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
commitab124e78b0271ddb904b761b31e5c9a0cf24e070 (patch)
tree0cf1447720c45721ed3d214a4eaaa6834bda155d
parent15748830d0fcd29294a1969a1012655e74908c1e (diff)
downloadFreeBSD-src-ab124e78b0271ddb904b761b31e5c9a0cf24e070.zip
FreeBSD-src-ab124e78b0271ddb904b761b31e5c9a0cf24e070.tar.gz
recording cvs-1.6 file death
-rw-r--r--HW.TROUBLE49
-rw-r--r--README69
-rw-r--r--eBones/acl/Makefile14
-rw-r--r--eBones/acl/acl_check.3183
-rw-r--r--eBones/acl/acl_files.c555
-rw-r--r--eBones/acl/acl_files.doc107
-rw-r--r--eBones/des/MISSING15
-rw-r--r--eBones/ext_srvtab/Makefile10
-rw-r--r--eBones/ext_srvtab/ext_srvtab.862
-rw-r--r--eBones/ext_srvtab/ext_srvtab.c176
-rw-r--r--eBones/kadmin/HOW-TO8
-rw-r--r--eBones/kadmin/Makefile19
-rw-r--r--eBones/kadmin/kadmin.c636
-rw-r--r--eBones/kadmin/kadmin_cmds.ct41
-rw-r--r--eBones/kadmind/HOW-TO267
-rw-r--r--eBones/kadmind/Makefile11
-rw-r--r--eBones/kadmind/admin_server.c474
-rw-r--r--eBones/kadmind/kadm_funcs.c381
-rw-r--r--eBones/kadmind/kadm_ser_wrap.c213
-rw-r--r--eBones/kadmind/kadm_server.c167
-rw-r--r--eBones/kadmind/kadm_server.h70
-rw-r--r--eBones/kadmind/kadmind.8117
-rw-r--r--eBones/kdb/Makefile11
-rw-r--r--eBones/kdb/krb_cache.c181
-rw-r--r--eBones/kdb/krb_dbm.c789
-rw-r--r--eBones/kdb/krb_kdb_utils.c148
-rw-r--r--eBones/kdb/krb_lib.c242
-rw-r--r--eBones/kdb/print_princ.c51
-rw-r--r--eBones/kdb_destroy/Makefile8
-rw-r--r--eBones/kdb_destroy/kdb_destroy.836
-rw-r--r--eBones/kdb_destroy/kdb_destroy.c66
-rw-r--r--eBones/kdb_edit/Makefile12
-rw-r--r--eBones/kdb_edit/kdb_edit.858
-rw-r--r--eBones/kdb_edit/kdb_edit.c477
-rw-r--r--eBones/kdb_edit/maketime.c85
-rw-r--r--eBones/kdb_edit/time.h45
-rw-r--r--eBones/kdb_init/Makefile10
-rw-r--r--eBones/kdb_init/kdb_init.845
-rw-r--r--eBones/kdb_init/kdb_init.c180
-rw-r--r--eBones/kdb_util/Makefile13
-rw-r--r--eBones/kdb_util/kdb_util.864
-rw-r--r--eBones/kdb_util/kdb_util.c523
-rw-r--r--eBones/kdestroy/Makefile11
-rw-r--r--eBones/kdestroy/kdestroy.c83
-rw-r--r--eBones/kerberos/Makefile11
-rw-r--r--eBones/kerberos/cr_err_reply.c97
-rw-r--r--eBones/kerberos/kerberos.c816
-rw-r--r--eBones/kinit/Makefile11
-rw-r--r--eBones/kinit/kinit.c224
-rw-r--r--eBones/klist/Makefile11
-rw-r--r--eBones/klist/klist.184
-rw-r--r--eBones/klist/klist.c288
-rw-r--r--eBones/kprop/Makefile11
-rw-r--r--eBones/kprop/kprop.c637
-rw-r--r--eBones/kprop/kprop.h55
-rw-r--r--eBones/kpropd/Makefile11
-rw-r--r--eBones/kpropd/kpropd.c453
-rw-r--r--eBones/krb/Makefile56
-rw-r--r--eBones/krb/add_ticket.c91
-rw-r--r--eBones/krb/create_auth_reply.c118
-rw-r--r--eBones/krb/create_ciph.c112
-rw-r--r--eBones/krb/create_death_packet.c65
-rw-r--r--eBones/krb/create_ticket.c132
-rw-r--r--eBones/krb/debug_decl.c20
-rw-r--r--eBones/krb/decomp_ticket.c126
-rw-r--r--eBones/krb/des_rw.c262
-rw-r--r--eBones/krb/dest_tkt.c92
-rw-r--r--eBones/krb/extract_ticket.c61
-rw-r--r--eBones/krb/fgetst.c42
-rw-r--r--eBones/krb/get_ad_tkt.c237
-rw-r--r--eBones/krb/get_admhst.c82
-rw-r--r--eBones/krb/get_cred.c63
-rw-r--r--eBones/krb/get_in_tkt.c286
-rw-r--r--eBones/krb/get_krbhst.c87
-rw-r--r--eBones/krb/get_krbrlm.c62
-rw-r--r--eBones/krb/get_phost.c55
-rw-r--r--eBones/krb/get_pw_tkt.c75
-rw-r--r--eBones/krb/get_request.c55
-rw-r--r--eBones/krb/get_svc_in_tkt.c77
-rw-r--r--eBones/krb/get_tf_fullname.c69
-rw-r--r--eBones/krb/get_tf_realm.c37
-rw-r--r--eBones/krb/getrealm.c106
-rw-r--r--eBones/krb/getst.c41
-rw-r--r--eBones/krb/in_tkt.c146
-rw-r--r--eBones/krb/k_gethostname.c71
-rw-r--r--eBones/krb/klog.c110
-rw-r--r--eBones/krb/kname_parse.c239
-rw-r--r--eBones/krb/kntoln.c63
-rw-r--r--eBones/krb/kparse.c776
-rw-r--r--eBones/krb/krb.3462
-rw-r--r--eBones/krb/krb_err.et257
-rw-r--r--eBones/krb/krb_err_txt.c280
-rw-r--r--eBones/krb/krb_get_in_tkt.c301
-rw-r--r--eBones/krb/krb_realmofhost.3161
-rw-r--r--eBones/krb/krb_sendauth.3348
-rw-r--r--eBones/krb/krb_set_tkt_string.343
-rw-r--r--eBones/krb/krbglue.c258
-rw-r--r--eBones/krb/kuserok.363
-rw-r--r--eBones/krb/kuserok.c199
-rw-r--r--eBones/krb/log.c125
-rw-r--r--eBones/krb/mk_err.c65
-rw-r--r--eBones/krb/mk_priv.c207
-rw-r--r--eBones/krb/mk_req.c198
-rw-r--r--eBones/krb/mk_safe.c171
-rw-r--r--eBones/krb/month_sname.c33
-rw-r--r--eBones/krb/netread.c50
-rw-r--r--eBones/krb/netwrite.c46
-rw-r--r--eBones/krb/one.c22
-rw-r--r--eBones/krb/pkt_cipher.c40
-rw-r--r--eBones/krb/pkt_clen.c58
-rw-r--r--eBones/krb/rd_err.c82
-rw-r--r--eBones/krb/rd_priv.c207
-rw-r--r--eBones/krb/rd_req.c331
-rw-r--r--eBones/krb/rd_safe.c183
-rw-r--r--eBones/krb/read_service_key.c124
-rw-r--r--eBones/krb/recvauth.c290
-rw-r--r--eBones/krb/save_credentials.c56
-rw-r--r--eBones/krb/send_to_kdc.c322
-rw-r--r--eBones/krb/sendauth.c259
-rw-r--r--eBones/krb/stime.c43
-rw-r--r--eBones/krb/tf_shm.c176
-rw-r--r--eBones/krb/tf_util.3151
-rw-r--r--eBones/krb/tf_util.c581
-rw-r--r--eBones/krb/tkt_string.c80
-rw-r--r--eBones/krb/util.c75
-rw-r--r--eBones/ksrvtgt/Makefile11
-rw-r--r--eBones/ksrvtgt/ksrvtgt.151
-rw-r--r--eBones/ksrvtgt/ksrvtgt.c62
-rw-r--r--eBones/ksrvutil/HOW-TO291
-rw-r--r--eBones/ksrvutil/Makefile9
-rw-r--r--eBones/ksrvutil/ksrvutil.c582
-rw-r--r--eBones/kstash/Makefile10
-rw-r--r--eBones/kstash/kstash.844
-rw-r--r--eBones/kstash/kstash.c94
-rw-r--r--eBones/libkadm/EXPORTABLE4
-rw-r--r--eBones/libkadm/Makefile24
-rw-r--r--eBones/libkadm/kadm.h164
-rw-r--r--eBones/libkadm/kadm_cli_wrap.c509
-rw-r--r--eBones/libkadm/kadm_err.et53
-rw-r--r--eBones/libkadm/kadm_stream.c286
-rw-r--r--eBones/libkadm/kadm_supp.c118
-rw-r--r--eBones/make_keypair/Makefile9
-rw-r--r--eBones/make_keypair/make_keypair.c134
-rw-r--r--eBones/man/acl_check.3183
-rw-r--r--eBones/man/ext_srvtab.862
-rw-r--r--eBones/man/kadmind.8117
-rw-r--r--eBones/man/kdb_destroy.836
-rw-r--r--eBones/man/kdb_edit.858
-rw-r--r--eBones/man/kdb_init.845
-rw-r--r--eBones/man/kdb_util.864
-rw-r--r--eBones/man/klist.184
-rw-r--r--eBones/man/krb.3462
-rw-r--r--eBones/man/krb_realmofhost.3161
-rw-r--r--eBones/man/krb_sendauth.3348
-rw-r--r--eBones/man/krb_set_tkt_string.343
-rw-r--r--eBones/man/ksrvtgt.151
-rw-r--r--eBones/man/kstash.844
-rw-r--r--eBones/man/kuserok.363
-rw-r--r--eBones/man/tf_util.3151
-rw-r--r--eBones/passwd/HOW-TO247
-rw-r--r--eBones/passwd/Makefile23
-rw-r--r--eBones/passwd/kpasswd.c223
-rw-r--r--eBones/register/Makefile14
-rw-r--r--eBones/register/register.c315
-rw-r--r--eBones/registerd/Makefile21
-rw-r--r--eBones/registerd/registerd.c354
-rw-r--r--eBones/usr.sbin/kadmin/Makefile11
-rw-r--r--eBones/usr.sbin/kadmin/admin_server.c474
-rw-r--r--eBones/usr.sbin/kadmin/kadm_funcs.c381
-rw-r--r--eBones/usr.sbin/kadmin/kadm_ser_wrap.c213
-rw-r--r--eBones/usr.sbin/kadmin/kadm_server.c167
-rw-r--r--eBones/usr.sbin/kadmin/kadm_server.h70
-rw-r--r--eBones/usr.sbin/kadmin/kadmind.8117
-rw-r--r--etc/adduser.conf12
-rw-r--r--etc/config/cleartmp4
-rw-r--r--etc/config/gated4
-rw-r--r--etc/config/kerberos4
-rw-r--r--etc/config/mountd.flags3
-rw-r--r--etc/config/named6
-rw-r--r--etc/config/nfsclient4
-rw-r--r--etc/config/nfsclient.flags4
-rw-r--r--etc/config/nfsserver4
-rw-r--r--etc/config/nfsserver.flags4
-rw-r--r--etc/config/nisclient4
-rw-r--r--etc/config/nisserver4
-rw-r--r--etc/config/quota5
-rw-r--r--etc/config/routed5
-rw-r--r--etc/config/routed.flags3
-rw-r--r--etc/config/rwhod4
-rw-r--r--etc/config/savecore4
-rw-r--r--etc/config/savecore.flags3
-rw-r--r--etc/config/sendmail4
-rw-r--r--etc/config/sendmail.flags3
-rw-r--r--etc/config/timed4
-rw-r--r--etc/config/timed.flags2
-rwxr-xr-xetc/etc.i386/EXTRACT_bin.sh18
-rwxr-xr-xetc/etc.i386/EXTRACT_secr.sh14
-rwxr-xr-xetc/etc.i386/EXTRACT_src.sh41
-rw-r--r--etc/etc.i386/README.1ST146
-rw-r--r--etc/etc.i386/README.INSTALL1011
-rw-r--r--etc/etc.i386/cdinst1.install1043
-rw-r--r--etc/etc.i386/cdinst1.profile71
-rwxr-xr-xetc/etc.i386/cpio.install20
-rw-r--r--etc/etc.i386/cpio.magic388
-rw-r--r--etc/etc.i386/cpio.rc102
-rw-r--r--etc/etc.i386/floppy.install_notes143
-rwxr-xr-xetc/etc.i386/inst1.install1042
-rw-r--r--etc/etc.i386/inst1.profile9
-rwxr-xr-xetc/etc.i386/inst2.install40
-rw-r--r--etc/etc.i386/inst2.profile440
-rw-r--r--etc/etc.i386/inst2.rc444
-rw-r--r--etc/etc.i386/install_notes1056
-rw-r--r--etc/etc.i386/kc.profile80
-rw-r--r--etc/manpath.config30
-rw-r--r--etc/myname1
-rw-r--r--etc/namedb/root.cache26
-rw-r--r--etc/passwd10
-rw-r--r--etc/rc.maint67
-rw-r--r--etc/rc.netstart141
-rw-r--r--etc/skey.access30
-rw-r--r--etc/userids1
-rw-r--r--games/x11/Makefile5
-rw-r--r--games/x11/xneko/Makefile11
-rw-r--r--games/x11/xneko/xneko.c1765
-rw-r--r--games/x11/xroach/Makefile11
-rw-r--r--games/x11/xroach/xroach.c602
-rw-r--r--gnu/Makefile.inc4
-rw-r--r--gnu/games/Makefile5
-rw-r--r--gnu/games/Makefile.inc9
-rw-r--r--gnu/games/chess/Makefile15
-rw-r--r--gnu/games/chess/Xchess/Makefile136
-rw-r--r--gnu/games/chess/Xchess/XCircle.c162
-rw-r--r--gnu/games/chess/Xchess/board.c179
-rw-r--r--gnu/games/chess/Xchess/button.c337
-rw-r--r--gnu/games/chess/Xchess/clock.c291
-rw-r--r--gnu/games/chess/Xchess/control.c515
-rw-r--r--gnu/games/chess/Xchess/jail.c327
-rw-r--r--gnu/games/chess/Xchess/message.c101
-rw-r--r--gnu/games/chess/Xchess/parse.c386
-rw-r--r--gnu/games/chess/Xchess/popup.c112
-rw-r--r--gnu/games/chess/Xchess/program.c204
-rw-r--r--gnu/games/chess/Xchess/record.c315
-rw-r--r--gnu/games/chess/Xchess/scrollText.c1877
-rw-r--r--gnu/games/chess/Xchess/scrollText/scrollText.c1858
-rw-r--r--gnu/games/chess/Xchess/std.c427
-rw-r--r--gnu/games/chess/Xchess/std.h105
-rw-r--r--gnu/games/chess/Xchess/valid.c264
-rw-r--r--gnu/games/chess/Xchess/window.c952
-rw-r--r--gnu/games/chess/Xchess/xchess.c205
-rw-r--r--gnu/games/chess/chess.6161
-rw-r--r--gnu/games/chess/gnuchess.c2307
-rw-r--r--gnu/games/chess/gnuchess.h97
-rw-r--r--gnu/games/chess/move.c357
-rw-r--r--gnu/games/chess/move.h81
-rw-r--r--gnu/games/chess/nondsp.c791
-rw-r--r--gnu/games/chess/uxdsp.c933
-rw-r--r--gnu/lib/libg++/libg++/regex.cc2757
-rw-r--r--gnu/lib/libmalloc/free.c210
-rw-r--r--gnu/lib/libmalloc/realloc.c146
-rw-r--r--gnu/lib/libreadline/README.FreeBSD21
-rw-r--r--gnu/lib/libreadline/doc/ChangeLog8
-rw-r--r--gnu/lib/libreadline/doc/hist.texinfo113
-rw-r--r--gnu/lib/libreadline/doc/history.info744
-rw-r--r--gnu/lib/libreadline/doc/inc-hist.texi155
-rw-r--r--gnu/lib/libreadline/doc/readline.info74
-rw-r--r--gnu/lib/libreadline/doc/readline.info-11322
-rw-r--r--gnu/lib/libreadline/doc/readline.info-2978
-rw-r--r--gnu/lib/libreadline/doc/rlman.texinfo111
-rw-r--r--gnu/lib/libreadline/doc/texindex.c1666
-rw-r--r--gnu/lib/libreadline/readline/chardefs.h89
-rw-r--r--gnu/lib/libreadline/readline/history.h149
-rw-r--r--gnu/lib/libreadline/readline/keymaps.h91
-rw-r--r--gnu/lib/libreadline/readline/readline.h267
-rw-r--r--gnu/lib/libreadline/readline/tilde.h38
-rw-r--r--gnu/lib/libreadline/sysdep.h37
-rw-r--r--gnu/lib/libreadline/tcsh_hack.readme27
-rw-r--r--gnu/lib/libregex/doc/Makefile.in92
-rw-r--r--gnu/lib/libregex/doc/regex.aux136
-rw-r--r--gnu/lib/libregex/doc/regex.cps152
-rw-r--r--gnu/lib/libregex/doc/regex.info2836
-rw-r--r--gnu/lib/libregex/doc/regex.texi3138
-rw-r--r--gnu/lib/libregex/test/TAGS373
-rw-r--r--gnu/libexec/uucp/common_sources/conf.h444
-rw-r--r--gnu/libexec/uucp/common_sources/tcp.c477
-rw-r--r--gnu/libexec/uucp/common_sources/tli.c582
-rwxr-xr-xgnu/libexec/uucp/contrib/uureroute91
-rw-r--r--gnu/libexec/uucp/sample/call20
-rw-r--r--gnu/libexec/uucp/sample/config88
-rw-r--r--gnu/libexec/uucp/sample/dial35
-rw-r--r--gnu/libexec/uucp/sample/dialcode19
-rw-r--r--gnu/libexec/uucp/sample/passwd18
-rw-r--r--gnu/libexec/uucp/sample/port41
-rw-r--r--gnu/libexec/uucp/sample/sys144
-rw-r--r--gnu/libexec/uucp/sample/sys251
-rw-r--r--gnu/usr.bin/as/Makefile.gnu356
-rw-r--r--gnu/usr.bin/as/README.gnu133
-rw-r--r--gnu/usr.bin/as/append.c37
-rw-r--r--gnu/usr.bin/as/config/a.out.gnu.h261
-rw-r--r--gnu/usr.bin/as/config/i386-opcode.h806
-rw-r--r--gnu/usr.bin/as/config/i386.c1946
-rw-r--r--gnu/usr.bin/as/config/i386.h296
-rw-r--r--gnu/usr.bin/as/doc/Makefile.in172
-rw-r--r--gnu/usr.bin/as/doc/a29k-coff.m414
-rw-r--r--gnu/usr.bin/as/doc/a29k.m49
-rw-r--r--gnu/usr.bin/as/doc/all.m420
-rw-r--r--gnu/usr.bin/as/doc/as.texinfo6730
-rw-r--r--gnu/usr.bin/as/doc/config.status5
-rw-r--r--gnu/usr.bin/as/doc/configure.in34
-rw-r--r--gnu/usr.bin/as/doc/gen.m414
-rw-r--r--gnu/usr.bin/as/doc/h8.m415
-rw-r--r--gnu/usr.bin/as/doc/i80386.m412
-rw-r--r--gnu/usr.bin/as/doc/i960.m416
-rw-r--r--gnu/usr.bin/as/doc/m680x0.m48
-rw-r--r--gnu/usr.bin/as/doc/none.m457
-rw-r--r--gnu/usr.bin/as/doc/pretex.m4268
-rw-r--r--gnu/usr.bin/as/doc/sparc.m48
-rw-r--r--gnu/usr.bin/as/doc/vax.m47
-rw-r--r--gnu/usr.bin/as/doc/vintage.m411
-rw-r--r--gnu/usr.bin/as/flonum-const.c157
-rw-r--r--gnu/usr.bin/as/flonum-copy.c76
-rw-r--r--gnu/usr.bin/as/md.h57
-rw-r--r--gnu/usr.bin/as/objrecdef.h255
-rw-r--r--gnu/usr.bin/awk/regex.c5070
-rw-r--r--gnu/usr.bin/awk/regex.h505
-rw-r--r--gnu/usr.bin/cpio/mt.1107
-rw-r--r--gnu/usr.bin/cpio/rmt.c281
-rw-r--r--gnu/usr.bin/cvs/lib/regex.h479
-rw-r--r--gnu/usr.bin/dialog/inputbox.c279
-rw-r--r--gnu/usr.bin/diff/regex.c5171
-rw-r--r--gnu/usr.bin/diff/regex.h490
-rw-r--r--gnu/usr.bin/gdb/ChangeLog4887
-rw-r--r--gnu/usr.bin/gdb/Gdbinit15
-rw-r--r--gnu/usr.bin/gdb/Makefile.dist371
-rw-r--r--gnu/usr.bin/gdb/Projects114
-rw-r--r--gnu/usr.bin/gdb/README.gnu142
-rw-r--r--gnu/usr.bin/gdb/XGdbinit.samp15
-rw-r--r--gnu/usr.bin/gdb/Xgdb.ad8
-rw-r--r--gnu/usr.bin/gdb/bfd/seclet.c185
-rw-r--r--gnu/usr.bin/gdb/bfd/seclet.h55
-rw-r--r--gnu/usr.bin/gdb/blockframe.c622
-rw-r--r--gnu/usr.bin/gdb/breakpoint.c1383
-rw-r--r--gnu/usr.bin/gdb/command.c856
-rw-r--r--gnu/usr.bin/gdb/command.h77
-rw-r--r--gnu/usr.bin/gdb/config/Makefile.i3866
-rw-r--r--gnu/usr.bin/gdb/config/default-dep.c585
-rw-r--r--gnu/usr.bin/gdb/config/i386-dep.c1275
-rw-r--r--gnu/usr.bin/gdb/config/i386-pinsn.c1812
-rw-r--r--gnu/usr.bin/gdb/config/i386bsd-dep.c1889
-rw-r--r--gnu/usr.bin/gdb/config/m-i386-sv32.h28
-rw-r--r--gnu/usr.bin/gdb/config/m-i386.h394
-rw-r--r--gnu/usr.bin/gdb/config/m-i386bsd.h375
-rw-r--r--gnu/usr.bin/gdb/config/m-i386g-sv32.h28
-rw-r--r--gnu/usr.bin/gdb/config/m-i386gas.h37
-rw-r--r--gnu/usr.bin/gdb/copying.c215
-rw-r--r--gnu/usr.bin/gdb/core.c581
-rw-r--r--gnu/usr.bin/gdb/cplus-dem.c996
-rw-r--r--gnu/usr.bin/gdb/dbxread.c5727
-rw-r--r--gnu/usr.bin/gdb/defs.h122
-rw-r--r--gnu/usr.bin/gdb/doc/ChangeLog783
-rw-r--r--gnu/usr.bin/gdb/doc/Makefile.in327
-rw-r--r--gnu/usr.bin/gdb/doc/a4rc.sed11
-rwxr-xr-xgnu/usr.bin/gdb/doc/config.status5
-rw-r--r--gnu/usr.bin/gdb/doc/configure.in7
-rw-r--r--gnu/usr.bin/gdb/doc/gdb.info213
-rw-r--r--gnu/usr.bin/gdb/doc/gdb.info-11304
-rw-r--r--gnu/usr.bin/gdb/doc/gdb.info-21165
-rw-r--r--gnu/usr.bin/gdb/doc/gdb.info-31264
-rw-r--r--gnu/usr.bin/gdb/doc/gdb.info-41349
-rw-r--r--gnu/usr.bin/gdb/doc/gdb.info-51215
-rw-r--r--gnu/usr.bin/gdb/doc/gdb.info-61220
-rw-r--r--gnu/usr.bin/gdb/doc/gdb.info-71233
-rw-r--r--gnu/usr.bin/gdb/doc/gdb.info-8657
-rw-r--r--gnu/usr.bin/gdb/doc/libgdb.texinfo1471
-rw-r--r--gnu/usr.bin/gdb/doc/lpsrc.sed13
-rw-r--r--gnu/usr.bin/gdb/doc/psrc.sed13
-rw-r--r--gnu/usr.bin/gdb/doc/refcard.ps798
-rw-r--r--gnu/usr.bin/gdb/doc/refcard.tex646
-rw-r--r--gnu/usr.bin/gdb/environ.c185
-rw-r--r--gnu/usr.bin/gdb/environ.h39
-rw-r--r--gnu/usr.bin/gdb/eval.c1065
-rw-r--r--gnu/usr.bin/gdb/expprint.c324
-rw-r--r--gnu/usr.bin/gdb/expread.y1782
-rw-r--r--gnu/usr.bin/gdb/expression.h191
-rw-r--r--gnu/usr.bin/gdb/findvar.c579
-rw-r--r--gnu/usr.bin/gdb/frame.h115
-rw-r--r--gnu/usr.bin/gdb/gdb.13
-rw-r--r--gnu/usr.bin/gdb/gdb/c-exp.tab.c2648
-rw-r--r--gnu/usr.bin/gdb/gdb/ch-exp.tab.c2854
-rw-r--r--gnu/usr.bin/gdb/gdb/freebsd-solib.c1469
-rw-r--r--gnu/usr.bin/gdb/gdb/m2-exp.tab.c1991
-rw-r--r--gnu/usr.bin/gdb/gdb/putenv.c111
-rw-r--r--gnu/usr.bin/gdb/gdb/regex.c1744
-rw-r--r--gnu/usr.bin/gdb/gdb/regex.h181
-rw-r--r--gnu/usr.bin/gdb/gdb/y.tab.h65
-rw-r--r--gnu/usr.bin/gdb/getpagesize.h25
-rw-r--r--gnu/usr.bin/gdb/infcmd.c1204
-rw-r--r--gnu/usr.bin/gdb/inferior.h142
-rw-r--r--gnu/usr.bin/gdb/inflow.c569
-rw-r--r--gnu/usr.bin/gdb/infrun.c1459
-rw-r--r--gnu/usr.bin/gdb/kgdb_proto.h63
-rw-r--r--gnu/usr.bin/gdb/main.c2241
-rw-r--r--gnu/usr.bin/gdb/ngdb.i386/Makefile27
-rw-r--r--gnu/usr.bin/gdb/obstack.c313
-rw-r--r--gnu/usr.bin/gdb/obstack.h372
-rw-r--r--gnu/usr.bin/gdb/printcmd.c1867
-rw-r--r--gnu/usr.bin/gdb/readline/ChangeLog98
-rw-r--r--gnu/usr.bin/gdb/readline/Makefile.gnu114
-rw-r--r--gnu/usr.bin/gdb/readline/chardefs.h50
-rw-r--r--gnu/usr.bin/gdb/readline/emacs_keymap.c472
-rw-r--r--gnu/usr.bin/gdb/readline/funmap.c217
-rw-r--r--gnu/usr.bin/gdb/readline/history.c1462
-rw-r--r--gnu/usr.bin/gdb/readline/history.h108
-rw-r--r--gnu/usr.bin/gdb/readline/keymaps.c172
-rw-r--r--gnu/usr.bin/gdb/readline/keymaps.h53
-rw-r--r--gnu/usr.bin/gdb/readline/readline.c5557
-rw-r--r--gnu/usr.bin/gdb/readline/readline.h161
-rw-r--r--gnu/usr.bin/gdb/readline/vi_keymap.c484
-rw-r--r--gnu/usr.bin/gdb/readline/vi_mode.c875
-rw-r--r--gnu/usr.bin/gdb/regex.c1738
-rw-r--r--gnu/usr.bin/gdb/regex.h185
-rw-r--r--gnu/usr.bin/gdb/remote-sl.c10
-rw-r--r--gnu/usr.bin/gdb/remote.c626
-rw-r--r--gnu/usr.bin/gdb/source.c1166
-rw-r--r--gnu/usr.bin/gdb/stab.def115
-rw-r--r--gnu/usr.bin/gdb/stack.c960
-rw-r--r--gnu/usr.bin/gdb/symmisc.c584
-rw-r--r--gnu/usr.bin/gdb/symseg.h523
-rw-r--r--gnu/usr.bin/gdb/symtab.c2473
-rw-r--r--gnu/usr.bin/gdb/symtab.h384
-rw-r--r--gnu/usr.bin/gdb/utils.c1096
-rw-r--r--gnu/usr.bin/gdb/valarith.c690
-rw-r--r--gnu/usr.bin/gdb/valops.c1418
-rw-r--r--gnu/usr.bin/gdb/valprint.c1430
-rw-r--r--gnu/usr.bin/gdb/value.h212
-rw-r--r--gnu/usr.bin/gdb/values.c1059
-rw-r--r--gnu/usr.bin/gdb/version.c20
-rw-r--r--gnu/usr.bin/gdb/wait.h81
-rw-r--r--gnu/usr.bin/gdb/xgdb/Makefile33
-rw-r--r--gnu/usr.bin/gdb/xgdb/xgdb.c700
-rw-r--r--gnu/usr.bin/grep/regex.c4987
-rw-r--r--gnu/usr.bin/grep/regex.h490
-rw-r--r--gnu/usr.bin/gzip/gzexe.in151
-rw-r--r--gnu/usr.bin/ld/TODO4
-rw-r--r--gnu/usr.bin/man/catman/catman36
-rw-r--r--gnu/usr.bin/man/catman/catman.sh43
-rw-r--r--gnu/usr.bin/man/makewhatis/makewhatis.sh120
-rw-r--r--gnu/usr.bin/perl/perl/usub/Makefile16
-rw-r--r--gnu/usr.bin/pr/Makefile11
-rw-r--r--gnu/usr.bin/pr/error.c117
-rw-r--r--gnu/usr.bin/pr/getopt.c757
-rw-r--r--gnu/usr.bin/pr/getopt1.c187
-rw-r--r--gnu/usr.bin/pr/pr.1103
-rw-r--r--gnu/usr.bin/pr/pr.c1920
-rw-r--r--gnu/usr.bin/pr/system.h200
-rw-r--r--gnu/usr.bin/pr/version.c13
-rw-r--r--gnu/usr.bin/pr/xmalloc.c88
-rw-r--r--gnu/usr.bin/ptx/regex.h490
-rw-r--r--gnu/usr.bin/send-pr/send-pr.info1604
-rw-r--r--gnu/usr.bin/send-pr/send-pr.texi657
-rw-r--r--gnu/usr.bin/tar/regex.c4923
-rw-r--r--gnu/usr.bin/yppush/yp.h292
-rw-r--r--gnu/usr.bin/yppush/yp_clnt.c216
-rw-r--r--gnu/usr.bin/yppush/yp_xdr.c477
-rw-r--r--gnu/usr.bin/yppush/ypclnt.c128
-rw-r--r--gnu/usr.bin/yppush/yppush_s.c156
-rw-r--r--gnu/usr.sbin/yppasswdd/yppasswd_xdr.c57
-rw-r--r--gnu/usr.sbin/ypserv/Makefile20
-rw-r--r--gnu/usr.sbin/ypserv/Makefile.yp394
-rw-r--r--gnu/usr.sbin/ypserv/dnslookup.c112
-rw-r--r--gnu/usr.sbin/ypserv/mknetid36
-rw-r--r--gnu/usr.sbin/ypserv/server.c1384
-rw-r--r--gnu/usr.sbin/ypserv/svc_run.c85
-rw-r--r--gnu/usr.sbin/ypserv/system.h67
-rw-r--r--gnu/usr.sbin/ypserv/yp.h611
-rw-r--r--gnu/usr.sbin/ypserv/yp_svc.c430
-rw-r--r--gnu/usr.sbin/ypserv/yp_xdr.c415
-rw-r--r--gnu/usr.sbin/ypserv/ypserv.8293
-rw-r--r--include/skey.h36
-rw-r--r--lib/csu/i386/gmon.c330
-rw-r--r--lib/csu/i386/gmon.h106
-rw-r--r--lib/libc/i386/gen/divsi3.S50
-rw-r--r--lib/libc/i386/gen/fixdfsi.S24
-rw-r--r--lib/libc/i386/gen/fixunsdfsi.S68
-rw-r--r--lib/libc/i386/gen/udivsi3.S50
-rw-r--r--lib/libc/locale/common_rune.h3
-rw-r--r--lib/libc/locale/common_setlocale.c64
-rw-r--r--lib/libc/locale/common_setlocale.h14
-rw-r--r--lib/libc/locale/read_runemagi.c133
-rw-r--r--lib/libc/locale/startup_setlocale.c198
-rw-r--r--lib/libforms/Makefile.orig12
-rw-r--r--lib/libforms/examples/test.c94
-rw-r--r--lib/libforms/examples/tform.c18
-rw-r--r--lib/libforms/fields.c678
-rw-r--r--lib/libforms/forms.c.orig502
-rw-r--r--lib/libforms/forms.h.orig126
-rw-r--r--lib/libforms/internal.h.orig38
-rw-r--r--lib/libforms/lex.c1606
-rw-r--r--lib/libforms/menu.c59
-rw-r--r--lib/libforms/parser.c1022
-rw-r--r--lib/libforms/y.tab.h46
-rw-r--r--lib/libforms/yacc.y149
-rw-r--r--lib/libftp/FtpAbort.c47
-rw-r--r--lib/libftp/FtpArchie.c63
-rw-r--r--lib/libftp/FtpBye.c45
-rw-r--r--lib/libftp/FtpClose.c26
-rw-r--r--lib/libftp/FtpCommand.c61
-rw-r--r--lib/libftp/FtpConnect.c72
-rw-r--r--lib/libftp/FtpCopy.c50
-rw-r--r--lib/libftp/FtpData.c92
-rw-r--r--lib/libftp/FtpDebug.c94
-rw-r--r--lib/libftp/FtpFilenameChecker.c43
-rw-r--r--lib/libftp/FtpFull.c142
-rw-r--r--lib/libftp/FtpGetHost.c44
-rw-r--r--lib/libftp/FtpGood.c55
-rw-r--r--lib/libftp/FtpIO.c174
-rw-r--r--lib/libftp/FtpInit.c41
-rw-r--r--lib/libftp/FtpLibrary.h268
-rw-r--r--lib/libftp/FtpLogin.c34
-rw-r--r--lib/libftp/FtpMessage.c130
-rw-r--r--lib/libftp/FtpMove.c25
-rw-r--r--lib/libftp/FtpNumber.c22
-rw-r--r--lib/libftp/FtpOpenDir.c27
-rw-r--r--lib/libftp/FtpPasv.c100
-rw-r--r--lib/libftp/FtpPort.c32
-rw-r--r--lib/libftp/FtpPwd.c34
-rw-r--r--lib/libftp/FtpRetr.c84
-rw-r--r--lib/libftp/FtpSize.c35
-rw-r--r--lib/libftp/FtpStor.c58
-rw-r--r--lib/libftp/FtpSyscalls.c35
-rw-r--r--lib/libftp/FtpType.c26
-rw-r--r--lib/libftp/Ftpfopen.c98
-rw-r--r--lib/libftp/Makefile20
-rw-r--r--lib/libftp/doc/example.c51
-rw-r--r--lib/libftp/utils/Makefile34
-rw-r--r--lib/libftp/utils/cdefs.h111
-rw-r--r--lib/libftp/utils/ftptry.c633
-rw-r--r--lib/libftp/utils/glob.c850
-rw-r--r--lib/libftp/utils/glob.h89
-rw-r--r--lib/libftp/utils/mirror.c92
-rw-r--r--lib/libftp/utils/readline.c961
-rw-r--r--lib/libftp/utils/uftp.c824
-rw-r--r--lib/libftp/utils/uftpcmd.c1202
-rw-r--r--lib/libncurses/TESTS/bs.c1252
-rw-r--r--lib/libncurses/TESTS/gdc.c202
-rw-r--r--lib/libncurses/lib_deleteln.c49
-rw-r--r--lib/libncurses/lib_insertln.c50
-rw-r--r--lib/libncurses/ncurses.h497
-rw-r--r--lib/libncurses/termcap.h52
-rw-r--r--lib/librpc/Makefile.inc4
-rw-r--r--lib/librpc/rpc/Makefile18
-rw-r--r--lib/libskey/authfile.c177
-rw-r--r--lib/libskey/md4.c336
-rw-r--r--lib/libskey/md4.h47
-rw-r--r--lib/libterm/Makefile15
-rw-r--r--lib/rpcsvc/Makefile31
-rw-r--r--libexec/atrun/atrun.877
-rw-r--r--libexec/atrun/atrun.h33
-rw-r--r--libexec/bugfiler/Makefile17
-rw-r--r--libexec/getty/fbtab_stuff.c93
-rw-r--r--libexec/kpasswdd/Makefile20
-rw-r--r--lkm/socksys/Makefile9
-rw-r--r--lkm/socksys/socksys.c69
-rwxr-xr-xrelease/scripts/adduser.sh183
-rwxr-xr-xrelease/scripts/bininst.sh86
-rw-r--r--release/scripts/extract_DES.sh19
-rw-r--r--release/scripts/extract_bin.sh27
-rw-r--r--release/scripts/extract_compat1x.sh9
-rw-r--r--release/scripts/extract_des.sh19
-rw-r--r--release/scripts/extract_dict.sh9
-rw-r--r--release/scripts/extract_games.sh9
-rw-r--r--release/scripts/extract_info.sh9
-rw-r--r--release/scripts/extract_manpages.sh9
-rw-r--r--release/scripts/extract_proflibs.sh9
-rw-r--r--release/scripts/extract_secure.sh19
-rw-r--r--release/scripts/extract_src.sh17
-rwxr-xr-xrelease/scripts/extract_xf86311.sh136
-rw-r--r--release/scripts/instdist.sh565
-rw-r--r--release/scripts/miscfuncs.sh141
-rw-r--r--release/scripts/mkchecksums.sh24
-rw-r--r--release/scripts/mkxf86extract.sh61
-rw-r--r--release/scripts/netinst.sh210
-rw-r--r--release/scripts/setup.sh66
-rw-r--r--release/sysinstall/help/da_DK.ISO8859-1/README98
-rw-r--r--release/sysinstall/help/da_DK.ISO8859-1/configure.hlp16
-rw-r--r--release/sysinstall/help/da_DK.ISO8859-1/language.hlp13
-rw-r--r--release/sysinstall/help/da_DK.ISO8859-1/usage.hlp56
-rw-r--r--release/sysinstall/help/da_DK.ISO_8859-1/README98
-rw-r--r--release/sysinstall/help/da_DK.ISO_8859-1/configure.hlp16
-rw-r--r--release/sysinstall/help/da_DK.ISO_8859-1/language.hlp13
-rw-r--r--release/sysinstall/help/da_DK.ISO_8859-1/usage.hlp56
-rw-r--r--release/sysinstall/help/de_DE.ISO8859-1/README106
-rw-r--r--release/sysinstall/help/de_DE.ISO8859-1/RELNOTES766
-rw-r--r--release/sysinstall/help/de_DE.ISO8859-1/configure.hlp18
-rw-r--r--release/sysinstall/help/de_DE.ISO8859-1/drives.hlp29
-rw-r--r--release/sysinstall/help/de_DE.ISO8859-1/install.hlp450
-rw-r--r--release/sysinstall/help/de_DE.ISO8859-1/language.hlp17
-rw-r--r--release/sysinstall/help/de_DE.ISO8859-1/media.hlp30
-rw-r--r--release/sysinstall/help/de_DE.ISO8859-1/network_device.hlp56
-rw-r--r--release/sysinstall/help/de_DE.ISO8859-1/partition.hlp85
-rw-r--r--release/sysinstall/help/de_DE.ISO8859-1/slice.hlp28
-rw-r--r--release/sysinstall/help/de_DE.ISO8859-1/tcp.hlp32
-rw-r--r--release/sysinstall/help/de_DE.ISO8859-1/usage.hlp57
-rw-r--r--release/sysinstall/help/de_DE.ISO_8859-1/README106
-rw-r--r--release/sysinstall/help/de_DE.ISO_8859-1/RELNOTES766
-rw-r--r--release/sysinstall/help/de_DE.ISO_8859-1/configure.hlp18
-rw-r--r--release/sysinstall/help/de_DE.ISO_8859-1/drives.hlp29
-rw-r--r--release/sysinstall/help/de_DE.ISO_8859-1/install.hlp450
-rw-r--r--release/sysinstall/help/de_DE.ISO_8859-1/language.hlp17
-rw-r--r--release/sysinstall/help/de_DE.ISO_8859-1/media.hlp30
-rw-r--r--release/sysinstall/help/de_DE.ISO_8859-1/network_device.hlp56
-rw-r--r--release/sysinstall/help/de_DE.ISO_8859-1/partition.hlp85
-rw-r--r--release/sysinstall/help/de_DE.ISO_8859-1/slice.hlp28
-rw-r--r--release/sysinstall/help/de_DE.ISO_8859-1/tcp.hlp32
-rw-r--r--release/sysinstall/help/de_DE.ISO_8859-1/usage.hlp57
-rw-r--r--release/sysinstall/help/en_US.ISO8859-1/README104
-rw-r--r--release/sysinstall/help/en_US.ISO8859-1/RELNOTES747
-rw-r--r--release/sysinstall/help/en_US.ISO8859-1/XF86.hlp500
-rw-r--r--release/sysinstall/help/en_US.ISO8859-1/configure.hlp14
-rw-r--r--release/sysinstall/help/en_US.ISO8859-1/distributions.hlp88
-rw-r--r--release/sysinstall/help/en_US.ISO8859-1/drives.hlp28
-rw-r--r--release/sysinstall/help/en_US.ISO8859-1/hardware.hlp384
-rw-r--r--release/sysinstall/help/en_US.ISO8859-1/install.hlp447
-rw-r--r--release/sysinstall/help/en_US.ISO8859-1/language.hlp14
-rw-r--r--release/sysinstall/help/en_US.ISO8859-1/media.hlp29
-rw-r--r--release/sysinstall/help/en_US.ISO8859-1/network_device.hlp54
-rw-r--r--release/sysinstall/help/en_US.ISO8859-1/options.hlp95
-rw-r--r--release/sysinstall/help/en_US.ISO8859-1/partition.hlp77
-rw-r--r--release/sysinstall/help/en_US.ISO8859-1/slice.hlp28
-rw-r--r--release/sysinstall/help/en_US.ISO8859-1/tcp.hlp27
-rw-r--r--release/sysinstall/help/en_US.ISO8859-1/usage.hlp54
-rw-r--r--release/sysinstall/help/en_US.ISO_8859-1/README104
-rw-r--r--release/sysinstall/help/en_US.ISO_8859-1/RELNOTES747
-rw-r--r--release/sysinstall/help/en_US.ISO_8859-1/XF86.hlp500
-rw-r--r--release/sysinstall/help/en_US.ISO_8859-1/configure.hlp14
-rw-r--r--release/sysinstall/help/en_US.ISO_8859-1/distributions.hlp88
-rw-r--r--release/sysinstall/help/en_US.ISO_8859-1/drives.hlp28
-rw-r--r--release/sysinstall/help/en_US.ISO_8859-1/hardware.hlp384
-rw-r--r--release/sysinstall/help/en_US.ISO_8859-1/install.hlp447
-rw-r--r--release/sysinstall/help/en_US.ISO_8859-1/language.hlp14
-rw-r--r--release/sysinstall/help/en_US.ISO_8859-1/media.hlp29
-rw-r--r--release/sysinstall/help/en_US.ISO_8859-1/network_device.hlp54
-rw-r--r--release/sysinstall/help/en_US.ISO_8859-1/options.hlp95
-rw-r--r--release/sysinstall/help/en_US.ISO_8859-1/partition.hlp77
-rw-r--r--release/sysinstall/help/en_US.ISO_8859-1/slice.hlp28
-rw-r--r--release/sysinstall/help/en_US.ISO_8859-1/tcp.hlp27
-rw-r--r--release/sysinstall/help/en_US.ISO_8859-1/usage.hlp54
-rw-r--r--release/sysinstall/help/es_ES.ISO8859-1/README108
-rw-r--r--release/sysinstall/help/es_ES.ISO8859-1/configure.hlp18
-rw-r--r--release/sysinstall/help/es_ES.ISO8859-1/language.hlp15
-rw-r--r--release/sysinstall/help/es_ES.ISO8859-1/usage.hlp57
-rw-r--r--release/sysinstall/help/es_ES.ISO_8859-1/README108
-rw-r--r--release/sysinstall/help/es_ES.ISO_8859-1/configure.hlp18
-rw-r--r--release/sysinstall/help/es_ES.ISO_8859-1/language.hlp15
-rw-r--r--release/sysinstall/help/es_ES.ISO_8859-1/usage.hlp57
-rw-r--r--release/sysinstall/help/fr_FR.ISO8859-1/README104
-rw-r--r--release/sysinstall/help/fr_FR.ISO8859-1/configure.hlp16
-rw-r--r--release/sysinstall/help/fr_FR.ISO8859-1/language.hlp13
-rw-r--r--release/sysinstall/help/fr_FR.ISO8859-1/usage.hlp54
-rw-r--r--release/sysinstall/help/fr_FR.ISO_8859-1/README104
-rw-r--r--release/sysinstall/help/fr_FR.ISO_8859-1/configure.hlp16
-rw-r--r--release/sysinstall/help/fr_FR.ISO_8859-1/language.hlp13
-rw-r--r--release/sysinstall/help/fr_FR.ISO_8859-1/usage.hlp54
-rw-r--r--release/sysinstall/help/it_IT.ISO8859-1/README107
-rw-r--r--release/sysinstall/help/it_IT.ISO8859-1/configure.hlp16
-rw-r--r--release/sysinstall/help/it_IT.ISO8859-1/language.hlp15
-rw-r--r--release/sysinstall/help/it_IT.ISO8859-1/usage.hlp56
-rw-r--r--release/sysinstall/help/it_IT.ISO_8859-1/README107
-rw-r--r--release/sysinstall/help/it_IT.ISO_8859-1/configure.hlp16
-rw-r--r--release/sysinstall/help/it_IT.ISO_8859-1/language.hlp15
-rw-r--r--release/sysinstall/help/it_IT.ISO_8859-1/usage.hlp56
-rw-r--r--release/sysinstall/help/ja_JP.JIS/README97
-rw-r--r--release/sysinstall/help/ja_JP.JIS/configure.hlp13
-rw-r--r--release/sysinstall/help/ja_JP.JIS/language.hlp12
-rw-r--r--release/sysinstall/help/ja_JP.JIS/usage.hlp50
-rw-r--r--release/sysinstall/help/ja_JP.ROMAJI/README105
-rw-r--r--release/sysinstall/help/ja_JP.ROMAJI/configure.hlp16
-rw-r--r--release/sysinstall/help/ja_JP.ROMAJI/language.hlp14
-rw-r--r--release/sysinstall/help/ja_JP.ROMAJI/usage.hlp52
-rw-r--r--release/sysinstall/help/nl_NL.ISO8859-1/README106
-rw-r--r--release/sysinstall/help/nl_NL.ISO8859-1/configure.hlp16
-rw-r--r--release/sysinstall/help/nl_NL.ISO8859-1/language.hlp15
-rw-r--r--release/sysinstall/help/nl_NL.ISO8859-1/usage.hlp56
-rw-r--r--release/sysinstall/help/nl_NL.ISO_8859-1/README106
-rw-r--r--release/sysinstall/help/nl_NL.ISO_8859-1/configure.hlp16
-rw-r--r--release/sysinstall/help/nl_NL.ISO_8859-1/language.hlp15
-rw-r--r--release/sysinstall/help/nl_NL.ISO_8859-1/usage.hlp56
-rw-r--r--release/sysinstall/help/no_NO.ISO8859-1/README107
-rw-r--r--release/sysinstall/help/no_NO.ISO8859-1/configure.hlp16
-rw-r--r--release/sysinstall/help/no_NO.ISO8859-1/language.hlp13
-rw-r--r--release/sysinstall/help/no_NO.ISO8859-1/usage.hlp56
-rw-r--r--release/sysinstall/help/no_NO.ISO_8859-1/README107
-rw-r--r--release/sysinstall/help/no_NO.ISO_8859-1/configure.hlp16
-rw-r--r--release/sysinstall/help/no_NO.ISO_8859-1/language.hlp13
-rw-r--r--release/sysinstall/help/no_NO.ISO_8859-1/usage.hlp56
-rw-r--r--release/sysinstall/help/ru_SU.KOI8-R/README109
-rw-r--r--release/sysinstall/help/ru_SU.KOI8-R/configure.hlp16
-rw-r--r--release/sysinstall/help/ru_SU.KOI8-R/language.hlp15
-rw-r--r--release/sysinstall/help/ru_SU.KOI8-R/usage.hlp60
-rw-r--r--release/sysinstall/help/sv_SE.ISO8859-1/README114
-rw-r--r--release/sysinstall/help/sv_SE.ISO8859-1/configure.hlp15
-rw-r--r--release/sysinstall/help/sv_SE.ISO8859-1/language.hlp14
-rw-r--r--release/sysinstall/help/sv_SE.ISO8859-1/usage.hlp49
-rw-r--r--release/sysinstall/help/sv_SE.ISO_8859-1/README114
-rw-r--r--release/sysinstall/help/sv_SE.ISO_8859-1/configure.hlp15
-rw-r--r--release/sysinstall/help/sv_SE.ISO_8859-1/language.hlp14
-rw-r--r--release/sysinstall/help/sv_SE.ISO_8859-1/usage.hlp49
-rw-r--r--sbin/bsdlabel/disklabel.5.5384
-rw-r--r--sbin/fastboot/Makefile12
-rw-r--r--sbin/fastboot/fastboot.sh38
-rw-r--r--sbin/fastboot/fasthalt.sh38
-rw-r--r--sbin/ft/Makefile8
-rw-r--r--sbin/ft/ft.886
-rw-r--r--sbin/ft/ft.c517
-rw-r--r--sbin/ft/ftecc.c480
-rw-r--r--sbin/ip_mroute_mod/Makefile9
-rw-r--r--sbin/ipfw/ipfirewall.4206
-rw-r--r--sbin/ipfw/ipfw.1527
-rw-r--r--sbin/slattach/uucplock.c143
-rwxr-xr-xsbin/startslip/example/sldown.sh3
-rwxr-xr-xsbin/startslip/example/slip.sh4
-rwxr-xr-xsbin/startslip/example/slup.sh9
-rw-r--r--sbin/sysinstall/Makefile51
-rw-r--r--sbin/sysinstall/bootarea.c112
-rw-r--r--sbin/sysinstall/bootarea.h24
-rw-r--r--sbin/sysinstall/bteasy17.uu15
-rw-r--r--sbin/sysinstall/dev2c.sh80
-rw-r--r--sbin/sysinstall/disk.h96
-rw-r--r--sbin/sysinstall/editor.c118
-rw-r--r--sbin/sysinstall/editor.h27
-rw-r--r--sbin/sysinstall/exec.c86
-rw-r--r--sbin/sysinstall/label.c379
-rw-r--r--sbin/sysinstall/label.h52
-rw-r--r--sbin/sysinstall/main.c100
-rw-r--r--sbin/sysinstall/mbr.c477
-rw-r--r--sbin/sysinstall/mbr.h82
-rw-r--r--sbin/sysinstall/ourcurses.c38
-rw-r--r--sbin/sysinstall/rtermcap.c14
-rw-r--r--sbin/sysinstall/stage0.c107
-rw-r--r--sbin/sysinstall/stage1.c229
-rw-r--r--sbin/sysinstall/stage2.c235
-rw-r--r--sbin/sysinstall/stage3.c74
-rw-r--r--sbin/sysinstall/stage4.c30
-rw-r--r--sbin/sysinstall/stage5.c52
-rw-r--r--sbin/sysinstall/sysinstall.c835
-rw-r--r--sbin/sysinstall/sysinstall.h148
-rw-r--r--sbin/sysinstall/termcap.c61
-rw-r--r--sbin/sysinstall/utils.c349
-rw-r--r--secure/bin/Makefile6
-rw-r--r--secure/bin/Makefile.inc5
-rw-r--r--secure/bin/ed/Makefile13
-rw-r--r--secure/libexec/Makefile6
-rw-r--r--secure/sbin/Makefile6
-rw-r--r--secure/sbin/Makefile.inc6
-rw-r--r--secure/sbin/init/Makefile12
-rw-r--r--share/FAQ/CONTRIB.FreeBSD245
-rw-r--r--share/FAQ/DISKSPACE.FAQ265
-rw-r--r--share/FAQ/Diskless.FAQ130
-rw-r--r--share/FAQ/FreeBSD-1.1.FAQ987
-rw-r--r--share/FAQ/FreeBSD-1.X/FreeBSD-1.1.FAQ987
-rw-r--r--share/FAQ/FreeBSD-1.X/Systems-1.1.FAQ266
-rw-r--r--share/FAQ/FreeBSD.FAQ1304
-rw-r--r--share/FAQ/HW.TROUBLE58
-rw-r--r--share/FAQ/MIRROR.SITES107
-rw-r--r--share/FAQ/Makefile28
-rw-r--r--share/FAQ/NEW_FOR_2_08
-rw-r--r--share/FAQ/NFS.FAQ77
-rw-r--r--share/FAQ/PORTS.FAQ211
-rwxr-xr-xshare/FAQ/PPP.doc368
-rw-r--r--share/FAQ/README55
-rw-r--r--share/FAQ/README-2.075
-rw-r--r--share/FAQ/REGISTER.FreeBSD85
-rw-r--r--share/FAQ/RELNOTES.FreeBSD624
-rw-r--r--share/FAQ/Slip.FAQ190
-rw-r--r--share/FAQ/Systems-1.1.FAQ266
-rw-r--r--share/FAQ/Systems.FAQ59
-rw-r--r--share/FAQ/TROUBLESHOOTING185
-rw-r--r--share/FAQ/Text/CONTRIB.FreeBSD278
-rw-r--r--share/FAQ/Text/ESDI.FAQ187
-rw-r--r--share/FAQ/Text/FreeBSD.FAQ1307
-rw-r--r--share/FAQ/Text/HW.TROUBLE58
-rw-r--r--share/FAQ/Text/MIRROR.SITES145
-rw-r--r--share/FAQ/Text/README104
-rw-r--r--share/FAQ/Text/REGISTER.FreeBSD85
-rw-r--r--share/FAQ/Text/RELNOTES.FreeBSD723
-rw-r--r--share/FAQ/Text/ROADMAP58
-rw-r--r--share/FAQ/Text/TROUBLESHOOTING185
-rw-r--r--share/FAQ/Text/UUCP_Internals.FAQ1603
-rw-r--r--share/FAQ/Text/ctm.FAQ191
-rw-r--r--share/FAQ/Text/current-policy.FAQ170
-rw-r--r--share/FAQ/Text/diskspace.FAQ267
-rw-r--r--share/FAQ/Text/kernel-debug.FAQ417
-rw-r--r--share/FAQ/Text/kernel-memory.FAQ72
-rw-r--r--share/FAQ/Text/mailing-list.FAQ105
-rw-r--r--share/FAQ/Text/nfs.FAQ79
-rw-r--r--share/FAQ/Text/ports.FAQ246
-rw-r--r--share/FAQ/Text/ppp.FAQ369
-rw-r--r--share/FAQ/Text/slip.FAQ192
-rw-r--r--share/FAQ/Text/slip_server.FAQ433
-rw-r--r--share/FAQ/Text/submitters.FAQ167
-rw-r--r--share/FAQ/Text/sup.FAQ91
-rw-r--r--share/FAQ/Text/systems.FAQ59
-rw-r--r--share/FAQ/UUCP_Internals.FAQ1603
-rw-r--r--share/FAQ/ctm.FAQ191
-rw-r--r--share/FAQ/current-policy.FAQ170
-rw-r--r--share/FAQ/diskspace.FAQ267
-rw-r--r--share/FAQ/extras/ports-supfile26
-rw-r--r--share/FAQ/extras/secure-stable-supfile2
-rw-r--r--share/FAQ/extras/secure-supfile2
-rw-r--r--share/FAQ/extras/stable-supfile15
-rw-r--r--share/FAQ/extras/standard-supfile15
-rw-r--r--share/FAQ/help.html15
-rw-r--r--share/FAQ/index.html40
-rw-r--r--share/FAQ/kerberos_setup.latex326
-rw-r--r--share/FAQ/kernel-debug.FAQ417
-rw-r--r--share/FAQ/mailing-list.FAQ105
-rw-r--r--share/FAQ/nfs.FAQ79
-rw-r--r--share/FAQ/ports-supfile7
-rw-r--r--share/FAQ/ports.FAQ246
-rwxr-xr-xshare/FAQ/ppp.FAQ369
-rw-r--r--share/FAQ/slip-dialup190
-rw-r--r--share/FAQ/slip.FAQ192
-rw-r--r--share/FAQ/slip_server.FAQ433
-rw-r--r--share/FAQ/standard-supfile14
-rw-r--r--share/FAQ/submitters.FAQ167
-rw-r--r--share/FAQ/sup.FAQ90
-rw-r--r--share/FAQ/systems.FAQ59
-rw-r--r--share/FAQ/tutorials.html109
-rw-r--r--share/examples/etc/aliases30
-rw-r--r--share/examples/etc/csh.cshrc1
-rw-r--r--share/examples/etc/csh.login7
-rw-r--r--share/examples/etc/csh.logout1
-rw-r--r--share/examples/etc/dm.conf19
-rw-r--r--share/examples/etc/fbtab2
-rw-r--r--share/examples/etc/ftpusers4
-rw-r--r--share/examples/etc/gettytab173
-rw-r--r--share/examples/etc/group17
-rw-r--r--share/examples/etc/host.conf7
-rw-r--r--share/examples/etc/hosts28
-rw-r--r--share/examples/etc/hosts.equiv2
-rw-r--r--share/examples/etc/hosts.lpd1
-rw-r--r--share/examples/etc/inetd.conf45
-rw-r--r--share/examples/etc/login.access44
-rw-r--r--share/examples/etc/manpath.config31
-rw-r--r--share/examples/etc/motd4
-rw-r--r--share/examples/etc/myname1
-rw-r--r--share/examples/etc/netstart46
-rw-r--r--share/examples/etc/networks16
-rw-r--r--share/examples/etc/phones12
-rw-r--r--share/examples/etc/printcap4
-rw-r--r--share/examples/etc/protocols28
-rw-r--r--share/examples/etc/rc242
-rw-r--r--share/examples/etc/rc.local23
-rw-r--r--share/examples/etc/rc.serial91
-rw-r--r--share/examples/etc/remote50
-rw-r--r--share/examples/etc/rpc34
-rw-r--r--share/examples/etc/security41
-rw-r--r--share/examples/etc/services180
-rw-r--r--share/examples/etc/shells6
-rw-r--r--share/examples/etc/syslog.conf9
-rw-r--r--share/examples/etc/ttys53
-rw-r--r--share/examples/lkm/vfs/Makefile48
-rw-r--r--share/examples/lkm/vfs/README107
-rw-r--r--share/examples/lkm/vfs/module/Makefile71
-rw-r--r--share/examples/lkm/vfs/module/kernfsmod.c127
-rwxr-xr-xshare/examples/syscons/setrus17
-rw-r--r--share/man/man4/apm.4146
-rw-r--r--share/man/man4/man4.i386/com.4102
-rw-r--r--share/man/man4/man4.i386/fd.491
-rw-r--r--share/man/man4/man4.i386/lpa.462
-rw-r--r--share/man/man4/meteor.4771
-rw-r--r--share/man/man4/pt.4.orig0
-rw-r--r--share/man/man4/uha.474
-rw-r--r--share/man/man4/wd.464
-rw-r--r--share/man/man4/worm.4.orig0
-rw-r--r--share/syscons/fonts/alt-8x14.fnt83
-rw-r--r--share/syscons/fonts/alt-8x16.fnt95
-rw-r--r--share/syscons/fonts/alt-8x8.fnt49
-rw-r--r--share/syscons/fonts/altb-8x16.fnt95
-rw-r--r--share/syscons/fonts/altc-8x16.fnt95
-rw-r--r--share/syscons/fonts/koi8-8x14.fnt83
-rw-r--r--share/syscons/fonts/koi8-8x16.fnt95
-rw-r--r--share/syscons/fonts/koi8-8x8.fnt49
-rw-r--r--share/syscons/fonts/koi8b-8x16.fnt95
-rw-r--r--share/syscons/fonts/koi8c-8x16.fnt95
-rw-r--r--share/syscons/scrnmaps/default60
-rw-r--r--share/syscons/scrnmaps/koi8-r2cp866.scm9
-rw-r--r--share/termcap/terminfo_extentions.doc476
-rw-r--r--share/timedef/data/ru_SU.KOI8-R78
-rw-r--r--share/tmac/Makefile25
-rw-r--r--share/zoneinfo/datfiles/asia331
-rw-r--r--share/zoneinfo/datfiles/europe318
-rw-r--r--sys/conf/nfsswapvmunix.c153
-rw-r--r--sys/gnu/i386/fpemul/bde_trapinfo.mail35
-rw-r--r--sys/gnu/i386/isa/scd.c1530
-rw-r--r--sys/gnu/i386/isa/scdreg.h145
-rw-r--r--sys/gnu/i386/scd.c1530
-rw-r--r--sys/gnu/i386/scdreg.h145
-rw-r--r--sys/gnu/misc/aha274x.seq1064
-rw-r--r--sys/gnu/misc/aha274x_seq.c355
-rw-r--r--sys/gnu/misc/aic7770/COPYING339
-rw-r--r--sys/gnu/misc/aic7770/COPYRIGHT16
-rw-r--r--sys/gnu/misc/aic7770/README94
-rw-r--r--sys/gnu/misc/aic7770/README-FIRST19
-rw-r--r--sys/gnu/misc/aic7770/aic7770.154
-rw-r--r--sys/gnu/misc/aic7770/aic7770.c584
-rw-r--r--sys/gnu/misc/aic7770/aic7770.seq1157
-rw-r--r--sys/gnu/misc/aic7770/aic7770_seq.h351
-rw-r--r--sys/gnu/misc/aic7xxx/COPYING339
-rw-r--r--sys/gnu/misc/aic7xxx/COPYRIGHT16
-rw-r--r--sys/gnu/misc/aic7xxx/README94
-rw-r--r--sys/gnu/misc/aic7xxx/README-FIRST19
-rw-r--r--sys/gnu/misc/aic7xxx/aic7770_seq.h351
-rw-r--r--sys/gnu/misc/aic7xxx/aic7xxx.170
-rw-r--r--sys/gnu/misc/aic7xxx/aic7xxx.c643
-rw-r--r--sys/gnu/misc/aic7xxx/aic7xxx.seq1253
-rw-r--r--sys/gnu/scsi/nic5000.c1476
-rw-r--r--sys/gnu/scsi/scsi_nic.h53
-rw-r--r--sys/i386/boot/README.386BSD151
-rw-r--r--sys/i386/boot/README.MACH210
-rw-r--r--sys/i386/boot/asm.S276
-rw-r--r--sys/i386/boot/asm.h144
-rw-r--r--sys/i386/boot/bios.S332
-rw-r--r--sys/i386/boot/boot.c288
-rw-r--r--sys/i386/boot/boot.h41
-rw-r--r--sys/i386/boot/boot2.S186
-rw-r--r--sys/i386/boot/disk.c281
-rw-r--r--sys/i386/boot/io.c225
-rw-r--r--sys/i386/boot/netboot/509.doc21
-rw-r--r--sys/i386/boot/netboot/ether.c1243
-rw-r--r--sys/i386/boot/netboot/ether.h262
-rw-r--r--sys/i386/boot/netboot/if_epreg.h388
-rw-r--r--sys/i386/boot/netboot/netboot.doc42
-rw-r--r--sys/i386/boot/rmaouthdr6
-rw-r--r--sys/i386/boot/serialboot/Makefile59
-rw-r--r--sys/i386/boot/serialboot/bios.S366
-rw-r--r--sys/i386/boot/serialboot/boot.c284
-rw-r--r--sys/i386/boot/start.S292
-rw-r--r--sys/i386/boot/sys.c242
-rw-r--r--sys/i386/boot/table.c131
-rw-r--r--sys/i386/conf/ATAPI123
-rw-r--r--sys/i386/conf/BOOTFLP70
-rw-r--r--sys/i386/conf/CORBIN116
-rw-r--r--sys/i386/conf/GENERICAH92
-rw-r--r--sys/i386/conf/GENERICBT87
-rw-r--r--sys/i386/conf/IPFIREWALL101
-rw-r--r--sys/i386/conf/MINI56
-rw-r--r--sys/i386/conf/PCVT103
-rw-r--r--sys/i386/conf/SYSCONS87
-rw-r--r--sys/i386/eisa/eisadevs.c53
-rw-r--r--sys/i386/ibcs2/README.iBCS2124
-rw-r--r--sys/i386/ibcs2/ibcs2.h280
-rw-r--r--sys/i386/ibcs2/ibcs2_dummy.c169
-rw-r--r--sys/i386/ibcs2/ibcs2_file.c525
-rw-r--r--sys/i386/ibcs2/ibcs2_stats.c274
-rw-r--r--sys/i386/include/dkio.h54
-rw-r--r--sys/i386/include/eflags.h54
-rw-r--r--sys/i386/include/ioctl_pc.h797
-rw-r--r--sys/i386/include/pio.h48
-rw-r--r--sys/i386/isa/aha1742.c1273
-rw-r--r--sys/i386/isa/aha2742.c1710
-rw-r--r--sys/i386/isa/aic7770.c154
-rw-r--r--sys/i386/isa/bt742a.c1764
-rw-r--r--sys/i386/isa/creative.h129
-rw-r--r--sys/i386/isa/ic/ncr_5380.h216
-rw-r--r--sys/i386/isa/if_is.c1102
-rw-r--r--sys/i386/isa/if_isreg.h129
-rw-r--r--sys/i386/isa/if_zereg.h859
-rw-r--r--sys/i386/isa/iso8859.font1254
-rw-r--r--sys/i386/isa/matcd.c2286
-rw-r--r--sys/i386/isa/matcd.h183
-rw-r--r--sys/i386/isa/matcd/matcd.h198
-rw-r--r--sys/i386/isa/npx.c.orig555
-rw-r--r--sys/i386/isa/options.h250
-rw-r--r--sys/i386/isa/pas.c974
-rw-r--r--sys/i386/isa/pcic.c246
-rw-r--r--sys/i386/isa/readMBR.c236
-rw-r--r--sys/i386/isa/sound/HOWTO_MIDI51
-rw-r--r--sys/i386/isa/sound/RELNOTES38
-rw-r--r--sys/i386/isa/sound/RELNOTES.Linux255
-rw-r--r--sys/i386/isa/sound/Readme.freebsd36
-rw-r--r--sys/i386/isa/sound/gustest/Makefile16
-rw-r--r--sys/i386/isa/sound/gustest/Readme67
-rw-r--r--sys/i386/isa/sound/gustest/gmidi.h134
-rw-r--r--sys/i386/isa/sound/gustest/gmod.c1589
-rw-r--r--sys/i386/isa/sound/gustest/gpatinfo.c176
-rw-r--r--sys/i386/isa/sound/gustest/gusload.c352
-rw-r--r--sys/i386/isa/sound/gustest/midithru.c328
-rw-r--r--sys/i386/isa/sound/gustest/pmtest.c412
-rw-r--r--sys/i386/isa/sound/midi.c205
-rw-r--r--sys/i386/isa/sound/pro_midi.c188
-rw-r--r--sys/i386/isa/sound/pss.c925
-rw-r--r--sys/i386/isa/sound/pss.h371
-rw-r--r--sys/i386/isa/sound/soundcard.h1045
-rw-r--r--sys/i386/isa/sound/ultrasound.h121
-rw-r--r--sys/i386/isa/sound/vat_audio.c387
-rw-r--r--sys/i386/isa/sound/vat_audioio.h111
-rw-r--r--sys/i386/pci/README.de48
-rw-r--r--sys/i386/pci/README.de-le33
-rw-r--r--sys/i386/pci/aic7870.c95
-rw-r--r--sys/i386/pci/dc21040.h214
-rw-r--r--sys/i386/pci/if_de.c1155
-rw-r--r--sys/i386/pci/ncr.c6505
-rw-r--r--sys/i386/pci/ncr_reg.h547
-rw-r--r--sys/i386/pci/ncrcontrol.c1630
-rw-r--r--sys/i386/pci/ncrreg.h547
-rw-r--r--sys/i386/pci/ncrstat.c1630
-rw-r--r--sys/i386/pci/pci.c778
-rw-r--r--sys/i386/pci/pci.h70
-rw-r--r--sys/i386/pci/pci_config.c80
-rw-r--r--sys/i386/pci/pci_device.h110
-rw-r--r--sys/i386/pci/pci_intel.c296
-rw-r--r--sys/i386/pci/pcibios.c276
-rw-r--r--sys/i386/pci/pcibios.h209
-rw-r--r--sys/i386/pci/pcireg.h423
-rw-r--r--sys/i386/pci/pcisupport.c397
-rw-r--r--sys/kern/subr_rmap.c82
-rw-r--r--sys/libkern/libkern.h65
-rw-r--r--sys/libkern/strtol.c128
-rw-r--r--sys/miscfs/devfs/devfs_back.c467
-rw-r--r--sys/miscfs/devfs/devfs_front.c476
-rw-r--r--sys/sys/map.h61
-rw-r--r--sys/sys/trace.h122
-rw-r--r--sys/ufs/ufs/lockf.h80
-rw-r--r--sys/ufs/ufs/ufs_lockf.c708
-rw-r--r--sys/vm/vm_user.c130
-rw-r--r--sys/vm/vm_vmio.c389
-rw-r--r--usr.bin/at/at.1216
-rw-r--r--usr.bin/at/pathnames.h42
-rw-r--r--usr.bin/colldef/data/lt_LN.ISO8859-119
-rw-r--r--usr.bin/colldef/data/lt_LN.ISO_8859-119
-rw-r--r--usr.bin/colldef/data/ru_SU.CP86620
-rw-r--r--usr.bin/colldef/data/ru_SU.KOI8-R20
-rw-r--r--usr.bin/f2c/f77.script114
-rw-r--r--usr.bin/f2c/index127
-rw-r--r--usr.bin/f2c/index.html138
-rw-r--r--usr.bin/f2c/notice23
-rw-r--r--usr.bin/f2c/readme145
-rw-r--r--usr.bin/f2c/xsum.c237
-rw-r--r--usr.bin/grep/egrep/Makefile18
-rw-r--r--usr.bin/key/README.WZV100
-rw-r--r--usr.bin/key/skey.159
-rw-r--r--usr.bin/login/login_skey.c105
-rw-r--r--usr.bin/mklocale/POSIX33
-rw-r--r--usr.bin/mklocale/data/ja_JP.EUC158
-rw-r--r--usr.bin/mklocale/data/lt_LN.ASCII28
-rw-r--r--usr.bin/mklocale/data/lt_LN.ISO8859-135
-rw-r--r--usr.bin/mklocale/data/lt_LN.ISO_8859-139
-rw-r--r--usr.bin/mklocale/data/ru_SU.CP86642
-rw-r--r--usr.bin/mklocale/data/ru_SU.KOI8-R39
-rw-r--r--usr.bin/mklocale/iso_8859_135
-rw-r--r--usr.bin/mklocale/ja_JP.EUC158
-rw-r--r--usr.bin/mklocale/ru_SU.KOI8-R39
-rw-r--r--usr.bin/passwd/yppasswd.1115
-rw-r--r--usr.bin/timedef/data/ru_SU.KOI8-R76
-rw-r--r--usr.bin/tip/pathnames.h44
-rw-r--r--usr.bin/tip/tip.c608
-rw-r--r--usr.bin/tip/tip.h280
-rw-r--r--usr.bin/tip/tipout.c166
-rw-r--r--usr.bin/tip/uucplock.c102
-rw-r--r--usr.bin/uucp/acucntrl/Makefile10
-rw-r--r--usr.bin/uucp/acucntrl/acucntrl.8164
-rw-r--r--usr.bin/uucp/uupoll/Makefile10
-rw-r--r--usr.bin/uucp/uusnap/Makefile8
-rw-r--r--usr.bin/watch/Makefile6
-rw-r--r--usr.bin/watch/snp.449
-rw-r--r--usr.bin/watch/watch.877
-rw-r--r--usr.bin/watch/watch.c404
-rw-r--r--usr.sbin/adduser/adduser195
-rw-r--r--usr.sbin/adduser/adduser.175
-rw-r--r--usr.sbin/adduser/adduser.conf12
-rw-r--r--usr.sbin/adduser/adduser.sh195
-rw-r--r--usr.sbin/bootpd/Makefile15
-rw-r--r--usr.sbin/bootpd/getether.c374
-rw-r--r--usr.sbin/bootpd/hwaddr.c294
-rw-r--r--usr.sbin/bootpd/rtmsg.c236
-rw-r--r--usr.sbin/bootpef/Makefile17
-rw-r--r--usr.sbin/bootpgw/Makefile14
-rw-r--r--usr.sbin/bootptest/Makefile15
-rw-r--r--usr.sbin/dbsym/Makefile6
-rw-r--r--usr.sbin/dbsym/dbsym.c255
-rw-r--r--usr.sbin/named/tools/nsquery/Makefile7
-rw-r--r--usr.sbin/named/tools/nsquery/nsquery.c140
-rw-r--r--usr.sbin/named/tools/nstest/Makefile7
-rw-r--r--usr.sbin/named/tools/nstest/nstest.c423
-rw-r--r--usr.sbin/pkg_install/+COMMENT1
-rw-r--r--usr.sbin/pkg_install/+CONTENTS2
-rw-r--r--usr.sbin/pkg_install/+DESC5
-rwxr-xr-xusr.sbin/pkg_install/pkg158
-rw-r--r--usr.sbin/rarpd/ether_addr.c201
-rw-r--r--usr.sbin/rtprio/rtprio.2106
-rw-r--r--usr.sbin/swapinfo/Makefile12
-rw-r--r--usr.sbin/swapinfo/README38
-rw-r--r--usr.sbin/swapinfo/devname.c75
-rw-r--r--usr.sbin/swapinfo/swapinfo.153
-rw-r--r--usr.sbin/swapinfo/swapinfo.c214
-rw-r--r--usr.sbin/tcpdump/tcpdump/tcplex.l144
-rw-r--r--usr.sbin/tzsetup/tzsetup.sh181
-rw-r--r--usr.sbin/xntpd/xntpres/Makefile28
1098 files changed, 0 insertions, 324595 deletions
diff --git a/HW.TROUBLE b/HW.TROUBLE
deleted file mode 100644
index a30967e..0000000
--- a/HW.TROUBLE
+++ /dev/null
@@ -1,49 +0,0 @@
-$Id$
-
-This file lists hardware, which doesn't do what it should do.
-
-Due to the nature of FreeBSD, we do not have the resources to test all
-possible kinds of hardware. We do however every now and then find, buy
-or hear about hardware which doesn't work with FreeBSD or in general.
-
-This is that list.
-
-To be added to this list, a piece of hardware has to:
- A: not do what it claims.
-or
- B: not do what common sense would expect it to.
-
-Only if performance claims are wildly of the mark will it be listed here.
-
-All entries must have a date and a mail-address associated with them, to
-reflect when and by whom they were added.
-For multifunctional devices, please indicate if other parts of the device
-work OK, or are untested.
-For mutual incompabilities, list both devices.
-For SCSI and IDE-devices, list the string seen on boot of FreeBSD, if
-possible, and trade name.
-Infer format from other entries, Keep sorted by first line.
-
-Thankyou.
-
----
-Controller, Data Technology DTC2280, "PC/AT Super I/O Card"
-IDE interface can be set to secondary address, but doesn't work there. Suspect
-Interrupt isn't moved along. Works fine on primary address. Other parts of
-card not tested.
-19940828 phk@freefall.cdrom.com
----
-IDE-disk, <Maxtor 7345 AT>, "Maxtor 7345"
-Cannot coexist on the same IDE-controller with a <WDC AC2540H>, "Western
-Digital Caviar 2540" disk. Jumpers not exhaustively experimented with, as
-neither of the companies make sufficient information available. Disk works
-fine when alone on IDE-controller.
-19940828 phk@freefall.cdrom.com
----
-IDE-disk, <WDC AC2540H>, "Western Digital Caviar 2540"
-Cannot coexist on the same IDE-controller with a <Maxtor 7345 AT>, "Maxtor
-7345" disk. Jumpers not exhaustively experimented with, as neither of the
-companies make sufficient information available. Disk works fine when alone
-on IDE-controller.
-19940828 phk@freefall.cdrom.com
----
diff --git a/README b/README
deleted file mode 100644
index f085cd7..0000000
--- a/README
+++ /dev/null
@@ -1,69 +0,0 @@
- -----------------------------------------
- FreeBSD 2.0 --- ALPHA Release , ,
- ----------------------------------------- /( )`
- \ \___ / |
-Welcome to the ALPHA release of FreeBSD 2.0 - the /- _ `-/ '
-first public snapshot of our new 4.4BSD Lite based (/\/ \ \ /\
-operating system environment. This install proce- / / | ` \
-dure is also at the ALPHA stage, and contains only O O ) / |
-the minimum functionality required by an `-^--'`< '
-*EXPERIENCED* person to install the system. (_.) _ ) /
-It is our hope, of course, that the feedback `.___/` /
-provided from this snapshot will `-----' /
-greatly assist us in making the release <----. __ / __ \
-of 2.0 much more user friendly. Your <----|====O)))==) \) /====
-comments and criticisms are very <----' `--' `.__,' \
-valuable to us, so please don't hesitate | |
-in contacting us! Full details on where and \ / /\
-how to provide feedback are given below. ______( (_ / \______/
- ,' ,-----' |
-This install procedure is ALPHA code, and `--{__________)
-may very possibly *DESTROY* the contents of your
-ENTIRE DISK! Please do not proceed with this installation
-unless you've adequately backed up your data first!
-
-If any errors occur during this installation, you can see them
-by toggling over to the alternate screen - type ALT-F2 to switch
-over, ALT-F1 to switch back to the install screen. The debugging
-output on the second screen may be very valuable to us in understanding
-your bug report, so please be sure to take note of it when reporting
-any failures in the installation! Thanks!
-
-Menus and scrolling output windows may be traversed with the arrow
-and Page Up/Page Down keys. To suspend the installation at any point,
-hit ESC twice. Hitting TAB will move the focus to different controls.
-If you've ever dealt with a DOS installation, you'll know how to deal
-with this.
-
-For a more complete description of what's new in this release, please
-see the release notes.
-
-For more documentation on this system, it is recommended that you purchase
-the 4.4BSD Document Set from O'Reilly Associates and the USENIX Association.
-ISBN 1-56592-082-1 We have no connection with O'Reilly, we're just
-satisfied customers!
-
-Have fun, and please let us know of any problems you encounter with
-this release!
-
-Comments should be sent to:
-
- hackers@FreeBSD.org
-
-Bug reports should be sent using the `send-pr' utility, if you
-were able to get the system installed, otherwise to:
-
- bugs@FreeBSD.org
-
-And general questions to:
-
- questions@FreeBSD.org
-
-
-Please have patience if your questions are not answered right away -
-this is an especially busy time for us, and our volunteer resources
-are often strained to the limit (if not somewhat past!).
-
-Thanks!
-
- The FreeBSD Project
diff --git a/eBones/acl/Makefile b/eBones/acl/Makefile
deleted file mode 100644
index c015eaa..0000000
--- a/eBones/acl/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-# From: @(#)Makefile 5.1 (Berkeley) 6/25/90
-# $Id: Makefile,v 1.4 1995/07/18 16:34:47 mark Exp $
-
-LIB= acl
-SHLIB_MAJOR= 2
-SHLIB_MINOR= 0
-CFLAGS+=-DDEBUG -DKERBEROS -I${.CURDIR}/../include -Wall
-SRCS= acl_files.c
-MAN3= acl_check.3
-MLINKS= acl_check.3 acl_canonicalize_principal.3 \
- acl_check.3 acl_exact_match.3 acl_check.3 acl_add.3 \
- acl_check.3 acl_delete.3 acl_check.3 acl_initialize.3
-
-.include <bsd.lib.mk>
diff --git a/eBones/acl/acl_check.3 b/eBones/acl/acl_check.3
deleted file mode 100644
index 2e5129c..0000000
--- a/eBones/acl/acl_check.3
+++ /dev/null
@@ -1,183 +0,0 @@
-.\" from: acl_check.3,v 4.1 89/01/23 11:06:54 jtkohl Exp $
-.\" $Id: acl_check.3,v 1.1.1.1 1994/09/30 14:50:05 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH ACL_CHECK 3 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-acl_canonicalize_principal, acl_check, acl_exact_match, acl_add,
-acl_delete, acl_initialize \- Access control list routines
-.SH SYNOPSIS
-.nf
-.nj
-.ft B
-cc <files> \-lacl \-lkrb
-.PP
-.ft B
-#include <kerberosIV/krb.h>
-.PP
-.ft B
-acl_canonicalize_principal(principal, buf)
-char *principal;
-char *buf;
-.PP
-.ft B
-acl_check(acl, principal)
-char *acl;
-char *principal;
-.PP
-.ft B
-acl_exact_match(acl, principal)
-char *acl;
-char *principal;
-.PP
-.ft B
-acl_add(acl, principal)
-char *acl;
-char *principal;
-.PP
-.ft B
-acl_delete(acl, principal)
-char *acl;
-char *principal;
-.PP
-.ft B
-acl_initialize(acl_file, mode)
-char *acl_file;
-int mode;
-.fi
-.ft R
-.SH DESCRIPTION
-.SS Introduction
-.PP
-An access control list (ACL) is a list of principals, where each
-principal is represented by a text string which cannot contain
-whitespace. The library allows application programs to refer to named
-access control lists to test membership and to atomically add and
-delete principals using a natural and intuitive interface. At
-present, the names of access control lists are required to be Unix
-filenames, and refer to human-readable Unix files; in the future, when
-a networked ACL server is implemented, the names may refer to a
-different namespace specific to the ACL service.
-.PP
-.SS Principal Names
-.PP
-Principal names have the form
-.nf
-.in +5n
-<name>[.<instance>][@<realm>]
-.in -5n
-e.g.:
-.in +5n
-asp
-asp.root
-asp@ATHENA.MIT.EDU
-asp.@ATHENA.MIT.EDU
-asp.root@ATHENA.MIT.EDU
-.in -5n
-.fi
-It is possible for principals to be underspecified. If an instance is
-missing, it is assumed to be "". If realm is missing, it is assumed
-to be the local realm as determined by
-.IR krb_get_lrealm (3).
-The canonical form contains all of name, instance,
-and realm; the acl_add and acl_delete routines will always
-leave the file in that form. Note that the canonical form of
-asp@ATHENA.MIT.EDU is actually asp.@ATHENA.MIT.EDU.
-.SS Routines
-.PP
-.I acl_canonicalize_principal
-stores the canonical form of
-.I principal
-in
-.IR buf .
-.I Buf
-must contain enough
-space to store a principal, given the limits on the sizes of name,
-instance, and realm specified as ANAME_SZ, INST_SZ, and REALM_SZ,
-respectively, in
-.IR /usr/include/kerberosIV/krb.h .
-.PP
-.I acl_check
-returns nonzero if
-.I principal
-appears in
-.IR acl .
-Returns 0 if principal
-does not appear in acl, or if an error occurs. Canonicalizes
-principal before checking, and allows the ACL to contain wildcards. The
-only supported wildcards are entries of the form
-name.*@realm, *.*@realm, and *.*@*. An asterisk matches any value for the
-its component field. For example, "jtkohl.*@*" would match principal
-jtkohl, with any instance and any realm.
-.PP
-.I acl_exact_match
-performs like
-.IR acl_check ,
-but does no canonicalization or wildcard matching.
-.PP
-.I acl_add
-atomically adds
-.I principal
-to
-.IR acl .
-Returns 0 if successful, nonzero otherwise. It is considered a failure
-if
-.I principal
-is already in
-.IR acl .
-This routine will canonicalize
-.IR principal ,
-but will treat wildcards literally.
-.PP
-.I acl_delete
-atomically deletes
-.I principal
-from
-.IR acl .
-Returns 0 if successful,
-nonzero otherwise. It is considered a failure if
-.I principal
-is not
-already in
-.IR acl .
-This routine will canonicalize
-.IR principal ,
-but will treat wildcards literally.
-.PP
-.I acl_initialize
-initializes
-.IR acl_file .
-If the file
-.I acl_file
-does not exist,
-.I acl_initialize
-creates it with mode
-.IR mode .
-If the file
-.I acl_file
-exists,
-.I acl_initialize
-removes all members. Returns 0 if successful,
-nonzero otherwise. WARNING: Mode argument is likely to change with
-the eventual introduction of an ACL service.
-.SH NOTES
-In the presence of concurrency, there is a very small chance that
-.I acl_add
-or
-.I acl_delete
-could report success even though it would have
-had no effect. This is a necessary side effect of using lock files
-for concurrency control rather than flock(2), which is not supported
-by NFS.
-.PP
-The current implementation caches ACLs in memory in a hash-table
-format for increased efficiency in checking membership; one effect of
-the caching scheme is that one file descriptor will be kept open for
-each ACL cached, up to a maximum of 8.
-.SH SEE ALSO
-kerberos(3), krb_get_lrealm(3)
-.SH AUTHOR
-James Aspnes (MIT Project Athena)
diff --git a/eBones/acl/acl_files.c b/eBones/acl/acl_files.c
deleted file mode 100644
index a3e1f68..0000000
--- a/eBones/acl/acl_files.c
+++ /dev/null
@@ -1,555 +0,0 @@
-/*
- *
- * Copyright 1987,1989 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * from: acl_files.c,v 4.4 89/12/19 13:30:53 jtkohl Exp $
- * $Id: acl_files.c,v 1.3 1995/07/18 16:34:49 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: acl_files.c,v 1.3 1995/07/18 16:34:49 mark Exp $";
-#endif lint
-#endif
-
-
-/*** Routines for manipulating access control list files ***/
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <strings.h>
-#include <sys/file.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/errno.h>
-#include <ctype.h>
-#include "krb.h"
-
-__BEGIN_DECLS
-static int acl_abort __P((char *, FILE *));
-__END_DECLS
-
-#ifndef KRB_REALM
-#define KRB_REALM "ATHENA.MIT.EDU"
-#endif
-
-/* "aname.inst@realm" */
-#define MAX_PRINCIPAL_SIZE (ANAME_SZ + INST_SZ + REALM_SZ + 3)
-#define INST_SEP '.'
-#define REALM_SEP '@'
-
-#define LINESIZE 2048 /* Maximum line length in an acl file */
-
-#define NEW_FILE "%s.~NEWACL~" /* Format for name of altered acl file */
-#define WAIT_TIME 300 /* Maximum time allowed write acl file */
-
-#define CACHED_ACLS 8 /* How many acls to cache */
- /* Each acl costs 1 open file descriptor */
-#define ACL_LEN 16 /* Twice a reasonable acl length */
-
-#define MAX(a,b) (((a)>(b))?(a):(b))
-#define MIN(a,b) (((a)<(b))?(a):(b))
-
-#define COR(a,b) ((a!=NULL)?(a):(b))
-
-/* Canonicalize a principal name */
-/* If instance is missing, it becomes "" */
-/* If realm is missing, it becomes the local realm */
-/* Canonicalized form is put in canon, which must be big enough to hold
- MAX_PRINCIPAL_SIZE characters */
-void
-acl_canonicalize_principal(principal, canon)
-char *principal;
-char *canon;
-{
- char *dot, *atsign, *end;
- int len;
-
- dot = index(principal, INST_SEP);
- atsign = index(principal, REALM_SEP);
-
- /* Maybe we're done already */
- if(dot != NULL && atsign != NULL) {
- if(dot < atsign) {
- /* It's for real */
- /* Copy into canon */
- strncpy(canon, principal, MAX_PRINCIPAL_SIZE);
- canon[MAX_PRINCIPAL_SIZE-1] = '\0';
- return;
- } else {
- /* Nope, it's part of the realm */
- dot = NULL;
- }
- }
-
- /* No such luck */
- end = principal + strlen(principal);
-
- /* Get the principal name */
- len = MIN(ANAME_SZ, COR(dot, COR(atsign, end)) - principal);
- strncpy(canon, principal, len);
- canon += len;
-
- /* Add INST_SEP */
- *canon++ = INST_SEP;
-
- /* Get the instance, if it exists */
- if(dot != NULL) {
- ++dot;
- len = MIN(INST_SZ, COR(atsign, end) - dot);
- strncpy(canon, dot, len);
- canon += len;
- }
-
- /* Add REALM_SEP */
- *canon++ = REALM_SEP;
-
- /* Get the realm, if it exists */
- /* Otherwise, default to local realm */
- if(atsign != NULL) {
- ++atsign;
- len = MIN(REALM_SZ, end - atsign);
- strncpy(canon, atsign, len);
- canon += len;
- *canon++ = '\0';
- } else if(krb_get_lrealm(canon, 1) != KSUCCESS) {
- strcpy(canon, KRB_REALM);
- }
-}
-
-/* Get a lock to modify acl_file */
-/* Return new FILE pointer */
-/* or NULL if file cannot be modified */
-/* REQUIRES WRITE PERMISSION TO CONTAINING DIRECTORY */
-static FILE *
-acl_lock_file(acl_file)
-char *acl_file;
-{
- struct stat s;
- char new[LINESIZE];
- int nfd;
- FILE *nf;
- int mode;
-
- if(stat(acl_file, &s) < 0) return(NULL);
- mode = s.st_mode;
- sprintf(new, NEW_FILE, acl_file);
- for(;;) {
- /* Open the new file */
- if((nfd = open(new, O_WRONLY|O_CREAT|O_EXCL, mode)) < 0) {
- if(errno == EEXIST) {
- /* Maybe somebody got here already, maybe it's just old */
- if(stat(new, &s) < 0) return(NULL);
- if(time(0) - s.st_ctime > WAIT_TIME) {
- /* File is stale, kill it */
- unlink(new);
- continue;
- } else {
- /* Wait and try again */
- sleep(1);
- continue;
- }
- } else {
- /* Some other error, we lose */
- return(NULL);
- }
- }
-
- /* If we got to here, the lock file is ours and ok */
- /* Reopen it under stdio */
- if((nf = fdopen(nfd, "w")) == NULL) {
- /* Oops, clean up */
- unlink(new);
- }
- return(nf);
- }
-}
-
-/* Commit changes to acl_file written onto FILE *f */
-/* Returns zero if successful */
-/* Returns > 0 if lock was broken */
-/* Returns < 0 if some other error occurs */
-/* Closes f */
-static int
-acl_commit(acl_file, f)
-char *acl_file;
-FILE *f;
-{
- char new[LINESIZE];
- int ret;
- struct stat s;
-
- sprintf(new, NEW_FILE, acl_file);
- if(fflush(f) < 0
- || fstat(fileno(f), &s) < 0
- || s.st_nlink == 0) {
- acl_abort(acl_file, f);
- return(-1);
- }
-
- ret = rename(new, acl_file);
- fclose(f);
- return(ret);
-}
-
-/*
- * Abort changes to acl_file written onto FILE *f
- * Returns 0 if successful, < 0 otherwise
- * Closes f
- */
-static int
-acl_abort(acl_file, f)
-char *acl_file;
-FILE *f;
-{
- char new[LINESIZE];
- int ret;
- struct stat s;
-
- /* make sure we aren't nuking someone else's file */
- if(fstat(fileno(f), &s) < 0 || s.st_nlink == 0) {
- fclose(f);
- return(-1);
- } else {
- sprintf(new, NEW_FILE, acl_file);
- ret = unlink(new);
- fclose(f);
- return(ret);
- }
-}
-
-/* Initialize an acl_file */
-/* Creates the file with permissions perm if it does not exist */
-/* Erases it if it does */
-/* Returns return value of acl_commit */
-int
-acl_initialize(acl_file, perm)
-char *acl_file;
-int perm;
-{
- FILE *new;
- int fd;
-
- /* Check if the file exists already */
- if((new = acl_lock_file(acl_file)) != NULL) {
- return(acl_commit(acl_file, new));
- } else {
- /* File must be readable and writable by owner */
- if((fd = open(acl_file, O_CREAT|O_EXCL, perm|0600)) < 0) {
- return(-1);
- } else {
- close(fd);
- return(0);
- }
- }
-}
-
-/* Eliminate all whitespace character in buf */
-/* Modifies its argument */
-static void
-nuke_whitespace(buf)
-char *buf;
-{
- register char *pin, *pout;
-
- for(pin = pout = buf; *pin != '\0'; pin++)
- if(!isspace(*pin)) *pout++ = *pin;
- *pout = '\0'; /* Terminate the string */
-}
-
-/* Hash table stuff */
-
-struct hashtbl {
- int size; /* Max number of entries */
- int entries; /* Actual number of entries */
- char **tbl; /* Pointer to start of table */
-};
-
-/* Make an empty hash table of size s */
-static struct hashtbl *
-make_hash(size)
-int size;
-{
- struct hashtbl *h;
-
- if(size < 1) size = 1;
- h = (struct hashtbl *) malloc(sizeof(struct hashtbl));
- h->size = size;
- h->entries = 0;
- h->tbl = (char **) calloc(size, sizeof(char *));
- return(h);
-}
-
-/* Destroy a hash table */
-static void
-destroy_hash(h)
-struct hashtbl *h;
-{
- int i;
-
- for(i = 0; i < h->size; i++) {
- if(h->tbl[i] != NULL) free(h->tbl[i]);
- }
- free(h->tbl);
- free(h);
-}
-
-/* Compute hash value for a string */
-static unsigned
-hashval(s)
-register char *s;
-{
- register unsigned hv;
-
- for(hv = 0; *s != '\0'; s++) {
- hv ^= ((hv << 3) ^ *s);
- }
- return(hv);
-}
-
-/* Add an element to a hash table */
-static void
-add_hash(h, el)
-struct hashtbl *h;
-char *el;
-{
- unsigned hv;
- char *s;
- char **old;
- int i;
-
- /* Make space if it isn't there already */
- if(h->entries + 1 > (h->size >> 1)) {
- old = h->tbl;
- h->tbl = (char **) calloc(h->size << 1, sizeof(char *));
- for(i = 0; i < h->size; i++) {
- if(old[i] != NULL) {
- hv = hashval(old[i]) % (h->size << 1);
- while(h->tbl[hv] != NULL) hv = (hv+1) % (h->size << 1);
- h->tbl[hv] = old[i];
- }
- }
- h->size = h->size << 1;
- free(old);
- }
-
- hv = hashval(el) % h->size;
- while(h->tbl[hv] != NULL && strcmp(h->tbl[hv], el)) hv = (hv+1) % h->size;
- s = malloc(strlen(el)+1);
- strcpy(s, el);
- h->tbl[hv] = s;
- h->entries++;
-}
-
-/* Returns nonzero if el is in h */
-static int
-check_hash(h, el)
-struct hashtbl *h;
-char *el;
-{
- unsigned hv;
-
- for(hv = hashval(el) % h->size;
- h->tbl[hv] != NULL;
- hv = (hv + 1) % h->size) {
- if(!strcmp(h->tbl[hv], el)) return(1);
- }
- return(0);
-}
-
-struct acl {
- char filename[LINESIZE]; /* Name of acl file */
- int fd; /* File descriptor for acl file */
- struct stat status; /* File status at last read */
- struct hashtbl *acl; /* Acl entries */
-};
-
-static struct acl acl_cache[CACHED_ACLS];
-
-static int acl_cache_count = 0;
-static int acl_cache_next = 0;
-
-/* Returns < 0 if unsuccessful in loading acl */
-/* Returns index into acl_cache otherwise */
-/* Note that if acl is already loaded, this is just a lookup */
-static int
-acl_load(name)
-char *name;
-{
- int i;
- FILE *f;
- struct stat s;
- char buf[MAX_PRINCIPAL_SIZE];
- char canon[MAX_PRINCIPAL_SIZE];
-
- /* See if it's there already */
- for(i = 0; i < acl_cache_count; i++) {
- if(!strcmp(acl_cache[i].filename, name)
- && acl_cache[i].fd >= 0) goto got_it;
- }
-
- /* It isn't, load it in */
- /* maybe there's still room */
- if(acl_cache_count < CACHED_ACLS) {
- i = acl_cache_count++;
- } else {
- /* No room, clean one out */
- i = acl_cache_next;
- acl_cache_next = (acl_cache_next + 1) % CACHED_ACLS;
- close(acl_cache[i].fd);
- if(acl_cache[i].acl) {
- destroy_hash(acl_cache[i].acl);
- acl_cache[i].acl = (struct hashtbl *) 0;
- }
- }
-
- /* Set up the acl */
- strcpy(acl_cache[i].filename, name);
- if((acl_cache[i].fd = open(name, O_RDONLY, 0)) < 0) return(-1);
- /* Force reload */
- acl_cache[i].acl = (struct hashtbl *) 0;
-
- got_it:
- /*
- * See if the stat matches
- *
- * Use stat(), not fstat(), as the file may have been re-created by
- * acl_add or acl_delete. If this happens, the old inode will have
- * no changes in the mod-time and the following test will fail.
- */
- if(stat(acl_cache[i].filename, &s) < 0) return(-1);
- if(acl_cache[i].acl == (struct hashtbl *) 0
- || s.st_nlink != acl_cache[i].status.st_nlink
- || s.st_mtime != acl_cache[i].status.st_mtime
- || s.st_ctime != acl_cache[i].status.st_ctime) {
- /* Gotta reload */
- if(acl_cache[i].fd >= 0) close(acl_cache[i].fd);
- if((acl_cache[i].fd = open(name, O_RDONLY, 0)) < 0) return(-1);
- if((f = fdopen(acl_cache[i].fd, "r")) == NULL) return(-1);
- if(acl_cache[i].acl) destroy_hash(acl_cache[i].acl);
- acl_cache[i].acl = make_hash(ACL_LEN);
- while(fgets(buf, sizeof(buf), f) != NULL) {
- nuke_whitespace(buf);
- acl_canonicalize_principal(buf, canon);
- add_hash(acl_cache[i].acl, canon);
- }
- fclose(f);
- acl_cache[i].status = s;
- }
- return(i);
-}
-
-/* Returns nonzero if it can be determined that acl contains principal */
-/* Principal is not canonicalized, and no wildcarding is done */
-int
-acl_exact_match(acl, principal)
-char *acl;
-char *principal;
-{
- int idx;
-
- return((idx = acl_load(acl)) >= 0
- && check_hash(acl_cache[idx].acl, principal));
-}
-
-/* Returns nonzero if it can be determined that acl contains principal */
-/* Recognizes wildcards in acl of the form
- name.*@realm, *.*@realm, and *.*@* */
-int
-acl_check(acl, principal)
-char *acl;
-char *principal;
-{
- char buf[MAX_PRINCIPAL_SIZE];
- char canon[MAX_PRINCIPAL_SIZE];
- char *realm;
-
- acl_canonicalize_principal(principal, canon);
-
- /* Is it there? */
- if(acl_exact_match(acl, canon)) return(1);
-
- /* Try the wildcards */
- realm = index(canon, REALM_SEP);
- *index(canon, INST_SEP) = '\0'; /* Chuck the instance */
-
- sprintf(buf, "%s.*%s", canon, realm);
- if(acl_exact_match(acl, buf)) return(1);
-
- sprintf(buf, "*.*%s", realm);
- if(acl_exact_match(acl, buf) || acl_exact_match(acl, "*.*@*")) return(1);
-
- return(0);
-}
-
-/* Adds principal to acl */
-/* Wildcards are interpreted literally */
-int
-acl_add(acl, principal)
-char *acl;
-char *principal;
-{
- int idx;
- int i;
- FILE *new;
- char canon[MAX_PRINCIPAL_SIZE];
-
- acl_canonicalize_principal(principal, canon);
-
- if((new = acl_lock_file(acl)) == NULL) return(-1);
- if((acl_exact_match(acl, canon))
- || (idx = acl_load(acl)) < 0) {
- acl_abort(acl, new);
- return(-1);
- }
- /* It isn't there yet, copy the file and put it in */
- for(i = 0; i < acl_cache[idx].acl->size; i++) {
- if(acl_cache[idx].acl->tbl[i] != NULL) {
- if(fputs(acl_cache[idx].acl->tbl[i], new) == NULL
- || putc('\n', new) != '\n') {
- acl_abort(acl, new);
- return(-1);
- }
- }
- }
- fputs(canon, new);
- putc('\n', new);
- return(acl_commit(acl, new));
-}
-
-/* Removes principal from acl */
-/* Wildcards are interpreted literally */
-int
-acl_delete(acl, principal)
-char *acl;
-char *principal;
-{
- int idx;
- int i;
- FILE *new;
- char canon[MAX_PRINCIPAL_SIZE];
-
- acl_canonicalize_principal(principal, canon);
-
- if((new = acl_lock_file(acl)) == NULL) return(-1);
- if((!acl_exact_match(acl, canon))
- || (idx = acl_load(acl)) < 0) {
- acl_abort(acl, new);
- return(-1);
- }
- /* It isn't there yet, copy the file and put it in */
- for(i = 0; i < acl_cache[idx].acl->size; i++) {
- if(acl_cache[idx].acl->tbl[i] != NULL
- && strcmp(acl_cache[idx].acl->tbl[i], canon)) {
- fputs(acl_cache[idx].acl->tbl[i], new);
- putc('\n', new);
- }
- }
- return(acl_commit(acl, new));
-}
-
diff --git a/eBones/acl/acl_files.doc b/eBones/acl/acl_files.doc
deleted file mode 100644
index 4096f9b..0000000
--- a/eBones/acl/acl_files.doc
+++ /dev/null
@@ -1,107 +0,0 @@
-PROTOTYPE ACL LIBRARY
-
-Introduction
-
-An access control list (ACL) is a list of principals, where each
-principal is is represented by a text string which cannot contain
-whitespace. The library allows application programs to refer to named
-access control lists to test membership and to atomically add and
-delete principals using a natural and intuitive interface. At
-present, the names of access control lists are required to be Unix
-filenames, and refer to human-readable Unix files; in the future, when
-a networked ACL server is implemented, the names may refer to a
-different namespace specific to the ACL service.
-
-
-Usage
-
-cc <files> -lacl -lkrb.
-
-
-
-Principal Names
-
-Principal names have the form
-
-<name>[.<instance>][@<realm>]
-
-e.g.
-
-asp
-asp.root
-asp@ATHENA.MIT.EDU
-asp.@ATHENA.MIT.EDU
-asp.root@ATHENA.MIT.EDU
-
-It is possible for principals to be underspecified. If instance is
-missing, it is assumed to be "". If realm is missing, it is assumed
-to be local_realm. The canonical form contains all of name, instance,
-and realm; the acl_add and acl_delete routines will always
-leave the file in that form. Note that the canonical form of
-asp@ATHENA.MIT.EDU is actually asp.@ATHENA.MIT.EDU.
-
-
-Routines
-
-acl_canonicalize_principal(principal, buf)
-char *principal;
-char *buf; /*RETVAL*/
-
-Store the canonical form of principal in buf. Buf must contain enough
-space to store a principal, given the limits on the sizes of name,
-instance, and realm specified in /usr/include/krb.h.
-
-acl_check(acl, principal)
-char *acl;
-char *principal;
-
-Returns nonzero if principal appears in acl. Returns 0 if principal
-does not appear in acl, or if an error occurs. Canonicalizes
-principal before checking, and allows the ACL to contain wildcards.
-
-acl_exact_match(acl, principal)
-char *acl;
-char *principal;
-
-Like acl_check, but does no canonicalization or wildcarding.
-
-acl_add(acl, principal)
-char *acl;
-char *principal;
-
-Atomically adds principal to acl. Returns 0 if successful, nonzero
-otherwise. It is considered a failure if principal is already in acl.
-This routine will canonicalize principal, but will treat wildcards
-literally.
-
-acl_delete(acl, principal)
-char *acl;
-char *principal;
-
-Atomically deletes principal from acl. Returns 0 if successful,
-nonzero otherwise. It is consider a failure if principal is not
-already in acl. This routine will canonicalize principal, but will
-treat wildcards literally.
-
-acl_initialize(acl, mode)
-char *acl;
-int mode;
-
-Initialize acl. If acl file does not exist, creates it with mode
-mode. If acl exists, removes all members. Returns 0 if successful,
-nonzero otherwise. WARNING: Mode argument is likely to change with
-the eventual introduction of an ACL service.
-
-
-Known problems
-
-In the presence of concurrency, there is a very small chance that
-acl_add or acl_delete could report success even though it would have
-had no effect. This is a necessary side effect of using lock files
-for concurrency control rather than flock(2), which is not supported
-by NFS.
-
-The current implementation caches ACLs in memory in a hash-table
-format for increased efficiency in checking membership; one effect of
-the caching scheme is that one file descriptor will be kept open for
-each ACL cached, up to a maximum of 8.
diff --git a/eBones/des/MISSING b/eBones/des/MISSING
deleted file mode 100644
index a697727..0000000
--- a/eBones/des/MISSING
+++ /dev/null
@@ -1,15 +0,0 @@
-# $Id: MISSING,v 1.1.1.1 1994/09/30 14:49:50 csgr Exp $
-
-The following symbols (you can find in the USA libdes) are still missing
-in this source.
-
-_des_cblock_print_file
-_des_generate_random_block
-_des_init_random_number_generator
-_des_new_random_key
-_des_set_random_generator_seed
-_des_set_sequence_number
-_des_debug
-
-# END
-
diff --git a/eBones/ext_srvtab/Makefile b/eBones/ext_srvtab/Makefile
deleted file mode 100644
index 7fb1f29..0000000
--- a/eBones/ext_srvtab/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# From: @(#)Makefile 5.1 (Berkeley) 6/25/90
-# $Id: Makefile,v 1.3 1995/07/18 16:35:54 mark Exp $
-
-PROG= ext_srvtab
-CFLAGS+=-DKERBEROS -I${.CURDIR}/../include -Wall
-DPADD= ${LIBKDB} ${LIBKRB}
-LDADD+= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -ldes
-MAN8= ext_srvtab.8
-
-.include <bsd.prog.mk>
diff --git a/eBones/ext_srvtab/ext_srvtab.8 b/eBones/ext_srvtab/ext_srvtab.8
deleted file mode 100644
index 565c3a3..0000000
--- a/eBones/ext_srvtab/ext_srvtab.8
+++ /dev/null
@@ -1,62 +0,0 @@
-.\" from: ext_srvtab.8,v 4.2 89/07/18 16:53:18 jtkohl Exp $
-.\" $Id: ext_srvtab.8,v 1.1.1.1 1994/09/30 14:50:05 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH EXT_SRVTAB 8 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-ext_srvtab \- extract service key files from Kerberos key distribution center database
-.SH SYNOPSIS
-ext_srvtab [
-.B \-n
-] [
-.B \-r realm
-] [
-.B hostname ...
-]
-.SH DESCRIPTION
-.I ext_srvtab
-extracts service key files from the Kerberos key distribution center
-(KDC) database.
-.PP
-Upon execution, it prompts the user to enter the master key string for
-the database. If the
-.B \-n
-option is specified, the master key is instead fetched from the master
-key cache file.
-.PP
-For each
-.I hostname
-specified on the command line,
-.I ext_srvtab
-creates the service key file
-.IR hostname -new-srvtab,
-containing all the entries in the database with an instance field of
-.I hostname.
-This new file contains all the keys registered for Kerberos-mediated
-service providing programs which use the
-.IR krb_get_phost (3)
-principal and instance conventions to run on the host
-.IR hostname .
-If the
-.B \-r
-option is specified, the realm fields in the extracted file will
-match the given realm rather than the local realm.
-.SH DIAGNOSTICS
-.TP 20n
-"verify_master_key: Invalid master key, does not match database."
-The master key string entered was incorrect.
-.SH FILES
-.TP 20n
-/etc/kerberosIV/principal.db
-DBM file containing database
-.TP
-/etc/kerberosIV/principal.ok
-Semaphore indicating that the DBM database is not being modified.
-.TP
-/etc/kerberosIV/master_key
-Master key cache file.
-.SH SEE ALSO
-read_service_key(3), krb_get_phost(3)
diff --git a/eBones/ext_srvtab/ext_srvtab.c b/eBones/ext_srvtab/ext_srvtab.c
deleted file mode 100644
index 6f25013..0000000
--- a/eBones/ext_srvtab/ext_srvtab.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- *
- * from: ext_srvtab.c,v 4.1 89/07/18 16:49:30 jtkohl Exp $
- * $Id: ext_srvtab.c,v 1.3 1995/07/18 16:35:55 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: ext_srvtab.c,v 1.3 1995/07/18 16:35:55 mark Exp $";
-#endif lint
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/file.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <signal.h>
-#include <des.h>
-#include <krb.h>
-#include <krb_db.h>
-
-#define TRUE 1
-#define FALSE 0
-
-static C_Block master_key;
-static C_Block session_key;
-static Key_schedule master_key_schedule;
-char progname[] = "ext_srvtab";
-char realm[REALM_SZ];
-
-void FWrite(char *p, int size, int n, FILE *f);
-void StampOutSecrets(void);
-void usage(void);
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- FILE *fout;
- char fname[1024];
- int fopen_errs = 0;
- int arg;
- Principal princs[40];
- int more;
- int prompt = TRUE;
- register int n, i;
-
- bzero(realm, sizeof(realm));
-
- /* Parse commandline arguments */
- if (argc < 2)
- usage();
- else {
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-n") == 0)
- prompt = FALSE;
- else if (strcmp(argv[i], "-r") == 0) {
- if (++i >= argc)
- usage();
- else {
- strcpy(realm, argv[i]);
- /*
- * This is to humor the broken way commandline
- * argument parsing is done. Later, this
- * program ignores everything that starts with -.
- */
- argv[i][0] = '-';
- }
- }
- else if (argv[i][0] == '-')
- usage();
- else
- if (!k_isinst(argv[i])) {
- fprintf(stderr, "%s: bad instance name: %s\n",
- progname, argv[i]);
- usage();
- }
- }
- }
-
- if (kdb_get_master_key (prompt, master_key, master_key_schedule) != 0) {
- fprintf (stderr, "Couldn't read master key.\n");
- fflush (stderr);
- exit(1);
- }
-
- if (kdb_verify_master_key (master_key, master_key_schedule, stderr) < 0) {
- exit(1);
- }
-
- /* For each arg, search for instances of arg, and produce */
- /* srvtab file */
- if (!realm[0])
- if (krb_get_lrealm(realm, 1) != KSUCCESS) {
- fprintf(stderr, "%s: couldn't get local realm\n", progname);
- exit(1);
- }
- (void) umask(077);
-
- for (arg = 1; arg < argc; arg++) {
- if (argv[arg][0] == '-')
- continue;
- sprintf(fname, "%s-new-srvtab", argv[arg]);
- if ((fout = fopen(fname, "w")) == NULL) {
- fprintf(stderr, "Couldn't create file '%s'.\n", fname);
- fopen_errs++;
- continue;
- }
- printf("Generating '%s'....\n", fname);
- n = kerb_get_principal("*", argv[arg], &princs[0], 40, &more);
- if (more)
- fprintf(stderr, "More than 40 found...\n");
- for (i = 0; i < n; i++) {
- FWrite(princs[i].name, strlen(princs[i].name) + 1, 1, fout);
- FWrite(princs[i].instance, strlen(princs[i].instance) + 1,
- 1, fout);
- FWrite(realm, strlen(realm) + 1, 1, fout);
- FWrite(&princs[i].key_version,
- sizeof(princs[i].key_version), 1, fout);
- bcopy(&princs[i].key_low, session_key, sizeof(long));
- bcopy(&princs[i].key_high, session_key + sizeof(long),
- sizeof(long));
- kdb_encrypt_key (session_key, session_key,
- master_key, master_key_schedule, DES_DECRYPT);
- FWrite(session_key, sizeof session_key, 1, fout);
- }
- fclose(fout);
- }
-
- StampOutSecrets();
-
- exit(fopen_errs); /* 0 errors if successful */
-
-}
-
-void
-Die()
-{
- StampOutSecrets();
- exit(1);
-}
-
-void
-FWrite(p, size, n, f)
- char *p;
- int size;
- int n;
- FILE *f;
-{
- if (fwrite(p, size, n, f) != n) {
- printf("Error writing output file. Terminating.\n");
- Die();
- }
-}
-
-void
-StampOutSecrets()
-{
- bzero(master_key, sizeof master_key);
- bzero(session_key, sizeof session_key);
- bzero(master_key_schedule, sizeof master_key_schedule);
-}
-
-void
-usage()
-{
- fprintf(stderr,
- "Usage: %s [-n] [-r realm] instance [instance ...]\n", progname);
- exit(1);
-}
diff --git a/eBones/kadmin/HOW-TO b/eBones/kadmin/HOW-TO
deleted file mode 100644
index bb5c3ca..0000000
--- a/eBones/kadmin/HOW-TO
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-To re-create this directory from outside the US, take the Makefile
-(provided), get the two source files from the original eBones distribution,
-do a `perl -spi.bak -e 's/\$(Header[^\$])\$/$1/g' *.{c,ct}', and then
-edit the #includes in kadmin.c to make things compile.
-
-Unfortunately, this program is not exportable.
diff --git a/eBones/kadmin/Makefile b/eBones/kadmin/Makefile
deleted file mode 100644
index 8eae179..0000000
--- a/eBones/kadmin/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# $Id: Makefile,v 1.1 1995/07/18 16:36:53 mark Exp $
-
-BINDIR= /usr/bin
-PROG= kadmin
-SRCS= kadmin.c kadmin_cmds.c
-CLEANFILES+= kadmin_cmds.c
-CFLAGS+= -DPOSIX -I${.CURDIR}/../include -I${KRBOBJDIR}
-CFLAGS+= -I${.CURDIR}/../libkadm -Wall
-LDADD+= -L${KADMOBJDIR} -lkadm -L${KRBOBJDIR} -lkrb -ldes
-LDADD+= -lss -lcom_err
-MAN8= kadmin.8
-
-kadmin_cmds.c: kadmin_cmds.ct
- test -e kadmin_cmds.ct || ln -s ${.CURDIR}/kadmin_cmds.ct .
- mk_cmds kadmin_cmds.ct
-
-.include <bsd.prog.mk>
-
-
diff --git a/eBones/kadmin/kadmin.c b/eBones/kadmin/kadmin.c
deleted file mode 100644
index fd98428..0000000
--- a/eBones/kadmin/kadmin.c
+++ /dev/null
@@ -1,636 +0,0 @@
-/*
- * $Source: /usr/cvs/src/eBones/kadmin/kadmin.c,v $
- * $Author: mark $
- *
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * Copyright.MIT.
- *
- * Kerberos database administrator's tool.
- *
- * The default behavior of kadmin is if the -m option is given
- * on the commandline, multiple requests are allowed to be given
- * with one entry of the admin password (until the tickets expire).
- * If you do not want this to be an available option, compile with
- * NO_MULTIPLE defined.
- */
-
-#if 0
-#ifndef lint
-static char rcsid_kadmin_c[] =
-"BonesHeader: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadmin.c,v 4.5 89/09/26 14:17:54 qjb Exp ";
-#endif lint
-#endif
-
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <sys/param.h>
-#include <pwd.h>
-#include <ss/ss.h>
-#include <com_err.h>
-#include <krb_err.h>
-#include <kadm.h>
-
-#define BAD_PW 1
-#define GOOD_PW 0
-#define FUDGE_VALUE 15 /* for ticket expiration time */
-#define PE_NO 0
-#define PE_YES 1
-#define PE_UNSURE 2
-
-/* for get_password, whether it should do the swapping...necessary for
- using vals structure, unnecessary for change_pw requests */
-#define DONTSWAP 0
-#define SWAP 1
-
-static void do_init(int argc, char *argv[]);
-void clean_up(void);
-int get_password(unsigned long *low, unsigned long *high, char *prompt,
- int byteswap);
-int get_admin_password(void);
-int princ_exists(char *name, char *instance, char *realm);
-
-extern ss_request_table admin_cmds;
-
-static char myname[ANAME_SZ];
-static char default_realm[REALM_SZ]; /* default kerberos realm */
-static char krbrlm[REALM_SZ]; /* current realm being administered */
-#ifndef NO_MULTIPLE
-static int multiple = 0; /* Allow multiple requests per ticket */
-#endif
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- int sci_idx;
- int code;
- char tktstring[MAXPATHLEN];
-
- void quit();
-
- sci_idx = ss_create_invocation("admin", "2.0", (char *) NULL,
- &admin_cmds, &code);
- if (code) {
- ss_perror(sci_idx, code, "creating invocation");
- exit(1);
- }
- (void) sprintf(tktstring, "/tmp/tkt_adm_%d",getpid());
- krb_set_tkt_string(tktstring);
-
- do_init(argc, argv);
-
- printf("Welcome to the Kerberos Administration Program, version 2\n");
- printf("Type \"help\" if you need it.\n");
- ss_listen(sci_idx, &code);
- printf("\n");
- quit();
- exit(0);
-}
-
-int
-setvals(vals, string)
- Kadm_vals *vals;
- char *string;
-{
- char realm[REALM_SZ];
- int status = KADM_SUCCESS;
-
- bzero(vals, sizeof(*vals));
- bzero(realm, sizeof(realm));
-
- SET_FIELD(KADM_NAME,vals->fields);
- SET_FIELD(KADM_INST,vals->fields);
- if ((status = kname_parse(vals->name, vals->instance, realm, string))) {
- printf("kerberos error: %s\n", krb_err_txt[status]);
- return status;
- }
- if (!realm[0])
- strcpy(realm, default_realm);
- if (strcmp(realm, krbrlm)) {
- strcpy(krbrlm, realm);
- if ((status = kadm_init_link(PWSERV_NAME, KRB_MASTER, krbrlm))
- != KADM_SUCCESS)
- printf("kadm error for realm %s: %s\n",
- krbrlm, error_message(status));
- }
- if (status)
- return 1;
- else
- return KADM_SUCCESS;
-}
-
-void
-change_password(argc, argv)
- int argc;
- char *argv[];
-{
- Kadm_vals old, new;
- int status;
- char pw_prompt[BUFSIZ];
-
- if (argc != 2) {
- printf("Usage: change_password loginname\n");
- return;
- }
-
- if (setvals(&old, argv[1]) != KADM_SUCCESS)
- return;
-
- new = old;
-
- SET_FIELD(KADM_DESKEY,new.fields);
-
- if (princ_exists(old.name, old.instance, krbrlm) != PE_NO) {
- /* get the admin's password */
- if (get_admin_password() != GOOD_PW)
- return;
-
- /* get the new password */
- (void) sprintf(pw_prompt, "New password for %s:", argv[1]);
-
- if (get_password(&new.key_low, &new.key_high,
- pw_prompt, SWAP) == GOOD_PW) {
- status = kadm_mod(&old, &new);
- if (status == KADM_SUCCESS) {
- printf("Password changed for %s.\n", argv[1]);
- } else {
- printf("kadmin: %s\nwhile changing password for %s",
- error_message(status), argv[1]);
- }
- } else
- printf("Error reading password; password unchanged\n");
- bzero((char *)&new, sizeof(new));
-#ifndef NO_MULTIPLE
- if (!multiple)
- clean_up();
-#endif
- }
- else
- printf("kadmin: Principal does not exist.\n");
- return;
-}
-
-/*ARGSUSED*/
-void
-change_admin_password(argc, argv)
- int argc;
- char *argv[];
-{
- des_cblock newkey;
- unsigned long low, high;
- int status;
- char prompt_pw[BUFSIZ];
-
- if (argc != 1) {
- printf("Usage: change_admin_password\n");
- return;
- }
- /* get the admin's password */
- if (get_admin_password() != GOOD_PW)
- return;
-
- (void) sprintf(prompt_pw, "New password for %s.admin:",myname);
- if (get_password(&low, &high, prompt_pw, DONTSWAP) == GOOD_PW) {
- bcopy((char *)&low,(char *) newkey,4);
- bcopy((char *)&high, (char *)(((long *) newkey) + 1),4);
- low = high = 0L;
- if ((status = kadm_change_pw(newkey)) == KADM_SUCCESS)
- printf("Admin password changed\n");
- else
- printf("kadm error: %s\n",error_message(status));
- bzero((char *)newkey, sizeof(newkey));
- } else
- printf("Error reading password; password unchanged\n");
-#ifndef NO_MULTIPLE
- if (!multiple)
- clean_up();
-#endif
- return;
-}
-
-void
-add_new_key(argc, argv)
- int argc;
- char *argv[];
-{
- Kadm_vals new;
- char pw_prompt[BUFSIZ];
- int status;
-
- if (argc != 2) {
- printf("Usage: add_new_key user_name.\n");
- return;
- }
- if (setvals(&new, argv[1]) != KADM_SUCCESS)
- return;
-
- SET_FIELD(KADM_DESKEY,new.fields);
-
- if (princ_exists(new.name, new.instance, krbrlm) != PE_YES) {
- /* get the admin's password */
- if (get_admin_password() != GOOD_PW)
- return;
-
- /* get the new password */
- (void) sprintf(pw_prompt, "Password for %s:", argv[1]);
-
- if (get_password(&new.key_low, &new.key_high,
- pw_prompt, SWAP) == GOOD_PW) {
- status = kadm_add(&new);
- if (status == KADM_SUCCESS) {
- printf("%s added to database.\n", argv[1]);
- } else {
- printf("kadm error: %s\n",error_message(status));
- }
- } else
- printf("Error reading password; %s not added\n",argv[1]);
- bzero((char *)&new, sizeof(new));
-#ifndef NO_MULTIPLE
- if (!multiple)
- clean_up();
-#endif
- }
- else
- printf("kadmin: Principal already exists.\n");
- return;
-}
-
-void
-get_entry(argc, argv)
- int argc;
- char *argv[];
-{
- int status;
- u_char fields[4];
- Kadm_vals vals;
-
- if (argc != 2) {
- printf("Usage: get_entry username\n");
- return;
- }
-
- bzero(fields, sizeof(fields));
-
- SET_FIELD(KADM_NAME,fields);
- SET_FIELD(KADM_INST,fields);
- SET_FIELD(KADM_EXPDATE,fields);
- SET_FIELD(KADM_ATTR,fields);
- SET_FIELD(KADM_MAXLIFE,fields);
-
- if (setvals(&vals, argv[1]) != KADM_SUCCESS)
- return;
-
-
- if (princ_exists(vals.name, vals.instance, krbrlm) != PE_NO) {
- /* get the admin's password */
- if (get_admin_password() != GOOD_PW)
- return;
-
- if ((status = kadm_get(&vals, fields)) == KADM_SUCCESS)
- prin_vals(&vals);
- else
- printf("kadm error: %s\n",error_message(status));
-
-#ifndef NO_MULTIPLE
- if (!multiple)
- clean_up();
-#endif
- }
- else
- printf("kadmin: Principal does not exist.\n");
- return;
-}
-
-
-void
-help(argc, argv)
- int argc;
- char *argv[];
-{
- if (argc == 1) {
- printf("Welcome to the Kerberos administration program.");
- printf("Type \"?\" to get\n");
- printf("a list of requests that are available. You can");
- printf(" get help on each of\n");
- printf("the commands by typing \"help command_name\".");
- printf(" Some functions of this\n");
- printf("program will require an \"admin\" password");
- printf(" from you. This is a password\n");
- printf("private to you, that is used to authenticate");
- printf(" requests from this\n");
- printf("program. You can change this password with");
- printf(" the \"change_admin_password\"\n");
- printf("(or short form \"cap\") command. Good Luck! \n");
- } else if (!strcmp(argv[1], "change_password") ||
- !strcmp(argv[1], "cpw")) {
- printf("Usage: change_password user_name.\n");
- printf("\n");
- printf("user_name is the name of the user whose password");
- printf(" you wish to change. \n");
- printf("His/her password is changed in the kerberos database\n");
- printf("When this command is issued, first the \"Admin\"");
- printf(" password will be prompted\n");
- printf("for and if correct the user's new password will");
- printf(" be prompted for (twice with\n");
- printf("appropriate comparison). Note: No minimum password");
- printf(" length restrictions apply, but\n");
- printf("longer passwords are more secure.\n");
- } else if (!strcmp(argv[1], "change_admin_password") ||
- !strcmp(argv[1], "cap")) {
- printf("Usage: change_admin_password.\n");
- printf("\n");
- printf("This command takes no arguments and is used");
- printf(" to change your private\n");
- printf("\"Admin\" password. It will first prompt for");
- printf(" the (current) \"Admin\"\n");
- printf("password and then ask for the new password");
- printf(" by prompting:\n");
- printf("\n");
- printf("New password for <Your User Name>.admin:\n");
- printf("\n");
- printf("Enter the new admin password that you desire");
- printf(" (it will be asked for\n");
- printf("twice to avoid errors).\n");
- } else if (!strcmp(argv[1], "add_new_key") ||
- !strcmp(argv[1], "ank")) {
- printf("Usage: add_new_key user_name.\n");
- printf("\n");
- printf("user_name is the name of a new user to put");
- printf(" in the kerberos database. Your\n");
- printf("\"Admin\" password and the user's password");
- printf(" are prompted for. The user's\n");
- printf("password will be asked for");
- printf(" twice to avoid errors.\n");
- } else if (!strcmp(argv[1], "get_entry") ||
- !strcmp(argv[1], "get")) {
- printf("Usage: get_entry user_name.\n");
- printf("\n");
- printf("user_name is the name of a user whose");
- printf(" entry you wish to review. Your\n");
- printf("\"Admin\" password is prompted for. ");
- printf(" The key field is not filled in, for\n");
- printf("security reasons.\n");
- } else if (!strcmp(argv[1], "destroy_tickets") ||
- !strcmp(argv[1], "dest")) {
- printf("Usage: destroy_tickets\n");
- printf("\n");
- printf("Destroy your admin tickets. This will");
- printf(" cause you to be prompted for your\n");
- printf("admin password on your next request.\n");
- } else if (!strcmp(argv[1], "list_requests") ||
- !strcmp(argv[1], "lr") ||
- !strcmp(argv[1], "?")) {
- printf("Usage: list_requests\n");
- printf("\n");
- printf("This command lists what other commands are");
- printf(" currently available.\n");
- } else if (!strcmp(argv[1], "exit") ||
- !strcmp(argv[1], "quit") ||
- !strcmp(argv[1], "q")) {
- printf("Usage: quit\n");
- printf("\n");
- printf("This command exits this program.\n");
- } else {
- printf("Sorry there is no such command as %s.", argv[1]);
- printf(" Type \"help\" for more information. \n");
- }
- return;
-}
-
-void
-go_home(str,x)
-char *str;
-int x;
-{
- fprintf(stderr, "%s: %s\n", str, error_message(x));
- clean_up();
- exit(1);
-}
-
-static int inited = 0;
-
-void
-usage()
-{
- fprintf(stderr, "Usage: kadmin [-u admin_name] [-r default_realm]");
-#ifndef NO_MULTIPLE
- fprintf(stderr, " [-m]");
-#endif
- fprintf(stderr, "\n");
-#ifndef NO_MULTIPLE
- fprintf(stderr, " -m allows multiple admin requests to be ");
- fprintf(stderr, "serviced with one entry of admin\n");
- fprintf(stderr, " password.\n");
-#endif
- exit(1);
-}
-
-static void
-do_init(argc, argv)
- int argc;
- char *argv[];
-{
- struct passwd *pw;
- extern char *optarg;
- extern int optind;
- int c;
-#ifndef NO_MULTIPLE
-#define OPTION_STRING "u:r:m"
-#else
-#define OPTION_STRING "u:r:"
-#endif
-
- bzero(myname, sizeof(myname));
-
- if (!inited) {
- /*
- * This is only as a default/initial realm; we don't care
- * about failure.
- */
- if (krb_get_lrealm(default_realm, 1) != KSUCCESS)
- strcpy(default_realm, KRB_REALM);
-
- /*
- * If we can reach the local realm, initialize to it. Otherwise,
- * don't initialize.
- */
- if (kadm_init_link(PWSERV_NAME, KRB_MASTER, krbrlm) != KADM_SUCCESS)
- bzero(krbrlm, sizeof(krbrlm));
- else
- strcpy(krbrlm, default_realm);
-
- while ((c = getopt(argc, argv, OPTION_STRING)) != EOF)
- switch (c) {
- case 'u':
- strncpy(myname, optarg, sizeof(myname) - 1);
- break;
- case 'r':
- bzero(default_realm, sizeof(default_realm));
- strncpy(default_realm, optarg, sizeof(default_realm) - 1);
- break;
-#ifndef NO_MULTIPLE
- case 'm':
- multiple++;
- break;
-#endif
- default:
- usage();
- break;
- }
- if (optind < argc)
- usage();
- if (!myname[0]) {
- pw = getpwuid((int) getuid());
- if (!pw) {
- fprintf(stderr,
- "You aren't in the password file. Who are you?\n");
- exit(1);
- }
- (void) strcpy(myname, pw->pw_name);
- }
- inited = 1;
- }
-}
-
-#ifdef NOENCRYPTION
-#define read_long_pw_string placebo_read_pw_string
-#else
-#define read_long_pw_string des_read_pw_string
-#endif
-extern int read_long_pw_string();
-
-int
-get_admin_password()
-{
- int status;
- char admin_passwd[MAX_KPW_LEN]; /* Admin's password */
- int ticket_life = 1; /* minimum ticket lifetime */
-#ifndef NO_MULTIPLE
- CREDENTIALS c;
-
- if (multiple) {
- /* If admin tickets exist and are valid, just exit. */
- bzero(&c, sizeof(c));
- if (krb_get_cred(PWSERV_NAME, KADM_SINST, krbrlm, &c) == KSUCCESS)
- /*
- * If time is less than lifetime - FUDGE_VALUE after issue date,
- * tickets will probably last long enough for the next
- * transaction.
- */
- if (time(0) < (c.issue_date + (5 * 60 * c.lifetime) - FUDGE_VALUE))
- return(KADM_SUCCESS);
- ticket_life = DEFAULT_TKT_LIFE;
- }
-#endif
-
- if (princ_exists(myname, "admin", krbrlm) != PE_NO) {
- if (read_long_pw_string(admin_passwd, sizeof(admin_passwd)-1,
- "Admin password:", 0)) {
- fprintf(stderr, "Error reading admin password.\n");
- goto bad;
- }
- status = krb_get_pw_in_tkt(myname, "admin", krbrlm, PWSERV_NAME,
- KADM_SINST, ticket_life, admin_passwd);
- bzero(admin_passwd, sizeof(admin_passwd));
- }
- else
- status = KDC_PR_UNKNOWN;
-
- switch(status) {
- case GT_PW_OK:
- return(GOOD_PW);
- case KDC_PR_UNKNOWN:
- printf("Principal %s.admin@%s does not exist.\n", myname, krbrlm);
- goto bad;
- case GT_PW_BADPW:
- printf("Incorrect admin password.\n");
- goto bad;
- default:
- com_err("kadmin", status+krb_err_base,
- "while getting password tickets");
- goto bad;
- }
-
- bad:
- bzero(admin_passwd, sizeof(admin_passwd));
- (void) dest_tkt();
- return(BAD_PW);
-}
-
-void
-clean_up()
-{
- (void) dest_tkt();
- return;
-}
-
-void
-quit()
-{
- printf("Cleaning up and exiting.\n");
- clean_up();
- exit(0);
-}
-
-int
-princ_exists(name, instance, realm)
- char *name;
- char *instance;
- char *realm;
-{
- int status;
-
- status = krb_get_pw_in_tkt(name, instance, realm, "krbtgt", realm, 1, "");
-
- if ((status == KSUCCESS) || (status == INTK_BADPW))
- return(PE_YES);
- else if (status == KDC_PR_UNKNOWN)
- return(PE_NO);
- else
- return(PE_UNSURE);
-}
-
-int
-get_password(low, high, prompt, byteswap)
-unsigned long *low, *high;
-char *prompt;
-int byteswap;
-{
- char new_passwd[MAX_KPW_LEN]; /* new password */
- des_cblock newkey;
-
- do {
- if (read_long_pw_string(new_passwd, sizeof(new_passwd)-1, prompt, 1))
- return(BAD_PW);
- if (strlen(new_passwd) == 0)
- printf("Null passwords are not allowed; try again.\n");
- } while (strlen(new_passwd) == 0);
-
-#ifdef NOENCRYPTION
- bzero((char *) newkey, sizeof(newkey));
-#else
- des_string_to_key(new_passwd, &newkey);
-#endif
- bzero(new_passwd, sizeof(new_passwd));
-
- bcopy((char *) newkey,(char *)low,4);
- bcopy((char *)(((long *) newkey) + 1), (char *)high,4);
-
- bzero((char *) newkey, sizeof(newkey));
-
-#ifdef NOENCRYPTION
- *low = 1;
-#endif
-
- if (byteswap != DONTSWAP) {
- *low = htonl(*low);
- *high = htonl(*high);
- }
- return(GOOD_PW);
-}
diff --git a/eBones/kadmin/kadmin_cmds.ct b/eBones/kadmin/kadmin_cmds.ct
deleted file mode 100644
index 141ac15..0000000
--- a/eBones/kadmin/kadmin_cmds.ct
+++ /dev/null
@@ -1,41 +0,0 @@
-# $Source: /usr/cvs/src/eBones/kadmin/kadmin_cmds.ct,v $
-# $Author: mark $
-# $Header: /usr/cvs/src/eBones/kadmin/kadmin_cmds.ct,v 1.1 1995/07/18 16:36:56 mark Exp $
-#
-# Copyright 1988 by the Massachusetts Institute of Technology.
-#
-# For copying and distribution information, please see the file
-# <mit-copyright.h>.
-#
-# Command table for Kerberos administration tool
-#
- command_table admin_cmds;
-
- request change_password,
- "Change a user's password",
- change_password, cpw;
-
- request change_admin_password, "Change your admin password",
- change_admin_password, cap;
-
- request add_new_key, "Add new user to kerberos database",
- add_new_key, ank;
-
- request get_entry, "Get entry from kerberos database",
- get_entry, get;
-
- request clean_up, "Destroy admin tickets",
- destroy_tickets, dest;
-
- request help,"Request help with this program",
- help;
-
-# list_requests is generic -- unrelated to Kerberos
-
- request ss_list_requests, "List available requests.",
- list_requests, lr, "?";
-
- request quit, "Exit program.",
- quit, exit, q;
-
- end;
diff --git a/eBones/kadmind/HOW-TO b/eBones/kadmind/HOW-TO
deleted file mode 100644
index f41982a..0000000
--- a/eBones/kadmind/HOW-TO
+++ /dev/null
@@ -1,267 +0,0 @@
-This directory was created from eBones by the following procedure:
-
-1) Get the files listed in the Makefile
-
-2) perl -spi.bak -e 's/\$(Header[^\$]*)\$/$1/g'
-
-3) Apply the patch listed below.
-
-diff -rc2 ../kadmind.orig/admin_server.c ./admin_server.c
-*** ../kadmind.orig/admin_server.c Thu Jan 19 18:04:04 1995
---- ./admin_server.c Thu Jan 19 21:58:51 1995
-***************
-*** 1,10 ****
- /*
-- * $Source: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/admin_server.c,v $
-- * $Author: jtkohl $
-- *
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
-! * <mit-copyright.h>.
- *
- * Top-level loop of the kerberos Administration server
---- 1,7 ----
- /*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
-! * Copyright.MIT.
- *
- * Top-level loop of the kerberos Administration server
-***************
-*** 12,20 ****
-
- #ifndef lint
- static char rcsid_admin_server_c[] =
-! "$Id: admin_server.c,v 4.8 90/01/02 13:50:38 jtkohl Exp $";
- #endif lint
-
-- #include <mit-copyright.h>
- /*
- admin_server.c
---- 9,20 ----
-
- #ifndef lint
-+ #if 0
- static char rcsid_admin_server_c[] =
-! "Id: admin_server.c,v 4.8 90/01/02 13:50:38 jtkohl Exp ";
-! #endif
-! static const char rcsid[] =
-! "$Id";
- #endif lint
-
- /*
- admin_server.c
-***************
-*** 389,393 ****
---- 389,397 ----
- register int i, j;
-
-+ #ifdef POSIX
-+ int status;
-+ #else
- union wait status;
-+ #endif
-
- pid = wait(&status);
-***************
-*** 400,406 ****
- pidarray[j] = pidarray[j+1];
- pidarraysize--;
-! if (status.w_retcode || status.w_coredump || status.w_termsig)
- log("child %d: termsig %d, coredump %d, retcode %d", pid,
-! status.w_termsig, status.w_coredump, status.w_retcode);
- #ifdef POSIX
- return;
---- 404,410 ----
- pidarray[j] = pidarray[j+1];
- pidarraysize--;
-! if (WEXITSTATUS(status) || WCOREDUMP(status) || WIFSIGNALED(status))
- log("child %d: termsig %d, coredump %d, retcode %d", pid,
-! WTERMSIG(status), WCOREDUMP(status), WEXITSTATUS(status));
- #ifdef POSIX
- return;
-***************
-*** 410,414 ****
- }
- log("child %d not in list: termsig %d, coredump %d, retcode %d", pid,
-! status.w_termsig, status.w_coredump, status.w_retcode);
- #ifdef POSIX
- return;
---- 414,418 ----
- }
- log("child %d not in list: termsig %d, coredump %d, retcode %d", pid,
-! WTERMSIG(status), WCOREDUMP(status), WEXITSTATUS(status));
- #ifdef POSIX
- return;
-Only in .: admin_server.c~
-diff -rc2 ../kadmind.orig/kadm_funcs.c ./kadm_funcs.c
-*** ../kadmind.orig/kadm_funcs.c Thu Jan 19 18:04:04 1995
---- ./kadm_funcs.c Thu Jan 19 21:56:31 1995
-***************
-*** 1,10 ****
- /*
-- * $Source: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadm_funcs.c,v $
-- * $Author: jon $
-- *
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
-! * <mit-copyright.h>.
- *
- * Kerberos administration server-side database manipulation routines
---- 1,7 ----
- /*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
-! * Copyright.MIT
- *
- * Kerberos administration server-side database manipulation routines
-***************
-*** 12,20 ****
-
- #ifndef lint
- static char rcsid_kadm_funcs_c[] =
-! "$Id: kadm_funcs.c,v 4.3 90/03/20 01:39:51 jon Exp $";
- #endif lint
-
-- #include <mit-copyright.h>
- /*
- kadm_funcs.c
---- 9,20 ----
-
- #ifndef lint
-+ #if 0
- static char rcsid_kadm_funcs_c[] =
-! "Id: kadm_funcs.c,v 4.3 90/03/20 01:39:51 jon Exp ";
-! #endif
-! static const char rcsid[] =
-! "$Id$";
- #endif lint
-
- /*
- kadm_funcs.c
-Only in .: kadm_funcs.c~
-diff -rc2 ../kadmind.orig/kadm_ser_wrap.c ./kadm_ser_wrap.c
-*** ../kadmind.orig/kadm_ser_wrap.c Thu Jan 19 18:04:04 1995
---- ./kadm_ser_wrap.c Thu Jan 19 21:59:15 1995
-***************
-*** 1,10 ****
- /*
-- * $Source: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadm_ser_wrap.c,v $
-- * $Author: jtkohl $
-- *
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
-! * <mit-copyright.h>.
- *
- * Kerberos administration server-side support functions
---- 1,7 ----
- /*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
-! * Copyright.MIT.
- *
- * Kerberos administration server-side support functions
-***************
-*** 16,20 ****
- #endif lint
-
-- #include <mit-copyright.h>
- /*
- kadm_ser_wrap.c
---- 13,16 ----
-Only in .: kadm_ser_wrap.c~
-diff -rc2 ../kadmind.orig/kadm_server.c ./kadm_server.c
-*** ../kadmind.orig/kadm_server.c Thu Jan 19 18:04:04 1995
---- ./kadm_server.c Thu Jan 19 21:59:31 1995
-***************
-*** 1,10 ****
- /*
-- * $Source: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadm_server.c,v $
-- * $Author: jtkohl $
-- *
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
-! * <mit-copyright.h>.
- *
- * Kerberos administration server-side subroutines
---- 1,7 ----
- /*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
-! * Copyright.MIT.
- *
- * Kerberos administration server-side subroutines
-***************
-*** 15,20 ****
- "Header: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadm_server.c,v 4.2 89/09/26 09:30:23 jtkohl Exp ";
- #endif lint
--
-- #include <mit-copyright.h>
-
- #include <kadm.h>
---- 12,15 ----
-Only in .: kadm_server.c~
-diff -rc2 ../kadmind.orig/kadm_server.h ./kadm_server.h
-*** ../kadmind.orig/kadm_server.h Thu Jan 19 18:04:05 1995
---- ./kadm_server.h Thu Jan 19 18:06:36 1995
-***************
-*** 7,11 ****
- *
- * For copying and distribution information, please see the file
-! * <mit-copyright.h>.
- *
- * Definitions for Kerberos administration server & client
---- 7,11 ----
- *
- * For copying and distribution information, please see the file
-! * Copyright.MIT.
- *
- * Definitions for Kerberos administration server & client
-***************
-*** 15,19 ****
- #define KADM_SERVER_DEFS
-
-- #include <mit-copyright.h>
- /*
- * kadm_server.h
---- 15,18 ----
-***************
-*** 25,30 ****
-
- #include <sys/types.h>
-! #include <krb.h>
-! #include <des.h>
-
- typedef struct {
---- 24,29 ----
-
- #include <sys/types.h>
-! #include <kerberosIV/krb.h>
-! #include <kerberosIV/des.h>
-
- typedef struct {
-***************
-*** 43,49 ****
-
- /* the default syslog file */
-! #define KADM_SYSLOG "/kerberos/admin_server.syslog"
-
-! #define DEFAULT_ACL_DIR "/kerberos"
- #define ADD_ACL_FILE "/admin_acl.add"
- #define GET_ACL_FILE "/admin_acl.get"
---- 42,48 ----
-
- /* the default syslog file */
-! #define KADM_SYSLOG "/var/log/kadmind.syslog"
-
-! #define DEFAULT_ACL_DIR "/etc/kerberosIV"
- #define ADD_ACL_FILE "/admin_acl.add"
- #define GET_ACL_FILE "/admin_acl.get"
diff --git a/eBones/kadmind/Makefile b/eBones/kadmind/Makefile
deleted file mode 100644
index f2e0357..0000000
--- a/eBones/kadmind/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# $Id: Makefile,v 1.1 1995/07/18 16:36:59 mark Exp $
-
-PROG= kadmind
-SRCS= admin_server.c kadm_funcs.c kadm_ser_wrap.c kadm_server.c
-CFLAGS+=-DPOSIX -I${.CURDIR}/../include -I${KRBOBJDIR} \
- -I${.CURDIR}/../libkadm -I${KADMOBJDIR} -Wall
-LDADD+= -L${KADMOBJDIR} -lkadm -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb \
- -ldes -L${ACLOBJDIR} -lacl -lcom_err
-MAN8= kadmind.8
-
-.include <bsd.prog.mk>
diff --git a/eBones/kadmind/admin_server.c b/eBones/kadmind/admin_server.c
deleted file mode 100644
index 72980d4..0000000
--- a/eBones/kadmind/admin_server.c
+++ /dev/null
@@ -1,474 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * Copyright.MIT.
- *
- * Top-level loop of the kerberos Administration server
- */
-
-#if 0
-#ifndef lint
-static char rcsid_admin_server_c[] =
-"Id: admin_server.c,v 4.8 90/01/02 13:50:38 jtkohl Exp ";
-static const char rcsid[] =
- "$Id";
-#endif lint
-#endif
-
-/*
- admin_server.c
- this holds the main loop and initialization and cleanup code for the server
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <signal.h>
-#ifndef sigmask
-#define sigmask(m) (1 <<((m)-1))
-#endif
-#include <sys/wait.h>
-#include <errno.h>
-#include <sys/socket.h>
-#include <syslog.h>
-#include <com_err.h>
-#include <kadm.h>
-#include <kadm_err.h>
-#include <krb_db.h>
-#include "kadm_server.h"
-
-/* Almost all procs and such need this, so it is global */
-admin_params prm; /* The command line parameters struct */
-
-char prog[32]; /* WHY IS THIS NEEDED??????? */
-char *progname = prog;
-char *acldir = DEFAULT_ACL_DIR;
-char krbrlm[REALM_SZ];
-extern Kadm_Server server_parm;
-
-void cleanexit(int val);
-void process_client(int fd, struct sockaddr_in *who);
-void kill_children(void);
-static void clear_secrets(void);
-void byebye(void);
-void close_syslog(void);
-int kadm_listen(void);
-
-/*
-** Main does the logical thing, it sets up the database and RPC interface,
-** as well as handling the creation and maintenance of the syslog file...
-*/
-void
-main(argc, argv) /* admin_server main routine */
-int argc;
-char *argv[];
-{
- int errval;
- int c;
- extern char *optarg;
-
- prog[sizeof(prog)-1]='\0'; /* Terminate... */
- (void) strncpy(prog, argv[0], sizeof(prog)-1);
-
- /* initialize the admin_params structure */
- prm.sysfile = KADM_SYSLOG; /* default file name */
- prm.inter = 1;
-
- bzero(krbrlm, sizeof(krbrlm));
-
- while ((c = getopt(argc, argv, "f:hnd:a:r:")) != EOF)
- switch(c) {
- case 'f': /* Syslog file name change */
- prm.sysfile = optarg;
- break;
- case 'n':
- prm.inter = 0;
- break;
- case 'a': /* new acl directory */
- acldir = optarg;
- break;
- case 'd':
- /* put code to deal with alt database place */
- if ((errval = kerb_db_set_name(optarg))) {
- fprintf(stderr, "opening database %s: %s",
- optarg, error_message(errval));
- exit(1);
- }
- break;
- case 'r':
- (void) strncpy(krbrlm, optarg, sizeof(krbrlm) - 1);
- break;
- case 'h': /* get help on using admin_server */
- default:
- printf("Usage: admin_server [-h] [-n] [-r realm] [-d dbname] [-f filename] [-a acldir]\n");
- exit(-1); /* failure */
- }
-
- if (krbrlm[0] == 0)
- if (krb_get_lrealm(krbrlm, 0) != KSUCCESS) {
- fprintf(stderr,
- "Unable to get local realm. Fix krb.conf or use -r.\n");
- exit(1);
- }
-
- printf("KADM Server %s initializing\n",KADM_VERSTR);
- printf("Please do not use 'kill -9' to kill this job, use a\n");
- printf("regular kill instead\n\n");
-
- set_logfile(prm.sysfile);
- log("Admin server starting");
-
- (void) kerb_db_set_lockmode(KERB_DBL_NONBLOCKING);
- errval = kerb_init(); /* Open the Kerberos database */
- if (errval) {
- fprintf(stderr, "error: kerb_init() failed");
- close_syslog();
- byebye();
- }
- /* set up the server_parm struct */
- if ((errval = kadm_ser_init(prm.inter, krbrlm))==KADM_SUCCESS) {
- kerb_fini(); /* Close the Kerberos database--
- will re-open later */
- errval = kadm_listen(); /* listen for calls to server from
- clients */
- }
- if (errval != KADM_SUCCESS) {
- fprintf(stderr,"error: %s\n",error_message(errval));
- kerb_fini(); /* Close if error */
- }
- close_syslog(); /* Close syslog file, print
- closing note */
- byebye(); /* Say bye bye on the terminal
- in use */
-} /* procedure main */
-
-
-/* close the system log file */
-void
-close_syslog()
-{
- log("Shutting down admin server");
-}
-
-void
-byebye() /* say goodnight gracie */
-{
- printf("Admin Server (kadm server) has completed operation.\n");
-}
-
-static void
-clear_secrets()
-{
- bzero((char *)server_parm.master_key, sizeof(server_parm.master_key));
- bzero((char *)server_parm.master_key_schedule,
- sizeof(server_parm.master_key_schedule));
- server_parm.master_key_version = 0L;
-}
-
-static exit_now = 0;
-
-sigtype
-doexit()
-{
- exit_now = 1;
-#ifdef POSIX
- return;
-#else /* !POSIX */
- return(0);
-#endif /* POSIX */
-}
-
-unsigned pidarraysize = 0;
-int *pidarray = (int *)0;
-
-/*
-kadm_listen
-listen on the admin servers port for a request
-*/
-int
-kadm_listen()
-{
- extern int errno;
- int found;
- int admin_fd;
- int peer_fd;
- fd_set mask, readfds;
- struct sockaddr_in peer;
- int addrlen;
- int pid;
- sigtype do_child();
-
- (void) signal(SIGINT, doexit);
- (void) signal(SIGTERM, doexit);
- (void) signal(SIGHUP, doexit);
- (void) signal(SIGQUIT, doexit);
- (void) signal(SIGPIPE, SIG_IGN); /* get errors on write() */
- (void) signal(SIGALRM, doexit);
- (void) signal(SIGCHLD, do_child);
-
- if ((admin_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
- return KADM_NO_SOCK;
- if (bind(admin_fd, (struct sockaddr *)&server_parm.admin_addr,
- sizeof(struct sockaddr_in)) < 0)
- return KADM_NO_BIND;
- (void) listen(admin_fd, 1);
- FD_ZERO(&mask);
- FD_SET(admin_fd, &mask);
-
- for (;;) { /* loop nearly forever */
- if (exit_now) {
- clear_secrets();
- kill_children();
- return(0);
- }
- readfds = mask;
- if ((found = select(admin_fd+1,&readfds,(fd_set *)0,
- (fd_set *)0, (struct timeval *)0)) == 0)
- continue; /* no things read */
- if (found < 0) {
- if (errno != EINTR)
- log("select: %s",error_message(errno));
- continue;
- }
- if (FD_ISSET(admin_fd, &readfds)) {
- /* accept the conn */
- addrlen = sizeof(peer);
- if ((peer_fd = accept(admin_fd, (struct sockaddr *)&peer,
- &addrlen)) < 0) {
- log("accept: %s",error_message(errno));
- continue;
- }
- addrlen = sizeof(server_parm.admin_addr);
- if (getsockname(peer_fd, (struct sockaddr *)&server_parm.admin_addr,
- &addrlen)) {
- log("getsockname: %s",error_message(errno));
- continue;
- }
-#ifdef DEBUG
- printf("Connection recieved on %s\n",
- inet_ntoa(server_parm.admin_addr.sin_addr));
-#endif /* DEBUG */
-#ifndef DEBUG
- /* if you want a sep daemon for each server */
- if ((pid = fork())) {
- /* parent */
- if (pid < 0) {
- log("fork: %s",error_message(errno));
- (void) close(peer_fd);
- continue;
- }
- /* fork succeded: keep tabs on child */
- (void) close(peer_fd);
- if (pidarray) {
- pidarray = (int *)realloc((char *)pidarray, ++pidarraysize);
- pidarray[pidarraysize-1] = pid;
- } else {
- pidarray = (int *)malloc(pidarraysize = 1);
- pidarray[0] = pid;
- }
- } else {
- /* child */
- (void) close(admin_fd);
-#endif /* DEBUG */
- /* do stuff */
- process_client (peer_fd, &peer);
-#ifndef DEBUG
- }
-#endif
- } else {
- log("something else woke me up!");
- return(0);
- }
- }
- /*NOTREACHED*/
- return(0); /* Shut -Wall up - markm */
-}
-
-#ifdef DEBUG
-#define cleanexit(code) {kerb_fini(); return;}
-#endif
-
-void
-process_client(fd, who)
-int fd;
-struct sockaddr_in *who;
-{
- u_char *dat;
- int dat_len;
- u_short dlen;
- int retval;
- int on = 1;
- Principal service;
- des_cblock skey;
- int more;
- int status;
-
- if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on)) < 0)
- log("setsockopt keepalive: %d",errno);
-
- server_parm.recv_addr = *who;
-
- if (kerb_init()) { /* Open as client */
- log("can't open krb db");
- cleanexit(1);
- }
- /* need to set service key to changepw.KRB_MASTER */
-
- status = kerb_get_principal(server_parm.sname, server_parm.sinst, &service,
- 1, &more);
- if (status == -1) {
- /* db locked */
- u_long retcode = KADM_DB_INUSE;
- char *pdat;
-
- dat_len = KADM_VERSIZE + sizeof(u_long);
- dat = (u_char *) malloc((unsigned)dat_len);
- pdat = (char *) dat;
- retcode = htonl((u_long) KADM_DB_INUSE);
- (void) strncpy(pdat, KADM_ULOSE, KADM_VERSIZE);
- bcopy((char *)&retcode, &pdat[KADM_VERSIZE], sizeof(u_long));
- goto out;
- } else if (!status) {
- log("no service %s.%s",server_parm.sname, server_parm.sinst);
- cleanexit(2);
- }
-
- bcopy((char *)&service.key_low, (char *)skey, 4);
- bcopy((char *)&service.key_high, (char *)(((long *) skey) + 1), 4);
- bzero((char *)&service, sizeof(service));
- kdb_encrypt_key (skey, skey, server_parm.master_key,
- server_parm.master_key_schedule, DECRYPT);
- (void) krb_set_key((char *)skey, 0); /* if error, will show up when
- rd_req fails */
- bzero((char *)skey, sizeof(skey));
-
- while (1) {
- if ((retval = krb_net_read(fd, (char *)&dlen, sizeof(u_short))) !=
- sizeof(u_short)) {
- if (retval < 0)
- log("dlen read: %s",error_message(errno));
- else if (retval)
- log("short dlen read: %d",retval);
- (void) close(fd);
- cleanexit(retval ? 3 : 0);
- }
- if (exit_now) {
- cleanexit(0);
- }
- dat_len = (int) ntohs(dlen);
- dat = (u_char *) malloc((unsigned)dat_len);
- if (!dat) {
- log("malloc: No memory");
- (void) close(fd);
- cleanexit(4);
- }
- if ((retval = krb_net_read(fd, (char *)dat, dat_len)) != dat_len) {
- if (retval < 0)
- log("data read: %s",error_message(errno));
- else
- log("short read: %d vs. %d", dat_len, retval);
- (void) close(fd);
- cleanexit(5);
- }
- if (exit_now) {
- cleanexit(0);
- }
- if ((retval = kadm_ser_in(&dat,&dat_len)) != KADM_SUCCESS)
- log("processing request: %s", error_message(retval));
-
- /* kadm_ser_in did the processing and returned stuff in
- dat & dat_len , return the appropriate data */
-
- out:
- dlen = (u_short) dat_len;
-
- if (dat_len != (int)dlen) {
- clear_secrets();
- abort(); /* XXX */
- }
- dlen = htons(dlen);
-
- if (krb_net_write(fd, (char *)&dlen, sizeof(u_short)) < 0) {
- log("writing dlen to client: %s",error_message(errno));
- (void) close(fd);
- cleanexit(6);
- }
-
- if (krb_net_write(fd, (char *)dat, dat_len) < 0) {
- log(LOG_ERR, "writing to client: %s",error_message(errno));
- (void) close(fd);
- cleanexit(7);
- }
- free((char *)dat);
- }
- /*NOTREACHED*/
-}
-
-sigtype
-do_child()
-{
- /* SIGCHLD brings us here */
- int pid;
- register int i, j;
-
-#ifdef POSIX
- int status;
-#else
- union wait status;
-#endif
-
- pid = wait(&status);
-
- for (i = 0; i < pidarraysize; i++)
- if (pidarray[i] == pid) {
- /* found it */
- for (j = i; j < pidarraysize-1; j++)
- /* copy others down */
- pidarray[j] = pidarray[j+1];
- pidarraysize--;
- if (WEXITSTATUS(status) || WCOREDUMP(status) || WIFSIGNALED(status))
- log("child %d: termsig %d, coredump %d, retcode %d", pid,
- WTERMSIG(status), WCOREDUMP(status), WEXITSTATUS(status));
-#ifdef POSIX
- return;
-#else /* !POSIX */
- return(0);
-#endif /* POSIX */
- }
- log("child %d not in list: termsig %d, coredump %d, retcode %d", pid,
- WTERMSIG(status), WCOREDUMP(status), WEXITSTATUS(status));
-#ifdef POSIX
- return;
-#else /* !POSIX */
- return(0);
-#endif /* POSIX */
-}
-
-#ifndef DEBUG
-void
-cleanexit(val)
- int val;
-{
- kerb_fini();
- clear_secrets();
- exit(val);
-}
-#endif
-
-void
-kill_children()
-{
- register int i;
- int osigmask;
-
- osigmask = sigblock(sigmask(SIGCHLD));
-
- for (i = 0; i < pidarraysize; i++) {
- kill(pidarray[i], SIGINT);
- log("killing child %d", pidarray[i]);
- }
- sigsetmask(osigmask);
- return;
-}
diff --git a/eBones/kadmind/kadm_funcs.c b/eBones/kadmind/kadm_funcs.c
deleted file mode 100644
index b8ddaa0..0000000
--- a/eBones/kadmind/kadm_funcs.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * Copyright.MIT
- *
- * Kerberos administration server-side database manipulation routines
- */
-
-#if 0
-#ifndef lint
-static char rcsid_kadm_funcs_c[] =
-"Id: kadm_funcs.c,v 4.3 90/03/20 01:39:51 jon Exp ";
-static const char rcsid[] =
- "$Id: kadm_funcs.c,v 1.1 1995/07/18 16:37:02 mark Exp $";
-#endif lint
-#endif
-
-/*
-kadm_funcs.c
-the actual database manipulation code
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <com_err.h>
-#include <sys/param.h>
-#include <kadm.h>
-#include <kadm_err.h>
-#include <krb_db.h>
-#include "kadm_server.h"
-
-extern Kadm_Server server_parm;
-
-int
-check_access(pname, pinst, prealm, acltype)
-char *pname;
-char *pinst;
-char *prealm;
-enum acl_types acltype;
-{
- char checkname[MAX_K_NAME_SZ];
- char filename[MAXPATHLEN];
- extern char *acldir;
-
- sprintf(checkname, "%s.%s@%s", pname, pinst, prealm);
-
- switch (acltype) {
- case ADDACL:
- sprintf(filename, "%s%s", acldir, ADD_ACL_FILE);
- break;
- case GETACL:
- sprintf(filename, "%s%s", acldir, GET_ACL_FILE);
- break;
- case MODACL:
- sprintf(filename, "%s%s", acldir, MOD_ACL_FILE);
- break;
- }
- return(acl_check(filename, checkname));
-}
-
-int
-wildcard(str)
-char *str;
-{
- if (!strcmp(str, WILDCARD_STR))
- return(1);
- return(0);
-}
-
-#define failadd(code) { (void) log("FAILED addding '%s.%s' (%s)", valsin->name, valsin->instance, error_message(code)); return code; }
-
-int
-kadm_add_entry (rname, rinstance, rrealm, valsin, valsout)
-char *rname; /* requestors name */
-char *rinstance; /* requestors instance */
-char *rrealm; /* requestors realm */
-Kadm_vals *valsin;
-Kadm_vals *valsout;
-{
- long numfound; /* check how many we get written */
- int more; /* pointer to more grabbed records */
- Principal data_i, data_o; /* temporary principal */
- u_char flags[4];
- des_cblock newpw;
- Principal default_princ;
-
- if (!check_access(rname, rinstance, rrealm, ADDACL)) {
- (void) log("WARNING: '%s.%s@%s' tried to add an entry for '%s.%s'",
- rname, rinstance, rrealm, valsin->name, valsin->instance);
- return KADM_UNAUTH;
- }
-
- /* Need to check here for "legal" name and instance */
- if (wildcard(valsin->name) || wildcard(valsin->instance)) {
- failadd(KADM_ILL_WILDCARD);
- }
-
- (void) log("request to add an entry for '%s.%s' from '%s.%s@%s'",
- valsin->name, valsin->instance, rname, rinstance, rrealm);
-
- numfound = kerb_get_principal(KERB_DEFAULT_NAME, KERB_DEFAULT_INST,
- &default_princ, 1, &more);
- if (numfound == -1) {
- failadd(KADM_DB_INUSE);
- } else if (numfound != 1) {
- failadd(KADM_UK_RERROR);
- }
-
- kadm_vals_to_prin(valsin->fields, &data_i, valsin);
- (void) strncpy(data_i.name, valsin->name, ANAME_SZ);
- (void) strncpy(data_i.instance, valsin->instance, INST_SZ);
-
- if (!IS_FIELD(KADM_EXPDATE,valsin->fields))
- data_i.exp_date = default_princ.exp_date;
- if (!IS_FIELD(KADM_ATTR,valsin->fields))
- data_i.attributes = default_princ.attributes;
- if (!IS_FIELD(KADM_MAXLIFE,valsin->fields))
- data_i.max_life = default_princ.max_life;
-
- bzero((char *)&default_princ, sizeof(default_princ));
-
- /* convert to host order */
- data_i.key_low = ntohl(data_i.key_low);
- data_i.key_high = ntohl(data_i.key_high);
-
-
- bcopy(&data_i.key_low,newpw,4);
- bcopy(&data_i.key_high,(char *)(((long *) newpw) + 1),4);
-
- /* encrypt new key in master key */
- kdb_encrypt_key (newpw, newpw, server_parm.master_key,
- server_parm.master_key_schedule, ENCRYPT);
- bcopy(newpw,&data_i.key_low,4);
- bcopy((char *)(((long *) newpw) + 1), &data_i.key_high,4);
- bzero((char *)newpw, sizeof(newpw));
-
- data_o = data_i;
- numfound = kerb_get_principal(valsin->name, valsin->instance,
- &data_o, 1, &more);
- if (numfound == -1) {
- failadd(KADM_DB_INUSE);
- } else if (numfound) {
- failadd(KADM_INUSE);
- } else {
- data_i.key_version++;
- data_i.kdc_key_ver = server_parm.master_key_version;
- (void) strncpy(data_i.mod_name, rname, sizeof(data_i.mod_name)-1);
- (void) strncpy(data_i.mod_instance, rinstance,
- sizeof(data_i.mod_instance)-1);
-
- numfound = kerb_put_principal(&data_i, 1);
- if (numfound == -1) {
- failadd(KADM_DB_INUSE);
- } else if (numfound) {
- failadd(KADM_UK_SERROR);
- } else {
- numfound = kerb_get_principal(valsin->name, valsin->instance,
- &data_o, 1, &more);
- if ((numfound!=1) || (more!=0)) {
- failadd(KADM_UK_RERROR);
- }
- bzero((char *)flags, sizeof(flags));
- SET_FIELD(KADM_NAME,flags);
- SET_FIELD(KADM_INST,flags);
- SET_FIELD(KADM_EXPDATE,flags);
- SET_FIELD(KADM_ATTR,flags);
- SET_FIELD(KADM_MAXLIFE,flags);
- kadm_prin_to_vals(flags, valsout, &data_o);
- (void) log("'%s.%s' added.", valsin->name, valsin->instance);
- return KADM_DATA; /* Set all the appropriate fields */
- }
- }
-}
-#undef failadd
-
-#define failget(code) { (void) log("FAILED retrieving '%s.%s' (%s)", valsin->name, valsin->instance, error_message(code)); return code; }
-
-int
-kadm_get_entry (rname, rinstance, rrealm, valsin, flags, valsout)
-char *rname; /* requestors name */
-char *rinstance; /* requestors instance */
-char *rrealm; /* requestors realm */
-Kadm_vals *valsin; /* what they wannt to get */
-u_char *flags; /* which fields we want */
-Kadm_vals *valsout; /* what data is there */
-{
- long numfound; /* check how many were returned */
- int more; /* To point to more name.instances */
- Principal data_o; /* Data object to hold Principal */
-
-
- if (!check_access(rname, rinstance, rrealm, GETACL)) {
- (void) log("WARNING: '%s.%s@%s' tried to get '%s.%s's entry",
- rname, rinstance, rrealm, valsin->name, valsin->instance);
- return KADM_UNAUTH;
- }
-
- if (wildcard(valsin->name) || wildcard(valsin->instance)) {
- failget(KADM_ILL_WILDCARD);
- }
-
- (void) log("retrieve '%s.%s's entry for '%s.%s@%s'",
- valsin->name, valsin->instance, rname, rinstance, rrealm);
-
- /* Look up the record in the database */
- numfound = kerb_get_principal(valsin->name, valsin->instance,
- &data_o, 1, &more);
- if (numfound == -1) {
- failget(KADM_DB_INUSE);
- } else if (numfound) { /* We got the record, let's return it */
- kadm_prin_to_vals(flags, valsout, &data_o);
- (void) log("'%s.%s' retrieved.", valsin->name, valsin->instance);
- return KADM_DATA; /* Set all the appropriate fields */
- } else {
- failget(KADM_NOENTRY); /* Else whimper and moan */
- }
-}
-#undef failget
-
-#define failmod(code) { (void) log("FAILED modifying '%s.%s' (%s)", valsin1->name, valsin1->instance, error_message(code)); return code; }
-
-int
-kadm_mod_entry (rname, rinstance, rrealm, valsin1, valsin2, valsout)
-char *rname; /* requestors name */
-char *rinstance; /* requestors instance */
-char *rrealm; /* requestors realm */
-Kadm_vals *valsin1, *valsin2; /* holds the parameters being
- passed in */
-Kadm_vals *valsout; /* the actual record which is returned */
-{
- long numfound;
- int more;
- Principal data_o, temp_key;
- u_char fields[4];
- des_cblock newpw;
-
- if (wildcard(valsin1->name) || wildcard(valsin1->instance)) {
- failmod(KADM_ILL_WILDCARD);
- }
-
- if (!check_access(rname, rinstance, rrealm, MODACL)) {
- (void) log("WARNING: '%s.%s@%s' tried to change '%s.%s's entry",
- rname, rinstance, rrealm, valsin1->name, valsin1->instance);
- return KADM_UNAUTH;
- }
-
- (void) log("request to modify '%s.%s's entry from '%s.%s@%s' ",
- valsin1->name, valsin1->instance, rname, rinstance, rrealm);
-
- numfound = kerb_get_principal(valsin1->name, valsin1->instance,
- &data_o, 1, &more);
- if (numfound == -1) {
- failmod(KADM_DB_INUSE);
- } else if (numfound) {
- kadm_vals_to_prin(valsin2->fields, &temp_key, valsin2);
- (void) strncpy(data_o.name, valsin1->name, ANAME_SZ);
- (void) strncpy(data_o.instance, valsin1->instance, INST_SZ);
- if (IS_FIELD(KADM_EXPDATE,valsin2->fields))
- data_o.exp_date = temp_key.exp_date;
- if (IS_FIELD(KADM_ATTR,valsin2->fields))
- data_o.attributes = temp_key.attributes;
- if (IS_FIELD(KADM_MAXLIFE,valsin2->fields))
- data_o.max_life = temp_key.max_life;
- if (IS_FIELD(KADM_DESKEY,valsin2->fields)) {
- data_o.key_version++;
- data_o.kdc_key_ver = server_parm.master_key_version;
-
-
- /* convert to host order */
- temp_key.key_low = ntohl(temp_key.key_low);
- temp_key.key_high = ntohl(temp_key.key_high);
-
-
- bcopy(&temp_key.key_low,newpw,4);
- bcopy(&temp_key.key_high,(char *)(((long *) newpw) + 1),4);
-
- /* encrypt new key in master key */
- kdb_encrypt_key (newpw, newpw, server_parm.master_key,
- server_parm.master_key_schedule, ENCRYPT);
- bcopy(newpw,&data_o.key_low,4);
- bcopy((char *)(((long *) newpw) + 1), &data_o.key_high,4);
- bzero((char *)newpw, sizeof(newpw));
- }
- bzero((char *)&temp_key, sizeof(temp_key));
-
- (void) strncpy(data_o.mod_name, rname, sizeof(data_o.mod_name)-1);
- (void) strncpy(data_o.mod_instance, rinstance,
- sizeof(data_o.mod_instance)-1);
- more = kerb_put_principal(&data_o, 1);
-
- bzero((char *)&data_o, sizeof(data_o));
-
- if (more == -1) {
- failmod(KADM_DB_INUSE);
- } else if (more) {
- failmod(KADM_UK_SERROR);
- } else {
- numfound = kerb_get_principal(valsin1->name, valsin1->instance,
- &data_o, 1, &more);
- if ((more!=0)||(numfound!=1)) {
- failmod(KADM_UK_RERROR);
- }
- bzero((char *) fields, sizeof(fields));
- SET_FIELD(KADM_NAME,fields);
- SET_FIELD(KADM_INST,fields);
- SET_FIELD(KADM_EXPDATE,fields);
- SET_FIELD(KADM_ATTR,fields);
- SET_FIELD(KADM_MAXLIFE,fields);
- kadm_prin_to_vals(fields, valsout, &data_o);
- (void) log("'%s.%s' modified.", valsin1->name, valsin1->instance);
- return KADM_DATA; /* Set all the appropriate fields */
- }
- }
- else {
- failmod(KADM_NOENTRY);
- }
-}
-#undef failmod
-
-#define failchange(code) { (void) log("FAILED changing key for '%s.%s@%s' (%s)", rname, rinstance, rrealm, error_message(code)); return code; }
-
-int
-kadm_change (rname, rinstance, rrealm, newpw)
-char *rname;
-char *rinstance;
-char *rrealm;
-des_cblock newpw;
-{
- long numfound;
- int more;
- Principal data_o;
- des_cblock local_pw;
-
- if (strcmp(server_parm.krbrlm, rrealm)) {
- (void) log("change key request from wrong realm, '%s.%s@%s'!\n",
- rname, rinstance, rrealm);
- return(KADM_WRONG_REALM);
- }
-
- if (wildcard(rname) || wildcard(rinstance)) {
- failchange(KADM_ILL_WILDCARD);
- }
- (void) log("'%s.%s@%s' wants to change its password",
- rname, rinstance, rrealm);
-
- bcopy(newpw, local_pw, sizeof(local_pw));
-
- /* encrypt new key in master key */
- kdb_encrypt_key (local_pw, local_pw, server_parm.master_key,
- server_parm.master_key_schedule, ENCRYPT);
-
- numfound = kerb_get_principal(rname, rinstance,
- &data_o, 1, &more);
- if (numfound == -1) {
- failchange(KADM_DB_INUSE);
- } else if (numfound) {
- bcopy(local_pw,&data_o.key_low,4);
- bcopy((char *)(((long *) local_pw) + 1), &data_o.key_high,4);
- data_o.key_version++;
- data_o.kdc_key_ver = server_parm.master_key_version;
- (void) strncpy(data_o.mod_name, rname, sizeof(data_o.mod_name)-1);
- (void) strncpy(data_o.mod_instance, rinstance,
- sizeof(data_o.mod_instance)-1);
- more = kerb_put_principal(&data_o, 1);
- bzero((char *) local_pw, sizeof(local_pw));
- bzero((char *) &data_o, sizeof(data_o));
- if (more == -1) {
- failchange(KADM_DB_INUSE);
- } else if (more) {
- failchange(KADM_UK_SERROR);
- } else {
- (void) log("'%s.%s@%s' password changed.", rname, rinstance, rrealm);
- return KADM_SUCCESS;
- }
- }
- else {
- failchange(KADM_NOENTRY);
- }
-}
-#undef failchange
diff --git a/eBones/kadmind/kadm_ser_wrap.c b/eBones/kadmind/kadm_ser_wrap.c
deleted file mode 100644
index 0fa1ace..0000000
--- a/eBones/kadmind/kadm_ser_wrap.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * Copyright.MIT.
- *
- * Kerberos administration server-side support functions
- */
-
-#if 0
-#ifndef lint
-static char rcsid_module_c[] =
-"BonesHeader: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadm_ser_wrap.c,v 4.4 89/09/26 09:29:36 jtkohl Exp ";
-#endif lint
-#endif
-
-/*
-kadm_ser_wrap.c
-unwraps wrapped packets and calls the appropriate server subroutine
-*/
-
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <kadm.h>
-#include <kadm_err.h>
-#include <krb_err.h>
-#include "kadm_server.h"
-
-Kadm_Server server_parm;
-
-/*
-kadm_ser_init
-set up the server_parm structure
-*/
-int
-kadm_ser_init(inter, realm)
-int inter; /* interactive or from file */
-char realm[];
-{
- struct servent *sep;
- struct hostent *hp;
- char hostname[MAXHOSTNAMELEN];
-
- init_kadm_err_tbl();
- init_krb_err_tbl();
- if (gethostname(hostname, sizeof(hostname)))
- return KADM_NO_HOSTNAME;
-
- strcpy(server_parm.sname, PWSERV_NAME);
- strcpy(server_parm.sinst, KRB_MASTER);
- strcpy(server_parm.krbrlm, realm);
-
- server_parm.admin_fd = -1;
- /* setting up the addrs */
- if ((sep = getservbyname(KADM_SNAME, "tcp")) == NULL)
- return KADM_NO_SERV;
- bzero((char *)&server_parm.admin_addr,sizeof(server_parm.admin_addr));
- server_parm.admin_addr.sin_family = AF_INET;
- if ((hp = gethostbyname(hostname)) == NULL)
- return KADM_NO_HOSTNAME;
- server_parm.admin_addr.sin_addr.s_addr = INADDR_ANY;
- server_parm.admin_addr.sin_port = sep->s_port;
- /* setting up the database */
- if (kdb_get_master_key((inter==1),server_parm.master_key,
- server_parm.master_key_schedule) != 0)
- return KADM_NO_MAST;
- if ((server_parm.master_key_version =
- kdb_verify_master_key(server_parm.master_key,
- server_parm.master_key_schedule,stderr))<0)
- return KADM_NO_VERI;
- return KADM_SUCCESS;
-}
-
-static void
-errpkt(dat, dat_len, code)
-u_char **dat;
-int *dat_len;
-int code;
-{
- u_long retcode;
- char *pdat;
-
- free((char *)*dat); /* free up req */
- *dat_len = KADM_VERSIZE + sizeof(u_long);
- *dat = (u_char *) malloc((unsigned)*dat_len);
- pdat = (char *) *dat;
- retcode = htonl((u_long) code);
- (void) strncpy(pdat, KADM_ULOSE, KADM_VERSIZE);
- bcopy((char *)&retcode, &pdat[KADM_VERSIZE], sizeof(u_long));
- return;
-}
-
-/*
-kadm_ser_in
-unwrap the data stored in dat, process, and return it.
-*/
-int
-kadm_ser_in(dat,dat_len)
-u_char **dat;
-int *dat_len;
-{
- u_char *in_st; /* pointer into the sent packet */
- int in_len,retc; /* where in packet we are, for
- returns */
- u_long r_len; /* length of the actual packet */
- KTEXT_ST authent; /* the authenticator */
- AUTH_DAT ad; /* who is this, klink */
- u_long ncksum; /* checksum of encrypted data */
- des_key_schedule sess_sched; /* our schedule */
- MSG_DAT msg_st;
- u_char *retdat, *tmpdat;
- int retval, retlen;
-
- if (strncmp(KADM_VERSTR, (char *)*dat, KADM_VERSIZE)) {
- errpkt(dat, dat_len, KADM_BAD_VER);
- return KADM_BAD_VER;
- }
- in_len = KADM_VERSIZE;
- /* get the length */
- if ((retc = stv_long(*dat, &r_len, in_len, *dat_len)) < 0)
- return KADM_LENGTH_ERROR;
- in_len += retc;
- authent.length = *dat_len - r_len - KADM_VERSIZE - sizeof(u_long);
- bcopy((char *)(*dat) + in_len, (char *)authent.dat, authent.length);
- authent.mbz = 0;
- /* service key should be set before here */
- if ((retc = krb_rd_req(&authent, server_parm.sname, server_parm.sinst,
- server_parm.recv_addr.sin_addr.s_addr, &ad, (char *)0)))
- {
- errpkt(dat, dat_len,retc + krb_err_base);
- return retc + krb_err_base;
- }
-
-#define clr_cli_secrets() {bzero((char *)sess_sched, sizeof(sess_sched)); bzero((char *)ad.session, sizeof(ad.session));}
-
- in_st = *dat + *dat_len - r_len;
-#ifdef NOENCRYPTION
- ncksum = 0;
-#else
- ncksum = quad_cksum((des_cblock *)in_st, (des_cblock *)0, (long) r_len,
- 0, (des_cblock *)ad.session);
-#endif
- if (ncksum!=ad.checksum) { /* yow, are we correct yet */
- clr_cli_secrets();
- errpkt(dat, dat_len,KADM_BAD_CHK);
- return KADM_BAD_CHK;
- }
-#ifdef NOENCRYPTION
- bzero(sess_sched, sizeof(sess_sched));
-#else
- des_key_sched((des_cblock *)ad.session, sess_sched);
-#endif
- if ((retc = (int) krb_rd_priv(in_st, r_len, sess_sched, ad.session,
- &server_parm.recv_addr,
- &server_parm.admin_addr, &msg_st))) {
- clr_cli_secrets();
- errpkt(dat, dat_len,retc + krb_err_base);
- return retc + krb_err_base;
- }
- switch (msg_st.app_data[0]) {
- case CHANGE_PW:
- retval = kadm_ser_cpw(msg_st.app_data+1,(int) msg_st.app_length,&ad,
- &retdat, &retlen);
- break;
- case ADD_ENT:
- retval = kadm_ser_add(msg_st.app_data+1,(int) msg_st.app_length,&ad,
- &retdat, &retlen);
- break;
- case GET_ENT:
- retval = kadm_ser_get(msg_st.app_data+1,(int) msg_st.app_length,&ad,
- &retdat, &retlen);
- break;
- case MOD_ENT:
- retval = kadm_ser_mod(msg_st.app_data+1,(int) msg_st.app_length,&ad,
- &retdat, &retlen);
- break;
- default:
- clr_cli_secrets();
- errpkt(dat, dat_len, KADM_NO_OPCODE);
- return KADM_NO_OPCODE;
- }
- /* Now seal the response back into a priv msg */
- free((char *)*dat);
- tmpdat = (u_char *) malloc((unsigned)(retlen + KADM_VERSIZE +
- sizeof(u_long)));
- (void) strncpy((char *)tmpdat, KADM_VERSTR, KADM_VERSIZE);
- retval = htonl((u_long)retval);
- bcopy((char *)&retval, (char *)tmpdat + KADM_VERSIZE, sizeof(u_long));
- if (retlen) {
- bcopy((char *)retdat, (char *)tmpdat + KADM_VERSIZE + sizeof(u_long),
- retlen);
- free((char *)retdat);
- }
- /* slop for mk_priv stuff */
- *dat = (u_char *) malloc((unsigned) (retlen + KADM_VERSIZE +
- sizeof(u_long) + 200));
- if ((*dat_len = krb_mk_priv(tmpdat, *dat,
- (u_long) (retlen + KADM_VERSIZE +
- sizeof(u_long)),
- sess_sched,
- ad.session, &server_parm.admin_addr,
- &server_parm.recv_addr)) < 0) {
- clr_cli_secrets();
- errpkt(dat, dat_len, KADM_NO_ENCRYPT);
- return KADM_NO_ENCRYPT;
- }
- clr_cli_secrets();
- return KADM_SUCCESS;
-}
diff --git a/eBones/kadmind/kadm_server.c b/eBones/kadmind/kadm_server.c
deleted file mode 100644
index c6cbc6a..0000000
--- a/eBones/kadmind/kadm_server.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * Copyright.MIT.
- *
- * Kerberos administration server-side subroutines
- */
-
-#if 0
-#ifndef lint
-static char rcsid_kadm_server_c[] =
-"Header: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadm_server.c,v 4.2 89/09/26 09:30:23 jtkohl Exp ";
-#endif lint
-#endif
-
-#include <string.h>
-#include <kadm.h>
-#include <kadm_err.h>
-#include "kadm_server.h"
-
-/*
-kadm_ser_cpw - the server side of the change_password routine
- recieves : KTEXT, {key}
- returns : CKSUM, RETCODE
- acl : caller can change only own password
-
-Replaces the password (i.e. des key) of the caller with that specified in key.
-Returns no actual data from the master server, since this is called by a user
-*/
-int
-kadm_ser_cpw(dat, len, ad, datout, outlen)
-u_char *dat;
-int len;
-AUTH_DAT *ad;
-u_char **datout;
-int *outlen;
-{
- unsigned long keylow, keyhigh;
- des_cblock newkey;
- int stvlen;
-
- /* take key off the stream, and change the database */
-
- if ((stvlen = stv_long(dat, &keyhigh, 0, len)) < 0)
- return(KADM_LENGTH_ERROR);
- if (stv_long(dat, &keylow, stvlen, len) < 0)
- return(KADM_LENGTH_ERROR);
-
- keylow = ntohl(keylow);
- keyhigh = ntohl(keyhigh);
- bcopy((char *)&keyhigh, (char *)(((long *)newkey) + 1), 4);
- bcopy((char *)&keylow, (char *)newkey, 4);
- *datout = 0;
- *outlen = 0;
-
- return(kadm_change(ad->pname, ad->pinst, ad->prealm, newkey));
-}
-
-/*
-kadm_ser_add - the server side of the add_entry routine
- recieves : KTEXT, {values}
- returns : CKSUM, RETCODE, {values}
- acl : su, sms (as alloc)
-
-Adds and entry containing values to the database
-returns the values of the entry, so if you leave certain fields blank you will
- be able to determine the default values they are set to
-*/
-int
-kadm_ser_add(dat,len,ad, datout, outlen)
-u_char *dat;
-int len;
-AUTH_DAT *ad;
-u_char **datout;
-int *outlen;
-{
- Kadm_vals values, retvals;
- int status;
-
- if ((status = stream_to_vals(dat, &values, len)) < 0)
- return(KADM_LENGTH_ERROR);
- if ((status = kadm_add_entry(ad->pname, ad->pinst, ad->prealm,
- &values, &retvals)) == KADM_DATA) {
- *outlen = vals_to_stream(&retvals,datout);
- return KADM_SUCCESS;
- } else {
- *outlen = 0;
- return status;
- }
-}
-
-/*
-kadm_ser_mod - the server side of the mod_entry routine
- recieves : KTEXT, {values, values}
- returns : CKSUM, RETCODE, {values}
- acl : su, sms (as register or dealloc)
-
-Modifies all entries corresponding to the first values so they match the
- second values.
-returns the values for the changed entries
-*/
-int
-kadm_ser_mod(dat,len,ad, datout, outlen)
-u_char *dat;
-int len;
-AUTH_DAT *ad;
-u_char **datout;
-int *outlen;
-{
- Kadm_vals vals1, vals2, retvals;
- int wh;
- int status;
-
- if ((wh = stream_to_vals(dat, &vals1, len)) < 0)
- return KADM_LENGTH_ERROR;
- if ((status = stream_to_vals(dat+wh,&vals2, len-wh)) < 0)
- return KADM_LENGTH_ERROR;
- if ((status = kadm_mod_entry(ad->pname, ad->pinst, ad->prealm, &vals1,
- &vals2, &retvals)) == KADM_DATA) {
- *outlen = vals_to_stream(&retvals,datout);
- return KADM_SUCCESS;
- } else {
- *outlen = 0;
- return status;
- }
-}
-
-/*
-kadm_ser_get
- recieves : KTEXT, {values, flags}
- returns : CKSUM, RETCODE, {count, values, values, values}
- acl : su
-
-gets the fields requested by flags from all entries matching values
-returns this data for each matching recipient, after a count of how many such
- matches there were
-*/
-int
-kadm_ser_get(dat,len,ad, datout, outlen)
-u_char *dat;
-int len;
-AUTH_DAT *ad;
-u_char **datout;
-int *outlen;
-{
- Kadm_vals values, retvals;
- u_char fl[FLDSZ];
- int loop,wh;
- int status;
-
- if ((wh = stream_to_vals(dat, &values, len)) < 0)
- return KADM_LENGTH_ERROR;
- if (wh + FLDSZ > len)
- return KADM_LENGTH_ERROR;
- for (loop=FLDSZ-1; loop>=0; loop--)
- fl[loop] = dat[wh++];
- if ((status = kadm_get_entry(ad->pname, ad->pinst, ad->prealm,
- &values, fl, &retvals)) == KADM_DATA) {
- *outlen = vals_to_stream(&retvals,datout);
- return KADM_SUCCESS;
- } else {
- *outlen = 0;
- return status;
- }
-}
-
diff --git a/eBones/kadmind/kadm_server.h b/eBones/kadmind/kadm_server.h
deleted file mode 100644
index 1708107..0000000
--- a/eBones/kadmind/kadm_server.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * $Source: /usr/cvs/src/eBones/kadmind/kadm_server.h,v $
- * $Author: mark $
- * Header: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadm_server.h,v 4.1 89/12/21 17:46:51 jtkohl Exp
- *
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * Copyright.MIT.
- *
- * Definitions for Kerberos administration server & client
- */
-
-#ifndef KADM_SERVER_DEFS
-#define KADM_SERVER_DEFS
-
-/*
- * kadm_server.h
- * Header file for the fourth attempt at an admin server
- * Doug Church, December 28, 1989, MIT Project Athena
- * ps. Yes that means this code belongs to athena etc...
- * as part of our ongoing attempt to copyright all greek names
- */
-
-#include <sys/types.h>
-#include <krb.h>
-#include <des.h>
-
-typedef struct {
- struct sockaddr_in admin_addr;
- struct sockaddr_in recv_addr;
- int recv_addr_len;
- int admin_fd; /* our link to clients */
- char sname[ANAME_SZ];
- char sinst[INST_SZ];
- char krbrlm[REALM_SZ];
- C_Block master_key;
- C_Block session_key;
- Key_schedule master_key_schedule;
- long master_key_version;
-} Kadm_Server;
-
-/* the default syslog file */
-#define KADM_SYSLOG "/var/log/kadmind.syslog"
-
-#define DEFAULT_ACL_DIR "/etc/kerberosIV"
-#define ADD_ACL_FILE "/admin_acl.add"
-#define GET_ACL_FILE "/admin_acl.get"
-#define MOD_ACL_FILE "/admin_acl.mod"
-
-int kadm_ser_in(unsigned char **dat, int *dat_len);
-int kadm_ser_init(int inter, char realm[]);
-int kadm_ser_cpw(u_char *dat, int len, AUTH_DAT *ad, u_char **datout,
- int *outlen);
-int kadm_ser_add(u_char *dat, int len, AUTH_DAT *ad, u_char **datout,
- int *outlen);
-int kadm_ser_mod(u_char *dat, int len, AUTH_DAT *ad, u_char **datout,
- int *outlen);
-int kadm_ser_get(u_char *dat, int len, AUTH_DAT *ad, u_char **datout,
- int *outlen);
-int kadm_change (char *rname, char *rinstance, char *rrealm,
- des_cblock newpw);
-int kadm_add_entry(char *rname, char *rinstance, char *rrealm,
- Kadm_vals *valsin, Kadm_vals *valsout);
-int kadm_mod_entry(char *rname, char *rinstance, char *rrealm,
- Kadm_vals *valsin1, Kadm_vals *valsin2, Kadm_vals *valsout);
-int kadm_get_entry(char *rname, char *rinstance, char *rrealm,
- Kadm_vals *valsin, u_char *flags, Kadm_vals *valsout);
-
-#endif KADM_SERVER_DEFS
diff --git a/eBones/kadmind/kadmind.8 b/eBones/kadmind/kadmind.8
deleted file mode 100644
index 1eb10d7..0000000
--- a/eBones/kadmind/kadmind.8
+++ /dev/null
@@ -1,117 +0,0 @@
-.\" from: kadmind.8,v 4.1 89/07/25 17:28:33 jtkohl Exp $
-.\" $Id: kadmind.8,v 1.1.1.1 1994/09/30 14:50:06 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KADMIND 8 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-kadmind \- network daemon for Kerberos database administration
-.SH SYNOPSIS
-.B kadmind
-[
-.B \-n
-] [
-.B \-h
-] [
-.B \-r realm
-] [
-.B \-f filename
-] [
-.B \-d dbname
-] [
-.B \-a acldir
-]
-.SH DESCRIPTION
-.I kadmind
-is the network database server for the Kerberos password-changing and
-administration tools.
-.PP
-Upon execution, it prompts the user to enter the master key string for
-the database.
-.PP
-If the
-.B \-n
-option is specified, the master key is instead fetched from the master
-key cache file.
-.PP
-If the
-.B \-r
-.I realm
-option is specified, the admin server will pretend that its
-local realm is
-.I realm
-instead of the actual local realm of the host it is running on.
-This makes it possible to run a server for a foreign kerberos
-realm.
-.PP
-If the
-.B \-f
-.I filename
-option is specified, then that file is used to hold the log information
-instead of the default.
-.PP
-If the
-.B \-d
-.I dbname
-option is specified, then that file is used as the database name instead
-of the default.
-.PP
-If the
-.B \-a
-.I acldir
-option is specified, then
-.I acldir
-is used as the directory in which to search for access control lists
-instead of the default.
-.PP
-If the
-.B \-h
-option is specified,
-.I kadmind
-prints out a short summary of the permissible control arguments, and
-then exits.
-.PP
-When performing requests on behalf of clients,
-.I kadmind
-checks access control lists (ACLs) to determine the authorization of the client
-to perform the requested action.
-Currently three distinct access types are supported:
-.TP 1i
-Addition
-(.add ACL file). If a principal is on this list, it may add new
-principals to the database.
-.TP
-Retrieval
-(.get ACL file). If a principal is on this list, it may retrieve
-database entries. NOTE: A principal's private key is never returned by
-the get functions.
-.TP
-Modification
-(.mod ACL file). If a principal is on this list, it may modify entries
-in the database.
-.PP
-A principal is always granted authorization to change its own password.
-.SH FILES
-.TP 20n
-/var/log/kadmind.syslog
-Default log file.
-.TP
-/etc/kerberosIV/admin_acl.{add,get,mod}
-Access control list files
-.TP
-/etc/kerberosIV/principal.db
-DBM file containing database
-.TP
-/etc/kerberosIV/principal.ok
-Semaphore indicating that the DBM database is not being modified.
-.TP
-/etc/kerberosIV/master_key
-Master key cache file.
-.SH "SEE ALSO"
-kerberos(1), kpasswd(1), kadmin(8), acl_check(3)
-.SH AUTHORS
-Douglas A. Church, MIT Project Athena
-.br
-John T. Kohl, Project Athena/Digital Equipment Corporation
diff --git a/eBones/kdb/Makefile b/eBones/kdb/Makefile
deleted file mode 100644
index 42f4235..0000000
--- a/eBones/kdb/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# From: @(#)Makefile 5.1 (Berkeley) 6/25/90
-# $Id: Makefile,v 1.4 1995/07/18 16:37:10 mark Exp $
-
-SHLIB_MAJOR= 2
-SHLIB_MINOR= 0
-
-LIB= kdb
-CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -Wall
-SRCS= krb_cache.c krb_dbm.c krb_kdb_utils.c krb_lib.c print_princ.c
-
-.include <bsd.lib.mk>
diff --git a/eBones/kdb/krb_cache.c b/eBones/kdb/krb_cache.c
deleted file mode 100644
index 1c7c9ce..0000000
--- a/eBones/kdb/krb_cache.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * This is where a cache would be implemented, if it were necessary.
- *
- * from: krb_cache.c,v 4.5 89/01/24 18:12:34 jon Exp $
- * $Id: krb_cache.c,v 1.3 1995/07/18 16:37:12 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: krb_cache.c,v 1.3 1995/07/18 16:37:12 mark Exp $";
-#endif lint
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/uio.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <strings.h>
-#include <des.h>
-#include <krb.h>
-#include <krb_db.h>
-
-#ifdef DEBUG
-extern int debug;
-extern long kerb_debug;
-#endif
-static init = 0;
-
-/*
- * initialization routine for cache
- */
-
-int
-kerb_cache_init()
-{
- init = 1;
- return (0);
-}
-
-/*
- * look up a principal in the cache returns number of principals found
- */
-
-int
-kerb_cache_get_principal(serv, inst, principal, max)
- char *serv; /* could have wild card */
- char *inst; /* could have wild card */
- Principal *principal;
- unsigned int max; /* max number of name structs to return */
-
-{
- int found = 0;
-
- if (!init)
- kerb_cache_init();
-#ifdef DEBUG
- if (kerb_debug & 2) {
- fprintf(stderr, "cache_get_principal for %s %s max = %d\n",
- serv, inst, max);
- if (found) {
- fprintf(stderr, "cache get %s %s found %s %s\n",
- serv, inst, principal->name, principal->instance);
- } else {
- fprintf(stderr, "cache %s %s not found\n", serv,
- inst);
- }
- }
-#endif
- return (found);
-}
-
-/*
- * insert/replace a principal in the cache returns number of principals
- * inserted
- */
-
-int
-kerb_cache_put_principal(principal, max)
- Principal *principal;
- unsigned int max; /* max number of principal structs to
- * insert */
-
-{
- u_long i;
- int count = 0;
-
- if (!init)
- kerb_cache_init();
-
-#ifdef DEBUG
- if (kerb_debug & 2) {
- fprintf(stderr, "kerb_cache_put_principal max = %d",
- max);
- }
-#endif
-
- for (i = 0; i < max; i++) {
-#ifdef DEBUG
- if (kerb_debug & 2)
- fprintf(stderr, "\n %s %s",
- principal->name, principal->instance);
-#endif
- /* DO IT */
- count++;
- principal++;
- }
- return count;
-}
-
-/*
- * look up a dba in the cache returns number of dbas found
- */
-
-int
-kerb_cache_get_dba(serv, inst, dba, max)
- char *serv; /* could have wild card */
- char *inst; /* could have wild card */
- Dba *dba;
- unsigned int max; /* max number of name structs to return */
-
-{
- int found = 0;
-
- if (!init)
- kerb_cache_init();
-
-#ifdef DEBUG
- if (kerb_debug & 2) {
- fprintf(stderr, "cache_get_dba for %s %s max = %d\n",
- serv, inst, max);
- if (found) {
- fprintf(stderr, "cache get %s %s found %s %s\n",
- serv, inst, dba->name, dba->instance);
- } else {
- fprintf(stderr, "cache %s %s not found\n", serv, inst);
- }
- }
-#endif
- return (found);
-}
-
-/*
- * insert/replace a dba in the cache returns number of dbas inserted
- */
-
-int
-kerb_cache_put_dba(dba, max)
- Dba *dba;
- unsigned int max; /* max number of dba structs to insert */
-
-{
- u_long i;
- int count = 0;
-
- if (!init)
- kerb_cache_init();
-#ifdef DEBUG
- if (kerb_debug & 2) {
- fprintf(stderr, "kerb_cache_put_dba max = %d", max);
- }
-#endif
- for (i = 0; i < max; i++) {
-#ifdef DEBUG
- if (kerb_debug & 2)
- fprintf(stderr, "\n %s %s",
- dba->name, dba->instance);
-#endif
- /* DO IT */
- count++;
- dba++;
- }
- return count;
-}
-
diff --git a/eBones/kdb/krb_dbm.c b/eBones/kdb/krb_dbm.c
deleted file mode 100644
index 760bd6f..0000000
--- a/eBones/kdb/krb_dbm.c
+++ /dev/null
@@ -1,789 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: krb_dbm.c,v 4.9 89/04/18 16:15:13 wesommer Exp $
- * $Id: krb_dbm.c,v 1.4 1995/08/03 17:15:42 mark Exp $
-*/
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: krb_dbm.c,v 1.4 1995/08/03 17:15:42 mark Exp $";
-#endif lint
-#endif
-
-#if defined(__FreeBSD__) || defined(__NetBSD__)
-#define _NDBM_
-#endif
-
-#if defined(__FreeBSD__) || defined(__NetBSD__)
-#define _DBM_
-#endif
-
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/uio.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <sys/resource.h>
-#include <sys/errno.h>
-#include <strings.h>
-#include <des.h>
-#include <sys/file.h>
-#ifdef _NDBM_
-#include <ndbm.h>
-#else /*_NDBM_*/
-#include <dbm.h>
-#endif /*_NDBM_*/
-/* before krb_db.h */
-#include <krb.h>
-#include <krb_db.h>
-
-#ifdef dbm_pagfno
-#define DB
-#endif
-
-#define KERB_DB_MAX_RETRY 5
-
-#ifdef DEBUG
-extern int debug;
-extern long kerb_debug;
-extern char *progname;
-#endif
-
-static init = 0;
-static char default_db_name[] = DBM_FILE;
-static char *current_db_name = default_db_name;
-static void encode_princ_key(datum *key, char *name, char *instance);
-static void decode_princ_key(datum *key, char *name, char *instance);
-static void encode_princ_contents(datum *contents, Principal *principal);
-static void decode_princ_contents(datum *contents, Principal *principal);
-static void kerb_dbl_fini(void);
-static int kerb_dbl_lock(int mode);
-static void kerb_dbl_unlock(void);
-static long kerb_start_update(char *db_name);
-static long kerb_end_update(char *db_name, long age);
-
-static struct timeval timestamp;/* current time of request */
-static int non_blocking = 0;
-
-/*
- * This module contains all of the code which directly interfaces to
- * the underlying representation of the Kerberos database; this
- * implementation uses a DBM or NDBM indexed "file" (actually
- * implemented as two separate files) to store the relations, plus a
- * third file as a semaphore to allow the database to be replaced out
- * from underneath the KDC server.
- */
-
-/*
- * Locking:
- *
- * There are two distinct locking protocols used. One is designed to
- * lock against processes (the admin_server, for one) which make
- * incremental changes to the database; the other is designed to lock
- * against utilities (kdb_util, kpropd) which replace the entire
- * database in one fell swoop.
- *
- * The first locking protocol is implemented using flock() in the
- * krb_dbl_lock() and krb_dbl_unlock routines.
- *
- * The second locking protocol is necessary because DBM "files" are
- * actually implemented as two separate files, and it is impossible to
- * atomically rename two files simultaneously. It assumes that the
- * database is replaced only very infrequently in comparison to the time
- * needed to do a database read operation.
- *
- * A third file is used as a "version" semaphore; the modification
- * time of this file is the "version number" of the database.
- * At the start of a read operation, the reader checks the version
- * number; at the end of the read operation, it checks again. If the
- * version number changed, or if the semaphore was nonexistant at
- * either time, the reader sleeps for a second to let things
- * stabilize, and then tries again; if it does not succeed after
- * KERB_DB_MAX_RETRY attempts, it gives up.
- *
- * On update, the semaphore file is deleted (if it exists) before any
- * update takes place; at the end of the update, it is replaced, with
- * a version number strictly greater than the version number which
- * existed at the start of the update.
- *
- * If the system crashes in the middle of an update, the semaphore
- * file is not automatically created on reboot; this is a feature, not
- * a bug, since the database may be inconsistant. Note that the
- * absence of a semaphore file does not prevent another _update_ from
- * taking place later. Database replacements take place automatically
- * only on slave servers; a crash in the middle of an update will be
- * fixed by the next slave propagation. A crash in the middle of an
- * update on the master would be somewhat more serious, but this would
- * likely be noticed by an administrator, who could fix the problem and
- * retry the operation.
- */
-
-/* Macros to convert ndbm names to dbm names.
- * Note that dbm_nextkey() cannot be simply converted using a macro, since
- * it is invoked giving the database, and nextkey() needs the previous key.
- *
- * Instead, all routines call "dbm_next" instead.
- */
-
-#ifndef _NDBM_
-typedef char DBM;
-
-#define dbm_open(file, flags, mode) ((dbminit(file) == 0)?"":((char *)0))
-#define dbm_fetch(db, key) fetch(key)
-#define dbm_store(db, key, content, flag) store(key, content)
-#define dbm_firstkey(db) firstkey()
-#define dbm_next(db,key) nextkey(key)
-#define dbm_close(db) dbmclose()
-#else
-#define dbm_next(db,key) dbm_nextkey(db)
-#endif
-
-/*
- * Utility routine: generate name of database file.
- */
-
-static char *gen_dbsuffix(db_name, sfx)
- char *db_name;
- char *sfx;
-{
- char *dbsuffix;
-
- if (sfx == NULL)
- sfx = ".ok";
-
- dbsuffix = malloc (strlen(db_name) + strlen(sfx) + 1);
- strcpy(dbsuffix, db_name);
- strcat(dbsuffix, sfx);
- return dbsuffix;
-}
-
-/*
- * initialization for data base routines.
- */
-
-int
-kerb_db_init()
-{
- init = 1;
- return (0);
-}
-
-/*
- * gracefully shut down database--must be called by ANY program that does
- * a kerb_db_init
- */
-
-void
-kerb_db_fini()
-{
-}
-
-/*
- * Set the "name" of the current database to some alternate value.
- *
- * Passing a null pointer as "name" will set back to the default.
- * If the alternate database doesn't exist, nothing is changed.
- */
-
-int
-kerb_db_set_name(name)
- char *name;
-{
- DBM *db;
-
- if (name == NULL)
- name = default_db_name;
- db = dbm_open(name, 0, 0);
- if (db == NULL)
- return errno;
- dbm_close(db);
- kerb_dbl_fini();
- current_db_name = name;
- return 0;
-}
-
-/*
- * Return the last modification time of the database.
- */
-
-long
-kerb_get_db_age()
-{
- struct stat st;
- char *okname;
- long age;
-
- okname = gen_dbsuffix(current_db_name, ".ok");
-
- if (stat (okname, &st) < 0)
- age = 0;
- else
- age = st.st_mtime;
-
- free (okname);
- return age;
-}
-
-/*
- * Remove the semaphore file; indicates that database is currently
- * under renovation.
- *
- * This is only for use when moving the database out from underneath
- * the server (for example, during slave updates).
- */
-
-static long
-kerb_start_update(db_name)
- char *db_name;
-{
- char *okname = gen_dbsuffix(db_name, ".ok");
- long age = kerb_get_db_age();
-
- if (unlink(okname) < 0
- && errno != ENOENT) {
- age = -1;
- }
- free (okname);
- return age;
-}
-
-static long
-kerb_end_update(db_name, age)
- char *db_name;
- long age;
-{
- int fd;
- int retval = 0;
- char *new_okname = gen_dbsuffix(db_name, ".ok#");
- char *okname = gen_dbsuffix(db_name, ".ok");
-
- fd = open (new_okname, O_CREAT|O_RDWR|O_TRUNC, 0600);
- if (fd < 0)
- retval = errno;
- else {
- struct stat st;
- struct timeval tv[2];
- /* make sure that semaphore is "after" previous value. */
- if (fstat (fd, &st) == 0
- && st.st_mtime <= age) {
- tv[0].tv_sec = st.st_atime;
- tv[0].tv_usec = 0;
- tv[1].tv_sec = age;
- tv[1].tv_usec = 0;
- /* set times.. */
- utimes (new_okname, tv);
- fsync(fd);
- }
- close(fd);
- if (rename (new_okname, okname) < 0)
- retval = errno;
- }
-
- free (new_okname);
- free (okname);
-
- return retval;
-}
-
-static long
-kerb_start_read()
-{
- return kerb_get_db_age();
-}
-
-static long
-kerb_end_read(age)
- u_long age;
-{
- if (kerb_get_db_age() != age || age == -1) {
- return -1;
- }
- return 0;
-}
-
-/*
- * Create the database, assuming it's not there.
- */
-
-int
-kerb_db_create(db_name)
- char *db_name;
-{
- char *okname = gen_dbsuffix(db_name, ".ok");
- int fd;
- register int ret = 0;
-#ifdef _NDBM_
- DBM *db;
-
- db = dbm_open(db_name, O_RDWR|O_CREAT|O_EXCL, 0600);
- if (db == NULL)
- ret = errno;
- else
- dbm_close(db);
-#else
- char *dirname = gen_dbsuffix(db_name, ".dir");
- char *pagname = gen_dbsuffix(db_name, ".pag");
-
- fd = open(dirname, O_RDWR|O_CREAT|O_EXCL, 0600);
- if (fd < 0)
- ret = errno;
- else {
- close(fd);
- fd = open (pagname, O_RDWR|O_CREAT|O_EXCL, 0600);
- if (fd < 0)
- ret = errno;
- else
- close(fd);
- }
- if (dbminit(db_name) < 0)
- ret = errno;
-#endif
- if (ret == 0) {
- fd = open (okname, O_CREAT|O_RDWR|O_TRUNC, 0600);
- if (fd < 0)
- ret = errno;
- close(fd);
- }
- return ret;
-}
-
-/*
- * "Atomically" rename the database in a way that locks out read
- * access in the middle of the rename.
- *
- * Not perfect; if we crash in the middle of an update, we don't
- * necessarily know to complete the transaction the rename, but...
- */
-
-int
-kerb_db_rename(from, to)
- char *from;
- char *to;
-{
-#ifdef _DBM_
- char *fromdb = gen_dbsuffix (from, ".db");
- char *todb = gen_dbsuffix (to, ".db");
-#else
- char *fromdir = gen_dbsuffix (from, ".dir");
- char *todir = gen_dbsuffix (to, ".dir");
- char *frompag = gen_dbsuffix (from , ".pag");
- char *topag = gen_dbsuffix (to, ".pag");
-#endif
- char *fromok = gen_dbsuffix(from, ".ok");
- long trans = kerb_start_update(to);
- int ok = 0;
-
-#ifdef _DBM_
- if (rename (fromdb, todb) == 0) {
-#else
- if ((rename (fromdir, todir) == 0)
- && (rename (frompag, topag) == 0)) {
-#endif
- (void) unlink (fromok);
- ok = 1;
- }
-
- free (fromok);
-#ifdef _DBM_
- free (fromdb);
- free (todb);
-#else
- free (fromdir);
- free (todir);
- free (frompag);
- free (topag);
-#endif
- if (ok)
- return kerb_end_update(to, trans);
- else
- return -1;
-}
-
-/*
- * look up a principal in the data base returns number of principals
- * found , and whether there were more than requested.
- */
-
-int
-kerb_db_get_principal(name, inst, principal, max, more)
- char *name; /* could have wild card */
- char *inst; /* could have wild card */
- Principal *principal;
- unsigned int max; /* max number of name structs to return */
- int *more; /* where there more than 'max' tuples? */
-
-{
- int found = 0, code;
- extern int errorproc();
- int wildp, wildi;
- datum key, contents;
- char testname[ANAME_SZ], testinst[INST_SZ];
- u_long trans;
- int try;
- DBM *db;
-
- if (!init)
- kerb_db_init(); /* initialize database routines */
-
- for (try = 0; try < KERB_DB_MAX_RETRY; try++) {
- trans = kerb_start_read();
-
- if ((code = kerb_dbl_lock(KERB_DBL_SHARED)) != 0)
- return -1;
-
- db = dbm_open(current_db_name, O_RDONLY, 0600);
-
- *more = 0;
-
-#ifdef DEBUG
- if (kerb_debug & 2)
- fprintf(stderr,
- "%s: db_get_principal for %s %s max = %d",
- progname, name, inst, max);
-#endif
-
- wildp = !strcmp(name, "*");
- wildi = !strcmp(inst, "*");
-
- if (!wildi && !wildp) { /* nothing's wild */
- encode_princ_key(&key, name, inst);
- contents = dbm_fetch(db, key);
- if (contents.dptr == NULL) {
- found = 0;
- goto done;
- }
- decode_princ_contents(&contents, principal);
-#ifdef DEBUG
- if (kerb_debug & 1) {
- fprintf(stderr, "\t found %s %s p_n length %d t_n length %d\n",
- principal->name, principal->instance,
- strlen(principal->name),
- strlen(principal->instance));
- }
-#endif
- found = 1;
- goto done;
- }
- /* process wild cards by looping through entire database */
-
- for (key = dbm_firstkey(db); key.dptr != NULL;
- key = dbm_next(db, key)) {
- decode_princ_key(&key, testname, testinst);
- if ((wildp || !strcmp(testname, name)) &&
- (wildi || !strcmp(testinst, inst))) { /* have a match */
- if (found >= max) {
- *more = 1;
- goto done;
- } else {
- found++;
- contents = dbm_fetch(db, key);
- decode_princ_contents(&contents, principal);
-#ifdef DEBUG
- if (kerb_debug & 1) {
- fprintf(stderr,
- "\tfound %s %s p_n length %d t_n length %d\n",
- principal->name, principal->instance,
- strlen(principal->name),
- strlen(principal->instance));
- }
-#endif
- principal++; /* point to next */
- }
- }
- }
-
- done:
- kerb_dbl_unlock(); /* unlock read lock */
- dbm_close(db);
- if (kerb_end_read(trans) == 0)
- break;
- found = -1;
- if (!non_blocking)
- sleep(1);
- }
- return (found);
-}
-
-/*
- * Update a name in the data base. Returns number of names
- * successfully updated.
- */
-
-int
-kerb_db_put_principal(principal, max)
- Principal *principal;
- unsigned int max; /* number of principal structs to
- * update */
-
-{
- int found = 0, code;
- u_long i;
- extern int errorproc();
- datum key, contents;
- DBM *db;
-
- gettimeofday(&timestamp, NULL);
-
- if (!init)
- kerb_db_init();
-
- if ((code = kerb_dbl_lock(KERB_DBL_EXCLUSIVE)) != 0)
- return -1;
-
- db = dbm_open(current_db_name, O_RDWR, 0600);
-
-#ifdef DEBUG
- if (kerb_debug & 2)
- fprintf(stderr, "%s: kerb_db_put_principal max = %d",
- progname, max);
-#endif
-
- /* for each one, stuff temps, and do replace/append */
- for (i = 0; i < max; i++) {
- encode_princ_contents(&contents, principal);
- encode_princ_key(&key, principal->name, principal->instance);
- dbm_store(db, key, contents, DBM_REPLACE);
-#ifdef DEBUG
- if (kerb_debug & 1) {
- fprintf(stderr, "\n put %s %s\n",
- principal->name, principal->instance);
- }
-#endif
- found++;
- principal++; /* bump to next struct */
- }
-
- dbm_close(db);
- kerb_dbl_unlock(); /* unlock database */
- return (found);
-}
-
-static void
-encode_princ_key(key, name, instance)
- datum *key;
- char *name, *instance;
-{
- static char keystring[ANAME_SZ + INST_SZ];
-
- bzero(keystring, ANAME_SZ + INST_SZ);
- strncpy(keystring, name, ANAME_SZ);
- strncpy(&keystring[ANAME_SZ], instance, INST_SZ);
- key->dptr = keystring;
- key->dsize = ANAME_SZ + INST_SZ;
-}
-
-static void
-decode_princ_key(key, name, instance)
- datum *key;
- char *name, *instance;
-{
- strncpy(name, key->dptr, ANAME_SZ);
- strncpy(instance, key->dptr + ANAME_SZ, INST_SZ);
- name[ANAME_SZ - 1] = '\0';
- instance[INST_SZ - 1] = '\0';
-}
-
-static void
-encode_princ_contents(contents, principal)
- datum *contents;
- Principal *principal;
-{
- contents->dsize = sizeof(*principal);
- contents->dptr = (char *) principal;
-}
-
-static void
-decode_princ_contents(contents, principal)
- datum *contents;
- Principal *principal;
-{
- bcopy(contents->dptr, (char *) principal, sizeof(*principal));
-}
-
-void
-kerb_db_get_stat(s)
- DB_stat *s;
-{
- gettimeofday(&timestamp, NULL);
-
-
- s->cpu = 0;
- s->elapsed = 0;
- s->dio = 0;
- s->pfault = 0;
- s->t_stamp = timestamp.tv_sec;
- s->n_retrieve = 0;
- s->n_replace = 0;
- s->n_append = 0;
- s->n_get_stat = 0;
- s->n_put_stat = 0;
- /* update local copy too */
-}
-
-void
-kerb_db_put_stat(s)
- DB_stat *s;
-{
-}
-
-void
-delta_stat(a, b, c)
- DB_stat *a, *b, *c;
-{
- /* c = a - b then b = a for the next time */
-
- c->cpu = a->cpu - b->cpu;
- c->elapsed = a->elapsed - b->elapsed;
- c->dio = a->dio - b->dio;
- c->pfault = a->pfault - b->pfault;
- c->t_stamp = a->t_stamp - b->t_stamp;
- c->n_retrieve = a->n_retrieve - b->n_retrieve;
- c->n_replace = a->n_replace - b->n_replace;
- c->n_append = a->n_append - b->n_append;
- c->n_get_stat = a->n_get_stat - b->n_get_stat;
- c->n_put_stat = a->n_put_stat - b->n_put_stat;
-
- bcopy(a, b, sizeof(DB_stat));
-}
-
-/*
- * look up a dba in the data base returns number of dbas found , and
- * whether there were more than requested.
- */
-
-int
-kerb_db_get_dba(dba_name, dba_inst, dba, max, more)
- char *dba_name; /* could have wild card */
- char *dba_inst; /* could have wild card */
- Dba *dba;
- unsigned int max; /* max number of name structs to return */
- int *more; /* where there more than 'max' tuples? */
-
-{
- *more = 0;
- return (0);
-}
-
-int
-kerb_db_iterate (func, arg)
- int (*func)();
- char *arg; /* void *, really */
-{
- datum key, contents;
- Principal *principal;
- int code;
- DBM *db;
-
- kerb_db_init(); /* initialize and open the database */
- if ((code = kerb_dbl_lock(KERB_DBL_SHARED)) != 0)
- return code;
-
- db = dbm_open(current_db_name, O_RDONLY, 0600);
-
- for (key = dbm_firstkey (db); key.dptr != NULL; key = dbm_next(db, key)) {
- contents = dbm_fetch (db, key);
- /* XXX may not be properly aligned */
- principal = (Principal *) contents.dptr;
- if ((code = (*func)(arg, principal)) != 0)
- return code;
- }
- dbm_close(db);
- kerb_dbl_unlock();
- return 0;
-}
-
-static int dblfd = -1;
-static int mylock = 0;
-static int inited = 0;
-
-static void
-kerb_dbl_init()
-{
- if (!inited) {
- char *filename = gen_dbsuffix (current_db_name, ".ok");
- if ((dblfd = open(filename, 0)) < 0) {
- fprintf(stderr, "kerb_dbl_init: couldn't open %s\n", filename);
- fflush(stderr);
- perror("open");
- exit(1);
- }
- free(filename);
- inited++;
- }
-}
-
-static void
-kerb_dbl_fini()
-{
- close(dblfd);
- dblfd = -1;
- inited = 0;
- mylock = 0;
-}
-
-static int
-kerb_dbl_lock(mode)
- int mode;
-{
- int flock_mode;
-
- if (!inited)
- kerb_dbl_init();
- if (mylock) { /* Detect lock call when lock already
- * locked */
- fprintf(stderr, "Kerberos locking error (mylock)\n");
- fflush(stderr);
- exit(1);
- }
- switch (mode) {
- case KERB_DBL_EXCLUSIVE:
- flock_mode = LOCK_EX;
- break;
- case KERB_DBL_SHARED:
- flock_mode = LOCK_SH;
- break;
- default:
- fprintf(stderr, "invalid lock mode %d\n", mode);
- abort();
- }
- if (non_blocking)
- flock_mode |= LOCK_NB;
-
- if (flock(dblfd, flock_mode) < 0)
- return errno;
- mylock++;
- return 0;
-}
-
-static void
-kerb_dbl_unlock()
-{
- if (!mylock) { /* lock already unlocked */
- fprintf(stderr, "Kerberos database lock not locked when unlocking.\n");
- fflush(stderr);
- exit(1);
- }
- if (flock(dblfd, LOCK_UN) < 0) {
- fprintf(stderr, "Kerberos database lock error. (unlocking)\n");
- fflush(stderr);
- perror("flock");
- exit(1);
- }
- mylock = 0;
-}
-
-int
-kerb_db_set_lockmode(mode)
- int mode;
-{
- int old = non_blocking;
- non_blocking = mode;
- return old;
-}
diff --git a/eBones/kdb/krb_kdb_utils.c b/eBones/kdb/krb_kdb_utils.c
deleted file mode 100644
index 0256348..0000000
--- a/eBones/kdb/krb_kdb_utils.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * Utility routines for Kerberos programs which directly access
- * the database. This code was duplicated in too many places
- * before I gathered it here.
- *
- * Jon Rochlis, MIT Telecom, March 1988
- *
- * from: krb_kdb_utils.c,v 4.1 89/07/26 11:01:12 jtkohl Exp $
- * $Id: krb_kdb_utils.c,v 1.3 1995/07/18 16:37:15 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: krb_kdb_utils.c,v 1.3 1995/07/18 16:37:15 mark Exp $";
-#endif lint
-#endif
-
-#include <des.h>
-#include <krb.h>
-#include <krb_db.h>
-#include <kdc.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/file.h>
-
-long
-kdb_get_master_key(prompt, master_key, master_key_sched)
- int prompt;
- C_Block master_key;
- Key_schedule master_key_sched;
-{
- int kfile;
-
- if (prompt) {
-#ifdef NOENCRYPTION
- placebo_read_password(master_key,
- "\nEnter Kerberos master key: ", 0);
-#else
- des_read_password((des_cblock *)master_key,
- "\nEnter Kerberos master key: ", 0);
-#endif
- printf ("\n");
- }
- else {
- kfile = open(MKEYFILE, O_RDONLY, 0600);
- if (kfile < 0) {
- /* oh, for com_err_ */
- return (-1);
- }
- if (read(kfile, (char *) master_key, 8) != 8) {
- return (-1);
- }
- close(kfile);
- }
-
-#ifndef NOENCRYPTION
- key_sched((des_cblock *)master_key,master_key_sched);
-#endif
- return (0);
-}
-
-/* The caller is reasponsible for cleaning up the master key and sched,
- even if we can't verify the master key */
-
-/* Returns master key version if successful, otherwise -1 */
-
-long
-kdb_verify_master_key (master_key, master_key_sched, out)
- C_Block master_key;
- Key_schedule master_key_sched;
- FILE *out; /* setting this to non-null be do output */
-{
- C_Block key_from_db;
- Principal principal_data[1];
- int n, more = 0;
- long master_key_version;
-
- /* lookup the master key version */
- n = kerb_get_principal(KERB_M_NAME, KERB_M_INST, principal_data,
- 1 /* only one please */, &more);
- if ((n != 1) || more) {
- if (out != (FILE *) NULL)
- fprintf(out,
- "verify_master_key: %s, %d found.\n",
- "Kerberos error on master key version lookup",
- n);
- return (-1);
- }
-
- master_key_version = (long) principal_data[0].key_version;
-
- /* set up the master key */
- if (out != (FILE *) NULL) /* should we punt this? */
- fprintf(out, "Current Kerberos master key version is %d.\n",
- principal_data[0].kdc_key_ver);
-
- /*
- * now use the master key to decrypt the key in the db, had better
- * be the same!
- */
- bcopy(&principal_data[0].key_low, key_from_db, 4);
- bcopy(&principal_data[0].key_high, ((long *) key_from_db) + 1, 4);
- kdb_encrypt_key (key_from_db, key_from_db,
- master_key, master_key_sched, DECRYPT);
-
- /* the decrypted database key had better equal the master key */
- n = bcmp((char *) master_key, (char *) key_from_db,
- sizeof(master_key));
- /* this used to zero the master key here! */
- bzero(key_from_db, sizeof(key_from_db));
- bzero(principal_data, sizeof (principal_data));
-
- if (n && (out != (FILE *) NULL)) {
- fprintf(out, "\n\07\07verify_master_key: Invalid master key; ");
- fprintf(out, "does not match database.\n");
- return (-1);
- }
- if (out != (FILE *) NULL) {
- fprintf(out, "\nMaster key entered. BEWARE!\07\07\n");
- fflush(out);
- }
-
- return (master_key_version);
-}
-
-/* The old algorithm used the key schedule as the initial vector which
- was byte order depedent ... */
-
-void
-kdb_encrypt_key (in, out, master_key, master_key_sched, e_d_flag)
- C_Block in, out, master_key;
- Key_schedule master_key_sched;
- int e_d_flag;
-{
-
-#ifdef NOENCRYPTION
- bcopy(in, out, sizeof(C_Block));
-#else
- pcbc_encrypt((des_cblock*)in,(des_cblock*)out,(long)sizeof(C_Block),
- master_key_sched,(des_cblock*)master_key,e_d_flag);
-#endif
-}
diff --git a/eBones/kdb/krb_lib.c b/eBones/kdb/krb_lib.c
deleted file mode 100644
index 2cf4fb8..0000000
--- a/eBones/kdb/krb_lib.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * $Source: /usr/cvs/src/eBones/kdb/krb_lib.c,v $
- * $Author: mark $
- *
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: krb_lib.c,v 1.3 1995/07/18 16:37:17 mark Exp $";
-#endif lint
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/uio.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <strings.h>
-#include <des.h>
-#include <krb.h>
-#include <krb_db.h>
-
-#ifdef DEBUG
-extern int debug;
-extern char *progname;
-long kerb_debug;
-#endif
-
-static init = 0;
-
-/*
- * initialization routine for data base
- */
-
-int
-kerb_init()
-{
-#ifdef DEBUG
- if (!init) {
- char *dbg = getenv("KERB_DBG");
- if (dbg)
- sscanf(dbg, "%ld", &kerb_debug);
- init = 1;
- }
-#endif
- kerb_db_init();
-
-#ifdef CACHE
- kerb_cache_init();
-#endif
-
- /* successful init, return 0, else errcode */
- return (0);
-}
-
-/*
- * finalization routine for database -- NOTE: MUST be called by any
- * program using kerb_init. ALSO will have to be modified to finalize
- * caches, if they're ever really implemented.
- */
-
-void
-kerb_fini()
-{
- kerb_db_fini();
-}
-
-/*
- * look up a principal in the cache or data base returns number of
- * principals found
- */
-
-int
-kerb_get_principal(name, inst, principal, max, more)
- char *name; /* could have wild card */
- char *inst; /* could have wild card */
- Principal *principal;
- unsigned int max; /* max number of name structs to return */
- int *more; /* more tuples than room for */
-
-{
- int found = 0;
-#ifdef CACHE
- static int wild = 0;
-#endif
- if (!init)
- kerb_init();
-
-#ifdef DEBUG
- if (kerb_debug & 1)
- fprintf(stderr, "\n%s: kerb_get_principal for %s %s max = %d\n",
- progname, name, inst, max);
-#endif
-
- /*
- * if this is a request including a wild card, have to go to db
- * since the cache may not be exhaustive.
- */
-
- /* clear the principal area */
- bzero((char *) principal, max * sizeof(Principal));
-
-#ifdef CACHE
- /*
- * so check to see if the name contains a wildcard "*" or "?", not
- * preceeded by a backslash.
- */
- wild = 0;
- if (index(name, '*') || index(name, '?') ||
- index(inst, '*') || index(inst, '?'))
- wild = 1;
-
- if (!wild) {
- /* try the cache first */
- found = kerb_cache_get_principal(name, inst, principal, max, more);
- if (found)
- return (found);
- }
-#endif
- /* If we didn't try cache, or it wasn't there, try db */
- found = kerb_db_get_principal(name, inst, principal, max, more);
- /* try to insert principal(s) into cache if it was found */
-#ifdef CACHE
- if (found) {
- kerb_cache_put_principal(principal, found);
- }
-#endif
- return (found);
-}
-
-/* principals */
-int
-kerb_put_principal(principal, n)
- Principal *principal;
- unsigned int n; /* number of principal structs to write */
-{
- long time();
- struct tm *tp, *localtime();
-
- /* set mod date */
- principal->mod_date = time((long *)0);
- /* and mod date string */
-
- tp = localtime(&principal->mod_date);
- (void) sprintf(principal->mod_date_txt, "%4d-%2d-%2d",
- tp->tm_year > 1900 ? tp->tm_year : tp->tm_year + 1900,
- tp->tm_mon + 1, tp->tm_mday); /* January is 0, not 1 */
-#ifdef DEBUG
- if (kerb_debug & 1) {
- int i;
- fprintf(stderr, "\nkerb_put_principal...");
- for (i = 0; i < n; i++) {
- krb_print_principal(&principal[i]);
- }
- }
-#endif
- /* write database */
- if (kerb_db_put_principal(principal, n) < 0) {
-#ifdef DEBUG
- if (kerb_debug & 1)
- fprintf(stderr, "\n%s: kerb_db_put_principal err", progname);
- /* watch out for cache */
-#endif
- return -1;
- }
-#ifdef CACHE
- /* write cache */
- if (!kerb_cache_put_principal(principal, n)) {
-#ifdef DEBUG
- if (kerb_debug & 1)
- fprintf(stderr, "\n%s: kerb_cache_put_principal err", progname);
-#endif
- return -1;
- }
-#endif
- return 0;
-}
-
-int
-kerb_get_dba(name, inst, dba, max, more)
- char *name; /* could have wild card */
- char *inst; /* could have wild card */
- Dba *dba;
- unsigned int max; /* max number of name structs to return */
- int *more; /* more tuples than room for */
-
-{
- int found = 0;
-#ifdef CACHE
- static int wild = 0;
-#endif
- if (!init)
- kerb_init();
-
-#ifdef DEBUG
- if (kerb_debug & 1)
- fprintf(stderr, "\n%s: kerb_get_dba for %s %s max = %d\n",
- progname, name, inst, max);
-#endif
- /*
- * if this is a request including a wild card, have to go to db
- * since the cache may not be exhaustive.
- */
-
- /* clear the dba area */
- bzero((char *) dba, max * sizeof(Dba));
-
-#ifdef CACHE
- /*
- * so check to see if the name contains a wildcard "*" or "?", not
- * preceeded by a backslash.
- */
-
- wild = 0;
- if (index(name, '*') || index(name, '?') ||
- index(inst, '*') || index(inst, '?'))
- wild = 1;
-
- if (!wild) {
- /* try the cache first */
- found = kerb_cache_get_dba(name, inst, dba, max, more);
- if (found)
- return (found);
- }
-#endif
- /* If we didn't try cache, or it wasn't there, try db */
- found = kerb_db_get_dba(name, inst, dba, max, more);
-#ifdef CACHE
- /* try to insert dba(s) into cache if it was found */
- if (found) {
- kerb_cache_put_dba(dba, found);
- }
-#endif
- return (found);
-}
diff --git a/eBones/kdb/print_princ.c b/eBones/kdb/print_princ.c
deleted file mode 100644
index 64e9106..0000000
--- a/eBones/kdb/print_princ.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: $Header: /usr/cvs/src/eBones/kdb/print_princ.c,v 1.3 1995/07/18 16:37:19 mark Exp $
- * $Id: print_princ.c,v 1.3 1995/07/18 16:37:19 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: print_princ.c,v 1.3 1995/07/18 16:37:19 mark Exp $";
-#endif lint
-#endif
-
-#include <stdio.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <strings.h>
-#include <krb.h>
-#include <krb_db.h>
-
-extern int debug;
-
-long kerb_debug;
-static struct tm *time_p;
-
-void
-krb_print_principal(a_n)
- Principal *a_n;
-{
- /* run-time database does not contain string versions */
- time_p = localtime(&(a_n->exp_date));
-
- fprintf(stderr,
- "\n%s %s expires %4d-%2d-%2d %2d:%2d, max_life %d*5 = %d min attr 0x%02x",
- a_n->name, a_n->instance,
- time_p->tm_year > 1900 ? time_p->tm_year : time_p->tm_year + 1900,
- time_p->tm_mon + 1, time_p->tm_mday,
- time_p->tm_hour, time_p->tm_min,
- a_n->max_life, 5 * a_n->max_life, a_n->attributes);
-
- fprintf(stderr,
- "\n\tkey_ver %d k_low 0x%08lx k_high 0x%08lx akv %d exists %d\n",
- a_n->key_version, a_n->key_low, a_n->key_high,
- a_n->kdc_key_ver, (int)a_n->old);
-
- fflush(stderr);
-}
diff --git a/eBones/kdb_destroy/Makefile b/eBones/kdb_destroy/Makefile
deleted file mode 100644
index f22f779..0000000
--- a/eBones/kdb_destroy/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# From: @(#)Makefile 5.1 (Berkeley) 6/25/90
-# $Id: Makefile,v 1.3 1995/07/18 16:37:22 mark Exp $
-
-PROG= kdb_destroy
-CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -Wall
-MAN8= kdb_destroy.8
-
-.include <bsd.prog.mk>
diff --git a/eBones/kdb_destroy/kdb_destroy.8 b/eBones/kdb_destroy/kdb_destroy.8
deleted file mode 100644
index 2e57876..0000000
--- a/eBones/kdb_destroy/kdb_destroy.8
+++ /dev/null
@@ -1,36 +0,0 @@
-.\" from: kdb_destroy.8,v 4.1 89/01/23 11:08:02 jtkohl Exp $
-.\" $Id: kdb_destroy.8,v 1.1.1.1 1994/09/30 14:50:06 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KDB_DESTROY 8 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-kdb_destroy \- destroy Kerberos key distribution center database
-.SH SYNOPSIS
-kdb_destroy
-.SH DESCRIPTION
-.I kdb_destroy
-deletes a Kerberos key distribution center database.
-.PP
-The user is prompted to verify that the database should be destroyed. A
-response beginning with `y' or `Y' confirms deletion.
-Any other response aborts deletion.
-.SH DIAGNOSTICS
-.TP 20n
-"Database cannot be deleted at /kerberos/principal"
-The attempt to delete the database failed (probably due to a system or
-access permission error).
-.TP
-"Database not deleted."
-The user aborted the deletion.
-.SH FILES
-.TP 20n
-/etc/kerberosIV/principal.db
-DBM file containing database
-.TP
-/etc/kerberosIV/principal.ok
-Semaphore indicating that the DBM database is not being modified.
-.SH SEE ALSO
-kdb_init(8)
diff --git a/eBones/kdb_destroy/kdb_destroy.c b/eBones/kdb_destroy/kdb_destroy.c
deleted file mode 100644
index 57e1a80..0000000
--- a/eBones/kdb_destroy/kdb_destroy.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: kdb_destroy.c,v 4.0 89/01/24 21:49:02 jtkohl Exp $
- * $Id: kdb_destroy.c,v 1.5 1995/08/04 06:35:45 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: kdb_destroy.c,v 1.5 1995/08/04 06:35:45 mark Exp $";
-#endif lint
-#endif
-
-#include <unistd.h>
-#include <strings.h>
-#include <stdio.h>
-#include <krb.h>
-#include <krb_db.h>
-
-#if defined(__FreeBSD__) || defined(__NetBSD__)
-#define _DBM_
-#endif
-
-void
-main()
-{
- char answer[10]; /* user input */
-#ifdef _DBM_
- char dbm[256]; /* database path and name */
- char *file; /* database file names */
-#else
- char dbm[256]; /* database path and name */
- char dbm1[256]; /* database path and name */
- char *file1, *file2; /* database file names */
-#endif
-
- strcpy(dbm, DBM_FILE);
-#ifdef _DBM_
- file = strcat(dbm, ".db");
-#else
- strcpy(dbm1, DBM_FILE);
- file1 = strcat(dbm, ".dir");
- file2 = strcat(dbm1, ".pag");
-#endif
-
- printf("You are about to destroy the Kerberos database ");
- printf("on this machine.\n");
- printf("Are you sure you want to do this (y/n)? ");
- fgets(answer, sizeof(answer), stdin);
-
- if (answer[0] == 'y' || answer[0] == 'Y') {
-#ifdef _DBM_
- if (unlink(file) == 0)
-#else
- if (unlink(file1) == 0 && unlink(file2) == 0)
-#endif
- fprintf(stderr, "Database deleted at %s\n", DBM_FILE);
- else
- fprintf(stderr, "Database cannot be deleted at %s\n",
- DBM_FILE);
- } else
- fprintf(stderr, "Database not deleted.\n");
-}
diff --git a/eBones/kdb_edit/Makefile b/eBones/kdb_edit/Makefile
deleted file mode 100644
index a56efcf..0000000
--- a/eBones/kdb_edit/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# From: @(#)Makefile 5.2 (Berkeley) 2/14/91
-# $Id: Makefile,v 1.3 1995/07/18 16:37:25 mark Exp $
-
-PROG= kdb_edit
-CFLAGS+=-DKERBEROS -DDEBUG -I. -I${.CURDIR}/../include -Wall
-SRCS= kdb_edit.c maketime.c
-.PATH: ${.CURDIR}/../kdb_edit
-DPADD= ${LIBKDB} ${LIBKRB}
-LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -ldes
-MAN8= kdb_edit.8
-
-.include <bsd.prog.mk>
diff --git a/eBones/kdb_edit/kdb_edit.8 b/eBones/kdb_edit/kdb_edit.8
deleted file mode 100644
index 44a0fa6..0000000
--- a/eBones/kdb_edit/kdb_edit.8
+++ /dev/null
@@ -1,58 +0,0 @@
-.\" from: kdb_edit.8,v 4.1 89/01/23 11:08:55 jtkohl Exp $
-.\" $Id: kdb_edit.8,v 1.2 1995/02/08 10:54:20 jkh Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KDB_EDIT 8 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-kdb_edit \- Kerberos key distribution center database editing utility
-.SH SYNOPSIS
-kdb_edit [
-.B \-n
-]
-.SH DESCRIPTION
-.I kdb_edit
-is used to create or change principals stored in the Kerberos key
-distribution center (KDC) database.
-.PP
-When executed,
-.I kdb_edit
-prompts for the master key string and verifies that it matches the
-master key stored in the database.
-If the
-.B \-n
-option is specified, the master key is instead fetched from the master
-key cache file.
-.PP
-Once the master key has been verified,
-.I kdb_edit
-begins a prompt loop. The user is prompted for the principal and
-instance to be modified. If the entry is not found the user may create
-it.
-Once an entry is found or created, the user may set the password,
-expiration date, maximum ticket lifetime, and attributes.
-Default expiration dates, maximum ticket lifetimes, and attributes are
-presented in brackets; if the user presses return the default is selected.
-There is no default password.
-The password "RANDOM" and an empty password are interpreted specially,
-if entered the user may have the program select a random DES key for the
-principal.
-.PP
-Upon successfully creating or changing the entry, ``Edit O.K.'' is
-printed.
-.SH DIAGNOSTICS
-.TP 20n
-"verify_master_key: Invalid master key, does not match database."
-The master key string entered was incorrect.
-.SH FILES
-.TP 20n
-/etc/kerberosIV/principal.db
-DBM file containing database
-.TP
-/etc/kerberosIV/principal.ok
-Semaphore indicating that the DBM database is not being modified.
-.TP
-/etc/kerberosIV/master_key
-Master key cache file.
diff --git a/eBones/kdb_edit/kdb_edit.c b/eBones/kdb_edit/kdb_edit.c
deleted file mode 100644
index 82bf9a4..0000000
--- a/eBones/kdb_edit/kdb_edit.c
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * This routine changes the Kerberos encryption keys for principals,
- * i.e., users or services.
- *
- * from: kdb_edit.c,v 4.2 90/01/09 16:05:09 raeburn Exp $
- * $Id: kdb_edit.c,v 1.5 1995/08/03 17:15:54 mark Exp $
- */
-
-/*
- * exit returns 0 ==> success -1 ==> error
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: kdb_edit.c,v 1.5 1995/08/03 17:15:54 mark Exp $";
-#endif lint
-#endif
-
-#include <stdio.h>
-#include <signal.h>
-#include <errno.h>
-#include <strings.h>
-#include <sys/ioctl.h>
-#include <sys/file.h>
-#include "time.h"
-#include <des.h>
-#include <krb.h>
-#include <krb_db.h>
-/* MKEYFILE is now defined in kdc.h */
-#include <kdc.h>
-
-void Usage(void);
-void cleanup(void);
-void sig_exit(int sig, int code, struct sigcontext *scp);
-void no_core_dumps(void);
-int change_principal(void);
-
-#define zaptime(foo) bzero((char *)(foo), sizeof(*(foo)))
-
-char prog[32];
-char *progname = prog;
-int nflag = 0;
-int cflag;
-int lflag;
-int uflag;
-int debug;
-extern kerb_debug;
-
-Key_schedule KS;
-C_Block new_key;
-unsigned char *input;
-
-unsigned char *ivec;
-int i, j;
-int more;
-
-char *in_ptr;
-char input_name[ANAME_SZ];
-char input_instance[INST_SZ];
-char input_string[ANAME_SZ];
-
-#define MAX_PRINCIPAL 10
-Principal principal_data[MAX_PRINCIPAL];
-
-static Principal old_principal;
-static Principal default_princ;
-
-static C_Block master_key;
-static C_Block session_key;
-static Key_schedule master_key_schedule;
-static char pw_str[255];
-static long master_key_version;
-
-/*
- * gets replacement
- */
-static char * s_gets(char * str, int len)
-{
- int i;
- char *s;
-
- if((s = fgets(str, len, stdin)) == NULL)
- return(s);
- if(str[i = (strlen(str)-1)] == '\n')
- str[i] = '\0';
- return(s);
-}
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-
-{
- /* Local Declarations */
-
- long n;
-
- prog[sizeof prog - 1] = '\0'; /* make sure terminated */
- strncpy(prog, argv[0], sizeof prog - 1); /* salt away invoking
- * program */
-
- /* Assume a long is four bytes */
- if (sizeof(long) != 4) {
- fprintf(stdout, "%s: size of long is %d.\n", prog, sizeof(long));
- exit(-1);
- }
- /* Assume <=32 signals */
- if (NSIG > 32) {
- fprintf(stderr, "%s: more than 32 signals defined.\n", prog);
- exit(-1);
- }
- while (--argc > 0 && (*++argv)[0] == '-')
- for (i = 1; argv[0][i] != '\0'; i++) {
- switch (argv[0][i]) {
-
- /* debug flag */
- case 'd':
- debug = 1;
- continue;
-
- /* debug flag */
- case 'l':
- kerb_debug |= 1;
- continue;
-
- case 'n': /* read MKEYFILE for master key */
- nflag = 1;
- continue;
-
- default:
- fprintf(stderr, "%s: illegal flag \"%c\"\n",
- progname, argv[0][i]);
- Usage(); /* Give message and die */
- }
- };
-
- fprintf(stdout, "Opening database...\n");
- fflush(stdout);
- kerb_init();
- if (argc > 0) {
- if (kerb_db_set_name(*argv) != 0) {
- fprintf(stderr, "Could not open altername database name\n");
- exit(1);
- }
- }
-
-#ifdef notdef
- no_core_dumps(); /* diddle signals to avoid core dumps! */
-
- /* ignore whatever is reasonable */
- signal(SIGHUP, SIG_IGN);
- signal(SIGINT, SIG_IGN);
- signal(SIGTSTP, SIG_IGN);
-
-#endif
-
- if (kdb_get_master_key ((nflag == 0),
- master_key, master_key_schedule) != 0) {
- fprintf (stdout, "Couldn't read master key.\n");
- fflush (stdout);
- exit (-1);
- }
-
- if ((master_key_version = kdb_verify_master_key(master_key,
- master_key_schedule,
- stdout)) < 0)
- exit (-1);
-
- /* lookup the default values */
- n = kerb_get_principal(KERB_DEFAULT_NAME, KERB_DEFAULT_INST,
- &default_princ, 1, &more);
- if (n != 1) {
- fprintf(stderr,
- "%s: Kerberos error on default value lookup, %ld found.\n",
- progname, n);
- exit(-1);
- }
- fprintf(stdout, "Previous or default values are in [brackets] ,\n");
- fprintf(stdout, "enter return to leave the same, or new value.\n");
-
- while (change_principal()) {
- }
-
- cleanup();
- return(0); /* make -Wall shut up - MRVM */
-}
-
-int
-change_principal()
-{
- static char temp[255];
- int creating = 0;
- int editpw = 0;
- int changed = 0;
- long temp_long;
- int n;
- struct tm *tp, edate, *localtime();
- long maketime();
-
- fprintf(stdout, "\nPrincipal name: ");
- fflush(stdout);
- if (!s_gets(input_name, ANAME_SZ-1) || *input_name == '\0')
- return 0;
- fprintf(stdout, "Instance: ");
- fflush(stdout);
- /* instance can be null */
- s_gets(input_instance, INST_SZ-1);
- j = kerb_get_principal(input_name, input_instance, principal_data,
- MAX_PRINCIPAL, &more);
- if (!j) {
- fprintf(stdout, "\n\07\07<Not found>, Create [y] ? ");
- s_gets(temp, sizeof(temp)-1); /* Default case should work, it didn't */
- if (temp[0] != 'y' && temp[0] != 'Y' && temp[0] != '\0')
- return -1;
- /* make a new principal, fill in defaults */
- j = 1;
- creating = 1;
- strcpy(principal_data[0].name, input_name);
- strcpy(principal_data[0].instance, input_instance);
- principal_data[0].old = NULL;
- principal_data[0].exp_date = default_princ.exp_date;
- principal_data[0].max_life = default_princ.max_life;
- principal_data[0].attributes = default_princ.attributes;
- principal_data[0].kdc_key_ver = (unsigned char) master_key_version;
- principal_data[0].key_version = 0; /* bumped up later */
- }
- tp = localtime(&principal_data[0].exp_date);
- (void) sprintf(principal_data[0].exp_date_txt, "%4d-%02d-%02d",
- tp->tm_year > 1900 ? tp->tm_year : tp->tm_year + 1900,
- tp->tm_mon + 1, tp->tm_mday); /* January is 0, not 1 */
- for (i = 0; i < j; i++) {
- for (;;) {
- fprintf(stdout,
- "\nPrincipal: %s, Instance: %s, kdc_key_ver: %d",
- principal_data[i].name, principal_data[i].instance,
- principal_data[i].kdc_key_ver);
- editpw = 1;
- changed = 0;
- if (!creating) {
- /*
- * copy the existing data so we can use the old values
- * for the qualifier clause of the replace
- */
- principal_data[i].old = (char *) &old_principal;
- bcopy(&principal_data[i], &old_principal,
- sizeof(old_principal));
- printf("\nChange password [n] ? ");
- s_gets(temp, sizeof(temp)-1);
- if (strcmp("y", temp) && strcmp("Y", temp))
- editpw = 0;
- }
- /* password */
- if (editpw) {
-#ifdef NOENCRYPTION
- placebo_read_pw_string(pw_str, sizeof pw_str,
- "\nNew Password: ", TRUE);
-#else
- des_read_pw_string(pw_str, sizeof pw_str,
- "\nNew Password: ", TRUE);
-#endif
- if (pw_str[0] == '\0' || !strcmp(pw_str, "RANDOM")) {
- printf("\nRandom password [y] ? ");
- s_gets(temp, sizeof(temp)-1);
- if (!strcmp("n", temp) || !strcmp("N", temp)) {
- /* no, use literal */
-#ifdef NOENCRYPTION
- bzero(new_key, sizeof(C_Block));
- new_key[0] = 127;
-#else
- string_to_key(pw_str, &new_key);
-#endif
- bzero(pw_str, sizeof pw_str); /* "RANDOM" */
- } else {
-#ifdef NOENCRYPTION
- bzero(new_key, sizeof(C_Block));
- new_key[0] = 127;
-#else
- random_key(new_key);
-#endif
- bzero(pw_str, sizeof pw_str);
- }
- } else if (!strcmp(pw_str, "NULL")) {
- printf("\nNull Key [y] ? ");
- s_gets(temp, sizeof(temp)-1);
- if (!strcmp("n", temp) || !strcmp("N", temp)) {
- /* no, use literal */
-#ifdef NOENCRYPTION
- bzero(new_key, sizeof(C_Block));
- new_key[0] = 127;
-#else
- string_to_key(pw_str, &new_key);
-#endif
- bzero(pw_str, sizeof pw_str); /* "NULL" */
- } else {
-
- principal_data[i].key_low = 0;
- principal_data[i].key_high = 0;
- goto null_key;
- }
- } else {
-#ifdef NOENCRYPTION
- bzero(new_key, sizeof(C_Block));
- new_key[0] = 127;
-#else
- string_to_key(pw_str, &new_key);
-#endif
- bzero(pw_str, sizeof pw_str);
- }
-
- /* seal it under the kerberos master key */
- kdb_encrypt_key (new_key, new_key,
- master_key, master_key_schedule,
- ENCRYPT);
- bcopy(new_key, &principal_data[i].key_low, 4);
- bcopy(((long *) new_key) + 1,
- &principal_data[i].key_high, 4);
- bzero(new_key, sizeof(new_key));
- null_key:
- /* set master key version */
- principal_data[i].kdc_key_ver =
- (unsigned char) master_key_version;
- /* bump key version # */
- principal_data[i].key_version++;
- fprintf(stdout,
- "\nPrincipal's new key version = %d\n",
- principal_data[i].key_version);
- fflush(stdout);
- changed = 1;
- }
- /* expiration date */
- fprintf(stdout, "Expiration date (enter yyyy-mm-dd) [ %s ] ? ",
- principal_data[i].exp_date_txt);
- zaptime(&edate);
- while (s_gets(temp, sizeof(temp)-1) && ((n = strlen(temp)) >
- sizeof(principal_data[0].exp_date_txt))) {
- bad_date:
- fprintf(stdout, "\07\07Date Invalid\n");
- fprintf(stdout,
- "Expiration date (enter yyyy-mm-dd) [ %s ] ? ",
- principal_data[i].exp_date_txt);
- zaptime(&edate);
- }
-
- if (*temp) {
- if (sscanf(temp, "%d-%d-%d", &edate.tm_year,
- &edate.tm_mon, &edate.tm_mday) != 3)
- goto bad_date;
- (void) strcpy(principal_data[i].exp_date_txt, temp);
- edate.tm_mon--; /* January is 0, not 1 */
- edate.tm_hour = 23; /* nearly midnight at the end of the */
- edate.tm_min = 59; /* specified day */
- if (!(principal_data[i].exp_date = maketime(&edate, 1)))
- goto bad_date;
- changed = 1;
- }
-
- /* maximum lifetime */
- fprintf(stdout, "Max ticket lifetime (*5 minutes) [ %d ] ? ",
- principal_data[i].max_life);
- while (s_gets(temp, sizeof(temp)-1) && *temp) {
- if (sscanf(temp, "%ld", &temp_long) != 1)
- goto bad_life;
- if (temp_long > 255 || (temp_long < 0)) {
- bad_life:
- fprintf(stdout, "\07\07Invalid, choose 0-255\n");
- fprintf(stdout,
- "Max ticket lifetime (*5 minutes) [ %d ] ? ",
- principal_data[i].max_life);
- continue;
- }
- changed = 1;
- /* dont clobber */
- principal_data[i].max_life = (unsigned short) temp_long;
- break;
- }
-
- /* attributes */
- fprintf(stdout, "Attributes [ %d ] ? ",
- principal_data[i].attributes);
- while (s_gets(temp, sizeof(temp)-1) && *temp) {
- if (sscanf(temp, "%ld", &temp_long) != 1)
- goto bad_att;
- if (temp_long > 65535 || (temp_long < 0)) {
- bad_att:
- fprintf(stdout, "\07\07Invalid, choose 0-65535\n");
- fprintf(stdout, "Attributes [ %d ] ? ",
- principal_data[i].attributes);
- continue;
- }
- changed = 1;
- /* dont clobber */
- principal_data[i].attributes =
- (unsigned short) temp_long;
- break;
- }
-
- /*
- * remaining fields -- key versions and mod info, should
- * not be directly manipulated
- */
- if (changed) {
- if (kerb_put_principal(&principal_data[i], 1)) {
- fprintf(stdout,
- "\nError updating Kerberos database");
- } else {
- fprintf(stdout, "Edit O.K.");
- }
- } else {
- fprintf(stdout, "Unchanged");
- }
-
-
- bzero(&principal_data[i].key_low, 4);
- bzero(&principal_data[i].key_high, 4);
- fflush(stdout);
- break;
- }
- }
- if (more) {
- fprintf(stdout, "\nThere were more tuples found ");
- fprintf(stdout, "than there were space for");
- }
- return 1;
-}
-
-void
-no_core_dumps()
-{
-
- signal(SIGQUIT, (sig_t)sig_exit);
- signal(SIGILL, (sig_t)sig_exit);
- signal(SIGTRAP, (sig_t)sig_exit);
- signal(SIGIOT, (sig_t)sig_exit);
- signal(SIGEMT, (sig_t)sig_exit);
- signal(SIGFPE, (sig_t)sig_exit);
- signal(SIGBUS, (sig_t)sig_exit);
- signal(SIGSEGV, (sig_t)sig_exit);
- signal(SIGSYS, (sig_t)sig_exit);
-}
-
-void
-sig_exit(sig, code, scp)
- int sig, code;
- struct sigcontext *scp;
-{
- cleanup();
- fprintf(stderr,
- "\nSignal caught, sig = %d code = %d old pc = 0x%X \nexiting",
- sig, code, scp->sc_pc);
- exit(-1);
-}
-
-void
-cleanup()
-{
-
- bzero(master_key, sizeof(master_key));
- bzero(session_key, sizeof(session_key));
- bzero(master_key_schedule, sizeof(master_key_schedule));
- bzero(principal_data, sizeof(principal_data));
- bzero(new_key, sizeof(new_key));
- bzero(pw_str, sizeof(pw_str));
-}
-
-void
-Usage()
-{
- fprintf(stderr, "Usage: %s [-n]\n", progname);
- exit(1);
-}
diff --git a/eBones/kdb_edit/maketime.c b/eBones/kdb_edit/maketime.c
deleted file mode 100644
index 5e0ee00..0000000
--- a/eBones/kdb_edit/maketime.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 1990 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * Convert a struct tm * to a UNIX time.
- *
- * from: maketime.c,v 4.2 90/01/09 15:54:51 raeburn Exp $
- * $Id: maketime.c,v 1.3 1995/07/18 16:37:29 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: maketime.c,v 1.1 1994/03/21 16:23:54 piero Exp ";
-#endif lint
-#endif
-
-#include <sys/time.h>
-
-#define daysinyear(y) (((y) % 4) ? 365 : (((y) % 100) ? 366 : (((y) % 400) ? 365 : 366)))
-
-#define SECSPERDAY 24*60*60
-#define SECSPERHOUR 60*60
-#define SECSPERMIN 60
-
-static int cumdays[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334,
- 365};
-
-static int leapyear[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-static int nonleapyear[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-
-long
-maketime(tp, local)
-register struct tm *tp;
-int local;
-{
- register long retval;
- int foo;
- int *marray;
-
- if (tp->tm_mon < 0 || tp->tm_mon > 11 ||
- tp->tm_hour < 0 || tp->tm_hour > 23 ||
- tp->tm_min < 0 || tp->tm_min > 59 ||
- tp->tm_sec < 0 || tp->tm_sec > 59) /* out of range */
- return 0;
-
- retval = 0;
- if (tp->tm_year < 1900)
- foo = tp->tm_year + 1900;
- else
- foo = tp->tm_year;
-
- if (foo < 1901 || foo > 2038) /* year is too small/large */
- return 0;
-
- if (daysinyear(foo) == 366) {
- if (tp->tm_mon > 1)
- retval+= SECSPERDAY; /* add leap day */
- marray = leapyear;
- } else
- marray = nonleapyear;
-
- if (tp->tm_mday < 0 || tp->tm_mday > marray[tp->tm_mon])
- return 0; /* out of range */
-
- while (--foo >= 1970)
- retval += daysinyear(foo) * SECSPERDAY;
-
- retval += cumdays[tp->tm_mon] * SECSPERDAY;
- retval += (tp->tm_mday-1) * SECSPERDAY;
- retval += tp->tm_hour * SECSPERHOUR + tp->tm_min * SECSPERMIN + tp->tm_sec;
-
- if (local) {
- /* need to use local time, so we retrieve timezone info */
- struct timezone tz;
- struct timeval tv;
- if (gettimeofday(&tv, &tz) < 0) {
- /* some error--give up? */
- return(retval);
- }
- retval += tz.tz_minuteswest * SECSPERMIN;
- }
- return(retval);
-}
diff --git a/eBones/kdb_edit/time.h b/eBones/kdb_edit/time.h
deleted file mode 100644
index ae84e2e..0000000
--- a/eBones/kdb_edit/time.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Structure for use by time manipulating subroutines.
- * The following library routines use it:
- * libc: ctime, localtime, gmtime, asctime
- * libcx: partime, maketime (may not be installed yet)
- */
-
-/*
- * from: time.h,v 1.1 82/05/06 11:34:29 wft Exp $
- * $Id: time.h,v 1.3 1995/07/18 16:37:31 mark Exp $
- */
-
-struct tm { /* See defines below for allowable ranges */
- int tm_sec;
- int tm_min;
- int tm_hour;
- int tm_mday;
- int tm_mon;
- int tm_year;
- int tm_wday;
- int tm_yday;
- int tm_isdst;
- int tm_zon; /* NEW: mins westward of Greenwich */
- int tm_ampm; /* NEW: 1 if AM, 2 if PM */
-};
-
-#define LCLZONE (5*60) /* Until V7 ftime(2) works, this defines local zone*/
-#define TMNULL (-1) /* Items not specified are given this value
- * in order to distinguish null specs from zero
- * specs. This is only used by partime and
- * maketime. */
-
- /* Indices into TM structure */
-#define TM_SEC 0 /* 0-59 */
-#define TM_MIN 1 /* 0-59 */
-#define TM_HOUR 2 /* 0-23 */
-#define TM_MDAY 3 /* 1-31 day of month */
-#define TM_DAY TM_MDAY /* " synonym */
-#define TM_MON 4 /* 0-11 */
-#define TM_YEAR 5 /* (year-1900) (year) */
-#define TM_WDAY 6 /* 0-6 day of week (0 = Sunday) */
-#define TM_YDAY 7 /* 0-365 day of year */
-#define TM_ISDST 8 /* 0 Std, 1 DST */
- /* New stuff */
-#define TM_ZON 9 /* 0-(24*60) minutes west of Greenwich */
-#define TM_AMPM 10 /* 1 AM, 2 PM */
diff --git a/eBones/kdb_init/Makefile b/eBones/kdb_init/Makefile
deleted file mode 100644
index 4d6a110..0000000
--- a/eBones/kdb_init/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# From: @(#)Makefile 5.1 (Berkeley) 6/25/90
-# $Id: Makefile,v 1.3 1995/07/18 16:37:34 mark Exp $
-
-PROG= kdb_init
-CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -Wall
-DPADD= ${LIBKDB} ${LIBKRB}
-LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -ldes
-MAN8= kdb_init.8
-
-.include <bsd.prog.mk>
diff --git a/eBones/kdb_init/kdb_init.8 b/eBones/kdb_init/kdb_init.8
deleted file mode 100644
index d884d00..0000000
--- a/eBones/kdb_init/kdb_init.8
+++ /dev/null
@@ -1,45 +0,0 @@
-.\" from: kdb_init.8,v 4.1 89/01/23 11:09:02 jtkohl Exp $
-.\" $Id: kdb_init.8,v 1.1.1.1 1994/09/30 14:50:06 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KDB_INIT 8 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-kdb_init \- Initialize Kerberos key distribution center database
-.SH SYNOPSIS
-kdb_init [
-.B realm
-]
-.SH DESCRIPTION
-.I kdb_init
-initializes a Kerberos key distribution center database, creating the
-necessary principals.
-.PP
-If the optional
-.I realm
-argument is not present,
-.I kdb_init
-prompts for a realm name (defaulting to the definition in
-/usr/include/kerberosIV/krb.h).
-After determining the realm to be created, it prompts for
-a master key password. The master key password is used to encrypt
-every encryption key stored in the database.
-.SH DIAGNOSTICS
-.TP 20n
-"/etc/kerberosIV/principal: File exists"
-An attempt was made to create a database on a machine which already had
-an existing database.
-.SH FILES
-.TP 20n
-/etc/kerberosIV/principal.db
-DBM file containing database
-.TP
-/etc/kerberosIV/principal.ok
-Semaphore indicating that the DBM database is not being modified.
-.TP
-/usr/include/kerberosIV/krb.h
-Include file defining default realm
-.SH SEE ALSO
-kdb_destroy(8)
diff --git a/eBones/kdb_init/kdb_init.c b/eBones/kdb_init/kdb_init.c
deleted file mode 100644
index de99181..0000000
--- a/eBones/kdb_init/kdb_init.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * program to initialize the database, reports error if database file
- * already exists.
- *
- * from: kdb_init.c,v 4.0 89/01/24 21:50:45 jtkohl Exp $
- * $Id: kdb_init.c,v 1.4 1995/07/18 16:37:35 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: kdb_init.c,v 1.4 1995/07/18 16:37:35 mark Exp $";
-#endif lint
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/time.h>
-#include <des.h>
-#include <krb.h>
-#include <krb_db.h>
-#include <string.h>
-
-#define TRUE 1
-
-enum ap_op {
- NULL_KEY, /* setup null keys */
- MASTER_KEY, /* use master key as new key */
- RANDOM_KEY, /* choose a random key */
-};
-
-int add_principal(char *name, char *instance, enum ap_op aap_op);
-
-int debug = 0;
-char *progname;
-C_Block master_key;
-Key_schedule master_key_schedule;
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- char realm[REALM_SZ];
- char *cp;
- int code;
- char *database;
-
- progname = (cp = rindex(*argv, '/')) ? cp + 1 : *argv;
-
- if (argc > 3) {
- fprintf(stderr, "Usage: %s [realm-name] [database-name]\n", argv[0]);
- exit(1);
- }
- if (argc == 3) {
- database = argv[2];
- --argc;
- } else
- database = DBM_FILE;
-
- /* Do this first, it'll fail if the database exists */
- if ((code = kerb_db_create(database)) != 0) {
- fprintf(stderr, "Couldn't create database: %s\n",
- sys_errlist[code]);
- exit(1);
- }
- kerb_db_set_name(database);
-
- if (argc == 2)
- strncpy(realm, argv[1], REALM_SZ);
- else {
- fprintf(stderr, "Realm name [default %s ]: ", KRB_REALM);
- if (fgets(realm, sizeof(realm), stdin) == NULL) {
- fprintf(stderr, "\nEOF reading realm\n");
- exit(1);
- }
- if ((cp = index(realm, '\n')))
- *cp = '\0';
- if (!*realm) /* no realm given */
- strcpy(realm, KRB_REALM);
- }
- if (!k_isrealm(realm)) {
- fprintf(stderr, "%s: Bad kerberos realm name \"%s\"\n",
- progname, realm);
- exit(1);
- }
- printf("You will be prompted for the database Master Password.\n");
- printf("It is important that you NOT FORGET this password.\n");
- fflush(stdout);
-
- if (kdb_get_master_key (TRUE, master_key, master_key_schedule) != 0) {
- fprintf (stderr, "Couldn't read master key.\n");
- exit (-1);
- }
-
- if (
- add_principal(KERB_M_NAME, KERB_M_INST, MASTER_KEY) ||
- add_principal(KERB_DEFAULT_NAME, KERB_DEFAULT_INST, NULL_KEY) ||
- add_principal("krbtgt", realm, RANDOM_KEY) ||
- add_principal("changepw", KRB_MASTER, RANDOM_KEY)
- ) {
- fprintf(stderr, "\n%s: couldn't initialize database.\n",
- progname);
- exit(1);
- }
-
- /* play it safe */
- bzero (master_key, sizeof (C_Block));
- bzero (master_key_schedule, sizeof (Key_schedule));
- exit(0);
-}
-
-/* use a return code to indicate success or failure. check the return */
-/* values of the routines called by this routine. */
-
-int
-add_principal(name, instance, aap_op)
- char *name, *instance;
- enum ap_op aap_op;
-{
- Principal principal;
- struct tm *tm;
- C_Block new_key;
-
- bzero(&principal, sizeof(principal));
- strncpy(principal.name, name, ANAME_SZ);
- strncpy(principal.instance, instance, INST_SZ);
- switch (aap_op) {
- case NULL_KEY:
- principal.key_low = 0;
- principal.key_high = 0;
- break;
- case RANDOM_KEY:
-#ifdef NOENCRYPTION
- bzero(new_key, sizeof(C_Block));
- new_key[0] = 127;
-#else
- random_key(new_key);
-#endif
- kdb_encrypt_key (new_key, new_key, master_key, master_key_schedule,
- ENCRYPT);
- bcopy(new_key, &principal.key_low, 4);
- bcopy(((long *) new_key) + 1, &principal.key_high, 4);
- break;
- case MASTER_KEY:
- bcopy (master_key, new_key, sizeof (C_Block));
- kdb_encrypt_key (new_key, new_key, master_key, master_key_schedule,
- ENCRYPT);
- bcopy(new_key, &principal.key_low, 4);
- bcopy(((long *) new_key) + 1, &principal.key_high, 4);
- break;
- }
- principal.exp_date = 946702799; /* Happy new century */
- strncpy(principal.exp_date_txt, "12/31/99", DATE_SZ);
- principal.mod_date = time(0);
-
- tm = localtime(&principal.mod_date);
- principal.attributes = 0;
- principal.max_life = 255;
-
- principal.kdc_key_ver = 1;
- principal.key_version = 1;
-
- strncpy(principal.mod_name, "db_creation", ANAME_SZ);
- strncpy(principal.mod_instance, "", INST_SZ);
- principal.old = 0;
-
- kerb_db_put_principal(&principal, 1);
-
- /* let's play it safe */
- bzero (new_key, sizeof (C_Block));
- bzero (&principal.key_low, 4);
- bzero (&principal.key_high, 4);
- return 0;
-}
diff --git a/eBones/kdb_util/Makefile b/eBones/kdb_util/Makefile
deleted file mode 100644
index 134fd34..0000000
--- a/eBones/kdb_util/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# From: @(#)Makefile 5.2 (Berkeley) 2/14/91
-# $Id: Makefile,v 1.3 1995/07/18 16:37:38 mark Exp $
-
-PROG= kdb_util
-CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../kdb_edit \
- -I${.CURDIR}/../include -Wall
-SRCS= kdb_util.c maketime.c
-.PATH: ${.CURDIR}/../kdb_edit
-DPADD= ${LIBKDB} ${LIBKRB}
-LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -ldes
-MAN8= kdb_util.8
-
-.include <bsd.prog.mk>
diff --git a/eBones/kdb_util/kdb_util.8 b/eBones/kdb_util/kdb_util.8
deleted file mode 100644
index 4183ef3..0000000
--- a/eBones/kdb_util/kdb_util.8
+++ /dev/null
@@ -1,64 +0,0 @@
-.\" from: kdb_util.8,v 4.1 89/01/23 11:09:11 jtkohl Exp $
-.\" $Id: kdb_util.8,v 1.1.1.1 1994/09/30 14:50:06 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KDB_UTIL 8 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-kdb_util \- Kerberos key distribution center database utility
-.SH SYNOPSIS
-kdb_util
-.B operation filename
-.SH DESCRIPTION
-.I kdb_util
-allows the Kerberos key distribution center (KDC) database administrator to
-perform utility functions on the database.
-.PP
-.I Operation
-must be one of the following:
-.TP 10n
-.I load
-initializes the KDC database with the records described by the
-text contained in the file
-.IR filename .
-Any existing database is overwritten.
-.TP
-.I dump
-dumps the KDC database into a text representation in the file
-.IR filename .
-.TP
-.I slave_dump
-performs a database dump like the
-.I dump
-operation, and additionally creates a semaphore file signalling the
-propagation software that an update is available for distribution to
-slave KDC databases.
-.TP
-.I new_master_key
-prompts for the old and new master key strings, and then dumps the KDC
-database into a text representation in the file
-.IR filename .
-The keys in the text representation are encrypted in the new master key.
-.TP
-.I convert_old_db
-prompts for the master key string, and then dumps the KDC database into
-a text representation in the file
-.IR filename .
-The existing database is assumed to be encrypted using the old format
-(encrypted by the key schedule of the master key); the dumped database
-is encrypted using the new format (encrypted directly with master key).
-.PP
-.SH DIAGNOSTICS
-.TP 20n
-"verify_master_key: Invalid master key, does not match database."
-The master key string entered was incorrect.
-.SH FILES
-.TP 20n
-/etc/kerberosIV/principal.db
-DBM file containing database
-.TP
-.IR filename .dump_ok
-semaphore file created by
-.IR slave_dump.
diff --git a/eBones/kdb_util/kdb_util.c b/eBones/kdb_util/kdb_util.c
deleted file mode 100644
index 5dbe509..0000000
--- a/eBones/kdb_util/kdb_util.c
+++ /dev/null
@@ -1,523 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * Kerberos database manipulation utility. This program allows you to
- * dump a kerberos database to an ascii readable file and load this
- * file into the database. Read locking of the database is done during a
- * dump operation. NO LOCKING is done during a load operation. Loads
- * should happen with other processes shutdown.
- *
- * Written July 9, 1987 by Jeffrey I. Schiller
- *
- * from: kdb_util.c,v 4.4 90/01/09 15:57:20 raeburn Exp $
- * $Id: kdb_util.c,v 1.5 1995/08/03 17:15:57 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: kdb_util.c,v 1.5 1995/08/03 17:15:57 mark Exp $";
-#endif lint
-#endif
-
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <time.h>
-#include <strings.h>
-#include <des.h>
-#include <krb.h>
-#include <sys/file.h>
-#include <krb_db.h>
-
-#define TRUE 1
-
-Principal aprinc;
-
-static des_cblock master_key, new_master_key;
-static des_key_schedule master_key_schedule, new_master_key_schedule;
-
-#define zaptime(foo) bzero((char *)(foo), sizeof(*(foo)))
-
-char * progname;
-
-void convert_old_format_db (char *db_file, FILE *out);
-void convert_new_master_key (char *db_file, FILE *out);
-void update_ok_file (char *file_name);
-void print_time(FILE *file, unsigned long timeval);
-void load_db (char *db_file, FILE *input_file);
-int dump_db (char *db_file, FILE *output_file, void (*cv_key)());
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- FILE *file;
- enum {
- OP_LOAD,
- OP_DUMP,
- OP_SLAVE_DUMP,
- OP_NEW_MASTER,
- OP_CONVERT_OLD_DB,
- } op;
- char *file_name;
- char *prog = argv[0];
- char *db_name;
-
- progname = prog;
-
- if (argc != 3 && argc != 4) {
- fprintf(stderr, "Usage: %s operation file-name [database name].\n",
- argv[0]);
- exit(1);
- }
- if (argc == 3)
- db_name = DBM_FILE;
- else
- db_name = argv[3];
-
- if (kerb_db_set_name (db_name) != 0) {
- perror("Can't open database");
- exit(1);
- }
-
- if (!strcmp(argv[1], "load"))
- op = OP_LOAD;
- else if (!strcmp(argv[1], "dump"))
- op = OP_DUMP;
- else if (!strcmp(argv[1], "slave_dump"))
- op = OP_SLAVE_DUMP;
- else if (!strcmp(argv[1], "new_master_key"))
- op = OP_NEW_MASTER;
- else if (!strcmp(argv[1], "convert_old_db"))
- op = OP_CONVERT_OLD_DB;
- else {
- fprintf(stderr,
- "%s: %s is an invalid operation.\n", prog, argv[1]);
- fprintf(stderr,
- "%s: Valid operations are \"dump\", \"slave_dump\",", argv[0]);
- fprintf(stderr,
- "\"load\", \"new_master_key\", and \"convert_old_db\".\n");
- exit(1);
- }
-
- file_name = argv[2];
- file = fopen(file_name, op == OP_LOAD ? "r" : "w");
- if (file == NULL) {
- fprintf(stderr, "%s: Unable to open %s\n", prog, argv[2]);
- (void) fflush(stderr);
- perror("open");
- exit(1);
- }
-
- switch (op) {
- case OP_DUMP:
- if ((dump_db (db_name, file, (void (*)()) 0) == EOF) ||
- (fclose(file) == EOF)) {
- fprintf(stderr, "error on file %s:", file_name);
- perror("");
- exit(1);
- }
- break;
- case OP_SLAVE_DUMP:
- if ((dump_db (db_name, file, (void (*)()) 0) == EOF) ||
- (fclose(file) == EOF)) {
- fprintf(stderr, "error on file %s:", file_name);
- perror("");
- exit(1);
- }
- update_ok_file (file_name);
- break;
- case OP_LOAD:
- load_db (db_name, file);
- break;
- case OP_NEW_MASTER:
- convert_new_master_key (db_name, file);
- printf("Don't forget to do a `kdb_util load %s' to reload the database!\n", file_name);
- break;
- case OP_CONVERT_OLD_DB:
- convert_old_format_db (db_name, file);
- printf("Don't forget to do a `kdb_util load %s' to reload the database!\n", file_name);
- break;
- }
- exit(0);
- }
-
-void
-clear_secrets ()
-{
- bzero((char *)master_key, sizeof (des_cblock));
- bzero((char *)master_key_schedule, sizeof (Key_schedule));
- bzero((char *)new_master_key, sizeof (des_cblock));
- bzero((char *)new_master_key_schedule, sizeof (Key_schedule));
-}
-
-/* cv_key is a procedure which takes a principle and changes its key,
- either for a new method of encrypting the keys, or a new master key.
- if cv_key is null no transformation of key is done (other than net byte
- order). */
-
-struct callback_args {
- void (*cv_key)();
- FILE *output_file;
-};
-
-static int dump_db_1(arg, principal)
- char *arg;
- Principal *principal;
-{ /* replace null strings with "*" */
- struct callback_args *a = (struct callback_args *)arg;
-
- if (principal->instance[0] == '\0') {
- principal->instance[0] = '*';
- principal->instance[1] = '\0';
- }
- if (principal->mod_name[0] == '\0') {
- principal->mod_name[0] = '*';
- principal->mod_name[1] = '\0';
- }
- if (principal->mod_instance[0] == '\0') {
- principal->mod_instance[0] = '*';
- principal->mod_instance[1] = '\0';
- }
- if (a->cv_key != NULL) {
- (*a->cv_key) (principal);
- }
- fprintf(a->output_file, "%s %s %d %d %d %d %lx %lx",
- principal->name,
- principal->instance,
- principal->max_life,
- principal->kdc_key_ver,
- principal->key_version,
- principal->attributes,
- htonl (principal->key_low),
- htonl (principal->key_high));
- print_time(a->output_file, principal->exp_date);
- print_time(a->output_file, principal->mod_date);
- fprintf(a->output_file, " %s %s\n",
- principal->mod_name,
- principal->mod_instance);
- return 0;
-}
-
-int
-dump_db (db_file, output_file, cv_key)
- char *db_file;
- FILE *output_file;
- void (*cv_key)();
-{
- struct callback_args a;
-
- a.cv_key = cv_key;
- a.output_file = output_file;
-
- kerb_db_iterate (dump_db_1, (char *)&a);
- return fflush(output_file);
-}
-
-void
-load_db (db_file, input_file)
- char *db_file;
- FILE *input_file;
-{
- char exp_date_str[50];
- char mod_date_str[50];
- int temp1, temp2, temp3;
- long time_explode();
- int code;
- char *temp_db_file;
- temp1 = strlen(db_file)+2;
- temp_db_file = malloc (temp1);
- strcpy(temp_db_file, db_file);
- strcat(temp_db_file, "~");
-
- /* Create the database */
- if ((code = kerb_db_create(temp_db_file)) != 0) {
- fprintf(stderr, "Couldn't create temp database %s: %s\n",
- temp_db_file, sys_errlist[code]);
- exit(1);
- }
- kerb_db_set_name(temp_db_file);
- for (;;) { /* explicit break on eof from fscanf */
- bzero((char *)&aprinc, sizeof(aprinc));
- if (fscanf(input_file,
- "%s %s %d %d %d %hd %lx %lx %s %s %s %s\n",
- aprinc.name,
- aprinc.instance,
- &temp1,
- &temp2,
- &temp3,
- &aprinc.attributes,
- &aprinc.key_low,
- &aprinc.key_high,
- exp_date_str,
- mod_date_str,
- aprinc.mod_name,
- aprinc.mod_instance) == EOF)
- break;
- aprinc.key_low = ntohl (aprinc.key_low);
- aprinc.key_high = ntohl (aprinc.key_high);
- aprinc.max_life = (unsigned char) temp1;
- aprinc.kdc_key_ver = (unsigned char) temp2;
- aprinc.key_version = (unsigned char) temp3;
- aprinc.exp_date = time_explode(exp_date_str);
- aprinc.mod_date = time_explode(mod_date_str);
- if (aprinc.instance[0] == '*')
- aprinc.instance[0] = '\0';
- if (aprinc.mod_name[0] == '*')
- aprinc.mod_name[0] = '\0';
- if (aprinc.mod_instance[0] == '*')
- aprinc.mod_instance[0] = '\0';
- if (kerb_db_put_principal(&aprinc, 1) != 1) {
- fprintf(stderr, "Couldn't store %s.%s: %s; load aborted\n",
- aprinc.name, aprinc.instance,
- sys_errlist[errno]);
- exit(1);
- };
- }
- if ((code = kerb_db_rename(temp_db_file, db_file)) != 0)
- perror("database rename failed");
- (void) fclose(input_file);
- free(temp_db_file);
-}
-
-void
-print_time(file, timeval)
- FILE *file;
- unsigned long timeval;
-{
- struct tm *tm;
- struct tm *gmtime();
- tm = gmtime((long *)&timeval);
- fprintf(file, " %04d%02d%02d%02d%02d",
- tm->tm_year < 1900 ? tm->tm_year + 1900: tm->tm_year,
- tm->tm_mon + 1,
- tm->tm_mday,
- tm->tm_hour,
- tm->tm_min);
-}
-
-/*ARGSUSED*/
-void
-update_ok_file (file_name)
- char *file_name;
-{
- /* handle slave locking/failure stuff */
- char *file_ok;
- int fd;
- static char ok[]=".dump_ok";
-
- if ((file_ok = (char *)malloc(strlen(file_name) + strlen(ok) + 1))
- == NULL) {
- fprintf(stderr, "kdb_util: out of memory.\n");
- (void) fflush (stderr);
- perror ("malloc");
- exit (1);
- }
- strcpy(file_ok, file_name);
- strcat(file_ok, ok);
- if ((fd = open(file_ok, O_WRONLY|O_CREAT|O_TRUNC, 0400)) < 0) {
- fprintf(stderr, "Error creating 'ok' file, '%s'", file_ok);
- perror("");
- (void) fflush (stderr);
- exit (1);
- }
- free(file_ok);
- close(fd);
-}
-
-void
-convert_key_new_master (p)
- Principal *p;
-{
- des_cblock key;
-
- /* leave null keys alone */
- if ((p->key_low == 0) && (p->key_high == 0)) return;
-
- /* move current key to des_cblock for encryption, special case master key
- since that's changing */
- if ((strncmp (p->name, KERB_M_NAME, ANAME_SZ) == 0) &&
- (strncmp (p->instance, KERB_M_INST, INST_SZ) == 0)) {
- bcopy((char *)new_master_key, (char *) key, sizeof (des_cblock));
- (p->key_version)++;
- } else {
- bcopy((char *)&(p->key_low), (char *)key, 4);
- bcopy((char *)&(p->key_high), (char *) (((long *) key) + 1), 4);
- kdb_encrypt_key (key, key, master_key, master_key_schedule, DECRYPT);
- }
-
- kdb_encrypt_key (key, key, new_master_key, new_master_key_schedule, ENCRYPT);
-
- bcopy((char *)key, (char *)&(p->key_low), 4);
- bcopy((char *)(((long *) key) + 1), (char *)&(p->key_high), 4);
- bzero((char *)key, sizeof (key)); /* a little paranoia ... */
-
- (p->kdc_key_ver)++;
-}
-
-void
-convert_new_master_key (db_file, out)
- char *db_file;
- FILE *out;
-{
-
- printf ("\n\nEnter the CURRENT master key.");
- if (kdb_get_master_key (TRUE, master_key, master_key_schedule) != 0) {
- fprintf (stderr, "get_master_key: Couldn't get master key.\n");
- clear_secrets ();
- exit (-1);
- }
-
- if (kdb_verify_master_key (master_key, master_key_schedule, stderr) < 0) {
- clear_secrets ();
- exit (-1);
- }
-
- printf ("\n\nNow enter the NEW master key. Do not forget it!!");
- if (kdb_get_master_key (TRUE, new_master_key, new_master_key_schedule) != 0) {
- fprintf (stderr, "get_master_key: Couldn't get new master key.\n");
- clear_secrets ();
- exit (-1);
- }
-
- dump_db (db_file, out, convert_key_new_master);
-}
-
-void
-convert_key_old_db (p)
- Principal *p;
-{
- des_cblock key;
-
- /* leave null keys alone */
- if ((p->key_low == 0) && (p->key_high == 0)) return;
-
- bcopy((char *)&(p->key_low), (char *)key, 4);
- bcopy((char *)&(p->key_high), (char *)(((long *) key) + 1), 4);
-
-#ifndef NOENCRYPTION
- des_pcbc_encrypt((des_cblock *)key,(des_cblock *)key,
- (long)sizeof(des_cblock),master_key_schedule,
- (des_cblock *)master_key_schedule,DECRYPT);
-#endif
-
- /* make new key, new style */
- kdb_encrypt_key (key, key, master_key, master_key_schedule, ENCRYPT);
-
- bcopy((char *)key, (char *)&(p->key_low), 4);
- bcopy((char *)(((long *) key) + 1), (char *)&(p->key_high), 4);
- bzero((char *)key, sizeof (key)); /* a little paranoia ... */
-}
-
-void
-convert_old_format_db (db_file, out)
- char *db_file;
- FILE *out;
-{
- des_cblock key_from_db;
- Principal principal_data[1];
- int n, more;
-
- if (kdb_get_master_key (TRUE, master_key, master_key_schedule) != 0L) {
- fprintf (stderr, "verify_master_key: Couldn't get master key.\n");
- clear_secrets();
- exit (-1);
- }
-
- /* can't call kdb_verify_master_key because this is an old style db */
- /* lookup the master key version */
- n = kerb_get_principal(KERB_M_NAME, KERB_M_INST, principal_data,
- 1 /* only one please */, &more);
- if ((n != 1) || more) {
- fprintf(stderr, "verify_master_key: "
- "Kerberos error on master key lookup, %d found.\n",
- n);
- exit (-1);
- }
-
- /* set up the master key */
- fprintf(stderr, "Current Kerberos master key version is %d.\n",
- principal_data[0].kdc_key_ver);
-
- /*
- * now use the master key to decrypt (old style) the key in the db, had better
- * be the same!
- */
- bcopy((char *)&principal_data[0].key_low, (char *)key_from_db, 4);
- bcopy((char *)&principal_data[0].key_high,
- (char *)(((long *) key_from_db) + 1), 4);
-#ifndef NOENCRYPTION
- des_pcbc_encrypt((des_cblock *)key_from_db,(des_cblock *)key_from_db,
- (long)sizeof(key_from_db),master_key_schedule,
- (des_cblock *)master_key_schedule,DECRYPT);
-#endif
- /* the decrypted database key had better equal the master key */
- n = bcmp((char *) master_key, (char *) key_from_db,
- sizeof(master_key));
- bzero((char *)key_from_db, sizeof(key_from_db));
-
- if (n) {
- fprintf(stderr, "\n\07\07verify_master_key: Invalid master key, ");
- fprintf(stderr, "does not match database.\n");
- exit (-1);
- }
-
- fprintf(stderr, "Master key verified.\n");
- (void) fflush(stderr);
-
- dump_db (db_file, out, convert_key_old_db);
-}
-
-long
-time_explode(cp)
-register char *cp;
-{
- char wbuf[5];
- struct tm tp;
- long maketime();
- int local;
-
- zaptime(&tp); /* clear out the struct */
-
- if (strlen(cp) > 10) { /* new format */
- (void) strncpy(wbuf, cp, 4);
- wbuf[4] = 0;
- tp.tm_year = atoi(wbuf);
- cp += 4; /* step over the year */
- local = 0; /* GMT */
- } else { /* old format: local time,
- year is 2 digits, assuming 19xx */
- wbuf[0] = *cp++;
- wbuf[1] = *cp++;
- wbuf[2] = 0;
- tp.tm_year = 1900 + atoi(wbuf);
- local = 1; /* local */
- }
-
- wbuf[0] = *cp++;
- wbuf[1] = *cp++;
- wbuf[2] = 0;
- tp.tm_mon = atoi(wbuf)-1;
-
- wbuf[0] = *cp++;
- wbuf[1] = *cp++;
- tp.tm_mday = atoi(wbuf);
-
- wbuf[0] = *cp++;
- wbuf[1] = *cp++;
- tp.tm_hour = atoi(wbuf);
-
- wbuf[0] = *cp++;
- wbuf[1] = *cp++;
- tp.tm_min = atoi(wbuf);
-
-
- return(maketime(&tp, local));
-}
diff --git a/eBones/kdestroy/Makefile b/eBones/kdestroy/Makefile
deleted file mode 100644
index 1e4da0a..0000000
--- a/eBones/kdestroy/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# From: @(#)Makefile 5.1 (Berkeley) 6/25/90
-# $Id: Makefile,v 1.3 1995/07/18 16:37:42 mark Exp $
-
-PROG= kdestroy
-CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -DBSD42 -Wall
-DPADD= ${LIBKRB}
-LDADD= -L${KRBOBJDIR} -lkrb -ldes
-BINDIR= /usr/bin
-MAN1= kdestroy.1
-
-.include <bsd.prog.mk>
diff --git a/eBones/kdestroy/kdestroy.c b/eBones/kdestroy/kdestroy.c
deleted file mode 100644
index 926eea5..0000000
--- a/eBones/kdestroy/kdestroy.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * This program causes Kerberos tickets to be destroyed.
- * Options are:
- *
- * -q[uiet] - no bell even if tickets not destroyed
- * -f[orce] - no message printed at all
- *
- * from: kdestroy.c,v 4.5 88/03/18 15:16:02 steiner Exp $
- * $Id: kdestroy.c,v 1.3 1995/07/18 16:37:44 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: kdestroy.c,v 1.3 1995/07/18 16:37:44 mark Exp $";
-#endif lint
-#endif
-
-#include <stdio.h>
-#include <krb.h>
-#ifdef BSD42
-#include <strings.h>
-#endif BSD42
-
-
-static char *pname;
-
-static void
-usage()
-{
- fprintf(stderr, "Usage: %s [-f] [-q]\n", pname);
- exit(1);
-}
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- int fflag=0, qflag=0, k_errno;
- register char *cp;
-
- cp = rindex (argv[0], '/');
- if (cp == NULL)
- pname = argv[0];
- else
- pname = cp+1;
-
- if (argc > 2)
- usage();
- else if (argc == 2) {
- if (!strcmp(argv[1], "-f"))
- ++fflag;
- else if (!strcmp(argv[1], "-q"))
- ++qflag;
- else usage();
- }
-
- k_errno = dest_tkt();
-
- if (fflag) {
- if (k_errno != 0 && k_errno != RET_TKFIL)
- exit(1);
- else
- exit(0);
- } else {
- if (k_errno == 0)
- printf("Tickets destroyed.\n");
- else if (k_errno == RET_TKFIL)
- fprintf(stderr, "No tickets to destroy.\n");
- else {
- fprintf(stderr, "Tickets NOT destroyed.\n");
- if (!qflag)
- fprintf(stderr, "\007");
- exit(1);
- }
- }
- exit(0);
-}
diff --git a/eBones/kerberos/Makefile b/eBones/kerberos/Makefile
deleted file mode 100644
index 7db860e..0000000
--- a/eBones/kerberos/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# From: @(#)Makefile 5.1 (Berkeley) 6/25/90
-# $Id: Makefile,v 1.3 1995/07/18 16:37:47 mark Exp $
-
-PROG= kerberos
-SRCS= kerberos.c cr_err_reply.c
-CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -Wall
-DPADD= ${LIBKDB} ${LIBKRB}
-LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -ldes
-NOMAN= noman
-
-.include <bsd.prog.mk>
diff --git a/eBones/kerberos/cr_err_reply.c b/eBones/kerberos/cr_err_reply.c
deleted file mode 100644
index 89ee5f6..0000000
--- a/eBones/kerberos/cr_err_reply.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: cr_err_reply.c,v 4.10 89/01/10 11:34:42 steiner Exp $
- * $Id: cr_err_reply.c,v 1.2 1995/07/18 16:37:49 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: cr_err_reply.c,v 1.2 1995/07/18 16:37:49 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <sys/types.h>
-#include <krb.h>
-#include <prot.h>
-#include <strings.h>
-
-extern int req_act_vno; /* this is defined in the kerberos
- * server code */
-
-/*
- * This routine is used by the Kerberos authentication server to
- * create an error reply packet to send back to its client.
- *
- * It takes a pointer to the packet to be built, the name, instance,
- * and realm of the principal, the client's timestamp, an error code
- * and an error string as arguments. Its return value is undefined.
- *
- * The packet is built in the following format:
- *
- * type variable data
- * or constant
- * ---- ----------- ----
- *
- * unsigned char req_ack_vno protocol version number
- *
- * unsigned char AUTH_MSG_ERR_REPLY protocol message type
- *
- * [least significant HOST_BYTE_ORDER sender's (server's) byte
- * bit of above field] order
- *
- * string pname principal's name
- *
- * string pinst principal's instance
- *
- * string prealm principal's realm
- *
- * unsigned long time_ws client's timestamp
- *
- * unsigned long e error code
- *
- * string e_string error text
- */
-
-void
-cr_err_reply(pkt,pname,pinst,prealm,time_ws,e,e_string)
- KTEXT pkt;
- char *pname; /* Principal's name */
- char *pinst; /* Principal's instance */
- char *prealm; /* Principal's authentication domain */
- u_long time_ws; /* Workstation time */
- u_long e; /* Error code */
- char *e_string; /* Text of error */
-{
- u_char *v = (u_char *) pkt->dat; /* Prot vers number */
- u_char *t = (u_char *)(pkt->dat+1); /* Prot message type */
-
- /* Create fixed part of packet */
- *v = (unsigned char) req_act_vno; /* KRB_PROT_VERSION; */
- *t = (unsigned char) AUTH_MSG_ERR_REPLY;
- *t |= HOST_BYTE_ORDER;
-
- /* Add the basic info */
- (void) strcpy((char *) (pkt->dat+2),pname);
- pkt->length = 3 + strlen(pname);
- (void) strcpy((char *)(pkt->dat+pkt->length),pinst);
- pkt->length += 1 + strlen(pinst);
- (void) strcpy((char *)(pkt->dat+pkt->length),prealm);
- pkt->length += 1 + strlen(prealm);
- /* ws timestamp */
- bcopy((char *) &time_ws,(char *)(pkt->dat+pkt->length),4);
- pkt->length += 4;
- /* err code */
- bcopy((char *) &e,(char *)(pkt->dat+pkt->length),4);
- pkt->length += 4;
- /* err text */
- (void) strcpy((char *)(pkt->dat+pkt->length),e_string);
- pkt->length += 1 + strlen(e_string);
-
- /* And return */
- return;
-}
diff --git a/eBones/kerberos/kerberos.c b/eBones/kerberos/kerberos.c
deleted file mode 100644
index 236bbbd..0000000
--- a/eBones/kerberos/kerberos.c
+++ /dev/null
@@ -1,816 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: kerberos.c,v 4.19 89/11/01 17:18:07 qjb Exp $
- * $Id: kerberos.c,v 1.4 1995/07/18 16:37:51 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: kerberos.c,v 1.4 1995/07/18 16:37:51 mark Exp $";
-#endif lint
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <signal.h>
-#include <sgtty.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <sys/file.h>
-#include <ctype.h>
-
-#include <krb.h>
-#include <des.h>
-#include <klog.h>
-#include <prot.h>
-#include <krb_db.h>
-#include <kdc.h>
-
-void cr_err_reply(KTEXT pkt, char *pname, char *pinst, char *prealm,
- u_long time_ws, u_long e, char *e_string);
-void kerb_err_reply(struct sockaddr_in *client, KTEXT pkt, long err,
- char *string);
-void setup_disc(void);
-void kerberos(struct sockaddr_in *client, KTEXT pkt);
-int check_princ(char *p_name, char *instance, unsigned lifetime, Principal *p);
-int set_tgtkey(char *r);
-
-struct sockaddr_in s_in = {AF_INET};
-int f;
-
-/* XXX several files in libkdb know about this */
-char *progname;
-
-static Key_schedule master_key_schedule;
-static C_Block master_key;
-
-static struct timeval kerb_time;
-static Principal a_name_data; /* for requesting user */
-static Principal s_name_data; /* for services requested */
-static C_Block session_key;
-static u_char master_key_version;
-static char k_instance[INST_SZ];
-static char *lt;
-static int more;
-
-static int mflag; /* Are we invoked manually? */
-static int lflag; /* Have we set an alterate log file? */
-static char *log_file; /* name of alt. log file */
-static int nflag; /* don't check max age */
-static int rflag; /* alternate realm specified */
-
-/* fields within the received request packet */
-static u_char req_msg_type;
-static u_char req_version;
-static char *req_name_ptr;
-static char *req_inst_ptr;
-static char *req_realm_ptr;
-static u_long req_time_ws;
-
-int req_act_vno = KRB_PROT_VERSION; /* Temporary for version skew */
-
-static char local_realm[REALM_SZ];
-
-/* statistics */
-static long q_bytes; /* current bytes remaining in queue */
-static long q_n; /* how many consecutive non-zero
- * q_bytes */
-static long max_q_bytes;
-static long max_q_n;
-static long n_auth_req;
-static long n_appl_req;
-static long n_packets;
-
-static long max_age = -1;
-static long pause_int = -1;
-
-static void check_db_age();
-static void hang();
-
-/*
- * Print usage message and exit.
- */
-static void usage()
-{
- fprintf(stderr, "Usage: %s [-s] [-m] [-n] [-p pause_seconds]%s%s\n", progname,
- " [-a max_age] [-l log_file] [-r realm]"
- ," [database_pathname]"
- );
- exit(1);
-}
-
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- struct sockaddr_in from;
- register int n;
- int on = 1;
- int child;
- struct servent *sp;
- int fromlen;
- static KTEXT_ST pkt_st;
- KTEXT pkt = &pkt_st;
- int kerror;
- int c;
- extern char *optarg;
- extern int optind;
-
- progname = argv[0];
-
- while ((c = getopt(argc, argv, "snmp:a:l:r:")) != EOF) {
- switch(c) {
- case 's':
- /*
- * Set parameters to slave server defaults.
- */
- if (max_age == -1 && !nflag)
- max_age = ONE_DAY; /* 24 hours */
- if (pause_int == -1)
- pause_int = FIVE_MINUTES; /* 5 minutes */
- if (lflag == 0) {
- log_file = KRBSLAVELOG;
- lflag++;
- }
- break;
- case 'n':
- max_age = -1; /* don't check max age. */
- nflag++;
- break;
- case 'm':
- mflag++; /* running manually; prompt for master key */
- break;
- case 'p':
- /* Set pause interval. */
- if (!isdigit(optarg[0]))
- usage();
- pause_int = atoi(optarg);
- if ((pause_int < 5) || (pause_int > ONE_HOUR)) {
- fprintf(stderr, "pause_int must be between 5 and 3600 seconds.\n");
- usage();
- }
- break;
- case 'a':
- /* Set max age. */
- if (!isdigit(optarg[0]))
- usage();
- max_age = atoi(optarg);
- if ((max_age < ONE_HOUR) || (max_age > THREE_DAYS)) {
- fprintf(stderr, "max_age must be between one hour and three days, in seconds\n");
- usage();
- }
- break;
- case 'l':
- /* Set alternate log file */
- lflag++;
- log_file = optarg;
- break;
- case 'r':
- /* Set realm name */
- rflag++;
- strcpy(local_realm, optarg);
- break;
- default:
- usage();
- break;
- }
- }
-
- if (optind == (argc-1)) {
- if (kerb_db_set_name(argv[optind]) != 0) {
- fprintf(stderr, "Could not set alternate database name\n");
- exit(1);
- }
- optind++;
- }
-
- if (optind != argc)
- usage();
-
- printf("Kerberos server starting\n");
-
- if ((!nflag) && (max_age != -1))
- printf("\tMaximum database age: %ld seconds\n", max_age);
- if (pause_int != -1)
- printf("\tSleep for %ld seconds on error\n", pause_int);
- else
- printf("\tSleep forever on error\n");
- if (mflag)
- printf("\tMaster key will be entered manually\n");
-
- printf("\tLog file is %s\n", lflag ? log_file : KRBLOG);
-
- if (lflag)
- kset_logfile(log_file);
-
- /* find our hostname, and use it as the instance */
- if (gethostname(k_instance, INST_SZ)) {
- fprintf(stderr, "%s: gethostname error\n", progname);
- exit(1);
- }
-
- if ((sp = getservbyname("kerberos", "udp")) == 0) {
- fprintf(stderr, "%s: udp/kerberos unknown service\n", progname);
- exit(1);
- }
- s_in.sin_port = sp->s_port;
-
- if ((f = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
- fprintf(stderr, "%s: Can't open socket\n", progname);
- exit(1);
- }
- if (setsockopt(f, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
- fprintf(stderr, "%s: setsockopt (SO_REUSEADDR)\n", progname);
-
- if (bind(f, (struct sockaddr *) &s_in, S_AD_SZ) < 0) {
- fprintf(stderr, "%s: Can't bind socket\n", progname);
- exit(1);
- }
- /* do all the database and cache inits */
- if ((n = kerb_init())) {
- if (mflag) {
- printf("Kerberos db and cache init ");
- printf("failed = %d ...exiting\n", n);
- exit(-1);
- } else {
- klog(L_KRB_PERR,
- "Kerberos db and cache init failed = %d ...exiting", n);
- hang();
- }
- }
-
- /* Make sure database isn't stale */
- check_db_age();
-
- /* setup master key */
- if (kdb_get_master_key (mflag, master_key, master_key_schedule) != 0) {
- klog (L_KRB_PERR, "kerberos: couldn't get master key.\n");
- exit (-1);
- }
- kerror = kdb_verify_master_key (master_key, master_key_schedule, stdout);
- if (kerror < 0) {
- klog (L_KRB_PERR, "Can't verify master key.");
- bzero (master_key, sizeof (master_key));
- bzero (master_key_schedule, sizeof (master_key_schedule));
- exit (-1);
- }
-
- master_key_version = (u_char) kerror;
-
- fprintf(stdout, "\nCurrent Kerberos master key version is %d\n",
- master_key_version);
-
- if (!rflag) {
- /* Look up our local realm */
- krb_get_lrealm(local_realm, 1);
- }
- fprintf(stdout, "Local realm: %s\n", local_realm);
- fflush(stdout);
-
- if (set_tgtkey(local_realm)) {
- /* Ticket granting service unknown */
- klog(L_KRB_PERR, "Ticket granting ticket service unknown");
- fprintf(stderr, "Ticket granting ticket service unknown\n");
- exit(1);
- }
- if (mflag) {
- if ((child = fork()) != 0) {
- printf("Kerberos started, PID=%d\n", child);
- exit(0);
- }
- setup_disc();
- }
- /* receive loop */
- for (;;) {
- fromlen = S_AD_SZ;
- n = recvfrom(f, pkt->dat, MAX_PKT_LEN, 0, (struct sockaddr *) &from,
- &fromlen);
- if (n > 0) {
- pkt->length = n;
- pkt->mbz = 0; /* force zeros to catch runaway strings */
- /* see what is left in the input queue */
- ioctl(f, FIONREAD, &q_bytes);
- gettimeofday(&kerb_time, NULL);
- q_n++;
- max_q_n = max(max_q_n, q_n);
- n_packets++;
- klog(L_NET_INFO,
- "q_byt %d, q_n %d, rd_byt %d, mx_q_b %d, mx_q_n %d, n_pkt %d",
- q_bytes, q_n, n, max_q_bytes, max_q_n, n_packets, 0);
- max_q_bytes = max(max_q_bytes, q_bytes);
- if (!q_bytes)
- q_n = 0; /* reset consecutive packets */
- kerberos(&from, pkt);
- } else
- klog(L_NET_ERR,
- "%s: bad recvfrom n = %d errno = %d", progname, n, errno, 0);
- }
-}
-
-void
-kerberos(client, pkt)
- struct sockaddr_in *client;
- KTEXT pkt;
-{
- static KTEXT_ST rpkt_st;
- KTEXT rpkt = &rpkt_st;
- static KTEXT_ST ciph_st;
- KTEXT ciph = &ciph_st;
- static KTEXT_ST tk_st;
- KTEXT tk = &tk_st;
- static KTEXT_ST auth_st;
- KTEXT auth = &auth_st;
- AUTH_DAT ad_st;
- AUTH_DAT *ad = &ad_st;
-
-
- static struct in_addr client_host;
- static int msg_byte_order;
- static int swap_bytes;
- static u_char k_flags;
- u_long lifetime;
- int i;
- C_Block key;
- Key_schedule key_s;
- char *ptr;
-
-
-
- ciph->length = 0;
-
- client_host = client->sin_addr;
-
- /* eval macros and correct the byte order and alignment as needed */
- req_version = pkt_version(pkt); /* 1 byte, version */
- req_msg_type = pkt_msg_type(pkt); /* 1 byte, Kerberos msg type */
-
- req_act_vno = req_version;
-
- /* check packet version */
- if (req_version != KRB_PROT_VERSION) {
- lt = klog(L_KRB_PERR,
- "KRB prot version mismatch: KRB =%d request = %d",
- KRB_PROT_VERSION, req_version, 0);
- /* send an error reply */
- kerb_err_reply(client, pkt, KERB_ERR_PKT_VER, lt);
- return;
- }
- msg_byte_order = req_msg_type & 1;
-
- swap_bytes = 0;
- if (msg_byte_order != HOST_BYTE_ORDER) {
- swap_bytes++;
- }
- klog(L_KRB_PINFO,
- "Prot version: %d, Byte order: %d, Message type: %d",
- req_version, msg_byte_order, req_msg_type);
-
- switch (req_msg_type & ~1) {
-
- case AUTH_MSG_KDC_REQUEST:
- {
- u_long req_life; /* Requested liftime */
- char *service; /* Service name */
- char *instance; /* Service instance */
- n_auth_req++;
- tk->length = 0;
- k_flags = 0; /* various kerberos flags */
-
-
- /* set up and correct for byte order and alignment */
- req_name_ptr = (char *) pkt_a_name(pkt);
- req_inst_ptr = (char *) pkt_a_inst(pkt);
- req_realm_ptr = (char *) pkt_a_realm(pkt);
- bcopy(pkt_time_ws(pkt), &req_time_ws, sizeof(req_time_ws));
- /* time has to be diddled */
- if (swap_bytes) {
- swap_u_long(req_time_ws);
- }
- ptr = (char *) pkt_time_ws(pkt) + 4;
-
- req_life = (u_long) (*ptr++);
-
- service = ptr;
- instance = ptr + strlen(service) + 1;
-
- rpkt = &rpkt_st;
- klog(L_INI_REQ,
- "Initial ticket request Host: %s User: \"%s\" \"%s\"",
- inet_ntoa(client_host), req_name_ptr, req_inst_ptr, 0);
-
- if ((i = check_princ(req_name_ptr, req_inst_ptr, 0,
- &a_name_data))) {
- kerb_err_reply(client, pkt, i, lt);
- return;
- }
- tk->length = 0; /* init */
- if (strcmp(service, "krbtgt"))
- klog(L_NTGT_INTK,
- "INITIAL request from %s.%s for %s.%s",
- req_name_ptr, req_inst_ptr, service, instance, 0);
- /* this does all the checking */
- if ((i = check_princ(service, instance, lifetime,
- &s_name_data))) {
- kerb_err_reply(client, pkt, i, lt);
- return;
- }
- /* Bound requested lifetime with service and user */
- lifetime = min(req_life, ((u_long) s_name_data.max_life));
- lifetime = min(lifetime, ((u_long) a_name_data.max_life));
-
-#ifdef NOENCRYPTION
- bzero(session_key, sizeof(C_Block));
-#else
- random_key(session_key);
-#endif
- /* unseal server's key from master key */
- bcopy(&s_name_data.key_low, key, 4);
- bcopy(&s_name_data.key_high, ((long *) key) + 1, 4);
- kdb_encrypt_key(key, key, master_key,
- master_key_schedule, DECRYPT);
- /* construct and seal the ticket */
- krb_create_ticket(tk, k_flags, a_name_data.name,
- a_name_data.instance, local_realm,
- client_host.s_addr, session_key, lifetime, kerb_time.tv_sec,
- s_name_data.name, s_name_data.instance, key);
- bzero(key, sizeof(key));
- bzero(key_s, sizeof(key_s));
-
- /*
- * get the user's key, unseal it from the server's key, and
- * use it to seal the cipher
- */
-
- /* a_name_data.key_low a_name_data.key_high */
- bcopy(&a_name_data.key_low, key, 4);
- bcopy(&a_name_data.key_high, ((long *) key) + 1, 4);
-
- /* unseal the a_name key from the master key */
- kdb_encrypt_key(key, key, master_key,
- master_key_schedule, DECRYPT);
-
- create_ciph(ciph, session_key, s_name_data.name,
- s_name_data.instance, local_realm, lifetime,
- s_name_data.key_version, tk, kerb_time.tv_sec, key);
-
- /* clear session key */
- bzero(session_key, sizeof(session_key));
-
- bzero(key, sizeof(key));
-
-
-
- /* always send a reply packet */
- rpkt = create_auth_reply(req_name_ptr, req_inst_ptr,
- req_realm_ptr, req_time_ws, 0, a_name_data.exp_date,
- a_name_data.key_version, ciph);
- sendto(f, rpkt->dat, rpkt->length, 0, (struct sockaddr *) client,
- S_AD_SZ);
- bzero(&a_name_data, sizeof(a_name_data));
- bzero(&s_name_data, sizeof(s_name_data));
- break;
- }
- case AUTH_MSG_APPL_REQUEST:
- {
- u_long time_ws; /* Workstation time */
- u_long req_life; /* Requested liftime */
- char *service; /* Service name */
- char *instance; /* Service instance */
- int kerno; /* Kerberos error number */
- char tktrlm[REALM_SZ];
-
- n_appl_req++;
- tk->length = 0;
- k_flags = 0; /* various kerberos flags */
-
- auth->length = 4 + strlen(pkt->dat + 3);
- auth->length += (int) *(pkt->dat + auth->length) +
- (int) *(pkt->dat + auth->length + 1) + 2;
-
- bcopy(pkt->dat, auth->dat, auth->length);
-
- strncpy(tktrlm, auth->dat + 3, REALM_SZ);
- if (set_tgtkey(tktrlm)) {
- lt = klog(L_ERR_UNK,
- "FAILED realm %s unknown. Host: %s ",
- tktrlm, inet_ntoa(client_host));
- kerb_err_reply(client, pkt, kerno, lt);
- return;
- }
- kerno = krb_rd_req(auth, "ktbtgt", tktrlm, client_host.s_addr,
- ad, 0);
-
- if (kerno) {
- klog(L_ERR_UNK, "FAILED krb_rd_req from %s: %s",
- inet_ntoa(client_host), krb_err_txt[kerno]);
- kerb_err_reply(client, pkt, kerno, "krb_rd_req failed");
- return;
- }
- ptr = (char *) pkt->dat + auth->length;
-
- bcopy(ptr, &time_ws, 4);
- ptr += 4;
-
- req_life = (u_long) (*ptr++);
-
- service = ptr;
- instance = ptr + strlen(service) + 1;
-
- klog(L_APPL_REQ, "APPL Request %s.%s@%s on %s for %s.%s",
- ad->pname, ad->pinst, ad->prealm, inet_ntoa(client_host),
- service, instance, 0);
-
- if (strcmp(ad->prealm, tktrlm)) {
- kerb_err_reply(client, pkt, KERB_ERR_PRINCIPAL_UNKNOWN,
- "Can't hop realms");
- return;
- }
- if (!strcmp(service, "changepw")) {
- kerb_err_reply(client, pkt, KERB_ERR_PRINCIPAL_UNKNOWN,
- "Can't authorize password changed based on TGT");
- return;
- }
- kerno = check_princ(service, instance, req_life,
- &s_name_data);
- if (kerno) {
- kerb_err_reply(client, pkt, kerno, lt);
- return;
- }
- /* Bound requested lifetime with service and user */
- lifetime = min(req_life,
- (ad->life - ((kerb_time.tv_sec - ad->time_sec) / 300)));
- lifetime = min(lifetime, ((u_long) s_name_data.max_life));
-
- /* unseal server's key from master key */
- bcopy(&s_name_data.key_low, key, 4);
- bcopy(&s_name_data.key_high, ((long *) key) + 1, 4);
- kdb_encrypt_key(key, key, master_key,
- master_key_schedule, DECRYPT);
- /* construct and seal the ticket */
-
-#ifdef NOENCRYPTION
- bzero(session_key, sizeof(C_Block));
-#else
- random_key(session_key);
-#endif
-
- krb_create_ticket(tk, k_flags, ad->pname, ad->pinst,
- ad->prealm, client_host.s_addr,
- session_key, lifetime, kerb_time.tv_sec,
- s_name_data.name, s_name_data.instance,
- key);
- bzero(key, sizeof(key));
- bzero(key_s, sizeof(key_s));
-
- create_ciph(ciph, session_key, service, instance,
- local_realm,
- lifetime, s_name_data.key_version, tk,
- kerb_time.tv_sec, ad->session);
-
- /* clear session key */
- bzero(session_key, sizeof(session_key));
-
- bzero(ad->session, sizeof(ad->session));
-
- rpkt = create_auth_reply(ad->pname, ad->pinst,
- ad->prealm, time_ws,
- 0, 0, 0, ciph);
- sendto(f, rpkt->dat, rpkt->length, 0, (struct sockaddr *) client,
- S_AD_SZ);
- bzero(&s_name_data, sizeof(s_name_data));
- break;
- }
-
-
-#ifdef notdef_DIE
- case AUTH_MSG_DIE:
- {
- lt = klog(L_DEATH_REQ,
- "Host: %s User: \"%s\" \"%s\" Kerberos killed",
- inet_ntoa(client_host), req_name_ptr, req_inst_ptr, 0);
- exit(0);
- }
-#endif notdef_DIE
-
- default:
- {
- lt = klog(L_KRB_PERR,
- "Unknown message type: %d from %s port %u",
- req_msg_type, inet_ntoa(client_host),
- ntohs(client->sin_port));
- break;
- }
- }
-}
-
-
-/*
- * setup_disc
- *
- * disconnect all descriptors, remove ourself from the process
- * group that spawned us.
- */
-
-void
-setup_disc()
-{
-
- int s;
-
- for (s = 0; s < 3; s++) {
- (void) close(s);
- }
-
- (void) open("/dev/null", 0);
- (void) dup2(0, 1);
- (void) dup2(0, 2);
-
- s = open("/dev/tty", 2);
-
- if (s >= 0) {
- ioctl(s, TIOCNOTTY, (struct sgttyb *) 0);
- (void) close(s);
- }
- (void) chdir("/tmp");
-}
-
-
-/*
- * kerb_er_reply creates an error reply packet and sends it to the
- * client.
- */
-
-void
-kerb_err_reply(client, pkt, err, string)
- struct sockaddr_in *client;
- KTEXT pkt;
- long err;
- char *string;
-
-{
- static KTEXT_ST e_pkt_st;
- KTEXT e_pkt = &e_pkt_st;
- static char e_msg[128];
-
- strcpy(e_msg, "\nKerberos error -- ");
- strcat(e_msg, string);
- cr_err_reply(e_pkt, req_name_ptr, req_inst_ptr, req_realm_ptr,
- req_time_ws, err, e_msg);
- sendto(f, e_pkt->dat, e_pkt->length, 0, (struct sockaddr *) client,
- S_AD_SZ);
-
-}
-
-/*
- * Make sure that database isn't stale.
- *
- * Exit if it is; we don't want to tell lies.
- */
-
-static void check_db_age()
-{
- long age;
-
- if (max_age != -1) {
- /* Requires existance of kerb_get_db_age() */
- gettimeofday(&kerb_time, 0);
- age = kerb_get_db_age();
- if (age == 0) {
- klog(L_KRB_PERR, "Database currently being updated!");
- hang();
- }
- if ((age + max_age) < kerb_time.tv_sec) {
- klog(L_KRB_PERR, "Database out of date!");
- hang();
- /* NOTREACHED */
- }
- }
-}
-
-int
-check_princ(p_name, instance, lifetime, p)
- char *p_name;
- char *instance;
- unsigned lifetime;
-
- Principal *p;
-{
- static int n;
- static int more;
-
- n = kerb_get_principal(p_name, instance, p, 1, &more);
- klog(L_ALL_REQ,
- "Principal: \"%s\", Instance: \"%s\" Lifetime = %d n = %d",
- p_name, instance, lifetime, n, 0);
-
- if (n < 0) {
- lt = klog(L_KRB_PERR, "Database unavailable!");
- hang();
- }
-
- /*
- * if more than one p_name, pick one, randomly create a session key,
- * compute maximum lifetime, lookup authorizations if applicable,
- * and stuff into cipher.
- */
- if (n == 0) {
- /* service unknown, log error, skip to next request */
- lt = klog(L_ERR_UNK, "UNKNOWN \"%s\" \"%s\"", p_name,
- instance, 0);
- return KERB_ERR_PRINCIPAL_UNKNOWN;
- }
- if (more) {
- /* not unique, log error */
- lt = klog(L_ERR_NUN, "Principal NOT UNIQUE \"%s\" \"%s\"",
- p_name, instance, 0);
- return KERB_ERR_PRINCIPAL_NOT_UNIQUE;
- }
- /* If the user's key is null, we want to return an error */
- if ((p->key_low == 0) && (p->key_high == 0)) {
- /* User has a null key */
- lt = klog(L_ERR_NKY, "Null key \"%s\" \"%s\"", p_name,
- instance, 0);
- return KERB_ERR_NULL_KEY;
- }
- if (master_key_version != p->kdc_key_ver) {
- /* log error reply */
- lt = klog(L_ERR_MKV,
- "Key vers incorrect, KRB = %d, \"%s\" \"%s\" = %d",
- master_key_version, p->name, p->instance, p->kdc_key_ver,
- 0);
- return KERB_ERR_NAME_MAST_KEY_VER;
- }
- /* make sure the service hasn't expired */
- if ((u_long) p->exp_date < (u_long) kerb_time.tv_sec) {
- /* service did expire, log it */
- lt = klog(L_ERR_SEXP,
- "EXPIRED \"%s\" \"%s\" %s", p->name, p->instance,
- stime(&(p->exp_date)), 0);
- return KERB_ERR_NAME_EXP;
- }
- /* ok is zero */
- return 0;
-}
-
-
-/* Set the key for krb_rd_req so we can check tgt */
-int
-set_tgtkey(r)
- char *r; /* Realm for desired key */
-{
- int n;
- static char lastrealm[REALM_SZ];
- Principal p_st;
- Principal *p = &p_st;
- C_Block key;
-
- if (!strcmp(lastrealm, r))
- return (KSUCCESS);
-
- log("Getting key for %s", r);
-
- n = kerb_get_principal("krbtgt", r, p, 1, &more);
- if (n == 0)
- return (KFAILURE);
-
- /* unseal tgt key from master key */
- bcopy(&p->key_low, key, 4);
- bcopy(&p->key_high, ((long *) key) + 1, 4);
- kdb_encrypt_key(key, key, master_key,
- master_key_schedule, DECRYPT);
- krb_set_key(key, 0);
- strcpy(lastrealm, r);
- return (KSUCCESS);
-}
-
-static void
-hang()
-{
- if (pause_int == -1) {
- klog(L_KRB_PERR, "Kerberos will pause so as not to loop init");
- for (;;)
- pause();
- } else {
- char buf[256];
- sprintf(buf, "Kerberos will wait %ld seconds before dying so as not to loop init", pause_int);
- klog(L_KRB_PERR, buf);
- sleep(pause_int);
- klog(L_KRB_PERR, "Do svedania....\n");
- exit(1);
- }
-}
diff --git a/eBones/kinit/Makefile b/eBones/kinit/Makefile
deleted file mode 100644
index 884f37d..0000000
--- a/eBones/kinit/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# From: @(#)Makefile 5.1 (Berkeley) 6/25/90
-# $Id: Makefile,v 1.3 1995/07/18 16:37:53 mark Exp $
-
-PROG= kinit
-CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -DBSD42 -Wall
-DPADD= ${LIBKRB} ${LIBDES}
-LDADD= -L${KRBOBJDIR} -lkrb -ldes
-BINDIR= /usr/bin
-MAN1= kinit.1
-
-.include <bsd.prog.mk>
diff --git a/eBones/kinit/kinit.c b/eBones/kinit/kinit.c
deleted file mode 100644
index 3b47c7c..0000000
--- a/eBones/kinit/kinit.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * Routine to initialize user to Kerberos. Prompts optionally for
- * user, instance and realm. Authenticates user and gets a ticket
- * for the Kerberos ticket-granting service for future use.
- *
- * Options are:
- *
- * -i[instance]
- * -r[realm]
- * -v[erbose]
- * -l[ifetime]
- *
- * from: kinit.c,v 4.12 90/03/20 16:11:15 jon Exp $
- * $Id: kinit.c,v 1.4 1995/08/03 17:16:00 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: kinit.c,v 1.4 1995/08/03 17:16:00 mark Exp $";
-#endif lint
-#endif
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <pwd.h>
-#include <krb.h>
-
-#ifndef ORGANIZATION
-#define ORGANIZATION "MIT Project Athena"
-#endif /*ORGANIZATION*/
-
-#ifdef PC
-#define LEN 64 /* just guessing */
-#endif PC
-
-#if defined(BSD42) || defined(__FreeBSD__) || defined(__NetBSD__)
-#include <strings.h>
-#include <sys/param.h>
-#if defined(ultrix) || defined(sun)
-#define LEN 64
-#else
-#define LEN MAXHOSTNAMELEN
-#endif /* defined(ultrix) || defined(sun) */
-#endif /* BSD42 */
-
-#define LIFE 96 /* lifetime of ticket in 5-minute units */
-
-char *progname;
-
-void usage(void);
-
-void
-get_input(s, size, stream)
-char *s;
-int size;
-FILE *stream;
-{
- char *p;
-
- if (fgets(s, size, stream) == NULL)
- exit(1);
- if ((p = index(s, '\n')) != NULL)
- *p = '\0';
-}
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- char aname[ANAME_SZ];
- char inst[INST_SZ];
- char realm[REALM_SZ];
- char buf[LEN];
- char *username = NULL;
- int iflag, rflag, vflag, lflag, lifetime, k_errno;
- register char *cp;
- register i;
-
- *inst = *realm = '\0';
- iflag = rflag = vflag = lflag = 0;
- lifetime = LIFE;
- progname = (cp = rindex(*argv, '/')) ? cp + 1 : *argv;
-
- while (--argc) {
- if ((*++argv)[0] != '-') {
- if (username)
- usage();
- username = *argv;
- continue;
- }
- for (i = 1; (*argv)[i] != '\0'; i++)
- switch ((*argv)[i]) {
- case 'i': /* Instance */
- ++iflag;
- continue;
- case 'r': /* Realm */
- ++rflag;
- continue;
- case 'v': /* Verbose */
- ++vflag;
- continue;
- case 'l':
- ++lflag;
- continue;
- default:
- usage();
- exit(1);
- }
- }
- if (username &&
- (k_errno = kname_parse(aname, inst, realm, username))
- != KSUCCESS) {
- fprintf(stderr, "%s: %s\n", progname, krb_err_txt[k_errno]);
- iflag = rflag = 1;
- username = NULL;
- }
- if (k_gethostname(buf, LEN)) {
- fprintf(stderr, "%s: k_gethostname failed\n", progname);
- exit(1);
- }
- printf("%s (%s)\n", ORGANIZATION, buf);
- if (username) {
- printf("Kerberos Initialization for \"%s", aname);
- if (*inst)
- printf(".%s", inst);
- if (*realm)
- printf("@%s", realm);
- printf("\"\n");
- } else {
- if (iflag) {
- printf("Kerberos Initialization\n");
- printf("Kerberos name: ");
- get_input(aname, sizeof(aname), stdin);
- } else {
- int uid = getuid();
- char *getenv();
- struct passwd *pwd;
-
- /* default to current user name unless running as root */
- if (uid == 0 && (username = getenv("USER")) &&
- strcmp(username, "root") != 0) {
- strncpy(aname, username, sizeof(aname));
- strncpy(inst, "root", sizeof(inst));
- } else {
- pwd = getpwuid(uid);
-
- if (pwd == (struct passwd *) NULL) {
- fprintf(stderr, "Unknown name for your uid\n");
- printf("Kerberos name: ");
- gets(aname);
- } else
- strncpy(aname, pwd->pw_name, sizeof(aname));
- }
- }
-
- if (!*aname)
- exit(0);
- if (!k_isname(aname)) {
- fprintf(stderr, "%s: bad Kerberos name format\n",
- progname);
- exit(1);
- }
- }
- /* optional instance */
- if (iflag) {
- printf("Kerberos instance: ");
- get_input(inst, sizeof(inst), stdin);
- if (!k_isinst(inst)) {
- fprintf(stderr, "%s: bad Kerberos instance format\n",
- progname);
- exit(1);
- }
- }
- if (rflag) {
- printf("Kerberos realm: ");
- get_input(realm, sizeof(realm), stdin);
- if (!k_isrealm(realm)) {
- fprintf(stderr, "%s: bad Kerberos realm format\n",
- progname);
- exit(1);
- }
- }
- if (lflag) {
- printf("Kerberos ticket lifetime (minutes): ");
- get_input(buf, sizeof(buf), stdin);
- lifetime = atoi(buf);
- if (lifetime < 5)
- lifetime = 1;
- else
- lifetime /= 5;
- /* This should be changed if the maximum ticket lifetime */
- /* changes */
- if (lifetime > 255)
- lifetime = 255;
- }
- if (!*realm && krb_get_lrealm(realm, 1)) {
- fprintf(stderr, "%s: krb_get_lrealm failed\n", progname);
- exit(1);
- }
- k_errno = krb_get_pw_in_tkt(aname, inst, realm, "krbtgt", realm,
- lifetime, 0);
- if (vflag) {
- printf("Kerberos realm %s:\n", realm);
- printf("%s\n", krb_err_txt[k_errno]);
- } else if (k_errno) {
- fprintf(stderr, "%s: %s\n", progname, krb_err_txt[k_errno]);
- exit(1);
- }
- return 0;
-}
-
-void
-usage()
-{
- fprintf(stderr, "Usage: %s [-irvl] [name]\n", progname);
- exit(1);
-}
diff --git a/eBones/klist/Makefile b/eBones/klist/Makefile
deleted file mode 100644
index c24800b..0000000
--- a/eBones/klist/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# From: @(#)Makefile 5.1 (Berkeley) 6/25/90
-# $Id: Makefile,v 1.3 1995/07/18 16:37:57 mark Exp $
-
-PROG= klist
-CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -Wall
-DPADD= ${LIBKRB} ${LIBDES}
-LDADD= -L${KRBOBJDIR} -lkrb -ldes
-BINDIR= /usr/bin
-MAN1= klist.1
-
-.include <bsd.prog.mk>
diff --git a/eBones/klist/klist.1 b/eBones/klist/klist.1
deleted file mode 100644
index af7e31a..0000000
--- a/eBones/klist/klist.1
+++ /dev/null
@@ -1,84 +0,0 @@
-.\" from: klist.1,v 4.8 89/01/24 14:35:09 jtkohl Exp $
-.\" $Id: klist.1,v 1.1.1.1 1994/09/30 14:50:06 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KLIST 1 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-klist \- list currently held Kerberos tickets
-.SH SYNOPSIS
-.B klist
-[
-\fB\-s \fR|\fB \-t\fR
-] [
-.B \-file
-name ] [
-.B \-srvtab
-]
-.br
-.SH DESCRIPTION
-.I klist
-prints the name of the tickets file and the
-identity of the principal the tickets are for (as listed in the
-tickets file), and
-lists the principal names of all Kerberos tickets currently held by
-the user, along with the issue and expire time for each authenticator.
-Principal names are listed in the form
-.I name.instance@realm,
-with the '.' omitted if the instance is null,
-and the '@' omitted if the realm is null.
-
-If given the
-.B \-s
-option,
-.I klist
-does not print the issue and expire times, the name of the tickets file,
-or the identity of the principal.
-
-If given the
-.B \-t
-option,
-.B klist
-checks for the existence of a non-expired ticket-granting-ticket in the
-ticket file. If one is present, it exits with status 0, else it exits
-with status 1. No output is generated when this option is specified.
-
-If given the
-.B \-file
-option, the following argument is used as the ticket file.
-Otherwise, if the
-.B KRBTKFILE
-environment variable is set, it is used.
-If this environment variable
-is not set, the file
-.B /tmp/tkt[uid]
-is used, where
-.B uid
-is the current user-id of the user.
-
-If given the
-.B \-srvtab
-option, the file is treated as a service key file, and the names of the
-keys contained therein are printed. If no file is
-specified with a
-.B \-file
-option, the default is
-.IR /etc/kerberosIV/srvtab .
-.SH FILES
-.TP 2i
-/etc/kerberosIV/krb.conf
-to get the name of the local realm
-.TP
-/tmp/tkt[uid]
-as the default ticket file ([uid] is the decimal UID of the user).
-.TP
-/etc/kerberosIV/srvtab
-as the default service key file
-.SH SEE ALSO
-.PP
-kerberos(1), kinit(1), kdestroy(1)
-.SH BUGS
-When reading a file as a service key file, very little sanity or error
-checking is performed.
diff --git a/eBones/klist/klist.c b/eBones/klist/klist.c
deleted file mode 100644
index 0927dcb..0000000
--- a/eBones/klist/klist.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * Lists your current Kerberos tickets.
- * Written by Bill Sommerfeld, MIT Project Athena.
- *
- * from: klist.c,v 4.15 89/08/30 11:19:16 jtkohl Exp $
- * $Id: klist.c,v 1.3 1995/07/18 16:37:59 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: klist.c,v 1.3 1995/07/18 16:37:59 mark Exp $";
-#endif lint
-#endif
-
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <sys/file.h>
-#include <krb.h>
-#include <prot.h>
-#include <time.h>
-
-int ok_getst(int fd, char *s, int n);
-void display_srvtab(char *file);
-char *short_date(long *dp);
-void usage(void);
-void display_tktfile(char *file, int tgt_test, int long_form);
-
-char *whoami; /* What was I invoked as?? */
-
-extern char *krb_err_txt[];
-
-/* ARGSUSED */
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- int long_form = 1;
- int tgt_test = 0;
- int do_srvtab = 0;
- char *tkt_file = NULL;
- char *cp;
-
- whoami = (cp = rindex(*argv, '/')) ? cp + 1 : *argv;
-
- while (*(++argv)) {
- if (!strcmp(*argv, "-s")) {
- long_form = 0;
- continue;
- }
- if (!strcmp(*argv, "-t")) {
- tgt_test = 1;
- long_form = 0;
- continue;
- }
- if (!strcmp(*argv, "-l")) { /* now default */
- continue;
- }
- if (!strcmp(*argv, "-file")) {
- if (*(++argv)) {
- tkt_file = *argv;
- continue;
- } else
- usage();
- }
- if (!strcmp(*argv, "-srvtab")) {
- if (tkt_file == NULL) /* if no other file spec'ed,
- set file to default srvtab */
- tkt_file = KEYFILE;
- do_srvtab = 1;
- continue;
- }
- usage();
- }
-
- if (do_srvtab)
- display_srvtab(tkt_file);
- else
- display_tktfile(tkt_file, tgt_test, long_form);
- exit(0);
-}
-
-void
-display_tktfile(file, tgt_test, long_form)
-char *file;
-int tgt_test, long_form;
-{
- char pname[ANAME_SZ];
- char pinst[INST_SZ];
- char prealm[REALM_SZ];
- char buf1[20], buf2[20];
- int k_errno;
- CREDENTIALS c;
- int header = 1;
-
- if ((file == NULL) && ((file = getenv("KRBTKFILE")) == NULL))
- file = TKT_FILE;
-
- if (long_form)
- printf("Ticket file: %s\n", file);
-
- /*
- * Since krb_get_tf_realm will return a ticket_file error,
- * we will call tf_init and tf_close first to filter out
- * things like no ticket file. Otherwise, the error that
- * the user would see would be
- * klist: can't find realm of ticket file: No ticket file (tf_util)
- * instead of
- * klist: No ticket file (tf_util)
- */
-
- /* Open ticket file */
- if ((k_errno = tf_init(file, R_TKT_FIL))) {
- if (!tgt_test)
- fprintf(stderr, "%s: %s\n", whoami, krb_err_txt[k_errno]);
- exit(1);
- }
- /* Close ticket file */
- (void) tf_close();
-
- /*
- * We must find the realm of the ticket file here before calling
- * tf_init because since the realm of the ticket file is not
- * really stored in the principal section of the file, the
- * routine we use must itself call tf_init and tf_close.
- */
- if ((k_errno = krb_get_tf_realm(file, prealm)) != KSUCCESS) {
- if (!tgt_test)
- fprintf(stderr, "%s: can't find realm of ticket file: %s\n",
- whoami, krb_err_txt[k_errno]);
- exit(1);
- }
-
- /* Open ticket file */
- if ((k_errno = tf_init(file, R_TKT_FIL))) {
- if (!tgt_test)
- fprintf(stderr, "%s: %s\n", whoami, krb_err_txt[k_errno]);
- exit(1);
- }
- /* Get principal name and instance */
- if ((k_errno = tf_get_pname(pname)) ||
- (k_errno = tf_get_pinst(pinst))) {
- if (!tgt_test)
- fprintf(stderr, "%s: %s\n", whoami, krb_err_txt[k_errno]);
- exit(1);
- }
-
- /*
- * You may think that this is the obvious place to get the
- * realm of the ticket file, but it can't be done here as the
- * routine to do this must open the ticket file. This is why
- * it was done before tf_init.
- */
-
- if (!tgt_test && long_form)
- printf("Principal:\t%s%s%s%s%s\n\n", pname,
- (pinst[0] ? "." : ""), pinst,
- (prealm[0] ? "@" : ""), prealm);
- while ((k_errno = tf_get_cred(&c)) == KSUCCESS) {
- if (!tgt_test && long_form && header) {
- printf("%-15s %-15s %s\n",
- " Issued", " Expires", " Principal");
- header = 0;
- }
- if (tgt_test) {
- c.issue_date += ((unsigned char) c.lifetime) * 5 * 60;
- if (!strcmp(c.service, TICKET_GRANTING_TICKET) &&
- !strcmp(c.instance, prealm)) {
- if (time(0) < c.issue_date)
- exit(0); /* tgt hasn't expired */
- else
- exit(1); /* has expired */
- }
- continue; /* not a tgt */
- }
- if (long_form) {
- (void) strcpy(buf1, short_date(&c.issue_date));
- c.issue_date += ((unsigned char) c.lifetime) * 5 * 60;
- (void) strcpy(buf2, short_date(&c.issue_date));
- printf("%s %s ", buf1, buf2);
- }
- printf("%s%s%s%s%s\n",
- c.service, (c.instance[0] ? "." : ""), c.instance,
- (c.realm[0] ? "@" : ""), c.realm);
- }
- if (tgt_test)
- exit(1); /* no tgt found */
- if (header && long_form && k_errno == EOF) {
- printf("No tickets in file.\n");
- }
-}
-
-char *
-short_date(dp)
- long *dp;
-{
- register char *cp;
- extern char *ctime();
- cp = ctime(dp) + 4;
- cp[15] = '\0';
- return (cp);
-}
-
-void
-usage()
-{
- fprintf(stderr,
- "Usage: %s [ -s | -t ] [ -file filename ] [ -srvtab ]\n", whoami);
- exit(1);
-}
-
-void
-display_srvtab(file)
-char *file;
-{
- int stab;
- char serv[SNAME_SZ];
- char inst[INST_SZ];
- char rlm[REALM_SZ];
- unsigned char key[8];
- unsigned char vno;
- int count;
-
- printf("Server key file: %s\n", file);
-
- if ((stab = open(file, O_RDONLY, 0400)) < 0) {
- perror(file);
- exit(1);
- }
- printf("%-15s %-15s %-10s %s\n","Service","Instance","Realm",
- "Key Version");
- printf("------------------------------------------------------\n");
-
- /* argh. getst doesn't return error codes, it silently fails */
- while (((count = ok_getst(stab, serv, SNAME_SZ)) > 0)
- && ((count = ok_getst(stab, inst, INST_SZ)) > 0)
- && ((count = ok_getst(stab, rlm, REALM_SZ)) > 0)) {
- if (((count = read(stab,(char *) &vno,1)) != 1) ||
- ((count = read(stab,(char *) key,8)) != 8)) {
- if (count < 0)
- perror("reading from key file");
- else
- fprintf(stderr, "key file truncated\n");
- exit(1);
- }
- printf("%-15s %-15s %-15s %d\n",serv,inst,rlm,vno);
- }
- if (count < 0)
- perror(file);
- (void) close(stab);
-}
-
-/* adapted from getst() in librkb */
-/*
- * ok_getst() takes a file descriptor, a string and a count. It reads
- * from the file until either it has read "count" characters, or until
- * it reads a null byte. When finished, what has been read exists in
- * the given string "s". If "count" characters were actually read, the
- * last is changed to a null, so the returned string is always null-
- * terminated. ok_getst() returns the number of characters read, including
- * the null terminator.
- *
- * If there is a read error, it returns -1 (like the read(2) system call)
- */
-
-int
-ok_getst(fd, s, n)
- int fd;
- register char *s;
- int n;
-{
- register count = n;
- int err;
- while ((err = read(fd, s, 1)) > 0 && --count)
- if (*s++ == '\0')
- return (n - count);
- if (err < 0)
- return(-1);
- *s = '\0';
- return (n - count);
-}
diff --git a/eBones/kprop/Makefile b/eBones/kprop/Makefile
deleted file mode 100644
index 636eaa4..0000000
--- a/eBones/kprop/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# From: @(#)Makefile 5.1 (Berkeley) 6/25/90
-# $Id: Makefile,v 1.1.1.1 1995/08/03 07:36:18 mark Exp $
-
-PROG= kprop
-CFLAGS+=-I${.CURDIR}/../include -Wall
-DPADD= ${LIBKRB}
-LDADD= -L${KRBOBJDIR} -lkrb -ldes
-BINDIR= /usr/sbin
-NOMAN= noman
-
-.include <bsd.prog.mk>
diff --git a/eBones/kprop/kprop.c b/eBones/kprop/kprop.c
deleted file mode 100644
index 23bb893..0000000
--- a/eBones/kprop/kprop.c
+++ /dev/null
@@ -1,637 +0,0 @@
-/*
- *
- * Copyright 1987 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information,
- * please see the file <mit-copyright.h>.
- *
- * $Revision: 1.1.1.1 $
- * $Date: 1995/08/03 07:36:18 $
- * $State: Exp $
- * $Source: /usr/cvs/src/eBones/kprop/kprop.c,v $
- * $Author: mark $
- * $Locker: $
- *
- * $Log: kprop.c,v $
- * Revision 1.1.1.1 1995/08/03 07:36:18 mark
- * Import an updated revision of the MIT kprop program for distributing
- * kerberos databases to slave servers.
- *
- * NOTE: This method was abandoned by MIT long ago, this code is close to
- * garbage, but it is slightly more secure than using rdist.
- * There is no documentation available on how to use it, and
- * it should -not- be built by default.
- *
- * Obtained from: MIT Project Athena
- *
- * Revision 1.1.1.1 1995/08/02 22:11:44 pst
- * Import an updated revision of the MIT kprop program for distributing
- * kerberos databases to slave servers.
- *
- * NOTE: This method was abandoned by MIT long ago, this code is close to
- * garbage, but it is slightly more secure than using rdist.
- * There is no documentation available on how to use it, and
- * it should -not- be built by default.
- *
- * Obtained from: MIT Project Athena
- *
- * Revision 4.7 92/11/10 23:01:06 tytso
- * Removed incompatible #include
- *
- * Revision 4.6 91/02/28 22:49:34 probe
- * Fixed header file inclusion
- *
- * Revision 4.5 90/03/20 15:37:57 jon
- * Stop kpropd port number from being bashed (static buffers)
- * Programmer: jtkohl
- * Auditor: jon
- *
- * Revision 4.4 90/01/02 13:42:40 jtkohl
- * add back in accidentally deleted $ in rcsid string
- *
- * Revision 4.3 89/12/30 21:22:27 qjb
- * Added #define MAXHOSTNAMELEN if not already defined for the benifit
- * of Unixes that don't have this variable in sys/param.h.
- *
- * Revision 4.2 89/03/23 10:23:43 jtkohl
- * fix misuse of mkstemp to use mktemp
- * NOENCRYPTION changes
- *
- * Revision 4.1 89/01/24 20:35:17 root
- * name change
- *
- * Revision 4.0 89/01/24 18:44:38 wesommer
- * Original version; programmer: wesommer
- * auditor: jon.
- *
- * Revision 4.4 88/01/08 18:05:21 jon
- * formating changes and rcs header info
- *
- *
- */
-
-#if 0
-#ifndef lint
-static char rcsid_kprop_c[] =
-"$Id: kprop.c,v 1.1.1.1 1995/08/03 07:36:18 mark Exp $";
-#endif lint
-#endif
-
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/param.h>
-#include <netdb.h>
-#include <krb.h>
-#include <des.h>
-
-#include "kprop.h"
-
-/* for those broken Unixes without this defined... should be in sys/param.h */
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 64
-#endif
-
-static char kprop_version[KPROP_PROT_VERSION_LEN] = KPROP_PROT_VERSION;
-
-int debug = 0;
-
-char my_realm[REALM_SZ];
-int princ_data_size = 3 * sizeof(long) + 3 * sizeof(unsigned char);
-short transfer_mode, net_transfer_mode;
-int force_flag;
-static char ok[] = ".dump_ok";
-
-extern char *krb_get_phost(char *);
-
-struct slave_host {
- u_long net_addr;
- char *name;
- char *instance;
- char *realm;
- int not_time_yet;
- int succeeded;
- struct slave_host *next;
-};
-
-void Death(char *s);
-int get_slaves(struct slave_host **psl, char *file, time_t ok_mtime);
-int prop_to_slaves(struct slave_host *sl, int fd, char *fslv);
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- int fd, i;
- char *floc, *floc_ok;
- char *fslv;
- struct stat stbuf, stbuf_ok;
- long l_init, l_final;
- char *pc;
- int l_diff;
- static struct slave_host *slave_host_list = NULL;
- struct slave_host *sh;
-
- transfer_mode = KPROP_TRANSFER_PRIVATE;
-
- time(&l_init);
- pc = ctime(&l_init);
- pc[strlen(pc) - 1] = '\0';
- printf("\nStart slave propagation: %s\n", pc);
-
- floc = (char *) NULL;
- fslv = (char *) NULL;
-
- if (krb_get_lrealm(my_realm,1) != KSUCCESS)
- Death ("Getting my kerberos realm. Check krb.conf");
-
- for (i = 1; i < argc; i++)
- switch (argv[i][0]) {
- case '-':
- if (strcmp (argv[i], "-private") == 0)
- transfer_mode = KPROP_TRANSFER_PRIVATE;
-#ifdef not_safe_yet
- else if (strcmp (argv[i], "-safe") == 0)
- transfer_mode = KPROP_TRANSFER_SAFE;
- else if (strcmp (argv[i], "-clear") == 0)
- transfer_mode = KPROP_TRANSFER_CLEAR;
-#endif
- else if (strcmp (argv[i], "-realm") == 0) {
- i++;
- if (i < argc)
- strcpy(my_realm, argv[i]);
- else
- goto usage;
- } else if (strcmp (argv[i], "-force") == 0)
- force_flag++;
- else {
- fprintf (stderr, "kprop: unknown control argument %s.\n",
- argv[i]);
- exit (1);
- }
- break;
- default:
- /* positional arguments are marginal at best ... */
- if (floc == (char *) NULL)
- floc = argv[i];
- else {
- if (fslv == (char *) NULL)
- fslv = argv[i];
- else {
- usage:
- /* already got floc and fslv, what is this? */
- fprintf(stderr,
- "\nUsage: kprop [-force] [-realm realm] [-private|-safe|-clear] data_file slaves_file\n\n");
- exit(1);
- }
- }
- }
- if ((floc == (char *)NULL) || (fslv == (char *)NULL))
- goto usage;
-
- if ((floc_ok = (char *) malloc(strlen(floc) + strlen(ok) + 1))
- == NULL) {
- Death(floc);
- }
- strcat(strcpy(floc_ok, floc), ok);
-
- if ((fd = open(floc, O_RDONLY)) < 0) {
- Death(floc);
- }
- if (flock(fd, LOCK_EX | LOCK_NB)) {
- Death(floc);
- }
- if (stat(floc, &stbuf)) {
- Death(floc);
- }
- if (stat(floc_ok, &stbuf_ok)) {
- Death(floc_ok);
- }
- if (stbuf.st_mtime > stbuf_ok.st_mtime) {
- fprintf(stderr, "kprop: '%s' more recent than '%s'.\n",
- floc, floc_ok);
- exit(1);
- }
- if (!get_slaves(&slave_host_list, fslv, stbuf_ok.st_mtime)) {
- fprintf(stderr,
- "kprop: can't read slave host file '%s'.\n", fslv);
- exit(1);
- }
-#ifdef KPROP_DBG
- {
- struct slave_host *sh;
- int i;
- fprintf(stderr, "\n\n");
- fflush(stderr);
- for (sh = slave_host_list; sh; sh = sh->next) {
- fprintf(stderr, "slave %d: %s, %s", i++, sh->name,
- inet_ntoa(sh->net_addr));
- fflush(stderr);
- }
- }
-#endif /* KPROP_DBG */
-
- if (!prop_to_slaves(slave_host_list, fd, fslv)) {
- fprintf(stderr,
- "kprop: propagation failed.\n");
- exit(1);
- }
- if (flock(fd, LOCK_UN)) {
- Death(floc);
- }
- fprintf(stderr, "\n\n");
- for (sh = slave_host_list; sh; sh = sh->next) {
- fprintf(stderr, "%s:\t\t%s\n", sh->name,
- (sh->not_time_yet? "Not time yet" : (sh->succeeded ? "Succeeded" : "FAILED")));
- }
-
- time(&l_final);
- l_diff = l_final - l_init;
- printf("propagation finished, %d:%02d:%02d elapsed\n",
- l_diff / 3600, (l_diff % 3600) / 60, l_diff % 60);
-
- exit(0);
-}
-
-void
-Death(s)
- char *s;
-{
- fprintf(stderr, "kprop: ");
- perror(s);
- exit(1);
-}
-
-/* The master -> slave protocol looks like this:
- 1) 8 byte version string
- 2) 2 bytes of "transfer mode" (net byte order of course)
- 3) ticket/authentication send by sendauth
- 4) 4 bytes of "block" length (u_long)
- 5) data
-
- 4 and 5 repeat til EOF ...
-*/
-
-int
-prop_to_slaves(sl, fd, fslv)
- struct slave_host *sl;
- int fd;
- char *fslv;
-{
- char buf[KPROP_BUFSIZ];
- char obuf[KPROP_BUFSIZ + 64 /* leave room for private msg overhead */ ];
- struct servent *sp;
- struct sockaddr_in sin, my_sin;
- int i, n, s;
- struct slave_host *cs; /* current slave */
- char path[256], my_host_name[MAXHOSTNAMELEN], *p_my_host_name;
- char kprop_service_instance[INST_SZ];
- char *pc;
- u_long cksum, get_data_checksum();
- u_long length, nlength;
- long kerror;
- KTEXT_ST ticket;
- CREDENTIALS cred;
- MSG_DAT msg_dat;
- static char tkstring[] = "/tmp/kproptktXXXXXX";
-
- Key_schedule session_sched;
-
- (void) mktemp(tkstring);
- krb_set_tkt_string(tkstring);
-
- if ((sp = getservbyname("krb_prop", "tcp")) == 0) {
- fprintf(stderr, "tcp/krb_prop: service unknown.\n");
- exit(1);
- }
-
- bzero(&sin, sizeof sin);
- sin.sin_family = AF_INET;
- sin.sin_port = sp->s_port;
-
- strcpy(path, fslv);
- if ((pc = rindex(path, '/'))) {
- pc += 1;
- } else {
- pc = path;
- }
-
- for (i = 0; i < 5; i++) { /* try each slave five times max */
- for (cs = sl; cs; cs = cs->next) {
- if (!cs->succeeded) {
- if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- perror("kprop: socket");
- exit(1);
- }
- bcopy(&cs->net_addr, &sin.sin_addr,
- sizeof cs->net_addr);
-
- if (connect(s, (struct sockaddr *) &sin, sizeof sin) < 0) {
- fprintf(stderr, "%s: ", cs->name);
- perror("connect");
- close(s);
- continue; /*** NEXT SLAVE ***/
- }
-
- /* for krb_mk_{priv, safe} */
- bzero (&my_sin, sizeof my_sin);
- n = sizeof my_sin;
- if (getsockname (s, (struct sockaddr *) &my_sin, &n) != 0) {
- fprintf (stderr, "kprop: can't get socketname.");
- perror ("getsockname");
- close (s);
- continue; /*** NEXT SLAVE ***/
- }
- if (n != sizeof (my_sin)) {
- fprintf (stderr, "kprop: can't get socketname. len");
- close (s);
- continue; /*** NEXT SLAVE ***/
- }
-
- /* Get ticket */
- kerror = krb_mk_req (&ticket, KPROP_SERVICE_NAME,
- cs->instance, cs->realm, (u_long) 0);
- /* if ticket has expired try to get a new one, but
- * first get a TGT ...
- */
- if (kerror != MK_AP_OK) {
- if (gethostname (my_host_name, sizeof(my_host_name)) != 0) {
- fprintf (stderr, "%s:", cs->name);
- perror ("getting my hostname");
- close (s);
- break; /* next one can't work either! */
- }
- /* get canonical kerberos service instance name */
- p_my_host_name = krb_get_phost (my_host_name);
- /* copy it to make sure gethostbyname static doesn't
- * screw us. */
- strcpy (kprop_service_instance, p_my_host_name);
- kerror = krb_get_svc_in_tkt (KPROP_SERVICE_NAME,
-#if 0
- kprop_service_instance,
-#else
- KRB_MASTER,
-#endif
- my_realm,
- TGT_SERVICE_NAME,
- my_realm,
- 96,
- KPROP_SRVTAB);
- if (kerror != INTK_OK) {
- fprintf (stderr,
- "%s: %s. While getting initial ticket\n",
- cs->name, krb_err_txt[kerror]);
- close (s);
- goto punt;
- }
- kerror = krb_mk_req (&ticket, KPROP_SERVICE_NAME,
- cs->instance, cs->realm, (u_long) 0);
- }
- if (kerror != MK_AP_OK) {
- fprintf (stderr, "%s: %s. Calling krb_mk_req.",
- cs->name, krb_err_txt[kerror]);
- close (s);
- continue; /*** NEXT SLAVE ***/
- }
-
- if (write(s, kprop_version, sizeof(kprop_version))
- != sizeof(kprop_version)) {
- fprintf (stderr, "%s: ", cs->name);
- perror ("write (version) error");
- close (s);
- continue; /*** NEXT SLAVE ***/
- }
-
- net_transfer_mode = htons (transfer_mode);
- if (write(s, &net_transfer_mode, sizeof(net_transfer_mode))
- != sizeof(net_transfer_mode)) {
- fprintf (stderr, "%s: ", cs->name);
- perror ("write (transfer_mode) error");
- close (s);
- continue; /*** NEXT SLAVE ***/
- }
-
- kerror = krb_get_cred (KPROP_SERVICE_NAME, cs->instance,
- cs->realm, &cred);
- if (kerror != KSUCCESS) {
- fprintf (stderr, "%s: %s. Getting session key.",
- cs->name, krb_err_txt[kerror]);
- close (s);
- continue; /*** NEXT SLAVE ***/
- }
-#ifdef NOENCRYPTION
- bzero((char *)session_sched, sizeof(session_sched));
-#else
- if (key_sched ((C_Block *)cred.session, session_sched)) {
- fprintf (stderr, "%s: can't make key schedule.",
- cs->name);
- close (s);
- continue; /*** NEXT SLAVE ***/
- }
-#endif
- /* SAFE (quad_cksum) and CLEAR are just not good enough */
- cksum = 0;
-#ifdef not_working_yet
- if (transfer_mode != KPROP_TRANSFER_PRIVATE) {
- cksum = get_data_checksum(fd, session_sched);
- lseek(fd, 0L, 0);
- }
- else
-#endif
- {
- struct stat st;
- fstat (fd, &st);
- cksum = st.st_size;
- }
- kerror = krb_sendauth(KOPT_DO_MUTUAL,
- s,
- &ticket,
- KPROP_SERVICE_NAME,
- cs->instance,
- cs->realm,
- cksum,
- &msg_dat,
- &cred,
- session_sched,
- &my_sin,
- &sin,
- KPROP_PROT_VERSION);
- if (kerror != KSUCCESS) {
- fprintf (stderr, "%s: %s. Calling krb_sendauth.",
- cs->name, krb_err_txt[kerror]);
- close (s);
- continue; /*** NEXT SLAVE ***/
- }
-
- while ((n = read(fd, buf, sizeof buf))) {
- if (n < 0) {
- perror("input file read error");
- exit(1);
- }
- switch (transfer_mode) {
- case KPROP_TRANSFER_PRIVATE:
- case KPROP_TRANSFER_SAFE:
- if (transfer_mode == KPROP_TRANSFER_PRIVATE)
- length = krb_mk_priv (buf, obuf, n,
- session_sched, cred.session,
- &my_sin, &sin);
- else
- length = krb_mk_safe (buf, obuf, n,
- (C_Block *)cred.session,
- &my_sin, &sin);
- if (length == -1) {
- fprintf (stderr, "%s: %s failed.",
- cs->name,
- (transfer_mode == KPROP_TRANSFER_PRIVATE)
- ? "krb_rd_priv" : "krb_rd_safe");
- close (s);
- continue; /*** NEXT SLAVE ***/
- }
- nlength = htonl(length);
- if (write(s, &nlength, sizeof nlength)
- != sizeof nlength) {
- fprintf (stderr, "%s: ", cs->name);
- perror ("write error");
- close (s);
- continue; /*** NEXT SLAVE ***/
- }
- if (write(s, obuf, length) != length) {
- fprintf(stderr, "%s: ", cs->name);
- perror("write error");
- close(s);
- continue; /*** NEXT SLAVE ***/
- }
- break;
- case KPROP_TRANSFER_CLEAR:
- if (write(s, buf, n) != n) {
- fprintf(stderr, "%s: ", cs->name);
- perror("write error");
- close(s);
- continue; /*** NEXT SLAVE ***/
- }
- break;
- }
- }
- close(s);
- cs->succeeded = 1;
- fprintf(stderr, "%s: success.\n", cs->name);
- strcat(strcpy(pc, cs->name), "-last-prop");
- close(creat(path, 0600));
- }
- }
- }
-punt:
-
- dest_tkt();
- for (cs = sl; cs; cs = cs->next) {
- if (!cs->succeeded)
- return (0); /* didn't get this slave */
- }
- return (1);
-}
-
-int
-get_slaves(psl, file, ok_mtime)
- struct slave_host **psl;
- char *file;
- time_t ok_mtime;
-{
- FILE *fin;
- char namebuf[128], *inst;
- char *pc;
- struct hostent *host;
- struct slave_host **th;
- char path[256];
- char *ppath;
- struct stat stbuf;
-
- if ((fin = fopen(file, "r")) == NULL) {
- fprintf(stderr, "Can't open slave host file, '%s'.\n", file);
- exit(-1);
- }
- strcpy(path, file);
- if ((ppath = rindex(path, '/'))) {
- ppath += 1;
- } else {
- ppath = path;
- }
- for (th = psl; fgets(namebuf, sizeof namebuf, fin); th = &(*th)->next) {
- if ((pc = index(namebuf, '\n'))) {
- *pc = '\0';
- } else {
- fprintf(stderr, "Host name too long (>= %d chars) in '%s'.\n",
- sizeof namebuf, file);
- exit(-1);
- }
- host = gethostbyname(namebuf);
- if (host == NULL) {
- fprintf(stderr, "Unknown host '%s' in '%s'.\n", namebuf, file);
- exit(-1);
- }
- (*th) = (struct slave_host *) malloc(sizeof(struct slave_host));
- if (!*th) {
- fprintf(stderr, "No memory reading host list from '%s'.\n",
- file);
- exit(-1);
- }
- (*th)->name = malloc(strlen(namebuf) + 1);
- if (!(*th)->name) {
- fprintf(stderr, "No memory reading host list from '%s'.\n",
- file);
- exit(-1);
- }
- /* get kerberos cannonical instance name */
- strcpy((*th)->name, namebuf);
- inst = krb_get_phost ((*th)->name);
- (*th)->instance = malloc(strlen(inst) + 1);
- if (!(*th)->instance) {
- fprintf(stderr, "No memory reading host list from '%s'.\n",
- file);
- exit(-1);
- }
- strcpy((*th)->instance, inst);
- /* what a concept, slave servers in different realms! */
- (*th)->realm = my_realm;
- (*th)->net_addr = *(u_long *) host->h_addr;
- (*th)->succeeded = 0;
- (*th)->next = NULL;
- strcat(strcpy(ppath, (*th)->name), "-last-prop");
- if (!force_flag && !stat(path, &stbuf) && stbuf.st_mtime > ok_mtime) {
- (*th)->not_time_yet = 1;
- (*th)->succeeded = 1; /* no change since last success */
- }
- }
- fclose(fin);
- return (1);
-}
-
-#ifdef doesnt_work_yet
-u_long get_data_checksum(fd, key_sched)
- int fd;
- Key_schedule key_sched;
-{
- unsigned long cksum = 0;
- unsigned long cbc_cksum();
- int n;
- char buf[BUFSIZ];
- long obuf[2];
-
- while (n = read(fd, buf, sizeof buf)) {
- if (n < 0) {
- fprintf(stderr, "Input data file read error: ");
- perror("read");
- exit(1);
- }
- cksum = cbc_cksum(buf, obuf, n, key_sched, key_sched);
- }
- return cksum;
-}
-#endif
diff --git a/eBones/kprop/kprop.h b/eBones/kprop/kprop.h
deleted file mode 100644
index 5197276..0000000
--- a/eBones/kprop/kprop.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 1987 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information,
- * please see the file <mit-copyright.h>.
- *
- * $Revision: 1.1.1.1 $
- * $Date: 1995/08/03 07:36:18 $
- * $State: Exp $
- * $Source: /usr/cvs/src/eBones/kprop/kprop.h,v $
- * $Author: mark $
- * $Locker: $
- *
- * $Log: kprop.h,v $
- * Revision 1.1.1.1 1995/08/03 07:36:18 mark
- * Import an updated revision of the MIT kprop program for distributing
- * kerberos databases to slave servers.
- *
- * NOTE: This method was abandoned by MIT long ago, this code is close to
- * garbage, but it is slightly more secure than using rdist.
- * There is no documentation available on how to use it, and
- * it should -not- be built by default.
- *
- * Obtained from: MIT Project Athena
- *
- * Revision 1.1.1.1 1995/08/02 22:11:44 pst
- * Import an updated revision of the MIT kprop program for distributing
- * kerberos databases to slave servers.
- *
- * NOTE: This method was abandoned by MIT long ago, this code is close to
- * garbage, but it is slightly more secure than using rdist.
- * There is no documentation available on how to use it, and
- * it should -not- be built by default.
- *
- * Obtained from: MIT Project Athena
- *
- * Revision 4.1 92/10/23 15:45:13 tytso
- * Change the location of KPROP_KDBUTIL to be /kerberos/bin/kdb_util.
- *
- * Revision 4.0 89/01/24 18:44:46 wesommer
- * Original version; programmer: wesommer
- * auditor: jon
- *
- */
-
-#define KPROP_SERVICE_NAME "rcmd"
-#define KPROP_SRVTAB "/etc/kerberosIV/srvtab"
-#define TGT_SERVICE_NAME "krbtgt"
-#define KPROP_PROT_VERSION_LEN 8
-#define KPROP_PROT_VERSION "kprop01"
-#define KPROP_TRANSFER_PRIVATE 1
-#define KPROP_TRANSFER_SAFE 2
-#define KPROP_TRANSFER_CLEAR 3
-#define KPROP_BUFSIZ 32768
-#define KPROP_KDB_UTIL "/usr/sbin/kdb_util"
diff --git a/eBones/kpropd/Makefile b/eBones/kpropd/Makefile
deleted file mode 100644
index 59d7914..0000000
--- a/eBones/kpropd/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# From: @(#)Makefile 5.1 (Berkeley) 6/25/90
-# $Id: Makefile,v 1.1.1.1 1995/08/03 07:37:19 mark Exp $
-
-PROG= kpropd
-CFLAGS+=-I${.CURDIR}/../include -I${.CURDIR}/../kprop -Wall
-DPADD= ${LIBKRB}
-LDADD= -L${KRBOBJDIR} -lkrb -ldes
-BINDIR= /usr/libexec
-NOMAN= noman
-
-.include <bsd.prog.mk>
diff --git a/eBones/kpropd/kpropd.c b/eBones/kpropd/kpropd.c
deleted file mode 100644
index 1b232df..0000000
--- a/eBones/kpropd/kpropd.c
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
- * Copyright 1987 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * MIT.Copyright.
- *
- * kprop/kpropd have been abandonded by Project Athena (for good reason)
- * however they still form the basis for one of the better ways for
- * distributing kerberos databases. This version of kpropd has been
- * adapted from the MIT distribution to work properly in a 4.4BSD
- * environment.
- *
- * $Revision: 1.1.1.1 $ $Date: 1995/08/03 07:37:19 $ $State: Exp $
- * $Source: /usr/cvs/src/eBones/kpropd/kpropd.c,v $
- *
- * Log: kpropd.c,v
- * Revision 4.5 92/10/23 15:45:46 tytso Make it possible
- * to specify the location of the kdb_util program.
- *
- * Revision 4.4 91/06/15 03:20:51 probe Fixed <sys/types.h> inclusion
- *
- * Revision 4.3 89/05/16 15:06:04 wesommer Fix operator precedence stuff.
- * Programmer: John Kohl.
- *
- * Revision 4.2 89/03/23 10:24:00 jtkohl NOENCRYPTION changes
- *
- * Revision 4.1 89/01/24 20:33:48 root name change
- *
- * Revision 4.0 89/01/24 18:45:06 wesommer Original version; programmer:
- * wesommer auditor: jon
- *
- * Revision 4.5 88/01/08 18:07:46 jon formatting and rcs header changes */
-
-/*
- * This program is run on slave servers, to catch updates "pushed" from the
- * master kerberos server in a realm.
- */
-
-#if 0
-#ifndef lint
-static char rcsid_kpropd_c[] =
-"$Header: /usr/cvs/src/eBones/kpropd/kpropd.c,v 1.1.1.1 1995/08/03 07:37:19 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <errno.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <syslog.h>
-#include <krb.h>
-#include <krb_db.h>
-
-#include "kprop.h"
-
-static char kprop_version[KPROP_PROT_VERSION_LEN] = KPROP_PROT_VERSION;
-
-int debug = 0;
-
-int pause_int = 300; /* 5 minutes in seconds */
-unsigned long get_data_checksum(int fd, Key_schedule key_sched);
-void recv_auth(int in, int out, int private,
- struct sockaddr_in *remote, struct sockaddr_in *local,
- AUTH_DAT *ad);
-static void SlowDeath(void);
-void recv_clear(int in, int out);
- /* leave room for private msg overhead */
-static char buf[KPROP_BUFSIZ + 64];
-
-static void
-usage()
-{
- fprintf(stderr, "\nUsage: kpropd [-r realm] [-s srvtab] [-P kdb_util] fname\n");
- exit(2);
-}
-
-void
-main(argc, argv)
- int argc;
- char **argv;
-{
- struct sockaddr_in from;
- struct sockaddr_in sin;
- int s2, fd, n, fdlock;
- int from_len;
- char local_file[256];
- char local_temp[256];
- struct hostent *hp;
- char hostname[256];
- char from_str[128];
- long kerror;
- AUTH_DAT auth_dat;
- KTEXT_ST ticket;
- char my_instance[INST_SZ];
- char my_realm[REALM_SZ];
- char cmd[1024];
- short net_transfer_mode, transfer_mode;
- Key_schedule session_sched;
- char version[9];
- int c;
- extern char *optarg;
- extern int optind;
- int rflag = 0;
- char *srvtab = "";
- char *local_db = DBM_FILE;
- char *kdb_util = KPROP_KDB_UTIL;
-
- if (argv[argc - 1][0] == 'k' && isdigit(argv[argc - 1][1])) {
- argc--; /* ttys file hack */
- }
- while ((c = getopt(argc, argv, "r:s:d:P:")) != EOF) {
- switch (c) {
- case 'r':
- rflag++;
- strcpy(my_realm, optarg);
- break;
- case 's':
- srvtab = optarg;
- break;
- case 'd':
- local_db = optarg;
- break;
- case 'P':
- kdb_util = optarg;
- break;
- default:
- usage();
- break;
- }
- }
- if (optind != argc - 1)
- usage();
-
- openlog("kpropd", LOG_PID, LOG_AUTH);
-
- strcpy(local_file, argv[optind]);
- strcat(strcpy(local_temp, argv[optind]), ".tmp");
-
-#ifdef STANDALONE
-
- if ((sp = getservbyname("krb_prop", "tcp")) == NULL) {
- syslog(LOG_ERR, "tcp/krb_prop: unknown service.");
- SlowDeath();
- }
- bzero(&sin, sizeof sin);
- sin.sin_port = sp->s_port;
- sin.sin_family = AF_INET;
-
- if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- syslog(LOG_ERR, "socket: %m");
- SlowDeath();
- }
- if (bind(s, (struct sockaddr *)&sin, sizeof sin) < 0) {
- syslog(LOG_ERR, "bind: %m");
- SlowDeath();
- }
-
-#endif /* STANDALONE */
-
- if (!rflag) {
- kerror = krb_get_lrealm(my_realm, 1);
- if (kerror != KSUCCESS) {
- syslog(LOG_ERR, "can't get local realm. %s",
- krb_err_txt[kerror]);
- SlowDeath();
- }
- }
- if (gethostname(my_instance, sizeof(my_instance)) != 0) {
- syslog(LOG_ERR, "gethostname: %m");
- SlowDeath();
- }
-
-#ifdef STANDALONE
- listen(s, 5);
- for (;;) {
- from_len = sizeof from;
- if ((s2 = accept(s, (struct sockaddr *)&from, &from_len)) < 0) {
- syslog(LOG_ERR, "accept: %m");
- continue;
- }
-#else /* !STANDALONE */
-
- s2 = 0;
- from_len = sizeof from;
- if (getpeername(0, (struct sockaddr *)&from, &from_len) < 0) {
- syslog(LOG_ERR, "getpeername: %m");
- SlowDeath();
- }
-
-#endif /* !STANDALONE */
-
- strcpy(from_str, inet_ntoa(from.sin_addr));
-
- if ((hp = gethostbyaddr((char *) &(from.sin_addr.s_addr),
- from_len, AF_INET)) == NULL) {
- strcpy(hostname, "UNKNOWN");
- } else {
- strcpy(hostname, hp->h_name);
- }
-
- syslog(LOG_INFO, "connection from %s, %s", hostname, from_str);
-
- /* for krb_rd_{priv, safe} */
- n = sizeof sin;
- if (getsockname(s2, (struct sockaddr *)&sin, &n) != 0) {
- syslog(LOG_ERR, "can't get socketname: %m");
- SlowDeath();
- }
- if (n != sizeof(sin)) {
- syslog(LOG_ERR, "can't get socketname (length)");
- SlowDeath();
- }
- if ((fdlock = open(local_temp, O_WRONLY | O_CREAT, 0600)) < 0) {
- syslog(LOG_ERR, "open: %m");
- SlowDeath();
- }
- if (flock(fdlock, LOCK_EX | LOCK_NB)) {
- syslog(LOG_ERR, "flock: %m");
- SlowDeath();
- }
- if ((fd = creat(local_temp, 0600)) < 0) {
- syslog(LOG_ERR, "creat: %m");
- SlowDeath();
- }
- if ((n = read(s2, buf, sizeof(kprop_version)))
- != sizeof(kprop_version)) {
- syslog(LOG_ERR,
- "can't read protocol version (%d bytes)", n);
- SlowDeath();
- }
- if (strncmp(buf, kprop_version, sizeof(kprop_version)) != 0) {
- syslog(LOG_ERR, "unsupported version %s", buf);
- SlowDeath();
- }
- if ((n = read(s2, &net_transfer_mode,
- sizeof(net_transfer_mode)))
- != sizeof(net_transfer_mode)) {
- syslog(LOG_ERR, "can't read transfer mode");
- SlowDeath();
- }
- transfer_mode = ntohs(net_transfer_mode);
- kerror = krb_recvauth(KOPT_DO_MUTUAL, s2, &ticket,
- KPROP_SERVICE_NAME,
- my_instance,
- &from,
- &sin,
- &auth_dat,
- srvtab,
- session_sched,
- version);
- if (kerror != KSUCCESS) {
- syslog(LOG_ERR, "%s calling getkdata",
- krb_err_txt[kerror]);
- SlowDeath();
- }
- syslog(LOG_INFO, "connection from %s.%s@%s",
- auth_dat.pname, auth_dat.pinst, auth_dat.prealm);
-
- /*
- * AUTHORIZATION is done here. We might want to expand this
- * to read an acl file at some point, but allowing for now
- * KPROP_SERVICE_NAME.KRB_MASTER@local-realm is fine ...
- */
-
- if ((strcmp(KPROP_SERVICE_NAME, auth_dat.pname) != 0) ||
- (strcmp(KRB_MASTER, auth_dat.pinst) != 0) ||
- (strcmp(my_realm, auth_dat.prealm) != 0)) {
- syslog(LOG_NOTICE, "authorization denied");
- SlowDeath();
- }
- switch (transfer_mode) {
- case KPROP_TRANSFER_PRIVATE:
- recv_auth(s2, fd, 1 /* private */ , &from, &sin, &auth_dat);
- break;
- case KPROP_TRANSFER_SAFE:
- recv_auth(s2, fd, 0 /* safe */ , &from, &sin, &auth_dat);
- break;
- case KPROP_TRANSFER_CLEAR:
- recv_clear(s2, fd);
- break;
- default:
- syslog(LOG_ERR, "bad transfer mode %d", transfer_mode);
- SlowDeath();
- }
-
- if (transfer_mode != KPROP_TRANSFER_PRIVATE) {
- syslog(LOG_ERR, "non-private transfers not supported\n");
- SlowDeath();
-#ifdef doesnt_work_yet
- lseek(fd, (long) 0, L_SET);
- if (auth_dat.checksum != get_data_checksum(fd, session_sched)) {
- syslog(LOG_ERR, "checksum doesn't match");
- SlowDeath();
- }
-#endif
- } else {
- struct stat st;
- fstat(fd, &st);
- if (st.st_size != auth_dat.checksum) {
- syslog(LOG_ERR, "length doesn't match");
- SlowDeath();
- }
- }
- close(fd);
- close(s2);
-
- if (rename(local_temp, local_file) < 0) {
- syslog(LOG_ERR, "rename: %m");
- SlowDeath();
- }
-
- if (flock(fdlock, LOCK_UN)) {
- syslog(LOG_ERR, "flock (unlock): %m");
- SlowDeath();
- }
- close(fdlock);
- sprintf(cmd, "%s load %s %s\n", kdb_util, local_file, local_db);
- if (system(cmd) != 0) {
- syslog(LOG_ERR, "couldn't load database");
- SlowDeath();
- }
-
-#ifdef STANDALONE
- }
-#endif
-
-}
-
-void
-recv_auth(in, out, private, remote, local, ad)
- int in, out;
- int private;
- struct sockaddr_in *remote, *local;
- AUTH_DAT *ad;
-{
- u_long length;
- long kerror;
- int n;
- MSG_DAT msg_data;
- Key_schedule session_sched;
-
- if (private)
-#ifdef NOENCRYPTION
- bzero((char *) session_sched, sizeof(session_sched));
-#else
- if (key_sched((C_Block *)ad->session, session_sched)) {
- syslog(LOG_ERR, "can't make key schedule");
- SlowDeath();
- }
-#endif
-
- while (1) {
- n = krb_net_read(in, (char *)&length, sizeof length);
- if (n == 0)
- break;
- if (n < 0) {
- syslog(LOG_ERR, "read: %m");
- SlowDeath();
- }
- length = ntohl(length);
- if (length > sizeof buf) {
- syslog(LOG_ERR, "read length %d, bigger than buf %d",
- length, sizeof buf);
- SlowDeath();
- }
- n = krb_net_read(in, buf, length);
- if (n < 0) {
- syslog(LOG_ERR, "kpropd: read: %m");
- SlowDeath();
- }
- if (private)
- kerror = krb_rd_priv(buf, n, session_sched, ad->session,
- remote, local, &msg_data);
- else
- kerror = krb_rd_safe(buf, n, (C_Block *)ad->session,
- remote, local, &msg_data);
- if (kerror != KSUCCESS) {
- syslog(LOG_ERR, "%s: %s",
- private ? "krb_rd_priv" : "krb_rd_safe",
- krb_err_txt[kerror]);
- SlowDeath();
- }
- if (write(out, msg_data.app_data, msg_data.app_length) !=
- msg_data.app_length) {
- syslog(LOG_ERR, "write: %m");
- SlowDeath();
- }
- }
-}
-
-void
-recv_clear(in, out)
- int in, out;
-{
- int n;
-
- while (1) {
- n = read(in, buf, sizeof buf);
- if (n == 0)
- break;
- if (n < 0) {
- syslog(LOG_ERR, "read: %m");
- SlowDeath();
- }
- if (write(out, buf, n) != n) {
- syslog(LOG_ERR, "write: %m");
- SlowDeath();
- }
- }
-}
-
-static void
-SlowDeath()
-{
-#ifdef STANDALONE
- sleep(pause_int);
-#endif
- exit(1);
-}
-
-#ifdef doesnt_work_yet
-unsigned long
-get_data_checksum(fd, key_sched)
- int fd;
- Key_schedule key_sched;
-{
- unsigned long cksum = 0;
- unsigned long cbc_cksum();
- int n;
- char buf[BUFSIZ];
- char obuf[8];
-
- while (n = read(fd, buf, sizeof buf)) {
- if (n < 0) {
- syslog(LOG_ERR, "read (in checksum test): %m");
- SlowDeath();
- }
-#ifndef NOENCRYPTION
- cksum += cbc_cksum(buf, obuf, n, key_sched, key_sched);
-#endif
- }
- return cksum;
-}
-#endif
diff --git a/eBones/krb/Makefile b/eBones/krb/Makefile
deleted file mode 100644
index b09b96b..0000000
--- a/eBones/krb/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-# From: @(#)Makefile 5.1 (Berkeley) 6/25/90
-# $Id: Makefile,v 1.5 1995/07/18 16:38:02 mark Exp $
-
-LIB= krb
-SHLIB_MAJOR= 2
-SHLIB_MINOR= 0
-CFLAGS+=-DKERBEROS -DCRYPT -DDEBUG -I${.CURDIR}/../include -DBSD42 -Wall
-SRCS= krb_err.c create_auth_reply.c create_ciph.c \
- create_death_packet.c create_ticket.c debug_decl.c decomp_ticket.c \
- des_rw.c dest_tkt.c extract_ticket.c fgetst.c get_ad_tkt.c \
- get_admhst.c get_cred.c get_in_tkt.c get_krbhst.c get_krbrlm.c \
- get_phost.c get_pw_tkt.c get_request.c get_svc_in_tkt.c \
- get_tf_fullname.c get_tf_realm.c getrealm.c getst.c in_tkt.c \
- k_gethostname.c klog.c kname_parse.c kntoln.c kparse.c \
- krb_err_txt.c krb_get_in_tkt.c kuserok.c log.c mk_err.c \
- mk_priv.c mk_req.c mk_safe.c month_sname.c \
- netread.c netwrite.c one.c pkt_cipher.c pkt_clen.c rd_err.c \
- rd_priv.c rd_req.c rd_safe.c read_service_key.c recvauth.c \
- save_credentials.c send_to_kdc.c sendauth.c stime.c tf_util.c \
- tkt_string.c util.c
-
-TDIR= ${.CURDIR}/..
-krb_err.c krb_err.h: krb_err.et
- test -e krb_err.et || ln -s ${.CURDIR}/krb_err.et .
- ${COMPILE_ET} krb_err.et
-LDADD+= -lcom_err
-
-beforeinstall:
- -cd ${.OBJDIR}; cmp -s krb_err.h \
- ${DESTDIR}/usr/include/kerberosIV/krb_err.h || \
- install -c -o ${BINOWN} -g ${BINGRP} -m 444 krb_err.h \
- ${DESTDIR}/usr/include/kerberosIV
-
-MAN3= krb.3 krb_realmofhost.3 krb_sendauth.3 krb_set_tkt_string.3 \
- kuserok.3 tf_util.3
-
-MLINKS= krb.3 krb_mk_req.3 krb.3 krb_rd_req.3 krb.3 krb_kntoln.3 \
- krb.3 krb_set_key.3 krb.3 krb_get_cred.3 krb.3 krb_mk_priv.3 \
- krb.3 krb_rd_priv.3 krb.3 krb_mk_safe.3 krb.3 krb_rd_safe.3 \
- krb.3 krb_mk_err.3 krb.3 krb_rd_err.3 krb.3 krb_ck_repl.3
-
-MLINKS+=krb_realmofhost.3 krb_get_phost.3 krb_realmofhost.3 krb_get_krbhst.3 \
- krb_realmofhost.3 krb_get_admhst.3 krb_realmofhost.3 krb_get_lrealm.3
-
-MLINKS+=krb_realmofhost.3 realm.3
-
-MLINKS+=krb_sendauth.3 krb_recvauth.3 krb_sendauth.3 krb_net_write.3 \
- krb_sendauth.3 krb_net_read.3
-
-MLINKS+=krb_sendauth.3 ksend.3
-
-MLINKS+=tf_util.3 tf_init.3 tf_util.3 tf_get_pname.3 \
- tf_util.3 tf_get_pinst.3 tf_util.3 tf_get_cred.3 \
- tf_util.3 tf_close.3
-
-.include <bsd.lib.mk>
diff --git a/eBones/krb/add_ticket.c b/eBones/krb/add_ticket.c
deleted file mode 100644
index 14ef47c..0000000
--- a/eBones/krb/add_ticket.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: add_ticket.c,v 4.7 88/10/07 06:06:26 shanzer Exp $
- * $Id: add_ticket.c,v 1.3 1995/07/18 16:38:04 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: add_ticket.c,v 1.3 1995/07/18 16:38:04 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <krb.h>
-#include <prot.h>
-#include <strings.h>
-
-/*
- * This routine is now obsolete. It used to be possible to request
- * more than one ticket at a time from the authentication server, and
- * it looks like this routine was used by the server to package the
- * tickets to be returned to the client.
- */
-
-/*
- * This routine adds a new ticket to the ciphertext to be returned to
- * the client. The routine takes the ciphertext (which doesn't get
- * encrypted till later), the number of the ticket (i.e. 1st, 2nd,
- * etc) the session key which goes in the ticket and is sent back to
- * the user, the lifetime for the ticket, the service name, the
- * instance, the realm, the key version number, and the ticket itself.
- *
- * This routine returns 0 (KSUCCESS) on success, and 1 (KFAILURE) on
- * failure. On failure, which occurs when there isn't enough room
- * for the ticket, a 0 length ticket is added.
- *
- * Notes: This routine must be called with successive values of n.
- * i.e. the ticket must be added in order. The corresponding routine
- * on the client side is extract ticket.
- */
-
-/* XXX they aren't all used; to avoid incompatible changes we will
- * fool lint for the moment */
-/*ARGSUSED */
-int
-add_ticket(cipher,n,session,lifetime,sname,instance,realm,kvno,ticket)
- KTEXT cipher; /* Ciphertext info for ticket */
- char *sname; /* Service name */
- char *instance; /* Instance */
- int n; /* Relative position of this ticket */
- char *session; /* Session key for this tkt */
- int lifetime; /* Lifetime of this ticket */
- char *realm; /* Realm in which ticket is valid */
- int kvno; /* Key version number of service key */
- KTEXT ticket; /* The ticket itself */
-{
-
- /* Note, the 42 is a temporary hack; it will have to be changed. */
-
- /* Begin check of ticket length */
- if ((cipher->length + ticket->length + 4 + 42 +
- (*(cipher->dat)+1-n)*(11+strlen(realm))) >
- MAX_KTXT_LEN) {
- bcopy(session,(char *)(cipher->dat+cipher->length),8);
- *(cipher->dat+cipher->length+8) = (char) lifetime;
- *(cipher->dat+cipher->length+9) = (char) kvno;
- (void) strcpy((char *)(cipher->dat+cipher->length+10),realm);
- cipher->length += 11 + strlen(realm);
- *(cipher->dat+n) = 0;
- return(KFAILURE);
- }
- /* End check of ticket length */
-
- /* Add the session key, lifetime, kvno, ticket to the ciphertext */
- bcopy(session,(char *)(cipher->dat+cipher->length),8);
- *(cipher->dat+cipher->length+8) = (char) lifetime;
- *(cipher->dat+cipher->length+9) = (char) kvno;
- (void) strcpy((char *)(cipher->dat+cipher->length+10),realm);
- cipher->length += 11 + strlen(realm);
- bcopy((char *)(ticket->dat),(char *)(cipher->dat+cipher->length),
- ticket->length);
- cipher->length += ticket->length;
-
- /* Set the ticket length at beginning of ciphertext */
- *(cipher->dat+n) = ticket->length;
- return(KSUCCESS);
-}
diff --git a/eBones/krb/create_auth_reply.c b/eBones/krb/create_auth_reply.c
deleted file mode 100644
index e304b17..0000000
--- a/eBones/krb/create_auth_reply.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: create_auth_reply.c,v 4.10 89/01/13 17:47:38 steiner Exp $
- * $Id: create_auth_reply.c,v 1.3 1995/07/18 16:38:06 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: create_auth_reply.c,v 1.3 1995/07/18 16:38:06 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <krb.h>
-#include <prot.h>
-#include <strings.h>
-
-/*
- * This routine is called by the Kerberos authentication server
- * to create a reply to an authentication request. The routine
- * takes the user's name, instance, and realm, the client's
- * timestamp, the number of tickets, the user's key version
- * number and the ciphertext containing the tickets themselves.
- * It constructs a packet and returns a pointer to it.
- *
- * Notes: The packet returned by this routine is static. Thus, if you
- * intend to keep the result beyond the next call to this routine, you
- * must copy it elsewhere.
- *
- * The packet is built in the following format:
- *
- * variable
- * type or constant data
- * ---- ----------- ----
- *
- * unsigned char KRB_PROT_VERSION protocol version number
- *
- * unsigned char AUTH_MSG_KDC_REPLY protocol message type
- *
- * [least significant HOST_BYTE_ORDER sender's (server's) byte
- * bit of above field] order
- *
- * string pname principal's name
- *
- * string pinst principal's instance
- *
- * string prealm principal's realm
- *
- * unsigned long time_ws client's timestamp
- *
- * unsigned char n number of tickets
- *
- * unsigned long x_date expiration date
- *
- * unsigned char kvno master key version
- *
- * short w_1 cipher length
- *
- * --- cipher->dat cipher data
- */
-
-KTEXT
-create_auth_reply(pname,pinst,prealm,time_ws,n,x_date,kvno,cipher)
- char *pname; /* Principal's name */
- char *pinst; /* Principal's instance */
- char *prealm; /* Principal's authentication domain */
- long time_ws; /* Workstation time */
- int n; /* Number of tickets */
- unsigned long x_date; /* Principal's expiration date */
- int kvno; /* Principal's key version number */
- KTEXT cipher; /* Cipher text with tickets and
- * session keys */
-{
- static KTEXT_ST pkt_st;
- KTEXT pkt = &pkt_st;
- unsigned char *v = pkt->dat; /* Prot vers number */
- unsigned char *t = (pkt->dat+1); /* Prot message type */
- short w_l; /* Cipher length */
-
- /* Create fixed part of packet */
- *v = (unsigned char) KRB_PROT_VERSION;
- *t = (unsigned char) AUTH_MSG_KDC_REPLY;
- *t |= HOST_BYTE_ORDER;
-
- if (n != 0)
- *v = 3;
-
- /* Add the basic info */
- (void) strcpy((char *) (pkt->dat+2), pname);
- pkt->length = 3 + strlen(pname);
- (void) strcpy((char *) (pkt->dat+pkt->length),pinst);
- pkt->length += 1 + strlen(pinst);
- (void) strcpy((char *) (pkt->dat+pkt->length),prealm);
- pkt->length += 1 + strlen(prealm);
- /* Workstation timestamp */
- bcopy((char *) &time_ws, (char *) (pkt->dat+pkt->length), 4);
- pkt->length += 4;
- *(pkt->dat+(pkt->length)++) = (unsigned char) n;
- /* Expiration date */
- bcopy((char *) &x_date, (char *) (pkt->dat+pkt->length),4);
- pkt->length += 4;
-
- /* Now send the ciphertext and info to help decode it */
- *(pkt->dat+(pkt->length)++) = (unsigned char) kvno;
- w_l = (short) cipher->length;
- bcopy((char *) &w_l,(char *) (pkt->dat+pkt->length),2);
- pkt->length += 2;
- bcopy((char *) (cipher->dat), (char *) (pkt->dat+pkt->length),
- cipher->length);
- pkt->length += cipher->length;
-
- /* And return the packet */
- return pkt;
-}
diff --git a/eBones/krb/create_ciph.c b/eBones/krb/create_ciph.c
deleted file mode 100644
index 7fb93e3..0000000
--- a/eBones/krb/create_ciph.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: create_ciph.c,v 4.8 89/05/18 21:24:26 jis Exp $
- * $Id: create_ciph.c,v 1.3 1995/07/18 16:38:07 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: create_ciph.c,v 1.3 1995/07/18 16:38:07 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <krb.h>
-#include <des.h>
-#include <strings.h>
-
-/*
- * This routine is used by the authentication server to create
- * a packet for its client, containing a ticket for the requested
- * service (given in "tkt"), and some information about the ticket,
- *
- * Returns KSUCCESS no matter what.
- *
- * The length of the cipher is stored in c->length; the format of
- * c->dat is as follows:
- *
- * variable
- * type or constant data
- * ---- ----------- ----
- *
- *
- * 8 bytes session session key for client, service
- *
- * string service service name
- *
- * string instance service instance
- *
- * string realm KDC realm
- *
- * unsigned char life ticket lifetime
- *
- * unsigned char kvno service key version number
- *
- * unsigned char tkt->length length of following ticket
- *
- * data tkt->dat ticket for service
- *
- * 4 bytes kdc_time KDC's timestamp
- *
- * <=7 bytes null null pad to 8 byte multiple
- *
- */
-
-int
-create_ciph(c, session, service, instance, realm, life, kvno, tkt,
- kdc_time, key)
- KTEXT c; /* Text block to hold ciphertext */
- C_Block session; /* Session key to send to user */
- char *service; /* Service name on ticket */
- char *instance; /* Instance name on ticket */
- char *realm; /* Realm of this KDC */
- unsigned long life; /* Lifetime of the ticket */
- int kvno; /* Key version number for service */
- KTEXT tkt; /* The ticket for the service */
- unsigned long kdc_time; /* KDC time */
- C_Block key; /* Key to encrypt ciphertext with */
-{
- char *ptr;
- Key_schedule key_s;
-
- ptr = (char *) c->dat;
-
- bcopy((char *) session, ptr, 8);
- ptr += 8;
-
- (void) strcpy(ptr,service);
- ptr += strlen(service) + 1;
-
- (void) strcpy(ptr,instance);
- ptr += strlen(instance) + 1;
-
- (void) strcpy(ptr,realm);
- ptr += strlen(realm) + 1;
-
- *(ptr++) = (unsigned char) life;
- *(ptr++) = (unsigned char) kvno;
- *(ptr++) = (unsigned char) tkt->length;
-
- bcopy((char *)(tkt->dat),ptr,tkt->length);
- ptr += tkt->length;
-
- bcopy((char *) &kdc_time,ptr,4);
- ptr += 4;
-
- /* guarantee null padded encrypted data to multiple of 8 bytes */
- bzero(ptr, 7);
-
- c->length = (((ptr - (char *) c->dat) + 7) / 8) * 8;
-
-#ifndef NOENCRYPTION
- key_sched((C_Block *)key,key_s);
- pcbc_encrypt((C_Block *)c->dat,(C_Block *)c->dat,(long) c->length,key_s,
- (C_Block *)key,ENCRYPT);
-#endif /* NOENCRYPTION */
-
- return(KSUCCESS);
-}
diff --git a/eBones/krb/create_death_packet.c b/eBones/krb/create_death_packet.c
deleted file mode 100644
index bdc0e34..0000000
--- a/eBones/krb/create_death_packet.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: create_death_packet.c,v 4.9 89/01/17 16:05:59 rfrench Exp $
- * $Id: create_death_packet.c,v 1.3 1995/07/18 16:38:09 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: create_death_packet.c,v 1.3 1995/07/18 16:38:09 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <krb.h>
-#include <prot.h>
-#include <strings.h>
-
-/*
- * This routine creates a packet to type AUTH_MSG_DIE which is sent to
- * the Kerberos server to make it shut down. It is used only in the
- * development environment.
- *
- * It takes a string "a_name" which is sent in the packet. A pointer
- * to the packet is returned.
- *
- * The format of the killer packet is:
- *
- * type variable data
- * or constant
- * ---- ----------- ----
- *
- * unsigned char KRB_PROT_VERSION protocol version number
- *
- * unsigned char AUTH_MSG_DIE message type
- *
- * [least significant HOST_BYTE_ORDER byte order of sender
- * bit of above field]
- *
- * string a_name presumably, name of
- * principal sending killer
- * packet
- */
-
-#ifdef DEBUG
-KTEXT
-krb_create_death_packet(a_name)
- char *a_name;
-{
- static KTEXT_ST pkt_st;
- KTEXT pkt = &pkt_st;
-
- unsigned char *v = pkt->dat;
- unsigned char *t = (pkt->dat+1);
- *v = (unsigned char) KRB_PROT_VERSION;
- *t = (unsigned char) AUTH_MSG_DIE;
- *t |= HOST_BYTE_ORDER;
- (void) strcpy((char *) (pkt->dat+2),a_name);
- pkt->length = 3 + strlen(a_name);
- return pkt;
-}
-#endif /* DEBUG */
diff --git a/eBones/krb/create_ticket.c b/eBones/krb/create_ticket.c
deleted file mode 100644
index e1d6974..0000000
--- a/eBones/krb/create_ticket.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: create_ticket.c,v 4.11 89/03/22 14:43:23 jtkohl Exp $
- * $Id: create_ticket.c,v 1.3 1995/07/18 16:38:12 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: create_ticket.c,v 1.3 1995/07/18 16:38:12 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <stdio.h>
-#include <des.h>
-#include <krb.h>
-#include <prot.h>
-#include <strings.h>
-
-/*
- * Create ticket takes as arguments information that should be in a
- * ticket, and the KTEXT object in which the ticket should be
- * constructed. It then constructs a ticket and returns, leaving the
- * newly created ticket in tkt.
- * The length of the ticket is a multiple of
- * eight bytes and is in tkt->length.
- *
- * If the ticket is too long, the ticket will contain nulls.
- * The return value of the routine is undefined.
- *
- * The corresponding routine to extract information from a ticket it
- * decomp_ticket. When changes are made to this routine, the
- * corresponding changes should also be made to that file.
- *
- * The packet is built in the following format:
- *
- * variable
- * type or constant data
- * ---- ----------- ----
- *
- * tkt->length length of ticket (multiple of 8 bytes)
- *
- * tkt->dat:
- *
- * unsigned char flags namely, HOST_BYTE_ORDER
- *
- * string pname client's name
- *
- * string pinstance client's instance
- *
- * string prealm client's realm
- *
- * 4 bytes paddress client's address
- *
- * 8 bytes session session key
- *
- * 1 byte life ticket lifetime
- *
- * 4 bytes time_sec KDC timestamp
- *
- * string sname service's name
- *
- * string sinstance service's instance
- *
- * <=7 bytes null null pad to 8 byte multiple
- *
- */
-
-int krb_create_ticket(tkt, flags, pname, pinstance, prealm, paddress,
- session, life, time_sec, sname, sinstance, key)
- KTEXT tkt; /* Gets filled in by the ticket */
- unsigned char flags; /* Various Kerberos flags */
- char *pname; /* Principal's name */
- char *pinstance; /* Principal's instance */
- char *prealm; /* Principal's authentication domain */
- long paddress; /* Net address of requesting entity */
- char *session; /* Session key inserted in ticket */
- short life; /* Lifetime of the ticket */
- long time_sec; /* Issue time and date */
- char *sname; /* Service Name */
- char *sinstance; /* Instance Name */
- C_Block key; /* Service's secret key */
-{
- Key_schedule key_s;
- register char *data; /* running index into ticket */
-
- tkt->length = 0; /* Clear previous data */
- flags |= HOST_BYTE_ORDER; /* ticket byte order */
- bcopy((char *) &flags,(char *) (tkt->dat),sizeof(flags));
- data = ((char *)tkt->dat) + sizeof(flags);
- (void) strcpy(data, pname);
- data += 1 + strlen(pname);
- (void) strcpy(data, pinstance);
- data += 1 + strlen(pinstance);
- (void) strcpy(data, prealm);
- data += 1 + strlen(prealm);
- bcopy((char *) &paddress, data, 4);
- data += 4;
-
- bcopy((char *) session, data, 8);
- data += 8;
- *(data++) = (char) life;
- /* issue time */
- bcopy((char *) &time_sec, data, 4);
- data += 4;
- (void) strcpy(data, sname);
- data += 1 + strlen(sname);
- (void) strcpy(data, sinstance);
- data += 1 + strlen(sinstance);
-
- /* guarantee null padded ticket to multiple of 8 bytes */
- bzero(data, 7);
- tkt->length = ((data - ((char *)tkt->dat) + 7)/8)*8;
-
- /* Check length of ticket */
- if (tkt->length > (sizeof(KTEXT_ST) - 7)) {
- bzero(tkt->dat, tkt->length);
- tkt->length = 0;
- return KFAILURE /* XXX */;
- }
-
-#ifndef NOENCRYPTION
- key_sched((C_Block *)key,key_s);
- pcbc_encrypt((C_Block *)tkt->dat,(C_Block *)tkt->dat,(long)tkt->length,
- key_s,(C_Block *)key,ENCRYPT);
-#endif
- return 0;
-}
diff --git a/eBones/krb/debug_decl.c b/eBones/krb/debug_decl.c
deleted file mode 100644
index f548e2a..0000000
--- a/eBones/krb/debug_decl.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: debug_decl.c,v 4.5 88/10/07 06:07:49 shanzer Exp $
- * $Id: debug_decl.c,v 1.3 1995/07/18 16:38:14 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: debug_decl.c,v 1.3 1995/07/18 16:38:14 mark Exp $";
-#endif lint
-#endif
-
-/* Declare global debugging variables. */
-
-int krb_ap_req_debug = 0;
-int krb_debug = 0;
diff --git a/eBones/krb/decomp_ticket.c b/eBones/krb/decomp_ticket.c
deleted file mode 100644
index 04316ad..0000000
--- a/eBones/krb/decomp_ticket.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: decomp_ticket.c,v 4.12 89/05/16 18:44:46 jtkohl Exp $
- * $Id: decomp_ticket.c,v 1.3 1995/07/18 16:38:15 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: decomp_ticket.c,v 1.3 1995/07/18 16:38:15 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <stdio.h>
-#include <des.h>
-#include <krb.h>
-#include <prot.h>
-#include <strings.h>
-
-/*
- * This routine takes a ticket and pointers to the variables that
- * should be filled in based on the information in the ticket. It
- * fills in values for its arguments.
- *
- * Note: if the client realm field in the ticket is the null string,
- * then the "prealm" variable is filled in with the local realm (as
- * defined by KRB_REALM).
- *
- * If the ticket byte order is different than the host's byte order
- * (as indicated by the byte order bit of the "flags" field), then
- * the KDC timestamp "time_sec" is byte-swapped. The other fields
- * potentially affected by byte order, "paddress" and "session" are
- * not byte-swapped.
- *
- * The routine returns KFAILURE if any of the "pname", "pinstance",
- * or "prealm" fields is too big, otherwise it returns KSUCCESS.
- *
- * The corresponding routine to generate tickets is create_ticket.
- * When changes are made to this routine, the corresponding changes
- * should also be made to that file.
- *
- * See create_ticket.c for the format of the ticket packet.
- */
-
-int
-decomp_ticket(tkt, flags, pname, pinstance, prealm, paddress, session,
- life, time_sec, sname, sinstance, key, key_s)
- KTEXT tkt; /* The ticket to be decoded */
- unsigned char *flags; /* Kerberos ticket flags */
- char *pname; /* Authentication name */
- char *pinstance; /* Principal's instance */
- char *prealm; /* Principal's authentication domain */
- unsigned long *paddress; /* Net address of entity
- * requesting ticket */
- C_Block session; /* Session key inserted in ticket */
- int *life; /* Lifetime of the ticket */
- unsigned long *time_sec; /* Issue time and date */
- char *sname; /* Service name */
- char *sinstance; /* Service instance */
- C_Block key; /* Service's secret key
- * (to decrypt the ticket) */
- Key_schedule key_s; /* The precomputed key schedule */
-{
- static int tkt_swap_bytes;
- unsigned char *uptr;
- char *ptr = (char *)tkt->dat;
-
-#ifndef NOENCRYPTION
- pcbc_encrypt((C_Block *)tkt->dat,(C_Block *)tkt->dat,(long)tkt->length,
- key_s,(C_Block *)key,DECRYPT);
-#endif /* ! NOENCRYPTION */
-
- *flags = *ptr; /* get flags byte */
- ptr += sizeof(*flags);
- tkt_swap_bytes = 0;
- if (HOST_BYTE_ORDER != ((*flags >> K_FLAG_ORDER)& 1))
- tkt_swap_bytes++;
-
- if (strlen(ptr) > ANAME_SZ)
- return(KFAILURE);
- (void) strcpy(pname,ptr); /* pname */
- ptr += strlen(pname) + 1;
-
- if (strlen(ptr) > INST_SZ)
- return(KFAILURE);
- (void) strcpy(pinstance,ptr); /* instance */
- ptr += strlen(pinstance) + 1;
-
- if (strlen(ptr) > REALM_SZ)
- return(KFAILURE);
- (void) strcpy(prealm,ptr); /* realm */
- ptr += strlen(prealm) + 1;
- /* temporary hack until realms are dealt with properly */
- if (*prealm == 0)
- (void) strcpy(prealm,KRB_REALM);
-
- bcopy(ptr,(char *)paddress,4); /* net address */
- ptr += 4;
-
- bcopy(ptr,(char *)session,8); /* session key */
- ptr+= 8;
-#ifdef notdef /* DONT SWAP SESSION KEY spm 10/22/86 */
- if (tkt_swap_bytes)
- swap_C_Block(session);
-#endif
-
- /* get lifetime, being certain we don't get negative lifetimes */
- uptr = (unsigned char *) ptr++;
- *life = (int) *uptr;
-
- bcopy(ptr,(char *) time_sec,4); /* issue time */
- ptr += 4;
- if (tkt_swap_bytes)
- swap_u_long(*time_sec);
-
- (void) strcpy(sname,ptr); /* service name */
- ptr += 1 + strlen(sname);
-
- (void) strcpy(sinstance,ptr); /* instance */
- ptr += 1 + strlen(sinstance);
- return(KSUCCESS);
-}
diff --git a/eBones/krb/des_rw.c b/eBones/krb/des_rw.c
deleted file mode 100644
index 5b339ee..0000000
--- a/eBones/krb/des_rw.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright (c) 1994 Geoffrey M. Rehmet, Rhodes University
- * All rights reserved.
- *
- * This code is derived from a specification based on software
- * which forms part of the 4.4BSD-Lite distribution, which was developed
- * by the University of California and its contributors.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the entire comment,
- * including the above copyright notice, this list of conditions
- * and the following disclaimer, verbatim, at the beginning of
- * the source file.
- * 2. Redistributions in binary form must reproduce 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 Geoffrey M. Rehmet
- * 4. Neither the name of Geoffrey M. Rehmet nor that of Rhodes University
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL GEOFFREY M. REHMET OR RHODES UNIVERSITY BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Id: des_rw.c,v 1.6 1995/07/18 16:38:17 mark Exp $
- */
-
-/*
- *
- * NB: THESE ROUTINES WILL FAIL IF NON-BLOCKING I/O IS USED.
- *
- */
-
-/*
- * Routines for reading and writing DES encrypted messages onto sockets.
- * (These routines will fail if non-blocking I/O is used.)
- *
- * When a message is written, its length is first transmitted as an int,
- * in network byte order. The encrypted message is then transmitted,
- * to a multiple of 8 bytes. Messages shorter than 8 bytes are right
- * justified into a buffer of length 8 bytes, and the remainder of the
- * buffer is filled with random garbage (before encryption):
- *
- * DDD -------->--+--------+
- * | |
- * +--+--+--+--+--+--+--+--+
- * |x |x |x |x |x |D |D |D |
- * +--+--+--+--+--+--+--+--+
- * | garbage | data |
- * | |
- * +-----------------------+----> des_pcbc_encrypt() -->
- *
- * (Note that the length field sent before the actual message specifies
- * the number of data bytes, not the length of the entire padded message.
- *
- * When data is read, if the message received is longer than the number
- * of bytes requested, then the remaining bytes are stored until the
- * following call to des_read(). If the number of bytes received is
- * less then the number of bytes received, then only the number of bytes
- * actually received is returned.
- *
- * This interface corresponds with the original des_rw.c, except for the
- * bugs in des_read() in the original 4.4BSD version. (One bug is
- * normally not visible, due to undocumented behaviour of
- * des_pcbc_encrypt() in the original MIT libdes.)
- *
- * XXX Todo:
- * 1) Give better error returns on writes
- * 2) Improve error checking on reads
- * 3) Get rid of need for extern decl. of krb_net_read()
- * 4) Tidy garbage generation a bit
- * 5) Make the above comment more readable
- */
-
-#ifdef CRYPT
-#ifdef KERBEROS
-
-#ifndef BUFFER_LEN
-#define BUFFER_LEN 10240
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <sys/param.h>
-#include <sys/types.h>
-
-#include <des.h>
-#include <krb.h>
-
-static des_cblock des_key;
-static des_key_schedule key_schedule;
-
-/*
- * Buffer for storing extra data when more data is received, then was
- * actually requested in des_read().
- */
-static u_char des_buff[BUFFER_LEN];
-static u_char buffer[BUFFER_LEN];
-static unsigned stored = 0;
-static u_char *buff_ptr = buffer;
-
-/*
- * Set the encryption key for des_read() and des_write().
- * inkey is the initial vector for the DES encryption, while insched is
- * the DES key, in unwrapped form.
- */
-
-int
-des_set_key(inkey, insched)
- des_cblock *inkey;
- des_key_schedule insched;
-{
- bcopy(inkey, des_key, sizeof(des_cblock));
- bcopy(insched, &key_schedule, sizeof(des_key_schedule));
- return 0;
-}
-
-/*
- * Clear the key schedule, and initial vector, which were previously
- * stored in static vars by des_set_key().
- */
-void des_clear_key()
-{
- bzero(&des_key, sizeof(des_cblock));
- bzero(&key_schedule, sizeof(des_key_schedule));
-}
-
-int
-des_read(fd, buf, len)
- int fd;
- register char * buf;
- int len;
-{
- int msg_length; /* length of actual message data */
- int pad_length; /* length of padded message */
- int nread; /* number of bytes actually read */
- int nreturned = 0;
-
- if(stored >= len) {
- bcopy(buff_ptr, buf, len);
- stored -= len;
- buff_ptr += len;
- return(len);
- } else {
- if (stored) {
- bcopy(buff_ptr, buf, stored);
- nreturned = stored;
- len -= stored;
- stored = 0;
- buff_ptr = buffer;
- } else {
- nreturned = 0;
- buff_ptr = buffer;
- }
- }
-
- nread = krb_net_read(fd, (char *)&msg_length, sizeof(msg_length));
- if(nread != (int)(sizeof(msg_length)))
- return(0);
-
- msg_length = ntohl(msg_length);
- pad_length = roundup(msg_length, 8);
-
- nread = krb_net_read(fd, des_buff, pad_length);
- if(nread != pad_length)
- return(0);
-
- des_pcbc_encrypt((des_cblock*) des_buff, (des_cblock*) buff_ptr,
- (msg_length < 8 ? 8 : msg_length),
- key_schedule, (des_cblock*) &des_key, DES_DECRYPT);
-
-
- if(msg_length < 8)
- buff_ptr += (8 - msg_length);
- stored = msg_length;
-
- if(stored >= len) {
- bcopy(buff_ptr, buf, len);
- stored -= len;
- buff_ptr += len;
- nreturned += len;
- } else {
- bcopy(buff_ptr, buf, stored);
- nreturned += stored;
- stored = 0;
- }
-
- return(nreturned);
-}
-
-
-/*
- * Write a message onto a file descriptor (generally a socket), using
- * DES to encrypt the message.
- */
-int
-des_write(fd, buf, len)
- int fd;
- char * buf;
- int len;
-{
- static int seeded = 0;
- char garbage[8];
- long rnd;
- int pad_len;
- int write_len;
- int i;
- char *data;
-
- if(len < 8) {
- /*
- * Right justify the message in 8 bytes of random garbage.
- */
- if(!seeded) {
- seeded = 1;
- srandom((unsigned)time(NULL));
- }
-
- for(i = 0 ; i < 8 ; i+= sizeof(long)) {
- rnd = random();
- bcopy(&rnd, garbage+i,
- (i <= (8 - sizeof(long)))?sizeof(long):(8-i));
- }
- bcopy(buf, garbage + 8 - len, len);
- data = garbage;
- pad_len = 8;
- } else {
- data = buf;
- pad_len = roundup(len, 8);
- }
-
- des_pcbc_encrypt((des_cblock*) data, (des_cblock*) des_buff,
- (len < 8)?8:len, key_schedule, (des_cblock*) &des_key, DES_ENCRYPT);
-
-
- write_len = htonl(len);
- if(write(fd, &write_len, sizeof(write_len)) != sizeof(write_len))
- return(-1);
- if(write(fd, des_buff, pad_len) != pad_len)
- return(-1);
-
- return(len);
-}
-
-#endif /* KERBEROS */
-#endif /* CRYPT */
diff --git a/eBones/krb/dest_tkt.c b/eBones/krb/dest_tkt.c
deleted file mode 100644
index df04be0..0000000
--- a/eBones/krb/dest_tkt.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: dest_tkt.c,v 4.9 89/10/02 16:23:07 jtkohl Exp $
- * $Id: dest_tkt.c,v 1.3 1995/07/18 16:38:19 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: dest_tkt.c,v 1.3 1995/07/18 16:38:19 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <krb.h>
-#include <sys/file.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef TKT_SHMEM
-#include <sys/param.h>
-#endif
-#include <errno.h>
-
-/*
- * dest_tkt() is used to destroy the ticket store upon logout.
- * If the ticket file does not exist, dest_tkt() returns RET_TKFIL.
- * Otherwise the function returns RET_OK on success, KFAILURE on
- * failure.
- *
- * The ticket file (TKT_FILE) is defined in "krb.h".
- */
-
-int
-dest_tkt()
-{
- char *file = TKT_FILE;
- int i,fd;
- extern int errno;
- struct stat statb;
- char buf[BUFSIZ];
-#ifdef TKT_SHMEM
- char shmidname[MAXPATHLEN];
-#endif /* TKT_SHMEM */
-
- errno = 0;
- if (lstat(file,&statb) < 0)
- goto out;
-
- if (!(statb.st_mode & S_IFREG)
-#ifdef notdef
- || statb.st_mode & 077
-#endif
- )
- goto out;
-
- if ((fd = open(file, O_RDWR, 0)) < 0)
- goto out;
-
- bzero(buf, BUFSIZ);
-
- for (i = 0; i < statb.st_size; i += BUFSIZ)
- if (write(fd, buf, BUFSIZ) != BUFSIZ) {
- (void) fsync(fd);
- (void) close(fd);
- goto out;
- }
-
- (void) fsync(fd);
- (void) close(fd);
-
- (void) unlink(file);
-
-out:
- if (errno == ENOENT) return RET_TKFIL;
- else if (errno != 0) return KFAILURE;
-#ifdef TKT_SHMEM
- /*
- * handle the shared memory case
- */
- (void) strcpy(shmidname, file);
- (void) strcat(shmidname, ".shm");
- if ((i = krb_shm_dest(shmidname)) != KSUCCESS)
- return(i);
-#endif /* TKT_SHMEM */
- return(KSUCCESS);
-}
diff --git a/eBones/krb/extract_ticket.c b/eBones/krb/extract_ticket.c
deleted file mode 100644
index 8ad3097..0000000
--- a/eBones/krb/extract_ticket.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: extract_ticket.c,v 4.6 88/10/07 06:08:15 shanzer Exp $
- * $Id: extract_ticket.c,v 1.3 1995/07/18 16:38:21 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: extract_ticket.c,v 1.3 1995/07/18 16:38:21 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <krb.h>
-#include <prot.h>
-#include <strings.h>
-
-/*
- * This routine is obsolete.
- *
- * This routine accepts the ciphertext returned by kerberos and
- * extracts the nth ticket. It also fills in the variables passed as
- * session, liftime and kvno.
- */
-
-void
-extract_ticket(cipher,n,session,lifetime,kvno,realm,ticket)
- KTEXT cipher; /* The ciphertext */
- int n; /* Which ticket */
- char *session; /* The session key for this tkt */
- int *lifetime; /* The life of this ticket */
- int *kvno; /* The kvno for the service */
- char *realm; /* Realm in which tkt issued */
- KTEXT ticket; /* The ticket itself */
-{
- char *ptr;
- int i;
-
- /* Start after the ticket lengths */
- ptr = (char *) cipher->dat;
- ptr = ptr + 1 + (int) *(cipher->dat);
-
- /* Step through earlier tickets */
- for (i = 1; i < n; i++)
- ptr = ptr + 11 + strlen(ptr+10) + (int) *(cipher->dat+i);
- bcopy(ptr, (char *) session, 8); /* Save the session key */
- ptr += 8;
- *lifetime = *(ptr++); /* Save the life of the ticket */
- *kvno = *(ptr++); /* Save the kvno */
- (void) strcpy(realm,ptr); /* instance */
- ptr += strlen(realm) + 1;
-
- /* Save the ticket if its length is non zero */
- ticket->length = *(cipher->dat+n);
- if (ticket->length)
- bcopy(ptr, (char *) (ticket->dat), ticket->length);
-}
diff --git a/eBones/krb/fgetst.c b/eBones/krb/fgetst.c
deleted file mode 100644
index 796caca..0000000
--- a/eBones/krb/fgetst.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: fgetst.c,v 4.0 89/01/23 10:08:31 jtkohl Exp $
- * $Id: fgetst.c,v 1.3 1995/07/18 16:38:23 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: fgetst.c,v 1.3 1995/07/18 16:38:23 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <stdio.h>
-
-/*
- * fgetst takes a file descriptor, a character pointer, and a count.
- * It reads from the file it has either read "count" characters, or
- * until it reads a null byte. When finished, what has been read exists
- * in "s". If "count" characters were actually read, the last is changed
- * to a null, so the returned string is always null-terminated. fgetst
- * returns the number of characters read, including the null terminator.
- */
-
-int
-fgetst(f, s, n)
- FILE *f;
- register char *s;
- int n;
-{
- register int count = n;
- int ch; /* NOT char; otherwise you don't see EOF */
-
- while ((ch = getc(f)) != EOF && ch && --count) {
- *s++ = ch;
- }
- *s = '\0';
- return (n - count);
-}
diff --git a/eBones/krb/get_ad_tkt.c b/eBones/krb/get_ad_tkt.c
deleted file mode 100644
index f96644a..0000000
--- a/eBones/krb/get_ad_tkt.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: get_ad_tkt.c,v 4.15 89/07/07 15:18:51 jtkohl Exp $
- * $Id: get_ad_tkt.c,v 1.3 1995/07/18 16:38:25 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: get_ad_tkt.c,v 1.3 1995/07/18 16:38:25 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <krb.h>
-#include <des.h>
-#include <prot.h>
-#include <strings.h>
-
-#include <stdio.h>
-#include <errno.h>
-
-/* use the bsd time.h struct defs for PC too! */
-#include <sys/time.h>
-#include <sys/types.h>
-
-extern int krb_debug;
-
-struct timeval tt_local = { 0, 0 };
-
-int swap_bytes;
-unsigned long rep_err_code;
-
-/*
- * get_ad_tkt obtains a new service ticket from Kerberos, using
- * the ticket-granting ticket which must be in the ticket file.
- * It is typically called by krb_mk_req() when the client side
- * of an application is creating authentication information to be
- * sent to the server side.
- *
- * get_ad_tkt takes four arguments: three pointers to strings which
- * contain the name, instance, and realm of the service for which the
- * ticket is to be obtained; and an integer indicating the desired
- * lifetime of the ticket.
- *
- * It returns an error status if the ticket couldn't be obtained,
- * or AD_OK if all went well. The ticket is stored in the ticket
- * cache.
- *
- * The request sent to the Kerberos ticket-granting service looks
- * like this:
- *
- * pkt->dat
- *
- * TEXT original contents of authenticator+ticket
- * pkt->dat built in krb_mk_req call
- *
- * 4 bytes time_ws always 0 (?)
- * char lifetime lifetime argument passed
- * string service service name argument
- * string sinstance service instance arg.
- *
- * See "prot.h" for the reply packet layout and definitions of the
- * extraction macros like pkt_version(), pkt_msg_type(), etc.
- */
-
-int
-get_ad_tkt(service,sinstance,realm,lifetime)
- char *service;
- char *sinstance;
- char *realm;
- int lifetime;
-{
- static KTEXT_ST pkt_st;
- KTEXT pkt = & pkt_st; /* Packet to KDC */
- static KTEXT_ST rpkt_st;
- KTEXT rpkt = &rpkt_st; /* Returned packet */
- static KTEXT_ST cip_st;
- KTEXT cip = &cip_st; /* Returned Ciphertext */
- static KTEXT_ST tkt_st;
- KTEXT tkt = &tkt_st; /* Current ticket */
- C_Block ses; /* Session key for tkt */
- CREDENTIALS cr;
- int kvno; /* Kvno for session key */
- char lrealm[REALM_SZ];
- C_Block key; /* Key for decrypting cipher */
- Key_schedule key_s;
- long time_ws = 0;
-
- char s_name[SNAME_SZ];
- char s_instance[INST_SZ];
- int msg_byte_order;
- int kerror;
- char rlm[REALM_SZ];
- char *ptr;
-
- unsigned long kdc_time; /* KDC time */
-
- if ((kerror = krb_get_tf_realm(TKT_FILE, lrealm)) != KSUCCESS)
- return(kerror);
-
- /* Create skeleton of packet to be sent */
- (void) gettimeofday(&tt_local,(struct timezone *) 0);
-
- pkt->length = 0;
-
- /*
- * Look for the session key (and other stuff we don't need)
- * in the ticket file for krbtgt.realm@lrealm where "realm"
- * is the service's realm (passed in "realm" argument) and
- * lrealm is the realm of our initial ticket. If we don't
- * have this, we will try to get it.
- */
-
- if ((kerror = krb_get_cred("krbtgt",realm,lrealm,&cr)) != KSUCCESS) {
- /*
- * If realm == lrealm, we have no hope, so let's not even try.
- */
- if ((strncmp(realm, lrealm, REALM_SZ)) == 0)
- return(AD_NOTGT);
- else{
- if ((kerror =
- get_ad_tkt("krbtgt",realm,lrealm,lifetime)) != KSUCCESS)
- return(kerror);
- if ((kerror = krb_get_cred("krbtgt",realm,lrealm,&cr)) != KSUCCESS)
- return(kerror);
- }
- }
-
- /*
- * Make up a request packet to the "krbtgt.realm@lrealm".
- * Start by calling krb_mk_req() which puts ticket+authenticator
- * into "pkt". Then tack other stuff on the end.
- */
-
- kerror = krb_mk_req(pkt,"krbtgt",realm,lrealm,0L);
-
- if (kerror)
- return(AD_NOTGT);
-
- /* timestamp */
- bcopy((char *) &time_ws,(char *) (pkt->dat+pkt->length),4);
- pkt->length += 4;
- *(pkt->dat+(pkt->length)++) = (char) lifetime;
- (void) strcpy((char *) (pkt->dat+pkt->length),service);
- pkt->length += 1 + strlen(service);
- (void) strcpy((char *)(pkt->dat+pkt->length),sinstance);
- pkt->length += 1 + strlen(sinstance);
-
- rpkt->length = 0;
-
- /* Send the request to the local ticket-granting server */
- if ((kerror = send_to_kdc(pkt, rpkt, realm))) return(kerror);
-
- /* check packet version of the returned packet */
- if (pkt_version(rpkt) != KRB_PROT_VERSION )
- return(INTK_PROT);
-
- /* Check byte order */
- msg_byte_order = pkt_msg_type(rpkt) & 1;
- swap_bytes = 0;
- if (msg_byte_order != HOST_BYTE_ORDER)
- swap_bytes++;
-
- switch (pkt_msg_type(rpkt) & ~1) {
- case AUTH_MSG_KDC_REPLY:
- break;
- case AUTH_MSG_ERR_REPLY:
- bcopy(pkt_err_code(rpkt), (char *) &rep_err_code, 4);
- if (swap_bytes)
- swap_u_long(rep_err_code);
- return(rep_err_code);
-
- default:
- return(INTK_PROT);
- }
-
- /* Extract the ciphertext */
- cip->length = pkt_clen(rpkt); /* let clen do the swap */
-
- bcopy((char *) pkt_cipher(rpkt),(char *) (cip->dat),cip->length);
-
-#ifndef NOENCRYPTION
- key_sched((C_Block *)cr.session,key_s);
- pcbc_encrypt((C_Block *)cip->dat,(C_Block *)cip->dat,(long)cip->length,
- key_s,(C_Block *)cr.session,DECRYPT);
-#endif
- /* Get rid of all traces of key */
- bzero((char *) cr.session, sizeof(key));
- bzero((char *) key_s, sizeof(key_s));
-
- ptr = (char *) cip->dat;
-
- bcopy(ptr,(char *)ses,8);
- ptr += 8;
-
- (void) strcpy(s_name,ptr);
- ptr += strlen(s_name) + 1;
-
- (void) strcpy(s_instance,ptr);
- ptr += strlen(s_instance) + 1;
-
- (void) strcpy(rlm,ptr);
- ptr += strlen(rlm) + 1;
-
- lifetime = (unsigned long) ptr[0];
- kvno = (unsigned long) ptr[1];
- tkt->length = (int) ptr[2];
- ptr += 3;
- bcopy(ptr,(char *)(tkt->dat),tkt->length);
- ptr += tkt->length;
-
- if (strcmp(s_name, service) || strcmp(s_instance, sinstance) ||
- strcmp(rlm, realm)) /* not what we asked for */
- return(INTK_ERR); /* we need a better code here XXX */
-
- /* check KDC time stamp */
- bcopy(ptr,(char *)&kdc_time,4); /* Time (coarse) */
- if (swap_bytes) swap_u_long(kdc_time);
-
- ptr += 4;
-
- (void) gettimeofday(&tt_local,(struct timezone *) 0);
- if (abs((int)(tt_local.tv_sec - kdc_time)) > CLOCK_SKEW) {
- return(RD_AP_TIME); /* XXX should probably be better
- code */
- }
-
- if ((kerror = save_credentials(s_name,s_instance,rlm,ses,lifetime,
- kvno,tkt,tt_local.tv_sec)))
- return(kerror);
-
- return(AD_OK);
-}
diff --git a/eBones/krb/get_admhst.c b/eBones/krb/get_admhst.c
deleted file mode 100644
index a01a40f..0000000
--- a/eBones/krb/get_admhst.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: get_admhst.c,v 4.0 89/01/23 10:08:55 jtkohl Exp $
- * $Id: get_admhst.c,v 1.3 1995/07/18 16:38:27 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: get_admhst.c,v 1.3 1995/07/18 16:38:27 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <stdio.h>
-#include <krb.h>
-#include <string.h>
-
-/*
- * Given a Kerberos realm, find a host on which the Kerberos database
- * administration server can be found.
- *
- * krb_get_admhst takes a pointer to be filled in, a pointer to the name
- * of the realm for which a server is desired, and an integer n, and
- * returns (in h) the nth administrative host entry from the configuration
- * file (KRB_CONF, defined in "krb.h") associated with the specified realm.
- *
- * On error, get_admhst returns KFAILURE. If all goes well, the routine
- * returns KSUCCESS.
- *
- * For the format of the KRB_CONF file, see comments describing the routine
- * krb_get_krbhst().
- *
- * This is a temporary hack to allow us to find the nearest system running
- * a Kerberos admin server. In the long run, this functionality will be
- * provided by a nameserver.
- */
-
-int
-krb_get_admhst(h, r, n)
- char *h;
- char *r;
- int n;
-{
- FILE *cnffile;
- char tr[REALM_SZ];
- char linebuf[BUFSIZ];
- char scratch[64];
- register int i;
-
- if ((cnffile = fopen(KRB_CONF,"r")) == NULL) {
- return(KFAILURE);
- }
- if (fgets(linebuf, BUFSIZ, cnffile) == NULL) {
- /* error reading */
- (void) fclose(cnffile);
- return(KFAILURE);
- }
- if (!index(linebuf, '\n')) {
- /* didn't all fit into buffer, punt */
- (void) fclose(cnffile);
- return(KFAILURE);
- }
- for (i = 0; i < n; ) {
- /* run through the file, looking for admin host */
- if (fgets(linebuf, BUFSIZ, cnffile) == NULL) {
- (void) fclose(cnffile);
- return(KFAILURE);
- }
- /* need to scan for a token after 'admin' to make sure that
- admin matched correctly */
- if (sscanf(linebuf, "%s %s admin %s", tr, h, scratch) != 3)
- continue;
- if (!strcmp(tr,r))
- i++;
- }
- (void) fclose(cnffile);
- return(KSUCCESS);
-}
diff --git a/eBones/krb/get_cred.c b/eBones/krb/get_cred.c
deleted file mode 100644
index 6023386..0000000
--- a/eBones/krb/get_cred.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: get_cred.c,v 4.10 89/05/31 17:46:22 jtkohl Exp $
- * $Id: get_cred.c,v 1.3 1995/07/18 16:38:28 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: get_cred.c,v 1.3 1995/07/18 16:38:28 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <stdio.h>
-#include <krb.h>
-
-/*
- * krb_get_cred takes a service name, instance, and realm, and a
- * structure of type CREDENTIALS to be filled in with ticket
- * information. It then searches the ticket file for the appropriate
- * ticket and fills in the structure with the corresponding
- * information from the file. If successful, it returns KSUCCESS.
- * On failure it returns a Kerberos error code.
- */
-
-int
-krb_get_cred(service,instance,realm,c)
- char *service; /* Service name */
- char *instance; /* Instance */
- char *realm; /* Auth domain */
- CREDENTIALS *c; /* Credentials struct */
-{
- int tf_status; /* return value of tf function calls */
-
- /* Open ticket file and lock it for shared reading */
- if ((tf_status = tf_init(TKT_FILE, R_TKT_FIL)) != KSUCCESS)
- return(tf_status);
-
- /* Copy principal's name and instance into the CREDENTIALS struc c */
-
- if ( (tf_status = tf_get_pname(c->pname)) != KSUCCESS ||
- (tf_status = tf_get_pinst(c->pinst)) != KSUCCESS )
- return (tf_status);
-
- /* Search for requested service credentials and copy into c */
-
- while ((tf_status = tf_get_cred(c)) == KSUCCESS) {
- /* Is this the right ticket? */
- if ((strcmp(c->service,service) == 0) &&
- (strcmp(c->instance,instance) == 0) &&
- (strcmp(c->realm,realm) == 0))
- break;
- }
- (void) tf_close();
-
- if (tf_status == EOF)
- return (GC_NOTKT);
- return(tf_status);
-}
diff --git a/eBones/krb/get_in_tkt.c b/eBones/krb/get_in_tkt.c
deleted file mode 100644
index b95f073..0000000
--- a/eBones/krb/get_in_tkt.c
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: get_in_tkt.c,v 4.12 89/07/18 16:32:56 jtkohl Exp $
- * $Id: get_in_tkt.c,v 1.3 1995/07/18 16:38:30 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: get_in_tkt.c,v 1.3 1995/07/18 16:38:30 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <krb.h>
-#include <prot.h>
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/*
- * This file contains two routines: passwd_to_key() converts
- * a password into a DES key (prompting for the password if
- * not supplied), and krb_get_pw_in_tkt() gets an initial ticket for
- * a user.
- */
-
-/*
- * passwd_to_key(): given a password, return a DES key.
- * There are extra arguments here which (used to be?)
- * used by srvtab_to_key().
- *
- * If the "passwd" argument is not null, generate a DES
- * key from it, using string_to_key().
- *
- * If the "passwd" argument is null, call des_read_password()
- * to prompt for a password and then convert it into a DES key.
- *
- * In either case, the resulting key is put in the "key" argument,
- * and 0 is returned.
- */
-
-/*ARGSUSED */
-static int passwd_to_key(user,instance,realm,passwd,key)
- char *user, *instance, *realm, *passwd;
- C_Block *key;
-{
-#ifdef NOENCRYPTION
- if (!passwd)
- placebo_read_password(key, "Password: ", 0);
-#else
- if (passwd)
- string_to_key(passwd,key);
- else
- des_read_password(key,"Password: ",0);
-#endif
- return (0);
-}
-
-/*
- * krb_get_pw_in_tkt() takes the name of the server for which the initial
- * ticket is to be obtained, the name of the principal the ticket is
- * for, the desired lifetime of the ticket, and the user's password.
- * It passes its arguments on to krb_get_in_tkt(), which contacts
- * Kerberos to get the ticket, decrypts it using the password provided,
- * and stores it away for future use.
- *
- * krb_get_pw_in_tkt() passes two additional arguments to krb_get_in_tkt():
- * the name of a routine (passwd_to_key()) to be used to get the
- * password in case the "password" argument is null and NULL for the
- * decryption procedure indicating that krb_get_in_tkt should use the
- * default method of decrypting the response from the KDC.
- *
- * The result of the call to krb_get_in_tkt() is returned.
- */
-
-int
-krb_get_pw_in_tkt(user,instance,realm,service,sinstance,life,password)
- char *user, *instance, *realm, *service, *sinstance;
- int life;
- char *password;
-{
- return(krb_get_in_tkt(user,instance,realm,service,sinstance,life,
- passwd_to_key, NULL, password));
-}
-
-#ifdef NOENCRYPTION
-/*
- * $Source: /usr/cvs/src/eBones/krb/get_in_tkt.c,v $
- * $Author: mark $
- *
- * 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.
- */
-
-#include <des.h>
-#include "conf.h"
-
-#include <stdio.h>
-#ifdef BSDUNIX
-#include <strings.h>
-#include <sys/ioctl.h>
-#include <signal.h>
-#include <setjmp.h>
-#else
-/* char *strcpy();
-int strcmp(); */
-#endif
-
-#ifdef BSDUNIX
-static jmp_buf env;
-#endif
-
-#ifdef BSDUNIX
-static void sig_restore();
-static push_signals(), pop_signals();
-int placebo_read_pw_string();
-#endif
-
-/*** Routines ****************************************************** */
-int
-placebo_read_password(k,prompt,verify)
- des_cblock *k;
- char *prompt;
- int verify;
-{
- int ok;
- char key_string[BUFSIZ];
-
-#ifdef BSDUNIX
- if (setjmp(env)) {
- ok = -1;
- goto lose;
- }
-#endif
-
- ok = placebo_read_pw_string(key_string, BUFSIZ, prompt, verify);
- if (ok == 0)
- bzero(k, sizeof(C_Block));
-
-lose:
- bzero(key_string, sizeof (key_string));
- return ok;
-}
-
-/*
- * This version just returns the string, doesn't map to key.
- *
- * Returns 0 on success, non-zero on failure.
- */
-
-int
-placebo_read_pw_string(s,max,prompt,verify)
- char *s;
- int max;
- char *prompt;
- int verify;
-{
- int ok = 0;
- char *ptr;
-
-#ifdef BSDUNIX
- jmp_buf old_env;
- struct sgttyb tty_state;
-#endif
- char key_string[BUFSIZ];
-
- if (max > BUFSIZ) {
- return -1;
- }
-
-#ifdef BSDUNIX
- bcopy(old_env, env, sizeof(env));
- if (setjmp(env))
- goto lose;
-
- /* save terminal state*/
- if (ioctl(0,TIOCGETP,&tty_state) == -1)
- return -1;
-
- push_signals();
- /* Turn off echo */
- tty_state.sg_flags &= ~ECHO;
- if (ioctl(0,TIOCSETP,&tty_state) == -1)
- return -1;
-#endif
- while (!ok) {
- printf(prompt);
- fflush(stdout);
-#ifdef CROSSMSDOS
- h19line(s,sizeof(s),0);
- if (!strlen(s))
- continue;
-#else
- if (!fgets(s, max, stdin)) {
- clearerr(stdin);
- continue;
- }
- if ((ptr = index(s, '\n')))
- *ptr = '\0';
-#endif
- if (verify) {
- printf("\nVerifying, please re-enter %s",prompt);
- fflush(stdout);
-#ifdef CROSSMSDOS
- h19line(key_string,sizeof(key_string),0);
- if (!strlen(key_string))
- continue;
-#else
- if (!fgets(key_string, sizeof(key_string), stdin)) {
- clearerr(stdin);
- continue;
- }
- if ((ptr = index(key_string, '\n')))
- *ptr = '\0';
-#endif
- if (strcmp(s,key_string)) {
- printf("\n\07\07Mismatch - try again\n");
- fflush(stdout);
- continue;
- }
- }
- ok = 1;
- }
-
-#ifdef BSDUNIX
-lose:
- if (!ok)
- bzero(s, max);
- printf("\n");
- /* turn echo back on */
- tty_state.sg_flags |= ECHO;
- if (ioctl(0,TIOCSETP,&tty_state))
- ok = 0;
- pop_signals();
- bcopy(env, old_env, sizeof(env));
-#endif
- if (verify)
- bzero(key_string, sizeof (key_string));
- s[max-1] = 0; /* force termination */
- return !ok; /* return nonzero if not okay */
-}
-
-#ifdef BSDUNIX
-/*
- * this can be static since we should never have more than
- * one set saved....
- */
-#ifdef POSIX
-static void (*old_sigfunc[NSIG])();
-#else
-static int (*old_sigfunc[NSIG])();
-#endif POSIX
-
-static push_signals()
-{
- register i;
- for (i = 0; i < NSIG; i++)
- old_sigfunc[i] = signal(i,sig_restore);
-}
-
-static pop_signals()
-{
- register i;
- for (i = 0; i < NSIG; i++)
- signal(i,old_sigfunc[i]);
-}
-
-static void sig_restore(sig,code,scp)
- int sig,code;
- struct sigcontext *scp;
-{
- longjmp(env,1);
-}
-#endif
-#endif /* NOENCRYPTION */
diff --git a/eBones/krb/get_krbhst.c b/eBones/krb/get_krbhst.c
deleted file mode 100644
index cfc6e1c..0000000
--- a/eBones/krb/get_krbhst.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: get_krbhst.c,v 4.8 89/01/22 20:00:29 rfrench Exp $
- * $Id: get_krbhst.c,v 1.3 1995/07/18 16:38:32 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: get_krbhst.c,v 1.3 1995/07/18 16:38:32 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <stdio.h>
-#include <krb.h>
-#include <strings.h>
-
-/*
- * Given a Kerberos realm, find a host on which the Kerberos authenti-
- * cation server can be found.
- *
- * krb_get_krbhst takes a pointer to be filled in, a pointer to the name
- * of the realm for which a server is desired, and an integer, n, and
- * returns (in h) the nth entry from the configuration file (KRB_CONF,
- * defined in "krb.h") associated with the specified realm.
- *
- * On end-of-file, krb_get_krbhst returns KFAILURE. If n=1 and the
- * configuration file does not exist, krb_get_krbhst will return KRB_HOST
- * (also defined in "krb.h"). If all goes well, the routine returnes
- * KSUCCESS.
- *
- * The KRB_CONF file contains the name of the local realm in the first
- * line (not used by this routine), followed by lines indicating realm/host
- * entries. The words "admin server" following the hostname indicate that
- * the host provides an administrative database server.
- *
- * For example:
- *
- * ATHENA.MIT.EDU
- * ATHENA.MIT.EDU kerberos-1.mit.edu admin server
- * ATHENA.MIT.EDU kerberos-2.mit.edu
- * LCS.MIT.EDU kerberos.lcs.mit.edu admin server
- *
- * This is a temporary hack to allow us to find the nearest system running
- * kerberos. In the long run, this functionality will be provided by a
- * nameserver.
- */
-
-int
-krb_get_krbhst(h,r,n)
- char *h;
- char *r;
- int n;
-{
- FILE *cnffile;
- char tr[REALM_SZ];
- char linebuf[BUFSIZ];
- register int i;
-
- if ((cnffile = fopen(KRB_CONF,"r")) == NULL) {
- if (n==1) {
- (void) strcpy(h,KRB_HOST);
- return(KSUCCESS);
- }
- else
- return(KFAILURE);
- }
- if (fscanf(cnffile,"%s",tr) == EOF)
- return(KFAILURE);
- /* run through the file, looking for the nth server for this realm */
- for (i = 1; i <= n;) {
- if (fgets(linebuf, BUFSIZ, cnffile) == NULL) {
- (void) fclose(cnffile);
- return(KFAILURE);
- }
- if (sscanf(linebuf, "%s %s", tr, h) != 2)
- continue;
- if (!strcmp(tr,r))
- i++;
- }
- (void) fclose(cnffile);
- return(KSUCCESS);
-}
diff --git a/eBones/krb/get_krbrlm.c b/eBones/krb/get_krbrlm.c
deleted file mode 100644
index a4803e5..0000000
--- a/eBones/krb/get_krbrlm.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: get_krbrlm.c,v 4.8 89/01/22 20:02:54 rfrench Exp $
- * $Id: get_krbrlm.c,v 1.3 1995/07/18 16:38:34 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: get_krbrlm.c,v 1.3 1995/07/18 16:38:34 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <stdio.h>
-#include <krb.h>
-#include <strings.h>
-
-/*
- * krb_get_lrealm takes a pointer to a string, and a number, n. It fills
- * in the string, r, with the name of the nth realm specified on the
- * first line of the kerberos config file (KRB_CONF, defined in "krb.h").
- * It returns 0 (KSUCCESS) on success, and KFAILURE on failure. If the
- * config file does not exist, and if n=1, a successful return will occur
- * with r = KRB_REALM (also defined in "krb.h").
- *
- * NOTE: for archaic & compatibility reasons, this routine will only return
- * valid results when n = 1.
- *
- * For the format of the KRB_CONF file, see comments describing the routine
- * krb_get_krbhst().
- */
-
-int
-krb_get_lrealm(r,n)
- char *r;
- int n;
-{
- FILE *cnffile, *fopen();
-
- if (n > 1)
- return(KFAILURE); /* Temporary restriction */
-
- if ((cnffile = fopen(KRB_CONF, "r")) == NULL) {
- if (n == 1) {
- (void) strcpy(r, KRB_REALM);
- return(KSUCCESS);
- }
- else
- return(KFAILURE);
- }
-
- if (fscanf(cnffile,"%s",r) != 1) {
- (void) fclose(cnffile);
- return(KFAILURE);
- }
- (void) fclose(cnffile);
- return(KSUCCESS);
-}
diff --git a/eBones/krb/get_phost.c b/eBones/krb/get_phost.c
deleted file mode 100644
index cd83b2d..0000000
--- a/eBones/krb/get_phost.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: get_phost.c,v 4.6 89/01/23 09:25:40 jtkohl Exp $
- * $Id: get_phost.c,v 1.3 1995/07/18 16:38:35 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: get_phost.c,v 1.3 1995/07/18 16:38:35 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <stdio.h>
-#include <ctype.h>
-#include <netdb.h>
-
-char *index();
-
-/*
- * This routine takes an alias for a host name and returns the first
- * field, lower case, of its domain name. For example, if "menel" is
- * an alias for host officially named "menelaus" (in /etc/hosts), for
- * the host whose official name is "MENELAUS.MIT.EDU", the name "menelaus"
- * is returned.
- *
- * This is done for historical Athena reasons: the Kerberos name of
- * rcmd servers (rlogin, rsh, rcp) is of the form "rcmd.host@realm"
- * where "host"is the lowercase for of the host name ("menelaus").
- * This should go away: the instance should be the domain name
- * (MENELAUS.MIT.EDU). But for now we need this routine...
- *
- * A pointer to the name is returned, if found, otherwise a pointer
- * to the original "alias" argument is returned.
- */
-
-char * krb_get_phost(alias)
- char *alias;
-{
- struct hostent *h;
- char *phost = alias;
- if ((h=gethostbyname(alias)) != (struct hostent *)NULL ) {
- char *p = index( h->h_name, '.' );
- if (p)
- *p = NULL;
- p = phost = h->h_name;
- do {
- if (isupper(*p)) *p=tolower(*p);
- } while (*p++);
- }
- return(phost);
-}
diff --git a/eBones/krb/get_pw_tkt.c b/eBones/krb/get_pw_tkt.c
deleted file mode 100644
index 48b6126..0000000
--- a/eBones/krb/get_pw_tkt.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: get_pw_tkt.c,v 4.6 89/01/13 18:19:11 steiner Exp $
- * $Id: get_pw_tkt.c,v 1.3 1995/07/18 16:38:37 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: get_pw_tkt.c,v 1.3 1995/07/18 16:38:37 mark Exp $";
-#endif /* lint */
-#endif
-
-
-#include <krb.h>
-
-/*
- * Get a ticket for the password-changing server ("changepw.KRB_MASTER").
- *
- * Given the name, instance, realm, and current password of the
- * principal for which the user wants a password-changing-ticket,
- * return either:
- *
- * GT_PW_BADPW if current password was wrong,
- * GT_PW_NULL if principal had a NULL password,
- * or the result of the krb_get_pw_in_tkt() call.
- *
- * First, try to get a ticket for "user.instance@realm" to use the
- * "changepw.KRB_MASTER" server (KRB_MASTER is defined in "krb.h").
- * The requested lifetime for the ticket is "1", and the current
- * password is the "cpw" argument given.
- *
- * If the password was bad, give up.
- *
- * If the principal had a NULL password in the Kerberos database
- * (indicating that the principal is known to Kerberos, but hasn't
- * got a password yet), try instead to get a ticket for the principal
- * "default.changepw@realm" to use the "changepw.KRB_MASTER" server.
- * Use the password "changepwkrb" instead of "cpw". Return GT_PW_NULL
- * if all goes well, otherwise the error.
- *
- * If this routine succeeds, a ticket and session key for either the
- * principal "user.instance@realm" or "default.changepw@realm" to use
- * the password-changing server will be in the user's ticket file.
- */
-
-int
-get_pw_tkt(user,instance,realm,cpw)
- char *user;
- char *instance;
- char *realm;
- char *cpw;
-{
- int kerror;
-
- kerror = krb_get_pw_in_tkt(user, instance, realm, "changepw",
- KRB_MASTER, 1, cpw);
-
- if (kerror == INTK_BADPW)
- return(GT_PW_BADPW);
-
- if (kerror == KDC_NULL_KEY) {
- kerror = krb_get_pw_in_tkt("default","changepw",realm,"changepw",
- KRB_MASTER,1,"changepwkrb");
- if (kerror)
- return(kerror);
- return(GT_PW_NULL);
- }
-
- return(kerror);
-}
diff --git a/eBones/krb/get_request.c b/eBones/krb/get_request.c
deleted file mode 100644
index c4982bf3..0000000
--- a/eBones/krb/get_request.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: get_request.c,v 4.7 88/12/01 14:00:11 jtkohl Exp $
- * $Id: get_request.c,v 1.3 1995/07/18 16:38:39 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: get_request.c,v 1.3 1995/07/18 16:38:39 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <krb.h>
-#include <prot.h>
-
-/*
- * This procedure is obsolete. It is used in the kerberos_slave
- * code for Version 3 tickets.
- *
- * This procedure sets s_name, and instance to point to
- * the corresponding fields from tne nth request in the packet.
- * it returns the lifetime requested. Garbage will be returned
- * if there are less than n requests in the packet.
- */
-
-int
-get_request(pkt, n, s_name, instance)
- KTEXT pkt; /* The packet itself */
- int n; /* Which request do we want */
- char **s_name; /* Service name to be filled in */
- char **instance; /* Instance name to be filled in */
-{
- /* Go to the beginning of the request list */
- char *ptr = (char *) pkt_a_realm(pkt) + 6 +
- strlen((char *)pkt_a_realm(pkt));
-
- /* Read requests until we hit the right one */
- while (n-- > 1) {
- ptr++;
- ptr += 1 + strlen(ptr);
- ptr += 1 + strlen(ptr);
- }
-
- /* Set the arguments to point to the right place */
- *s_name = 1 + ptr;
- *instance = 2 + ptr + strlen(*s_name);
-
- /* Return the requested lifetime */
- return((int) *ptr);
-}
diff --git a/eBones/krb/get_svc_in_tkt.c b/eBones/krb/get_svc_in_tkt.c
deleted file mode 100644
index f5680db..0000000
--- a/eBones/krb/get_svc_in_tkt.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: get_svc_in_tkt.c,v 4.9 89/07/18 16:33:34 jtkohl Exp $
- * $Id: get_svc_in_tkt.c,v 1.3 1995/07/18 16:38:41 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: get_svc_in_tkt.c,v 1.3 1995/07/18 16:38:41 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <krb.h>
-#include <prot.h>
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/*
- * This file contains two routines: srvtab_to_key(), which gets
- * a server's key from a srvtab file, and krb_get_svc_in_tkt() which
- * gets an initial ticket for a server.
- */
-
-/*
- * srvtab_to_key(): given a "srvtab" file (where the keys for the
- * service on a host are stored), return the private key of the
- * given service (user.instance@realm).
- *
- * srvtab_to_key() passes its arguments on to read_service_key(),
- * plus one additional argument, the key version number.
- * (Currently, the key version number is always 0; this value
- * is treated as a wildcard by read_service_key().)
- *
- * If the "srvtab" argument is null, KEYFILE (defined in "krb.h")
- * is passed in its place.
- *
- * It returns the return value of the read_service_key() call.
- * The service key is placed in "key".
- */
-
-static int
-srvtab_to_key(user, instance, realm, srvtab, key)
- char *user, *instance, *realm, *srvtab;
- C_Block key;
-{
- if (!srvtab)
- srvtab = KEYFILE;
-
- return(read_service_key(user, instance, realm, 0, srvtab,
- (char *)key));
-}
-
-/*
- * krb_get_svc_in_tkt() passes its arguments on to krb_get_in_tkt(),
- * plus two additional arguments: a pointer to the srvtab_to_key()
- * function to be used to get the key from the key file and a NULL
- * for the decryption procedure indicating that krb_get_in_tkt should
- * use the default method of decrypting the response from the KDC.
- *
- * It returns the return value of the krb_get_in_tkt() call.
- */
-
-int
-krb_get_svc_in_tkt(user, instance, realm, service, sinstance, life, srvtab)
- char *user, *instance, *realm, *service, *sinstance;
- int life;
- char *srvtab;
-{
- return(krb_get_in_tkt(user, instance, realm, service, sinstance,
- life, srvtab_to_key, NULL, srvtab));
-}
diff --git a/eBones/krb/get_tf_fullname.c b/eBones/krb/get_tf_fullname.c
deleted file mode 100644
index 8d76399..0000000
--- a/eBones/krb/get_tf_fullname.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: get_tf_fullname.c,v 4.3 90/03/10 22:40:20 jon Exp $
- * $Id: get_tf_fullname.c,v 1.3 1995/07/18 16:38:42 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: get_tf_fullname.c,v 1.3 1995/07/18 16:38:42 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <krb.h>
-#include <strings.h>
-#include <stdio.h>
-
-/*
- * This file contains a routine to extract the fullname of a user
- * from the ticket file.
- */
-
-/*
- * krb_get_tf_fullname() takes four arguments: the name of the
- * ticket file, and variables for name, instance, and realm to be
- * returned in. Since the realm of a ticket file is not really fully
- * supported, the realm used will be that of the the first ticket in
- * the file as this is the one that was obtained with a password by
- * krb_get_in_tkt().
- */
-
-int
-krb_get_tf_fullname(ticket_file, name, instance, realm)
- char *ticket_file;
- char *name;
- char *instance;
- char *realm;
-{
- int tf_status;
- CREDENTIALS c;
-
- if ((tf_status = tf_init(ticket_file, R_TKT_FIL)) != KSUCCESS)
- return(tf_status);
-
- if (((tf_status = tf_get_pname(c.pname)) != KSUCCESS) ||
- ((tf_status = tf_get_pinst(c.pinst)) != KSUCCESS))
- return (tf_status);
-
- if (name)
- strcpy(name, c.pname);
- if (instance)
- strcpy(instance, c.pinst);
- if ((tf_status = tf_get_cred(&c)) == KSUCCESS) {
- if (realm)
- strcpy(realm, c.realm);
- }
- else {
- if (tf_status == EOF)
- return(KFAILURE);
- else
- return(tf_status);
- }
- (void) tf_close();
-
- return(tf_status);
-}
diff --git a/eBones/krb/get_tf_realm.c b/eBones/krb/get_tf_realm.c
deleted file mode 100644
index 8d75a9d..0000000
--- a/eBones/krb/get_tf_realm.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: get_tf_realm.c,v 4.2 90/01/02 13:40:19 jtkohl Exp $
- * $Id: get_tf_realm.c,v 1.3 1995/07/18 16:38:44 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: get_tf_realm.c,v 1.3 1995/07/18 16:38:44 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <krb.h>
-#include <strings.h>
-
-/*
- * This file contains a routine to extract the realm of a kerberos
- * ticket file.
- */
-
-/*
- * krb_get_tf_realm() takes two arguments: the name of a ticket
- * and a variable to store the name of the realm in.
- *
- */
-
-int
-krb_get_tf_realm(ticket_file, realm)
- char *ticket_file;
- char *realm;
-{
- return(krb_get_tf_fullname(ticket_file, 0, 0, realm));
-}
diff --git a/eBones/krb/getrealm.c b/eBones/krb/getrealm.c
deleted file mode 100644
index dcd4d28..0000000
--- a/eBones/krb/getrealm.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * routine to convert hostname into realm name.
- *
- * from: getrealm.c,v 4.6 90/01/02 13:35:56 jtkohl Exp $
- * $Id: getrealm.c,v 1.3 1995/07/18 16:38:46 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: getrealm.c,v 1.3 1995/07/18 16:38:46 mark Exp $";
-#endif lint
-#endif
-
-#include <strings.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <krb.h>
-#include <sys/param.h>
-
-/* for Ultrix and friends ... */
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 64
-#endif
-
-/*
- * krb_realmofhost.
- * Given a fully-qualified domain-style primary host name,
- * return the name of the Kerberos realm for the host.
- * If the hostname contains no discernable domain, or an error occurs,
- * return the local realm name, as supplied by get_krbrlm().
- * If the hostname contains a domain, but no translation is found,
- * the hostname's domain is converted to upper-case and returned.
- *
- * The format of each line of the translation file is:
- * domain_name kerberos_realm
- * -or-
- * host_name kerberos_realm
- *
- * domain_name should be of the form .XXX.YYY (e.g. .LCS.MIT.EDU)
- * host names should be in the usual form (e.g. FOO.BAR.BAZ)
- */
-
-static char ret_realm[REALM_SZ+1];
-
-char *
-krb_realmofhost(host)
-char *host;
-{
- char *domain;
- FILE *trans_file;
- char trans_host[MAXHOSTNAMELEN+1];
- char trans_realm[REALM_SZ+1];
- int retval;
-
- domain = index(host, '.');
-
- /* prepare default */
- if (domain) {
- char *cp;
-
- strncpy(ret_realm, &domain[1], REALM_SZ);
- ret_realm[REALM_SZ] = '\0';
- /* Upper-case realm */
- for (cp = ret_realm; *cp; cp++)
- if (islower(*cp))
- *cp = toupper(*cp);
- } else {
- krb_get_lrealm(ret_realm, 1);
- }
-
- if ((trans_file = fopen(KRB_RLM_TRANS, "r")) == (FILE *) 0) {
- /* krb_errno = KRB_NO_TRANS */
- return(ret_realm);
- }
- while (1) {
- if ((retval = fscanf(trans_file, "%s %s",
- trans_host, trans_realm)) != 2) {
- if (retval == EOF) {
- fclose(trans_file);
- return(ret_realm);
- }
- continue; /* ignore broken lines */
- }
- trans_host[MAXHOSTNAMELEN] = '\0';
- trans_realm[REALM_SZ] = '\0';
- if (!strcasecmp(trans_host, host)) {
- /* exact match of hostname, so return the realm */
- (void) strcpy(ret_realm, trans_realm);
- fclose(trans_file);
- return(ret_realm);
- }
- if ((trans_host[0] == '.') && domain) {
- /* this is a domain match */
- if (!strcasecmp(trans_host, domain)) {
- /* domain match, save for later */
- (void) strcpy(ret_realm, trans_realm);
- continue;
- }
- }
- }
-}
diff --git a/eBones/krb/getst.c b/eBones/krb/getst.c
deleted file mode 100644
index e50e4bb..0000000
--- a/eBones/krb/getst.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * form: getst.c,v 4.5 88/11/15 16:31:39 jtkohl Exp $
- * $Id: getst.c,v 1.3 1995/07/18 16:38:47 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: getst.c,v 1.3 1995/07/18 16:38:47 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <unistd.h>
-
-/*
- * getst() takes a file descriptor, a string and a count. It reads
- * from the file until either it has read "count" characters, or until
- * it reads a null byte. When finished, what has been read exists in
- * the given string "s". If "count" characters were actually read, the
- * last is changed to a null, so the returned string is always null-
- * terminated. getst() returns the number of characters read, including
- * the null terminator.
- */
-
-int
-getst(fd, s, n)
- int fd;
- register char *s;
- int n;
-{
- register count = n;
- while (read(fd, s, 1) > 0 && --count)
- if (*s++ == '\0')
- return (n - count);
- *s = '\0';
- return (n - count);
-}
diff --git a/eBones/krb/in_tkt.c b/eBones/krb/in_tkt.c
deleted file mode 100644
index 1f6ee8a..0000000
--- a/eBones/krb/in_tkt.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: kt.c,v 4.9 89/10/25 19:03:35 qjb Exp $
- * $Id: in_tkt.c,v 1.6 1995/07/18 16:38:49 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: in_tkt.c,v 1.6 1995/07/18 16:38:49 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <krb.h>
-#include <sys/file.h>
-#include <sys/fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef TKT_SHMEM
-#include <sys/param.h>
-#endif
-
-extern int krb_debug;
-
-/*
- * in_tkt() is used to initialize the ticket store. It creates the
- * file to contain the tickets and writes the given user's name "pname"
- * and instance "pinst" in the file. in_tkt() returns KSUCCESS on
- * success, or KFAILURE if something goes wrong.
- */
-
-int
-in_tkt(pname,pinst)
- char *pname;
- char *pinst;
-{
- int tktfile;
- uid_t me, metoo;
- struct stat buf;
- int count;
- char *file = TKT_FILE;
- int fd;
- register int i;
- char charbuf[BUFSIZ];
-#ifdef TKT_SHMEM
- char shmidname[MAXPATHLEN];
-#endif /* TKT_SHMEM */
-
- me = getuid ();
- metoo = geteuid();
- if (lstat(file,&buf) == 0) {
- if (buf.st_uid != me && me == 0) {
- unlink(file);
- } else {
- if (buf.st_uid != me || !(buf.st_mode & S_IFREG) ||
- buf.st_mode & 077) {
- if (krb_debug)
- fprintf(stderr,"Error initializing %s",file);
- return(KFAILURE);
- }
- /* file already exists, and permissions appear ok, so nuke it */
- if ((fd = open(file, O_RDWR, 0)) < 0)
- goto out; /* can't zero it, but we can still try truncating it */
-
- bzero(charbuf, sizeof(charbuf));
-
- for (i = 0; i < buf.st_size; i += sizeof(charbuf))
- if (write(fd, charbuf, sizeof(charbuf)) != sizeof(charbuf)) {
- (void) fsync(fd);
- (void) close(fd);
- goto out;
- }
-
- (void) fsync(fd);
- (void) close(fd);
- }
- }
- out:
- /* arrange so the file is owned by the ruid
- (swap real & effective uid if necessary).
- This isn't a security problem, since the ticket file, if it already
- exists, has the right uid (== ruid) and mode. */
- if (me != metoo) {
- if (setreuid(metoo, me) < 0) {
- /* can't switch??? barf! */
- if (krb_debug)
- perror("in_tkt: setreuid");
- return(KFAILURE);
- } else
- if (krb_debug)
- printf("swapped UID's %ld and %ld\n",metoo,me);
- }
- if ((tktfile = open(file,O_CREAT | O_TRUNC | O_WRONLY,0600)) < 0) {
- if (krb_debug)
- fprintf(stderr,"Error initializing %s",TKT_FILE);
- return(KFAILURE);
- }
- if (me != metoo) {
- if (setreuid(me, metoo) < 0) {
- /* can't switch??? barf! */
- if (krb_debug)
- perror("in_tkt: setreuid2");
- return(KFAILURE);
- } else
- if (krb_debug)
- printf("swapped UID's %ld and %ld\n",me,metoo);
- }
- if (lstat(file,&buf) < 0) {
- if (krb_debug)
- fprintf(stderr,"Error initializing %s",TKT_FILE);
- return(KFAILURE);
- }
-
- if (buf.st_uid != me || !(buf.st_mode & S_IFREG) ||
- buf.st_mode & 077) {
- if (krb_debug)
- fprintf(stderr,"Error initializing %s",TKT_FILE);
- return(KFAILURE);
- }
-
- count = strlen(pname)+1;
- if (write(tktfile,pname,count) != count) {
- (void) close(tktfile);
- return(KFAILURE);
- }
- count = strlen(pinst)+1;
- if (write(tktfile,pinst,count) != count) {
- (void) close(tktfile);
- return(KFAILURE);
- }
- (void) close(tktfile);
-#ifdef TKT_SHMEM
- (void) strcpy(shmidname, file);
- (void) strcat(shmidname, ".shm");
- return(krb_shm_create(shmidname));
-#else /* !TKT_SHMEM */
- return(KSUCCESS);
-#endif /* TKT_SHMEM */
-}
diff --git a/eBones/krb/k_gethostname.c b/eBones/krb/k_gethostname.c
deleted file mode 100644
index cfb4f92..0000000
--- a/eBones/krb/k_gethostname.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: k_gethostname.c,v 4.1 88/12/01 14:04:42 jtkohl Exp $
- * $Id: k_gethostname.c,v 1.3 1995/07/18 16:38:51 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: k_gethostname.c,v 1.3 1995/07/18 16:38:51 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <unistd.h>
-
-#ifndef PC
-#ifndef BSD42
-/* teach me how to k_gethostname for your system here */
-#endif
-#endif
-
-#ifdef PC
-#include <stdio.h>
-typedef long in_name;
-#include "custom.h" /* where is this file? */
-extern get_custom();
-#define LEN 64 /* just a guess */
-#endif /* PC */
-
-/*
- * Return the local host's name in "name", up to "namelen" characters.
- * "name" will be null-terminated if "namelen" is big enough.
- * The return code is 0 on success, -1 on failure. (The calling
- * interface is identical to gethostname(2).)
- *
- * Currently defined for BSD 4.2 and PC. The BSD version just calls
- * gethostname(); the PC code was taken from "kinit.c", and may or may
- * not work.
- */
-
-int
-k_gethostname(name, namelen)
- char *name;
- int namelen;
-{
-#ifdef BSD42
- return gethostname(name, namelen);
-#endif
-
-#ifdef PC
- char buf[LEN];
- char b1, b2, b3, b4;
- register char *ptr;
-
- get_custom(); /* should check for errors,
- * return -1 on failure */
- ptr = (char *) &(custom.c_me);
- b1 = *ptr++;
- b2 = *ptr++;
- b3 = *ptr++;
- b4 = *ptr;
- (void) sprintf(buf,"PC address %d.%d.%d.%d",b1,b2,b3,b4);
- if (strlen(buf) > namelen)
- fprintf(stderr, "gethostname: namelen too small; truncating");
- strnpcy(name, buf, namelen);
- return 0;
-#endif
-}
diff --git a/eBones/krb/klog.c b/eBones/krb/klog.c
deleted file mode 100644
index 7fdc774..0000000
--- a/eBones/krb/klog.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: klog.c,v 4.6 88/12/01 14:06:05 jtkohl Exp $
- * $Id: klog.c,v 1.3 1995/07/18 16:38:52 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: klog.c,v 1.3 1995/07/18 16:38:52 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <sys/time.h>
-#include <stdio.h>
-
-#include <krb.h>
-#include <klog.h>
-
-static char *log_name = KRBLOG;
-static int is_open;
-static char logtxt[1000];
-
-/*
- * This file contains two logging routines: kset_logfile()
- * to determine the file to which log entries should be written;
- * and klog() to write log entries to the file.
- */
-
-/*
- * klog() is used to add entries to the logfile (see kset_logfile()
- * below). Note that it is probably not portable since it makes
- * assumptions about what the compiler will do when it is called
- * with less than the correct number of arguments which is the
- * way it is usually called.
- *
- * The log entry consists of a timestamp and the given arguments
- * printed according to the given "format" string.
- *
- * The log file is opened and closed for each log entry.
- *
- * If the given log type "type" is unknown, or if the log file
- * cannot be opened, no entry is made to the log file.
- *
- * The return value is always a pointer to the formatted log
- * text string "logtxt".
- */
-
-char * klog(type,format,a1,a2,a3,a4,a5,a6,a7,a8,a9,a0)
- int type;
- char *format;
- int a1,a2,a3,a4,a5,a6,a7,a8,a9,a0;
-{
- FILE *logfile;
- long now;
- struct tm *tm;
- static int logtype_array[NLOGTYPE] = {0,0};
- static int array_initialized;
-
- if (!(array_initialized++)) {
- logtype_array[L_NET_ERR] = 1;
- logtype_array[L_KRB_PERR] = 1;
- logtype_array[L_KRB_PWARN] = 1;
- logtype_array[L_APPL_REQ] = 1;
- logtype_array[L_INI_REQ] = 1;
- logtype_array[L_DEATH_REQ] = 1;
- logtype_array[L_NTGT_INTK] = 1;
- logtype_array[L_ERR_SEXP] = 1;
- logtype_array[L_ERR_MKV] = 1;
- logtype_array[L_ERR_NKY] = 1;
- logtype_array[L_ERR_NUN] = 1;
- logtype_array[L_ERR_UNK] = 1;
- }
-
- (void) sprintf(logtxt,format,a1,a2,a3,a4,a5,a6,a7,a8,a9,a0);
-
- if (!logtype_array[type])
- return(logtxt);
-
- if ((logfile = fopen(log_name,"a")) == NULL)
- return(logtxt);
-
- (void) time(&now);
- tm = localtime(&now);
-
- fprintf(logfile,"%2d-%s-%02d %02d:%02d:%02d ",tm->tm_mday,
- month_sname(tm->tm_mon + 1),tm->tm_year,
- tm->tm_hour, tm->tm_min, tm->tm_sec);
- fprintf(logfile,"%s\n",logtxt);
- (void) fclose(logfile);
- return(logtxt);
-}
-
-/*
- * kset_logfile() changes the name of the file to which
- * messages are logged. If kset_logfile() is not called,
- * the logfile defaults to KRBLOG, defined in "krb.h".
- */
-
-void
-kset_logfile(filename)
- char *filename;
-{
- log_name = filename;
- is_open = 0;
-}
diff --git a/eBones/krb/kname_parse.c b/eBones/krb/kname_parse.c
deleted file mode 100644
index da7ec93..0000000
--- a/eBones/krb/kname_parse.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: kname_parse.c,v 4.4 88/12/01 14:07:29 jtkohl Exp $
- * $Id: kname_parse.c,v 1.3 1995/07/18 16:38:54 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: kname_parse.c,v 1.3 1995/07/18 16:38:54 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <stdio.h>
-#include <krb.h>
-#include <strings.h>
-
-/* max size of full name */
-#define FULL_SZ (ANAME_SZ + INST_SZ + REALM_SZ)
-
-#define NAME 0 /* which field are we in? */
-#define INST 1
-#define REALM 2
-
-extern char *krb_err_txt[];
-
-/*
- * This file contains four routines for handling Kerberos names.
- *
- * kname_parse() breaks a Kerberos name into its name, instance,
- * and realm components.
- *
- * k_isname(), k_isinst(), and k_isrealm() check a given string to see if
- * it's a syntactically legitimate respective part of a Kerberos name,
- * returning 1 if it is, 0 if it isn't.
- *
- * Definition of "syntactically legitimate" names is according to
- * the Project Athena Technical Plan Section E.2.1, page 7 "Specifying
- * names", version dated 21 Dec 1987.
- */
-
-/*
- * kname_parse() takes a Kerberos name "fullname" of the form:
- *
- * username[.instance][@realm]
- *
- * and returns the three components ("name", "instance", and "realm"
- * in the example above) in the given arguments "np", "ip", and "rp".
- *
- * If successful, it returns KSUCCESS. If there was an error,
- * KNAME_FMT is returned.
- */
-
-int
-kname_parse(np, ip, rp, fullname)
- char *np, *ip, *rp, *fullname;
-{
- static char buf[FULL_SZ];
- char *rnext, *wnext; /* next char to read, write */
- register char c;
- int backslash;
- int field;
-
- backslash = 0;
- rnext = buf;
- wnext = np;
- field = NAME;
-
- if (strlen(fullname) > FULL_SZ)
- return KNAME_FMT;
- (void) strcpy(buf, fullname);
-
- while ((c = *rnext++)) {
- if (backslash) {
- *wnext++ = c;
- backslash = 0;
- continue;
- }
- switch (c) {
- case '\\':
- backslash++;
- break;
- case '.':
- switch (field) {
- case NAME:
- if (wnext == np)
- return KNAME_FMT;
- *wnext = '\0';
- field = INST;
- wnext = ip;
- break;
- case INST:
- return KNAME_FMT;
- /* break; */
- case REALM:
- *wnext++ = c;
- break;
- default:
- fprintf(stderr, "unknown field value\n");
- exit(1);
- }
- break;
- case '@':
- switch (field) {
- case NAME:
- if (wnext == np)
- return KNAME_FMT;
- *ip = '\0';
- /* fall through */
- case INST:
- *wnext = '\0';
- field = REALM;
- wnext = rp;
- break;
- case REALM:
- return KNAME_FMT;
- default:
- fprintf(stderr, "unknown field value\n");
- exit(1);
- }
- break;
- default:
- *wnext++ = c;
- }
- }
- *wnext = '\0';
- if ((strlen(np) > ANAME_SZ - 1) ||
- (strlen(ip) > INST_SZ - 1) ||
- (strlen(rp) > REALM_SZ - 1))
- return KNAME_FMT;
- return KSUCCESS;
-}
-
-/*
- * k_isname() returns 1 if the given name is a syntactically legitimate
- * Kerberos name; returns 0 if it's not.
- */
-
-int
-k_isname(s)
- char *s;
-{
- register char c;
- int backslash = 0;
-
- if (!*s)
- return 0;
- if (strlen(s) > ANAME_SZ - 1)
- return 0;
- while((c = *s++)) {
- if (backslash) {
- backslash = 0;
- continue;
- }
- switch(c) {
- case '\\':
- backslash = 1;
- break;
- case '.':
- return 0;
- /* break; */
- case '@':
- return 0;
- /* break; */
- }
- }
- return 1;
-}
-
-
-/*
- * k_isinst() returns 1 if the given name is a syntactically legitimate
- * Kerberos instance; returns 0 if it's not.
- */
-
-int
-k_isinst(s)
- char *s;
-{
- register char c;
- int backslash = 0;
-
- if (strlen(s) > INST_SZ - 1)
- return 0;
- while((c = *s++)) {
- if (backslash) {
- backslash = 0;
- continue;
- }
- switch(c) {
- case '\\':
- backslash = 1;
- break;
- case '.':
- return 0;
- /* break; */
- case '@':
- return 0;
- /* break; */
- }
- }
- return 1;
-}
-
-/*
- * k_isrealm() returns 1 if the given name is a syntactically legitimate
- * Kerberos realm; returns 0 if it's not.
- */
-
-int
-k_isrealm(s)
- char *s;
-{
- register char c;
- int backslash = 0;
-
- if (!*s)
- return 0;
- if (strlen(s) > REALM_SZ - 1)
- return 0;
- while((c = *s++)) {
- if (backslash) {
- backslash = 0;
- continue;
- }
- switch(c) {
- case '\\':
- backslash = 1;
- break;
- case '@':
- return 0;
- /* break; */
- }
- }
- return 1;
-}
diff --git a/eBones/krb/kntoln.c b/eBones/krb/kntoln.c
deleted file mode 100644
index 388704c..0000000
--- a/eBones/krb/kntoln.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: kntoln.c,v 4.7 89/01/23 09:25:15 jtkohl Exp $
- * $Id: kntoln.c,v 1.3 1995/07/18 16:38:56 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: kntoln.c,v 1.3 1995/07/18 16:38:56 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <krb.h>
-#include <strings.h>
-
-/*
- * krb_kntoln converts an auth name into a local name by looking up
- * the auth name in the /etc/aname file. The format of the aname
- * file is:
- *
- * +-----+-----+-----+-----+------+----------+-------+-------+
- * | anl | inl | rll | lnl | name | instance | realm | lname |
- * +-----+-----+-----+-----+------+----------+-------+-------+
- * | 1by | 1by | 1by | 1by | name | instance | realm | lname |
- * +-----+-----+-----+-----+------+----------+-------+-------+
- *
- * If the /etc/aname file can not be opened it will set the
- * local name to the auth name. Thus, in this case it performs as
- * the identity function.
- *
- * The name instance and realm are passed to krb_kntoln through
- * the AUTH_DAT structure (ad).
- *
- * Now here's what it *really* does:
- *
- * Given a Kerberos name in an AUTH_DAT structure, check that the
- * instance is null, and that the realm is the same as the local
- * realm, and return the principal's name in "lname". Return
- * KSUCCESS if all goes well, otherwise KFAILURE.
- */
-
-int
-krb_kntoln(ad,lname)
- AUTH_DAT *ad;
- char *lname;
-{
- static char lrealm[REALM_SZ] = "";
-
- if (!(*lrealm) && (krb_get_lrealm(lrealm,1) == KFAILURE))
- return(KFAILURE);
-
- if (strcmp(ad->pinst,""))
- return(KFAILURE);
- if (strcmp(ad->prealm,lrealm))
- return(KFAILURE);
- (void) strcpy(lname,ad->pname);
- return(KSUCCESS);
-}
diff --git a/eBones/krb/kparse.c b/eBones/krb/kparse.c
deleted file mode 100644
index 5b25ac7..0000000
--- a/eBones/krb/kparse.c
+++ /dev/null
@@ -1,776 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * Purpose:
- * This module was developed to parse the "~/.klogin" files for
- * Kerberos-authenticated rlogin/rcp/rsh services. However, it is
- * general purpose and can be used to parse any such parameter file.
- *
- * The parameter file should consist of one or more entries, with each
- * entry on a separate line and consisting of zero or more
- * "keyword=value" combinations. The keyword is case insensitive, but
- * the value is not. Any string may be enclosed in quotes, and
- * c-style "\" literals are supported. A comma may be used to
- * separate the k/v combinations, and multiple commas are ignored.
- * Whitespace (blank or tab) may be used freely and is ignored.
- *
- * Full error processing is available. When PS_BAD_KEYWORD or
- * PS_SYNTAX is returned from fGetParameterSet(), the string ErrorMsg
- * contains a meaningful error message.
- *
- * Keywords and their default values are programmed by an external
- * table.
- *
- * Routines:
- * fGetParameterSet() parse one line of the parameter file
- * fGetKeywordValue() parse one "keyword=value" combo
- * fGetToken() parse one token
- *
- *
- * from: kparse.c,v 4.5 89/01/21 17:20:39 jtkohl Exp $
- * $Id: kparse.c,v 1.3 1995/07/18 16:38:58 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: kparse.c,v 1.3 1995/07/18 16:38:58 mark Exp $";
-#endif lint
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <kparse.h>
-
-#ifndef FALSE
-#define FALSE 0
-#define TRUE 1
-#endif
-
-#define MAXKEY 80
-#define MAXVALUE 80
-
-int fUngetChar(int ch, FILE *fp);
-int fGetChar(FILE *fp);
-int fGetLiteral(FILE *fp);
-
-int LineNbr=1; /* current line nbr in parameter file */
-char ErrorMsg[80]; /* meaningful only when KV_SYNTAX, PS_SYNTAX,
- * or PS_BAD_KEYWORD is returned by
- * fGetKeywordValue or fGetParameterSet */
-
-int
-fGetParameterSet( fp,parm,parmcount )
- FILE *fp;
- parmtable parm[];
- int parmcount;
-{
- int rc,i;
- char keyword[MAXKEY];
- char value[MAXVALUE];
-
- while (TRUE) {
- rc=fGetKeywordValue(fp,keyword,MAXKEY,value,MAXVALUE);
-
- switch (rc) {
-
- case KV_EOF:
- return(PS_EOF);
-
- case KV_EOL:
- return(PS_OKAY);
-
- case KV_SYNTAX:
- return(PS_SYNTAX);
-
- case KV_OKAY:
- /*
- * got a reasonable keyword/value pair. Search the
- * parameter table to see if we recognize the keyword; if
- * not, return an error. If we DO recognize it, make sure
- * it has not already been given. If not already given,
- * save the value.
- */
- for (i=0; i<parmcount; i++) {
- if (strcmp(strutol(keyword),parm[i].keyword)==0) {
- if (parm[i].value) {
- sprintf(ErrorMsg,"duplicate keyword \"%s\" found",
- keyword);
- return(PS_BAD_KEYWORD);
- }
- parm[i].value = strsave( value );
- break;
- }
- }
- if (i >= parmcount) {
- sprintf(ErrorMsg, "unrecognized keyword \"%s\" found",
- keyword);
- return(PS_BAD_KEYWORD);
- }
- break;
-
- default:
- sprintf(ErrorMsg,
- "panic: bad return (%d) from fGetToken()",rc);
- break;
- }
- }
-}
-
-/*
- * Routine: ParmCompare
- *
- * Purpose:
- * ParmCompare checks a specified value for a particular keyword.
- * fails if keyword not found or keyword found but the value was
- * different. Like strcmp, ParmCompare returns 0 for a match found, -1
- * otherwise
- */
-int
-ParmCompare( parm, parmcount, keyword, value )
- parmtable parm[];
- int parmcount;
- char *keyword;
- char *value;
-{
- int i;
-
- for (i=0; i<parmcount; i++) {
- if (strcmp(parm[i].keyword,keyword)==0) {
- if (parm[i].value) {
- return(strcmp(parm[i].value,value));
- } else {
- return(strcmp(parm[i].defvalue,value));
- }
- }
- }
- return(-1);
-}
-
-void
-FreeParameterSet(parm,parmcount)
- parmtable parm[];
- int parmcount;
-{
- int i;
-
- for (i=0; i<parmcount; i++) {
- if (parm[i].value) {
- free(parm[i].value);
- parm[i].value = (char *)NULL;
- }
- }
-}
-
-int
-fGetKeywordValue( fp, keyword, klen, value, vlen )
- FILE *fp;
- char *keyword;
- int klen;
- char *value;
- int vlen;
-{
- int rc;
- int gotit;
-
- *keyword = *value = '\0'; /* preset strings to NULL */
-
- /*
- * Looking for a keyword.
- * return an exception for EOF or BAD_QSTRING
- * ignore leading WHITEspace
- * ignore any number of leading commas
- * newline means we have all the parms for this
- * statement; give an indication that there is
- * nothing more on this line.
- * stop looking if we find QSTRING, STRING, or NUMBER
- * return syntax error for any other PUNKtuation
- */
- gotit = FALSE;
- do {
- rc = fGetToken(fp,keyword,klen);
-
- switch (rc) {
-
- case GTOK_WHITE:
- break;
-
- case GTOK_EOF:
- return(KV_EOF);
-
- case GTOK_BAD_QSTRING:
- sprintf(ErrorMsg,"unterminated string \"%s found",keyword);
- return(KV_SYNTAX);
-
- case GTOK_PUNK:
- if (strcmp("\n",keyword)==0) {
- return(KV_EOL);
- } else if (strcmp(",",keyword)!=0) {
- sprintf(ErrorMsg,"expecting rvalue, found \'%s\'",keyword);
- }
- break;
-
- case GTOK_STRING:
- case GTOK_QSTRING:
- case GTOK_NUMBER:
- gotit = TRUE;
- break;
-
- default:
- sprintf(ErrorMsg,"panic: bad return (%d) from fGetToken()",rc);
- return(KV_SYNTAX);
- }
-
- } while (!gotit);
-
- /*
- * now we expect an equal sign.
- * skip any whitespace
- * stop looking if we find an equal sign
- * anything else causes a syntax error
- */
- gotit = FALSE;
- do {
- rc = fGetToken(fp,value,vlen);
-
- switch (rc) {
-
- case GTOK_WHITE:
- break;
-
- case GTOK_BAD_QSTRING:
- sprintf(ErrorMsg,
- "expecting \'=\', found unterminated string \"%s",
- value);
- return(KV_SYNTAX);
-
- case GTOK_PUNK:
- if (strcmp("=",value)==0) {
- gotit = TRUE;
- } else {
- if (strcmp("\n",value)==0) {
- sprintf(ErrorMsg,"expecting \"=\", found newline");
- fUngetChar('\n',fp);
- } else {
- sprintf(ErrorMsg,
- "expecting rvalue, found \'%s\'",keyword);
- }
- return(KV_SYNTAX);
- }
- break;
-
- case GTOK_STRING:
- case GTOK_QSTRING:
- case GTOK_NUMBER:
- sprintf(ErrorMsg,"expecting \'=\', found \"%s\"",value);
- return(KV_SYNTAX);
-
- case GTOK_EOF:
- sprintf(ErrorMsg,"expecting \'=\', found EOF");
- return(KV_SYNTAX);
-
- default:
- sprintf(ErrorMsg,
- "panic: bad return (%d) from fGetToken()",rc);
- return(KV_SYNTAX);
- }
-
- } while ( !gotit );
-
- /*
- * got the keyword and equal sign, now get a value.
- * ignore any whitespace
- * any punctuation is a syntax error
- */
- gotit = FALSE;
- do {
- rc = fGetToken(fp,value,vlen);
-
- switch (rc) {
-
- case GTOK_WHITE:
- break;
-
- case GTOK_EOF:
- sprintf(ErrorMsg,"expecting rvalue, found EOF");
- return(KV_SYNTAX);
-
- case GTOK_BAD_QSTRING:
- sprintf(ErrorMsg,"unterminated quoted string \"%s",value);
- return(KV_SYNTAX);
-
- case GTOK_PUNK:
- if (strcmp("\n",value)==0) {
- sprintf(ErrorMsg,"expecting rvalue, found newline");
- fUngetChar('\n',fp);
- } else {
- sprintf(ErrorMsg,
- "expecting rvalue, found \'%s\'",value);
- }
- return(KV_SYNTAX);
- break;
-
- case GTOK_STRING:
- case GTOK_QSTRING:
- case GTOK_NUMBER:
- gotit = TRUE;
- return(KV_OKAY);
-
- default:
- sprintf(ErrorMsg,
- "panic: bad return (%d) from fGetToken()",rc);
- return(KV_SYNTAX);
- }
-
- } while ( !gotit );
- /*NOTREACHED*/
- return(0); /*just to shut up -Wall MRVM*/
-}
-
-/*
- * Routine Name: fGetToken
- *
- * Function: read the next token from the specified file.
- * A token is defined as a group of characters
- * terminated by a white space char (SPACE, CR,
- * LF, FF, TAB). The token returned is stripped of
- * both leading and trailing white space, and is
- * terminated by a NULL terminator. An alternate
- * definition of a token is a string enclosed in
- * single or double quotes.
- *
- * Explicit Parameters:
- * fp pointer to the input FILE
- * dest pointer to destination buffer
- * maxlen length of the destination buffer. The buffer
- * length INCLUDES the NULL terminator.
- *
- * Implicit Parameters: stderr where the "token too long" message goes
- *
- * External Procedures: fgetc
- *
- * Side Effects: None
- *
- * Return Value: A token classification value, as
- * defined in kparse.h. Note that the
- * classification for end of file is
- * always zero.
- */
-int
-fGetToken(fp, dest, maxlen)
- FILE *fp;
- char *dest;
- int maxlen;
-{
- int ch='\0';
- int len=0;
- char *p = dest;
- int digits;
-
- ch=fGetChar(fp);
-
- /*
- * check for a quoted string. If found, take all characters
- * that fit until a closing quote is found. Note that this
- * algorithm will not behave well for a string which is too long.
- */
- if (ISQUOTE(ch)) {
- int done = FALSE;
- do {
- ch = fGetChar(fp);
- done = ((maxlen<++len)||ISLINEFEED(ch)||(ch==EOF)
- ||ISQUOTE(ch));
- if (ch=='\\')
- ch = fGetLiteral(fp);
- if (!done)
- *p++ = ch;
- else if ((ch!=EOF) && !ISQUOTE(ch))
- fUngetChar(ch,fp);
- } while (!done);
- *p = '\0';
- if (ISLINEFEED(ch)) return(GTOK_BAD_QSTRING);
- return(GTOK_QSTRING);
- }
-
- /*
- * Not a quoted string. If its a token character (rules are
- * defined via the ISTOKENCHAR macro, in kparse.h) take it and all
- * token chars following it until we run out of space.
- */
- digits=TRUE;
- if (ISTOKENCHAR(ch)) {
- while ( (ISTOKENCHAR(ch)) && len<maxlen-1 ) {
- if (!isdigit(ch)) digits=FALSE;
- *p++ = ch;
- len++;
- ch = fGetChar(fp);
- };
- *p = '\0';
-
- if (ch!=EOF) {
- fUngetChar(ch,fp);
- }
- if (digits) {
- return(GTOK_NUMBER);
- } else {
- return(GTOK_STRING);
- }
- }
-
- /*
- * Neither a quoted string nor a token character. Return a string
- * with just that one character in it.
- */
- if (ch==EOF) {
- return(GTOK_EOF);
- }
- if (!ISWHITESPACE(ch)) {
- *p++ = ch;
- *p='\0';
- } else {
- *p++ = ' '; /* white space is always the
- * blank character */
- *p='\0';
- /*
- * The character is a white space. Flush all additional white
- * space.
- */
- while (ISWHITESPACE(ch) && ((ch=fGetChar(fp)) != EOF))
- ;
- if (ch!=EOF) {
- fUngetChar(ch,fp);
- }
- return(GTOK_WHITE);
- }
- return(GTOK_PUNK);
-}
-
-/*
- * fGetLiteral is called after we find a '\' in the input stream. A
- * string of numbers following the backslash are converted to the
- * appropriate value; hex (0xn), octal (0n), and decimal (otherwise)
- * are all supported. If the char after the \ is not a number, we
- * special case certain values (\n, \f, \r, \b) or return a literal
- * otherwise (useful for \", for example).
- */
-int
-fGetLiteral(fp)
- FILE *fp;
-{
- int ch;
- int n=0;
- int base;
-
- ch = fGetChar(fp);
-
- if (!isdigit(ch)) {
- switch (ch) {
- case 'n': return('\n');
- case 'f': return('\f');
- case 'r': return('\r');
- case 'b': return('\b');
- default: return(ch);
- }
- }
-
- /*
- * got a number. might be decimal (no prefix), octal (prefix 0),
- * or hexadecimal (prefix 0x). Set the base appropriately.
- */
- if (ch!='0') {
- base=10; /* its a decimal number */
- } else {
- /*
- * found a zero, its either hex or octal
- */
- ch = fGetChar(fp);
- if ((ch!='x') && (ch!='X')) {
- base=010;
- } else {
- ch = fGetChar(fp);
- base=0x10;
- }
- }
-
- switch (base) {
-
- case 010: /* octal */
- while (ISOCTAL(ch)) {
- n = (n*base) + ch - '0';
- ch = fGetChar(fp);
- }
- break;
-
- case 10: /* decimal */
- while (isdigit(ch)) {
- n = (n*base) + ch - '0';
- ch = fGetChar(fp);
- }
- break;
- case 0x10: /* hexadecimal */
- while (isxdigit(ch)) {
- if (isdigit(ch)) {
- n = (n*base) + ch - '0';
- } else {
- n = (n*base) + toupper(ch) - 'A' + 0xA ;
- }
- ch = fGetChar(fp);
- }
- break;
- default:
- fprintf(stderr,"fGetLiteral() died real bad. Fix gettoken.c.");
- exit(1);
- break;
- }
- fUngetChar(ch,fp);
- return(n);
-}
-
-/*
- * exactly the same as ungetc(3) except that the line number of the
- * input file is maintained.
- */
-int
-fUngetChar(ch,fp)
- int ch;
- FILE *fp;
-{
- if (ch=='\n') LineNbr--;
- return(ungetc(ch,fp));
-}
-
-
-/*
- * exactly the same as fgetc(3) except that the line number of the
- * input file is maintained.
- */
-int
-fGetChar(fp)
- FILE *fp;
-{
- int ch = fgetc(fp);
- if (ch=='\n') LineNbr++;
- return(ch);
-}
-
-
-/*
- * Routine Name: strsave
- *
- * Function: return a pointer to a saved copy of the
- * input string. the copy will be allocated
- * as large as necessary.
- *
- * Explicit Parameters: pointer to string to save
- *
- * Implicit Parameters: None
- *
- * External Procedures: malloc,strcpy,strlen
- *
- * Side Effects: None
- *
- * Return Value: pointer to copied string
- *
- */
-char *
-strsave(p)
- char *p;
-{
- return(strcpy(malloc(strlen(p)+1),p));
-}
-
-
-/*
- * strutol changes all characters in a string to lower case, in place.
- * the pointer to the beginning of the string is returned.
- */
-
-char *
-strutol( start )
- char *start;
-{
- char *q;
- for (q=start; *q; q++)
- if (isupper(*q))
- *q=tolower(*q);
- return(start);
-}
-
-#ifdef GTOK_TEST /* mainline test routine for fGetToken() */
-
-#define MAXTOKEN 100
-
-char *pgm = "gettoken";
-
-main(argc,argv)
- int argc;
- char **argv;
-{
- char *p;
- int type;
- FILE *fp;
-
- if (--argc) {
- fp = fopen(*++argv,"ra");
- if (fp == (FILE *)NULL) {
- fprintf(stderr,"can\'t open \"%s\"\n",*argv);
- }
- } else
- fp = stdin;
-
- p = malloc(MAXTOKEN);
- while (type = fGetToken(fp,p,MAXTOKEN)) {
- switch(type) {
- case GTOK_BAD_QSTRING:
- printf("BAD QSTRING!\t");
- break;
- case GTOK_EOF:
- printf("EOF!\t");
- break;
- case GTOK_QSTRING:
- printf("QSTRING\t");
- break;
- case GTOK_STRING:
- printf("STRING\t");
- break;
- case GTOK_NUMBER:
- printf("NUMBER\t");
- break;
- case GTOK_PUNK:
- printf("PUNK\t");
- break;
- case GTOK_WHITE:
- printf("WHITE\t");
- break;
- default:
- printf("HUH?\t");
- break;
- }
- if (*p=='\n')
- printf("\\n\n");
- else
- printf("%s\n",p);
- }
- exit(0);
-}
-#endif
-
-#ifdef KVTEST
-
-main(argc,argv)
- int argc;
- char **argv;
-{
- int rc,ch;
- FILE *fp;
- char key[MAXKEY],valu[MAXVALUE];
- char *filename;
-
- if (argc != 2) {
- fprintf(stderr,"usage: test <filename>\n");
- exit(1);
- }
-
- if (!(fp=fopen(*++argv,"r"))) {
- fprintf(stderr,"can\'t open input file \"%s\"\n",filename);
- exit(1);
- }
- filename = *argv;
-
- while ((rc=fGetKeywordValue(fp,key,MAXKEY,valu,MAXVALUE))!=KV_EOF){
-
- switch (rc) {
-
- case KV_EOL:
- printf("%s, line %d: nada mas.\n",filename,LineNbr-1);
- break;
-
- case KV_SYNTAX:
- printf("%s, line %d: syntax error: %s\n",
- filename,LineNbr,ErrorMsg);
- while ( ((ch=fGetChar(fp))!=EOF) && (ch!='\n') );
- break;
-
- case KV_OKAY:
- printf("%s, line %d: okay, %s=\"%s\"\n",
- filename,LineNbr,key,valu);
- break;
-
- default:
- printf("panic: bad return (%d) from fGetKeywordValue\n",rc);
- break;
- }
- }
- printf("EOF");
- fclose(fp);
- exit(0);
-}
-#endif
-
-#ifdef PSTEST
-
-parmtable kparm[] = {
- /* keyword, default, found value */
- { "user", "", (char *)NULL },
- { "realm", "Athena", (char *)NULL },
- { "instance", "", (char *)NULL }
-};
-
-main(argc,argv)
- int argc;
- char **argv;
-{
- int rc,i,ch;
- FILE *fp;
- char *filename;
-
- if (argc != 2) {
- fprintf(stderr,"usage: test <filename>\n");
- exit(1);
- }
-
- if (!(fp=fopen(*++argv,"r"))) {
- fprintf(stderr,"can\'t open input file \"%s\"\n",filename);
- exit(1);
- }
- filename = *argv;
-
- while ((rc=fGetParameterSet(fp,kparm,PARMCOUNT(kparm))) != PS_EOF) {
-
- switch (rc) {
-
- case PS_BAD_KEYWORD:
- printf("%s, line %d: %s\n",filename,LineNbr,ErrorMsg);
- while ( ((ch=fGetChar(fp))!=EOF) && (ch!='\n') );
- break;
-
- case PS_SYNTAX:
- printf("%s, line %d: syntax error: %s\n",
- filename,LineNbr,ErrorMsg);
- while ( ((ch=fGetChar(fp))!=EOF) && (ch!='\n') );
- break;
-
- case PS_OKAY:
- printf("%s, line %d: valid parameter set found:\n",
- filename,LineNbr-1);
- for (i=0; i<PARMCOUNT(kparm); i++) {
- printf("\t%s = \"%s\"\n",kparm[i].keyword,
- (kparm[i].value ? kparm[i].value
- : kparm[i].defvalue));
- }
- break;
-
- default:
- printf("panic: bad return (%d) from fGetParameterSet\n",rc);
- break;
- }
- FreeParameterSet(kparm,PARMCOUNT(kparm));
- }
- printf("EOF");
- fclose(fp);
- exit(0);
-}
-#endif
diff --git a/eBones/krb/krb.3 b/eBones/krb/krb.3
deleted file mode 100644
index 98a720b..0000000
--- a/eBones/krb/krb.3
+++ /dev/null
@@ -1,462 +0,0 @@
-.\" $Source: /home/ncvs/src/eBones/man/krb.3,v $
-.\" $Author: rgrimes $
-.\" $Header: /home/ncvs/src/eBones/man/krb.3,v 1.1.1.1 1994/05/27 05:12:09 rgrimes Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <mit-copyright.h>.
-.\"
-.TH KERBEROS 3 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-krb_mk_req, krb_rd_req, krb_kntoln, krb_set_key, krb_get_cred,
-krb_mk_priv, krb_rd_priv, krb_mk_safe, krb_rd_safe, krb_mk_err,
-krb_rd_err, krb_ck_repl \- Kerberos authentication library
-.SH SYNOPSIS
-.nf
-.nj
-.ft B
-#include <kerberosIV/des.h>
-#include <kerberosIV/krb.h>
-.PP
-.ft B
-extern char *krb_err_txt[];
-.PP
-.ft B
-int krb_mk_req(authent,service,instance,realm,checksum)
-KTEXT authent;
-char *service;
-char *instance;
-char *realm;
-u_long checksum;
-.PP
-.ft B
-int krb_rd_req(authent,service,instance,from_addr,ad,fn)
-KTEXT authent;
-char *service;
-char *instance;
-u_long from_addr;
-AUTH_DAT *ad;
-char *fn;
-.PP
-.ft B
-int krb_kntoln(ad,lname)
-AUTH_DAT *ad;
-char *lname;
-.PP
-.ft B
-int krb_set_key(key,cvt)
-char *key;
-int cvt;
-.PP
-.ft B
-int krb_get_cred(service,instance,realm,c)
-char *service;
-char *instance;
-char *realm;
-CREDENTIALS *c;
-.PP
-.ft B
-long krb_mk_priv(in,out,in_length,schedule,key,sender,receiver)
-u_char *in;
-u_char *out;
-u_long in_length;
-des_cblock key;
-des_key_schedule schedule;
-struct sockaddr_in *sender;
-struct sockaddr_in *receiver;
-.PP
-.ft B
-long krb_rd_priv(in,in_length,schedule,key,sender,receiver,msg_data)
-u_char *in;
-u_long in_length;
-Key_schedule schedule;
-des_cblock key;
-struct sockaddr_in *sender;
-struct sockaddr_in *receiver;
-MSG_DAT *msg_data;
-.PP
-.ft B
-long krb_mk_safe(in,out,in_length,key,sender,receiver)
-u_char *in;
-u_char *out;
-u_long in_length;
-des_cblock key;
-struct sockaddr_in *sender;
-struct sockaddr_in *receiver;
-.PP
-.ft B
-long krb_rd_safe(in,length,key,sender,receiver,msg_data)
-u_char *in;
-u_long length;
-des_cblock key;
-struct sockaddr_in *sender;
-struct sockaddr_in *receiver;
-MSG_DAT *msg_data;
-.PP
-.ft B
-long krb_mk_err(out,code,string)
-u_char *out;
-long code;
-char *string;
-.PP
-.ft B
-long krb_rd_err(in,length,code,msg_data)
-u_char *in;
-u_long length;
-long code;
-MSG_DAT *msg_data;
-.fi
-.ft R
-.SH DESCRIPTION
-This library supports network authentication and various related
-operations. The library contains many routines beyond those described
-in this man page, but they are not intended to be used directly.
-Instead, they are called by the routines that are described, the
-authentication server and the login program.
-.PP
-.I krb_err_txt[]
-contains text string descriptions of various Kerberos error codes returned
-by some of the routines below.
-.PP
-.I krb_mk_req
-takes a pointer to a text structure in which an authenticator is to be
-built. It also takes the name, instance, and realm of the service to be
-used and an optional checksum. It is up to the application to decide
-how to generate the checksum.
-.I krb_mk_req
-then retrieves a ticket for the desired service and creates an
-authenticator. The authenticator is built in
-.I authent
-and is accessible
-to the calling procedure.
-.PP
-It is up to the application to get the authenticator to the service
-where it will be read by
-.I krb_rd_req.
-Unless an attacker posesses the session key contained in the ticket, it
-will be unable to modify the authenticator. Thus, the checksum can be
-used to verify the authenticity of the other data that will pass through
-a connection.
-.PP
-.I krb_rd_req
-takes an authenticator of type
-.B KTEXT,
-a service name, an instance, the address of the
-host originating the request, and a pointer to a structure of type
-.B AUTH_DAT
-which is filled in with information obtained from the authenticator.
-It also optionally takes the name of the file in which it will find the
-secret key(s) for the service.
-If the supplied
-.I instance
-contains "*", then the first service key with the same service name
-found in the service key file will be used, and the
-.I instance
-argument will be filled in with the chosen instance. This means that
-the caller must provide space for such an instance name.
-.PP
-It is used to find out information about the principal when a request
-has been made to a service. It is up to the application protocol to get
-the authenticator from the client to the service. The authenticator is
-then passed to
-.I krb_rd_req
-to extract the desired information.
-.PP
-.I krb_rd_req
-returns zero (RD_AP_OK) upon successful authentication. If a packet was
-forged, modified, or replayed, authentication will fail. If the
-authentication fails, a non-zero value is returned indicating the
-particular problem encountered. See
-.I krb.h
-for the list of error codes.
-.PP
-If the last argument is the null string (""), krb_rd_req will use the
-file /etc/kerberosIV/srvtab to find its keys. If the last argument is
-NULL, it will assume that the key has been set by
-.I krb_set_key
-and will not bother looking further.
-.PP
-.I krb_kntoln
-converts a Kerberos name to a local name. It takes a structure
-of type AUTH_DAT and uses the name and instance to look in the database
-/etc/kerberosIV/aname to find the corresponding local name. The local name is
-returned and can be used by an application to change uids, directories,
-or other parameters. It is not an integral part of Kerberos, but is
-instead provided to support the use of Kerberos in existing utilities.
-.PP
-.I krb_set_key
-takes as an argument a des key. It then creates
-a key schedule from it and saves the original key to be used as an
-initialization vector.
-It is used to set the server's key which
-must be used to decrypt tickets.
-.PP
-If called with a non-zero second argument,
-.I krb_set_key
-will first convert the input from a string of arbitrary length to a DES
-key by encrypting it with a one-way function.
-.PP
-In most cases it should not be necessary to call
-.I krb_set_key.
-The necessary keys will usually be obtained and set inside
-.I krb_rd_req. krb_set_key
-is provided for those applications that do not wish to place the
-application keys on disk.
-.PP
-.I krb_get_cred
-searches the caller's ticket file for a ticket for the given service, instance,
-and realm; and, if a ticket is found, fills in the given CREDENTIALS structure
-with the ticket information.
-.PP
-If the ticket was found,
-.I krb_get_cred
-returns GC_OK.
-If the ticket file can't be found, can't be read, doesn't belong to
-the user (other than root), isn't a regular file, or is in the wrong
-mode, the error GC_TKFIL is returned.
-.PP
-.I krb_mk_priv
-creates an encrypted, authenticated
-message from any arbitrary application data, pointed to by
-.I in
-and
-.I in_length
-bytes long.
-The private session key, pointed to by
-.I key
-and the key schedule,
-.I schedule,
-are used to encrypt the data and some header information using
-.I pcbc_encrypt.
-.I sender
-and
-.I receiver
-point to the Internet address of the two parties.
-In addition to providing privacy, this protocol message protects
-against modifications, insertions or replays. The encapsulated message and
-header are placed in the area pointed to by
-.I out
-and the routine returns the length of the output, or -1 indicating
-an error.
-.PP
-.I krb_rd_priv
-decrypts and authenticates a received
-.I krb_mk_priv
-message.
-.I in
-points to the beginning of the received message, whose length
-is specified in
-.I in_length.
-The private session key, pointed to by
-.I key,
-and the key schedule,
-.I schedule,
-are used to decrypt and verify the received message.
-.I msg_data
-is a pointer to a
-.I MSG_DAT
-struct, defined in
-.I krb.h.
-The routine fills in the
-.I app_data
-field with a pointer to the decrypted application data,
-.I app_length
-with the length of the
-.I app_data
-field,
-.I time_sec
-and
-.I time_5ms
-with the timestamps in the message, and
-.I swap
-with a 1 if the byte order of the receiver is different than that of
-the sender. (The application must still determine if it is appropriate
-to byte-swap application data; the Kerberos protocol fields are already taken
-care of). The
-.I hash
-field returns a value useful as input to the
-.I krb_ck_repl
-routine.
-
-The routine returns zero if ok, or a Kerberos error code. Modified messages
-and old messages cause errors, but it is up to the caller to
-check the time sequence of messages, and to check against recently replayed
-messages using
-.I krb_ck_repl
-if so desired.
-.PP
-.I krb_mk_safe
-creates an authenticated, but unencrypted message from any arbitrary
-application data,
-pointed to by
-.I in
-and
-.I in_length
-bytes long.
-The private session key, pointed to by
-.I key,
-is used to seed the
-.I quad_cksum()
-checksum algorithm used as part of the authentication.
-.I sender
-and
-.I receiver
-point to the Internet address of the two parties.
-This message does not provide privacy, but does protect (via detection)
-against modifications, insertions or replays. The encapsulated message and
-header are placed in the area pointed to by
-.I out
-and the routine returns the length of the output, or -1 indicating
-an error.
-The authentication provided by this routine is not as strong as that
-provided by
-.I krb_mk_priv
-or by computing the checksum using
-.I cbc_cksum
-instead, both of which authenticate via DES.
-.PP
-
-.I krb_rd_safe
-authenticates a received
-.I krb_mk_safe
-message.
-.I in
-points to the beginning of the received message, whose length
-is specified in
-.I in_length.
-The private session key, pointed to by
-.I key,
-is used to seed the quad_cksum() routine as part of the authentication.
-.I msg_data
-is a pointer to a
-.I MSG_DAT
-struct, defined in
-.I krb.h .
-The routine fills in these
-.I MSG_DAT
-fields:
-the
-.I app_data
-field with a pointer to the application data,
-.I app_length
-with the length of the
-.I app_data
-field,
-.I time_sec
-and
-.I time_5ms
-with the timestamps in the message, and
-.I swap
-with a 1 if the byte order of the receiver is different than that of
-the sender.
-(The application must still determine if it is appropriate
-to byte-swap application data; the Kerberos protocol fields are already taken
-care of). The
-.I hash
-field returns a value useful as input to the
-.I krb_ck_repl
-routine.
-
-The routine returns zero if ok, or a Kerberos error code. Modified messages
-and old messages cause errors, but it is up to the caller to
-check the time sequence of messages, and to check against recently replayed
-messages using
-.I krb_ck_repl
-if so desired.
-.PP
-.I krb_mk_err
-constructs an application level error message that may be used along
-with
-.I krb_mk_priv
-or
-.I krb_mk_safe.
-.I out
-is a pointer to the output buffer,
-.I code
-is an application specific error code, and
-.I string
-is an application specific error string.
-
-.PP
-.I krb_rd_err
-unpacks a received
-.I krb_mk_err
-message.
-.I in
-points to the beginning of the received message, whose length
-is specified in
-.I in_length.
-.I code
-is a pointer to a value to be filled in with the error
-value provided by the application.
-.I msg_data
-is a pointer to a
-.I MSG_DAT
-struct, defined in
-.I krb.h .
-The routine fills in these
-.I MSG_DAT
-fields: the
-.I app_data
-field with a pointer to the application error text,
-.I app_length
-with the length of the
-.I app_data
-field, and
-.I swap
-with a 1 if the byte order of the receiver is different than that of
-the sender. (The application must still determine if it is appropriate
-to byte-swap application data; the Kerberos protocol fields are already taken
-care of).
-
-The routine returns zero if the error message has been successfully received,
-or a Kerberos error code.
-.PP
-The
-.I KTEXT
-structure is used to pass around text of varying lengths. It consists
-of a buffer for the data, and a length. krb_rd_req takes an argument of this
-type containing the authenticator, and krb_mk_req returns the
-authenticator in a structure of this type. KTEXT itself is really a
-pointer to the structure. The actual structure is of type KTEXT_ST.
-.PP
-The
-.I AUTH_DAT
-structure is filled in by krb_rd_req. It must be allocated before
-calling krb_rd_req, and a pointer to it is passed. The structure is
-filled in with data obtained from Kerberos.
-.I MSG_DAT
-structure is filled in by either krb_rd_priv, krb_rd_safe, or
-krb_rd_err. It must be allocated before the call and a pointer to it
-is passed. The structure is
-filled in with data obtained from Kerberos.
-.PP
-.SH FILES
-/usr/include/kerberosIV/krb.h
-.br
-/usr/lib/libkrb.a
-.br
-/usr/include/kerberosIV/des.h
-.br
-/usr/lib/libdes.a
-.br
-/etc/kerberosIV/aname
-.br
-/etc/kerberosIV/srvtab
-.br
-/tmp/tkt[uid]
-.SH "SEE ALSO"
-kerberos(1), des_crypt(3)
-.SH DIAGNOSTICS
-.SH BUGS
-The caller of
-.I krb_rd_req, krb_rd_priv, and krb_rd_safe
-must check time order and for replay attempts.
-.I krb_ck_repl
-is not implemented yet.
-.SH AUTHORS
-Clifford Neuman, MIT Project Athena
-.br
-Steve Miller, MIT Project Athena/Digital Equipment Corporation
-.SH RESTRICTIONS
-COPYRIGHT 1985,1986,1989 Massachusetts Institute of Technology
diff --git a/eBones/krb/krb_err.et b/eBones/krb/krb_err.et
deleted file mode 100644
index 7d2baef..0000000
--- a/eBones/krb/krb_err.et
+++ /dev/null
@@ -1,257 +0,0 @@
-# Copyright 1987,1988 Massachusetts Institute of Technology
-# For copying and distribution information, see the file
-# "Copyright.MIT".
-#
-# from: krb_err.et,v 4.1 89/09/26 09:24:20 jtkohl Exp $
-# $Id: krb_err.et,v 1.3 1995/07/18 16:39:00 mark Exp $
-#
- error_table krb
-
- ec KRBET_KSUCCESS,
- "Kerberos successful"
-
- ec KRBET_KDC_NAME_EXP,
- "Kerberos principal expired"
-
- ec KRBET_KDC_SERVICE_EXP,
- "Kerberos service expired"
-
- ec KRBET_KDC_AUTH_EXP,
- "Kerberos auth expired"
-
- ec KRBET_KDC_PKT_VER,
- "Incorrect kerberos master key version"
-
- ec KRBET_KDC_P_MKEY_VER,
- "Incorrect kerberos master key version"
-
- ec KRBET_KDC_S_MKEY_VER,
- "Incorrect kerberos master key version"
-
- ec KRBET_KDC_BYTE_ORDER,
- "Kerberos error: byte order unknown"
-
- ec KRBET_KDC_PR_UNKNOWN,
- "Kerberos principal unknown"
-
- ec KRBET_KDC_PR_N_UNIQUE,
- "Kerberos principal not unique"
-
- ec KRBET_KDC_NULL_KEY,
- "Kerberos principal has null key"
-
- ec KRBET_KRB_RES11,
- "Reserved 11"
-
- ec KRBET_KRB_RES12,
- "Reserved 12"
-
- ec KRBET_KRB_RES13,
- "Reserved 13"
-
- ec KRBET_KRB_RES14,
- "Reserved 14"
-
- ec KRBET_KRB_RES15,
- "Reserved 15"
-
- ec KRBET_KRB_RES16,
- "Reserved 16"
-
- ec KRBET_KRB_RES17,
- "Reserved 17"
-
- ec KRBET_KRB_RES18,
- "Reserved 18"
-
- ec KRBET_KRB_RES19,
- "Reserved 19"
-
- ec KRBET_KDC_GEN_ERR,
- "Generic error from Kerberos KDC"
-
- ec KRBET_GC_TKFIL,
- "Can't read Kerberos ticket file"
-
- ec KRBET_GC_NOTKT,
- "Can't find Kerberos ticket or TGT"
-
- ec KRBET_KRB_RES23,
- "Reserved 23"
-
- ec KRBET_KRB_RES24,
- "Reserved 24"
-
- ec KRBET_KRB_RES25,
- "Reserved 25"
-
- ec KRBET_MK_AP_TGTEXP,
- "Kerberos TGT Expired"
-
- ec KRBET_KRB_RES27,
- "Reserved 27"
-
- ec KRBET_KRB_RES28,
- "Reserved 28"
-
- ec KRBET_KRB_RES29,
- "Reserved 29"
-
- ec KRBET_KRB_RES30,
- "Reserved 30"
-
- ec KRBET_RD_AP_UNDEC,
- "Kerberos error: Can't decode authenticator"
-
- ec KRBET_RD_AP_EXP,
- "Kerberos ticket expired"
-
- ec KRBET_RD_AP_NYV,
- "Kerberos ticket not yet valid"
-
- ec KRBET_RD_AP_REPEAT,
- "Kerberos error: Repeated request"
-
- ec KRBET_RD_AP_NOT_US,
- "The kerberos ticket isn't for us"
-
- ec KRBET_RD_AP_INCON,
- "Kerberos request inconsistent"
-
- ec KRBET_RD_AP_TIME,
- "Kerberos error: delta_t too big"
-
- ec KRBET_RD_AP_BADD,
- "Kerberos error: incorrect net address"
-
- ec KRBET_RD_AP_VERSION,
- "Kerberos protocol version mismatch"
-
- ec KRBET_RD_AP_MSG_TYPE,
- "Kerberos error: invalid msg type"
-
- ec KRBET_RD_AP_MODIFIED,
- "Kerberos error: message stream modified"
-
- ec KRBET_RD_AP_ORDER,
- "Kerberos error: message out of order"
-
- ec KRBET_RD_AP_UNAUTHOR,
- "Kerberos error: unauthorized request"
-
- ec KRBET_KRB_RES44,
- "Reserved 44"
-
- ec KRBET_KRB_RES45,
- "Reserved 45"
-
- ec KRBET_KRB_RES46,
- "Reserved 46"
-
- ec KRBET_KRB_RES47,
- "Reserved 47"
-
- ec KRBET_KRB_RES48,
- "Reserved 48"
-
- ec KRBET_KRB_RES49,
- "Reserved 49"
-
- ec KRBET_KRB_RES50,
- "Reserved 50"
-
- ec KRBET_GT_PW_NULL,
- "Kerberos error: current PW is null"
-
- ec KRBET_GT_PW_BADPW,
- "Kerberos error: Incorrect current password"
-
- ec KRBET_GT_PW_PROT,
- "Kerberos protocol error"
-
- ec KRBET_GT_PW_KDCERR,
- "Error returned by Kerberos KDC"
-
- ec KRBET_GT_PW_NULLTKT,
- "Null Kerberos ticket returned by KDC"
-
- ec KRBET_SKDC_RETRY,
- "Kerberos error: Retry count exceeded"
-
- ec KRBET_SKDC_CANT,
- "Kerberos error: Can't send request"
-
- ec KRBET_KRB_RES58,
- "Reserved 58"
-
- ec KRBET_KRB_RES59,
- "Reserved 59"
-
- ec KRBET_KRB_RES60,
- "Reserved 60"
-
- ec KRBET_INTK_W_NOTALL,
- "Kerberos error: not all tickets returned"
-
- ec KRBET_INTK_BADPW,
- "Kerberos error: incorrect password"
-
- ec KRBET_INTK_PROT,
- "Kerberos error: Protocol Error"
-
- ec KRBET_KRB_RES64,
- "Reserved 64"
-
- ec KRBET_KRB_RES65,
- "Reserved 65"
-
- ec KRBET_KRB_RES66,
- "Reserved 66"
-
- ec KRBET_KRB_RES67,
- "Reserved 67"
-
- ec KRBET_KRB_RES68,
- "Reserved 68"
-
- ec KRBET_KRB_RES69,
- "Reserved 69"
-
- ec KRBET_INTK_ERR,
- "Other error"
-
- ec KRBET_AD_NOTGT,
- "Don't have Kerberos ticket-granting ticket"
-
- ec KRBET_KRB_RES72,
- "Reserved 72"
-
- ec KRBET_KRB_RES73,
- "Reserved 73"
-
- ec KRBET_KRB_RES74,
- "Reserved 74"
-
- ec KRBET_KRB_RES75,
- "Reserved 75"
-
- ec KRBET_NO_TKT_FIL,
- "No ticket file found"
-
- ec KRBET_TKT_FIL_ACC,
- "Couldn't access ticket file"
-
- ec KRBET_TKT_FIL_LCK,
- "Couldn't lock ticket file"
-
- ec KRBET_TKT_FIL_FMT,
- "Bad ticket file format"
-
- ec KRBET_TKT_FIL_INI,
- "tf_init not called first"
-
- ec KRBET_KNAME_FMT,
- "Bad Kerberos name format"
-
- end
-
diff --git a/eBones/krb/krb_err_txt.c b/eBones/krb/krb_err_txt.c
deleted file mode 100644
index 2c8c0ca..0000000
--- a/eBones/krb/krb_err_txt.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: krb_err_txt.c,v 4.7 88/12/01 14:10:14 jtkohl Exp $
- * $Id: krb_err_txt.c,v 1.3 1995/07/18 16:39:02 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: krb_err_txt.c,v 1.3 1995/07/18 16:39:02 mark Exp $";
-#endif lint
-#endif
-
-/*
- * This file contains an array of error text strings.
- * The associated error codes (which are defined in "krb.h")
- * follow the string in the comments at the end of each line.
- */
-
-char *krb_err_txt[256] = {
- "OK", /* 000 */
- "Principal expired (kerberos)", /* 001 */
- "Service expired (kerberos)", /* 002 */
- "Authentication expired (kerberos)", /* 003 */
- "Unknown protocol version number (kerberos)", /* 004 */
- "Principal: Incorrect master key version (kerberos)", /* 005 */
- "Service: Incorrect master key version (kerberos)", /* 006 */
- "Bad byte order (kerberos)", /* 007 */
- "Principal unknown (kerberos)", /* 008 */
- "Principal not unique (kerberos)", /* 009 */
- "Principal has null key (kerberos)", /* 010 */
- "Reserved error message 11 (kerberos)", /* 011 */
- "Reserved error message 12 (kerberos)", /* 012 */
- "Reserved error message 13 (kerberos)", /* 013 */
- "Reserved error message 14 (kerberos)", /* 014 */
- "Reserved error message 15 (kerberos)", /* 015 */
- "Reserved error message 16 (kerberos)", /* 016 */
- "Reserved error message 17 (kerberos)", /* 017 */
- "Reserved error message 18 (kerberos)", /* 018 */
- "Reserved error message 19 (kerberos)", /* 019 */
- "Permission Denied (kerberos)", /* 020 */
- "Can't read ticket file (krb_get_cred)", /* 021 */
- "Can't find ticket (krb_get_cred)", /* 022 */
- "Reserved error message 23 (krb_get_cred)", /* 023 */
- "Reserved error message 24 (krb_get_cred)", /* 024 */
- "Reserved error message 25 (krb_get_cred)", /* 025 */
- "Ticket granting ticket expired (krb_mk_req)", /* 026 */
- "Reserved error message 27 (krb_mk_req)", /* 027 */
- "Reserved error message 28 (krb_mk_req)", /* 028 */
- "Reserved error message 29 (krb_mk_req)", /* 029 */
- "Reserved error message 30 (krb_mk_req)", /* 030 */
- "Can't decode authenticator (krb_rd_req)", /* 031 */
- "Ticket expired (krb_rd_req)", /* 032 */
- "Ticket issue date too far in the future (krb_rd_req)",/* 033 */
- "Repeat request (krb_rd_req)", /* 034 */
- "Ticket for wrong server (krb_rd_req)", /* 035 */
- "Request inconsistent (krb_rd_req)", /* 036 */
- "Time is out of bounds (krb_rd_req)", /* 037 */
- "Incorrect network address (krb_rd_req)", /* 038 */
- "Protocol version mismatch (krb_rd_req)", /* 039 */
- "Illegal message type (krb_rd_req)", /* 040 */
- "Message integrity error (krb_rd_req)", /* 041 */
- "Message duplicate or out of order (krb_rd_req)", /* 042 */
- "Unauthorized request (krb_rd_req)", /* 043 */
- "Reserved error message 44 (krb_rd_req)", /* 044 */
- "Reserved error message 45 (krb_rd_req)", /* 045 */
- "Reserved error message 46 (krb_rd_req)", /* 046 */
- "Reserved error message 47 (krb_rd_req)", /* 047 */
- "Reserved error message 48 (krb_rd_req)", /* 048 */
- "Reserved error message 49 (krb_rd_req)", /* 049 */
- "Reserved error message 50 (krb_rd_req)", /* 050 */
- "Current password is NULL (get_pw_tkt)", /* 051 */
- "Current password incorrect (get_pw_tkt)", /* 052 */
- "Protocol error (gt_pw_tkt)", /* 053 */
- "Error returned by KDC (gt_pw_tkt)", /* 054 */
- "Null ticket returned by KDC (gt_pw_tkt)", /* 055 */
- "Retry count exceeded (send_to_kdc)", /* 056 */
- "Can't send request (send_to_kdc)", /* 057 */
- "Reserved error message 58 (send_to_kdc)", /* 058 */
- "Reserved error message 59 (send_to_kdc)", /* 059 */
- "Reserved error message 60 (send_to_kdc)", /* 060 */
- "Warning: Not ALL tickets returned", /* 061 */
- "Password incorrect", /* 062 */
- "Protocol error (get_intkt)", /* 063 */
- "Reserved error message 64 (get_in_tkt)", /* 064 */
- "Reserved error message 65 (get_in_tkt)", /* 065 */
- "Reserved error message 66 (get_in_tkt)", /* 066 */
- "Reserved error message 67 (get_in_tkt)", /* 067 */
- "Reserved error message 68 (get_in_tkt)", /* 068 */
- "Reserved error message 69 (get_in_tkt)", /* 069 */
- "Generic error (get_intkt)", /* 070 */
- "Don't have ticket granting ticket (get_ad_tkt)", /* 071 */
- "Reserved error message 72 (get_ad_tkt)", /* 072 */
- "Reserved error message 73 (get_ad_tkt)", /* 073 */
- "Reserved error message 74 (get_ad_tkt)", /* 074 */
- "Reserved error message 75 (get_ad_tkt)", /* 075 */
- "No ticket file (tf_util)", /* 076 */
- "Can't access ticket file (tf_util)", /* 077 */
- "Can't lock ticket file; try later (tf_util)", /* 078 */
- "Bad ticket file format (tf_util)", /* 079 */
- "Read ticket file before tf_init (tf_util)", /* 080 */
- "Bad Kerberos name format (kname_parse)", /* 081 */
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "(reserved)",
- "Generic kerberos error (kfailure)", /* 255 */
-};
diff --git a/eBones/krb/krb_get_in_tkt.c b/eBones/krb/krb_get_in_tkt.c
deleted file mode 100644
index b6ff308..0000000
--- a/eBones/krb/krb_get_in_tkt.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: der: krb_get_in_tkt.c,v 4.19 89/07/18 16:31:31 jtkohl Exp $
- * $Id: krb_get_in_tkt.c,v 1.3 1995/07/18 16:39:04 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: krb_get_in_tkt.c,v 1.3 1995/07/18 16:39:04 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <krb.h>
-#include <des.h>
-#include <prot.h>
-
-#include <stdio.h>
-#include <strings.h>
-#include <errno.h>
-
-/* use the bsd time.h struct defs for PC too! */
-#include <sys/time.h>
-#include <sys/types.h>
-
-int swap_bytes;
-
-/*
- * decrypt_tkt(): Given user, instance, realm, passwd, key_proc
- * and the cipher text sent from the KDC, decrypt the cipher text
- * using the key returned by key_proc.
- */
-
-static int
-decrypt_tkt(user, instance, realm, arg, key_proc, cipp)
- char *user;
- char *instance;
- char *realm;
- char *arg;
- int (*key_proc)();
- KTEXT *cipp;
-{
- KTEXT cip = *cipp;
- C_Block key; /* Key for decrypting cipher */
- Key_schedule key_s;
-
-#ifndef NOENCRYPTION
- /* Attempt to decrypt it */
-#endif
-
- /* generate a key */
-
- {
- register int rc;
- rc = (*key_proc)(user,instance,realm,arg,key);
- if (rc)
- return(rc);
- }
-
-#ifndef NOENCRYPTION
- key_sched(&key,key_s);
- pcbc_encrypt((C_Block *)cip->dat,(C_Block *)cip->dat,
- (long) cip->length,key_s,(C_Block *)key,DES_DECRYPT);
-#endif /* !NOENCRYPTION */
- /* Get rid of all traces of key */
- bzero((char *)key,sizeof(key));
- bzero((char *)key_s,sizeof(key_s));
-
- return(0);
-}
-
-/*
- * krb_get_in_tkt() gets a ticket for a given principal to use a given
- * service and stores the returned ticket and session key for future
- * use.
- *
- * The "user", "instance", and "realm" arguments give the identity of
- * the client who will use the ticket. The "service" and "sinstance"
- * arguments give the identity of the server that the client wishes
- * to use. (The realm of the server is the same as the Kerberos server
- * to whom the request is sent.) The "life" argument indicates the
- * desired lifetime of the ticket; the "key_proc" argument is a pointer
- * to the routine used for getting the client's private key to decrypt
- * the reply from Kerberos. The "decrypt_proc" argument is a pointer
- * to the routine used to decrypt the reply from Kerberos; and "arg"
- * is an argument to be passed on to the "key_proc" routine.
- *
- * If all goes well, krb_get_in_tkt() returns INTK_OK, otherwise it
- * returns an error code: If an AUTH_MSG_ERR_REPLY packet is returned
- * by Kerberos, then the error code it contains is returned. Other
- * error codes returned by this routine include INTK_PROT to indicate
- * wrong protocol version, INTK_BADPW to indicate bad password (if
- * decrypted ticket didn't make sense), INTK_ERR if the ticket was for
- * the wrong server or the ticket store couldn't be initialized.
- *
- * The format of the message sent to Kerberos is as follows:
- *
- * Size Variable Field
- * ---- -------- -----
- *
- * 1 byte KRB_PROT_VERSION protocol version number
- * 1 byte AUTH_MSG_KDC_REQUEST | message type
- * HOST_BYTE_ORDER local byte order in lsb
- * string user client's name
- * string instance client's instance
- * string realm client's realm
- * 4 bytes tlocal.tv_sec timestamp in seconds
- * 1 byte life desired lifetime
- * string service service's name
- * string sinstance service's instance
- */
-
-int
-krb_get_in_tkt(user, instance, realm, service, sinstance, life,
- key_proc, decrypt_proc, arg)
- char *user;
- char *instance;
- char *realm;
- char *service;
- char *sinstance;
- int life;
- int (*key_proc)();
- int (*decrypt_proc)();
- char *arg;
-{
- KTEXT_ST pkt_st;
- KTEXT pkt = &pkt_st; /* Packet to KDC */
- KTEXT_ST rpkt_st;
- KTEXT rpkt = &rpkt_st; /* Returned packet */
- KTEXT_ST cip_st;
- KTEXT cip = &cip_st; /* Returned Ciphertext */
- KTEXT_ST tkt_st;
- KTEXT tkt = &tkt_st; /* Current ticket */
- C_Block ses; /* Session key for tkt */
- int kvno; /* Kvno for session key */
- unsigned char *v = pkt->dat; /* Prot vers no */
- unsigned char *t = (pkt->dat+1); /* Prot msg type */
-
- char s_name[SNAME_SZ];
- char s_instance[INST_SZ];
- char rlm[REALM_SZ];
- int lifetime;
- int msg_byte_order;
- int kerror;
- unsigned long exp_date;
- char *ptr;
-
- struct timeval t_local;
-
- unsigned long rep_err_code;
-
- unsigned long kdc_time; /* KDC time */
-
- /* BUILD REQUEST PACKET */
-
- /* Set up the fixed part of the packet */
- *v = (unsigned char) KRB_PROT_VERSION;
- *t = (unsigned char) AUTH_MSG_KDC_REQUEST;
- *t |= HOST_BYTE_ORDER;
-
- /* Now for the variable info */
- (void) strcpy((char *)(pkt->dat+2),user); /* aname */
- pkt->length = 3 + strlen(user);
- (void) strcpy((char *)(pkt->dat+pkt->length),
- instance); /* instance */
- pkt->length += 1 + strlen(instance);
- (void) strcpy((char *)(pkt->dat+pkt->length),realm); /* realm */
- pkt->length += 1 + strlen(realm);
-
- (void) gettimeofday(&t_local,(struct timezone *) 0);
- /* timestamp */
- bcopy((char *)&(t_local.tv_sec),(char *)(pkt->dat+pkt->length), 4);
- pkt->length += 4;
-
- *(pkt->dat+(pkt->length)++) = (char) life;
- (void) strcpy((char *)(pkt->dat+pkt->length),service);
- pkt->length += 1 + strlen(service);
- (void) strcpy((char *)(pkt->dat+pkt->length),sinstance);
- pkt->length += 1 + strlen(sinstance);
-
- rpkt->length = 0;
-
- /* SEND THE REQUEST AND RECEIVE THE RETURN PACKET */
-
- if ((kerror = send_to_kdc(pkt, rpkt, realm))) return(kerror);
-
- /* check packet version of the returned packet */
- if (pkt_version(rpkt) != KRB_PROT_VERSION)
- return(INTK_PROT);
-
- /* Check byte order */
- msg_byte_order = pkt_msg_type(rpkt) & 1;
- swap_bytes = 0;
- if (msg_byte_order != HOST_BYTE_ORDER) {
- swap_bytes++;
- }
-
- switch (pkt_msg_type(rpkt) & ~1) {
- case AUTH_MSG_KDC_REPLY:
- break;
- case AUTH_MSG_ERR_REPLY:
- bcopy(pkt_err_code(rpkt),(char *) &rep_err_code,4);
- if (swap_bytes) swap_u_long(rep_err_code);
- return((int)rep_err_code);
- default:
- return(INTK_PROT);
- }
-
- /* EXTRACT INFORMATION FROM RETURN PACKET */
-
- /* get the principal's expiration date */
- bcopy(pkt_x_date(rpkt),(char *) &exp_date,sizeof(exp_date));
- if (swap_bytes) swap_u_long(exp_date);
-
- /* Extract the ciphertext */
- cip->length = pkt_clen(rpkt); /* let clen do the swap */
-
- if ((cip->length < 0) || (cip->length > sizeof(cip->dat)))
- return(INTK_ERR); /* no appropriate error code
- currently defined for INTK_ */
- /* copy information from return packet into "cip" */
- bcopy((char *) pkt_cipher(rpkt),(char *)(cip->dat),cip->length);
-
- /* Attempt to decrypt the reply. */
- if (decrypt_proc == NULL)
- decrypt_proc = decrypt_tkt;
- (*decrypt_proc)(user, instance, realm, arg, key_proc, &cip);
-
- ptr = (char *) cip->dat;
-
- /* extract session key */
- bcopy(ptr,(char *)ses,8);
- ptr += 8;
-
- if ((strlen(ptr) + (ptr - (char *) cip->dat)) > cip->length)
- return(INTK_BADPW);
-
- /* extract server's name */
- (void) strcpy(s_name,ptr);
- ptr += strlen(s_name) + 1;
-
- if ((strlen(ptr) + (ptr - (char *) cip->dat)) > cip->length)
- return(INTK_BADPW);
-
- /* extract server's instance */
- (void) strcpy(s_instance,ptr);
- ptr += strlen(s_instance) + 1;
-
- if ((strlen(ptr) + (ptr - (char *) cip->dat)) > cip->length)
- return(INTK_BADPW);
-
- /* extract server's realm */
- (void) strcpy(rlm,ptr);
- ptr += strlen(rlm) + 1;
-
- /* extract ticket lifetime, server key version, ticket length */
- /* be sure to avoid sign extension on lifetime! */
- lifetime = (unsigned char) ptr[0];
- kvno = (unsigned char) ptr[1];
- tkt->length = (unsigned char) ptr[2];
- ptr += 3;
-
- if ((tkt->length < 0) ||
- ((tkt->length + (ptr - (char *) cip->dat)) > cip->length))
- return(INTK_BADPW);
-
- /* extract ticket itself */
- bcopy(ptr,(char *)(tkt->dat),tkt->length);
- ptr += tkt->length;
-
- if (strcmp(s_name, service) || strcmp(s_instance, sinstance) ||
- strcmp(rlm, realm)) /* not what we asked for */
- return(INTK_ERR); /* we need a better code here XXX */
-
- /* check KDC time stamp */
- bcopy(ptr,(char *)&kdc_time,4); /* Time (coarse) */
- if (swap_bytes) swap_u_long(kdc_time);
-
- ptr += 4;
-
- (void) gettimeofday(&t_local,(struct timezone *) 0);
- if (abs((int)(t_local.tv_sec - kdc_time)) > CLOCK_SKEW) {
- return(RD_AP_TIME); /* XXX should probably be better
- code */
- }
-
- /* initialize ticket cache */
- if (in_tkt(user,instance) != KSUCCESS)
- return(INTK_ERR);
-
- /* stash ticket, session key, etc. for future use */
- if ((kerror = save_credentials(s_name, s_instance, rlm, ses,
- lifetime, kvno, tkt, t_local.tv_sec)))
- return(kerror);
-
- return(INTK_OK);
-}
diff --git a/eBones/krb/krb_realmofhost.3 b/eBones/krb/krb_realmofhost.3
deleted file mode 100644
index 63aa1eb..0000000
--- a/eBones/krb/krb_realmofhost.3
+++ /dev/null
@@ -1,161 +0,0 @@
-.\" from: krb_realmofhost.3,v 4.1 89/01/23 11:10:47 jtkohl Exp $
-.\" $Id: krb_realmofhost.3,v 1.1.1.1 1994/09/30 14:50:07 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KRB_REALMOFHOST 3 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-krb_realmofhost, krb_get_phost, krb_get_krbhst, krb_get_admhst,
-krb_get_lrealm \- additional Kerberos utility routines
-.SH SYNOPSIS
-.nf
-.nj
-.ft B
-#include <kerberosIV/krb.h>
-#include <kerberosIV/des.h>
-#include <netinet/in.h>
-.PP
-.ft B
-char *krb_realmofhost(host)
-char *host;
-.PP
-.ft B
-char *krb_get_phost(alias)
-char *alias;
-.PP
-.ft B
-krb_get_krbhst(host,realm,n)
-char *host;
-char *realm;
-int n;
-.PP
-.ft B
-krb_get_admhst(host,realm,n)
-char *host;
-char *realm;
-int n;
-.PP
-.ft B
-krb_get_lrealm(realm,n)
-char *realm;
-int n;
-.fi
-.ft R
-.SH DESCRIPTION
-.I krb_realmofhost
-returns the Kerberos realm of the host
-.IR host ,
-as determined by the translation table
-.IR /etc/kerberosIV/krb.realms .
-.I host
-should be the fully-qualified domain-style primary host name of the host
-in question. In order to prevent certain security attacks, this routine
-must either have
-.I a priori
-knowledge of a host's realm, or obtain such information securely.
-.PP
-The format of the translation file is described by
-.IR krb.realms (5).
-If
-.I host
-exactly matches a host_name line, the corresponding realm
-is returned.
-Otherwise, if the domain portion of
-.I host
-matches a domain_name line, the corresponding realm
-is returned.
-If
-.I host
-contains a domain, but no translation is found,
-.IR host 's
-domain is converted to upper-case and returned.
-If
-.I host
-contains no discernable domain, or an error occurs,
-the local realm name, as supplied by
-.IR krb_get_lrealm (3),
-is returned.
-.PP
-.I krb_get_phost
-converts the hostname
-.I alias
-(which can be either an official name or an alias) into the instance
-name to be used in obtaining Kerberos tickets for most services,
-including the Berkeley rcmd suite (rlogin, rcp, rsh).
-.br
-The current convention is to return the first segment of the official
-domain-style name after conversion to lower case.
-.PP
-.I krb_get_krbhst
-fills in
-.I host
-with the hostname of the
-.IR n th
-host running a Kerberos key distribution center (KDC)
-for realm
-.IR realm ,
-as specified in the configuration file (\fI/etc/kerberosIV/krb.conf\fR).
-The configuration file is described by
-.IR krb.conf (5).
-If the host is successfully filled in, the routine
-returns KSUCCESS.
-If the file cannot be opened, and
-.I n
-equals 1, then the value of KRB_HOST as defined in
-.I <krb.h>
-is filled in, and KSUCCESS is returned. If there are fewer than
-.I n
-hosts running a Kerberos KDC for the requested realm, or the
-configuration file is malformed, the routine
-returns KFAILURE.
-.PP
-.I krb_get_admhst
-fills in
-.I host
-with the hostname of the
-.IR n th
-host running a Kerberos KDC database administration server
-for realm
-.IR realm ,
-as specified in the configuration file (\fI/etc/kerberosIV/krb.conf\fR).
-If the file cannot be opened or is malformed, or there are fewer than
-.I n
-hosts running a Kerberos KDC database administration server,
-the routine returns KFAILURE.
-.PP
-The character arrays used as return values for
-.IR krb_get_krbhst ,
-.IR krb_get_admhst ,
-should be large enough to
-hold any hostname (MAXHOSTNAMELEN from <sys/param.h>).
-.PP
-.I krb_get_lrealm
-fills in
-.I realm
-with the
-.IR n th
-realm of the local host, as specified in the configuration file.
-.I realm
-should be at least REALM_SZ (from
-.IR <krb.h>) characters long.
-.PP
-.SH SEE ALSO
-kerberos(3), krb.conf(5), krb.realms(5)
-.SH FILES
-.TP 20n
-/etc/kerberosIV/krb.realms
-translation file for host-to-realm mapping.
-.TP
-/etc/kerberosIV/krb.conf
-local realm-name and realm/server configuration file.
-.SH BUGS
-The current convention for instance names is too limited; the full
-domain name should be used.
-.PP
-.I krb_get_lrealm
-currently only supports
-.I n
-= 1. It should really consult the user's ticket cache to determine the
-user's current realm, rather than consulting a file on the host.
diff --git a/eBones/krb/krb_sendauth.3 b/eBones/krb/krb_sendauth.3
deleted file mode 100644
index a749bb5..0000000
--- a/eBones/krb/krb_sendauth.3
+++ /dev/null
@@ -1,348 +0,0 @@
-.\" from: krb_sendauth.3,v 4.1 89/01/23 11:10:58 jtkohl Exp $
-.\" $Id: krb_sendauth.3,v 1.1.1.1 1994/09/30 14:50:07 csgr Exp $
-.\" Copyright 1988 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KRB_SENDAUTH 3 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-krb_sendauth, krb_recvauth, krb_net_write, krb_net_read \-
-Kerberos routines for sending authentication via network stream sockets
-.SH SYNOPSIS
-.nf
-.nj
-.ft B
-#include <kerberosIV/krb.h>
-#include <kerberosIV/des.h>
-#include <netinet/in.h>
-.PP
-.fi
-.HP 1i
-.ft B
-int krb_sendauth(options, fd, ktext, service, inst, realm, checksum,
-msg_data, cred, schedule, laddr, faddr, version)
-.nf
-.RS 0
-.ft B
-long options;
-int fd;
-KTEXT ktext;
-char *service, *inst, *realm;
-u_long checksum;
-MSG_DAT *msg_data;
-CREDENTIALS *cred;
-Key_schedule schedule;
-struct sockaddr_in *laddr, *faddr;
-char *version;
-.PP
-.fi
-.HP 1i
-.ft B
-int krb_recvauth(options, fd, ktext, service, inst, faddr, laddr,
-auth_data, filename, schedule, version)
-.nf
-.RS 0
-.ft B
-long options;
-int fd;
-KTEXT ktext;
-char *service, *inst;
-struct sockaddr_in *faddr, *laddr;
-AUTH_DAT *auth_data;
-char *filename;
-Key_schedule schedule;
-char *version;
-.PP
-.ft B
-int krb_net_write(fd, buf, len)
-int fd;
-char *buf;
-int len;
-.PP
-.ft B
-int krb_net_read(fd, buf, len)
-int fd;
-char *buf;
-int len;
-.fi
-.SH DESCRIPTION
-.PP
-These functions,
-which are built on top of the core Kerberos library,
-provide a convenient means for client and server
-programs to send authentication messages
-to one another through network connections.
-The
-.I krb_sendauth
-function sends an authenticated ticket from the client program to
-the server program by writing the ticket to a network socket.
-The
-.I krb_recvauth
-function receives the ticket from the client by
-reading from a network socket.
-
-.SH KRB_SENDAUTH
-.PP
-This function writes the ticket to
-the network socket specified by the
-file descriptor
-.IR fd,
-returning KSUCCESS if the write proceeds successfully,
-and an error code if it does not.
-
-The
-.I ktext
-argument should point to an allocated KTEXT_ST structure.
-The
-.IR service,
-.IR inst,
-and
-.IR realm
-arguments specify the server program's Kerberos principal name,
-instance, and realm.
-If you are writing a client that uses the local realm exclusively,
-you can set the
-.I realm
-argument to NULL.
-
-The
-.I version
-argument allows the client program to pass an application-specific
-version string that the server program can then match against
-its own version string.
-The
-.I version
-string can be up to KSEND_VNO_LEN (see
-.IR <krb.h> )
-characters in length.
-
-The
-.I checksum
-argument can be used to pass checksum information to the
-server program.
-The client program is responsible for specifying this information.
-This checksum information is difficult to corrupt because
-.I krb_sendauth
-passes it over the network in encrypted form.
-The
-.I checksum
-argument is passed as the checksum argument to
-.IR krb_mk_req .
-
-You can set
-.IR krb_sendauth's
-other arguments to NULL unless you want the
-client and server programs to mutually authenticate
-themselves.
-In the case of mutual authentication,
-the client authenticates itself to the server program,
-and demands that the server in turn authenticate itself to
-the client.
-
-.SH KRB_SENDAUTH AND MUTUAL AUTHENTICATION
-.PP
-If you want mutual authentication,
-make sure that you read all pending data from the local socket
-before calling
-.IR krb_sendauth.
-Set
-.IR krb_sendauth's
-.I options
-argument to
-.BR KOPT_DO_MUTUAL
-(this macro is defined in the
-.IR krb.h
-file);
-make sure that the
-.I laddr
-argument points to
-the address of the local socket,
-and that
-.I faddr
-points to the foreign socket's network address.
-
-.I Krb_sendauth
-fills in the other arguments--
-.IR msg_data ,
-.IR cred ,
-and
-.IR schedule --before
-sending the ticket to the server program.
-You must, however, allocate space for these arguments
-before calling the function.
-
-.I Krb_sendauth
-supports two other options:
-.BR KOPT_DONT_MK_REQ,
-and
-.BR KOPT_DONT_CANON.
-If called with
-.I options
-set as KOPT_DONT_MK_REQ,
-.I krb_sendauth
-will not use the
-.I krb_mk_req
-function to retrieve the ticket from the Kerberos server.
-The
-.I ktext
-argument must point to an existing ticket and authenticator (such as
-would be created by
-.IR krb_mk_req ),
-and the
-.IR service,
-.IR inst,
-and
-.IR realm
-arguments can be set to NULL.
-
-If called with
-.I options
-set as KOPT_DONT_CANON,
-.I krb_sendauth
-will not convert the service's instance to canonical form using
-.IR krb_get_phost (3).
-
-If you want to call
-.I krb_sendauth
-with a multiple
-.I options
-specification,
-construct
-.I options
-as a bitwise-OR of the options you want to specify.
-
-.SH KRB_RECVAUTH
-.PP
-The
-.I krb_recvauth
-function
-reads a ticket/authenticator pair from the socket pointed to by the
-.I fd
-argument.
-Set the
-.I options
-argument
-as a bitwise-OR of the options desired.
-Currently only KOPT_DO_MUTUAL is useful to the receiver.
-
-The
-.I ktext
-argument
-should point to an allocated KTEXT_ST structure.
-.I Krb_recvauth
-fills
-.I ktext
-with the
-ticket/authenticator pair read from
-.IR fd ,
-then passes it to
-.IR krb_rd_req .
-
-The
-.I service
-and
-.I inst
-arguments
-specify the expected service and instance for which the ticket was
-generated. They are also passed to
-.IR krb_rd_req.
-The
-.I inst
-argument may be set to "*" if the caller wishes
-.I krb_mk_req
-to fill in the instance used (note that there must be space in the
-.I inst
-argument to hold a full instance name, see
-.IR krb_mk_req (3)).
-
-The
-.I faddr
-argument
-should point to the address of the peer which is presenting the ticket.
-It is also passed to
-.IR krb_rd_req .
-
-If the client and server plan to mutually authenticate
-one another,
-the
-.I laddr
-argument
-should point to the local address of the file descriptor.
-Otherwise you can set this argument to NULL.
-
-The
-.I auth_data
-argument
-should point to an allocated AUTH_DAT area.
-It is passed to and filled in by
-.IR krb_rd_req .
-The checksum passed to the corresponding
-.I krb_sendauth
-is available as part of the filled-in AUTH_DAT area.
-
-The
-.I filename
-argument
-specifies the filename
-which the service program should use to obtain its service key.
-.I Krb_recvauth
-passes
-.I filename
-to the
-.I krb_rd_req
-function.
-If you set this argument to "",
-.I krb_rd_req
-looks for the service key in the file
-.IR /etc/kerberosIV/srvtab.
-
-If the client and server are performing mutual authenication,
-the
-.I schedule
-argument
-should point to an allocated Key_schedule.
-Otherwise it is ignored and may be NULL.
-
-The
-.I version
-argument should point to a character array of at least KSEND_VNO_LEN
-characters. It is filled in with the version string passed by the client to
-.IR krb_sendauth.
-.PP
-.SH KRB_NET_WRITE AND KRB_NET_READ
-.PP
-The
-.I krb_net_write
-function
-emulates the write(2) system call, but guarantees that all data
-specified is written to
-.I fd
-before returning, unless an error condition occurs.
-.PP
-The
-.I krb_net_read
-function
-emulates the read(2) system call, but guarantees that the requested
-amount of data is read from
-.I fd
-before returning, unless an error condition occurs.
-.PP
-.SH BUGS
-.IR krb_sendauth,
-.IR krb_recvauth,
-.IR krb_net_write,
-and
-.IR krb_net_read
-will not work properly on sockets set to non-blocking I/O mode.
-
-.SH SEE ALSO
-
-krb_mk_req(3), krb_rd_req(3), krb_get_phost(3)
-
-.SH AUTHOR
-John T. Kohl, MIT Project Athena
-.SH RESTRICTIONS
-Copyright 1988, Massachusetts Instititute of Technology.
-For copying and distribution information,
-please see the file <Copyright.h>.
diff --git a/eBones/krb/krb_set_tkt_string.3 b/eBones/krb/krb_set_tkt_string.3
deleted file mode 100644
index 73b5e5d..0000000
--- a/eBones/krb/krb_set_tkt_string.3
+++ /dev/null
@@ -1,43 +0,0 @@
-.\" from: krb_set_tkt_string.3,v 4.1 89/01/23 11:11:09 jtkohl Exp $
-.\" $Id: krb_set_tkt_string.3,v 1.1.1.1 1994/09/30 14:50:07 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KRB_SET_TKT_STRING 3 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-krb_set_tkt_string \- set Kerberos ticket cache file name
-.SH SYNOPSIS
-.nf
-.nj
-.ft B
-#include <kerberosIV/krb.h>
-.PP
-.ft B
-void krb_set_tkt_string(filename)
-char *filename;
-.fi
-.ft R
-.SH DESCRIPTION
-.I krb_set_tkt_string
-sets the name of the file that holds the user's
-cache of Kerberos server tickets and associated session keys.
-.PP
-The string
-.I filename
-passed in is copied into local storage.
-Only MAXPATHLEN-1 (see <sys/param.h>) characters of the filename are
-copied in for use as the cache file name.
-.PP
-This routine should be called during initialization, before other
-Kerberos routines are called; otherwise the routines which fetch the
-ticket cache file name may be called and return an undesired ticket file
-name until this routine is called.
-.SH FILES
-.TP 20n
-/tmp/tkt[uid]
-default ticket file name, unless the environment variable KRBTKFILE is set.
-[uid] denotes the user's uid, in decimal.
-.SH SEE ALSO
-kerberos(3), setenv(3)
diff --git a/eBones/krb/krbglue.c b/eBones/krb/krbglue.c
deleted file mode 100644
index f82cf70..0000000
--- a/eBones/krb/krbglue.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: krbglue.c,v 4.1 89/01/23 15:51:50 wesommer Exp $
- * $Id: krbglue.c,v 1.3 1995/07/18 16:39:05 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-$Id: krbglue.c,v 1.3 1995/07/18 16:39:05 mark Exp $";
-#endif lint
-#endif
-
-#ifndef NCOMPAT
-/*
- * glue together new libraries and old clients
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <des.h>
-#include "krb.h"
-
-/* These definitions should be in krb.h, no? */
-/*
-#if defined(__HIGHC__)
-#undef __STDC__
-#endif
-#ifdef __STDC__
-extern int krb_mk_req (KTEXT, char *, char *, char *, long);
-extern int krb_rd_req (KTEXT, char *, char *, long, AUTH_DAT *, char *);
-extern int krb_kntoln (AUTH_DAT *, char *);
-extern int krb_set_key (char *, int);
-extern int krb_get_cred (char *, char *, char *, CREDENTIALS *);
-extern long krb_mk_priv (u_char *, u_char *, u_long, Key_schedule,
- C_Block, struct sockaddr_in *,
- struct sockaddr_in *);
-extern long krb_rd_priv (u_char *, u_long, Key_schedule,
- C_Block, struct sockaddr_in *,
- struct sockaddr_in *, MSG_DAT *);
-extern long krb_mk_safe (u_char *, u_char *, u_long, C_Block *,
- struct sockaddr_in *, struct sockaddr_in *);
-extern long krb_rd_safe (u_char *, u_long, C_Block *,
- struct sockaddr_in *, struct sockaddr_in *,
- MSG_DAT *);
-extern long krb_mk_err (u_char *, long, char *);
-extern int krb_rd_err (u_char *, u_long, long *, MSG_DAT *);
-extern int krb_get_pw_in_tkt (char *, char *, char *, char *, char *, int,
- char *);
-extern int krb_get_svc_in_tkt (char *, char *, char *, char *, char *, int,
- char *);
-extern int krb_get_pw_tkt (char *, char *, char *, char *);
-extern int krb_get_lrealm (char *, char *);
-extern int krb_realmofhost (char *);
-extern char *krb_get_phost (char *);
-extern int krb_get_krbhst (char *, char *, int);
-#ifdef DEBUG
-extern KTEXT krb_create_death_packet (char *);
-#endif
-#else
-extern int krb_mk_req ();
-extern int krb_rd_req ();
-extern int krb_kntoln ();
-extern int krb_set_key ();
-extern int krb_get_cred ();
-extern long krb_mk_priv ();
-extern long krb_rd_priv ();
-extern long krb_mk_safe ();
-extern long krb_rd_safe ();
-extern long krb_mk_err ();
-extern int krb_rd_err ();
-extern int krb_get_pw_in_tkt ();
-extern int krb_get_svc_in_tkt ();
-extern int krb_get_pw_tkt ();
-extern int krb_get_lrealm ();
-extern int krb_realmofhost ();
-extern char *krb_get_phost ();
-extern int krb_get_krbhst ();
-#ifdef DEBUG
-extern KTEXT krb_create_death_packet ();
-#endif
-#endif
-*/
-
-
-int mk_ap_req(authent, service, instance, realm, checksum)
- KTEXT authent;
- char *service, *instance, *realm;
- u_long checksum;
-{
- return krb_mk_req(authent,service,instance,realm,checksum);
-}
-
-int rd_ap_req(authent, service, instance, from_addr, ad, fn)
- KTEXT authent;
- char *service, *instance;
- u_long from_addr;
- AUTH_DAT *ad;
- char *fn;
-{
- return krb_rd_req(authent,service,instance,from_addr,ad,fn);
-}
-
-int an_to_ln(ad, lname)
- AUTH_DAT *ad;
- char *lname;
-{
- return krb_kntoln (ad,lname);
-}
-
-int set_serv_key (key, cvt)
- char *key;
- int cvt;
-{
- return krb_set_key(key,cvt);
-}
-
-int get_credentials (svc,inst,rlm,cred)
- char *svc, *inst, *rlm;
- CREDENTIALS *cred;
-{
- return krb_get_cred (svc, inst, rlm, cred);
-}
-
-long mk_private_msg (in,out,in_length,schedule,key,sender,receiver)
- u_char *in, *out;
- u_long in_length;
- Key_schedule schedule;
- C_Block key;
- struct sockaddr_in *sender, *receiver;
-{
- return krb_mk_priv (in,out,in_length,schedule,key,sender,receiver);
-}
-
-long rd_private_msg (in,in_length,schedule,key,sender,receiver,msg_data)
- u_char *in;
- u_long in_length;
- Key_schedule schedule;
- C_Block key;
- struct sockaddr_in *sender, *receiver;
- MSG_DAT *msg_data;
-{
- return krb_rd_priv (in,in_length,schedule,key,sender,receiver,msg_data);
-}
-
-long mk_safe_msg (in,out,in_length,key,sender,receiver)
- u_char *in, *out;
- u_long in_length;
- C_Block *key;
- struct sockaddr_in *sender, *receiver;
-{
- return krb_mk_safe (in,out,in_length,key,sender,receiver);
-}
-
-long rd_safe_msg (in,length,key,sender,receiver,msg_data)
- u_char *in;
- u_long length;
- C_Block *key;
- struct sockaddr_in *sender, *receiver;
- MSG_DAT *msg_data;
-{
- return krb_rd_safe (in,length,key,sender,receiver,msg_data);
-}
-
-long mk_appl_err_msg (out,code,string)
- u_char *out;
- long code;
- char *string;
-{
- return krb_mk_err (out,code,string);
-}
-
-long rd_appl_err_msg (in,length,code,msg_data)
- u_char *in;
- u_long length;
- long *code;
- MSG_DAT *msg_data;
-{
- return krb_rd_err (in,length,code,msg_data);
-}
-
-int get_in_tkt(user,instance,realm,service,sinstance,life,password)
- char *user, *instance, *realm, *service, *sinstance;
- int life;
- char *password;
-{
- return krb_get_pw_in_tkt(user,instance,realm,service,sinstance,
- life,password);
-}
-
-int get_svc_in_tkt(user, instance, realm, service, sinstance, life, srvtab)
- char *user, *instance, *realm, *service, *sinstance;
- int life;
- char *srvtab;
-{
- return krb_get_svc_in_tkt(user, instance, realm, service, sinstance,
- life, srvtab);
-}
-
-int get_pw_tkt(user,instance,realm,cpw)
- char *user;
- char *instance;
- char *realm;
- char *cpw;
-{
- return krb_get_pw_tkt(user,instance,realm,cpw);
-}
-
-int
-get_krbrlm (r, n)
-char *r;
-int n;
-{
- return krb_get_lream(r,n);
-}
-
-int
-krb_getrealm (host)
-{
- return krb_realmofhost(host);
-}
-
-char *
-get_phost (host)
-char *host
-{
- return krb_get_phost(host);
-}
-
-int
-get_krbhst (h, r, n)
-char *h;
-char *r;
-int n;
-{
- return krb_get_krbhst(h,r,n);
-}
-#ifdef DEBUG
-struct ktext *create_death_packet(a_name)
- char *a_name;
-{
- return krb_create_death_packet(a_name);
-}
-#endif /* DEBUG */
-
-#if 0
-extern int krb_ck_repl ();
-
-int check_replay ()
-{
- return krb_ck_repl ();
-}
-#endif
-#endif /* NCOMPAT */
diff --git a/eBones/krb/kuserok.3 b/eBones/krb/kuserok.3
deleted file mode 100644
index c7581a6..0000000
--- a/eBones/krb/kuserok.3
+++ /dev/null
@@ -1,63 +0,0 @@
-.\" from: kuserok.3,v 4.1 89/01/23 11:11:49 jtkohl Exp $
-.\" $Id: kuserok.3,v 1.1.1.1 1994/09/30 14:50:07 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KUSEROK 3 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-kuserok \- Kerberos version of ruserok
-.SH SYNOPSIS
-.nf
-.nj
-.ft B
-#include <kerberosIV/krb.h>
-.PP
-.ft B
-kuserok(kdata, localuser)
-AUTH_DAT *auth_data;
-char *localuser;
-.fi
-.ft R
-.SH DESCRIPTION
-.I kuserok
-determines whether a Kerberos principal described by the structure
-.I auth_data
-is authorized to login as user
-.I localuser
-according to the authorization file
-("~\fIlocaluser\fR/.klogin" by default). It returns 0 (zero) if authorized,
-1 (one) if not authorized.
-.PP
-If there is no account for
-.I localuser
-on the local machine, authorization is not granted.
-If there is no authorization file, and the Kerberos principal described
-by
-.I auth_data
-translates to
-.I localuser
-(using
-.IR krb_kntoln (3)),
-authorization is granted.
-If the authorization file
-can't be accessed, or the file is not owned by
-.IR localuser,
-authorization is denied. Otherwise, the file is searched for
-a matching principal name, instance, and realm. If a match is found,
-authorization is granted, else authorization is denied.
-.PP
-The file entries are in the format:
-.nf
-.in +5n
- name.instance@realm
-.in -5n
-.fi
-with one entry per line.
-.SH SEE ALSO
-kerberos(3), ruserok(3), krb_kntoln(3)
-.SH FILES
-.TP 20n
-~\fIlocaluser\fR/.klogin
-authorization list
diff --git a/eBones/krb/kuserok.c b/eBones/krb/kuserok.c
deleted file mode 100644
index 8e5d18a..0000000
--- a/eBones/krb/kuserok.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * kuserok: check if a kerberos principal has
- * access to a local account
- *
- * from: kuserok.c,v 4.5 89/01/23 09:25:21 jtkohl Exp $
- * $Id: kuserok.c,v 1.3 1995/07/18 16:39:07 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: kuserok.c,v 1.3 1995/07/18 16:39:07 mark Exp $";
-#endif lint
-#endif
-
-#include <krb.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <pwd.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#include <strings.h>
-
-#define OK 0
-#define NOTOK 1
-#define MAX_USERNAME 10
-
-/*
- * Given a Kerberos principal "kdata", and a local username "luser",
- * determine whether user is authorized to login according to the
- * authorization file ("~luser/.klogin" by default). Returns OK
- * if authorized, NOTOK if not authorized.
- *
- * If there is no account for "luser" on the local machine, returns
- * NOTOK. If there is no authorization file, and the given Kerberos
- * name "kdata" translates to the same name as "luser" (using
- * krb_kntoln()), returns OK. Otherwise, if the authorization file
- * can't be accessed, returns NOTOK. Otherwise, the file is read for
- * a matching principal name, instance, and realm. If one is found,
- * returns OK, if none is found, returns NOTOK.
- *
- * The file entries are in the format:
- *
- * name.instance@realm
- *
- * one entry per line.
- *
- * The ATHENA_COMPAT code supports old-style Athena ~luser/.klogin
- * file entries. See the file "kparse.c".
- */
-
-#ifdef ATHENA_COMPAT
-
-#include <kparse.h>
-
-/*
- * The parmtable defines the keywords we will recognize with their
- * default values, and keeps a pointer to the found value. The found
- * value should be filled in with strsave(), since FreeParameterSet()
- * will release memory for all non-NULL found strings.
- *
-*** NOTE WELL! ***
- *
- * The table below is very nice, but we cannot hard-code a default for the
- * realm: we have to get the realm via krb_get_lrealm(). Even though the
- * default shows as "from krb_get_lrealm, below", it gets changed in
- * kuserok to whatever krb_get_lrealm() tells us. That code assumes that
- * the realm will be the entry number in the table below, so if you
- * change the order of the entries below, you have to change the
- * #definition of REALM_SCRIPT to reflect it.
- */
-#define REALM_SUBSCRIPT 1
-parmtable kparm[] = {
-
-/* keyword default found value */
-{"user", "", (char *) NULL},
-{"realm", "see krb_get_lrealm, below", (char *) NULL},
-{"instance", "", (char *) NULL},
-};
-#define KPARMS kparm,PARMCOUNT(kparm)
-#endif ATHENA_COMPAT
-
-int
-kuserok(kdata, luser)
- AUTH_DAT *kdata;
- char *luser;
-{
- struct stat sbuf;
- struct passwd *pwd;
- char pbuf[MAXPATHLEN];
- int isok = NOTOK, rc;
- FILE *fp;
- char kuser[MAX_USERNAME];
- char principal[ANAME_SZ], inst[INST_SZ], realm[REALM_SZ];
- char linebuf[BUFSIZ];
- char *newline;
- int gobble;
-#ifdef ATHENA_COMPAT
- char local_realm[REALM_SZ];
-#endif ATHENA_COMPAT
-
- /* no account => no access */
- if ((pwd = getpwnam(luser)) == NULL) {
- return(NOTOK);
- }
- (void) strcpy(pbuf, pwd->pw_dir);
- (void) strcat(pbuf, "/.klogin");
-
- if (access(pbuf, F_OK)) { /* not accessible */
- /*
- * if he's trying to log in as himself, and there is no .klogin file,
- * let him. To find out, call
- * krb_kntoln to convert the triple in kdata to a name which we can
- * string compare.
- */
- if (!krb_kntoln(kdata, kuser) && (strcmp(kuser, luser) == 0)) {
- return(OK);
- }
- }
- /* open ~/.klogin */
- if ((fp = fopen(pbuf, "r")) == NULL) {
- return(NOTOK);
- }
- /*
- * security: if the user does not own his own .klogin file,
- * do not grant access
- */
- if (fstat(fileno(fp), &sbuf)) {
- fclose(fp);
- return(NOTOK);
- }
- if (sbuf.st_uid != pwd->pw_uid) {
- fclose(fp);
- return(NOTOK);
- }
-
-#ifdef ATHENA_COMPAT
- /* Accept old-style .klogin files */
-
- /*
- * change the default realm from the hard-coded value to the
- * accepted realm that Kerberos specifies.
- */
- rc = krb_get_lrealm(local_realm, 1);
- if (rc == KSUCCESS)
- kparm[REALM_SUBSCRIPT].defvalue = local_realm;
- else
- return (rc);
-
- /* check each line */
- while ((isok != OK) && (rc = fGetParameterSet(fp, KPARMS)) != PS_EOF) {
- switch (rc) {
- case PS_BAD_KEYWORD:
- case PS_SYNTAX:
- while (((gobble = fGetChar(fp)) != EOF) && (gobble != '\n'));
- break;
-
- case PS_OKAY:
- isok = (ParmCompare(KPARMS, "user", kdata->pname) ||
- ParmCompare(KPARMS, "instance", kdata->pinst) ||
- ParmCompare(KPARMS, "realm", kdata->prealm));
- break;
-
- default:
- break;
- }
- FreeParameterSet(kparm, PARMCOUNT(kparm));
- }
- /* reset the stream for parsing new-style names, if necessary */
- rewind(fp);
-#endif ATHENA_COMPAT
-
- /* check each line */
- while ((isok != OK) && (fgets(linebuf, BUFSIZ, fp) != NULL)) {
- /* null-terminate the input string */
- linebuf[BUFSIZ-1] = '\0';
- newline = NULL;
- /* nuke the newline if it exists */
- if ((newline = index(linebuf, '\n')))
- *newline = '\0';
- rc = kname_parse(principal, inst, realm, linebuf);
- if (rc == KSUCCESS) {
- isok = (strncmp(kdata->pname, principal, ANAME_SZ) ||
- strncmp(kdata->pinst, inst, INST_SZ) ||
- strncmp(kdata->prealm, realm, REALM_SZ));
- }
- /* clean up the rest of the line if necessary */
- if (!newline)
- while (((gobble = getc(fp)) != EOF) && gobble != '\n');
- }
- fclose(fp);
- return(isok);
-}
diff --git a/eBones/krb/log.c b/eBones/krb/log.c
deleted file mode 100644
index e33477f..0000000
--- a/eBones/krb/log.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: log.c,v 4.7 88/12/01 14:15:14 jtkohl Exp $
- * $Id: log.c,v 1.3 1995/07/18 16:39:09 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: log.c,v 1.3 1995/07/18 16:39:09 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <sys/time.h>
-#include <stdio.h>
-#include <krb.h>
-#include <klog.h>
-
-static char *log_name = KRBLOG;
-static is_open;
-
-/*
- * This file contains three logging routines: set_logfile()
- * to determine the file that log entries should be written to;
- * and log() and new_log() to write log entries to the file.
- */
-
-/*
- * log() is used to add entries to the logfile (see set_logfile()
- * below). Note that it is probably not portable since it makes
- * assumptions about what the compiler will do when it is called
- * with less than the correct number of arguments which is the
- * way it is usually called.
- *
- * The log entry consists of a timestamp and the given arguments
- * printed according to the given "format".
- *
- * The log file is opened and closed for each log entry.
- *
- * The return value is undefined.
- */
-
-__BEGIN_DECLS
-char *month_sname __P((int));
-__END_DECLS
-
-
-/*VARARGS1 */
-void log(format,a1,a2,a3,a4,a5,a6,a7,a8,a9,a0)
- char *format;
- int a1,a2,a3,a4,a5,a6,a7,a8,a9,a0;
-{
- FILE *logfile, *fopen();
- long time(),now;
- struct tm *tm;
-
- if ((logfile = fopen(log_name,"a")) == NULL)
- return;
-
- (void) time(&now);
- tm = localtime(&now);
-
- fprintf(logfile,"%2d-%s-%02d %02d:%02d:%02d ",tm->tm_mday,
- month_sname(tm->tm_mon + 1),tm->tm_year,
- tm->tm_hour, tm->tm_min, tm->tm_sec);
- fprintf(logfile,format,a1,a2,a3,a4,a5,a6,a7,a8,a9,a0);
- fprintf(logfile,"\n");
- (void) fclose(logfile);
- return;
-}
-
-/*
- * set_logfile() changes the name of the file to which
- * messages are logged. If set_logfile() is not called,
- * the logfile defaults to KRBLOG, defined in "krb.h".
- */
-
-void
-set_logfile(filename)
- char *filename;
-{
- log_name = filename;
- is_open = 0;
-}
-
-/*
- * new_log() appends a log entry containing the give time "t" and the
- * string "string" to the logfile (see set_logfile() above). The file
- * is opened once and left open. The routine returns 1 on failure, 0
- * on success.
- */
-
-int
-new_log(t,string)
- long t;
- char *string;
-{
- static FILE *logfile;
-
- long time();
- struct tm *tm;
-
- if (!is_open) {
- if ((logfile = fopen(log_name,"a")) == NULL) return(1);
- is_open = 1;
- }
-
- if (t) {
- tm = localtime(&t);
-
- fprintf(logfile,"\n%2d-%s-%02d %02d:%02d:%02d %s",tm->tm_mday,
- month_sname(tm->tm_mon + 1),tm->tm_year,
- tm->tm_hour, tm->tm_min, tm->tm_sec, string);
- }
- else {
- fprintf(logfile,"\n%20s%s","",string);
- }
-
- (void) fflush(logfile);
- return(0);
-}
diff --git a/eBones/krb/mk_err.c b/eBones/krb/mk_err.c
deleted file mode 100644
index 8600240..0000000
--- a/eBones/krb/mk_err.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: mk_err.c,v 4.4 88/11/15 16:33:36 jtkohl Exp $
- * $Id: mk_err.c,v 1.3 1995/07/18 16:39:11 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: mk_err.c,v 1.3 1995/07/18 16:39:11 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <sys/types.h>
-#include <krb.h>
-#include <prot.h>
-#include <strings.h>
-
-/*
- * This routine creates a general purpose error reply message. It
- * doesn't use KTEXT because application protocol may have long
- * messages, and may want this part of buffer contiguous to other
- * stuff.
- *
- * The error reply is built in "p", using the error code "e" and
- * error text "e_string" given. The length of the error reply is
- * returned.
- *
- * The error reply is in the following format:
- *
- * unsigned char KRB_PROT_VERSION protocol version no.
- * unsigned char AUTH_MSG_APPL_ERR message type
- * (least significant
- * bit of above) HOST_BYTE_ORDER local byte order
- * 4 bytes e given error code
- * string e_string given error text
- */
-
-long krb_mk_err(p,e,e_string)
- u_char *p; /* Where to build error packet */
- long e; /* Error code */
- char *e_string; /* Text of error */
-{
- u_char *start;
-
- start = p;
-
- /* Create fixed part of packet */
- *p++ = (unsigned char) KRB_PROT_VERSION;
- *p = (unsigned char) AUTH_MSG_APPL_ERR;
- *p++ |= HOST_BYTE_ORDER;
-
- /* Add the basic info */
- bcopy((char *)&e,(char *)p,4); /* err code */
- p += sizeof(e);
- (void) strcpy((char *)p,e_string); /* err text */
- p += strlen(e_string);
-
- /* And return the length */
- return p-start;
-}
diff --git a/eBones/krb/mk_priv.c b/eBones/krb/mk_priv.c
deleted file mode 100644
index d45d734..0000000
--- a/eBones/krb/mk_priv.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * This routine constructs a Kerberos 'private msg', i.e.
- * cryptographically sealed with a private session key.
- *
- * Note-- bcopy is used to avoid alignment problems on IBM RT.
- *
- * Note-- It's too bad that it did a long int compare on the RT before.
- *
- * Returns either < 0 ===> error, or resulting size of message
- *
- * Steve Miller Project Athena MIT/DEC
- *
- * from: mk_priv.c,v 4.13 89/03/22 14:48:59 jtkohl Exp $
- * $Id: mk_priv.c,v 1.3 1995/07/18 16:39:13 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: mk_priv.c,v 1.3 1995/07/18 16:39:13 mark Exp $";
-#endif /* lint */
-#endif
-
-/* system include files */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/time.h>
-
-/* application include files */
-#include <des.h>
-#include <krb.h>
-#include <prot.h>
-#include "lsb_addr_comp.h"
-
-extern char *errmsg();
-extern int errno;
-extern int krb_debug;
-
-/* static storage */
-
-
-static u_long c_length;
-static struct timeval msg_time;
-static u_char msg_time_5ms;
-static long msg_time_sec;
-
-/*
- * krb_mk_priv() constructs an AUTH_MSG_PRIVATE message. It takes
- * some user data "in" of "length" bytes and creates a packet in "out"
- * consisting of the user data, a timestamp, and the sender's network
- * address.
-#ifndef NOENCRYTION
- * The packet is encrypted by pcbc_encrypt(), using the given
- * "key" and "schedule".
-#endif
- * The length of the resulting packet "out" is
- * returned.
- *
- * It is similar to krb_mk_safe() except for the additional key
- * schedule argument "schedule" and the fact that the data is encrypted
- * rather than appended with a checksum. Also, the protocol version
- * number is "private_msg_ver", defined in krb_rd_priv.c, rather than
- * KRB_PROT_VERSION, defined in "krb.h".
- *
- * The "out" packet consists of:
- *
- * Size Variable Field
- * ---- -------- -----
- *
- * 1 byte private_msg_ver protocol version number
- * 1 byte AUTH_MSG_PRIVATE | message type plus local
- * HOST_BYTE_ORDER byte order in low bit
- *
- * 4 bytes c_length length of data
-#ifndef NOENCRYPT
- * we encrypt from here with pcbc_encrypt
-#endif
- *
- * 4 bytes length length of user data
- * length in user data
- * 1 byte msg_time_5ms timestamp milliseconds
- * 4 bytes sender->sin.addr.s_addr sender's IP address
- *
- * 4 bytes msg_time_sec or timestamp seconds with
- * -msg_time_sec direction in sign bit
- *
- * 0<=n<=7 bytes pad to 8 byte multiple zeroes
- */
-
-long krb_mk_priv(in,out,length,schedule,key,sender,receiver)
- u_char *in; /* application data */
- u_char *out; /* put msg here, leave room for
- * header! breaks if in and out
- * (header stuff) overlap */
- u_long length; /* of in data */
- Key_schedule schedule; /* precomputed key schedule */
- C_Block key; /* encryption key for seed and ivec */
- struct sockaddr_in *sender; /* sender address */
- struct sockaddr_in *receiver; /* receiver address */
-{
- register u_char *p,*q;
- static u_char *c_length_ptr;
- extern int private_msg_ver; /* in krb_rd_priv.c */
-
- /*
- * get the current time to use instead of a sequence #, since
- * process lifetime may be shorter than the lifetime of a session
- * key.
- */
- if (gettimeofday(&msg_time,(struct timezone *)0)) {
- return -1;
- }
- msg_time_sec = (long) msg_time.tv_sec;
- msg_time_5ms = msg_time.tv_usec/5000; /* 5ms quanta */
-
- p = out;
-
- *p++ = private_msg_ver;
- *p++ = AUTH_MSG_PRIVATE | HOST_BYTE_ORDER;
-
- /* calculate cipher length */
- c_length_ptr = p;
- p += sizeof(c_length);
-
- q = p;
-
- /* stuff input length */
- bcopy((char *)&length,(char *)p,sizeof(length));
- p += sizeof(length);
-
-#ifdef NOENCRYPTION
- /* make all the stuff contiguous for checksum */
-#else
- /* make all the stuff contiguous for checksum and encryption */
-#endif
- bcopy((char *)in,(char *)p,(int) length);
- p += length;
-
- /* stuff time 5ms */
- bcopy((char *)&msg_time_5ms,(char *)p,sizeof(msg_time_5ms));
- p += sizeof(msg_time_5ms);
-
- /* stuff source address */
- bcopy((char *)&sender->sin_addr.s_addr,(char *)p,
- sizeof(sender->sin_addr.s_addr));
- p += sizeof(sender->sin_addr.s_addr);
-
- /*
- * direction bit is the sign bit of the timestamp. Ok
- * until 2038??
- */
- /* For compatibility with broken old code, compares are done in VAX
- byte order (LSBFIRST) */
- if (lsb_net_ulong_less(sender->sin_addr.s_addr, /* src < recv */
- receiver->sin_addr.s_addr)==-1)
- msg_time_sec = -msg_time_sec;
- else if (lsb_net_ulong_less(sender->sin_addr.s_addr,
- receiver->sin_addr.s_addr)==0)
- if (lsb_net_ushort_less(sender->sin_port,receiver->sin_port) == -1)
- msg_time_sec = -msg_time_sec;
- /* stuff time sec */
- bcopy((char *)&msg_time_sec,(char *)p,sizeof(msg_time_sec));
- p += sizeof(msg_time_sec);
-
- /*
- * All that for one tiny bit! Heaven help those that talk to
- * themselves.
- */
-
-#ifdef notdef
- /*
- * calculate the checksum of the length, address, sequence, and
- * inp data
- */
- cksum = quad_cksum(q,NULL,p-q,0,key);
- if (krb_debug)
- printf("\ncksum = %u",cksum);
- /* stuff checksum */
- bcopy((char *) &cksum,(char *) p,sizeof(cksum));
- p += sizeof(cksum);
-#endif
-
- /*
- * All the data have been assembled, compute length
- */
-
- c_length = p - q;
- c_length = ((c_length + sizeof(C_Block) -1)/sizeof(C_Block)) *
- sizeof(C_Block);
- /* stuff the length */
- bcopy((char *) &c_length,(char *)c_length_ptr,sizeof(c_length));
-
-#ifndef NOENCRYPTION
- pcbc_encrypt((C_Block *)q,(C_Block *)q,(long)(p-q),schedule,(C_Block *)key,
- ENCRYPT);
-#endif /* NOENCRYPTION */
-
- return (q - out + c_length); /* resulting size */
-}
diff --git a/eBones/krb/mk_req.c b/eBones/krb/mk_req.c
deleted file mode 100644
index a27c1c0..0000000
--- a/eBones/krb/mk_req.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: der: mk_req.c,v 4.17 89/07/07 15:20:35 jtkohl Exp $
- * $Id: mk_req.c,v 1.3 1995/07/18 16:39:15 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: mk_req.c,v 1.3 1995/07/18 16:39:15 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <krb.h>
-#include <prot.h>
-#include <des.h>
-#include <sys/time.h>
-#include <strings.h>
-
-extern int krb_ap_req_debug;
-static struct timeval tv_local = { 0, 0 };
-static int lifetime = DEFAULT_TKT_LIFE;
-
-/*
- * krb_mk_req takes a text structure in which an authenticator is to
- * be built, the name of a service, an instance, a realm,
- * and a checksum. It then retrieves a ticket for
- * the desired service and creates an authenticator in the text
- * structure passed as the first argument. krb_mk_req returns
- * KSUCCESS on success and a Kerberos error code on failure.
- *
- * The peer procedure on the other end is krb_rd_req. When making
- * any changes to this routine it is important to make corresponding
- * changes to krb_rd_req.
- *
- * The authenticator consists of the following:
- *
- * authent->dat
- *
- * unsigned char KRB_PROT_VERSION protocol version no.
- * unsigned char AUTH_MSG_APPL_REQUEST message type
- * (least significant
- * bit of above) HOST_BYTE_ORDER local byte ordering
- * unsigned char kvno from ticket server's key version
- * string realm server's realm
- * unsigned char tl ticket length
- * unsigned char idl request id length
- * text ticket->dat ticket for server
- * text req_id->dat request id
- *
- * The ticket information is retrieved from the ticket cache or
- * fetched from Kerberos. The request id (called the "authenticator"
- * in the papers on Kerberos) contains the following:
- *
- * req_id->dat
- *
- * string cr.pname {name, instance, and
- * string cr.pinst realm of principal
- * string myrealm making this request}
- * 4 bytes checksum checksum argument given
- * unsigned char tv_local.tf_usec time (milliseconds)
- * 4 bytes tv_local.tv_sec time (seconds)
- *
- * req_id->length = 3 strings + 3 terminating nulls + 5 bytes for time,
- * all rounded up to multiple of 8.
- */
-
-int
-krb_mk_req(authent,service,instance,realm,checksum)
- register KTEXT authent; /* Place to build the authenticator */
- char *service; /* Name of the service */
- char *instance; /* Service instance */
- char *realm; /* Authentication domain of service */
- long checksum; /* Checksum of data (optional) */
-{
- static KTEXT_ST req_st; /* Temp storage for req id */
- register KTEXT req_id = &req_st;
- unsigned char *v = authent->dat; /* Prot version number */
- unsigned char *t = (authent->dat+1); /* Message type */
- unsigned char *kv = (authent->dat+2); /* Key version no */
- unsigned char *tl = (authent->dat+4+strlen(realm)); /* Tkt len */
- unsigned char *idl = (authent->dat+5+strlen(realm)); /* Reqid len */
- CREDENTIALS cr; /* Credentials used by retr */
- register KTEXT ticket = &(cr.ticket_st); /* Pointer to tkt_st */
- int retval; /* Returned by krb_get_cred */
- static Key_schedule key_s;
- char myrealm[REALM_SZ];
-
- /* The fixed parts of the authenticator */
- *v = (unsigned char) KRB_PROT_VERSION;
- *t = (unsigned char) AUTH_MSG_APPL_REQUEST;
- *t |= HOST_BYTE_ORDER;
-
- /* Get the ticket and move it into the authenticator */
- if (krb_ap_req_debug)
- printf("Realm: %s\n",realm);
- /*
- * Determine realm of these tickets. We will send this to the
- * KDC from which we are requesting tickets so it knows what to
- * with our session key.
- */
- if ((retval = krb_get_tf_realm(TKT_FILE, myrealm)) != KSUCCESS)
- return(retval);
-
- retval = krb_get_cred(service,instance,realm,&cr);
-
- if (retval == RET_NOTKT) {
- if ((retval = get_ad_tkt(service,instance,realm,lifetime)))
- return(retval);
- if ((retval = krb_get_cred(service,instance,realm,&cr)))
- return(retval);
- }
-
- if (retval != KSUCCESS) return (retval);
-
- if (krb_ap_req_debug)
- printf("%s %s %s %s %s\n", service, instance, realm,
- cr.pname, cr.pinst);
- *kv = (unsigned char) cr.kvno;
- (void) strcpy((char *)(authent->dat+3),realm);
- *tl = (unsigned char) ticket->length;
- bcopy((char *)(ticket->dat),(char *)(authent->dat+6+strlen(realm)),
- ticket->length);
- authent->length = 6 + strlen(realm) + ticket->length;
- if (krb_ap_req_debug)
- printf("Ticket->length = %d\n",ticket->length);
- if (krb_ap_req_debug)
- printf("Issue date: %ld\n",cr.issue_date);
-
- /* Build request id */
- (void) strcpy((char *)(req_id->dat),cr.pname); /* Auth name */
- req_id->length = strlen(cr.pname)+1;
- /* Principal's instance */
- (void) strcpy((char *)(req_id->dat+req_id->length),cr.pinst);
- req_id->length += strlen(cr.pinst)+1;
- /* Authentication domain */
- (void) strcpy((char *)(req_id->dat+req_id->length),myrealm);
- req_id->length += strlen(myrealm)+1;
- /* Checksum */
- bcopy((char *)&checksum,(char *)(req_id->dat+req_id->length),4);
- req_id->length += 4;
-
- /* Fill in the times on the request id */
- (void) gettimeofday(&tv_local,(struct timezone *) 0);
- *(req_id->dat+(req_id->length)++) =
- (unsigned char) tv_local.tv_usec;
- /* Time (coarse) */
- bcopy((char *)&(tv_local.tv_sec),
- (char *)(req_id->dat+req_id->length), 4);
- req_id->length += 4;
-
- /* Fill to a multiple of 8 bytes for DES */
- req_id->length = ((req_id->length+7)/8)*8;
-
-#ifndef NOENCRYPTION
- key_sched((C_Block *)cr.session,key_s);
- pcbc_encrypt((C_Block *)req_id->dat,(C_Block *)req_id->dat,
- (long)req_id->length,key_s,(C_Block *)cr.session,ENCRYPT);
- bzero((char *) key_s, sizeof(key_s));
-#endif /* NOENCRYPTION */
-
- /* Copy it into the authenticator */
- bcopy((char *)(req_id->dat),(char *)(authent->dat+authent->length),
- req_id->length);
- authent->length += req_id->length;
- /* And set the id length */
- *idl = (unsigned char) req_id->length;
- /* clean up */
- bzero((char *)req_id, sizeof(*req_id));
-
- if (krb_ap_req_debug)
- printf("Authent->length = %d\n",authent->length);
- if (krb_ap_req_debug)
- printf("idl = %d, tl = %d\n",(int) *idl, (int) *tl);
-
- return(KSUCCESS);
-}
-
-/*
- * krb_set_lifetime sets the default lifetime for additional tickets
- * obtained via krb_mk_req().
- *
- * It returns the previous value of the default lifetime.
- */
-
-int
-krb_set_lifetime(newval)
-int newval;
-{
- int olife = lifetime;
-
- lifetime = newval;
- return(olife);
-}
diff --git a/eBones/krb/mk_safe.c b/eBones/krb/mk_safe.c
deleted file mode 100644
index e5490bc..0000000
--- a/eBones/krb/mk_safe.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * This routine constructs a Kerberos 'safe msg', i.e. authenticated
- * using a private session key to seed a checksum. Msg is NOT
- * encrypted.
- *
- * Note-- bcopy is used to avoid alignment problems on IBM RT
- *
- * Returns either <0 ===> error, or resulting size of message
- *
- * Steve Miller Project Athena MIT/DEC
- *
- * from: mk_safe.c,v 4.12 89/03/22 14:50:49 jtkohl Exp $
- * $Id: mk_safe.c,v 1.3 1995/07/18 16:39:17 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: mk_safe.c,v 1.3 1995/07/18 16:39:17 mark Exp $";
-#endif /* lint */
-#endif
-
-/* system include files */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/time.h>
-
-/* application include files */
-#include <des.h>
-#include <krb.h>
-#include <prot.h>
-#include "lsb_addr_comp.h"
-
-extern char *errmsg();
-extern int errno;
-extern int krb_debug;
-
-/* static storage */
-
-static u_long cksum;
-static C_Block big_cksum[2];
-static struct timeval msg_time;
-static u_char msg_time_5ms;
-static long msg_time_sec;
-
-/*
- * krb_mk_safe() constructs an AUTH_MSG_SAFE message. It takes some
- * user data "in" of "length" bytes and creates a packet in "out"
- * consisting of the user data, a timestamp, and the sender's network
- * address, followed by a checksum computed on the above, using the
- * given "key". The length of the resulting packet is returned.
- *
- * The "out" packet consists of:
- *
- * Size Variable Field
- * ---- -------- -----
- *
- * 1 byte KRB_PROT_VERSION protocol version number
- * 1 byte AUTH_MSG_SAFE | message type plus local
- * HOST_BYTE_ORDER byte order in low bit
- *
- * ===================== begin checksum ================================
- *
- * 4 bytes length length of user data
- * length in user data
- * 1 byte msg_time_5ms timestamp milliseconds
- * 4 bytes sender->sin.addr.s_addr sender's IP address
- *
- * 4 bytes msg_time_sec or timestamp seconds with
- * -msg_time_sec direction in sign bit
- *
- * ======================= end checksum ================================
- *
- * 16 bytes big_cksum quadratic checksum of
- * above using "key"
- */
-
-long krb_mk_safe(in,out,length,key,sender,receiver)
- u_char *in; /* application data */
- u_char *out; /*
- * put msg here, leave room for header!
- * breaks if in and out (header stuff)
- * overlap
- */
- u_long length; /* of in data */
- C_Block *key; /* encryption key for seed and ivec */
- struct sockaddr_in *sender; /* sender address */
- struct sockaddr_in *receiver; /* receiver address */
-{
- register u_char *p,*q;
-
- /*
- * get the current time to use instead of a sequence #, since
- * process lifetime may be shorter than the lifetime of a session
- * key.
- */
- if (gettimeofday(&msg_time,(struct timezone *)0)) {
- return -1;
- }
- msg_time_sec = (long) msg_time.tv_sec;
- msg_time_5ms = msg_time.tv_usec/5000; /* 5ms quanta */
-
- p = out;
-
- *p++ = KRB_PROT_VERSION;
- *p++ = AUTH_MSG_SAFE | HOST_BYTE_ORDER;
-
- q = p; /* start for checksum stuff */
- /* stuff input length */
- bcopy((char *)&length,(char *)p,sizeof(length));
- p += sizeof(length);
-
- /* make all the stuff contiguous for checksum */
- bcopy((char *)in,(char *)p,(int) length);
- p += length;
-
- /* stuff time 5ms */
- bcopy((char *)&msg_time_5ms,(char *)p,sizeof(msg_time_5ms));
- p += sizeof(msg_time_5ms);
-
- /* stuff source address */
- bcopy((char *) &sender->sin_addr.s_addr,(char *)p,
- sizeof(sender->sin_addr.s_addr));
- p += sizeof(sender->sin_addr.s_addr);
-
- /*
- * direction bit is the sign bit of the timestamp. Ok until
- * 2038??
- */
- /* For compatibility with broken old code, compares are done in VAX
- byte order (LSBFIRST) */
- if (lsb_net_ulong_less(sender->sin_addr.s_addr, /* src < recv */
- receiver->sin_addr.s_addr)==-1)
- msg_time_sec = -msg_time_sec;
- else if (lsb_net_ulong_less(sender->sin_addr.s_addr,
- receiver->sin_addr.s_addr)==0)
- if (lsb_net_ushort_less(sender->sin_port,receiver->sin_port) == -1)
- msg_time_sec = -msg_time_sec;
- /*
- * all that for one tiny bit! Heaven help those that talk to
- * themselves.
- */
-
- /* stuff time sec */
- bcopy((char *)&msg_time_sec,(char *)p,sizeof(msg_time_sec));
- p += sizeof(msg_time_sec);
-
-#ifdef NOENCRYPTION
- cksum = 0;
- bzero(big_cksum, sizeof(big_cksum));
-#else
- cksum=quad_cksum((C_Block *)q,big_cksum,p-q,2,key);
-#endif
- if (krb_debug)
- printf("\ncksum = %lu",cksum);
-
- /* stuff checksum */
- bcopy((char *)big_cksum,(char *)p,sizeof(big_cksum));
- p += sizeof(big_cksum);
-
- return ((long)(p - out)); /* resulting size */
-
-}
diff --git a/eBones/krb/month_sname.c b/eBones/krb/month_sname.c
deleted file mode 100644
index f4ef339..0000000
--- a/eBones/krb/month_sname.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: month_sname.c,v 4.4 88/11/15 16:39:32 jtkohl Exp $
- * $Id: month_sname.c,v 1.3 1995/07/18 16:39:19 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: month_sname.c,v 1.3 1995/07/18 16:39:19 mark Exp $";
-#endif /* lint */
-#endif
-
-
-/*
- * Given an integer 1-12, month_sname() returns a string
- * containing the first three letters of the corresponding
- * month. Returns 0 if the argument is out of range.
- */
-
-char *month_sname(n)
- int n;
-{
- static char *name[] = {
- "Jan","Feb","Mar","Apr","May","Jun",
- "Jul","Aug","Sep","Oct","Nov","Dec"
- };
- return((n < 1 || n > 12) ? 0 : name [n-1]);
-}
diff --git a/eBones/krb/netread.c b/eBones/krb/netread.c
deleted file mode 100644
index 628004e..0000000
--- a/eBones/krb/netread.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: netread.c,v 4.1 88/11/15 16:47:21 jtkohl Exp $
- * $Id: netread.c,v 1.3 1995/07/18 16:39:20 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: netread.c,v 1.3 1995/07/18 16:39:20 mark Exp $";
-#endif lint
-#endif
-
-#include <unistd.h>
-
-/*
- * krb_net_read() reads from the file descriptor "fd" to the buffer
- * "buf", until either 1) "len" bytes have been read or 2) cannot
- * read anymore from "fd". It returns the number of bytes read
- * or a read() error. (The calling interface is identical to
- * read(2).)
- *
- * XXX must not use non-blocking I/O
- */
-
-int
-krb_net_read(fd, buf, len)
-int fd;
-register char *buf;
-register int len;
-{
- int cc, len2 = 0;
-
- do {
- cc = read(fd, buf, len);
- if (cc < 0)
- return(cc); /* errno is already set */
- else if (cc == 0) {
- return(len2);
- } else {
- buf += cc;
- len2 += cc;
- len -= cc;
- }
- } while (len > 0);
- return(len2);
-}
diff --git a/eBones/krb/netwrite.c b/eBones/krb/netwrite.c
deleted file mode 100644
index f85f7ba..0000000
--- a/eBones/krb/netwrite.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: netwrite.c,v 4.1 88/11/15 16:48:58 jtkohl Exp $";
- * $Id: netwrite.c,v 1.3 1995/07/18 16:39:22 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: netwrite.c,v 1.3 1995/07/18 16:39:22 mark Exp $";
-#endif lint
-#endif
-
-#include <unistd.h>
-
-/*
- * krb_net_write() writes "len" bytes from "buf" to the file
- * descriptor "fd". It returns the number of bytes written or
- * a write() error. (The calling interface is identical to
- * write(2).)
- *
- * XXX must not use non-blocking I/O
- */
-
-int
-krb_net_write(fd, buf, len)
-int fd;
-register char *buf;
-int len;
-{
- int cc;
- register int wrlen = len;
- do {
- cc = write(fd, buf, wrlen);
- if (cc < 0)
- return(cc);
- else {
- buf += cc;
- wrlen -= cc;
- }
- } while (wrlen > 0);
- return(len);
-}
diff --git a/eBones/krb/one.c b/eBones/krb/one.c
deleted file mode 100644
index ef02ae1..0000000
--- a/eBones/krb/one.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * form: one.c,v 4.1 88/11/15 16:51:41 jtkohl Exp $
- * $Id: one.c,v 1.3 1995/07/18 16:39:24 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: one.c,v 1.3 1995/07/18 16:39:24 mark Exp $";
-#endif lint
-#endif
-
-/*
- * definition of variable set to 1.
- * used in krb_conf.h to determine host byte order.
- */
-
-int krbONE = 1;
diff --git a/eBones/krb/pkt_cipher.c b/eBones/krb/pkt_cipher.c
deleted file mode 100644
index 9c32b72..0000000
--- a/eBones/krb/pkt_cipher.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: pkt_cipher.c,v 4.8 89/01/13 17:46:14 steiner Exp $
- * $Id: pkt_cipher.c,v 1.3 1995/07/18 16:39:25 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: pkt_cipher.c,v 1.3 1995/07/18 16:39:25 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <krb.h>
-#include <prot.h>
-
-
-/*
- * This routine takes a reply packet from the Kerberos ticket-granting
- * service and returns a pointer to the beginning of the ciphertext in it.
- *
- * See "prot.h" for packet format.
- */
-
-KTEXT
-pkt_cipher(packet)
- KTEXT packet;
-{
- unsigned char *ptr = pkt_a_realm(packet) + 6
- + strlen((char *)pkt_a_realm(packet));
- /* Skip a few more fields */
- ptr += 3 + 4; /* add 4 for exp_date */
-
- /* And return the pointer */
- return((KTEXT) ptr);
-}
diff --git a/eBones/krb/pkt_clen.c b/eBones/krb/pkt_clen.c
deleted file mode 100644
index f8dacae..0000000
--- a/eBones/krb/pkt_clen.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: pkt_clen.c,v 4.7 88/11/15 16:56:36 jtkohl Exp $
- * $Id: pkt_clen.c,v 1.3 1995/07/18 16:39:27 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: pkt_clen.c,v 1.3 1995/07/18 16:39:27 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <string.h>
-
-#include <krb.h>
-#include <prot.h>
-
-extern int krb_debug;
-extern int swap_bytes;
-
-/*
- * Given a pointer to an AUTH_MSG_KDC_REPLY packet, return the length of
- * its ciphertext portion. The external variable "swap_bytes" is assumed
- * to have been set to indicate whether or not the packet is in local
- * byte order. pkt_clen() takes this into account when reading the
- * ciphertext length out of the packet.
- */
-
-int
-pkt_clen(pkt)
- KTEXT pkt;
-{
- static unsigned short temp,temp2;
- int clen = 0;
-
- /* Start of ticket list */
- unsigned char *ptr = pkt_a_realm(pkt) + 10
- + strlen((char *)pkt_a_realm(pkt));
-
- /* Finally the length */
- bcopy((char *)(++ptr),(char *)&temp,2); /* alignment */
- if (swap_bytes) {
- /* assume a short is 2 bytes?? */
- swab((char *)&temp,(char *)&temp2,2);
- temp = temp2;
- }
-
- clen = (int) temp;
-
- if (krb_debug)
- printf("Clen is %d\n",clen);
- return(clen);
-}
diff --git a/eBones/krb/rd_err.c b/eBones/krb/rd_err.c
deleted file mode 100644
index e46dc66..0000000
--- a/eBones/krb/rd_err.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * This routine dissects a a Kerberos 'safe msg',
- * checking its integrity, and returning a pointer to the application
- * data contained and its length.
- *
- * Returns 0 (RD_AP_OK) for success or an error code (RD_AP_...)
- *
- * Steve Miller Project Athena MIT/DEC
- *
- * from: rd_err.c,v 4.5 89/01/13 17:26:38 steiner Exp $
- * $Id: rd_err.c,v 1.3 1995/07/18 16:39:29 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: rd_err.c,v 1.3 1995/07/18 16:39:29 mark Exp $";
-#endif /* lint */
-#endif
-
-/* system include files */
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/time.h>
-
-/* application include files */
-#include <krb.h>
-#include <prot.h>
-
-/*
- * Given an AUTH_MSG_APPL_ERR message, "in" and its length "in_length",
- * return the error code from the message in "code" and the text in
- * "m_data" as follows:
- *
- * m_data->app_data points to the error text
- * m_data->app_length points to the length of the error text
- *
- * If all goes well, return RD_AP_OK. If the version number
- * is wrong, return RD_AP_VERSION, and if it's not an AUTH_MSG_APPL_ERR
- * type message, return RD_AP_MSG_TYPE.
- *
- * The AUTH_MSG_APPL_ERR message format can be found in mk_err.c
- */
-
-int
-krb_rd_err(in,in_length,code,m_data)
- u_char *in; /* pointer to the msg received */
- u_long in_length; /* of in msg */
- long *code; /* received error code */
- MSG_DAT *m_data;
-{
- register u_char *p;
- int swap_bytes = 0;
- p = in; /* beginning of message */
-
- if (*p++ != KRB_PROT_VERSION)
- return(RD_AP_VERSION);
- if (((*p) & ~1) != AUTH_MSG_APPL_ERR)
- return(RD_AP_MSG_TYPE);
- if ((*p++ & 1) != HOST_BYTE_ORDER)
- swap_bytes++;
-
- /* safely get code */
- bcopy((char *)p,(char *)code,sizeof(*code));
- if (swap_bytes)
- swap_u_long(*code);
- p += sizeof(*code); /* skip over */
-
- m_data->app_data = p; /* we're now at the error text
- * message */
- m_data->app_length = in_length;
-
- return(RD_AP_OK); /* OK == 0 */
-}
diff --git a/eBones/krb/rd_priv.c b/eBones/krb/rd_priv.c
deleted file mode 100644
index 0c21a1d..0000000
--- a/eBones/krb/rd_priv.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * This routine dissects a a Kerberos 'private msg', decrypting it,
- * checking its integrity, and returning a pointer to the application
- * data contained and its length.
- *
- * Returns 0 (RD_AP_OK) for success or an error code (RD_AP_...). If
- * the return value is RD_AP_TIME, then either the times are too far
- * out of synch, OR the packet was modified.
- *
- * Steve Miller Project Athena MIT/DEC
- *
- * from: rd_priv.c,v 4.14 89/04/28 11:59:42 jtkohl Exp $
- * $Id: rd_priv.c,v 1.3 1995/07/18 16:39:31 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[]=
-"$Id: rd_priv.c,v 1.3 1995/07/18 16:39:31 mark Exp $";
-#endif /* lint */
-#endif
-
-/* system include files */
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/time.h>
-
-/* application include files */
-#include <des.h>
-#include <krb.h>
-#include <prot.h>
-#include "lsb_addr_comp.h"
-
-extern int krb_debug;
-
-/* static storage */
-
-static u_long c_length;
-static int swap_bytes;
-static struct timeval local_time;
-static long delta_t;
-int private_msg_ver = KRB_PROT_VERSION;
-
-/*
-#ifdef NOENCRPYTION
- * krb_rd_priv() checks the integrity of an
-#else
- * krb_rd_priv() decrypts and checks the integrity of an
-#endif
- * AUTH_MSG_PRIVATE message. Given the message received, "in",
- * the length of that message, "in_length", the key "schedule"
- * and "key", and the network addresses of the
- * "sender" and "receiver" of the message, krb_rd_safe() returns
- * RD_AP_OK if the message is okay, otherwise some error code.
- *
- * The message data retrieved from "in" are returned in the structure
- * "m_data". The pointer to the application data
- * (m_data->app_data) refers back to the appropriate place in "in".
- *
- * See the file "mk_priv.c" for the format of the AUTH_MSG_PRIVATE
- * message. The structure containing the extracted message
- * information, MSG_DAT, is defined in "krb.h".
- */
-
-long
-krb_rd_priv(in,in_length,schedule,key,sender,receiver,m_data)
- u_char *in; /* pointer to the msg received */
- u_long in_length; /* length of "in" msg */
- Key_schedule schedule; /* precomputed key schedule */
- C_Block key; /* encryption key for seed and ivec */
- struct sockaddr_in *sender;
- struct sockaddr_in *receiver;
- MSG_DAT *m_data; /*various input/output data from msg */
-{
- register u_char *p,*q;
- static u_long src_addr; /* Can't send structs since no
- * guarantees on size */
-
- if (gettimeofday(&local_time,(struct timezone *)0))
- return -1;
-
- p = in; /* beginning of message */
- swap_bytes = 0;
-
- if (*p++ != KRB_PROT_VERSION && *(p-1) != 3)
- return RD_AP_VERSION;
- private_msg_ver = *(p-1);
- if (((*p) & ~1) != AUTH_MSG_PRIVATE)
- return RD_AP_MSG_TYPE;
- if ((*p++ & 1) != HOST_BYTE_ORDER)
- swap_bytes++;
-
- /* get cipher length */
- bcopy((char *)p,(char *)&c_length,sizeof(c_length));
- if (swap_bytes)
- swap_u_long(c_length);
- p += sizeof(c_length);
- /* check for rational length so we don't go comatose */
- if (VERSION_SZ + MSG_TYPE_SZ + c_length > in_length)
- return RD_AP_MODIFIED;
-
-
- q = p; /* mark start of encrypted stuff */
-
-#ifndef NOENCRYPTION
- pcbc_encrypt((C_Block *)q,(C_Block *)q,(long)c_length,schedule,
- (C_Block *)key,DECRYPT);
-#endif
-
- /* safely get application data length */
- bcopy((char *) p,(char *)&(m_data->app_length),
- sizeof(m_data->app_length));
- if (swap_bytes)
- swap_u_long(m_data->app_length);
- p += sizeof(m_data->app_length); /* skip over */
-
- if (m_data->app_length + sizeof(c_length) + sizeof(in_length) +
- sizeof(m_data->time_sec) + sizeof(m_data->time_5ms) +
- sizeof(src_addr) + VERSION_SZ + MSG_TYPE_SZ
- > in_length)
- return RD_AP_MODIFIED;
-
-#ifndef NOENCRYPTION
- /* we're now at the decrypted application data */
-#endif
- m_data->app_data = p;
-
- p += m_data->app_length;
-
- /* safely get time_5ms */
- bcopy((char *) p, (char *)&(m_data->time_5ms),
- sizeof(m_data->time_5ms));
- /* don't need to swap-- one byte for now */
- p += sizeof(m_data->time_5ms);
-
- /* safely get src address */
- bcopy((char *) p,(char *)&src_addr,sizeof(src_addr));
- /* don't swap, net order always */
- p += sizeof(src_addr);
-
- if (src_addr != (u_long) sender->sin_addr.s_addr)
- return RD_AP_MODIFIED;
-
- /* safely get time_sec */
- bcopy((char *) p, (char *)&(m_data->time_sec),
- sizeof(m_data->time_sec));
- if (swap_bytes) swap_u_long(m_data->time_sec);
-
- p += sizeof(m_data->time_sec);
-
- /* check direction bit is the sign bit */
- /* For compatibility with broken old code, compares are done in VAX
- byte order (LSBFIRST) */
- if (lsb_net_ulong_less(sender->sin_addr.s_addr,
- receiver->sin_addr.s_addr)==-1)
- /* src < recv */
- m_data->time_sec = - m_data->time_sec;
- else if (lsb_net_ulong_less(sender->sin_addr.s_addr,
- receiver->sin_addr.s_addr)==0)
- if (lsb_net_ushort_less(sender->sin_port,receiver->sin_port)==-1)
- /* src < recv */
- m_data->time_sec = - m_data->time_sec;
- /*
- * all that for one tiny bit!
- * Heaven help those that talk to themselves.
- */
-
- /* check the time integrity of the msg */
- delta_t = abs((int)((long) local_time.tv_sec
- - m_data->time_sec));
- if (delta_t > CLOCK_SKEW)
- return RD_AP_TIME;
- if (krb_debug)
- printf("\ndelta_t = %ld",delta_t);
-
- /*
- * caller must check timestamps for proper order and
- * replays, since server might have multiple clients
- * each with its own timestamps and we don't assume
- * tightly synchronized clocks.
- */
-
-#ifdef notdef
- bcopy((char *) p,(char *)&cksum,sizeof(cksum));
- if (swap_bytes) swap_u_long(cksum)
- /*
- * calculate the checksum of the length, sequence,
- * and input data, on the sending byte order!!
- */
- calc_cksum = quad_cksum(q,NULL,p-q,0,key);
-
- if (krb_debug)
- printf("\ncalc_cksum = %u, received cksum = %u",
- calc_cksum, cksum);
- if (cksum != calc_cksum)
- return RD_AP_MODIFIED;
-#endif
- return RD_AP_OK; /* OK == 0 */
-}
diff --git a/eBones/krb/rd_req.c b/eBones/krb/rd_req.c
deleted file mode 100644
index 60ee948..0000000
--- a/eBones/krb/rd_req.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: der: rd_req.c,v 4.16 89/03/22 14:52:06 jtkohl Exp $
- * $Id: rd_req.c,v 1.3 1995/07/18 16:39:33 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: rd_req.c,v 1.3 1995/07/18 16:39:33 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <des.h>
-#include <krb.h>
-#include <prot.h>
-#include <sys/time.h>
-#include <strings.h>
-
-extern int krb_ap_req_debug;
-
-static struct timeval t_local = { 0, 0 };
-
-/*
- * Keep the following information around for subsequent calls
- * to this routine by the same server using the same key.
- */
-
-static Key_schedule serv_key; /* Key sched to decrypt ticket */
-static C_Block ky; /* Initialization vector */
-static int st_kvno; /* version number for this key */
-static char st_rlm[REALM_SZ]; /* server's realm */
-static char st_nam[ANAME_SZ]; /* service name */
-static char st_inst[INST_SZ]; /* server's instance */
-
-/*
- * This file contains two functions. krb_set_key() takes a DES
- * key or password string and returns a DES key (either the original
- * key, or the password converted into a DES key) and a key schedule
- * for it.
- *
- * krb_rd_req() reads an authentication request and returns information
- * about the identity of the requestor, or an indication that the
- * identity information was not authentic.
- */
-
-/*
- * krb_set_key() takes as its first argument either a DES key or a
- * password string. The "cvt" argument indicates how the first
- * argument "key" is to be interpreted: if "cvt" is null, "key" is
- * taken to be a DES key; if "cvt" is non-null, "key" is taken to
- * be a password string, and is converted into a DES key using
- * string_to_key(). In either case, the resulting key is returned
- * in the external static variable "ky". A key schedule is
- * generated for "ky" and returned in the external static variable
- * "serv_key".
- *
- * This routine returns the return value of des_key_sched.
- *
- * krb_set_key() needs to be in the same .o file as krb_rd_req() so that
- * the key set by krb_set_key() is available in private storage for
- * krb_rd_req().
- */
-
-int
-krb_set_key(key,cvt)
- char *key;
- int cvt;
-{
-#ifdef NOENCRYPTION
- bzero(ky, sizeof(ky));
- return KSUCCESS;
-#else
- if (cvt)
- string_to_key(key,(C_Block *)ky);
- else
- bcopy(key,(char *)ky,8);
- return(des_key_sched((C_Block *)ky,serv_key));
-#endif
-}
-
-
-/*
- * krb_rd_req() takes an AUTH_MSG_APPL_REQUEST or
- * AUTH_MSG_APPL_REQUEST_MUTUAL message created by krb_mk_req(),
- * checks its integrity and returns a judgement as to the requestor's
- * identity.
- *
- * The "authent" argument is a pointer to the received message.
- * The "service" and "instance" arguments name the receiving server,
- * and are used to get the service's ticket to decrypt the ticket
- * in the message, and to compare against the server name inside the
- * ticket. "from_addr" is the network address of the host from which
- * the message was received; this is checked against the network
- * address in the ticket. If "from_addr" is zero, the check is not
- * performed. "ad" is an AUTH_DAT structure which is
- * filled in with information about the sender's identity according
- * to the authenticator and ticket sent in the message. Finally,
- * "fn" contains the name of the file containing the server's key.
- * (If "fn" is NULL, the server's key is assumed to have been set
- * by krb_set_key(). If "fn" is the null string ("") the default
- * file KEYFILE, defined in "krb.h", is used.)
- *
- * krb_rd_req() returns RD_AP_OK if the authentication information
- * was genuine, or one of the following error codes (defined in
- * "krb.h"):
- *
- * RD_AP_VERSION - wrong protocol version number
- * RD_AP_MSG_TYPE - wrong message type
- * RD_AP_UNDEC - couldn't decipher the message
- * RD_AP_INCON - inconsistencies found
- * RD_AP_BADD - wrong network address
- * RD_AP_TIME - client time (in authenticator)
- * too far off server time
- * RD_AP_NYV - Kerberos time (in ticket) too
- * far off server time
- * RD_AP_EXP - ticket expired
- *
- * For the message format, see krb_mk_req().
- *
- * Mutual authentication is not implemented.
- */
-
-int
-krb_rd_req(authent,service,instance,from_addr,ad,fn)
- register KTEXT authent; /* The received message */
- char *service; /* Service name */
- char *instance; /* Service instance */
- long from_addr; /* Net address of originating host */
- AUTH_DAT *ad; /* Structure to be filled in */
- char *fn; /* Filename to get keys from */
-{
- static KTEXT_ST ticket; /* Temp storage for ticket */
- static KTEXT tkt = &ticket;
- static KTEXT_ST req_id_st; /* Temp storage for authenticator */
- register KTEXT req_id = &req_id_st;
-
- char realm[REALM_SZ]; /* Realm of issuing kerberos */
- static Key_schedule seskey_sched; /* Key sched for session key */
- unsigned char skey[KKEY_SZ]; /* Session key from ticket */
- char sname[SNAME_SZ]; /* Service name from ticket */
- char iname[INST_SZ]; /* Instance name from ticket */
- char r_aname[ANAME_SZ]; /* Client name from authenticator */
- char r_inst[INST_SZ]; /* Client instance from authenticator */
- char r_realm[REALM_SZ]; /* Client realm from authenticator */
- unsigned int r_time_ms; /* Fine time from authenticator */
- unsigned long r_time_sec; /* Coarse time from authenticator */
- register char *ptr; /* For stepping through */
- unsigned long delta_t; /* Time in authenticator - local time */
- long tkt_age; /* Age of ticket */
- static int swap_bytes; /* Need to swap bytes? */
- static int mutual; /* Mutual authentication requested? */
- static unsigned char s_kvno;/* Version number of the server's key
- * Kerberos used to encrypt ticket */
- int status;
-
- if (authent->length <= 0)
- return(RD_AP_MODIFIED);
-
- ptr = (char *) authent->dat;
-
- /* get msg version, type and byte order, and server key version */
-
- /* check version */
- if (KRB_PROT_VERSION != (unsigned int) *ptr++)
- return(RD_AP_VERSION);
-
- /* byte order */
- swap_bytes = 0;
- if ((*ptr & 1) != HOST_BYTE_ORDER)
- swap_bytes++;
-
- /* check msg type */
- mutual = 0;
- switch (*ptr++ & ~1) {
- case AUTH_MSG_APPL_REQUEST:
- break;
- case AUTH_MSG_APPL_REQUEST_MUTUAL:
- mutual++;
- break;
- default:
- return(RD_AP_MSG_TYPE);
- }
-
-#ifdef lint
- /* XXX mutual is set but not used; why??? */
- /* this is a crock to get lint to shut up */
- if (mutual)
- mutual = 0;
-#endif /* lint */
- s_kvno = *ptr++; /* get server key version */
- (void) strcpy(realm,ptr); /* And the realm of the issuing KDC */
- ptr += strlen(ptr) + 1; /* skip the realm "hint" */
-
- /*
- * If "fn" is NULL, key info should already be set; don't
- * bother with ticket file. Otherwise, check to see if we
- * already have key info for the given server and key version
- * (saved in the static st_* variables). If not, go get it
- * from the ticket file. If "fn" is the null string, use the
- * default ticket file.
- */
- if (fn && (strcmp(st_nam,service) || strcmp(st_inst,instance) ||
- strcmp(st_rlm,realm) || (st_kvno != s_kvno))) {
- if (*fn == 0) fn = KEYFILE;
- st_kvno = s_kvno;
-#ifndef NOENCRYPTION
- if (read_service_key(service,instance,realm,s_kvno,fn,(char *)skey))
- return(RD_AP_UNDEC);
- if ((status=krb_set_key((char *)skey,0))) return(status);
-#endif
- (void) strcpy(st_rlm,realm);
- (void) strcpy(st_nam,service);
- (void) strcpy(st_inst,instance);
- }
-
- /* Get ticket from authenticator */
- tkt->length = (int) *ptr++;
- if ((tkt->length + (ptr+1 - (char *) authent->dat)) > authent->length)
- return(RD_AP_MODIFIED);
- bcopy(ptr+1,(char *)(tkt->dat),tkt->length);
-
- if (krb_ap_req_debug)
- log("ticket->length: %d",tkt->length);
-
-#ifndef NOENCRYPTION
- /* Decrypt and take apart ticket */
-#endif
-
- if (decomp_ticket(tkt,&ad->k_flags,ad->pname,ad->pinst,ad->prealm,
- &(ad->address),ad->session, &(ad->life),
- &(ad->time_sec),sname,iname,ky,serv_key))
- return(RD_AP_UNDEC);
-
- if (krb_ap_req_debug) {
- log("Ticket Contents.");
- log(" Aname: %s.%s",ad->pname,
- ((int)*(ad->prealm) ? ad->prealm : "Athena"));
- log(" Service: %s%s%s",sname,((int)*iname ? "." : ""),iname);
- }
-
- /* Extract the authenticator */
- req_id->length = (int) *(ptr++);
- if ((req_id->length + (ptr + tkt->length - (char *) authent->dat)) >
- authent->length)
- return(RD_AP_MODIFIED);
- bcopy(ptr + tkt->length, (char *)(req_id->dat),req_id->length);
-
-#ifndef NOENCRYPTION
- key_sched((C_Block *)ad->session,seskey_sched);
- pcbc_encrypt((C_Block *)req_id->dat,(C_Block *)req_id->dat,
- (long)req_id->length,seskey_sched,(C_Block *)ad->session,DES_DECRYPT);
-#endif /* NOENCRYPTION */
-
-#define check_ptr() if ((ptr - (char *) req_id->dat) > req_id->length) return(RD_AP_MODIFIED);
-
- ptr = (char *) req_id->dat;
- (void) strcpy(r_aname,ptr); /* Authentication name */
- ptr += strlen(r_aname)+1;
- check_ptr();
- (void) strcpy(r_inst,ptr); /* Authentication instance */
- ptr += strlen(r_inst)+1;
- check_ptr();
- (void) strcpy(r_realm,ptr); /* Authentication name */
- ptr += strlen(r_realm)+1;
- check_ptr();
- bcopy(ptr,(char *)&ad->checksum,4); /* Checksum */
- ptr += 4;
- check_ptr();
- if (swap_bytes) swap_u_long(ad->checksum);
- r_time_ms = *(ptr++); /* Time (fine) */
-#ifdef lint
- /* XXX r_time_ms is set but not used. why??? */
- /* this is a crock to get lint to shut up */
- if (r_time_ms)
- r_time_ms = 0;
-#endif /* lint */
- check_ptr();
- /* assume sizeof(r_time_sec) == 4 ?? */
- bcopy(ptr,(char *)&r_time_sec,4); /* Time (coarse) */
- if (swap_bytes) swap_u_long(r_time_sec);
-
- /* Check for authenticity of the request */
- if (krb_ap_req_debug)
- log("Pname: %s %s",ad->pname,r_aname);
- if (strcmp(ad->pname,r_aname) != 0)
- return(RD_AP_INCON);
- if (strcmp(ad->pinst,r_inst) != 0)
- return(RD_AP_INCON);
- if (krb_ap_req_debug)
- log("Realm: %s %s",ad->prealm,r_realm);
- if ((strcmp(ad->prealm,r_realm) != 0))
- return(RD_AP_INCON);
-
- if (krb_ap_req_debug)
- log("Address: %d %d",ad->address,from_addr);
- if (from_addr && (ad->address != from_addr))
- return(RD_AP_BADD);
-
- (void) gettimeofday(&t_local,(struct timezone *) 0);
- delta_t = abs((int)(t_local.tv_sec - r_time_sec));
- if (delta_t > CLOCK_SKEW) {
- if (krb_ap_req_debug)
- log("Time out of range: %d - %d = %d",
- t_local.tv_sec,r_time_sec,delta_t);
- return(RD_AP_TIME);
- }
-
- /* Now check for expiration of ticket */
-
- tkt_age = t_local.tv_sec - ad->time_sec;
- if (krb_ap_req_debug)
- log("Time: %d Issue Date: %d Diff: %d Life %x",
- t_local.tv_sec,ad->time_sec,tkt_age,ad->life);
-
- if (t_local.tv_sec < ad->time_sec) {
- if ((ad->time_sec - t_local.tv_sec) > CLOCK_SKEW)
- return(RD_AP_NYV);
- }
- else if ((t_local.tv_sec - ad->time_sec) > 5 * 60 * ad->life)
- return(RD_AP_EXP);
-
- /* All seems OK */
- ad->reply.length = 0;
-
- return(RD_AP_OK);
-}
diff --git a/eBones/krb/rd_safe.c b/eBones/krb/rd_safe.c
deleted file mode 100644
index 4d3e8d6..0000000
--- a/eBones/krb/rd_safe.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * This routine dissects a a Kerberos 'safe msg', checking its
- * integrity, and returning a pointer to the application data
- * contained and its length.
- *
- * Returns 0 (RD_AP_OK) for success or an error code (RD_AP_...)
- *
- * Steve Miller Project Athena MIT/DEC
- *
- * from: rd_safe.c,v 4.12 89/01/23 15:16:16 steiner Exp $
- * $Id: rd_safe.c,v 1.3 1995/07/18 16:39:34 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: rd_safe.c,v 1.3 1995/07/18 16:39:34 mark Exp $";
-#endif /* lint */
-#endif
-
-/* system include files */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/time.h>
-
-/* application include files */
-#include <des.h>
-#include <krb.h>
-#include <prot.h>
-#include "lsb_addr_comp.h"
-
-extern char *errmsg();
-extern int errno;
-extern int krb_debug;
-
-/* static storage */
-
-static C_Block calc_cksum[2];
-static C_Block big_cksum[2];
-static int swap_bytes;
-static struct timeval local_time;
-static u_long delta_t;
-
-/*
- * krb_rd_safe() checks the integrity of an AUTH_MSG_SAFE message.
- * Given the message received, "in", the length of that message,
- * "in_length", the "key" to compute the checksum with, and the
- * network addresses of the "sender" and "receiver" of the message,
- * krb_rd_safe() returns RD_AP_OK if message is okay, otherwise
- * some error code.
- *
- * The message data retrieved from "in" is returned in the structure
- * "m_data". The pointer to the application data (m_data->app_data)
- * refers back to the appropriate place in "in".
- *
- * See the file "mk_safe.c" for the format of the AUTH_MSG_SAFE
- * message. The structure containing the extracted message
- * information, MSG_DAT, is defined in "krb.h".
- */
-
-long krb_rd_safe(in,in_length,key,sender,receiver,m_data)
- u_char *in; /* pointer to the msg received */
- u_long in_length; /* length of "in" msg */
- C_Block *key; /* encryption key for seed and ivec */
- struct sockaddr_in *sender; /* sender's address */
- struct sockaddr_in *receiver; /* receiver's address -- me */
- MSG_DAT *m_data; /* where to put message information */
-{
- register u_char *p,*q;
- static u_long src_addr; /* Can't send structs since no
- * guarantees on size */
- /* Be very conservative */
- if (sizeof(u_long) != sizeof(struct in_addr)) {
- fprintf(stderr,"\n\
-krb_rd_safe protocol err sizeof(u_long) != sizeof(struct in_addr)");
- exit(-1);
- }
-
- if (gettimeofday(&local_time,(struct timezone *)0))
- return -1;
-
- p = in; /* beginning of message */
- swap_bytes = 0;
-
- if (*p++ != KRB_PROT_VERSION) return RD_AP_VERSION;
- if (((*p) & ~1) != AUTH_MSG_SAFE) return RD_AP_MSG_TYPE;
- if ((*p++ & 1) != HOST_BYTE_ORDER) swap_bytes++;
-
- q = p; /* mark start of cksum stuff */
-
- /* safely get length */
- bcopy((char *)p,(char *)&(m_data->app_length),
- sizeof(m_data->app_length));
- if (swap_bytes) swap_u_long(m_data->app_length);
- p += sizeof(m_data->app_length); /* skip over */
-
- if (m_data->app_length + sizeof(in_length)
- + sizeof(m_data->time_sec) + sizeof(m_data->time_5ms)
- + sizeof(big_cksum) + sizeof(src_addr)
- + VERSION_SZ + MSG_TYPE_SZ > in_length)
- return(RD_AP_MODIFIED);
-
- m_data->app_data = p; /* we're now at the application data */
-
- /* skip app data */
- p += m_data->app_length;
-
- /* safely get time_5ms */
- bcopy((char *)p, (char *)&(m_data->time_5ms),
- sizeof(m_data->time_5ms));
-
- /* don't need to swap-- one byte for now */
- p += sizeof(m_data->time_5ms);
-
- /* safely get src address */
- bcopy((char *)p,(char *)&src_addr,sizeof(src_addr));
-
- /* don't swap, net order always */
- p += sizeof(src_addr);
-
- if (src_addr != (u_long) sender->sin_addr.s_addr)
- return RD_AP_MODIFIED;
-
- /* safely get time_sec */
- bcopy((char *)p, (char *)&(m_data->time_sec),
- sizeof(m_data->time_sec));
- if (swap_bytes)
- swap_u_long(m_data->time_sec);
- p += sizeof(m_data->time_sec);
-
- /* check direction bit is the sign bit */
- /* For compatibility with broken old code, compares are done in VAX
- byte order (LSBFIRST) */
- if (lsb_net_ulong_less(sender->sin_addr.s_addr,
- receiver->sin_addr.s_addr)==-1)
- /* src < recv */
- m_data->time_sec = - m_data->time_sec;
- else if (lsb_net_ulong_less(sender->sin_addr.s_addr,
- receiver->sin_addr.s_addr)==0)
- if (lsb_net_ushort_less(sender->sin_port,receiver->sin_port)==-1)
- /* src < recv */
- m_data->time_sec = - m_data->time_sec;
-
- /*
- * All that for one tiny bit! Heaven help those that talk to
- * themselves.
- */
-
- /* check the time integrity of the msg */
- delta_t = abs((int)((long) local_time.tv_sec - m_data->time_sec));
- if (delta_t > CLOCK_SKEW) return RD_AP_TIME;
-
- /*
- * caller must check timestamps for proper order and replays, since
- * server might have multiple clients each with its own timestamps
- * and we don't assume tightly synchronized clocks.
- */
-
- bcopy((char *)p,(char *)big_cksum,sizeof(big_cksum));
- if (swap_bytes) swap_u_16(big_cksum);
-
-#ifdef NOENCRYPTION
- bzero(calc_cksum, sizeof(calc_cksum));
-#else
- quad_cksum((C_Block *)q,calc_cksum,p-q,2,key);
-#endif
-
- if (krb_debug)
- printf("\ncalc_cksum = %lu, received cksum = %lu",
- (long) calc_cksum[0], (long) big_cksum[0]);
- if (bcmp((char *)big_cksum,(char *)calc_cksum,sizeof(big_cksum)))
- return(RD_AP_MODIFIED);
-
- return(RD_AP_OK); /* OK == 0 */
-}
diff --git a/eBones/krb/read_service_key.c b/eBones/krb/read_service_key.c
deleted file mode 100644
index 6064292..0000000
--- a/eBones/krb/read_service_key.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: _service_key.c,v 4.10 90/03/10 19:06:56 jon Exp $
- * $Id: read_service_key.c,v 1.3 1995/07/18 16:39:36 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: read_service_key.c,v 1.3 1995/07/18 16:39:36 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <krb.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <strings.h>
-
-/*
- * The private keys for servers on a given host are stored in a
- * "srvtab" file (typically "/etc/srvtab"). This routine extracts
- * a given server's key from the file.
- *
- * read_service_key() takes the server's name ("service"), "instance",
- * and "realm" and a key version number "kvno", and looks in the given
- * "file" for the corresponding entry, and if found, returns the entry's
- * key field in "key".
- *
- * If "instance" contains the string "*", then it will match
- * any instance, and the chosen instance will be copied to that
- * string. For this reason it is important that the there is enough
- * space beyond the "*" to receive the entry.
- *
- * If "kvno" is 0, it is treated as a wild card and the first
- * matching entry regardless of the "vno" field is returned.
- *
- * This routine returns KSUCCESS on success, otherwise KFAILURE.
- *
- * The format of each "srvtab" entry is as follows:
- *
- * Size Variable Field in file
- * ---- -------- -------------
- * string serv server name
- * string inst server instance
- * string realm server realm
- * 1 byte vno server key version #
- * 8 bytes key server's key
- * ... ... ...
- */
-
-
-/*ARGSUSED */
-int
-read_service_key(service,instance,realm,kvno,file,key)
- char *service; /* Service Name */
- char *instance; /* Instance name or "*" */
- char *realm; /* Realm */
- int kvno; /* Key version number */
- char *file; /* Filename */
- char *key; /* Pointer to key to be filled in */
-{
- char serv[SNAME_SZ];
- char inst[INST_SZ];
- char rlm[REALM_SZ];
- unsigned char vno; /* Key version number */
- int wcard;
-
- int stab, open();
-
- if ((stab = open(file, 0, 0)) < NULL)
- return(KFAILURE);
-
- wcard = (instance[0] == '*') && (instance[1] == '\0');
-
- while(getst(stab,serv,SNAME_SZ) > 0) { /* Read sname */
- (void) getst(stab,inst,INST_SZ); /* Instance */
- (void) getst(stab,rlm,REALM_SZ); /* Realm */
- /* Vers number */
- if (read(stab,(char *)&vno,1) != 1) {
- close(stab);
- return(KFAILURE);
- }
- /* Key */
- if (read(stab,key,8) != 8) {
- close(stab);
- return(KFAILURE);
- }
- /* Is this the right service */
- if (strcmp(serv,service))
- continue;
- /* How about instance */
- if (!wcard && strcmp(inst,instance))
- continue;
- if (wcard)
- (void) strncpy(instance,inst,INST_SZ);
- /* Is this the right realm */
-#ifdef ATHENA_COMPAT
- /* XXX For backward compatibility: if keyfile says "Athena"
- and caller wants "ATHENA.MIT.EDU", call it a match */
- if (strcmp(rlm,realm) &&
- (strcmp(rlm,"Athena") ||
- strcmp(realm,"ATHENA.MIT.EDU")))
- continue;
-#else /* ! ATHENA_COMPAT */
- if (strcmp(rlm,realm))
- continue;
-#endif /* ATHENA_COMPAT */
-
- /* How about the key version number */
- if (kvno && kvno != (int) vno)
- continue;
-
- (void) close(stab);
- return(KSUCCESS);
- }
-
- /* Can't find the requested service */
- (void) close(stab);
- return(KFAILURE);
-}
diff --git a/eBones/krb/recvauth.c b/eBones/krb/recvauth.c
deleted file mode 100644
index 45d68ee..0000000
--- a/eBones/krb/recvauth.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: recvauth.c,v 4.4 90/03/10 19:03:08 jon Exp $";
- * $Id: recvauth.c,v 1.3 1995/07/18 16:39:38 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: recvauth.c,v 1.3 1995/07/18 16:39:38 mark Exp $";
-#endif lint
-#endif
-
-#include <krb.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <syslog.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <strings.h>
-
-
-#define KRB_SENDAUTH_VERS "AUTHV0.1" /* MUST be KRB_SENDAUTH_VLEN
- chars */
-
-/*
- * If the protocol changes, you will need to change the version string
- * and make appropriate changes in krb_sendauth.c
- * be sure to support old versions of krb_sendauth!
- */
-
-extern int errno;
-
-/*
- * krb_recvauth() reads (and optionally responds to) a message sent
- * using krb_sendauth(). The "options" argument is a bit-field of
- * selected options (see "sendauth.c" for options description).
- * The only option relevant to krb_recvauth() is KOPT_DO_MUTUAL
- * (mutual authentication requested). The "fd" argument supplies
- * a file descriptor to read from (and write to, if mutual authenti-
- * cation is requested).
- *
- * Part of the received message will be a Kerberos ticket sent by the
- * client; this is read into the "ticket" argument. The "service" and
- * "instance" arguments supply the server's Kerberos name. If the
- * "instance" argument is the string "*", it is treated as a wild card
- * and filled in during the krb_rd_req() call (see read_service_key()).
- *
- * The "faddr" and "laddr" give the sending (client) and receiving
- * (local server) network addresses. ("laddr" may be left NULL unless
- * mutual authentication is requested, in which case it must be set.)
- *
- * The authentication information extracted from the message is returned
- * in "kdata". The "filename" argument indicates the file where the
- * server's key can be found. (It is passed on to krb_rd_req().) If
- * left null, the default "/etc/srvtab" will be used.
- *
- * If mutual authentication is requested, the session key schedule must
- * be computed in order to reply; this schedule is returned in the
- * "schedule" argument. A string containing the application version
- * number from the received message is returned in "version", which
- * should be large enough to hold a KRB_SENDAUTH_VLEN-character string.
- *
- * See krb_sendauth() for the format of the received client message.
- *
- * This routine supports another client format, for backward
- * compatibility, consisting of:
- *
- * Size Variable Field
- * ---- -------- -----
- *
- * string tmp_buf, tkt_len length of ticket, in
- * ascii
- *
- * char ' ' (space char) separator
- *
- * tkt_len ticket->dat the ticket
- *
- * This old-style version does not support mutual authentication.
- *
- * krb_recvauth() first reads the protocol version string from the
- * given file descriptor. If it doesn't match the current protocol
- * version (KRB_SENDAUTH_VERS), the old-style format is assumed. In
- * that case, the string of characters up to the first space is read
- * and interpreted as the ticket length, then the ticket is read.
- *
- * If the first string did match KRB_SENDAUTH_VERS, krb_recvauth()
- * next reads the application protocol version string. Then the
- * ticket length and ticket itself are read.
- *
- * The ticket is decrypted and checked by the call to krb_rd_req().
- * If no mutual authentication is required, the result of the
- * krb_rd_req() call is retured by this routine. If mutual authenti-
- * cation is required, a message in the following format is returned
- * on "fd":
- *
- * Size Variable Field
- * ---- -------- -----
- *
- * 4 bytes tkt_len length of ticket or -1
- * if error occurred
- *
- * priv_len tmp_buf "private" message created
- * by krb_mk_priv() which
- * contains the incremented
- * checksum sent by the client
- * encrypted in the session
- * key. (This field is not
- * present in case of error.)
- *
- * If all goes well, KSUCCESS is returned; otherwise KFAILURE or some
- * other error code is returned.
- */
-
-#ifndef max
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-#endif /* max */
-
-int
-krb_recvauth(options, fd, ticket, service, instance, faddr, laddr, kdata,
- filename, schedule, version)
-long options; /* bit-pattern of options */
-int fd; /* file descr. to read from */
-KTEXT ticket; /* storage for client's ticket */
-char *service; /* service expected */
-char *instance; /* inst expected (may be filled in) */
-struct sockaddr_in *faddr; /* address of foreign host on fd */
-struct sockaddr_in *laddr; /* local address */
-AUTH_DAT *kdata; /* kerberos data (returned) */
-char *filename; /* name of file with service keys */
-Key_schedule schedule; /* key schedule (return) */
-char *version; /* version string (filled in) */
-{
-
- int i, cc, old_vers = 0;
- char krb_vers[KRB_SENDAUTH_VLEN + 1]; /* + 1 for the null terminator */
- char *cp;
- int rem;
- long tkt_len, priv_len;
- u_long cksum;
- u_char tmp_buf[MAX_KTXT_LEN+max(KRB_SENDAUTH_VLEN+1,21)];
-
- /* read the protocol version number */
- if (krb_net_read(fd, krb_vers, KRB_SENDAUTH_VLEN) !=
- KRB_SENDAUTH_VLEN)
- return(errno);
- krb_vers[KRB_SENDAUTH_VLEN] = '\0';
-
- /* check version string */
- if (strcmp(krb_vers,KRB_SENDAUTH_VERS)) {
- /* Assume the old version of sendkerberosdata: send ascii
- length, ' ', and ticket. */
- if (options & KOPT_DO_MUTUAL)
- return(KFAILURE); /* XXX can't do old style with mutual auth */
- old_vers = 1;
-
- /* copy what we have read into tmp_buf */
- (void) bcopy(krb_vers, (char *) tmp_buf, KRB_SENDAUTH_VLEN);
-
- /* search for space, and make it a null */
- for (i = 0; i < KRB_SENDAUTH_VLEN; i++)
- if (tmp_buf[i]== ' ') {
- tmp_buf[i] = '\0';
- /* point cp to the beginning of the real ticket */
- cp = (char *) &tmp_buf[i+1];
- break;
- }
-
- if (i == KRB_SENDAUTH_VLEN)
- /* didn't find the space, keep reading to find it */
- for (; i<20; i++) {
- if (read(fd, (char *)&tmp_buf[i], 1) != 1) {
- return(KFAILURE);
- }
- if (tmp_buf[i] == ' ') {
- tmp_buf[i] = '\0';
- /* point cp to the beginning of the real ticket */
- cp = (char *) &tmp_buf[i+1];
- break;
- }
- }
-
- tkt_len = (long) atoi((char *) tmp_buf);
-
- /* sanity check the length */
- if ((i==20)||(tkt_len<=0)||(tkt_len>MAX_KTXT_LEN))
- return(KFAILURE);
-
- if (i < KRB_SENDAUTH_VLEN) {
- /* since we already got the space, and part of the ticket,
- we read fewer bytes to get the rest of the ticket */
- if (krb_net_read(fd, (char *)(tmp_buf+KRB_SENDAUTH_VLEN),
- (int) (tkt_len - KRB_SENDAUTH_VLEN + 1 + i))
- != (int)(tkt_len - KRB_SENDAUTH_VLEN + 1 + i))
- return(errno);
- } else {
- if (krb_net_read(fd, (char *)(tmp_buf+i), (int)tkt_len) !=
- (int) tkt_len)
- return(errno);
- }
- ticket->length = tkt_len;
- /* copy the ticket into the struct */
- (void) bcopy(cp, (char *) ticket->dat, ticket->length);
-
- } else {
- /* read the application version string */
- if (krb_net_read(fd, version, KRB_SENDAUTH_VLEN) !=
- KRB_SENDAUTH_VLEN)
- return(errno);
- version[KRB_SENDAUTH_VLEN] = '\0';
-
- /* get the length of the ticket */
- if (krb_net_read(fd, (char *)&tkt_len, sizeof(tkt_len)) !=
- sizeof(tkt_len))
- return(errno);
-
- /* sanity check */
- ticket->length = ntohl((unsigned long)tkt_len);
- if ((ticket->length <= 0) || (ticket->length > MAX_KTXT_LEN)) {
- if (options & KOPT_DO_MUTUAL) {
- rem = KFAILURE;
- goto mutual_fail;
- } else
- return(KFAILURE); /* XXX there may still be junk on the fd? */
- }
-
- /* read the ticket */
- if (krb_net_read(fd, (char *) ticket->dat, ticket->length)
- != ticket->length)
- return(errno);
- }
- /*
- * now have the ticket. decrypt it to get the authenticated
- * data.
- */
- rem = krb_rd_req(ticket,service,instance,faddr->sin_addr.s_addr,
- kdata,filename);
-
- if (old_vers) return(rem); /* XXX can't do mutual with old client */
-
- /* if we are doing mutual auth, compose a response */
- if (options & KOPT_DO_MUTUAL) {
- if (rem != KSUCCESS)
- /* the krb_rd_req failed */
- goto mutual_fail;
-
- /* add one to the (formerly) sealed checksum, and re-seal it
- for return to the client */
- cksum = kdata->checksum + 1;
- cksum = htonl(cksum);
-#ifndef NOENCRYPTION
- key_sched((C_Block *)kdata->session,schedule);
-#endif
- priv_len = krb_mk_priv((unsigned char *)&cksum,
- tmp_buf,
- (unsigned long) sizeof(cksum),
- schedule,
- kdata->session,
- laddr,
- faddr);
- if (priv_len < 0) {
- /* re-sealing failed; notify the client */
- rem = KFAILURE; /* XXX */
-mutual_fail:
- priv_len = -1;
- tkt_len = htonl((unsigned long) priv_len);
- /* a length of -1 is interpreted as an authentication
- failure by the client */
- if ((cc = krb_net_write(fd, (char *)&tkt_len, sizeof(tkt_len)))
- != sizeof(tkt_len))
- return(cc);
- return(rem);
- } else {
- /* re-sealing succeeded, send the private message */
- tkt_len = htonl((unsigned long)priv_len);
- if ((cc = krb_net_write(fd, (char *)&tkt_len, sizeof(tkt_len)))
- != sizeof(tkt_len))
- return(cc);
- if ((cc = krb_net_write(fd, (char *)tmp_buf, (int) priv_len))
- != (int) priv_len)
- return(cc);
- }
- }
- return(rem);
-}
diff --git a/eBones/krb/save_credentials.c b/eBones/krb/save_credentials.c
deleted file mode 100644
index 268bb77..0000000
--- a/eBones/krb/save_credentials.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: save_credentials.c,v 4.9 89/05/31 17:45:43 jtkohl Exp $
- * $Id: save_credentials.c,v 1.3 1995/07/18 16:39:40 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: save_credentials.c,v 1.3 1995/07/18 16:39:40 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <stdio.h>
-#include <krb.h>
-
-/*
- * This routine takes a ticket and associated info and calls
- * tf_save_cred() to store them in the ticket cache. The peer
- * routine for extracting a ticket and associated info from the
- * ticket cache is krb_get_cred(). When changes are made to
- * this routine, the corresponding changes should be made
- * in krb_get_cred() as well.
- *
- * Returns KSUCCESS if all goes well, otherwise an error returned
- * by the tf_init() or tf_save_cred() routines.
- */
-
-int
-save_credentials(service, instance, realm, session, lifetime, kvno,
- ticket, issue_date)
- char *service; /* Service name */
- char *instance; /* Instance */
- char *realm; /* Auth domain */
- C_Block session; /* Session key */
- int lifetime; /* Lifetime */
- int kvno; /* Key version number */
- KTEXT ticket; /* The ticket itself */
- long issue_date; /* The issue time */
-{
- int tf_status; /* return values of the tf_util calls */
-
- /* Open and lock the ticket file for writing */
- if ((tf_status = tf_init(TKT_FILE, W_TKT_FIL)) != KSUCCESS)
- return(tf_status);
-
- /* Save credentials by appending to the ticket file */
- tf_status = tf_save_cred(service, instance, realm, session,
- lifetime, kvno, ticket, issue_date);
- (void) tf_close();
- return (tf_status);
-}
diff --git a/eBones/krb/send_to_kdc.c b/eBones/krb/send_to_kdc.c
deleted file mode 100644
index a2a329a..0000000
--- a/eBones/krb/send_to_kdc.c
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: send_to_kdc.c,v 4.20 90/01/02 13:40:37 jtkohl Exp $
- * $Id: send_to_kdc.c,v 1.3 1995/07/18 16:39:42 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid_send_to_kdc_c[] =
-"$Id: send_to_kdc.c,v 1.1 1994/03/21 17:35:39 piero Exp ";
-#endif /* lint */
-#endif
-
-#include <krb.h>
-#include <prot.h>
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#ifdef lint
-#include <sys/uio.h> /* struct iovec to make lint happy */
-#endif /* lint */
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <strings.h>
-
-#define S_AD_SZ sizeof(struct sockaddr_in)
-
-extern int errno;
-extern int krb_debug;
-
-extern char *malloc(), *calloc(), *realloc();
-
-int krb_udp_port = 0;
-
-/* CLIENT_KRB_TIMEOUT indicates the time to wait before
- * retrying a server. It's defined in "krb.h".
- */
-static struct timeval timeout = { CLIENT_KRB_TIMEOUT, 0};
-static char *prog = "send_to_kdc";
-static send_recv();
-
-/*
- * This file contains two routines, send_to_kdc() and send_recv().
- * send_recv() is a static routine used by send_to_kdc().
- */
-
-/*
- * send_to_kdc() sends a message to the Kerberos authentication
- * server(s) in the given realm and returns the reply message.
- * The "pkt" argument points to the message to be sent to Kerberos;
- * the "rpkt" argument will be filled in with Kerberos' reply.
- * The "realm" argument indicates the realm of the Kerberos server(s)
- * to transact with. If the realm is null, the local realm is used.
- *
- * If more than one Kerberos server is known for a given realm,
- * different servers will be queried until one of them replies.
- * Several attempts (retries) are made for each server before
- * giving up entirely.
- *
- * If an answer was received from a Kerberos host, KSUCCESS is
- * returned. The following errors can be returned:
- *
- * SKDC_CANT - can't get local realm
- * - can't find "kerberos" in /etc/services database
- * - can't open socket
- * - can't bind socket
- * - all ports in use
- * - couldn't find any Kerberos host
- *
- * SKDC_RETRY - couldn't get an answer from any Kerberos server,
- * after several retries
- */
-
-int
-send_to_kdc(pkt,rpkt,realm)
- KTEXT pkt;
- KTEXT rpkt;
- char *realm;
-{
- int i, f;
- int no_host; /* was a kerberos host found? */
- int retry;
- int n_hosts;
- int retval;
- struct sockaddr_in to;
- struct hostent *host, *hostlist;
- char *cp;
- char krbhst[MAX_HSTNM];
- char lrealm[REALM_SZ];
-
- /*
- * If "realm" is non-null, use that, otherwise get the
- * local realm.
- */
- if (realm)
- (void) strcpy(lrealm, realm);
- else
- if (krb_get_lrealm(lrealm,1)) {
- if (krb_debug)
- fprintf(stderr, "%s: can't get local realm\n", prog);
- return(SKDC_CANT);
- }
- if (krb_debug)
- printf("lrealm is %s\n", lrealm);
- if (krb_udp_port == 0) {
- register struct servent *sp;
- if ((sp = getservbyname("kerberos","udp")) == 0) {
- if (krb_debug)
- fprintf(stderr, "%s: Can't get kerberos/udp service\n",
- prog);
- return(SKDC_CANT);
- }
- krb_udp_port = sp->s_port;
- if (krb_debug)
- printf("krb_udp_port is %d\n", krb_udp_port);
- }
- bzero((char *)&to, S_AD_SZ);
- hostlist = (struct hostent *) malloc(sizeof(struct hostent));
- if (!hostlist)
- return (/*errno */SKDC_CANT);
- if ((f = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
- if (krb_debug)
- fprintf(stderr,"%s: Can't open socket\n", prog);
- return(SKDC_CANT);
- }
- /* from now on, exit through rtn label for cleanup */
-
- no_host = 1;
- /* get an initial allocation */
- n_hosts = 0;
- for (i = 1; krb_get_krbhst(krbhst, lrealm, i) == KSUCCESS; ++i) {
- if (krb_debug) {
- printf("Getting host entry for %s...",krbhst);
- (void) fflush(stdout);
- }
- host = gethostbyname(krbhst);
- if (krb_debug) {
- printf("%s.\n",
- host ? "Got it" : "Didn't get it");
- (void) fflush(stdout);
- }
- if (!host)
- continue;
- no_host = 0; /* found at least one */
- n_hosts++;
- /* preserve host network address to check later
- * (would be better to preserve *all* addresses,
- * take care of that later)
- */
- hostlist = (struct hostent *)
- realloc((char *)hostlist,
- (unsigned)
- sizeof(struct hostent)*(n_hosts+1));
- if (!hostlist)
- return /*errno */SKDC_CANT;
- bcopy((char *)host, (char *)&hostlist[n_hosts-1],
- sizeof(struct hostent));
- host = &hostlist[n_hosts-1];
- cp = malloc((unsigned)host->h_length);
- if (!cp) {
- retval = /*errno */SKDC_CANT;
- goto rtn;
- }
- bcopy((char *)host->h_addr, cp, host->h_length);
-/* At least Sun OS version 3.2 (or worse) and Ultrix version 2.2
- (or worse) only return one name ... */
-#if !(defined(ULTRIX022) || (defined(SunOS) && SunOS < 40))
- host->h_addr_list = (char **)malloc(sizeof(char *));
- if (!host->h_addr_list) {
- retval = /*errno */SKDC_CANT;
- goto rtn;
- }
-#endif /* ULTRIX022 || SunOS */
- host->h_addr = cp;
- bzero((char *)&hostlist[n_hosts],
- sizeof(struct hostent));
- to.sin_family = host->h_addrtype;
- bcopy(host->h_addr, (char *)&to.sin_addr,
- host->h_length);
- to.sin_port = krb_udp_port;
- if (send_recv(pkt, rpkt, f, &to, hostlist)) {
- retval = KSUCCESS;
- goto rtn;
- }
- if (krb_debug) {
- printf("Timeout, error, or wrong descriptor\n");
- (void) fflush(stdout);
- }
- }
- if (no_host) {
- if (krb_debug)
- fprintf(stderr, "%s: can't find any Kerberos host.\n",
- prog);
- retval = SKDC_CANT;
- goto rtn;
- }
- /* retry each host in sequence */
- for (retry = 0; retry < CLIENT_KRB_RETRY; ++retry) {
- for (host = hostlist; host->h_name != (char *)NULL; host++) {
- to.sin_family = host->h_addrtype;
- bcopy(host->h_addr, (char *)&to.sin_addr,
- host->h_length);
- if (send_recv(pkt, rpkt, f, &to, hostlist)) {
- retval = KSUCCESS;
- goto rtn;
- }
- }
- }
- retval = SKDC_RETRY;
-rtn:
- (void) close(f);
- if (hostlist) {
- if(!no_host) {
- register struct hostent *hp;
- for (hp = hostlist; hp->h_name; hp++)
-#if !(defined(ULTRIX022) || (defined(SunOS) && SunOS < 40))
- if (hp->h_addr_list) {
-#endif /* ULTRIX022 || SunOS */
- if (hp->h_addr)
- free(hp->h_addr);
-#if !(defined(ULTRIX022) || (defined(SunOS) && SunOS < 40))
- free((char *)hp->h_addr_list);
- }
-#endif /* ULTRIX022 || SunOS */
- }
- free((char *)hostlist);
- }
- return(retval);
-}
-
-/*
- * try to send out and receive message.
- * return 1 on success, 0 on failure
- */
-
-static int
-send_recv(pkt,rpkt,f,_to,addrs)
- KTEXT pkt;
- KTEXT rpkt;
- int f;
- struct sockaddr_in *_to;
- struct hostent *addrs;
-{
- fd_set readfds;
- register struct hostent *hp;
- struct sockaddr_in from;
- int sin_size;
- int numsent;
-
- if (krb_debug) {
- if (_to->sin_family == AF_INET)
- printf("Sending message to %s...",
- inet_ntoa(_to->sin_addr));
- else
- printf("Sending message...");
- (void) fflush(stdout);
- }
- if ((numsent = sendto(f,(char *)(pkt->dat), pkt->length, 0,
- (struct sockaddr *)_to,
- S_AD_SZ)) != pkt->length) {
- if (krb_debug)
- printf("sent only %d/%d\n",numsent, pkt->length);
- return 0;
- }
- if (krb_debug) {
- printf("Sent\nWaiting for reply...");
- (void) fflush(stdout);
- }
- FD_ZERO(&readfds);
- FD_SET(f, &readfds);
- errno = 0;
- /* select - either recv is ready, or timeout */
- /* see if timeout or error or wrong descriptor */
- if (select(f + 1, &readfds, (fd_set *)0, (fd_set *)0, &timeout) < 1
- || !FD_ISSET(f, &readfds)) {
- if (krb_debug) {
- fprintf(stderr, "select failed: readfds=%x",
- readfds);
- perror("");
- }
- return 0;
- }
- sin_size = sizeof(from);
- if (recvfrom(f, (char *)(rpkt->dat), sizeof(rpkt->dat), 0,
- (struct sockaddr *)&from, &sin_size)
- < 0) {
- if (krb_debug)
- perror("recvfrom");
- return 0;
- }
- if (krb_debug) {
- printf("received packet from %s\n", inet_ntoa(from.sin_addr));
- fflush(stdout);
- }
- for (hp = addrs; hp->h_name != (char *)NULL; hp++) {
- if (!bcmp(hp->h_addr, (char *)&from.sin_addr.s_addr,
- hp->h_length)) {
- if (krb_debug) {
- printf("Received it\n");
- (void) fflush(stdout);
- }
- return 1;
- }
- if (krb_debug)
- fprintf(stderr,
- "packet not from %lx\n",
- (unsigned long)hp->h_addr);
- }
- if (krb_debug)
- fprintf(stderr, "%s: received packet from wrong host! (%lx)\n",
- "send_to_kdc(send_rcv)", from.sin_addr.s_addr);
- return 0;
-}
diff --git a/eBones/krb/sendauth.c b/eBones/krb/sendauth.c
deleted file mode 100644
index a1d79e7..0000000
--- a/eBones/krb/sendauth.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: sendauth.c,v 4.6 90/03/10 23:18:28 jon Exp $
- * $Id: sendauth.c,v 1.3 1995/07/18 16:39:44 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: sendauth.c,v 1.3 1995/07/18 16:39:44 mark Exp $";
-#endif lint
-#endif
-
-#include <krb.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <syslog.h>
-#include <errno.h>
-#include <stdio.h>
-#include <strings.h>
-
-#define KRB_SENDAUTH_VERS "AUTHV0.1" /* MUST be KRB_SENDAUTH_VLEN chars */
-/*
- * If the protocol changes, you will need to change the version string
- * and make appropriate changes in krb_recvauth.c
- */
-
-extern int errno;
-
-extern char *krb_get_phost();
-
-/*
- * This file contains two routines: krb_sendauth() and krb_sendsrv().
- *
- * krb_sendauth() transmits a ticket over a file descriptor for a
- * desired service, instance, and realm, doing mutual authentication
- * with the server if desired.
- *
- * krb_sendsvc() sends a service name to a remote knetd server.
- */
-
-/*
- * The first argument to krb_sendauth() contains a bitfield of
- * options (the options are defined in "krb.h"):
- *
- * KOPT_DONT_CANON Don't canonicalize instance as a hostname.
- * (If this option is not chosen, krb_get_phost()
- * is called to canonicalize it.)
- *
- * KOPT_DONT_MK_REQ Don't request server ticket from Kerberos.
- * A ticket must be supplied in the "ticket"
- * argument.
- * (If this option is not chosen, and there
- * is no ticket for the given server in the
- * ticket cache, one will be fetched using
- * krb_mk_req() and returned in "ticket".)
- *
- * KOPT_DO_MUTUAL Do mutual authentication, requiring that the
- * receiving server return the checksum+1 encrypted
- * in the session key. The mutual authentication
- * is done using krb_mk_priv() on the other side
- * (see "recvauth.c") and krb_rd_priv() on this
- * side.
- *
- * The "fd" argument is a file descriptor to write to the remote
- * server on. The "ticket" argument is used to store the new ticket
- * from the krb_mk_req() call. If the KOPT_DONT_MK_REQ options is
- * chosen, the ticket must be supplied in the "ticket" argument.
- * The "service", "inst", and "realm" arguments identify the ticket.
- * If "realm" is null, the local realm is used.
- *
- * The following arguments are only needed if the KOPT_DO_MUTUAL option
- * is chosen:
- *
- * The "checksum" argument is a number that the server will add 1 to
- * to authenticate itself back to the client; the "msg_data" argument
- * holds the returned mutual-authentication message from the server
- * (i.e., the checksum+1); the "cred" structure is used to hold the
- * session key of the server, extracted from the ticket file, for use
- * in decrypting the mutual authentication message from the server;
- * and "schedule" holds the key schedule for that decryption. The
- * the local and server addresses are given in "laddr" and "faddr".
- *
- * The application protocol version number (of up to KRB_SENDAUTH_VLEN
- * characters) is passed in "version".
- *
- * If all goes well, KSUCCESS is returned, otherwise some error code.
- *
- * The format of the message sent to the server is:
- *
- * Size Variable Field
- * ---- -------- -----
- *
- * KRB_SENDAUTH_VLEN KRB_SENDAUTH_VER sendauth protocol
- * bytes version number
- *
- * KRB_SENDAUTH_VLEN version application protocol
- * bytes version number
- *
- * 4 bytes ticket->length length of ticket
- *
- * ticket->length ticket->dat ticket itself
- */
-
-/*
- * XXX: Note that krb_rd_priv() is coded in such a way that
- * "msg_data->app_data" will be pointing into "priv_buf", which
- * will disappear when krb_sendauth() returns.
- */
-
-int
-krb_sendauth(options, fd, ticket, service, inst, realm, checksum,
- msg_data, cred, schedule, laddr, faddr, version)
-long options; /* bit-pattern of options */
-int fd; /* file descriptor to write onto */
-KTEXT ticket; /* where to put ticket (return); or
- * supplied in case of KOPT_DONT_MK_REQ */
-char *service, *inst, *realm; /* service name, instance, realm */
-u_long checksum; /* checksum to include in request */
-MSG_DAT *msg_data; /* mutual auth MSG_DAT (return) */
-CREDENTIALS *cred; /* credentials (return) */
-Key_schedule schedule; /* key schedule (return) */
-struct sockaddr_in *laddr; /* local address */
-struct sockaddr_in *faddr; /* address of foreign host on fd */
-char *version; /* version string */
-{
- int rem, i, cc;
- char srv_inst[INST_SZ];
- char krb_realm[REALM_SZ];
- char buf[BUFSIZ];
- long tkt_len;
- u_char priv_buf[1024];
- u_long cksum;
-
- rem=KSUCCESS;
-
- /* get current realm if not passed in */
- if (!realm) {
- rem = krb_get_lrealm(krb_realm,1);
- if (rem != KSUCCESS)
- return(rem);
- realm = krb_realm;
- }
-
- /* copy instance into local storage, canonicalizing if desired */
- if (options & KOPT_DONT_CANON)
- (void) strncpy(srv_inst, inst, INST_SZ);
- else
- (void) strncpy(srv_inst, krb_get_phost(inst), INST_SZ);
-
- /* get the ticket if desired */
- if (!(options & KOPT_DONT_MK_REQ)) {
- rem = krb_mk_req(ticket, service, srv_inst, realm, checksum);
- if (rem != KSUCCESS)
- return(rem);
- }
-
-#ifdef ATHENA_COMPAT
- /* this is only for compatibility with old servers */
- if (options & KOPT_DO_OLDSTYLE) {
- (void) sprintf(buf,"%d ",ticket->length);
- (void) write(fd, buf, strlen(buf));
- (void) write(fd, (char *) ticket->dat, ticket->length);
- return(rem);
- }
-#endif ATHENA_COMPAT
- /* if mutual auth, get credentials so we have service session
- keys for decryption below */
- if (options & KOPT_DO_MUTUAL)
- if ((cc = krb_get_cred(service, srv_inst, realm, cred)))
- return(cc);
-
- /* zero the buffer */
- (void) bzero(buf, BUFSIZ);
-
- /* insert version strings */
- (void) strncpy(buf, KRB_SENDAUTH_VERS, KRB_SENDAUTH_VLEN);
- (void) strncpy(buf+KRB_SENDAUTH_VLEN, version, KRB_SENDAUTH_VLEN);
-
- /* increment past vers strings */
- i = 2*KRB_SENDAUTH_VLEN;
-
- /* put ticket length into buffer */
- tkt_len = htonl((unsigned long) ticket->length);
- (void) bcopy((char *) &tkt_len, buf+i, sizeof(tkt_len));
- i += sizeof(tkt_len);
-
- /* put ticket into buffer */
- (void) bcopy((char *) ticket->dat, buf+i, ticket->length);
- i += ticket->length;
-
- /* write the request to the server */
- if ((cc = krb_net_write(fd, buf, i)) != i)
- return(cc);
-
- /* mutual authentication, if desired */
- if (options & KOPT_DO_MUTUAL) {
- /* get the length of the reply */
- if (krb_net_read(fd, (char *) &tkt_len, sizeof(tkt_len)) !=
- sizeof(tkt_len))
- return(errno);
- tkt_len = ntohl((unsigned long)tkt_len);
-
- /* if the length is negative, the server failed to recognize us. */
- if ((tkt_len < 0) || (tkt_len > sizeof(priv_buf)))
- return(KFAILURE); /* XXX */
- /* read the reply... */
- if (krb_net_read(fd, (char *)priv_buf, (int) tkt_len) != (int) tkt_len)
- return(errno);
-
- /* ...and decrypt it */
-#ifndef NOENCRYPTION
- key_sched((C_Block *)cred->session,schedule);
-#endif
- if ((cc = krb_rd_priv(priv_buf,(unsigned long) tkt_len, schedule,
- cred->session, faddr, laddr, msg_data)))
- return(cc);
-
- /* fetch the (modified) checksum */
- (void) bcopy((char *)msg_data->app_data, (char *)&cksum,
- sizeof(cksum));
- cksum = ntohl(cksum);
-
- /* if it doesn't match, fail */
- if (cksum != checksum + 1)
- return(KFAILURE); /* XXX */
- }
- return(KSUCCESS);
-}
-
-#ifdef ATHENA_COMPAT
-/*
- * krb_sendsvc
- */
-
-int
-krb_sendsvc(fd, service)
-int fd;
-char *service;
-{
- /* write the service name length and then the service name to
- the fd */
- long serv_length;
- int cc;
-
- serv_length = htonl((unsigned long)strlen(service));
- if ((cc = krb_net_write(fd, (char *) &serv_length,
- sizeof(serv_length)))
- != sizeof(serv_length))
- return(cc);
- if ((cc = krb_net_write(fd, service, strlen(service)))
- != strlen(service))
- return(cc);
- return(KSUCCESS);
-}
-#endif ATHENA_COMPAT
diff --git a/eBones/krb/stime.c b/eBones/krb/stime.c
deleted file mode 100644
index 2da2463..0000000
--- a/eBones/krb/stime.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: stime.c,v 4.5 88/11/15 16:58:05 jtkohl Exp $
- * $Id: stime.c,v 1.3 1995/07/18 16:39:46 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: stime.c,v 1.3 1995/07/18 16:39:46 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <sys/time.h>
-#include <stdio.h> /* for sprintf() */
-
-/*
- * Given a pointer to a long containing the number of seconds
- * since the beginning of time (midnight 1 Jan 1970 GMT), return
- * a string containing the local time in the form:
- *
- * "25-Jan-88 10:17:56"
- */
-
-char *
-stime(t)
- long *t;
-{
- static char st_data[40];
- static char *st = st_data;
- struct tm *tm;
- char *month_sname();
-
- tm = localtime(t);
- (void) sprintf(st,"%2d-%s-%02d %02d:%02d:%02d",tm->tm_mday,
- month_sname(tm->tm_mon + 1),tm->tm_year,
- tm->tm_hour, tm->tm_min, tm->tm_sec);
- return st;
-}
diff --git a/eBones/krb/tf_shm.c b/eBones/krb/tf_shm.c
deleted file mode 100644
index 31894cb..0000000
--- a/eBones/krb/tf_shm.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * Shared memory segment functions for session keys. Derived from code
- * contributed by Dan Kolkowitz (kolk@jessica.stanford.edu).
- *
- * from: tf_shm.c,v 4.2 89/10/25 23:26:46 qjb Exp $
- * $Id: tf_shm.c,v 1.3 1995/07/18 16:39:48 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: tf_shm.c,v 1.3 1995/07/18 16:39:48 mark Exp $";
-#endif lint
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <krb.h>
-#include <des.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#define MAX_BUFF sizeof(des_cblock)*1000 /* room for 1k keys */
-
-extern int errno;
-extern int krb_debug;
-
-/*
- * krb_create_shmtkt:
- *
- * create a shared memory segment for session keys, leaving its id
- * in the specified filename.
- */
-
-int
-krb_shm_create(file_name)
-char *file_name;
-{
- int retval;
- int shmid;
- struct shmid_ds shm_buf;
- FILE *sfile;
- uid_t me, metoo, getuid(), geteuid();
-
- (void) krb_shm_dest(file_name); /* nuke it if it exists...
- this cleans up to make sure we
- don't slowly lose memory. */
-
- shmid = shmget((long)IPC_PRIVATE,MAX_BUFF, IPC_CREAT);
- if (shmid == -1) {
- if (krb_debug)
- perror("krb_shm_create shmget");
- return(KFAILURE); /* XXX */
- }
- me = getuid();
- metoo = geteuid();
- /*
- * now set up the buffer so that we can modify it
- */
- shm_buf.shm_perm.uid = me;
- shm_buf.shm_perm.gid = getgid();
- shm_buf.shm_perm.mode = 0600;
- if (shmctl(shmid,IPC_SET,&shm_buf) < 0) { /*can now map it */
- if (krb_debug)
- perror("krb_shm_create shmctl");
- (void) shmctl(shmid, IPC_RMID, 0);
- return(KFAILURE); /* XXX */
- }
- (void) shmctl(shmid, SHM_LOCK, 0); /* attempt to lock-in-core */
- /* arrange so the file is owned by the ruid
- (swap real & effective uid if necessary). */
- if (me != metoo) {
- if (setreuid(metoo, me) < 0) {
- /* can't switch??? barf! */
- if (krb_debug)
- perror("krb_shm_create: setreuid");
- (void) shmctl(shmid, IPC_RMID, 0);
- return(KFAILURE);
- } else
- if (krb_debug)
- printf("swapped UID's %d and %d\n",metoo,me);
- }
- if ((sfile = fopen(file_name,"w")) == 0) {
- if (krb_debug)
- perror("krb_shm_create file");
- (void) shmctl(shmid, IPC_RMID, 0);
- return(KFAILURE); /* XXX */
- }
- if (fchmod(fileno(sfile),0600) < 0) {
- if (krb_debug)
- perror("krb_shm_create fchmod");
- (void) shmctl(shmid, IPC_RMID, 0);
- return(KFAILURE); /* XXX */
- }
- if (me != metoo) {
- if (setreuid(me, metoo) < 0) {
- /* can't switch??? barf! */
- if (krb_debug)
- perror("krb_shm_create: setreuid2");
- (void) shmctl(shmid, IPC_RMID, 0);
- return(KFAILURE);
- } else
- if (krb_debug)
- printf("swapped UID's %d and %d\n",me,metoo);
- }
-
- (void) fprintf(sfile,"%d",shmid);
- (void) fflush(sfile);
- (void) fclose(sfile);
- return(KSUCCESS);
-}
-
-
-/*
- * krb_is_diskless:
- *
- * check / to see if file .diskless exists. If so it is diskless.
- * Do it this way now to avoid dependencies on a particular routine.
- * Choose root file system since that will be private to the client.
- */
-
-int krb_is_diskless()
-{
- struct stat buf;
- if (stat("/.diskless",&buf) < 0)
- return(0);
- else return(1);
-}
-
-/*
- * krb_shm_dest: destroy shared memory segment with session keys, and remove
- * file pointing to it.
- */
-
-int krb_shm_dest(file)
-char *file;
-{
- int shmid;
- FILE *sfile;
- struct stat st_buf;
-
- if (stat(file,&st_buf) == 0) {
- /* successful stat */
- if ((sfile = fopen(file,"r")) == 0) {
- if (krb_debug)
- perror("cannot open shared memory file");
- return(KFAILURE); /* XXX */
- }
- if (fscanf(sfile,"%d",&shmid) == 1) {
- if (shmctl(shmid,IPC_RMID,0) != 0) {
- if (krb_debug)
- perror("krb_shm_dest: cannot delete shm segment");
- (void) fclose(sfile);
- return(KFAILURE); /* XXX */
- }
- } else {
- if (krb_debug)
- fprintf(stderr, "bad format in shmid file\n");
- (void) fclose(sfile);
- return(KFAILURE); /* XXX */
- }
- (void) fclose(sfile);
- (void) unlink(file);
- return(KSUCCESS);
- } else
- return(RET_TKFIL); /* XXX */
-}
-
-
-
diff --git a/eBones/krb/tf_util.3 b/eBones/krb/tf_util.3
deleted file mode 100644
index ee6e436..0000000
--- a/eBones/krb/tf_util.3
+++ /dev/null
@@ -1,151 +0,0 @@
-.\" from: tf_util.3,v 4.2 89/04/25 17:17:11 jtkohl Exp $
-.\" $Id: tf_util.3,v 1.1.1.1 1994/09/30 14:50:08 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH TF_UTIL 3 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-tf_init, tf_get_pname, tf_get_pinst, tf_get_cred, tf_close \
-\- Routines for manipulating a Kerberos ticket file
-.SH SYNOPSIS
-.nf
-.nj
-.ft B
-#include <kerberosIV/krb.h>
-.PP
-.ft B
-extern char *krb_err_txt[];
-.PP
-.ft B
-tf_init(tf_name, rw)
-char *tf_name;
-int rw;
-.PP
-.ft B
-tf_get_pname(pname)
-char *pname;
-.PP
-.ft B
-tf_get_pinst(pinst)
-char *pinst;
-.PP
-.ft B
-tf_get_cred(c)
-CREDENTIALS *c;
-.PP
-.ft B
-tf_close()
-.PP
-.fi
-.SH DESCRIPTION
-This group of routines are provided to manipulate the Kerberos tickets
-file. A ticket file has the following format:
-.nf
-.in +4
-.sp
-principal's name (null-terminated string)
-principal's instance (null-terminated string)
-CREDENTIAL_1
-CREDENTIAL_2
- ...
-CREDENTIAL_n
-EOF
-.sp
-.in -4
-.LP
-Where "CREDENTIAL_x" consists of the following fixed-length
-fields from the CREDENTIALS structure (defined in <krb.h>):
-.nf
-.sp
-.in +4
- char service[ANAME_SZ]
- char instance[INST_SZ]
- char realm[REALM_SZ]
- des_cblock session
- int lifetime
- int kvno
- KTEXT_ST ticket_st
- long issue_date
-.in -4
-.sp
-.fi
-.PP
-.I tf_init
-must be called before the other ticket file
-routines.
-It takes the name of the ticket file to use,
-and a read/write flag as arguments.
-It tries to open the ticket file, checks the mode and if
-everything is okay, locks the file. If it's opened for
-reading, the lock is shared. If it's opened for writing,
-the lock is exclusive.
-KSUCCESS is returned if all went well, otherwise one of the
-following:
-.nf
-.sp
-NO_TKT_FIL - file wasn't there
-TKT_FIL_ACC - file was in wrong mode, etc.
-TKT_FIL_LCK - couldn't lock the file, even after a retry
-.sp
-.fi
-.PP
-The
-.I tf_get_pname
-reads the principal's name from a ticket file.
-It should only be called after tf_init has been called. The
-principal's name is filled into the
-.I pname
-parameter. If all goes
-well, KSUCCESS is returned.
-If tf_init wasn't called, TKT_FIL_INI
-is returned.
-If the principal's name was null, or EOF was encountered, or the
-name was longer than ANAME_SZ, TKT_FIL_FMT is returned.
-.PP
-The
-.I tf_get_pinst
-reads the principal's instance from a ticket file.
-It should only be called after tf_init and tf_get_pname
-have been called.
-The principal's instance is filled into the
-.I pinst
-parameter.
-If all goes
-well, KSUCCESS is returned.
-If tf_init wasn't called, TKT_FIL_INI
-is returned.
-If EOF was encountered, or the
-name was longer than INST_SZ, TKT_FIL_FMT is returned.
-Note that, unlike the principal name, the instance name may be null.
-.PP
-The
-.I tf_get_cred
-routine reads a CREDENTIALS record from a ticket file and
-fills in the given structure.
-It should only be called after
-tf_init, tf_get_pname, and tf_get_pinst have been called.
-If all goes well, KSUCCESS is returned. Possible error codes
-are:
-.nf
-.sp
-TKT_FIL_INI - tf_init wasn't called first
-TKT_FIL_FMT - bad format
-EOF - end of file encountered
-.sp
-.fi
-.PP
-.I tf_close
-closes the ticket file and releases the lock on it.
-.SH "SEE ALSO"
-krb(3)
-.SH DIAGNOSTICS
-.SH BUGS
-The ticket file routines have to be called in a certain order.
-.SH AUTHORS
-Jennifer Steiner, MIT Project Athena
-.br
-Bill Bryant, MIT Project Athena
-.SH RESTRICTIONS
-Copyright 1987 Massachusetts Institute of Technology
diff --git a/eBones/krb/tf_util.c b/eBones/krb/tf_util.c
deleted file mode 100644
index e939c38..0000000
--- a/eBones/krb/tf_util.c
+++ /dev/null
@@ -1,581 +0,0 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: tf_util.c,v 4.9 90/03/10 19:19:45 jon Exp $
- * $Id: tf_util.c,v 1.3 1995/07/18 16:39:50 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: tf_util.c,v 1.3 1995/07/18 16:39:50 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#include <krb.h>
-
-#ifdef TKT_SHMEM
-#include <sys/param.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#endif /* TKT_SHMEM */
-
-#define TOO_BIG -1
-#define TF_LCK_RETRY ((unsigned)2) /* seconds to sleep before
- * retry if ticket file is
- * locked */
-extern int krb_debug;
-
-#ifdef TKT_SHMEM
-char *krb_shm_addr = 0;
-static char *tmp_shm_addr = 0;
-static char krb_dummy_skey[8] = {0,0,0,0,0,0,0,0};
-
-#endif /* TKT_SHMEM */
-
-/*
- * fd must be initialized to something that won't ever occur as a real
- * file descriptor. Since open(2) returns only non-negative numbers as
- * valid file descriptors, and tf_init always stuffs the return value
- * from open in here even if it is an error flag, we must
- * a. Initialize fd to a negative number, to indicate that it is
- * not initially valid.
- * b. When checking for a valid fd, assume that negative values
- * are invalid (ie. when deciding whether tf_init has been
- * called.)
- * c. In tf_close, be sure it gets reinitialized to a negative
- * number.
- */
-static fd = -1;
-static curpos; /* Position in tfbfr */
-static lastpos; /* End of tfbfr */
-static char tfbfr[BUFSIZ]; /* Buffer for ticket data */
-
-static int tf_read(char *s, int n);
-static int tf_gets(char *s, int n);
-
-/*
- * This file contains routines for manipulating the ticket cache file.
- *
- * The ticket file is in the following format:
- *
- * principal's name (null-terminated string)
- * principal's instance (null-terminated string)
- * CREDENTIAL_1
- * CREDENTIAL_2
- * ...
- * CREDENTIAL_n
- * EOF
- *
- * Where "CREDENTIAL_x" consists of the following fixed-length
- * fields from the CREDENTIALS structure (see "krb.h"):
- *
- * char service[ANAME_SZ]
- * char instance[INST_SZ]
- * char realm[REALM_SZ]
- * C_Block session
- * int lifetime
- * int kvno
- * KTEXT_ST ticket_st
- * long issue_date
- *
- * Short description of routines:
- *
- * tf_init() opens the ticket file and locks it.
- *
- * tf_get_pname() returns the principal's name.
- *
- * tf_get_pinst() returns the principal's instance (may be null).
- *
- * tf_get_cred() returns the next CREDENTIALS record.
- *
- * tf_save_cred() appends a new CREDENTIAL record to the ticket file.
- *
- * tf_close() closes the ticket file and releases the lock.
- *
- * tf_gets() returns the next null-terminated string. It's an internal
- * routine used by tf_get_pname(), tf_get_pinst(), and tf_get_cred().
- *
- * tf_read() reads a given number of bytes. It's an internal routine
- * used by tf_get_cred().
- */
-
-/*
- * tf_init() should be called before the other ticket file routines.
- * It takes the name of the ticket file to use, "tf_name", and a
- * read/write flag "rw" as arguments.
- *
- * It tries to open the ticket file, checks the mode, and if everything
- * is okay, locks the file. If it's opened for reading, the lock is
- * shared. If it's opened for writing, the lock is exclusive.
- *
- * Returns KSUCCESS if all went well, otherwise one of the following:
- *
- * NO_TKT_FIL - file wasn't there
- * TKT_FIL_ACC - file was in wrong mode, etc.
- * TKT_FIL_LCK - couldn't lock the file, even after a retry
- */
-
-int
-tf_init(tf_name, rw)
- char *tf_name;
- int rw;
-{
- int wflag;
- uid_t me, getuid();
- struct stat stat_buf;
-#ifdef TKT_SHMEM
- char shmidname[MAXPATHLEN];
- FILE *sfp;
- int shmid;
-#endif
-
- switch (rw) {
- case R_TKT_FIL:
- wflag = 0;
- break;
- case W_TKT_FIL:
- wflag = 1;
- break;
- default:
- if (krb_debug) fprintf(stderr, "tf_init: illegal parameter\n");
- return TKT_FIL_ACC;
- }
- if (lstat(tf_name, &stat_buf) < 0)
- switch (errno) {
- case ENOENT:
- return NO_TKT_FIL;
- default:
- return TKT_FIL_ACC;
- }
- me = getuid();
- if ((stat_buf.st_uid != me && me != 0) ||
- ((stat_buf.st_mode & S_IFMT) != S_IFREG))
- return TKT_FIL_ACC;
-#ifdef TKT_SHMEM
- (void) strcpy(shmidname, tf_name);
- (void) strcat(shmidname, ".shm");
- if (stat(shmidname,&stat_buf) < 0)
- return(TKT_FIL_ACC);
- if ((stat_buf.st_uid != me && me != 0) ||
- ((stat_buf.st_mode & S_IFMT) != S_IFREG))
- return TKT_FIL_ACC;
-#endif /* TKT_SHMEM */
-
- /*
- * If "wflag" is set, open the ticket file in append-writeonly mode
- * and lock the ticket file in exclusive mode. If unable to lock
- * the file, sleep and try again. If we fail again, return with the
- * proper error message.
- */
-
- curpos = sizeof(tfbfr);
-
-#ifdef TKT_SHMEM
- sfp = fopen(shmidname, "r"); /* only need read/write on the
- actual tickets */
- if (sfp == 0)
- return TKT_FIL_ACC;
- shmid = -1;
- {
- char buf[BUFSIZ];
- int val; /* useful for debugging fscanf */
- /* We provide our own buffer here since some STDIO libraries
- barf on unbuffered input with fscanf() */
-
- setbuf(sfp, buf);
- if ((val = fscanf(sfp,"%d",&shmid)) != 1) {
- (void) fclose(sfp);
- return TKT_FIL_ACC;
- }
- if (shmid < 0) {
- (void) fclose(sfp);
- return TKT_FIL_ACC;
- }
- (void) fclose(sfp);
- }
- /*
- * global krb_shm_addr is initialized to 0. Ultrix bombs when you try and
- * attach the same segment twice so we need this check.
- */
- if (!krb_shm_addr) {
- if ((krb_shm_addr = shmat(shmid,0,0)) == -1){
- if (krb_debug)
- fprintf(stderr,
- "cannot attach shared memory for segment %d\n",
- shmid);
- krb_shm_addr = 0; /* reset so we catch further errors */
- return TKT_FIL_ACC;
- }
- }
- tmp_shm_addr = krb_shm_addr;
-#endif /* TKT_SHMEM */
-
- if (wflag) {
- fd = open(tf_name, O_RDWR, 0600);
- if (fd < 0) {
- return TKT_FIL_ACC;
- }
- if (flock(fd, LOCK_EX | LOCK_NB) < 0) {
- sleep(TF_LCK_RETRY);
- if (flock(fd, LOCK_EX | LOCK_NB) < 0) {
- (void) close(fd);
- fd = -1;
- return TKT_FIL_LCK;
- }
- }
- return KSUCCESS;
- }
- /*
- * Otherwise "wflag" is not set and the ticket file should be opened
- * for read-only operations and locked for shared access.
- */
-
- fd = open(tf_name, O_RDONLY, 0600);
- if (fd < 0) {
- return TKT_FIL_ACC;
- }
- if (flock(fd, LOCK_SH | LOCK_NB) < 0) {
- sleep(TF_LCK_RETRY);
- if (flock(fd, LOCK_SH | LOCK_NB) < 0) {
- (void) close(fd);
- fd = -1;
- return TKT_FIL_LCK;
- }
- }
- return KSUCCESS;
-}
-
-/*
- * tf_get_pname() reads the principal's name from the ticket file. It
- * should only be called after tf_init() has been called. The
- * principal's name is filled into the "p" parameter. If all goes well,
- * KSUCCESS is returned. If tf_init() wasn't called, TKT_FIL_INI is
- * returned. If the name was null, or EOF was encountered, or the name
- * was longer than ANAME_SZ, TKT_FIL_FMT is returned.
- */
-
-int
-tf_get_pname(p)
- char *p;
-{
- if (fd < 0) {
- if (krb_debug)
- fprintf(stderr, "tf_get_pname called before tf_init.\n");
- return TKT_FIL_INI;
- }
- if (tf_gets(p, ANAME_SZ) < 2) /* can't be just a null */
- return TKT_FIL_FMT;
- return KSUCCESS;
-}
-
-/*
- * tf_get_pinst() reads the principal's instance from a ticket file.
- * It should only be called after tf_init() and tf_get_pname() have been
- * called. The instance is filled into the "inst" parameter. If all
- * goes well, KSUCCESS is returned. If tf_init() wasn't called,
- * TKT_FIL_INI is returned. If EOF was encountered, or the instance
- * was longer than ANAME_SZ, TKT_FIL_FMT is returned. Note that the
- * instance may be null.
- */
-
-int
-tf_get_pinst(inst)
- char *inst;
-{
- if (fd < 0) {
- if (krb_debug)
- fprintf(stderr, "tf_get_pinst called before tf_init.\n");
- return TKT_FIL_INI;
- }
- if (tf_gets(inst, INST_SZ) < 1)
- return TKT_FIL_FMT;
- return KSUCCESS;
-}
-
-/*
- * tf_get_cred() reads a CREDENTIALS record from a ticket file and fills
- * in the given structure "c". It should only be called after tf_init(),
- * tf_get_pname(), and tf_get_pinst() have been called. If all goes well,
- * KSUCCESS is returned. Possible error codes are:
- *
- * TKT_FIL_INI - tf_init wasn't called first
- * TKT_FIL_FMT - bad format
- * EOF - end of file encountered
- */
-
-int
-tf_get_cred(c)
- CREDENTIALS *c;
-{
- KTEXT ticket = &c->ticket_st; /* pointer to ticket */
- int k_errno;
-
- if (fd < 0) {
- if (krb_debug)
- fprintf(stderr, "tf_get_cred called before tf_init.\n");
- return TKT_FIL_INI;
- }
- if ((k_errno = tf_gets(c->service, SNAME_SZ)) < 2)
- switch (k_errno) {
- case TOO_BIG:
- case 1: /* can't be just a null */
- tf_close();
- return TKT_FIL_FMT;
- case 0:
- return EOF;
- }
- if ((k_errno = tf_gets(c->instance, INST_SZ)) < 1)
- switch (k_errno) {
- case TOO_BIG:
- return TKT_FIL_FMT;
- case 0:
- return EOF;
- }
- if ((k_errno = tf_gets(c->realm, REALM_SZ)) < 2)
- switch (k_errno) {
- case TOO_BIG:
- case 1: /* can't be just a null */
- tf_close();
- return TKT_FIL_FMT;
- case 0:
- return EOF;
- }
- if (
- tf_read((char *) (c->session), KEY_SZ) < 1 ||
- tf_read((char *) &(c->lifetime), sizeof(c->lifetime)) < 1 ||
- tf_read((char *) &(c->kvno), sizeof(c->kvno)) < 1 ||
- tf_read((char *) &(ticket->length), sizeof(ticket->length))
- < 1 ||
- /* don't try to read a silly amount into ticket->dat */
- ticket->length > MAX_KTXT_LEN ||
- tf_read((char *) (ticket->dat), ticket->length) < 1 ||
- tf_read((char *) &(c->issue_date), sizeof(c->issue_date)) < 1
- ) {
- tf_close();
- return TKT_FIL_FMT;
- }
-#ifdef TKT_SHMEM
- bcopy(tmp_shm_addr,c->session,KEY_SZ);
- tmp_shm_addr += KEY_SZ;
-#endif /* TKT_SHMEM */
- return KSUCCESS;
-}
-
-/*
- * tf_close() closes the ticket file and sets "fd" to -1. If "fd" is
- * not a valid file descriptor, it just returns. It also clears the
- * buffer used to read tickets.
- *
- * The return value is not defined.
- */
-
-void
-tf_close()
-{
- if (!(fd < 0)) {
-#ifdef TKT_SHMEM
- if (shmdt(krb_shm_addr)) {
- /* what kind of error? */
- if (krb_debug)
- fprintf(stderr, "shmdt 0x%x: errno %d",krb_shm_addr, errno);
- } else {
- krb_shm_addr = 0;
- }
-#endif TKT_SHMEM
- (void) flock(fd, LOCK_UN);
- (void) close(fd);
- fd = -1; /* see declaration of fd above */
- }
- bzero(tfbfr, sizeof(tfbfr));
-}
-
-/*
- * tf_gets() is an internal routine. It takes a string "s" and a count
- * "n", and reads from the file until either it has read "n" characters,
- * or until it reads a null byte. When finished, what has been read exists
- * in "s". If it encounters EOF or an error, it closes the ticket file.
- *
- * Possible return values are:
- *
- * n the number of bytes read (including null terminator)
- * when all goes well
- *
- * 0 end of file or read error
- *
- * TOO_BIG if "count" characters are read and no null is
- * encountered. This is an indication that the ticket
- * file is seriously ill.
- */
-
-static int
-tf_gets(s, n)
- register char *s;
- int n;
-{
- register count;
-
- if (fd < 0) {
- if (krb_debug)
- fprintf(stderr, "tf_gets called before tf_init.\n");
- return TKT_FIL_INI;
- }
- for (count = n - 1; count > 0; --count) {
- if (curpos >= sizeof(tfbfr)) {
- lastpos = read(fd, tfbfr, sizeof(tfbfr));
- curpos = 0;
- }
- if (curpos == lastpos) {
- tf_close();
- return 0;
- }
- *s = tfbfr[curpos++];
- if (*s++ == '\0')
- return (n - count);
- }
- tf_close();
- return TOO_BIG;
-}
-
-/*
- * tf_read() is an internal routine. It takes a string "s" and a count
- * "n", and reads from the file until "n" bytes have been read. When
- * finished, what has been read exists in "s". If it encounters EOF or
- * an error, it closes the ticket file.
- *
- * Possible return values are:
- *
- * n the number of bytes read when all goes well
- *
- * 0 on end of file or read error
- */
-
-static int
-tf_read(s, n)
- register char *s;
- register int n;
-{
- register count;
-
- for (count = n; count > 0; --count) {
- if (curpos >= sizeof(tfbfr)) {
- lastpos = read(fd, tfbfr, sizeof(tfbfr));
- curpos = 0;
- }
- if (curpos == lastpos) {
- tf_close();
- return 0;
- }
- *s++ = tfbfr[curpos++];
- }
- return n;
-}
-
-/*
- * tf_save_cred() appends an incoming ticket to the end of the ticket
- * file. You must call tf_init() before calling tf_save_cred().
- *
- * The "service", "instance", and "realm" arguments specify the
- * server's name; "session" contains the session key to be used with
- * the ticket; "kvno" is the server key version number in which the
- * ticket is encrypted, "ticket" contains the actual ticket, and
- * "issue_date" is the time the ticket was requested (local host's time).
- *
- * Returns KSUCCESS if all goes well, TKT_FIL_INI if tf_init() wasn't
- * called previously, and KFAILURE for anything else that went wrong.
- */
-
-int
-tf_save_cred(service, instance, realm, session, lifetime, kvno,
- ticket, issue_date)
- char *service; /* Service name */
- char *instance; /* Instance */
- char *realm; /* Auth domain */
- C_Block session; /* Session key */
- int lifetime; /* Lifetime */
- int kvno; /* Key version number */
- KTEXT ticket; /* The ticket itself */
- long issue_date; /* The issue time */
-{
-
- off_t lseek();
- int count; /* count for write */
-#ifdef TKT_SHMEM
- int *skey_check;
-#endif /* TKT_SHMEM */
-
- if (fd < 0) { /* fd is ticket file as set by tf_init */
- if (krb_debug)
- fprintf(stderr, "tf_save_cred called before tf_init.\n");
- return TKT_FIL_INI;
- }
- /* Find the end of the ticket file */
- (void) lseek(fd, 0L, 2);
-#ifdef TKT_SHMEM
- /* scan to end of existing keys: pick first 'empty' slot.
- we assume that no real keys will be completely zero (it's a weak
- key under DES) */
-
- skey_check = (int *) krb_shm_addr;
-
- while (*skey_check && *(skey_check+1))
- skey_check += 2;
- tmp_shm_addr = (char *)skey_check;
-#endif /* TKT_SHMEM */
-
- /* Write the ticket and associated data */
- /* Service */
- count = strlen(service) + 1;
- if (write(fd, service, count) != count)
- goto bad;
- /* Instance */
- count = strlen(instance) + 1;
- if (write(fd, instance, count) != count)
- goto bad;
- /* Realm */
- count = strlen(realm) + 1;
- if (write(fd, realm, count) != count)
- goto bad;
- /* Session key */
-#ifdef TKT_SHMEM
- bcopy(session,tmp_shm_addr,8);
- tmp_shm_addr+=8;
- if (write(fd,krb_dummy_skey,8) != 8)
- goto bad;
-#else /* ! TKT_SHMEM */
- if (write(fd, (char *) session, 8) != 8)
- goto bad;
-#endif /* TKT_SHMEM */
- /* Lifetime */
- if (write(fd, (char *) &lifetime, sizeof(int)) != sizeof(int))
- goto bad;
- /* Key vno */
- if (write(fd, (char *) &kvno, sizeof(int)) != sizeof(int))
- goto bad;
- /* Tkt length */
- if (write(fd, (char *) &(ticket->length), sizeof(int)) !=
- sizeof(int))
- goto bad;
- /* Ticket */
- count = ticket->length;
- if (write(fd, (char *) (ticket->dat), count) != count)
- goto bad;
- /* Issue date */
- if (write(fd, (char *) &issue_date, sizeof(long))
- != sizeof(long))
- goto bad;
-
- /* Actually, we should check each write for success */
- return (KSUCCESS);
-bad:
- return (KFAILURE);
-}
diff --git a/eBones/krb/tkt_string.c b/eBones/krb/tkt_string.c
deleted file mode 100644
index d944833..0000000
--- a/eBones/krb/tkt_string.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: tkt_string.c,v 4.6 89/01/05 12:31:51 raeburn Exp $
- * $Id: tkt_string.c,v 1.3 1995/07/18 16:39:52 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char *rcsid =
-"$Id: tkt_string.c,v 1.3 1995/07/18 16:39:52 mark Exp $";
-#endif /* lint */
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <krb.h>
-#include <string.h>
-#include <sys/param.h>
-
-/*
- * This routine is used to generate the name of the file that holds
- * the user's cache of server tickets and associated session keys.
- *
- * If it is set, krb_ticket_string contains the ticket file name.
- * Otherwise, the filename is constructed as follows:
- *
- * If it is set, the environment variable "KRBTKFILE" will be used as
- * the ticket file name. Otherwise TKT_ROOT (defined in "krb.h") and
- * the user's uid are concatenated to produce the ticket file name
- * (e.g., "/tmp/tkt123"). A pointer to the string containing the ticket
- * file name is returned.
- */
-
-static char krb_ticket_string[MAXPATHLEN] = "";
-
-char *tkt_string()
-{
- char *env;
- uid_t getuid();
-
- if (!*krb_ticket_string) {
- if ((env = getenv("KRBTKFILE"))) {
- (void) strncpy(krb_ticket_string, env,
- sizeof(krb_ticket_string)-1);
- krb_ticket_string[sizeof(krb_ticket_string)-1] = '\0';
- } else {
- /* 32 bits of signed integer will always fit in 11 characters
- (including the sign), so no need to worry about overflow */
- (void) sprintf(krb_ticket_string, "%s%ld",TKT_ROOT,getuid());
- }
- }
- return krb_ticket_string;
-}
-
-/*
- * This routine is used to set the name of the file that holds the user's
- * cache of server tickets and associated session keys.
- *
- * The value passed in is copied into local storage.
- *
- * NOTE: This routine should be called during initialization, before other
- * Kerberos routines are called; otherwise tkt_string() above may be called
- * and return an undesired ticket file name until this routine is called.
- */
-
-void
-krb_set_tkt_string(val)
-char *val;
-{
-
- (void) strncpy(krb_ticket_string, val, sizeof(krb_ticket_string)-1);
- krb_ticket_string[sizeof(krb_ticket_string)-1] = '\0';
-
- return;
-}
diff --git a/eBones/krb/util.c b/eBones/krb/util.c
deleted file mode 100644
index 68c0dbc..0000000
--- a/eBones/krb/util.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Miscellaneous debug printing utilities
- *
- * from: util.c,v 4.8 89/01/17 22:02:08 wesommer Exp $
- * $Id: util.c,v 1.3 1995/07/18 16:39:54 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: util.c,v 1.3 1995/07/18 16:39:54 mark Exp $";
-#endif lint
-#endif
-
-#include <krb.h>
-#include <des.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <stdio.h>
-
-/*
- * Print some of the contents of the given authenticator structure
- * (AUTH_DAT defined in "krb.h"). Fields printed are:
- *
- * pname, pinst, prealm, netaddr, flags, cksum, timestamp, session
- */
-
-void
-ad_print(x)
-AUTH_DAT *x;
-{
- struct in_addr in;
-
- /* Print the contents of an auth_dat struct. */
- in.s_addr = x->address;
- printf("\n%s %s %s %s flags %u cksum 0x%lX\n\ttkt_tm 0x%lX sess_key",
- x->pname, x->pinst, x->prealm, inet_ntoa(in), x->k_flags,
- x->checksum, x->time_sec);
-
- printf("[8] =");
-#ifdef NOENCRYPTION
- placebo_cblock_print(x->session);
-#else
- des_cblock_print_file((C_Block *)x->session,stdout);
-#endif
- /* skip reply for now */
-}
-
-/*
- * Print in hex the 8 bytes of the given session key.
- *
- * Printed format is: " 0x { x, x, x, x, x, x, x, x }"
- */
-
-#ifdef NOENCRYPTION
-placebo_cblock_print(x)
- des_cblock x;
-{
- unsigned char *y = (unsigned char *) x;
- register int i = 0;
-
- printf(" 0x { ");
-
- while (i++ <8) {
- printf("%x",*y++);
- if (i<8) printf(", ");
- }
- printf(" }");
-}
-#endif
diff --git a/eBones/ksrvtgt/Makefile b/eBones/ksrvtgt/Makefile
deleted file mode 100644
index 9bf166d..0000000
--- a/eBones/ksrvtgt/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# From: @(#)Makefile 5.1 (Berkeley) 6/25/90
-# $Id: Makefile,v 1.3 1995/07/18 16:40:05 mark Exp $
-
-PROG= ksrvtgt
-CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -Wall
-DPADD= ${LIBKRB} ${LIBDES}
-LDADD= -L${KRBOBJDIR} -lkrb -ldes
-BINDIR= /usr/bin
-MAN1= ksrvtgt.1
-
-.include <bsd.prog.mk>
diff --git a/eBones/ksrvtgt/ksrvtgt.1 b/eBones/ksrvtgt/ksrvtgt.1
deleted file mode 100644
index 129c745..0000000
--- a/eBones/ksrvtgt/ksrvtgt.1
+++ /dev/null
@@ -1,51 +0,0 @@
-.\" from: ksrvtgt.1,v 4.1 89/01/24 14:36:28 jtkohl Exp $
-.\" $Id: ksrvtgt.1,v 1.1.1.1 1994/09/30 14:50:07 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KSRVTGT 1 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-ksrvtgt \- fetch and store Kerberos ticket-granting-ticket using a
-service key
-.SH SYNOPSIS
-.B ksrvtgt
-name instance [[realm] srvtab]
-.SH DESCRIPTION
-.I ksrvtgt
-retrieves a ticket-granting ticket with a lifetime of five (5) minutes
-for the principal
-.I name.instance@realm
-(or
-.I name.instance@localrealm
-if
-.I realm
-is not supplied on the command line), decrypts the response using
-the service key found in
-.I srvtab
-(or in
-.B /etc/kerberosIV/srvtab
-if
-.I srvtab
-is not specified on the command line), and stores the ticket in the
-standard ticket cache.
-.PP
-This command is intended primarily for use in shell scripts and other
-batch-type facilities.
-.SH DIAGNOSTICS
-"Generic kerberos failure (kfailure)" can indicate a whole range of
-problems, the most common of which is the inability to read the service
-key file.
-.SH FILES
-.TP 2i
-/etc/kerberosIV/krb.conf
-to get the name of the local realm.
-.TP
-/tmp/tkt[uid]
-The default ticket file.
-.TP
-/etc/kerberosIV/srvtab
-The default service key file.
-.SH SEE ALSO
-kerberos(1), kinit(1), kdestroy(1)
diff --git a/eBones/ksrvtgt/ksrvtgt.c b/eBones/ksrvtgt/ksrvtgt.c
deleted file mode 100644
index 0f92394..0000000
--- a/eBones/ksrvtgt/ksrvtgt.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * Get a ticket-granting-ticket given a service key file (srvtab)
- * The lifetime is the shortest allowed [1 five-minute interval]
- *
- * from: ksrvtgt.c,v 4.3 89/07/28 10:17:28 jtkohl Exp $
- * $Id: ksrvtgt.c,v 1.3 1995/07/18 16:40:07 mark Exp $
- */
-
-#ifndef lint
-const char rcsid[] =
-"$Id: ksrvtgt.c,v 1.3 1995/07/18 16:40:07 mark Exp $";
-#endif /* lint */
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/param.h>
-#include <krb.h>
-#include <conf.h>
-
-int
-main(argc,argv)
- int argc;
- char **argv;
-{
- char realm[REALM_SZ + 1];
- register int code;
- char srvtab[MAXPATHLEN + 1];
-
- bzero(realm, sizeof(realm));
- bzero(srvtab, sizeof(srvtab));
-
- if (argc < 3 || argc > 5) {
- fprintf(stderr, "Usage: %s name instance [[realm] srvtab]\n",
- argv[0]);
- exit(1);
- }
-
- if (argc == 4)
- (void) strncpy(srvtab, argv[3], sizeof(srvtab) -1);
-
- if (argc == 5) {
- (void) strncpy(realm, argv[3], sizeof(realm) - 1);
- (void) strncpy(srvtab, argv[4], sizeof(srvtab) -1);
- }
-
- if (srvtab[0] == 0)
- (void) strcpy(srvtab, KEYFILE);
-
- if (realm[0] == 0)
- if (krb_get_lrealm(realm, 1) != KSUCCESS)
- (void) strcpy(realm, KRB_REALM);
-
- code = krb_get_svc_in_tkt(argv[1], argv[2], realm,
- "krbtgt", realm, 1, srvtab);
- if (code)
- fprintf(stderr, "%s\n", krb_err_txt[code]);
- exit(code);
-}
diff --git a/eBones/ksrvutil/HOW-TO b/eBones/ksrvutil/HOW-TO
deleted file mode 100644
index 53f719c..0000000
--- a/eBones/ksrvutil/HOW-TO
+++ /dev/null
@@ -1,291 +0,0 @@
-To re-create this export-controlled program from eBones:
-
-1) Copy ksrvutil.c from the kadmin directory.
-2) perl -spi.bak -e 's/\$(Header[^\$]*)\$/$1/g' *.[ch]
-3) Apply this patch:
-
-*** ksrvutil.c.orig Fri Jan 20 17:19:45 1995
---- ksrvutil.c Fri Jan 20 17:27:38 1995
-***************
-*** 1,10 ****
- /*
-- * $Source: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/ksrvutil.c,v $
-- * $Author: jtkohl $
-- *
- * Copyright 1989 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
-! * <mit-copyright.h>.
- *
- * list and update contents of srvtab files
---- 1,7 ----
- /*
- * Copyright 1989 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
-! * Copyright.MIT.
- *
- * list and update contents of srvtab files
-***************
-*** 12,20 ****
-
- #ifndef lint
- static char rcsid_ksrvutil_c[] =
-! "BonesHeader: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/ksrvutil.c,v 4.1 89/09/26 09:33:49 jtkohl Exp ";
- #endif lint
-
-- #include <mit-copyright.h>
- /*
- * ksrvutil
---- 9,20 ----
-
- #ifndef lint
-+ #if 0
- static char rcsid_ksrvutil_c[] =
-! "BonesHeader: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/ksrvutil.c,v 4.1 89/09/26 09:33:49 jtkohl Exp ";
-! #endif
-! static const char rcsid[] =
-! "$Id$";
- #endif lint
-
- /*
- * ksrvutil
-***************
-*** 37,40 ****
---- 37,41 ----
- #include <errno.h>
- #include <kadm.h>
-+ #include <err.h>
-
- #ifdef NOENCRYPTION
-***************
-*** 54,58 ****
-
- extern int errno;
-- extern char *sys_errlist[];
-
- extern void krb_set_tkt_string();
---- 55,58 ----
-***************
-*** 79,85 ****
- if ((keyfile_fd = open(keyfile, O_RDONLY, 0)) < 0) {
- if (errno != ENOENT) {
-! (void)fprintf(stderr, "%s: Unable to read %s: %s\n", progname,
-! keyfile, sys_errlist[errno]);
-! exit(1);
- }
- else {
---- 79,83 ----
- if ((keyfile_fd = open(keyfile, O_RDONLY, 0)) < 0) {
- if (errno != ENOENT) {
-! err(1, "unable to read %s", keyfile);
- }
- else {
-***************
-*** 88,100 ****
- open(keyfile,
- O_WRONLY | O_TRUNC | O_CREAT, SRVTAB_MODE)) < 0) {
-! (void) fprintf(stderr, "%s: Unable to create %s: %s\n",
-! progname, keyfile, sys_errlist[errno]);
-! exit(1);
- }
- else
- if (close(keyfile_fd) < 0) {
-! (void) fprintf(stderr, "%s: Failure closing %s: %s\n",
-! progname, keyfile, sys_errlist[errno]);
-! exit(1);
- }
- }
---- 86,94 ----
- open(keyfile,
- O_WRONLY | O_TRUNC | O_CREAT, SRVTAB_MODE)) < 0) {
-! err(1, "unable to create %s", keyfile);
- }
- else
- if (close(keyfile_fd) < 0) {
-! err(1, "failure closing %s", keyfile);
- }
- }
-***************
-*** 107,135 ****
- open(backup_keyfile, O_WRONLY | O_TRUNC | O_CREAT,
- keyfile_mode)) < 0) {
-! (void) fprintf(stderr, "%s: Unable to write %s: %s\n", progname,
-! backup_keyfile, sys_errlist[errno]);
-! exit(1);
- }
- do {
- if ((rcount = read(keyfile_fd, (char *)buf, sizeof(buf))) < 0) {
-! (void) fprintf(stderr, "%s: Error reading %s: %s\n", progname,
-! keyfile, sys_errlist[errno]);
-! exit(1);
- }
- if (rcount && (write(backup_keyfile_fd, buf, rcount) != rcount)) {
-! (void) fprintf(stderr, "%s: Error writing %s: %s\n", progname,
-! backup_keyfile, sys_errlist[errno]);
-! exit(1);
- }
- } while (rcount);
- if (close(backup_keyfile_fd) < 0) {
-! (void) fprintf(stderr, "%s: Error closing %s: %s\n", progname,
-! backup_keyfile, sys_errlist[errno]);
-! exit(1);
- }
- if (close(keyfile_fd) < 0) {
-! (void) fprintf(stderr, "%s: Error closing %s: %s\n", progname,
-! keyfile, sys_errlist[errno]);
-! exit(1);
- }
- }
---- 101,119 ----
- open(backup_keyfile, O_WRONLY | O_TRUNC | O_CREAT,
- keyfile_mode)) < 0) {
-! err(1, "unable to write %s", backup_keyfile);
- }
- do {
- if ((rcount = read(keyfile_fd, (char *)buf, sizeof(buf))) < 0) {
-! err(1, "error reading %s", keyfile);
- }
- if (rcount && (write(backup_keyfile_fd, buf, rcount) != rcount)) {
-! err(1, "error writing %s", backup_keyfile);
- }
- } while (rcount);
- if (close(backup_keyfile_fd) < 0) {
-! err(1, "error closing %s", backup_keyfile);
- }
- if (close(keyfile_fd) < 0) {
-! err(1, "error closing %s", keyfile);
- }
- }
-***************
-*** 145,151 ****
- (void) bzero(buf, size);
- if (read(0, buf, size - 1) < 0) {
-! (void) fprintf(stderr, "Failure reading from stdin: %s\n",
-! sys_errlist[errno]);
-! leave((char *)NULL, 1);
- }
- fflush(stdin);
---- 129,134 ----
- (void) bzero(buf, size);
- if (read(0, buf, size - 1) < 0) {
-! warn("failure reading from stdin");
-! leave((char *)NULL, 1);
- }
- fflush(stdin);
-***************
-*** 163,170 ****
- {
- if (write(fd, buf, len) != len) {
-! (void) fprintf(stderr, "%s: Failure writing to %s: %s\n", progname,
-! filename, sys_errlist[errno]);
-! (void) close(fd);
-! leave("In progress srvtab in this file.", 1);
- }
- }
---- 146,152 ----
- {
- if (write(fd, buf, len) != len) {
-! warn("failure writing %s", filename);
-! close(fd);
-! leave("In progress srvtab in this file.", 1);
- }
- }
-***************
-*** 343,349 ****
- if (change || list) {
- if ((backup_keyfile_fd = open(backup_keyfile, O_RDONLY, 0)) < 0) {
-! (void) fprintf(stderr, "%s: Unable to read %s: %s\n", argv[0],
-! backup_keyfile, sys_errlist[errno]);
-! exit(1);
- }
- }
---- 325,329 ----
- if (change || list) {
- if ((backup_keyfile_fd = open(backup_keyfile, O_RDONLY, 0)) < 0) {
-! err(1, "unable to read %s", backup_keyfile);
- }
- }
-***************
-*** 353,359 ****
- open(work_keyfile, O_WRONLY | O_CREAT | O_TRUNC,
- SRVTAB_MODE)) < 0) {
-! (void) fprintf(stderr, "%s: Unable to write %s: %s\n", argv[0],
-! work_keyfile, sys_errlist[errno]);
-! exit(1);
- }
- }
---- 333,337 ----
- open(work_keyfile, O_WRONLY | O_CREAT | O_TRUNC,
- SRVTAB_MODE)) < 0) {
-! err(1, "unable to write %s", work_keyfile);
- }
- }
-***************
-*** 361,367 ****
- if ((work_keyfile_fd =
- open(work_keyfile, O_APPEND | O_WRONLY, SRVTAB_MODE)) < 0) {
-! (void) fprintf(stderr, "%s: Unable to open %s for append: %s\n",
-! argv[0], work_keyfile, sys_errlist[errno]);
-! exit(1);
- }
- }
---- 339,343 ----
- if ((work_keyfile_fd =
- open(work_keyfile, O_APPEND | O_WRONLY, SRVTAB_MODE)) < 0) {
-! err(1, "unable to append to %s", work_keyfile);
- }
- }
-***************
-*** 456,463 ****
- }
- else {
-! (void)fprintf(stderr,
-! "%s: Unable to revert keyfile: %s\n",
-! argv[0], sys_errlist[errno]);
-! leave("", 1);
- }
- }
---- 432,437 ----
- }
- else {
-! warn("unable to revert keyfile");
-! leave("", 1);
- }
- }
-***************
-*** 499,518 ****
- if (change || list)
- if (close(backup_keyfile_fd) < 0) {
-! (void) fprintf(stderr, "%s: Failure closing %s: %s\n",
-! argv[0], backup_keyfile, sys_errlist[errno]);
-! (void) fprintf(stderr, "continuing...\n");
- }
-
- if (change || add) {
- if (close(work_keyfile_fd) < 0) {
-! (void) fprintf(stderr, "%s: Failure closing %s: %s\n",
-! argv[0], work_keyfile, sys_errlist[errno]);
-! exit(1);
- }
- if (rename(work_keyfile, keyfile) < 0) {
-! (void) fprintf(stderr, "%s: Failure renaming %s to %s: %s\n",
-! argv[0], work_keyfile, keyfile,
-! sys_errlist[errno]);
-! exit(1);
- }
- (void) chmod(backup_keyfile, keyfile_mode);
---- 473,485 ----
- if (change || list)
- if (close(backup_keyfile_fd) < 0) {
-! warn("failure closing %s, continuing", backup_keyfile);
- }
-
- if (change || add) {
- if (close(work_keyfile_fd) < 0) {
-! err(1, "failure closing %s", work_keyfile);
- }
- if (rename(work_keyfile, keyfile) < 0) {
-! err(1, "failure renaming %s to %s", work_keyfile, keyfile);
- }
- (void) chmod(backup_keyfile, keyfile_mode);
diff --git a/eBones/ksrvutil/Makefile b/eBones/ksrvutil/Makefile
deleted file mode 100644
index a95d9ae..0000000
--- a/eBones/ksrvutil/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# $Id: Makefile,v 1.1 1995/07/18 16:40:09 mark Exp $
-
-PROG= ksrvutil
-SRCS= ksrvutil.c
-CFLAGS+= -I${.CURDIR}/../include -I${.CURDIR}/../libkadm -Wall
-LDADD+= -L${KADMOBJDIR} -lkadm -L${KRBOBJDIR} -lkrb -ldes -lcom_err
-MAN8= ksrvutil.8
-
-.include <bsd.prog.mk>
diff --git a/eBones/ksrvutil/ksrvutil.c b/eBones/ksrvutil/ksrvutil.c
deleted file mode 100644
index 1062ea5..0000000
--- a/eBones/ksrvutil/ksrvutil.c
+++ /dev/null
@@ -1,582 +0,0 @@
-/*
- * Copyright 1989 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * Copyright.MIT.
- *
- * list and update contents of srvtab files
- */
-
-#if 0
-#ifndef lint
-static char rcsid_ksrvutil_c[] =
-"BonesHeader: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/ksrvutil.c,v 4.1 89/09/26 09:33:49 jtkohl Exp ";
-static const char rcsid[] =
- "$Id: ksrvutil.c,v 1.1 1995/07/18 16:40:11 mark Exp $";
-#endif lint
-#endif
-
-/*
- * ksrvutil
- * list and update the contents of srvtab files
- */
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/param.h>
-#include <stdio.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <kadm.h>
-#include <err.h>
-#include <com_err.h>
-
-#ifdef NOENCRYPTION
-#define read_long_pw_string placebo_read_pw_string
-#else /* NOENCRYPTION */
-#define read_long_pw_string des_read_pw_string
-#endif /* NOENCRYPTION */
-int read_long_pw_string();
-
-#define SRVTAB_MODE 0600 /* rw------- */
-#define PAD " "
-#define VNO_HEADER "Version"
-#define VNO_FORMAT "%4d "
-#define KEY_HEADER " Key " /* 17 characters long */
-#define PRINC_HEADER " Principal\n"
-#define PRINC_FORMAT "%s"
-
-void usage(void);
-void leave(char *str, int x);
-void get_key_from_password(des_cblock key);
-void print_name(char *name, char *inst, char *realm);
-void print_key(des_cblock key);
-unsigned short get_mode(char *filename);
-int get_svc_new_key(des_cblock new_key, char *sname, char *sinst,
- char *srealm, char *keyfile);
-
-void
-copy_keyfile(progname, keyfile, backup_keyfile)
- char *progname;
- char *keyfile;
- char *backup_keyfile;
-{
- int keyfile_fd;
- int backup_keyfile_fd;
- int keyfile_mode;
- char buf[BUFSIZ]; /* for copying keyfiles */
- int rcount; /* for copying keyfiles */
- int try_again;
-
- bzero((char *)buf, sizeof(buf));
-
- do {
- try_again = FALSE;
- if ((keyfile_fd = open(keyfile, O_RDONLY, 0)) < 0) {
- if (errno != ENOENT) {
- err(1, "unable to read %s", keyfile);
- }
- else {
- try_again = TRUE;
- if ((keyfile_fd =
- open(keyfile,
- O_WRONLY | O_TRUNC | O_CREAT, SRVTAB_MODE)) < 0) {
- err(1, "unable to create %s", keyfile);
- }
- else
- if (close(keyfile_fd) < 0) {
- err(1, "failure closing %s", keyfile);
- }
- }
- }
- } while(try_again);
-
- keyfile_mode = get_mode(keyfile);
-
- if ((backup_keyfile_fd =
- open(backup_keyfile, O_WRONLY | O_TRUNC | O_CREAT,
- keyfile_mode)) < 0) {
- err(1, "unable to write %s", backup_keyfile);
- }
- do {
- if ((rcount = read(keyfile_fd, (char *)buf, sizeof(buf))) < 0) {
- err(1, "error reading %s", keyfile);
- }
- if (rcount && (write(backup_keyfile_fd, buf, rcount) != rcount)) {
- err(1, "error writing %s", backup_keyfile);
- }
- } while (rcount);
- if (close(backup_keyfile_fd) < 0) {
- err(1, "error closing %s", backup_keyfile);
- }
- if (close(keyfile_fd) < 0) {
- err(1, "error closing %s", keyfile);
- }
-}
-
-void
-safe_read_stdin(prompt, buf, size)
- char *prompt;
- char *buf;
- int size;
-{
- printf(prompt);
- fflush(stdout);
- bzero(buf, size);
- if (read(0, buf, size - 1) < 0) {
- warn("failure reading from stdin");
- leave((char *)NULL, 1);
- }
- fflush(stdin);
- buf[strlen(buf)-1] = 0;
-}
-
-
-void
-safe_write(progname, filename, fd, buf, len)
- char *progname;
- char *filename;
- int fd;
- char *buf;
- int len;
-{
- if (write(fd, buf, len) != len) {
- warn("failure writing %s", filename);
- close(fd);
- leave("In progress srvtab in this file.", 1);
- }
-}
-
-int
-yn(string)
- char *string;
-{
- char ynbuf[5];
-
- printf("%s (y,n) [y] ", string);
- for (;;) {
- safe_read_stdin("", ynbuf, sizeof(ynbuf));
-
- if ((ynbuf[0] == 'n') || (ynbuf[0] == 'N'))
- return(0);
- else if ((ynbuf[0] == 'y') || (ynbuf[0] == 'Y') || (ynbuf[0] == 0))
- return(1);
- else {
- printf("Please enter 'y' or 'n': ");
- fflush(stdout);
- }
- }
-}
-
-void
-append_srvtab(progname, filename, fd, sname, sinst,
- srealm, key_vno, key)
- char *progname;
- char *filename;
- int fd;
- char *sname;
- char *sinst;
- char *srealm;
- unsigned char key_vno;
- des_cblock key;
-{
- /* Add one to append null */
- safe_write(progname, filename, fd, sname, strlen(sname) + 1);
- safe_write(progname, filename, fd, sinst, strlen(sinst) + 1);
- safe_write(progname, filename, fd, srealm, strlen(srealm) + 1);
- safe_write(progname, filename, fd, (char *)&key_vno, 1);
- safe_write(progname, filename, fd, (char *)key, sizeof(des_cblock));
- fsync(fd);
-}
-
-unsigned short
-get_mode(filename)
- char *filename;
-{
- struct stat statbuf;
- unsigned short mode;
-
- bzero((char *)&statbuf, sizeof(statbuf));
-
- if (stat(filename, &statbuf) < 0)
- mode = SRVTAB_MODE;
- else
- mode = statbuf.st_mode;
-
- return(mode);
-}
-
-int
-main(argc,argv)
- int argc;
- char *argv[];
-{
- char sname[ANAME_SZ]; /* name of service */
- char sinst[INST_SZ]; /* instance of service */
- char srealm[REALM_SZ]; /* realm of service */
- unsigned char key_vno; /* key version number */
- int status; /* general purpose error status */
- des_cblock new_key;
- des_cblock old_key;
- char change_tkt[MAXPATHLEN]; /* Ticket to use for key change */
- char keyfile[MAXPATHLEN]; /* Original keyfile */
- char work_keyfile[MAXPATHLEN]; /* Working copy of keyfile */
- char backup_keyfile[MAXPATHLEN]; /* Backup copy of keyfile */
- unsigned short keyfile_mode; /* Protections on keyfile */
- int work_keyfile_fd = -1; /* Initialize so that */
- int backup_keyfile_fd = -1; /* compiler doesn't complain */
- char local_realm[REALM_SZ]; /* local kerberos realm */
- int i;
- int interactive = FALSE;
- int list = FALSE;
- int change = FALSE;
- int add = FALSE;
- int key = FALSE; /* do we show keys? */
- int arg_entered = FALSE;
- int change_this_key = FALSE;
- char databuf[BUFSIZ];
- int first_printed = FALSE; /* have we printed the first item? */
-
- bzero((char *)sname, sizeof(sname));
- bzero((char *)sinst, sizeof(sinst));
- bzero((char *)srealm, sizeof(srealm));
-
- bzero((char *)change_tkt, sizeof(change_tkt));
- bzero((char *)keyfile, sizeof(keyfile));
- bzero((char *)work_keyfile, sizeof(work_keyfile));
- bzero((char *)backup_keyfile, sizeof(backup_keyfile));
- bzero((char *)local_realm, sizeof(local_realm));
-
- sprintf(change_tkt, "/tmp/tkt_ksrvutil.%d", getpid());
- krb_set_tkt_string(change_tkt);
-
- /* This is used only as a default for adding keys */
- if (krb_get_lrealm(local_realm, 1) != KSUCCESS)
- strcpy(local_realm, KRB_REALM);
-
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-i") == 0)
- interactive++;
- else if (strcmp(argv[i], "-k") == 0)
- key++;
- else if (strcmp(argv[i], "list") == 0) {
- if (arg_entered)
- usage();
- else {
- arg_entered++;
- list++;
- }
- }
- else if (strcmp(argv[i], "change") == 0) {
- if (arg_entered)
- usage();
- else {
- arg_entered++;
- change++;
- }
- }
- else if (strcmp(argv[i], "add") == 0) {
- if (arg_entered)
- usage();
- else {
- arg_entered++;
- add++;
- }
- }
- else if (strcmp(argv[i], "-f") == 0) {
- if (++i == argc)
- usage();
- else
- strcpy(keyfile, argv[i]);
- }
- else
- usage();
- }
-
- if (!arg_entered)
- usage();
-
- if (!keyfile[0])
- strcpy(keyfile, KEYFILE);
-
- strcpy(work_keyfile, keyfile);
- strcpy(backup_keyfile, keyfile);
-
- if (change || add) {
- strcat(work_keyfile, ".work");
- strcat(backup_keyfile, ".old");
-
- copy_keyfile(argv[0], keyfile, backup_keyfile);
- }
-
- if (add)
- copy_keyfile(argv[0], backup_keyfile, work_keyfile);
-
- keyfile_mode = get_mode(keyfile);
-
- if (change || list) {
- if ((backup_keyfile_fd = open(backup_keyfile, O_RDONLY, 0)) < 0) {
- err(1, "unable to read %s", backup_keyfile);
- }
- }
-
- if (change) {
- if ((work_keyfile_fd =
- open(work_keyfile, O_WRONLY | O_CREAT | O_TRUNC,
- SRVTAB_MODE)) < 0) {
- err(1, "unable to write %s", work_keyfile);
- }
- }
- else if (add) {
- if ((work_keyfile_fd =
- open(work_keyfile, O_APPEND | O_WRONLY, SRVTAB_MODE)) < 0) {
- err(1, "unable to append to %s", work_keyfile);
- }
- }
-
- if (change || list) {
- while ((getst(backup_keyfile_fd, sname, SNAME_SZ) > 0) &&
- (getst(backup_keyfile_fd, sinst, INST_SZ) > 0) &&
- (getst(backup_keyfile_fd, srealm, REALM_SZ) > 0) &&
- (read(backup_keyfile_fd, &key_vno, 1) > 0) &&
- (read(backup_keyfile_fd,(char *)old_key,sizeof(old_key)) > 0)) {
- if (list) {
- if (!first_printed) {
- printf(VNO_HEADER);
- printf(PAD);
- if (key) {
- printf(KEY_HEADER);
- printf(PAD);
- }
- printf(PRINC_HEADER);
- first_printed = 1;
- }
- printf(VNO_FORMAT, key_vno);
- printf(PAD);
- if (key) {
- print_key(old_key);
- printf(PAD);
- }
- print_name(sname, sinst, srealm);
- printf("\n");
- }
- else if (change) {
- printf("\nPrincipal: ");
- print_name(sname, sinst, srealm);
- printf("; version %d\n", key_vno);
- if (interactive)
- change_this_key = yn("Change this key?");
- else if (change)
- change_this_key = 1;
- else
- change_this_key = 0;
-
- if (change_this_key)
- printf("Changing to version %d.\n", key_vno + 1);
- else if (change)
- printf("Not changing this key.\n");
-
- if (change_this_key) {
- /*
- * Pick a new key and determine whether or not
- * it is safe to change
- */
- if ((status =
- get_svc_new_key(new_key, sname, sinst,
- srealm, keyfile)) == KADM_SUCCESS)
- key_vno++;
- else {
- bcopy(old_key, new_key, sizeof(new_key));
- com_err(argv[0], status, ": key NOT changed");
- change_this_key = FALSE;
- }
- }
- else
- bcopy(old_key, new_key, sizeof(new_key));
- append_srvtab(argv[0], work_keyfile, work_keyfile_fd,
- sname, sinst, srealm, key_vno, new_key);
- if (key && change_this_key) {
- printf("Old key: ");
- print_key(old_key);
- printf("; new key: ");
- print_key(new_key);
- printf("\n");
- }
- if (change_this_key) {
- if ((status = kadm_change_pw(new_key)) == KADM_SUCCESS) {
- printf("Key changed.\n");
- dest_tkt();
- }
- else {
- com_err(argv[0], status,
- " attempting to change password.");
- dest_tkt();
- /* XXX This knows the format of a keyfile */
- if (lseek(work_keyfile_fd, -9, L_INCR) >= 0) {
- key_vno--;
- safe_write(argv[0], work_keyfile,
- work_keyfile_fd, (char *)&key_vno, 1);
- safe_write(argv[0], work_keyfile, work_keyfile_fd,
- (char *)old_key, sizeof(des_cblock));
- fsync(work_keyfile_fd);
- fprintf(stderr,"Key NOT changed.\n");
- }
- else {
- warn("unable to revert keyfile");
- leave("", 1);
- }
- }
- }
- }
- bzero((char *)old_key, sizeof(des_cblock));
- bzero((char *)new_key, sizeof(des_cblock));
- }
- }
- else if (add) {
- do {
- do {
- safe_read_stdin("Name: ", databuf, sizeof(databuf));
- strncpy(sname, databuf, sizeof(sname) - 1);
- safe_read_stdin("Instance: ", databuf, sizeof(databuf));
- strncpy(sinst, databuf, sizeof(sinst) - 1);
- safe_read_stdin("Realm: ", databuf, sizeof(databuf));
- strncpy(srealm, databuf, sizeof(srealm) - 1);
- safe_read_stdin("Version number: ", databuf, sizeof(databuf));
- key_vno = atoi(databuf);
- if (!srealm[0])
- strcpy(srealm, local_realm);
- printf("New principal: ");
- print_name(sname, sinst, srealm);
- printf("; version %d\n", key_vno);
- } while (!yn("Is this correct?"));
- get_key_from_password(new_key);
- if (key) {
- printf("Key: ");
- print_key(new_key);
- printf("\n");
- }
- append_srvtab(argv[0], work_keyfile, work_keyfile_fd,
- sname, sinst, srealm, key_vno, new_key);
- printf("Key successfully added.\n");
- } while (yn("Would you like to add another key?"));
- }
-
- if (change || list)
- if (close(backup_keyfile_fd) < 0) {
- warn("failure closing %s, continuing", backup_keyfile);
- }
-
- if (change || add) {
- if (close(work_keyfile_fd) < 0) {
- err(1, "failure closing %s", work_keyfile);
- }
- if (rename(work_keyfile, keyfile) < 0) {
- err(1, "failure renaming %s to %s", work_keyfile, keyfile);
- }
- chmod(backup_keyfile, keyfile_mode);
- chmod(keyfile, keyfile_mode);
- printf("Old keyfile in %s.\n", backup_keyfile);
- }
-
- exit(0);
-}
-
-void
-print_key(key)
- des_cblock key;
-{
- int i;
-
- for (i = 0; i < 4; i++)
- printf("%02x", key[i]);
- printf(" ");
- for (i = 4; i < 8; i++)
- printf("%02x", key[i]);
-}
-
-void
-print_name(name, inst, realm)
- char *name;
- char *inst;
- char *realm;
-{
- printf("%s%s%s%s%s", name, inst[0] ? "." : "", inst,
- realm[0] ? "@" : "", realm);
-}
-
-int
-get_svc_new_key(new_key, sname, sinst, srealm, keyfile)
- des_cblock new_key;
- char *sname;
- char *sinst;
- char *srealm;
- char *keyfile;
-{
- int status = KADM_SUCCESS;
-
- if (((status = krb_get_svc_in_tkt(sname, sinst, srealm, PWSERV_NAME,
- KADM_SINST, 1, keyfile)) == KSUCCESS) &&
- ((status = kadm_init_link("changepw", KRB_MASTER, srealm)) ==
- KADM_SUCCESS)) {
-#ifdef NOENCRYPTION
- bzero((char *) new_key, sizeof(des_cblock));
- new_key[0] = (unsigned char) 1;
-#else /* NOENCRYPTION */
- des_random_key(new_key);
-#endif /* NOENCRYPTION */
- return(KADM_SUCCESS);
- }
-
- return(status);
-}
-
-void
-get_key_from_password(key)
- des_cblock key;
-{
- char password[MAX_KPW_LEN]; /* storage for the password */
-
- if (read_long_pw_string(password, sizeof(password)-1, "Password: ", 1))
- leave("Error reading password.", 1);
-
-#ifdef NOENCRYPTION
- bzero((char *) key, sizeof(des_cblock));
- key[0] = (unsigned char) 1;
-#else /* NOENCRYPTION */
- des_string_to_key(password, (des_cblock *)key);
-#endif /* NOENCRYPTION */
- bzero((char *)password, sizeof(password));
-}
-
-void
-usage()
-{
- fprintf(stderr, "Usage: ksrvutil [-f keyfile] [-i] [-k] ");
- fprintf(stderr, "{list | change | add}\n");
- fprintf(stderr, " -i causes the program to ask for ");
- fprintf(stderr, "confirmation before changing keys.\n");
- fprintf(stderr, " -k causes the key to printed for list or ");
- fprintf(stderr, "change.\n");
- exit(1);
-}
-
-void
-leave(str,x)
-char *str;
-int x;
-{
- if (str)
- fprintf(stderr, "%s\n", str);
- dest_tkt();
- exit(x);
-}
diff --git a/eBones/kstash/Makefile b/eBones/kstash/Makefile
deleted file mode 100644
index 1387f8c..0000000
--- a/eBones/kstash/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# From: @(#)Makefile 5.2 (Berkeley) 3/5/91
-# $Id: Makefile,v 1.3 1995/07/18 16:40:14 mark Exp $
-
-PROG= kstash
-CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -Wall
-DPADD= ${LIBKDB} ${LIBKRB}
-LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -ldes
-MAN8= kstash.8
-
-.include <bsd.prog.mk>
diff --git a/eBones/kstash/kstash.8 b/eBones/kstash/kstash.8
deleted file mode 100644
index ac8c57b..0000000
--- a/eBones/kstash/kstash.8
+++ /dev/null
@@ -1,44 +0,0 @@
-.\" from: kstash.8,v 4.1 89/01/23 11:11:39 jtkohl Exp $
-.\" $Id: kstash.8,v 1.1.1.1 1994/09/30 14:50:07 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KSTASH 8 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-kstash \- stash Kerberos key distribution center database master key
-.SH SYNOPSIS
-kstash
-.SH DESCRIPTION
-.I kstash
-saves the Kerberos key distribution center (KDC) database master key in
-the master key cache file.
-.PP
-The user is prompted to enter the key, to verify the authenticity of the
-key and the authorization to store the key in the file.
-.SH DIAGNOSTICS
-.TP 20n
-"verify_master_key: Invalid master key, does not match database."
-The master key string entered was incorrect.
-.TP
-"kstash: Unable to open master key file"
-The attempt to open the cache file for writing failed (probably due to a
-system or access permission error).
-.TP
-"kstash: Write I/O error on master key file"
-The
-.BR write (2)
-system call returned an error while
-.I kstash
-was attempting to write the key to the file.
-.SH FILES
-.TP 20n
-/etc/kerberosIV/principal.db
-DBM file containing database
-.TP
-/etc/kerberosIV/principal.ok
-Semaphore indicating that the DBM database is not being modified.
-.TP
-/etc/kerberosIV/master_key
-Master key cache file.
diff --git a/eBones/kstash/kstash.c b/eBones/kstash/kstash.c
deleted file mode 100644
index ce26a1d..0000000
--- a/eBones/kstash/kstash.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * from: kstash.c,v 4.0 89/01/23 09:45:43 jtkohl Exp $
- * $Id: kstash.c,v 1.3 1995/07/18 16:40:16 mark Exp $
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] =
-"$Id: kstash.c,v 1.3 1995/07/18 16:40:16 mark Exp $";
-#endif lint
-#endif
-
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <signal.h>
-#include <sgtty.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <sys/file.h>
-
-#include <krb.h>
-#include <des.h>
-#include <klog.h>
-#include <prot.h>
-#include <krb_db.h>
-#include <kdc.h>
-
-/* change this later, but krblib_dbm needs it for now */
-char *progname;
-
-static C_Block master_key;
-static Key_schedule master_key_schedule;
-int debug;
-static int kfile;
-static void clear_secrets();
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- long n;
- if ((n = kerb_init())) {
- fprintf(stderr, "Kerberos db and cache init failed = %ld\n", n);
- exit(1);
- }
-
- if (kdb_get_master_key (TRUE, master_key, master_key_schedule) != 0) {
- fprintf (stderr, "%s: Couldn't read master key.\n", argv[0]);
- fflush (stderr);
- clear_secrets();
- exit (-1);
- }
-
- if (kdb_verify_master_key (master_key, master_key_schedule, stderr) < 0) {
- clear_secrets();
- exit (-1);
- }
-
- kfile = open(MKEYFILE, O_TRUNC | O_RDWR | O_CREAT, 0600);
- if (kfile < 0) {
- clear_secrets();
- fprintf(stderr, "\n\07\07%s: Unable to open master key file\n",
- argv[0]);
- exit(1);
- }
- if (write(kfile, (char *) master_key, 8) < 0) {
- clear_secrets();
- fprintf(stderr, "\n%s: Write I/O error on master key file\n",
- argv[0]);
- exit(1);
- }
- (void) close(kfile);
- clear_secrets();
- return(0);
-}
-
-static void
-clear_secrets()
-{
- bzero(master_key_schedule, sizeof(master_key_schedule));
- bzero(master_key, sizeof(master_key));
-}
diff --git a/eBones/libkadm/EXPORTABLE b/eBones/libkadm/EXPORTABLE
deleted file mode 100644
index e478483..0000000
--- a/eBones/libkadm/EXPORTABLE
+++ /dev/null
@@ -1,4 +0,0 @@
-The files in this directory are believed to be exportable.
-
--GAWollman
-
diff --git a/eBones/libkadm/Makefile b/eBones/libkadm/Makefile
deleted file mode 100644
index 293e842..0000000
--- a/eBones/libkadm/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-# $Id: Makefile,v 1.1 1995/07/18 16:40:20 mark Exp $
-
-LIB= kadm
-
-SRCS= kadm_err.c kadm_stream.c kadm_supp.c kadm_cli_wrap.c
-CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/../include -I${KRBOBJDIR} \
- -DPOSIX -Wall
-CLEANFILES+= kadm_err.c kadm_err.h
-
-kadm_err.c kadm_err.h: kadm_err.et
- test -e kadm_err.et || ln -s ${.CURDIR}/kadm_err.et .
- compile_et kadm_err.et
-
-beforeinstall:
- -cd ${.CURDIR}; cmp -s kadm.h \
- ${DESTDIR}/usr/include/kerberosIV/kadm.h || \
- install -c -o ${BINOWN} -g ${BINGRP} -m 444 kadm.h \
- ${DESTDIR}/usr/include/kerberosIV
- -cd ${.OBJDIR}; cmp -s kadm_err.h \
- ${DESTDIR}/usr/include/kerberosIV/kadm_err.h || \
- install -c -o ${BINOWN} -g ${BINGRP} -m 444 kadm_err.h \
- ${DESTDIR}/usr/include/kerberosIV
-
-.include <bsd.lib.mk>
diff --git a/eBones/libkadm/kadm.h b/eBones/libkadm/kadm.h
deleted file mode 100644
index 21a23bb..0000000
--- a/eBones/libkadm/kadm.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * $Source: /usr/cvs/src/eBones/libkadm/kadm.h,v $
- * $Author: mark $
- * Header: /afs/athena.mit.edu/astaff/project/kerberos/src/include/RCS/kadm.h,v 4.2 89/09/26 09:15:20 jtkohl Exp
- *
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * Copyright.MIT.
- *
- * Definitions for Kerberos administration server & client
- */
-
-#ifndef KADM_DEFS
-#define KADM_DEFS
-
-/*
- * kadm.h
- * Header file for the fourth attempt at an admin server
- * Doug Church, December 28, 1989, MIT Project Athena
- */
-
-/* for those broken Unixes without this defined... should be in sys/param.h */
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 64
-#endif
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <krb.h>
-#include <krb_db.h>
-#include <des.h>
-
-/* The global structures for the client and server */
-typedef struct {
- struct sockaddr_in admin_addr;
- struct sockaddr_in my_addr;
- int my_addr_len;
- int admin_fd; /* file descriptor for link to admin server */
- char sname[ANAME_SZ]; /* the service name */
- char sinst[INST_SZ]; /* the services instance */
- char krbrlm[REALM_SZ];
-} Kadm_Client;
-
-typedef struct { /* status of the server, i.e the parameters */
- int inter; /* Space for command line flags */
- char *sysfile; /* filename of server */
-} admin_params; /* Well... it's the admin's parameters */
-
-/* Largest password length to be supported */
-#define MAX_KPW_LEN 128
-
-/* Largest packet the admin server will ever allow itself to return */
-#define KADM_RET_MAX 2048
-
-/* That's right, versions are 8 byte strings */
-#define KADM_VERSTR "KADM0.0A"
-#define KADM_ULOSE "KYOULOSE" /* sent back when server can't
- decrypt client's msg */
-#define KADM_VERSIZE strlen(KADM_VERSTR)
-
-/* the lookups for the server instances */
-#define PWSERV_NAME "changepw"
-#define KADM_SNAME "kerberos_master"
-#define KADM_SINST "kerberos"
-
-/* Attributes fields constants and macros */
-#define ALLOC 2
-#define RESERVED 3
-#define DEALLOC 4
-#define DEACTIVATED 5
-#define ACTIVE 6
-
-/* Kadm_vals structure for passing db fields into the server routines */
-#define FLDSZ 4
-
-typedef struct {
- u_char fields[FLDSZ]; /* The active fields in this struct */
- char name[ANAME_SZ];
- char instance[INST_SZ];
- unsigned long key_low;
- unsigned long key_high;
- unsigned long exp_date;
- unsigned short attributes;
- unsigned char max_life;
-} Kadm_vals; /* The basic values structure in Kadm */
-
-/* Kadm_vals structure for passing db fields into the server routines */
-#define FLDSZ 4
-
-/* Need to define fields types here */
-#define KADM_NAME 31
-#define KADM_INST 30
-#define KADM_EXPDATE 29
-#define KADM_ATTR 28
-#define KADM_MAXLIFE 27
-#define KADM_DESKEY 26
-
-/* To set a field entry f in a fields structure d */
-#define SET_FIELD(f,d) (d[3-(f/8)]|=(1<<(f%8)))
-
-/* To set a field entry f in a fields structure d */
-#define CLEAR_FIELD(f,d) (d[3-(f/8)]&=(~(1<<(f%8))))
-
-/* Is field f in fields structure d */
-#define IS_FIELD(f,d) (d[3-(f/8)]&(1<<(f%8)))
-
-/* Various return codes */
-#define KADM_SUCCESS 0
-
-#define WILDCARD_STR "*"
-
-enum acl_types {
-ADDACL,
-GETACL,
-MODACL
-};
-
-/* Various opcodes for the admin server's functions */
-#define CHANGE_PW 2
-#define ADD_ENT 3
-#define MOD_ENT 4
-#define GET_ENT 5
-
-/* XXX This doesn't belong here!!! */
-#ifdef POSIX
-typedef void sigtype;
-#else
-typedef int sigtype;
-#endif
-
-int vals_to_stream(Kadm_vals *dt_in, u_char **dt_out);
-int stream_to_vals(u_char *dt_in, Kadm_vals *dt_out, int maxlen);
-
-int build_field_header(u_char *cont, u_char **st);
-int check_field_header(u_char *st, u_char *cont, int maxlen);
-
-int stv_string(u_char *st, char *dat, int loc, int stlen, int maxlen);
-int stv_short(u_char *st, u_short *dat, int loc, int maxlen);
-int stv_long(u_char *st, u_long *dat, int loc, int maxlen);
-int stv_char(u_char *st, u_char *dat, int loc, int maxlen);
-
-int vts_string(char *dat, u_char **st, int loc);
-int vts_short(u_short dat, u_char **st, int loc);
-int vts_long(u_long dat, u_char **st, int loc);
-int vts_char(u_char dat, u_char **st, int loc);
-
-int kadm_cli_conn(void);
-void kadm_cli_disconn(void);
-int kadm_cli_send(u_char *st_dat, int st_siz, u_char **ret_dat, int *ret_siz);
-int kadm_cli_out(u_char *dat, int dat_len, u_char **ret_dat, int *ret_siz);
-int kadm_cli_keyd(des_cblock s_k, des_key_schedule s_s);
-
-int kadm_get(Kadm_vals *vals, u_char fl[4]);
-int kadm_mod(Kadm_vals *vals1, Kadm_vals *vals2);
-int kadm_add(Kadm_vals *vals);
-int kadm_change_pw(des_cblock newkey);
-int kadm_init_link(char n[], char i[], char r[]);
-void prin_vals(Kadm_vals *vals);
-void kadm_vals_to_prin(u_char fields[FLDSZ], Principal *new, Kadm_vals *old);
-void kadm_prin_to_vals(u_char fields[FLDSZ], Kadm_vals *new, Principal *old);
-
-#endif KADM_DEFS
diff --git a/eBones/libkadm/kadm_cli_wrap.c b/eBones/libkadm/kadm_cli_wrap.c
deleted file mode 100644
index e25439d..0000000
--- a/eBones/libkadm/kadm_cli_wrap.c
+++ /dev/null
@@ -1,509 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * Copyright.MIT.
- *
- * Kerberos administration server client-side routines
- */
-
-#if 0
-#ifndef lint
-static char rcsid_kadm_cli_wrap_c[] =
-"from: Id: kadm_cli_wrap.c,v 4.6 89/12/30 20:09:45 qjb Exp";
-static const char rcsid[] =
- "$Id: kadm_cli_wrap.c,v 1.1 1995/07/18 16:40:23 mark Exp $";
-#endif lint
-#endif
-
-/*
- * kadm_cli_wrap.c the client side wrapping of the calls to the admin server
- */
-
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <signal.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <kadm.h>
-#include <kadm_err.h>
-#include <krb_err.h>
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-static Kadm_Client client_parm;
-
-/* Macros for use in returning data... used in kadm_cli_send */
-#define RET_N_FREE(r) {clear_secrets(); free((char *)act_st); free((char *)priv_pak); return r;}
-
-/* Keys for use in the transactions */
-static des_cblock sess_key; /* to be filled in by kadm_cli_keyd */
-static Key_schedule sess_sched;
-
-static void
-clear_secrets()
-{
- bzero((char *)sess_key, sizeof(sess_key));
- bzero((char *)sess_sched, sizeof(sess_sched));
-}
-
-/*
- * kadm_init_link
- * receives : name, inst, realm
- *
- * initializes client parm, the Kadm_Client structure which holds the
- * data about the connection between the server and client, the services
- * used, the locations and other fun things
- */
-int
-kadm_init_link(n, i, r)
-char n[];
-char i[];
-char r[];
-{
- struct servent *sep; /* service we will talk to */
- struct hostent *hop; /* host we will talk to */
- char adm_hostname[MAXHOSTNAMELEN];
-
- (void) init_kadm_err_tbl();
- (void) init_krb_err_tbl();
- (void) strcpy(client_parm.sname, n);
- (void) strcpy(client_parm.sinst, i);
- (void) strcpy(client_parm.krbrlm, r);
- client_parm.admin_fd = -1;
-
- /* set up the admin_addr - fetch name of admin host */
- if (krb_get_admhst(adm_hostname, client_parm.krbrlm, 1) != KSUCCESS)
- return KADM_NO_HOST;
- if ((hop = gethostbyname(adm_hostname)) == NULL)
- return KADM_UNK_HOST; /* couldnt find the admin servers
- * address */
- if ((sep = getservbyname(KADM_SNAME, "tcp")) == NULL)
- return KADM_NO_SERV; /* couldnt find the admin service */
- bzero((char *) &client_parm.admin_addr,
- sizeof(client_parm.admin_addr));
- client_parm.admin_addr.sin_family = hop->h_addrtype;
- bcopy((char *) hop->h_addr, (char *) &client_parm.admin_addr.sin_addr,
- hop->h_length);
- client_parm.admin_addr.sin_port = sep->s_port;
-
- return KADM_SUCCESS;
-} /* procedure kadm_init_link */
-
-/*
- * kadm_change_pw
- * recieves : key
- *
- * Replaces the password (i.e. des key) of the caller with that specified in
- * key. Returns no actual data from the master server, since this is called
- * by a user
- */
-int
-kadm_change_pw(newkey)
-des_cblock newkey; /* The DES form of the users key */
-{
- int stsize, retc; /* stream size and return code */
- u_char *send_st; /* send stream */
- u_char *ret_st;
- int ret_sz;
- u_long keytmp;
-
- if ((retc = kadm_cli_conn()) != KADM_SUCCESS)
- return(retc);
- /* possible problem with vts_long on a non-multiple of four boundary */
-
- stsize = 0; /* start of our output packet */
- send_st = (u_char *) malloc(1);/* to make it reallocable */
- send_st[stsize++] = (u_char) CHANGE_PW;
-
- /* change key to stream */
-
- bcopy((char *) (((long *) newkey) + 1), (char *) &keytmp, 4);
- keytmp = htonl(keytmp);
- stsize += vts_long(keytmp, &send_st, stsize);
-
- bcopy((char *) newkey, (char *) &keytmp, 4);
- keytmp = htonl(keytmp);
- stsize += vts_long(keytmp, &send_st, stsize);
-
- retc = kadm_cli_send(send_st, stsize, &ret_st, &ret_sz);
- free((char *)send_st);
- if (retc == KADM_SUCCESS) {
- free((char *)ret_st);
- }
- kadm_cli_disconn();
- return(retc);
-}
-
-/*
- * kadm_add
- * receives : vals
- * returns : vals
- *
- * Adds and entry containing values to the database returns the values of the
- * entry, so if you leave certain fields blank you will be able to determine
- * the default values they are set to
- */
-int
-kadm_add(vals)
-Kadm_vals *vals;
-{
- u_char *st, *st2; /* st will hold the stream of values */
- int st_len; /* st2 the final stream with opcode */
- int retc; /* return code from call */
- u_char *ret_st;
- int ret_sz;
-
- if ((retc = kadm_cli_conn()) != KADM_SUCCESS)
- return(retc);
- st_len = vals_to_stream(vals, &st);
- st2 = (u_char *) malloc((unsigned)(1 + st_len));
- *st2 = (u_char) ADD_ENT; /* here's the opcode */
- bcopy((char *) st, (char *) st2 + 1, st_len); /* append st on */
- retc = kadm_cli_send(st2, st_len + 1, &ret_st, &ret_sz);
- free((char *)st);
- free((char *)st2);
- if (retc == KADM_SUCCESS) {
- /* ret_st has vals */
- if (stream_to_vals(ret_st, vals, ret_sz) < 0)
- retc = KADM_LENGTH_ERROR;
- free((char *)ret_st);
- }
- kadm_cli_disconn();
- return(retc);
-}
-
-/*
- * kadm_mod
- * receives : KTEXT, {values, values}
- * returns : CKSUM, RETCODE, {values}
- * acl : su, sms (as register or dealloc)
- *
- * Modifies all entries corresponding to the first values so they match the
- * second values. returns the values for the changed entries in vals2
- */
-int
-kadm_mod(vals1, vals2)
-Kadm_vals *vals1;
-Kadm_vals *vals2;
-{
- u_char *st, *st2; /* st will hold the stream of values */
- int st_len, nlen; /* st2 the final stream with opcode */
- u_char *ret_st;
- int ret_sz;
-
- /* nlen is the length of second vals */
- int retc; /* return code from call */
-
- if ((retc = kadm_cli_conn()) != KADM_SUCCESS)
- return(retc);
-
- st_len = vals_to_stream(vals1, &st);
- st2 = (u_char *) malloc((unsigned)(1 + st_len));
- *st2 = (u_char) MOD_ENT; /* here's the opcode */
- bcopy((char *) st, (char *) st2 + 1, st_len++); /* append st on */
- free((char *)st);
- nlen = vals_to_stream(vals2, &st);
- st2 = (u_char *) realloc((char *) st2, (unsigned)(st_len + nlen));
- bcopy((char *) st, (char *) st2 + st_len, nlen); /* append st on */
- retc = kadm_cli_send(st2, st_len + nlen, &ret_st, &ret_sz);
- free((char *)st);
- free((char *)st2);
- if (retc == KADM_SUCCESS) {
- /* ret_st has vals */
- if (stream_to_vals(ret_st, vals2, ret_sz) < 0)
- retc = KADM_LENGTH_ERROR;
- free((char *)ret_st);
- }
- kadm_cli_disconn();
- return(retc);
-}
-
-/*
- * kadm_get
- * receives : KTEXT, {values, flags}
- * returns : CKSUM, RETCODE, {count, values, values, values}
- * acl : su
- *
- * gets the fields requested by flags from all entries matching values returns
- * this data for each matching recipient, after a count of how many such
- * matches there were
- */
-int
-kadm_get(vals, fl)
-Kadm_vals *vals;
-u_char fl[4];
-
-{
- int loop; /* for copying the fields data */
- u_char *st, *st2; /* st will hold the stream of values */
- int st_len; /* st2 the final stream with opcode */
- int retc; /* return code from call */
- u_char *ret_st;
- int ret_sz;
-
- if ((retc = kadm_cli_conn()) != KADM_SUCCESS)
- return(retc);
- st_len = vals_to_stream(vals, &st);
- st2 = (u_char *) malloc((unsigned)(1 + st_len + FLDSZ));
- *st2 = (u_char) GET_ENT; /* here's the opcode */
- bcopy((char *) st, (char *) st2 + 1, st_len); /* append st on */
- for (loop = FLDSZ - 1; loop >= 0; loop--)
- *(st2 + st_len + FLDSZ - loop) = fl[loop]; /* append the flags */
- retc = kadm_cli_send(st2, st_len + 1 + FLDSZ, &ret_st, &ret_sz);
- free((char *)st);
- free((char *)st2);
- if (retc == KADM_SUCCESS) {
- /* ret_st has vals */
- if (stream_to_vals(ret_st, vals, ret_sz) < 0)
- retc = KADM_LENGTH_ERROR;
- free((char *)ret_st);
- }
- kadm_cli_disconn();
- return(retc);
-}
-
-/*
- * kadm_cli_send
- * recieves : opcode, packet, packet length, serv_name, serv_inst
- * returns : return code from the packet build, the server, or
- * something else
- *
- * It assembles a packet as follows:
- * 8 bytes : VERSION STRING
- * 4 bytes : LENGTH OF MESSAGE DATA and OPCODE
- * : KTEXT
- * : OPCODE \
- * : DATA > Encrypted (with make priv)
- * : ...... /
- *
- * If it builds the packet and it is small enough, then it attempts to open the
- * connection to the admin server. If the connection is succesfully open
- * then it sends the data and waits for a reply.
- */
-int
-kadm_cli_send(st_dat, st_siz, ret_dat, ret_siz)
-u_char *st_dat; /* the actual data */
-int st_siz; /* length of said data */
-u_char **ret_dat; /* to give return info */
-int *ret_siz; /* length of returned info */
-{
- int act_len, retdat; /* current offset into packet, return
- * data */
- KTEXT_ST authent; /* the authenticator we will build */
- u_char *act_st; /* the pointer to the complete packet */
- u_char *priv_pak; /* private version of the packet */
- int priv_len; /* length of private packet */
- u_long cksum; /* checksum of the packet */
- MSG_DAT mdat;
- u_char *return_dat;
-
- act_st = (u_char *) malloc(KADM_VERSIZE); /* verstr stored first */
- (void) strncpy((char *)act_st, KADM_VERSTR, KADM_VERSIZE);
- act_len = KADM_VERSIZE;
-
- if ((retdat = kadm_cli_keyd(sess_key, sess_sched)) != KADM_SUCCESS) {
- free((char *)act_st);
- return retdat; /* couldnt get key working */
- }
- priv_pak = (u_char *) malloc((unsigned)(st_siz + 200));
- /* 200 bytes for extra info case */
- if ((priv_len = krb_mk_priv(st_dat, priv_pak, (u_long)st_siz,
- sess_sched, sess_key, &client_parm.my_addr,
- &client_parm.admin_addr)) < 0)
- RET_N_FREE(KADM_NO_ENCRYPT); /* whoops... we got a lose
- * here */
- /* here is the length of priv data. receiver calcs
- size of authenticator by subtracting vno size, priv size, and
- sizeof(u_long) (for the size indication) from total size */
-
- act_len += vts_long((u_long) priv_len, &act_st, act_len);
-#ifdef NOENCRYPTION
- cksum = 0;
-#else
- cksum = quad_cksum((des_cblock *)priv_pak, (des_cblock *)0,
- (long)priv_len, 0, (des_cblock *)sess_key);
-#endif
- if ((retdat = krb_mk_req(&authent, client_parm.sname, client_parm.sinst,
- client_parm.krbrlm, (long)cksum))) {
- /* authenticator? */
- RET_N_FREE(retdat + krb_err_base);
- }
-
- act_st = (u_char *) realloc((char *) act_st,
- (unsigned) (act_len + authent.length
- + priv_len));
- if (!act_st) {
- clear_secrets();
- free((char *)priv_pak);
- return(KADM_NOMEM);
- }
- bcopy((char *) authent.dat, (char *) act_st + act_len, authent.length);
- bcopy((char *) priv_pak, (char *) act_st + act_len + authent.length,
- priv_len);
- free((char *)priv_pak);
- if ((retdat = kadm_cli_out(act_st,
- act_len + authent.length + priv_len,
- ret_dat, ret_siz)) != KADM_SUCCESS)
- RET_N_FREE(retdat);
- free((char *)act_st);
-#define RET_N_FREE2(r) {free((char *)*ret_dat); clear_secrets(); return(r);}
-
- /* first see if it's a YOULOUSE */
- if ((*ret_siz >= KADM_VERSIZE) &&
- !strncmp(KADM_ULOSE, (char *)*ret_dat, KADM_VERSIZE)) {
- u_long errcode;
- /* it's a youlose packet */
- if (*ret_siz < KADM_VERSIZE + sizeof(u_long))
- RET_N_FREE2(KADM_BAD_VER);
- bcopy((char *)(*ret_dat) + KADM_VERSIZE, (char *)&errcode,
- sizeof(u_long));
- retdat = (int) ntohl(errcode);
- RET_N_FREE2(retdat);
- }
- /* need to decode the ret_dat */
- if ((retdat = krb_rd_priv(*ret_dat, (u_long)*ret_siz, sess_sched,
- sess_key, &client_parm.admin_addr,
- &client_parm.my_addr, &mdat)))
- RET_N_FREE2(retdat+krb_err_base);
- if (mdat.app_length < KADM_VERSIZE + 4)
- /* too short! */
- RET_N_FREE2(KADM_BAD_VER);
- if (strncmp((char *)mdat.app_data, KADM_VERSTR, KADM_VERSIZE))
- /* bad version */
- RET_N_FREE2(KADM_BAD_VER);
- bcopy((char *)mdat.app_data+KADM_VERSIZE,
- (char *)&retdat, sizeof(u_long));
- retdat = ntohl((u_long)retdat);
- if (!(return_dat = (u_char *)malloc((unsigned)(mdat.app_length -
- KADM_VERSIZE - sizeof(u_long)))))
- RET_N_FREE2(KADM_NOMEM);
- bcopy((char *) mdat.app_data + KADM_VERSIZE + sizeof(u_long),
- (char *)return_dat,
- (int)mdat.app_length - KADM_VERSIZE - sizeof(u_long));
- free((char *)*ret_dat);
- clear_secrets();
- *ret_dat = return_dat;
- *ret_siz = mdat.app_length - KADM_VERSIZE - sizeof(u_long);
- return retdat;
-}
-
-/* takes in the sess_key and key_schedule and sets them appropriately */
-int
-kadm_cli_keyd(s_k, s_s)
-des_cblock s_k; /* session key */
-des_key_schedule s_s; /* session key schedule */
-{
- CREDENTIALS cred; /* to get key data */
- int stat;
-
- /* want .sname and .sinst here.... */
- if ((stat = krb_get_cred(client_parm.sname, client_parm.sinst,
- client_parm.krbrlm, &cred)))
- return stat + krb_err_base;
- bcopy((char *) cred.session, (char *) s_k, sizeof(des_cblock));
- bzero((char *) cred.session, sizeof(des_cblock));
-#ifdef NOENCRYPTION
- bzero(s_s, sizeof(des_key_schedule));
-#else
- if ((stat = key_sched((des_cblock *)s_k,s_s)))
- return(stat+krb_err_base);
-#endif
- return KADM_SUCCESS;
-} /* This code "works" */
-
-static sigtype (*opipe)();
-
-int
-kadm_cli_conn()
-{ /* this connects and sets my_addr */
- int on = 1;
-
- if ((client_parm.admin_fd =
- socket(client_parm.admin_addr.sin_family, SOCK_STREAM,0)) < 0)
- return KADM_NO_SOCK; /* couldnt create the socket */
- if (connect(client_parm.admin_fd,
- (struct sockaddr *) & client_parm.admin_addr,
- sizeof(client_parm.admin_addr))) {
- (void) close(client_parm.admin_fd);
- client_parm.admin_fd = -1;
- return KADM_NO_CONN; /* couldnt get the connect */
- }
- opipe = signal(SIGPIPE, SIG_IGN);
- client_parm.my_addr_len = sizeof(client_parm.my_addr);
- if (getsockname(client_parm.admin_fd,
- (struct sockaddr *) & client_parm.my_addr,
- &client_parm.my_addr_len) < 0) {
- (void) close(client_parm.admin_fd);
- client_parm.admin_fd = -1;
- (void) signal(SIGPIPE, opipe);
- return KADM_NO_HERE; /* couldnt find out who we are */
- }
- if (setsockopt(client_parm.admin_fd, SOL_SOCKET, SO_KEEPALIVE, &on,
- sizeof(on)) < 0) {
- (void) close(client_parm.admin_fd);
- client_parm.admin_fd = -1;
- (void) signal(SIGPIPE, opipe);
- return KADM_NO_CONN; /* XXX */
- }
- return KADM_SUCCESS;
-}
-
-void
-kadm_cli_disconn()
-{
- (void) close(client_parm.admin_fd);
- (void) signal(SIGPIPE, opipe);
-}
-
-int
-kadm_cli_out(dat, dat_len, ret_dat, ret_siz)
-u_char *dat;
-int dat_len;
-u_char **ret_dat;
-int *ret_siz;
-{
- extern int errno;
- u_short dlen;
- int retval;
-
- dlen = (u_short) dat_len;
-
- if (dat_len != (int)dlen)
- return (KADM_NO_ROOM);
-
- dlen = htons(dlen);
- if (krb_net_write(client_parm.admin_fd, (char *) &dlen,
- sizeof(u_short)) < 0)
- return (errno); /* XXX */
-
- if (krb_net_write(client_parm.admin_fd, (char *) dat, dat_len) < 0)
- return (errno); /* XXX */
-
- if ((retval = krb_net_read(client_parm.admin_fd, (char *) &dlen,
- sizeof(u_short)) != sizeof(u_short))) {
- if (retval < 0)
- return(errno); /* XXX */
- else
- return(EPIPE); /* short read ! */
- }
-
- dlen = ntohs(dlen);
- *ret_dat = (u_char *)malloc((unsigned)dlen);
- if (!*ret_dat)
- return(KADM_NOMEM);
-
- if ((retval = krb_net_read(client_parm.admin_fd, (char *) *ret_dat,
- (int) dlen) != dlen)) {
- if (retval < 0)
- return(errno); /* XXX */
- else
- return(EPIPE); /* short read ! */
- }
- *ret_siz = (int) dlen;
- return KADM_SUCCESS;
-}
diff --git a/eBones/libkadm/kadm_err.et b/eBones/libkadm/kadm_err.et
deleted file mode 100644
index e45a9c2..0000000
--- a/eBones/libkadm/kadm_err.et
+++ /dev/null
@@ -1,53 +0,0 @@
-# $Source: /usr/cvs/src/eBones/libkadm/kadm_err.et,v $
-# $Author: mark $
-# $Header: /usr/cvs/src/eBones/libkadm/kadm_err.et,v 1.1 1995/07/18 16:40:25 mark Exp $
-# Copyright 1988 by the Massachusetts Institute of Technology.
-#
-# For copying and distribution information, please see the file
-# <mit-copyright.h>.
-#
-# Kerberos administration server error table
-#
- et kadm
-
-# KADM_SUCCESS, as all success codes should be, is zero
-
-ec KADM_RCSID, "$Header: /usr/cvs/src/eBones/libkadm/kadm_err.et,v 1.1 1995/07/18 16:40:25 mark Exp $"
-# /* Building and unbuilding the packet errors */
-ec KADM_NO_REALM, "Cannot fetch local realm"
-ec KADM_NO_CRED, "Unable to fetch credentials"
-ec KADM_BAD_KEY, "Bad key supplied"
-ec KADM_NO_ENCRYPT, "Can't encrypt data"
-ec KADM_NO_AUTH, "Cannot encode/decode authentication info"
-ec KADM_WRONG_REALM, "Principal attemping change is in wrong realm"
-ec KADM_NO_ROOM, "Packet is too large"
-ec KADM_BAD_VER, "Version number is incorrect"
-ec KADM_BAD_CHK, "Checksum does not match"
-ec KADM_NO_READ, "Unsealing private data failed"
-ec KADM_NO_OPCODE, "Unsupported operation"
-ec KADM_NO_HOST, "Could not find administrating host"
-ec KADM_UNK_HOST, "Administrating host name is unknown"
-ec KADM_NO_SERV, "Could not find service name in services database"
-ec KADM_NO_SOCK, "Could not create socket"
-ec KADM_NO_CONN, "Could not connect to server"
-ec KADM_NO_HERE, "Could not fetch local socket address"
-ec KADM_NO_MAST, "Could not fetch master key"
-ec KADM_NO_VERI, "Could not verify master key"
-
-# /* From the server side routines */
-ec KADM_INUSE, "Entry already exists in database"
-ec KADM_UK_SERROR, "Database store error"
-ec KADM_UK_RERROR, "Database read error"
-ec KADM_UNAUTH, "Insufficient access to perform requested operation"
-# KADM_DATA isn't really an error, but...
-ec KADM_DATA, "Data is available for return to client"
-ec KADM_NOENTRY, "No such entry in the database"
-
-ec KADM_NOMEM, "Memory exhausted"
-ec KADM_NO_HOSTNAME, "Could not fetch system hostname"
-ec KADM_NO_BIND, "Could not bind port"
-ec KADM_LENGTH_ERROR, "Length mismatch problem"
-ec KADM_ILL_WILDCARD, "Illegal use of wildcard"
-
-ec KADM_DB_INUSE, "Database is locked or in use--try again later"
-end
diff --git a/eBones/libkadm/kadm_stream.c b/eBones/libkadm/kadm_stream.c
deleted file mode 100644
index 58a625a..0000000
--- a/eBones/libkadm/kadm_stream.c
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * Copyright.MIT.
- *
- * Stream conversion functions for Kerberos administration server
- */
-
-#if 0
-#ifndef lint
-static char rcsid_kadm_stream_c[] =
-"Header: /afs/athena.mit.edu/astaff/project/kerberos/src/lib/kadm/RCS/kadm_stream.c,v 4.2 89/09/26 09:20:48 jtkohl Exp ";
-static const char rcsid[] =
- "$Id: kadm_stream.c,v 1.1 1995/07/18 16:40:27 mark Exp $";
-#endif lint
-#endif
-
-/*
- kadm_stream.c
- this holds the stream support routines for the kerberos administration server
-
- vals_to_stream: converts a vals struct to a stream for transmission
- internals build_field_header, vts_[string, char, long, short]
- stream_to_vals: converts a stream to a vals struct
- internals check_field_header, stv_[string, char, long, short]
- error: prints out a kadm error message, returns
- fatal: prints out a kadm fatal error message, exits
-*/
-
-#include <string.h>
-#include <kadm.h>
-
-#define min(a,b) (((a) < (b)) ? (a) : (b))
-
-/*
-vals_to_stream
- recieves : kadm_vals *, u_char *
- returns : a realloced and filled in u_char *
-
-this function creates a byte-stream representation of the kadm_vals structure
-*/
-
-int
-vals_to_stream(dt_in, dt_out)
-Kadm_vals *dt_in;
-u_char **dt_out;
-{
- int vsloop, stsize; /* loop counter, stream size */
-
- stsize = build_field_header(dt_in->fields, dt_out);
- for (vsloop=31; vsloop>=0; vsloop--)
- if (IS_FIELD(vsloop,dt_in->fields)) {
- switch (vsloop) {
- case KADM_NAME:
- stsize+=vts_string(dt_in->name, dt_out, stsize);
- break;
- case KADM_INST:
- stsize+=vts_string(dt_in->instance, dt_out, stsize);
- break;
- case KADM_EXPDATE:
- stsize+=vts_long(dt_in->exp_date, dt_out, stsize);
- break;
- case KADM_ATTR:
- stsize+=vts_short(dt_in->attributes, dt_out, stsize);
- break;
- case KADM_MAXLIFE:
- stsize+=vts_char(dt_in->max_life, dt_out, stsize);
- break;
- case KADM_DESKEY:
- stsize+=vts_long(dt_in->key_high, dt_out, stsize);
- stsize+=vts_long(dt_in->key_low, dt_out, stsize);
- break;
- default:
- break;
- }
-}
- return(stsize);
-}
-
-int
-build_field_header(cont, st)
-u_char *cont; /* container for fields data */
-u_char **st; /* stream */
-{
- *st = (u_char *) malloc (4);
- bcopy((char *) cont, (char *) *st, 4);
- return 4; /* return pointer to current stream location */
-}
-
-int
-vts_string(dat, st, loc)
-char *dat; /* a string to put on the stream */
-u_char **st; /* base pointer to the stream */
-int loc; /* offset into the stream for current data */
-{
- *st = (u_char *) realloc ((char *)*st, (unsigned) (loc + strlen(dat) + 1));
- bcopy(dat, (char *)(*st + loc), strlen(dat)+1);
- return strlen(dat)+1;
-}
-
-int
-vts_short(dat, st, loc)
-u_short dat; /* the attributes field */
-u_char **st; /* a base pointer to the stream */
-int loc; /* offset into the stream for current data */
-{
- u_short temp; /* to hold the net order short */
-
- temp = htons(dat); /* convert to network order */
- *st = (u_char *) realloc ((char *)*st, (unsigned)(loc + sizeof(u_short)));
- bcopy((char *) &temp, (char *)(*st + loc), sizeof(u_short));
- return sizeof(u_short);
-}
-
-int
-vts_long(dat, st, loc)
-u_long dat; /* the attributes field */
-u_char **st; /* a base pointer to the stream */
-int loc; /* offset into the stream for current data */
-{
- u_long temp; /* to hold the net order short */
-
- temp = htonl(dat); /* convert to network order */
- *st = (u_char *) realloc ((char *)*st, (unsigned)(loc + sizeof(u_long)));
- bcopy((char *) &temp, (char *)(*st + loc), sizeof(u_long));
- return sizeof(u_long);
-}
-
-int
-vts_char(dat, st, loc)
-u_char dat; /* the attributes field */
-u_char **st; /* a base pointer to the stream */
-int loc; /* offset into the stream for current data */
-{
- *st = (u_char *) realloc ((char *)*st, (unsigned)(loc + sizeof(u_char)));
- (*st)[loc] = (u_char) dat;
- return 1;
-}
-
-/*
-stream_to_vals
- recieves : u_char *, kadm_vals *
- returns : a kadm_vals filled in according to u_char *
-
-this decodes a byte stream represntation of a vals struct into kadm_vals
-*/
-int
-stream_to_vals(dt_in, dt_out, maxlen)
-u_char *dt_in;
-Kadm_vals *dt_out;
-int maxlen; /* max length to use */
-{
- register int vsloop, stsize; /* loop counter, stream size */
- register int status;
-
- bzero((char *) dt_out, sizeof(*dt_out));
-
- stsize = check_field_header(dt_in, dt_out->fields, maxlen);
- if (stsize < 0)
- return(-1);
- for (vsloop=31; vsloop>=0; vsloop--)
- if (IS_FIELD(vsloop,dt_out->fields))
- switch (vsloop) {
- case KADM_NAME:
- if ((status = stv_string(dt_in, dt_out->name, stsize,
- sizeof(dt_out->name), maxlen)) < 0)
- return(-1);
- stsize += status;
- break;
- case KADM_INST:
- if ((status = stv_string(dt_in, dt_out->instance, stsize,
- sizeof(dt_out->instance), maxlen)) < 0)
- return(-1);
- stsize += status;
- break;
- case KADM_EXPDATE:
- if ((status = stv_long(dt_in, &dt_out->exp_date, stsize,
- maxlen)) < 0)
- return(-1);
- stsize += status;
- break;
- case KADM_ATTR:
- if ((status = stv_short(dt_in, &dt_out->attributes, stsize,
- maxlen)) < 0)
- return(-1);
- stsize += status;
- break;
- case KADM_MAXLIFE:
- if ((status = stv_char(dt_in, &dt_out->max_life, stsize,
- maxlen)) < 0)
- return(-1);
- stsize += status;
- break;
- case KADM_DESKEY:
- if ((status = stv_long(dt_in, &dt_out->key_high, stsize,
- maxlen)) < 0)
- return(-1);
- stsize += status;
- if ((status = stv_long(dt_in, &dt_out->key_low, stsize,
- maxlen)) < 0)
- return(-1);
- stsize += status;
- break;
- default:
- break;
- }
- return stsize;
-}
-
-int
-check_field_header(st, cont, maxlen)
-u_char *st; /* stream */
-u_char *cont; /* container for fields data */
-int maxlen;
-{
- if (4 > maxlen)
- return(-1);
- bcopy((char *) st, (char *) cont, 4);
- return 4; /* return pointer to current stream location */
-}
-
-int
-stv_string(st, dat, loc, stlen, maxlen)
-register u_char *st; /* base pointer to the stream */
-char *dat; /* a string to read from the stream */
-register int loc; /* offset into the stream for current data */
-int stlen; /* max length of string to copy in */
-int maxlen; /* max length of input stream */
-{
- int maxcount; /* max count of chars to copy */
-
- maxcount = min(maxlen - loc, stlen);
-
- (void) strncpy(dat, (char *)st + loc, maxcount);
-
- if (dat[maxcount-1]) /* not null-term --> not enuf room */
- return(-1);
- return strlen(dat)+1;
-}
-
-int
-stv_short(st, dat, loc, maxlen)
-u_char *st; /* a base pointer to the stream */
-u_short *dat; /* the attributes field */
-int loc; /* offset into the stream for current data */
-int maxlen;
-{
- u_short temp; /* to hold the net order short */
-
- if (loc + sizeof(u_short) > maxlen)
- return(-1);
- bcopy((char *)((u_long)st+(u_long)loc), (char *) &temp, sizeof(u_short));
- *dat = ntohs(temp); /* convert to network order */
- return sizeof(u_short);
-}
-
-int
-stv_long(st, dat, loc, maxlen)
-u_char *st; /* a base pointer to the stream */
-u_long *dat; /* the attributes field */
-int loc; /* offset into the stream for current data */
-int maxlen; /* maximum length of st */
-{
- u_long temp; /* to hold the net order short */
-
- if (loc + sizeof(u_long) > maxlen)
- return(-1);
- bcopy((char *)((u_long)st+(u_long)loc), (char *) &temp, sizeof(u_long));
- *dat = ntohl(temp); /* convert to network order */
- return sizeof(u_long);
-}
-
-int
-stv_char(st, dat, loc, maxlen)
-u_char *st; /* a base pointer to the stream */
-u_char *dat; /* the attributes field */
-int loc; /* offset into the stream for current data */
-int maxlen;
-{
- if (loc + 1 > maxlen)
- return(-1);
- *dat = *(st + loc);
- return 1;
-}
-
diff --git a/eBones/libkadm/kadm_supp.c b/eBones/libkadm/kadm_supp.c
deleted file mode 100644
index 353fed0..0000000
--- a/eBones/libkadm/kadm_supp.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * Copyright.MIT.
- *
- * Support functions for Kerberos administration server & clients
- */
-
-#if 0
-#ifndef lint
-static char rcsid_kadm_supp_c[] =
-"Header: /afs/athena.mit.edu/astaff/project/kerberos/src/lib/kadm/RCS/kadm_supp.c,v 4.1 89/09/26 09:21:07 jtkohl Exp ";
-static const char rcsid[] =
- "$Id: kadm_supp.c,v 1.1 1995/07/18 16:40:28 mark Exp $";
-#endif lint
-#endif
-
-/*
- kadm_supp.c
- this holds the support routines for the kerberos administration server
-
- error: prints out a kadm error message, returns
- fatal: prints out a kadm fatal error message, exits
- prin_vals: prints out data associated with a Principal in the vals
- structure
-*/
-
-#include <string.h>
-#include <time.h>
-#include <kadm.h>
-#include <krb_db.h>
-
-/*
-prin_vals:
- recieves : a vals structure
-*/
-void
-prin_vals(vals)
-Kadm_vals *vals;
-{
- printf("Info in Database for %s.%s:\n", vals->name, vals->instance);
- printf(" Max Life: %d Exp Date: %s\n",vals->max_life,
- asctime(localtime((long *)&vals->exp_date)));
- printf(" Attribs: %.2x key: %lu %lu\n",vals->attributes,
- vals->key_low, vals->key_high);
-}
-
-#ifdef notdef
-nierror(s)
-int s;
-{
- printf("Kerberos admin server loses..... %s\n",error_message(s));
- return(s);
-}
-#endif
-
-/* kadm_prin_to_vals takes a fields arguments, a Kadm_vals and a Principal,
- it copies the fields in Principal specified by fields into Kadm_vals,
- i.e from old to new */
-
-void
-kadm_prin_to_vals(fields, new, old)
-u_char fields[FLDSZ];
-Kadm_vals *new;
-Principal *old;
-{
- bzero((char *)new, sizeof(*new));
- if (IS_FIELD(KADM_NAME,fields)) {
- (void) strncpy(new->name, old->name, ANAME_SZ);
- SET_FIELD(KADM_NAME, new->fields);
- }
- if (IS_FIELD(KADM_INST,fields)) {
- (void) strncpy(new->instance, old->instance, INST_SZ);
- SET_FIELD(KADM_INST, new->fields);
- }
- if (IS_FIELD(KADM_EXPDATE,fields)) {
- new->exp_date = old->exp_date;
- SET_FIELD(KADM_EXPDATE, new->fields);
- }
- if (IS_FIELD(KADM_ATTR,fields)) {
- new->attributes = old->attributes;
- SET_FIELD(KADM_MAXLIFE, new->fields);
- }
- if (IS_FIELD(KADM_MAXLIFE,fields)) {
- new->max_life = old->max_life;
- SET_FIELD(KADM_MAXLIFE, new->fields);
- }
- if (IS_FIELD(KADM_DESKEY,fields)) {
- new->key_low = old->key_low;
- new->key_high = old->key_high;
- SET_FIELD(KADM_DESKEY, new->fields);
- }
-}
-
-void
-kadm_vals_to_prin(fields, new, old)
-u_char fields[FLDSZ];
-Principal *new;
-Kadm_vals *old;
-{
-
- bzero((char *)new, sizeof(*new));
- if (IS_FIELD(KADM_NAME,fields))
- (void) strncpy(new->name, old->name, ANAME_SZ);
- if (IS_FIELD(KADM_INST,fields))
- (void) strncpy(new->instance, old->instance, INST_SZ);
- if (IS_FIELD(KADM_EXPDATE,fields))
- new->exp_date = old->exp_date;
- if (IS_FIELD(KADM_ATTR,fields))
- new->attributes = old->attributes;
- if (IS_FIELD(KADM_MAXLIFE,fields))
- new->max_life = old->max_life;
- if (IS_FIELD(KADM_DESKEY,fields)) {
- new->key_low = old->key_low;
- new->key_high = old->key_high;
- }
-}
diff --git a/eBones/make_keypair/Makefile b/eBones/make_keypair/Makefile
deleted file mode 100644
index 7d435e7..0000000
--- a/eBones/make_keypair/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/1/93
-
-PROG= make_keypair
-MAN8= make_keypair.8
-CFLAGS+=-DKERBEROS -I${.CURDIR}/../include -I${.CURDIR}/../register -Wall
-DPADD= ${LIBKRB}
-LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -ldes
-
-.include <bsd.prog.mk>
diff --git a/eBones/make_keypair/make_keypair.c b/eBones/make_keypair/make_keypair.c
deleted file mode 100644
index deb67ac..0000000
--- a/eBones/make_keypair/make_keypair.c
+++ /dev/null
@@ -1,134 +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.
- */
-
-#if 0
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1988, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-static char sccsid[] = "@(#)make_keypair.c 8.1 (Berkeley) 6/1/93";
-#endif /* not lint */
-#endif
-
-#include <sys/types.h>
-#include <sys/file.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <netdb.h>
-#include <des.h>
-#include <krb.h>
-#include "pathnames.h"
-#include "register_proto.h"
-
-void usage(char *name);
-void make_key(struct in_addr addr);
-
-char * progname;
-
-void
-main(argc, argv)
- int argc;
- char **argv;
-{
- struct hostent *hp;
- char *addr;
- int i;
- struct sockaddr_in sin;
-
- progname = *argv; /* argv[0] */
-
- if (argc != 2) {
- usage(argv[0]);
- exit(1);
- }
-
- if ((hp = gethostbyname(argv[1])) == NULL) {
- herror(argv[1]);
- exit(1);
- }
-
- for (i = 0; (addr = hp->h_addr_list[i]); i++) {
- addr = hp->h_addr_list[i];
- bcopy(addr, &sin.sin_addr, hp->h_length);
-
- printf("Making key for host %s (%s)\n",
- argv[1], inet_ntoa(sin.sin_addr));
- make_key(sin.sin_addr);
- }
- printf("==========\n");
- printf("One copy of the each key should be put in %s on the\n",
- SERVER_KEYDIR);
- printf("Kerberos server machine (mode 600, owner root).\n");
- printf("Another copy of each key should be put on the named\n");
- printf("client as %sXXX.XXX.XXX.XXX (same modes as above),\n",
- CLIENT_KEYFILE);
- printf("where the X's refer to digits of the host's inet address.\n");
- (void)fflush(stdout);
- exit(0);
-}
-
-void
-make_key(addr)
- struct in_addr addr;
-{
- struct keyfile_data kfile;
- char namebuf[255];
- int fd;
-
- (void)sprintf(namebuf, "%s%s",
- CLIENT_KEYFILE,
- inet_ntoa(addr));
- fd = open(namebuf, O_WRONLY|O_CREAT, 0600);
- if (fd < 0) {
- perror("open");
- exit(1);
- }
- random_key(kfile.kf_key);
- printf("writing to file -> %s ...", namebuf);
- if (write(fd, &kfile, sizeof(kfile)) != sizeof(kfile)) {
- fprintf(stderr, "error writing file %s\n", namebuf);
- }
- printf("done.\n");
- (void)close(fd);
- return;
-}
-
-void
-usage(name)
- char *name;
-{
- fprintf(stderr, "usage: %s host\n", name);
-}
diff --git a/eBones/man/acl_check.3 b/eBones/man/acl_check.3
deleted file mode 100644
index 2e5129c..0000000
--- a/eBones/man/acl_check.3
+++ /dev/null
@@ -1,183 +0,0 @@
-.\" from: acl_check.3,v 4.1 89/01/23 11:06:54 jtkohl Exp $
-.\" $Id: acl_check.3,v 1.1.1.1 1994/09/30 14:50:05 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH ACL_CHECK 3 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-acl_canonicalize_principal, acl_check, acl_exact_match, acl_add,
-acl_delete, acl_initialize \- Access control list routines
-.SH SYNOPSIS
-.nf
-.nj
-.ft B
-cc <files> \-lacl \-lkrb
-.PP
-.ft B
-#include <kerberosIV/krb.h>
-.PP
-.ft B
-acl_canonicalize_principal(principal, buf)
-char *principal;
-char *buf;
-.PP
-.ft B
-acl_check(acl, principal)
-char *acl;
-char *principal;
-.PP
-.ft B
-acl_exact_match(acl, principal)
-char *acl;
-char *principal;
-.PP
-.ft B
-acl_add(acl, principal)
-char *acl;
-char *principal;
-.PP
-.ft B
-acl_delete(acl, principal)
-char *acl;
-char *principal;
-.PP
-.ft B
-acl_initialize(acl_file, mode)
-char *acl_file;
-int mode;
-.fi
-.ft R
-.SH DESCRIPTION
-.SS Introduction
-.PP
-An access control list (ACL) is a list of principals, where each
-principal is represented by a text string which cannot contain
-whitespace. The library allows application programs to refer to named
-access control lists to test membership and to atomically add and
-delete principals using a natural and intuitive interface. At
-present, the names of access control lists are required to be Unix
-filenames, and refer to human-readable Unix files; in the future, when
-a networked ACL server is implemented, the names may refer to a
-different namespace specific to the ACL service.
-.PP
-.SS Principal Names
-.PP
-Principal names have the form
-.nf
-.in +5n
-<name>[.<instance>][@<realm>]
-.in -5n
-e.g.:
-.in +5n
-asp
-asp.root
-asp@ATHENA.MIT.EDU
-asp.@ATHENA.MIT.EDU
-asp.root@ATHENA.MIT.EDU
-.in -5n
-.fi
-It is possible for principals to be underspecified. If an instance is
-missing, it is assumed to be "". If realm is missing, it is assumed
-to be the local realm as determined by
-.IR krb_get_lrealm (3).
-The canonical form contains all of name, instance,
-and realm; the acl_add and acl_delete routines will always
-leave the file in that form. Note that the canonical form of
-asp@ATHENA.MIT.EDU is actually asp.@ATHENA.MIT.EDU.
-.SS Routines
-.PP
-.I acl_canonicalize_principal
-stores the canonical form of
-.I principal
-in
-.IR buf .
-.I Buf
-must contain enough
-space to store a principal, given the limits on the sizes of name,
-instance, and realm specified as ANAME_SZ, INST_SZ, and REALM_SZ,
-respectively, in
-.IR /usr/include/kerberosIV/krb.h .
-.PP
-.I acl_check
-returns nonzero if
-.I principal
-appears in
-.IR acl .
-Returns 0 if principal
-does not appear in acl, or if an error occurs. Canonicalizes
-principal before checking, and allows the ACL to contain wildcards. The
-only supported wildcards are entries of the form
-name.*@realm, *.*@realm, and *.*@*. An asterisk matches any value for the
-its component field. For example, "jtkohl.*@*" would match principal
-jtkohl, with any instance and any realm.
-.PP
-.I acl_exact_match
-performs like
-.IR acl_check ,
-but does no canonicalization or wildcard matching.
-.PP
-.I acl_add
-atomically adds
-.I principal
-to
-.IR acl .
-Returns 0 if successful, nonzero otherwise. It is considered a failure
-if
-.I principal
-is already in
-.IR acl .
-This routine will canonicalize
-.IR principal ,
-but will treat wildcards literally.
-.PP
-.I acl_delete
-atomically deletes
-.I principal
-from
-.IR acl .
-Returns 0 if successful,
-nonzero otherwise. It is considered a failure if
-.I principal
-is not
-already in
-.IR acl .
-This routine will canonicalize
-.IR principal ,
-but will treat wildcards literally.
-.PP
-.I acl_initialize
-initializes
-.IR acl_file .
-If the file
-.I acl_file
-does not exist,
-.I acl_initialize
-creates it with mode
-.IR mode .
-If the file
-.I acl_file
-exists,
-.I acl_initialize
-removes all members. Returns 0 if successful,
-nonzero otherwise. WARNING: Mode argument is likely to change with
-the eventual introduction of an ACL service.
-.SH NOTES
-In the presence of concurrency, there is a very small chance that
-.I acl_add
-or
-.I acl_delete
-could report success even though it would have
-had no effect. This is a necessary side effect of using lock files
-for concurrency control rather than flock(2), which is not supported
-by NFS.
-.PP
-The current implementation caches ACLs in memory in a hash-table
-format for increased efficiency in checking membership; one effect of
-the caching scheme is that one file descriptor will be kept open for
-each ACL cached, up to a maximum of 8.
-.SH SEE ALSO
-kerberos(3), krb_get_lrealm(3)
-.SH AUTHOR
-James Aspnes (MIT Project Athena)
diff --git a/eBones/man/ext_srvtab.8 b/eBones/man/ext_srvtab.8
deleted file mode 100644
index 565c3a3..0000000
--- a/eBones/man/ext_srvtab.8
+++ /dev/null
@@ -1,62 +0,0 @@
-.\" from: ext_srvtab.8,v 4.2 89/07/18 16:53:18 jtkohl Exp $
-.\" $Id: ext_srvtab.8,v 1.1.1.1 1994/09/30 14:50:05 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH EXT_SRVTAB 8 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-ext_srvtab \- extract service key files from Kerberos key distribution center database
-.SH SYNOPSIS
-ext_srvtab [
-.B \-n
-] [
-.B \-r realm
-] [
-.B hostname ...
-]
-.SH DESCRIPTION
-.I ext_srvtab
-extracts service key files from the Kerberos key distribution center
-(KDC) database.
-.PP
-Upon execution, it prompts the user to enter the master key string for
-the database. If the
-.B \-n
-option is specified, the master key is instead fetched from the master
-key cache file.
-.PP
-For each
-.I hostname
-specified on the command line,
-.I ext_srvtab
-creates the service key file
-.IR hostname -new-srvtab,
-containing all the entries in the database with an instance field of
-.I hostname.
-This new file contains all the keys registered for Kerberos-mediated
-service providing programs which use the
-.IR krb_get_phost (3)
-principal and instance conventions to run on the host
-.IR hostname .
-If the
-.B \-r
-option is specified, the realm fields in the extracted file will
-match the given realm rather than the local realm.
-.SH DIAGNOSTICS
-.TP 20n
-"verify_master_key: Invalid master key, does not match database."
-The master key string entered was incorrect.
-.SH FILES
-.TP 20n
-/etc/kerberosIV/principal.db
-DBM file containing database
-.TP
-/etc/kerberosIV/principal.ok
-Semaphore indicating that the DBM database is not being modified.
-.TP
-/etc/kerberosIV/master_key
-Master key cache file.
-.SH SEE ALSO
-read_service_key(3), krb_get_phost(3)
diff --git a/eBones/man/kadmind.8 b/eBones/man/kadmind.8
deleted file mode 100644
index 1eb10d7..0000000
--- a/eBones/man/kadmind.8
+++ /dev/null
@@ -1,117 +0,0 @@
-.\" from: kadmind.8,v 4.1 89/07/25 17:28:33 jtkohl Exp $
-.\" $Id: kadmind.8,v 1.1.1.1 1994/09/30 14:50:06 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KADMIND 8 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-kadmind \- network daemon for Kerberos database administration
-.SH SYNOPSIS
-.B kadmind
-[
-.B \-n
-] [
-.B \-h
-] [
-.B \-r realm
-] [
-.B \-f filename
-] [
-.B \-d dbname
-] [
-.B \-a acldir
-]
-.SH DESCRIPTION
-.I kadmind
-is the network database server for the Kerberos password-changing and
-administration tools.
-.PP
-Upon execution, it prompts the user to enter the master key string for
-the database.
-.PP
-If the
-.B \-n
-option is specified, the master key is instead fetched from the master
-key cache file.
-.PP
-If the
-.B \-r
-.I realm
-option is specified, the admin server will pretend that its
-local realm is
-.I realm
-instead of the actual local realm of the host it is running on.
-This makes it possible to run a server for a foreign kerberos
-realm.
-.PP
-If the
-.B \-f
-.I filename
-option is specified, then that file is used to hold the log information
-instead of the default.
-.PP
-If the
-.B \-d
-.I dbname
-option is specified, then that file is used as the database name instead
-of the default.
-.PP
-If the
-.B \-a
-.I acldir
-option is specified, then
-.I acldir
-is used as the directory in which to search for access control lists
-instead of the default.
-.PP
-If the
-.B \-h
-option is specified,
-.I kadmind
-prints out a short summary of the permissible control arguments, and
-then exits.
-.PP
-When performing requests on behalf of clients,
-.I kadmind
-checks access control lists (ACLs) to determine the authorization of the client
-to perform the requested action.
-Currently three distinct access types are supported:
-.TP 1i
-Addition
-(.add ACL file). If a principal is on this list, it may add new
-principals to the database.
-.TP
-Retrieval
-(.get ACL file). If a principal is on this list, it may retrieve
-database entries. NOTE: A principal's private key is never returned by
-the get functions.
-.TP
-Modification
-(.mod ACL file). If a principal is on this list, it may modify entries
-in the database.
-.PP
-A principal is always granted authorization to change its own password.
-.SH FILES
-.TP 20n
-/var/log/kadmind.syslog
-Default log file.
-.TP
-/etc/kerberosIV/admin_acl.{add,get,mod}
-Access control list files
-.TP
-/etc/kerberosIV/principal.db
-DBM file containing database
-.TP
-/etc/kerberosIV/principal.ok
-Semaphore indicating that the DBM database is not being modified.
-.TP
-/etc/kerberosIV/master_key
-Master key cache file.
-.SH "SEE ALSO"
-kerberos(1), kpasswd(1), kadmin(8), acl_check(3)
-.SH AUTHORS
-Douglas A. Church, MIT Project Athena
-.br
-John T. Kohl, Project Athena/Digital Equipment Corporation
diff --git a/eBones/man/kdb_destroy.8 b/eBones/man/kdb_destroy.8
deleted file mode 100644
index 2e57876..0000000
--- a/eBones/man/kdb_destroy.8
+++ /dev/null
@@ -1,36 +0,0 @@
-.\" from: kdb_destroy.8,v 4.1 89/01/23 11:08:02 jtkohl Exp $
-.\" $Id: kdb_destroy.8,v 1.1.1.1 1994/09/30 14:50:06 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KDB_DESTROY 8 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-kdb_destroy \- destroy Kerberos key distribution center database
-.SH SYNOPSIS
-kdb_destroy
-.SH DESCRIPTION
-.I kdb_destroy
-deletes a Kerberos key distribution center database.
-.PP
-The user is prompted to verify that the database should be destroyed. A
-response beginning with `y' or `Y' confirms deletion.
-Any other response aborts deletion.
-.SH DIAGNOSTICS
-.TP 20n
-"Database cannot be deleted at /kerberos/principal"
-The attempt to delete the database failed (probably due to a system or
-access permission error).
-.TP
-"Database not deleted."
-The user aborted the deletion.
-.SH FILES
-.TP 20n
-/etc/kerberosIV/principal.db
-DBM file containing database
-.TP
-/etc/kerberosIV/principal.ok
-Semaphore indicating that the DBM database is not being modified.
-.SH SEE ALSO
-kdb_init(8)
diff --git a/eBones/man/kdb_edit.8 b/eBones/man/kdb_edit.8
deleted file mode 100644
index 44a0fa6..0000000
--- a/eBones/man/kdb_edit.8
+++ /dev/null
@@ -1,58 +0,0 @@
-.\" from: kdb_edit.8,v 4.1 89/01/23 11:08:55 jtkohl Exp $
-.\" $Id: kdb_edit.8,v 1.2 1995/02/08 10:54:20 jkh Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KDB_EDIT 8 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-kdb_edit \- Kerberos key distribution center database editing utility
-.SH SYNOPSIS
-kdb_edit [
-.B \-n
-]
-.SH DESCRIPTION
-.I kdb_edit
-is used to create or change principals stored in the Kerberos key
-distribution center (KDC) database.
-.PP
-When executed,
-.I kdb_edit
-prompts for the master key string and verifies that it matches the
-master key stored in the database.
-If the
-.B \-n
-option is specified, the master key is instead fetched from the master
-key cache file.
-.PP
-Once the master key has been verified,
-.I kdb_edit
-begins a prompt loop. The user is prompted for the principal and
-instance to be modified. If the entry is not found the user may create
-it.
-Once an entry is found or created, the user may set the password,
-expiration date, maximum ticket lifetime, and attributes.
-Default expiration dates, maximum ticket lifetimes, and attributes are
-presented in brackets; if the user presses return the default is selected.
-There is no default password.
-The password "RANDOM" and an empty password are interpreted specially,
-if entered the user may have the program select a random DES key for the
-principal.
-.PP
-Upon successfully creating or changing the entry, ``Edit O.K.'' is
-printed.
-.SH DIAGNOSTICS
-.TP 20n
-"verify_master_key: Invalid master key, does not match database."
-The master key string entered was incorrect.
-.SH FILES
-.TP 20n
-/etc/kerberosIV/principal.db
-DBM file containing database
-.TP
-/etc/kerberosIV/principal.ok
-Semaphore indicating that the DBM database is not being modified.
-.TP
-/etc/kerberosIV/master_key
-Master key cache file.
diff --git a/eBones/man/kdb_init.8 b/eBones/man/kdb_init.8
deleted file mode 100644
index d884d00..0000000
--- a/eBones/man/kdb_init.8
+++ /dev/null
@@ -1,45 +0,0 @@
-.\" from: kdb_init.8,v 4.1 89/01/23 11:09:02 jtkohl Exp $
-.\" $Id: kdb_init.8,v 1.1.1.1 1994/09/30 14:50:06 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KDB_INIT 8 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-kdb_init \- Initialize Kerberos key distribution center database
-.SH SYNOPSIS
-kdb_init [
-.B realm
-]
-.SH DESCRIPTION
-.I kdb_init
-initializes a Kerberos key distribution center database, creating the
-necessary principals.
-.PP
-If the optional
-.I realm
-argument is not present,
-.I kdb_init
-prompts for a realm name (defaulting to the definition in
-/usr/include/kerberosIV/krb.h).
-After determining the realm to be created, it prompts for
-a master key password. The master key password is used to encrypt
-every encryption key stored in the database.
-.SH DIAGNOSTICS
-.TP 20n
-"/etc/kerberosIV/principal: File exists"
-An attempt was made to create a database on a machine which already had
-an existing database.
-.SH FILES
-.TP 20n
-/etc/kerberosIV/principal.db
-DBM file containing database
-.TP
-/etc/kerberosIV/principal.ok
-Semaphore indicating that the DBM database is not being modified.
-.TP
-/usr/include/kerberosIV/krb.h
-Include file defining default realm
-.SH SEE ALSO
-kdb_destroy(8)
diff --git a/eBones/man/kdb_util.8 b/eBones/man/kdb_util.8
deleted file mode 100644
index 4183ef3..0000000
--- a/eBones/man/kdb_util.8
+++ /dev/null
@@ -1,64 +0,0 @@
-.\" from: kdb_util.8,v 4.1 89/01/23 11:09:11 jtkohl Exp $
-.\" $Id: kdb_util.8,v 1.1.1.1 1994/09/30 14:50:06 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KDB_UTIL 8 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-kdb_util \- Kerberos key distribution center database utility
-.SH SYNOPSIS
-kdb_util
-.B operation filename
-.SH DESCRIPTION
-.I kdb_util
-allows the Kerberos key distribution center (KDC) database administrator to
-perform utility functions on the database.
-.PP
-.I Operation
-must be one of the following:
-.TP 10n
-.I load
-initializes the KDC database with the records described by the
-text contained in the file
-.IR filename .
-Any existing database is overwritten.
-.TP
-.I dump
-dumps the KDC database into a text representation in the file
-.IR filename .
-.TP
-.I slave_dump
-performs a database dump like the
-.I dump
-operation, and additionally creates a semaphore file signalling the
-propagation software that an update is available for distribution to
-slave KDC databases.
-.TP
-.I new_master_key
-prompts for the old and new master key strings, and then dumps the KDC
-database into a text representation in the file
-.IR filename .
-The keys in the text representation are encrypted in the new master key.
-.TP
-.I convert_old_db
-prompts for the master key string, and then dumps the KDC database into
-a text representation in the file
-.IR filename .
-The existing database is assumed to be encrypted using the old format
-(encrypted by the key schedule of the master key); the dumped database
-is encrypted using the new format (encrypted directly with master key).
-.PP
-.SH DIAGNOSTICS
-.TP 20n
-"verify_master_key: Invalid master key, does not match database."
-The master key string entered was incorrect.
-.SH FILES
-.TP 20n
-/etc/kerberosIV/principal.db
-DBM file containing database
-.TP
-.IR filename .dump_ok
-semaphore file created by
-.IR slave_dump.
diff --git a/eBones/man/klist.1 b/eBones/man/klist.1
deleted file mode 100644
index af7e31a..0000000
--- a/eBones/man/klist.1
+++ /dev/null
@@ -1,84 +0,0 @@
-.\" from: klist.1,v 4.8 89/01/24 14:35:09 jtkohl Exp $
-.\" $Id: klist.1,v 1.1.1.1 1994/09/30 14:50:06 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KLIST 1 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-klist \- list currently held Kerberos tickets
-.SH SYNOPSIS
-.B klist
-[
-\fB\-s \fR|\fB \-t\fR
-] [
-.B \-file
-name ] [
-.B \-srvtab
-]
-.br
-.SH DESCRIPTION
-.I klist
-prints the name of the tickets file and the
-identity of the principal the tickets are for (as listed in the
-tickets file), and
-lists the principal names of all Kerberos tickets currently held by
-the user, along with the issue and expire time for each authenticator.
-Principal names are listed in the form
-.I name.instance@realm,
-with the '.' omitted if the instance is null,
-and the '@' omitted if the realm is null.
-
-If given the
-.B \-s
-option,
-.I klist
-does not print the issue and expire times, the name of the tickets file,
-or the identity of the principal.
-
-If given the
-.B \-t
-option,
-.B klist
-checks for the existence of a non-expired ticket-granting-ticket in the
-ticket file. If one is present, it exits with status 0, else it exits
-with status 1. No output is generated when this option is specified.
-
-If given the
-.B \-file
-option, the following argument is used as the ticket file.
-Otherwise, if the
-.B KRBTKFILE
-environment variable is set, it is used.
-If this environment variable
-is not set, the file
-.B /tmp/tkt[uid]
-is used, where
-.B uid
-is the current user-id of the user.
-
-If given the
-.B \-srvtab
-option, the file is treated as a service key file, and the names of the
-keys contained therein are printed. If no file is
-specified with a
-.B \-file
-option, the default is
-.IR /etc/kerberosIV/srvtab .
-.SH FILES
-.TP 2i
-/etc/kerberosIV/krb.conf
-to get the name of the local realm
-.TP
-/tmp/tkt[uid]
-as the default ticket file ([uid] is the decimal UID of the user).
-.TP
-/etc/kerberosIV/srvtab
-as the default service key file
-.SH SEE ALSO
-.PP
-kerberos(1), kinit(1), kdestroy(1)
-.SH BUGS
-When reading a file as a service key file, very little sanity or error
-checking is performed.
diff --git a/eBones/man/krb.3 b/eBones/man/krb.3
deleted file mode 100644
index 98a720b..0000000
--- a/eBones/man/krb.3
+++ /dev/null
@@ -1,462 +0,0 @@
-.\" $Source: /home/ncvs/src/eBones/man/krb.3,v $
-.\" $Author: rgrimes $
-.\" $Header: /home/ncvs/src/eBones/man/krb.3,v 1.1.1.1 1994/05/27 05:12:09 rgrimes Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <mit-copyright.h>.
-.\"
-.TH KERBEROS 3 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-krb_mk_req, krb_rd_req, krb_kntoln, krb_set_key, krb_get_cred,
-krb_mk_priv, krb_rd_priv, krb_mk_safe, krb_rd_safe, krb_mk_err,
-krb_rd_err, krb_ck_repl \- Kerberos authentication library
-.SH SYNOPSIS
-.nf
-.nj
-.ft B
-#include <kerberosIV/des.h>
-#include <kerberosIV/krb.h>
-.PP
-.ft B
-extern char *krb_err_txt[];
-.PP
-.ft B
-int krb_mk_req(authent,service,instance,realm,checksum)
-KTEXT authent;
-char *service;
-char *instance;
-char *realm;
-u_long checksum;
-.PP
-.ft B
-int krb_rd_req(authent,service,instance,from_addr,ad,fn)
-KTEXT authent;
-char *service;
-char *instance;
-u_long from_addr;
-AUTH_DAT *ad;
-char *fn;
-.PP
-.ft B
-int krb_kntoln(ad,lname)
-AUTH_DAT *ad;
-char *lname;
-.PP
-.ft B
-int krb_set_key(key,cvt)
-char *key;
-int cvt;
-.PP
-.ft B
-int krb_get_cred(service,instance,realm,c)
-char *service;
-char *instance;
-char *realm;
-CREDENTIALS *c;
-.PP
-.ft B
-long krb_mk_priv(in,out,in_length,schedule,key,sender,receiver)
-u_char *in;
-u_char *out;
-u_long in_length;
-des_cblock key;
-des_key_schedule schedule;
-struct sockaddr_in *sender;
-struct sockaddr_in *receiver;
-.PP
-.ft B
-long krb_rd_priv(in,in_length,schedule,key,sender,receiver,msg_data)
-u_char *in;
-u_long in_length;
-Key_schedule schedule;
-des_cblock key;
-struct sockaddr_in *sender;
-struct sockaddr_in *receiver;
-MSG_DAT *msg_data;
-.PP
-.ft B
-long krb_mk_safe(in,out,in_length,key,sender,receiver)
-u_char *in;
-u_char *out;
-u_long in_length;
-des_cblock key;
-struct sockaddr_in *sender;
-struct sockaddr_in *receiver;
-.PP
-.ft B
-long krb_rd_safe(in,length,key,sender,receiver,msg_data)
-u_char *in;
-u_long length;
-des_cblock key;
-struct sockaddr_in *sender;
-struct sockaddr_in *receiver;
-MSG_DAT *msg_data;
-.PP
-.ft B
-long krb_mk_err(out,code,string)
-u_char *out;
-long code;
-char *string;
-.PP
-.ft B
-long krb_rd_err(in,length,code,msg_data)
-u_char *in;
-u_long length;
-long code;
-MSG_DAT *msg_data;
-.fi
-.ft R
-.SH DESCRIPTION
-This library supports network authentication and various related
-operations. The library contains many routines beyond those described
-in this man page, but they are not intended to be used directly.
-Instead, they are called by the routines that are described, the
-authentication server and the login program.
-.PP
-.I krb_err_txt[]
-contains text string descriptions of various Kerberos error codes returned
-by some of the routines below.
-.PP
-.I krb_mk_req
-takes a pointer to a text structure in which an authenticator is to be
-built. It also takes the name, instance, and realm of the service to be
-used and an optional checksum. It is up to the application to decide
-how to generate the checksum.
-.I krb_mk_req
-then retrieves a ticket for the desired service and creates an
-authenticator. The authenticator is built in
-.I authent
-and is accessible
-to the calling procedure.
-.PP
-It is up to the application to get the authenticator to the service
-where it will be read by
-.I krb_rd_req.
-Unless an attacker posesses the session key contained in the ticket, it
-will be unable to modify the authenticator. Thus, the checksum can be
-used to verify the authenticity of the other data that will pass through
-a connection.
-.PP
-.I krb_rd_req
-takes an authenticator of type
-.B KTEXT,
-a service name, an instance, the address of the
-host originating the request, and a pointer to a structure of type
-.B AUTH_DAT
-which is filled in with information obtained from the authenticator.
-It also optionally takes the name of the file in which it will find the
-secret key(s) for the service.
-If the supplied
-.I instance
-contains "*", then the first service key with the same service name
-found in the service key file will be used, and the
-.I instance
-argument will be filled in with the chosen instance. This means that
-the caller must provide space for such an instance name.
-.PP
-It is used to find out information about the principal when a request
-has been made to a service. It is up to the application protocol to get
-the authenticator from the client to the service. The authenticator is
-then passed to
-.I krb_rd_req
-to extract the desired information.
-.PP
-.I krb_rd_req
-returns zero (RD_AP_OK) upon successful authentication. If a packet was
-forged, modified, or replayed, authentication will fail. If the
-authentication fails, a non-zero value is returned indicating the
-particular problem encountered. See
-.I krb.h
-for the list of error codes.
-.PP
-If the last argument is the null string (""), krb_rd_req will use the
-file /etc/kerberosIV/srvtab to find its keys. If the last argument is
-NULL, it will assume that the key has been set by
-.I krb_set_key
-and will not bother looking further.
-.PP
-.I krb_kntoln
-converts a Kerberos name to a local name. It takes a structure
-of type AUTH_DAT and uses the name and instance to look in the database
-/etc/kerberosIV/aname to find the corresponding local name. The local name is
-returned and can be used by an application to change uids, directories,
-or other parameters. It is not an integral part of Kerberos, but is
-instead provided to support the use of Kerberos in existing utilities.
-.PP
-.I krb_set_key
-takes as an argument a des key. It then creates
-a key schedule from it and saves the original key to be used as an
-initialization vector.
-It is used to set the server's key which
-must be used to decrypt tickets.
-.PP
-If called with a non-zero second argument,
-.I krb_set_key
-will first convert the input from a string of arbitrary length to a DES
-key by encrypting it with a one-way function.
-.PP
-In most cases it should not be necessary to call
-.I krb_set_key.
-The necessary keys will usually be obtained and set inside
-.I krb_rd_req. krb_set_key
-is provided for those applications that do not wish to place the
-application keys on disk.
-.PP
-.I krb_get_cred
-searches the caller's ticket file for a ticket for the given service, instance,
-and realm; and, if a ticket is found, fills in the given CREDENTIALS structure
-with the ticket information.
-.PP
-If the ticket was found,
-.I krb_get_cred
-returns GC_OK.
-If the ticket file can't be found, can't be read, doesn't belong to
-the user (other than root), isn't a regular file, or is in the wrong
-mode, the error GC_TKFIL is returned.
-.PP
-.I krb_mk_priv
-creates an encrypted, authenticated
-message from any arbitrary application data, pointed to by
-.I in
-and
-.I in_length
-bytes long.
-The private session key, pointed to by
-.I key
-and the key schedule,
-.I schedule,
-are used to encrypt the data and some header information using
-.I pcbc_encrypt.
-.I sender
-and
-.I receiver
-point to the Internet address of the two parties.
-In addition to providing privacy, this protocol message protects
-against modifications, insertions or replays. The encapsulated message and
-header are placed in the area pointed to by
-.I out
-and the routine returns the length of the output, or -1 indicating
-an error.
-.PP
-.I krb_rd_priv
-decrypts and authenticates a received
-.I krb_mk_priv
-message.
-.I in
-points to the beginning of the received message, whose length
-is specified in
-.I in_length.
-The private session key, pointed to by
-.I key,
-and the key schedule,
-.I schedule,
-are used to decrypt and verify the received message.
-.I msg_data
-is a pointer to a
-.I MSG_DAT
-struct, defined in
-.I krb.h.
-The routine fills in the
-.I app_data
-field with a pointer to the decrypted application data,
-.I app_length
-with the length of the
-.I app_data
-field,
-.I time_sec
-and
-.I time_5ms
-with the timestamps in the message, and
-.I swap
-with a 1 if the byte order of the receiver is different than that of
-the sender. (The application must still determine if it is appropriate
-to byte-swap application data; the Kerberos protocol fields are already taken
-care of). The
-.I hash
-field returns a value useful as input to the
-.I krb_ck_repl
-routine.
-
-The routine returns zero if ok, or a Kerberos error code. Modified messages
-and old messages cause errors, but it is up to the caller to
-check the time sequence of messages, and to check against recently replayed
-messages using
-.I krb_ck_repl
-if so desired.
-.PP
-.I krb_mk_safe
-creates an authenticated, but unencrypted message from any arbitrary
-application data,
-pointed to by
-.I in
-and
-.I in_length
-bytes long.
-The private session key, pointed to by
-.I key,
-is used to seed the
-.I quad_cksum()
-checksum algorithm used as part of the authentication.
-.I sender
-and
-.I receiver
-point to the Internet address of the two parties.
-This message does not provide privacy, but does protect (via detection)
-against modifications, insertions or replays. The encapsulated message and
-header are placed in the area pointed to by
-.I out
-and the routine returns the length of the output, or -1 indicating
-an error.
-The authentication provided by this routine is not as strong as that
-provided by
-.I krb_mk_priv
-or by computing the checksum using
-.I cbc_cksum
-instead, both of which authenticate via DES.
-.PP
-
-.I krb_rd_safe
-authenticates a received
-.I krb_mk_safe
-message.
-.I in
-points to the beginning of the received message, whose length
-is specified in
-.I in_length.
-The private session key, pointed to by
-.I key,
-is used to seed the quad_cksum() routine as part of the authentication.
-.I msg_data
-is a pointer to a
-.I MSG_DAT
-struct, defined in
-.I krb.h .
-The routine fills in these
-.I MSG_DAT
-fields:
-the
-.I app_data
-field with a pointer to the application data,
-.I app_length
-with the length of the
-.I app_data
-field,
-.I time_sec
-and
-.I time_5ms
-with the timestamps in the message, and
-.I swap
-with a 1 if the byte order of the receiver is different than that of
-the sender.
-(The application must still determine if it is appropriate
-to byte-swap application data; the Kerberos protocol fields are already taken
-care of). The
-.I hash
-field returns a value useful as input to the
-.I krb_ck_repl
-routine.
-
-The routine returns zero if ok, or a Kerberos error code. Modified messages
-and old messages cause errors, but it is up to the caller to
-check the time sequence of messages, and to check against recently replayed
-messages using
-.I krb_ck_repl
-if so desired.
-.PP
-.I krb_mk_err
-constructs an application level error message that may be used along
-with
-.I krb_mk_priv
-or
-.I krb_mk_safe.
-.I out
-is a pointer to the output buffer,
-.I code
-is an application specific error code, and
-.I string
-is an application specific error string.
-
-.PP
-.I krb_rd_err
-unpacks a received
-.I krb_mk_err
-message.
-.I in
-points to the beginning of the received message, whose length
-is specified in
-.I in_length.
-.I code
-is a pointer to a value to be filled in with the error
-value provided by the application.
-.I msg_data
-is a pointer to a
-.I MSG_DAT
-struct, defined in
-.I krb.h .
-The routine fills in these
-.I MSG_DAT
-fields: the
-.I app_data
-field with a pointer to the application error text,
-.I app_length
-with the length of the
-.I app_data
-field, and
-.I swap
-with a 1 if the byte order of the receiver is different than that of
-the sender. (The application must still determine if it is appropriate
-to byte-swap application data; the Kerberos protocol fields are already taken
-care of).
-
-The routine returns zero if the error message has been successfully received,
-or a Kerberos error code.
-.PP
-The
-.I KTEXT
-structure is used to pass around text of varying lengths. It consists
-of a buffer for the data, and a length. krb_rd_req takes an argument of this
-type containing the authenticator, and krb_mk_req returns the
-authenticator in a structure of this type. KTEXT itself is really a
-pointer to the structure. The actual structure is of type KTEXT_ST.
-.PP
-The
-.I AUTH_DAT
-structure is filled in by krb_rd_req. It must be allocated before
-calling krb_rd_req, and a pointer to it is passed. The structure is
-filled in with data obtained from Kerberos.
-.I MSG_DAT
-structure is filled in by either krb_rd_priv, krb_rd_safe, or
-krb_rd_err. It must be allocated before the call and a pointer to it
-is passed. The structure is
-filled in with data obtained from Kerberos.
-.PP
-.SH FILES
-/usr/include/kerberosIV/krb.h
-.br
-/usr/lib/libkrb.a
-.br
-/usr/include/kerberosIV/des.h
-.br
-/usr/lib/libdes.a
-.br
-/etc/kerberosIV/aname
-.br
-/etc/kerberosIV/srvtab
-.br
-/tmp/tkt[uid]
-.SH "SEE ALSO"
-kerberos(1), des_crypt(3)
-.SH DIAGNOSTICS
-.SH BUGS
-The caller of
-.I krb_rd_req, krb_rd_priv, and krb_rd_safe
-must check time order and for replay attempts.
-.I krb_ck_repl
-is not implemented yet.
-.SH AUTHORS
-Clifford Neuman, MIT Project Athena
-.br
-Steve Miller, MIT Project Athena/Digital Equipment Corporation
-.SH RESTRICTIONS
-COPYRIGHT 1985,1986,1989 Massachusetts Institute of Technology
diff --git a/eBones/man/krb_realmofhost.3 b/eBones/man/krb_realmofhost.3
deleted file mode 100644
index 63aa1eb..0000000
--- a/eBones/man/krb_realmofhost.3
+++ /dev/null
@@ -1,161 +0,0 @@
-.\" from: krb_realmofhost.3,v 4.1 89/01/23 11:10:47 jtkohl Exp $
-.\" $Id: krb_realmofhost.3,v 1.1.1.1 1994/09/30 14:50:07 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KRB_REALMOFHOST 3 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-krb_realmofhost, krb_get_phost, krb_get_krbhst, krb_get_admhst,
-krb_get_lrealm \- additional Kerberos utility routines
-.SH SYNOPSIS
-.nf
-.nj
-.ft B
-#include <kerberosIV/krb.h>
-#include <kerberosIV/des.h>
-#include <netinet/in.h>
-.PP
-.ft B
-char *krb_realmofhost(host)
-char *host;
-.PP
-.ft B
-char *krb_get_phost(alias)
-char *alias;
-.PP
-.ft B
-krb_get_krbhst(host,realm,n)
-char *host;
-char *realm;
-int n;
-.PP
-.ft B
-krb_get_admhst(host,realm,n)
-char *host;
-char *realm;
-int n;
-.PP
-.ft B
-krb_get_lrealm(realm,n)
-char *realm;
-int n;
-.fi
-.ft R
-.SH DESCRIPTION
-.I krb_realmofhost
-returns the Kerberos realm of the host
-.IR host ,
-as determined by the translation table
-.IR /etc/kerberosIV/krb.realms .
-.I host
-should be the fully-qualified domain-style primary host name of the host
-in question. In order to prevent certain security attacks, this routine
-must either have
-.I a priori
-knowledge of a host's realm, or obtain such information securely.
-.PP
-The format of the translation file is described by
-.IR krb.realms (5).
-If
-.I host
-exactly matches a host_name line, the corresponding realm
-is returned.
-Otherwise, if the domain portion of
-.I host
-matches a domain_name line, the corresponding realm
-is returned.
-If
-.I host
-contains a domain, but no translation is found,
-.IR host 's
-domain is converted to upper-case and returned.
-If
-.I host
-contains no discernable domain, or an error occurs,
-the local realm name, as supplied by
-.IR krb_get_lrealm (3),
-is returned.
-.PP
-.I krb_get_phost
-converts the hostname
-.I alias
-(which can be either an official name or an alias) into the instance
-name to be used in obtaining Kerberos tickets for most services,
-including the Berkeley rcmd suite (rlogin, rcp, rsh).
-.br
-The current convention is to return the first segment of the official
-domain-style name after conversion to lower case.
-.PP
-.I krb_get_krbhst
-fills in
-.I host
-with the hostname of the
-.IR n th
-host running a Kerberos key distribution center (KDC)
-for realm
-.IR realm ,
-as specified in the configuration file (\fI/etc/kerberosIV/krb.conf\fR).
-The configuration file is described by
-.IR krb.conf (5).
-If the host is successfully filled in, the routine
-returns KSUCCESS.
-If the file cannot be opened, and
-.I n
-equals 1, then the value of KRB_HOST as defined in
-.I <krb.h>
-is filled in, and KSUCCESS is returned. If there are fewer than
-.I n
-hosts running a Kerberos KDC for the requested realm, or the
-configuration file is malformed, the routine
-returns KFAILURE.
-.PP
-.I krb_get_admhst
-fills in
-.I host
-with the hostname of the
-.IR n th
-host running a Kerberos KDC database administration server
-for realm
-.IR realm ,
-as specified in the configuration file (\fI/etc/kerberosIV/krb.conf\fR).
-If the file cannot be opened or is malformed, or there are fewer than
-.I n
-hosts running a Kerberos KDC database administration server,
-the routine returns KFAILURE.
-.PP
-The character arrays used as return values for
-.IR krb_get_krbhst ,
-.IR krb_get_admhst ,
-should be large enough to
-hold any hostname (MAXHOSTNAMELEN from <sys/param.h>).
-.PP
-.I krb_get_lrealm
-fills in
-.I realm
-with the
-.IR n th
-realm of the local host, as specified in the configuration file.
-.I realm
-should be at least REALM_SZ (from
-.IR <krb.h>) characters long.
-.PP
-.SH SEE ALSO
-kerberos(3), krb.conf(5), krb.realms(5)
-.SH FILES
-.TP 20n
-/etc/kerberosIV/krb.realms
-translation file for host-to-realm mapping.
-.TP
-/etc/kerberosIV/krb.conf
-local realm-name and realm/server configuration file.
-.SH BUGS
-The current convention for instance names is too limited; the full
-domain name should be used.
-.PP
-.I krb_get_lrealm
-currently only supports
-.I n
-= 1. It should really consult the user's ticket cache to determine the
-user's current realm, rather than consulting a file on the host.
diff --git a/eBones/man/krb_sendauth.3 b/eBones/man/krb_sendauth.3
deleted file mode 100644
index a749bb5..0000000
--- a/eBones/man/krb_sendauth.3
+++ /dev/null
@@ -1,348 +0,0 @@
-.\" from: krb_sendauth.3,v 4.1 89/01/23 11:10:58 jtkohl Exp $
-.\" $Id: krb_sendauth.3,v 1.1.1.1 1994/09/30 14:50:07 csgr Exp $
-.\" Copyright 1988 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KRB_SENDAUTH 3 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-krb_sendauth, krb_recvauth, krb_net_write, krb_net_read \-
-Kerberos routines for sending authentication via network stream sockets
-.SH SYNOPSIS
-.nf
-.nj
-.ft B
-#include <kerberosIV/krb.h>
-#include <kerberosIV/des.h>
-#include <netinet/in.h>
-.PP
-.fi
-.HP 1i
-.ft B
-int krb_sendauth(options, fd, ktext, service, inst, realm, checksum,
-msg_data, cred, schedule, laddr, faddr, version)
-.nf
-.RS 0
-.ft B
-long options;
-int fd;
-KTEXT ktext;
-char *service, *inst, *realm;
-u_long checksum;
-MSG_DAT *msg_data;
-CREDENTIALS *cred;
-Key_schedule schedule;
-struct sockaddr_in *laddr, *faddr;
-char *version;
-.PP
-.fi
-.HP 1i
-.ft B
-int krb_recvauth(options, fd, ktext, service, inst, faddr, laddr,
-auth_data, filename, schedule, version)
-.nf
-.RS 0
-.ft B
-long options;
-int fd;
-KTEXT ktext;
-char *service, *inst;
-struct sockaddr_in *faddr, *laddr;
-AUTH_DAT *auth_data;
-char *filename;
-Key_schedule schedule;
-char *version;
-.PP
-.ft B
-int krb_net_write(fd, buf, len)
-int fd;
-char *buf;
-int len;
-.PP
-.ft B
-int krb_net_read(fd, buf, len)
-int fd;
-char *buf;
-int len;
-.fi
-.SH DESCRIPTION
-.PP
-These functions,
-which are built on top of the core Kerberos library,
-provide a convenient means for client and server
-programs to send authentication messages
-to one another through network connections.
-The
-.I krb_sendauth
-function sends an authenticated ticket from the client program to
-the server program by writing the ticket to a network socket.
-The
-.I krb_recvauth
-function receives the ticket from the client by
-reading from a network socket.
-
-.SH KRB_SENDAUTH
-.PP
-This function writes the ticket to
-the network socket specified by the
-file descriptor
-.IR fd,
-returning KSUCCESS if the write proceeds successfully,
-and an error code if it does not.
-
-The
-.I ktext
-argument should point to an allocated KTEXT_ST structure.
-The
-.IR service,
-.IR inst,
-and
-.IR realm
-arguments specify the server program's Kerberos principal name,
-instance, and realm.
-If you are writing a client that uses the local realm exclusively,
-you can set the
-.I realm
-argument to NULL.
-
-The
-.I version
-argument allows the client program to pass an application-specific
-version string that the server program can then match against
-its own version string.
-The
-.I version
-string can be up to KSEND_VNO_LEN (see
-.IR <krb.h> )
-characters in length.
-
-The
-.I checksum
-argument can be used to pass checksum information to the
-server program.
-The client program is responsible for specifying this information.
-This checksum information is difficult to corrupt because
-.I krb_sendauth
-passes it over the network in encrypted form.
-The
-.I checksum
-argument is passed as the checksum argument to
-.IR krb_mk_req .
-
-You can set
-.IR krb_sendauth's
-other arguments to NULL unless you want the
-client and server programs to mutually authenticate
-themselves.
-In the case of mutual authentication,
-the client authenticates itself to the server program,
-and demands that the server in turn authenticate itself to
-the client.
-
-.SH KRB_SENDAUTH AND MUTUAL AUTHENTICATION
-.PP
-If you want mutual authentication,
-make sure that you read all pending data from the local socket
-before calling
-.IR krb_sendauth.
-Set
-.IR krb_sendauth's
-.I options
-argument to
-.BR KOPT_DO_MUTUAL
-(this macro is defined in the
-.IR krb.h
-file);
-make sure that the
-.I laddr
-argument points to
-the address of the local socket,
-and that
-.I faddr
-points to the foreign socket's network address.
-
-.I Krb_sendauth
-fills in the other arguments--
-.IR msg_data ,
-.IR cred ,
-and
-.IR schedule --before
-sending the ticket to the server program.
-You must, however, allocate space for these arguments
-before calling the function.
-
-.I Krb_sendauth
-supports two other options:
-.BR KOPT_DONT_MK_REQ,
-and
-.BR KOPT_DONT_CANON.
-If called with
-.I options
-set as KOPT_DONT_MK_REQ,
-.I krb_sendauth
-will not use the
-.I krb_mk_req
-function to retrieve the ticket from the Kerberos server.
-The
-.I ktext
-argument must point to an existing ticket and authenticator (such as
-would be created by
-.IR krb_mk_req ),
-and the
-.IR service,
-.IR inst,
-and
-.IR realm
-arguments can be set to NULL.
-
-If called with
-.I options
-set as KOPT_DONT_CANON,
-.I krb_sendauth
-will not convert the service's instance to canonical form using
-.IR krb_get_phost (3).
-
-If you want to call
-.I krb_sendauth
-with a multiple
-.I options
-specification,
-construct
-.I options
-as a bitwise-OR of the options you want to specify.
-
-.SH KRB_RECVAUTH
-.PP
-The
-.I krb_recvauth
-function
-reads a ticket/authenticator pair from the socket pointed to by the
-.I fd
-argument.
-Set the
-.I options
-argument
-as a bitwise-OR of the options desired.
-Currently only KOPT_DO_MUTUAL is useful to the receiver.
-
-The
-.I ktext
-argument
-should point to an allocated KTEXT_ST structure.
-.I Krb_recvauth
-fills
-.I ktext
-with the
-ticket/authenticator pair read from
-.IR fd ,
-then passes it to
-.IR krb_rd_req .
-
-The
-.I service
-and
-.I inst
-arguments
-specify the expected service and instance for which the ticket was
-generated. They are also passed to
-.IR krb_rd_req.
-The
-.I inst
-argument may be set to "*" if the caller wishes
-.I krb_mk_req
-to fill in the instance used (note that there must be space in the
-.I inst
-argument to hold a full instance name, see
-.IR krb_mk_req (3)).
-
-The
-.I faddr
-argument
-should point to the address of the peer which is presenting the ticket.
-It is also passed to
-.IR krb_rd_req .
-
-If the client and server plan to mutually authenticate
-one another,
-the
-.I laddr
-argument
-should point to the local address of the file descriptor.
-Otherwise you can set this argument to NULL.
-
-The
-.I auth_data
-argument
-should point to an allocated AUTH_DAT area.
-It is passed to and filled in by
-.IR krb_rd_req .
-The checksum passed to the corresponding
-.I krb_sendauth
-is available as part of the filled-in AUTH_DAT area.
-
-The
-.I filename
-argument
-specifies the filename
-which the service program should use to obtain its service key.
-.I Krb_recvauth
-passes
-.I filename
-to the
-.I krb_rd_req
-function.
-If you set this argument to "",
-.I krb_rd_req
-looks for the service key in the file
-.IR /etc/kerberosIV/srvtab.
-
-If the client and server are performing mutual authenication,
-the
-.I schedule
-argument
-should point to an allocated Key_schedule.
-Otherwise it is ignored and may be NULL.
-
-The
-.I version
-argument should point to a character array of at least KSEND_VNO_LEN
-characters. It is filled in with the version string passed by the client to
-.IR krb_sendauth.
-.PP
-.SH KRB_NET_WRITE AND KRB_NET_READ
-.PP
-The
-.I krb_net_write
-function
-emulates the write(2) system call, but guarantees that all data
-specified is written to
-.I fd
-before returning, unless an error condition occurs.
-.PP
-The
-.I krb_net_read
-function
-emulates the read(2) system call, but guarantees that the requested
-amount of data is read from
-.I fd
-before returning, unless an error condition occurs.
-.PP
-.SH BUGS
-.IR krb_sendauth,
-.IR krb_recvauth,
-.IR krb_net_write,
-and
-.IR krb_net_read
-will not work properly on sockets set to non-blocking I/O mode.
-
-.SH SEE ALSO
-
-krb_mk_req(3), krb_rd_req(3), krb_get_phost(3)
-
-.SH AUTHOR
-John T. Kohl, MIT Project Athena
-.SH RESTRICTIONS
-Copyright 1988, Massachusetts Instititute of Technology.
-For copying and distribution information,
-please see the file <Copyright.h>.
diff --git a/eBones/man/krb_set_tkt_string.3 b/eBones/man/krb_set_tkt_string.3
deleted file mode 100644
index 73b5e5d..0000000
--- a/eBones/man/krb_set_tkt_string.3
+++ /dev/null
@@ -1,43 +0,0 @@
-.\" from: krb_set_tkt_string.3,v 4.1 89/01/23 11:11:09 jtkohl Exp $
-.\" $Id: krb_set_tkt_string.3,v 1.1.1.1 1994/09/30 14:50:07 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KRB_SET_TKT_STRING 3 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-krb_set_tkt_string \- set Kerberos ticket cache file name
-.SH SYNOPSIS
-.nf
-.nj
-.ft B
-#include <kerberosIV/krb.h>
-.PP
-.ft B
-void krb_set_tkt_string(filename)
-char *filename;
-.fi
-.ft R
-.SH DESCRIPTION
-.I krb_set_tkt_string
-sets the name of the file that holds the user's
-cache of Kerberos server tickets and associated session keys.
-.PP
-The string
-.I filename
-passed in is copied into local storage.
-Only MAXPATHLEN-1 (see <sys/param.h>) characters of the filename are
-copied in for use as the cache file name.
-.PP
-This routine should be called during initialization, before other
-Kerberos routines are called; otherwise the routines which fetch the
-ticket cache file name may be called and return an undesired ticket file
-name until this routine is called.
-.SH FILES
-.TP 20n
-/tmp/tkt[uid]
-default ticket file name, unless the environment variable KRBTKFILE is set.
-[uid] denotes the user's uid, in decimal.
-.SH SEE ALSO
-kerberos(3), setenv(3)
diff --git a/eBones/man/ksrvtgt.1 b/eBones/man/ksrvtgt.1
deleted file mode 100644
index 129c745..0000000
--- a/eBones/man/ksrvtgt.1
+++ /dev/null
@@ -1,51 +0,0 @@
-.\" from: ksrvtgt.1,v 4.1 89/01/24 14:36:28 jtkohl Exp $
-.\" $Id: ksrvtgt.1,v 1.1.1.1 1994/09/30 14:50:07 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KSRVTGT 1 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-ksrvtgt \- fetch and store Kerberos ticket-granting-ticket using a
-service key
-.SH SYNOPSIS
-.B ksrvtgt
-name instance [[realm] srvtab]
-.SH DESCRIPTION
-.I ksrvtgt
-retrieves a ticket-granting ticket with a lifetime of five (5) minutes
-for the principal
-.I name.instance@realm
-(or
-.I name.instance@localrealm
-if
-.I realm
-is not supplied on the command line), decrypts the response using
-the service key found in
-.I srvtab
-(or in
-.B /etc/kerberosIV/srvtab
-if
-.I srvtab
-is not specified on the command line), and stores the ticket in the
-standard ticket cache.
-.PP
-This command is intended primarily for use in shell scripts and other
-batch-type facilities.
-.SH DIAGNOSTICS
-"Generic kerberos failure (kfailure)" can indicate a whole range of
-problems, the most common of which is the inability to read the service
-key file.
-.SH FILES
-.TP 2i
-/etc/kerberosIV/krb.conf
-to get the name of the local realm.
-.TP
-/tmp/tkt[uid]
-The default ticket file.
-.TP
-/etc/kerberosIV/srvtab
-The default service key file.
-.SH SEE ALSO
-kerberos(1), kinit(1), kdestroy(1)
diff --git a/eBones/man/kstash.8 b/eBones/man/kstash.8
deleted file mode 100644
index ac8c57b..0000000
--- a/eBones/man/kstash.8
+++ /dev/null
@@ -1,44 +0,0 @@
-.\" from: kstash.8,v 4.1 89/01/23 11:11:39 jtkohl Exp $
-.\" $Id: kstash.8,v 1.1.1.1 1994/09/30 14:50:07 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KSTASH 8 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-kstash \- stash Kerberos key distribution center database master key
-.SH SYNOPSIS
-kstash
-.SH DESCRIPTION
-.I kstash
-saves the Kerberos key distribution center (KDC) database master key in
-the master key cache file.
-.PP
-The user is prompted to enter the key, to verify the authenticity of the
-key and the authorization to store the key in the file.
-.SH DIAGNOSTICS
-.TP 20n
-"verify_master_key: Invalid master key, does not match database."
-The master key string entered was incorrect.
-.TP
-"kstash: Unable to open master key file"
-The attempt to open the cache file for writing failed (probably due to a
-system or access permission error).
-.TP
-"kstash: Write I/O error on master key file"
-The
-.BR write (2)
-system call returned an error while
-.I kstash
-was attempting to write the key to the file.
-.SH FILES
-.TP 20n
-/etc/kerberosIV/principal.db
-DBM file containing database
-.TP
-/etc/kerberosIV/principal.ok
-Semaphore indicating that the DBM database is not being modified.
-.TP
-/etc/kerberosIV/master_key
-Master key cache file.
diff --git a/eBones/man/kuserok.3 b/eBones/man/kuserok.3
deleted file mode 100644
index c7581a6..0000000
--- a/eBones/man/kuserok.3
+++ /dev/null
@@ -1,63 +0,0 @@
-.\" from: kuserok.3,v 4.1 89/01/23 11:11:49 jtkohl Exp $
-.\" $Id: kuserok.3,v 1.1.1.1 1994/09/30 14:50:07 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KUSEROK 3 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-kuserok \- Kerberos version of ruserok
-.SH SYNOPSIS
-.nf
-.nj
-.ft B
-#include <kerberosIV/krb.h>
-.PP
-.ft B
-kuserok(kdata, localuser)
-AUTH_DAT *auth_data;
-char *localuser;
-.fi
-.ft R
-.SH DESCRIPTION
-.I kuserok
-determines whether a Kerberos principal described by the structure
-.I auth_data
-is authorized to login as user
-.I localuser
-according to the authorization file
-("~\fIlocaluser\fR/.klogin" by default). It returns 0 (zero) if authorized,
-1 (one) if not authorized.
-.PP
-If there is no account for
-.I localuser
-on the local machine, authorization is not granted.
-If there is no authorization file, and the Kerberos principal described
-by
-.I auth_data
-translates to
-.I localuser
-(using
-.IR krb_kntoln (3)),
-authorization is granted.
-If the authorization file
-can't be accessed, or the file is not owned by
-.IR localuser,
-authorization is denied. Otherwise, the file is searched for
-a matching principal name, instance, and realm. If a match is found,
-authorization is granted, else authorization is denied.
-.PP
-The file entries are in the format:
-.nf
-.in +5n
- name.instance@realm
-.in -5n
-.fi
-with one entry per line.
-.SH SEE ALSO
-kerberos(3), ruserok(3), krb_kntoln(3)
-.SH FILES
-.TP 20n
-~\fIlocaluser\fR/.klogin
-authorization list
diff --git a/eBones/man/tf_util.3 b/eBones/man/tf_util.3
deleted file mode 100644
index ee6e436..0000000
--- a/eBones/man/tf_util.3
+++ /dev/null
@@ -1,151 +0,0 @@
-.\" from: tf_util.3,v 4.2 89/04/25 17:17:11 jtkohl Exp $
-.\" $Id: tf_util.3,v 1.1.1.1 1994/09/30 14:50:08 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH TF_UTIL 3 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-tf_init, tf_get_pname, tf_get_pinst, tf_get_cred, tf_close \
-\- Routines for manipulating a Kerberos ticket file
-.SH SYNOPSIS
-.nf
-.nj
-.ft B
-#include <kerberosIV/krb.h>
-.PP
-.ft B
-extern char *krb_err_txt[];
-.PP
-.ft B
-tf_init(tf_name, rw)
-char *tf_name;
-int rw;
-.PP
-.ft B
-tf_get_pname(pname)
-char *pname;
-.PP
-.ft B
-tf_get_pinst(pinst)
-char *pinst;
-.PP
-.ft B
-tf_get_cred(c)
-CREDENTIALS *c;
-.PP
-.ft B
-tf_close()
-.PP
-.fi
-.SH DESCRIPTION
-This group of routines are provided to manipulate the Kerberos tickets
-file. A ticket file has the following format:
-.nf
-.in +4
-.sp
-principal's name (null-terminated string)
-principal's instance (null-terminated string)
-CREDENTIAL_1
-CREDENTIAL_2
- ...
-CREDENTIAL_n
-EOF
-.sp
-.in -4
-.LP
-Where "CREDENTIAL_x" consists of the following fixed-length
-fields from the CREDENTIALS structure (defined in <krb.h>):
-.nf
-.sp
-.in +4
- char service[ANAME_SZ]
- char instance[INST_SZ]
- char realm[REALM_SZ]
- des_cblock session
- int lifetime
- int kvno
- KTEXT_ST ticket_st
- long issue_date
-.in -4
-.sp
-.fi
-.PP
-.I tf_init
-must be called before the other ticket file
-routines.
-It takes the name of the ticket file to use,
-and a read/write flag as arguments.
-It tries to open the ticket file, checks the mode and if
-everything is okay, locks the file. If it's opened for
-reading, the lock is shared. If it's opened for writing,
-the lock is exclusive.
-KSUCCESS is returned if all went well, otherwise one of the
-following:
-.nf
-.sp
-NO_TKT_FIL - file wasn't there
-TKT_FIL_ACC - file was in wrong mode, etc.
-TKT_FIL_LCK - couldn't lock the file, even after a retry
-.sp
-.fi
-.PP
-The
-.I tf_get_pname
-reads the principal's name from a ticket file.
-It should only be called after tf_init has been called. The
-principal's name is filled into the
-.I pname
-parameter. If all goes
-well, KSUCCESS is returned.
-If tf_init wasn't called, TKT_FIL_INI
-is returned.
-If the principal's name was null, or EOF was encountered, or the
-name was longer than ANAME_SZ, TKT_FIL_FMT is returned.
-.PP
-The
-.I tf_get_pinst
-reads the principal's instance from a ticket file.
-It should only be called after tf_init and tf_get_pname
-have been called.
-The principal's instance is filled into the
-.I pinst
-parameter.
-If all goes
-well, KSUCCESS is returned.
-If tf_init wasn't called, TKT_FIL_INI
-is returned.
-If EOF was encountered, or the
-name was longer than INST_SZ, TKT_FIL_FMT is returned.
-Note that, unlike the principal name, the instance name may be null.
-.PP
-The
-.I tf_get_cred
-routine reads a CREDENTIALS record from a ticket file and
-fills in the given structure.
-It should only be called after
-tf_init, tf_get_pname, and tf_get_pinst have been called.
-If all goes well, KSUCCESS is returned. Possible error codes
-are:
-.nf
-.sp
-TKT_FIL_INI - tf_init wasn't called first
-TKT_FIL_FMT - bad format
-EOF - end of file encountered
-.sp
-.fi
-.PP
-.I tf_close
-closes the ticket file and releases the lock on it.
-.SH "SEE ALSO"
-krb(3)
-.SH DIAGNOSTICS
-.SH BUGS
-The ticket file routines have to be called in a certain order.
-.SH AUTHORS
-Jennifer Steiner, MIT Project Athena
-.br
-Bill Bryant, MIT Project Athena
-.SH RESTRICTIONS
-Copyright 1987 Massachusetts Institute of Technology
diff --git a/eBones/passwd/HOW-TO b/eBones/passwd/HOW-TO
deleted file mode 100644
index aad3b9c..0000000
--- a/eBones/passwd/HOW-TO
+++ /dev/null
@@ -1,247 +0,0 @@
-Here's how to regenerate this from the original eBones:
-
-1) Copy kpasswd.c from the admin directory.
-2) perl -spi.bak -e 's/\$(Header[^\$]*)\$/$1/g' *.[ch]
-3) Apply the following patch:
-
-*** /home/wollman/kpasswd.orig/kpasswd.c Fri Jan 20 16:01:36 1995
---- kpasswd.c Fri Jan 20 16:29:57 1995
-***************
-*** 1,10 ****
- /*
-- * $Source: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kpasswd.c,v $
-- * $Author: jtkohl $
-- *
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
-! * <mit-copyright.h>.
- *
- * change your password with kerberos
---- 1,7 ----
- /*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
-! * Copyright.MIT.
- *
- * change your password with kerberos
-***************
-*** 12,20 ****
-
- #ifndef lint
- static char rcsid_kpasswd_c[] =
- "BonesHeader: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kpasswd.c,v 4.3 89/09/26 09:33:02 jtkohl Exp ";
- #endif lint
-
-- #include <mit-copyright.h>
- /*
- * kpasswd
---- 9,20 ----
-
- #ifndef lint
-+ #if 0
- static char rcsid_kpasswd_c[] =
- "BonesHeader: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kpasswd.c,v 4.3 89/09/26 09:33:02 jtkohl Exp ";
-+ #endif
-+ static const char rcsid[] =
-+ "$Id$";
- #endif lint
-
- /*
- * kpasswd
-***************
-*** 28,36 ****
- #include "kadm.h"
-
- extern void krb_set_tkt_string();
-
-! main(argc,argv)
-! int argc;
-! char *argv[];
- {
- char name[ANAME_SZ]; /* name of user */
---- 28,38 ----
- #include "kadm.h"
-
-+ #include "extern.h"
-+
- extern void krb_set_tkt_string();
-+ static void go_home(char *, int);
-
-!
-! int krb_passwd(char *uname, char *iflag, char *rflag, char *uflag)
- {
- char name[ANAME_SZ]; /* name of user */
-***************
-*** 66,74 ****
- default_realm) != KSUCCESS) {
- pw = getpwuid((int) getuid());
-! if (pw)
-! (void) strcpy(default_name, pw->pw_name);
-! else
- /* seems like a null name is kinda silly */
-! (void) strcpy(default_name, "");
- strcpy(default_inst, "");
- if (krb_get_lrealm(default_realm, 1) != KSUCCESS)
---- 68,77 ----
- default_realm) != KSUCCESS) {
- pw = getpwuid((int) getuid());
-! if (pw) {
-! strcpy(default_name, pw->pw_name);
-! } else {
- /* seems like a null name is kinda silly */
-! strcpy(default_name, "");
-! }
- strcpy(default_inst, "");
- if (krb_get_lrealm(default_realm, 1) != KSUCCESS)
-***************
-*** 76,85 ****
- }
-
-! while ((c = getopt(argc, argv, "u:n:i:r:h")) != EOF) {
-! switch (c) {
-! case 'u':
-! if (status = kname_parse(name, inst, realm, optarg)) {
-! fprintf(stderr, "Kerberos error: %s\n", krb_err_txt[status]);
-! exit(2);
- }
- if (realm[0])
---- 79,85 ----
- }
-
-! if(uflag) {
-! if (status = kname_parse(name, inst, realm, uflag)) {
-! errx(2, "Kerberos error: %s", krb_err_txt[status]);
- }
- if (realm[0])
-***************
-*** 88,130 ****
- if (krb_get_lrealm(realm, 1) != KSUCCESS)
- strcpy(realm, KRB_REALM);
-! break;
-! case 'n':
-! if (k_isname(optarg))
-! (void) strncpy(name, optarg, sizeof(name) - 1);
-! else {
-! fprintf(stderr, "Bad name: %s\n", optarg);
-! usage(1);
-! }
-! break;
-! case 'i':
-! if (k_isinst(optarg))
-! (void) strncpy(inst, optarg, sizeof(inst) - 1);
-! else {
-! fprintf(stderr, "Bad instance: %s\n", optarg);
-! usage(1);
- }
-! (void) strcpy(inst, optarg);
-! break;
-! case 'r':
-! if (k_isrealm(optarg)) {
-! (void) strncpy(realm, optarg, sizeof(realm) - 1);
-! realm_given++;
- }
-! else {
-! fprintf(stderr, "Bad realm: %s\n", optarg);
-! usage(1);
- }
-- break;
-- case 'h':
-- usage(0);
-- break;
-- default:
-- usage(1);
-- break;
-- }
-- use_default = 0;
- }
-! if (optind < argc)
-! usage(1);
-
- if (use_default) {
---- 88,119 ----
- if (krb_get_lrealm(realm, 1) != KSUCCESS)
- strcpy(realm, KRB_REALM);
-! }
-!
-! if(uname) {
-! if (k_isname(uname)) {
-! strncpy(name, uname, sizeof(name) - 1);
-! } else {
-! errx(1, "bad name: %s", uname);
- }
-! }
-!
-! if(iflag) {
-! if (k_isinst(iflag)) {
-! strncpy(inst, iflag, sizeof(inst) - 1);
-! } else {
-! errx(1, "bad instance: %s", iflag);
- }
-! }
-!
-! if(rflag) {
-! if (k_isrealm(rflag)) {
-! strncpy(realm, rflag, sizeof(realm) - 1);
-! realm_given++;
-! } else {
-! errx(1, "bad realm: %s", rflag);
- }
- }
-!
-! if(uname || iflag || rflag || uflag) use_default = 0;
-
- if (use_default) {
-***************
-*** 132,137 ****
- strcpy(inst, default_inst);
- strcpy(realm, default_realm);
-! }
-! else {
- if (!name[0])
- strcpy(name, default_name);
---- 121,125 ----
- strcpy(inst, default_inst);
- strcpy(realm, default_realm);
-! } else {
- if (!name[0])
- strcpy(name, default_name);
-***************
-*** 147,153 ****
- if ((status = kadm_init_link("changepw", KRB_MASTER, realm))
- != KADM_SUCCESS)
-! com_err(argv[0], status, "while initializing");
- else if ((status = kadm_change_pw(new_key)) != KADM_SUCCESS)
-! com_err(argv[0], status, " attempting to change password.");
-
- if (status != KADM_SUCCESS)
---- 135,141 ----
- if ((status = kadm_init_link("changepw", KRB_MASTER, realm))
- != KADM_SUCCESS)
-! com_err("kpasswd", status, "while initializing");
- else if ((status = kadm_change_pw(new_key)) != KADM_SUCCESS)
-! com_err("kpasswd", status, " attempting to change password.");
-
- if (status != KADM_SUCCESS)
-***************
-*** 225,237 ****
- }
-
-! usage(value)
-! int value;
-! {
-! fprintf(stderr, "Usage: ");
-! fprintf(stderr, "kpasswd [-h ] [-n user] [-i instance] [-r realm] ");
-! fprintf(stderr, "[-u fullname]\n");
-! exit(value);
-! }
-!
- go_home(str,x)
- char *str;
---- 213,217 ----
- }
-
-! static void
- go_home(str,x)
- char *str;
diff --git a/eBones/passwd/Makefile b/eBones/passwd/Makefile
deleted file mode 100644
index 5dba6a3..0000000
--- a/eBones/passwd/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-# $Id$
-
-PROG= passwd
-BINDIR= /usr/bin
-
-SRCS= local_passwd.c passwd.c pw_copy.c pw_util.c kpasswd.c
-.PATH: ${.CURDIR}/../../usr.bin/chpass ${.CURDIR}/../../usr.sbin/vipw \
- ${.CURDIR}/../../usr.bin/rlogin ${.CURDIR}/../../usr.bin/passwd
-CFLAGS+= -DKERBEROS -DPOSIX \
- -I${.CURDIR} -I${.CURDIR}/../../usr.sbin/vipw \
- -I${.CURDIR}/../../usr.bin/chpass \
- -I${.CURDIR}/../../usr.bin/passwd \
- -I${.CURDIR}/../include \
- -I${.CURDIR}/../libkadm
-LDADD= -L${KADMOBJDIR} -lkadm -L${KRBOBJDIR} -lkrb -L${DESOBJDIR} -ldes \
- -lcrypt -lcom_err
-
-BINOWN= root
-BINMODE=4555
-INSTALLFLAGS= -fschg
-NOMAN= #man page installed by regular passwd
-
-.include <bsd.prog.mk>
diff --git a/eBones/passwd/kpasswd.c b/eBones/passwd/kpasswd.c
deleted file mode 100644
index 56e76a3..0000000
--- a/eBones/passwd/kpasswd.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * Copyright.MIT.
- *
- * change your password with kerberos
- */
-
-#ifndef lint
-#if 0
-static char rcsid_kpasswd_c[] =
- "BonesHeader: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kpasswd.c,v 4.3 89/09/26 09:33:02 jtkohl Exp ";
-#endif
-static const char rcsid[] =
- "$Id: kpasswd.c,v 1.1 1995/07/18 16:41:20 mark Exp $";
-#endif lint
-
-/*
- * kpasswd
- * change your password with kerberos
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/param.h>
-#include <pwd.h>
-#include "kadm.h"
-
-#include "extern.h"
-
-extern void krb_set_tkt_string();
-static void go_home(char *, int);
-
-
-int krb_passwd(char *uname, char *iflag, char *rflag, char *uflag)
-{
- char name[ANAME_SZ]; /* name of user */
- char inst[INST_SZ]; /* instance of user */
- char realm[REALM_SZ]; /* realm of user */
- char default_name[ANAME_SZ];
- char default_inst[INST_SZ];
- char default_realm[REALM_SZ];
- int realm_given = 0; /* True if realm was give on cmdline */
- int use_default = 1; /* True if we should use default name */
- struct passwd *pw;
- int status; /* return code */
- des_cblock new_key;
- int c;
- extern char *optarg;
- extern int optind;
- char tktstring[MAXPATHLEN];
-
- void get_pw_new_key();
-
-#ifdef NOENCRYPTION
-#define read_long_pw_string placebo_read_pw_string
-#else
-#define read_long_pw_string des_read_pw_string
-#endif
- int read_long_pw_string();
-
- bzero(name, sizeof(name));
- bzero(inst, sizeof(inst));
- bzero(realm, sizeof(realm));
-
- if (krb_get_tf_fullname(TKT_FILE, default_name, default_inst,
- default_realm) != KSUCCESS) {
- pw = getpwuid((int) getuid());
- if (pw) {
- strcpy(default_name, pw->pw_name);
- } else {
- /* seems like a null name is kinda silly */
- strcpy(default_name, "");
- }
- strcpy(default_inst, "");
- if (krb_get_lrealm(default_realm, 1) != KSUCCESS)
- strcpy(default_realm, KRB_REALM);
- }
-
- if(uflag) {
- if (status = kname_parse(name, inst, realm, uflag)) {
- errx(2, "Kerberos error: %s", krb_err_txt[status]);
- }
- if (realm[0])
- realm_given++;
- else
- if (krb_get_lrealm(realm, 1) != KSUCCESS)
- strcpy(realm, KRB_REALM);
- }
-
- if(uname) {
- if (k_isname(uname)) {
- strncpy(name, uname, sizeof(name) - 1);
- } else {
- errx(1, "bad name: %s", uname);
- }
- }
-
- if(iflag) {
- if (k_isinst(iflag)) {
- strncpy(inst, iflag, sizeof(inst) - 1);
- } else {
- errx(1, "bad instance: %s", iflag);
- }
- }
-
- if(rflag) {
- if (k_isrealm(rflag)) {
- strncpy(realm, rflag, sizeof(realm) - 1);
- realm_given++;
- } else {
- errx(1, "bad realm: %s", rflag);
- }
- }
-
- if(uname || iflag || rflag || uflag) use_default = 0;
-
- if (use_default) {
- strcpy(name, default_name);
- strcpy(inst, default_inst);
- strcpy(realm, default_realm);
- } else {
- if (!name[0])
- strcpy(name, default_name);
- if (!realm[0])
- strcpy(realm, default_realm);
- }
-
- (void) sprintf(tktstring, "/tmp/tkt_cpw_%d",getpid());
- krb_set_tkt_string(tktstring);
-
- get_pw_new_key(new_key, name, inst, realm, realm_given);
-
- if ((status = kadm_init_link("changepw", KRB_MASTER, realm))
- != KADM_SUCCESS)
- com_err("kpasswd", status, "while initializing");
- else if ((status = kadm_change_pw(new_key)) != KADM_SUCCESS)
- com_err("kpasswd", status, " attempting to change password.");
-
- if (status != KADM_SUCCESS)
- fprintf(stderr,"Password NOT changed.\n");
- else
- printf("Password changed.\n");
-
- (void) dest_tkt();
- if (status)
- exit(2);
- else
- exit(0);
-}
-
-void get_pw_new_key(new_key, name, inst, realm, print_realm)
- des_cblock new_key;
- char *name;
- char *inst;
- char *realm;
- int print_realm; /* True if realm was give on cmdline */
-{
- char ppromp[40+ANAME_SZ+INST_SZ+REALM_SZ]; /* for the password prompt */
- char pword[MAX_KPW_LEN]; /* storage for the password */
- char npromp[40+ANAME_SZ+INST_SZ+REALM_SZ]; /* for the password prompt */
-
- char local_realm[REALM_SZ];
- int status;
-
- /*
- * We don't care about failure; this is to determine whether or
- * not to print the realm in the prompt for a new password.
- */
- (void) krb_get_lrealm(local_realm, 1);
-
- if (strcmp(local_realm, realm))
- print_realm++;
-
- (void) sprintf(ppromp,"Old password for %s%s%s%s%s:",
- name, *inst ? "." : "", inst,
- print_realm ? "@" : "", print_realm ? realm : "");
- if (read_long_pw_string(pword, sizeof(pword)-1, ppromp, 0)) {
- fprintf(stderr, "Error reading old password.\n");
- exit(1);
- }
-
- if ((status = krb_get_pw_in_tkt(name, inst, realm, PWSERV_NAME,
- KADM_SINST, 1, pword)) != KSUCCESS) {
- if (status == INTK_BADPW) {
- printf("Incorrect old password.\n");
- exit(0);
- }
- else {
- fprintf(stderr, "Kerberos error: %s\n", krb_err_txt[status]);
- exit(1);
- }
- }
- bzero(pword, sizeof(pword));
- do {
- (void) sprintf(npromp,"New Password for %s%s%s%s%s:",
- name, *inst ? "." : "", inst,
- print_realm ? "@" : "", print_realm ? realm : "");
- if (read_long_pw_string(pword, sizeof(pword)-1, npromp, 1))
- go_home("Error reading new password, password unchanged.\n",0);
- if (strlen(pword) == 0)
- printf("Null passwords are not allowed; try again.\n");
- } while (strlen(pword) == 0);
-
-#ifdef NOENCRYPTION
- bzero((char *) new_key, sizeof(des_cblock));
- new_key[0] = (unsigned char) 1;
-#else
- (void) des_string_to_key(pword, new_key);
-#endif
- bzero(pword, sizeof(pword));
-}
-
-static void
-go_home(str,x)
- char *str;
- int x;
-{
- fprintf(stderr, str, x);
- (void) dest_tkt();
- exit(1);
-}
diff --git a/eBones/register/Makefile b/eBones/register/Makefile
deleted file mode 100644
index 9adfc93..0000000
--- a/eBones/register/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/1/93
-# $Id: Makefile,v 1.5 1995/07/18 16:41:22 mark Exp $
-
-PROG= register
-SRCS= register.c
-CFLAGS+=-DCRYPT -DDEBUG -DKERBEROS -I${.CURDIR}/../include -Wall
-.PATH: ${.CURDIR}/../../usr.bin/rlogin
-DPADD= ${LIBKRB}
-LDADD= -L${KRBOBJDIR} -lkrb -ldes -lcrypt
-BINDIR= /usr/bin
-BINOWN= root
-BINMODE=4555
-
-.include <bsd.prog.mk>
diff --git a/eBones/register/register.c b/eBones/register/register.c
deleted file mode 100644
index 4f083a7..0000000
--- a/eBones/register/register.c
+++ /dev/null
@@ -1,315 +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 0
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1989, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-static char sccsid[] = "@(#)register.c 8.1 (Berkeley) 6/1/93";
-#endif /* not lint */
-#endif
-
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/socket.h>
-#include <sys/file.h>
-#include <sys/signal.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <netdb.h>
-#include <des.h>
-#include <krb.h>
-#include "pathnames.h"
-#include "register_proto.h"
-
-#define SERVICE "krbupdate" /* service to add to KDC's database */
-#define PROTOCOL "tcp"
-
-void die(void);
-void type_info(void);
-void setup_key(struct sockaddr_in local);
-void cleanup(void);
-int get_user_info(void);
-
-char realm[REALM_SZ];
-char krbhst[MAX_HSTNM];
-
-static char pname[ANAME_SZ];
-static char iname[INST_SZ];
-static char password[_PASSWORD_LEN];
-
-void
-main(argc, argv)
- int argc;
- char **argv;
-{
- struct servent *se;
- struct hostent *host;
- struct sockaddr_in sin, local;
- int rval;
- int sock, llen;
- u_char code;
- static struct rlimit rl = { 0, 0 };
-
- signal(SIGPIPE, (__sighandler_t *)die);
-
- if (setrlimit(RLIMIT_CORE, &rl) < 0) {
- perror("rlimit");
- exit(1);
- }
-
- if ((se = getservbyname(SERVICE, PROTOCOL)) == NULL) {
- fprintf(stderr, "couldn't find entry for service %s\n",
- SERVICE);
- exit(1);
- }
- if ((rval = krb_get_lrealm(realm,0)) != KSUCCESS) {
- fprintf(stderr, "couldn't get local Kerberos realm: %s\n",
- krb_err_txt[rval]);
- exit(1);
- }
-
- if ((rval = krb_get_krbhst(krbhst, realm, 1)) != KSUCCESS) {
- fprintf(stderr, "couldn't get Kerberos host: %s\n",
- krb_err_txt[rval]);
- exit(1);
- }
-
- if ((host = gethostbyname(krbhst)) == NULL) {
- fprintf(stderr, "couldn't get host entry for host %s\n",
- krbhst);
- exit(1);
- }
-
- sin.sin_family = host->h_addrtype;
- (void)bcopy(host->h_addr, (char *) &sin.sin_addr, host->h_length);
- sin.sin_port = se->s_port;
-
- if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
- perror("socket");
- exit(1);
- }
-
- if (connect(sock, (struct sockaddr *) &sin, sizeof(sin)) < 0) {
- perror("connect");
- (void)close(sock);
- exit(1);
- }
-
- llen = sizeof(local);
- if (getsockname(sock, (struct sockaddr *) &local, &llen) < 0) {
- perror("getsockname");
- (void)close(sock);
- exit(1);
- }
-
- setup_key(local);
-
- type_info();
-
- if (!get_user_info()) {
- code = ABORT;
- (void)des_write(sock, &code, 1);
- cleanup();
- exit(1);
- }
-
- code = APPEND_DB;
- if (des_write(sock, &code, 1) != 1) {
- perror("write 1");
- cleanup();
- exit(1);
- }
-
- if (des_write(sock, pname, ANAME_SZ) != ANAME_SZ) {
- perror("write principal name");
- cleanup();
- exit(1);
- }
-
- if (des_write(sock, iname, INST_SZ) != INST_SZ) {
- perror("write instance name");
- cleanup();
- exit(1);
- }
-
- if (des_write(sock, password, 255) != 255) {
- perror("write password");
- cleanup();
- exit(1);
- }
-
- /* get return message */
-
- {
- int cc;
- char msgbuf[BUFSIZ];
-
- cc = read(sock, msgbuf, BUFSIZ);
- if (cc <= 0) {
- fprintf(stderr, "protocol error during key verification\n");
- cleanup();
- exit(1);
- }
- if (strncmp(msgbuf, GOTKEY_MSG, 6) != 0) {
- fprintf(stderr, "%s: %s", krbhst, msgbuf);
- cleanup();
- exit(1);
- }
-
- cc = des_read(sock, msgbuf, BUFSIZ);
- if (cc <= 0) {
- fprintf(stderr, "protocol error during read\n");
- cleanup();
- exit(1);
- } else {
- printf("%s: %s", krbhst, msgbuf);
- }
- }
-
- cleanup();
- close(sock);
-}
-
-void
-cleanup()
-{
- bzero(password, 255);
-}
-
-extern char *crypt();
-extern char *getpass();
-
-int
-get_user_info()
-{
- int uid = getuid();
- int valid = 0, i;
- struct passwd *pw;
- char *pas, *namep;
-
- /* NB: we must run setuid-root to get at the real pw file */
-
- if ((pw = getpwuid(uid)) == NULL) {
- fprintf(stderr, "Who are you?\n");
- return(0);
- }
- (void)seteuid(uid);
- (void)strcpy(pname, pw->pw_name); /* principal name */
-
- for (i = 1; i < 3; i++) {
- pas = getpass("login password:");
- namep = crypt(pas, pw->pw_passwd);
- if (strcmp(namep, pw->pw_passwd)) {
- fprintf(stderr, "Password incorrect\n");
- continue;
- } else {
- valid = 1;
- break;
- }
- }
- if (!valid)
- return(0);
- pas = getpass("Kerberos password (may be the same):");
- while (*pas == NULL) {
- printf("<NULL> password not allowed\n");
- pas = getpass("Kerberos password (may be the same):");
- }
- (void)strcpy(password, pas); /* password */
- pas = getpass("Retype Kerberos password:");
- if (strcmp(password, pas)) {
- fprintf(stderr, "Password mismatch -- aborted\n");
- return(0);
- }
-
- iname[0] = NULL; /* null instance name */
- return(1);
-}
-
-void
-setup_key(local)
- struct sockaddr_in local;
-{
- static struct keyfile_data kdata;
- static Key_schedule schedule;
- int fd;
- char namebuf[MAXPATHLEN];
-
- (void) sprintf(namebuf, "%s%s",
- CLIENT_KEYFILE,
- inet_ntoa(local.sin_addr));
-
- fd = open(namebuf, O_RDONLY);
- if (fd < 0) {
- fprintf(stderr, "couldn't open key file %s for local host: ",
- namebuf);
- perror("");
- exit(1);
- }
-
- if (read(fd, (char *)&kdata, sizeof(kdata)) != sizeof(kdata)) {
- fprintf(stderr,"size error reading key file for local host %s\n",
- inet_ntoa(local.sin_addr));
- exit(1);
- }
- key_sched((des_cblock *)kdata.kf_key, schedule);
- des_set_key((des_cblock *)kdata.kf_key, schedule);
- return;
-}
-
-void
-type_info()
-{
- printf("Kerberos user registration (realm %s)\n\n", realm);
- printf("Please enter your login password followed by your new Kerberos password.\n");
- printf("The Kerberos password you enter now will be used in the future\n");
- printf("as your Kerberos password for all machines in the %s realm.\n", realm);
- printf("You will only be allowed to perform this operation once, although you may run\n");
- printf("the %s program from now on to change your Kerberos password.\n\n", _PATH_KPASSWD);
-}
-
-void
-die()
-{
- fprintf(stderr, "\nServer no longer listening\n");
- fflush(stderr);
- cleanup();
- exit(1);
-}
diff --git a/eBones/registerd/Makefile b/eBones/registerd/Makefile
deleted file mode 100644
index 89b6ca7..0000000
--- a/eBones/registerd/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# Copyright (c) 1990 The Regents of the University of California.
-# All rights reserved.
-#
-# %sccs.include.redist.sh
-#
-# @(#)Makefile 8.1 (Berkeley) 6/1/93
-#
-# $Id: Makefile,v 1.4 1995/07/18 16:41:24 mark Exp $
-
-PROG= registerd
-SRCS= registerd.c
-CFLAGS+=-DCRYPT -DKERBEROS -I${.CURDIR}/../register \
- -I${.CURDIR}/../include -Wall
-.PATH: ${.CURDIR}/../../usr.bin/rlogin
-DPADD= ${LIBKDB} ${LIBKRB}
-LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -ldes
-MAN8= registerd.8
-BINDIR= /usr/libexec
-
-.include <bsd.prog.mk>
diff --git a/eBones/registerd/registerd.c b/eBones/registerd/registerd.c
deleted file mode 100644
index 12a3939..0000000
--- a/eBones/registerd/registerd.c
+++ /dev/null
@@ -1,354 +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.
- */
-
-#if 0
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1990, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-static char sccsid[] = "@(#)registerd.c 8.1 (Berkeley) 6/1/93";
-#endif /* not lint */
-#endif
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/signal.h>
-#include <sys/resource.h>
-#include <sys/param.h>
-#include <sys/file.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <syslog.h>
-#include <des.h>
-#include <krb.h>
-#include <krb_db.h>
-#include <string.h>
-#include <stdio.h>
-#include <unistd.h>
-#include "register_proto.h"
-#include "pathnames.h"
-
-#define KBUFSIZ (sizeof(struct keyfile_data))
-#define RCRYPT 0x00
-#define CLEAR 0x01
-
-char *progname, msgbuf[BUFSIZ];
-
-void cleanup(void);
-void die(void);
-void send_packet(char *msg, int flag);
-int net_get_principal(char *pname, char *iname, C_Block *keyp);
-int do_append(struct sockaddr_in *sinp);
-
-void
-main(argc, argv)
- int argc;
- char **argv;
-{
- static Key_schedule schedule;
- static struct rlimit rl = { 0, 0 };
- struct keyfile_data *kfile;
- u_char code;
- int kf, retval, sval;
- struct sockaddr_in sin;
- char keyfile[MAXPATHLEN], keybuf[KBUFSIZ];
-
- progname = argv[0]; /* for the library routines */
-
- openlog("registerd", LOG_PID, LOG_AUTH);
-
- signal(SIGHUP, SIG_IGN);
- signal(SIGINT, SIG_IGN);
- signal(SIGTSTP, SIG_IGN);
- signal(SIGPIPE, (__sighandler_t *)die);
-
- if (setrlimit(RLIMIT_CORE, &rl) < 0) {
- syslog(LOG_ERR, "setrlimit: %m");
- exit(1);
- }
-
-
- /* figure out who we are talking to */
-
- sval = sizeof(sin);
- if (getpeername(0, (struct sockaddr *) &sin, &sval) < 0) {
- syslog(LOG_ERR, "getpeername: %m");
- exit(1);
- }
-
- /* get encryption key */
-
- (void) sprintf(keyfile, "%s/%s%s",
- SERVER_KEYDIR,
- KEYFILE_BASE,
- inet_ntoa(sin.sin_addr));
-
- if ((kf = open(keyfile, O_RDONLY)) < 0) {
- syslog(LOG_ERR,
- "error opening Kerberos update keyfile (%s): %m", keyfile);
- sprintf(msgbuf,
- "couldn't open session keyfile for your host");
- send_packet(msgbuf, CLEAR);
- exit(1);
- }
-
- if (read(kf, keybuf, KBUFSIZ) != KBUFSIZ) {
- syslog(LOG_ERR, "wrong read size of Kerberos update keyfile");
- sprintf(msgbuf,
- "couldn't read session key from your host's keyfile");
- send_packet(msgbuf, CLEAR);
- exit(1);
- }
- sprintf(msgbuf, GOTKEY_MSG);
- send_packet(msgbuf, CLEAR);
- kfile = (struct keyfile_data *) keybuf;
- key_sched((C_Block *)kfile->kf_key, schedule);
- des_set_key((des_cblock *)kfile->kf_key, schedule);
-
- /* read the command code byte */
-
- if (des_read(0, &code, 1) == 1) {
-
- switch(code) {
- case APPEND_DB:
- retval = do_append(&sin);
- break;
- case ABORT:
- cleanup();
- close(0);
- exit(0);
- default:
- retval = KFAILURE;
- syslog(LOG_NOTICE,
- "invalid command code on db update (0x%x)",
- code);
- }
-
- } else {
- retval = KFAILURE;
- syslog(LOG_ERR,
- "couldn't read command code on Kerberos update");
- }
-
- code = (u_char) retval;
- if (code != KSUCCESS) {
- sprintf(msgbuf, "%s", krb_err_txt[code]);
- send_packet(msgbuf, RCRYPT);
- } else {
- sprintf(msgbuf, "Update complete.");
- send_packet(msgbuf, RCRYPT);
- }
- cleanup();
- close(0);
- exit(0);
-}
-
-#define MAX_PRINCIPAL 10
-static Principal principal_data[MAX_PRINCIPAL];
-static C_Block key, master_key;
-static Key_schedule master_key_schedule;
-
-int
-do_append(sinp)
- struct sockaddr_in *sinp;
-{
- Principal default_princ;
- char input_name[ANAME_SZ];
- char input_instance[INST_SZ];
- int j,n, more;
- long mkeyversion;
-
-
-
- /* get master key from MKEYFILE */
- if (kdb_get_master_key(0, master_key, master_key_schedule) != 0) {
- syslog(LOG_ERR, "couldn't get master key");
- return(KFAILURE);
- }
-
- mkeyversion = kdb_verify_master_key(master_key, master_key_schedule, NULL);
- if (mkeyversion < 0) {
- syslog(LOG_ERR, "couldn't validate master key");
- return(KFAILURE);
- }
-
- n = kerb_get_principal(KERB_DEFAULT_NAME, KERB_DEFAULT_INST,
- &default_princ, 1, &more);
-
- if (n != 1) {
- syslog(LOG_ERR, "couldn't get default principal");
- return(KFAILURE);
- }
-
- /*
- * get principal name, instance, and password from network.
- * convert password to key and store it
- */
-
- if (net_get_principal(input_name, input_instance, (C_Block *)key) != 0) {
- return(KFAILURE);
- }
-
-
- j = kerb_get_principal(
- input_name,
- input_instance,
- principal_data,
- MAX_PRINCIPAL,
- &more
- );
-
- if (j != 0) {
- /* already in database, no update */
- syslog(LOG_NOTICE,
- "attempt to add duplicate entry for principal %s.%s",
- input_name, input_instance);
- return(KDC_PR_N_UNIQUE);
- }
-
- /*
- * set up principal's name, instance
- */
-
- strcpy(principal_data[0].name, input_name);
- strcpy(principal_data[0].instance, input_instance);
- principal_data[0].old = NULL;
-
-
- /* and the expiration date and version #s */
-
- principal_data[0].exp_date = default_princ.exp_date;
- strcpy(principal_data[0].exp_date_txt, default_princ.exp_date_txt);
- principal_data[0].max_life = default_princ.max_life;
- principal_data[0].attributes = default_princ.attributes;
- principal_data[0].kdc_key_ver = default_princ.kdc_key_ver;
-
-
- /* and the key */
-
- kdb_encrypt_key(key, key, master_key, master_key_schedule,
- ENCRYPT);
- bcopy(key, &principal_data[0].key_low, 4);
- bcopy(((long *) key) + 1, &principal_data[0].key_high,4);
- bzero(key, sizeof(key));
-
- principal_data[0].key_version = 1; /* 1st entry */
-
- /* and write it to the database */
-
- if (kerb_put_principal(&principal_data[0], 1)) {
- syslog(LOG_INFO, "Kerberos update failure: put_principal failed");
- return(KFAILURE);
- }
-
- syslog(LOG_NOTICE, "Kerberos update: wrote new record for %s.%s from %s",
- principal_data[0].name,
- principal_data[0].instance,
- inet_ntoa(sinp->sin_addr)
- );
-
- return(KSUCCESS);
-
-}
-
-void
-send_packet(msg,flag)
- char *msg;
- int flag;
-{
- int len = strlen(msg);
- msg[len++] = '\n';
- msg[len] = '\0';
- if (len > sizeof(msgbuf)) {
- syslog(LOG_ERR, "send_packet: invalid msg size");
- return;
- }
- if (flag == RCRYPT) {
- if (des_write(0, msg, len) != len)
- syslog(LOG_ERR, "couldn't write reply message");
- } else if (flag == CLEAR) {
- if (write(0, msg, len) != len)
- syslog(LOG_ERR, "couldn't write reply message");
- } else
- syslog(LOG_ERR, "send_packet: invalid flag (%d)", flag);
-
-}
-
-int
-net_get_principal(pname, iname, keyp)
- char *pname, *iname;
- C_Block *keyp;
-{
- int cc;
- static char password[255];
-
- cc = des_read(0, pname, ANAME_SZ);
- if (cc != ANAME_SZ) {
- syslog(LOG_ERR, "couldn't get principal name");
- return(-1);
- }
-
- cc = des_read(0, iname, INST_SZ);
- if (cc != INST_SZ) {
- syslog(LOG_ERR, "couldn't get instance name");
- return(-1);
- }
-
- cc = des_read(0, password, 255);
- if (cc != 255) {
- syslog(LOG_ERR, "couldn't get password");
- bzero(password, 255);
- return(-1);
- }
-
- string_to_key(password, (des_cblock *)*keyp);
- bzero(password, 255);
- return(0);
-}
-
-void
-cleanup()
-{
- bzero(master_key, sizeof(master_key));
- bzero(key, sizeof(key));
- bzero(master_key_schedule, sizeof(master_key_schedule));
-}
-
-void
-die()
-{
- syslog(LOG_ERR, "remote end died (SIGPIPE)");
- cleanup();
- exit(1);
-}
diff --git a/eBones/usr.sbin/kadmin/Makefile b/eBones/usr.sbin/kadmin/Makefile
deleted file mode 100644
index f2e0357..0000000
--- a/eBones/usr.sbin/kadmin/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# $Id: Makefile,v 1.1 1995/07/18 16:36:59 mark Exp $
-
-PROG= kadmind
-SRCS= admin_server.c kadm_funcs.c kadm_ser_wrap.c kadm_server.c
-CFLAGS+=-DPOSIX -I${.CURDIR}/../include -I${KRBOBJDIR} \
- -I${.CURDIR}/../libkadm -I${KADMOBJDIR} -Wall
-LDADD+= -L${KADMOBJDIR} -lkadm -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb \
- -ldes -L${ACLOBJDIR} -lacl -lcom_err
-MAN8= kadmind.8
-
-.include <bsd.prog.mk>
diff --git a/eBones/usr.sbin/kadmin/admin_server.c b/eBones/usr.sbin/kadmin/admin_server.c
deleted file mode 100644
index 72980d4..0000000
--- a/eBones/usr.sbin/kadmin/admin_server.c
+++ /dev/null
@@ -1,474 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * Copyright.MIT.
- *
- * Top-level loop of the kerberos Administration server
- */
-
-#if 0
-#ifndef lint
-static char rcsid_admin_server_c[] =
-"Id: admin_server.c,v 4.8 90/01/02 13:50:38 jtkohl Exp ";
-static const char rcsid[] =
- "$Id";
-#endif lint
-#endif
-
-/*
- admin_server.c
- this holds the main loop and initialization and cleanup code for the server
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <signal.h>
-#ifndef sigmask
-#define sigmask(m) (1 <<((m)-1))
-#endif
-#include <sys/wait.h>
-#include <errno.h>
-#include <sys/socket.h>
-#include <syslog.h>
-#include <com_err.h>
-#include <kadm.h>
-#include <kadm_err.h>
-#include <krb_db.h>
-#include "kadm_server.h"
-
-/* Almost all procs and such need this, so it is global */
-admin_params prm; /* The command line parameters struct */
-
-char prog[32]; /* WHY IS THIS NEEDED??????? */
-char *progname = prog;
-char *acldir = DEFAULT_ACL_DIR;
-char krbrlm[REALM_SZ];
-extern Kadm_Server server_parm;
-
-void cleanexit(int val);
-void process_client(int fd, struct sockaddr_in *who);
-void kill_children(void);
-static void clear_secrets(void);
-void byebye(void);
-void close_syslog(void);
-int kadm_listen(void);
-
-/*
-** Main does the logical thing, it sets up the database and RPC interface,
-** as well as handling the creation and maintenance of the syslog file...
-*/
-void
-main(argc, argv) /* admin_server main routine */
-int argc;
-char *argv[];
-{
- int errval;
- int c;
- extern char *optarg;
-
- prog[sizeof(prog)-1]='\0'; /* Terminate... */
- (void) strncpy(prog, argv[0], sizeof(prog)-1);
-
- /* initialize the admin_params structure */
- prm.sysfile = KADM_SYSLOG; /* default file name */
- prm.inter = 1;
-
- bzero(krbrlm, sizeof(krbrlm));
-
- while ((c = getopt(argc, argv, "f:hnd:a:r:")) != EOF)
- switch(c) {
- case 'f': /* Syslog file name change */
- prm.sysfile = optarg;
- break;
- case 'n':
- prm.inter = 0;
- break;
- case 'a': /* new acl directory */
- acldir = optarg;
- break;
- case 'd':
- /* put code to deal with alt database place */
- if ((errval = kerb_db_set_name(optarg))) {
- fprintf(stderr, "opening database %s: %s",
- optarg, error_message(errval));
- exit(1);
- }
- break;
- case 'r':
- (void) strncpy(krbrlm, optarg, sizeof(krbrlm) - 1);
- break;
- case 'h': /* get help on using admin_server */
- default:
- printf("Usage: admin_server [-h] [-n] [-r realm] [-d dbname] [-f filename] [-a acldir]\n");
- exit(-1); /* failure */
- }
-
- if (krbrlm[0] == 0)
- if (krb_get_lrealm(krbrlm, 0) != KSUCCESS) {
- fprintf(stderr,
- "Unable to get local realm. Fix krb.conf or use -r.\n");
- exit(1);
- }
-
- printf("KADM Server %s initializing\n",KADM_VERSTR);
- printf("Please do not use 'kill -9' to kill this job, use a\n");
- printf("regular kill instead\n\n");
-
- set_logfile(prm.sysfile);
- log("Admin server starting");
-
- (void) kerb_db_set_lockmode(KERB_DBL_NONBLOCKING);
- errval = kerb_init(); /* Open the Kerberos database */
- if (errval) {
- fprintf(stderr, "error: kerb_init() failed");
- close_syslog();
- byebye();
- }
- /* set up the server_parm struct */
- if ((errval = kadm_ser_init(prm.inter, krbrlm))==KADM_SUCCESS) {
- kerb_fini(); /* Close the Kerberos database--
- will re-open later */
- errval = kadm_listen(); /* listen for calls to server from
- clients */
- }
- if (errval != KADM_SUCCESS) {
- fprintf(stderr,"error: %s\n",error_message(errval));
- kerb_fini(); /* Close if error */
- }
- close_syslog(); /* Close syslog file, print
- closing note */
- byebye(); /* Say bye bye on the terminal
- in use */
-} /* procedure main */
-
-
-/* close the system log file */
-void
-close_syslog()
-{
- log("Shutting down admin server");
-}
-
-void
-byebye() /* say goodnight gracie */
-{
- printf("Admin Server (kadm server) has completed operation.\n");
-}
-
-static void
-clear_secrets()
-{
- bzero((char *)server_parm.master_key, sizeof(server_parm.master_key));
- bzero((char *)server_parm.master_key_schedule,
- sizeof(server_parm.master_key_schedule));
- server_parm.master_key_version = 0L;
-}
-
-static exit_now = 0;
-
-sigtype
-doexit()
-{
- exit_now = 1;
-#ifdef POSIX
- return;
-#else /* !POSIX */
- return(0);
-#endif /* POSIX */
-}
-
-unsigned pidarraysize = 0;
-int *pidarray = (int *)0;
-
-/*
-kadm_listen
-listen on the admin servers port for a request
-*/
-int
-kadm_listen()
-{
- extern int errno;
- int found;
- int admin_fd;
- int peer_fd;
- fd_set mask, readfds;
- struct sockaddr_in peer;
- int addrlen;
- int pid;
- sigtype do_child();
-
- (void) signal(SIGINT, doexit);
- (void) signal(SIGTERM, doexit);
- (void) signal(SIGHUP, doexit);
- (void) signal(SIGQUIT, doexit);
- (void) signal(SIGPIPE, SIG_IGN); /* get errors on write() */
- (void) signal(SIGALRM, doexit);
- (void) signal(SIGCHLD, do_child);
-
- if ((admin_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
- return KADM_NO_SOCK;
- if (bind(admin_fd, (struct sockaddr *)&server_parm.admin_addr,
- sizeof(struct sockaddr_in)) < 0)
- return KADM_NO_BIND;
- (void) listen(admin_fd, 1);
- FD_ZERO(&mask);
- FD_SET(admin_fd, &mask);
-
- for (;;) { /* loop nearly forever */
- if (exit_now) {
- clear_secrets();
- kill_children();
- return(0);
- }
- readfds = mask;
- if ((found = select(admin_fd+1,&readfds,(fd_set *)0,
- (fd_set *)0, (struct timeval *)0)) == 0)
- continue; /* no things read */
- if (found < 0) {
- if (errno != EINTR)
- log("select: %s",error_message(errno));
- continue;
- }
- if (FD_ISSET(admin_fd, &readfds)) {
- /* accept the conn */
- addrlen = sizeof(peer);
- if ((peer_fd = accept(admin_fd, (struct sockaddr *)&peer,
- &addrlen)) < 0) {
- log("accept: %s",error_message(errno));
- continue;
- }
- addrlen = sizeof(server_parm.admin_addr);
- if (getsockname(peer_fd, (struct sockaddr *)&server_parm.admin_addr,
- &addrlen)) {
- log("getsockname: %s",error_message(errno));
- continue;
- }
-#ifdef DEBUG
- printf("Connection recieved on %s\n",
- inet_ntoa(server_parm.admin_addr.sin_addr));
-#endif /* DEBUG */
-#ifndef DEBUG
- /* if you want a sep daemon for each server */
- if ((pid = fork())) {
- /* parent */
- if (pid < 0) {
- log("fork: %s",error_message(errno));
- (void) close(peer_fd);
- continue;
- }
- /* fork succeded: keep tabs on child */
- (void) close(peer_fd);
- if (pidarray) {
- pidarray = (int *)realloc((char *)pidarray, ++pidarraysize);
- pidarray[pidarraysize-1] = pid;
- } else {
- pidarray = (int *)malloc(pidarraysize = 1);
- pidarray[0] = pid;
- }
- } else {
- /* child */
- (void) close(admin_fd);
-#endif /* DEBUG */
- /* do stuff */
- process_client (peer_fd, &peer);
-#ifndef DEBUG
- }
-#endif
- } else {
- log("something else woke me up!");
- return(0);
- }
- }
- /*NOTREACHED*/
- return(0); /* Shut -Wall up - markm */
-}
-
-#ifdef DEBUG
-#define cleanexit(code) {kerb_fini(); return;}
-#endif
-
-void
-process_client(fd, who)
-int fd;
-struct sockaddr_in *who;
-{
- u_char *dat;
- int dat_len;
- u_short dlen;
- int retval;
- int on = 1;
- Principal service;
- des_cblock skey;
- int more;
- int status;
-
- if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on)) < 0)
- log("setsockopt keepalive: %d",errno);
-
- server_parm.recv_addr = *who;
-
- if (kerb_init()) { /* Open as client */
- log("can't open krb db");
- cleanexit(1);
- }
- /* need to set service key to changepw.KRB_MASTER */
-
- status = kerb_get_principal(server_parm.sname, server_parm.sinst, &service,
- 1, &more);
- if (status == -1) {
- /* db locked */
- u_long retcode = KADM_DB_INUSE;
- char *pdat;
-
- dat_len = KADM_VERSIZE + sizeof(u_long);
- dat = (u_char *) malloc((unsigned)dat_len);
- pdat = (char *) dat;
- retcode = htonl((u_long) KADM_DB_INUSE);
- (void) strncpy(pdat, KADM_ULOSE, KADM_VERSIZE);
- bcopy((char *)&retcode, &pdat[KADM_VERSIZE], sizeof(u_long));
- goto out;
- } else if (!status) {
- log("no service %s.%s",server_parm.sname, server_parm.sinst);
- cleanexit(2);
- }
-
- bcopy((char *)&service.key_low, (char *)skey, 4);
- bcopy((char *)&service.key_high, (char *)(((long *) skey) + 1), 4);
- bzero((char *)&service, sizeof(service));
- kdb_encrypt_key (skey, skey, server_parm.master_key,
- server_parm.master_key_schedule, DECRYPT);
- (void) krb_set_key((char *)skey, 0); /* if error, will show up when
- rd_req fails */
- bzero((char *)skey, sizeof(skey));
-
- while (1) {
- if ((retval = krb_net_read(fd, (char *)&dlen, sizeof(u_short))) !=
- sizeof(u_short)) {
- if (retval < 0)
- log("dlen read: %s",error_message(errno));
- else if (retval)
- log("short dlen read: %d",retval);
- (void) close(fd);
- cleanexit(retval ? 3 : 0);
- }
- if (exit_now) {
- cleanexit(0);
- }
- dat_len = (int) ntohs(dlen);
- dat = (u_char *) malloc((unsigned)dat_len);
- if (!dat) {
- log("malloc: No memory");
- (void) close(fd);
- cleanexit(4);
- }
- if ((retval = krb_net_read(fd, (char *)dat, dat_len)) != dat_len) {
- if (retval < 0)
- log("data read: %s",error_message(errno));
- else
- log("short read: %d vs. %d", dat_len, retval);
- (void) close(fd);
- cleanexit(5);
- }
- if (exit_now) {
- cleanexit(0);
- }
- if ((retval = kadm_ser_in(&dat,&dat_len)) != KADM_SUCCESS)
- log("processing request: %s", error_message(retval));
-
- /* kadm_ser_in did the processing and returned stuff in
- dat & dat_len , return the appropriate data */
-
- out:
- dlen = (u_short) dat_len;
-
- if (dat_len != (int)dlen) {
- clear_secrets();
- abort(); /* XXX */
- }
- dlen = htons(dlen);
-
- if (krb_net_write(fd, (char *)&dlen, sizeof(u_short)) < 0) {
- log("writing dlen to client: %s",error_message(errno));
- (void) close(fd);
- cleanexit(6);
- }
-
- if (krb_net_write(fd, (char *)dat, dat_len) < 0) {
- log(LOG_ERR, "writing to client: %s",error_message(errno));
- (void) close(fd);
- cleanexit(7);
- }
- free((char *)dat);
- }
- /*NOTREACHED*/
-}
-
-sigtype
-do_child()
-{
- /* SIGCHLD brings us here */
- int pid;
- register int i, j;
-
-#ifdef POSIX
- int status;
-#else
- union wait status;
-#endif
-
- pid = wait(&status);
-
- for (i = 0; i < pidarraysize; i++)
- if (pidarray[i] == pid) {
- /* found it */
- for (j = i; j < pidarraysize-1; j++)
- /* copy others down */
- pidarray[j] = pidarray[j+1];
- pidarraysize--;
- if (WEXITSTATUS(status) || WCOREDUMP(status) || WIFSIGNALED(status))
- log("child %d: termsig %d, coredump %d, retcode %d", pid,
- WTERMSIG(status), WCOREDUMP(status), WEXITSTATUS(status));
-#ifdef POSIX
- return;
-#else /* !POSIX */
- return(0);
-#endif /* POSIX */
- }
- log("child %d not in list: termsig %d, coredump %d, retcode %d", pid,
- WTERMSIG(status), WCOREDUMP(status), WEXITSTATUS(status));
-#ifdef POSIX
- return;
-#else /* !POSIX */
- return(0);
-#endif /* POSIX */
-}
-
-#ifndef DEBUG
-void
-cleanexit(val)
- int val;
-{
- kerb_fini();
- clear_secrets();
- exit(val);
-}
-#endif
-
-void
-kill_children()
-{
- register int i;
- int osigmask;
-
- osigmask = sigblock(sigmask(SIGCHLD));
-
- for (i = 0; i < pidarraysize; i++) {
- kill(pidarray[i], SIGINT);
- log("killing child %d", pidarray[i]);
- }
- sigsetmask(osigmask);
- return;
-}
diff --git a/eBones/usr.sbin/kadmin/kadm_funcs.c b/eBones/usr.sbin/kadmin/kadm_funcs.c
deleted file mode 100644
index b8ddaa0..0000000
--- a/eBones/usr.sbin/kadmin/kadm_funcs.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * Copyright.MIT
- *
- * Kerberos administration server-side database manipulation routines
- */
-
-#if 0
-#ifndef lint
-static char rcsid_kadm_funcs_c[] =
-"Id: kadm_funcs.c,v 4.3 90/03/20 01:39:51 jon Exp ";
-static const char rcsid[] =
- "$Id: kadm_funcs.c,v 1.1 1995/07/18 16:37:02 mark Exp $";
-#endif lint
-#endif
-
-/*
-kadm_funcs.c
-the actual database manipulation code
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <com_err.h>
-#include <sys/param.h>
-#include <kadm.h>
-#include <kadm_err.h>
-#include <krb_db.h>
-#include "kadm_server.h"
-
-extern Kadm_Server server_parm;
-
-int
-check_access(pname, pinst, prealm, acltype)
-char *pname;
-char *pinst;
-char *prealm;
-enum acl_types acltype;
-{
- char checkname[MAX_K_NAME_SZ];
- char filename[MAXPATHLEN];
- extern char *acldir;
-
- sprintf(checkname, "%s.%s@%s", pname, pinst, prealm);
-
- switch (acltype) {
- case ADDACL:
- sprintf(filename, "%s%s", acldir, ADD_ACL_FILE);
- break;
- case GETACL:
- sprintf(filename, "%s%s", acldir, GET_ACL_FILE);
- break;
- case MODACL:
- sprintf(filename, "%s%s", acldir, MOD_ACL_FILE);
- break;
- }
- return(acl_check(filename, checkname));
-}
-
-int
-wildcard(str)
-char *str;
-{
- if (!strcmp(str, WILDCARD_STR))
- return(1);
- return(0);
-}
-
-#define failadd(code) { (void) log("FAILED addding '%s.%s' (%s)", valsin->name, valsin->instance, error_message(code)); return code; }
-
-int
-kadm_add_entry (rname, rinstance, rrealm, valsin, valsout)
-char *rname; /* requestors name */
-char *rinstance; /* requestors instance */
-char *rrealm; /* requestors realm */
-Kadm_vals *valsin;
-Kadm_vals *valsout;
-{
- long numfound; /* check how many we get written */
- int more; /* pointer to more grabbed records */
- Principal data_i, data_o; /* temporary principal */
- u_char flags[4];
- des_cblock newpw;
- Principal default_princ;
-
- if (!check_access(rname, rinstance, rrealm, ADDACL)) {
- (void) log("WARNING: '%s.%s@%s' tried to add an entry for '%s.%s'",
- rname, rinstance, rrealm, valsin->name, valsin->instance);
- return KADM_UNAUTH;
- }
-
- /* Need to check here for "legal" name and instance */
- if (wildcard(valsin->name) || wildcard(valsin->instance)) {
- failadd(KADM_ILL_WILDCARD);
- }
-
- (void) log("request to add an entry for '%s.%s' from '%s.%s@%s'",
- valsin->name, valsin->instance, rname, rinstance, rrealm);
-
- numfound = kerb_get_principal(KERB_DEFAULT_NAME, KERB_DEFAULT_INST,
- &default_princ, 1, &more);
- if (numfound == -1) {
- failadd(KADM_DB_INUSE);
- } else if (numfound != 1) {
- failadd(KADM_UK_RERROR);
- }
-
- kadm_vals_to_prin(valsin->fields, &data_i, valsin);
- (void) strncpy(data_i.name, valsin->name, ANAME_SZ);
- (void) strncpy(data_i.instance, valsin->instance, INST_SZ);
-
- if (!IS_FIELD(KADM_EXPDATE,valsin->fields))
- data_i.exp_date = default_princ.exp_date;
- if (!IS_FIELD(KADM_ATTR,valsin->fields))
- data_i.attributes = default_princ.attributes;
- if (!IS_FIELD(KADM_MAXLIFE,valsin->fields))
- data_i.max_life = default_princ.max_life;
-
- bzero((char *)&default_princ, sizeof(default_princ));
-
- /* convert to host order */
- data_i.key_low = ntohl(data_i.key_low);
- data_i.key_high = ntohl(data_i.key_high);
-
-
- bcopy(&data_i.key_low,newpw,4);
- bcopy(&data_i.key_high,(char *)(((long *) newpw) + 1),4);
-
- /* encrypt new key in master key */
- kdb_encrypt_key (newpw, newpw, server_parm.master_key,
- server_parm.master_key_schedule, ENCRYPT);
- bcopy(newpw,&data_i.key_low,4);
- bcopy((char *)(((long *) newpw) + 1), &data_i.key_high,4);
- bzero((char *)newpw, sizeof(newpw));
-
- data_o = data_i;
- numfound = kerb_get_principal(valsin->name, valsin->instance,
- &data_o, 1, &more);
- if (numfound == -1) {
- failadd(KADM_DB_INUSE);
- } else if (numfound) {
- failadd(KADM_INUSE);
- } else {
- data_i.key_version++;
- data_i.kdc_key_ver = server_parm.master_key_version;
- (void) strncpy(data_i.mod_name, rname, sizeof(data_i.mod_name)-1);
- (void) strncpy(data_i.mod_instance, rinstance,
- sizeof(data_i.mod_instance)-1);
-
- numfound = kerb_put_principal(&data_i, 1);
- if (numfound == -1) {
- failadd(KADM_DB_INUSE);
- } else if (numfound) {
- failadd(KADM_UK_SERROR);
- } else {
- numfound = kerb_get_principal(valsin->name, valsin->instance,
- &data_o, 1, &more);
- if ((numfound!=1) || (more!=0)) {
- failadd(KADM_UK_RERROR);
- }
- bzero((char *)flags, sizeof(flags));
- SET_FIELD(KADM_NAME,flags);
- SET_FIELD(KADM_INST,flags);
- SET_FIELD(KADM_EXPDATE,flags);
- SET_FIELD(KADM_ATTR,flags);
- SET_FIELD(KADM_MAXLIFE,flags);
- kadm_prin_to_vals(flags, valsout, &data_o);
- (void) log("'%s.%s' added.", valsin->name, valsin->instance);
- return KADM_DATA; /* Set all the appropriate fields */
- }
- }
-}
-#undef failadd
-
-#define failget(code) { (void) log("FAILED retrieving '%s.%s' (%s)", valsin->name, valsin->instance, error_message(code)); return code; }
-
-int
-kadm_get_entry (rname, rinstance, rrealm, valsin, flags, valsout)
-char *rname; /* requestors name */
-char *rinstance; /* requestors instance */
-char *rrealm; /* requestors realm */
-Kadm_vals *valsin; /* what they wannt to get */
-u_char *flags; /* which fields we want */
-Kadm_vals *valsout; /* what data is there */
-{
- long numfound; /* check how many were returned */
- int more; /* To point to more name.instances */
- Principal data_o; /* Data object to hold Principal */
-
-
- if (!check_access(rname, rinstance, rrealm, GETACL)) {
- (void) log("WARNING: '%s.%s@%s' tried to get '%s.%s's entry",
- rname, rinstance, rrealm, valsin->name, valsin->instance);
- return KADM_UNAUTH;
- }
-
- if (wildcard(valsin->name) || wildcard(valsin->instance)) {
- failget(KADM_ILL_WILDCARD);
- }
-
- (void) log("retrieve '%s.%s's entry for '%s.%s@%s'",
- valsin->name, valsin->instance, rname, rinstance, rrealm);
-
- /* Look up the record in the database */
- numfound = kerb_get_principal(valsin->name, valsin->instance,
- &data_o, 1, &more);
- if (numfound == -1) {
- failget(KADM_DB_INUSE);
- } else if (numfound) { /* We got the record, let's return it */
- kadm_prin_to_vals(flags, valsout, &data_o);
- (void) log("'%s.%s' retrieved.", valsin->name, valsin->instance);
- return KADM_DATA; /* Set all the appropriate fields */
- } else {
- failget(KADM_NOENTRY); /* Else whimper and moan */
- }
-}
-#undef failget
-
-#define failmod(code) { (void) log("FAILED modifying '%s.%s' (%s)", valsin1->name, valsin1->instance, error_message(code)); return code; }
-
-int
-kadm_mod_entry (rname, rinstance, rrealm, valsin1, valsin2, valsout)
-char *rname; /* requestors name */
-char *rinstance; /* requestors instance */
-char *rrealm; /* requestors realm */
-Kadm_vals *valsin1, *valsin2; /* holds the parameters being
- passed in */
-Kadm_vals *valsout; /* the actual record which is returned */
-{
- long numfound;
- int more;
- Principal data_o, temp_key;
- u_char fields[4];
- des_cblock newpw;
-
- if (wildcard(valsin1->name) || wildcard(valsin1->instance)) {
- failmod(KADM_ILL_WILDCARD);
- }
-
- if (!check_access(rname, rinstance, rrealm, MODACL)) {
- (void) log("WARNING: '%s.%s@%s' tried to change '%s.%s's entry",
- rname, rinstance, rrealm, valsin1->name, valsin1->instance);
- return KADM_UNAUTH;
- }
-
- (void) log("request to modify '%s.%s's entry from '%s.%s@%s' ",
- valsin1->name, valsin1->instance, rname, rinstance, rrealm);
-
- numfound = kerb_get_principal(valsin1->name, valsin1->instance,
- &data_o, 1, &more);
- if (numfound == -1) {
- failmod(KADM_DB_INUSE);
- } else if (numfound) {
- kadm_vals_to_prin(valsin2->fields, &temp_key, valsin2);
- (void) strncpy(data_o.name, valsin1->name, ANAME_SZ);
- (void) strncpy(data_o.instance, valsin1->instance, INST_SZ);
- if (IS_FIELD(KADM_EXPDATE,valsin2->fields))
- data_o.exp_date = temp_key.exp_date;
- if (IS_FIELD(KADM_ATTR,valsin2->fields))
- data_o.attributes = temp_key.attributes;
- if (IS_FIELD(KADM_MAXLIFE,valsin2->fields))
- data_o.max_life = temp_key.max_life;
- if (IS_FIELD(KADM_DESKEY,valsin2->fields)) {
- data_o.key_version++;
- data_o.kdc_key_ver = server_parm.master_key_version;
-
-
- /* convert to host order */
- temp_key.key_low = ntohl(temp_key.key_low);
- temp_key.key_high = ntohl(temp_key.key_high);
-
-
- bcopy(&temp_key.key_low,newpw,4);
- bcopy(&temp_key.key_high,(char *)(((long *) newpw) + 1),4);
-
- /* encrypt new key in master key */
- kdb_encrypt_key (newpw, newpw, server_parm.master_key,
- server_parm.master_key_schedule, ENCRYPT);
- bcopy(newpw,&data_o.key_low,4);
- bcopy((char *)(((long *) newpw) + 1), &data_o.key_high,4);
- bzero((char *)newpw, sizeof(newpw));
- }
- bzero((char *)&temp_key, sizeof(temp_key));
-
- (void) strncpy(data_o.mod_name, rname, sizeof(data_o.mod_name)-1);
- (void) strncpy(data_o.mod_instance, rinstance,
- sizeof(data_o.mod_instance)-1);
- more = kerb_put_principal(&data_o, 1);
-
- bzero((char *)&data_o, sizeof(data_o));
-
- if (more == -1) {
- failmod(KADM_DB_INUSE);
- } else if (more) {
- failmod(KADM_UK_SERROR);
- } else {
- numfound = kerb_get_principal(valsin1->name, valsin1->instance,
- &data_o, 1, &more);
- if ((more!=0)||(numfound!=1)) {
- failmod(KADM_UK_RERROR);
- }
- bzero((char *) fields, sizeof(fields));
- SET_FIELD(KADM_NAME,fields);
- SET_FIELD(KADM_INST,fields);
- SET_FIELD(KADM_EXPDATE,fields);
- SET_FIELD(KADM_ATTR,fields);
- SET_FIELD(KADM_MAXLIFE,fields);
- kadm_prin_to_vals(fields, valsout, &data_o);
- (void) log("'%s.%s' modified.", valsin1->name, valsin1->instance);
- return KADM_DATA; /* Set all the appropriate fields */
- }
- }
- else {
- failmod(KADM_NOENTRY);
- }
-}
-#undef failmod
-
-#define failchange(code) { (void) log("FAILED changing key for '%s.%s@%s' (%s)", rname, rinstance, rrealm, error_message(code)); return code; }
-
-int
-kadm_change (rname, rinstance, rrealm, newpw)
-char *rname;
-char *rinstance;
-char *rrealm;
-des_cblock newpw;
-{
- long numfound;
- int more;
- Principal data_o;
- des_cblock local_pw;
-
- if (strcmp(server_parm.krbrlm, rrealm)) {
- (void) log("change key request from wrong realm, '%s.%s@%s'!\n",
- rname, rinstance, rrealm);
- return(KADM_WRONG_REALM);
- }
-
- if (wildcard(rname) || wildcard(rinstance)) {
- failchange(KADM_ILL_WILDCARD);
- }
- (void) log("'%s.%s@%s' wants to change its password",
- rname, rinstance, rrealm);
-
- bcopy(newpw, local_pw, sizeof(local_pw));
-
- /* encrypt new key in master key */
- kdb_encrypt_key (local_pw, local_pw, server_parm.master_key,
- server_parm.master_key_schedule, ENCRYPT);
-
- numfound = kerb_get_principal(rname, rinstance,
- &data_o, 1, &more);
- if (numfound == -1) {
- failchange(KADM_DB_INUSE);
- } else if (numfound) {
- bcopy(local_pw,&data_o.key_low,4);
- bcopy((char *)(((long *) local_pw) + 1), &data_o.key_high,4);
- data_o.key_version++;
- data_o.kdc_key_ver = server_parm.master_key_version;
- (void) strncpy(data_o.mod_name, rname, sizeof(data_o.mod_name)-1);
- (void) strncpy(data_o.mod_instance, rinstance,
- sizeof(data_o.mod_instance)-1);
- more = kerb_put_principal(&data_o, 1);
- bzero((char *) local_pw, sizeof(local_pw));
- bzero((char *) &data_o, sizeof(data_o));
- if (more == -1) {
- failchange(KADM_DB_INUSE);
- } else if (more) {
- failchange(KADM_UK_SERROR);
- } else {
- (void) log("'%s.%s@%s' password changed.", rname, rinstance, rrealm);
- return KADM_SUCCESS;
- }
- }
- else {
- failchange(KADM_NOENTRY);
- }
-}
-#undef failchange
diff --git a/eBones/usr.sbin/kadmin/kadm_ser_wrap.c b/eBones/usr.sbin/kadmin/kadm_ser_wrap.c
deleted file mode 100644
index 0fa1ace..0000000
--- a/eBones/usr.sbin/kadmin/kadm_ser_wrap.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * Copyright.MIT.
- *
- * Kerberos administration server-side support functions
- */
-
-#if 0
-#ifndef lint
-static char rcsid_module_c[] =
-"BonesHeader: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadm_ser_wrap.c,v 4.4 89/09/26 09:29:36 jtkohl Exp ";
-#endif lint
-#endif
-
-/*
-kadm_ser_wrap.c
-unwraps wrapped packets and calls the appropriate server subroutine
-*/
-
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <kadm.h>
-#include <kadm_err.h>
-#include <krb_err.h>
-#include "kadm_server.h"
-
-Kadm_Server server_parm;
-
-/*
-kadm_ser_init
-set up the server_parm structure
-*/
-int
-kadm_ser_init(inter, realm)
-int inter; /* interactive or from file */
-char realm[];
-{
- struct servent *sep;
- struct hostent *hp;
- char hostname[MAXHOSTNAMELEN];
-
- init_kadm_err_tbl();
- init_krb_err_tbl();
- if (gethostname(hostname, sizeof(hostname)))
- return KADM_NO_HOSTNAME;
-
- strcpy(server_parm.sname, PWSERV_NAME);
- strcpy(server_parm.sinst, KRB_MASTER);
- strcpy(server_parm.krbrlm, realm);
-
- server_parm.admin_fd = -1;
- /* setting up the addrs */
- if ((sep = getservbyname(KADM_SNAME, "tcp")) == NULL)
- return KADM_NO_SERV;
- bzero((char *)&server_parm.admin_addr,sizeof(server_parm.admin_addr));
- server_parm.admin_addr.sin_family = AF_INET;
- if ((hp = gethostbyname(hostname)) == NULL)
- return KADM_NO_HOSTNAME;
- server_parm.admin_addr.sin_addr.s_addr = INADDR_ANY;
- server_parm.admin_addr.sin_port = sep->s_port;
- /* setting up the database */
- if (kdb_get_master_key((inter==1),server_parm.master_key,
- server_parm.master_key_schedule) != 0)
- return KADM_NO_MAST;
- if ((server_parm.master_key_version =
- kdb_verify_master_key(server_parm.master_key,
- server_parm.master_key_schedule,stderr))<0)
- return KADM_NO_VERI;
- return KADM_SUCCESS;
-}
-
-static void
-errpkt(dat, dat_len, code)
-u_char **dat;
-int *dat_len;
-int code;
-{
- u_long retcode;
- char *pdat;
-
- free((char *)*dat); /* free up req */
- *dat_len = KADM_VERSIZE + sizeof(u_long);
- *dat = (u_char *) malloc((unsigned)*dat_len);
- pdat = (char *) *dat;
- retcode = htonl((u_long) code);
- (void) strncpy(pdat, KADM_ULOSE, KADM_VERSIZE);
- bcopy((char *)&retcode, &pdat[KADM_VERSIZE], sizeof(u_long));
- return;
-}
-
-/*
-kadm_ser_in
-unwrap the data stored in dat, process, and return it.
-*/
-int
-kadm_ser_in(dat,dat_len)
-u_char **dat;
-int *dat_len;
-{
- u_char *in_st; /* pointer into the sent packet */
- int in_len,retc; /* where in packet we are, for
- returns */
- u_long r_len; /* length of the actual packet */
- KTEXT_ST authent; /* the authenticator */
- AUTH_DAT ad; /* who is this, klink */
- u_long ncksum; /* checksum of encrypted data */
- des_key_schedule sess_sched; /* our schedule */
- MSG_DAT msg_st;
- u_char *retdat, *tmpdat;
- int retval, retlen;
-
- if (strncmp(KADM_VERSTR, (char *)*dat, KADM_VERSIZE)) {
- errpkt(dat, dat_len, KADM_BAD_VER);
- return KADM_BAD_VER;
- }
- in_len = KADM_VERSIZE;
- /* get the length */
- if ((retc = stv_long(*dat, &r_len, in_len, *dat_len)) < 0)
- return KADM_LENGTH_ERROR;
- in_len += retc;
- authent.length = *dat_len - r_len - KADM_VERSIZE - sizeof(u_long);
- bcopy((char *)(*dat) + in_len, (char *)authent.dat, authent.length);
- authent.mbz = 0;
- /* service key should be set before here */
- if ((retc = krb_rd_req(&authent, server_parm.sname, server_parm.sinst,
- server_parm.recv_addr.sin_addr.s_addr, &ad, (char *)0)))
- {
- errpkt(dat, dat_len,retc + krb_err_base);
- return retc + krb_err_base;
- }
-
-#define clr_cli_secrets() {bzero((char *)sess_sched, sizeof(sess_sched)); bzero((char *)ad.session, sizeof(ad.session));}
-
- in_st = *dat + *dat_len - r_len;
-#ifdef NOENCRYPTION
- ncksum = 0;
-#else
- ncksum = quad_cksum((des_cblock *)in_st, (des_cblock *)0, (long) r_len,
- 0, (des_cblock *)ad.session);
-#endif
- if (ncksum!=ad.checksum) { /* yow, are we correct yet */
- clr_cli_secrets();
- errpkt(dat, dat_len,KADM_BAD_CHK);
- return KADM_BAD_CHK;
- }
-#ifdef NOENCRYPTION
- bzero(sess_sched, sizeof(sess_sched));
-#else
- des_key_sched((des_cblock *)ad.session, sess_sched);
-#endif
- if ((retc = (int) krb_rd_priv(in_st, r_len, sess_sched, ad.session,
- &server_parm.recv_addr,
- &server_parm.admin_addr, &msg_st))) {
- clr_cli_secrets();
- errpkt(dat, dat_len,retc + krb_err_base);
- return retc + krb_err_base;
- }
- switch (msg_st.app_data[0]) {
- case CHANGE_PW:
- retval = kadm_ser_cpw(msg_st.app_data+1,(int) msg_st.app_length,&ad,
- &retdat, &retlen);
- break;
- case ADD_ENT:
- retval = kadm_ser_add(msg_st.app_data+1,(int) msg_st.app_length,&ad,
- &retdat, &retlen);
- break;
- case GET_ENT:
- retval = kadm_ser_get(msg_st.app_data+1,(int) msg_st.app_length,&ad,
- &retdat, &retlen);
- break;
- case MOD_ENT:
- retval = kadm_ser_mod(msg_st.app_data+1,(int) msg_st.app_length,&ad,
- &retdat, &retlen);
- break;
- default:
- clr_cli_secrets();
- errpkt(dat, dat_len, KADM_NO_OPCODE);
- return KADM_NO_OPCODE;
- }
- /* Now seal the response back into a priv msg */
- free((char *)*dat);
- tmpdat = (u_char *) malloc((unsigned)(retlen + KADM_VERSIZE +
- sizeof(u_long)));
- (void) strncpy((char *)tmpdat, KADM_VERSTR, KADM_VERSIZE);
- retval = htonl((u_long)retval);
- bcopy((char *)&retval, (char *)tmpdat + KADM_VERSIZE, sizeof(u_long));
- if (retlen) {
- bcopy((char *)retdat, (char *)tmpdat + KADM_VERSIZE + sizeof(u_long),
- retlen);
- free((char *)retdat);
- }
- /* slop for mk_priv stuff */
- *dat = (u_char *) malloc((unsigned) (retlen + KADM_VERSIZE +
- sizeof(u_long) + 200));
- if ((*dat_len = krb_mk_priv(tmpdat, *dat,
- (u_long) (retlen + KADM_VERSIZE +
- sizeof(u_long)),
- sess_sched,
- ad.session, &server_parm.admin_addr,
- &server_parm.recv_addr)) < 0) {
- clr_cli_secrets();
- errpkt(dat, dat_len, KADM_NO_ENCRYPT);
- return KADM_NO_ENCRYPT;
- }
- clr_cli_secrets();
- return KADM_SUCCESS;
-}
diff --git a/eBones/usr.sbin/kadmin/kadm_server.c b/eBones/usr.sbin/kadmin/kadm_server.c
deleted file mode 100644
index c6cbc6a..0000000
--- a/eBones/usr.sbin/kadmin/kadm_server.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * Copyright.MIT.
- *
- * Kerberos administration server-side subroutines
- */
-
-#if 0
-#ifndef lint
-static char rcsid_kadm_server_c[] =
-"Header: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadm_server.c,v 4.2 89/09/26 09:30:23 jtkohl Exp ";
-#endif lint
-#endif
-
-#include <string.h>
-#include <kadm.h>
-#include <kadm_err.h>
-#include "kadm_server.h"
-
-/*
-kadm_ser_cpw - the server side of the change_password routine
- recieves : KTEXT, {key}
- returns : CKSUM, RETCODE
- acl : caller can change only own password
-
-Replaces the password (i.e. des key) of the caller with that specified in key.
-Returns no actual data from the master server, since this is called by a user
-*/
-int
-kadm_ser_cpw(dat, len, ad, datout, outlen)
-u_char *dat;
-int len;
-AUTH_DAT *ad;
-u_char **datout;
-int *outlen;
-{
- unsigned long keylow, keyhigh;
- des_cblock newkey;
- int stvlen;
-
- /* take key off the stream, and change the database */
-
- if ((stvlen = stv_long(dat, &keyhigh, 0, len)) < 0)
- return(KADM_LENGTH_ERROR);
- if (stv_long(dat, &keylow, stvlen, len) < 0)
- return(KADM_LENGTH_ERROR);
-
- keylow = ntohl(keylow);
- keyhigh = ntohl(keyhigh);
- bcopy((char *)&keyhigh, (char *)(((long *)newkey) + 1), 4);
- bcopy((char *)&keylow, (char *)newkey, 4);
- *datout = 0;
- *outlen = 0;
-
- return(kadm_change(ad->pname, ad->pinst, ad->prealm, newkey));
-}
-
-/*
-kadm_ser_add - the server side of the add_entry routine
- recieves : KTEXT, {values}
- returns : CKSUM, RETCODE, {values}
- acl : su, sms (as alloc)
-
-Adds and entry containing values to the database
-returns the values of the entry, so if you leave certain fields blank you will
- be able to determine the default values they are set to
-*/
-int
-kadm_ser_add(dat,len,ad, datout, outlen)
-u_char *dat;
-int len;
-AUTH_DAT *ad;
-u_char **datout;
-int *outlen;
-{
- Kadm_vals values, retvals;
- int status;
-
- if ((status = stream_to_vals(dat, &values, len)) < 0)
- return(KADM_LENGTH_ERROR);
- if ((status = kadm_add_entry(ad->pname, ad->pinst, ad->prealm,
- &values, &retvals)) == KADM_DATA) {
- *outlen = vals_to_stream(&retvals,datout);
- return KADM_SUCCESS;
- } else {
- *outlen = 0;
- return status;
- }
-}
-
-/*
-kadm_ser_mod - the server side of the mod_entry routine
- recieves : KTEXT, {values, values}
- returns : CKSUM, RETCODE, {values}
- acl : su, sms (as register or dealloc)
-
-Modifies all entries corresponding to the first values so they match the
- second values.
-returns the values for the changed entries
-*/
-int
-kadm_ser_mod(dat,len,ad, datout, outlen)
-u_char *dat;
-int len;
-AUTH_DAT *ad;
-u_char **datout;
-int *outlen;
-{
- Kadm_vals vals1, vals2, retvals;
- int wh;
- int status;
-
- if ((wh = stream_to_vals(dat, &vals1, len)) < 0)
- return KADM_LENGTH_ERROR;
- if ((status = stream_to_vals(dat+wh,&vals2, len-wh)) < 0)
- return KADM_LENGTH_ERROR;
- if ((status = kadm_mod_entry(ad->pname, ad->pinst, ad->prealm, &vals1,
- &vals2, &retvals)) == KADM_DATA) {
- *outlen = vals_to_stream(&retvals,datout);
- return KADM_SUCCESS;
- } else {
- *outlen = 0;
- return status;
- }
-}
-
-/*
-kadm_ser_get
- recieves : KTEXT, {values, flags}
- returns : CKSUM, RETCODE, {count, values, values, values}
- acl : su
-
-gets the fields requested by flags from all entries matching values
-returns this data for each matching recipient, after a count of how many such
- matches there were
-*/
-int
-kadm_ser_get(dat,len,ad, datout, outlen)
-u_char *dat;
-int len;
-AUTH_DAT *ad;
-u_char **datout;
-int *outlen;
-{
- Kadm_vals values, retvals;
- u_char fl[FLDSZ];
- int loop,wh;
- int status;
-
- if ((wh = stream_to_vals(dat, &values, len)) < 0)
- return KADM_LENGTH_ERROR;
- if (wh + FLDSZ > len)
- return KADM_LENGTH_ERROR;
- for (loop=FLDSZ-1; loop>=0; loop--)
- fl[loop] = dat[wh++];
- if ((status = kadm_get_entry(ad->pname, ad->pinst, ad->prealm,
- &values, fl, &retvals)) == KADM_DATA) {
- *outlen = vals_to_stream(&retvals,datout);
- return KADM_SUCCESS;
- } else {
- *outlen = 0;
- return status;
- }
-}
-
diff --git a/eBones/usr.sbin/kadmin/kadm_server.h b/eBones/usr.sbin/kadmin/kadm_server.h
deleted file mode 100644
index 1708107..0000000
--- a/eBones/usr.sbin/kadmin/kadm_server.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * $Source: /usr/cvs/src/eBones/kadmind/kadm_server.h,v $
- * $Author: mark $
- * Header: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadm_server.h,v 4.1 89/12/21 17:46:51 jtkohl Exp
- *
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * Copyright.MIT.
- *
- * Definitions for Kerberos administration server & client
- */
-
-#ifndef KADM_SERVER_DEFS
-#define KADM_SERVER_DEFS
-
-/*
- * kadm_server.h
- * Header file for the fourth attempt at an admin server
- * Doug Church, December 28, 1989, MIT Project Athena
- * ps. Yes that means this code belongs to athena etc...
- * as part of our ongoing attempt to copyright all greek names
- */
-
-#include <sys/types.h>
-#include <krb.h>
-#include <des.h>
-
-typedef struct {
- struct sockaddr_in admin_addr;
- struct sockaddr_in recv_addr;
- int recv_addr_len;
- int admin_fd; /* our link to clients */
- char sname[ANAME_SZ];
- char sinst[INST_SZ];
- char krbrlm[REALM_SZ];
- C_Block master_key;
- C_Block session_key;
- Key_schedule master_key_schedule;
- long master_key_version;
-} Kadm_Server;
-
-/* the default syslog file */
-#define KADM_SYSLOG "/var/log/kadmind.syslog"
-
-#define DEFAULT_ACL_DIR "/etc/kerberosIV"
-#define ADD_ACL_FILE "/admin_acl.add"
-#define GET_ACL_FILE "/admin_acl.get"
-#define MOD_ACL_FILE "/admin_acl.mod"
-
-int kadm_ser_in(unsigned char **dat, int *dat_len);
-int kadm_ser_init(int inter, char realm[]);
-int kadm_ser_cpw(u_char *dat, int len, AUTH_DAT *ad, u_char **datout,
- int *outlen);
-int kadm_ser_add(u_char *dat, int len, AUTH_DAT *ad, u_char **datout,
- int *outlen);
-int kadm_ser_mod(u_char *dat, int len, AUTH_DAT *ad, u_char **datout,
- int *outlen);
-int kadm_ser_get(u_char *dat, int len, AUTH_DAT *ad, u_char **datout,
- int *outlen);
-int kadm_change (char *rname, char *rinstance, char *rrealm,
- des_cblock newpw);
-int kadm_add_entry(char *rname, char *rinstance, char *rrealm,
- Kadm_vals *valsin, Kadm_vals *valsout);
-int kadm_mod_entry(char *rname, char *rinstance, char *rrealm,
- Kadm_vals *valsin1, Kadm_vals *valsin2, Kadm_vals *valsout);
-int kadm_get_entry(char *rname, char *rinstance, char *rrealm,
- Kadm_vals *valsin, u_char *flags, Kadm_vals *valsout);
-
-#endif KADM_SERVER_DEFS
diff --git a/eBones/usr.sbin/kadmin/kadmind.8 b/eBones/usr.sbin/kadmin/kadmind.8
deleted file mode 100644
index 1eb10d7..0000000
--- a/eBones/usr.sbin/kadmin/kadmind.8
+++ /dev/null
@@ -1,117 +0,0 @@
-.\" from: kadmind.8,v 4.1 89/07/25 17:28:33 jtkohl Exp $
-.\" $Id: kadmind.8,v 1.1.1.1 1994/09/30 14:50:06 csgr Exp $
-.\" Copyright 1989 by the Massachusetts Institute of Technology.
-.\"
-.\" For copying and distribution information,
-.\" please see the file <Copyright.MIT>.
-.\"
-.TH KADMIND 8 "Kerberos Version 4.0" "MIT Project Athena"
-.SH NAME
-kadmind \- network daemon for Kerberos database administration
-.SH SYNOPSIS
-.B kadmind
-[
-.B \-n
-] [
-.B \-h
-] [
-.B \-r realm
-] [
-.B \-f filename
-] [
-.B \-d dbname
-] [
-.B \-a acldir
-]
-.SH DESCRIPTION
-.I kadmind
-is the network database server for the Kerberos password-changing and
-administration tools.
-.PP
-Upon execution, it prompts the user to enter the master key string for
-the database.
-.PP
-If the
-.B \-n
-option is specified, the master key is instead fetched from the master
-key cache file.
-.PP
-If the
-.B \-r
-.I realm
-option is specified, the admin server will pretend that its
-local realm is
-.I realm
-instead of the actual local realm of the host it is running on.
-This makes it possible to run a server for a foreign kerberos
-realm.
-.PP
-If the
-.B \-f
-.I filename
-option is specified, then that file is used to hold the log information
-instead of the default.
-.PP
-If the
-.B \-d
-.I dbname
-option is specified, then that file is used as the database name instead
-of the default.
-.PP
-If the
-.B \-a
-.I acldir
-option is specified, then
-.I acldir
-is used as the directory in which to search for access control lists
-instead of the default.
-.PP
-If the
-.B \-h
-option is specified,
-.I kadmind
-prints out a short summary of the permissible control arguments, and
-then exits.
-.PP
-When performing requests on behalf of clients,
-.I kadmind
-checks access control lists (ACLs) to determine the authorization of the client
-to perform the requested action.
-Currently three distinct access types are supported:
-.TP 1i
-Addition
-(.add ACL file). If a principal is on this list, it may add new
-principals to the database.
-.TP
-Retrieval
-(.get ACL file). If a principal is on this list, it may retrieve
-database entries. NOTE: A principal's private key is never returned by
-the get functions.
-.TP
-Modification
-(.mod ACL file). If a principal is on this list, it may modify entries
-in the database.
-.PP
-A principal is always granted authorization to change its own password.
-.SH FILES
-.TP 20n
-/var/log/kadmind.syslog
-Default log file.
-.TP
-/etc/kerberosIV/admin_acl.{add,get,mod}
-Access control list files
-.TP
-/etc/kerberosIV/principal.db
-DBM file containing database
-.TP
-/etc/kerberosIV/principal.ok
-Semaphore indicating that the DBM database is not being modified.
-.TP
-/etc/kerberosIV/master_key
-Master key cache file.
-.SH "SEE ALSO"
-kerberos(1), kpasswd(1), kadmin(8), acl_check(3)
-.SH AUTHORS
-Douglas A. Church, MIT Project Athena
-.br
-John T. Kohl, Project Athena/Digital Equipment Corporation
diff --git a/etc/adduser.conf b/etc/adduser.conf
deleted file mode 100644
index 04d6aae..0000000
--- a/etc/adduser.conf
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# Configuration file for adduser (1)
-#
-# $Id: adduser.conf,v 1.2 1994/12/28 07:11:29 gclarkii Exp $
-
-$useautoids = "1"; # Define this if you wish to use auto-increment
-$defgroupid = "20"; # Default ID
-$defusrdir = "\/usr\/u"; # Default User Dir
-$userdefshell = "\/bin\/csh"; # Default user shell
-$skel_location = "\/usr\/share\/skel"; # Location of shell skeletons
-$userids = "\/etc\/userids"; # Location of 'userids' file
-
diff --git a/etc/config/cleartmp b/etc/config/cleartmp
deleted file mode 100644
index ba8ff1b..0000000
--- a/etc/config/cleartmp
+++ /dev/null
@@ -1,4 +0,0 @@
-# $Id$
-# This option determines whether the /tmp directory should be
-# automatically cleared on startup. Default is on.
-on
diff --git a/etc/config/gated b/etc/config/gated
deleted file mode 100644
index c960aca..0000000
--- a/etc/config/gated
+++ /dev/null
@@ -1,4 +0,0 @@
-# $Id$
-# This file determins whether Cornell's GateD should be automatically
-# started. The default is off.
-off
diff --git a/etc/config/kerberos b/etc/config/kerberos
deleted file mode 100644
index 883dbb2..0000000
--- a/etc/config/kerberos
+++ /dev/null
@@ -1,4 +0,0 @@
-# $Id$
-# This file determines whether the Kerberos server should be
-# automatically started. The default is off.
-off
diff --git a/etc/config/mountd.flags b/etc/config/mountd.flags
deleted file mode 100644
index 8aefcdb..0000000
--- a/etc/config/mountd.flags
+++ /dev/null
@@ -1,3 +0,0 @@
-# $Id$
-# This file lists the flags passed to the NFS mount daemon `mountd' when
-# started at boot time.
diff --git a/etc/config/named b/etc/config/named
deleted file mode 100644
index 67df31e..0000000
--- a/etc/config/named
+++ /dev/null
@@ -1,6 +0,0 @@
-# $Id$
-# This file determines whether the name server should be started
-# automatically. The default is off, but Internet-connected systems
-# should set it to `on' whenever possible. (NB: it must be
-# configured.)
-off
diff --git a/etc/config/nfsclient b/etc/config/nfsclient
deleted file mode 100644
index 63543ad..0000000
--- a/etc/config/nfsclient
+++ /dev/null
@@ -1,4 +0,0 @@
-# $Id$
-# This file determines whether the NFS client software is automatically
-# started at boot time. The default is off.
-off
diff --git a/etc/config/nfsclient.flags b/etc/config/nfsclient.flags
deleted file mode 100644
index cefd50d..0000000
--- a/etc/config/nfsclient.flags
+++ /dev/null
@@ -1,4 +0,0 @@
-# $Id$
-# This file lists options provided to the NFS I/O daemon `nfsiod', when
-# started at boot time.
-4
diff --git a/etc/config/nfsserver b/etc/config/nfsserver
deleted file mode 100644
index 4049345..0000000
--- a/etc/config/nfsserver
+++ /dev/null
@@ -1,4 +0,0 @@
-# $Id$
-# This file determines whether the NFS server is automatically started
-# at boot time. The default is off.
-off
diff --git a/etc/config/nfsserver.flags b/etc/config/nfsserver.flags
deleted file mode 100644
index d3ba186..0000000
--- a/etc/config/nfsserver.flags
+++ /dev/null
@@ -1,4 +0,0 @@
-# $Id$
-# This file lists the flags passed to the NFS server `nfsd' when started
-# at boot time.
--u 0,0,4 -t 0,0
diff --git a/etc/config/nisclient b/etc/config/nisclient
deleted file mode 100644
index 74fc1bb..0000000
--- a/etc/config/nisclient
+++ /dev/null
@@ -1,4 +0,0 @@
-# $Id$
-# This file determines whether the Yellow Pages/NIS client software
-# is automatically started at boot time. The default is off.
-off
diff --git a/etc/config/nisserver b/etc/config/nisserver
deleted file mode 100644
index d3c187c..0000000
--- a/etc/config/nisserver
+++ /dev/null
@@ -1,4 +0,0 @@
-# $Id$
-# This file determines whether the Yellow Pages/NIS server software
-# is automatically started at boot time. The default is off.
-off
diff --git a/etc/config/quota b/etc/config/quota
deleted file mode 100644
index c03530e..0000000
--- a/etc/config/quota
+++ /dev/null
@@ -1,5 +0,0 @@
-# $Id$
-# This file determines whether quotas are enabled upon system startup.
-# This option does not effect whether the kernel supports quotas.
-# The default is off.
-off
diff --git a/etc/config/routed b/etc/config/routed
deleted file mode 100644
index 827481c..0000000
--- a/etc/config/routed
+++ /dev/null
@@ -1,5 +0,0 @@
-# $Id$
-# This option determines whether routed is automatically started at
-# boot time. It should probably be turned off, but for now the
-# default is on.
-on
diff --git a/etc/config/routed.flags b/etc/config/routed.flags
deleted file mode 100644
index 49f11c2..0000000
--- a/etc/config/routed.flags
+++ /dev/null
@@ -1,3 +0,0 @@
-# $Id$
-# This file gives the command-line flags passed to routed when it is started.
--q
diff --git a/etc/config/rwhod b/etc/config/rwhod
deleted file mode 100644
index 72de6d5..0000000
--- a/etc/config/rwhod
+++ /dev/null
@@ -1,4 +0,0 @@
-# $Id$
-# This file determins whether rwhod is automatically started at boot
-# time. The default is off.
-off
diff --git a/etc/config/savecore b/etc/config/savecore
deleted file mode 100644
index e22338d..0000000
--- a/etc/config/savecore
+++ /dev/null
@@ -1,4 +0,0 @@
-# $Id$
-# This file determines whether any attempt is made to save a crash
-# dump in /var/crash upon boot-up. The default is on.
-on
diff --git a/etc/config/savecore.flags b/etc/config/savecore.flags
deleted file mode 100644
index b89cedf..0000000
--- a/etc/config/savecore.flags
+++ /dev/null
@@ -1,3 +0,0 @@
-# $Id$
-# This file determines where crash dumps will be saved.
-/var/crash
diff --git a/etc/config/sendmail b/etc/config/sendmail
deleted file mode 100644
index 922105d..0000000
--- a/etc/config/sendmail
+++ /dev/null
@@ -1,4 +0,0 @@
-# $Id$
-# This file determines whether to automatically start sendmail at
-# system boot time. The default is on; options in sendmail.flags.
-on
diff --git a/etc/config/sendmail.flags b/etc/config/sendmail.flags
deleted file mode 100644
index e4d6504..0000000
--- a/etc/config/sendmail.flags
+++ /dev/null
@@ -1,3 +0,0 @@
-# $Id$
-# This file gives the flags passed to sendmail on system startup if enabled.
--bd -q30m
diff --git a/etc/config/timed b/etc/config/timed
deleted file mode 100644
index a136f52..0000000
--- a/etc/config/timed
+++ /dev/null
@@ -1,4 +0,0 @@
-# $Id$
-# This file determines whether the Berkeley time daemon is
-# automatically started at boot time. The default is off.
-off
diff --git a/etc/config/timed.flags b/etc/config/timed.flags
deleted file mode 100644
index b3d15ea..0000000
--- a/etc/config/timed.flags
+++ /dev/null
@@ -1,2 +0,0 @@
-# $Id$
-# This file contains the flags passed to timed at start-up time, if enabled.
diff --git a/etc/etc.i386/EXTRACT_bin.sh b/etc/etc.i386/EXTRACT_bin.sh
deleted file mode 100755
index d682174..0000000
--- a/etc/etc.i386/EXTRACT_bin.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-#
-# This file will extract all of the FreeBSD binaries into ${EXTRACT_TARGET}
-# if it is set, or / otherwise.
-#
-# CAUTION DO NOT USE THIS TO INSTALL THE BINARIES ONTO A RUNNING
-# SYSTEM, it will NOT WORK!!! You should use the extract command from /magic
-# for installing the bindist onto your system.
-SOURCEDIR=.
-if [ X"${EXTRACT_TARGET}" = X"" ]; then
- echo "YOU DO NOT WANT TO DO THAT!!!"
- exit
- EXTRACT_TARGET=/
-fi
-
-cd $SOURCEDIR
-cat bin_tgz.* | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
-#NO_EXPORT#cat des_tgz.* | gunzip | tar --directory ${EXTRACT_TARGET} -xpf -
diff --git a/etc/etc.i386/EXTRACT_secr.sh b/etc/etc.i386/EXTRACT_secr.sh
deleted file mode 100755
index 718966c..0000000
--- a/etc/etc.i386/EXTRACT_secr.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-#
-# This file will extract all of the FreeBSD secure distribution into
-# ${EXTRACT_TARGET} if it is set, or / otherwise.
-#
-SOURCEDIR=.
-if [ X"${EXTRACT_TARGET}" = X"" ]; then
- EXTRACT_TARGET=/
-fi
-
-cd $SOURCEDIR
-
-cat des_tgz.* | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
-cat libcrypt.aa | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
diff --git a/etc/etc.i386/EXTRACT_src.sh b/etc/etc.i386/EXTRACT_src.sh
deleted file mode 100755
index 0b7c465..0000000
--- a/etc/etc.i386/EXTRACT_src.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh
-#
-# This file will extract all of the FreeBSD sources into
-# ${EXTRACT_TARGET}/usr/src if it is set, or /usr/src otherwise.
-# If you do not want all the sources you can copy this file to your
-# disk and edit it to comment out the ones you do not want. You
-# will need to change the setting of SOURCEDIR to reflect where the srcdist
-# directory is (dependent on where your cdrom is mounted,
-# it might be /cdrom/tarballs/srcdist) .
-#
-if [ X"${SOURCEDIR}" = X"" ]; then
- SOURCEDIR=.
-fi
-if [ X"${EXTRACT_TARGET}" = X"" ]; then
- EXTRACT_TARGET=/
-fi
-
-cd $SOURCEDIR
-
-# Note that base.aa is REQUIRED to be able to use the source tree for
-# building in.
-#
-cat base.* | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
-
-#
-# The following are optional
-#
-cat bin.* | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
-cat contrib.* | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
-cat etc.aa | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
-cat games.* | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
-cat gnu.* | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
-cat include.* | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
-cat lib.* | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
-#NO_EXPORT#cat libcrypt.* | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
-cat libexec.* | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
-cat sbin.* | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
-cat share.* | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
-cat sys.* | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
-cat usrbin.* | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
-cat usrsbin.* | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf -
diff --git a/etc/etc.i386/README.1ST b/etc/etc.i386/README.1ST
deleted file mode 100644
index 1840d96..0000000
--- a/etc/etc.i386/README.1ST
+++ /dev/null
@@ -1,146 +0,0 @@
- FLOPPY INSTALLATION NOTES
- FreeBSD
- Release 1.1.5
-
-Welcome to FreeBSD! This document has been put together in an effort
-to make initial installation of the system from floppy as easy as possible.
-It also provides a simple description for those eager to get started as soon as
-possible. Please see the file README.INSTALL for more detailed installation
-instructions.
-
-1. To install FreeBSD you will need 3 (or 4 if you choose to add the optional
- DOS floppy) floppies, as well as the bulk of the distribution on some
- other medium (floppy, tape, CD, etc). If you've retrieved this release
- from the net, you'll first have to make the floppies yourself using
- the supplied images.
-
- Due to the differences in PC configurations, we've found it necessary
- to provide multiple initial boot images that provide kernels for
- different types of systems.
-
- If your disk controller is one of:
-
- MFM / RLL / IDE / ST506
- Adaptec 154x series
- Adaptec 174x series
- Buslogic 545S
-
- Then please use the disk image: kcopy_ah.flp
- to construct your boot floppy.
-
- If your disk controller is one of:
-
- Bustek 742a
- UltraStore 14F or 34F
-
- Then please use the disk image: kcopy_bt.flp
- to construct your boot floppy.
-
- Next, make a second floppy from the disk image: filesyst.flp
- You'll need this for the second stage of the boot process.
-
- Finally, make a third floppy from the disk image: cpio.flp
- You'll need this for the last stage of the boot process.
-
- If you want to use any of the optional tools in the tools
- subdirectory of the ftp distribution site, these should be
- copied directly to a DOS formatted disk (using, either mcopy
- or mount -t pcfs). This disk is referred to later as the
- optional "dos" floppy.
-
- If installing more than one operating system on a disk, then
- it is recommended that the dos floppy at least include the
- os-bs boot manager. If downloading files via a modem and SLIP
- is not available, then the dos floppy should include kermit.
- You'll have the option of loading the programs that are on
- the dos floppy in the last stage of the boot process.
-
-2. Boot the first floppy. When it asks you to insert the file system floppy,
- insert the second floppy ``filesyst.flp.'' Follow the instructions
- that floppy gives you. If partitions already exist on the hard disk,
- then by default FreeBSD attempts to install itself at the end of these.
- Before rebooting, note the type of disk it says to copy the kernel
- to: ``sd0a'' or ``wd0a'' (``sd0a'' is for SCSI systems, ``wd0a'' is
- for all others.) When the system halts, go on to the next step.
-
-3. Boot the first floppy again, but this time when it asks
- you to insert the file system floppy, just press the return key.
- Follow the instructions that the floppy gives you. When you see
- the ``kc>'' prompt, type ``copy'' (without quotes). At the next prompt,
- ``copy kernel to>'', type either ``sd0a'' or ``wd0a'' as given in
- the previous step. When the system halts, go on to the next step.
-
-4. Making sure that there's no floppy in the drive, press return to boot
- from the hard disk. After it has booted and is asking what drive the
- cpio floppy is in, insert the third floppy ``cpio.flp'' into a
- floppy drive and answer the question about what drive it is in.
- Note that 0 is the same as DOS drive A:, and 1 is the same as DOS
- drive B:
-
-5. After the cpio floppy has been copied to the disk, remove it from the
- drive. If there are programs on the dos-floppy that you would like
- installed, then insert this disk in a floppy drive, again specifying
- the drive to read from.
-
-6. After the cpio (or optional dos) floppy has been copied to the disk,
- enter `halt' at the command prompt.
-
-7. When the system asks you to press the return key to reboot, first
- remove the floppy and then press the return key to boot from the hard
- disk.
-
-8. At this point you will get 4 errors from the fsck on boot, these
- are normal and are caused by files that were open when the
- /dev entries were built - just ignore them. The system will
- correct these errors and then halt, after which you should press
- the return key again to reboot with a clean system.
-
-9. Congratulations, you've got the mini FreeBSD system on your disk!
-
-10. Follow the instructions about set_tmp_dir and extract that
- will come on your screen after you've pressed the return key.
-
-11. Run the configure command to set up some of the /etc files by
- typing ``configure''. You will have to edit /etc/netstart after
- this if you have a networking interface.
-
-12. Reboot so that the system comes up multiuser by typing ``reboot''.
-
-13. You are now running FreeBSD! Congratulations! You may now continue
- with installing the source distribution, or stop here for now.
-
-14. The file /magic contains the special sh commands used during
- installation. Should you need to use them you can do the following.
-
- /bin/sh
- . /magic
-
-15. If your disk has several operating systems, you may want to
- install the Thomas Wolfram's os-bs boot manager for selecting
- which system to boot. This works well with DOS, OS/2, FreeBSD
- and other systems. To install it, boot the system with MS-DOS
- and insert the dos-floppy of the FreeBSD install suite in
- floppy drive A:. Then enter the DOS commands:
- > A:
- > os-bs135
- > cd os-bs
- > os-bs
- A menu should now appear on the screen. Use the cursor keys
- to highlight the install option and hit ENTER. Simply follow the
- instructions from there.
-
- For more information about the ob-bs program, including its
- capabilities and limitations, see the file `readme.1st' in the
- os-bs directory.
-
- If you choose not to install os-bs, then fdisk can be used to
- change the boot system. This is done by making the primary
- partition for the boot system active. FreeBSD has an fdisk
- command that can be used for this purpose as well.
-
-16. In addition to the FreeBSD source and binary distributions, many
- additional packages, such as X11 and TeX, may be obtained from
- freebsd.cdrom.com - please have a look around! You may also find
- this a good time to read the release notes in RELNOTES.FreeBSD.
-
-End of $Id: floppy.install_notes,v 1.15 1994/05/15 01:10:17 rgrimes Exp $
diff --git a/etc/etc.i386/README.INSTALL b/etc/etc.i386/README.INSTALL
deleted file mode 100644
index e67c6cd..0000000
--- a/etc/etc.i386/README.INSTALL
+++ /dev/null
@@ -1,1011 +0,0 @@
- INSTALLATION NOTES
- FreeBSD
- Release 1.1.5
-
-These notes have been prepared from those written originally for NetBSD
-0.9. The conversion was done by someone who has had experience with
-installing and upgrading 386bsd, but who is not a unix guru, so there
-will be slant towards this experience. Corrections/updates are
-welcomed, it is difficult/impossible to test every last hardware
-combination.
-
-Be sure to read _ALL_ of this document before you try to install
-FreeBSD. FreeBSD probably looks a bit similar to things that you've
-seen before (perhaps 386BSD), but the installation procedures are quite
-different.
-
-
-FreeBSD Release Contents:
-------- --- ------- --------
-
-The FreeBSD Release consists of the following elements:
-
-Bootable Kernel-copy floppies
-
- These disks are bootable and have enough utilities on
- board to copy a new kernel to a prepared hard disk. While
- they are primarily intended for installing FreeBSD, they
- also make upgrading to a new kernel easy: boot from it,
- and copy a new kernel to disk.
-
- You must choose between one of two kernel-copy floppy
- images, depending on your disk controller type. The
- "kcopy-ah-floppy" image supports the Adaptec 154x and 1742
- SCSI adapters, while "kcopy-bt-floppy" supports the Bustek
- 742 and Ultrastore SCSI adapters. For systems with only
- MFM, RLL, ESDI or IDE disk controllers, either image can
- be used.
-
-Installation floppies
-
- In addition to a bootable floppy, two additional floppies are
- required to prepare your hard drive for FreeBSD and to install
- the FreeBSD base distribution. Like the boot
- floppies, these are distributed as binary images. They are
- are referred to below as the "filesystem-floppy" and the
- "cpio-floppy".
-
- There is also an optional fourth installation disk referred
- to as the "dos-floppy". Unlike the other install disks,
- there is no binary image for the dos floppy. Instead this
- is a regular MS-DOS-formatted floppy disk containing any
- FreeBSD programs you choose to copy to it using mtools or
- even the DOS copy command. The most commonly requested
- programs have been put in a tools directory at FreeBSD
- archives sites.
-
-
-FreeBSD distribution sets
-
- These collections contain the complete FreeBSD system and
- utilities in source and binary form. There are three
- separate sets: the FreeBSD binaries, the FreeBSD sources,
- and the DES sources+binaries. The DES set contains only
- crypt(3) code and is subject to U.S.A. export restrictions.
-
- The binary distribution set can be found in the "bindist"
- subdirectory of the FreeBSD archive sites. It consists
- of files named bin_tgz.aa to bin_tgz.cm (i.e., 65 files
- all told). A CKSUMS file (* see note below) is included
- for verifying the integrity of these.
-
- The source distribution sets can be found in under
- "srcdist" subdirectory of archive sites. It is consists
- of files named for each logical group of src files (split into
- "catagories"), plus the CKSUMS file.
-
- Finally, the security distribution set contains
- usr/src/libcrypt/*, the source files for the DES encryption
- algorithm, and the binaries which depend on it. It can
- be found in the "secrdist" subdirectory on sites which
- choose to carry the complete FreeBSD distribution.
-
- NOTE: Individuals who are not in the U.S.A. but who still want
- to use encryption without violating U.S. export laws should read
- the FreeBSD FAQ entry regarding foreign distribution of independently
- developed encryption technology. Look in:
-
- /usr/src/contrib/FAQ
-
- Or, on the net, freebsd.cdrom.com:~ftp/pub/FreeBSD/FAQ
-
-
- The individual files in each collection are no more than
- 235 Kbytes in size. (The last file is just long enough
- to contain the rest of the data for that distribution
- set.)
-
- Each collection is a split, gzip'ed tar archive. They
- are reassembled and extracted by the install procedure.
- However, to view them without installing FreeBSD, you can
- use, e.g., the command line:
-
- cat bin* | gunzip | tar tvf - | more
-
- You should NOT extract the distribution directly, but rather
- use the `extract' command available at installation time.
- This command performs special-case handling to avoid possible
- problems in extracting a release on a new system.
-
- In each of the distribution directories, there is a file
- named "CKSUMS" which contains the checksums of the files
- in that directory, as generated by the cksum(1) command.
- You can use cksum to verify the integrity of the archives,
- if you suspect one of the files is corrupted.
-
- N.B.: The CKSUMS files are produced using the 4.4BSD
- version of cksum which is POSIX-compliant. The values in
- these file do not match the cksums generated by the 386BSD 0.1
- version of cksum (which is based on an earlier "standard").
- A copy of the new cksum binary that will run on
- 386bsd/Netbsd/FreeBSD can be found in the "tools" subdirectory
- of the distribution.
-
-
-System Requirements and Supported Devices:
------- ------------ --- --------- -------
-
-FreeBSD runs on ISA (AT-Bus), EISA and some PCI systems with 386, 486 and
-Pentium processors. A math coprocessor is recommended but not essential.
-It does NOT support Micro-channel systems, such as some IBM PS/2 systems.
-The minimal configuration should include 4Meg of RAM and an 80Meg hard disk,
-but to install the entire system (with sources) you'll need much more disk
-space, and to run X or compile programs on the system, more RAM is recommended.
-(4Meg will actually allow you to run X and/or compile, but it's extremely slow).
-
-For a complete list of supported cards and peripherals, please see the
-file RELNOTES.FreeBSD. It should be installed in the root directory
-of your newly installed system, or can be fetched off the net from:
-
- freebsd.cdrom.com:~ftp/pub/FreeBSD/RELNOTES
-
-
-To be detected by the distributed kernels, certain devices must
-be configured as follows: (Note: IRQ 9 is the same as IRQ 2
-on ISA/EISA based machines)
-
-Device Name Port IRQ DRQ Misc
------- ---- ---- --- --- ----
-Floppy Cntlr. fd0 0x3f0 6 2
-
-Std. Hard Disk Cntlr.
- wd0 0x1f0 14
-
-AHA-154x SCSI Cntlr. 0x330 11 5 [kcopy-ah-floppy]
-
-AHA-174x SCSI Cntlr. automatically configured [kcopy-ah-floppy]
-
-BT742 SCSI Cntlr. 0x330 12 [kcopy-bt-floppy]
-
-UHA-14f SCSI Cntlr. or
-UHA-34f SCSI Cntlr. 0x330 14 5 [kcopy-bt-floppy]
-(In FreeBSD GAMMA and before, UHA was on IRQ 11)
-
-SCSI Disks sd[0-2] automatically configured
-
-SCSI Tapes st[01] automatically configured
-
-SCSI CD-ROMs cd0 automatically configured
-
-Serial Ports com0 0x3f8 4
- com1 0x2f8 3
- com2 0x3e8 5
- com3 0x3f8 9
-
-Mitsumi CDROM 0x300 5 1 [kcopy-ah-floppy]
-
-SMC/WD Ethernet or
-3COM 3c503 ed0 0x280 5 iomem 0xd8000
-
-NOTE for 386bsd users: the we0 device for the WD80xxyy card has been
-replaced with an ed0 device. The default settings of 9/280/d000 have
-been changed to 5/280/d800 as this address accomdates all of the boards.
-
-Novell Ethernet ed0 0x280 5
-
-NOTE for 386bsd users: the ne0 device for the NEx000 card has been
-replaced with an ed0 device. The default settings of 9/300 have
-been changed to 5/280.
-
-ISOLAN ISOLink is0 0x280 10 7
-Novell NE2100 is0 0x280 10 7
-
-QIC-02 Tape wt0 0x300 5 1
-
-Parallel (Printer) Port
- lpt0 0x3BC 7
-
-Interruptless Parallel (Printer) Port
- lpa0 0x378
- lpa1 0x278
-
-N.B.: Disable the lpt interrupt on the board or you will
-have problems using the lpa drivers.
-
-
-Hard-Disk Storage Requirements
---------- ------- ------------
-
-The minimum base installation of FreeBSD requires a free hard disk
-partition with at least 16 MB free space. This is only enough for
-the three installation disks, which don't support a multi-user
-shell.
-
-The full binary distribution extracts to about 46 MB.
-The full source distribution extracts to about 72 MB.
-The kernel source only extracts to about 7 MB.
-To recompile the sources requires an additional 55 MB.
-To recompile the kernel requires an additional 2 MB.
-
-Since additional room is required for extracting the distributions,
-a full binary installation requires a minimum of about 80 MB (46
-MB extracted + 16 MB archived + 8 MB minimum swap + room for
-extracting).
-
-A complete source + binary distribution requires a minimum of
-about 210 MB (assuming a minimum 8 MB swap).
-
-
-Getting the System on to Useful Media:
-------- --- ------ -- -- ------ -----
-
-Installation is supported from several media types, including:
-
- MS-DOS floppies
- MS-DOS hard disk (Primary partition)
- Tape
- NFS partitions
- FTP
- Kermit
-
-No matter what you do, however, you'll need at least three disks (1.2M
-or 1.44M) handy, on which you will put the kernel-copy image and the
-install (or upgrade) floppy images.
-
-The images are available from the directory "floppies", under the root
-of the FreeBSD/FreeBSD-1.1.5 tree at your favorite archive site.
-They're available both as raw disk images, and gzipped, to save time
-downloading.
-
-If you are using an AHA-154x or AHA-1742 SCSI host adapter, you need
-the kcopy-ah-floppy image. If you're using a BT-742 SCSI host adapter
-or an Ultrastor adaptor, then you'll need the kcopy-bt-floppy image.
-If you're using MFM/RLL/IDE disk controllers, you can use either
-kernel-copy floppy image.
-
-If you are using UNIX to make the floppies, you should use the command
-dd(1) to write the raw floppy images (i.e., kcopy-ah-floppy or
-kcopy-bt-floppy, filesystem-floppy and cpio-floppy) to the floppies.
-For example, to write kcopy-ah-floppy to a 5.25" 1.2 Mb floppy
-disk under 386BSD, use:
-
- $ dd if=kcopy-ah-floppy of=/dev/fd0a bs=30b count=80
-
-or for a 3.5" 1.44 Mb floppy:
-
- $ dd if=kcopy-ah-floppy of=/dev/fd0a bs=36b count=80
-
-If you are using DOS to make the floppies, use the rawrite.exe
-utility. This can be found in the "tools" subdirectory of the
-archive site. Copy rawrite.exe and the binary images to a DOS
-disk, type "rawrite" under MS-DOS and follow the instructions.
-Rawrite can write binary images to either 1.2MB or 1.44MB
-MS-DOS-formatted floppies.
-
-Any other programs from the tools directory that might be needed
-for installing FreeBSD, such as kermit, should be copied to a DOS-
-formatted floppy (1.2MB or 1.44MB). Under 386BSD, they can be
-copied to floppy using the mcopy command. Under DOS, use the DOS
-copy command.
-
-The steps necessary to prepare the distribution sets for installation
-depend on which method of installation you choose. The various methods
-are explained below.
-
-To prepare for installing via MS-DOS hard disk:
-
- To prepare FreeBSD for installaton from the MS-DOS C: drive
- of the hard disk, you need to do the following:
-
- If FreeBSD is installed on a hard disk containing
- a Primary MS-DOS partition (as opposed to an
- Extended DOS partition), then the FreeBSD distribution
- files can be read directly from DOS. Preparation
- is just a matter of copying the FreeBSD distribution
- files onto DOS C: drive of the hard disk.
-
- If FreeBSD is installed on a separate hard disk than
- MS-DOS, it is not currently possible to read the FreeBSD
- distribution files directly from DOS. In this case,
- a different medium should be used.
-
- Once you have the files on the C: drive, you can proceed to the
- next step in the installation process, viz preparing your hard
- disk.
-
-To prepare for installing via MS-DOS floppies:
-
- To prepare FreeBSD for installaton from MS-DOS floppies, you
- need to do the following:
-
- Count the number of "<set>_tgz.xx" files
- you have (these are split, gzip'ed, tar
- archives). Call this number N. You will
- need N/6 1.44M floppies, or N/5 1.2M
- floppies to install the distribution
- in this manner. For the set of bin files
- (i.e., 80 files) and 1.2 Mb floppies you will
- need 16 disks.
-
- Format all of the floppies, with MS-DOS.
- Don't make any of them MS-DOS bootable
- floppies (i.e., don't use "format /s"!)
- If you use "format /u" then the format
- will run a tad faster.
-
- Copy all of the "<set>_tgz.xx" files on
- the DOS disks. Under DOS use the DOS copy
- command. Under 386BSD, use, for instance,
- the make_floppies script:
-
- #!/bin/sh
- N_PER_DISK=5
-
- x=$N_PER_DISK
- for dist in bin_tgz.*; do
- if [ $x -ge $N_PER_DISK ]; then
- x=0
- echo -n "Insert next disk, "
- echo -n "and press ENTER... "
- read reply
- mdel a:/\*
- fi
- mcopy $dist a:/
- x=`expr $x + 1`
- done
-
- (Or you might use tar instead).
-
- Once you have the files on DOS disks, you can proceed to the
- next step in the installation process, viz preparing your hard
- disk.
-
-To prepare for installing via a tape:
-
- To install FreeBSD from a tape, you need to be somehow
- to get the FreeBSD filesets you wish to install on
- your system on to the appropriate kind of tape,
- in tar format.
-
- If you're making the tape on a UN*X system, the easiest
- way to do so is:
-
- tar cvf <tape_device> <files>
-
- where "<tape_device>" is the name of the tape device
- that describes the tape drive you're using (either
- /dev/rst0 for SCSI tape, otherwise /dev/rwt0).
- If you can't figure it out, ask your system administrator.
- "<files>" are the names of the "<set>.tar.gz.xx" files
- which you want to be placed on the tape.
-
- If your tape drive is not a type recognzed by the
- kernel, then it may be necessary to set the tape density
- using either the st(1) command (for SCSI tape) or the
- mt(1) command. Both these programs are available from
- the tools directory of the FreeBSD archive site.
-
-To prepare for installing via an NFS partition:
-
- NOTE: this method of installation is recommended
- only for those already familiar with using
- the BSD network-manipulation commands and
- interfaces. If you aren't, this documentation
- should help, but is not intended to be
- all-encompassing.
-
- Place the FreeBSD software you wish to install into
- a directory on an NFS server, and make that directory
- mountable by the machine which you will be installing
- FreeBSD on. This will probably require modifying the
- /etc/exports file of the NFS server and resetting
- mountd, acts which will require superuser privileges.
- Make a note of the numeric IP address of the NFS server
- and make a note of the router closest to the the new
- FreeBSD machine if the NFS server is not on a network
- which is directly attached to the FreeBSD machine.
-
- Once you have done this, you can proceed to the next
- step in the installation process, preparing your hard disk.
-
-To prepare for installing via FTP:
-
- NOTE: this method of installation is recommended
- only for those already familiar with using
- the BSD network-manipulation commands and
- interfaces. If you aren't, this documentation
- should help, but is not intended to be
- all-encompassing.
-
- The preparations for this method of installation
- are easy: all you have to do is make sure that
- there's some FTP site from which you can retrieve
- the FreeBSD installation when it's time to do
- the install. You should know the numeric IP
- address of that site, and the numeric IP address of
- your nearest router if the new FreeBSD computer is
- not on the same net or subnet as the FTP site.
-
- Once you have done this, you can proceed to the next
- step in the installation process, preparing your hard disk.
-
-To prepare for installing via Kermit:
-
- The preparations for this method of installation
- require that the kermit program be put on the
- dos-floppy installation disk. This will be
- loaded as part of the minimum base installation.
- Kermit is available from tools directory of the
- FreeBSD FTP site. This is a FreeBSD binary and
- only executes under the FreeBSD operating system.
-
- Once you have done this, you can proceed to the next
- step in the installation process, preparing your hard disk.
-
-To upgrade:
-
- (The beta upgrade script is available on request from
- FreeBSD-questions@freefall.cdrom.com)
-
-Preparing your Hard Disk for FreeBSD Installation:
---------- ---- ---- ---- --- ------ ------------
-
-NOTE: If you wish to install FreeBSD on your whole drive, (i.e. you do
-not want DOS or any other operating system on your hard disk), you can
-skip this section, and go on to "Installing the FreeBSD System."
-
-Firstly, be sure you have a reliable backup of any data which you may
-want to keep; repartitioning your hard drive is an excellent way to
-destroy important data.
-
-WARNING: If you are using a disk controller which supports disk
-geometry translation, BE SURE TO USE THE SAME PARAMETERS FOR FreeBSD AS
-FOR DOS! If you do not, FreeBSD will not be able to properly coexist
-with DOS.
-
-Secondly, make sure your disk has at least 16 Mbytes free space (or
-80 Mbytes for the complete binary distribition).
-
-You are now set to install FreeBSD on your hard drive.
-
-Installing the FreeBSD System:
----------- --- ------ ------
-
-If DOS or OS/2 is already installed on the hard disk, installation should
-be easy. By default FreeBSD is installed after the last DOS or OS/2
-partition. Otherwise, you may need to specify your hard disk's geometry
-(i.e., number of cylinders, heads and sectors per track).
-
-For computing partition sizes, it might help to have a calculator handy.
-
-And it's finally time to install the system!
-
-The following is a walk-through of the steps necessary to get FreeBSD
-installed on your hard disk. If you wish to stop the installation, you
-may hit Control-C at any prompt and then type `halt'.
-
- Boot from the kcopy-ah or kcopy-bt floppy, depending on
- your hard disk controller type.
-
- When prompted to insert the filesystem floppy, remove the
- kcopy floppy from the drive and insert filesystem floppy
- and hit any key.
- N.B.: The filesystem floppy must not be write protected.
-
- [When booting, if no message prompt appears after a
- reasonable period of time, reboot and try it again. If
- this doesn't work, try disabling your CPU's internal and
- external caches, and then try to boot again. If there is
- still no message prompt, then you can't install FreeBSD
- on your hardware. If you were able to install 386bsd,
- this is definitely a bug in our software; please report
- it! Please include your system configuration, and any
- other relevant information in your bug report.]
-
- The boot sequence continues after the filesystem floppy
- has been inserted. A copyright notice is displayed along
- with a list of the hardware that FreeBSD recognizes as
- being in your machine. You might want to make a note of
- the disk values for cylinders, heads, sectors etc for
- later use.
-
- After a short while (approximately 30 to 60 seconds), you
- should see a welcome message and a prompt, asking if you
- wish to proceed with the installation.
-
- If you wish to proceed, enter "y" and then return.
-
- You will then be asked what type of disk drive you have.
- The valid options are listed on the screen (e.g., SCSI, ESDI).
-
- You will then be asked for a label name for your disk.
- This should be a short, one-word name for your disk,
- e.g., "cp3100-mine" for a Conner Peripherals "3100" disk.
- You needn't remember this name.
-
- Next, you will be prompted for the geometry information.
- The default values should be correct, in which case just
- hit ENTER to accept them. Otherwise enter the values
- that were displayed during the boot sequence as they are
- requested.
-
- The default size of the FreeBSD portion of the disk
- is the maximum available at the end of the disk (which may
- be the whole disk). Accept the default by hitting ENTER.
- Otherwise, enter an appropriate value using the information
- displayed.
-
- If you are not installing on the whole disk, you will be
- asked for the offset of the FreeBSD partition from the
- beginning of the disk. Again, hit ENTER to accept the
- default, or enter a cylinder offset from the beginning of
- the disk.
-
- You will then be asked for the size of your root partition,
- in cylinders. The suggested maximum size is 15 Mbytes
- which is used as a default. Accept this, or enter a
- suitable value (after converting to cylinders using the
- formula displayed).
-
- Next, you will be asked for the size of your swap partition
- - again, you must calculate this in cylinders. You should
- probably allocate around twice as much swap space as you
- have RAM memory. If you wish the system to save crash dumps
- when it panics, you will need at least as much swap as you
- have RAM.
-
- The install program will then ask you for information about
- the rest of the partitions you want on your disk. For the
- purposes of this document, you only want one more: /usr.
- Therefore, at the prompt, when in asks you to enter the size
- of the next partition, enter the number of cylinders remaining
- in the FreeBSD portion of the disk. When it asks you for the
- mount point for this partition, say "/usr".
-
- After the FreeBSD partition have been assigned, install checks
- the disk for an MS-DOS partition. If one exists, you are prompted
- whether to make this accessible from FreeBSD (i.e., for reading
- and writing). And if you choose to make the DOS partition
- accessible, you are prompted for what directory it should
- be mounted on. "/dos" is used by default. With this
- choice, you could copy the contents of the DOS root
- directory (i.e., C:\), for instance, with the Unix command:
-
- # cp /dos/* .
-
- If have you a DOS partition and you don't want it visible
- from FreeBSD, just respond with "n" when asked whether to
- make it accessible.
-
- YOU ARE NOW AT THE POINT OF NO RETURN.
-
- If you confirm that you want to install FreeBSD, your hard
- drive will be modified, and perhaps it contents scrambled at
- the whim of the install program. This is especially likely
- if you gave the install program incorrect information.
- Enter "no" at the prompt to get the option of redoing the
- configuration, using your previous choices as defaults.
-
- If you are sure you want to proceed, enter "yes" at the prompt.
-
- The install program now makes the filesystems you specified.
- If all goes well, there should be no errors in this section
- of the installation. If there are, restart from the the
- beginning of the installation process.
-
- After the installation program prompts you to see if you'd
- like to be told about all of the files it's going to copy
- to your hard drive, it will spend a few minutes copying these
- files and then will print out an informative message and
- place you at a "#" prompt.
-
- Read the message and note which partition (e.g., sd0a or wd0a)
- you need to copy a kernel to. Reboot the machine off the
- kcopy-xx-floppy disk, but this time at the prompt asking
- you to insert a file system floppy, do _not_ replace the
- floppy, just press <enter>.
-
- At the "kc>" prompt, enter "copy" to prepare to copy the
- kernel on the floppy to your hard disk.
-
- At the next "kc>" prompt, enter the disk partition to which
- you want to copy the kernel. (e.g., sd0a or wd0a).
-
- It will work for a minute or two, then present you with
- another "#" prompt. Follow the instructions given, (i.e.,
- halt the system) and reboot from the hard disk. You will
- probably have to do a hardware reset or else your ethernet
- card might not be recognised at reboot (e.g., if you have a
- WD8003EP card).
-
- When the machine boots, a three-line banner should appear at
- the top of the screen. In a few seconds, a series of
- messages will appear, describing the hardware in your machine.
- Once again, this stage can take up to two minutes, so DO NOT
- PANIC!
-
- You will be asked to insert the cpio-floppy into a floppy
- drive, and enter that drive's number. "0" corresponds to
- DOS's "A:" drive, "1" corresponds to DOS's "B:" drive.
-
- After you enter the number it will ask you if you'd like to
- watch its progress, and after you answer this question it
- will begin installing still more files on your hard disk.
- This should take no more than 3 minutes.
-
- You are given the option to load the dos-floppy disk.
- In particular, if you want to use kermit for downloading
- the distribution, the dos-floppy should have the kermit
- binary. Or if you are using SCSI tape, the dos-floppy should
- contain the st command.
-
- To load the dos-floppy, remove the cpio-floppy from the
- drive, insert the dos-floppy and enter a "yes" response
- at the prompt. Otherwise, enter "no" at the prompt.
-
- After the dos-floppy has been loaded, you are given (more)
- instructions, (e.g., to halt the system) and you should
- reboot the machine again, from the hard drive and probably
- with a hardware reset to kick your ethernet card back into
- life.
-
- CONGRATULATIONS: You now have the minimum base of FreeBSD
- files on your hard disk! Now you get to install the
- distribution file sets. Remember that, at minimum, you must
- install the bin.tar.gz.xx file set (see below for
- instructions).
-
- After the machine is done booting, you will be presented
- with a screenful of information about what to do next.
-
- What you do from this point on depends on which media you're
- using to install FreeBSD. Follow the appropriate
- instructions, given below.
-
- To install from MS-DOS hard disk partition, floppy or tape:
-
- The first thing you should do is to choose a temporary
- directory where the distribution files can be stored.
- To do this, use the command "set_tmp_dir" and enter
- your choice. The default is /usr/distrib.
-
- After you have chosen a temporary directory,
- you should issue the appropriate load command:
-
- load_dos - for loading from a MS-DOS hard disk
- partition, or from floppies,
-
- load_qic_tape - for loading from QIC-02 tape, or
-
- load_scsi_tape - for you're loading from the first
- SCSI tape drive in the system.
-
- If loading from tape, it may be necessary to first
- set the default density using the mt or st command.
- The low-density device (/dev/rst0 or /dev/rmt0)
- is used by the load_xx_tape command, so to prepare
- a SCSI device for reading QIC-150 tape, you might use:
-
- # st -f /dev/nrst0 rewind
- # st -f /dev/nrst0 low_dnsty 16
- # load_scsi_tape
-
- If loading from floppy or hard disk, the load_dos
- command prompts for information, such as to which
- floppy drive or hard disk directory to load from.
- Additional options are available, e.g., for listing
- and, if loading from hard disk, changing source
- directories.
-
- Go to the directory which contains the first
- distribution set you wish to install. This is
- either the directory you specified above, if using
- load_dos, or possibly a subdirectory of that
- directory, if you loaded from tape.
-
- When there, run "set_tmp_dir" again, and choose
- the default temporary directory, by hitting
- return at the prompt.
-
- Run the "extract" command, giving it as its sole
- argument the name of the distribution set you
- wish to extract. For example, to extract the binary
- distribution, use the command:
-
- extract bin
-
- and to extract the source distribution:
-
- extract src
-
- After the extraction is complete, go to the location
- of the next set you want to extract, "set_tmp_dir"
- again, and once again issue the appropriate
- extract command. Continue this process until
- you've finished installing all of the sets which you
- desire to have on your hard disk.
-
- After each set is finished, if you know that you
- are running low on space you can remove the
- distribution files for that set by saying:
-
- rm <set>*
-
- For example, if you wish to remove the distribution
- files for the binarydist set, after the "extract bin"
- command has completed, issue the command:
-
- rm bin*
-
- Once you have extracted all sets and are at the "#" prompt
- again, proceed to the section "Configuring Your System,"
- below.
-
- To install via FTP or NFS:
-
- First you must decide on a temporary directory to hold
- the <set>.tar.gz.xx files. The directory /usr/distrib
- is suggested. You should cd to it, if necessary do
- a mkdir first. Use set_tmp_dir to identify this
- directory to the install process.
-
- Configure the appropriate ethernet interface (e.g. ed0,
- ne0, etc.) up, with a command like:
-
- ifconfig <ifname> <ipaddr> [netmask <netmask>]
-
- where <ifname> is the interface name (e.g. ed0, etc.),
- and <ipaddr> is the numeric IP address of the interface.
- If the interface has a special netmask, supply
- the word "netmask" and that netmask at the end of the
- command line. For instance, without a special netmask:
-
- ifconfig ed0 129.133.10.10
-
- or with a special netmask
-
- ifconfig ed0 128.32.240.167 netmask 0xffffff00
-
- or the equivalent
-
- ifconfig ed0 128.32.240.167 netmask 255.255.255.0
-
- If you are using the AUI connector on a 3C503 card, you
- must also set the LLC0 flag (the default is to use the BNC
- connector):
-
- ifconfig ed0 130.252.23.86 llc0
-
- If the NFS server or FTP server is not on a directly-
- connected network, you should set up a route to it
- with the command:
-
- route add default <gate_ipaddr>
-
- where <gate_ipaddr> is your gateway's numeric IP address.
-
- If you are NFS-mounting the distribution sets,
- mount them on the temporary directory with the command:
-
- mount -t nfs <serv_ipaddr>:<dist_dir> <tmp_dir>
-
- where <serv_ipaddr> is the server's numeric IP address,
- <dist_dir> is the path to the distribution files on
- the server, and <tmp_dir> is the name of the local
- temporary directory (e.g., /usr/distrib). Proceed as if
- you had loaded the files from tape, "cd"ing to the
- appropriate directories and running "set_tmp_dir" and
- "extract" as appropriate.
-
- If you are retrieving the distribution sets using ftp,
- cd into the temp directory, and execute the command:
-
- ftp <serv_ipaddr>
-
- where <serv_ipaddr> is the server's numeric IP address.
- Get the files with FTP, taking care to use binary mode
- to transfer all files. A simple set of commands is
-
- ftp <serv_ipaddr>
- user ftp
- passwd <user-id>@
- hash
- binary
- prompt
- cd <where/the/binarydist/files/are>
- mget *
- cd <where/the/sourcedist/files/are>
- mget *
- quit
-
- Once you have all of the files for the distribution sets
- that you wish to install, you can proceed using the
- instructions above as if you had installed the files
- from a floppy.
-
- To install via Kermit:
-
- First you must decide on a temporary directory to hold
- the <set>.tar.gz.xx files. The directory /usr/distrib
- is suggested. You should cd to it, if necessary do
- a mkdir first. Use set_tmp_dir to identify this
- directory to the install process.
-
- Invoke kermit and dial the remote kermit server.
- A typical session might be:
- # stty -f /dev/sio01 clocal
- # kermit
- C-Kermit> set file type binary
- C-Kermit> set line /dev/sio01
- C-Kermit> set baud 9600
- C-Kermit> set receive packet 740
- C-Kermit> set window 4
- C-Kermit> set block 2
- C-Kermit> connect
- Connecting to /dev/sio01, speed 9600.
- The escape character is Ctrl-\ (ASCII 28, FS)
- Type the escape character followed by C to get back,
- or followed by ? to see other options.
- atdt 1234567 <-- dial the remote
- Connect 9600
- login: mylogin <-- login to the remote
- [...]
- remote$ kermit -ix <-- remote kermit as binary server
- [...]
- ^\C <-- return to local kermit
- C-Kermit> get bin_tgz* <-- request files from remote
- [...] (wait long for transfer to complete)
- C-Kermit> finish <-- terminate remote server
- C-Kermit> connect
- C-Kermit> exit <-- exit remote kermit
- remote$ exit <-- exit remote host
- ^\C <-- return to local kermit
- C-Kermit> exit <-- exit local kermit
-
- At this point the binary distribution should be
- downloaded to the FreeBSD system. Run the "extract"
- command, giving it as its sole argument the name
- of the distribution set you wish to extract. For
- example, to extract the binary distribution, use
- the command:
-
- extract bin
-
- and to extract the source distribution:
-
- extract src
-
- After the extraction is complete, go to the location
- of the next set you want to extract, "set_tmp_dir"
- again, and once again issue the appropriate
- extract command. Continue this process until
- you've finished installing all of the sets which you
- desire to have on your hard disk.
-
- After each set is finished, if you know that you
- are running low on space you can remove the
- distribution files for that set by saying:
-
- rm <set>*
-
- For example, if you wish to remove the distribution
- files for the binarydist set, after the "extract bin"
- command has completed, issue the command:
-
- rm bin*
-
- Once you have extracted all sets and are at the "#" prompt
- again, proceed to the section "Configuring Your System,"
- below.
-
-
-Further Tips on Installing FreeBSD
-------- ---- -- ---------- -------
-
- You might wish to install the binarydist first, get that
- working, and then at a later point in time have a go at
- installing the sourcedist. BEFORE YOU REBOOT AFTER INSTALLING
- THE BINARYDIS, you must preserve the commands that do the
- extracting. They are kept in the single-user-mode .profile
- file called /.profile. Proceed like this:
-
- mv /.profile /.profile.install
- ln /root/.profile /.profile
-
- When you are ready to install the sourcedist at some time
- in the future, get into multi-user mode (i.e., the normal
- means of running FreeBSD) and issue these commands:
-
- cp /.profile.install /.profile
- shutdown now
-
- This will cause the system to go into single-user mode, and
- the install profile will be active (i.e., you will find the
- commands load_dos, extract etc available to you again).
-
- If your disk has several operating systems, you may want
- to install a boot manager such as Thomas Wolfram's os-bs
- for selecting which system to boot. os-bs135.exe and other
- boot managers are available from the tools directory of
- the FreeBSD FTP site. os-bs works well with DOS, OS/2,
- FreeBSD and other systems, however, it cannot currently
- be used to boot FreeBSD from a second hard disk. Another
- boot manager, such as boot-easy should be used.
-
- To install, for instance, os-bs, boot the system with
- MS-DOS and insert the dos-floppy containing os-bs135.exe
- in floppy drive A:. Then enter the DOS commands:
- > A:
- > os-bs135
- > cd os-bs
- > os-bs
- A menu should now appear on the screen. Use the cursor keys
- to highlight the install option, hit ENTER, and follow the
- instructions from there.
-
- For more information about the ob-bs program, including its
- capabilities and limitations, see the file `readme.1st' in the
- os-bs directory.
-
- If your disk has several operating systems and you choose
- not to install os-bs, then fdisk can be used to change
- the boot system. This is done by making the primary
- partition for the boot system active. FreeBSD has an
- fdisk command that can be used for this purpose as well.
-
-
-Configuring Your System:
------------ ---- ------
-
-Once you have finished extracting all of the distribution sets that you
-want on your hard drive and are back at the "#" prompt, you are ready
-to configure your system.
-
-The configuration utility expects that you have installed the base
-system. If you have not, you will not be able to run it successfully
-(nor will you have a functional system regardless of configuration).
-
-To configure the newly installed operating system, run the command
-"configure".
-
-Configure will ask for the machine's hostname, domain name, and other
-network configuration information. You should check that configure has
-set up the following files correctly:
-
- /etc/netstart
- /etc/myname
-
-Once you have supplied configure all that it requests, your machine
-will be configured well enough that when you reboot it it will be a
-completely functional FreeBSD system. It is not completely configured,
-however; you should adjust the /etc/sendmail.cf file as necessary to
-suit your site and/or disable sendmail in /etc/rc and you should look
-in /etc/netstart to make sure the flags are defined correctly for your
-site. You might wish to set up several other tcp/ip files, such as
-
- /etc/resolv.conf
- /etc/networks
-
-Once you are done with configuration, reboot with the "reboot" command.
-
-When it boots off of the hard drive, you will have a complete FreeBSD
-system! CONGRATULATIONS! (You really deserve them!!!)
-
-
-Administrivia:
--------------
-
-Registration? What's that?
-
-If you've got something to say, do so! We'd like your input.
-
-Please send random comments to:
-
- FreeBSD-questions@freefall.cdrom.com
-
-Please send bug reports, and that sort of material to:
-
- FreeBSD-bugs@freefall.cdrom.com
-
-If you'd like to help with this effort, and have an idea as to how
-you could be useful, send mail to:
-
- FreeBSD-hackers@freefall.cdrom.com
-
-THANKS FOR USING THIS; that's what makes it all worthwhile.
-
-[a favor: Please avoid mailing huge documents or files to these mailing lists,
- as they will end up in our personal mail spools. We will be
- happy to make other arrangements]
-
-This is $Id: install_notes,v 1.14 1994/02/25 23:34:14 alm Exp $
diff --git a/etc/etc.i386/cdinst1.install b/etc/etc.i386/cdinst1.install
deleted file mode 100644
index 7b04dfb..0000000
--- a/etc/etc.i386/cdinst1.install
+++ /dev/null
@@ -1,1043 +0,0 @@
-#!/bin/sh
-# cd install floppy disk /install script
-#
-# $Id: cdinst1.install,v 1.6 1994/06/29 06:46:01 rgrimes Exp $
-
-# ${OPSYSTEM}, the mounting of the cdrom drive, and the path are all
-# setup by .profile
-#
-OPSYSID=165
-ROOTMIN=7
-SWAPMIN=8
-USRMIN=45
-DISKMIN=`expr $ROOTMIN + $SWAPMIN + $USRMIN + 1`
-DEFBLOCKING=2
-DEFSECT=17
-DEFHEAD=12
-DEFCYLN=1024
-RUN_FDISK=""
-
-DOS1_ID=1
-DOS2_ID=4
-DOS3_ID=6
-
-set_arbitrary_defaults() {
-cyls_per_disk=$DEFCYLN
-tracks_per_cyl=$DEFHEAD
-sects_per_track=$DEFSECT
-unused_last_part=3
-part_cnt=4
-}
-
-
-get_fdisk_data() {
-cyls_per_disk=
-part_id=
-got_sysid=
-part_cnt=0
-sysid_cnt=0
-have_opsys_part=
-have_dos_part=
-unused_last_part=
-extent_max=0
-extent_max_part=
-
-fdisk /dev/r${drivename}d >fdisk.out 2>fdisk.err
-if [ $? -gt 0 ]; then
- echo "Can't open /dev/r${drivename}d for reading!"
- set_arbitrary_defaults
- >fdisk.out
- >fdisk.err
- return 2
-elif [ -s fdisk.err ]; then
- echo "Disk doesn't appear to be initialized..."
- >fdisk.out
- >fdisk.err
- no_part_table=1
-fi
-while read data; do
- if [ ! "$cyls_per_disk" ]; then
- cyls_per_disk=`expr "$data" : '[^=]*=\([0-9]*\)'`
- tracks_per_cyl=`expr "$data" : '[^=]*=[^=]*=\([0-9]*\)'`
- sects_per_track=`expr "$data" : '[^=]*=[^=]*=[^=]*=\([0-9]*\)'`
- continue
- fi
- if [ "$got_sysid" ]; then
- start_part=`expr "$data" : '[^0-9]*\([0-9]*\)'`
- size_part=`expr "$data" : '[^0-9]*[0-9]*[^0-9]*\([0-9]*\)'`
- extent_part=`expr $start_part + $size_part`
- if [ $extent_part -gt $extent_max ]; then
- extent_max=$extent_part
- extent_max_part=$part_id
- fi
- eval start${part_id}=$start_part
- eval size${part_id}=$size_part
- sysid_cnt=`expr $sysid_cnt + 1`
- got_sysid=
- part_id=
- elif [ "$part_id" ]; then
- sysid=`expr "$data" : 'sysid \([0-9]*\)'`
- sysname=`expr "$data" : 'sysid[^(]*(\([^)]*\)'`
- if [ "$no_part_table" -o "$sysid" = "0" -o \
- "$(expr "$data" : '\(<UNUSED>\)')" = "<UNUSED>" ]; then
- unused_last_part=$part_id
- part_id=
- continue
- fi
- if [ "$sysid" = "$OPSYSID" ]; then
- have_opsys_part=$part_id
- elif [ ! "$have_dos_part" -a \( "$sysid" = "$DOS1_ID" -o \
- "$sysid" = "$DOS2_ID" -o "$sysid" = "$DOS3_ID" \) ]; then
- have_dos_part=$part_id
- fi
- eval sysid${part_id}=$sysid
- eval sysname${part_id}=\"$sysname\"
- got_sysid=1
- else
- part_id=`expr "$data" : 'The data[^0-9]*\([0-9]*\)'`
- beg_cyl=`expr "$data" : '[ ]*beg[^0-9]*\([0-9]*\)'`
- end_cyl=`expr "$data" : '[ ]*end[^0-9]*\([0-9]*\)'`
- if [ "$part_id" ]; then
- part_cnt=`expr $part_cnt + 1`
- elif [ "${beg_cyl}" -gt "${cyls_per_disk}" -o \
- "${end_cyl}" -gt "${cyls_per_disk}" ]; then
- no_part_table=1
- sysid_cnt=0
- have_opsys_part=0
- unused_last_part=`expr $part_cnt - 1`
- fi
- fi
-done <fdisk.out
-if [ ! "$cyls_per_disk" ]; then
- set_arbitrary_defaults
- return 2
-fi
->fdisk.out
->fdisk.err
-return 0
-}
-
-set_existing_part() {
-# Set existing partiton values as default (adjusting to cylinder boundaries)
-eval opsys_size=\$size${opsys_part}
-eval opsys_start=\$start${opsys_part}
-[ $opsys_size -eq 50000 ] && opsys_size=$disksize
-opsys_off=`expr $opsys_start / $cylindersize`
-opsys_adjusted=`expr $opsys_off \* $cylindersize`
-if [ $opsys_adjusted -lt $opsys_start -o $opsys_off -eq 0 ]; then
- opsys_off=`expr $opsys_off + 1`
- opsys_adjusted=`expr $opsys_off \* $cylindersize`
- opsys_size=`expr $opsys_size - $opsys_adjusted + $opsys_start`
-fi
-cyls_per_opsys=`expr $opsys_size / $cylindersize`
-RUN_FDISK="fdisk -u"
-}
-
-
-set_overwrite_part() {
-while :; do
- echo
- echo -n "Please specify partition to overwrite: [3] "
- read resp junk
- opsys_part=${resp:-3}
- if [ "$opsys_part" -ge 0 -a "$opsys_part" -le 3 ]; then
- break
- else
- echo
- echo "Partition must be in the range [0-3]"
- fi
-done
-set_existing_part
-}
-
-analyze_fdisk_data() {
-if [ "$part_cnt" -gt 0 ]; then
- echo
- echo "Partition Offset* Size* Name"
- echo "--------- ------ ---- ----"
- i=0
- while [ $i -lt $part_cnt ]; do
- pcyls=
- poff=
- eval psize=\$size${i}
- eval pstart=\$start${i}
- eval pname=\$sysname${i}
- [ "$psize" -eq 50000 ] && psize=$disksize
- if [ "$psize" ]; then
- poff=`expr $pstart / $cylindersize`
- padjusted=`expr $poff \* $cylindersize`
- if [ "$padjusted" -lt "$pstart" ]; then
- poff=`expr $poff + 1`
- padjusted=`expr $poff \* $cylindersize`
- psize=`expr $psize - $padjusted + $pstart`
- fi
- pcyls=`expr $psize / $cylindersize`
- fi
- echo -n "${i}"
- echo -n " ${poff:-0}"
- echo -n " ${pcyls:-0}"
- echo " ${pname:-(Unused)}"
- i=`expr $i + 1`
- done
- echo "* Sizes and offsets are in units of cylinders."
-fi
-# Case I: >1024 cylinders
-force_offset=
-if [ $cyls_per_disk -gt 1024 ]; then
- echo
- echo " WARNING: >1024 cylinders. On some hardware, this prevents"
- echo " ${OPSYSTEM} from sharing the disk with other operating systems."
- echo -n "Install ${OPSYSTEM} on entire disk, overwriting existing partitions? [n] "
- read resp junk
- case "$resp" in
- y*|Y*)
- RUN_FDISK=""
- force_offset=1
- opsys_off=0
- cyls_per_opsys=${cyls_per_disk}
- opsys_part=${unused_last_part:-3}
- return 0
- ;;
- *)
- echo
- echo "If the number of disk cylinders does not exceed 1024, then ${OPSYSTEM}"
- echo "can be installed alongside other operating systems on a single disk."
- echo "Otherwise, it is system-dependent whether this will work or not."
- echo "In the worst case, ${OPSYSTEM} MUST be installed at the beginning of"
- echo "the disk, and existing partitions will be lost."
- echo
- echo "For now, we will assume that >1024 cylinders creates no problems..."
- # FALL THROUGH
- ;;
- esac
-fi
-# Case II: no partitions used
-if [ $sysid_cnt -eq 0 ]; then
- echo
- echo " WARNING: partition table is either missing or corrupt."
- echo " Existing partitions will be lost."
- part_cnt=${part_cnt:-4}
- RUN_FDISK="overwrite"
- opsys_off=1
- cyls_per_opsys=`expr ${cyls_per_disk} - 1`
- opsys_part=${unused_last_part:-3}
- return 0
-# Case IIIa: overwrite an existing 386BSD/NetBSD/FreeBSD partition
-elif [ "$have_opsys_part" ]; then
- echo
- echo "386/Net/FreeBSD partition already exists!"
- echo -n "Overwrite existing partition? [n] "
- read resp junk
- case "$resp" in
- y*|Y*)
- opsys_part=${have_opsys_part}
- set_existing_part
- return 0
- ;;
- *)
- have_opsys_part=
- # FALL THROUGH
- ;;
- esac
-fi
-
-# Case IIIb: no partitions available
-if [ $sysid_cnt -eq $part_cnt -a ! "$have_opsys_part" ]; then
- echo
- echo "No unused partitions."
- echo -n "Install $OPSYSTEM and overwrite the entire disk? [n] "
- read resp junk
- case "$resp" in
- y*|Y*)
- # don't use first cylinder!
- opsys_off=1
- cyls_per_opsys=`expr $cyls_per_disk - 1`
- opsys_part=${unused_last_part}
- RUN_FDISK="overwrite"
- ;;
- *)
- set_overwrite_part
- ;;
- esac
- return 0
-fi
-
-
-# *** CAVEAT ***
-# $OPSYSTEM installs at the end of the disk. If the
-# beginning of the disk is free but not the end, install fails!
-
-# Assume `fdisk -u' to add $OPSYSTEM in last unused partition for remaining cases
-opsys_part=${unused_last_part}
-RUN_FDISK="fdisk -u"
-mb_sect=`expr 1024 \* 1024 / $bytes_per_sect`
-disk_minimum=`expr $DISKMIN \* $mb_sect`
-
-# Case IV: No room (at end of disk) for mininal install
-[ $extent_max -eq 50000 ] && extent_max=$disksize
-disk_remaining=`expr $disksize - $extent_max`
-if [ $disk_remaining -lt $disk_minimum ]; then
- echo
- echo "Not enough space ($DISKMIN Mb) at end of disk to install $OPSYSTEM."
- echo -n "Install FreeBSD and overwrite the entire disk? [n] "
- read resp junk
- case "$resp" in
- y*|Y*)
- # don't use first cylinder!
- opsys_off=1
- cyls_per_opsys=`expr $cyls_per_disk - 1`
- opsys_part=${unused_last_part}
- RUN_FDISK="overwrite"
- ;;
- *)
- echo
- echo -n "Overwrite an existing partition? [n] "
- read resp junk
- case "$resp" in
- y*|Y*)
- set_overwrite_part
- ;;
- *)
- echo
- echo " WARNING: To install ${OPSYSTEM}, you're on your own in figuring"
- echo " out where on the disk it will fit without overwriting another"
- echo " partition..."
- # Set defaults assuming there is only one partition at end of disk
- eval start=\$start${extent_max_part}
- # don't use first cylinder!
- opsys_off=1
- cyls_per_opsys=`expr $start / $cylindersize - 1`
- [ $cyls_per_opsys -lt 0 ] && cyls_per_opsys=0
- ;;
- esac
- ;;
- esac
- return 0
-fi
-
-# Case V: Room for $OPSYSTEM and partition data okay
-opsys_off=`expr $extent_max / $cylindersize`
-opsys_extent=`expr $opsys_off \* $cylindersize`
-[ $opsys_extent -lt $extent_max ] && opsys_off=`expr $opsys_off + 1`
-cyls_per_opsys=`expr $cyls_per_disk - $opsys_off`
-return 0
-}
-
-put_fdisk_data() {
-start=$root_offset
-size=$partition
-
-if [ "$RUN_FDISK" = "overwrite" ]; then
- # How do you overwrite without explicitly editing each entry?
- (
- echo y
- echo $cyls_per_disk
- echo $tracks_per_cyl
- echo $sects_per_track
- echo y
- ) >fdisk.script
- i=0
- n=`expr ${part_cnt:-4} - 1`
- while [ $i -lt $n ]; do
- echo y
- echo 0
- echo 0
- echo 0
- echo n
- echo y
- i=`expr $i + 1`
- done >>fdisk.script
- ( echo y
- echo ${OPSYSID}
- echo ${start}
- echo ${size}
- echo n
- echo y
- echo y
- echo ${n}
- echo y
- echo y
- ) >>fdisk.script
- fdisk -u /dev/r${drivename}d <fdisk.script >/dev/null 2>&1
-elif [ "$RUN_FDISK" ]; then
- $RUN_FDISK -${opsys_part:-${unused_last_part:-3}} /dev/r${drivename}d <<-EOF >/dev/null 2>&1
- y
- $cyls_per_disk
- $tracks_per_cyl
- $sects_per_track
- y
- y
- ${OPSYSID}
- ${start}
- ${size}
- n
- y
- y
- ${opsys_part:-${unused_last_part:-3}}
- y
- y
- EOF
-fi
-
-}
-
-echo
-echo "This program is designed to help put ${OPSYSTEM} on a hard disk with"
-echo "at least $DISKMIN Megabytes of free space."
-echo
-echo "Before starting, it is important to know your hard disk's geometry"
-echo "(i.e., number of cylinders, heads and sectors/track). If installing"
-echo "${OPSYSTEM} on the same disk as another operating system, then the"
-echo "two systems should use the same geometry. In particular, ${OPSYSTEM}'s"
-echo "default geometry is inappropriate for MS-DOS. So in this case, the"
-echo "DOS geometry should be used instead."
-echo
-echo "As with anything which modifies a hard drive's contents, this program"
-echo "can cause SIGNIFICANT DATA LOSS. We strongly recommend making sure"
-echo "that the hard drive is backed up before going further with the"
-echo "installation process."
-echo
-echo -n "Proceed with installation? [y] "
-read resp junk
-resp=${resp:-y}
-case "$resp" in
-y*|Y*)
- echo
- echo "Cool! Let's get to it..."
- echo
- echo "You will be given a chance to start over if you make a"
- echo "mistake during these questions."
- echo "At the end, you have the option of redoing the configuration."
- echo "If you really must quit at some point, type <CTRL>+C and"
- echo "enter \`halt' at the command prompt, \`#'."
- ;;
-*)
- echo
- echo "OK, then. Enter \`halt' to halt the machine."
- echo "Once the machine has halted, remove the floppy,"
- echo "and press any key to reboot."
- exit
- ;;
-esac
-
-mount -u /dev/fd0 / || {
- if mount -u /dev/fd1 / ; then
- echo "[Please ignore the above error message, that's normal.]"
- else
- echo "Oh boy, we're in trouble here: Could not mount floppy read-write."
- exit 1
- fi
-}
-sync
-verified_install=""
-while [ ! "$verified_install" ]; do # Begin of Big Loop
-
-rotdelay="-d 0 -n 1"
-drivename=wd0
-drivetype=wd
-sect_fwd=""
-echo
-echo "First, we need to know the drive type. This can be can be one of"
-echo "ESDI, SCSI, ST506, or IDE."
-echo -n "Drive type? [${type:-IDE}] "
-read resp junk
-type=${resp:-${type:-IDE}}
-case "$type" in
-e*|E*|st*|ST*)
- echo -n "Does it support AUTOMATIC sector remapping? [y] "
- read remap junk
- case "$remap" in
- n*|N*)
- sect_fwd="sf:"
- ;;
- esac
- case "$type" in
- e*|E*)
- DEFSECT=36
- ;;
- esac
- ;;
-i*|I*)
- type=ST506
- ;;
-sc*|SC*)
- drivename=sd0
- drivetype=sd
- type=SCSI
- DEFSECT=32
- DEFHEAD=64
- ;;
-*)
- echo "Unknown type. Assuming ST506 with automatic sectoring..."
- type=ST506
- ;;
-esac
-echo -n "Install onto which drive [$drivename] "
-read resp junk
-drivename=${resp:-${drivename}}
-echo
-echo "Disk $drivename is of device type $drivetype."
-if [ ! "$partition" ]; then
- echo
- echo "Please wait. Examining device /dev/r${drivename}d..."
- get_fdisk_data
- if [ $? -gt 1 ]; then
- echo "Hm - we can't seem to read that drive."
- echo
- echo -n "Are you sure that $type is the correct type? [n] "
- read resp
- case "$resp" in
- y*|Y*)
- echo
- echo "Well, since we can't even open it, there isn't much"
- echo "hope for writing a label on it. But you're free"
- echo "to give it a try. You need to specify the geometry."
- ;;
- *)
- echo
- echo "Okay. Let's start again from the top."
- continue
- ;;
- esac
- fi
-fi
-echo
-echo "Now we want to build a data base entry in /etc/disktab describing"
-echo "the geometry of the /dev/$drivename disk. The name of the entry"
-echo "should be descriptive of the disk's type and model. For example,"
-echo "a Maxtor IDE, model 7080 disk might be named \`maxtor7080'."
-echo -n "Disk label name (one word, please)? [${name:-mfr_model}] "
-read resp junk
-name=${resp:-${name:-mfr_model}}
-echo
-echo "${OPSYSTEM} should use the same hard disk geometry as used by other"
-echo "operating systems on the hard disk."
-echo -n "Number of bytes per disk sector? [${bytes_per_sect:-512}] "
-read resp junk
-bytes_per_sect=${resp:-${bytes_per_sect:-512}}
-echo
-echo -n "Total number of disk cylinders? [${cyls_per_disk:-${DEFCYLN}}] "
-read resp junk
-cyls_per_disk=${resp:-${cyls_per_disk:-${DEFCYLN}}}
-echo
-echo -n "Number of disk heads (i.e., tracks/cylinder)? [${tracks_per_cyl:-${DEFHEAD}}] "
-read resp junk
-tracks_per_cyl=${resp:-${tracks_per_cyl:-${DEFHEAD}}}
-echo
-echo -n "Number of disk sectors (i.e., sectors/track)? [${sects_per_track:-${DEFSECT}}] "
-read resp junk
-sects_per_track=${resp:-${sects_per_track:-${DEFSECT}}}
-cylindersize=`expr $sects_per_track \* $tracks_per_cyl`
-disksize=`expr $cylindersize \* $cyls_per_disk`
-mb_sect=`expr 1024 \* 1024 / $bytes_per_sect`
-mb_per_disk=`expr $disksize / $mb_sect`
-opsys_cyls_min=`expr $DISKMIN \* $mb_sect / $cylindersize`
-analyze_fdisk_data
-if [ $? -eq 0 ]; then
- partition=`expr $cyls_per_opsys \* $cylindersize`
- part_offset=`expr $opsys_off \* $cylindersize`
-fi
-echo
-echo "Disk has a total of $mb_per_disk Mb."
-echo "The size of the ${OPSYSTEM} portion of the disk must be at least"
-echo "${opsys_cyls_min} cylinders, and should not exceed $(expr $cyls_per_disk - 1) cylinders."
-echo "The offset of ${OPSYSTEM} from the beginning of the disk should be at"
-echo "least 1 cylinder."
-echo
-echo "For efficiency, partitions begin and end on cylinder boundaries."
-echo "If you know the size NN in Megabytes (Mb) of a partition you want, then"
-echo "use the following formula to determine the number NC of cylinders to use:"
-echo " NC = integer { ( NN * $mb_sect ) / $cylindersize }"
-while :; do
- echo -n "Total size of the ${OPSYSTEM} portion of the disk (in cylinders)? [${cyls_per_opsys:-`expr ${cyls_per_disk} - 1`}] "
- read resp junk
- cyls_per_opsys=${resp:-${cyls_per_opsys:-`expr ${cyls_per_disk} - 1`}}
- partition=`expr $cyls_per_opsys \* $cylindersize`
- if [ $cyls_per_opsys -lt $cyls_per_disk -a ! "$force_offset" ]; then
- echo
- echo -n "Offset of ${OPSYSTEM} from beginning of disk (in cylinders)? [${opsys_off:-1}] "
- read resp junk
- opsys_off=${resp:-${opsys_off:-1}}
- else
- echo
- echo " WARNING: Existing partitions will be lost. In addition,"
- echo " installing at cylinder 0 may cause problems for some disk"
- echo " controllers. If the filesystem is corrupted or install"
- echo " fails, install at cylinder 1."
- RUN_FDISK=""
- cyls_per_opsys=$cyls_per_disk
- partition=$disksize
- opsys_off=0
- fi
- part_offset=`expr $opsys_off \* $cylindersize`
- opsys_extent=`expr $opsys_off + $cyls_per_opsys`
- if [ ${opsys_extent} -gt ${cyls_per_disk} ]; then
- echo
- echo "${OPSYSTEM} Size + Offset cannot exceed ${cyls_per_disk} cylinders."
- elif [ ${cyls_per_opsys} -lt ${opsys_cyls_min} ]; then
- echo
- echo "${OPSYSTEM} requires at least ${opsys_cyls_min} cylinders to install."
- else break
- fi
-done
-badspacesec=0
-if [ "$sect_fwd" = "sf:" ]; then
- badspacecyl=`expr $sects_per_track + 126`
- badspacecyl=`expr $badspacecyl + $cylindersize - 1`
- badspacecyl=`expr $badspacecyl / $cylindersize`
- badspacesec=`expr $badspacecyl \* $cylindersize`
- echo
- echo -n "Using $badspacesec sectors ($badspacecyl cylinders) for the "
- echo "bad144 bad block table"
-fi
-whats_left=`expr $partition - $badspacesec`
-cyl_left=`expr $whats_left / $cylindersize`
-mb_left=`expr $whats_left / $mb_sect`
-swap_cyls_min=`expr $SWAPMIN \* $mb_sect / $cylindersize`
-root_cyls_max=`expr ${cyl_left} - ${swap_cyls_min}`
-root_cyls_min=`expr $ROOTMIN \* $mb_sect / $cylindersize`
-echo
-echo "There are $mb_left Mb ($cyl_left cylinders) to allocate."
-echo
-echo "The $OPSYSTEM portion of the disk must itself be divided into at least"
-echo "two partitions: one for the root filesystem and one for swap. It is a"
-echo "good idea to have at least a third (large) $OPSYSTEM partition for the /usr"
-echo "filesystem."
-echo
-echo "The root partition cannot exceed ${root_cyls_max} cylinders. It is usually"
-echo "no larger than about 15 Mb ($(expr 15 \* $mb_sect / $cylindersize) cylinders), and sometimes"
-echo "as small as $ROOTMIN Mb ($root_cyls_min cylinders)."
-if [ ! "$cyls_per_root" ]; then
- # set default root partition to 15MB
- cyls_per_root=`expr \( 15 \* $mb_sect \) / $cylindersize`
- usr_cyls_max=`expr ${root_cyls_max} - ${cyls_per_root}`
- mb_usr=`expr ${usr_cyls_max} \* $cylindersize / $mb_sect`
- [ $cyls_per_root -gt $root_cyls_max -o $mb_usr -lt $USRMIN ] &&
- cyls_per_root=$root_cyls_max
-fi
-while :; do
- echo -n "Root partition size (in cylinders)? [${cyls_per_root}] "
- read resp junk
- cyls_per_root=${resp:-${cyls_per_root}}
- root=`expr $cyls_per_root \* $cylindersize`
- if [ ${cyls_per_root} -gt ${root_cyls_max} ]; then
- echo
- echo "The root partition size cannot exceed $root_cyls_max cylinders."
- elif [ ${cyls_per_root} -lt ${root_cyls_min} ]; then
- echo
- echo "The root partition size must be at least $root_cyls_min cylinders."
- else
- part_used=`expr $root + $badspacesec`
- break
- fi
-done
-root_offset=$part_offset
-whats_left=`expr $partition - $part_used`
-cyl_left=`expr $whats_left / $cylindersize`
-mb_left=`expr $whats_left / $mb_sect`
-blocking_factor=2
-fragsize=`expr $bytes_per_sect \* $blocking_factor`
-blocksize=`expr $bytes_per_sect \* $blocking_factor \* 8`
-memsize=`dmesg | grep "^real mem" | awk '{ print $4 }'`
-mb_ram=`expr \( $memsize / 1024 / 1024 \) + 1`
-swap_mb=`expr \( 21 \* $mb_ram \) / 10`
-echo
-echo "$mb_left Mb ($cyl_left cylinders) remaining in ${OPSYSTEM} portion of disk."
-echo
-echo "Minimum swap space is $SWAPMIN Mb (${swap_cyls_min} cylinders.)"
-echo "For running X, with your RAM size of $mb_ram Mb,"
-echo "$swap_mb Mb (`expr \( \( 21 \* $mb_ram \* $mb_sect \) / 10 / ${cylindersize} \)` cylinders) of swap is recommended."
-if [ ! "$swap_cyl" ]; then
- swap_cyl=`expr \( 21 \* $mb_ram \* $mb_sect \) / 10`
- swap_cyl=`expr $swap_cyl / ${cylindersize}`
-
- # but not swap size more than 10% of disk size...
- swap_quot=`expr $mb_left / $mb_ram`
- if [ $swap_quot -lt 10 ]; then
- swap_cyl=$swap_cyls_min
- fi
-fi
-while :; do
- echo -n "Swap partition size (in cylinders)? [${swap_cyl}] "
- read resp junk
- swap_cyl=${resp:-${swap_cyl}}
- swap=`expr $swap_cyl \* $cylindersize`
- if [ ${swap_cyl} -gt ${cyl_left} ]; then
- echo
- echo "Swap size cannot exceed $cyl_left cylinders."
- elif [ ${swap_cyl} -lt ${swap_cyls_min} ]; then
- echo
- echo "Swap size must be at least ${swap_cyls_min} cylinders."
- else
- break
- fi
-done
-swap_offset=`expr $root_offset + $root`
-part_used=`expr $part_used + $swap`
-echo "" >/etc/disktab
-echo "$name|${OPSYSTEM} installation generated:\\" >>/etc/disktab
-echo " :dt=${type}:ty=winchester:\\" >>/etc/disktab
-echo -n " :nc#${cyls_per_disk}:ns#${sects_per_track}" >>/etc/disktab
-echo ":nt#${tracks_per_cyl}:\\" >>/etc/disktab
-echo " :se#${bytes_per_sect}:${sect_fwd}\\" >>/etc/disktab
-echo -n " :pa#${root}:oa#${root_offset}" >>/etc/disktab
-echo ":ta=4.2BSD:ba#${blocksize}:fa#${fragsize}:\\" >>/etc/disktab
-echo " :pb#${swap}:ob#${swap_offset}:tb=swap:\\" >>/etc/disktab
-echo " :pc#${partition}:oc#${part_offset}:\\" >>/etc/disktab
-ename="";fname="";gname="";hname=""
-if [ $part_used -lt $partition ]; then
- echo
- echo "Now we enter information about any other partitions and filesystems"
- echo "to be created in the ${OPSYSTEM} portion of the disk. This process"
- echo "is complete when we've filled up all remaining space in the ${OPSYSTEM}"
- echo "portion of the disk."
-fi
-while [ $part_used -lt $partition ]; do
- part_size=0
- whats_left=`expr $partition - $part_used`
- cyl_left=`expr $whats_left / $cylindersize`
- mb_left=`expr $whats_left / $mb_sect`
- echo
- echo "$mb_left Mb ($cyl_left cylinders) remaining in ${OPSYSTEM} portion of disk."
- echo
- while :; do
- echo -n "Next partition size (in cylinders)? [${cyl_left}] "
- read resp junk
- part_size=${resp:-${cyl_left}}
- part_size=`expr $part_size \* $cylindersize`
- total=`expr $part_used + $part_size`
- if [ $total -gt $partition ]; then
- echo
- echo "Partition size cannot exceed ${cyl_left} cylinders."
- else
- part_used=$total
- part_name=""
- while [ "$part_name" = "" ]; do
- echo
- echo -n "On which directory should this filesystem be mounted? [usr] "
- read resp junk
- part_name=${resp:-usr}
- part_name=`expr X"$part_name" : 'X/*\(.*\)'`
- done
- break
- fi
- done
- if [ ! "$ename" ]; then
- ename=$part_name
- offset=`expr $part_offset + $root + $swap`
- echo -n " :pe#${part_size}:oe#${offset}" >>/etc/disktab
- echo ":te=4.2BSD:be#${blocksize}:fe#${fragsize}:\\" >>/etc/disktab
- offset=`expr $offset + $part_size`
- elif [ ! "$fname" ]; then
- fname=$part_name
- echo -n " :pf#${part_size}:of#${offset}" >>/etc/disktab
- echo ":tf=4.2BSD:bf#${blocksize}:ff#${fragsize}:\\" >>/etc/disktab
- offset=`expr $offset + $part_size`
- elif [ ! "$gname" ]; then
- gname=$part_name
- echo -n " :pg#${part_size}:og#${offset}" >>/etc/disktab
- echo ":tg=4.2BSD:bg#${blocksize}:fg#${fragsize}:\\" >>/etc/disktab
- offset=`expr $offset + $part_size`
- elif [ ! "$hname" ]; then
- hname=$part_name
- echo -n " :ph#${part_size}:oh#${offset}" >>/etc/disktab
- echo ":th=4.2BSD:bh#${blocksize}:fh#${fragsize}:\\" >>/etc/disktab
- part_used=partition
- fi
-done
-if [ "$have_dos_part" -a "$have_dos_part" != "$opsys_part" -a \
- "$RUN_FDISK" != "overwrite" -a ! "$hname" ]; then
- echo
- echo "There appears to be a MS-DOS filesystem on the hard disk."
- echo -n "Make this be accessible from ${OPSYSTEM}? [y] "
- read resp junk
- case "${resp:-y}" in
- y*|Y*)
- part_name=""
- while [ "$part_name" = "" ]; do
- echo
- echo -n "On which directory should this filesystem be mounted? [dos] "
- read resp junk
- part_name=${resp:-dos}
- part_name=`expr X"$part_name" : 'X/*\(.*\)'`
- done
- hname=$part_name
- eval offset=\$start${have_dos_part}
- eval part_size=\$size${have_dos_part}
- echo -n " :ph#${part_size}:oh#${offset}" >>/etc/disktab
- echo ":th=MSDOS:\\" >>/etc/disktab
- part_used=partition
- ;;
- *)
- have_dos_part=""
- ;;
- esac
-else
- have_dos_part=""
-fi
-echo " :pd#${disksize}:od#0:" >>/etc/disktab
-sync
-
-# cat /etc/disktab
-OIFS=$IFS
-IFS='
-'
-while read data; do
- echo $data
-done < /etc/disktab
-IFS=$OIFS
-
-echo
-echo -n "Verbose installation? [n] "
-read resp
-
-case $resp in
-y*)
- cpioverbose=-v
- ;;
-*)
- cpioverbose=
- ;;
-esac
-
-
-echo
-echo "OK! THIS IS THE LAST CHANCE!!! Data on the hard disk wil be lost."
-echo -n "Are you sure you want to install on the hard drive? (yes/no) "
-resp=""
-while [ ! "$resp" ]; do
- read resp junk
- case "$resp" in
- Yes|yes|YES)
- verified_install=1
- echo
- echo "OK! Here we go..."
- ;;
- No|no|NO)
- echo
- echo -n "Would you like to change the configuration? [y] "
- read resp junk
- resp=${resp:-y}
- case "$resp" in
- y*|Y*)
- ;;
- *)
- echo
- echo "OK, then. Enter 'halt' to halt the machine."
- echo "Once the machine has halted, remove the floppy,"
- echo "and press any key to reboot."
- exit
- ;;
- esac
- ;;
- *)
- echo "Please spell out either of \`yes' or \`no'..."
- echo -n "Install on the hard disk? (yes/no) "
- resp=
- ;;
- esac
-done
-done # End of Big Loop
-
-put_fdisk_data
-
-echo
-echo -n "Labelling disk..."
-echo y |
-disklabel -w -r ${drivename} $name \
- ${CDROM_FILESYSTEM}/usr/mdec/${drivetype}boot \
- ${CDROM_FILESYSTEM}/usr/mdec/boot${drivetype}
-# XXX >/dev/null 2>&1
-echo " done."
-
-if [ "$sect_fwd" = "sf:" ]; then
- echo -n "Initializing bad144 badblock table..."
- bad144 $drivename 0
- echo " done."
- echo "Updating badblock table..."
- # `2>&1 >/dev/null' filters stdout and leaves only stderr...
- badlist=$(bad144 -s $drivename 2>&1 >/dev/null |
- while read data; do
- bad_seek=$(expr "$data" : '[^(]*(seek)[^0-9]*\([0-9]*\)')
- bad_read=$(expr "$data" : '[^(]*(read)[^0-9]*\([0-9]*\)')
- [ "$bad_seek" -o "$bad_read" ] && echo -n "$bad_seek $bad_read "
- done)
- [ "$badlist" ] && bad144 -a -c $drivename $badlist
- echo " done."
-fi
-
-echo "Initializing root filesystem, and mounting..."
-newfs ${rotdelay} /dev/r${drivename}a $name
-mount -v /dev/${drivename}a /mnt
-if [ "$ename" != "" ]; then
- echo
- echo "Initializing $ename filesystem, and mounting..."
- newfs ${rotdelay} /dev/r${drivename}e $name
- mkdir -p /mnt/$ename
- mount -v /dev/${drivename}e /mnt/$ename
-fi
-if [ "$fname" != "" ]; then
- echo
- echo "Initializing $fname filesystem, and mounting..."
- newfs ${rotdelay} /dev/r${drivename}f $name
- mkdir -p /mnt/$fname
- mount -v /dev/${drivename}f /mnt/$fname
-fi
-if [ "$gname" != "" ]; then
- echo
- echo "Initializing $gname filesystem, and mounting..."
- newfs ${rotdelay} /dev/r${drivename}g $name
- mkdir -p /mnt/$gname
- mount -v /dev/${drivename}g /mnt/$gname
-fi
-if [ "$hname" != "" ]; then
- echo
- if [ ! "$have_dos_part" ]; then
- echo "Initializing $hname filesystem, and mounting..."
- newfs ${rotdelay} /dev/r${drivename}h $name
- else
- echo "Initializing $hname filesystem..."
- fi
- mkdir -p /mnt/$hname
- [ ! "$have_dos_part" ] &&
- mount -v /dev/${drivename}h /mnt/$hname
-fi
-
-echo
-echo "Please wait. Copying to disk..."
-cd /mnt
-cat $CDROM_BINDIST | \
- gunzip | tar --extract --file - --preserve-permissions ${cpioverbose}
-
-echo "/dev/${drivename}a / ufs rw 1 1" >etc/fstab
-if [ "$ename" != "" ]; then
- echo "/dev/${drivename}e /$ename ufs rw 1 2" >>etc/fstab
-fi
-if [ "$fname" != "" ]; then
- echo "/dev/${drivename}f /$fname ufs rw 1 3" >>etc/fstab
-fi
-if [ "$gname" != "" ]; then
- echo "/dev/${drivename}g /$gname ufs rw 1 4" >>etc/fstab
-fi
-if [ "$hname" != "" ]; then
- if [ ! "$have_dos_part" ]; then
- echo "/dev/${drivename}h /$hname ufs rw 1 5" >>etc/fstab
- else
- echo "/dev/${drivename}h /$hname pcfs rw 0 0" >>etc/fstab
- fi
-fi
-
-cat /etc/disktab >etc/disktab.install
-cp -p /kernel /mnt
-
-echo
-echo "Building /dev files..."
-chroot /mnt sh <<!
-cd /dev
-sh MAKEDEV all
-cd /
-!
-echo " done."
-
-echo "You will now be prompted for information about this"
-echo "machine. If you hit return, the default answer (in"
-echo "brackets) will be used."
-
-echo
-echo -n "What is this machine's hostname? [unknown.host.domain] "
-read hname
-
-if [ "$hname" = "" ]; then
- hname=unknown.host.domain
-fi
-echo $hname > /mnt/etc/myname
-proto_domain=`echo $hname | sed -e 's/[^.]*\.//'`
-
-echo
-echo "What domain is this machine in (this is NOT its YP"
-echo -n "domain name)? [$proto_domain] "
-read dname
-
-if [ "$dname" = "" ]; then
- dname=$proto_domain
-fi
-
-echo
-echo -n "Does this machine have an ethernet interface? [y] "
-read resp
-case "$resp" in
-n*)
- ;;
-*)
- intf=
- while [ "$intf" = "" ]; do
- echo -n "What is the primary interface name (i.e. ed0, etc.)? "
- read intf
- done
- echo -n "What is the hostname for this interface? [$hname] "
- read ifname
- if [ "$ifname" = "" ]; then
- ifname=$hname
- fi
- ifaddr=
- while [ "$ifaddr" = "" ]; do
- echo -n "What is the IP address associated with this interface? "
- read ifaddr
- done
- echo "$ifaddr $ifname `echo $ifname | sed -e s/\.$dname//`" \
- >> /mnt/etc/hosts
-
- echo -n "Does this network have a special netmask? [n] "
- read resp
- case "$resp" in
- y*)
- echo -n "What is the netmask? [0xffffff00] "
- read resp
- if [ "$resp" = "" ]; then
- ifnetmask="netmask 0xffffff00
- else
- ifnetmask="netmask $resp"
- fi
- ;;
- *)
- ifnetmask=
- ;;
- esac
-
- echo -n "Does this network need additional flags? [n] "
- read resp
- case "$resp" in
- y*)
- echo -n "What flags? [llc0] "
- read ifflags
- if [ "$ifflags" = "" ]; then
- ifflags=llc0
- fi
- ;;
- *)
- ifflags=
- ;;
- esac
-
- echo "inet $ifname $ifnetmask $ifflags" > /mnt/etc/hostname.$intf
-
- echo ""
- echo "WARNING: you will need to finish the configuration of your"
- echo "network by editing /etc/netstart, read the comments in that"
- echo "file for more instructions."
- ;;
-esac
-
-echo
-echo "Your system should be set up now for operation."
-
-sync
-
-echo
-echo "The next step: reboot from the hard disk and enjoy the system!"
-echo
-echo "To do this, enter \`halt' now to halt the machine. After it"
-echo "announces that it has halted, remove the floppy from the drive"
-echo "and press any key to boot."
-echo
-echo "Okay, that's all for now. I'm waiting for you to enter \`halt'..."
diff --git a/etc/etc.i386/cdinst1.profile b/etc/etc.i386/cdinst1.profile
deleted file mode 100644
index ce4d0ca..0000000
--- a/etc/etc.i386/cdinst1.profile
+++ /dev/null
@@ -1,71 +0,0 @@
-#!bin/sh
-# cdinst1.profile floppy disk /.profile script
-PATH=/sbin:/bin:/usr/bin:/usr/sbin:.
-export PATH
-HOME=/root
-export HOME
-TERM=pc3
-export TERM
-TERMCAP="\
-pc3|ibmpc3:li#25:co#80:am:bs:bw:eo:cd=\E[J:ce=\E[K:cl=\Ec:cm=\E[%i%2;%2H:\
-do=\E[B:ho=\E[;H:nd=\E[C:up=\E[A:so=\E[7m:se=\E[0m:us=\E[4m:ue=\E[0m:\
-:ac=l\332q\304k\277x\263j\331m\300w\302u\264v\301t\303n\305:\
-:kb=^h:kh=\E[Y:ku=\E[A:kd=\E[B:kl=\E[D:kr=\E[C:"
-export TERMCAP
-
-# To bad uname is not availiable here!
-#
-OPSYSTEM=FreeBSD
-export OPSYSTEM
-CDROM_TYPE=0
-export CDROM_TYPE
-CDROM_MOUNT=/cdrom
-export CDROM_MOUNT
-CDROM_FILESYSTEM=${CDROM_MOUNT}/filesys
-export CDROM_FILESYSTEM
-CDROM_BINDIST=${CDROM_MOUNT}/tarballs/bindist/bin_tgz.*
-export CDROM_BINDIST
-
-echo
-echo "Welcome to ${OPSYSTEM}."
-echo
-
-# Lets find the cd rom drive and get it mounted so we have access to
-# all of the binaries, this is really ugly, but it uses the minimum
-# amount of support code and should always find us a cdrom drive if
-# there is one ready to use!
-
-while [ $CDROM_TYPE -eq 0 ]; do # Begin of cd drive loop
-
- mount -t isofs /dev/cd0a ${CDROM_MOUNT} >/dev/null 2>&1
- if [ $? -eq 0 ]; then
- CDROM_TYPE=1
- echo "Found and mounted SCSI CD ROM drive /dev/cd0a"
- else
- mount -t isofs /dev/mcd0a ${CDROM_MOUNT} >/dev/null 2>&1
- if [ $? -eq 0 ]; then
- CDROM_TYPE=2
- echo "Found and mounted Mitsumi CD ROM drive /dev/mcd0a"
- else
- mount -t isofs /dev/mcd1a ${CDROM_MOUNT} >/dev/null 2>&1
- if [ $? -eq 0 ]; then
- CDROM_TYPE=2
- echo "Found and mounted Mitsumi CD ROM drive /dev/mcd1a"
- else
- CDROM_TYPE=0
- echo "No cdrom drive found, are you sure the cd is in the"
- echo "drive and the drive is ready? Press return to make"
- echo -n "another attempt at finding the cdrom drive."
- read resp
- fi
- fi
- fi
-done # End of cd drive loop
-
-# Okay, we now have a cdrom drive and know what device to call it by, and
-# it should be mounted, so lets reset our path so we can use all the binaries
-# from the cd rom drive and export the set up variables for the install script
-#
-PATH=/sbin:/bin:/usr/bin:/usr/sbin:${CDROM_FILESYSTEM}/sbin:${CDROM_FILESYSTEM}/bin:${CDROM_FILESYSTEM}/usr/bin:${CDROM_FILESYSTEM}/usr/sbin:.
-
-/install
diff --git a/etc/etc.i386/cpio.install b/etc/etc.i386/cpio.install
deleted file mode 100755
index dda4457..0000000
--- a/etc/etc.i386/cpio.install
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-#
-# $Id$
-#
-
-echo
-echo -n "Copying to disk... "
-cd /
-gunzip < mnt/inst2.cpio.gz | cpio -idmu
-cd /mnt
-echo -n "Copying more to disk... "
-ls install magic | cpio -pdmu /
-echo -n "Copying even more to disk... "
-ls rc | cpio -pdmu /etc
-echo -n "Building /dev files... "
-cd /dev
-sh MAKEDEV all
-cd /
-echo "done."
-sync
diff --git a/etc/etc.i386/cpio.magic b/etc/etc.i386/cpio.magic
deleted file mode 100644
index 0e4ed0c..0000000
--- a/etc/etc.i386/cpio.magic
+++ /dev/null
@@ -1,388 +0,0 @@
-#!bin/sh
-# $Id: cpio.magic,v 1.12 1994/06/28 07:20:30 jkh Exp $
-#
-set_tmp_dir()
-{
- def_tmp_dir=`pwd`
- [ "$def_tmp_dir" = "/" ] && def_tmp_dir=/usr/distrib
- echo -n "Where do we ${1:-put} the distrbution files? [${def_tmp_dir}] "
- read tmp_dir
- [ ! "$tmp_dir" ] && tmp_dir=$def_tmp_dir
- if [ ! -d "$tmp_dir" ]; then
- /bin/rm -rf $tmp_dir
- mkdir -p $tmp_dir
- fi
- echo
-}
-tmp_dir()
-{
- if [ "$tmp_dir" = "" ]; then
- set_tmp_dir $1
- fi
- cd $tmp_dir
-}
-load_fd()
-{
- tmp_dir
- drive=
- altdrive=
- subdir=
- while [ -z "$drive" ]; do
- echo -n "Read from which drive (or ? for help)? [c] "
- read answer junk
- case "${answer:-c}" in
- a*b|A*B)
- drive=A; altdrive=B
- ;;
- b*a|B*A)
- drive=B; altdrive=A
- ;;
- a*|A*)
- drive=A; altdrive=A
- ;;
- b*|B*)
- drive=B; altdrive=B
- ;;
- c*|C*)
- while read data; do
- msdos_device=`expr X"$data" : 'X[ ]*\([^ ]*\)[^M]*pcfs'`
- msdos_dir=`expr X"$data" : 'X[ ]*[^ ]*[ ]*\([^ ]*\)'`
- [ "${msdos_device}" ] && break
- done </etc/fstab
- if [ ! "$msdos_device" ]; then
- echo
- echo "Cannot find MS-DOS in filesystem table"
- continue
- fi
- drive=C; altdrive=C
- while :; do
- echo
- echo -n "Read from which MS-DOS drive C: directory? [/] "
- read resp junk
- newdir=$(echo "${resp:-/}" | \
- awk '{ sub(/^[Cc]*:*/, ""); gsub(/\\/, "/"); gsub(/^\/*/, ""); gsub(/\/*$/, ""); print $0 }')
- if [ -d ${msdos_dir}/${newdir} ]; then
- subdir=$newdir
- break
- else
- echo "C:/${newdir}: No such directory"
- fi
- done
- ;;
- q*|Q*)
- drive=q
- ;;
- \?*)
- echo
- echo "Enter: To:"
- echo "------ ---"
- echo " a Read from floppy drive A:"
- echo " b Read from floppy drive B:"
- echo " c Read from MS-DOS hard drive C:"
- echo " ab Alternate between A: and B:, starting with A:"
- echo " ba Alternate between A: and B:, starting with B:"
- echo " q Quit"
- echo
- ;;
- esac
- done
- verbose=-v
- interactive=-i
- if [ "$drive" = "C" ]; then
- dir=${msdos_dir}
- elif [ "$drive" != "q" ]; then
- dir=/tmp/floppy
- [ -d $dir ] && umount $dir >/dev/null 2>&1
- [ -f $dir ] && rm -f $dir
- mkdir -p $dir
- fi
- while [ "$drive" != "q" ]
- do
- device=/dev/fd0
- [ "$drive" = "B" ] && device=/dev/fd1
- [ "$drive" = "C" ] && device=${msdos_device}
- echo;
- if [ "$drive" != "C" ]; then
- echo "Insert floppy in drive $drive:, then press RETURN to copy files,"
- echo -n "or enter option (? for help): "
- else
- echo -n "Press RETURN to copy files, or enter option (? for help): "
- fi
- read answer junk
- case "${answer:-g}" in
- c*|C*)
- if [ "$drive" != "C" ]; then
- echo "Cannot change directory: not reading from MS-DOS drive C:"
- else
- echo
- echo -n "Read from which MS-DOS drive C: directory? [/${subdir}] "
- read resp junk
- [ ! "$resp" ] && resp="/$subdir"
- absolute=`expr X"$resp" : 'X[Cc]*:*\([/\]\)'`
- subsub=$(echo "${resp}" | \
- awk '{ sub(/^[Cc]*:*/, ""); gsub(/\\/, "/"); gsub(/^\/*/, ""); gsub(/\/*$/, ""); print $0 }')
- if [ "$absolute" -o ! "$subdir" ]; then
- newsub=$subsub
- else
- newsub=$subdir/$subsub
- fi
- if [ -d ${dir}/${newsub} ]; then
- subdir=$newsub
- else
- echo "C:/${newsub}: No such directory"
- fi
- fi
- ;;
- g*|G*)
- sync
- if [ "$drive" = "C" ]; then
- [ "$verbose" ] &&
- { echo; echo "Copying files from MS-DOS C:/${subdir}"; }
- cp ${msdos_dir}/${subdir}/* .
- sync
- elif mount -t pcfs $verbose $device $dir; then
- [ "$verbose" ] &&
- { echo; echo "Copying files to disk..."; }
- cp $interactive $dir/* .
- sync
- umount $dir
- tmp=$drive; drive=$altdrive; altdrive=$tmp
- fi
- ;;
- i*|I*)
- tmp=$interactive; interactive=; [ -z "$tmp" ] && interactive=-i
- tmp=on; [ -z "$interactive" ] && tmp=off
- echo "interactive mode is $tmp"
- ;;
- l*|L*)
- sync
- [ "$verbose" ] && echo "Directory of ${drive}:/${subdir}"
- if [ "$drive" = "C" ]; then
- ls -l $dir/${subdir}
- else
- umount $dir >/dev/null 2>&1
- if mount -t pcfs $device $dir; then
- ls -l $dir/${subdir}
- umount $dir
- fi
- fi
- ;;
- o*|O*)
- tmp=$drive; drive=$altdrive; altdrive=$tmp
- ;;
- q*|Q*)
- drive=q
- ;;
- s*|S*)
- echo; echo -n "tmp_dir is set to $tmp_dir"
- [ "$tmp_dir" != "`pwd`" ] && echo -n " (physically `pwd`)"
- echo; echo "Free space in tmp_dir:"
- df -k .
- echo -n "Reading from drive $drive:"
- [ "$drive" != "$altdrive" ] && echo -n " and drive $altdrive:"
- echo
- tmp=on; [ -z "$verbose" ] && tmp=off
- echo "Verbose mode is $tmp"
- tmp=on; [ -z "$interactive" ] && tmp=off
- echo "Interactive mode is $tmp"
- ;;
- v*|V*)
- tmp=$verbose; verbose=; [ -z "$tmp" ] && verbose=-v
- tmp=on; [ -z "$verbose" ] && tmp=off
- echo "verbose mode is $tmp"
- ;;
- \?)
- echo
- echo "Enter: To:"
- echo "----- ---"
- echo "(just RETURN) Copy files from ${drive}:/${subdir} to $tmp_dir"
- echo " c Change directory of MS-DOS drive C:"
- echo " i Toggle interactive mode (cp -i)"
- echo " l List directory of current drive"
- echo " o Read from alternate floppy drive"
- echo " q Quit"
- echo " s Show status"
- echo " v Toggle verbose mode"
- echo
- ;;
- esac
- done
- echo "Working directory: `pwd`"
- unset verbose answer drive altdrive device dir subdir tmp interactive
-}
-load_dos()
-{
- load_fd
-}
-load_qic_tape()
-{
- tmp_dir
- echo -n "Insert tape into QIC tape drive and hit return to continue: "
- read foo
- tar --unlink -xvf /dev/rwt0
-}
-load_scsi_tape()
-{
- tmp_dir
- echo -n "Insert tape into SCSI tape drive and hit return to continue: "
- read foo
- tar --unlink -xvf /dev/nrst0
-}
-extract()
-{
- [ X"$1" = X"" ] && { echo "usage: extract dist-prefix"; return; }
- tmp_dir find
- echo -n "Would you like to be verbose about this? [n] "
- read verbose
- case $verbose in
- y*|Y*)
- tarverbose=--verbose
- ;;
- *)
- tarverbose=
- ;;
- esac
- #XXX ugly hacks to get around busy text files/symlink problems.
- if [ X"$1" = X"bin" ]; then
- rm -f /bin/sh.$$ /sbin/init.$$ /etc/termcap.$$
- mv /bin/sh /bin/sh.$$
- mv /sbin/init /sbin/init.$$
- mv /etc/termcap /etc/termcap.$$
- fi
- if [ X"$1" = X"des" ]; then
- rm -f /sbin/init.$$
- mv /sbin/init /sbin/init.$$
- fi
- for i in $*; do
- cat "$i"* |
- gunzip |
- (cd / ; tar --unlink --extract --file - --preserve-permissions ${tarverbose} )
- done
- sync
- [ X"$1" = X"bin" ] && echo "Run \`configure' to complete installation."
- echo "(wd is now: `pwd`)"
-}
-configure()
-{
- echo "You will now be prompted for information about this"
- echo "machine. If you hit return, the default answer (in"
- echo "brackets) will be used."
-
- echo
- echo -n "What is this machine's hostname? [unknown.host.domain] "
- read hname
-
- if [ "$hname" = "" ]; then
- hname=unknown.host.domain
- fi
- echo $hname > /etc/myname
- proto_domain=`echo $hname | sed -e 's/[^.]*\.//'`
-
- echo
- echo "What domain is this machine in (this is NOT its YP"
- echo -n "domain name)? [$proto_domain] "
- read dname
-
- if [ "$dname" = "" ]; then
- dname=$proto_domain
- fi
-
- echo
- echo -n "Does this machine have an ethernet interface? [y] "
- read resp
- case "$resp" in
- n*)
- ;;
- *)
- intf=
- while [ "$intf" = "" ]; do
- echo -n "What is the primary interface name (i.e. ed0, etc.)? "
- read intf
- done
- echo -n "What is the hostname for this interface? [$hname] "
- read ifname
- if [ "$ifname" = "" ]; then
- ifname=$hname
- fi
- ifaddr=
- while [ "$ifaddr" = "" ]; do
- echo -n "What is the IP address associated with this interface? "
- read ifaddr
- done
- echo "$ifaddr $ifname `echo $ifname | sed -e s/\.$dname//`" \
- >> /etc/hosts
-
- echo -n "Does this interface have a special netmask? [n] "
- read resp
- case "$resp" in
- y*)
- echo -n "What is the netmask? [0xffffff00] "
- read resp
- if [ "$resp" = "" ]; then
- ifnetmask="netmask 0xffffff00"
- else
- ifnetmask="netmask $resp"
- fi
- ;;
- *)
- ifnetmask=
- ;;
- esac
-
- echo -n "Does this interface need additional flags? [n] "
- read resp
- case "$resp" in
- y*)
- echo -n "What flags? [llc0] "
- read ifflags
- if [ "$ifflags" = "" ]; then
- ifflags=llc0
- fi
- ;;
- *)
- ifflags=
- ;;
- esac
-
- echo "inet $ifname $ifnetmask $ifflags" > /etc/hostname.$intf
-
- echo ""
- echo "WARNING: if you have any more ethernet interfaces, you"
- echo "will have to configure them by hand. Read the comments"
- echo "in /etc/netstart to learn how to do this"
- ;;
- esac
-
- echo
- echo "Setting up access to a nameserver:"
- echo -n "Do you want to configure /etc/resolv.conf? [n]: "
- read resp
- case "$resp" in
- y*)
- echo "OK: Configuring your /etc/resolv.conf"
- echo "If you need more information about resolv.conf"
- echo "type \"man 5 resolver\" once you have COMPLETED"
- echo "installation of the binary distribution."
- echo ""
-
- nameserver=
- while [ "$nameserver" = "" ]; do
- echo -n "Enter the IP number of your nameserver: "
- read nameserver
- done
-
- echo "nameserver $nameserver" > /etc/resolv.conf
-
- echo " "
- ;;
- *)
- ;;
- esac
-
- sync
-
- echo
- echo "OK. You should be completely set up now."
- echo "You should now reboot your machine by issuing the 'reboot' command"
- echo "after removing anything that happens to be in your floppy drive."
-}
diff --git a/etc/etc.i386/cpio.rc b/etc/etc.i386/cpio.rc
deleted file mode 100644
index c45e0e5..0000000
--- a/etc/etc.i386/cpio.rc
+++ /dev/null
@@ -1,102 +0,0 @@
-# $Id: cpio.rc,v 1.4 1994/06/04 12:00:51 jkh Exp $
-#
-
-stty status '^T'
-trap : 2
-trap : 3
-PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/distbin; export PATH
-if [ -e /fastboot ]
-then
- echo Fast boot ... skipping disk checks
-else
- echo Automatic reboot in progress...
- fsck -p
- case $? in
- 0)
- ;;
- 2)
- exit 1
- ;;
- 4)
- echo; echo README README README README README README README
- echo
- echo "NOTE: The above errors are expected if this is the"
- echo "first time you have booted from the hard disk after"
- echo "completing the floppy install"; echo
- echo "Automatic file system check changed the root file system"
- echo "The system must halt for these corrections to take effect"
- echo
- reboot
- echo "reboot failed... help!"
- exit 1
- ;;
- 8)
- echo "Automatic file system check failed... help!"
- exit 1
- ;;
- 12)
- echo "Reboot interrupted"
- exit 1
- ;;
- 130)
- exit 1
- ;;
- *)
- echo "Unknown error in reboot"
- exit 1
- ;;
- esac
-fi
-
-trap 2
-trap "echo 'Reboot interrupted'; exit 1" 3
-umount -a >/dev/null 2>&1
-mount -a -t nonfs
-rm -f /fastboot
-(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; })
-
-OPSYSTEM=FreeBSD
-# Sure wish we had uname at this point
-RELEASE="2.0.0 (Development)"
-NVTTYS="4"
-echo "${OPSYSTEM} Base System Release ${RELEASE}"
-echo ""
-echo "Congratulations, you've got ${OPSYSTEM} on the hard disk!"
-echo
-echo "Your system has been configured with ${NVTTYS} virtual terminals,"
-echo "though one has been reserved for X (should you need it) and has no"
-echo "login prompt on it. Once you've loaded the binary distribution and"
-echo "have rebooted the system, you can access these virtual terminals by"
-echo "pressing ALT-F<n>, where n is the function key number representing"
-echo "the virtual terminal you want to use. For more information, read"
-echo "the screen(4), kbdcontrol(1) and vidcontrol(1) man pages."
-echo
-echo "Press the return key for more installation instructions"
-read junkit
-echo
-echo "To finish installation:"
-echo "Pick a temporary directory by running set_tmp_dir. Make sure it's"
-echo "in a place with lots of space, probably under /usr."
-echo "Then, load the remaining distribution files into that temporary"
-echo "directory by issuing one of the following commands:"
-echo
-echo " load_dos load_fd load_qic_tape load_scsi_tape"
-echo
-echo "or by fetching the files with ftp (see the installation notes for"
-echo "information on how to do that)."
-echo
-echo "Once this is complete, extract the distribution files by issuing the"
-echo "command 'extract <distribution>' where <distribution> is the base name"
-echo "of the distribution files, e.g. 'base10'."
-echo
-echo "Once all of the filesets you wish to install have been extracted,"
-echo "enter the command 'configure' to finish setting up the system"
-echo " "
-echo "If you should wish to uninstall ${OPSYSTEM}, delete the partition by using the"
-echo "DOS 5 FDISK program. If installed on the entire drive, use the FDISK/MBR"
-echo "to remove the ${OPSYSTEM} bootstrap from the drive."
-echo 'erase ^H, kill ^U, intr ^C'
-stty newcrt erase ^H intr ^C kill ^U
-umask 0
-echo ". /magic" >>/.profile
-exit 1
diff --git a/etc/etc.i386/floppy.install_notes b/etc/etc.i386/floppy.install_notes
deleted file mode 100644
index ad216f1..0000000
--- a/etc/etc.i386/floppy.install_notes
+++ /dev/null
@@ -1,143 +0,0 @@
- FLOPPY INSTALLATION NOTES
- FreeBSD
- Release 1.1
-
-Welcome to FreeBSD! This document has been put together in an effort
-to make initial installation of the system from floppy as easy as possible.
-
-1. To install FreeBSD you will need 3 (or 4 if you choose to add the optional
- DOS floppy) floppies, as well as the bulk of the distribution on some
- other medium (floppy, tape, CD, etc). If you've retrieved this release
- from the net, you'll first have to make the floppies yourself using
- the supplied images.
-
- Due to the differences in PC configurations, we've found it necessary
- to provide multiple initial boot images that provide kernels for
- different types of systems.
-
- If your disk controller is one of:
-
- MFM / RLL / IDE / ST506
- Adaptec 154x series
- Adaptec 174x series
- Buslogic 545S
-
- Then please use the disk image: kcopy_ah.flp
- to construct your boot floppy.
-
- If your disk controller is one of:
-
- Bustek 742a
- UltraStore 14F or 34F
-
- Then please use the disk image: kcopy_bt.flp
- to construct your boot floppy.
-
- Next, make a second floppy from the disk image: filesyst.flp
- You'll need this for the second stage of the boot process.
-
- Finally, make a third floppy from the disk image: cpio.flp
- You'll need this for the last stage of the boot process.
-
- If you want to use any of the optional tools in the tools
- subdirectory of the ftp distribution site, these should be
- copied directly to a DOS formatted disk (using, either mcopy
- or mount -t pcfs). This disk is referred to later as the
- optional "dos" floppy.
-
- If installing more than one operating system on a disk, then
- it is recommended that the dos floppy at least include the
- os-bs boot manager. If downloading files via a modem and SLIP
- is not available, then the dos floppy should include kermit.
- You'll have the option of loading the programs that are on
- the dos floppy in the last stage of the boot process.
-
-2. Boot the first floppy. When it asks you to insert the file system floppy,
- insert the second floppy ``filesyst.flp.'' Follow the instructions
- that floppy gives you. If partitions already exist on the hard disk,
- then by default FreeBSD attempts to install itself at the end of these.
- Before rebooting, note the type of disk it says to copy the kernel
- to: ``sd0a'' or ``wd0a'' (``sd0a'' is for SCSI systems, ``wd0a'' is
- for all others.) When the system halts, go on to the next step.
-
-3. Boot the first floppy again, but this time when it asks
- you to insert the file system floppy, just press the return key.
- Follow the instructions that the floppy gives you. When you see
- the ``kc>'' prompt, type ``copy'' (without quotes). At the next prompt,
- ``copy kernel to>'', type either ``sd0a'' or ``wd0a'' as given in
- the previous step. When the system halts, go on to the next step.
-
-4. Making sure that there's no floppy in the drive, press return to boot
- from the hard disk. After it has booted and is asking what drive the
- cpio floppy is in, insert the third floppy ``cpio.flp'' into a
- floppy drive and answer the question about what drive it is in.
- Note that 0 is the same as DOS drive A:, and 1 is the same as DOS
- drive B:
-
-5. After the cpio floppy has been copied to the disk, remove it from the
- drive. If there are programs on the dos-floppy that you would like
- installed, then insert this disk in a floppy drive, again specifying
- the drive to read from.
-
-6. After the cpio (or optional dos) floppy has been copied to the disk,
- enter `halt' at the command prompt.
-
-7. When the system asks you to press the return key to reboot, first
- remove the floppy and then press the return key to boot from the hard
- disk.
-
-8. At this point you will get 4 errors from the fsck on boot, these
- are normal and are caused by files that were open when the
- /dev entries were built - just ignore them. The system will
- correct these errors and then halt, after which you should press
- the return key again to reboot with a clean system.
-
-9. Congratulations, you've got the mini FreeBSD system on your disk!
-
-10. Follow the instructions about set_tmp_dir and extract that
- will come on your screen after you've pressed the return key.
-
-11. Run the configure command to set up some of the /etc files by
- typing ``configure''. You will have to edit /etc/netstart after
- this if you have a networking interface.
-
-12. Reboot so that the system comes up multiuser by typing ``reboot''.
-
-13. You are now running FreeBSD! Congratulations! You may now continue
- with installing the source distribution, or stop here for now.
-
-14. The file /magic contains the special sh commands used during
- installation. Should you need to use them you can do the following.
-
- /bin/sh
- . /magic
-
-15. If your disk has several operating systems, you may want to
- install the Thomas Wolfram's os-bs boot manager for selecting
- which system to boot. This works well with DOS, OS/2, FreeBSD
- and other systems. To install it, boot the system with MS-DOS
- and insert the dos-floppy of the FreeBSD install suite in
- floppy drive A:. Then enter the DOS commands:
- > A:
- > os-bs135
- > cd os-bs
- > os-bs
- A menu should now appear on the screen. Use the cursor keys
- to highlight the install option and hit ENTER. Simply follow the
- instructions from there.
-
- For more information about the ob-bs program, including its
- capabilities and limitations, see the file `readme.1st' in the
- os-bs directory.
-
- If you choose not to install os-bs, then fdisk can be used to
- change the boot system. This is done by making the primary
- partition for the boot system active. FreeBSD has an fdisk
- command that can be used for this purpose as well.
-
-16. In addition to the FreeBSD source and binary distributions, many
- additional packages, such as X11 and TeX, may be obtained from
- freebsd.cdrom.com - please have a look around! You may also find
- this a good time to read the release notes in RELNOTES.FreeBSD.
-
-End of $Id: floppy.install_notes,v 1.14 1994/05/15 01:09:23 rgrimes Exp $
diff --git a/etc/etc.i386/inst1.install b/etc/etc.i386/inst1.install
deleted file mode 100755
index 395928e..0000000
--- a/etc/etc.i386/inst1.install
+++ /dev/null
@@ -1,1042 +0,0 @@
-#!/bin/sh
-# install1.fs disk 'install'
-#
-# Currently, no method for checking to see if the designated disk type is
-# already in /etc/disktab. You can edit it out of the file after installation.
-#
-PATH=/sbin:/bin:/usr/bin:/usr/sbin:.
-export PATH
-
-OPSYSTEM=FreeBSD
-OPSYSID=165
-ROOTMIN=8
-SWAPMIN=8
-USRMIN=7
-DISKMIN=`expr $ROOTMIN + $SWAPMIN + 1`
-DEFBLOCKING=2
-DEFSECT=17
-DEFHEAD=12
-DEFCYLN=1024
-RUN_FDISK=""
-
-DOS1_ID=1
-DOS2_ID=4
-DOS3_ID=6
-
-set_arbitrary_defaults() {
-cyls_per_disk=$DEFCYLN
-tracks_per_cyl=$DEFHEAD
-sects_per_track=$DEFSECT
-unused_last_part=3
-part_cnt=4
-}
-
-
-get_fdisk_data() {
-cyls_per_disk=
-part_id=
-got_sysid=
-part_cnt=0
-sysid_cnt=0
-have_opsys_part=
-have_dos_part=
-unused_last_part=
-extent_max=0
-extent_max_part=
-
-fdisk /dev/r${drivename}d >fdisk.out 2>fdisk.err
-if [ $? -gt 0 ]; then
- echo "Can't open /dev/r${drivename}d for reading!"
- set_arbitrary_defaults
- >fdisk.out
- >fdisk.err
- return 2
-elif [ -s fdisk.err ]; then
- echo "Disk doesn't appear to be initialized..."
- no_part_table=1
-fi
-while read data; do
- if [ ! "$cyls_per_disk" ]; then
- cyls_per_disk=`expr "$data" : '[^=]*=\([0-9]*\)'`
- tracks_per_cyl=`expr "$data" : '[^=]*=[^=]*=\([0-9]*\)'`
- sects_per_track=`expr "$data" : '[^=]*=[^=]*=[^=]*=\([0-9]*\)'`
- continue
- fi
- if [ "$got_sysid" ]; then
- start_part=`expr "$data" : '[^0-9]*\([0-9]*\)'`
- size_part=`expr "$data" : '[^0-9]*[0-9]*[^0-9]*\([0-9]*\)'`
- extent_part=`expr $start_part + $size_part`
- if [ $extent_part -gt $extent_max ]; then
- extent_max=$extent_part
- extent_max_part=$part_id
- fi
- eval start${part_id}=$start_part
- eval size${part_id}=$size_part
- sysid_cnt=`expr $sysid_cnt + 1`
- got_sysid=
- part_id=
- elif [ "$part_id" ]; then
- sysid=`expr "$data" : 'sysid \([0-9]*\)'`
- sysname=`expr "$data" : 'sysid[^(]*(\([^)]*\)'`
- if [ "$no_part_table" -o "$sysid" = "0" -o \
- "$(expr "$data" : '\(<UNUSED>\)')" = "<UNUSED>" ]; then
- unused_last_part=$part_id
- part_id=
- continue
- fi
- if [ "$sysid" = "$OPSYSID" ]; then
- have_opsys_part=$part_id
- elif [ ! "$have_dos_part" -a \( "$sysid" = "$DOS1_ID" -o \
- "$sysid" = "$DOS2_ID" -o "$sysid" = "$DOS3_ID" \) ]; then
- have_dos_part=$part_id
- fi
- eval sysid${part_id}=$sysid
- eval sysname${part_id}=\"$sysname\"
- got_sysid=1
- else
- part_id=`expr "$data" : 'The data[^0-9]*\([0-9]*\)'`
- beg_cyl=`expr "$data" : '[ ]*beg[^0-9]*\([0-9]*\)'`
- end_cyl=`expr "$data" : '[ ]*end[^0-9]*\([0-9]*\)'`
- if [ "$part_id" ]; then
- part_cnt=`expr $part_cnt + 1`
- elif [ "${beg_cyl}" -gt "${cyls_per_disk}" -o \
- "${end_cyl}" -gt "${cyls_per_disk}" ]; then
- no_part_table=1
- sysid_cnt=0
- have_opsys_part=0
- unused_last_part=`expr $part_cnt - 1`
- fi
- fi
-done <fdisk.out
-if [ ! "$cyls_per_disk" ]; then
- set_arbitrary_defaults
- return 2
-fi
->fdisk.out
->fdisk.err
-return 0
-}
-
-set_existing_part() {
-# Set existing partiton values as default (adjusting to cylinder boundaries)
-eval opsys_size=\$size${opsys_part}
-eval opsys_start=\$start${opsys_part}
-[ $opsys_size -eq 50000 ] && opsys_size=$disksize
-opsys_off=`expr $opsys_start / $cylindersize`
-opsys_adjusted=`expr $opsys_off \* $cylindersize`
-if [ $opsys_adjusted -lt $opsys_start -o $opsys_off -eq 0 ]; then
- opsys_off=`expr $opsys_off + 1`
- opsys_adjusted=`expr $opsys_off \* $cylindersize`
- opsys_size=`expr $opsys_size - $opsys_adjusted + $opsys_start`
-fi
-cyls_per_opsys=`expr $opsys_size / $cylindersize`
-RUN_FDISK="fdisk -u"
-}
-
-
-set_overwrite_part() {
-while :; do
- echo
- echo -n "Please specify partition to overwrite: [3] "
- read resp junk
- opsys_part=${resp:-3}
- if [ "$opsys_part" -ge 0 -a "$opsys_part" -le 3 ]; then
- break
- else
- echo
- echo "Partition must be in the range [0-3]"
- fi
-done
-set_existing_part
-}
-
-analyze_fdisk_data() {
-if [ "$part_cnt" -gt 0 ]; then
- echo
- echo "Partition Offset* Size* Name"
- echo "--------- ------ ---- ----"
- i=0
- while [ $i -lt $part_cnt ]; do
- pcyls=
- poff=
- eval psize=\$size${i}
- eval pstart=\$start${i}
- eval pname=\$sysname${i}
- [ "$psize" -eq 50000 ] && psize=$disksize
- if [ "$psize" ]; then
- poff=`expr $pstart / $cylindersize`
- padjusted=`expr $poff \* $cylindersize`
- if [ "$padjusted" -lt "$pstart" ]; then
- poff=`expr $poff + 1`
- padjusted=`expr $poff \* $cylindersize`
- psize=`expr $psize - $padjusted + $pstart`
- fi
- pcyls=`expr $psize / $cylindersize`
- fi
- echo -n "${i}"
- echo -n " ${poff:-0}"
- echo -n " ${pcyls:-0}"
- echo " ${pname:-(Unused)}"
- i=`expr $i + 1`
- done
- echo "* Sizes and offsets are in units of cylinders."
-fi
-# Case I: >1024 cylinders
-force_offset=
-if [ $cyls_per_disk -gt 1024 ]; then
- echo
- echo " WARNING: >1024 cylinders. On some hardware, this prevents"
- echo " ${OPSYSTEM} from sharing the disk with other operating systems."
- echo -n "Install ${OPSYSTEM} on entire disk, overwriting existing partitions? [n] "
- read resp junk
- case "$resp" in
- y*|Y*)
- RUN_FDISK=""
- force_offset=1
- opsys_off=0
- cyls_per_opsys=${cyls_per_disk}
- opsys_part=${unused_last_part:-3}
- return 0
- ;;
- *)
- echo
- echo "If the number of disk cylinders does not exceed 1024, then ${OPSYSTEM}"
- echo "can be installed alongside other operating systems on a single disk."
- echo "Otherwise, it is system-dependent whether this will work or not."
- echo "In the worst case, ${OPSYSTEM} MUST be installed at the beginning of"
- echo "the disk, and existing partitions will be lost."
- echo
- echo "For now, we will assume that >1024 cylinders creates no problems..."
- # FALL THROUGH
- ;;
- esac
-fi
-# Case II: no partitions used
-if [ $sysid_cnt -eq 0 ]; then
- echo
- echo " WARNING: partition table is either missing or corrupt."
- echo " Existing partitions will be lost."
- part_cnt=${part_cnt:-4}
- RUN_FDISK="overwrite"
- opsys_off=1
- cyls_per_opsys=`expr ${cyls_per_disk} - 1`
- opsys_part=${unused_last_part:-3}
- return 0
-# Case IIIa: overwrite an existing 386BSD/NetBSD/FreeBSD partition
-elif [ "$have_opsys_part" ]; then
- echo
- echo "386/Net/FreeBSD partition already exists!"
- echo "${OPSYSTEM} cannot be installed alongside an existing BSD partition."
- echo -n "Overwrite existing partition? [y] "
- read resp junk
- case "${resp:-y}" in
- y*|Y*)
- opsys_part=${have_opsys_part}
- set_existing_part
- return 0
- ;;
- *)
- echo
- echo "Installation aborted. Enter \`halt' to halt the machine."
- echo "Once the machine has halted, remove the floppy,"
- echo "and press any key to reboot."
- exit
- ;;
- esac
-fi
-
-# Case IIIb: no partitions available
-if [ $sysid_cnt -eq $part_cnt -a ! "$have_opsys_part" ]; then
- echo
- echo "No unused partitions."
- echo -n "Install $OPSYSTEM and overwrite the entire disk? [n] "
- read resp junk
- case "$resp" in
- y*|Y*)
- # don't use first cylinder!
- opsys_off=1
- cyls_per_opsys=`expr $cyls_per_disk - 1`
- opsys_part=${unused_last_part}
- RUN_FDISK="overwrite"
- ;;
- *)
- set_overwrite_part
- ;;
- esac
- return 0
-fi
-
-
-# *** CAVEAT ***
-# $OPSYSTEM installs at the end of the disk. If the
-# beginning of the disk is free but not the end, install fails!
-
-# Assume `fdisk -u' to add $OPSYSTEM in last unused partition for remaining cases
-opsys_part=${unused_last_part}
-RUN_FDISK="fdisk -u"
-mb_sect=`expr 1024 \* 1024 / $bytes_per_sect`
-disk_minimum=`expr $DISKMIN \* $mb_sect`
-
-# Case IV: No room (at end of disk) for mininal install
-[ $extent_max -eq 50000 ] && extent_max=$disksize
-disk_remaining=`expr $disksize - $extent_max`
-if [ $disk_remaining -lt $disk_minimum ]; then
- echo
- echo "Not enough space ($DISKMIN Mb) at end of disk to install $OPSYSTEM."
- echo -n "Install FreeBSD and overwrite the entire disk? [n] "
- read resp junk
- case "$resp" in
- y*|Y*)
- # don't use first cylinder!
- opsys_off=1
- cyls_per_opsys=`expr $cyls_per_disk - 1`
- opsys_part=${unused_last_part}
- RUN_FDISK="overwrite"
- ;;
- *)
- echo
- echo -n "Overwrite an existing partition? [n] "
- read resp junk
- case "$resp" in
- y*|Y*)
- set_overwrite_part
- ;;
- *)
- echo
- echo " WARNING: To install ${OPSYSTEM}, you're on your own in figuring"
- echo " out where on the disk it will fit without overwriting another"
- echo " partition..."
- # Set defaults assuming there is only one partition at end of disk
- eval start=\$start${extent_max_part}
- # don't use first cylinder!
- opsys_off=1
- cyls_per_opsys=`expr $start / $cylindersize - 1`
- [ $cyls_per_opsys -lt 0 ] && cyls_per_opsys=0
- ;;
- esac
- ;;
- esac
- return 0
-fi
-
-# Case V: Room for $OPSYSTEM and partition data okay
-opsys_off=`expr $extent_max / $cylindersize`
-opsys_extent=`expr $opsys_off \* $cylindersize`
-[ $opsys_extent -lt $extent_max ] && opsys_off=`expr $opsys_off + 1`
-cyls_per_opsys=`expr $cyls_per_disk - $opsys_off`
-return 0
-}
-
-put_fdisk_data() {
-start=$root_offset
-size=$partition
-
-if [ "$RUN_FDISK" = "overwrite" ]; then
- # How do you overwrite without explicitly editing each entry?
- (
- echo y
- echo $cyls_per_disk
- echo $tracks_per_cyl
- echo $sects_per_track
- echo y
- ) >fdisk.script
- i=0
- n=`expr ${part_cnt:-4} - 1`
- while [ $i -lt $n ]; do
- echo y
- echo 0
- echo 0
- echo 0
- echo n
- echo y
- i=`expr $i + 1`
- done >>fdisk.script
- ( echo y
- echo ${OPSYSID}
- echo ${start}
- echo ${size}
- echo n
- echo y
- echo y
- echo ${n}
- echo y
- echo y
- ) >>fdisk.script
- fdisk -u /dev/r${drivename}d <fdisk.script >/dev/null 2>&1
-elif [ "$RUN_FDISK" ]; then
- $RUN_FDISK -${opsys_part:-${unused_last_part:-3}} /dev/r${drivename}d <<-EOF >/dev/null 2>&1
- y
- $cyls_per_disk
- $tracks_per_cyl
- $sects_per_track
- y
- y
- ${OPSYSID}
- ${start}
- ${size}
- n
- y
- y
- ${opsys_part:-${unused_last_part:-3}}
- y
- y
- EOF
-fi
-
-}
-
-echo
-echo
-echo "Welcome to ${OPSYSTEM}."
-echo
-echo "This program is designed to help put ${OPSYSTEM} on a hard disk with"
-echo "at least $DISKMIN Megabytes of free space."
-echo
-echo "Before starting, it is important to know your hard disk's geometry"
-echo "(i.e., number of cylinders, heads and sectors/track). If installing"
-echo "${OPSYSTEM} on the same disk as another operating system, then the"
-echo "two systems should use the same geometry. In particular, ${OPSYSTEM}'s"
-echo "default geometry is inappropriate for MS-DOS. So in this case, the"
-echo "DOS geometry should be used instead."
-echo
-echo "As with anything which modifies a hard drive's contents, this program"
-echo "can cause SIGNIFICANT data loss. We strongly recommend making sure"
-echo "that the hard drive is backed up before going further with the"
-echo "installation process."
-echo
-echo -n "Proceed with installation? [y] "
-read resp junk
-resp=${resp:-y}
-case "$resp" in
-y*|Y*)
- echo
- echo "Cool! Let's get to it..."
- echo
- echo "If a mistake is made along the way, don't bail out."
- echo "At the end, you have the option of redoing the configuration."
- echo "If you really must quit at some point, type <CTRL>+C and"
- echo "enter \`halt' at the command prompt, \`#'."
- ;;
-*)
- echo
- echo "Installation aborted. Enter \`halt' to halt the machine."
- echo "Once the machine has halted, remove the floppy,"
- echo "and press any key to reboot."
- exit
- ;;
-esac
-
-mount -u /dev/fd0 / || {
- if mount -u /dev/fd1 / ; then
- echo "[Please ignore the above error message, that's normal.]"
- else
- echo "Oh boy, we're in trouble here: Could not mount floppy read-write."
- exit 1
- fi
-}
-sync
-verified_install=""
-while [ ! "$verified_install" ]; do # Begin of Big Loop
-
-rotdelay="-d 0 -n 1"
-drivename=wd0
-drivetype=wd
-sect_fwd=""
-echo
-echo "First, we need to know the drive type. This can be can be one of"
-echo "ESDI, SCSI, ST506, or IDE."
-echo -n "Drive type? [${type:-IDE}] "
-read resp junk
-type=${resp:-${type:-IDE}}
-case "$type" in
-e*|E*|st*|ST*)
- echo -n "Does it support AUTOMATIC sector remapping? [y] "
- read remap junk
- case "$remap" in
- n*|N*)
- sect_fwd="sf:"
- ;;
- esac
- case "$type" in
- e*|E*)
- DEFSECT=36
- ;;
- esac
- ;;
-i*|I*)
- type=ST506
- ;;
-sc*|SC*)
- drivename=sd0
- drivetype=sd
- type=SCSI
- DEFSECT=32
- DEFHEAD=64
- ;;
-*)
- echo "Unknown type. Assuming ST506 with automatic sectoring..."
- type=ST506
- ;;
-esac
-echo
-echo -n "Install onto which drive [$drivename] "
-read resp junk
-drivename=${resp:-${drivename}}
-echo
-echo "Disk $drivename is of device type $drivetype."
-if [ ! "$partition" ]; then
- echo
- echo "Examining device /dev/r${drivename}d..."
- get_fdisk_data
- if [ $? -gt 1 ]; then
- echo "Hm - we can't seem to read that drive."
- echo
- echo -n "Are you sure that $type is the correct type? [n] "
- read resp
- case "$resp" in
- y*|Y*)
- echo
- echo "Well, since we can't even open it, there isn't much"
- echo "hope for writing a label on it. But you're free"
- echo "to give it a try. You need to specify the geometry."
- ;;
- *)
- echo
- echo "Oops. Let's start again from the top."
- continue
- ;;
- esac
- fi
-fi
-echo
-echo "Now we want to build a data base entry in /etc/disktab describing"
-echo "the geometry of the /dev/$drivename disk. The name of the entry"
-echo "should be descriptive of the disk's type and model. For example,"
-echo "a Maxtor IDE, model 7080 disk might be named \`maxtor7080'."
-echo -n "Disk label name (one word, please)? [${name:-mfr_model}] "
-read resp junk
-name=${resp:-${name:-mfr_model}}
-echo
-echo "${OPSYSTEM} should use the same hard disk geometry as used by other"
-echo "operating systems on the hard disk."
-echo -n "Number of bytes per disk sector? [${bytes_per_sect:-512}] "
-read resp junk
-bytes_per_sect=${resp:-${bytes_per_sect:-512}}
-echo
-echo -n "Total number of disk cylinders? [${cyls_per_disk:-${DEFCYLN}}] "
-read resp junk
-cyls_per_disk=${resp:-${cyls_per_disk:-${DEFCYLN}}}
-echo
-echo -n "Number of disk heads (i.e., tracks/cylinder)? [${tracks_per_cyl:-${DEFHEAD}}] "
-read resp junk
-tracks_per_cyl=${resp:-${tracks_per_cyl:-${DEFHEAD}}}
-echo
-echo -n "Number of disk sectors (i.e., sectors/track)? [${sects_per_track:-${DEFSECT}}] "
-read resp junk
-sects_per_track=${resp:-${sects_per_track:-${DEFSECT}}}
-cylindersize=`expr $sects_per_track \* $tracks_per_cyl`
-disksize=`expr $cylindersize \* $cyls_per_disk`
-mb_sect=`expr 1024 \* 1024 / $bytes_per_sect`
-mb_per_disk=`expr $disksize / $mb_sect`
-opsys_cyls_min=`expr $DISKMIN \* $mb_sect / $cylindersize`
-analyze_fdisk_data
-if [ $? -eq 0 ]; then
- partition=`expr $cyls_per_opsys \* $cylindersize`
- part_offset=`expr $opsys_off \* $cylindersize`
-fi
-echo
-echo "Disk has a total of $mb_per_disk Mb."
-echo "The size of the ${OPSYSTEM} portion of the disk must be at least"
-echo "${opsys_cyls_min} cylinders, and should not exceed $(expr $cyls_per_disk - 1) cylinders."
-echo "The offset of ${OPSYSTEM} from the beginning of the disk should be at"
-echo "least 1 cylinder."
-echo
-echo "For efficiency, partitions begin and end on cylinder boundaries."
-echo "If you know the size NN in Megabytes (Mb) of a partition you want, then"
-echo "use the following formula to determine the number NC of cylinders to use:"
-echo " NC = integer { ( NN * $mb_sect ) / $cylindersize }"
-while :; do
- echo -n "Total size of the ${OPSYSTEM} portion of the disk (in cylinders)? [${cyls_per_opsys:-`expr ${cyls_per_disk} - 1`}] "
- read resp junk
- cyls_per_opsys=${resp:-${cyls_per_opsys:-`expr ${cyls_per_disk} - 1`}}
- partition=`expr $cyls_per_opsys \* $cylindersize`
- if [ $cyls_per_opsys -lt $cyls_per_disk -a ! "$force_offset" ]; then
- echo
- echo -n "Offset of ${OPSYSTEM} from beginning of disk (in cylinders)? [${opsys_off:-1}] "
- read resp junk
- opsys_off=${resp:-${opsys_off:-1}}
- else
- echo
- echo " WARNING: Existing partitions will be lost. In addition,"
- echo " installing at cylinder 0 may cause problems for some disk"
- echo " controllers. If the filesystem is corrupted or install"
- echo " fails, install at cylinder 1."
- RUN_FDISK=""
- cyls_per_opsys=$cyls_per_disk
- partition=$disksize
- opsys_off=0
- fi
- part_offset=`expr $opsys_off \* $cylindersize`
- opsys_extent=`expr $opsys_off + $cyls_per_opsys`
- if [ ${opsys_extent} -gt ${cyls_per_disk} ]; then
- echo
- echo "${OPSYSTEM} Size + Offset cannot exceed ${cyls_per_disk} cylinders."
- elif [ ${cyls_per_opsys} -lt ${opsys_cyls_min} ]; then
- echo
- echo "${OPSYSTEM} requires at least ${opsys_cyls_min} cylinders to install."
- else break
- fi
-done
-badspacesec=0
-if [ "$sect_fwd" = "sf:" ]; then
- badspacecyl=`expr $sects_per_track + 126`
- badspacecyl=`expr $badspacecyl + $cylindersize - 1`
- badspacecyl=`expr $badspacecyl / $cylindersize`
- badspacesec=`expr $badspacecyl \* $cylindersize`
- echo
- echo -n "Using $badspacesec sectors ($badspacecyl cylinders) for the "
- echo "bad144 bad block table"
-fi
-whats_left=`expr $partition - $badspacesec`
-cyl_left=`expr $whats_left / $cylindersize`
-mb_left=`expr $whats_left / $mb_sect`
-swap_cyls_min=`expr $SWAPMIN \* $mb_sect / $cylindersize`
-root_cyls_max=`expr ${cyl_left} - ${swap_cyls_min}`
-root_cyls_min=`expr $ROOTMIN \* $mb_sect / $cylindersize`
-echo
-echo "There are $mb_left Mb ($cyl_left cylinders) to allocate."
-echo
-echo "The $OPSYSTEM portion of the disk must itself be divided into at least"
-echo "two partitions: one for the root filesystem and one for swap. It is a"
-echo "good idea to have at least a third (large) $OPSYSTEM partition for the /usr"
-echo "filesystem."
-echo
-echo "The root partition cannot exceed ${root_cyls_max} cylinders. It is usually"
-echo "no larger than about 15 Mb ($(expr 15 \* $mb_sect / $cylindersize) cylinders), and sometimes"
-echo "as small as $ROOTMIN Mb ($root_cyls_min cylinders)."
-if [ ! "$cyls_per_root" ]; then
- # set default root partition to 15MB
- cyls_per_root=`expr \( 15 \* $mb_sect \) / $cylindersize`
- usr_cyls_max=`expr ${root_cyls_max} - ${cyls_per_root}`
- mb_usr=`expr ${usr_cyls_max} \* $cylindersize / $mb_sect`
- [ $cyls_per_root -gt $root_cyls_max -o $mb_usr -lt $USRMIN ] &&
- cyls_per_root=$root_cyls_max
-fi
-while :; do
- echo -n "Root partition size (in cylinders)? [${cyls_per_root}] "
- read resp junk
- cyls_per_root=${resp:-${cyls_per_root}}
- root=`expr $cyls_per_root \* $cylindersize`
- if [ ${cyls_per_root} -gt ${root_cyls_max} ]; then
- echo
- echo "The root partition size cannot exceed $root_cyls_max cylinders."
- elif [ ${cyls_per_root} -lt ${root_cyls_min} ]; then
- echo
- echo "The root partition size must be at least $root_cyls_min cylinders."
- else
- part_used=`expr $root + $badspacesec`
- break
- fi
-done
-root_offset=$part_offset
-whats_left=`expr $partition - $part_used`
-cyl_left=`expr $whats_left / $cylindersize`
-mb_left=`expr $whats_left / $mb_sect`
-echo
-# DO NOT USE DIFFERENT BLOCKING FACTORS FOR EACH PARITION.. IT TRASHES THE
-# VM SYSTEM! When that gets fixed this can go back the way it was...
-#
-echo "We can build the filesystems with block/fragment sizes of either"
-echo " 1) 4k/512, to save disk space at the expense of speed, or"
-echo " 2) 8k/1k for speed at the expense of disk space."
-echo -n "Which blocking factor should we use for the filesystems? "
-echo -n "[${blocking_factor:-${DEFBLOCKING}}] "
-read resp junk
-blocking_factor=${resp:-${blocking_factor:-${DEFBLOCKING}}}
-fragsize=`expr $bytes_per_sect \* $blocking_factor`
-blocksize=`expr $bytes_per_sect \* $blocking_factor \* 8`
-echo
-echo "$mb_left Mb ($cyl_left cylinders) remaining in ${OPSYSTEM} portion of disk."
-echo
-echo "Minimum swap space is ${swap_cyls_min} cylinders."
-echo "For running X, if your RAM size is NR Mb, then the recomended swap"
-echo "size NS (in cylinders) is:"
-echo " NS = integer { ( NR x `expr 21 \* $mb_sect / 10` ) / ${cylindersize} }"
-if [ ! "$swap_cyl" ]; then
- # guess memory size
- mb_ram=16
- swap_cyl=`expr \( 21 \* $mb_ram \* $mb_sect \) / 10`
- swap_cyl=`expr $swap_cyl / ${cylindersize}`
-
- # but not swap size more than 10% of disk size...
- swap_quot=`expr $mb_left / $mb_ram`
- if [ $swap_quot -lt 10 ]; then
- swap_cyl=$swap_cyls_min
- fi
-fi
-while :; do
- echo -n "Swap partition size (in cylinders)? [${swap_cyl}] "
- read resp junk
- swap_cyl=${resp:-${swap_cyl}}
- swap=`expr $swap_cyl \* $cylindersize`
- if [ ${swap_cyl} -gt ${cyl_left} ]; then
- echo
- echo "Swap size cannot exceed $cyl_left cylinders."
- elif [ ${swap_cyl} -lt ${swap_cyls_min} ]; then
- echo
- echo "Swap size must be at least ${swap_cyls_min} cylinders."
- else
- break
- fi
-done
-swap_offset=`expr $root_offset + $root`
-part_used=`expr $part_used + $swap`
-echo "" >/etc/disktab
-echo "$name|${OPSYSTEM} installation generated:\\" >>/etc/disktab
-echo " :dt=${type}:ty=winchester:\\" >>/etc/disktab
-echo -n " :nc#${cyls_per_disk}:ns#${sects_per_track}" >>/etc/disktab
-echo ":nt#${tracks_per_cyl}:\\" >>/etc/disktab
-echo " :se#${bytes_per_sect}:${sect_fwd}\\" >>/etc/disktab
-echo -n " :pa#${root}:oa#${root_offset}" >>/etc/disktab
-echo ":ta=4.2BSD:ba#${blocksize}:fa#${fragsize}:\\" >>/etc/disktab
-echo " :pb#${swap}:ob#${swap_offset}:tb=swap:\\" >>/etc/disktab
-echo " :pc#${partition}:oc#${part_offset}:\\" >>/etc/disktab
-ename="";fname="";gname="";hname=""
-if [ $part_used -lt $partition ]; then
- echo
- echo "Now we enter information about any other partitions and filesystems"
- echo "to be created in the ${OPSYSTEM} portion of the disk. This process"
- echo "is complete when we've filled up all remaining space in the ${OPSYSTEM}"
- echo "portion of the disk."
-fi
-while [ $part_used -lt $partition ]; do
- part_size=0
- whats_left=`expr $partition - $part_used`
- cyl_left=`expr $whats_left / $cylindersize`
- mb_left=`expr $whats_left / $mb_sect`
- echo
- echo "$mb_left Mb ($cyl_left cylinders) remaining in ${OPSYSTEM} portion of disk."
- echo
- while :; do
- echo -n "Next partition size (in cylinders)? [${cyl_left}] "
- read resp junk
- part_size=${resp:-${cyl_left}}
- part_size=`expr $part_size \* $cylindersize`
- total=`expr $part_used + $part_size`
- if [ $total -gt $partition ]; then
- echo
- echo "Partition size cannot exceed ${cyl_left} cylinders."
- else
- part_used=$total
- part_name=""
- while [ "$part_name" = "" ]; do
- echo
- echo -n "On which directory should this filesystem be mounted? [usr] "
- read resp junk
- part_name=${resp:-usr}
- part_name=`expr X"$part_name" : 'X/*\(.*\)'`
- done
- break
- fi
- done
- if [ ! "$ename" ]; then
- ename=$part_name
- offset=`expr $part_offset + $root + $swap`
- echo -n " :pe#${part_size}:oe#${offset}" >>/etc/disktab
- echo ":te=4.2BSD:be#${blocksize}:fe#${fragsize}:\\" >>/etc/disktab
- offset=`expr $offset + $part_size`
- elif [ ! "$fname" ]; then
- fname=$part_name
- echo -n " :pf#${part_size}:of#${offset}" >>/etc/disktab
- echo ":tf=4.2BSD:bf#${blocksize}:ff#${fragsize}:\\" >>/etc/disktab
- offset=`expr $offset + $part_size`
- elif [ ! "$gname" ]; then
- gname=$part_name
- echo -n " :pg#${part_size}:og#${offset}" >>/etc/disktab
- echo ":tg=4.2BSD:bg#${blocksize}:fg#${fragsize}:\\" >>/etc/disktab
- offset=`expr $offset + $part_size`
- elif [ ! "$hname" ]; then
- hname=$part_name
- echo -n " :ph#${part_size}:oh#${offset}" >>/etc/disktab
- echo ":th=4.2BSD:bh#${blocksize}:fh#${fragsize}:\\" >>/etc/disktab
- part_used=partition
- fi
-done
-if [ "$have_dos_part" -a "$have_dos_part" != "$opsys_part" -a \
- "$RUN_FDISK" != "" -a "$RUN_FDISK" != "overwrite" -a ! "$hname" ]; then
- echo
- echo "There appears to be a MS-DOS filesystem on the hard disk."
- echo -n "Make this be accessible from ${OPSYSTEM}? [y] "
- read resp junk
- case "${resp:-y}" in
- y*|Y*)
- part_name=""
- while [ "$part_name" = "" ]; do
- echo
- echo -n "On which directory should this filesystem be mounted? [dos] "
- read resp junk
- part_name=${resp:-dos}
- part_name=`expr X"$part_name" : 'X/*\(.*\)'`
- done
- hname=$part_name
- eval offset=\$start${have_dos_part}
- eval part_size=\$size${have_dos_part}
- echo -n " :ph#${part_size}:oh#${offset}" >>/etc/disktab
- echo ":th=MSDOS:\\" >>/etc/disktab
- part_used=partition
- ;;
- *)
- have_dos_part=""
- ;;
- esac
-else
- have_dos_part=""
-fi
-echo " :pd#${disksize}:od#0:" >>/etc/disktab
-sync
-
-# cat /etc/disktab
-OIFS=$IFS
-IFS='
-'
-while read data; do
- echo $data
-done < /etc/disktab
-IFS=$OIFS
-
-echo
-echo -n "Verbose installation? [n] "
-read resp
-
-case $resp in
-y*)
- cpioverbose=v
- ;;
-*)
- cpioverbose=
- ;;
-esac
-
-
-echo
-echo "THIS IS THE LAST CHANCE!!! Data on the hard disk will be lost!"
-echo -n "Are you sure you want to install on the hard drive? (yes/no) "
-resp=""
-while [ ! "$resp" ]; do
- read resp junk
- case "$resp" in
- Yes|yes|YES)
- verified_install=1
- echo
- echo "Here we go..."
- ;;
- No|no|NO)
- echo
- echo -n "Would you like to change the configuration? [y] "
- read resp junk
- resp=${resp:-y}
- case "$resp" in
- y*|Y*)
- ;;
- *)
- echo
- echo "Installation aborted. Enter 'halt' to halt the machine."
- echo "Once the machine has halted, remove the floppy,"
- echo "and press any key to reboot."
- exit
- ;;
- esac
- ;;
- *)
- echo "Please spell out either of \`yes' or \`no'..."
- echo -n "Install on the hard disk? (yes/no) "
- resp=
- ;;
- esac
-done
-done # End of Big Loop
-
-put_fdisk_data
-
-echo
-echo -n "Labelling disk..."
-echo y |
-/sbin/disklabel -w -r -B ${drivename}c $name
-# >/dev/null 2>&1
-echo " done."
-
-# XXX - Do it again, incase we disklabeled sector 0!
-# XXX - this is not working for some reason, need to look at it closer!
-put_fdisk_data
-
-if [ "$sect_fwd" = "sf:" ]; then
- echo -n "Initializing bad144 badblock table..."
- bad144 $drivename 0
- echo " done."
- echo "Updating badblock table..."
- # `2>&1 >/dev/null' filters stdout and leaves only stderr...
- badlist=$(bad144 -s $drivename 2>&1 >/dev/null |
- while read data; do
- bad_seek=$(expr "$data" : '[^(]*(seek)[^0-9]*\([0-9]*\)')
- bad_read=$(expr "$data" : '[^(]*(read)[^0-9]*\([0-9]*\)')
- [ "$bad_seek" -o "$bad_read" ] && echo -n "$bad_seek $bad_read "
- done)
- [ "$badlist" ] && bad144 -a -c $drivename $badlist
- echo " done."
-fi
-
-echo "Initializing root filesystem, and mounting..."
-newfs ${rotdelay} /dev/r${drivename}a $name
-mount -v /dev/${drivename}a /mnt
-if [ "$ename" != "" ]; then
- echo
- echo "Initializing $ename filesystem, and mounting..."
- newfs ${rotdelay} /dev/r${drivename}e $name
- mkdir -p /mnt/$ename
- mount -v /dev/${drivename}e /mnt/$ename
-fi
-if [ "$fname" != "" ]; then
- echo
- echo "Initializing $fname filesystem, and mounting..."
- newfs ${rotdelay} /dev/r${drivename}f $name
- mkdir -p /mnt/$fname
- mount -v /dev/${drivename}f /mnt/$fname
-fi
-if [ "$gname" != "" ]; then
- echo
- echo "Initializing $gname filesystem, and mounting..."
- newfs ${rotdelay} /dev/r${drivename}g $name
- mkdir -p /mnt/$gname
- mount -v /dev/${drivename}g /mnt/$gname
-fi
-if [ "$hname" != "" ]; then
- echo
- if [ ! "$have_dos_part" ]; then
- echo "Initializing $hname filesystem, and mounting..."
- newfs ${rotdelay} /dev/r${drivename}h $name
- else
- echo "Preparing for $hname filesystem, and mounting..."
- fi
- mkdir -p /mnt/$hname
- [ ! "$have_dos_part" ] &&
- mount -v /dev/${drivename}h /mnt/$hname
-fi
-
-echo
-echo -n "Copying to disk... "
-cd /
-cpio -pdamu${cpioverbose} /mnt <filelist
-echo -n "Copying more to disk... "
-cd /mnt
-gzcat < /inst1.cpio.gz | cpio -idmu${cpioverbose}
-
-echo -n "Building /etc/fstab... "
-echo "proc /proc procfs rw 0 0" >etc/fstab
-echo "/dev/${drivename}b none swap sw 0 0" >>etc/fstab
-echo "/dev/${drivename}a / ufs rw 1 1" >>etc/fstab
-if [ "$ename" != "" ]; then
- echo "/dev/${drivename}e /$ename ufs rw 1 2" >>etc/fstab
-fi
-if [ "$fname" != "" ]; then
- echo "/dev/${drivename}f /$fname ufs rw 1 3" >>etc/fstab
-fi
-if [ "$gname" != "" ]; then
- echo "/dev/${drivename}g /$gname ufs rw 1 4" >>etc/fstab
-fi
-if [ "$hname" != "" ]; then
- if [ ! "$have_dos_part" ]; then
- echo "/dev/${drivename}h /$hname ufs rw 1 5" >>etc/fstab
- else
- echo "/dev/${drivename}h /$hname pcfs ro 0 0" >>etc/fstab
- fi
-fi
-
-# cat /etc/disktab >etc/disktab.install
-OIFS=$IFS
-IFS='
-'
-while read data; do
- echo $data
-done </etc/disktab >etc/disktab.install
-IFS=$OIFS
-echo "done."
-
-echo -n "Building /etc/rc... "
-(
-echo "PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/distbin:"
-echo "export PATH"
-echo "HOME=/root"
-echo "export HOME"
-echo "TERM=pc3"
-echo "export TERM"
-echo "mount -at ufs"
-echo "echo"
-echo "echo"
-echo "echo \"Insert cpio installation floppy in drive and\""
-echo "echo -n \"enter that drive's number (0 = A:, 1 = B:): [0] \""
-echo "read resp junk"
-echo "driveno=\${resp:-0}"
-echo "mount -o ro /dev/fd\${driveno} /mnt"
-echo "cd /mnt"
-echo "install"
-echo "cd /"
-echo "umount /mnt >/dev/null 2>&1"
-echo "echo"
-echo "echo -n \"Install optional dos floppy? [n] \""
-echo "read resp junk"
-echo "case \"\$resp\" in"
-echo "y*|Y*)"
-echo " echo"
-echo " echo \"Insert dos floppy in drive, and then\""
-echo " echo -n \"enter that drive's number (0 or 1): [0] \""
-echo " read resp junk"
-echo " driveno=\${resp:-0}"
-echo " echo \"Copying files to /usr/distbin...\""
-echo " mount -t pcfs -o ro /dev/fd\${driveno} /mnt"
-echo " mkdir -p /usr/distbin"
-echo " cp /mnt/* /usr/distbin/ >/dev/null 2>&1"
-echo " umount /mnt >/dev/null 2>&1"
-echo " sync"
-echo " ;;"
-echo "esac"
-echo "echo"
-echo "echo \"OK. All of the base files are installed.\""
-echo "echo"
-echo "echo \"The next step: reboot from the hard disk. Further\""
-echo "echo \"instructions are presented upon rebooting.\""
-echo "echo"
-echo "echo \"Enter 'halt' now at the prompt to halt the machine.\""
-echo "echo \"After the machine has halted, remove the floppy from the disk\""
-echo "echo \"drive, and hit any key to reboot from the hard disk.\""
-echo "exit 1"
-) >etc/rc
-echo "done."
-
-if [ "$hname" != "" ]; then /sbin/umount /dev/${drivename}h ; fi
-if [ "$gname" != "" ]; then /sbin/umount /dev/${drivename}g ; fi
-if [ "$fname" != "" ]; then /sbin/umount /dev/${drivename}f ; fi
-if [ "$ename" != "" ]; then /sbin/umount /dev/${drivename}e ; fi
-/sbin/umount /mnt
-
-sync
-
-echo
-echo "The next step: reboot from the kernel-copy disk, copy a kernel"
-echo "to the hard disk, and finally reboot from the hard disk."
-echo
-echo "To do this, enter \`halt' now to halt the machine. After it"
-echo "announces that it has halted, remove the floppy from the drive"
-echo "and insert the kernel-copy disk that was booted before."
-echo "Press any key to reboot. When prompted to insert the filesystem"
-echo "floppy this time, just hit RETURN without changing floppies."
-echo
-echo "If all goes well, you can enter the command \`copy' at the prompt to"
-echo "copy the kernel to the hard disk. When asked for which partition to"
-echo "copy to, enter \`${drivename}a' (without the quotes)."
-echo
-echo "The light on the floppy may not go out, so don't wait for it."
-echo
-echo "Okay, that's all for now. I'm halting ..."
-
-sync;sync;sync;sync
-halt
diff --git a/etc/etc.i386/inst1.profile b/etc/etc.i386/inst1.profile
deleted file mode 100644
index 8e39a8b..0000000
--- a/etc/etc.i386/inst1.profile
+++ /dev/null
@@ -1,9 +0,0 @@
-# $Id$
-#
-PATH=/sbin:/usr/sbin:/bin:/usr/bin:.:
-export PATH
-HOME=/root
-export HOME
-TERM=pc3
-export TERM
-/install
diff --git a/etc/etc.i386/inst2.install b/etc/etc.i386/inst2.install
deleted file mode 100755
index 0ef2d46..0000000
--- a/etc/etc.i386/inst2.install
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-# install2.fs disk 'install'
-# Simplified, interactive FreeBSD installation script.
-# D.E. Silvia (dsilvia@net.com)
-#
-# Heavily hacked on for support of FreeBSD
-# by Rodney W. Grimes (rgrimes@cdrom.com) 1993/08/11
-#
-# Installs balance of basic FreeBSD system.
-#
-
-echo -n "Verbose installation? [n] "
-read resp
-case $resp in
- y*)
- cpioverbose=v
- ;;
- *)
- cpioverbose=
- ;;
-esac
-
-echo
-echo "Please wait. Copying to disk..."
-# remove /.profile so that the right things happen when it gets
-# over written
-rm /.profile
-cd /
-mnt/usr/bin/gunzip < mnt/inst2.cpio.gz | cpio -idmu${cpioverbose}
-cd /mnt
-ls .profile install usr/bin/* | cpio -pdmu${cpioverbose} /
-cd /dev
-echo " done."
-echo
-echo "Building /dev files..."
-sh MAKEDEV all
-cd /
-echo " done."
-
-sync
diff --git a/etc/etc.i386/inst2.profile b/etc/etc.i386/inst2.profile
deleted file mode 100644
index 92058a0..0000000
--- a/etc/etc.i386/inst2.profile
+++ /dev/null
@@ -1,440 +0,0 @@
-stty status '^T'
-trap : 2
-trap : 3
-HOME=/; export HOME
-PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/distbin; export PATH
-if [ -e /fastboot ]
-then
- echo Fast boot ... skipping disk checks
-else
- echo Automatic reboot in progress...
- fsck -p
- case $? in
- 0)
- ;;
- 2)
- exit 1
- ;;
- 4)
- echo; echo README README README README README README README
- echo
- echo "NOTE: The above errors are expected if this is the"
- echo "first time you have booted from the hard disk after"
- echo "completing the floppy install"; echo
- echo "Automatic file system check changed the root file system"
- echo "The system must halt for these corrections to take effect"
- echo
- reboot
- echo "reboot failed... help!"
- exit 1
- ;;
- 8)
- echo "Automatic file system check failed... help!"
- exit 1
- ;;
- 12)
- echo "Reboot interrupted"
- exit 1
- ;;
- 130)
- exit 1
- ;;
- *)
- echo "Unknown error in reboot"
- exit 1
- ;;
- esac
-fi
-
-trap 2
-trap "echo 'Reboot interrupted'; exit 1" 3
-umount -a >/dev/null 2>&1
-mount -a -t nonfs
-rm -f /fastboot
-(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; })
-
-TERM=pc3 # terminal emulator, for elvis
-TERMCAP="\
-pc3|ibmpc3:li#25:co#80:am:bs:bw:eo:cd=\E[J:ce=\E[K:cl=\Ec:cm=\E[%i%2;%2H:\
-do=\E[B:ho=\E[;H:nd=\E[C:up=\E[A:so=\E[7m:se=\E[0m:us=\E[4m:ue=\E[0m:\
-:ac=l\332q\304k\277x\263j\331m\300w\302u\264v\301t\303n\305:\
-:kb=^h:kh=\E[Y:ku=\E[A:kd=\E[B:kl=\E[D:kr=\E[C:"
-OPSYSTEM=FreeBSD
-RELEASE="1.1"
-export TERMCAP
-export TERM
-echo "${OPSYSTEM} Base System Release ${RELEASE}"
-echo ""
-echo "Congratulations, you've got ${OPSYSTEM} on the hard disk!"
-echo
-echo "Press the return key for more installation instructions"
-read junkit
-echo
-echo "To finish installation:"
-echo "Pick a temporary directory by running set_tmp_dir. Make sure it's"
-echo "in a place with lots of space, probably under /usr."
-echo "Then, load the remaining distribution files into that temporary"
-echo "directory by issuing one of the following commands:"
-echo
-echo " load_fd load_qic_tape load_scsi_tape"
-echo
-echo "or by fetching the files with ftp (see the installation notes for"
-echo "information on how to do that)."
-echo
-echo "Once this is complete, extract the distribution files by issuing the"
-echo "command 'extract <distribution>' where <distribution> is the base name"
-echo "of the distribution files, e.g. 'base10'."
-echo
-echo "Once all of the filesets you wish to install have been extracted,"
-echo "enter the command 'configure' to finish setting up the system"
-echo " "
-echo "If you should wish to uninstall ${OPSYSTEM}, delete the partition by using the"
-echo "DOS 5 FDISK program. If installed on the entire drive, use the FDISK/MBR"
-echo "to remove the ${OPSYSTEM} bootstrap from the drive."
-echo 'erase ^?, werase ^H, kill ^U, intr ^C'
-stty newcrt werase  intr  kill  erase  9600
-umask 0
-set_tmp_dir()
-{
- def_tmp_dir=`pwd`
- [ "$def_tmp_dir" = "/" ] && def_tmp_dir=/usr/distrib
- echo -n "Copy files to which directory? [${def_tmp_dir}] "
- read tmp_dir
- [ ! "$tmp_dir" ] && tmp_dir=$def_tmp_dir
- if [ ! -d "$tmp_dir" ]; then
- /bin/rm -rf $tmp_dir
- mkdir -p $tmp_dir
- fi
- echo
-}
-tmp_dir()
-{
- if [ "$tmp_dir" = "" ]; then
- set_tmp_dir
- fi
- cd $tmp_dir
-}
-load_fd()
-{
- tmp_dir
- drive=
- altdrive=
- subdir=
- while [ -z "$drive" ]; do
- echo -n "Read from which drive (or ? for help)? [c] "
- read answer junk
- case "${answer:-c}" in
- a*b|A*B)
- drive=A; altdrive=B
- ;;
- b*a|B*A)
- drive=B; altdrive=A
- ;;
- a*|A*)
- drive=A; altdrive=A
- ;;
- b*|B*)
- drive=B; altdrive=B
- ;;
- c*|C*)
- while read data; do
- msdos_device=`expr X"$data" : 'X[ ]*\([^ ]*\)[^M]*pcfs'`
- msdos_dir=`expr X"$data" : 'X[ ]*[^ ]*[ ]*\([^ ]*\)'`
- [ "${msdos_device}" ] && break
- done </etc/fstab
- if [ ! "$msdos_device" ]; then
- echo
- echo "Cannot find MS-DOS in filesystem table"
- continue
- fi
- drive=C; altdrive=C
- while :; do
- echo
- echo -n "Read from which MS-DOS drive C: directory? [/] "
- read resp junk
- newdir=$(echo "${resp:-/}" | \
- awk '{ sub(/^[Cc]*:*/, ""); gsub(/\\/, "/"); gsub(/^\/*/, ""); gsub(/\/*$/, ""); print $0 }')
- if [ -d ${msdos_dir}/${newdir} ]; then
- subdir=$newdir
- break
- else
- echo "C:/${newdir}: No such directory"
- fi
- done
- ;;
- q*|Q*)
- drive=q
- ;;
- \?*)
- echo
- echo "Enter: To:"
- echo "------ ---"
- echo " a Read from floppy drive A:"
- echo " b Read from floppy drive B:"
- echo " c Read from MS-DOS hard drive C:"
- echo " ab Alternate between A: and B:, starting with A:"
- echo " ba Alternate between A: and B:, starting with B:"
- echo " q Quit"
- echo
- ;;
- esac
- done
- verbose=-v
- interactive=-i
- if [ "$drive" = "C" ]; then
- dir=${msdos_dir}
- elif [ "$drive" != "q" ]; then
- dir=/tmp/floppy
- [ -d $dir ] && umount $dir >/dev/null 2>&1
- [ -f $dir ] && rm -f $dir
- mkdir -p $dir
- fi
- while [ "$drive" != "q" ]
- do
- device=/dev/fd0
- [ "$drive" = "B" ] && device=/dev/fd1
- [ "$drive" = "C" ] && device=${msdos_device}
- echo;
- if [ "$drive" != "C" ]; then
- echo "Insert floppy in drive $drive:, then press RETURN to copy files,"
- echo -n "or enter option (? for help): "
- else
- echo -n "Press RETURN to copy files, or enter option (? for help): "
- fi
- read answer junk
- case "${answer:-g}" in
- c*|C*)
- if [ "$drive" != "C" ]; then
- echo "Cannot change directory: not reading from MS-DOS drive C:"
- else
- echo
- echo -n "Read from which MS-DOS drive C: directory? [/${subdir}] "
- read resp junk
- [ ! "$resp" ] && resp="/$subdir"
- absolute=`expr X"$resp" : 'X[Cc]*:*\([/\]\)'`
- subsub=$(echo "${resp}" | \
- awk '{ sub(/^[Cc]*:*/, ""); gsub(/\\/, "/"); gsub(/^\/*/, ""); gsub(/\/*$/, ""); print $0 }')
- if [ "$absolute" -o ! "$subdir" ]; then
- newsub=$subsub
- else
- newsub=$subdir/$subsub
- fi
- if [ -d ${dir}/${newsub} ]; then
- subdir=$newsub
- else
- echo "C:/${newsub}: No such directory"
- fi
- fi
- ;;
- g*|G*)
- sync
- if [ "$drive" = "C" ]; then
- [ "$verbose" ] &&
- { echo; echo "Please wait. Copying files from MS-DOS C:/${subdir}"; }
- cp ${msdos_dir}/${subdir}/* .
- sync
- elif mount -t pcfs $verbose $device $dir; then
- [ "$verbose" ] &&
- { echo; echo "Please wait. Copying files to disk..."; }
- cp $interactive $dir/* .
- sync
- umount $dir
- tmp=$drive; drive=$altdrive; altdrive=$tmp
- fi
- ;;
- i*|I*)
- tmp=$interactive; interactive=; [ -z "$tmp" ] && interactive=-i
- tmp=on; [ -z "$interactive" ] && tmp=off
- echo "interactive mode is $tmp"
- ;;
- l*|L*)
- sync
- [ "$verbose" ] && echo "Directory of ${drive}:/${subdir}"
- if [ "$drive" = "C" ]; then
- ls -l $dir/${subdir}
- else
- umount $dir >/dev/null 2>&1
- if mount -t pcfs $device $dir; then
- ls -l $dir/${subdir}
- umount $dir
- fi
- fi
- ;;
- o*|O*)
- tmp=$drive; drive=$altdrive; altdrive=$tmp
- ;;
- q*|Q*)
- drive=q
- ;;
- s*|S*)
- echo; echo -n "tmp_dir is set to $tmp_dir"
- [ "$tmp_dir" != "`pwd`" ] && echo -n " (physically `pwd`)"
- echo; echo "Free space in tmp_dir:"
- df -k .
- echo -n "Reading from drive $drive:"
- [ "$drive" != "$altdrive" ] && echo -n " and drive $altdrive:"
- echo
- tmp=on; [ -z "$verbose" ] && tmp=off
- echo "Verbose mode is $tmp"
- tmp=on; [ -z "$interactive" ] && tmp=off
- echo "Interactive mode is $tmp"
- ;;
- v*|V*)
- tmp=$verbose; verbose=; [ -z "$tmp" ] && verbose=-v
- tmp=on; [ -z "$verbose" ] && tmp=off
- echo "verbose mode is $tmp"
- ;;
- \?)
- echo
- echo "Enter: To:"
- echo "----- ---"
- echo "(just RETURN) Copy files from ${drive}:/${subdir} to $tmp_dir"
- echo " c Change directory of MS-DOS drive C:"
- echo " i Toggle interactive mode (cp -i)"
- echo " l List directory of current drive"
- echo " o Read from alternate floppy drive"
- echo " q Quit"
- echo " s Show status"
- echo " v Toggle verbose mode"
- echo
- ;;
- esac
- done
- echo "Working directory: `pwd`"
- unset verbose answer drive altdrive device dir subdir tmp interactive
-}
-load_qic_tape()
-{
- tmp_dir
- echo -n "Insert tape into QIC tape drive and hit return to continue: "
- read foo
- tar xvf /dev/rwt0
-}
-load_scsi_tape()
-{
- tmp_dir
- echo -n "Insert tape into SCSI tape drive and hit return to continue: "
- read foo
- tar xvf /dev/nrst0
-}
-extract()
-{
- tmp_dir
- echo -n "Would you like to be verbose about this? [n] "
- read verbose
- case $verbose in
- y*|Y*)
- tarverbose=--verbose
- ;;
- *)
- tarverbose=
- ;;
- esac
- #XXX ugly hack to eliminate busy files, copy them to /tmp and use them
- #from there...
- cp -p /bin/cat /usr/bin/gunzip /usr/bin/tar /tmp
-
- for i in $*; do
- /tmp/cat "$i"* |
- /tmp/gunzip |
- (cd / ; /tmp/tar --extract --file - --preserve-permissions ${tarverbose} )
- done
- rm -f /tmp/cat /tmp/gunzip /tmp/tar
- sync
-}
-configure()
-{
- echo "You will now be prompted for information about this"
- echo "machine. If you hit return, the default answer (in"
- echo "brackets) will be used."
-
- echo
- echo -n "What is this machine's hostname? [unknown.host.domain] "
- read hname
-
- if [ "$hname" = "" ]; then
- hname=unknown.host.domain
- fi
- echo $hname > /etc/myname
- proto_domain=`echo $hname | sed -e 's/[^.]*\.//'`
-
- echo
- echo "What domain is this machine in (this is NOT its YP"
- echo -n "domain name)? [$proto_domain] "
- read dname
-
- if [ "$dname" = "" ]; then
- dname=$proto_domain
- fi
-
- echo
- echo -n "Does this machine have an ethernet interface? [y] "
- read resp
- case "$resp" in
- n*)
- ;;
- *)
- intf=
- while [ "$intf" = "" ]; do
- echo -n "What is the primary interface name (i.e. we0, etc.)? "
- read intf
- done
- echo -n "What is the hostname for this interface? [$hname] "
- read ifname
- if [ "$ifname" = "" ]; then
- ifname=$hname
- fi
- ifaddr=
- while [ "$ifaddr" = "" ]; do
- echo -n "What is the IP address associated with this interface? "
- read ifaddr
- done
- echo "$ifaddr $ifname `echo $ifname | sed -e s/\.$dname//`" \
- >> /etc/hosts
-
- echo -n "Does this interface have a special netmask? [n] "
- read resp
- case "$resp" in
- y*)
- echo -n "What is the netmask? [0xffffff00] "
- read ifnetmask
- if [ "$ifnetmask" = "" ]; then
- ifnetmask=0xffffff00
- fi
- ;;
- *)
- ifnetmask=
- ;;
- esac
-
- echo -n "Does this interface need additional flags? [n] "
- read resp
- case "$resp" in
- y*)
- echo -n "What flags? [llc0] "
- read ifflags
- if [ "$ifflags" = "" ]; then
- ifflags=llc0
- fi
- ;;
- *)
- ifflags=
- ;;
- esac
-
- echo "inet $ifname $ifnetmask $ifflags" > /etc/hostname.$intf
-
- echo ""
- echo "WARNING: if you have any more ethernet interfaces, you"
- echo "will have to configure them by hand. Read the comments"
- echo "in /etc/netstart to learn how to do this"
- ;;
- esac
-
- sync
-
- echo
- echo "OK. You should be completely set up now."
- echo "You should now reboot your machine by issuing the 'reboot' command"
- echo "after removing anything that happens to be in your floppy drive."
-}
diff --git a/etc/etc.i386/inst2.rc b/etc/etc.i386/inst2.rc
deleted file mode 100644
index e439eb1..0000000
--- a/etc/etc.i386/inst2.rc
+++ /dev/null
@@ -1,444 +0,0 @@
-# $Id: inst2.rc,v 1.4 1994/06/15 19:23:33 jkh Exp $
-#
-
-stty status '^T'
-trap : 2
-trap : 3
-PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/distbin; export PATH
-
-echo
-echo
-if [ -e /fastboot ]
-then
- echo Fast boot ... skipping disk checks
-else
- echo Automatic reboot in progress...
- fsck -p
- case $? in
- 0)
- ;;
- 2)
- exit 1
- ;;
- 4)
- echo; echo README README README README README README README
- echo
- echo "NOTE: The above errors are expected if this is the"
- echo "first time you have booted from the hard disk after"
- echo "completing the floppy install"; echo
- echo "Automatic file system check changed the root file system"
- echo "The system must halt for these corrections to take effect"
- echo
- reboot
- echo "reboot failed... help!"
- exit 1
- ;;
- 8)
- echo "Automatic file system check failed... help!"
- exit 1
- ;;
- 12)
- echo "Reboot interrupted"
- exit 1
- ;;
- 130)
- exit 1
- ;;
- *)
- echo "Unknown error in reboot"
- exit 1
- ;;
- esac
-fi
-
-trap 2
-trap "echo 'Reboot interrupted'; exit 1" 3
-umount -a >/dev/null 2>&1
-mount -a -t nonfs
-rm -f /fastboot
-(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; })
-
-OPSYSTEM=FreeBSD
-# Sure wish we had uname at this point!
-RELEASE="2.0.0 (Development)"
-echo "${OPSYSTEM} Base System Release ${RELEASE}"
-echo ""
-echo "Congratulations, you've got ${OPSYSTEM} on the hard disk!"
-echo
-echo "Press the return key for more installation instructions"
-read junkit
-echo
-echo "To finish installation:"
-echo "Pick a temporary directory by running set_tmp_dir. Make sure it's"
-echo "in a place with lots of space, probably under /usr."
-echo "Then, load the remaining distribution files into that temporary"
-echo "directory by issuing one of the following commands:"
-echo
-echo " load_dos load_fd load_qic_tape load_scsi_tape"
-echo
-echo "or by fetching the files with ftp (see the installation notes for"
-echo "information on how to do that)."
-echo
-echo "Once this is complete, extract the distribution files by issuing the"
-echo "command 'extract <distribution>' where <distribution> is the base name"
-echo "of the distribution files, e.g. 'base10'."
-echo
-echo "Once all of the filesets you wish to install have been extracted,"
-echo "enter the command 'configure' to finish setting up the system"
-echo " "
-echo "If you wish to uninstall ${OPSYSTEM}, delete the partition by using the"
-echo "DOS 5 FDISK program. If installed on the entire drive, use the FDISK/MBR"
-echo "to remove the ${OPSYSTEM} bootstrap from the drive."
-echo 'erase ^H, kill ^U, intr ^C'
-stty newcrt erase ^H intr ^C kill ^U
-umask 0
-exit 1
-
-set_tmp_dir()
-{
- def_tmp_dir=`pwd`
- [ "$def_tmp_dir" = "/" ] && def_tmp_dir=/usr/distrib
- echo -n "Copy files to which directory? [${def_tmp_dir}] "
- read tmp_dir
- [ ! "$tmp_dir" ] && tmp_dir=$def_tmp_dir
- if [ ! -d "$tmp_dir" ]; then
- /bin/rm -rf $tmp_dir
- mkdir -p $tmp_dir
- fi
- echo
-}
-tmp_dir()
-{
- if [ "$tmp_dir" = "" ]; then
- set_tmp_dir
- fi
- cd $tmp_dir
-}
-load_fd()
-{
- tmp_dir
- drive=
- altdrive=
- subdir=
- while [ -z "$drive" ]; do
- echo -n "Read from which drive (or ? for help)? [c] "
- read answer junk
- case "${answer:-c}" in
- a*b|A*B)
- drive=A; altdrive=B
- ;;
- b*a|B*A)
- drive=B; altdrive=A
- ;;
- a*|A*)
- drive=A; altdrive=A
- ;;
- b*|B*)
- drive=B; altdrive=B
- ;;
- c*|C*)
- while read data; do
- msdos_device=`expr X"$data" : 'X[ ]*\([^ ]*\)[^M]*pcfs'`
- msdos_dir=`expr X"$data" : 'X[ ]*[^ ]*[ ]*\([^ ]*\)'`
- [ "${msdos_device}" ] && break
- done </etc/fstab
- if [ ! "$msdos_device" ]; then
- echo
- echo "Cannot find MS-DOS in filesystem table"
- continue
- fi
- drive=C; altdrive=C
- while :; do
- echo
- echo -n "Read from which MS-DOS drive C: directory? [/] "
- read resp junk
- newdir=$(echo "${resp:-/}" | \
- awk '{ sub(/^[Cc]*:*/, ""); gsub(/\\/, "/"); gsub(/^\/*/, ""); gsub(/\/*$/, ""); print $0 }')
- if [ -d ${msdos_dir}/${newdir} ]; then
- subdir=$newdir
- break
- else
- echo "C:/${newdir}: No such directory"
- fi
- done
- ;;
- q*|Q*)
- drive=q
- ;;
- \?*)
- echo
- echo "Enter: To:"
- echo "------ ---"
- echo " a Read from floppy drive A:"
- echo " b Read from floppy drive B:"
- echo " c Read from MS-DOS hard drive C:"
- echo " ab Alternate between A: and B:, starting with A:"
- echo " ba Alternate between A: and B:, starting with B:"
- echo " q Quit"
- echo
- ;;
- esac
- done
- verbose=-v
- interactive=-i
- if [ "$drive" = "C" ]; then
- dir=${msdos_dir}
- elif [ "$drive" != "q" ]; then
- dir=/tmp/floppy
- [ -d $dir ] && umount $dir >/dev/null 2>&1
- [ -f $dir ] && rm -f $dir
- mkdir -p $dir
- fi
- while [ "$drive" != "q" ]
- do
- device=/dev/fd0
- [ "$drive" = "B" ] && device=/dev/fd1
- [ "$drive" = "C" ] && device=${msdos_device}
- echo;
- if [ "$drive" != "C" ]; then
- echo "Insert floppy in drive $drive:, then press RETURN to copy files,"
- echo -n "or enter option (? for help): "
- else
- echo -n "Press RETURN to copy files, or enter option (? for help): "
- fi
- read answer junk
- case "${answer:-g}" in
- c*|C*)
- if [ "$drive" != "C" ]; then
- echo "Cannot change directory: not reading from MS-DOS drive C:"
- else
- echo
- echo -n "Read from which MS-DOS drive C: directory? [/${subdir}] "
- read resp junk
- [ ! "$resp" ] && resp="/$subdir"
- absolute=`expr X"$resp" : 'X[Cc]*:*\([/\]\)'`
- subsub=$(echo "${resp}" | \
- awk '{ sub(/^[Cc]*:*/, ""); gsub(/\\/, "/"); gsub(/^\/*/, ""); gsub(/\/*$/, ""); print $0 }')
- if [ "$absolute" -o ! "$subdir" ]; then
- newsub=$subsub
- else
- newsub=$subdir/$subsub
- fi
- if [ -d ${dir}/${newsub} ]; then
- subdir=$newsub
- else
- echo "C:/${newsub}: No such directory"
- fi
- fi
- ;;
- g*|G*)
- sync
- if [ "$drive" = "C" ]; then
- [ "$verbose" ] &&
- { echo; echo "Copying files from MS-DOS C:/${subdir}"; }
- cp ${msdos_dir}/${subdir}/* .
- sync
- elif mount -t pcfs $verbose $device $dir; then
- [ "$verbose" ] &&
- { echo; echo "Copying files to disk..."; }
- cp $interactive $dir/* .
- sync
- umount $dir
- tmp=$drive; drive=$altdrive; altdrive=$tmp
- fi
- ;;
- i*|I*)
- tmp=$interactive; interactive=; [ -z "$tmp" ] && interactive=-i
- tmp=on; [ -z "$interactive" ] && tmp=off
- echo "interactive mode is $tmp"
- ;;
- l*|L*)
- sync
- [ "$verbose" ] && echo "Directory of ${drive}:/${subdir}"
- if [ "$drive" = "C" ]; then
- ls -l $dir/${subdir}
- else
- umount $dir >/dev/null 2>&1
- if mount -t pcfs $device $dir; then
- ls -l $dir/${subdir}
- umount $dir
- fi
- fi
- ;;
- o*|O*)
- tmp=$drive; drive=$altdrive; altdrive=$tmp
- ;;
- q*|Q*)
- drive=q
- ;;
- s*|S*)
- echo; echo -n "tmp_dir is set to $tmp_dir"
- [ "$tmp_dir" != "`pwd`" ] && echo -n " (physically `pwd`)"
- echo; echo "Free space in tmp_dir:"
- df -k .
- echo -n "Reading from drive $drive:"
- [ "$drive" != "$altdrive" ] && echo -n " and drive $altdrive:"
- echo
- tmp=on; [ -z "$verbose" ] && tmp=off
- echo "Verbose mode is $tmp"
- tmp=on; [ -z "$interactive" ] && tmp=off
- echo "Interactive mode is $tmp"
- ;;
- v*|V*)
- tmp=$verbose; verbose=; [ -z "$tmp" ] && verbose=-v
- tmp=on; [ -z "$verbose" ] && tmp=off
- echo "verbose mode is $tmp"
- ;;
- \?)
- echo
- echo "Enter: To:"
- echo "----- ---"
- echo "(just RETURN) Copy files from ${drive}:/${subdir} to $tmp_dir"
- echo " c Change directory of MS-DOS drive C:"
- echo " i Toggle interactive mode (cp -i)"
- echo " l List directory of current drive"
- echo " o Read from alternate floppy drive"
- echo " q Quit"
- echo " s Show status"
- echo " v Toggle verbose mode"
- echo
- ;;
- esac
- done
- echo "Working directory: `pwd`"
- unset verbose answer drive altdrive device dir subdir tmp interactive
-}
-load_dos
-{
- load_fd
-}
-load_qic_tape()
-{
- tmp_dir
- echo -n "Insert tape into QIC tape drive and hit return to continue: "
- read foo
- tar xvf /dev/rwt0
-}
-load_scsi_tape()
-{
- tmp_dir
- echo -n "Insert tape into SCSI tape drive and hit return to continue: "
- read foo
- tar xvf /dev/nrst0
-}
-extract()
-{
- tmp_dir
- echo -n "Would you like to be verbose about this? [n] "
- read verbose
- case $verbose in
- y*|Y*)
- tarverbose=--verbose
- ;;
- *)
- tarverbose=
- ;;
- esac
- #XXX ugly hack to eliminate busy files, copy them to /tmp and use them
- #from there...
- cp -p /bin/cat /usr/bin/gunzip /usr/bin/tar /tmp
-
- for i in $*; do
- /tmp/cat "$i"* |
- /tmp/gunzip |
- (cd / ; /tmp/tar --extract --file - --preserve-permissions ${tarverbose} )
- done
- rm -f /tmp/cat /tmp/gunzip /tmp/tar
- sync
-}
-configure()
-{
- echo "You will now be prompted for information about this"
- echo "machine. If you hit return, the default answer (in"
- echo "brackets) will be used."
-
- echo
- echo -n "What is this machine's hostname? [unknown.host.domain] "
- read hname
-
- if [ "$hname" = "" ]; then
- hname=unknown.host.domain
- fi
- echo $hname > /etc/myname
- proto_domain=`echo $hname | sed -e 's/[^.]*\.//'`
-
- echo
- echo "What domain is this machine in (this is NOT its YP"
- echo -n "domain name)? [$proto_domain] "
- read dname
-
- if [ "$dname" = "" ]; then
- dname=$proto_domain
- fi
-
- echo
- echo -n "Does this machine have an ethernet interface? [y] "
- read resp
- case "$resp" in
- n*)
- ;;
- *)
- intf=
- while [ "$intf" = "" ]; do
- echo -n "What is the primary interface name (i.e. ed0, etc.)? "
- read intf
- done
- echo -n "What is the hostname for this interface? [$hname] "
- read ifname
- if [ "$ifname" = "" ]; then
- ifname=$hname
- fi
- ifaddr=
- while [ "$ifaddr" = "" ]; do
- echo -n "What is the IP address associated with this interface? "
- read ifaddr
- done
- echo "$ifaddr $ifname `echo $ifname | sed -e s/\.$dname//`" \
- >> /etc/hosts
-
- echo -n "Does this interface have a special netmask? [n] "
- read resp
- case "$resp" in
- y*)
- echo -n "What is the netmask? [0xffffff00] "
- read ifnetmask
- if [ "$ifnetmask" = "" ]; then
- ifnetmask=0xffffff00
- fi
- ;;
- *)
- ifnetmask=
- ;;
- esac
-
- echo -n "Does this interface need additional flags? [n] "
- read resp
- case "$resp" in
- y*)
- echo -n "What flags? [llc0] "
- read ifflags
- if [ "$ifflags" = "" ]; then
- ifflags=llc0
- fi
- ;;
- *)
- ifflags=
- ;;
- esac
-
- echo "inet $ifname netmask $ifnetmask $ifflags" > /etc/hostname.$intf
-
- echo ""
- echo "WARNING: if you have any more ethernet interfaces, you"
- echo "will have to configure them by hand. Read the comments"
- echo "in /etc/netstart to learn how to do this"
- ;;
- esac
-
- sync
-
- echo
- echo "OK. You should be completely set up now."
- echo "You should now reboot your machine by issuing the 'reboot' command"
- echo "after removing anything that happens to be in your floppy drive."
-}
diff --git a/etc/etc.i386/install_notes b/etc/etc.i386/install_notes
deleted file mode 100644
index 2a9d0d0..0000000
--- a/etc/etc.i386/install_notes
+++ /dev/null
@@ -1,1056 +0,0 @@
- INSTALLATION NOTES
- FreeBSD
- Release 1.1
-
-These notes have been prepared from those written originally for NetBSD
-0.9. The conversion was done by someone who has had experience with
-installing and upgrading 386bsd, but who is not a unix guru, so there
-will be slant towards this experience. Corrections/updates are
-welcomed, it is difficult/impossible to test every last hardware
-combination.
-
-Be sure to read _ALL_ of this document before you try to install
-FreeBSD. FreeBSD probably looks a bit similar to things that you've
-seen before (perhaps 386BSD), but the installation procedures are quite
-different.
-
-
-FreeBSD Release Contents:
-------- --- ------- --------
-
-The FreeBSD Release consists of the following elements:
-
-Bootable Kernel-copy floppies
-
- These disks are bootable and have enough utilities on
- board to copy a new kernel to a prepared hard disk. While
- they are primarily intended for installing FreeBSD, they
- also make upgrading to a new kernel easy: boot from it,
- and copy a new kernel to disk.
-
- You must choose between one of two kernel-copy floppy
- images, depending on your disk controller type. The
- "kcopy-ah-floppy" image supports the Adaptec 154x and 1742
- SCSI adapters, while "kcopy-bt-floppy" supports the Bustek
- 742 and Ultrastore SCSI adapters. For systems with only
- MFM, RLL, ESDI or IDE disk controllers, either image can
- be used.
-
-Installation floppies
-
- In addition to a bootable floppy, currently two additional
- disks are required to prepare your hard drive for FreeBSD
- and to install the FreeBSD distribution. Like the boot
- floppies, these are distributed as binary images. They are
- are referred to below as the "filesystem-floppy" and the
- "cpio-floppy".
-
- There is also an optional fourth installation disk referred
- to as the "dos-floppy". Unlike the other install disks,
- there is no binary image for the dos floppy. Instead this
- is a regular MS-DOS-formatted floppy disk containing any
- FreeBSD programs you choose to copy to it using mtools or
- even the DOS copy command. The most commonly requested
- programs have been put in a tools directory at FreeBSD
- archives sites.
-
-Upgrade floppies
-
- These facilitate upgrading to FreeBSD from any previous
- patch-kit level of 386BSD 0.1. They are still in testing,
- but should be available by the time you read this from
- the tools/upgrade directory at FreeBSD archive sites.
- [the current version is:
- tools/upgrade/386BSD-to-FreeBSD-update-LATE-BETA.tar.gz]
-
-FreeBSD distribution sets
-
- These collections contain the complete FreeBSD system and
- utilities in source and binary form. There are three
- separate sets: the FreeBSD binaries, the FreeBSD sources,
- and the DES sources+binaries. The DES set contains only
- crypt(3) code and is subject to U.S.A. export restrictions.
-
- The binary distribution set can be found in the "binarydist"
- subdirectory of the FreeBSD archive sites. It consists
- of files named bin_tgz.aa to bin_tgz.db (i.e., 80 files
- all told). A CKSUMS file (* see note below) is included
- for verifying the integrity of these.
-
- The source distribution sets can be found in under
- "sourcedist" subdirectory of archive sites. It is consists
- of files named src_tgz.aa to src_tgz.cp (i.e., 68 files
- all told), plus file CKSUMS*.
-
- Finally, the security distribution set contains
- usr/src/libcrypt/*, the source files for the DES encryption
- algorithm, and the binaries which depend on it. It can
- be found in the "securedist" subdirectory on sites which
- choose to carry the complete FreeBSD distribution.
-
- The individual files in each collection are no more than
- 235 Kbytes in size. (The last file is just long enough
- to contain the rest of the data for that distribution
- set.)
-
- Each collection is a split, gzip'ed tar archive. They
- are reassembled and extracted by the install procedure.
- However, to view them without installing FreeBSD, you can
- use, e.g., the command line:
-
- cat bin* | gunzip | tar tvf - | more
-
- or to extract the files themselves:
-
- cat bin* | gunzip | tar xvfp -
-
- Using this method, the files are extracted in the current
- directory. So to install the binary distribution, for
- instance, you have to run the "tar xvfp" from the root
- directory (/).
-
- In each of the distribution directories, there is a file
- named "CKSUMS" which contains the checksums of the files
- in that directory, as generated by the cksum(1) command.
- You can use cksum to verify the integrity of the archives,
- if you suspect one of the files is corrupted.
-
- N.B.: The CKSUMS files are produced using the 4.4BSD
- version of cksum which is POSIX-compliant. The values in
- these file do not match the cksums generated by the 386BSD 0.1
- version of cksum (which is based on an earlier "standard").
- A copy of the new cksum binary that will run on
- 386bsd/Netbsd/FreeBSD can be found in the "tools" subdirectory
- of the distribution.
-
-
-System Requirements and Supported Devices:
------- ------------ --- --------- -------
-
-FreeBSD runs on ISA (AT-Bus) and EISA systems, with 386 and 486
-processors, with or without math coprocessors. It does NOT support
-Micro-channel systems, such as some IBM PS/2 systems. The minimal
-configuration includes 4Meg of RAM, and an 80Meg hard disk, but to
-install the entire system you'll need much more disk space, and to run
-X or compile the system more RAM is recommended. (4Meg will actually
-allow you to run X and/or compile, but it's extremely slow.)
-
-Supported devices include:
-
- Standard floppy controllers
-
- Standard hard disk controllers:
- MFM
- ESDI
- IDE
- RLL
-
- SCSI hard disk controllers:
- Adaptec 154x series * [kcopy-ah-floppy]
- Adaptec 174x series
- Buslogic 545S
- Bustek 742 (EISA) [kcopy-bt-floppy]
- DTC 3290 in 1542 emulation mode *
- Ultrastor 14f and 34f
-
- * Your system can NOT have more than 16MB of memory with
- these controllers.
-
- Display Adaptors:
- MDA
- CGA
- VGA (and SVGA)
- HGC
-
- Serial communications ports
- 8250
- 16450
- 16550A
- [4-port multi-serial cards - require kernel built
- with MULTI_PORT option]
- [We do not support the Intel 82501 serial chip used
- in some PC's at this time]
-
- Ethernet controllers
- SMC/WD 8003, 8013, and equivalents
- (including the SMC "Elite" series)
- Novell NE1000, NE2000, NE2100
- 3COM 3c503
- ISOLAN ISOLink
-
- Tape drives:
- QIC-02 format tape drives
- most SCSI tape/DAT drives
- [an early QIC-40 or QIC-80 tape driver exists,
- but is not yet incorporated into FreeBSD]
-
- CD-ROM drives:
- Mitsumi CDROM drive with Mitsumi Controller
- Most SCSI CD-ROM drives on a supported SCSI controller
-
-To be detected by the distributed kernels, the devices must
-be configured as follows: (Note: IRQ 9 is the same as IRQ 2
-on ISA/EISA based machines)
-
-Device Name Port IRQ DRQ Misc
------- ---- ---- --- --- ----
-Floppy Cntlr. fd0 0x3f0 6 2
-
-Std. Hard Disk Cntlr.
- wd0 0x1f0 14
-
-AHA-154x SCSI Cntlr. 0x330 11 5 [kcopy-ah-floppy]
-
-AHA-174x SCSI Cntlr. automatically configured [kcopy-ah-floppy]
-
-BT742 SCSI Cntlr. 0x330 12 [kcopy-bt-floppy]
-
-UHA-14f SCSI Cntlr. or
-UHA-34f SCSI Cntlr. 0x330 14 5 [kcopy-bt-floppy]
-(In FreeBSD GAMMA and before, UHA was on IRQ 11)
-
-SCSI Disks sd[0-2] automatically configured
-
-SCSI Tapes st[01] automatically configured
-
-SCSI CD-ROMs cd0 automatically configured
-
-Serial Ports com0 0x3f8 4
- com1 0x2f8 3
- com2 0x3e8 5
- com3 0x3f8 9
-
-SMC/WD Ethernet or
-3COM 3c503 ed0 0x280 5 iomem 0xd8000
-
-NOTE for 386bsd users: the we0 device for the WD80xxyy card has been
-replaced with an ed0 device. The default settings of 9/280/d000 have
-been changed to 5/280/d800 as this address accomdates all of the boards.
-
-Novell Ethernet ed0 0x280 5
-
-NOTE for 386bsd users: the ne0 device for the NEx000 card has been
-replaced with an ed0 device. The default settings of 9/300 have
-been changed to 5/280.
-
-ISOLAN ISOLink is0 0x280 10 7
-Novell NE2100 is0 0x280 10 7
-
-QIC-02 Tape wt0 0x300 5 1
-
-Parallel (Printer) Port
- lpt0 0x3BC 7
-
-Interruptless Parallel (Printer) Port
- lpa0 0x378
- lpa1 0x278
-
-N.B.: Disable the lpt interrupt on the board or you will
-have problems using the lpa drivers.
-
-Hard-Disk Storage Requirements
---------- ------- ------------
-
-The minimum base installation of FreeBSD requires a free hard disk
-partition with at least 16 MB free space. This is only enough for
-the three installation disks, which don't support a multi-user
-shell.
-
-The full binary distribution extracts to about 46 MB.
-The full source distribution extracts to about 72 MB.
-The kernel source only extracts to about 7 MB.
-To recompile the sources requires an additional 55 MB.
-To recompile the kernel requires an additional 2 MB.
-
-Since additional room is required for extracting the distributions,
-a full binary installation requires a minimum of about 80 MB (46
-MB extracted + 16 MB archived + 8 MB minimum swap + room for
-extracting).
-
-A complete source + binary distribution requires a minimum of
-about 210 MB (assuming a minimum 8 MB swap).
-
-
-Getting the System on to Useful Media:
-------- --- ------ -- -- ------ -----
-
-Installation is supported from several media types, including:
-
- MS-DOS floppies
- MS-DOS hard disk (Primary partition)
- Tape
- NFS partitions
- FTP
- Kermit
-
-No matter what you do, however, you'll need at least three disks (1.2M
-or 1.44M) handy, on which you will put the kernel-copy image and the
-install (or upgrade) floppy images.
-
-The images are available from the directory "floppies", under the root
-of the FreeBSD/FreeBSD-1.1 tree at your favorite archive site.
-They're available both as raw disk images, and gzipped, to save time
-downloading.
-
-If you are using an AHA-154x or AHA-1742 SCSI host adapter, you need
-the kcopy-ah-floppy image. If you're using a BT-742 SCSI host adapter
-or an Ultrastor adaptor, then you'll need the kcopy-bt-floppy image.
-If you're using MFM/RLL/IDE disk controllers, you can use either
-kernel-copy floppy image.
-
-If you are using UNIX to make the floppies, you should use the command
-dd(1) to write the raw floppy images (i.e., kcopy-ah-floppy or
-kcopy-bt-floppy, filesystem-floppy and cpio-floppy) to the floppies.
-For example, to write kcopy-ah-floppy to a 5.25" 1.2 Mb floppy
-disk under 386BSD, use:
-
- $ dd if=kcopy-ah-floppy of=/dev/fd0a bs=30b count=80
-
-or for a 3.5" 1.44 Mb floppy:
-
- $ dd if=kcopy-ah-floppy of=/dev/fd0a bs=36b count=80
-
-If you are using DOS to make the floppies, use the rawrite.exe
-utility. This can be found in the "tools" subdirectory of the
-archive site. Copy rawrite.exe and the binary images to a DOS
-disk, type "rawrite" under MS-DOS and follow the instructions.
-Rawrite can write binary images to either 1.2MB or 1.44MB
-MS-DOS-formatted floppies.
-
-Any other programs from the tools directory that might be needed
-for installing FreeBSD, such as kermit, should be copied to a DOS-
-formatted floppy (1.2MB or 1.44MB). Under 386BSD, they can be
-copied to floppy using the mcopy command. Under DOS, use the DOS
-copy command.
-
-The steps necessary to prepare the distribution sets for installation
-depend on which method of installation you choose. The various methods
-are explained below.
-
-To prepare for installing via MS-DOS hard disk:
-
- To prepare FreeBSD for installaton from the MS-DOS C: drive
- of the hard disk, you need to do the following:
-
- If FreeBSD is installed on a hard disk containing
- a Primary MS-DOS partition (as opposed to an
- Extended DOS partition), then the FreeBSD distribution
- files can be read directly from DOS. Preparation
- is just a matter of copying the FreeBSD distribution
- files onto DOS C: drive of the hard disk.
-
- If FreeBSD is installed on a separate hard disk than
- MS-DOS, it is not currently possible to read the FreeBSD
- distribution files directly from DOS. In this case,
- a different medium should be used.
-
- Once you have the files on the C: drive, you can proceed to the
- next step in the installation process, viz preparing your hard
- disk.
-
-To prepare for installing via MS-DOS floppies:
-
- To prepare FreeBSD for installaton from MS-DOS floppies, you
- need to do the following:
-
- Count the number of "<set>_tgz.xx" files
- you have (these are split, gzip'ed, tar
- archives). Call this number N. You will
- need N/6 1.44M floppies, or N/5 1.2M
- floppies to install the distribution
- in this manner. For the set of bin files
- (i.e., 80 files) and 1.2 Mb floppies you will
- need 16 disks.
-
- Format all of the floppies, with MS-DOS.
- Don't make any of them MS-DOS bootable
- floppies (i.e., don't use "format /s"!)
- If you use "format /u" then the format
- will run a tad faster.
-
- Copy all of the "<set>_tgz.xx" files on
- the DOS disks. Under DOS use the DOS copy
- command. Under 386BSD, use, for instance,
- the make_floppies script:
-
- #!/bin/sh
- N_PER_DISK=5
-
- x=$N_PER_DISK
- for dist in bin_tgz.*; do
- if [ $x -ge $N_PER_DISK ]; then
- x=0
- echo -n "Insert next disk, "
- echo -n "and press ENTER... "
- read reply
- mdel a:/\*
- fi
- mcopy $dist a:/
- x=`expr $x + 1`
- done
-
- (Or you might use tar instead).
-
- Once you have the files on DOS disks, you can proceed to the
- next step in the installation process, viz preparing your hard
- disk.
-
-To prepare for installing via a tape:
-
- To install FreeBSD from a tape, you need to be somehow
- to get the FreeBSD filesets you wish to install on
- your system on to the appropriate kind of tape,
- in tar format.
-
- If you're making the tape on a UN*X system, the easiest
- way to do so is:
-
- tar cvf <tape_device> <files>
-
- where "<tape_device>" is the name of the tape device
- that describes the tape drive you're using (either
- /dev/rst0 for SCSI tape, otherwise /dev/rwt0).
- If you can't figure it out, ask your system administrator.
- "<files>" are the names of the "<set>.tar.gz.xx" files
- which you want to be placed on the tape.
-
- If your tape drive is not a type recognzed by the
- kernel, then it may be necessary to set the tape density
- using either the st(1) command (for SCSI tape) or the
- mt(1) command. Both these programs are available from
- the tools directory of the FreeBSD archive site.
-
-To prepare for installing via an NFS partition:
-
- NOTE: this method of installation is recommended
- only for those already familiar with using
- the BSD network-manipulation commands and
- interfaces. If you aren't, this documentation
- should help, but is not intended to be
- all-encompassing.
-
- Place the FreeBSD software you wish to install into
- a directory on an NFS server, and make that directory
- mountable by the machine which you will be installing
- FreeBSD on. This will probably require modifying the
- /etc/exports file of the NFS server and resetting
- mountd, acts which will require superuser privileges.
- Make a note of the numeric IP address of the NFS server
- and make a note of the router closest to the the new
- FreeBSD machine if the NFS server is not on a network
- which is directly attached to the FreeBSD machine.
-
- Once you have done this, you can proceed to the next
- step in the installation process, preparing your hard disk.
-
-To prepare for installing via FTP:
-
- NOTE: this method of installation is recommended
- only for those already familiar with using
- the BSD network-manipulation commands and
- interfaces. If you aren't, this documentation
- should help, but is not intended to be
- all-encompassing.
-
- The preparations for this method of installation
- are easy: all you have to do is make sure that
- there's some FTP site from which you can retrieve
- the FreeBSD installation when it's time to do
- the install. You should know the numeric IP
- address of that site, and the numeric IP address of
- your nearest router if the new FreeBSD computer is
- not on the same net or subnet as the FTP site.
-
- Once you have done this, you can proceed to the next
- step in the installation process, preparing your hard disk.
-
-To prepare for installing via Kermit:
-
- The preparations for this method of installation
- require that the kermit program be put on the
- dos-floppy installation disk. This will be
- loaded as part of the minimum base installation.
- Kermit is available from tools directory of the
- FreeBSD FTP site. This is a FreeBSD binary and
- only executes under the FreeBSD operating system.
-
- Once you have done this, you can proceed to the next
- step in the installation process, preparing your hard disk.
-
-To upgrade:
-
- (The beta upgrade script is available on request from
- FreeBSD-questions@freefall.cdrom.com)
-
-Preparing your Hard Disk for FreeBSD Installation:
---------- ---- ---- ---- --- ------ ------------
-
-NOTE: If you wish to install FreeBSD on your whole drive, (i.e. you do
-not want DOS or any other operating system on your hard disk), you can
-skip this section, and go on to "Installing the FreeBSD System."
-
-Firstly, be sure you have a reliable backup of any data which you may
-want to keep; repartitioning your hard drive is an excellent way to
-destroy important data.
-
-WARNING: If you are using a disk controller which supports disk
-geometry translation, BE SURE TO USE THE SAME PARAMETERS FOR FreeBSD AS
-FOR DOS! If you do not, FreeBSD will not be able to properly coexist
-with DOS.
-
-Secondly, make sure your disk has at least 16 Mbytes free space (or
-80 Mbytes for the complete binary distribition).
-
-You are now set to install FreeBSD on your hard drive.
-
-Installing the FreeBSD System:
----------- --- ------ ------
-
-If DOS or OS/2 is already installed on the hard disk, installation should
-be easy. By default FreeBSD is installed after the last DOS or OS/2
-partition. Otherwise, you may need to specify your hard disk's geometry
-(i.e., number of cylinders, heads and sectors per track).
-
-For computing partition sizes, it might help to have a calculator handy.
-
-And it's finally time to install the system!
-
-The following is a walk-through of the steps necessary to get FreeBSD
-installed on your hard disk. If you wish to stop the installation, you
-may hit Control-C at any prompt and then type `halt'.
-
- Boot from the kcopy-ah or kcopy-bt floppy, depending on
- your hard disk controller type.
-
- When prompted to insert the filesystem floppy, remove the
- kcopy floppy from the drive and insert filesystem floppy
- and hit any key.
- N.B.: The filesystem floppy must not be write protected.
-
- [When booting, if no message prompt appears after a
- reasonable period of time, reboot and try it again. If
- this doesn't work, try disabling your CPU's internal and
- external caches, and then try to boot again. If there is
- still no message prompt, then you can't install FreeBSD
- on your hardware. If you were able to install 386bsd,
- this is definitely a bug in our software; please report
- it! Please include your system configuration, and any
- other relevant information in your bug report.]
-
- The boot sequence continues after the filesystem floppy
- has been inserted. A copyright notice is displayed along
- with a list of the hardware that FreeBSD recognizes as
- being in your machine. You might want to make a note of
- the disk values for cylinders, heads, sectors etc for
- later use.
-
- After a short while (approximately 30 to 60 seconds), you
- should see a welcome message and a prompt, asking if you
- wish to proceed with the installation.
-
- If you wish to proceed, enter "y" and then return.
-
- You will then be asked what type of disk drive you have.
- The valid options are listed on the screen (e.g., SCSI, ESDI).
-
- You will then be asked for a label name for your disk.
- This should be a short, one-word name for your disk,
- e.g., "cp3100-mine" for a Conner Peripherals "3100" disk.
- You needn't remember this name.
-
- Next, you will be prompted for the geometry information.
- The default values should be correct, in which case just
- hit ENTER to accept them. Otherwise enter the values
- that were displayed during the boot sequence as they are
- requested.
-
- The default size of the FreeBSD portion of the disk
- is the maximum available at the end of the disk (which may
- be the whole disk). Accept the default by hitting ENTER.
- Otherwise, enter an appropriate value using the information
- displayed.
-
- If you are not installing on the whole disk, you will be
- asked for the offset of the FreeBSD partition from the
- beginning of the disk. Again, hit ENTER to accept the
- default, or enter a cylinder offset from the beginning of
- the disk.
-
- You will then be asked for the size of your root partition,
- in cylinders. The suggested maximum size is 15 Mbytes
- which is used as a default. Accept this, or enter a
- suitable value (after converting to cylinders using the
- formula displayed).
-
- Next, you will be asked for the size of your swap partition
- - again, you must calculate this in cylinders. You should
- probably allocate around twice as much swap space as you
- have RAM memory. If you wish the system to save crash dumps
- when it panics, you will need at least as much swap as you
- have RAM.
-
- The install program will then ask you for information about
- the rest of the partitions you want on your disk. For the
- purposes of this document, you only want one more: /usr.
- Therefore, at the prompt, when in asks you to enter the size
- of the next partition, enter the number of cylinders remaining
- in the FreeBSD portion of the disk. When it asks you for the
- mount point for this partition, say "/usr".
-
- After the FreeBSD partition have been assigned, install checks
- the disk for an MS-DOS partition. If one exists, you are prompted
- whether to make this accessible from FreeBSD (i.e., for reading
- and writing). And if you choose to make the DOS partition
- accessible, you are prompted for what directory it should
- be mounted on. "/dos" is used by default. With this
- choice, you could copy the contents of the DOS root
- directory (i.e., C:\), for instance, with the Unix command:
-
- # cp /dos/* .
-
- If have you a DOS partition and you don't want it visible
- from FreeBSD, just respond with "n" when asked whether to
- make it accessible.
-
- YOU ARE NOW AT THE POINT OF NO RETURN.
-
- If you confirm that you want to install FreeBSD, your hard
- drive will be modified, and perhaps it contents scrambled at
- the whim of the install program. This is especially likely
- if you gave the install program incorrect information.
- Enter "no" at the prompt to get the option of redoing the
- configuration, using your previous choices as defaults.
-
- If you are sure you want to proceed, enter "yes" at the prompt.
-
- The install program now makes the filesystems you specified.
- If all goes well, there should be no errors in this section
- of the installation. If there are, restart from the the
- beginning of the installation process.
-
- After the installation program prompts you to see if you'd
- like to be told about all of the files it's going to copy
- to your hard drive, it will spend a few minutes copying these
- files and then will print out an informative message and
- place you at a "#" prompt.
-
- Read the message and note which partition (e.g., sd0a or wd0a)
- you need to copy a kernel to. Reboot the machine off the
- kcopy-xx-floppy disk, but this time at the prompt asking
- you to insert a file system floppy, do _not_ replace the
- floppy, just press <enter>.
-
- At the "kc>" prompt, enter "copy" to prepare to copy the
- kernel on the floppy to your hard disk.
-
- At the next "kc>" prompt, enter the disk partition to which
- you want to copy the kernel. (e.g., sd0a or wd0a).
-
- It will work for a minute or two, then present you with
- another "#" prompt. Follow the instructions given, (i.e.,
- halt the system) and reboot from the hard disk. You will
- probably have to do a hardware reset or else your ethernet
- card might not be recognised at reboot (e.g., if you have a
- WD8003EP card).
-
- When the machine boots, a three-line banner should appear at
- the top of the screen. In a few seconds, a series of
- messages will appear, describing the hardware in your machine.
- Once again, this stage can take up to two minutes, so DO NOT
- PANIC!
-
- You will be asked to insert the cpio-floppy into a floppy
- drive, and enter that drive's number. "0" corresponds to
- DOS's "A:" drive, "1" corresponds to DOS's "B:" drive.
-
- After you enter the number it will ask you if you'd like to
- watch its progress, and after you answer this question it
- will begin installing still more files on your hard disk.
- This should take no more than 3 minutes.
-
- You are given the option to load the dos-floppy disk.
- In particular, if you want to use kermit for downloading
- the distribution, the dos-floppy should have the kermit
- binary. Or if you are using SCSI tape, the dos-floppy should
- contain the st command.
-
- To load the dos-floppy, remove the cpio-floppy from the
- drive, insert the dos-floppy and enter a "yes" response
- at the prompt. Otherwise, enter "no" at the prompt.
-
- After the dos-floppy has been loaded, you are given (more)
- instructions, (e.g., to halt the system) and you should
- reboot the machine again, from the hard drive and probably
- with a hardware reset to kick your ethernet card back into
- life.
-
- CONGRATULATIONS: You now have the minimum base of FreeBSD
- files on your hard disk! Now you get to install the
- distribution file sets. Remember that, at minimum, you must
- install the bin.tar.gz.xx file set (see below for
- instructions).
-
- After the machine is done booting, you will be presented
- with a screenful of information about what to do next.
-
- What you do from this point on depends on which media you're
- using to install FreeBSD. Follow the appropriate
- instructions, given below.
-
- To install from MS-DOS hard disk partition, floppy or tape:
-
- The first thing you should do is to choose a temporary
- directory where the distribution files can be stored.
- To do this, use the command "set_tmp_dir" and enter
- your choice. The default is /usr/distrib.
-
- After you have chosen a temporary directory,
- you should issue the appropriate load command:
-
- load_dos - for loading from a MS-DOS hard disk
- partition, or from floppies,
-
- load_qic_tape - for loading from QIC-02 tape, or
-
- load_scsi_tape - for you're loading from the first
- SCSI tape drive in the system.
-
- If loading from tape, it may be necessary to first
- set the default density using the mt or st command.
- The low-density device (/dev/rst0 or /dev/rmt0)
- is used by the load_xx_tape command, so to prepare
- a SCSI device for reading QIC-150 tape, you might use:
-
- # st -f /dev/nrst0 rewind
- # st -f /dev/nrst0 low_dnsty 16
- # load_scsi_tape
-
- If loading from floppy or hard disk, the load_dos
- command prompts for information, such as to which
- floppy drive or hard disk directory to load from.
- Additional options are available, e.g., for listing
- and, if loading from hard disk, changing source
- directories.
-
- Go to the directory which contains the first
- distribution set you wish to install. This is
- either the directory you specified above, if using
- load_dos, or possibly a subdirectory of that
- directory, if you loaded from tape.
-
- When there, run "set_tmp_dir" again, and choose
- the default temporary directory, by hitting
- return at the prompt.
-
- Run the "extract" command, giving it as its sole
- argument the name of the distribution set you
- wish to extract. For example, to extract the binary
- distribution, use the command:
-
- extract bin
-
- and to extract the source distribution:
-
- extract src
-
- After the extraction is complete, go to the location
- of the next set you want to extract, "set_tmp_dir"
- again, and once again issue the appropriate
- extract command. Continue this process until
- you've finished installing all of the sets which you
- desire to have on your hard disk.
-
- After each set is finished, if you know that you
- are running low on space you can remove the
- distribution files for that set by saying:
-
- rm <set>*
-
- For example, if you wish to remove the distribution
- files for the binarydist set, after the "extract bin"
- command has completed, issue the command:
-
- rm bin*
-
- Once you have extracted all sets and are at the "#" prompt
- again, proceed to the section "Configuring Your System,"
- below.
-
- To install via FTP or NFS:
-
- First you must decide on a temporary directory to hold
- the <set>.tar.gz.xx files. The directory /usr/distrib
- is suggested. You should cd to it, if necessary do
- a mkdir first. Use set_tmp_dir to identify this
- directory to the install process.
-
- Configure the appropriate ethernet interface (e.g. ed0,
- ne0, etc.) up, with a command like:
-
- ifconfig <ifname> <ipaddr> [netmask <netmask>]
-
- where <ifname> is the interface name (e.g. ed0, etc.),
- and <ipaddr> is the numeric IP address of the interface.
- If the interface has a special netmask, supply
- the word "netmask" and that netmask at the end of the
- command line. For instance, without a special netmask:
-
- ifconfig ed0 129.133.10.10
-
- or with a special netmask
-
- ifconfig ed0 128.32.240.167 netmask 0xffffff00
-
- or the equivalent
-
- ifconfig ed0 128.32.240.167 netmask 255.255.255.0
-
- If you are using the AUI connector on a 3C503 card, you
- must also set the LLC0 flag (the default is to use the BNC
- connector):
-
- ifconfig ed0 130.252.23.86 llc0
-
- If the NFS server or FTP server is not on a directly-
- connected network, you should set up a route to it
- with the command:
-
- route add default <gate_ipaddr>
-
- where <gate_ipaddr> is your gateway's numeric IP address.
-
- If you are NFS-mounting the distribution sets,
- mount them on the temporary directory with the command:
-
- mount -t nfs <serv_ipaddr>:<dist_dir> <tmp_dir>
-
- where <serv_ipaddr> is the server's numeric IP address,
- <dist_dir> is the path to the distribution files on
- the server, and <tmp_dir> is the name of the local
- temporary directory (e.g., /usr/distrib). Proceed as if
- you had loaded the files from tape, "cd"ing to the
- appropriate directories and running "set_tmp_dir" and
- "extract" as appropriate.
-
- If you are retrieving the distribution sets using ftp,
- cd into the temp directory, and execute the command:
-
- ftp <serv_ipaddr>
-
- where <serv_ipaddr> is the server's numeric IP address.
- Get the files with FTP, taking care to use binary mode
- to transfer all files. A simple set of commands is
-
- ftp <serv_ipaddr>
- user ftp
- passwd <user-id>@
- hash
- binary
- prompt
- cd <where/the/binarydist/files/are>
- mget *
- cd <where/the/sourcedist/files/are>
- mget *
- quit
-
- Once you have all of the files for the distribution sets
- that you wish to install, you can proceed using the
- instructions above as if you had installed the files
- from a floppy.
-
- To install via Kermit:
-
- First you must decide on a temporary directory to hold
- the <set>.tar.gz.xx files. The directory /usr/distrib
- is suggested. You should cd to it, if necessary do
- a mkdir first. Use set_tmp_dir to identify this
- directory to the install process.
-
- Invoke kermit and dial the remote kermit server.
- A typical session might be:
- # stty -f /dev/sio01 clocal
- # kermit
- C-Kermit> set file type binary
- C-Kermit> set line /dev/sio01
- C-Kermit> set baud 9600
- C-Kermit> set receive packet 740
- C-Kermit> set window 4
- C-Kermit> set block 2
- C-Kermit> connect
- Connecting to /dev/sio01, speed 9600.
- The escape character is Ctrl-\ (ASCII 28, FS)
- Type the escape character followed by C to get back,
- or followed by ? to see other options.
- atdt 1234567 <-- dial the remote
- Connect 9600
- login: mylogin <-- login to the remote
- [...]
- remote$ kermit -ix <-- remote kermit as binary server
- [...]
- ^\C <-- return to local kermit
- C-Kermit> get bin_tgz* <-- request files from remote
- [...] (wait long for transfer to complete)
- C-Kermit> finish <-- terminate remote server
- C-Kermit> connect
- C-Kermit> exit <-- exit remote kermit
- remote$ exit <-- exit remote host
- ^\C <-- return to local kermit
- C-Kermit> exit <-- exit local kermit
-
- At this point the binary distribution should be
- downloaded to the FreeBSD system. Run the "extract"
- command, giving it as its sole argument the name
- of the distribution set you wish to extract. For
- example, to extract the binary distribution, use
- the command:
-
- extract bin
-
- and to extract the source distribution:
-
- extract src
-
- After the extraction is complete, go to the location
- of the next set you want to extract, "set_tmp_dir"
- again, and once again issue the appropriate
- extract command. Continue this process until
- you've finished installing all of the sets which you
- desire to have on your hard disk.
-
- After each set is finished, if you know that you
- are running low on space you can remove the
- distribution files for that set by saying:
-
- rm <set>*
-
- For example, if you wish to remove the distribution
- files for the binarydist set, after the "extract bin"
- command has completed, issue the command:
-
- rm bin*
-
- Once you have extracted all sets and are at the "#" prompt
- again, proceed to the section "Configuring Your System,"
- below.
-
-
-Further Tips on Installing FreeBSD
-------- ---- -- ---------- -------
-
- You might wish to install the binarydist first, get that
- working, and then at a later point in time have a go at
- installing the sourcedist. BEFORE YOU REBOOT AFTER INSTALLING
- THE BINARYDIS, you must preserve the commands that do the
- extracting. They are kept in the single-user-mode .profile
- file called /.profile. Proceed like this:
-
- mv /.profile /.profile.install
- ln /root/.profile /.profile
-
- When you are ready to install the sourcedist at some time
- in the future, get into multi-user mode (i.e., the normal
- means of running FreeBSD) and issue these commands:
-
- cp /.profile.install /.profile
- shutdown now
-
- This will cause the system to go into single-user mode, and
- the install profile will be active (i.e., you will find the
- commands load_dos, extract etc available to you again).
-
- If your disk has several operating systems, you may want
- to install a boot manager such as Thomas Wolfram's os-bs
- for selecting which system to boot. os-bs135.exe and other
- boot managers are available from the tools directory of
- the FreeBSD FTP site. os-bs works well with DOS, OS/2,
- FreeBSD and other systems, however, it cannot currently
- be used to boot FreeBSD from a second hard disk. Another
- boot manager, such as boot-easy should be used.
-
- To install, for instance, os-bs, boot the system with
- MS-DOS and insert the dos-floppy containing os-bs135.exe
- in floppy drive A:. Then enter the DOS commands:
- > A:
- > os-bs135
- > cd os-bs
- > os-bs
- A menu should now appear on the screen. Use the cursor keys
- to highlight the install option, hit ENTER, and follow the
- instructions from there.
-
- For more information about the ob-bs program, including its
- capabilities and limitations, see the file `readme.1st' in the
- os-bs directory.
-
- If your disk has several operating systems and you choose
- not to install os-bs, then fdisk can be used to change
- the boot system. This is done by making the primary
- partition for the boot system active. FreeBSD has an
- fdisk command that can be used for this purpose as well.
-
-
-Configuring Your System:
------------ ---- ------
-
-Once you have finished extracting all of the distribution sets that you
-want on your hard drive and are back at the "#" prompt, you are ready
-to configure your system.
-
-The configuration utility expects that you have installed the base
-system. If you have not, you will not be able to run it successfully
-(nor will you have a functional system regardless of configuration).
-
-To configure the newly installed operating system, run the command
-"configure".
-
-Configure will ask for the machine's hostname, domain name, and other
-network configuration information. You should check that configure has
-set up the following files correctly:
-
- /etc/netstart
- /etc/myname
-
-Once you have supplied configure all that it requests, your machine
-will be configured well enough that when you reboot it it will be a
-completely functional FreeBSD system. It is not completely configured,
-however; you should adjust the /etc/sendmail.cf file as necessary to
-suit your site and/or disable sendmail in /etc/rc and you should look
-in /etc/netstart to make sure the flags are defined correctly for your
-site. You might wish to set up several other tcp/ip files, such as
-
- /etc/resolv.conf
- /etc/networks
-
-Once you are done with configuration, reboot with the "reboot" command.
-
-When it boots off of the hard drive, you will have a complete FreeBSD
-system! CONGRATULATIONS! (You really deserve them!!!)
-
-
-Administrivia:
--------------
-
-Registration? What's that?
-
-If you've got something to say, do so! We'd like your input.
-
-Please send random comments to:
-
- FreeBSD-questions@freefall.cdrom.com
-
-Please send bug reports, and that sort of material to:
-
- FreeBSD-bugs@freefall.cdrom.com
-
-If you'd like to help with this effort, and have an idea as to how
-you could be useful, send mail to:
-
- FreeBSD-hackers@freefall.cdrom.com
-
-THANKS FOR USING THIS; that's what makes it all worthwhile.
-
-[a favor: Please avoid mailing huge documents or files to these mailing lists,
- as they will end up in our personal mail spools. We will be
- happy to make other arrangements]
-
-This is $Id: install_notes,v 1.13 1994/02/22 17:11:27 rgrimes Exp $
diff --git a/etc/etc.i386/kc.profile b/etc/etc.i386/kc.profile
deleted file mode 100644
index 1bc715b..0000000
--- a/etc/etc.i386/kc.profile
+++ /dev/null
@@ -1,80 +0,0 @@
-# $Id: kc.profile,v 1.6 1994/02/21 21:52:00 rgrimes Exp $
-#
-# rc for kernel distribution floppy
-
-PATH=/bin:/sbin
-export PATH
-
-reboot_it() {
- echo ""
- echo "halting the machine..."
- halt
- echo "Halt failed! Try power-cycling the machine..."
- exit 1
-}
-
-bail_out() {
- echo ""
- echo "Time to reboot the machine!"
- echo "Once the machine has halted (it'll tell you when),"
- echo "remove the floppy from the disk drive and press"
- echo "any key to reboot."
- reboot_it
-}
-
-echo ""
-echo ""
-echo Enter '"copy"' at the prompt to copy the kernel on this
-echo floppy to your hard disk. enter anything else to reboot,
-echo but wait for the machine to restart to remove the floppy.
-echo ""
-echo -n "kc> "
-
-read todo
-
-if [ X"$todo" = Xcopy ]; then
- echo ""
- echo "What disk partition should the kernel be installed on?"
- echo "(e.g., "wd0a", "sd0a", etc.)"
- echo ""
- echo -n "copy kernel to> "
- while :; do
- read diskpart junk
- [ -c /dev/r$diskpart ] && break
- echo "${diskpart}: invalid partition"
- echo
- echo -n "copy kernel to> "
- done
- echo ""
- echo "Checking the filesystem on $diskpart..."
- fsck -y /dev/r$diskpart
- if [ $? -ne 0 ]; then
- echo ""
- echo "fsck failed... Sorry, can't copy kernel!"
- bail_out
- fi
- echo -n "Mounting $diskpart on /mnt... "
- mount /dev/$diskpart /mnt
- if [ $? -ne 0 ]; then
- echo ""
- echo "mount failed... Sorry, can't copy kernel!"
- bail_out
- fi
- echo "done."
- echo -n "Copying kernel... "
- cp -p /kernel /mnt
- if [ $? -ne 0 ]; then
- echo "failed... (?!?!?!)"
- bail_out
- fi
- echo "done."
- echo -n "Unmounting $diskpart... "
- umount /mnt > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo -n "failed... Shouldn't be a problem... "
- fi
- echo "done."
- bail_out
-fi
-
-reboot_it
diff --git a/etc/manpath.config b/etc/manpath.config
deleted file mode 100644
index f6e6d68..0000000
--- a/etc/manpath.config
+++ /dev/null
@@ -1,30 +0,0 @@
-# manpath.config
-#
-# This file is read by manpath to configure the mandatory manpath, to
-# map each path element to a manpath element and to determine where the
-# "man" binary lives. The format is:
-#
-# MANBIN pathname
-# MANDATORY_MANPATH manpath_element
-# MANPATH_MAP path_element manpath_element
-#
-# MANBIN is optional
-#
-#MANBIN /usr/bin/man
-#
-# every automatically generated MANPATH includes these fields
-#
-MANDATORY_MANPATH /usr/share/man
-MANDATORY_MANPATH /usr/local/man
-MANDATORY_MANPATH /usr/X386/man
-#MANDATORY_MANPATH /usr/X11R6/man
-#
-# set up PATH to MANPATH mapping
-#
-MANPATH_MAP /bin /usr/share/man
-MANPATH_MAP /usr/bin /usr/share/man
-MANPATH_MAP /usr/ucb /usr/share/man
-MANPATH_MAP /usr/local/mh /usr/local/mh/man
-MANPATH_MAP /usr/local/bin /usr/local/man
-MANPATH_MAP /usr/X386/bin /usr/X386/man
-#MANPATH_MAP /usr/X11R6/bin /usr/X11R6/man
diff --git a/etc/myname b/etc/myname
deleted file mode 100644
index a0d6cce..0000000
--- a/etc/myname
+++ /dev/null
@@ -1 +0,0 @@
-myname.my.domain
diff --git a/etc/namedb/root.cache b/etc/namedb/root.cache
deleted file mode 100644
index 56e5d72..0000000
--- a/etc/namedb/root.cache
+++ /dev/null
@@ -1,26 +0,0 @@
-; Updated from ns.internic.net root NS record 21.3.1995 by wollman
-;
-; $Id$
-
-; Initial cache data for root domain servers.
-. IN NS NS.INTERNIC.NET.
- IN NS AOS.ARL.ARMY.MIL.
- IN NS NS1.ISI.EDU.
- IN NS C.PSI.NET.
- IN NS TERP.UMD.EDU.
- IN NS NS.NASA.GOV.
- IN NS NIC.NORDU.NET.
- IN NS NS.ISC.ORG.
- IN NS NS.NIC.DDN.MIL.
-
-; Prep the cache (hotwire the addresses). Order does not matter.
-NS.INTERNIC.NET. IN A 198.41.0.4
-AOS.ARL.ARMY.MIL. IN A 128.63.4.82
- IN A 192.5.25.82
-NS1.ISI.EDU. IN A 128.9.0.107
-C.PSI.NET. IN A 192.33.4.12
-TERP.UMD.EDU. IN A 128.8.10.90
-NS.NASA.GOV. IN A 128.102.16.10
- IN A 192.52.195.10
-NIC.NORDU.NET. IN A 192.36.148.17
-NS.ISC.ORG. IN A 192.5.5.241
diff --git a/etc/passwd b/etc/passwd
deleted file mode 100644
index e004afe..0000000
--- a/etc/passwd
+++ /dev/null
@@ -1,10 +0,0 @@
-root:*:0:0:Charlie &:/root:/bin/csh
-toor:*:0:0:Bourne-again Superuser:/root:
-daemon:*:1:31:The devil himself:/root:
-operator:*:2:20:System &:/usr/guest/operator:/bin/csh
-bin:*:3:7:Binaries Commands and Source,,,:/:/dev/null
-games:*:7:13:Games pseudo-user:/usr/games:
-uucp:*:66:1:UNIX-to-UNIX Copy:/var/spool/uucppublic:/usr/lib/uucp/uucico
-ingres:*:267:74:& Group:/usr/ingres:/bin/csh
-falcon:*:32766:31:Prof. Steven &:/usr/games:/usr/games/wargames
-nobody:*:32767:9999:Unprivileged user:/nonexistent:/dev/null
diff --git a/etc/rc.maint b/etc/rc.maint
deleted file mode 100644
index 8311df1b..0000000
--- a/etc/rc.maint
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-# $Id: rc.maint,v 1.3 1995/03/29 03:30:22 jkh Exp $
-# From: @(#)rc 5.27 (Berkeley) 6/5/91
-
-# Various maintainance tasks to be done as the system is coming up
-
-# /var/crash should be a directory or a symbolic link
-# to the crash directory if core dumps are to be saved.
-if [ "X${savecore}" = X"YES" -a -d /var/crash ]; then
- echo; echo -n checking for core dump...
- savecore /var/crash
- echo done.
-fi
-
-# clean up left-over files
-rm -f /etc/nologin
-rm -f /var/spool/lock/*
-rm -f /var/spool/uucp/.Temp/*
-
-# clean out the old utmp file.
-(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; })
-
-# Check the quotas
-if [ "X${check_quotas}" = X"YES" ]; then
- echo 'checking quotas:'
- quotacheck -a
- echo ' done.'
- quotaon -a
-fi
-
-# build ps databases
-kvm_mkdb
-dev_mkdb
-
-# snapshot any kernel -c changes back to disk
-echo 'check for kernel -c changes'
-/sbin/dset -q
-
-# Whack the pty perms back into shape.
-chmod 666 /dev/tty[pqrs]*
-
-# check the password temp/lock file
-if [ -f /etc/ptmp ]
-then
- logger -s -p auth.err \
- "password file may be incorrect -- /etc/ptmp exists"
-fi
-
-# Recover vi editor files.
-virecovery=/var/tmp/vi.recover/recover.*
-if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then
- echo 'Recovering vi editor sessions'
- for i in $virecovery; do
- sendmail -t < $i
- done
-fi
-
-echo clearing /tmp
-
-# prune quickly with one rm, then use find to clean up /tmp/[lq]*
-# (not needed with mfs /tmp, but doesn't hurt there...)
-(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
- find -d . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;)
-
-if [ "X${accounting}" = X"YES" -a -d /var/account ]; then
- echo 'turning on accounting'; accton /var/account/acct
-fi
diff --git a/etc/rc.netstart b/etc/rc.netstart
deleted file mode 100644
index 7a211f4..0000000
--- a/etc/rc.netstart
+++ /dev/null
@@ -1,141 +0,0 @@
-#!/bin/sh -
-#
-# $Id: netstart,v 1.23 1995/03/22 18:00:35 jkh Exp $
-# From: @(#)netstart 5.9 (Berkeley) 3/30/91
-
-# my-name is my symbolic name
-# my-netmask is specified in /etc/networks
-#
-if [ -z "`hostname -s`" ] ; then
- hostname $hostname
-fi
-
-# Set the domainname if we're using NIS
-if [ -z "`domainname`" -a -e "/etc/defaultdomain" ] ; then
- domainname=`cat /etc/defaultdomain`
- domainname $domainname
-fi
-
-for i in /etc/hostname.*
-do
- ifn=`expr $i : '/etc/hostname\.\(.*\)'`
- if [ -e /etc/hostname.$ifn ]; then
- if [ -e /etc/start_if.$ifn ]; then
- sh /etc/start_if.$ifn $ifn
- fi
- ifconfig $ifn `cat /etc/hostname.$ifn`
- ifconfig $ifn
- fi
-done
-
-# set the address for the loopback interface
-ifconfig lo0 inet localhost
-
-# set interface for multicasts to default interface
-# this needs to happen before router discovery
-route add 224.0.0.0 -netmask 0xf0000000 -interface $hostname
-
-if [ -n "$defaultrouter" -a "x$defaultrouter" != "xNO" ] ; then
- route add default $defaultrouter
-elif [ -f /etc/defaultrouter ] ; then
- route add default `cat /etc/defaultrouter`
-fi
-
-# use loopback, not the wire
-# route add $hostname localhost
-
-echo -n starting network daemons:
-
-# Portmapper should always be run, to provide RPC services for inetd.
-if [ -x /usr/sbin/portmap ]; then
- echo -n ' portmap'; portmap
-fi
-
-# $gated and $routedflags are imported from /etc/sysconfig.
-# If $gated == YES, gated is used; otherwise routed.
-# If $routedflags == NO, routed isn't run.
-if [ "X${gated}" = X"YES" -a -r /etc/gated.conf ]; then
- echo -n ' gated'; gated $gatedflags
-elif [ "X${routedflags}" != X"NO" ]; then
- echo -n ' routed'; routed $routedflags
-fi
-
-# $namedflags is imported from /etc/sysconfig
-if [ "X${namedflags}" != "XNO" ]; then
- echo -n ' named'; named $namedflags
-fi
-
-# $ntpdate and $xntpdflags are imported from /etc/sysconfig.
-# If $ntpdate != NO, run ntpdate $ntpdate to set the date correctly.
-# If $xntpdflags != NO, start xntpd.
-if [ "X${ntpdate}" != X"NO" -o "X${xntpdflags}" != X"NO" ]; then
- if [ "X${tickadjflags}" != X"NO" ]; then
- echo -n ' tickadj'; tickadj ${tickadjflags--Aq}
- fi
-
- if [ "X${ntpdate}" != X"NO" ]; then
- echo -n ' ntpdate'; ntpdate ${ntpdate}
- fi
-
- if [ "X${xntpdflags}" != X"NO" ]; then
- echo -n ' xntpd'; xntpd ${xntpdflags}
- fi
-fi
-
-# $timedflags is imported from /etc/sysconfig;
-# if $timedflags == NO, timed isn't run.
-if [ "X${timedflags}" != X"NO" ]; then
- echo -n ' timed'; timed $timedflags
-fi
-
-# $rwhod is imported from /etc/sysconfig;
-# if $rwhod is set to YES, rwhod is run.
-if [ "X${rwhod}" = X"YES" ]; then
- echo -n ' rwhod'; rwhod
-fi
-
-if [ "X${nfs_server}" = X"YES" -a -r /etc/exports ]; then
- echo -n ' mountd'; mountd
- echo -n ' nfsd'; nfsd -u -t 4
-fi
-
-if [ "X${nfs_client}" = X"YES" ]; then
- echo -n ' nfsiod'; nfsiod -n 4
-fi
-
-if [ "X${amdflags}" != X"NO" ]; then
- echo -n ' amd'; amd ${amdflags}
-fi
-
-# $sendmail_flags is imported from /etc/sysconfig;
-# if $sendmail_flags is something other than NO, sendmail is run.
-if [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then
- echo -n ' sendmail'; sendmail ${sendmail_flags}
-fi
-
-# Kerberos runs ONLY on the Kerberos server machine
-if [ "X${kerberos_server}" = X"YES" ]; then
- echo -n ' kerberos'; kerberos >> /var/log/kerberos.log &
- echo -n ' kadmind'; \
- (sleep 20; /usr/sbin/kadmind -n >/dev/null 2>&1 &) &
-fi
-
-# Start ypserv if we're an NIS server.
-# Run yppasswdd only on the NIS master server
-if [ "X${nis_serverflags}" != X"NO" ]; then
- echo -n ' ypserv'; ypserv ${nis_serverflags}
-
- if [ "X${yppasswddflags}" != X"NO" ]; then
- echo -n ' yppasswdd'; yppasswdd ${yppasswddflags}
- fi
-fi
-
-
-# Start ypbind if we're an NIS client
-if [ "X${nis_clientflags}" != X"NO" ]; then
- echo -n ' ypbind'; ypbind ${nis_clientflags}
-fi
-
-echo -n ' inetd'; inetd
-echo '.'
-
diff --git a/etc/skey.access b/etc/skey.access
deleted file mode 100644
index ad0245f..0000000
--- a/etc/skey.access
+++ /dev/null
@@ -1,30 +0,0 @@
-# This file controls whether UNIX passwords are to be permitted. Rules
-# are matched in order, and the search terminates when the first matching
-# rule has been found.
-#
-# Each rule has the form:
-#
-# permit condition condition...
-# deny condition condition...
-#
-# Where "permit" or "deny" may be followed by zero or more conditions.
-#
-# A rule is matched when all conditions are satisfied. A rule without
-# conditions is always satisfied.
-#
-# Examples of conditions are:
-#
-# hostname wzv.win.tue.nl
-# internet 131.155.210.0 255.255.255.0
-# port ttya
-# user root
-# group wheel
-#
-# The old S/Key form (permit/deny netnumber netmask) is still supported.
-#
-#permit user uugiga # uucp login via modem or internet
-#permit port ttyb # local
-#permit port console # local
-#deny # anything else
-
-permit # permit plaintext passwords all the time
diff --git a/etc/userids b/etc/userids
deleted file mode 100644
index 3cda32f..0000000
--- a/etc/userids
+++ /dev/null
@@ -1 +0,0 @@
-515
diff --git a/games/x11/Makefile b/games/x11/Makefile
deleted file mode 100644
index 38183ec..0000000
--- a/games/x11/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# @(#)Makefile 8.2 (Berkeley) 3/31/94
-
-SUBDIR= xneko xroach
-
-.include <bsd.subdir.mk>
diff --git a/games/x11/xneko/Makefile b/games/x11/xneko/Makefile
deleted file mode 100644
index 2ca89ba..0000000
--- a/games/x11/xneko/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-
-PROG= xneko
-MAN6= xneko.6
-DPADD+= ${X11BASE}/lib/libX11.a ${LIBM}
-CFLAGS+= -I${X11BASE}/include
-LDDESTDIR+= -L${X11BASE}/lib
-LDADD+= -lX11 -lm
-
-.include "../../Makefile.inc"
-.include <bsd.prog.mk>
diff --git a/games/x11/xneko/xneko.c b/games/x11/xneko/xneko.c
deleted file mode 100644
index 7f6615e..0000000
--- a/games/x11/xneko/xneko.c
+++ /dev/null
@@ -1,1765 +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[] = "@(#)xneko.c 8.1 (Berkeley) 5/31/93";
-#endif /* not lint */
-
-/*--------------------------------------------------------------
- *
- * xneko - X11 G-
- *
- * Original Writer: Masayuki Koba
- * Programmed by Masayuki Koba, 1990
- *
- *--------------------------------------------------------------
- *
- *!!Introduction:
- *
- *!!!!K\@(#)xneko.c 8.1m%0%i%`$O Macintosh $N5/31/939%/%"%/%;%5%j!< "neko" $N
- *!!F0:n$r X11 $G%^%M$?$b$N$G$9!#
- *
- *!!!!Macintosh "neko" $N=(0o$J5/31/936%$%s$K7I0U$rI=$7$D$D!"$3$N
- *!!@(#)xneko.c 8.1m%0%i%`$r3'$5$s$KJ{$2$^$9!#
- *
- *--------------------------------------------------------------
- *
- *!!Special Thanks to
- *
- * toshi-w !D!!Macintosh neko $N>R2p<T
- * shio-m !D!!!VX11 $N neko $,M_$7$$!*!W$H%?%@$r$3$M$??M
- * disco !D!!X11 SCCS/s.xneko.c/%K%+%k!&%"8.1P%$%6!<
- *
- * HOMY !D!!/usr/src/games/xneko/SCCS/s.xneko.c0;XE&<T
- * BNS !D!!J#?t@(#)xneko.c 8.1l!<%sBP1~May 31, 1993C%ADs6!<T
- *
- * "xneko" Presented by Masayuki Koba (masa-k).
- *
- *--------------------------------------------------------------
- *
- *!!Manifest:
- *
- *!!!!K\@(#)xneko.c 8.1m%0%i%`$O Public Domain Software $G$9!#E>:\!&2~NI$O
- *!!<+M3$K9T$C$F2<$5$$!#
- *
- *!!!!$J$*!"86:n<T$O!"K\@(#)xneko.c 8.1m%0%i%`$r;HMQ$9$k$3$H$K$h$C$F@8$8$?
- *!!>c32$dITMx1W$K$D$$$F$$$C$5$$@UG$$r;}$A$^$;$s!#
- *
- *--------------------------------------------------------------
- *
- *!!Bugs:
- *
- *!!!!!J#1!KX11 $N .Xdefaults $N@_Dj$r$^$k$C$-$jL5;k$7$F$$$^$9!#
- *
- *!!!!!J#2!KG-$NF0:n$,;~4V$HF14|$7$F$$$k$?$a!"%^%&%9$N0\F0>pJs
- *!!!!!!!!$r%]!<%j%s%0$7$F$$$^$9!#=>$C$F!"%^%&%9$,A4$/F0:n$7$F
- *!!!!!!!!$$$J$$;~$OL5BL$J%^%&%9:BI8FI$_<h$j$r9T$C$F$7$^$$$^$9!#
- *
- *!!!!!J#3!K%&%#%s8.1&$,%"%$%3%s2=$5$l$F$b!"$7$i$s$W$j$GIA2h$7
- *!!!!!!!!$D$E$1$^$9!#$3$NItJ,$O!"8=:_$N%&%#%s8.1&$N>uBV$r@(#) xneko.c 8.1@(#)'
- *!!!!!!!!70/$7$F!"%"%$%3%s2=$5$l$F$$$k;~$O40A4$K%$s%HBT$A
- *!!!!!!!!$K$J$k$h$&$K=q$-JQ$($J$1$l$P$J$j$^$;$s!# ($=$s$J$3$H!"
- *!!!!!!!!$G$-$k$N$+$J$!!#X10 $G$O$G$-$^$7$?$,!#)
- *
- *!!!!!J#4!K%j%5%$%:8e$N%&%#%s8.1&$,6KC<$K>.$5$/$J$C$?;~$NF0:n
- *!!!!!!!!$OJ]>Z$G$-$^$;$s!#
- *
- *!!!!!J#5!KK\Mh$J$i$P3NJ]$7$?%&%#%s8.1&$d Pixmap $O@(#)xneko.c 8.1m%0%i%`
- *!!!!!!!!=*N;;~$K2rJ|$9$kI,MW$,$"$j$^$9$,!"K\@(#)xneko.c 8.1m%0%i%`$O$=$N
- *!!!!!!!!$X$s$r%5%\$C$F$*$j!"Hs>o$K$*9T57$,0-$/$J$C$F$$$^$9!#
- *!!!!!!!!IaDL$O exit() ;~$K%7%9SCCS/s.xneko.c`$,M>J,$J%j%=!<%9$r2rJ|$7$F
- *!!!!!!!!$/$l$^$9$,!"#O#S$K/usr/src/games/xneko/SCCS/s.xneko.c0$,$"$k>l9g$O xneko $r2?EY$b5/
- *!!!!!!!!F0$9$k$H!"$=$N$&$A%9%o82WNN0h$,ITB-$7$F$7$^$&$3$H$K
- *!!!!!!!!$J$k$+$b$7$l$^$;$s!#
- *
- *!!!!!J#6!K;~4V$KF14|$7$FI,$:IA2h=hM}$r<B9T$9$k$?$a!"0BDj>uBV
- *!!!!!!!!$G$b Idle 90 !A 95% $H$J$j!"%7%9SCCS/s.xneko.c`#C#P#U$r 5 !A 10%
- *!!!!!!!!Dx>CHq$7$^$9!#!Jxtachos $GD4$Y$^$7$?!#!K
- *
- *--------------------------------------------------------------
- *
- *!!System (Machine):
- *
- *!!!!K\@(#)xneko.c 8.1m%0%i%`$NF0:n$r3NG'$7$?%7%9SCCS/s.xneko.c`9=@.$O0J2<$NDL$j!#
- *
- * !&NWS-1750!"NWS-1720 (NEWS)!"NWP-512D
- * !!NEWS-OS 3.2a (UNIX 4.3BSD)!"X11 Release 2
- *
- * !&NWS-1750!"NWS-1720 (NEWS)!"NWP-512D
- * !!NEWS-OS 3.3 (UNIX 4.3BSD)!"X11 Release 3
- *
- * !&Sun 3!"X11 Release 4
- *
- * !&LUNA!"X11 Release 3
- *
- * !&DECstation 3100!"ULTRIX!"X11
- *
- *--------------------------------------------------------------*/
-
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/keysym.h>
-
-#include <stdio.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <signal.h>
-#include <math.h>
-#include <sys/time.h>
-
-
-#ifndef lint
-static char
- rcsid[] = "$Header: /home/ncvs/src/games/x11/xneko/xneko.c,v 1.2 1995/05/30 03:37:35 rgrimes Exp $";
-static char WriterMessage[] = "xneko: Programmed by Masayuki Koba, 1990";
-#endif
-
-
-/*
- * X11 G- 0C5/31/93^129W18:45:36!%$%k0lMw!'
- *
- * "icon.xbm" !D!!%"%$%3%s
- * "cursor.xbm" !D!!%+!<%=%k
- * "cursor_mask.xbm" !D!!%+!<%=%k!J%^%9%/!K
- *
- * "space.xbm" !D!!%9%Z!<%9
- *
- * "mati2.xbm" !D!!BT$A#2
- * "jare2.xbm" !D!!$8$c$l#2
- * "kaki1.xbm" !D!!A_$-#1
- * "kaki2.xbm" !D!!A_$-#2
- * "mati3.xbm" !D!!BT$A#3!J$"$/$S!K
- * "sleep1.xbm" !D!!?2$k#1
- * "sleep2.xbm" !D!!?2$k#2
- *
- * "awake.xbm" !D!!L\3P$a
- *
- * "up1.xbm" !D!!>e#1
- * "up2.xbm" !D!!>e#2
- * "down1.xbm" !D!!2<#1
- * "down2.xbm" !D!!2<#2
- * "left1.xbm" !D!!:8#1
- * "left2.xbm" !D!!:8#2
- * "right1.xbm" !D!!1&#1
- * "right2.xbm" !D!!1&#2
- * "upleft1.xbm" !D!!:8>e#1
- * "upleft2.xbm" !D!!:8>e#2
- * "upright1.xbm" !D!!1&>e#1
- * "upright2.xbm" !D!!1&>e#2
- * "dwleft1.xbm" !D!!:82<#1
- * "dwleft2.xbm" !D!!:82<#2
- * "dwright1.xbm" !D!!1&2<#1
- * "dwright2.xbm" !D!!1&2<#2
- *
- * "utogi1.xbm" !D!!>eKa$.#1
- * "utogi2.xbm" !D!!>eKa$.#2
- * "dtogi1.xbm" !D!!2<Ka$.#1
- * "dtogi2.xbm" !D!!2<Ka$.#2
- * "ltogi1.xbm" !D!!:8Ka$.#1
- * "ltogi2.xbm" !D!!:8Ka$.#2
- * "rtogi1.xbm" !D!!1&Ka$.#1
- * "rtogi2.xbm" !D!!1&Ka$.#2
- *
- * !!$3$l$i$N18:45:36!%$%k$O bitmap %3%^%s%I$GJT=82DG=$G$9!#
- *
- * (bitmap size "* 32x32 ... Macintosh ICON resource size.)
- *
- */
-
-
-#include "bitmaps/icon.xbm"
-#include "bitmaps/cursor.xbm"
-#include "bitmaps/cursor_mask.xbm"
-
-#include "bitmaps/space.xbm"
-
-#include "bitmaps/mati2.xbm"
-#include "bitmaps/jare2.xbm"
-#include "bitmaps/kaki1.xbm"
-#include "bitmaps/kaki2.xbm"
-#include "bitmaps/mati3.xbm"
-#include "bitmaps/sleep1.xbm"
-#include "bitmaps/sleep2.xbm"
-
-#include "bitmaps/awake.xbm"
-
-#include "bitmaps/up1.xbm"
-#include "bitmaps/up2.xbm"
-#include "bitmaps/down1.xbm"
-#include "bitmaps/down2.xbm"
-#include "bitmaps/left1.xbm"
-#include "bitmaps/left2.xbm"
-#include "bitmaps/right1.xbm"
-#include "bitmaps/right2.xbm"
-#include "bitmaps/upright1.xbm"
-#include "bitmaps/upright2.xbm"
-#include "bitmaps/upleft1.xbm"
-#include "bitmaps/upleft2.xbm"
-#include "bitmaps/dwleft1.xbm"
-#include "bitmaps/dwleft2.xbm"
-#include "bitmaps/dwright1.xbm"
-#include "bitmaps/dwright2.xbm"
-
-#include "bitmaps/utogi1.xbm"
-#include "bitmaps/utogi2.xbm"
-#include "bitmaps/dtogi1.xbm"
-#include "bitmaps/dtogi2.xbm"
-#include "bitmaps/ltogi1.xbm"
-#include "bitmaps/ltogi2.xbm"
-#include "bitmaps/rtogi1.xbm"
-#include "bitmaps/rtogi2.xbm"
-
-
-/*
- * Dj?tDj5A
- */
-
-#define BITMAP_WIDTH 32 /* #1%-%c%i%/%?$NI} (18:45:53/%;%k) */
-#define BITMAP_HEIGHT 32 /* #1%-%c%i%/%?$N9b$5 (18:45:53/%;%k) */
-
-#define WINDOW_WIDTH 320 /* %&%#%s8.1&$NI} (18:45:53/%;%k) */
-#define WINDOW_HEIGHT 256 /* %&%#%s8.1&$N9b$5 (18:45:53/%;%k) */
-
-#define DEFAULT_BORDER 2 /* %\!<%@!<%5%$%: */
-
-#define DEFAULT_WIN_X 1 /* %&%#%s8.1&@8@.#X:BI8 */
-#define DEFAULT_WIN_Y 1 /* %&%#%s8.1&@8@.#Y:BI8 */
-
-#define AVAIL_KEYBUF 255
-
-#define EVENT_MASK1 ( KeyPressMask | StructureNotifyMask )
-
-#define EVENT_MASK2 ( KeyPressMask | \
- ExposureMask | \
- StructureNotifyMask )
-
-#define MAX_TICK 9999 /* Odd Only! */
-
-#define INTERVAL 125000L /* %$%s%?!</usr/src/games/xneko/SCCS/s.xneko.ck%?%$%` */
-
-#define NEKO_SPEED 16
-
-#define IDLE_SPACE 6
-
-#define NORMAL_STATE 1
-#define DEBUG_LIST 2
-#define DEBUG_MOVE 3
-
-/* G-$N>uBVDj?t */
-
-#define NEKO_STOP 0 /* N)$A;_$^$C$? */
-#define NEKO_JARE 1 /* 4i$r@v$C$F$$$k */
-#define NEKO_KAKI 2 /* F,$rA_$$$F$$$k */
-#define NEKO_AKUBI 3 /* $"$/$S$r$7$F$$$k */
-#define NEKO_SLEEP 4 /* ?2$F$7$^$C$? */
-#define NEKO_AWAKE 5 /* L\$,3P$a$? */
-#define NEKO_U_MOVE 6 /* >e$K0\F0Cf */
-#define NEKO_D_MOVE 7 /* 2<$K0\F0Cf */
-#define NEKO_L_MOVE 8 /* :8$K0\F0Cf */
-#define NEKO_R_MOVE 9 /* 1&$K0\F0Cf */
-#define NEKO_UL_MOVE 10 /* :8>e$K0\F0Cf */
-#define NEKO_UR_MOVE 11 /* 1&>e$K0\F0Cf */
-#define NEKO_DL_MOVE 12 /* :82<$K0\F0Cf */
-#define NEKO_DR_MOVE 13 /* 1&2<$K0\F0Cf */
-#define NEKO_U_TOGI 14 /* >e$NJI$r0z$CA_$$$F$$$k */
-#define NEKO_D_TOGI 15 /* 2<$NJI$r0z$CA_$$$F$$$k */
-#define NEKO_L_TOGI 16 /* :8$NJI$r0z$CA_$$$F$$$k */
-#define NEKO_R_TOGI 17 /* 1&$NJI$r0z$CA_$$$F$$$k */
-
-/* G-$N%"%K%a!<%7%g%s7+$jJV$72s?t */
-
-#define NEKO_STOP_TIME 4
-#define NEKO_JARE_TIME 10
-#define NEKO_KAKI_TIME 4
-#define NEKO_AKUBI_TIME 3
-#define NEKO_AWAKE_TIME 3
-#define NEKO_TOGI_TIME 10
-
-#define PI_PER8 ((double)3.1415926535/(double)8)
-
-#define DIRNAMELEN 255
-
-
-/*
- * %0%m!</usr/src/games/xneko/SCCS/s.xneko.ckJQ?t
- */
-
-static char *ProgramName; /* %3%^%s%IL>>N */
-
-Display *theDisplay;
-int theScreen;
-unsigned int theDepth;
-unsigned long theBlackPixel;
-unsigned long theWhitePixel;
-Window theWindow;
-Cursor theCursor;
-
-static unsigned int WindowWidth;
-static unsigned int WindowHeight;
-
-static int WindowPointX;
-static int WindowPointY;
-
-static unsigned int BorderWidth = DEFAULT_BORDER;
-
-long IntervalTime = INTERVAL;
-
-int EventState; /* %$s%H=hM}MQ >uBVJQ?t */
-
-int NekoTickCount; /* G-F0:n%+%&%s%? */
-int NekoStateCount; /* G-F10l>uBV%+%&%s%? */
-int NekoState; /* G-$N>uBV */
-
-int MouseX; /* %^%&%9#X:BI8 */
-int MouseY; /* %^%&%9#Y:BI8 */
-
-int PrevMouseX = 0; /* D>A0$N%^%&%9#X:BI8 */
-int PrevMouseY = 0; /* D>A0$N%^%&%9#Y:BI8 */
-
-int NekoX; /* G-#X:BI8 */
-int NekoY; /* G-#Y:BI8 */
-
-int NekoMoveDx; /* G-0\F05wN%#X */
-int NekoMoveDy; /* G-0\F05wN%#Y */
-
-int NekoLastX; /* G-:G=*IA2h#X:BI8 */
-int NekoLastY; /* G-:G=*IA2h#Y:BI8 */
-GC NekoLastGC; /* G-:G=*IA2h GC */
-
-double NekoSpeed = (double)NEKO_SPEED;
-
-double SinPiPer8Times3; /* sin( #3&P!?#8 ) */
-double SinPiPer8; /* sin( &P!?#8 ) */
-
-Pixmap SpaceXbm;
-
-Pixmap Mati2Xbm;
-Pixmap Jare2Xbm;
-Pixmap Kaki1Xbm;
-Pixmap Kaki2Xbm;
-Pixmap Mati3Xbm;
-Pixmap Sleep1Xbm;
-Pixmap Sleep2Xbm;
-
-Pixmap AwakeXbm;
-
-Pixmap Up1Xbm;
-Pixmap Up2Xbm;
-Pixmap Down1Xbm;
-Pixmap Down2Xbm;
-Pixmap Left1Xbm;
-Pixmap Left2Xbm;
-Pixmap Right1Xbm;
-Pixmap Right2Xbm;
-Pixmap UpLeft1Xbm;
-Pixmap UpLeft2Xbm;
-Pixmap UpRight1Xbm;
-Pixmap UpRight2Xbm;
-Pixmap DownLeft1Xbm;
-Pixmap DownLeft2Xbm;
-Pixmap DownRight1Xbm;
-Pixmap DownRight2Xbm;
-
-Pixmap UpTogi1Xbm;
-Pixmap UpTogi2Xbm;
-Pixmap DownTogi1Xbm;
-Pixmap DownTogi2Xbm;
-Pixmap LeftTogi1Xbm;
-Pixmap LeftTogi2Xbm;
-Pixmap RightTogi1Xbm;
-Pixmap RightTogi2Xbm;
-
-GC SpaceGC;
-
-GC Mati2GC;
-GC Jare2GC;
-GC Kaki1GC;
-GC Kaki2GC;
-GC Mati3GC;
-GC Sleep1GC;
-GC Sleep2GC;
-
-GC AwakeGC;
-
-GC Up1GC;
-GC Up2GC;
-GC Down1GC;
-GC Down2GC;
-GC Left1GC;
-GC Left2GC;
-GC Right1GC;
-GC Right2GC;
-GC UpLeft1GC;
-GC UpLeft2GC;
-GC UpRight1GC;
-GC UpRight2GC;
-GC DownLeft1GC;
-GC DownLeft2GC;
-GC DownRight1GC;
-GC DownRight2GC;
-
-GC UpTogi1GC;
-GC UpTogi2GC;
-GC DownTogi1GC;
-GC DownTogi2GC;
-GC LeftTogi1GC;
-GC LeftTogi2GC;
-GC RightTogi1GC;
-GC RightTogi2GC;
-
-typedef struct {
- GC *GCCreatePtr;
- Pixmap *BitmapCreatePtr;
- char *PixelPattern;
- unsigned int PixelWidth;
- unsigned int PixelHeight;
-} BitmapGCData;
-
-BitmapGCData BitmapGCDataTable[] =
-{
- { &SpaceGC, &SpaceXbm, space_bits, space_width, space_height },
- { &Mati2GC, &Mati2Xbm, mati2_bits, mati2_width, mati2_height },
- { &Jare2GC, &Jare2Xbm, jare2_bits, jare2_width, jare2_height },
- { &Kaki1GC, &Kaki1Xbm, kaki1_bits, kaki1_width, kaki1_height },
- { &Kaki2GC, &Kaki2Xbm, kaki2_bits, kaki2_width, kaki2_height },
- { &Mati3GC, &Mati3Xbm, mati3_bits, mati3_width, mati3_height },
- { &Sleep1GC, &Sleep1Xbm, sleep1_bits, sleep1_width, sleep1_height },
- { &Sleep2GC, &Sleep2Xbm, sleep2_bits, sleep2_width, sleep2_height },
- { &AwakeGC, &AwakeXbm, awake_bits, awake_width, awake_height },
- { &Up1GC, &Up1Xbm, up1_bits, up1_width, up1_height },
- { &Up2GC, &Up2Xbm, up2_bits, up2_width, up2_height },
- { &Down1GC, &Down1Xbm, down1_bits, down1_width, down1_height },
- { &Down2GC, &Down2Xbm, down2_bits, down2_width, down2_height },
- { &Left1GC, &Left1Xbm, left1_bits, left1_width, left1_height },
- { &Left2GC, &Left2Xbm, left2_bits, left2_width, left2_height },
- { &Right1GC, &Right1Xbm, right1_bits, right1_width, right1_height },
- { &Right2GC, &Right2Xbm, right2_bits, right2_width, right2_height },
- { &UpLeft1GC, &UpLeft1Xbm, upleft1_bits, upleft1_width, upleft1_height },
- { &UpLeft2GC, &UpLeft2Xbm, upleft2_bits, upleft2_width, upleft2_height },
- { &UpRight1GC,
- &UpRight1Xbm, upright1_bits, upright1_width, upright1_height },
- { &UpRight2GC,
- &UpRight2Xbm, upright2_bits, upright2_width, upright2_height },
- { &DownLeft1GC,
- &DownLeft1Xbm, dwleft1_bits, dwleft1_width, dwleft1_height },
- { &DownLeft2GC,
- &DownLeft2Xbm, dwleft2_bits, dwleft2_width, dwleft2_height },
- { &DownRight1GC,
- &DownRight1Xbm, dwright1_bits, dwright1_width, dwright1_height },
- { &DownRight2GC,
- &DownRight2Xbm, dwright2_bits, dwright2_width, dwright2_height },
- { &UpTogi1GC, &UpTogi1Xbm, utogi1_bits, utogi1_width, utogi1_height },
- { &UpTogi2GC, &UpTogi2Xbm, utogi2_bits, utogi2_width, utogi2_height },
- { &DownTogi1GC, &DownTogi1Xbm, dtogi1_bits, dtogi1_width, dtogi1_height },
- { &DownTogi2GC, &DownTogi2Xbm, dtogi2_bits, dtogi2_width, dtogi2_height },
- { &LeftTogi1GC, &LeftTogi1Xbm, ltogi1_bits, ltogi1_width, ltogi1_height },
- { &LeftTogi2GC, &LeftTogi2Xbm, ltogi2_bits, ltogi2_width, ltogi2_height },
- { &RightTogi1GC,
- &RightTogi1Xbm, rtogi1_bits, rtogi1_width, rtogi1_height },
- { &RightTogi2GC,
- &RightTogi2Xbm, rtogi2_bits, rtogi2_width, rtogi2_height },
- { NULL, NULL, NULL, NULL, NULL }
-};
-
-typedef struct {
- GC *TickEvenGCPtr;
- GC *TickOddGCPtr;
-} Animation;
-
-Animation AnimationPattern[] =
-{
- { &Mati2GC, &Mati2GC }, /* NekoState == NEKO_STOP */
- { &Jare2GC, &Mati2GC }, /* NekoState == NEKO_JARE */
- { &Kaki1GC, &Kaki2GC }, /* NekoState == NEKO_KAKI */
- { &Mati3GC, &Mati3GC }, /* NekoState == NEKO_AKUBI */
- { &Sleep1GC, &Sleep2GC }, /* NekoState == NEKO_SLEEP */
- { &AwakeGC, &AwakeGC }, /* NekoState == NEKO_AWAKE */
- { &Up1GC, &Up2GC } , /* NekoState == NEKO_U_MOVE */
- { &Down1GC, &Down2GC }, /* NekoState == NEKO_D_MOVE */
- { &Left1GC, &Left2GC }, /* NekoState == NEKO_L_MOVE */
- { &Right1GC, &Right2GC }, /* NekoState == NEKO_R_MOVE */
- { &UpLeft1GC, &UpLeft2GC }, /* NekoState == NEKO_UL_MOVE */
- { &UpRight1GC, &UpRight2GC }, /* NekoState == NEKO_UR_MOVE */
- { &DownLeft1GC, &DownLeft2GC }, /* NekoState == NEKO_DL_MOVE */
- { &DownRight1GC, &DownRight2GC }, /* NekoState == NEKO_DR_MOVE */
- { &UpTogi1GC, &UpTogi2GC }, /* NekoState == NEKO_U_TOGI */
- { &DownTogi1GC, &DownTogi2GC }, /* NekoState == NEKO_D_TOGI */
- { &LeftTogi1GC, &LeftTogi2GC }, /* NekoState == NEKO_L_TOGI */
- { &RightTogi1GC, &RightTogi2GC }, /* NekoState == NEKO_R_TOGI */
-};
-
-
-/*--------------------------------------------------------------
- *
- * 0C5/31/93^504W%G!<%?!&GC =i4|2=
- *
- *--------------------------------------------------------------*/
-
-void
-InitBitmapAndGCs()
-{
- BitmapGCData *BitmapGCDataTablePtr;
- XGCValues theGCValues;
-
- theGCValues.function = GXcopy;
- theGCValues.foreground = BlackPixel( theDisplay, theScreen );
- theGCValues.background = WhitePixel( theDisplay, theScreen );
- theGCValues.fill_style = FillTiled;
-
- for ( BitmapGCDataTablePtr = BitmapGCDataTable;
- BitmapGCDataTablePtr->GCCreatePtr != NULL;
- BitmapGCDataTablePtr++ ) {
-
- *(BitmapGCDataTablePtr->BitmapCreatePtr)
- = XCreatePixmapFromBitmapData(
- theDisplay,
- RootWindow( theDisplay, theScreen ),
- BitmapGCDataTablePtr->PixelPattern,
- BitmapGCDataTablePtr->PixelWidth,
- BitmapGCDataTablePtr->PixelHeight,
- BlackPixel( theDisplay, theScreen ),
- WhitePixel( theDisplay, theScreen ),
- DefaultDepth( theDisplay, theScreen ) );
-
- theGCValues.tile = *(BitmapGCDataTablePtr->BitmapCreatePtr);
-
- *(BitmapGCDataTablePtr->GCCreatePtr)
- = XCreateGC( theDisplay, theWindow,
- GCFunction | GCForeground | GCBackground |
- GCTile | GCFillStyle,
- &theGCValues );
- }
-
- XFlush( theDisplay );
-}
-
-
-/*--------------------------------------------------------------
- *
- * %9%/%j!<%s4D6-=i4|2=
- *
- *--------------------------------------------------------------*/
-
-void
-InitScreen( DisplayName, theGeometry, TitleName, iconicState )
- char *DisplayName;
- char *theGeometry;
- char *TitleName;
- Bool iconicState;
-{
- int GeometryStatus;
- XSetWindowAttributes theWindowAttributes;
- XSizeHints theSizeHints;
- unsigned long theWindowMask;
- Pixmap theIconPixmap;
- Pixmap theCursorSource;
- Pixmap theCursorMask;
- XWMHints theWMHints;
- Window theRoot;
- Colormap theColormap;
- XColor theWhiteColor, theBlackColor, theExactColor;
-
- if ( ( theDisplay = XOpenDisplay( DisplayName ) ) == NULL ) {
- fprintf( stderr, "%s: Can't open display", ProgramName );
- if ( DisplayName != NULL ) {
- fprintf( stderr, " %s.\n", DisplayName );
- } else {
- fprintf( stderr, ".\n" );
- }
- exit( 1 );
- }
-
- theScreen = DefaultScreen( theDisplay );
- theDepth = DefaultDepth( theDisplay, theScreen );
-
- theBlackPixel = BlackPixel( theDisplay, theScreen );
- theWhitePixel = WhitePixel( theDisplay, theScreen );
-
- GeometryStatus = XParseGeometry( theGeometry,
- &WindowPointX, &WindowPointY,
- &WindowWidth, &WindowHeight );
-
- if ( !( GeometryStatus & XValue ) ) {
- WindowPointX = DEFAULT_WIN_X;
- }
- if ( !( GeometryStatus & YValue ) ) {
- WindowPointY = DEFAULT_WIN_Y;
- }
- if ( !( GeometryStatus & WidthValue ) ) {
- WindowWidth = WINDOW_WIDTH;
- }
- if ( !( GeometryStatus & HeightValue ) ) {
- WindowHeight = WINDOW_HEIGHT;
- }
-
- theCursorSource
- = XCreateBitmapFromData( theDisplay,
- RootWindow( theDisplay, theScreen ),
- cursor_bits,
- cursor_width,
- cursor_height );
-
- theCursorMask
- = XCreateBitmapFromData( theDisplay,
- RootWindow( theDisplay, theScreen ),
- cursor_mask_bits,
- cursor_mask_width,
- cursor_mask_height );
-
- theColormap = DefaultColormap( theDisplay, theScreen );
-
- if ( !XAllocNamedColor( theDisplay, theColormap,
- "white", &theWhiteColor, &theExactColor ) ) {
- fprintf( stderr,
- "%s: Can't XAllocNamedColor( \"white\" ).\n", ProgramName );
- exit( 1 );
- }
-
- if ( !XAllocNamedColor( theDisplay, theColormap,
- "black", &theBlackColor, &theExactColor ) ) {
- fprintf( stderr,
- "%s: Can't XAllocNamedColor( \"black\" ).\n", ProgramName );
- exit( 1 );
- }
-
- theCursor = XCreatePixmapCursor( theDisplay,
- theCursorSource, theCursorMask,
- &theBlackColor, &theWhiteColor,
- cursor_x_hot, cursor_y_hot );
-
- theWindowAttributes.border_pixel = theBlackPixel;
- theWindowAttributes.background_pixel = theWhitePixel;
- theWindowAttributes.cursor = theCursor;
- theWindowAttributes.override_redirect = False;
-
- theWindowMask = CWBackPixel |
- CWBorderPixel |
- CWCursor |
- CWOverrideRedirect;
-
- theWindow = XCreateWindow( theDisplay,
- RootWindow( theDisplay, theScreen ),
- WindowPointX, WindowPointY,
- WindowWidth, WindowHeight,
- BorderWidth,
- theDepth,
- InputOutput,
- CopyFromParent,
- theWindowMask,
- &theWindowAttributes );
-
- theIconPixmap = XCreateBitmapFromData( theDisplay, theWindow,
- icon_bits,
- icon_width,
- icon_height );
-
- theWMHints.icon_pixmap = theIconPixmap;
- if ( iconicState ) {
- theWMHints.initial_state = IconicState;
- } else {
- theWMHints.initial_state = NormalState;
- }
- theWMHints.flags = IconPixmapHint | StateHint;
-
- XSetWMHints( theDisplay, theWindow, &theWMHints );
-
- theSizeHints.flags = PPosition | PSize;
- theSizeHints.x = WindowPointX;
- theSizeHints.y = WindowPointY;
- theSizeHints.width = WindowWidth;
- theSizeHints.height = WindowHeight;
-
- XSetNormalHints( theDisplay, theWindow, &theSizeHints );
-
- if ( strlen( TitleName ) >= 1 ) {
- XStoreName( theDisplay, theWindow, TitleName );
- XSetIconName( theDisplay, theWindow, TitleName );
- } else {
- XStoreName( theDisplay, theWindow, ProgramName );
- XSetIconName( theDisplay, theWindow, ProgramName );
- }
-
- XMapWindow( theDisplay, theWindow );
-
- XFlush( theDisplay );
-
- XGetGeometry( theDisplay, theWindow,
- &theRoot,
- &WindowPointX, &WindowPointY,
- &WindowWidth, &WindowHeight,
- &BorderWidth, &theDepth );
-
- InitBitmapAndGCs();
-
- XSelectInput( theDisplay, theWindow, EVENT_MASK1 );
-
- XFlush( theDisplay );
-}
-
-
-/*--------------------------------------------------------------
- *
- * %$%s%?!</usr/src/games/xneko/SCCS/s.xneko.ck
- *
- * !!$3$N4X?t$r8F$V$H!"$"$k0lDj$N;~4VJV$C$F$3$J$/$J$k!#G-
- * $NF0:n%?%$%_%s%0D4@0$KMxMQ$9$k$3$H!#
- *
- *--------------------------------------------------------------*/
-
-void
-Interval()
-{
- pause();
-}
-
-
-/*--------------------------------------------------------------
- *
- * SCCS/s.xneko.c#728/%+%&%s%H=hM}
- *
- *--------------------------------------------------------------*/
-
-void
-TickCount()
-{
- if ( ++NekoTickCount >= MAX_TICK ) {
- NekoTickCount = 0;
- }
-
- if ( NekoTickCount % 2 == 0 ) {
- if ( NekoStateCount < MAX_TICK ) {
- NekoStateCount++;
- }
- }
-}
-
-
-/*--------------------------------------------------------------
- *
- * G->uBV@_Dj
- *
- *--------------------------------------------------------------*/
-
-void
-SetNekoState( SetValue )
- int SetValue;
-{
- NekoTickCount = 0;
- NekoStateCount = 0;
-
- NekoState = SetValue;
-
-#ifdef DEBUG
- switch ( NekoState ) {
- case NEKO_STOP:
- case NEKO_JARE:
- case NEKO_KAKI:
- case NEKO_AKUBI:
- case NEKO_SLEEP:
- case NEKO_U_TOGI:
- case NEKO_D_TOGI:
- case NEKO_L_TOGI:
- case NEKO_R_TOGI:
- NekoMoveDx = NekoMoveDy = 0;
- break;
- default:
- break;
- }
-#endif
-}
-
-
-/*--------------------------------------------------------------
- *
- * G-IA2h=hM}
- *
- *--------------------------------------------------------------*/
-
-void
-DrawNeko( x, y, DrawGC )
- int x;
- int y;
- GC DrawGC;
-{
- if ( ( x != NekoLastX || y != NekoLastY )
- && ( EventState != DEBUG_LIST ) ) {
- XFillRectangle( theDisplay, theWindow, SpaceGC,
- NekoLastX, NekoLastY,
- BITMAP_WIDTH, BITMAP_HEIGHT );
- }
-
- XSetTSOrigin( theDisplay, DrawGC, x, y );
-
- XFillRectangle( theDisplay, theWindow, DrawGC,
- x, y, BITMAP_WIDTH, BITMAP_HEIGHT );
-
- XFlush( theDisplay );
-
- NekoLastX = x;
- NekoLastY = y;
-
- NekoLastGC = DrawGC;
-}
-
-
-/*--------------------------------------------------------------
- *
- * G-:FIA2h=hM}
- *
- *--------------------------------------------------------------*/
-
-void
-RedrawNeko()
-{
- XFillRectangle( theDisplay, theWindow, NekoLastGC,
- NekoLastX, NekoLastY,
- BITMAP_WIDTH, BITMAP_HEIGHT );
-
- XFlush( theDisplay );
-}
-
-
-/*--------------------------------------------------------------
- *
- * G-0\F0J}K!7hDj
- *
- *--------------------------------------------------------------*/
-
-void
-NekoDirection()
-{
- int NewState;
- double LargeX, LargeY;
- double Length;
- double SinTheta;
-
- if ( NekoMoveDx == 0 && NekoMoveDy == 0 ) {
- NewState = NEKO_STOP;
- } else {
- LargeX = (double)NekoMoveDx;
- LargeY = (double)(-NekoMoveDy);
- Length = sqrt( LargeX * LargeX + LargeY * LargeY );
- SinTheta = LargeY / Length;
-
- if ( NekoMoveDx > 0 ) {
- if ( SinTheta > SinPiPer8Times3 ) {
- NewState = NEKO_U_MOVE;
- } else if ( ( SinTheta <= SinPiPer8Times3 )
- && ( SinTheta > SinPiPer8 ) ) {
- NewState = NEKO_UR_MOVE;
- } else if ( ( SinTheta <= SinPiPer8 )
- && ( SinTheta > -( SinPiPer8 ) ) ) {
- NewState = NEKO_R_MOVE;
- } else if ( ( SinTheta <= -( SinPiPer8 ) )
- && ( SinTheta > -( SinPiPer8Times3 ) ) ) {
- NewState = NEKO_DR_MOVE;
- } else {
- NewState = NEKO_D_MOVE;
- }
- } else {
- if ( SinTheta > SinPiPer8Times3 ) {
- NewState = NEKO_U_MOVE;
- } else if ( ( SinTheta <= SinPiPer8Times3 )
- && ( SinTheta > SinPiPer8 ) ) {
- NewState = NEKO_UL_MOVE;
- } else if ( ( SinTheta <= SinPiPer8 )
- && ( SinTheta > -( SinPiPer8 ) ) ) {
- NewState = NEKO_L_MOVE;
- } else if ( ( SinTheta <= -( SinPiPer8 ) )
- && ( SinTheta > -( SinPiPer8Times3 ) ) ) {
- NewState = NEKO_DL_MOVE;
- } else {
- NewState = NEKO_D_MOVE;
- }
- }
- }
-
- if ( NekoState != NewState ) {
- SetNekoState( NewState );
- }
-}
-
-
-/*--------------------------------------------------------------
- *
- * G-JI$V$D$+$jH=Dj
- *
- *--------------------------------------------------------------*/
-
-Bool
-IsWindowOver()
-{
- Bool ReturnValue = False;
-
- if ( NekoY <= 0 ) {
- NekoY = 0;
- ReturnValue = True;
- } else if ( NekoY >= WindowHeight - BITMAP_HEIGHT ) {
- NekoY = WindowHeight - BITMAP_HEIGHT;
- ReturnValue = True;
- }
- if ( NekoX <= 0 ) {
- NekoX = 0;
- ReturnValue = True;
- } else if ( NekoX >= WindowWidth - BITMAP_WIDTH ) {
- NekoX = WindowWidth - BITMAP_WIDTH;
- ReturnValue = True;
- }
-
- return( ReturnValue );
-}
-
-
-/*--------------------------------------------------------------
- *
- * G-0\F0>u67H=Dj
- *
- *--------------------------------------------------------------*/
-
-Bool
-IsNekoDontMove()
-{
- if ( NekoX == NekoLastX && NekoY == NekoLastY ) {
- return( True );
- } else {
- return( False );
- }
-}
-
-
-/*--------------------------------------------------------------
- *
- * G-0\F03+;OH=Dj
- *
- *--------------------------------------------------------------*/
-
-Bool
-IsNekoMoveStart()
-{
-#ifndef DEBUG
- if ( ( PrevMouseX >= MouseX - IDLE_SPACE
- && PrevMouseX <= MouseX + IDLE_SPACE ) &&
- ( PrevMouseY >= MouseY - IDLE_SPACE
- && PrevMouseY <= MouseY + IDLE_SPACE ) ) {
- return( False );
- } else {
- return( True );
- }
-#else
- if ( NekoMoveDx == 0 && NekoMoveDy == 0 ) {
- return( False );
- } else {
- return( True );
- }
-#endif
-}
-
-
-/*--------------------------------------------------------------
- *
- * G-0\F0 dx, dy 7W;;
- *
- *--------------------------------------------------------------*/
-
-void
-CalcDxDy()
-{
- Window QueryRoot, QueryChild;
- int AbsoluteX, AbsoluteY;
- int RelativeX, RelativeY;
- unsigned int ModKeyMask;
- double LargeX, LargeY;
- double DoubleLength, Length;
-
- XQueryPointer( theDisplay, theWindow,
- &QueryRoot, &QueryChild,
- &AbsoluteX, &AbsoluteY,
- &RelativeX, &RelativeY,
- &ModKeyMask );
-
- PrevMouseX = MouseX;
- PrevMouseY = MouseY;
-
- MouseX = RelativeX;
- MouseY = RelativeY;
-
- LargeX = (double)( MouseX - NekoX - BITMAP_WIDTH / 2 );
- LargeY = (double)( MouseY - NekoY - BITMAP_HEIGHT );
-
- DoubleLength = LargeX * LargeX + LargeY * LargeY;
-
- if ( DoubleLength != (double)0 ) {
- Length = sqrt( DoubleLength );
- if ( Length <= NekoSpeed ) {
- NekoMoveDx = (int)LargeX;
- NekoMoveDy = (int)LargeY;
- } else {
- NekoMoveDx = (int)( ( NekoSpeed * LargeX ) / Length );
- NekoMoveDy = (int)( ( NekoSpeed * LargeY ) / Length );
- }
- } else {
- NekoMoveDx = NekoMoveDy = 0;
- }
-}
-
-
-/*--------------------------------------------------------------
- *
- * F0:n2r@OG-IA2h=hM}
- *
- *--------------------------------------------------------------*/
-
-void
-NekoThinkDraw()
-{
-#ifndef DEBUG
- CalcDxDy();
-#endif
-
- if ( NekoState != NEKO_SLEEP ) {
- DrawNeko( NekoX, NekoY,
- NekoTickCount % 2 == 0 ?
- *(AnimationPattern[ NekoState ].TickEvenGCPtr) :
- *(AnimationPattern[ NekoState ].TickOddGCPtr) );
- } else {
- DrawNeko( NekoX, NekoY,
- NekoTickCount % 8 <= 3 ?
- *(AnimationPattern[ NekoState ].TickEvenGCPtr) :
- *(AnimationPattern[ NekoState ].TickOddGCPtr) );
- }
-
- TickCount();
-
- switch ( NekoState ) {
- case NEKO_STOP:
- if ( IsNekoMoveStart() ) {
- SetNekoState( NEKO_AWAKE );
- break;
- }
- if ( NekoStateCount < NEKO_STOP_TIME ) {
- break;
- }
- if ( NekoMoveDx < 0 && NekoX <= 0 ) {
- SetNekoState( NEKO_L_TOGI );
- } else if ( NekoMoveDx > 0 && NekoX >= WindowWidth - BITMAP_WIDTH ) {
- SetNekoState( NEKO_R_TOGI );
- } else if ( NekoMoveDy < 0 && NekoY <= 0 ) {
- SetNekoState( NEKO_U_TOGI );
- } else if ( NekoMoveDy > 0 && NekoY >= WindowHeight - BITMAP_HEIGHT ) {
- SetNekoState( NEKO_D_TOGI );
- } else {
- SetNekoState( NEKO_JARE );
- }
- break;
- case NEKO_JARE:
- if ( IsNekoMoveStart() ) {
- SetNekoState( NEKO_AWAKE );
- break;
- }
- if ( NekoStateCount < NEKO_JARE_TIME ) {
- break;
- }
- SetNekoState( NEKO_KAKI );
- break;
- case NEKO_KAKI:
- if ( IsNekoMoveStart() ) {
- SetNekoState( NEKO_AWAKE );
- break;
- }
- if ( NekoStateCount < NEKO_KAKI_TIME ) {
- break;
- }
- SetNekoState( NEKO_AKUBI );
- break;
- case NEKO_AKUBI:
- if ( IsNekoMoveStart() ) {
- SetNekoState( NEKO_AWAKE );
- break;
- }
- if ( NekoStateCount < NEKO_AKUBI_TIME ) {
- break;
- }
- SetNekoState( NEKO_SLEEP );
- break;
- case NEKO_SLEEP:
- if ( IsNekoMoveStart() ) {
- SetNekoState( NEKO_AWAKE );
- break;
- }
- break;
- case NEKO_AWAKE:
- if ( NekoStateCount < NEKO_AWAKE_TIME ) {
- break;
- }
- NekoDirection(); /* G-$,F0$/8~$-$r5a$a$k */
- break;
- case NEKO_U_MOVE:
- case NEKO_D_MOVE:
- case NEKO_L_MOVE:
- case NEKO_R_MOVE:
- case NEKO_UL_MOVE:
- case NEKO_UR_MOVE:
- case NEKO_DL_MOVE:
- case NEKO_DR_MOVE:
- NekoX += NekoMoveDx;
- NekoY += NekoMoveDy;
- NekoDirection();
- if ( IsWindowOver() ) {
- if ( IsNekoDontMove() ) {
- SetNekoState( NEKO_STOP );
- }
- }
- break;
- case NEKO_U_TOGI:
- case NEKO_D_TOGI:
- case NEKO_L_TOGI:
- case NEKO_R_TOGI:
- if ( IsNekoMoveStart() ) {
- SetNekoState( NEKO_AWAKE );
- break;
- }
- if ( NekoStateCount < NEKO_TOGI_TIME ) {
- break;
- }
- SetNekoState( NEKO_KAKI );
- break;
- default:
- /* Internal Error */
- SetNekoState( NEKO_STOP );
- break;
- }
-
- Interval();
-}
-
-
-#ifdef DEBUG
-
-/*--------------------------------------------------------------
- *
- * %-%c%i%/%?!<0lMwI=<(!J5/31/93P11500MQ!K
- *
- *--------------------------------------------------------------*/
-
-void
-DisplayCharacters()
-{
- int Index;
- int x, y;
-
- for ( Index = 0, x = 0, y = 0;
- BitmapGCDataTable[ Index ].GCCreatePtr != NULL; Index++ ) {
-
- DrawNeko( x, y, *(BitmapGCDataTable[ Index ].GCCreatePtr) );
- XFlush( theDisplay );
-
- x += BITMAP_WIDTH;
-
- if ( x > WindowWidth - BITMAP_WIDTH ) {
- x = 0;
- y += BITMAP_HEIGHT;
- if ( y > WindowHeight - BITMAP_HEIGHT) {
- break;
- }
- }
- }
-}
-
-#endif /* DEBUG */
-
-
-/*--------------------------------------------------------------
- *
- * %-!<%$s%H=hM}
- *
- *--------------------------------------------------------------*/
-
-Bool
-ProcessKeyPress( theKeyEvent )
- XKeyEvent *theKeyEvent;
-{
- int Length;
- int theKeyBufferMaxLen = AVAIL_KEYBUF;
- char theKeyBuffer[ AVAIL_KEYBUF + 1 ];
- KeySym theKeySym;
- XComposeStatus theComposeStatus;
- Bool ReturnState;
-
- ReturnState = True;
-
- Length = XLookupString( theKeyEvent,
- theKeyBuffer, theKeyBufferMaxLen,
- &theKeySym, &theComposeStatus );
-
- if ( Length > 0 ) {
- switch ( theKeyBuffer[ 0 ] ) {
- case 'q':
- case 'Q':
- if ( theKeyEvent->state & Mod1Mask ) { /* META (Alt) %-!< */
- ReturnState = False;
- }
- break;
- default:
- break;
- }
- }
-
-#ifdef DEBUG
- if ( EventState == DEBUG_MOVE ) {
- switch ( theKeySym ) {
- case XK_KP_1:
- NekoMoveDx = -(int)( NekoSpeed / sqrt( (double)2 ) );
- NekoMoveDy = -NekoMoveDx;
- break;
- case XK_KP_2:
- NekoMoveDx = 0;
- NekoMoveDy = (int)NekoSpeed;
- break;
- case XK_KP_3:
- NekoMoveDx = (int)( NekoSpeed / sqrt( (double)2 ) );
- NekoMoveDy = NekoMoveDx;
- break;
- case XK_KP_4:
- NekoMoveDx = -(int)NekoSpeed;
- NekoMoveDy = 0;
- break;
- case XK_KP_5:
- NekoMoveDx = 0;
- NekoMoveDy = 0;
- break;
- case XK_KP_6:
- NekoMoveDx = (int)NekoSpeed;
- NekoMoveDy = 0;
- break;
- case XK_KP_7:
- NekoMoveDx = -(int)( NekoSpeed / sqrt( (double)2 ) );
- NekoMoveDy = NekoMoveDx;
- break;
- case XK_KP_8:
- NekoMoveDx = 0;
- NekoMoveDy = -(int)NekoSpeed;
- break;
- case XK_KP_9:
- NekoMoveDx = (int)( NekoSpeed / sqrt( (double)2 ) );
- NekoMoveDy = -NekoMoveDx;
- break;
- }
- }
-#endif
-
- return( ReturnState );
-}
-
-
-/*--------------------------------------------------------------
- *
- * G-0LCVD4@0
- *
- *--------------------------------------------------------------*/
-
-void
-NekoAdjust()
-{
- if ( NekoX < 0 ) {
- NekoX = 0;
- } else if ( NekoX > WindowWidth - BITMAP_WIDTH ) {
- NekoX = WindowWidth - BITMAP_WIDTH;
- }
-
- if ( NekoY < 0 ) {
- NekoY = 0;
- } else if ( NekoY > WindowHeight - BITMAP_HEIGHT ) {
- NekoY = WindowHeight - BITMAP_HEIGHT;
- }
-}
-
-
-/*--------------------------------------------------------------
- *
- * %$s%H=hM}
- *
- *--------------------------------------------------------------*/
-
-Bool
-ProcessEvent()
-{
- XEvent theEvent;
- Bool ContinueState = True;
-
- switch ( EventState ) {
- case NORMAL_STATE:
- while ( XCheckMaskEvent( theDisplay, EVENT_MASK1, &theEvent ) ) {
- switch ( theEvent.type ) {
- case ConfigureNotify:
- WindowWidth = theEvent.xconfigure.width;
- WindowHeight = theEvent.xconfigure.height;
- WindowPointX = theEvent.xconfigure.x;
- WindowPointY = theEvent.xconfigure.y;
- BorderWidth = theEvent.xconfigure.border_width;
- NekoAdjust();
- break;
- case Expose:
- if ( theEvent.xexpose.count == 0 ) {
- RedrawNeko();
- }
- break;
- case MapNotify:
- RedrawNeko();
- break;
- case KeyPress:
- ContinueState = ProcessKeyPress( &theEvent.xkey );
- if ( !ContinueState ) {
- return( ContinueState );
- }
- break;
- default:
- /* Unknown Event */
- break;
- }
- }
- break;
-#ifdef DEBUG
- case DEBUG_LIST:
- XNextEvent( theDisplay, &theEvent );
- switch ( theEvent.type ) {
- case ConfigureNotify:
- WindowWidth = theEvent.xconfigure.width;
- WindowHeight = theEvent.xconfigure.height;
- WindowPointX = theEvent.xconfigure.x;
- WindowPointY = theEvent.xconfigure.y;
- BorderWidth = theEvent.xconfigure.border_width;
- break;
- case Expose:
- if ( theEvent.xexpose.count == 0 ) {
- DisplayCharacters();
- }
- break;
- case MapNotify:
- DisplayCharacters();
- break;
- case KeyPress:
- ContinueState = ProcessKeyPress( &theEvent );
- break;
- default:
- /* Unknown Event */
- break;
- }
- break;
- case DEBUG_MOVE:
- while ( XCheckMaskEvent( theDisplay, EVENT_MASK1, &theEvent ) ) {
- switch ( theEvent.type ) {
- case ConfigureNotify:
- WindowWidth = theEvent.xconfigure.width;
- WindowHeight = theEvent.xconfigure.height;
- WindowPointX = theEvent.xconfigure.x;
- WindowPointY = theEvent.xconfigure.y;
- BorderWidth = theEvent.xconfigure.border_width;
- NekoAdjust();
- break;
- case Expose:
- if ( theEvent.xexpose.count == 0 ) {
- RedrawNeko();
- }
- break;
- case MapNotify:
- RedrawNeko();
- break;
- case KeyPress:
- ContinueState = ProcessKeyPress( &theEvent );
- if ( !ContinueState ) {
- return( ContinueState );
- }
- break;
- default:
- /* Unknown Event */
- break;
- }
- }
- break;
-#endif
- default:
- /* Internal Error */
- break;
- }
-
- return( ContinueState );
-}
-
-
-/*--------------------------------------------------------------
- *
- * G-=hM}
- *
- *--------------------------------------------------------------*/
-
-void
-ProcessNeko()
-{
- struct itimerval Value;
-
- /* 4D6-$N=i4|2= */
-
- EventState = NORMAL_STATE;
-
- /* G-$N=i4|2= */
-
- NekoX = ( WindowWidth - BITMAP_WIDTH / 2 ) / 2;
- NekoY = ( WindowHeight - BITMAP_HEIGHT / 2 ) / 2;
-
- NekoLastX = NekoX;
- NekoLastY = NekoY;
-
- SetNekoState( NEKO_STOP );
-
- /* %?%$%^!<@_Dj */
-
- timerclear( &Value.it_interval );
- timerclear( &Value.it_value );
-
- Value.it_interval.tv_usec = IntervalTime;
- Value.it_value.tv_usec = IntervalTime;
-
- setitimer( ITIMER_REAL, &Value, 0 );
-
- /* %a%$%s=hM} */
-
- do {
- NekoThinkDraw();
- } while ( ProcessEvent() );
-}
-
-
-#ifdef DEBUG
-
-/*--------------------------------------------------------------
- *
- * G-0lMw!J5/31/93P14460MQ!K
- *
- *--------------------------------------------------------------*/
-
-void
-NekoList()
-{
- EventState = DEBUG_LIST;
-
- fprintf( stderr, "\n" );
- fprintf( stderr, "G-0lMw$rI=<($7$^$9!#(Quit !D Alt-Q)\n" );
- fprintf( stderr, "\n" );
-
- XSelectInput( theDisplay, theWindow, EVENT_MASK2 );
-
- while ( ProcessEvent() );
-}
-
-
-/*--------------------------------------------------------------
- *
- * G-0\F0SCCS/s.xneko.c9%H!J5/31/93P14670MQ!K
- *
- *--------------------------------------------------------------*/
-
-void
-NekoMoveTest()
-{
- struct itimerval Value;
-
- /* 4D6-$N=i4|2= */
-
- EventState = DEBUG_MOVE;
-
- /* G-$N=i4|2= */
-
- NekoX = ( WindowWidth - BITMAP_WIDTH / 2 ) / 2;
- NekoY = ( WindowHeight - BITMAP_HEIGHT / 2 ) / 2;
-
- NekoLastX = NekoX;
- NekoLastY = NekoY;
-
- SetNekoState( NEKO_STOP );
-
- /* %?%$%^!<@_Dj */
-
- timerclear( &Value.it_interval );
- timerclear( &Value.it_value );
-
- Value.it_interval.tv_usec = IntervalTime;
- Value.it_value.tv_usec = IntervalTime;
-
- setitimer( ITIMER_REAL, &Value, 0 );
-
- /* %a%$%s=hM} */
-
- fprintf( stderr, "\n" );
- fprintf( stderr, "G-$N0\F0SCCS/s.xneko.c9%H$r9T$$$^$9!#(Quit !D Alt-Q)\n" );
- fprintf( stderr, "\n" );
- fprintf( stderr, "\t%-!<May 31, 1993C%I>e$NSCCS/s.xneko.cs%-!<$GG-$r0\F0$5$;$F2<$5$$!#\n" );
- fprintf( stderr, "\t(M-8z$J%-!<$O#1!A#9$G$9!#)\n" );
- fprintf( stderr, "\n" );
-
- do {
- NekoThinkDraw();
- } while ( ProcessEvent() );
-}
-
-
-/*--------------------------------------------------------------
- *
- * %a%K%e!<=hM}!J5/31/93P15170MQ!K
- *
- *--------------------------------------------------------------*/
-
-void
-ProcessDebugMenu()
-{
- int UserSelectNo = 0;
- char UserAnswer[ BUFSIZ ];
-
- fprintf( stderr, "\n" );
- fprintf( stderr, "!Zxneko 5/31/93P15280%a%K%e!<![\n" );
-
- while ( !( UserSelectNo >= 1 && UserSelectNo <= 2 ) ) {
- fprintf( stderr, "\n" );
- fprintf( stderr, "\t1)!!G-%-%c%i%/%?!<0lMwI=<(\n" );
- fprintf( stderr, "\t2)!!G-0\F0SCCS/s.xneko.c9%H\n" );
- fprintf( stderr, "\n" );
- fprintf( stderr, "Select: " );
-
- fgets( UserAnswer, sizeof( UserAnswer ), stdin );
-
- UserSelectNo = atoi( UserAnswer );
-
- if ( !( UserSelectNo >= 1 && UserSelectNo <= 2 ) ) {
- fprintf( stderr, "\n" );
- fprintf( stderr, "@5$7$$HV9f$rA*Br$7$F2<$5$$!#\n" );
- }
- }
-
- switch ( UserSelectNo ) {
- case 1:
- /* G-%-%c%i%/%?!<0lMwI=<( */
- NekoList();
- break;
- case 2:
- /* G-0\F0SCCS/s.xneko.c9%H */
- NekoMoveTest();
- break;
- default:
- /* Internal Error */
- break;
- }
-
- fprintf( stderr, "SCCS/s.xneko.c9%H=*N;!#\n" );
- fprintf( stderr, "\n" );
-}
-
-#endif /* DEBUG */
-
-
-/*--------------------------------------------------------------
- *
- * SIGALRM %7%0%J%k=hM}
- *
- *--------------------------------------------------------------*/
-
-void
-NullFunction()
-{
- /* No Operation */
-}
-
-
-/*--------------------------------------------------------------
- *
- * Usage
- *
- *--------------------------------------------------------------*/
-
-void
-Usage()
-{
- fprintf( stderr,
- "Usage: %s [-display <display>] [-geometry <geometry>] \\\n",
- ProgramName );
- fprintf( stderr, " [-title <title>] [-name <title>] [-iconic] \\\n" );
- fprintf( stderr, " [-speed <speed>] [-time <time>] [-help]\n" );
-}
-
-
-/*--------------------------------------------------------------
- *
- * #XMay 31, 1993i%a!<%?I>2A
- *
- *--------------------------------------------------------------*/
-
-Bool
-GetArguments( argc, argv, theDisplayName, theGeometry, theTitle,
- NekoSpeed, IntervalTime )
- int argc;
- char *argv[];
- char *theDisplayName;
- char *theGeometry;
- char *theTitle;
- double *NekoSpeed;
- long *IntervalTime;
-{
- int ArgCounter;
- Bool iconicState;
-
- theDisplayName[ 0 ] = '\0';
- theGeometry[ 0 ] = '\0';
- theTitle[ 0 ] = '\0';
-
- iconicState = False;
-
- for ( ArgCounter = 0; ArgCounter < argc; ArgCounter++ ) {
-
- if ( strncmp( argv[ ArgCounter ], "-h", 2 ) == 0 ) {
- Usage();
- exit( 0 );
- } else if ( strcmp( argv[ ArgCounter ], "-display" ) == 0 ) {
- ArgCounter++;
- if ( ArgCounter < argc ) {
- strcpy( theDisplayName, argv[ ArgCounter ] );
- } else {
- fprintf( stderr, "%s: -display option error.\n", ProgramName );
- exit( 1 );
- }
- } else if ( strncmp( argv[ ArgCounter ], "-geom", 5 ) == 0 ) {
- ArgCounter++;
- if ( ArgCounter < argc ) {
- strcpy( theGeometry, argv[ ArgCounter ] );
- } else {
- fprintf( stderr,
- "%s: -geometry option error.\n", ProgramName );
- exit( 1 );
- }
- } else if ( ( strcmp( argv[ ArgCounter ], "-title" ) == 0 )
- || ( strcmp( argv[ ArgCounter ], "-name" ) == 0 ) ) {
- ArgCounter++;
- if ( ArgCounter < argc ) {
- strcpy( theTitle, argv[ ArgCounter ] );
- } else {
- fprintf( stderr, "%s: -title option error.\n", ProgramName );
- exit( 1 );
- }
- } else if ( strcmp( argv[ ArgCounter ], "-iconic" ) == 0 ) {
- iconicState = True;
- } else if ( strcmp( argv[ ArgCounter ], "-speed" ) == 0 ) {
- ArgCounter++;
- if ( ArgCounter < argc ) {
- *NekoSpeed = atof( argv[ ArgCounter ] );
- } else {
- fprintf( stderr, "%s: -speed option error.\n", ProgramName );
- exit( 1 );
- }
- } else if ( strcmp( argv[ ArgCounter ], "-time" ) == 0 ) {
- ArgCounter++;
- if ( ArgCounter < argc ) {
- *IntervalTime = atol( argv[ ArgCounter ] );
- } else {
- fprintf( stderr, "%s: -time option error.\n", ProgramName );
- exit( 1 );
- }
- } else {
- fprintf( stderr,
- "%s: Unknown option \"%s\".\n", ProgramName,
- argv[ ArgCounter ] );
- Usage();
- exit( 1 );
- }
- }
-
- if ( strlen( theDisplayName ) < 1 ) {
- theDisplayName = NULL;
- }
-
- if ( strlen( theGeometry ) < 1 ) {
- theGeometry = NULL;
- }
-
- return( iconicState );
-}
-
-
-/*--------------------------------------------------------------
- *
- * %a%$%s4X?t
- *
- *--------------------------------------------------------------*/
-
-int
-main( argc, argv )
- int argc;
- char *argv[];
-{
- Bool iconicState;
- char theDisplayName[ DIRNAMELEN ];
- char theGeometry[ DIRNAMELEN ];
- char theTitle[ DIRNAMELEN ];
-
- ProgramName = argv[ 0 ];
-
- argc--;
- argv++;
-
- iconicState = GetArguments( argc, argv,
- theDisplayName,
- theGeometry,
- theTitle,
- &NekoSpeed,
- &IntervalTime );
-
- InitScreen( theDisplayName, theGeometry, theTitle, iconicState );
-
- signal( SIGALRM, NullFunction );
-
- SinPiPer8Times3 = sin( PI_PER8 * (double)3 );
- SinPiPer8 = sin( PI_PER8 );
-
-#ifndef DEBUG
- ProcessNeko();
-#else
- ProcessDebugMenu();
-#endif
-
- exit( 0 );
-}
diff --git a/games/x11/xroach/Makefile b/games/x11/xroach/Makefile
deleted file mode 100644
index 8447d77..0000000
--- a/games/x11/xroach/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/8/93
-
-PROG= xroach
-MAN6= xroach.6
-CFLAGS+= -I${.CURDIR}/bitmaps -I${X11BASE}/include
-DPADD+= ${X11BASE}/lib/libX11.a ${LIBM}
-LDDESTDIR+= -L${X11BASE}/lib
-LDADD+= -lX11 -lm
-
-.include "../../Makefile.inc"
-.include <bsd.prog.mk>
diff --git a/games/x11/xroach/xroach.c b/games/x11/xroach/xroach.c
deleted file mode 100644
index 971e90f..0000000
--- a/games/x11/xroach/xroach.c
+++ /dev/null
@@ -1,602 +0,0 @@
-/*
- Xroach - A game of skill. Try to find the roaches under your windows.
-
- Copyright 1991 by J.T. Anderson
-
- jta@locus.com
-
- This program may be freely distributed provided that all
- copyright notices are retained.
-
- To build:
- cc -o xroach roach.c -lX11 [-lsocketorwhatever] [-lm] [-l...]
-
- Dedicated to Greg McFarlane. (gregm@otc.otca.oz.au)
-*/
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xos.h>
-
-#include <stdio.h>
-#include <math.h>
-#include <signal.h>
-#include <stdlib.h>
-
-char Copyright[] = "Xroach\nCopyright 1991 J.T. Anderson";
-
-#include "roachmap.h"
-
-typedef unsigned long Pixel;
-typedef int ErrorHandler();
-
-#define SCAMPER_EVENT (LASTEvent + 1)
-
-#if !defined(GRAB_SERVER)
-#define GRAB_SERVER 0
-#endif
-
-Display *display;
-int screen;
-Window rootWin;
-unsigned int display_width, display_height;
-int center_x, center_y;
-GC gc;
-char *display_name = NULL;
-Pixel black, white;
-
-int done = 0;
-int eventBlock = 0;
-int errorVal = 0;
-
-typedef struct Roach {
- RoachMap *rp;
- int index;
- float x;
- float y;
- int intX;
- int intY;
- int hidden;
- int turnLeft;
- int steps;
-} Roach;
-
-Roach *roaches;
-int maxRoaches = 10;
-int curRoaches = 0;
-float roachSpeed = 20.0;
-
-Region rootVisible = NULL;
-
-void Usage();
-void SigHandler();
-void AddRoach();
-void MoveRoach();
-void DrawRoaches();
-void CoverRoot();
-int CalcRootVisible();
-int MarkHiddenRoaches();
-Pixel AllocNamedColor();
-
-void
-main(ac, av)
-int ac;
-char *av[];
-{
- XGCValues xgcv;
- int ax;
- char *arg;
- RoachMap *rp;
- int rx;
- float angle;
- XEvent ev;
- char *roachColor = "black";
- int nVis;
- int needCalc;
-
- /*
- Process command line options.
- */
- for (ax=1; ax<ac; ax++) {
- arg = av[ax];
- if (strcmp(arg, "-display") == 0) {
- display_name = av[++ax];
- }
- else if (strcmp(arg, "-rc") == 0) {
- roachColor = av[++ax];
- }
- else if (strcmp(arg, "-speed") == 0) {
- roachSpeed = atof(av[++ax]);
- }
- else if (strcmp(arg, "-roaches") == 0) {
- maxRoaches = strtol(av[++ax], (char **)NULL, 0);
- }
- else {
- Usage();
- }
- }
-
- srand((int)time((long *)NULL));
-
- /*
- Catch some signals so we can erase any visible roaches.
- */
- signal(SIGKILL, SigHandler);
- signal(SIGINT, SigHandler);
- signal(SIGTERM, SigHandler);
- signal(SIGHUP, SigHandler);
-
- display = XOpenDisplay(display_name);
- if (display == NULL) {
- if (display_name == NULL) display_name = getenv("DISPLAY");
- (void) fprintf(stderr, "%s: cannot connect to X server %s\n", av[0],
- display_name ? display_name : "(default)");
- exit(1);
- }
-
- screen = DefaultScreen(display);
- rootWin = RootWindow(display, screen);
- black = BlackPixel(display, screen);
- white = WhitePixel(display, screen);
-
- display_width = DisplayWidth(display, screen);
- display_height = DisplayHeight(display, screen);
- center_x = display_width / 2;
- center_y = display_height / 2;
-
- /*
- Create roach pixmaps at several orientations.
- */
- for (ax=0; ax<360; ax+=ROACH_ANGLE) {
- rx = ax / ROACH_ANGLE;
- angle = rx * 0.261799387799;
- rp = &roachPix[rx];
- rp->pixmap = XCreateBitmapFromData(display, rootWin,
- rp->roachBits, rp->width, rp->height);
- rp->sine = sin(angle);
- rp->cosine = cos(angle);
- }
-
- roaches = (Roach *)malloc(sizeof(Roach) * maxRoaches);
-
- gc = XCreateGC(display, rootWin, 0L, &xgcv);
- XSetForeground(display, gc, AllocNamedColor(roachColor, black));
- XSetFillStyle(display, gc, FillStippled);
-
- while (curRoaches < maxRoaches)
- AddRoach();
-
- XSelectInput(display, rootWin, ExposureMask | SubstructureNotifyMask);
-
- needCalc = 1;
- while (!done) {
- if (XPending(display)) {
- XNextEvent(display, &ev);
- }
- else {
- if (needCalc) {
- needCalc = CalcRootVisible();
- }
- nVis = MarkHiddenRoaches();
- if (nVis) {
- ev.type = SCAMPER_EVENT;
- }
- else {
- DrawRoaches();
- eventBlock = 1;
- XNextEvent(display, &ev);
- eventBlock = 0;
- }
- }
-
- switch (ev.type) {
-
- case SCAMPER_EVENT:
- for (rx=0; rx<curRoaches; rx++) {
- if (!roaches[rx].hidden)
- MoveRoach(rx);
- }
- DrawRoaches();
- XSync(display, False);
- break;
-
- case Expose:
- case MapNotify:
- case UnmapNotify:
- case ConfigureNotify:
- needCalc = 1;
- break;
-
- }
- }
-
- CoverRoot();
-
- XCloseDisplay(display);
-}
-
-#define USEPRT(msg) fprintf(stderr, msg)
-
-void
-Usage()
-{
- USEPRT("Usage: xroach [options]\n\n");
- USEPRT("Options:\n");
- USEPRT(" -display displayname\n");
- USEPRT(" -rc roachcolor\n");
- USEPRT(" -roaches numroaches\n");
- USEPRT(" -speed roachspeed\n");
-
- exit(1);
-}
-
-void
-SigHandler()
-{
-
- /*
- If we are blocked, no roaches are visible and we can just bail
- out. If we are not blocked, then let the main procedure clean
- up the root window.
- */
- if (eventBlock) {
- XCloseDisplay(display);
- exit(0);
- }
- else {
- done = 1;
- }
-}
-
-/*
- Generate random integer between 0 and maxVal-1.
-*/
-int
-RandInt(maxVal)
-int maxVal;
-{
- return rand() % maxVal;
-}
-
-/*
- Check for roach completely in specified rectangle.
-*/
-int
-RoachInRect(roach, rx, ry, x, y, width, height)
-Roach *roach;
-int rx;
-int ry;
-int x;
-int y;
-unsigned int width;
-unsigned int height;
-{
- if (rx < x) return 0;
- if ((rx + roach->rp->width) > (x + width)) return 0;
- if (ry < y) return 0;
- if ((ry + roach->rp->height) > (y + height)) return 0;
-
- return 1;
-}
-
-/*
- Check for roach overlapping specified rectangle.
-*/
-int
-RoachOverRect(roach, rx, ry, x, y, width, height)
-Roach *roach;
-int rx;
-int ry;
-int x;
-int y;
-unsigned int width;
-unsigned int height;
-{
- if (rx >= (x + width)) return 0;
- if ((rx + roach->rp->width) <= x) return 0;
- if (ry >= (y + height)) return 0;
- if ((ry + roach->rp->height) <= y) return 0;
-
- return 1;
-}
-
-/*
- Give birth to a roach.
-*/
-void
-AddRoach()
-{
- Roach *r;
-
- if (curRoaches < maxRoaches) {
- r = &roaches[curRoaches++];
- r->index = RandInt(ROACH_HEADINGS);
- r->rp = &roachPix[r->index];
- r->x = RandInt(display_width - r->rp->width);
- r->y = RandInt(display_height - r->rp->height);
- r->intX = -1;
- r->intY = -1;
- r->hidden = 0;
- r->steps = RandInt(200);
- r->turnLeft = RandInt(100) >= 50;
- }
-}
-
-/*
- Turn a roach.
-*/
-void
-TurnRoach(roach)
-Roach *roach;
-{
- if (roach->index != (roach->rp - roachPix)) return;
-
- if (roach->turnLeft) {
- roach->index += (RandInt(30) / 10) + 1;
- if (roach->index >= ROACH_HEADINGS)
- roach->index -= ROACH_HEADINGS;
- }
- else {
- roach->index -= (RandInt(30) / 10) + 1;
- if (roach->index < 0)
- roach->index += ROACH_HEADINGS;
- }
-}
-
-/*
- Move a roach.
-*/
-void
-MoveRoach(rx)
-int rx;
-{
- Roach *roach;
- Roach *r2;
- float newX;
- float newY;
- int ii;
-
- roach = &roaches[rx];
- newX = roach->x + (roachSpeed * roach->rp->cosine);
- newY = roach->y - (roachSpeed * roach->rp->sine);
-
- if (RoachInRect(roach, (int)newX, (int)newY,
- 0, 0, display_width, display_height)) {
-
- roach->x = newX;
- roach->y = newY;
-
- if (roach->steps-- <= 0) {
- TurnRoach(roach);
- roach->steps = RandInt(200);
- }
-
- for (ii=rx+1; ii<curRoaches; ii++) {
- r2 = &roaches[ii];
- if (RoachOverRect(roach, (int)newX, (int)newY,
- r2->intX, r2->intY, r2->rp->width, r2->rp->height)) {
-
- TurnRoach(roach);
- }
- }
- }
- else {
- TurnRoach(roach);
- }
-}
-
-/*
- Draw all roaches.
-*/
-void
-DrawRoaches()
-{
- Roach *roach;
- int rx;
-
- for (rx=0; rx<curRoaches; rx++) {
- roach = &roaches[rx];
-
- if (roach->intX >= 0) {
- XClearArea(display, rootWin, roach->intX, roach->intY,
- roach->rp->width, roach->rp->height, False);
- }
- }
-
- for (rx=0; rx<curRoaches; rx++) {
- roach = &roaches[rx];
-
- if (!roach->hidden) {
- roach->intX = roach->x;
- roach->intY = roach->y;
- roach->rp = &roachPix[roach->index];
-
- XSetStipple(display, gc, roach->rp->pixmap);
- XSetTSOrigin(display, gc, roach->intX, roach->intY);
- XFillRectangle(display, rootWin, gc,
- roach->intX, roach->intY, roach->rp->width, roach->rp->height);
- }
- else {
- roach->intX = -1;
- }
- }
-}
-
-/*
- Cover root window to erase roaches.
-*/
-void
-CoverRoot()
-{
- XSetWindowAttributes xswa;
- long wamask;
- Window roachWin;
-
- xswa.background_pixmap = ParentRelative;
- xswa.override_redirect = True;
- wamask = CWBackPixmap | CWOverrideRedirect;
- roachWin = XCreateWindow(display, rootWin, 0, 0,
- display_width, display_height, 0, CopyFromParent,
- InputOutput, CopyFromParent, wamask, &xswa);
- XLowerWindow(display, roachWin);
- XMapWindow(display, roachWin);
- XFlush(display);
-}
-
-#if !GRAB_SERVER
-
-int
-RoachErrors(dpy, err)
-Display *dpy;
-XErrorEvent *err;
-{
- errorVal = err->error_code;
-
- return 0;
-}
-
-#endif /* GRAB_SERVER */
-
-/*
- Calculate Visible region of root window.
-*/
-int
-CalcRootVisible()
-{
- Region covered;
- Region visible;
- Window *children;
- int nChildren;
- Window dummy;
- XWindowAttributes wa;
- int wx;
- XRectangle rect;
- int winX, winY;
- unsigned int winHeight, winWidth;
- unsigned int borderWidth;
- unsigned int depth;
-
- /*
- If we don't grab the server, the XGetWindowAttribute or XGetGeometry
- calls can abort us. On the other hand, the server grabs can make for
- some annoying delays.
- */
-#if GRAB_SERVER
- XGrabServer(display);
-#else
- XSetErrorHandler(RoachErrors);
-#endif
-
- /*
- Get children of root.
- */
- XQueryTree(display, rootWin, &dummy, &dummy, &children, &nChildren);
-
- /*
- For each mapped child, add the window rectangle to the covered
- region.
- */
- covered = XCreateRegion();
- for (wx=0; wx<nChildren; wx++) {
- if (XEventsQueued(display, QueuedAlready)) return 1;
- errorVal = 0;
- XGetWindowAttributes(display, children[wx], &wa);
- if (errorVal) continue;
- if (wa.map_state == IsViewable) {
- XGetGeometry(display, children[wx], &dummy, &winX, &winY,
- &winWidth, &winHeight, &borderWidth, &depth);
- if (errorVal) continue;
- rect.x = winX;
- rect.y = winY;
- rect.width = winWidth + (borderWidth * 2);
- rect.height = winHeight + (borderWidth * 2);
- XUnionRectWithRegion(&rect, covered, covered);
- }
- }
- XFree((char *)children);
-
-#if GRAB_SERVER
- XUngrabServer(display);
-#else
- XSetErrorHandler((ErrorHandler *)NULL);
-#endif
-
- /*
- Subtract the covered region from the root window region.
- */
- visible = XCreateRegion();
- rect.x = 0;
- rect.y = 0;
- rect.width = display_width;
- rect.height = display_height;
- XUnionRectWithRegion(&rect, visible, visible);
- XSubtractRegion(visible, covered, visible);
- XDestroyRegion(covered);
-
- /*
- Save visible region globally.
- */
- if (rootVisible)
- XDestroyRegion(rootVisible);
- rootVisible = visible;
-
-
- /*
- Mark all roaches visible.
- */
- for (wx=0; wx<curRoaches; wx++)
- roaches[wx].hidden = 0;
-
- return 0;
-}
-
-/*
- Mark hidden roaches.
-*/
-int
-MarkHiddenRoaches()
-{
- int rx;
- Roach *r;
- int nVisible;
-
- nVisible = 0;
- for (rx=0; rx<curRoaches; rx++) {
- r = &roaches[rx];
-
- if (!r->hidden) {
- if (r->intX > 0 && XRectInRegion(rootVisible, r->intX, r->intY,
- r->rp->width, r->rp->height) == RectangleOut) {
- r->hidden = 1;
- }
- else {
- nVisible++;
- }
- }
- }
-
- return nVisible;
-}
-
-/*
- Allocate a color by name.
-*/
-Pixel
-AllocNamedColor(colorName, dfltPix)
-char *colorName;
-Pixel dfltPix;
-{
- Pixel pix;
- XColor scrncolor;
- XColor exactcolor;
-
- if (XAllocNamedColor(display, DefaultColormap(display, screen),
- colorName, &scrncolor, &exactcolor)) {
- pix = scrncolor.pixel;
- }
- else {
- pix = dfltPix;
- }
-
- return pix;
-}
-
diff --git a/gnu/Makefile.inc b/gnu/Makefile.inc
deleted file mode 100644
index 8eb90e8..0000000
--- a/gnu/Makefile.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-# @(#)Makefile.inc 5.1 (Berkeley) 5/11/90
-
-BINDIR?= /usr/bin
-LIBDIR?= /usr/lib
diff --git a/gnu/games/Makefile b/gnu/games/Makefile
deleted file mode 100644
index 4a7577e..0000000
--- a/gnu/games/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $Id$
-
-SUBDIR= chess
-
-.include <bsd.subdir.mk>
diff --git a/gnu/games/Makefile.inc b/gnu/games/Makefile.inc
deleted file mode 100644
index 4437a84..0000000
--- a/gnu/games/Makefile.inc
+++ /dev/null
@@ -1,9 +0,0 @@
-# $Id$
-
-BINOWN?= games
-.if defined(HIDEGAME)
-BINDIR?= /usr/games/hide
-BINMODE?= 4700
-.else
-BINDIR?= /usr/games
-.endif
diff --git a/gnu/games/chess/Makefile b/gnu/games/chess/Makefile
deleted file mode 100644
index a40e597..0000000
--- a/gnu/games/chess/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-# @(#)Makefile 5.4 (Berkeley) 5/11/90
-
-PROG= chess
-SRCS= gnuchess.c uxdsp.c move.c
-CFLAGS+=-DNEWMOVE=12
-MAN6= chess.6
-DPADD= ${LIBCURSES} ${LIBTERMCAP}
-LDADD= -lcurses -ltermcap
-HIDEGAME=hidegame
-
-beforeinstall:
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \
- ${.CURDIR}/gnuchess.book ${DESTDIR}/usr/share/games
-
-.include <bsd.prog.mk>
diff --git a/gnu/games/chess/Xchess/Makefile b/gnu/games/chess/Xchess/Makefile
deleted file mode 100644
index c4d0d78..0000000
--- a/gnu/games/chess/Xchess/Makefile
+++ /dev/null
@@ -1,136 +0,0 @@
-# RCS Info: $Revision: 1.3 $ on $Date: 1995/05/30 04:41:16 $
-# $Source: /home/ncvs/src/gnu/games/chess/Xchess/Makefile,v $
-# Copyright (c) 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
-#
-# Makefile for xchess.
-
-#CC = cc -O -m68010 -L/pub.MC68010/lib -L/usr.MC68010/lib
-CC = cc -O
-
-CFILES =\
- board.c\
- button.c\
- clock.c\
- control.c\
- jail.c\
- message.c\
- parse.c\
- popup.c\
- program.c\
- record.c\
- std.c\
- valid.c\
- window.c\
- XCircle.c
-
-COBJS =\
- board.o\
- button.o\
- clock.o\
- control.o\
- jail.o\
- message.o\
- parse.o\
- popup.o\
- program.o\
- record.o\
- std.o\
- valid.o\
- window.o\
- XCircle.o
-
-HFILES =\
- std.h\
- xchess.h
-
-SOURCE = $(CFILES)
-
-ALLFILES = $(SOURCE) $(HFILES)
-
-INCLUDE = -I. -I${X11BASE}/include
-
-DEFINES = -DDEF_PROGRAM=\"/usr/games/chess\"
-
-CFLAGS = $(DEFINES) $(INCLUDE)
-LINTFLAGS = -u -z -lc -DLINT $(DEFINES) $(INCLUDE)
-LINTLIB = ../lib/llib-lX.ln
-#LDFLAGS = -L/usr2/X/lib -z -lX -lm
-LDFLAGS = -L${X11BASE}/lib -loldX -lX11 -z -lm
-GPLDFLAGS = -z -loldX -lX11 -lXMenu_p -lX -lm_p -g -pg
-
-.c.o: $*.c
- $(CC) $(CFLAGS) -c $*.c
-.s.o: $*.s
- $(CC) $(CFLAGS) -c $*.s
-
-all: xchess scrollText.o
- @echo "All done."
-
-everything: all tags depend lint wc
- @echo "All done."
-
-xchess: xchess.o $(COBJS) scrollText.o
- $(CC) -o xchess xchess.o $(COBJS) scrollText.o \
- $(LDFLAGS)
-
-scrollText.o: scrollText.h scrollText.c
-
-gpxchess: xchess.o $(COBJS)
- $(CC) -o gpxchess xchess.o $(COBJS) scrollText/libScroll.a \
- $(GPLDFLAGS)
-
-lint: $(SOURCE)
- lint $(LINTFLAGS) $(SOURCE) $(LINTLIB) | \
- grep -v "multiply declared"
-
-qgrind: $(ALLFILES)
- qgrind -lc $(ALLFILES)
-
-vgrind: $(ALLFILES)
- vgrind -lc $(ALLFILES)
-
-opt: all
-
-reopt: all
-
-install: all
-
-source: $(SOURCE)
-
-tags: $(ALLFILES)
- ctags -w -t *.c *.h > /dev/null 2>&1
-
-wc: $(ALLFILES)
- @wc $(ALLFILES)
-
-print: $(ALLFILES)
- @pr $(ALLFILES)
-
-clean:
- rm -f *.o *.a *.out xchess tags foo tmp
-
-tar:
- tar -cf xchess.tar Makefile *.h *.c *.bitmap *.icon *.cur *.1\
- scrollText/Makefile scrollText/*.h scrollText/*.c scrollText/*.1\
- scrollText/*.3
-
-$(ALLFILES):
- co $@
-
-depend: $(SOURCE)
- cc -M $(CFLAGS) $(CFILES) > makedep
- echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
- echo '$$r makedep' >>eddep
- echo 'w' >>eddep
- 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
-# DEPENDENCIES MUST END AT END OF FILE
-
-xchess.o $(COBJS): $(HFILES)
-
diff --git a/gnu/games/chess/Xchess/XCircle.c b/gnu/games/chess/Xchess/XCircle.c
deleted file mode 100644
index 5514855..0000000
--- a/gnu/games/chess/Xchess/XCircle.c
+++ /dev/null
@@ -1,162 +0,0 @@
-
-/* This file contains code for X-CHESS.
- Copyright (C) 1986 Free Software Foundation, Inc.
-
-This file is part of X-CHESS.
-
-X-CHESS is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the X-CHESS General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-X-CHESS, but only under the conditions described in the
-X-CHESS General Public License. A copy of this license is
-supposed to have been given to you along with X-CHESS so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-/* RCS Info: $Revision: 1.2 $ on $Date: 1995/05/30 04:41:18 $
- * $Source: /home/ncvs/src/gnu/games/chess/Xchess/XCircle.c,v $
- * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
- * Permission is granted to do anything with this code except sell it
- * or remove this message.
- *
- */
-
-#include <stdio.h>
-#include <X11/Xlib.h>
-#include <X11/X10.h>
-#include <math.h>
-
-#define PI 3.1415926535897932384
-
-#define MAXVERTS 1000
-
-void
-XCircle(win, x, y, rad, start, end, width, height, pixel, func, planes)
- Window win;
- int x, y, rad;
- double start, end;
- int pixel;
- int width, height;
- int func, planes;
-{
- Vertex verts[MAXVERTS];
- double xp, yp, ang;
- int lx, ly, xpt, ypt, i;
- double gradincr = 2 / (double) rad;
- int bk = 0;
-
- while (end >= PI * 2)
- end -= PI * 2;
- while (start >= PI * 2)
- start -= PI * 2;
- while (end < 0)
- end += PI * 2;
- while (start < 0)
- start += PI * 2;
- if (end == start) {
- if (end < gradincr)
- end = end + PI * 2 - gradincr / 2;
- else
- end -= gradincr / 2;
- }
- for (ang = start, i = 0; i < MAXVERTS; ) {
-
- xp = x + rad * cos(ang);
- yp = y + rad * sin(ang);
-
- xpt = xp;
- ypt = yp;
-
- if (!i || (lx != xpt) || (ly != ypt)) {
- verts[i].x = xpt;
- verts[i].y = ypt;
- verts[i].flags = 0;
- i++;
- }
- lx = xpt;
- ly = ypt;
- if (bk)
- break;
- if (((ang < end) && (ang + gradincr > end)) || ((end < start)
- && (ang + gradincr > 2 * PI)
- && (ang + gradincr - 2 * PI > end))) {
- ang = end;
- bk = 1;
- } else if (ang == end) {
- break;
- } else {
- ang += gradincr;
- }
- if (ang >= PI * 2)
- ang -= PI * 2;
- }
-
- /* Now draw the thing.. */
- XDraw(win, verts, i, width, height, pixel, func, planes);
-
- return;
-}
-
-#ifdef notdef /* VertexCurved is screwed up */
-
-void
-XCircle(win, x, y, rad, start, end, width, height, pixel, func, planes)
- Window win;
- int x, y, rad;
- double start, end;
- int pixel;
- int width, height;
- int func, planes;
-{
- Vertex verts[7];
- int i, j, sv, ev;
- int dp = 0;
-
- for (i = j = 0 ; i < 4; i++) {
- verts[j].x = x + rad * cos((double) (PI * i / 2));
- verts[j].y = y + rad * sin((double) (PI * i / 2));
- verts[j].flags = VertexCurved;
- if ((start >= PI * i / 2) && (start < PI * (i + 1) / 2) &&
- (start != end)) {
- j++;
- verts[j].x = x + rad * cos(start);
- verts[j].y = y + rad * sin(start);
- verts[j].flags = VertexCurved;
- sv = j;
- } else if ((end >= PI * i / 2) && (end < PI * (i + 1) / 2)
- && (start != end)) {
- j++;
- verts[j].x = x + rad * cos(end);
- verts[j].y = y + rad * sin(end);
- verts[j].flags = VertexCurved;
- ev = j;
- }
- j++;
- }
- verts[0].flags |= VertexStartClosed;
- verts[j].x = verts[0].x;
- verts[j].y = verts[0].y;
- verts[j].flags = (verts[0].flags & ~VertexStartClosed) |
- VertexEndClosed;
- for (i = 0; i < 15; i++) {
- if (dp)
- verts[i % 7].flags |= VertexDontDraw;
- if (i % 7 == ev)
- dp = 1;
- else if (i % 7 == sv)
- dp = 0;
- }
- XDraw(win, verts, j + 1, width, height, pixel, func, planes);
-
- return;
-}
-
-#endif notdef
-
diff --git a/gnu/games/chess/Xchess/board.c b/gnu/games/chess/Xchess/board.c
deleted file mode 100644
index fab97d8..0000000
--- a/gnu/games/chess/Xchess/board.c
+++ /dev/null
@@ -1,179 +0,0 @@
-
-/* This file contains code for X-CHESS.
- Copyright (C) 1986 Free Software Foundation, Inc.
-
-This file is part of X-CHESS.
-
-X-CHESS is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the X-CHESS General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-X-CHESS, but only under the conditions described in the
-X-CHESS General Public License. A copy of this license is
-supposed to have been given to you along with X-CHESS so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:08 $
- * $Source: /home/ncvs/src/gnu/games/chess/Xchess/board.c,v $
- * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
- * Permission is granted to do anything with this code except sell it
- * or remove this message.
- *
- * Stuff to deal with the board.
- */
-
-#include "xchess.h"
-
-board *chessboard;
-
-void
-board_setup()
-{
- chessboard = alloc(board);
- board_init(chessboard);
- return;
-}
-
-void
-board_init(b)
- board *b;
-{
- int i, j;
-
- for (i = 0; i < 2; i++)
- for (j = 0; j < SIZE; j++)
- b->square[i][j].color = BLACK;
- for (i = 2; i < 6; i++)
- for (j = 0; j < SIZE; j++)
- b->square[i][j].color = NONE;
- for (i = 6; i < 8; i++)
- for (j = 0; j < SIZE; j++)
- b->square[i][j].color = WHITE;
- for (i = 0; i < SIZE; i++)
- b->square[1][i].type = b->square[6][i].type =
- PAWN;
- b->square[0][0].type = b->square[7][0].type = ROOK;
- b->square[0][1].type = b->square[7][1].type = KNIGHT;
- b->square[0][2].type = b->square[7][2].type = BISHOP;
- b->square[0][3].type = b->square[7][3].type = QUEEN;
- b->square[0][4].type = b->square[7][4].type = KING;
- b->square[0][5].type = b->square[7][5].type = BISHOP;
- b->square[0][6].type = b->square[7][6].type = KNIGHT;
- b->square[0][7].type = b->square[7][7].type = ROOK;
- b->black_cant_castle_k = false;
- b->black_cant_castle_q = false;
- b->white_cant_castle_k = false;
- b->white_cant_castle_q = false;
-
- return;
-}
-
-void
-board_drawall()
-{
- int i, j;
-
- for (i = 0; i < SIZE; i++)
- for (j = 0; j < SIZE; j++)
- if (chessboard->square[i][j].color != NONE) {
- win_drawpiece(&chessboard->square[i][j], i,
- j, WHITE);
- if (!oneboard)
- win_drawpiece(&chessboard->square[i][j],
- i, j, BLACK);
- }
- return;
-}
-
-void
-board_move(b, m)
- board *b;
- move *m;
-{
- switch (m->type) {
-
- case MOVE:
- case CAPTURE:
- b->square[m->fromy][m->fromx].color = NONE;
- b->square[m->toy][m->tox].color = m->piece.color;
- b->square[m->toy][m->tox].type = m->piece.type;
- if ((m->piece.type == PAWN) && (((m->piece.color == BLACK) &&
- (m->toy == 7)) || ((m->piece.color == WHITE) &&
- (m->toy == 0))))
- b->square[m->toy][m->tox].type = QUEEN;
- if (m->enpassant)
- b->square[m->toy + ((m->piece.color == WHITE) ? 1 :
- -1)][m->tox].color = NONE;
- break;
-
- case KCASTLE:
- if (m->piece.color == WHITE) {
- b->square[7][5].color = m->piece.color;
- b->square[7][5].type = ROOK;
- b->square[7][6].color = m->piece.color;
- b->square[7][6].type = KING;
- b->square[7][4].color = NONE;
- b->square[7][7].color = NONE;
- } else {
- b->square[0][5].color = m->piece.color;
- b->square[0][5].type = ROOK;
- b->square[0][6].color = m->piece.color;
- b->square[0][6].type = KING;
- b->square[0][4].color = NONE;
- b->square[0][7].color = NONE;
- }
- break;
-
- case QCASTLE:
- if (m->piece.color == WHITE) {
- b->square[7][3].color = m->piece.color;
- b->square[7][3].type = ROOK;
- b->square[7][2].color = m->piece.color;
- b->square[7][2].type = KING;
- b->square[7][4].color = NONE;
- b->square[7][0].color = NONE;
- } else {
- b->square[0][3].color = m->piece.color;
- b->square[0][3].type = ROOK;
- b->square[0][2].color = m->piece.color;
- b->square[0][2].type = KING;
- b->square[0][4].color = NONE;
- b->square[0][0].color = NONE;
- }
- break;
-
- default:
- fprintf(stderr, "Bad move type %d\n", m->type);
- }
-
- if (m->piece.type == KING) {
- if (m->piece.color == WHITE)
- b->white_cant_castle_q =
- b->white_cant_castle_k= true;
- else
- b->black_cant_castle_q =
- b->black_cant_castle_k= true;
- } else if (m->piece.type == ROOK) {
- if (m->piece.color == WHITE) {
- if (m->fromx == 0)
- b->white_cant_castle_q = true;
- else if (m->fromx == 7)
- b->white_cant_castle_k = true;
- } else {
- if (m->fromx == 0)
- b->black_cant_castle_q = true;
- else if (m->fromx == 7)
- b->black_cant_castle_k = true;
- }
- }
-
- return;
-}
-
diff --git a/gnu/games/chess/Xchess/button.c b/gnu/games/chess/Xchess/button.c
deleted file mode 100644
index d91005d..0000000
--- a/gnu/games/chess/Xchess/button.c
+++ /dev/null
@@ -1,337 +0,0 @@
-
-/* This file contains code for X-CHESS.
- Copyright (C) 1986 Free Software Foundation, Inc.
-
-This file is part of X-CHESS.
-
-X-CHESS is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the X-CHESS General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-X-CHESS, but only under the conditions described in the
-X-CHESS General Public License. A copy of this license is
-supposed to have been given to you along with X-CHESS so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:15 $
- * $Source: /home/ncvs/src/gnu/games/chess/Xchess/button.c,v $
- * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
- * Permission is granted to do anything with this code except sell it
- * or remove this message.
- *
- * Do stuff with the buttons.
- * The configuration we're using is: Draw Back Pause
- * Resign Fwd Flip
- * Reset Save Easy (Switch)
- */
-
-#include "xchess.h"
-
-typedef enum choice { NOCHOICE, DRAW, RESIGN, REPLAY, SWITCH, FORE, SAVE,
- STOP, FLIP, RESTART, EASY } choice;
-
-static struct but {
- char *label;
- int x, y;
- int width, height;
- choice which;
-} buts[] = {
- { "Draw", 0, 20, 108, 29, DRAW } ,
- { "Back", 109, 20, 108, 29, REPLAY } ,
- { "Pause", 219, 20, 108, 29, STOP } ,
- { "Resign", 0, 50, 108, 29, RESIGN } ,
- { "Fwd", 109, 50, 108, 29, FORE } ,
- { "Flip", 219, 50, 108, 29, FLIP } ,
- { "Reset", 0, 80, 108, 29, RESTART } ,
- { "Save", 109, 80, 108, 29, SAVE } ,
-#define EASY_OFFSET 8
- { "Switch", 219, 80, 108, 29, SWITCH }
-/* { "NoEasy", 219, 80, 108, 29, EASY }*/
-} ;
-static int easy = 1;
-
-void
-button_draw(win)
- windata *win;
-{
- int i, x, numbuts = sizeof (buts) / sizeof (struct but);
-
- XSetState(win->display, DefaultGC(win->display, 0),
- win->border.pixel, WhitePixel(win->display, 0),
- GXcopy, AllPlanes);
- XSetLineAttributes(win->display, DefaultGC(win->display, 0),
- BORDER_WIDTH, LineSolid, CapButt,
- JoinMiter);
-
- XDrawLine(win->display, win->buttonwin,
- DefaultGC(win->display, 0),
- 0, 29, BUTTON_WIDTH, 29);
- XDrawLine(win->display, win->buttonwin,
- DefaultGC(win->display, 0),
- 0, 60, BUTTON_WIDTH, 60);
- XDrawLine(win->display, win->buttonwin,
- DefaultGC(win->display, 0),
- 108, 0, 108, BUTTON_HEIGHT);
- XDrawLine(win->display, win->buttonwin,
- DefaultGC(win->display, 0),
- 219, 0, 219, BUTTON_HEIGHT);
-
- XSetFont(win->display, DefaultGC(win->display, 0), win->large->fid);
- XSetForeground(win->display, DefaultGC(win->display, 0),
- win->textcolor.pixel);
- XSetBackground(win->display, DefaultGC(win->display, 0),
- win->textback.pixel);
-
- for (i = 0; i < numbuts; i++) {
- x = (buts[i].width -
- XTextWidth(win->large, buts[i].label,
- strlen(buts[i].label))) / 2;
-
- XDrawImageString(win->display, win->buttonwin,
- DefaultGC(win->display, 0),
- buts[i].x + x, buts[i].y, buts[i].label,
- strlen(buts[i].label));
- }
- return;
-}
-
-void
-button_service(win, event)
- windata *win;
- XEvent *event;
-{
- XKeyEvent *ev = &event->xkey;
- choice c;
- int i, numbuts = sizeof (buts) / sizeof (struct but);
- char *s;
-
- ev->y += 15;
- for (i = 0; i < numbuts; i++)
- if ((ev->x >= buts[i].x) && (ev->x <= buts[i].x +
- buts[i].width) && (ev->y >= buts[i].y) &&
- (ev->y <= buts[i].y + buts[i].height)) {
- c = buts[i].which;
- break;
- }
- if ((i == numbuts) || (c == NOCHOICE)) {
- message_add(win, "Bad choice.\n", true);
- return;
- }
-
- if (loading_flag && (c != STOP)) {
- message_add(win, "You can only use PAUSE now\n", true);
- return;
- }
-
- switch (c) {
- case DRAW:
- if (!oneboard) {
- message_add(win, "Just a sec...\n", false);
- if (!pop_question(((win == win1) ? win2 : win1),
-"The other player wants\nto call the game a draw.\nDo you agree?\n")) {
- message_add(win,
- "The other player declines the draw\n", false);
- return;
- }
- }
- message_add(win1, "Draw agreed.\n", false);
- if (!oneboard)
- message_add(win2, "Draw agreed.\n", false);
- cleanup("Draw agreed.");
- break;
-
- case RESIGN:
- if (!pop_question(win, "Are you sure\nyou want to resign?"))
- return;
- if ((oneboard && !progflag) || (nexttomove == win->color)) {
- if (nexttomove == WHITE)
- s = "White resigns.";
- else
- s = "Black resigns.";
- if (oneboard) {
- message_add(win, s, false);
- message_add(win, "\n", false);
- } else {
- message_add(win1, s, false);
- message_add(win, "\n", false);
- message_add(win2, s, false);
- message_add(win, "\n", false);
- }
- sleep(5);
- cleanup(s);
- } else {
- message_add(win, "It's not your turn.\n", true);
- }
- break;
-
- case REPLAY:
- if (!oneboard) {
- message_add(win, "Just a sec...\n", false);
- if (!pop_question(((win == win1) ? win2 : win1),
-"The other player wants\nto take back his last move.\nDo you let him?\n")) {
- message_add(win,
- "The other player refuses...\n", false);
- return;
- }
- }
- if (!moves) {
- message_add(win, "Can't back up...\n", true);
- break;
- }
- message_add(win1, "Replaying...\n", false);
- if (!oneboard)
- message_add(win2, "Replaying...\n", false);
- replay();
- if (progflag)
- replay();
- break;
-
- case FORE:
- if (!oneboard) {
- message_add(win, "Just a sec...\n", false);
- if (!pop_question(((win == win1) ? win2 : win1),
-"The other player wants\nto do a 'fore'.\nIs that ok with you?\n")) {
- message_add(win,
- "The other player refuses...\n", false);
- return;
- }
- }
- if (!foremoves) {
- message_add(win, "Can't go forward...\n", true);
- break;
- }
- message_add(win1, "Moving forward...\n", false);
- if (!oneboard)
- message_add(win2, "Moving forward...\n", false);
- forward();
- break;
-
- case SWITCH:
- message_add(win, "You can't switch yet.\n", false);
- break;
-
- case SAVE:
- if (saveflag) {
- message_add(win,
- "Game is already being logged in file '", true);
- message_add(win, record_file, true);
- message_add(win, "'.\n", true);
- } else {
- message_add(win, "Saving game to file '", false);
- message_add(win, record_file, false);
- message_add(win, "'.\n", false);
- record_save();
- }
- break;
-
- case STOP:
- if (loading_flag) {
- loading_paused = (loading_paused ? false : true);
- message_add(win, loading_paused ?
- "Stopped.\nHit 'Pause' again to restart.\n" :
- "Restarted.\n", false);
- } else if (clock_started) {
- if (!oneboard) {
- message_add(win, "Just a sec...\n", false);
- if (!pop_question(((win == win1) ? win2 : win1),
-"The other player wants\nto stop the clock.\nDo you let him?\n")) {
- message_add(win,
- "The other player refuses to pause.\n",
- false);
- return;
- }
- }
- message_add(win1,
- "Clock stopped.\nHit 'Pause' again to restart.\n",
- false);
- if (!oneboard)
- message_add(win2,
- "Clock stopped.\nHit 'Pause' again to restart.\n",
- false);
- clock_started = false;
- } else {
- if (!oneboard) {
- message_add(win, "Just a sec...\n", false);
- if (!pop_question(((win == win1) ? win2 : win1),
-"The other player wants\nto start the clock again.\nIs that ok?\n")) {
- message_add(win,
- "The other player refuses to resume.\n",
- false);
- return;
- }
- }
- message_add(win1, "Clock restarted.\n", false);
- if (!oneboard)
- message_add(win2, "Clock restarted.\n", false);
- clock_started = true;
- }
- break;
-
- case FLIP:
- message_add(win, "Flipping window...\n", false);
- win->flipped = win->flipped ? false : true;
- win_redraw(win, (XEvent *) NULL);
- break;
-
- case RESTART:
- if (!oneboard) {
- message_add(win, "Just a sec...\n", false);
- if (!pop_question(((win == win1) ? win2 : win1),
-"The other player wants\nto restart the game.\nDo you agree?\n")) {
- message_add(win,
- "The other player refuses to reset\n", false);
- return;
- }
- }
- message_add(win, "Restarting game.\n", false);
- restart();
- break;
- case EASY:
- if (oneboard) {
- int x;
- if (easy)
- easy = 0;
- else
- easy = 1;
-
- if (easy)
- buts[EASY_OFFSET].label = " Easy ";
- else
- buts[EASY_OFFSET].label = "NoEasy";
-
- program_easy(easy);
-
- x = (buts[EASY_OFFSET].width -
- XTextWidth(win->large,
- buts[EASY_OFFSET].label,
- strlen(buts[EASY_OFFSET].label))) / 2;
-
- XSetFont(win->display, DefaultGC(win->display,
- 0), win->large->fid);
- XSetForeground(win->display,
- DefaultGC(win->display, 0),
- win->textcolor.pixel);
- XSetBackground(win->display,
- DefaultGC(win->display, 0),
- win->textback.pixel);
-
- XDrawImageString(win->display,
- win->buttonwin,
- DefaultGC(win->display, 0),
- buts[EASY_OFFSET].x + x,
- buts[EASY_OFFSET].y,
- buts[EASY_OFFSET].label,
- strlen(buts[EASY_OFFSET].label));
- }
- break;
- }
- return;
-}
-
diff --git a/gnu/games/chess/Xchess/clock.c b/gnu/games/chess/Xchess/clock.c
deleted file mode 100644
index 88228b0..0000000
--- a/gnu/games/chess/Xchess/clock.c
+++ /dev/null
@@ -1,291 +0,0 @@
-
-/* This file contains code for X-CHESS.
- Copyright (C) 1986 Free Software Foundation, Inc.
-
-This file is part of X-CHESS.
-
-X-CHESS is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the X-CHESS General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-X-CHESS, but only under the conditions described in the
-X-CHESS General Public License. A copy of this license is
-supposed to have been given to you along with X-CHESS so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:08 $
- * $Source: /home/ncvs/src/gnu/games/chess/Xchess/clock.c,v $
- * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
- * Permission is granted to do anything with this code except sell it
- * or remove this message.
- *
- * Do stuff with the clocks. The way things work is as follows. We call
- * clock_init to draw the clocks initially, but they don't actually start
- * running until we call clock_switch for the first time.
- */
-
-#include "xchess.h"
-
-int movesperunit = 0;
-int timeunit = 0;
-bool clock_started = false;
-int whiteseconds, blackseconds;
-
-static bool white_running = true;
-static long lastwhite, lastblack;
-static bool firstmove = true;
-
-extern void dohands(), hilight();
-
-#define PI 3.1415926535897932384
-
-void
-clock_draw(win, col)
- windata *win;
- color col;
-{
- int i;
- char buf[BSIZE];
- int x = CLOCK_WIDTH / 2, y = CLOCK_WIDTH / 2;
- int xp, yp;
- int rad = CLOCK_WIDTH / 2 - 10;
- Window w = ((col == WHITE) ? win->wclockwin : win->bclockwin);
-
- /* Draw a clock face and the hands. */
- XCircle(w, x, y, rad, 0.0, 0.0, 1, 1, win->textcolor.pixel, GXcopy,
- AllPlanes);
- rad -= 8;
-
- XSetFont(win->display, DefaultGC(win->display, 0),
- win->small->fid);
- XSetForeground(win->display, DefaultGC(win->display, 0),
- win->textcolor.pixel);
- XSetBackground(win->display, DefaultGC(win->display, 0),
- win->textback.pixel);
- for (i = 1; i <= 12; i++) {
- xp = x + rad * cos(PI * 3 / 2 + i * PI / 6) - 4;
- yp = y + rad * sin(PI * 3 / 2 + i * PI / 6) - 5;
- sprintf(buf, "%d", i);
- XDrawString(win->display, w, DefaultGC(win->display, 0),
- xp, yp, buf, strlen(buf));
- }
-
- dohands(win, col);
-
- if (white_running) {
- hilight(win, WHITE, true);
- hilight(win, BLACK, false);
- } else {
- hilight(win, WHITE, false);
- hilight(win, BLACK, true);
- }
- return;
-}
-
-void
-clock_init(win, col)
- windata *win;
- color col;
-{
- whiteseconds = blackseconds = 0;
- clock_started = false;
- firstmove = true;
- clock_draw(win, col);
-
- return;
-}
-
-void
-clock_update()
-{
- int now = time((long *) NULL);
- int i;
-
- if (!clock_started) {
- lastwhite = lastblack = now;
- return;
- }
-
- if (white_running) {
- whiteseconds += now - lastwhite;
- lastwhite = now;
- dohands(win1, WHITE);
- if (!oneboard)
- dohands(win2, WHITE);
- if (timeunit) {
- i = whiteseconds / timeunit;
- if ((i > 0) && (whiteseconds > i * timeunit) &&
- (whiteseconds < i * timeunit + 10) &&
- (movesperunit * i > movenum)) {
- message_add(win1,
- "White has exceeded his time limit\n",
- true);
- if (!oneboard) {
- message_add(win2,
- "White has exceeded his time limit\n",
- true);
- }
- timeunit = 0;
- }
- }
- } else {
- blackseconds += now - lastblack;
- lastblack = now;
- dohands(win1, BLACK);
- if (!oneboard)
- dohands(win2, BLACK);
- if (timeunit) {
- i = blackseconds / timeunit;
- if ((i > 0) && (blackseconds > i * timeunit) &&
- (blackseconds < i * timeunit + 10) &&
- (movesperunit * i > movenum)) {
- message_add(win1,
- "Black has exceeded his time limit\n",
- true);
- if (!oneboard) {
- message_add(win2,
- "Black has exceeded his time limit\n",
- true);
- }
- timeunit = 0;
- }
- }
- }
- return;
-}
-
-void
-clock_switch()
-{
- if (firstmove) {
- clock_started = true;
- firstmove = false;
- lastwhite = lastblack = time((long *) NULL);
- }
- if (white_running) {
- white_running = false;
- lastblack = time((long *) NULL);
- hilight(win1, WHITE, false);
- hilight(win1, BLACK, true);
- if (!oneboard) {
- hilight(win2, WHITE, false);
- hilight(win2, BLACK, true);
- }
- } else {
- white_running = true;
- lastwhite = time((long *) NULL);
- hilight(win1, WHITE, true);
- hilight(win1, BLACK, false);
- if (!oneboard) {
- hilight(win2, WHITE, true);
- hilight(win2, BLACK, false);
- }
- }
- return;
-}
-
-static void
-dohands(win, col)
- windata *win;
- color col;
-{
- int cx = CLOCK_WIDTH / 2, cy = CLOCK_WIDTH / 2;
- double *h = (col == WHITE) ? win->whitehands : win->blackhands;
- Window w = (col == WHITE) ? win->wclockwin : win->bclockwin;
- long secs = (col == WHITE) ? whiteseconds : blackseconds;
- int rad, x, y, i;
-
- /* First erase the old hands. */
- XSetState(win->display, DefaultGC(win->display, 0),
- win->textback.pixel, win->textback.pixel,
- GXcopy, AllPlanes);
-
- rad = CLOCK_WIDTH / 2 - 30;
- for (i = 0; i < 3; i++) {
- x = cx + rad * sin(PI - h[i]);
- y = cy + rad * cos(PI - h[i]);
- XSetLineAttributes(win->display,
- DefaultGC(win->display, 0),
- i, LineSolid, 0, 0);
- XDrawLine(win->display, w, DefaultGC(win->display, 0),
- cx, cy, x, y);
- rad -= 8;
- }
-
- h[0] = (secs % 60) * 2 * PI / 60;
- h[1] = ((secs / 60) % 60) * 2 * PI / 60;
- h[2] = ((secs / 3600) % 12) * 2 * PI / 12;
-
- /* Now draw the new ones. */
-
- XSetState(win->display, DefaultGC(win->display, 0),
- win->textcolor.pixel, win->textback.pixel,
- GXcopy, AllPlanes);
-
- rad = CLOCK_WIDTH / 2 - 30;
- for (i = 0; i < 3; i++) {
- x = cx + rad * sin(PI - h[i]);
- y = cy + rad * cos(PI - h[i]);
- XSetLineAttributes(win->display,
- DefaultGC(win->display, 0),
- i, LineSolid, 0, 0);
- XDrawLine(win->display, w, DefaultGC(win->display, 0),
- cx, cy, x, y);
- rad -= 8;
- }
- XFlush(win->display);
- return;
-}
-
-static void
-hilight(win, col, on)
- windata *win;
- color col;
- bool on;
-{
- Window w = (col == WHITE) ? win->wclockwin : win->bclockwin;
- char *s = (col == WHITE) ? " WHITE " : " BLACK ";
- int x;
-
-
- x = XTextWidth(win->large, s, strlen(s));
- if (on)
- XSetState(win->display, DefaultGC(win->display, 0),
- win->textback.pixel,
- win->textcolor.pixel,
- GXcopy,
- AllPlanes);
- else
- XSetState(win->display, DefaultGC(win->display, 0),
- win->textcolor.pixel,
- win->textback.pixel,
- GXcopy, AllPlanes);
-
- XSetLineAttributes(win->display, DefaultGC(win->display, 0),
- BORDER_WIDTH, LineSolid, CapButt, JoinMiter);
- XSetFont(win->display, DefaultGC(win->display, 0),
- win->large->fid);
-
- XDrawLine(win->display, w, DefaultGC(win->display, 0),
- 0, CLOCK_HEIGHT - 26,
- CLOCK_WIDTH, CLOCK_HEIGHT - 26);
-
- XDrawImageString(win->display, w, DefaultGC(win->display, 0),
- (CLOCK_WIDTH - x) / 2, CLOCK_HEIGHT,
- s, strlen(s));
-
- if (on)
- XSetState(win->display, DefaultGC(win->display, 0),
- win->textcolor.pixel,
- win->textback.pixel,
- GXcopy, AllPlanes);
- return;
-}
-
diff --git a/gnu/games/chess/Xchess/control.c b/gnu/games/chess/Xchess/control.c
deleted file mode 100644
index 7d23a76..0000000
--- a/gnu/games/chess/Xchess/control.c
+++ /dev/null
@@ -1,515 +0,0 @@
-/* This file contains code for X-CHESS.
- Copyright (C) 1986 Free Software Foundation, Inc.
-
-This file is part of X-CHESS.
-
-X-CHESS is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the X-CHESS General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-X-CHESS, but only under the conditions described in the
-X-CHESS General Public License. A copy of this license is
-supposed to have been given to you along with X-CHESS so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:11 $
- * $Source: /home/ncvs/src/gnu/games/chess/Xchess/control.c,v $
- * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
- * Permission is granted to do anything with this code except sell it
- * or remove this message.
- *
- * Deal with input from the user.
- */
-
-#include "xchess.h"
-
-move *moves;
-move *foremoves;
-color nexttomove = WHITE;
-bool noisyflag = false;
-
-move *lastmove;
-static move *thismove;
-
-static void screen_move();
-
-void
-button_pressed(event, win)
- XEvent *event;
- windata *win;
-{
- int x, y;
- XKeyEvent *ev = (XKeyEvent *) event;
-
- if (!oneboard && (win->color != nexttomove)) {
- message_add(win, "Wrong player!\n", true);
- return;
- }
- if (progflag && (nexttomove == (blackflag ? WHITE : BLACK))) {
- message_add(win, "Wait for the computer...\n", true);
- return;
- }
- if (loading_flag) {
- message_add(win, "You'd better not do that now...\n", true);
- return;
- }
-
- /* Figure out what piece he is pointing at. */
- x = ev->x / (SQUARE_WIDTH + BORDER_WIDTH);
- y = ev->y / (SQUARE_HEIGHT + BORDER_WIDTH);
-
- if (win->flipped) {
- y = SIZE - y - 1;
- x = SIZE - x - 1;
- }
-
- if ((x < 0) || (x >= SIZE) || (y < 0) || (y >= SIZE)) {
- fprintf(stderr, "Bad coords (%d, %d)\n", x, y);
- return;
- }
-
- if (oneboard && (chessboard->square[y][x].color != nexttomove)) {
- message_add(win, "Wrong player!\n", true);
- return;
- } else if (!oneboard && (chessboard->square[y][x].color !=
- win->color)) {
- message_add(win, "Can't move that\n", true);
- return;
- }
-
- thismove = alloc(move);
- thismove->fromx = x;
- thismove->fromy = y;
- thismove->piece.color = chessboard->square[y][x].color;
- thismove->piece.type = chessboard->square[y][x].type;
-
- if (debug)
- fprintf(stderr, "%s selected his %s at (%d, %d)...\n",
- colornames[(int) thismove->piece.color],
- piecenames[(int) thismove->piece.type],
- thismove->fromy, thismove->fromx);
- return;
-}
-
-void
-button_released(event, win)
- XEvent *event;
- windata *win;
-{
- int x, y;
- XKeyEvent *ev = (XKeyEvent *) event;
-
- if (!thismove) {
- /* fprintf(stderr, "Error: button hasn't been pressed\n"); */
- return;
- }
- if (loading_flag)
- return;
-
- /* Figure out what piece he is pointing at. */
- x = ev->x / (SQUARE_WIDTH + BORDER_WIDTH);
- y = ev->y / (SQUARE_HEIGHT + BORDER_WIDTH);
-
- if (win->flipped) {
- y = SIZE - y - 1;
- x = SIZE - x - 1;
- }
-
- if ((x < 0) || (x >= SIZE) || (y < 0) || (y >= SIZE)) {
- fprintf(stderr, "Bad coords (%d, %d)\n", x, y);
- return;
- }
-
- if ((thismove->fromx == x) && (thismove->fromy == y)) {
- message_add(win, "Hey, you touch it, you move it, buddy.\n",
- true);
- return;
- }
- if (chessboard->square[y][x].color == thismove->piece.color) {
- message_add(win, "Can't put one piece on top of another\n",
- true);
- return;
- }
-
- thismove->tox = x;
- thismove->toy = y;
- thismove->taken.color = chessboard->square[y][x].color;
- thismove->taken.type = chessboard->square[y][x].type;
- if (thismove->taken.color != NONE)
- thismove->type = CAPTURE;
- else if ((thismove->piece.type == KING) && (thismove->fromx == 4) &&
- (thismove->tox == 6) &&
- (thismove->toy == thismove->fromy))
- thismove->type = KCASTLE;
- else if ((thismove->piece.type == KING) && (thismove->tox == 2) &&
- (thismove->fromx == 4) &&
- (thismove->toy == thismove->fromy))
- thismove->type = QCASTLE;
- else
- thismove->type = MOVE;
-
- /* Now check the en-passant case... */
- if ((thismove->type == MOVE) && ((thismove->tox == thismove->fromx + 1)
- || (thismove->tox == thismove->fromx - 1)) &&
- (thismove->piece.type == PAWN) && lastmove &&
- (lastmove->tox == lastmove->fromx) && (lastmove->fromx
- == thismove->tox) && ((lastmove->fromy + lastmove->toy)
- / 2 == thismove->toy)) {
- thismove->type = CAPTURE;
- thismove->enpassant = true;
- thismove->taken = lastmove->piece;
- }
-
- if (!valid_move(thismove, chessboard)) {
- message_add(win, "Invalid move.\n", true);
- return;
- }
-
- if (debug)
- fprintf(stderr, "\t... and moved it to (%d, %d), type %s\n",
- thismove->toy, thismove->tox,
- movetypenames[(int) thismove->type]);
- move_piece(thismove);
-
- if (thismove->check) {
- message_add(win1, "Check.\n", true);
- if (!oneboard) {
- message_add(win2, "Check.\n", true);
- }
- }
-
- if (!moves)
- moves = lastmove = thismove;
- else
- lastmove = lastmove->next = thismove;
-
- if (progflag)
- program_send(thismove);
-
- thismove = NULL;
- nexttomove = ((nexttomove == WHITE) ? BLACK : WHITE);
- clock_switch();
-
- return;
-}
-
-void
-prog_move(m)
- move *m;
-{
- if (debug)
- fprintf(stderr, "program moves from (%d, %d) to (%d, %d)\n",
- m->fromy, m->fromx, m->toy, m->tox);
- move_piece(m);
-
- if (!moves)
- moves = lastmove = m;
- else
- lastmove = lastmove->next = m;
-
- nexttomove = ((nexttomove == WHITE) ? BLACK : WHITE);
- clock_switch();
-
- return;
-}
-
-void
-move_piece(m)
- move *m;
-{
- /* Update the screen... */
- screen_move(m);
-
- /* Move the piece on the board... */
- board_move(chessboard, m);
-
- /* And record it... */
- record_move(m);
-
- if (noisyflag) {
- XBell(win1->display, 50);
- XBell(win2->display, 50);
- }
- return;
-}
-
-static void
-screen_move(m)
- move *m;
-{
- piece pp;
-
- switch (m->type) {
- case CAPTURE:
- jail_add(&m->taken);
- /* FALLTHRU */
-
- case MOVE:
- win_erasepiece(m->fromy, m->fromx, WHITE);
- if (win_flashmove)
- win_flash(m, WHITE);
- win_drawpiece(&m->piece, m->toy, m->tox, WHITE);
- if (m->enpassant)
- win_erasepiece(m->toy + ((m->piece.color == WHITE) ?
- 1 : -1), m->tox, WHITE);
- if (!oneboard) {
- win_erasepiece(m->fromy, m->fromx, BLACK);
- if (win_flashmove)
- win_flash(m, BLACK);
- win_drawpiece(&m->piece, m->toy, m->tox, BLACK);
- if (m->enpassant)
- win_erasepiece(m->toy + ((m->piece.color ==
- WHITE) ? 1 : -1), m->tox, WHITE);
- }
- if ((m->piece.type == PAWN) && (((m->piece.color == BLACK) &&
- (m->toy == 7)) || ((m->piece.color == WHITE) &&
- (m->toy == 0)))) {
- pp.color = m->piece.color;
- pp.type = QUEEN;
- win_drawpiece(&pp, m->toy, m->tox, WHITE);
- if (!oneboard)
- win_drawpiece(&m->piece, m->toy, m->tox, BLACK);
- }
- break;
-
- case KCASTLE:
- if (m->piece.color == WHITE) {
- win_erasepiece(7, 4, WHITE);
- win_erasepiece(7, 7, WHITE);
- if (win_flashmove)
- win_flash(m, WHITE);
- win_drawpiece(&m->piece, 7, 6, WHITE);
- win_drawpiece(&chessboard->square[7][7], 7, 5, WHITE);
- if (!oneboard) {
- win_erasepiece(7, 4, BLACK);
- win_erasepiece(7, 7, BLACK);
- if (win_flashmove)
- win_flash(m, BLACK);
- win_drawpiece(&m->piece, 7, 6, BLACK);
- win_drawpiece(&chessboard->square[7][7], 7, 5,
- BLACK);
- }
- } else {
- win_erasepiece(0, 4, WHITE);
- win_erasepiece(0, 7, WHITE);
- if (win_flashmove)
- win_flash(m, WHITE);
- win_drawpiece(&m->piece, 0, 6, WHITE);
- win_drawpiece(&chessboard->square[0][7], 0, 5, WHITE);
- if (!oneboard) {
- win_erasepiece(0, 4, BLACK);
- win_erasepiece(0, 7, BLACK);
- if (win_flashmove)
- win_flash(m, BLACK);
- win_drawpiece(&m->piece, 0, 6, BLACK);
- win_drawpiece(&chessboard->square[0][7], 0, 5,
- BLACK);
- }
- }
- break;
-
- case QCASTLE:
- if (m->piece.color == WHITE) {
- win_erasepiece(7, 4, WHITE);
- win_erasepiece(7, 0, WHITE);
- if (win_flashmove)
- win_flash(m, WHITE);
- win_drawpiece(&m->piece, 7, 2, WHITE);
- win_drawpiece(&chessboard->square[7][0], 7, 3, WHITE);
- if (!oneboard) {
- win_erasepiece(7, 4, BLACK);
- win_erasepiece(7, 0, BLACK);
- if (win_flashmove)
- win_flash(m, BLACK);
- win_drawpiece(&m->piece, 7, 2, BLACK);
- win_drawpiece(&chessboard->square[7][7], 7, 3,
- BLACK);
- }
- } else {
- win_erasepiece(0, 4, WHITE);
- win_erasepiece(0, 0, WHITE);
- if (win_flashmove)
- win_flash(m, WHITE);
- win_drawpiece(&m->piece, 0, 2, WHITE);
- win_drawpiece(&chessboard->square[0][0], 0, 3, WHITE);
- if (!oneboard) {
- win_erasepiece(0, 4, BLACK);
- win_erasepiece(0, 0, BLACK);
- if (win_flashmove)
- win_flash(m, BLACK);
- win_drawpiece(&m->piece, 0, 2, BLACK);
- win_drawpiece(&chessboard->square[0][7], 0, 3,
- BLACK);
- }
- }
- break;
-
- default:
- fprintf(stderr, "Bad move type %d\n", m->type);
- }
- return;
-}
-
-/* Retract the last move made... */
-
-void
-replay()
-{
- move *m = lastmove, bm;
-
- memset(&bm, 0, sizeof(bm));
- switch (m->type) {
- case MOVE:
- bm.type = MOVE;
- bm.piece = m->piece;
- bm.fromx = m->tox;
- bm.fromy = m->toy;
- bm.tox = m->fromx;
- bm.toy = m->fromy;
- board_move(chessboard, &bm);
- screen_move(&bm);
- break;
-
- case CAPTURE:
- bm.type = MOVE;
- bm.piece = m->piece;
- bm.fromx = m->tox;
- bm.fromy = m->toy;
- bm.tox = m->fromx;
- bm.toy = m->fromy;
- board_move(chessboard, &bm);
- screen_move(&bm);
- chessboard->square[m->toy][m->tox] = m->taken;
- bm.piece = m->taken;
- bm.fromx = bm.tox = m->tox;
- bm.fromy = bm.toy = m->toy;
- screen_move(&bm);
- jail_remove(&m->taken);
- break;
-
- case KCASTLE:
- bm.type = MOVE;
- bm.piece.type = KING;
- bm.piece.color = m->piece.color;
- bm.fromx = 6;
- bm.tox = 4;
- bm.fromy = bm.toy = (m->piece.color == WHITE) ? 7 : 0;
- board_move(chessboard, &bm);
- screen_move(&bm);
- bm.type = MOVE;
- bm.piece.type = ROOK;
- bm.piece.color = m->piece.color;
- bm.fromx = 5;
- bm.tox = 7;
- bm.fromy = bm.toy = (m->piece.color == WHITE) ? 7 : 0;
- board_move(chessboard, &bm);
- screen_move(&bm);
- if (m->piece.color == WHITE)
- chessboard->white_cant_castle_k = false;
- else
- chessboard->black_cant_castle_k = false;
- break;
-
- case QCASTLE:
- bm.type = MOVE;
- bm.piece.type = KING;
- bm.piece.color = m->piece.color;
- bm.fromx = 2;
- bm.tox = 4;
- bm.fromy = bm.toy = (m->piece.color == WHITE) ? 7 : 0;
- board_move(chessboard, &bm);
- screen_move(&bm);
- bm.type = MOVE;
- bm.piece.type = ROOK;
- bm.piece.color = m->piece.color;
- bm.fromx = 3;
- bm.tox = 0;
- bm.fromy = bm.toy = (m->piece.color == WHITE) ? 7 : 0;
- board_move(chessboard, &bm);
- screen_move(&bm);
- if (m->piece.color == WHITE)
- chessboard->white_cant_castle_q = false;
- else
- chessboard->black_cant_castle_q = false;
- break;
- }
- record_back();
-
- nexttomove = ((nexttomove == WHITE) ? BLACK : WHITE);
- clock_switch();
-
- if (!moves->next) {
- moves->next = foremoves;
- foremoves = moves;
- moves = lastmove = NULL;
- } else {
- for (m = moves; m->next; m = m->next)
- lastmove = m;
- lastmove->next->next = foremoves;
- foremoves = lastmove->next;
- lastmove->next = NULL;
- }
-
- if (progflag)
- program_undo();
-
- return;
-}
-
-/* Put back the last move undone. */
-
-void
-forward()
-{
- prog_move(foremoves);
- foremoves = foremoves->next;
- return;
-}
-
-/* End the game. */
-
-void
-cleanup(s)
- char *s;
-{
- if (progflag)
- program_end();
- record_end(s);
- XSync(win1->display, 0);
- if (!oneboard) {
- XSync(win2->display, 0);
- }
- exit(0);
-}
-
-void
-restart()
-{
- moves = lastmove = thismove = NULL;
- nexttomove = WHITE;
-
- clock_init(win1, WHITE);
- clock_init(win1, BLACK);
- jail_init(win1);
- if (!oneboard) {
- clock_init(win2, WHITE);
- clock_init(win2, BLACK);
- jail_init(win2);
- }
- board_init(chessboard);
- win_restart();
- record_reset();
- if (progflag) {
- program_end();
- program_init(progname);
- }
- return;
-}
-
diff --git a/gnu/games/chess/Xchess/jail.c b/gnu/games/chess/Xchess/jail.c
deleted file mode 100644
index b3ed391..0000000
--- a/gnu/games/chess/Xchess/jail.c
+++ /dev/null
@@ -1,327 +0,0 @@
-
-/* This file contains code for X-CHESS.
- Copyright (C) 1986 Free Software Foundation, Inc.
-
-This file is part of X-CHESS.
-
-X-CHESS is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the X-CHESS General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-X-CHESS, but only under the conditions described in the
-X-CHESS General Public License. A copy of this license is
-supposed to have been given to you along with X-CHESS so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:12 $
- * $Source: /home/ncvs/src/gnu/games/chess/Xchess/jail.c,v $
- * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
- * Permission is granted to do anything with this code except sell it
- * or remove this message.
- *
- */
-
-#include "xchess.h"
-
-#include "pawn_small.bitmap"
-#include "rook_small.bitmap"
-#include "knight_small.bitmap"
-#include "bishop_small.bitmap"
-#include "queen_small.bitmap"
-#include "king_small.bitmap"
-
-#include "pawn_small_outline.bitmap"
-#include "rook_small_outline.bitmap"
-#include "knight_small_outline.bitmap"
-#include "bishop_small_outline.bitmap"
-#include "queen_small_outline.bitmap"
-#include "king_small_outline.bitmap"
-
-static bool pos[32];
-
-static piecetype pcs[] = { KING, QUEEN, ROOK, ROOK, BISHOP, BISHOP, KNIGHT,
- KNIGHT, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN } ;
-
-extern int piecepos();
-extern char *bitsget();
-
-void
-jail_init(win)
- windata *win;
-{
- int i;
-
- for (i = 0; i < 32; i++)
- pos[i] = false;
- jail_draw(win);
- return;
-}
-
-#define JAIL_HEADER "Captured Pieces"
-
-void
-jail_draw(win)
- windata *win;
-{
- int i;
- char *bits;
- Pixmap tmpPM;
- piece p;
-
- i = XTextWidth(win->large, JAIL_HEADER, strlen(JAIL_HEADER));
- XSetFont(win->display, DefaultGC(win->display, 0),
- win->large->fid);
- XSetForeground(win->display, DefaultGC(win->display, 0),
- win->textcolor.pixel);
- XSetBackground(win->display, DefaultGC(win->display, 0),
- win->textback.pixel);
-
- XDrawImageString(win->display, win->jailwin,
- DefaultGC(win->display, 0),
- (JAIL_WIDTH - i) / 2, 20, JAIL_HEADER,
- strlen(JAIL_HEADER));
-
- XSetForeground(win->display, DefaultGC(win->display, 0),
- win->blackpiece.pixel);
- XSetBackground(win->display, DefaultGC(win->display, 0),
- win->textback.pixel);
- XSetFillStyle(win->display, DefaultGC(win->display, 0),
- FillSolid);
- XSetFunction(win->display, DefaultGC(win->display, 0),
- GXcopy);
-
- for (i = 0; i < 16; i++)
- if (pos[i]) {
- p.color = WHITE;
- p.type = pcs[i];
- bits = bitsget(&p);
- tmpPM = XCreateBitmapFromData(win->display,
- win->jailwin, bits,
- 32, 32);
-
- XCopyPlane(win->display, tmpPM, win->jailwin,
- DefaultGC(win->display, 0),
- 0, 0, 32, 32,
- 5 + (i % 8) * 32, 25 + (i / 8) * 32,
- 1);
- XFreePixmap(win->display, tmpPM);
- } else {
- XFillRectangle(win->display, win->jailwin,
- DefaultGC(win->display, 0),
- 5 + (i % 8) * 32,
- 25 + (i / 8) * 32,
- 32, 32);
- }
- for (i = 0; i < 16; i++)
- if (pos[i + 16]) {
- p.color = BLACK;
- p.type = pcs[i];
- bits = bitsget(&p);
- tmpPM = XCreateBitmapFromData(win->display,
- win->jailwin, bits,
- 32, 32);
-
- XCopyPlane(win->display, tmpPM, win->jailwin,
- DefaultGC(win->display, 0),
- 0, 0, 32, 32,
- 5 + (i % 8) * 32, 94 + (i / 8) * 32,
- 1);
- XFreePixmap(win->display, tmpPM);
- } else {
- XFillRectangle(win->display, win->jailwin,
- DefaultGC(win->display, 0),
- 5 + (i % 8) * 32, 94 + (i / 8) * 32,
- 32, 32);
- }
-
- return;
-}
-
-void
-jail_add(p)
- piece *p;
-{
- int i = piecepos(p, false);
- char *bits;
- Pixmap tmpPM;
-
- pos[i] = true;
-
- bits = bitsget(p);
-
- XSetState(win1->display, DefaultGC(win1->display, 0),
- win1->blackpiece.pixel,
- win1->textback.pixel,
- GXcopy,
- AllPlanes);
-
- tmpPM = XCreateBitmapFromData(win1->display,
- win1->jailwin, bits,
- 32, 32);
-
- XCopyPlane(win1->display, tmpPM, win1->jailwin,
- DefaultGC(win1->display, 0),
- 0, 0, 32, 32,
- 5 + (i % 8) * 32, ((i >= 16) ? 30 : 25) + (i / 8) * 32,
- 1);
- XFreePixmap(win1->display, tmpPM);
-
- if (!oneboard) {
- XSetState(win2->display, DefaultGC(win2->display, 0),
- win2->blackpiece.pixel,
- win2->textback.pixel,
- GXcopy,
- AllPlanes);
-
-
- tmpPM = XCreateBitmapFromData(win2->display,
- win2->jailwin, bits,
- 32, 32);
-
- XCopyPlane(win2->display, tmpPM, win2->jailwin,
- DefaultGC(win2->display, 0),
- 0, 0, 32, 32,
- 5 + (i % 8) * 32, ((i >= 16) ? 30 : 25) + (i / 8) * 32,
- 1);
- XFreePixmap(win2->display, tmpPM);
- }
-
- return;
-}
-
-void
-jail_remove(p)
- piece *p;
-{
- int i = piecepos(p, true);
-
- pos[i] = false;
-
-
- XSetForeground(win1->display,
- DefaultGC(win1->display, 0),
- win1->blackpiece.pixel);
- XSetBackground(win1->display,
- DefaultGC(win1->display, 0),
- win1->textback.pixel);
- XSetFillStyle(win1->display,
- DefaultGC(win1->display, 0),
- FillSolid);
-
- XFillRectangle(win1->display, win1->jailwin,
- DefaultGC(win1->display, 0),
- 5 + (i % 8) * 32,
- ((i >= 16) ? 30 : 25) + (i / 8) * 32,
- 32, 32);
-
- if (!oneboard) {
- XSetForeground(win2->display,
- DefaultGC(win2->display, 0),
- win2->blackpiece.pixel);
- XSetBackground(win2->display,
- DefaultGC(win2->display, 0),
- win2->textback.pixel);
- XSetFillStyle(win2->display,
- DefaultGC(win2->display, 0),
- FillSolid);
-
- XFillRectangle(win2->display, win2->jailwin,
- DefaultGC(win2->display, 0),
- 5 + (i % 8) * 32,
- ((i >= 16) ? 30 : 25) + (i / 8) * 32,
- 32, 32);
- }
-
- return;
-}
-
-static char *bitsget(p)
- piece *p;
-{
- char *bits;
-
- switch (p->type) {
- case PAWN:
- bits = (p->color == WHITE) ? pawn_small_outline_bits :
- pawn_small_bits;
- break;
-
- case ROOK:
- bits = (p->color == WHITE) ? rook_small_outline_bits :
- rook_small_bits;
- break;
-
- case KNIGHT:
- bits = (p->color == WHITE) ? knight_small_outline_bits :
- knight_small_bits;
- break;
-
- case BISHOP:
- bits = (p->color == WHITE) ? bishop_small_outline_bits :
- bishop_small_bits;
- break;
-
- case QUEEN:
- bits = (p->color == WHITE) ? queen_small_outline_bits :
- queen_small_bits;
- break;
-
- case KING:
- bits = (p->color == WHITE) ? king_small_outline_bits :
- king_small_bits;
- break;
- }
- return (bits);
-}
-
-static int
-piecepos(p, there)
- piece *p;
- bool there;
-{
- int i, base = (p->color == WHITE) ? 0 : 16;
-
- switch (p->type) {
- case PAWN:
- for (i = base + 8; (i < base + 15) && pos[i]; i++)
- ;
- if (there && !pos[i])
- i--;
- break;
-
- case KING:
- /* Hmm... */
- i = base;
- break;
-
- case QUEEN:
- i = base + 1;
- break;
-
- case ROOK:
- i = base + 2;
- if ((there && pos[i + 1]) || (!there && pos[i]))
- i++;
- break;
-
- case BISHOP:
- i = base + 4;
- if ((there && pos[i + 1]) || (!there && pos[i]))
- i++;
- break;
-
- case KNIGHT:
- i = base + 6;
- if ((there && pos[i + 1]) || (!there && pos[i]))
- i++;
- break;
- }
- return (i);
-}
diff --git a/gnu/games/chess/Xchess/message.c b/gnu/games/chess/Xchess/message.c
deleted file mode 100644
index 26df739..0000000
--- a/gnu/games/chess/Xchess/message.c
+++ /dev/null
@@ -1,101 +0,0 @@
-
-/* This file contains code for X-CHESS.
- Copyright (C) 1986 Free Software Foundation, Inc.
-
-This file is part of X-CHESS.
-
-X-CHESS is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the X-CHESS General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-X-CHESS, but only under the conditions described in the
-X-CHESS General Public License. A copy of this license is
-supposed to have been given to you along with X-CHESS so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:14 $
- * $Source: /home/ncvs/src/gnu/games/chess/Xchess/message.c,v $
- * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
- * Permission is granted to do anything with this code except sell it
- * or remove this message.
- *
- * Do stuff with the message window. Font 0 is the normal font, font 1
- * is large, and font 2 is normal red.
- */
-
-#include "xchess.h"
-
-#define MESSAGE_HEADER "\n1 XChess Messages0\n"
-
-void
-message_init(win)
- windata *win;
-{
- TxtGrab(win->display, win->messagewin, "xchess", win->medium,
- win->textback.pixel, win->textcolor.pixel,
- win->cursorcolor.pixel);
- TxtAddFont(win->display, win->messagewin, 1, win->large, win->textcolor.pixel);
- TxtAddFont(win->display, win->messagewin, 2, win->medium, win->errortext.pixel);
- TxtAddFont(win->display, win->messagewin, 3, win->medium, win->playertext.pixel);
-
- TxtWriteStr(win->display, win->messagewin, MESSAGE_HEADER);
- return;
-}
-
-void
-message_add(win, string, err)
- windata *win;
- char *string;
- bool err;
-{
- if (err) {
- TxtWriteStr(win->display, win->messagewin, "2");
- TxtWriteStr(win->display, win->messagewin, string);
- TxtWriteStr(win->display, win->messagewin, "0");
- XBell(win->display, 50);
- } else
- TxtWriteStr(win->display, win->messagewin, string);
-
- XSync(win->display, 0);
- return;
-}
-
-void
-message_send(win, event)
- windata *win;
- XEvent *event;
-{
- XKeyEvent *ev = &event->xkey;
- KeySym keysym;
- windata *ow = (win == win1) ? win2 : win1;
- char buf[BSIZE], *s;
- int i;
-
- i = XLookupString(ev, buf, sizeof(buf) - 1, &keysym, &s);
- buf[i] = '\0';
- for (s = buf; *s; s++)
- if (*s == '\r')
- *s = '\n';
- else if (*s == '\177')
- *s = '';
-
- TxtWriteStr(win->display, win->messagewin, "3");
- TxtWriteStr(win->display, win->messagewin, buf);
- TxtWriteStr(win->display, win->messagewin, "0");
- XSync(win->display, 0);
- if (ow) {
- TxtWriteStr(ow->display, ow->messagewin, "3");
- TxtWriteStr(ow->display, ow->messagewin, buf);
- TxtWriteStr(ow->display, ow->messagewin, "0");
- XSync(ow->display, 0);
- }
- return;
-}
-
diff --git a/gnu/games/chess/Xchess/parse.c b/gnu/games/chess/Xchess/parse.c
deleted file mode 100644
index 2dd94ed..0000000
--- a/gnu/games/chess/Xchess/parse.c
+++ /dev/null
@@ -1,386 +0,0 @@
-/* This file contains code for X-CHESS.
- Copyright (C) 1986 Free Software Foundation, Inc.
-
-This file is part of X-CHESS.
-
-X-CHESS is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the X-CHESS General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-X-CHESS, but only under the conditions described in the
-X-CHESS General Public License. A copy of this license is
-supposed to have been given to you along with X-CHESS so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:06 $
- * $Source: /home/ncvs/src/gnu/games/chess/Xchess/parse.c,v $
- * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
- * Permission is granted to do anything with this code except sell it
- * or remove this message.
- *
- * Parse a sequence of chess moves...
- */
-
-#include "xchess.h"
-
-bool loading_flag = false;
-bool loading_paused = false;
-
-static char *line;
-
-/* Load a record file in. This returns a number of things -- the board, the
- * list of moves, and whose turn it is.
- */
-
-void
-load_game(file)
- char *file;
-{
- FILE *fp;
- char buf[BSIZE];
- bool eflag;
- move *m;
- board *tmpboard = alloc(board);
-
- if (eq(file, "xchess.game") && saveflag) {
- message_add(win1,
- "Oops, I just overwrote the\nfile xchess.game...\n",
- true);
- message_add(win1, "I hope you had another copy.\n", true);
- return;
- }
- if (!(fp = fopen(file, "r"))) {
- perror(file);
- return;
- }
-
- /* Get a few lines... */
- fgets(buf, BSIZE, fp);
- message_add(win1, buf, false);
- if (!oneboard)
- message_add(win2, buf, false);
-
- fgets(buf, BSIZE, fp);
- message_add(win1, buf, false);
- if (!oneboard)
- message_add(win2, buf, false);
-
- fgets(buf, BSIZE, fp);
- if (eq(buf, "\tenglish\n"))
- eflag = true;
- else if (eq(buf, "\talgebraic\n"))
- eflag = false;
- else {
- fprintf(stderr, "Can't decide whether this is english...\n");
- return;
- }
-
- board_init(tmpboard);
- line = NULL;
- m = parse_file(fp, tmpboard, eflag);
- tfree(tmpboard);
-
- /* Now apply these moves to the board we were given... */
- loading_flag = true;
- while (m) {
- if (!quickflag)
- XSync(win1->display, 0);
- win_process(true);
- if (!quickflag)
- sleep(1);
- if (!loading_paused) {
- prog_move(m);
- m = m->next;
- }
- }
- loading_flag = false;
- if (line)
- message_add(win1, line, false);
-
- while (fgets(buf, BSIZE, fp))
- message_add(win1, buf, false);
-
- fclose(fp);
-
- return;
-}
-
-/* Given a starting position (usually the beginning board configuration),
- * read in a file of moves.
- */
-
-move *
-parse_file(fp, b, english)
- FILE *fp;
- board *b;
- bool english;
-{
- move *mvs = NULL, *end = NULL;
- char buf[BSIZE], *s, *t;
-
- while (fgets(buf, BSIZE, fp)) {
- if (*buf == '#')
- continue;
- s = buf;
-
- /* The move number... */
- if (!(t = gettok(&s)))
- break;
- if (!isdigit(*t)) {
- line = copy(buf);
- break;
- }
-
- if (!(t = gettok(&s)))
- break;
- if (end)
- end = end->next = (english ? parse_move(b, t, WHITE) :
- parse_imove(b, t, WHITE));
- else
- mvs = end = (english ? parse_move(b, t, WHITE) :
- parse_imove(b, t, WHITE));
- if (!end) {
- fprintf(stderr, "Can't parse %s\n", buf);
- return (NULL);
- }
- board_move(b, end);
-
- if (!(t = gettok(&s)))
- break;
- if (end)
- end = end->next = (english ? parse_move(b, t, BLACK) :
- parse_imove(b, t, BLACK));
- else
- mvs = end = (english ? parse_move(b, t, BLACK) :
- parse_imove(b, t, BLACK));
- if (!end) {
- fprintf(stderr, "Can't parse %s\n", buf);
- return (NULL);
- }
- board_move(b, end);
- }
-
- return (mvs);
-}
-
-/* Parse a move. The move format accepted is as follows -
- * move: spec-spec
- * capture: specxspec
- * kcastle: 2 o's
- * qcastle: 3 o's
- * A spec is either piece/pos, piece, or just pos. A pos consists of a column
- * name followed by a row number. If the column name is kr, kn, kb, k, q,
- * qb, qn, or qr, then the row number is according to the english system,
- * or if it is a-h then it is according to the international system.
- *
- *** As of now the spec must include the position.
- */
-
-move *
-parse_move(b, str, w)
- board *b;
- char *str;
- color w;
-{
- move *m = alloc(move);
- char *s;
- char spec1[16], spec2[16];
- int i, j;
-
-if (debug) fprintf(stderr, "parsing %s\n", str);
-
- /* Check for castles. */
- for (s = str, i = 0; *s; s++)
- if ((*s == 'o') || (*s == 'O'))
- i++;
- if (i == 2) {
- m->type = KCASTLE;
- m->piece.type = KING;
- m->piece.color = w;
- return (m);
- } else if (i == 3) {
- m->type = QCASTLE;
- m->piece.type = KING;
- m->piece.color = w;
- return (m);
- }
- if (index(str, '-'))
- m->type = MOVE;
- else if (index(str, 'x'))
- m->type = CAPTURE;
- else
- return (NULL);
- for (i = 0; str[i]; i++)
- if ((str[i] == 'x') || (str[i] == '-'))
- break;
- else
- spec1[i] = str[i];
- spec1[i] = '\0';
- for (i++, j = 0; str[i]; i++, j++)
- if ((str[i] == 'x') || (str[i] == '-'))
- break;
- else
- spec2[j] = str[i];
- spec2[j] = '\0';
-
- /* Now decode the specifications. */
- s = spec1;
- switch (*s) {
- case 'p': case 'P':
- m->piece.type = PAWN; break;
- case 'r': case 'R':
- m->piece.type = ROOK; break;
- case 'n': case 'N':
- m->piece.type = KNIGHT; break;
- case 'b': case 'B':
- m->piece.type = BISHOP; break;
- case 'q': case 'Q':
- m->piece.type = QUEEN; break;
- case 'k': case 'K':
- m->piece.type = KING; break;
- default:
- return (NULL);
- }
- m->piece.color = w;
- s += 2;
-
- /* Now get the {q,k}{,b,n,r}n string... */
- if ((s[0] == 'q') && (s[1] == 'r'))
- m->fromx = 0, s += 2;
- else if ((s[0] == 'q') && (s[1] == 'n'))
- m->fromx = 1, s += 2;
- else if ((s[0] == 'q') && (s[1] == 'b'))
- m->fromx = 2, s += 2;
- else if ((s[0] == 'q') && isdigit(s[1]))
- m->fromx = 3, s += 1;
- else if ((s[0] == 'k') && isdigit(s[1]))
- m->fromx = 4, s += 1;
- else if ((s[0] == 'k') && (s[1] == 'b'))
- m->fromx = 5, s += 2;
- else if ((s[0] == 'k') && (s[1] == 'n'))
- m->fromx = 6, s += 2;
- else if ((s[0] == 'k') && (s[1] == 'r'))
- m->fromx = 7, s += 2;
- m->fromy = ((w == WHITE) ? (SIZE - atoi(s)) : (atoi(s) - 1));
-
- if ((b->square[m->fromy][m->fromx].color != w) ||
- (b->square[m->fromy][m->fromx].type != m->piece.type)) {
- fprintf(stderr, "Error: bad stuff\n");
- return (NULL);
- }
-
- s = spec2;
- if (m->type == CAPTURE) {
- switch (*s) {
- case 'p': case 'P':
- m->taken.type = PAWN; break;
- case 'r': case 'R':
- m->taken.type = ROOK; break;
- case 'n': case 'N':
- m->taken.type = KNIGHT; break;
- case 'b': case 'B':
- m->taken.type = BISHOP; break;
- case 'q': case 'Q':
- m->taken.type = QUEEN; break;
- case 'k': case 'K':
- m->taken.type = KING; break;
- default:
- return (NULL);
- }
- m->taken.color = ((w == WHITE) ? BLACK : WHITE);
- s += 2;
- }
-
- /* Now get the {q,k}{,b,n,r}n string... */
- if ((s[0] == 'q') && (s[1] == 'r'))
- m->tox = 0, s += 2;
- else if ((s[0] == 'q') && (s[1] == 'n'))
- m->tox = 1, s += 2;
- else if ((s[0] == 'q') && (s[1] == 'b'))
- m->tox = 2, s += 2;
- else if ((s[0] == 'q') && isdigit(s[1]))
- m->tox = 3, s += 1;
- else if ((s[0] == 'k') && isdigit(s[1]))
- m->tox = 4, s += 1;
- else if ((s[0] == 'k') && (s[1] == 'b'))
- m->tox = 5, s += 2;
- else if ((s[0] == 'k') && (s[1] == 'n'))
- m->tox = 6, s += 2;
- else if ((s[0] == 'k') && (s[1] == 'r'))
- m->tox = 7, s += 2;
- m->toy = ((w == WHITE) ? (SIZE - atoi(s)) : (atoi(s) - 1));
-
- if ((m->type == CAPTURE) && ((b->square[m->toy][m->tox].color !=
- m->taken.color) || (b->square[m->toy][m->tox].type !=
- m->taken.type))) {
- fprintf(stderr, "Error: bad stuff\n");
- return (NULL);
- }
-
- return (m);
-}
-
-/* Parse an algebraic notation move. This is a lot easier... */
-
-move *
-parse_imove(b, buf, w)
- board *b;
- char *buf;
- color w;
-{
- char *s;
- move *m = alloc(move);
- int n;
-
-if (debug) fprintf(stderr, "(alg) parsing %s\n", buf);
-
- for (s = buf, n = 0; *s; s++)
- if ((*s == 'o') || (*s == 'O'))
- n++;
- s = buf;
-
- if (n == 2)
- m->type = KCASTLE;
- else if (n == 3)
- m->type = QCASTLE;
- else {
- m->fromx = *s++ - 'a';
- m->fromy = SIZE - (*s++ - '0');
- m->tox = *s++ - 'a';
- m->toy = SIZE - (*s++ - '0');
- m->piece = b->square[m->fromy][m->fromx];
- m->taken = b->square[m->toy][m->tox];
- if (m->taken.color == NONE)
- m->type = MOVE;
- else
- m->type = CAPTURE;
- /* for pawns we must account for en passant */
- if (m->piece.type == PAWN) {
- if (m->type == MOVE && m->fromx != m->tox) {
- m->enpassant = 1;
- m->type = CAPTURE;
- }
- }
- }
-
- if (m->piece.color != w) {
- fprintf(stderr, "Error: parse_imove: piece of wrong color!\n");
- return (NULL);
- }
- if ((m->piece.type == KING) && (m->fromy == m->toy) && (m->fromx == 4)
- && (m->tox == 6))
- m->type = KCASTLE;
- else if ((m->piece.type == KING) && (m->fromy == m->toy) &&
- (m->fromx == 4) && (m->tox == 2))
- m->type = QCASTLE;
-
- return (m);
-}
-
diff --git a/gnu/games/chess/Xchess/popup.c b/gnu/games/chess/Xchess/popup.c
deleted file mode 100644
index 0995638..0000000
--- a/gnu/games/chess/Xchess/popup.c
+++ /dev/null
@@ -1,112 +0,0 @@
-
-/* This file contains code for X-CHESS.
- Copyright (C) 1986 Free Software Foundation, Inc.
-
-This file is part of X-CHESS.
-
-X-CHESS is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the X-CHESS General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-X-CHESS, but only under the conditions described in the
-X-CHESS General Public License. A copy of this license is
-supposed to have been given to you along with X-CHESS so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:13 $
- * $Source: /home/ncvs/src/gnu/games/chess/Xchess/popup.c,v $
- * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
- * faustus@cad.berkeley.edu, ucbvax!faustus
- * Permission is granted to modify and re-distribute this code in any manner
- * as long as this notice is preserved. All standard disclaimers apply.
- *
- * A simple pop-up menu system.
- */
-
-#include "xchess.h"
-
-/* Open a small window with some text in it and two buttons -- yes and no.
- * Use black and white pixel, and the medium font.
- */
-
-bool
-pop_question(win, text)
- windata *win;
- char *text;
-{
- char *s, *t;
- int nlines = 1, ncols = 0, i = 0, j;
- int x, y;
- Window w;
- bool ch;
- XEvent ev;
-
- for (s = text; *s; s++) {
- if ((*s == '\n') && s[1])
- nlines++;
- if ((*s == '\n') || !s[1]) {
- if (i > ncols)
- ncols = i;
- i = 0;
- } else
- i++;
- }
-
- if (ncols < 12)
- ncols = 12;
- nlines += 4;
- ncols += 4;
-
- x = (BASE_WIDTH - ncols * win->medium->max_bounds.width) / 2;
- y = (BASE_HEIGHT - nlines * win->medium->max_bounds.ascent) / 2;
-
- w = XCreateSimpleWindow(win->display, win->basewin,
- x, y, ncols * win->medium->max_bounds.width,
- nlines * win->medium->ascent,
- BORDER_WIDTH, win->border.pixel,
- win->textback.pixel);
- XMapRaised(win->display, w);
- XSetFont(win->display, DefaultGC(win->display, 0),
- win->medium->fid);
-
- for (i = 0, s = text; i < nlines - 4; i++) {
- for (t = s, j = 0; *t && (*t != '\n'); t++, j++)
- ;
- XDrawString(win->display, w, DefaultGC(win->display, 0),
- (ncols - j) / 2 * win->medium->max_bounds.width,
- (i + 1) * win->medium->ascent,
- s, j);
- s = t + 1;
- }
- XDrawString(win->display, w, DefaultGC(win->display, 0),
- (ncols - 8) * win->medium->max_bounds.width / 4,
- (nlines - 2) * win->medium->ascent,
- "YES", 3);
- XDrawString(win->display, w, DefaultGC(win->display, 0),
- (ncols - 4) * win->medium->max_bounds.width * 3 / 4,
- (nlines - 2) * win->medium->ascent,
- "NO", 2);
-
- XSync(win->display, 0);
- XSelectInput(win->display, w, ButtonPressMask);
- XWindowEvent(win->display, w, ButtonPressMask, &ev);
- x = ev.xkey.x;
- y = ev.xkey.y;
-
- if (x > ncols * win->medium->max_bounds.width / 2)
- ch = false;
- else
- ch = true;
-
- XDestroyWindow(win->display, w);
- XSync(win->display, 0);
- return (ch);
-}
-
diff --git a/gnu/games/chess/Xchess/program.c b/gnu/games/chess/Xchess/program.c
deleted file mode 100644
index e2eb186..0000000
--- a/gnu/games/chess/Xchess/program.c
+++ /dev/null
@@ -1,204 +0,0 @@
-
-/* This file contains code for X-CHESS.
- Copyright (C) 1986 Free Software Foundation, Inc.
-
-This file is part of X-CHESS.
-
-X-CHESS is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the X-CHESS General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-X-CHESS, but only under the conditions described in the
-X-CHESS General Public License. A copy of this license is
-supposed to have been given to you along with X-CHESS so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-/* RCS Info: $Revision: 1.3 $ on $Date: 1994/11/04 02:11:30 $
- * $Source: /home/ncvs/src/gnu/games/chess/Xchess/program.c,v $
- * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
- * Permission is granted to do anything with this code except sell it
- * or remove this message.
- *
- * The interface to whichever chess playing program we are using...
- */
-
-#include "xchess.h"
-#include <signal.h>
-#include <sys/time.h>
-
-static int pid;
-static FILE *from;
-static FILE *to;
-static bool easy = 1;
-
-bool
-program_init(name)
- char *name;
-{
- int toprog[2], fromprog[2];
- char buf[BSIZE];
- char time[10];
- char moves[10];
-
- pipe(toprog);
- pipe(fromprog);
-
- if (!(pid = fork())) {
- /* Start up the program. */
- dup2(toprog[0], 0);
- dup2(fromprog[1], 1);
- close(toprog[0]);
- close(toprog[1]);
- close(fromprog[0]);
- close(fromprog[1]);
- sprintf (time, "%d", timeunit/60);
- sprintf (moves, "%d", movesperunit);
- if (proghost)
- execl("/usr/ucb/rsh", "rsh", proghost, name,
- moves, time,
- (char *) NULL);
- else
- execl(name, name, moves, time, (char *) NULL);
- perror(name);
- exit(1);
- }
-
- close(toprog[0]);
- close(fromprog[1]);
-
- from = fdopen(fromprog[0], "r");
- setbuf(from, NULL);
- to = fdopen(toprog[1], "w");
- setbuf(to, NULL);
-
- /* Get the first line... */
- fgets(buf, BSIZE, from);
- if (debug)
- fprintf(stderr, "program says %s", buf);
- if (blackflag) {
- fputs("switch\n", to);
- fflush(to);
- fgets(buf, BSIZE, from);
- if (debug)
- fprintf(stderr, "program says %s", buf);
- message_add(win1, "GNU Chess playing white\n", false);
- } else
- message_add(win1, "GNU Chess playing black\n", false);
-
- return (true);
-}
-
-void
-program_end()
-{
- fclose(from);
- fclose(to);
- kill(pid, SIGTERM);
- return;
-}
-
-void
-program_send(m)
- move *m;
-{
- char buf[BSIZE];
-
- if ((m->type == MOVE) || (m->type == CAPTURE))
- sprintf(buf, "%c%d%c%d\n", 'a' + m->fromx, SIZE - m->fromy,
- 'a' + m->tox, SIZE - m->toy);
- else if (m->type == KCASTLE)
- strcpy(buf, (m->piece.color == WHITE) ? "e1g1\n" : "e8g8\n");
- else if (m->type == QCASTLE)
- strcpy(buf, (m->piece.color == WHITE) ? "e1c1\n" : "e8c8\n");
-
- if (debug)
- fprintf(stderr, "sending program %s", buf);
- if (!easy)
- kill (pid, SIGINT);
-
- fputs(buf, to);
- fflush(to);
-
- /* One junk line... */
- fgets(buf, BSIZE, from);
- if (debug)
- fprintf(stderr, "program says %s", buf);
- return;
-}
-
-move *
-program_get()
-{
- int rfd = (1 << fileno(from)), wfd = 0, xfd = 0;
- static struct timeval notime = { 0, 0 };
- char buf[BSIZE], *s;
- move *m;
- int i;
-
- /* Do a poll... */
-
-#ifdef __FreeBSD__
- if (!(i = select(32, &rfd, &wfd, &xfd, &notime))) {
-#else
- if (!(i = select(32, &rfd, &wfd, &xfd, &notime)) &&
- !from->_cnt) { /* Bad stuff... */
-#endif
- if (debug)
- fprintf(stderr, "poll: nothing\n");
- return (NULL);
- }
- if (i == -1) {
- perror("select");
- return (NULL);
- }
-
- fgets(buf, BSIZE, from);
- if (*buf == '\n' || *buf == '\0') {
- message_add(win1, "program died", false);
- return (NULL);
- }
-
- if (debug)
- fprintf(stderr, "got from program %s", buf);
-
- for (s = buf; !isalpha(*s); s++)
- ;
- m = parse_imove(chessboard, s, nexttomove);
- if (m == NULL)
- return (NULL);
-
- if (!valid_move(m, chessboard)) {
- fprintf(stderr, "Error: move %s is invalid!!\n", buf);
- return (NULL);
- }
-
- /*
- fgets(buf, BSIZE, from);
- if (debug)
- fprintf(stderr, "program says %s", buf);
- */
- message_add(win1, buf, false);
- return (m);
-}
-
-void
-program_undo()
-{
- fputs("undo\n", to);
- return;
-}
-void
-program_easy (mode)
- bool mode;
-
-{
- fputs("easy\n", to);
- easy = mode;
-}
diff --git a/gnu/games/chess/Xchess/record.c b/gnu/games/chess/Xchess/record.c
deleted file mode 100644
index b2fcea1..0000000
--- a/gnu/games/chess/Xchess/record.c
+++ /dev/null
@@ -1,315 +0,0 @@
-
-/* This file contains code for X-CHESS.
- Copyright (C) 1986 Free Software Foundation, Inc.
-
-This file is part of X-CHESS.
-
-X-CHESS is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the X-CHESS General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-X-CHESS, but only under the conditions described in the
-X-CHESS General Public License. A copy of this license is
-supposed to have been given to you along with X-CHESS so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:09 $
- * $Source: /home/ncvs/src/gnu/games/chess/Xchess/record.c,v $
- * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
- * Permission is granted to do anything with this code except sell it
- * or remove this message.
- *
- * Deal with recording moves.
- */
-
-#include "xchess.h"
-
-#undef smartass
-
-bool record_english = true;
-char *record_file = DEF_RECORD_FILE;
-int movenum = 0;
-bool saveflag = false;
-
-static char *colnames[] = { "qr", "qn", "qb", "q", "k", "kb", "kn", "kr" } ;
-static char *pcnames[] = { "P", "R", "N", "B", "Q", "K" } ;
-
-static char *movestring();
-static char *tstring();
-static FILE *backup;
-
-#define RECORD_HEADER "\n1 XChess Game Record0\n"
-
-void
-record_init(win)
- windata *win;
-{
- int i;
-
- i = XTextWidth(win->medium, RECORD_HEADER,
- sizeof(RECORD_HEADER) - 1);
- i = (40 * win->small->max_bounds.width - i *
- win->medium->max_bounds.width) /
- win->medium->max_bounds.width / 2;
- TxtGrab(win->display, win->recwin, "xchess", win->small, win->textback.pixel,
- win->textcolor.pixel, win->cursorcolor.pixel);
- TxtAddFont(win->display, win->recwin, 1, win->medium, win->textcolor.pixel);
- for (; i > 0; i++)
- TxtWriteStr(win->display, win->recwin, " ");
- TxtWriteStr(win->display, win->recwin, RECORD_HEADER);
-
- if (saveflag) {
- if (!(backup = fopen(record_file, "w"))) {
- perror(record_file);
- saveflag = false;
- } else {
- fprintf(backup, "X Chess -- %s\n", datestring());
- if (dispname2)
- fprintf(backup, "\tWhite on %s, black on %s\n",
- dispname1, dispname2);
- else
- fprintf(backup, "\tGame played on %s\n",
- dispname1);
- fprintf(backup, "\t%s\n", record_english ? "english" :
- "algebraic");
- fflush(backup);
- }
- }
-
- movenum = 0;
- return;
-}
-
-void
-record_reset()
-{
- TxtWriteStr(win1->display, win1->recwin, "\n\n1 New Game0\n\n");
- if (!oneboard) {
- TxtWriteStr(win2->display, win2->recwin, "\n\n1 New Game0\n\n");
- }
- movenum = 0;
- if (saveflag) {
- fprintf(backup, "\n\nNew Game\n\n");
- fflush(backup);
- }
- return;
-}
-
-void
-record_end(s)
- char *s;
-{
- char buf[BSIZE];
-
- sprintf(buf, "\n%s\n", s);
- TxtWriteStr(win1->display, win1->recwin, s);
- if (!oneboard) {
- TxtWriteStr(win2->display, win2->recwin, s);
- }
- if (saveflag) {
- fprintf(backup, "\n%s\n", s);
- fprintf(backup, "Time: white: %s, ", tstring(whiteseconds));
- fprintf(backup, "black: %s\n", tstring(blackseconds));
- fclose(backup);
- }
- return;
-}
-
-void
-record_save()
-{
- move *m;
- FILE *fp;
- int i;
- char *s;
-
- if (!(fp = fopen(record_file, "w"))) {
- perror(record_file);
- return;
- }
- fprintf(fp, "X Chess -- %s\n", datestring());
- if (dispname2)
- fprintf(fp, "\tWhite on %s, black on %s\n",
- dispname1, dispname2);
- else
- fprintf(fp, "\tGame played on %s\n", dispname1);
- fprintf(fp, "\t%s\n", record_english ? "english" : "algebraic");
-
- for (m = moves, i = 1; m; i++) {
- s = movestring(m);
- fprintf(fp, "%2d. %-16s ", i, s);
- m = m->next;
- if (m)
- s = movestring(m);
- else
- s = "";
- fprintf(fp, "%s\n", s);
- if (m)
- m = m->next;
- }
- fclose(fp);
- return;
-}
-
-void
-record_move(m)
- move *m;
-{
- char *s, buf[BSIZE];
-
- s = movestring(m);
-
- if (m->piece.color == WHITE) {
- movenum++;
- sprintf(buf, "%2d. %-16s ", movenum, s);
- } else {
- sprintf(buf, "%s\n", s);
- }
- TxtWriteStr(win1->display, win1->recwin, buf);
- if (!oneboard) {
- TxtWriteStr(win2->display, win2->recwin, buf);
- }
- if (saveflag) {
- fprintf(backup, "%s", buf);
- fflush(backup);
- }
-
- return;
-}
-
-void
-record_back()
-{
- extern move *lastmove;
- move *m = lastmove;
- char *s = movestring(m);
- char buf[BSIZE];
- long i;
-
- if (m->piece.color == WHITE) {
- sprintf(buf, "%2d. %-16s ", movenum, s);
- } else {
- sprintf(buf, "%s\n", s);
- }
- s = buf;
- for (i = 0; *s != '\0'; i++)
- *s++ = ''; /* control H, backspace */
-
- TxtWriteStr(win1->display, win1->recwin, buf);
- if (!oneboard) {
- TxtWriteStr(win2->display, win2->recwin, buf);
- }
-
- if (nexttomove == BLACK)
- movenum--;
- if (saveflag) {
- fseek(backup, -i, 1);
- fflush(backup);
- }
-
- return;
-}
-
-static char *
-movestring(m)
- move *m;
-{
- int fy, ty;
- static char buf[BSIZE];
-
- if (!record_english || (m->piece.color == WHITE)) {
- fy = SIZE - m->fromy;
- ty = SIZE - m->toy;
- } else {
- fy = m->fromy + 1;
- ty = m->toy + 1;
- }
-
- switch (m->type) {
- case MOVE:
- if (record_english)
- sprintf(buf, "%s/%s%d-%s%d%s", pcnames[(int) m->piece.
- type], colnames[m->fromx], fy,
- colnames[m->tox], ty, m->check ? "+" :
- "");
- else
- sprintf(buf, "%c%d%c%d", 'a' + m->fromx, fy, 'a' +
- m->tox, ty);
- break;
- case CAPTURE:
- if (record_english)
- sprintf(buf, "%s/%s%dx%s/%s%d%s%s",
- pcnames[(int) m->piece.type],
- colnames[m->fromx], fy,
- pcnames[(int) m->taken.type],
- colnames[m->tox], ty,
- m->enpassant ? "e.p." : "",
- m->check ? "+" : "");
- else
- sprintf(buf, "%c%d%c%d", 'a' + m->fromx, fy, 'a' +
- m->tox, ty);
- break;
-
- case KCASTLE:
- if (record_english)
- sprintf(buf, "O-O%s", m->check ? "ch" : "");
- else if (m->piece.color == WHITE)
- strcpy(buf, "e1g1");
- else
- strcpy(buf, "e8g8");
- break;
-
- case QCASTLE:
- if (record_english)
- sprintf(buf, "O-O-O%s", m->check ? "ch" : "");
- else if (m->piece.color == WHITE)
- strcpy(buf, "e1c1");
- else
- strcpy(buf, "e8c8");
- break;
-
- default:
- sprintf(buf, "something strange");
- break;
- }
- if ((m->piece.type == PAWN) && (((m->piece.color == BLACK) &&
- (m->toy == 7)) || ((m->piece.color == WHITE) &&
- (m->toy == 0))))
- strcat(buf, "(Q)");
-
-#ifdef smartass
- if (!(random() % 50))
- strcat(buf, "?");
- else if (!(random() % 50))
- strcat(buf, "!");
- else if (!(random() % 500))
- strcat(buf, "???");
- else if (!(random() % 500))
- strcat(buf, "!!!");
-#endif smartass
-
- return (buf);
-}
-
-static char *
-tstring(s)
- int s;
-{
- static char buf[64];
-
- if (s > 3600)
- sprintf(buf, "%dh %dm %ds", s / 3600, (s % 3600) / 60, s % 60);
- else if (s > 60)
- sprintf(buf, "%dm %ds", (s % 3600) / 60, s % 60);
- else
- sprintf(buf, "%ds", s);
- return (buf);
-}
-
diff --git a/gnu/games/chess/Xchess/scrollText.c b/gnu/games/chess/Xchess/scrollText.c
deleted file mode 100644
index b8484dd..0000000
--- a/gnu/games/chess/Xchess/scrollText.c
+++ /dev/null
@@ -1,1877 +0,0 @@
-/*
- * A Scrollable Text Output Window
- *
- * David Harrison
- * University of California, Berkeley
- * 1986
- *
- * The following is an implementation for a scrollable text output
- * system. It handles exposure events only (other interactions are
- * under user control). For scrolling, a always present scroll bar
- * is implemented. It detects size changes and compensates accordingly.
- */
-
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/X10.h>
-#include <sys/types.h>
-#include "scrollText.h"
-
-extern char *malloc();
-extern char *realloc();
-#define alloc(type) (type *) malloc(sizeof(type))
-#define numalloc(type, num) (type *) malloc((unsigned) (num * sizeof(type)))
-#define MAXINT 2147483647
-
-extern XAssocTable *XCreateAssocTable();
-extern caddr_t XLookUpAssoc();
-
-static XAssocTable *textWindows = (XAssocTable *) 0;
-
-#define NOOPTION -1 /* Option hasn't been set yet */
-#define NORMSCROLL 0 /* Smooth scroll on LineToTop and TopToHere */
-#define JUMPSCROLL 1 /* Jump scrolling on LineToTop and TopToHere */
-
-static int ScrollOption = NOOPTION;
-
-typedef char *Generic;
-
-#define DEFAULT_GC textInfo->fontGC[textInfo->curFont]
-
-#define BARSIZE 15
-#define BARBORDER 1
-#define MAXFONTS 8
-#define INITBUFSIZE 1024
-#define INITLINES 50
-#define INITEXPARY 50
-#define XPADDING 2
-#define YPADDING 2
-#define INTERLINE 5
-#define INTERSPACE 1
-#define CURSORWIDTH 2
-#define EXPANDPERCENT 40
-#define BUFSIZE 1024
-#define CUROFFSET 1
-#define MAXFOREIGN 250
-#define NOINDEX -1
-
-/* The wrap line indicator */
-#define WRAPINDSIZE 7
-#define STEMOFFSET 5
-#define arrow_width 7
-#define arrow_height 5
-static char arrow_bits[] = {
- 0x24, 0x26, 0x3f, 0x06, 0x04};
-
-#define NEWLINE '\n'
-#define BACKSPACE '\010'
-#define NEWFONT '\006'
-#define LOWCHAR '\040'
-#define HIGHCHAR '\176'
-
-#define CHARMASK 0x00ff /* Character mask */
-#define FONTMASK 0x0700 /* Character font */
-#define FONTSHIFT 8 /* Shift amount */
-
-#define WRAPFLAG 0x01 /* Line wrap flag */
-
-/*
- * Lines are represented by a pointer into the overall array of
- * 16-bit characters. The lower eight bits is used to indicate the character
- * (in ASCII), and the next two bits are used to indicate the font
- * the character should be drawn in.
- */
-
-typedef struct txtLine {
- int lineLength; /* Current line length */
- int lineHeight; /* Full height of line in pixels */
- int lineBaseLine; /* Current baseline of the line */
- int lineWidth; /* Drawing position at end of line */
- int lineText; /* Offset into master buffer */
- int lineFlags; /* Line wrap flag is here */
-};
-
-
-/*
- * For ExposeCopy events, we queue up the redraw requests collapsing
- * them into line redraw requests until the CopyExpose event arrives.
- * The queue is represented as a dynamic array of the following
- * structure:
- */
-
-typedef struct expEvent {
- int lineIndex; /* Index of line to redraw */
- int ypos; /* Drawing position of line */
-};
-
-
-/*
- * The text buffer is represented using a dynamic counted array
- * of 16-bit quantities. This array expands as needed.
- * For the screen representation, a dynamic counted array
- * of line structures is used. This array points into the
- * text buffer to denote the start of each line and its parameters.
- * The windows are configured as one overall window which contains
- * the scroll bar as a sub-window along its right edge. Thus,
- * the text drawing space is actually w-BARSIZE.
- */
-
-#define NOTATBOTTOM 0x01 /* Need to scroll to bottom before appending */
-#define FONTNUMWAIT 0x02 /* Waiting for font number */
-#define COPYEXPOSE 0x04 /* Need to process a copy expose event */
-#define SCREENWRONG 0x08 /* TxtJamStr has invalidated screen contents */
-
-typedef struct txtWin {
- /* Basic text buffer */
- int bufAlloc; /* Allocated size of buffer */
- int bufSpot; /* Current writing position in buffer */
- short *mainBuffer; /* Main buffer of text */
-
- /* Line information */
- int numLines; /* Number of display lines in buffer */
- int allocLines; /* Number of lines allocated */
- struct txtLine **txtBuffer; /* Dynamic array of lines */
-
- /* Current Window display information */
- Window mainWindow; /* Text display window */
- Window scrollBar; /* Subwindow for scroll bar */
- Pixmap arrowMap; /* line wrap indicator */
- int bgPix, fgPix; /* Background and cursor */
- GC CursorGC; /* gc for the cursor */
- GC bgGC; /* gc for erasing things */
- GC fontGC[MAXFONTS]; /* gc for doing fonts */
- XFontStruct theFonts[MAXFONTS];/* Display fonts */
- int theColors[MAXFONTS]; /* foregrounds of the fonts */
- int curFont; /* current font for tracking */
- int w, h; /* Current size */
- int startLine; /* Top line in display */
- int endLine; /* Bottom line in display */
- int bottomSpace; /* Space at bottom of screen */
- int flagWord; /* If non-zero, not at end */
-
- /* For handling ExposeCopy events */
- int exposeSize; /* Current size of array */
- int exposeAlloc; /* Allocated size */
- struct expEvent **exposeAry;/* Array of line indices */
-
- /* Drawing position information */
- int curLine; /* Current line in buffer */
- int curX; /* Current horizontal positi */
- int curY; /* Current vertical drawing */
-};
-
-/* Flags for the various basic character handling functions */
-
-#define DODISP 0x01 /* Update the display */
-#define NONEWLINE 0x02 /* Dont append newline */
-
-
-
-static int InitLine(newLine)
-struct txtLine *newLine; /* Newly created line structure */
-/*
- * This routine initializes a newly created line structure.
- */
-{
- newLine->lineLength = 0;
- newLine->lineHeight = 0;
- newLine->lineBaseLine = 0;
- newLine->lineWidth = XPADDING;
- newLine->lineText = NOINDEX;
- newLine->lineFlags = 0;
- return 1;
-}
-
-
-
-
-int TxtGrab(display, txtWin, program, mainFont, bg, fg, cur)
-Display *display; /* display window is on */
-Window txtWin; /* Window to take over as scrollable text */
-char *program; /* Program name for Xdefaults */
-XFontStruct *mainFont; /* Primary text font */
-int bg, fg, cur; /* Background, foreground, and cursor colors */
-/*
- * This routine takes control of 'txtWin' and makes it into a scrollable
- * text output window. It will create a sub-window for the scroll bar
- * with a background of 'bg' and an bar with color 'fg'. Both fixed width
- * and variable width fonts are supported. Additional fonts can be loaded
- * using 'TxtAddFont'. Returns 0 if there were problems, non-zero if
- * everything went ok.
- */
-{
- struct txtWin *newWin; /* Text package specific information */
- XWindowAttributes winInfo; /* Window information */
- int index;
- XGCValues gc_val;
-
- if (textWindows == (XAssocTable *) 0) {
- textWindows = XCreateAssocTable(32);
- if (textWindows == (XAssocTable *) 0) return(0);
- }
- if (XGetWindowAttributes(display, txtWin, &winInfo) == 0) return 0;
-
- if (ScrollOption == NOOPTION) {
- /* Read to see if the user wants jump scrolling or not */
- if (XGetDefault(display, program, "JumpScroll")) {
- ScrollOption = JUMPSCROLL;
- } else {
- ScrollOption = NORMSCROLL;
- }
- }
-
- /* Initialize local structure */
- newWin = alloc(struct txtWin);
-
- /* Initialize arrow pixmap */
- newWin->arrowMap = XCreatePixmapFromBitmapData(display, txtWin,
- arrow_bits,
- arrow_width, arrow_height,
- cur, bg,
- DisplayPlanes(display, 0));
-
- newWin->bufAlloc = INITBUFSIZE;
- newWin->bufSpot = 0;
- newWin->mainBuffer = numalloc(short, INITBUFSIZE);
-
- newWin->numLines = 1;
- newWin->allocLines = INITLINES;
- newWin->txtBuffer = numalloc(struct txtLine *, INITLINES);
- for (index = 0; index < INITLINES; index++) {
- newWin->txtBuffer[index] = alloc(struct txtLine);
- InitLine(newWin->txtBuffer[index]);
- }
-
- /* Window display information */
- newWin->mainWindow = txtWin;
- newWin->w = winInfo.width;
- newWin->h = winInfo.height;
- newWin->startLine = 0;
- newWin->endLine = 0;
- newWin->bottomSpace = winInfo.height
- - YPADDING - mainFont->ascent - mainFont->descent - INTERLINE;
- newWin->flagWord = 0;
- newWin->bgPix = bg;
- newWin->fgPix = fg;
-
- /* Scroll Bar Creation */
- newWin->scrollBar = XCreateSimpleWindow(display, txtWin,
- winInfo.width - BARSIZE,
- 0, BARSIZE - (2*BARBORDER),
- winInfo.height - (2*BARBORDER),
- BARBORDER,
- fg, bg);
- XSelectInput(display, newWin->scrollBar, ExposureMask|ButtonReleaseMask);
- XMapRaised(display, newWin->scrollBar);
-
- /* Font and Color Initialization */
- newWin->theFonts[0] = *mainFont;
- newWin->theColors[0] = fg;
- gc_val.function = GXcopy;
- gc_val.plane_mask = AllPlanes;
- gc_val.foreground = fg;
- gc_val.background = bg;
- gc_val.graphics_exposures = 1;
- gc_val.font = mainFont->fid;
- gc_val.line_width = 1;
- gc_val.line_style = LineSolid;
-
- newWin->fontGC[0] = XCreateGC(display, txtWin,
- GCFunction | GCPlaneMask |
- GCForeground | GCBackground |
- GCGraphicsExposures | GCFont,
- &gc_val);
-
- gc_val.foreground = cur;
- newWin->CursorGC = XCreateGC(display, txtWin,
- GCFunction | GCPlaneMask |
- GCForeground | GCBackground |
- GCLineStyle | GCLineWidth,
- &gc_val);
-
- gc_val.foreground = bg;
- newWin->bgGC = XCreateGC(display, txtWin,
- GCFunction | GCPlaneMask |
- GCForeground | GCBackground |
- GCGraphicsExposures | GCFont,
- &gc_val);
-
-
- for (index = 1; index < MAXFONTS; index++) {
- newWin->theFonts[index].fid = 0;
- newWin->fontGC[index] = 0;
- }
-
-
- /* Initialize size of first line */
- newWin->txtBuffer[0]->lineHeight = newWin->theFonts[0].ascent +
- newWin->theFonts[0].descent;
- newWin->txtBuffer[0]->lineText = 0;
-
- /* ExposeCopy array initialization */
- newWin->exposeSize = 0;
- newWin->exposeAlloc = INITEXPARY;
- newWin->exposeAry = numalloc(struct expEvent *, INITEXPARY);
- for (index = 0; index < newWin->exposeAlloc; index++)
- newWin->exposeAry[index] = alloc(struct expEvent);
- /* Put plus infinity in last slot for sorting purposes */
- newWin->exposeAry[0]->lineIndex = MAXINT;
-
- /* Drawing Position Information */
- newWin->curLine = 0;
- newWin->curX = 0;
- newWin->curY = YPADDING + mainFont->ascent + mainFont->descent;
-
- /* Attach it to both windows */
- XMakeAssoc(display, textWindows, (XID) txtWin, (caddr_t) newWin);
- XMakeAssoc(display, textWindows, (XID) newWin->scrollBar, (caddr_t) newWin);
- return 1;
-}
-
-
-int TxtRelease(display, w)
-Display *display;
-Window w; /* Window to release */
-/*
- * This routine releases all resources associated with the
- * specified window which are consumed by the text
- * window package. This includes the entire text buffer, line start
- * array, and the scroll bar window. However, the window
- * itself is NOT destroyed. The routine will return zero if
- * the window is not owned by the text window package.
- */
-{
- struct txtWin *textInfo;
- int index;
-
- if ((textInfo = (struct txtWin *) XLookUpAssoc(display,
- textWindows, (XID) w)) == 0)
- return 0;
-
- for (index = 0; index < MAXFONTS; index++)
- if (textInfo->fontGC[index] != 0)
- XFreeGC(display, textInfo->fontGC[index]);
-
- free((Generic) textInfo->mainBuffer);
- for (index = 0; index < textInfo->numLines; index++) {
- free((Generic) textInfo->txtBuffer[index]);
- }
- free((Generic) textInfo->txtBuffer);
- XDestroyWindow(display, textInfo->scrollBar);
- for (index = 0; index < textInfo->exposeSize; index++) {
- free((Generic) textInfo->exposeAry[index]);
- }
- free((Generic) textInfo->exposeAry);
- XDeleteAssoc(display, textWindows, (XID) w);
- free((Generic) textInfo);
- return 1;
-}
-
-
-
-static int RecompBuffer(textInfo)
-struct txtWin *textInfo; /* Text window information */
-/*
- * This routine recomputes all line breaks in a buffer after
- * a change in window size or font. This is done by throwing
- * away the old line start array and recomputing it. Although
- * a lot of this work is also done elsewhere, it has been included
- * inline here for efficiency.
- */
-{
- int startPos, endSize, linenum;
- register int index, chsize, curfont;
- register short *bufptr;
- register XFontStruct *fontptr;
- register struct txtLine *lineptr;
- char theChar;
-
- /* Record the old position so we can come back to it */
- for (startPos = textInfo->txtBuffer[textInfo->startLine]->lineText;
- (startPos > 0) && (textInfo->mainBuffer[startPos] != '\n');
- startPos--)
- /* null loop body */;
-
- /* Clear out the old line start array */
- for (index = 0; index < textInfo->numLines; index++) {
- InitLine(textInfo->txtBuffer[index]);
- }
-
- /* Initialize first line */
- textInfo->txtBuffer[0]->lineHeight =
- textInfo->theFonts[0].ascent + textInfo->theFonts[0].descent;
- textInfo->txtBuffer[0]->lineText = 0;
-
- /* Process the text back into lines */
- endSize = textInfo->w - BARSIZE - WRAPINDSIZE;
- bufptr = textInfo->mainBuffer;
- lineptr = textInfo->txtBuffer[0];
- linenum = 0;
- fontptr = &(textInfo->theFonts[0]);
- curfont = 0;
- for (index = 0; index < textInfo->bufSpot; index++) {
- theChar = bufptr[index] & CHARMASK;
-
- if ((bufptr[index] & FONTMASK) != curfont) {
- int newFontNum, heightDiff;
-
- /* Switch fonts */
- newFontNum = (bufptr[index] & FONTMASK) >> FONTSHIFT;
- if (textInfo->theFonts[newFontNum].fid != 0) {
- /* Valid font */
- curfont = bufptr[index] & FONTMASK;
- fontptr = &(textInfo->theFonts[newFontNum]);
- heightDiff = (fontptr->ascent + fontptr->descent) -
- lineptr->lineHeight;
- if (heightDiff < 0) heightDiff = 0;
- lineptr->lineHeight += heightDiff;
- }
- }
- if (theChar == '\n') {
- /* Handle new line */
- if (linenum >= textInfo->allocLines-1)
- /* Expand number of lines */
- ExpandLines(textInfo);
- linenum++;
- lineptr = textInfo->txtBuffer[linenum];
- /* Initialize next line */
- lineptr->lineHeight = fontptr->ascent + fontptr->descent;
- lineptr->lineText = index+1;
- /* Check to see if its the starting line */
- if (index == startPos) textInfo->startLine = linenum;
- } else {
- /* Handle normal character */
- chsize = CharSize(textInfo, linenum, index);
- if (lineptr->lineWidth + chsize > endSize) {
- /* Handle line wrap */
- lineptr->lineFlags |= WRAPFLAG;
- if (linenum >= textInfo->allocLines-1)
- /* Expand number of lines */
- ExpandLines(textInfo);
- linenum++;
- lineptr = textInfo->txtBuffer[linenum];
- /* Initialize next line */
- lineptr->lineHeight = fontptr->ascent + fontptr->descent;
- lineptr->lineText = index;
- lineptr->lineLength = 1;
- lineptr->lineWidth += chsize;
- } else {
- /* Handle normal addition of character */
- lineptr->lineLength += 1;
- lineptr->lineWidth += chsize;
- }
- }
- }
- /* We now have a valid line array. Let's clean up some other fields. */
- textInfo->numLines = linenum+1;
- if (startPos == 0) {
- textInfo->startLine = 0;
- }
- textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace));
- textInfo->curLine = linenum;
- /* Check to see if we are at the bottom */
- if (textInfo->endLine >= textInfo->numLines-1) {
- textInfo->curY = textInfo->h - textInfo->bottomSpace -
- lineptr->lineHeight;
- textInfo->flagWord &= (~NOTATBOTTOM);
- } else {
- textInfo->flagWord |= NOTATBOTTOM;
- }
- return 1;
-}
-
-
-
-
-int TxtAddFont(display, textWin, fontNumber, newFont, newColor)
-Display *display;
-Window textWin; /* Scrollable text window */
-int fontNumber; /* Place to add font (0-7) */
-XFontStruct *newFont; /* Font to add */
-int newColor; /* Color of font */
-/*
- * This routine loads a new font so that it can be used in a previously
- * created text window. There are eight font slots numbered 0 through 7.
- * If there is already a font in the specified slot, it will be replaced
- * and an automatic redraw of the window will take place. See TxtWriteStr
- * for details on using alternate fonts. The color specifies the foreground
- * color of the text. The default foreground color is used if this
- * parameter is TXT_NO_COLOR. Returns a non-zero value if
- * everything went well.
- */
-{
- struct txtWin *textInfo;
- int redrawFlag;
- XGCValues gc_val;
-
- if ((fontNumber < 0) || (fontNumber >= MAXFONTS)) return 0;
- if ((textInfo = (struct txtWin *)
- XLookUpAssoc(display, textWindows, (XID) textWin)) == 0)
- return 0;
- if (newColor == TXT_NO_COLOR) {
- newColor = textInfo->fgPix;
- }
-
- gc_val.font = newFont->fid;
- gc_val.foreground = newColor;
- gc_val.background = textInfo->bgPix;
- gc_val.plane_mask = AllPlanes;
- gc_val.graphics_exposures = 1;
- gc_val.function = GXcopy;
-
- if (textInfo->fontGC[fontNumber] != 0)
- {
- XChangeGC(display, textInfo->fontGC[fontNumber],
- GCFont | GCForeground, &gc_val);
- }
- else
- textInfo->fontGC[fontNumber] = XCreateGC(display, textWin,
- GCFont |
- GCForeground |
- GCBackground |
- GCFunction |
- GCPlaneMask |
- GCGraphicsExposures,
- &gc_val);
-
-
- redrawFlag = (textInfo->theFonts[fontNumber].fid != 0) &&
- (((newFont) && (newFont->fid != textInfo->theFonts[fontNumber].fid)) ||
- (newColor != textInfo->theColors[fontNumber]));
- if (newFont) {
- textInfo->theFonts[fontNumber] = *newFont;
- }
- textInfo->theColors[fontNumber] = newColor;
-
- if (redrawFlag) {
- RecompBuffer(textInfo);
- XClearWindow(display, textWin);
- TxtRepaint(display, textWin);
- }
- return 1;
-}
-
-
-
-int TxtWinP(display, w)
-Display *display;
-Window w;
-/*
- * Returns a non-zero value if the window has been previously grabbed
- * using TxtGrab and 0 if it has not.
- */
-{
- if (XLookUpAssoc(display, textWindows, (XID) w))
- return(1);
- else return(0);
-}
-
-
-
-static int FindEndLine(textInfo, botSpace)
-struct txtWin *textInfo;
-int *botSpace;
-/*
- * Given the starting line in 'textInfo->startLine', this routine
- * determines the index of the last line that can be drawn given the
- * current size of the screen. If there are not enough lines to
- * fill the screen, the index of the last line will be returned.
- * The amount of empty bottom space is returned in 'botSpace'.
- */
-{
- int index, height, lineHeight;
-
- height = YPADDING;
- index = textInfo->startLine;
- while (index < textInfo->numLines) {
- lineHeight = textInfo->txtBuffer[index]->lineHeight + INTERLINE;
- if (height + lineHeight > textInfo->h) break;
- height += lineHeight;
- index++;
- }
- if (botSpace) {
- *botSpace = textInfo->h - height;
- }
- return index - 1;
-}
-
-
-
-static int UpdateScroll(display, textInfo)
-Display *display;
-struct txtWin *textInfo; /* Text window information */
-/*
- * This routine computes the current extent of the scroll bar
- * indicator and repaints the bar with the correct information.
- */
-{
- int top, bottom;
-
- if (textInfo->numLines > 1) {
- top = textInfo->startLine * (textInfo->h - 2*BARBORDER) /
- (textInfo->numLines - 1);
- bottom = textInfo->endLine * (textInfo->h - 2*BARBORDER) /
- (textInfo->numLines - 1);
- } else {
- top = 0;
- bottom = textInfo->h - (2*BARBORDER);
- }
-
- /* Draw it - make sure there is a little padding */
- if (top == 0) top++;
- if (bottom == textInfo->h-(2*BARBORDER)) bottom--;
-
- XFillRectangle(display, textInfo->scrollBar,
- textInfo->bgGC,
- 0, 0, BARSIZE, top-1);
-#ifdef __FreeBSD__
- XFillRectangle(display, textInfo->scrollBar,
- DEFAULT_GC, top, BARSIZE - (2*BARBORDER) - 2,
- BARSIZE, bottom - top);
-#else
- XFillRectangle(display, textInfo->scrollBar,
- DEFAULT_GC, top, BARSIZE - (2*BARBORDER) - 2,
- bottom - top);
-#endif
- XFillRectangle(display, textInfo->scrollBar, DEFAULT_GC,
- 0, bottom+1, BARSIZE,
- textInfo->h - (2 * BARBORDER) - bottom);
-
- return 1;
-}
-
-
-
-
-int TxtClear(display, w)
-Display *display;
-Window w;
-/*
- * This routine clears a scrollable text window. It resets the current
- * writing position to the upper left hand corner of the screen.
- * NOTE: THIS ALSO CLEARS THE CONTENTS OF THE TEXT WINDOW BUFFER AND
- * RESETS THE SCROLL BAR. Returns 0 if the window is not a text window.
- * This should be used *instead* of XClear.
- */
-{
- struct txtWin *textInfo;
- int index;
-
- if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w)) == 0)
- return 0;
-
- /* Zero out the arrays */
- textInfo->bufSpot = 0;
- for (index = 0; index < textInfo->numLines; index++) {
- InitLine(textInfo->txtBuffer[index]);
- }
- textInfo->txtBuffer[0]->lineHeight =
- textInfo->theFonts[textInfo->curFont].ascent +
- textInfo->theFonts[textInfo->curFont].descent;
-
- textInfo->numLines = 1;
- textInfo->startLine = 0;
- textInfo->endLine = 0;
- textInfo->curLine = 0;
- textInfo->curX = 0;
- textInfo->curY = YPADDING + textInfo->theFonts[textInfo->curFont].ascent
- + textInfo->theFonts[textInfo->curFont].descent;
-
- textInfo->bottomSpace = textInfo->h - YPADDING -
- textInfo->theFonts[textInfo->curFont].ascent - INTERLINE -
- textInfo->theFonts[textInfo->curFont].descent;
- /* Actually clear the window */
- XClearWindow(display, w);
-
- /* Draw the current cursor */
- XFillRectangle(display, w, textInfo->CursorGC,
- XPADDING + CUROFFSET, textInfo->curY,
- CURSORWIDTH,
- textInfo->theFonts[textInfo->curFont].ascent +
- textInfo->theFonts[textInfo->curFont].descent);
-
- /* Update the scroll bar */
- UpdateScroll(display, textInfo);
- return 1;
-}
-
-
-static int WarpToBottom(display, textInfo)
-Display *display;
-struct txtWin *textInfo; /* Text Information */
-/*
- * This routine causes the specified text window to display its
- * last screen of information. It updates the scroll bar
- * to the appropriate spot. The implementation scans backward
- * through the buffer to find an appropriate starting spot for
- * the window.
- */
-{
- int index, height, lineHeight;
-
- index = textInfo->numLines-1;
- height = 0;
- while (index >= 0) {
- lineHeight = textInfo->txtBuffer[index]->lineHeight + INTERLINE;
- if (height + lineHeight > textInfo->h) break;
- height += lineHeight;
- index--;
- }
- textInfo->startLine = index + 1;
- textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace));
- textInfo->curY = textInfo->h - textInfo->bottomSpace -
- textInfo->txtBuffer[textInfo->endLine]->lineHeight;
- XClearWindow(display, textInfo->mainWindow);
- TxtRepaint(display, textInfo->mainWindow);
- return 1;
-}
-
-
-
-static int UpdateExposures(display, textInfo)
-Display *display;
-struct txtWin *textInfo; /* Text window information */
-/*
- * Before a new scrolling action occurs, the text window package
- * must handle all COPYEXPOSE events generated by the last scrolling
- * action. This routine is called to do this. Foreign events (those
- * not handled by TxtFilter) are queued up and replaced on the queue
- * after the processing of the exposure events is complete.
- */
-{
-#if 0
- XEvent foreignQueue[MAXFOREIGN];
- int index, lastItem = 0;
-
- while (textInfo->flagWord & COPYEXPOSE) {
- XNextEvent(display, &(foreignQueue[lastItem]));
- if (!TxtFilter(display, &(foreignQueue[lastItem])))
- lastItem++;
- if (lastItem >= MAXFOREIGN) {
- printf("Too many foreign events to queue!\n");
- textInfo->flagWord &= (~COPYEXPOSE);
- }
- }
- for (index = 0; index < lastItem; index++) {
- XPutBackEvent(display, &(foreignQueue[index]));
- }
-#endif
- return 1;
-}
-
-
-static int ScrollDown(display,textInfo)
-Display *display;
-struct txtWin *textInfo; /* Text window information */
-/*
- * This routine scrolls the indicated text window down by one
- * line. The line below the current line must exist. The window
- * is scrolled so that the line below the last line is fully
- * displayed. This may cause many lines to scroll off the top.
- * Scrolling is done using XCopyArea. The exposure events should
- * be caught using ExposeCopy.
- */
-{
- int lineSum, index, targetSpace, freeSpace, updateFlag;
-
- lineSum = 0;
- if (textInfo->endLine + 1 >= textInfo->numLines) return 0;
- targetSpace = textInfo->txtBuffer[textInfo->endLine+1]->lineHeight +
- INTERLINE;
- if (textInfo->bottomSpace < targetSpace) {
- index = textInfo->startLine;
- while (index < textInfo->endLine) {
- lineSum += (textInfo->txtBuffer[index]->lineHeight + INTERLINE);
- if (textInfo->bottomSpace + lineSum >= targetSpace) break;
- index++;
- }
-
- /* Must move upward by 'lineSum' pixels */
- XCopyArea(display, textInfo->mainWindow, textInfo->mainWindow,
- DEFAULT_GC, 0, lineSum,
- textInfo->w - BARSIZE, textInfo->h,
- 0, 0);
-
- textInfo->flagWord |= COPYEXPOSE;
- /* Repair the damage to the structures */
- textInfo->startLine = index + 1;
- updateFlag = 1;
- } else {
- updateFlag = 0;
- }
- /* More lines might be able to fit. Let's check. */
- freeSpace = textInfo->bottomSpace + lineSum - targetSpace;
- index = textInfo->endLine + 1;
- while (index < textInfo->numLines-1) {
- if (freeSpace - textInfo->txtBuffer[index+1]->lineHeight - INTERLINE < 0)
- break;
- freeSpace -= (textInfo->txtBuffer[index+1]->lineHeight + INTERLINE);
- index++;
- }
- textInfo->endLine = index;
- textInfo->bottomSpace = freeSpace;
- if (updateFlag) {
- UpdateExposures(display, textInfo);
- }
- UpdateScroll(display, textInfo);
- return 1;
-}
-
-
-
-
-static int ExpandLines(textInfo)
-struct txtWin *textInfo; /* Text Information */
-/*
- * This routine allocates and initializes additional space in
- * the line start array (txtBuffer). The new space
- * is allocated using realloc. The expansion factor is a percentage
- * given by EXPANDPERCENT.
- */
-{
- int newSize, index;
-
- newSize = textInfo->allocLines;
- newSize += (newSize * EXPANDPERCENT) / 100;
-
- textInfo->txtBuffer = (struct txtLine **)
- realloc((char *) textInfo->txtBuffer,
- (unsigned) (newSize * sizeof(struct txtLine *)));
- for (index = textInfo->allocLines; index < newSize; index++) {
- textInfo->txtBuffer[index] = alloc(struct txtLine);
- InitLine(textInfo->txtBuffer[index]);
- }
- textInfo->allocLines = newSize;
- return 1;
-}
-
-static int ExpandBuffer(textInfo)
-struct txtWin *textInfo; /* Text information */
-/*
- * Expands the basic character buffer using realloc. The expansion
- * factor is a percentage given by EXPANDPERCENT.
- */
-{
- int newSize;
-
- newSize = textInfo->bufAlloc + (textInfo->bufAlloc * EXPANDPERCENT) / 100;
- textInfo->mainBuffer = (short *)
- realloc((char *) textInfo->mainBuffer, (unsigned) newSize * sizeof(short));
- textInfo->bufAlloc = newSize;
- return 1;
-}
-
-
-
-static int HandleNewLine(display, textInfo, flagWord)
-Display *display;
-struct txtWin *textInfo; /* Text Information */
-int flagWord; /* DODISP or NONEWLINE or both */
-/*
- * This routine initializes the next line for drawing by setting
- * its height to the current font height, scrolls the screen down
- * one line, and updates the current drawing position to the
- * left edge of the newly cleared line. If DODISP is specified,
- * the screen will be updated (otherwise not). If NONEWLINE is
- * specified, no newline character will be added to the text buffer
- * (this is for line wrap).
- */
-{
- struct txtLine *curLine, *nextLine;
-
- /* Check to see if a new line must be allocated */
- if (textInfo->curLine >= textInfo->allocLines-1)
- /* Expand the number of lines */
- ExpandLines(textInfo);
- textInfo->numLines += 1;
-
- /* Then we initialize the next line */
- nextLine = textInfo->txtBuffer[textInfo->numLines-1];
- nextLine->lineHeight =
- textInfo->theFonts[textInfo->curFont].ascent +
- textInfo->theFonts[textInfo->curFont].descent;
-
- curLine = textInfo->txtBuffer[textInfo->curLine];
- if (flagWord & DODISP) {
- /* Scroll down a line if required */
- if ((textInfo->curY + curLine->lineHeight +
- nextLine->lineHeight + (INTERLINE * 2)) > textInfo->h)
- {
- ScrollDown(display, textInfo);
- }
- else
- {
- /* Update the bottom space appropriately */
- textInfo->bottomSpace -= (nextLine->lineHeight + INTERLINE);
- textInfo->endLine += 1;
- }
- /* Update drawing position */
- textInfo->curY = textInfo->h -
- (textInfo->bottomSpace + nextLine->lineHeight);
- }
-
- /* Move down a line */
- textInfo->curLine += 1;
- if (!(flagWord & NONEWLINE)) {
- /* Append end-of-line to text buffer */
- if (textInfo->bufSpot >= textInfo->bufAlloc) {
- /* Allocate more space in main text buffer */
- ExpandBuffer(textInfo);
- }
- textInfo->mainBuffer[(textInfo->bufSpot)++] =
- (textInfo->curFont << FONTSHIFT) | '\n';
- }
- nextLine->lineText = textInfo->bufSpot;
- textInfo->curX = 0;
- return 1;
-}
-
-
-
-static int CharSize(textInfo, lineNum, charNum)
-struct txtWin *textInfo; /* Current Text Information */
-int lineNum; /* Line in buffer */
-int charNum; /* Character in line */
-/*
- * This routine determines the size of the specified character.
- * It takes in account the font of the character and whether its
- * fixed or variable. The size includes INTERSPACE spacing between
- * the characters.
- */
-{
- register XFontStruct *charFont;
- register short *theLine;
- register short theChar;
-
- theLine = &(textInfo->mainBuffer[textInfo->txtBuffer[lineNum]->lineText]);
- theChar = theLine[charNum] & CHARMASK;
- charFont = &(textInfo->theFonts[(theChar & FONTMASK) >> FONTSHIFT]);
- if (theChar <= charFont->min_char_or_byte2 ||
- theChar >= charFont->max_char_or_byte2 ||
- charFont->per_char == 0)
- return charFont->max_bounds.width + 1;
- else
- return charFont->per_char[theChar].width + 1;
-}
-
-
-
-
-
-static int HandleBackspace(display, textInfo, flagWord)
-Display *display;
-struct txtWin *textInfo; /* Text Information */
-int flagWord; /* DODISP or nothing */
-/*
- * This routine handles a backspace found in the input stream. The
- * character before the current writing position will be erased and
- * the drawing position will move back one character. If the writing
- * position is at the left margin, the drawing position will move
- * up to the previous line. If it is a line that has been wrapped,
- * the character at the end of the previous line will be erased.
- */
-{
- struct txtLine *thisLine, *prevLine;
- int chSize;
-
- thisLine = textInfo->txtBuffer[textInfo->curLine];
- /* First, determine whether we need to go back a line */
- if (thisLine->lineLength == 0) {
- /* Bleep if at top of buffer */
- if (textInfo->curLine == 0) {
- XBell(display, 50);
- return 0;
- }
-
- /* See if we have to scroll in the other direction */
- if ((flagWord & DODISP) && (textInfo->curY <= YPADDING)) {
- /* This will display the last lines of the buffer */
- WarpToBottom(display, textInfo);
- }
-
- /* Set drawing position at end of previous line */
- textInfo->curLine -= 1;
- prevLine = textInfo->txtBuffer[textInfo->curLine];
- textInfo->numLines -= 1;
- if (flagWord & DODISP) {
- textInfo->curY -= (prevLine->lineHeight + INTERLINE);
- textInfo->bottomSpace += (thisLine->lineHeight + INTERLINE);
- textInfo->endLine -= 1;
- }
-
- /* We are unlinewrapping if the previous line has flag set */
- if (prevLine->lineFlags & WRAPFLAG) {
- /* Get rid of line wrap indicator */
- if (flagWord & DODISP) {
- XFillRectangle(display, textInfo->mainWindow,
- textInfo->bgGC,
- textInfo->w - BARSIZE - WRAPINDSIZE,
- textInfo->curY, WRAPINDSIZE,
- prevLine->lineHeight);
- }
- prevLine->lineFlags &= (~WRAPFLAG);
- /* Call recursively to wipe out the ending character */
- HandleBackspace(display, textInfo, flagWord);
- } else {
- /* Delete the end-of-line in the primary buffer */
- textInfo->bufSpot -= 1;
- }
- } else {
- /* Normal deletion of character */
- chSize =
- CharSize(textInfo, textInfo->curLine,
- textInfo->txtBuffer[textInfo->curLine]->lineLength - 1);
- /* Move back appropriate amount and wipe it out */
- thisLine->lineWidth -= chSize;
- if (flagWord & DODISP) {
- XFillRectangle(display, textInfo->mainWindow,
- textInfo->bgGC,
- thisLine->lineWidth, textInfo->curY,
- chSize, thisLine->lineHeight);
- }
- /* Delete from buffer */
- textInfo->txtBuffer[textInfo->curLine]->lineLength -= 1;
- textInfo->bufSpot -= 1;
- }
- return 1;
-}
-
-
-
-static int DrawLineWrap(display, win, x, y, h, col)
-Display *display;
-Window win; /* What window to draw it in */
-int x, y; /* Position of upper left corner */
-int h; /* Height of indicator */
-int col; /* Color of indicator */
-/*
- * This routine draws a line wrap indicator at the end of a line.
- * Visually, it is an arrow of the specified height directly against
- * the scroll bar border. The bitmap used for the arrow is stored
- * in 'arrowMap' with size 'arrow_width' and 'arrow_height'.
- */
-{
- struct txtWin *textInfo;
-
- textInfo = (struct txtWin *)XLookUpAssoc(display, textWindows,
- (XID) win);
-
- /* First, draw the arrow */
-#ifdef __FreeBSD__
- XCopyArea(display, textInfo->arrowMap, textInfo->mainWindow,
- textInfo->CursorGC,
- 0, 0, arrow_width, arrow_height,
- x, y + h - arrow_height);
-#else
- XCopyArea(display, textInfo->arrowMap, textInfo->mainWindow,
- textInfo->CursorGC,
- 0, 0, arrow_width, arrow_height,
- x, y + h - arrow_height, 1);
-#endif
-
- /* Then draw the stem */
- XDrawLine(display, textInfo->mainWindow, textInfo->CursorGC,
- x + STEMOFFSET, y,
- x + STEMOFFSET, y + h - arrow_height);
- return 1;
-}
-
-
-
-
-static int DrawLine(display, textInfo, lineIndex, ypos)
-Display *display;
-struct txtWin *textInfo; /* Text window information */
-int lineIndex; /* Index of line to draw */
-int ypos; /* Y position for line */
-/*
- * This routine destructively draws the indicated line in the
- * indicated window at the indicated position. It does not
- * clear to end of line however. It draws a line wrap indicator
- * if needed but does not draw a cursor.
- */
-{
- int index, startPos, curFont, theColor, curX, saveX, fontIndex;
- struct txtLine *someLine;
- char lineBuffer[BUFSIZE], *glyph;
- short *linePointer;
- XFontStruct *theFont;
- XGCValues gc;
-
- /* First, we draw the text */
- index = 0;
- curX = XPADDING;
- someLine = textInfo->txtBuffer[lineIndex];
- linePointer = &(textInfo->mainBuffer[someLine->lineText]);
- while (index < someLine->lineLength) {
- startPos = index;
- saveX = curX;
- curFont = linePointer[index] & FONTMASK;
- fontIndex = curFont >> FONTSHIFT;
- theFont = &(textInfo->theFonts[fontIndex]);
- theColor = textInfo->theColors[fontIndex];
- glyph = &(lineBuffer[0]);
- while ((index < someLine->lineLength) &&
- ((linePointer[index] & FONTMASK) == curFont))
- {
- *glyph = linePointer[index] & CHARMASK;
- index++;
- curX += CharSize(textInfo, lineIndex, index);
- glyph++;
- }
-
- /* Flush out the glyphs */
- XFillRectangle(display, textInfo->mainWindow,
- textInfo->bgGC,
- saveX, ypos,
- textInfo->w - BARSIZE,
- someLine->lineHeight + YPADDING + INTERLINE);
-
- XDrawString(display, textInfo->mainWindow,
- textInfo->fontGC[fontIndex],
- saveX, ypos,
- lineBuffer, someLine->lineLength);
- }
- /* Then the line wrap indicator (if needed) */
- if (someLine->lineFlags & WRAPFLAG) {
- DrawLineWrap(display, textInfo->mainWindow,
- textInfo->w - BARSIZE - WRAPINDSIZE,
- ypos, someLine->lineHeight,
- textInfo->fgPix);
- }
- return 1;
-}
-
-
-
-
-static int HandleNewFont(display, fontNum, textInfo, flagWord)
-Display *display;
-int fontNum; /* Font number */
-struct txtWin *textInfo; /* Text information */
-int flagWord; /* DODISP or nothing */
-/*
- * This routine handles a new font request. These requests take
- * the form "^F<digit>". The parsing is done in TxtWriteStr.
- * This routine is called only if the form is valid. It may return
- * a failure (0 status) if the requested font is not loaded.
- * If the new font is larger than any of the current
- * fonts on the line, it will change the line height and redisplay
- * the line.
- */
-{
- struct txtLine *thisLine;
- int heightDiff, baseDiff, redrawFlag;
-
- if (textInfo->theFonts[fontNum].fid == 0) {
- return 0;
- } else {
- thisLine = textInfo->txtBuffer[textInfo->curLine];
- textInfo->curFont = fontNum;
- redrawFlag = 0;
- heightDiff = textInfo->theFonts[fontNum].ascent +
- textInfo->theFonts[fontNum].descent -
- thisLine->lineHeight;
-
- if (heightDiff > 0) {
- redrawFlag = 1;
- } else {
- heightDiff = 0;
- }
-
- if (redrawFlag) {
- if (flagWord & DODISP) {
- /* Clear current line */
- XFillRectangle(display, textInfo->mainWindow,
- textInfo->bgGC,
- 0, textInfo->curY, textInfo->w,
- thisLine->lineHeight);
-
- /* Check to see if it requires scrolling */
- if ((textInfo->curY + thisLine->lineHeight + heightDiff +
- INTERLINE) > textInfo->h)
- {
- /*
- * General approach: "unscroll" the last line up
- * and then call ScrollDown to do the right thing.
- */
- textInfo->endLine -= 1;
- textInfo->bottomSpace += thisLine->lineHeight +
- INTERLINE;
-
- XFillRectangle(display, textInfo->mainWindow,
- textInfo->bgGC,
- 0, textInfo->h - textInfo->bottomSpace,
- textInfo->w, textInfo->bottomSpace);
-
- thisLine->lineHeight += heightDiff;
- ScrollDown(display, textInfo);
- textInfo->curY = textInfo->h -
- (textInfo->bottomSpace + INTERLINE +
- thisLine->lineHeight);
- }
- else
- {
- /* Just update bottom space */
- textInfo->bottomSpace -= heightDiff;
- thisLine->lineHeight += heightDiff;
- }
- /* Redraw the current line */
- DrawLine(display, textInfo, textInfo->curLine, textInfo->curY);
- } else {
- /* Just update line height */
- thisLine->lineHeight += heightDiff;
- }
- }
- return 1;
- }
-}
-
-
-
-int TxtWriteStr(display, w, str)
-Display *display;
-Window w; /* Text window */
-register char *str; /* 0 terminated string */
-/*
- * This routine writes a string to the specified text window.
- * The following notes apply:
- * - Text is always appended to the end of the text buffer.
- * - If the scroll bar is positioned such that the end of the
- * text is not visible, an automatic scroll to the bottom
- * will be done before the appending of text.
- * - Non-printable ASCII characters are not displayed.
- * - The '\n' character causes the current text position to
- * advance one line and start at the left.
- * - Tabs are not supported.
- * - Lines too long for the screen will be wrapped and a line wrap
- * indication will be drawn.
- * - Backspace clears the previous character. It will do the right
- * thing if asked to backspace past a wrapped line.
- * - A new font can be chosen using the sequence '^F<digit>' where
- * <digit> is 0-7. The directive will be ignored if
- * there is no font in the specified slot.
- * Returns 0 if something went wrong.
- */
-{
- register int fontIndex;
- register struct txtWin *textInfo;
- register struct txtLine *thisLine;
-
- if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w)) == 0)
- return 0;
-
- /* See if screen needs to be updated */
- if (textInfo->flagWord & SCREENWRONG) {
- TxtRepaint(display, textInfo->mainWindow);
- }
-
- /* See if we have to scroll down to the bottom */
- if (textInfo->flagWord & NOTATBOTTOM) {
- WarpToBottom(display, textInfo);
- textInfo->flagWord &= (~NOTATBOTTOM);
- }
-
- /* Undraw the current cursor */
- thisLine = textInfo->txtBuffer[textInfo->curLine];
-
- XFillRectangle(display, w, textInfo->bgGC,
- thisLine->lineWidth + CUROFFSET,
- textInfo->curY,
- CURSORWIDTH,
- thisLine->lineHeight);
-
- for ( /* str is ok */ ; (*str != 0) ; str++) {
- /* Check to see if we are waiting on a font */
- if (textInfo->flagWord & FONTNUMWAIT) {
- textInfo->flagWord &= (~FONTNUMWAIT);
- fontIndex = *str - '0';
- if ((fontIndex >= 0) && (fontIndex < MAXFONTS)) {
- /* Handle font -- go get next character */
- if (HandleNewFont(display, fontIndex, textInfo, DODISP))
- continue;
- }
- }
-
- /* Inline code for handling normal character case */
- if ((*str >= LOWCHAR) && (*str <= HIGHCHAR)) {
- register XFontStruct *thisFont;
- register struct txtLine *thisLine;
- register int charWidth;
- int thisColor;
-
- /* Determine size of character */
- thisFont = &(textInfo->theFonts[textInfo->curFont]);
- thisColor = textInfo->theColors[textInfo->curFont];
- if (*str <= thisFont->min_char_or_byte2 ||
- *str >= thisFont->max_char_or_byte2 ||
- thisFont->per_char == 0)
- charWidth = thisFont->max_bounds.width + 1;
- else
- charWidth = thisFont->per_char[*str].width + 1;
-
- /* Check to see if line wrap is required */
- thisLine = textInfo->txtBuffer[textInfo->curLine];
- if (thisLine->lineWidth + charWidth >
- (textInfo->w-BARSIZE-WRAPINDSIZE))
- {
- DrawLineWrap(display, textInfo->mainWindow,
- textInfo->w-BARSIZE-WRAPINDSIZE,
- textInfo->curY, thisLine->lineHeight,
- textInfo->fgPix);
- thisLine->lineFlags |= WRAPFLAG;
- /* Handle the spacing problem the same way as a newline */
- HandleNewLine(display, textInfo, DODISP | NONEWLINE);
- thisLine = textInfo->txtBuffer[textInfo->curLine];
- }
-
- /* Ready to draw character */
- XDrawString(display, textInfo->mainWindow,
- DEFAULT_GC,
- textInfo->curX += charWidth,
- textInfo->curY + thisLine->lineHeight,
- str, 1);
-
- /* Append character onto main buffer */
- if (textInfo->bufSpot >= textInfo->bufAlloc)
- /* Make room for more characters */
- ExpandBuffer(textInfo);
- textInfo->mainBuffer[(textInfo->bufSpot)++] =
- (textInfo->curFont << FONTSHIFT) | (*str);
-
- /* Update the line start array */
- thisLine->lineLength += 1;
- thisLine->lineWidth += charWidth;
- } else if (*str == NEWLINE) {
- HandleNewLine(display, textInfo, DODISP);
- } else if (*str == NEWFONT) {
- /* Go into waiting for font number mode */
- textInfo->flagWord |= FONTNUMWAIT;
- } else if (*str == BACKSPACE) {
- HandleBackspace(display, textInfo, DODISP);
- } else {
- /* Ignore all others */
- }
- }
- /* Draw the cursor in its new position */
- thisLine = textInfo->txtBuffer[textInfo->curLine];
-
- XFillRectangle(display, w, textInfo->CursorGC,
- thisLine->lineWidth + CUROFFSET,
- textInfo->curY /* + thisLine->lineHeight */,
- CURSORWIDTH, thisLine->lineHeight);
-
- return 1;
-}
-
-
-
-int TxtJamStr(display, w, str)
-Display *display;
-Window w; /* Text window */
-register char *str; /* NULL terminated string */
-/*
- * This is the same as TxtWriteStr except the screen is NOT updated.
- * After a call to this routine, TxtRepaint should be called to
- * update the screen. This routine is meant to be used to load
- * a text buffer with information and then allow the user to
- * scroll through it at will.
- */
-{
- register int fontIndex;
- register struct txtWin *textInfo;
-
- if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w)
- ) == 0)
- return 0;
-
- for ( /* str is ok */ ; (*str != 0) ; str++) {
- /* Check to see if we are waiting on a font */
- if (textInfo->flagWord & FONTNUMWAIT) {
- textInfo->flagWord &= (~FONTNUMWAIT);
- fontIndex = *str - '0';
- if ((fontIndex >= 0) && (fontIndex < MAXFONTS)) {
- if (HandleNewFont(display, fontIndex, textInfo, 0)) {
- /* Handled font -- go get next character */
- continue;
- }
- }
- }
- /* Inline code for handling normal character case */
- if ((*str >= LOWCHAR) && (*str <= HIGHCHAR)) {
- register XFontStruct *thisFont;
- register struct txtLine *thisLine;
- register int charWidth;
-
- /* Determine size of character */
- thisFont = &(textInfo->theFonts[textInfo->curFont]);
-
- if (*str <= thisFont->min_char_or_byte2 ||
- *str >= thisFont->max_char_or_byte2 ||
- thisFont->per_char == 0)
- charWidth = thisFont->max_bounds.width + 1;
- else
- charWidth = thisFont->per_char[*str].width + 1;
-
- /* Check to see if line wrap is required */
- thisLine = textInfo->txtBuffer[textInfo->curLine];
- if (thisLine->lineWidth + charWidth >
- (textInfo->w-BARSIZE-WRAPINDSIZE))
- {
- thisLine->lineFlags |= WRAPFLAG;
- /* Handle the spacing problem the same way as a newline */
- HandleNewLine(display, textInfo, NONEWLINE);
- thisLine = textInfo->txtBuffer[textInfo->curLine];
- }
- /* Append character onto main buffer */
- if (textInfo->bufSpot >= textInfo->bufAlloc)
- /* Make room for more characters */
- ExpandBuffer(textInfo);
- textInfo->mainBuffer[(textInfo->bufSpot)++] =
- (textInfo->curFont << FONTSHIFT) | (*str);
-
- /* Update the line start array */
- thisLine->lineLength += 1;
- thisLine->lineWidth += charWidth;
- } else if (*str == NEWLINE) {
- HandleNewLine(display, textInfo, 0);
- } else if (*str == NEWFONT) {
- /* Go into waiting for font number mode */
- textInfo->flagWord |= FONTNUMWAIT;
- } else if (*str == BACKSPACE) {
- HandleBackspace(display, textInfo, 0);
- } else {
- /* Ignore all others */
- }
- }
- textInfo->flagWord |= SCREENWRONG;
- return 1;
-}
-
-
-
-int TxtRepaint(display,w)
-Display *display;
-Window w;
-/*
- * Repaints the given scrollable text window. The routine repaints
- * the entire window. For handling exposure events, the TxtFilter
- * routine should be used.
- */
-{
- struct txtWin *textInfo;
- int index, ypos;
-
- if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w)
- ) == 0)
- return 0;
-
- /* Check to see if the screen is up to date */
- if (textInfo->flagWord & SCREENWRONG) {
- textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace));
- textInfo->flagWord &= (~SCREENWRONG);
- }
-
- ypos = YPADDING;
- index = textInfo->startLine;
- for (;;) {
- DrawLine(display, textInfo, index, ypos);
- if (index >= textInfo->endLine) break;
- ypos += (textInfo->txtBuffer[index]->lineHeight + INTERLINE);
- index++;
- }
- /* Draw the cursor (if on screen) */
- if (textInfo->endLine == textInfo->curLine) {
- XFillRectangle(display, w, textInfo->CursorGC,
- textInfo->txtBuffer[index]->lineWidth + CUROFFSET,
- ypos /* + textInfo->txtBuffer[index]->lineHeight */,
- CURSORWIDTH, textInfo->txtBuffer[index]->lineHeight);
-
- }
- /* Update the scroll bar */
- UpdateScroll(display, textInfo);
- return 1;
-}
-
-
-
-static int InsertIndex(textInfo, thisIndex, ypos)
-struct txtWin *textInfo; /* Text Window Information */
-int thisIndex; /* Line index of exposed line */
-int ypos; /* Drawing position of line */
-/*
- * This routine inserts the supplied line index into the copy
- * exposure array for 'textInfo'. The array is kept sorted
- * from lowest to highest using insertion sort. The array
- * is dynamically expanded if needed.
- */
-{
- struct expEvent *newItem;
- int newSize, index, downIndex;
-
- /* Check to see if we need to expand it */
- if ((textInfo->exposeSize + 3) >= textInfo->exposeAlloc) {
- newSize = textInfo->exposeAlloc +
- (textInfo->exposeAlloc * EXPANDPERCENT / 100);
- textInfo->exposeAry = (struct expEvent **)
- realloc((char *) textInfo->exposeAry,
- (unsigned) (newSize * sizeof(struct expEvent *)));
- for (index = textInfo->exposeAlloc; index < newSize; index++)
- textInfo->exposeAry[index] = alloc(struct expEvent);
- textInfo->exposeAlloc = newSize;
- }
- /* Find spot for insertion. NOTE: last spot has big number */
- for (index = 0; index <= textInfo->exposeSize; index++) {
- if (textInfo->exposeAry[index]->lineIndex >= thisIndex) {
- if (textInfo->exposeAry[index]->lineIndex > thisIndex) {
- /* Insert before this entry */
- newItem = textInfo->exposeAry[textInfo->exposeSize+1];
- for (downIndex = textInfo->exposeSize;
- downIndex >= index;
- downIndex--)
- {
- textInfo->exposeAry[downIndex+1] =
- textInfo->exposeAry[downIndex];
- }
- /* Put a free structure at this spot */
- textInfo->exposeAry[index] = newItem;
- /* Fill it in */
- textInfo->exposeAry[index]->lineIndex = thisIndex;
- textInfo->exposeAry[index]->ypos = ypos;
- /* Break out of loop */
- textInfo->exposeSize += 1;
- }
- break;
- }
- }
- return 1;
-}
-
-
-
-static int ScrollUp(display, textInfo)
-Display *display;
-struct txtWin *textInfo; /* Text window information */
-/*
- * This routine scrolls the indicated text window up by one
- * line. The line above the current line must exist. The
- * window is scrolled so that the line above the start line
- * is displayed at the top of the screen. This may cause
- * many lines to scroll off the bottom. The scrolling is
- * done using XCopyArea. The exposure events should be caught
- * by ExposeCopy.
- */
-{
- int targetSpace;
-
- /* Make sure all exposures have been handled by now */
- if (textInfo->startLine == 0) return 0;
- targetSpace = textInfo->txtBuffer[textInfo->startLine-1]->lineHeight +
- INTERLINE;
- /* Move the area downward by the target amount */
- XCopyArea(display, textInfo->mainWindow, textInfo->mainWindow,
- DEFAULT_GC,
- 0, YPADDING, textInfo->w - BARSIZE,
- textInfo->h, 0, targetSpace);
-
- textInfo->flagWord |= COPYEXPOSE;
- /* Update the text window parameters */
- textInfo->startLine -= 1;
- textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace));
-
- /* Clear out bottom space region */
-#ifdef __FreeBSD__
- XClearArea(display, textInfo->mainWindow,
- 0, textInfo->h - textInfo->bottomSpace,
- textInfo->w, textInfo->bottomSpace, 1);
-#else
- XClearArea(display, textInfo->mainWindow,
- 0, textInfo->h - textInfo->bottomSpace,
- textInfo->w, textInfo->bottomSpace);
-#endif
-
- UpdateExposures(display, textInfo);
- UpdateScroll(display, textInfo);
-
- return 1;
-}
-
-
-static int ScrollToSpot(display, textInfo, ySpot)
-Display *display;
-struct txtWin *textInfo; /* Text window information */
-int ySpot; /* Button position in scroll window */
-/*
- * This routine scrolls the specified text window relative to the
- * position of the mouse in the scroll bar. The center of the screen
- * will be positioned to correspond to the mouse position.
- */
-{
- int targetLine, aboveLines;
-
- targetLine = textInfo->numLines * ySpot / textInfo->h;
- textInfo->startLine = targetLine;
- textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace));
- aboveLines = 0;
- /* Make the target line the *center* of the window */
- while ((textInfo->startLine > 0) &&
- (aboveLines < textInfo->endLine - targetLine))
- {
- textInfo->startLine -= 1;
- textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace));
- aboveLines++;
- }
- if (textInfo->endLine == textInfo->numLines-1) {
- WarpToBottom(display, textInfo);
- } else {
- XClearWindow(display, textInfo->mainWindow);
- TxtRepaint(display, textInfo->mainWindow);
- }
- return 1;
-}
-
-
-
-static int LineToTop(display, textInfo, pos)
-Display *display;
-struct txtWin *textInfo; /* Text window information */
-int pos; /* Y position of mouse */
-/*
- * This routine scrolls the screen down until the line at the
- * mouse position is at the top of the screen. It stops
- * if it can't scroll the buffer down that far. If the
- * global 'ScrollOption' is NORMSCROLL, a smooth scroll
- * is used. Otherwise, it jumps to the right position
- * and repaints the screen.
- */
-{
- int index, sum;
-
- /* First, we find the current line */
- sum = 0;
- for (index = textInfo->startLine; index <= textInfo->endLine; index++) {
- if (sum + textInfo->txtBuffer[index]->lineHeight + INTERLINE> pos) break;
- sum += textInfo->txtBuffer[index]->lineHeight + INTERLINE;
- }
- /* We always want to scroll down at least one line */
- if (index == textInfo->startLine) index++;
- if (ScrollOption == NORMSCROLL) {
- /* Scroll down until 'index' is the starting line */
- while ((textInfo->startLine < index) && ScrollDown(display, textInfo))
- {
- /* Empty Loop Body */
- }
- } else {
- /* Immediately jump to correct spot */
- textInfo->startLine = index;
- textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace));
- if (textInfo->endLine == textInfo->numLines-1) {
- WarpToBottom(display, textInfo);
- } else {
- XClearWindow(display, textInfo->mainWindow);
- TxtRepaint(display, textInfo->mainWindow);
- }
- }
- /* Check to see if at end of buffer */
- if (textInfo->endLine >= textInfo->numLines-1) {
- textInfo->flagWord &= (~NOTATBOTTOM);
- }
- return 1;
-}
-
-
-
-static int TopToHere(display, textInfo, pos)
-Display *display;
-struct txtWin *textInfo; /* Text window information */
-int pos; /* Y position of mouse */
-/*
- * This routine scrolls the screen up until the top line of
- * the screen is at the current Y position of the mouse. Again,
- * it will stop if it can't scroll that far. If the global
- * 'ScrollOption' is NORMSCROLL, a smooth scroll is used.
- * If it's not, it will simply redraw the screen at the
- * correct spot.
- */
-{
- int sum, target, linesup, index;
-
- target = pos - textInfo->txtBuffer[textInfo->startLine]->lineHeight;
- /* We always want to scroll up at least one line */
- if (target <= 0) target = 1;
- sum = 0;
- linesup = 0;
- /* Check to see if we are at the top anyway */
- if (textInfo->startLine == 0) return 0;
- if (ScrollOption == NORMSCROLL) {
- /* Scroll up until sum of new top lines greater than target */
- while ((sum < target) && ScrollUp(display, textInfo)) {
- sum += textInfo->txtBuffer[textInfo->startLine]->lineHeight;
- linesup++;
- }
- } else {
- /* Search backward to find index */
- index = textInfo->startLine - 1;
- while ((index > 0) && (sum < target)) {
- sum += textInfo->txtBuffer[index]->lineHeight;
- linesup++;
- index--;
- }
- /* Go directly to the index */
- textInfo->startLine = index;
- textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace));
- XClearWindow(display, textInfo->mainWindow);
- TxtRepaint(display, textInfo->mainWindow);
- }
- /* If we scrolled, assert we are not at bottom of buffer */
- if (linesup > 0) {
- textInfo->flagWord |= NOTATBOTTOM;
- }
- return 1;
-}
-
-
-
-int TxtFilter(display, evt)
-Display *display;
-XEvent *evt;
-/*
- * This routine handles events associated with scrollable text windows.
- * It will handle all exposure events and any button released events
- * in the scroll bar of a text window. It does NOT handle any other
- * events. If it cannot handle the event, it will return 0.
- */
-{
- XExposeEvent *expose = &evt->xexpose;
- XButtonEvent *btEvt = &evt->xbutton;
- XGraphicsExposeEvent *gexpose = &evt->xgraphicsexpose;
- XNoExposeEvent *noexpose = &evt->xnoexpose;
- struct txtWin *textInfo;
- int index, ypos;
- Window w, sw;
-
- if (textWindows == (XAssocTable *) 0) {
- textWindows = XCreateAssocTable(32);
- if (textWindows == (XAssocTable *) 0) return(0);
- }
- if (evt->type == Expose) {
- w = expose->window;
- sw = 0;
- }
- else if (evt->type == GraphicsExpose) {
- w = gexpose->drawable;
- sw = 0;
- }
- else if (evt->type == NoExpose) {
- w = noexpose->drawable;
- sw = 0;
- }
- else if (evt->type == ButtonRelease) {
- w = btEvt->window;
- sw = btEvt->subwindow;
- }
- else
- return 0;
-
- if ((textInfo = (struct txtWin *)
- XLookUpAssoc(display, textWindows, (XID) w)) == 0)
- return 0;
-
- /* Determine whether it's main window or not */
- if ((w == textInfo->mainWindow) && (sw == 0)) {
- /* Main Window - handle exposures */
- switch (evt->type) {
- case Expose:
- ypos = 0 /*YPADDING*/;
- for (index = textInfo->startLine;
- index <= textInfo->endLine;
- index++)
- {
- int lh = textInfo->txtBuffer[index]->lineHeight;
-
- if (((ypos + lh) >= expose->y) &&
- (ypos <= (expose->y + expose->height)))
- {
- /* Intersection region */
- /* Draw line immediately */
- DrawLine(display, textInfo, index, ypos);
- /* And possibly draw cursor */
- if (textInfo->curLine == index) {
- XFillRectangle(display, w, textInfo->CursorGC,
- textInfo->txtBuffer[index]->lineWidth +
- CUROFFSET,
- ypos,
- CURSORWIDTH,
- lh);
- }
- }
- ypos += lh + INTERLINE;
- }
- break;
- case GraphicsExpose:
- ypos = 0 /*YPADDING*/;
- for (index = textInfo->startLine;
- index <= textInfo->endLine;
- index++)
- {
- int lh = textInfo->txtBuffer[index]->lineHeight;
-
- if (((ypos + lh) >= gexpose->y) &&
- (ypos <= (gexpose->y + gexpose->height)))
- {
- /* Intersection region */
- /* Draw line immediately */
- DrawLine(display, textInfo, index, ypos);
- /* And possibly draw cursor */
- if (textInfo->curLine == index) {
- XFillRectangle(display, w, textInfo->CursorGC,
- textInfo->txtBuffer[index]->lineWidth +
- CUROFFSET,
- ypos,
- CURSORWIDTH,
- lh);
- }
- }
- ypos += lh + INTERLINE;
- }
- break;
- case NoExpose:
- break;
- default:
- /* Not one of our events */
- return 0;
- }
- } else {
- switch (evt->type) {
- case Expose:
- UpdateScroll(display, textInfo);
- break;
- case ButtonRelease:
- /* Find out which button */
- switch (btEvt->button) {
- case Button1:
- /* Scroll up until top line is at mouse position */
- TopToHere(display, textInfo, btEvt->y);
- break;
- case Button2:
- /* Scroll to spot relative to position */
- ScrollToSpot(display, textInfo, btEvt->y);
- if (textInfo->endLine >= textInfo->numLines-1) {
- textInfo->flagWord &= (~NOTATBOTTOM);
- } else {
- textInfo->flagWord |= NOTATBOTTOM;
- }
- break;
- case Button3:
- /* Scroll down until pointed line is at top */
- LineToTop(display, textInfo, btEvt->y);
- break;
- }
- break;
- default:
- /* Not one of our events */
- return 0;
- }
- }
- return 1;
-}
diff --git a/gnu/games/chess/Xchess/scrollText/scrollText.c b/gnu/games/chess/Xchess/scrollText/scrollText.c
deleted file mode 100644
index aefb599..0000000
--- a/gnu/games/chess/Xchess/scrollText/scrollText.c
+++ /dev/null
@@ -1,1858 +0,0 @@
-/*
- * A Scrollable Text Output Window
- *
- * David Harrison
- * University of California, Berkeley
- * 1986
- *
- * The following is an implementation for a scrollable text output
- * system. It handles exposure events only (other interactions are
- * under user control). For scrolling, a always present scroll bar
- * is implemented. It detects size changes and compensates accordingly.
- */
-
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/X10.h>
-#include <sys/types.h>
-#include "scrollText.h"
-
-extern char *malloc();
-extern char *realloc();
-#define alloc(type) (type *) malloc(sizeof(type))
-#define numalloc(type, num) (type *) malloc((unsigned) (num * sizeof(type)))
-#define MAXINT 2147483647
-
-extern XAssocTable *XCreateAssocTable();
-extern caddr_t XLookUpAssoc();
-
-static XAssocTable *textWindows = (XAssocTable *) 0;
-
-#define NOOPTION -1 /* Option hasn't been set yet */
-#define NORMSCROLL 0 /* Smooth scroll on LineToTop and TopToHere */
-#define JUMPSCROLL 1 /* Jump scrolling on LineToTop and TopToHere */
-
-static int ScrollOption = NOOPTION;
-
-typedef char *Generic;
-
-#define DEFAULT_GC textInfo->fontGC[textInfo->curFont]
-
-#define BARSIZE 15
-#define BARBORDER 1
-#define MAXFONTS 8
-#define INITBUFSIZE 1024
-#define INITLINES 50
-#define INITEXPARY 50
-#define XPADDING 2
-#define YPADDING 2
-#define INTERLINE 5
-#define INTERSPACE 1
-#define CURSORWIDTH 2
-#define EXPANDPERCENT 40
-#define BUFSIZE 1024
-#define CUROFFSET 1
-#define MAXFOREIGN 250
-#define NOINDEX -1
-
-/* The wrap line indicator */
-#define WRAPINDSIZE 7
-#define STEMOFFSET 5
-#define arrow_width 7
-#define arrow_height 5
-static char arrow_bits[] = {
- 0x24, 0x26, 0x3f, 0x06, 0x04};
-
-#define NEWLINE '\n'
-#define BACKSPACE '\010'
-#define NEWFONT '\006'
-#define LOWCHAR '\040'
-#define HIGHCHAR '\176'
-
-#define CHARMASK 0x00ff /* Character mask */
-#define FONTMASK 0x0700 /* Character font */
-#define FONTSHIFT 8 /* Shift amount */
-
-#define WRAPFLAG 0x01 /* Line wrap flag */
-
-/*
- * Lines are represented by a pointer into the overall array of
- * 16-bit characters. The lower eight bits is used to indicate the character
- * (in ASCII), and the next two bits are used to indicate the font
- * the character should be drawn in.
- */
-
-typedef struct txtLine {
- int lineLength; /* Current line length */
- int lineHeight; /* Full height of line in pixels */
- int lineBaseLine; /* Current baseline of the line */
- int lineWidth; /* Drawing position at end of line */
- int lineText; /* Offset into master buffer */
- int lineFlags; /* Line wrap flag is here */
-};
-
-
-/*
- * For ExposeCopy events, we queue up the redraw requests collapsing
- * them into line redraw requests until the CopyExpose event arrives.
- * The queue is represented as a dynamic array of the following
- * structure:
- */
-
-typedef struct expEvent {
- int lineIndex; /* Index of line to redraw */
- int ypos; /* Drawing position of line */
-};
-
-
-/*
- * The text buffer is represented using a dynamic counted array
- * of 16-bit quantities. This array expands as needed.
- * For the screen representation, a dynamic counted array
- * of line structures is used. This array points into the
- * text buffer to denote the start of each line and its parameters.
- * The windows are configured as one overall window which contains
- * the scroll bar as a sub-window along its right edge. Thus,
- * the text drawing space is actually w-BARSIZE.
- */
-
-#define NOTATBOTTOM 0x01 /* Need to scroll to bottom before appending */
-#define FONTNUMWAIT 0x02 /* Waiting for font number */
-#define COPYEXPOSE 0x04 /* Need to process a copy expose event */
-#define SCREENWRONG 0x08 /* TxtJamStr has invalidated screen contents */
-
-typedef struct txtWin {
- /* Basic text buffer */
- int bufAlloc; /* Allocated size of buffer */
- int bufSpot; /* Current writing position in buffer */
- short *mainBuffer; /* Main buffer of text */
-
- /* Line information */
- int numLines; /* Number of display lines in buffer */
- int allocLines; /* Number of lines allocated */
- struct txtLine **txtBuffer; /* Dynamic array of lines */
-
- /* Current Window display information */
- Window mainWindow; /* Text display window */
- Window scrollBar; /* Subwindow for scroll bar */
- Pixmap arrowMap; /* line wrap indicator */
- int bgPix, fgPix; /* Background and cursor */
- GC CursorGC; /* gc for the cursor */
- GC bgGC; /* gc for erasing things */
- GC fontGC[MAXFONTS]; /* gc for doing fonts */
- XFontStruct theFonts[MAXFONTS];/* Display fonts */
- int theColors[MAXFONTS]; /* foregrounds of the fonts */
- int curFont; /* current font for tracking */
- int w, h; /* Current size */
- int startLine; /* Top line in display */
- int endLine; /* Bottom line in display */
- int bottomSpace; /* Space at bottom of screen */
- int flagWord; /* If non-zero, not at end */
-
- /* For handling ExposeCopy events */
- int exposeSize; /* Current size of array */
- int exposeAlloc; /* Allocated size */
- struct expEvent **exposeAry;/* Array of line indices */
-
- /* Drawing position information */
- int curLine; /* Current line in buffer */
- int curX; /* Current horizontal positi */
- int curY; /* Current vertical drawing */
-};
-
-/* Flags for the various basic character handling functions */
-
-#define DODISP 0x01 /* Update the display */
-#define NONEWLINE 0x02 /* Dont append newline */
-
-
-
-static int InitLine(newLine)
-struct txtLine *newLine; /* Newly created line structure */
-/*
- * This routine initializes a newly created line structure.
- */
-{
- newLine->lineLength = 0;
- newLine->lineHeight = 0;
- newLine->lineBaseLine = 0;
- newLine->lineWidth = XPADDING;
- newLine->lineText = NOINDEX;
- newLine->lineFlags = 0;
- return 1;
-}
-
-
-
-
-int TxtGrab(display, txtWin, program, mainFont, bg, fg, cur)
-Display *display; /* display window is on */
-Window txtWin; /* Window to take over as scrollable text */
-char *program; /* Program name for Xdefaults */
-XFontStruct *mainFont; /* Primary text font */
-int bg, fg, cur; /* Background, foreground, and cursor colors */
-/*
- * This routine takes control of 'txtWin' and makes it into a scrollable
- * text output window. It will create a sub-window for the scroll bar
- * with a background of 'bg' and an bar with color 'fg'. Both fixed width
- * and variable width fonts are supported. Additional fonts can be loaded
- * using 'TxtAddFont'. Returns 0 if there were problems, non-zero if
- * everything went ok.
- */
-{
- struct txtWin *newWin; /* Text package specific information */
- XWindowAttributes winInfo; /* Window information */
- int index;
- XGCValues gc_val;
-
- if (textWindows == (XAssocTable *) 0) {
- textWindows = XCreateAssocTable(32);
- if (textWindows == (XAssocTable *) 0) return(0);
- }
- if (XGetWindowAttributes(display, txtWin, &winInfo) == 0) return 0;
-
- if (ScrollOption == NOOPTION) {
- /* Read to see if the user wants jump scrolling or not */
- if (XGetDefault(display, program, "JumpScroll")) {
- ScrollOption = JUMPSCROLL;
- } else {
- ScrollOption = NORMSCROLL;
- }
- }
-
- /* Initialize local structure */
- newWin = alloc(struct txtWin);
-
- /* Initialize arrow pixmap */
- newWin->arrowMap = XCreatePixmapFromBitmapData(display, txtWin,
- arrow_bits,
- arrow_width, arrow_height,
- cur, bg,
- DisplayPlanes(display, 0));
-
- newWin->bufAlloc = INITBUFSIZE;
- newWin->bufSpot = 0;
- newWin->mainBuffer = numalloc(short, INITBUFSIZE);
-
- newWin->numLines = 1;
- newWin->allocLines = INITLINES;
- newWin->txtBuffer = numalloc(struct txtLine *, INITLINES);
- for (index = 0; index < INITLINES; index++) {
- newWin->txtBuffer[index] = alloc(struct txtLine);
- InitLine(newWin->txtBuffer[index]);
- }
-
- /* Window display information */
- newWin->mainWindow = txtWin;
- newWin->w = winInfo.width;
- newWin->h = winInfo.height;
- newWin->startLine = 0;
- newWin->endLine = 0;
- newWin->bottomSpace = winInfo.height
- - YPADDING - mainFont->ascent - mainFont->descent - INTERLINE;
- newWin->flagWord = 0;
- newWin->bgPix = bg;
- newWin->fgPix = fg;
-
- /* Scroll Bar Creation */
- newWin->scrollBar = XCreateSimpleWindow(display, txtWin,
- winInfo.width - BARSIZE,
- 0, BARSIZE - (2*BARBORDER),
- winInfo.height - (2*BARBORDER),
- BARBORDER,
- fg, bg);
- XSelectInput(display, newWin->scrollBar, ExposureMask|ButtonReleaseMask);
- XMapRaised(display, newWin->scrollBar);
-
- /* Font and Color Initialization */
- newWin->theFonts[0] = *mainFont;
- newWin->theColors[0] = fg;
- gc_val.function = GXcopy;
- gc_val.plane_mask = AllPlanes;
- gc_val.foreground = fg;
- gc_val.background = bg;
- gc_val.graphics_exposures = 1;
- gc_val.font = mainFont->fid;
- gc_val.line_width = 1;
- gc_val.line_style = LineSolid;
-
- newWin->fontGC[0] = XCreateGC(display, txtWin,
- GCFunction | GCPlaneMask |
- GCForeground | GCBackground |
- GCGraphicsExposures | GCFont,
- &gc_val);
-
- gc_val.foreground = cur;
- newWin->CursorGC = XCreateGC(display, txtWin,
- GCFunction | GCPlaneMask |
- GCForeground | GCBackground |
- GCLineStyle | GCLineWidth,
- &gc_val);
-
- gc_val.foreground = bg;
- newWin->bgGC = XCreateGC(display, txtWin,
- GCFunction | GCPlaneMask |
- GCForeground | GCBackground |
- GCGraphicsExposures | GCFont,
- &gc_val);
-
-
- for (index = 1; index < MAXFONTS; index++) {
- newWin->theFonts[index].fid = 0;
- newWin->fontGC[index] = 0;
- }
-
-
- /* Initialize size of first line */
- newWin->txtBuffer[0]->lineHeight = newWin->theFonts[0].ascent +
- newWin->theFonts[0].descent;
- newWin->txtBuffer[0]->lineText = 0;
-
- /* ExposeCopy array initialization */
- newWin->exposeSize = 0;
- newWin->exposeAlloc = INITEXPARY;
- newWin->exposeAry = numalloc(struct expEvent *, INITEXPARY);
- for (index = 0; index < newWin->exposeAlloc; index++)
- newWin->exposeAry[index] = alloc(struct expEvent);
- /* Put plus infinity in last slot for sorting purposes */
- newWin->exposeAry[0]->lineIndex = MAXINT;
-
- /* Drawing Position Information */
- newWin->curLine = 0;
- newWin->curX = 0;
- newWin->curY = YPADDING + mainFont->ascent + mainFont->descent;
-
- /* Attach it to both windows */
- XMakeAssoc(display, textWindows, (XID) txtWin, (caddr_t) newWin);
- XMakeAssoc(display, textWindows, (XID) newWin->scrollBar, (caddr_t) newWin);
- return 1;
-}
-
-
-int TxtRelease(display, w)
-Display *display;
-Window w; /* Window to release */
-/*
- * This routine releases all resources associated with the
- * specified window which are consumed by the text
- * window package. This includes the entire text buffer, line start
- * array, and the scroll bar window. However, the window
- * itself is NOT destroyed. The routine will return zero if
- * the window is not owned by the text window package.
- */
-{
- struct txtWin *textInfo;
- int index;
-
- if ((textInfo = (struct txtWin *) XLookUpAssoc(display,
- textWindows, (XID) w)) == 0)
- return 0;
-
- for (index = 0; index < MAXFONTS; index++)
- if (textInfo->fontGC[index] != 0)
- XFreeGC(display, textInfo->fontGC[index]);
-
- free((Generic) textInfo->mainBuffer);
- for (index = 0; index < textInfo->numLines; index++) {
- free((Generic) textInfo->txtBuffer[index]);
- }
- free((Generic) textInfo->txtBuffer);
- XDestroyWindow(display, textInfo->scrollBar);
- for (index = 0; index < textInfo->exposeSize; index++) {
- free((Generic) textInfo->exposeAry[index]);
- }
- free((Generic) textInfo->exposeAry);
- XDeleteAssoc(display, textWindows, (XID) w);
- free((Generic) textInfo);
- return 1;
-}
-
-
-
-static int RecompBuffer(textInfo)
-struct txtWin *textInfo; /* Text window information */
-/*
- * This routine recomputes all line breaks in a buffer after
- * a change in window size or font. This is done by throwing
- * away the old line start array and recomputing it. Although
- * a lot of this work is also done elsewhere, it has been included
- * inline here for efficiency.
- */
-{
- int startPos, endSize, linenum;
- register int index, chsize, curfont;
- register short *bufptr;
- register XFontStruct *fontptr;
- register struct txtLine *lineptr;
- char theChar;
-
- /* Record the old position so we can come back to it */
- for (startPos = textInfo->txtBuffer[textInfo->startLine]->lineText;
- (startPos > 0) && (textInfo->mainBuffer[startPos] != '\n');
- startPos--)
- /* null loop body */;
-
- /* Clear out the old line start array */
- for (index = 0; index < textInfo->numLines; index++) {
- InitLine(textInfo->txtBuffer[index]);
- }
-
- /* Initialize first line */
- textInfo->txtBuffer[0]->lineHeight =
- textInfo->theFonts[0].ascent + textInfo->theFonts[0].descent;
- textInfo->txtBuffer[0]->lineText = 0;
-
- /* Process the text back into lines */
- endSize = textInfo->w - BARSIZE - WRAPINDSIZE;
- bufptr = textInfo->mainBuffer;
- lineptr = textInfo->txtBuffer[0];
- linenum = 0;
- fontptr = &(textInfo->theFonts[0]);
- curfont = 0;
- for (index = 0; index < textInfo->bufSpot; index++) {
- theChar = bufptr[index] & CHARMASK;
-
- if ((bufptr[index] & FONTMASK) != curfont) {
- int newFontNum, heightDiff;
-
- /* Switch fonts */
- newFontNum = (bufptr[index] & FONTMASK) >> FONTSHIFT;
- if (textInfo->theFonts[newFontNum].fid != 0) {
- /* Valid font */
- curfont = bufptr[index] & FONTMASK;
- fontptr = &(textInfo->theFonts[newFontNum]);
- heightDiff = (fontptr->ascent + fontptr->descent) -
- lineptr->lineHeight;
- if (heightDiff < 0) heightDiff = 0;
- lineptr->lineHeight += heightDiff;
- }
- }
- if (theChar == '\n') {
- /* Handle new line */
- if (linenum >= textInfo->allocLines-1)
- /* Expand number of lines */
- ExpandLines(textInfo);
- linenum++;
- lineptr = textInfo->txtBuffer[linenum];
- /* Initialize next line */
- lineptr->lineHeight = fontptr->ascent + fontptr->descent;
- lineptr->lineText = index+1;
- /* Check to see if its the starting line */
- if (index == startPos) textInfo->startLine = linenum;
- } else {
- /* Handle normal character */
- chsize = CharSize(textInfo, linenum, index);
- if (lineptr->lineWidth + chsize > endSize) {
- /* Handle line wrap */
- lineptr->lineFlags |= WRAPFLAG;
- if (linenum >= textInfo->allocLines-1)
- /* Expand number of lines */
- ExpandLines(textInfo);
- linenum++;
- lineptr = textInfo->txtBuffer[linenum];
- /* Initialize next line */
- lineptr->lineHeight = fontptr->ascent + fontptr->descent;
- lineptr->lineText = index;
- lineptr->lineLength = 1;
- lineptr->lineWidth += chsize;
- } else {
- /* Handle normal addition of character */
- lineptr->lineLength += 1;
- lineptr->lineWidth += chsize;
- }
- }
- }
- /* We now have a valid line array. Let's clean up some other fields. */
- textInfo->numLines = linenum+1;
- if (startPos == 0) {
- textInfo->startLine = 0;
- }
- textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace));
- textInfo->curLine = linenum;
- /* Check to see if we are at the bottom */
- if (textInfo->endLine >= textInfo->numLines-1) {
- textInfo->curY = textInfo->h - textInfo->bottomSpace -
- lineptr->lineHeight;
- textInfo->flagWord &= (~NOTATBOTTOM);
- } else {
- textInfo->flagWord |= NOTATBOTTOM;
- }
- return 1;
-}
-
-
-
-
-int TxtAddFont(display, textWin, fontNumber, newFont, newColor)
-Display *display;
-Window textWin; /* Scrollable text window */
-int fontNumber; /* Place to add font (0-7) */
-XFontStruct *newFont; /* Font to add */
-int newColor; /* Color of font */
-/*
- * This routine loads a new font so that it can be used in a previously
- * created text window. There are eight font slots numbered 0 through 7.
- * If there is already a font in the specified slot, it will be replaced
- * and an automatic redraw of the window will take place. See TxtWriteStr
- * for details on using alternate fonts. The color specifies the foreground
- * color of the text. The default foreground color is used if this
- * parameter is TXT_NO_COLOR. Returns a non-zero value if
- * everything went well.
- */
-{
- struct txtWin *textInfo;
- int redrawFlag;
- XGCValues gc_val;
-
- if ((fontNumber < 0) || (fontNumber >= MAXFONTS)) return 0;
- if ((textInfo = (struct txtWin *)
- XLookUpAssoc(display, textWindows, (XID) textWin)) == 0)
- return 0;
- if (newColor == TXT_NO_COLOR) {
- newColor = textInfo->fgPix;
- }
-
- gc_val.font = newFont->fid;
- gc_val.foreground = newColor;
- gc_val.background = textInfo->bgPix;
- gc_val.plane_mask = AllPlanes;
- gc_val.graphics_exposures = 1;
- gc_val.function = GXcopy;
-
- if (textInfo->fontGC[fontNumber] != 0)
- {
- XChangeGC(display, textInfo->fontGC[fontNumber],
- GCFont | GCForeground, &gc_val);
- }
- else
- textInfo->fontGC[fontNumber] = XCreateGC(display, textWin,
- GCFont |
- GCForeground |
- GCBackground |
- GCFunction |
- GCPlaneMask |
- GCGraphicsExposures,
- &gc_val);
-
-
- redrawFlag = (textInfo->theFonts[fontNumber].fid != 0) &&
- (((newFont) && (newFont->fid != textInfo->theFonts[fontNumber].fid)) ||
- (newColor != textInfo->theColors[fontNumber]));
- if (newFont) {
- textInfo->theFonts[fontNumber] = *newFont;
- }
- textInfo->theColors[fontNumber] = newColor;
-
- if (redrawFlag) {
- RecompBuffer(textInfo);
- XClearWindow(display, textWin);
- TxtRepaint(display, textWin);
- }
- return 1;
-}
-
-
-
-int TxtWinP(display, w)
-Display *display;
-Window w;
-/*
- * Returns a non-zero value if the window has been previously grabbed
- * using TxtGrab and 0 if it has not.
- */
-{
- if (XLookUpAssoc(display, textWindows, (XID) w))
- return(1);
- else return(0);
-}
-
-
-
-static int FindEndLine(textInfo, botSpace)
-struct txtWin *textInfo;
-int *botSpace;
-/*
- * Given the starting line in 'textInfo->startLine', this routine
- * determines the index of the last line that can be drawn given the
- * current size of the screen. If there are not enough lines to
- * fill the screen, the index of the last line will be returned.
- * The amount of empty bottom space is returned in 'botSpace'.
- */
-{
- int index, height, lineHeight;
-
- height = YPADDING;
- index = textInfo->startLine;
- while (index < textInfo->numLines) {
- lineHeight = textInfo->txtBuffer[index]->lineHeight + INTERLINE;
- if (height + lineHeight > textInfo->h) break;
- height += lineHeight;
- index++;
- }
- if (botSpace) {
- *botSpace = textInfo->h - height;
- }
- return index - 1;
-}
-
-
-
-static int UpdateScroll(display, textInfo)
-Display *display;
-struct txtWin *textInfo; /* Text window information */
-/*
- * This routine computes the current extent of the scroll bar
- * indicator and repaints the bar with the correct information.
- */
-{
- int top, bottom;
-
- if (textInfo->numLines > 1) {
- top = textInfo->startLine * (textInfo->h - 2*BARBORDER) /
- (textInfo->numLines - 1);
- bottom = textInfo->endLine * (textInfo->h - 2*BARBORDER) /
- (textInfo->numLines - 1);
- } else {
- top = 0;
- bottom = textInfo->h - (2*BARBORDER);
- }
-
- /* Draw it - make sure there is a little padding */
- if (top == 0) top++;
- if (bottom == textInfo->h-(2*BARBORDER)) bottom--;
-
- XFillRectangle(display, textInfo->scrollBar,
- textInfo->bgGC,
- 0, 0, BARSIZE, top-1);
- XFillRectangle(display, textInfo->scrollBar,
- DEFAULT_GC, top, BARSIZE - (2*BARBORDER) - 2,
- bottom - top);
- XFillRectangle(display, textInfo->scrollBar, DEFAULT_GC,
- 0, bottom+1, BARSIZE,
- textInfo->h - (2 * BARBORDER) - bottom);
-
- return 1;
-}
-
-
-
-
-int TxtClear(display, w)
-Display *display;
-Window w;
-/*
- * This routine clears a scrollable text window. It resets the current
- * writing position to the upper left hand corner of the screen.
- * NOTE: THIS ALSO CLEARS THE CONTENTS OF THE TEXT WINDOW BUFFER AND
- * RESETS THE SCROLL BAR. Returns 0 if the window is not a text window.
- * This should be used *instead* of XClear.
- */
-{
- struct txtWin *textInfo;
- int index;
-
- if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w)) == 0)
- return 0;
-
- /* Zero out the arrays */
- textInfo->bufSpot = 0;
- for (index = 0; index < textInfo->numLines; index++) {
- InitLine(textInfo->txtBuffer[index]);
- }
- textInfo->txtBuffer[0]->lineHeight =
- textInfo->theFonts[textInfo->curFont].ascent +
- textInfo->theFonts[textInfo->curFont].descent;
-
- textInfo->numLines = 1;
- textInfo->startLine = 0;
- textInfo->endLine = 0;
- textInfo->curLine = 0;
- textInfo->curX = 0;
- textInfo->curY = YPADDING + textInfo->theFonts[textInfo->curFont].ascent
- + textInfo->theFonts[textInfo->curFont].descent;
-
- textInfo->bottomSpace = textInfo->h - YPADDING -
- textInfo->theFonts[textInfo->curFont].ascent - INTERLINE -
- textInfo->theFonts[textInfo->curFont].descent;
- /* Actually clear the window */
- XClearWindow(display, w);
-
- /* Draw the current cursor */
- XFillRectangle(display, w, textInfo->CursorGC,
- XPADDING + CUROFFSET, textInfo->curY,
- CURSORWIDTH,
- textInfo->theFonts[textInfo->curFont].ascent +
- textInfo->theFonts[textInfo->curFont].descent);
-
- /* Update the scroll bar */
- UpdateScroll(display, textInfo);
- return 1;
-}
-
-
-static int WarpToBottom(display, textInfo)
-Display *display;
-struct txtWin *textInfo; /* Text Information */
-/*
- * This routine causes the specified text window to display its
- * last screen of information. It updates the scroll bar
- * to the appropriate spot. The implementation scans backward
- * through the buffer to find an appropriate starting spot for
- * the window.
- */
-{
- int index, height, lineHeight;
-
- index = textInfo->numLines-1;
- height = 0;
- while (index >= 0) {
- lineHeight = textInfo->txtBuffer[index]->lineHeight + INTERLINE;
- if (height + lineHeight > textInfo->h) break;
- height += lineHeight;
- index--;
- }
- textInfo->startLine = index + 1;
- textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace));
- textInfo->curY = textInfo->h - textInfo->bottomSpace -
- textInfo->txtBuffer[textInfo->endLine]->lineHeight;
- XClearWindow(display, textInfo->mainWindow);
- TxtRepaint(display, textInfo->mainWindow);
- return 1;
-}
-
-
-
-static int UpdateExposures(display, textInfo)
-Display *display;
-struct txtWin *textInfo; /* Text window information */
-/*
- * Before a new scrolling action occurs, the text window package
- * must handle all COPYEXPOSE events generated by the last scrolling
- * action. This routine is called to do this. Foreign events (those
- * not handled by TxtFilter) are queued up and replaced on the queue
- * after the processing of the exposure events is complete.
- */
-{
-#if 0
- XEvent foreignQueue[MAXFOREIGN];
- int index, lastItem = 0;
-
- while (textInfo->flagWord & COPYEXPOSE) {
- XNextEvent(display, &(foreignQueue[lastItem]));
- if (!TxtFilter(display, &(foreignQueue[lastItem])))
- lastItem++;
- if (lastItem >= MAXFOREIGN) {
- printf("Too many foreign events to queue!\n");
- textInfo->flagWord &= (~COPYEXPOSE);
- }
- }
- for (index = 0; index < lastItem; index++) {
- XPutBackEvent(display, &(foreignQueue[index]));
- }
-#endif
- return 1;
-}
-
-
-static int ScrollDown(display,textInfo)
-Display *display;
-struct txtWin *textInfo; /* Text window information */
-/*
- * This routine scrolls the indicated text window down by one
- * line. The line below the current line must exist. The window
- * is scrolled so that the line below the last line is fully
- * displayed. This may cause many lines to scroll off the top.
- * Scrolling is done using XCopyArea. The exposure events should
- * be caught using ExposeCopy.
- */
-{
- int lineSum, index, targetSpace, freeSpace, updateFlag;
-
- lineSum = 0;
- if (textInfo->endLine + 1 >= textInfo->numLines) return 0;
- targetSpace = textInfo->txtBuffer[textInfo->endLine+1]->lineHeight +
- INTERLINE;
- if (textInfo->bottomSpace < targetSpace) {
- index = textInfo->startLine;
- while (index < textInfo->endLine) {
- lineSum += (textInfo->txtBuffer[index]->lineHeight + INTERLINE);
- if (textInfo->bottomSpace + lineSum >= targetSpace) break;
- index++;
- }
-
- /* Must move upward by 'lineSum' pixels */
- XCopyArea(display, textInfo->mainWindow, textInfo->mainWindow,
- DEFAULT_GC, 0, lineSum,
- textInfo->w - BARSIZE, textInfo->h,
- 0, 0);
-
- textInfo->flagWord |= COPYEXPOSE;
- /* Repair the damage to the structures */
- textInfo->startLine = index + 1;
- updateFlag = 1;
- } else {
- updateFlag = 0;
- }
- /* More lines might be able to fit. Let's check. */
- freeSpace = textInfo->bottomSpace + lineSum - targetSpace;
- index = textInfo->endLine + 1;
- while (index < textInfo->numLines-1) {
- if (freeSpace - textInfo->txtBuffer[index+1]->lineHeight - INTERLINE < 0)
- break;
- freeSpace -= (textInfo->txtBuffer[index+1]->lineHeight + INTERLINE);
- index++;
- }
- textInfo->endLine = index;
- textInfo->bottomSpace = freeSpace;
- if (updateFlag) {
- UpdateExposures(display, textInfo);
- }
- UpdateScroll(display, textInfo);
- return 1;
-}
-
-
-
-
-static int ExpandLines(textInfo)
-struct txtWin *textInfo; /* Text Information */
-/*
- * This routine allocates and initializes additional space in
- * the line start array (txtBuffer). The new space
- * is allocated using realloc. The expansion factor is a percentage
- * given by EXPANDPERCENT.
- */
-{
- int newSize, index;
-
- newSize = textInfo->allocLines;
- newSize += (newSize * EXPANDPERCENT) / 100;
-
- textInfo->txtBuffer = (struct txtLine **)
- realloc((char *) textInfo->txtBuffer,
- (unsigned) (newSize * sizeof(struct txtLine *)));
- for (index = textInfo->allocLines; index < newSize; index++) {
- textInfo->txtBuffer[index] = alloc(struct txtLine);
- InitLine(textInfo->txtBuffer[index]);
- }
- textInfo->allocLines = newSize;
- return 1;
-}
-
-static int ExpandBuffer(textInfo)
-struct txtWin *textInfo; /* Text information */
-/*
- * Expands the basic character buffer using realloc. The expansion
- * factor is a percentage given by EXPANDPERCENT.
- */
-{
- int newSize;
-
- newSize = textInfo->bufAlloc + (textInfo->bufAlloc * EXPANDPERCENT) / 100;
- textInfo->mainBuffer = (short *)
- realloc((char *) textInfo->mainBuffer, (unsigned) newSize * sizeof(short));
- textInfo->bufAlloc = newSize;
- return 1;
-}
-
-
-
-static int HandleNewLine(display, textInfo, flagWord)
-Display *display;
-struct txtWin *textInfo; /* Text Information */
-int flagWord; /* DODISP or NONEWLINE or both */
-/*
- * This routine initializes the next line for drawing by setting
- * its height to the current font height, scrolls the screen down
- * one line, and updates the current drawing position to the
- * left edge of the newly cleared line. If DODISP is specified,
- * the screen will be updated (otherwise not). If NONEWLINE is
- * specified, no newline character will be added to the text buffer
- * (this is for line wrap).
- */
-{
- struct txtLine *curLine, *nextLine;
-
- /* Check to see if a new line must be allocated */
- if (textInfo->curLine >= textInfo->allocLines-1)
- /* Expand the number of lines */
- ExpandLines(textInfo);
- textInfo->numLines += 1;
-
- /* Then we initialize the next line */
- nextLine = textInfo->txtBuffer[textInfo->numLines-1];
- nextLine->lineHeight =
- textInfo->theFonts[textInfo->curFont].ascent +
- textInfo->theFonts[textInfo->curFont].descent;
-
- curLine = textInfo->txtBuffer[textInfo->curLine];
- if (flagWord & DODISP) {
- /* Scroll down a line if required */
- if ((textInfo->curY + curLine->lineHeight +
- nextLine->lineHeight + (INTERLINE * 2)) > textInfo->h)
- {
- ScrollDown(display, textInfo);
- }
- else
- {
- /* Update the bottom space appropriately */
- textInfo->bottomSpace -= (nextLine->lineHeight + INTERLINE);
- textInfo->endLine += 1;
- }
- /* Update drawing position */
- textInfo->curY = textInfo->h -
- (textInfo->bottomSpace + nextLine->lineHeight);
- }
-
- /* Move down a line */
- textInfo->curLine += 1;
- if (!(flagWord & NONEWLINE)) {
- /* Append end-of-line to text buffer */
- if (textInfo->bufSpot >= textInfo->bufAlloc) {
- /* Allocate more space in main text buffer */
- ExpandBuffer(textInfo);
- }
- textInfo->mainBuffer[(textInfo->bufSpot)++] =
- (textInfo->curFont << FONTSHIFT) | '\n';
- }
- nextLine->lineText = textInfo->bufSpot;
- textInfo->curX = 0;
- return 1;
-}
-
-
-
-static int CharSize(textInfo, lineNum, charNum)
-struct txtWin *textInfo; /* Current Text Information */
-int lineNum; /* Line in buffer */
-int charNum; /* Character in line */
-/*
- * This routine determines the size of the specified character.
- * It takes in account the font of the character and whether its
- * fixed or variable. The size includes INTERSPACE spacing between
- * the characters.
- */
-{
- register XFontStruct *charFont;
- register short *theLine;
- register short theChar;
-
- theLine = &(textInfo->mainBuffer[textInfo->txtBuffer[lineNum]->lineText]);
- theChar = theLine[charNum] & CHARMASK;
- charFont = &(textInfo->theFonts[(theChar & FONTMASK) >> FONTSHIFT]);
- if (theChar <= charFont->min_char_or_byte2 ||
- theChar >= charFont->max_char_or_byte2 ||
- charFont->per_char == 0)
- return charFont->max_bounds.width + 1;
- else
- return charFont->per_char[theChar].width + 1;
-}
-
-
-
-
-
-static int HandleBackspace(display, textInfo, flagWord)
-Display *display;
-struct txtWin *textInfo; /* Text Information */
-int flagWord; /* DODISP or nothing */
-/*
- * This routine handles a backspace found in the input stream. The
- * character before the current writing position will be erased and
- * the drawing position will move back one character. If the writing
- * position is at the left margin, the drawing position will move
- * up to the previous line. If it is a line that has been wrapped,
- * the character at the end of the previous line will be erased.
- */
-{
- struct txtLine *thisLine, *prevLine;
- int chSize;
-
- thisLine = textInfo->txtBuffer[textInfo->curLine];
- /* First, determine whether we need to go back a line */
- if (thisLine->lineLength == 0) {
- /* Bleep if at top of buffer */
- if (textInfo->curLine == 0) {
- XBell(display, 50);
- return 0;
- }
-
- /* See if we have to scroll in the other direction */
- if ((flagWord & DODISP) && (textInfo->curY <= YPADDING)) {
- /* This will display the last lines of the buffer */
- WarpToBottom(display, textInfo);
- }
-
- /* Set drawing position at end of previous line */
- textInfo->curLine -= 1;
- prevLine = textInfo->txtBuffer[textInfo->curLine];
- textInfo->numLines -= 1;
- if (flagWord & DODISP) {
- textInfo->curY -= (prevLine->lineHeight + INTERLINE);
- textInfo->bottomSpace += (thisLine->lineHeight + INTERLINE);
- textInfo->endLine -= 1;
- }
-
- /* We are unlinewrapping if the previous line has flag set */
- if (prevLine->lineFlags & WRAPFLAG) {
- /* Get rid of line wrap indicator */
- if (flagWord & DODISP) {
- XFillRectangle(display, textInfo->mainWindow,
- textInfo->bgGC,
- textInfo->w - BARSIZE - WRAPINDSIZE,
- textInfo->curY, WRAPINDSIZE,
- prevLine->lineHeight);
- }
- prevLine->lineFlags &= (~WRAPFLAG);
- /* Call recursively to wipe out the ending character */
- HandleBackspace(display, textInfo, flagWord);
- } else {
- /* Delete the end-of-line in the primary buffer */
- textInfo->bufSpot -= 1;
- }
- } else {
- /* Normal deletion of character */
- chSize =
- CharSize(textInfo, textInfo->curLine,
- textInfo->txtBuffer[textInfo->curLine]->lineLength - 1);
- /* Move back appropriate amount and wipe it out */
- thisLine->lineWidth -= chSize;
- if (flagWord & DODISP) {
- XFillRectangle(display, textInfo->mainWindow,
- textInfo->bgGC,
- thisLine->lineWidth, textInfo->curY,
- chSize, thisLine->lineHeight);
- }
- /* Delete from buffer */
- textInfo->txtBuffer[textInfo->curLine]->lineLength -= 1;
- textInfo->bufSpot -= 1;
- }
- return 1;
-}
-
-
-
-static int DrawLineWrap(display, win, x, y, h, col)
-Display *display;
-Window win; /* What window to draw it in */
-int x, y; /* Position of upper left corner */
-int h; /* Height of indicator */
-int col; /* Color of indicator */
-/*
- * This routine draws a line wrap indicator at the end of a line.
- * Visually, it is an arrow of the specified height directly against
- * the scroll bar border. The bitmap used for the arrow is stored
- * in 'arrowMap' with size 'arrow_width' and 'arrow_height'.
- */
-{
- struct txtWin *textInfo;
-
- textInfo = (struct txtWin *)XLookUpAssoc(display, textWindows,
- (XID) win);
-
- /* First, draw the arrow */
- XCopyArea(display, textInfo->arrowMap, textInfo->mainWindow,
- textInfo->CursorGC,
- 0, 0, arrow_width, arrow_height,
- x, y + h - arrow_height, 1);
-
- /* Then draw the stem */
- XDrawLine(display, textInfo->mainWindow, textInfo->CursorGC,
- x + STEMOFFSET, y,
- x + STEMOFFSET, y + h - arrow_height);
- return 1;
-}
-
-
-
-
-static int DrawLine(display, textInfo, lineIndex, ypos)
-Display *display;
-struct txtWin *textInfo; /* Text window information */
-int lineIndex; /* Index of line to draw */
-int ypos; /* Y position for line */
-/*
- * This routine destructively draws the indicated line in the
- * indicated window at the indicated position. It does not
- * clear to end of line however. It draws a line wrap indicator
- * if needed but does not draw a cursor.
- */
-{
- int index, startPos, curFont, theColor, curX, saveX, fontIndex;
- struct txtLine *someLine;
- char lineBuffer[BUFSIZE], *glyph;
- short *linePointer;
- XFontStruct *theFont;
- XGCValues gc;
-
- /* First, we draw the text */
- index = 0;
- curX = XPADDING;
- someLine = textInfo->txtBuffer[lineIndex];
- linePointer = &(textInfo->mainBuffer[someLine->lineText]);
- while (index < someLine->lineLength) {
- startPos = index;
- saveX = curX;
- curFont = linePointer[index] & FONTMASK;
- fontIndex = curFont >> FONTSHIFT;
- theFont = &(textInfo->theFonts[fontIndex]);
- theColor = textInfo->theColors[fontIndex];
- glyph = &(lineBuffer[0]);
- while ((index < someLine->lineLength) &&
- ((linePointer[index] & FONTMASK) == curFont))
- {
- *glyph = linePointer[index] & CHARMASK;
- index++;
- curX += CharSize(textInfo, lineIndex, index);
- glyph++;
- }
-
- /* Flush out the glyphs */
- XFillRectangle(display, textInfo->mainWindow,
- textInfo->bgGC,
- saveX, ypos,
- textInfo->w - BARSIZE,
- someLine->lineHeight + YPADDING + INTERLINE);
-
- XDrawString(display, textInfo->mainWindow,
- textInfo->fontGC[fontIndex],
- saveX, ypos,
- lineBuffer, someLine->lineLength);
- }
- /* Then the line wrap indicator (if needed) */
- if (someLine->lineFlags & WRAPFLAG) {
- DrawLineWrap(display, textInfo->mainWindow,
- textInfo->w - BARSIZE - WRAPINDSIZE,
- ypos, someLine->lineHeight,
- textInfo->fgPix);
- }
- return 1;
-}
-
-
-
-
-static int HandleNewFont(display, fontNum, textInfo, flagWord)
-Display *display;
-int fontNum; /* Font number */
-struct txtWin *textInfo; /* Text information */
-int flagWord; /* DODISP or nothing */
-/*
- * This routine handles a new font request. These requests take
- * the form "^F<digit>". The parsing is done in TxtWriteStr.
- * This routine is called only if the form is valid. It may return
- * a failure (0 status) if the requested font is not loaded.
- * If the new font is larger than any of the current
- * fonts on the line, it will change the line height and redisplay
- * the line.
- */
-{
- struct txtLine *thisLine;
- int heightDiff, baseDiff, redrawFlag;
-
- if (textInfo->theFonts[fontNum].fid == 0) {
- return 0;
- } else {
- thisLine = textInfo->txtBuffer[textInfo->curLine];
- textInfo->curFont = fontNum;
- redrawFlag = 0;
- heightDiff = textInfo->theFonts[fontNum].ascent +
- textInfo->theFonts[fontNum].descent -
- thisLine->lineHeight;
-
- if (heightDiff > 0) {
- redrawFlag = 1;
- } else {
- heightDiff = 0;
- }
-
- if (redrawFlag) {
- if (flagWord & DODISP) {
- /* Clear current line */
- XFillRectangle(display, textInfo->mainWindow,
- textInfo->bgGC,
- 0, textInfo->curY, textInfo->w,
- thisLine->lineHeight);
-
- /* Check to see if it requires scrolling */
- if ((textInfo->curY + thisLine->lineHeight + heightDiff +
- INTERLINE) > textInfo->h)
- {
- /*
- * General approach: "unscroll" the last line up
- * and then call ScrollDown to do the right thing.
- */
- textInfo->endLine -= 1;
- textInfo->bottomSpace += thisLine->lineHeight +
- INTERLINE;
-
- XFillRectangle(display, textInfo->mainWindow,
- textInfo->bgGC,
- 0, textInfo->h - textInfo->bottomSpace,
- textInfo->w, textInfo->bottomSpace);
-
- thisLine->lineHeight += heightDiff;
- ScrollDown(display, textInfo);
- textInfo->curY = textInfo->h -
- (textInfo->bottomSpace + INTERLINE +
- thisLine->lineHeight);
- }
- else
- {
- /* Just update bottom space */
- textInfo->bottomSpace -= heightDiff;
- thisLine->lineHeight += heightDiff;
- }
- /* Redraw the current line */
- DrawLine(display, textInfo, textInfo->curLine, textInfo->curY);
- } else {
- /* Just update line height */
- thisLine->lineHeight += heightDiff;
- }
- }
- return 1;
- }
-}
-
-
-
-int TxtWriteStr(display, w, str)
-Display *display;
-Window w; /* Text window */
-register char *str; /* 0 terminated string */
-/*
- * This routine writes a string to the specified text window.
- * The following notes apply:
- * - Text is always appended to the end of the text buffer.
- * - If the scroll bar is positioned such that the end of the
- * text is not visible, an automatic scroll to the bottom
- * will be done before the appending of text.
- * - Non-printable ASCII characters are not displayed.
- * - The '\n' character causes the current text position to
- * advance one line and start at the left.
- * - Tabs are not supported.
- * - Lines too long for the screen will be wrapped and a line wrap
- * indication will be drawn.
- * - Backspace clears the previous character. It will do the right
- * thing if asked to backspace past a wrapped line.
- * - A new font can be chosen using the sequence '^F<digit>' where
- * <digit> is 0-7. The directive will be ignored if
- * there is no font in the specified slot.
- * Returns 0 if something went wrong.
- */
-{
- register int fontIndex;
- register struct txtWin *textInfo;
- register struct txtLine *thisLine;
-
- if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w)) == 0)
- return 0;
-
- /* See if screen needs to be updated */
- if (textInfo->flagWord & SCREENWRONG) {
- TxtRepaint(display, textInfo->mainWindow);
- }
-
- /* See if we have to scroll down to the bottom */
- if (textInfo->flagWord & NOTATBOTTOM) {
- WarpToBottom(display, textInfo);
- textInfo->flagWord &= (~NOTATBOTTOM);
- }
-
- /* Undraw the current cursor */
- thisLine = textInfo->txtBuffer[textInfo->curLine];
-
- XFillRectangle(display, w, textInfo->bgGC,
- thisLine->lineWidth + CUROFFSET,
- textInfo->curY,
- CURSORWIDTH,
- thisLine->lineHeight);
-
- for ( /* str is ok */ ; (*str != 0) ; str++) {
- /* Check to see if we are waiting on a font */
- if (textInfo->flagWord & FONTNUMWAIT) {
- textInfo->flagWord &= (~FONTNUMWAIT);
- fontIndex = *str - '0';
- if ((fontIndex >= 0) && (fontIndex < MAXFONTS)) {
- /* Handle font -- go get next character */
- if (HandleNewFont(display, fontIndex, textInfo, DODISP))
- continue;
- }
- }
-
- /* Inline code for handling normal character case */
- if ((*str >= LOWCHAR) && (*str <= HIGHCHAR)) {
- register XFontStruct *thisFont;
- register struct txtLine *thisLine;
- register int charWidth;
- int thisColor;
-
- /* Determine size of character */
- thisFont = &(textInfo->theFonts[textInfo->curFont]);
- thisColor = textInfo->theColors[textInfo->curFont];
- if (*str <= thisFont->min_char_or_byte2 ||
- *str >= thisFont->max_char_or_byte2 ||
- thisFont->per_char == 0)
- charWidth = thisFont->max_bounds.width + 1;
- else
- charWidth = thisFont->per_char[*str].width + 1;
-
- /* Check to see if line wrap is required */
- thisLine = textInfo->txtBuffer[textInfo->curLine];
- if (thisLine->lineWidth + charWidth >
- (textInfo->w-BARSIZE-WRAPINDSIZE))
- {
- DrawLineWrap(display, textInfo->mainWindow,
- textInfo->w-BARSIZE-WRAPINDSIZE,
- textInfo->curY, thisLine->lineHeight,
- textInfo->fgPix);
- thisLine->lineFlags |= WRAPFLAG;
- /* Handle the spacing problem the same way as a newline */
- HandleNewLine(display, textInfo, DODISP | NONEWLINE);
- thisLine = textInfo->txtBuffer[textInfo->curLine];
- }
-
- /* Ready to draw character */
- XDrawString(display, textInfo->mainWindow,
- DEFAULT_GC,
- textInfo->curX += charWidth,
- textInfo->curY + thisLine->lineHeight,
- str, 1);
-
- /* Append character onto main buffer */
- if (textInfo->bufSpot >= textInfo->bufAlloc)
- /* Make room for more characters */
- ExpandBuffer(textInfo);
- textInfo->mainBuffer[(textInfo->bufSpot)++] =
- (textInfo->curFont << FONTSHIFT) | (*str);
-
- /* Update the line start array */
- thisLine->lineLength += 1;
- thisLine->lineWidth += charWidth;
- } else if (*str == NEWLINE) {
- HandleNewLine(display, textInfo, DODISP);
- } else if (*str == NEWFONT) {
- /* Go into waiting for font number mode */
- textInfo->flagWord |= FONTNUMWAIT;
- } else if (*str == BACKSPACE) {
- HandleBackspace(display, textInfo, DODISP);
- } else {
- /* Ignore all others */
- }
- }
- /* Draw the cursor in its new position */
- thisLine = textInfo->txtBuffer[textInfo->curLine];
-
- XFillRectangle(display, w, textInfo->CursorGC,
- thisLine->lineWidth + CUROFFSET,
- textInfo->curY /* + thisLine->lineHeight */,
- CURSORWIDTH, thisLine->lineHeight);
-
- return 1;
-}
-
-
-
-int TxtJamStr(display, w, str)
-Display *display;
-Window w; /* Text window */
-register char *str; /* NULL terminated string */
-/*
- * This is the same as TxtWriteStr except the screen is NOT updated.
- * After a call to this routine, TxtRepaint should be called to
- * update the screen. This routine is meant to be used to load
- * a text buffer with information and then allow the user to
- * scroll through it at will.
- */
-{
- register int fontIndex;
- register struct txtWin *textInfo;
-
- if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w)
- ) == 0)
- return 0;
-
- for ( /* str is ok */ ; (*str != 0) ; str++) {
- /* Check to see if we are waiting on a font */
- if (textInfo->flagWord & FONTNUMWAIT) {
- textInfo->flagWord &= (~FONTNUMWAIT);
- fontIndex = *str - '0';
- if ((fontIndex >= 0) && (fontIndex < MAXFONTS)) {
- if (HandleNewFont(display, fontIndex, textInfo, 0)) {
- /* Handled font -- go get next character */
- continue;
- }
- }
- }
- /* Inline code for handling normal character case */
- if ((*str >= LOWCHAR) && (*str <= HIGHCHAR)) {
- register XFontStruct *thisFont;
- register struct txtLine *thisLine;
- register int charWidth;
-
- /* Determine size of character */
- thisFont = &(textInfo->theFonts[textInfo->curFont]);
-
- if (*str <= thisFont->min_char_or_byte2 ||
- *str >= thisFont->max_char_or_byte2 ||
- thisFont->per_char == 0)
- charWidth = thisFont->max_bounds.width + 1;
- else
- charWidth = thisFont->per_char[*str].width + 1;
-
- /* Check to see if line wrap is required */
- thisLine = textInfo->txtBuffer[textInfo->curLine];
- if (thisLine->lineWidth + charWidth >
- (textInfo->w-BARSIZE-WRAPINDSIZE))
- {
- thisLine->lineFlags |= WRAPFLAG;
- /* Handle the spacing problem the same way as a newline */
- HandleNewLine(display, textInfo, NONEWLINE);
- thisLine = textInfo->txtBuffer[textInfo->curLine];
- }
- /* Append character onto main buffer */
- if (textInfo->bufSpot >= textInfo->bufAlloc)
- /* Make room for more characters */
- ExpandBuffer(textInfo);
- textInfo->mainBuffer[(textInfo->bufSpot)++] =
- (textInfo->curFont << FONTSHIFT) | (*str);
-
- /* Update the line start array */
- thisLine->lineLength += 1;
- thisLine->lineWidth += charWidth;
- } else if (*str == NEWLINE) {
- HandleNewLine(display, textInfo, 0);
- } else if (*str == NEWFONT) {
- /* Go into waiting for font number mode */
- textInfo->flagWord |= FONTNUMWAIT;
- } else if (*str == BACKSPACE) {
- HandleBackspace(display, textInfo, 0);
- } else {
- /* Ignore all others */
- }
- }
- textInfo->flagWord |= SCREENWRONG;
- return 1;
-}
-
-
-
-int TxtRepaint(display,w)
-Display *display;
-Window w;
-/*
- * Repaints the given scrollable text window. The routine repaints
- * the entire window. For handling exposure events, the TxtFilter
- * routine should be used.
- */
-{
- struct txtWin *textInfo;
- int index, ypos;
-
- if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w)
- ) == 0)
- return 0;
-
- /* Check to see if the screen is up to date */
- if (textInfo->flagWord & SCREENWRONG) {
- textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace));
- textInfo->flagWord &= (~SCREENWRONG);
- }
-
- ypos = YPADDING;
- index = textInfo->startLine;
- for (;;) {
- DrawLine(display, textInfo, index, ypos);
- if (index >= textInfo->endLine) break;
- ypos += (textInfo->txtBuffer[index]->lineHeight + INTERLINE);
- index++;
- }
- /* Draw the cursor (if on screen) */
- if (textInfo->endLine == textInfo->curLine) {
- XFillRectangle(display, w, textInfo->CursorGC,
- textInfo->txtBuffer[index]->lineWidth + CUROFFSET,
- ypos /* + textInfo->txtBuffer[index]->lineHeight */,
- CURSORWIDTH, textInfo->txtBuffer[index]->lineHeight);
-
- }
- /* Update the scroll bar */
- UpdateScroll(display, textInfo);
- return 1;
-}
-
-
-
-static int InsertIndex(textInfo, thisIndex, ypos)
-struct txtWin *textInfo; /* Text Window Information */
-int thisIndex; /* Line index of exposed line */
-int ypos; /* Drawing position of line */
-/*
- * This routine inserts the supplied line index into the copy
- * exposure array for 'textInfo'. The array is kept sorted
- * from lowest to highest using insertion sort. The array
- * is dynamically expanded if needed.
- */
-{
- struct expEvent *newItem;
- int newSize, index, downIndex;
-
- /* Check to see if we need to expand it */
- if ((textInfo->exposeSize + 3) >= textInfo->exposeAlloc) {
- newSize = textInfo->exposeAlloc +
- (textInfo->exposeAlloc * EXPANDPERCENT / 100);
- textInfo->exposeAry = (struct expEvent **)
- realloc((char *) textInfo->exposeAry,
- (unsigned) (newSize * sizeof(struct expEvent *)));
- for (index = textInfo->exposeAlloc; index < newSize; index++)
- textInfo->exposeAry[index] = alloc(struct expEvent);
- textInfo->exposeAlloc = newSize;
- }
- /* Find spot for insertion. NOTE: last spot has big number */
- for (index = 0; index <= textInfo->exposeSize; index++) {
- if (textInfo->exposeAry[index]->lineIndex >= thisIndex) {
- if (textInfo->exposeAry[index]->lineIndex > thisIndex) {
- /* Insert before this entry */
- newItem = textInfo->exposeAry[textInfo->exposeSize+1];
- for (downIndex = textInfo->exposeSize;
- downIndex >= index;
- downIndex--)
- {
- textInfo->exposeAry[downIndex+1] =
- textInfo->exposeAry[downIndex];
- }
- /* Put a free structure at this spot */
- textInfo->exposeAry[index] = newItem;
- /* Fill it in */
- textInfo->exposeAry[index]->lineIndex = thisIndex;
- textInfo->exposeAry[index]->ypos = ypos;
- /* Break out of loop */
- textInfo->exposeSize += 1;
- }
- break;
- }
- }
- return 1;
-}
-
-
-
-static int ScrollUp(display, textInfo)
-Display *display;
-struct txtWin *textInfo; /* Text window information */
-/*
- * This routine scrolls the indicated text window up by one
- * line. The line above the current line must exist. The
- * window is scrolled so that the line above the start line
- * is displayed at the top of the screen. This may cause
- * many lines to scroll off the bottom. The scrolling is
- * done using XCopyArea. The exposure events should be caught
- * by ExposeCopy.
- */
-{
- int targetSpace;
-
- /* Make sure all exposures have been handled by now */
- if (textInfo->startLine == 0) return 0;
- targetSpace = textInfo->txtBuffer[textInfo->startLine-1]->lineHeight +
- INTERLINE;
- /* Move the area downward by the target amount */
- XCopyArea(display, textInfo->mainWindow, textInfo->mainWindow,
- DEFAULT_GC,
- 0, YPADDING, textInfo->w - BARSIZE,
- textInfo->h, 0, targetSpace);
-
- textInfo->flagWord |= COPYEXPOSE;
- /* Update the text window parameters */
- textInfo->startLine -= 1;
- textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace));
-
- /* Clear out bottom space region */
- XClearArea(display, textInfo->mainWindow,
- 0, textInfo->h - textInfo->bottomSpace,
- textInfo->w, textInfo->bottomSpace);
-
- UpdateExposures(display, textInfo);
- UpdateScroll(display, textInfo);
-
- return 1;
-}
-
-
-static int ScrollToSpot(display, textInfo, ySpot)
-Display *display;
-struct txtWin *textInfo; /* Text window information */
-int ySpot; /* Button position in scroll window */
-/*
- * This routine scrolls the specified text window relative to the
- * position of the mouse in the scroll bar. The center of the screen
- * will be positioned to correspond to the mouse position.
- */
-{
- int targetLine, aboveLines;
-
- targetLine = textInfo->numLines * ySpot / textInfo->h;
- textInfo->startLine = targetLine;
- textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace));
- aboveLines = 0;
- /* Make the target line the *center* of the window */
- while ((textInfo->startLine > 0) &&
- (aboveLines < textInfo->endLine - targetLine))
- {
- textInfo->startLine -= 1;
- textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace));
- aboveLines++;
- }
- if (textInfo->endLine == textInfo->numLines-1) {
- WarpToBottom(display, textInfo);
- } else {
- XClearWindow(display, textInfo->mainWindow);
- TxtRepaint(display, textInfo->mainWindow);
- }
- return 1;
-}
-
-
-
-static int LineToTop(display, textInfo, pos)
-Display *display;
-struct txtWin *textInfo; /* Text window information */
-int pos; /* Y position of mouse */
-/*
- * This routine scrolls the screen down until the line at the
- * mouse position is at the top of the screen. It stops
- * if it can't scroll the buffer down that far. If the
- * global 'ScrollOption' is NORMSCROLL, a smooth scroll
- * is used. Otherwise, it jumps to the right position
- * and repaints the screen.
- */
-{
- int index, sum;
-
- /* First, we find the current line */
- sum = 0;
- for (index = textInfo->startLine; index <= textInfo->endLine; index++) {
- if (sum + textInfo->txtBuffer[index]->lineHeight + INTERLINE> pos) break;
- sum += textInfo->txtBuffer[index]->lineHeight + INTERLINE;
- }
- /* We always want to scroll down at least one line */
- if (index == textInfo->startLine) index++;
- if (ScrollOption == NORMSCROLL) {
- /* Scroll down until 'index' is the starting line */
- while ((textInfo->startLine < index) && ScrollDown(display, textInfo))
- {
- /* Empty Loop Body */
- }
- } else {
- /* Immediately jump to correct spot */
- textInfo->startLine = index;
- textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace));
- if (textInfo->endLine == textInfo->numLines-1) {
- WarpToBottom(display, textInfo);
- } else {
- XClearWindow(display, textInfo->mainWindow);
- TxtRepaint(display, textInfo->mainWindow);
- }
- }
- /* Check to see if at end of buffer */
- if (textInfo->endLine >= textInfo->numLines-1) {
- textInfo->flagWord &= (~NOTATBOTTOM);
- }
- return 1;
-}
-
-
-
-static int TopToHere(display, textInfo, pos)
-Display *display;
-struct txtWin *textInfo; /* Text window information */
-int pos; /* Y position of mouse */
-/*
- * This routine scrolls the screen up until the top line of
- * the screen is at the current Y position of the mouse. Again,
- * it will stop if it can't scroll that far. If the global
- * 'ScrollOption' is NORMSCROLL, a smooth scroll is used.
- * If it's not, it will simply redraw the screen at the
- * correct spot.
- */
-{
- int sum, target, linesup, index;
-
- target = pos - textInfo->txtBuffer[textInfo->startLine]->lineHeight;
- /* We always want to scroll up at least one line */
- if (target <= 0) target = 1;
- sum = 0;
- linesup = 0;
- /* Check to see if we are at the top anyway */
- if (textInfo->startLine == 0) return 0;
- if (ScrollOption == NORMSCROLL) {
- /* Scroll up until sum of new top lines greater than target */
- while ((sum < target) && ScrollUp(display, textInfo)) {
- sum += textInfo->txtBuffer[textInfo->startLine]->lineHeight;
- linesup++;
- }
- } else {
- /* Search backward to find index */
- index = textInfo->startLine - 1;
- while ((index > 0) && (sum < target)) {
- sum += textInfo->txtBuffer[index]->lineHeight;
- linesup++;
- index--;
- }
- /* Go directly to the index */
- textInfo->startLine = index;
- textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace));
- XClearWindow(display, textInfo->mainWindow);
- TxtRepaint(display, textInfo->mainWindow);
- }
- /* If we scrolled, assert we are not at bottom of buffer */
- if (linesup > 0) {
- textInfo->flagWord |= NOTATBOTTOM;
- }
- return 1;
-}
-
-
-
-int TxtFilter(display, evt)
-Display *display;
-XEvent *evt;
-/*
- * This routine handles events associated with scrollable text windows.
- * It will handle all exposure events and any button released events
- * in the scroll bar of a text window. It does NOT handle any other
- * events. If it cannot handle the event, it will return 0.
- */
-{
- XExposeEvent *expose = &evt->xexpose;
- XButtonEvent *btEvt = &evt->xbutton;
- XGraphicsExposeEvent *gexpose = &evt->xgraphicsexpose;
- XNoExposeEvent *noexpose = &evt->xnoexpose;
- struct txtWin *textInfo;
- int index, ypos;
- Window w, sw;
-
- if (textWindows == (XAssocTable *) 0) {
- textWindows = XCreateAssocTable(32);
- if (textWindows == (XAssocTable *) 0) return(0);
- }
- if (evt->type == Expose) {
- w = expose->window;
- sw = 0;
- }
- else if (evt->type == GraphicsExpose) {
- w = gexpose->drawable;
- sw = 0;
- }
- else if (evt->type == NoExpose) {
- w = noexpose->drawable;
- sw = 0;
- }
- else if (evt->type == ButtonRelease) {
- w = btEvt->window;
- sw = btEvt->subwindow;
- }
- else
- return 0;
-
- if ((textInfo = (struct txtWin *)
- XLookUpAssoc(display, textWindows, (XID) w)) == 0)
- return 0;
-
- /* Determine whether it's main window or not */
- if ((w == textInfo->mainWindow) && (sw == 0)) {
- /* Main Window - handle exposures */
- switch (evt->type) {
- case Expose:
- ypos = 0 /*YPADDING*/;
- for (index = textInfo->startLine;
- index <= textInfo->endLine;
- index++)
- {
- int lh = textInfo->txtBuffer[index]->lineHeight;
-
- if (((ypos + lh) >= expose->y) &&
- (ypos <= (expose->y + expose->height)))
- {
- /* Intersection region */
- /* Draw line immediately */
- DrawLine(display, textInfo, index, ypos);
- /* And possibly draw cursor */
- if (textInfo->curLine == index) {
- XFillRectangle(display, w, textInfo->CursorGC,
- textInfo->txtBuffer[index]->lineWidth +
- CUROFFSET,
- ypos,
- CURSORWIDTH,
- lh);
- }
- }
- ypos += lh + INTERLINE;
- }
- break;
- case GraphicsExpose:
- ypos = 0 /*YPADDING*/;
- for (index = textInfo->startLine;
- index <= textInfo->endLine;
- index++)
- {
- int lh = textInfo->txtBuffer[index]->lineHeight;
-
- if (((ypos + lh) >= gexpose->y) &&
- (ypos <= (gexpose->y + gexpose->height)))
- {
- /* Intersection region */
- /* Draw line immediately */
- DrawLine(display, textInfo, index, ypos);
- /* And possibly draw cursor */
- if (textInfo->curLine == index) {
- XFillRectangle(display, w, textInfo->CursorGC,
- textInfo->txtBuffer[index]->lineWidth +
- CUROFFSET,
- ypos,
- CURSORWIDTH,
- lh);
- }
- }
- ypos += lh + INTERLINE;
- }
- break;
- case NoExpose:
- break;
- default:
- /* Not one of our events */
- return 0;
- }
- } else {
- switch (evt->type) {
- case Expose:
- UpdateScroll(display, textInfo);
- break;
- case ButtonRelease:
- /* Find out which button */
- switch (btEvt->button) {
- case Button1:
- /* Scroll up until top line is at mouse position */
- TopToHere(display, textInfo, btEvt->y);
- break;
- case Button2:
- /* Scroll to spot relative to position */
- ScrollToSpot(display, textInfo, btEvt->y);
- if (textInfo->endLine >= textInfo->numLines-1) {
- textInfo->flagWord &= (~NOTATBOTTOM);
- } else {
- textInfo->flagWord |= NOTATBOTTOM;
- }
- break;
- case Button3:
- /* Scroll down until pointed line is at top */
- LineToTop(display, textInfo, btEvt->y);
- break;
- }
- break;
- default:
- /* Not one of our events */
- return 0;
- }
- }
- return 1;
-}
diff --git a/gnu/games/chess/Xchess/std.c b/gnu/games/chess/Xchess/std.c
deleted file mode 100644
index 2bbd113..0000000
--- a/gnu/games/chess/Xchess/std.c
+++ /dev/null
@@ -1,427 +0,0 @@
-
-/* This file contains code for X-CHESS.
- Copyright (C) 1986 Free Software Foundation, Inc.
-
-This file is part of X-CHESS.
-
-X-CHESS is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the X-CHESS General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-X-CHESS, but only under the conditions described in the
-X-CHESS General Public License. A copy of this license is
-supposed to have been given to you along with X-CHESS so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-/* RCS Info: $Revision: 1.3 $ on $Date: 1994/11/04 02:11:33 $
- * $Source: /home/ncvs/src/gnu/games/chess/Xchess/std.c,v $
- * Copyright (c) 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
- *
- * Utility routines.
- */
-
-#include "std.h"
-
-#ifndef IBMPC
-#include <sys/types.h>
-#endif not IBMPC
-#ifdef UNIX
-#include <signal.h>
-#include <pwd.h>
-#endif UNIX
-#ifdef BSD
-#include <sys/time.h>
-#include <sys/resource.h>
-#endif BSD
-
-extern char **environ;
-
-bool
-prefix(p, s)
- register char *p, *s;
-{
- while (*p && (*p == *s))
- p++, s++;
- if (!*p)
- return (true);
- else
- return (false);
-}
-
-/* Create a copy of a string. */
-
-char *
-copy(str)
- char *str;
-{
- char *p, *tmalloc();
-
- p = tmalloc(strlen(str) + 1);
- strcpy(p, str);
- return(p);
-}
-
-/* Determine whether sub is a substring of str. */
-
-bool
-substring(sub, str)
- register char *str, *sub;
-{
- register char *s;
-
- while(*str) {
- if(*str == *sub) {
- for(s = sub; *s; s++)
- if(*s != *str++)
- break;
- if(*s == '\0')
- return (true);
- }
- str++;
- }
- return (false);
-}
-
-/* Malloc num bytes and initialize to zero. Fatal error if the space can't
- * be malloc'd.
- */
-
-char *
-tmalloc(num)
- register int num;
-{
- register char *s;
- char *malloc();
-
- s = malloc((unsigned) num);
- if (!s) {
- fatal("malloc: can't allocate %d bytes", num);
- }
- bzero(s, num);
- return(s);
-}
-
-char *
-trealloc(ptr, num)
- char *ptr;
- int num;
-{
- register char *s;
- char *realloc();
-
- s = realloc(ptr, (unsigned) num);
- if (!s) {
- fatal("realloc: can't allocate %d bytes", num);
- }
- /* Well, this won't be zeroed... Too bad... */
- return(s);
-}
-
-/* Append one character to a string. Don't check for overflow. */
-
-void
-appendc(s, c)
- char *s, c;
-{
- while (*s)
- s++;
- *s++ = c;
- *s = '\0';
- return;
-}
-
-int
-scannum(str)
- char *str;
-{
- int i = 0;
-
- while(isdigit(*str))
- i = i * 10 + *(str++) - '0';
- return(i);
-}
-
-/* Case insensitive prefix. */
-
-bool
-ciprefix(p, s)
- register char *p, *s;
-{
- while (*p) {
- if ((isupper(*p) ? tolower(*p) : *p) !=
- (isupper(*s) ? tolower(*s) : *s))
- return(false);
- p++;
- s++;
- }
- return (true);
-}
-
-/* Case insensitive strcmp... */
-
-bool
-cieq(p, s)
- register char *p, *s;
-{
- while (*p) {
- if ((isupper(*p) ? tolower(*p) : *p) !=
- (isupper(*s) ? tolower(*s) : *s))
- return(false);
- p++;
- s++;
- }
- return (!*s);
-}
-
-#ifdef BSD
-
-/* Return the date. Return value is static data. */
-
-char *
-datestring()
-{
- register char *tzn;
- struct tm *tp;
- static char tbuf[40];
- char *ap;
- struct timeval tv;
- struct timezone tz;
- char *timezone(), *asctime();
- int i;
- struct tm *localtime();
-
- (void) gettimeofday(&tv, &tz);
- tp = localtime((time_t *) &tv.tv_sec);
- ap = asctime(tp);
- tzn = timezone(tz.tz_minuteswest, tp->tm_isdst);
- sprintf(tbuf, "%.20s", ap);
- if (tzn)
- strcat(tbuf, tzn);
- strcat(tbuf, ap + 19);
- i = strlen(tbuf);
- tbuf[i - 1] = '\0';
- return (tbuf);
-}
-
-#else BSD
-
-/* Give it a try... */
-
-char *
-datestring()
-{
- long i;
- static char buf[64];
-
- i = time(0);
- strcpy(buf, ctime(&i));
- buf[strlen(buf) - 1] = '\0'; /* Kill the nl. */
- return (buf);
-}
-
-#endif
-
-/* How many seconds have elapsed in running time. */
-
-int
-seconds()
-{
-#ifdef BSD
- struct rusage ruse;
-
- getrusage(RUSAGE_SELF, &ruse);
- return (ruse.ru_utime.tv_sec);
-#else BSD
-#endif BSD
-}
-
-/* A few things that may not exist on non-unix systems. */
-
-#ifndef BSD
-
-#ifndef index
-
-char *
-index(s, c)
- register char *s;
- register char c;
-{
- while ((*s != c) && (*s != '\0'))
- s++;
- if (*s == '\0')
- return ((char *) 0);
- else
- return (s);
-}
-
-#endif not index
-
-#ifndef rindex
-
-char *
-rindex(s, c)
- register char *s;
- register char c;
-{
- register char *t;
-
- for (t = s; *t != '\0'; t++);
- while ((*t != c) && (t != s))
- t--;
- if (t == s)
- return ((char *) 0);
- else
- return (t);
-}
-
-#endif not rindex
-
-#ifndef bcopy
-
-void
-bcopy(from, to, num)
- register char *from, *to;
- register int num;
-{
- while (num-- > 0)
- *to++ = *from++;
- return;
-}
-
-#endif not bcopy
-
-#ifndef bzero
-
-void
-bzero(ptr, num)
- register char *ptr;
- register int num;
-{
- while (num-- > 0)
- *ptr++ = '\0';
- return;
-}
-
-#endif not bzero
-
-/* This might not be around... If not then forget about sorting... */
-
-void qsort() {}
-
-#endif BSD
-
-char *
-gettok(s)
- char **s;
-{
- char buf[BSIZE];
- int i = 0;
-
- while (isspace(**s))
- (*s)++;
- if (!**s)
- return (NULL);
- while (**s && !isspace(**s))
- buf[i++] = *(*s)++;
- buf[i] = '\0';
- while (isspace(**s))
- (*s)++;
- return (copy(buf));
-}
-
-/* Die horribly. */
-
-/* VARARGS1 */
-void
-fatal(s, args)
- char *s;
-{
- fputs("Internal Error: ", stderr);
-#ifndef __FreeBSD__
- _doprnt(s, &args, stderr);
-#endif
- putc('\n', stderr);
-
- kill(getpid(), SIGIOT);
- /* NOTREACHED */
-}
-
-void
-setenv(name, value)
- char *name, *value;
-{
- int i;
- char **xx, *s;
-
- s = tmalloc(strlen(name) + 2);
- sprintf(s, "%s=", name);
-
- /* Copy the old environment... */
- for (i = 0; environ[i]; i++)
- if (prefix(s, environ[i]))
- break;
- if (!environ[i]) {
- xx = (char **) tmalloc((i + 2) * sizeof (char *));
- for (i = 0; environ[i]; i++)
- xx[i] = environ[i];
- xx[i + 1] = NULL;
- environ = xx;
- } else
- xx = environ;
-
- xx[i] = tmalloc(strlen(name) + strlen(value) + 2);
- sprintf(xx[i], "%s=%s", name, value);
- return;
-}
-
-char *
-getusername()
-{
- int i = getuid();
- struct passwd *pw = getpwuid(i);
-
- return (pw ? pw->pw_name : NULL);
-}
-
-char *
-gethome()
-{
- int i = getuid();
- struct passwd *pw = getpwuid(i);
-
- return (pw ? pw->pw_dir : "/strange");
-}
-
-char *
-tildexpand(s)
- char *s;
-{
- struct passwd *pw;
- char *n, buf[64];
- int i;
-
- if (*s != '~')
- return (copy(s));
-
- for (s++, i = 0; *s != '/'; s++, i++)
- buf[i] = *s;
- buf[i] = '\0';
- if (!i)
- pw = getpwuid(getuid());
- else
- pw = getpwnam(buf);
- if (!pw)
- return (s);
- n = tmalloc(strlen(s) + strlen(pw->pw_dir) + 1);
- strcpy(n, pw->pw_dir);
- strcat(n, s);
- return (n);
-}
-
diff --git a/gnu/games/chess/Xchess/std.h b/gnu/games/chess/Xchess/std.h
deleted file mode 100644
index 19cb1da..0000000
--- a/gnu/games/chess/Xchess/std.h
+++ /dev/null
@@ -1,105 +0,0 @@
-
-/* This file contains code for X-CHESS.
- Copyright (C) 1986 Free Software Foundation, Inc.
-
-This file is part of X-CHESS.
-
-X-CHESS is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the X-CHESS General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-X-CHESS, but only under the conditions described in the
-X-CHESS General Public License. A copy of this license is
-supposed to have been given to you along with X-CHESS so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:06 $
- * $Source: /home/ncvs/src/gnu/games/chess/Xchess/std.h,v $
- * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
- *
- * Standard definitions.
- */
-
-#define UNIX
-#define BSD
-
-#ifndef FILE
-#include <stdio.h>
-#endif
-#ifndef isalpha
-#include <ctype.h>
-#endif
-#ifndef HUGE
-#include <math.h>
-#endif
-#include <strings.h>
-
-typedef int bool;
-
-#define false 0
-#define true 1
-
-/* Externs defined in std.c */
-
-extern char *tmalloc();
-extern char *trealloc();
-extern char *copy();
-extern char *datestring();
-extern char *getusername();
-extern char *gethome();
-extern char *gettok();
-extern char *tildexpand();
-extern void fatal();
-extern void setenv();
-extern void appendc();
-extern int scannum();
-extern int seconds();
-extern bool prefix();
-extern bool ciprefix();
-extern bool cieq();
-extern bool substring();
-
-/* Externs from libc */
-
-extern char *getenv();
-extern int errno;
-/* extern char *sys_errlist[]; */
-
-/* Should use BSIZE instead of BUFSIZ... */
-
-#define BSIZE 512
-
-/* Some standard macros. */
-
-#define eq(a,b) (!strcmp((a), (b)))
-#define isalphanum(c) (isalpha(c) || isdigit(c))
-#define alloc(strname) ((struct strname *) tmalloc(sizeof(struct strname)))
-#define tfree(ptr) { if (ptr) free((char *) ptr); ptr = 0; }
-#define hexnum(c) ((((c) >= '0') && ((c) <= '9')) ? ((c) - '0') : ((((c) >= \
- 'a') && ((c) <= 'f')) ? ((c) - 'a' + 10) : ((((c) >= 'A') && \
- ((c) <= 'F')) ? ((c) - 'A' + 10) : 0)))
-
-#ifndef BSD
-#define random rand
-#define srandom srand
-#endif BSD
-
-#ifdef VMS
-
-#define EXIT_NORMAL 1
-#define EXIT_BAD 0
-
-#else VMS
-
-#define EXIT_NORMAL 0
-#define EXIT_BAD 1
-
-#endif VMS
-
diff --git a/gnu/games/chess/Xchess/valid.c b/gnu/games/chess/Xchess/valid.c
deleted file mode 100644
index 06d1f29..0000000
--- a/gnu/games/chess/Xchess/valid.c
+++ /dev/null
@@ -1,264 +0,0 @@
-
-/* This file contains code for X-CHESS.
- Copyright (C) 1986 Free Software Foundation, Inc.
-
-This file is part of X-CHESS.
-
-X-CHESS is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the X-CHESS General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-X-CHESS, but only under the conditions described in the
-X-CHESS General Public License. A copy of this license is
-supposed to have been given to you along with X-CHESS so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:08 $
- * $Source: /home/ncvs/src/gnu/games/chess/Xchess/valid.c,v $
- * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
- * Permission is granted to do anything with this code except sell it
- * or remove this message.
- *
- * Validate a move.
- */
-
-#include "xchess.h"
-
-extern bool ischeck(), couldmove();
-
-bool
-valid_move(m, b)
- move *m;
- board *b;
-{
- board tb;
-
- /* First check that the piece can make the move at all... */
- if (!couldmove(m, b))
- return (false);
-
- /* Now see if the king is in check now. */
- bcopy((char *) b, (char *) &tb, sizeof (board));
- board_move(&tb, m);
- if (ischeck(&tb, m->piece.color))
- return (false);
-
- if (ischeck(&tb, ((m->piece.color == WHITE) ? BLACK : WHITE)))
- m->check = true;
-
- return (true);
-}
-
-static bool
-couldmove(m, b)
- move *m;
- board *b;
-{
- int x, y;
-
- switch (m->type) {
- case KCASTLE:
- if ((m->piece.color == WHITE) && (b->white_cant_castle_k) ||
- (m->piece.color == BLACK) &&
- (b->black_cant_castle_k))
- return (false);
- if ((b->square[m->fromy][5].color != NONE) ||
- (b->square[m->fromy][6].color != NONE))
- return (false);
- if (ischeck(b, m->piece.color))
- return (false);
- break;
-
- case QCASTLE:
- if ((m->piece.color == WHITE) && (b->white_cant_castle_q) ||
- (m->piece.color == BLACK) &&
- (b->black_cant_castle_q))
- return (false);
- if ((b->square[m->fromy][1].color != NONE) ||
- (b->square[m->fromy][2].color != NONE) ||
- (b->square[m->fromy][3].color != NONE))
- return (false);
- if (ischeck(b, m->piece.color))
- return (false);
- break;
-
- case MOVE:
- case CAPTURE:
- /* There is one special case here, that of taking a pawn
- * en passant. In this case we change the move field to
- * CAPTURE if it's ok.
- */
- switch (m->piece.type) {
- case PAWN:
- if ((m->type == MOVE) && (m->fromx == m->tox)) {
- /* A normal move. */
- if ((m->piece.color == WHITE) && (m->fromy ==
- m->toy + 1))
- break;
- if ((m->piece.color == WHITE) && (m->fromy ==
- 6) && (m->toy == 4) &&
- (b->square[5][m->fromx].color
- == NONE))
- break;
- if ((m->piece.color == BLACK) && (m->fromy ==
- m->toy - 1))
- break;
- if ((m->piece.color == BLACK) && (m->fromy ==
- 1) && (m->toy == 3) &&
- (b->square[2][m->fromx].color
- == NONE))
- break;
- return (false);
- } else if (m->type == CAPTURE) {
- if ((((m->piece.color == WHITE) && (m->fromy ==
- m->toy + 1)) || ((m->piece.color ==
- BLACK) && (m->fromy == m->toy -
- 1))) && ((m->fromx == m->tox + 1) ||
- (m->fromx == m->tox - 1)))
- break;
- /* Now maybe it's enpassant... We've already
- * checked for some of these things in the
- * calling routine.
- */
- if (m->enpassant) {
- if (b->square[(m->piece.color == WHITE)
- ? 3 : 4][m->tox].color ==
- ((m->piece.color == WHITE) ?
- BLACK : WHITE))
- break;
- }
- return (false);
- }
- return (false);
-
- case ROOK:
- if (m->fromx == m->tox) {
- for (y = m->fromy + ((m->fromy > m->toy) ? -1 :
- 1); y != m->toy; y += ((m->fromy
- > m->toy) ? -1 : 1))
- if (b->square[y][m->tox].color != NONE)
- return (false);
- break;
- }
- if (m->fromy == m->toy) {
- for (x = m->fromx + ((m->fromx > m->tox) ? -1 :
- 1); x != m->tox; x += ((m->fromx
- > m->tox) ? -1 : 1))
- if (b->square[m->toy][x].color != NONE)
- return (false);
- break;
- }
- return (false);
-
- case KNIGHT:
- x = m->fromx - m->tox;
- y = m->fromy - m->toy;
- if ((((x == 2) || (x == -2)) &&
- ((y == 1) || (y == -1))) ||
- (((x == 1) || (x == -1)) &&
- ((y == 2) || (y == -2))))
- break;
- return (false);
-
- case BISHOP:
- x = m->fromx - m->tox;
- y = m->fromy - m->toy;
- if ((x != y) && (x != - y))
- return (false);
- for (x = m->fromx + ((m->fromx > m->tox) ? -1 : 1), y =
- m->fromy + ((m->fromy > m->toy) ? -1 :
- 1); x != m->tox;
- x += ((m->fromx > m->tox) ? -1 : 1),
- y += ((m->fromy > m->toy) ? -1 : 1))
- if (b->square[y][x].color != NONE)
- return (false);
- break;
-
- case QUEEN:
- if (m->fromx == m->tox) {
- for (y = m->fromy + ((m->fromy > m->toy) ? -1 :
- 1); y != m->toy; y += ((m->fromy
- > m->toy) ? -1 : 1))
- if (b->square[y][m->tox].color != NONE)
- return (false);
- break;
- }
- if (m->fromy == m->toy) {
- for (x = m->fromx + ((m->fromx > m->tox) ? -1 :
- 1); x != m->tox; x += ((m->fromx
- > m->tox) ? -1 : 1))
- if (b->square[m->toy][x].color != NONE)
- return (false);
- break;
- }
- x = m->fromx - m->tox;
- y = m->fromy - m->toy;
- if ((x != y) && (x != - y))
- return (false);
- for (x = m->fromx + ((m->fromx > m->tox) ? -1 : 1), y =
- m->fromy + ((m->fromy > m->toy) ? -1 :
- 1); x != m->tox;
- x += ((m->fromx > m->tox) ? -1 : 1),
- y += ((m->fromy > m->toy) ? -1 : 1))
- if (b->square[y][x].color != NONE)
- return (false);
- break;
-
- case KING:
- x = m->fromx - m->tox;
- y = m->fromy - m->toy;
- if ((x >= -1) && (x <= 1) && (y >= -1) && (y <= 1))
- break;
- return (false);
- }
- break;
- }
- return (true);
-}
-
-/* Say whether either king is in check... If move is non-NULL, say whether he
- * in in check after the move takes place. We do this in a rather stupid way.
- */
-
-static bool
-ischeck(b, col)
- board *b;
- color col;
-{
- int x, y, kx, ky;
- move ch;
-
- for (x = 0; x < SIZE; x++)
- for (y = 0; y < SIZE; y++)
- if ((b->square[y][x].color == col) &&
- (b->square[y][x].type == KING)) {
- kx = x;
- ky = y;
- }
-
- for (x = 0; x < SIZE; x++)
- for (y = 0; y < SIZE; y++)
- if (b->square[y][x].color == ((col == WHITE) ?
- BLACK : WHITE)) {
- ch.type = CAPTURE;
- ch.piece.color = b->square[y][x].color;
- ch.piece.type = b->square[y][x].type;
- ch.fromx = x;
- ch.fromy = y;
- ch.tox = kx;
- ch.toy = ky;
- ch.enpassant = false;
- if (couldmove(&ch, b))
- return (true);
- }
-
- return (false);
-}
-
diff --git a/gnu/games/chess/Xchess/window.c b/gnu/games/chess/Xchess/window.c
deleted file mode 100644
index c33ef81..0000000
--- a/gnu/games/chess/Xchess/window.c
+++ /dev/null
@@ -1,952 +0,0 @@
-/* This file contains code for X-CHESS.
- Copyright (C) 1986 Free Software Foundation, Inc.
-
-This file is part of X-CHESS.
-
-X-CHESS is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the X-CHESS General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-X-CHESS, but only under the conditions described in the
-X-CHESS General Public License. A copy of this license is
-supposed to have been given to you along with X-CHESS so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:08 $
- * $Source: /home/ncvs/src/gnu/games/chess/Xchess/window.c,v $
- * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
- * Permission is granted to do anything with this code except sell it
- * or remove this message.
- *
- * Deal with the two (or one) windows.
- */
-
-#include "xchess.h"
-#include <X11/Xutil.h>
-#include <sys/time.h>
-
-#include "pawn.bitmap"
-#include "rook.bitmap"
-#include "knight.bitmap"
-#include "bishop.bitmap"
-#include "queen.bitmap"
-#include "king.bitmap"
-
-#include "pawn_outline.bitmap"
-#include "rook_outline.bitmap"
-#include "knight_outline.bitmap"
-#include "bishop_outline.bitmap"
-#include "queen_outline.bitmap"
-#include "king_outline.bitmap"
-
-#include "pawn_mask.bitmap"
-#include "rook_mask.bitmap"
-#include "knight_mask.bitmap"
-#include "bishop_mask.bitmap"
-#include "queen_mask.bitmap"
-#include "king_mask.bitmap"
-
-#include "shade.bitmap"
-
-#include "xchess.cur"
-#include "xchess_mask.cur"
-
-#include "xchess.icon"
-
-windata *win1, *win2;
-bool win_flashmove = false;
-
-extern bool setup();
-extern void service(), drawgrid(), icon_refresh();
-
-bool
-win_setup(disp1, disp2)
- char *disp1, *disp2;
-{
- win1 = alloc(windata);
- if (!oneboard)
- win2 = alloc(windata);
-
- if (!setup(disp1, win1) || (!oneboard && !setup(disp2, win2)))
- return (false);
-
- if (blackflag) {
- win1->color = BLACK;
- win1->flipped = true;
- } else
- win1->color = WHITE;
- win_drawboard(win1);
-
- if (!oneboard) {
- win2->color = BLACK;
- win2->flipped = true;
- win_drawboard(win2);
- }
-
- return(true);
-}
-
-/* Draw the chess board... */
-
-void
-win_drawboard(win)
- windata *win;
-{
- int i, j;
-
- drawgrid(win);
-
- /* Now toss on the squares... */
- for (i = 0; i < SIZE; i++)
- for (j = 0; j < SIZE; j++)
- win_erasepiece(j, i, win->color);
-
- return;
-}
-
-/* Draw one piece. */
-
-void
-win_drawpiece(p, y, x, wnum)
- piece *p;
- int y, x;
- color wnum;
-{
- char *bits, *maskbits, *outline;
- windata *win;
- char buf[BSIZE];
- XImage *tmpImage;
- Pixmap tmpPM, maskPM;
- XGCValues gc;
-
- if (oneboard || (wnum == win1->color))
- win = win1;
- else
- win = win2;
-
- if (win->flipped) {
- y = SIZE - y - 1;
- x = SIZE - x - 1;
- }
-
- /*
- if (debug)
- fprintf(stderr, "draw a %s at (%d, %d) on board %d\n",
- piecenames[(int) p->type], y, x, wnum);
- */
-
- if ((x < 0) || (x > 7) || (y < 0) || (y > 7)) exit(1);
-
- switch (p->type) {
- case PAWN:
- bits = pawn_bits;
- maskbits = pawn_mask_bits;
- outline = pawn_outline_bits;
- break;
-
- case ROOK:
- bits = rook_bits;
- maskbits = rook_mask_bits;
- outline = rook_outline_bits;
- break;
-
- case KNIGHT:
- bits = knight_bits;
- maskbits = knight_mask_bits;
- outline = knight_outline_bits;
- break;
-
- case BISHOP:
- bits = bishop_bits;
- maskbits = bishop_mask_bits;
- outline = bishop_outline_bits;
- break;
-
- case QUEEN:
- bits = queen_bits;
- maskbits = queen_mask_bits;
- outline = queen_outline_bits;
- break;
-
- case KING:
- bits = king_bits;
- maskbits = king_mask_bits;
- outline = king_outline_bits;
- break;
-
- default:
- fprintf(stderr,
- "Internal Error: win_drawpiece: bad piece type %d\n",
- p->type);
- }
-
- /* There are two things we can do... If this is a black and white
- * display, we have to shade the square and use an outline if the piece
- * is white. We also have to use a mask... Since we don't want
- * to use up too many bitmaps, create the mask bitmap, put the bits,
- * and then destroy it.
- */
- if (win->bnw && (p->color == WHITE))
- bits = outline;
- if (win->bnw && !iswhite(win, x, y)) {
- XSetState(win->display, DefaultGC(win->display, 0),
- BlackPixel(win->display, 0),
- WhitePixel(win->display, 0), GXcopy, AllPlanes);
-
- tmpPM = XCreateBitmapFromData(win->display, win->boardwin,
- shade_bits, SQUARE_WIDTH, SQUARE_HEIGHT);
-
- XCopyPlane(win->display, tmpPM, win->boardwin, DefaultGC(win->display, 0),
- 0, 0, SQUARE_WIDTH, SQUARE_HEIGHT,
- x * (SQUARE_WIDTH + BORDER_WIDTH),
- y * (SQUARE_HEIGHT + BORDER_WIDTH), 1);
-
- XFreePixmap(win->display, tmpPM);
-
- XSetFunction(win->display, DefaultGC(win->display, 0),
- GXandInverted);
- maskPM = XCreateBitmapFromData(win->display, win->boardwin,
- maskbits, SQUARE_WIDTH, SQUARE_HEIGHT);
- XCopyPlane(win->display, maskPM, win->boardwin, DefaultGC(win->display, 0),
- 0, 0, SQUARE_WIDTH, SQUARE_HEIGHT,
- x * (SQUARE_WIDTH + BORDER_WIDTH),
- y * (SQUARE_HEIGHT + BORDER_WIDTH), 1);
- XFreePixmap(win->display, maskPM);
-
- XSetFunction(win->display, DefaultGC(win->display, 0),
- GXor);
- tmpPM = XCreateBitmapFromData(win->display, win->boardwin,
- bits, SQUARE_WIDTH, SQUARE_HEIGHT);
- XCopyPlane(win->display, tmpPM, win->boardwin, DefaultGC(win->display, 0),
- 0, 0, SQUARE_WIDTH, SQUARE_HEIGHT,
- x * (SQUARE_WIDTH + BORDER_WIDTH),
- y * (SQUARE_HEIGHT + BORDER_WIDTH), 1);
- XFreePixmap(win->display, tmpPM);
-
- XSetFunction(win->display, DefaultGC(win->display, 0), GXcopy);
-
- } else if (win->bnw){
- XSetState(win->display, DefaultGC(win->display, 0),
- BlackPixel(win->display, 0),
- WhitePixel(win->display, 0), GXcopy, AllPlanes);
-
- tmpPM = XCreateBitmapFromData(win->display, win->boardwin,
- bits, SQUARE_WIDTH, SQUARE_HEIGHT);
- XCopyPlane(win->display, tmpPM, win->boardwin, DefaultGC(win->display, 0),
- 0, 0, SQUARE_WIDTH, SQUARE_HEIGHT,
- x * (SQUARE_WIDTH + BORDER_WIDTH),
- y * (SQUARE_HEIGHT + BORDER_WIDTH), 1);
- XFreePixmap(win->display, tmpPM);
- } else {
- XSetState(win->display, DefaultGC(win->display, 0),
- ((p->color == WHITE) ? win->whitepiece.pixel :
- win->blackpiece.pixel),
- (iswhite(win, x, y) ? win->whitesquare.pixel :
- win->blacksquare.pixel),
- GXcopy, AllPlanes);
- tmpPM = XCreateBitmapFromData(win->display, win->boardwin,
- bits, SQUARE_WIDTH, SQUARE_HEIGHT);
- XCopyPlane(win->display, tmpPM, win->boardwin, DefaultGC(win->display, 0),
- 0, 0, SQUARE_WIDTH, SQUARE_HEIGHT,
- x * (SQUARE_WIDTH + BORDER_WIDTH),
- y * (SQUARE_HEIGHT + BORDER_WIDTH), 1);
- XFreePixmap(win->display, tmpPM);
- }
-
- if (!record_english) {
- gc.foreground = win->textcolor.pixel;
- if (iswhite(win, x, y) || win->bnw)
- gc.background = win->whitesquare.pixel;
- else
- gc.background = win->blacksquare.pixel;
-
- gc.font = win->small->fid;
-
- XChangeGC(win->display, DefaultGC(win->display, 0),
- GCForeground | GCBackground | GCFont, &gc);
-
- if (!x) {
- sprintf(buf, " %d", SIZE - y);
- XDrawImageString(win->display, win->boardwin,
- DefaultGC(win->display, 0),
- 1, (y + 1) * (SQUARE_HEIGHT +
- BORDER_WIDTH) - BORDER_WIDTH +
- win->small->max_bounds.ascent - 1, buf, 2);
- }
- if (y == SIZE - 1) {
- sprintf(buf, "%c", 'A' + x);
- XDrawImageString(win->display, win->boardwin,
- DefaultGC(win->display, 0),
- x * (SQUARE_WIDTH + BORDER_WIDTH) + 1,
- SIZE * (SQUARE_HEIGHT + BORDER_WIDTH) - BORDER_WIDTH +
- win->small->max_bounds.ascent - 1, buf, 1);
- }
- }
- return;
-}
-
-void
-win_erasepiece(y, x, wnum)
- int y, x;
- color wnum;
-{
- windata *win;
- char buf[BSIZE];
- XGCValues gc;
- Pixmap tmpPM;
-
- if (oneboard || (wnum == win1->color))
- win = win1;
- else
- win = win2;
-
- if (win->flipped) {
- y = SIZE - y - 1;
- x = SIZE - x - 1;
- }
-
- /*
- if (debug)
- fprintf(stderr, "erase square (%d, %d) on board %d\n", y, x,
- wnum);
- */
-
- if ((x < 0) || (x > 7) || (y < 0) || (y > 7)) exit(1);
-
- if (win->bnw && !iswhite(win, x, y)) {
- XSetState(win->display, DefaultGC(win->display, 0),
- BlackPixel(win->display, 0),
- WhitePixel(win->display, 0), GXcopy, AllPlanes);
- tmpPM = XCreateBitmapFromData(win->display, win->boardwin,
- shade_bits, SQUARE_WIDTH, SQUARE_HEIGHT);
-
- XCopyPlane(win->display, tmpPM, win->boardwin, DefaultGC(win->display, 0),
- 0, 0, SQUARE_WIDTH, SQUARE_HEIGHT,
- x * (SQUARE_WIDTH + BORDER_WIDTH),
- y * (SQUARE_HEIGHT + BORDER_WIDTH), 1);
-
- XFreePixmap(win->display, tmpPM);
- } else {
- XSetFillStyle(win->display, DefaultGC(win->display, 0),
- FillSolid);
- XSetForeground(win->display, DefaultGC(win->display, 0),
- iswhite(win, x, y) ? win->whitesquare.pixel :
- win->blacksquare.pixel);
- XFillRectangle(win->display, win->boardwin,
- DefaultGC(win->display, 0),
- x * (SQUARE_WIDTH + BORDER_WIDTH),
- y * (SQUARE_HEIGHT + BORDER_WIDTH),
- SQUARE_WIDTH, SQUARE_HEIGHT);
- }
-
- if (!record_english) {
- gc.foreground = win->textcolor.pixel;
- if (iswhite(win, x, y) || win->bnw)
- gc.background = win->whitesquare.pixel;
- else
- gc.background = win->blacksquare.pixel;
-
- gc.font = win->small->fid;
-
- XChangeGC(win->display, DefaultGC(win->display, 0),
- GCForeground | GCBackground | GCFont, &gc);
-
- if (!x) {
- sprintf(buf, " %d", SIZE - y);
- XDrawImageString(win->display, win->boardwin,
- DefaultGC(win->display, 0),
- 1, (y + 1) * (SQUARE_HEIGHT +
- BORDER_WIDTH) - BORDER_WIDTH +
- win->small->max_bounds.ascent - 1, buf, 2);
- }
- if (y == SIZE - 1) {
- sprintf(buf, "%c", 'A' + x);
- XDrawImageString(win->display, win->boardwin,
- DefaultGC(win->display, 0),
- x * (SQUARE_WIDTH + BORDER_WIDTH) + 1,
- SIZE * (SQUARE_HEIGHT + BORDER_WIDTH) - BORDER_WIDTH +
- win->small->max_bounds.ascent - 1, buf, 1);
- }
- }
-
-
- return;
-}
-
-void
-win_flash(m, wnum)
- move *m;
- color wnum;
-{
- windata *win;
- int sx, sy, ex, ey, i;
-
- if (oneboard || (wnum == win1->color))
- win = win1;
- else
- win = win2;
-
- if (win->flipped) {
- sx = SIZE - m->fromx - 1;
- sy = SIZE - m->fromy - 1;
- ex = SIZE - m->tox - 1;
- ey = SIZE - m->toy - 1;
- } else {
- sx = m->fromx;
- sy = m->fromy;
- ex = m->tox;
- ey = m->toy;
- }
- sx = sx * (SQUARE_WIDTH + BORDER_WIDTH) + SQUARE_WIDTH / 2;
- sy = sy * (SQUARE_HEIGHT + BORDER_WIDTH) + SQUARE_HEIGHT / 2;
- ex = ex * (SQUARE_WIDTH + BORDER_WIDTH) + SQUARE_WIDTH / 2;
- ey = ey * (SQUARE_HEIGHT + BORDER_WIDTH) + SQUARE_HEIGHT / 2;
-
- XSetFunction(win->display, DefaultGC(win->display, 0), GXinvert);
- XSetLineAttributes(win->display, DefaultGC(win->display, 0),
- 0, LineSolid, 0, 0);
- for (i = 0; i < num_flashes * 2; i++) {
- XDrawLine(win->display,win->boardwin,
- DefaultGC(win->display, 0),
- sx, sy, ex, ey);
- }
-
- XSetFunction(win->display, DefaultGC(win->display, 0), GXcopy);
- return;
-}
-
-/* Handle input from the players. */
-
-void
-win_process(quick)
- bool quick;
-{
- int i, rfd = 0, wfd = 0, xfd = 0;
- struct timeval timeout;
-
- timeout.tv_sec = 0;
- timeout.tv_usec = (quick ? 0 : 500000);
-
- if (XPending(win1->display))
- service(win1);
- if (!oneboard) {
- if (XPending(win1->display))
- service(win2);
- }
-
- if (oneboard)
- rfd = 1 << win1->display->fd;
- else
- rfd = (1 << win1->display->fd) | (1 << win2->display->fd);
- if (!(i = select(32, &rfd, &wfd, &xfd, &timeout)))
- return;
- if (i == -1) {
- perror("select");
- exit(1);
- }
- if (rfd & (1 << win1->display->fd))
- service(win1);
- if (!oneboard && (rfd & (1 << win2->display->fd)))
- service(win2);
-
- return;
-}
-
-static void
-service(win)
- windata *win;
-{
- XEvent ev;
-
- while(XPending(win->display)) {
- XNextEvent(win->display, &ev);
- if (TxtFilter(win->display, &ev))
- continue;
-
- if (ev.xany.window == win->boardwin) {
- switch (ev.type) {
- case ButtonPress:
- button_pressed(&ev, win);
- break;
-
- case ButtonRelease:
- button_released(&ev, win);
- break;
-
- case Expose:
- /* Redraw... */
- win_redraw(win, &ev);
- break;
-
- case 0:
- case NoExpose:
- break;
- default:
- fprintf(stderr, "Bad event type %d\n", ev.type);
- exit(1);
- }
- } else if (ev.xany.window == win->wclockwin) {
- switch (ev.type) {
- case Expose:
- clock_draw(win, WHITE);
- break;
-
- case 0:
- case NoExpose:
- break;
- default:
- fprintf(stderr, "Bad event type %d\n", ev.type);
- exit(1);
- }
- } else if (ev.xany.window == win->bclockwin) {
- switch (ev.type) {
- case Expose:
- clock_draw(win, BLACK);
- break;
-
- case 0:
- case NoExpose:
- break;
- default:
- fprintf(stderr, "Bad event type %d\n", ev.type);
- exit(1);
- }
- } else if (ev.xany.window == win->jailwin) {
- switch (ev.type) {
- case Expose:
- jail_draw(win);
- break;
-
- case 0:
- case NoExpose:
- break;
- default:
- fprintf(stderr, "Bad event type %d\n", ev.type);
- exit(1);
- }
- } else if (ev.xany.window == win->buttonwin) {
- switch (ev.type) {
- case ButtonPress:
- button_service(win, &ev);
- break;
-
- case Expose:
- button_draw(win);
- break;
-
- case 0:
- case NoExpose:
- break;
- default:
- fprintf(stderr, "Bad event type %d\n", ev.type);
- exit(1);
- }
- } else if (ev.xany.window == win->icon) {
- icon_refresh(win);
- } else if (ev.xany.window == win->basewin) {
- message_send(win, &ev);
- } else {
- fprintf(stderr, "Internal Error: service: bad win\n");
- fprintf(stderr, "window = %d, event = %d\n", ev.xany.window,
- ev.type);
- }
- }
- return;
-}
-
-void
-win_redraw(win, event)
- windata *win;
- XEvent *event;
-{
- XExposeEvent *ev = &event->xexpose;
- int x1, y1, x2, y2, i, j;
-
- drawgrid(win);
- if (ev) {
- x1 = ev->x / (SQUARE_WIDTH + BORDER_WIDTH);
- y1 = ev->y / (SQUARE_HEIGHT + BORDER_WIDTH);
- x2 = (ev->x + ev->width) / (SQUARE_WIDTH + BORDER_WIDTH);
- y2 = (ev->y + ev->height) / (SQUARE_HEIGHT + BORDER_WIDTH);
- } else {
- x1 = 0;
- y1 = 0;
- x2 = SIZE - 1;
- y2 = SIZE - 1;
- }
-
- if (x1 < 0) x1 = 0;
- if (y1 < 0) y1 = 0;
- if (x2 < 0) x2 = 0;
- if (y2 < 0) y2 = 0;
- if (x1 > SIZE - 1) x1 = SIZE - 1;
- if (y1 > SIZE - 1) y1 = SIZE - 1;
- if (x2 > SIZE - 1) x2 = SIZE - 1;
- if (y2 > SIZE - 1) y2 = SIZE - 1;
-
- if (win->flipped) {
- y1 = SIZE - y2 - 1;
- y2 = SIZE - y1 - 1;
- x1 = SIZE - x2 - 1;
- x2 = SIZE - x1 - 1;
- }
-
- for (i = x1; i <= x2; i++)
- for (j = y1; j <= y2; j++) {
- if (chessboard->square[j][i].color == NONE)
- win_erasepiece(j, i, WHITE);
- else
- win_drawpiece(&chessboard->square[j][i], j, i,
- WHITE);
- if (!oneboard) {
- if (chessboard->square[j][i].color == NONE)
- win_erasepiece(j, i, BLACK);
- else
- win_drawpiece(&chessboard->square[j][i],
- j, i, BLACK);
- }
- }
-
- return;
-}
-
-static bool
-setup(dispname, win)
- char *dispname;
- windata *win;
-{
- char buf[BSIZE], *s;
- Pixmap bm, bmask;
- Cursor cur;
- extern char *program, *recfile;
- XSizeHints xsizes;
-
-
- if (!(win->display = XOpenDisplay(dispname)))
- return (false);
-
-
- /* Now get boolean defaults... */
- if ((s = XGetDefault(win->display, program, "noisy")) && eq(s, "on"))
- noisyflag = true;
- if ((s = XGetDefault(win->display, program, "savemoves")) && eq(s, "on"))
- saveflag = true;
- if ((s = XGetDefault(win->display, program, "algebraic")) && eq(s, "on"))
- record_english = false;
- if ((s = XGetDefault(win->display, program, "blackandwhite")) && eq(s, "on"))
- bnwflag = true;
- if ((s = XGetDefault(win->display, program, "quickrestore")) && eq(s, "on"))
- quickflag = true;
- if ((s = XGetDefault(win->display, program, "flash")) && eq(s, "on"))
- win_flashmove = true;
-
- /* ... numeric variables ... */
- if (s = XGetDefault(win->display, program, "numflashes"))
- num_flashes = atoi(s);
- if (s = XGetDefault(win->display, program, "flashsize"))
- flash_size = atoi(s);
-
- /* ... and strings. */
- if (s = XGetDefault(win->display, program, "progname"))
- progname = s;
- if (s = XGetDefault(win->display, program, "proghost"))
- proghost = s;
- if (s = XGetDefault(win->display, program, "recordfile"))
- recfile = s;
- if (s = XGetDefault(win->display, program, "blackpiece"))
- black_piece_color = s;
- if (s = XGetDefault(win->display, program, "whitepiece"))
- white_piece_color = s;
- if (s = XGetDefault(win->display, program, "blacksquare"))
- black_square_color = s;
- if (s = XGetDefault(win->display, program, "whitesquare"))
- white_square_color = s;
- if (s = XGetDefault(win->display, program, "bordercolor"))
- border_color = s;
- if (s = XGetDefault(win->display, program, "textcolor"))
- text_color = s;
- if (s = XGetDefault(win->display, program, "textback"))
- text_back = s;
- if (s = XGetDefault(win->display, program, "errortext"))
- error_text = s;
- if (s = XGetDefault(win->display, program, "playertext"))
- player_text = s;
- if (s = XGetDefault(win->display, program, "cursorcolor"))
- cursor_color = s;
-
- if ((DisplayPlanes(win->display, 0) == 1) || bnwflag)
- win->bnw = true;
-
- /* Allocate colors... */
- if (win->bnw) {
- win->blackpiece.pixel = BlackPixel (win->display, 0);
- win->whitepiece.pixel = WhitePixel (win->display, 0);
- win->blacksquare.pixel = BlackPixel (win->display, 0);
- win->whitesquare.pixel = WhitePixel (win->display, 0);
- win->border.pixel = BlackPixel (win->display, 0);
- win->textcolor.pixel = BlackPixel (win->display, 0);
- win->textback.pixel = WhitePixel (win->display, 0);
- win->playertext.pixel = BlackPixel (win->display, 0);
- win->errortext.pixel = BlackPixel (win->display, 0);
- win->cursorcolor.pixel = BlackPixel (win->display, 0) ;
- } else {
- if (!XParseColor(win->display,
- DefaultColormap(win->display, 0),
- black_piece_color, &win->blackpiece) ||
- !XParseColor(win->display,
- DefaultColormap(win->display, 0),
- white_piece_color, &win->whitepiece) ||
- !XParseColor(win->display,
- DefaultColormap(win->display, 0),
- black_square_color, &win->blacksquare) ||
- !XParseColor(win->display,
- DefaultColormap(win->display, 0),
- white_square_color, &win->whitesquare) ||
- !XParseColor(win->display,
- DefaultColormap(win->display, 0),
- border_color, &win->border) ||
- !XParseColor(win->display,
- DefaultColormap(win->display, 0),
- text_color, &win->textcolor) ||
- !XParseColor(win->display,
- DefaultColormap(win->display, 0),
- text_back, &win->textback) ||
- !XParseColor(win->display,
- DefaultColormap(win->display, 0),
- error_text, &win->errortext) ||
- !XParseColor(win->display,
- DefaultColormap(win->display, 0),
- player_text, &win->playertext) ||
- !XParseColor(win->display,
- DefaultColormap(win->display, 0),
- cursor_color, &win->cursorcolor) ||
- !XAllocColor(win->display,
- DefaultColormap(win->display, 0),
- &win->blackpiece) ||
- !XAllocColor(win->display,
- DefaultColormap(win->display, 0),
- &win->whitepiece) ||
- !XAllocColor(win->display,
- DefaultColormap(win->display, 0),
- &win->blacksquare) ||
- !XAllocColor(win->display,
- DefaultColormap(win->display, 0),
- &win->whitesquare) ||
- !XAllocColor(win->display,
- DefaultColormap(win->display, 0),
- &win->border) ||
- !XAllocColor(win->display,
- DefaultColormap(win->display, 0),
- &win->textcolor) ||
- !XAllocColor(win->display,
- DefaultColormap(win->display, 0),
- &win->textback) ||
- !XAllocColor(win->display,
- DefaultColormap(win->display, 0),
- &win->errortext) ||
- !XAllocColor(win->display,
- DefaultColormap(win->display, 0),
- &win->playertext) ||
- !XAllocColor(win->display,
- DefaultColormap(win->display, 0),
- &win->cursorcolor))
- fprintf(stderr, "Can't get colors...\n");
- }
-
- /* Get fonts... */
- if ((win->small = XLoadQueryFont(win->display,SMALL_FONT)) ==
- NULL)
- fprintf(stderr, "Can't get small font...\n");
-
- if ((win->medium = XLoadQueryFont(win->display,MEDIUM_FONT))
- == NULL)
- fprintf(stderr, "Can't get medium font...\n");
-
- if ((win->large = XLoadQueryFont(win->display,LARGE_FONT)) ==
- NULL)
- fprintf(stderr, "Can't get large font...\n");
-
-
- /* Create the windows... */
-
- win->basewin =
- XCreateSimpleWindow(win->display,DefaultRootWindow(win->display),
- BASE_XPOS, BASE_YPOS,
- BASE_WIDTH, BASE_HEIGHT, 0,
- BlackPixel(win->display, 0),
- WhitePixel(win->display, 0));
- win->boardwin = XCreateSimpleWindow(win->display,win->basewin,
- BOARD_XPOS, BOARD_YPOS,
- BOARD_WIDTH, BOARD_HEIGHT,
- BORDER_WIDTH,
- win->border.pixel,
- WhitePixel(win->display, 0));
- win->recwin = XCreateSimpleWindow(win->display,win->basewin,
- RECORD_XPOS, RECORD_YPOS,
- RECORD_WIDTH, RECORD_HEIGHT,
- BORDER_WIDTH, win->border.pixel,
- win->textback.pixel);
- win->jailwin = XCreateSimpleWindow(win->display,win->basewin,
- JAIL_XPOS, JAIL_YPOS,
- JAIL_WIDTH, JAIL_HEIGHT,
- BORDER_WIDTH,
- win->border.pixel,
- win->textback.pixel);
- win->wclockwin = XCreateSimpleWindow(win->display,win->basewin,
- WCLOCK_XPOS, WCLOCK_YPOS,
- CLOCK_WIDTH, CLOCK_HEIGHT,
- BORDER_WIDTH, win->border.pixel,
- win->textback.pixel);
- win->bclockwin = XCreateSimpleWindow(win->display,win->basewin,
- BCLOCK_XPOS, BCLOCK_YPOS,
- CLOCK_WIDTH, CLOCK_HEIGHT,
- BORDER_WIDTH, win->border.pixel,
- win->textback.pixel);
- win->messagewin = XCreateSimpleWindow(win->display,win->basewin,
- MESS_XPOS, MESS_YPOS,
- MESS_WIDTH, MESS_HEIGHT,
- BORDER_WIDTH, win->border.pixel,
- win->textback.pixel);
- win->buttonwin = XCreateSimpleWindow(win->display,win->basewin,
- BUTTON_XPOS, BUTTON_YPOS,
- BUTTON_WIDTH, BUTTON_HEIGHT,
- BORDER_WIDTH, win->border.pixel,
- win->textback.pixel);
-
- /* Let's define an icon... */
- win->iconpixmap = XCreatePixmapFromBitmapData(win->display,
- win->basewin, icon_bits,
- icon_width, icon_height,
- win->blacksquare.pixel,
- win->whitesquare.pixel,
- 1);
- xsizes.flags = PSize | PMinSize | PPosition;
- xsizes.min_width = BASE_WIDTH;
- xsizes.min_height = BASE_HEIGHT;
- xsizes.x = BASE_XPOS;
- xsizes.y = BASE_YPOS;
- XSetStandardProperties(win->display, win->basewin,
- program, program, win->iconpixmap,
- 0, NULL, &xsizes);
-
- bm = XCreateBitmapFromData(win->display,
- win->basewin, xchess_bits,
- xchess_width, xchess_height);
- bmask = XCreateBitmapFromData(win->display,
- win->basewin, xchess_mask_bits,
- xchess_width, xchess_height);
- cur = XCreatePixmapCursor(win->display, bm, bmask,
- &win->cursorcolor,
- &WhitePixel(win->display, 0),
- xchess_x_hot, xchess_y_hot);
- XFreePixmap(win->display, bm);
- XFreePixmap(win->display, bmask);
-
- XDefineCursor(win->display,win->basewin, cur);
-
- XMapSubwindows(win->display,win->basewin);
- XMapRaised(win->display,win->basewin);
-
- XSelectInput(win->display,win->basewin, KeyPressMask);
- XSelectInput(win->display,win->boardwin,
- ButtonPressMask | ButtonReleaseMask | ExposureMask);
- XSelectInput(win->display,win->recwin,
- ButtonReleaseMask | ExposureMask);
- XSelectInput(win->display,win->jailwin, ExposureMask);
- XSelectInput(win->display,win->wclockwin, ExposureMask);
- XSelectInput(win->display,win->bclockwin, ExposureMask);
- XSelectInput(win->display,win->messagewin,
- ButtonReleaseMask | ExposureMask);
- XSelectInput(win->display,win->buttonwin,
- ButtonPressMask | ExposureMask);
-
- message_init(win);
- record_init(win);
- button_draw(win);
- jail_init(win);
- clock_init(win, WHITE);
- clock_init(win, BLACK);
- if (timeunit) {
- if (timeunit > 1800)
- sprintf(buf, "%d moves every %.2lg hours.\n",
- movesperunit, ((double) timeunit) / 3600);
- else if (timeunit > 30)
- sprintf(buf, "%d moves every %.2lg minutes.\n",
- movesperunit, ((double) timeunit) / 60);
- else
- sprintf(buf, "%d moves every %d seconds.\n",
- movesperunit, timeunit);
- message_add(win, buf, false);
- }
- return (true);
-}
-
-static void
-drawgrid(win)
- windata *win;
-{
- int i;
- XGCValues gc;
-
- gc.function = GXcopy;
- gc.plane_mask = AllPlanes;
- gc.foreground = win->border.pixel;
- gc.line_width = 0;
- gc.line_style = LineSolid;
-
- XChangeGC(win->display,
- DefaultGC(win->display, 0),
- GCFunction | GCPlaneMask | GCForeground |
- GCLineWidth | GCLineStyle, &gc);
-
- /* Draw the lines... horizontal, */
- for (i = 1; i < SIZE; i++)
- XDrawLine(win->display, win->boardwin,
- DefaultGC(win->display, 0), 0,
- i * (SQUARE_WIDTH + BORDER_WIDTH) -
- BORDER_WIDTH / 2,
- SIZE * (SQUARE_WIDTH + BORDER_WIDTH),
- i * (SQUARE_WIDTH + BORDER_WIDTH) -
- BORDER_WIDTH / 2);
-
- /* and vertical... */
- for (i = 1; i < SIZE; i++)
- XDrawLine(win->display, win->boardwin,
- DefaultGC(win->display, 0),
- i * (SQUARE_WIDTH + BORDER_WIDTH) -
- BORDER_WIDTH / 2, 0,
- i * (SQUARE_WIDTH + BORDER_WIDTH) -
- BORDER_WIDTH / 2,
- SIZE * (SQUARE_WIDTH + BORDER_WIDTH));
- return;
-}
-
-void
-win_restart()
-{
- win1->flipped = false;
- win_redraw(win1, (XEvent *) NULL);
- if (!oneboard) {
- win2->flipped = true;
- win_redraw(win2, (XEvent *) NULL);
- }
- return;
-}
-
-static void
-icon_refresh(win)
- windata *win;
-{
- XCopyArea(win->display, win->iconpixmap, win->icon,
- DefaultGC(win->display, 0),
- 0, 0, icon_width, icon_height, 0, 0);
- return;
-}
-
diff --git a/gnu/games/chess/Xchess/xchess.c b/gnu/games/chess/Xchess/xchess.c
deleted file mode 100644
index 74d010f..0000000
--- a/gnu/games/chess/Xchess/xchess.c
+++ /dev/null
@@ -1,205 +0,0 @@
-
-/* This file contains code for X-CHESS.
- Copyright (C) 1986 Free Software Foundation, Inc.
-
-This file is part of X-CHESS.
-
-X-CHESS is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the X-CHESS General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-X-CHESS, but only under the conditions described in the
-X-CHESS General Public License. A copy of this license is
-supposed to have been given to you along with X-CHESS so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:09 $
- * $Source: /home/ncvs/src/gnu/games/chess/Xchess/xchess.c,v $
- * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
- * Permission is granted to do anything with this code except sell it
- * or remove this message.
- */
-
-#define USAGE "xchess [ -d ] [ -f recordfile ] [ -r savedfile ] [ -i ]\n\
-\t[ -t moves/timeunit ] [ -c ] [ -p program ] [ -b ] [ -bnw ] [ -s ]\n\
-\t[ -n ] [ -h host ] [ -v ] [ -R ] [ whitedisplay ] [ blackdisplay ]"
-
-#include <signal.h>
-#include "xchess.h"
-
-bool debug = false;
-bool oneboard = false;
-bool bnwflag = false;
-bool progflag = false;
-bool blackflag = false;
-bool quickflag = false;
-
-char *progname = DEF_PROGRAM;
-char *proghost = NULL;
-char *piecenames[] = { "pawn", "rook", "knight", "bishop", "queen", "king" } ;
-char *colornames[] = { "white", "black", "none" } ;
-char *movetypenames[] = { "move", "qcastle", "kcastle", "capture" } ;
-char *dispname1 = NULL, *dispname2 = NULL;
-
-char *black_piece_color = BLACK_PIECE_COLOR;
-char *white_piece_color = WHITE_PIECE_COLOR;
-char *black_square_color = BLACK_SQUARE_COLOR;
-char *white_square_color = WHITE_SQUARE_COLOR;
-char *border_color = BORDER_COLOR;
-char *text_color = TEXT_COLOR;
-char *text_back = TEXT_BACK;
-char *error_text = ERROR_TEXT;
-char *player_text = PLAYER_TEXT;
-char *cursor_color = CURSOR_COLOR;
-
-int num_flashes = NUM_FLASHES;
-int flash_size = FLASH_SIZE;
-char *program;
-char *recfile = NULL;
-
-#ifdef notdef
-/*
- * Serves no purpose.
- */
-die () {
-fprintf(stderr, "child proc changed status?!\n");
-}
-#endif
-
-void
-main(ac, av)
- char **av;
-{
- bool randflag = false;
- move *m;
- char *s;
-
- program = av[0];
-
-#ifdef notdef
- signal(SIGCHLD, die);
-#endif
-
- /* Process args. */
- av++; ac--;
- while (ac > 0 && **av == '-') {
- if (eq(*av, "-d")) {
- debug = true;
- } else if (eq(*av, "-f")) {
- av++; ac--;
- if (*av)
- record_file = *av;
- else
- goto usage;
- } else if (eq(*av, "-r")) {
- av++; ac--;
- if (*av)
- recfile = *av;
- else
- goto usage;
- } else if (eq(*av, "-i")) {
- record_english = false;
- } else if (eq(*av, "-R")) {
- randflag = true;
- } else if (eq(*av, "-v")) {
- win_flashmove = true;
- } else if (eq(*av, "-q")) {
- quickflag = true;
- } else if (eq(*av, "-t")) {
- av++; ac--;
- if (*av) {
- movesperunit = atoi(*av);
- if (s = index(*av, '/'))
- timeunit = atoi(s + 1) * 60;
- else
- timeunit = 60;
- } else
- goto usage;
- } else if (eq(*av, "-p")) {
- av++; ac--;
- if (*av)
- progname = *av;
- else
- goto usage;
- } else if (eq(*av, "-h")) {
- av++; ac--;
- if (*av)
- proghost = *av;
- else
- goto usage;
- } else if (eq(*av, "-b")) {
- blackflag = true;
- } else if (eq(*av, "-c")) {
- progflag = true;
- } else if (eq(*av, "-bnw")) {
- bnwflag = true;
- } else if (eq(*av, "-s")) {
- saveflag = true;
- } else if (eq(*av, "-n")) {
- noisyflag = true;
- } else
- goto usage;
- av++; ac--;
- }
- if (ac > 0)
- dispname1 = av[0];
- if (ac > 1)
- dispname2 = av[1];
- if (ac > 2)
- goto usage;
-
- if (!dispname2)
- oneboard = true;
-
- srandom(getpid());
-
- if (!oneboard && randflag && (random() % 2)) {
- s = dispname1;
- dispname1 = dispname2;
- dispname2 = s;
- }
-
- if (!dispname1)
- dispname1 = getenv("DISPLAY");
-
- /* Set up the board. */
- board_setup();
-
- /* Create the windows. */
- win_setup(dispname1, dispname2);
-
- board_drawall();
-
- /* Start the program if necessary. */
- if (progflag)
- if (!program_init(progname))
- exit(1);
-
- if (recfile)
- load_game(recfile);
-
- /* Go into a loop of prompting players alternately for moves, checking
- * them, and updating things.
- */
- for (;;) {
- win_process(false);
- clock_update();
- if (progflag && ((!blackflag && (nexttomove == BLACK)) ||
- (blackflag && (nexttomove == WHITE)))) {
- m = program_get();
- if (m)
- prog_move(m);
- }
- }
-
-usage: fprintf(stderr, "Usage: %s\n", USAGE);
- exit(1);
-}
-
diff --git a/gnu/games/chess/chess.6 b/gnu/games/chess/chess.6
deleted file mode 100644
index bbf0aa4..0000000
--- a/gnu/games/chess/chess.6
+++ /dev/null
@@ -1,161 +0,0 @@
-.TH Chess GNU
-.SH NAME
-Chess \- GNU Chess
-.SH SYNOPSIS
-.B Chess
-[
-.B arg1 arg2
-]
-.SH DESCRIPTION
-.I Chess
-plays a game of chess against the user or it plays against itself.
-.PP
-.I Chess
-has a simple alpha-numeric board display or it can be compiled for
-use with the CHESSTOOL program on a SUN workstation.
-The program gets its opening moves from the file gnuchess.book which
-should be located in the same directory as gnuchess.
-To invoke the prgram, type 'gnuchess' or type 'chesstool gnuchess'
-on a SUN workstation where 'CHESSTOOL' is installed.
-The 'gnuchess' command can be followed by up to 2 command line arguments.
-If one argument is given it determines the programs search time in
-seconds. If two arguments are given, they will be used to set tournament
-time controls with the first argument being the number of moves and the second
-being the total clock time in minutes. Thus, entering 'chess 60 5' will set
-the clocks for 5 minutes (300 seconds) for the first 60 moves.
-If no argument is given the program will prompt the user for level of
-play.
-For use with CHESSTOOL, see the documentation on that program.
-.PP
-Once
-.I Chess
-is invoked, the program will display the board and prompt the user
-for a move. To enter a move, use the notation 'e2e4' where the first
-letter-number pair indicates the origination square
-and the second letter-number pair indicates the destination square.
-An alternative is to use the notation 'nf3' where
-the first letter indicates the piece type (p,n,b,r,q,k).
-To castle, type the origin and destination squares
-of the king just as you would do for a regular move, or type
-"o-o" for kingside castling and "o-o-o" for queenside.
-.SH COMMANDS
-.PP
-In addition to legal moves, the following commands are available as responses.
-.PP
-.I beep
--- causes the program to beep after each move.
-.PP
-.I bd
--- updates the current board position on the display.
-.PP
-.I book
--- turns off use of the opening library.
-.PP
-.I both
--- causes the computer to play both sides of a chess game.
-.PP
-.I black
--- causes the computer to take the black pieces with the move
-and begin searching.
-.PP
-.I level
--- allows the user to set time controls such as
-60 moves in 5 minutes etc. In tournament mode, the program will
-vary the time it takes for each
-move depending on the situation. If easy mode is disabled (using
-the 'easy' command), the program
-will often respond with its move immediately, saving time on
-its clock for use later on.
-.PP
-.I depth
--- allows the user to change the
-search depth of the program. The maximum depth is 29 ply.
-Normally the depth is set to 29 and the computer terminates
-its search based on elapsed time rather than depth.
-Using the depth command allows setting depth to say
-4 ply and setting response time to a large number such as
-9999 seconds. The program will then search until all moves
-have been examined to a depth of 4 ply (with extensions up
-to 11 additional ply for sequences of checks and captures).
-.PP
-.I easy
--- toggles easy mode (thinking on opponents time)
-on and off. The default is easy mode ON. If easy mode is disabled,
-the user must enter a 'break' or '^C' to get the programs
-attention before entering each move.
-.PP
-.I edit
--- allows the user to set up a board position.
-In this mode, the '#' command will clear the board, the 'c'
-command will toggle piece color, and the '.' command will exit
-setup mode. Pieces are entered by typing a letter (p,n,b,r,q,k) for
-the piece followed by the coordinate. For example "pb3" would
-place a pawn on square b3.
-.PP
-.I force
--- allows the user to enter moves for both
-sides. To get the program to play after a sequence of moves
-has been entered use the 'white' or 'black' commands.
-.PP
-.I get
--- retrieves a game from disk. The program will
-prompt the user for a file name.
-.PP
-.I help
--- displays a short description of the commands.
-.PP
-.I hint
--- causes the program to supply the user with
-its predicted move.
-.PP
-.I list
--- writes the game moves and some statistics
-on search depth, nodes, and time to the file 'chess.lst'.
-.PP
-.I new
--- starts a new game.
-.PP
-.I post
--- causes the program to display the principle
-variation and the score during the search. A score of
-100 is equivalent to a 1 pawn advantage for the computer.
-.PP
-.I random
--- causes the program to randomize its move
-selection slightly.
-.PP
-.I reverse
--- causes the board display to be reversed. That
-is, the white pieces will now appear at the top of the board.
-.PP
-.I quit
--- exits the game.
-.PP
-.I save
--- saves a game to disk. The program will prompt
-the user for a file name.
-.PP
-.I switch
--- causes the program to switch places with
-the opponent and begin searching.
-.PP
-.I undo
--- undoes the last move whether it was the computer's
-or the human's. You may also type "remove". This is equivalent
-to two "undo's" (e.g. retract one move for each side).
-.PP
-.I white
--- causes the computer to take the white pieces
-with the move and begin searching.
-.SH BUGS
-.PP
-Pawn promotion to pieces other than a queen is not allowed.
-En-Passant does not work properly with CHESSTOOOL.
-The transposition table may not work properly in some
-positions so the default is to turn this off.
-.fi
-.SH SEE ALSO
-.nf
-chesstool(6)
-.fi
-
diff --git a/gnu/games/chess/gnuchess.c b/gnu/games/chess/gnuchess.c
deleted file mode 100644
index 20b32c4..0000000
--- a/gnu/games/chess/gnuchess.c
+++ /dev/null
@@ -1,2307 +0,0 @@
-/*
- C source for CHESS
-
- Revision: 4-25-88
-
- Copyright (C) 1986, 1987, 1988 Free Software Foundation, Inc.
- Copyright (c) 1988 John Stanback
-
- This file is part of CHESS.
-
- CHESS is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY. No author or distributor
- accepts responsibility to anyone for the consequences of using it
- or for whether it serves any particular purpose or works at all,
- unless he says so in writing. Refer to the CHESS General Public
- License for full details.
-
- Everyone is granted permission to copy, modify and redistribute
- CHESS, but only under the conditions described in the
- CHESS General Public License. A copy of this license is
- supposed to have been given to you along with CHESS so you
- can know your rights and responsibilities. It should be in a
- file named COPYING. Among other things, the copyright notice
- and this notice must be preserved on all copies.
-*/
-
-
-#include <stdio.h>
-#include <ctype.h>
-
-#ifdef MSDOS
-#include <stdlib.h>
-#include <time.h>
-#include <alloc.h>
-#define ttblsz 4096
-#else
-#include <sys/param.h>
-#include <sys/times.h>
-#define ttblsz 16384
-#define huge
-#endif MSDOS
-
-#include "move.h"
-
-#define neutral 2
-#define white 0
-#define black 1
-#define no_piece 0
-#define pawn 1
-#define knight 2
-#define bishop 3
-#define rook 4
-#define queen 5
-#define king 6
-#define valueP 100
-#define valueN 350
-#define valueB 355
-#define valueR 550
-#define valueQ 1100
-#define valueK 1200
-#define ctlP 0x4000
-#define ctlN 0x2800
-#define ctlB 0x1800
-#define ctlR 0x0400
-#define ctlQ 0x0200
-#define ctlK 0x0100
-#define ctlBQ 0x1200
-#define ctlRQ 0x0600
-#define ctlNN 0x2000
-#define pxx " PNBRQK"
-#define qxx " pnbrqk"
-#define rxx "12345678"
-#define cxx "abcdefgh"
-#define check 0x0001
-#define capture 0x0002
-#define draw 0x0004
-#define promote 0x0008
-#define cstlmask 0x0010
-#define epmask 0x0020
-#define exact 0x0040
-#define pwnthrt 0x0080
-#define truescore 0x0001
-#define lowerbound 0x0002
-#define upperbound 0x0004
-#define maxdepth 30
-#define true 1
-#define false 0
-#define absv(x) ((x) < 0 ? -(x) : (x))
-#if (NEWMOVE < 1)
-#define taxicab(a,b) (abs(column[a]-column[b]) + abs(row[a]-row[b]))
-#endif
-struct leaf
- {
- short f,t,score,reply;
- unsigned short flags;
- };
-struct GameRec
- {
- unsigned short gmove;
- short score,depth,time,piece,color;
- long nodes;
- };
-struct TimeControlRec
- {
- short moves[2];
- long clock[2];
- };
-struct BookEntry
- {
- struct BookEntry *next;
- unsigned short *mv;
- };
-struct hashval
- {
- unsigned long bd;
- unsigned short key;
- };
-struct hashentry
- {
- unsigned long hashbd;
- unsigned short mv,flags;
- short score,depth;
- };
-
-char mvstr1[5],mvstr2[5];
-struct leaf Tree[2000],*root;
-short TrPnt[maxdepth],board[64],color[64];
-short row[64],column[64],locn[8][8],Pindex[64],svalue[64];
-short PieceList[2][16],PieceCnt[2],atak[2][64],PawnCnt[2][8];
-short castld[2],kingmoved[2],mtl[2],pmtl[2],emtl[2],hung[2];
-short c1,c2,*atk1,*atk2,*PC1,*PC2,EnemyKing;
-short mate,post,opponent,computer,Sdepth,Awindow,Bwindow,dither;
-long ResponseTime,ExtraTime,Level,et,et0,time0,cputimer,ft;
-long NodeCnt,evrate,ETnodes,EvalNodes,HashCnt;
-short quit,reverse,bothsides,hashflag,InChk,player,force,easy,beep;
-short wking,bking,FROMsquare,TOsquare,timeout,Zscore,zwndw,xwndw,slk;
-short INCscore;
-short HasPawn[2],HasKnight[2],HasBishop[2],HasRook[2],HasQueen[2];
-short ChkFlag[maxdepth],CptrFlag[maxdepth],PawnThreat[maxdepth];
-short Pscore[maxdepth],Tscore[maxdepth],Threat[maxdepth];
-struct GameRec GameList[240];
-short GameCnt,Game50,epsquare,lpost,rcptr,contempt;
-short MaxSearchDepth;
-struct BookEntry *Book;
-struct TimeControlRec TimeControl;
-short TCflag,TCmoves,TCminutes,OperatorTime;
-short otherside[3]={1,0,2};
-short rank7[3]={6,1,0};
-short map[64]=
- {0,1,2,3,4,5,6,7,
- 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
- 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
- 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,
- 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,
- 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,
- 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,
- 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77};
-short unmap[120]=
- {0,1,2,3,4,5,6,7,-1,-1,-1,-1,-1,-1,-1,-1,
- 8,9,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,
- 16,17,18,19,20,21,22,23,-1,-1,-1,-1,-1,-1,-1,-1,
- 24,25,26,27,28,29,30,31,-1,-1,-1,-1,-1,-1,-1,-1,
- 32,33,34,35,36,37,38,39,-1,-1,-1,-1,-1,-1,-1,-1,
- 40,41,42,43,44,45,46,47,-1,-1,-1,-1,-1,-1,-1,-1,
- 48,49,50,51,52,53,54,55,-1,-1,-1,-1,-1,-1,-1,-1,
- 56,57,58,59,60,61,62,63};
-short Dcode[120]=
- {0,1,1,1,1,1,1,1,0,0,0,0,0,0,0x0E,0x0F,
- 0x10,0x11,0x12,0,0,0,0,0,0,0,0,0,0,0,0x0F,0x1F,
- 0x10,0x21,0x11,0,0,0,0,0,0,0,0,0,0,0x0F,0,0,
- 0x10,0,0,0x11,0,0,0,0,0,0,0,0,0x0F,0,0,0,
- 0x10,0,0,0,0x11,0,0,0,0,0,0,0x0F,0,0,0,0,
- 0x10,0,0,0,0,0x11,0,0,0,0,0x0F,0,0,0,0,0,
- 0x10,0,0,0,0,0,0x11,0,0,0x0F,0,0,0,0,0,0,
- 0x10,0,0,0,0,0,0,0x11};
-short Stboard[64]=
- {rook,knight,bishop,queen,king,bishop,knight,rook,
- pawn,pawn,pawn,pawn,pawn,pawn,pawn,pawn,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- pawn,pawn,pawn,pawn,pawn,pawn,pawn,pawn,
- rook,knight,bishop,queen,king,bishop,knight,rook};
-short Stcolor[64]=
- {white,white,white,white,white,white,white,white,
- white,white,white,white,white,white,white,white,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- black,black,black,black,black,black,black,black,
- black,black,black,black,black,black,black,black};
-short sweep[7]= {false,false,false,true,true,true,false};
-short Dpwn[3]={4,6,0};
-short Dstart[7]={6,4,8,4,0,0,0};
-short Dstop[7]={7,5,15,7,3,7,7};
-short Dir[16]={1,0x10,-1,-0x10,0x0F,0x11,-0x0F,-0x11,
- 0x0E,-0x0E,0x12,-0x12,0x1F,-0x1F,0x21,-0x21};
-short Pdir[34]={0,0x38,0,0,0,0,0,0,0,0,0,0,0,0,0x02,0x35,
- 0x38,0x35,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0x02,
- 0,0x02};
-short pbit[7]={0,0x01,0x02,0x04,0x08,0x10,0x20};
-unsigned short killr0[maxdepth],killr1[maxdepth],killr2[maxdepth];
-unsigned short killr3[maxdepth],PrVar[maxdepth];
-unsigned short PV,hint,Swag0,Swag1,Swag2,Swag3,Swag4;
-unsigned short hashkey;
-unsigned long hashbd;
-struct hashval hashcode[2][7][64];
-struct hashentry huge *ttable,*ptbl;
-unsigned char history[8192];
-
-short Mwpawn[64],Mbpawn[64],Mknight[2][64],Mbishop[2][64];
-short Mking[2][64],Kfield[2][64];
-short value[7]={0,valueP,valueN,valueB,valueR,valueQ,valueK};
-short control[7]={0,ctlP,ctlN,ctlB,ctlR,ctlQ,ctlK};
-short PassedPawn0[8]={0,60,80,120,200,360,600,800};
-short PassedPawn1[8]={0,30,40,60,100,180,300,800};
-short PassedPawn2[8]={0,15,25,35,50,90,140,800};
-short PassedPawn3[8]={0,5,10,15,20,30,140,800};
-short ISOLANI[8] = {-12,-16,-20,-24,-24,-20,-16,-12};
-short BACKWARD[8] = {-6,-10,-15,-21,-28,-28,-28,-28};
-short BMBLTY[14] = {-2,0,2,4,6,8,10,12,13,14,15,16,16,16};
-short RMBLTY[14] = {0,2,4,6,8,10,11,12,13,14,14,14,14,14};
-short Kthreat[16] = {0,-8,-20,-36,-52,-68,-80,-80,-80,-80,-80,-80,
- -80,-80,-80,-80};
-short KNIGHTPOST,KNIGHTSTRONG,BISHOPSTRONG,KATAK,KBNKsq;
-short PEDRNK2B,PWEAKH,PADVNCM,PADVNCI,PAWNSHIELD,PDOUBLED,PBLOK;
-short RHOPN,RHOPNX,KHOPN,KHOPNX,KSFTY;
-short ATAKD,HUNGP,HUNGX,KCASTLD,KMOVD,XRAY,PINVAL;
-short stage,stage2,Zwmtl,Zbmtl,Developed[2],PawnStorm;
-short PawnBonus,BishopBonus,RookBonus;
-short KingOpening[64]=
- { 0, 0, -4,-10,-10, -4, 0, 0,
- -4, -4, -8,-12,-12, -8, -4, -4,
- -12,-16,-20,-20,-20,-20,-16,-12,
- -16,-20,-24,-24,-24,-24,-20,-16,
- -16,-20,-24,-24,-24,-24,-20,-16,
- -12,-16,-20,-20,-20,-20,-16,-12,
- -4, -4, -8,-12,-12, -8, -4, -4,
- 0, 0, -4,-10,-10, -4, 0, 0};
-short KingEnding[64]=
- { 0, 6,12,18,18,12, 6, 0,
- 6,12,18,24,24,18,12, 6,
- 12,18,24,30,30,24,18,12,
- 18,24,30,36,36,30,24,18,
- 18,24,30,36,36,30,24,18,
- 12,18,24,30,30,24,18,12,
- 6,12,18,24,24,18,12, 6,
- 0, 6,12,18,18,12, 6, 0};
-short DyingKing[64]=
- { 0, 8,16,24,24,16, 8, 0,
- 8,32,40,48,48,40,32, 8,
- 16,40,56,64,64,56,40,16,
- 24,48,64,72,72,64,48,24,
- 24,48,64,72,72,64,48,24,
- 16,40,56,64,64,56,40,16,
- 8,32,40,48,48,40,32, 8,
- 0, 8,16,24,24,16, 8, 0};
-short KBNK[64]=
- {99,90,80,70,60,50,40,40,
- 90,80,60,50,40,30,20,40,
- 80,60,40,30,20,10,30,50,
- 70,50,30,10, 0,20,40,60,
- 60,40,20, 0,10,30,50,70,
- 50,30,10,20,30,40,60,80,
- 40,20,30,40,50,60,80,90,
- 40,40,50,60,70,80,90,99};
-short pknight[64]=
- { 0, 4, 8,10,10, 8, 4, 0,
- 4, 8,16,20,20,16, 8, 4,
- 8,16,24,28,28,24,16, 8,
- 10,20,28,32,32,28,20,10,
- 10,20,28,32,32,28,20,10,
- 8,16,24,28,28,24,16, 8,
- 4, 8,16,20,20,16, 8, 4,
- 0, 4, 8,10,10, 8, 4, 0};
-short pbishop[64]=
- {14,14,14,14,14,14,14,14,
- 14,22,18,18,18,18,22,14,
- 14,18,22,22,22,22,18,14,
- 14,18,22,22,22,22,18,14,
- 14,18,22,22,22,22,18,14,
- 14,18,22,22,22,22,18,14,
- 14,22,18,18,18,18,22,14,
- 14,14,14,14,14,14,14,14};
-short PawnAdvance[64]=
- { 0, 0, 0, 0, 0, 0, 0, 0,
- 4, 4, 4, 0, 0, 4, 4, 4,
- 6, 8, 2,10,10, 2, 8, 6,
- 6, 8,12,16,16,12, 8, 6,
- 8,12,16,24,24,16,12, 8,
- 12,16,24,32,32,24,16,12,
- 12,16,24,32,32,24,16,12,
- 0, 0, 0, 0, 0, 0, 0, 0};
-
-
-main(argc,argv)
-int argc; char *argv[];
-{
-#ifdef MSDOS
- ttable = (struct hashentry huge *)farmalloc(ttblsz *
- (unsigned long)sizeof(struct hashentry));
-#else
- ttable = (struct hashentry *)malloc(ttblsz *
- (unsigned long)sizeof(struct hashentry));
-#endif
- Level = 0; TCflag = false; OperatorTime = 0;
- if (argc == 2) Level = atoi(argv[1]);
- if (argc == 3)
- {
- TCmoves = atoi(argv[1]); TCminutes = atoi(argv[2]); TCflag = true;
- }
- Initialize();
- NewGame();
-#if (NEWMOVE > 0)
- Initialize_dist();
-#if (NEWMOVE > 1)
- Initialize_moves();
-#endif
-#endif
- while (!(quit))
- {
- if (bothsides && !mate) SelectMove(opponent,1); else InputCommand();
- if (!(quit || mate || force)) SelectMove(computer,1);
- }
- ExitChess();
-}
-
-
-
-/* ............ INTERFACE ROUTINES ........................... */
-
-int VerifyMove(s,iop,mv)
-char s[];
-short iop;
-unsigned short *mv;
-
-/*
- Compare the string 's' to the list of legal moves available for the
- opponent. If a match is found, make the move on the board.
-*/
-
-{
-static short pnt,tempb,tempc,tempsf,tempst,cnt;
-static struct leaf xnode;
-struct leaf *node;
-
- *mv = 0;
- if (iop == 2)
- {
- UnmakeMove(opponent,&xnode,&tempb,&tempc,&tempsf,&tempst);
- return(false);
- }
- cnt = 0;
- MoveList(opponent,2);
- pnt = TrPnt[2];
- while (pnt < TrPnt[3])
- {
- node = &Tree[pnt++];
- algbr(node->f,node->t,(short) node->flags & cstlmask);
- if (strcmp(s,mvstr1) == 0 || strcmp(s,mvstr2) == 0)
- {
- cnt++; xnode = *node;
- }
- }
- if (cnt == 1)
- {
- MakeMove(opponent,&xnode,&tempb,&tempc,&tempsf,&tempst);
- if (SqAtakd(PieceList[opponent][0],computer))
- {
- UnmakeMove(opponent,&xnode,&tempb,&tempc,&tempsf,&tempst);
- ShowMessage("Illegal Move!!");
- return(false);
- }
- else
- {
- if (iop == 1) return(true);
- if (xnode.flags & epmask) UpdateDisplay(0,0,1,0);
- else UpdateDisplay(xnode.f,xnode.t,0,xnode.flags & cstlmask);
- if (xnode.flags & cstlmask) Game50 = GameCnt;
- else if (board[xnode.t] == pawn || (xnode.flags & capture))
- Game50 = GameCnt;
- GameList[GameCnt].depth = GameList[GameCnt].score = 0;
- GameList[GameCnt].nodes = 0;
- ElapsedTime(1);
- GameList[GameCnt].time = (short)et;
- TimeControl.clock[opponent] -= et;
- --TimeControl.moves[opponent];
- *mv = (xnode.f << 8) + xnode.t;
- algbr(xnode.f,xnode.t,false);
- return(true);
- }
- }
- if (cnt > 1) ShowMessage("Ambiguous Move!");
- return(false);
-}
-
-
-NewGame()
-
-/*
- Reset the board and other variables to start a new game.
-*/
-
-{
-short l,r,c,p;
-
- mate = quit = reverse = bothsides = post = false;
- hashflag = force = PawnStorm = false;
- beep = rcptr = easy = true;
- lpost = NodeCnt = epsquare = et0 = 0;
- dither = 0;
- Awindow = 90;
- Bwindow = 90;
- xwndw = 90;
- MaxSearchDepth = 29;
- contempt = 0;
- GameCnt = -1; Game50 = 0;
- Zwmtl = Zbmtl = 0;
- Developed[white] = Developed[black] = false;
- castld[white] = castld[black] = false;
- kingmoved[white] = kingmoved[black] = 0;
- PawnThreat[0] = CptrFlag[0] = Threat[0] = false;
- Pscore[0] = 12000; Tscore[0] = 12000;
- opponent = white; computer = black;
- for (r = 0; r < 8; r++)
- for (c = 0; c < 8; c++)
- {
- l = 8*r+c; locn[r][c] = l;
- row[l] = r; column[l] = c;
- board[l] = Stboard[l]; color[l] = Stcolor[l];
- }
- for (c = white; c <= black; c++)
- for (p = pawn; p <= king; p++)
- for (l = 0; l < 64; l++)
- {
- hashcode[c][p][l].key = (unsigned short)rand();
- hashcode[c][p][l].bd = ((unsigned long)rand() << 16) +
- (unsigned long)rand();
- }
- ClrScreen();
- if (TCflag) SetTimeControl();
- else if (Level == 0) SelectLevel();
- UpdateDisplay(0,0,1,0);
- InitializeStats();
- time0 = time((long *)0);
- ElapsedTime(1);
- GetOpenings();
-}
-
-
-algbr(f,t,iscastle)
-short f,t,iscastle;
-{
- mvstr1[0] = cxx[column[f]]; mvstr1[1] = rxx[row[f]];
- mvstr1[2] = cxx[column[t]]; mvstr1[3] = rxx[row[t]];
- mvstr2[0] = qxx[board[f]];
- mvstr2[1] = mvstr1[2]; mvstr2[2] = mvstr1[3];
- mvstr1[4] = '\0'; mvstr2[3] = '\0';
- if (iscastle)
- if (t > f) strcpy(mvstr2,"o-o");
- else strcpy(mvstr2,"o-o-o");
-}
-
-
-/* ............ MOVE GENERATION & SEARCH ROUTINES .............. */
-
-SelectMove(side,iop)
-short side,iop;
-
-/*
- Select a move by calling function search() at progressively deeper
- ply until time is up or a mate or draw is reached. An alpha-beta
- window of -90 to +90 points is set around the score returned from the
- previous iteration. If Sdepth != 0 then the program has correctly
- predicted the opponents move and the search will start at a depth of
- Sdepth+1 rather than a depth of 1.
-*/
-
-{
-static short i,alpha,beta,score,tempb,tempc,tempsf,tempst,xside,rpt;
-
- timeout = false;
- xside = otherside[side];
- if (iop != 2) player = side;
- if (TCflag)
- {
- if (((TimeControl.moves[side] + 3) - OperatorTime) != 0)
- ResponseTime = (TimeControl.clock[side]) /
- (TimeControl.moves[side] + 3) -
- OperatorTime;
- else ResponseTime = 0;
- ResponseTime += (ResponseTime*TimeControl.moves[side])/(2*TCmoves+1);
- }
- else ResponseTime = Level;
- if (iop == 2) ResponseTime = 999;
- if (Sdepth > 0 && root->score > Zscore-zwndw) ResponseTime -= ft;
- else if (ResponseTime < 1) ResponseTime = 1;
- ExtraTime = 0;
- ExaminePosition();
- ScorePosition(side,&score);
- ShowSidetomove();
-
- if (Sdepth == 0)
- {
- ZeroTTable();
- SearchStartStuff(side);
- for (i = 0; i < 8192; i++) history[i] = 0;
- FROMsquare = TOsquare = -1;
- PV = 0;
- if (iop != 2) hint = 0;
- for (i = 0; i < maxdepth; i++)
- PrVar[i] = killr0[i] = killr1[i] = killr2[i] = killr3[i] = 0;
- alpha = score-90; beta = score+90;
- rpt = 0;
- TrPnt[1] = 0; root = &Tree[0];
- MoveList(side,1);
- for (i = TrPnt[1]; i < TrPnt[2]; i++) pick(i,TrPnt[2]-1);
- if (Book != NULL) OpeningBook();
- if (Book != NULL) timeout = true;
- NodeCnt = ETnodes = EvalNodes = HashCnt = 0;
- Zscore = 0; zwndw = 20;
- }
-
- while (!timeout && Sdepth < MaxSearchDepth)
- {
- Sdepth++;
- ShowDepth(' ');
- score = search(side,1,Sdepth,alpha,beta,PrVar,&rpt);
- for (i = 1; i <= Sdepth; i++) killr0[i] = PrVar[i];
- if (score < alpha)
- {
- ShowDepth('-');
- ExtraTime = 10*ResponseTime;
- ZeroTTable();
- score = search(side,1,Sdepth,-9000,beta,PrVar,&rpt);
- }
- if (score > beta && !(root->flags & exact))
- {
- ShowDepth('+');
- ExtraTime = 0;
- ZeroTTable();
- score = search(side,1,Sdepth,alpha,9000,PrVar,&rpt);
- }
- score = root->score;
- if (!timeout)
- for (i = TrPnt[1]+1; i < TrPnt[2]; i++) pick(i,TrPnt[2]-1);
- ShowResults(score,PrVar,'.');
- for (i = 1; i <= Sdepth; i++) killr0[i] = PrVar[i];
- if (score > Zscore-zwndw && score > Tree[1].score+250) ExtraTime = 0;
- else if (score > Zscore-3*zwndw) ExtraTime = ResponseTime;
- else ExtraTime = 3*ResponseTime;
- if (root->flags & exact) timeout = true;
- if (Tree[1].score < -9000) timeout = true;
- if (4*et > 2*ResponseTime + ExtraTime) timeout = true;
- if (!timeout)
- {
- Tscore[0] = score;
- if (Zscore == 0) Zscore = score;
- else Zscore = (Zscore+score)/2;
- }
- zwndw = 20+abs(Zscore/12);
- beta = score + Bwindow;
- if (Zscore < score) alpha = Zscore - Awindow - zwndw;
- else alpha = score - Awindow - zwndw;
- }
-
- score = root->score;
- if (rpt >= 2 || score < -12000) root->flags |= draw;
- if (iop == 2) return(0);
- if (Book == NULL) hint = PrVar[2];
- ElapsedTime(1);
-
- if (score > -9999 && rpt <= 2)
- {
- MakeMove(side,root,&tempb,&tempc,&tempsf,&tempst);
- algbr(root->f,root->t,(short) root->flags & cstlmask);
- }
- else mvstr1[0] = '\0';
- OutputMove();
- if (score == -9999 || score == 9998) mate = true;
- if (mate) hint = 0;
- if (root->flags & cstlmask) Game50 = GameCnt;
- else if (board[root->t] == pawn || (root->flags & capture))
- Game50 = GameCnt;
- GameList[GameCnt].score = score;
- GameList[GameCnt].nodes = NodeCnt;
- GameList[GameCnt].time = (short)et;
- GameList[GameCnt].depth = Sdepth;
- if (TCflag)
- {
- TimeControl.clock[side] -= (et + OperatorTime);
- if (--TimeControl.moves[side] == 0) SetTimeControl();
- }
- if ((root->flags & draw) && bothsides) quit = true;
- if (GameCnt > 238) quit = true;
- player = xside;
- Sdepth = 0;
- fflush(stdin);
- return(0);
-}
-
-
-OpeningBook()
-
-/*
- Go thru each of the opening lines of play and check for a match with
- the current game listing. If a match occurs, generate a random number.
- If this number is the largest generated so far then the next move in
- this line becomes the current "candidate". After all lines are
- checked, the candidate move is put at the top of the Tree[] array and
- will be played by the program. Note that the program does not handle
- book transpositions.
-*/
-
-{
-short j,pnt;
-unsigned short m,*mp;
-unsigned r,r0;
-struct BookEntry *p;
-
- srand((unsigned)time0);
- r0 = m = 0;
- p = Book;
- while (p != NULL)
- {
- mp = p->mv;
- for (j = 0; j <= GameCnt; j++)
- if (GameList[j].gmove != *(mp++)) break;
- if (j > GameCnt)
- if ((r=rand()) > r0)
- {
- r0 = r; m = *mp;
- hint = *(++mp);
- }
- p = p->next;
- }
-
- for (pnt = TrPnt[1]; pnt < TrPnt[2]; pnt++)
- if ((Tree[pnt].f<<8) + Tree[pnt].t == m) Tree[pnt].score = 0;
- pick(TrPnt[1],TrPnt[2]-1);
- if (Tree[TrPnt[1]].score < 0) Book = NULL;
-}
-
-
-#define UpdateSearchStatus \
-{\
- if (post) ShowCurrentMove(pnt,node->f,node->t);\
- if (pnt > TrPnt[1])\
- {\
- d = best-Zscore; e = best-node->score;\
- if (best < alpha) ExtraTime = 10*ResponseTime;\
- else if (d > -zwndw && e > 4*zwndw) ExtraTime = -ResponseTime/3;\
- else if (d > -zwndw) ExtraTime = 0;\
- else if (d > -3*zwndw) ExtraTime = ResponseTime;\
- else if (d > -9*zwndw) ExtraTime = 3*ResponseTime;\
- else ExtraTime = 5*ResponseTime;\
- }\
-}
-
-int search(side,ply,depth,alpha,beta,bstline,rpt)
-short side,ply,depth,alpha,beta,*rpt;
-unsigned short bstline[];
-
-/*
- Perform an alpha-beta search to determine the score for the current
- board position. If depth <= 0 only capturing moves, pawn promotions
- and responses to check are generated and searched, otherwise all
- moves are processed. The search depth is modified for check evasions,
- certain re-captures and threats. Extensions may continue for up to 11
- ply beyond the nominal search depth.
-*/
-
-#define prune (cf && score+node->score < alpha)
-#define ReCapture (rcptr && score > alpha && score < beta &&\
- ply > 2 && CptrFlag[ply-1] && CptrFlag[ply-2])
-#define MateThreat (ply < Sdepth+4 && ply > 4 &&\
- ChkFlag[ply-2] && ChkFlag[ply-4] &&\
- ChkFlag[ply-2] != ChkFlag[ply-4])
-
-{
-register short j,pnt;
-short best,tempb,tempc,tempsf,tempst;
-short xside,pbst,d,e,cf,score,rcnt;
-unsigned short mv,nxtline[maxdepth];
-struct leaf *node,tmp;
-
- NodeCnt++;
- xside = otherside[side];
- if (depth < 0) depth = 0;
-
- if (ply <= Sdepth+3) repetition(rpt); else *rpt = 0;
- if (*rpt >= 2) return(0);
-
- score = evaluate(side,xside,ply,alpha,beta);
- if (score > 9000)
- {
- bstline[ply] = 0;
- return(score);
- }
-
- if (depth > 0)
- {
- if (InChk || PawnThreat[ply-1] || ReCapture) ++depth;
- }
- else
- {
- if (score >= alpha &&
- (InChk || PawnThreat[ply-1] || Threat[ply-1])) ++depth;
- else if (score <= beta && MateThreat) ++depth;
- }
-
- if (depth > 0 && hashflag && ply > 1)
- {
- ProbeTTable(side,depth,&alpha,&beta,&score);
- bstline[ply] = PV;
- bstline[ply+1] = 0;
- if (beta == -20000) return(score);
- if (alpha > beta) return(alpha);
- }
-
- if (Sdepth == 1) d = 7; else d = 11;
- if (ply > Sdepth+d || (depth < 1 && score > beta)) return(score);
-
- if (ply > 1)
- if (depth > 0) MoveList(side,ply);
- else CaptureList(side,xside,ply);
-
- if (TrPnt[ply] == TrPnt[ply+1]) return(score);
-
- cf = (depth < 1 && ply > Sdepth+1 && !ChkFlag[ply-2] && !slk);
-
- if (depth > 0) best = -12000; else best = score;
- if (best > alpha) alpha = best;
-
- for (pnt = pbst = TrPnt[ply];
- pnt < TrPnt[ply+1] && best <= beta;
- pnt++)
- {
- if (ply > 1) pick(pnt,TrPnt[ply+1]-1);
- node = &Tree[pnt];
- mv = (node->f << 8) + node->t;
- nxtline[ply+1] = 0;
-
- if (prune) break;
- if (ply == 1) UpdateSearchStatus;
-
- if (!(node->flags & exact))
- {
- MakeMove(side,node,&tempb,&tempc,&tempsf,&tempst);
- CptrFlag[ply] = (node->flags & capture);
- PawnThreat[ply] = (node->flags & pwnthrt);
- Tscore[ply] = node->score;
- PV = node->reply;
- node->score = -search(xside,ply+1,depth-1,-beta,-alpha,
- nxtline,&rcnt);
- if (abs(node->score) > 9000) node->flags |= exact;
- else if (rcnt == 1) node->score /= 2;
- if (rcnt >= 2 || GameCnt-Game50 > 99 ||
- (node->score == 9999-ply && !ChkFlag[ply]))
- {
- node->flags |= draw; node->flags |= exact;
- if (side == computer) node->score = contempt;
- else node->score = -contempt;
- }
- node->reply = nxtline[ply+1];
- UnmakeMove(side,node,&tempb,&tempc,&tempsf,&tempst);
- }
- if (node->score > best && !timeout)
- {
- if (depth > 0)
- if (node->score > alpha && !(node->flags & exact))
- node->score += depth;
- best = node->score; pbst = pnt;
- if (best > alpha) alpha = best;
- for (j = ply+1; nxtline[j] > 0; j++) bstline[j] = nxtline[j];
- bstline[j] = 0;
- bstline[ply] = mv;
- if (ply == 1)
- {
- if (best == alpha)
- {
- tmp = Tree[pnt];
- for (j = pnt-1; j >= 0; j--) Tree[j+1] = Tree[j];
- Tree[0] = tmp;
- pbst = 0;
- }
- if (Sdepth > 2)
- if (best > beta) ShowResults(best,bstline,'+');
- else if (best < alpha) ShowResults(best,bstline,'-');
- else ShowResults(best,bstline,'&');
- }
- }
- if (NodeCnt > ETnodes) ElapsedTime(0);
- if (timeout) return(-Tscore[ply-1]);
- }
-
- node = &Tree[pbst];
- mv = (node->f<<8) + node->t;
- if (hashflag && ply <= Sdepth && *rpt == 0 && best == alpha)
- PutInTTable(side,best,depth,alpha,beta,mv);
- if (depth > 0)
- {
- j = (node->f<<6) + node->t; if (side == black) j |= 0x1000;
- if (history[j] < 150) history[j] += 2*depth;
- if (node->t != (GameList[GameCnt].gmove & 0xFF))
- if (best <= beta) killr3[ply] = mv;
- else if (mv != killr1[ply])
- {
- killr2[ply] = killr1[ply];
- killr1[ply] = mv;
- }
- if (best > 9000) killr0[ply] = mv; else killr0[ply] = 0;
- }
- return(best);
-}
-
-
-evaluate(side,xside,ply,alpha,beta)
-short side,xside,ply,alpha,beta;
-
-/*
- Compute an estimate of the score by adding the positional score from
- the previous ply to the material difference. If this score falls
- inside a window which is 180 points wider than the alpha-beta window
- (or within a 50 point window during quiescence search) call
- ScorePosition() to determine a score, otherwise return the estimated
- score. If one side has only a king and the other either has no pawns
- or no pieces then the function ScoreLoneKing() is called.
-*/
-
-{
-short s,evflag;
-
- hung[white] = hung[black] = 0;
- slk = ((mtl[white] == valueK && (pmtl[black] == 0 || emtl[black] == 0)) ||
- (mtl[black] == valueK && (pmtl[white] == 0 || emtl[white] == 0)));
- s = -Pscore[ply-1] + mtl[side] - mtl[xside];
- s -= INCscore;
-
- if (slk) evflag = false;
- else evflag =
- (ply == 1 || ply < Sdepth ||
- ((ply == Sdepth+1 || ply == Sdepth+2) &&
- (s > alpha-xwndw && s < beta+xwndw)) ||
- (ply > Sdepth+2 && s >= alpha-25 && s <= beta+25));
-
- if (evflag)
- {
- EvalNodes++;
- ataks(side,atak[side]);
- if (atak[side][PieceList[xside][0]] > 0) return(10001-ply);
- ataks(xside,atak[xside]);
- InChk = (atak[xside][PieceList[side][0]] > 0);
- ScorePosition(side,&s);
- }
- else
- {
- if (SqAtakd(PieceList[xside][0],side)) return(10001-ply);
- InChk = SqAtakd(PieceList[side][0],xside);
- if (slk) ScoreLoneKing(side,&s);
- }
-
- Pscore[ply] = s - mtl[side] + mtl[xside];
- if (InChk) ChkFlag[ply-1] = Pindex[TOsquare];
- else ChkFlag[ply-1] = 0;
- Threat[ply-1] = (hung[side] > 1 && ply == Sdepth+1);
- return(s);
-}
-
-
-ProbeTTable(side,depth,alpha,beta,score)
-short side,depth,*alpha,*beta,*score;
-
-/*
- Look for the current board position in the transposition table.
-*/
-
-{
-short hindx;
- if (side == white) hashkey |= 1; else hashkey &= 0xFFFE;
- hindx = (hashkey & (ttblsz-1));
- ptbl = (ttable + hindx);
- if (ptbl->depth >= depth && ptbl->hashbd == hashbd)
- {
- HashCnt++;
- PV = ptbl->mv;
- if (ptbl->flags & truescore)
- {
- *score = ptbl->score;
- *beta = -20000;
- return(true);
- }
-/*
- else if (ptbl->flags & upperbound)
- {
- if (ptbl->score < *beta) *beta = ptbl->score+1;
- }
-*/
- else if (ptbl->flags & lowerbound)
- {
- if (ptbl->score > *alpha) *alpha = ptbl->score-1;
- }
- }
- return(false);
-}
-
-
-PutInTTable(side,score,depth,alpha,beta,mv)
-short side,score,depth,alpha,beta;
-unsigned short mv;
-
-/*
- Store the current board position in the transposition table.
-*/
-
-{
-short hindx;
- if (side == white) hashkey |= 1; else hashkey &= 0xFFFE;
- hindx = (hashkey & (ttblsz-1));
- ptbl = (ttable + hindx);
- ptbl->hashbd = hashbd;
- ptbl->depth = depth;
- ptbl->score = score;
- ptbl->mv = mv;
- ptbl->flags = 0;
- if (score < alpha) ptbl->flags |= upperbound;
- else if (score > beta) ptbl->flags |= lowerbound;
- else ptbl->flags |= truescore;
-}
-
-
-ZeroTTable()
-{
-int i;
- if (hashflag)
- for (i = 0; i < ttblsz; i++)
- {
- ptbl = (ttable + i);
- ptbl->depth = 0;
- }
-}
-
-
-MoveList(side,ply)
-short side,ply;
-
-/*
- Fill the array Tree[] with all available moves for side to play. Array
- TrPnt[ply] contains the index into Tree[] of the first move at a ply.
-*/
-
-{
-register short i;
-short xside,f;
-
- xside = otherside[side];
- if (PV == 0) Swag0 = killr0[ply]; else Swag0 = PV;
- Swag1 = killr1[ply]; Swag2 = killr2[ply];
- Swag3 = killr3[ply]; Swag4 = 0;
- if (ply > 2) Swag4 = killr1[ply-2];
- TrPnt[ply+1] = TrPnt[ply];
- Dstart[pawn] = Dpwn[side]; Dstop[pawn] = Dstart[pawn] + 1;
- for (i = PieceCnt[side]; i >= 0; i--)
- GenMoves(ply,PieceList[side][i],side,xside);
- if (kingmoved[side] == 0 && !castld[side])
- {
- f = PieceList[side][0];
- if (castle(side,f,f+2,0))
- {
- LinkMove(ply,f,f+2,xside);
- Tree[TrPnt[ply+1]-1].flags |= cstlmask;
- }
- if (castle(side,f,f-2,0))
- {
- LinkMove(ply,f,f-2,xside);
- Tree[TrPnt[ply+1]-1].flags |= cstlmask;
- }
- }
-}
-
-#if (NEWMOVE < 11)
-GenMoves(ply,sq,side,xside)
-short ply,sq,side,xside;
-
-/*
- Generate moves for a piece. The from square is mapped onto a special
- board and offsets (taken from array Dir[]) are added to the mapped
- location. The newly generated square is tested to see if it falls off
- the board by ANDing the square with 88 HEX. Legal moves are linked
- into the tree.
-*/
-
-{
-register short m,u,d;
-short i,m0,piece;
-
- piece = board[sq]; m0 = map[sq];
- if (sweep[piece])
- for (i = Dstart[piece]; i <= Dstop[piece]; i++)
- {
- d = Dir[i]; m = m0+d;
- while (!(m & 0x88))
- {
- u = unmap[m];
- if (color[u] == neutral)
- {
- LinkMove(ply,sq,u,xside);
- m += d;
- }
- else if (color[u] == xside)
- {
- LinkMove(ply,sq,u,xside);
- break;
- }
- else break;
- }
- }
- else if (piece == pawn)
- {
- if (side == white && color[sq+8] == neutral)
- {
- LinkMove(ply,sq,sq+8,xside);
- if (row[sq] == 1)
- if (color[sq+16] == neutral)
- LinkMove(ply,sq,sq+16,xside);
- }
- else if (side == black && color[sq-8] == neutral)
- {
- LinkMove(ply,sq,sq-8,xside);
- if (row[sq] == 6)
- if (color[sq-16] == neutral)
- LinkMove(ply,sq,sq-16,xside);
- }
- for (i = Dstart[piece]; i <= Dstop[piece]; i++)
- if (!((m = m0+Dir[i]) & 0x88))
- {
- u = unmap[m];
- if (color[u] == xside || u == epsquare)
- LinkMove(ply,sq,u,xside);
- }
- }
- else
- {
- for (i = Dstart[piece]; i <= Dstop[piece]; i++)
- if (!((m = m0+Dir[i]) & 0x88))
- {
- u = unmap[m];
- if (color[u] != side) LinkMove(ply,sq,u,xside);
- }
- }
-}
-#endif
-
-LinkMove(ply,f,t,xside)
-short ply,f,t,xside;
-
-/*
- Add a move to the tree. Assign a bonus to order the moves
- as follows:
- 1. Principle variation
- 2. Capture of last moved piece
- 3. Other captures (major pieces first)
- 4. Killer moves
- 5. "history" killers
-*/
-
-{
-register short s,z;
-unsigned short mv;
-struct leaf *node;
-
- node = &Tree[TrPnt[ply+1]];
- ++TrPnt[ply+1];
- node->flags = node->reply = 0;
- node->f = f; node->t = t;
- mv = (f<<8) + t;
- s = 0;
- if (mv == Swag0) s = 2000;
- else if (mv == Swag1) s = 60;
- else if (mv == Swag2) s = 50;
- else if (mv == Swag3) s = 40;
- else if (mv == Swag4) s = 30;
- if (color[t] != neutral)
- {
- node->flags |= capture;
- if (t == TOsquare) s += 500;
- s += value[board[t]] - board[f];
- }
- if (board[f] == pawn)
- if (row[t] == 0 || row[t] == 7)
- {
- node->flags |= promote;
- s += 800;
- }
- else if (row[t] == 1 || row[t] == 6)
- {
- node->flags |= pwnthrt;
- s += 600;
- }
- else if (t == epsquare) node->flags |= epmask;
- z = (f<<6) + t; if (xside == white) z |= 0x1000;
- s += history[z];
- node->score = s - 20000;
-}
-
-#if (NEWMOVE < 10)
-CaptureList(side,xside,ply)
-short side,xside,ply;
-
-/*
- Generate captures and Pawn promotions only.
-*/
-
-#define LinkCapture\
-{\
- node->f = sq; node->t = u;\
- node->reply = 0;\
- node->flags = capture;\
- node->score = value[board[u]] + svalue[board[u]] - piece;\
- if (piece == pawn && (u < 8 || u > 55))\
- {\
- node->flags |= promote;\
- node->score = valueQ;\
- }\
- ++node;\
- ++TrPnt[ply+1];\
-}
-
-{
-register short m,u;
-short d,sq,i,j,j1,j2,m0,r7,d0,piece,*PL;
-struct leaf *node;
-
- TrPnt[ply+1] = TrPnt[ply];
- node = &Tree[TrPnt[ply]];
- Dstart[pawn] = Dpwn[side]; Dstop[pawn] = Dstart[pawn] + 1;
- if (side == white)
- {
- r7 = 6; d0 = 8;
- }
- else
- {
- r7 = 1; d0 = -8;
- }
- PL = PieceList[side];
- for (i = 0; i <= PieceCnt[side]; i++)
- {
- sq = PL[i];
- m0 = map[sq]; piece = board[sq];
- j1 = Dstart[piece]; j2 = Dstop[piece];
- if (sweep[piece])
- for (j = j1; j <= j2; j++)
- {
- d = Dir[j]; m = m0+d;
- while (!(m & 0x88))
- {
- u = unmap[m];
- if (color[u] == neutral) m += d;
- else
- {
- if (color[u] == xside) LinkCapture;
- break;
- }
- }
- }
- else
- {
- for (j = j1; j <= j2; j++)
- if (!((m = m0+Dir[j]) & 0x88))
- {
- u = unmap[m];
- if (color[u] == xside) LinkCapture;
- }
- if (piece == pawn && row[sq] == r7)
- {
- u = sq+d0;
- if (color[u] == neutral) LinkCapture;
- }
- }
- }
-}
-#endif
-
-int castle(side,kf,kt,iop)
-short side,kf,kt,iop;
-
-/*
- Make or Unmake a castling move.
-*/
-
-{
-short rf,rt,d,t0,xside;
-
- xside = otherside[side];
- if (kt > kf)
- {
- rf = kf+3; rt = kt-1; d = 1;
- }
- else
- {
- rf = kf-4; rt = kt+1; d = -1;
- }
- if (iop == 0)
- {
- if (board[kf] != king || board[rf] != rook || color[rf] != side)
- return(false);
- if (color[kt] != neutral || color[rt] != neutral) return(false);
- if (d == -1 && color[kt+d] != neutral) return(false);
- if (SqAtakd(kf,xside)) return(false);
- if (SqAtakd(kt,xside)) return(false);
- if (SqAtakd(kf+d,xside)) return(false);
- }
- else
- {
- if (iop == 1) castld[side] = true; else castld[side] = false;
- if (iop == 2)
- {
- t0 = kt; kt = kf; kf = t0;
- t0 = rt; rt = rf; rf = t0;
- }
- board[kt] = king; color[kt] = side; Pindex[kt] = 0;
- board[kf] = no_piece; color[kf] = neutral;
- board[rt] = rook; color[rt] = side; Pindex[rt] = Pindex[rf];
- board[rf] = no_piece; color[rf] = neutral;
- PieceList[side][Pindex[kt]] = kt;
- PieceList[side][Pindex[rt]] = rt;
- if (hashflag)
- {
- UpdateHashbd(side,king,kf,kt);
- UpdateHashbd(side,rook,rf,rt);
- }
- }
- return(true);
-}
-
-
-EnPassant(xside,f,t,iop)
-short xside,f,t,iop;
-
-/*
- Make or unmake an en passant move.
-*/
-
-{
-short l;
- if (t > f) l = t-8; else l = t+8;
- if (iop == 1)
- {
- board[l] = no_piece; color[l] = neutral;
- }
- else
- {
- board[l] = pawn; color[l] = xside;
- }
- InitializeStats();
-}
-
-
-MakeMove(side,node,tempb,tempc,tempsf,tempst)
-short side,*tempc,*tempb,*tempsf,*tempst;
-struct leaf *node;
-
-/*
- Update Arrays board[], color[], and Pindex[] to reflect the new board
- position obtained after making the move pointed to by node. Also
- update miscellaneous stuff that changes when a move is made.
-*/
-
-{
-register short f,t;
-short xside,ct,cf;
-
- xside = otherside[side];
- f = node->f; t = node->t; epsquare = -1;
- FROMsquare = f; TOsquare = t;
- INCscore = 0;
- GameList[++GameCnt].gmove = (f<<8) + t;
- if (node->flags & cstlmask)
- {
- GameList[GameCnt].piece = no_piece;
- GameList[GameCnt].color = side;
- castle(side,f,t,1);
- }
- else
- {
- *tempc = color[t]; *tempb = board[t];
- *tempsf = svalue[f]; *tempst = svalue[t];
- GameList[GameCnt].piece = *tempb;
- GameList[GameCnt].color = *tempc;
- if (*tempc != neutral)
- {
- UpdatePieceList(*tempc,t,1);
- if (*tempb == pawn) --PawnCnt[*tempc][column[t]];
- if (board[f] == pawn)
- {
- --PawnCnt[side][column[f]];
- ++PawnCnt[side][column[t]];
- cf = column[f]; ct = column[t];
- if (PawnCnt[side][ct] > 1+PawnCnt[side][cf])
- INCscore -= 15;
- else if (PawnCnt[side][ct] < 1+PawnCnt[side][cf])
- INCscore += 15;
- else if (ct == 0 || ct == 7 || PawnCnt[side][ct+ct-cf] == 0)
- INCscore -= 15;
- }
- mtl[xside] -= value[*tempb];
- if (*tempb == pawn) pmtl[xside] -= valueP;
- if (hashflag) UpdateHashbd(xside,*tempb,-1,t);
- INCscore += *tempst;
- }
- color[t] = color[f]; board[t] = board[f]; svalue[t] = svalue[f];
- Pindex[t] = Pindex[f]; PieceList[side][Pindex[t]] = t;
- color[f] = neutral; board[f] = no_piece;
- if (board[t] == pawn)
- if (t-f == 16) epsquare = f+8;
- else if (f-t == 16) epsquare = f-8;
- if (node->flags & promote)
- {
- board[t] = queen;
- --PawnCnt[side][column[t]];
- mtl[side] += valueQ - valueP;
- pmtl[side] -= valueP;
- HasQueen[side] = true;
- if (hashflag)
- {
- UpdateHashbd(side,pawn,f,-1);
- UpdateHashbd(side,queen,f,-1);
- }
- INCscore -= *tempsf;
- }
- if (board[t] == king) ++kingmoved[side];
- if (node->flags & epmask) EnPassant(xside,f,t,1);
- else if (hashflag) UpdateHashbd(side,board[t],f,t);
- }
-}
-
-
-UnmakeMove(side,node,tempb,tempc,tempsf,tempst)
-short side,*tempc,*tempb,*tempsf,*tempst;
-struct leaf *node;
-
-/*
- Take back a move.
-*/
-
-{
-register short f,t;
-short xside;
-
- xside = otherside[side];
- f = node->f; t = node->t; epsquare = -1;
- GameCnt--;
- if (node->flags & cstlmask) castle(side,f,t,2);
- else
- {
- color[f] = color[t]; board[f] = board[t]; svalue[f] = *tempsf;
- Pindex[f] = Pindex[t]; PieceList[side][Pindex[f]] = f;
- color[t] = *tempc; board[t] = *tempb; svalue[t] = *tempst;
- if (node->flags & promote)
- {
- board[f] = pawn;
- ++PawnCnt[side][column[t]];
- mtl[side] += valueP - valueQ;
- pmtl[side] += valueP;
- if (hashflag)
- {
- UpdateHashbd(side,queen,-1,t);
- UpdateHashbd(side,pawn,-1,t);
- }
- }
- if (*tempc != neutral)
- {
- UpdatePieceList(*tempc,t,2);
- if (*tempb == pawn) ++PawnCnt[*tempc][column[t]];
- if (board[f] == pawn)
- {
- --PawnCnt[side][column[t]];
- ++PawnCnt[side][column[f]];
- }
- mtl[xside] += value[*tempb];
- if (*tempb == pawn) pmtl[xside] += valueP;
- if (hashflag) UpdateHashbd(xside,*tempb,-1,t);
- }
- if (board[f] == king) --kingmoved[side];
- if (node->flags & epmask) EnPassant(xside,f,t,2);
- else if (hashflag) UpdateHashbd(side,board[f],f,t);
- }
-}
-
-
-UpdateHashbd(side,piece,f,t)
-short side,piece,f,t;
-
-/*
- hashbd contains a 32 bit "signature" of the board position. hashkey
- contains a 16 bit code used to address the hash table. When a move is
- made, XOR'ing the hashcode of moved piece on the from and to squares
- with the hashbd and hashkey values keeps things current.
-*/
-
-{
- if (f >= 0)
- {
- hashbd ^= hashcode[side][piece][f].bd;
- hashkey ^= hashcode[side][piece][f].key;
- }
- if (t >= 0)
- {
- hashbd ^= hashcode[side][piece][t].bd;
- hashkey ^= hashcode[side][piece][t].key;
- }
-}
-
-
-UpdatePieceList(side,sq,iop)
-short side,sq,iop;
-
-/*
- Update the PieceList and Pindex arrays when a piece is captured or
- when a capture is unmade.
-*/
-
-{
-register short i;
- if (iop == 1)
- {
- PieceCnt[side]--;
- for (i = Pindex[sq]; i <= PieceCnt[side]; i++)
- {
- PieceList[side][i] = PieceList[side][i+1];
- Pindex[PieceList[side][i]] = i;
- }
- }
- else
- {
- PieceCnt[side]++;
- PieceList[side][PieceCnt[side]] = sq;
- Pindex[sq] = PieceCnt[side];
- }
-}
-
-
-InitializeStats()
-
-/*
- Scan thru the board seeing what's on each square. If a piece is found,
- update the variables PieceCnt, PawnCnt, Pindex and PieceList. Also
- determine the material for each side and set the hashkey and hashbd
- variables to represent the current board position. Array
- PieceList[side][indx] contains the location of all the pieces of
- either side. Array Pindex[sq] contains the indx into PieceList for a
- given square.
-*/
-
-{
-register short i,sq;
- epsquare = -1;
- for (i = 0; i < 8; i++)
- PawnCnt[white][i] = PawnCnt[black][i] = 0;
- mtl[white] = mtl[black] = pmtl[white] = pmtl[black] = 0;
- PieceCnt[white] = PieceCnt[black] = 0;
- hashbd = hashkey = 0;
- for (sq = 0; sq < 64; sq++)
- if (color[sq] != neutral)
- {
- mtl[color[sq]] += value[board[sq]];
- if (board[sq] == pawn)
- {
- pmtl[color[sq]] += valueP;
- ++PawnCnt[color[sq]][column[sq]];
- }
- if (board[sq] == king) Pindex[sq] = 0;
- else Pindex[sq] = ++PieceCnt[color[sq]];
- PieceList[color[sq]][Pindex[sq]] = sq;
- hashbd ^= hashcode[color[sq]][board[sq]][sq].bd;
- hashkey ^= hashcode[color[sq]][board[sq]][sq].key;
- }
-}
-
-
-pick(p1,p2)
-short p1,p2;
-
-/*
- Find the best move in the tree between indexes p1 and p2. Swap the
- best move into the p1 element.
-*/
-
-{
-register short p,s;
-short p0,s0;
-struct leaf temp;
-
- s0 = Tree[p1].score; p0 = p1;
- for (p = p1+1; p <= p2; p++)
- if ((s = Tree[p].score) > s0)
- {
- s0 = s; p0 = p;
- }
- if (p0 != p1)
- {
- temp = Tree[p1]; Tree[p1] = Tree[p0]; Tree[p0] = temp;
- }
-}
-
-
-repetition(cnt)
-short *cnt;
-
-/*
- Check for draw by threefold repetition.
-*/
-
-{
-register short i,c;
-short f,t,b[64];
-unsigned short m;
- *cnt = c = 0;
- if (GameCnt > Game50+3)
- {
-/*
- memset((char *)b,0,64*sizeof(short));
-*/
- for (i = 0; i < 64; b[i++] = 0);
- for (i = GameCnt; i > Game50; i--)
- {
- m = GameList[i].gmove; f = m>>8; t = m & 0xFF;
- if (++b[f] == 0) c--; else c++;
- if (--b[t] == 0) c--; else c++;
- if (c == 0) (*cnt)++;
- }
- }
-}
-
-#if (NEWMOVE < 3)
-int SqAtakd(sq,side)
-short sq,side;
-
-/*
- See if any piece with color 'side' ataks sq. First check for pawns
- or king, then try other pieces. Array Dcode is used to check for
- knight attacks or R,B,Q co-linearity.
-*/
-
-{
-register short m,d;
-short i,m0,m1,loc,piece,*PL;
-
- m1 = map[sq];
- if (side == white) m = m1-0x0F; else m = m1+0x0F;
- if (!(m & 0x88))
- if (board[unmap[m]] == pawn && color[unmap[m]] == side) return(true);
- if (side == white) m = m1-0x11; else m = m1+0x11;
- if (!(m & 0x88))
- if (board[unmap[m]] == pawn && color[unmap[m]] == side) return(true);
- if (distance(sq,PieceList[side][0]) == 1) return(true);
-
- PL = PieceList[side];
- for (i = 1; i <= PieceCnt[side]; i++)
- {
- loc = PL[i]; piece = board[loc];
- if (piece == pawn) continue;
- m0 = map[loc]; d = Dcode[abs(m1-m0)];
- if (d == 0 || (Pdir[d] & pbit[piece]) == 0) continue;
- if (piece == knight) return(true);
- else
- {
- if (m1 < m0) d = -d;
- for (m = m0+d; m != m1; m += d)
- if (color[unmap[m]] != neutral) break;
- if (m == m1) return(true);
- }
- }
- return(false);
-}
-#endif
-
-#if (NEWMOVE < 2)
-ataks(side,a)
-short side,*a;
-
-/*
- Fill array atak[][] with info about ataks to a square. Bits 8-15
- are set if the piece (king..pawn) ataks the square. Bits 0-7
- contain a count of total ataks to the square.
-*/
-
-{
-register short u,m;
-short d,c,j,j1,j2,piece,i,m0,sq,*PL;
-
-/*
- memset((char *)a,0,64*sizeof(short));
-*/
- for (u = 0; u < 64; a[u++] = 0);
- Dstart[pawn] = Dpwn[side]; Dstop[pawn] = Dstart[pawn] + 1;
- PL = PieceList[side];
- for (i = 0; i <= PieceCnt[side]; i++)
- {
- sq = PL[i];
- m0 = map[sq];
- piece = board[sq];
- c = control[piece]; j1 = Dstart[piece]; j2 = Dstop[piece];
- if (sweep[piece])
- for (j = j1; j <= j2; j++)
- {
- d = Dir[j]; m = m0+d;
- while (!(m & 0x88))
- {
- u = unmap[m];
- a[u] = ++a[u] | c;
- if (color[u] == neutral) m += d;
- else break;
- }
- }
- else
- for (j = j1; j <= j2; j++)
- if (!((m = m0+Dir[j]) & 0x88))
- {
- u = unmap[m];
- a[u] = ++a[u] | c;
- }
- }
-}
-#endif
-
-/* ............ POSITIONAL EVALUATION ROUTINES ............ */
-
-ScorePosition(side,score)
-short side,*score;
-
-/*
- Perform normal static evaluation of board position. A score is
- generated for each piece and these are summed to get a score for each
- side.
-*/
-
-{
-register short sq,s;
-short i,xside,pscore[3];
-
- wking = PieceList[white][0]; bking = PieceList[black][0];
- UpdateWeights();
- xside = otherside[side];
- pscore[white] = pscore[black] = 0;
-
- for (c1 = white; c1 <= black; c1++)
- {
- c2 = otherside[c1];
- if (c1 == white) EnemyKing = bking; else EnemyKing = wking;
- atk1 = atak[c1]; atk2 = atak[c2];
- PC1 = PawnCnt[c1]; PC2 = PawnCnt[c2];
- for (i = 0; i <= PieceCnt[c1]; i++)
- {
- sq = PieceList[c1][i];
- s = SqValue(sq,side);
- pscore[c1] += s;
- svalue[sq] = s;
- }
- }
- if (hung[side] > 1) pscore[side] += HUNGX;
- if (hung[xside] > 1) pscore[xside] += HUNGX;
-
- *score = mtl[side] - mtl[xside] + pscore[side] - pscore[xside] + 10;
- if (dither) *score += rand() % dither;
-
- if (*score > 0 && pmtl[side] == 0)
- if (emtl[side] < valueR) *score = 0;
- else if (*score < valueR) *score /= 2;
- if (*score < 0 && pmtl[xside] == 0)
- if (emtl[xside] < valueR) *score = 0;
- else if (-*score < valueR) *score /= 2;
-
- if (mtl[xside] == valueK && emtl[side] > valueB) *score += 200;
- if (mtl[side] == valueK && emtl[xside] > valueB) *score -= 200;
-}
-
-
-ScoreLoneKing(side,score)
-short side,*score;
-
-/*
- Static evaluation when loser has only a king and winner has no pawns
- or no pieces.
-*/
-
-{
-short winner,loser,king1,king2,s,i;
-
- UpdateWeights();
- if (mtl[white] > mtl[black]) winner = white; else winner = black;
- loser = otherside[winner];
- king1 = PieceList[winner][0]; king2 = PieceList[loser][0];
-
- s = 0;
-
- if (pmtl[winner] > 0)
- for (i = 1; i <= PieceCnt[winner]; i++)
- s += ScoreKPK(side,winner,loser,king1,king2,PieceList[winner][i]);
-
- else if (emtl[winner] == valueB+valueN)
- s = ScoreKBNK(winner,king1,king2);
-
- else if (emtl[winner] > valueB)
- s = 500 + emtl[winner] - DyingKing[king2] - 2*distance(king1,king2);
-
- if (side == winner) *score = s; else *score = -s;
-}
-
-
-int ScoreKPK(side,winner,loser,king1,king2,sq)
-short side,winner,loser,king1,king2,sq;
-
-/*
- Score King and Pawns versus King endings.
-*/
-
-{
-short s,r;
-
- if (PieceCnt[winner] == 1) s = 50; else s = 120;
- if (winner == white)
- {
- if (side == loser) r = row[sq]-1; else r = row[sq];
- if (row[king2] >= r && distance(sq,king2) < 8-r) s += 10*row[sq];
- else s = 500+50*row[sq];
- if (row[sq] < 6) sq += 16; else sq += 8;
- }
- else
- {
- if (side == loser) r = row[sq]+1; else r = row[sq];
- if (row[king2] <= r && distance(sq,king2) < r+1) s += 10*(7-row[sq]);
- else s = 500+50*(7-row[sq]);
- if (row[sq] > 1) sq -= 16; else sq -= 8;
- }
- s += 8*(taxicab(king2,sq) - taxicab(king1,sq));
- return(s);
-}
-
-
-int ScoreKBNK(winner,king1,king2)
-short winner,king1,king2;
-
-/*
- Score King+Bishop+Knight versus King endings.
- This doesn't work all that well but it's better than nothing.
-*/
-
-{
-short s;
- s = emtl[winner] - 300;
- if (KBNKsq == 0) s += KBNK[king2];
- else s += KBNK[locn[row[king2]][7-column[king2]]];
- s -= taxicab(king1,king2);
- s -= distance(PieceList[winner][1],king2);
- s -= distance(PieceList[winner][2],king2);
- return(s);
-}
-
-
-SqValue(sq,side)
-short sq,side;
-
-/*
- Calculate the positional value for the piece on 'sq'.
-*/
-
-{
-register short j,fyle,rank;
-short s,piece,a1,a2,in_square,r,mob,e,c;
-
- piece = board[sq];
- a1 = (atk1[sq] & 0x4FFF); a2 = (atk2[sq] & 0x4FFF);
- rank = row[sq]; fyle = column[sq];
- s = 0;
- if (piece == pawn && c1 == white)
- {
- s = Mwpawn[sq];
- if (sq == 11 || sq == 12)
- if (color[sq+8] != neutral) s += PEDRNK2B;
- if ((fyle == 0 || PC1[fyle-1] == 0) &&
- (fyle == 7 || PC1[fyle+1] == 0))
- s += ISOLANI[fyle];
- else if (PC1[fyle] > 1) s += PDOUBLED;
- if (a1 < ctlP && atk1[sq+8] < ctlP)
- {
- s += BACKWARD[a2 & 0xFF];
- if (PC2[fyle] == 0) s += PWEAKH;
- if (color[sq+8] != neutral) s += PBLOK;
- }
- if (PC2[fyle] == 0)
- {
- if (side == black) r = rank-1; else r = rank;
- in_square = (row[bking] >= r && distance(sq,bking) < 8-r);
- if (a2 == 0 || side == white) e = 0; else e = 1;
- for (j = sq+8; j < 64; j += 8)
- if (atk2[j] >= ctlP) { e = 2; break; }
- else if (atk2[j] > 0 || color[j] != neutral) e = 1;
- if (e == 2) s += (stage*PassedPawn3[rank]) / 10;
- else if (in_square || e == 1) s += (stage*PassedPawn2[rank]) / 10;
- else if (emtl[black] > 0) s += (stage*PassedPawn1[rank]) / 10;
- else s += PassedPawn0[rank];
- }
- }
- else if (piece == pawn && c1 == black)
- {
- s = Mbpawn[sq];
- if (sq == 51 || sq == 52)
- if (color[sq-8] != neutral) s += PEDRNK2B;
- if ((fyle == 0 || PC1[fyle-1] == 0) &&
- (fyle == 7 || PC1[fyle+1] == 0))
- s += ISOLANI[fyle];
- else if (PC1[fyle] > 1) s += PDOUBLED;
- if (a1 < ctlP && atk1[sq-8] < ctlP)
- {
- s += BACKWARD[a2 & 0xFF];
- if (PC2[fyle] == 0) s += PWEAKH;
- if (color[sq-8] != neutral) s += PBLOK;
- }
- if (PC2[fyle] == 0)
- {
- if (side == white) r = rank+1; else r = rank;
- in_square = (row[wking] <= r && distance(sq,wking) < r+1);
- if (a2 == 0 || side == black) e = 0; else e = 1;
- for (j = sq-8; j >= 0; j -= 8)
- if (atk2[j] >= ctlP) { e = 2; break; }
- else if (atk2[j] > 0 || color[j] != neutral) e = 1;
- if (e == 2) s += (stage*PassedPawn3[7-rank]) / 10;
- else if (in_square || e == 1) s += (stage*PassedPawn2[7-rank]) / 10;
- else if (emtl[white] > 0) s += (stage*PassedPawn1[7-rank]) / 10;
- else s += PassedPawn0[7-rank];
- }
- }
- else if (piece == knight)
- {
- s = Mknight[c1][sq];
- }
- else if (piece == bishop)
- {
- s = Mbishop[c1][sq];
- BRscan(sq,&s,&mob);
- s += BMBLTY[mob];
- }
- else if (piece == rook)
- {
- s += RookBonus;
- BRscan(sq,&s,&mob);
- s += RMBLTY[mob];
- if (PC1[fyle] == 0) s += RHOPN;
- if (PC2[fyle] == 0) s += RHOPNX;
- if (rank == rank7[c1] && pmtl[c2] > 100) s += 10;
- if (stage > 2) s += 14 - taxicab(sq,EnemyKing);
- }
- else if (piece == queen)
- {
- if (stage > 2) s += 14 - taxicab(sq,EnemyKing);
- if (distance(sq,EnemyKing) < 3) s += 12;
- }
- else if (piece == king)
- {
- s = Mking[c1][sq];
- if (KSFTY > 0)
- if (Developed[c2] || stage > 0) KingScan(sq,&s);
- if (castld[c1]) s += KCASTLD;
- else if (kingmoved[c1]) s += KMOVD;
-
- if (PC1[fyle] == 0) s += KHOPN;
- if (PC2[fyle] == 0) s += KHOPNX;
- if (fyle == 1 || fyle == 2 || fyle == 3 || fyle == 7)
- {
- if (PC1[fyle-1] == 0) s += KHOPN;
- if (PC2[fyle-1] == 0) s += KHOPNX;
- }
- if (fyle == 4 || fyle == 5 || fyle == 6 || fyle == 0)
- {
- if (PC1[fyle+1] == 0) s += KHOPN;
- if (PC2[fyle+1] == 0) s += KHOPNX;
- }
- if (fyle == 2)
- {
- if (PC1[0] == 0) s += KHOPN;
- if (PC2[0] == 0) s += KHOPNX;
- }
- if (fyle == 5)
- {
- if (PC1[7] == 0) s += KHOPN;
- if (PC2[7] == 0) s += KHOPNX;
- }
- }
-
- if (a2 > 0)
- {
- c = (control[piece] & 0x4FFF);
- if (a1 == 0 || a2 > c+1)
- {
- s += HUNGP;
- ++hung[c1];
- if (piece != king && trapped(sq,piece)) ++hung[c1];
- }
- else if (piece != pawn || a2 > a1)
- if (a2 >= c || a1 < ctlP) s += ATAKD;
- }
- return(s);
-}
-
-#if (NEWMOVE > 6)
-KingScan(sq,s)
-short sq,*s;
-
-/*
- Assign penalties if king can be threatened by checks, if squares
- near the king are controlled by the enemy (especially the queen),
- or if there are no pawns near the king.
-*/
-
-#define ScoreThreat\
- if (color[u] != c2)\
- if (atk1[u] == 0 || (atk2[u] & 0xFF) > 1) ++cnt;\
- else *s -= 3
-
-{
-register short m,u;
-short d,i,m0,cnt,ok;
-
- cnt = 0;
- m0 = map[sq];
- if (HasBishop[c2] || HasQueen[c2])
- for (i = Dstart[bishop]; i <= Dstop[bishop]; i++)
- {
- d = Dir[i]; m = m0+d;
- while (!(m & 0x88))
- {
- u = unmap[m];
- if (atk2[u] & ctlBQ) ScoreThreat;
- if (color[u] != neutral) break;
- m += d;
- }
- }
- if (HasRook[c2] || HasQueen[c2])
- for (i = Dstart[rook]; i <= Dstop[rook]; i++)
- {
- d = Dir[i]; m = m0+d;
- while (!(m & 0x88))
- {
- u = unmap[m];
- if (atk2[u] & ctlRQ) ScoreThreat;
- if (color[u] != neutral) break;
- m += d;
- }
- }
- if (HasKnight[c2])
- for (i = Dstart[knight]; i <= Dstop[knight]; i++)
- if (!((m = m0+Dir[i]) & 0x88))
- {
- u = unmap[m];
- if (atk2[u] & ctlNN) ScoreThreat;
- }
- *s += (KSFTY*Kthreat[cnt]) / 16;
-
- cnt = 0; ok = false;
- m0 = map[sq];
- for (i = Dstart[king]; i <= Dstop[king]; i++)
- if (!((m = m0+Dir[i]) & 0x88))
- {
- u = unmap[m];
- if (board[u] == pawn) ok = true;
- if (atk2[u] > atk1[u])
- {
- ++cnt;
- if (atk2[u] & ctlQ)
- if (atk2[u] > ctlQ+1 && atk1[u] < ctlQ) *s -= 4*KSFTY;
- }
- }
- if (!ok) *s -= KSFTY;
- if (cnt > 1) *s -= KSFTY;
-}
-#endif
-
-#if (NEWMOVE < 4)
-BRscan(sq,s,mob)
-short sq,*s,*mob;
-
-/*
- Find Bishop and Rook mobility, XRAY attacks, and pins. Increment the
- hung[] array if a pin is found.
-*/
-
-{
-register short m,u;
-short d,j,m0,piece,pin,*Kf;
-
- Kf = Kfield[c1];
- *mob = 0;
- m0 = map[sq]; piece = board[sq];
- for (j = Dstart[piece]; j <= Dstop[piece]; j++)
- {
- pin = -1;
- d = Dir[j]; m = m0+d;
- while (!(m & 0x88))
- {
- u = unmap[m]; *s += Kf[u];
- if (color[u] == neutral)
- {
- (*mob)++;
- m += d;
- }
- else if (pin < 0)
- {
- if (board[u] == pawn || board[u] == king) break;
- pin = u;
- m += d;
- }
- else if (color[u] == c2 && (board[u] > piece || atk2[u] == 0))
- {
- if (color[pin] == c2)
- {
- *s += PINVAL;
- if (atk2[pin] == 0 ||
- atk1[pin] > control[board[pin]]+1)
- ++hung[c2];
- }
- else *s += XRAY;
- break;
- }
- else break;
- }
- }
-}
-#endif
-
-#if (NEWMOVE > 5)
-int trapped(sq,piece)
-short sq,piece;
-
-/*
- See if the attacked piece has unattacked squares to move to.
-*/
-
-{
-register short u,m,d;
-short i,m0;
-
- m0 = map[sq];
- if (sweep[piece])
- for (i = Dstart[piece]; i <= Dstop[piece]; i++)
- {
- d = Dir[i]; m = m0+d;
- while (!(m & 0x88))
- {
- u = unmap[m];
- if (color[u] == c1) break;
- if (atk2[u] == 0 || board[u] >= piece) return(false);
- if (color[u] == c2) break;
- m += d;
- }
- }
- else if (piece == pawn)
- {
- if (c1 == white) u = sq+8; else u = sq-8;
- if (color[u] == neutral && atk1[u] >= atk2[u])
- return(false);
- if (!((m = m0+Dir[Dpwn[c1]]) & 0x88))
- if (color[unmap[m]] == c2) return(false);
- if (!((m = m0+Dir[Dpwn[c1]+1]) & 0x88))
- if (color[unmap[m]] == c2) return(false);
- }
- else
- {
- for (i = Dstart[piece]; i <= Dstop[piece]; i++)
- if (!((m = m0+Dir[i]) & 0x88))
- {
- u = unmap[m];
- if (color[u] != c1)
- if (atk2[u] == 0 || board[u] >= piece) return(false);
- }
- }
- return(true);
-}
-#endif
-
-ExaminePosition()
-
-/*
- This is done one time before the search is started. Set up arrays
- Mwpawn, Mbpawn, Mknight, Mbishop, Mking which are used in the
- SqValue() function to determine the positional value of each piece.
-*/
-
-{
-register short i,sq;
-short wpadv,bpadv,wstrong,bstrong,z,side,pp,j,val,Pd,fyle,rank;
-
- wking = PieceList[white][0]; bking = PieceList[black][0];
- ataks(white,atak[white]); ataks(black,atak[black]);
- Zwmtl = Zbmtl = 0;
- UpdateWeights();
- HasPawn[white] = HasPawn[black] = 0;
- HasKnight[white] = HasKnight[black] = 0;
- HasBishop[white] = HasBishop[black] = 0;
- HasRook[white] = HasRook[black] = 0;
- HasQueen[white] = HasQueen[black] = 0;
- for (side = white; side <= black; side++)
- for (i = 0; i <= PieceCnt[side]; i++)
- switch (board[PieceList[side][i]])
- {
- case pawn : ++HasPawn[side]; break;
- case knight : ++HasKnight[side]; break;
- case bishop : ++HasBishop[side]; break;
- case rook : ++HasRook[side]; break;
- case queen : ++HasQueen[side]; break;
- }
- if (!Developed[white])
- Developed[white] = (board[1] != knight && board[2] != bishop &&
- board[5] != bishop && board[6] != knight);
- if (!Developed[black])
- Developed[black] = (board[57] != knight && board[58] != bishop &&
- board[61] != bishop && board[62] != knight);
- if (!PawnStorm && stage < 5)
- PawnStorm = ((column[wking] < 3 && column[bking] > 4) ||
- (column[wking] > 4 && column[bking] < 3));
-
- CopyBoard(pknight,Mknight[white]);
- CopyBoard(pknight,Mknight[black]);
- CopyBoard(pbishop,Mbishop[white]);
- CopyBoard(pbishop,Mbishop[black]);
- BlendBoard(KingOpening,KingEnding,Mking[white]);
- BlendBoard(KingOpening,KingEnding,Mking[black]);
-
- for (sq = 0; sq < 64; sq++)
- {
- fyle = column[sq]; rank = row[sq];
- wstrong = bstrong = true;
- for (i = sq; i < 64; i += 8)
- if (atak[black][i] >= ctlP) wstrong = false;
- for (i = sq; i >= 0; i -= 8)
- if (atak[white][i] >= ctlP) bstrong = false;
- wpadv = bpadv = PADVNCM;
- if ((fyle == 0 || PawnCnt[white][fyle-1] == 0) &&
- (fyle == 7 || PawnCnt[white][fyle+1] == 0)) wpadv = PADVNCI;
- if ((fyle == 0 || PawnCnt[black][fyle-1] == 0) &&
- (fyle == 7 || PawnCnt[black][fyle+1] == 0)) bpadv = PADVNCI;
- Mwpawn[sq] = (wpadv*PawnAdvance[sq]) / 10;
- Mbpawn[sq] = (bpadv*PawnAdvance[63-sq]) / 10;
- Mwpawn[sq] += PawnBonus; Mbpawn[sq] += PawnBonus;
- if (castld[white] || kingmoved[white])
- {
- if ((fyle < 3 || fyle > 4) && distance(sq,wking) < 3)
- Mwpawn[sq] += PAWNSHIELD;
- }
- else if (rank < 3 && (fyle < 2 || fyle > 5))
- Mwpawn[sq] += PAWNSHIELD / 2;
- if (castld[black] || kingmoved[black])
- {
- if ((fyle < 3 || fyle > 4) && distance(sq,bking) < 3)
- Mbpawn[sq] += PAWNSHIELD;
- }
- else if (rank > 4 && (fyle < 2 || fyle > 5))
- Mbpawn[sq] += PAWNSHIELD / 2;
- if (PawnStorm)
- {
- if ((column[wking] < 4 && fyle > 4) ||
- (column[wking] > 3 && fyle < 3)) Mwpawn[sq] += 3*rank - 21;
- if ((column[bking] < 4 && fyle > 4) ||
- (column[bking] > 3 && fyle < 3)) Mbpawn[sq] -= 3*rank;
- }
-
- Mknight[white][sq] += 5 - distance(sq,bking);
- Mknight[white][sq] += 5 - distance(sq,wking);
- Mknight[black][sq] += 5 - distance(sq,wking);
- Mknight[black][sq] += 5 - distance(sq,bking);
- Mbishop[white][sq] += BishopBonus;
- Mbishop[black][sq] += BishopBonus;
- for (i = 0; i <= PieceCnt[black]; i++)
- if (distance(sq,PieceList[black][i]) < 3)
- Mknight[white][sq] += KNIGHTPOST;
- for (i = 0; i <= PieceCnt[white]; i++)
- if (distance(sq,PieceList[white][i]) < 3)
- Mknight[black][sq] += KNIGHTPOST;
- if (wstrong) Mknight[white][sq] += KNIGHTSTRONG;
- if (bstrong) Mknight[black][sq] += KNIGHTSTRONG;
- if (wstrong) Mbishop[white][sq] += BISHOPSTRONG;
- if (bstrong) Mbishop[black][sq] += BISHOPSTRONG;
-
- if (HasBishop[white] == 2) Mbishop[white][sq] += 8;
- if (HasBishop[black] == 2) Mbishop[black][sq] += 8;
- if (HasKnight[white] == 2) Mknight[white][sq] += 5;
- if (HasKnight[black] == 2) Mknight[black][sq] += 5;
-
- if (board[sq] == bishop)
- if (rank % 2 == fyle % 2) KBNKsq = 0; else KBNKsq = 7;
-
- Kfield[white][sq] = Kfield[black][sq] = 0;
- if (distance(sq,wking) == 1) Kfield[black][sq] = KATAK;
- if (distance(sq,bking) == 1) Kfield[white][sq] = KATAK;
-
- Pd = 0;
- for (i = 0; i < 64; i++)
- if (board[i] == pawn)
- {
- if (color[i] == white)
- {
- pp = true;
- if (row[i] == 6) z = i+8; else z = i+16;
- for (j = i+8; j < 64; j += 8)
- if (atak[black][j] > ctlP || board[j] == pawn) pp = false;
- }
- else
- {
- pp = true;
- if (row[i] == 1) z = i-8; else z = i-16;
- for (j = i-8; j >= 0; j -= 8)
- if (atak[white][j] > ctlP || board[j] == pawn) pp = false;
- }
- if (pp) Pd += 5*taxicab(sq,z); else Pd += taxicab(sq,z);
- }
- if (Pd != 0)
- {
- val = (Pd*stage2) / 10;
- Mking[white][sq] -= val;
- Mking[black][sq] -= val;
- }
- }
-}
-
-
-UpdateWeights()
-
-/*
- If material balance has changed, determine the values for the
- positional evaluation terms.
-*/
-
-{
-short tmtl;
-
- if (mtl[white] != Zwmtl || mtl[black] != Zbmtl)
- {
- Zwmtl = mtl[white]; Zbmtl = mtl[black];
- emtl[white] = Zwmtl - pmtl[white] - valueK;
- emtl[black] = Zbmtl - pmtl[black] - valueK;
- tmtl = emtl[white] + emtl[black];
- if (tmtl > 6600) stage = 0;
- else if (tmtl < 1400) stage = 10;
- else stage = (6600-tmtl) / 520;
- if (tmtl > 3600) stage2 = 0;
- else if (tmtl < 1400) stage2 = 10;
- else stage2 = (3600-tmtl) / 220;
-
- PEDRNK2B = -15; /* centre pawn on 2nd rank & blocked */
- PBLOK = -4; /* blocked backward pawn */
- PDOUBLED = -14; /* doubled pawn */
- PWEAKH = -4; /* weak pawn on half open file */
- PAWNSHIELD = 10-stage; /* pawn near friendly king */
- PADVNCM = 10; /* advanced pawn multiplier */
- PADVNCI = 7; /* muliplier for isolated pawn */
- PawnBonus = stage;
-
- KNIGHTPOST = (stage+2)/3; /* knight near enemy pieces */
- KNIGHTSTRONG = (stage+6)/2; /* occupies pawn hole */
-
- BISHOPSTRONG = (stage+6)/2; /* occupies pawn hole */
- BishopBonus = 2*stage;
-
- RHOPN = 10; /* rook on half open file */
- RHOPNX = 4;
- RookBonus = 6*stage;
-
- XRAY = 8; /* Xray attack on piece */
- PINVAL = 10; /* Pin */
-
- KHOPN = (3*stage-30) / 2; /* king on half open file */
- KHOPNX = KHOPN / 2;
- KCASTLD = 10 - stage;
- KMOVD = -40 / (stage+1); /* king moved before castling */
- KATAK = (10-stage) / 2; /* B,R attacks near enemy king */
- if (stage < 8) KSFTY = 16-2*stage; else KSFTY = 0;
-
- ATAKD = -6; /* defender > attacker */
- HUNGP = -8; /* each hung piece */
- HUNGX = -12; /* extra for >1 hung piece */
- }
-}
-
-#if (NEWMOVE < 1)
-int distance(a,b)
-short a,b;
-{
-register short d1,d2;
-
- d1 = abs(column[a]-column[b]);
- d2 = abs(row[a]-row[b]);
- return(d1 > d2 ? d1 : d2);
-}
-#endif
-
-BlendBoard(a,b,c)
-short a[64],b[64],c[64];
-{
-register int sq;
- for (sq = 0; sq < 64; sq++)
- c[sq] = (a[sq]*(10-stage) + b[sq]*stage) / 10;
-}
-
-
-CopyBoard(a,b)
-short a[64],b[64];
-{
-register int sq;
- for (sq = 0; sq < 64; sq++)
- b[sq] = a[sq];
-}
diff --git a/gnu/games/chess/gnuchess.h b/gnu/games/chess/gnuchess.h
deleted file mode 100644
index ee6442e..0000000
--- a/gnu/games/chess/gnuchess.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- This file contains code for CHESS.
- Copyright (C) 1986, 1987, 1988 Free Software Foundation, Inc.
-
- This file is part of CHESS.
-
- CHESS is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY. No author or distributor
- accepts responsibility to anyone for the consequences of using it
- or for whether it serves any particular purpose or works at all,
- unless he says so in writing. Refer to the CHESS General Public
- License for full details.
-
- Everyone is granted permission to copy, modify and redistribute
- CHESS, but only under the conditions described in the
- CHESS General Public License. A copy of this license is
- supposed to have been given to you along with CHESS so you
- can know your rights and responsibilities. It should be in a
- file named COPYING. Among other things, the copyright notice
- and this notice must be preserved on all copies.
-*/
-
-
-/* Header file for GNU CHESS */
-
-#define neutral 2
-#define white 0
-#define black 1
-#define no_piece 0
-#define pawn 1
-#define knight 2
-#define bishop 3
-#define rook 4
-#define queen 5
-#define king 6
-#define pxx " PNBRQK"
-#define qxx " pnbrqk"
-#define rxx "12345678"
-#define cxx "abcdefgh"
-#define check 0x0001
-#define capture 0x0002
-#define draw 0x0004
-#define promote 0x0008
-#define cstlmask 0x0010
-#define epmask 0x0020
-#define exact 0x0040
-#define pwnthrt 0x0080
-#define maxdepth 30
-#define true 1
-#define false 0
-
-struct leaf
- {
- short f,t,score,reply;
- unsigned short flags;
- };
-struct GameRec
- {
- unsigned short gmove;
- short score,depth,time,piece,color;
- long nodes;
- };
-struct TimeControlRec
- {
- short moves[2];
- long clock[2];
- };
-struct BookEntry
- {
- struct BookEntry *next;
- unsigned short *mv;
- };
-
-extern char mvstr1[5],mvstr2[5];
-extern struct leaf Tree[2000],*root;
-extern short TrPnt[maxdepth],board[64],color[64];
-extern short row[64],column[64],locn[8][8];
-extern short atak[2][64],PawnCnt[2][8];
-extern short castld[2],kingmoved[2];
-extern short c1,c2,*atk1,*atk2,*PC1,*PC2;
-extern short mate,post,opponent,computer,Sdepth,Awindow,Bwindow,dither;
-extern long ResponseTime,ExtraTime,Level,et,et0,time0,cputimer,ft;
-extern long NodeCnt,evrate,ETnodes,EvalNodes,HashCnt;
-extern short quit,reverse,bothsides,hashflag,InChk,player,force,easy,beep,meter;
-extern short timeout,xwndw;
-extern struct GameRec GameList[240];
-extern short GameCnt,Game50,epsquare,lpost,rcptr,contempt;
-extern short MaxSearchDepth;
-extern struct BookEntry *Book;
-extern struct TimeControlRec TimeControl;
-extern short TCflag,TCmoves,TCminutes,OperatorTime;
-extern short otherside[3];
-extern short Stboard[64];
-extern short Stcolor[64];
-extern unsigned short hint,PrVar[maxdepth];
-
-#define HZ 60
diff --git a/gnu/games/chess/move.c b/gnu/games/chess/move.c
deleted file mode 100644
index b4b0d42..0000000
--- a/gnu/games/chess/move.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/* move generator hes@log-sv.se 890318
- Modified: 890606 NEWMOVE Levels 1-6 for easier debugging */
-#include "move.h"
-#include "gnuchess.h"
-
-short distdata[64][64];
-short taxidata[64][64];
-
-void Initialize_dist() {
-register short a,b,d,di;
-
- /* init taxi and dist data */
- for(a=0;a<64;a++)
- for(b=0;b<64;b++) {
- d = abs(column[a]-column[b]);
- di = abs(row[a]-row[b]);
- taxidata[a][b] = d + di;
- distdata[a][b] = (d > di ? d : di);
- };
-}
-
-#if (NEWMOVE > 1)
-struct sqdata posdata[3][8][64][64];
-
-static short direc[8][8] = {
- 0, 0, 0, 0, 0, 0, 0, 0, /* no_piece = 0 */
- -10,-11, -9, 0, 0, 0, 0, 0, /* wpawn = 1 */
- -21,-19,-12, -8, 21, 19, 12, 8, /* knight = 2 */
- -11, -9, 11, 9, 0, 0, 0, 0, /* bishop = 3 */
- -10, -1, 10, 1, 0, 0, 0, 0, /* rook = 4 */
- -11, -9,-10, -1, 11, 9, 10, 1, /* queen = 5 */
- -11, -9,-10, -1, 11, 9, 10, 1, /* king = 6 */
- 0, 0, 0, 0, 0, 0, 0, 0};/* no_piece = 7 */
-
-static short dc[3] = {-1,1,0};
-
-static short max_steps [8] = {0,2,1,7,7,7,1,0};
-
-static short unmap[120] = {
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1, 0, 1, 2, 3, 4, 5, 6, 7,-1,
- -1, 8, 9,10,11,12,13,14,15,-1,
- -1,16,17,18,19,20,21,22,23,-1,
- -1,24,25,26,27,28,29,30,31,-1,
- -1,32,33,34,35,36,37,38,39,-1,
- -1,40,41,42,43,44,45,46,47,-1,
- -1,48,49,50,51,52,53,54,55,-1,
- -1,56,57,58,59,60,61,62,63,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
-
-void Initialize_moves() {
- short c,ptyp,po,p0,d,di,s;
- struct sqdata *p;
- short dest[8][8];
- short steps[8];
- short sorted[8];
-
- /* init posdata */
- for(c=0;c<3;c++)
- for(ptyp=0;ptyp<8;ptyp++)
- for(po=0;po<64;po++)
- for(p0=0;p0<64;p0++) {
- posdata[c][ptyp][po][p0].nextpos = po;
- posdata[c][ptyp][po][p0].nextdir = po;
- };
- /* dest is a function of dir and step */
- for(c=0;c<2;c++)
- for(ptyp=1;ptyp<7;ptyp++)
- for(po=21;po<99;po++)
- if (unmap[po] >= 0) {
- p = posdata[c][ptyp][unmap[po]];
- for(d=0;d<8;d++) {
- dest[d][0] = unmap[po];
- if (dc[c]*direc[ptyp][d] != 0) {
- p0=po;
- for(s=0;s<max_steps[ptyp];s++) {
- p0 = p0 + dc[c]*direc[ptyp][d];
- /* break if (off board) or
- (pawns move two steps from home square) */
- if (unmap[p0] < 0 ||
- (ptyp == pawn && s>0 && (d>0 || Stboard[unmap[po]] != ptyp)))
- break;
- else
- dest[d][s] = unmap[p0];
- }
- }
- else s=0;
- /* sort dest in number of steps order */
- steps[d] = s;
- for(di=d;di>0;di--)
- if (steps[sorted[di-1]] < s)
- sorted[di] = sorted[di-1];
- else
- break;
- sorted[di] = d;
- }
- /* update posdata, pawns have two threads (capture and no capture) */
- p0=unmap[po];
- if (ptyp == pawn) {
- for(s=0;s<steps[0];s++) {
- p[p0].nextpos = dest[0][s];
- p0 = dest[0][s];
- }
- p0=unmap[po];
- for(d=1;d<3;d++) {
- p[p0].nextdir = dest[d][0];
- p0 = dest[d][0];
- }
- }
- else {
- p[p0].nextdir = dest[sorted[0]][0];
- for(d=0;d<8;d++)
- for(s=0;s<steps[sorted[d]];s++) {
- p[p0].nextpos = dest[sorted[d]][s];
- p0 = dest[sorted[d]][s];
- if (d < 7)
- p[p0].nextdir = dest[sorted[d+1]][0];
- /* else is already initialised */
- }
- }
-#ifdef DEBUG
- printf("Ptyp:%d Position:%d\n{",ptyp,unmap[po]);
- for(p0=0;p0<63;p0++) printf("%d,",p[p0].nextpos);
- printf("%d};\n",p[63].nextpos);
- for(p0=0;p0<63;p0++) printf("%d,",p[p0].nextdir);
- printf("%d};\n",p[63].nextdir);
-#endif DEBUG
- }
-}
-#endif
-
-
-#if (NEWMOVE > 2)
-int SqAtakd(sq,side)
-short sq,side;
-
-/*
- See if any piece with color 'side' ataks sq. First check pawns
- Then Queen, Bishop, Rook and King and last Knight.
-*/
-
-{
- register short u;
- register struct sqdata *p;
-
- p = posdata[1-side][pawn][sq];
- u = p[sq].nextdir; /* follow captures thread */
- while (u != sq) {
- if (board[u] == pawn && color[u] == side) return(true);
- u = p[u].nextdir;
- }
- /* king capture */
- if (distance(sq,PieceList[side][0]) == 1) return(true);
- /* try a queen bishop capture */
- p = posdata[side][bishop][sq];
- u = p[sq].nextpos;
- while (u != sq) {
- if (color[u] == neutral) {
- u = p[u].nextpos;
- }
- else {
- if (color[u] == side &&
- (board[u] == queen || board[u] == bishop))
- return(true);
- u = p[u].nextdir;
- }
- }
- /* try a queen rook capture */
- p = posdata[side][rook][sq];
- u = p[sq].nextpos;
- while (u != sq) {
- if (color[u] == neutral) {
- u = p[u].nextpos;
- }
- else {
- if (color[u] == side &&
- (board[u] == queen || board[u] == rook))
- return(true);
- u = p[u].nextdir;
- }
- }
- /* try a knight capture */
- p = posdata[side][knight][sq];
- u = p[sq].nextpos;
- while (u != sq) {
- if (color[u] == neutral) {
- u = p[u].nextpos;
- }
- else {
- if (color[u] == side && board[u] == knight) return(true);
- u = p[u].nextdir;
- }
- }
- return(false);
-}
-#endif
-
-#if (NEWMOVE > 3)
-BRscan(sq,s,mob)
-short sq,*s,*mob;
-/*
- Find Bishop and Rook mobility, XRAY attacks, and pins. Increment the
- hung[] array if a pin is found.
-*/
-{
- register short u,piece,pin;
- register struct sqdata *p;
- short *Kf;
-
- Kf = Kfield[c1];
- *mob = 0;
- piece = board[sq];
- p = posdata[color[sq]][piece][sq];
- u = p[sq].nextpos;
- pin = -1; /* start new direction */
- while (u != sq) {
- *s += Kf[u];
- if (color[u] == neutral) {
- (*mob)++;
- if (p[u].nextpos == p[u].nextdir) pin = -1; /* oops new direction */
- u = p[u].nextpos;
- }
- else if (pin < 0) {
- if (board[u] == pawn || board[u] == king)
- u = p[u].nextdir;
- else {
- if (p[u].nextpos != p[u].nextdir)
- pin = u; /* not on the edge and on to find a pin */
- u = p[u].nextpos;
- }
- }
- else if (color[u] == c2 && (board[u] > piece || atk2[u] == 0))
- {
- if (color[pin] == c2)
- {
- *s += PINVAL;
- if (atk2[pin] == 0 ||
- atk1[pin] > control[board[pin]]+1)
- ++hung[c2];
- }
- else *s += XRAY;
- pin = -1; /* new direction */
- u = p[u].nextdir;
- }
- else {
- pin = -1; /* new direction */
- u = p[u].nextdir;
- }
- }
-}
-#endif
-
-#if (NEWMOVE >= 5)
-CaptureList(side,xside,ply)
-short side,xside,ply;
-{
- register short u,sq;
- register struct sqdata *p;
- short i,piece,*PL;
- struct leaf *node;
-
- TrPnt[ply+1] = TrPnt[ply];
- node = &Tree[TrPnt[ply]];
- PL = PieceList[side];
- for (i = 0; i <= PieceCnt[side]; i++)
- {
- sq = PL[i];
- piece = board[sq];
- p = posdata[side][piece][sq];
- if (piece == pawn) {
- u = p[sq].nextdir; /* follow captures thread */
- while (u != sq) {
- if (color[u] == xside) {
- node->f = sq; node->t = u;
- node->flags = capture;
- if (u < 8 || u > 55)
- {
- node->flags |= promote;
- node->score = valueQ;
- }
- else
- node->score = value[board[u]] + svalue[board[u]] - piece;
- ++node;
- ++TrPnt[ply+1];
- }
- u = p[u].nextdir;
- }
- }
- else {
- u = p[sq].nextpos;
- while (u != sq) {
- if (color[u] == neutral)
- u = p[u].nextpos;
- else {
- if (color[u] == xside) {
- node->f = sq; node->t = u;
- node->flags = capture;
- node->score = value[board[u]] + svalue[board[u]] - piece;
- ++node;
- ++TrPnt[ply+1];
- }
- u = p[u].nextdir;
- }
- }
- }
- }
-}
-#endif
-
-#if (NEWMOVE > 5)
-GenMoves(ply,sq,side,xside)
- short ply,sq,side,xside;
-
-/*
- Generate moves for a piece. The moves are taken from the
- precalulated array posdata. If the board is free, next move
- is choosen from nextpos else from nextdir.
-*/
-
-{
- register short u,piece;
- register struct sqdata *p;
-
- piece = board[sq];
- p = posdata[side][piece][sq];
- if (piece == pawn) {
- u = p[sq].nextdir; /* follow captures thread */
- while (u != sq) {
- if (color[u] == xside) LinkMove(ply,sq,u,xside);
- u = p[u].nextdir;
- }
- u = p[sq].nextpos; /* and follow no captures thread */
- while (u != sq) {
- if (color[u] == neutral && (u != sq+16 || color[u-8] == neutral)
- && (u != sq-16 || color[u+8] == neutral)) {
- LinkMove(ply,sq,u,xside);
- }
- u = p[u].nextpos;
- }
- }
- else {
- u = p[sq].nextpos;
- while (u != sq) {
- if (color[u] == neutral) {
- LinkMove(ply,sq,u,xside);
- u = p[u].nextpos;
- }
- else {
- if (color[u] == xside) LinkMove(ply,sq,u,xside);
- u = p[u].nextdir;
- }
- }
- }
-}
-#endif
diff --git a/gnu/games/chess/move.h b/gnu/games/chess/move.h
deleted file mode 100644
index 3294e4a..0000000
--- a/gnu/games/chess/move.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* header file for move generator hes 890318
- Modified: 890510 minor bug fixed in Newataks
- 890606 NEWMOVE levels 1-6 */
-
-#if (NEWMOVE >= 1)
-extern short distdata[64][64];
-extern short taxidata[64][64];
-
-#define taxicab(a,b) taxidata[a][b]
-#define distance(a,b) distdata[a][b]
-
-extern void Initialize_dist();
-#endif
-
-#if (NEWMOVE >= 2)
-struct sqdata {
- short nextpos;
- short nextdir;
-};
-extern struct sqdata posdata[3][8][64][64];
-
-extern void Initialize_moves();
-
-#define ataks(side,a)\
-{\
- register short u,c,sq;\
- register struct sqdata *p;\
- short i,piece,*PL;\
- \
- for (u = 64; u; a[--u] = 0); \
- PL = PieceList[side];\
- for (i = 0; i <= PieceCnt[side]; i++)\
- {\
- sq = PL[i];\
- piece = board[sq];\
- c = control[piece];\
- p = posdata[side][piece][sq];\
- if (piece == pawn) {\
- u = p[sq].nextdir; /* follow captures thread */\
- while (u != sq) {\
- a[u] = ++a[u] | c;\
- u = p[u].nextdir;\
- }\
- }\
- else {\
- u = p[sq].nextpos;\
- while (u != sq) {\
- a[u] = ++a[u] | c;\
- if (color[u] == neutral)\
- u = p[u].nextpos;\
- else\
- u = p[u].nextdir;\
- }\
- }\
- }\
-}
-#endif
-
-#if (NEWMOVE >= 3)
-extern short PieceList[2][16];
-
-extern int Sqatakd();
-#endif
-
-#if (NEWMOVE > 3)
-extern short Kfield[2][64],PINVAL,control[7],hung[2],XRAY;
-
-extern BRscan();
-#endif
-
-#if (NEWMOVE > 4)
-#define valueQ 1100
-
-extern short PieceCnt[2],value[7],svalue[64];
-
-extern CaptureList();
-#endif
-
-#if (NEWMOVE > 5)
-extern GenMoves();
-#endif
diff --git a/gnu/games/chess/nondsp.c b/gnu/games/chess/nondsp.c
deleted file mode 100644
index bec36d3..0000000
--- a/gnu/games/chess/nondsp.c
+++ /dev/null
@@ -1,791 +0,0 @@
-/*
- UNIX & MSDOS NON-DISPLAY, AND CHESSTOOL interface for Chess
-
- Revision: 4-25-88
-
- Copyright (C) 1986, 1987, 1988 Free Software Foundation, Inc.
- Copyright (c) 1988 John Stanback
-
- This file is part of CHESS.
-
- CHESS is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY. No author or distributor
- accepts responsibility to anyone for the consequences of using it
- or for whether it serves any particular purpose or works at all,
- unless he says so in writing. Refer to the CHESS General Public
- License for full details.
-
- Everyone is granted permission to copy, modify and redistribute
- CHESS, but only under the conditions described in the
- CHESS General Public License. A copy of this license is
- supposed to have been given to you along with CHESS so you
- can know your rights and responsibilities. It should be in a
- file named COPYING. Among other things, the copyright notice
- and this notice must be preserved on all copies.
-*/
-
-
-#include <stdio.h>
-#include <ctype.h>
-#ifdef MSDOS
-#include <dos.h>
-#include <stdlib.h>
-#include <time.h>
-#else
-#include <sys/param.h>
-#include <sys/times.h>
-#include <sys/file.h>
-struct tms tmbuf1,tmbuf2;
-int TerminateSearch(),Die();
-#endif MSDOS
-
-#include "gnuchess.h"
-#ifdef NEWMOVE
-#include "move.h"
-#endif
-
-#define printz printf
-#define scanz scanf
-int mycnt1,mycnt2;
-
-
-Initialize()
-{
- mycnt1 = mycnt2 = 0;
-#ifndef MSDOS
-#endif
-#ifdef CHESSTOOL
- setlinebuf(stdout);
-/*
- setvbuf(stdout,NULL,_IOLBF,BUFSIZ);
-*/
- printf("Chess\n");
- if (Level == 0 && !TCflag) Level = 15;
-#endif CHESSTOOL
-}
-
-ExitChess()
-{
- ListGame();
- exit(0);
-}
-
-#ifndef MSDOS
-Die()
-{
-char s[80];
- printz("Abort? ");
- scanz("%s",s);
- if (strcmp(s,"yes") == 0) ExitChess();
-}
-
-TerminateSearch()
-{
- timeout = true;
- bothsides = false;
-}
-#endif MSDOS
-
-
-InputCommand()
-
-/*
- Process the users command. If easy mode is OFF (the computer is
- thinking on opponents time) and the program is out of book, then make
- the 'hint' move on the board and call SelectMove() to find a response.
- The user terminates the search by entering ^C (quit siqnal) before
- entering a command. If the opponent does not make the hint move, then
- set Sdepth to zero.
-*/
-
-{
-int i;
-short ok,tmp;
-long cnt,rate,t1,t2;
-unsigned short mv;
-char s[80];
-
- ok = quit = false;
- player = opponent;
- ft = 0;
- if (hint > 0 && !easy && Book == NULL)
- {
- fflush(stdout);
- time0 = time((long *)0);
- algbr(hint>>8,hint & 0xFF,false);
- strcpy(s,mvstr1);
- tmp = epsquare;
- if (VerifyMove(s,1,&mv))
- {
- SelectMove(computer,2);
- VerifyMove(mvstr1,2,&mv);
- if (Sdepth > 0) Sdepth--;
- }
- ft = time((long *)0) - time0;
- epsquare = tmp;
- }
-
-#ifndef MSDOS
-#endif
- while (!(ok || quit))
- {
- PromptForMove();
- i = scanz("%s",s);
- if (i == EOF || s[0] == 0) ExitChess();
- player = opponent;
- ok = VerifyMove(s,0,&mv);
- if (ok && mv != hint)
- {
- Sdepth = 0;
- ft = 0;
- }
-
- if (strcmp(s,"bd") == 0)
- {
- ClrScreen();
- UpdateDisplay(0,0,1,0);
- }
- if (strcmp(s,"quit") == 0) quit = true;
- if (strcmp(s,"post") == 0) post = !post;
- if (strcmp(s,"set") == 0) EditBoard();
- if (strcmp(s,"go") == 0) ok = true;
- if (strcmp(s,"help") == 0) help();
- if (strcmp(s,"force") == 0) force = !force;
- if (strcmp(s,"book") == 0) Book = NULL;
- if (strcmp(s,"new") == 0) NewGame();
- if (strcmp(s,"list") == 0) ListGame();
- if (strcmp(s,"level") == 0) SelectLevel();
- if (strcmp(s,"hash") == 0) hashflag = !hashflag;
- if (strcmp(s,"beep") == 0) beep = !beep;
- if (strcmp(s,"Awindow") == 0) ChangeAlphaWindow();
- if (strcmp(s,"Bwindow") == 0) ChangeBetaWindow();
- if (strcmp(s,"rcptr") == 0) rcptr = !rcptr;
- if (strcmp(s,"hint") == 0) GiveHint();
- if (strcmp(s,"zero") == 0) ZeroTTable();
- if (strcmp(s,"both") == 0)
- {
- bothsides = !bothsides;
- Sdepth = 0;
- SelectMove(opponent,1);
- ok = true;
- }
- if (strcmp(s,"reverse") == 0)
- {
- reverse = !reverse;
- ClrScreen();
- UpdateDisplay(0,0,1,0);
- }
- if (strcmp(s,"switch") == 0)
- {
- computer = otherside[computer];
- opponent = otherside[opponent];
- force = false;
- Sdepth = 0;
- ok = true;
- }
- if (strcmp(s,"white") == 0)
- {
- computer = white; opponent = black;
- ok = true; force = false;
- Sdepth = 0;
- }
- if (strcmp(s,"black") == 0)
- {
- computer = black; opponent = white;
- ok = true; force = false;
- Sdepth = 0;
- }
- if (strcmp(s,"undo") == 0 && GameCnt >= 0) Undo();
- if (strcmp(s,"remove") == 0 && GameCnt >= 1)
- {
- Undo(); Undo();
- }
- if (strcmp(s,"get") == 0) GetGame();
- if (strcmp(s,"save") == 0) SaveGame();
- if (strcmp(s,"depth") == 0) ChangeSearchDepth();
- if (strcmp(s,"random") == 0) dither = 6;
- if (strcmp(s,"easy") == 0) easy = !easy;
- if (strcmp(s,"contempt") == 0) SetContempt();
- if (strcmp(s,"xwndw") == 0) ChangeXwindow();
- if (strcmp(s,"test") == 0)
- {
- t1 = time(0);
- cnt = 0;
- for (i = 0; i < 10000; i++)
- {
- MoveList(opponent,2);
- cnt += TrPnt[3] - TrPnt[2];
- }
- t2 = time(0);
- rate = cnt / (t2-t1);
- printz("cnt= %ld rate= %ld\n",cnt,rate);
- }
- }
-
- ElapsedTime(1);
- if (force)
- {
- computer = opponent; opponent = otherside[computer];
- }
-#ifndef MSDOS
- (void) times(&tmbuf1);
-#ifdef CHESSTOOL
- printf("%d. %s\n",++mycnt2,s);
-#endif CHESSTOOL
-#endif MSDOS
-}
-
-
-help()
-{
- ClrScreen();
- printz("CHESS command summary\n");
- printz("g1f3 move from g1 to f3\n");
- printz("nf3 move knight to f3\n");
- printz("o-o castle king side\n");
- printz("o-o-o castle queen side\n");
- printz("set edit board\n");
- printz("switch sides with computer\n");
- printz("white computer plays white\n");
- printz("black computer plays black\n");
- printz("reverse board display\n");
- printz("both computer match\n");
- printz("random randomize play\n");
- printz("undo undo last move\n");
- printz("time change level\n");
- printz("depth set search depth\n");
- printz("post principle variation\n");
- printz("hint suggest a move\n");
- printz("bd redraw board\n");
- printz("clock set time control\n");
- printz("force enter game moves\n");
- printz("list game to chess.lst\n");
- printz("save game to file\n");
- printz("get game from file\n");
- printz("new start new game\n");
- printz("quit exit CHESS\n");
- printz("Computer: ");
- if (computer == white) printz("WHITE\n"); else printz("BLACK\n");
- printz("Opponent: ");
- if (opponent == white) printz("WHITE\n"); else printz("BLACK\n");
- printz("Response time: %ld",Level," sec.\n");
- printz("Easy mode: ");
- if (easy) printz("ON\n"); else printz("OFF\n");
- printz("Depth: %d\n",MaxSearchDepth);
- printz("Random: ");
- if (dither) printz("ON\n"); else printz("OFF\n");
- printz("Transposition table: ");
- if (hashflag) printz("ON\n"); else printz("OFF\n");
- UpdateDisplay(0,0,1,0);
-}
-
-
-EditBoard()
-
-/*
- Set up a board position. Pieces are entered by typing the piece
- followed by the location. For example, Nf3 will place a knight on
- square f3.
-*/
-
-{
-short a,r,c,sq;
-char s[80];
-
- ClrScreen();
- UpdateDisplay(0,0,1,0);
- printz(". exit to main\n");
- printz("# clear board\n");
- printz("enter piece & location: \n");
-
- a = white;
- do
- {
- scanz("%s",s);
- if (s[0] == '#')
- {
- for (sq = 0; sq < 64; sq++)
- {
- board[sq] = no_piece; color[sq] = neutral;
- }
- UpdateDisplay(0,0,1,0);
- }
- if (s[0] == 'c' || s[0] == 'C') a = otherside[a];
- c = s[1]-'a'; r = s[2]-'1';
- if ((c >= 0) && (c < 8) && (r >= 0) && (r < 8))
- {
- sq = locn[r][c];
- color[sq] = a;
- if (s[0] == 'p') board[sq] = pawn;
- else if (s[0] == 'n') board[sq] = knight;
- else if (s[0] == 'b') board[sq] = bishop;
- else if (s[0] == 'r') board[sq] = rook;
- else if (s[0] == 'q') board[sq] = queen;
- else if (s[0] == 'k') board[sq] = king;
- else { board[sq] = no_piece; color[sq] = neutral; }
- }
- }
- while (s[0] != '.');
- if (board[4] != king) kingmoved[white] = 10;
- if (board[60] != king) kingmoved[black] = 10;
- GameCnt = -1; Game50 = 0; Sdepth = 0;
- InitializeStats();
- ClrScreen();
- UpdateDisplay(0,0,1,0);
-}
-
-
-ShowDepth(ch)
-char ch;
-{
-}
-
-ShowResults(score,bstline,ch)
-short score;
-unsigned short bstline[];
-char ch;
-{
-#ifndef CHESSTOOL
-register int i;
- printz("%2d%c %5d %4ld %7ld ",Sdepth,ch,score,et,NodeCnt);
- for (i = 1; bstline[i] > 0; i++)
- {
- algbr((short)(bstline[i] >> 8),(short)(bstline[i] & 0xFF),false);
- if (i == 9 || i == 17) printz("\n ");
- printz("%5s ",mvstr1);
- }
- printz("\n");
-#endif
-}
-
-
-SearchStartStuff(side)
-short side;
-{
-#ifndef MSDOS
-#endif
-#ifndef CHESSTOOL
- printz("\nMove# %d Target= %ld Clock: %ld\n",
- TCmoves-TimeControl.moves[side]+1,
- ResponseTime,TimeControl.clock[side]);
-#endif
-}
-
-
-OutputMove()
-{
-#ifdef CHESSTOOL
- printz("%d. ... %s\n",++mycnt1,mvstr1);
- if (root->flags & draw)
- {
- printz("Draw\n");
- ListGame();
- exit(0);
- }
- if (root->score == -9999)
- {
- if (opponent == white) printz("White\n"); else printz("Black\n");
- ListGame();
- exit(0);
- }
- if (root->score == 9998)
- {
- if (computer == white) printz("White\n"); else printz("Black\n");
- ListGame();
- exit(0);
- }
-#else
- printz("Nodes= %ld Eval= %ld Hash= %ld Rate= %ld ",
- NodeCnt,EvalNodes,HashCnt,evrate);
- printz("CPU= %.2ld:%.2ld.%.2ld\n\n",
- cputimer/6000,(cputimer % 6000)/100,cputimer % 100);
-
- if (root->flags & epmask) UpdateDisplay(0,0,1,0);
- else UpdateDisplay(root->f,root->t,0,root->flags & cstlmask);
- printz("My move is: %s\n\n",mvstr1);
- if (beep) printz("%c",7);
-
- if (root->flags & draw) printz("Draw game!\n");
- else if (root->score == -9999) printz("opponent mates!\n");
- else if (root->score == 9998) printz("computer mates!\n");
- else if (root->score < -9000) printz("opponent will soon mate!\n");
- else if (root->score > 9000) printz("computer will soon mate!\n");
-#endif CHESSTOOL
-}
-
-
-ElapsedTime(iop)
-short iop;
-
-/*
- Determine the time that has passed since the search was started. If
- the elapsed time exceeds the target (ResponseTime+ExtraTime) then set
- timeout to true which will terminate the search.
-*/
-
-{
- et = time((long *)0) - time0;
- if (et < 0) et = 0;
- ETnodes += 50;
- if (et > et0 || iop == 1)
- {
- if (et > ResponseTime+ExtraTime && Sdepth > 1) timeout = true;
- et0 = et;
- if (iop == 1)
- {
- time0 = time((long *)0); et0 = 0;
- }
-#ifdef MSDOS
- cputimer = 100*et;
- if (et > 0) evrate = NodeCnt/(et+ft); else evrate = 0;
- if (kbhit() && Sdepth > 1)
- {
- timeout = true;
- bothsides = false;
- }
-#else
- (void) times(&tmbuf2);
- cputimer = 100*(tmbuf2.tms_utime - tmbuf1.tms_utime) / HZ;
- if (cputimer > 0) evrate = (100*NodeCnt)/(cputimer+100*ft);
- else evrate = 0;
-#endif MSDOS
- ETnodes = NodeCnt + 50;
- }
-}
-
-
-SetTimeControl()
-{
- if (TCflag)
- {
- TimeControl.moves[white] = TimeControl.moves[black] = TCmoves;
- TimeControl.clock[white] = TimeControl.clock[black] = 60*(long)TCminutes;
- }
- else
- {
- TimeControl.moves[white] = TimeControl.moves[black] = 0;
- TimeControl.clock[white] = TimeControl.clock[black] = 0;
- Level = 60*(long)TCminutes;
- }
- et = 0;
- ElapsedTime(1);
-}
-
-
-ClrScreen()
-{
-#ifndef CHESSTOOL
- printz("\n");
-#endif
-}
-
-
-UpdateDisplay(f,t,flag,iscastle)
-short f,t,flag,iscastle;
-{
-#ifndef CHESSTOOL
-short r,c,l;
- if (flag)
- {
- printz("\n");
- for (r = 7; r >= 0; r--)
- {
- for (c = 0; c <= 7; c++)
- {
- if (reverse) l = locn[7-r][7-c]; else l = locn[r][c];
- if (color[l] == neutral) printz(" -");
- else if (color[l] == white) printz(" %c",qxx[board[l]]);
- else printz(" %c",pxx[board[l]]);
- }
- printz("\n");
- }
- printz("\n");
- }
-#endif CHESSTOOL
-}
-
-
-GetOpenings()
-
-/*
- Read in the Opening Book file and parse the algebraic notation for a
- move into an unsigned integer format indicating the from and to
- square. Create a linked list of opening lines of play, with
- entry->next pointing to the next line and entry->move pointing to a
- chunk of memory containing the moves. More Opening lines of up to 256
- half moves may be added to gnuchess.book.
-*/
-
-{
-FILE *fd;
-int c,i,j,side;
-char buffr[2048];
-struct BookEntry *entry;
-unsigned short mv,*mp,tmp[100];
-
- if ((fd = fopen("gnuchess.book","r")) != NULL)
- {
-/*
- setvbuf(fd,buffr,_IOFBF,2048);
-*/
- Book = NULL;
- i = 0; side = white;
- while ((c = parse(fd,&mv,side)) >= 0)
- if (c == 1)
- {
- tmp[++i] = mv;
- side = otherside[side];
- }
- else if (c == 0 && i > 0)
- {
- entry = (struct BookEntry *)malloc(sizeof(struct BookEntry));
- mp = (unsigned short *)malloc((i+1)*sizeof(unsigned short));
- entry->mv = mp;
- entry->next = Book;
- Book = entry;
- for (j = 1; j <= i; j++) *(mp++) = tmp[j];
- *mp = 0;
- i = 0; side = white;
- }
- fclose(fd);
- }
-}
-
-
-int parse(fd,mv,side)
-FILE *fd;
-unsigned short *mv;
-short side;
-{
-int c,i,r1,r2,c1,c2;
-char s[100];
- while ((c = getc(fd)) == ' ');
- i = 0; s[0] = c;
- while (c != ' ' && c != '\n' && c != EOF) s[++i] = c = getc(fd);
- s[++i] = '\0';
- if (c == EOF) return(-1);
- if (s[0] == '!' || i < 3)
- {
- while (c != '\n' && c != EOF) c = getc(fd);
- return(0);
- }
- if (s[4] == 'o')
- if (side == black) *mv = 0x3C3A; else *mv = 0x0402;
- else if (s[0] == 'o')
- if (side == black) *mv = 0x3C3E; else *mv = 0x0406;
- else
- {
- c1 = s[0] - 'a'; r1 = s[1] - '1';
- c2 = s[2] - 'a'; r2 = s[3] - '1';
- *mv = (locn[r1][c1]<<8) + locn[r2][c2];
- }
- return(1);
-}
-
-
-GetGame()
-{
-FILE *fd;
-char fname[40];
-int c;
-short sq;
-unsigned short m;
-
- printz("Enter file name: ");
- scanz("%s",fname);
- if (fname[0] == '\0') strcpy(fname,"chess.000");
- if ((fd = fopen(fname,"r")) != NULL)
- {
- fscanf(fd,"%hd%hd%hd",&computer,&opponent,&Game50);
- fscanf(fd,"%hd%hd%hd%hd",
- &castld[white],&castld[black],
- &kingmoved[white],&kingmoved[black]);
- fscanf(fd,"%hd%hd",&TCflag,&OperatorTime);
- fscanf(fd,"%ld%ld%hd%hd",
- &TimeControl.clock[white],&TimeControl.clock[black],
- &TimeControl.moves[white],&TimeControl.moves[black]);
- for (sq = 0; sq < 64; sq++)
- {
- fscanf(fd,"%hd",&m);
- board[sq] = (m >> 8); color[sq] = (m & 0xFF);
- if (color[sq] == 0) color[sq] = neutral; else --color[sq];
- }
- GameCnt = -1; c = '?';
- while (c != EOF)
- {
- ++GameCnt;
- c = fscanf(fd,"%hd%hd%hd%ld%hd%hd%hd",&GameList[GameCnt].gmove,
- &GameList[GameCnt].score,&GameList[GameCnt].depth,
- &GameList[GameCnt].nodes,&GameList[GameCnt].time,
- &GameList[GameCnt].piece,&GameList[GameCnt].color);
- if (GameList[GameCnt].color == 0) GameList[GameCnt].color = neutral;
- else --GameList[GameCnt].color;
- }
- GameCnt--;
- if (TimeControl.clock[white] > 0) TCflag = true;
- computer--; opponent--;
- }
- fclose(fd);
- InitializeStats();
- UpdateDisplay(0,0,1,0);
- Sdepth = 0;
-}
-
-
-SaveGame()
-{
-FILE *fd;
-char fname[40];
-short sq,i,c;
-
- printz("Enter file name: ");
- scanz("%s",fname);
-
- if (fname[0] == '\0' || access(fname,W_OK) == -1) strcpy(fname,"chess.000");
- fd = fopen(fname,"w");
- fprintf(fd,"%d %d %d\n",computer+1,opponent+1,Game50);
- fprintf(fd,"%d %d %d %d\n",
- castld[white],castld[black],kingmoved[white],kingmoved[black]);
- fprintf(fd,"%d %d\n",TCflag,OperatorTime);
- fprintf(fd,"%ld %ld %d %d\n",
- TimeControl.clock[white],TimeControl.clock[black],
- TimeControl.moves[white],TimeControl.moves[black]);
- for (sq = 0; sq < 64; sq++)
- {
- if (color[sq] == neutral) c = 0; else c = color[sq]+1;
- fprintf(fd,"%d\n",256*board[sq] + c);
- }
- for (i = 0; i <= GameCnt; i++)
- {
- if (GameList[i].color == neutral) c = 0;
- else c = GameList[i].color + 1;
- fprintf(fd,"%d %d %d %ld %d %d %d\n",
- GameList[i].gmove,GameList[i].score,GameList[i].depth,
- GameList[i].nodes,GameList[i].time,
- GameList[i].piece,c);
- }
- fclose(fd);
-}
-
-
-ListGame()
-{
-FILE *fd;
-short i,f,t;
- fd = fopen("chess.lst","w");
- fprintf(fd,"\n");
- fprintf(fd," score depth nodes time ");
- fprintf(fd," score depth nodes time\n");
- for (i = 0; i <= GameCnt; i++)
- {
- f = GameList[i].gmove>>8; t = (GameList[i].gmove & 0xFF);
- algbr(f,t,false);
- if ((i % 2) == 0) fprintf(fd,"\n"); else fprintf(fd," ");
- fprintf(fd,"%5s %5d %2d %6ld %5d",mvstr1,
- GameList[i].score,GameList[i].depth,
- GameList[i].nodes,GameList[i].time);
- }
- fprintf(fd,"\n\n");
- fclose(fd);
-}
-
-
-Undo()
-
-/*
- Undo the most recent half-move.
-*/
-
-{
-short f,t;
- f = GameList[GameCnt].gmove>>8;
- t = GameList[GameCnt].gmove & 0xFF;
- if (board[t] == king && distance(t,f) > 1)
- castle(GameList[GameCnt].color,f,t,2);
- else
- {
- board[f] = board[t]; color[f] = color[t];
- board[t] = GameList[GameCnt].piece;
- color[t] = GameList[GameCnt].color;
- if (board[f] == king) --kingmoved[color[f]];
- }
- if (TCflag) ++TimeControl.moves[color[f]];
- GameCnt--; mate = false; Sdepth = 0;
- UpdateDisplay(0,0,1,0);
- InitializeStats();
-}
-
-
-ShowMessage(s)
-char *s;
-{
-#ifndef CHESSTOOL
- printz("%s\n");
-#endif CHESSTOOL
-}
-
-ShowSidetomove()
-{
-}
-
-PromptForMove()
-{
-#ifndef CHESSTOOL
- printz("\nYour move is? ");
-#endif CHESSTOOL
-}
-
-
-ShowCurrentMove(pnt,f,t)
-short pnt,f,t;
-{
-}
-
-ChangeAlphaWindow()
-{
- printz("window: ");
- scanz("%hd",&Awindow);
-}
-
-ChangeBetaWindow()
-{
- printz("window: ");
- scanz("%hd",&Bwindow);
-}
-
-GiveHint()
-{
- algbr((short)(hint>>8),(short)(hint & 0xFF),false);
- printz("try %s\n",mvstr1);
-}
-
-
-SelectLevel()
-{
- OperatorTime = 30000;
- printz("Enter #moves #minutes: ");
- scanz("%hd %hd",&TCmoves,&TCminutes);
- printz("Operator time= ");
- scanz("%hd",&OperatorTime);
- TCflag = (TCmoves > 1);
- SetTimeControl();
-}
-
-
-ChangeSearchDepth()
-{
- printz("depth= ");
- scanz("%hd",&MaxSearchDepth);
-}
-
-SetContempt()
-{
- printz("contempt= ");
- scanz("%hd",&contempt);
-}
-
-ChangeXwindow()
-{
- printz("xwndw= ");
- scanz("%hd",&xwndw);
-}
diff --git a/gnu/games/chess/uxdsp.c b/gnu/games/chess/uxdsp.c
deleted file mode 100644
index 84034bc..0000000
--- a/gnu/games/chess/uxdsp.c
+++ /dev/null
@@ -1,933 +0,0 @@
-/*
- ALPHA interface for CHESS
-
- Revision: 4-25-88
-
- Copyright (C) 1986, 1987, 1988 Free Software Foundation, Inc.
- Copyright (c) 1988 John Stanback
-
- This file is part of CHESS.
-
- CHESS is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY. No author or distributor
- accepts responsibility to anyone for the consequences of using it
- or for whether it serves any particular purpose or works at all,
- unless he says so in writing. Refer to the CHESS General Public
- License for full details.
-
- Everyone is granted permission to copy, modify and redistribute
- CHESS, but only under the conditions described in the
- CHESS General Public License. A copy of this license is
- supposed to have been given to you along with CHESS so you
- can know your rights and responsibilities. It should be in a
- file named COPYING. Among other things, the copyright notice
- and this notice must be preserved on all copies.
-*/
-
-
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/param.h>
-#include <sys/times.h>
-#include <sys/file.h>
-#include <curses.h>
-#include <signal.h>
-#include "gnuchess.h"
-#ifdef NEWMOVE
-#include "move.h"
-#endif
-#include "pathnames.h"
-
-struct tms tmbuf1,tmbuf2;
-void TerminateSearch(),Die();
-
-#define scanz fflush(stdout),scanw
-#define printz printw
-
-
-Initialize()
-{
- signal(SIGINT,Die); signal(SIGQUIT,Die);
- initscr();
- crmode();
-}
-
-
-ExitChess()
-{
- nocrmode();
- endwin();
- exit(0);
-}
-
-
-void
-Die()
-{
-char s[80];
- signal(SIGINT,SIG_IGN);
- signal(SIGQUIT,SIG_IGN);
- ShowMessage("Abort? ");
- scanz("%s",s);
- if (strcmp(s,"yes") == 0) ExitChess();
- signal(SIGINT,Die); signal(SIGQUIT,Die);
-}
-
-
-void
-TerminateSearch()
-{
- signal(SIGINT,SIG_IGN);
- signal(SIGQUIT,SIG_IGN);
- timeout = true;
- bothsides = false;
- signal(SIGINT,Die); signal(SIGQUIT,Die);
-}
-
-
-InputCommand()
-
-/*
- Process the users command. If easy mode is OFF (the computer is
- thinking on opponents time) and the program is out of book, then make
- the 'hint' move on the board and call SelectMove() to find a response.
- The user terminates the search by entering ^C (quit siqnal) before
- entering a command. If the opponent does not make the hint move, then
- set Sdepth to zero.
-*/
-
-{
-short ok,i,tmp;
-long cnt,rate,t1,t2;
-unsigned short mv;
-char s[80];
-
- ok = quit = false;
- player = opponent;
- ShowSidetomove();
- ft = 0;
- if (hint > 0 && !easy && Book == NULL)
- {
- fflush(stdout);
- time0 = time((long *)0);
- algbr(hint>>8,hint & 0xFF,false);
- strcpy(s,mvstr1);
- tmp = epsquare;
- if (VerifyMove(s,1,&mv))
- {
- PromptForMove();
- SelectMove(computer,2);
- VerifyMove(mvstr1,2,&mv);
- if (Sdepth > 0) Sdepth--;
- }
- ft = time((time_t *)0) - time0;
- epsquare = tmp;
- }
-
- signal(SIGINT,Die); signal(SIGQUIT,Die);
- while (!(ok || quit))
- {
- PromptForMove();
- scanz("%s",s);
- player = opponent;
- ok = VerifyMove(s,0,&mv);
- if (ok && mv != hint)
- {
- Sdepth = 0;
- ft = 0;
- }
-
- if (strcmp(s,"bd") == 0)
- {
- ClrScreen();
- UpdateDisplay(0,0,1,0);
- }
- if (strcmp(s,"quit") == 0) quit = true;
- if (strcmp(s,"post") == 0) post = !post;
- if (strcmp(s,"edit") == 0) EditBoard();
- if (strcmp(s,"go") == 0) ok = true;
- if (strcmp(s,"help") == 0) help();
- if (strcmp(s,"force") == 0) force = !force;
- if (strcmp(s,"book") == 0) Book = NULL;
- if (strcmp(s,"undo") == 0 && GameCnt >= 0) Undo();
- if (strcmp(s,"new") == 0) NewGame();
- if (strcmp(s,"list") == 0) ListGame();
- if (strcmp(s,"level") == 0) SelectLevel();
- if (strcmp(s,"hash") == 0) hashflag = !hashflag;
- if (strcmp(s,"beep") == 0) beep = !beep;
- if (strcmp(s,"Awindow") == 0) ChangeAlphaWindow();
- if (strcmp(s,"Bwindow") == 0) ChangeBetaWindow();
- if (strcmp(s,"hint") == 0) GiveHint();
- if (strcmp(s,"both") == 0)
- {
- bothsides = !bothsides;
- Sdepth = 0;
- SelectMove(opponent,1);
- ok = true;
- }
- if (strcmp(s,"reverse") == 0)
- {
- reverse = !reverse;
- ClrScreen();
- UpdateDisplay(0,0,1,0);
- }
- if (strcmp(s,"switch") == 0)
- {
- computer = otherside[computer];
- opponent = otherside[opponent];
- force = false;
- Sdepth = 0;
- ok = true;
- }
- if (strcmp(s,"white") == 0)
- {
- computer = white; opponent = black;
- ok = true; force = false;
- Sdepth = 0;
- }
- if (strcmp(s,"black") == 0)
- {
- computer = black; opponent = white;
- ok = true; force = false;
- Sdepth = 0;
- }
- if (strcmp(s,"remove") == 0 && GameCnt >= 1)
- {
- Undo(); Undo();
- }
- if (strcmp(s,"get") == 0) GetGame();
- if (strcmp(s,"save") == 0) SaveGame();
- if (strcmp(s,"depth") == 0) ChangeSearchDepth();
- if (strcmp(s,"random") == 0) dither = 6;
- if (strcmp(s,"easy") == 0) easy = !easy;
- if (strcmp(s,"contempt") == 0) SetContempt();
- if (strcmp(s,"xwndw") == 0) ChangeXwindow();
- if (strcmp(s,"test") == 0)
- {
- t1 = time(0);
- cnt = 0;
- for (i = 0; i < 10000; i++)
- {
- MoveList(opponent,2);
- cnt += TrPnt[3] - TrPnt[2];
- }
- t2 = time(0);
- rate = cnt / (t2-t1);
- gotoXY(50,24);
- printz("cnt= %ld rate= %ld",cnt,rate);
- ClrEoln();
- }
- if (strcmp(s,"p") == 0) ShowPostnValues();
- if (strcmp(s,"debug") == 0) DoDebug();
- }
-
- ClearMessage();
- ElapsedTime(1);
- if (force)
- {
- computer = opponent; opponent = otherside[computer];
- }
- (void) times(&tmbuf1);
- signal(SIGINT,TerminateSearch); signal(SIGQUIT,TerminateSearch);
-}
-
-
-EditBoard()
-
-/*
- Set up a board position. Pieces are entered by typing the piece
- followed by the location. For example, Nf3 will place a knight on
- square f3.
-*/
-
-{
-short a,r,c,sq;
-char s[80];
-
- ClrScreen();
- UpdateDisplay(0,0,1,0);
- gotoXY(50,2); printz(". Exit to main");
- gotoXY(50,3); printz("# Clear board");
- gotoXY(49,5); printz("Enter piece & location: ");
- a = white;
- do
- {
- gotoXY(73,5); ClrEoln(); scanz("%s",s);
- if (s[0] == '#')
- {
- for (sq = 0; sq < 64; sq++)
- {
- board[sq] = no_piece; color[sq] = neutral;
- }
- UpdateDisplay(0,0,1,0);
- }
- if (s[0] == 'c' || s[0] == 'C') a = otherside[a];
- c = s[1]-'a'; r = s[2]-'1';
- if ((c >= 0) && (c < 8) && (r >= 0) && (r < 8))
- {
- sq = locn[r][c];
- color[sq] = a;
- if (s[0] == 'p') board[sq] = pawn;
- else if (s[0] == 'n') board[sq] = knight;
- else if (s[0] == 'b') board[sq] = bishop;
- else if (s[0] == 'r') board[sq] = rook;
- else if (s[0] == 'q') board[sq] = queen;
- else if (s[0] == 'k') board[sq] = king;
- else { board[sq] = no_piece; color[sq] = neutral; }
- DrawPiece(sq);
- }
- }
- while (s[0] != '.');
- if (board[4] != king) kingmoved[white] = 10;
- if (board[60] != king) kingmoved[black] = 10;
- GameCnt = -1; Game50 = 0; Sdepth = 0;
- InitializeStats();
- ClrScreen();
- UpdateDisplay(0,0,1,0);
-}
-
-
-help()
-{
- ClrScreen();
- gotoXY(28,1); printz("CHESS command summary");
- gotoXY(1,3); printz("g1f3 move from g1 to f3");
- gotoXY(1,4); printz("nf3 move knight to f3");
- gotoXY(1,5); printz("o-o castle king side");
- gotoXY(1,6); printz("o-o-o castle queen side");
- gotoXY(1,7); printz("edit edit board");
- gotoXY(1,8); printz("switch sides with computer");
- gotoXY(1,9); printz("white computer plays white");
- gotoXY(1,10); printz("black computer plays black");
- gotoXY(1,11); printz("reverse board display");
- gotoXY(1,12); printz("both computer match");
- gotoXY(1,13); printz("random randomize play");
- gotoXY(1,14); printz("undo undo last move");
- gotoXY(42,3); printz("level change level");
- gotoXY(42,4); printz("depth set search depth");
- gotoXY(42,5); printz("post principle variation");
- gotoXY(42,6); printz("hint suggest a move");
- gotoXY(42,7); printz("bd redraw board");
- gotoXY(42,8); printz("force enter game moves");
- gotoXY(42,9); printz("list game to chess.lst");
- gotoXY(42,10); printz("save game to file");
- gotoXY(42,11); printz("get game from file");
- gotoXY(42,12); printz("new start new game");
- gotoXY(42,13); printz("quit exit CHESS");
- gotoXY(10,21); printz("Computer: ");
- if (computer == white) printz("WHITE"); else printz("BLACK");
- gotoXY(10,22); printz("Opponent: ");
- if (opponent == white) printz("WHITE"); else printz("BLACK");
- gotoXY(10,23); printz("Level: %ld",Level," sec.");
- gotoXY(10,24); printz("Easy mode: ");
- if (easy) printz("ON"); else printz("OFF");
- gotoXY(40,21); printz("Depth: %d",MaxSearchDepth);
- gotoXY(40,22); printz("Random: ");
- if (dither) printz("ON"); else printz("OFF");
- gotoXY(40,23); printz("Transposition table: ");
- if (hashflag) printz("ON"); else printz("OFF");
- refresh();
- while (getchar() != 27);
- ClrScreen();
- UpdateDisplay(0,0,1,0);
-}
-
-
-ShowDepth(ch)
-char ch;
-{
- gotoXY(50,4); printz("Depth= %d%c ",Sdepth,ch); ClrEoln();
-}
-
-
-ShowResults(score,bstline,ch)
-short score;
-unsigned short bstline[];
-char ch;
-{
-short d,e,ply;
- if (post && player == computer)
- {
- e = lpost;
- gotoXY(50,5); printz("Score= %d",score); ClrEoln();
- d = 8; gotoXY(50,d); ClrEoln();
- for (ply = 1; bstline[ply] > 0; ply++)
- {
- algbr(bstline[ply] >> 8,bstline[ply] & 0xFF,false);
- if (ply == 5 || ply == 9 || ply == 13 || ply == 17)
- {
- gotoXY(50,++d); ClrEoln();
- }
- printz("%5s ",mvstr1);
- }
- ClrEoln();
- lpost = d;
- while (++d <= e)
- {
- gotoXY(50,d); ClrEoln();
- }
- }
-}
-
-
-SearchStartStuff(side)
-short side;
-{
-short i;
- signal(SIGINT,TerminateSearch); signal(SIGQUIT,TerminateSearch);
- if (player == computer)
- for (i = 5; i < 14; i++)
- {
- gotoXY(50,i); ClrEoln();
- }
-}
-
-
-OutputMove()
-{
- if (root->flags & epmask) UpdateDisplay(0,0,1,0);
- else UpdateDisplay(root->f,root->t,0,root->flags & cstlmask);
- gotoXY(50,17); printz("My move is: %s",mvstr1);
- if (beep) putchar(7);
- ClrEoln();
-
- gotoXY(50,24);
- if (root->flags & draw) printz("Draw game!");
- else if (root->score == -9999) printz("opponent mates!");
- else if (root->score == 9998) printz("computer mates!");
- else if (root->score < -9000) printz("opponent will soon mate!");
- else if (root->score > 9000) printz("computer will soon mate!");
- ClrEoln();
-
- if (post)
- {
- gotoXY(50,22); printz("Nodes= %6ld",NodeCnt); ClrEoln();
- gotoXY(50,23); printz("Nodes/Sec= %4ld",evrate); ClrEoln();
- }
-}
-
-
-ElapsedTime(iop)
-
-/*
- Determine the time that has passed since the search was started. If
- the elapsed time exceeds the target (ResponseTime+ExtraTime) then set
- timeout to true which will terminate the search.
-*/
-
-short iop;
-{
- et = time((time_t *)0) - time0;
- if (et < 0) et = 0;
- ETnodes += 50;
- if (et > et0 || iop == 1)
- {
- if (et > ResponseTime+ExtraTime && Sdepth > 1) timeout = true;
- et0 = et;
- if (iop == 1)
- {
- time0 = time((time_t *)0); et0 = 0;
- }
- (void) times(&tmbuf2);
- cputimer = 100*(tmbuf2.tms_utime - tmbuf1.tms_utime) / HZ;
- if (cputimer > 0) evrate = (100*NodeCnt)/(cputimer+100*ft);
- else evrate = 0;
- ETnodes = NodeCnt + 50;
- UpdateClocks();
- }
-}
-
-
-UpdateClocks()
-{
-short m,s;
- m = et/60; s = (et - 60*m);
- if (TCflag)
- {
- m = (TimeControl.clock[player] - et) / 60;
- s = TimeControl.clock[player] - et - 60*m;
- }
- if (m < 0) m = 0;
- if (s < 0) s = 0;
- if (player == white)
- if (reverse) gotoXY(20,2); else gotoXY(20,23);
- else
- if (reverse) gotoXY(20,23); else gotoXY(20,2);
- printz("%d:%2d ",m,s);
- if (post)
- {
- gotoXY(50,22); printz("Nodes= %6ld",NodeCnt);
- gotoXY(50,23); printz("Nodes/Sec= %4ld",evrate);
- }
- refresh();
-}
-
-
-
-SetTimeControl()
-{
- if (TCflag)
- {
- TimeControl.moves[white] = TimeControl.moves[black] = TCmoves;
- TimeControl.clock[white] = TimeControl.clock[black] = 60*(long)TCminutes;
- }
- else
- {
- TimeControl.moves[white] = TimeControl.moves[black] = 0;
- TimeControl.clock[white] = TimeControl.clock[black] = 0;
- Level = 60*(long)TCminutes;
- }
- et = 0;
- ElapsedTime(1);
-}
-
-
-gotoXY(x,y)
-short x,y;
-{
- move(y-1,x-1);
-}
-
-
-ClrScreen()
-{
- clear(); refresh();
-}
-
-
-ClrEoln()
-{
- clrtoeol(); refresh();
-}
-
-
-DrawPiece(sq)
-short sq;
-{
-short r,c; char x;
- if (reverse) r = 7-row[sq]; else r = row[sq];
- if (reverse) c = 7-column[sq]; else c = column[sq];
- if (color[sq] == black) x = '*'; else x = ' ';
- gotoXY(5+5*c,5+2*(7-r)); printz("%c%c ",x,pxx[board[sq]]);
-}
-
-
-UpdateDisplay(f,t,flag,iscastle)
-short f,t,flag,iscastle;
-{
-short i,l,z;
- if (flag)
- {
- gotoXY(56,2); printz("CHESS");
- i = 3;
- gotoXY(3,++i);
- printz("|----|----|----|----|----|----|----|----|");
- while (i<19)
- {
- gotoXY(1,++i);
- if (reverse) z = (i/2)-1; else z = 10-(i/2);
- printz("%d | | | | | | | | |",z);
- gotoXY(3,++i);
- if (i < 19)
- printz("+----+----+----+----+----+----+----+----+");
- }
- printz("|----|----|----|----|----|----|----|----|");
- gotoXY(3,21);
- if (reverse) printz(" h g f e d c b a");
- else printz(" a b c d e f g h");
- if (reverse) gotoXY(5,23); else gotoXY(5,2);
- if (computer == black) printz("Computer"); else printz("Human ");
- if (reverse) gotoXY(5,2); else gotoXY(5,23);
- if (computer == white) printz("Computer"); else printz("Human ");
- for (l = 0; l < 64; l++) DrawPiece(l);
- }
- else
- {
- DrawPiece(f); DrawPiece(t);
- if (iscastle)
- if (t > f)
- { DrawPiece(f+3); DrawPiece(t-1); }
- else
- { DrawPiece(f-4); DrawPiece(t+1); }
- }
- refresh();
-}
-
-
-GetOpenings()
-
-/*
- Read in the Opening Book file and parse the algebraic notation for a
- move into an unsigned integer format indicating the from and to
- square. Create a linked list of opening lines of play, with
- entry->next pointing to the next line and entry->move pointing to a
- chunk of memory containing the moves. More Opening lines of up to 256
- half moves may be added to gnuchess.book.
-*/
-
-{
-FILE *fd;
-int c,i,j,side;
-struct BookEntry *entry;
-unsigned short mv,*mp,tmp[100];
-
- if ((fd = fopen(_PATH_CHESSBOOK,"r")) != NULL)
- {
- Book = NULL;
- i = 0; side = white;
- while ((c = parse(fd,&mv,side)) >= 0)
- if (c == 1)
- {
- tmp[++i] = mv;
- side = otherside[side];
- }
- else if (c == 0 && i > 0)
- {
- entry = (struct BookEntry *)malloc(sizeof(struct BookEntry));
- mp = (unsigned short *)malloc((i+1)*sizeof(unsigned short));
- entry->mv = mp;
- entry->next = Book;
- Book = entry;
- for (j = 1; j <= i; j++) *(mp++) = tmp[j];
- *mp = 0;
- i = 0; side = white;
- }
- fclose(fd);
- }
- else
- {
- fprintf(stderr, "\nchess: can't read %s.\n", _PATH_CHESSBOOK);
- exit(1);
- }
-}
-
-
-int parse(fd,mv,side)
-FILE *fd;
-unsigned short *mv;
-short side;
-{
-int c,i,r1,r2,c1,c2;
-char s[100];
- while ((c = getc(fd)) == ' ');
- i = 0; s[0] = c;
- while (c != ' ' && c != '\n' && c != EOF) s[++i] = c = getc(fd);
- s[++i] = '\0';
- if (c == EOF) return(-1);
- if (s[0] == '!' || i < 3)
- {
- while (c != '\n' && c != EOF) c = getc(fd);
- return(0);
- }
- if (s[4] == 'o')
- if (side == black) *mv = 0x3C3A; else *mv = 0x0402;
- else if (s[0] == 'o')
- if (side == black) *mv = 0x3C3E; else *mv = 0x0406;
- else
- {
- c1 = s[0] - 'a'; r1 = s[1] - '1';
- c2 = s[2] - 'a'; r2 = s[3] - '1';
- *mv = (locn[r1][c1]<<8) + locn[r2][c2];
- }
- return(1);
-}
-
-
-GetGame()
-{
-FILE *fd;
-char fname[40];
-int c;
-short sq;
-unsigned short m;
-
- ShowMessage("File name: ");
- scanz("%s",fname);
- if (fname[0] == '\0') strcpy(fname,"chess.000");
- if ((fd = fopen(fname,"r")) != NULL)
- {
- fscanf(fd,"%hd%hd%hd",&computer,&opponent,&Game50);
- fscanf(fd,"%hd%hd%hd%hd",
- &castld[white],&castld[black],
- &kingmoved[white],&kingmoved[black]);
- fscanf(fd,"%hd%hd",&TCflag,&OperatorTime);
- fscanf(fd,"%ld%ld%hd%hd",
- &TimeControl.clock[white],&TimeControl.clock[black],
- &TimeControl.moves[white],&TimeControl.moves[black]);
- for (sq = 0; sq < 64; sq++)
- {
- fscanf(fd,"%hd",&m);
- board[sq] = (m >> 8); color[sq] = (m & 0xFF);
- if (color[sq] == 0) color[sq] = neutral; else --color[sq];
- }
- GameCnt = -1; c = '?';
- while (c != EOF)
- {
- ++GameCnt;
- c = fscanf(fd,"%hd%hd%hd%ld%hd%hd%hd",&GameList[GameCnt].gmove,
- &GameList[GameCnt].score,&GameList[GameCnt].depth,
- &GameList[GameCnt].nodes,&GameList[GameCnt].time,
- &GameList[GameCnt].piece,&GameList[GameCnt].color);
- if (GameList[GameCnt].color == 0) GameList[GameCnt].color = neutral;
- else --GameList[GameCnt].color;
- }
- GameCnt--;
- if (TimeControl.clock[white] > 0) TCflag = true;
- computer--; opponent--;
- }
- fclose(fd);
- InitializeStats();
- UpdateDisplay(0,0,1,0);
- Sdepth = 0;
-}
-
-
-SaveGame()
-{
-FILE *fd;
-char fname[40];
-short sq,i,c;
-
- ShowMessage("File name: ");
- scanz("%s",fname);
-
- if (fname[0] == '\0' || access(fname,W_OK) == -1) strcpy(fname,"chess.000");
- fd = fopen(fname,"w");
- fprintf(fd,"%d %d %d\n",computer+1,opponent+1,Game50);
- fprintf(fd,"%d %d %d %d\n",
- castld[white],castld[black],kingmoved[white],kingmoved[black]);
- fprintf(fd,"%d %d\n",TCflag,OperatorTime);
- fprintf(fd,"%ld %ld %d %d\n",
- TimeControl.clock[white],TimeControl.clock[black],
- TimeControl.moves[white],TimeControl.moves[black]);
- for (sq = 0; sq < 64; sq++)
- {
- if (color[sq] == neutral) c = 0; else c = color[sq]+1;
- fprintf(fd,"%d\n",256*board[sq] + c);
- }
- for (i = 0; i <= GameCnt; i++)
- {
- if (GameList[i].color == neutral) c = 0;
- else c = GameList[i].color + 1;
- fprintf(fd,"%d %d %d %ld %d %d %d\n",
- GameList[i].gmove,GameList[i].score,GameList[i].depth,
- GameList[i].nodes,GameList[i].time,
- GameList[i].piece,c);
- }
- fclose(fd);
-}
-
-
-ListGame()
-{
-FILE *fd;
-short i,f,t;
- fd = fopen("chess.lst","w");
- fprintf(fd,"\n");
- fprintf(fd," score depth nodes time ");
- fprintf(fd," score depth nodes time\n");
- for (i = 0; i <= GameCnt; i++)
- {
- f = GameList[i].gmove>>8; t = (GameList[i].gmove & 0xFF);
- algbr(f,t,false);
- if ((i % 2) == 0) fprintf(fd,"\n"); else fprintf(fd," ");
- fprintf(fd,"%5s %5d %2d %6ld %5d",mvstr1,
- GameList[i].score,GameList[i].depth,
- GameList[i].nodes,GameList[i].time);
- }
- fprintf(fd,"\n\n");
- fclose(fd);
-}
-
-
-Undo()
-
-/*
- Undo the most recent half-move.
-*/
-
-{
-short f,t;
- f = GameList[GameCnt].gmove>>8;
- t = GameList[GameCnt].gmove & 0xFF;
- if (board[t] == king && distance(t,f) > 1)
- castle(GameList[GameCnt].color,f,t,2);
- else
- {
- board[f] = board[t]; color[f] = color[t];
- board[t] = GameList[GameCnt].piece;
- color[t] = GameList[GameCnt].color;
- if (board[f] == king) --kingmoved[color[f]];
- }
- if (TCflag) ++TimeControl.moves[color[f]];
- GameCnt--; mate = false; Sdepth = 0;
- UpdateDisplay(0,0,1,0);
- InitializeStats();
-}
-
-
-ShowMessage(s)
-char *s;
-{
- gotoXY(50,24); printz("%s",s); ClrEoln();
-}
-
-ClearMessage()
-{
- gotoXY(50,24); ClrEoln();
-}
-
-ShowSidetomove()
-{
- gotoXY(50,14);
- if (player == white) printz("%2d: WHITE",1+(GameCnt+1)/2);
- else printz("%2d: BLACK",1+(GameCnt+1)/2);
- ClrEoln();
-}
-
-PromptForMove()
-{
- gotoXY(50,19); printz("Your move is? "); ClrEoln();
-}
-
-ShowCurrentMove(pnt,f,t)
-short pnt,f,t;
-{
- algbr(f,t,false);
- gotoXY(50,7); printz("(%2d) %4s",pnt,mvstr1);
-}
-
-ChangeAlphaWindow()
-{
- ShowMessage("window: ");
- scanz("%hd",&Awindow);
-}
-
-ChangeBetaWindow()
-{
- ShowMessage("window: ");
- scanz("%hd",&Bwindow);
-}
-
-GiveHint()
-{
-char s[40];
- algbr((short)(hint>>8),(short)(hint & 0xFF),false);
- strcpy(s,"try ");
- strcat(s,mvstr1);
- ShowMessage(s);
-}
-
-ChangeSearchDepth()
-{
- ShowMessage("depth= ");
- scanz("%hd",&MaxSearchDepth);
-}
-
-SetContempt()
-{
- ShowMessage("contempt= ");
- scanz("%hd",&contempt);
-}
-
-ChangeXwindow()
-{
- ShowMessage("xwndw= ");
- scanz("%hd",&xwndw);
-}
-
-
-SelectLevel()
-{
- ClrScreen();
- gotoXY(32,2); printz("CHESS");
- gotoXY(20,4); printz(" 1. 60 moves in 5 minutes");
- gotoXY(20,5); printz(" 2. 60 moves in 15 minutes");
- gotoXY(20,6); printz(" 3. 60 moves in 30 minutes");
- gotoXY(20,7); printz(" 4. 40 moves in 30 minutes");
- gotoXY(20,8); printz(" 5. 40 moves in 60 minutes");
- gotoXY(20,9); printz(" 6. 40 moves in 120 minutes");
- gotoXY(20,10); printz(" 7. 40 moves in 240 minutes");
- gotoXY(20,11); printz(" 8. 1 move in 15 minutes");
- gotoXY(20,12); printz(" 9. 1 move in 60 minutes");
- gotoXY(20,13); printz("10. 1 move in 600 minutes");
-
- OperatorTime = 0; TCmoves = 60; TCminutes = 5;
-
- gotoXY(20,17); printz("Enter Level: ");
- refresh();
- scanz("%ld",&Level);
- switch (Level)
- {
- case 1 : TCmoves = 60; TCminutes = 5; break;
- case 2 : TCmoves = 60; TCminutes = 15; break;
- case 3 : TCmoves = 60; TCminutes = 30; break;
- case 4 : TCmoves = 40; TCminutes = 30; break;
- case 5 : TCmoves = 40; TCminutes = 60; break;
- case 6 : TCmoves = 40; TCminutes = 120; break;
- case 7 : TCmoves = 40; TCminutes = 240; break;
- case 8 : TCmoves = 1; TCminutes = 15; break;
- case 9 : TCmoves = 1; TCminutes = 60; break;
- case 10 : TCmoves = 1; TCminutes = 600; break;
- }
-
- TCflag = (TCmoves > 1);
- SetTimeControl();
- ClrScreen();
- UpdateDisplay(0,0,1,0);
-}
-
-
-ShowPostnValues()
-{
-short i,r,c;
- ExaminePosition();
- for (i = 0; i < 64; i++)
- {
- if (reverse) r = 7-row[i]; else r = row[i];
- if (reverse) c = 7-column[i]; else c = column[i];
- gotoXY(4+5*c,5+2*(7-r));
- c1 = color[i]; c2 = otherside[c1];
- PC1 = PawnCnt[c1]; PC2 = PawnCnt[c2];
- atk1 = atak[c1]; atk2 = atak[c2];
- if (color[i] == neutral) printz(" ");
- else printz("%3d ",SqValue(i,opponent));
- }
- ScorePosition(opponent,&i);
- gotoXY(50,24);
- printz("Score= %d",i); ClrEoln();
-}
-
-
-DoDebug()
-{
-short k,p,i,r,c,tp,tc;
-char s[40];
- ExaminePosition();
- ShowMessage("Enter piece: ");
- scanz("%s",s);
- if (s[0] == 'w') k = white; else k = black;
- if (s[1] == 'p') p = pawn;
- else if (s[1] == 'n') p = knight;
- else if (s[1] == 'b') p = bishop;
- else if (s[1] == 'r') p = rook;
- else if (s[1] == 'q') p = queen;
- else if (s[1] == 'k') p = king;
- else p = no_piece;
- for (i = 0; i < 64; i++)
- {
- if (reverse) r = 7-row[i]; else r = row[i];
- if (reverse) c = 7-column[i]; else c = column[i];
- gotoXY(4+5*c,5+2*(7-r));
- tp = board[i]; tc = color[i];
- board[i] = p; color[i] = k;
- c1 = k; c2 = otherside[c1];
- PC1 = PawnCnt[c1]; PC2 = PawnCnt[c2];
- atk1 = atak[c1]; atk2 = atak[c2];
- printz("%3d ",SqValue(i,opponent));
- board[i] = tp; color[i] = tc;
- }
- ScorePosition(opponent,&i);
- gotoXY(50,24);
- printz("Score= %d",i); ClrEoln();
-}
diff --git a/gnu/lib/libg++/libg++/regex.cc b/gnu/lib/libg++/libg++/regex.cc
deleted file mode 100644
index 40b8498..0000000
--- a/gnu/lib/libg++/libg++/regex.cc
+++ /dev/null
@@ -1,2757 +0,0 @@
-/* Extended regular expression matching and search library.
- Copyright (C) 1985, 1989-90 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-
-// This is a translation into C++ of regex.c, the GNU regexp package.
-
-/* To test, compile with -Dtest. This Dtestable feature turns this into
- a self-contained program which reads a pattern, describes how it
- compiles, then reads a string and searches for it.
-
- On the other hand, if you compile with both -Dtest and -Dcanned you
- can run some tests we've already thought of. */
-
-/* AIX requires the alloca decl to be the first thing in the file. */
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else
-#ifdef sparc
-#include <alloca.h>
-extern "C" void *__builtin_alloca(...);
-#else
-#ifdef _AIX
-#pragma alloca
-#else
-char *alloca ();
-#endif
-#endif
-#endif
-
-#ifdef emacs
-
-/* The `emacs' switch turns on certain special matching commands
- that make sense only in emacs. */
-
-#include "config.h"
-#include "lisp.h"
-#include "buffer.h"
-#include "syntax.h"
-
-#else /* not emacs */
-
-#include <_G_config.h>
-#include <string.h>
-#include <stdlib.h>
-
-/* Define the syntax stuff, so we can do the \<, \>, etc. */
-
-/* This must be nonzero for the wordchar and notwordchar pattern
- commands in re_match_2. */
-#ifndef Sword
-#define Sword 1
-#endif
-
-#define SYNTAX(c) re_syntax_table[c]
-
-
-#ifdef SYNTAX_TABLE
-
-char *re_syntax_table;
-
-#else /* not SYNTAX_TABLE */
-
-static char re_syntax_table[256];
-
-
-static void
-init_syntax_once ()
-{
- register int c;
- static int done = 0;
-
- if (done)
- return;
-
- memset (re_syntax_table, 0, sizeof re_syntax_table);
-
- for (c = 'a'; c <= 'z'; c++)
- re_syntax_table[c] = Sword;
-
- for (c = 'A'; c <= 'Z'; c++)
- re_syntax_table[c] = Sword;
-
- for (c = '0'; c <= '9'; c++)
- re_syntax_table[c] = Sword;
-
- done = 1;
-}
-
-#endif /* SYNTAX_TABLE */
-#endif /* emacs */
-
-/* We write fatal error messages on standard error. */
-#include <stdio.h>
-
-/* isalpha(3) etc. are used for the character classes. */
-#include <ctype.h>
-/* Sequents are missing isgraph. */
-#ifndef isgraph
-#define isgraph(c) (isprint((c)) && !isspace((c)))
-#endif
-
-/* Get the interface, including the syntax bits. */
-#include <gnuregex.h>
-
-
-/* These are the command codes that appear in compiled regular
- expressions, one per byte. Some command codes are followed by
- argument bytes. A command code can specify any interpretation
- whatsoever for its arguments. Zero-bytes may appear in the compiled
- regular expression.
-
- The value of `exactn' is needed in search.c (search_buffer) in emacs.
- So regex.h defines a symbol `RE_EXACTN_VALUE' to be 1; the value of
- `exactn' we use here must also be 1. */
-
-enum regexpcode
- {
- unused=0,
- exactn=1, /* Followed by one byte giving n, then by n literal bytes. */
- begline, /* Fail unless at beginning of line. */
- endline, /* Fail unless at end of line. */
- jump, /* Followed by two bytes giving relative address to jump to. */
- on_failure_jump, /* Followed by two bytes giving relative address of
- place to resume at in case of failure. */
- finalize_jump, /* Throw away latest failure point and then jump to
- address. */
- maybe_finalize_jump, /* Like jump but finalize if safe to do so.
- This is used to jump back to the beginning
- of a repeat. If the command that follows
- this jump is clearly incompatible with the
- one at the beginning of the repeat, such that
- we can be sure that there is no use backtracking
- out of repetitions already completed,
- then we finalize. */
- dummy_failure_jump, /* Jump, and push a dummy failure point. This
- failure point will be thrown away if an attempt
- is made to use it for a failure. A + construct
- makes this before the first repeat. Also
- use it as an intermediary kind of jump when
- compiling an or construct. */
- succeed_n, /* Used like on_failure_jump except has to succeed n times;
- then gets turned into an on_failure_jump. The relative
- address following it is useless until then. The
- address is followed by two bytes containing n. */
- jump_n, /* Similar to jump, but jump n times only; also the relative
- address following is in turn followed by yet two more bytes
- containing n. */
- set_number_at, /* Set the following relative location to the
- subsequent number. */
- anychar, /* Matches any (more or less) one character. */
- charset, /* Matches any one char belonging to specified set.
- First following byte is number of bitmap bytes.
- Then come bytes for a bitmap saying which chars are in.
- Bits in each byte are ordered low-bit-first.
- A character is in the set if its bit is 1.
- A character too large to have a bit in the map
- is automatically not in the set. */
- charset_not, /* Same parameters as charset, but match any character
- that is not one of those specified. */
- start_memory, /* Start remembering the text that is matched, for
- storing in a memory register. Followed by one
- byte containing the register number. Register numbers
- must be in the range 0 through RE_NREGS. */
- stop_memory, /* Stop remembering the text that is matched
- and store it in a memory register. Followed by
- one byte containing the register number. Register
- numbers must be in the range 0 through RE_NREGS. */
- duplicate, /* Match a duplicate of something remembered.
- Followed by one byte containing the index of the memory
- register. */
-#ifdef emacs
- before_dot, /* Succeeds if before point. */
- at_dot, /* Succeeds if at point. */
- after_dot, /* Succeeds if after point. */
-#endif
- begbuf, /* Succeeds if at beginning of buffer. */
- endbuf, /* Succeeds if at end of buffer. */
- wordchar, /* Matches any word-constituent character. */
- notwordchar, /* Matches any char that is not a word-constituent. */
- wordbeg, /* Succeeds if at word beginning. */
- wordend, /* Succeeds if at word end. */
- wordbound, /* Succeeds if at a word boundary. */
- notwordbound /* Succeeds if not at a word boundary. */
-#ifdef emacs
- ,syntaxspec, /* Matches any character whose syntax is specified.
- followed by a byte which contains a syntax code,
- e.g., Sword. */
- notsyntaxspec /* Matches any character whose syntax differs from
- that specified. */
-#endif
- };
-
-
-/* Number of failure points to allocate space for initially,
- when matching. If this number is exceeded, more space is allocated,
- so it is not a hard limit. */
-
-#ifndef NFAILURES
-#define NFAILURES 80
-#endif
-
-
-#ifndef SIGN_EXTEND_CHAR
-#ifdef __STDC__
-#define SIGN_EXTEND_CHAR(c) ((signed char)(c))
-#else
-#define SIGN_EXTEND_CHAR(c) (((c)^128) - 128) /* As in Harbison and Steele. */
-#endif
-#endif /* not SIGN_EXTEND_CHAR */
-
-/* Store NUMBER in two contiguous bytes starting at DESTINATION. */
-#define STORE_NUMBER(destination, number) \
- { (destination)[0] = (char)((number) & 0377); \
- (destination)[1] = (number) >> 8; }
-
-/* Same as STORE_NUMBER, except increment the destination pointer to
- the byte after where the number is stored. Watch out that values for
- DESTINATION such as p + 1 won't work, whereas p will. */
-#define STORE_NUMBER_AND_INCR(destination, number) \
- { STORE_NUMBER(destination, number); \
- (destination) += 2; }
-
-
-/* Put into DESTINATION a number stored in two contingous bytes starting
- at SOURCE. */
-#define EXTRACT_NUMBER(destination, source) \
- { (destination) = *(source) & 0377; \
- (destination) += SIGN_EXTEND_CHAR (*(char *)((source) + 1)) << 8; }
-
-/* Same as EXTRACT_NUMBER, except increment the pointer for source to
- point to second byte of SOURCE. Note that SOURCE has to be a value
- such as p, not, e.g., p + 1. */
-#define EXTRACT_NUMBER_AND_INCR(destination, source) \
- { EXTRACT_NUMBER (destination, source); \
- (source) += 2; }
-
-
-/* Specify the precise syntax of regexps for compilation. This provides
- for compatibility for various utilities which historically have
- different, incompatible syntaxes.
-
- The argument SYNTAX is a bit-mask comprised of the various bits
- defined in regex.h. */
-
-int
-re_set_syntax (int syntax)
-{
- int ret;
-
- ret = obscure_syntax;
- obscure_syntax = syntax;
- return ret;
-}
-
-/* Set by re_set_syntax to the current regexp syntax to recognize. */
-int obscure_syntax = 0;
-
-
-
-/* Macros for re_compile_pattern, which is found below these definitions. */
-
-#define CHAR_CLASS_MAX_LENGTH 6
-
-/* Fetch the next character in the uncompiled pattern, translating it if
- necessary. */
-#define PATFETCH(c) \
- {if (p == pend) goto end_of_pattern; \
- c = * (const unsigned char *) p++; \
- if (translate) c = translate[c]; }
-
-/* Fetch the next character in the uncompiled pattern, with no
- translation. */
-#define PATFETCH_RAW(c) \
- {if (p == pend) goto end_of_pattern; \
- c = * (const unsigned char *) p++; }
-
-#define PATUNFETCH p--
-
-
-/* If the buffer isn't allocated when it comes in, use this. */
-#define INIT_BUF_SIZE 28
-
-/* Make sure we have at least N more bytes of space in buffer. */
-#define GET_BUFFER_SPACE(n) \
- { \
- while (b - bufp->buffer + (n) >= bufp->allocated) \
- EXTEND_BUFFER; \
- }
-
-/* Make sure we have one more byte of buffer space and then add CH to it. */
-#define BUFPUSH(ch) \
- { \
- GET_BUFFER_SPACE (1); \
- *b++ = (char) (ch); \
- }
-
-/* Extend the buffer by twice its current size via reallociation and
- reset the pointers that pointed into the old allocation to point to
- the correct places in the new allocation. If extending the buffer
- results in it being larger than 1 << 16, then flag memory exhausted. */
-#define EXTEND_BUFFER \
- { char *old_buffer = bufp->buffer; \
- if (bufp->allocated == (1L<<16)) goto too_big; \
- bufp->allocated *= 2; \
- if (bufp->allocated > (1L<<16)) bufp->allocated = (1L<<16); \
- bufp->buffer = (char *) realloc (bufp->buffer, bufp->allocated); \
- if (bufp->buffer == 0) \
- goto memory_exhausted; \
- b = (b - old_buffer) + bufp->buffer; \
- if (fixup_jump) \
- fixup_jump = (fixup_jump - old_buffer) + bufp->buffer; \
- if (laststart) \
- laststart = (laststart - old_buffer) + bufp->buffer; \
- begalt = (begalt - old_buffer) + bufp->buffer; \
- if (pending_exact) \
- pending_exact = (pending_exact - old_buffer) + bufp->buffer; \
- }
-
-/* Set the bit for character C in a character set list. */
-#define SET_LIST_BIT(c) (b[(c) / BYTEWIDTH] |= 1 << ((c) % BYTEWIDTH))
-
-/* Get the next unsigned number in the uncompiled pattern. */
-#define GET_UNSIGNED_NUMBER(num) \
- { if (p != pend) \
- { \
- PATFETCH (c); \
- while (isdigit (c)) \
- { \
- if (num < 0) \
- num = 0; \
- num = num * 10 + c - '0'; \
- if (p == pend) \
- break; \
- PATFETCH (c); \
- } \
- } \
- }
-
-/* Subroutines for re_compile_pattern. */
-static void store_jump (char *from, char opcode, char *to);
-static void insert_jump (char op, char *from, char *to, char *current_end);
-static void store_jump_n (char *from, char opcode, char *to, unsigned n);
-static void insert_jump_n (char, char *, char *, char *, unsigned);
-static void insert_op_2 (char, char *, char *_end, int, int);
-
-
-/* re_compile_pattern takes a regular-expression string
- and converts it into a buffer full of byte commands for matching.
-
- PATTERN is the address of the pattern string
- SIZE is the length of it.
- BUFP is a struct re_pattern_buffer * which points to the info
- on where to store the byte commands.
- This structure contains a char * which points to the
- actual space, which should have been obtained with malloc.
- re_compile_pattern may use realloc to grow the buffer space.
-
- The number of bytes of commands can be found out by looking in
- the `struct re_pattern_buffer' that bufp pointed to, after
- re_compile_pattern returns. */
-
-char *
-re_compile_pattern (const char *pattern, int size, struct re_pattern_buffer *bufp)
-{
- register char *b = bufp->buffer;
- register const char *p = pattern;
- const char *pend = pattern + size;
- register unsigned c, c1;
- const char *p1;
- unsigned char *translate = (unsigned char *) bufp->translate;
-
- /* Address of the count-byte of the most recently inserted `exactn'
- command. This makes it possible to tell whether a new exact-match
- character can be added to that command or requires a new `exactn'
- command. */
-
- char *pending_exact = 0;
-
- /* Address of the place where a forward-jump should go to the end of
- the containing expression. Each alternative of an `or', except the
- last, ends with a forward-jump of this sort. */
-
- char *fixup_jump = 0;
-
- /* Address of start of the most recently finished expression.
- This tells postfix * where to find the start of its operand. */
-
- char *laststart = 0;
-
- /* In processing a repeat, 1 means zero matches is allowed. */
-
- char zero_times_ok;
-
- /* In processing a repeat, 1 means many matches is allowed. */
-
- char many_times_ok;
-
- /* Address of beginning of regexp, or inside of last \(. */
-
- char *begalt = b;
-
- /* In processing an interval, at least this many matches must be made. */
- int lower_bound;
-
- /* In processing an interval, at most this many matches can be made. */
- int upper_bound;
-
- /* Place in pattern (i.e., the {) to which to go back if the interval
- is invalid. */
- const char *beg_interval = 0;
-
- /* Stack of information saved by \( and restored by \).
- Four stack elements are pushed by each \(:
- First, the value of b.
- Second, the value of fixup_jump.
- Third, the value of regnum.
- Fourth, the value of begalt. */
-
- int stackb[40];
- int *stackp = stackb;
- int *stacke = stackb + 40;
- int *stackt;
-
- /* Counts \('s as they are encountered. Remembered for the matching \),
- where it becomes the register number to put in the stop_memory
- command. */
-
- unsigned regnum = 1;
-
- bufp->fastmap_accurate = 0;
-
-#ifndef emacs
-#ifndef SYNTAX_TABLE
- /* Initialize the syntax table. */
- init_syntax_once();
-#endif
-#endif
-
- if (bufp->allocated == 0)
- {
- bufp->allocated = INIT_BUF_SIZE;
- if (bufp->buffer)
- /* EXTEND_BUFFER loses when bufp->allocated is 0. */
- bufp->buffer = (char *) realloc (bufp->buffer, INIT_BUF_SIZE);
- else
- /* Caller did not allocate a buffer. Do it for them. */
- bufp->buffer = (char *) malloc (INIT_BUF_SIZE);
- if (!bufp->buffer) goto memory_exhausted;
- begalt = b = bufp->buffer;
- }
-
- while (p != pend)
- {
- PATFETCH (c);
-
- switch (c)
- {
- case '$':
- {
- const char *p1 = p;
- /* When testing what follows the $,
- look past the \-constructs that don't consume anything. */
- if (! (obscure_syntax & RE_CONTEXT_INDEP_OPS))
- while (p1 != pend)
- {
- if (*p1 == '\\' && p1 + 1 != pend
- && (p1[1] == '<' || p1[1] == '>'
- || p1[1] == '`' || p1[1] == '\''
-#ifdef emacs
- || p1[1] == '='
-#endif
- || p1[1] == 'b' || p1[1] == 'B'))
- p1 += 2;
- else
- break;
- }
- if (obscure_syntax & RE_TIGHT_VBAR)
- {
- if (! (obscure_syntax & RE_CONTEXT_INDEP_OPS) && p1 != pend)
- goto normal_char;
- /* Make operand of last vbar end before this `$'. */
- if (fixup_jump)
- store_jump (fixup_jump, jump, b);
- fixup_jump = 0;
- BUFPUSH (endline);
- break;
- }
- /* $ means succeed if at end of line, but only in special contexts.
- If validly in the middle of a pattern, it is a normal character. */
-
- if ((obscure_syntax & RE_CONTEXTUAL_INVALID_OPS) && p1 != pend)
- goto invalid_pattern;
- if (p1 == pend || *p1 == '\n'
- || (obscure_syntax & RE_CONTEXT_INDEP_OPS)
- || (obscure_syntax & RE_NO_BK_PARENS
- ? *p1 == ')'
- : *p1 == '\\' && p1[1] == ')')
- || (obscure_syntax & RE_NO_BK_VBAR
- ? *p1 == '|'
- : *p1 == '\\' && p1[1] == '|'))
- {
- BUFPUSH (endline);
- break;
- }
- goto normal_char;
- }
- case '^':
- /* ^ means succeed if at beg of line, but only if no preceding
- pattern. */
-
- if ((obscure_syntax & RE_CONTEXTUAL_INVALID_OPS) && laststart)
- goto invalid_pattern;
- if (laststart && p - 2 >= pattern && p[-2] != '\n'
- && !(obscure_syntax & RE_CONTEXT_INDEP_OPS))
- goto normal_char;
- if (obscure_syntax & RE_TIGHT_VBAR)
- {
- if (p != pattern + 1
- && ! (obscure_syntax & RE_CONTEXT_INDEP_OPS))
- goto normal_char;
- BUFPUSH (begline);
- begalt = b;
- }
- else
- BUFPUSH (begline);
- break;
-
- case '+':
- case '?':
- if ((obscure_syntax & RE_BK_PLUS_QM)
- || (obscure_syntax & RE_LIMITED_OPS))
- goto normal_char;
- handle_plus:
- case '*':
- /* If there is no previous pattern, char not special. */
- if (!laststart)
- {
- if (obscure_syntax & RE_CONTEXTUAL_INVALID_OPS)
- goto invalid_pattern;
- else if (! (obscure_syntax & RE_CONTEXT_INDEP_OPS))
- goto normal_char;
- }
- /* If there is a sequence of repetition chars,
- collapse it down to just one. */
- zero_times_ok = 0;
- many_times_ok = 0;
- while (1)
- {
- zero_times_ok |= c != '+';
- many_times_ok |= c != '?';
- if (p == pend)
- break;
- PATFETCH (c);
- if (c == '*')
- ;
- else if (!(obscure_syntax & RE_BK_PLUS_QM)
- && (c == '+' || c == '?'))
- ;
- else if ((obscure_syntax & RE_BK_PLUS_QM)
- && c == '\\')
- {
- int c1;
- PATFETCH (c1);
- if (!(c1 == '+' || c1 == '?'))
- {
- PATUNFETCH;
- PATUNFETCH;
- break;
- }
- c = c1;
- }
- else
- {
- PATUNFETCH;
- break;
- }
- }
-
- /* Star, etc. applied to an empty pattern is equivalent
- to an empty pattern. */
- if (!laststart)
- break;
-
- /* Now we know whether or not zero matches is allowed
- and also whether or not two or more matches is allowed. */
- if (many_times_ok)
- {
- /* If more than one repetition is allowed, put in at the
- end a backward relative jump from b to before the next
- jump we're going to put in below (which jumps from
- laststart to after this jump). */
- GET_BUFFER_SPACE (3);
- store_jump (b, maybe_finalize_jump, laststart - 3);
- b += 3; /* Because store_jump put stuff here. */
- }
- /* On failure, jump from laststart to b + 3, which will be the
- end of the buffer after this jump is inserted. */
- GET_BUFFER_SPACE (3);
- insert_jump (on_failure_jump, laststart, b + 3, b);
- pending_exact = 0;
- b += 3;
- if (!zero_times_ok)
- {
- /* At least one repetition is required, so insert a
- dummy-failure before the initial on-failure-jump
- instruction of the loop. This effects a skip over that
- instruction the first time we hit that loop. */
- GET_BUFFER_SPACE (6);
- insert_jump (dummy_failure_jump, laststart, laststart + 6, b);
- b += 3;
- }
- break;
-
- case '.':
- laststart = b;
- BUFPUSH (anychar);
- break;
-
- case '[':
- if (p == pend)
- goto invalid_pattern;
- while (b - bufp->buffer
- > bufp->allocated - 3 - (1 << BYTEWIDTH) / BYTEWIDTH)
- EXTEND_BUFFER;
-
- laststart = b;
- if (*p == '^')
- {
- BUFPUSH (charset_not);
- p++;
- }
- else
- BUFPUSH (charset);
- p1 = p;
-
- BUFPUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
- /* Clear the whole map */
- memset (b, 0, (1 << BYTEWIDTH) / BYTEWIDTH);
-
- if ((obscure_syntax & RE_HAT_NOT_NEWLINE) && b[-2] == charset_not)
- SET_LIST_BIT ('\n');
-
-
- /* Read in characters and ranges, setting map bits. */
- while (1)
- {
- /* Don't translate while fetching, in case it's a range bound.
- When we set the bit for the character, we translate it. */
- PATFETCH_RAW (c);
-
- /* If set, \ escapes characters when inside [...]. */
- if ((obscure_syntax & RE_AWK_CLASS_HACK) && c == '\\')
- {
- PATFETCH(c1);
- SET_LIST_BIT (c1);
- continue;
- }
- if (c == ']')
- {
- if (p == p1 + 1)
- {
- /* If this is an empty bracket expression. */
- if ((obscure_syntax & RE_NO_EMPTY_BRACKETS)
- && p == pend)
- goto invalid_pattern;
- }
- else
- /* Stop if this isn't merely a ] inside a bracket
- expression, but rather the end of a bracket
- expression. */
- break;
- }
- /* Get a range. */
- if (p[0] == '-' && p[1] != ']')
- {
- PATFETCH (c1);
- /* Don't translate the range bounds while fetching them. */
- PATFETCH_RAW (c1);
-
- if ((obscure_syntax & RE_NO_EMPTY_RANGES) && c > c1)
- goto invalid_pattern;
-
- if ((obscure_syntax & RE_NO_HYPHEN_RANGE_END)
- && c1 == '-' && *p != ']')
- goto invalid_pattern;
-
- while (c <= c1)
- {
- /* Translate each char that's in the range. */
- if (translate)
- SET_LIST_BIT (translate[c]);
- else
- SET_LIST_BIT (c);
- c++;
- }
- }
- else if ((obscure_syntax & RE_CHAR_CLASSES)
- && c == '[' && p[0] == ':')
- {
- /* Longest valid character class word has six characters. */
- char str[CHAR_CLASS_MAX_LENGTH];
- PATFETCH (c);
- c1 = 0;
- /* If no ] at end. */
- if (p == pend)
- goto invalid_pattern;
- while (1)
- {
- /* Don't translate the ``character class'' characters. */
- PATFETCH_RAW (c);
- if (c == ':' || c == ']' || p == pend
- || c1 == CHAR_CLASS_MAX_LENGTH)
- break;
- str[c1++] = c;
- }
- str[c1] = '\0';
- if (p == pend
- || c == ']' /* End of the bracket expression. */
- || p[0] != ']'
- || p + 1 == pend
- || (strcmp (str, "alpha") != 0
- && strcmp (str, "upper") != 0
- && strcmp (str, "lower") != 0
- && strcmp (str, "digit") != 0
- && strcmp (str, "alnum") != 0
- && strcmp (str, "xdigit") != 0
- && strcmp (str, "space") != 0
- && strcmp (str, "print") != 0
- && strcmp (str, "punct") != 0
- && strcmp (str, "graph") != 0
- && strcmp (str, "cntrl") != 0))
- {
- /* Undo the ending character, the letters, and leave
- the leading : and [ (but set bits for them). */
- c1++;
- while (c1--)
- PATUNFETCH;
- SET_LIST_BIT ('[');
- SET_LIST_BIT (':');
- }
- else
- {
- /* The ] at the end of the character class. */
- PATFETCH (c);
- if (c != ']')
- goto invalid_pattern;
- for (c = 0; c < (1 << BYTEWIDTH); c++)
- {
- if ((strcmp (str, "alpha") == 0 && isalpha (c))
- || (strcmp (str, "upper") == 0 && isupper (c))
- || (strcmp (str, "lower") == 0 && islower (c))
- || (strcmp (str, "digit") == 0 && isdigit (c))
- || (strcmp (str, "alnum") == 0 && isalnum (c))
- || (strcmp (str, "xdigit") == 0 && isxdigit (c))
- || (strcmp (str, "space") == 0 && isspace (c))
- || (strcmp (str, "print") == 0 && isprint (c))
- || (strcmp (str, "punct") == 0 && ispunct (c))
- || (strcmp (str, "graph") == 0 && isgraph (c))
- || (strcmp (str, "cntrl") == 0 && iscntrl (c)))
- SET_LIST_BIT (c);
- }
- }
- }
- else if (translate)
- SET_LIST_BIT (translate[c]);
- else
- SET_LIST_BIT (c);
- }
-
- /* Discard any character set/class bitmap bytes that are all
- 0 at the end of the map. Decrement the map-length byte too. */
- while ((int) b[-1] > 0 && b[b[-1] - 1] == 0)
- b[-1]--;
- b += b[-1];
- break;
-
- case '(':
- if (! (obscure_syntax & RE_NO_BK_PARENS))
- goto normal_char;
- else
- goto handle_open;
-
- case ')':
- if (! (obscure_syntax & RE_NO_BK_PARENS))
- goto normal_char;
- else
- goto handle_close;
-
- case '\n':
- if (! (obscure_syntax & RE_NEWLINE_OR))
- goto normal_char;
- else
- goto handle_bar;
-
- case '|':
- if ((obscure_syntax & RE_CONTEXTUAL_INVALID_OPS)
- && (! laststart || p == pend))
- goto invalid_pattern;
- else if (! (obscure_syntax & RE_NO_BK_VBAR))
- goto normal_char;
- else
- goto handle_bar;
-
- case '{':
- if (! ((obscure_syntax & RE_NO_BK_CURLY_BRACES)
- && (obscure_syntax & RE_INTERVALS)))
- goto normal_char;
- else
- goto handle_interval;
-
- case '\\':
- if (p == pend) goto invalid_pattern;
- PATFETCH_RAW (c);
- switch (c)
- {
- case '(':
- if (obscure_syntax & RE_NO_BK_PARENS)
- goto normal_backsl;
- handle_open:
- if (stackp == stacke) goto nesting_too_deep;
-
- /* Laststart should point to the start_memory that we are about
- to push (unless the pattern has RE_NREGS or more ('s). */
- *stackp++ = b - bufp->buffer;
- if (regnum < RE_NREGS)
- {
- BUFPUSH (start_memory);
- BUFPUSH (regnum);
- }
- *stackp++ = fixup_jump ? fixup_jump - bufp->buffer + 1 : 0;
- *stackp++ = regnum++;
- *stackp++ = begalt - bufp->buffer;
- fixup_jump = 0;
- laststart = 0;
- begalt = b;
- break;
-
- case ')':
- if (obscure_syntax & RE_NO_BK_PARENS)
- goto normal_backsl;
- handle_close:
- if (stackp == stackb) goto unmatched_close;
- begalt = *--stackp + bufp->buffer;
- if (fixup_jump)
- store_jump (fixup_jump, jump, b);
- if (stackp[-1] < RE_NREGS)
- {
- BUFPUSH (stop_memory);
- BUFPUSH (stackp[-1]);
- }
- stackp -= 2;
- fixup_jump = *stackp ? *stackp + bufp->buffer - 1 : 0;
- laststart = *--stackp + bufp->buffer;
- break;
-
- case '|':
- if ((obscure_syntax & RE_LIMITED_OPS)
- || (obscure_syntax & RE_NO_BK_VBAR))
- goto normal_backsl;
- handle_bar:
- if (obscure_syntax & RE_LIMITED_OPS)
- goto normal_char;
- /* Insert before the previous alternative a jump which
- jumps to this alternative if the former fails. */
- GET_BUFFER_SPACE (6);
- insert_jump (on_failure_jump, begalt, b + 6, b);
- pending_exact = 0;
- b += 3;
- /* The alternative before the previous alternative has a
- jump after it which gets executed if it gets matched.
- Adjust that jump so it will jump to the previous
- alternative's analogous jump (put in below, which in
- turn will jump to the next (if any) alternative's such
- jump, etc.). The last such jump jumps to the correct
- final destination. */
- if (fixup_jump)
- store_jump (fixup_jump, jump, b);
-
- /* Leave space for a jump after previous alternative---to be
- filled in later. */
- fixup_jump = b;
- b += 3;
-
- laststart = 0;
- begalt = b;
- break;
-
- case '{':
- if (! (obscure_syntax & RE_INTERVALS)
- /* Let \{ be a literal. */
- || ((obscure_syntax & RE_INTERVALS)
- && (obscure_syntax & RE_NO_BK_CURLY_BRACES))
- /* If it's the string "\{". */
- || (p - 2 == pattern && p == pend))
- goto normal_backsl;
- handle_interval:
- beg_interval = p - 1; /* The {. */
- /* If there is no previous pattern, this isn't an interval. */
- if (!laststart)
- {
- if (obscure_syntax & RE_CONTEXTUAL_INVALID_OPS)
- goto invalid_pattern;
- else
- goto normal_backsl;
- }
- /* It also isn't an interval if not preceded by an re
- matching a single character or subexpression, or if
- the current type of intervals can't handle back
- references and the previous thing is a back reference. */
- if (! (*laststart == anychar
- || *laststart == charset
- || *laststart == charset_not
- || *laststart == start_memory
- || (*laststart == exactn && laststart[1] == 1)
- || (! (obscure_syntax & RE_NO_BK_REFS)
- && *laststart == duplicate)))
- {
- if (obscure_syntax & RE_NO_BK_CURLY_BRACES)
- goto normal_char;
-
- /* Posix extended syntax is handled in previous
- statement; this is for Posix basic syntax. */
- if (obscure_syntax & RE_INTERVALS)
- goto invalid_pattern;
-
- goto normal_backsl;
- }
- lower_bound = -1; /* So can see if are set. */
- upper_bound = -1;
- GET_UNSIGNED_NUMBER (lower_bound);
- if (c == ',')
- {
- GET_UNSIGNED_NUMBER (upper_bound);
- if (upper_bound < 0)
- upper_bound = RE_DUP_MAX;
- }
- if (upper_bound < 0)
- upper_bound = lower_bound;
- if (! (obscure_syntax & RE_NO_BK_CURLY_BRACES))
- {
- if (c != '\\')
- goto invalid_pattern;
- PATFETCH (c);
- }
- if (c != '}' || lower_bound < 0 || upper_bound > RE_DUP_MAX
- || lower_bound > upper_bound
- || ((obscure_syntax & RE_NO_BK_CURLY_BRACES)
- && p != pend && *p == '{'))
- {
- if (obscure_syntax & RE_NO_BK_CURLY_BRACES)
- goto unfetch_interval;
- else
- goto invalid_pattern;
- }
-
- /* If upper_bound is zero, don't want to succeed at all;
- jump from laststart to b + 3, which will be the end of
- the buffer after this jump is inserted. */
-
- if (upper_bound == 0)
- {
- GET_BUFFER_SPACE (3);
- insert_jump (jump, laststart, b + 3, b);
- b += 3;
- }
-
- /* Otherwise, after lower_bound number of succeeds, jump
- to after the jump_n which will be inserted at the end
- of the buffer, and insert that jump_n. */
- else
- { /* Set to 5 if only one repetition is allowed and
- hence no jump_n is inserted at the current end of
- the buffer; then only space for the succeed_n is
- needed. Otherwise, need space for both the
- succeed_n and the jump_n. */
-
- unsigned slots_needed = upper_bound == 1 ? 5 : 10;
-
- GET_BUFFER_SPACE ((int) slots_needed);
- /* Initialize the succeed_n to n, even though it will
- be set by its attendant set_number_at, because
- re_compile_fastmap will need to know it. Jump to
- what the end of buffer will be after inserting
- this succeed_n and possibly appending a jump_n. */
- insert_jump_n (succeed_n, laststart, b + slots_needed,
- b, lower_bound);
- b += 5; /* Just increment for the succeed_n here. */
-
- /* More than one repetition is allowed, so put in at
- the end of the buffer a backward jump from b to the
- succeed_n we put in above. By the time we've gotten
- to this jump when matching, we'll have matched once
- already, so jump back only upper_bound - 1 times. */
-
- if (upper_bound > 1)
- {
- store_jump_n (b, jump_n, laststart, upper_bound - 1);
- b += 5;
- /* When hit this when matching, reset the
- preceding jump_n's n to upper_bound - 1. */
- BUFPUSH (set_number_at);
- GET_BUFFER_SPACE (2);
- STORE_NUMBER_AND_INCR (b, -5);
- STORE_NUMBER_AND_INCR (b, upper_bound - 1);
- }
- /* When hit this when matching, set the succeed_n's n. */
- GET_BUFFER_SPACE (5);
- insert_op_2 (set_number_at, laststart, b, 5, lower_bound);
- b += 5;
- }
- pending_exact = 0;
- beg_interval = 0;
- break;
-
-
- unfetch_interval:
- /* If an invalid interval, match the characters as literals. */
- if (beg_interval)
- p = beg_interval;
- else
- {
- fprintf (stderr,
- "regex: no interval beginning to which to backtrack.\n");
- exit (1);
- }
-
- beg_interval = 0;
- PATFETCH (c); /* normal_char expects char in `c'. */
- goto normal_char;
- break;
-
-#ifdef emacs
- case '=':
- BUFPUSH (at_dot);
- break;
-
- case 's':
- laststart = b;
- BUFPUSH (syntaxspec);
- PATFETCH (c);
- BUFPUSH (syntax_spec_code[c]);
- break;
-
- case 'S':
- laststart = b;
- BUFPUSH (notsyntaxspec);
- PATFETCH (c);
- BUFPUSH (syntax_spec_code[c]);
- break;
-#endif /* emacs */
-
- case 'w':
- laststart = b;
- BUFPUSH (wordchar);
- break;
-
- case 'W':
- laststart = b;
- BUFPUSH (notwordchar);
- break;
-
- case '<':
- BUFPUSH (wordbeg);
- break;
-
- case '>':
- BUFPUSH (wordend);
- break;
-
- case 'b':
- BUFPUSH (wordbound);
- break;
-
- case 'B':
- BUFPUSH (notwordbound);
- break;
-
- case '`':
- BUFPUSH (begbuf);
- break;
-
- case '\'':
- BUFPUSH (endbuf);
- break;
-
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (obscure_syntax & RE_NO_BK_REFS)
- goto normal_char;
- c1 = c - '0';
- if (c1 >= regnum)
- {
- if (obscure_syntax & RE_NO_EMPTY_BK_REF)
- goto invalid_pattern;
- else
- goto normal_char;
- }
- /* Can't back reference to a subexpression if inside of it. */
- for (stackt = stackp - 2; stackt > stackb; stackt -= 4)
- if (*stackt == c1)
- goto normal_char;
- laststart = b;
- BUFPUSH (duplicate);
- BUFPUSH (c1);
- break;
-
- case '+':
- case '?':
- if (obscure_syntax & RE_BK_PLUS_QM)
- goto handle_plus;
- else
- goto normal_backsl;
- break;
-
- default:
- normal_backsl:
- /* You might think it would be useful for \ to mean
- not to translate; but if we don't translate it
- it will never match anything. */
- if (translate) c = translate[c];
- goto normal_char;
- }
- break;
-
- default:
- normal_char: /* Expects the character in `c'. */
- if (!pending_exact || pending_exact + *pending_exact + 1 != b
- || *pending_exact == 0177 || *p == '*' || *p == '^'
- || ((obscure_syntax & RE_BK_PLUS_QM)
- ? *p == '\\' && (p[1] == '+' || p[1] == '?')
- : (*p == '+' || *p == '?'))
- || ((obscure_syntax & RE_INTERVALS)
- && ((obscure_syntax & RE_NO_BK_CURLY_BRACES)
- ? *p == '{'
- : (p[0] == '\\' && p[1] == '{'))))
- {
- laststart = b;
- BUFPUSH (exactn);
- pending_exact = b;
- BUFPUSH (0);
- }
- BUFPUSH (c);
- (*pending_exact)++;
- }
- }
-
- if (fixup_jump)
- store_jump (fixup_jump, jump, b);
-
- if (stackp != stackb) goto unmatched_open;
-
- bufp->used = b - bufp->buffer;
- return 0;
-
- invalid_pattern:
- return "Invalid regular expression";
-
- unmatched_open:
- return "Unmatched \\(";
-
- unmatched_close:
- return "Unmatched \\)";
-
- end_of_pattern:
- return "Premature end of regular expression";
-
- nesting_too_deep:
- return "Nesting too deep";
-
- too_big:
- return "Regular expression too big";
-
- memory_exhausted:
- return "Memory exhausted";
-}
-
-
-/* Store a jump of the form <OPCODE> <relative address>.
- Store in the location FROM a jump operation to jump to relative
- address FROM - TO. OPCODE is the opcode to store. */
-
-static void
-store_jump (char *from, char opcode, char *to)
-{
- from[0] = opcode;
- STORE_NUMBER(from + 1, to - (from + 3));
-}
-
-
-/* Open up space before char FROM, and insert there a jump to TO.
- CURRENT_END gives the end of the storage not in use, so we know
- how much data to copy up. OP is the opcode of the jump to insert.
-
- If you call this function, you must zero out pending_exact. */
-
-static void
-insert_jump (char op, char *from, char *to, char *current_end)
-{
- register char *pfrom = current_end; /* Copy from here... */
- register char *pto = current_end + 3; /* ...to here. */
-
- while (pfrom != from)
- *--pto = *--pfrom;
- store_jump (from, op, to);
-}
-
-
-/* Store a jump of the form <opcode> <relative address> <n> .
-
- Store in the location FROM a jump operation to jump to relative
- address FROM - TO. OPCODE is the opcode to store, N is a number the
- jump uses, say, to decide how many times to jump.
-
- If you call this function, you must zero out pending_exact. */
-
-static void
-store_jump_n (char *from, char opcode, char *to, unsigned n)
-{
- from[0] = opcode;
- STORE_NUMBER (from + 1, to - (from + 3));
- STORE_NUMBER (from + 3, n);
-}
-
-
-/* Similar to insert_jump, but handles a jump which needs an extra
- number to handle minimum and maximum cases. Open up space at
- location FROM, and insert there a jump to TO. CURRENT_END gives the
- end of the storage in use, so we know how much data to copy up. OP is
- the opcode of the jump to insert.
-
- If you call this function, you must zero out pending_exact. */
-
-static void
-insert_jump_n (char op, char *from, char *to, char *current_end, unsigned n)
-{
- register char *pfrom = current_end; /* Copy from here... */
- register char *pto = current_end + 5; /* ...to here. */
-
- while (pfrom != from)
- *--pto = *--pfrom;
- store_jump_n (from, op, to, n);
-}
-
-
-/* Open up space at location THERE, and insert operation OP followed by
- NUM_1 and NUM_2. CURRENT_END gives the end of the storage in use, so
- we know how much data to copy up.
-
- If you call this function, you must zero out pending_exact. */
-
-static void
-insert_op_2 (char op, char *there, char *current_end, int num_1, int num_2)
-{
- register char *pfrom = current_end; /* Copy from here... */
- register char *pto = current_end + 5; /* ...to here. */
-
- while (pfrom != there)
- *--pto = *--pfrom;
-
- there[0] = op;
- STORE_NUMBER (there + 1, num_1);
- STORE_NUMBER (there + 3, num_2);
-}
-
-
-
-/* Given a pattern, compute a fastmap from it. The fastmap records
- which of the (1 << BYTEWIDTH) possible characters can start a string
- that matches the pattern. This fastmap is used by re_search to skip
- quickly over totally implausible text.
-
- The caller must supply the address of a (1 << BYTEWIDTH)-byte data
- area as bufp->fastmap.
- The other components of bufp describe the pattern to be used. */
-
-void
-re_compile_fastmap (struct re_pattern_buffer *bufp)
-{
- unsigned char *pattern = (unsigned char *) bufp->buffer;
- int size = bufp->used;
- register char *fastmap = bufp->fastmap;
- register unsigned char *p = pattern;
- register unsigned char *pend = pattern + size;
- register int j, k;
- unsigned char *translate = (unsigned char *) bufp->translate;
-
- unsigned char *stackb[NFAILURES];
- unsigned char **stackp = stackb;
-
- unsigned is_a_succeed_n;
-
- memset (fastmap, 0, (1 << BYTEWIDTH));
- bufp->fastmap_accurate = 1;
- bufp->can_be_null = 0;
-
- while (p)
- {
- is_a_succeed_n = 0;
- if (p == pend)
- {
- bufp->can_be_null = 1;
- break;
- }
-#ifdef SWITCH_ENUM_BUG
- switch ((int) ((enum regexpcode) *p++))
-#else
- switch ((enum regexpcode) *p++)
-#endif
- {
- case exactn:
- if (translate)
- fastmap[translate[p[1]]] = 1;
- else
- fastmap[p[1]] = 1;
- break;
-
- case unused:
- case begline:
-#ifdef emacs
- case before_dot:
- case at_dot:
- case after_dot:
-#endif
- case begbuf:
- case endbuf:
- case wordbound:
- case notwordbound:
- case wordbeg:
- case wordend:
- continue;
-
- case endline:
- if (translate)
- fastmap[translate['\n']] = 1;
- else
- fastmap['\n'] = 1;
-
- if (bufp->can_be_null != 1)
- bufp->can_be_null = 2;
- break;
-
- case jump_n:
- case finalize_jump:
- case maybe_finalize_jump:
- case jump:
- case dummy_failure_jump:
- EXTRACT_NUMBER_AND_INCR (j, p);
- p += j;
- if (j > 0)
- continue;
- /* Jump backward reached implies we just went through
- the body of a loop and matched nothing.
- Opcode jumped to should be an on_failure_jump.
- Just treat it like an ordinary jump.
- For a * loop, it has pushed its failure point already;
- If so, discard that as redundant. */
-
- if ((enum regexpcode) *p != on_failure_jump
- && (enum regexpcode) *p != succeed_n)
- continue;
- p++;
- EXTRACT_NUMBER_AND_INCR (j, p);
- p += j;
- if (stackp != stackb && *stackp == p)
- stackp--;
- continue;
-
- case on_failure_jump:
- handle_on_failure_jump:
- EXTRACT_NUMBER_AND_INCR (j, p);
- *++stackp = p + j;
- if (is_a_succeed_n)
- EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */
- continue;
-
- case succeed_n:
- is_a_succeed_n = 1;
- /* Get to the number of times to succeed. */
- p += 2;
- /* Increment p past the n for when k != 0. */
- EXTRACT_NUMBER_AND_INCR (k, p);
- if (k == 0)
- {
- p -= 4;
- goto handle_on_failure_jump;
- }
- continue;
-
- case set_number_at:
- p += 4;
- continue;
-
- case start_memory:
- case stop_memory:
- p++;
- continue;
-
- case duplicate:
- bufp->can_be_null = 1;
- fastmap['\n'] = 1;
- case anychar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (j != '\n')
- fastmap[j] = 1;
- if (bufp->can_be_null)
- return;
- /* Don't return; check the alternative paths
- so we can set can_be_null if appropriate. */
- break;
-
- case wordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == Sword)
- fastmap[j] = 1;
- break;
-
- case notwordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != Sword)
- fastmap[j] = 1;
- break;
-
-#ifdef emacs
- case syntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
-
- case notsyntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
-#endif /* not emacs */
-
- case charset:
- for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
- {
- if (translate)
- fastmap[translate[j]] = 1;
- else
- fastmap[j] = 1;
- }
- break;
-
- case charset_not:
- /* Chars beyond end of map must be allowed */
- for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
- if (translate)
- fastmap[translate[j]] = 1;
- else
- fastmap[j] = 1;
-
- for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
- {
- if (translate)
- fastmap[translate[j]] = 1;
- else
- fastmap[j] = 1;
- }
- break;
- }
-
- /* Get here means we have successfully found the possible starting
- characters of one path of the pattern. We need not follow this
- path any farther. Instead, look at the next alternative
- remembered in the stack. */
- if (stackp != stackb)
- p = *stackp--;
- else
- break;
- }
-}
-
-
-
-/* Like re_search_2, below, but only one string is specified, and
- doesn't let you say where to stop matching. */
-
-int
-re_search (struct re_pattern_buffer *pbufp,
- char *string,
- int size,
- int startpos,
- int range,
- struct re_registers *regs)
-{
- return re_search_2 (pbufp, (char *) 0, 0, string, size, startpos, range,
- regs, size);
-}
-
-
-/* Using the compiled pattern in PBUFP->buffer, first tries to match the
- virtual concatenation of STRING1 and STRING2, starting first at index
- STARTPOS, then at STARTPOS + 1, and so on. RANGE is the number of
- places to try before giving up. If RANGE is negative, it searches
- backwards, i.e., the starting positions tried are STARTPOS, STARTPOS
- - 1, etc. STRING1 and STRING2 are of SIZE1 and SIZE2, respectively.
- In REGS, return the indices of the virtual concatenation of STRING1
- and STRING2 that matched the entire PBUFP->buffer and its contained
- subexpressions. Do not consider matching one past the index MSTOP in
- the virtual concatenation of STRING1 and STRING2.
-
- The value returned is the position in the strings at which the match
- was found, or -1 if no match was found, or -2 if error (such as
- failure stack overflow). */
-
-int
-re_search_2 (struct re_pattern_buffer *pbufp,
- char *string1, int size1,
- char *string2, int size2,
- int startpos,
- register int range,
- struct re_registers *regs,
- int mstop)
-{
- register char *fastmap = pbufp->fastmap;
- register unsigned char *translate = (unsigned char *) pbufp->translate;
- int total_size = size1 + size2;
- int endpos = startpos + range;
- int val;
-
- /* Check for out-of-range starting position. */
- if (startpos < 0 || startpos > total_size)
- return -1;
-
- /* Fix up range if it would eventually take startpos outside of the
- virtual concatenation of string1 and string2. */
- if (endpos < -1)
- range = -1 - startpos;
- else if (endpos > total_size)
- range = total_size - startpos;
-
- /* Update the fastmap now if not correct already. */
- if (fastmap && !pbufp->fastmap_accurate)
- re_compile_fastmap (pbufp);
-
- /* If the search isn't to be a backwards one, don't waste time in a
- long search for a pattern that says it is anchored. */
- if (pbufp->used > 0 && (enum regexpcode) pbufp->buffer[0] == begbuf
- && range > 0)
- {
- if (startpos > 0)
- return -1;
- else
- range = 1;
- }
-
- while (1)
- {
- /* If a fastmap is supplied, skip quickly over characters that
- cannot possibly be the start of a match. Note, however, that
- if the pattern can possibly match the null string, we must
- test it at each starting point so that we take the first null
- string we get. */
-
- if (fastmap && startpos < total_size && pbufp->can_be_null != 1)
- {
- if (range > 0) /* Searching forwards. */
- {
- register int lim = 0;
- register unsigned char *p;
- int irange = range;
- if (startpos < size1 && startpos + range >= size1)
- lim = range - (size1 - startpos);
-
- p = ((unsigned char *)
- &(startpos >= size1 ? string2 - size1 : string1)[startpos]);
-
- while (range > lim && !fastmap[translate
- ? translate[*p++]
- : *p++])
- range--;
- startpos += irange - range;
- }
- else /* Searching backwards. */
- {
- register unsigned char c;
-
- if (string1 == 0 || startpos >= size1)
- c = string2[startpos - size1];
- else
- c = string1[startpos];
-
- c &= 0xff;
- if (translate ? !fastmap[translate[c]] : !fastmap[c])
- goto advance;
- }
- }
-
- if (range >= 0 && startpos == total_size
- && fastmap && pbufp->can_be_null == 0)
- return -1;
-
- val = re_match_2 (pbufp, string1, size1, string2, size2, startpos,
- regs, mstop);
- if (val >= 0)
- return startpos;
- if (val == -2)
- return -2;
-
-#ifdef C_ALLOCA
- alloca (0);
-#endif /* C_ALLOCA */
-
- advance:
- if (!range)
- break;
- else if (range > 0)
- {
- range--;
- startpos++;
- }
- else
- {
- range++;
- startpos--;
- }
- }
- return -1;
-}
-
-
-
-#ifndef emacs /* emacs never uses this. */
-int
-re_match (struct re_pattern_buffer *pbufp,
- char *string,
- int size,
- int pos,
- struct re_registers *regs)
-{
- return re_match_2 (pbufp, (char *) 0, 0, string, size, pos, regs, size);
-}
-#endif /* not emacs */
-
-
-/* The following are used for re_match_2, defined below: */
-
-/* Roughly the maximum number of failure points on the stack. Would be
- exactly that if always pushed MAX_NUM_FAILURE_ITEMS each time we failed. */
-
-int re_max_failures = 2000;
-
-/* Routine used by re_match_2. */
-static int bcmp_translate (char *, char *, int, unsigned char *);
-
-
-/* Structure and accessing macros used in re_match_2: */
-
-struct register_info
-{
- unsigned is_active : 1;
- unsigned matched_something : 1;
-};
-
-#define IS_ACTIVE(R) ((R).is_active)
-#define MATCHED_SOMETHING(R) ((R).matched_something)
-
-
-/* Macros used by re_match_2: */
-
-
-/* I.e., regstart, regend, and reg_info. */
-
-#define NUM_REG_ITEMS 3
-
-/* We push at most this many things on the stack whenever we
- fail. The `+ 2' refers to PATTERN_PLACE and STRING_PLACE, which are
- arguments to the PUSH_FAILURE_POINT macro. */
-
-#define MAX_NUM_FAILURE_ITEMS (RE_NREGS * NUM_REG_ITEMS + 2)
-
-
-/* We push this many things on the stack whenever we fail. */
-
-#define NUM_FAILURE_ITEMS (last_used_reg * NUM_REG_ITEMS + 2)
-
-
-/* This pushes most of the information about the current state we will want
- if we ever fail back to it. */
-
-#define PUSH_FAILURE_POINT(pattern_place, string_place) \
- { \
- short last_used_reg, this_reg; \
- \
- /* Find out how many registers are active or have been matched. \
- (Aside from register zero, which is only set at the end.) */ \
- for (last_used_reg = RE_NREGS - 1; last_used_reg > 0; last_used_reg--)\
- if (regstart[last_used_reg] != (unsigned char *) -1) \
- break; \
- \
- if (stacke - stackp < NUM_FAILURE_ITEMS) \
- { \
- unsigned char **stackx; \
- int len = stacke - stackb; \
- if (len > re_max_failures * MAX_NUM_FAILURE_ITEMS) \
- return -2; \
- \
- /* Roughly double the size of the stack. */ \
- stackx = (unsigned char **) alloca (2 * len \
- * sizeof (unsigned char *));\
- /* Only copy what is in use. */ \
- memcpy (stackx, stackb, len * sizeof (char *)); \
- stackp = stackx + (stackp - stackb); \
- stackb = stackx; \
- stacke = stackb + 2 * len; \
- } \
- \
- /* Now push the info for each of those registers. */ \
- for (this_reg = 1; this_reg <= last_used_reg; this_reg++) \
- { \
- *stackp++ = regstart[this_reg]; \
- *stackp++ = regend[this_reg]; \
- *stackp++ = (unsigned char *) &reg_info[this_reg]; \
- } \
- \
- /* Push how many registers we saved. */ \
- *stackp++ = (unsigned char *) last_used_reg; \
- \
- *stackp++ = pattern_place; \
- *stackp++ = string_place; \
- }
-
-
-/* This pops what PUSH_FAILURE_POINT pushes. */
-
-#define POP_FAILURE_POINT() \
- { \
- int temp; \
- stackp -= 2; /* Remove failure points. */ \
- temp = (int) *--stackp; /* How many regs pushed. */ \
- temp *= NUM_REG_ITEMS; /* How much to take off the stack. */ \
- stackp -= temp; /* Remove the register info. */ \
- }
-
-
-#define MATCHING_IN_FIRST_STRING (dend == end_match_1)
-
-/* Is true if there is a first string and if PTR is pointing anywhere
- inside it or just past the end. */
-
-#define IS_IN_FIRST_STRING(ptr) \
- (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
-
-/* Call before fetching a character with *d. This switches over to
- string2 if necessary. */
-
-#define PREFETCH \
- while (d == dend) \
- { \
- /* end of string2 => fail. */ \
- if (dend == end_match_2) \
- goto fail; \
- /* end of string1 => advance to string2. */ \
- d = string2; \
- dend = end_match_2; \
- }
-
-
-/* Call this when have matched something; it sets `matched' flags for the
- registers corresponding to the subexpressions of which we currently
- are inside. */
-#define SET_REGS_MATCHED \
- { unsigned this_reg; \
- for (this_reg = 0; this_reg < RE_NREGS; this_reg++) \
- { \
- if (IS_ACTIVE(reg_info[this_reg])) \
- MATCHED_SOMETHING(reg_info[this_reg]) = 1; \
- else \
- MATCHED_SOMETHING(reg_info[this_reg]) = 0; \
- } \
- }
-
-/* Test if at very beginning or at very end of the virtual concatenation
- of string1 and string2. If there is only one string, we've put it in
- string2. */
-
-#define AT_STRINGS_BEG (d == (size1 ? string1 : string2) || !size2)
-#define AT_STRINGS_END (d == end2)
-
-#define AT_WORD_BOUNDARY \
- (AT_STRINGS_BEG || AT_STRINGS_END || IS_A_LETTER (d - 1) != IS_A_LETTER (d))
-
-/* We have two special cases to check for:
- 1) if we're past the end of string1, we have to look at the first
- character in string2;
- 2) if we're before the beginning of string2, we have to look at the
- last character in string1; we assume there is a string1, so use
- this in conjunction with AT_STRINGS_BEG. */
-#define IS_A_LETTER(d) \
- (SYNTAX ((d) == end1 ? *string2 : (d) == string2 - 1 ? *(end1 - 1) : *(d))\
- == Sword)
-
-
-/* Match the pattern described by PBUFP against the virtual
- concatenation of STRING1 and STRING2, which are of SIZE1 and SIZE2,
- respectively. Start the match at index POS in the virtual
- concatenation of STRING1 and STRING2. In REGS, return the indices of
- the virtual concatenation of STRING1 and STRING2 that matched the
- entire PBUFP->buffer and its contained subexpressions. Do not
- consider matching one past the index MSTOP in the virtual
- concatenation of STRING1 and STRING2.
-
- If pbufp->fastmap is nonzero, then it had better be up to date.
-
- The reason that the data to match are specified as two components
- which are to be regarded as concatenated is so this function can be
- used directly on the contents of an Emacs buffer.
-
- -1 is returned if there is no match. -2 is returned if there is an
- error (such as match stack overflow). Otherwise the value is the
- length of the substring which was matched. */
-
-int
-re_match_2 (struct re_pattern_buffer *pbufp,
- char *string1_arg, int size1,
- char *string2_arg, int size2,
- int pos,
- struct re_registers *regs,
- int mstop)
-{
- register unsigned char *p = (unsigned char *) pbufp->buffer;
-
- /* Pointer to beyond end of buffer. */
- register unsigned char *pend = p + pbufp->used;
-
- unsigned char *string1 = (unsigned char *) string1_arg;
- unsigned char *string2 = (unsigned char *) string2_arg;
- unsigned char *end1; /* Just past end of first string. */
- unsigned char *end2; /* Just past end of second string. */
-
- /* Pointers into string1 and string2, just past the last characters in
- each to consider matching. */
- unsigned char *end_match_1, *end_match_2;
-
- register unsigned char *d, *dend;
- register int mcnt; /* Multipurpose. */
- unsigned char *translate = (unsigned char *) pbufp->translate;
- unsigned is_a_jump_n = 0;
-
- /* Failure point stack. Each place that can handle a failure further
- down the line pushes a failure point on this stack. It consists of
- restart, regend, and reg_info for all registers corresponding to the
- subexpressions we're currently inside, plus the number of such
- registers, and, finally, two char *'s. The first char * is where to
- resume scanning the pattern; the second one is where to resume
- scanning the strings. If the latter is zero, the failure point is a
- ``dummy''; if a failure happens and the failure point is a dummy, it
- gets discarded and the next next one is tried. */
-
- unsigned char *initial_stack[MAX_NUM_FAILURE_ITEMS * NFAILURES];
- unsigned char **stackb = initial_stack;
- unsigned char **stackp = stackb;
- unsigned char **stacke = &stackb[MAX_NUM_FAILURE_ITEMS * NFAILURES];
-
-
- /* Information on the contents of registers. These are pointers into
- the input strings; they record just what was matched (on this
- attempt) by a subexpression part of the pattern, that is, the
- regnum-th regstart pointer points to where in the pattern we began
- matching and the regnum-th regend points to right after where we
- stopped matching the regnum-th subexpression. (The zeroth register
- keeps track of what the whole pattern matches.) */
-
- unsigned char *regstart[RE_NREGS];
- unsigned char *regend[RE_NREGS];
-
- /* The is_active field of reg_info helps us keep track of which (possibly
- nested) subexpressions we are currently in. The matched_something
- field of reg_info[reg_num] helps us tell whether or not we have
- matched any of the pattern so far this time through the reg_num-th
- subexpression. These two fields get reset each time through any
- loop their register is in. */
-
- struct register_info reg_info[RE_NREGS];
-
-
- /* The following record the register info as found in the above
- variables when we find a match better than any we've seen before.
- This happens as we backtrack through the failure points, which in
- turn happens only if we have not yet matched the entire string. */
-
- unsigned best_regs_set = 0;
- unsigned char *best_regstart[RE_NREGS];
- unsigned char *best_regend[RE_NREGS];
-
- /* Initialize subexpression text positions to -1 to mark ones that no
- \( or ( and \) or ) has been seen for. Also set all registers to
- inactive and mark them as not having matched anything or ever
- failed. */
- for (mcnt = 0; mcnt < RE_NREGS; mcnt++)
- {
- regstart[mcnt] = regend[mcnt] = (unsigned char *) -1;
- IS_ACTIVE (reg_info[mcnt]) = 0;
- MATCHED_SOMETHING (reg_info[mcnt]) = 0;
- }
-
- if (regs)
- for (mcnt = 0; mcnt < RE_NREGS; mcnt++)
- regs->start[mcnt] = regs->end[mcnt] = -1;
-
- /* Set up pointers to ends of strings.
- Don't allow the second string to be empty unless both are empty. */
- if (size2 == 0)
- {
- string2 = string1;
- size2 = size1;
- string1 = 0;
- size1 = 0;
- }
- end1 = string1 + size1;
- end2 = string2 + size2;
-
- /* Compute where to stop matching, within the two strings. */
- if (mstop <= size1)
- {
- end_match_1 = string1 + mstop;
- end_match_2 = string2;
- }
- else
- {
- end_match_1 = end1;
- end_match_2 = string2 + mstop - size1;
- }
-
- /* `p' scans through the pattern as `d' scans through the data. `dend'
- is the end of the input string that `d' points within. `d' is
- advanced into the following input string whenever necessary, but
- this happens before fetching; therefore, at the beginning of the
- loop, `d' can be pointing at the end of a string, but it cannot
- equal string2. */
-
- if (size1 != 0 && pos <= size1)
- d = string1 + pos, dend = end_match_1;
- else
- d = string2 + pos - size1, dend = end_match_2;
-
-
- /* This loops over pattern commands. It exits by returning from the
- function if match is complete, or it drops through if match fails
- at this starting point in the input data. */
-
- while (1)
- {
- is_a_jump_n = 0;
- /* End of pattern means we might have succeeded. */
- if (p == pend)
- {
- /* If not end of string, try backtracking. Otherwise done. */
- if (d != end_match_2)
- {
- if (stackp != stackb)
- {
- /* More failure points to try. */
-
- unsigned in_same_string =
- IS_IN_FIRST_STRING (best_regend[0])
- == MATCHING_IN_FIRST_STRING;
-
- /* If exceeds best match so far, save it. */
- if (! best_regs_set
- || (in_same_string && d > best_regend[0])
- || (! in_same_string && ! MATCHING_IN_FIRST_STRING))
- {
- best_regs_set = 1;
- best_regend[0] = d; /* Never use regstart[0]. */
-
- for (mcnt = 1; mcnt < RE_NREGS; mcnt++)
- {
- best_regstart[mcnt] = regstart[mcnt];
- best_regend[mcnt] = regend[mcnt];
- }
- }
- goto fail;
- }
- /* If no failure points, don't restore garbage. */
- else if (best_regs_set)
- {
- restore_best_regs:
- /* Restore best match. */
- d = best_regend[0];
-
- for (mcnt = 0; mcnt < RE_NREGS; mcnt++)
- {
- regstart[mcnt] = best_regstart[mcnt];
- regend[mcnt] = best_regend[mcnt];
- }
- }
- }
-
- /* If caller wants register contents data back, convert it
- to indices. */
- if (regs)
- {
- regs->start[0] = pos;
- if (MATCHING_IN_FIRST_STRING)
- regs->end[0] = d - string1;
- else
- regs->end[0] = d - string2 + size1;
- for (mcnt = 1; mcnt < RE_NREGS; mcnt++)
- {
- if (regend[mcnt] == (unsigned char *) -1)
- {
- regs->start[mcnt] = -1;
- regs->end[mcnt] = -1;
- continue;
- }
- if (IS_IN_FIRST_STRING (regstart[mcnt]))
- regs->start[mcnt] = regstart[mcnt] - string1;
- else
- regs->start[mcnt] = regstart[mcnt] - string2 + size1;
-
- if (IS_IN_FIRST_STRING (regend[mcnt]))
- regs->end[mcnt] = regend[mcnt] - string1;
- else
- regs->end[mcnt] = regend[mcnt] - string2 + size1;
- }
- }
- return d - pos - (MATCHING_IN_FIRST_STRING
- ? string1
- : string2 - size1);
- }
-
- /* Otherwise match next pattern command. */
-#ifdef SWITCH_ENUM_BUG
- switch ((int) ((enum regexpcode) *p++))
-#else
- switch ((enum regexpcode) *p++)
-#endif
- {
-
- /* \( [or `(', as appropriate] is represented by start_memory,
- \) by stop_memory. Both of those commands are followed by
- a register number in the next byte. The text matched
- within the \( and \) is recorded under that number. */
- case start_memory:
- regstart[*p] = d;
- IS_ACTIVE (reg_info[*p]) = 1;
- MATCHED_SOMETHING (reg_info[*p]) = 0;
- p++;
- break;
-
- case stop_memory:
- regend[*p] = d;
- IS_ACTIVE (reg_info[*p]) = 0;
-
- /* If just failed to match something this time around with a sub-
- expression that's in a loop, try to force exit from the loop. */
- if ((! MATCHED_SOMETHING (reg_info[*p])
- || (enum regexpcode) p[-3] == start_memory)
- && (p + 1) != pend)
- {
- register unsigned char *p2 = p + 1;
- mcnt = 0;
- switch (*p2++)
- {
- case jump_n:
- is_a_jump_n = 1;
- case finalize_jump:
- case maybe_finalize_jump:
- case jump:
- case dummy_failure_jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p2);
- if (is_a_jump_n)
- p2 += 2;
- break;
- }
- p2 += mcnt;
-
- /* If the next operation is a jump backwards in the pattern
- to an on_failure_jump, exit from the loop by forcing a
- failure after pushing on the stack the on_failure_jump's
- jump in the pattern, and d. */
- if (mcnt < 0 && (enum regexpcode) *p2++ == on_failure_jump)
- {
- EXTRACT_NUMBER_AND_INCR (mcnt, p2);
- PUSH_FAILURE_POINT (p2 + mcnt, d);
- goto fail;
- }
- }
- p++;
- break;
-
- /* \<digit> has been turned into a `duplicate' command which is
- followed by the numeric value of <digit> as the register number. */
- case duplicate:
- {
- int regno = *p++; /* Get which register to match against */
- register unsigned char *d2, *dend2;
-
- /* Where in input to try to start matching. */
- d2 = regstart[regno];
-
- /* Where to stop matching; if both the place to start and
- the place to stop matching are in the same string, then
- set to the place to stop, otherwise, for now have to use
- the end of the first string. */
-
- dend2 = ((IS_IN_FIRST_STRING (regstart[regno])
- == IS_IN_FIRST_STRING (regend[regno]))
- ? regend[regno] : end_match_1);
- while (1)
- {
- /* If necessary, advance to next segment in register
- contents. */
- while (d2 == dend2)
- {
- if (dend2 == end_match_2) break;
- if (dend2 == regend[regno]) break;
- d2 = string2, dend2 = regend[regno]; /* end of string1 => advance to string2. */
- }
- /* At end of register contents => success */
- if (d2 == dend2) break;
-
- /* If necessary, advance to next segment in data. */
- PREFETCH;
-
- /* How many characters left in this segment to match. */
- mcnt = dend - d;
-
- /* Want how many consecutive characters we can match in
- one shot, so, if necessary, adjust the count. */
- if (mcnt > dend2 - d2)
- mcnt = dend2 - d2;
-
- /* Compare that many; failure if mismatch, else move
- past them. */
- if (translate
- ? bcmp_translate ((char*)d, (char*)d2, mcnt, translate)
- : memcmp (d, d2, mcnt))
- goto fail;
- d += mcnt, d2 += mcnt;
- }
- }
- break;
-
- case anychar:
- PREFETCH; /* Fetch a data character. */
- /* Match anything but a newline, maybe even a null. */
- if ((translate ? translate[*d] : *d) == '\n'
- || ((obscure_syntax & RE_DOT_NOT_NULL)
- && (translate ? translate[*d] : *d) == '\000'))
- goto fail;
- SET_REGS_MATCHED;
- d++;
- break;
-
- case charset:
- case charset_not:
- {
- int not = 0; /* Nonzero for charset_not. */
- register int c;
- if (*(p - 1) == (unsigned char) charset_not)
- not = 1;
-
- PREFETCH; /* Fetch a data character. */
-
- if (translate)
- c = translate[*d];
- else
- c = *d;
-
- if (c < *p * BYTEWIDTH
- && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
-
- p += 1 + *p;
-
- if (!not) goto fail;
- SET_REGS_MATCHED;
- d++;
- break;
- }
-
- case begline:
- if ((size1 != 0 && d == string1)
- || (size1 == 0 && size2 != 0 && d == string2)
- || (d && d[-1] == '\n')
- || (size1 == 0 && size2 == 0))
- break;
- else
- goto fail;
-
- case endline:
- if (d == end2
- || (d == end1 ? (size2 == 0 || *string2 == '\n') : *d == '\n'))
- break;
- goto fail;
-
- /* `or' constructs are handled by starting each alternative with
- an on_failure_jump that points to the start of the next
- alternative. Each alternative except the last ends with a
- jump to the joining point. (Actually, each jump except for
- the last one really jumps to the following jump, because
- tensioning the jumps is a hassle.) */
-
- /* The start of a stupid repeat has an on_failure_jump that points
- past the end of the repeat text. This makes a failure point so
- that on failure to match a repetition, matching restarts past
- as many repetitions have been found with no way to fail and
- look for another one. */
-
- /* A smart repeat is similar but loops back to the on_failure_jump
- so that each repetition makes another failure point. */
-
- case on_failure_jump:
- on_failure:
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- PUSH_FAILURE_POINT (p + mcnt, d);
- break;
-
- /* The end of a smart repeat has a maybe_finalize_jump back.
- Change it either to a finalize_jump or an ordinary jump. */
- case maybe_finalize_jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- {
- register unsigned char *p2 = p;
- /* Compare what follows with the beginning of the repeat.
- If we can establish that there is nothing that they would
- both match, we can change to finalize_jump. */
- while (p2 + 1 != pend
- && (*p2 == (unsigned char) stop_memory
- || *p2 == (unsigned char) start_memory))
- p2 += 2; /* Skip over reg number. */
- if (p2 == pend)
- p[-3] = (unsigned char) finalize_jump;
- else if (*p2 == (unsigned char) exactn
- || *p2 == (unsigned char) endline)
- {
- register int c = *p2 == (unsigned char) endline ? '\n' : p2[2];
- register unsigned char *p1 = p + mcnt;
- /* p1[0] ... p1[2] are an on_failure_jump.
- Examine what follows that. */
- if (p1[3] == (unsigned char) exactn && p1[5] != c)
- p[-3] = (unsigned char) finalize_jump;
- else if (p1[3] == (unsigned char) charset
- || p1[3] == (unsigned char) charset_not)
- {
- int not = p1[3] == (unsigned char) charset_not;
- if (c < p1[4] * BYTEWIDTH
- && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
- /* `not' is 1 if c would match. */
- /* That means it is not safe to finalize. */
- if (!not)
- p[-3] = (unsigned char) finalize_jump;
- }
- }
- }
- p -= 2; /* Point at relative address again. */
- if (p[-1] != (unsigned char) finalize_jump)
- {
- p[-1] = (unsigned char) jump;
- goto nofinalize;
- }
- /* Note fall through. */
-
- /* The end of a stupid repeat has a finalize_jump back to the
- start, where another failure point will be made which will
- point to after all the repetitions found so far. */
-
- /* Take off failure points put on by matching on_failure_jump
- because didn't fail. Also remove the register information
- put on by the on_failure_jump. */
- case finalize_jump:
- POP_FAILURE_POINT ();
- /* Note fall through. */
-
- /* Jump without taking off any failure points. */
- case jump:
- nofinalize:
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- p += mcnt;
- break;
-
- case dummy_failure_jump:
- /* Normally, the on_failure_jump pushes a failure point, which
- then gets popped at finalize_jump. We will end up at
- finalize_jump, also, and with a pattern of, say, `a+', we
- are skipping over the on_failure_jump, so we have to push
- something meaningless for finalize_jump to pop. */
- PUSH_FAILURE_POINT (0, 0);
- goto nofinalize;
-
-
- /* Have to succeed matching what follows at least n times. Then
- just handle like an on_failure_jump. */
- case succeed_n:
- EXTRACT_NUMBER (mcnt, p + 2);
- /* Originally, this is how many times we HAVE to succeed. */
- if (mcnt)
- {
- mcnt--;
- p += 2;
- STORE_NUMBER_AND_INCR (p, mcnt);
- }
- else if (mcnt == 0)
- {
- p[2] = unused;
- p[3] = unused;
- goto on_failure;
- }
- else
- {
- fprintf (stderr, "regex: the succeed_n's n is not set.\n");
- exit (1);
- }
- break;
-
- case jump_n:
- EXTRACT_NUMBER (mcnt, p + 2);
- /* Originally, this is how many times we CAN jump. */
- if (mcnt)
- {
- mcnt--;
- STORE_NUMBER(p + 2, mcnt);
- goto nofinalize; /* Do the jump without taking off
- any failure points. */
- }
- /* If don't have to jump any more, skip over the rest of command. */
- else
- p += 4;
- break;
-
- case set_number_at:
- {
- register unsigned char *p1;
-
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- p1 = p + mcnt;
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- STORE_NUMBER (p1, mcnt);
- break;
- }
-
- /* Ignore these. Used to ignore the n of succeed_n's which
- currently have n == 0. */
- case unused:
- break;
-
- case wordbound:
- if (AT_WORD_BOUNDARY)
- break;
- goto fail;
-
- case notwordbound:
- if (AT_WORD_BOUNDARY)
- goto fail;
- break;
-
- case wordbeg:
- /* Have to check if AT_STRINGS_BEG before looking at d - 1. */
- if (IS_A_LETTER (d) && (AT_STRINGS_BEG || !IS_A_LETTER (d - 1)))
- break;
- goto fail;
-
- case wordend:
- /* Have to check if AT_STRINGS_BEG before looking at d - 1. */
- if (!AT_STRINGS_BEG && IS_A_LETTER (d - 1)
- && (!IS_A_LETTER (d) || AT_STRINGS_END))
- break;
- goto fail;
-
-#ifdef emacs
- case before_dot:
- if (PTR_CHAR_POS (d) >= point)
- goto fail;
- break;
-
- case at_dot:
- if (PTR_CHAR_POS (d) != point)
- goto fail;
- break;
-
- case after_dot:
- if (PTR_CHAR_POS (d) <= point)
- goto fail;
- break;
-
- case wordchar:
- mcnt = (int) Sword;
- goto matchsyntax;
-
- case syntaxspec:
- mcnt = *p++;
- matchsyntax:
- PREFETCH;
- if (SYNTAX (*d++) != (enum syntaxcode) mcnt) goto fail;
- SET_REGS_MATCHED;
- break;
-
- case notwordchar:
- mcnt = (int) Sword;
- goto matchnotsyntax;
-
- case notsyntaxspec:
- mcnt = *p++;
- matchnotsyntax:
- PREFETCH;
- if (SYNTAX (*d++) == (enum syntaxcode) mcnt) goto fail;
- SET_REGS_MATCHED;
- break;
-
-#else /* not emacs */
-
- case wordchar:
- PREFETCH;
- if (!IS_A_LETTER (d))
- goto fail;
- SET_REGS_MATCHED;
- break;
-
- case notwordchar:
- PREFETCH;
- if (IS_A_LETTER (d))
- goto fail;
- SET_REGS_MATCHED;
- break;
-
-#endif /* not emacs */
-
- case begbuf:
- if (AT_STRINGS_BEG)
- break;
- goto fail;
-
- case endbuf:
- if (AT_STRINGS_END)
- break;
- goto fail;
-
- case exactn:
- /* Match the next few pattern characters exactly.
- mcnt is how many characters to match. */
- mcnt = *p++;
- /* This is written out as an if-else so we don't waste time
- testing `translate' inside the loop. */
- if (translate)
- {
- do
- {
- PREFETCH;
- if (translate[*d++] != *p++) goto fail;
- }
- while (--mcnt);
- }
- else
- {
- do
- {
- PREFETCH;
- if (*d++ != *p++) goto fail;
- }
- while (--mcnt);
- }
- SET_REGS_MATCHED;
- break;
- }
- continue; /* Successfully executed one pattern command; keep going. */
-
- /* Jump here if any matching operation fails. */
- fail:
- if (stackp != stackb)
- /* A restart point is known. Restart there and pop it. */
- {
- short last_used_reg, this_reg;
-
- /* If this failure point is from a dummy_failure_point, just
- skip it. */
- if (!stackp[-2])
- {
- POP_FAILURE_POINT ();
- goto fail;
- }
-
- d = *--stackp;
- p = *--stackp;
- if (d >= string1 && d <= end1)
- dend = end_match_1;
- /* Restore register info. */
- last_used_reg = (short) (int) *--stackp;
-
- /* Make the ones that weren't saved -1 or 0 again. */
- for (this_reg = RE_NREGS - 1; this_reg > last_used_reg; this_reg--)
- {
- regend[this_reg] = (unsigned char *) -1;
- regstart[this_reg] = (unsigned char *) -1;
- IS_ACTIVE (reg_info[this_reg]) = 0;
- MATCHED_SOMETHING (reg_info[this_reg]) = 0;
- }
-
- /* And restore the rest from the stack. */
- for ( ; this_reg > 0; this_reg--)
- {
- reg_info[this_reg] = *(struct register_info *) *--stackp;
- regend[this_reg] = *--stackp;
- regstart[this_reg] = *--stackp;
- }
- }
- else
- break; /* Matching at this starting point really fails. */
- }
-
- if (best_regs_set)
- goto restore_best_regs;
- return -1; /* Failure to match. */
-}
-
-
-static int
-bcmp_translate (char *s1, char *s2, int len, unsigned char *translate)
-{
- register unsigned char *p1 = (unsigned char*)s1;
- register unsigned char *p2 = (unsigned char*)s2;
- while (len)
- {
- if (translate [*p1++] != translate [*p2++]) return 1;
- len--;
- }
- return 0;
-}
-
-
-
-/* Entry points compatible with 4.2 BSD regex library. */
-
-#if 0
-
-static struct re_pattern_buffer re_comp_buf;
-
-char *
-re_comp (char *s)
-{
- if (!s)
- {
- if (!re_comp_buf.buffer)
- return "No previous regular expression";
- return 0;
- }
-
- if (!re_comp_buf.buffer)
- {
- if (!(re_comp_buf.buffer = (char *) malloc (200)))
- return "Memory exhausted";
- re_comp_buf.allocated = 200;
- if (!(re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH)))
- return "Memory exhausted";
- }
- return re_compile_pattern (s, strlen (s), &re_comp_buf);
-}
-
-int
-re_exec (char *s)
-{
- int len = strlen (s);
- return 0 <= re_search (&re_comp_buf, s, len, 0, len,
- (struct re_registers *) 0);
-}
-#endif /* not emacs */
-
-
-
-#ifdef test
-
-#include <stdio.h>
-
-/* Indexed by a character, gives the upper case equivalent of the
- character. */
-
-char upcase[0400] =
- { 000, 001, 002, 003, 004, 005, 006, 007,
- 010, 011, 012, 013, 014, 015, 016, 017,
- 020, 021, 022, 023, 024, 025, 026, 027,
- 030, 031, 032, 033, 034, 035, 036, 037,
- 040, 041, 042, 043, 044, 045, 046, 047,
- 050, 051, 052, 053, 054, 055, 056, 057,
- 060, 061, 062, 063, 064, 065, 066, 067,
- 070, 071, 072, 073, 074, 075, 076, 077,
- 0100, 0101, 0102, 0103, 0104, 0105, 0106, 0107,
- 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117,
- 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127,
- 0130, 0131, 0132, 0133, 0134, 0135, 0136, 0137,
- 0140, 0101, 0102, 0103, 0104, 0105, 0106, 0107,
- 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117,
- 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127,
- 0130, 0131, 0132, 0173, 0174, 0175, 0176, 0177,
- 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207,
- 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217,
- 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227,
- 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237,
- 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247,
- 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257,
- 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267,
- 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277,
- 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307,
- 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317,
- 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327,
- 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337,
- 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347,
- 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357,
- 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367,
- 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377
- };
-
-#ifdef canned
-
-#include "tests.h"
-
-typedef enum { extended_test, basic_test } test_type;
-
-/* Use this to run the tests we've thought of. */
-
-void
-main ()
-{
- test_type t = extended_test;
-
- if (t == basic_test)
- {
- printf ("Running basic tests:\n\n");
- test_posix_basic ();
- }
- else if (t == extended_test)
- {
- printf ("Running extended tests:\n\n");
- test_posix_extended ();
- }
-}
-
-#else /* not canned */
-
-/* Use this to run interactive tests. */
-
-void
-main (int argc, char **argv)
-{
- char pat[80];
- struct re_pattern_buffer buf;
- int i;
- char c;
- char fastmap[(1 << BYTEWIDTH)];
-
- /* Allow a command argument to specify the style of syntax. */
- if (argc > 1)
- obscure_syntax = atoi (argv[1]);
-
- buf.allocated = 40;
- buf.buffer = (char *) malloc (buf.allocated);
- buf.fastmap = fastmap;
- buf.translate = upcase;
-
- while (1)
- {
- gets (pat);
-
- if (*pat)
- {
- re_compile_pattern (pat, strlen(pat), &buf);
-
- for (i = 0; i < buf.used; i++)
- printchar (buf.buffer[i]);
-
- putchar ('\n');
-
- printf ("%d allocated, %d used.\n", buf.allocated, buf.used);
-
- re_compile_fastmap (&buf);
- printf ("Allowed by fastmap: ");
- for (i = 0; i < (1 << BYTEWIDTH); i++)
- if (fastmap[i]) printchar (i);
- putchar ('\n');
- }
-
- gets (pat); /* Now read the string to match against */
-
- i = re_match (&buf, pat, strlen (pat), 0, 0);
- printf ("Match value %d.\n", i);
- }
-}
-
-#endif
-
-
-#ifdef NOTDEF
-void
-print_buf (struct re_pattern_buffer *bufpbufp)
-{
- int i;
-
- printf ("buf is :\n----------------\n");
- for (i = 0; i < bufp->used; i++)
- printchar (bufp->buffer[i]);
-
- printf ("\n%d allocated, %d used.\n", bufp->allocated, bufp->used);
-
- printf ("Allowed by fastmap: ");
- for (i = 0; i < (1 << BYTEWIDTH); i++)
- if (bufp->fastmap[i])
- printchar (i);
- printf ("\nAllowed by translate: ");
- if (bufp->translate)
- for (i = 0; i < (1 << BYTEWIDTH); i++)
- if (bufp->translate[i])
- printchar (i);
- printf ("\nfastmap is%s accurate\n", bufp->fastmap_accurate ? "" : "n't");
- printf ("can %s be null\n----------", bufp->can_be_null ? "" : "not");
-}
-#endif /* NOTDEF */
-
-void
-printchar (char c)
-{
- if (c < 040 || c >= 0177)
- {
- putchar ('\\');
- putchar (((c >> 6) & 3) + '0');
- putchar (((c >> 3) & 7) + '0');
- putchar ((c & 7) + '0');
- }
- else
- putchar (c);
-}
-
-void
-error (char *string)
-{
- puts (string);
- exit (1);
-}
-#endif /* test */
diff --git a/gnu/lib/libmalloc/free.c b/gnu/lib/libmalloc/free.c
deleted file mode 100644
index 7d2a77c..0000000
--- a/gnu/lib/libmalloc/free.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/* Free a block of memory allocated by `malloc'.
- Copyright 1990, 1991, 1992 Free Software Foundation
- Written May 1989 by Mike Haertel.
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with this library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.
-
- The author may be reached (Email) at the address mike@ai.mit.edu,
- or (US mail) as Mike Haertel c/o Free Software Foundation. */
-
-#ifndef _MALLOC_INTERNAL
-#define _MALLOC_INTERNAL
-#include <malloc.h>
-#endif
-
-/* Debugging hook for free. */
-void (*__free_hook) __P ((__ptr_t __ptr));
-
-/* List of blocks allocated by memalign. */
-struct alignlist *_aligned_blocks = NULL;
-
-/* Return memory to the heap.
- Like `free' but don't call a __free_hook if there is one. */
-void
-_free_internal (ptr)
- __ptr_t ptr;
-{
- int type;
- size_t block, blocks;
- register size_t i;
- struct list *prev, *next;
-
- block = BLOCK (ptr);
-
- type = _heapinfo[block].busy.type;
- switch (type)
- {
- case 0:
- /* Get as many statistics as early as we can. */
- --_chunks_used;
- _bytes_used -= _heapinfo[block].busy.info.size * BLOCKSIZE;
- _bytes_free += _heapinfo[block].busy.info.size * BLOCKSIZE;
-
- /* Find the free cluster previous to this one in the free list.
- Start searching at the last block referenced; this may benefit
- programs with locality of allocation. */
- i = _heapindex;
- if (i > block)
- while (i > block)
- i = _heapinfo[i].free.prev;
- else
- {
- do
- i = _heapinfo[i].free.next;
- while (i > 0 && i < block);
- i = _heapinfo[i].free.prev;
- }
-
- /* Determine how to link this block into the free list. */
- if (block == i + _heapinfo[i].free.size)
- {
- /* Coalesce this block with its predecessor. */
- _heapinfo[i].free.size += _heapinfo[block].busy.info.size;
- block = i;
- }
- else
- {
- /* Really link this block back into the free list. */
- _heapinfo[block].free.size = _heapinfo[block].busy.info.size;
- _heapinfo[block].free.next = _heapinfo[i].free.next;
- _heapinfo[block].free.prev = i;
- _heapinfo[i].free.next = block;
- _heapinfo[_heapinfo[block].free.next].free.prev = block;
- ++_chunks_free;
- }
-
- /* Now that the block is linked in, see if we can coalesce it
- with its successor (by deleting its successor from the list
- and adding in its size). */
- if (block + _heapinfo[block].free.size == _heapinfo[block].free.next)
- {
- _heapinfo[block].free.size
- += _heapinfo[_heapinfo[block].free.next].free.size;
- _heapinfo[block].free.next
- = _heapinfo[_heapinfo[block].free.next].free.next;
- _heapinfo[_heapinfo[block].free.next].free.prev = block;
- --_chunks_free;
- }
-
- /* Now see if we can return stuff to the system. */
- blocks = _heapinfo[block].free.size;
- if (blocks >= FINAL_FREE_BLOCKS && block + blocks == _heaplimit
- && (*__morecore) (0) == ADDRESS (block + blocks))
- {
- register size_t bytes = blocks * BLOCKSIZE;
- _heaplimit -= blocks;
- (*__morecore) (-bytes);
- _heapinfo[_heapinfo[block].free.prev].free.next
- = _heapinfo[block].free.next;
- _heapinfo[_heapinfo[block].free.next].free.prev
- = _heapinfo[block].free.prev;
- block = _heapinfo[block].free.prev;
- --_chunks_free;
- _bytes_free -= bytes;
- }
-
- /* Set the next search to begin at this block. */
- _heapindex = block;
- break;
-
- default:
- /* Do some of the statistics. */
- --_chunks_used;
- _bytes_used -= 1 << type;
- ++_chunks_free;
- _bytes_free += 1 << type;
-
- /* Get the address of the first free fragment in this block. */
- prev = (struct list *) ((char *) ADDRESS (block) +
- (_heapinfo[block].busy.info.frag.first << type));
-
- if (_heapinfo[block].busy.info.frag.nfree == (BLOCKSIZE >> type) - 1)
- {
- /* If all fragments of this block are free, remove them
- from the fragment list and free the whole block. */
- next = prev;
- for (i = 1; i < (size_t) (BLOCKSIZE >> type); ++i)
- next = next->next;
- prev->prev->next = next;
- if (next != NULL)
- next->prev = prev->prev;
- _heapinfo[block].busy.type = 0;
- _heapinfo[block].busy.info.size = 1;
-
- /* Keep the statistics accurate. */
- ++_chunks_used;
- _bytes_used += BLOCKSIZE;
- _chunks_free -= BLOCKSIZE >> type;
- _bytes_free -= BLOCKSIZE;
-
- free (ADDRESS (block));
- }
- else if (_heapinfo[block].busy.info.frag.nfree != 0)
- {
- /* If some fragments of this block are free, link this
- fragment into the fragment list after the first free
- fragment of this block. */
- next = (struct list *) ptr;
- next->next = prev->next;
- next->prev = prev;
- prev->next = next;
- if (next->next != NULL)
- next->next->prev = next;
- ++_heapinfo[block].busy.info.frag.nfree;
- }
- else
- {
- /* No fragments of this block are free, so link this
- fragment into the fragment list and announce that
- it is the first free fragment of this block. */
- prev = (struct list *) ptr;
- _heapinfo[block].busy.info.frag.nfree = 1;
- _heapinfo[block].busy.info.frag.first = (unsigned long int)
- ((unsigned long int) ((char *) ptr - (char *) NULL)
- % BLOCKSIZE >> type);
- prev->next = _fraghead[type].next;
- prev->prev = &_fraghead[type];
- prev->prev->next = prev;
- if (prev->next != NULL)
- prev->next->prev = prev;
- }
- break;
- }
-}
-
-/* Return memory to the heap. */
-void
-free (ptr)
- __ptr_t ptr;
-{
- register struct alignlist *l;
-
- if (ptr == NULL)
- return;
-
- for (l = _aligned_blocks; l != NULL; l = l->next)
- if (l->aligned == ptr)
- {
- l->aligned = NULL; /* Mark the slot in the list as free. */
- ptr = l->exact;
- break;
- }
-
- if (__free_hook != NULL)
- (*__free_hook) (ptr);
- else
- _free_internal (ptr);
-}
diff --git a/gnu/lib/libmalloc/realloc.c b/gnu/lib/libmalloc/realloc.c
deleted file mode 100644
index 2d31766..0000000
--- a/gnu/lib/libmalloc/realloc.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/* Change the size of a block allocated by `malloc'.
- Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
- Written May 1989 by Mike Haertel.
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with this library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.
-
- The author may be reached (Email) at the address mike@ai.mit.edu,
- or (US mail) as Mike Haertel c/o Free Software Foundation. */
-
-#ifndef _MALLOC_INTERNAL
-#define _MALLOC_INTERNAL
-#include <malloc.h>
-#endif
-
-#define min(A, B) ((A) < (B) ? (A) : (B))
-
-/* Debugging hook for realloc. */
-__ptr_t (*__realloc_hook) __P ((__ptr_t __ptr, size_t __size));
-
-/* Resize the given region to the new size, returning a pointer
- to the (possibly moved) region. This is optimized for speed;
- some benchmarks seem to indicate that greater compactness is
- achieved by unconditionally allocating and copying to a
- new region. This module has incestuous knowledge of the
- internals of both free and malloc. */
-__ptr_t
-realloc (ptr, size)
- __ptr_t ptr;
- size_t size;
-{
- __ptr_t result;
- int type;
- size_t block, blocks, oldlimit;
-
- if (size == 0)
- {
- free (ptr);
- return malloc (0);
- }
- else if (ptr == NULL)
- return malloc (size);
-
- if (__realloc_hook != NULL)
- return (*__realloc_hook) (ptr, size);
-
- block = BLOCK (ptr);
-
- type = _heapinfo[block].busy.type;
- switch (type)
- {
- case 0:
- /* Maybe reallocate a large block to a small fragment. */
- if (size <= BLOCKSIZE / 2)
- {
- result = malloc (size);
- if (result != NULL)
- {
- memcpy (result, ptr, size);
- free (ptr);
- return result;
- }
- }
-
- /* The new size is a large allocation as well;
- see if we can hold it in place. */
- blocks = BLOCKIFY (size);
- if (blocks < _heapinfo[block].busy.info.size)
- {
- /* The new size is smaller; return
- excess memory to the free list. */
- _heapinfo[block + blocks].busy.type = 0;
- _heapinfo[block + blocks].busy.info.size
- = _heapinfo[block].busy.info.size - blocks;
- _heapinfo[block].busy.info.size = blocks;
- free (ADDRESS (block + blocks));
- result = ptr;
- }
- else if (blocks == _heapinfo[block].busy.info.size)
- /* No size change necessary. */
- result = ptr;
- else
- {
- /* Won't fit, so allocate a new region that will.
- Free the old region first in case there is sufficient
- adjacent free space to grow without moving. */
- blocks = _heapinfo[block].busy.info.size;
- /* Prevent free from actually returning memory to the system. */
- oldlimit = _heaplimit;
- _heaplimit = 0;
- free (ptr);
- _heaplimit = oldlimit;
- result = malloc (size);
- if (result == NULL)
- {
- /* Now we're really in trouble. We have to unfree
- the thing we just freed. Unfortunately it might
- have been coalesced with its neighbors. */
- if (_heapindex == block)
- (void) malloc (blocks * BLOCKSIZE);
- else
- {
- __ptr_t previous = malloc ((block - _heapindex) * BLOCKSIZE);
- (void) malloc (blocks * BLOCKSIZE);
- free (previous);
- }
- return NULL;
- }
- if (ptr != result)
- memmove (result, ptr, blocks * BLOCKSIZE);
- }
- break;
-
- default:
- /* Old size is a fragment; type is logarithm
- to base two of the fragment size. */
- if (size > (size_t) (1 << (type - 1)) && size <= (size_t) (1 << type))
- /* The new size is the same kind of fragment. */
- result = ptr;
- else
- {
- /* The new size is different; allocate a new space,
- and copy the lesser of the new size and the old. */
- result = malloc (size);
- if (result == NULL)
- return NULL;
- memcpy (result, ptr, min (size, (size_t) 1 << type));
- free (ptr);
- }
- break;
- }
-
- return result;
-}
diff --git a/gnu/lib/libreadline/README.FreeBSD b/gnu/lib/libreadline/README.FreeBSD
deleted file mode 100644
index 6af2775..0000000
--- a/gnu/lib/libreadline/README.FreeBSD
+++ /dev/null
@@ -1,21 +0,0 @@
-The GNU Readline library is a programming tool that provides a
-consistent user interface for recalling lines of previously typed
-input and performing editing tasks on input lines.
-
-paul@freefall.cdrom.com
-
-There was a bug with tcsh: when readline attempt to get tty
-modes from background, it got no-echo editing tcsh mode.
-
-Workaround for this implemented via TIOCGWINSZ/TIOCSWINSZ
-with same winsize structure: it does nothing expect polling
-process from background. Look tcsh_hack.readme for details.
-
-This version is more ctype-oriented than original bash version.
-
-If you want 8-bit clean version, put
- set convert-meta off
- set output-meta on
-in your ~/.inputrc file
-
-ache@astral.msk.su
diff --git a/gnu/lib/libreadline/doc/ChangeLog b/gnu/lib/libreadline/doc/ChangeLog
deleted file mode 100644
index 5f1f5061..0000000
--- a/gnu/lib/libreadline/doc/ChangeLog
+++ /dev/null
@@ -1,8 +0,0 @@
-Tue Feb 2 11:40:04 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * Makefile.in: configurable (and useable) Makefile template
- * Makefile: removed, replaced with configurable Makefile.in
- * texindex.c texinfo.tex: remove, replacing w/refs to tools
- elsewhere in distribution tree
- * configure.in: pro forma configure stub
- * ChangeLog: new file
diff --git a/gnu/lib/libreadline/doc/hist.texinfo b/gnu/lib/libreadline/doc/hist.texinfo
deleted file mode 100644
index cc80efa..0000000
--- a/gnu/lib/libreadline/doc/hist.texinfo
+++ /dev/null
@@ -1,113 +0,0 @@
-\input texinfo @c -*-texinfo-*-
-@c %**start of header (This is for running Texinfo on a region.)
-@setfilename history.info
-@settitle GNU History Library
-@c %**end of header (This is for running Texinfo on a region.)
-
-@setchapternewpage odd
-
-@ignore
-last change: Wed Jul 20 09:57:17 EDT 1994
-@end ignore
-
-@set EDITION 2.0
-@set VERSION 2.0
-@set UPDATED 20 July 1994
-@set UPDATE-MONTH July 1994
-
-@ifinfo
-This document describes the GNU History library, a programming tool that
-provides a consistent user interface for recalling lines of previously
-typed input.
-
-Copyright (C) 1988, 1991 Free Software Foundation, Inc.
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-pare preserved on all copies.
-
-@ignore
-Permission is granted to process this file through TeX and print the
-results, provided the printed document carries copying permission
-notice identical to this one except for the removal of this paragraph
-(this paragraph not being relevant to the printed manual).
-@end ignore
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the entire
-resulting derived work is distributed under the terms of a permission
-notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation approved
-by the Foundation.
-@end ifinfo
-
-@titlepage
-@sp 10
-@title GNU History Library
-@subtitle Edition @value{EDITION}, for @code{History Library} Version @value{VERSION}.
-@subtitle @value{UPDATE-MONTH}
-@author Brian Fox, Free Software Foundation
-@author Chet Ramey, Case Western Reserve University
-
-@page
-This document describes the GNU History library, a programming tool that
-provides a consistent user interface for recalling lines of previously
-typed input.
-
-Published by the Free Software Foundation @*
-675 Massachusetts Avenue, @*
-Cambridge, MA 02139 USA
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the entire
-resulting derived work is distributed under the terms of a permission
-notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation approved
-by the Foundation.
-
-@vskip 0pt plus 1filll
-Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
-@end titlepage
-
-@ifinfo
-@node Top
-@top GNU History Library
-
-This document describes the GNU History library, a programming tool that
-provides a consistent user interface for recalling lines of previously
-typed input.
-
-@menu
-* Using History Interactively:: GNU History User's Manual.
-* Programming with GNU History:: GNU History Programmer's Manual.
-* Concept Index:: Index of concepts described in this manual.
-* Function and Variable Index:: Index of externally visible functions
- and variables.
-@end menu
-@end ifinfo
-
-@syncodeindex fn vr
-
-@include hsuser.texinfo
-@include hstech.texinfo
-
-@node Concept Index
-@appendix Concept Index
-@printindex cp
-
-@node Function and Variable Index
-@appendix Function and Variable Index
-@printindex vr
-
-@contents
-@bye
diff --git a/gnu/lib/libreadline/doc/history.info b/gnu/lib/libreadline/doc/history.info
deleted file mode 100644
index 6df0bd9..0000000
--- a/gnu/lib/libreadline/doc/history.info
+++ /dev/null
@@ -1,744 +0,0 @@
-This is Info file history.info, produced by Makeinfo-1.55 from the
-input file hist.texinfo.
-
- This document describes the GNU History library, a programming tool
-that provides a consistent user interface for recalling lines of
-previously typed input.
-
- Copyright (C) 1988, 1991 Free Software Foundation, Inc.
-
- Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice pare
-preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of
-this manual under the conditions for verbatim copying, provided that
-the entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
- Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions, except that this permission notice may be stated in a
-translation approved by the Foundation.
-
-
-File: history.info, Node: Top, Next: Using History Interactively, Prev: (DIR), Up: (DIR)
-
-GNU History Library
-*******************
-
- This document describes the GNU History library, a programming tool
-that provides a consistent user interface for recalling lines of
-previously typed input.
-
-* Menu:
-
-* Using History Interactively:: GNU History User's Manual.
-* Programming with GNU History:: GNU History Programmer's Manual.
-* Concept Index:: Index of concepts described in this manual.
-* Function and Variable Index:: Index of externally visible functions
- and variables.
-
-
-File: history.info, Node: Using History Interactively, Next: Programming with GNU History, Prev: Top, Up: Top
-
-Using History Interactively
-***************************
-
- This chapter describes how to use the GNU History Library
-interactively, from a user's standpoint. It should be considered a
-user's guide. For information on using the GNU History Library in your
-own programs, *note Programming with GNU History::..
-
-* Menu:
-
-* History Interaction:: What it feels like using History as a user.
-
-
-File: history.info, Node: History Interaction, Up: Using History Interactively
-
-History Interaction
-===================
-
- The History library provides a history expansion feature that is
-similar to the history expansion provided by `csh'. The following text
-describes the syntax used to manipulate the history information.
-
- History expansion takes place in two parts. The first is to
-determine which line from the previous history should be used during
-substitution. The second is to select portions of that line for
-inclusion into the current one. The line selected from the previous
-history is called the "event", and the portions of that line that are
-acted upon are called "words". The line is broken into words in the
-same fashion that Bash does, so that several English (or Unix) words
-surrounded by quotes are considered as one word.
-
-* Menu:
-
-* Event Designators:: How to specify which history line to use.
-* Word Designators:: Specifying which words are of interest.
-* Modifiers:: Modifying the results of substitution.
-
-
-File: history.info, Node: Event Designators, Next: Word Designators, Up: History Interaction
-
-Event Designators
------------------
-
- An event designator is a reference to a command line entry in the
-history list.
-
-`!'
- Start a history substitution, except when followed by a space, tab,
- the end of the line, = or (.
-
-`!!'
- Refer to the previous command. This is a synonym for `!-1'.
-
-`!n'
- Refer to command line N.
-
-`!-n'
- Refer to the command N lines back.
-
-`!string'
- Refer to the most recent command starting with STRING.
-
-`!?string'[`?']
- Refer to the most recent command containing STRING.
-
-`!#'
- The entire command line typed so far.
-
-`^string1^string2^'
- Quick Substitution. Repeat the last command, replacing STRING1
- with STRING2. Equivalent to `!!:s/string1/string2/'.
-
-
-File: history.info, Node: Word Designators, Next: Modifiers, Prev: Event Designators, Up: History Interaction
-
-Word Designators
-----------------
-
- A : separates the event specification from the word designator. It
-can be omitted if the word designator begins with a ^, $, * or %.
-Words are numbered from the beginning of the line, with the first word
-being denoted by a 0 (zero).
-
-`0 (zero)'
- The `0'th word. For many applications, this is the command word.
-
-`n'
- The Nth word.
-
-`^'
- The first argument; that is, word 1.
-
-`$'
- The last argument.
-
-`%'
- The word matched by the most recent `?string?' search.
-
-`x-y'
- A range of words; `-Y' abbreviates `0-Y'.
-
-`*'
- All of the words, except the `0'th. This is a synonym for `1-$'.
- It is not an error to use * if there is just one word in the event;
- the empty string is returned in that case.
-
-`x*'
- Abbreviates `x-$'
-
-`x-'
- Abbreviates `x-$' like `x*', but omits the last word.
-
-
-File: history.info, Node: Modifiers, Prev: Word Designators, Up: History Interaction
-
-Modifiers
----------
-
- After the optional word designator, you can add a sequence of one or
-more of the following modifiers, each preceded by a :.
-
-`h'
- Remove a trailing pathname component, leaving only the head.
-
-`r'
- Remove a trailing suffix of the form `.'SUFFIX, leaving the
- basename.
-
-`e'
- Remove all but the trailing suffix.
-
-`t'
- Remove all leading pathname components, leaving the tail.
-
-`p'
- Print the new command but do not execute it.
-
-`s/old/new/'
- Substitute NEW for the first occurrence of OLD in the event line.
- Any delimiter may be used in place of /. The delimiter may be
- quoted in OLD and NEW with a single backslash. If & appears in
- NEW, it is replaced by OLD. A single backslash will quote the &.
- The final delimiter is optional if it is the last character on the
- input line.
-
-`&'
- Repeat the previous substitution.
-
-`g'
- Cause changes to be applied over the entire event line. Used in
- conjunction with `s', as in `gs/old/new/', or with `&'.
-
-
-File: history.info, Node: Programming with GNU History, Next: Concept Index, Prev: Using History Interactively, Up: Top
-
-Programming with GNU History
-****************************
-
- This chapter describes how to interface programs that you write with
-the GNU History Library. It should be considered a technical guide.
-For information on the interactive use of GNU History, *note Using
-History Interactively::..
-
-* Menu:
-
-* Introduction to History:: What is the GNU History library for?
-* History Storage:: How information is stored.
-* History Functions:: Functions that you can use.
-* History Variables:: Variables that control behaviour.
-* History Programming Example:: Example of using the GNU History Library.
-
-
-File: history.info, Node: Introduction to History, Next: History Storage, Up: Programming with GNU History
-
-Introduction to History
-=======================
-
- Many programs read input from the user a line at a time. The GNU
-History library is able to keep track of those lines, associate
-arbitrary data with each line, and utilize information from previous
-lines in composing new ones.
-
- The programmer using the History library has available functions for
-remembering lines on a history list, associating arbitrary data with a
-line, removing lines from the list, searching through the list for a
-line containing an arbitrary text string, and referencing any line in
-the list directly. In addition, a history "expansion" function is
-available which provides for a consistent user interface across
-different programs.
-
- The user using programs written with the History library has the
-benefit of a consistent user interface with a set of well-known
-commands for manipulating the text of previous lines and using that text
-in new commands. The basic history manipulation commands are similar to
-the history substitution provided by `csh'.
-
- If the programmer desires, he can use the Readline library, which
-includes some history manipulation by default, and has the added
-advantage of command line editing.
-
-
-File: history.info, Node: History Storage, Next: History Functions, Prev: Introduction to History, Up: Programming with GNU History
-
-History Storage
-===============
-
- The history list is an array of history entries. A history entry is
-declared as follows:
-
- typedef struct _hist_entry {
- char *line;
- char *data;
- } HIST_ENTRY;
-
- The history list itself might therefore be declared as
-
- HIST_ENTRY **the_history_list;
-
- The state of the History library is encapsulated into a single
-structure:
-
- /* A structure used to pass the current state of the history stuff around. */
- typedef struct _hist_state {
- HIST_ENTRY **entries; /* Pointer to the entries themselves. */
- int offset; /* The location pointer within this array. */
- int length; /* Number of elements within this array. */
- int size; /* Number of slots allocated to this array. */
- int flags;
- } HISTORY_STATE;
-
- If the flags member includes `HS_STIFLED', the history has been
-stifled.
-
-
-File: history.info, Node: History Functions, Next: History Variables, Prev: History Storage, Up: Programming with GNU History
-
-History Functions
-=================
-
- This section describes the calling sequence for the various functions
-present in GNU History.
-
-* Menu:
-
-* Initializing History and State Management:: Functions to call when you
- want to use history in a
- program.
-* History List Management:: Functions used to manage the list
- of history entries.
-* Information About the History List:: Functions returning information about
- the history list.
-* Moving Around the History List:: Functions used to change the position
- in the history list.
-* Searching the History List:: Functions to search the history list
- for entries containing a string.
-* Managing the History File:: Functions that read and write a file
- containing the history list.
-* History Expansion:: Functions to perform csh-like history
- expansion.
-
-
-File: history.info, Node: Initializing History and State Management, Next: History List Management, Up: History Functions
-
-Initializing History and State Management
------------------------------------------
-
- This section describes functions used to initialize and manage the
-state of the History library when you want to use the history functions
-in your program.
-
- - Function: void using_history ()
- Begin a session in which the history functions might be used. This
- initializes the interactive variables.
-
- - Function: HISTORY_STATE * history_get_history_state ()
- Return a structure describing the current state of the input
- history.
-
- - Function: void history_set_history_state (HISTORY_STATE *state)
- Set the state of the history list according to STATE.
-
-
-File: history.info, Node: History List Management, Next: Information About the History List, Prev: Initializing History and State Management, Up: History Functions
-
-History List Management
------------------------
-
- These functions manage individual entries on the history list, or set
-parameters managing the list itself.
-
- - Function: void add_history (char *string)
- Place STRING at the end of the history list. The associated data
- field (if any) is set to `NULL'.
-
- - Function: HIST_ENTRY * remove_history (int which)
- Remove history entry at offset WHICH from the history. The
- removed element is returned so you can free the line, data, and
- containing structure.
-
- - Function: HIST_ENTRY * replace_history_entry (int which, char *line,
- char *data)
- Make the history entry at offset WHICH have LINE and DATA. This
- returns the old entry so you can dispose of the data. In the case
- of an invalid WHICH, a `NULL' pointer is returned.
-
- - Function: void stifle_history (int max)
- Stifle the history list, remembering only the last MAX entries.
-
- - Function: int unstifle_history ()
- Stop stifling the history. This returns the previous amount the
- history was stifled. The value is positive if the history was
- stifled, negative if it wasn't.
-
- - Function: int history_is_stifled ()
- Returns non-zero if the history is stifled, zero if it is not.
-
-
-File: history.info, Node: Information About the History List, Next: Moving Around the History List, Prev: History List Management, Up: History Functions
-
-Information About the History List
-----------------------------------
-
- These functions return information about the entire history list or
-individual list entries.
-
- - Function: HIST_ENTRY ** history_list ()
- Return a `NULL' terminated array of `HIST_ENTRY' which is the
- current input history. Element 0 of this list is the beginning of
- time. If there is no history, return `NULL'.
-
- - Function: int where_history ()
- Returns the offset of the current history element.
-
- - Function: HIST_ENTRY * current_history ()
- Return the history entry at the current position, as determined by
- `where_history ()'. If there is no entry there, return a `NULL'
- pointer.
-
- - Function: HIST_ENTRY * history_get (int offset)
- Return the history entry at position OFFSET, starting from
- `history_base'. If there is no entry there, or if OFFSET is
- greater than the history length, return a `NULL' pointer.
-
- - Function: int history_total_bytes ()
- Return the number of bytes that the primary history entries are
- using. This function returns the sum of the lengths of all the
- lines in the history.
-
-
-File: history.info, Node: Moving Around the History List, Next: Searching the History List, Prev: Information About the History List, Up: History Functions
-
-Moving Around the History List
-------------------------------
-
- These functions allow the current index into the history list to be
-set or changed.
-
- - Function: int history_set_pos (int pos)
- Set the position in the history list to POS, an absolute index
- into the list.
-
- - Function: HIST_ENTRY * previous_history ()
- Back up the current history offset to the previous history entry,
- and return a pointer to that entry. If there is no previous
- entry, return a `NULL' pointer.
-
- - Function: HIST_ENTRY * next_history ()
- Move the current history offset forward to the next history entry,
- and return the a pointer to that entry. If there is no next
- entry, return a `NULL' pointer.
-
-
-File: history.info, Node: Searching the History List, Next: Managing the History File, Prev: Moving Around the History List, Up: History Functions
-
-Searching the History List
---------------------------
-
- These functions allow searching of the history list for entries
-containing a specific string. Searching may be performed both forward
-and backward from the current history position. The search may be
-"anchored", meaning that the string must match at the beginning of the
-history entry.
-
- - Function: int history_search (char *string, int direction)
- Search the history for STRING, starting at the current history
- offset. If DIRECTION < 0, then the search is through previous
- entries, else through subsequent. If STRING is found, then the
- current history index is set to that history entry, and the value
- returned is the offset in the line of the entry where STRING was
- found. Otherwise, nothing is changed, and a -1 is returned.
-
- - Function: int history_search_prefix (char *string, int direction)
- Search the history for STRING, starting at the current history
- offset. The search is anchored: matching lines must begin with
- STRING. If DIRECTION < 0, then the search is through previous
- entries, else through subsequent. If STRING is found, then the
- current history index is set to that entry, and the return value
- is 0. Otherwise, nothing is changed, and a -1 is returned.
-
- - Function: int history_search_pos (char *string, int direction, int
- pos)
- Search for STRING in the history list, starting at POS, an
- absolute index into the list. If DIRECTION is negative, the search
- proceeds backward from POS, otherwise forward. Returns the
- absolute index of the history element where STRING was found, or
- -1 otherwise.
-
-
-File: history.info, Node: Managing the History File, Next: History Expansion, Prev: Searching the History List, Up: History Functions
-
-Managing the History File
--------------------------
-
- The History library can read the history from and write it to a file.
-This section documents the functions for managing a history file.
-
- - Function: int read_history (char *filename)
- Add the contents of FILENAME to the history list, a line at a
- time. If FILENAME is `NULL', then read from `~/.history'.
- Returns 0 if successful, or errno if not.
-
- - Function: int read_history_range (char *filename, int from, int to)
- Read a range of lines from FILENAME, adding them to the history
- list. Start reading at line FROM and end at TO. If FROM is zero,
- start at the beginning. If TO is less than FROM, then read until
- the end of the file. If FILENAME is `NULL', then read from
- `~/.history'. Returns 0 if successful, or `errno' if not.
-
- - Function: int write_history (char *filename)
- Write the current history to FILENAME, overwriting FILENAME if
- necessary. If FILENAME is `NULL', then write the history list to
- `~/.history'. Values returned are as in `read_history ()'.
-
- - Function: int append_history (int nelements, char *filename)
- Append the last NELEMENTS of the history list to FILENAME.
-
- - Function: int history_truncate_file (char *filename, int nlines)
- Truncate the history file FILENAME, leaving only the last NLINES
- lines.
-
-
-File: history.info, Node: History Expansion, Prev: Managing the History File, Up: History Functions
-
-History Expansion
------------------
-
- These functions implement `csh'-like history expansion.
-
- - Function: int history_expand (char *string, char **output)
- Expand STRING, placing the result into OUTPUT, a pointer to a
- string (*note History Interaction::.). Returns:
- `0'
- If no expansions took place (or, if the only change in the
- text was the de-slashifying of the history expansion
- character);
-
- `1'
- if expansions did take place;
-
- `-1'
- if there was an error in expansion;
-
- `2'
- if the returned line should only be displayed, but not
- executed, as with the `:p' modifier (*note Modifiers::.).
-
- If an error ocurred in expansion, then OUTPUT contains a
- descriptive error message.
-
- - Function: char * history_arg_extract (int first, int last, char
- *string)
- Extract a string segment consisting of the FIRST through LAST
- arguments present in STRING. Arguments are broken up as in Bash.
-
- - Function: char * get_history_event (char *string, int *cindex, int
- qchar)
- Returns the text of the history event beginning at STRING +
- *CINDEX. *CINDEX is modified to point to after the event
- specifier. At function entry, CINDEX points to the index into
- STRING where the history event specification begins. QCHAR is a
- character that is allowed to end the event specification in
- addition to the "normal" terminating characters.
-
- - Function: char ** history_tokenize (char *string)
- Return an array of tokens parsed out of STRING, much as the shell
- might. The tokens are split on white space and on the characters
- `()<>;&|$', and shell quoting conventions are obeyed.
-
-
-File: history.info, Node: History Variables, Next: History Programming Example, Prev: History Functions, Up: Programming with GNU History
-
-History Variables
-=================
-
- This section describes the externally visible variables exported by
-the GNU History Library.
-
- - Variable: int history_base
- The logical offset of the first entry in the history list.
-
- - Variable: int history_length
- The number of entries currently stored in the history list.
-
- - Variable: int max_input_history
- The maximum number of history entries. This must be changed using
- `stifle_history ()'.
-
- - Variable: char history_expansion_char
- The character that starts a history event. The default is `!'.
-
- - Variable: char history_subst_char
- The character that invokes word substitution if found at the start
- of a line. The default is `^'.
-
- - Variable: char history_comment_char
- During tokenization, if this character is seen as the first
- character of a word, then it and all subsequent characters up to a
- newline are ignored, suppressing history expansion for the
- remainder of the line. This is disabled by default.
-
- - Variable: char * history_no_expand_chars
- The list of characters which inhibit history expansion if found
- immediately following HISTORY_EXPANSION_CHAR. The default is
- whitespace and `='.
-
-
-File: history.info, Node: History Programming Example, Prev: History Variables, Up: Programming with GNU History
-
-History Programming Example
-===========================
-
- The following program demonstrates simple use of the GNU History
-Library.
-
- main ()
- {
- char line[1024], *t;
- int len, done = 0;
-
- line[0] = 0;
-
- using_history ();
- while (!done)
- {
- printf ("history$ ");
- fflush (stdout);
- t = fgets (line, sizeof (line) - 1, stdin);
- if (t && *t)
- {
- len = strlen (t);
- if (t[len - 1] == '\n')
- t[len - 1] = '\0';
- }
-
- if (!t)
- strcpy (line, "quit");
-
- if (line[0])
- {
- char *expansion;
- int result;
-
- result = history_expand (line, &expansion);
- if (result)
- fprintf (stderr, "%s\n", expansion);
-
- if (result < 0 || result == 2)
- {
- free (expansion);
- continue;
- }
-
- add_history (expansion);
- strncpy (line, expansion, sizeof (line) - 1);
- free (expansion);
- }
-
- if (strcmp (line, "quit") == 0)
- done = 1;
- else if (strcmp (line, "save") == 0)
- write_history ("history_file");
- else if (strcmp (line, "read") == 0)
- read_history ("history_file");
- else if (strcmp (line, "list") == 0)
- {
- register HIST_ENTRY **the_list;
- register int i;
-
- the_list = history_list ();
- if (the_list)
- for (i = 0; the_list[i]; i++)
- printf ("%d: %s\n", i + history_base, the_list[i]->line);
- }
- else if (strncmp (line, "delete", 6) == 0)
- {
- int which;
- if ((sscanf (line + 6, "%d", &which)) == 1)
- {
- HIST_ENTRY *entry = remove_history (which);
- if (!entry)
- fprintf (stderr, "No such entry %d\n", which);
- else
- {
- free (entry->line);
- free (entry);
- }
- }
- else
- {
- fprintf (stderr, "non-numeric arg given to `delete'\n");
- }
- }
- }
- }
-
-
-File: history.info, Node: Concept Index, Next: Function and Variable Index, Prev: Programming with GNU History, Up: Top
-
-Concept Index
-*************
-
-* Menu:
-
-* anchored search: Searching the History List.
-* event designators: Event Designators.
-* expansion: History Interaction.
-* history events: Event Designators.
-* History Searching: Searching the History List.
-
-
-File: history.info, Node: Function and Variable Index, Prev: Concept Index, Up: Top
-
-Function and Variable Index
-***************************
-
-* Menu:
-
-* add_history: History List Management.
-* append_history: Managing the History File.
-* current_history: Information About the History List.
-* get_history_event: History Expansion.
-* history_arg_extract: History Expansion.
-* history_base: History Variables.
-* history_comment_char: History Variables.
-* history_expand: History Expansion.
-* history_expansion_char: History Variables.
-* history_get: Information About the History List.
-* history_get_history_state: Initializing History and State Management.
-* history_is_stifled: History List Management.
-* history_length: History Variables.
-* history_list: Information About the History List.
-* history_no_expand_chars: History Variables.
-* history_search: Searching the History List.
-* history_search_pos: Searching the History List.
-* history_search_prefix: Searching the History List.
-* history_set_history_state: Initializing History and State Management.
-* history_set_pos: Moving Around the History List.
-* history_subst_char: History Variables.
-* history_tokenize: History Expansion.
-* history_total_bytes: Information About the History List.
-* history_truncate_file: Managing the History File.
-* max_input_history: History Variables.
-* next_history: Moving Around the History List.
-* previous_history: Moving Around the History List.
-* read_history: Managing the History File.
-* read_history_range: Managing the History File.
-* remove_history: History List Management.
-* replace_history_entry: History List Management.
-* stifle_history: History List Management.
-* unstifle_history: History List Management.
-* using_history: Initializing History and State Management.
-* where_history: Information About the History List.
-* write_history: Managing the History File.
-
-
-
-Tag Table:
-Node: Top975
-Node: Using History Interactively1569
-Node: History Interaction2077
-Node: Event Designators3122
-Node: Word Designators3952
-Node: Modifiers4936
-Node: Programming with GNU History6065
-Node: Introduction to History6791
-Node: History Storage8112
-Node: History Functions9205
-Node: Initializing History and State Management10176
-Node: History List Management10968
-Node: Information About the History List12396
-Node: Moving Around the History List13702
-Node: Searching the History List14587
-Node: Managing the History File16419
-Node: History Expansion17925
-Node: History Variables19769
-Node: History Programming Example21138
-Node: Concept Index23742
-Node: Function and Variable Index24223
-
-End Tag Table
diff --git a/gnu/lib/libreadline/doc/inc-hist.texi b/gnu/lib/libreadline/doc/inc-hist.texi
deleted file mode 100644
index 539e372..0000000
--- a/gnu/lib/libreadline/doc/inc-hist.texi
+++ /dev/null
@@ -1,155 +0,0 @@
-@ignore
-This file is completely identical to hsuser.texinfo, except that it has the
-reference to the programming manual removed. There are definately better ways
-to do this!
-
-This file documents the user interface to the GNU History library.
-
-Copyright (C) 1988, 1991 Free Software Foundation, Inc.
-Authored by Brian Fox.
-
-Permission is granted to make and distribute verbatim copies of this manual
-provided the copyright notice and this permission notice are preserved on
-all copies.
-
-Permission is granted to process this file through Tex and print the
-results, provided the printed document carries copying permission notice
-identical to this one except for the removal of this paragraph (this
-paragraph not being relevant to the printed manual).
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided also that the
-GNU Copyright statement is available to the distributee, and provided that
-the entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions.
-@end ignore
-
-@node Using History Interactively
-@appendix Using History Interactively
-
-This chapter describes how to use the GNU History Library interactively,
-from a user's standpoint.
-
-@menu
-* History Interaction:: What it feels like using History as a user.
-@end menu
-
-@node History Interaction
-@section History Interaction
-@cindex expansion
-
-The History library provides a history expansion feature that is similar
-to the history expansion in Csh. The following text describes the sytax
-that you use to manipulate the history information.
-
-History expansion takes place in two parts. The first is to determine
-which line from the previous history should be used during substitution.
-The second is to select portions of that line for inclusion into the
-current one. The line selected from the previous history is called the
-@dfn{event}, and the portions of that line that are acted upon are
-called @dfn{words}. The line is broken into words in the same fashion
-that the Bash shell does, so that several English (or Unix) words
-surrounded by quotes are considered as one word.
-
-@menu
-* Event Designators:: How to specify which history line to use.
-* Word Designators:: Specifying which words are of interest.
-* Modifiers:: Modifying the results of susbstitution.
-@end menu
-
-@node Event Designators
-@subsection Event Designators
-@cindex event designators
-
-An event designator is a reference to a command line entry in the
-history list.
-
-@table @asis
-
-@item @code{!}
-Start a history subsititution, except when followed by a space, tab, or
-the end of the line... @key{=} or @key{(}.
-
-@item @code{!!}
-Refer to the previous command. This is a synonym for @code{!-1}.
-
-@item @code{!n}
-Refer to command line @var{n}.
-
-@item @code{!-n}
-Refer to the command line @var{n} lines back.
-
-@item @code{!string}
-Refer to the most recent command starting with @var{string}.
-
-@item @code{!?string}[@code{?}]
-Refer to the most recent command containing @var{string}.
-
-@end table
-
-@node Word Designators
-@subsection Word Designators
-
-A @key{:} separates the event specification from the word designator. It
-can be omitted if the word designator begins with a @key{^}, @key{$},
-@key{*} or @key{%}. Words are numbered from the beginning of the line,
-with the first word being denoted by a 0 (zero).
-
-@table @code
-
-@item 0 (zero)
-The zero'th word. For many applications, this is the command word.
-
-@item n
-The @var{n}'th word.
-
-@item ^
-The first argument. that is, word 1.
-
-@item $
-The last argument.
-
-@item %
-The word matched by the most recent @code{?string?} search.
-
-@item x-y
-A range of words; @code{-@var{y}} Abbreviates @code{0-@var{y}}.
-
-@item *
-All of the words, excepting the zero'th. This is a synonym for @code{1-$}.
-It is not an error to use @key{*} if there is just one word in the event.
-The empty string is returned in that case.
-
-@end table
-
-@node Modifiers
-@subsection Modifiers
-
-After the optional word designator, you can add a sequence of one or more
-of the following modifiers, each preceded by a @key{:}.
-
-@table @code
-
-@item #
-The entire command line typed so far. This means the current command,
-not the previous command, so it really isn't a word designator, and doesn't
-belong in this section.
-
-@item h
-Remove a trailing pathname component, leaving only the head.
-
-@item r
-Remove a trailing suffix of the form @samp{.}@var{suffix}, leaving the basename.
-
-@item e
-Remove all but the suffix.
-
-@item t
-Remove all leading pathname components, leaving the tail.
-
-@item p
-Print the new command but do not execute it.
-@end table
diff --git a/gnu/lib/libreadline/doc/readline.info b/gnu/lib/libreadline/doc/readline.info
deleted file mode 100644
index f4882e9..0000000
--- a/gnu/lib/libreadline/doc/readline.info
+++ /dev/null
@@ -1,74 +0,0 @@
-This is Info file readline.info, produced by Makeinfo-1.55 from the
-input file rlman.texinfo.
-
- This document describes the GNU Readline Library, a utility which
-aids in the consistency of user interface across discrete programs that
-need to provide a command line interface.
-
- Copyright (C) 1988, 1991 Free Software Foundation, Inc.
-
- Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice pare
-preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of
-this manual under the conditions for verbatim copying, provided that
-the entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
- Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions, except that this permission notice may be stated in a
-translation approved by the Foundation.
-
-
-Indirect:
-readline.info-1: 1000
-readline.info-2: 50467
-
-Tag Table:
-(Indirect)
-Node: Top1000
-Node: Command Line Editing1613
-Node: Introduction and Notation2264
-Node: Readline Interaction3284
-Node: Readline Bare Essentials4423
-Node: Readline Movement Commands5953
-Node: Readline Killing Commands6844
-Node: Readline Arguments8547
-Node: Readline Init File9498
-Node: Readline Init Syntax10502
-Node: Conditional Init Constructs17435
-Node: Bindable Readline Commands19681
-Node: Commands For Moving20351
-Node: Commands For History21199
-Node: Commands For Text23783
-Node: Commands For Killing25522
-Node: Numeric Arguments26971
-Node: Commands For Completion27598
-Node: Keyboard Macros28525
-Node: Miscellaneous Commands29084
-Node: Readline vi Mode30372
-Node: Programming with GNU Readline32122
-Node: Basic Behavior32919
-Node: Custom Functions36232
-Node: The Function Type36845
-Node: Function Writing37690
-Node: Readline Convenience Functions40453
-Node: Function Naming41118
-Node: Keymaps42345
-Node: Binding Keys43856
-Node: Associating Function Names and Bindings45650
-Node: Allowing Undoing46812
-Node: Redisplay49397
-Node: Modifying Text50467
-Node: Utility Functions51378
-Node: Custom Completers54444
-Node: How Completing Works55165
-Node: Completion Functions58156
-Node: Completion Variables61171
-Node: A Short Completion Example64996
-Node: Concept Index77230
-Node: Function and Variable Index77717
-
-End Tag Table
diff --git a/gnu/lib/libreadline/doc/readline.info-1 b/gnu/lib/libreadline/doc/readline.info-1
deleted file mode 100644
index 78bbd05..0000000
--- a/gnu/lib/libreadline/doc/readline.info-1
+++ /dev/null
@@ -1,1322 +0,0 @@
-This is Info file readline.info, produced by Makeinfo-1.55 from the
-input file rlman.texinfo.
-
- This document describes the GNU Readline Library, a utility which
-aids in the consistency of user interface across discrete programs that
-need to provide a command line interface.
-
- Copyright (C) 1988, 1991 Free Software Foundation, Inc.
-
- Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice pare
-preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of
-this manual under the conditions for verbatim copying, provided that
-the entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
- Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions, except that this permission notice may be stated in a
-translation approved by the Foundation.
-
-
-File: readline.info, Node: Top, Next: Command Line Editing, Prev: (DIR), Up: (DIR)
-
-GNU Readline Library
-********************
-
- This document describes the GNU Readline Library, a utility which
-aids in the consistency of user interface across discrete programs that
-need to provide a command line interface.
-
-* Menu:
-
-* Command Line Editing:: GNU Readline User's Manual.
-* Programming with GNU Readline:: GNU Readline Programmer's Manual.
-* Concept Index:: Index of concepts described in this manual.
-* Function and Variable Index:: Index of externally visible functions
- and variables.
-
-
-File: readline.info, Node: Command Line Editing, Next: Programming with GNU Readline, Prev: Top, Up: Top
-
-Command Line Editing
-********************
-
- This chapter describes the basic features of the GNU command line
-editing interface.
-
-* Menu:
-
-* Introduction and Notation:: Notation used in this text.
-* Readline Interaction:: The minimum set of commands for editing a line.
-* Readline Init File:: Customizing Readline from a user's view.
-* Bindable Readline Commands:: A description of most of the Readline commands
- available for binding
-* Readline vi Mode:: A short description of how to make Readline
- behave like the vi editor.
-
-
-File: readline.info, Node: Introduction and Notation, Next: Readline Interaction, Up: Command Line Editing
-
-Introduction to Line Editing
-============================
-
- The following paragraphs describe the notation used to represent
-keystrokes.
-
- The text C-k is read as `Control-K' and describes the character
-produced when the Control key is depressed and the k key is struck.
-
- The text M-k is read as `Meta-K' and describes the character
-produced when the meta key (if you have one) is depressed, and the k
-key is struck. If you do not have a meta key, the identical keystroke
-can be generated by typing ESC first, and then typing k. Either
-process is known as "metafying" the k key.
-
- The text M-C-k is read as `Meta-Control-k' and describes the
-character produced by "metafying" C-k.
-
- In addition, several keys have their own names. Specifically, DEL,
-ESC, LFD, SPC, RET, and TAB all stand for themselves when seen in this
-text, or in an init file (*note Readline Init File::., for more info).
-
-
-File: readline.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing
-
-Readline Interaction
-====================
-
- Often during an interactive session you type in a long line of text,
-only to notice that the first word on the line is misspelled. The
-Readline library gives you a set of commands for manipulating the text
-as you type it in, allowing you to just fix your typo, and not forcing
-you to retype the majority of the line. Using these editing commands,
-you move the cursor to the place that needs correction, and delete or
-insert the text of the corrections. Then, when you are satisfied with
-the line, you simply press RETURN. You do not have to be at the end of
-the line to press RETURN; the entire line is accepted regardless of the
-location of the cursor within the line.
-
-* Menu:
-
-* Readline Bare Essentials:: The least you need to know about Readline.
-* Readline Movement Commands:: Moving about the input line.
-* Readline Killing Commands:: How to delete text, and how to get it back!
-* Readline Arguments:: Giving numeric arguments to commands.
-
-
-File: readline.info, Node: Readline Bare Essentials, Next: Readline Movement Commands, Up: Readline Interaction
-
-Readline Bare Essentials
-------------------------
-
- In order to enter characters into the line, simply type them. The
-typed character appears where the cursor was, and then the cursor moves
-one space to the right. If you mistype a character, you can use your
-erase character to back up and delete the mistyped character.
-
- Sometimes you may miss typing a character that you wanted to type,
-and not notice your error until you have typed several other
-characters. In that case, you can type C-b to move the cursor to the
-left, and then correct your mistake. Afterwards, you can move the
-cursor to the right with C-f.
-
- When you add text in the middle of a line, you will notice that
-characters to the right of the cursor are `pushed over' to make room
-for the text that you have inserted. Likewise, when you delete text
-behind the cursor, characters to the right of the cursor are `pulled
-back' to fill in the blank space created by the removal of the text. A
-list of the basic bare essentials for editing the text of an input line
-follows.
-
-C-b
- Move back one character.
-
-C-f
- Move forward one character.
-
-DEL
- Delete the character to the left of the cursor.
-
-C-d
- Delete the character underneath the cursor.
-
-Printing characters
- Insert the character into the line at the cursor.
-
-C-_
- Undo the last thing that you did. You can undo all the way back
- to an empty line.
-
-
-File: readline.info, Node: Readline Movement Commands, Next: Readline Killing Commands, Prev: Readline Bare Essentials, Up: Readline Interaction
-
-Readline Movement Commands
---------------------------
-
- The above table describes the most basic possible keystrokes that
-you need in order to do editing of the input line. For your
-convenience, many other commands have been added in addition to C-b,
-C-f, C-d, and DEL. Here are some commands for moving more rapidly
-about the line.
-
-C-a
- Move to the start of the line.
-
-C-e
- Move to the end of the line.
-
-M-f
- Move forward a word.
-
-M-b
- Move backward a word.
-
-C-l
- Clear the screen, reprinting the current line at the top.
-
- Notice how C-f moves forward a character, while M-f moves forward a
-word. It is a loose convention that control keystrokes operate on
-characters while meta keystrokes operate on words.
-
-
-File: readline.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction
-
-Readline Killing Commands
--------------------------
-
- "Killing" text means to delete the text from the line, but to save
-it away for later use, usually by "yanking" (re-inserting) it back into
-the line. If the description for a command says that it `kills' text,
-then you can be sure that you can get the text back in a different (or
-the same) place later.
-
- When you use a kill command, the text is saved in a "kill-ring".
-Any number of consecutive kills save all of the killed text together, so
-that when you yank it back, you get it all. The kill ring is not line
-specific; the text that you killed on a previously typed line is
-available to be yanked back later, when you are typing another line.
-
- Here is the list of commands for killing text.
-
-C-k
- Kill the text from the current cursor position to the end of the
- line.
-
-M-d
- Kill from the cursor to the end of the current word, or if between
- words, to the end of the next word.
-
-M-DEL
- Kill from the cursor the start of the previous word, or if between
- words, to the start of the previous word.
-
-C-w
- Kill from the cursor to the previous whitespace. This is
- different than M-DEL because the word boundaries differ.
-
- And, here is how to "yank" the text back into the line. Yanking
-means to copy the most-recently-killed text from the kill buffer.
-
-C-y
- Yank the most recently killed text back into the buffer at the
- cursor.
-
-M-y
- Rotate the kill-ring, and yank the new top. You can only do this
- if the prior command is C-y or M-y.
-
-
-File: readline.info, Node: Readline Arguments, Prev: Readline Killing Commands, Up: Readline Interaction
-
-Readline Arguments
-------------------
-
- You can pass numeric arguments to Readline commands. Sometimes the
-argument acts as a repeat count, other times it is the sign of the
-argument that is significant. If you pass a negative argument to a
-command which normally acts in a forward direction, that command will
-act in a backward direction. For example, to kill text back to the
-start of the line, you might type M- C-k.
-
- The general way to pass numeric arguments to a command is to type
-meta digits before the command. If the first `digit' you type is a
-minus sign (-), then the sign of the argument will be negative. Once
-you have typed one meta digit to get the argument started, you can type
-the remainder of the digits, and then the command. For example, to give
-the C-d command an argument of 10, you could type M-1 0 C-d.
-
-
-File: readline.info, Node: Readline Init File, Next: Bindable Readline Commands, Prev: Readline Interaction, Up: Command Line Editing
-
-Readline Init File
-==================
-
- Although the Readline library comes with a set of Emacs-like
-keybindings installed by default, it is possible that you would like to
-use a different set of keybindings. You can customize programs that
-use Readline by putting commands in an "init" file in your home
-directory. The name of this file is taken from the value of the
-environment variable `INPUTRC'. If that variable is unset, the default
-is `~/.inputrc'.
-
- When a program which uses the Readline library starts up, the init
-file is read, and the key bindings are set.
-
- In addition, the `C-x C-r' command re-reads this init file, thus
-incorporating any changes that you might have made to it.
-
-* Menu:
-
-* Readline Init Syntax:: Syntax for the commands in the inputrc file.
-* Conditional Init Constructs:: Conditional key bindings in the inputrc file.
-
-
-File: readline.info, Node: Readline Init Syntax, Next: Conditional Init Constructs, Up: Readline Init File
-
-Readline Init Syntax
---------------------
-
- There are only a few basic constructs allowed in the Readline init
-file. Blank lines are ignored. Lines beginning with a # are comments.
-Lines beginning with a $ indicate conditional constructs (*note
-Conditional Init Constructs::.). Other lines denote variable settings
-and key bindings.
-
-Variable Settings
- You can change the state of a few variables in Readline by using
- the `set' command within the init file. Here is how you would
- specify that you wish to use `vi' line editing commands:
-
- set editing-mode vi
-
- Right now, there are only a few variables which can be set; so
- few, in fact, that we just list them here:
-
- `editing-mode'
- The `editing-mode' variable controls which editing mode you
- are using. By default, Readline starts up in Emacs editing
- mode, where the keystrokes are most similar to Emacs. This
- variable can be set to either `emacs' or `vi'.
-
- `horizontal-scroll-mode'
- This variable can be set to either `On' or `Off'. Setting it
- to `On' means that the text of the lines that you edit will
- scroll horizontally on a single screen line when they are
- longer than the width of the screen, instead of wrapping onto
- a new screen line. By default, this variable is set to `Off'.
-
- `mark-modified-lines'
- This variable, when set to `On', says to display an asterisk
- (`*') at the start of history lines which have been modified.
- This variable is `off' by default.
-
- `bell-style'
- Controls what happens when Readline wants to ring the
- terminal bell. If set to `none', Readline never rings the
- bell. If set to `visible', Readline uses a visible bell if
- one is available. If set to `audible' (the default),
- Readline attempts to ring the terminal's bell.
-
- `comment-begin'
- The string to insert at the beginning of the line when the
- `vi-comment' command is executed. The default value is `"#"'.
-
- `meta-flag'
- If set to `on', Readline will enable eight-bit input (it will
- not strip the eighth bit from the characters it reads),
- regardless of what the terminal claims it can support. The
- default value is `off'.
-
- `convert-meta'
- If set to `on', Readline will convert characters with the
- eigth bit set to an ASCII key sequence by stripping the eigth
- bit and prepending an ESC character, converting them to a
- meta-prefixed key sequence. The default value is `on'.
-
- `output-meta'
- If set to `on', Readline will display characters with the
- eighth bit set directly rather than as a meta-prefixed escape
- sequence. The default is `off'.
-
- `completion-query-items'
- The number of possible completions that determines when the
- user is asked whether he wants to see the list of
- possibilities. If the number of possible completions is
- greater than this value, Readline will ask the user whether
- or not he wishes to view them; otherwise, they are simply
- listed. The default limit is `100'.
-
- `keymap'
- Sets Readline's idea of the current keymap for key binding
- commands. Acceptable `keymap' names are `emacs',
- `emacs-standard', `emacs-meta', `emacs-ctlx', `vi', `vi-move',
- `vi-command', and `vi-insert'. `vi' is equivalent to
- `vi-command'; `emacs' is equivalent to `emacs-standard'. The
- default value is `emacs'. The value of the `editing-mode'
- variable also affects the default keymap.
-
- `show-all-if-ambiguous'
- This alters the default behavior of the completion functions.
- If set to `on', words which have more than one possible
- completion cause the matches to be listed immediately instead
- of ringing the bell. The default value is `off'.
-
- `expand-tilde'
- If set to `on', tilde expansion is performed when Readline
- attempts word completion. The default is `off'.
-
-Key Bindings
- The syntax for controlling key bindings in the init file is
- simple. First you have to know the name of the command that you
- want to change. The following pages contain tables of the command
- name, the default keybinding, and a short description of what the
- command does.
-
- Once you know the name of the command, simply place the name of
- the key you wish to bind the command to, a colon, and then the
- name of the command on a line in the init file. The name of the
- key can be expressed in different ways, depending on which is most
- comfortable for you.
-
- KEYNAME: FUNCTION-NAME or MACRO
- KEYNAME is the name of a key spelled out in English. For
- example:
- Control-u: universal-argument
- Meta-Rubout: backward-kill-word
- Control-o: ">&output"
-
- In the above example, `C-u' is bound to the function
- `universal-argument', and `C-o' is bound to run the macro
- expressed on the right hand side (that is, to insert the text
- `>&output' into the line).
-
- "KEYSEQ": FUNCTION-NAME or MACRO
- KEYSEQ differs from KEYNAME above in that strings denoting an
- entire key sequence can be specified, by placing the key
- sequence in double quotes. Some GNU Emacs style key escapes
- can be used, as in the following example, but the special
- character names are not recognized.
-
- "\C-u": universal-argument
- "\C-x\C-r": re-read-init-file
- "\e[11~": "Function Key 1"
-
- In the above example, `C-u' is bound to the function
- `universal-argument' (just as it was in the first example),
- `C-x C-r' is bound to the function `re-read-init-file', and
- `ESC [ 1 1 ~' is bound to insert the text `Function Key 1'.
- The following escape sequences are available when specifying
- key sequences:
-
- ``\C-''
- control prefix
-
- ``\M-''
- meta prefix
-
- ``\e''
- an escape character
-
- ``\\''
- backslash
-
- ``\"''
- "
-
- ``\'''
- '
-
- When entering the text of a macro, single or double quotes
- should be used to indicate a macro definition. Unquoted text
- is assumed to be a function name. Backslash will quote any
- character in the macro text, including " and '. For example,
- the following binding will make `C-x \' insert a single \
- into the line:
- "\C-x\\": "\\"
-
-
-File: readline.info, Node: Conditional Init Constructs, Prev: Readline Init Syntax, Up: Readline Init File
-
-Conditional Init Constructs
----------------------------
-
- Readline implements a facility similar in spirit to the conditional
-compilation features of the C preprocessor which allows key bindings
-and variable settings to be performed as the result of tests. There
-are three parser directives used.
-
-`$if'
- The `$if' construct allows bindings to be made based on the
- editing mode, the terminal being used, or the application using
- Readline. The text of the test extends to the end of the line; no
- characters are required to isolate it.
-
- `mode'
- The `mode=' form of the `$if' directive is used to test
- whether Readline is in `emacs' or `vi' mode. This may be
- used in conjunction with the `set keymap' command, for
- instance, to set bindings in the `emacs-standard' and
- `emacs-ctlx' keymaps only if Readline is starting out in
- `emacs' mode.
-
- `term'
- The `term=' form may be used to include terminal-specific key
- bindings, perhaps to bind the key sequences output by the
- terminal's function keys. The word on the right side of the
- `=' is tested against the full name of the terminal and the
- portion of the terminal name before the first `-'. This
- allows SUN to match both SUN and SUN-CMD, for instance.
-
- `application'
- The APPLICATION construct is used to include
- application-specific settings. Each program using the
- Readline library sets the APPLICATION NAME, and you can test
- for it. This could be used to bind key sequences to
- functions useful for a specific program. For instance, the
- following command adds a key sequence that quotes the current
- or previous word in Bash:
- $if bash
- # Quote the current or previous word
- "\C-xq": "\eb\"\ef\""
- $endif
-
-`$endif'
- This command, as you saw in the previous example, terminates an
- `$if' command.
-
-`$else'
- Commands in this branch of the `$if' directive are executed if the
- test fails.
-
-
-File: readline.info, Node: Bindable Readline Commands, Next: Readline vi Mode, Prev: Readline Init File, Up: Command Line Editing
-
-Bindable Readline Commands
-==========================
-
-* Menu:
-
-* Commands For Moving:: Moving about the line.
-* Commands For History:: Getting at previous lines.
-* Commands For Text:: Commands for changing text.
-* Commands For Killing:: Commands for killing and yanking.
-* Numeric Arguments:: Specifying numeric arguments, repeat counts.
-* Commands For Completion:: Getting Readline to do the typing for you.
-* Keyboard Macros:: Saving and re-executing typed characters
-* Miscellaneous Commands:: Other miscellaneous commands.
-
-
-File: readline.info, Node: Commands For Moving, Next: Commands For History, Up: Bindable Readline Commands
-
-Commands For Moving
--------------------
-
-`beginning-of-line (C-a)'
- Move to the start of the current line.
-
-`end-of-line (C-e)'
- Move to the end of the line.
-
-`forward-char (C-f)'
- Move forward a character.
-
-`backward-char (C-b)'
- Move back a character.
-
-`forward-word (M-f)'
- Move forward to the end of the next word. Words are composed of
- letters and digits.
-
-`backward-word (M-b)'
- Move back to the start of this, or the previous, word. Words are
- composed of letters and digits.
-
-`clear-screen (C-l)'
- Clear the screen and redraw the current line, leaving the current
- line at the top of the screen.
-
-`redraw-current-line ()'
- Refresh the current line. By default, this is unbound.
-
-
-File: readline.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Bindable Readline Commands
-
-Commands For Manipulating The History
--------------------------------------
-
-`accept-line (Newline, Return)'
- Accept the line regardless of where the cursor is. If this line is
- non-empty, add it to the history list. If this line was a history
- line, then restore the history line to its original state.
-
-`previous-history (C-p)'
- Move `up' through the history list.
-
-`next-history (C-n)'
- Move `down' through the history list.
-
-`beginning-of-history (M-<)'
- Move to the first line in the history.
-
-`end-of-history (M->)'
- Move to the end of the input history, i.e., the line you are
- entering.
-
-`reverse-search-history (C-r)'
- Search backward starting at the current line and moving `up'
- through the history as necessary. This is an incremental search.
-
-`forward-search-history (C-s)'
- Search forward starting at the current line and moving `down'
- through the the history as necessary. This is an incremental
- search.
-
-`non-incremental-reverse-search-history (M-p)'
- Search backward starting at the current line and moving `up'
- through the history as necessary using a non-incremental search
- for a string supplied by the user.
-
-`non-incremental-forward-search-history (M-n)'
- Search forward starting at the current line and moving `down'
- through the the history as necessary using a non-incremental search
- for a string supplied by the user.
-
-`history-search-forward ()'
- Search forward through the history for the string of characters
- between the start of the current line and the current point. This
- is a non-incremental search. By default, this command is unbound.
-
-`history-search-backward ()'
- Search backward through the history for the string of characters
- between the start of the current line and the current point. This
- is a non-incremental search. By default, this command is unbound.
-
-`yank-nth-arg (M-C-y)'
- Insert the first argument to the previous command (usually the
- second word on the previous line). With an argument N, insert the
- Nth word from the previous command (the words in the previous
- command begin with word 0). A negative argument inserts the Nth
- word from the end of the previous command.
-
-`yank-last-arg (M-., M-_)'
- Insert last argument to the previous command (the last word on the
- previous line). With an argument, behave exactly like
- `yank-nth-arg'.
-
-
-File: readline.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Bindable Readline Commands
-
-Commands For Changing Text
---------------------------
-
-`delete-char (C-d)'
- Delete the character under the cursor. If the cursor is at the
- beginning of the line, there are no characters in the line, and
- the last character typed was not C-d, then return EOF.
-
-`backward-delete-char (Rubout)'
- Delete the character behind the cursor. A numeric arg says to kill
- the characters instead of deleting them.
-
-`quoted-insert (C-q, C-v)'
- Add the next character that you type to the line verbatim. This is
- how to insert key sequences like C-q, for example.
-
-`tab-insert (M-TAB)'
- Insert a tab character.
-
-`self-insert (a, b, A, 1, !, ...)'
- Insert yourself.
-
-`transpose-chars (C-t)'
- Drag the character before the cursor forward over the character at
- the cursor, moving the cursor forward as well. If the insertion
- point is at the end of the line, then this transposes the last two
- characters of the line. Negative argumentss don't work.
-
-`transpose-words (M-t)'
- Drag the word behind the cursor past the word in front of the
- cursor moving the cursor over that word as well.
-
-`upcase-word (M-u)'
- Uppercase the current (or following) word. With a negative
- argument, do the previous word, but do not move the cursor.
-
-`downcase-word (M-l)'
- Lowercase the current (or following) word. With a negative
- argument, do the previous word, but do not move the cursor.
-
-`capitalize-word (M-c)'
- Capitalize the current (or following) word. With a negative
- argument, do the previous word, but do not move the cursor.
-
-
-File: readline.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands
-
-Killing And Yanking
--------------------
-
-`kill-line (C-k)'
- Kill the text from the current cursor position to the end of the
- line.
-
-`backward-kill-line (C-x Rubout)'
- Kill backward to the beginning of the line.
-
-`unix-line-discard (C-u)'
- Kill backward from the cursor to the beginning of the current line.
- Save the killed text on the kill-ring.
-
-`kill-whole-line ()'
- Kill all characters on the current line, no matter where the
- cursor is. By default, this is unbound.
-
-`kill-word (M-d)'
- Kill from the cursor to the end of the current word, or if between
- words, to the end of the next word. Word boundaries are the same
- as `forward-word'.
-
-`backward-kill-word (M-DEL)'
- Kill the word behind the cursor. Word boundaries are the same as
- `backward-word'.
-
-`unix-word-rubout (C-w)'
- Kill the word behind the cursor, using white space as a word
- boundary. The killed text is saved on the kill-ring.
-
-`delete-horizontal-space ()'
- Delete all spaces and tabs around point. By default, this is
- unbound.
-
-`yank (C-y)'
- Yank the top of the kill ring into the buffer at the current
- cursor position.
-
-`yank-pop (M-y)'
- Rotate the kill-ring, and yank the new top. You can only do this
- if the prior command is yank or yank-pop.
-
-
-File: readline.info, Node: Numeric Arguments, Next: Commands For Completion, Prev: Commands For Killing, Up: Bindable Readline Commands
-
-Specifying Numeric Arguments
-----------------------------
-
-`digit-argument (M-0, M-1, ... M--)'
- Add this digit to the argument already accumulating, or start a new
- argument. M- starts a negative argument.
-
-`universal-argument ()'
- Each time this is executed, the argument count is multiplied by
- four. The argument count is initially one, so executing this
- function the first time makes the argument count four. By
- default, this is not bound to a key.
-
-
-File: readline.info, Node: Commands For Completion, Next: Keyboard Macros, Prev: Numeric Arguments, Up: Bindable Readline Commands
-
-Letting Readline Type For You
------------------------------
-
-`complete (TAB)'
- Attempt to do completion on the text before the cursor. This is
- application-specific. Generally, if you are typing a filename
- argument, you can do filename completion; if you are typing a
- command, you can do command completion, if you are typing in a
- symbol to GDB, you can do symbol name completion, if you are
- typing in a variable to Bash, you can do variable name completion,
- and so on.
-
-`possible-completions (M-?)'
- List the possible completions of the text before the cursor.
-
-`insert-completions ()'
- Insert all completions of the text before point that would have
- been generated by `possible-completions'. By default, this is not
- bound to a key.
-
-
-File: readline.info, Node: Keyboard Macros, Next: Miscellaneous Commands, Prev: Commands For Completion, Up: Bindable Readline Commands
-
-Keyboard Macros
----------------
-
-`start-kbd-macro (C-x ()'
- Begin saving the characters typed into the current keyboard macro.
-
-`end-kbd-macro (C-x ))'
- Stop saving the characters typed into the current keyboard macro
- and save the definition.
-
-`call-last-kbd-macro (C-x e)'
- Re-execute the last keyboard macro defined, by making the
- characters in the macro appear as if typed at the keyboard.
-
-
-File: readline.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bindable Readline Commands
-
-Some Miscellaneous Commands
----------------------------
-
-`re-read-init-file (C-x C-r)'
- Read in the contents of your init file, and incorporate any
- bindings or variable assignments found there.
-
-`abort (C-g)'
- Abort the current editing command and ring the terminal's bell
- (subject to the setting of `bell-style').
-
-`do-uppercase-version (M-a, M-b, ...)'
- Run the command that is bound to the corresoponding uppercase
- character.
-
-`prefix-meta (ESC)'
- Make the next character that you type be metafied. This is for
- people without a meta key. Typing `ESC f' is equivalent to typing
- `M-f'.
-
-`undo (C-_, C-x C-u)'
- Incremental undo, separately remembered for each line.
-
-`revert-line (M-r)'
- Undo all changes made to this line. This is like typing the `undo'
- command enough times to get back to the beginning.
-
-`tilde-expand (M-~)'
- Perform tilde expansion on the current word.
-
-`dump-functions ()'
- Print all of the functions and their key bindings to the readline
- output stream. If a numeric argument is supplied, the output is
- formatted in such a way that it can be made part of an INPUTRC
- file.
-
-
-File: readline.info, Node: Readline vi Mode, Prev: Bindable Readline Commands, Up: Command Line Editing
-
-Readline vi Mode
-================
-
- While the Readline library does not have a full set of `vi' editing
-functions, it does contain enough to allow simple editing of the line.
-The Readline `vi' mode behaves as specified in the Posix 1003.2
-standard.
-
- In order to switch interactively between `Emacs' and `Vi' editing
-modes, use the command M-C-j (toggle-editing-mode). The Readline
-default is `emacs' mode.
-
- When you enter a line in `vi' mode, you are already placed in
-`insertion' mode, as if you had typed an `i'. Pressing ESC switches
-you into `command' mode, where you can edit the text of the line with
-the standard `vi' movement keys, move to previous history lines with
-`k', and following lines with `j', and so forth.
-
- This document describes the GNU Readline Library, a utility for
-aiding in the consitency of user interface across discrete programs
-that need to provide a command line interface.
-
- Copyright (C) 1988, 1994 Free Software Foundation, Inc.
-
- Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice pare
-preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of
-this manual under the conditions for verbatim copying, provided that
-the entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
- Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions, except that this permission notice may be stated in a
-translation approved by the Foundation.
-
-
-File: readline.info, Node: Programming with GNU Readline, Next: Concept Index, Prev: Command Line Editing, Up: Top
-
-Programming with GNU Readline
-*****************************
-
- This chapter describes the interface between the GNU Readline
-Library and other programs. If you are a programmer, and you wish to
-include the features found in GNU Readline such as completion, line
-editing, and interactive history manipulation in your own programs,
-this section is for you.
-
-* Menu:
-
-* Basic Behavior:: Using the default behavior of Readline.
-* Custom Functions:: Adding your own functions to Readline.
-* Readline Convenience Functions:: Functions which Readline supplies to
- aid in writing your own
-* Custom Completers:: Supplanting or supplementing Readline's
- completion functions.
-
-
-File: readline.info, Node: Basic Behavior, Next: Custom Functions, Up: Programming with GNU Readline
-
-Basic Behavior
-==============
-
- Many programs provide a command line interface, such as `mail',
-`ftp', and `sh'. For such programs, the default behaviour of Readline
-is sufficient. This section describes how to use Readline in the
-simplest way possible, perhaps to replace calls in your code to
-`gets()' or `fgets ()'.
-
- The function `readline ()' prints a prompt and then reads and returns
-a single line of text from the user. The line `readline' returns is
-allocated with `malloc ()'; you should `free ()' the line when you are
-done with it. The declaration for `readline' in ANSI C is
-
- `char *readline (char *PROMPT);'
-
-So, one might say
- `char *line = readline ("Enter a line: ");'
-
-in order to read a line of text from the user. The line returned has
-the final newline removed, so only the text remains.
-
- If `readline' encounters an `EOF' while reading the line, and the
-line is empty at that point, then `(char *)NULL' is returned.
-Otherwise, the line is ended just as if a newline had been typed.
-
- If you want the user to be able to get at the line later, (with C-p
-for example), you must call `add_history ()' to save the line away in a
-"history" list of such lines.
-
- `add_history (line)';
-
-For full details on the GNU History Library, see the associated manual.
-
- It is preferable to avoid saving empty lines on the history list,
-since users rarely have a burning need to reuse a blank line. Here is
-a function which usefully replaces the standard `gets ()' library
-function, and has the advantage of no static buffer to overflow:
-
- /* A static variable for holding the line. */
- static char *line_read = (char *)NULL;
-
- /* Read a string, and return a pointer to it. Returns NULL on EOF. */
- char *
- rl_gets ()
- {
- /* If the buffer has already been allocated, return the memory
- to the free pool. */
- if (line_read)
- {
- free (line_read);
- line_read = (char *)NULL;
- }
-
- /* Get a line from the user. */
- line_read = readline ("");
-
- /* If the line has any text in it, save it on the history. */
- if (line_read && *line_read)
- add_history (line_read);
-
- return (line_read);
- }
-
- This function gives the user the default behaviour of TAB
-completion: completion on file names. If you do not want Readline to
-complete on filenames, you can change the binding of the TAB key with
-`rl_bind_key ()'.
-
- `int rl_bind_key (int KEY, int (*FUNCTION)());'
-
- `rl_bind_key ()' takes two arguments: KEY is the character that you
-want to bind, and FUNCTION is the address of the function to call when
-KEY is pressed. Binding TAB to `rl_insert ()' makes TAB insert itself.
-`rl_bind_key ()' returns non-zero if KEY is not a valid ASCII character
-code (between 0 and 255).
-
- Thus, to disable the default TAB behavior, the following suffices:
- `rl_bind_key ('\t', rl_insert);'
-
- This code should be executed once at the start of your program; you
-might write a function called `initialize_readline ()' which performs
-this and other desired initializations, such as installing custom
-completers (*note Custom Completers::.).
-
-
-File: readline.info, Node: Custom Functions, Next: Readline Convenience Functions, Prev: Basic Behavior, Up: Programming with GNU Readline
-
-Custom Functions
-================
-
- Readline provides many functions for manipulating the text of the
-line, but it isn't possible to anticipate the needs of all programs.
-This section describes the various functions and variables defined
-within the Readline library which allow a user program to add
-customized functionality to Readline.
-
-* Menu:
-
-* The Function Type:: C declarations to make code readable.
-* Function Writing:: Variables and calling conventions.
-
-
-File: readline.info, Node: The Function Type, Next: Function Writing, Up: Custom Functions
-
-The Function Type
------------------
-
- For readabilty, we declare a new type of object, called "Function".
-A `Function' is a C function which returns an `int'. The type
-declaration for `Function' is:
-
-`typedef int Function ();'
-
- The reason for declaring this new type is to make it easier to write
-code describing pointers to C functions. Let us say we had a variable
-called FUNC which was a pointer to a function. Instead of the classic
-C declaration
-
- `int (*)()func;'
-
-we may write
-
- `Function *func;'
-
-Similarly, there are
-
- typedef void VFunction ();
- typedef char *CPFunction (); and
- typedef char **CPPFunction ();
-
-for functions returning no value, `pointer to char', and `pointer to
-pointer to char', respectively.
-
-
-File: readline.info, Node: Function Writing, Prev: The Function Type, Up: Custom Functions
-
-Writing a New Function
-----------------------
-
- In order to write new functions for Readline, you need to know the
-calling conventions for keyboard-invoked functions, and the names of the
-variables that describe the current state of the line read so far.
-
- The calling sequence for a command `foo' looks like
-
- `foo (int count, int key)'
-
-where COUNT is the numeric argument (or 1 if defaulted) and KEY is the
-key that invoked this function.
-
- It is completely up to the function as to what should be done with
-the numeric argument. Some functions use it as a repeat count, some as
-a flag, and others to choose alternate behavior (refreshing the current
-line as opposed to refreshing the screen, for example). Some choose to
-ignore it. In general, if a function uses the numeric argument as a
-repeat count, it should be able to do something useful with both
-negative and positive arguments. At the very least, it should be aware
-that it can be passed a negative argument.
-
- - Variable: char * rl_line_buffer
- This is the line gathered so far. You are welcome to modify the
- contents of the line, but see *Note Allowing Undoing::.
-
- - Variable: int rl_point
- The offset of the current cursor position in `rl_line_buffer' (the
- *point*).
-
- - Variable: int rl_end
- The number of characters present in `rl_line_buffer'. When
- `rl_point' is at the end of the line, `rl_point' and `rl_end' are
- equal.
-
- - Variable: int rl_mark
- The mark (saved position) in the current line. If set, the mark
- and point define a *region*.
-
- - Variable: int rl_done
- Setting this to a non-zero value causes Readline to return the
- current line immediately.
-
- - Variable: int rl_pending_input
- Setting this to a value makes it the next keystroke read. This is
- a way to stuff a single character into the input stream.
-
- - Variable: char * rl_prompt
- The prompt Readline uses. This is set from the argument to
- `readline ()', and should not be assigned to directly.
-
- - Variable: char * rl_terminal_name
- The terminal type, used for initialization.
-
- - Variable: char * rl_readline_name
- This variable is set to a unique name by each application using
- Readline. The value allows conditional parsing of the inputrc file
- (*note Conditional Init Constructs::.).
-
- - Variable: FILE * rl_instream
- The stdio stream from which Readline reads input.
-
- - Variable: FILE * rl_outstream
- The stdio stream to which Readline performs output.
-
- - Variable: Function * rl_startup_hook
- If non-zero, this is the address of a function to call just before
- `readline' prints the first prompt.
-
-
-File: readline.info, Node: Readline Convenience Functions, Next: Custom Completers, Prev: Custom Functions, Up: Programming with GNU Readline
-
-Readline Convenience Functions
-==============================
-
-* Menu:
-
-* Function Naming:: How to give a function you write a name.
-* Keymaps:: Making keymaps.
-* Binding Keys:: Changing Keymaps.
-* Associating Function Names and Bindings:: Translate function names to
- key sequences.
-* Allowing Undoing:: How to make your functions undoable.
-* Redisplay:: Functions to control line display.
-* Modifying Text:: Functions to modify `rl_line_buffer'.
-* Utility Functions:: Generally useful functions and hooks.
-
-
-File: readline.info, Node: Function Naming, Next: Keymaps, Up: Readline Convenience Functions
-
-Naming a Function
------------------
-
- The user can dynamically change the bindings of keys while using
-Readline. This is done by representing the function with a descriptive
-name. The user is able to type the descriptive name when referring to
-the function. Thus, in an init file, one might find
-
- Meta-Rubout: backward-kill-word
-
- This binds the keystroke Meta-Rubout to the function *descriptively*
-named `backward-kill-word'. You, as the programmer, should bind the
-functions you write to descriptive names as well. Readline provides a
-function for doing that:
-
- - Function: int rl_add_defun (char *name, Function *function, int key)
- Add NAME to the list of named functions. Make FUNCTION be the
- function that gets called. If KEY is not -1, then bind it to
- FUNCTION using `rl_bind_key ()'.
-
- Using this function alone is sufficient for most applications. It is
-the recommended way to add a few functions to the default functions that
-Readline has built in. If you need to do something other than adding a
-function to Readline, you may need to use the underlying functions
-described below.
-
-
-File: readline.info, Node: Keymaps, Next: Binding Keys, Prev: Function Naming, Up: Readline Convenience Functions
-
-Selecting a Keymap
-------------------
-
- Key bindings take place on a "keymap". The keymap is the
-association between the keys that the user types and the functions that
-get run. You can make your own keymaps, copy existing keymaps, and tell
-Readline which keymap to use.
-
- - Function: Keymap rl_make_bare_keymap ()
- Returns a new, empty keymap. The space for the keymap is
- allocated with `malloc ()'; you should `free ()' it when you are
- done.
-
- - Function: Keymap rl_copy_keymap (Keymap map)
- Return a new keymap which is a copy of MAP.
-
- - Function: Keymap rl_make_keymap ()
- Return a new keymap with the printing characters bound to
- rl_insert, the lowercase Meta characters bound to run their
- equivalents, and the Meta digits bound to produce numeric
- arguments.
-
- - Function: void rl_discard_keymap (Keymap keymap)
- Free the storage associated with KEYMAP.
-
- Readline has several internal keymaps. These functions allow you to
-change which keymap is active.
-
- - Function: Keymap rl_get_keymap ()
- Returns the currently active keymap.
-
- - Function: void rl_set_keymap (Keymap keymap)
- Makes KEYMAP the currently active keymap.
-
- - Function: Keymap rl_get_keymap_by_name (char *name)
- Return the keymap matching NAME. NAME is one which would be
- supplied in a `set keymap' inputrc line (*note Readline Init
- File::.).
-
-
-File: readline.info, Node: Binding Keys, Next: Associating Function Names and Bindings, Prev: Keymaps, Up: Readline Convenience Functions
-
-Binding Keys
-------------
-
- You associate keys with functions through the keymap. Readline has
-several internal keymaps: `emacs_standard_keymap', `emacs_meta_keymap',
-`emacs_ctlx_keymap', `vi_movement_keymap', and `vi_insertion_keymap'.
-`emacs_standard_keymap' is the default, and the examples in this manual
-assume that.
-
- These functions manage key bindings.
-
- - Function: int rl_bind_key (int key, Function *function)
- Binds KEY to FUNCTION in the currently active keymap. Returns
- non-zero in the case of an invalid KEY.
-
- - Function: int rl_bind_key_in_map (int key, Function *function,
- Keymap map)
- Bind KEY to FUNCTION in MAP. Returns non-zero in the case of an
- invalid KEY.
-
- - Function: int rl_unbind_key (int key)
- Bind KEY to the null function in the currently active keymap.
- Returns non-zero in case of error.
-
- - Function: int rl_unbind_key_in_map (int key, Keymap map)
- Bind KEY to the null function in MAP. Returns non-zero in case of
- error.
-
- - Function: int rl_generic_bind (int type, char *keyseq, char *data,
- Keymap map)
- Bind the key sequence represented by the string KEYSEQ to the
- arbitrary pointer DATA. TYPE says what kind of data is pointed to
- by DATA; this can be a function (`ISFUNC'), a macro (`ISMACR'), or
- a keymap (`ISKMAP'). This makes new keymaps as necessary. The
- initial keymap in which to do bindings is MAP.
-
- - Function: int rl_parse_and_bind (char *line)
- Parse LINE as if it had been read from the `inputrc' file and
- perform any key bindings and variable assignments found (*note
- Readline Init File::.).
-
-
-File: readline.info, Node: Associating Function Names and Bindings, Next: Allowing Undoing, Prev: Binding Keys, Up: Readline Convenience Functions
-
-Associating Function Names and Bindings
----------------------------------------
-
- These functions allow you to find out what keys invoke named
-functions and the functions invoked by a particular key sequence.
-
- - Function: Function * rl_named_function (char *name)
- Return the function with name NAME.
-
- - Function: Function * rl_function_of_keyseq (char *keyseq, Keymap
- map, int *type)
- Return the function invoked by KEYSEQ in keymap MAP. If MAP is
- NULL, the current keymap is used. If TYPE is not NULL, the type
- of the object is returned in it (one of `ISFUNC', `ISKMAP', or
- `ISMACR').
-
- - Function: char ** rl_invoking_keyseqs (Function *function)
- Return an array of strings representing the key sequences used to
- invoke FUNCTION in the current keymap.
-
- - Function: char ** rl_invoking_keyseqs_in_map (Function *function,
- Keymap map)
- Return an array of strings representing the key sequences used to
- invoke FUNCTION in the keymap MAP.
-
-
-File: readline.info, Node: Allowing Undoing, Next: Redisplay, Prev: Associating Function Names and Bindings, Up: Readline Convenience Functions
-
-Allowing Undoing
-----------------
-
- Supporting the undo command is a painless thing, and makes your
-functions much more useful. It is certainly easy to try something if
-you know you can undo it. I could use an undo function for the stock
-market.
-
- If your function simply inserts text once, or deletes text once, and
-uses `rl_insert_text ()' or `rl_delete_text ()' to do it, then undoing
-is already done for you automatically.
-
- If you do multiple insertions or multiple deletions, or any
-combination of these operations, you should group them together into
-one operation. This is done with `rl_begin_undo_group ()' and
-`rl_end_undo_group ()'.
-
- The types of events that can be undone are:
-
- enum undo_code { UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END };
-
- Notice that `UNDO_DELETE' means to insert some text, and
-`UNDO_INSERT' means to delete some text. That is, the undo code tells
-undo what to undo, not how to undo it. `UNDO_BEGIN' and `UNDO_END' are
-tags added by `rl_begin_undo_group ()' and `rl_end_undo_group ()'.
-
- - Function: int rl_begin_undo_group ()
- Begins saving undo information in a group construct. The undo
- information usually comes from calls to `rl_insert_text ()' and
- `rl_delete_text ()', but could be the result of calls to
- `rl_add_undo ()'.
-
- - Function: int rl_end_undo_group ()
- Closes the current undo group started with `rl_begin_undo_group
- ()'. There should be one call to `rl_end_undo_group ()' for each
- call to `rl_begin_undo_group ()'.
-
- - Function: void rl_add_undo (enum undo_code what, int start, int end,
- char *text)
- Remember how to undo an event (according to WHAT). The affected
- text runs from START to END, and encompasses TEXT.
-
- - Function: void free_undo_list ()
- Free the existing undo list.
-
- - Function: int rl_do_undo ()
- Undo the first thing on the undo list. Returns `0' if there was
- nothing to undo, non-zero if something was undone.
-
- Finally, if you neither insert nor delete text, but directly modify
-the existing text (e.g., change its case), call `rl_modifying ()' once,
-just before you modify the text. You must supply the indices of the
-text range that you are going to modify.
-
- - Function: int rl_modifying (int start, int end)
- Tell Readline to save the text between START and END as a single
- undo unit. It is assumed that you will subsequently modify that
- text.
-
-
-File: readline.info, Node: Redisplay, Next: Modifying Text, Prev: Allowing Undoing, Up: Readline Convenience Functions
-
-Redisplay
----------
-
- - Function: int rl_redisplay ()
- Change what's displayed on the screen to reflect the current
- contents of `rl_line_buffer'.
-
- - Function: int rl_forced_update_display ()
- Force the line to be updated and redisplayed, whether or not
- Readline thinks the screen display is correct.
-
- - Function: int rl_on_new_line ()
- Tell the update routines that we have moved onto a new (empty)
- line, usually after ouputting a newline.
-
- - Function: int rl_reset_line_state ()
- Reset the display state to a clean state and redisplay the current
- line starting on a new line.
-
- - Function: int rl_message (va_alist)
- The arguments are a string as would be supplied to `printf'. The
- resulting string is displayed in the "echo area". The echo area
- is also used to display numeric arguments and search strings.
-
- - Function: int rl_clear_message ()
- Clear the message in the echo area.
-
diff --git a/gnu/lib/libreadline/doc/readline.info-2 b/gnu/lib/libreadline/doc/readline.info-2
deleted file mode 100644
index 35681aa..0000000
--- a/gnu/lib/libreadline/doc/readline.info-2
+++ /dev/null
@@ -1,978 +0,0 @@
-This is Info file readline.info, produced by Makeinfo-1.55 from the
-input file rlman.texinfo.
-
- This document describes the GNU Readline Library, a utility which
-aids in the consistency of user interface across discrete programs that
-need to provide a command line interface.
-
- Copyright (C) 1988, 1991 Free Software Foundation, Inc.
-
- Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice pare
-preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of
-this manual under the conditions for verbatim copying, provided that
-the entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
- Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions, except that this permission notice may be stated in a
-translation approved by the Foundation.
-
-
-File: readline.info, Node: Modifying Text, Next: Utility Functions, Prev: Redisplay, Up: Readline Convenience Functions
-
-Modifying Text
---------------
-
- - Function: int rl_insert_text (char *text)
- Insert TEXT into the line at the current cursor position.
-
- - Function: int rl_delete_text (int start, int end)
- Delete the text between START and END in the current line.
-
- - Function: char * rl_copy_text (int start, int end)
- Return a copy of the text between START and END in the current
- line.
-
- - Function: int rl_kill_text (int start, int end)
- Copy the text between START and END in the current line to the
- kill ring, appending or prepending to the last kill if the last
- command was a kill command. The text is deleted. If START is
- less than END, the text is appended, otherwise prepended. If the
- last command was not a kill, a new kill ring slot is used.
-
-
-File: readline.info, Node: Utility Functions, Prev: Modifying Text, Up: Readline Convenience Functions
-
-Utility Functions
------------------
-
- - Function: int rl_reset_terminal (char *terminal_name)
- Reinitialize Readline's idea of the terminal settings using
- TERMINAL_NAME as the terminal type (e.g., `vt100').
-
- - Function: int alphabetic (int c)
- Return 1 if C is an alphabetic character.
-
- - Function: int numeric (int c)
- Return 1 if C is a numeric character.
-
- - Function: int ding ()
- Ring the terminal bell, obeying the setting of `bell-style'.
-
- The following are implemented as macros, defined in `chartypes.h'.
-
- - Function: int uppercase_p (int c)
- Return 1 if C is an uppercase alphabetic character.
-
- - Function: int lowercase_p (int c)
- Return 1 if C is a lowercase alphabetic character.
-
- - Function: int digit_p (int c)
- Return 1 if C is a numeric character.
-
- - Function: int to_upper (int c)
- If C is a lowercase alphabetic character, return the corresponding
- uppercase character.
-
- - Function: int to_lower (int c)
- If C is an uppercase alphabetic character, return the corresponding
- lowercase character.
-
- - Function: int digit_value (int c)
- If C is a number, return the value it represents.
-
-An Example
-----------
-
- Here is a function which changes lowercase characters to their
-uppercase equivalents, and uppercase characters to lowercase. If this
-function was bound to `M-c', then typing `M-c' would change the case of
-the character under point. Typing `M-1 0 M-c' would change the case of
-the following 10 characters, leaving the cursor on the last character
-changed.
-
- /* Invert the case of the COUNT following characters. */
- int
- invert_case_line (count, key)
- int count, key;
- {
- register int start, end, i;
-
- start = rl_point;
-
- if (rl_point >= rl_end)
- return (0);
-
- if (count < 0)
- {
- direction = -1;
- count = -count;
- }
- else
- direction = 1;
-
- /* Find the end of the range to modify. */
- end = start + (count * direction);
-
- /* Force it to be within range. */
- if (end > rl_end)
- end = rl_end;
- else if (end < 0)
- end = 0;
-
- if (start == end)
- return (0);
-
- if (start > end)
- {
- int temp = start;
- start = end;
- end = temp;
- }
-
- /* Tell readline that we are modifying the line, so it will save
- the undo information. */
- rl_modifying (start, end);
-
- for (i = start; i != end; i++)
- {
- if (uppercase_p (rl_line_buffer[i]))
- rl_line_buffer[i] = to_lower (rl_line_buffer[i]);
- else if (lowercase_p (rl_line_buffer[i]))
- rl_line_buffer[i] = to_upper (rl_line_buffer[i]);
- }
- /* Move point to on top of the last character changed. */
- rl_point = (direction == 1) ? end - 1 : start;
- return (0);
- }
-
-
-File: readline.info, Node: Custom Completers, Prev: Readline Convenience Functions, Up: Programming with GNU Readline
-
-Custom Completers
-=================
-
- Typically, a program that reads commands from the user has a way of
-disambiguating commands and data. If your program is one of these, then
-it can provide completion for commands, data, or both. The following
-sections describe how your program and Readline cooperate to provide
-this service.
-
-* Menu:
-
-* How Completing Works:: The logic used to do completion.
-* Completion Functions:: Functions provided by Readline.
-* Completion Variables:: Variables which control completion.
-* A Short Completion Example:: An example of writing completer subroutines.
-
-
-File: readline.info, Node: How Completing Works, Next: Completion Functions, Up: Custom Completers
-
-How Completing Works
---------------------
-
- In order to complete some text, the full list of possible completions
-must be available. That is, it is not possible to accurately expand a
-partial word without knowing all of the possible words which make sense
-in that context. The Readline library provides the user interface to
-completion, and two of the most common completion functions: filename
-and username. For completing other types of text, you must write your
-own completion function. This section describes exactly what such
-functions must do, and provides an example.
-
- There are three major functions used to perform completion:
-
- 1. The user-interface function `rl_complete ()'. This function is
- called with the same arguments as other Readline functions
- intended for interactive use: COUNT and INVOKING_KEY. It
- isolates the word to be completed and calls `completion_matches
- ()' to generate a list of possible completions. It then either
- lists the possible completions, inserts the possible completions,
- or actually performs the completion, depending on which behavior
- is desired.
-
- 2. The internal function `completion_matches ()' uses your
- "generator" function to generate the list of possible matches, and
- then returns the array of these matches. You should place the
- address of your generator function in
- `rl_completion_entry_function'.
-
- 3. The generator function is called repeatedly from
- `completion_matches ()', returning a string each time. The
- arguments to the generator function are TEXT and STATE. TEXT is
- the partial word to be completed. STATE is zero the first time
- the function is called, allowing the generator to perform any
- necessary initialization, and a positive non-zero integer for each
- subsequent call. When the generator function returns `(char
- *)NULL' this signals `completion_matches ()' that there are no
- more possibilities left. Usually the generator function computes
- the list of possible completions when STATE is zero, and returns
- them one at a time on subsequent calls. Each string the generator
- function returns as a match must be allocated with `malloc()';
- Readline frees the strings when it has finished with them.
-
-
- - Function: int rl_complete (int ignore, int invoking_key)
- Complete the word at or before point. You have supplied the
- function that does the initial simple matching selection algorithm
- (see `completion_matches ()'). The default is to do filename
- completion.
-
- - Variable: Function * rl_completion_entry_function
- This is a pointer to the generator function for `completion_matches
- ()'. If the value of `rl_completion_entry_function' is `(Function
- *)NULL' then the default filename generator function,
- `filename_entry_function ()', is used.
-
-
-File: readline.info, Node: Completion Functions, Next: Completion Variables, Prev: How Completing Works, Up: Custom Completers
-
-Completion Functions
---------------------
-
- Here is the complete list of callable completion functions present in
-Readline.
-
- - Function: int rl_complete_internal (int what_to_do)
- Complete the word at or before point. WHAT_TO_DO says what to do
- with the completion. A value of `?' means list the possible
- completions. `TAB' means do standard completion. `*' means
- insert all of the possible completions. `!' means to display all
- of the possible completions, if there is more than one, as well as
- performing partial completion.
-
- - Function: int rl_complete (int ignore, int invoking_key)
- Complete the word at or before point. You have supplied the
- function that does the initial simple matching selection algorithm
- (see `completion_matches ()' and `rl_completion_entry_function').
- The default is to do filename completion. This calls
- `rl_complete_internal ()' with an argument depending on
- INVOKING_KEY.
-
- - Function: int rl_possible_completions (int count, int invoking_key))
- List the possible completions. See description of `rl_complete
- ()'. This calls `rl_complete_internal ()' with an argument of `?'.
-
- - Function: int rl_insert_completions (int count, int invoking_key))
- Insert the list of possible completions into the line, deleting the
- partially-completed word. See description of `rl_complete ()'.
- This calls `rl_complete_internal ()' with an argument of `*'.
-
- - Function: char ** completion_matches (char *text, CPFunction
- *entry_func)
- Returns an array of `(char *)' which is a list of completions for
- TEXT. If there are no completions, returns `(char **)NULL'. The
- first entry in the returned array is the substitution for TEXT.
- The remaining entries are the possible completions. The array is
- terminated with a `NULL' pointer.
-
- ENTRY_FUNC is a function of two args, and returns a `(char *)'.
- The first argument is TEXT. The second is a state argument; it is
- zero on the first call, and non-zero on subsequent calls.
- eNTRY_FUNC returns a `NULL' pointer to the caller when there are
- no more matches.
-
- - Function: char * filename_completion_function (char *text, int state)
- A generator function for filename completion in the general case.
- Note that completion in Bash is a little different because of all
- the pathnames that must be followed when looking up completions
- for a command. The Bash source is a useful reference for writing
- custom completion functions.
-
- - Function: char * username_completion_function (char *text, int state)
- A completion generator for usernames. TEXT contains a partial
- username preceded by a random character (usually `~'). As with all
- completion generators, STATE is zero on the first call and non-zero
- for subsequent calls.
-
-
-File: readline.info, Node: Completion Variables, Next: A Short Completion Example, Prev: Completion Functions, Up: Custom Completers
-
-Completion Variables
---------------------
-
- - Variable: Function * rl_completion_entry_function
- A pointer to the generator function for `completion_matches ()'.
- `NULL' means to use `filename_entry_function ()', the default
- filename completer.
-
- - Variable: CPPFunction * rl_attempted_completion_function
- A pointer to an alternative function to create matches. The
- function is called with TEXT, START, and END. START and END are
- indices in `rl_line_buffer' saying what the boundaries of TEXT
- are. If this function exists and returns `NULL', or if this
- variable is set to `NULL', then `rl_complete ()' will call the
- value of `rl_completion_entry_function' to generate matches,
- otherwise the array of strings returned will be used.
-
- - Variable: int rl_completion_query_items
- Up to this many items will be displayed in response to a
- possible-completions call. After that, we ask the user if she is
- sure she wants to see them all. The default value is 100.
-
- - Variable: char * rl_basic_word_break_characters
- The basic list of characters that signal a break between words for
- the completer routine. The default value of this variable is the
- characters which break words for completion in Bash, i.e., `"
- \t\n\"\\'`@$><=;|&{("'.
-
- - Variable: char * rl_completer_word_break_characters
- The list of characters that signal a break between words for
- `rl_complete_internal ()'. The default list is the value of
- `rl_basic_word_break_characters'.
-
- - Variable: char * rl_special_prefixes
- The list of characters that are word break characters, but should
- be left in TEXT when it is passed to the completion function.
- Programs can use this to help determine what kind of completing to
- do. For instance, Bash sets this variable to "$@" so that it can
- complete shell variables and hostnames.
-
- - Variable: int rl_ignore_completion_duplicates
- If non-zero, then disallow duplicates in the matches. Default is
- 1.
-
- - Variable: int rl_filename_completion_desired
- Non-zero means that the results of the matches are to be treated as
- filenames. This is *always* zero on entry, and can only be changed
- within a completion entry generator function. If it is set to a
- non-zero value, directory names have a slash appended and Readline
- attempts to quote completed filenames if they contain any embedded
- word break characters.
-
- - Variable: int rl_filename_quoting_desired
- Non-zero means that the results of the matches are to be quoted
- using double quotes (or an application-specific quoting mechanism)
- if the completed filename contains any characters in
- `rl_completer_word_break_chars'. This is *always* non-zero on
- entry, and can only be changed within a completion entry generator
- function.
-
- - Variable: Function * rl_ignore_some_completions_function
- This function, if defined, is called by the completer when real
- filename completion is done, after all the matching names have
- been generated. It is passed a `NULL' terminated array of matches.
- The first element (`matches[0]') is the maximal substring common
- to all matches. This function can re-arrange the list of matches
- as required, but each element deleted from the array must be freed.
-
- - Variable: char * rl_completer_quote_characters
- List of characters which can be used to quote a substring of the
- line. Completion occurs on the entire substring, and within the
- substring `rl_completer_word_break_characters' are treated as any
- other character, unless they also appear within this list.
-
-
-File: readline.info, Node: A Short Completion Example, Prev: Completion Variables, Up: Custom Completers
-
-A Short Completion Example
---------------------------
-
- Here is a small application demonstrating the use of the GNU Readline
-library. It is called `fileman', and the source code resides in
-`examples/fileman.c'. This sample application provides completion of
-command names, line editing features, and access to the history list.
-
- /* fileman.c -- A tiny application which demonstrates how to use the
- GNU Readline library. This application interactively allows users
- to manipulate files and their modes. */
-
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/file.h>
- #include <sys/stat.h>
- #include <sys/errno.h>
-
- #include <readline/readline.h>
- #include <readline/history.h>
-
- extern char *getwd ();
- extern char *xmalloc ();
-
- /* The names of functions that actually do the manipulation. */
- int com_list (), com_view (), com_rename (), com_stat (), com_pwd ();
- int com_delete (), com_help (), com_cd (), com_quit ();
-
- /* A structure which contains information on the commands this program
- can understand. */
-
- typedef struct {
- char *name; /* User printable name of the function. */
- Function *func; /* Function to call to do the job. */
- char *doc; /* Documentation for this function. */
- } COMMAND;
-
- COMMAND commands[] = {
- { "cd", com_cd, "Change to directory DIR" },
- { "delete", com_delete, "Delete FILE" },
- { "help", com_help, "Display this text" },
- { "?", com_help, "Synonym for `help'" },
- { "list", com_list, "List files in DIR" },
- { "ls", com_list, "Synonym for `list'" },
- { "pwd", com_pwd, "Print the current working directory" },
- { "quit", com_quit, "Quit using Fileman" },
- { "rename", com_rename, "Rename FILE to NEWNAME" },
- { "stat", com_stat, "Print out statistics on FILE" },
- { "view", com_view, "View the contents of FILE" },
- { (char *)NULL, (Function *)NULL, (char *)NULL }
- };
-
- /* Forward declarations. */
- char *stripwhite ();
- COMMAND *find_command ();
-
- /* The name of this program, as taken from argv[0]. */
- char *progname;
-
- /* When non-zero, this global means the user is done using this program. */
- int done;
-
- char *
- dupstr (s)
- int s;
- {
- char *r;
-
- r = xmalloc (strlen (s) + 1);
- strcpy (r, s);
- return (r);
- }
-
- main (argc, argv)
- int argc;
- char **argv;
- {
- char *line, *s;
-
- progname = argv[0];
-
- initialize_readline (); /* Bind our completer. */
-
- /* Loop reading and executing lines until the user quits. */
- for ( ; done == 0; )
- {
- line = readline ("FileMan: ");
-
- if (!line)
- break;
-
- /* Remove leading and trailing whitespace from the line.
- Then, if there is anything left, add it to the history list
- and execute it. */
- s = stripwhite (line);
-
- if (*s)
- {
- add_history (s);
- execute_line (s);
- }
-
- free (line);
- }
- exit (0);
- }
-
- /* Execute a command line. */
- int
- execute_line (line)
- char *line;
- {
- register int i;
- COMMAND *command;
- char *word;
-
- /* Isolate the command word. */
- i = 0;
- while (line[i] && whitespace (line[i]))
- i++;
- word = line + i;
-
- while (line[i] && !whitespace (line[i]))
- i++;
-
- if (line[i])
- line[i++] = '\0';
-
- command = find_command (word);
-
- if (!command)
- {
- fprintf (stderr, "%s: No such command for FileMan.\n", word);
- return (-1);
- }
-
- /* Get argument to command, if any. */
- while (whitespace (line[i]))
- i++;
-
- word = line + i;
-
- /* Call the function. */
- return ((*(command->func)) (word));
- }
-
- /* Look up NAME as the name of a command, and return a pointer to that
- command. Return a NULL pointer if NAME isn't a command name. */
- COMMAND *
- find_command (name)
- char *name;
- {
- register int i;
-
- for (i = 0; commands[i].name; i++)
- if (strcmp (name, commands[i].name) == 0)
- return (&commands[i]);
-
- return ((COMMAND *)NULL);
- }
-
- /* Strip whitespace from the start and end of STRING. Return a pointer
- into STRING. */
- char *
- stripwhite (string)
- char *string;
- {
- register char *s, *t;
-
- for (s = string; whitespace (*s); s++)
- ;
-
- if (*s == 0)
- return (s);
-
- t = s + strlen (s) - 1;
- while (t > s && whitespace (*t))
- t--;
- *++t = '\0';
-
- return s;
- }
-
- /* **************************************************************** */
- /* */
- /* Interface to Readline Completion */
- /* */
- /* **************************************************************** */
-
- char *command_generator ();
- char **fileman_completion ();
-
- /* Tell the GNU Readline library how to complete. We want to try to complete
- on command names if this is the first word in the line, or on filenames
- if not. */
- initialize_readline ()
- {
- /* Allow conditional parsing of the ~/.inputrc file. */
- rl_readline_name = "FileMan";
-
- /* Tell the completer that we want a crack first. */
- rl_attempted_completion_function = (CPPFunction *)fileman_completion;
- }
-
- /* Attempt to complete on the contents of TEXT. START and END show the
- region of TEXT that contains the word to complete. We can use the
- entire line in case we want to do some simple parsing. Return the
- array of matches, or NULL if there aren't any. */
- char **
- fileman_completion (text, start, end)
- char *text;
- int start, end;
- {
- char **matches;
-
- matches = (char **)NULL;
-
- /* If this word is at the start of the line, then it is a command
- to complete. Otherwise it is the name of a file in the current
- directory. */
- if (start == 0)
- matches = completion_matches (text, command_generator);
-
- return (matches);
- }
-
- /* Generator function for command completion. STATE lets us know whether
- to start from scratch; without any state (i.e. STATE == 0), then we
- start at the top of the list. */
- char *
- command_generator (text, state)
- char *text;
- int state;
- {
- static int list_index, len;
- char *name;
-
- /* If this is a new word to complete, initialize now. This includes
- saving the length of TEXT for efficiency, and initializing the index
- variable to 0. */
- if (!state)
- {
- list_index = 0;
- len = strlen (text);
- }
-
- /* Return the next name which partially matches from the command list. */
- while (name = commands[list_index].name)
- {
- list_index++;
-
- if (strncmp (name, text, len) == 0)
- return (dupstr(name));
- }
-
- /* If no names matched, then return NULL. */
- return ((char *)NULL);
- }
-
- /* **************************************************************** */
- /* */
- /* FileMan Commands */
- /* */
- /* **************************************************************** */
-
- /* String to pass to system (). This is for the LIST, VIEW and RENAME
- commands. */
- static char syscom[1024];
-
- /* List the file(s) named in arg. */
- com_list (arg)
- char *arg;
- {
- if (!arg)
- arg = "";
-
- sprintf (syscom, "ls -FClg %s", arg);
- return (system (syscom));
- }
-
- com_view (arg)
- char *arg;
- {
- if (!valid_argument ("view", arg))
- return 1;
-
- sprintf (syscom, "more %s", arg);
- return (system (syscom));
- }
-
- com_rename (arg)
- char *arg;
- {
- too_dangerous ("rename");
- return (1);
- }
-
- com_stat (arg)
- char *arg;
- {
- struct stat finfo;
-
- if (!valid_argument ("stat", arg))
- return (1);
-
- if (stat (arg, &finfo) == -1)
- {
- perror (arg);
- return (1);
- }
-
- printf ("Statistics for `%s':\n", arg);
-
- printf ("%s has %d link%s, and is %d byte%s in length.\n", arg,
- finfo.st_nlink,
- (finfo.st_nlink == 1) ? "" : "s",
- finfo.st_size,
- (finfo.st_size == 1) ? "" : "s");
- printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime));
- printf (" Last access at: %s", ctime (&finfo.st_atime));
- printf (" Last modified at: %s", ctime (&finfo.st_mtime));
- return (0);
- }
-
- com_delete (arg)
- char *arg;
- {
- too_dangerous ("delete");
- return (1);
- }
-
- /* Print out help for ARG, or for all of the commands if ARG is
- not present. */
- com_help (arg)
- char *arg;
- {
- register int i;
- int printed = 0;
-
- for (i = 0; commands[i].name; i++)
- {
- if (!*arg || (strcmp (arg, commands[i].name) == 0))
- {
- printf ("%s\t\t%s.\n", commands[i].name, commands[i].doc);
- printed++;
- }
- }
-
- if (!printed)
- {
- printf ("No commands match `%s'. Possibilties are:\n", arg);
-
- for (i = 0; commands[i].name; i++)
- {
- /* Print in six columns. */
- if (printed == 6)
- {
- printed = 0;
- printf ("\n");
- }
-
- printf ("%s\t", commands[i].name);
- printed++;
- }
-
- if (printed)
- printf ("\n");
- }
- return (0);
- }
-
- /* Change to the directory ARG. */
- com_cd (arg)
- char *arg;
- {
- if (chdir (arg) == -1)
- {
- perror (arg);
- return 1;
- }
-
- com_pwd ("");
- return (0);
- }
-
- /* Print out the current working directory. */
- com_pwd (ignore)
- char *ignore;
- {
- char dir[1024], *s;
-
- s = getwd (dir);
- if (s == 0)
- {
- printf ("Error getting pwd: %s\n", dir);
- return 1;
- }
-
- printf ("Current directory is %s\n", dir);
- return 0;
- }
-
- /* The user wishes to quit using this program. Just set DONE non-zero. */
- com_quit (arg)
- char *arg;
- {
- done = 1;
- return (0);
- }
-
- /* Function which tells you that you can't do this. */
- too_dangerous (caller)
- char *caller;
- {
- fprintf (stderr,
- "%s: Too dangerous for me to distribute. Write it yourself.\n",
- caller);
- }
-
- /* Return non-zero if ARG is a valid argument for CALLER, else print
- an error message and return zero. */
- int
- valid_argument (caller, arg)
- char *caller, *arg;
- {
- if (!arg || !*arg)
- {
- fprintf (stderr, "%s: Argument required.\n", caller);
- return (0);
- }
-
- return (1);
- }
-
-
-File: readline.info, Node: Concept Index, Next: Function and Variable Index, Prev: Programming with GNU Readline, Up: Top
-
-Concept Index
-*************
-
-* Menu:
-
-* interaction, readline: Readline Interaction.
-* Kill ring: Readline Killing Commands.
-* Killing text: Readline Killing Commands.
-* readline, function: Basic Behavior.
-* Yanking text: Readline Killing Commands.
-
-
-File: readline.info, Node: Function and Variable Index, Prev: Concept Index, Up: Top
-
-Function and Variable Index
-***************************
-
-* Menu:
-
-* $else: Conditional Init Constructs.
-* $endif: Conditional Init Constructs.
-* $if: Conditional Init Constructs.
-* abort (C-g): Miscellaneous Commands.
-* accept-line (Newline, Return): Commands For History.
-* alphabetic: Utility Functions.
-* backward-char (C-b): Commands For Moving.
-* backward-delete-char (Rubout): Commands For Text.
-* backward-kill-line (C-x Rubout): Commands For Killing.
-* backward-kill-word (M-DEL): Commands For Killing.
-* backward-word (M-b): Commands For Moving.
-* beginning-of-history (M-<): Commands For History.
-* beginning-of-line (C-a): Commands For Moving.
-* bell-style: Readline Init Syntax.
-* call-last-kbd-macro (C-x e): Keyboard Macros.
-* capitalize-word (M-c): Commands For Text.
-* clear-screen (C-l): Commands For Moving.
-* comment-begin: Readline Init Syntax.
-* complete (TAB): Commands For Completion.
-* completion-query-items: Readline Init Syntax.
-* completion_matches: Completion Functions.
-* convert-meta: Readline Init Syntax.
-* delete-char (C-d): Commands For Text.
-* delete-horizontal-space (): Commands For Killing.
-* digit-argument (M-0, M-1, ... M-): Numeric Arguments.
-* digit_p: Utility Functions.
-* digit_value: Utility Functions.
-* ding: Utility Functions.
-* do-uppercase-version (M-a, M-b, ...): Miscellaneous Commands.
-* downcase-word (M-l): Commands For Text.
-* dump-functions (): Miscellaneous Commands.
-* editing-mode: Readline Init Syntax.
-* end-kbd-macro (C-x )): Keyboard Macros.
-* end-of-history (M->): Commands For History.
-* end-of-line (C-e): Commands For Moving.
-* expand-tilde: Readline Init Syntax.
-* filename_completion_function: Completion Functions.
-* forward-char (C-f): Commands For Moving.
-* forward-search-history (C-s): Commands For History.
-* forward-word (M-f): Commands For Moving.
-* free_undo_list: Allowing Undoing.
-* history-search-backward (): Commands For History.
-* history-search-forward (): Commands For History.
-* horizontal-scroll-mode: Readline Init Syntax.
-* insert-completions (): Commands For Completion.
-* keymap: Readline Init Syntax.
-* kill-line (C-k): Commands For Killing.
-* kill-whole-line (): Commands For Killing.
-* kill-word (M-d): Commands For Killing.
-* lowercase_p: Utility Functions.
-* mark-modified-lines: Readline Init Syntax.
-* meta-flag: Readline Init Syntax.
-* next-history (C-n): Commands For History.
-* non-incremental-forward-search-history (M-n): Commands For History.
-* non-incremental-reverse-search-history (M-p): Commands For History.
-* numeric: Utility Functions.
-* output-meta: Readline Init Syntax.
-* possible-completions (M-?): Commands For Completion.
-* prefix-meta (ESC): Miscellaneous Commands.
-* previous-history (C-p): Commands For History.
-* quoted-insert (C-q, C-v): Commands For Text.
-* re-read-init-file (C-x C-r): Miscellaneous Commands.
-* readline: Basic Behavior.
-* redraw-current-line (): Commands For Moving.
-* reverse-search-history (C-r): Commands For History.
-* revert-line (M-r): Miscellaneous Commands.
-* rl_add_defun: Function Naming.
-* rl_add_undo: Allowing Undoing.
-* rl_attempted_completion_function: Completion Variables.
-* rl_basic_word_break_characters: Completion Variables.
-* rl_begin_undo_group: Allowing Undoing.
-* rl_bind_key: Binding Keys.
-* rl_bind_key_in_map: Binding Keys.
-* rl_clear_message: Redisplay.
-* rl_complete: How Completing Works.
-* rl_complete: Completion Functions.
-* rl_completer_quote_characters: Completion Variables.
-* rl_completer_word_break_characters: Completion Variables.
-* rl_complete_internal: Completion Functions.
-* rl_completion_entry_function: Completion Variables.
-* rl_completion_entry_function: How Completing Works.
-* rl_completion_query_items: Completion Variables.
-* rl_copy_keymap: Keymaps.
-* rl_copy_text: Modifying Text.
-* rl_delete_text: Modifying Text.
-* rl_discard_keymap: Keymaps.
-* rl_done: Function Writing.
-* rl_do_undo: Allowing Undoing.
-* rl_end: Function Writing.
-* rl_end_undo_group: Allowing Undoing.
-* rl_filename_completion_desired: Completion Variables.
-* rl_filename_quoting_desired: Completion Variables.
-* rl_forced_update_display: Redisplay.
-* rl_function_of_keyseq: Associating Function Names and Bindings.
-* rl_generic_bind: Binding Keys.
-* rl_get_keymap: Keymaps.
-* rl_get_keymap_by_name: Keymaps.
-* rl_ignore_completion_duplicates: Completion Variables.
-* rl_ignore_some_completions_function: Completion Variables.
-* rl_insert_completions: Completion Functions.
-* rl_insert_text: Modifying Text.
-* rl_instream: Function Writing.
-* rl_invoking_keyseqs: Associating Function Names and Bindings.
-* rl_invoking_keyseqs_in_map: Associating Function Names and Bindings.
-* rl_kill_text: Modifying Text.
-* rl_line_buffer: Function Writing.
-* rl_make_bare_keymap: Keymaps.
-* rl_make_keymap: Keymaps.
-* rl_mark: Function Writing.
-* rl_message: Redisplay.
-* rl_modifying: Allowing Undoing.
-* rl_named_function: Associating Function Names and Bindings.
-* rl_on_new_line: Redisplay.
-* rl_outstream: Function Writing.
-* rl_parse_and_bind: Binding Keys.
-* rl_pending_input: Function Writing.
-* rl_point: Function Writing.
-* rl_possible_completions: Completion Functions.
-* rl_prompt: Function Writing.
-* rl_readline_name: Function Writing.
-* rl_redisplay: Redisplay.
-* rl_reset_line_state: Redisplay.
-* rl_reset_terminal: Utility Functions.
-* rl_set_keymap: Keymaps.
-* rl_special_prefixes: Completion Variables.
-* rl_startup_hook: Function Writing.
-* rl_terminal_name: Function Writing.
-* rl_unbind_key: Binding Keys.
-* rl_unbind_key_in_map: Binding Keys.
-* self-insert (a, b, A, 1, !, ...): Commands For Text.
-* show-all-if-ambiguous: Readline Init Syntax.
-* start-kbd-macro (C-x (): Keyboard Macros.
-* tab-insert (M-TAB): Commands For Text.
-* tilde-expand (M-~): Miscellaneous Commands.
-* to_lower: Utility Functions.
-* to_upper: Utility Functions.
-* transpose-chars (C-t): Commands For Text.
-* transpose-words (M-t): Commands For Text.
-* undo (C-_, C-x C-u): Miscellaneous Commands.
-* universal-argument (): Numeric Arguments.
-* unix-line-discard (C-u): Commands For Killing.
-* unix-word-rubout (C-w): Commands For Killing.
-* upcase-word (M-u): Commands For Text.
-* uppercase_p: Utility Functions.
-* username_completion_function: Completion Functions.
-* yank (C-y): Commands For Killing.
-* yank-last-arg (M-., M-_): Commands For History.
-* yank-nth-arg (M-C-y): Commands For History.
-* yank-pop (M-y): Commands For Killing.
-
-
diff --git a/gnu/lib/libreadline/doc/rlman.texinfo b/gnu/lib/libreadline/doc/rlman.texinfo
deleted file mode 100644
index ec14066..0000000
--- a/gnu/lib/libreadline/doc/rlman.texinfo
+++ /dev/null
@@ -1,111 +0,0 @@
-\input texinfo @c -*-texinfo-*-
-@comment %**start of header (This is for running Texinfo on a region.)
-@setfilename readline.info
-@settitle GNU Readline Library
-@comment %**end of header (This is for running Texinfo on a region.)
-@synindex vr fn
-@setchapternewpage odd
-
-@ignore
-last change: Thu Jul 21 16:02:40 EDT 1994
-@end ignore
-
-@set EDITION 2.0
-@set VERSION 2.0
-@set UPDATED 21 July 1994
-@set UPDATE-MONTH July 1994
-
-@ifinfo
-This document describes the GNU Readline Library, a utility which aids
-in the consistency of user interface across discrete programs that need
-to provide a command line interface.
-
-Copyright (C) 1988, 1991 Free Software Foundation, Inc.
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-pare preserved on all copies.
-
-@ignore
-Permission is granted to process this file through TeX and print the
-results, provided the printed document carries copying permission
-notice identical to this one except for the removal of this paragraph
-(this paragraph not being relevant to the printed manual).
-@end ignore
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the entire
-resulting derived work is distributed under the terms of a permission
-notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation approved
-by the Foundation.
-@end ifinfo
-
-@titlepage
-@sp 10
-@title GNU Readline Library
-@subtitle Edition @value{EDITION}, for @code{Readline Library} Version @value{VERSION}.
-@subtitle @value{UPDATE-MONTH}
-@author Brian Fox, Free Software Foundation
-@author Chet Ramey, Case Western Reserve University
-
-@page
-This document describes the GNU Readline Library, a utility which aids
-in the consistency of user interface across discrete programs that need
-to provide a command line interface.
-
-Published by the Free Software Foundation @*
-675 Massachusetts Avenue, @*
-Cambridge, MA 02139 USA
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the entire
-resulting derived work is distributed under the terms of a permission
-notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation approved
-by the Foundation.
-
-@vskip 0pt plus 1filll
-Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
-@end titlepage
-
-@ifinfo
-@node Top
-@top GNU Readline Library
-
-This document describes the GNU Readline Library, a utility which aids
-in the consistency of user interface across discrete programs that need
-to provide a command line interface.
-
-@menu
-* Command Line Editing:: GNU Readline User's Manual.
-* Programming with GNU Readline:: GNU Readline Programmer's Manual.
-* Concept Index:: Index of concepts described in this manual.
-* Function and Variable Index:: Index of externally visible functions
- and variables.
-@end menu
-@end ifinfo
-
-@include rluser.texinfo
-@include rltech.texinfo
-
-@node Concept Index
-@unnumbered Concept Index
-@printindex cp
-
-@node Function and Variable Index
-@unnumbered Function and Variable Index
-@printindex fn
-
-@contents
-@bye
diff --git a/gnu/lib/libreadline/doc/texindex.c b/gnu/lib/libreadline/doc/texindex.c
deleted file mode 100644
index 9233bab..0000000
--- a/gnu/lib/libreadline/doc/texindex.c
+++ /dev/null
@@ -1,1666 +0,0 @@
-/* Prepare TeX index dribble output into an actual index.
-
- Version 1.45
-
- Copyright (C) 1987, 1991, 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-
-#include <stdio.h>
-#include <ctype.h>
-#include <errno.h>
-#include "getopt.h"
-#include "bashansi.h"
-
-#if !defined (errno)
-extern int errno;
-#endif
-
-#if defined (HAVE_UNISTD_H)
-# include <unistd.h>
-#else /* !HAVE_UNISTD_H */
-extern long lseek ();
-#endif /* !HAVE_UNISTD_H */
-
-extern char *mktemp ();
-
-#if !defined (HAVE_STRERROR)
-extern int sys_nerr;
-extern char *sys_errlist[];
-#endif
-
-#include <sys/types.h>
-
-#if defined (_AIX) || !defined (_POSIX_VERSION)
-# include <sys/file.h>
-#endif
-
-#include <fcntl.h>
-
-#define TI_NO_ERROR 0
-#define TI_FATAL_ERROR 1
-
-#if !defined (SEEK_SET)
-# define SEEK_SET 0
-# define SEEK_CUR 1
-# define SEEK_END 2
-#endif /* !SEEK_SET */
-
-/* When sorting in core, this structure describes one line
- and the position and length of its first keyfield. */
-struct lineinfo
-{
- char *text; /* The actual text of the line. */
- union {
- char *text; /* The start of the key (for textual comparison). */
- long number; /* The numeric value (for numeric comparison). */
- } key;
- long keylen; /* Length of KEY field. */
-};
-
-/* This structure describes a field to use as a sort key. */
-struct keyfield
-{
- int startwords; /* Number of words to skip. */
- int startchars; /* Number of additional chars to skip. */
- int endwords; /* Number of words to ignore at end. */
- int endchars; /* Ditto for characters of last word. */
- char ignore_blanks; /* Non-zero means ignore spaces and tabs. */
- char fold_case; /* Non-zero means case doesn't matter. */
- char reverse; /* Non-zero means compare in reverse order. */
- char numeric; /* Non-zeros means field is ASCII numeric. */
- char positional; /* Sort according to file position. */
- char braced; /* Count balanced-braced groupings as fields. */
-};
-
-/* Vector of keyfields to use. */
-struct keyfield keyfields[3];
-
-/* Number of keyfields stored in that vector. */
-int num_keyfields = 3;
-
-/* Vector of input file names, terminated with a null pointer. */
-char **infiles;
-
-/* Vector of corresponding output file names, or NULL, meaning default it
- (add an `s' to the end). */
-char **outfiles;
-
-/* Length of `infiles'. */
-int num_infiles;
-
-/* Pointer to the array of pointers to lines being sorted. */
-char **linearray;
-
-/* The allocated length of `linearray'. */
-long nlines;
-
-/* Directory to use for temporary files. On Unix, it ends with a slash. */
-char *tempdir;
-
-/* Start of filename to use for temporary files. */
-char *tempbase;
-
-/* Number of last temporary file. */
-int tempcount;
-
-/* Number of last temporary file already deleted.
- Temporary files are deleted by `flush_tempfiles' in order of creation. */
-int last_deleted_tempcount;
-
-/* During in-core sort, this points to the base of the data block
- which contains all the lines of data. */
-char *text_base;
-
-/* Additional command switches .*/
-
-/* Nonzero means do not delete tempfiles -- for debugging. */
-int keep_tempfiles;
-
-/* The name this program was run with. */
-char *program_name;
-
-/* Forward declarations of functions in this file. */
-
-void decode_command ();
-void sort_in_core ();
-void sort_offline ();
-char **parsefile ();
-char *find_field ();
-char *find_pos ();
-long find_value ();
-char *find_braced_pos ();
-char *find_braced_end ();
-void writelines ();
-int compare_field ();
-int compare_full ();
-long readline ();
-int merge_files ();
-int merge_direct ();
-void pfatal_with_name ();
-void fatal ();
-void error ();
-void *xmalloc (), *xrealloc ();
-char *concat ();
-char *maketempname ();
-void flush_tempfiles ();
-char *tempcopy ();
-
-#define MAX_IN_CORE_SORT 500000
-
-void
-main (argc, argv)
- int argc;
- char **argv;
-{
- int i;
-
- tempcount = 0;
- last_deleted_tempcount = 0;
- program_name = argv[0];
-
- /* Describe the kind of sorting to do. */
- /* The first keyfield uses the first braced field and folds case. */
- keyfields[0].braced = 1;
- keyfields[0].fold_case = 1;
- keyfields[0].endwords = -1;
- keyfields[0].endchars = -1;
-
- /* The second keyfield uses the second braced field, numerically. */
- keyfields[1].braced = 1;
- keyfields[1].numeric = 1;
- keyfields[1].startwords = 1;
- keyfields[1].endwords = -1;
- keyfields[1].endchars = -1;
-
- /* The third keyfield (which is ignored while discarding duplicates)
- compares the whole line. */
- keyfields[2].endwords = -1;
- keyfields[2].endchars = -1;
-
- decode_command (argc, argv);
-
- tempbase = mktemp (concat ("txiXXXXXX", "", ""));
-
- /* Process input files completely, one by one. */
-
- for (i = 0; i < num_infiles; i++)
- {
- int desc;
- long ptr;
- char *outfile;
-
- desc = open (infiles[i], O_RDONLY, 0);
- if (desc < 0)
- pfatal_with_name (infiles[i]);
- lseek (desc, 0L, SEEK_END);
- ptr = lseek (desc, 0L, SEEK_CUR);
-
- close (desc);
-
- outfile = outfiles[i];
- if (!outfile)
- {
- outfile = concat (infiles[i], "s", "");
- }
-
- if (ptr < MAX_IN_CORE_SORT)
- /* Sort a small amount of data. */
- sort_in_core (infiles[i], ptr, outfile);
- else
- sort_offline (infiles[i], ptr, outfile);
- }
-
- flush_tempfiles (tempcount);
- exit (TI_NO_ERROR);
-}
-
-void
-usage ()
-{
- fprintf (stderr, "\
-Usage: %s [-k] infile [-o outfile] ...\n", program_name);
- exit (1);
-}
-
-/* Decode the command line arguments to set the parameter variables
- and set up the vector of keyfields and the vector of input files. */
-
-void
-decode_command (argc, argv)
- int argc;
- char **argv;
-{
- int optc;
- char **ip;
- char **op;
-
- /* Store default values into parameter variables. */
-
- tempdir = getenv ("TMPDIR");
- if (tempdir == NULL)
- tempdir = "/tmp/";
- else
- tempdir = concat (tempdir, "/", "");
-
- keep_tempfiles = 0;
-
- /* Allocate ARGC input files, which must be enough. */
-
- infiles = (char **) xmalloc (argc * sizeof (char *));
- outfiles = (char **) xmalloc (argc * sizeof (char *));
- ip = infiles;
- op = outfiles;
-
- while ((optc = getopt (argc, argv, "-ko:")) != EOF)
- {
- switch (optc)
- {
- case 1: /* Non-option filename. */
- *ip++ = optarg;
- *op++ = NULL;
- break;
-
- case 'k':
- keep_tempfiles = 1;
- break;
-
- case 'o':
- if (op > outfiles)
- *(op - 1) = optarg;
- break;
-
- default:
- usage ();
- }
- }
-
- /* Record number of keyfields and terminate list of filenames. */
- num_infiles = ip - infiles;
- *ip = 0;
- if (num_infiles == 0)
- usage ();
-}
-
-/* Return a name for a temporary file. */
-
-char *
-maketempname (count)
- int count;
-{
- char tempsuffix[10];
- sprintf (tempsuffix, "%d", count);
- return concat (tempdir, tempbase, tempsuffix);
-}
-
-/* Delete all temporary files up to TO_COUNT. */
-
-void
-flush_tempfiles (to_count)
- int to_count;
-{
- if (keep_tempfiles)
- return;
- while (last_deleted_tempcount < to_count)
- unlink (maketempname (++last_deleted_tempcount));
-}
-
-/* Copy the input file open on IDESC into a temporary file
- and return the temporary file name. */
-
-#define BUFSIZE 1024
-
-char *
-tempcopy (idesc)
- int idesc;
-{
- char *outfile = maketempname (++tempcount);
- int odesc;
- char buffer[BUFSIZE];
-
- odesc = open (outfile, O_WRONLY | O_CREAT, 0666);
-
- if (odesc < 0)
- pfatal_with_name (outfile);
-
- while (1)
- {
- int nread = read (idesc, buffer, BUFSIZE);
- write (odesc, buffer, nread);
- if (!nread)
- break;
- }
-
- close (odesc);
-
- return outfile;
-}
-
-/* Compare LINE1 and LINE2 according to the specified set of keyfields. */
-
-int
-compare_full (line1, line2)
- char **line1, **line2;
-{
- int i;
-
- /* Compare using the first keyfield;
- if that does not distinguish the lines, try the second keyfield;
- and so on. */
-
- for (i = 0; i < num_keyfields; i++)
- {
- long length1, length2;
- char *start1 = find_field (&keyfields[i], *line1, &length1);
- char *start2 = find_field (&keyfields[i], *line2, &length2);
- int tem = compare_field (&keyfields[i], start1, length1, *line1 - text_base,
- start2, length2, *line2 - text_base);
- if (tem)
- {
- if (keyfields[i].reverse)
- return -tem;
- return tem;
- }
- }
-
- return 0; /* Lines match exactly. */
-}
-
-/* Compare LINE1 and LINE2, described by structures
- in which the first keyfield is identified in advance.
- For positional sorting, assumes that the order of the lines in core
- reflects their nominal order. */
-
-int
-compare_prepared (line1, line2)
- struct lineinfo *line1, *line2;
-{
- int i;
- int tem;
- char *text1, *text2;
-
- /* Compare using the first keyfield, which has been found for us already. */
- if (keyfields->positional)
- {
- if (line1->text - text_base > line2->text - text_base)
- tem = 1;
- else
- tem = -1;
- }
- else if (keyfields->numeric)
- tem = line1->key.number - line2->key.number;
- else
- tem = compare_field (keyfields, line1->key.text, line1->keylen, 0,
- line2->key.text, line2->keylen, 0);
- if (tem)
- {
- if (keyfields->reverse)
- return -tem;
- return tem;
- }
-
- text1 = line1->text;
- text2 = line2->text;
-
- /* Compare using the second keyfield;
- if that does not distinguish the lines, try the third keyfield;
- and so on. */
-
- for (i = 1; i < num_keyfields; i++)
- {
- long length1, length2;
- char *start1 = find_field (&keyfields[i], text1, &length1);
- char *start2 = find_field (&keyfields[i], text2, &length2);
- int tem = compare_field (&keyfields[i], start1, length1, text1 - text_base,
- start2, length2, text2 - text_base);
- if (tem)
- {
- if (keyfields[i].reverse)
- return -tem;
- return tem;
- }
- }
-
- return 0; /* Lines match exactly. */
-}
-
-/* Like compare_full but more general.
- You can pass any strings, and you can say how many keyfields to use.
- POS1 and POS2 should indicate the nominal positional ordering of
- the two lines in the input. */
-
-int
-compare_general (str1, str2, pos1, pos2, use_keyfields)
- char *str1, *str2;
- long pos1, pos2;
- int use_keyfields;
-{
- int i;
-
- /* Compare using the first keyfield;
- if that does not distinguish the lines, try the second keyfield;
- and so on. */
-
- for (i = 0; i < use_keyfields; i++)
- {
- long length1, length2;
- char *start1 = find_field (&keyfields[i], str1, &length1);
- char *start2 = find_field (&keyfields[i], str2, &length2);
- int tem = compare_field (&keyfields[i], start1, length1, pos1,
- start2, length2, pos2);
- if (tem)
- {
- if (keyfields[i].reverse)
- return -tem;
- return tem;
- }
- }
-
- return 0; /* Lines match exactly. */
-}
-
-/* Find the start and length of a field in STR according to KEYFIELD.
- A pointer to the starting character is returned, and the length
- is stored into the int that LENGTHPTR points to. */
-
-char *
-find_field (keyfield, str, lengthptr)
- struct keyfield *keyfield;
- char *str;
- long *lengthptr;
-{
- char *start;
- char *end;
- char *(*fun) ();
-
- if (keyfield->braced)
- fun = find_braced_pos;
- else
- fun = find_pos;
-
- start = (*fun) (str, keyfield->startwords, keyfield->startchars,
- keyfield->ignore_blanks);
- if (keyfield->endwords < 0)
- {
- if (keyfield->braced)
- end = find_braced_end (start);
- else
- {
- end = start;
- while (*end && *end != '\n')
- end++;
- }
- }
- else
- {
- end = (*fun) (str, keyfield->endwords, keyfield->endchars, 0);
- if (end - str < start - str)
- end = start;
- }
- *lengthptr = end - start;
- return start;
-}
-
-/* Return a pointer to a specified place within STR,
- skipping (from the beginning) WORDS words and then CHARS chars.
- If IGNORE_BLANKS is nonzero, we skip all blanks
- after finding the specified word. */
-
-char *
-find_pos (str, words, chars, ignore_blanks)
- char *str;
- int words, chars;
- int ignore_blanks;
-{
- int i;
- char *p = str;
-
- for (i = 0; i < words; i++)
- {
- char c;
- /* Find next bunch of nonblanks and skip them. */
- while ((c = *p) == ' ' || c == '\t')
- p++;
- while ((c = *p) && c != '\n' && !(c == ' ' || c == '\t'))
- p++;
- if (!*p || *p == '\n')
- return p;
- }
-
- while (*p == ' ' || *p == '\t')
- p++;
-
- for (i = 0; i < chars; i++)
- {
- if (!*p || *p == '\n')
- break;
- p++;
- }
- return p;
-}
-
-/* Like find_pos but assumes that each field is surrounded by braces
- and that braces within fields are balanced. */
-
-char *
-find_braced_pos (str, words, chars, ignore_blanks)
- char *str;
- int words, chars;
- int ignore_blanks;
-{
- int i;
- int bracelevel;
- char *p = str;
- char c;
-
- for (i = 0; i < words; i++)
- {
- bracelevel = 1;
- while ((c = *p++) != '{' && c != '\n' && c)
- /* Do nothing. */ ;
- if (c != '{')
- return p - 1;
- while (bracelevel)
- {
- c = *p++;
- if (c == '{')
- bracelevel++;
- if (c == '}')
- bracelevel--;
- if (c == 0 || c == '\n')
- return p - 1;
- }
- }
-
- while ((c = *p++) != '{' && c != '\n' && c)
- /* Do nothing. */ ;
-
- if (c != '{')
- return p - 1;
-
- if (ignore_blanks)
- while ((c = *p) == ' ' || c == '\t')
- p++;
-
- for (i = 0; i < chars; i++)
- {
- if (!*p || *p == '\n')
- break;
- p++;
- }
- return p;
-}
-
-/* Find the end of the balanced-brace field which starts at STR.
- The position returned is just before the closing brace. */
-
-char *
-find_braced_end (str)
- char *str;
-{
- int bracelevel;
- char *p = str;
- char c;
-
- bracelevel = 1;
- while (bracelevel)
- {
- c = *p++;
- if (c == '{')
- bracelevel++;
- if (c == '}')
- bracelevel--;
- if (c == 0 || c == '\n')
- return p - 1;
- }
- return p - 1;
-}
-
-long
-find_value (start, length)
- char *start;
- long length;
-{
- while (length != 0L)
- {
- if (isdigit (*start))
- return atol (start);
- length--;
- start++;
- }
- return 0l;
-}
-
-/* Vector used to translate characters for comparison.
- This is how we make all alphanumerics follow all else,
- and ignore case in the first sorting. */
-int char_order[256];
-
-void
-init_char_order ()
-{
- int i;
- for (i = 1; i < 256; i++)
- char_order[i] = i;
-
- for (i = '0'; i <= '9'; i++)
- char_order[i] += 512;
-
- for (i = 'a'; i <= 'z'; i++)
- {
- char_order[i] = 512 + i;
- char_order[i + 'A' - 'a'] = 512 + i;
- }
-}
-
-/* Compare two fields (each specified as a start pointer and a character count)
- according to KEYFIELD.
- The sign of the value reports the relation between the fields. */
-
-int
-compare_field (keyfield, start1, length1, pos1, start2, length2, pos2)
- struct keyfield *keyfield;
- char *start1;
- long length1;
- long pos1;
- char *start2;
- long length2;
- long pos2;
-{
- if (keyfields->positional)
- {
- if (pos1 > pos2)
- return 1;
- else
- return -1;
- }
- if (keyfield->numeric)
- {
- long value = find_value (start1, length1) - find_value (start2, length2);
- if (value > 0)
- return 1;
- if (value < 0)
- return -1;
- return 0;
- }
- else
- {
- char *p1 = start1;
- char *p2 = start2;
- char *e1 = start1 + length1;
- char *e2 = start2 + length2;
-
- while (1)
- {
- int c1, c2;
-
- if (p1 == e1)
- c1 = 0;
- else
- c1 = *p1++;
- if (p2 == e2)
- c2 = 0;
- else
- c2 = *p2++;
-
- if (char_order[c1] != char_order[c2])
- return char_order[c1] - char_order[c2];
- if (!c1)
- break;
- }
-
- /* Strings are equal except possibly for case. */
- p1 = start1;
- p2 = start2;
- while (1)
- {
- int c1, c2;
-
- if (p1 == e1)
- c1 = 0;
- else
- c1 = *p1++;
- if (p2 == e2)
- c2 = 0;
- else
- c2 = *p2++;
-
- if (c1 != c2)
- /* Reverse sign here so upper case comes out last. */
- return c2 - c1;
- if (!c1)
- break;
- }
-
- return 0;
- }
-}
-
-/* A `struct linebuffer' is a structure which holds a line of text.
- `readline' reads a line from a stream into a linebuffer
- and works regardless of the length of the line. */
-
-struct linebuffer
-{
- long size;
- char *buffer;
-};
-
-/* Initialize LINEBUFFER for use. */
-
-void
-initbuffer (linebuffer)
- struct linebuffer *linebuffer;
-{
- linebuffer->size = 200;
- linebuffer->buffer = (char *) xmalloc (200);
-}
-
-/* Read a line of text from STREAM into LINEBUFFER.
- Return the length of the line. */
-
-long
-readline (linebuffer, stream)
- struct linebuffer *linebuffer;
- FILE *stream;
-{
- char *buffer = linebuffer->buffer;
- char *p = linebuffer->buffer;
- char *end = p + linebuffer->size;
-
- while (1)
- {
- int c = getc (stream);
- if (p == end)
- {
- buffer = (char *) xrealloc (buffer, linebuffer->size *= 2);
- p += buffer - linebuffer->buffer;
- end += buffer - linebuffer->buffer;
- linebuffer->buffer = buffer;
- }
- if (c < 0 || c == '\n')
- {
- *p = 0;
- break;
- }
- *p++ = c;
- }
-
- return p - buffer;
-}
-
-/* Sort an input file too big to sort in core. */
-
-void
-sort_offline (infile, nfiles, total, outfile)
- char *infile;
- int nfiles;
- long total;
- char *outfile;
-{
- /* More than enough. */
- int ntemps = 2 * (total + MAX_IN_CORE_SORT - 1) / MAX_IN_CORE_SORT;
- char **tempfiles = (char **) xmalloc (ntemps * sizeof (char *));
- FILE *istream = fopen (infile, "r");
- int i;
- struct linebuffer lb;
- long linelength;
- int failure = 0;
-
- initbuffer (&lb);
-
- /* Read in one line of input data. */
-
- linelength = readline (&lb, istream);
-
- if (lb.buffer[0] != '\\' && lb.buffer[0] != '@')
- {
- error ("%s: not a texinfo index file", infile);
- return;
- }
-
- /* Split up the input into `ntemps' temporary files, or maybe fewer,
- and put the new files' names into `tempfiles' */
-
- for (i = 0; i < ntemps; i++)
- {
- char *outname = maketempname (++tempcount);
- FILE *ostream = fopen (outname, "w");
- long tempsize = 0;
-
- if (!ostream)
- pfatal_with_name (outname);
- tempfiles[i] = outname;
-
- /* Copy lines into this temp file as long as it does not make file
- "too big" or until there are no more lines. */
-
- while (tempsize + linelength + 1 <= MAX_IN_CORE_SORT)
- {
- tempsize += linelength + 1;
- fputs (lb.buffer, ostream);
- putc ('\n', ostream);
-
- /* Read another line of input data. */
-
- linelength = readline (&lb, istream);
- if (!linelength && feof (istream))
- break;
-
- if (lb.buffer[0] != '\\' && lb.buffer[0] != '@')
- {
- error ("%s: not a texinfo index file", infile);
- failure = 1;
- goto fail;
- }
- }
- fclose (ostream);
- if (feof (istream))
- break;
- }
-
- free (lb.buffer);
-
-fail:
- /* Record number of temp files we actually needed. */
-
- ntemps = i;
-
- /* Sort each tempfile into another tempfile.
- Delete the first set of tempfiles and put the names of the second
- into `tempfiles'. */
-
- for (i = 0; i < ntemps; i++)
- {
- char *newtemp = maketempname (++tempcount);
- sort_in_core (&tempfiles[i], MAX_IN_CORE_SORT, newtemp);
- if (!keep_tempfiles)
- unlink (tempfiles[i]);
- tempfiles[i] = newtemp;
- }
-
- if (failure)
- return;
-
- /* Merge the tempfiles together and indexify. */
-
- merge_files (tempfiles, ntemps, outfile);
-}
-
-/* Sort INFILE, whose size is TOTAL,
- assuming that is small enough to be done in-core,
- then indexify it and send the output to OUTFILE (or to stdout). */
-
-void
-sort_in_core (infile, total, outfile)
- char *infile;
- long total;
- char *outfile;
-{
- char **nextline;
- char *data = (char *) xmalloc (total + 1);
- char *file_data;
- long file_size;
- int i;
- FILE *ostream = stdout;
- struct lineinfo *lineinfo;
-
- /* Read the contents of the file into the moby array `data'. */
-
- int desc = open (infile, O_RDONLY, 0);
-
- if (desc < 0)
- fatal ("failure reopening %s", infile);
- for (file_size = 0;;)
- {
- i = read (desc, data + file_size, total - file_size);
- if (i <= 0)
- break;
- file_size += i;
- }
- file_data = data;
- data[file_size] = 0;
-
- close (desc);
-
- if (file_size > 0 && data[0] != '\\' && data[0] != '@')
- {
- error ("%s: not a texinfo index file", infile);
- return;
- }
-
- init_char_order ();
-
- /* Sort routines want to know this address. */
-
- text_base = data;
-
- /* Create the array of pointers to lines, with a default size
- frequently enough. */
-
- nlines = total / 50;
- if (!nlines)
- nlines = 2;
- linearray = (char **) xmalloc (nlines * sizeof (char *));
-
- /* `nextline' points to the next free slot in this array.
- `nlines' is the allocated size. */
-
- nextline = linearray;
-
- /* Parse the input file's data, and make entries for the lines. */
-
- nextline = parsefile (infile, nextline, file_data, file_size);
- if (nextline == 0)
- {
- error ("%s: not a texinfo index file", infile);
- return;
- }
-
- /* Sort the lines. */
-
- /* If we have enough space, find the first keyfield of each line in advance.
- Make a `struct lineinfo' for each line, which records the keyfield
- as well as the line, and sort them. */
-
- lineinfo = (struct lineinfo *) malloc ((nextline - linearray) * sizeof (struct lineinfo));
-
- if (lineinfo)
- {
- struct lineinfo *lp;
- char **p;
-
- for (lp = lineinfo, p = linearray; p != nextline; lp++, p++)
- {
- lp->text = *p;
- lp->key.text = find_field (keyfields, *p, &lp->keylen);
- if (keyfields->numeric)
- lp->key.number = find_value (lp->key.text, lp->keylen);
- }
-
- qsort (lineinfo, nextline - linearray, sizeof (struct lineinfo), compare_prepared);
-
- for (lp = lineinfo, p = linearray; p != nextline; lp++, p++)
- *p = lp->text;
-
- free (lineinfo);
- }
- else
- qsort (linearray, nextline - linearray, sizeof (char *), compare_full);
-
- /* Open the output file. */
-
- if (outfile)
- {
- ostream = fopen (outfile, "w");
- if (!ostream)
- pfatal_with_name (outfile);
- }
-
- writelines (linearray, nextline - linearray, ostream);
- if (outfile)
- fclose (ostream);
-
- free (linearray);
- free (data);
-}
-
-/* Parse an input string in core into lines.
- DATA is the input string, and SIZE is its length.
- Data goes in LINEARRAY starting at NEXTLINE.
- The value returned is the first entry in LINEARRAY still unused.
- Value 0 means input file contents are invalid. */
-
-char **
-parsefile (filename, nextline, data, size)
- char *filename;
- char **nextline;
- char *data;
- long size;
-{
- char *p, *end;
- char **line = nextline;
-
- p = data;
- end = p + size;
- *end = 0;
-
- while (p != end)
- {
- if (p[0] != '\\' && p[0] != '@')
- return 0;
-
- *line = p;
- while (*p && *p != '\n')
- p++;
- if (p != end)
- p++;
-
- line++;
- if (line == linearray + nlines)
- {
- char **old = linearray;
- linearray = (char **) xrealloc (linearray, sizeof (char *) * (nlines *= 4));
- line += linearray - old;
- }
- }
-
- return line;
-}
-
-/* Indexification is a filter applied to the sorted lines
- as they are being written to the output file.
- Multiple entries for the same name, with different page numbers,
- get combined into a single entry with multiple page numbers.
- The first braced field, which is used for sorting, is discarded.
- However, its first character is examined, folded to lower case,
- and if it is different from that in the previous line fed to us
- a \initial line is written with one argument, the new initial.
-
- If an entry has four braced fields, then the second and third
- constitute primary and secondary names.
- In this case, each change of primary name
- generates a \primary line which contains only the primary name,
- and in between these are \secondary lines which contain
- just a secondary name and page numbers. */
-
-/* The last primary name we wrote a \primary entry for.
- If only one level of indexing is being done, this is the last name seen. */
-char *lastprimary;
-/* Length of storage allocated for lastprimary. */
-int lastprimarylength;
-
-/* Similar, for the secondary name. */
-char *lastsecondary;
-int lastsecondarylength;
-
-/* Zero if we are not in the middle of writing an entry.
- One if we have written the beginning of an entry but have not
- yet written any page numbers into it.
- Greater than one if we have written the beginning of an entry
- plus at least one page number. */
-int pending;
-
-/* The initial (for sorting purposes) of the last primary entry written.
- When this changes, a \initial {c} line is written */
-
-char *lastinitial;
-
-int lastinitiallength;
-
-/* When we need a string of length 1 for the value of lastinitial,
- store it here. */
-
-char lastinitial1[2];
-
-/* Initialize static storage for writing an index. */
-
-static void
-xbzero(s, n)
- char *s;
- int n;
-{
- register char *p;
- for (p = s; n--; )
- *p++ = '\0';
-}
-
-void
-init_index ()
-{
- pending = 0;
- lastinitial = lastinitial1;
- lastinitial1[0] = 0;
- lastinitial1[1] = 0;
- lastinitiallength = 0;
- lastprimarylength = 100;
- lastprimary = (char *) xmalloc (lastprimarylength + 1);
- xbzero (lastprimary, lastprimarylength + 1);
- lastsecondarylength = 100;
- lastsecondary = (char *) xmalloc (lastsecondarylength + 1);
- xbzero (lastsecondary, lastsecondarylength + 1);
-}
-
-/* Indexify. Merge entries for the same name,
- insert headers for each initial character, etc. */
-
-void
-indexify (line, ostream)
- char *line;
- FILE *ostream;
-{
- char *primary, *secondary, *pagenumber;
- int primarylength, secondarylength = 0, pagelength;
- int nosecondary;
- int initiallength;
- char *initial;
- char initial1[2];
- register char *p;
-
- /* First, analyze the parts of the entry fed to us this time. */
-
- p = find_braced_pos (line, 0, 0, 0);
- if (*p == '{')
- {
- initial = p;
- /* Get length of inner pair of braces starting at `p',
- including that inner pair of braces. */
- initiallength = find_braced_end (p + 1) + 1 - p;
- }
- else
- {
- initial = initial1;
- initial1[0] = *p;
- initial1[1] = 0;
- initiallength = 1;
-
- if (initial1[0] >= 'a' && initial1[0] <= 'z')
- initial1[0] -= 040;
- }
-
- pagenumber = find_braced_pos (line, 1, 0, 0);
- pagelength = find_braced_end (pagenumber) - pagenumber;
- if (pagelength == 0)
- abort ();
-
- primary = find_braced_pos (line, 2, 0, 0);
- primarylength = find_braced_end (primary) - primary;
-
- secondary = find_braced_pos (line, 3, 0, 0);
- nosecondary = !*secondary;
- if (!nosecondary)
- secondarylength = find_braced_end (secondary) - secondary;
-
- /* If the primary is different from before, make a new primary entry. */
- if (strncmp (primary, lastprimary, primarylength))
- {
- /* Close off current secondary entry first, if one is open. */
- if (pending)
- {
- fputs ("}\n", ostream);
- pending = 0;
- }
-
- /* If this primary has a different initial, include an entry for
- the initial. */
- if (initiallength != lastinitiallength ||
- strncmp (initial, lastinitial, initiallength))
- {
- fprintf (ostream, "\\initial {");
- fwrite (initial, 1, initiallength, ostream);
- fprintf (ostream, "}\n", initial);
- if (initial == initial1)
- {
- lastinitial = lastinitial1;
- *lastinitial1 = *initial1;
- }
- else
- {
- lastinitial = initial;
- }
- lastinitiallength = initiallength;
- }
-
- /* Make the entry for the primary. */
- if (nosecondary)
- fputs ("\\entry {", ostream);
- else
- fputs ("\\primary {", ostream);
- fwrite (primary, primarylength, 1, ostream);
- if (nosecondary)
- {
- fputs ("}{", ostream);
- pending = 1;
- }
- else
- fputs ("}\n", ostream);
-
- /* Record name of most recent primary. */
- if (lastprimarylength < primarylength)
- {
- lastprimarylength = primarylength + 100;
- lastprimary = (char *) xrealloc (lastprimary,
- 1 + lastprimarylength);
- }
- strncpy (lastprimary, primary, primarylength);
- lastprimary[primarylength] = 0;
-
- /* There is no current secondary within this primary, now. */
- lastsecondary[0] = 0;
- }
-
- /* Should not have an entry with no subtopic following one with a subtopic. */
-
- if (nosecondary && *lastsecondary)
- error ("entry %s follows an entry with a secondary name", line);
-
- /* Start a new secondary entry if necessary. */
- if (!nosecondary && strncmp (secondary, lastsecondary, secondarylength))
- {
- if (pending)
- {
- fputs ("}\n", ostream);
- pending = 0;
- }
-
- /* Write the entry for the secondary. */
- fputs ("\\secondary {", ostream);
- fwrite (secondary, secondarylength, 1, ostream);
- fputs ("}{", ostream);
- pending = 1;
-
- /* Record name of most recent secondary. */
- if (lastsecondarylength < secondarylength)
- {
- lastsecondarylength = secondarylength + 100;
- lastsecondary = (char *) xrealloc (lastsecondary,
- 1 + lastsecondarylength);
- }
- strncpy (lastsecondary, secondary, secondarylength);
- lastsecondary[secondarylength] = 0;
- }
-
- /* Here to add one more page number to the current entry. */
- if (pending++ != 1)
- fputs (", ", ostream); /* Punctuate first, if this is not the first. */
- fwrite (pagenumber, pagelength, 1, ostream);
-}
-
-/* Close out any unfinished output entry. */
-
-void
-finish_index (ostream)
- FILE *ostream;
-{
- if (pending)
- fputs ("}\n", ostream);
- free (lastprimary);
- free (lastsecondary);
-}
-
-/* Copy the lines in the sorted order.
- Each line is copied out of the input file it was found in. */
-
-void
-writelines (linearray, nlines, ostream)
- char **linearray;
- int nlines;
- FILE *ostream;
-{
- char **stop_line = linearray + nlines;
- char **next_line;
-
- init_index ();
-
- /* Output the text of the lines, and free the buffer space. */
-
- for (next_line = linearray; next_line != stop_line; next_line++)
- {
- /* If -u was specified, output the line only if distinct from previous one. */
- if (next_line == linearray
- /* Compare previous line with this one, using only the
- explicitly specd keyfields. */
- || compare_general (*(next_line - 1), *next_line, 0L, 0L, num_keyfields - 1))
- {
- char *p = *next_line;
- char c;
-
- while ((c = *p++) && c != '\n')
- /* Do nothing. */ ;
- *(p - 1) = 0;
- indexify (*next_line, ostream);
- }
- }
-
- finish_index (ostream);
-}
-
-/* Assume (and optionally verify) that each input file is sorted;
- merge them and output the result.
- Returns nonzero if any input file fails to be sorted.
-
- This is the high-level interface that can handle an unlimited
- number of files. */
-
-#define MAX_DIRECT_MERGE 10
-
-int
-merge_files (infiles, nfiles, outfile)
- char **infiles;
- int nfiles;
- char *outfile;
-{
- char **tempfiles;
- int ntemps;
- int i;
- int value = 0;
- int start_tempcount = tempcount;
-
- if (nfiles <= MAX_DIRECT_MERGE)
- return merge_direct (infiles, nfiles, outfile);
-
- /* Merge groups of MAX_DIRECT_MERGE input files at a time,
- making a temporary file to hold each group's result. */
-
- ntemps = (nfiles + MAX_DIRECT_MERGE - 1) / MAX_DIRECT_MERGE;
- tempfiles = (char **) xmalloc (ntemps * sizeof (char *));
- for (i = 0; i < ntemps; i++)
- {
- int nf = MAX_DIRECT_MERGE;
- if (i + 1 == ntemps)
- nf = nfiles - i * MAX_DIRECT_MERGE;
- tempfiles[i] = maketempname (++tempcount);
- value |= merge_direct (&infiles[i * MAX_DIRECT_MERGE], nf, tempfiles[i]);
- }
-
- /* All temporary files that existed before are no longer needed
- since their contents have been merged into our new tempfiles.
- So delete them. */
- flush_tempfiles (start_tempcount);
-
- /* Now merge the temporary files we created. */
-
- merge_files (tempfiles, ntemps, outfile);
-
- free (tempfiles);
-
- return value;
-}
-
-/* Assume (and optionally verify) that each input file is sorted;
- merge them and output the result.
- Returns nonzero if any input file fails to be sorted.
-
- This version of merging will not work if the number of
- input files gets too high. Higher level functions
- use it only with a bounded number of input files. */
-
-int
-merge_direct (infiles, nfiles, outfile)
- char **infiles;
- int nfiles;
- char *outfile;
-{
- struct linebuffer *lb1, *lb2;
- struct linebuffer **thisline, **prevline;
- FILE **streams;
- int i;
- int nleft;
- int lossage = 0;
- int *file_lossage;
- struct linebuffer *prev_out = 0;
- FILE *ostream = stdout;
-
- if (outfile)
- {
- ostream = fopen (outfile, "w");
- }
- if (!ostream)
- pfatal_with_name (outfile);
-
- init_index ();
-
- if (nfiles == 0)
- {
- if (outfile)
- fclose (ostream);
- return 0;
- }
-
- /* For each file, make two line buffers.
- Also, for each file, there is an element of `thisline'
- which points at any time to one of the file's two buffers,
- and an element of `prevline' which points to the other buffer.
- `thisline' is supposed to point to the next available line from the file,
- while `prevline' holds the last file line used,
- which is remembered so that we can verify that the file is properly sorted. */
-
- /* lb1 and lb2 contain one buffer each per file. */
- lb1 = (struct linebuffer *) xmalloc (nfiles * sizeof (struct linebuffer));
- lb2 = (struct linebuffer *) xmalloc (nfiles * sizeof (struct linebuffer));
-
- /* thisline[i] points to the linebuffer holding the next available line in file i,
- or is zero if there are no lines left in that file. */
- thisline = (struct linebuffer **)
- xmalloc (nfiles * sizeof (struct linebuffer *));
- /* prevline[i] points to the linebuffer holding the last used line
- from file i. This is just for verifying that file i is properly
- sorted. */
- prevline = (struct linebuffer **)
- xmalloc (nfiles * sizeof (struct linebuffer *));
- /* streams[i] holds the input stream for file i. */
- streams = (FILE **) xmalloc (nfiles * sizeof (FILE *));
- /* file_lossage[i] is nonzero if we already know file i is not
- properly sorted. */
- file_lossage = (int *) xmalloc (nfiles * sizeof (int));
-
- /* Allocate and initialize all that storage. */
-
- for (i = 0; i < nfiles; i++)
- {
- initbuffer (&lb1[i]);
- initbuffer (&lb2[i]);
- thisline[i] = &lb1[i];
- prevline[i] = &lb2[i];
- file_lossage[i] = 0;
- streams[i] = fopen (infiles[i], "r");
- if (!streams[i])
- pfatal_with_name (infiles[i]);
-
- readline (thisline[i], streams[i]);
- }
-
- /* Keep count of number of files not at eof. */
- nleft = nfiles;
-
- while (nleft)
- {
- struct linebuffer *best = 0;
- struct linebuffer *exch;
- int bestfile = -1;
- int i;
-
- /* Look at the next avail line of each file; choose the least one. */
-
- for (i = 0; i < nfiles; i++)
- {
- if (thisline[i] &&
- (!best ||
- 0 < compare_general (best->buffer, thisline[i]->buffer,
- (long) bestfile, (long) i, num_keyfields)))
- {
- best = thisline[i];
- bestfile = i;
- }
- }
-
- /* Output that line, unless it matches the previous one and we
- don't want duplicates. */
-
- if (!(prev_out &&
- !compare_general (prev_out->buffer,
- best->buffer, 0L, 1L, num_keyfields - 1)))
- indexify (best->buffer, ostream);
- prev_out = best;
-
- /* Now make the line the previous of its file, and fetch a new
- line from that file. */
-
- exch = prevline[bestfile];
- prevline[bestfile] = thisline[bestfile];
- thisline[bestfile] = exch;
-
- while (1)
- {
- /* If the file has no more, mark it empty. */
-
- if (feof (streams[bestfile]))
- {
- thisline[bestfile] = 0;
- /* Update the number of files still not empty. */
- nleft--;
- break;
- }
- readline (thisline[bestfile], streams[bestfile]);
- if (thisline[bestfile]->buffer[0] || !feof (streams[bestfile]))
- break;
- }
- }
-
- finish_index (ostream);
-
- /* Free all storage and close all input streams. */
-
- for (i = 0; i < nfiles; i++)
- {
- fclose (streams[i]);
- free (lb1[i].buffer);
- free (lb2[i].buffer);
- }
- free (file_lossage);
- free (lb1);
- free (lb2);
- free (thisline);
- free (prevline);
- free (streams);
-
- if (outfile)
- fclose (ostream);
-
- return lossage;
-}
-
-/* Print error message and exit. */
-
-void
-fatal (s1, s2)
- char *s1, *s2;
-{
- error (s1, s2);
- exit (TI_FATAL_ERROR);
-}
-
-/* Print error message. S1 is printf control string, S2 is arg for it. */
-
-void
-error (s1, s2)
- char *s1, *s2;
-{
- printf ("%s: ", program_name);
- printf (s1, s2);
- printf ("\n");
-}
-
-#if !defined (HAVE_STRERROR)
-static char *
-strerror (n)
- int n;
-{
- static char ebuf[40];
-
- if (n < sys_nerr)
- return sys_errlist[n];
- else
- {
- sprintf (ebuf, "Unknown error %d", n);
- return ebuf;
- }
-}
-#endif
-
-void
-perror_with_name (name)
- char *name;
-{
- char *s;
-
- s = concat ("", strerror (errno), " for %s");
- error (s, name);
-}
-
-void
-pfatal_with_name (name)
- char *name;
-{
- char *s;
-
- s = concat ("", strerror (errno), " for %s");
- fatal (s, name);
-}
-
-/* Return a newly-allocated string whose contents concatenate those of
- S1, S2, S3. */
-
-char *
-concat (s1, s2, s3)
- char *s1, *s2, *s3;
-{
- int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
- 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;
-}
-
-/* Just like malloc, but kills the program in case of fatal error. */
-void *
-xmalloc (nbytes)
- int nbytes;
-{
- void *temp = (void *) malloc (nbytes);
-
- if (nbytes && temp == (void *)NULL)
- memory_error ("xmalloc", nbytes);
-
- return (temp);
-}
-
-/* Like realloc (), but barfs if there isn't enough memory. */
-void *
-xrealloc (pointer, nbytes)
- void *pointer;
- int nbytes;
-{
- void *temp;
-
- if (!pointer)
- temp = (void *)xmalloc (nbytes);
- else
- temp = (void *)realloc (pointer, nbytes);
-
- if (nbytes && !temp)
- memory_error ("xrealloc", nbytes);
-
- return (temp);
-}
-
-memory_error (callers_name, bytes_wanted)
- char *callers_name;
- int bytes_wanted;
-{
- char printable_string[80];
-
- sprintf (printable_string,
- "Virtual memory exhausted in %s ()! Needed %d bytes.",
- callers_name, bytes_wanted);
-
- error (printable_string, "");
- abort ();
-}
diff --git a/gnu/lib/libreadline/readline/chardefs.h b/gnu/lib/libreadline/readline/chardefs.h
deleted file mode 100644
index aa63da6..0000000
--- a/gnu/lib/libreadline/readline/chardefs.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* chardefs.h -- Character definitions for readline. */
-#ifndef _CHARDEFS_
-#define _CHARDEFS_
-
-#include <ctype.h>
-#include <string.h>
-
-#ifndef savestring
-extern char *xmalloc ();
-#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
-#endif
-
-#ifndef whitespace
-#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
-#endif
-
-#ifdef CTRL
-#undef CTRL
-#endif
-
-/* Some character stuff. */
-#define control_character_threshold 0x020 /* Smaller than this is control. */
-#define meta_character_threshold 0x07f /* Larger than this is Meta. */
-#define control_character_bit 0x40 /* 0x000000, must be off. */
-#define meta_character_bit 0x080 /* x0000000, must be on. */
-#define largest_char 255 /* Largest character value. */
-
-#define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char)
-#define CTRL(c) ((c) & (~control_character_bit))
-#define META(c) ((c) | meta_character_bit)
-
-#define UNMETA(c) ((c) & (~meta_character_bit))
-#define UNCTRL(c) to_upper(((c)|control_character_bit))
-
-#define lowercase_p(c) islower(c)
-#define uppercase_p(c) isupper(c)
-
-#define pure_alphabetic(c) isalpha(c)
-
-#ifndef to_upper
-#define to_upper(c) toupper(c)
-#define to_lower(c) tolower(c)
-#endif
-
-#define CTRL_P(c) ((c) < control_character_threshold)
-#define META_P(c) ((c) > meta_character_threshold)
-
-#ifndef digit_value
-#define digit_value(x) ((x) - '0')
-#endif
-
-#ifndef NEWLINE
-#define NEWLINE '\n'
-#endif
-
-#ifndef RETURN
-#define RETURN CTRL('M')
-#endif
-
-#ifndef RUBOUT
-#define RUBOUT 0x7f
-#endif
-
-#ifndef TAB
-#define TAB '\t'
-#endif
-
-#ifdef ABORT_CHAR
-#undef ABORT_CHAR
-#endif
-#define ABORT_CHAR CTRL('G')
-
-#ifdef PAGE
-#undef PAGE
-#endif
-#define PAGE CTRL('L')
-
-#ifdef SPACE
-#undef SPACE
-#endif
-#define SPACE 0x20
-
-#ifdef ESC
-#undef ESC
-#endif
-
-#define ESC CTRL('[')
-
-#endif /* _CHARDEFS_ */
diff --git a/gnu/lib/libreadline/readline/history.h b/gnu/lib/libreadline/readline/history.h
deleted file mode 100644
index 2ef5424..0000000
--- a/gnu/lib/libreadline/readline/history.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* History.h -- the names of functions that you can call in history. */
-
-/* The structure used to store a history entry. */
-typedef struct _hist_entry {
- char *line;
- char *data;
-} HIST_ENTRY;
-
-/* A structure used to pass the current state of the history stuff around. */
-typedef struct _hist_state {
- HIST_ENTRY **entries; /* Pointer to the entries themselves. */
- int offset; /* The location pointer within this array. */
- int length; /* Number of elements within this array. */
- int size; /* Number of slots allocated to this array. */
-} HISTORY_STATE;
-
-/* For convenience only. You set this when interpreting history commands.
- It is the logical offset of the first history element. */
-extern int history_base;
-
-/* Begin a session in which the history functions might be used. This
- just initializes the interactive variables. */
-extern void using_history ();
-
-/* Return the current HISTORY_STATE of the history. */
-extern HISTORY_STATE *history_get_history_state ();
-
-/* Set the state of the current history array to STATE. */
-extern void history_set_history_state ();
-
-/* Place STRING at the end of the history list.
- The associated data field (if any) is set to NULL. */
-extern void add_history ();
-
-/* Returns the number which says what history element we are now
- looking at. */
-extern int where_history ();
-
-/* Set the position in the history list to POS. */
-int history_set_pos ();
-
-/* Search for STRING in the history list, starting at POS, an
- absolute index into the list. DIR, if negative, says to search
- backwards from POS, else forwards.
- Returns the absolute index of the history element where STRING
- was found, or -1 otherwise. */
-extern int history_search_pos ();
-
-/* A reasonably useless function, only here for completeness. WHICH
- is the magic number that tells us which element to delete. The
- elements are numbered from 0. */
-extern HIST_ENTRY *remove_history ();
-
-/* Stifle the history list, remembering only MAX number of entries. */
-extern void stifle_history ();
-
-/* Stop stifling the history. This returns the previous amount the
- history was stifled by. The value is positive if the history was
- stifled, negative if it wasn't. */
-extern int unstifle_history ();
-
-/* Add the contents of FILENAME to the history list, a line at a time.
- If FILENAME is NULL, then read from ~/.history. Returns 0 if
- successful, or errno if not. */
-extern int read_history ();
-
-/* Read a range of lines from FILENAME, adding them to the history list.
- Start reading at the FROM'th line and end at the TO'th. If FROM
- is zero, start at the beginning. If TO is less than FROM, read
- until the end of the file. If FILENAME is NULL, then read from
- ~/.history. Returns 0 if successful, or errno if not. */
-extern int read_history_range ();
-
-/* Append the current history to FILENAME. If FILENAME is NULL,
- then append the history list to ~/.history. Values returned
- are as in read_history (). */
-extern int write_history ();
-
-/* Append NELEMENT entries to FILENAME. The entries appended are from
- the end of the list minus NELEMENTs up to the end of the list. */
-int append_history ();
-
-/* Make the history entry at WHICH have LINE and DATA. This returns
- the old entry so you can dispose of the data. In the case of an
- invalid WHICH, a NULL pointer is returned. */
-extern HIST_ENTRY *replace_history_entry ();
-
-/* Return the history entry at the current position, as determined by
- history_offset. If there is no entry there, return a NULL pointer. */
-HIST_ENTRY *current_history ();
-
-/* Back up history_offset to the previous history entry, and return
- a pointer to that entry. If there is no previous entry, return
- a NULL pointer. */
-extern HIST_ENTRY *previous_history ();
-
-/* Move history_offset forward to the next item in the input_history,
- and return the a pointer to that entry. If there is no next entry,
- return a NULL pointer. */
-extern HIST_ENTRY *next_history ();
-
-/* Return a NULL terminated array of HIST_ENTRY which is the current input
- history. Element 0 of this list is the beginning of time. If there
- is no history, return NULL. */
-extern HIST_ENTRY **history_list ();
-
-/* Search the history for STRING, starting at history_offset.
- If DIRECTION < 0, then the search is through previous entries,
- else through subsequent. If the string is found, then
- current_history () is the history entry, and the value of this function
- is the offset in the line of that history entry that the string was
- found in. Otherwise, nothing is changed, and a -1 is returned. */
-extern int history_search ();
-
-/* Expand the string STRING, placing the result into OUTPUT, a pointer
- to a string. Returns:
-
- 0) If no expansions took place (or, if the only change in
- the text was the de-slashifying of the history expansion
- character)
- 1) If expansions did take place
- -1) If there was an error in expansion.
-
- If an error ocurred in expansion, then OUTPUT contains a descriptive
- error message. */
-extern int history_expand ();
-
-/* Return an array of tokens, much as the shell might. The tokens are
- parsed out of STRING. */
-extern char **history_tokenize ();
-
-/* Extract a string segment consisting of the FIRST through LAST
- arguments present in STRING. Arguments are broken up as in
- the shell. */
-extern char *history_arg_extract ();
-
-/* Return the number of bytes that the primary history entries are using.
- This just adds up the lengths of the_history->lines. */
-extern int history_total_bytes ();
-
-/* Exported history variables. */
-extern int history_stifled;
-extern int history_length;
-extern int max_input_history;
-extern char history_expansion_char;
-extern char history_subst_char;
-extern char history_comment_char;
-extern char *history_no_expand_chars;
-extern int history_base;
diff --git a/gnu/lib/libreadline/readline/keymaps.h b/gnu/lib/libreadline/readline/keymaps.h
deleted file mode 100644
index f7e9f6f..0000000
--- a/gnu/lib/libreadline/readline/keymaps.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* keymaps.h -- Manipulation of readline keymaps. */
-
-/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
-
- This file is part of the GNU Readline Library, a library for
- reading lines of text with interactive input and history editing.
-
- The GNU Readline Library 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.
-
- The GNU Readline Library is distributed in the hope that it will be
- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- The GNU General Public License is often shipped with GNU software, and
- is generally kept in a file called COPYING or LICENSE. If you do not
- have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef _KEYMAPS_H_
-#define _KEYMAPS_H_
-
-#include <readline/chardefs.h>
-
-#if !defined (__FUNCTION_DEF)
-# define __FUNCTION_DEF
-typedef int Function ();
-typedef void VFunction ();
-typedef char *CPFunction ();
-typedef char **CPPFunction ();
-#endif
-
-/* A keymap contains one entry for each key in the ASCII set.
- Each entry consists of a type and a pointer.
- POINTER is the address of a function to run, or the
- address of a keymap to indirect through.
- TYPE says which kind of thing POINTER is. */
-typedef struct _keymap_entry {
- char type;
- Function *function;
-} KEYMAP_ENTRY;
-
-/* This must be large enough to hold bindings for all of the characters
- in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x,
- and so on). */
-#define KEYMAP_SIZE 256
-
-/* I wanted to make the above structure contain a union of:
- union { Function *function; struct _keymap_entry *keymap; } value;
- but this made it impossible for me to create a static array.
- Maybe I need C lessons. */
-
-typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];
-typedef KEYMAP_ENTRY *Keymap;
-
-/* The values that TYPE can have in a keymap entry. */
-#define ISFUNC 0
-#define ISKMAP 1
-#define ISMACR 2
-
-extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap;
-extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap;
-
-/* Return a new, empty keymap.
- Free it with free() when you are done. */
-extern Keymap rl_make_bare_keymap ();
-
-/* Return a new keymap which is a copy of MAP. */
-extern Keymap rl_copy_keymap ();
-
-/* Return a new keymap with the printing characters bound to rl_insert,
- the lowercase Meta characters bound to run their equivalents, and
- the Meta digits bound to produce numeric arguments. */
-extern Keymap rl_make_keymap ();
-
-extern void rl_discard_keymap ();
-
-/* Return the keymap corresponding to a given name. Names look like
- `emacs' or `emacs-meta' or `vi-insert'. */
-extern Keymap rl_get_keymap_by_name ();
-
-/* Return the current keymap. */
-extern Keymap rl_get_keymap ();
-
-/* Set the current keymap to MAP. */
-extern void rl_set_keymap ();
-
-#endif /* _KEYMAPS_H_ */
diff --git a/gnu/lib/libreadline/readline/readline.h b/gnu/lib/libreadline/readline/readline.h
deleted file mode 100644
index bbc8a0f..0000000
--- a/gnu/lib/libreadline/readline/readline.h
+++ /dev/null
@@ -1,267 +0,0 @@
-/* Readline.h -- the names of functions callable from within readline. */
-
-/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
-
- This file is part of the GNU Readline Library, a library for
- reading lines of text with interactive input and history editing.
-
- The GNU Readline Library 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.
-
- The GNU Readline Library is distributed in the hope that it will be
- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- The GNU General Public License is often shipped with GNU software, and
- is generally kept in a file called COPYING or LICENSE. If you do not
- have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#if !defined (_READLINE_H_)
-#define _READLINE_H_
-
-#include <readline/keymaps.h>
-#include <readline/tilde.h>
-
-/* The functions for manipulating the text of the line within readline.
-Most of these functions are bound to keys by default. */
-extern int
- rl_tilde_expand (),
- rl_beg_of_line (), rl_backward (), rl_delete (), rl_end_of_line (),
- rl_forward (), ding (), rl_backward (), rl_newline (), rl_kill_line (),
- rl_clear_screen (), rl_get_next_history (), rl_get_previous_history (),
- rl_quoted_insert (), rl_reverse_search_history (), rl_transpose_chars (),
- rl_unix_line_discard (), rl_quoted_insert (), rl_unix_word_rubout (),
- rl_yank (), rl_rubout (), rl_backward_word (), rl_kill_word (),
- rl_forward_word (), rl_tab_insert (), rl_yank_pop (), rl_yank_nth_arg (),
- rl_backward_kill_word (), rl_backward_kill_line (), rl_transpose_words (),
- rl_complete (), rl_possible_completions (), rl_insert_completions (),
- rl_do_lowercase_version (), rl_kill_full_line (),
- rl_digit_argument (), rl_universal_argument (), rl_abort (),
- rl_undo_command (), rl_revert_line (), rl_beginning_of_history (),
- rl_end_of_history (), rl_forward_search_history (), rl_insert (),
- rl_upcase_word (), rl_downcase_word (), rl_capitalize_word (),
- rl_restart_output (), rl_re_read_init_file (), rl_dump_functions (),
- rl_delete_horizontal_space (), rl_history_search_forward (),
- rl_history_search_backward ();
-
-/* `Public' utility functions. */
-extern int rl_insert_text (), rl_delete_text (), rl_kill_text ();
-extern int rl_complete_internal ();
-extern int rl_expand_prompt ();
-extern int rl_initialize ();
-extern int rl_set_signals (), rl_clear_signals ();
-extern int rl_init_argument (), rl_digit_argument ();
-extern int rl_read_key (), rl_getc (), rl_stuff_char ();
-extern int maybe_save_line (), maybe_unsave_line (), maybe_replace_line ();
-extern int rl_modifying ();
-
-extern int rl_begin_undo_group (), rl_end_undo_group ();
-extern void rl_add_undo (), free_undo_list ();
-extern int rl_do_undo ();
-
-extern int rl_insert_close ();
-
-/* These are *both* defined even when VI_MODE is not. */
-extern int rl_vi_editing_mode (), rl_emacs_editing_mode ();
-
-/* Non incremental history searching. */
-extern int
- rl_noninc_forward_search (), rl_noninc_reverse_search (),
- rl_noninc_forward_search_again (), rl_noninc_reverse_search_again ();
-
-/* Things for vi mode. */
-extern int rl_vi_check (), rl_vi_textmod_command ();
-extern int
- rl_vi_redo (), rl_vi_tilde_expand (),
- rl_vi_movement_mode (), rl_vi_insertion_mode (), rl_vi_arg_digit (),
- rl_vi_prev_word (), rl_vi_next_word (), rl_vi_char_search (),
- rl_vi_eof_maybe (), rl_vi_append_mode (), rl_vi_put (),
- rl_vi_append_eol (), rl_vi_insert_beg (), rl_vi_delete (), rl_vi_comment (),
- rl_vi_first_print (), rl_vi_fword (), rl_vi_fWord (), rl_vi_bword (),
- rl_vi_bWord (), rl_vi_eword (), rl_vi_eWord (), rl_vi_end_word (),
- rl_vi_change_case (), rl_vi_match (), rl_vi_bracktype (),
- rl_vi_change_char (), rl_vi_yank_arg (), rl_vi_search (),
- rl_vi_search_again (), rl_vi_subst (), rl_vi_overstrike (),
- rl_vi_overstrike_delete (), rl_vi_replace(), rl_vi_column (),
- rl_vi_delete_to (), rl_vi_change_to (), rl_vi_yank_to (),
- rl_vi_complete (), rl_vi_fetch_history ();
-
-/* Keyboard macro commands. */
-extern int rl_start_kbd_macro (), rl_end_kbd_macro ();
-extern int rl_call_last_kbd_macro ();
-
-extern int rl_arrow_keys(), rl_refresh_line ();
-
-/* Maintaining the state of undo. We remember individual deletes and inserts
- on a chain of things to do. */
-
-/* The actions that undo knows how to undo. Notice that UNDO_DELETE means
- to insert some text, and UNDO_INSERT means to delete some text. I.e.,
- the code tells undo what to undo, not how to undo it. */
-enum undo_code { UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END };
-
-/* What an element of THE_UNDO_LIST looks like. */
-typedef struct undo_list {
- struct undo_list *next;
- int start, end; /* Where the change took place. */
- char *text; /* The text to insert, if undoing a delete. */
- enum undo_code what; /* Delete, Insert, Begin, End. */
-} UNDO_LIST;
-
-/* The current undo list for RL_LINE_BUFFER. */
-extern UNDO_LIST *rl_undo_list;
-
-/* The data structure for mapping textual names to code addresses. */
-typedef struct {
- char *name;
- Function *function;
-} FUNMAP;
-
-extern FUNMAP **funmap;
-
-/* **************************************************************** */
-/* */
-/* Well Published Variables */
-/* */
-/* **************************************************************** */
-
-/* The name of the calling program. You should initialize this to
- whatever was in argv[0]. It is used when parsing conditionals. */
-extern char *rl_readline_name;
-
-/* The line buffer that is in use. */
-extern char *rl_line_buffer;
-
-/* The location of point, and end. */
-extern int rl_point, rl_end;
-
-/* The name of the terminal to use. */
-extern char *rl_terminal_name;
-
-/* The input and output streams. */
-extern FILE *rl_instream, *rl_outstream;
-
-/* The basic list of characters that signal a break between words for the
- completer routine. The initial contents of this variable is what
- breaks words in the shell, i.e. "n\"\\'`@$>". */
-extern char *rl_basic_word_break_characters;
-
-/* The list of characters that signal a break between words for
- rl_complete_internal. The default list is the contents of
- rl_basic_word_break_characters. */
-extern char *rl_completer_word_break_characters;
-
-/* List of characters which can be used to quote a substring of the line.
- Completion occurs on the entire substring, and within the substring
- rl_completer_word_break_characters are treated as any other character,
- unless they also appear within this list. */
-extern char *rl_completer_quote_characters;
-
-/* List of characters that are word break characters, but should be left
- in TEXT when it is passed to the completion function. The shell uses
- this to help determine what kind of completing to do. */
-extern char *rl_special_prefixes;
-
-/* Pointer to the generator function for completion_matches ().
- NULL means to use filename_entry_function (), the default filename
- completer. */
-extern Function *rl_completion_entry_function;
-
-/* If rl_ignore_some_completions_function is non-NULL it is the address
- of a function to call after all of the possible matches have been
- generated, but before the actual completion is done to the input line.
- The function is called with one argument; a NULL terminated array
- of (char *). If your function removes any of the elements, they
- must be free()'ed. */
-extern Function *rl_ignore_some_completions_function;
-
-/* Pointer to alternative function to create matches.
- Function is called with TEXT, START, and END.
- START and END are indices in RL_LINE_BUFFER saying what the boundaries
- of TEXT are.
- If this function exists and returns NULL then call the value of
- rl_completion_entry_function to try to match, otherwise use the
- array of strings returned. */
-extern CPPFunction *rl_attempted_completion_function;
-
-/* If non-zero, then this is the address of a function to call just
- before readline_internal () prints the first prompt. */
-extern Function *rl_startup_hook;
-
-/* If non-zero, then this is the address of a function to call when
- completing on a directory name. The function is called with
- the address of a string (the current directory name) as an arg. */
-extern Function *rl_directory_completion_hook;
-
-/* Backwards compatibility with previous versions of readline. */
-#define rl_symbolic_link_hook rl_directory_completion_hook
-
-/* The address of a function to call periodically while Readline is
- awaiting character input, or NULL, for no event handling. */
-extern Function *rl_event_hook;
-
-/* Non-zero means that modified history lines are preceded
- with an asterisk. */
-extern int rl_show_star;
-
-/* Non-zero means to suppress normal filename completion after the
- user-specified completion function has been called. */
-extern int rl_attempted_completion_over;
-
-/* **************************************************************** */
-/* */
-/* Well Published Functions */
-/* */
-/* **************************************************************** */
-
-/* Read a line of input. Prompt with PROMPT. A NULL PROMPT means none. */
-extern char *readline ();
-
-/* These functions are from complete.c. */
-/* Return an array of strings which are the result of repeatadly calling
- FUNC with TEXT. */
-extern char **completion_matches ();
-extern char *username_completion_function ();
-extern char *filename_completion_function ();
-
-/* These functions are from bind.c. */
-/* rl_add_defun (char *name, Function *function, int key)
- Add NAME to the list of named functions. Make FUNCTION
- be the function that gets called.
- If KEY is not -1, then bind it. */
-extern int rl_add_defun ();
-extern int rl_bind_key (), rl_bind_key_in_map ();
-extern int rl_unbind_key (), rl_unbind_key_in_map ();
-extern int rl_set_key ();
-extern int rl_macro_bind (), rl_generic_bind (), rl_variable_bind ();
-extern int rl_translate_keyseq ();
-extern Function *rl_named_function (), *rl_function_of_keyseq ();
-extern int rl_parse_and_bind ();
-extern Keymap rl_get_keymap (), rl_get_keymap_by_name ();
-extern void rl_set_keymap ();
-extern char **rl_invoking_keyseqs (), **rl_invoking_keyseqs_in_map ();
-extern void rl_function_dumper ();
-extern int rl_read_init_file ();
-
-/* Functions in funmap.c */
-extern void rl_list_funmap_names ();
-extern void rl_initialize_funmap ();
-
-/* Functions in display.c */
-extern void rl_redisplay ();
-extern int rl_message (), rl_clear_message ();
-extern int rl_reset_line_state ();
-extern int rl_character_len ();
-extern int rl_show_char ();
-extern int crlf (), rl_on_new_line ();
-extern int rl_forced_update_display ();
-
-/* Definitions available for use by readline clients. */
-#define RL_PROMPT_START_IGNORE '\001'
-#define RL_PROMPT_END_IGNORE '\002'
-
-#endif /* _READLINE_H_ */
diff --git a/gnu/lib/libreadline/readline/tilde.h b/gnu/lib/libreadline/readline/tilde.h
deleted file mode 100644
index 726d081..0000000
--- a/gnu/lib/libreadline/readline/tilde.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* tilde.h: Externally available variables and function in libtilde.a. */
-
-#if !defined (__TILDE_H__)
-# define __TILDE_H__
-
-/* Function pointers can be declared as (Function *)foo. */
-#if !defined (__FUNCTION_DEF)
-# define __FUNCTION_DEF
-typedef int Function ();
-typedef void VFunction ();
-typedef char *CPFunction ();
-typedef char **CPPFunction ();
-#endif /* _FUNCTION_DEF */
-
-/* If non-null, this contains the address of a function to call if the
- standard meaning for expanding a tilde fails. The function is called
- with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
- which is the expansion, or a NULL pointer if there is no expansion. */
-extern CPFunction *tilde_expansion_failure_hook;
-
-/* When non-null, this is a NULL terminated array of strings which
- are duplicates for a tilde prefix. Bash uses this to expand
- `=~' and `:~'. */
-extern char **tilde_additional_prefixes;
-
-/* When non-null, this is a NULL terminated array of strings which match
- the end of a username, instead of just "/". Bash sets this to
- `:' and `=~'. */
-extern char **tilde_additional_suffixes;
-
-/* Return a new string which is the result of tilde expanding STRING. */
-extern char *tilde_expand ();
-
-/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
- tilde. If there is no expansion, call tilde_expansion_failure_hook. */
-extern char *tilde_expand_word ();
-
-#endif /* __TILDE_H__ */
diff --git a/gnu/lib/libreadline/sysdep.h b/gnu/lib/libreadline/sysdep.h
deleted file mode 100644
index 007a561..0000000
--- a/gnu/lib/libreadline/sysdep.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* System-dependent stuff, for ``normal'' systems */
-/* If you think you need to change this file, then you are wrong. In order to
- avoid a huge ugly mass of nested #ifdefs, you should create a new file just
- for your system, which contains exactly those #includes and definitions that
- your system needs, AND NOTHING MORE! Then, add that file to the appropriate
- place in configure.in, and viola, you are done. sysdep-sunos4.h is a good
- example of how to do this. */
-
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else
-#if defined (sparc) && defined (sun)
-#include <alloca.h>
-#endif
-#ifndef alloca /* May be a macro, with args. */
-extern char *alloca ();
-#endif
-#endif
-
-#include <sys/types.h> /* Needed by dirent.h */
-#include <sys/ioctl.h> /* Needed for TIOC?WINSZ */
-
-#if defined (USG) && defined (TIOCGWINSZ)
-#include <sys/stream.h>
-#if defined (USGr4) || defined (USGr3)
-#include <sys/ptem.h>
-#endif /* USGr4 */
-#endif /* USG && TIOCGWINSZ */
-
-#include <dirent.h>
-typedef struct dirent dirent;
-
-/* SVR4 systems should use <termios.h> rather than <termio.h>. */
-
-#if defined (USGr4)
-#define _POSIX_VERSION
-#endif
diff --git a/gnu/lib/libreadline/tcsh_hack.readme b/gnu/lib/libreadline/tcsh_hack.readme
deleted file mode 100644
index 6fd5da1..0000000
--- a/gnu/lib/libreadline/tcsh_hack.readme
+++ /dev/null
@@ -1,27 +0,0 @@
-*** rltty.c.orig Thu May 12 19:02:50 1994
---- rltty.c Thu May 12 19:03:06 1994
-***************
-*** 21,26 ****
---- 21,27 ----
- have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
- #include <sys/types.h>
-+ #include <sys/ioctl.h>
- #include <signal.h>
- #include <errno.h>
- #include <stdio.h>
-***************
-*** 359,364 ****
---- 360,371 ----
- int tty;
- TIOTYPE *tiop;
- {
-+ /* XXX this prevents to got editing mode from tcsh. Ache */
-+ struct winsize w;
-+
-+ if (ioctl (tty, TIOCGWINSZ, &w) == 0)
-+ (void) ioctl (tty, TIOCSWINSZ, &w);
-+
- while (GETATTR (tty, tiop) < 0)
- {
- if (errno != EINTR)
diff --git a/gnu/lib/libregex/doc/Makefile.in b/gnu/lib/libregex/doc/Makefile.in
deleted file mode 100644
index 2f5d382..0000000
--- a/gnu/lib/libregex/doc/Makefile.in
+++ /dev/null
@@ -1,92 +0,0 @@
-# Makefile for regex documentation.
-#
-# Copyright (C) 1992 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-# Installation directories.
-prefix = /usr/local
-infodir = $(prefix)/info
-
-srcdir = @srcdir@
-VPATH = @srcdir@:../@srcdir@
-
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-
-MAKEINFO = makeinfo --no-split
-SHELL = /bin/sh
-TEX = tex
-TEXINDEX = texindex
-
-default all: regex.info regex.dvi
-.PHONY: default all
-
-# We need to include some code from regex.h.
-regex.texi: xregex.texi
- rm -f $@
- gawk -f include.awk -vsource=../$(srcdir)/regex.h \
- <../$(srcdir)/doc/xregex.texi \
- | expand >$@
- chmod a-w $@
-
-regex.dvi: regex.cps
- $(TEX) regex.texi
-regex.cps: regex.cp
- $(TEXINDEX) regex.??
-regex.cp: regex.texi
- $(TEX) ../$(srcdir)/doc/regex.texi
-
-regex.info: regex.texi
- $(MAKEINFO) ../$(srcdir)/doc/regex.texi
-
-# I know of no way to make a good TAGS file from Texinfo source.
-TAGS:
-
-check:
-.PHONY: check
-
-install: regex.info
- -mkdir $(prefix) $(infodir)
- for i in *.info*; do $(INSTALL_DATA) $$i $(infodir)/$$i; done
-.PHONY: install
-
-clean mostlyclean:
- rm -f regex.?? *.dvi *.log *.toc
-
-distclean: clean
- rm -f Makefile
- for f in regex.??s; do if test -z "`cat $$f`"; then rm -f $$f; fi; done
-
-realclean: distclean
- rm -f *.info* regex.??? regex.texi TAGS
-
-extraclean: distclean
- rm -f patch* *~* *\#* *.orig *.rej *.bak core a.out
-.PHONY: mostlyclean clean distclean realclean extraclean
-
-Makefile: Makefile.in ../config.status
- (cd ..; sh config.status)
-
-# Prevent GNU make 3 from overflowing arg limit on system V.
-.NOEXPORT:
-
-# Assumes $(distdir) is the place to put our files.
-distfiles = Makefile.in *.texi texinfo.tex include.awk \
- regex.info* regex.aux regex.cps
-dist: Makefile regex.info regex.cps
- mkdir $(distdir)
- ln $(distfiles) $(distdir)
-.PHONY: dist
diff --git a/gnu/lib/libregex/doc/regex.aux b/gnu/lib/libregex/doc/regex.aux
deleted file mode 100644
index fd6a245..0000000
--- a/gnu/lib/libregex/doc/regex.aux
+++ /dev/null
@@ -1,136 +0,0 @@
-'xrdef {Overview-pg}{1}
-'xrdef {Overview-snt}{Chapter'tie1}
-'xrdef {Regular Expression Syntax-pg}{2}
-'xrdef {Regular Expression Syntax-snt}{Chapter'tie2}
-'xrdef {Syntax Bits-pg}{2}
-'xrdef {Syntax Bits-snt}{Section'tie2.1}
-'xrdef {Predefined Syntaxes-pg}{5}
-'xrdef {Predefined Syntaxes-snt}{Section'tie2.2}
-'xrdef {Collating Elements vs. Characters-pg}{6}
-'xrdef {Collating Elements vs. Characters-snt}{Section'tie2.3}
-'xrdef {The Backslash Character-pg}{7}
-'xrdef {The Backslash Character-snt}{Section'tie2.4}
-'xrdef {Common Operators-pg}{9}
-'xrdef {Common Operators-snt}{Chapter'tie3}
-'xrdef {Match-self Operator-pg}{9}
-'xrdef {Match-self Operator-snt}{Section'tie3.1}
-'xrdef {Match-any-character Operator-pg}{9}
-'xrdef {Match-any-character Operator-snt}{Section'tie3.2}
-'xrdef {Concatenation Operator-pg}{10}
-'xrdef {Concatenation Operator-snt}{Section'tie3.3}
-'xrdef {Repetition Operators-pg}{10}
-'xrdef {Repetition Operators-snt}{Section'tie3.4}
-'xrdef {Match-zero-or-more Operator-pg}{10}
-'xrdef {Match-zero-or-more Operator-snt}{Section'tie3.4.1}
-'xrdef {Match-one-or-more Operator-pg}{11}
-'xrdef {Match-one-or-more Operator-snt}{Section'tie3.4.2}
-'xrdef {Match-zero-or-one Operator-pg}{11}
-'xrdef {Match-zero-or-one Operator-snt}{Section'tie3.4.3}
-'xrdef {Interval Operators-pg}{12}
-'xrdef {Interval Operators-snt}{Section'tie3.4.4}
-'xrdef {Alternation Operator-pg}{13}
-'xrdef {Alternation Operator-snt}{Section'tie3.5}
-'xrdef {List Operators-pg}{13}
-'xrdef {List Operators-snt}{Section'tie3.6}
-'xrdef {Character Class Operators-pg}{14}
-'xrdef {Character Class Operators-snt}{Section'tie3.6.1}
-'xrdef {Range Operator-pg}{15}
-'xrdef {Range Operator-snt}{Section'tie3.6.2}
-'xrdef {Grouping Operators-pg}{16}
-'xrdef {Grouping Operators-snt}{Section'tie3.7}
-'xrdef {Back-reference Operator-pg}{17}
-'xrdef {Back-reference Operator-snt}{Section'tie3.8}
-'xrdef {Anchoring Operators-pg}{18}
-'xrdef {Anchoring Operators-snt}{Section'tie3.9}
-'xrdef {Match-beginning-of-line Operator-pg}{18}
-'xrdef {Match-beginning-of-line Operator-snt}{Section'tie3.9.1}
-'xrdef {Match-end-of-line Operator-pg}{18}
-'xrdef {Match-end-of-line Operator-snt}{Section'tie3.9.2}
-'xrdef {GNU Operators-pg}{20}
-'xrdef {GNU Operators-snt}{Chapter'tie4}
-'xrdef {Word Operators-pg}{20}
-'xrdef {Word Operators-snt}{Section'tie4.1}
-'xrdef {Non-Emacs Syntax Tables-pg}{20}
-'xrdef {Non-Emacs Syntax Tables-snt}{Section'tie4.1.1}
-'xrdef {Match-word-boundary Operator-pg}{20}
-'xrdef {Match-word-boundary Operator-snt}{Section'tie4.1.2}
-'xrdef {Match-within-word Operator-pg}{20}
-'xrdef {Match-within-word Operator-snt}{Section'tie4.1.3}
-'xrdef {Match-beginning-of-word Operator-pg}{21}
-'xrdef {Match-beginning-of-word Operator-snt}{Section'tie4.1.4}
-'xrdef {Match-end-of-word Operator-pg}{21}
-'xrdef {Match-end-of-word Operator-snt}{Section'tie4.1.5}
-'xrdef {Match-word-constituent Operator-pg}{21}
-'xrdef {Match-word-constituent Operator-snt}{Section'tie4.1.6}
-'xrdef {Match-non-word-constituent Operator-pg}{21}
-'xrdef {Match-non-word-constituent Operator-snt}{Section'tie4.1.7}
-'xrdef {Buffer Operators-pg}{21}
-'xrdef {Buffer Operators-snt}{Section'tie4.2}
-'xrdef {Match-beginning-of-buffer Operator-pg}{21}
-'xrdef {Match-beginning-of-buffer Operator-snt}{Section'tie4.2.1}
-'xrdef {Match-end-of-buffer Operator-pg}{21}
-'xrdef {Match-end-of-buffer Operator-snt}{Section'tie4.2.2}
-'xrdef {GNU Emacs Operators-pg}{22}
-'xrdef {GNU Emacs Operators-snt}{Chapter'tie5}
-'xrdef {Syntactic Class Operators-pg}{22}
-'xrdef {Syntactic Class Operators-snt}{Section'tie5.1}
-'xrdef {Emacs Syntax Tables-pg}{22}
-'xrdef {Emacs Syntax Tables-snt}{Section'tie5.1.1}
-'xrdef {Match-syntactic-class Operator-pg}{22}
-'xrdef {Match-syntactic-class Operator-snt}{Section'tie5.1.2}
-'xrdef {Match-not-syntactic-class Operator-pg}{22}
-'xrdef {Match-not-syntactic-class Operator-snt}{Section'tie5.1.3}
-'xrdef {What Gets Matched?-pg}{23}
-'xrdef {What Gets Matched?-snt}{Chapter'tie6}
-'xrdef {Programming with Regex-pg}{24}
-'xrdef {Programming with Regex-snt}{Chapter'tie7}
-'xrdef {GNU Regex Functions-pg}{24}
-'xrdef {GNU Regex Functions-snt}{Section'tie7.1}
-'xrdef {GNU Pattern Buffers-pg}{24}
-'xrdef {GNU Pattern Buffers-snt}{Section'tie7.1.1}
-'xrdef {GNU Regular Expression Compiling-pg}{26}
-'xrdef {GNU Regular Expression Compiling-snt}{Section'tie7.1.2}
-'xrdef {GNU Matching-pg}{27}
-'xrdef {GNU Matching-snt}{Section'tie7.1.3}
-'xrdef {GNU Searching-pg}{28}
-'xrdef {GNU Searching-snt}{Section'tie7.1.4}
-'xrdef {Matching/Searching with Split Data-pg}{29}
-'xrdef {Matching/Searching with Split Data-snt}{Section'tie7.1.5}
-'xrdef {Searching with Fastmaps-pg}{30}
-'xrdef {Searching with Fastmaps-snt}{Section'tie7.1.6}
-'xrdef {GNU Translate Tables-pg}{31}
-'xrdef {GNU Translate Tables-snt}{Section'tie7.1.7}
-'xrdef {Using Registers-pg}{32}
-'xrdef {Using Registers-snt}{Section'tie7.1.8}
-'xrdef {Freeing GNU Pattern Buffers-pg}{34}
-'xrdef {Freeing GNU Pattern Buffers-snt}{Section'tie7.1.9}
-'xrdef {POSIX Regex Functions-pg}{35}
-'xrdef {POSIX Regex Functions-snt}{Section'tie7.2}
-'xrdef {POSIX Pattern Buffers-pg}{35}
-'xrdef {POSIX Pattern Buffers-snt}{Section'tie7.2.1}
-'xrdef {POSIX Regular Expression Compiling-pg}{35}
-'xrdef {POSIX Regular Expression Compiling-snt}{Section'tie7.2.2}
-'xrdef {POSIX Matching-pg}{37}
-'xrdef {POSIX Matching-snt}{Section'tie7.2.3}
-'xrdef {Reporting Errors-pg}{38}
-'xrdef {Reporting Errors-snt}{Section'tie7.2.4}
-'xrdef {Using Byte Offsets-pg}{39}
-'xrdef {Using Byte Offsets-snt}{Section'tie7.2.5}
-'xrdef {Freeing POSIX Pattern Buffers-pg}{39}
-'xrdef {Freeing POSIX Pattern Buffers-snt}{Section'tie7.2.6}
-'xrdef {BSD Regex Functions-pg}{40}
-'xrdef {BSD Regex Functions-snt}{Section'tie7.3}
-'xrdef {BSD Regular Expression Compiling-pg}{40}
-'xrdef {BSD Regular Expression Compiling-snt}{Section'tie7.3.1}
-'xrdef {BSD Searching-pg}{40}
-'xrdef {BSD Searching-snt}{Section'tie7.3.2}
-'xrdef {Copying-pg}{42}
-'xrdef {Copying-snt}{Appendix'tie'char65{}}
-'xrdef {Copying-pg}{42}
-'xrdef {Copying-snt}{}
-'xrdef {Copying-pg}{43}
-'xrdef {Copying-snt}{}
-'xrdef {Copying-pg}{48}
-'xrdef {Copying-snt}{}
-'xrdef {Index-pg}{50}
-'xrdef {Index-snt}{}
diff --git a/gnu/lib/libregex/doc/regex.cps b/gnu/lib/libregex/doc/regex.cps
deleted file mode 100644
index 8b2e57c..0000000
--- a/gnu/lib/libregex/doc/regex.cps
+++ /dev/null
@@ -1,152 +0,0 @@
-\initial {$}
-\entry {\code {$}}{18}
-\initial {(}
-\entry {\code {(}}{16}
-\initial {)}
-\entry {\code {)}}{16}
-\initial {*}
-\entry {\samp {*}}{10}
-\initial {-}
-\entry {\samp {-}}{13}
-\initial {.}
-\entry {\samp {.}}{9}
-\initial {:}
-\entry {\samp {:]} in regex}{14}
-\initial {?}
-\entry {\samp {?}}{11}
-\initial {[}
-\entry {\samp {[}}{13}
-\entry {\samp {[:} in regex}{14}
-\entry {\samp {[{\tt\hat}}}{13}
-\initial {]}
-\entry {\samp {]}}{13}
-\initial {{\tt\char'173}}
-\entry {\samp {{\tt\char'173}}}{12}
-\initial {{\tt\char'174}}
-\entry {\code {{\tt\char'174}}}{13}
-\initial {{\tt\char'175}}
-\entry {\samp {{\tt\char'175}}}{12}
-\initial {{\tt\char43}}
-\entry {\samp {{\tt\char43}}}{11}
-\initial {{\tt\hat}}
-\entry {\samp {{\tt\hat}}}{13}
-\entry {\code {{\tt\hat}}}{18}
-\initial {{\tt\indexbackslash }}
-\entry {{\tt\indexbackslash }}{7}
-\entry {\samp {{\tt\indexbackslash }}}{13}
-\entry {\samp {{\tt\indexbackslash }'}}{21}
-\entry {\code {{\tt\indexbackslash }(}}{16}
-\entry {\code {{\tt\indexbackslash })}}{16}
-\entry {\samp {{\tt\indexbackslash }`}}{21}
-\entry {\samp {{\tt\indexbackslash }{\tt\char'173}}}{12}
-\entry {\code {{\tt\indexbackslash }{\tt\char'174}}}{13}
-\entry {\samp {{\tt\indexbackslash }{\tt\char'175}}}{12}
-\entry {\samp {{\tt\indexbackslash }{\tt\gtr}}}{21}
-\entry {\samp {{\tt\indexbackslash }{\tt\less}}}{21}
-\entry {\samp {{\tt\indexbackslash }b}}{20}
-\entry {\samp {{\tt\indexbackslash }B}}{20}
-\entry {\samp {{\tt\indexbackslash }s}}{22}
-\entry {\samp {{\tt\indexbackslash }S}}{22}
-\entry {\samp {{\tt\indexbackslash }w}}{21}
-\entry {\samp {{\tt\indexbackslash }W}}{21}
-\initial {A}
-\entry {\code {allocated \r {initialization}}}{26}
-\entry {alternation operator}{13}
-\entry {alternation operator and \samp {{\tt\hat}}}{18}
-\entry {anchoring}{18}
-\entry {anchors}{18}
-\entry {Awk}{5}
-\initial {B}
-\entry {back references}{17}
-\entry {backtracking}{10, 13}
-\entry {beginning-of-line operator}{18}
-\entry {bracket expression}{13}
-\entry {\code {buffer \r {field, set by \code {re{\_}compile{\_}pattern}}}}{27}
-\entry {\code {buffer \r {initialization}}}{26}
-\initial {C}
-\entry {character classes}{14}
-\initial {E}
-\entry {Egrep}{5}
-\entry {Emacs}{5}
-\entry {end-of-line operator}{18}
-\entry {\code {end\penalty 10000{\spaceskip = 0pt{} }\r {in\penalty 10000{\spaceskip = 0pt{} }\code {struct\penalty 10000{\spaceskip = 0pt{} }re_registers}}}}{32}
-\initial {F}
-\entry {\code {fastmap \r {initialization}}}{26}
-\entry {\code {fastmap{\_}accurate \r {field, set by \code {re{\_}compile{\_}pattern}}}}{27}
-\entry {fastmaps}{30}
-\initial {G}
-\entry {Grep}{5}
-\entry {grouping}{16}
-\initial {I}
-\entry {ignoring case}{35}
-\entry {interval expression}{12}
-\initial {M}
-\entry {matching list}{13}
-\entry {matching newline}{13}
-\entry {matching with GNU functions}{27}
-\initial {N}
-\entry {\code {newline{\_}anchor \r {field in pattern buffer}}}{18}
-\entry {nonmatching list}{13}
-\entry {\code {not{\_}bol \r {field in pattern buffer}}}{18}
-\entry {\code {num_regs\penalty 10000{\spaceskip = 0pt{} }\r {in\penalty 10000{\spaceskip = 0pt{} }\code {struct\penalty 10000{\spaceskip = 0pt{} }re_registers}}}}{32}
-\initial {O}
-\entry {open-group operator and \samp {{\tt\hat}}}{18}
-\entry {or operator}{13}
-\initial {P}
-\entry {parenthesizing}{16}
-\entry {pattern buffer initialization}{26}
-\entry {pattern buffer, definition of}{24}
-\entry {POSIX Awk}{5}
-\initial {R}
-\entry {\code {range \r {argument to \code {re{\_}search}}}}{28}
-\entry {\code {re_registers}}{32}
-\entry {\code {RE{\_}BACKSLASH{\_}ESCAPE{\_}IN{\_}LIST}}{3}
-\entry {\code {RE{\_}BK{\_}PLUS{\_}QM}}{3}
-\entry {\code {RE{\_}CHAR{\_}CLASSES}}{3}
-\entry {\code {RE{\_}CONTEXT{\_}INDEP{\_}ANCHORS}}{3}
-\entry {\code {RE{\_}CONTEXT{\_}INDEP{\_}ANCHORS \r {(and \samp {{\tt\hat}})}}}{18}
-\entry {\code {RE{\_}CONTEXT{\_}INDEP{\_}OPS}}{3}
-\entry {\code {RE{\_}CONTEXT{\_}INVALID{\_}OPS}}{3}
-\entry {\code {RE{\_}DOT{\_}NEWLINE}}{3}
-\entry {\code {RE{\_}DOT{\_}NOT{\_}NULL}}{4}
-\entry {\code {RE{\_}INTERVALS}}{4}
-\entry {\code {RE{\_}LIMITED{\_}OPS}}{4}
-\entry {\code {RE{\_}NEWLINE{\_}ALT}}{4}
-\entry {\code {RE{\_}NO{\_}BK{\_}BRACES}}{4}
-\entry {\code {RE{\_}NO{\_}BK{\_}PARENS}}{4}
-\entry {\code {RE{\_}NO{\_}BK{\_}REFS}}{4}
-\entry {\code {RE{\_}NO{\_}BK{\_}VBAR}}{4}
-\entry {\code {RE{\_}NO{\_}EMPTY{\_}RANGES}}{4}
-\entry {\code {re{\_}nsub \r {field, set by \code {re{\_}compile{\_}pattern}}}}{27}
-\entry {\code {re{\_}pattern{\_}buffer \r {definition}}}{24}
-\entry {\code {re{\_}syntax{\_}options \r {initialization}}}{26}
-\entry {\code {RE{\_}UNMATCHED{\_}RIGHT{\_}PAREN{\_}ORD}}{4}
-\entry {\code {REG{\_}EXTENDED}}{35}
-\entry {\code {REG{\_}ICASE}}{35}
-\entry {\code {REG{\_}NEWLINE}}{36}
-\entry {\code {REG{\_}NOSUB}}{35}
-\entry {\code {regex.c}}{1}
-\entry {\code {regex.h}}{1}
-\entry {regexp anchoring}{18}
-\entry {\code {regmatch{\_}t}}{39}
-\entry {\code {regs{\_}allocated}}{32}
-\entry {\code {REGS{\_}FIXED}}{33}
-\entry {\code {REGS{\_}REALLOCATE}}{32}
-\entry {\code {REGS{\_}UNALLOCATED}}{32}
-\entry {regular expressions, syntax of}{2}
-\initial {S}
-\entry {searching with GNU functions}{28}
-\entry {\code {start \r {argument to \code {re{\_}search}}}}{28}
-\entry {\code {start\penalty 10000{\spaceskip = 0pt{} }\r {in\penalty 10000{\spaceskip = 0pt{} }\code {struct\penalty 10000{\spaceskip = 0pt{} }re_registers}}}}{32}
-\entry {\code {struct re{\_}pattern{\_}buffer \r {definition}}}{24}
-\entry {subexpressions}{16}
-\entry {syntax bits}{2}
-\entry {\code {syntax \r {field, set by \code {re{\_}compile{\_}pattern}}}}{27}
-\entry {syntax initialization}{26}
-\entry {syntax of regular expressions}{2}
-\initial {T}
-\entry {\code {translate \r {initialization}}}{26}
-\initial {U}
-\entry {\code {used \r {field, set by \code {re{\_}compile{\_}pattern}}}}{27}
-\initial {W}
-\entry {word boundaries, matching}{20}
diff --git a/gnu/lib/libregex/doc/regex.info b/gnu/lib/libregex/doc/regex.info
deleted file mode 100644
index 90deede..0000000
--- a/gnu/lib/libregex/doc/regex.info
+++ /dev/null
@@ -1,2836 +0,0 @@
-This is Info file regex.info, produced by Makeinfo-1.52 from the input
-file .././doc/regex.texi.
-
- This file documents the GNU regular expression library.
-
- Copyright (C) 1992, 1993 Free Software Foundation, Inc.
-
- Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided also that the
-section entitled "GNU General Public License" is included exactly as in
-the original, and provided that the entire resulting derived work is
-distributed under the terms of a permission notice identical to this
-one.
-
- Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions, except that the section entitled "GNU General Public License"
-may be included in a translation approved by the Free Software
-Foundation instead of in the original English.
-
-
-File: regex.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir)
-
-Regular Expression Library
-**************************
-
- This manual documents how to program with the GNU regular expression
-library. This is edition 0.12a of the manual, 19 September 1992.
-
- The first part of this master menu lists the major nodes in this Info
-document, including the index. The rest of the menu lists all the
-lower level nodes in the document.
-
-* Menu:
-
-* Overview::
-* Regular Expression Syntax::
-* Common Operators::
-* GNU Operators::
-* GNU Emacs Operators::
-* What Gets Matched?::
-* Programming with Regex::
-* Copying:: Copying and sharing Regex.
-* Index:: General index.
- -- The Detailed Node Listing --
-
-Regular Expression Syntax
-
-* Syntax Bits::
-* Predefined Syntaxes::
-* Collating Elements vs. Characters::
-* The Backslash Character::
-
-Common Operators
-
-* Match-self Operator:: Ordinary characters.
-* Match-any-character Operator:: .
-* Concatenation Operator:: Juxtaposition.
-* Repetition Operators:: * + ? {}
-* Alternation Operator:: |
-* List Operators:: [...] [^...]
-* Grouping Operators:: (...)
-* Back-reference Operator:: \digit
-* Anchoring Operators:: ^ $
-
-Repetition Operators
-
-* Match-zero-or-more Operator:: *
-* Match-one-or-more Operator:: +
-* Match-zero-or-one Operator:: ?
-* Interval Operators:: {}
-
-List Operators (`[' ... `]' and `[^' ... `]')
-
-* Character Class Operators:: [:class:]
-* Range Operator:: start-end
-
-Anchoring Operators
-
-* Match-beginning-of-line Operator:: ^
-* Match-end-of-line Operator:: $
-
-GNU Operators
-
-* Word Operators::
-* Buffer Operators::
-
-Word Operators
-
-* Non-Emacs Syntax Tables::
-* Match-word-boundary Operator:: \b
-* Match-within-word Operator:: \B
-* Match-beginning-of-word Operator:: \<
-* Match-end-of-word Operator:: \>
-* Match-word-constituent Operator:: \w
-* Match-non-word-constituent Operator:: \W
-
-Buffer Operators
-
-* Match-beginning-of-buffer Operator:: \`
-* Match-end-of-buffer Operator:: \'
-
-GNU Emacs Operators
-
-* Syntactic Class Operators::
-
-Syntactic Class Operators
-
-* Emacs Syntax Tables::
-* Match-syntactic-class Operator:: \sCLASS
-* Match-not-syntactic-class Operator:: \SCLASS
-
-Programming with Regex
-
-* GNU Regex Functions::
-* POSIX Regex Functions::
-* BSD Regex Functions::
-
-GNU Regex Functions
-
-* GNU Pattern Buffers:: The re_pattern_buffer type.
-* GNU Regular Expression Compiling:: re_compile_pattern ()
-* GNU Matching:: re_match ()
-* GNU Searching:: re_search ()
-* Matching/Searching with Split Data:: re_match_2 (), re_search_2 ()
-* Searching with Fastmaps:: re_compile_fastmap ()
-* GNU Translate Tables:: The `translate' field.
-* Using Registers:: The re_registers type and related fns.
-* Freeing GNU Pattern Buffers:: regfree ()
-
-POSIX Regex Functions
-
-* POSIX Pattern Buffers:: The regex_t type.
-* POSIX Regular Expression Compiling:: regcomp ()
-* POSIX Matching:: regexec ()
-* Reporting Errors:: regerror ()
-* Using Byte Offsets:: The regmatch_t type.
-* Freeing POSIX Pattern Buffers:: regfree ()
-
-BSD Regex Functions
-
-* BSD Regular Expression Compiling:: re_comp ()
-* BSD Searching:: re_exec ()
-
-
-File: regex.info, Node: Overview, Next: Regular Expression Syntax, Prev: Top, Up: Top
-
-Overview
-********
-
- A "regular expression" (or "regexp", or "pattern") is a text string
-that describes some (mathematical) set of strings. A regexp R
-"matches" a string S if S is in the set of strings described by R.
-
- Using the Regex library, you can:
-
- * see if a string matches a specified pattern as a whole, and
-
- * search within a string for a substring matching a specified
- pattern.
-
- Some regular expressions match only one string, i.e., the set they
-describe has only one member. For example, the regular expression
-`foo' matches the string `foo' and no others. Other regular
-expressions match more than one string, i.e., the set they describe has
-more than one member. For example, the regular expression `f*' matches
-the set of strings made up of any number (including zero) of `f's. As
-you can see, some characters in regular expressions match themselves
-(such as `f') and some don't (such as `*'); the ones that don't match
-themselves instead let you specify patterns that describe many
-different strings.
-
- To either match or search for a regular expression with the Regex
-library functions, you must first compile it with a Regex pattern
-compiling function. A "compiled pattern" is a regular expression
-converted to the internal format used by the library functions. Once
-you've compiled a pattern, you can use it for matching or searching any
-number of times.
-
- The Regex library consists of two source files: `regex.h' and
-`regex.c'. Regex provides three groups of functions with which you can
-operate on regular expressions. One group--the GNU group--is more
-powerful but not completely compatible with the other two, namely the
-POSIX and Berkeley UNIX groups; its interface was designed specifically
-for GNU. The other groups have the same interfaces as do the regular
-expression functions in POSIX and Berkeley UNIX.
-
- We wrote this chapter with programmers in mind, not users of
-programs--such as Emacs--that use Regex. We describe the Regex library
-in its entirety, not how to write regular expressions that a particular
-program understands.
-
-
-File: regex.info, Node: Regular Expression Syntax, Next: Common Operators, Prev: Overview, Up: Top
-
-Regular Expression Syntax
-*************************
-
- "Characters" are things you can type. "Operators" are things in a
-regular expression that match one or more characters. You compose
-regular expressions from operators, which in turn you specify using one
-or more characters.
-
- Most characters represent what we call the match-self operator, i.e.,
-they match themselves; we call these characters "ordinary". Other
-characters represent either all or parts of fancier operators; e.g.,
-`.' represents what we call the match-any-character operator (which, no
-surprise, matches (almost) any character); we call these characters
-"special". Two different things determine what characters represent
-what operators:
-
- 1. the regular expression syntax your program has told the Regex
- library to recognize, and
-
- 2. the context of the character in the regular expression.
-
- In the following sections, we describe these things in more detail.
-
-* Menu:
-
-* Syntax Bits::
-* Predefined Syntaxes::
-* Collating Elements vs. Characters::
-* The Backslash Character::
-
-
-File: regex.info, Node: Syntax Bits, Next: Predefined Syntaxes, Up: Regular Expression Syntax
-
-Syntax Bits
-===========
-
- In any particular syntax for regular expressions, some characters are
-always special, others are sometimes special, and others are never
-special. The particular syntax that Regex recognizes for a given
-regular expression depends on the value in the `syntax' field of the
-pattern buffer of that regular expression.
-
- You get a pattern buffer by compiling a regular expression. *Note
-GNU Pattern Buffers::, and *Note POSIX Pattern Buffers::, for more
-information on pattern buffers. *Note GNU Regular Expression
-Compiling::, *Note POSIX Regular Expression Compiling::, and *Note BSD
-Regular Expression Compiling::, for more information on compiling.
-
- Regex considers the value of the `syntax' field to be a collection of
-bits; we refer to these bits as "syntax bits". In most cases, they
-affect what characters represent what operators. We describe the
-meanings of the operators to which we refer in *Note Common Operators::,
-*Note GNU Operators::, and *Note GNU Emacs Operators::.
-
- For reference, here is the complete list of syntax bits, in
-alphabetical order:
-
-`RE_BACKSLASH_ESCAPE_IN_LISTS'
- If this bit is set, then `\' inside a list (*note List Operators::.
- quotes (makes ordinary, if it's special) the following character;
- if this bit isn't set, then `\' is an ordinary character inside
- lists. (*Note The Backslash Character::, for what `\' does
- outside of lists.)
-
-`RE_BK_PLUS_QM'
- If this bit is set, then `\+' represents the match-one-or-more
- operator and `\?' represents the match-zero-or-more operator; if
- this bit isn't set, then `+' represents the match-one-or-more
- operator and `?' represents the match-zero-or-one operator. This
- bit is irrelevant if `RE_LIMITED_OPS' is set.
-
-`RE_CHAR_CLASSES'
- If this bit is set, then you can use character classes in lists;
- if this bit isn't set, then you can't.
-
-`RE_CONTEXT_INDEP_ANCHORS'
- If this bit is set, then `^' and `$' are special anywhere outside
- a list; if this bit isn't set, then these characters are special
- only in certain contexts. *Note Match-beginning-of-line
- Operator::, and *Note Match-end-of-line Operator::.
-
-`RE_CONTEXT_INDEP_OPS'
- If this bit is set, then certain characters are special anywhere
- outside a list; if this bit isn't set, then those characters are
- special only in some contexts and are ordinary elsewhere.
- Specifically, if this bit isn't set then `*', and (if the syntax
- bit `RE_LIMITED_OPS' isn't set) `+' and `?' (or `\+' and `\?',
- depending on the syntax bit `RE_BK_PLUS_QM') represent repetition
- operators only if they're not first in a regular expression or
- just after an open-group or alternation operator. The same holds
- for `{' (or `\{', depending on the syntax bit `RE_NO_BK_BRACES') if
- it is the beginning of a valid interval and the syntax bit
- `RE_INTERVALS' is set.
-
-`RE_CONTEXT_INVALID_OPS'
- If this bit is set, then repetition and alternation operators
- can't be in certain positions within a regular expression.
- Specifically, the regular expression is invalid if it has:
-
- * a repetition operator first in the regular expression or just
- after a match-beginning-of-line, open-group, or alternation
- operator; or
-
- * an alternation operator first or last in the regular
- expression, just before a match-end-of-line operator, or just
- after an alternation or open-group operator.
-
- If this bit isn't set, then you can put the characters
- representing the repetition and alternation characters anywhere in
- a regular expression. Whether or not they will in fact be
- operators in certain positions depends on other syntax bits.
-
-`RE_DOT_NEWLINE'
- If this bit is set, then the match-any-character operator matches
- a newline; if this bit isn't set, then it doesn't.
-
-`RE_DOT_NOT_NULL'
- If this bit is set, then the match-any-character operator doesn't
- match a null character; if this bit isn't set, then it does.
-
-`RE_INTERVALS'
- If this bit is set, then Regex recognizes interval operators; if
- this bit isn't set, then it doesn't.
-
-`RE_LIMITED_OPS'
- If this bit is set, then Regex doesn't recognize the
- match-one-or-more, match-zero-or-one or alternation operators; if
- this bit isn't set, then it does.
-
-`RE_NEWLINE_ALT'
- If this bit is set, then newline represents the alternation
- operator; if this bit isn't set, then newline is ordinary.
-
-`RE_NO_BK_BRACES'
- If this bit is set, then `{' represents the open-interval operator
- and `}' represents the close-interval operator; if this bit isn't
- set, then `\{' represents the open-interval operator and `\}'
- represents the close-interval operator. This bit is relevant only
- if `RE_INTERVALS' is set.
-
-`RE_NO_BK_PARENS'
- If this bit is set, then `(' represents the open-group operator and
- `)' represents the close-group operator; if this bit isn't set,
- then `\(' represents the open-group operator and `\)' represents
- the close-group operator.
-
-`RE_NO_BK_REFS'
- If this bit is set, then Regex doesn't recognize `\'DIGIT as the
- back reference operator; if this bit isn't set, then it does.
-
-`RE_NO_BK_VBAR'
- If this bit is set, then `|' represents the alternation operator;
- if this bit isn't set, then `\|' represents the alternation
- operator. This bit is irrelevant if `RE_LIMITED_OPS' is set.
-
-`RE_NO_EMPTY_RANGES'
- If this bit is set, then a regular expression with a range whose
- ending point collates lower than its starting point is invalid; if
- this bit isn't set, then Regex considers such a range to be empty.
-
-`RE_UNMATCHED_RIGHT_PAREN_ORD'
- If this bit is set and the regular expression has no matching
- open-group operator, then Regex considers what would otherwise be
- a close-group operator (based on how `RE_NO_BK_PARENS' is set) to
- match `)'.
-
-
-File: regex.info, Node: Predefined Syntaxes, Next: Collating Elements vs. Characters, Prev: Syntax Bits, Up: Regular Expression Syntax
-
-Predefined Syntaxes
-===================
-
- If you're programming with Regex, you can set a pattern buffer's
-(*note GNU Pattern Buffers::., and *Note POSIX Pattern Buffers::)
-`syntax' field either to an arbitrary combination of syntax bits (*note
-Syntax Bits::.) or else to the configurations defined by Regex. These
-configurations define the syntaxes used by certain programs--GNU Emacs,
-POSIX Awk, traditional Awk, Grep, Egrep--in addition to syntaxes for
-POSIX basic and extended regular expressions.
-
- The predefined syntaxes-taken directly from `regex.h'--are:
-
- #define RE_SYNTAX_EMACS 0
-
- #define RE_SYNTAX_AWK \
- (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS \
- | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
- | RE_UNMATCHED_RIGHT_PAREN_ORD)
-
- #define RE_SYNTAX_POSIX_AWK \
- (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)
-
- #define RE_SYNTAX_GREP \
- (RE_BK_PLUS_QM | RE_CHAR_CLASSES \
- | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
- | RE_NEWLINE_ALT)
-
- #define RE_SYNTAX_EGREP \
- (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
- | RE_NEWLINE_ALT | RE_NO_BK_PARENS \
- | RE_NO_BK_VBAR)
-
- #define RE_SYNTAX_POSIX_EGREP \
- (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)
-
- /* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
- #define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
-
- #define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
-
- /* Syntax bits common to both basic and extended POSIX regex syntax. */
- #define _RE_SYNTAX_POSIX_COMMON \
- (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
- | RE_INTERVALS | RE_NO_EMPTY_RANGES)
-
- #define RE_SYNTAX_POSIX_BASIC \
- (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
-
- /* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
- RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
- isn't minimal, since other operators, such as \`, aren't disabled. */
- #define RE_SYNTAX_POSIX_MINIMAL_BASIC \
- (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
-
- #define RE_SYNTAX_POSIX_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_VBAR \
- | RE_UNMATCHED_RIGHT_PAREN_ORD)
-
- /* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS
- replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added. */
- #define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS \
- | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
-
-
-File: regex.info, Node: Collating Elements vs. Characters, Next: The Backslash Character, Prev: Predefined Syntaxes, Up: Regular Expression Syntax
-
-Collating Elements vs. Characters
-=================================
-
- POSIX generalizes the notion of a character to that of a collating
-element. It defines a "collating element" to be "a sequence of one or
-more bytes defined in the current collating sequence as a unit of
-collation."
-
- This generalizes the notion of a character in two ways. First, a
-single character can map into two or more collating elements. For
-example, the German "es-zet" collates as the collating element `s'
-followed by another collating element `s'. Second, two or more
-characters can map into one collating element. For example, the
-Spanish `ll' collates after `l' and before `m'.
-
- Since POSIX's "collating element" preserves the essential idea of a
-"character," we use the latter, more familiar, term in this document.
-
-
-File: regex.info, Node: The Backslash Character, Prev: Collating Elements vs. Characters, Up: Regular Expression Syntax
-
-The Backslash Character
-=======================
-
- The `\' character has one of four different meanings, depending on
-the context in which you use it and what syntax bits are set (*note
-Syntax Bits::.). It can: 1) stand for itself, 2) quote the next
-character, 3) introduce an operator, or 4) do nothing.
-
- 1. It stands for itself inside a list (*note List Operators::.) if
- the syntax bit `RE_BACKSLASH_ESCAPE_IN_LISTS' is not set. For
- example, `[\]' would match `\'.
-
- 2. It quotes (makes ordinary, if it's special) the next character
- when you use it either:
-
- * outside a list,(1) or
-
- * inside a list and the syntax bit
- `RE_BACKSLASH_ESCAPE_IN_LISTS' is set.
-
- 3. It introduces an operator when followed by certain ordinary
- characters--sometimes only when certain syntax bits are set. See
- the cases `RE_BK_PLUS_QM', `RE_NO_BK_BRACES', `RE_NO_BK_VAR',
- `RE_NO_BK_PARENS', `RE_NO_BK_REF' in *Note Syntax Bits::. Also:
-
- * `\b' represents the match-word-boundary operator (*note
- Match-word-boundary Operator::.).
-
- * `\B' represents the match-within-word operator (*note
- Match-within-word Operator::.).
-
- * `\<' represents the match-beginning-of-word operator
- (*note Match-beginning-of-word Operator::.).
-
- * `\>' represents the match-end-of-word operator (*note
- Match-end-of-word Operator::.).
-
- * `\w' represents the match-word-constituent operator (*note
- Match-word-constituent Operator::.).
-
- * `\W' represents the match-non-word-constituent operator
- (*note Match-non-word-constituent Operator::.).
-
- * `\`' represents the match-beginning-of-buffer operator and
- `\'' represents the match-end-of-buffer operator (*note
- Buffer Operators::.).
-
- * If Regex was compiled with the C preprocessor symbol `emacs'
- defined, then `\sCLASS' represents the match-syntactic-class
- operator and `\SCLASS' represents the
- match-not-syntactic-class operator (*note Syntactic Class
- Operators::.).
-
- 4. In all other cases, Regex ignores `\'. For example, `\n' matches
- `n'.
-
-
- ---------- Footnotes ----------
-
- (1) Sometimes you don't have to explicitly quote special characters
-to make them ordinary. For instance, most characters lose any special
-meaning inside a list (*note List Operators::.). In addition, if the
-syntax bits `RE_CONTEXT_INVALID_OPS' and `RE_CONTEXT_INDEP_OPS' aren't
-set, then (for historical reasons) the matcher considers special
-characters ordinary if they are in contexts where the operations they
-represent make no sense; for example, then the match-zero-or-more
-operator (represented by `*') matches itself in the regular expression
-`*foo' because there is no preceding expression on which it can
-operate. It is poor practice, however, to depend on this behavior; if
-you want a special character to be ordinary outside a list, it's better
-to always quote it, regardless.
-
-
-File: regex.info, Node: Common Operators, Next: GNU Operators, Prev: Regular Expression Syntax, Up: Top
-
-Common Operators
-****************
-
- You compose regular expressions from operators. In the following
-sections, we describe the regular expression operators specified by
-POSIX; GNU also uses these. Most operators have more than one
-representation as characters. *Note Regular Expression Syntax::, for
-what characters represent what operators under what circumstances.
-
- For most operators that can be represented in two ways, one
-representation is a single character and the other is that character
-preceded by `\'. For example, either `(' or `\(' represents the
-open-group operator. Which one does depends on the setting of a syntax
-bit, in this case `RE_NO_BK_PARENS'. Why is this so? Historical
-reasons dictate some of the varying representations, while POSIX
-dictates others.
-
- Finally, almost all characters lose any special meaning inside a list
-(*note List Operators::.).
-
-* Menu:
-
-* Match-self Operator:: Ordinary characters.
-* Match-any-character Operator:: .
-* Concatenation Operator:: Juxtaposition.
-* Repetition Operators:: * + ? {}
-* Alternation Operator:: |
-* List Operators:: [...] [^...]
-* Grouping Operators:: (...)
-* Back-reference Operator:: \digit
-* Anchoring Operators:: ^ $
-
-
-File: regex.info, Node: Match-self Operator, Next: Match-any-character Operator, Up: Common Operators
-
-The Match-self Operator (ORDINARY CHARACTER)
-============================================
-
- This operator matches the character itself. All ordinary characters
-(*note Regular Expression Syntax::.) represent this operator. For
-example, `f' is always an ordinary character, so the regular expression
-`f' matches only the string `f'. In particular, it does *not* match
-the string `ff'.
-
-
-File: regex.info, Node: Match-any-character Operator, Next: Concatenation Operator, Prev: Match-self Operator, Up: Common Operators
-
-The Match-any-character Operator (`.')
-======================================
-
- This operator matches any single printing or nonprinting character
-except it won't match a:
-
-newline
- if the syntax bit `RE_DOT_NEWLINE' isn't set.
-
-null
- if the syntax bit `RE_DOT_NOT_NULL' is set.
-
- The `.' (period) character represents this operator. For example,
-`a.b' matches any three-character string beginning with `a' and ending
-with `b'.
-
-
-File: regex.info, Node: Concatenation Operator, Next: Repetition Operators, Prev: Match-any-character Operator, Up: Common Operators
-
-The Concatenation Operator
-==========================
-
- This operator concatenates two regular expressions A and B. No
-character represents this operator; you simply put B after A. The
-result is a regular expression that will match a string if A matches
-its first part and B matches the rest. For example, `xy' (two
-match-self operators) matches `xy'.
-
-
-File: regex.info, Node: Repetition Operators, Next: Alternation Operator, Prev: Concatenation Operator, Up: Common Operators
-
-Repetition Operators
-====================
-
- Repetition operators repeat the preceding regular expression a
-specified number of times.
-
-* Menu:
-
-* Match-zero-or-more Operator:: *
-* Match-one-or-more Operator:: +
-* Match-zero-or-one Operator:: ?
-* Interval Operators:: {}
-
-
-File: regex.info, Node: Match-zero-or-more Operator, Next: Match-one-or-more Operator, Up: Repetition Operators
-
-The Match-zero-or-more Operator (`*')
--------------------------------------
-
- This operator repeats the smallest possible preceding regular
-expression as many times as necessary (including zero) to match the
-pattern. `*' represents this operator. For example, `o*' matches any
-string made up of zero or more `o's. Since this operator operates on
-the smallest preceding regular expression, `fo*' has a repeating `o',
-not a repeating `fo'. So, `fo*' matches `f', `fo', `foo', and so on.
-
- Since the match-zero-or-more operator is a suffix operator, it may be
-useless as such when no regular expression precedes it. This is the
-case when it:
-
- * is first in a regular expression, or
-
- * follows a match-beginning-of-line, open-group, or alternation
- operator.
-
-Three different things can happen in these cases:
-
- 1. If the syntax bit `RE_CONTEXT_INVALID_OPS' is set, then the
- regular expression is invalid.
-
- 2. If `RE_CONTEXT_INVALID_OPS' isn't set, but `RE_CONTEXT_INDEP_OPS'
- is, then `*' represents the match-zero-or-more operator (which
- then operates on the empty string).
-
- 3. Otherwise, `*' is ordinary.
-
-
- The matcher processes a match-zero-or-more operator by first matching
-as many repetitions of the smallest preceding regular expression as it
-can. Then it continues to match the rest of the pattern.
-
- If it can't match the rest of the pattern, it backtracks (as many
-times as necessary), each time discarding one of the matches until it
-can either match the entire pattern or be certain that it cannot get a
-match. For example, when matching `ca*ar' against `caaar', the matcher
-first matches all three `a's of the string with the `a*' of the regular
-expression. However, it cannot then match the final `ar' of the
-regular expression against the final `r' of the string. So it
-backtracks, discarding the match of the last `a' in the string. It can
-then match the remaining `ar'.
-
-
-File: regex.info, Node: Match-one-or-more Operator, Next: Match-zero-or-one Operator, Prev: Match-zero-or-more Operator, Up: Repetition Operators
-
-The Match-one-or-more Operator (`+' or `\+')
---------------------------------------------
-
- If the syntax bit `RE_LIMITED_OPS' is set, then Regex doesn't
-recognize this operator. Otherwise, if the syntax bit `RE_BK_PLUS_QM'
-isn't set, then `+' represents this operator; if it is, then `\+' does.
-
- This operator is similar to the match-zero-or-more operator except
-that it repeats the preceding regular expression at least once; *note
-Match-zero-or-more Operator::., for what it operates on, how some
-syntax bits affect it, and how Regex backtracks to match it.
-
- For example, supposing that `+' represents the match-one-or-more
-operator; then `ca+r' matches, e.g., `car' and `caaaar', but not `cr'.
-
-
-File: regex.info, Node: Match-zero-or-one Operator, Next: Interval Operators, Prev: Match-one-or-more Operator, Up: Repetition Operators
-
-The Match-zero-or-one Operator (`?' or `\?')
---------------------------------------------
-
- If the syntax bit `RE_LIMITED_OPS' is set, then Regex doesn't
-recognize this operator. Otherwise, if the syntax bit `RE_BK_PLUS_QM'
-isn't set, then `?' represents this operator; if it is, then `\?' does.
-
- This operator is similar to the match-zero-or-more operator except
-that it repeats the preceding regular expression once or not at all;
-*note Match-zero-or-more Operator::., to see what it operates on, how
-some syntax bits affect it, and how Regex backtracks to match it.
-
- For example, supposing that `?' represents the match-zero-or-one
-operator; then `ca?r' matches both `car' and `cr', but nothing else.
-
-
-File: regex.info, Node: Interval Operators, Prev: Match-zero-or-one Operator, Up: Repetition Operators
-
-Interval Operators (`{' ... `}' or `\{' ... `\}')
--------------------------------------------------
-
- If the syntax bit `RE_INTERVALS' is set, then Regex recognizes
-"interval expressions". They repeat the smallest possible preceding
-regular expression a specified number of times.
-
- If the syntax bit `RE_NO_BK_BRACES' is set, `{' represents the
-"open-interval operator" and `}' represents the "close-interval
-operator" ; otherwise, `\{' and `\}' do.
-
- Specifically, supposing that `{' and `}' represent the open-interval
-and close-interval operators; then:
-
-`{COUNT}'
- matches exactly COUNT occurrences of the preceding regular
- expression.
-
-`{MIN,}'
- matches MIN or more occurrences of the preceding regular
- expression.
-
-`{MIN, MAX}'
- matches at least MIN but no more than MAX occurrences of the
- preceding regular expression.
-
- The interval expression (but not necessarily the regular expression
-that contains it) is invalid if:
-
- * MIN is greater than MAX, or
-
- * any of COUNT, MIN, or MAX are outside the range zero to
- `RE_DUP_MAX' (which symbol `regex.h' defines).
-
- If the interval expression is invalid and the syntax bit
-`RE_NO_BK_BRACES' is set, then Regex considers all the characters in
-the would-be interval to be ordinary. If that bit isn't set, then the
-regular expression is invalid.
-
- If the interval expression is valid but there is no preceding regular
-expression on which to operate, then if the syntax bit
-`RE_CONTEXT_INVALID_OPS' is set, the regular expression is invalid. If
-that bit isn't set, then Regex considers all the characters--other than
-backslashes, which it ignores--in the would-be interval to be ordinary.
-
-
-File: regex.info, Node: Alternation Operator, Next: List Operators, Prev: Repetition Operators, Up: Common Operators
-
-The Alternation Operator (`|' or `\|')
-======================================
-
- If the syntax bit `RE_LIMITED_OPS' is set, then Regex doesn't
-recognize this operator. Otherwise, if the syntax bit `RE_NO_BK_VBAR'
-is set, then `|' represents this operator; otherwise, `\|' does.
-
- Alternatives match one of a choice of regular expressions: if you put
-the character(s) representing the alternation operator between any two
-regular expressions A and B, the result matches the union of the
-strings that A and B match. For example, supposing that `|' is the
-alternation operator, then `foo|bar|quux' would match any of `foo',
-`bar' or `quux'.
-
- The alternation operator operates on the *largest* possible
-surrounding regular expressions. (Put another way, it has the lowest
-precedence of any regular expression operator.) Thus, the only way you
-can delimit its arguments is to use grouping. For example, if `(' and
-`)' are the open and close-group operators, then `fo(o|b)ar' would
-match either `fooar' or `fobar'. (`foo|bar' would match `foo' or
-`bar'.)
-
- The matcher usually tries all combinations of alternatives so as to
-match the longest possible string. For example, when matching
-`(fooq|foo)*(qbarquux|bar)' against `fooqbarquux', it cannot take, say,
-the first ("depth-first") combination it could match, since then it
-would be content to match just `fooqbar'.
-
-
-File: regex.info, Node: List Operators, Next: Grouping Operators, Prev: Alternation Operator, Up: Common Operators
-
-List Operators (`[' ... `]' and `[^' ... `]')
-=============================================
-
- "Lists", also called "bracket expressions", are a set of one or more
-items. An "item" is a character, a character class expression, or a
-range expression. The syntax bits affect which kinds of items you can
-put in a list. We explain the last two items in subsections below.
-Empty lists are invalid.
-
- A "matching list" matches a single character represented by one of
-the list items. You form a matching list by enclosing one or more items
-within an "open-matching-list operator" (represented by `[') and a
-"close-list operator" (represented by `]').
-
- For example, `[ab]' matches either `a' or `b'. `[ad]*' matches the
-empty string and any string composed of just `a's and `d's in any
-order. Regex considers invalid a regular expression with a `[' but no
-matching `]'.
-
- "Nonmatching lists" are similar to matching lists except that they
-match a single character *not* represented by one of the list items.
-You use an "open-nonmatching-list operator" (represented by `[^'(1))
-instead of an open-matching-list operator to start a nonmatching list.
-
- For example, `[^ab]' matches any character except `a' or `b'.
-
- If the `posix_newline' field in the pattern buffer (*note GNU Pattern
-Buffers::. is set, then nonmatching lists do not match a newline.
-
- Most characters lose any special meaning inside a list. The special
-characters inside a list follow.
-
-`]'
- ends the list if it's not the first list item. So, if you want to
- make the `]' character a list item, you must put it first.
-
-`\'
- quotes the next character if the syntax bit
- `RE_BACKSLASH_ESCAPE_IN_LISTS' is set.
-
-`[:'
- represents the open-character-class operator (*note Character
- Class Operators::.) if the syntax bit `RE_CHAR_CLASSES' is set and
- what follows is a valid character class expression.
-
-`:]'
- represents the close-character-class operator if the syntax bit
- `RE_CHAR_CLASSES' is set and what precedes it is an
- open-character-class operator followed by a valid character class
- name.
-
-`-'
- represents the range operator (*note Range Operator::.) if it's
- not first or last in a list or the ending point of a range.
-
-All other characters are ordinary. For example, `[.*]' matches `.' and
-`*'.
-
-* Menu:
-
-* Character Class Operators:: [:class:]
-* Range Operator:: start-end
-
- ---------- Footnotes ----------
-
- (1) Regex therefore doesn't consider the `^' to be the first
-character in the list. If you put a `^' character first in (what you
-think is) a matching list, you'll turn it into a nonmatching list.
-
-
-File: regex.info, Node: Character Class Operators, Next: Range Operator, Up: List Operators
-
-Character Class Operators (`[:' ... `:]')
------------------------------------------
-
- If the syntax bit `RE_CHARACTER_CLASSES' is set, then Regex
-recognizes character class expressions inside lists. A "character
-class expression" matches one character from a given class. You form a
-character class expression by putting a character class name between an
-"open-character-class operator" (represented by `[:') and a
-"close-character-class operator" (represented by `:]'). The character
-class names and their meanings are:
-
-`alnum'
- letters and digits
-
-`alpha'
- letters
-
-`blank'
- system-dependent; for GNU, a space or tab
-
-`cntrl'
- control characters (in the ASCII encoding, code 0177 and codes
- less than 040)
-
-`digit'
- digits
-
-`graph'
- same as `print' except omits space
-
-`lower'
- lowercase letters
-
-`print'
- printable characters (in the ASCII encoding, space tilde--codes
- 040 through 0176)
-
-`punct'
- neither control nor alphanumeric characters
-
-`space'
- space, carriage return, newline, vertical tab, and form feed
-
-`upper'
- uppercase letters
-
-`xdigit'
- hexadecimal digits: `0'-`9', `a'-`f', `A'-`F'
-
-These correspond to the definitions in the C library's `<ctype.h>'
-facility. For example, `[:alpha:]' corresponds to the standard
-facility `isalpha'. Regex recognizes character class expressions only
-inside of lists; so `[[:alpha:]]' matches any letter, but `[:alpha:]'
-outside of a bracket expression and not followed by a repetition
-operator matches just itself.
-
-
-File: regex.info, Node: Range Operator, Prev: Character Class Operators, Up: List Operators
-
-The Range Operator (`-')
-------------------------
-
- Regex recognizes "range expressions" inside a list. They represent
-those characters that fall between two elements in the current
-collating sequence. You form a range expression by putting a "range
-operator" between two characters.(1) `-' represents the range operator.
-For example, `a-f' within a list represents all the characters from `a'
-through `f' inclusively.
-
- If the syntax bit `RE_NO_EMPTY_RANGES' is set, then if the range's
-ending point collates less than its starting point, the range (and the
-regular expression containing it) is invalid. For example, the regular
-expression `[z-a]' would be invalid. If this bit isn't set, then Regex
-considers such a range to be empty.
-
- Since `-' represents the range operator, if you want to make a `-'
-character itself a list item, you must do one of the following:
-
- * Put the `-' either first or last in the list.
-
- * Include a range whose starting point collates strictly lower than
- `-' and whose ending point collates equal or higher. Unless a
- range is the first item in a list, a `-' can't be its starting
- point, but *can* be its ending point. That is because Regex
- considers `-' to be the range operator unless it is preceded by
- another `-'. For example, in the ASCII encoding, `)', `*', `+',
- `,', `-', `.', and `/' are contiguous characters in the collating
- sequence. You might think that `[)-+--/]' has two ranges: `)-+'
- and `--/'. Rather, it has the ranges `)-+' and `+--', plus the
- character `/', so it matches, e.g., `,', not `.'.
-
- * Put a range whose starting point is `-' first in the list.
-
- For example, `[-a-z]' matches a lowercase letter or a hyphen (in
-English, in ASCII).
-
- ---------- Footnotes ----------
-
- (1) You can't use a character class for the starting or ending point
-of a range, since a character class is not a single character.
-
-
-File: regex.info, Node: Grouping Operators, Next: Back-reference Operator, Prev: List Operators, Up: Common Operators
-
-Grouping Operators (`(' ... `)' or `\(' ... `\)')
-=================================================
-
- A "group", also known as a "subexpression", consists of an
-"open-group operator", any number of other operators, and a
-"close-group operator". Regex treats this sequence as a unit, just as
-mathematics and programming languages treat a parenthesized expression
-as a unit.
-
- Therefore, using "groups", you can:
-
- * delimit the argument(s) to an alternation operator (*note
- Alternation Operator::.) or a repetition operator (*note
- Repetition Operators::.).
-
- * keep track of the indices of the substring that matched a given
- group. *Note Using Registers::, for a precise explanation. This
- lets you:
-
- * use the back-reference operator (*note Back-reference
- Operator::.).
-
- * use registers (*note Using Registers::.).
-
- If the syntax bit `RE_NO_BK_PARENS' is set, then `(' represents the
-open-group operator and `)' represents the close-group operator;
-otherwise, `\(' and `\)' do.
-
- If the syntax bit `RE_UNMATCHED_RIGHT_PAREN_ORD' is set and a
-close-group operator has no matching open-group operator, then Regex
-considers it to match `)'.
-
-
-File: regex.info, Node: Back-reference Operator, Next: Anchoring Operators, Prev: Grouping Operators, Up: Common Operators
-
-The Back-reference Operator ("\"DIGIT)
-======================================
-
- If the syntax bit `RE_NO_BK_REF' isn't set, then Regex recognizes
-back references. A back reference matches a specified preceding group.
-The back reference operator is represented by `\DIGIT' anywhere after
-the end of a regular expression's DIGIT-th group (*note Grouping
-Operators::.).
-
- DIGIT must be between `1' and `9'. The matcher assigns numbers 1
-through 9 to the first nine groups it encounters. By using one of `\1'
-through `\9' after the corresponding group's close-group operator, you
-can match a substring identical to the one that the group does.
-
- Back references match according to the following (in all examples
-below, `(' represents the open-group, `)' the close-group, `{' the
-open-interval and `}' the close-interval operator):
-
- * If the group matches a substring, the back reference matches an
- identical substring. For example, `(a)\1' matches `aa' and
- `(bana)na\1bo\1' matches `bananabanabobana'. Likewise, `(.*)\1'
- matches any (newline-free if the syntax bit `RE_DOT_NEWLINE' isn't
- set) string that is composed of two identical halves; the `(.*)'
- matches the first half and the `\1' matches the second half.
-
- * If the group matches more than once (as it might if followed by,
- e.g., a repetition operator), then the back reference matches the
- substring the group *last* matched. For example, `((a*)b)*\1\2'
- matches `aabababa'; first group 1 (the outer one) matches `aab'
- and group 2 (the inner one) matches `aa'. Then group 1 matches
- `ab' and group 2 matches `a'. So, `\1' matches `ab' and `\2'
- matches `a'.
-
- * If the group doesn't participate in a match, i.e., it is part of an
- alternative not taken or a repetition operator allows zero
- repetitions of it, then the back reference makes the whole match
- fail. For example, `(one()|two())-and-(three\2|four\3)' matches
- `one-and-three' and `two-and-four', but not `one-and-four' or
- `two-and-three'. For example, if the pattern matches `one-and-',
- then its group 2 matches the empty string and its group 3 doesn't
- participate in the match. So, if it then matches `four', then
- when it tries to back reference group 3--which it will attempt to
- do because `\3' follows the `four'--the match will fail because
- group 3 didn't participate in the match.
-
- You can use a back reference as an argument to a repetition operator.
-For example, `(a(b))\2*' matches `a' followed by two or more `b's.
-Similarly, `(a(b))\2{3}' matches `abbbb'.
-
- If there is no preceding DIGIT-th subexpression, the regular
-expression is invalid.
-
-
-File: regex.info, Node: Anchoring Operators, Prev: Back-reference Operator, Up: Common Operators
-
-Anchoring Operators
-===================
-
- These operators can constrain a pattern to match only at the
-beginning or end of the entire string or at the beginning or end of a
-line.
-
-* Menu:
-
-* Match-beginning-of-line Operator:: ^
-* Match-end-of-line Operator:: $
-
-
-File: regex.info, Node: Match-beginning-of-line Operator, Next: Match-end-of-line Operator, Up: Anchoring Operators
-
-The Match-beginning-of-line Operator (`^')
-------------------------------------------
-
- This operator can match the empty string either at the beginning of
-the string or after a newline character. Thus, it is said to "anchor"
-the pattern to the beginning of a line.
-
- In the cases following, `^' represents this operator. (Otherwise,
-`^' is ordinary.)
-
- * It (the `^') is first in the pattern, as in `^foo'.
-
- * The syntax bit `RE_CONTEXT_INDEP_ANCHORS' is set, and it is outside
- a bracket expression.
-
- * It follows an open-group or alternation operator, as in `a\(^b\)'
- and `a\|^b'. *Note Grouping Operators::, and *Note Alternation
- Operator::.
-
- These rules imply that some valid patterns containing `^' cannot be
-matched; for example, `foo^bar' if `RE_CONTEXT_INDEP_ANCHORS' is set.
-
- If the `not_bol' field is set in the pattern buffer (*note GNU
-Pattern Buffers::.), then `^' fails to match at the beginning of the
-string. *Note POSIX Matching::, for when you might find this useful.
-
- If the `newline_anchor' field is set in the pattern buffer, then `^'
-fails to match after a newline. This is useful when you do not regard
-the string to be matched as broken into lines.
-
-
-File: regex.info, Node: Match-end-of-line Operator, Prev: Match-beginning-of-line Operator, Up: Anchoring Operators
-
-The Match-end-of-line Operator (`$')
-------------------------------------
-
- This operator can match the empty string either at the end of the
-string or before a newline character in the string. Thus, it is said
-to "anchor" the pattern to the end of a line.
-
- It is always represented by `$'. For example, `foo$' usually
-matches, e.g., `foo' and, e.g., the first three characters of
-`foo\nbar'.
-
- Its interaction with the syntax bits and pattern buffer fields is
-exactly the dual of `^''s; see the previous section. (That is,
-"beginning" becomes "end", "next" becomes "previous", and "after"
-becomes "before".)
-
-
-File: regex.info, Node: GNU Operators, Next: GNU Emacs Operators, Prev: Common Operators, Up: Top
-
-GNU Operators
-*************
-
- Following are operators that GNU defines (and POSIX doesn't).
-
-* Menu:
-
-* Word Operators::
-* Buffer Operators::
-
-
-File: regex.info, Node: Word Operators, Next: Buffer Operators, Up: GNU Operators
-
-Word Operators
-==============
-
- The operators in this section require Regex to recognize parts of
-words. Regex uses a syntax table to determine whether or not a
-character is part of a word, i.e., whether or not it is
-"word-constituent".
-
-* Menu:
-
-* Non-Emacs Syntax Tables::
-* Match-word-boundary Operator:: \b
-* Match-within-word Operator:: \B
-* Match-beginning-of-word Operator:: \<
-* Match-end-of-word Operator:: \>
-* Match-word-constituent Operator:: \w
-* Match-non-word-constituent Operator:: \W
-
-
-File: regex.info, Node: Non-Emacs Syntax Tables, Next: Match-word-boundary Operator, Up: Word Operators
-
-Non-Emacs Syntax Tables
------------------------
-
- A "syntax table" is an array indexed by the characters in your
-character set. In the ASCII encoding, therefore, a syntax table has
-256 elements. Regex always uses a `char *' variable `re_syntax_table'
-as its syntax table. In some cases, it initializes this variable and
-in others it expects you to initialize it.
-
- * If Regex is compiled with the preprocessor symbols `emacs' and
- `SYNTAX_TABLE' both undefined, then Regex allocates
- `re_syntax_table' and initializes an element I either to `Sword'
- (which it defines) if I is a letter, number, or `_', or to zero if
- it's not.
-
- * If Regex is compiled with `emacs' undefined but `SYNTAX_TABLE'
- defined, then Regex expects you to define a `char *' variable
- `re_syntax_table' to be a valid syntax table.
-
- * *Note Emacs Syntax Tables::, for what happens when Regex is
- compiled with the preprocessor symbol `emacs' defined.
-
-
-File: regex.info, Node: Match-word-boundary Operator, Next: Match-within-word Operator, Prev: Non-Emacs Syntax Tables, Up: Word Operators
-
-The Match-word-boundary Operator (`\b')
----------------------------------------
-
- This operator (represented by `\b') matches the empty string at
-either the beginning or the end of a word. For example, `\brat\b'
-matches the separate word `rat'.
-
-
-File: regex.info, Node: Match-within-word Operator, Next: Match-beginning-of-word Operator, Prev: Match-word-boundary Operator, Up: Word Operators
-
-The Match-within-word Operator (`\B')
--------------------------------------
-
- This operator (represented by `\B') matches the empty string within a
-word. For example, `c\Brat\Be' matches `crate', but `dirty \Brat'
-doesn't match `dirty rat'.
-
-
-File: regex.info, Node: Match-beginning-of-word Operator, Next: Match-end-of-word Operator, Prev: Match-within-word Operator, Up: Word Operators
-
-The Match-beginning-of-word Operator (`\<')
--------------------------------------------
-
- This operator (represented by `\<') matches the empty string at the
-beginning of a word.
-
-
-File: regex.info, Node: Match-end-of-word Operator, Next: Match-word-constituent Operator, Prev: Match-beginning-of-word Operator, Up: Word Operators
-
-The Match-end-of-word Operator (`\>')
--------------------------------------
-
- This operator (represented by `\>') matches the empty string at the
-end of a word.
-
-
-File: regex.info, Node: Match-word-constituent Operator, Next: Match-non-word-constituent Operator, Prev: Match-end-of-word Operator, Up: Word Operators
-
-The Match-word-constituent Operator (`\w')
-------------------------------------------
-
- This operator (represented by `\w') matches any word-constituent
-character.
-
-
-File: regex.info, Node: Match-non-word-constituent Operator, Prev: Match-word-constituent Operator, Up: Word Operators
-
-The Match-non-word-constituent Operator (`\W')
-----------------------------------------------
-
- This operator (represented by `\W') matches any character that is not
-word-constituent.
-
-
-File: regex.info, Node: Buffer Operators, Prev: Word Operators, Up: GNU Operators
-
-Buffer Operators
-================
-
- Following are operators which work on buffers. In Emacs, a "buffer"
-is, naturally, an Emacs buffer. For other programs, Regex considers the
-entire string to be matched as the buffer.
-
-* Menu:
-
-* Match-beginning-of-buffer Operator:: \`
-* Match-end-of-buffer Operator:: \'
-
-
-File: regex.info, Node: Match-beginning-of-buffer Operator, Next: Match-end-of-buffer Operator, Up: Buffer Operators
-
-The Match-beginning-of-buffer Operator (`\`')
----------------------------------------------
-
- This operator (represented by `\`') matches the empty string at the
-beginning of the buffer.
-
-
-File: regex.info, Node: Match-end-of-buffer Operator, Prev: Match-beginning-of-buffer Operator, Up: Buffer Operators
-
-The Match-end-of-buffer Operator (`\'')
----------------------------------------
-
- This operator (represented by `\'') matches the empty string at the
-end of the buffer.
-
-
-File: regex.info, Node: GNU Emacs Operators, Next: What Gets Matched?, Prev: GNU Operators, Up: Top
-
-GNU Emacs Operators
-*******************
-
- Following are operators that GNU defines (and POSIX doesn't) that you
-can use only when Regex is compiled with the preprocessor symbol
-`emacs' defined.
-
-* Menu:
-
-* Syntactic Class Operators::
-
-
-File: regex.info, Node: Syntactic Class Operators, Up: GNU Emacs Operators
-
-Syntactic Class Operators
-=========================
-
- The operators in this section require Regex to recognize the syntactic
-classes of characters. Regex uses a syntax table to determine this.
-
-* Menu:
-
-* Emacs Syntax Tables::
-* Match-syntactic-class Operator:: \sCLASS
-* Match-not-syntactic-class Operator:: \SCLASS
-
-
-File: regex.info, Node: Emacs Syntax Tables, Next: Match-syntactic-class Operator, Up: Syntactic Class Operators
-
-Emacs Syntax Tables
--------------------
-
- A "syntax table" is an array indexed by the characters in your
-character set. In the ASCII encoding, therefore, a syntax table has
-256 elements.
-
- If Regex is compiled with the preprocessor symbol `emacs' defined,
-then Regex expects you to define and initialize the variable
-`re_syntax_table' to be an Emacs syntax table. Emacs' syntax tables
-are more complicated than Regex's own (*note Non-Emacs Syntax
-Tables::.). *Note Syntax: (emacs)Syntax, for a description of Emacs'
-syntax tables.
-
-
-File: regex.info, Node: Match-syntactic-class Operator, Next: Match-not-syntactic-class Operator, Prev: Emacs Syntax Tables, Up: Syntactic Class Operators
-
-The Match-syntactic-class Operator (`\s'CLASS)
-----------------------------------------------
-
- This operator matches any character whose syntactic class is
-represented by a specified character. `\sCLASS' represents this
-operator where CLASS is the character representing the syntactic class
-you want. For example, `w' represents the syntactic class of
-word-constituent characters, so `\sw' matches any word-constituent
-character.
-
-
-File: regex.info, Node: Match-not-syntactic-class Operator, Prev: Match-syntactic-class Operator, Up: Syntactic Class Operators
-
-The Match-not-syntactic-class Operator (`\S'CLASS)
---------------------------------------------------
-
- This operator is similar to the match-syntactic-class operator except
-that it matches any character whose syntactic class is *not*
-represented by the specified character. `\SCLASS' represents this
-operator. For example, `w' represents the syntactic class of
-word-constituent characters, so `\Sw' matches any character that is not
-word-constituent.
-
-
-File: regex.info, Node: What Gets Matched?, Next: Programming with Regex, Prev: GNU Emacs Operators, Up: Top
-
-What Gets Matched?
-******************
-
- Regex usually matches strings according to the "leftmost longest"
-rule; that is, it chooses the longest of the leftmost matches. This
-does not mean that for a regular expression containing subexpressions
-that it simply chooses the longest match for each subexpression, left to
-right; the overall match must also be the longest possible one.
-
- For example, `(ac*)(c*d[ac]*)\1' matches `acdacaaa', not `acdac', as
-it would if it were to choose the longest match for the first
-subexpression.
-
-
-File: regex.info, Node: Programming with Regex, Next: Copying, Prev: What Gets Matched?, Up: Top
-
-Programming with Regex
-**********************
-
- Here we describe how you use the Regex data structures and functions
-in C programs. Regex has three interfaces: one designed for GNU, one
-compatible with POSIX and one compatible with Berkeley UNIX.
-
-* Menu:
-
-* GNU Regex Functions::
-* POSIX Regex Functions::
-* BSD Regex Functions::
-
-
-File: regex.info, Node: GNU Regex Functions, Next: POSIX Regex Functions, Up: Programming with Regex
-
-GNU Regex Functions
-===================
-
- If you're writing code that doesn't need to be compatible with either
-POSIX or Berkeley UNIX, you can use these functions. They provide more
-options than the other interfaces.
-
-* Menu:
-
-* GNU Pattern Buffers:: The re_pattern_buffer type.
-* GNU Regular Expression Compiling:: re_compile_pattern ()
-* GNU Matching:: re_match ()
-* GNU Searching:: re_search ()
-* Matching/Searching with Split Data:: re_match_2 (), re_search_2 ()
-* Searching with Fastmaps:: re_compile_fastmap ()
-* GNU Translate Tables:: The `translate' field.
-* Using Registers:: The re_registers type and related fns.
-* Freeing GNU Pattern Buffers:: regfree ()
-
-
-File: regex.info, Node: GNU Pattern Buffers, Next: GNU Regular Expression Compiling, Up: GNU Regex Functions
-
-GNU Pattern Buffers
--------------------
-
- To compile, match, or search for a given regular expression, you must
-supply a pattern buffer. A "pattern buffer" holds one compiled regular
-expression.(1)
-
- You can have several different pattern buffers simultaneously, each
-holding a compiled pattern for a different regular expression.
-
- `regex.h' defines the pattern buffer `struct' as follows:
-
- /* Space that holds the compiled pattern. It is declared as
- `unsigned char *' because its elements are
- sometimes used as array indexes. */
- unsigned char *buffer;
-
- /* Number of bytes to which `buffer' points. */
- unsigned long allocated;
-
- /* Number of bytes actually used in `buffer'. */
- unsigned long used;
-
- /* Syntax setting with which the pattern was compiled. */
- reg_syntax_t syntax;
-
- /* Pointer to a fastmap, if any, otherwise zero. re_search uses
- the fastmap, if there is one, to skip over impossible
- starting points for matches. */
- char *fastmap;
-
- /* Either a translate table to apply to all characters before
- comparing them, or zero for no translation. The translation
- is applied to a pattern when it is compiled and to a string
- when it is matched. */
- char *translate;
-
- /* Number of subexpressions found by the compiler. */
- size_t re_nsub;
-
- /* Zero if this pattern cannot match the empty string, one else.
- Well, in truth it's used only in `re_search_2', to see
- whether or not we should use the fastmap, so we don't set
- this absolutely perfectly; see `re_compile_fastmap' (the
- `duplicate' case). */
- unsigned can_be_null : 1;
-
- /* If REGS_UNALLOCATED, allocate space in the `regs' structure
- for `max (RE_NREGS, re_nsub + 1)' groups.
- If REGS_REALLOCATE, reallocate space if necessary.
- If REGS_FIXED, use what's there. */
- #define REGS_UNALLOCATED 0
- #define REGS_REALLOCATE 1
- #define REGS_FIXED 2
- unsigned regs_allocated : 2;
-
- /* Set to zero when `regex_compile' compiles a pattern; set to one
- by `re_compile_fastmap' if it updates the fastmap. */
- unsigned fastmap_accurate : 1;
-
- /* If set, `re_match_2' does not return information about
- subexpressions. */
- unsigned no_sub : 1;
-
- /* If set, a beginning-of-line anchor doesn't match at the
- beginning of the string. */
- unsigned not_bol : 1;
-
- /* Similarly for an end-of-line anchor. */
- unsigned not_eol : 1;
-
- /* If true, an anchor at a newline matches. */
- unsigned newline_anchor : 1;
-
- ---------- Footnotes ----------
-
- (1) Regular expressions are also referred to as "patterns," hence
-the name "pattern buffer."
-
-
-File: regex.info, Node: GNU Regular Expression Compiling, Next: GNU Matching, Prev: GNU Pattern Buffers, Up: GNU Regex Functions
-
-GNU Regular Expression Compiling
---------------------------------
-
- In GNU, you can both match and search for a given regular expression.
-To do either, you must first compile it in a pattern buffer (*note GNU
-Pattern Buffers::.).
-
- Regular expressions match according to the syntax with which they were
-compiled; with GNU, you indicate what syntax you want by setting the
-variable `re_syntax_options' (declared in `regex.h' and defined in
-`regex.c') before calling the compiling function, `re_compile_pattern'
-(see below). *Note Syntax Bits::, and *Note Predefined Syntaxes::.
-
- You can change the value of `re_syntax_options' at any time.
-Usually, however, you set its value once and then never change it.
-
- `re_compile_pattern' takes a pattern buffer as an argument. You must
-initialize the following fields:
-
-`translate initialization'
-`translate'
- Initialize this to point to a translate table if you want one, or
- to zero if you don't. We explain translate tables in *Note GNU
- Translate Tables::.
-
-`fastmap'
- Initialize this to nonzero if you want a fastmap, or to zero if you
- don't.
-
-`buffer'
-`allocated'
- If you want `re_compile_pattern' to allocate memory for the
- compiled pattern, set both of these to zero. If you have an
- existing block of memory (allocated with `malloc') you want Regex
- to use, set `buffer' to its address and `allocated' to its size (in
- bytes).
-
- `re_compile_pattern' uses `realloc' to extend the space for the
- compiled pattern as necessary.
-
- To compile a pattern buffer, use:
-
- char *
- re_compile_pattern (const char *REGEX, const int REGEX_SIZE,
- struct re_pattern_buffer *PATTERN_BUFFER)
-
-REGEX is the regular expression's address, REGEX_SIZE is its length,
-and PATTERN_BUFFER is the pattern buffer's address.
-
- If `re_compile_pattern' successfully compiles the regular expression,
-it returns zero and sets `*PATTERN_BUFFER' to the compiled pattern. It
-sets the pattern buffer's fields as follows:
-
-`buffer'
- to the compiled pattern.
-
-`used'
- to the number of bytes the compiled pattern in `buffer' occupies.
-
-`syntax'
- to the current value of `re_syntax_options'.
-
-`re_nsub'
- to the number of subexpressions in REGEX.
-
-`fastmap_accurate'
- to zero on the theory that the pattern you're compiling is
- different than the one previously compiled into `buffer'; in that
- case (since you can't make a fastmap without a compiled pattern),
- `fastmap' would either contain an incompatible fastmap, or nothing
- at all.
-
- If `re_compile_pattern' can't compile REGEX, it returns an error
-string corresponding to one of the errors listed in *Note POSIX Regular
-Expression Compiling::.
-
-
-File: regex.info, Node: GNU Matching, Next: GNU Searching, Prev: GNU Regular Expression Compiling, Up: GNU Regex Functions
-
-GNU Matching
-------------
-
- Matching the GNU way means trying to match as much of a string as
-possible starting at a position within it you specify. Once you've
-compiled a pattern into a pattern buffer (*note GNU Regular Expression
-Compiling::.), you can ask the matcher to match that pattern against a
-string using:
-
- int
- re_match (struct re_pattern_buffer *PATTERN_BUFFER,
- const char *STRING, const int SIZE,
- const int START, struct re_registers *REGS)
-
-PATTERN_BUFFER is the address of a pattern buffer containing a compiled
-pattern. STRING is the string you want to match; it can contain
-newline and null characters. SIZE is the length of that string. START
-is the string index at which you want to begin matching; the first
-character of STRING is at index zero. *Note Using Registers::, for a
-explanation of REGS; you can safely pass zero.
-
- `re_match' matches the regular expression in PATTERN_BUFFER against
-the string STRING according to the syntax in PATTERN_BUFFERS's `syntax'
-field. (*Note GNU Regular Expression Compiling::, for how to set it.)
-The function returns -1 if the compiled pattern does not match any part
-of STRING and -2 if an internal error happens; otherwise, it returns
-how many (possibly zero) characters of STRING the pattern matched.
-
- An example: suppose PATTERN_BUFFER points to a pattern buffer
-containing the compiled pattern for `a*', and STRING points to `aaaaab'
-(whereupon SIZE should be 6). Then if START is 2, `re_match' returns 3,
-i.e., `a*' would have matched the last three `a's in STRING. If START
-is 0, `re_match' returns 5, i.e., `a*' would have matched all the `a's
-in STRING. If START is either 5 or 6, it returns zero.
-
- If START is not between zero and SIZE, then `re_match' returns -1.
-
-
-File: regex.info, Node: GNU Searching, Next: Matching/Searching with Split Data, Prev: GNU Matching, Up: GNU Regex Functions
-
-GNU Searching
--------------
-
- "Searching" means trying to match starting at successive positions
-within a string. The function `re_search' does this.
-
- Before calling `re_search', you must compile your regular expression.
-*Note GNU Regular Expression Compiling::.
-
- Here is the function declaration:
-
- int
- re_search (struct re_pattern_buffer *PATTERN_BUFFER,
- const char *STRING, const int SIZE,
- const int START, const int RANGE,
- struct re_registers *REGS)
-
-whose arguments are the same as those to `re_match' (*note GNU
-Matching::.) except that the two arguments START and RANGE replace
-`re_match''s argument START.
-
- If RANGE is positive, then `re_search' attempts a match starting
-first at index START, then at START + 1 if that fails, and so on, up to
-START + RANGE; if RANGE is negative, then it attempts a match starting
-first at index START, then at START -1 if that fails, and so on.
-
- If START is not between zero and SIZE, then `re_search' returns -1.
-When RANGE is positive, `re_search' adjusts RANGE so that START + RANGE
-- 1 is between zero and SIZE, if necessary; that way it won't search
-outside of STRING. Similarly, when RANGE is negative, `re_search'
-adjusts RANGE so that START + RANGE + 1 is between zero and SIZE, if
-necessary.
-
- If the `fastmap' field of PATTERN_BUFFER is zero, `re_search' matches
-starting at consecutive positions; otherwise, it uses `fastmap' to make
-the search more efficient. *Note Searching with Fastmaps::.
-
- If no match is found, `re_search' returns -1. If a match is found,
-it returns the index where the match began. If an internal error
-happens, it returns -2.
-
-
-File: regex.info, Node: Matching/Searching with Split Data, Next: Searching with Fastmaps, Prev: GNU Searching, Up: GNU Regex Functions
-
-Matching and Searching with Split Data
---------------------------------------
-
- Using the functions `re_match_2' and `re_search_2', you can match or
-search in data that is divided into two strings.
-
- The function:
-
- int
- re_match_2 (struct re_pattern_buffer *BUFFER,
- const char *STRING1, const int SIZE1,
- const char *STRING2, const int SIZE2,
- const int START,
- struct re_registers *REGS,
- const int STOP)
-
-is similar to `re_match' (*note GNU Matching::.) except that you pass
-*two* data strings and sizes, and an index STOP beyond which you don't
-want the matcher to try matching. As with `re_match', if it succeeds,
-`re_match_2' returns how many characters of STRING it matched. Regard
-STRING1 and STRING2 as concatenated when you set the arguments START and
-STOP and use the contents of REGS; `re_match_2' never returns a value
-larger than SIZE1 + SIZE2.
-
- The function:
-
- int
- re_search_2 (struct re_pattern_buffer *BUFFER,
- const char *STRING1, const int SIZE1,
- const char *STRING2, const int SIZE2,
- const int START, const int RANGE,
- struct re_registers *REGS,
- const int STOP)
-
-is similarly related to `re_search'.
-
-
-File: regex.info, Node: Searching with Fastmaps, Next: GNU Translate Tables, Prev: Matching/Searching with Split Data, Up: GNU Regex Functions
-
-Searching with Fastmaps
------------------------
-
- If you're searching through a long string, you should use a fastmap.
-Without one, the searcher tries to match at consecutive positions in the
-string. Generally, most of the characters in the string could not start
-a match. It takes much longer to try matching at a given position in
-the string than it does to check in a table whether or not the
-character at that position could start a match. A "fastmap" is such a
-table.
-
- More specifically, a fastmap is an array indexed by the characters in
-your character set. Under the ASCII encoding, therefore, a fastmap has
-256 elements. If you want the searcher to use a fastmap with a given
-pattern buffer, you must allocate the array and assign the array's
-address to the pattern buffer's `fastmap' field. You either can
-compile the fastmap yourself or have `re_search' do it for you; when
-`fastmap' is nonzero, it automatically compiles a fastmap the first
-time you search using a particular compiled pattern.
-
- To compile a fastmap yourself, use:
-
- int
- re_compile_fastmap (struct re_pattern_buffer *PATTERN_BUFFER)
-
-PATTERN_BUFFER is the address of a pattern buffer. If the character C
-could start a match for the pattern, `re_compile_fastmap' makes
-`PATTERN_BUFFER->fastmap[C]' nonzero. It returns 0 if it can compile a
-fastmap and -2 if there is an internal error. For example, if `|' is
-the alternation operator and PATTERN_BUFFER holds the compiled pattern
-for `a|b', then `re_compile_fastmap' sets `fastmap['a']' and
-`fastmap['b']' (and no others).
-
- `re_search' uses a fastmap as it moves along in the string: it checks
-the string's characters until it finds one that's in the fastmap. Then
-it tries matching at that character. If the match fails, it repeats
-the process. So, by using a fastmap, `re_search' doesn't waste time
-trying to match at positions in the string that couldn't start a match.
-
- If you don't want `re_search' to use a fastmap, store zero in the
-`fastmap' field of the pattern buffer before calling `re_search'.
-
- Once you've initialized a pattern buffer's `fastmap' field, you need
-never do so again--even if you compile a new pattern in it--provided
-the way the field is set still reflects whether or not you want a
-fastmap. `re_search' will still either do nothing if `fastmap' is null
-or, if it isn't, compile a new fastmap for the new pattern.
-
-
-File: regex.info, Node: GNU Translate Tables, Next: Using Registers, Prev: Searching with Fastmaps, Up: GNU Regex Functions
-
-GNU Translate Tables
---------------------
-
- If you set the `translate' field of a pattern buffer to a translate
-table, then the GNU Regex functions to which you've passed that pattern
-buffer use it to apply a simple transformation to all the regular
-expression and string characters at which they look.
-
- A "translate table" is an array indexed by the characters in your
-character set. Under the ASCII encoding, therefore, a translate table
-has 256 elements. The array's elements are also characters in your
-character set. When the Regex functions see a character C, they use
-`translate[C]' in its place, with one exception: the character after a
-`\' is not translated. (This ensures that, the operators, e.g., `\B'
-and `\b', are always distinguishable.)
-
- For example, a table that maps all lowercase letters to the
-corresponding uppercase ones would cause the matcher to ignore
-differences in case.(1) Such a table would map all characters except
-lowercase letters to themselves, and lowercase letters to the
-corresponding uppercase ones. Under the ASCII encoding, here's how you
-could initialize such a table (we'll call it `case_fold'):
-
- for (i = 0; i < 256; i++)
- case_fold[i] = i;
- for (i = 'a'; i <= 'z'; i++)
- case_fold[i] = i - ('a' - 'A');
-
- You tell Regex to use a translate table on a given pattern buffer by
-assigning that table's address to the `translate' field of that buffer.
-If you don't want Regex to do any translation, put zero into this
-field. You'll get weird results if you change the table's contents
-anytime between compiling the pattern buffer, compiling its fastmap, and
-matching or searching with the pattern buffer.
-
- ---------- Footnotes ----------
-
- (1) A table that maps all uppercase letters to the corresponding
-lowercase ones would work just as well for this purpose.
-
-
-File: regex.info, Node: Using Registers, Next: Freeing GNU Pattern Buffers, Prev: GNU Translate Tables, Up: GNU Regex Functions
-
-Using Registers
----------------
-
- A group in a regular expression can match a (posssibly empty)
-substring of the string that regular expression as a whole matched.
-The matcher remembers the beginning and end of the substring matched by
-each group.
-
- To find out what they matched, pass a nonzero REGS argument to a GNU
-matching or searching function (*note GNU Matching::. and *Note GNU
-Searching::), i.e., the address of a structure of this type, as defined
-in `regex.h':
-
- struct re_registers
- {
- unsigned num_regs;
- regoff_t *start;
- regoff_t *end;
- };
-
- Except for (possibly) the NUM_REGS'th element (see below), the Ith
-element of the `start' and `end' arrays records information about the
-Ith group in the pattern. (They're declared as C pointers, but this is
-only because not all C compilers accept zero-length arrays;
-conceptually, it is simplest to think of them as arrays.)
-
- The `start' and `end' arrays are allocated in various ways, depending
-on the value of the `regs_allocated' field in the pattern buffer passed
-to the matcher.
-
- The simplest and perhaps most useful is to let the matcher
-(re)allocate enough space to record information for all the groups in
-the regular expression. If `regs_allocated' is `REGS_UNALLOCATED', the
-matcher allocates 1 + RE_NSUB (another field in the pattern buffer;
-*note GNU Pattern Buffers::.). The extra element is set to -1, and
-sets `regs_allocated' to `REGS_REALLOCATE'. Then on subsequent calls
-with the same pattern buffer and REGS arguments, the matcher
-reallocates more space if necessary.
-
- It would perhaps be more logical to make the `regs_allocated' field
-part of the `re_registers' structure, instead of part of the pattern
-buffer. But in that case the caller would be forced to initialize the
-structure before passing it. Much existing code doesn't do this
-initialization, and it's arguably better to avoid it anyway.
-
- `re_compile_pattern' sets `regs_allocated' to `REGS_UNALLOCATED', so
-if you use the GNU regular expression functions, you get this behavior
-by default.
-
- xx document re_set_registers
-
- POSIX, on the other hand, requires a different interface: the caller
-is supposed to pass in a fixed-length array which the matcher fills.
-Therefore, if `regs_allocated' is `REGS_FIXED' the matcher simply fills
-that array.
-
- The following examples illustrate the information recorded in the
-`re_registers' structure. (In all of them, `(' represents the
-open-group and `)' the close-group operator. The first character in
-the string STRING is at index 0.)
-
- * If the regular expression has an I-th group not contained within
- another group that matches a substring of STRING, then the
- function sets `REGS->start[I]' to the index in STRING where the
- substring matched by the I-th group begins, and `REGS->end[I]' to
- the index just beyond that substring's end. The function sets
- `REGS->start[0]' and `REGS->end[0]' to analogous information about
- the entire pattern.
-
- For example, when you match `((a)(b))' against `ab', you get:
-
- * 0 in `REGS->start[0]' and 2 in `REGS->end[0]'
-
- * 0 in `REGS->start[1]' and 2 in `REGS->end[1]'
-
- * 0 in `REGS->start[2]' and 1 in `REGS->end[2]'
-
- * 1 in `REGS->start[3]' and 2 in `REGS->end[3]'
-
- * If a group matches more than once (as it might if followed by,
- e.g., a repetition operator), then the function reports the
- information about what the group *last* matched.
-
- For example, when you match the pattern `(a)*' against the string
- `aa', you get:
-
- * 0 in `REGS->start[0]' and 2 in `REGS->end[0]'
-
- * 1 in `REGS->start[1]' and 2 in `REGS->end[1]'
-
- * If the I-th group does not participate in a successful match,
- e.g., it is an alternative not taken or a repetition operator
- allows zero repetitions of it, then the function sets
- `REGS->start[I]' and `REGS->end[I]' to -1.
-
- For example, when you match the pattern `(a)*b' against the string
- `b', you get:
-
- * 0 in `REGS->start[0]' and 1 in `REGS->end[0]'
-
- * -1 in `REGS->start[1]' and -1 in `REGS->end[1]'
-
- * If the I-th group matches a zero-length string, then the function
- sets `REGS->start[I]' and `REGS->end[I]' to the index just beyond
- that zero-length string.
-
- For example, when you match the pattern `(a*)b' against the string
- `b', you get:
-
- * 0 in `REGS->start[0]' and 1 in `REGS->end[0]'
-
- * 0 in `REGS->start[1]' and 0 in `REGS->end[1]'
-
- * If an I-th group contains a J-th group in turn not contained
- within any other group within group I and the function reports a
- match of the I-th group, then it records in `REGS->start[J]' and
- `REGS->end[J]' the last match (if it matched) of the J-th group.
-
- For example, when you match the pattern `((a*)b)*' against the
- string `abb', group 2 last matches the empty string, so you get
- what it previously matched:
-
- * 0 in `REGS->start[0]' and 3 in `REGS->end[0]'
-
- * 2 in `REGS->start[1]' and 3 in `REGS->end[1]'
-
- * 2 in `REGS->start[2]' and 2 in `REGS->end[2]'
-
- When you match the pattern `((a)*b)*' against the string `abb',
- group 2 doesn't participate in the last match, so you get:
-
- * 0 in `REGS->start[0]' and 3 in `REGS->end[0]'
-
- * 2 in `REGS->start[1]' and 3 in `REGS->end[1]'
-
- * 0 in `REGS->start[2]' and 1 in `REGS->end[2]'
-
- * If an I-th group contains a J-th group in turn not contained
- within any other group within group I and the function sets
- `REGS->start[I]' and `REGS->end[I]' to -1, then it also sets
- `REGS->start[J]' and `REGS->end[J]' to -1.
-
- For example, when you match the pattern `((a)*b)*c' against the
- string `c', you get:
-
- * 0 in `REGS->start[0]' and 1 in `REGS->end[0]'
-
- * -1 in `REGS->start[1]' and -1 in `REGS->end[1]'
-
- * -1 in `REGS->start[2]' and -1 in `REGS->end[2]'
-
-
-File: regex.info, Node: Freeing GNU Pattern Buffers, Prev: Using Registers, Up: GNU Regex Functions
-
-Freeing GNU Pattern Buffers
----------------------------
-
- To free any allocated fields of a pattern buffer, you can use the
-POSIX function described in *Note Freeing POSIX Pattern Buffers::,
-since the type `regex_t'--the type for POSIX pattern buffers--is
-equivalent to the type `re_pattern_buffer'. After freeing a pattern
-buffer, you need to again compile a regular expression in it (*note GNU
-Regular Expression Compiling::.) before passing it to a matching or
-searching function.
-
-
-File: regex.info, Node: POSIX Regex Functions, Next: BSD Regex Functions, Prev: GNU Regex Functions, Up: Programming with Regex
-
-POSIX Regex Functions
-=====================
-
- If you're writing code that has to be POSIX compatible, you'll need
-to use these functions. Their interfaces are as specified by POSIX,
-draft 1003.2/D11.2.
-
-* Menu:
-
-* POSIX Pattern Buffers:: The regex_t type.
-* POSIX Regular Expression Compiling:: regcomp ()
-* POSIX Matching:: regexec ()
-* Reporting Errors:: regerror ()
-* Using Byte Offsets:: The regmatch_t type.
-* Freeing POSIX Pattern Buffers:: regfree ()
-
-
-File: regex.info, Node: POSIX Pattern Buffers, Next: POSIX Regular Expression Compiling, Up: POSIX Regex Functions
-
-POSIX Pattern Buffers
----------------------
-
- To compile or match a given regular expression the POSIX way, you
-must supply a pattern buffer exactly the way you do for GNU (*note GNU
-Pattern Buffers::.). POSIX pattern buffers have type `regex_t', which
-is equivalent to the GNU pattern buffer type `re_pattern_buffer'.
-
-
-File: regex.info, Node: POSIX Regular Expression Compiling, Next: POSIX Matching, Prev: POSIX Pattern Buffers, Up: POSIX Regex Functions
-
-POSIX Regular Expression Compiling
-----------------------------------
-
- With POSIX, you can only search for a given regular expression; you
-can't match it. To do this, you must first compile it in a pattern
-buffer, using `regcomp'.
-
- To compile a pattern buffer, use:
-
- int
- regcomp (regex_t *PREG, const char *REGEX, int CFLAGS)
-
-PREG is the initialized pattern buffer's address, REGEX is the regular
-expression's address, and CFLAGS is the compilation flags, which Regex
-considers as a collection of bits. Here are the valid bits, as defined
-in `regex.h':
-
-`REG_EXTENDED'
- says to use POSIX Extended Regular Expression syntax; if this isn't
- set, then says to use POSIX Basic Regular Expression syntax.
- `regcomp' sets PREG's `syntax' field accordingly.
-
-`REG_ICASE'
- says to ignore case; `regcomp' sets PREG's `translate' field to a
- translate table which ignores case, replacing anything you've put
- there before.
-
-`REG_NOSUB'
- says to set PREG's `no_sub' field; *note POSIX Matching::., for
- what this means.
-
-`REG_NEWLINE'
- says that a:
-
- * match-any-character operator (*note Match-any-character
- Operator::.) doesn't match a newline.
-
- * nonmatching list not containing a newline (*note List
- Operators::.) matches a newline.
-
- * match-beginning-of-line operator (*note
- Match-beginning-of-line Operator::.) matches the empty string
- immediately after a newline, regardless of how `REG_NOTBOL'
- is set (*note POSIX Matching::., for an explanation of
- `REG_NOTBOL').
-
- * match-end-of-line operator (*note Match-beginning-of-line
- Operator::.) matches the empty string immediately before a
- newline, regardless of how `REG_NOTEOL' is set (*note POSIX
- Matching::., for an explanation of `REG_NOTEOL').
-
- If `regcomp' successfully compiles the regular expression, it returns
-zero and sets `*PATTERN_BUFFER' to the compiled pattern. Except for
-`syntax' (which it sets as explained above), it also sets the same
-fields the same way as does the GNU compiling function (*note GNU
-Regular Expression Compiling::.).
-
- If `regcomp' can't compile the regular expression, it returns one of
-the error codes listed here. (Except when noted differently, the
-syntax of in all examples below is basic regular expression syntax.)
-
-`REG_BADRPT'
- For example, the consecutive repetition operators `**' in `a**'
- are invalid. As another example, if the syntax is extended
- regular expression syntax, then the repetition operator `*' with
- nothing on which to operate in `*' is invalid.
-
-`REG_BADBR'
- For example, the COUNT `-1' in `a\{-1' is invalid.
-
-`REG_EBRACE'
- For example, `a\{1' is missing a close-interval operator.
-
-`REG_EBRACK'
- For example, `[a' is missing a close-list operator.
-
-`REG_ERANGE'
- For example, the range ending point `z' that collates lower than
- does its starting point `a' in `[z-a]' is invalid. Also, the
- range with the character class `[:alpha:]' as its starting point in
- `[[:alpha:]-|]'.
-
-`REG_ECTYPE'
- For example, the character class name `foo' in `[[:foo:]' is
- invalid.
-
-`REG_EPAREN'
- For example, `a\)' is missing an open-group operator and `\(a' is
- missing a close-group operator.
-
-`REG_ESUBREG'
- For example, the back reference `\2' that refers to a nonexistent
- subexpression in `\(a\)\2' is invalid.
-
-`REG_EEND'
- Returned when a regular expression causes no other more specific
- error.
-
-`REG_EESCAPE'
- For example, the trailing backslash `\' in `a\' is invalid, as is
- the one in `\'.
-
-`REG_BADPAT'
- For example, in the extended regular expression syntax, the empty
- group `()' in `a()b' is invalid.
-
-`REG_ESIZE'
- Returned when a regular expression needs a pattern buffer larger
- than 65536 bytes.
-
-`REG_ESPACE'
- Returned when a regular expression makes Regex to run out of
- memory.
-
-
-File: regex.info, Node: POSIX Matching, Next: Reporting Errors, Prev: POSIX Regular Expression Compiling, Up: POSIX Regex Functions
-
-POSIX Matching
---------------
-
- Matching the POSIX way means trying to match a null-terminated string
-starting at its first character. Once you've compiled a pattern into a
-pattern buffer (*note POSIX Regular Expression Compiling::.), you can
-ask the matcher to match that pattern against a string using:
-
- int
- regexec (const regex_t *PREG, const char *STRING,
- size_t NMATCH, regmatch_t PMATCH[], int EFLAGS)
-
-PREG is the address of a pattern buffer for a compiled pattern. STRING
-is the string you want to match.
-
- *Note Using Byte Offsets::, for an explanation of PMATCH. If you
-pass zero for NMATCH or you compiled PREG with the compilation flag
-`REG_NOSUB' set, then `regexec' will ignore PMATCH; otherwise, you must
-allocate it to have at least NMATCH elements. `regexec' will record
-NMATCH byte offsets in PMATCH, and set to -1 any unused elements up to
-PMATCH`[NMATCH]' - 1.
-
- EFLAGS specifies "execution flags"--namely, the two bits `REG_NOTBOL'
-and `REG_NOTEOL' (defined in `regex.h'). If you set `REG_NOTBOL', then
-the match-beginning-of-line operator (*note Match-beginning-of-line
-Operator::.) always fails to match. This lets you match against pieces
-of a line, as you would need to if, say, searching for repeated
-instances of a given pattern in a line; it would work correctly for
-patterns both with and without match-beginning-of-line operators.
-`REG_NOTEOL' works analogously for the match-end-of-line operator
-(*note Match-end-of-line Operator::.); it exists for symmetry.
-
- `regexec' tries to find a match for PREG in STRING according to the
-syntax in PREG's `syntax' field. (*Note POSIX Regular Expression
-Compiling::, for how to set it.) The function returns zero if the
-compiled pattern matches STRING and `REG_NOMATCH' (defined in
-`regex.h') if it doesn't.
-
-
-File: regex.info, Node: Reporting Errors, Next: Using Byte Offsets, Prev: POSIX Matching, Up: POSIX Regex Functions
-
-Reporting Errors
-----------------
-
- If either `regcomp' or `regexec' fail, they return a nonzero error
-code, the possibilities for which are defined in `regex.h'. *Note
-POSIX Regular Expression Compiling::, and *Note POSIX Matching::, for
-what these codes mean. To get an error string corresponding to these
-codes, you can use:
-
- size_t
- regerror (int ERRCODE,
- const regex_t *PREG,
- char *ERRBUF,
- size_t ERRBUF_SIZE)
-
-ERRCODE is an error code, PREG is the address of the pattern buffer
-which provoked the error, ERRBUF is the error buffer, and ERRBUF_SIZE
-is ERRBUF's size.
-
- `regerror' returns the size in bytes of the error string
-corresponding to ERRCODE (including its terminating null). If ERRBUF
-and ERRBUF_SIZE are nonzero, it also returns in ERRBUF the first
-ERRBUF_SIZE - 1 characters of the error string, followed by a null.
-eRRBUF_SIZE must be a nonnegative number less than or equal to the size
-in bytes of ERRBUF.
-
- You can call `regerror' with a null ERRBUF and a zero ERRBUF_SIZE to
-determine how large ERRBUF need be to accommodate `regerror''s error
-string.
-
-
-File: regex.info, Node: Using Byte Offsets, Next: Freeing POSIX Pattern Buffers, Prev: Reporting Errors, Up: POSIX Regex Functions
-
-Using Byte Offsets
-------------------
-
- In POSIX, variables of type `regmatch_t' hold analogous information,
-but are not identical to, GNU's registers (*note Using Registers::.).
-To get information about registers in POSIX, pass to `regexec' a
-nonzero PMATCH of type `regmatch_t', i.e., the address of a structure
-of this type, defined in `regex.h':
-
- typedef struct
- {
- regoff_t rm_so;
- regoff_t rm_eo;
- } regmatch_t;
-
- When reading in *Note Using Registers::, about how the matching
-function stores the information into the registers, substitute PMATCH
-for REGS, `PMATCH[I]->rm_so' for `REGS->start[I]' and
-`PMATCH[I]->rm_eo' for `REGS->end[I]'.
-
-
-File: regex.info, Node: Freeing POSIX Pattern Buffers, Prev: Using Byte Offsets, Up: POSIX Regex Functions
-
-Freeing POSIX Pattern Buffers
------------------------------
-
- To free any allocated fields of a pattern buffer, use:
-
- void
- regfree (regex_t *PREG)
-
-PREG is the pattern buffer whose allocated fields you want freed.
-`regfree' also sets PREG's `allocated' and `used' fields to zero.
-After freeing a pattern buffer, you need to again compile a regular
-expression in it (*note POSIX Regular Expression Compiling::.) before
-passing it to the matching function (*note POSIX Matching::.).
-
-
-File: regex.info, Node: BSD Regex Functions, Prev: POSIX Regex Functions, Up: Programming with Regex
-
-BSD Regex Functions
-===================
-
- If you're writing code that has to be Berkeley UNIX compatible,
-you'll need to use these functions whose interfaces are the same as
-those in Berkeley UNIX.
-
-* Menu:
-
-* BSD Regular Expression Compiling:: re_comp ()
-* BSD Searching:: re_exec ()
-
-
-File: regex.info, Node: BSD Regular Expression Compiling, Next: BSD Searching, Up: BSD Regex Functions
-
-BSD Regular Expression Compiling
---------------------------------
-
- With Berkeley UNIX, you can only search for a given regular
-expression; you can't match one. To search for it, you must first
-compile it. Before you compile it, you must indicate the regular
-expression syntax you want it compiled according to by setting the
-variable `re_syntax_options' (declared in `regex.h' to some syntax
-(*note Regular Expression Syntax::.).
-
- To compile a regular expression use:
-
- char *
- re_comp (char *REGEX)
-
-REGEX is the address of a null-terminated regular expression.
-`re_comp' uses an internal pattern buffer, so you can use only the most
-recently compiled pattern buffer. This means that if you want to use a
-given regular expression that you've already compiled--but it isn't the
-latest one you've compiled--you'll have to recompile it. If you call
-`re_comp' with the null string (*not* the empty string) as the
-argument, it doesn't change the contents of the pattern buffer.
-
- If `re_comp' successfully compiles the regular expression, it returns
-zero. If it can't compile the regular expression, it returns an error
-string. `re_comp''s error messages are identical to those of
-`re_compile_pattern' (*note GNU Regular Expression Compiling::.).
-
-
-File: regex.info, Node: BSD Searching, Prev: BSD Regular Expression Compiling, Up: BSD Regex Functions
-
-BSD Searching
--------------
-
- Searching the Berkeley UNIX way means searching in a string starting
-at its first character and trying successive positions within it to
-find a match. Once you've compiled a pattern using `re_comp' (*note
-BSD Regular Expression Compiling::.), you can ask Regex to search for
-that pattern in a string using:
-
- int
- re_exec (char *STRING)
-
-STRING is the address of the null-terminated string in which you want
-to search.
-
- `re_exec' returns either 1 for success or 0 for failure. It
-automatically uses a GNU fastmap (*note Searching with Fastmaps::.).
-
-
-File: regex.info, Node: Copying, Next: Index, Prev: Programming with Regex, Up: Top
-
-GNU GENERAL PUBLIC LICENSE
-**************************
-
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 675 Mass Ave, Cambridge, MA 02139, USA
-
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-Preamble
-========
-
- The licenses for most software are designed to take away your freedom
-to share and change it. By contrast, the GNU General Public License is
-intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it in
-new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 1. This License applies to any program or other work which contains a
- notice placed by the copyright holder saying it may be distributed
- under the terms of this General Public License. The "Program",
- below, refers to any such program or work, and a "work based on
- the Program" means either the Program or any derivative work under
- copyright law: that is to say, a work containing the Program or a
- portion of it, either verbatim or with modifications and/or
- translated into another language. (Hereinafter, translation is
- included without limitation in the term "modification".) Each
- licensee is addressed as "you".
-
- Activities other than copying, distribution and modification are
- not covered by this License; they are outside its scope. The act
- of running the Program is not restricted, and the output from the
- Program is covered only if its contents constitute a work based on
- the Program (independent of having been made by running the
- Program). Whether that is true depends on what the Program does.
-
- 2. You may copy and distribute verbatim copies of the Program's
- source code as you receive it, in any medium, provided that you
- conspicuously and appropriately publish on each copy an appropriate
- copyright notice and disclaimer of warranty; keep intact all the
- notices that refer to this License and to the absence of any
- warranty; and give any other recipients of the Program a copy of
- this License along with the Program.
-
- You may charge a fee for the physical act of transferring a copy,
- and you may at your option offer warranty protection in exchange
- for a fee.
-
- 3. You may modify your copy or copies of the Program or any portion
- of it, thus forming a work based on the Program, and copy and
- distribute such modifications or work under the terms of Section 1
- above, provided that you also meet all of these conditions:
-
- a. You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b. You must cause any work that you distribute or publish, that
- in whole or in part contains or is derived from the Program
- or any part thereof, to be licensed as a whole at no charge
- to all third parties under the terms of this License.
-
- c. If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display
- an announcement including an appropriate copyright notice and
- a notice that there is no warranty (or else, saying that you
- provide a warranty) and that users may redistribute the
- program under these conditions, and telling the user how to
- view a copy of this License. (Exception: if the Program
- itself is interactive but does not normally print such an
- announcement, your work based on the Program is not required
- to print an announcement.)
-
- These requirements apply to the modified work as a whole. If
- identifiable sections of that work are not derived from the
- Program, and can be reasonably considered independent and separate
- works in themselves, then this License, and its terms, do not
- apply to those sections when you distribute them as separate
- works. But when you distribute the same sections as part of a
- whole which is a work based on the Program, the distribution of
- the whole must be on the terms of this License, whose permissions
- for other licensees extend to the entire whole, and thus to each
- and every part regardless of who wrote it.
-
- Thus, it is not the intent of this section to claim rights or
- contest your rights to work written entirely by you; rather, the
- intent is to exercise the right to control the distribution of
- derivative or collective works based on the Program.
-
- In addition, mere aggregation of another work not based on the
- Program with the Program (or with a work based on the Program) on
- a volume of a storage or distribution medium does not bring the
- other work under the scope of this License.
-
- 4. You may copy and distribute the Program (or a work based on it,
- under Section 2) in object code or executable form under the terms
- of Sections 1 and 2 above provided that you also do one of the
- following:
-
- a. Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of
- Sections 1 and 2 above on a medium customarily used for
- software interchange; or,
-
- b. Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a
- medium customarily used for software interchange; or,
-
- c. Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with
- such an offer, in accord with Subsection b above.)
-
- The source code for a work means the preferred form of the work for
- making modifications to it. For an executable work, complete
- source code means all the source code for all modules it contains,
- plus any associated interface definition files, plus the scripts
- used to control compilation and installation of the executable.
- However, as a special exception, the source code distributed need
- not include anything that is normally distributed (in either
- source or binary form) with the major components (compiler,
- kernel, and so on) of the operating system on which the executable
- runs, unless that component itself accompanies the executable.
-
- If distribution of executable or object code is made by offering
- access to copy from a designated place, then offering equivalent
- access to copy the source code from the same place counts as
- distribution of the source code, even though third parties are not
- compelled to copy the source along with the object code.
-
- 5. You may not copy, modify, sublicense, or distribute the Program
- except as expressly provided under this License. Any attempt
- otherwise to copy, modify, sublicense or distribute the Program is
- void, and will automatically terminate your rights under this
- License. However, parties who have received copies, or rights,
- from you under this License will not have their licenses
- terminated so long as such parties remain in full compliance.
-
- 6. You are not required to accept this License, since you have not
- signed it. However, nothing else grants you permission to modify
- or distribute the Program or its derivative works. These actions
- are prohibited by law if you do not accept this License.
- Therefore, by modifying or distributing the Program (or any work
- based on the Program), you indicate your acceptance of this
- License to do so, and all its terms and conditions for copying,
- distributing or modifying the Program or works based on it.
-
- 7. Each time you redistribute the Program (or any work based on the
- Program), the recipient automatically receives a license from the
- original licensor to copy, distribute or modify the Program
- subject to these terms and conditions. You may not impose any
- further restrictions on the recipients' exercise of the rights
- granted herein. You are not responsible for enforcing compliance
- by third parties to this License.
-
- 8. If, as a consequence of a court judgment or allegation of patent
- infringement or for any other reason (not limited to patent
- issues), conditions are imposed on you (whether by court order,
- agreement or otherwise) that contradict the conditions of this
- License, they do not excuse you from the conditions of this
- License. If you cannot distribute so as to satisfy simultaneously
- your obligations under this License and any other pertinent
- obligations, then as a consequence you may not distribute the
- Program at all. For example, if a patent license would not permit
- royalty-free redistribution of the Program by all those who
- receive copies directly or indirectly through you, then the only
- way you could satisfy both it and this License would be to refrain
- entirely from distribution of the Program.
-
- If any portion of this section is held invalid or unenforceable
- under any particular circumstance, the balance of the section is
- intended to apply and the section as a whole is intended to apply
- in other circumstances.
-
- It is not the purpose of this section to induce you to infringe any
- patents or other property right claims or to contest validity of
- any such claims; this section has the sole purpose of protecting
- the integrity of the free software distribution system, which is
- implemented by public license practices. Many people have made
- generous contributions to the wide range of software distributed
- through that system in reliance on consistent application of that
- system; it is up to the author/donor to decide if he or she is
- willing to distribute software through any other system and a
- licensee cannot impose that choice.
-
- This section is intended to make thoroughly clear what is believed
- to be a consequence of the rest of this License.
-
- 9. If the distribution and/or use of the Program is restricted in
- certain countries either by patents or by copyrighted interfaces,
- the original copyright holder who places the Program under this
- License may add an explicit geographical distribution limitation
- excluding those countries, so that distribution is permitted only
- in or among countries not thus excluded. In such case, this
- License incorporates the limitation as if written in the body of
- this License.
-
- 10. The Free Software Foundation may publish revised and/or new
- versions of the General Public License from time to time. Such
- new versions will be similar in spirit to the present version, but
- may differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
- Program specifies a version number of this License which applies
- to it and "any later version", you have the option of following
- the terms and conditions either of that version or of any later
- version published by the Free Software Foundation. If the Program
- does not specify a version number of this License, you may choose
- any version ever published by the Free Software Foundation.
-
- 11. If you wish to incorporate parts of the Program into other free
- programs whose distribution conditions are different, write to the
- author to ask for permission. For software which is copyrighted
- by the Free Software Foundation, write to the Free Software
- Foundation; we sometimes make exceptions for this. Our decision
- will be guided by the two goals of preserving the free status of
- all derivatives of our free software and of promoting the sharing
- and reuse of software generally.
-
- NO WARRANTY
-
- 12. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
- WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
- LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
- HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
- WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
- NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE
- QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
- PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
- SERVICING, REPAIR OR CORRECTION.
-
- 13. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
- WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
- MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
- LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
- INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
- INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
- DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
- OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
- OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
-Appendix: How to Apply These Terms to Your New Programs
-=======================================================
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these
-terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
- Copyright (C) 19YY NAME OF AUTHOR
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Also add information on how to contact you by electronic and paper
-mail.
-
- If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19YY NAME OF AUTHOR
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
- The hypothetical commands `show w' and `show c' should show the
-appropriate parts of the General Public License. Of course, the
-commands you use may be called something other than `show w' and `show
-c'; they could even be mouse-clicks or menu items--whatever suits your
-program.
-
- You should also get your employer (if you work as a programmer) or
-your school, if any, to sign a "copyright disclaimer" for the program,
-if necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- SIGNATURE OF TY COON, 1 April 1989
- Ty Coon, President of Vice
-
- This General Public License does not permit incorporating your
-program into proprietary programs. If your program is a subroutine
-library, you may consider it more useful to permit linking proprietary
-applications with the library. If this is what you want to do, use the
-GNU Library General Public License instead of this License.
-
-
-File: regex.info, Node: Index, Prev: Copying, Up: Top
-
-Index
-*****
-
-* Menu:
-
-* $: Match-end-of-line Operator.
-* (: Grouping Operators.
-* ): Grouping Operators.
-* *: Match-zero-or-more Operator.
-* +: Match-one-or-more Operator.
-* -: List Operators.
-* .: Match-any-character Operator.
-* :] in regex: Character Class Operators.
-* ?: Match-zero-or-one Operator.
-* {: Interval Operators.
-* }: Interval Operators.
-* [: in regex: Character Class Operators.
-* [^: List Operators.
-* [: List Operators.
-* \': Match-end-of-buffer Operator.
-* \<: Match-beginning-of-word Operator.
-* \>: Match-end-of-word Operator.
-* \{: Interval Operators.
-* \}: Interval Operators.
-* \b: Match-word-boundary Operator.
-* \B: Match-within-word Operator.
-* \s: Match-syntactic-class Operator.
-* \S: Match-not-syntactic-class Operator.
-* \w: Match-word-constituent Operator.
-* \W: Match-non-word-constituent Operator.
-* \`: Match-beginning-of-buffer Operator.
-* \: List Operators.
-* ]: List Operators.
-* ^: List Operators.
-* allocated initialization: GNU Regular Expression Compiling.
-* alternation operator: Alternation Operator.
-* alternation operator and ^: Match-beginning-of-line Operator.
-* anchoring: Anchoring Operators.
-* anchors: Match-end-of-line Operator.
-* anchors: Match-beginning-of-line Operator.
-* Awk: Predefined Syntaxes.
-* back references: Back-reference Operator.
-* backtracking: Match-zero-or-more Operator.
-* backtracking: Alternation Operator.
-* beginning-of-line operator: Match-beginning-of-line Operator.
-* bracket expression: List Operators.
-* buffer field, set by re_compile_pattern: GNU Regular Expression Compiling.
-* buffer initialization: GNU Regular Expression Compiling.
-* character classes: Character Class Operators.
-* Egrep: Predefined Syntaxes.
-* Emacs: Predefined Syntaxes.
-* end in struct re_registers: Using Registers.
-* end-of-line operator: Match-end-of-line Operator.
-* fastmap initialization: GNU Regular Expression Compiling.
-* fastmaps: Searching with Fastmaps.
-* fastmap_accurate field, set by re_compile_pattern: GNU Regular Expression Compiling.
-* Grep: Predefined Syntaxes.
-* grouping: Grouping Operators.
-* ignoring case: POSIX Regular Expression Compiling.
-* interval expression: Interval Operators.
-* matching list: List Operators.
-* matching newline: List Operators.
-* matching with GNU functions: GNU Matching.
-* newline_anchor field in pattern buffer: Match-beginning-of-line Operator.
-* nonmatching list: List Operators.
-* not_bol field in pattern buffer: Match-beginning-of-line Operator.
-* num_regs in struct re_registers: Using Registers.
-* open-group operator and ^: Match-beginning-of-line Operator.
-* or operator: Alternation Operator.
-* parenthesizing: Grouping Operators.
-* pattern buffer initialization: GNU Regular Expression Compiling.
-* pattern buffer, definition of: GNU Pattern Buffers.
-* POSIX Awk: Predefined Syntaxes.
-* range argument to re_search: GNU Searching.
-* regex.c: Overview.
-* regex.h: Overview.
-* regexp anchoring: Anchoring Operators.
-* regmatch_t: Using Byte Offsets.
-* regs_allocated: Using Registers.
-* REGS_FIXED: Using Registers.
-* REGS_REALLOCATE: Using Registers.
-* REGS_UNALLOCATED: Using Registers.
-* regular expressions, syntax of: Regular Expression Syntax.
-* REG_EXTENDED: POSIX Regular Expression Compiling.
-* REG_ICASE: POSIX Regular Expression Compiling.
-* REG_NEWLINE: POSIX Regular Expression Compiling.
-* REG_NOSUB: POSIX Regular Expression Compiling.
-* RE_BACKSLASH_ESCAPE_IN_LIST: Syntax Bits.
-* RE_BK_PLUS_QM: Syntax Bits.
-* RE_CHAR_CLASSES: Syntax Bits.
-* RE_CONTEXT_INDEP_ANCHORS: Syntax Bits.
-* RE_CONTEXT_INDEP_ANCHORS (and ^): Match-beginning-of-line Operator.
-* RE_CONTEXT_INDEP_OPS: Syntax Bits.
-* RE_CONTEXT_INVALID_OPS: Syntax Bits.
-* RE_DOT_NEWLINE: Syntax Bits.
-* RE_DOT_NOT_NULL: Syntax Bits.
-* RE_INTERVALS: Syntax Bits.
-* RE_LIMITED_OPS: Syntax Bits.
-* RE_NEWLINE_ALT: Syntax Bits.
-* RE_NO_BK_BRACES: Syntax Bits.
-* RE_NO_BK_PARENS: Syntax Bits.
-* RE_NO_BK_REFS: Syntax Bits.
-* RE_NO_BK_VBAR: Syntax Bits.
-* RE_NO_EMPTY_RANGES: Syntax Bits.
-* re_nsub field, set by re_compile_pattern: GNU Regular Expression Compiling.
-* re_pattern_buffer definition: GNU Pattern Buffers.
-* re_registers: Using Registers.
-* re_syntax_options initialization: GNU Regular Expression Compiling.
-* RE_UNMATCHED_RIGHT_PAREN_ORD: Syntax Bits.
-* searching with GNU functions: GNU Searching.
-* start argument to re_search: GNU Searching.
-* start in struct re_registers: Using Registers.
-* struct re_pattern_buffer definition: GNU Pattern Buffers.
-* subexpressions: Grouping Operators.
-* syntax field, set by re_compile_pattern: GNU Regular Expression Compiling.
-* syntax bits: Syntax Bits.
-* syntax initialization: GNU Regular Expression Compiling.
-* syntax of regular expressions: Regular Expression Syntax.
-* translate initialization: GNU Regular Expression Compiling.
-* used field, set by re_compile_pattern: GNU Regular Expression Compiling.
-* word boundaries, matching: Match-word-boundary Operator.
-* \: The Backslash Character.
-* \(: Grouping Operators.
-* \): Grouping Operators.
-* \|: Alternation Operator.
-* ^: Match-beginning-of-line Operator.
-* |: Alternation Operator.
-
-
-
-Tag Table:
-Node: Top1064
-Node: Overview4562
-Node: Regular Expression Syntax6746
-Node: Syntax Bits7916
-Node: Predefined Syntaxes14018
-Node: Collating Elements vs. Characters17872
-Node: The Backslash Character18835
-Node: Common Operators21992
-Node: Match-self Operator23445
-Node: Match-any-character Operator23941
-Node: Concatenation Operator24520
-Node: Repetition Operators25017
-Node: Match-zero-or-more Operator25436
-Node: Match-one-or-more Operator27483
-Node: Match-zero-or-one Operator28341
-Node: Interval Operators29196
-Node: Alternation Operator30991
-Node: List Operators32489
-Node: Character Class Operators35272
-Node: Range Operator36901
-Node: Grouping Operators38930
-Node: Back-reference Operator40251
-Node: Anchoring Operators43073
-Node: Match-beginning-of-line Operator43447
-Node: Match-end-of-line Operator44779
-Node: GNU Operators45518
-Node: Word Operators45767
-Node: Non-Emacs Syntax Tables46391
-Node: Match-word-boundary Operator47465
-Node: Match-within-word Operator47858
-Node: Match-beginning-of-word Operator48255
-Node: Match-end-of-word Operator48588
-Node: Match-word-constituent Operator48908
-Node: Match-non-word-constituent Operator49234
-Node: Buffer Operators49545
-Node: Match-beginning-of-buffer Operator49952
-Node: Match-end-of-buffer Operator50264
-Node: GNU Emacs Operators50558
-Node: Syntactic Class Operators50901
-Node: Emacs Syntax Tables51307
-Node: Match-syntactic-class Operator51963
-Node: Match-not-syntactic-class Operator52560
-Node: What Gets Matched?53150
-Node: Programming with Regex53799
-Node: GNU Regex Functions54237
-Node: GNU Pattern Buffers55078
-Node: GNU Regular Expression Compiling58303
-Node: GNU Matching61181
-Node: GNU Searching63101
-Node: Matching/Searching with Split Data64913
-Node: Searching with Fastmaps66369
-Node: GNU Translate Tables68921
-Node: Using Registers70892
-Node: Freeing GNU Pattern Buffers77000
-Node: POSIX Regex Functions77593
-Node: POSIX Pattern Buffers78266
-Node: POSIX Regular Expression Compiling78709
-Node: POSIX Matching82836
-Node: Reporting Errors84791
-Node: Using Byte Offsets86048
-Node: Freeing POSIX Pattern Buffers86861
-Node: BSD Regex Functions87467
-Node: BSD Regular Expression Compiling87886
-Node: BSD Searching89258
-Node: Copying89960
-Node: Index109122
-
-End Tag Table
diff --git a/gnu/lib/libregex/doc/regex.texi b/gnu/lib/libregex/doc/regex.texi
deleted file mode 100644
index d93953e..0000000
--- a/gnu/lib/libregex/doc/regex.texi
+++ /dev/null
@@ -1,3138 +0,0 @@
-\input texinfo
-@c %**start of header
-@setfilename regex.info
-@settitle Regex
-@c %**end of header
-
-@c \\{fill-paragraph} works better (for me, anyway) if the text in the
-@c source file isn't indented.
-@paragraphindent 2
-
-@c Define a new index for our magic constants.
-@defcodeindex cn
-
-@c Put everything in one index (arbitrarily chosen to be the concept index).
-@syncodeindex cn cp
-@syncodeindex ky cp
-@syncodeindex pg cp
-@syncodeindex tp cp
-@syncodeindex vr cp
-
-@c Here is what we use in the Info `dir' file:
-@c * Regex: (regex). Regular expression library.
-
-
-@ifinfo
-This file documents the GNU regular expression library.
-
-Copyright (C) 1992, 1993 Free Software Foundation, Inc.
-
-Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-
-@ignore
-Permission is granted to process this file through TeX and print the
-results, provided the printed document carries a copying permission
-notice identical to this one except for the removal of this paragraph
-(this paragraph not being relevant to the printed manual).
-@end ignore
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided also that the
-section entitled ``GNU General Public License'' is included exactly as
-in the original, and provided that the entire resulting derived work is
-distributed under the terms of a permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that the section entitled ``GNU General Public License'' may be
-included in a translation approved by the Free Software Foundation
-instead of in the original English.
-@end ifinfo
-
-
-@titlepage
-
-@title Regex
-@subtitle edition 0.12a
-@subtitle 19 September 1992
-@author Kathryn A. Hargreaves
-@author Karl Berry
-
-@page
-
-@vskip 0pt plus 1filll
-Copyright @copyright{} 1992 Free Software Foundation.
-
-Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided also that the
-section entitled ``GNU General Public License'' is included exactly as
-in the original, and provided that the entire resulting derived work is
-distributed under the terms of a permission notice identical to this
-one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that the section entitled ``GNU General Public License'' may be
-included in a translation approved by the Free Software Foundation
-instead of in the original English.
-
-@end titlepage
-
-
-@ifinfo
-@node Top, Overview, (dir), (dir)
-@top Regular Expression Library
-
-This manual documents how to program with the GNU regular expression
-library. This is edition 0.12a of the manual, 19 September 1992.
-
-The first part of this master menu lists the major nodes in this Info
-document, including the index. The rest of the menu lists all the
-lower level nodes in the document.
-
-@menu
-* Overview::
-* Regular Expression Syntax::
-* Common Operators::
-* GNU Operators::
-* GNU Emacs Operators::
-* What Gets Matched?::
-* Programming with Regex::
-* Copying:: Copying and sharing Regex.
-* Index:: General index.
- --- The Detailed Node Listing ---
-
-Regular Expression Syntax
-
-* Syntax Bits::
-* Predefined Syntaxes::
-* Collating Elements vs. Characters::
-* The Backslash Character::
-
-Common Operators
-
-* Match-self Operator:: Ordinary characters.
-* Match-any-character Operator:: .
-* Concatenation Operator:: Juxtaposition.
-* Repetition Operators:: * + ? @{@}
-* Alternation Operator:: |
-* List Operators:: [...] [^...]
-* Grouping Operators:: (...)
-* Back-reference Operator:: \digit
-* Anchoring Operators:: ^ $
-
-Repetition Operators
-
-* Match-zero-or-more Operator:: *
-* Match-one-or-more Operator:: +
-* Match-zero-or-one Operator:: ?
-* Interval Operators:: @{@}
-
-List Operators (@code{[} @dots{} @code{]} and @code{[^} @dots{} @code{]})
-
-* Character Class Operators:: [:class:]
-* Range Operator:: start-end
-
-Anchoring Operators
-
-* Match-beginning-of-line Operator:: ^
-* Match-end-of-line Operator:: $
-
-GNU Operators
-
-* Word Operators::
-* Buffer Operators::
-
-Word Operators
-
-* Non-Emacs Syntax Tables::
-* Match-word-boundary Operator:: \b
-* Match-within-word Operator:: \B
-* Match-beginning-of-word Operator:: \<
-* Match-end-of-word Operator:: \>
-* Match-word-constituent Operator:: \w
-* Match-non-word-constituent Operator:: \W
-
-Buffer Operators
-
-* Match-beginning-of-buffer Operator:: \`
-* Match-end-of-buffer Operator:: \'
-
-GNU Emacs Operators
-
-* Syntactic Class Operators::
-
-Syntactic Class Operators
-
-* Emacs Syntax Tables::
-* Match-syntactic-class Operator:: \sCLASS
-* Match-not-syntactic-class Operator:: \SCLASS
-
-Programming with Regex
-
-* GNU Regex Functions::
-* POSIX Regex Functions::
-* BSD Regex Functions::
-
-GNU Regex Functions
-
-* GNU Pattern Buffers:: The re_pattern_buffer type.
-* GNU Regular Expression Compiling:: re_compile_pattern ()
-* GNU Matching:: re_match ()
-* GNU Searching:: re_search ()
-* Matching/Searching with Split Data:: re_match_2 (), re_search_2 ()
-* Searching with Fastmaps:: re_compile_fastmap ()
-* GNU Translate Tables:: The `translate' field.
-* Using Registers:: The re_registers type and related fns.
-* Freeing GNU Pattern Buffers:: regfree ()
-
-POSIX Regex Functions
-
-* POSIX Pattern Buffers:: The regex_t type.
-* POSIX Regular Expression Compiling:: regcomp ()
-* POSIX Matching:: regexec ()
-* Reporting Errors:: regerror ()
-* Using Byte Offsets:: The regmatch_t type.
-* Freeing POSIX Pattern Buffers:: regfree ()
-
-BSD Regex Functions
-
-* BSD Regular Expression Compiling:: re_comp ()
-* BSD Searching:: re_exec ()
-@end menu
-@end ifinfo
-@node Overview, Regular Expression Syntax, Top, Top
-@chapter Overview
-
-A @dfn{regular expression} (or @dfn{regexp}, or @dfn{pattern}) is a text
-string that describes some (mathematical) set of strings. A regexp
-@var{r} @dfn{matches} a string @var{s} if @var{s} is in the set of
-strings described by @var{r}.
-
-Using the Regex library, you can:
-
-@itemize @bullet
-
-@item
-see if a string matches a specified pattern as a whole, and
-
-@item
-search within a string for a substring matching a specified pattern.
-
-@end itemize
-
-Some regular expressions match only one string, i.e., the set they
-describe has only one member. For example, the regular expression
-@samp{foo} matches the string @samp{foo} and no others. Other regular
-expressions match more than one string, i.e., the set they describe has
-more than one member. For example, the regular expression @samp{f*}
-matches the set of strings made up of any number (including zero) of
-@samp{f}s. As you can see, some characters in regular expressions match
-themselves (such as @samp{f}) and some don't (such as @samp{*}); the
-ones that don't match themselves instead let you specify patterns that
-describe many different strings.
-
-To either match or search for a regular expression with the Regex
-library functions, you must first compile it with a Regex pattern
-compiling function. A @dfn{compiled pattern} is a regular expression
-converted to the internal format used by the library functions. Once
-you've compiled a pattern, you can use it for matching or searching any
-number of times.
-
-The Regex library consists of two source files: @file{regex.h} and
-@file{regex.c}.
-@pindex regex.h
-@pindex regex.c
-Regex provides three groups of functions with which you can operate on
-regular expressions. One group---the @sc{gnu} group---is more powerful
-but not completely compatible with the other two, namely the @sc{posix}
-and Berkeley @sc{unix} groups; its interface was designed specifically
-for @sc{gnu}. The other groups have the same interfaces as do the
-regular expression functions in @sc{posix} and Berkeley
-@sc{unix}.
-
-We wrote this chapter with programmers in mind, not users of
-programs---such as Emacs---that use Regex. We describe the Regex
-library in its entirety, not how to write regular expressions that a
-particular program understands.
-
-
-@node Regular Expression Syntax, Common Operators, Overview, Top
-@chapter Regular Expression Syntax
-
-@cindex regular expressions, syntax of
-@cindex syntax of regular expressions
-
-@dfn{Characters} are things you can type. @dfn{Operators} are things in
-a regular expression that match one or more characters. You compose
-regular expressions from operators, which in turn you specify using one
-or more characters.
-
-Most characters represent what we call the match-self operator, i.e.,
-they match themselves; we call these characters @dfn{ordinary}. Other
-characters represent either all or parts of fancier operators; e.g.,
-@samp{.} represents what we call the match-any-character operator
-(which, no surprise, matches (almost) any character); we call these
-characters @dfn{special}. Two different things determine what
-characters represent what operators:
-
-@enumerate
-@item
-the regular expression syntax your program has told the Regex library to
-recognize, and
-
-@item
-the context of the character in the regular expression.
-@end enumerate
-
-In the following sections, we describe these things in more detail.
-
-@menu
-* Syntax Bits::
-* Predefined Syntaxes::
-* Collating Elements vs. Characters::
-* The Backslash Character::
-@end menu
-
-
-@node Syntax Bits, Predefined Syntaxes, , Regular Expression Syntax
-@section Syntax Bits
-
-@cindex syntax bits
-
-In any particular syntax for regular expressions, some characters are
-always special, others are sometimes special, and others are never
-special. The particular syntax that Regex recognizes for a given
-regular expression depends on the value in the @code{syntax} field of
-the pattern buffer of that regular expression.
-
-You get a pattern buffer by compiling a regular expression. @xref{GNU
-Pattern Buffers}, and @ref{POSIX Pattern Buffers}, for more information
-on pattern buffers. @xref{GNU Regular Expression Compiling}, @ref{POSIX
-Regular Expression Compiling}, and @ref{BSD Regular Expression
-Compiling}, for more information on compiling.
-
-Regex considers the value of the @code{syntax} field to be a collection
-of bits; we refer to these bits as @dfn{syntax bits}. In most cases,
-they affect what characters represent what operators. We describe the
-meanings of the operators to which we refer in @ref{Common Operators},
-@ref{GNU Operators}, and @ref{GNU Emacs Operators}.
-
-For reference, here is the complete list of syntax bits, in alphabetical
-order:
-
-@table @code
-
-@cnindex RE_BACKSLASH_ESCAPE_IN_LIST
-@item RE_BACKSLASH_ESCAPE_IN_LISTS
-If this bit is set, then @samp{\} inside a list (@pxref{List Operators}
-quotes (makes ordinary, if it's special) the following character; if
-this bit isn't set, then @samp{\} is an ordinary character inside lists.
-(@xref{The Backslash Character}, for what `\' does outside of lists.)
-
-@cnindex RE_BK_PLUS_QM
-@item RE_BK_PLUS_QM
-If this bit is set, then @samp{\+} represents the match-one-or-more
-operator and @samp{\?} represents the match-zero-or-more operator; if
-this bit isn't set, then @samp{+} represents the match-one-or-more
-operator and @samp{?} represents the match-zero-or-one operator. This
-bit is irrelevant if @code{RE_LIMITED_OPS} is set.
-
-@cnindex RE_CHAR_CLASSES
-@item RE_CHAR_CLASSES
-If this bit is set, then you can use character classes in lists; if this
-bit isn't set, then you can't.
-
-@cnindex RE_CONTEXT_INDEP_ANCHORS
-@item RE_CONTEXT_INDEP_ANCHORS
-If this bit is set, then @samp{^} and @samp{$} are special anywhere outside
-a list; if this bit isn't set, then these characters are special only in
-certain contexts. @xref{Match-beginning-of-line Operator}, and
-@ref{Match-end-of-line Operator}.
-
-@cnindex RE_CONTEXT_INDEP_OPS
-@item RE_CONTEXT_INDEP_OPS
-If this bit is set, then certain characters are special anywhere outside
-a list; if this bit isn't set, then those characters are special only in
-some contexts and are ordinary elsewhere. Specifically, if this bit
-isn't set then @samp{*}, and (if the syntax bit @code{RE_LIMITED_OPS}
-isn't set) @samp{+} and @samp{?} (or @samp{\+} and @samp{\?}, depending
-on the syntax bit @code{RE_BK_PLUS_QM}) represent repetition operators
-only if they're not first in a regular expression or just after an
-open-group or alternation operator. The same holds for @samp{@{} (or
-@samp{\@{}, depending on the syntax bit @code{RE_NO_BK_BRACES}) if
-it is the beginning of a valid interval and the syntax bit
-@code{RE_INTERVALS} is set.
-
-@cnindex RE_CONTEXT_INVALID_OPS
-@item RE_CONTEXT_INVALID_OPS
-If this bit is set, then repetition and alternation operators can't be
-in certain positions within a regular expression. Specifically, the
-regular expression is invalid if it has:
-
-@itemize @bullet
-
-@item
-a repetition operator first in the regular expression or just after a
-match-beginning-of-line, open-group, or alternation operator; or
-
-@item
-an alternation operator first or last in the regular expression, just
-before a match-end-of-line operator, or just after an alternation or
-open-group operator.
-
-@end itemize
-
-If this bit isn't set, then you can put the characters representing the
-repetition and alternation characters anywhere in a regular expression.
-Whether or not they will in fact be operators in certain positions
-depends on other syntax bits.
-
-@cnindex RE_DOT_NEWLINE
-@item RE_DOT_NEWLINE
-If this bit is set, then the match-any-character operator matches
-a newline; if this bit isn't set, then it doesn't.
-
-@cnindex RE_DOT_NOT_NULL
-@item RE_DOT_NOT_NULL
-If this bit is set, then the match-any-character operator doesn't match
-a null character; if this bit isn't set, then it does.
-
-@cnindex RE_INTERVALS
-@item RE_INTERVALS
-If this bit is set, then Regex recognizes interval operators; if this bit
-isn't set, then it doesn't.
-
-@cnindex RE_LIMITED_OPS
-@item RE_LIMITED_OPS
-If this bit is set, then Regex doesn't recognize the match-one-or-more,
-match-zero-or-one or alternation operators; if this bit isn't set, then
-it does.
-
-@cnindex RE_NEWLINE_ALT
-@item RE_NEWLINE_ALT
-If this bit is set, then newline represents the alternation operator; if
-this bit isn't set, then newline is ordinary.
-
-@cnindex RE_NO_BK_BRACES
-@item RE_NO_BK_BRACES
-If this bit is set, then @samp{@{} represents the open-interval operator
-and @samp{@}} represents the close-interval operator; if this bit isn't
-set, then @samp{\@{} represents the open-interval operator and
-@samp{\@}} represents the close-interval operator. This bit is relevant
-only if @code{RE_INTERVALS} is set.
-
-@cnindex RE_NO_BK_PARENS
-@item RE_NO_BK_PARENS
-If this bit is set, then @samp{(} represents the open-group operator and
-@samp{)} represents the close-group operator; if this bit isn't set, then
-@samp{\(} represents the open-group operator and @samp{\)} represents
-the close-group operator.
-
-@cnindex RE_NO_BK_REFS
-@item RE_NO_BK_REFS
-If this bit is set, then Regex doesn't recognize @samp{\}@var{digit} as
-the back reference operator; if this bit isn't set, then it does.
-
-@cnindex RE_NO_BK_VBAR
-@item RE_NO_BK_VBAR
-If this bit is set, then @samp{|} represents the alternation operator;
-if this bit isn't set, then @samp{\|} represents the alternation
-operator. This bit is irrelevant if @code{RE_LIMITED_OPS} is set.
-
-@cnindex RE_NO_EMPTY_RANGES
-@item RE_NO_EMPTY_RANGES
-If this bit is set, then a regular expression with a range whose ending
-point collates lower than its starting point is invalid; if this bit
-isn't set, then Regex considers such a range to be empty.
-
-@cnindex RE_UNMATCHED_RIGHT_PAREN_ORD
-@item RE_UNMATCHED_RIGHT_PAREN_ORD
-If this bit is set and the regular expression has no matching open-group
-operator, then Regex considers what would otherwise be a close-group
-operator (based on how @code{RE_NO_BK_PARENS} is set) to match @samp{)}.
-
-@end table
-
-
-@node Predefined Syntaxes, Collating Elements vs. Characters, Syntax Bits, Regular Expression Syntax
-@section Predefined Syntaxes
-
-If you're programming with Regex, you can set a pattern buffer's
-(@pxref{GNU Pattern Buffers}, and @ref{POSIX Pattern Buffers})
-@code{syntax} field either to an arbitrary combination of syntax bits
-(@pxref{Syntax Bits}) or else to the configurations defined by Regex.
-These configurations define the syntaxes used by certain
-programs---@sc{gnu} Emacs,
-@cindex Emacs
-@sc{posix} Awk,
-@cindex POSIX Awk
-traditional Awk,
-@cindex Awk
-Grep,
-@cindex Grep
-@cindex Egrep
-Egrep---in addition to syntaxes for @sc{posix} basic and extended
-regular expressions.
-
-The predefined syntaxes--taken directly from @file{regex.h}---are:
-
-@example
-#define RE_SYNTAX_EMACS 0
-
-#define RE_SYNTAX_AWK \
- (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS \
- | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
- | RE_UNMATCHED_RIGHT_PAREN_ORD)
-
-#define RE_SYNTAX_POSIX_AWK \
- (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)
-
-#define RE_SYNTAX_GREP \
- (RE_BK_PLUS_QM | RE_CHAR_CLASSES \
- | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
- | RE_NEWLINE_ALT)
-
-#define RE_SYNTAX_EGREP \
- (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
- | RE_NEWLINE_ALT | RE_NO_BK_PARENS \
- | RE_NO_BK_VBAR)
-
-#define RE_SYNTAX_POSIX_EGREP \
- (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)
-
-/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
-#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
-
-#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
-
-/* Syntax bits common to both basic and extended POSIX regex syntax. */
-#define _RE_SYNTAX_POSIX_COMMON \
- (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
- | RE_INTERVALS | RE_NO_EMPTY_RANGES)
-
-#define RE_SYNTAX_POSIX_BASIC \
- (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
-
-/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
- RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
- isn't minimal, since other operators, such as \`, aren't disabled. */
-#define RE_SYNTAX_POSIX_MINIMAL_BASIC \
- (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
-
-#define RE_SYNTAX_POSIX_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_VBAR \
- | RE_UNMATCHED_RIGHT_PAREN_ORD)
-
-/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS
- replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added. */
-#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS \
- | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
-@end example
-
-@node Collating Elements vs. Characters, The Backslash Character, Predefined Syntaxes, Regular Expression Syntax
-@section Collating Elements vs.@: Characters
-
-@sc{posix} generalizes the notion of a character to that of a
-collating element. It defines a @dfn{collating element} to be ``a
-sequence of one or more bytes defined in the current collating sequence
-as a unit of collation.''
-
-This generalizes the notion of a character in
-two ways. First, a single character can map into two or more collating
-elements. For example, the German
-@tex
-`\ss'
-@end tex
-@ifinfo
-``es-zet''
-@end ifinfo
-collates as the collating element @samp{s} followed by another collating
-element @samp{s}. Second, two or more characters can map into one
-collating element. For example, the Spanish @samp{ll} collates after
-@samp{l} and before @samp{m}.
-
-Since @sc{posix}'s ``collating element'' preserves the essential idea of
-a ``character,'' we use the latter, more familiar, term in this document.
-
-@node The Backslash Character, , Collating Elements vs. Characters, Regular Expression Syntax
-@section The Backslash Character
-
-@cindex \
-The @samp{\} character has one of four different meanings, depending on
-the context in which you use it and what syntax bits are set
-(@pxref{Syntax Bits}). It can: 1) stand for itself, 2) quote the next
-character, 3) introduce an operator, or 4) do nothing.
-
-@enumerate
-@item
-It stands for itself inside a list
-(@pxref{List Operators}) if the syntax bit
-@code{RE_BACKSLASH_ESCAPE_IN_LISTS} is not set. For example, @samp{[\]}
-would match @samp{\}.
-
-@item
-It quotes (makes ordinary, if it's special) the next character when you
-use it either:
-
-@itemize @bullet
-@item
-outside a list,@footnote{Sometimes
-you don't have to explicitly quote special characters to make
-them ordinary. For instance, most characters lose any special meaning
-inside a list (@pxref{List Operators}). In addition, if the syntax bits
-@code{RE_CONTEXT_INVALID_OPS} and @code{RE_CONTEXT_INDEP_OPS}
-aren't set, then (for historical reasons) the matcher considers special
-characters ordinary if they are in contexts where the operations they
-represent make no sense; for example, then the match-zero-or-more
-operator (represented by @samp{*}) matches itself in the regular
-expression @samp{*foo} because there is no preceding expression on which
-it can operate. It is poor practice, however, to depend on this
-behavior; if you want a special character to be ordinary outside a list,
-it's better to always quote it, regardless.} or
-
-@item
-inside a list and the syntax bit @code{RE_BACKSLASH_ESCAPE_IN_LISTS} is set.
-
-@end itemize
-
-@item
-It introduces an operator when followed by certain ordinary
-characters---sometimes only when certain syntax bits are set. See the
-cases @code{RE_BK_PLUS_QM}, @code{RE_NO_BK_BRACES}, @code{RE_NO_BK_VAR},
-@code{RE_NO_BK_PARENS}, @code{RE_NO_BK_REF} in @ref{Syntax Bits}. Also:
-
-@itemize @bullet
-@item
-@samp{\b} represents the match-word-boundary operator
-(@pxref{Match-word-boundary Operator}).
-
-@item
-@samp{\B} represents the match-within-word operator
-(@pxref{Match-within-word Operator}).
-
-@item
-@samp{\<} represents the match-beginning-of-word operator @*
-(@pxref{Match-beginning-of-word Operator}).
-
-@item
-@samp{\>} represents the match-end-of-word operator
-(@pxref{Match-end-of-word Operator}).
-
-@item
-@samp{\w} represents the match-word-constituent operator
-(@pxref{Match-word-constituent Operator}).
-
-@item
-@samp{\W} represents the match-non-word-constituent operator
-(@pxref{Match-non-word-constituent Operator}).
-
-@item
-@samp{\`} represents the match-beginning-of-buffer
-operator and @samp{\'} represents the match-end-of-buffer operator
-(@pxref{Buffer Operators}).
-
-@item
-If Regex was compiled with the C preprocessor symbol @code{emacs}
-defined, then @samp{\s@var{class}} represents the match-syntactic-class
-operator and @samp{\S@var{class}} represents the
-match-not-syntactic-class operator (@pxref{Syntactic Class Operators}).
-
-@end itemize
-
-@item
-In all other cases, Regex ignores @samp{\}. For example,
-@samp{\n} matches @samp{n}.
-
-@end enumerate
-
-@node Common Operators, GNU Operators, Regular Expression Syntax, Top
-@chapter Common Operators
-
-You compose regular expressions from operators. In the following
-sections, we describe the regular expression operators specified by
-@sc{posix}; @sc{gnu} also uses these. Most operators have more than one
-representation as characters. @xref{Regular Expression Syntax}, for
-what characters represent what operators under what circumstances.
-
-For most operators that can be represented in two ways, one
-representation is a single character and the other is that character
-preceded by @samp{\}. For example, either @samp{(} or @samp{\(}
-represents the open-group operator. Which one does depends on the
-setting of a syntax bit, in this case @code{RE_NO_BK_PARENS}. Why is
-this so? Historical reasons dictate some of the varying
-representations, while @sc{posix} dictates others.
-
-Finally, almost all characters lose any special meaning inside a list
-(@pxref{List Operators}).
-
-@menu
-* Match-self Operator:: Ordinary characters.
-* Match-any-character Operator:: .
-* Concatenation Operator:: Juxtaposition.
-* Repetition Operators:: * + ? @{@}
-* Alternation Operator:: |
-* List Operators:: [...] [^...]
-* Grouping Operators:: (...)
-* Back-reference Operator:: \digit
-* Anchoring Operators:: ^ $
-@end menu
-
-@node Match-self Operator, Match-any-character Operator, , Common Operators
-@section The Match-self Operator (@var{ordinary character})
-
-This operator matches the character itself. All ordinary characters
-(@pxref{Regular Expression Syntax}) represent this operator. For
-example, @samp{f} is always an ordinary character, so the regular
-expression @samp{f} matches only the string @samp{f}. In
-particular, it does @emph{not} match the string @samp{ff}.
-
-@node Match-any-character Operator, Concatenation Operator, Match-self Operator, Common Operators
-@section The Match-any-character Operator (@code{.})
-
-@cindex @samp{.}
-
-This operator matches any single printing or nonprinting character
-except it won't match a:
-
-@table @asis
-@item newline
-if the syntax bit @code{RE_DOT_NEWLINE} isn't set.
-
-@item null
-if the syntax bit @code{RE_DOT_NOT_NULL} is set.
-
-@end table
-
-The @samp{.} (period) character represents this operator. For example,
-@samp{a.b} matches any three-character string beginning with @samp{a}
-and ending with @samp{b}.
-
-@node Concatenation Operator, Repetition Operators, Match-any-character Operator, Common Operators
-@section The Concatenation Operator
-
-This operator concatenates two regular expressions @var{a} and @var{b}.
-No character represents this operator; you simply put @var{b} after
-@var{a}. The result is a regular expression that will match a string if
-@var{a} matches its first part and @var{b} matches the rest. For
-example, @samp{xy} (two match-self operators) matches @samp{xy}.
-
-@node Repetition Operators, Alternation Operator, Concatenation Operator, Common Operators
-@section Repetition Operators
-
-Repetition operators repeat the preceding regular expression a specified
-number of times.
-
-@menu
-* Match-zero-or-more Operator:: *
-* Match-one-or-more Operator:: +
-* Match-zero-or-one Operator:: ?
-* Interval Operators:: @{@}
-@end menu
-
-@node Match-zero-or-more Operator, Match-one-or-more Operator, , Repetition Operators
-@subsection The Match-zero-or-more Operator (@code{*})
-
-@cindex @samp{*}
-
-This operator repeats the smallest possible preceding regular expression
-as many times as necessary (including zero) to match the pattern.
-@samp{*} represents this operator. For example, @samp{o*}
-matches any string made up of zero or more @samp{o}s. Since this
-operator operates on the smallest preceding regular expression,
-@samp{fo*} has a repeating @samp{o}, not a repeating @samp{fo}. So,
-@samp{fo*} matches @samp{f}, @samp{fo}, @samp{foo}, and so on.
-
-Since the match-zero-or-more operator is a suffix operator, it may be
-useless as such when no regular expression precedes it. This is the
-case when it:
-
-@itemize @bullet
-@item
-is first in a regular expression, or
-
-@item
-follows a match-beginning-of-line, open-group, or alternation
-operator.
-
-@end itemize
-
-@noindent
-Three different things can happen in these cases:
-
-@enumerate
-@item
-If the syntax bit @code{RE_CONTEXT_INVALID_OPS} is set, then the
-regular expression is invalid.
-
-@item
-If @code{RE_CONTEXT_INVALID_OPS} isn't set, but
-@code{RE_CONTEXT_INDEP_OPS} is, then @samp{*} represents the
-match-zero-or-more operator (which then operates on the empty string).
-
-@item
-Otherwise, @samp{*} is ordinary.
-
-@end enumerate
-
-@cindex backtracking
-The matcher processes a match-zero-or-more operator by first matching as
-many repetitions of the smallest preceding regular expression as it can.
-Then it continues to match the rest of the pattern.
-
-If it can't match the rest of the pattern, it backtracks (as many times
-as necessary), each time discarding one of the matches until it can
-either match the entire pattern or be certain that it cannot get a
-match. For example, when matching @samp{ca*ar} against @samp{caaar},
-the matcher first matches all three @samp{a}s of the string with the
-@samp{a*} of the regular expression. However, it cannot then match the
-final @samp{ar} of the regular expression against the final @samp{r} of
-the string. So it backtracks, discarding the match of the last @samp{a}
-in the string. It can then match the remaining @samp{ar}.
-
-
-@node Match-one-or-more Operator, Match-zero-or-one Operator, Match-zero-or-more Operator, Repetition Operators
-@subsection The Match-one-or-more Operator (@code{+} or @code{\+})
-
-@cindex @samp{+}
-
-If the syntax bit @code{RE_LIMITED_OPS} is set, then Regex doesn't recognize
-this operator. Otherwise, if the syntax bit @code{RE_BK_PLUS_QM} isn't
-set, then @samp{+} represents this operator; if it is, then @samp{\+}
-does.
-
-This operator is similar to the match-zero-or-more operator except that
-it repeats the preceding regular expression at least once;
-@pxref{Match-zero-or-more Operator}, for what it operates on, how some
-syntax bits affect it, and how Regex backtracks to match it.
-
-For example, supposing that @samp{+} represents the match-one-or-more
-operator; then @samp{ca+r} matches, e.g., @samp{car} and
-@samp{caaaar}, but not @samp{cr}.
-
-@node Match-zero-or-one Operator, Interval Operators, Match-one-or-more Operator, Repetition Operators
-@subsection The Match-zero-or-one Operator (@code{?} or @code{\?})
-@cindex @samp{?}
-
-If the syntax bit @code{RE_LIMITED_OPS} is set, then Regex doesn't
-recognize this operator. Otherwise, if the syntax bit
-@code{RE_BK_PLUS_QM} isn't set, then @samp{?} represents this operator;
-if it is, then @samp{\?} does.
-
-This operator is similar to the match-zero-or-more operator except that
-it repeats the preceding regular expression once or not at all;
-@pxref{Match-zero-or-more Operator}, to see what it operates on, how
-some syntax bits affect it, and how Regex backtracks to match it.
-
-For example, supposing that @samp{?} represents the match-zero-or-one
-operator; then @samp{ca?r} matches both @samp{car} and @samp{cr}, but
-nothing else.
-
-@node Interval Operators, , Match-zero-or-one Operator, Repetition Operators
-@subsection Interval Operators (@code{@{} @dots{} @code{@}} or @code{\@{} @dots{} @code{\@}})
-
-@cindex interval expression
-@cindex @samp{@{}
-@cindex @samp{@}}
-@cindex @samp{\@{}
-@cindex @samp{\@}}
-
-If the syntax bit @code{RE_INTERVALS} is set, then Regex recognizes
-@dfn{interval expressions}. They repeat the smallest possible preceding
-regular expression a specified number of times.
-
-If the syntax bit @code{RE_NO_BK_BRACES} is set, @samp{@{} represents
-the @dfn{open-interval operator} and @samp{@}} represents the
-@dfn{close-interval operator} ; otherwise, @samp{\@{} and @samp{\@}} do.
-
-Specifically, supposing that @samp{@{} and @samp{@}} represent the
-open-interval and close-interval operators; then:
-
-@table @code
-@item @{@var{count}@}
-matches exactly @var{count} occurrences of the preceding regular
-expression.
-
-@item @{@var{min,}@}
-matches @var{min} or more occurrences of the preceding regular
-expression.
-
-@item @{@var{min, max}@}
-matches at least @var{min} but no more than @var{max} occurrences of
-the preceding regular expression.
-
-@end table
-
-The interval expression (but not necessarily the regular expression that
-contains it) is invalid if:
-
-@itemize @bullet
-@item
-@var{min} is greater than @var{max}, or
-
-@item
-any of @var{count}, @var{min}, or @var{max} are outside the range
-zero to @code{RE_DUP_MAX} (which symbol @file{regex.h}
-defines).
-
-@end itemize
-
-If the interval expression is invalid and the syntax bit
-@code{RE_NO_BK_BRACES} is set, then Regex considers all the
-characters in the would-be interval to be ordinary. If that bit
-isn't set, then the regular expression is invalid.
-
-If the interval expression is valid but there is no preceding regular
-expression on which to operate, then if the syntax bit
-@code{RE_CONTEXT_INVALID_OPS} is set, the regular expression is invalid.
-If that bit isn't set, then Regex considers all the characters---other
-than backslashes, which it ignores---in the would-be interval to be
-ordinary.
-
-
-@node Alternation Operator, List Operators, Repetition Operators, Common Operators
-@section The Alternation Operator (@code{|} or @code{\|})
-
-@kindex |
-@kindex \|
-@cindex alternation operator
-@cindex or operator
-
-If the syntax bit @code{RE_LIMITED_OPS} is set, then Regex doesn't
-recognize this operator. Otherwise, if the syntax bit
-@code{RE_NO_BK_VBAR} is set, then @samp{|} represents this operator;
-otherwise, @samp{\|} does.
-
-Alternatives match one of a choice of regular expressions:
-if you put the character(s) representing the alternation operator between
-any two regular expressions @var{a} and @var{b}, the result matches
-the union of the strings that @var{a} and @var{b} match. For
-example, supposing that @samp{|} is the alternation operator, then
-@samp{foo|bar|quux} would match any of @samp{foo}, @samp{bar} or
-@samp{quux}.
-
-@ignore
-@c Nobody needs to disallow empty alternatives any more.
-If the syntax bit @code{RE_NO_EMPTY_ALTS} is set, then if either of the regular
-expressions @var{a} or @var{b} is empty, the
-regular expression is invalid. More precisely, if this syntax bit is
-set, then the alternation operator can't:
-
-@itemize @bullet
-@item
-be first or last in a regular expression;
-
-@item
-follow either another alternation operator or an open-group operator
-(@pxref{Grouping Operators}); or
-
-@item
-precede a close-group operator.
-
-@end itemize
-
-@noindent
-For example, supposing @samp{(} and @samp{)} represent the open and
-close-group operators, then @samp{|foo}, @samp{foo|}, @samp{foo||bar},
-@samp{foo(|bar)}, and @samp{(foo|)bar} would all be invalid.
-@end ignore
-
-The alternation operator operates on the @emph{largest} possible
-surrounding regular expressions. (Put another way, it has the lowest
-precedence of any regular expression operator.)
-Thus, the only way you can
-delimit its arguments is to use grouping. For example, if @samp{(} and
-@samp{)} are the open and close-group operators, then @samp{fo(o|b)ar}
-would match either @samp{fooar} or @samp{fobar}. (@samp{foo|bar} would
-match @samp{foo} or @samp{bar}.)
-
-@cindex backtracking
-The matcher usually tries all combinations of alternatives so as to
-match the longest possible string. For example, when matching
-@samp{(fooq|foo)*(qbarquux|bar)} against @samp{fooqbarquux}, it cannot
-take, say, the first (``depth-first'') combination it could match, since
-then it would be content to match just @samp{fooqbar}.
-
-@comment xx something about leftmost-longest
-
-
-@node List Operators, Grouping Operators, Alternation Operator, Common Operators
-@section List Operators (@code{[} @dots{} @code{]} and @code{[^} @dots{} @code{]})
-
-@cindex matching list
-@cindex @samp{[}
-@cindex @samp{]}
-@cindex @samp{^}
-@cindex @samp{-}
-@cindex @samp{\}
-@cindex @samp{[^}
-@cindex nonmatching list
-@cindex matching newline
-@cindex bracket expression
-
-@dfn{Lists}, also called @dfn{bracket expressions}, are a set of one or
-more items. An @dfn{item} is a character,
-@ignore
-(These get added when they get implemented.)
-a collating symbol, an equivalence class expression,
-@end ignore
-a character class expression, or a range expression. The syntax bits
-affect which kinds of items you can put in a list. We explain the last
-two items in subsections below. Empty lists are invalid.
-
-A @dfn{matching list} matches a single character represented by one of
-the list items. You form a matching list by enclosing one or more items
-within an @dfn{open-matching-list operator} (represented by @samp{[})
-and a @dfn{close-list operator} (represented by @samp{]}).
-
-For example, @samp{[ab]} matches either @samp{a} or @samp{b}.
-@samp{[ad]*} matches the empty string and any string composed of just
-@samp{a}s and @samp{d}s in any order. Regex considers invalid a regular
-expression with a @samp{[} but no matching
-@samp{]}.
-
-@dfn{Nonmatching lists} are similar to matching lists except that they
-match a single character @emph{not} represented by one of the list
-items. You use an @dfn{open-nonmatching-list operator} (represented by
-@samp{[^}@footnote{Regex therefore doesn't consider the @samp{^} to be
-the first character in the list. If you put a @samp{^} character first
-in (what you think is) a matching list, you'll turn it into a
-nonmatching list.}) instead of an open-matching-list operator to start a
-nonmatching list.
-
-For example, @samp{[^ab]} matches any character except @samp{a} or
-@samp{b}.
-
-If the @code{posix_newline} field in the pattern buffer (@pxref{GNU
-Pattern Buffers} is set, then nonmatching lists do not match a newline.
-
-Most characters lose any special meaning inside a list. The special
-characters inside a list follow.
-
-@table @samp
-@item ]
-ends the list if it's not the first list item. So, if you want to make
-the @samp{]} character a list item, you must put it first.
-
-@item \
-quotes the next character if the syntax bit @code{RE_BACKSLASH_ESCAPE_IN_LISTS} is
-set.
-
-@ignore
-Put these in if they get implemented.
-
-@item [.
-represents the open-collating-symbol operator (@pxref{Collating Symbol
-Operators}).
-
-@item .]
-represents the close-collating-symbol operator.
-
-@item [=
-represents the open-equivalence-class operator (@pxref{Equivalence Class
-Operators}).
-
-@item =]
-represents the close-equivalence-class operator.
-
-@end ignore
-
-@item [:
-represents the open-character-class operator (@pxref{Character Class
-Operators}) if the syntax bit @code{RE_CHAR_CLASSES} is set and what
-follows is a valid character class expression.
-
-@item :]
-represents the close-character-class operator if the syntax bit
-@code{RE_CHAR_CLASSES} is set and what precedes it is an
-open-character-class operator followed by a valid character class name.
-
-@item -
-represents the range operator (@pxref{Range Operator}) if it's
-not first or last in a list or the ending point of a range.
-
-@end table
-
-@noindent
-All other characters are ordinary. For example, @samp{[.*]} matches
-@samp{.} and @samp{*}.
-
-@menu
-* Character Class Operators:: [:class:]
-* Range Operator:: start-end
-@end menu
-
-@ignore
-(If collating symbols and equivalence class expressions get implemented,
-then add this.)
-
-node Collating Symbol Operators
-subsubsection Collating Symbol Operators (@code{[.} @dots{} @code{.]})
-
-If the syntax bit @code{XX} is set, then you can represent
-collating symbols inside lists. You form a @dfn{collating symbol} by
-putting a collating element between an @dfn{open-collating-symbol
-operator} and an @dfn{close-collating-symbol operator}. @samp{[.}
-represents the open-collating-symbol operator and @samp{.]} represents
-the close-collating-symbol operator. For example, if @samp{ll} is a
-collating element, then @samp{[[.ll.]]} would match @samp{ll}.
-
-node Equivalence Class Operators
-subsubsection Equivalence Class Operators (@code{[=} @dots{} @code{=]})
-@cindex equivalence class expression in regex
-@cindex @samp{[=} in regex
-@cindex @samp{=]} in regex
-
-If the syntax bit @code{XX} is set, then Regex recognizes equivalence class
-expressions inside lists. A @dfn{equivalence class expression} is a set
-of collating elements which all belong to the same equivalence class.
-You form an equivalence class expression by putting a collating
-element between an @dfn{open-equivalence-class operator} and a
-@dfn{close-equivalence-class operator}. @samp{[=} represents the
-open-equivalence-class operator and @samp{=]} represents the
-close-equivalence-class operator. For example, if @samp{a} and @samp{A}
-were an equivalence class, then both @samp{[[=a=]]} and @samp{[[=A=]]}
-would match both @samp{a} and @samp{A}. If the collating element in an
-equivalence class expression isn't part of an equivalence class, then
-the matcher considers the equivalence class expression to be a collating
-symbol.
-
-@end ignore
-
-@node Character Class Operators, Range Operator, , List Operators
-@subsection Character Class Operators (@code{[:} @dots{} @code{:]})
-
-@cindex character classes
-@cindex @samp{[:} in regex
-@cindex @samp{:]} in regex
-
-If the syntax bit @code{RE_CHARACTER_CLASSES} is set, then Regex
-recognizes character class expressions inside lists. A @dfn{character
-class expression} matches one character from a given class. You form a
-character class expression by putting a character class name between an
-@dfn{open-character-class operator} (represented by @samp{[:}) and a
-@dfn{close-character-class operator} (represented by @samp{:]}). The
-character class names and their meanings are:
-
-@table @code
-
-@item alnum
-letters and digits
-
-@item alpha
-letters
-
-@item blank
-system-dependent; for @sc{gnu}, a space or tab
-
-@item cntrl
-control characters (in the @sc{ascii} encoding, code 0177 and codes
-less than 040)
-
-@item digit
-digits
-
-@item graph
-same as @code{print} except omits space
-
-@item lower
-lowercase letters
-
-@item print
-printable characters (in the @sc{ascii} encoding, space
-tilde---codes 040 through 0176)
-
-@item punct
-neither control nor alphanumeric characters
-
-@item space
-space, carriage return, newline, vertical tab, and form feed
-
-@item upper
-uppercase letters
-
-@item xdigit
-hexadecimal digits: @code{0}--@code{9}, @code{a}--@code{f}, @code{A}--@code{F}
-
-@end table
-
-@noindent
-These correspond to the definitions in the C library's @file{<ctype.h>}
-facility. For example, @samp{[:alpha:]} corresponds to the standard
-facility @code{isalpha}. Regex recognizes character class expressions
-only inside of lists; so @samp{[[:alpha:]]} matches any letter, but
-@samp{[:alpha:]} outside of a bracket expression and not followed by a
-repetition operator matches just itself.
-
-@node Range Operator, , Character Class Operators, List Operators
-@subsection The Range Operator (@code{-})
-
-Regex recognizes @dfn{range expressions} inside a list. They represent
-those characters
-that fall between two elements in the current collating sequence. You
-form a range expression by putting a @dfn{range operator} between two
-@ignore
-(If these get implemented, then substitute this for ``characters.'')
-of any of the following: characters, collating elements, collating symbols,
-and equivalence class expressions. The starting point of the range and
-the ending point of the range don't have to be the same kind of item,
-e.g., the starting point could be a collating element and the ending
-point could be an equivalence class expression. If a range's ending
-point is an equivalence class, then all the collating elements in that
-class will be in the range.
-@end ignore
-characters.@footnote{You can't use a character class for the starting
-or ending point of a range, since a character class is not a single
-character.} @samp{-} represents the range operator. For example,
-@samp{a-f} within a list represents all the characters from @samp{a}
-through @samp{f}
-inclusively.
-
-If the syntax bit @code{RE_NO_EMPTY_RANGES} is set, then if the range's
-ending point collates less than its starting point, the range (and the
-regular expression containing it) is invalid. For example, the regular
-expression @samp{[z-a]} would be invalid. If this bit isn't set, then
-Regex considers such a range to be empty.
-
-Since @samp{-} represents the range operator, if you want to make a
-@samp{-} character itself
-a list item, you must do one of the following:
-
-@itemize @bullet
-@item
-Put the @samp{-} either first or last in the list.
-
-@item
-Include a range whose starting point collates strictly lower than
-@samp{-} and whose ending point collates equal or higher. Unless a
-range is the first item in a list, a @samp{-} can't be its starting
-point, but @emph{can} be its ending point. That is because Regex
-considers @samp{-} to be the range operator unless it is preceded by
-another @samp{-}. For example, in the @sc{ascii} encoding, @samp{)},
-@samp{*}, @samp{+}, @samp{,}, @samp{-}, @samp{.}, and @samp{/} are
-contiguous characters in the collating sequence. You might think that
-@samp{[)-+--/]} has two ranges: @samp{)-+} and @samp{--/}. Rather, it
-has the ranges @samp{)-+} and @samp{+--}, plus the character @samp{/}, so
-it matches, e.g., @samp{,}, not @samp{.}.
-
-@item
-Put a range whose starting point is @samp{-} first in the list.
-
-@end itemize
-
-For example, @samp{[-a-z]} matches a lowercase letter or a hyphen (in
-English, in @sc{ascii}).
-
-
-@node Grouping Operators, Back-reference Operator, List Operators, Common Operators
-@section Grouping Operators (@code{(} @dots{} @code{)} or @code{\(} @dots{} @code{\)})
-
-@kindex (
-@kindex )
-@kindex \(
-@kindex \)
-@cindex grouping
-@cindex subexpressions
-@cindex parenthesizing
-
-A @dfn{group}, also known as a @dfn{subexpression}, consists of an
-@dfn{open-group operator}, any number of other operators, and a
-@dfn{close-group operator}. Regex treats this sequence as a unit, just
-as mathematics and programming languages treat a parenthesized
-expression as a unit.
-
-Therefore, using @dfn{groups}, you can:
-
-@itemize @bullet
-@item
-delimit the argument(s) to an alternation operator (@pxref{Alternation
-Operator}) or a repetition operator (@pxref{Repetition
-Operators}).
-
-@item
-keep track of the indices of the substring that matched a given group.
-@xref{Using Registers}, for a precise explanation.
-This lets you:
-
-@itemize @bullet
-@item
-use the back-reference operator (@pxref{Back-reference Operator}).
-
-@item
-use registers (@pxref{Using Registers}).
-
-@end itemize
-
-@end itemize
-
-If the syntax bit @code{RE_NO_BK_PARENS} is set, then @samp{(} represents
-the open-group operator and @samp{)} represents the
-close-group operator; otherwise, @samp{\(} and @samp{\)} do.
-
-If the syntax bit @code{RE_UNMATCHED_RIGHT_PAREN_ORD} is set and a
-close-group operator has no matching open-group operator, then Regex
-considers it to match @samp{)}.
-
-
-@node Back-reference Operator, Anchoring Operators, Grouping Operators, Common Operators
-@section The Back-reference Operator (@dfn{\}@var{digit})
-
-@cindex back references
-
-If the syntax bit @code{RE_NO_BK_REF} isn't set, then Regex recognizes
-back references. A back reference matches a specified preceding group.
-The back reference operator is represented by @samp{\@var{digit}}
-anywhere after the end of a regular expression's @w{@var{digit}-th}
-group (@pxref{Grouping Operators}).
-
-@var{digit} must be between @samp{1} and @samp{9}. The matcher assigns
-numbers 1 through 9 to the first nine groups it encounters. By using
-one of @samp{\1} through @samp{\9} after the corresponding group's
-close-group operator, you can match a substring identical to the
-one that the group does.
-
-Back references match according to the following (in all examples below,
-@samp{(} represents the open-group, @samp{)} the close-group, @samp{@{}
-the open-interval and @samp{@}} the close-interval operator):
-
-@itemize @bullet
-@item
-If the group matches a substring, the back reference matches an
-identical substring. For example, @samp{(a)\1} matches @samp{aa} and
-@samp{(bana)na\1bo\1} matches @samp{bananabanabobana}. Likewise,
-@samp{(.*)\1} matches any (newline-free if the syntax bit
-@code{RE_DOT_NEWLINE} isn't set) string that is composed of two
-identical halves; the @samp{(.*)} matches the first half and the
-@samp{\1} matches the second half.
-
-@item
-If the group matches more than once (as it might if followed
-by, e.g., a repetition operator), then the back reference matches the
-substring the group @emph{last} matched. For example,
-@samp{((a*)b)*\1\2} matches @samp{aabababa}; first @w{group 1} (the
-outer one) matches @samp{aab} and @w{group 2} (the inner one) matches
-@samp{aa}. Then @w{group 1} matches @samp{ab} and @w{group 2} matches
-@samp{a}. So, @samp{\1} matches @samp{ab} and @samp{\2} matches
-@samp{a}.
-
-@item
-If the group doesn't participate in a match, i.e., it is part of an
-alternative not taken or a repetition operator allows zero repetitions
-of it, then the back reference makes the whole match fail. For example,
-@samp{(one()|two())-and-(three\2|four\3)} matches @samp{one-and-three}
-and @samp{two-and-four}, but not @samp{one-and-four} or
-@samp{two-and-three}. For example, if the pattern matches
-@samp{one-and-}, then its @w{group 2} matches the empty string and its
-@w{group 3} doesn't participate in the match. So, if it then matches
-@samp{four}, then when it tries to back reference @w{group 3}---which it
-will attempt to do because @samp{\3} follows the @samp{four}---the match
-will fail because @w{group 3} didn't participate in the match.
-
-@end itemize
-
-You can use a back reference as an argument to a repetition operator. For
-example, @samp{(a(b))\2*} matches @samp{a} followed by two or more
-@samp{b}s. Similarly, @samp{(a(b))\2@{3@}} matches @samp{abbbb}.
-
-If there is no preceding @w{@var{digit}-th} subexpression, the regular
-expression is invalid.
-
-
-@node Anchoring Operators, , Back-reference Operator, Common Operators
-@section Anchoring Operators
-
-@cindex anchoring
-@cindex regexp anchoring
-
-These operators can constrain a pattern to match only at the beginning or
-end of the entire string or at the beginning or end of a line.
-
-@menu
-* Match-beginning-of-line Operator:: ^
-* Match-end-of-line Operator:: $
-@end menu
-
-
-@node Match-beginning-of-line Operator, Match-end-of-line Operator, , Anchoring Operators
-@subsection The Match-beginning-of-line Operator (@code{^})
-
-@kindex ^
-@cindex beginning-of-line operator
-@cindex anchors
-
-This operator can match the empty string either at the beginning of the
-string or after a newline character. Thus, it is said to @dfn{anchor}
-the pattern to the beginning of a line.
-
-In the cases following, @samp{^} represents this operator. (Otherwise,
-@samp{^} is ordinary.)
-
-@itemize @bullet
-
-@item
-It (the @samp{^}) is first in the pattern, as in @samp{^foo}.
-
-@cnindex RE_CONTEXT_INDEP_ANCHORS @r{(and @samp{^})}
-@item
-The syntax bit @code{RE_CONTEXT_INDEP_ANCHORS} is set, and it is outside
-a bracket expression.
-
-@cindex open-group operator and @samp{^}
-@cindex alternation operator and @samp{^}
-@item
-It follows an open-group or alternation operator, as in @samp{a\(^b\)}
-and @samp{a\|^b}. @xref{Grouping Operators}, and @ref{Alternation
-Operator}.
-
-@end itemize
-
-These rules imply that some valid patterns containing @samp{^} cannot be
-matched; for example, @samp{foo^bar} if @code{RE_CONTEXT_INDEP_ANCHORS}
-is set.
-
-@vindex not_bol @r{field in pattern buffer}
-If the @code{not_bol} field is set in the pattern buffer (@pxref{GNU
-Pattern Buffers}), then @samp{^} fails to match at the beginning of the
-string. @xref{POSIX Matching}, for when you might find this useful.
-
-@vindex newline_anchor @r{field in pattern buffer}
-If the @code{newline_anchor} field is set in the pattern buffer, then
-@samp{^} fails to match after a newline. This is useful when you do not
-regard the string to be matched as broken into lines.
-
-
-@node Match-end-of-line Operator, , Match-beginning-of-line Operator, Anchoring Operators
-@subsection The Match-end-of-line Operator (@code{$})
-
-@kindex $
-@cindex end-of-line operator
-@cindex anchors
-
-This operator can match the empty string either at the end of
-the string or before a newline character in the string. Thus, it is
-said to @dfn{anchor} the pattern to the end of a line.
-
-It is always represented by @samp{$}. For example, @samp{foo$} usually
-matches, e.g., @samp{foo} and, e.g., the first three characters of
-@samp{foo\nbar}.
-
-Its interaction with the syntax bits and pattern buffer fields is
-exactly the dual of @samp{^}'s; see the previous section. (That is,
-``beginning'' becomes ``end'', ``next'' becomes ``previous'', and
-``after'' becomes ``before''.)
-
-
-@node GNU Operators, GNU Emacs Operators, Common Operators, Top
-@chapter GNU Operators
-
-Following are operators that @sc{gnu} defines (and @sc{posix} doesn't).
-
-@menu
-* Word Operators::
-* Buffer Operators::
-@end menu
-
-@node Word Operators, Buffer Operators, , GNU Operators
-@section Word Operators
-
-The operators in this section require Regex to recognize parts of words.
-Regex uses a syntax table to determine whether or not a character is
-part of a word, i.e., whether or not it is @dfn{word-constituent}.
-
-@menu
-* Non-Emacs Syntax Tables::
-* Match-word-boundary Operator:: \b
-* Match-within-word Operator:: \B
-* Match-beginning-of-word Operator:: \<
-* Match-end-of-word Operator:: \>
-* Match-word-constituent Operator:: \w
-* Match-non-word-constituent Operator:: \W
-@end menu
-
-@node Non-Emacs Syntax Tables, Match-word-boundary Operator, , Word Operators
-@subsection Non-Emacs Syntax Tables
-
-A @dfn{syntax table} is an array indexed by the characters in your
-character set. In the @sc{ascii} encoding, therefore, a syntax table
-has 256 elements. Regex always uses a @code{char *} variable
-@code{re_syntax_table} as its syntax table. In some cases, it
-initializes this variable and in others it expects you to initialize it.
-
-@itemize @bullet
-@item
-If Regex is compiled with the preprocessor symbols @code{emacs} and
-@code{SYNTAX_TABLE} both undefined, then Regex allocates
-@code{re_syntax_table} and initializes an element @var{i} either to
-@code{Sword} (which it defines) if @var{i} is a letter, number, or
-@samp{_}, or to zero if it's not.
-
-@item
-If Regex is compiled with @code{emacs} undefined but @code{SYNTAX_TABLE}
-defined, then Regex expects you to define a @code{char *} variable
-@code{re_syntax_table} to be a valid syntax table.
-
-@item
-@xref{Emacs Syntax Tables}, for what happens when Regex is compiled with
-the preprocessor symbol @code{emacs} defined.
-
-@end itemize
-
-@node Match-word-boundary Operator, Match-within-word Operator, Non-Emacs Syntax Tables, Word Operators
-@subsection The Match-word-boundary Operator (@code{\b})
-
-@cindex @samp{\b}
-@cindex word boundaries, matching
-
-This operator (represented by @samp{\b}) matches the empty string at
-either the beginning or the end of a word. For example, @samp{\brat\b}
-matches the separate word @samp{rat}.
-
-@node Match-within-word Operator, Match-beginning-of-word Operator, Match-word-boundary Operator, Word Operators
-@subsection The Match-within-word Operator (@code{\B})
-
-@cindex @samp{\B}
-
-This operator (represented by @samp{\B}) matches the empty string within
-a word. For example, @samp{c\Brat\Be} matches @samp{crate}, but
-@samp{dirty \Brat} doesn't match @samp{dirty rat}.
-
-@node Match-beginning-of-word Operator, Match-end-of-word Operator, Match-within-word Operator, Word Operators
-@subsection The Match-beginning-of-word Operator (@code{\<})
-
-@cindex @samp{\<}
-
-This operator (represented by @samp{\<}) matches the empty string at the
-beginning of a word.
-
-@node Match-end-of-word Operator, Match-word-constituent Operator, Match-beginning-of-word Operator, Word Operators
-@subsection The Match-end-of-word Operator (@code{\>})
-
-@cindex @samp{\>}
-
-This operator (represented by @samp{\>}) matches the empty string at the
-end of a word.
-
-@node Match-word-constituent Operator, Match-non-word-constituent Operator, Match-end-of-word Operator, Word Operators
-@subsection The Match-word-constituent Operator (@code{\w})
-
-@cindex @samp{\w}
-
-This operator (represented by @samp{\w}) matches any word-constituent
-character.
-
-@node Match-non-word-constituent Operator, , Match-word-constituent Operator, Word Operators
-@subsection The Match-non-word-constituent Operator (@code{\W})
-
-@cindex @samp{\W}
-
-This operator (represented by @samp{\W}) matches any character that is
-not word-constituent.
-
-
-@node Buffer Operators, , Word Operators, GNU Operators
-@section Buffer Operators
-
-Following are operators which work on buffers. In Emacs, a @dfn{buffer}
-is, naturally, an Emacs buffer. For other programs, Regex considers the
-entire string to be matched as the buffer.
-
-@menu
-* Match-beginning-of-buffer Operator:: \`
-* Match-end-of-buffer Operator:: \'
-@end menu
-
-
-@node Match-beginning-of-buffer Operator, Match-end-of-buffer Operator, , Buffer Operators
-@subsection The Match-beginning-of-buffer Operator (@code{\`})
-
-@cindex @samp{\`}
-
-This operator (represented by @samp{\`}) matches the empty string at the
-beginning of the buffer.
-
-@node Match-end-of-buffer Operator, , Match-beginning-of-buffer Operator, Buffer Operators
-@subsection The Match-end-of-buffer Operator (@code{\'})
-
-@cindex @samp{\'}
-
-This operator (represented by @samp{\'}) matches the empty string at the
-end of the buffer.
-
-
-@node GNU Emacs Operators, What Gets Matched?, GNU Operators, Top
-@chapter GNU Emacs Operators
-
-Following are operators that @sc{gnu} defines (and @sc{posix} doesn't)
-that you can use only when Regex is compiled with the preprocessor
-symbol @code{emacs} defined.
-
-@menu
-* Syntactic Class Operators::
-@end menu
-
-
-@node Syntactic Class Operators, , , GNU Emacs Operators
-@section Syntactic Class Operators
-
-The operators in this section require Regex to recognize the syntactic
-classes of characters. Regex uses a syntax table to determine this.
-
-@menu
-* Emacs Syntax Tables::
-* Match-syntactic-class Operator:: \sCLASS
-* Match-not-syntactic-class Operator:: \SCLASS
-@end menu
-
-@node Emacs Syntax Tables, Match-syntactic-class Operator, , Syntactic Class Operators
-@subsection Emacs Syntax Tables
-
-A @dfn{syntax table} is an array indexed by the characters in your
-character set. In the @sc{ascii} encoding, therefore, a syntax table
-has 256 elements.
-
-If Regex is compiled with the preprocessor symbol @code{emacs} defined,
-then Regex expects you to define and initialize the variable
-@code{re_syntax_table} to be an Emacs syntax table. Emacs' syntax
-tables are more complicated than Regex's own (@pxref{Non-Emacs Syntax
-Tables}). @xref{Syntax, , Syntax, emacs, The GNU Emacs User's Manual},
-for a description of Emacs' syntax tables.
-
-@node Match-syntactic-class Operator, Match-not-syntactic-class Operator, Emacs Syntax Tables, Syntactic Class Operators
-@subsection The Match-syntactic-class Operator (@code{\s}@var{class})
-
-@cindex @samp{\s}
-
-This operator matches any character whose syntactic class is represented
-by a specified character. @samp{\s@var{class}} represents this operator
-where @var{class} is the character representing the syntactic class you
-want. For example, @samp{w} represents the syntactic
-class of word-constituent characters, so @samp{\sw} matches any
-word-constituent character.
-
-@node Match-not-syntactic-class Operator, , Match-syntactic-class Operator, Syntactic Class Operators
-@subsection The Match-not-syntactic-class Operator (@code{\S}@var{class})
-
-@cindex @samp{\S}
-
-This operator is similar to the match-syntactic-class operator except
-that it matches any character whose syntactic class is @emph{not}
-represented by the specified character. @samp{\S@var{class}} represents
-this operator. For example, @samp{w} represents the syntactic class of
-word-constituent characters, so @samp{\Sw} matches any character that is
-not word-constituent.
-
-
-@node What Gets Matched?, Programming with Regex, GNU Emacs Operators, Top
-@chapter What Gets Matched?
-
-Regex usually matches strings according to the ``leftmost longest''
-rule; that is, it chooses the longest of the leftmost matches. This
-does not mean that for a regular expression containing subexpressions
-that it simply chooses the longest match for each subexpression, left to
-right; the overall match must also be the longest possible one.
-
-For example, @samp{(ac*)(c*d[ac]*)\1} matches @samp{acdacaaa}, not
-@samp{acdac}, as it would if it were to choose the longest match for the
-first subexpression.
-
-
-@node Programming with Regex, Copying, What Gets Matched?, Top
-@chapter Programming with Regex
-
-Here we describe how you use the Regex data structures and functions in
-C programs. Regex has three interfaces: one designed for @sc{gnu}, one
-compatible with @sc{posix} and one compatible with Berkeley @sc{unix}.
-
-@menu
-* GNU Regex Functions::
-* POSIX Regex Functions::
-* BSD Regex Functions::
-@end menu
-
-
-@node GNU Regex Functions, POSIX Regex Functions, , Programming with Regex
-@section GNU Regex Functions
-
-If you're writing code that doesn't need to be compatible with either
-@sc{posix} or Berkeley @sc{unix}, you can use these functions. They
-provide more options than the other interfaces.
-
-@menu
-* GNU Pattern Buffers:: The re_pattern_buffer type.
-* GNU Regular Expression Compiling:: re_compile_pattern ()
-* GNU Matching:: re_match ()
-* GNU Searching:: re_search ()
-* Matching/Searching with Split Data:: re_match_2 (), re_search_2 ()
-* Searching with Fastmaps:: re_compile_fastmap ()
-* GNU Translate Tables:: The `translate' field.
-* Using Registers:: The re_registers type and related fns.
-* Freeing GNU Pattern Buffers:: regfree ()
-@end menu
-
-
-@node GNU Pattern Buffers, GNU Regular Expression Compiling, , GNU Regex Functions
-@subsection GNU Pattern Buffers
-
-@cindex pattern buffer, definition of
-@tindex re_pattern_buffer @r{definition}
-@tindex struct re_pattern_buffer @r{definition}
-
-To compile, match, or search for a given regular expression, you must
-supply a pattern buffer. A @dfn{pattern buffer} holds one compiled
-regular expression.@footnote{Regular expressions are also referred to as
-``patterns,'' hence the name ``pattern buffer.''}
-
-You can have several different pattern buffers simultaneously, each
-holding a compiled pattern for a different regular expression.
-
-@file{regex.h} defines the pattern buffer @code{struct} as follows:
-
-@example
- /* Space that holds the compiled pattern. It is declared as
- `unsigned char *' because its elements are
- sometimes used as array indexes. */
- unsigned char *buffer;
-
- /* Number of bytes to which `buffer' points. */
- unsigned long allocated;
-
- /* Number of bytes actually used in `buffer'. */
- unsigned long used;
-
- /* Syntax setting with which the pattern was compiled. */
- reg_syntax_t syntax;
-
- /* Pointer to a fastmap, if any, otherwise zero. re_search uses
- the fastmap, if there is one, to skip over impossible
- starting points for matches. */
- char *fastmap;
-
- /* Either a translate table to apply to all characters before
- comparing them, or zero for no translation. The translation
- is applied to a pattern when it is compiled and to a string
- when it is matched. */
- char *translate;
-
- /* Number of subexpressions found by the compiler. */
- size_t re_nsub;
-
- /* Zero if this pattern cannot match the empty string, one else.
- Well, in truth it's used only in `re_search_2', to see
- whether or not we should use the fastmap, so we don't set
- this absolutely perfectly; see `re_compile_fastmap' (the
- `duplicate' case). */
- unsigned can_be_null : 1;
-
- /* If REGS_UNALLOCATED, allocate space in the `regs' structure
- for `max (RE_NREGS, re_nsub + 1)' groups.
- If REGS_REALLOCATE, reallocate space if necessary.
- If REGS_FIXED, use what's there. */
-#define REGS_UNALLOCATED 0
-#define REGS_REALLOCATE 1
-#define REGS_FIXED 2
- unsigned regs_allocated : 2;
-
- /* Set to zero when `regex_compile' compiles a pattern; set to one
- by `re_compile_fastmap' if it updates the fastmap. */
- unsigned fastmap_accurate : 1;
-
- /* If set, `re_match_2' does not return information about
- subexpressions. */
- unsigned no_sub : 1;
-
- /* If set, a beginning-of-line anchor doesn't match at the
- beginning of the string. */
- unsigned not_bol : 1;
-
- /* Similarly for an end-of-line anchor. */
- unsigned not_eol : 1;
-
- /* If true, an anchor at a newline matches. */
- unsigned newline_anchor : 1;
-
-@end example
-
-
-@node GNU Regular Expression Compiling, GNU Matching, GNU Pattern Buffers, GNU Regex Functions
-@subsection GNU Regular Expression Compiling
-
-In @sc{gnu}, you can both match and search for a given regular
-expression. To do either, you must first compile it in a pattern buffer
-(@pxref{GNU Pattern Buffers}).
-
-@cindex syntax initialization
-@vindex re_syntax_options @r{initialization}
-Regular expressions match according to the syntax with which they were
-compiled; with @sc{gnu}, you indicate what syntax you want by setting
-the variable @code{re_syntax_options} (declared in @file{regex.h} and
-defined in @file{regex.c}) before calling the compiling function,
-@code{re_compile_pattern} (see below). @xref{Syntax Bits}, and
-@ref{Predefined Syntaxes}.
-
-You can change the value of @code{re_syntax_options} at any time.
-Usually, however, you set its value once and then never change it.
-
-@cindex pattern buffer initialization
-@code{re_compile_pattern} takes a pattern buffer as an argument. You
-must initialize the following fields:
-
-@table @code
-
-@item translate @r{initialization}
-
-@item translate
-@vindex translate @r{initialization}
-Initialize this to point to a translate table if you want one, or to
-zero if you don't. We explain translate tables in @ref{GNU Translate
-Tables}.
-
-@item fastmap
-@vindex fastmap @r{initialization}
-Initialize this to nonzero if you want a fastmap, or to zero if you
-don't.
-
-@item buffer
-@itemx allocated
-@vindex buffer @r{initialization}
-@vindex allocated @r{initialization}
-@findex malloc
-If you want @code{re_compile_pattern} to allocate memory for the
-compiled pattern, set both of these to zero. If you have an existing
-block of memory (allocated with @code{malloc}) you want Regex to use,
-set @code{buffer} to its address and @code{allocated} to its size (in
-bytes).
-
-@code{re_compile_pattern} uses @code{realloc} to extend the space for
-the compiled pattern as necessary.
-
-@end table
-
-To compile a pattern buffer, use:
-
-@findex re_compile_pattern
-@example
-char *
-re_compile_pattern (const char *@var{regex}, const int @var{regex_size},
- struct re_pattern_buffer *@var{pattern_buffer})
-@end example
-
-@noindent
-@var{regex} is the regular expression's address, @var{regex_size} is its
-length, and @var{pattern_buffer} is the pattern buffer's address.
-
-If @code{re_compile_pattern} successfully compiles the regular
-expression, it returns zero and sets @code{*@var{pattern_buffer}} to the
-compiled pattern. It sets the pattern buffer's fields as follows:
-
-@table @code
-@item buffer
-@vindex buffer @r{field, set by @code{re_compile_pattern}}
-to the compiled pattern.
-
-@item used
-@vindex used @r{field, set by @code{re_compile_pattern}}
-to the number of bytes the compiled pattern in @code{buffer} occupies.
-
-@item syntax
-@vindex syntax @r{field, set by @code{re_compile_pattern}}
-to the current value of @code{re_syntax_options}.
-
-@item re_nsub
-@vindex re_nsub @r{field, set by @code{re_compile_pattern}}
-to the number of subexpressions in @var{regex}.
-
-@item fastmap_accurate
-@vindex fastmap_accurate @r{field, set by @code{re_compile_pattern}}
-to zero on the theory that the pattern you're compiling is different
-than the one previously compiled into @code{buffer}; in that case (since
-you can't make a fastmap without a compiled pattern),
-@code{fastmap} would either contain an incompatible fastmap, or nothing
-at all.
-
-@c xx what else?
-@end table
-
-If @code{re_compile_pattern} can't compile @var{regex}, it returns an
-error string corresponding to one of the errors listed in @ref{POSIX
-Regular Expression Compiling}.
-
-
-@node GNU Matching, GNU Searching, GNU Regular Expression Compiling, GNU Regex Functions
-@subsection GNU Matching
-
-@cindex matching with GNU functions
-
-Matching the @sc{gnu} way means trying to match as much of a string as
-possible starting at a position within it you specify. Once you've compiled
-a pattern into a pattern buffer (@pxref{GNU Regular Expression
-Compiling}), you can ask the matcher to match that pattern against a
-string using:
-
-@findex re_match
-@example
-int
-re_match (struct re_pattern_buffer *@var{pattern_buffer},
- const char *@var{string}, const int @var{size},
- const int @var{start}, struct re_registers *@var{regs})
-@end example
-
-@noindent
-@var{pattern_buffer} is the address of a pattern buffer containing a
-compiled pattern. @var{string} is the string you want to match; it can
-contain newline and null characters. @var{size} is the length of that
-string. @var{start} is the string index at which you want to
-begin matching; the first character of @var{string} is at index zero.
-@xref{Using Registers}, for a explanation of @var{regs}; you can safely
-pass zero.
-
-@code{re_match} matches the regular expression in @var{pattern_buffer}
-against the string @var{string} according to the syntax in
-@var{pattern_buffers}'s @code{syntax} field. (@xref{GNU Regular
-Expression Compiling}, for how to set it.) The function returns
-@math{-1} if the compiled pattern does not match any part of
-@var{string} and @math{-2} if an internal error happens; otherwise, it
-returns how many (possibly zero) characters of @var{string} the pattern
-matched.
-
-An example: suppose @var{pattern_buffer} points to a pattern buffer
-containing the compiled pattern for @samp{a*}, and @var{string} points
-to @samp{aaaaab} (whereupon @var{size} should be 6). Then if @var{start}
-is 2, @code{re_match} returns 3, i.e., @samp{a*} would have matched the
-last three @samp{a}s in @var{string}. If @var{start} is 0,
-@code{re_match} returns 5, i.e., @samp{a*} would have matched all the
-@samp{a}s in @var{string}. If @var{start} is either 5 or 6, it returns
-zero.
-
-If @var{start} is not between zero and @var{size}, then
-@code{re_match} returns @math{-1}.
-
-
-@node GNU Searching, Matching/Searching with Split Data, GNU Matching, GNU Regex Functions
-@subsection GNU Searching
-
-@cindex searching with GNU functions
-
-@dfn{Searching} means trying to match starting at successive positions
-within a string. The function @code{re_search} does this.
-
-Before calling @code{re_search}, you must compile your regular
-expression. @xref{GNU Regular Expression Compiling}.
-
-Here is the function declaration:
-
-@findex re_search
-@example
-int
-re_search (struct re_pattern_buffer *@var{pattern_buffer},
- const char *@var{string}, const int @var{size},
- const int @var{start}, const int @var{range},
- struct re_registers *@var{regs})
-@end example
-
-@noindent
-@vindex start @r{argument to @code{re_search}}
-@vindex range @r{argument to @code{re_search}}
-whose arguments are the same as those to @code{re_match} (@pxref{GNU
-Matching}) except that the two arguments @var{start} and @var{range}
-replace @code{re_match}'s argument @var{start}.
-
-If @var{range} is positive, then @code{re_search} attempts a match
-starting first at index @var{start}, then at @math{@var{start} + 1} if
-that fails, and so on, up to @math{@var{start} + @var{range}}; if
-@var{range} is negative, then it attempts a match starting first at
-index @var{start}, then at @math{@var{start} -1} if that fails, and so
-on.
-
-If @var{start} is not between zero and @var{size}, then @code{re_search}
-returns @math{-1}. When @var{range} is positive, @code{re_search}
-adjusts @var{range} so that @math{@var{start} + @var{range} - 1} is
-between zero and @var{size}, if necessary; that way it won't search
-outside of @var{string}. Similarly, when @var{range} is negative,
-@code{re_search} adjusts @var{range} so that @math{@var{start} +
-@var{range} + 1} is between zero and @var{size}, if necessary.
-
-If the @code{fastmap} field of @var{pattern_buffer} is zero,
-@code{re_search} matches starting at consecutive positions; otherwise,
-it uses @code{fastmap} to make the search more efficient.
-@xref{Searching with Fastmaps}.
-
-If no match is found, @code{re_search} returns @math{-1}. If
-a match is found, it returns the index where the match began. If an
-internal error happens, it returns @math{-2}.
-
-
-@node Matching/Searching with Split Data, Searching with Fastmaps, GNU Searching, GNU Regex Functions
-@subsection Matching and Searching with Split Data
-
-Using the functions @code{re_match_2} and @code{re_search_2}, you can
-match or search in data that is divided into two strings.
-
-The function:
-
-@findex re_match_2
-@example
-int
-re_match_2 (struct re_pattern_buffer *@var{buffer},
- const char *@var{string1}, const int @var{size1},
- const char *@var{string2}, const int @var{size2},
- const int @var{start},
- struct re_registers *@var{regs},
- const int @var{stop})
-@end example
-
-@noindent
-is similar to @code{re_match} (@pxref{GNU Matching}) except that you
-pass @emph{two} data strings and sizes, and an index @var{stop} beyond
-which you don't want the matcher to try matching. As with
-@code{re_match}, if it succeeds, @code{re_match_2} returns how many
-characters of @var{string} it matched. Regard @var{string1} and
-@var{string2} as concatenated when you set the arguments @var{start} and
-@var{stop} and use the contents of @var{regs}; @code{re_match_2} never
-returns a value larger than @math{@var{size1} + @var{size2}}.
-
-The function:
-
-@findex re_search_2
-@example
-int
-re_search_2 (struct re_pattern_buffer *@var{buffer},
- const char *@var{string1}, const int @var{size1},
- const char *@var{string2}, const int @var{size2},
- const int @var{start}, const int @var{range},
- struct re_registers *@var{regs},
- const int @var{stop})
-@end example
-
-@noindent
-is similarly related to @code{re_search}.
-
-
-@node Searching with Fastmaps, GNU Translate Tables, Matching/Searching with Split Data, GNU Regex Functions
-@subsection Searching with Fastmaps
-
-@cindex fastmaps
-If you're searching through a long string, you should use a fastmap.
-Without one, the searcher tries to match at consecutive positions in the
-string. Generally, most of the characters in the string could not start
-a match. It takes much longer to try matching at a given position in the
-string than it does to check in a table whether or not the character at
-that position could start a match. A @dfn{fastmap} is such a table.
-
-More specifically, a fastmap is an array indexed by the characters in
-your character set. Under the @sc{ascii} encoding, therefore, a fastmap
-has 256 elements. If you want the searcher to use a fastmap with a
-given pattern buffer, you must allocate the array and assign the array's
-address to the pattern buffer's @code{fastmap} field. You either can
-compile the fastmap yourself or have @code{re_search} do it for you;
-when @code{fastmap} is nonzero, it automatically compiles a fastmap the
-first time you search using a particular compiled pattern.
-
-To compile a fastmap yourself, use:
-
-@findex re_compile_fastmap
-@example
-int
-re_compile_fastmap (struct re_pattern_buffer *@var{pattern_buffer})
-@end example
-
-@noindent
-@var{pattern_buffer} is the address of a pattern buffer. If the
-character @var{c} could start a match for the pattern,
-@code{re_compile_fastmap} makes
-@code{@var{pattern_buffer}->fastmap[@var{c}]} nonzero. It returns
-@math{0} if it can compile a fastmap and @math{-2} if there is an
-internal error. For example, if @samp{|} is the alternation operator
-and @var{pattern_buffer} holds the compiled pattern for @samp{a|b}, then
-@code{re_compile_fastmap} sets @code{fastmap['a']} and
-@code{fastmap['b']} (and no others).
-
-@code{re_search} uses a fastmap as it moves along in the string: it
-checks the string's characters until it finds one that's in the fastmap.
-Then it tries matching at that character. If the match fails, it
-repeats the process. So, by using a fastmap, @code{re_search} doesn't
-waste time trying to match at positions in the string that couldn't
-start a match.
-
-If you don't want @code{re_search} to use a fastmap,
-store zero in the @code{fastmap} field of the pattern buffer before
-calling @code{re_search}.
-
-Once you've initialized a pattern buffer's @code{fastmap} field, you
-need never do so again---even if you compile a new pattern in
-it---provided the way the field is set still reflects whether or not you
-want a fastmap. @code{re_search} will still either do nothing if
-@code{fastmap} is null or, if it isn't, compile a new fastmap for the
-new pattern.
-
-@node GNU Translate Tables, Using Registers, Searching with Fastmaps, GNU Regex Functions
-@subsection GNU Translate Tables
-
-If you set the @code{translate} field of a pattern buffer to a translate
-table, then the @sc{gnu} Regex functions to which you've passed that
-pattern buffer use it to apply a simple transformation
-to all the regular expression and string characters at which they look.
-
-A @dfn{translate table} is an array indexed by the characters in your
-character set. Under the @sc{ascii} encoding, therefore, a translate
-table has 256 elements. The array's elements are also characters in
-your character set. When the Regex functions see a character @var{c},
-they use @code{translate[@var{c}]} in its place, with one exception: the
-character after a @samp{\} is not translated. (This ensures that, the
-operators, e.g., @samp{\B} and @samp{\b}, are always distinguishable.)
-
-For example, a table that maps all lowercase letters to the
-corresponding uppercase ones would cause the matcher to ignore
-differences in case.@footnote{A table that maps all uppercase letters to
-the corresponding lowercase ones would work just as well for this
-purpose.} Such a table would map all characters except lowercase letters
-to themselves, and lowercase letters to the corresponding uppercase
-ones. Under the @sc{ascii} encoding, here's how you could initialize
-such a table (we'll call it @code{case_fold}):
-
-@example
-for (i = 0; i < 256; i++)
- case_fold[i] = i;
-for (i = 'a'; i <= 'z'; i++)
- case_fold[i] = i - ('a' - 'A');
-@end example
-
-You tell Regex to use a translate table on a given pattern buffer by
-assigning that table's address to the @code{translate} field of that
-buffer. If you don't want Regex to do any translation, put zero into
-this field. You'll get weird results if you change the table's contents
-anytime between compiling the pattern buffer, compiling its fastmap, and
-matching or searching with the pattern buffer.
-
-@node Using Registers, Freeing GNU Pattern Buffers, GNU Translate Tables, GNU Regex Functions
-@subsection Using Registers
-
-A group in a regular expression can match a (posssibly empty) substring
-of the string that regular expression as a whole matched. The matcher
-remembers the beginning and end of the substring matched by
-each group.
-
-To find out what they matched, pass a nonzero @var{regs} argument to a
-@sc{gnu} matching or searching function (@pxref{GNU Matching} and
-@ref{GNU Searching}), i.e., the address of a structure of this type, as
-defined in @file{regex.h}:
-
-@c We don't bother to include this directly from regex.h,
-@c since it changes so rarely.
-@example
-@tindex re_registers
-@vindex num_regs @r{in @code{struct re_registers}}
-@vindex start @r{in @code{struct re_registers}}
-@vindex end @r{in @code{struct re_registers}}
-struct re_registers
-@{
- unsigned num_regs;
- regoff_t *start;
- regoff_t *end;
-@};
-@end example
-
-Except for (possibly) the @var{num_regs}'th element (see below), the
-@var{i}th element of the @code{start} and @code{end} arrays records
-information about the @var{i}th group in the pattern. (They're declared
-as C pointers, but this is only because not all C compilers accept
-zero-length arrays; conceptually, it is simplest to think of them as
-arrays.)
-
-The @code{start} and @code{end} arrays are allocated in various ways,
-depending on the value of the @code{regs_allocated}
-@vindex regs_allocated
-field in the pattern buffer passed to the matcher.
-
-The simplest and perhaps most useful is to let the matcher (re)allocate
-enough space to record information for all the groups in the regular
-expression. If @code{regs_allocated} is @code{REGS_UNALLOCATED},
-@vindex REGS_UNALLOCATED
-the matcher allocates @math{1 + @var{re_nsub}} (another field in the
-pattern buffer; @pxref{GNU Pattern Buffers}). The extra element is set
-to @math{-1}, and sets @code{regs_allocated} to @code{REGS_REALLOCATE}.
-@vindex REGS_REALLOCATE
-Then on subsequent calls with the same pattern buffer and @var{regs}
-arguments, the matcher reallocates more space if necessary.
-
-It would perhaps be more logical to make the @code{regs_allocated} field
-part of the @code{re_registers} structure, instead of part of the
-pattern buffer. But in that case the caller would be forced to
-initialize the structure before passing it. Much existing code doesn't
-do this initialization, and it's arguably better to avoid it anyway.
-
-@code{re_compile_pattern} sets @code{regs_allocated} to
-@code{REGS_UNALLOCATED},
-so if you use the GNU regular expression
-functions, you get this behavior by default.
-
-xx document re_set_registers
-
-@sc{posix}, on the other hand, requires a different interface: the
-caller is supposed to pass in a fixed-length array which the matcher
-fills. Therefore, if @code{regs_allocated} is @code{REGS_FIXED}
-@vindex REGS_FIXED
-the matcher simply fills that array.
-
-The following examples illustrate the information recorded in the
-@code{re_registers} structure. (In all of them, @samp{(} represents the
-open-group and @samp{)} the close-group operator. The first character
-in the string @var{string} is at index 0.)
-
-@c xx i'm not sure this is all true anymore.
-
-@itemize @bullet
-
-@item
-If the regular expression has an @w{@var{i}-th}
-group not contained within another group that matches a
-substring of @var{string}, then the function sets
-@code{@w{@var{regs}->}start[@var{i}]} to the index in @var{string} where
-the substring matched by the @w{@var{i}-th} group begins, and
-@code{@w{@var{regs}->}end[@var{i}]} to the index just beyond that
-substring's end. The function sets @code{@w{@var{regs}->}start[0]} and
-@code{@w{@var{regs}->}end[0]} to analogous information about the entire
-pattern.
-
-For example, when you match @samp{((a)(b))} against @samp{ab}, you get:
-
-@itemize
-@item
-0 in @code{@w{@var{regs}->}start[0]} and 2 in @code{@w{@var{regs}->}end[0]}
-
-@item
-0 in @code{@w{@var{regs}->}start[1]} and 2 in @code{@w{@var{regs}->}end[1]}
-
-@item
-0 in @code{@w{@var{regs}->}start[2]} and 1 in @code{@w{@var{regs}->}end[2]}
-
-@item
-1 in @code{@w{@var{regs}->}start[3]} and 2 in @code{@w{@var{regs}->}end[3]}
-@end itemize
-
-@item
-If a group matches more than once (as it might if followed by,
-e.g., a repetition operator), then the function reports the information
-about what the group @emph{last} matched.
-
-For example, when you match the pattern @samp{(a)*} against the string
-@samp{aa}, you get:
-
-@itemize
-@item
-0 in @code{@w{@var{regs}->}start[0]} and 2 in @code{@w{@var{regs}->}end[0]}
-
-@item
-1 in @code{@w{@var{regs}->}start[1]} and 2 in @code{@w{@var{regs}->}end[1]}
-@end itemize
-
-@item
-If the @w{@var{i}-th} group does not participate in a
-successful match, e.g., it is an alternative not taken or a
-repetition operator allows zero repetitions of it, then the function
-sets @code{@w{@var{regs}->}start[@var{i}]} and
-@code{@w{@var{regs}->}end[@var{i}]} to @math{-1}.
-
-For example, when you match the pattern @samp{(a)*b} against
-the string @samp{b}, you get:
-
-@itemize
-@item
-0 in @code{@w{@var{regs}->}start[0]} and 1 in @code{@w{@var{regs}->}end[0]}
-
-@item
-@math{-1} in @code{@w{@var{regs}->}start[1]} and @math{-1} in @code{@w{@var{regs}->}end[1]}
-@end itemize
-
-@item
-If the @w{@var{i}-th} group matches a zero-length string, then the
-function sets @code{@w{@var{regs}->}start[@var{i}]} and
-@code{@w{@var{regs}->}end[@var{i}]} to the index just beyond that
-zero-length string.
-
-For example, when you match the pattern @samp{(a*)b} against the string
-@samp{b}, you get:
-
-@itemize
-@item
-0 in @code{@w{@var{regs}->}start[0]} and 1 in @code{@w{@var{regs}->}end[0]}
-
-@item
-0 in @code{@w{@var{regs}->}start[1]} and 0 in @code{@w{@var{regs}->}end[1]}
-@end itemize
-
-@ignore
-The function sets @code{@w{@var{regs}->}start[0]} and
-@code{@w{@var{regs}->}end[0]} to analogous information about the entire
-pattern.
-
-For example, when you match the pattern @samp{(a*)} against the empty
-string, you get:
-
-@itemize
-@item
-0 in @code{@w{@var{regs}->}start[0]} and 0 in @code{@w{@var{regs}->}end[0]}
-
-@item
-0 in @code{@w{@var{regs}->}start[1]} and 0 in @code{@w{@var{regs}->}end[1]}
-@end itemize
-@end ignore
-
-@item
-If an @w{@var{i}-th} group contains a @w{@var{j}-th} group
-in turn not contained within any other group within group @var{i} and
-the function reports a match of the @w{@var{i}-th} group, then it
-records in @code{@w{@var{regs}->}start[@var{j}]} and
-@code{@w{@var{regs}->}end[@var{j}]} the last match (if it matched) of
-the @w{@var{j}-th} group.
-
-For example, when you match the pattern @samp{((a*)b)*} against the
-string @samp{abb}, @w{group 2} last matches the empty string, so you
-get what it previously matched:
-
-@itemize
-@item
-0 in @code{@w{@var{regs}->}start[0]} and 3 in @code{@w{@var{regs}->}end[0]}
-
-@item
-2 in @code{@w{@var{regs}->}start[1]} and 3 in @code{@w{@var{regs}->}end[1]}
-
-@item
-2 in @code{@w{@var{regs}->}start[2]} and 2 in @code{@w{@var{regs}->}end[2]}
-@end itemize
-
-When you match the pattern @samp{((a)*b)*} against the string
-@samp{abb}, @w{group 2} doesn't participate in the last match, so you
-get:
-
-@itemize
-@item
-0 in @code{@w{@var{regs}->}start[0]} and 3 in @code{@w{@var{regs}->}end[0]}
-
-@item
-2 in @code{@w{@var{regs}->}start[1]} and 3 in @code{@w{@var{regs}->}end[1]}
-
-@item
-0 in @code{@w{@var{regs}->}start[2]} and 1 in @code{@w{@var{regs}->}end[2]}
-@end itemize
-
-@item
-If an @w{@var{i}-th} group contains a @w{@var{j}-th} group
-in turn not contained within any other group within group @var{i}
-and the function sets
-@code{@w{@var{regs}->}start[@var{i}]} and
-@code{@w{@var{regs}->}end[@var{i}]} to @math{-1}, then it also sets
-@code{@w{@var{regs}->}start[@var{j}]} and
-@code{@w{@var{regs}->}end[@var{j}]} to @math{-1}.
-
-For example, when you match the pattern @samp{((a)*b)*c} against the
-string @samp{c}, you get:
-
-@itemize
-@item
-0 in @code{@w{@var{regs}->}start[0]} and 1 in @code{@w{@var{regs}->}end[0]}
-
-@item
-@math{-1} in @code{@w{@var{regs}->}start[1]} and @math{-1} in @code{@w{@var{regs}->}end[1]}
-
-@item
-@math{-1} in @code{@w{@var{regs}->}start[2]} and @math{-1} in @code{@w{@var{regs}->}end[2]}
-@end itemize
-
-@end itemize
-
-@node Freeing GNU Pattern Buffers, , Using Registers, GNU Regex Functions
-@subsection Freeing GNU Pattern Buffers
-
-To free any allocated fields of a pattern buffer, you can use the
-@sc{posix} function described in @ref{Freeing POSIX Pattern Buffers},
-since the type @code{regex_t}---the type for @sc{posix} pattern
-buffers---is equivalent to the type @code{re_pattern_buffer}. After
-freeing a pattern buffer, you need to again compile a regular expression
-in it (@pxref{GNU Regular Expression Compiling}) before passing it to
-a matching or searching function.
-
-
-@node POSIX Regex Functions, BSD Regex Functions, GNU Regex Functions, Programming with Regex
-@section POSIX Regex Functions
-
-If you're writing code that has to be @sc{posix} compatible, you'll need
-to use these functions. Their interfaces are as specified by @sc{posix},
-draft 1003.2/D11.2.
-
-@menu
-* POSIX Pattern Buffers:: The regex_t type.
-* POSIX Regular Expression Compiling:: regcomp ()
-* POSIX Matching:: regexec ()
-* Reporting Errors:: regerror ()
-* Using Byte Offsets:: The regmatch_t type.
-* Freeing POSIX Pattern Buffers:: regfree ()
-@end menu
-
-
-@node POSIX Pattern Buffers, POSIX Regular Expression Compiling, , POSIX Regex Functions
-@subsection POSIX Pattern Buffers
-
-To compile or match a given regular expression the @sc{posix} way, you
-must supply a pattern buffer exactly the way you do for @sc{gnu}
-(@pxref{GNU Pattern Buffers}). @sc{posix} pattern buffers have type
-@code{regex_t}, which is equivalent to the @sc{gnu} pattern buffer
-type @code{re_pattern_buffer}.
-
-
-@node POSIX Regular Expression Compiling, POSIX Matching, POSIX Pattern Buffers, POSIX Regex Functions
-@subsection POSIX Regular Expression Compiling
-
-With @sc{posix}, you can only search for a given regular expression; you
-can't match it. To do this, you must first compile it in a
-pattern buffer, using @code{regcomp}.
-
-@ignore
-Before calling @code{regcomp}, you must initialize this pattern buffer
-as you do for @sc{gnu} (@pxref{GNU Regular Expression Compiling}). See
-below, however, for how to choose a syntax with which to compile.
-@end ignore
-
-To compile a pattern buffer, use:
-
-@findex regcomp
-@example
-int
-regcomp (regex_t *@var{preg}, const char *@var{regex}, int @var{cflags})
-@end example
-
-@noindent
-@var{preg} is the initialized pattern buffer's address, @var{regex} is
-the regular expression's address, and @var{cflags} is the compilation
-flags, which Regex considers as a collection of bits. Here are the
-valid bits, as defined in @file{regex.h}:
-
-@table @code
-
-@item REG_EXTENDED
-@vindex REG_EXTENDED
-says to use @sc{posix} Extended Regular Expression syntax; if this isn't
-set, then says to use @sc{posix} Basic Regular Expression syntax.
-@code{regcomp} sets @var{preg}'s @code{syntax} field accordingly.
-
-@item REG_ICASE
-@vindex REG_ICASE
-@cindex ignoring case
-says to ignore case; @code{regcomp} sets @var{preg}'s @code{translate}
-field to a translate table which ignores case, replacing anything you've
-put there before.
-
-@item REG_NOSUB
-@vindex REG_NOSUB
-says to set @var{preg}'s @code{no_sub} field; @pxref{POSIX Matching},
-for what this means.
-
-@item REG_NEWLINE
-@vindex REG_NEWLINE
-says that a:
-
-@itemize @bullet
-
-@item
-match-any-character operator (@pxref{Match-any-character
-Operator}) doesn't match a newline.
-
-@item
-nonmatching list not containing a newline (@pxref{List
-Operators}) matches a newline.
-
-@item
-match-beginning-of-line operator (@pxref{Match-beginning-of-line
-Operator}) matches the empty string immediately after a newline,
-regardless of how @code{REG_NOTBOL} is set (@pxref{POSIX Matching}, for
-an explanation of @code{REG_NOTBOL}).
-
-@item
-match-end-of-line operator (@pxref{Match-beginning-of-line
-Operator}) matches the empty string immediately before a newline,
-regardless of how @code{REG_NOTEOL} is set (@pxref{POSIX Matching},
-for an explanation of @code{REG_NOTEOL}).
-
-@end itemize
-
-@end table
-
-If @code{regcomp} successfully compiles the regular expression, it
-returns zero and sets @code{*@var{pattern_buffer}} to the compiled
-pattern. Except for @code{syntax} (which it sets as explained above), it
-also sets the same fields the same way as does the @sc{gnu} compiling
-function (@pxref{GNU Regular Expression Compiling}).
-
-If @code{regcomp} can't compile the regular expression, it returns one
-of the error codes listed here. (Except when noted differently, the
-syntax of in all examples below is basic regular expression syntax.)
-
-@table @code
-
-@comment repetitions
-@item REG_BADRPT
-For example, the consecutive repetition operators @samp{**} in
-@samp{a**} are invalid. As another example, if the syntax is extended
-regular expression syntax, then the repetition operator @samp{*} with
-nothing on which to operate in @samp{*} is invalid.
-
-@item REG_BADBR
-For example, the @var{count} @samp{-1} in @samp{a\@{-1} is invalid.
-
-@item REG_EBRACE
-For example, @samp{a\@{1} is missing a close-interval operator.
-
-@comment lists
-@item REG_EBRACK
-For example, @samp{[a} is missing a close-list operator.
-
-@item REG_ERANGE
-For example, the range ending point @samp{z} that collates lower than
-does its starting point @samp{a} in @samp{[z-a]} is invalid. Also, the
-range with the character class @samp{[:alpha:]} as its starting point in
-@samp{[[:alpha:]-|]}.
-
-@item REG_ECTYPE
-For example, the character class name @samp{foo} in @samp{[[:foo:]} is
-invalid.
-
-@comment groups
-@item REG_EPAREN
-For example, @samp{a\)} is missing an open-group operator and @samp{\(a}
-is missing a close-group operator.
-
-@item REG_ESUBREG
-For example, the back reference @samp{\2} that refers to a nonexistent
-subexpression in @samp{\(a\)\2} is invalid.
-
-@comment unfinished business
-
-@item REG_EEND
-Returned when a regular expression causes no other more specific error.
-
-@item REG_EESCAPE
-For example, the trailing backslash @samp{\} in @samp{a\} is invalid, as is the
-one in @samp{\}.
-
-@comment kitchen sink
-@item REG_BADPAT
-For example, in the extended regular expression syntax, the empty group
-@samp{()} in @samp{a()b} is invalid.
-
-@comment internal
-@item REG_ESIZE
-Returned when a regular expression needs a pattern buffer larger than
-65536 bytes.
-
-@item REG_ESPACE
-Returned when a regular expression makes Regex to run out of memory.
-
-@end table
-
-
-@node POSIX Matching, Reporting Errors, POSIX Regular Expression Compiling, POSIX Regex Functions
-@subsection POSIX Matching
-
-Matching the @sc{posix} way means trying to match a null-terminated
-string starting at its first character. Once you've compiled a pattern
-into a pattern buffer (@pxref{POSIX Regular Expression Compiling}), you
-can ask the matcher to match that pattern against a string using:
-
-@findex regexec
-@example
-int
-regexec (const regex_t *@var{preg}, const char *@var{string},
- size_t @var{nmatch}, regmatch_t @var{pmatch}[], int @var{eflags})
-@end example
-
-@noindent
-@var{preg} is the address of a pattern buffer for a compiled pattern.
-@var{string} is the string you want to match.
-
-@xref{Using Byte Offsets}, for an explanation of @var{pmatch}. If you
-pass zero for @var{nmatch} or you compiled @var{preg} with the
-compilation flag @code{REG_NOSUB} set, then @code{regexec} will ignore
-@var{pmatch}; otherwise, you must allocate it to have at least
-@var{nmatch} elements. @code{regexec} will record @var{nmatch} byte
-offsets in @var{pmatch}, and set to @math{-1} any unused elements up to
-@math{@var{pmatch}@code{[@var{nmatch}]} - 1}.
-
-@var{eflags} specifies @dfn{execution flags}---namely, the two bits
-@code{REG_NOTBOL} and @code{REG_NOTEOL} (defined in @file{regex.h}). If
-you set @code{REG_NOTBOL}, then the match-beginning-of-line operator
-(@pxref{Match-beginning-of-line Operator}) always fails to match.
-This lets you match against pieces of a line, as you would need to if,
-say, searching for repeated instances of a given pattern in a line; it
-would work correctly for patterns both with and without
-match-beginning-of-line operators. @code{REG_NOTEOL} works analogously
-for the match-end-of-line operator (@pxref{Match-end-of-line
-Operator}); it exists for symmetry.
-
-@code{regexec} tries to find a match for @var{preg} in @var{string}
-according to the syntax in @var{preg}'s @code{syntax} field.
-(@xref{POSIX Regular Expression Compiling}, for how to set it.) The
-function returns zero if the compiled pattern matches @var{string} and
-@code{REG_NOMATCH} (defined in @file{regex.h}) if it doesn't.
-
-@node Reporting Errors, Using Byte Offsets, POSIX Matching, POSIX Regex Functions
-@subsection Reporting Errors
-
-If either @code{regcomp} or @code{regexec} fail, they return a nonzero
-error code, the possibilities for which are defined in @file{regex.h}.
-@xref{POSIX Regular Expression Compiling}, and @ref{POSIX Matching}, for
-what these codes mean. To get an error string corresponding to these
-codes, you can use:
-
-@findex regerror
-@example
-size_t
-regerror (int @var{errcode},
- const regex_t *@var{preg},
- char *@var{errbuf},
- size_t @var{errbuf_size})
-@end example
-
-@noindent
-@var{errcode} is an error code, @var{preg} is the address of the pattern
-buffer which provoked the error, @var{errbuf} is the error buffer, and
-@var{errbuf_size} is @var{errbuf}'s size.
-
-@code{regerror} returns the size in bytes of the error string
-corresponding to @var{errcode} (including its terminating null). If
-@var{errbuf} and @var{errbuf_size} are nonzero, it also returns in
-@var{errbuf} the first @math{@var{errbuf_size} - 1} characters of the
-error string, followed by a null.
-@var{errbuf_size} must be a nonnegative number less than or equal to the
-size in bytes of @var{errbuf}.
-
-You can call @code{regerror} with a null @var{errbuf} and a zero
-@var{errbuf_size} to determine how large @var{errbuf} need be to
-accommodate @code{regerror}'s error string.
-
-@node Using Byte Offsets, Freeing POSIX Pattern Buffers, Reporting Errors, POSIX Regex Functions
-@subsection Using Byte Offsets
-
-In @sc{posix}, variables of type @code{regmatch_t} hold analogous
-information, but are not identical to, @sc{gnu}'s registers (@pxref{Using
-Registers}). To get information about registers in @sc{posix}, pass to
-@code{regexec} a nonzero @var{pmatch} of type @code{regmatch_t}, i.e.,
-the address of a structure of this type, defined in
-@file{regex.h}:
-
-@tindex regmatch_t
-@example
-typedef struct
-@{
- regoff_t rm_so;
- regoff_t rm_eo;
-@} regmatch_t;
-@end example
-
-When reading in @ref{Using Registers}, about how the matching function
-stores the information into the registers, substitute @var{pmatch} for
-@var{regs}, @code{@w{@var{pmatch}[@var{i}]->}rm_so} for
-@code{@w{@var{regs}->}start[@var{i}]} and
-@code{@w{@var{pmatch}[@var{i}]->}rm_eo} for
-@code{@w{@var{regs}->}end[@var{i}]}.
-
-@node Freeing POSIX Pattern Buffers, , Using Byte Offsets, POSIX Regex Functions
-@subsection Freeing POSIX Pattern Buffers
-
-To free any allocated fields of a pattern buffer, use:
-
-@findex regfree
-@example
-void
-regfree (regex_t *@var{preg})
-@end example
-
-@noindent
-@var{preg} is the pattern buffer whose allocated fields you want freed.
-@code{regfree} also sets @var{preg}'s @code{allocated} and @code{used}
-fields to zero. After freeing a pattern buffer, you need to again
-compile a regular expression in it (@pxref{POSIX Regular Expression
-Compiling}) before passing it to the matching function (@pxref{POSIX
-Matching}).
-
-
-@node BSD Regex Functions, , POSIX Regex Functions, Programming with Regex
-@section BSD Regex Functions
-
-If you're writing code that has to be Berkeley @sc{unix} compatible,
-you'll need to use these functions whose interfaces are the same as those
-in Berkeley @sc{unix}.
-
-@menu
-* BSD Regular Expression Compiling:: re_comp ()
-* BSD Searching:: re_exec ()
-@end menu
-
-@node BSD Regular Expression Compiling, BSD Searching, , BSD Regex Functions
-@subsection BSD Regular Expression Compiling
-
-With Berkeley @sc{unix}, you can only search for a given regular
-expression; you can't match one. To search for it, you must first
-compile it. Before you compile it, you must indicate the regular
-expression syntax you want it compiled according to by setting the
-variable @code{re_syntax_options} (declared in @file{regex.h} to some
-syntax (@pxref{Regular Expression Syntax}).
-
-To compile a regular expression use:
-
-@findex re_comp
-@example
-char *
-re_comp (char *@var{regex})
-@end example
-
-@noindent
-@var{regex} is the address of a null-terminated regular expression.
-@code{re_comp} uses an internal pattern buffer, so you can use only the
-most recently compiled pattern buffer. This means that if you want to
-use a given regular expression that you've already compiled---but it
-isn't the latest one you've compiled---you'll have to recompile it. If
-you call @code{re_comp} with the null string (@emph{not} the empty
-string) as the argument, it doesn't change the contents of the pattern
-buffer.
-
-If @code{re_comp} successfully compiles the regular expression, it
-returns zero. If it can't compile the regular expression, it returns
-an error string. @code{re_comp}'s error messages are identical to those
-of @code{re_compile_pattern} (@pxref{GNU Regular Expression
-Compiling}).
-
-@node BSD Searching, , BSD Regular Expression Compiling, BSD Regex Functions
-@subsection BSD Searching
-
-Searching the Berkeley @sc{unix} way means searching in a string
-starting at its first character and trying successive positions within
-it to find a match. Once you've compiled a pattern using @code{re_comp}
-(@pxref{BSD Regular Expression Compiling}), you can ask Regex
-to search for that pattern in a string using:
-
-@findex re_exec
-@example
-int
-re_exec (char *@var{string})
-@end example
-
-@noindent
-@var{string} is the address of the null-terminated string in which you
-want to search.
-
-@code{re_exec} returns either 1 for success or 0 for failure. It
-automatically uses a @sc{gnu} fastmap (@pxref{Searching with Fastmaps}).
-
-
-@node Copying, Index, Programming with Regex, Top
-@appendix GNU GENERAL PUBLIC LICENSE
-@center Version 2, June 1991
-
-@display
-Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
-675 Mass Ave, Cambridge, MA 02139, USA
-
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-@end display
-
-@unnumberedsec Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software---to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
-@iftex
-@unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-@end iftex
-@ifinfo
-@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-@end ifinfo
-
-@enumerate
-@item
-This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The ``Program'', below,
-refers to any such program or work, and a ``work based on the Program''
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term ``modification''.) Each licensee is addressed as ``you''.
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-@item
-You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-@item
-You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-@enumerate a
-@item
-You must cause the modified files to carry prominent notices
-stating that you changed the files and the date of any change.
-
-@item
-You must cause any work that you distribute or publish, that in
-whole or in part contains or is derived from the Program or any
-part thereof, to be licensed as a whole at no charge to all third
-parties under the terms of this License.
-
-@item
-If the modified program normally reads commands interactively
-when run, you must cause it, when started running for such
-interactive use in the most ordinary way, to print or display an
-announcement including an appropriate copyright notice and a
-notice that there is no warranty (or else, saying that you provide
-a warranty) and that users may redistribute the program under
-these conditions, and telling the user how to view a copy of this
-License. (Exception: if the Program itself is interactive but
-does not normally print such an announcement, your work based on
-the Program is not required to print an announcement.)
-@end enumerate
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-@item
-You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-@enumerate a
-@item
-Accompany it with the complete corresponding machine-readable
-source code, which must be distributed under the terms of Sections
-1 and 2 above on a medium customarily used for software interchange; or,
-
-@item
-Accompany it with a written offer, valid for at least three
-years, to give any third party, for a charge no more than your
-cost of physically performing source distribution, a complete
-machine-readable copy of the corresponding source code, to be
-distributed under the terms of Sections 1 and 2 above on a medium
-customarily used for software interchange; or,
-
-@item
-Accompany it with the information you received as to the offer
-to distribute corresponding source code. (This alternative is
-allowed only for noncommercial distribution and only if you
-received the program in object code or executable form with such
-an offer, in accord with Subsection b above.)
-@end enumerate
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-@item
-You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-@item
-You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-@item
-Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-@item
-If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-@item
-If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-@item
-The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and ``any
-later version'', you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-@item
-If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-@iftex
-@heading NO WARRANTY
-@end iftex
-@ifinfo
-@center NO WARRANTY
-@end ifinfo
-
-@item
-BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-@item
-IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-@end enumerate
-
-@iftex
-@heading END OF TERMS AND CONDITIONS
-@end iftex
-@ifinfo
-@center END OF TERMS AND CONDITIONS
-@end ifinfo
-
-@page
-@unnumberedsec Appendix: How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the ``copyright'' line and a pointer to where the full notice is found.
-
-@smallexample
-@var{one line to give the program's name and a brief idea of what it does.}
-Copyright (C) 19@var{yy} @var{name of author}
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-@end smallexample
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-@smallexample
-Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author}
-Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-This is free software, and you are welcome to redistribute it
-under certain conditions; type `show c' for details.
-@end smallexample
-
-The hypothetical commands @samp{show w} and @samp{show c} should show
-the appropriate parts of the General Public License. Of course, the
-commands you use may be called something other than @samp{show w} and
-@samp{show c}; they could even be mouse-clicks or menu items---whatever
-suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a ``copyright disclaimer'' for the program, if
-necessary. Here is a sample; alter the names:
-
-@example
-Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-`Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-@var{signature of Ty Coon}, 1 April 1989
-Ty Coon, President of Vice
-@end example
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-
-
-@node Index, , Copying, Top
-@unnumbered Index
-
-@printindex cp
-
-@contents
-
-@bye
diff --git a/gnu/lib/libregex/test/TAGS b/gnu/lib/libregex/test/TAGS
deleted file mode 100644
index d3aad75..0000000
--- a/gnu/lib/libregex/test/TAGS
+++ /dev/null
@@ -1,373 +0,0 @@
-
-.././regex.c,4137
-#define AT_STRINGS_BEG(3078,98376
-#define AT_STRINGS_END(3079,98449
-#define AT_WORD_BOUNDARY(3093,99002
-#define BUF_PUSH(887,24995
-#define BUF_PUSH_2(895,25208
-#define BUF_PUSH_3(904,25437
-#define DEBUG_POP(2336,74614
-#define DEBUG_PRINT1(471,14296
-#define DEBUG_PRINT1(785,21263
-#define DEBUG_PRINT2(472,14342
-#define DEBUG_PRINT3(473,14398
-#define DEBUG_PRINT3(787,21316
-#define DEBUG_PRINT4(474,14462
-#define DEBUG_PRINT_COMPILED_PATTERN(475,14534
-#define DEBUG_PRINT_COMPILED_PATTERN(789,21386
-#define DEBUG_PRINT_DOUBLE_STRING(477,14637
-#define DEBUG_PUSH(2338,74684
-#define DEBUG_STATEMENT(470,14267
-#define DOUBLE_FAIL_STACK(2299,73230
-#define EVER_MATCHED_SOMETHING(3028,96680
-#define EXTEND_BUFFER(941,26834
-#define EXTRACT_NUMBER(403,12499
-#define EXTRACT_NUMBER(422,12960
-#define EXTRACT_NUMBER_AND_INCR(430,13181
-#define EXTRACT_NUMBER_AND_INCR(448,13583
-#define FAIL_STACK_EMPTY(2271,72289
-#define FAIL_STACK_FULL(2273,72404
-#define FAIL_STACK_PTR_EMPTY(2272,72344
-#define FAIL_STACK_TOP(2274,72473
-#define FIRST_STRING_P(221,5848
-#define FREE_VAR(3100,99186
-#define FREE_VARIABLES(3101,99240
-#define FREE_VARIABLES(3116,99751
-#define GET_BUFFER_SPACE(882,24802
-#define GET_UNSIGNED_NUMBER(1017,29312
-#define INIT_FAIL_STACK(2279,72612
-#define INSERT_JUMP(923,26079
-#define INSERT_JUMP2(927,26236
-#define ISALNUM(147,3407
-#define ISALPHA(148,3455
-#define ISBLANK(135,3062
-#define ISBLANK(137,3116
-#define ISCNTRL(149,3503
-#define ISDIGIT(146,3359
-#define ISGRAPH(140,3185
-#define ISGRAPH(142,3239
-#define ISLOWER(150,3551
-#define ISPRINT(145,3311
-#define ISPUNCT(151,3599
-#define ISSPACE(152,3647
-#define ISUPPER(153,3695
-#define ISXDIGIT(154,3743
-#define IS_ACTIVE(3026,96578
-#define IS_CHAR_CLASS(1035,29793
-#define MATCHED_SOMETHING(3027,96621
-#define MAX(233,6292
-#define MIN(234,6334
-#define PATFETCH(852,23769
-#define PATFETCH_RAW(860,24020
-#define POINTER_TO_OFFSET(3050,97433
-#define POP_FAILURE_ITEM(2331,74426
-#define POP_FAILURE_POINT(2461,79538
-#define PREFETCH(3064,97916
-#define PUSH_FAILURE_ITEM(2327,74253
-#define PUSH_FAILURE_POINT(2352,75048
-#define PUSH_PATTERN_OP(2317,73841
-#define REGEX_REALLOCATE(185,4875
-#define REGEX_REALLOCATE(210,5495
-#define REGEX_TALLOC(227,6137
-#define REG_MATCH_NULL_STRING_P(3025,96511
-#define REG_UNSET(3055,97649
-#define RETALLOC(226,6058
-#define SET_LIST_BIT(1011,29089
-#define SET_REGS_MATCHED(3034,96936
-#define SIGN_EXTEND_CHAR(166,4109
-#define SIGN_EXTEND_CHAR(169,4217
-#define STORE_JUMP(915,25800
-#define STORE_JUMP2(919,25917
-#define STORE_NUMBER(384,11919
-#define STORE_NUMBER_AND_INCR(394,12242
-#define STREQ(231,6244
-#define SYNTAX(120,2790
-#define TALLOC(225,6003
-#define TRANSLATE(873,24503
-#define WORDCHAR_P(3086,98755
-alt_match_null_string_p 4466,149039
-#define assert(782,21217
-at_begline_loc_p 2131,67979
-at_endline_loc_p 2150,68557
-#define bcmp(54,1656
-bcmp_translate 4591,151831
-#define bcopy(57,1726
-typedef char boolean;236,6377
-#define bzero(60,1793
-common_op_match_null_string_p 4503,149895
-compile_range 2200,69997
-} compile_stack_elt_t;990,28602
-} compile_stack_type;998,28748
-extract_number 411,12714
-extract_number_and_incr 438,13370
-} fail_stack_type;2269,72269
-group_in_compile_stack 2172,69174
-group_match_null_string_p 4357,145267
-init_syntax_once 94,2365
-insert_op1 2091,67107
-insert_op2 2110,67475
-#define isascii(131,3018
-typedef int pattern_offset_t;981,28388
-print_compiled_pattern 726,19792
-print_double_string 753,20605
-print_fastmap 486,14835
-print_partial_compiled_pattern 518,15475
-re_comp 4650,153479
-re_compile_fastmap 2532,82428
-re_compile_pattern 4617,152520
-re_exec 4688,154373
-re_match 3136,100557
-re_match_2 3161,101399
-} re_opcode_t;378,11781
-re_search 2844,90872
-re_search_2 2877,91998
-re_set_registers 2817,90247
-re_set_syntax 808,22087
-regcomp 4736,155972
-regerror 4876,160188
-regex_compile 1062,30922
-regexec 4811,158371
-regfree 4920,161247
-} register_info_type;3023,96488
-typedef unsigned regnum_t;974,28172
-store_op1 2063,66535
-store_op2 2076,66768
-typedef const unsigned 2262,72103
-
-.././regex.h,230
-#define _RE_ARGS(394,14981
-#define _RE_ARGS(398,15036
-} reg_errcode_t;270,10874
-typedef unsigned reg_syntax_t;38,1503
-typedef struct re_pattern_buffer regex_t;346,13556
-} regmatch_t;382,14634
-typedef int regoff_t;354,13814
-
-getpagesize.h,84
-#define getpagesize(12,137
-#define getpagesize(15,191
-#define getpagesize(20,302
-
-test.h,436
-#define BRACES_TO_OPS(107,3169
-#define INVALID_PATTERN(110,3328
-#define MATCH_SELF(114,3429
-#define PARENS_TO_OPS(108,3248
-#define SAFE_STRLEN(14,201
-#define TEST_POSITIONED_MATCH(116,3470
-#define TEST_REGISTERS(104,3011
-#define TEST_REGISTERS_2(97,2703
-#define TEST_SEARCH(127,3875
-#define TEST_SEARCH_2(123,3720
-#define TEST_TRUNCATED_MATCH(120,3608
-typedef enum { false = 0, true = 1 } boolean;16,255
-} test_type;33,572
-
-alloca.c,128
-alloca 141,3996
-find_stack_direction 85,2553
-} header;127,3538
-typedef void *pointer;51,1721
-typedef char *pointer;53,1778
-
-bsd-interf.c,51
-test_berk_search 8,106
-test_bsd_interface 33,738
-
-debugmalloc.c,395
-#define TRACE(8,143
-#define TRACE1(9,197
-#define TRACE2(10,254
-#define TRACE3(11,319
-#define TRACE4(12,392
-#define USER_ALLOC(61,1440
-typedef char *address;15,480
-} *chunk;54,1225
-chunk_delete 115,2778
-chunk_insert 96,2294
-chunk_to_mem 79,1916
-free 261,5604
-free_list_available 175,3947
-malloc 203,4343
-mem_to_chunk 68,1703
-realloc 242,5309
-validate_list 153,3478
-xsbrk 21,545
-
-emacsmalloc.c,574
-#define ASSERT(178,5884
-#define ASSERT(181,5985
-#define CHAIN(166,5430
-#define bcmp(73,2821
-#define bcopy(72,2777
-#define bzero(74,2868
-calloc 603,15983
-free 484,13255
-get_lim_data 736,18517
-get_lim_data 752,18767
-get_lim_data 759,18860
-getpool 374,10263
-malloc 413,11133
-malloc_init 218,6863
-malloc_mem_free 707,17940
-malloc_mem_used 688,17683
-malloc_stats 663,17320
-malloc_usable_size 233,7147
-memalign 618,16164
-morecore 244,7380
-realloc 541,14424
-#define start_of_data(110,3486
-#define start_of_data(115,3546
-sys_sbrk 815,20804
-valloc 645,17031
-
-fileregex.c,13
-main 11,156
-
-g++malloc.c,1543
-#define UPDATE_STATS(33,1090
-#define UPDATE_STATS(35,1131
-static inline int aligned_OK(343,11189
-void* calloc(1039,28692
-void cfree(1048,28894
-static inline void* chunk2mem(619,19336
-#define clear_inuse(592,18767
-static inline void consollink(716,21398
-static void do_free_stats(544,18016
-static void do_malloc_stats(534,17741
-766,22304
-extern 762,22235
- for 1260,34165
-void free(1028,28553
-static inline void frontlink(732,21717
-static unsigned int gcd(557,18251
- if 1212,32427
- if 1216,32582
- if 1220,32737
- if 1224,32880
- if 1229,33094
- if 1233,33251
- if 1238,33463
- if 1242,33609
- if 1247,33739
-#define inuse(590,18680
-static inline unsigned int lcm(580,18540
-void* malloc(939,26370
-static mchunkptr malloc_find_space(858,24561
-void malloc_stats(1201,32256
-unsigned int malloc_usable_size(1054,28936
-static volatile void malloc_user_error(286,9757
-static void malloc_user_error(288,9804
-typedef struct malloc_bin* mbinptr;320,10636
-typedef struct malloc_chunk* mchunkptr;309,10247
-static inline mchunkptr mem2chunk(643,19759
-void* memalign(1118,30363
-#define next_chunk(600,18910
-#define prev_chunk(604,19023
-void* realloc(1071,29263
-static inline unsigned int request2size(335,10993
-mchunkptr sanity_check(628,19486
-#define set_inuse(591,18723
-static inline void set_size(609,19149
-static inline mbinptr size2bin(499,16914
-static inline void split(685,20463
-static 768,22312
-static inline void unlink(671,20263
-void* valloc(1194,32107
-typedef volatile void 760,22184
-764,22271
-
-iregex.c,54
-main 20,390
-print_regs 141,2638
-scanstring 87,1839
-
-main.c,13
-main 12,242
-
-malloc-test.c,112
-#define BITS_BLOCK(12,168
-#define BITS_MASK(13,228
-} bits_list_type;6,56
-init_bits_list 16,311
-main(32,621
-
-other.c,18
-test_others 6,96
-
-printchar.c,15
-printchar 2,5
-
-psx-basic.c,23
-test_posix_basic 7,84
-
-psx-extend.c,26
-test_posix_extended 7,88
-
-psx-generic.c,26
-test_posix_generic 8,117
-
-psx-group.c,20
-test_grouping 7,92
-
-psx-interf.c,416
-fill_pmatch 174,4802
-get_error_string 18,260
-init_pattern_buffer 49,1434
-test_compile 67,1925
-test_eflags 245,6876
-test_error_code_allocation 562,16619
-test_error_code_message 524,15247
-test_ignore_case 303,8525
-test_newline 330,9199
-test_nsub 117,3319
-test_pmatch 188,5121
-test_posix_interface 614,18719
-test_posix_match 359,9938
-test_regcomp 138,3725
-test_regerror 592,17621
-test_regexec 394,10783
-
-psx-interv.c,21
-test_intervals 6,93
-
-test.c,607
-#define SET_FASTMAP(447,13999
-#define bcmp(18,362
-#define bcopy(19,415
-#define bzero(20,473
-compile_and_print_pattern 666,19653
-concat 97,2673
-delimiters_to_ops 571,17477
-general_test 115,2996
-invalid_pattern 542,16821
-#define memcmp(26,611
-#define memcpy(27,660
-print_pattern_info 635,18998
-set_all_registers 58,1390
-test_all_registers 506,15567
-test_case_fold 682,19993
-test_fastmap 460,14363
-test_fastmap_search 474,14668
-test_match 776,22235
-test_match_2 766,22040
-test_match_n_times 715,20798
-test_search_return 408,13011
-valid_nonposix_pattern 646,19239
-valid_pattern 557,17182
-
-tregress.c,208
-#define SIMPLE_MATCH(74,1463
-#define SIMPLE_NONMATCH(75,1528
-do_match 78,1599
-itoa 10,199
-simple_compile 44,882
-simple_fail 21,353
-simple_fastmap 55,1115
-simple_search 100,2020
-test_regress 124,2513
-
-upcase.c,0
-
-xmalloc.c,14
-xmalloc 9,87
diff --git a/gnu/libexec/uucp/common_sources/conf.h b/gnu/libexec/uucp/common_sources/conf.h
deleted file mode 100644
index 9053c44..0000000
--- a/gnu/libexec/uucp/common_sources/conf.h
+++ /dev/null
@@ -1,444 +0,0 @@
-/* conf.h. Generated automatically by configure. */
-/* Configuration header file for Taylor UUCP. -*- C -*- */
-
-/* Set MAIL_PROGRAM to a program which takes a mail address as an
- argument and accepts a mail message to send to that address on
- stdin (e.g. "/bin/mail"). */
-#define MAIL_PROGRAM "/usr/bin/mail"
-
-/* Set ECHO_PROGRAM to a program which echoes its arguments; if echo
- is a shell builtin you can just use "echo". */
-#define ECHO_PROGRAM "echo"
-
-/* The following macros indicate what header files you have. Set the
- macro to 1 if you have the corresponding header file, or 0 if you
- do not. */
-#define HAVE_STDDEF_H 1 /* <stddef.h> */
-#define HAVE_STRING_H 1 /* <string.h> */
-#define HAVE_STRINGS_H 1 /* <strings.h> */
-#define HAVE_UNISTD_H 1 /* <unistd.h> */
-#define HAVE_STDLIB_H 1 /* <stdlib.h> */
-#define HAVE_LIMITS_H 1 /* <limits.h> */
-#define HAVE_TIME_H 1 /* <time.h> */
-#define HAVE_SYS_WAIT_H 1 /* <sys/wait.h> */
-#define HAVE_SYS_IOCTL_H 1 /* <sys/ioctl.h> */
-#define HAVE_DIRENT_H 1 /* <dirent.h> */
-#define HAVE_MEMORY_H 1 /* <memory.h> */
-#define HAVE_SYS_PARAM_H 1 /* <sys/param.h> */
-#define HAVE_UTIME_H 1 /* <utime.h> */
-#define HAVE_FCNTL_H 1 /* <fcntl.h> */
-#define HAVE_SYS_FILE_H 1 /* <sys/file.h> */
-#define HAVE_SYS_TIMES_H 1 /* <sys/times.h> */
-#define HAVE_LIBC_H 0 /* <libc.h> */
-#define HAVE_SYSEXITS_H 1 /* <sysexits.h> */
-#define HAVE_POLL_H 0 /* <poll.h> */
-#define HAVE_TIUSER_H 0 /* <tiuser.h> */
-#define HAVE_XTI_H 0 /* <xti.h> */
-#define HAVE_SYS_TLI_H 0 /* <sys/tli.h> */
-#define HAVE_STROPTS_H 0 /* <stropts.h> */
-#define HAVE_FTW_H 0 /* <ftw.h> */
-#define HAVE_GLOB_H 1 /* <glob.h> */
-#define HAVE_SYS_SELECT_H 0 /* <sys/select.h> */
-#define HAVE_SYS_TYPES_TCP_H 0 /* <sys/types.tcp.h> */
-
-/* If major and minor are not defined in <sys/types.h>, but are in
- <sys/mkdev.h>, set MAJOR_IN_MKDEV to 1. If they are in
- <sys/sysmacros.h>, set MAJOR_IN_SYSMACROS to 1. */
-#define MAJOR_IN_MKDEV 0
-#define MAJOR_IN_SYSMACROS 0
-
-/* If the macro offsetof is not defined in <stddef.h>, you may give it
- a definition here. If you do not, the code will use a definition
- (in uucp.h) that should be fairly portable. */
-/* #define offsetof */
-
-/* Set RETSIGTYPE to the return type of a signal handler. On newer
- systems this will be void; some older systems use int. */
-#define RETSIGTYPE void
-
-/* Set HAVE_SYS_TIME_AND_TIME_H to 1 if <time.h> and <sys/time.h> can both
- be included in a single source file; if you don't have either or both of
- them, it doesn't matter what you set this to. */
-#define HAVE_SYS_TIME_AND_TIME_H 1
-
-/* Set HAVE_TERMIOS_AND_SYS_IOCTL_H to 1 if <termios.h> and <sys/ioctl.h>
- can both be included in a single source file; if you don't have either
- or both of them, it doesn't matter what you set this to. */
-#define HAVE_TERMIOS_AND_SYS_IOCTL_H 1
-
-/* If you are configuring by hand, you should set one of the terminal
- driver options in policy.h. If you are autoconfiguring, the script
- will check whether your system defines CBREAK, which is a terminal
- setting; if your system supports CBREAK, and you don't set a terminal
- driver in policy.h, the code will assume that you have a BSD style
- terminal driver. */
-#define HAVE_CBREAK 1
-
-/* The package needs several standard types. If you are using the
- configure script, it will look in standard places for these types,
- and give default definitions for them here if it doesn't find them.
- The default definitions should work on most systems, but you may
- want to check them. If you are configuring by hand, you will have
- to figure out whether the types are defined on your system, and
- what they should be defined to.
-
- Any type that is not defined on your system should get a macro
- definition. The definition should be of the name of the type in
- all capital letters. For example, #define PID_T int. If the type
- is defined in a standard header file, the macro name should not be
- defined. */
-
-/* The type pid_t is used to hold a process ID number. It is normally
- defined in <sys/types.h>. This is the type returned by the
- functions fork or getpid. Usually int will work fine. */
-#undef PID_T
-
-/* The type uid_t is used to hold a user ID number. It is normally
- defined in <sys/types.h>. This is the type returned by the getuid
- function. Usually int will work fine. */
-#undef UID_T
-
-/* The type gid_t is used to hold a group ID number. It is sometimes
- defined in <sys/types.h>. This is the type returned by the getgid
- function. Usually int will work fine. */
-#undef GID_T
-
-/* The type off_t is used to hold an offset in a file. It is sometimes
- defined in <sys/types.h>. This is the type of the second argument to
- the lseek function. Usually long will work fine. */
-#undef OFF_T
-
-/* Set HAVE_SIG_ATOMIC_T_IN_SIGNAL_H if the type sig_atomic_t is defined
- in <signal.h> as required by ANSI C. */
-#define HAVE_SIG_ATOMIC_T_IN_SIGNAL_H 0
-
-/* Set HAVE_SIG_ATOMIC_T_IN_TYPES_H if the type sig_atomic_t is defined
- in <sys/types.h>. This is ignored if HAVE_SIG_ATOMIC_T_IN_SIGNAL_H is
- set to 1. */
-#define HAVE_SIG_ATOMIC_T_IN_TYPES_H 0
-
-/* The type sig_atomic_t is used to hold a value which may be
- referenced in a single atomic operation. If it is not defined in
- either <signal.h> or <sys/types.h>, you may want to give it a
- definition here. If you don't, the code will use char. If your
- compiler does not support sig_atomic_t, there is no type which is
- really correct; fortunately, for this package it does not really
- matter very much. */
-#undef SIG_ATOMIC_T
-
-/* Set HAVE_SIZE_T_IN_STDDEF_H to 1 if the type size_t is defined in
- <stddef.h> as required by ANSI C. */
-#define HAVE_SIZE_T_IN_STDDEF_H 1
-
-/* Set HAVE_SIZE_T_IN_TYPES_H to 1 if the type size_t is defined in
- <sys/types.h>. This is ignored if HAVE_SIZE_T_IN_STDDEF_H is set
- to 1. */
-#define HAVE_SIZE_T_IN_TYPES_H 1
-
-/* The type size_t is used to hold the size of an object. In
- particular, an argument of this type is passed as the size argument
- to the malloc and realloc functions. If size_t is not defined in
- either <stddef.h> or <sys/types.h>, you may want to give it a
- definition here. If you don't, the code will use unsigned. */
-#undef SIZE_T
-
-/* Set HAVE_TIME_T_IN_TIME_H to 1 if the type time_t is defined in
- <time.h>, as required by the ANSI C standard. */
-#define HAVE_TIME_T_IN_TIME_H 1
-
-/* Set HAVE_TIME_T_IN_TYPES_H to 1 if the type time_t is defined in
- <sys/types.h>. This is ignored if HAVE_TIME_T_IN_TIME_H is set to
- 1. */
-#define HAVE_TIME_T_IN_TYPES_H 1
-
-/* When Taylor UUCP is talking to another instance of itself, it will
- tell the other side the size of a file before it is transferred.
- If the package can determine how much disk space is available, it
- will use this information to avoid filling up the disk. Define one
- of the following macros to tell the code how to determine the
- amount of available disk space. It is possible that none of these
- are appropriate; it will do no harm to use none of them, but, of
- course, nothing will then prevent the package from filling up the
- disk. Note that this space check is only useful when talking to
- another instance of Taylor UUCP.
-
- STAT_STATVFS statvfs function
- STAT_STATFS2_BSIZE two argument statfs function with f_bsize field
- STAT_STATFS2_FSIZE two argument statfs function with f_fsize field
- STAT_STATFS2_FS_DATA two argument statfs function with fd_req field
- STAT_STATFS4 four argument statfs function
- STAT_USTAT the ustat function with 512 byte blocks. */
-#define STAT_STATVFS 0
-#define STAT_STATFS2_BSIZE 0
-#define STAT_STATFS2_FSIZE 1
-#define STAT_STATFS2_FS_DATA 0
-#define STAT_STATFS4 0
-#define STAT_USTAT 0
-
-/* Set HAVE_VOID to 1 if the compiler supports declaring functions with
- a return type of void and casting values to void. */
-#define HAVE_VOID 1
-
-/* Set HAVE_UNSIGNED_CHAR to 1 if the compiler supports the type unsigned
- char. */
-#define HAVE_UNSIGNED_CHAR 1
-
-/* Set HAVE_ERRNO_DECLARATION to 1 if errno is declared in <errno.h>. */
-#define HAVE_ERRNO_DECLARATION 1
-
-/* There are now a number of functions to check for. For each of
- these, the macro HAVE_FUNC should be set to 1 if your system has
- FUNC. For example, HAVE_VFPRINTF should be set to 1 if your system
- has vfprintf, 0 otherwise. */
-
-/* Taylor UUCP will take advantage of the following functions if they
- are available, but knows how to deal with their absence. */
-#define HAVE_VFPRINTF 1
-#define HAVE_FTRUNCATE 1
-#define HAVE_LTRUNC 0
-#define HAVE_WAITPID 1
-#define HAVE_WAIT4 1
-#define HAVE_GLOB 1
-#define HAVE_SETREUID 1
-
-/* There are several functions which are replaced in the subdirectory
- lib. If they are missing, the configure script will automatically
- add them to lib/Makefile to force them to be recompiled. If you
- are configuring by hand, you will have to do this yourself. The
- string @LIBOBJS@ in lib/Makefile.in should be replaced by a list of
- object files in lib/Makefile. The following comments tell you
- which object file names to add (they are generally fairly obvious,
- given that the file names have no more than six characters before
- the period). */
-
-/* For each of these functions, if it does not exist, the indicated
- object file should be added to lib/Makefile. */
-#define HAVE_BSEARCH 1 /* bsrch.o */
-#define HAVE_GETLINE 0 /* getlin.o */
-#define HAVE_MEMCHR 1 /* memchr.o */
-#define HAVE_STRDUP 1 /* strdup.o */
-#define HAVE_STRSTR 1 /* strstr.o */
-#define HAVE_STRTOL 1 /* strtol.o */
-
-/* If neither of these functions exists, you should add bzero.o to
- lib/Makefile. */
-#define HAVE_BZERO 1
-#define HAVE_MEMSET 1
-
-/* If neither of these functions exists, you should add memcmp.o to
- lib/Makefile. */
-#define HAVE_MEMCMP 1
-#define HAVE_BCMP 1
-
-/* If neither of these functions exists, you should add memcpy.o to
- lib/Makefile. */
-#define HAVE_MEMCPY 1
-#define HAVE_BCOPY 1
-
-/* If neither of these functions exists, you should add strcas.o to
- lib/Makefile. */
-#define HAVE_STRCASECMP 1
-#define HAVE_STRICMP 0
-
-/* If neither of these functions exists, you should add strncs.o to
- lib/Makefile. */
-#define HAVE_STRNCASECMP 1
-#define HAVE_STRNICMP 0
-
-/* If neither of these functions exists, you should add strchr.o to
- lib/Makefile. */
-#define HAVE_STRCHR 1
-#define HAVE_INDEX 1
-
-/* If neither of these functions exists, you should add strrch.o to
- lib/Makefile. */
-#define HAVE_STRRCHR 1
-#define HAVE_RINDEX 1
-
-/* There are also Unix specific functions which are replaced in the
- subdirectory unix. If they are missing, the configure script will
- automatically add them to unix/Makefile to force them to be
- recompiled. If you are configuring by hand, you will have to do
- this yourself. The string @UNIXOBJS@ in unix/Makefile.in should be
- replaced by a list of object files in unix/Makefile. The following
- comments tell you which object file names to add. */
-
-/* For each of these functions, if it does not exist, the indicated
- object file should be added to unix/Makefile. */
-#define HAVE_OPENDIR 1 /* dirent.o */
-#define HAVE_DUP2 1 /* dup2.o */
-#define HAVE_FTW 0 /* ftw.o */
-#define HAVE_REMOVE 1 /* remove.o */
-#define HAVE_RENAME 1 /* rename.o */
-#define HAVE_STRERROR 1 /* strerr.o */
-
-/* The code needs to know how to create directories. If you have the
- mkdir function, set HAVE_MKDIR to 1 and replace @UUDIR@ in
- Makefile.in with '# ' (the configure script will set @UUDIR@
- according to the variable UUDIR). Otherwise, set HAVE_MKDIR to 0,
- remove @UUDIR@ from Makefile.in, set MKDIR_PROGRAM to the name of
- the program which will create a directory named on the command line
- (e.g., "/bin/mkdir"), and add mkdir.o to the @UNIXOBJS@ string in
- unix/Makefile.in. */
-#define HAVE_MKDIR 1
-#define MKDIR_PROGRAM unused
-
-/* The code also needs to know how to remove directories. If you have
- the rmdir function, set HAVE_RMDIR to 1. Otherwise, set
- RMDIR_PROGRAM to the name of the program which will remove a
- directory named on the command line (e.g., "/bin/rmdir") and add
- rmdir.o to the @UNIXOBJS@ string in unix/Makefile.in. */
-#define HAVE_RMDIR 1
-#define RMDIR_PROGRAM unused
-
-/* The code needs to know to how to get the name of the current
- directory. If getcwd is available it will be used, otherwise if
- getwd is available it will be used. Otherwise, set PWD_PROGRAM to
- the name of the program which will print the name of the current
- working directory (e.g., "/bin/pwd") and add getcwd.o to the
- @UNIXOBJS@ string in unix/Makefile.in. */
-#define HAVE_GETCWD 1
-#define HAVE_GETWD 1
-#define PWD_PROGRAM unused
-
-/* If you have either sigsetjmp or setret, it will be used instead of
- setjmp. These functions will only be used if your system restarts
- system calls after interrupts (see HAVE_RESTARTABLE_SYSCALLS,
- below). */
-#define HAVE_SIGSETJMP 0
-#define HAVE_SETRET 0
-
-/* The code needs to know what function to use to set a signal
- handler. If will try to use each of the following functions in
- turn. If none are available, it will use signal, which is assumed
- to always exist. */
-#define HAVE_SIGACTION 1
-#define HAVE_SIGVEC 1
-#define HAVE_SIGSET 0
-
-/* If the code is going to use sigvec (HAVE_SIGACTION is 0 and
- HAVE_SIGVEC is 1), then HAVE_SIGVEC_SV_FLAGS must be set to 1 if
- the sigvec structure contains the sv_flags field, or 0 if the
- sigvec structure contains the sv_onstack field. If the code is not
- going to use sigvec, it doesn't matter what this is set to. */
-#define HAVE_SIGVEC_SV_FLAGS 1
-
-/* The code will try to use each of the following functions in turn
- when blocking signals from delivery. If none are available, a
- relatively unimportant race condition will exist. */
-#define HAVE_SIGPROCMASK 1
-#define HAVE_SIGBLOCK 1
-#define HAVE_SIGHOLD 0
-
-/* If you have either of the following functions, it will be used to
- determine the number of file descriptors which may be open.
- Otherwise, the code will use OPEN_MAX if defined, then NOFILE if
- defined, then 20. */
-#define HAVE_GETDTABLESIZE 1
-#define HAVE_SYSCONF 0
-
-/* The code will use one of the following functions when detaching
- from a terminal. One of these must exist. */
-#define HAVE_SETPGRP 0
-#define HAVE_SETSID 1
-
-/* If you do not specify the local node name in the main configuration
- file, Taylor UUCP will try to use each of the following functions
- in turn. If neither is available, you must specify the local node
- name in the configuration file. */
-#define HAVE_GETHOSTNAME 1
-#define HAVE_UNAME 0
-
-/* The code will try to use each of the following functions in turn to
- determine the current time. If none are available, it will use
- time, which is assumed to always exist. */
-#define HAVE_GETTIMEOFDAY 1
-#define HAVE_FTIME 0
-
-/* If neither gettimeofday nor ftime is available, the code will use
- times (if available) to measure a span of time. See also the
- discussion of TIMES_TICK in policy.h. */
-#define HAVE_TIMES 1
-
-/* When a chat script requests a pause of less than a second with \p,
- Taylor UUCP will try to use each of the following functions in
- turn. If none are available, it will sleep for a full second.
- Also, the (non-portable) tstuu program requires either select or
- poll. */
-#define HAVE_NAPMS 0
-#define HAVE_NAP 0
-#define HAVE_USLEEP 1
-#define HAVE_POLL 0
-#define HAVE_SELECT 1
-
-/* If the getgrent function is available, it will be used to determine
- all the groups a user belongs to when checking file access
- permissions. */
-#define HAVE_GETGRENT 1
-
-/* If the socket function is available, TCP support code will be
- compiled in. */
-#define HAVE_SOCKET 1
-
-/* If the t_open function is available, TLI support code will be
- compiled in. This may require adding a library, such as -lnsl or
- -lxti, to the Makefile variables LIBS. */
-#define HAVE_T_OPEN 0
-
-/* That's the end of the list of the functions. Now there are a few
- last miscellaneous items. */
-
-/* On some systems the following functions are declared in such a way
- that the code cannot make a simple extern. On other systems, these
- functions are not declared at all, and the extern is required. If
- a declaration of the function, as shown, compiles on your system,
- set the value to 1. Not all functions declared externally are
- listed here, only the ones with which I have had trouble. */
-/* extern long times (); */
-#define TIMES_DECLARATION_OK 0
-/* extern struct passwd *getpwnam (); */
-#define GETPWNAM_DECLARATION_OK 1
-/* extern struct passwd *getpwuid (); */
-#define GETPWUID_DECLARATION_OK 0
-/* extern struct group *getgrent (); */
-#define GETGRENT_DECLARATION_OK 1
-
-/* Set HAVE_BSD_PGRP to 1 if your getpgrp call takes 1 argument and
- your setpgrp calls takes 2 arguments (on System V they generally
- take no arguments). You can safely set this to 1 on System V,
- provided the call will compile without any errors. */
-#define HAVE_BSD_PGRP 0
-
-/* Set HAVE_UNION_WAIT to 1 if union wait is defined in the header
- file <sys/wait.h>. */
-#define HAVE_UNION_WAIT 1
-
-/* Set HAVE_LONG_FILE_NAMES to 1 if the system supports file names
- longer than 14 characters. */
-#define HAVE_LONG_FILE_NAMES 1
-
-/* If slow system calls are restarted after interrupts, set
- HAVE_RESTARTABLE_SYSCALLS to 1. This is ignored if HAVE_SIGACTION
- is 1 or if HAVE_SIGVEC is 1 and HAVE_SIGVEC_SV_FLAGS is 1 and
- SV_INTERRUPT is defined in <signal.h>. In both of these cases
- system calls can be prevented from restarting. */
-#define HAVE_RESTARTABLE_SYSCALLS 1
-
-/* Some systems supposedly need the following macros to be defined.
- These are handled by the configure script (it will turn #undef into
- #define when appropriate, which is why the peculiar #ifndef #undef
- construction is used). If you are configuring by hand, you may add
- appropriate definitions here, or just add them to CFLAGS when
- running make. */
-#ifndef _ALL_SOURCE
-#undef _ALL_SOURCE
-#endif
-#ifndef _POSIX_SOURCE
-#undef _POSIX_SOURCE
-#endif
-#ifndef _MINIX
-#undef _MINIX
-#endif
-#ifndef _POSIX_1_SOURCE
-#undef _POSIX_1_SOURCE
-#endif
diff --git a/gnu/libexec/uucp/common_sources/tcp.c b/gnu/libexec/uucp/common_sources/tcp.c
deleted file mode 100644
index 161e5f9e..0000000
--- a/gnu/libexec/uucp/common_sources/tcp.c
+++ /dev/null
@@ -1,477 +0,0 @@
-/* tcp.c
- Code to handle TCP connections.
-
- Copyright (C) 1991, 1992, 1993 Ian Lance Taylor
-
- This file is part of the Taylor UUCP package.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- The author of the program may be contacted at ian@airs.com or
- c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
- */
-
-#include "uucp.h"
-
-#if USE_RCS_ID
-const char tcp_rcsid[] = "$Id: tcp.c,v 1.2 1994/05/07 18:09:01 ache Exp $";
-#endif
-
-#if HAVE_TCP
-
-#include "uudefs.h"
-#include "uuconf.h"
-#include "sysdep.h"
-#include "conn.h"
-#include "system.h"
-
-#include <errno.h>
-
-#if HAVE_SYS_TYPES_TCP_H
-#include <sys/types.tcp.h>
-#endif
-#include <sys/socket.h>
-#include <netdb.h>
-#include <netinet/in.h>
-
-#if HAVE_FCNTL_H
-#include <fcntl.h>
-#else
-#if HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-#endif
-
-#ifndef FD_CLOEXEC
-#define FD_CLOEXEC 1
-#endif
-
-/* This code handles TCP connections. It assumes a Berkeley socket
- interface. */
-
-/* The normal "uucp" port number. */
-#define IUUCP_PORT (540)
-
-/* Local functions. */
-static void utcp_free P((struct sconnection *qconn));
-static boolean ftcp_open P((struct sconnection *qconn, long ibaud,
- boolean fwait));
-static boolean ftcp_close P((struct sconnection *qconn,
- pointer puuconf,
- struct uuconf_dialer *qdialer,
- boolean fsuccess));
-static boolean ftcp_dial P((struct sconnection *qconn, pointer puuconf,
- const struct uuconf_system *qsys,
- const char *zphone,
- struct uuconf_dialer *qdialer,
- enum tdialerfound *ptdialer));
-static int itcp_port_number P((const char *zport));
-
-/* The command table for a TCP connection. */
-static const struct sconncmds stcpcmds =
-{
- utcp_free,
- NULL, /* pflock */
- NULL, /* pfunlock */
- ftcp_open,
- ftcp_close,
- ftcp_dial,
- fsysdep_conn_read,
- fsysdep_conn_write,
- fsysdep_conn_io,
- NULL, /* pfbreak */
- NULL, /* pfset */
- NULL, /* pfcarrier */
- fsysdep_conn_chat,
- NULL /* pibaud */
-};
-
-/* Initialize a TCP connection. */
-
-boolean
-fsysdep_tcp_init (qconn)
- struct sconnection *qconn;
-{
- struct ssysdep_conn *q;
-
- q = (struct ssysdep_conn *) xmalloc (sizeof (struct ssysdep_conn));
- q->o = -1;
- q->ord = -1;
- q->owr = -1;
- q->zdevice = NULL;
- q->iflags = -1;
- q->iwr_flags = -1;
- q->fterminal = FALSE;
- q->ftli = FALSE;
- q->ibaud = 0;
-
- qconn->psysdep = (pointer) q;
- qconn->qcmds = &stcpcmds;
- return TRUE;
-}
-
-/* Free a TCP connection. */
-
-static void
-utcp_free (qconn)
- struct sconnection *qconn;
-{
- xfree (qconn->psysdep);
-}
-
-/* Open a TCP connection. If the fwait argument is TRUE, we are
- running as a server. Otherwise we are just trying to reach another
- system. */
-
-static boolean
-ftcp_open (qconn, ibaud, fwait)
- struct sconnection *qconn;
- long ibaud;
- boolean fwait;
-{
- struct ssysdep_conn *qsysdep;
- struct sockaddr_in s;
- const char *zport;
- uid_t iuid, ieuid;
-
- ulog_device ("TCP");
-
- qsysdep = (struct ssysdep_conn *) qconn->psysdep;
-
- qsysdep->o = socket (AF_INET, SOCK_STREAM, 0);
- if (qsysdep->o < 0)
- {
- ulog (LOG_ERROR, "socket: %s", strerror (errno));
- return FALSE;
- }
-
- if (fcntl (qsysdep->o, F_SETFD,
- fcntl (qsysdep->o, F_GETFD, 0) | FD_CLOEXEC) < 0)
- {
- ulog (LOG_ERROR, "fcntl (FD_CLOEXEC): %s", strerror (errno));
- (void) close (qsysdep->o);
- qsysdep->o = -1;
- return FALSE;
- }
-
- qsysdep->iflags = fcntl (qsysdep->o, F_GETFL, 0);
- if (qsysdep->iflags < 0)
- {
- ulog (LOG_ERROR, "fcntl: %s", strerror (errno));
- (void) close (qsysdep->o);
- qsysdep->o = -1;
- return FALSE;
- }
-
- /* We save our process ID in the qconn structure. This is checked
- in ftcp_close. */
- qsysdep->ipid = getpid ();
-
- /* If we aren't waiting for a connection, we're done. */
- if (! fwait)
- return TRUE;
-
- /* Run as a server and wait for a new connection. The code in
- uucico.c has already detached us from our controlling terminal.
- From this point on if the server gets an error we exit; we only
- return if we have received a connection. It would be more robust
- to respawn the server if it fails; someday. */
- bzero ((pointer) &s, sizeof s);
- s.sin_family = AF_INET;
- zport = qconn->qport->uuconf_u.uuconf_stcp.uuconf_zport;
- s.sin_port = itcp_port_number (zport);
- s.sin_addr.s_addr = htonl (INADDR_ANY);
-
- /* Swap to our real user ID when doing the bind call. This will
- permit the server to use privileged TCP ports when invoked by
- root. We only swap if our effective user ID is not root, so that
- the program can also be made suid root in order to get privileged
- ports when invoked by anybody. */
- iuid = getuid ();
- ieuid = geteuid ();
- if (ieuid != 0)
- {
-#if HAVE_SETREUID
- /* Swap the effective user id and the real user id. We can then
- swap them back again when we want to return to the uucp
- user's permissions. */
- if (setreuid (ieuid, iuid) < 0)
- {
- ulog (LOG_ERROR, "setreuid (%ld, %ld): %s",
- (long) ieuid, (long) iuid, strerror (errno));
- (void) close (qsysdep->o);
- qsysdep->o = -1;
- return FALSE;
- }
-#else /* ! HAVE_SETREUID */
-#if HAVE_SAVED_SETUID
- /* Set the effective user id to the real user id. Since the
- effective user id is the saved setuid we will able to set
- back to it later. If the real user id is root we will not be
- able to switch back and forth, but that doesn't matter since
- we only want to switch once. */
- if (setuid (iuid) < 0)
- {
- ulog (LOG_ERROR, "setuid (%ld): %s", (long) iuid,
- strerror (errno));
- (void) close (qsysdep->o);
- qsysdep->o = -1;
- return FALSE;
- }
-#else /* ! HAVE_SAVED_SETUID */
- /* There's no way to switch between real permissions and
- effective permissions. Just try the bind with the uucp
- permissions. */
-#endif /* ! HAVE_SAVED_SETUID */
-#endif /* ! HAVE_SETREUID */
- }
-
- if (bind (qsysdep->o, (struct sockaddr *) &s, sizeof s) < 0)
- ulog (LOG_FATAL, "bind: %s", strerror (errno));
-
- /* Now swap back to the uucp user ID. */
- if (ieuid != 0)
- {
-#if HAVE_SETREUID
- if (setreuid (iuid, ieuid) < 0)
- {
- ulog (LOG_ERROR, "setreuid (%ld, %ld): %s",
- (long) iuid, (long) ieuid, strerror (errno));
- (void) close (qsysdep->o);
- qsysdep->o = -1;
- return FALSE;
- }
-#else /* ! HAVE_SETREUID */
-#if HAVE_SAVED_SETUID
- /* Set ourselves back to our original effective user id. */
- if (setuid ((uid_t) ieuid) < 0)
- {
- ulog (LOG_ERROR, "setuid (%ld): %s", (long) ieuid,
- strerror (errno));
- (void) close (qsysdep->o);
- qsysdep->o = -1;
- return FALSE;
- }
-#else /* ! HAVE_SAVED_SETUID */
- /* We didn't switch, no need to switch back. */
-#endif /* ! HAVE_SAVED_SETUID */
-#endif /* ! HAVE_SETREUID */
- }
-
- if (listen (qsysdep->o, 5) < 0)
- ulog (LOG_FATAL, "listen: %s", strerror (errno));
-
- while (! FGOT_SIGNAL ())
- {
- size_t clen;
- int onew;
- pid_t ipid;
-
- DEBUG_MESSAGE0 (DEBUG_PORT,
- "ftcp_open: Waiting for connections");
-
- clen = sizeof s;
- onew = accept (qsysdep->o, (struct sockaddr *) &s, &clen);
- if (onew < 0)
- ulog (LOG_FATAL, "accept: %s", strerror (errno));
-
- DEBUG_MESSAGE0 (DEBUG_PORT,
- "ftcp_open: Got connection; forking");
-
- ipid = ixsfork ();
- if (ipid < 0)
- ulog (LOG_FATAL, "fork: %s", strerror (errno));
- if (ipid == 0)
- {
- (void) close (qsysdep->o);
- qsysdep->o = onew;
-
- /* Now we fork and let our parent die, so that we become
- a child of init. This lets the main server code wait
- for its child and then continue without accumulating
- zombie children. */
- ipid = ixsfork ();
- if (ipid < 0)
- {
- ulog (LOG_ERROR, "fork: %s", strerror (errno));
- _exit (EXIT_FAILURE);
- }
-
- if (ipid != 0)
- _exit (EXIT_SUCCESS);
-
- ulog_id (getpid ());
-
- return TRUE;
- }
-
- (void) close (onew);
-
- /* Now wait for the child. */
- (void) ixswait ((unsigned long) ipid, (const char *) NULL);
- }
-
- /* We got a signal. */
- usysdep_exit (FALSE);
-
- /* Avoid compiler warnings. */
- return FALSE;
-}
-
-/* Close the port. */
-
-/*ARGSUSED*/
-static boolean
-ftcp_close (qconn, puuconf, qdialer, fsuccess)
- struct sconnection *qconn;
- pointer puuconf;
- struct uuconf_dialer *qdialer;
- boolean fsuccess;
-{
- struct ssysdep_conn *qsysdep;
- boolean fret;
-
- qsysdep = (struct ssysdep_conn *) qconn->psysdep;
- fret = TRUE;
- if (qsysdep->o >= 0 && close (qsysdep->o) < 0)
- {
- ulog (LOG_ERROR, "close: %s", strerror (errno));
- fret = FALSE;
- }
- qsysdep->o = -1;
-
- /* If the current pid is not the one we used to open the port, then
- we must have forked up above and we are now the child. In this
- case, we are being called from within the fendless loop in
- uucico.c. We return FALSE to force the loop to end and the child
- to exit. This should be handled in a cleaner fashion. */
- if (qsysdep->ipid != getpid ())
- fret = FALSE;
-
- return fret;
-}
-
-/* Dial out on a TCP port, so to speak: connect to a remote computer. */
-
-/*ARGSUSED*/
-static boolean
-ftcp_dial (qconn, puuconf, qsys, zphone, qdialer, ptdialer)
- struct sconnection *qconn;
- pointer puuconf;
- const struct uuconf_system *qsys;
- const char *zphone;
- struct uuconf_dialer *qdialer;
- enum tdialerfound *ptdialer;
-{
- struct ssysdep_conn *qsysdep;
- const char *zhost;
- struct hostent *q;
- struct sockaddr_in s;
- const char *zport;
- char **pzdialer;
-
- qsysdep = (struct ssysdep_conn *) qconn->psysdep;
-
- *ptdialer = DIALERFOUND_FALSE;
-
- zhost = zphone;
- if (zhost == NULL)
- {
- if (qsys == NULL)
- {
- ulog (LOG_ERROR, "No address for TCP connection");
- return FALSE;
- }
- zhost = qsys->uuconf_zname;
- }
-
- errno = 0;
- q = gethostbyname ((char *) zhost);
- if (q == NULL)
- {
- if (errno == 0)
- ulog (LOG_ERROR, "%s: unknown host name", zhost);
- else
- ulog (LOG_ERROR, "gethostbyname (%s): %s", zhost, strerror (errno));
- return FALSE;
- }
-
- s.sin_family = q->h_addrtype;
- memcpy (&s.sin_addr.s_addr, q->h_addr, (size_t) q->h_length);
- zport = qconn->qport->uuconf_u.uuconf_stcp.uuconf_zport;
- s.sin_port = itcp_port_number (zport);
-
- if (connect (qsysdep->o, (struct sockaddr *) &s, sizeof s) < 0)
- {
- ulog (LOG_ERROR, "connect: %s", strerror (errno));
- return FALSE;
- }
-
- /* Handle the dialer sequence, if any. */
- pzdialer = qconn->qport->uuconf_u.uuconf_stcp.uuconf_pzdialer;
- if (pzdialer != NULL && *pzdialer != NULL)
- {
- if (! fconn_dial_sequence (qconn, puuconf, pzdialer, qsys, zphone,
- qdialer, ptdialer))
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Get the port number given a name. The argument will almost always
- be "uucp" so we cache that value. The return value is always in
- network byte order. This returns -1 on error. */
-
-static int
-itcp_port_number (zname)
- const char *zname;
-{
- boolean fuucp;
- static int iuucp;
- int i;
- char *zend;
- struct servent *q;
-
- fuucp = strcmp (zname, "uucp") == 0;
- if (fuucp && iuucp != 0)
- return iuucp;
-
- /* Try it as a number first. */
- i = strtol ((char *) zname, &zend, 10);
- if (i != 0 && *zend == '\0')
- return htons (i);
-
- q = getservbyname ((char *) zname, (char *) "tcp");
- if (q == NULL)
- {
- /* We know that the "uucp" service should be 540, even if isn't
- in /etc/services. */
- if (fuucp)
- {
- iuucp = htons (IUUCP_PORT);
- return iuucp;
- }
- ulog (LOG_ERROR, "getservbyname (%s): %s", zname, strerror (errno));
- return -1;
- }
-
- if (fuucp)
- iuucp = q->s_port;
-
- return q->s_port;
-}
-
-#endif /* HAVE_TCP */
diff --git a/gnu/libexec/uucp/common_sources/tli.c b/gnu/libexec/uucp/common_sources/tli.c
deleted file mode 100644
index db3491a..0000000
--- a/gnu/libexec/uucp/common_sources/tli.c
+++ /dev/null
@@ -1,582 +0,0 @@
-/* tli.c
- Code to handle TLI connections.
-
- Copyright (C) 1992, 1993, 1994 Ian Lance Taylor
-
- This file is part of the Taylor UUCP package.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- The author of the program may be contacted at ian@airs.com or
- c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
- */
-
-#include "uucp.h"
-
-#if USE_RCS_ID
-const char tli_rcsid[] = "$Id: tli.c,v 1.2 1994/05/07 18:09:03 ache Exp $";
-#endif
-
-#if HAVE_TLI
-
-#include "sysdep.h"
-#include "uudefs.h"
-#include "uuconf.h"
-#include "conn.h"
-#include "system.h"
-
-#include <errno.h>
-
-#if HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
-#endif
-
-#if HAVE_TIUSER_H
-#include <tiuser.h>
-#else
-#if HAVE_XTI_H
-#include <xti.h>
-#else
-#if HAVE_SYS_TLI_H
-#include <sys/tli.h>
-#endif
-#endif
-#endif
-
-#if HAVE_STROPTS_H
-#include <stropts.h>
-#endif
-
-#if HAVE_FCNTL_H
-#include <fcntl.h>
-#else
-#if HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-#endif
-
-#ifndef O_RDONLY
-#define O_RDONLY 0
-#define O_WRONLY 1
-#define O_RDWR 2
-#endif
-
-#ifndef FD_CLOEXEC
-#define FD_CLOEXEC 1
-#endif
-
-/* The arguments to t_alloca have two different names. I want the
- SVID ones, not the XPG3 ones. */
-#ifndef T_BIND
-#define T_BIND T_BIND_STR
-#endif
-#ifndef T_CALL
-#define T_CALL T_CALL_STR
-#endif
-
-/* Hopefully these externs will not cause any trouble. This is how
- they are shown in the SVID. */
-extern int t_errno;
-extern char *t_errlist[];
-extern int t_nerr;
-
-#ifndef HAVE_TIUSER_H
-#ifndef t_alloc
-extern pointer t_alloc ();
-#endif
-#endif
-
-/* This code handles TLI connections. It's Unix specific. It's
- largely based on code from Unix Network Programming, by W. Richard
- Stevens. */
-
-/* Local functions. */
-static const char *ztlierror P((void));
-static void utli_free P((struct sconnection *qconn));
-static boolean ftli_push P((struct sconnection *qconn));
-static boolean ftli_open P((struct sconnection *qconn, long ibaud,
- boolean fwait));
-static boolean ftli_close P((struct sconnection *qconn,
- pointer puuconf,
- struct uuconf_dialer *qdialer,
- boolean fsuccess));
-static boolean ftli_dial P((struct sconnection *qconn, pointer puuconf,
- const struct uuconf_system *qsys,
- const char *zphone,
- struct uuconf_dialer *qdialer,
- enum tdialerfound *ptdialer));
-
-/* The command table for a TLI connection. */
-static const struct sconncmds stlicmds =
-{
- utli_free,
- NULL, /* pflock */
- NULL, /* pfunlock */
- ftli_open,
- ftli_close,
- ftli_dial,
- fsysdep_conn_read,
- fsysdep_conn_write,
- fsysdep_conn_io,
- NULL, /* pfbreak */
- NULL, /* pfset */
- NULL, /* pfcarrier */
- fsysdep_conn_chat,
- NULL /* pibaud */
-};
-
-/* Get a TLI error string. */
-
-static const char *
-ztlierror ()
-{
- if (t_errno == TSYSERR)
- return strerror (errno);
- if (t_errno < 0 || t_errno >= t_nerr)
- return "Unknown TLI error";
- return t_errlist[t_errno];
-}
-
-/* Initialize a TLI connection. This may be called with qconn->qport
- NULL, when opening standard input as a TLI connection. */
-
-boolean
-fsysdep_tli_init (qconn)
- struct sconnection *qconn;
-{
- struct ssysdep_conn *q;
-
- q = (struct ssysdep_conn *) xmalloc (sizeof (struct ssysdep_conn));
- q->o = -1;
- q->ord = -1;
- q->owr = -1;
- q->zdevice = NULL;
- q->iflags = -1;
- q->iwr_flags = -1;
- q->fterminal = FALSE;
- q->ftli = TRUE;
- q->ibaud = 0;
-
- qconn->psysdep = (pointer) q;
- qconn->qcmds = &stlicmds;
- return TRUE;
-}
-
-/* Free a TLI connection. */
-
-static void
-utli_free (qconn)
- struct sconnection *qconn;
-{
- xfree (qconn->psysdep);
-}
-
-/* Push all desired modules onto a TLI stream. If the user requests a
- STREAMS connection without giving a list of modules, we just push
- tirdwr. If the I_PUSH ioctl is not defined on this system, we just
- ignore any list of modules. */
-
-static boolean
-ftli_push (qconn)
- struct sconnection *qconn;
-{
-#ifdef I_PUSH
-
- struct ssysdep_conn *qsysdep;
-
- qsysdep = (struct ssysdep_conn *) qconn->psysdep;
-
- if (qconn->qport->uuconf_u.uuconf_stli.uuconf_pzpush != NULL)
- {
- char **pz;
-
- for (pz = qconn->qport->uuconf_u.uuconf_stli.uuconf_pzpush;
- *pz != NULL;
- pz++)
- {
- if (ioctl (qsysdep->o, I_PUSH, *pz) < 0)
- {
- ulog (LOG_ERROR, "ioctl (I_PUSH, %s): %s", *pz,
- strerror (errno));
- return FALSE;
- }
- }
- }
- else if (qconn->qport->uuconf_u.uuconf_stli.uuconf_fstream)
- {
- if (ioctl (qsysdep->o, I_PUSH, "tirdwr") < 0)
- {
- ulog (LOG_ERROR, "ioctl (I_PUSH, tirdwr): %s",
- strerror (errno));
- return FALSE;
- }
- }
-
- /* If we have just put the connection into stream mode, we must turn
- off the TLI flag to avoid using TLI calls on it. */
- if (qconn->qport->uuconf_u.uuconf_stli.uuconf_fstream)
- qsysdep->ftli = FALSE;
-
-#endif /* defined (I_PUSH) */
-
- return TRUE;
-}
-
-/* Open a TLI connection. If the fwait argument is TRUE, we are
- running as a server. Otherwise we are just trying to reach another
- system. */
-
-static boolean
-ftli_open (qconn, ibaud, fwait)
- struct sconnection *qconn;
- long ibaud;
- boolean fwait;
-{
- struct ssysdep_conn *qsysdep;
- const char *zdevice;
- char *zfreedev;
- const char *zservaddr;
- char *zfreeaddr;
- struct t_bind *qtbind;
- struct t_call *qtcall;
-
- /* Unlike most other device types, we don't bother to call
- ulog_device here, because fconn_open calls it with the name of
- the port anyhow. */
-
- qsysdep = (struct ssysdep_conn *) qconn->psysdep;
-
- zdevice = qconn->qport->uuconf_u.uuconf_stli.uuconf_zdevice;
- if (zdevice == NULL)
- zdevice = qconn->qport->uuconf_zname;
-
- zfreedev = NULL;
- if (*zdevice != '/')
- {
- zfreedev = zbufalc (sizeof "/dev/" + strlen (zdevice));
- sprintf (zfreedev, "/dev/%s", zdevice);
- zdevice = zfreedev;
- }
-
- qsysdep->o = t_open (zdevice, O_RDWR, (struct t_info *) NULL);
- if (qsysdep->o < 0)
- {
- ulog (LOG_ERROR, "t_open (%s): %s", zdevice, ztlierror ());
- ubuffree (zfreedev);
- return FALSE;
- }
-
- if (fcntl (qsysdep->o, F_SETFD,
- fcntl (qsysdep->o, F_GETFD, 0) | FD_CLOEXEC) < 0)
- {
- ulog (LOG_ERROR, "fcntl (FD_CLOEXEC): %s", strerror (errno));
- ubuffree (zfreedev);
- (void) t_close (qsysdep->o);
- qsysdep->o = -1;
- return FALSE;
- }
-
- qsysdep->iflags = fcntl (qsysdep->o, F_GETFL, 0);
- if (qsysdep->iflags < 0)
- {
- ulog (LOG_ERROR, "fcntl: %s", strerror (errno));
- ubuffree (zfreedev);
- (void) t_close (qsysdep->o);
- qsysdep->o = -1;
- return FALSE;
- }
-
- /* We save our process ID in the qconn structure. This is checked
- in ftli_close. */
- qsysdep->ipid = getpid ();
-
- /* If we aren't waiting for a connection, we can bind to any local
- address, and then we're finished. */
- if (! fwait)
- {
- ubuffree (zfreedev);
- if (t_bind (qsysdep->o, (struct t_bind *) NULL,
- (struct t_bind *) NULL) < 0)
- {
- ulog (LOG_ERROR, "t_bind: %s", ztlierror ());
- (void) t_close (qsysdep->o);
- qsysdep->o = -1;
- return FALSE;
- }
- return TRUE;
- }
-
- /* Run as a server and wait for a new connection. The code in
- uucico.c has already detached us from our controlling terminal.
- From this point on if the server gets an error we exit; we only
- return if we have received a connection. It would be more robust
- to respawn the server if it fails; someday. */
- qtbind = (struct t_bind *) t_alloc (qsysdep->o, T_BIND, T_ALL);
- if (qtbind == NULL)
- ulog (LOG_FATAL, "t_alloc (T_BIND): %s", ztlierror ());
-
- zservaddr = qconn->qport->uuconf_u.uuconf_stli.uuconf_zservaddr;
- if (zservaddr == NULL)
- ulog (LOG_FATAL, "Can't run as TLI server; no server address");
-
- zfreeaddr = zbufcpy (zservaddr);
- qtbind->addr.len = cescape (zfreeaddr);
- if (qtbind->addr.len > qtbind->addr.maxlen)
- ulog (LOG_FATAL, "%s: TLI server address too long (max %d)",
- zservaddr, qtbind->addr.maxlen);
- memcpy (qtbind->addr.buf, zfreeaddr, qtbind->addr.len);
- ubuffree (zfreeaddr);
-
- qtbind->qlen = 5;
-
- if (t_bind (qsysdep->o, qtbind, (struct t_bind *) NULL) < 0)
- ulog (LOG_FATAL, "t_bind (%s): %s", zservaddr, ztlierror ());
-
- (void) t_free ((pointer) qtbind, T_BIND);
-
- qtcall = (struct t_call *) t_alloc (qsysdep->o, T_CALL, T_ALL);
- if (qtcall == NULL)
- ulog (LOG_FATAL, "t_alloc (T_CALL): %s", ztlierror ());
-
- while (! FGOT_SIGNAL ())
- {
- int onew;
- pid_t ipid;
-
- DEBUG_MESSAGE0 (DEBUG_PORT,
- "ftli_open: Waiting for connections");
-
- if (t_listen (qsysdep->o, qtcall) < 0)
- ulog (LOG_FATAL, "t_listen: %s", ztlierror ());
-
- onew = t_open (zdevice, O_RDWR, (struct t_info *) NULL);
- if (onew < 0)
- ulog (LOG_FATAL, "t_open (%s): %s", zdevice, ztlierror ());
-
- if (fcntl (onew, F_SETFD,
- fcntl (onew, F_GETFD, 0) | FD_CLOEXEC) < 0)
- ulog (LOG_FATAL, "fcntl (FD_CLOEXEC): %s", strerror (errno));
-
- if (t_bind (onew, (struct t_bind *) NULL, (struct t_bind *) NULL) < 0)
- ulog (LOG_FATAL, "t_bind: %s", ztlierror ());
-
- if (t_accept (qsysdep->o, onew, qtcall) < 0)
- {
- /* We may have received a disconnect. */
- if (t_errno != TLOOK)
- ulog (LOG_FATAL, "t_accept: %s", ztlierror ());
- if (t_rcvdis (qsysdep->o, (struct t_discon *) NULL) < 0)
- ulog (LOG_FATAL, "t_rcvdis: %s", ztlierror ());
- (void) t_close (onew);
- continue;
- }
-
- DEBUG_MESSAGE0 (DEBUG_PORT,
- "ftli_open: Got connection; forking");
-
- ipid = ixsfork ();
- if (ipid < 0)
- ulog (LOG_FATAL, "fork: %s", strerror (errno));
- if (ipid == 0)
- {
- ulog_close ();
-
- (void) t_close (qsysdep->o);
- qsysdep->o = onew;
-
- /* Push any desired modules. */
- if (! ftli_push (qconn))
- _exit (EXIT_FAILURE);
-
- /* Now we fork and let our parent die, so that we become
- a child of init. This lets the main server code wait
- for its child and then continue without accumulating
- zombie children. */
- ipid = ixsfork ();
- if (ipid < 0)
- {
- ulog (LOG_ERROR, "fork: %s", strerror (errno));
- _exit (EXIT_FAILURE);
- }
-
- if (ipid != 0)
- _exit (EXIT_SUCCESS);
-
- ulog_id (getpid ());
-
- return TRUE;
- }
-
- (void) t_close (onew);
-
- /* Now wait for the child. */
- (void) ixswait ((unsigned long) ipid, (const char *) NULL);
- }
-
- /* We got a signal. */
- usysdep_exit (FALSE);
-
- /* Avoid compiler warnings. */
- return FALSE;
-}
-
-/* Close the port. */
-
-/*ARGSUSED*/
-static boolean
-ftli_close (qconn, puuconf, qdialer, fsuccess)
- struct sconnection *qconn;
- pointer puuconf;
- struct uuconf_dialer *qdialer;
- boolean fsuccess;
-{
- struct ssysdep_conn *qsysdep;
- boolean fret;
-
- qsysdep = (struct ssysdep_conn *) qconn->psysdep;
-
- fret = TRUE;
- if (qsysdep->o >= 0)
- {
- if (qsysdep->ftli)
- {
- if (t_close (qsysdep->o) < 0)
- {
- ulog (LOG_ERROR, "t_close: %s", ztlierror ());
- fret = FALSE;
- }
- }
- else
- {
- if (close (qsysdep->o) < 0)
- {
- ulog (LOG_ERROR, "close: %s", strerror (errno));
- fret = FALSE;
- }
- }
-
- qsysdep->o = -1;
- }
-
- /* If the current pid is not the one we used to open the port, then
- we must have forked up above and we are now the child. In this
- case, we are being called from within the fendless loop in
- uucico.c. We return FALSE to force the loop to end and the child
- to exit. This should be handled in a cleaner fashion. */
- if (qsysdep->ipid != getpid ())
- fret = FALSE;
-
- return fret;
-}
-
-/* Dial out on a TLI port, so to speak: connect to a remote computer. */
-
-/*ARGSUSED*/
-static boolean
-ftli_dial (qconn, puuconf, qsys, zphone, qdialer, ptdialerfound)
- struct sconnection *qconn;
- pointer puuconf;
- const struct uuconf_system *qsys;
- const char *zphone;
- struct uuconf_dialer *qdialer;
- enum tdialerfound *ptdialerfound;
-{
- struct ssysdep_conn *qsysdep;
- char **pzdialer;
- const char *zaddr;
- struct t_call *qtcall;
- char *zescape;
-
- qsysdep = (struct ssysdep_conn *) qconn->psysdep;
-
- *ptdialerfound = DIALERFOUND_FALSE;
-
- pzdialer = qconn->qport->uuconf_u.uuconf_stli.uuconf_pzdialer;
- if (*pzdialer == NULL)
- pzdialer = NULL;
-
- /* If the first dialer is "TLI" or "TLIS", we use the first token
- (pzdialer[1]) as the address to connect to. */
- zaddr = zphone;
- if (pzdialer != NULL
- && (strcmp (pzdialer[0], "TLI") == 0
- || strcmp (pzdialer[0], "TLIS") == 0))
- {
- if (pzdialer[1] == NULL)
- ++pzdialer;
- else
- {
- if (strcmp (pzdialer[1], "\\D") != 0
- && strcmp (pzdialer[1], "\\T") != 0)
- zaddr = pzdialer[1];
- pzdialer += 2;
- }
- }
-
- if (zaddr == NULL)
- {
- ulog (LOG_ERROR, "No address for TLI connection");
- return FALSE;
- }
-
- qtcall = (struct t_call *) t_alloc (qsysdep->o, T_CALL, T_ADDR);
- if (qtcall == NULL)
- {
- ulog (LOG_ERROR, "t_alloc (T_CALL): %s", ztlierror ());
- return FALSE;
- }
-
- zescape = zbufcpy (zaddr);
- qtcall->addr.len = cescape (zescape);
- if (qtcall->addr.len > qtcall->addr.maxlen)
- {
- ulog (LOG_ERROR, "%s: TLI address too long (max %d)", zaddr,
- qtcall->addr.maxlen);
- ubuffree (zescape);
- return FALSE;
- }
- memcpy (qtcall->addr.buf, zescape, qtcall->addr.len);
- ubuffree (zescape);
-
- if (t_connect (qsysdep->o, qtcall, (struct t_call *) NULL) < 0)
- {
- if (t_errno != TLOOK)
- ulog (LOG_ERROR, "t_connect: %s", ztlierror ());
- else
- {
- if (t_rcvdis (qsysdep->o, (struct t_discon *) NULL) < 0)
- ulog (LOG_ERROR, "t_rcvdis: %s", ztlierror ());
- else
- ulog (LOG_ERROR, "Connection refused");
- }
- return FALSE;
- }
-
- /* We've connected to the remote. Push any desired modules. */
- if (! ftli_push (qconn))
- return FALSE;
-
- /* Handle the rest of the dialer sequence. */
- if (pzdialer != NULL && *pzdialer != NULL)
- {
- if (! fconn_dial_sequence (qconn, puuconf, pzdialer, qsys, zphone,
- qdialer, ptdialerfound))
- return FALSE;
- }
-
- return TRUE;
-}
-
-#endif /* HAVE_TLI */
diff --git a/gnu/libexec/uucp/contrib/uureroute b/gnu/libexec/uucp/contrib/uureroute
deleted file mode 100755
index 3eeb654..0000000
--- a/gnu/libexec/uucp/contrib/uureroute
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/local/bin/perl
-eval ' exec /usr/local/bin/perl $0 "$@" '
- if $running_under_some_shell;
-
-# From a script by <Bill.Campbell@celestial.com>
-# Newsgroups: comp.sources.misc
-# Subject: v28i073: uureroute - Reroute HDB queued mail, Part01/01
-# Date: 26 Feb 92 02:28:37 GMT
-#
-# This is a Honey DanBer specific routine written in perl to reroute all
-# mail queued up for a specific host. It needs to be run as "root" since
-# uucp will not allow itself to remove others requests.
-#
-# Revision *** 92/21/09: Francois Pinard <pinard@iro.umontreal.ca>
-# 1. adapted for Taylor UUCP
-#
-# Revision 1.3 91/10/08 09:01:21 src
-# 1. Rewritten in perl
-# 2. Add -v option for debugging.
-#
-# Revision 1.2 91/10/07 23:57:42 root
-# 1. Fix mail program path.
-# 2. Truncate directory name to 7 characters
-
-($progname = $0) =~ s!.*/!!; # save this very early
-
-$USAGE = "
-# Reroute uucp mail
-#
-# Usage: $progname [-v] host [host...]
-#
-# Options Argument Description
-# -v Verbose (doesn't execute /bin/sh)
-#
-";
-
-$UUSTAT = "/usr/local/bin/uustat";
-$SHELL = "/bin/sh";
-$SMAIL = "/bin/smail";
-
-sub usage
-{
- die join ("\n", @_) . "\n$USAGE\n";
-}
-
-do "getopts.pl";
-
-&usage ("Invalid Option") unless do Getopts ("vV");
-
-$verbose = ($opt_v ? '-v' : ());
-$suffix = ($verbose ? '' : $$);
-
-&usage ("No system specified") if $#ARGV < 0;
-
-if (!$verbose)
-{
- open (SHELL, "| $SHELL");
- select SHELL;
-}
-
-while ($system = shift)
-{
- $sysprefix = substr ($system, 0, 7);
- $directory = "/usr/spool/uucp/$sysprefix";
- open (UUSTAT, "$UUSTAT -s $system -c rmail |");
- print "set -ex\n";
- while (<UUSTAT>)
- {
- ($jobid, ) = split;
- ($cfile) = substr ($jobid, length ($jobid) - 5);
- $cfilename = "$directory/C./C.$cfile";
- open (CFILE, $cfilename) || die "Cannot open $cfilename\n";
- $_ = <CFILE>;
- close CFILE;
- if (/^E D\.(....) [^ ]+ [^ ]+ -CR D\.\1 0666 [^ ]+ 0 rmail (.*)/)
- {
- $datafile = "$directory/D./D.$1";
- $address = $2;
- }
- else
- {
- print STDERR;
- die "Cannot parse previous line from $cfilename\n";
- }
- print "$SMAIL -R $system!$address < $datafile && $UUSTAT -k $jobid\n";
- }
- close UUSTAT;
-}
-close SHELL unless $verbose;
-
-exit 0;
diff --git a/gnu/libexec/uucp/sample/call b/gnu/libexec/uucp/sample/call
deleted file mode 100644
index de4190c..0000000
--- a/gnu/libexec/uucp/sample/call
+++ /dev/null
@@ -1,20 +0,0 @@
-# This is an example of call, the call out password file for Taylor
-# UUCP. To use it, you must compile the package with
-# HAVE_TAYLOR_CONFIG set to 1 in policy.h (that is the default), copy
-# this file to newconfigdir as set in Makefile.in (the default is
-# /usr/local/conf/uucp), and edit it as appropriate for your system.
-
-# Everything after a '#' character is a comment. To uncomment any of
-# the sample lines below, just delete the '#'.
-
-# This file is used when the ``call-login'' or ``call-password''
-# commands are used in the sys file with a "*" argument (e.g.,
-# ``call-login *''). The system name is looked up in this file, and
-# the login name and password are used.
-
-# The point of this is that the sys file may then be publically
-# readable, while still concealing the login names and passwords used
-# to connect to the remote system.
-
-# The format is just system-name login-name password.
-uunet Uairs foobar
diff --git a/gnu/libexec/uucp/sample/config b/gnu/libexec/uucp/sample/config
deleted file mode 100644
index e7d683b..0000000
--- a/gnu/libexec/uucp/sample/config
+++ /dev/null
@@ -1,88 +0,0 @@
-# This is an example of config, the main configuration file for Taylor
-# UUCP. To use it, you must compile the package with
-# HAVE_TAYLOR_CONFIG set to 1 in policy.h (that is the default), copy
-# this file to newconfigdir as set in Makefile.in (the default is
-# /usr/local/conf/uucp), and edit it as appropriate for your system.
-
-# You need not use this file at all; all the important commands have
-# defaults which will be used if this file can not be found.
-
-# Everything after a '#' character is a comment. To uncomment any of
-# the sample lines below, just delete the '#'.
-
-# You must choose a UUCP name. If your system is going to be
-# communicating with other systems outside your organization, the name
-# must be unique in the entire world. The usual method is to pick a
-# name, and then search the UUCP maps (in the newsgroup
-# comp.mail.maps) to see whether it has already been taken. See the
-# README posting in comp.mail.maps for more information. If the name
-# of your system as returned by "uuname -n" or "hostname" is the name
-# you want to use, you do not need to set the name in this file.
-# Otherwise uncomment and edit the following line.
-# nodename uucp # The UUCP name of this system
-
-# The default spool directory is set in policy.h (the default is
-# /usr/spool/uucp). All UUCP jobs and status information are kept in
-# the spool directory. If you wish to change it, use the spool
-# command.
-# spool /usr/spool/uucp # The UUCP spool directory
-
-# The default public directory is set in policy.h (the default is
-# /usr/spool/uucppublic). Remote systems may refer to a file in this
-# directory using "~/FILE". By default, the public directory is the
-# only directory which remote systems may transfer files in and out
-# of. If you wish to change the public directory, use the pubdir
-# command.
-# pubdir /usr/spool/uucppublic # The UUCP public directory
-
-# The names of the UUCP log files are set in policy.h. The default
-# names depend on the logging option you have chosen. If
-# HAVE_TAYLOR_LOGGING is set in policy.h, the default log file name is
-# /usr/spool/uucp/Log, the default statistics file name is
-# /usr/spool/uucp/Stats, and the default debugging file name is
-# /usr/spool/uucp/Debug. These file names may be set by the following
-# commands.
-# logfile /usr/spool/uucp/Log # The UUCP log file
-# statfile /usr/spool/uucp/Stats # The UUCP statistics file
-# debugfile /usr/spool/uucp/Debug # The UUCP debugging file
-
-# uuxqt is the program which executes UUCP requests from other
-# systems. Normally one is started after each run of uucico, the
-# communications daemon. You may control the maximum number of uuxqt
-# programs run at the same time with the following command. The
-# default is to have no maximum.
-# max-uuxqts 1 # The maximum number of uuxqts
-
-# There are several files that uucico uses. By default it looks for
-# them in newconfigdir, as set in Makefile.in. You may name one or
-# more of each type of file using the following commands.
-# sysfile FILES # Default "sys"
-# portfile FILES # Default "port"
-# dialfile FILES # Default "dial"
-# dialcodefile FILES # Default "dialcode"
-# callfile FILES # Default "call"
-# passwdfile FILES # Default "passwd"
-
-# The ``timetable'' command may be used to declare timetables. These
-# may then be referred to in time strings in the other files.
-# timetable Day Wk0905-1655
-
-# The ``unknown'' command is followed by any command which may appear
-# in a sys file. These commands are taken together to describe what
-# is permitted to a system which is not listed in any sys file. If
-# the ``unknown'' command, then unknown systems are not permitted to
-# connect.
-
-# Here is an example which permits unknown systems to download files
-# from /usr/spool/anonymous, and to upload them to
-# /usr/spool/anonymous/upload.
-#
-# No commands may be executed (the list of permitted commands is empty)
-# unknown commands
-# The public directory is /usr/spool/anonymous
-# unknown pubdir /usr/spool/anonymous
-# Only files in the public directory may be sent; users may not download
-# files from the upload directory
-# unknown remote-send ~ !~/upload
-# May only upload files into /usr/spool/anonymous/upload
-# unknown remote-receive ~/upload
diff --git a/gnu/libexec/uucp/sample/dial b/gnu/libexec/uucp/sample/dial
deleted file mode 100644
index f0d4bdd..0000000
--- a/gnu/libexec/uucp/sample/dial
+++ /dev/null
@@ -1,35 +0,0 @@
-# This is an example of dial, the dialer configuration file for Taylor
-# UUCP. To use it, you must compile the package with
-# HAVE_TAYLOR_CONFIG set to 1 in policy.h (that is the default), copy
-# this file to newconfigdir as set in Makefile.in (the default is
-# /usr/local/conf/uucp), and edit it as appropriate for your system.
-
-# Everything after a '#' character is a comment. To uncomment any of
-# the sample lines below, just delete the '#'.
-
-# All dialers named in the port (or sys) file must be described in the
-# dial file. It is also possible to describe a dialer directly in the
-# port (or sys) file.
-
-# This is a typical Hayes modem definition.
-dialer hayes
-
-# The chat script used to dial the phone.
-# This means:
-# 1) expect nothing (i.e., continue with step 2)
-# 2) send "ATZ", then a carriage return, then sleep for 1 to 2
-# seconds. The \c means to not send a final carriage return.
-# 3) wait until the modem echoes "OK"
-# 4) send "ATDT", then the telephone number (after translating any
-# dialcodes).
-# 5) wait until the modem echoes "CONNECT"
-chat "" ATZ\r\d\c OK ATDT\T CONNECT
-
-# If we get "BUSY" or "NO CARRIER" during the dial chat script we
-# abort the dial immediately.
-chat-fail BUSY
-chat-fail NO\sCARRIER
-
-# When the call is over, we make sure we hangup the modem.
-complete \d\d+++\d\dATH\r\c
-abort \d\d+++\d\dATH\r\c
diff --git a/gnu/libexec/uucp/sample/dialcode b/gnu/libexec/uucp/sample/dialcode
deleted file mode 100644
index 710a07b..0000000
--- a/gnu/libexec/uucp/sample/dialcode
+++ /dev/null
@@ -1,19 +0,0 @@
-# This is an example of dialcode, the dialcode configuration file for
-# Taylor UUCP. To use it, you must compile the package with
-# HAVE_TAYLOR_CONFIG set to 1 in policy.h (that is the default), copy
-# this file to newconfigdir as set in Makefile.in (the default is
-# /usr/local/conf/uucp), and edit it as appropriate for your system.
-
-# Everything after a '#' character is a comment. To uncomment any of
-# the sample lines below, just delete the '#'.
-
-# The dialcode file is used if \T is used in the dialer chat script
-# and the telephone number begins with alphabetic characters. The
-# alphabetic characters are looked up and translated in dialcode.
-
-# Here are a couple of sample dialcodes.
-MA 617
-CA 415
-
-# For example, if the phone number (from the sys file) is MA7389449,
-# then the string sent to the modem will be 6177389449.
diff --git a/gnu/libexec/uucp/sample/passwd b/gnu/libexec/uucp/sample/passwd
deleted file mode 100644
index 2b04e13..0000000
--- a/gnu/libexec/uucp/sample/passwd
+++ /dev/null
@@ -1,18 +0,0 @@
-# This is an example of passwd, the call in password file for Taylor
-# UUCP. To use it, you must compile the package with
-# HAVE_TAYLOR_CONFIG set to 1 in policy.h (that is the default), copy
-# this file to newconfigdir as set in Makefile.in (the default is
-# /usr/local/conf/uucp), and edit it as appropriate for your system.
-
-# Everything after a '#' character is a comment. To uncomment any of
-# the sample lines below, just delete the '#'.
-
-# This file is used when uucico is invoked with the -l or -e argument.
-# uucico will then prompt for a login name and password. The login
-# name is looked up in this file to check the password (the system
-# password file, /etc/passwd, is not checked). This permits uucico to
-# completely take over a port, allowing UUCP access to remote systems
-# but not permitting remote users to actually log in to the system.
-
-# The format is just login-name password.
-Uairs foobar
diff --git a/gnu/libexec/uucp/sample/port b/gnu/libexec/uucp/sample/port
deleted file mode 100644
index 8e48186..0000000
--- a/gnu/libexec/uucp/sample/port
+++ /dev/null
@@ -1,41 +0,0 @@
-# This is an example of port, the port configuration file for Taylor
-# UUCP. To use it, you must compile the package with
-# HAVE_TAYLOR_CONFIG set to 1 in policy.h (that is the default), copy
-# this file to newconfigdir as set in Makefile.in (the default is
-# /usr/local/conf/uucp), and edit it as appropriate for your system.
-
-# Everything after a '#' character is a comment. To uncomment any of
-# the sample lines below, just delete the '#'.
-
-# All ports named in the sys file must be described in a port file.
-# It is also possible to describe the port directly in the sys file.
-
-# Commands that appears before the first ``port'' command are defaults
-# for all ports that appear later in the file. In this case all ports
-# will default to being modems (other possible types are direct, tcp
-# and tli).
-type modem
-
-# Now we describe two ports.
-
-# This is the name of the port. This name may be used in the sys file
-# to select the port, or the sys file may just specify a baud rate in
-# which case the first matching unlocked port will be used.
-port port1
-
-# This is the device name to open to dial out.
-device /dev/ttyd0
-
-# This is the dialer to use, as described in the dialer file.
-dialer hayes
-
-# This is the baud rate to dial out at.
-speed 2400
-
-# Here is a second port. This is like the first, except that it uses
-# a different device. It also permits a range of speeds, which is
-# mainly useful if the system specifies a particular baud rate.
-port port2
-device /dev/ttyd1
-dialer hayes
-speed-range 2400 9600
diff --git a/gnu/libexec/uucp/sample/sys1 b/gnu/libexec/uucp/sample/sys1
deleted file mode 100644
index fa9e770..0000000
--- a/gnu/libexec/uucp/sample/sys1
+++ /dev/null
@@ -1,44 +0,0 @@
-# This is an example of a sys file, the file(s) which describe remote
-# systems for Taylor UUCP. To use it, you must compile the package
-# with HAVE_TAYLOR_CONFIG set to 1 in policy.h (that is the default),
-# copy this file to newconfigdir as set in Makefile.in (the default is
-# /usr/local/conf/uucp), and edit it as appropriate for your system.
-
-# If you do not use the ``unknown'' command in the config file, then
-# each system that you communicate with must be listed in a sys file.
-
-# Everything after a '#' character is a comment. To uncomment any of
-# the sample lines below, just delete the '#'.
-
-# This is a sample sys file that might be used in a leaf system. A
-# leaf system is one that only contacts one other system. sys2
-# provides another example.
-
-# The name of the remote system that we call.
-system uunet
-
-# The login name and password are kept in the callout password file
-# (by default this is the file "call" in newconfigdir).
-call-login *
-call-password *
-
-# We can send anything at any time.
-time any
-
-# During the day we only accept grade 'Z' or above; at other times
-# (not mentioned here) we accept all grades. uunet queues up news
-# at grade 'd', which is lower than 'Z'.
-call-timegrade Z Wk0755-2305,Su1655-2305
-
-# The phone number to call.
-phone 7389449
-
-# uunet tends to be slow, so we increase the timeout
-chat-timeout 120
-
-# The port we use to dial out.
-port serial
-
-# Increase the timeout and the number of retries.
-protocol-parameter g timeout 20
-protocol-parameter g retries 10
diff --git a/gnu/libexec/uucp/sample/sys2 b/gnu/libexec/uucp/sample/sys2
deleted file mode 100644
index 856529a..0000000
--- a/gnu/libexec/uucp/sample/sys2
+++ /dev/null
@@ -1,51 +0,0 @@
-# This is an example of a sys file, the file(s) which describe remote
-# systems for Taylor UUCP. To use it, you must compile the package
-# with HAVE_TAYLOR_CONFIG set to 1 in policy.h (that is the default),
-# copy this file to newconfigdir as set in Makefile.in (the default is
-# /usr/local/conf/uucp), and edit it as appropriate for your system.
-
-# If you do not use the ``unknown'' command in the config file, then
-# each system that you communicate with must be listed in a sys file.
-
-# Everything after a '#' character is a comment. To uncomment any of
-# the sample lines below, just delete the '#'.
-
-# This is a sample sys file that might be used by a system that
-# contacts a couple of other systems, both of which are treated the
-# same. sys1 provides another example.
-
-# Commands that appear before the first ``system'' commands are
-# defaults for all systems listed in the file.
-
-# Get the login name and password to use from the call-out file. By
-# default this is the file "call" in newconfigdir.
-call-login *
-call-password *
-
-# The systems must use a particular login
-called-login Ulocal
-
-# Permit local users to send any world readable file
-local-send /
-
-# Permit local uses to request into any world writable directory
-local-receive /
-
-# Call at any time
-time any
-
-# Use port1, then port2
-port port1
-
-alternate
-
-port port2
-
-# Now define the systems themselves. Because of all the defaults we
-# used, there is very little to specify for the systems themselves.
-
-system comton
-phone 5551212
-
-system bugs
-phone 5552424
diff --git a/gnu/usr.bin/as/Makefile.gnu b/gnu/usr.bin/as/Makefile.gnu
deleted file mode 100644
index 4b81b0c..0000000
--- a/gnu/usr.bin/as/Makefile.gnu
+++ /dev/null
@@ -1,356 +0,0 @@
-# Makefile for GAS.
-# Copyright (C) 1989, Free Software Foundation
-#
-# This file is part of GAS, the GNU Assembler.
-#
-# GAS 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.
-#
-# GAS 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 GAS; see the file COPYING. If not, write to
-# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-
-# This makefile may be used to make the VAX, 68020, 80386,
-# SPARC, ns32k, or i860 assembler(s).
-
-BINDIR = /usr/local/bin
-#CC=gcc
-
-# If you are on a BSD system, un-comment the next two lines, and comment out
-# the lines for SystemV and HPUX below
-G0 = -g -I. #-O -Wall
-LDFLAGS = $(CFLAGS)
-#
-# To compile gas on a System Five machine, comment out the two lines above
-# and un-comment out the next three lines
-# Comment out the -lPW on the LOADLIBES line if you are using GCC.
-# G0 = -g -I. -DUSG
-# LDFLAGS = $(CFLAGS)
-# LOADLIBES = -lmalloc -lPW
-#
-# To compile gas for HPUX, link m-hpux.h to m68k.h , and un-comment the
-# next two lines. (If you are using GCC, comment out the alloca.o part)
-# (Get alloca from the emacs distribution, or use GCC.)
-# HPUX 7.0 may have a bug in setvbuf. gas gives an error message like
-# 1:"Unknown operator" -- Statement 'NO_APP' ignored
-# if setvbuf is broken. Re-compile input-file.c (and only input-file.c
-# with -DVMS and the problem should go away.
-#
-# G0 = -g -I. -DUSG
-# LOADLIBES = alloca.o
-#
-# To compile gas for a Sequent Symmetry, comment out all the above lines,
-# and un-comment the next two lines.
-# G0 = -g -I. -DUSE_SYSTEM_HDR -DEXEC_VERSION=1
-# LOADLIBES = -lc /usr/att/lib/libc.a
-
-# If you just want to compile the vax assembler, type 'make avax'
-
-# If you just want to compile the i386 assembler, type 'make a386'
-
-# If you just want to compile the ns32k assembler, type 'make a32k'
-
-# If you just want to compile the sparc assembler, type 'make asparc'
-
-# If you just want to compile the mc68020 assembler, make sure m68k.h
-# is correctly set up, and type type 'make a68' (Except on HPUX machines,
-# where you will have to make the changes marked below before typing
-# 'make a68'
-# m68k.h should be a symbolic or hard-link to one of
-# m-sun3.h , m-hpux.h or m-generic.h
-# depending on which machine you want to compile the 68020 assembler for.
-#
-# If you want the 68k assembler to be completely compatable with the the
-# SUN one, un-comment the -DSUN_ASM_SYNTAX line below.
-#
-# If you machine does not have vfprintf, but does have _doprnt(),
-# remove the # from the -DNO_VARARGS line below.
-#
-# If the return-type of a signal-hander is void (instead of int),
-# remove the # from the -DSIGTY line below.
-#
-# To include the mc68851 mmu coprocessor instructions in the 68020 assembler,
-# remove the # from the -Dm68851 line below.
-#
-# If you want the 68020 assembler use a register prefix character, un-comment
-# the REGISTER_PREFIX line, and (maybe) change the '%' to the appropriate
-# character.
-#
-# If you want the assembler to treat .L* or ..* symbols as local, instead of
-# the usual L* symbols, un-comment the DOT_LABEL_PREFIX line.
-#
-# If you want the 80386 assembler to correctly handle fsub/fsubr and fdiv/fdivr
-# opcodes (unlike most 80386 assemblers), remove the # from
-# the -DNON_BROKEN_WORDS line below.
-#
-# To compile 80386 Gas for the Sequent Symmetry, un-comment the -DEXEC_VERSION
-# and the -DUSE_SYSTEM_HDR lines below.
-#
-# To compile gas for the HP 9000/300 un-comment the -DUSE_HP_HDR line below.
-#
-# For the ns32k, the options are 32532 or 32032 CPU and 32381 or 32081 FPU.
-# To select the NS32532, remove the # from the -DNS32532 line below.
-# To compile in tne NS32381 opcodes in addition to the NS32081 opcodes
-# (the 32381 is a superset of the 32081), remove the # from the -DNS32381
-# line below.
-#
-# For the ns32k on a Sequent, uncomment the SEQUENT_COMPATABILITY line below.
-#
-# If you want the .align N directive to align to the next N byte boundry,
-# instead of the next 1<<N boundry, un-comment the OTHER_ALIGN line below.
-# (This option is automatically enabled when building the sparc assembler.
-#
-
-O1 = -DNO_VARARGS
-O2 = # -DNON_BROKEN_WORDS
-O3 = # -Dm68851
-O4 = # -DEXEC_VERSION=1
-O5 = # -DSIGTY=void
-O6 = # -DNS32532
-O6 = # -DNS32381
-O7 = # -DDOT_LABEL_PREFIX
-O8 = # -DSEQUENT_COMPATABILITY
-O9 = # -DREGISTER_PREFIX=\'%\'
-O10= # -DOTHER_ALIGN
-
-G1 = # -DUSE_SYSTEM_HDR
-G2 = # -DUSE_HP_HDR
-G3 = # -DSUN_ASM_SYNTAX
-
-OPTIONS = $(O1) $(O2) $(O3) $(O4) $(O5) $(O6) $(O7) $(O8) $(O9) $(O10)
-
-CFLAGS = $(G0) $(G1) $(G2) $(G3) $(G4)
-
-#
-# To make the 68020 assembler compile as the default, un-comment the next
-# line, and comment out all the other lines that start with DEFAULT_GAS
-DEFAULT_GAS=a68
-#
-# To make the VAX assembler compile as the default, un-comment the next
-# line and commment out all the other lines that start with DEFAULT_GAS
-#DEFAULT_GAS=avax
-#
-# To make the 80386 assembler compile as the default, un-comment the next
-# line and commment out all the other lines that start with DEFAULT_GAS
-#DEFAULT_GAS=a386
-#
-# To make the ns32k assembler compile as the default, un-comment the next
-# line and commment out all the other lines that start with DEFAULT_GAS
-#DEFAULT_GAS=a32k
-#
-# To make the sparc assembler compile as the default, un-comment the next
-# line and commment out all the other lines that start with DEFAULT_GAS
-#DEFAULT_GAS=asparc
-#
-# To make the i860 assembler compile as the default, un-comment the next
-# line and comment out all the other lines that start with DEFAULT_GAS
-#DEFAULT_GAS=a860
-
-# Global Sources -------------------------------------------------------------
-
-a =\
-as.o xrealloc.o xmalloc.o hash.o hex-value.o \
-atof-generic.o append.o messages.o expr.o app.o \
-frags.o input-file.o input-scrub.o output-file.o \
-subsegs.o symbols.o version.o \
-flonum-const.o flonum-copy.o flonum-mult.o strstr.o bignum-copy.o \
-obstack.o
-#gdb.o gdb-file.o gdb-symbols.o gdb-blocks.o gdb-lines.o
-
-a: $(DEFAULT_GAS)
- @rm -f a
- @ln $(DEFAULT_GAS) a
-
-# I860 GAS ------------------------------------------------------------------
-u = i860.o atof-ieee.o write-i860.o read-i860.o
-
-U = i860.c i860.h i860-opcode.h
-
-i860.o: i860.c i860.h i860-opcode.h as.h frags.h struc-symbol.h
-i860.o: flonum.h expr.h hash.h md.h write.h read.h symbols.h
- $(CC) -c $(CFLAGS) -DI860 i860.c
-
-atof-ieee.o: flonum.h
-
-write-i860.o: write.c i860.h
- $(CC) -c -DI860 $(CFLAGS) write.c
- mv write.o write-i860.o
-
-read-i860.o: read.c i860.h
- $(CC) -c -DI860 $(CFLAGS) read.c
- mv read.o read-i860.o
-
-a860: $a $u
- $(CC) -o a860 $(LDFLAGS) $a $u $(LOADLIBES)
-
-# SPARC GAS ------------------------------------------------------------------
-v = sparc.o atof-ieee.o write-sparc.o read-sparc.o
-
-V = sparc.c sparc.h sparc-opcode.h
-
-atof-ieee.o: flonum.h
-sparc.o: sparc.c sparc.h sparc-opcode.h as.h frags.h struc-symbol.h
-sparc.o: flonum.h expr.h hash.h md.h write.h read.h symbols.h
- $(CC) -c $(CFLAGS) -DSPARC sparc.c
-
-write-sparc.o: write.c
- $(CC) -c -DSPARC $(CFLAGS) write.c
- mv write.o write-sparc.o
-
-read-sparc.o: read.c
- $(CC) -c -DSPARC $(CFLAGS) read.c
- mv read.o read-sparc.o
-
-asparc: $a $v
- $(CC) -o asparc $(LDFLAGS) $a $v $(LOADLIBES)
-
-# NS32K GAS ------------------------------------------------------------------
-w = ns32k.o atof-ieee.o write-ns32k.o read-ns32k.o
-
-W = ns32k.c ns32k-opcode.h
-
-atof-ieee.o: flonum.h
-ns32k.o: as.h frags.h struc-symbol.h flonum.h expr.h md.h hash.h
-ns32k.o: write.h symbols.h ns32k-opcode.h ns32k.c
- $(CC) $(CFLAGS) $(OPTIONS) -c ns32k.c
-
-write-ns32k.o: write.c
- $(CC) -c -DNS32K $(CFLAGS) write.c
- mv write.o write-ns32k.o
-
-read-ns32k.o:
- $(CC) -c -DNS32K $(CFLAGS) read.c
- mv read.o read-ns32k.o
-
-a32k: $a $w
- $(CC) -o a32k $(LDFLAGS) $a $w $(LOADLIBES)
-
-# 80386 GAS ------------------------------------------------------------------
-x = i386.o atof-ieee.o write.o read.o
-
-X = i386.c i386.h i386-opcode.h
-
-i386.o: i386.c as.h read.h flonum.h frags.h struc-symbol.h expr.h
-i386.o: symbols.h hash.h md.h i386.h i386-opcode.h
- $(CC) $(CFLAGS) $(OPTIONS) -c i386.c
-
-atof-ieee.o: flonum.h
-
-a386: $a $x
- $(CC) -o a386 $(LDFLAGS) $a $x $(LOADLIBES)
-
-# 68020 GAS ------------------------------------------------------------------
-y = m68k.o atof-ieee.o write.o read.o
-
-Y = m68k.c atof-ieee.c m68k-opcode.h m-hpux.h m-sun3.h m-generic.h
-
-atof-ieee.o: flonum.h
-
-m68k.o: m68k.c a.out.gnu.h as.h expr.h flonum.h frags.h hash.h
-m68k.o: m68k-opcode.h m68k.h md.h obstack.h struc-symbol.h
- $(CC) $(CFLAGS) $(OPTIONS) -c m68k.c
-
-a68: $a $y
- $(CC) -o a68 $(LDFLAGS) $a $y $(LOADLIBES)
-
-# VAX GAS --------------------------------------------------------------------
-z = vax.o atof-vax.o write.o read.o
-
-Z = vax.c atof-vax.c vax-opcode.h vax-inst.h \
- make-gas.com objrecdef.h vms.c vms-dbg.c README-vms-dbg
-
-vax.o: vax.c a.out.gnu.h as.h expr.h flonum.h frags.h md.h obstack.h
-vax.o: read.h struc-symbol.h symbols.h vax-inst.h vax-opcode.h
-atof-vax.o: as.h flonum.h read.h
-
-avax: $a $z
- $(CC) -o avax $(LDFLAGS) $a $z $(LOADLIBES)
-
-# global files ---------------------------------------------------------------
-
-as.o: as.c
- $(CC) $(CFLAGS) $(OPTIONS) -c as.c
-
-messages.o: messages.c
- $(CC) $(CFLAGS) $(OPTIONS) -c messages.c
-
-hash.o: hash.c
- $(CC) $(CFLAGS) -Derror=as_fatal -c hash.c
-
-xmalloc.o: xmalloc.c
- $(CC) $(CFLAGS) -Derror=as_fatal -c xmalloc.c
-
-xrealloc.o: xrealloc.c
- $(CC) $(CFLAGS) -Derror=as_fatal -c xrealloc.c
-
-A =\
-as.c xrealloc.c xmalloc.c hash.c hex-value.c \
-atof-generic.c append.c messages.c expr.c bignum-copy.c \
-frags.c input-file.c input-scrub.c output-file.c read.c \
-subsegs.c symbols.c write.c strstr.c \
-flonum-const.c flonum-copy.c flonum-mult.c app.c version.c \
-obstack.c \
-#gdb.c gdb-file.c gdb-symbols.c gdb-blocks.c \
-#gdb-lines.c
-
-H = \
-a.out.gnu.h as.h bignum.h expr.h flonum.h \
-frags.h hash.h input-file.h md.h \
-obstack.h read.h struc-symbol.h subsegs.h \
-symbols.h write.h
-
-dist: COPYING README ChangeLog $A $H $Z $Y $X $W $V $U Makefile
- echo gas-`sed -n -e '/ version /s/[^0-9.]*\([0-9.]*\).*/\1/p' < version.c` > .fname
- mkdir `cat .fname`
-
- ln COPYING README ChangeLog $A $H $Z $Y $X $W $V $U Makefile `cat .fname`
- tar cvhZf `cat .fname`.tar.Z `cat .fname`
- -rm -r `cat .fname`
- -rm .fname
-
-clean:
- rm -f a avax a68 a386 a32k asparc $a $v $w $x $y $z a core gmon.out bugs a.out
-
-install: a
- cp a $(BINDIR)/gas
-
-
-# General .o-->.h dependencies
-
-app.o: as.h
-as.o: a.out.gnu.h as.h read.h struc-symbol.h write.h
-atof-generic.o: flonum.h
-bignum-copy.o: bignum.h
-expr.o: a.out.gnu.h as.h expr.h flonum.h obstack.h read.h struc-symbol.h
-expr.o: symbols.h
-flonum-const.o: flonum.h
-flonum-copy.o: flonum.h
-flonum-mult.o: flonum.h
-flonum-normal.o:flonum.h
-flonum-print.o: flonum.h
-frags.o: a.out.gnu.h as.h frags.h obstack.h struc-symbol.h subsegs.h
-#gdb.o: as.h
-#gdb-blocks.o: as.h
-#gdb-lines.o: as.h frags.h obstack.h
-#gdb-symbols.o: a.out.gnu.h as.h struc-symbol.h
-hash.o: hash.h
-input-file.o: input-file.h
-input-scrub.o: as.h input-file.h read.h
-messages.o: as.h
-obstack.o: obstack.h
-read.o: a.out.gnu.h as.h expr.h flonum.h frags.h hash.h md.h obstack.h
-read.o: read.h struc-symbol.h symbols.h
-subsegs.o: a.out.gnu.h as.h frags.h obstack.h struc-symbol.h subsegs.h write.h
-symbols.o: a.out.gnu.h as.h frags.h hash.h obstack.h struc-symbol.h symbols.h
-write.o: a.out.gnu.h as.h md.h obstack.h struc-symbol.h subsegs.h
-write.o: symbols.h write.h
-
-flonum.h: bignum.h
-
diff --git a/gnu/usr.bin/as/README.gnu b/gnu/usr.bin/as/README.gnu
deleted file mode 100644
index 46f135fc..0000000
--- a/gnu/usr.bin/as/README.gnu
+++ /dev/null
@@ -1,133 +0,0 @@
-This is the beta-test version of the GNU assembler. (Probably
-around Version 1.35, but check version.c which gets updated more
-often than this readme.)
-
-The assembler has been modified to support a feature that is
-potentially useful when assembling compiler output, but which may
-confuse assembly language programmers. If assembler encounters a
-.word pseudo-op of the form symbol1-symbol2 (the difference of two
-symbols), and the difference of those two symbols will not fit in 16
-bits, the assembler will create a branch around a long jump to
-symbol1, and insert this into the output directly before the next
-label: The .word will (instead of containing garbage, or giving an
-error message) contain (the address of the long jump)-symbol2. This
-allows the assembler to assemble jump tables that jump to locations
-very far away into code that works properly. If the next label is
-more than 32K away from the .word, you lose (silently) RMS claims
-this will never happen. If the -k option is given, you will get a
-warning message when this happens.
-
-These files are currently set up to allow you to compile all of the
-versions of the assembler (68020, VAX, ns32k, and i386) on the same
-machine. To compile the 68020 version, type 'make a68'. To compile
-the VAX version, type 'make avax'. To compile the ns32k version,
-type 'make a32k'. To compile the Intel 80386 version, type 'make
-a386'. The Makefile contains instructions on how to make one of the
-assemblers compile as the default.
-
-Before you can compile the 68020 version of the assembler, you must
-make m68k.h be a link to m-sun3.h , m-hpux.h or m-generic.h . If
-you are on a SUN-3 (or other machine that uses a magic number of
-(2 << 16) | OMAGIC type 'ln -s m-sun3.h m68k.h' else if you are on a
-machine running HP-UX, type 'ln m-hpux.h m689k.h' else type
-'ln -s m-generic.h m68k.h' If your machine does not support symbolic
-links, omit the '-s'.
-
-See the instructions in the Makefile for compiling gas for the Sequent
-Symmetry (dynix 3.0.12 + others?) or for the HP 9000/300
-
-If your machine does not have both varargs.h and vfprintf(), but does have
-_doprnt() add -DNO_VARARGS to the CFLAGS line in the makefile. If your
-machine has neither vfprintf() or _doprnt(), you will have to change
-messages.c in order to get readable error messages from the assembler.
-
-
- REPORTING BUGS IN GAS
-
-Bugs in gas should be reported to bug-gnu-utils@prep.ai.mit.edu If you can't
-get through to prep, try hack@gnu.ai.mit.edu or hack@media-lab.media.mit.edu
-
-If you report a bug in GAS, please remember to include:
-
-A description of exactly what went wrong.
-
-The type of machine GAS was running on (VAX, 68020, etc),
-
-The Operating System GAS was running under.
-
-The options given to GAS.
-
-The actual input file that caused the problem.
-
-It is silly to report a bug in GAS without including an input file for
-GAS. Don't ask us to generate the file just because you made it from
-files you think we have access to.
-
-1. You might be mistaken.
-2. It might take us a lot of time to install things to regenerate that file.
-3. We might get a different file from the one you got, and might not see any
-bug.
-
-To save us these delays and uncertainties, always send the input file
-for the program that failed.
-
-If the input file is very large, and you are on the internet, you may
-want to make it avaliable for anonymous FTP instead of mailing it. If you
-do, include instructions for FTP'ing it in your bug report.
-
------------------------------- README.APOLLO ---------------------------------
-
-The changes required to get the GNU C compiler running on
-Apollo 68K platforms are available via anonymous ftp from
-labrea.stanford.edu (36.8.0.47) in the form of a compressed
-tar file named "/pub/gnu/apollo-gcc-1.37.tar.Z".
-The size of the file is 84145 bytes.
-
-To build GCC for the Apollo you'll need the virgin FSF
-distributions of bison-1.03, gas-1.34, and gcc-1.37. They
-are also on labrea.stanford.edu as well as prep.ai.mit.edu.
-My changes are to enable gas to produce Apollo COFF object
-files and allow gcc to parse some of the syntax extensions
-which appear in Apollo C header files. Note that the
-COFF encapsulation technique cannot be used on the Apollo.
-
-The tar file should be unpacked in the directory containing
-the gas-1.34 and gcc-1.37 directories; a few files will be overlaid,
-and an APOLLO-GCC-README file will appear in the top directory.
-This file contains detailed instructions on how to proceed.
-
-These changes will only work for SR10.1 or later systems, using
-the 6.6 or later version of the Apollo C compiler.
-
-If you do not have ftp access, I can mail you the changes in the
-form of diffs; they are approximately 40K in length. If you request
-them, be sure to give me a voice phone number so I can contact you
-in case I can't send you mail; I've had several requests in the
-past from people I can't contact.
-
-By the way, I'm working on getting the GNU C++ compiler running;
-there are a couple problems to solve. I hope to be able to announce
-the Apollo version shortly after the 1.37 version is released.
-
-John Vasta Hewlett-Packard Apollo Systems Division
-vasta@apollo.hp.com M.S. CHA-01-LT
-(508) 256-6600 x6362 300 Apollo Drive, Chelmsford, MA 01824
-UUCP: {decwrl!decvax, mit-eddie, attunix}!apollo!vasta
-
-------------------------------------
-
-You might refer others who are interested in a similar thing.
-
-Kevin Buchs buchs@mayo.edu
-
-
------------------------------- README.COFF -----------------------------------
-
-If you have a COFF system, you may wish to aquire
-
- UUCP: osu-cis!~/gnu/coff/gnu-coff.tar.Z
- or
- FTP: tut.cis.ohio-state.edu:/pub/gnu/coff/gnu-coff.tar.Z
-
-These contain patches for gas that will make it produce COFF output.
-I have never seen these patches, so I don't know how well they work.
diff --git a/gnu/usr.bin/as/append.c b/gnu/usr.bin/as/append.c
deleted file mode 100644
index d51a27f..0000000
--- a/gnu/usr.bin/as/append.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Append a string ontp another string
- Copyright (C) 1987 Free Software Foundation, Inc.
-
-This file is part of GAS, the GNU Assembler.
-
-GAS 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.
-
-GAS 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 GAS; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* JF: This is silly. Why not stuff this in some other file? */
-#ifdef USG
-#define bcopy(from,to,n) memcpy(to,from,n)
-#endif
-
-void
-append (charPP, fromP, length)
-char **charPP;
-char *fromP;
-unsigned long length;
-{
- if (length) { /* Don't trust bcopy() of 0 chars. */
- bcopy (fromP, * charPP,(int) length);
- *charPP += length;
- }
-}
-
-/* end: append.c */
diff --git a/gnu/usr.bin/as/config/a.out.gnu.h b/gnu/usr.bin/as/config/a.out.gnu.h
deleted file mode 100644
index 71b09a0..0000000
--- a/gnu/usr.bin/as/config/a.out.gnu.h
+++ /dev/null
@@ -1,261 +0,0 @@
-#ifndef __A_OUT_GNU_H__
-#define __A_OUT_GNU_H__
-
-#define __GNU_EXEC_MACROS__
-
-#ifndef __STRUCT_EXEC_OVERRIDE__
-
-struct exec
-{
- unsigned long a_info; /* Use macros N_MAGIC, etc for access */
- unsigned a_text; /* length of text, in bytes */
- unsigned a_data; /* length of data, in bytes */
- unsigned a_bss; /* length of uninitialized data area for file, in bytes */
- unsigned a_syms; /* length of symbol table data in file, in bytes */
- unsigned a_entry; /* start address */
- unsigned a_trsize; /* length of relocation info for text, in bytes */
- unsigned a_drsize; /* length of relocation info for data, in bytes */
-};
-
-#endif /* __STRUCT_EXEC_OVERRIDE__ */
-
-/* these go in the N_MACHTYPE field */
-enum machine_type {
-#if defined (M_OLDSUN2)
- M__OLDSUN2 = M_OLDSUN2,
-#else
- M_OLDSUN2 = 0,
-#endif
-#if defined (M_68010)
- M__68010 = M_68010,
-#else
- M_68010 = 1,
-#endif
-#if defined (M_68020)
- M__68020 = M_68020,
-#else
- M_68020 = 2,
-#endif
-#if defined (M_SPARC)
- M__SPARC = M_SPARC,
-#else
- M_SPARC = 3,
-#endif
- /* skip a bunch so we don't run into any of sun's numbers */
- M_386 = 100,
-};
-
-#if !defined (N_MAGIC)
-#define N_MAGIC(exec) ((exec).a_info & 0xffff)
-#endif
-#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
-#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
-#define N_SET_INFO(exec, magic, type, flags) \
- ((exec).a_info = ((magic) & 0xffff) \
- | (((int)(type) & 0xff) << 16) \
- | (((flags) & 0xff) << 24))
-#define N_SET_MAGIC(exec, magic) \
- ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
-
-#define N_SET_MACHTYPE(exec, machtype) \
- ((exec).a_info = \
- ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
-
-#define N_SET_FLAGS(exec, flags) \
- ((exec).a_info = \
- ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
-
-/* Code indicating object file or impure executable. */
-#define OMAGIC 0407
-/* Code indicating pure executable. */
-#define NMAGIC 0410
-/* Code indicating demand-paged executable. */
-#define ZMAGIC 0413
-
-#if !defined (N_BADMAG)
-#define N_BADMAG(x) \
- (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC \
- && N_MAGIC(x) != ZMAGIC)
-#endif
-
-#define _N_BADMAG(x) \
- (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC \
- && N_MAGIC(x) != ZMAGIC)
-
-#define _N_HDROFF(x) (1024 - sizeof (struct exec))
-
-#if !defined (N_TXTOFF)
-#define N_TXTOFF(x) \
- (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : sizeof (struct exec))
-#endif
-
-#if !defined (N_DATOFF)
-#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
-#endif
-
-#if !defined (N_TRELOFF)
-#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
-#endif
-
-#if !defined (N_DRELOFF)
-#define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_trsize)
-#endif
-
-#if !defined (N_SYMOFF)
-#define N_SYMOFF(x) (N_DRELOFF(x) + (x).a_drsize)
-#endif
-
-#if !defined (N_STROFF)
-#define N_STROFF(x) (N_SYMOFF(x) + (x).a_syms)
-#endif
-
-/* Address of text segment in memory after it is loaded. */
-#if !defined (N_TXTADDR)
-#define N_TXTADDR(x) 0
-#endif
-
-/* Address of data segment in memory after it is loaded.
- Note that it is up to you to define SEGMENT_SIZE
- on machines not listed here. */
-#if defined(vax) || defined(hp300) || defined(pyr)
-#define SEGMENT_SIZE page_size
-#endif
-#ifdef sony
-#define SEGMENT_SIZE 0x2000
-#endif /* Sony. */
-#ifdef is68k
-#define SEGMENT_SIZE 0x20000
-#endif
-#if defined(m68k) && defined(PORTAR)
-#define PAGE_SIZE 0x400
-#define SEGMENT_SIZE PAGE_SIZE
-#endif
-
-#define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))
-
-#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
-
-#ifndef N_DATADDR
-#define N_DATADDR(x) \
- (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
- : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
-#endif
-
-/* Address of bss segment in memory after it is loaded. */
-#if !defined (N_BSSADDR)
-#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
-#endif
-
-#if !defined (N_NLIST_DECLARED)
-struct nlist {
- union {
- char *n_name;
- struct nlist *n_next;
- long n_strx;
- } n_un;
- unsigned char n_type;
- char n_other;
- short n_desc;
- unsigned long n_value;
-};
-#endif /* no N_NLIST_DECLARED. */
-
-#if !defined (N_UNDF)
-#define N_UNDF 0
-#endif
-#if !defined (N_ABS)
-#define N_ABS 2
-#endif
-#if !defined (N_TEXT)
-#define N_TEXT 4
-#endif
-#if !defined (N_DATA)
-#define N_DATA 6
-#endif
-#if !defined (N_BSS)
-#define N_BSS 8
-#endif
-#if !defined (N_FN)
-#define N_FN 15
-#endif
-
-#if !defined (N_EXT)
-#define N_EXT 1
-#endif
-#if !defined (N_TYPE)
-#define N_TYPE 036
-#endif
-#if !defined (N_STAB)
-#define N_STAB 0340
-#endif
-
-/* 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. */
-#define N_INDR 0xa
-
-/* The following symbols refer to set elements.
- All the N_SET[ATDB] symbols with the same name form one set.
- Space is allocated for the set in the text section, and each set
- element's value is stored into one word of the space.
- The first word of the space is the length of the set (number of elements).
-
- 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. */
-
-/* These appear as input to LD, in a .o file. */
-#define N_SETA 0x14 /* Absolute set element symbol */
-#define N_SETT 0x16 /* Text set element symbol */
-#define N_SETD 0x18 /* Data set element symbol */
-#define N_SETB 0x1A /* Bss set element symbol */
-
-/* This is output from LD. */
-#define N_SETV 0x1C /* Pointer to set vector in data area. */
-
-#if !defined (N_RELOCATION_INFO_DECLARED)
-/* This structure describes a single relocation to be performed.
- The text-relocation section of the file is a vector of these structures,
- all of which apply to the text section.
- Likewise, the data-relocation section applies to the data section. */
-
-struct relocation_info
-{
- /* Address (within segment) to be relocated. */
- int r_address;
- /* The meaning of r_symbolnum depends on r_extern. */
- unsigned int r_symbolnum:24;
- /* Nonzero means value is a pc-relative offset
- and it should be relocated for changes in its own address
- as well as for changes in the symbol or section specified. */
- unsigned int r_pcrel:1;
- /* Length (as exponent of 2) of the field to be relocated.
- Thus, a value of 2 indicates 1<<2 bytes. */
- unsigned int r_length:2;
- /* 1 => relocate with value of symbol.
- r_symbolnum is the index of the symbol
- in file's the symbol table.
- 0 => relocate with the address of a segment.
- r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
- (the N_EXT bit may be set also, but signifies nothing). */
- unsigned int r_extern:1;
- /* Four bits that aren't used, but when writing an object file
- it is desirable to clear them. */
-#ifdef NS32K
- unsigned r_bsr:1;
- unsigned r_disp:1;
- unsigned r_pad:2;
-#else
- unsigned int r_pad:4;
-#endif
-};
-#endif /* no N_RELOCATION_INFO_DECLARED. */
-
-
-#endif /* __A_OUT_GNU_H__ */
diff --git a/gnu/usr.bin/as/config/i386-opcode.h b/gnu/usr.bin/as/config/i386-opcode.h
deleted file mode 100644
index cace0c3..0000000
--- a/gnu/usr.bin/as/config/i386-opcode.h
+++ /dev/null
@@ -1,806 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- *
- * @(#)i386-opcode.h 6.3 (Berkeley) 5/8/91
- */
-
-/* i386-opcode.h -- Intel 80386 opcode table
- Copyright (C) 1989, Free Software Foundation.
-
-This file is part of GAS, the GNU Assembler.
-
-GAS 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.
-
-GAS 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 GAS; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-template i386_optab[] = {
-
-#define _ None
-/* move instructions */
-{ "mov", 2, 0xa0, _, DW|NoModrm, Disp32, Acc, 0 },
-{ "mov", 2, 0x88, _, DW|Modrm, Reg, Reg|Mem, 0 },
-{ "mov", 2, 0xb0, _, ShortFormW, Imm, Reg, 0 },
-{ "mov", 2, 0xc6, _, W|Modrm, Imm, Reg|Mem, 0 },
-{ "mov", 2, 0x8c, _, D|Modrm, SReg3|SReg2, Reg16|Mem16, 0 },
-/* move to/from control debug registers */
-{ "mov", 2, 0x0f20, _, D|Modrm, Control, Reg32, 0},
-{ "mov", 2, 0x0f21, _, D|Modrm, Debug, Reg32, 0},
-{ "mov", 2, 0x0f24, _, D|Modrm, Test, Reg32, 0},
-
-/* move with sign extend */
-/* "movsbl" & "movsbw" must not be unified into "movsb" to avoid
- conflict with the "movs" string move instruction. Thus,
- {"movsb", 2, 0x0fbe, _, ReverseRegRegmem|Modrm, Reg8|Mem, Reg16|Reg32, 0},
- is not kosher; we must seperate the two instructions. */
-{"movsbl", 2, 0x0fbe, _, ReverseRegRegmem|Modrm, Reg8|Mem, Reg32, 0},
-{"movsbw", 2, 0x660fbe, _, ReverseRegRegmem|Modrm, Reg8|Mem, Reg16, 0},
-{"movswl", 2, 0x0fbf, _, ReverseRegRegmem|Modrm, Reg16|Mem, Reg32, 0},
-
-/* move with zero extend */
-{"movzb", 2, 0x0fb6, _, ReverseRegRegmem|Modrm, Reg8|Mem, Reg16|Reg32, 0},
-{"movzwl", 2, 0x0fb7, _, ReverseRegRegmem|Modrm, Reg16|Mem, Reg32, 0},
-
-/* push instructions */
-{"push", 1, 0x50, _, ShortForm, WordReg,0,0 },
-{"push", 1, 0xff, 0x6, Modrm, WordReg|WordMem, 0, 0 },
-{"push", 1, 0x6a, _, NoModrm, Imm8S, 0, 0},
-{"push", 1, 0x68, _, NoModrm, Imm16|Imm32, 0, 0},
-{"push", 1, 0x06, _, Seg2ShortForm, SReg2,0,0 },
-{"push", 1, 0x0fa0, _, Seg3ShortForm, SReg3,0,0 },
-/* push all */
-{"pusha", 0, 0x60, _, NoModrm, 0, 0, 0 },
-
-/* pop instructions */
-{"pop", 1, 0x58, _, ShortForm, WordReg,0,0 },
-{"pop", 1, 0x8f, 0x0, Modrm, WordReg|WordMem, 0, 0 },
-#define POP_SEG_SHORT 0x7
-{"pop", 1, 0x07, _, Seg2ShortForm, SReg2,0,0 },
-{"pop", 1, 0x0fa1, _, Seg3ShortForm, SReg3,0,0 },
-/* pop all */
-{"popa", 0, 0x61, _, NoModrm, 0, 0, 0 },
-
-/* xchg exchange instructions
- xchg commutes: we allow both operand orders */
-{"xchg", 2, 0x90, _, ShortForm, WordReg, Acc, 0 },
-{"xchg", 2, 0x90, _, ShortForm, Acc, WordReg, 0 },
-{"xchg", 2, 0x86, _, W|Modrm, Reg, Reg|Mem, 0 },
-{"xchg", 2, 0x86, _, W|Modrm, Reg|Mem, Reg, 0 },
-
-/* in/out from ports */
-{"in", 2, 0xe4, _, W|NoModrm, Imm8, Acc, 0 },
-{"in", 2, 0xec, _, W|NoModrm, InOutPortReg, Acc, 0 },
-{"out", 2, 0xe6, _, W|NoModrm, Acc, Imm8, 0 },
-{"out", 2, 0xee, _, W|NoModrm, Acc, InOutPortReg, 0 },
-
-/* load effective address */
-{"lea", 2, 0x8d, _, Modrm, WordMem, WordReg, 0 },
-
-/* load segment registers from memory */
-{"lds", 2, 0xc5, _, Modrm, Mem, Reg32, 0},
-{"les", 2, 0xc4, _, Modrm, Mem, Reg32, 0},
-{"lfs", 2, 0x0fb4, _, Modrm, Mem, Reg32, 0},
-{"lgs", 2, 0x0fb5, _, Modrm, Mem, Reg32, 0},
-{"lss", 2, 0x0fb2, _, Modrm, Mem, Reg32, 0},
-
-/* flags register instructions */
-{"clc", 0, 0xf8, _, NoModrm, 0, 0, 0},
-{"cld", 0, 0xfc, _, NoModrm, 0, 0, 0},
-{"cli", 0, 0xfa, _, NoModrm, 0, 0, 0},
-{"clts", 0, 0x0f06, _, NoModrm, 0, 0, 0},
-{"cmc", 0, 0xf5, _, NoModrm, 0, 0, 0},
-{"lahf", 0, 0x9f, _, NoModrm, 0, 0, 0},
-{"sahf", 0, 0x9e, _, NoModrm, 0, 0, 0},
-{"pushf", 0, 0x9c, _, NoModrm, 0, 0, 0},
-{"popf", 0, 0x9d, _, NoModrm, 0, 0, 0},
-{"stc", 0, 0xf9, _, NoModrm, 0, 0, 0},
-{"std", 0, 0xfd, _, NoModrm, 0, 0, 0},
-{"sti", 0, 0xfb, _, NoModrm, 0, 0, 0},
-
-{"add", 2, 0x0, _, DW|Modrm, Reg, Reg|Mem, 0},
-{"add", 2, 0x83, 0, Modrm, Imm8S, WordReg|WordMem, 0},
-{"add", 2, 0x4, _, W|NoModrm, Imm, Acc, 0},
-{"add", 2, 0x80, 0, W|Modrm, Imm, Reg|Mem, 0},
-
-{"inc", 1, 0x40, _, ShortForm, WordReg, 0, 0},
-{"inc", 1, 0xfe, 0, W|Modrm, Reg|Mem, 0, 0},
-
-{"sub", 2, 0x28, _, DW|Modrm, Reg, Reg|Mem, 0},
-{"sub", 2, 0x83, 5, Modrm, Imm8S, WordReg|WordMem, 0},
-{"sub", 2, 0x2c, _, W|NoModrm, Imm, Acc, 0},
-{"sub", 2, 0x80, 5, W|Modrm, Imm, Reg|Mem, 0},
-
-{"dec", 1, 0x48, _, ShortForm, WordReg, 0, 0},
-{"dec", 1, 0xfe, 1, W|Modrm, Reg|Mem, 0, 0},
-
-{"sbb", 2, 0x18, _, DW|Modrm, Reg, Reg|Mem, 0},
-{"sbb", 2, 0x83, 3, Modrm, Imm8S, WordReg|WordMem, 0},
-{"sbb", 2, 0x1c, _, W|NoModrm, Imm, Acc, 0},
-{"sbb", 2, 0x80, 3, W|Modrm, Imm, Reg|Mem, 0},
-
-{"cmp", 2, 0x38, _, DW|Modrm, Reg, Reg|Mem, 0},
-{"cmp", 2, 0x83, 7, Modrm, Imm8S, WordReg|WordMem, 0},
-{"cmp", 2, 0x3c, _, W|NoModrm, Imm, Acc, 0},
-{"cmp", 2, 0x80, 7, W|Modrm, Imm, Reg|Mem, 0},
-
-{"test", 2, 0x84, _, W|Modrm, Reg|Mem, Reg, 0},
-{"test", 2, 0x84, _, W|Modrm, Reg, Reg|Mem, 0},
-{"test", 2, 0xa8, _, W|NoModrm, Imm, Acc, 0},
-{"test", 2, 0xf6, 0, W|Modrm, Imm, Reg|Mem, 0},
-
-{"and", 2, 0x20, _, DW|Modrm, Reg, Reg|Mem, 0},
-{"and", 2, 0x83, 4, Modrm, Imm8S, WordReg|WordMem, 0},
-{"and", 2, 0x24, _, W|NoModrm, Imm, Acc, 0},
-{"and", 2, 0x80, 4, W|Modrm, Imm, Reg|Mem, 0},
-
-{"or", 2, 0x08, _, DW|Modrm, Reg, Reg|Mem, 0},
-{"or", 2, 0x83, 1, Modrm, Imm8S, WordReg|WordMem, 0},
-{"or", 2, 0x0c, _, W|NoModrm, Imm, Acc, 0},
-{"or", 2, 0x80, 1, W|Modrm, Imm, Reg|Mem, 0},
-
-{"xor", 2, 0x30, _, DW|Modrm, Reg, Reg|Mem, 0},
-{"xor", 2, 0x83, 6, Modrm, Imm8S, WordReg|WordMem, 0},
-{"xor", 2, 0x34, _, W|NoModrm, Imm, Acc, 0},
-{"xor", 2, 0x80, 6, W|Modrm, Imm, Reg|Mem, 0},
-
-{"adc", 2, 0x10, _, DW|Modrm, Reg, Reg|Mem, 0},
-{"adc", 2, 0x83, 2, Modrm, Imm8S, WordReg|WordMem, 0},
-{"adc", 2, 0x14, _, W|NoModrm, Imm, Acc, 0},
-{"adc", 2, 0x80, 2, W|Modrm, Imm, Reg|Mem, 0},
-
-{"neg", 1, 0xf6, 3, W|Modrm, Reg|Mem, 0, 0},
-{"not", 1, 0xf6, 2, W|Modrm, Reg|Mem, 0, 0},
-
-{"aaa", 0, 0x37, _, NoModrm, 0, 0, 0},
-{"aas", 0, 0x3f, _, NoModrm, 0, 0, 0},
-{"daa", 0, 0x27, _, NoModrm, 0, 0, 0},
-{"das", 0, 0x2f, _, NoModrm, 0, 0, 0},
-{"aad", 0, 0xd50a, _, NoModrm, 0, 0, 0},
-{"aam", 0, 0xd40a, _, NoModrm, 0, 0, 0},
-
-/* conversion insns */
-/* conversion: intel naming */
-{"cbw", 0, 0x6698, _, NoModrm, 0, 0, 0},
-{"cwd", 0, 0x6699, _, NoModrm, 0, 0, 0},
-{"cwde", 0, 0x98, _, NoModrm, 0, 0, 0},
-{"cdq", 0, 0x99, _, NoModrm, 0, 0, 0},
-/* att naming */
-{"cbtw", 0, 0x6698, _, NoModrm, 0, 0, 0},
-{"cwtl", 0, 0x98, _, NoModrm, 0, 0, 0},
-{"cwtd", 0, 0x6699, _, NoModrm, 0, 0, 0},
-{"cltd", 0, 0x99, _, NoModrm, 0, 0, 0},
-
-/* Warning! the mul/imul (opcode 0xf6) must only have 1 operand! They are
- expanding 64-bit multiplies, and *cannot* be selected to accomplish
- 'imul %ebx, %eax' (opcode 0x0faf must be used in this case)
- These multiplies can only be selected with single opearnd forms. */
-{"mul", 1, 0xf6, 4, W|Modrm, Reg|Mem, 0, 0},
-{"imul", 1, 0xf6, 5, W|Modrm, Reg|Mem, 0, 0},
-
-
-
-
-/* imulKludge here is needed to reverse the i.rm.reg & i.rm.regmem fields.
- These instructions are exceptions: 'imul $2, %eax, %ecx' would put
- '%eax' in the reg field and '%ecx' in the regmem field if we did not
- switch them. */
-{"imul", 2, 0x0faf, _, Modrm|ReverseRegRegmem, WordReg|Mem, WordReg, 0},
-{"imul", 3, 0x6b, _, Modrm|ReverseRegRegmem, Imm8S, WordReg|Mem, WordReg},
-{"imul", 3, 0x69, _, Modrm|ReverseRegRegmem, Imm16|Imm32, WordReg|Mem, WordReg},
-/*
- imul with 2 operands mimicks imul with 3 by puting register both
- in i.rm.reg & i.rm.regmem fields
-*/
-{"imul", 2, 0x6b, _, Modrm|imulKludge, Imm8S, WordReg, 0},
-{"imul", 2, 0x69, _, Modrm|imulKludge, Imm16|Imm32, WordReg, 0},
-{"div", 1, 0xf6, 6, W|Modrm, Reg|Mem, 0, 0},
-{"div", 2, 0xf6, 6, W|Modrm, Reg|Mem, Acc, 0},
-{"idiv", 1, 0xf6, 7, W|Modrm, Reg|Mem, 0, 0},
-{"idiv", 2, 0xf6, 7, W|Modrm, Reg|Mem, Acc, 0},
-
-{"rol", 2, 0xd0, 0, W|Modrm, Imm1, Reg|Mem, 0},
-{"rol", 2, 0xc0, 0, W|Modrm, Imm8, Reg|Mem, 0},
-{"rol", 2, 0xd2, 0, W|Modrm, ShiftCount, Reg|Mem, 0},
-{"rol", 1, 0xd0, 0, W|Modrm, Reg|Mem, 0, 0},
-
-{"ror", 2, 0xd0, 1, W|Modrm, Imm1, Reg|Mem, 0},
-{"ror", 2, 0xc0, 1, W|Modrm, Imm8, Reg|Mem, 0},
-{"ror", 2, 0xd2, 1, W|Modrm, ShiftCount, Reg|Mem, 0},
-{"ror", 1, 0xd0, 1, W|Modrm, Reg|Mem, 0, 0},
-
-{"rcl", 2, 0xd0, 2, W|Modrm, Imm1, Reg|Mem, 0},
-{"rcl", 2, 0xc0, 2, W|Modrm, Imm8, Reg|Mem, 0},
-{"rcl", 2, 0xd2, 2, W|Modrm, ShiftCount, Reg|Mem, 0},
-{"rcl", 1, 0xd0, 2, W|Modrm, Reg|Mem, 0, 0},
-
-{"rcr", 2, 0xd0, 3, W|Modrm, Imm1, Reg|Mem, 0},
-{"rcr", 2, 0xc0, 3, W|Modrm, Imm8, Reg|Mem, 0},
-{"rcr", 2, 0xd2, 3, W|Modrm, ShiftCount, Reg|Mem, 0},
-{"rcr", 1, 0xd0, 3, W|Modrm, Reg|Mem, 0, 0},
-
-{"sal", 2, 0xd0, 4, W|Modrm, Imm1, Reg|Mem, 0},
-{"sal", 2, 0xc0, 4, W|Modrm, Imm8, Reg|Mem, 0},
-{"sal", 2, 0xd2, 4, W|Modrm, ShiftCount, Reg|Mem, 0},
-{"sal", 1, 0xd0, 4, W|Modrm, Reg|Mem, 0, 0},
-{"shl", 2, 0xd0, 4, W|Modrm, Imm1, Reg|Mem, 0},
-{"shl", 2, 0xc0, 4, W|Modrm, Imm8, Reg|Mem, 0},
-{"shl", 2, 0xd2, 4, W|Modrm, ShiftCount, Reg|Mem, 0},
-{"shl", 1, 0xd0, 4, W|Modrm, Reg|Mem, 0, 0},
-
-{"shld", 3, 0x0fa4, _, Modrm, Imm8, WordReg, WordReg|Mem},
-{"shld", 3, 0x0fa5, _, Modrm, ShiftCount, WordReg, WordReg|Mem},
-
-{"shr", 2, 0xd0, 5, W|Modrm, Imm1, Reg|Mem, 0},
-{"shr", 2, 0xc0, 5, W|Modrm, Imm8, Reg|Mem, 0},
-{"shr", 2, 0xd2, 5, W|Modrm, ShiftCount, Reg|Mem, 0},
-{"shr", 1, 0xd0, 5, W|Modrm, Reg|Mem, 0, 0},
-
-{"shrd", 3, 0x0fac, _, Modrm, Imm8, WordReg, WordReg|Mem},
-{"shrd", 3, 0x0fad, _, Modrm, ShiftCount, WordReg, WordReg|Mem},
-
-{"sar", 2, 0xd0, 7, W|Modrm, Imm1, Reg|Mem, 0},
-{"sar", 2, 0xc0, 7, W|Modrm, Imm8, Reg|Mem, 0},
-{"sar", 2, 0xd2, 7, W|Modrm, ShiftCount, Reg|Mem, 0},
-{"sar", 1, 0xd0, 7, W|Modrm, Reg|Mem, 0, 0},
-
-/* control transfer instructions */
-#define CALL_PC_RELATIVE 0xe8
-{"call", 1, 0xe8, _, JumpDword, Disp32, 0, 0},
-{"call", 1, 0xff, 2, Modrm, Reg|Mem|JumpAbsolute, 0, 0},
-#define CALL_FAR_IMMEDIATE 0x9a
-{"lcall", 2, 0x9a, _, JumpInterSegment, Imm16, Imm32, 0},
-{"lcall", 1, 0xff, 3, Modrm, Mem, 0, 0},
-
-#define JUMP_PC_RELATIVE 0xeb
-{"jmp", 1, 0xeb, _, Jump, Disp, 0, 0},
-{"jmp", 1, 0xff, 4, Modrm, Reg32|Mem|JumpAbsolute, 0, 0},
-#define JUMP_FAR_IMMEDIATE 0xea
-{"ljmp", 2, 0xea, _, JumpInterSegment, Imm16, Imm32, 0},
-{"ljmp", 1, 0xff, 5, Modrm, Mem, 0, 0},
-
-{"ret", 0, 0xc3, _, NoModrm, 0, 0, 0},
-{"ret", 1, 0xc2, _, NoModrm, Imm16, 0, 0},
-{"lret", 0, 0xcb, _, NoModrm, 0, 0, 0},
-{"lret", 1, 0xca, _, NoModrm, Imm16, 0, 0},
-{"enter", 2, 0xc8, _, NoModrm, Imm16, Imm8, 0},
-{"leave", 0, 0xc9, _, NoModrm, 0, 0, 0},
-
-/* conditional jumps */
-{"jo", 1, 0x70, _, Jump, Disp, 0, 0},
-
-{"jno", 1, 0x71, _, Jump, Disp, 0, 0},
-
-{"jb", 1, 0x72, _, Jump, Disp, 0, 0},
-{"jc", 1, 0x72, _, Jump, Disp, 0, 0},
-{"jnae", 1, 0x72, _, Jump, Disp, 0, 0},
-
-{"jnb", 1, 0x73, _, Jump, Disp, 0, 0},
-{"jnc", 1, 0x73, _, Jump, Disp, 0, 0},
-{"jae", 1, 0x73, _, Jump, Disp, 0, 0},
-
-{"je", 1, 0x74, _, Jump, Disp, 0, 0},
-{"jz", 1, 0x74, _, Jump, Disp, 0, 0},
-
-{"jne", 1, 0x75, _, Jump, Disp, 0, 0},
-{"jnz", 1, 0x75, _, Jump, Disp, 0, 0},
-
-{"jbe", 1, 0x76, _, Jump, Disp, 0, 0},
-{"jna", 1, 0x76, _, Jump, Disp, 0, 0},
-
-{"jnbe", 1, 0x77, _, Jump, Disp, 0, 0},
-{"ja", 1, 0x77, _, Jump, Disp, 0, 0},
-
-{"js", 1, 0x78, _, Jump, Disp, 0, 0},
-
-{"jns", 1, 0x79, _, Jump, Disp, 0, 0},
-
-{"jp", 1, 0x7a, _, Jump, Disp, 0, 0},
-{"jpe", 1, 0x7a, _, Jump, Disp, 0, 0},
-
-{"jnp", 1, 0x7b, _, Jump, Disp, 0, 0},
-{"jpo", 1, 0x7b, _, Jump, Disp, 0, 0},
-
-{"jl", 1, 0x7c, _, Jump, Disp, 0, 0},
-{"jnge", 1, 0x7c, _, Jump, Disp, 0, 0},
-
-{"jnl", 1, 0x7d, _, Jump, Disp, 0, 0},
-{"jge", 1, 0x7d, _, Jump, Disp, 0, 0},
-
-{"jle", 1, 0x7e, _, Jump, Disp, 0, 0},
-{"jng", 1, 0x7e, _, Jump, Disp, 0, 0},
-
-{"jnle", 1, 0x7f, _, Jump, Disp, 0, 0},
-{"jg", 1, 0x7f, _, Jump, Disp, 0, 0},
-
-/* these turn into pseudo operations when disp is larger than 8 bits */
-#define IS_JUMP_ON_CX_ZERO(o) \
- (o == 0x67e3)
-#define IS_JUMP_ON_ECX_ZERO(o) \
- (o == 0xe3)
-
-{"jcxz", 1, 0x67e3, _, JumpByte, Disp, 0, 0},
-{"jecxz", 1, 0xe3, _, JumpByte, Disp, 0, 0},
-
-#define IS_LOOP_ECX_TIMES(o) \
- (o == 0xe2 || o == 0xe1 || o == 0xe0)
-
-{"loop", 1, 0xe2, _, JumpByte, Disp, 0, 0},
-
-{"loopz", 1, 0xe1, _, JumpByte, Disp, 0, 0},
-{"loope", 1, 0xe1, _, JumpByte, Disp, 0, 0},
-
-{"loopnz", 1, 0xe0, _, JumpByte, Disp, 0, 0},
-{"loopne", 1, 0xe0, _, JumpByte, Disp, 0, 0},
-
-/* set byte on flag instructions */
-{"seto", 1, 0x0f90, 0, Modrm, Reg8|Mem, 0, 0},
-
-{"setno", 1, 0x0f91, 0, Modrm, Reg8|Mem, 0, 0},
-
-{"setb", 1, 0x0f92, 0, Modrm, Reg8|Mem, 0, 0},
-{"setnae", 1, 0x0f92, 0, Modrm, Reg8|Mem, 0, 0},
-
-{"setnb", 1, 0x0f93, 0, Modrm, Reg8|Mem, 0, 0},
-{"setae", 1, 0x0f93, 0, Modrm, Reg8|Mem, 0, 0},
-
-{"sete", 1, 0x0f94, 0, Modrm, Reg8|Mem, 0, 0},
-{"setz", 1, 0x0f94, 0, Modrm, Reg8|Mem, 0, 0},
-
-{"setne", 1, 0x0f95, 0, Modrm, Reg8|Mem, 0, 0},
-{"setnz", 1, 0x0f95, 0, Modrm, Reg8|Mem, 0, 0},
-
-{"setbe", 1, 0x0f96, 0, Modrm, Reg8|Mem, 0, 0},
-{"setna", 1, 0x0f96, 0, Modrm, Reg8|Mem, 0, 0},
-
-{"setnbe", 1, 0x0f97, 0, Modrm, Reg8|Mem, 0, 0},
-{"seta", 1, 0x0f97, 0, Modrm, Reg8|Mem, 0, 0},
-
-{"sets", 1, 0x0f98, 0, Modrm, Reg8|Mem, 0, 0},
-
-{"setns", 1, 0x0f99, 0, Modrm, Reg8|Mem, 0, 0},
-
-{"setp", 1, 0x0f9a, 0, Modrm, Reg8|Mem, 0, 0},
-{"setpe", 1, 0x0f9a, 0, Modrm, Reg8|Mem, 0, 0},
-
-{"setnp", 1, 0x0f9b, 0, Modrm, Reg8|Mem, 0, 0},
-{"setpo", 1, 0x0f9b, 0, Modrm, Reg8|Mem, 0, 0},
-
-{"setl", 1, 0x0f9c, 0, Modrm, Reg8|Mem, 0, 0},
-{"setnge", 1, 0x0f9c, 0, Modrm, Reg8|Mem, 0, 0},
-
-{"setnl", 1, 0x0f9d, 0, Modrm, Reg8|Mem, 0, 0},
-{"setge", 1, 0x0f9d, 0, Modrm, Reg8|Mem, 0, 0},
-
-{"setle", 1, 0x0f9e, 0, Modrm, Reg8|Mem, 0, 0},
-{"setng", 1, 0x0f9e, 0, Modrm, Reg8|Mem, 0, 0},
-
-{"setnle", 1, 0x0f9f, 0, Modrm, Reg8|Mem, 0, 0},
-{"setg", 1, 0x0f9f, 0, Modrm, Reg8|Mem, 0, 0},
-
-#define IS_STRING_INSTRUCTION(o) \
- ((o) == 0xa6 || (o) == 0x6c || (o) == 0x6e || (o) == 0x6e || \
- (o) == 0xac || (o) == 0xa4 || (o) == 0xae || (o) == 0xaa || \
- (o) == 0xd7)
-
-/* string manipulation */
-{"cmps", 0, 0xa6, _, W|NoModrm, 0, 0, 0},
-{"ins", 0, 0x6c, _, W|NoModrm, 0, 0, 0},
-{"outs", 0, 0x6e, _, W|NoModrm, 0, 0, 0},
-{"lods", 0, 0xac, _, W|NoModrm, 0, 0, 0},
-{"movs", 0, 0xa4, _, W|NoModrm, 0, 0, 0},
-{"scas", 0, 0xae, _, W|NoModrm, 0, 0, 0},
-{"stos", 0, 0xaa, _, W|NoModrm, 0, 0, 0},
-{"xlat", 0, 0xd7, _, NoModrm, 0, 0, 0},
-
-/* bit manipulation */
-{"bsf", 2, 0x0fbc, _, Modrm|ReverseRegRegmem, Reg|Mem, Reg, 0},
-{"bsr", 2, 0x0fbd, _, Modrm|ReverseRegRegmem, Reg|Mem, Reg, 0},
-{"bt", 2, 0x0fa3, _, Modrm, Reg, Reg|Mem, 0},
-{"bt", 2, 0x0fba, 4, Modrm, Imm8, Reg|Mem, 0},
-{"btc", 2, 0x0fbb, _, Modrm, Reg, Reg|Mem, 0},
-{"btc", 2, 0x0fba, 7, Modrm, Imm8, Reg|Mem, 0},
-{"btr", 2, 0x0fb3, _, Modrm, Reg, Reg|Mem, 0},
-{"btr", 2, 0x0fba, 6, Modrm, Imm8, Reg|Mem, 0},
-{"bts", 2, 0x0fab, _, Modrm, Reg, Reg|Mem, 0},
-{"bts", 2, 0x0fba, 5, Modrm, Imm8, Reg|Mem, 0},
-
-/* interrupts & op. sys insns */
-/* See i386.c for conversion of 'int $3' into the special int 3 insn. */
-#define INT_OPCODE 0xcd
-#define INT3_OPCODE 0xcc
-{"int", 1, 0xcd, _, NoModrm, Imm8, 0, 0},
-{"int3", 0, 0xcc, _, NoModrm, 0, 0, 0},
-{"into", 0, 0xce, _, NoModrm, 0, 0, 0},
-{"iret", 0, 0xcf, _, NoModrm, 0, 0, 0},
-
-{"boundl", 2, 0x62, _, Modrm, Reg32, Mem, 0},
-{"boundw", 2, 0x6662, _, Modrm, Reg16, Mem, 0},
-
-{"hlt", 0, 0xf4, _, NoModrm, 0, 0, 0},
-{"wait", 0, 0x9b, _, NoModrm, 0, 0, 0},
-/* nop is actually 'xchgl %eax, %eax' */
-{"nop", 0, 0x90, _, NoModrm, 0, 0, 0},
-
-/* protection control */
-{"arpl", 2, 0x63, _, Modrm, Reg16, Reg16|Mem, 0},
-{"lar", 2, 0x0f02, _, Modrm|ReverseRegRegmem, WordReg|Mem, WordReg, 0},
-{"lgdt", 1, 0x0f01, 2, Modrm, Mem, 0, 0},
-{"lidt", 1, 0x0f01, 3, Modrm, Mem, 0, 0},
-{"lldt", 1, 0x0f00, 2, Modrm, WordReg|Mem, 0, 0},
-{"lmsw", 1, 0x0f01, 6, Modrm, WordReg|Mem, 0, 0},
-{"lsl", 2, 0x0f03, _, Modrm|ReverseRegRegmem, WordReg|Mem, WordReg, 0},
-{"ltr", 1, 0x0f00, 3, Modrm, WordReg|Mem, 0, 0},
-
-{"sgdt", 1, 0x0f01, 0, Modrm, Mem, 0, 0},
-{"sidt", 1, 0x0f01, 1, Modrm, Mem, 0, 0},
-{"sldt", 1, 0x0f00, 0, Modrm, WordReg|Mem, 0, 0},
-{"smsw", 1, 0x0f01, 4, Modrm, WordReg|Mem, 0, 0},
-{"str", 1, 0x0f00, 1, Modrm, Reg16|Mem, 0, 0},
-
-{"verr", 1, 0x0f00, 4, Modrm, WordReg|Mem, 0, 0},
-{"verw", 1, 0x0f00, 5, Modrm, WordReg|Mem, 0, 0},
-
-/* floating point instructions */
-
-/* load */
-{"fld", 1, 0xd9c0, _, ShortForm, FloatReg, 0, 0}, /* register */
-{"flds", 1, 0xd9, 0, Modrm, Mem, 0, 0}, /* %st0 <-- mem float */
-{"fildl", 1, 0xdb, 0, Modrm, Mem, 0, 0}, /* %st0 <-- mem word */
-{"fldl", 1, 0xdd, 0, Modrm, Mem, 0, 0}, /* %st0 <-- mem double */
-{"fldl", 1, 0xd9c0, _, ShortForm, FloatReg, 0, 0}, /* register */
-{"filds", 1, 0xdf, 0, Modrm, Mem, 0, 0}, /* %st0 <-- mem dword */
-{"fildq", 1, 0xdf, 5, Modrm, Mem, 0, 0}, /* %st0 <-- mem qword */
-{"fldt", 1, 0xdb, 5, Modrm, Mem, 0, 0}, /* %st0 <-- mem efloat */
-{"fbld", 1, 0xdf, 4, Modrm, Mem, 0, 0}, /* %st0 <-- mem bcd */
-
-/* store (no pop) */
-{"fst", 1, 0xddd0, _, ShortForm, FloatReg, 0, 0}, /* register */
-{"fsts", 1, 0xd9, 2, Modrm, Mem, 0, 0}, /* %st0 --> mem float */
-{"fistl", 1, 0xdb, 2, Modrm, Mem, 0, 0}, /* %st0 --> mem dword */
-{"fstl", 1, 0xdd, 2, Modrm, Mem, 0, 0}, /* %st0 --> mem double */
-{"fstl", 1, 0xddd0, _, ShortForm, FloatReg, 0, 0}, /* register */
-{"fists", 1, 0xdf, 2, Modrm, Mem, 0, 0}, /* %st0 --> mem word */
-
-/* store (with pop) */
-{"fstp", 1, 0xddd8, _, ShortForm, FloatReg, 0, 0}, /* register */
-{"fstps", 1, 0xd9, 3, Modrm, Mem, 0, 0}, /* %st0 --> mem float */
-{"fistpl", 1, 0xdb, 3, Modrm, Mem, 0, 0}, /* %st0 --> mem word */
-{"fstpl", 1, 0xdd, 3, Modrm, Mem, 0, 0}, /* %st0 --> mem double */
-{"fstpl", 1, 0xddd8, _, ShortForm, FloatReg, 0, 0}, /* register */
-{"fistps", 1, 0xdf, 3, Modrm, Mem, 0, 0}, /* %st0 --> mem dword */
-{"fistpq", 1, 0xdf, 7, Modrm, Mem, 0, 0}, /* %st0 --> mem qword */
-{"fstpt", 1, 0xdb, 7, Modrm, Mem, 0, 0}, /* %st0 --> mem efloat */
-{"fbstp", 1, 0xdf, 6, Modrm, Mem, 0, 0}, /* %st0 --> mem bcd */
-
-/* exchange %st<n> with %st0 */
-{"fxch", 1, 0xd9c8, _, ShortForm, FloatReg, 0, 0},
-
-/* comparison (without pop) */
-{"fcom", 1, 0xd8d0, _, ShortForm, FloatReg, 0, 0},
-{"fcoms", 1, 0xd8, 2, Modrm, Mem, 0, 0}, /* compare %st0, mem float */
-{"ficoml", 1, 0xda, 2, Modrm, Mem, 0, 0}, /* compare %st0, mem word */
-{"fcoml", 1, 0xdc, 2, Modrm, Mem, 0, 0}, /* compare %st0, mem double */
-{"fcoml", 1, 0xd8d0, _, ShortForm, FloatReg, 0, 0},
-{"ficoms", 1, 0xde, 2, Modrm, Mem, 0, 0}, /* compare %st0, mem dword */
-
-/* comparison (with pop) */
-{"fcomp", 1, 0xd8d8, _, ShortForm, FloatReg, 0, 0},
-{"fcomps", 1, 0xd8, 3, Modrm, Mem, 0, 0}, /* compare %st0, mem float */
-{"ficompl", 1, 0xda, 3, Modrm, Mem, 0, 0}, /* compare %st0, mem word */
-{"fcompl", 1, 0xdc, 3, Modrm, Mem, 0, 0}, /* compare %st0, mem double */
-{"fcompl", 1, 0xd8d8, _, ShortForm, FloatReg, 0, 0},
-{"ficomps", 1, 0xde, 3, Modrm, Mem, 0, 0}, /* compare %st0, mem dword */
-{"fcompp", 0, 0xded9, _, NoModrm, 0, 0, 0}, /* compare %st0, %st1 & pop twice */
-
-/* unordered comparison (with pop) */
-{"fucom", 1, 0xdde0, _, ShortForm, FloatReg, 0, 0},
-{"fucomp", 1, 0xdde8, _, ShortForm, FloatReg, 0, 0},
-{"fucompp", 0, 0xdae9, _, NoModrm, 0, 0, 0}, /* ucompare %st0, %st1 & pop twice */
-
-{"ftst", 0, 0xd9e4, _, NoModrm, 0, 0, 0}, /* test %st0 */
-{"fxam", 0, 0xd9e5, _, NoModrm, 0, 0, 0}, /* examine %st0 */
-
-/* load constants into %st0 */
-{"fld1", 0, 0xd9e8, _, NoModrm, 0, 0, 0}, /* %st0 <-- 1.0 */
-{"fldl2t", 0, 0xd9e9, _, NoModrm, 0, 0, 0}, /* %st0 <-- log2(10) */
-{"fldl2e", 0, 0xd9ea, _, NoModrm, 0, 0, 0}, /* %st0 <-- log2(e) */
-{"fldpi", 0, 0xd9eb, _, NoModrm, 0, 0, 0}, /* %st0 <-- pi */
-{"fldlg2", 0, 0xd9ec, _, NoModrm, 0, 0, 0}, /* %st0 <-- log10(2) */
-{"fldln2", 0, 0xd9ed, _, NoModrm, 0, 0, 0}, /* %st0 <-- ln(2) */
-{"fldz", 0, 0xd9ee, _, NoModrm, 0, 0, 0}, /* %st0 <-- 0.0 */
-
-/* arithmetic */
-
-/* add */
-{"fadd", 1, 0xd8c0, _, ShortForm, FloatReg, 0, 0},
-{"fadd", 2, 0xd8c0, _, ShortForm|FloatD, FloatReg, FloatAcc, 0},
-{"fadd", 0, 0xdcc1, _, NoModrm, 0, 0, 0}, /* alias for fadd %st, %st(1) */
-{"faddp", 1, 0xdac0, _, ShortForm, FloatReg, 0, 0},
-{"faddp", 2, 0xdac0, _, ShortForm|FloatD, FloatReg, FloatAcc, 0},
-{"faddp", 0, 0xdec1, _, NoModrm, 0, 0, 0}, /* alias for faddp %st, %st(1) */
-{"fadds", 1, 0xd8, 0, Modrm, Mem, 0, 0},
-{"fiaddl", 1, 0xda, 0, Modrm, Mem, 0, 0},
-{"faddl", 1, 0xdc, 0, Modrm, Mem, 0, 0},
-{"fiadds", 1, 0xde, 0, Modrm, Mem, 0, 0},
-
-/* sub */
-/* Note: intel has decided that certain of these operations are reversed
- in assembler syntax. */
-{"fsub", 1, 0xd8e0, _, ShortForm, FloatReg, 0, 0},
-{"fsub", 2, 0xd8e0, _, ShortForm, FloatReg, FloatAcc, 0},
-#ifdef NON_BROKEN_OPCODES
-{"fsub", 2, 0xdce8, _, ShortForm, FloatAcc, FloatReg, 0},
-#else
-{"fsub", 2, 0xdce0, _, ShortForm, FloatAcc, FloatReg, 0},
-#endif
-{"fsub", 0, 0xdce1, _, NoModrm, 0, 0, 0},
-{"fsubp", 1, 0xdae0, _, ShortForm, FloatReg, 0, 0},
-{"fsubp", 2, 0xdae0, _, ShortForm, FloatReg, FloatAcc, 0},
-#ifdef NON_BROKEN_OPCODES
-{"fsubp", 2, 0xdee8, _, ShortForm, FloatAcc, FloatReg, 0},
-#else
-{"fsubp", 2, 0xdee0, _, ShortForm, FloatAcc, FloatReg, 0},
-#endif
-{"fsubp", 0, 0xdee1, _, NoModrm, 0, 0, 0},
-{"fsubs", 1, 0xd8, 4, Modrm, Mem, 0, 0},
-{"fisubl", 1, 0xda, 4, Modrm, Mem, 0, 0},
-{"fsubl", 1, 0xdc, 4, Modrm, Mem, 0, 0},
-{"fisubs", 1, 0xde, 4, Modrm, Mem, 0, 0},
-
-/* sub reverse */
-{"fsubr", 1, 0xd8e8, _, ShortForm, FloatReg, 0, 0},
-{"fsubr", 2, 0xd8e8, _, ShortForm, FloatReg, FloatAcc, 0},
-#ifdef NON_BROKEN_OPCODES
-{"fsubr", 2, 0xdce0, _, ShortForm, FloatAcc, FloatReg, 0},
-#else
-{"fsubr", 2, 0xdce8, _, ShortForm, FloatAcc, FloatReg, 0},
-#endif
-{"fsubr", 0, 0xdce9, _, NoModrm, 0, 0, 0},
-{"fsubrp", 1, 0xdae8, _, ShortForm, FloatReg, 0, 0},
-{"fsubrp", 2, 0xdae8, _, ShortForm, FloatReg, FloatAcc, 0},
-#ifdef NON_BROKEN_OPCODES
-{"fsubrp", 2, 0xdee0, _, ShortForm, FloatAcc, FloatReg, 0},
-#else
-{"fsubrp", 2, 0xdee8, _, ShortForm, FloatAcc, FloatReg, 0},
-#endif
-{"fsubrp", 0, 0xdee9, _, NoModrm, 0, 0, 0},
-{"fsubrs", 1, 0xd8, 5, Modrm, Mem, 0, 0},
-{"fisubrl", 1, 0xda, 5, Modrm, Mem, 0, 0},
-{"fsubrl", 1, 0xdc, 5, Modrm, Mem, 0, 0},
-{"fisubrs", 1, 0xde, 5, Modrm, Mem, 0, 0},
-
-/* mul */
-{"fmul", 1, 0xd8c8, _, ShortForm, FloatReg, 0, 0},
-{"fmul", 2, 0xd8c8, _, ShortForm|FloatD, FloatReg, FloatAcc, 0},
-{"fmul", 0, 0xdcc9, _, NoModrm, 0, 0, 0},
-{"fmulp", 1, 0xdac8, _, ShortForm, FloatReg, 0, 0},
-{"fmulp", 2, 0xdac8, _, ShortForm|FloatD, FloatReg, FloatAcc, 0},
-{"fmulp", 0, 0xdec9, _, NoModrm, 0, 0, 0},
-{"fmuls", 1, 0xd8, 1, Modrm, Mem, 0, 0},
-{"fimull", 1, 0xda, 1, Modrm, Mem, 0, 0},
-{"fmull", 1, 0xdc, 1, Modrm, Mem, 0, 0},
-{"fimuls", 1, 0xde, 1, Modrm, Mem, 0, 0},
-
-/* div */
-/* Note: intel has decided that certain of these operations are reversed
- in assembler syntax. */
-{"fdiv", 1, 0xd8f0, _, ShortForm, FloatReg, 0, 0},
-{"fdiv", 2, 0xd8f0, _, ShortForm, FloatReg, FloatAcc, 0},
-#ifdef NON_BROKEN_OPCODES
-{"fdiv", 2, 0xdcf8, _, ShortForm, FloatAcc, FloatReg, 0},
-#else
-{"fdiv", 2, 0xdcf0, _, ShortForm, FloatAcc, FloatReg, 0},
-#endif
-{"fdiv", 0, 0xdcf1, _, NoModrm, 0, 0, 0},
-{"fdivp", 1, 0xdaf0, _, ShortForm, FloatReg, 0, 0},
-{"fdivp", 2, 0xdaf0, _, ShortForm, FloatReg, FloatAcc, 0},
-#ifdef NON_BROKEN_OPCODES
-{"fdivp", 2, 0xdef8, _, ShortForm, FloatAcc, FloatReg, 0},
-#else
-{"fdivp", 2, 0xdef0, _, ShortForm, FloatAcc, FloatReg, 0},
-#endif
-{"fdivp", 0, 0xdef1, _, NoModrm, 0, 0, 0},
-{"fdivs", 1, 0xd8, 6, Modrm, Mem, 0, 0},
-{"fidivl", 1, 0xda, 6, Modrm, Mem, 0, 0},
-{"fdivl", 1, 0xdc, 6, Modrm, Mem, 0, 0},
-{"fidivs", 1, 0xde, 6, Modrm, Mem, 0, 0},
-
-/* div reverse */
-{"fdivr", 1, 0xd8f8, _, ShortForm, FloatReg, 0, 0},
-{"fdivr", 2, 0xd8f8, _, ShortForm, FloatReg, FloatAcc, 0},
-#ifdef NON_BROKEN_OPCODES
-{"fdivr", 2, 0xdcf0, _, ShortForm, FloatAcc, FloatReg, 0},
-#else
-{"fdivr", 2, 0xdcf8, _, ShortForm, FloatAcc, FloatReg, 0},
-#endif
-{"fdivr", 0, 0xdcf9, _, NoModrm, 0, 0, 0},
-{"fdivrp", 1, 0xdaf8, _, ShortForm, FloatReg, 0, 0},
-{"fdivrp", 2, 0xdaf8, _, ShortForm, FloatReg, FloatAcc, 0},
-#ifdef NON_BROKEN_OPCODES
-{"fdivrp", 2, 0xdef0, _, ShortForm, FloatAcc, FloatReg, 0},
-#else
-{"fdivrp", 2, 0xdef8, _, ShortForm, FloatAcc, FloatReg, 0},
-#endif
-{"fdivrp", 0, 0xdef9, _, NoModrm, 0, 0, 0},
-{"fdivrs", 1, 0xd8, 7, Modrm, Mem, 0, 0},
-{"fidivrl", 1, 0xda, 7, Modrm, Mem, 0, 0},
-{"fdivrl", 1, 0xdc, 7, Modrm, Mem, 0, 0},
-{"fidivrs", 1, 0xde, 7, Modrm, Mem, 0, 0},
-
-{"f2xm1", 0, 0xd9f0, _, NoModrm, 0, 0, 0},
-{"fyl2x", 0, 0xd9f1, _, NoModrm, 0, 0, 0},
-{"fptan", 0, 0xd9f2, _, NoModrm, 0, 0, 0},
-{"fpatan", 0, 0xd9f3, _, NoModrm, 0, 0, 0},
-{"fxtract", 0, 0xd9f4, _, NoModrm, 0, 0, 0},
-{"fprem1", 0, 0xd9f5, _, NoModrm, 0, 0, 0},
-{"fdecstp", 0, 0xd9f6, _, NoModrm, 0, 0, 0},
-{"fincstp", 0, 0xd9f7, _, NoModrm, 0, 0, 0},
-{"fprem", 0, 0xd9f8, _, NoModrm, 0, 0, 0},
-{"fyl2xp1", 0, 0xd9f9, _, NoModrm, 0, 0, 0},
-{"fsqrt", 0, 0xd9fa, _, NoModrm, 0, 0, 0},
-{"fsincos", 0, 0xd9fb, _, NoModrm, 0, 0, 0},
-{"frndint", 0, 0xd9fc, _, NoModrm, 0, 0, 0},
-{"fscale", 0, 0xd9fd, _, NoModrm, 0, 0, 0},
-{"fsin", 0, 0xd9fe, _, NoModrm, 0, 0, 0},
-{"fcos", 0, 0xd9ff, _, NoModrm, 0, 0, 0},
-
-{"fchs", 0, 0xd9e0, _, NoModrm, 0, 0, 0},
-{"fabs", 0, 0xd9e1, _, NoModrm, 0, 0, 0},
-
-/* processor control */
-{"fninit", 0, 0xdbe3, _, NoModrm, 0, 0, 0},
-{"finit", 0, 0xdbe3, _, NoModrm, 0, 0, 0},
-{"fldcw", 1, 0xd9, 5, Modrm, Mem, 0, 0},
-{"fnstcw", 1, 0xd9, 7, Modrm, Mem, 0, 0},
-{"fstcw", 1, 0xd9, 7, Modrm, Mem, 0, 0},
-{"fnstsw", 1, 0xdfe0, _, NoModrm, Acc, 0, 0},
-{"fnstsw", 1, 0xdd, 7, Modrm, Mem, 0, 0},
-{"fnstsw", 0, 0xdfe0, _, NoModrm, 0, 0, 0},
-{"fstsw", 1, 0xdfe0, _, NoModrm, Acc, 0, 0},
-{"fstsw", 1, 0xdd, 7, Modrm, Mem, 0, 0},
-{"fstsw", 0, 0xdfe0, _, NoModrm, 0, 0, 0},
-{"fnclex", 0, 0xdbe2, _, NoModrm, 0, 0, 0},
-{"fclex", 0, 0xdbe2, _, NoModrm, 0, 0, 0},
-/*
- We ignore the short format (287) versions of fstenv/fldenv & fsave/frstor
- instructions; i'm not sure how to add them or how they are different.
- My 386/387 book offers no details about this.
-*/
-{"fnstenv", 1, 0xd9, 6, Modrm, Mem, 0, 0},
-{"fstenv", 1, 0xd9, 6, Modrm, Mem, 0, 0},
-{"fldenv", 1, 0xd9, 4, Modrm, Mem, 0, 0},
-{"fnsave", 1, 0xdd, 6, Modrm, Mem, 0, 0},
-{"fsave", 1, 0xdd, 6, Modrm, Mem, 0, 0},
-{"frstor", 1, 0xdd, 4, Modrm, Mem, 0, 0},
-
-{"ffree", 1, 0xddc0, _, ShortForm, FloatReg, 0, 0},
-{"fnop", 0, 0xd9d0, _, NoModrm, 0, 0, 0},
-{"fwait", 0, 0x9b, _, NoModrm, 0, 0, 0},
-
-/*
- opcode prefixes; we allow them as seperate insns too
- (see prefix table below)
-*/
-{"aword", 0, 0x67, _, NoModrm, 0, 0, 0},
-{"word", 0, 0x66, _, NoModrm, 0, 0, 0},
-{"lock", 0, 0xf0, _, NoModrm, 0, 0, 0},
-{"cs", 0, 0x2e, _, NoModrm, 0, 0, 0},
-{"ds", 0, 0x3e, _, NoModrm, 0, 0, 0},
-{"es", 0, 0x26, _, NoModrm, 0, 0, 0},
-{"fs", 0, 0x64, _, NoModrm, 0, 0, 0},
-{"gs", 0, 0x65, _, NoModrm, 0, 0, 0},
-{"ss", 0, 0x36, _, NoModrm, 0, 0, 0},
-{"rep", 0, 0xf3, _, NoModrm, 0, 0, 0},
-{"repe", 0, 0xf3, _, NoModrm, 0, 0, 0},
-{ "repne", 0, 0xf2, _, NoModrm, 0, 0, 0},
-
-{"", 0, 0, 0, 0, 0, 0, 0} /* sentinal */
-};
-#undef _
-
-template *i386_optab_end
- = i386_optab + sizeof (i386_optab)/sizeof(i386_optab[0]);
-
-/* 386 register table */
-
-reg_entry i386_regtab[] = {
- /* 8 bit regs */
- {"al", Reg8|Acc, 0}, {"cl", Reg8|ShiftCount, 1}, {"dl", Reg8, 2},
- {"bl", Reg8, 3},
- {"ah", Reg8, 4}, {"ch", Reg8, 5}, {"dh", Reg8, 6}, {"bh", Reg8, 7},
- /* 16 bit regs */
- {"ax", Reg16|Acc, 0}, {"cx", Reg16, 1}, {"dx", Reg16|InOutPortReg, 2}, {"bx", Reg16, 3},
- {"sp", Reg16, 4}, {"bp", Reg16, 5}, {"si", Reg16, 6}, {"di", Reg16, 7},
- /* 32 bit regs */
- {"eax", Reg32|Acc, 0}, {"ecx", Reg32, 1}, {"edx", Reg32, 2}, {"ebx", Reg32, 3},
- {"esp", Reg32, 4}, {"ebp", Reg32, 5}, {"esi", Reg32, 6}, {"edi", Reg32, 7},
- /* segment registers */
- {"es", SReg2, 0}, {"cs", SReg2, 1}, {"ss", SReg2, 2},
- {"ds", SReg2, 3}, {"fs", SReg3, 4}, {"gs", SReg3, 5},
- /* control registers */
- {"cr0", Control, 0}, {"cr2", Control, 2}, {"cr3", Control, 3},
- /* debug registers */
- {"db0", Debug, 0}, {"db1", Debug, 1}, {"db2", Debug, 2},
- {"db3", Debug, 3}, {"db6", Debug, 6}, {"db7", Debug, 7},
- /* test registers */
- {"tr6", Test, 6}, {"tr7", Test, 7},
- /* float registers */
- {"st(0)", FloatReg|FloatAcc, 0},
- {"st", FloatReg|FloatAcc, 0},
- {"st(1)", FloatReg, 1}, {"st(2)", FloatReg, 2},
- {"st(3)", FloatReg, 3}, {"st(4)", FloatReg, 4}, {"st(5)", FloatReg, 5},
- {"st(6)", FloatReg, 6}, {"st(7)", FloatReg, 7}
-};
-
-#define MAX_REG_NAME_SIZE 8 /* for parsing register names from input */
-
-reg_entry *i386_regtab_end
- = i386_regtab + sizeof(i386_regtab)/sizeof(i386_regtab[0]);
-
-/* segment stuff */
-seg_entry cs = { "cs", 0x2e };
-seg_entry ds = { "ds", 0x3e };
-seg_entry ss = { "ss", 0x36 };
-seg_entry es = { "es", 0x26 };
-seg_entry fs = { "fs", 0x64 };
-seg_entry gs = { "gs", 0x65 };
-seg_entry null = { "", 0x0 };
-
-/*
- This table is used to store the default segment register implied by all
- possible memory addressing modes.
- It is indexed by the mode & modrm entries of the modrm byte as follows:
- index = (mode<<3) | modrm;
-*/
-seg_entry *one_byte_segment_defaults[] = {
- /* mode 0 */
- &ds, &ds, &ds, &ds, &null, &ds, &ds, &ds,
- /* mode 1 */
- &ds, &ds, &ds, &ds, &null, &ss, &ds, &ds,
- /* mode 2 */
- &ds, &ds, &ds, &ds, &null, &ss, &ds, &ds,
- /* mode 3 --- not a memory reference; never referenced */
-};
-
-seg_entry *two_byte_segment_defaults[] = {
- /* mode 0 */
- &ds, &ds, &ds, &ds, &ss, &ds, &ds, &ds,
- /* mode 1 */
- &ds, &ds, &ds, &ds, &ss, &ds, &ds, &ds,
- /* mode 2 */
- &ds, &ds, &ds, &ds, &ss, &ds, &ds, &ds,
- /* mode 3 --- not a memory reference; never referenced */
-};
-
-prefix_entry i386_prefixtab[] = {
- { "addr16", 0x67 }, /* address size prefix ==> 16bit addressing
- * (How is this useful?) */
-#define WORD_PREFIX_OPCODE 0x66
- { "data16", 0x66 }, /* operand size prefix */
- { "lock", 0xf0 }, /* bus lock prefix */
- { "wait", 0x9b }, /* wait for coprocessor */
- { "cs", 0x2e }, { "ds", 0x3e }, /* segment overrides ... */
- { "es", 0x26 }, { "fs", 0x64 },
- { "gs", 0x65 }, { "ss", 0x36 },
-/* REPE & REPNE used to detect rep/repne with a non-string instruction */
-#define REPNE 0xf2
-#define REPE 0xf3
- { "rep", 0xf3 }, { "repe", 0xf3 }, /* repeat string instructions */
- { "repne", 0xf2 }
-};
-
-prefix_entry *i386_prefixtab_end
- = i386_prefixtab + sizeof(i386_prefixtab)/sizeof(i386_prefixtab[0]);
-
diff --git a/gnu/usr.bin/as/config/i386.c b/gnu/usr.bin/as/config/i386.c
deleted file mode 100644
index 2281acd..0000000
--- a/gnu/usr.bin/as/config/i386.c
+++ /dev/null
@@ -1,1946 +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[] = "@(#)i386.c 6.4 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* i386.c -- Assemble code for the Intel 80386
- Copyright (C) 1989, Free Software Foundation.
-
-This file is part of GAS, the GNU Assembler.
-
-GAS 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.
-
-GAS 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 GAS; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/*
- Intel 80386 machine specific gas.
- Written by Eliot Dresselhaus (eliot@mgm.mit.edu).
- Bugs & suggestions are completely welcome. This is free software.
- Please help us make it better.
-*/
-
-#include <stdio.h>
-#include <varargs.h>
-#include <ctype.h>
-
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else
-extern char *alloca();
-#endif
-#ifdef USG
-#define index strchr
-#endif
-
-#include "as.h"
-#include "read.h"
-#include "flonum.h"
-#include "obstack.h"
-#include "frags.h"
-#include "struc-symbol.h"
-#include "expr.h"
-#include "symbols.h"
-#include "hash.h"
-#include "md.h"
-#include "i386.h"
-#include "i386-opcode.h"
-
-long omagic = OMAGIC;
-char FLT_CHARS[] = "fFdDxX";
-char EXP_CHARS[] = "eE";
-char line_comment_chars[] = "#";
-char comment_chars[] = "#";
-
-/* tables for lexical analysis */
-static char opcode_chars[256];
-static char register_chars[256];
-static char operand_chars[256];
-static char space_chars[256];
-static char identifier_chars[256];
-static char digit_chars[256];
-
-/* lexical macros */
-#define is_opcode_char(x) (opcode_chars[(unsigned char) x])
-#define is_operand_char(x) (operand_chars[(unsigned char) x])
-#define is_register_char(x) (register_chars[(unsigned char) x])
-#define is_space_char(x) (space_chars[(unsigned char) x])
-#define is_identifier_char(x) (identifier_chars[(unsigned char) x])
-#define is_digit_char(x) (digit_chars[(unsigned char) x])
-
-/* put here all non-digit non-letter charcters that may occur in an operand */
-static char operand_special_chars[] = "%$-+(,)*._~/<>|&^!:";
-
-static char *ordinal_names[] = { "first", "second", "third" }; /* for printfs */
-
-/* md_assemble() always leaves the strings it's passed unaltered. To
- effect this we maintain a stack of saved characters that we've smashed
- with '\0's (indicating end of strings for various sub-fields of the
- assembler instruction). */
-static char save_stack[32];
-static char *save_stack_p; /* stack pointer */
-#define END_STRING_AND_SAVE(s) *save_stack_p++ = *s; *s = '\0'
-#define RESTORE_END_STRING(s) *s = *--save_stack_p
-
-/* The instruction we're assembling. */
-static i386_insn i;
-
-/* Per instruction expressionS buffers: 2 displacements & 2 immediate max. */
-static expressionS disp_expressions[2], im_expressions[2];
-
-/* pointers to ebp & esp entries in reg_hash hash table */
-static reg_entry *ebp, *esp;
-
-static int this_operand; /* current operand we are working on */
-
-/*
-Interface to relax_segment.
-There are 2 relax states for 386 jump insns: one for conditional & one
-for unconditional jumps. This is because the these two types of jumps
-add different sizes to frags when we're figuring out what sort of jump
-to choose to reach a given label. */
-
-/* types */
-#define COND_JUMP 1 /* conditional jump */
-#define UNCOND_JUMP 2 /* unconditional jump */
-/* sizes */
-#define BYTE 0
-#define WORD 1
-#define DWORD 2
-#define UNKNOWN_SIZE 3
-
-#define ENCODE_RELAX_STATE(type,size) ((type<<2) | (size))
-#define SIZE_FROM_RELAX_STATE(s) \
- ( (((s) & 0x3) == BYTE ? 1 : (((s) & 0x3) == WORD ? 2 : 4)) )
-
-const relax_typeS md_relax_table[] = {
-/*
- The fields are:
- 1) most positive reach of this state,
- 2) most negative reach of this state,
- 3) how many bytes this mode will add to the size of the current frag
- 4) which index into the table to try if we can't fit into this one.
-*/
- {1, 1, 0, 0},
- {1, 1, 0, 0},
- {1, 1, 0, 0},
- {1, 1, 0, 0},
-
- /* For now we don't use word displacement jumps: they may be
- untrustworthy. */
- {127+1, -128+1, 0, ENCODE_RELAX_STATE(COND_JUMP,DWORD) },
- /* word conditionals add 3 bytes to frag:
- 2 opcode prefix; 1 displacement bytes */
- {32767+2, -32768+2, 3, ENCODE_RELAX_STATE(COND_JUMP,DWORD) },
- /* dword conditionals adds 4 bytes to frag:
- 1 opcode prefix; 3 displacement bytes */
- {0, 0, 4, 0},
- {1, 1, 0, 0},
-
- {127+1, -128+1, 0, ENCODE_RELAX_STATE(UNCOND_JUMP,DWORD) },
- /* word jmp adds 2 bytes to frag:
- 1 opcode prefix; 1 displacement bytes */
- {32767+2, -32768+2, 2, ENCODE_RELAX_STATE(UNCOND_JUMP,DWORD) },
- /* dword jmp adds 3 bytes to frag:
- 0 opcode prefix; 3 displacement bytes */
- {0, 0, 3, 0},
- {1, 1, 0, 0},
-
-};
-
-void float_cons (), cons ();
-
-/* Ignore certain directives generated by gcc. This probably should
- not be here. */
-void dummy ()
-{
- while (*input_line_pointer && *input_line_pointer != '\n')
- input_line_pointer++;
-}
-
-const pseudo_typeS md_pseudo_table[] = {
- { "ffloat", float_cons, 'f' },
- { "dfloat", float_cons, 'd' },
- { "tfloat", float_cons, 'x' },
- { "value", cons, 2 },
- { "ident", dummy, 0 }, /* ignore these directives */
- { "def", dummy, 0 },
- { "optim", dummy, 0 }, /* For sun386i cc */
- { "version", dummy, 0 },
- { "ln", dummy, 0 },
- { 0, 0, 0 }
-};
-
-/* for interface with expression () */
-extern char * input_line_pointer;
-char * index ();
-
-char * output_invalid ();
-reg_entry * parse_register ();
-
-/* obstack for constructing various things in md_begin */
-struct obstack o;
-
-/* hash table for opcode lookup */
-static struct hash_control *op_hash = (struct hash_control *) 0;
-/* hash table for register lookup */
-static struct hash_control *reg_hash = (struct hash_control *) 0;
-/* hash table for prefix lookup */
-static struct hash_control *prefix_hash = (struct hash_control *) 0;
-
-
-void md_begin ()
-{
- char * hash_err;
-
- obstack_begin (&o,4096);
-
- /* initialize op_hash hash table */
- op_hash = hash_new(); /* xmalloc handles error */
-
- {
- register template *optab;
- register templates *core_optab;
- char *prev_name;
-
- optab = i386_optab; /* setup for loop */
- prev_name = optab->name;
- obstack_grow (&o, optab, sizeof(template));
- core_optab = (templates *) xmalloc (sizeof (templates));
-
- for (optab++; optab < i386_optab_end; optab++) {
- if (! strcmp (optab->name, prev_name)) {
- /* same name as before --> append to current template list */
- obstack_grow (&o, optab, sizeof(template));
- } else {
- /* different name --> ship out current template list;
- add to hash table; & begin anew */
- /* Note: end must be set before start! since obstack_next_free changes
- upon opstack_finish */
- core_optab->end = (template *) obstack_next_free(&o);
- core_optab->start = (template *) obstack_finish(&o);
- hash_err = hash_insert (op_hash, prev_name, (char *) core_optab);
- if (hash_err && *hash_err) {
- hash_error:
- as_fatal("Internal Error: Can't hash %s: %s",prev_name, hash_err);
- }
- prev_name = optab->name;
- core_optab = (templates *) xmalloc (sizeof(templates));
- obstack_grow (&o, optab, sizeof(template));
- }
- }
- }
-
- /* initialize reg_hash hash table */
- reg_hash = hash_new();
- {
- register reg_entry *regtab;
-
- for (regtab = i386_regtab; regtab < i386_regtab_end; regtab++) {
- hash_err = hash_insert (reg_hash, regtab->reg_name, regtab);
- if (hash_err && *hash_err) goto hash_error;
- }
- }
-
- esp = (reg_entry *) hash_find (reg_hash, "esp");
- ebp = (reg_entry *) hash_find (reg_hash, "ebp");
-
- /* initialize reg_hash hash table */
- prefix_hash = hash_new();
- {
- register prefix_entry *prefixtab;
-
- for (prefixtab = i386_prefixtab;
- prefixtab < i386_prefixtab_end; prefixtab++) {
- hash_err = hash_insert (prefix_hash, prefixtab->prefix_name, prefixtab);
- if (hash_err && *hash_err) goto hash_error;
- }
- }
-
- /* fill in lexical tables: opcode_chars, operand_chars, space_chars */
- {
- register unsigned int c;
-
- bzero (opcode_chars, sizeof(opcode_chars));
- bzero (operand_chars, sizeof(operand_chars));
- bzero (space_chars, sizeof(space_chars));
- bzero (identifier_chars, sizeof(identifier_chars));
- bzero (digit_chars, sizeof(digit_chars));
-
- for (c = 0; c < 256; c++) {
- if (islower(c) || isdigit(c)) {
- opcode_chars[c] = c;
- register_chars[c] = c;
- } else if (isupper(c)) {
- opcode_chars[c] = tolower(c);
- register_chars[c] = opcode_chars[c];
- } else if (c == PREFIX_SEPERATOR) {
- opcode_chars[c] = c;
- } else if (c == ')' || c == '(') {
- register_chars[c] = c;
- }
-
- if (isupper(c) || islower(c) || isdigit(c))
- operand_chars[c] = c;
- else if (c && index(operand_special_chars, c))
- operand_chars[c] = c;
-
- if (isdigit(c) || c == '-') digit_chars[c] = c;
-
- if (isalpha(c) || c == '_' || c == '.' || isdigit(c))
- identifier_chars[c] = c;
-
- if (c == ' ' || c == '\t') space_chars[c] = c;
- }
- }
-}
-
-void md_end() {} /* not much to do here. */
-
-
-#ifdef DEBUG386
-
-/* debugging routines for md_assemble */
-static void pi (), pte (), pt (), pe (), ps ();
-
-static void pi (line, x)
- char * line;
- i386_insn *x;
-{
- register template *p;
- int i;
-
- fprintf (stdout, "%s: template ", line);
- pte (&x->tm);
- fprintf (stdout, " modrm: mode %x reg %x reg/mem %x",
- x->rm.mode, x->rm.reg, x->rm.regmem);
- fprintf (stdout, " base %x index %x scale %x\n",
- x->bi.base, x->bi.index, x->bi.scale);
- for (i = 0; i < x->operands; i++) {
- fprintf (stdout, " #%d: ", i+1);
- pt (x->types[i]);
- fprintf (stdout, "\n");
- if (x->types[i] & Reg) fprintf (stdout, "%s\n", x->regs[i]->reg_name);
- if (x->types[i] & Imm) pe (x->imms[i]);
- if (x->types[i] & (Disp|Abs)) pe (x->disps[i]);
- }
-}
-
-static void pte (t)
- template *t;
-{
- int i;
- fprintf (stdout, " %d operands ", t->operands);
- fprintf (stdout, "opcode %x ",
- t->base_opcode);
- if (t->extension_opcode != None)
- fprintf (stdout, "ext %x ", t->extension_opcode);
- if (t->opcode_modifier&D)
- fprintf (stdout, "D");
- if (t->opcode_modifier&W)
- fprintf (stdout, "W");
- fprintf (stdout, "\n");
- for (i = 0; i < t->operands; i++) {
- fprintf (stdout, " #%d type ", i+1);
- pt (t->operand_types[i]);
- fprintf (stdout, "\n");
- }
-}
-
-char *seg_names[] = {
-"SEG_ABSOLUTE", "SEG_TEXT", "SEG_DATA", "SEG_BSS", "SEG_UNKNOWN",
-"SEG_NONE", "SEG_PASS1", "SEG_GOOF", "SEG_BIG", "SEG_DIFFERENCE" };
-
-static void pe (e)
- expressionS *e;
-{
- fprintf (stdout, " segment %s\n", seg_names[(int) e->X_seg]);
- fprintf (stdout, " add_number %d (%x)\n",
- e->X_add_number, e->X_add_number);
- if (e->X_add_symbol) {
- fprintf (stdout, " add_symbol ");
- ps (e->X_add_symbol);
- fprintf (stdout, "\n");
- }
- if (e->X_subtract_symbol) {
- fprintf (stdout, " sub_symbol ");
- ps (e->X_subtract_symbol);
- fprintf (stdout, "\n");
- }
-}
-
-#define SYMBOL_TYPE(t) \
- (((t&N_TYPE) == N_UNDF) ? "UNDEFINED" : \
- (((t&N_TYPE) == N_ABS) ? "ABSOLUTE" : \
- (((t&N_TYPE) == N_TEXT) ? "TEXT" : \
- (((t&N_TYPE) == N_DATA) ? "DATA" : \
- (((t&N_TYPE) == N_BSS) ? "BSS" : "Bad n_type!")))))
-
-static void ps (s)
- symbolS *s;
-{
- fprintf (stdout, "%s type %s%s",
- s->sy_nlist.n_un.n_name,
- (s->sy_nlist.n_type&N_EXT) ? "EXTERNAL " : "",
- SYMBOL_TYPE (s->sy_nlist.n_type));
-}
-
-struct type_name {
- uint mask;
- char *tname;
-} type_names[] = {
- { Reg8, "r8" }, { Reg16, "r16" }, { Reg32, "r32" }, { Imm8, "i8" },
- { Imm8S, "i8s" },
- { Imm16, "i16" }, { Imm32, "i32" }, { Mem8, "Mem8"}, { Mem16, "Mem16"},
- { Mem32, "Mem32"}, { BaseIndex, "BaseIndex" },
- { Abs8, "Abs8" }, { Abs16, "Abs16" }, { Abs32, "Abs32" },
- { Disp8, "d8" }, { Disp16, "d16" },
- { Disp32, "d32" }, { SReg2, "SReg2" }, { SReg3, "SReg3" }, { Acc, "Acc" },
- { InOutPortReg, "InOutPortReg" }, { ShiftCount, "ShiftCount" },
- { Imm1, "i1" }, { Control, "control reg" }, {Test, "test reg"},
- { FloatReg, "FReg"}, {FloatAcc, "FAcc"},
- { JumpAbsolute, "Jump Absolute"},
- { 0, "" }
-};
-
-static void pt (t)
- uint t;
-{
- register struct type_name *ty;
-
- if (t == Unknown) {
- fprintf (stdout, "Unknown");
- } else {
- for (ty = type_names; ty->mask; ty++)
- if (t & ty->mask) fprintf (stdout, "%s, ", ty->tname);
- }
- fflush (stdout);
-}
-
-#endif /* DEBUG386 */
-
-/*
- This is the guts of the machine-dependent assembler. LINE points to a
- machine dependent instruction. This funciton is supposed to emit
- the frags/bytes it assembles to.
- */
-void md_assemble (line)
- char *line;
-{
- /* Holds temlate once we've found it. */
- register template * t;
-
- /* Possible templates for current insn */
- templates *current_templates = (templates *) 0;
-
- /* Initialize globals. */
- bzero (&i, sizeof(i));
- bzero (disp_expressions, sizeof(disp_expressions));
- bzero (im_expressions, sizeof(im_expressions));
- save_stack_p = save_stack; /* reset stack pointer */
-
- /* Fist parse an opcode & call i386_operand for the operands.
- We assume that the scrubber has arranged it so that line[0] is the valid
- start of a (possibly prefixed) opcode. */
- {
- register char *l = line; /* Fast place to put LINE. */
-
- /* TRUE if operand is pending after ','. */
- uint expecting_operand = 0;
- /* TRUE if we found a prefix only acceptable with string insns. */
- uint expecting_string_instruction = 0;
- /* Non-zero if operand parens not balenced. */
- uint paren_not_balenced;
- char * token_start = l;
-
- while (! is_space_char(*l) && *l != END_OF_INSN) {
- if (! is_opcode_char(*l)) {
- as_bad ("invalid character %s in opcode", output_invalid(*l));
- return;
- } else if (*l != PREFIX_SEPERATOR) {
- *l = opcode_chars[(unsigned char) *l]; /* fold case of opcodes */
- l++;
- } else { /* this opcode's got a prefix */
- register int q;
- register prefix_entry * prefix;
-
- if (l == token_start) {
- as_bad ("expecting prefix; got nothing");
- return;
- }
- END_STRING_AND_SAVE (l);
- prefix = (prefix_entry *) hash_find (prefix_hash, token_start);
- if (! prefix) {
- as_bad ("no such opcode prefix ('%s')", token_start);
- return;
- }
- RESTORE_END_STRING (l);
- /* check for repeated prefix */
- for (q = 0; q < i.prefixes; q++)
- if (i.prefix[q] == prefix->prefix_code) {
- as_bad ("same prefix used twice; you don't really want this!");
- return;
- }
- if (i.prefixes == MAX_PREFIXES) {
- as_bad ("too many opcode prefixes");
- return;
- }
- i.prefix[i.prefixes++] = prefix->prefix_code;
- if (prefix->prefix_code == REPE || prefix->prefix_code == REPNE)
- expecting_string_instruction = TRUE;
- /* skip past PREFIX_SEPERATOR and reset token_start */
- token_start = ++l;
- }
- }
- END_STRING_AND_SAVE (l);
- if (token_start == l) {
- as_bad ("expecting opcode; got nothing");
- return;
- }
-
- /* Lookup insn in hash; try intel & att naming conventions if appropriate;
- that is: we only use the opcode suffix 'b' 'w' or 'l' if we need to. */
- current_templates = (templates *) hash_find (op_hash, token_start);
- if (! current_templates) {
- int last_index = strlen(token_start) - 1;
- char last_char = token_start[last_index];
- switch (last_char) {
- case DWORD_OPCODE_SUFFIX:
- case WORD_OPCODE_SUFFIX:
- case BYTE_OPCODE_SUFFIX:
- token_start[last_index] = '\0';
- current_templates = (templates *) hash_find (op_hash, token_start);
- token_start[last_index] = last_char;
- i.suffix = last_char;
- }
- if (!current_templates) {
- as_bad ("no such 386 instruction: `%s'", token_start); return;
- }
- }
- RESTORE_END_STRING (l);
-
- /* check for rep/repne without a string instruction */
- if (expecting_string_instruction &&
- ! IS_STRING_INSTRUCTION (current_templates->
- start->base_opcode)) {
- as_bad ("expecting string instruction after rep/repne");
- return;
- }
-
- /* There may be operands to parse. */
- if (*l != END_OF_INSN &&
- /* For string instructions, we ignore any operands if given. This
- kludges, for example, 'rep/movsb %ds:(%esi), %es:(%edi)' where
- the operands are always going to be the same, and are not really
- encoded in machine code. */
- ! IS_STRING_INSTRUCTION (current_templates->
- start->base_opcode)) {
- /* parse operands */
- do {
- /* skip optional white space before operand */
- while (! is_operand_char(*l) && *l != END_OF_INSN) {
- if (! is_space_char(*l)) {
- as_bad ("invalid character %s before %s operand",
- output_invalid(*l),
- ordinal_names[i.operands]);
- return;
- }
- l++;
- }
- token_start = l; /* after white space */
- paren_not_balenced = 0;
- while (paren_not_balenced || *l != ',') {
- if (*l == END_OF_INSN) {
- if (paren_not_balenced) {
- as_bad ("unbalenced parenthesis in %s operand.",
- ordinal_names[i.operands]);
- return;
- } else break; /* we are done */
- } else if (! is_operand_char(*l)) {
- as_bad ("invalid character %s in %s operand",
- output_invalid(*l),
- ordinal_names[i.operands]);
- return;
- }
- if (*l == '(') ++paren_not_balenced;
- if (*l == ')') --paren_not_balenced;
- l++;
- }
- if (l != token_start) { /* yes, we've read in another operand */
- uint operand_ok;
- this_operand = i.operands++;
- if (i.operands > MAX_OPERANDS) {
- as_bad ("spurious operands; (%d operands/instruction max)",
- MAX_OPERANDS);
- return;
- }
- /* now parse operand adding info to 'i' as we go along */
- END_STRING_AND_SAVE (l);
- operand_ok = i386_operand (token_start);
- RESTORE_END_STRING (l); /* restore old contents */
- if (!operand_ok) return;
- } else {
- if (expecting_operand) {
- expecting_operand_after_comma:
- as_bad ("expecting operand after ','; got nothing");
- return;
- }
- if (*l == ',') {
- as_bad ("expecting operand before ','; got nothing");
- return;
- }
- }
-
- /* now *l must be either ',' or END_OF_INSN */
- if (*l == ',') {
- if (*++l == END_OF_INSN) { /* just skip it, if it's \n complain */
- goto expecting_operand_after_comma;
- }
- expecting_operand = TRUE;
- }
- } while (*l != END_OF_INSN); /* until we get end of insn */
- }
- }
-
- /* Now we've parsed the opcode into a set of templates, and have the
- operands at hand.
- Next, we find a template that matches the given insn,
- making sure the overlap of the given operands types is consistent
- with the template operand types. */
-
-#define MATCH(overlap,given_type) \
- (overlap && \
- (overlap & (JumpAbsolute|BaseIndex|Mem8)) \
- == (given_type & (JumpAbsolute|BaseIndex|Mem8)))
-
- /* If m0 and m1 are register matches they must be consistent
- with the expected operand types t0 and t1.
- That is, if both m0 & m1 are register matches
- i.e. ( ((m0 & (Reg)) && (m1 & (Reg)) ) ?
- then, either 1. or 2. must be true:
- 1. the expected operand type register overlap is null:
- (t0 & t1 & Reg) == 0
- AND
- the given register overlap is null:
- (m0 & m1 & Reg) == 0
- 2. the expected operand type register overlap == the given
- operand type overlap: (t0 & t1 & m0 & m1 & Reg).
- */
-#define CONSISTENT_REGISTER_MATCH(m0, m1, t0, t1) \
- ( ((m0 & (Reg)) && (m1 & (Reg))) ? \
- ( ((t0 & t1 & (Reg)) == 0 && (m0 & m1 & (Reg)) == 0) || \
- ((t0 & t1) & (m0 & m1) & (Reg)) \
- ) : 1)
- {
- register uint overlap0, overlap1;
- expressionS * exp;
- uint overlap2;
- uint found_reverse_match;
-
- overlap0 = overlap1 = overlap2 = found_reverse_match = 0;
- for (t = current_templates->start;
- t < current_templates->end;
- t++) {
-
- /* must have right number of operands */
- if (i.operands != t->operands) continue;
- else if (!t->operands) break; /* 0 operands always matches */
-
- overlap0 = i.types[0] & t->operand_types[0];
- switch (t->operands) {
- case 1:
- if (! MATCH (overlap0,i.types[0])) continue;
- break;
- case 2: case 3:
- overlap1 = i.types[1] & t->operand_types[1];
- if (! MATCH (overlap0,i.types[0]) ||
- ! MATCH (overlap1,i.types[1]) ||
- ! CONSISTENT_REGISTER_MATCH(overlap0, overlap1,
- t->operand_types[0],
- t->operand_types[1])) {
-
- /* check if other direction is valid ... */
- if (! (t->opcode_modifier & COMES_IN_BOTH_DIRECTIONS))
- continue;
-
- /* try reversing direction of operands */
- overlap0 = i.types[0] & t->operand_types[1];
- overlap1 = i.types[1] & t->operand_types[0];
- if (! MATCH (overlap0,i.types[0]) ||
- ! MATCH (overlap1,i.types[1]) ||
- ! CONSISTENT_REGISTER_MATCH (overlap0, overlap1,
- t->operand_types[0],
- t->operand_types[1])) {
- /* does not match either direction */
- continue;
- }
- /* found a reverse match here -- slip through */
- /* found_reverse_match holds which of D or FloatD we've found */
- found_reverse_match = t->opcode_modifier & COMES_IN_BOTH_DIRECTIONS;
- } /* endif: not forward match */
- /* found either forward/reverse 2 operand match here */
- if (t->operands == 3) {
- overlap2 = i.types[2] & t->operand_types[2];
- if (! MATCH (overlap2,i.types[2]) ||
- ! CONSISTENT_REGISTER_MATCH (overlap0, overlap2,
- t->operand_types[0],
- t->operand_types[2]) ||
- ! CONSISTENT_REGISTER_MATCH (overlap1, overlap2,
- t->operand_types[1],
- t->operand_types[2]))
- continue;
- }
- /* found either forward/reverse 2 or 3 operand match here:
- slip through to break */
- }
- break; /* we've found a match; break out of loop */
- } /* for (t = ... */
- if (t == current_templates->end) { /* we found no match */
- as_bad ("operands given don't match any known 386 instruction");
- return;
- }
-
- /* Copy the template we found (we may change it!). */
- bcopy (t, &i.tm, sizeof (template));
- t = &i.tm; /* alter new copy of template */
-
- /* If there's no opcode suffix we try to invent one based on register
- operands. */
- if (! i.suffix && i.reg_operands) {
- /* We take i.suffix from the LAST register operand specified. This
- assumes that the last register operands is the destination register
- operand. */
- int o;
- for (o = 0; o < MAX_OPERANDS; o++)
- if (i.types[o] & Reg) {
- i.suffix = (i.types[o] == Reg8) ? BYTE_OPCODE_SUFFIX :
- (i.types[o] == Reg16) ? WORD_OPCODE_SUFFIX :
- DWORD_OPCODE_SUFFIX;
- }
- }
-
- /* Make still unresolved immediate matches conform to size of immediate
- given in i.suffix. Note: overlap2 cannot be an immediate!
- We assume this. */
- if ((overlap0 & (Imm8|Imm8S|Imm16|Imm32))
- && overlap0 != Imm8 && overlap0 != Imm8S
- && overlap0 != Imm16 && overlap0 != Imm32) {
- if (! i.suffix) {
- as_bad ("no opcode suffix given; can't determine immediate size");
- return;
- }
- overlap0 &= (i.suffix == BYTE_OPCODE_SUFFIX ? (Imm8|Imm8S) :
- (i.suffix == WORD_OPCODE_SUFFIX ? Imm16 : Imm32));
- }
- if ((overlap1 & (Imm8|Imm8S|Imm16|Imm32))
- && overlap1 != Imm8 && overlap1 != Imm8S
- && overlap1 != Imm16 && overlap1 != Imm32) {
- if (! i.suffix) {
- as_bad ("no opcode suffix given; can't determine immediate size");
- return;
- }
- overlap1 &= (i.suffix == BYTE_OPCODE_SUFFIX ? (Imm8|Imm8S) :
- (i.suffix == WORD_OPCODE_SUFFIX ? Imm16 : Imm32));
- }
-
- i.types[0] = overlap0;
- i.types[1] = overlap1;
- i.types[2] = overlap2;
-
- if (overlap0 & ImplicitRegister) i.reg_operands--;
- if (overlap1 & ImplicitRegister) i.reg_operands--;
- if (overlap2 & ImplicitRegister) i.reg_operands--;
- if (overlap0 & Imm1) i.imm_operands = 0; /* kludge for shift insns */
-
- if (found_reverse_match) {
- uint save;
- save = t->operand_types[0];
- t->operand_types[0] = t->operand_types[1];
- t->operand_types[1] = save;
- }
-
- /* Finalize opcode. First, we change the opcode based on the operand
- size given by i.suffix: we never have to change things for byte insns,
- or when no opcode suffix is need to size the operands. */
-
- if (! i.suffix && (t->opcode_modifier & W)) {
- as_bad ("no opcode suffix given and no register operands; can't size instruction");
- return;
- }
-
- if (i.suffix && i.suffix != BYTE_OPCODE_SUFFIX) {
- /* Select between byte and word/dword operations. */
- if (t->opcode_modifier & W)
- t->base_opcode |= W;
- /* Now select between word & dword operations via the
- operand size prefix. */
- if (i.suffix == WORD_OPCODE_SUFFIX) {
- if (i.prefixes == MAX_PREFIXES) {
- as_bad ("%d prefixes given and 'w' opcode suffix gives too many prefixes",
- MAX_PREFIXES);
- return;
- }
- i.prefix[i.prefixes++] = WORD_PREFIX_OPCODE;
- }
- }
-
- /* For insns with operands there are more diddles to do to the opcode. */
- if (i.operands) {
- /* If we found a reverse match we must alter the opcode direction bit
- found_reverse_match holds bit to set (different for int &
- float insns). */
-
- if (found_reverse_match) {
- t->base_opcode |= found_reverse_match;
- }
-
- /*
- The imul $imm, %reg instruction is converted into
- imul $imm, %reg, %reg. */
- if (t->opcode_modifier & imulKludge) {
- i.regs[2] = i.regs[1]; /* Pretend we saw the 3 operand case. */
- i.reg_operands = 2;
- }
-
- /* Certain instructions expect the destination to be in the i.rm.reg
- field. This is by far the exceptional case. For these instructions,
- if the source operand is a register, we must reverse the i.rm.reg
- and i.rm.regmem fields. We accomplish this by faking that the
- two register operands were given in the reverse order. */
- if ((t->opcode_modifier & ReverseRegRegmem) && i.reg_operands == 2) {
- uint first_reg_operand = (i.types[0] & Reg) ? 0 : 1;
- uint second_reg_operand = first_reg_operand + 1;
- reg_entry *tmp = i.regs[first_reg_operand];
- i.regs[first_reg_operand] = i.regs[second_reg_operand];
- i.regs[second_reg_operand] = tmp;
- }
-
- if (t->opcode_modifier & ShortForm) {
- /* The register or float register operand is in operand 0 or 1. */
- uint o = (i.types[0] & (Reg|FloatReg)) ? 0 : 1;
- /* Register goes in low 3 bits of opcode. */
- t->base_opcode |= i.regs[o]->reg_num;
- } else if (t->opcode_modifier & ShortFormW) {
- /* Short form with 0x8 width bit. Register is always dest. operand */
- t->base_opcode |= i.regs[1]->reg_num;
- if (i.suffix == WORD_OPCODE_SUFFIX ||
- i.suffix == DWORD_OPCODE_SUFFIX)
- t->base_opcode |= 0x8;
- } else if (t->opcode_modifier & Seg2ShortForm) {
- if (t->base_opcode == POP_SEG_SHORT && i.regs[0]->reg_num == 1) {
- as_bad ("you can't 'pop cs' on the 386.");
- return;
- }
- t->base_opcode |= (i.regs[0]->reg_num << 3);
- } else if (t->opcode_modifier & Seg3ShortForm) {
- /* 'push %fs' is 0x0fa0; 'pop %fs' is 0x0fa1.
- 'push %gs' is 0x0fa8; 'pop %fs' is 0x0fa9.
- So, only if i.regs[0]->reg_num == 5 (%gs) do we need
- to change the opcode. */
- if (i.regs[0]->reg_num == 5)
- t->base_opcode |= 0x08;
- } else if (t->opcode_modifier & Modrm) {
- /* The opcode is completed (modulo t->extension_opcode which must
- be put into the modrm byte.
- Now, we make the modrm & index base bytes based on all the info
- we've collected. */
-
- /* i.reg_operands MUST be the number of real register operands;
- implicit registers do not count. */
- if (i.reg_operands == 2) {
- uint source, dest;
- source = (i.types[0] & (Reg|SReg2|SReg3|Control|Debug|Test)) ? 0 : 1;
- dest = source + 1;
- i.rm.mode = 3;
- /* We must be careful to make sure that all segment/control/test/
- debug registers go into the i.rm.reg field (despite the whether
- they are source or destination operands). */
- if (i.regs[dest]->reg_type & (SReg2|SReg3|Control|Debug|Test)) {
- i.rm.reg = i.regs[dest]->reg_num;
- i.rm.regmem = i.regs[source]->reg_num;
- } else {
- i.rm.reg = i.regs[source]->reg_num;
- i.rm.regmem = i.regs[dest]->reg_num;
- }
- } else { /* if it's not 2 reg operands... */
- if (i.mem_operands) {
- uint fake_zero_displacement = FALSE;
- uint o = (i.types[0] & Mem) ? 0 : ((i.types[1] & Mem) ? 1 : 2);
-
- /* Encode memory operand into modrm byte and base index byte. */
-
- if (i.base_reg == esp && ! i.index_reg) {
- /* <disp>(%esp) becomes two byte modrm with no index register. */
- i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING;
- i.rm.mode = MODE_FROM_DISP_SIZE (i.types[o]);
- i.bi.base = ESP_REG_NUM;
- i.bi.index = NO_INDEX_REGISTER;
- i.bi.scale = 0; /* Must be zero! */
- } else if (i.base_reg == ebp && !i.index_reg) {
- if (! (i.types[o] & Disp)) {
- /* Must fake a zero byte displacement.
- There is no direct way to code '(%ebp)' directly. */
- fake_zero_displacement = TRUE;
- /* fake_zero_displacement code does not set this. */
- i.types[o] |= Disp8;
- }
- i.rm.mode = MODE_FROM_DISP_SIZE (i.types[o]);
- i.rm.regmem = EBP_REG_NUM;
- } else if (! i.base_reg && (i.types[o] & BaseIndex)) {
- /* There are three cases here.
- Case 1: '<32bit disp>(,1)' -- indirect absolute.
- (Same as cases 2 & 3 with NO index register)
- Case 2: <32bit disp> (,<index>) -- no base register with disp
- Case 3: (, <index>) --- no base register;
- no disp (must add 32bit 0 disp). */
- i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING;
- i.rm.mode = 0; /* 32bit mode */
- i.bi.base = NO_BASE_REGISTER;
- i.types[o] &= ~Disp;
- i.types[o] |= Disp32; /* Must be 32bit! */
- if (i.index_reg) { /* case 2 or case 3 */
- i.bi.index = i.index_reg->reg_num;
- i.bi.scale = i.log2_scale_factor;
- if (i.disp_operands == 0)
- fake_zero_displacement = TRUE; /* case 3 */
- } else {
- i.bi.index = NO_INDEX_REGISTER;
- i.bi.scale = 0;
- }
- } else if (i.disp_operands && !i.base_reg && !i.index_reg) {
- /* Operand is just <32bit disp> */
- i.rm.regmem = EBP_REG_NUM;
- i.rm.mode = 0;
- i.types[o] &= ~Disp;
- i.types[o] |= Disp32;
- } else {
- /* It's not a special case; rev'em up. */
- i.rm.regmem = i.base_reg->reg_num;
- i.rm.mode = MODE_FROM_DISP_SIZE (i.types[o]);
- if (i.index_reg) {
- i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING;
- i.bi.base = i.base_reg->reg_num;
- i.bi.index = i.index_reg->reg_num;
- i.bi.scale = i.log2_scale_factor;
- if (i.base_reg == ebp && i.disp_operands == 0) { /* pace */
- fake_zero_displacement = TRUE;
- i.types[o] |= Disp8;
- i.rm.mode = MODE_FROM_DISP_SIZE (i.types[o]);
- }
- }
- }
- if (fake_zero_displacement) {
- /* Fakes a zero displacement assuming that i.types[o] holds
- the correct displacement size. */
- exp = &disp_expressions[i.disp_operands++];
- i.disps[o] = exp;
- exp->X_seg = SEG_ABSOLUTE;
- exp->X_add_number = 0;
- exp->X_add_symbol = (symbolS *) 0;
- exp->X_subtract_symbol = (symbolS *) 0;
- }
-
- /* Select the correct segment for the memory operand. */
- if (i.seg) {
- uint seg_index;
- seg_entry * default_seg;
-
- if (i.rm.regmem == ESCAPE_TO_TWO_BYTE_ADDRESSING) {
- seg_index = (i.rm.mode<<3) | i.bi.base;
- default_seg = two_byte_segment_defaults [seg_index];
- } else {
- seg_index = (i.rm.mode<<3) | i.rm.regmem;
- default_seg = one_byte_segment_defaults [seg_index];
- }
- /* If the specified segment is not the default, use an
- opcode prefix to select it */
- if (i.seg != default_seg) {
- if (i.prefixes == MAX_PREFIXES) {
- as_bad ("%d prefixes given and %s segment override gives too many prefixes",
- MAX_PREFIXES, i.seg->seg_name);
- return;
- }
- i.prefix[i.prefixes++] = i.seg->seg_prefix;
- }
- }
- }
-
- /* Fill in i.rm.reg or i.rm.regmem field with register operand
- (if any) based on t->extension_opcode. Again, we must be careful
- to make sure that segment/control/debug/test registers are coded
- into the i.rm.reg field. */
- if (i.reg_operands) {
- uint o =
- (i.types[0] & (Reg|SReg2|SReg3|Control|Debug|Test)) ? 0 :
- (i.types[1] & (Reg|SReg2|SReg3|Control|Debug|Test)) ? 1 : 2;
- /* If there is an extension opcode to put here, the register number
- must be put into the regmem field. */
- if (t->extension_opcode != None)
- i.rm.regmem = i.regs[o]->reg_num;
- else i.rm.reg = i.regs[o]->reg_num;
-
- /* Now, if no memory operand has set i.rm.mode = 0, 1, 2
- we must set it to 3 to indicate this is a register operand
- int the regmem field */
- if (! i.mem_operands) i.rm.mode = 3;
- }
-
- /* Fill in i.rm.reg field with extension opcode (if any). */
- if (t->extension_opcode != None)
- i.rm.reg = t->extension_opcode;
- }
- }
- }
- }
-
- /* Handle conversion of 'int $3' --> special int3 insn. */
- if (t->base_opcode == INT_OPCODE && i.imms[0]->X_add_number == 3) {
- t->base_opcode = INT3_OPCODE;
- i.imm_operands = 0;
- }
-
- /* We are ready to output the insn. */
- {
- register char * p;
-
- /* Output jumps. */
- if (t->opcode_modifier & Jump) {
- int n = i.disps[0]->X_add_number;
-
- switch (i.disps[0]->X_seg) {
- case SEG_ABSOLUTE:
- if (FITS_IN_SIGNED_BYTE (n)) {
- p = frag_more (2);
- p[0] = t->base_opcode;
- p[1] = n;
-#if 0 /* leave out 16 bit jumps - pace */
- } else if (FITS_IN_SIGNED_WORD (n)) {
- p = frag_more (4);
- p[0] = WORD_PREFIX_OPCODE;
- p[1] = t->base_opcode;
- md_number_to_chars (&p[2], n, 2);
-#endif
- } else { /* It's an absolute dword displacement. */
- if (t->base_opcode == JUMP_PC_RELATIVE) { /* pace */
- /* unconditional jump */
- p = frag_more (5);
- p[0] = 0xe9;
- md_number_to_chars (&p[1], n, 4);
- } else {
- /* conditional jump */
- p = frag_more (6);
- p[0] = TWO_BYTE_OPCODE_ESCAPE;
- p[1] = t->base_opcode + 0x10;
- md_number_to_chars (&p[2], n, 4);
- }
- }
- break;
- default:
- /* It's a symbol; end frag & setup for relax.
- Make sure there are 6 chars left in the current frag; if not
- we'll have to start a new one. */
- /* I caught it failing with obstack_room == 6,
- so I changed to <= pace */
- if (obstack_room (&frags) <= 6) {
- frag_wane(frag_now);
- frag_new (0);
- }
- p = frag_more (1);
- p[0] = t->base_opcode;
- frag_var (rs_machine_dependent,
- 6, /* 2 opcode/prefix + 4 displacement */
- 1,
- ((uchar) *p == JUMP_PC_RELATIVE
- ? ENCODE_RELAX_STATE (UNCOND_JUMP, BYTE)
- : ENCODE_RELAX_STATE (COND_JUMP, BYTE)),
- i.disps[0]->X_add_symbol,
- n, p);
- break;
- }
- } else if (t->opcode_modifier & (JumpByte|JumpDword)) {
- int size = (t->opcode_modifier & JumpByte) ? 1 : 4;
- int n = i.disps[0]->X_add_number;
-
- if (FITS_IN_UNSIGNED_BYTE(t->base_opcode)) {
- FRAG_APPEND_1_CHAR (t->base_opcode);
- } else {
- p = frag_more (2); /* opcode can be at most two bytes */
- /* put out high byte first: can't use md_number_to_chars! */
- *p++ = (t->base_opcode >> 8) & 0xff;
- *p = t->base_opcode & 0xff;
- }
-
- p = frag_more (size);
- switch (i.disps[0]->X_seg) {
- case SEG_ABSOLUTE:
- md_number_to_chars (p, n, size);
- if (size == 1 && ! FITS_IN_SIGNED_BYTE (n)) {
- as_bad ("loop/jecx only takes byte displacement; %d shortened to %d",
- n, *p);
- }
- break;
- default:
- fix_new (frag_now, p - frag_now->fr_literal, size,
- i.disps[0]->X_add_symbol, i.disps[0]->X_subtract_symbol,
- i.disps[0]->X_add_number, 1);
- break;
- }
- } else if (t->opcode_modifier & JumpInterSegment) {
- p = frag_more (1 + 2 + 4); /* 1 opcode; 2 segment; 4 offset */
- p[0] = t->base_opcode;
- if (i.imms[1]->X_seg == SEG_ABSOLUTE)
- md_number_to_chars (p + 1, i.imms[1]->X_add_number, 4);
- else
- fix_new (frag_now, p + 1 - frag_now->fr_literal, 4,
- i.imms[1]->X_add_symbol,
- i.imms[1]->X_subtract_symbol,
- i.imms[1]->X_add_number, 0);
- if (i.imms[0]->X_seg != SEG_ABSOLUTE)
- as_bad ("can't handle non absolute segment in long call/jmp");
- md_number_to_chars (p + 5, i.imms[0]->X_add_number, 2);
- } else {
- /* Output normal instructions here. */
- register char *q;
-
- /* First the prefix bytes. */
- for (q = i.prefix; q < i.prefix + i.prefixes; q++) {
- p = frag_more (1);
- md_number_to_chars (p, (uint) *q, 1);
- }
-
- /* Now the opcode; be careful about word order here! */
- if (FITS_IN_UNSIGNED_BYTE(t->base_opcode)) {
- FRAG_APPEND_1_CHAR (t->base_opcode);
- } else if (FITS_IN_UNSIGNED_WORD(t->base_opcode)) {
- p = frag_more (2);
- /* put out high byte first: can't use md_number_to_chars! */
- *p++ = (t->base_opcode >> 8) & 0xff;
- *p = t->base_opcode & 0xff;
- } else { /* opcode is either 3 or 4 bytes */
- if (t->base_opcode & 0xff000000) {
- p = frag_more (4);
- *p++ = (t->base_opcode >> 24) & 0xff;
- } else p = frag_more (3);
- *p++ = (t->base_opcode >> 16) & 0xff;
- *p++ = (t->base_opcode >> 8) & 0xff;
- *p = (t->base_opcode ) & 0xff;
- }
-
- /* Now the modrm byte and base index byte (if present). */
- if (t->opcode_modifier & Modrm) {
- p = frag_more (1);
- /* md_number_to_chars (p, i.rm, 1); */
- md_number_to_chars (p, (i.rm.regmem<<0 | i.rm.reg<<3 | i.rm.mode<<6), 1);
- /* If i.rm.regmem == ESP (4) && i.rm.mode != Mode 3 (Register mode)
- ==> need second modrm byte. */
- if (i.rm.regmem == ESCAPE_TO_TWO_BYTE_ADDRESSING && i.rm.mode != 3) {
- p = frag_more (1);
- /* md_number_to_chars (p, i.bi, 1); */
- md_number_to_chars (p,(i.bi.base<<0 | i.bi.index<<3 | i.bi.scale<<6), 1);
- }
- }
-
- if (i.disp_operands) {
- register int n;
-
- for (n = 0; n < i.operands; n++) {
- if (i.disps[n]) {
- if (i.disps[n]->X_seg == SEG_ABSOLUTE) {
- if (i.types[n] & (Disp8|Abs8)) {
- p = frag_more (1);
- md_number_to_chars (p, i.disps[n]->X_add_number, 1);
- } else if (i.types[n] & (Disp16|Abs16)) {
- p = frag_more (2);
- md_number_to_chars (p, i.disps[n]->X_add_number, 2);
- } else { /* Disp32|Abs32 */
- p = frag_more (4);
- md_number_to_chars (p, i.disps[n]->X_add_number, 4);
- }
- } else { /* not SEG_ABSOLUTE */
- /* need a 32-bit fixup (don't support 8bit non-absolute disps) */
- p = frag_more (4);
- fix_new (frag_now, p - frag_now->fr_literal, 4,
- i.disps[n]->X_add_symbol, i.disps[n]->X_subtract_symbol,
- i.disps[n]->X_add_number, 0);
- }
- }
- }
- } /* end displacement output */
-
- /* output immediate */
- if (i.imm_operands) {
- register int n;
-
- for (n = 0; n < i.operands; n++) {
- if (i.imms[n]) {
- if (i.imms[n]->X_seg == SEG_ABSOLUTE) {
- if (i.types[n] & (Imm8|Imm8S)) {
- p = frag_more (1);
- md_number_to_chars (p, i.imms[n]->X_add_number, 1);
- } else if (i.types[n] & Imm16) {
- p = frag_more (2);
- md_number_to_chars (p, i.imms[n]->X_add_number, 2);
- } else {
- p = frag_more (4);
- md_number_to_chars (p, i.imms[n]->X_add_number, 4);
- }
- } else { /* not SEG_ABSOLUTE */
- /* need a 32-bit fixup (don't support 8bit non-absolute ims) */
- /* try to support other sizes ... */
- int size;
- if (i.types[n] & (Imm8|Imm8S))
- size = 1;
- else if (i.types[n] & Imm16)
- size = 2;
- else
- size = 4;
- p = frag_more (size);
- fix_new (frag_now, p - frag_now->fr_literal, size,
- i.imms[n]->X_add_symbol, i.imms[n]->X_subtract_symbol,
- i.imms[n]->X_add_number, 0);
- }
- }
- }
- } /* end immediate output */
- }
-
-#ifdef DEBUG386
- if (flagseen ['D']) {
- pi (line, &i);
- }
-#endif /* DEBUG386 */
-
- }
- return;
-}
-
-/* Parse OPERAND_STRING into the i386_insn structure I. Returns non-zero
- on error. */
-
-int i386_operand (operand_string)
- char *operand_string;
-{
- register char *op_string = operand_string;
-
- /* Address of '\0' at end of operand_string. */
- char * end_of_operand_string = operand_string + strlen(operand_string);
-
- /* Start and end of displacement string expression (if found). */
- char * displacement_string_start = 0;
- char * displacement_string_end;
-
- /* We check for an absolute prefix (differentiating,
- for example, 'jmp pc_relative_label' from 'jmp *absolute_label'. */
- if (*op_string == ABSOLUTE_PREFIX) {
- op_string++;
- i.types[this_operand] |= JumpAbsolute;
- }
-
- /* Check if operand is a register. */
- if (*op_string == REGISTER_PREFIX) {
- register reg_entry * r;
- if (! (r = parse_register (op_string))) {
- as_bad ("bad register name ('%s')", op_string);
- return 0;
- }
- /* Check for segment override, rather than segment register by
- searching for ':' after %<x>s where <x> = s, c, d, e, f, g. */
- if ((r->reg_type & (SReg2|SReg3)) && op_string[3] == ':') {
- switch (r->reg_num) {
- case 0:
- i.seg = &es; break;
- case 1:
- i.seg = &cs; break;
- case 2:
- i.seg = &ss; break;
- case 3:
- i.seg = &ds; break;
- case 4:
- i.seg = &fs; break;
- case 5:
- i.seg = &gs; break;
- }
- op_string += 4; /* skip % <x> s : */
- operand_string = op_string; /* Pretend given string starts here. */
- if (!is_digit_char(*op_string) && !is_identifier_char(*op_string)
- && *op_string != '(' && *op_string != ABSOLUTE_PREFIX) {
- as_bad ("bad memory operand after segment override");
- return 0;
- }
- /* Handle case of %es:*foo. */
- if (*op_string == ABSOLUTE_PREFIX) {
- op_string++;
- i.types[this_operand] |= JumpAbsolute;
- }
- goto do_memory_reference;
- }
- i.types[this_operand] |= r->reg_type;
- i.regs[this_operand] = r;
- i.reg_operands++;
- } else if (*op_string == IMMEDIATE_PREFIX) { /* ... or an immediate */
- char * save_input_line_pointer;
- register expressionS *exp;
- segT exp_seg;
- if (i.imm_operands == MAX_IMMEDIATE_OPERANDS) {
- as_bad ("only 1 or 2 immediate operands are allowed");
- return 0;
- }
- exp = &im_expressions[i.imm_operands++];
- i.imms [this_operand] = exp;
- save_input_line_pointer = input_line_pointer;
- input_line_pointer = ++op_string; /* must advance op_string! */
- exp_seg = expression (exp);
- input_line_pointer = save_input_line_pointer;
- switch (exp_seg) {
- case SEG_NONE: /* missing or bad expr becomes absolute 0 */
- as_bad ("missing or invalid immediate expression '%s' taken as 0",
- operand_string);
- exp->X_seg = SEG_ABSOLUTE;
- exp->X_add_number = 0;
- exp->X_add_symbol = (symbolS *) 0;
- exp->X_subtract_symbol = (symbolS *) 0;
- i.types[this_operand] |= Imm;
- break;
- case SEG_ABSOLUTE:
- i.types[this_operand] |= SMALLEST_IMM_TYPE (exp->X_add_number);
- break;
- case SEG_TEXT: case SEG_DATA: case SEG_BSS: case SEG_UNKNOWN:
- i.types[this_operand] |= Imm32; /* this is an address ==> 32bit */
- break;
- default:
-seg_unimplemented:
- as_bad ("Unimplemented segment type %d in parse_operand", exp_seg);
- return 0;
- }
- /* shorten this type of this operand if the instruction wants
- * fewer bits than are present in the immediate. The bit field
- * code can put out 'andb $0xffffff, %al', for example. pace
- * also 'movw $foo,(%eax)'
- */
- switch (i.suffix) {
- case WORD_OPCODE_SUFFIX:
- i.types[this_operand] |= Imm16;
- break;
- case BYTE_OPCODE_SUFFIX:
- i.types[this_operand] |= Imm16 | Imm8 | Imm8S;
- break;
- }
- } else if (is_digit_char(*op_string) || is_identifier_char(*op_string)
- || *op_string == '(') {
- /* This is a memory reference of some sort. */
- register char * base_string;
- uint found_base_index_form;
-
- do_memory_reference:
- if (i.mem_operands == MAX_MEMORY_OPERANDS) {
- as_bad ("more than 1 memory reference in instruction");
- return 0;
- }
- i.mem_operands++;
-
- /* Determine type of memory operand from opcode_suffix;
- no opcode suffix implies general memory references. */
- switch (i.suffix) {
- case BYTE_OPCODE_SUFFIX:
- i.types[this_operand] |= Mem8;
- break;
- case WORD_OPCODE_SUFFIX:
- i.types[this_operand] |= Mem16;
- break;
- case DWORD_OPCODE_SUFFIX:
- default:
- i.types[this_operand] |= Mem32;
- }
-
- /* Check for base index form. We detect the base index form by
- looking for an ')' at the end of the operand, searching
- for the '(' matching it, and finding a REGISTER_PREFIX or ','
- after it. */
- base_string = end_of_operand_string - 1;
- found_base_index_form = FALSE;
- if (*base_string == ')') {
- uint parens_balenced = 1;
- /* We've already checked that the number of left & right ()'s are equal,
- so this loop will not be infinite. */
- do {
- base_string--;
- if (*base_string == ')') parens_balenced++;
- if (*base_string == '(') parens_balenced--;
- } while (parens_balenced);
- base_string++; /* Skip past '('. */
- if (*base_string == REGISTER_PREFIX || *base_string == ',')
- found_base_index_form = TRUE;
- }
-
- /* If we can't parse a base index register expression, we've found
- a pure displacement expression. We set up displacement_string_start
- and displacement_string_end for the code below. */
- if (! found_base_index_form) {
- displacement_string_start = op_string;
- displacement_string_end = end_of_operand_string;
- } else {
- char *base_reg_name, *index_reg_name, *num_string;
- int num;
-
- i.types[this_operand] |= BaseIndex;
-
- /* If there is a displacement set-up for it to be parsed later. */
- if (base_string != op_string + 1) {
- displacement_string_start = op_string;
- displacement_string_end = base_string - 1;
- }
-
- /* Find base register (if any). */
- if (*base_string != ',') {
- base_reg_name = base_string++;
- /* skip past register name & parse it */
- while (isalpha(*base_string)) base_string++;
- if (base_string == base_reg_name+1) {
- as_bad ("can't find base register name after '(%c'",
- REGISTER_PREFIX);
- return 0;
- }
- END_STRING_AND_SAVE (base_string);
- if (! (i.base_reg = parse_register (base_reg_name))) {
- as_bad ("bad base register name ('%s')", base_reg_name);
- return 0;
- }
- RESTORE_END_STRING (base_string);
- }
-
- /* Now check seperator; must be ',' ==> index reg
- OR num ==> no index reg. just scale factor
- OR ')' ==> end. (scale factor = 1) */
- if (*base_string != ',' && *base_string != ')') {
- as_bad ("expecting ',' or ')' after base register in `%s'",
- operand_string);
- return 0;
- }
-
- /* There may index reg here; and there may be a scale factor. */
- if (*base_string == ',' && *(base_string+1) == REGISTER_PREFIX) {
- index_reg_name = ++base_string;
- while (isalpha(*++base_string));
- END_STRING_AND_SAVE (base_string);
- if (! (i.index_reg = parse_register(index_reg_name))) {
- as_bad ("bad index register name ('%s')", index_reg_name);
- return 0;
- }
- RESTORE_END_STRING (base_string);
- }
-
- /* Check for scale factor. */
- if (*base_string == ',' && isdigit(*(base_string+1))) {
- num_string = ++base_string;
- while (is_digit_char(*base_string)) base_string++;
- if (base_string == num_string) {
- as_bad ("can't find a scale factor after ','");
- return 0;
- }
- END_STRING_AND_SAVE (base_string);
- /* We've got a scale factor. */
- if (! sscanf (num_string, "%d", &num)) {
- as_bad ("can't parse scale factor from '%s'", num_string);
- return 0;
- }
- RESTORE_END_STRING (base_string);
- switch (num) { /* must be 1 digit scale */
- case 1: i.log2_scale_factor = 0; break;
- case 2: i.log2_scale_factor = 1; break;
- case 4: i.log2_scale_factor = 2; break;
- case 8: i.log2_scale_factor = 3; break;
- default:
- as_bad ("expecting scale factor of 1, 2, 4, 8; got %d", num);
- return 0;
- }
- } else {
- if (! i.index_reg && *base_string == ',') {
- as_bad ("expecting index register or scale factor after ','; got '%c'",
- *(base_string+1));
- return 0;
- }
- }
- }
-
- /* If there's an expression begining the operand, parse it,
- assuming displacement_string_start and displacement_string_end
- are meaningful. */
- if (displacement_string_start) {
- register expressionS * exp;
- segT exp_seg;
- char * save_input_line_pointer;
- exp = &disp_expressions[i.disp_operands];
- i.disps [this_operand] = exp;
- i.disp_operands++;
- save_input_line_pointer = input_line_pointer;
- input_line_pointer = displacement_string_start;
- END_STRING_AND_SAVE (displacement_string_end);
- exp_seg = expression (exp);
- if(*input_line_pointer)
- as_bad("Ignoring junk '%s' after expression",input_line_pointer);
- RESTORE_END_STRING (displacement_string_end);
- input_line_pointer = save_input_line_pointer;
- switch (exp_seg) {
- case SEG_NONE:
- /* missing expr becomes absolute 0 */
- as_bad ("missing or invalid displacement '%s' taken as 0",
- operand_string);
- i.types[this_operand] |= (Disp|Abs);
- exp->X_seg = SEG_ABSOLUTE;
- exp->X_add_number = 0;
- exp->X_add_symbol = (symbolS *) 0;
- exp->X_subtract_symbol = (symbolS *) 0;
- break;
- case SEG_ABSOLUTE:
- i.types[this_operand] |= SMALLEST_DISP_TYPE (exp->X_add_number);
- break;
- case SEG_TEXT: case SEG_DATA: case SEG_BSS:
- case SEG_UNKNOWN: /* must be 32 bit displacement (i.e. address) */
- i.types[this_operand] |= Disp32;
- break;
- default:
- goto seg_unimplemented;
- }
- }
-
- /* Make sure the memory operand we've been dealt is valid. */
- if (i.base_reg && i.index_reg &&
- ! (i.base_reg->reg_type & i.index_reg->reg_type & Reg)) {
- as_bad ("register size mismatch in (base,index,scale) expression");
- return 0;
- }
- if ((i.base_reg && (i.base_reg->reg_type & Reg32) == 0) ||
- (i.index_reg && (i.index_reg->reg_type & Reg32) == 0)) {
- as_bad ("base/index register must be 32 bit register");
- return 0;
- }
- if (i.index_reg && i.index_reg == esp) {
- as_bad ("%s may not be used as an index register", esp->reg_name);
- return 0;
- }
- } else { /* it's not a memory operand; argh! */
- as_bad ("invalid char %s begining %s operand '%s'",
- output_invalid(*op_string), ordinal_names[this_operand],
- op_string);
- return 0;
- }
- return 1; /* normal return */
-}
-
-/*
- * md_estimate_size_before_relax()
- *
- * Called just before relax().
- * Any symbol that is now undefined will not become defined.
- * Return the correct fr_subtype in the frag.
- * Return the initial "guess for fr_var" to caller.
- * The guess for fr_var is ACTUALLY the growth beyond fr_fix.
- * Whatever we do to grow fr_fix or fr_var contributes to our returned value.
- * Although it may not be explicit in the frag, pretend fr_var starts with a
- * 0 value.
- */
-int
-md_estimate_size_before_relax (fragP, segment_type)
- register fragS * fragP;
- register int segment_type; /* N_DATA or N_TEXT. */
-{
- register uchar * opcode;
- register int old_fr_fix;
-
- old_fr_fix = fragP -> fr_fix;
- opcode = (uchar *) fragP -> fr_opcode;
- /* We've already got fragP->fr_subtype right; all we have to do is check
- for un-relaxable symbols. */
- if ((fragP -> fr_symbol -> sy_type & N_TYPE) != segment_type) {
- /* symbol is undefined in this segment */
- switch (opcode[0]) {
- case JUMP_PC_RELATIVE: /* make jmp (0xeb) a dword displacement jump */
- opcode[0] = 0xe9; /* dword disp jmp */
- fragP -> fr_fix += 4;
- fix_new (fragP, old_fr_fix, 4,
- fragP -> fr_symbol,
- (symbolS *) 0,
- fragP -> fr_offset, 1);
- break;
-
- default:
- /* This changes the byte-displacement jump 0x7N -->
- the dword-displacement jump 0x0f8N */
- opcode[1] = opcode[0] + 0x10;
- opcode[0] = TWO_BYTE_OPCODE_ESCAPE; /* two-byte escape */
- fragP -> fr_fix += 1 + 4; /* we've added an opcode byte */
- fix_new (fragP, old_fr_fix + 1, 4,
- fragP -> fr_symbol,
- (symbolS *) 0,
- fragP -> fr_offset, 1);
- break;
- }
- frag_wane (fragP);
- }
- return (fragP -> fr_var + fragP -> fr_fix - old_fr_fix);
-} /* md_estimate_size_before_relax() */
-
-/*
- * md_convert_frag();
- *
- * Called after relax() is finished.
- * In: Address of frag.
- * fr_type == rs_machine_dependent.
- * fr_subtype is what the address relaxed to.
- *
- * Out: Any fixSs and constants are set up.
- * Caller will turn frag into a ".space 0".
- */
-void
-md_convert_frag (fragP)
- register fragS * fragP;
-{
- register uchar * opcode;
- uchar * where_to_put_displacement;
- uint target_address, opcode_address;
- uint extension;
- int displacement_from_opcode_start;
-
- opcode = (uchar *) fragP -> fr_opcode;
-
- /* Address we want to reach in file space. */
- target_address = fragP->fr_symbol->sy_value + fragP->fr_offset;
-
- /* Address opcode resides at in file space. */
- opcode_address = fragP->fr_address + fragP->fr_fix;
-
- /* Displacement from opcode start to fill into instruction. */
- displacement_from_opcode_start = target_address - opcode_address;
-
- switch (fragP->fr_subtype) {
- case ENCODE_RELAX_STATE (COND_JUMP, BYTE):
- case ENCODE_RELAX_STATE (UNCOND_JUMP, BYTE):
- /* don't have to change opcode */
- extension = 1; /* 1 opcode + 1 displacement */
- where_to_put_displacement = &opcode[1];
- break;
-
- case ENCODE_RELAX_STATE (COND_JUMP, WORD):
- opcode[1] = TWO_BYTE_OPCODE_ESCAPE;
- opcode[2] = opcode[0] + 0x10;
- opcode[0] = WORD_PREFIX_OPCODE;
- extension = 4; /* 3 opcode + 2 displacement */
- where_to_put_displacement = &opcode[3];
- break;
-
- case ENCODE_RELAX_STATE (UNCOND_JUMP, WORD):
- opcode[1] = 0xe9;
- opcode[0] = WORD_PREFIX_OPCODE;
- extension = 3; /* 2 opcode + 2 displacement */
- where_to_put_displacement = &opcode[2];
- break;
-
- case ENCODE_RELAX_STATE (COND_JUMP, DWORD):
- opcode[1] = opcode[0] + 0x10;
- opcode[0] = TWO_BYTE_OPCODE_ESCAPE;
- extension = 5; /* 2 opcode + 4 displacement */
- where_to_put_displacement = &opcode[2];
- break;
-
- case ENCODE_RELAX_STATE (UNCOND_JUMP, DWORD):
- opcode[0] = 0xe9;
- extension = 4; /* 1 opcode + 4 displacement */
- where_to_put_displacement = &opcode[1];
- break;
-
- default:
- BAD_CASE(fragP -> fr_subtype);
- break;
- }
- /* now put displacement after opcode */
- md_number_to_chars (where_to_put_displacement,
- displacement_from_opcode_start - extension,
- SIZE_FROM_RELAX_STATE (fragP->fr_subtype));
- fragP -> fr_fix += extension;
-}
-
-
-int md_short_jump_size = 2; /* size of byte displacement jmp */
-int md_long_jump_size = 5; /* size of dword displacement jmp */
-
-void md_create_short_jump(ptr, from_addr, to_addr)
- char *ptr;
- long from_addr, to_addr;
-{
- long offset;
-
- offset = to_addr - (from_addr + 2);
- md_number_to_chars (ptr, (long) 0xeb, 1); /* opcode for byte-disp jump */
- md_number_to_chars (ptr + 1, offset, 1);
-}
-
-void md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
- char *ptr;
- long from_addr, to_addr;
- fragS *frag;
- symbolS *to_symbol;
-{
- long offset;
-
- if (flagseen['m']) {
- offset = to_addr - to_symbol->sy_value;
- md_number_to_chars (ptr, 0xe9, 1); /* opcode for long jmp */
- md_number_to_chars (ptr + 1, offset, 4);
- fix_new (frag, (ptr+1) - frag->fr_literal, 4,
- to_symbol, (symbolS *) 0, (long int) 0, 0);
- } else {
- offset = to_addr - (from_addr + 5);
- md_number_to_chars(ptr, (long) 0xe9, 1);
- md_number_to_chars(ptr + 1, offset, 4);
- }
-}
-
-int
-md_parse_option(argP,cntP,vecP)
-char **argP;
-int *cntP;
-char ***vecP;
-{
- return 1;
-}
-
-void /* Knows about order of bytes in address. */
-md_number_to_chars (con, value, nbytes)
- char con []; /* Return 'nbytes' of chars here. */
- long int value; /* The value of the bits. */
- int nbytes; /* Number of bytes in the output. */
-{
- register char * p = con;
-
- switch (nbytes) {
- case 1:
- p[0] = value & 0xff;
- break;
- case 2:
- p[0] = value & 0xff;
- p[1] = (value >> 8) & 0xff;
- break;
- case 4:
- p[0] = value & 0xff;
- p[1] = (value>>8) & 0xff;
- p[2] = (value>>16) & 0xff;
- p[3] = (value>>24) & 0xff;
- break;
- default:
- BAD_CASE (nbytes);
- }
-}
-
-void /* Knows about order of bytes in address. */
-md_number_to_disp (con, value, nbytes)
- char con []; /* Return 'nbytes' of chars here. */
- long int value; /* The value of the bits. */
- int nbytes; /* Number of bytes in the output. */
-{
- char * answer = alloca (nbytes);
- register char * p = answer;
-
- switch (nbytes) {
- case 1:
- *p = value;
- break;
- case 2:
- *p++ = value;
- *p = (value>>8);
- break;
- case 4:
- *p++ = value;
- *p++ = (value>>8);
- *p++ = (value>>16);
- *p = (value>>24);
- break;
- default:
- BAD_CASE (nbytes);
- }
- bcopy (answer, con, nbytes);
-}
-
-void /* Knows about order of bytes in address. */
-md_number_to_imm (con, value, nbytes)
- char con []; /* Return 'nbytes' of chars here. */
- long int value; /* The value of the bits. */
- int nbytes; /* Number of bytes in the output. */
-{
- char * answer = alloca (nbytes);
- register char * p = answer;
-
- switch (nbytes) {
- case 1:
- *p = value;
- break;
- case 2:
- *p++ = value;
- *p = (value>>8);
- break;
- case 4:
- *p++ = value;
- *p++ = (value>>8);
- *p++ = (value>>16);
- *p = (value>>24);
- break;
- default:
- BAD_CASE (nbytes);
- }
- bcopy (answer, con, nbytes);
-}
-
-void /* Knows about order of bytes in address. */
-md_number_to_field (con, value, nbytes)
- char con []; /* Return 'nbytes' of chars here. */
- long int value; /* The value of the bits. */
- int nbytes; /* Number of bytes in the output. */
-{
- char * answer = alloca (nbytes);
- register char * p = answer;
-
- switch (nbytes) {
- case 1:
- *p = value;
- break;
- case 2:
- *p++ = value;
- *p = (value>>8);
- break;
- case 4:
- *p++ = value;
- *p++ = (value>>8);
- *p++ = (value>>16);
- *p = (value>>24);
- break;
- default:
- BAD_CASE (nbytes);
- }
- bcopy (answer, con, nbytes);
-}
-
-long int /* Knows about the byte order in a word. */
-md_chars_to_number (con, nbytes)
-unsigned char con[]; /* Low order byte 1st. */
- int nbytes; /* Number of bytes in the input. */
-{
- long int retval;
- for (retval=0, con+=nbytes-1; nbytes--; con--)
- {
- retval <<= BITS_PER_CHAR;
- retval |= *con;
- }
- return retval;
-}
-
-void md_ri_to_chars(ri_p, ri)
- struct relocation_info *ri_p, ri;
-{
- unsigned char the_bytes[8];
-
- /* this is easy */
- md_number_to_chars(the_bytes, ri.r_address, sizeof(ri.r_address));
- /* now the fun stuff */
- the_bytes[6] = (ri.r_symbolnum >> 16) & 0x0ff;
- the_bytes[5] = (ri.r_symbolnum >> 8) & 0x0ff;
- the_bytes[4] = ri.r_symbolnum & 0x0ff;
- the_bytes[7] = (((ri.r_extern << 3) & 0x08) | ((ri.r_length << 1) & 0x06) |
- ((ri.r_pcrel << 0) & 0x01)) & 0x0F;
- /* now put it back where you found it */
- bcopy (the_bytes, (char *)ri_p, sizeof(struct relocation_info));
-}
-
-
-#define MAX_LITTLENUMS 6
-
-/* Turn the string pointed to by litP into a floating point constant of type
- type, and emit the appropriate bytes. The number of LITTLENUMS emitted
- is stored in *sizeP . An error message is returned, or NULL on OK.
- */
-char *
-md_atof(type,litP,sizeP)
- char type;
- char *litP;
- int *sizeP;
-{
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- char *t;
- char *atof_ieee();
-
- switch(type) {
- case 'f':
- case 'F':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- prec = 4;
- break;
-
- case 'x':
- case 'X':
- prec = 5;
- break;
-
- default:
- *sizeP=0;
- return "Bad call to md_atof ()";
- }
- t = atof_ieee (input_line_pointer,type,words);
- if(t)
- input_line_pointer=t;
-
- *sizeP = prec * sizeof(LITTLENUM_TYPE);
- /* this loops outputs the LITTLENUMs in REVERSE order; in accord with
- the bigendian 386 */
- for(wordP = words + prec - 1;prec--;) {
- md_number_to_chars (litP, (long) (*wordP--), sizeof(LITTLENUM_TYPE));
- litP += sizeof(LITTLENUM_TYPE);
- }
- return ""; /* Someone should teach Dean about null pointers */
-}
-
-char output_invalid_buf[8];
-
-char * output_invalid (c)
- char c;
-{
- if (isprint(c)) sprintf (output_invalid_buf, "'%c'", c);
- else sprintf (output_invalid_buf, "(0x%x)", c);
- return output_invalid_buf;
-}
-
-reg_entry *parse_register (reg_string)
- char *reg_string; /* reg_string starts *before* REGISTER_PREFIX */
-{
- register char *s = reg_string;
- register char *p;
- char reg_name_given[MAX_REG_NAME_SIZE];
-
- s++; /* skip REGISTER_PREFIX */
- for (p = reg_name_given; is_register_char (*s); p++, s++) {
- *p = register_chars [*s];
- if (p >= reg_name_given + MAX_REG_NAME_SIZE)
- return (reg_entry *) 0;
- }
- *p = '\0';
- return (reg_entry *) hash_find (reg_hash, reg_name_given);
-}
-
diff --git a/gnu/usr.bin/as/config/i386.h b/gnu/usr.bin/as/config/i386.h
deleted file mode 100644
index c569c1c..0000000
--- a/gnu/usr.bin/as/config/i386.h
+++ /dev/null
@@ -1,296 +0,0 @@
-/* i386.h -- Header file for i386.c
- Copyright (C) 1989, Free Software Foundation.
-
-This file is part of GAS, the GNU Assembler.
-
-GAS 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.
-
-GAS 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 GAS; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#define MAX_OPERANDS 3 /* max operands per insn */
-#define MAX_PREFIXES 4 /* max prefixes per opcode */
-#define MAX_IMMEDIATE_OPERANDS 2 /* max immediates per insn */
-#define MAX_MEMORY_OPERANDS 2 /* max memory ref per insn
- * lcall uses 2
- */
-/* we define the syntax here (modulo base,index,scale syntax) */
-#define REGISTER_PREFIX '%'
-#define IMMEDIATE_PREFIX '$'
-#define ABSOLUTE_PREFIX '*'
-#define PREFIX_SEPERATOR '/'
-
-#define TWO_BYTE_OPCODE_ESCAPE 0x0f
-
-/* register numbers */
-#define EBP_REG_NUM 5
-#define ESP_REG_NUM 4
-
-/* modrm_byte.regmem for twobyte escape */
-#define ESCAPE_TO_TWO_BYTE_ADDRESSING ESP_REG_NUM
-/* index_base_byte.index for no index register addressing */
-#define NO_INDEX_REGISTER ESP_REG_NUM
-/* index_base_byte.base for no base register addressing */
-#define NO_BASE_REGISTER EBP_REG_NUM
-
-/* these are the att as opcode suffixes, making movl --> mov, for example */
-#define DWORD_OPCODE_SUFFIX 'l'
-#define WORD_OPCODE_SUFFIX 'w'
-#define BYTE_OPCODE_SUFFIX 'b'
-
-/* modrm.mode = REGMEM_FIELD_HAS_REG when a register is in there */
-#define REGMEM_FIELD_HAS_REG 0x3 /* always = 0x3 */
-#define REGMEM_FIELD_HAS_MEM (~REGMEM_FIELD_HAS_REG)
-
-#define END_OF_INSN '\0'
-
-/*
-When an operand is read in it is classified by its type. This type includes
-all the possible ways an operand can be used. Thus, '%eax' is both 'register
-# 0' and 'The Accumulator'. In our language this is expressed by OR'ing
-'Reg32' (any 32 bit register) and 'Acc' (the accumulator).
-Operands are classified so that we can match given operand types with
-the opcode table in i386-opcode.h.
- */
-#define Unknown 0x0
-/* register */
-#define Reg8 0x1 /* 8 bit reg */
-#define Reg16 0x2 /* 16 bit reg */
-#define Reg32 0x4 /* 32 bit reg */
-#define Reg (Reg8|Reg16|Reg32) /* gen'l register */
-#define WordReg (Reg16|Reg32) /* for push/pop operands */
-/* immediate */
-#define Imm8 0x8 /* 8 bit immediate */
-#define Imm8S 0x10 /* 8 bit immediate sign extended */
-#define Imm16 0x20 /* 16 bit immediate */
-#define Imm32 0x40 /* 32 bit immediate */
-#define Imm1 0x80 /* 1 bit immediate */
-#define ImmUnknown Imm32 /* for unknown expressions */
-#define Imm (Imm8|Imm8S|Imm16|Imm32) /* gen'l immediate */
-/* memory */
-#define Disp8 0x200 /* 8 bit displacement (for jumps) */
-#define Disp16 0x400 /* 16 bit displacement */
-#define Disp32 0x800 /* 32 bit displacement */
-#define Disp (Disp8|Disp16|Disp32) /* General displacement */
-#define DispUnknown Disp32 /* for unknown size displacements */
-#define Mem8 0x1000
-#define Mem16 0x2000
-#define Mem32 0x4000
-#define BaseIndex 0x8000
-#define Mem (Disp|Mem8|Mem16|Mem32|BaseIndex) /* General memory */
-#define WordMem (Mem16|Mem32|Disp|BaseIndex)
-#define ByteMem (Mem8|Disp|BaseIndex)
-/* specials */
-#define InOutPortReg 0x10000 /* register to hold in/out port addr = dx */
-#define ShiftCount 0x20000 /* register to hold shift cound = cl */
-#define Control 0x40000 /* Control register */
-#define Debug 0x80000 /* Debug register */
-#define Test 0x100000 /* Test register */
-#define FloatReg 0x200000 /* Float register */
-#define FloatAcc 0x400000 /* Float stack top %st(0) */
-#define SReg2 0x800000 /* 2 bit segment register */
-#define SReg3 0x1000000 /* 3 bit segment register */
-#define Acc 0x2000000 /* Accumulator %al or %ax or %eax */
-#define ImplicitRegister (InOutPortReg|ShiftCount|Acc|FloatAcc)
-#define JumpAbsolute 0x4000000
-#define Abs8 0x08000000
-#define Abs16 0x10000000
-#define Abs32 0x20000000
-#define Abs (Abs8|Abs16|Abs32)
-
-#define MODE_FROM_DISP_SIZE(t) \
- ((t&(Disp8)) ? 1 : \
- ((t&(Disp32)) ? 2 : 0))
-
-#define Byte (Reg8|Imm8|Imm8S)
-#define Word (Reg16|Imm16)
-#define DWord (Reg32|Imm32)
-
-/* convert opcode suffix ('b' 'w' 'l' typically) into type specifyer */
-#define OPCODE_SUFFIX_TO_TYPE(s) \
- (s == BYTE_OPCODE_SUFFIX ? Byte : \
- (s == WORD_OPCODE_SUFFIX ? Word : DWord))
-
-#define FITS_IN_SIGNED_BYTE(num) ((num) >= -128 && (num) <= 127)
-#define FITS_IN_UNSIGNED_BYTE(num) ((num) >= 0 && (num) <= 255)
-#define FITS_IN_UNSIGNED_WORD(num) ((num) >= 0 && (num) <= 65535)
-#define FITS_IN_SIGNED_WORD(num) ((num) >= -32768 && (num) <= 32767)
-
-#define SMALLEST_DISP_TYPE(num) \
- FITS_IN_SIGNED_BYTE(num) ? (Disp8|Disp32|Abs8|Abs32) : (Disp32|Abs32)
-
-#define SMALLEST_IMM_TYPE(num) \
- (num == 1) ? (Imm1|Imm8|Imm8S|Imm16|Imm32): \
- FITS_IN_SIGNED_BYTE(num) ? (Imm8S|Imm8|Imm16|Imm32) : \
- FITS_IN_UNSIGNED_BYTE(num) ? (Imm8|Imm16|Imm32): \
- (FITS_IN_SIGNED_WORD(num)||FITS_IN_UNSIGNED_WORD(num)) ? (Imm16|Imm32) : \
- (Imm32)
-
-typedef unsigned char uchar;
-typedef unsigned int uint;
-
-typedef struct {
- /* instruction name sans width suffix ("mov" for movl insns) */
- char *name;
-
- /* how many operands */
- uint operands;
-
- /* base_opcode is the fundamental opcode byte with a optional prefix(es). */
- uint base_opcode;
-
- /* extension_opcode is the 3 bit extension for group <n> insns.
- If this template has no extension opcode (the usual case) use None */
- uchar extension_opcode;
-#define None 0xff /* If no extension_opcode is possible. */
-
- /* the bits in opcode_modifier are used to generate the final opcode from
- the base_opcode. These bits also are used to detect alternate forms of
- the same instruction */
- uint opcode_modifier;
-
-/* opcode_modifier bits: */
-#define W 0x1 /* set if operands are words or dwords */
-#define D 0x2 /* D = 0 if Reg --> Regmem; D = 1 if Regmem --> Reg */
-/* direction flag for floating insns: MUST BE 0x400 */
-#define FloatD 0x400
-/* shorthand */
-#define DW (D|W)
-#define ShortForm 0x10 /* register is in low 3 bits of opcode */
-#define ShortFormW 0x20 /* ShortForm and W bit is 0x8 */
-#define Seg2ShortForm 0x40 /* encoding of load segment reg insns */
-#define Seg3ShortForm 0x80 /* fs/gs segment register insns. */
-#define Jump 0x100 /* special case for jump insns. */
-#define JumpInterSegment 0x200 /* special case for intersegment leaps/calls */
-/* 0x400 CANNOT BE USED since it's already used by FloatD above */
-#define DONT_USE 0x400
-#define NoModrm 0x800
-#define Modrm 0x1000
-#define imulKludge 0x2000
-#define JumpByte 0x4000
-#define JumpDword 0x8000
-#define ReverseRegRegmem 0x10000
-
- /* (opcode_modifier & COMES_IN_ALL_SIZES) is true if the
- instuction comes in byte, word, and dword sizes and is encoded into
- machine code in the canonical way. */
-#define COMES_IN_ALL_SIZES (W)
-
- /* (opcode_modifier & COMES_IN_BOTH_DIRECTIONS) indicates that the
- source and destination operands can be reversed by setting either
- the D (for integer insns) or the FloatD (for floating insns) bit
- in base_opcode. */
-#define COMES_IN_BOTH_DIRECTIONS (D|FloatD)
-
- /* operand_types[i] describes the type of operand i. This is made
- by OR'ing together all of the possible type masks. (e.g.
- 'operand_types[i] = Reg|Imm' specifies that operand i can be
- either a register or an immediate operand */
- uint operand_types[3];
-} template;
-
-/*
- 'templates' is for grouping together 'template' structures for opcodes
- of the same name. This is only used for storing the insns in the grand
- ole hash table of insns.
- The templates themselves start at START and range up to (but not including)
- END.
-*/
-typedef struct {
- template *start;
- template *end;
-} templates;
-
-/* these are for register name --> number & type hash lookup */
-typedef struct {
- char * reg_name;
- uint reg_type;
- uint reg_num;
-} reg_entry;
-
-typedef struct {
- char * seg_name;
- uint seg_prefix;
-} seg_entry;
-
-/* these are for prefix name --> prefix code hash lookup */
-typedef struct {
- char * prefix_name;
- uchar prefix_code;
-} prefix_entry;
-
-/* 386 operand encoding bytes: see 386 book for details of this. */
-typedef struct {
- unsigned regmem:3; /* codes register or memory operand */
- unsigned reg:3; /* codes register operand (or extended opcode) */
- unsigned mode:2; /* how to interpret regmem & reg */
-} modrm_byte;
-
-/* 386 opcode byte to code indirect addressing. */
-typedef struct {
- unsigned base:3;
- unsigned index:3;
- unsigned scale:2;
-} base_index_byte;
-
-/* 'md_assemble ()' gathers together information and puts it into a
- i386_insn. */
-
-typedef struct {
- /* TM holds the template for the insn were currently assembling. */
- template tm;
- /* SUFFIX holds the opcode suffix (e.g. 'l' for 'movl') if given. */
- char suffix;
- /* Operands are coded with OPERANDS, TYPES, DISPS, IMMS, and REGS. */
-
- /* OPERANDS gives the number of given operands. */
- uint operands;
-
- /* REG_OPERANDS, DISP_OPERANDS, MEM_OPERANDS, IMM_OPERANDS give the number of
- given register, displacement, memory operands and immediate operands. */
- uint reg_operands, disp_operands, mem_operands, imm_operands;
-
- /* TYPES [i] is the type (see above #defines) which tells us how to
- search through DISPS [i] & IMMS [i] & REGS [i] for the required
- operand. */
- uint types [MAX_OPERANDS];
-
- /* Displacements (if given) for each operand. */
- expressionS * disps [MAX_OPERANDS];
-
- /* Immediate operands (if given) for each operand. */
- expressionS * imms [MAX_OPERANDS];
-
- /* Register operands (if given) for each operand. */
- reg_entry * regs [MAX_OPERANDS];
-
- /* BASE_REG, INDEX_REG, and LOG2_SCALE_FACTOR are used to encode
- the base index byte below. */
- reg_entry * base_reg;
- reg_entry * index_reg;
- uint log2_scale_factor;
-
- /* SEG gives the seg_entry of this insn. It is equal to zero unless
- an explicit segment override is given. */
- seg_entry * seg; /* segment for memory operands (if given) */
-
- /* PREFIX holds all the given prefix opcodes (usually null).
- PREFIXES is the size of PREFIX. */
- char prefix [MAX_PREFIXES];
- uint prefixes;
-
- /* RM and IB are the modrm byte and the base index byte where the addressing
- modes of this insn are encoded. */
-
- modrm_byte rm;
- base_index_byte bi;
-} i386_insn;
diff --git a/gnu/usr.bin/as/doc/Makefile.in b/gnu/usr.bin/as/doc/Makefile.in
deleted file mode 100644
index fdae0b2..0000000
--- a/gnu/usr.bin/as/doc/Makefile.in
+++ /dev/null
@@ -1,172 +0,0 @@
-# Makefile for GNU Assembler documentation
-# - see pretex.m4 for discussion of preprocessor definitions
-# Copyright (C) 1987-1992 Free Software Foundation, Inc.
-
-#This file is part of GNU GAS.
-
-#GNU GAS is free software; you can redistribute it and/or modify
-#it under the terms of the GNU General Public License as published by
-#the Free Software Foundation; either version 2, or (at your option)
-#any later version.
-
-#GNU GAS 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 GAS; see the file COPYING. If not, write to
-#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-
-# The targets for external use include:
-# all, doc, proto, install, uninstall, includes, TAGS,
-# clean, cleanconfig, realclean, stage1, stage2, stage3, stage4.
-
-# Variables that exist for you to override.
-# See below for how to change them for certain systems.
-
-srcdir = .
-
-prefix = /usr/local
-
-bindir = $(prefix)/bin
-datadir = $(prefix)/lib
-libdir = $(prefix)/lib
-mandir = $(datadir)/man
-man1dir = $(mandir)/man1
-man2dir = $(mandir)/man2
-man3dir = $(mandir)/man3
-man4dir = $(mandir)/man4
-man5dir = $(mandir)/man5
-man6dir = $(mandir)/man6
-man7dir = $(mandir)/man7
-man8dir = $(mandir)/man8
-man9dir = $(mandir)/man9
-infodir = $(datadir)/info
-includedir = $(prefix)/include
-docdir = $(datadir)/doc
-
-SHELL = /bin/sh
-
-INSTALL = install -c
-INSTALL_PROGRAM = $(INSTALL)
-INSTALL_DATA = $(INSTALL)
-
-AR = ar
-AR_FLAGS = qv
-BISON = bison
-MAKEINFO = makeinfo
-RANLIB = ranlib
-
-# What version of the manual you want (see *.m4); "all" includes everything
-CONFIG=all
-
-# Sun/Berkeley m4 doesn't have all the things we need; use GNU or sV
-M4=gm4
-#M4=/usr/5bin/m4
-
-# Directory for gas source
-srcdir=..
-
-# Where to find texinfo.tex to format docn with TeX
-TEXIDIR = $(srcdir)/../texinfo/fsf
-
-#### host, target, and site specific Makefile frags come in here.
-##
-
-all:
-clean:
-install:
- $(INSTALL_DATA) $(srcdir)/as.1 $(man1dir)/as.1
-
-info: as.info
-
-as.info: as-${CONFIG}.texinfo
- makeinfo -o as.info as-${CONFIG}.texinfo
-
-install-info: as.info
- [ -d $(infodir) ] || mkdir $(infodir)
- for i in as.info* ; do \
- $(INSTALL_DATA) $$i $(infodir)/$$i ; \
- done
-
-as.dvi: as-${CONFIG}.texinfo
- TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex as-${CONFIG}.texinfo
- texindex as-${CONFIG}.??
- TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex as-${CONFIG}.texinfo
- mv as-${CONFIG}.dvi as.dvi
- rm as-${CONFIG}.?? as-${CONFIG}.???
-
-# ROFF doc targets as.ms, as.mm, as.me
-# (we don't use a variable because we don't trust all makes to handle
-# a var in the target name right).
-# roff output (-ms)
-as.ms: as-${CONFIG}.texinfo
- sed -e '/\\input texinfo/d' \
- -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
- -e 's/{.*,,/{/' \
- as-${CONFIG}.texinfo | \
- texi2roff -ms >as.ms
-
-# roff output (-mm)
-as.mm: as-${CONFIG}.texinfo
- sed -e '/\\input texinfo/d' \
- -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
- -e 's/{.*,,/{/' \
- -e '/@noindent/d' \
- as-${CONFIG}.texinfo | \
- texi2roff -mm | \
- sed -e 's/---/\\(em/g' \
- >as.mm
-
-# roff output (-me)
-as.me: as-${CONFIG}.texinfo
- sed -e '/\\input texinfo/d' \
- -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
- -e 's/{.*,,/{/' \
- as-${CONFIG}.texinfo | \
- texi2roff -me >as.me
-
-
-
-as-all.texinfo: as.texinfo pretex.m4 none.m4 all.m4
- ${M4} $(srcdir)/pretex.m4 $(srcdir)/none.m4 $(srcdir)/all.m4 $(srcdir)/as.texinfo >as-all.texinfo
-
-as-a29k.texinfo: as.texinfo pretex.m4 none.m4 a29k.m4
- ${M4} pretex.m4 none.m4 a29k.m4 as.texinfo >as-a29k.texinfo
-
-as-a29k-coff.texinfo: as.texinfo pretex.m4 none.m4 a29k-coff.m4
- ${M4} pretex.m4 none.m4 a29k-coff.m4 as.texinfo >as-a29k-coff.texinfo
-
-as-gen.texinfo: as.texinfo pretex.m4 none.m4 gen.m4
- ${M4} pretex.m4 none.m4 gen.m4 as.texinfo >as-gen.texinfo
-
-as-h8.texinfo: as.texinfo pretex.m4 none.m4 h8.m4
- ${M4} pretex.m4 none.m4 h8.m4 as.texinfo >as-h8.texinfo
-
-as-i80386.texinfo: as.texinfo pretex.m4 none.m4 i80386.m4
- ${M4} pretex.m4 none.m4 i80386.m4 as.texinfo >as-i80386.texinfo
-
-as-i960.texinfo: as.texinfo pretex.m4 none.m4 i960.m4
- ${M4} pretex.m4 none.m4 i960.m4 as.texinfo >as-i960.texinfo
-
-as-m680x0.texinfo: as.texinfo pretex.m4 none.m4 m680x0.m4
- ${M4} pretex.m4 none.m4 m680x0.m4 as.texinfo >as-m680x0.texinfo
-
-as-sparc.texinfo: as.texinfo pretex.m4 none.m4 sparc.m4
- ${M4} pretex.m4 none.m4 sparc.m4 as.texinfo >as-sparc.texinfo
-
-as-vax.texinfo: as.texinfo pretex.m4 none.m4 vax.m4
- ${M4} pretex.m4 none.m4 vax.m4 as.texinfo >as-vax.texinfo
-
-as-vintage.texinfo: as.texinfo pretex.m4 none.m4 vintage.m4
- ${M4} pretex.m4 none.m4 vintage.m4 as.texinfo >as-vintage.texinfo
-
-clean-info:
- rm -f as-${CONFIG}.* as.dvi as.info*
-
-force:
-
-Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
- $(SHELL) ./config.status
-
diff --git a/gnu/usr.bin/as/doc/a29k-coff.m4 b/gnu/usr.bin/as/doc/a29k-coff.m4
deleted file mode 100644
index c3b04e1..0000000
--- a/gnu/usr.bin/as/doc/a29k-coff.m4
+++ /dev/null
@@ -1,14 +0,0 @@
-_divert__(-1)
-_define__(<_A29K__>,<1>)
-_define__(<_GENERIC__>,<0>)
-_define__(<_HOST__>,<AMD 29K>)
-_define__(<_MACH_DEP__>,<AMD29K-Dependent>)
-_define__(<_AOUT__>,<0>)
-_define__(<_BOUT__>,<0>)
-_define__(<_COFF__>,<1>)
-_define__(<_ELF__>,<0>)
-_define__(<_DIFFTABKLUG__>,0) NO difference-table kluge
-_define__(<_IEEEFLOAT__>,1) IEEE floating point
-_define__(<_W32__>,1) 32-bit words
-_define__(<_W16__>,0)
-_divert__<>
diff --git a/gnu/usr.bin/as/doc/a29k.m4 b/gnu/usr.bin/as/doc/a29k.m4
deleted file mode 100644
index 9564387..0000000
--- a/gnu/usr.bin/as/doc/a29k.m4
+++ /dev/null
@@ -1,9 +0,0 @@
-_divert__(-1)
-_define__(<_A29K__>,<1>)
-_define__(<_HOST__>,<AMD 29K>)
-_define__(<_MACH_DEP__>,<AMD29K-Dependent>)
-_define__(<_DIFFTABKLUG__>,0) NO difference-table kluge
-_define__(<_IEEEFLOAT__>,1) IEEE floating point
-_define__(<_W32__>,1) 32-bit words
-_define__(<_W16__>,0)
-_divert__<>
diff --git a/gnu/usr.bin/as/doc/all.m4 b/gnu/usr.bin/as/doc/all.m4
deleted file mode 100644
index 3d4e7fd..0000000
--- a/gnu/usr.bin/as/doc/all.m4
+++ /dev/null
@@ -1,20 +0,0 @@
-_divert__(-1)
-<$Id: all.m4,v 1.1 1993/10/02 21:00:13 pk Exp $>
-_define__(<_ALL_ARCH__>,<1>)
-_define__(<_GENERIC__>,<1>) In case none.m4 changes its mind abt default
-
-_define__(<_AOUT__>,<1>)
-_define__(<_BOUT__>,<1>)
-_define__(<_COFF__>,<1>)
-_define__(<_ELF__>,<1>)
-
-_define__(<_A29K__>,<1>)
-_define__(<_H8__>,<1>)
-_define__(<_I80386__>,<1>)
-_define__(<_I960__>,<1>)
-_define__(<_M680X0__>,<1>)
-_define__(<_SPARC__>,<1>)
-_define__(<_VAX__>,<1>)
-_define__(<_VXWORKS__>,<1>)
-
-_divert__<>
diff --git a/gnu/usr.bin/as/doc/as.texinfo b/gnu/usr.bin/as/doc/as.texinfo
deleted file mode 100644
index c9e0f57..0000000
--- a/gnu/usr.bin/as/doc/as.texinfo
+++ /dev/null
@@ -1,6730 +0,0 @@
-_dnl__ -*-Texinfo-*-
-_dnl__ Copyright (c) 1991 1992 Free Software Foundation, Inc.
-_dnl__ $Id: as.texinfo,v 1.1 1993/10/02 21:00:15 pk Exp $
-\input texinfo @c -*-Texinfo-*-
-@c Copyright (c) 1991 1992 Free Software Foundation, Inc.
-@c %**start of header
-@setfilename _AS__.info
-_if__(_GENERIC__)
-@settitle Using _AS__
-_fi__(_GENERIC__)
-_if__(!_GENERIC__)
-@settitle Using _AS__ (_HOST__)
-_fi__(!_GENERIC__)
-@setchapternewpage odd
-@c @smallbook
-@c @cropmarks
-@c %**end of header
-
-@finalout
-@syncodeindex ky cp
-
-_if__(0)
-
-NOTE: this manual is marked up for preprocessing with a collection
-of m4 macros called "pretex.m4".
-
-THIS IS THE FULL SOURCE. The full source needs to be run through m4
-before either tex- or info- formatting: for example,
- m4 pretex.m4 none.m4 m680x0.m4 as.texinfo >as-680x0.texinfo
-will produce (assuming your path finds either GNU or SysV m4; Berkeley
-won't do) a file, configured for the M680x0 version of GAS, suitable for
-formatting. See the text in "pretex.m4" for a fuller explanation (and
-the macro definitions).
-
-_fi__(0)
-@c
-@ifinfo
-This file documents the GNU Assembler "_AS__".
-
-Copyright (C) 1991 Free Software Foundation, Inc.
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-
-@ignore
-Permission is granted to process this file through Tex and print the
-results, provided the printed document carries copying permission
-notice identical to this one except for the removal of this paragraph
-(this paragraph not being relevant to the printed manual).
-
-@end ignore
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided also that the
-section entitled ``GNU General Public License'' is included exactly as
-in the original, and provided that the entire resulting derived work is
-distributed under the terms of a permission notice identical to this
-one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that the section entitled ``GNU General Public License'' may be
-included in a translation approved by the Free Software Foundation
-instead of in the original English.
-@end ifinfo
-
-@titlepage
-@title Using _AS__
-@subtitle The GNU Assembler
-_if__(!_GENERIC__)
-@subtitle for the _HOST__ family
-_fi__(!_GENERIC__)
-@sp 1
-@subtitle January 1992
-@sp 1
-@sp 13
-The Free Software Foundation Inc. thanks The Nice Computer
-Company of Australia for loaning Dean Elsner to write the
-first (Vax) version of @code{as} for Project GNU.
-The proprietors, management and staff of TNCCA thank FSF for
-distracting the boss while they got some work
-done.
-@sp 3
-@author Dean Elsner, Jay Fenlason & friends
-@c edited by: pesch@cygnus.com
-@page
-@tex
-\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
-\xdef\manvers{\$Revision: 1.1 $} % For use in headers, footers too
-{\parskip=0pt
-\hfill \manvers\par
-\hfill \TeX{}info \texinfoversion\par
-}
-%"boxit" macro for figures:
-%Modified from Knuth's ``boxit'' macro from TeXbook (answer to exercise 21.3)
-\gdef\boxit#1#2{\vbox{\hrule\hbox{\vrule\kern3pt
- \vbox{\parindent=0pt\parskip=0pt\hsize=#1\kern3pt\strut\hfil
-#2\hfil\strut\kern3pt}\kern3pt\vrule}\hrule}}%box with visible outline
-\gdef\ibox#1#2{\hbox to #1{#2\hfil}\kern8pt}% invisible box
-@end tex
-
-Edited by Roland Pesch for Cygnus Support.
-
-@vskip 0pt plus 1filll
-Copyright @copyright{} 1991 Free Software Foundation, Inc.
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided also that the
-section entitled ``GNU General Public License'' is included exactly as
-in the original, and provided that the entire resulting derived work is
-distributed under the terms of a permission notice identical to this
-one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that the section entitled ``GNU General Public License'' may be
-included in a translation approved by the Free Software Foundation
-instead of in the original English.
-@end titlepage
-@page
-@node Top, Overview, (dir), (dir)
-@ifinfo
-This file is a user guide to the GNU assembler @code{_AS__}.
-_if__(!_GENERIC__)
-This version of the file describes @code{_AS__} configured to generate
-code for _HOST__ architectures.
-_fi__(!_GENERIC__)
-@end ifinfo
-@menu
-* Overview:: Overview
-* Invoking:: Command-Line Options
-* Syntax:: Syntax
-* Sections:: Sections and Relocation
-* Symbols:: Symbols
-* Expressions:: Expressions
-* Pseudo Ops:: Assembler Directives
-* _MACH_DEP__:: Machine Dependent Features
-* Copying:: GNU GENERAL PUBLIC LICENSE
-* Index:: Index
-@end menu
-
-@node Overview, Invoking, Top, Top
-@chapter Overview
-@iftex
-This manual is a user guide to the GNU assembler @code{_AS__}.
-_if__(!_GENERIC__)
-This version of the manual describes @code{_AS__} configured to generate
-code for _HOST__ architectures.
-_fi__(!_GENERIC__)
-@end iftex
-
-@cindex invocation summary
-@cindex option summary
-@cindex summary of options
-Here is a brief summary of how to invoke @code{_AS__}. For details,
-@pxref{Invoking,,Comand-Line Options}.
-
-@c We don't use deffn and friends for the following because they seem
-@c to be limited to one line for the header.
-@smallexample
- _AS__ [ -a | -al | -as ] [ -D ] [ -f ]
- [ -I @var{path} ] [ -k ] [ -L ]
- [ -o @var{objfile} ] [ -R ] [ -v ] [ -w ]
-_if__(_A29K__)
-@c am29k has no machine-dependent assembler options
-_fi__(_A29K__)
-_if__(_H8__)
-@c h8/300 has no machine-dependent assembler options
-_fi__(_H8__)
-_if__(_I960__)
-@c see md_parse_option in i960.c
- [ -ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC ]
- [ -b ] [ -norelax ]
-_fi__(_I960__)
-_if__(_M680X0__)
- [ -l ] [ -mc68000 | -mc68010 | -mc68020 ]
-_fi__(_M680X0__)
- [ -- | @var{files} @dots{} ]
-@end smallexample
-
-@table @code
-@item -a | -al | -as
-Turn on assembly listings; @samp{-al}, listing only, @samp{-as}, symbols
-only, @samp{-a}, everything.
-
-@item -D
-This option is accepted only for script compatibility with calls to
-other assemblers; it has no effect on @code{_AS__}.
-
-@item -f
-``fast''---skip preprocessing (assume source is compiler output)
-
-@item -I @var{path}
-Add @var{path} to the search list for @code{.include} directives
-
-@item -k
-_if__((!_GENERIC__) && !_DIFFTABKLUG__)
-This option is accepted but has no effect on the _HOST__ family.
-_fi__((!_GENERIC__) && !_DIFFTABKLUG__)
-_if__(_GENERIC__ || _DIFFTABKLUG__)
-Issue warnings when difference tables altered for long displacements.
-_fi__(_GENERIC__ || _DIFFTABKLUG__)
-
-@item -L
-Keep (in symbol table) local symbols, starting with @samp{L}
-
-@item -o @var{objfile}
-Name the object-file output from @code{_AS__}
-
-@item -R
-Fold data section into text section
-
-@item -v
-Announce @code{as} version
-
-@item -W
-Suppress warning messages
-
-_if__(_I960__)
-@item -ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC
-_if__(_GENERIC__)
-(When configured for Intel 960).
-_fi__(_GENERIC__)
-Specify which variant of the 960 architecture is the target.
-
-@item -b
-_if__(_GENERIC__)
-(When configured for Intel 960).
-_fi__(_GENERIC__)
-Add code to collect statistics about branches taken.
-
-@item -norelax
-_if__(_GENERIC__)
-(When configured for Intel 960).
-_fi__(_GENERIC__)
-Do not alter compare-and-branch instructions for long displacements;
-error if necessary.
-_fi__(_I960__)
-
-_if__(_M680X0__)
-@item -l
-_if__(_GENERIC__)
-(When configured for Motorola 68000).
-_fi__(_GENERIC__)
-Shorten references to undefined symbols, to one word instead of two
-
-@item -mc68000 | -mc68010 | -mc68020
-_if__(_GENERIC__)
-(When configured for Motorola 68000).
-_fi__(_GENERIC__)
-Specify what processor in the 68000 family is the target (default 68020)
-_fi__(_M680X0__)
-
-@item -- | @var{files} @dots{}
-Standard input, or source files to assemble
-@end table
-
-@menu
-* Manual:: Structure of this Manual
-* GNU Assembler:: _AS__, the GNU Assembler
-* Object Formats:: Object File Formats
-* Command Line:: Command Line
-* Input Files:: Input Files
-* Object:: Output (Object) File
-* Errors:: Error and Warning Messages
-@end menu
-
-@node Manual, GNU Assembler, Overview, Overview
-@section Structure of this Manual
-
-@cindex manual, structure and purpose
-This manual is intended to describe what you need to know to use
-@sc{gnu} @code{_AS__}. We cover the syntax expected in source files, including
-notation for symbols, constants, and expressions; the directives that
-@code{_AS__} understands; and of course how to invoke @code{_AS__}.
-
-_if__(!_GENERIC__)
-We also cover special features in the _HOST__
-configuration of @code{_AS__}, including assembler directives.
-_fi__(!_GENERIC__)
-_if__(_GENERIC__)
-This manual also describes some of the machine-dependent features of
-various flavors of the assembler.
-_fi__(_GENERIC__)
-_if__(_INTERNALS__)
-This manual also describes how the assembler works internally, and
-provides some information that may be useful to people attempting to
-port the assembler to another machine.
-_fi__(_INTERNALS__)
-@refill
-
-@cindex machine instructions (not covered)
-On the other hand, this manual is @emph{not} intended as an introduction
-to programming in assembly language---let alone programming in general!
-In a similar vein, we make no attempt to introduce the machine
-architecture; we do @emph{not} describe the instruction set, standard
-mnemonics, registers or addressing modes that are standard to a
-particular architecture.
-_if__(_GENERIC__)
-You may want to consult the manufacturer's
-machine architecture manual for this information.
-_fi__(_GENERIC__)
-_if__(_H8__&&!_GENERIC__)
-For information on the H8/300 machine instruction set, see @cite{H8/300
-Series Programming Manual} (Hitachi ADE--602--025).
-_fi__(_H8__&&!_GENERIC__)
-
-
-@c I think this is premature---pesch@cygnus.com, 17jan1991
-@ignore
-Throughout this manual, we assume that you are running @dfn{GNU},
-the portable operating system from the @dfn{Free Software
-Foundation, Inc.}. This restricts our attention to certain kinds of
-computer (in particular, the kinds of computers that GNU can run on);
-once this assumption is granted examples and definitions need less
-qualification.
-
-@code{_AS__} is part of a team of programs that turn a high-level
-human-readable series of instructions into a low-level
-computer-readable series of instructions. Different versions of
-@code{_AS__} are used for different kinds of computer.
-@end ignore
-
-@c There used to be a section "Terminology" here, which defined
-@c "contents", "byte", "word", and "long". Defining "word" to any
-@c particular size is confusing when the .word directive may generate 16
-@c bits on one machine and 32 bits on another; in general, for the user
-@c version of this manual, none of these terms seem essential to define.
-@c They were used very little even in the former draft of the manual;
-@c this draft makes an effort to avoid them (except in names of
-@c directives).
-
-@node GNU Assembler, Object Formats, Manual, Overview
-@section _AS__, the GNU Assembler
-
-GNU @code{as} is really a family of assemblers.
-_if__(!_GENERIC__)
-This manual describes @code{_AS__}, a member of that family which is
-configured for the _HOST__ architectures.
-_fi__(!_GENERIC__)
-If you use (or have used) the GNU assembler on one architecture, you
-should find a fairly similar environment when you use it on another
-architecture. Each version has much in common with the others,
-including object file formats, most assembler directives (often called
-@dfn{pseudo-ops)} and assembler syntax.@refill
-
-_if__(_GENERIC__||!_H8__)
-@cindex purpose of @sc{gnu} @code{_AS__}
-@code{_AS__} is primarily intended to assemble the output of the GNU C
-compiler @code{_GCC__} for use by the linker @code{_LD__}. Nevertheless,
-we've tried to make @code{_AS__} assemble correctly everything that the native
-assembler would.
-_fi__(_GENERIC__||!_H8__)
-_if__(_VAX__)
-Any exceptions are documented explicitly (@pxref{_MACH_DEP__}).
-_fi__(_VAX__)
-_if__(_GENERIC__||_M680X0__)
-This doesn't mean @code{_AS__} always uses the same syntax as another
-assembler for the same architecture; for example, we know of several
-incompatible versions of 680x0 assembly language syntax.
-_fi__(_GENERIC__||_M680X0__)
-
-Unlike older assemblers, @code{_AS__} is designed to assemble a source
-program in one pass of the source file. This has a subtle impact on the
-@kbd{.org} directive (@pxref{Org,,@code{.org}}).
-
-@node Object Formats, Command Line, GNU Assembler, Overview
-@section Object File Formats
-
-@cindex object file format
-The GNU assembler can be configured to produce several alternative
-object file formats. For the most part, this does not affect how you
-write assembly language programs; but directives for debugging symbols
-are typically different in different file formats. @xref{Symbol
-Attributes,,Symbol Attributes}.
-_if__(!_GENERIC__)
-_if__(!(_I960__||_A29K__))
-_if__(_AOUT__ && (!_COFF__) && (!_ELF__))
-On the _HOST__, @code{_AS__} is configured to produce @code{a.out} format object
-files.@refill
-_fi__(_AOUT__ && (!_COFF__) && (!_ELF__))
-_if__((!_AOUT__) && _COFF__ && (!_ELF__))
-On the _HOST__, @code{_AS__} is configured to produce COFF format object
-files.@refill
-_fi__((!_AOUT__) && _COFF__ && (!_ELF__))
-_fi__(!(_I960__||_A29K__))
-_if__(_A29K__)
-On the _HOST__, @code{_AS__} can be configured to produce either
-@code{a.out} or COFF format object files.
-_fi__(_A29K__)
-_if__(_I960__)
-On the _HOST__, @code{_AS__} can be configured to produce either @code{b.out} or COFF
-format object files.
-_fi__(_I960__)
-_fi__(!_GENERIC__)
-
-@node Command Line, Input Files, Object Formats, Overview
-@section Command Line
-
-@cindex command line conventions
-After the program name @code{_AS__}, the command line may contain
-options and file names. Options may appear in any order, and may be
-before, after, or between file names. The order of file names is
-significant.
-
-@cindex standard input, as input file
-@kindex --
-@file{--} (two hyphens) by itself names the standard input file
-explicitly, as one of the files for @code{_AS__} to assemble.
-
-@cindex options, command line
-Except for @samp{--} any command line argument that begins with a
-hyphen (@samp{-}) is an option. Each option changes the behavior of
-@code{_AS__}. No option changes the way another option works. An
-option is a @samp{-} followed by one or more letters; the case of
-the letter is important. All options are optional.
-
-Some options expect exactly one file name to follow them. The file
-name may either immediately follow the option's letter (compatible
-with older assemblers) or it may be the next command argument (GNU
-standard). These two command lines are equivalent:
-
-@smallexample
-_AS__ -o my-object-file.o mumble.s
-_AS__ -omy-object-file.o mumble.s
-@end smallexample
-
-@node Input Files, Object, Command Line, Overview
-@section Input Files
-
-@cindex input
-@cindex source program
-@cindex files, input
-We use the phrase @dfn{source program}, abbreviated @dfn{source}, to
-describe the program input to one run of @code{_AS__}. The program may
-be in one or more files; how the source is partitioned into files
-doesn't change the meaning of the source.
-
-@c I added "con" prefix to "catenation" just to prove I can overcome my
-@c APL training... pesch@cygnus.com
-The source program is a concatenation of the text in all the files, in the
-order specified.
-
-Each time you run @code{_AS__} it assembles exactly one source
-program. The source program is made up of one or more files.
-(The standard input is also a file.)
-
-You give @code{_AS__} a command line that has zero or more input file
-names. The input files are read (from left file name to right). A
-command line argument (in any position) that has no special meaning
-is taken to be an input file name.
-
-If you give @code{_AS__} no file names it attempts to read one input file
-from the @code{_AS__} standard input, which is normally your terminal. You
-may have to type @key{ctl-D} to tell @code{_AS__} there is no more program
-to assemble.
-
-Use @samp{--} if you need to explicitly name the standard input file
-in your command line.
-
-If the source is empty, @code{_AS__} will produce a small, empty object
-file.
-
-@subheading Filenames and Line-numbers
-
-@cindex input file linenumbers
-@cindex line numbers, in input files
-There are two ways of locating a line in the input file (or files) and
-either may be used in reporting error messages. One way refers to a line
-number in a physical file; the other refers to a line number in a
-``logical'' file. @xref{Errors, ,Error and Warning Messages}.
-
-@dfn{Physical files} are those files named in the command line given
-to @code{_AS__}.
-
-@dfn{Logical files} are simply names declared explicitly by assembler
-directives; they bear no relation to physical files. Logical file names
-help error messages reflect the original source file, when @code{_AS__}
-source is itself synthesized from other files.
-@xref{App-File,,@code{.app-file}}.
-
-@node Object, Errors, Input Files, Overview
-@section Output (Object) File
-
-@cindex object file
-@cindex output file
-@kindex a.out
-@kindex .o
-Every time you run @code{_AS__} it produces an output file, which is
-your assembly language program translated into numbers. This file
-is the object file, named @code{a.out} unless you tell @code{_AS__} to
-give it another name by using the @code{-o} option. Conventionally,
-object file names end with @file{.o}. The default name of
-@file{a.out} is used for historical reasons: older assemblers were
-capable of assembling self-contained programs directly into a
-runnable program.
-@c This may still work, but hasn't been tested.
-
-@cindex linker
-@kindex ld
-The object file is meant for input to the linker @code{_LD__}. It contains
-assembled program code, information to help @code{_LD__} integrate
-the assembled program into a runnable file, and (optionally) symbolic
-information for the debugger.
-
-@c link above to some info file(s) like the description of a.out.
-@c don't forget to describe GNU info as well as Unix lossage.
-
-@node Errors, , Object, Overview
-@section Error and Warning Messages
-
-@cindex error messsages
-@cindex warning messages
-@cindex messages from @code{_AS__}
-@code{_AS__} may write warnings and error messages to the standard error
-file (usually your terminal). This should not happen when a compiler
-runs @code{_AS__} automatically. Warnings report an assumption made so
-that @code{_AS__} could keep assembling a flawed program; errors report a
-grave problem that stops the assembly.
-
-@cindex format of warning messages
-Warning messages have the format
-
-@smallexample
-file_name:@b{NNN}:Warning Message Text
-@end smallexample
-
-@noindent
-@cindex line numbers, in warnings/errors
-(where @b{NNN} is a line number). If a logical file name has
-been given (@pxref{App-File,,@code{.app-file}}) it is used for the filename, otherwise the
-name of the current input file is used. If a logical line number was
-given
-_if__(!_A29K__)
-(@pxref{Line,,@code{.line}})
-_fi__(!_A29K__)
-_if__(_A29K__)
-(@pxref{Ln,,@code{.ln}})
-_fi__(_A29K__)
-then it is used to calculate the number printed,
-otherwise the actual line in the current source file is printed. The
-message text is intended to be self explanatory (in the grand Unix
-tradition). @refill
-
-@cindex format of error messages
-Error messages have the format
-@smallexample
-file_name:@b{NNN}:FATAL:Error Message Text
-@end smallexample
-The file name and line number are derived as for warning
-messages. The actual message text may be rather less explanatory
-because many of them aren't supposed to happen.
-
-@node Invoking, Syntax, Overview, Top
-@chapter Command-Line Options
-
-@cindex options, all versions of @code{_AS__}
-This chapter describes command-line options available in @emph{all}
-versions of the GNU assembler; @pxref{_MACH_DEP__}, for options specific
-_if__(!_GENERIC__)
-to the _HOST__.
-_fi__(!_GENERIC__)
-_if__(_GENERIC__)
-to particular machine architectures.
-_fi__(_GENERIC__)
-
-@section Enable Listings: @code{-a}, @code{-al}, @code{-as}
-
-@kindex -a
-@kindex -al
-@kindex -as
-@cindex listings, enabling
-@cindex assembly listings, enabling
-These options enable listing output from the assembler. @samp{-a} by
-itself requests all listing output; @samp{-al} requests only the
-output-program listing, and @samp{-as} requests only a symbol table
-listing.
-
-Once you have specified one of these options, you can further control
-listing output and its appearance using the directives @code{.list},
-@code{.nolist}, @code{.psize}, @code{.eject}, @code{.title}, and
-@code{.sbttl}.
-
-If you do not request listing output with one of the @samp{-a} options, the
-listing-control directives have no effect.
-
-@section @code{-D}
-
-@kindex -D
-This option has no effect whatsoever, but it is accepted to make it more
-likely that scripts written for other assemblers will also work with
-@code{_AS__}.
-
-@section Work Faster: @code{-f}
-
-@kindex -f
-@cindex trusted compiler
-@cindex faster processing (@code{-f})
-@samp{-f} should only be used when assembling programs written by a
-(trusted) compiler. @samp{-f} stops the assembler from pre-processing
-the input file(s) before assembling them. @xref{Pre-processing,
-,Pre-processing}.
-
-@quotation
-@emph{Warning:} if the files actually need to be pre-processed (if they
-contain comments, for example), @code{_AS__} will not work correctly if
-@samp{-f} is used.
-@end quotation
-
-@section @code{.include} search path: @code{-I} @var{path}
-
-@kindex -I @var{path}
-@cindex paths for @code{.include}
-@cindex search path for @code{.include}
-@cindex @code{include} directive search path
-Use this option to add a @var{path} to the list of directories
-@code{_AS__} will search for files specified in @code{.include}
-directives (@pxref{Include,,@code{.include}}). You may use @code{-I} as
-many times as necessary to include a variety of paths. The current
-working directory is always searched first; after that, @code{_AS__}
-searches any @samp{-I} directories in the same order as they were
-specified (left to right) on the command line.
-
-@section Difference Tables: @code{-k}
-
-@kindex -k
-_if__((!_GENERIC__) && (!_DIFFTABKLUG__))
-On the _HOST__ family, this option is allowed, but has no effect. It is
-permitted for compatibility with the GNU assembler on other platforms,
-where it can be used to warn when the assembler alters the machine code
-generated for @samp{.word} directives in difference tables. The _HOST__
-family does not have the addressing limitations that sometimes lead to this
-alteration on other platforms.
-_fi__((!_GENERIC__) && (!_DIFFTABKLUG__))
-
-_if__(_GENERIC__ || _DIFFTABKLUG__ )
-@cindex difference tables, warning
-@cindex warning for altered difference tables
-@code{_AS__} sometimes alters the code emitted for directives of the form
-@samp{.word @var{sym1}-@var{sym2}}; @pxref{Word,,@code{.word}}.
-You can use the @samp{-k} option if you want a warning issued when this
-is done.
-_fi__(_GENERIC__ || _DIFFTABKLUG__ )
-
-@section Include Local Labels: @code{-L}
-
-@kindex -L
-@cindex local labels, retaining in output
-Labels beginning with @samp{L} (upper case only) are called @dfn{local
-labels}. @xref{Symbol Names}. Normally you don't see such labels when
-debugging, because they are intended for the use of programs (like
-compilers) that compose assembler programs, not for your notice.
-Normally both @code{_AS__} and @code{_LD__} discard such labels, so you don't
-normally debug with them.
-
-This option tells @code{_AS__} to retain those @samp{L@dots{}} symbols
-in the object file. Usually if you do this you also tell the linker
-@code{_LD__} to preserve symbols whose names begin with @samp{L}.
-
-@section Name the Object File: @code{-o}
-
-@kindex -o
-@cindex naming object file
-@cindex object file name
-There is always one object file output when you run @code{_AS__}. By
-default it has the name @file{a.out}. You use this option (which
-takes exactly one filename) to give the object file a different name.
-
-Whatever the object file is called, @code{_AS__} will overwrite any
-existing file of the same name.
-
-@section Join Data and Text Sections: @code{-R}
-
-@kindex -R
-@cindex data and text sections, joining
-@cindex text and data sections, joining
-@cindex joining text and data sections
-@cindex merging text and data sections
-@code{-R} tells @code{_AS__} to write the object file as if all
-data-section data lives in the text section. This is only done at
-the very last moment: your binary data are the same, but data
-section parts are relocated differently. The data section part of
-your object file is zero bytes long because all it bytes are
-appended to the text section. (@xref{Sections,,Sections and Relocation}.)
-
-When you specify @code{-R} it would be possible to generate shorter
-address displacements (because we don't have to cross between text and
-data section). We refrain from doing this simply for compatibility with
-older versions of @code{_AS__}. In future, @code{-R} may work this way.
-
-_if__(_COFF__)
-When @code{_AS__} is configured for COFF output,
-this option is only useful if you use sections named @samp{.text} and
-@samp{.data}.
-_fi__(_COFF__)
-
-@section Announce Version: @code{-v}
-
-@kindex -v
-@kindex -version
-@cindex @code{_AS__} version
-@cindex version of @code{_AS__}
-You can find out what version of as is running by including the
-option @samp{-v} (which you can also spell as @samp{-version}) on the
-command line.
-
-@section Suppress Warnings: @code{-W}
-
-@kindex -W
-@cindex suppressing warnings
-@cindex warnings, suppressing
-@code{_AS__} should never give a warning or error message when
-assembling compiler output. But programs written by people often
-cause @code{_AS__} to give a warning that a particular assumption was
-made. All such warnings are directed to the standard error file.
-If you use this option, no warnings are issued. This option only
-affects the warning messages: it does not change any particular of how
-@code{_AS__} assembles your file. Errors, which stop the assembly, are
-still reported.
-
-@node Syntax, Sections, Invoking, Top
-@chapter Syntax
-
-@cindex machine-independent syntax
-@cindex syntax, machine-independent
-This chapter describes the machine-independent syntax allowed in a
-source file. @code{_AS__} syntax is similar to what many other assemblers
-use; it is inspired in BSD 4.2
-_if__(!_VAX__)
-assembler. @refill
-_fi__(!_VAX__)
-_if__(_VAX__)
-assembler, except that @code{_AS__} does not assemble Vax bit-fields.
-_fi__(_VAX__)
-
-@menu
-* Pre-processing:: Pre-processing
-* Whitespace:: Whitespace
-* Comments:: Comments
-* Symbol Intro:: Symbols
-* Statements:: Statements
-* Constants:: Constants
-@end menu
-
-@node Pre-processing, Whitespace, Syntax, Syntax
-@section Pre-Processing
-
-@cindex preprocessing
-The pre-processor:
-@itemize @bullet
-@cindex whitespace, removed by preprocessor
-@item
-adjusts and removes extra whitespace. It leaves one space or tab before
-the keywords on a line, and turns any other whitespace on the line into
-a single space.
-
-@cindex comments, removed by preprocessor
-@item
-removes all comments, replacing them with a single space, or an
-appropriate number of newlines.
-
-@cindex constants, converted by preprocessor
-@item
-converts character constants into the appropriate numeric values.
-@end itemize
-
-Excess whitespace, comments, and character constants
-cannot be used in the portions of the input text that are not
-pre-processed.
-
-@cindex turning preprocessing on and off
-@cindex preprocessing, turning on and off
-@kindex #NO_APP
-@kindex #APP
-If the first line of an input file is @code{#NO_APP} or the @samp{-f}
-option is given, the input file will not be pre-processed. Within such
-an input file, parts of the file can be pre-processed by putting a line
-that says @code{#APP} before the text that should be pre-processed, and
-putting a line that says @code{#NO_APP} after them. This feature is
-mainly intend to support @code{asm} statements in compilers whose output
-normally does not need to be pre-processed.
-
-@node Whitespace, Comments, Pre-processing, Syntax
-@section Whitespace
-
-@cindex whitespace
-@dfn{Whitespace} is one or more blanks or tabs, in any order.
-Whitespace is used to separate symbols, and to make programs neater for
-people to read. Unless within character constants
-(@pxref{Characters,,Character Constants}), any whitespace means the same
-as exactly one space.
-
-@node Comments, Symbol Intro, Whitespace, Syntax
-@section Comments
-
-@cindex comments
-There are two ways of rendering comments to @code{_AS__}. In both
-cases the comment is equivalent to one space.
-
-Anything from @samp{/*} through the next @samp{*/} is a comment.
-This means you may not nest these comments.
-
-@smallexample
-/*
- The only way to include a newline ('\n') in a comment
- is to use this sort of comment.
-*/
-
-/* This sort of comment does not nest. */
-@end smallexample
-
-@cindex line comment character
-Anything from the @dfn{line comment} character to the next newline
-is considered a comment and is ignored. The line comment character is
-_if__(_VAX__)
-@samp{#} on the Vax;
-_fi__(_VAX__)
-_if__(_I960__)
-@samp{#} on the i960;
-_fi__(_I960__)
-_if__(_M680X0__)
-@samp{|} on the 680x0;
-_fi__(_M680X0__)
-_if__(_A29K__)
-@samp{;} for the AMD 29K family;
-_fi__(_A29K__)
-_if__(_H8__)
-@samp{;} for the _HOST__ family;
-_fi__(_H8__)
-@pxref{_MACH_DEP__}. @refill
-@c FIXME: fill in SPARC line comment char
-
-_if__(_GENERIC__)
-On some machines there are two different line comment characters. One
-will only begin a comment if it is the first non-whitespace character on
-a line, while the other will always begin a comment.
-_fi__(_GENERIC__)
-
-@kindex #
-@cindex lines starting with @code{#}
-@cindex logical line numbers
-To be compatible with past assemblers, a special interpretation is
-given to lines that begin with @samp{#}. Following the @samp{#} an
-absolute expression (@pxref{Expressions}) is expected: this will be
-the logical line number of the @b{next} line. Then a string
-(@xref{Strings}.) is allowed: if present it is a new logical file
-name. The rest of the line, if any, should be whitespace.
-
-If the first non-whitespace characters on the line are not numeric,
-the line is ignored. (Just like a comment.)
-@smallexample
- # This is an ordinary comment.
-# 42-6 "new_file_name" # New logical file name
- # This is logical line # 36.
-@end smallexample
-This feature is deprecated, and may disappear from future versions
-of @code{_AS__}.
-
-@node Symbol Intro, Statements, Comments, Syntax
-@section Symbols
-
-@cindex symbols
-@cindex characters used in symbols
-A @dfn{symbol} is one or more characters chosen from the set of all
-letters (both upper and lower case), digits and
-_if__(!_H8__)
-the three characters @samp{_.$}
-_fi__(!_H8__)
-_if__(_H8__)
-the two characters @samp{_.}
-_if__(_GENERIC__)
-On most machines, you can also use @code{$} in symbol names; exceptions
-are noted in @ref{_MACH_DEP__}.
-_fi__(_GENERIC__)
-_fi__(_H8__)
-No symbol may begin with a digit. Case is significant.
-There is no length limit: all characters are significant. Symbols are
-delimited by characters not in that set, or by the beginning of a file
-(since the source program must end with a newline, the end of a file is
-not a possible symbol delimiter). @xref{Symbols}.
-@cindex length of symbols
-
-@node Statements, Constants, Symbol Intro, Syntax
-@section Statements
-
-@cindex statements, structure of
-@cindex line separator character
-@cindex statement separator character
-_if__(!_GENERIC__)
-_if__(!(_A29K__||_H8__))
-A @dfn{statement} ends at a newline character (@samp{\n}) or at a
-semicolon (@samp{;}). The newline or semicolon is considered part of
-the preceding statement. Newlines and semicolons within character
-constants are an exception: they don't end statements.
-_fi__(!(_A29K__||_H8__))
-_if__(_A29K__)
-A @dfn{statement} ends at a newline character (@samp{\n}) or an ``at''
-sign (@samp{@@}). The newline or at sign is considered part of the
-preceding statement. Newlines and at signs within character constants
-are an exception: they don't end statements.
-_fi__(_A29K__)
-_if__(_H8__)
-A @dfn{statement} ends at a newline character (@samp{\n}) or a dollar
-sign (@samp{$}). The newline or dollar sign is considered part of the
-preceding statement. Newlines and dollar signs within character constants
-are an exception: they don't end statements.
-_fi__(_H8__)
-_fi__(!_GENERIC__)
-_if__(_GENERIC__)
-A @dfn{statement} ends at a newline character (@samp{\n}) or line
-separator character. (The line separator is usually @samp{;}, unless
-this conflicts with the comment character; @pxref{_MACH_DEP__}.) The
-newline or separator character is considered part of the preceding
-statement. Newlines and separators within character constants are an
-exception: they don't end statements.
-_fi__(_GENERIC__)
-
-@cindex newline, required at file end
-@cindex EOF, newline must precede
-It is an error to end any statement with end-of-file: the last
-character of any input file should be a newline.@refill
-
-@cindex continuing statements
-@cindex multi-line statements
-@cindex statement on multiple lines
-You may write a statement on more than one line if you put a
-backslash (@kbd{\}) immediately in front of any newlines within the
-statement. When @code{_AS__} reads a backslashed newline both
-characters are ignored. You can even put backslashed newlines in
-the middle of symbol names without changing the meaning of your
-source program.
-
-An empty statement is allowed, and may include whitespace. It is ignored.
-
-@cindex instructions and directives
-@cindex directives and instructions
-@c "key symbol" is not used elsewhere in the document; seems pedantic to
-@c @defn{} it in that case, as was done previously... pesch@cygnus.com,
-@c 13feb91.
-A statement begins with zero or more labels, optionally followed by a
-key symbol which determines what kind of statement it is. The key
-symbol determines the syntax of the rest of the statement. If the
-symbol begins with a dot @samp{.} then the statement is an assembler
-directive: typically valid for any computer. If the symbol begins with
-a letter the statement is an assembly language @dfn{instruction}: it
-will assemble into a machine language instruction.
-_if__(_GENERIC__)
-Different versions of @code{_AS__} for different computers will
-recognize different instructions. In fact, the same symbol may
-represent a different instruction in a different computer's assembly
-language.@refill
-_fi__(_GENERIC__)
-
-@cindex @code{:} (label)
-@cindex label (@code{:})
-A label is a symbol immediately followed by a colon (@code{:}).
-Whitespace before a label or after a colon is permitted, but you may not
-have whitespace between a label's symbol and its colon. @xref{Labels}.
-
-@smallexample
-label: .directive followed by something
-another_label: # This is an empty statement.
- instruction operand_1, operand_2, @dots{}
-@end smallexample
-
-@node Constants, , Statements, Syntax
-@section Constants
-
-@cindex constants
-A constant is a number, written so that its value is known by
-inspection, without knowing any context. Like this:
-@smallexample
-.byte 74, 0112, 092, 0x4A, 0X4a, 'J, '\J # All the same value.
-.ascii "Ring the bell\7" # A string constant.
-.octa 0x123456789abcdef0123456789ABCDEF0 # A bignum.
-.float 0f-314159265358979323846264338327\
-95028841971.693993751E-40 # - pi, a flonum.
-@end smallexample
-
-@menu
-* Characters:: Character Constants
-* Numbers:: Number Constants
-@end menu
-
-@node Characters, Numbers, Constants, Constants
-@subsection Character Constants
-
-@cindex character constants
-@cindex constants, character
-There are two kinds of character constants. A @dfn{character} stands
-for one character in one byte and its value may be used in
-numeric expressions. String constants (properly called string
-@emph{literals}) are potentially many bytes and their values may not be
-used in arithmetic expressions.
-
-@menu
-* Strings:: Strings
-* Chars:: Characters
-@end menu
-
-@node Strings, Chars, Characters, Characters
-@subsubsection Strings
-
-@cindex string constants
-@cindex constants, string
-A @dfn{string} is written between double-quotes. It may contain
-double-quotes or null characters. The way to get special characters
-into a string is to @dfn{escape} these characters: precede them with
-a backslash @samp{\} character. For example @samp{\\} represents
-one backslash: the first @code{\} is an escape which tells
-@code{_AS__} to interpret the second character literally as a backslash
-(which prevents @code{_AS__} from recognizing the second @code{\} as an
-escape character). The complete list of escapes follows.
-
-@cindex escape codes, character
-@cindex character escape codes
-@table @kbd
-@c @item \a
-@c Mnemonic for ACKnowledge; for ASCII this is octal code 007.
-@c
-@item \b
-@cindex @code{\b} (backspace character)
-@cindex backspace (@code{\b})
-Mnemonic for backspace; for ASCII this is octal code 010.
-
-@c @item \e
-@c Mnemonic for EOText; for ASCII this is octal code 004.
-@c
-@item \f
-@cindex @code{\f} (formfeed character)
-@cindex formfeed (@code{\f})
-Mnemonic for FormFeed; for ASCII this is octal code 014.
-
-@item \n
-@cindex @code{\n} (newline character)
-@cindex newline (@code{\n})
-Mnemonic for newline; for ASCII this is octal code 012.
-
-@c @item \p
-@c Mnemonic for prefix; for ASCII this is octal code 033, usually known as @code{escape}.
-@c
-@item \r
-@cindex @code{\r} (carriage return character)
-@cindex carriage return (@code{\r})
-Mnemonic for carriage-Return; for ASCII this is octal code 015.
-
-@c @item \s
-@c Mnemonic for space; for ASCII this is octal code 040. Included for compliance with
-@c other assemblers.
-@c
-@item \t
-@cindex @code{\t} (tab)
-@cindex tab (@code{\t})
-Mnemonic for horizontal Tab; for ASCII this is octal code 011.
-
-@c @item \v
-@c Mnemonic for Vertical tab; for ASCII this is octal code 013.
-@c @item \x @var{digit} @var{digit} @var{digit}
-@c A hexadecimal character code. The numeric code is 3 hexadecimal digits.
-@c
-@item \ @var{digit} @var{digit} @var{digit}
-@cindex @code{\@var{ddd}} (octal character code)
-@cindex octal character code (@code{\@var{ddd}})
-An octal character code. The numeric code is 3 octal digits.
-For compatibility with other Unix systems, 8 and 9 are accepted as digits:
-for example, @code{\008} has the value 010, and @code{\009} the value 011.
-
-@item \\
-@cindex @code{\\} (@samp{\} character)
-@cindex backslash (@code{\\})
-Represents one @samp{\} character.
-
-@c @item \'
-@c Represents one @samp{'} (accent acute) character.
-@c This is needed in single character literals
-@c (@xref{Characters,,Character Constants}.) to represent
-@c a @samp{'}.
-@c
-@item \"
-@cindex @code{\"} (doublequote character)
-@cindex doublequote (@code{\"})
-Represents one @samp{"} character. Needed in strings to represent
-this character, because an unescaped @samp{"} would end the string.
-
-@item \ @var{anything-else}
-Any other character when escaped by @kbd{\} will give a warning, but
-assemble as if the @samp{\} was not present. The idea is that if
-you used an escape sequence you clearly didn't want the literal
-interpretation of the following character. However @code{_AS__} has no
-other interpretation, so @code{_AS__} knows it is giving you the wrong
-code and warns you of the fact.
-@end table
-
-Which characters are escapable, and what those escapes represent,
-varies widely among assemblers. The current set is what we think
-the BSD 4.2 assembler recognizes, and is a subset of what most C
-compilers recognize. If you are in doubt, don't use an escape
-sequence.
-
-@node Chars, , Strings, Characters
-@subsubsection Characters
-
-@cindex single character constant
-@cindex character, single
-@cindex constant, single character
-A single character may be written as a single quote immediately
-followed by that character. The same escapes apply to characters as
-to strings. So if you want to write the character backslash, you
-must write @kbd{'\\} where the first @code{\} escapes the second
-@code{\}. As you can see, the quote is an acute accent, not a
-grave accent. A newline
-_if__(!_GENERIC__)
-_if__(!(_A29K__||_H8__))
-(or semicolon @samp{;})
-_fi__(!(_A29K__||_H8__))
-_if__(_A29K__)
-(or at sign @samp{@@})
-_fi__(_A29K__)
-_if__(_H8__)
-(or dollar sign @samp{$})
-_fi__(_H8__)
-_fi__(!_GENERIC__)
-immediately following an acute accent is taken as a literal character
-and does not count as the end of a statement. The value of a character
-constant in a numeric expression is the machine's byte-wide code for
-that character. @code{_AS__} assumes your character code is ASCII:
-@kbd{'A} means 65, @kbd{'B} means 66, and so on. @refill
-
-@node Numbers, , Characters, Constants
-@subsection Number Constants
-
-@cindex constants, number
-@cindex number constants
-@code{_AS__} distinguishes three kinds of numbers according to how they
-are stored in the target machine. @emph{Integers} are numbers that
-would fit into an @code{int} in the C language. @emph{Bignums} are
-integers, but they are stored in more than 32 bits. @emph{Flonums}
-are floating point numbers, described below.
-
-@menu
-* Integers:: Integers
-* Bignums:: Bignums
-* Flonums:: Flonums
-_if__(_I960__&&!_GENERIC__)
-* Bit Fields:: Bit Fields
-_fi__(_I960__&&!_GENERIC__)
-@end menu
-
-@node Integers, Bignums, Numbers, Numbers
-@subsubsection Integers
-@cindex integers
-@cindex constants, integer
-
-@cindex binary integers
-@cindex integers, binary
-A binary integer is @samp{0b} or @samp{0B} followed by zero or more of
-the binary digits @samp{01}.
-
-@cindex octal integers
-@cindex integers, octal
-An octal integer is @samp{0} followed by zero or more of the octal
-digits (@samp{01234567}).
-
-@cindex decimal integers
-@cindex integers, decimal
-A decimal integer starts with a non-zero digit followed by zero or
-more digits (@samp{0123456789}).
-
-@cindex hexadecimal integers
-@cindex integers, hexadecimal
-A hexadecimal integer is @samp{0x} or @samp{0X} followed by one or
-more hexadecimal digits chosen from @samp{0123456789abcdefABCDEF}.
-
-Integers have the usual values. To denote a negative integer, use
-the prefix operator @samp{-} discussed under expressions
-(@pxref{Prefix Ops,,Prefix Operators}).
-
-@node Bignums, Flonums, Integers, Numbers
-@subsubsection Bignums
-
-@cindex bignums
-@cindex constants, bignum
-A @dfn{bignum} has the same syntax and semantics as an integer
-except that the number (or its negative) takes more than 32 bits to
-represent in binary. The distinction is made because in some places
-integers are permitted while bignums are not.
-
-_if__(_I960__&&!_GENERIC__)
-@node Flonums, Bit Fields, Bignums, Numbers
-_fi__(_I960__&&!_GENERIC__)
-_if__(_GENERIC__||!_I960__)
-@node Flonums, , Bignums, Numbers
-_fi__(_GENERIC__||!_I960__)
-@subsubsection Flonums
-@cindex flonums
-@cindex floating point numbers
-@cindex constants, floating point
-
-@cindex precision, floating point
-A @dfn{flonum} represents a floating point number. The translation is
-indirect: a decimal floating point number from the text is converted by
-@code{_AS__} to a generic binary floating point number of more than
-sufficient precision. This generic floating point number is converted
-to a particular computer's floating point format (or formats) by a
-portion of @code{_AS__} specialized to that computer.
-
-A flonum is written by writing (in order)
-@itemize @bullet
-@item
-The digit @samp{0}.
-@item
-A letter, to tell @code{_AS__} the rest of the number is a flonum.
-_if__(_GENERIC__)
-@kbd{e} is recommended. Case is not important.
-@ignore
-@c FIXME: verify if flonum syntax really this vague for most cases
- (Any otherwise illegal letter
-will work here, but that might be changed. Vax BSD 4.2 assembler seems
-to allow any of @samp{defghDEFGH}.)
-@end ignore
-_fi__(_GENERIC__)
-_if__(_A29K__||_H8__)
-_if__(_GENERIC__)
-On the AMD 29K and H8/300 architectures, the letter must be:
-_fi__(_GENERIC__)
-One of the letters @samp{DFPRSX} (in upper or lower case).
-_fi__(_A29K__||_H8__)
-_if__(_I960__)
-_if__(_GENERIC__)
-On the Intel 960 architecture, the letter must be:
-_fi__(_GENERIC__)
-One of the letters @samp{DFT} (in upper or lower case).
-_fi__(_I960__)
-@item
-An optional sign: either @samp{+} or @samp{-}.
-@item
-An optional @dfn{integer part}: zero or more decimal digits.
-@item
-An optional @dfn{fractional part}: @samp{.} followed by zero
-or more decimal digits.
-@item
-An optional exponent, consisting of:
-@itemize @bullet
-@item
-An @samp{E} or @samp{e}.
-@c I can't find a config where "EXP_CHARS" is other than 'eE', but in
-@c principle this can perfectly well be different on different targets.
-@item
-Optional sign: either @samp{+} or @samp{-}.
-@item
-One or more decimal digits.
-@end itemize
-@end itemize
-
-At least one of the integer part or the fractional part must be
-present. The floating point number has the usual base-10 value.
-
-@code{_AS__} does all processing using integers. Flonums are computed
-independently of any floating point hardware in the computer running
-@code{_AS__}.
-
-_if__(_I960__&&!_GENERIC__)
-@c Bit fields are written as a general facility but are also controlled
-@c by a conditional-compilation flag---which is as of now (21mar91)
-@c turned on only by the i960 config of GAS.
-@node Bit Fields, , Flonums, Numbers
-@subsubsection Bit Fields
-
-@cindex bit fields
-@cindex constants, bit field
-You can also define numeric constants as @dfn{bit fields}.
-specify two numbers separated by a colon---
-@example
-@var{mask}:@var{value}
-@end example
-@noindent
-the first will act as a mask; @code{_AS__} will bitwise-and it with the
-second value.
-
-The resulting number is then packed
-_if__(_GENERIC__)
-@c this conditional paren in case bit fields turned on elsewhere than 960
-(in host-dependent byte order)
-_fi__(_GENERIC__)
-into a field whose width depends on which assembler directive has the
-bit-field as its argument. Overflow (a result from the bitwise and
-requiring more binary digits to represent) is not an error; instead,
-more constants are generated, of the specified width, beginning with the
-least significant digits.@refill
-
-The directives @code{.byte}, @code{.hword}, @code{.int}, @code{.long},
-@code{.short}, and @code{.word} accept bit-field arguments.
-_fi__(_I960__&&!_GENERIC__)
-
-@node Sections, Symbols, Syntax, Top
-@chapter Sections and Relocation
-@cindex sections
-@cindex relocation
-
-@menu
-* Secs Background:: Background
-* _LD__ Sections:: _LD__ Sections
-* _AS__ Sections:: _AS__ Internal Sections
-* Sub-Sections:: Sub-Sections
-* bss:: bss Section
-@end menu
-
-@node Secs Background, _LD__ Sections, Sections, Sections
-@section Background
-
-Roughly, a section is a range of addresses, with no gaps; all data
-``in'' those addresses is treated the same for some particular purpose.
-For example there may be a ``read only'' section.
-
-@cindex linker, and assembler
-@cindex assembler, and linker
-The linker @code{_LD__} reads many object files (partial programs) and
-combines their contents to form a runnable program. When @code{_AS__}
-emits an object file, the partial program is assumed to start at address
-0. @code{_LD__} will assign the final addresses the partial program
-occupies, so that different partial programs don't overlap. This is
-actually an over-simplification, but it will suffice to explain how
-@code{_AS__} uses sections.
-
-@code{_LD__} moves blocks of bytes of your program to their run-time
-addresses. These blocks slide to their run-time addresses as rigid
-units; their length does not change and neither does the order of bytes
-within them. Such a rigid unit is called a @emph{section}. Assigning
-run-time addresses to sections is called @dfn{relocation}. It includes
-the task of adjusting mentions of object-file addresses so they refer to
-the proper run-time addresses.
-_if__(_H8__)
-For the H8/300, @code{_AS__} pads sections if needed to ensure they end
-on a word (sixteen bit) boundary.
-_fi__(_H8__)
-
-@cindex standard @code{_AS__} sections
-An object file written by @code{_AS__} has at least three sections, any
-of which may be empty. These are named @dfn{text}, @dfn{data} and
-@dfn{bss} sections.
-
-_if__(_COFF__)
-_if__(_GENERIC__)
-When it generates COFF output,
-_fi__(_GENERIC__)
-@code{_AS__} can also generate whatever other named sections you specify
-using the @samp{.section} directive (@pxref{Section,,@code{.section}}).
-If you don't use any directives that place output in the @samp{.text}
-or @samp{.data} sections, these sections will still exist, but will be empty.
-_fi__(_COFF__)
-
-Within the object file, the text section starts at address @code{0}, the
-data section follows, and the bss section follows the data section.
-
-To let @code{_LD__} know which data will change when the sections are
-relocated, and how to change that data, @code{_AS__} also writes to the
-object file details of the relocation needed. To perform relocation
-@code{_LD__} must know, each time an address in the object
-file is mentioned:
-@itemize @bullet
-@item
-Where in the object file is the beginning of this reference to
-an address?
-@item
-How long (in bytes) is this reference?
-@item
-Which section does the address refer to? What is the numeric value of
-@display
-(@var{address}) @minus{} (@var{start-address of section})?
-@end display
-@item
-Is the reference to an address ``Program-Counter relative''?
-@end itemize
-
-@cindex addresses, format of
-@cindex section-relative addressing
-In fact, every address @code{_AS__} ever uses is expressed as
-@display
-(@var{section}) + (@var{offset into section})
-@end display
-@noindent
-Further, every expression @code{_AS__} computes is of this section-relative
-nature. @dfn{Absolute expression} means an expression with section
-``absolute'' (@pxref{_LD__ Sections}). A @dfn{pass1 expression} means
-an expression with section ``pass1'' (@pxref{_AS__ Sections,,_AS__
-Internal Sections}). In this manual we use the notation @{@var{secname}
-@var{N}@} to mean ``offset @var{N} into section @var{secname}''.
-
-Apart from text, data and bss sections you need to know about the
-@dfn{absolute} section. When @code{_LD__} mixes partial programs,
-addresses in the absolute section remain unchanged. For example, address
-@code{@{absolute 0@}} is ``relocated'' to run-time address 0 by @code{_LD__}.
-Although two partial programs' data sections will not overlap addresses
-after linking, @emph{by definition} their absolute sections will overlap.
-Address @code{@{absolute@ 239@}} in one partial program will always be the same
-address when the program is running as address @code{@{absolute@ 239@}} in any
-other partial program.
-
-The idea of sections is extended to the @dfn{undefined} section. Any
-address whose section is unknown at assembly time is by definition
-rendered @{undefined @var{U}@}---where @var{U} will be filled in later.
-Since numbers are always defined, the only way to generate an undefined
-address is to mention an undefined symbol. A reference to a named
-common block would be such a symbol: its value is unknown at assembly
-time so it has section @emph{undefined}.
-
-By analogy the word @emph{section} is used to describe groups of sections in
-the linked program. @code{_LD__} puts all partial programs' text
-sections in contiguous addresses in the linked program. It is
-customary to refer to the @emph{text section} of a program, meaning all
-the addresses of all partial program's text sections. Likewise for
-data and bss sections.
-
-Some sections are manipulated by @code{_LD__}; others are invented for
-use of @code{_AS__} and have no meaning except during assembly.
-
-@node _LD__ Sections, _AS__ Sections, Secs Background, Sections
-@section _LD__ Sections
-@code{_LD__} deals with just four kinds of sections, summarized below.
-
-@table @strong
-
-_if__(_GENERIC__||_COFF__)
-@cindex named sections
-@cindex sections, named
-@item named sections
-_fi__(_GENERIC__||_COFF__)
-_if__(_AOUT__||_BOUT__)
-@cindex text section
-@cindex data section
-@item text section
-@itemx data section
-_fi__(_AOUT__||_BOUT__)
-These sections hold your program. @code{_AS__} and @code{_LD__} treat them as
-separate but equal sections. Anything you can say of one section is
-true another.
-_if__(_AOUT__||_BOUT__)
-When the program is running, however, it is
-customary for the text section to be unalterable. The
-text section is often shared among processes: it will contain
-instructions, constants and the like. The data section of a running
-program is usually alterable: for example, C variables would be stored
-in the data section.
-_fi__(_AOUT__||_BOUT__)
-
-@cindex bss section
-@item bss section
-This section contains zeroed bytes when your program begins running. It
-is used to hold unitialized variables or common storage. The length of
-each partial program's bss section is important, but because it starts
-out containing zeroed bytes there is no need to store explicit zero
-bytes in the object file. The bss section was invented to eliminate
-those explicit zeros from object files.
-
-@cindex absolute section
-@item absolute section
-Address 0 of this section is always ``relocated'' to runtime address 0.
-This is useful if you want to refer to an address that @code{_LD__} must
-not change when relocating. In this sense we speak of absolute
-addresses being ``unrelocatable'': they don't change during relocation.
-
-@cindex undefined section
-@item undefined section
-This ``section'' is a catch-all for address references to objects not in
-the preceding sections.
-@c FIXME: ref to some other doc on obj-file formats could go here.
-@end table
-
-@cindex relocation example
-An idealized example of three relocatable sections follows.
-_if__(_COFF__)
-The example uses the traditional section names @samp{.text} and @samp{.data}.
-_fi__(_COFF__)
-Memory addresses are on the horizontal axis.
-
-@c TEXI2ROFF-KILL
-@ifinfo
-@c END TEXI2ROFF-KILL
-@smallexample
- +-----+----+--+
-partial program # 1: |ttttt|dddd|00|
- +-----+----+--+
-
- text data bss
- seg. seg. seg.
-
- +---+---+---+
-partial program # 2: |TTT|DDD|000|
- +---+---+---+
-
- +--+---+-----+--+----+---+-----+~~
-linked program: | |TTT|ttttt| |dddd|DDD|00000|
- +--+---+-----+--+----+---+-----+~~
-
- addresses: 0 @dots{}
-@end smallexample
-@c TEXI2ROFF-KILL
-@end ifinfo
-@c FIXME make sure no page breaks inside figure!!
-@tex
-
-\line{\it Partial program \#1: \hfil}
-\line{\ibox{2.5cm}{\tt text}\ibox{2cm}{\tt data}\ibox{1cm}{\tt bss}\hfil}
-\line{\boxit{2.5cm}{\tt ttttt}\boxit{2cm}{\tt dddd}\boxit{1cm}{\tt 00}\hfil}
-
-\line{\it Partial program \#2: \hfil}
-\line{\ibox{1cm}{\tt text}\ibox{1.5cm}{\tt data}\ibox{1cm}{\tt bss}\hfil}
-\line{\boxit{1cm}{\tt TTT}\boxit{1.5cm}{\tt DDDD}\boxit{1cm}{\tt 000}\hfil}
-
-\line{\it linked program: \hfil}
-\line{\ibox{.5cm}{}\ibox{1cm}{\tt text}\ibox{2.5cm}{}\ibox{.75cm}{}\ibox{2cm}{\tt data}\ibox{1.5cm}{}\ibox{2cm}{\tt bss}\hfil}
-\line{\boxit{.5cm}{}\boxit{1cm}{\tt TTT}\boxit{2.5cm}{\tt
-ttttt}\boxit{.75cm}{}\boxit{2cm}{\tt dddd}\boxit{1.5cm}{\tt
-DDDD}\boxit{2cm}{\tt 00000}\ \dots\hfil}
-
-\line{\it addresses: \hfil}
-\line{0\dots\hfil}
-
-@end tex
-@c END TEXI2ROFF-KILL
-
-@node _AS__ Sections, Sub-Sections, _LD__ Sections, Sections
-@section _AS__ Internal Sections
-
-@cindex internal @code{_AS__} sections
-@cindex sections in messages, internal
-These sections are meant only for the internal use of @code{_AS__}. They
-have no meaning at run-time. You don't really need to know about these
-sections for most purposes; but they can be mentioned in @code{_AS__}
-warning messages, so it might be helpful to have an idea of their
-meanings to @code{_AS__}. These sections are used to permit the
-value of every expression in your assembly language program to be a
-section-relative address.
-
-@table @b
-@item absent
-@cindex absent (internal section)
-An expression was expected and none was found.
-
-@item ASSEMBLER-INTERNAL-LOGIC-ERROR!
-@cindex assembler internal logic error
-An internal assembler logic error has been found. This means there is a
-bug in the assembler.
-
-@item bignum/flonum
-@cindex bignum/flonum (internal section)
-If a number can't be written as a C @code{int} constant (a bignum or a
-flonum, but not an integer), it is recorded as belonging to this
-``section''. @code{_AS__} has to remember that a flonum or a bignum
-does not fit into 32 bits, and cannot be an argument (@pxref{Arguments})
-in an expression: this is done by making a flonum or bignum be in a
-separate internal section. This is purely for internal @code{_AS__}
-convenience; bignum/flonum section behaves similarly to absolute
-section.
-
-@item pass1 section
-@cindex pass1 (internal section)
-The expression was impossible to evaluate in the first pass. The
-assembler will attempt a second pass (second reading of the source) to
-evaluate the expression. Your expression mentioned an undefined symbol
-in a way that defies the one-pass (section + offset in section) assembly
-process. No compiler need emit such an expression.
-
-@quotation
-@emph{Warning:} the second pass is currently not implemented. @code{_AS__}
-will abort with an error message if one is required.
-@end quotation
-
-@item difference section
-@cindex difference (internal section)
-As an assist to the C compiler, expressions of the forms
-@display
- (@var{undefined symbol}) @minus{} (@var{expression})
- @var{something} @minus{} (@var{undefined symbol})
- (@var{undefined symbol}) @minus{} (@var{undefined symbol})
-@end display
-
-are permitted, and belong to the difference section. @code{_AS__}
-re-evaluates such expressions after the source file has been read and
-the symbol table built. If by that time there are no undefined symbols
-in the expression then the expression assumes a new section. The
-intention is to permit statements like
-@samp{.word label - base_of_table}
-to be assembled in one pass where both @code{label} and
-@code{base_of_table} are undefined. This is useful for compiling C and
-Algol switch statements, Pascal case statements, FORTRAN computed goto
-statements and the like.
-@c FIXME item debug
-@c FIXME item transfer[t] vector preload
-@c FIXME item transfer[t] vector postload
-@c FIXME item register
-@end table
-
-@node Sub-Sections, bss, _AS__ Sections, Sections
-@section Sub-Sections
-
-@cindex numbered subsections
-@cindex grouping data
-_if__(_AOUT__||_BOUT__)
-Assembled bytes
-_if__(_COFF__)
-conventionally
-_fi__(_COFF__)
-fall into two sections: text and data.
-_fi__(_AOUT__||_BOUT__)
-You may have separate groups of
-_if__(_COFF__||_GENERIC__)
-data in named sections
-_fi__(_COFF__||_GENERIC__)
-_if__((_AOUT__||_BOUT__)&&!_GENERIC__)
-text or data
-_fi__((_AOUT__||_BOUT__)&&!_GENERIC__)
-that you want to end up near to each other in the object
-file, even though they are not contiguous in the assembler source.
-@code{_AS__} allows you to use @dfn{subsections} for this purpose.
-Within each section, there can be numbered subsections with
-values from 0 to 8192. Objects assembled into the same subsection will
-be grouped with other objects in the same subsection when they are all
-put into the object file. For example, a compiler might want to store
-constants in the text section, but might not want to have them
-interspersed with the program being assembled. In this case, the
-compiler could issue a @samp{.text 0} before each section of code being
-output, and a @samp{.text 1} before each group of constants being output.
-
-Subsections are optional. If you don't use subsections, everything
-will be stored in subsection number zero.
-
-_if__(_GENERIC__)
-Each subsection is zero-padded up to a multiple of four bytes.
-(Subsections may be padded a different amount on different flavors
-of @code{_AS__}.)
-_fi__(_GENERIC__)
-_if__(!_GENERIC__)
-_if__(_H8__)
-On the H8/300 platform, each subsection is zero-padded to a word
-boundary (two bytes).
-_fi__(_H8__)
-_if__(_I960__)
-@c FIXME section padding (alignment)?
-@c Rich Pixley says padding here depends on target obj code format; that
-@c doesn't seem particularly useful to say without further elaboration,
-@c so for now I say nothing about it. If this is a generic BFD issue,
-@c these paragraphs might need to vanish from this manual, and be
-@c discussed in BFD chapter of binutils (or some such).
-_fi__(_I960__)
-_if__(_A29K__)
-On the AMD 29K family, no particular padding is added to section or
-subsection sizes; _AS__ forces no alignment on this platform.
-_fi__(_A29K__)
-_fi__(!_GENERIC__)
-
-Subsections appear in your object file in numeric order, lowest numbered
-to highest. (All this to be compatible with other people's assemblers.)
-The object file contains no representation of subsections; @code{_LD__} and
-other programs that manipulate object files will see no trace of them.
-They just see all your text subsections as a text section, and all your
-data subsections as a data section.
-
-To specify which subsection you want subsequent statements assembled
-into, use a numeric argument to specify it, in a @samp{.text
-@var{expression}} or a @samp{.data @var{expression}} statement.
-_if__(_COFF__)
-_if__(_GENERIC__)
-When generating COFF output, you
-_fi__(_GENERIC__)
-_if__(!_GENERIC__)
-You
-_fi__(!_GENERIC__)
-can also use an extra subsection
-argument with arbitrary named sections: @samp{.section @var{name},
-@var{expression}}.
-_fi__(_COFF__)
-@var{Expression} should be an absolute expression.
-(@xref{Expressions}.) If you just say @samp{.text} then @samp{.text 0}
-is assumed. Likewise @samp{.data} means @samp{.data 0}. Assembly
-begins in @code{text 0}. For instance:
-@smallexample
-.text 0 # The default subsection is text 0 anyway.
-.ascii "This lives in the first text subsection. *"
-.text 1
-.ascii "But this lives in the second text subsection."
-.data 0
-.ascii "This lives in the data section,"
-.ascii "in the first data subsection."
-.text 0
-.ascii "This lives in the first text section,"
-.ascii "immediately following the asterisk (*)."
-@end smallexample
-
-Each section has a @dfn{location counter} incremented by one for every
-byte assembled into that section. Because subsections are merely a
-convenience restricted to @code{_AS__} there is no concept of a subsection
-location counter. There is no way to directly manipulate a location
-counter---but the @code{.align} directive will change it, and any label
-definition will capture its current value. The location counter of the
-section that statements are being assembled into is said to be the
-@dfn{active} location counter.
-
-@node bss, , Sub-Sections, Sections
-@section bss Section
-
-@cindex bss section
-@cindex common variable storage
-The bss section is used for local common variable storage.
-You may allocate address space in the bss section, but you may
-not dictate data to load into it before your program executes. When
-your program starts running, all the contents of the bss
-section are zeroed bytes.
-
-Addresses in the bss section are allocated with special directives; you
-may not assemble anything directly into the bss section. Hence there
-are no bss subsections. @xref{Comm,,@code{.comm}},
-@pxref{Lcomm,,@code{.lcomm}}.
-
-@node Symbols, Expressions, Sections, Top
-@chapter Symbols
-
-@cindex symbols
-Symbols are a central concept: the programmer uses symbols to name
-things, the linker uses symbols to link, and the debugger uses symbols
-to debug.
-
-@quotation
-@cindex debuggers, and symbol order
-@emph{Warning:} @code{_AS__} does not place symbols in the object file in
-the same order they were declared. This may break some debuggers.
-@end quotation
-
-@menu
-* Labels:: Labels
-* Setting Symbols:: Giving Symbols Other Values
-* Symbol Names:: Symbol Names
-* Dot:: The Special Dot Symbol
-* Symbol Attributes:: Symbol Attributes
-@end menu
-
-@node Labels, Setting Symbols, Symbols, Symbols
-@section Labels
-
-@cindex labels
-A @dfn{label} is written as a symbol immediately followed by a colon
-@samp{:}. The symbol then represents the current value of the
-active location counter, and is, for example, a suitable instruction
-operand. You are warned if you use the same symbol to represent two
-different locations: the first definition overrides any other
-definitions.
-
-@node Setting Symbols, Symbol Names, Labels, Symbols
-@section Giving Symbols Other Values
-
-@cindex assigning values to symbols
-@cindex symbol values, assigning
-A symbol can be given an arbitrary value by writing a symbol, followed
-by an equals sign @samp{=}, followed by an expression
-(@pxref{Expressions}). This is equivalent to using the @code{.set}
-directive. @xref{Set,,@code{.set}}.
-
-@node Symbol Names, Dot, Setting Symbols, Symbols
-@section Symbol Names
-
-@cindex symbol names
-@cindex names, symbol
-Symbol names begin with a letter or with one of
-_if__(!_H8__)
-@samp{_.$}
-_fi__(!_H8__)
-_if__(_H8__)
-@samp{_.}
-_if__(_GENERIC__)
-(On most machines, you can also use @code{$} in symbol names; exceptions
-are noted in @ref{_MACH_DEP__}.)
-_fi__(_GENERIC__)
-_fi__(_H8__)
-That character may be followed by any string of digits, letters,
-_if__(!_H8__)
-underscores and dollar signs.
-_fi__(!_H8__)
-_if__(_H8__)
-_if__(_GENERIC__)
-dollar signs (unless otherwise noted in @ref{_MACH_DEP__}),
-_fi__(_GENERIC__)
-and underscores.
-_fi__(_H8__)
-Case of letters is significant:
-@code{foo} is a different symbol name than @code{Foo}.
-
-_if__(_A29K__)
-For the AMD 29K family, @samp{?} is also allowed in the
-body of a symbol name, though not at its beginning.
-_fi__(_A29K__)
-
-Each symbol has exactly one name. Each name in an assembly language
-program refers to exactly one symbol. You may use that symbol name any
-number of times in a program.
-
-@subheading Local Symbol Names
-
-@cindex local symbol names
-@cindex symbol names, local
-@cindex temporary symbol names
-@cindex symbol names, temporary
-Local symbols help compilers and programmers use names temporarily.
-There are ten local symbol names, which are re-used throughout the
-program. You may refer to them using the names @samp{0} @samp{1}
-@dots{} @samp{9}. To define a local symbol, write a label of the form
-@samp{@b{N}:} (where @b{N} represents any digit). To refer to the most
-recent previous definition of that symbol write @samp{@b{N}b}, using the
-same digit as when you defined the label. To refer to the next
-definition of a local label, write @samp{@b{N}f}---where @b{N} gives you
-a choice of 10 forward references. The @samp{b} stands for
-``backwards'' and the @samp{f} stands for ``forwards''.
-
-Local symbols are not emitted by the current GNU C compiler.
-
-There is no restriction on how you can use these labels, but
-remember that at any point in the assembly you can refer to at most
-10 prior local labels and to at most 10 forward local labels.
-
-Local symbol names are only a notation device. They are immediately
-transformed into more conventional symbol names before the assembler
-uses them. The symbol names stored in the symbol table, appearing in
-error messages and optionally emitted to the object file have these
-parts:
-
-@table @code
-@item L
-All local labels begin with @samp{L}. Normally both @code{_AS__} and
-@code{_LD__} forget symbols that start with @samp{L}. These labels are
-used for symbols you are never intended to see. If you give the
-@samp{-L} option then @code{_AS__} will retain these symbols in the
-object file. If you also instruct @code{_LD__} to retain these symbols,
-you may use them in debugging.
-
-@item @var{digit}
-If the label is written @samp{0:} then the digit is @samp{0}.
-If the label is written @samp{1:} then the digit is @samp{1}.
-And so on up through @samp{9:}.
-
-@item @ctrl{A}
-This unusual character is included so you don't accidentally invent
-a symbol of the same name. The character has ASCII value
-@samp{\001}.
-
-@item @emph{ordinal number}
-This is a serial number to keep the labels distinct. The first
-@samp{0:} gets the number @samp{1}; The 15th @samp{0:} gets the
-number @samp{15}; @emph{etc.}. Likewise for the other labels @samp{1:}
-through @samp{9:}.
-@end table
-
-For instance, the first @code{1:} is named @code{L1@ctrl{A}1}, the 44th
-@code{3:} is named @code{L3@ctrl{A}44}.
-
-@node Dot, Symbol Attributes, Symbol Names, Symbols
-@section The Special Dot Symbol
-
-@cindex dot (symbol)
-@cindex @code{.} (symbol)
-@cindex current address
-@cindex location counter
-The special symbol @samp{.} refers to the current address that
-@code{_AS__} is assembling into. Thus, the expression @samp{melvin:
-.long .} will cause @code{melvin} to contain its own address.
-Assigning a value to @code{.} is treated the same as a @code{.org}
-directive. Thus, the expression @samp{.=.+4} is the same as saying
-_if__(!_A29K__)
-@samp{.space 4}.
-_fi__(!_A29K__)
-_if__(_A29K__)
-@samp{.block 4}.
-_fi__(_A29K__)
-
-@node Symbol Attributes, , Dot, Symbols
-@section Symbol Attributes
-
-@cindex symbol attributes
-@cindex attributes, symbol
-Every symbol has, as well as its name, the attributes ``Value'' and
-``Type''. Depending on output format, symbols can also have auxiliary
-attributes.
-_if__(_INTERNALS__)
-The detailed definitions are in _0__<a.out.h>_1__.
-_fi__(_INTERNALS__)
-
-If you use a symbol without defining it, @code{_AS__} assumes zero for
-all these attributes, and probably won't warn you. This makes the
-symbol an externally defined symbol, which is generally what you
-would want.
-
-@menu
-* Symbol Value:: Value
-* Symbol Type:: Type
-_if__(_AOUT__||_BOUT__)
-_if__(_GENERIC__||!_BOUT__)
-* a.out Symbols:: Symbol Attributes: @code{a.out}
-_fi__(_GENERIC__||!_BOUT__)
-_if__(_BOUT__&&!_GENERIC__)
-* a.out Symbols:: Symbol Attributes: @code{a.out}, @code{b.out}
-_fi__(_BOUT__&&!_GENERIC__)
-_fi__(_AOUT__||_BOUT__)
-_if__(_COFF__)
-* COFF Symbols:: Symbol Attributes for COFF
-_fi__(_COFF__)
-@end menu
-
-@node Symbol Value, Symbol Type, Symbol Attributes, Symbol Attributes
-@subsection Value
-
-@cindex value of a symbol
-@cindex symbol value
-The value of a symbol is (usually) 32 bits. For a symbol which labels a
-location in the text, data, bss or absolute sections the value is the
-number of addresses from the start of that section to the label.
-Naturally for text, data and bss sections the value of a symbol changes
-as @code{_LD__} changes section base addresses during linking. Absolute
-symbols' values do not change during linking: that is why they are
-called absolute.
-
-The value of an undefined symbol is treated in a special way. If it is
-0 then the symbol is not defined in this assembler source program, and
-@code{_LD__} will try to determine its value from other programs it is
-linked with. You make this kind of symbol simply by mentioning a symbol
-name without defining it. A non-zero value represents a @code{.comm}
-common declaration. The value is how much common storage to reserve, in
-bytes (addresses). The symbol refers to the first address of the
-allocated storage.
-
-_if__(!(_AOUT__||_BOUT__))
-@node Symbol Type, COFF Symbols, Symbol Value, Symbol Attributes
-_fi__(!(_AOUT__||_BOUT__))
-_if__((_AOUT__||_BOUT__))
-@node Symbol Type, a.out Symbols, Symbol Value, Symbol Attributes
-_fi__((_AOUT__||_BOUT__))
-@subsection Type
-
-@cindex type of a symbol
-@cindex symbol type
-The type attribute of a symbol contains relocation (section)
-information, any flag settings indicating that a symbol is external, and
-(optionally), other information for linkers and debuggers. The exact
-format depends on the object-code output format in use.
-
-_if__(_AOUT__||_BOUT__)
-_if__(_COFF__)
-@node a.out Symbols, COFF Symbols, Symbol Type, Symbol Attributes
-_fi__(_COFF__)
-_if__(!_COFF__)
-@node a.out Symbols, , Symbol Type, Symbol Attributes
-_fi__(!_COFF__)
-_if__(_BOUT__&&!_GENERIC__)
-@subsection Symbol Attributes: @code{a.out}, @code{b.out}
-
-@cindex @code{b.out} symbol attributes
-@cindex symbol attributes, @code{b.out}
-These symbol attributes appear only when @code{_AS__} is configured for
-one of the Berkeley-descended object output formats.
-_fi__(_BOUT__&&!_GENERIC__)
-_if__(_GENERIC__||!_BOUT__)
-@subsection Symbol Attributes: @code{a.out}
-_fi__(_GENERIC__||!_BOUT__)
-
-@cindex @code{a.out} symbol attributes
-@cindex symbol attributes, @code{a.out}
-
-@menu
-* Symbol Desc:: Descriptor
-* Symbol Other:: Other
-@end menu
-
-@node Symbol Desc, Symbol Other, a.out Symbols, a.out Symbols
-@subsubsection Descriptor
-
-@cindex descriptor, of @code{a.out} symbol
-This is an arbitrary 16-bit value. You may establish a symbol's
-descriptor value by using a @code{.desc} statement
-(@pxref{Desc,,@code{.desc}}). A descriptor value means nothing to
-@code{_AS__}.
-
-@node Symbol Other, , Symbol Desc, a.out Symbols
-@subsubsection Other
-
-@cindex other attribute, of @code{a.out} symbol
-This is an arbitrary 8-bit value. It means nothing to @code{_AS__}.
-_fi__(_AOUT__||_BOUT__)
-
-_if__(_COFF__)
-_if__(!(_AOUT__||_BOUT__))
-@node COFF Symbols, , Symbol Type, Symbol Attributes
-_fi__(!(_AOUT__||_BOUT__))
-_if__(_AOUT__||_BOUT__)
-@node COFF Symbols, , a.out Symbols, Symbol Attributes
-_fi__(_AOUT__||_BOUT__)
-@subsection Symbol Attributes for COFF
-
-@cindex COFF symbol attributes
-@cindex symbol attributes, COFF
-
-The COFF format supports a multitude of auxiliary symbol attributes;
-like the primary symbol attributes, they are set between @code{.def} and
-@code{.endef} directives.
-
-@subsubsection Primary Attributes
-
-@cindex primary attributes, COFF symbols
-The symbol name is set with @code{.def}; the value and type,
-respectively, with @code{.val} and @code{.type}.
-
-@subsubsection Auxiliary Attributes
-
-@cindex auxiliary attributes, COFF symbols
-The @code{_AS__} directives @code{.dim}, @code{.line}, @code{.scl},
-@code{.size}, and @code{.tag} can generate auxiliary symbol table
-information for COFF.
-_fi__(_COFF__)
-
-@node Expressions, Pseudo Ops, Symbols, Top
-@chapter Expressions
-
-@cindex expressions
-@cindex addresses
-@cindex numeric values
-An @dfn{expression} specifies an address or numeric value.
-Whitespace may precede and/or follow an expression.
-
-@menu
-* Empty Exprs:: Empty Expressions
-* Integer Exprs:: Integer Expressions
-@end menu
-
-@node Empty Exprs, Integer Exprs, Expressions, Expressions
-@section Empty Expressions
-
-@cindex empty expressions
-@cindex expressions, empty
-An empty expression has no value: it is just whitespace or null.
-Wherever an absolute expression is required, you may omit the
-expression and @code{_AS__} will assume a value of (absolute) 0. This
-is compatible with other assemblers.
-
-@node Integer Exprs, , Empty Exprs, Expressions
-@section Integer Expressions
-
-@cindex integer expressions
-@cindex expressions, integer
-An @dfn{integer expression} is one or more @emph{arguments} delimited
-by @emph{operators}.
-
-@menu
-* Arguments:: Arguments
-* Operators:: Operators
-* Prefix Ops:: Prefix Operators
-* Infix Ops:: Infix Operators
-@end menu
-
-@node Arguments, Operators, Integer Exprs, Integer Exprs
-@subsection Arguments
-
-@cindex expression arguments
-@cindex arguments in expressions
-@cindex operands in expressions
-@cindex arithmetic operands
-@dfn{Arguments} are symbols, numbers or subexpressions. In other
-contexts arguments are sometimes called ``arithmetic operands''. In
-this manual, to avoid confusing them with the ``instruction operands'' of
-the machine language, we use the term ``argument'' to refer to parts of
-expressions only, reserving the word ``operand'' to refer only to machine
-instruction operands.
-
-Symbols are evaluated to yield @{@var{section} @var{NNN}@} where
-@var{section} is one of text, data, bss, absolute,
-or undefined. @var{NNN} is a signed, 2's complement 32 bit
-integer.
-
-Numbers are usually integers.
-
-A number can be a flonum or bignum. In this case, you are warned
-that only the low order 32 bits are used, and @code{_AS__} pretends
-these 32 bits are an integer. You may write integer-manipulating
-instructions that act on exotic constants, compatible with other
-assemblers.
-
-@cindex subexpressions
-Subexpressions are a left parenthesis @samp{(} followed by an integer
-expression, followed by a right parenthesis @samp{)}; or a prefix
-operator followed by an argument.
-
-@node Operators, Prefix Ops, Arguments, Integer Exprs
-@subsection Operators
-
-@cindex operators, in expressions
-@cindex arithmetic functions
-@cindex functions, in expressions
-@dfn{Operators} are arithmetic functions, like @code{+} or @code{%}. Prefix
-operators are followed by an argument. Infix operators appear
-between their arguments. Operators may be preceded and/or followed by
-whitespace.
-
-@node Prefix Ops, Infix Ops, Operators, Integer Exprs
-@subsection Prefix Operator
-
-@cindex prefix operators
-@code{_AS__} has the following @dfn{prefix operators}. They each take
-one argument, which must be absolute.
-
-@c the tex/end tex stuff surrounding this small table is meant to make
-@c it align, on the printed page, with the similar table in the next
-@c section (which is inside an enumerate).
-@tex
-\global\advance\leftskip by \itemindent
-@end tex
-
-@table @code
-@item -
-@dfn{Negation}. Two's complement negation.
-@item ~
-@dfn{Complementation}. Bitwise not.
-@end table
-
-@tex
-\global\advance\leftskip by -\itemindent
-@end tex
-
-@node Infix Ops, , Prefix Ops, Integer Exprs
-@subsection Infix Operators
-
-@cindex infix operators
-@cindex operators, permitted arguments
-@dfn{Infix operators} take two arguments, one on either side. Operators
-have precedence, but operations with equal precedence are performed left
-to right. Apart from @code{+} or @code{-}, both arguments must be
-absolute, and the result is absolute.
-
-@enumerate
-@cindex operator precedence
-@cindex precedence of operators
-
-@item
-Highest Precedence
-
-@table @code
-@item *
-@dfn{Multiplication}.
-
-@item /
-@dfn{Division}. Truncation is the same as the C operator @samp{/}
-
-@item %
-@dfn{Remainder}.
-
-@item _0__<_1__
-@itemx _0__<<_1__
-@dfn{Shift Left}. Same as the C operator @samp{_0__<<_1__}
-
-@item _0__>_1__
-@itemx _0__>>_1__
-@dfn{Shift Right}. Same as the C operator @samp{_0__>>_1__}
-@end table
-
-@item
-Intermediate precedence
-
-@table @code
-@item |
-
-@dfn{Bitwise Inclusive Or}.
-
-@item &
-@dfn{Bitwise And}.
-
-@item ^
-@dfn{Bitwise Exclusive Or}.
-
-@item !
-@dfn{Bitwise Or Not}.
-@end table
-
-@item
-Lowest Precedence
-
-@table @code
-@item +
-@cindex addition, permitted arguments
-@cindex plus, permitted arguments
-@cindex arguments for addition
-@dfn{Addition}. If either argument is absolute, the result
-has the section of the other argument.
-If either argument is pass1 or undefined, the result is pass1.
-Otherwise @code{+} is illegal.
-
-@item -
-@cindex subtraction, permitted arguments
-@cindex minus, permitted arguments
-@cindex arguments for subtraction
-@dfn{Subtraction}. If the right argument is absolute, the
-result has the section of the left argument.
-If either argument is pass1 the result is pass1.
-If either argument is undefined the result is difference section.
-If both arguments are in the same section, the result is absolute---provided
-that section is one of text, data or bss.
-Otherwise subtraction is illegal.
-@end table
-@end enumerate
-
-The sense of the rule for addition is that it's only meaningful to add
-the @emph{offsets} in an address; you can only have a defined section in
-one of the two arguments.
-
-Similarly, you can't subtract quantities from two different sections.
-
-@node Pseudo Ops, _MACH_DEP__, Expressions, Top
-@chapter Assembler Directives
-
-@cindex directives, machine independent
-@cindex pseudo-ops, machine independent
-@cindex machine independent directives
-All assembler directives have names that begin with a period (@samp{.}).
-The rest of the name is letters, usually in lower case.
-
-This chapter discusses directives present regardless of the target
-machine configuration for the GNU assembler.
-_if__(!_H8__)
-@xref{_MACH_DEP__} for additional directives.
-_fi__(!_H8__)
-
-@menu
-* Abort:: @code{.abort}
-_if__(_COFF__)
-* coff-ABORT:: @code{.ABORT}
-_fi__(_COFF__)
-_if__(_BOUT__&&!_COFF__)
-* bout-ABORT:: @code{.ABORT}
-_fi__(_BOUT__&&!_COFF__)
-* Align:: @code{.align @var{abs-expr} , @var{abs-expr}}
-* App-File:: @code{.app-file @var{string}}
-* Ascii:: @code{.ascii "@var{string}"}@dots{}
-* Asciz:: @code{.asciz "@var{string}"}@dots{}
-* Byte:: @code{.byte @var{expressions}}
-* Comm:: @code{.comm @var{symbol} , @var{length} }
-* Data:: @code{.data @var{subsection}}
-_if__(_COFF__||_BOUT__)
-* Def:: @code{.def @var{name}}
-_fi__(_COFF__||_BOUT__)
-_if__(_AOUT__||_BOUT__)
-* Desc:: @code{.desc @var{symbol}, @var{abs-expression}}
-_fi__(_AOUT__||_BOUT__)
-_if__(_COFF__||_BOUT__)
-* Dim:: @code{.dim}
-_fi__(_COFF__||_BOUT__)
-* Double:: @code{.double @var{flonums}}
-* Eject:: @code{.eject}
-* Else:: @code{.else}
-_if__(_COFF__||_BOUT__)
-* Endef:: @code{.endef}
-_fi__(_COFF__||_BOUT__)
-* Endif:: @code{.endif}
-* Equ:: @code{.equ @var{symbol}, @var{expression}}
-* Extern:: @code{.extern}
-_if__(_GENERIC__||!_A29K__)
-* File:: @code{.file @var{string}}
-_fi__(_GENERIC__||!_A29K__)
-* Fill:: @code{.fill @var{repeat} , @var{size} , @var{value}}
-* Float:: @code{.float @var{flonums}}
-* Global:: @code{.global @var{symbol}}, @code{.globl @var{symbol}}
-* hword:: @code{.hword @var{expressions}}
-* Ident:: @code{.ident}
-* If:: @code{.if @var{absolute expression}}
-* Include:: @code{.include "@var{file}"}
-* Int:: @code{.int @var{expressions}}
-* Lcomm:: @code{.lcomm @var{symbol} , @var{length}}
-* Lflags:: @code{.lflags}
-_if__(_GENERIC__||!_A29K__)
-* Line:: @code{.line @var{line-number}}
-_fi__(_GENERIC__||!_A29K__)
-* Ln:: @code{.ln @var{line-number}}
-* List:: @code{.list}
-* Long:: @code{.long @var{expressions}}
-* Lsym:: @code{.lsym @var{symbol}, @var{expression}}
-* Nolist:: @code{.nolist}
-* Octa:: @code{.octa @var{bignums}}
-* Org:: @code{.org @var{new-lc} , @var{fill}}
-* Psize:: @code{.psize @var{lines}, @var{columns}}
-* Quad:: @code{.quad @var{bignums}}
-* Sbttl:: @code{.sbttl "@var{subheading}"}
-_if__(_COFF__||_BOUT__)
-* Scl:: @code{.scl @var{class}}
-_fi__(_COFF__||_BOUT__)
-_if__(_COFF__)
-* Section:: @code{.section @var{name}, @var{subsection}}
-_fi__(_COFF__)
-* Set:: @code{.set @var{symbol}, @var{expression}}
-* Short:: @code{.short @var{expressions}}
-* Single:: @code{.single @var{flonums}}
-_if__(_COFF__||_BOUT__)
-* Size:: @code{.size}
-_fi__(_COFF__||_BOUT__)
-* Space:: @code{.space @var{size} , @var{fill}}
-_if__(_GENERIC__||!_H8__)
-* Stab:: @code{.stabd, .stabn, .stabs}
-_fi__(_GENERIC__||!_H8__)
-_if__(_COFF__||_BOUT__)
-* Tag:: @code{.tag @var{structname}}
-_fi__(_COFF__||_BOUT__)
-* Text:: @code{.text @var{subsection}}
-* Title:: @code{.title "@var{heading}"}
-_if__(_COFF__||_BOUT__)
-* Type:: @code{.type @var{int}}
-* Val:: @code{.val @var{addr}}
-_fi__(_COFF__||_BOUT__)
-* Word:: @code{.word @var{expressions}}
-* Deprecated:: Deprecated Directives
-@end menu
-
-_if__(_COFF__)
-@node Abort, coff-ABORT, Pseudo Ops, Pseudo Ops
-_fi__(_COFF__)
-_if__((!_COFF__) && _BOUT__)
-@node Abort, bout-ABORT, Pseudo Ops, Pseudo Ops
-_fi__((!_COFF__) && _BOUT__)
-_if__(! (_BOUT__ || _COFF__) )
-@node Abort, Align, Pseudo Ops, Pseudo Ops
-_fi__(! (_BOUT__ || _COFF__) )
-@section @code{.abort}
-
-@cindex @code{abort} directive
-@cindex stopping the assembly
-This directive stops the assembly immediately. It is for
-compatibility with other assemblers. The original idea was that the
-assembly language source would be piped into the assembler. If the sender
-of the source quit, it could use this directive tells @code{_AS__} to
-quit also. One day @code{.abort} will not be supported.
-
-_if__(_COFF__)
-@node coff-ABORT, Align, Abort, Pseudo Ops
-@section @code{.ABORT}
-
-@cindex @code{ABORT} directive
-When producing COFF output, @code{_AS__} accepts this directive as a
-synonym for @samp{.abort}.
-_fi__(_COFF__)
-
-_if__(_BOUT__)
-_if__(!_COFF__)
-@node bout-ABORT, Align, Abort, Pseudo Ops
-@section @code{.ABORT}
-
-@cindex @code{ABORT} directive
-_fi__(!_COFF__)
-
-When producing @code{b.out} output, @code{_AS__} accepts this directive,
-but ignores it.
-_fi__(_BOUT__)
-
-_if__( ! (_COFF__ || _BOUT__) )
-@node Align, App-File, Abort, Pseudo Ops
-_fi__( ! (_COFF__ || _BOUT__) )
-_if__( _COFF__)
-@node Align, App-File, coff-ABORT, Pseudo Ops
-_fi__( _COFF__)
-_if__( _BOUT__ && (! _COFF__))
-@node Align, App-File, bout-ABORT, Pseudo Ops
-_fi__( _BOUT__ && (! _COFF__))
-@section @code{.align @var{abs-expr} , @var{abs-expr}}
-
-@cindex padding the location counter
-@cindex advancing location counter
-@cindex location counter, advancing
-@cindex @code{align} directive
-Pad the location counter (in the current subsection) to a particular
-storage boundary. The first expression (which must be absolute) is the
-number of low-order zero bits the location counter will have after
-advancement. For example @samp{.align 3} will advance the location
-counter until it a multiple of 8. If the location counter is already a
-multiple of 8, no change is needed.
-
-The second expression (also absolute) gives the value to be stored in
-the padding bytes. It (and the comma) may be omitted. If it is
-omitted, the padding bytes are zero.
-
-@node App-File, Ascii, Align, Pseudo Ops
-@section @code{.app-file @var{string}}
-
-@cindex logical file name
-@cindex file name, logical
-@cindex @code{app-file} directive
-@code{.app-file}
-_if__(!_A29K__)
-(which may also be spelled @samp{.file})
-_fi__(!_A29K__)
-tells @code{_AS__} that we are about to start a new
-logical file. @var{string} is the new file name. In general, the
-filename is recognized whether or not it is surrounded by quotes @samp{"};
-but if you wish to specify an empty file name is permitted,
-you must give the quotes--@code{""}. This statement may go away in
-future: it is only recognized to be compatible with old @code{_AS__}
-programs.@refill
-
-@node Ascii, Asciz, App-File, Pseudo Ops
-@section @code{.ascii "@var{string}"}@dots{}
-
-@cindex @code{ascii} directive
-@cindex string literals
-@code{.ascii} expects zero or more string literals (@pxref{Strings})
-separated by commas. It assembles each string (with no automatic
-trailing zero byte) into consecutive addresses.
-
-@node Asciz, Byte, Ascii, Pseudo Ops
-@section @code{.asciz "@var{string}"}@dots{}
-
-@cindex @code{asciz} directive
-@cindex zero-terminated strings
-@cindex null-terminated strings
-@code{.asciz} is just like @code{.ascii}, but each string is followed by
-a zero byte. The ``z'' in @samp{.asciz} stands for ``zero''.
-
-@node Byte, Comm, Asciz, Pseudo Ops
-@section @code{.byte @var{expressions}}
-
-@cindex @code{byte} directive
-@cindex integers, one byte
-@code{.byte} expects zero or more expressions, separated by commas.
-Each expression is assembled into the next byte.
-
-@node Comm, Data, Byte, Pseudo Ops
-@section @code{.comm @var{symbol} , @var{length} }
-
-@cindex @code{comm} directive
-@cindex symbol, common
-@code{.comm} declares a named common area in the bss section. Normally
-@code{_LD__} reserves memory addresses for it during linking, so no partial
-program defines the location of the symbol. Use @code{.comm} to tell
-@code{_LD__} that it must be at least @var{length} bytes long. @code{_LD__}
-will allocate space for each @code{.comm} symbol that is at least as
-long as the longest @code{.comm} request in any of the partial programs
-linked. @var{length} is an absolute expression.
-
-_if__(_COFF__ || _BOUT__)
-@node Data, Def, Comm, Pseudo Ops
-_fi__(_COFF__ || _BOUT__)
-_if__(!(_COFF__ || _BOUT__) && _AOUT__)
-@node Data, Desc, Comm, Pseudo Ops
-_fi__(!(_COFF__ || _BOUT__) && _AOUT__)
-_if__(! (_COFF__ || _BOUT__ || _AOUT__) )
-@c Well, this *might* happen...
-@node Data, Double, Comm, Pseudo Ops
-_fi__(! (_COFF__ || _BOUT__ || _AOUT__) )
-@section @code{.data @var{subsection}}
-
-@cindex @code{data} directive
-@code{.data} tells @code{_AS__} to assemble the following statements onto the
-end of the data subsection numbered @var{subsection} (which is an
-absolute expression). If @var{subsection} is omitted, it defaults
-to zero.
-
-_if__(_COFF__ || _BOUT__)
-_if__(_AOUT__ || _BOUT__)
-@node Def, Desc, Data, Pseudo Ops
-_fi__(_AOUT__ || _BOUT__)
-_if__(!(_AOUT__ || _BOUT__))
-@node Def, Dim, Data, Pseudo Ops
-_fi__(!(_AOUT__ || _BOUT__))
-@section @code{.def @var{name}}
-
-@cindex @code{def} directive
-@cindex COFF symbols, debugging
-@cindex debugging COFF symbols
-Begin defining debugging information for a symbol @var{name}; the
-definition extends until the @code{.endef} directive is encountered.
-_if__(_BOUT__)
-
-This directive is only observed when @code{_AS__} is configured for COFF
-format output; when producing @code{b.out}, @samp{.def} is recognized,
-but ignored.
-_fi__(_BOUT__)
-_fi__(_COFF__ || _BOUT__)
-
-_if__(_AOUT__||_BOUT__)
-_if__(_COFF__||_BOUT__)
-@node Desc, Dim, Def, Pseudo Ops
-_fi__(_COFF__||_BOUT__)
-_if__(!(_COFF__||_BOUT__))
-@node Desc, Double, Data, Pseudo Ops
-_fi__(!(_COFF__||_BOUT__))
-@section @code{.desc @var{symbol}, @var{abs-expression}}
-
-@cindex @code{desc} directive
-@cindex COFF symbol descriptor
-@cindex symbol descriptor, COFF
-This directive sets the descriptor of the symbol (@pxref{Symbol Attributes})
-to the low 16 bits of an absolute expression.
-
-_if__(_COFF__)
-The @samp{.desc} directive is not available when @code{_AS__} is
-configured for COFF output; it is only for @code{a.out} or @code{b.out}
-object format. For the sake of compatibility, @code{_AS__} will accept
-it, but produce no output, when configured for COFF.
-_fi__(_COFF__)
-_fi__(_AOUT__||_BOUT__)
-
-_if__(_COFF__ || _BOUT__)
-_if__(_AOUT__ || _BOUT__)
-@node Dim, Double, Desc, Pseudo Ops
-_fi__(_AOUT__ || _BOUT__)
-_if__(!(_AOUT__ || _BOUT__))
-@node Dim, Double, Def, Pseudo Ops
-_fi__(!(_AOUT__ || _BOUT__))
-@section @code{.dim}
-
-@cindex @code{dim} directive
-@cindex COFF auxiliary symbol information
-@cindex auxiliary symbol information, COFF
-This directive is generated by compilers to include auxiliary debugging
-information in the symbol table. It is only permitted inside
-@code{.def}/@code{.endef} pairs.
-_if__(_BOUT__)
-
-@samp{.dim} is only meaningful when generating COFF format output; when
-@code{_AS__} is generating @code{b.out}, it accepts this directive but
-ignores it.
-_fi__(_BOUT__)
-_fi__(_COFF__ || _BOUT__)
-
-_if__(_COFF__||_BOUT__)
-@node Double, Eject, Dim, Pseudo Ops
-_fi__(_COFF__||_BOUT__)
-_if__(!(_COFF__||_BOUT__))
-@node Double, Eject, Desc, Pseudo Ops
-_fi__(!(_COFF__||_BOUT__))
-@section @code{.double @var{flonums}}
-
-@cindex @code{double} directive
-@cindex floating point numbers (double)
-@code{.double} expects zero or more flonums, separated by commas. It
-assembles floating point numbers.
-_if__(_GENERIC__)
-The exact kind of floating point numbers emitted depends on how
-@code{_AS__} is configured. @xref{_MACH_DEP__}.
-_fi__(_GENERIC__)
-_if__((!_GENERIC__) && _IEEEFLOAT__)
-On the _HOST__ family @samp{.double} emits 64-bit floating-point numbers
-in @sc{ieee} format.
-_fi__((!_GENERIC__) && _IEEEFLOAT__)
-
-@node Eject, Else, Double, Pseudo Ops
-@section @code{.eject}
-
-@cindex @code{eject} directive
-@cindex new page, in listings
-@cindex page, in listings
-@cindex listing control: new page
-Force a page break at this point, when generating assembly listings.
-
-_if__(_COFF__||_BOUT__)
-@node Else, Endef, Eject, Pseudo Ops
-_fi__(_COFF__||_BOUT__)
-_if__(!(_COFF__||_BOUT__))
-@node Else, Endif, Eject, Pseudo Ops
-_fi__(!(_COFF__||_BOUT__))
-@section @code{.else}
-
-@cindex @code{else} directive
-@code{.else} is part of the @code{_AS__} support for conditional
-assembly; @pxref{If,,@code{.if}}. It marks the beginning of a section
-of code to be assembled if the condition for the preceding @code{.if}
-was false.
-
-_if__(0)
-@node End, Endef, Else, Pseudo Ops
-@section @code{.end}
-
-@cindex @code{end} directive
-This doesn't do anything---but isn't an s_ignore, so I suspect it's
-meant to do something eventually (which is why it isn't documented here
-as "for compatibility with blah").
-_fi__(0)
-
-_if__(_COFF__||_BOUT__)
-@node Endef, Endif, Else, Pseudo Ops
-@section @code{.endef}
-
-@cindex @code{endef} directive
-This directive flags the end of a symbol definition begun with
-@code{.def}.
-_if__(_BOUT__)
-
-@samp{.endef} is only meaningful when generating COFF format output; if
-@code{_AS__} is configured to generate @code{b.out}, it accepts this
-directive but ignores it.
-_fi__(_BOUT__)
-_fi__(_COFF__||_BOUT__)
-
-_if__(_COFF__||_BOUT__)
-@node Endif, Equ, Endef, Pseudo Ops
-_fi__(_COFF__||_BOUT__)
-_if__(!(_COFF__||_BOUT__))
-@node Endif, Equ, Else, Pseudo Ops
-_fi__(!(_COFF__||_BOUT__))
-@section @code{.endif}
-
-@cindex @code{endif} directive
-@code{.endif} is part of the @code{_AS__} support for conditional assembly;
-it marks the end of a block of code that is only assembled
-conditionally. @xref{If,,@code{.if}}.
-
-@node Equ, Extern, Endif, Pseudo Ops
-@section @code{.equ @var{symbol}, @var{expression}}
-
-@cindex @code{equ} directive
-@cindex assigning values to symbols
-@cindex symbols, assigning values to
-This directive sets the value of @var{symbol} to @var{expression}.
-It is synonymous with @samp{.set}; @pxref{Set,,@code{.set}}.
-
-_if__(_GENERIC__||!_A29K__)
-@node Extern, File, Equ, Pseudo Ops
-_fi__(_GENERIC__||!_A29K__)
-_if__(_A29K__&&!_GENERIC__)
-@node Extern, Fill, Equ, Pseudo Ops
-_fi__(_A29K__&&!_GENERIC__)
-@section @code{.extern}
-
-@cindex @code{extern} directive
-@code{.extern} is accepted in the source program---for compatibility
-with other assemblers---but it is ignored. @code{_AS__} treats
-all undefined symbols as external.
-
-_if__(_GENERIC__||!_A29K__)
-@node File, Fill, Extern, Pseudo Ops
-@section @code{.file @var{string}}
-
-@cindex @code{file} directive
-@cindex logical file name
-@cindex file name, logical
-@code{.file} (which may also be spelled @samp{.app-file}) tells
-@code{_AS__} that we are about to start a new logical file.
-@var{string} is the new file name. In general, the filename is
-recognized whether or not it is surrounded by quotes @samp{"}; but if
-you wish to specify an empty file name, you must give the
-quotes--@code{""}. This statement may go away in future: it is only
-recognized to be compatible with old @code{_AS__} programs.
-_if__(_A29K__)
-In some configurations of @code{_AS__}, @code{.file} has already been
-removed to avoid conflicts with other assemblers. @xref{_MACH_DEP__}.
-_fi__(_A29K__)
-_fi__(_GENERIC__||!_A29K__)
-
-_if__(_GENERIC__||!_A29K__)
-@node Fill, Float, File, Pseudo Ops
-_fi__(_GENERIC__||!_A29K__)
-_if__(_A29K__&&!_GENERIC__)
-@node Fill, Float, Extern, Pseudo Ops
-_fi__(_A29K__&&!_GENERIC__)
-@section @code{.fill @var{repeat} , @var{size} , @var{value}}
-
-@cindex @code{fill} directive
-@cindex writing patterns in memory
-@cindex patterns, writing in memory
-@var{result}, @var{size} and @var{value} are absolute expressions.
-This emits @var{repeat} copies of @var{size} bytes. @var{Repeat}
-may be zero or more. @var{Size} may be zero or more, but if it is
-more than 8, then it is deemed to have the value 8, compatible with
-other people's assemblers. The contents of each @var{repeat} bytes
-is taken from an 8-byte number. The highest order 4 bytes are
-zero. The lowest order 4 bytes are @var{value} rendered in the
-byte-order of an integer on the computer @code{_AS__} is assembling for.
-Each @var{size} bytes in a repetition is taken from the lowest order
-@var{size} bytes of this number. Again, this bizarre behavior is
-compatible with other people's assemblers.
-
-@var{size} and @var{value} are optional.
-If the second comma and @var{value} are absent, @var{value} is
-assumed zero. If the first comma and following tokens are absent,
-@var{size} is assumed to be 1.
-
-@node Float, Global, Fill, Pseudo Ops
-@section @code{.float @var{flonums}}
-
-@cindex floating point numbers (single)
-@cindex @code{float} directive
-This directive assembles zero or more flonums, separated by commas. It
-has the same effect as @code{.single}.
-_if__(_GENERIC__)
-The exact kind of floating point numbers emitted depends on how
-@code{_AS__} is configured.
-@xref{_MACH_DEP__}.
-_fi__(_GENERIC__)
-_if__((!_GENERIC__) && _IEEEFLOAT__)
-On the _HOST__ family, @code{.float} emits 32-bit floating point numbers
-in @sc{ieee} format.
-_fi__((!_GENERIC__) && _IEEEFLOAT__)
-
-@node Global, hword, Float, Pseudo Ops
-@section @code{.global @var{symbol}}, @code{.globl @var{symbol}}
-
-@cindex @code{global} directive
-@cindex symbol, making visible to linker
-@code{.global} makes the symbol visible to @code{_LD__}. If you define
-@var{symbol} in your partial program, its value is made available to
-other partial programs that are linked with it. Otherwise,
-@var{symbol} will take its attributes from a symbol of the same name
-from another partial program it is linked with.
-
-Both spellings (@samp{.globl} and @samp{.global}) are accepted, for
-compatibility with other assemblers.
-
-_if__(_AOUT__||_BOUT__||_COFF__)
-@node hword, Ident, Global, Pseudo Ops
-_fi__(_AOUT__||_BOUT__||_COFF__)
-_if__(!(_AOUT__||_BOUT__||_COFF__))
-@node hword, If, Global, Pseudo Ops
-_fi__(!(_AOUT__||_BOUT__||_COFF__))
-@section @code{.hword @var{expressions}}
-
-@cindex @code{hword} directive
-@cindex integers, 16-bit
-@cindex numbers, 16-bit
-@cindex sixteen bit integers
-This expects zero or more @var{expressions}, and emits
-a 16 bit number for each.
-
-_if__(_GENERIC__)
-This directive is a synonym for @samp{.short}; depending on the target
-architecture, it may also be a synonym for @samp{.word}.
-_fi__(_GENERIC__)
-_if__( _W32__ && !_GENERIC__ )
-This directive is a synonym for @samp{.short}.
-_fi__( _W32__ && !_GENERIC__ )
-_if__(_W16__ && !_GENERIC__ )
-This directive is a synonym for both @samp{.short} and @samp{.word}.
-_fi__(_W16__ && !_GENERIC__ )
-
-_if__(_AOUT__||_BOUT__||_COFF__)
-@node Ident, If, hword, Pseudo Ops
-@section @code{.ident}
-
-@cindex @code{ident} directive
-This directive is used by some assemblers to place tags in object files.
-@code{_AS__} simply accepts the directive for source-file
-compatibility with such assemblers, but does not actually emit anything
-for it.
-_fi__(_AOUT__||_BOUT__||_COFF__)
-
-_if__(_AOUT__||_BOUT__||_COFF__)
-@node If, Include, Ident, Pseudo Ops
-_fi__(_AOUT__||_BOUT__||_COFF__)
-_if__(!(_AOUT__||_BOUT__||_COFF__))
-@node If, Include, hword, Pseudo Ops
-_fi__(!(_AOUT__||_BOUT__||_COFF__))
-@section @code{.if @var{absolute expression}}
-
-@cindex conditional assembly
-@cindex @code{if} directive
-@code{.if} marks the beginning of a section of code which is only
-considered part of the source program being assembled if the argument
-(which must be an @var{absolute expression}) is non-zero. The end of
-the conditional section of code must be marked by @code{.endif}
-(@pxref{Endif,,@code{.endif}}); optionally, you may include code for the
-alternative condition, flagged by @code{.else} (@pxref{Else,,@code{.else}}.
-
-The following variants of @code{.if} are also supported:
-@table @code
-@item .ifdef @var{symbol}
-@cindex @code{ifdef} directive
-Assembles the following section of code if the specified @var{symbol}
-has been defined.
-
-_if__(0)
-@item .ifeqs
-@cindex @code{ifeqs} directive
-Not yet implemented.
-_fi__(0)
-
-@item .ifndef @var{symbol}
-@itemx ifnotdef @var{symbol}
-@cindex @code{ifndef} directive
-@cindex @code{ifnotdef} directive
-Assembles the following section of code if the specified @var{symbol}
-has not been defined. Both spelling variants are equivalent.
-
-_if__(0)
-@item ifnes
-Not yet implemented.
-_fi__(0)
-@end table
-
-@node Include, Int, If, Pseudo Ops
-@section @code{.include "@var{file}"}
-
-@cindex @code{include} directive
-@cindex supporting files, including
-@cindex files, including
-This directive provides a way to include supporting files at specified
-points in your source program. The code from @var{file} is assembled as
-if it followed the point of the @code{.include}; when the end of the
-included file is reached, assembly of the original file continues. You
-can control the search paths used with the @samp{-I} command-line option
-(@pxref{Invoking,,Command-Line Options}). Quotation marks are required
-around @var{file}.
-
-@node Int, Lcomm, Include, Pseudo Ops
-@section @code{.int @var{expressions}}
-
-@cindex @code{int} directive
-_if__(_GENERIC__||!_H8__)
-@cindex integers, 32-bit
-_fi__(_GENERIC__||!_H8__)
-Expect zero or more @var{expressions}, of any section, separated by
-commas. For each expression, emit a
-_if__(_GENERIC__||!_H8__)
-32-bit
-_fi__(_GENERIC__||!_H8__)
-_if__(_H8__&&!_GENERIC__)
-16-bit
-_fi__(_H8__&&!_GENERIC__)
-number that will, at run
-time, be the value of that expression. The byte order of the
-expression depends on what kind of computer will run the program.
-
-@node Lcomm, Lflags, Int, Pseudo Ops
-@section @code{.lcomm @var{symbol} , @var{length}}
-
-@cindex @code{lcomm} directive
-@cindex local common symbols
-@cindex symbols, local common
-Reserve @var{length} (an absolute expression) bytes for a local common
-denoted by @var{symbol}. The section and value of @var{symbol} are
-those of the new local common. The addresses are allocated in the bss
-section, so at run-time the bytes will start off zeroed. @var{Symbol}
-is not declared global (@pxref{Global,,@code{.global}}), so is normally
-not visible to @code{_LD__}.
-
-_if__(_GENERIC__||(!_A29K__))
-@node Lflags, Line, Lcomm, Pseudo Ops
-_fi__(_GENERIC__||(!_A29K__))
-_if__((!_GENERIC__)&& _A29K__)
-@node Lflags, Ln, Lcomm, Pseudo Ops
-_fi__((!_GENERIC__)&& _A29K__)
-@section @code{.lflags}
-
-@cindex @code{lflags} directive (ignored)
-@code{_AS__} accepts this directive, for compatibility with other
-assemblers, but ignores it.
-
-_if__(_GENERIC__ || !_A29K__)
-@node Line, Ln, Lflags, Pseudo Ops
-@section @code{.line @var{line-number}}
-
-@cindex @code{line} directive
-_fi__(_GENERIC__ || (!_A29K__))
-_if__(_A29K__ && (!_GENERIC__))
-@node Ln, List, Lflags, Pseudo Ops
-@section @code{.ln @var{line-number}}
-
-@cindex @code{ln} directive
-_fi__(_A29K__ && (!_GENERIC__))
-@cindex logical line number
-_if__(_AOUT__||_BOUT__)
-Tell @code{_AS__} to change the logical line number. @var{line-number} must be
-an absolute expression. The next line will have that logical line
-number. So any other statements on the current line (after a statement
-separator
-_if__(_GENERIC__)
-character)
-_fi__(_GENERIC__)
-_if__(!_GENERIC__)
-_if__(! (_A29K__||_H8__) )
-character @code{;})
-_fi__(! (_A29K__||_H8__) )
-_if__(_A29K__)
-character @samp{@@})
-_fi__(_A29K__)
-_if__(_H8__)
-character @samp{$})
-_fi__(_H8__)
-_fi__(!_GENERIC__)
-will be reported as on logical line number
-@var{line-number} @minus{} 1.
-One day this directive will be unsupported: it is used only
-for compatibility with existing assembler programs. @refill
-
-_if__(_GENERIC__ && _A29K__)
-@emph{Warning:} In the AMD29K configuration of _AS__, this command is
-only available with the name @code{.ln}, rather than as either
-@code{.line} or @code{.ln}.
-_fi__(_GENERIC__ && _A29K__)
-_fi__(_AOUT__||_BOUT__)
-_if__(_COFF__)
-
-Even though this is a directive associated with the @code{a.out} or
-@code{b.out} object-code formats, @code{_AS__} will still recognize it
-when producing COFF output, and will treat @samp{.line} as though it
-were the COFF @samp{.ln} @emph{if} it is found outside a
-@code{.def}/@code{.endef} pair.
-
-Inside a @code{.def}, @samp{.line} is, instead, one of the directives
-used by compilers to generate auxiliary symbol information for
-debugging.
-_fi__(_COFF__)
-
-_if__(_AOUT__&&(_GENERIC__||!_A29K__))
-@node Ln, List, Line, Pseudo Ops
-@section @code{.ln @var{line-number}}
-
-@cindex @code{ln} directive
-@samp{.ln} is a synonym for @samp{.line}.
-_fi__(_AOUT__&&(_GENERIC__||!_A29K__))
-_if__(_COFF__&&!_AOUT__)
-@node Ln, List, Line, Pseudo Ops
-@section @code{.ln @var{line-number}}
-
-@cindex @code{ln} directive
-Tell @code{_AS__} to change the logical line number. @var{line-number}
-must be an absolute expression. The next line will have that logical
-line number, so any other statements on the current line (after a
-statement separator character @code{;}) will be reported as on logical
-line number @var{line-number} @minus{} 1.
-_if__(_BOUT__)
-
-This directive is accepted, but ignored, when @code{_AS__} is configured for
-@code{b.out}; its effect is only associated with COFF output format.
-_fi__(_BOUT__)
-_fi__(_COFF__&&!_AOUT__)
-
-@node List, Long, Ln, Pseudo Ops
-@section @code{.list}
-
-@cindex @code{list} directive
-@cindex listing control, turning on
-Control (in conjunction with the @code{.nolist} directive) whether or
-not assembly listings are generated. These two directives maintain an
-internal counter (which is zero initially). @code{.list} increments the
-counter, and @code{.nolist} decrements it. Assembly listings are
-generated whenever the counter is greater than zero.
-
-By default, listings are disabled. When you enable them (with the
-@samp{-a} command line option; @pxref{Invoking,,Command-Line Options}),
-the initial value of the listing counter is one.
-
-@node Long, Lsym, List, Pseudo Ops
-@section @code{.long @var{expressions}}
-
-@cindex @code{long} directive
-@code{.long} is the same as @samp{.int}, @pxref{Int,,@code{.int}}.
-
-@node Lsym, Nolist, Long, Pseudo Ops
-@section @code{.lsym @var{symbol}, @var{expression}}
-
-@cindex @code{lsym} directive
-@cindex symbol, not referenced in assembly
-@code{.lsym} creates a new symbol named @var{symbol}, but does not put it in
-the hash table, ensuring it cannot be referenced by name during the
-rest of the assembly. This sets the attributes of the symbol to be
-the same as the expression value:
-@smallexample
-@var{other} = @var{descriptor} = 0
-@var{type} = @r{(section of @var{expression})}
-@var{value} = @var{expression}
-@end smallexample
-@noindent
-The new symbol is not flagged as external.
-
-@node Nolist, Octa, Lsym, Pseudo Ops
-@section @code{.nolist}
-
-@cindex @code{nolist} directive
-@cindex listing control, turning off
-Control (in conjunction with the @code{.list} directive) whether or
-not assembly listings are generated. These two directives maintain an
-internal counter (which is zero initially). @code{.list} increments the
-counter, and @code{.nolist} decrements it. Assembly listings are
-generated whenever the counter is greater than zero.
-
-@node Octa, Org, Nolist, Pseudo Ops
-@section @code{.octa @var{bignums}}
-
-@c FIXME: double size emitted for "octa" on i960, others? Or warn?
-@cindex @code{octa} directive
-@cindex integer, 16-byte
-@cindex sixteen byte integer
-This directive expects zero or more bignums, separated by commas. For each
-bignum, it emits a 16-byte integer.
-
-The term ``octa'' comes from contexts in which a ``word'' is two bytes;
-hence @emph{octa}-word for 16 bytes.
-
-@node Org, Psize, Octa, Pseudo Ops
-@section @code{.org @var{new-lc} , @var{fill}}
-
-@cindex @code{org} directive
-@cindex location counter, advancing
-@cindex advancing location counter
-@cindex current address, advancing
-@code{.org} will advance the location counter of the current section to
-@var{new-lc}. @var{new-lc} is either an absolute expression or an
-expression with the same section as the current subsection. That is,
-you can't use @code{.org} to cross sections: if @var{new-lc} has the
-wrong section, the @code{.org} directive is ignored. To be compatible
-with former assemblers, if the section of @var{new-lc} is absolute,
-@code{_AS__} will issue a warning, then pretend the section of @var{new-lc}
-is the same as the current subsection.
-
-@code{.org} may only increase the location counter, or leave it
-unchanged; you cannot use @code{.org} to move the location counter
-backwards.
-
-@c double negative used below "not undefined" because this is a specific
-@c reference to "undefined" (as SEG_UNKNOWN is called in this manual)
-@c section. pesch@cygnus.com 18feb91
-Because @code{_AS__} tries to assemble programs in one pass @var{new-lc}
-may not be undefined. If you really detest this restriction we eagerly await
-a chance to share your improved assembler.
-
-Beware that the origin is relative to the start of the section, not
-to the start of the subsection. This is compatible with other
-people's assemblers.
-
-When the location counter (of the current subsection) is advanced, the
-intervening bytes are filled with @var{fill} which should be an
-absolute expression. If the comma and @var{fill} are omitted,
-@var{fill} defaults to zero.
-
-@node Psize, Quad, Org, Pseudo Ops
-@section @code{.psize @var{lines} , @var{columns}}
-
-@cindex @code{psize} directive
-@cindex listing control: paper size
-@cindex paper size, for listings
-Use this directive to declare the number of lines---and, optionally, the
-number of columns---to use for each page, when generating listings.
-
-If you don't use @code{.psize}, listings will use a default line-count
-of 60. You may omit the comma and @var{columns} specification; the
-default width is 200 columns.
-
-@code{_AS__} will generate formfeeds whenever the specified number of
-lines is exceeded (or whenever you explicitly request one, using
-@code{.eject}).
-
-If you specify @var{lines} as @code{0}, no formfeeds are generated save
-those explicitly specified with @code{.eject}.
-
-@node Quad, Sbttl, Psize, Pseudo Ops
-@section @code{.quad @var{bignums}}
-
-@cindex @code{quad} directive
-@code{.quad} expects zero or more bignums, separated by commas. For
-each bignum, it emits
-_if__(_GENERIC__||(!_I960__))
-an 8-byte integer. If the bignum won't fit in 8
-bytes, it prints a warning message; and just takes the lowest order 8
-bytes of the bignum.@refill
-@cindex eight-byte integer
-@cindex integer, 8-byte
-
-The term ``quad'' comes from contexts in which a ``word'' is two bytes;
-hence @emph{quad}-word for 8 bytes.
-_fi__(_GENERIC__||(!_I960__))
-_if__(_I960__&&(!_GENERIC__))
-a 16-byte integer. If the bignum won't fit in 16 bytes, it prints a
-warning message; and just takes the lowest order 16 bytes of the
-bignum.@refill
-@cindex sixteen-byte integer
-@cindex integer, 16-byte
-_fi__(_I960__&&(!_GENERIC__))
-
-_if__(_COFF__||_BOUT__)
-@node Sbttl, Scl, Quad, Pseudo Ops
-_fi__(_COFF__||_BOUT__)
-_if__(!(_COFF__||_BOUT__))
-@node Sbttl, Set, Quad, Pseudo Ops
-_fi__(!(_COFF__||_BOUT__))
-@section @code{.sbttl "@var{subheading}"}
-
-@cindex @code{sbttl} directive
-@cindex subtitles for listings
-@cindex listing control: subtitle
-Use @var{subheading} as the title (third line, immediately after the
-title line) when generating assembly listings.
-
-This directive affects subsequent pages, as well as the current page if
-it appears within ten lines of the top of a page.
-
-_if__(_COFF__||_BOUT__)
-_if__(!_COFF__)
-@node Scl, Set, Sbttl, Pseudo Ops
-_fi__(!_COFF__)
-_if__(_COFF__)
-@node Scl, Section, Sbttl, Pseudo Ops
-_fi__(_COFF__)
-@section @code{.scl @var{class}}
-
-@cindex @code{scl} directive
-@cindex symbol storage class (COFF)
-@cindex COFF symbol storage class
-Set the storage-class value for a symbol. This directive may only be
-used inside a @code{.def}/@code{.endef} pair. Storage class may flag
-whether a symbol is static or external, or it may record further
-symbolic debugging information.
-_if__(_BOUT__)
-
-The @samp{.scl} directive is primarily associated with COFF output; when
-configured to generate @code{b.out} output format, @code{_AS__} will
-accept this directive but ignore it.
-_fi__(_BOUT__)
-_fi__(_COFF__||_BOUT__)
-
-_if__(_COFF__)
-@node Section, Set, Scl, Pseudo Ops
-@section @code{.section @var{name}, @var{subsection}}
-
-@cindex @code{section} directive
-@cindex named section (COFF)
-@cindex COFF named section
-Assemble the following code into end of subsection numbered
-@var{subsection} in the COFF named section @var{name}. If you omit
-@var{subsection}, @code{_AS__} uses subsection number zero.
-@samp{.section .text} is equivalent to the @code{.text} directive;
-@samp{.section .data} is equivalent to the @code{.data} directive.
-
-@node Set, Short, Section, Pseudo Ops
-_fi__(_COFF__)
-_if__(_BOUT__&&!_COFF__)
-@node Set, Short, Scl, Pseudo Ops
-_fi__(_BOUT__&&!_COFF__)
-_if__(!(_COFF__||_BOUT__))
-@node Set, Short, Quad, Pseudo Ops
-_fi__(!(_COFF__||_BOUT__))
-@section @code{.set @var{symbol}, @var{expression}}
-
-@cindex @code{set} directive
-@cindex symbol value, setting
-This directive sets the value of @var{symbol} to @var{expression}. This
-will change @var{symbol}'s value and type to conform to
-@var{expression}. If @var{symbol} was flagged as external, it remains
-flagged. (@xref{Symbol Attributes}.)
-
-You may @code{.set} a symbol many times in the same assembly.
-If the expression's section is unknowable during pass 1, a second
-pass over the source program will be forced. The second pass is
-currently not implemented. @code{_AS__} will abort with an error
-message if one is required.
-
-If you @code{.set} a global symbol, the value stored in the object
-file is the last value stored into it.
-
-@node Short, Single, Set, Pseudo Ops
-@section @code{.short @var{expressions}}
-
-@cindex @code{short} directive
-_if__(_GENERIC__ || _W16__)
-@code{.short} is the same as @samp{.word}. @xref{Word,,@code{.word}}.
-_if__(_W32__)
-In some configurations, however, @code{.short} and @code{.word} generate
-numbers of different lengths; @pxref{_MACH_DEP__}.
-_fi__(_W32__)
-_fi__(_GENERIC__|| _W16__)
-_if__((!_GENERIC__) && _W32__)
-This expects zero or more @var{expressions}, and emits
-a 16 bit number for each.
-_fi__((!_GENERIC__) && _W32__)
-_if__(_COFF__||_BOUT__)
-@node Single, Size, Short, Pseudo Ops
-_fi__(_COFF__||_BOUT__)
-_if__(!(_COFF__||_BOUT__))
-@node Single, Space, Short, Pseudo Ops
-_fi__(!(_COFF__||_BOUT__))
-@section @code{.single @var{flonums}}
-
-@cindex @code{single} directive
-@cindex floating point numbers (single)
-This directive assembles zero or more flonums, separated by commas. It
-has the same effect as @code{.float}.
-_if__(_GENERIC__)
-The exact kind of floating point numbers emitted depends on how
-@code{_AS__} is configured. @xref{_MACH_DEP__}.
-_fi__(_GENERIC__)
-_if__((!_GENERIC__) && _IEEEFLOAT__)
-On the _HOST__ family, @code{.single} emits 32-bit floating point
-numbers in @sc{ieee} format.
-_fi__((!_GENERIC__) && _IEEEFLOAT__)
-
-_if__(_COFF__||_BOUT__)
-@node Size, Space, Single, Pseudo Ops
-@section @code{.size}
-
-@cindex @code{size} directive
-This directive is generated by compilers to include auxiliary debugging
-information in the symbol table. It is only permitted inside
-@code{.def}/@code{.endef} pairs.
-_if__(_BOUT__)
-
-@samp{.size} is only meaningful when generating COFF format output; when
-@code{_AS__} is generating @code{b.out}, it accepts this directive but
-ignores it.
-_fi__(_BOUT__)
-_fi__(_COFF__||_BOUT__)
-
-_if__(_H8__&&!_GENERIC__)
-@node Space, Tag, Size, Pseudo Ops
-_fi__(_H8__&&!_GENERIC__)
-_if__(_GENERIC__||!_H8__)
-_if__(_COFF__||_BOUT__)
-@node Space, Stab, Size, Pseudo Ops
-_fi__(_COFF__||_BOUT__)
-_if__(!(_COFF__||_BOUT__))
-@node Space, Stab, Single, Pseudo Ops
-_fi__(!(_COFF__||_BOUT__))
-_fi__(_GENERIC__||!_H8__)
-_if__(_GENERIC__ || !_A29K__)
-@section @code{.space @var{size} , @var{fill}}
-
-@cindex @code{space} directive
-@cindex filling memory
-This directive emits @var{size} bytes, each of value @var{fill}. Both
-@var{size} and @var{fill} are absolute expressions. If the comma
-and @var{fill} are omitted, @var{fill} is assumed to be zero.
-_fi__(_GENERIC__ || !_A29K__)
-
-_if__(_A29K__)
-@section @code{.space}
-
-@cindex @code{space} directive
-On the AMD 29K, this directive is ignored; it is accepted for
-compatibility with other AMD 29K assemblers.
-
-@quotation
-@emph{Warning:} In other versions of the GNU assembler, the directive
-@code{.space} has the effect of @code{.block} @xref{_MACH_DEP__}.
-@end quotation
-_fi__(_A29K__)
-
-_if__(_GENERIC__||!_H8__)
-_if__(_AOUT__||_BOUT__||_COFF__)
-_if__(_COFF__||_BOUT__)
-@node Stab, Tag, Space, Pseudo Ops
-_fi__(_COFF__||_BOUT__)
-_if__(!(_COFF__||_BOUT__))
-@node Stab, Text, Space, Pseudo Ops
-_fi__(!(_COFF__||_BOUT__))
-@section @code{.stabd, .stabn, .stabs}
-
-@cindex symbolic debuggers, information for
-@cindex @code{stab@var{x}} directives
-There are three directives that begin @samp{.stab}.
-All emit symbols (@pxref{Symbols}), for use by symbolic debuggers.
-The symbols are not entered in the @code{_AS__} hash table: they
-cannot be referenced elsewhere in the source file.
-Up to five fields are required:
-@table @var
-@item string
-This is the symbol's name. It may contain any character except @samp{\000},
-so is more general than ordinary symbol names. Some debuggers used to
-code arbitrarily complex structures into symbol names using this field.
-@item type
-An absolute expression. The symbol's type is set to the low 8
-bits of this expression.
-Any bit pattern is permitted, but @code{_LD__} and debuggers will choke on
-silly bit patterns.
-@item other
-An absolute expression.
-The symbol's ``other'' attribute is set to the low 8 bits of this expression.
-@item desc
-An absolute expression.
-The symbol's descriptor is set to the low 16 bits of this expression.
-@item value
-An absolute expression which becomes the symbol's value.
-@end table
-
-If a warning is detected while reading a @code{.stabd}, @code{.stabn},
-or @code{.stabs} statement, the symbol has probably already been created
-and you will get a half-formed symbol in your object file. This is
-compatible with earlier assemblers!
-
-@table @code
-@cindex @code{stabd} directive
-@item .stabd @var{type} , @var{other} , @var{desc}
-
-The ``name'' of the symbol generated is not even an empty string.
-It is a null pointer, for compatibility. Older assemblers used a
-null pointer so they didn't waste space in object files with empty
-strings.
-
-The symbol's value is set to the location counter,
-relocatably. When your program is linked, the value of this symbol
-will be where the location counter was when the @code{.stabd} was
-assembled.
-
-@item .stabn @var{type} , @var{other} , @var{desc} , @var{value}
-@cindex @code{stabn} directive
-The name of the symbol is set to the empty string @code{""}.
-
-@item .stabs @var{string} , @var{type} , @var{other} , @var{desc} , @var{value}
-@cindex @code{stabs} directive
-All five fields are specified.
-@end table
-_fi__(_AOUT__||_BOUT__||_COFF__)
-_fi__(_GENERIC__||!_H8__)
-
-_if__(_COFF__||_BOUT__)
-_if__(_GENERIC__||!_H8__)
-@node Tag, Text, Stab, Pseudo Ops
-_fi__(_GENERIC__||!_H8__)
-_if__(_H8__&&!_GENERIC__)
-@node Tag, Text, Space, Pseudo Ops
-_fi__(_H8__&&!_GENERIC__)
-@section @code{.tag @var{structname}}
-
-@cindex COFF structure debugging
-@cindex structure debugging, COFF
-@cindex @code{tag} directive
-This directive is generated by compilers to include auxiliary debugging
-information in the symbol table. It is only permitted inside
-@code{.def}/@code{.endef} pairs. Tags are used to link structure
-definitions in the symbol table with instances of those structures.
-_if__(_BOUT__)
-
-@samp{.tag} is only used when generating COFF format output; when
-@code{_AS__} is generating @code{b.out}, it accepts this directive but
-ignores it.
-_fi__(_BOUT__)
-_fi__(_COFF__||_BOUT__)
-
-_if__(_COFF__||_BOUT__)
-@node Text, Title, Tag, Pseudo Ops
-_fi__(_COFF__||_BOUT__)
-_if__(!(_COFF__||_BOUT__))
-@node Text, Title, Stab, Pseudo Ops
-_fi__(!(_COFF__||_BOUT__))
-@section @code{.text @var{subsection}}
-
-@cindex @code{text} directive
-Tells @code{_AS__} to assemble the following statements onto the end of
-the text subsection numbered @var{subsection}, which is an absolute
-expression. If @var{subsection} is omitted, subsection number zero
-is used.
-
-_if__(_COFF__||_BOUT__)
-@node Title, Type, Text, Pseudo Ops
-_fi__(_COFF__||_BOUT__)
-_if__(!(_COFF__||_BOUT__))
-@node Title, Word, Text, Pseudo Ops
-_fi__(!(_COFF__||_BOUT__))
-@section @code{.title "@var{heading}"}
-
-@cindex @code{title} directive
-@cindex listing control: title line
-Use @var{heading} as the title (second line, immediately after the
-source file name and pagenumber) when generating assembly listings.
-
-This directive affects subsequent pages, as well as the current page if
-it appears within ten lines of the top of a page.
-
-_if__(_COFF__||_BOUT__)
-@node Type, Val, Title, Pseudo Ops
-@section @code{.type @var{int}}
-
-@cindex COFF symbol type
-@cindex symbol type, COFF
-@cindex @code{type} directive
-This directive, permitted only within @code{.def}/@code{.endef} pairs,
-records the integer @var{int} as the type attribute of a symbol table entry.
-_if__(_BOUT__)
-
-@samp{.type} is associated only with COFF format output; when
-@code{_AS__} is configured for @code{b.out} output, it accepts this
-directive but ignores it.
-_fi__(_BOUT__)
-_fi__(_COFF__||_BOUT__)
-
-_if__(_COFF__||_BOUT__)
-@node Val, Word, Type, Pseudo Ops
-@section @code{.val @var{addr}}
-
-@cindex @code{val} directive
-@cindex COFF value attribute
-@cindex value attribute, COFF
-This directive, permitted only within @code{.def}/@code{.endef} pairs,
-records the address @var{addr} as the value attribute of a symbol table
-entry.
-_if__(_BOUT__)
-
-@samp{.val} is used only for COFF output; when @code{_AS__} is
-configured for @code{b.out}, it accepts this directive but ignores it.
-_fi__(_BOUT__)
-_fi__(_COFF__||_BOUT__)
-
-_if__(_COFF__||_BOUT__)
-@node Word, Deprecated, Val, Pseudo Ops
-_fi__(_COFF__||_BOUT__)
-_if__(!(_COFF__||_BOUT__))
-@node Word, Deprecated, Text, Pseudo Ops
-_fi__(!(_COFF__||_BOUT__))
-@section @code{.word @var{expressions}}
-
-@cindex @code{word} directive
-This directive expects zero or more @var{expressions}, of any section,
-separated by commas.
-_if__((!_GENERIC__) && _W32__)
-For each expression, @code{_AS__} emits a 32-bit number.
-_fi__((!_GENERIC__) && _W32__)
-_if__((!_GENERIC__) && _W16__)
-For each expression, @code{_AS__} emits a 16-bit number.
-_fi__((!_GENERIC__) && _W16__)
-
-_if__(_GENERIC__)
-The size of the number emitted, and its byte order,
-depends on what kind of computer will run the program.
-_fi__(_GENERIC__)
-
-@c on amd29k, i960, sparc the "special treatment to support compilers" doesn't
-@c happen---32-bit addressability, period; no long/short jumps.
-_if__(_GENERIC__ || _DIFFTABKLUG__)
-@cindex difference tables altered
-@cindex altered difference tables
-@quotation
-@emph{Warning: Special Treatment to support Compilers}
-@end quotation
-
-_if__(_GENERIC__)
-Machines with a 32-bit address space, but that do less than 32-bit
-addressing, require the following special treatment. If the machine of
-interest to you does 32-bit addressing (or doesn't require it;
-@pxref{_MACH_DEP__}), you can ignore this issue.
-
-_fi__(_GENERIC__)
-In order to assemble compiler output into something that will work,
-@code{_AS__} will occasionlly do strange things to @samp{.word} directives.
-Directives of the form @samp{.word sym1-sym2} are often emitted by
-compilers as part of jump tables. Therefore, when @code{_AS__} assembles a
-directive of the form @samp{.word sym1-sym2}, and the difference between
-@code{sym1} and @code{sym2} does not fit in 16 bits, @code{_AS__} will
-create a @dfn{secondary jump table}, immediately before the next label.
-This secondary jump table will be preceded by a short-jump to the
-first byte after the secondary table. This short-jump prevents the flow
-of control from accidentally falling into the new table. Inside the
-table will be a long-jump to @code{sym2}. The original @samp{.word}
-will contain @code{sym1} minus the address of the long-jump to
-@code{sym2}.
-
-If there were several occurrences of @samp{.word sym1-sym2} before the
-secondary jump table, all of them will be adjusted. If there was a
-@samp{.word sym3-sym4}, that also did not fit in sixteen bits, a
-long-jump to @code{sym4} will be included in the secondary jump table,
-and the @code{.word} directives will be adjusted to contain @code{sym3}
-minus the address of the long-jump to @code{sym4}; and so on, for as many
-entries in the original jump table as necessary.
-
-_if__(_INTERNALS__)
-@emph{This feature may be disabled by compiling @code{_AS__} with the
-@samp{-DWORKING_DOT_WORD} option.} This feature is likely to confuse
-assembly language programmers.
-_fi__(_INTERNALS__)
-_fi__(_GENERIC__ || _DIFFTABKLUG__)
-
-@node Deprecated, , Word, Pseudo Ops
-@section Deprecated Directives
-
-@cindex deprecated directives
-@cindex obsolescent directives
-One day these directives won't work.
-They are included for compatibility with older assemblers.
-@table @t
-@item .abort
-@item .app-file
-@item .line
-@end table
-
-@node _MACH_DEP__, Copying, Pseudo Ops, Top
-_if__(_GENERIC__)
-@chapter Machine Dependent Features
-
-@cindex machine dependencies
-The machine instruction sets are (almost by definition) different on
-each machine where @code{_AS__} runs. Floating point representations
-vary as well, and @code{_AS__} often supports a few additional
-directives or command-line options for compatibility with other
-assemblers on a particular platform. Finally, some versions of
-@code{_AS__} support special pseudo-instructions for branch
-optimization.
-
-This chapter discusses most of these differences, though it does not
-include details on any machine's instruction set. For details on that
-subject, see the hardware manufacturer's manual.
-
-@menu
-_if__(_VAX__)
-* Vax-Dependent:: VAX Dependent Features
-_fi__(_VAX__)
-_if__(_A29K__)
-* AMD29K-Dependent:: AMD 29K Dependent Features
-_fi__(_A29K__)
-_if__(_H8__)
-* H8/300-Dependent:: AMD 29K Dependent Features
-_fi__(_H8__)
-_if__(_I960__)
-* i960-Dependent:: Intel 80960 Dependent Features
-_fi__(_I960__)
-_if__(_M680X0__)
-* M68K-Dependent:: M680x0 Dependent Features
-_fi__(_M680X0__)
-_if__(_SPARC__)
-* Sparc-Dependent:: SPARC Dependent Features
-_fi__(_SPARC__)
-_if__(_I80386__)
-* i386-Dependent:: 80386 Dependent Features
-_fi__(_I80386__)
-@end menu
-
-_fi__(_GENERIC__)
-_if__(_VAX__)
-_if__(_GENERIC__)
-@node Vax-Dependent, AMD29K-Dependent, Machine Dependent, Machine Dependent
-_fi__(_GENERIC__)
-_CHAPSEC__(0+_GENERIC__) VAX Dependent Features
-
-@cindex VAX support
-@menu
-* Vax-Opts:: VAX Command-Line Options
-* VAX-float:: VAX Floating Point
-* VAX-directives:: Vax Machine Directives
-* VAX-opcodes:: VAX Opcodes
-* VAX-branch:: VAX Branch Improvement
-* VAX-operands:: VAX Operands
-* VAX-no:: Not Supported on VAX
-@end menu
-
-@node Vax-Opts, VAX-float, Vax-Dependent, Vax-Dependent
-_CHAPSEC__(1+_GENERIC__) VAX Command-Line Options
-
-@cindex command-line options ignored, VAX
-@cindex VAX command-line options ignored
-The Vax version of @code{_AS__} accepts any of the following options,
-gives a warning message that the option was ignored and proceeds.
-These options are for compatibility with scripts designed for other
-people's assemblers.
-
-@table @asis
-@item @kbd{-D} (Debug)
-@itemx @kbd{-S} (Symbol Table)
-@itemx @kbd{-T} (Token Trace)
-@cindex @code{-D}, ignored on VAX
-@cindex @code{-S}, ignored on VAX
-@cindex @code{-T}, ignored on VAX
-These are obsolete options used to debug old assemblers.
-
-@item @kbd{-d} (Displacement size for JUMPs)
-@cindex @code{-d}, VAX option
-This option expects a number following the @kbd{-d}. Like options
-that expect filenames, the number may immediately follow the
-@kbd{-d} (old standard) or constitute the whole of the command line
-argument that follows @kbd{-d} (GNU standard).
-
-@item @kbd{-V} (Virtualize Interpass Temporary File)
-@cindex @code{-V}, redundant on VAX
-Some other assemblers use a temporary file. This option
-commanded them to keep the information in active memory rather
-than in a disk file. @code{_AS__} always does this, so this
-option is redundant.
-
-@item @kbd{-J} (JUMPify Longer Branches)
-@cindex @code{-J}, ignored on VAX
-Many 32-bit computers permit a variety of branch instructions
-to do the same job. Some of these instructions are short (and
-fast) but have a limited range; others are long (and slow) but
-can branch anywhere in virtual memory. Often there are 3
-flavors of branch: short, medium and long. Some other
-assemblers would emit short and medium branches, unless told by
-this option to emit short and long branches.
-
-@item @kbd{-t} (Temporary File Directory)
-@cindex @code{-t}, ignored on VAX
-Some other assemblers may use a temporary file, and this option
-takes a filename being the directory to site the temporary
-file. @code{_AS__} does not use a temporary disk file, so this
-option makes no difference. @kbd{-t} needs exactly one
-filename.
-@end table
-
-@cindex VMS (VAX) options
-@cindex options for VAX/VMS
-@cindex VAX/VMS options
-@cindex @code{-h} option, VAX/VMS
-@cindex @code{-+} option, VAX/VMS
-@cindex Vax-11 C compatibility
-@cindex symbols with lowercase, VAX/VMS
-@c FIXME! look into "I think" below, correct if needed, delete.
-The Vax version of the assembler accepts two options when
-compiled for VMS. They are @kbd{-h}, and @kbd{-+}. The
-@kbd{-h} option prevents @code{_AS__} from modifying the
-symbol-table entries for symbols that contain lowercase
-characters (I think). The @kbd{-+} option causes @code{_AS__} to
-print warning messages if the FILENAME part of the object file,
-or any symbol name is larger than 31 characters. The @kbd{-+}
-option also insertes some code following the @samp{_main}
-symbol so that the object file will be compatible with Vax-11
-"C".
-
-@node VAX-float, VAX-directives, Vax-Opts, Vax-Dependent
-_CHAPSEC__(1+_GENERIC__) VAX Floating Point
-
-@cindex VAX floating point
-@cindex floating point, VAX
-Conversion of flonums to floating point is correct, and
-compatible with previous assemblers. Rounding is
-towards zero if the remainder is exactly half the least significant bit.
-
-@code{D}, @code{F}, @code{G} and @code{H} floating point formats
-are understood.
-
-Immediate floating literals (@emph{e.g.} @samp{S`$6.9})
-are rendered correctly. Again, rounding is towards zero in the
-boundary case.
-
-@cindex @code{float} directive, VAX
-@cindex @code{double} directive, VAX
-The @code{.float} directive produces @code{f} format numbers.
-The @code{.double} directive produces @code{d} format numbers.
-
-@node VAX-directives, VAX-opcodes, VAX-float, Vax-Dependent
-_CHAPSEC__(1+_GENERIC__) Vax Machine Directives
-
-@cindex machine directives, VAX
-@cindex VAX machine directives
-The Vax version of the assembler supports four directives for
-generating Vax floating point constants. They are described in the
-table below.
-
-@cindex wide floating point directives, VAX
-@table @code
-@item .dfloat
-@cindex @code{dfloat} directive, VAX
-This expects zero or more flonums, separated by commas, and
-assembles Vax @code{d} format 64-bit floating point constants.
-
-@item .ffloat
-@cindex @code{ffloat} directive, VAX
-This expects zero or more flonums, separated by commas, and
-assembles Vax @code{f} format 32-bit floating point constants.
-
-@item .gfloat
-@cindex @code{gfloat} directive, VAX
-This expects zero or more flonums, separated by commas, and
-assembles Vax @code{g} format 64-bit floating point constants.
-
-@item .hfloat
-@cindex @code{hfloat} directive, VAX
-This expects zero or more flonums, separated by commas, and
-assembles Vax @code{h} format 128-bit floating point constants.
-
-@end table
-
-@node VAX-opcodes, VAX-branch, VAX-directives, Vax-Dependent
-_CHAPSEC__(1+_GENERIC__) VAX Opcodes
-
-@cindex VAX opcode mnemonics
-@cindex opcode mnemonics, VAX
-@cindex mnemonics for opcodes, VAX
-All DEC mnemonics are supported. Beware that @code{case@dots{}}
-instructions have exactly 3 operands. The dispatch table that
-follows the @code{case@dots{}} instruction should be made with
-@code{.word} statements. This is compatible with all unix
-assemblers we know of.
-
-@node VAX-branch, VAX-operands, VAX-opcodes, Vax-Dependent
-_CHAPSEC__(1+_GENERIC__) VAX Branch Improvement
-
-@cindex VAX branch improvement
-@cindex branch improvement, VAX
-@cindex pseudo-ops for branch, VAX
-Certain pseudo opcodes are permitted. They are for branch
-instructions. They expand to the shortest branch instruction that
-will reach the target. Generally these mnemonics are made by
-substituting @samp{j} for @samp{b} at the start of a DEC mnemonic.
-This feature is included both for compatibility and to help
-compilers. If you don't need this feature, don't use these
-opcodes. Here are the mnemonics, and the code they can expand into.
-
-@table @code
-@item jbsb
-@samp{Jsb} is already an instruction mnemonic, so we chose @samp{jbsb}.
-@table @asis
-@item (byte displacement)
-@kbd{bsbb @dots{}}
-@item (word displacement)
-@kbd{bsbw @dots{}}
-@item (long displacement)
-@kbd{jsb @dots{}}
-@end table
-@item jbr
-@itemx jr
-Unconditional branch.
-@table @asis
-@item (byte displacement)
-@kbd{brb @dots{}}
-@item (word displacement)
-@kbd{brw @dots{}}
-@item (long displacement)
-@kbd{jmp @dots{}}
-@end table
-@item j@var{COND}
-@var{COND} may be any one of the conditional branches
-@code{neq nequ eql eqlu gtr geq lss gtru lequ vc vs gequ cc lssu cs}.
-@var{COND} may also be one of the bit tests
-@code{bs bc bss bcs bsc bcc bssi bcci lbs lbc}.
-@var{NOTCOND} is the opposite condition to @var{COND}.
-@table @asis
-@item (byte displacement)
-@kbd{b@var{COND} @dots{}}
-@item (word displacement)
-@kbd{b@var{NOTCOND} foo ; brw @dots{} ; foo:}
-@item (long displacement)
-@kbd{b@var{NOTCOND} foo ; jmp @dots{} ; foo:}
-@end table
-@item jacb@var{X}
-@var{X} may be one of @code{b d f g h l w}.
-@table @asis
-@item (word displacement)
-@kbd{@var{OPCODE} @dots{}}
-@item (long displacement)
-@example
-@var{OPCODE} @dots{}, foo ;
-brb bar ;
-foo: jmp @dots{} ;
-bar:
-@end example
-@end table
-@item jaob@var{YYY}
-@var{YYY} may be one of @code{lss leq}.
-@item jsob@var{ZZZ}
-@var{ZZZ} may be one of @code{geq gtr}.
-@table @asis
-@item (byte displacement)
-@kbd{@var{OPCODE} @dots{}}
-@item (word displacement)
-@example
-@var{OPCODE} @dots{}, foo ;
-brb bar ;
-foo: brw @var{destination} ;
-bar:
-@end example
-@item (long displacement)
-@example
-@var{OPCODE} @dots{}, foo ;
-brb bar ;
-foo: jmp @var{destination} ;
-bar:
-@end example
-@end table
-@item aobleq
-@itemx aoblss
-@itemx sobgeq
-@itemx sobgtr
-@table @asis
-@item (byte displacement)
-@kbd{@var{OPCODE} @dots{}}
-@item (word displacement)
-@example
-@var{OPCODE} @dots{}, foo ;
-brb bar ;
-foo: brw @var{destination} ;
-bar:
-@end example
-@item (long displacement)
-@example
-@var{OPCODE} @dots{}, foo ;
-brb bar ;
-foo: jmp @var{destination} ;
-bar:
-@end example
-@end table
-@end table
-
-@node VAX-operands, VAX-no, VAX-branch, Vax-Dependent
-_CHAPSEC__(1+_GENERIC__) VAX Operands
-
-@cindex VAX operand notation
-@cindex operand notation, VAX
-@cindex immediate character, VAX
-@cindex VAX immediate character
-The immediate character is @samp{$} for Unix compatibility, not
-@samp{#} as DEC writes it.
-
-@cindex indirect character, VAX
-@cindex VAX indirect character
-The indirect character is @samp{*} for Unix compatibility, not
-@samp{@@} as DEC writes it.
-
-@cindex displacement sizing character, VAX
-@cindex VAX displacement sizing character
-The displacement sizing character is @samp{`} (an accent grave) for
-Unix compatibility, not @samp{^} as DEC writes it. The letter
-preceding @samp{`} may have either case. @samp{G} is not
-understood, but all other letters (@code{b i l s w}) are understood.
-
-@cindex register names, VAX
-@cindex VAX register names
-Register names understood are @code{r0 r1 r2 @dots{} r15 ap fp sp
-pc}. Any case of letters will do.
-
-For instance
-@smallexample
-tstb *w`$4(r5)
-@end smallexample
-
-Any expression is permitted in an operand. Operands are comma
-separated.
-
-@c There is some bug to do with recognizing expressions
-@c in operands, but I forget what it is. It is
-@c a syntax clash because () is used as an address mode
-@c and to encapsulate sub-expressions.
-
-@node VAX-no, , VAX-operands, Vax-Dependent
-_CHAPSEC__(1+_GENERIC__) Not Supported on VAX
-
-@cindex VAX bitfields not supported
-@cindex bitfields, not supported on VAX
-Vax bit fields can not be assembled with @code{_AS__}. Someone
-can add the required code if they really need it.
-
-_fi__(_VAX__)
-_if__(_A29K__)
-_if__(_GENERIC__)
-@node AMD29K-Dependent, H8/300-Dependent, Vax-Dependent, Machine Dependent
-_fi__(_GENERIC__)
-_CHAPSEC__(0+_GENERIC__) AMD 29K Dependent Features
-
-@cindex AMD 29K support
-@cindex 29K support
-@menu
-* AMD29K Options:: Options
-* AMD29K Syntax:: Syntax
-* AMD29K Floating Point:: Floating Point
-* AMD29K Directives:: AMD 29K Machine Directives
-* AMD29K Opcodes:: Opcodes
-@end menu
-
-@node AMD29K Options, AMD29K Syntax, AMD29K-Dependent, AMD29K-Dependent
-_CHAPSEC__(1+_GENERIC__) Options
-@cindex AMD 29K options (none)
-@cindex options for AMD29K (none)
-@code{_AS__} has no additional command-line options for the AMD
-29K family.
-
-@node AMD29K Syntax, AMD29K Floating Point, AMD29K Options, AMD29K-Dependent
-_CHAPSEC__(1+_GENERIC__) Syntax
-@menu
-* AMD29K-Chars:: Special Characters
-* AMD29K-Regs:: Register Names
-@end menu
-
-@node AMD29K-Chars, AMD29K-Regs, AMD29K Syntax, AMD29K Syntax
-_CHAPSEC__(2+_GENERIC__) Special Characters
-
-@cindex line comment character, AMD 29K
-@cindex AMD 29K line comment character
-@samp{;} is the line comment character.
-
-@cindex line separator, AMD 29K
-@cindex AMD 29K line separator
-@cindex statement separator, AMD 29K
-@cindex AMD 29K statement separator
-@samp{@@} can be used instead of a newline to separate statements.
-
-@cindex identifiers, AMD 29K
-@cindex AMD 29K identifiers
-The character @samp{?} is permitted in identifiers (but may not begin
-an identifier).
-
-@node AMD29K-Regs, , AMD29K-Chars, AMD29K Syntax
-_CHAPSEC__(2+_GENERIC__) Register Names
-
-@cindex AMD 29K register names
-@cindex register names, AMD 29K
-General-purpose registers are represented by predefined symbols of the
-form @samp{GR@var{nnn}} (for global registers) or @samp{LR@var{nnn}}
-(for local registers), where @var{nnn} represents a number between
-@code{0} and @code{127}, written with no leading zeros. The leading
-letters may be in either upper or lower case; for example, @samp{gr13}
-and @samp{LR7} are both valid register names.
-
-You may also refer to general-purpose registers by specifying the
-register number as the result of an expression (prefixed with @samp{%%}
-to flag the expression as a register number):
-@smallexample
-%%@var{expression}
-@end smallexample
-@noindent
----where @var{expression} must be an absolute expression evaluating to a
-number between @code{0} and @code{255}. The range [0, 127] refers to
-global registers, and the range [128, 255] to local registers.
-
-@cindex special purpose registers, AMD 29K
-@cindex AMD 29K special purpose registers
-@cindex protected registers, AMD 29K
-@cindex AMD 29K protected registers
-In addition, @code{_AS__} understands the following protected
-special-purpose register names for the AMD 29K family:
-
-@smallexample
- vab chd pc0
- ops chc pc1
- cps rbp pc2
- cfg tmc mmu
- cha tmr lru
-@end smallexample
-
-These unprotected special-purpose register names are also recognized:
-@smallexample
- ipc alu fpe
- ipa bp inte
- ipb fc fps
- q cr exop
-@end smallexample
-
-@node AMD29K Floating Point, AMD29K Directives, AMD29K Syntax, AMD29K-Dependent
-_CHAPSEC__(1+_GENERIC__) Floating Point
-
-@cindex floating point, AMD 29K (@sc{ieee})
-@cindex AMD 29K floating point (@sc{ieee})
-The AMD 29K family uses @sc{ieee} floating-point numbers.
-
-@node AMD29K Directives, AMD29K Opcodes, AMD29K Floating Point, AMD29K-Dependent
-_CHAPSEC__(1+_GENERIC__) AMD 29K Machine Directives
-
-@cindex machine directives, AMD 29K
-@cindex AMD 29K machine directives
-@table @code
-@item .block @var{size} , @var{fill}
-@cindex @code{block} directive, AMD 29K
-This directive emits @var{size} bytes, each of value @var{fill}. Both
-@var{size} and @var{fill} are absolute expressions. If the comma
-and @var{fill} are omitted, @var{fill} is assumed to be zero.
-
-In other versions of the GNU assembler, this directive is called
-@samp{.space}.
-@end table
-
-@table @code
-@item .cputype
-@cindex @code{cputype} directive, AMD 29K
-This directive is ignored; it is accepted for compatibility with other
-AMD 29K assemblers.
-
-@item .file
-@cindex @code{file} directive, AMD 29K
-This directive is ignored; it is accepted for compatibility with other
-AMD 29K assemblers.
-
-@quotation
-@emph{Warning:} in other versions of the GNU assembler, @code{.file} is
-used for the directive called @code{.app-file} in the AMD 29K support.
-@end quotation
-
-@item .line
-@cindex @code{line} directive, AMD 29K
-This directive is ignored; it is accepted for compatibility with other
-AMD 29K assemblers.
-
-@item .reg @var{symbol}, @var{expression}
-@cindex @code{reg} directive, AMD 29K
-@code{.reg} has the same effect as @code{.lsym}; @pxref{Lsym,,@code{.lsym}}.
-
-@item .sect
-@cindex @code{sect} directive, AMD 29K
-This directive is ignored; it is accepted for compatibility with other
-AMD 29K assemblers.
-
-@item .use @var{section name}
-@cindex @code{use} directive, AMD 29K
-Establishes the section and subsection for the following code;
-@var{section name} may be one of @code{.text}, @code{.data},
-@code{.data1}, or @code{.lit}. With one of the first three @var{section
-name} options, @samp{.use} is equivalent to the machine directive
-@var{section name}; the remaining case, @samp{.use .lit}, is the same as
-@samp{.data 200}.
-@end table
-
-@node AMD29K Opcodes, , AMD29K Directives, AMD29K-Dependent
-_CHAPSEC__(1+_GENERIC__) Opcodes
-
-@cindex AMD 29K opcodes
-@cindex opcodes for AMD 29K
-@code{_AS__} implements all the standard AMD 29K opcodes. No
-additional pseudo-instructions are needed on this family.
-
-For information on the 29K machine instruction set, see @cite{Am29000
-User's Manual}, Advanced Micro Devices, Inc.
-
-_fi__(_A29K__)
-_if__(_H8__)
-_if__(_GENERIC__)
-@node H8/300-Dependent, i960-Dependent, AMD29K-Dependent, Machine Dependent
-_fi__(_GENERIC__)
-_CHAPSEC__(0+_GENERIC__) H8/300 Dependent Features
-
-@cindex H8/300 support
-@menu
-* H8/300 Options:: Options
-* H8/300 Syntax:: Syntax
-* H8/300 Floating Point:: Floating Point
-* H8/300 Directives:: H8/300 Machine Directives
-* H8/300 Opcodes:: Opcodes
-@end menu
-
-@node H8/300 Options, H8/300 Syntax, H8/300-Dependent, H8/300-Dependent
-_CHAPSEC__(1+_GENERIC__) Options
-
-@cindex H8/300 options (none)
-@cindex options, H8/300 (none)
-@code{_AS__} has no additional command-line options for the Hitachi
-H8/300 family.
-
-@node H8/300 Syntax, H8/300 Floating Point, H8/300 Options, H8/300-Dependent
-_CHAPSEC__(1+_GENERIC__) Syntax
-@menu
-* H8/300-Chars:: Special Characters
-* H8/300-Regs:: Register Names
-* H8/300-Addressing:: Addressing Modes
-@end menu
-
-@node H8/300-Chars, H8/300-Regs, H8/300 Syntax, H8/300 Syntax
-_CHAPSEC__(2+_GENERIC__) Special Characters
-
-@cindex line comment character, H8/300
-@cindex H8/300 line comment character
-@samp{;} is the line comment character.
-
-@cindex line separator, H8/300
-@cindex statement separator, H8/300
-@cindex H8/300 line separator
-@samp{$} can be used instead of a newline to separate statements.
-Therefore @emph{you may not use @samp{$} in symbol names} on the H8/300.
-
-@node H8/300-Regs, H8/300-Addressing, H8/300-Chars, H8/300 Syntax
-_CHAPSEC__(2+_GENERIC__) Register Names
-
-@cindex H8/300 registers
-@cindex registers, H8/300
-You can use predefined symbols of the form @samp{r@var{n}h} and
-@samp{r@var{n}l} to refer to the H8/300 registers as sixteen 8-bit
-general-purpose registers. @var{n} is a digit from @samp{0} to
-@samp{7}); for instance, both @samp{r0h} and @samp{r7l} are valid
-register names.
-
-You can also use the eight predefined symbols @samp{r@var{n}} to refer
-to the H8/300 registers as 16-bit registers (you must use this form for
-addressing).
-
-The two control registers are called @code{pc} (program counter; a
-16-bit register) and @code{ccr} (condition code register; an 8-bit
-register). @code{r7} is used as the stack pointer, and can also be
-called @code{sp}.
-
-@node H8/300-Addressing, , H8/300-Regs, H8/300 Syntax
-_CHAPSEC__(2+_GENERIC__) Addressing Modes
-
-@cindex addressing modes, H8/300
-@cindex H8/300 addressing modes
-_AS__ understands the following addressing modes for the H8/300:
-@table @code
-@item r@var{n}
-Register direct
-
-@item @@r@var{n}
-Register indirect
-
-@item @@(@var{d}, r@var{n})
-@itemx @@(@var{d}:16, r@var{n})
-Register indirect: 16-bit displacement @var{d} from register @var{n}.
-(You may specify the @samp{:16} for clarity if you wish, but it is not
-required and has no effect.)
-
-@item @@r@var{n}+
-Register indirect with post-increment
-
-@item @@-r@var{n}
-Register indirect with pre-decrement
-
-@item @code{@@}@var{aa}
-@itemx @code{@@}@var{aa}:8
-@itemx @code{@@}@var{aa}:16
-Absolute address @code{aa}. You may specify the @samp{:8} or @samp{:16}
-for clarity, if you wish; but @code{_AS__} neither requires this nor
-uses it---the address size required is taken from context.
-
-@item #@var{xx}
-@itemx #@var{xx}:8
-@itemx #@var{xx}:16
-Immediate data @var{xx}. You may specify the @samp{:8} or @samp{:16}
-for clarity, if you wish; but @code{_AS__} neither requires this nor
-uses it---the data size required is taken from context.
-
-@item @code{@@}@code{@@}@var{aa}
-@itemx @code{@@}@code{@@}@var{aa}:8
-Memory indirect. You may specify the @samp{:8} for clarity, if you
-wish; but @code{_AS__} neither requires this nor uses it.
-@end table
-
-@node H8/300 Floating Point, H8/300 Directives, H8/300 Syntax, H8/300-Dependent
-_CHAPSEC__(1+_GENERIC__) Floating Point
-
-@cindex floating point, H8/300 (@sc{ieee})
-@cindex H8/300 floating point (@sc{ieee})
-The H8/300 family uses @sc{ieee} floating-point numbers.
-
-@node H8/300 Directives, H8/300 Opcodes, H8/300 Floating Point, H8/300-Dependent
-_CHAPSEC__(1+_GENERIC__) H8/300 Machine Directives
-
-@cindex H8/300 machine directives (none)
-@cindex machine directives, H8/300 (none)
-@cindex @code{word} directive, H8/300
-@cindex @code{int} directive, H8/300
-@code{_AS__} has no machine-dependent directives for the H8/300.
-However, on this platform the @samp{.int} and @samp{.word} directives
-generate 16-bit numbers.
-
-@node H8/300 Opcodes, , H8/300 Directives, H8/300-Dependent
-_CHAPSEC__(1+_GENERIC__) Opcodes
-
-@cindex H8/300 opcode summary
-@cindex opcode summary, H8/300
-@cindex mnemonics, H8/300
-@cindex instruction summary, H8/300
-For detailed information on the H8/300 machine instruction set, see
-@cite{H8/300 Series Programming Manual} (Hitachi ADE--602--025).
-
-@code{_AS__} implements all the standard H8/300 opcodes. No additional
-pseudo-instructions are needed on this family.
-
-The following table summarizes the opcodes and their arguments:
-@c kluge due to lack of group outside example
-@page
-@smallexample
-@group
- Rs @r{source register}
- Rd @r{destination register}
- imm @r{immediate data}
- x:3 @r{a bit (as a number between 0 and 7)}
- d:8 @r{eight bit displacement from @code{pc}}
- d:16 @r{sixteen bit displacement from @code{Rs}}
-
-add.b Rs,Rd biand #x:3,Rd
-add.b #imm:8,Rd biand #x:3,@@Rd
-add.w Rs,Rd biand #x:3,@@aa:8
-adds #1,Rd bild #x:3,Rd
-adds #2,Rd bild #x:3,@@Rd
-addx #imm:8,Rd bild #x:3,@@aa:8
-addx Rs,Rd bior #x:3,Rd
-and #imm:8,Rd bior #x:3,@@Rd
-and Rs,Rd bior #x:3,@@aa:8
-andc #imm:8,ccr bist #x:3,Rd
-band #x:3,Rd bist #x:3,@@Rd
-band #x:3,@@Rd bist #x:3,@@aa:8
-bra d:8 bixor #x:3,Rd
-bt d:8 bixor #x:3,@@Rd
-brn d:8 bixor #x:3,@@aa:8
-bf d:8 bld #x:3,Rd
-bhi d:8 bld #x:3,@@Rd
-bls d:8 bld #x:3,@@aa:8
-bcc d:8 bnot #x:3,Rd
-bhs d:8 bnot #x:3,@@Rd
-bcs d:8 bnot #x:3,@@aa:8
-blo d:8 bnot Rs,Rd
-bne d:8 bnot Rs,@@Rd
-beq d:8 bnot Rs,@@aa:8
-bvc d:8 bor #x:3,Rd
-bvs d:8 bor #x:3,@@Rd
-bpl d:8 bor #x:3,@@aa:8
-bmi d:8 bset #x:3,@@Rd
-bge d:8 bset #x:3,@@aa:8
-blt d:8 bset Rs,Rd
-bgt d:8 bset Rs,@@Rd
-ble d:8 bset Rs,@@aa:8
-bclr #x:3,Rd bsr d:8
-bclr #x:3,@@Rd bst #x:3,Rd
-bclr #x:3,@@aa:8 bst #x:3,@@Rd
-bclr Rs,Rd bst #x:3,@@aa:8
-bclr Rs,@@Rd btst #x:3,Rd
-@end group
-@group
-btst #x:3,@@Rd mov.w @@(d:16, Rs),Rd
-btst #x:3,@@aa:8 mov.w @@Rs+,Rd
-btst Rs,Rd mov.w @@aa:16,Rd
-btst Rs,@@Rd mov.w Rs,@@Rd
-btst Rs,@@aa:8 mov.w Rs,@@(d:16, Rd)
-bxor #x:3,Rd mov.w Rs,@@-Rd
-bxor #x:3,@@Rd mov.w Rs,@@aa:16
-bxor #x:3,@@aa:8 movfpe @@aa:16,Rd
-cmp.b #imm:8,Rd movtpe Rs,@@aa:16
-cmp.b Rs,Rd mulxu Rs,Rd
-cmp.w Rs,Rd neg Rs
-daa Rs nop
-das Rs not Rs
-dec Rs or #imm:8,Rd
-divxu Rs,Rd or Rs,Rd
-eepmov orc #imm:8,ccr
-inc Rs pop Rs
-jmp @@Rs push Rs
-jmp @@aa:16 rotl Rs
-jmp @@@@aa rotr Rs
-jsr @@Rs rotxl Rs
-jsr @@aa:16 rotxr Rs
-jsr @@@@aa:8 rte
-ldc #imm:8,ccr rts
-ldc Rs,ccr shal Rs
-mov.b Rs,Rd shar Rs
-mov.b #imm:8,Rd shll Rs
-mov.b @@Rs,Rd shlr Rs
-mov.b @@(d:16, Rs),Rd sleep
-mov.b @@Rs+,Rd stc ccr,Rd
-mov.b @@aa:16,Rd sub.b Rs,Rd
-mov.b @@aa:8,Rd sub.w Rs,Rd
-mov.b Rs,@@Rd subs #1,Rd
-mov.b Rs,@@(d:16, Rd) subs #2,Rd
-mov.b Rs,@@-Rd subx #imm:8,Rd
-mov.b Rs,@@aa:16 subx Rs,Rd
-mov.b Rs,@@aa:8 xor #imm:8,Rd
-mov.w Rs,Rd xor Rs,Rd
-mov.w #imm:16,Rd xorc #imm:8,ccr
-mov.w @@Rs,Rd
-@end group
-@end smallexample
-
-@cindex size suffixes, H8/300
-@cindex H8/300 size suffixes
-Four H8/300 instructions (@code{add}, @code{cmp}, @code{mov},
-@code{sub}) are defined with variants using the suffixes @samp{.b} and
-@samp{.w} to specify the size of a memory operand. @code{_AS__}
-supports these suffixes, but does not require them; since one of the
-operands is always a register, @code{_AS__} can deduce the correct size.
-
-For example, since @code{r0} refers to a 16-bit register,
-@example
-mov r0,@@foo
-@exdent is equivalent to
-mov.w r0,@@foo
-@end example
-
-If you use the size suffixes, @code{_AS__} will issue a warning if
-there's a mismatch between the suffix and the register size.
-
-_fi__(_H8__)
-_if__(_I960__)
-_if__(_GENERIC__)
-@node i960-Dependent, M68K-Dependent, H8/300-Dependent, Machine Dependent
-_fi__(_GENERIC__)
-_CHAPSEC__(0+_GENERIC__) Intel 80960 Dependent Features
-
-@cindex i960 support
-@menu
-* Options-i960:: i960 Command-line Options
-* Floating Point-i960:: Floating Point
-* Directives-i960:: i960 Machine Directives
-* Opcodes for i960:: i960 Opcodes
-@end menu
-
-@c FIXME! Add Syntax sec with discussion of bitfields here, at least so
-@c long as they're not turned on for other machines than 960.
-@node Options-i960, Floating Point-i960, i960-Dependent, i960-Dependent
-
-_CHAPSEC__(1+_GENERIC__) i960 Command-line Options
-
-@cindex i960 options
-@cindex options, i960
-@table @code
-
-@item -ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC
-@cindex i960 architecture options
-@cindex architecture options, i960
-@cindex @code{-A} options, i960
-Select the 80960 architecture. Instructions or features not supported
-by the selected architecture cause fatal errors.
-
-@samp{-ACA} is equivalent to @samp{-ACA_A}; @samp{-AKC} is equivalent to
-@samp{-AMC}. Synonyms are provided for compatibility with other tools.
-
-If none of these options is specified, @code{_AS__} will generate code for any
-instruction or feature that is supported by @emph{some} version of the
-960 (even if this means mixing architectures!). In principle,
-@code{_AS__} will attempt to deduce the minimal sufficient processor
-type if none is specified; depending on the object code format, the
-processor type may be recorded in the object file. If it is critical
-that the @code{_AS__} output match a specific architecture, specify that
-architecture explicitly.
-
-@item -b
-@cindex @code{-b} option, i960
-@cindex branch recording, i960
-@cindex i960 branch recording
-Add code to collect information about conditional branches taken, for
-later optimization using branch prediction bits. (The conditional branch
-instructions have branch prediction bits in the CA, CB, and CC
-architectures.) If @var{BR} represents a conditional branch instruction,
-the following represents the code generated by the assembler when
-@samp{-b} is specified:
-
-@smallexample
- call @var{increment routine}
- .word 0 # pre-counter
-Label: @var{BR}
- call @var{increment routine}
- .word 0 # post-counter
-@end smallexample
-
-The counter following a branch records the number of times that branch
-was @emph{not} taken; the differenc between the two counters is the
-number of times the branch @emph{was} taken.
-
-@cindex @code{gbr960}, i960 postprocessor
-@cindex branch statistics table, i960
-A table of every such @code{Label} is also generated, so that the
-external postprocessor @code{gbr960} (supplied by Intel) can locate all
-the counters. This table is always labelled @samp{__BRANCH_TABLE__};
-this is a local symbol to permit collecting statistics for many separate
-object files. The table is word aligned, and begins with a two-word
-header. The first word, initialized to 0, is used in maintaining linked
-lists of branch tables. The second word is a count of the number of
-entries in the table, which follow immediately: each is a word, pointing
-to one of the labels illustrated above.
-
-@c TEXI2ROFF-KILL
-@ifinfo
-@c END TEXI2ROFF-KILL
-@example
- +------------+------------+------------+ ... +------------+
- | | | | | |
- | *NEXT | COUNT: N | *BRLAB 1 | | *BRLAB N |
- | | | | | |
- +------------+------------+------------+ ... +------------+
-
- __BRANCH_TABLE__ layout
-@end example
-@c TEXI2ROFF-KILL
-@end ifinfo
-@tex
-\vskip 1pc
-\line{\leftskip=0pt\hskip\tableindent
-\boxit{2cm}{\tt *NEXT}\boxit{2cm}{\tt COUNT: \it N}\boxit{2cm}{\tt
-*BRLAB 1}\ibox{1cm}{\quad\dots}\boxit{2cm}{\tt *BRLAB \it N}\hfil}
-\centerline{\it {\tt \_\_BRANCH\_TABLE\_\_} layout}
-@end tex
-@c END TEXI2ROFF-KILL
-
-The first word of the header is used to locate multiple branch tables,
-since each object file may contain one. Normally the links are
-maintained with a call to an initialization routine, placed at the
-beginning of each function in the file. The GNU C compiler will
-generate these calls automatically when you give it a @samp{-b} option.
-For further details, see the documentation of @samp{gbr960}.
-
-@item -norelax
-@cindex @code{-norelax} option, i960
-Normally, Compare-and-Branch instructions with targets that require
-displacements greater than 13 bits (or that have external targets) are
-replaced with the corresponding compare (or @samp{chkbit}) and branch
-instructions. You can use the @samp{-norelax} option to specify that
-@code{_AS__} should generate errors instead, if the target displacement
-is larger than 13 bits.
-
-This option does not affect the Compare-and-Jump instructions; the code
-emitted for them is @emph{always} adjusted when necessary (depending on
-displacement size), regardless of whether you use @samp{-norelax}.
-@end table
-
-@node Floating Point-i960, Directives-i960, Options-i960, i960-Dependent
-_CHAPSEC__(1+_GENERIC__) Floating Point
-
-@cindex floating point, i960 (@sc{ieee})
-@cindex i960 floating point (@sc{ieee})
-@code{_AS__} generates @sc{ieee} floating-point numbers for the directives
-@samp{.float}, @samp{.double}, @samp{.extended}, and @samp{.single}.
-
-@node Directives-i960, Opcodes for i960, Floating Point-i960, i960-Dependent
-_CHAPSEC__(1+_GENERIC__) i960 Machine Directives
-
-@cindex machine directives, i960
-@cindex i960 machine directives
-
-@table @code
-@cindex @code{bss} directive, i960
-@item .bss @var{symbol}, @var{length}, @var{align}
-Reserve @var{length} bytes in the bss section for a local @var{symbol},
-aligned to the power of two specified by @var{align}. @var{length} and
-@var{align} must be positive absolute expressions. This directive
-differs from @samp{.lcomm} only in that it permits you to specify
-an alignment. @xref{Lcomm,,@code{.lcomm}}.
-@end table
-
-@table @code
-@item .extended @var{flonums}
-@cindex @code{extended} directive, i960
-@code{.extended} expects zero or more flonums, separated by commas; for
-each flonum, @samp{.extended} emits an @sc{ieee} extended-format (80-bit)
-floating-point number.
-
-@item .leafproc @var{call-lab}, @var{bal-lab}
-@cindex @code{leafproc} directive, i960
-You can use the @samp{.leafproc} directive in conjunction with the
-optimized @code{callj} instruction to enable faster calls of leaf
-procedures. If a procedure is known to call no other procedures, you
-may define an entry point that skips procedure prolog code (and that does
-not depend on system-supplied saved context), and declare it as the
-@var{bal-lab} using @samp{.leafproc}. If the procedure also has an
-entry point that goes through the normal prolog, you can specify that
-entry point as @var{call-lab}.
-
-A @samp{.leafproc} declaration is meant for use in conjunction with the
-optimized call instruction @samp{callj}; the directive records the data
-needed later to choose between converting the @samp{callj} into a
-@code{bal} or a @code{call}.
-
-@var{call-lab} is optional; if only one argument is present, or if the
-two arguments are identical, the single argument is assumed to be the
-@code{bal} entry point.
-
-@item .sysproc @var{name}, @var{index}
-@cindex @code{sysproc} directive, i960
-The @samp{.sysproc} directive defines a name for a system procedure.
-After you define it using @samp{.sysproc}, you can use @var{name} to
-refer to the system procedure identified by @var{index} when calling
-procedures with the optimized call instruction @samp{callj}.
-
-Both arguments are required; @var{index} must be between 0 and 31
-(inclusive).
-@end table
-
-@node Opcodes for i960, , Directives-i960, i960-Dependent
-_CHAPSEC__(1+_GENERIC__) i960 Opcodes
-
-@cindex opcodes, i960
-@cindex i960 opcodes
-All Intel 960 machine instructions are supported;
-@pxref{Options-i960,,i960 Command-line Options} for a discussion of
-selecting the instruction subset for a particular 960
-architecture.@refill
-
-Some opcodes are processed beyond simply emitting a single corresponding
-instruction: @samp{callj}, and Compare-and-Branch or Compare-and-Jump
-instructions with target displacements larger than 13 bits.
-
-@menu
-* callj-i960:: @code{callj}
-* Compare-and-branch-i960:: Compare-and-Branch
-@end menu
-
-@node callj-i960, Compare-and-branch-i960, Opcodes for i960, Opcodes for i960
-_CHAPSEC__(2+_GENERIC__) @code{callj}
-
-@cindex @code{callj}, i960 pseudo-opcode
-@cindex i960 @code{callj} pseudo-opcode
-You can write @code{callj} to have the assembler or the linker determine
-the most appropriate form of subroutine call: @samp{call},
-@samp{bal}, or @samp{calls}. If the assembly source contains
-enough information---a @samp{.leafproc} or @samp{.sysproc} directive
-defining the operand---then @code{_AS__} will translate the
-@code{callj}; if not, it will simply emit the @code{callj}, leaving it
-for the linker to resolve.
-
-@node Compare-and-branch-i960, , callj-i960, Opcodes for i960
-_CHAPSEC__(2+_GENERIC__) Compare-and-Branch
-
-@cindex i960 compare and branch instructions
-@cindex compare and branch instructions, i960
-The 960 architectures provide combined Compare-and-Branch instructions
-that permit you to store the branch target in the lower 13 bits of the
-instruction word itself. However, if you specify a branch target far
-enough away that its address won't fit in 13 bits, the assembler can
-either issue an error, or convert your Compare-and-Branch instruction
-into separate instructions to do the compare and the branch.
-
-@cindex compare and jump expansions, i960
-@cindex i960 compare and jump expansions
-Whether @code{_AS__} gives an error or expands the instruction depends
-on two choices you can make: whether you use the @samp{-norelax} option,
-and whether you use a ``Compare and Branch'' instruction or a ``Compare
-and Jump'' instruction. The ``Jump'' instructions are @emph{always}
-expanded if necessary; the ``Branch'' instructions are expanded when
-necessary @emph{unless} you specify @code{-norelax}---in which case
-@code{_AS__} gives an error instead.
-
-These are the Compare-and-Branch instructions, their ``Jump'' variants,
-and the instruction pairs they may expand into:
-
-@c TEXI2ROFF-KILL
-@ifinfo
-@c END TEXI2ROFF-KILL
-@example
- Compare and
- Branch Jump Expanded to
- ------ ------ ------------
- bbc chkbit; bno
- bbs chkbit; bo
- cmpibe cmpije cmpi; be
- cmpibg cmpijg cmpi; bg
- cmpibge cmpijge cmpi; bge
- cmpibl cmpijl cmpi; bl
- cmpible cmpijle cmpi; ble
- cmpibno cmpijno cmpi; bno
- cmpibne cmpijne cmpi; bne
- cmpibo cmpijo cmpi; bo
- cmpobe cmpoje cmpo; be
- cmpobg cmpojg cmpo; bg
- cmpobge cmpojge cmpo; bge
- cmpobl cmpojl cmpo; bl
- cmpoble cmpojle cmpo; ble
- cmpobne cmpojne cmpo; bne
-@end example
-@c TEXI2ROFF-KILL
-@end ifinfo
-@tex
-\hskip\tableindent
-\halign{\hfil {\tt #}\quad&\hfil {\tt #}\qquad&{\tt #}\hfil\cr
-\omit{\hfil\it Compare and\hfil}\span\omit&\cr
-{\it Branch}&{\it Jump}&{\it Expanded to}\cr
- bbc& & chkbit; bno\cr
- bbs& & chkbit; bo\cr
- cmpibe& cmpije& cmpi; be\cr
- cmpibg& cmpijg& cmpi; bg\cr
- cmpibge& cmpijge& cmpi; bge\cr
- cmpibl& cmpijl& cmpi; bl\cr
- cmpible& cmpijle& cmpi; ble\cr
- cmpibno& cmpijno& cmpi; bno\cr
- cmpibne& cmpijne& cmpi; bne\cr
- cmpibo& cmpijo& cmpi; bo\cr
- cmpobe& cmpoje& cmpo; be\cr
- cmpobg& cmpojg& cmpo; bg\cr
- cmpobge& cmpojge& cmpo; bge\cr
- cmpobl& cmpojl& cmpo; bl\cr
- cmpoble& cmpojle& cmpo; ble\cr
- cmpobne& cmpojne& cmpo; bne\cr}
-@end tex
-@c END TEXI2ROFF-KILL
-_fi__(_I960__)
-
-_if__(_M680X0__)
-_if__(_GENERIC__)
-@c FIXME! node conds are only sufficient for m68k alone, all, and vintage
-_if__(_I960__)
-@node M68K-Dependent, Sparc-Dependent, i960-Dependent, Machine Dependent
-_fi__(_I960__)
-_if__(!_I960__)
-@node M68K-Dependent, Sparc-Dependent, Machine Dependent, Machine Dependent
-_fi__(!_I960__)
-_fi__(_GENERIC__)
-_CHAPSEC__(0+_GENERIC__) M680x0 Dependent Features
-
-@cindex M680x0 support
-@menu
-* M68K-Opts:: M680x0 Options
-* M68K-Syntax:: Syntax
-* M68K-Float:: Floating Point
-* M68K-Directives:: 680x0 Machine Directives
-* M68K-opcodes:: Opcodes
-@end menu
-
-@node M68K-Opts, M68K-Syntax, M68K-Dependent, M68K-Dependent
-_CHAPSEC__(1+_GENERIC__) M680x0 Options
-
-@cindex options, M680x0
-@cindex M680x0 options
-The Motorola 680x0 version of @code{_AS__} has two machine dependent options.
-One shortens undefined references from 32 to 16 bits, while the
-other is used to tell @code{_AS__} what kind of machine it is
-assembling for.
-
-@cindex @code{-l} option, M680x0
-You can use the @kbd{-l} option to shorten the size of references to
-undefined symbols. If the @kbd{-l} option is not given, references to
-undefined symbols will be a full long (32 bits) wide. (Since @code{_AS__}
-cannot know where these symbols will end up, @code{_AS__} can only allocate
-space for the linker to fill in later. Since @code{_AS__} doesn't know how
-far away these symbols will be, it allocates as much space as it can.)
-If this option is given, the references will only be one word wide (16
-bits). This may be useful if you want the object file to be as small as
-possible, and you know that the relevant symbols will be less than 17
-bits away.
-
-@cindex @code{-m68000} and related options, M680x0
-@cindex architecture options, M680x0
-@cindex M680x0 architecture options
-The 680x0 version of @code{_AS__} is most frequently used to assemble
-programs for the Motorola MC68020 microprocessor. Occasionally it is
-used to assemble programs for the mostly similar, but slightly different
-MC68000 or MC68010 microprocessors. You can give @code{_AS__} the options
-@samp{-m68000}, @samp{-mc68000}, @samp{-m68010}, @samp{-mc68010},
-@samp{-m68020}, and @samp{-mc68020} to tell it what processor is the
-target.
-
-@node M68K-Syntax, M68K-Float, M68K-Opts, M68K-Dependent
-_CHAPSEC__(1+_GENERIC__) Syntax
-
-@cindex M680x0 syntax
-@cindex syntax, M680x0
-@cindex M680x0 size modifiers
-@cindex size modifiers, M680x0
-The 680x0 version of @code{_AS__} uses syntax similar to the Sun assembler.
-Size modifiers are appended directly to the end of the opcode without an
-intervening period. For example, write @samp{movl} rather than
-@samp{move.l}.
-
-_if__(_INTERNALS__)
-If @code{_AS__} is compiled with SUN_ASM_SYNTAX defined, it will also allow
-Sun-style local labels of the form @samp{1$} through @samp{$9}.
-_fi__(_INTERNALS__)
-
-In the following table @dfn{apc} stands for any of the address
-registers (@samp{a0} through @samp{a7}), nothing, (@samp{}), the
-Program Counter (@samp{pc}), or the zero-address relative to the
-program counter (@samp{zpc}).
-
-@cindex M680x0 addressing modes
-@cindex addressing modes, M680x0
-The following addressing modes are understood:
-@table @dfn
-@item Immediate
-@samp{#@var{digits}}
-
-@item Data Register
-@samp{d0} through @samp{d7}
-
-@item Address Register
-@samp{a0} through @samp{a7}
-
-@item Address Register Indirect
-@samp{a0@@} through @samp{a7@@}
-
-@item Address Register Postincrement
-@samp{a0@@+} through @samp{a7@@+}
-
-@item Address Register Predecrement
-@samp{a0@@-} through @samp{a7@@-}
-
-@item Indirect Plus Offset
-@samp{@var{apc}@@(@var{digits})}
-
-@item Index
-@samp{@var{apc}@@(@var{digits},@var{register}:@var{size}:@var{scale})}
-
-or @samp{@var{apc}@@(@var{register}:@var{size}:@var{scale})}
-
-@item Postindex
-@samp{@var{apc}@@(@var{digits})@@(@var{digits},@var{register}:@var{size}:@var{scale})}
-
-or @samp{@var{apc}@@(@var{digits})@@(@var{register}:@var{size}:@var{scale})}
-
-@item Preindex
-@samp{@var{apc}@@(@var{digits},@var{register}:@var{size}:@var{scale})@@(@var{digits})}
-
-or @samp{@var{apc}@@(@var{register}:@var{size}:@var{scale})@@(@var{digits})}
-
-@item Memory Indirect
-@samp{@var{apc}@@(@var{digits})@@(@var{digits})}
-
-@item Absolute
-@samp{@var{symbol}}, or @samp{@var{digits}}
-@ignore
-@c pesch@cygnus.com: gnu, rich concur the following needs careful
-@c research before documenting.
- , or either of the above followed
-by @samp{:b}, @samp{:w}, or @samp{:l}.
-@end ignore
-@end table
-
-@node M68K-Float, M68K-Directives, M68K-Syntax, M68K-Dependent
-_CHAPSEC__(1+_GENERIC__) Floating Point
-
-@cindex floating point, M680x0
-@cindex M680x0 floating point
-@c FIXME is this "not too well tested" crud STILL true?
-The floating point code is not too well tested, and may have
-subtle bugs in it.
-
-Packed decimal (P) format floating literals are not supported.
-Feel free to add the code!
-
-The floating point formats generated by directives are these.
-
-@table @code
-@item .float
-@cindex @code{float} directive, M680x0
-@code{Single} precision floating point constants.
-
-@item .double
-@cindex @code{double} directive, M680x0
-@code{Double} precision floating point constants.
-@end table
-
-There is no directive to produce regions of memory holding
-extended precision numbers, however they can be used as
-immediate operands to floating-point instructions. Adding a
-directive to create extended precision numbers would not be
-hard, but it has not yet seemed necessary.
-
-@node M68K-Directives, M68K-opcodes, M68K-Float, M68K-Dependent
-_CHAPSEC__(1+_GENERIC__) 680x0 Machine Directives
-
-@cindex M680x0 directives
-@cindex directives, M680x0
-In order to be compatible with the Sun assembler the 680x0 assembler
-understands the following directives.
-
-@table @code
-@item .data1
-@cindex @code{data1} directive, M680x0
-This directive is identical to a @code{.data 1} directive.
-
-@item .data2
-@cindex @code{data2} directive, M680x0
-This directive is identical to a @code{.data 2} directive.
-
-@item .even
-@cindex @code{even} directive, M680x0
-This directive is identical to a @code{.align 1} directive.
-@c Is this true? does it work???
-
-@item .skip
-@cindex @code{skip} directive, M680x0
-This directive is identical to a @code{.space} directive.
-@end table
-
-@node M68K-opcodes, , M68K-Directives, M68K-Dependent
-_CHAPSEC__(1+_GENERIC__) Opcodes
-
-@cindex M680x0 opcodes
-@cindex opcodes, M680x0
-@cindex instruction set, M680x0
-@c pesch@cygnus.com: I don't see any point in the following
-@c paragraph. Bugs are bugs; how does saying this
-@c help anyone?
-@ignore
-Danger: Several bugs have been found in the opcode table (and
-fixed). More bugs may exist. Be careful when using obscure
-instructions.
-@end ignore
-
-@menu
-* M68K-Branch:: Branch Improvement
-* M68K-Chars:: Special Characters
-@end menu
-
-@node M68K-Branch, M68K-Chars, M68K-opcodes, M68K-opcodes
-_CHAPSEC__(2+_GENERIC__) Branch Improvement
-
-@cindex pseudo-opcodes, M680x0
-@cindex M680x0 pseudo-opcodes
-@cindex branch improvement, M680x0
-@cindex M680x0 branch improvement
-Certain pseudo opcodes are permitted for branch instructions.
-They expand to the shortest branch instruction that will reach the
-target. Generally these mnemonics are made by substituting @samp{j} for
-@samp{b} at the start of a Motorola mnemonic.
-
-The following table summarizes the pseudo-operations. A @code{*} flags
-cases that are more fully described after the table:
-
-@smallexample
- Displacement
- +---------------------------------------------------------
- | 68020 68000/10
-Pseudo-Op |BYTE WORD LONG LONG non-PC relative
- +---------------------------------------------------------
- jbsr |bsrs bsr bsrl jsr jsr
- jra |bras bra bral jmp jmp
-* jXX |bXXs bXX bXXl bNXs;jmpl bNXs;jmp
-* dbXX |dbXX dbXX dbXX; bra; jmpl
-* fjXX |fbXXw fbXXw fbXXl fbNXw;jmp
-
-XX: condition
-NX: negative of condition XX
-
-@end smallexample
-@center @code{*}---see full description below
-
-@table @code
-@item jbsr
-@itemx jra
-These are the simplest jump pseudo-operations; they always map to one
-particular machine instruction, depending on the displacement to the
-branch target.
-
-@item j@var{XX}
-Here, @samp{j@var{XX}} stands for an entire family of pseudo-operations,
-where @var{XX} is a conditional branch or condition-code test. The full
-list of pseudo-ops in this family is:
-@smallexample
- jhi jls jcc jcs jne jeq jvc
- jvs jpl jmi jge jlt jgt jle
-@end smallexample
-
-For the cases of non-PC relative displacements and long displacements on
-the 68000 or 68010, @code{_AS__} will issue a longer code fragment in terms of
-@var{NX}, the opposite condition to @var{XX}:
-@smallexample
- j@var{XX} foo
-@end smallexample
-gives
-@smallexample
- b@var{NX}s oof
- jmp foo
- oof:
-@end smallexample
-
-@item db@var{XX}
-The full family of pseudo-operations covered here is
-@smallexample
- dbhi dbls dbcc dbcs dbne dbeq dbvc
- dbvs dbpl dbmi dbge dblt dbgt dble
- dbf dbra dbt
-@end smallexample
-
-Other than for word and byte displacements, when the source reads
-@samp{db@var{XX} foo}, @code{_AS__} will emit
-@smallexample
- db@var{XX} oo1
- bra oo2
- oo1:jmpl foo
- oo2:
-@end smallexample
-
-@item fj@var{XX}
-This family includes
-@smallexample
- fjne fjeq fjge fjlt fjgt fjle fjf
- fjt fjgl fjgle fjnge fjngl fjngle fjngt
- fjnle fjnlt fjoge fjogl fjogt fjole fjolt
- fjor fjseq fjsf fjsne fjst fjueq fjuge
- fjugt fjule fjult fjun
-@end smallexample
-
-For branch targets that are not PC relative, @code{_AS__} emits
-@smallexample
- fb@var{NX} oof
- jmp foo
- oof:
-@end smallexample
-when it encounters @samp{fj@var{XX} foo}.
-
-@end table
-
-@node M68K-Chars, , M68K-Branch, M68K-opcodes
-_CHAPSEC__(2+_GENERIC__) Special Characters
-
-@cindex special characters, M680x0
-@cindex M680x0 immediate character
-@cindex immediate character, M680x0
-@cindex M680x0 line comment character
-@cindex line comment character, M680x0
-@cindex comments, M680x0
-The immediate character is @samp{#} for Sun compatibility. The
-line-comment character is @samp{|}. If a @samp{#} appears at the
-beginning of a line, it is treated as a comment unless it looks like
-@samp{# line file}, in which case it is treated normally.
-
-_fi__(_M680X0__)
-_if__(0)
-@c pesch@cygnus.com: conditionalize on something other than 0 when filled in.
-@section 32x32
-@section Options
-The 32x32 version of @code{_AS__} accepts a @kbd{-m32032} option to
-specify thiat it is compiling for a 32032 processor, or a
-@kbd{-m32532} to specify that it is compiling for a 32532 option.
-The default (if neither is specified) is chosen when the assembler
-is compiled.
-
-@subsection Syntax
-I don't know anything about the 32x32 syntax assembled by
-@code{_AS__}. Someone who undersands the processor (I've never seen
-one) and the possible syntaxes should write this section.
-
-@subsection Floating Point
-The 32x32 uses @sc{ieee} floating point numbers, but @code{_AS__} will only
-create single or double precision values. I don't know if the 32x32
-understands extended precision numbers.
-
-@subsection 32x32 Machine Directives
-The 32x32 has no machine dependent directives.
-
-_fi__(0)
-_if__(_SPARC__)
-_if__(_GENERIC__)
-_if__(_I80386__&&_M680X0__)
-@node Sparc-Dependent, i386-Dependent, M68K-Dependent, Machine Dependent
-_fi__(_I80386__&&_M680X0__)
-_if__(_I80386__&&_I960__&&!_M680X0__)
-@node Sparc-Dependent, i386-Dependent, i960-Dependent, Machine Dependent
-_fi__(_I80386__&&_I960__&&!_M680X0__)
-_if__(_I80386__&&_A29K__&&(!_I960__)&&!_M680X0__)
-@node Sparc-Dependent, i386-Dependent, AMD29K-Dependent, Machine Dependent
-_fi__(_I80386__&&_A29K__&&(!_I960__)&&!_M680X0__)
-_if__(_I80386__&&_VAX__&&(!_A29K__)&&(!_I960__)&&!_M680X0__)
-@node Sparc-Dependent, i386-Dependent, Vax-Dependent, Machine Dependent
-_fi__(_I80386__&&_VAX__&&(!_A29K__)&&(!_I960__)&&!_M680X0__)
-_if__(_I80386__&&(!_VAX__)&&(!_A29K__)&&(!_I960__)&&!_M680X0__)
-@node Sparc-Dependent, i386-Dependent, Machine Dependent, Machine Dependent
-_fi__(_I80386__&&(!_VAX__)&&(!_A29K__)&&(!_I960__)&&!_M680X0__)
-_if__((!_I80386__)&&_M680X0__)
-@node Sparc-Dependent, , M68K-Dependent, Machine Dependent
-_fi__((!_I80386__)&&_M680X0__)
-_if__((!_I80386__)&&_I960__&&!_M680X0__)
-@node Sparc-Dependent, , i960-Dependent, Machine Dependent
-_fi__((!_I80386__)&&_I960__&&!_M680X0__)
-_if__((!_I80386__)&&_A29K__&&(!_I960__)&&!_M680X0__)
-@node Sparc-Dependent, , AMD29K-Dependent, Machine Dependent
-_fi__((!_I80386__)&&_A29K__&&(!_I960__)&&!_M680X0__)
-_if__((!_I80386__)&&_VAX__&&(!_A29K__)&&(!_I960__)&&!_M680X0__)
-@node Sparc-Dependent, , Vax-Dependent, Machine Dependent
-_fi__((!_I80386__)&&_VAX__&&(!_A29K__)&&(!_I960__)&&!_M680X0__)
-_if__((!_I80386__)&&(!_VAX__)&&(!_A29K__)&&(!_I960__)&&!_M680X0__)
-@node Sparc-Dependent, , Machine Dependent, Machine Dependent
-_fi__((!_I80386__)&&(!_VAX__)&&(!_A29K__)&&(!_I960__)&&!_M680X0__)
-_fi__(_GENERIC__)
-_CHAPSEC__(0+_GENERIC__) SPARC Dependent Features
-
-@cindex SPARC support
-@menu
-* Sparc-Opts:: Options
-* Sparc-Float:: Floating Point
-* Sparc-Directives:: Sparc Machine Directives
-@end menu
-
-@node Sparc-Opts, Sparc-Float, Sparc-Dependent, Sparc-Dependent
-_CHAPSEC__(1+_GENERIC__) Options
-
-@cindex options for SPARC (none)
-@cindex SPARC options (none)
-The Sparc has no machine dependent options.
-
-@ignore
-@c FIXME: (sparc) Fill in "syntax" section!
-@c subsection syntax
-I don't know anything about Sparc syntax. Someone who does
-will have to write this section.
-@end ignore
-
-@node Sparc-Float, Sparc-Directives, Sparc-Opts, Sparc-Dependent
-_CHAPSEC__(1+_GENERIC__) Floating Point
-
-@cindex floating point, SPARC (@sc{ieee})
-@cindex SPARC floating point (@sc{ieee})
-The Sparc uses @sc{ieee} floating-point numbers.
-
-@node Sparc-Directives, , Sparc-Float, Sparc-Dependent
-_CHAPSEC__(1+_GENERIC__) Sparc Machine Directives
-
-@cindex SPARC machine directives
-@cindex machine directives, SPARC
-The Sparc version of @code{_AS__} supports the following additional
-machine directives:
-
-@table @code
-@item .common
-@cindex @code{common} directive, SPARC
-This must be followed by a symbol name, a positive number, and
-@code{"bss"}. This behaves somewhat like @code{.comm}, but the
-syntax is different.
-
-@item .half
-@cindex @code{half} directive, SPARC
-This is functionally identical to @code{.short}.
-
-@item .proc
-@cindex @code{proc} directive, SPARC
-This directive is ignored. Any text following it on the same
-line is also ignored.
-
-@item .reserve
-@cindex @code{reserve} directive, SPARC
-This must be followed by a symbol name, a positive number, and
-@code{"bss"}. This behaves somewhat like @code{.lcomm}, but the
-syntax is different.
-
-@item .seg
-@cindex @code{seg} directive, SPARC
-This must be followed by @code{"text"}, @code{"data"}, or
-@code{"data1"}. It behaves like @code{.text}, @code{.data}, or
-@code{.data 1}.
-
-@item .skip
-@cindex @code{skip} directive, SPARC
-This is functionally identical to the @code{.space} directive.
-
-@item .word
-@cindex @code{word} directive, SPARC
-On the Sparc, the .word directive produces 32 bit values,
-instead of the 16 bit values it produces on many other machines.
-@end table
-
-_fi__(_SPARC__)
-_if__(_I80386__)
-_if__(_GENERIC__)
-@c FIXME! Conditionalize for all combinations in this section
-@node i386-Dependent, , Sparc-Dependent, Machine Dependent
-_fi__(_GENERIC__)
-_CHAPSEC__(0+_GENERIC__) 80386 Dependent Features
-
-@cindex i386 support
-@cindex i80306 support
-@menu
-* i386-Options:: Options
-* i386-Syntax:: AT&T Syntax versus Intel Syntax
-* i386-Opcodes:: Opcode Naming
-* i386-Regs:: Register Naming
-* i386-prefixes:: Opcode Prefixes
-* i386-Memory:: Memory References
-* i386-jumps:: Handling of Jump Instructions
-* i386-Float:: Floating Point
-* i386-Notes:: Notes
-@end menu
-
-@node i386-Options, i386-Syntax, i386-Dependent, i386-Dependent
-_CHAPSEC__(1+_GENERIC__) Options
-
-@cindex options for i386 (none)
-@cindex i386 options (none)
-The 80386 has no machine dependent options.
-
-@node i386-Syntax, i386-Opcodes, i386-Options, i386-Dependent
-_CHAPSEC__(1+_GENERIC__) AT&T Syntax versus Intel Syntax
-
-@cindex i386 syntax compatibility
-@cindex syntax compatibility, i386
-In order to maintain compatibility with the output of @code{_GCC__},
-@code{_AS__} supports AT&T System V/386 assembler syntax. This is quite
-different from Intel syntax. We mention these differences because
-almost all 80386 documents used only Intel syntax. Notable differences
-between the two syntaxes are:
-
-@itemize @bullet
-@item
-@cindex immediate operands, i386
-@cindex i386 immediate operands
-@cindex register operands, i386
-@cindex i386 register operands
-@cindex jump/call operands, i386
-@cindex i386 jump/call operands
-@cindex operand delimiters, i386
-AT&T immediate operands are preceded by @samp{$}; Intel immediate
-operands are undelimited (Intel @samp{push 4} is AT&T @samp{pushl $4}).
-AT&T register operands are preceded by @samp{%}; Intel register operands
-are undelimited. AT&T absolute (as opposed to PC relative) jump/call
-operands are prefixed by @samp{*}; they are undelimited in Intel syntax.
-
-@item
-@cindex i386 source, destination operands
-@cindex source, destination operands; i386
-AT&T and Intel syntax use the opposite order for source and destination
-operands. Intel @samp{add eax, 4} is @samp{addl $4, %eax}. The
-@samp{source, dest} convention is maintained for compatibility with
-previous Unix assemblers.
-
-@item
-@cindex opcode suffixes, i386
-@cindex sizes operands, i386
-@cindex i386 size suffixes
-In AT&T syntax the size of memory operands is determined from the last
-character of the opcode name. Opcode suffixes of @samp{b}, @samp{w},
-and @samp{l} specify byte (8-bit), word (16-bit), and long (32-bit)
-memory references. Intel syntax accomplishes this by prefixes memory
-operands (@emph{not} the opcodes themselves) with @samp{byte ptr},
-@samp{word ptr}, and @samp{dword ptr}. Thus, Intel @samp{mov al, byte
-ptr @var{foo}} is @samp{movb @var{foo}, %al} in AT&T syntax.
-
-@item
-@cindex return instructions, i386
-@cindex i386 jump, call, return
-Immediate form long jumps and calls are
-@samp{lcall/ljmp $@var{section}, $@var{offset}} in AT&T syntax; the
-Intel syntax is
-@samp{call/jmp far @var{section}:@var{offset}}. Also, the far return
-instruction
-is @samp{lret $@var{stack-adjust}} in AT&T syntax; Intel syntax is
-@samp{ret far @var{stack-adjust}}.
-
-@item
-@cindex sections, i386
-@cindex i386 sections
-The AT&T assembler does not provide support for multiple section
-programs. Unix style systems expect all programs to be single sections.
-@end itemize
-
-@node i386-Opcodes, i386-Regs, i386-Syntax, i386-Dependent
-_CHAPSEC__(1+_GENERIC__) Opcode Naming
-
-@cindex i386 opcode naming
-@cindex opcode naming, i386
-Opcode names are suffixed with one character modifiers which specify the
-size of operands. The letters @samp{b}, @samp{w}, and @samp{l} specify
-byte, word, and long operands. If no suffix is specified by an
-instruction and it contains no memory operands then @code{_AS__} tries to
-fill in the missing suffix based on the destination register operand
-(the last one by convention). Thus, @samp{mov %ax, %bx} is equivalent
-to @samp{movw %ax, %bx}; also, @samp{mov $1, %bx} is equivalent to
-@samp{movw $1, %bx}. Note that this is incompatible with the AT&T Unix
-assembler which assumes that a missing opcode suffix implies long
-operand size. (This incompatibility does not affect compiler output
-since compilers always explicitly specify the opcode suffix.)
-
-Almost all opcodes have the same names in AT&T and Intel format. There
-are a few exceptions. The sign extend and zero extend instructions need
-two sizes to specify them. They need a size to sign/zero extend
-@emph{from} and a size to zero extend @emph{to}. This is accomplished
-by using two opcode suffixes in AT&T syntax. Base names for sign extend
-and zero extend are @samp{movs@dots{}} and @samp{movz@dots{}} in AT&T
-syntax (@samp{movsx} and @samp{movzx} in Intel syntax). The opcode
-suffixes are tacked on to this base name, the @emph{from} suffix before
-the @emph{to} suffix. Thus, @samp{movsbl %al, %edx} is AT&T syntax for
-``move sign extend @emph{from} %al @emph{to} %edx.'' Possible suffixes,
-thus, are @samp{bl} (from byte to long), @samp{bw} (from byte to word),
-and @samp{wl} (from word to long).
-
-@cindex conversion instructions, i386
-@cindex i386 conversion instructions
-The Intel-syntax conversion instructions
-
-@itemize @bullet
-@item
-@samp{cbw} --- sign-extend byte in @samp{%al} to word in @samp{%ax},
-
-@item
-@samp{cwde} --- sign-extend word in @samp{%ax} to long in @samp{%eax},
-
-@item
-@samp{cwd} --- sign-extend word in @samp{%ax} to long in @samp{%dx:%ax},
-
-@item
-@samp{cdq} --- sign-extend dword in @samp{%eax} to quad in @samp{%edx:%eax},
-@end itemize
-
-@noindent
-are called @samp{cbtw}, @samp{cwtl}, @samp{cwtd}, and @samp{cltd} in
-AT&T naming. @code{_AS__} accepts either naming for these instructions.
-
-@cindex jump instructions, i386
-@cindex call instructions, i386
-Far call/jump instructions are @samp{lcall} and @samp{ljmp} in
-AT&T syntax, but are @samp{call far} and @samp{jump far} in Intel
-convention.
-
-@node i386-Regs, i386-prefixes, i386-Opcodes, i386-Dependent
-_CHAPSEC__(1+_GENERIC__) Register Naming
-
-@cindex i386 registers
-@cindex registers, i386
-Register operands are always prefixes with @samp{%}. The 80386 registers
-consist of
-
-@itemize @bullet
-@item
-the 8 32-bit registers @samp{%eax} (the accumulator), @samp{%ebx},
-@samp{%ecx}, @samp{%edx}, @samp{%edi}, @samp{%esi}, @samp{%ebp} (the
-frame pointer), and @samp{%esp} (the stack pointer).
-
-@item
-the 8 16-bit low-ends of these: @samp{%ax}, @samp{%bx}, @samp{%cx},
-@samp{%dx}, @samp{%di}, @samp{%si}, @samp{%bp}, and @samp{%sp}.
-
-@item
-the 8 8-bit registers: @samp{%ah}, @samp{%al}, @samp{%bh},
-@samp{%bl}, @samp{%ch}, @samp{%cl}, @samp{%dh}, and @samp{%dl} (These
-are the high-bytes and low-bytes of @samp{%ax}, @samp{%bx},
-@samp{%cx}, and @samp{%dx})
-
-@item
-the 6 section registers @samp{%cs} (code section), @samp{%ds}
-(data section), @samp{%ss} (stack section), @samp{%es}, @samp{%fs},
-and @samp{%gs}.
-
-@item
-the 3 processor control registers @samp{%cr0}, @samp{%cr2}, and
-@samp{%cr3}.
-
-@item
-the 6 debug registers @samp{%db0}, @samp{%db1}, @samp{%db2},
-@samp{%db3}, @samp{%db6}, and @samp{%db7}.
-
-@item
-the 2 test registers @samp{%tr6} and @samp{%tr7}.
-
-@item
-the 8 floating point register stack @samp{%st} or equivalently
-@samp{%st(0)}, @samp{%st(1)}, @samp{%st(2)}, @samp{%st(3)},
-@samp{%st(4)}, @samp{%st(5)}, @samp{%st(6)}, and @samp{%st(7)}.
-@end itemize
-
-@node i386-prefixes, i386-Memory, i386-Regs, i386-Dependent
-_CHAPSEC__(1+_GENERIC__) Opcode Prefixes
-
-@cindex i386 opcode prefixes
-@cindex opcode prefixes, i386
-@cindex prefixes, i386
-Opcode prefixes are used to modify the following opcode. They are used
-to repeat string instructions, to provide section overrides, to perform
-bus lock operations, and to give operand and address size (16-bit
-operands are specified in an instruction by prefixing what would
-normally be 32-bit operands with a ``operand size'' opcode prefix).
-Opcode prefixes are usually given as single-line instructions with no
-operands, and must directly precede the instruction they act upon. For
-example, the @samp{scas} (scan string) instruction is repeated with:
-@smallexample
- repne
- scas
-@end smallexample
-
-Here is a list of opcode prefixes:
-
-@itemize @bullet
-@item
-@cindex section override prefixes, i386
-Section override prefixes @samp{cs}, @samp{ds}, @samp{ss}, @samp{es},
-@samp{fs}, @samp{gs}. These are automatically added by specifying
-using the @var{section}:@var{memory-operand} form for memory references.
-
-@item
-@cindex size prefixes, i386
-Operand/Address size prefixes @samp{data16} and @samp{addr16}
-change 32-bit operands/addresses into 16-bit operands/addresses. Note
-that 16-bit addressing modes (i.e. 8086 and 80286 addressing modes)
-are not supported (yet).
-
-@item
-@cindex bus lock prefixes, i386
-@cindex inhibiting interrupts, i386
-The bus lock prefix @samp{lock} inhibits interrupts during
-execution of the instruction it precedes. (This is only valid with
-certain instructions; see a 80386 manual for details).
-
-@item
-@cindex coprocessor wait, i386
-The wait for coprocessor prefix @samp{wait} waits for the
-coprocessor to complete the current instruction. This should never be
-needed for the 80386/80387 combination.
-
-@item
-@cindex repeat prefixes, i386
-The @samp{rep}, @samp{repe}, and @samp{repne} prefixes are added
-to string instructions to make them repeat @samp{%ecx} times.
-@end itemize
-
-@node i386-Memory, i386-jumps, i386-prefixes, i386-Dependent
-_CHAPSEC__(1+_GENERIC__) Memory References
-
-@cindex i386 memory references
-@cindex memory references, i386
-An Intel syntax indirect memory reference of the form
-
-@smallexample
-@var{section}:[@var{base} + @var{index}*@var{scale} + @var{disp}]
-@end smallexample
-
-@noindent
-is translated into the AT&T syntax
-
-@smallexample
-@var{section}:@var{disp}(@var{base}, @var{index}, @var{scale})
-@end smallexample
-
-@noindent
-where @var{base} and @var{index} are the optional 32-bit base and
-index registers, @var{disp} is the optional displacement, and
-@var{scale}, taking the values 1, 2, 4, and 8, multiplies @var{index}
-to calculate the address of the operand. If no @var{scale} is
-specified, @var{scale} is taken to be 1. @var{section} specifies the
-optional section register for the memory operand, and may override the
-default section register (see a 80386 manual for section register
-defaults). Note that section overrides in AT&T syntax @emph{must} have
-be preceded by a @samp{%}. If you specify a section override which
-coincides with the default section register, @code{_AS__} will @emph{not}
-output any section register override prefixes to assemble the given
-instruction. Thus, section overrides can be specified to emphasize which
-section register is used for a given memory operand.
-
-Here are some examples of Intel and AT&T style memory references:
-
-@table @asis
-@item AT&T: @samp{-4(%ebp)}, Intel: @samp{[ebp - 4]}
-@var{base} is @samp{%ebp}; @var{disp} is @samp{-4}. @var{section} is
-missing, and the default section is used (@samp{%ss} for addressing with
-@samp{%ebp} as the base register). @var{index}, @var{scale} are both missing.
-
-@item AT&T: @samp{foo(,%eax,4)}, Intel: @samp{[foo + eax*4]}
-@var{index} is @samp{%eax} (scaled by a @var{scale} 4); @var{disp} is
-@samp{foo}. All other fields are missing. The section register here
-defaults to @samp{%ds}.
-
-@item AT&T: @samp{foo(,1)}; Intel @samp{[foo]}
-This uses the value pointed to by @samp{foo} as a memory operand.
-Note that @var{base} and @var{index} are both missing, but there is only
-@emph{one} @samp{,}. This is a syntactic exception.
-
-@item AT&T: @samp{%gs:foo}; Intel @samp{gs:foo}
-This selects the contents of the variable @samp{foo} with section
-register @var{section} being @samp{%gs}.
-@end table
-
-Absolute (as opposed to PC relative) call and jump operands must be
-prefixed with @samp{*}. If no @samp{*} is specified, @code{_AS__} will
-always choose PC relative addressing for jump/call labels.
-
-Any instruction that has a memory operand @emph{must} specify its size (byte,
-word, or long) with an opcode suffix (@samp{b}, @samp{w}, or @samp{l},
-respectively).
-
-@node i386-jumps, i386-Float, i386-Memory, i386-Dependent
-_CHAPSEC__(1+_GENERIC__) Handling of Jump Instructions
-
-@cindex jump optimization, i386
-@cindex i386 jump optimization
-Jump instructions are always optimized to use the smallest possible
-displacements. This is accomplished by using byte (8-bit) displacement
-jumps whenever the target is sufficiently close. If a byte displacement
-is insufficient a long (32-bit) displacement is used. We do not support
-word (16-bit) displacement jumps (i.e. prefixing the jump instruction
-with the @samp{addr16} opcode prefix), since the 80386 insists upon masking
-@samp{%eip} to 16 bits after the word displacement is added.
-
-Note that the @samp{jcxz}, @samp{jecxz}, @samp{loop}, @samp{loopz},
-@samp{loope}, @samp{loopnz} and @samp{loopne} instructions only come in
-byte displacements, so that it is possible that use of these
-instructions (@code{_GCC__} does not use them) will cause the assembler to
-print an error message (and generate incorrect code). The AT&T 80386
-assembler tries to get around this problem by expanding @samp{jcxz foo} to
-@smallexample
- jcxz cx_zero
- jmp cx_nonzero
-cx_zero: jmp foo
-cx_nonzero:
-@end smallexample
-
-@node i386-Float, i386-Notes, i386-jumps, i386-Dependent
-_CHAPSEC__(1+_GENERIC__) Floating Point
-
-@cindex i386 floating point
-@cindex floating point, i386
-All 80387 floating point types except packed BCD are supported.
-(BCD support may be added without much difficulty). These data
-types are 16-, 32-, and 64- bit integers, and single (32-bit),
-double (64-bit), and extended (80-bit) precision floating point.
-Each supported type has an opcode suffix and a constructor
-associated with it. Opcode suffixes specify operand's data
-types. Constructors build these data types into memory.
-
-@itemize @bullet
-@item
-@cindex @code{float} directive, i386
-@cindex @code{single} directive, i386
-@cindex @code{double} directive, i386
-@cindex @code{tfloat} directive, i386
-Floating point constructors are @samp{.float} or @samp{.single},
-@samp{.double}, and @samp{.tfloat} for 32-, 64-, and 80-bit formats.
-These correspond to opcode suffixes @samp{s}, @samp{l}, and @samp{t}.
-@samp{t} stands for temporary real, and that the 80387 only supports
-this format via the @samp{fldt} (load temporary real to stack top) and
-@samp{fstpt} (store temporary real and pop stack) instructions.
-
-@item
-@cindex @code{word} directive, i386
-@cindex @code{long} directive, i386
-@cindex @code{int} directive, i386
-@cindex @code{quad} directive, i386
-Integer constructors are @samp{.word}, @samp{.long} or @samp{.int}, and
-@samp{.quad} for the 16-, 32-, and 64-bit integer formats. The corresponding
-opcode suffixes are @samp{s} (single), @samp{l} (long), and @samp{q}
-(quad). As with the temporary real format the 64-bit @samp{q} format is
-only present in the @samp{fildq} (load quad integer to stack top) and
-@samp{fistpq} (store quad integer and pop stack) instructions.
-@end itemize
-
-Register to register operations do not require opcode suffixes,
-so that @samp{fst %st, %st(1)} is equivalent to @samp{fstl %st, %st(1)}.
-
-@cindex i386 @code{fwait} instruction
-@cindex @code{fwait instruction}, i386
-Since the 80387 automatically synchronizes with the 80386 @samp{fwait}
-instructions are almost never needed (this is not the case for the
-80286/80287 and 8086/8087 combinations). Therefore, @code{_AS__} suppresses
-the @samp{fwait} instruction whenever it is implicitly selected by one
-of the @samp{fn@dots{}} instructions. For example, @samp{fsave} and
-@samp{fnsave} are treated identically. In general, all the @samp{fn@dots{}}
-instructions are made equivalent to @samp{f@dots{}} instructions. If
-@samp{fwait} is desired it must be explicitly coded.
-
-@node i386-Notes, , i386-Float, i386-Dependent
-_CHAPSEC__(1+_GENERIC__) Notes
-
-@cindex i386 @code{mul}, @code{imul} instructions
-@cindex @code{mul} instruction, i386
-@cindex @code{imul} instruction, i386
-There is some trickery concerning the @samp{mul} and @samp{imul}
-instructions that deserves mention. The 16-, 32-, and 64-bit expanding
-multiplies (base opcode @samp{0xf6}; extension 4 for @samp{mul} and 5
-for @samp{imul}) can be output only in the one operand form. Thus,
-@samp{imul %ebx, %eax} does @emph{not} select the expanding multiply;
-the expanding multiply would clobber the @samp{%edx} register, and this
-would confuse @code{_GCC__} output. Use @samp{imul %ebx} to get the
-64-bit product in @samp{%edx:%eax}.
-
-We have added a two operand form of @samp{imul} when the first operand
-is an immediate mode expression and the second operand is a register.
-This is just a shorthand, so that, multiplying @samp{%eax} by 69, for
-example, can be done with @samp{imul $69, %eax} rather than @samp{imul
-$69, %eax, %eax}.
-
-_fi__(_I80386__)
-_if__(0)
-@c pesch@cygnus.com: we ignore the following chapters, since internals are
-@c changing rapidly. These may need to be moved to another
-@c book anyhow, if we adopt the model of user/modifier
-@c books.
-@node Maintenance, Retargeting, _MACH_DEP__, Top
-@chapter Maintaining the Assembler
-[[this chapter is still being built]]
-
-@section Design
-We had these goals, in descending priority:
-@table @b
-@item Accuracy.
-For every program composed by a compiler, @code{_AS__} should emit
-``correct'' code. This leaves some latitude in choosing addressing
-modes, order of @code{relocation_info} structures in the object
-file, @emph{etc}.
-
-@item Speed, for usual case.
-By far the most common use of @code{_AS__} will be assembling compiler
-emissions.
-
-@item Upward compatibility for existing assembler code.
-Well @dots{} we don't support Vax bit fields but everything else
-seems to be upward compatible.
-
-@item Readability.
-The code should be maintainable with few surprises. (JF: ha!)
-
-@end table
-
-We assumed that disk I/O was slow and expensive while memory was
-fast and access to memory was cheap. We expect the in-memory data
-structures to be less than 10 times the size of the emitted object
-file. (Contrast this with the C compiler where in-memory structures
-might be 100 times object file size!)
-This suggests:
-@itemize @bullet
-@item
-Try to read the source file from disk only one time. For other
-reasons, we keep large chunks of the source file in memory during
-assembly so this is not a problem. Also the assembly algorithm
-should only scan the source text once if the compiler composed the
-text according to a few simple rules.
-@item
-Emit the object code bytes only once. Don't store values and then
-backpatch later.
-@item
-Build the object file in memory and do direct writes to disk of
-large buffers.
-@end itemize
-
-RMS suggested a one-pass algorithm which seems to work well. By not
-parsing text during a second pass considerable time is saved on
-large programs (@emph{e.g.} the sort of C program @code{yacc} would
-emit).
-
-It happened that the data structures needed to emit relocation
-information to the object file were neatly subsumed into the data
-structures that do backpatching of addresses after pass 1.
-
-Many of the functions began life as re-usable modules, loosely
-connected. RMS changed this to gain speed. For example, input
-parsing routines which used to work on pre-sanitized strings now
-must parse raw data. Hence they have to import knowledge of the
-assemblers' comment conventions @emph{etc}.
-
-@section Deprecated Feature(?)s
-We have stopped supporting some features:
-@itemize @bullet
-@item
-@code{.org} statements must have @b{defined} expressions.
-@item
-Vax Bit fields (@kbd{:} operator) are entirely unsupported.
-@end itemize
-
-It might be a good idea to not support these features in a future release:
-@itemize @bullet
-@item
-@kbd{#} should begin a comment, even in column 1.
-@item
-Why support the logical line & file concept any more?
-@item
-Subsections are a good candidate for flushing.
-Depends on which compilers need them I guess.
-@end itemize
-
-@section Bugs, Ideas, Further Work
-Clearly the major improvement is DON'T USE A TEXT-READING
-ASSEMBLER for the back end of a compiler. It is much faster to
-interpret binary gobbledygook from a compiler's tables than to
-ask the compiler to write out human-readable code just so the
-assembler can parse it back to binary.
-
-Assuming you use @code{_AS__} for human written programs: here are
-some ideas:
-@itemize @bullet
-@item
-Document (here) @code{APP}.
-@item
-Take advantage of knowing no spaces except after opcode
-to speed up @code{_AS__}. (Modify @code{app.c} to flush useless spaces:
-only keep space/tabs at begin of line or between 2
-symbols.)
-@item
-Put pointers in this documentation to @file{a.out} documentation.
-@item
-Split the assembler into parts so it can gobble direct binary
-from @emph{e.g.} @code{cc}. It is silly for@code{cc} to compose text
-just so @code{_AS__} can parse it back to binary.
-@item
-Rewrite hash functions: I want a more modular, faster library.
-@item
-Clean up LOTS of code.
-@item
-Include all the non-@file{.c} files in the maintenance chapter.
-@item
-Document flonums.
-@item
-Implement flonum short literals.
-@item
-Change all talk of expression operands to expression quantities,
-or perhaps to expression arguments.
-@item
-Implement pass 2.
-@item
-Whenever a @code{.text} or @code{.data} statement is seen, we close
-of the current frag with an imaginary @code{.fill 0}. This is
-because we only have one obstack for frags, and we can't grow new
-frags for a new subsection, then go back to the old subsection and
-append bytes to the old frag. All this nonsense goes away if we
-give each subsection its own obstack. It makes code simpler in
-about 10 places, but nobody has bothered to do it because C compiler
-output rarely changes subsections (compared to ending frags with
-relaxable addresses, which is common).
-@end itemize
-
-@section Sources
-@c The following files in the @file{_AS__} directory
-@c are symbolic links to other files, of
-@c the same name, in a different directory.
-@c @itemize @bullet
-@c @item
-@c @file{atof_generic.c}
-@c @item
-@c @file{atof_vax.c}
-@c @item
-@c @file{flonum_const.c}
-@c @item
-@c @file{flonum_copy.c}
-@c @item
-@c @file{flonum_get.c}
-@c @item
-@c @file{flonum_multip.c}
-@c @item
-@c @file{flonum_normal.c}
-@c @item
-@c @file{flonum_print.c}
-@c @end itemize
-
-Here is a list of the source files in the @file{_AS__} directory.
-
-@table @file
-@item app.c
-This contains the pre-processing phase, which deletes comments,
-handles whitespace, etc. This was recently re-written, since app
-used to be a separate program, but RMS wanted it to be inline.
-
-@item append.c
-This is a subroutine to append a string to another string returning a
-pointer just after the last @code{char} appended. (JF: All these
-little routines should probably all be put in one file.)
-
-@item as.c
-Here you will find the main program of the assembler @code{_AS__}.
-
-@item expr.c
-This is a branch office of @file{read.c}. This understands
-expressions, arguments. Inside @code{_AS__}, arguments are called
-(expression) @emph{operands}. This is confusing, because we also talk
-(elsewhere) about instruction @emph{operands}. Also, expression
-operands are called @emph{quantities} explicitly to avoid confusion
-with instruction operands. What a mess.
-
-@item frags.c
-This implements the @b{frag} concept. Without frags, finding the
-right size for branch instructions would be a lot harder.
-
-@item hash.c
-This contains the symbol table, opcode table @emph{etc.} hashing
-functions.
-
-@item hex_value.c
-This is a table of values of digits, for use in atoi() type
-functions. Could probably be flushed by using calls to strtol(), or
-something similar.
-
-@item input-file.c
-This contains Operating system dependent source file reading
-routines. Since error messages often say where we are in reading
-the source file, they live here too. Since @code{_AS__} is intended to
-run under GNU and Unix only, this might be worth flushing. Anyway,
-almost all C compilers support stdio.
-
-@item input-scrub.c
-This deals with calling the pre-processor (if needed) and feeding the
-chunks back to the rest of the assembler the right way.
-
-@item messages.c
-This contains operating system independent parts of fatal and
-warning message reporting. See @file{append.c} above.
-
-@item output-file.c
-This contains operating system dependent functions that write an
-object file for @code{_AS__}. See @file{input-file.c} above.
-
-@item read.c
-This implements all the directives of @code{_AS__}. This also deals
-with passing input lines to the machine dependent part of the
-assembler.
-
-@item strstr.c
-This is a C library function that isn't in most C libraries yet.
-See @file{append.c} above.
-
-@item subsegs.c
-This implements subsections.
-
-@item symbols.c
-This implements symbols.
-
-@item write.c
-This contains the code to perform relaxation, and to write out
-the object file. It is mostly operating system independent, but
-different OSes have different object file formats in any case.
-
-@item xmalloc.c
-This implements @code{malloc()} or bust. See @file{append.c} above.
-
-@item xrealloc.c
-This implements @code{realloc()} or bust. See @file{append.c} above.
-
-@item atof-generic.c
-The following files were taken from a machine-independent subroutine
-library for manipulating floating point numbers and very large
-integers.
-
-@file{atof-generic.c} turns a string into a flonum internal format
-floating-point number.
-
-@item flonum-const.c
-This contains some potentially useful floating point numbers in
-flonum format.
-
-@item flonum-copy.c
-This copies a flonum.
-
-@item flonum-multip.c
-This multiplies two flonums together.
-
-@item bignum-copy.c
-This copies a bignum.
-
-@end table
-
-Here is a table of all the machine-specific files (this includes
-both source and header files). Typically, there is a
-@var{machine}.c file, a @var{machine}-opcode.h file, and an
-atof-@var{machine}.c file. The @var{machine}-opcode.h file should
-be identical to the one used by GDB (which uses it for disassembly.)
-
-@table @file
-
-@item atof-ieee.c
-This contains code to turn a flonum into a ieee literal constant.
-This is used by tye 680x0, 32x32, sparc, and i386 versions of @code{_AS__}.
-
-@item i386-opcode.h
-This is the opcode-table for the i386 version of the assembler.
-
-@item i386.c
-This contains all the code for the i386 version of the assembler.
-
-@item i386.h
-This defines constants and macros used by the i386 version of the assembler.
-
-@item m-generic.h
-generic 68020 header file. To be linked to m68k.h on a
-non-sun3, non-hpux system.
-
-@item m-sun2.h
-68010 header file for Sun2 workstations. Not well tested. To be linked
-to m68k.h on a sun2. (See also @samp{-DSUN_ASM_SYNTAX} in the
-@file{Makefile}.)
-
-@item m-sun3.h
-68020 header file for Sun3 workstations. To be linked to m68k.h before
-compiling on a Sun3 system. (See also @samp{-DSUN_ASM_SYNTAX} in the
-@file{Makefile}.)
-
-@item m-hpux.h
-68020 header file for a HPUX (system 5?) box. Which box, which
-version of HPUX, etc? I don't know.
-
-@item m68k.h
-A hard- or symbolic- link to one of @file{m-generic.h},
-@file{m-hpux.h} or @file{m-sun3.h} depending on which kind of
-680x0 you are assembling for. (See also @samp{-DSUN_ASM_SYNTAX} in the
-@file{Makefile}.)
-
-@item m68k-opcode.h
-Opcode table for 68020. This is now a link to the opcode table
-in the @code{GDB} source directory.
-
-@item m68k.c
-All the mc680x0 code, in one huge, slow-to-compile file.
-
-@item ns32k.c
-This contains the code for the ns32032/ns32532 version of the
-assembler.
-
-@item ns32k-opcode.h
-This contains the opcode table for the ns32032/ns32532 version
-of the assembler.
-
-@item vax-inst.h
-Vax specific file for describing Vax operands and other Vax-ish things.
-
-@item vax-opcode.h
-Vax opcode table.
-
-@item vax.c
-Vax specific parts of @code{_AS__}. Also includes the former files
-@file{vax-ins-parse.c}, @file{vax-reg-parse.c} and @file{vip-op.c}.
-
-@item atof-vax.c
-Turns a flonum into a Vax constant.
-
-@item vms.c
-This file contains the special code needed to put out a VMS
-style object file for the Vax.
-
-@end table
-
-Here is a list of the header files in the source directory.
-(Warning: This section may not be very accurate. I didn't
-write the header files; I just report them.) Also note that I
-think many of these header files could be cleaned up or
-eliminated.
-
-@table @file
-
-@item a.out.h
-This describes the structures used to create the binary header data
-inside the object file. Perhaps we should use the one in
-@file{/usr/include}?
-
-@item as.h
-This defines all the globally useful things, and pulls in _0__<stdio.h>_1__
-and _0__<assert.h>_1__.
-
-@item bignum.h
-This defines macros useful for dealing with bignums.
-
-@item expr.h
-Structure and macros for dealing with expression()
-
-@item flonum.h
-This defines the structure for dealing with floating point
-numbers. It #includes @file{bignum.h}.
-
-@item frags.h
-This contains macro for appending a byte to the current frag.
-
-@item hash.h
-Structures and function definitions for the hashing functions.
-
-@item input-file.h
-Function headers for the input-file.c functions.
-
-@item md.h
-structures and function headers for things defined in the
-machine dependent part of the assembler.
-
-@item obstack.h
-This is the GNU systemwide include file for manipulating obstacks.
-Since nobody is running under real GNU yet, we include this file.
-
-@item read.h
-Macros and function headers for reading in source files.
-
-@item struct-symbol.h
-Structure definition and macros for dealing with the _AS__
-internal form of a symbol.
-
-@item subsegs.h
-structure definition for dealing with the numbered subsections
-of the text and data sections.
-
-@item symbols.h
-Macros and function headers for dealing with symbols.
-
-@item write.h
-Structure for doing section fixups.
-@end table
-
-@comment ~subsection Test Directory
-@comment (Note: The test directory seems to have disappeared somewhere
-@comment along the line. If you want it, you'll probably have to find a
-@comment REALLY OLD dump tape~dots{})
-@comment
-@comment The ~file{test/} directory is used for regression testing.
-@comment After you modify ~@code{_AS__}, you can get a quick go/nogo
-@comment confidence test by running the new ~@code{_AS__} over the source
-@comment files in this directory. You use a shell script ~file{test/do}.
-@comment
-@comment The tests in this suite are evolving. They are not comprehensive.
-@comment They have, however, caught hundreds of bugs early in the debugging
-@comment cycle of ~@code{_AS__}. Most test statements in this suite were naturally
-@comment selected: they were used to demonstrate actual ~@code{_AS__} bugs rather
-@comment than being written ~i{a prioi}.
-@comment
-@comment Another testing suggestion: over 30 bugs have been found simply by
-@comment running examples from this manual through ~@code{_AS__}.
-@comment Some examples in this manual are selected
-@comment to distinguish boundary conditions; they are good for testing ~@code{_AS__}.
-@comment
-@comment ~subsubsection Regression Testing
-@comment Each regression test involves assembling a file and comparing the
-@comment actual output of ~@code{_AS__} to ``known good'' output files. Both
-@comment the object file and the error/warning message file (stderr) are
-@comment inspected. Optionally the ~@code{_AS__} exit status may be checked.
-@comment Discrepencies are reported. Each discrepency means either that
-@comment you broke some part of ~@code{_AS__} or that the ``known good'' files
-@comment are now out of date and should be changed to reflect the new
-@comment definition of ``good''.
-@comment
-@comment Each regression test lives in its own directory, in a tree
-@comment rooted in the directory ~file{test/}. Each such directory
-@comment has a name ending in ~file{.ret}, where `ret' stands for
-@comment REgression Test. The ~file{.ret} ending allows ~code{find
-@comment (1)} to find all regression tests in the tree, without
-@comment needing to list them explicitly.
-@comment
-@comment Any ~file{.ret} directory must contain a file called
-@comment ~file{input} which is the source file to assemble. During
-@comment testing an object file ~file{output} is created, as well as
-@comment a file ~file{stdouterr} which contains the output to both
-@comment stderr and stderr. If there is a file ~file{output.good} in
-@comment the directory, and if ~file{output} contains exactly the
-@comment same data as ~file{output.good}, the file ~file{output} is
-@comment deleted. Likewise ~file{stdouterr} is removed if it exactly
-@comment matches a file ~file{stdouterr.good}. If file
-@comment ~file{status.good} is present, containing a decimal number
-@comment before a newline, the exit status of ~@code{_AS__} is compared
-@comment to this number. If the status numbers are not equal, a file
-@comment ~file{status} is written to the directory, containing the
-@comment actual status as a decimal number followed by newline.
-@comment
-@comment Should any of the ~file{*.good} files fail to match their corresponding
-@comment actual files, this is noted by a 1-line message on the screen during
-@comment the regression test, and you can use ~@code{find (1)} to find any
-@comment files named ~file{status}, ~file {output} or ~file{stdouterr}.
-@comment
-@node Retargeting, Copying, Maintenance, Top
-@chapter Teaching the Assembler about a New Machine
-
-This chapter describes the steps required in order to make the
-assembler work with another machine's assembly language. This
-chapter is not complete, and only describes the steps in the
-broadest terms. You should look at the source for the
-currently supported machine in order to discover some of the
-details that aren't mentioned here.
-
-You should create a new file called @file{@var{machine}.c}, and
-add the appropriate lines to the file @file{Makefile} so that
-you can compile your new version of the assembler. This should
-be straighforward; simply add lines similar to the ones there
-for the four current versions of the assembler.
-
-If you want to be compatible with GDB, (and the current
-machine-dependent versions of the assembler), you should create
-a file called @file{@var{machine}-opcode.h} which should
-contain all the information about the names of the machine
-instructions, their opcodes, and what addressing modes they
-support. If you do this right, the assembler and GDB can share
-this file, and you'll only have to write it once. Note that
-while you're writing @code{_AS__}, you may want to use an
-independent program (if you have access to one), to make sure
-that @code{_AS__} is emitting the correct bytes. Since @code{_AS__}
-and @code{GDB} share the opcode table, an incorrect opcode
-table entry may make invalid bytes look OK when you disassemble
-them with @code{GDB}.
-
-@section Functions You will Have to Write
-
-Your file @file{@var{machine}.c} should contain definitions for
-the following functions and variables. It will need to include
-some header files in order to use some of the structures
-defined in the machine-independent part of the assembler. The
-needed header files are mentioned in the descriptions of the
-functions that will need them.
-
-@table @code
-
-@item long omagic;
-This long integer holds the value to place at the beginning of
-the @file{a.out} file. It is usually @samp{OMAGIC}, except on
-machines that store additional information in the magic-number.
-
-@item char comment_chars[];
-This character array holds the values of the characters that
-start a comment anywhere in a line. Comments are stripped off
-automatically by the machine independent part of the
-assembler. Note that the @samp{/*} will always start a
-comment, and that only @samp{*/} will end a comment started by
-@samp{*/}.
-
-@item char line_comment_chars[];
-This character array holds the values of the chars that start a
-comment only if they are the first (non-whitespace) character
-on a line. If the character @samp{#} does not appear in this
-list, you may get unexpected results. (Various
-machine-independent parts of the assembler treat the comments
-@samp{#APP} and @samp{#NO_APP} specially, and assume that lines
-that start with @samp{#} are comments.)
-
-@item char EXP_CHARS[];
-This character array holds the letters that can separate the
-mantissa and the exponent of a floating point number. Typical
-values are @samp{e} and @samp{E}.
-
-@item char FLT_CHARS[];
-This character array holds the letters that--when they appear
-immediately after a leading zero--indicate that a number is a
-floating-point number. (Sort of how 0x indicates that a
-hexadecimal number follows.)
-
-@item pseudo_typeS md_pseudo_table[];
-(@var{pseudo_typeS} is defined in @file{md.h})
-This array contains a list of the machine_dependent directives
-the assembler must support. It contains the name of each
-pseudo op (Without the leading @samp{.}), a pointer to a
-function to be called when that directive is encountered, and
-an integer argument to be passed to that function.
-
-@item void md_begin(void)
-This function is called as part of the assembler's
-initialization. It should do any initialization required by
-any of your other routines.
-
-@item int md_parse_option(char **optionPTR, int *argcPTR, char ***argvPTR)
-This routine is called once for each option on the command line
-that the machine-independent part of @code{_AS__} does not
-understand. This function should return non-zero if the option
-pointed to by @var{optionPTR} is a valid option. If it is not
-a valid option, this routine should return zero. The variables
-@var{argcPTR} and @var{argvPTR} are provided in case the option
-requires a filename or something similar as an argument. If
-the option is multi-character, @var{optionPTR} should be
-advanced past the end of the option, otherwise every letter in
-the option will be treated as a separate single-character
-option.
-
-@item void md_assemble(char *string)
-This routine is called for every machine-dependent
-non-directive line in the source file. It does all the real
-work involved in reading the opcode, parsing the operands,
-etc. @var{string} is a pointer to a null-terminated string,
-that comprises the input line, with all excess whitespace and
-comments removed.
-
-@item void md_number_to_chars(char *outputPTR,long value,int nbytes)
-This routine is called to turn a C long int, short int, or char
-into the series of bytes that represents that number on the
-target machine. @var{outputPTR} points to an array where the
-result should be stored; @var{value} is the value to store; and
-@var{nbytes} is the number of bytes in 'value' that should be
-stored.
-
-@item void md_number_to_imm(char *outputPTR,long value,int nbytes)
-This routine is called to turn a C long int, short int, or char
-into the series of bytes that represent an immediate value on
-the target machine. It is identical to the function @code{md_number_to_chars},
-except on NS32K machines.@refill
-
-@item void md_number_to_disp(char *outputPTR,long value,int nbytes)
-This routine is called to turn a C long int, short int, or char
-into the series of bytes that represent an displacement value on
-the target machine. It is identical to the function @code{md_number_to_chars},
-except on NS32K machines.@refill
-
-@item void md_number_to_field(char *outputPTR,long value,int nbytes)
-This routine is identical to @code{md_number_to_chars},
-except on NS32K machines.
-
-@item void md_ri_to_chars(struct relocation_info *riPTR,ri)
-(@code{struct relocation_info} is defined in @file{a.out.h})
-This routine emits the relocation info in @var{ri}
-in the appropriate bit-pattern for the target machine.
-The result should be stored in the location pointed
-to by @var{riPTR}. This routine may be a no-op unless you are
-attempting to do cross-assembly.
-
-@item char *md_atof(char type,char *outputPTR,int *sizePTR)
-This routine turns a series of digits into the appropriate
-internal representation for a floating-point number.
-@var{type} is a character from @var{FLT_CHARS[]} that describes
-what kind of floating point number is wanted; @var{outputPTR}
-is a pointer to an array that the result should be stored in;
-and @var{sizePTR} is a pointer to an integer where the size (in
-bytes) of the result should be stored. This routine should
-return an error message, or an empty string (not (char *)0) for
-success.
-
-@item int md_short_jump_size;
-This variable holds the (maximum) size in bytes of a short (16
-bit or so) jump created by @code{md_create_short_jump()}. This
-variable is used as part of the broken-word feature, and isn't
-needed if the assembler is compiled with
-@samp{-DWORKING_DOT_WORD}.
-
-@item int md_long_jump_size;
-This variable holds the (maximum) size in bytes of a long (32
-bit or so) jump created by @code{md_create_long_jump()}. This
-variable is used as part of the broken-word feature, and isn't
-needed if the assembler is compiled with
-@samp{-DWORKING_DOT_WORD}.
-
-@item void md_create_short_jump(char *resultPTR,long from_addr,
-@code{long to_addr,fragS *frag,symbolS *to_symbol)}
-This function emits a jump from @var{from_addr} to @var{to_addr} in
-the array of bytes pointed to by @var{resultPTR}. If this creates a
-type of jump that must be relocated, this function should call
-@code{fix_new()} with @var{frag} and @var{to_symbol}. The jump
-emitted by this function may be smaller than @var{md_short_jump_size},
-but it must never create a larger one.
-(If it creates a smaller jump, the extra bytes of memory will not be
-used.) This function is used as part of the broken-word feature,
-and isn't needed if the assembler is compiled with
-@samp{-DWORKING_DOT_WORD}.@refill
-
-@item void md_create_long_jump(char *ptr,long from_addr,
-@code{long to_addr,fragS *frag,symbolS *to_symbol)}
-This function is similar to the previous function,
-@code{md_create_short_jump()}, except that it creates a long
-jump instead of a short one. This function is used as part of
-the broken-word feature, and isn't needed if the assembler is
-compiled with @samp{-DWORKING_DOT_WORD}.
-
-@item int md_estimate_size_before_relax(fragS *fragPTR,int segment_type)
-This function does the initial setting up for relaxation. This
-includes forcing references to still-undefined symbols to the
-appropriate addressing modes.
-
-@item relax_typeS md_relax_table[];
-(relax_typeS is defined in md.h)
-This array describes the various machine dependent states a
-frag may be in before relaxation. You will need one group of
-entries for each type of addressing mode you intend to relax.
-
-@item void md_convert_frag(fragS *fragPTR)
-(@var{fragS} is defined in @file{as.h})
-This routine does the required cleanup after relaxation.
-Relaxation has changed the type of the frag to a type that can
-reach its destination. This function should adjust the opcode
-of the frag to use the appropriate addressing mode.
-@var{fragPTR} points to the frag to clean up.
-
-@item void md_end(void)
-This function is called just before the assembler exits. It
-need not free up memory unless the operating system doesn't do
-it automatically on exit. (In which case you'll also have to
-track down all the other places where the assembler allocates
-space but never frees it.)
-
-@end table
-
-@section External Variables You will Need to Use
-
-You will need to refer to or change the following external variables
-from within the machine-dependent part of the assembler.
-
-@table @code
-@item extern char flagseen[];
-This array holds non-zero values in locations corresponding to
-the options that were on the command line. Thus, if the
-assembler was called with @samp{-W}, @var{flagseen['W']} would
-be non-zero.
-
-@item extern fragS *frag_now;
-This pointer points to the current frag--the frag that bytes
-are currently being added to. If nothing else, you will need
-to pass it as an argument to various machine-independent
-functions. It is maintained automatically by the
-frag-manipulating functions; you should never have to change it
-yourself.
-
-@item extern LITTLENUM_TYPE generic_bignum[];
-(@var{LITTLENUM_TYPE} is defined in @file{bignum.h}.
-This is where @dfn{bignums}--numbers larger than 32 bits--are
-returned when they are encountered in an expression. You will
-need to use this if you need to implement directives (or
-anything else) that must deal with these large numbers.
-@code{Bignums} are of @code{segT} @code{SEG_BIG} (defined in
-@file{as.h}, and have a positive @code{X_add_number}. The
-@code{X_add_number} of a @code{bignum} is the number of
-@code{LITTLENUMS} in @var{generic_bignum} that the number takes
-up.
-
-@item extern FLONUM_TYPE generic_floating_point_number;
-(@var{FLONUM_TYPE} is defined in @file{flonum.h}.
-The is where @dfn{flonums}--floating-point numbers within
-expressions--are returned. @code{Flonums} are of @code{segT}
-@code{SEG_BIG}, and have a negative @code{X_add_number}.
-@code{Flonums} are returned in a generic format. You will have
-to write a routine to turn this generic format into the
-appropriate floating-point format for your machine.
-
-@item extern int need_pass_2;
-If this variable is non-zero, the assembler has encountered an
-expression that cannot be assembled in a single pass. Since
-the second pass isn't implemented, this flag means that the
-assembler is punting, and is only looking for additional syntax
-errors. (Or something like that.)
-
-@item extern segT now_seg;
-This variable holds the value of the section the assembler is
-currently assembling into.
-
-@end table
-
-@section External functions will you need
-
-You will find the following external functions useful (or
-indispensable) when you're writing the machine-dependent part
-of the assembler.
-
-@table @code
-
-@item char *frag_more(int bytes)
-This function allocates @var{bytes} more bytes in the current
-frag (or starts a new frag, if it can't expand the current frag
-any more.) for you to store some object-file bytes in. It
-returns a pointer to the bytes, ready for you to store data in.
-
-@item void fix_new(fragS *frag, int where, short size, symbolS *add_symbol, symbolS *sub_symbol, long offset, int pcrel)
-This function stores a relocation fixup to be acted on later.
-@var{frag} points to the frag the relocation belongs in;
-@var{where} is the location within the frag where the relocation begins;
-@var{size} is the size of the relocation, and is usually 1 (a single byte),
- 2 (sixteen bits), or 4 (a longword).
-The value @var{add_symbol} @minus{} @var{sub_symbol} + @var{offset}, is added to the byte(s)
-at _0__@var{frag->literal[where]}_1__. If @var{pcrel} is non-zero, the address of the
-location is subtracted from the result. A relocation entry is also added
-to the @file{a.out} file. @var{add_symbol}, @var{sub_symbol}, and/or
-@var{offset} may be NULL.@refill
-
-@item char *frag_var(relax_stateT type, int max_chars, int var,
-@code{relax_substateT subtype, symbolS *symbol, char *opcode)}
-This function creates a machine-dependent frag of type @var{type}
-(usually @code{rs_machine_dependent}).
-@var{max_chars} is the maximum size in bytes that the frag may grow by;
-@var{var} is the current size of the variable end of the frag;
-@var{subtype} is the sub-type of the frag. The sub-type is used to index into
-@var{md_relax_table[]} during @code{relaxation}.
-@var{symbol} is the symbol whose value should be used to when relax-ing this frag.
-@var{opcode} points into a byte whose value may have to be modified if the
-addressing mode used by this frag changes. It typically points into the
-@var{fr_literal[]} of the previous frag, and is used to point to a location
-that @code{md_convert_frag()}, may have to change.@refill
-
-@item void frag_wane(fragS *fragPTR)
-This function is useful from within @code{md_convert_frag}. It
-changes a frag to type rs_fill, and sets the variable-sized
-piece of the frag to zero. The frag will never change in size
-again.
-
-@item segT expression(expressionS *retval)
-(@var{segT} is defined in @file{as.h}; @var{expressionS} is defined in @file{expr.h})
-This function parses the string pointed to by the external char
-pointer @var{input_line_pointer}, and returns the section-type
-of the expression. It also stores the results in the
-@var{expressionS} pointed to by @var{retval}.
-@var{input_line_pointer} is advanced to point past the end of
-the expression. (@var{input_line_pointer} is used by other
-parts of the assembler. If you modify it, be sure to restore
-it to its original value.)
-
-@item as_warn(char *message,@dots{})
-If warning messages are disabled, this function does nothing.
-Otherwise, it prints out the current file name, and the current
-line number, then uses @code{fprintf} to print the
-@var{message} and any arguments it was passed.
-
-@item as_bad(char *message,@dots{})
-This function should be called when @code{_AS__} encounters
-conditions that are bad enough that @code{_AS__} should not
-produce an object file, but should continue reading input and
-printing warning and bad error messages.
-
-@item as_fatal(char *message,@dots{})
-This function prints out the current file name and line number,
-prints the word @samp{FATAL:}, then uses @code{fprintf} to
-print the @var{message} and any arguments it was passed. Then
-the assembler exits. This function should only be used for
-serious, unrecoverable errors.
-
-@item void float_const(int float_type)
-This function reads floating-point constants from the current
-input line, and calls @code{md_atof} to assemble them. It is
-useful as the function to call for the directives
-@samp{.single}, @samp{.double}, @samp{.float}, etc.
-@var{float_type} must be a character from @var{FLT_CHARS}.
-
-@item void demand_empty_rest_of_line(void);
-This function can be used by machine-dependent directives to
-make sure the rest of the input line is empty. It prints a
-warning message if there are additional characters on the line.
-
-@item long int get_absolute_expression(void)
-This function can be used by machine-dependent directives to
-read an absolute number from the current input line. It
-returns the result. If it isn't given an absolute expression,
-it prints a warning message and returns zero.
-
-@end table
-
-
-@section The concept of Frags
-
-This assembler works to optimize the size of certain addressing
-modes. (e.g. branch instructions) This means the size of many
-pieces of object code cannot be determined until after assembly
-is finished. (This means that the addresses of symbols cannot be
-determined until assembly is finished.) In order to do this,
-@code{_AS__} stores the output bytes as @dfn{frags}.
-
-Here is the definition of a frag (from @file{as.h})
-@smallexample
-struct frag
-@{
- long int fr_fix;
- long int fr_var;
- relax_stateT fr_type;
- relax_substateT fr_substate;
- unsigned long fr_address;
- long int fr_offset;
- struct symbol *fr_symbol;
- char *fr_opcode;
- struct frag *fr_next;
- char fr_literal[];
-@}
-@end smallexample
-
-@table @var
-@item fr_fix
-is the size of the fixed-size piece of the frag.
-
-@item fr_var
-is the maximum (?) size of the variable-sized piece of the frag.
-
-@item fr_type
-is the type of the frag.
-Current types are:
-rs_fill
-rs_align
-rs_org
-rs_machine_dependent
-
-@item fr_substate
-This stores the type of machine-dependent frag this is. (what
-kind of addressing mode is being used, and what size is being
-tried/will fit/etc.
-
-@item fr_address
-@var{fr_address} is only valid after relaxation is finished.
-Before relaxation, the only way to store an address is (pointer
-to frag containing the address) plus (offset into the frag).
-
-@item fr_offset
-This contains a number, whose meaning depends on the type of
-the frag.
-for machine_dependent frags, this contains the offset from
-fr_symbol that the frag wants to go to. Thus, for branch
-instructions it is usually zero. (unless the instruction was
-@samp{jba foo+12} or something like that.)
-
-@item fr_symbol
-for machine_dependent frags, this points to the symbol the frag
-needs to reach.
-
-@item fr_opcode
-This points to the location in the frag (or in a previous frag)
-of the opcode for the instruction that caused this to be a frag.
-@var{fr_opcode} is needed if the actual opcode must be changed
-in order to use a different form of the addressing mode.
-(For example, if a conditional branch only comes in size tiny,
-a large-size branch could be implemented by reversing the sense
-of the test, and turning it into a tiny branch over a large jump.
-This would require changing the opcode.)
-
-@var{fr_literal} is a variable-size array that contains the
-actual object bytes. A frag consists of a fixed size piece of
-object data, (which may be zero bytes long), followed by a
-piece of object data whose size may not have been determined
-yet. Other information includes the type of the frag (which
-controls how it is relaxed),
-
-@item fr_next
-This is the next frag in the singly-linked list. This is
-usually only needed by the machine-independent part of
-@code{_AS__}.
-
-@end table
-_fi__(0)
-
-@node Copying, Index, _MACH_DEP__, Top
-@unnumbered GNU GENERAL PUBLIC LICENSE
-
-@cindex license
-@cindex GPL
-@cindex copying @code{_AS__}
-@center Version 2, June 1991
-
-@display
-Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
-675 Mass Ave, Cambridge, MA 02139, USA
-
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-@end display
-
-@unnumberedsec Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software---to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
-@iftex
-@unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-@end iftex
-@ifinfo
-@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-@end ifinfo
-
-@enumerate
-@item
-This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The ``Program'', below,
-refers to any such program or work, and a ``work based on the Program''
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term ``modification''.) Each licensee is addressed as ``you''.
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-@item
-You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-@item
-You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-@enumerate a
-@item
-You must cause the modified files to carry prominent notices
-stating that you changed the files and the date of any change.
-
-@item
-You must cause any work that you distribute or publish, that in
-whole or in part contains or is derived from the Program or any
-part thereof, to be licensed as a whole at no charge to all third
-parties under the terms of this License.
-
-@item
-If the modified program normally reads commands interactively
-when run, you must cause it, when started running for such
-interactive use in the most ordinary way, to print or display an
-announcement including an appropriate copyright notice and a
-notice that there is no warranty (or else, saying that you provide
-a warranty) and that users may redistribute the program under
-these conditions, and telling the user how to view a copy of this
-License. (Exception: if the Program itself is interactive but
-does not normally print such an announcement, your work based on
-the Program is not required to print an announcement.)
-@end enumerate
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-@item
-You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-@enumerate a
-@item
-Accompany it with the complete corresponding machine-readable
-source code, which must be distributed under the terms of Sections
-1 and 2 above on a medium customarily used for software interchange; or,
-
-@item
-Accompany it with a written offer, valid for at least three
-years, to give any third party, for a charge no more than your
-cost of physically performing source distribution, a complete
-machine-readable copy of the corresponding source code, to be
-distributed under the terms of Sections 1 and 2 above on a medium
-customarily used for software interchange; or,
-
-@item
-Accompany it with the information you received as to the offer
-to distribute corresponding source code. (This alternative is
-allowed only for noncommercial distribution and only if you
-received the program in object code or executable form with such
-an offer, in accord with Subsection b above.)
-@end enumerate
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-@item
-You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-@item
-You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-@item
-Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-@item
-If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-@item
-If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-@item
-The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and ``any
-later version'', you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-@item
-If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-@iftex
-@heading NO WARRANTY
-@end iftex
-@ifinfo
-@center NO WARRANTY
-@end ifinfo
-
-@item
-BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-@item
-IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-@end enumerate
-
-@iftex
-@heading END OF TERMS AND CONDITIONS
-@end iftex
-@ifinfo
-@center END OF TERMS AND CONDITIONS
-@end ifinfo
-
-@page
-@unnumberedsec Applying These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the ``copyright'' line and a pointer to where the full notice is found.
-
-@smallexample
-@var{one line to give the program's name and an idea of what it does.}
-Copyright (C) 19@var{yy} @var{name of author}
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the
-Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.
-@end smallexample
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-@smallexample
-Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author}
-Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
-type `show w'. This is free software, and you are welcome
-to redistribute it under certain conditions; type `show c'
-for details.
-@end smallexample
-
-The hypothetical commands @samp{show w} and @samp{show c} should show
-the appropriate parts of the General Public License. Of course, the
-commands you use may be called something other than @samp{show w} and
-@samp{show c}; they could even be mouse-clicks or menu items---whatever
-suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a ``copyright disclaimer'' for the program, if
-necessary. Here is a sample; alter the names:
-
-@smallexample
-Yoyodyne, Inc., hereby disclaims all copyright interest in
-the program `Gnomovision' (which makes passes at compilers)
-written by James Hacker.
-
-@var{signature of Ty Coon}, 1 April 1989
-Ty Coon, President of Vice
-@end smallexample
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-
-@node Index, , Copying, Top
-@unnumbered Index
-
-@printindex cp
-
-@summarycontents
-@contents
-@bye
diff --git a/gnu/usr.bin/as/doc/config.status b/gnu/usr.bin/as/doc/config.status
deleted file mode 100644
index f1e7f63..0000000
--- a/gnu/usr.bin/as/doc/config.status
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-# This file was generated automatically by configure. Do not edit.
-# /d/users/pk/src/gnu/usr.bin/gas.1.93/gas/doc was configured as follows:
-/d/users/pk/src/gnu/usr.bin/gas.1.93/./configure i386 -target=i386 -norecursion
-#
diff --git a/gnu/usr.bin/as/doc/configure.in b/gnu/usr.bin/as/doc/configure.in
deleted file mode 100644
index f9820ea..0000000
--- a/gnu/usr.bin/as/doc/configure.in
+++ /dev/null
@@ -1,34 +0,0 @@
-# This file is configure.in
-#
-# Copyright (C) 1987-1992 Free Software Foundation, Inc.
-#
-# This file is part of GAS, the GNU Assembler.
-#
-# GAS is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# GAS 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 GAS; see the file COPYING. If not, write to
-# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-#
-
-# This file is a shell script that supplies the information necessary
-# to tailor a template configure script into the configure script
-# appropriate for this directory. For more information, check any
-# existing configure script.
-
-srctrigger=all.m4
-srcname="gas doc"
-
-# per-host:
-
-# per-target:
-
-# end of gas/doc/configure.in
diff --git a/gnu/usr.bin/as/doc/gen.m4 b/gnu/usr.bin/as/doc/gen.m4
deleted file mode 100644
index bf444a6..0000000
--- a/gnu/usr.bin/as/doc/gen.m4
+++ /dev/null
@@ -1,14 +0,0 @@
-_divert__(-1)
-<$Id: gen.m4,v 1.1 1993/10/02 21:00:19 pk Exp $>
-_define__(<_GENERIC__>,<1>) In case none.m4 changes its mind abt default
-
-_define__(<_AOUT__>,<1>)
-_define__(<_COFF__>,<1>)
-_define__(<_ELF__>,<1>)
-
-_define__(<_I80386__>,<1>)
-_define__(<_M680X0__>,<1>)
-_define__(<_SPARC__>,<1>)
-_define__(<_VAX__>,<1>)
-
-_divert__<>
diff --git a/gnu/usr.bin/as/doc/h8.m4 b/gnu/usr.bin/as/doc/h8.m4
deleted file mode 100644
index ed52c85..0000000
--- a/gnu/usr.bin/as/doc/h8.m4
+++ /dev/null
@@ -1,15 +0,0 @@
-_divert__(-1)
-_define__(<_H8__>,<1>)
-_define__(<_AS__>,<as83>)
-_define__(<_GENERIC__>,<0>)
-_define__(<_HOST__>,<H8/300>)
-_define__(<_MACH_DEP__>,<H8/300-Dependent>)
-_define__(<_AOUT__>,<0>)
-_define__(<_BOUT__>,<0>)
-_define__(<_COFF__>,<1>)
-_define__(<_ELF__>,<0>)
-_define__(<_DIFFTABKLUG__>,0) NO difference-table kluge
-_define__(<_IEEEFLOAT__>,1) IEEE floating point
-_define__(<_W32__>,0)
-_define__(<_W16__>,1) 16-bit words
-_divert__<>
diff --git a/gnu/usr.bin/as/doc/i80386.m4 b/gnu/usr.bin/as/doc/i80386.m4
deleted file mode 100644
index e8718aa..0000000
--- a/gnu/usr.bin/as/doc/i80386.m4
+++ /dev/null
@@ -1,12 +0,0 @@
-_divert__(-1)
-_define__(<_I80386__>,<1>)
-_define__(<_GENERIC__>,<0>)
-_define__(<_HOST__>,<Intel 80386>)
-_define__(<_MACH_DEP__>,<i386-Dependent>)
-_define__(<_AOUT__>,<1>)
-_define__(<_BOUT__>,<0>)
-_define__(<_COFF__>,<0>)
-_define__(<_ELF__>,<0>)
-_define__(<_W32__>,0)
-_define__(<_W16__>,1) 16-bit words
-_divert__<>
diff --git a/gnu/usr.bin/as/doc/i960.m4 b/gnu/usr.bin/as/doc/i960.m4
deleted file mode 100644
index 1fca147..0000000
--- a/gnu/usr.bin/as/doc/i960.m4
+++ /dev/null
@@ -1,16 +0,0 @@
-_divert__(-1)
-_define__(<_I960__>,<1>)
-_define__(<_AOUT__>,<0>)
-_define__(<_BOUT__>,<1>)
-_define__(<_COFF__>,<1>)
-_define__(<_AS__>,<gas960>)
-_define__(<_GCC__>,<gcc960>)
-_define__(<_LD__>,<gld960>)
-_define__(<_GDB__>,<gdb960>)
-_define__(<_HOST__>,<Intel 960>)
-_define__(<_MACH_DEP__>,<i960-Dependent>)
-_define__(<_DIFFTABKLUG__>,0) NO difference-table kluge
-_define__(<_IEEEFLOAT__>,1) IEEE floating point
-_define__(<_W32__>,1) 32-bit words
-_define__(<_W16__>,0)
-_divert__<>
diff --git a/gnu/usr.bin/as/doc/m680x0.m4 b/gnu/usr.bin/as/doc/m680x0.m4
deleted file mode 100644
index 4013e72..0000000
--- a/gnu/usr.bin/as/doc/m680x0.m4
+++ /dev/null
@@ -1,8 +0,0 @@
-_divert__(-1)
-_define__(<_GENERIC__>,<0>)
-_define__(<_M680X0__>,<1>)
-_define__(<_HOST__>,<Motorola 680x0>)
-_define__(<_MACH_DEP__>,<M68K-Dependent>)
-_define__(<_W32__>,0)
-_define__(<_W16__>,1) 16-bit words
-_divert__<>
diff --git a/gnu/usr.bin/as/doc/none.m4 b/gnu/usr.bin/as/doc/none.m4
deleted file mode 100644
index dfa17d3..0000000
--- a/gnu/usr.bin/as/doc/none.m4
+++ /dev/null
@@ -1,57 +0,0 @@
-_divert__(-1)
-<$Id: none.m4,v 1.1 1993/10/02 21:00:24 pk Exp $>
-
-Switches:
-
-_define__(<_ALL_ARCH__>,<0>) (Meant as most inclusive; file turning
- it on is expected to also turn on
- all arch-related switches including
- "_GENERIC__")
-_define__(<_GENERIC__>,<1>) (may not be quite all configs;
- meant for "most vanilla" manual)
-_define__(<_INTERNALS__>,<0>)
-
-_define__(<_AOUT__>,<1>) Object formats. Note we turn on one.
-_define__(<_BOUT__>,<0>)
-_define__(<_COFF__>,<0>)
-_define__(<_ELF__>,<0>)
-
- Properties of the assembler
-_define__(<_DIFFTABKLUG__>,1) Do we use the difference-table kluge?
-_define__(<_IEEEFLOAT__>,0) IEEE floating-point?
-_define__(<_W32__>,0) word is 32 bits
-_define__(<_W16__>,1) word is 16 bits
-
-_define__(<_A29K__>,<0>) Specific architectures. Note none
-_define__(<_H8__>,<0>) starts out on.
-_define__(<_I80386__>,<0>)
-_define__(<_I960__>,<0>)
-_define__(<_M680X0__>,<0>)
-_define__(<_SPARC__>,<0>)
-_define__(<_VAX__>,<0>)
-_define__(<_VXWORKS__>,<0>)
-
-Text:
-
-Default names; individual configs may override
-Assembler:
-_define__(<_AS__>,<as>)
-C Compiler:
-_define__(<_GCC__>,<gcc>)
-Linker:
-_define__(<_LD__>,<ld>)
-Debugger name:
-_define__(<_GDBN__>,<GDB>)
-Debugger program:
-_define__(<_GDBP__>,<gdb>)
-Debugger init file:
-_define__(<_GDBINIT__>,<.gdbinit>)
-
-Text for host; individual configs *should* override, but this may
-catch some flubs
-_define__(<_HOST__>,<machine specific>)
-
-"Machine Dependent" nodename
-_define__(<_MACH_DEP__>,<Machine Dependent>)
-
-_divert__<>
diff --git a/gnu/usr.bin/as/doc/pretex.m4 b/gnu/usr.bin/as/doc/pretex.m4
deleted file mode 100644
index 9a9696f..0000000
--- a/gnu/usr.bin/as/doc/pretex.m4
+++ /dev/null
@@ -1,268 +0,0 @@
-divert(-1) -*-Text-*-
-` Copyright (c) 1991 Free Software Foundation, Inc.'
-` This file defines and documents the M4 macros used '
-` to preprocess some GNU manuals'
-` $Id: pretex.m4,v 1.1 1993/10/02 21:00:25 pk Exp $'
-
-I. INTRODUCTION
-
-This collection of M4 macros is meant to help in pre-processing texinfo
-files to allow configuring them by hosts; for example, the reader of an
-as manual who only has access to a 386 may not really want to see crud about
-VAXen.
-
-A preprocessor is used, rather than extending texinfo, because this
-way we can hack the conditionals in only one place; otherwise we would
-have to write TeX macros, update makeinfo, and update the Emacs
-info-formatting functions.
-
-II. COMPATIBILITY
-
-These macros should work with GNU m4 and System V m4; they do not work
-with Sun or Berkeley M4.
-
-III. USAGE
-
-A. M4 INVOCATION
-Assume this file is called "pretex.m4". Then, to preprocess a
-document "mybook.texinfo" you might do something like the following:
-
- m4 pretex.m4 none.m4 PARTIC.m4 mybook.texinfo >mybook-PARTIC.texinfo
-
----where your path is set to find GNU or SysV "m4", and the other m4
-files mentioned are as follows:
-
- none.m4: A file that defines, as 0, all the options you might
- want to turn on using the conditionals defined below.
- Unlike the C preprocessor, m4 does not default
- undefined macros to 0. For example, here is a "none.m4"
- I have been using:
- _divert__(-1)
-
- _define__(<_ALL_ARCH__>,<0>)
- _define__(<_INTERNALS__>,<0>)
-
- _define__(<_AMD29K__>,<0>)
- _define__(<_I80386__>,<0>)
- _define__(<_I960__>,<0>)
- _define__(<_M680X0__>,<0>)
- _define__(<_SPARC__>,<0>)
- _define__(<_VAX__>,<0>)
-
- _divert__<>
-
- PARTIC.m4: A file that turns on whichever options you actually
- want the manual configured for, in this particular
- instance. Its contents are similar to one or more of
- the lines in "none.m4", but of course the second
- argument to _define__ is <1> rather than <0>.
-
- This is also a convenient place to _define__ any macros
- that you want to expand to different text for
- different configurations---for example, the name of
- the program being described.
-
-Naturally, these are just suggested conventions; you could put your macro
-definitions in any files or combinations of files you like.
-
-These macros use the characters < and > as m4 quotes; if you need
-these characters in your text, you will also want to use the macros
-_0__ and _1__ from this package---see the description of "Quote
-Handling" in the "Implementation" section below.
-
-B. WHAT GOES IN THE PRE-TEXINFO SOURCE
-
-For the most part, the text of your book. In addition, you can
-have text that is included only conditionally, using the macros
-_if__ and _fi__ defined below. They BOTH take an argument! This is
-primarily meant for readability (so a human can more easily see what
-conditional end matches what conditional beginning), but the argument
-is actually used in the _fi__ as well as the _if__ implementation.
-You should always give a _fi__ the same argument as its matching
-_if__. Other arguments may appear to work for a while, but are almost
-certain to produce the wrong output for some configurations.
-
-For example, here is an excerpt from the very beginning of the
-documentation for GNU as, to name the info file appropriately for
-different configurations:
- _if__(_ALL_ARCH__)
- @setfilename as.info
- _fi__(_ALL_ARCH__)
- _if__(_M680X0__ && !_ALL_ARCH__)
- @setfilename as-m680x0.info
- _fi__(_M680X0__ && !_ALL_ARCH__)
- _if__(_AMD29K__ && !_ALL_ARCH__)
- @setfilename as-29k.info
- _fi__(_AMD29K__ && !_ALL_ARCH__)
-
-Note that you can use Boolean expressions in the arguments; the
-expression language is that of the built-in m4 macro `eval', described
-in the m4 manual.
-
-IV. IMPLEMENTATION
-
-A.PRIMITIVE RENAMING
-First, we redefine m4's built-ins to avoid conflict with plain text.
-The naming convention used is that our macros all begin with a single
-underbar and end with two underbars. The asymmetry is meant to avoid
-conflict with some other conventions (which we may want to document) that
-are intended to avoid conflict, like ANSI C predefined macros.
-
-define(`_undefine__',defn(`undefine'))
-define(`_define__',defn(`define'))
-define(`_defn__',defn(`defn'))
-define(`_ppf__',`_define__(`_$1__',_defn__(`$1'))_undefine__(`$1')')
-_ppf__(`builtin')
-_ppf__(`changecom')
-_ppf__(`changequote')
-_ppf__(`decr')
-_ppf__(`define')
-_ppf__(`defn')
-_ppf__(`divert')
-_ppf__(`divnum')
-_ppf__(`dnl')
-_ppf__(`dumpdef')
-_ppf__(`errprint')
-_ppf__(`esyscmd')
-_ppf__(`eval')
-_ppf__(`format')
-_ppf__(`ifdef')
-_ppf__(`ifelse')
-_ppf__(`include')
-_ppf__(`incr')
-_ppf__(`index')
-_ppf__(`len')
-_ppf__(`m4exit')
-_ppf__(`m4wrap')
-_ppf__(`maketemp')
-_ppf__(`patsubst')
-_ppf__(`popdef')
-_ppf__(`pushdef')
-_ppf__(`regexp')
-_ppf__(`shift')
-_ppf__(`sinclude')
-_ppf__(`substr')
-_ppf__(`syscmd')
-_ppf__(`sysval')
-_ppf__(`traceoff')
-_ppf__(`traceon')
-_ppf__(`translit')
-_ppf__(`undefine')
-_ppf__(`undivert')
-_ppf__(`unix')
-
-B. QUOTE HANDLING.
-
-The characters used as quotes by M4, by default, are unfortunately
-quite likely to occur in ordinary text. To avoid surprises, we will
-use the characters <> ---which are just as suggestive (more so to
-Francophones, perhaps) but a little less common in text (save for
-those poor Francophones. You win some, you lose some). Still, we
-expect also to have to set < and > occasionally in text; to do that,
-we define a macro to turn off quote handling (_0__) and a macro to
-turn it back on (_1__), according to our convention.
-
- BEWARE: This seems to make < and > unusable as relational operations
- in calls to the builtin "eval". So far I've gotten
- along without; but a better choice may be possible.
-
-Note that we postponed this for a while, for convenience in discussing
-the issue and in the primitive renaming---not to mention in defining
-_0__ and _1__ themselves! However, the quote redefinitions MUST
-precede the _if__ / _fi__ definitions, because M4 will expand the text
-as given---if we use the wrong quotes here, we will get the wrong
-quotes when we use the conditionals.
-
-_define__(_0__,`_changequote__(,)')_define__(_1__,`_changequote__(<,>)')
-_1__
-
-C. CONDITIONALS
-
-We define two macros, _if__ and _fi__. BOTH take arguments! This is
-meant both to help the human reader match up a _fi__ with its
-corresponding _if__ and to aid in the implementation. You may use the
-full expression syntax supported by M4 (see docn of `eval' builtin in
-the m4 manual).
-
-The conditional macros are carefully defined to avoid introducing
-extra whitespace (i.e., blank lines or blank characters). One side
-effect exists---
-
- BEWARE: text following an `_if__' on the same line is
- DISCARDED even if the condition is true; text
- following a `_fi__' on the same line is also
- always discarded.
-
-The recommended convention is to always place _if__ and _fi__ on a
-line by themselves. This will also aid the human reader. TeX won't
-care about the line breaks; as for info, you may want to insert calls
-to `@refill' at the end of paragraphs containing conditionalized text,
-where you don't want line breaks separating unconditional from
-conditional text. info formatting will then give you nice looking
-paragraphs in the info file.
-
-Nesting: conditionals are designed to nest, in the following way:
-*nothing* is output between an outer pair of false conditionals, even
-if there are true conditionals inside. A false conditional "defeats"
-all conditionals within it. The counter _IF_FS__ is used to
-implement this; kindly avoid redefining it directly.
-
-_define__(<_IF_FS__>,<0>)
-
-NOTE: The definitions for our "pushf" and "popf" macros use eval
-rather than incr and decr, because GNU m4 (0.75) tries to call eval
-for us when we say "incr" or "decr"---but doesn't notice we've changed
-eval's name.
-
-_define__(
- <_pushf__>,
- <_define__(<_IF_FS__>,
- _eval__((_IF_FS__)+1))>)
-_define__(
- <_popf__>,
- <_ifelse__(0,_IF_FS__,
- <<>_dnl__<>>,
- <_define__(<_IF_FS__>,_eval__((_IF_FS__)-1))>)>)
-
-_define__(
- <_if__>,
- <_ifelse__(1,_eval__( ($1) ),
- <<>_dnl__<>>,
- <_pushf__<>_divert__(-1)>)>)
-_define__(
- <_fi__>,
- <_ifelse__(1,_eval__( ($1) ),
- <<>_dnl__<>>,
- <_popf__<>_ifelse__(0,_IF_FS__,
- <_divert__<>_dnl__<>>,<>)>)>)
-
-D. CHAPTER/SECTION MACRO
-In a parametrized manual, the heading level may need to be calculated;
-for example, a manual that has a chapter on machine dependencies
-should be conditionally structured as follows:
- - IF the manual is configured for a SINGLE machine type, use
-the chapter heading for that machine type, and run headings down
-from there (top level for a particular machine is chapter, then within
-that we have section, subsection etc);
- - ELSE, if MANY machine types are described in the chapter,
-use a generic chapter heading such as "@chapter Machine Dependencies",
-use "section" for the top level description of EACH machine, and run
-headings down from there (top level for a particular machine is
-section, then within that we have subsection, subsubsection etc).
-
-The macro <_CHAPSEC__> is for this purpose: its argument is evaluated (so
-you can construct expressions to express choices such as above), then
-expands as follows:
- 0: @chapter
- 1: @section
- 2: @subsection
- 3: @subsubsection
- ...and so on.
-
-_define__(<_CHAPSEC__>,<@_cs__(_eval__($1))>)
-_define__(<_cs__>,<_ifelse__(
- 0, $1, <chapter>,
- 1, $1, <section>,
- <sub<>_cs__(_eval__($1 - 1))>)>)
-
-_divert__<>_dnl__<>
diff --git a/gnu/usr.bin/as/doc/sparc.m4 b/gnu/usr.bin/as/doc/sparc.m4
deleted file mode 100644
index 121855a..0000000
--- a/gnu/usr.bin/as/doc/sparc.m4
+++ /dev/null
@@ -1,8 +0,0 @@
-_divert__(-1)
-_define__(<_SPARC__>,<1>)
-_define__(<_HOST__>,<SPARC>)
-_define__(<_MACH_DEP__>,<Sparc-Dependent>)
-_define__(<_IEEEFLOAT__>,1) IEEE floating point
-_define__(<_W32__>,1) 32-bit words
-_define__(<_W16__>,0)
-_divert__<>
diff --git a/gnu/usr.bin/as/doc/vax.m4 b/gnu/usr.bin/as/doc/vax.m4
deleted file mode 100644
index 009e334..0000000
--- a/gnu/usr.bin/as/doc/vax.m4
+++ /dev/null
@@ -1,7 +0,0 @@
-_divert__(-1)
-_define__(<_VAX__>,<1>)
-_define__(<_HOST__>,<VAX>)
-_define__(<_MACH_DEP__>,<VAX-Dependent>)
-_define__(<_W32__>,0)
-_define__(<_W16__>,1) 16-bit words
-_divert__<>
diff --git a/gnu/usr.bin/as/doc/vintage.m4 b/gnu/usr.bin/as/doc/vintage.m4
deleted file mode 100644
index d5913be..0000000
--- a/gnu/usr.bin/as/doc/vintage.m4
+++ /dev/null
@@ -1,11 +0,0 @@
-_divert__(-1)
-<$Id: vintage.m4,v 1.1 1993/10/02 21:00:29 pk Exp $>
-_define__(<_ALL_ARCH__>,<1>)
-_define__(<_GENERIC__>,<1>) In case none.m4 changes its mind abt default
-
-_define__(<_AOUT__>,<1>)
-
-_define__(<_M680X0__>,<1>)
-_define__(<_SPARC__>,<1>)
-
-_divert__<>
diff --git a/gnu/usr.bin/as/flonum-const.c b/gnu/usr.bin/as/flonum-const.c
deleted file mode 100644
index 617e585..0000000
--- a/gnu/usr.bin/as/flonum-const.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/* flonum_const.c - Useful Flonum constants
- Copyright (C) 1987 Free Software Foundation, Inc.
-
-This file is part of GAS, the GNU Assembler.
-
-GAS 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.
-
-GAS 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 GAS; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "flonum.h"
-/* JF: I added the last entry to this table, and I'm not
- sure if its right or not. Could go either way. I wish
- I really understood this stuff. */
-
-
-const int table_size_of_flonum_powers_of_ten = 11;
-
-static const LITTLENUM_TYPE zero[] = { 1 };
-
-/***********************************************************************\
-* *
-* Warning: the low order bits may be WRONG here. *
-* I took this from a suspect bc(1) script. *
-* "minus_X"[] is supposed to be 10^(2^-X) expressed in base 2^16. *
-* The radix point is just AFTER the highest element of the [] *
-* *
-* Because bc rounds DOWN for printing (I think), the lowest *
-* significance littlenums should probably have 1 added to them. *
-* *
-\***********************************************************************/
-
-/* JF: If this equals 6553/(2^16)+39321/(2^32)+... it approaches .1 */
-static const LITTLENUM_TYPE minus_1 [] = {
- 39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321,
- 39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321, 39321, 6553 };
-static const LITTLENUM_TYPE plus_1 [] = { 10 };
-
-/* JF: If this equals 655/(2^16) + 23592/(2^32) + ... it approaches .01 */
-static const LITTLENUM_TYPE minus_2 [] = {
- 10485, 36700, 62914, 23592, 49807, 10485, 36700, 62914, 23592, 49807,
- 10485, 36700, 62914, 23592, 49807, 10485, 36700, 62914, 23592, 655 };
-static const LITTLENUM_TYPE plus_2 [] = { 100 };
-
-/* This approaches .0001 */
-static const LITTLENUM_TYPE minus_3 [] = {
- 52533, 20027, 37329, 65116, 64067, 60397, 14784, 18979, 33659, 19503,
- 2726, 9542, 629, 2202, 40475, 10590, 4299, 47815, 36280, 6 };
-static const LITTLENUM_TYPE plus_3 [] = { 10000 };
-
-/* JF: this approaches 1e-8 */
-static const LITTLENUM_TYPE minus_4 [] = {
- 22516, 49501, 54293, 19424, 60699, 6716, 24348, 22618, 23904, 21327,
- 3919, 44703, 19149, 28803, 48959, 6259, 50273, 62237, 42 };
-/* This equals 1525 * 2^16 + 57600 */
-static const LITTLENUM_TYPE plus_4 [] = { 57600, 1525 };
-
-/* This approaches 1e-16 */
-static const LITTLENUM_TYPE minus_5 [] = {
- 22199, 45957, 17005, 26266, 10526, 16260, 55017, 35680, 40443, 19789,
- 17356, 30195, 55905, 28426, 63010, 44197, 1844 };
-static const LITTLENUM_TYPE plus_5 [] = { 28609, 34546, 35 };
-
-static const LITTLENUM_TYPE minus_6 [] = {
- 30926, 26518, 13110, 43018, 54982, 48258, 24658, 15209, 63366, 11929,
- 20069, 43857, 60487, 51 };
-static const LITTLENUM_TYPE plus_6 [] = { 61313, 34220, 16731, 11629, 1262 };
-
-static const LITTLENUM_TYPE minus_7 [] = {
- 29819, 14733, 21490, 40602, 31315, 65186, 2695 };
-static const LITTLENUM_TYPE plus_7 [] = {
- 7937, 49002, 60772, 28216, 38893, 55975, 63988, 59711, 20227, 24 };
-
-static const LITTLENUM_TYPE minus_8 [] = {
- 45849, 19069, 18068, 36324, 37948, 48745, 10873, 64360, 15961, 20566,
- 24178, 15922, 59427, 110 };
-static const LITTLENUM_TYPE plus_8 [] = {
- 15873, 11925, 39177, 991, 14589, 19735, 25347, 65086, 53853, 938,
- 37209, 47086, 33626, 23253, 32586, 42547, 9731, 59679, 590 };
-
-static const LITTLENUM_TYPE minus_9 [] = {
- 63601, 55221, 43562, 33661, 29067, 28203, 65417, 64352, 22462, 41110,
- 12570, 28635, 23199, 50572, 28471, 27074, 46375, 64028, 13106, 63700,
- 32698, 17493, 32420, 34382, 22750, 20681, 12300 };
-static const LITTLENUM_TYPE plus_9 [] = {
- 63564, 61556, 29377, 54467, 18621, 28141, 36415, 61241, 47119, 30026,
- 19740, 46002, 13541, 61413, 30480, 38664, 32205, 50593, 51112, 48904,
- 48263, 43814, 286, 30826, 52813, 62575, 61390, 24540, 21495, 5 };
-
-static const LITTLENUM_TYPE minus_10 [] = {
- 50313, 34681, 1464, 25889, 19575, 41125, 17635, 4598, 49708, 13427,
- 17287, 56115, 53783, 38255, 32415, 17778, 31596, 7557, 20951, 18477,
- 40353, 1178, 44405, 11837, 11571, 50963, 15649, 11698, 40675, 2308, };
-static const LITTLENUM_TYPE plus_10[] = {
-18520, 53764, 54535, 61910, 61962, 59843, 46270, 58053, 12473, 63785,
- 2449, 43230, 50044, 47595, 10403, 35766, 32607, 1124, 24966, 35044,
-25524, 23631, 18826, 14518, 58448, 14562, 49618, 5588, 25396, 28 };
-
-static const LITTLENUM_TYPE minus_11 [] = {
- 6223, 59909, 62437, 59960, 14652, 45336, 48800, 7647, 51962, 37982,
- 60436, 58176, 26767, 8440, 9831, 48556, 20994, 14148, 6757, 17221,
- 60624, 46129, 53210, 44085, 54016, 24259, 11232, 21229, 21313, 81, };
-static const LITTLENUM_TYPE plus_11 [] = {
- 36159, 2055, 33615, 61362, 23581, 62454, 9748, 15275, 39284, 58636,
- 16269, 42793, 47240, 45774, 50861, 48400, 9413, 40281, 4030, 9572,
- 7984, 33038, 59522, 19450, 40593, 24486, 54320, 6661, 55766, 805, };
-
-/* Shut up complaints about differing pointer types. They only differ
- in the const attribute, but there isn't any easy way to do this
- */
-#define X (LITTLENUM_TYPE *)
-
-const FLONUM_TYPE flonum_negative_powers_of_ten [] = {
- {X zero, X zero, X zero, 0, '+'},
- {X minus_1, X minus_1 +19, X minus_1 + 19, -20, '+'},
- {X minus_2, X minus_2 +19, X minus_2 + 19, -20, '+'},
- {X minus_3, X minus_3 +19, X minus_3 + 19, -20, '+'},
- {X minus_4, X minus_4 +18, X minus_4 + 18, -20, '+'},
- {X minus_5, X minus_5 +16, X minus_5 + 16, -20, '+'},
- {X minus_6, X minus_6 +13, X minus_6 + 13, -20, '+'},
- {X minus_7, X minus_7 + 6, X minus_7 + 6, -20, '+'},
- {X minus_8, X minus_8 +13, X minus_8 + 13, -40, '+'},
- {X minus_9, X minus_9 +26, X minus_9 + 26, -80, '+'},
- {X minus_10, X minus_10+29, X minus_10 + 29,-136, '+'},
- {X minus_11, X minus_11+29, X minus_11 + 29,-242, '+'},
-};
-
-const FLONUM_TYPE flonum_positive_powers_of_ten [] = {
- {X zero, X zero, X zero, 0, '+'},
- {X plus_1, X plus_1 + 0, X plus_1 + 0, 0, '+'},
- {X plus_2, X plus_2 + 0, X plus_2 + 0, 0, '+'},
- {X plus_3, X plus_3 + 0, X plus_3 + 0, 0, '+'},
- {X plus_4, X plus_4 + 1, X plus_4 + 1, 0, '+'},
- {X plus_5, X plus_5 + 2, X plus_5 + 2, 1, '+'},
- {X plus_6, X plus_6 + 4, X plus_6 + 4, 2, '+'},
- {X plus_7, X plus_7 + 9, X plus_7 + 9, 4, '+'},
- {X plus_8, X plus_8 + 18, X plus_8 + 18, 8, '+'},
- {X plus_9, X plus_9 + 29, X plus_9 + 29, 24, '+'},
- {X plus_10, X plus_10 + 29, X plus_10 + 29, 77, '+'},
- {X plus_11, X plus_11 + 29, X plus_11 + 29, 183, '+'},
-};
-
-#ifdef VMS
-dummy1()
-{
-}
-#endif
-/* end: flonum_const.c */
diff --git a/gnu/usr.bin/as/flonum-copy.c b/gnu/usr.bin/as/flonum-copy.c
deleted file mode 100644
index 3a51f06..0000000
--- a/gnu/usr.bin/as/flonum-copy.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* flonum_copy.c - copy a flonum
- Copyright (C) 1987 Free Software Foundation, Inc.
-
-This file is part of GAS, the GNU Assembler.
-
-GAS 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.
-
-GAS 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 GAS; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "flonum.h"
-#ifdef USG
-#define bzero(s,n) memset(s,0,n)
-#define bcopy(from,to,n) memcpy(to,from,n)
-#endif
-
-void
-flonum_copy (in, out)
- FLONUM_TYPE * in;
- FLONUM_TYPE * out;
-{
- int in_length; /* 0 origin */
- int out_length; /* 0 origin */
-
- out -> sign = in -> sign;
- in_length = in -> leader - in -> low;
- if (in_length < 0)
- {
- out -> leader = out -> low - 1; /* 0.0 case */
- }
- else
- {
- out_length = out -> high - out -> low;
- /*
- * Assume no GAPS in packing of littlenums.
- * I.e. sizeof(array) == sizeof(element) * number_of_elements.
- */
- if (in_length <= out_length)
- {
- {
- /*
- * For defensive programming, zero any high-order littlenums we don't need.
- * This is destroying evidence and wasting time, so why bother???
- */
- if (in_length < out_length)
- {
- bzero ((char *)(out->low + in_length + 1), out_length - in_length);
- }
- }
- bcopy ((char *)(in->low), (char *)(out->low), (int)((in_length + 1) * sizeof(LITTLENUM_TYPE)));
- out -> exponent = in -> exponent;
- out -> leader = in -> leader - in -> low + out -> low;
- }
- else
- {
- int shorten; /* 1-origin. Number of littlenums we drop. */
-
- shorten = in_length - out_length;
- /* Assume out_length >= 0 ! */
- bcopy ((char *)(in->low + shorten),(char *)( out->low), (int)((out_length + 1) * sizeof(LITTLENUM_TYPE)));
- out -> leader = out -> high;
- out -> exponent = in -> exponent + shorten;
- }
- } /* if any significant bits */
-}
-
-/* end: flonum_copy.c */
diff --git a/gnu/usr.bin/as/md.h b/gnu/usr.bin/as/md.h
deleted file mode 100644
index 681d027..0000000
--- a/gnu/usr.bin/as/md.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* md.h -machine dependent- */
-
-/* Copyright (C) 1987 Free Software Foundation, Inc.
-
-This file is part of Gas, the GNU Assembler.
-
-The GNU assembler is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the GNU Assembler General
-Public License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-the GNU Assembler, but only under the conditions described in the
-GNU Assembler General Public License. A copy of this license is
-supposed to have been given to you along with the GNU Assembler
-so you can know your rights and responsibilities. It should be
-in a file named COPYING. Among other things, the copyright
-notice and this notice must be preserved on all copies. */
-
-/* In theory (mine, at least!) the machine dependent part of the assembler
- should only have to include one file. This one. -- JF */
-
-/* JF added this here */
-typedef struct {
- char * poc_name; /* assembler mnemonic, lower case, no '.' */
- void (*poc_handler)(); /* Do the work */
- int poc_val; /* Value to pass to handler */
-}
-pseudo_typeS;
-extern const pseudo_typeS md_pseudo_table[];
-
-/* JF moved this here from as.h under the theory that nobody except MACHINE.c
- and write.c care about it anyway. */
-
-typedef struct
-{
- long rlx_forward; /* Forward reach. Signed number. > 0. */
- long rlx_backward; /* Backward reach. Signed number. < 0. */
- unsigned char rlx_length; /* Bytes length of this address. */
- relax_substateT rlx_more; /* Next longer relax-state. */
- /* 0 means there is no 'next' relax-state. */
-}
-relax_typeS;
-
-extern const relax_typeS md_relax_table[]; /* Define it in MACHINE.c */
-
-char * md_atof();
-void md_assemble();
-void md_begin();
-void md_convert_frag();
-void md_end();
-int md_estimate_size_before_relax();
-void md_number_to_chars();
-
-/* end: md.h */
diff --git a/gnu/usr.bin/as/objrecdef.h b/gnu/usr.bin/as/objrecdef.h
deleted file mode 100644
index fca8af4..0000000
--- a/gnu/usr.bin/as/objrecdef.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- *
- * $OBJRECDEF
- * Generated automatically by "vms_struct Version 1.00"
- * Created from VMS definition file "objrecdef.mar"
- * Mon Oct 14 14:01:29 1985
- *
- */
-struct OBJREC {
- unsigned char obj$b_rectyp;
- unsigned char obj$b_subtyp;
- unsigned char obj$b_mhd_strlv;
- unsigned char obj$b_mhd_recsz[2];
- unsigned char obj$t_mhd_name[1];
- };
-
-#define OBJ$C_HDR 0
-#define OBJ$C_HDR_MHD 0
-#define OBJ$C_HDR_LNM 1
-#define OBJ$C_HDR_SRC 2
-#define OBJ$C_HDR_TTL 3
-#define OBJ$C_HDR_CPR 4
-#define OBJ$C_HDR_MTC 5
-#define OBJ$C_HDR_GTX 6
-#define OBJ$C_GSD 1
-#define OBJ$C_GSD_PSC 0
-#define OBJ$C_GSD_SYM 1
-#define OBJ$C_GSD_EPM 2
-#define OBJ$C_GSD_PRO 3
-#define OBJ$C_GSD_SYMW 4
-#define OBJ$C_GSD_EPMW 5
-#define OBJ$C_GSD_PROW 6
-#define OBJ$C_GSD_IDC 7
-#define OBJ$C_GSD_ENV 8
-#define OBJ$C_GSD_LSY 9
-#define OBJ$C_GSD_LEPM 10
-#define OBJ$C_GSD_LPRO 11
-#define OBJ$C_GSD_SPSC 12
-#define OBJ$C_TIR 2
-#define OBJ$C_EOM 3
-#define OBJ$C_DBG 4
-#define OBJ$C_TBT 5
-#define OBJ$C_LNK 6
-#define OBJ$C_EOMW 7
-#define OBJ$C_MAXRECTYP 7
-#define OBJ$K_SUBTYP 1
-#define OBJ$C_SUBTYP 1
-#define OBJ$C_MAXRECSIZ 2048
-#define OBJ$C_STRLVL 0
-#define OBJ$C_SYMSIZ 31
-#define OBJ$C_STOREPLIM -1
-#define OBJ$C_PSCALILIM 9
-
-#define MHD$C_MHD 0
-#define MHD$C_LNM 1
-#define MHD$C_SRC 2
-#define MHD$C_TTL 3
-#define MHD$C_CPR 4
-#define MHD$C_MTC 5
-#define MHD$C_GTX 6
-#define MHD$C_MAXHDRTYP 6
-
-#define GSD$K_ENTRIES 1
-#define GSD$C_ENTRIES 1
-#define GSD$C_PSC 0
-#define GSD$C_SYM 1
-#define GSD$C_EPM 2
-#define GSD$C_PRO 3
-#define GSD$C_SYMW 4
-#define GSD$C_EPMW 5
-#define GSD$C_PROW 6
-#define GSD$C_IDC 7
-#define GSD$C_ENV 8
-#define GSD$C_LSY 9
-#define GSD$C_LEPM 10
-#define GSD$C_LPRO 11
-#define GSD$C_SPSC 12
-#define GSD$C_SYMV 13
-#define GSD$C_EPMV 14
-#define GSD$C_PROV 15
-#define GSD$C_MAXRECTYP 15
-
-#define GSY$M_WEAK 1
-#define GSY$M_DEF 2
-#define GSY$M_UNI 4
-#define GSY$M_REL 8
-
-#define GPS$M_PIC 1
-#define GPS$M_LIB 2
-#define GPS$M_OVR 4
-#define GPS$M_REL 8
-#define GPS$M_GBL 16
-#define GPS$M_SHR 32
-#define GPS$M_EXE 64
-#define GPS$M_RD 128
-#define GPS$M_WRT 256
-#define GPS$M_VEC 512
-#define GPS$K_NAME 9
-#define GPS$C_NAME 9
-
-#define TIR$C_STA_GBL 0
-#define TIR$C_STA_SB 1
-#define TIR$C_STA_SW 2
-#define TIR$C_STA_LW 3
-#define TIR$C_STA_PB 4
-#define TIR$C_STA_PW 5
-#define TIR$C_STA_PL 6
-#define TIR$C_STA_UB 7
-#define TIR$C_STA_UW 8
-#define TIR$C_STA_BFI 9
-#define TIR$C_STA_WFI 10
-#define TIR$C_STA_LFI 11
-#define TIR$C_STA_EPM 12
-#define TIR$C_STA_CKARG 13
-#define TIR$C_STA_WPB 14
-#define TIR$C_STA_WPW 15
-#define TIR$C_STA_WPL 16
-#define TIR$C_STA_LSY 17
-#define TIR$C_STA_LIT 18
-#define TIR$C_STA_LEPM 19
-#define TIR$C_MAXSTACOD 19
-#define TIR$C_MINSTOCOD 20
-#define TIR$C_STO_SB 20
-#define TIR$C_STO_SW 21
-#define TIR$C_STO_L 22
-#define TIR$C_STO_BD 23
-#define TIR$C_STO_WD 24
-#define TIR$C_STO_LD 25
-#define TIR$C_STO_LI 26
-#define TIR$C_STO_PIDR 27
-#define TIR$C_STO_PICR 28
-#define TIR$C_STO_RSB 29
-#define TIR$C_STO_RSW 30
-#define TIR$C_STO_RL 31
-#define TIR$C_STO_VPS 32
-#define TIR$C_STO_USB 33
-#define TIR$C_STO_USW 34
-#define TIR$C_STO_RUB 35
-#define TIR$C_STO_RUW 36
-#define TIR$C_STO_B 37
-#define TIR$C_STO_W 38
-#define TIR$C_STO_RB 39
-#define TIR$C_STO_RW 40
-#define TIR$C_STO_RIVB 41
-#define TIR$C_STO_PIRR 42
-#define TIR$C_MAXSTOCOD 42
-#define TIR$C_MINOPRCOD 50
-#define TIR$C_OPR_NOP 50
-#define TIR$C_OPR_ADD 51
-#define TIR$C_OPR_SUB 52
-#define TIR$C_OPR_MUL 53
-#define TIR$C_OPR_DIV 54
-#define TIR$C_OPR_AND 55
-#define TIR$C_OPR_IOR 56
-#define TIR$C_OPR_EOR 57
-#define TIR$C_OPR_NEG 58
-#define TIR$C_OPR_COM 59
-#define TIR$C_OPR_INSV 60
-#define TIR$C_OPR_ASH 61
-#define TIR$C_OPR_USH 62
-#define TIR$C_OPR_ROT 63
-#define TIR$C_OPR_SEL 64
-#define TIR$C_OPR_REDEF 65
-#define TIR$C_OPR_DFLIT 66
-#define TIR$C_MAXOPRCOD 66
-#define TIR$C_MINCTLCOD 80
-#define TIR$C_CTL_SETRB 80
-#define TIR$C_CTL_AUGRB 81
-#define TIR$C_CTL_DFLOC 82
-#define TIR$C_CTL_STLOC 83
-#define TIR$C_CTL_STKDL 84
-#define TIR$C_MAXCTLCOD 84
-
-/*
- * Debugger symbol definitions: These are done by hand, as no
- * machine-readable version seems
- * to be available.
- */
-#define DST$C_C 7 /* Language == "C" */
-#define DST$C_VERSION 153
-#define DST$C_SOURCE 155 /* Source file */
-#define DST$C_PROLOG 162
-#define DST$C_BLKBEG 176 /* Beginning of block */
-#define DST$C_BLKEND 177 /* End of block */
-#define DST$C_ENTRY 181
-#define DST$C_PSECT 184
-#define DST$C_LINE_NUM 185 /* Line Number */
-#define DST$C_LBLORLIT 186
-#define DST$C_LABEL 187
-#define DST$C_MODBEG 188 /* Beginning of module */
-#define DST$C_MODEND 189 /* End of module */
-#define DST$C_RTNBEG 190 /* Beginning of routine */
-#define DST$C_RTNEND 191 /* End of routine */
-#define DST$C_DELTA_PC_W 1 /* Incr PC */
-#define DST$C_INCR_LINUM 2 /* Incr Line # */
-#define DST$C_INCR_LINUM_W 3 /* Incr Line # */
-#define DST$C_SET_LINUM_INCR 4
-#define DST$C_SET_LINUM_INCR_W 5
-#define DST$C_RESET_LINUM_INCR 6
-#define DST$C_BEG_STMT_MODE 7
-#define DST$C_END_STMT_MODE 8
-#define DST$C_SET_LINE_NUM 9 /* Set Line # */
-#define DST$C_SET_PC 10
-#define DST$C_SET_PC_W 11
-#define DST$C_SET_PC_L 12
-#define DST$C_SET_STMTNUM 13
-#define DST$C_TERM 14 /* End of lines */
-#define DST$C_TERM_W 15 /* End of lines */
-#define DST$C_SET_ABS_PC 16 /* Set PC */
-#define DST$C_DELTA_PC_L 17 /* Incr PC */
-#define DST$C_INCR_LINUM_L 18 /* Incr Line # */
-#define DST$C_SET_LINUM_B 19 /* Set Line # */
-#define DST$C_SET_LINUM_L 20 /* Set Line # */
-#define DST$C_TERM_L 21 /* End of lines */
-/* these are used with DST$C_SOURCE */
-#define DST$C_SRC_FORMFEED 16 /* ^L counts */
-#define DST$C_SRC_DECLFILE 1 /* Declare file */
-#define DST$C_SRC_SETFILE 2 /* Set file */
-#define DST$C_SRC_SETREC_L 3 /* Set record */
-#define DST$C_SRC_DEFLINES_W 10 /* # of line */
-/* the following are the codes for the various data types. Anything not on
- * the list is included under 'advanced_type'
- */
-#define DBG$C_UCHAR 0x02
-#define DBG$C_USINT 0x03
-#define DBG$C_ULINT 0x04
-#define DBG$C_SCHAR 0x06
-#define DBG$C_SSINT 0x07
-#define DBG$C_SLINT 0x08
-#define DBG$C_REAL4 0x0a
-#define DBG$C_REAL8 0x0b
-#define DBG$C_FUNCTION_ADDR 0x17
-#define DBG$C_ADVANCED_TYPE 0xa3
-/* These are the codes that are used to generate the definitions of struct
- * union and enum records
- */
-#define DBG$C_ENUM_ITEM 0xa4
-#define DBG$C_ENUM_START 0xa5
-#define DBG$C_ENUM_END 0xa6
-#define DBG$C_STRUCT_START 0xab
-#define DBG$C_STRUCT_ITEM 0xff
-#define DBG$C_STRUCT_END 0xac
-/* These are the codes that are used in the suffix records to determine the
- * actual data type
- */
-#define DBG$C_BASIC 0x01
-#define DBG$C_BASIC_ARRAY 0x02
-#define DBG$C_STRUCT 0x03
-#define DBG$C_POINTER 0x04
-#define DBG$C_VOID 0x05
-#define DBG$C_COMPLEX_ARRAY 0x07
-/* These codes are used in the generation of the symbol definition records
- */
-#define DBG$C_FUNCTION_PARAMETER 0xc9
-#define DBG$C_LOCAL_SYM 0xd9
diff --git a/gnu/usr.bin/awk/regex.c b/gnu/usr.bin/awk/regex.c
deleted file mode 100644
index 6a36f3d..0000000
--- a/gnu/usr.bin/awk/regex.c
+++ /dev/null
@@ -1,5070 +0,0 @@
-/* Extended regular expression matching and search library,
- version 0.12.
- (Implements POSIX draft P10003.2/D11.2, except for
- internationalization features.)
-
- Copyright (C) 1993 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* AIX requires this to be the first thing in the file. */
-#if defined (_AIX) && !defined (REGEX_MALLOC)
- #pragma alloca
-#endif
-
-#define _GNU_SOURCE
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if defined(STDC_HEADERS) && !defined(emacs)
-#include <stddef.h>
-#else
-/* We need this for `regex.h', and perhaps for the Emacs include files. */
-#include <sys/types.h>
-#endif
-
-/* The `emacs' switch turns on certain matching commands
- that make sense only in Emacs. */
-#ifdef emacs
-
-#include "lisp.h"
-#include "buffer.h"
-#include "syntax.h"
-
-/* Emacs uses `NULL' as a predicate. */
-#undef NULL
-
-#else /* not emacs */
-
-/* We used to test for `BSTRING' here, but only GCC and Emacs define
- `BSTRING', as far as I know, and neither of them use this code. */
-#if HAVE_STRING_H || STDC_HEADERS
-#include <string.h>
-#ifndef bcmp
-#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
-#endif
-#ifndef bcopy
-#define bcopy(s, d, n) memcpy ((d), (s), (n))
-#endif
-#ifndef bzero
-#define bzero(s, n) memset ((s), 0, (n))
-#endif
-#else
-#include <strings.h>
-#endif
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#else
-char *malloc ();
-char *realloc ();
-#endif
-
-
-/* Define the syntax stuff for \<, \>, etc. */
-
-/* This must be nonzero for the wordchar and notwordchar pattern
- commands in re_match_2. */
-#ifndef Sword
-#define Sword 1
-#endif
-
-#ifdef SYNTAX_TABLE
-
-extern char *re_syntax_table;
-
-#else /* not SYNTAX_TABLE */
-
-/* How many characters in the character set. */
-#define CHAR_SET_SIZE 256
-
-static char re_syntax_table[CHAR_SET_SIZE];
-
-static void
-init_syntax_once ()
-{
- register int c;
- static int done = 0;
-
- if (done)
- return;
-
- bzero (re_syntax_table, sizeof re_syntax_table);
-
- for (c = 'a'; c <= 'z'; c++)
- re_syntax_table[c] = Sword;
-
- for (c = 'A'; c <= 'Z'; c++)
- re_syntax_table[c] = Sword;
-
- for (c = '0'; c <= '9'; c++)
- re_syntax_table[c] = Sword;
-
- re_syntax_table['_'] = Sword;
-
- done = 1;
-}
-
-#endif /* not SYNTAX_TABLE */
-
-#define SYNTAX(c) re_syntax_table[c]
-
-#endif /* not emacs */
-
-/* Get the interface, including the syntax bits. */
-#include "regex.h"
-
-/* isalpha etc. are used for the character classes. */
-#include <ctype.h>
-
-/* Jim Meyering writes:
-
- "... Some ctype macros are valid only for character codes that
- isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
- using /bin/cc or gcc but without giving an ansi option). So, all
- ctype uses should be through macros like ISPRINT... If
- STDC_HEADERS is defined, then autoconf has verified that the ctype
- macros don't need to be guarded with references to isascii. ...
- Defining isascii to 1 should let any compiler worth its salt
- eliminate the && through constant folding." */
-#if ! defined (isascii) || defined (STDC_HEADERS)
-#undef isascii
-#define isascii(c) 1
-#endif
-
-#ifdef isblank
-#define ISBLANK(c) (isascii (c) && isblank (c))
-#else
-#define ISBLANK(c) ((c) == ' ' || (c) == '\t')
-#endif
-#ifdef isgraph
-#define ISGRAPH(c) (isascii (c) && isgraph (c))
-#else
-#define ISGRAPH(c) (isascii (c) && isprint (c) && !isspace (c))
-#endif
-
-#define ISPRINT(c) (isascii (c) && isprint (c))
-#define ISDIGIT(c) (isascii (c) && isdigit (c))
-#define ISALNUM(c) (isascii (c) && isalnum (c))
-#define ISALPHA(c) (isascii (c) && isalpha (c))
-#define ISCNTRL(c) (isascii (c) && iscntrl (c))
-#define ISLOWER(c) (isascii (c) && islower (c))
-#define ISPUNCT(c) (isascii (c) && ispunct (c))
-#define ISSPACE(c) (isascii (c) && isspace (c))
-#define ISUPPER(c) (isascii (c) && isupper (c))
-#define ISXDIGIT(c) (isascii (c) && isxdigit (c))
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* We remove any previous definition of `SIGN_EXTEND_CHAR',
- since ours (we hope) works properly with all combinations of
- machines, compilers, `char' and `unsigned char' argument types.
- (Per Bothner suggested the basic approach.) */
-#undef SIGN_EXTEND_CHAR
-#if __STDC__
-#define SIGN_EXTEND_CHAR(c) ((signed char) (c))
-#else /* not __STDC__ */
-/* As in Harbison and Steele. */
-#define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
-#endif
-
-/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we
- use `alloca' instead of `malloc'. This is because using malloc in
- re_search* or re_match* could cause memory leaks when C-g is used in
- Emacs; also, malloc is slower and causes storage fragmentation. On
- the other hand, malloc is more portable, and easier to debug.
-
- Because we sometimes use alloca, some routines have to be macros,
- not functions -- `alloca'-allocated space disappears at the end of the
- function it is called in. */
-
-#ifdef REGEX_MALLOC
-
-#define REGEX_ALLOCATE malloc
-#define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize)
-
-#else /* not REGEX_MALLOC */
-
-/* Emacs already defines alloca, sometimes. */
-#ifndef alloca
-
-/* Make alloca work the best possible way. */
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else /* not __GNUC__ */
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#else /* not __GNUC__ or HAVE_ALLOCA_H */
-#ifndef _AIX /* Already did AIX, up at the top. */
-char *alloca ();
-#endif /* not _AIX */
-#endif /* not HAVE_ALLOCA_H */
-#endif /* not __GNUC__ */
-
-#endif /* not alloca */
-
-#define REGEX_ALLOCATE alloca
-
-/* Assumes a `char *destination' variable. */
-#define REGEX_REALLOCATE(source, osize, nsize) \
- (destination = (char *) alloca (nsize), \
- bcopy (source, destination, osize), \
- destination)
-
-#endif /* not REGEX_MALLOC */
-
-
-/* True if `size1' is non-NULL and PTR is pointing anywhere inside
- `string1' or just past its end. This works if PTR is NULL, which is
- a good thing. */
-#define FIRST_STRING_P(ptr) \
- (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
-
-/* (Re)Allocate N items of type T using malloc, or fail. */
-#define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t)))
-#define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
-#define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
-
-#define BYTEWIDTH 8 /* In bits. */
-
-#define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
-
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-
-typedef char boolean;
-#define false 0
-#define true 1
-
-/* These are the command codes that appear in compiled regular
- expressions. Some opcodes are followed by argument bytes. A
- command code can specify any interpretation whatsoever for its
- arguments. Zero bytes may appear in the compiled regular expression.
-
- The value of `exactn' is needed in search.c (search_buffer) in Emacs.
- So regex.h defines a symbol `RE_EXACTN_VALUE' to be 1; the value of
- `exactn' we use here must also be 1. */
-
-typedef enum
-{
- no_op = 0,
-
- /* Followed by one byte giving n, then by n literal bytes. */
- exactn = 1,
-
- /* Matches any (more or less) character. */
- anychar,
-
- /* Matches any one char belonging to specified set. First
- following byte is number of bitmap bytes. Then come bytes
- for a bitmap saying which chars are in. Bits in each byte
- are ordered low-bit-first. A character is in the set if its
- bit is 1. A character too large to have a bit in the map is
- automatically not in the set. */
- charset,
-
- /* Same parameters as charset, but match any character that is
- not one of those specified. */
- charset_not,
-
- /* Start remembering the text that is matched, for storing in a
- register. Followed by one byte with the register number, in
- the range 0 to one less than the pattern buffer's re_nsub
- field. Then followed by one byte with the number of groups
- inner to this one. (This last has to be part of the
- start_memory only because we need it in the on_failure_jump
- of re_match_2.) */
- start_memory,
-
- /* Stop remembering the text that is matched and store it in a
- memory register. Followed by one byte with the register
- number, in the range 0 to one less than `re_nsub' in the
- pattern buffer, and one byte with the number of inner groups,
- just like `start_memory'. (We need the number of inner
- groups here because we don't have any easy way of finding the
- corresponding start_memory when we're at a stop_memory.) */
- stop_memory,
-
- /* Match a duplicate of something remembered. Followed by one
- byte containing the register number. */
- duplicate,
-
- /* Fail unless at beginning of line. */
- begline,
-
- /* Fail unless at end of line. */
- endline,
-
- /* Succeeds if at beginning of buffer (if emacs) or at beginning
- of string to be matched (if not). */
- begbuf,
-
- /* Analogously, for end of buffer/string. */
- endbuf,
-
- /* Followed by two byte relative address to which to jump. */
- jump,
-
- /* Same as jump, but marks the end of an alternative. */
- jump_past_alt,
-
- /* Followed by two-byte relative address of place to resume at
- in case of failure. */
- on_failure_jump,
-
- /* Like on_failure_jump, but pushes a placeholder instead of the
- current string position when executed. */
- on_failure_keep_string_jump,
-
- /* Throw away latest failure point and then jump to following
- two-byte relative address. */
- pop_failure_jump,
-
- /* Change to pop_failure_jump if know won't have to backtrack to
- match; otherwise change to jump. This is used to jump
- back to the beginning of a repeat. If what follows this jump
- clearly won't match what the repeat does, such that we can be
- sure that there is no use backtracking out of repetitions
- already matched, then we change it to a pop_failure_jump.
- Followed by two-byte address. */
- maybe_pop_jump,
-
- /* Jump to following two-byte address, and push a dummy failure
- point. This failure point will be thrown away if an attempt
- is made to use it for a failure. A `+' construct makes this
- before the first repeat. Also used as an intermediary kind
- of jump when compiling an alternative. */
- dummy_failure_jump,
-
- /* Push a dummy failure point and continue. Used at the end of
- alternatives. */
- push_dummy_failure,
-
- /* Followed by two-byte relative address and two-byte number n.
- After matching N times, jump to the address upon failure. */
- succeed_n,
-
- /* Followed by two-byte relative address, and two-byte number n.
- Jump to the address N times, then fail. */
- jump_n,
-
- /* Set the following two-byte relative address to the
- subsequent two-byte number. The address *includes* the two
- bytes of number. */
- set_number_at,
-
- wordchar, /* Matches any word-constituent character. */
- notwordchar, /* Matches any char that is not a word-constituent. */
-
- wordbeg, /* Succeeds if at word beginning. */
- wordend, /* Succeeds if at word end. */
-
- wordbound, /* Succeeds if at a word boundary. */
- notwordbound /* Succeeds if not at a word boundary. */
-
-#ifdef emacs
- ,before_dot, /* Succeeds if before point. */
- at_dot, /* Succeeds if at point. */
- after_dot, /* Succeeds if after point. */
-
- /* Matches any character whose syntax is specified. Followed by
- a byte which contains a syntax code, e.g., Sword. */
- syntaxspec,
-
- /* Matches any character whose syntax is not that specified. */
- notsyntaxspec
-#endif /* emacs */
-} re_opcode_t;
-
-/* Common operations on the compiled pattern. */
-
-/* Store NUMBER in two contiguous bytes starting at DESTINATION. */
-
-#define STORE_NUMBER(destination, number) \
- do { \
- (destination)[0] = (number) & 0377; \
- (destination)[1] = (number) >> 8; \
- } while (0)
-
-/* Same as STORE_NUMBER, except increment DESTINATION to
- the byte after where the number is stored. Therefore, DESTINATION
- must be an lvalue. */
-
-#define STORE_NUMBER_AND_INCR(destination, number) \
- do { \
- STORE_NUMBER (destination, number); \
- (destination) += 2; \
- } while (0)
-
-/* Put into DESTINATION a number stored in two contiguous bytes starting
- at SOURCE. */
-
-#define EXTRACT_NUMBER(destination, source) \
- do { \
- (destination) = *(source) & 0377; \
- (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \
- } while (0)
-
-#ifdef DEBUG
-static void extract_number _RE_ARGS((int *dest, unsigned char *source));
-static void
-extract_number (dest, source)
- int *dest;
- unsigned char *source;
-{
- int temp = SIGN_EXTEND_CHAR (*(source + 1));
- *dest = *source & 0377;
- *dest += temp << 8;
-}
-
-#ifndef EXTRACT_MACROS /* To debug the macros. */
-#undef EXTRACT_NUMBER
-#define EXTRACT_NUMBER(dest, src) extract_number (&dest, src)
-#endif /* not EXTRACT_MACROS */
-
-#endif /* DEBUG */
-
-/* Same as EXTRACT_NUMBER, except increment SOURCE to after the number.
- SOURCE must be an lvalue. */
-
-#define EXTRACT_NUMBER_AND_INCR(destination, source) \
- do { \
- EXTRACT_NUMBER (destination, source); \
- (source) += 2; \
- } while (0)
-
-#ifdef DEBUG
-static void extract_number_and_incr _RE_ARGS((int *destination,
- unsigned char **source));
-static void
-extract_number_and_incr (destination, source)
- int *destination;
- unsigned char **source;
-{
- extract_number (destination, *source);
- *source += 2;
-}
-
-#ifndef EXTRACT_MACROS
-#undef EXTRACT_NUMBER_AND_INCR
-#define EXTRACT_NUMBER_AND_INCR(dest, src) \
- extract_number_and_incr (&dest, &src)
-#endif /* not EXTRACT_MACROS */
-
-#endif /* DEBUG */
-
-/* If DEBUG is defined, Regex prints many voluminous messages about what
- it is doing (if the variable `debug' is nonzero). If linked with the
- main program in `iregex.c', you can enter patterns and strings
- interactively. And if linked with the main program in `main.c' and
- the other test files, you can run the already-written tests. */
-
-#ifdef DEBUG
-
-/* We use standard I/O for debugging. */
-#include <stdio.h>
-
-/* It is useful to test things that ``must'' be true when debugging. */
-#include <assert.h>
-
-static int debug = 0;
-
-#define DEBUG_STATEMENT(e) e
-#define DEBUG_PRINT1(x) if (debug) printf (x)
-#define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2)
-#define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3)
-#define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4)
-#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \
- if (debug) print_partial_compiled_pattern (s, e)
-#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \
- if (debug) print_double_string (w, s1, sz1, s2, sz2)
-
-
-extern void printchar ();
-
-/* Print the fastmap in human-readable form. */
-
-void
-print_fastmap (fastmap)
- char *fastmap;
-{
- unsigned was_a_range = 0;
- unsigned i = 0;
-
- while (i < (1 << BYTEWIDTH))
- {
- if (fastmap[i++])
- {
- was_a_range = 0;
- printchar (i - 1);
- while (i < (1 << BYTEWIDTH) && fastmap[i])
- {
- was_a_range = 1;
- i++;
- }
- if (was_a_range)
- {
- printf ("-");
- printchar (i - 1);
- }
- }
- }
- putchar ('\n');
-}
-
-
-/* Print a compiled pattern string in human-readable form, starting at
- the START pointer into it and ending just before the pointer END. */
-
-void
-print_partial_compiled_pattern (start, end)
- unsigned char *start;
- unsigned char *end;
-{
- int mcnt, mcnt2;
- unsigned char *p = start;
- unsigned char *pend = end;
-
- if (start == NULL)
- {
- printf ("(null)\n");
- return;
- }
-
- /* Loop over pattern commands. */
- while (p < pend)
- {
- printf ("%d:\t", p - start);
-
- switch ((re_opcode_t) *p++)
- {
- case no_op:
- printf ("/no_op");
- break;
-
- case exactn:
- mcnt = *p++;
- printf ("/exactn/%d", mcnt);
- do
- {
- putchar ('/');
- printchar (*p++);
- }
- while (--mcnt);
- break;
-
- case start_memory:
- mcnt = *p++;
- printf ("/start_memory/%d/%d", mcnt, *p++);
- break;
-
- case stop_memory:
- mcnt = *p++;
- printf ("/stop_memory/%d/%d", mcnt, *p++);
- break;
-
- case duplicate:
- printf ("/duplicate/%d", *p++);
- break;
-
- case anychar:
- printf ("/anychar");
- break;
-
- case charset:
- case charset_not:
- {
- register int c, last = -100;
- register int in_range = 0;
-
- printf ("/charset [%s",
- (re_opcode_t) *(p - 1) == charset_not ? "^" : "");
-
- assert (p + *p < pend);
-
- for (c = 0; c < 256; c++)
- if (c / 8 < *p
- && (p[1 + (c/8)] & (1 << (c % 8))))
- {
- /* Are we starting a range? */
- if (last + 1 == c && ! in_range)
- {
- putchar ('-');
- in_range = 1;
- }
- /* Have we broken a range? */
- else if (last + 1 != c && in_range)
- {
- printchar (last);
- in_range = 0;
- }
-
- if (! in_range)
- printchar (c);
-
- last = c;
- }
-
- if (in_range)
- printchar (last);
-
- putchar (']');
-
- p += 1 + *p;
- }
- break;
-
- case begline:
- printf ("/begline");
- break;
-
- case endline:
- printf ("/endline");
- break;
-
- case on_failure_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/on_failure_jump to %d", p + mcnt - start);
- break;
-
- case on_failure_keep_string_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/on_failure_keep_string_jump to %d", p + mcnt - start);
- break;
-
- case dummy_failure_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/dummy_failure_jump to %d", p + mcnt - start);
- break;
-
- case push_dummy_failure:
- printf ("/push_dummy_failure");
- break;
-
- case maybe_pop_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/maybe_pop_jump to %d", p + mcnt - start);
- break;
-
- case pop_failure_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/pop_failure_jump to %d", p + mcnt - start);
- break;
-
- case jump_past_alt:
- extract_number_and_incr (&mcnt, &p);
- printf ("/jump_past_alt to %d", p + mcnt - start);
- break;
-
- case jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/jump to %d", p + mcnt - start);
- break;
-
- case succeed_n:
- extract_number_and_incr (&mcnt, &p);
- extract_number_and_incr (&mcnt2, &p);
- printf ("/succeed_n to %d, %d times", p + mcnt - start, mcnt2);
- break;
-
- case jump_n:
- extract_number_and_incr (&mcnt, &p);
- extract_number_and_incr (&mcnt2, &p);
- printf ("/jump_n to %d, %d times", p + mcnt - start, mcnt2);
- break;
-
- case set_number_at:
- extract_number_and_incr (&mcnt, &p);
- extract_number_and_incr (&mcnt2, &p);
- printf ("/set_number_at location %d to %d", p + mcnt - start, mcnt2);
- break;
-
- case wordbound:
- printf ("/wordbound");
- break;
-
- case notwordbound:
- printf ("/notwordbound");
- break;
-
- case wordbeg:
- printf ("/wordbeg");
- break;
-
- case wordend:
- printf ("/wordend");
-
-#ifdef emacs
- case before_dot:
- printf ("/before_dot");
- break;
-
- case at_dot:
- printf ("/at_dot");
- break;
-
- case after_dot:
- printf ("/after_dot");
- break;
-
- case syntaxspec:
- printf ("/syntaxspec");
- mcnt = *p++;
- printf ("/%d", mcnt);
- break;
-
- case notsyntaxspec:
- printf ("/notsyntaxspec");
- mcnt = *p++;
- printf ("/%d", mcnt);
- break;
-#endif /* emacs */
-
- case wordchar:
- printf ("/wordchar");
- break;
-
- case notwordchar:
- printf ("/notwordchar");
- break;
-
- case begbuf:
- printf ("/begbuf");
- break;
-
- case endbuf:
- printf ("/endbuf");
- break;
-
- default:
- printf ("?%d", *(p-1));
- }
-
- putchar ('\n');
- }
-
- printf ("%d:\tend of pattern.\n", p - start);
-}
-
-
-void
-print_compiled_pattern (bufp)
- struct re_pattern_buffer *bufp;
-{
- unsigned char *buffer = bufp->buffer;
-
- print_partial_compiled_pattern (buffer, buffer + bufp->used);
- printf ("%d bytes used/%d bytes allocated.\n", bufp->used, bufp->allocated);
-
- if (bufp->fastmap_accurate && bufp->fastmap)
- {
- printf ("fastmap: ");
- print_fastmap (bufp->fastmap);
- }
-
- printf ("re_nsub: %d\t", bufp->re_nsub);
- printf ("regs_alloc: %d\t", bufp->regs_allocated);
- printf ("can_be_null: %d\t", bufp->can_be_null);
- printf ("newline_anchor: %d\n", bufp->newline_anchor);
- printf ("no_sub: %d\t", bufp->no_sub);
- printf ("not_bol: %d\t", bufp->not_bol);
- printf ("not_eol: %d\t", bufp->not_eol);
- printf ("syntax: %d\n", bufp->syntax);
- /* Perhaps we should print the translate table? */
-}
-
-
-void
-print_double_string (where, string1, size1, string2, size2)
- const char *where;
- const char *string1;
- const char *string2;
- int size1;
- int size2;
-{
- unsigned this_char;
-
- if (where == NULL)
- printf ("(null)");
- else
- {
- if (FIRST_STRING_P (where))
- {
- for (this_char = where - string1; this_char < size1; this_char++)
- printchar (string1[this_char]);
-
- where = string2;
- }
-
- for (this_char = where - string2; this_char < size2; this_char++)
- printchar (string2[this_char]);
- }
-}
-
-#else /* not DEBUG */
-
-#undef assert
-#define assert(e)
-
-#define DEBUG_STATEMENT(e)
-#define DEBUG_PRINT1(x)
-#define DEBUG_PRINT2(x1, x2)
-#define DEBUG_PRINT3(x1, x2, x3)
-#define DEBUG_PRINT4(x1, x2, x3, x4)
-#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
-#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)
-
-#endif /* not DEBUG */
-
-/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can
- also be assigned to arbitrarily: each pattern buffer stores its own
- syntax, so it can be changed between regex compilations. */
-reg_syntax_t re_syntax_options = RE_SYNTAX_EMACS;
-
-
-/* Specify the precise syntax of regexps for compilation. This provides
- for compatibility for various utilities which historically have
- different, incompatible syntaxes.
-
- The argument SYNTAX is a bit mask comprised of the various bits
- defined in regex.h. We return the old syntax. */
-
-reg_syntax_t
-re_set_syntax (syntax)
- reg_syntax_t syntax;
-{
- reg_syntax_t ret = re_syntax_options;
-
- re_syntax_options = syntax;
- return ret;
-}
-
-/* This table gives an error message for each of the error codes listed
- in regex.h. Obviously the order here has to be same as there. */
-
-static const char *re_error_msg[] =
- { NULL, /* REG_NOERROR */
- "No match", /* REG_NOMATCH */
- "Invalid regular expression", /* REG_BADPAT */
- "Invalid collation character", /* REG_ECOLLATE */
- "Invalid character class name", /* REG_ECTYPE */
- "Trailing backslash", /* REG_EESCAPE */
- "Invalid back reference", /* REG_ESUBREG */
- "Unmatched [ or [^", /* REG_EBRACK */
- "Unmatched ( or \\(", /* REG_EPAREN */
- "Unmatched \\{", /* REG_EBRACE */
- "Invalid content of \\{\\}", /* REG_BADBR */
- "Invalid range end", /* REG_ERANGE */
- "Memory exhausted", /* REG_ESPACE */
- "Invalid preceding regular expression", /* REG_BADRPT */
- "Premature end of regular expression", /* REG_EEND */
- "Regular expression too big", /* REG_ESIZE */
- "Unmatched ) or \\)", /* REG_ERPAREN */
- };
-
-/* Subroutine declarations and macros for regex_compile. */
-
-static reg_errcode_t regex_compile _RE_ARGS((const char *pattern, size_t size,
- reg_syntax_t syntax,
- struct re_pattern_buffer *bufp));
-static void store_op1 _RE_ARGS((re_opcode_t op, unsigned char *loc, int arg));
-static void store_op2 _RE_ARGS((re_opcode_t op, unsigned char *loc,
- int arg1, int arg2));
-static void insert_op1 _RE_ARGS((re_opcode_t op, unsigned char *loc,
- int arg, unsigned char *end));
-static void insert_op2 _RE_ARGS((re_opcode_t op, unsigned char *loc,
- int arg1, int arg2, unsigned char *end));
-static boolean at_begline_loc_p _RE_ARGS((const char *pattern, const char *p,
- reg_syntax_t syntax));
-static boolean at_endline_loc_p _RE_ARGS((const char *p, const char *pend,
- reg_syntax_t syntax));
-static reg_errcode_t compile_range _RE_ARGS((const char **p_ptr,
- const char *pend,
- char *translate,
- reg_syntax_t syntax,
- unsigned char *b));
-
-/* Fetch the next character in the uncompiled pattern---translating it
- if necessary. Also cast from a signed character in the constant
- string passed to us by the user to an unsigned char that we can use
- as an array index (in, e.g., `translate'). */
-#define PATFETCH(c) \
- do {if (p == pend) return REG_EEND; \
- c = (unsigned char) *p++; \
- if (translate) c = translate[c]; \
- } while (0)
-
-/* Fetch the next character in the uncompiled pattern, with no
- translation. */
-#define PATFETCH_RAW(c) \
- do {if (p == pend) return REG_EEND; \
- c = (unsigned char) *p++; \
- } while (0)
-
-/* Go backwards one character in the pattern. */
-#define PATUNFETCH p--
-
-
-/* If `translate' is non-null, return translate[D], else just D. We
- cast the subscript to translate because some data is declared as
- `char *', to avoid warnings when a string constant is passed. But
- when we use a character as a subscript we must make it unsigned. */
-#define TRANSLATE(d) (translate ? translate[(unsigned char) (d)] : (d))
-
-
-/* Macros for outputting the compiled pattern into `buffer'. */
-
-/* If the buffer isn't allocated when it comes in, use this. */
-#define INIT_BUF_SIZE 32
-
-/* Make sure we have at least N more bytes of space in buffer. */
-#define GET_BUFFER_SPACE(n) \
- while (b - bufp->buffer + (n) > bufp->allocated) \
- EXTEND_BUFFER ()
-
-/* Make sure we have one more byte of buffer space and then add C to it. */
-#define BUF_PUSH(c) \
- do { \
- GET_BUFFER_SPACE (1); \
- *b++ = (unsigned char) (c); \
- } while (0)
-
-
-/* Ensure we have two more bytes of buffer space and then append C1 and C2. */
-#define BUF_PUSH_2(c1, c2) \
- do { \
- GET_BUFFER_SPACE (2); \
- *b++ = (unsigned char) (c1); \
- *b++ = (unsigned char) (c2); \
- } while (0)
-
-
-/* As with BUF_PUSH_2, except for three bytes. */
-#define BUF_PUSH_3(c1, c2, c3) \
- do { \
- GET_BUFFER_SPACE (3); \
- *b++ = (unsigned char) (c1); \
- *b++ = (unsigned char) (c2); \
- *b++ = (unsigned char) (c3); \
- } while (0)
-
-
-/* Store a jump with opcode OP at LOC to location TO. We store a
- relative address offset by the three bytes the jump itself occupies. */
-#define STORE_JUMP(op, loc, to) \
- store_op1 (op, loc, (int)((to) - (loc) - 3))
-
-/* Likewise, for a two-argument jump. */
-#define STORE_JUMP2(op, loc, to, arg) \
- store_op2 (op, loc, (int)((to) - (loc) - 3), arg)
-
-/* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */
-#define INSERT_JUMP(op, loc, to) \
- insert_op1 (op, loc, (int)((to) - (loc) - 3), b)
-
-/* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */
-#define INSERT_JUMP2(op, loc, to, arg) \
- insert_op2 (op, loc, (int)((to) - (loc) - 3), arg, b)
-
-
-/* This is not an arbitrary limit: the arguments which represent offsets
- into the pattern are two bytes long. So if 2^16 bytes turns out to
- be too small, many things would have to change. */
-/* Any other compiler which, like MSC, has allocation limit below 2^16
- bytes will have to use approach similar to what was done below for
- MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up
- reallocating to 0 bytes. Such thing is not going to work too well.
- You have been warned!! */
-#ifdef _MSC_VER
-/* Microsoft C 16-bit versions limit malloc to approx 65512 bytes.
- The REALLOC define eliminates a flurry of conversion warnings,
- but is not required. */
-#define MAX_BUF_SIZE 65500L
-#define REALLOC(p,s) realloc((p), (size_t) (s))
-#else
-#define MAX_BUF_SIZE (1L << 16)
-#define REALLOC realloc
-#endif
-
-/* Extend the buffer by twice its current size via realloc and
- reset the pointers that pointed into the old block to point to the
- correct places in the new one. If extending the buffer results in it
- being larger than MAX_BUF_SIZE, then flag memory exhausted. */
-#define EXTEND_BUFFER() \
- do { \
- unsigned char *old_buffer = bufp->buffer; \
- if (bufp->allocated == MAX_BUF_SIZE) \
- return REG_ESIZE; \
- bufp->allocated <<= 1; \
- if (bufp->allocated > MAX_BUF_SIZE) \
- bufp->allocated = MAX_BUF_SIZE; \
- bufp->buffer = (unsigned char *) REALLOC(bufp->buffer, bufp->allocated);\
- if (bufp->buffer == NULL) \
- return REG_ESPACE; \
- /* If the buffer moved, move all the pointers into it. */ \
- if (old_buffer != bufp->buffer) \
- { \
- b = (b - old_buffer) + bufp->buffer; \
- begalt = (begalt - old_buffer) + bufp->buffer; \
- if (fixup_alt_jump) \
- fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer;\
- if (laststart) \
- laststart = (laststart - old_buffer) + bufp->buffer; \
- if (pending_exact) \
- pending_exact = (pending_exact - old_buffer) + bufp->buffer; \
- } \
- } while (0)
-
-
-/* Since we have one byte reserved for the register number argument to
- {start,stop}_memory, the maximum number of groups we can report
- things about is what fits in that byte. */
-#define MAX_REGNUM 255
-
-/* But patterns can have more than `MAX_REGNUM' registers. We just
- ignore the excess. */
-typedef unsigned regnum_t;
-
-
-/* Macros for the compile stack. */
-
-/* Since offsets can go either forwards or backwards, this type needs to
- be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */
-/* int may be not enough when sizeof(int) == 2 */
-typedef long pattern_offset_t;
-
-typedef struct
-{
- pattern_offset_t begalt_offset;
- pattern_offset_t fixup_alt_jump;
- pattern_offset_t inner_group_offset;
- pattern_offset_t laststart_offset;
- regnum_t regnum;
-} compile_stack_elt_t;
-
-
-typedef struct
-{
- compile_stack_elt_t *stack;
- unsigned size;
- unsigned avail; /* Offset of next open position. */
-} compile_stack_type;
-
-
-#define INIT_COMPILE_STACK_SIZE 32
-
-#define COMPILE_STACK_EMPTY (compile_stack.avail == 0)
-#define COMPILE_STACK_FULL (compile_stack.avail == compile_stack.size)
-
-/* The next available element. */
-#define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail])
-
-
-/* Set the bit for character C in a list. */
-#define SET_LIST_BIT(c) \
- (b[((unsigned char) (c)) / BYTEWIDTH] \
- |= 1 << (((unsigned char) c) % BYTEWIDTH))
-
-
-/* Get the next unsigned number in the uncompiled pattern. */
-#define GET_UNSIGNED_NUMBER(num) \
- { if (p != pend) \
- { \
- PATFETCH (c); \
- while (ISDIGIT (c)) \
- { \
- if (num < 0) \
- num = 0; \
- num = num * 10 + c - '0'; \
- if (p == pend) \
- break; \
- PATFETCH (c); \
- } \
- } \
- }
-
-#define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */
-
-#define IS_CHAR_CLASS(string) \
- (STREQ (string, "alpha") || STREQ (string, "upper") \
- || STREQ (string, "lower") || STREQ (string, "digit") \
- || STREQ (string, "alnum") || STREQ (string, "xdigit") \
- || STREQ (string, "space") || STREQ (string, "print") \
- || STREQ (string, "punct") || STREQ (string, "graph") \
- || STREQ (string, "cntrl") || STREQ (string, "blank"))
-
-static boolean group_in_compile_stack _RE_ARGS((compile_stack_type
- compile_stack,
- regnum_t regnum));
-
-/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
- Returns one of error codes defined in `regex.h', or zero for success.
-
- Assumes the `allocated' (and perhaps `buffer') and `translate'
- fields are set in BUFP on entry.
-
- If it succeeds, results are put in BUFP (if it returns an error, the
- contents of BUFP are undefined):
- `buffer' is the compiled pattern;
- `syntax' is set to SYNTAX;
- `used' is set to the length of the compiled pattern;
- `fastmap_accurate' is zero;
- `re_nsub' is the number of subexpressions in PATTERN;
- `not_bol' and `not_eol' are zero;
-
- The `fastmap' and `newline_anchor' fields are neither
- examined nor set. */
-
-static reg_errcode_t
-regex_compile (pattern, size, syntax, bufp)
- const char *pattern;
- size_t size;
- reg_syntax_t syntax;
- struct re_pattern_buffer *bufp;
-{
- /* We fetch characters from PATTERN here. Even though PATTERN is
- `char *' (i.e., signed), we declare these variables as unsigned, so
- they can be reliably used as array indices. */
- register unsigned char c, c1;
-
- /* A random tempory spot in PATTERN. */
- const char *p1;
-
- /* Points to the end of the buffer, where we should append. */
- register unsigned char *b;
-
- /* Keeps track of unclosed groups. */
- compile_stack_type compile_stack;
-
- /* Points to the current (ending) position in the pattern. */
- const char *p = pattern;
- const char *pend = pattern + size;
-
- /* How to translate the characters in the pattern. */
- char *translate = bufp->translate;
-
- /* Address of the count-byte of the most recently inserted `exactn'
- command. This makes it possible to tell if a new exact-match
- character can be added to that command or if the character requires
- a new `exactn' command. */
- unsigned char *pending_exact = 0;
-
- /* Address of start of the most recently finished expression.
- This tells, e.g., postfix * where to find the start of its
- operand. Reset at the beginning of groups and alternatives. */
- unsigned char *laststart = 0;
-
- /* Address of beginning of regexp, or inside of last group. */
- unsigned char *begalt;
-
- /* Place in the uncompiled pattern (i.e., the {) to
- which to go back if the interval is invalid. */
- const char *beg_interval;
-
- /* Address of the place where a forward jump should go to the end of
- the containing expression. Each alternative of an `or' -- except the
- last -- ends with a forward jump of this sort. */
- unsigned char *fixup_alt_jump = 0;
-
- /* Counts open-groups as they are encountered. Remembered for the
- matching close-group on the compile stack, so the same register
- number is put in the stop_memory as the start_memory. */
- regnum_t regnum = 0;
-
-#ifdef DEBUG
- DEBUG_PRINT1 ("\nCompiling pattern: ");
- if (debug)
- {
- unsigned debug_count;
-
- for (debug_count = 0; debug_count < size; debug_count++)
- printchar (pattern[debug_count]);
- putchar ('\n');
- }
-#endif /* DEBUG */
-
- /* Initialize the compile stack. */
- compile_stack.stack = TALLOC (INIT_COMPILE_STACK_SIZE, compile_stack_elt_t);
- if (compile_stack.stack == NULL)
- return REG_ESPACE;
-
- compile_stack.size = INIT_COMPILE_STACK_SIZE;
- compile_stack.avail = 0;
-
- /* Initialize the pattern buffer. */
- bufp->syntax = syntax;
- bufp->fastmap_accurate = 0;
- bufp->not_bol = bufp->not_eol = 0;
-
- /* Set `used' to zero, so that if we return an error, the pattern
- printer (for debugging) will think there's no pattern. We reset it
- at the end. */
- bufp->used = 0;
-
- /* Always count groups, whether or not bufp->no_sub is set. */
- bufp->re_nsub = 0;
-
-#if !defined (emacs) && !defined (SYNTAX_TABLE)
- /* Initialize the syntax table. */
- init_syntax_once ();
-#endif
-
- if (bufp->allocated == 0)
- {
- if (bufp->buffer)
- { /* If zero allocated, but buffer is non-null, try to realloc
- enough space. This loses if buffer's address is bogus, but
- that is the user's responsibility. */
- RETALLOC (bufp->buffer, INIT_BUF_SIZE, unsigned char);
- }
- else
- { /* Caller did not allocate a buffer. Do it for them. */
- bufp->buffer = TALLOC (INIT_BUF_SIZE, unsigned char);
- }
- if (!bufp->buffer) return REG_ESPACE;
-
- bufp->allocated = INIT_BUF_SIZE;
- }
-
- begalt = b = bufp->buffer;
-
- /* Loop through the uncompiled pattern until we're at the end. */
- while (p != pend)
- {
- PATFETCH (c);
-
- switch (c)
- {
- case '^':
- {
- if ( /* If at start of pattern, it's an operator. */
- p == pattern + 1
- /* If context independent, it's an operator. */
- || syntax & RE_CONTEXT_INDEP_ANCHORS
- /* Otherwise, depends on what's come before. */
- || at_begline_loc_p (pattern, p, syntax))
- BUF_PUSH (begline);
- else
- goto normal_char;
- }
- break;
-
-
- case '$':
- {
- if ( /* If at end of pattern, it's an operator. */
- p == pend
- /* If context independent, it's an operator. */
- || syntax & RE_CONTEXT_INDEP_ANCHORS
- /* Otherwise, depends on what's next. */
- || at_endline_loc_p (p, pend, syntax))
- BUF_PUSH (endline);
- else
- goto normal_char;
- }
- break;
-
-
- case '+':
- case '?':
- if ((syntax & RE_BK_PLUS_QM)
- || (syntax & RE_LIMITED_OPS))
- goto normal_char;
- handle_plus:
- case '*':
- /* If there is no previous pattern... */
- if (!laststart)
- {
- if (syntax & RE_CONTEXT_INVALID_OPS)
- return REG_BADRPT;
- else if (!(syntax & RE_CONTEXT_INDEP_OPS))
- goto normal_char;
- }
-
- {
- /* Are we optimizing this jump? */
- boolean keep_string_p = false;
-
- /* 1 means zero (many) matches is allowed. */
- char zero_times_ok = 0, many_times_ok = 0;
-
- /* If there is a sequence of repetition chars, collapse it
- down to just one (the right one). We can't combine
- interval operators with these because of, e.g., `a{2}*',
- which should only match an even number of `a's. */
-
- for (;;)
- {
- zero_times_ok |= c != '+';
- many_times_ok |= c != '?';
-
- if (p == pend)
- break;
-
- PATFETCH (c);
-
- if (c == '*'
- || (!(syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?')))
- ;
-
- else if (syntax & RE_BK_PLUS_QM && c == '\\')
- {
- if (p == pend) return REG_EESCAPE;
-
- PATFETCH (c1);
- if (!(c1 == '+' || c1 == '?'))
- {
- PATUNFETCH;
- PATUNFETCH;
- break;
- }
-
- c = c1;
- }
- else
- {
- PATUNFETCH;
- break;
- }
-
- /* If we get here, we found another repeat character. */
- }
-
- /* Star, etc. applied to an empty pattern is equivalent
- to an empty pattern. */
- if (!laststart)
- break;
-
- /* Now we know whether or not zero matches is allowed
- and also whether or not two or more matches is allowed. */
- if (many_times_ok)
- { /* More than one repetition is allowed, so put in at the
- end a backward relative jump from `b' to before the next
- jump we're going to put in below (which jumps from
- laststart to after this jump).
-
- But if we are at the `*' in the exact sequence `.*\n',
- insert an unconditional jump backwards to the .,
- instead of the beginning of the loop. This way we only
- push a failure point once, instead of every time
- through the loop. */
- assert (p - 1 > pattern);
-
- /* Allocate the space for the jump. */
- GET_BUFFER_SPACE (3);
-
- /* We know we are not at the first character of the pattern,
- because laststart was nonzero. And we've already
- incremented `p', by the way, to be the character after
- the `*'. Do we have to do something analogous here
- for null bytes, because of RE_DOT_NOT_NULL? */
- if (TRANSLATE (*(p - 2)) == TRANSLATE ('.')
- && zero_times_ok
- && p < pend && TRANSLATE (*p) == TRANSLATE ('\n')
- && !(syntax & RE_DOT_NEWLINE))
- { /* We have .*\n. */
- STORE_JUMP (jump, b, laststart);
- keep_string_p = true;
- }
- else
- /* Anything else. */
- STORE_JUMP (maybe_pop_jump, b, laststart - 3);
-
- /* We've added more stuff to the buffer. */
- b += 3;
- }
-
- /* On failure, jump from laststart to b + 3, which will be the
- end of the buffer after this jump is inserted. */
- GET_BUFFER_SPACE (3);
- INSERT_JUMP (keep_string_p ? on_failure_keep_string_jump
- : on_failure_jump,
- laststart, b + 3);
- pending_exact = 0;
- b += 3;
-
- if (!zero_times_ok)
- {
- /* At least one repetition is required, so insert a
- `dummy_failure_jump' before the initial
- `on_failure_jump' instruction of the loop. This
- effects a skip over that instruction the first time
- we hit that loop. */
- GET_BUFFER_SPACE (3);
- INSERT_JUMP (dummy_failure_jump, laststart, laststart + 6);
- b += 3;
- }
- }
- break;
-
-
- case '.':
- laststart = b;
- BUF_PUSH (anychar);
- break;
-
-
- case '[':
- {
- boolean had_char_class = false;
-
- if (p == pend) return REG_EBRACK;
-
- /* Ensure that we have enough space to push a charset: the
- opcode, the length count, and the bitset; 34 bytes in all. */
- GET_BUFFER_SPACE (34);
-
- laststart = b;
-
- /* We test `*p == '^' twice, instead of using an if
- statement, so we only need one BUF_PUSH. */
- BUF_PUSH (*p == '^' ? charset_not : charset);
- if (*p == '^')
- p++;
-
- /* Remember the first position in the bracket expression. */
- p1 = p;
-
- /* Push the number of bytes in the bitmap. */
- BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
-
- /* Clear the whole map. */
- bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH);
-
- /* charset_not matches newline according to a syntax bit. */
- if ((re_opcode_t) b[-2] == charset_not
- && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
- SET_LIST_BIT ('\n');
-
- /* Read in characters and ranges, setting map bits. */
- for (;;)
- {
- if (p == pend) return REG_EBRACK;
-
- PATFETCH (c);
-
- /* \ might escape characters inside [...] and [^...]. */
- if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
- {
- if (p == pend) return REG_EESCAPE;
-
- PATFETCH (c1);
- SET_LIST_BIT (c1);
- continue;
- }
-
- /* Could be the end of the bracket expression. If it's
- not (i.e., when the bracket expression is `[]' so
- far), the ']' character bit gets set way below. */
- if (c == ']' && p != p1 + 1)
- break;
-
- /* Look ahead to see if it's a range when the last thing
- was a character class. */
- if (had_char_class && c == '-' && *p != ']')
- return REG_ERANGE;
-
- /* Look ahead to see if it's a range when the last thing
- was a character: if this is a hyphen not at the
- beginning or the end of a list, then it's the range
- operator. */
- if (c == '-'
- && !(p - 2 >= pattern && p[-2] == '[')
- && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^')
- && *p != ']')
- {
- reg_errcode_t ret
- = compile_range (&p, pend, translate, syntax, b);
- if (ret != REG_NOERROR) return ret;
- }
-
- else if (p[0] == '-' && p[1] != ']')
- { /* This handles ranges made up of characters only. */
- reg_errcode_t ret;
-
- /* Move past the `-'. */
- PATFETCH (c1);
-
- ret = compile_range (&p, pend, translate, syntax, b);
- if (ret != REG_NOERROR) return ret;
- }
-
- /* See if we're at the beginning of a possible character
- class. */
-
- else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
- { /* Leave room for the null. */
- char str[CHAR_CLASS_MAX_LENGTH + 1];
-
- PATFETCH (c);
- c1 = 0;
-
- /* If pattern is `[[:'. */
- if (p == pend) return REG_EBRACK;
-
- for (;;)
- {
- PATFETCH (c);
- if (c == ':' || c == ']' || p == pend
- || c1 == CHAR_CLASS_MAX_LENGTH)
- break;
- str[c1++] = c;
- }
- str[c1] = '\0';
-
- /* If isn't a word bracketed by `[:' and:`]':
- undo the ending character, the letters, and leave
- the leading `:' and `[' (but set bits for them). */
- if (c == ':' && *p == ']')
- {
- int ch;
- boolean is_alnum = STREQ (str, "alnum");
- boolean is_alpha = STREQ (str, "alpha");
- boolean is_blank = STREQ (str, "blank");
- boolean is_cntrl = STREQ (str, "cntrl");
- boolean is_digit = STREQ (str, "digit");
- boolean is_graph = STREQ (str, "graph");
- boolean is_lower = STREQ (str, "lower");
- boolean is_print = STREQ (str, "print");
- boolean is_punct = STREQ (str, "punct");
- boolean is_space = STREQ (str, "space");
- boolean is_upper = STREQ (str, "upper");
- boolean is_xdigit = STREQ (str, "xdigit");
-
- if (!IS_CHAR_CLASS (str)) return REG_ECTYPE;
-
- /* Throw away the ] at the end of the character
- class. */
- PATFETCH (c);
-
- if (p == pend) return REG_EBRACK;
-
- for (ch = 0; ch < 1 << BYTEWIDTH; ch++)
- {
- if ( (is_alnum && ISALNUM (ch))
- || (is_alpha && ISALPHA (ch))
- || (is_blank && ISBLANK (ch))
- || (is_cntrl && ISCNTRL (ch))
- || (is_digit && ISDIGIT (ch))
- || (is_graph && ISGRAPH (ch))
- || (is_lower && ISLOWER (ch))
- || (is_print && ISPRINT (ch))
- || (is_punct && ISPUNCT (ch))
- || (is_space && ISSPACE (ch))
- || (is_upper && ISUPPER (ch))
- || (is_xdigit && ISXDIGIT (ch)))
- SET_LIST_BIT (ch);
- }
- had_char_class = true;
- }
- else
- {
- c1++;
- while (c1--)
- PATUNFETCH;
- SET_LIST_BIT ('[');
- SET_LIST_BIT (':');
- had_char_class = false;
- }
- }
- else
- {
- had_char_class = false;
- SET_LIST_BIT (c);
- }
- }
-
- /* Discard any (non)matching list bytes that are all 0 at the
- end of the map. Decrease the map-length byte too. */
- while ((int) b[-1] > 0 && b[b[-1] - 1] == 0)
- b[-1]--;
- b += b[-1];
- }
- break;
-
-
- case '(':
- if (syntax & RE_NO_BK_PARENS)
- goto handle_open;
- else
- goto normal_char;
-
-
- case ')':
- if (syntax & RE_NO_BK_PARENS)
- goto handle_close;
- else
- goto normal_char;
-
-
- case '\n':
- if (syntax & RE_NEWLINE_ALT)
- goto handle_alt;
- else
- goto normal_char;
-
-
- case '|':
- if (syntax & RE_NO_BK_VBAR)
- goto handle_alt;
- else
- goto normal_char;
-
-
- case '{':
- if (syntax & RE_INTERVALS && syntax & RE_NO_BK_BRACES)
- goto handle_interval;
- else
- goto normal_char;
-
-
- case '\\':
- if (p == pend) return REG_EESCAPE;
-
- /* Do not translate the character after the \, so that we can
- distinguish, e.g., \B from \b, even if we normally would
- translate, e.g., B to b. */
- PATFETCH_RAW (c);
-
- switch (c)
- {
- case '(':
- if (syntax & RE_NO_BK_PARENS)
- goto normal_backslash;
-
- handle_open:
- bufp->re_nsub++;
- regnum++;
-
- if (COMPILE_STACK_FULL)
- {
- RETALLOC (compile_stack.stack, compile_stack.size << 1,
- compile_stack_elt_t);
- if (compile_stack.stack == NULL) return REG_ESPACE;
-
- compile_stack.size <<= 1;
- }
-
- /* These are the values to restore when we hit end of this
- group. They are all relative offsets, so that if the
- whole pattern moves because of realloc, they will still
- be valid. */
- COMPILE_STACK_TOP.begalt_offset = begalt - bufp->buffer;
- COMPILE_STACK_TOP.fixup_alt_jump
- = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0;
- COMPILE_STACK_TOP.laststart_offset = b - bufp->buffer;
- COMPILE_STACK_TOP.regnum = regnum;
-
- /* We will eventually replace the 0 with the number of
- groups inner to this one. But do not push a
- start_memory for groups beyond the last one we can
- represent in the compiled pattern. */
- if (regnum <= MAX_REGNUM)
- {
- COMPILE_STACK_TOP.inner_group_offset = b - bufp->buffer + 2;
- BUF_PUSH_3 (start_memory, regnum, 0);
- }
-
- compile_stack.avail++;
-
- fixup_alt_jump = 0;
- laststart = 0;
- begalt = b;
- /* If we've reached MAX_REGNUM groups, then this open
- won't actually generate any code, so we'll have to
- clear pending_exact explicitly. */
- pending_exact = 0;
- break;
-
-
- case ')':
- if (syntax & RE_NO_BK_PARENS) goto normal_backslash;
-
- if (COMPILE_STACK_EMPTY)
- if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
- goto normal_backslash;
- else
- return REG_ERPAREN;
-
- handle_close:
- if (fixup_alt_jump)
- { /* Push a dummy failure point at the end of the
- alternative for a possible future
- `pop_failure_jump' to pop. See comments at
- `push_dummy_failure' in `re_match_2'. */
- BUF_PUSH (push_dummy_failure);
-
- /* We allocated space for this jump when we assigned
- to `fixup_alt_jump', in the `handle_alt' case below. */
- STORE_JUMP (jump_past_alt, fixup_alt_jump, b - 1);
- }
-
- /* See similar code for backslashed left paren above. */
- if (COMPILE_STACK_EMPTY)
- if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
- goto normal_char;
- else
- return REG_ERPAREN;
-
- /* Since we just checked for an empty stack above, this
- ``can't happen''. */
- assert (compile_stack.avail != 0);
- {
- /* We don't just want to restore into `regnum', because
- later groups should continue to be numbered higher,
- as in `(ab)c(de)' -- the second group is #2. */
- regnum_t this_group_regnum;
-
- compile_stack.avail--;
- begalt = bufp->buffer + COMPILE_STACK_TOP.begalt_offset;
- fixup_alt_jump
- = COMPILE_STACK_TOP.fixup_alt_jump
- ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1
- : 0;
- laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset;
- this_group_regnum = COMPILE_STACK_TOP.regnum;
- /* If we've reached MAX_REGNUM groups, then this open
- won't actually generate any code, so we'll have to
- clear pending_exact explicitly. */
- pending_exact = 0;
-
- /* We're at the end of the group, so now we know how many
- groups were inside this one. */
- if (this_group_regnum <= MAX_REGNUM)
- {
- unsigned char *inner_group_loc
- = bufp->buffer + COMPILE_STACK_TOP.inner_group_offset;
-
- *inner_group_loc = regnum - this_group_regnum;
- BUF_PUSH_3 (stop_memory, this_group_regnum,
- regnum - this_group_regnum);
- }
- }
- break;
-
-
- case '|': /* `\|'. */
- if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR)
- goto normal_backslash;
- handle_alt:
- if (syntax & RE_LIMITED_OPS)
- goto normal_char;
-
- /* Insert before the previous alternative a jump which
- jumps to this alternative if the former fails. */
- GET_BUFFER_SPACE (3);
- INSERT_JUMP (on_failure_jump, begalt, b + 6);
- pending_exact = 0;
- b += 3;
-
- /* The alternative before this one has a jump after it
- which gets executed if it gets matched. Adjust that
- jump so it will jump to this alternative's analogous
- jump (put in below, which in turn will jump to the next
- (if any) alternative's such jump, etc.). The last such
- jump jumps to the correct final destination. A picture:
- _____ _____
- | | | |
- | v | v
- a | b | c
-
- If we are at `b', then fixup_alt_jump right now points to a
- three-byte space after `a'. We'll put in the jump, set
- fixup_alt_jump to right after `b', and leave behind three
- bytes which we'll fill in when we get to after `c'. */
-
- if (fixup_alt_jump)
- STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
-
- /* Mark and leave space for a jump after this alternative,
- to be filled in later either by next alternative or
- when know we're at the end of a series of alternatives. */
- fixup_alt_jump = b;
- GET_BUFFER_SPACE (3);
- b += 3;
-
- laststart = 0;
- begalt = b;
- break;
-
-
- case '{':
- /* If \{ is a literal. */
- if (!(syntax & RE_INTERVALS)
- /* If we're at `\{' and it's not the open-interval
- operator. */
- || ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES))
- || (p - 2 == pattern && p == pend))
- goto normal_backslash;
-
- handle_interval:
- {
- /* If got here, then the syntax allows intervals. */
-
- /* At least (most) this many matches must be made. */
- int lower_bound = -1, upper_bound = -1;
-
- beg_interval = p - 1;
-
- if (p == pend)
- {
- if (syntax & RE_NO_BK_BRACES)
- goto unfetch_interval;
- else
- return REG_EBRACE;
- }
-
- GET_UNSIGNED_NUMBER (lower_bound);
-
- if (c == ',')
- {
- GET_UNSIGNED_NUMBER (upper_bound);
- if (upper_bound < 0) upper_bound = RE_DUP_MAX;
- }
- else
- /* Interval such as `{1}' => match exactly once. */
- upper_bound = lower_bound;
-
- if (lower_bound < 0 || upper_bound > RE_DUP_MAX
- || lower_bound > upper_bound)
- {
- if (syntax & RE_NO_BK_BRACES)
- goto unfetch_interval;
- else
- return REG_BADBR;
- }
-
- if (!(syntax & RE_NO_BK_BRACES))
- {
- if (c != '\\') return REG_EBRACE;
-
- PATFETCH (c);
- }
-
- if (c != '}')
- {
- if (syntax & RE_NO_BK_BRACES)
- goto unfetch_interval;
- else
- return REG_BADBR;
- }
-
- /* We just parsed a valid interval. */
-
- /* If it's invalid to have no preceding re. */
- if (!laststart)
- {
- if (syntax & RE_CONTEXT_INVALID_OPS)
- return REG_BADRPT;
- else if (syntax & RE_CONTEXT_INDEP_OPS)
- laststart = b;
- else
- goto unfetch_interval;
- }
-
- /* If the upper bound is zero, don't want to succeed at
- all; jump from `laststart' to `b + 3', which will be
- the end of the buffer after we insert the jump. */
- if (upper_bound == 0)
- {
- GET_BUFFER_SPACE (3);
- INSERT_JUMP (jump, laststart, b + 3);
- b += 3;
- }
-
- /* Otherwise, we have a nontrivial interval. When
- we're all done, the pattern will look like:
- set_number_at <jump count> <upper bound>
- set_number_at <succeed_n count> <lower bound>
- succeed_n <after jump addr> <succed_n count>
- <body of loop>
- jump_n <succeed_n addr> <jump count>
- (The upper bound and `jump_n' are omitted if
- `upper_bound' is 1, though.) */
- else
- { /* If the upper bound is > 1, we need to insert
- more at the end of the loop. */
- unsigned nbytes = 10 + (upper_bound > 1) * 10;
-
- GET_BUFFER_SPACE (nbytes);
-
- /* Initialize lower bound of the `succeed_n', even
- though it will be set during matching by its
- attendant `set_number_at' (inserted next),
- because `re_compile_fastmap' needs to know.
- Jump to the `jump_n' we might insert below. */
- INSERT_JUMP2 (succeed_n, laststart,
- b + 5 + (upper_bound > 1) * 5,
- lower_bound);
- b += 5;
-
- /* Code to initialize the lower bound. Insert
- before the `succeed_n'. The `5' is the last two
- bytes of this `set_number_at', plus 3 bytes of
- the following `succeed_n'. */
- insert_op2 (set_number_at, laststart, 5, lower_bound, b);
- b += 5;
-
- if (upper_bound > 1)
- { /* More than one repetition is allowed, so
- append a backward jump to the `succeed_n'
- that starts this interval.
-
- When we've reached this during matching,
- we'll have matched the interval once, so
- jump back only `upper_bound - 1' times. */
- STORE_JUMP2 (jump_n, b, laststart + 5,
- upper_bound - 1);
- b += 5;
-
- /* The location we want to set is the second
- parameter of the `jump_n'; that is `b-2' as
- an absolute address. `laststart' will be
- the `set_number_at' we're about to insert;
- `laststart+3' the number to set, the source
- for the relative address. But we are
- inserting into the middle of the pattern --
- so everything is getting moved up by 5.
- Conclusion: (b - 2) - (laststart + 3) + 5,
- i.e., b - laststart.
-
- We insert this at the beginning of the loop
- so that if we fail during matching, we'll
- reinitialize the bounds. */
- insert_op2 (set_number_at, laststart, b - laststart,
- upper_bound - 1, b);
- b += 5;
- }
- }
- pending_exact = 0;
- beg_interval = NULL;
- }
- break;
-
- unfetch_interval:
- /* If an invalid interval, match the characters as literals. */
- assert (beg_interval);
- p = beg_interval;
- beg_interval = NULL;
-
- /* normal_char and normal_backslash need `c'. */
- PATFETCH (c);
-
- if (!(syntax & RE_NO_BK_BRACES))
- {
- if (p > pattern && p[-1] == '\\')
- goto normal_backslash;
- }
- goto normal_char;
-
-#ifdef emacs
- /* There is no way to specify the before_dot and after_dot
- operators. rms says this is ok. --karl */
- case '=':
- BUF_PUSH (at_dot);
- break;
-
- case 's':
- laststart = b;
- PATFETCH (c);
- BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]);
- break;
-
- case 'S':
- laststart = b;
- PATFETCH (c);
- BUF_PUSH_2 (notsyntaxspec, syntax_spec_code[c]);
- break;
-#endif /* emacs */
-
-
- case 'w':
- if (re_syntax_options & RE_NO_GNU_OPS)
- goto normal_char;
- laststart = b;
- BUF_PUSH (wordchar);
- break;
-
-
- case 'W':
- if (re_syntax_options & RE_NO_GNU_OPS)
- goto normal_char;
- laststart = b;
- BUF_PUSH (notwordchar);
- break;
-
-
- case '<':
- if (re_syntax_options & RE_NO_GNU_OPS)
- goto normal_char;
- BUF_PUSH (wordbeg);
- break;
-
- case '>':
- if (re_syntax_options & RE_NO_GNU_OPS)
- goto normal_char;
- BUF_PUSH (wordend);
- break;
-
- case 'b':
- if (re_syntax_options & RE_NO_GNU_OPS)
- goto normal_char;
- BUF_PUSH (wordbound);
- break;
-
- case 'B':
- if (re_syntax_options & RE_NO_GNU_OPS)
- goto normal_char;
- BUF_PUSH (notwordbound);
- break;
-
- case '`':
- if (re_syntax_options & RE_NO_GNU_OPS)
- goto normal_char;
- BUF_PUSH (begbuf);
- break;
-
- case '\'':
- if (re_syntax_options & RE_NO_GNU_OPS)
- goto normal_char;
- BUF_PUSH (endbuf);
- break;
-
- case '1': case '2': case '3': case '4': case '5':
- case '6': case '7': case '8': case '9':
- if (syntax & RE_NO_BK_REFS)
- goto normal_char;
-
- c1 = c - '0';
-
- if (c1 > regnum)
- return REG_ESUBREG;
-
- /* Can't back reference to a subexpression if inside of it. */
- if (group_in_compile_stack (compile_stack, (regnum_t)c1))
- goto normal_char;
-
- laststart = b;
- BUF_PUSH_2 (duplicate, c1);
- break;
-
-
- case '+':
- case '?':
- if (syntax & RE_BK_PLUS_QM)
- goto handle_plus;
- else
- goto normal_backslash;
-
- default:
- normal_backslash:
- /* You might think it would be useful for \ to mean
- not to translate; but if we don't translate it
- it will never match anything. */
- c = TRANSLATE (c);
- goto normal_char;
- }
- break;
-
-
- default:
- /* Expects the character in `c'. */
- normal_char:
- /* If no exactn currently being built. */
- if (!pending_exact
-
- /* If last exactn not at current position. */
- || pending_exact + *pending_exact + 1 != b
-
- /* We have only one byte following the exactn for the count. */
- || *pending_exact == (1 << BYTEWIDTH) - 1
-
- /* If followed by a repetition operator. */
- || *p == '*' || *p == '^'
- || ((syntax & RE_BK_PLUS_QM)
- ? *p == '\\' && (p[1] == '+' || p[1] == '?')
- : (*p == '+' || *p == '?'))
- || ((syntax & RE_INTERVALS)
- && ((syntax & RE_NO_BK_BRACES)
- ? *p == '{'
- : (p[0] == '\\' && p[1] == '{'))))
- {
- /* Start building a new exactn. */
-
- laststart = b;
-
- BUF_PUSH_2 (exactn, 0);
- pending_exact = b - 1;
- }
-
- BUF_PUSH (c);
- (*pending_exact)++;
- break;
- } /* switch (c) */
- } /* while p != pend */
-
-
- /* Through the pattern now. */
-
- if (fixup_alt_jump)
- STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
-
- if (!COMPILE_STACK_EMPTY)
- return REG_EPAREN;
-
- free (compile_stack.stack);
-
- /* We have succeeded; set the length of the buffer. */
- bufp->used = b - bufp->buffer;
-
-#ifdef DEBUG
- if (debug)
- {
- DEBUG_PRINT1 ("\nCompiled pattern: \n");
- print_compiled_pattern (bufp);
- }
-#endif /* DEBUG */
-
- return REG_NOERROR;
-} /* regex_compile */
-
-/* Subroutines for `regex_compile'. */
-
-/* Store OP at LOC followed by two-byte integer parameter ARG. */
-
-static void
-store_op1 (op, loc, arg)
- re_opcode_t op;
- unsigned char *loc;
- int arg;
-{
- *loc = (unsigned char) op;
- STORE_NUMBER (loc + 1, arg);
-}
-
-
-/* Like `store_op1', but for two two-byte parameters ARG1 and ARG2. */
-
-static void
-store_op2 (op, loc, arg1, arg2)
- re_opcode_t op;
- unsigned char *loc;
- int arg1, arg2;
-{
- *loc = (unsigned char) op;
- STORE_NUMBER (loc + 1, arg1);
- STORE_NUMBER (loc + 3, arg2);
-}
-
-
-/* Copy the bytes from LOC to END to open up three bytes of space at LOC
- for OP followed by two-byte integer parameter ARG. */
-
-static void
-insert_op1 (op, loc, arg, end)
- re_opcode_t op;
- unsigned char *loc;
- int arg;
- unsigned char *end;
-{
- register unsigned char *pfrom = end;
- register unsigned char *pto = end + 3;
-
- while (pfrom != loc)
- *--pto = *--pfrom;
-
- store_op1 (op, loc, arg);
-}
-
-
-/* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2. */
-
-static void
-insert_op2 (op, loc, arg1, arg2, end)
- re_opcode_t op;
- unsigned char *loc;
- int arg1, arg2;
- unsigned char *end;
-{
- register unsigned char *pfrom = end;
- register unsigned char *pto = end + 5;
-
- while (pfrom != loc)
- *--pto = *--pfrom;
-
- store_op2 (op, loc, arg1, arg2);
-}
-
-
-/* P points to just after a ^ in PATTERN. Return true if that ^ comes
- after an alternative or a begin-subexpression. We assume there is at
- least one character before the ^. */
-
-static boolean
-at_begline_loc_p (pattern, p, syntax)
- const char *pattern, *p;
- reg_syntax_t syntax;
-{
- const char *prev = p - 2;
- boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\';
-
- return
- /* After a subexpression? */
- (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash))
- /* After an alternative? */
- || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash));
-}
-
-
-/* The dual of at_begline_loc_p. This one is for $. We assume there is
- at least one character after the $, i.e., `P < PEND'. */
-
-static boolean
-at_endline_loc_p (p, pend, syntax)
- const char *p, *pend;
- reg_syntax_t syntax;
-{
- const char *next = p;
- boolean next_backslash = *next == '\\';
- const char *next_next = p + 1 < pend ? p + 1 : NULL;
-
- return
- /* Before a subexpression? */
- (syntax & RE_NO_BK_PARENS ? *next == ')'
- : next_backslash && next_next && *next_next == ')')
- /* Before an alternative? */
- || (syntax & RE_NO_BK_VBAR ? *next == '|'
- : next_backslash && next_next && *next_next == '|');
-}
-
-
-/* Returns true if REGNUM is in one of COMPILE_STACK's elements and
- false if it's not. */
-
-static boolean
-group_in_compile_stack (compile_stack, regnum)
- compile_stack_type compile_stack;
- regnum_t regnum;
-{
- int this_element;
-
- for (this_element = compile_stack.avail - 1;
- this_element >= 0;
- this_element--)
- if (compile_stack.stack[this_element].regnum == regnum)
- return true;
-
- return false;
-}
-
-
-/* Read the ending character of a range (in a bracket expression) from the
- uncompiled pattern *P_PTR (which ends at PEND). We assume the
- starting character is in `P[-2]'. (`P[-1]' is the character `-'.)
- Then we set the translation of all bits between the starting and
- ending characters (inclusive) in the compiled pattern B.
-
- Return an error code.
-
- We use these short variable names so we can use the same macros as
- `regex_compile' itself. */
-
-static reg_errcode_t
-compile_range (p_ptr, pend, translate, syntax, b)
- const char **p_ptr, *pend;
- char *translate;
- reg_syntax_t syntax;
- unsigned char *b;
-{
- unsigned this_char;
-
- const char *p = *p_ptr;
- int range_start, range_end;
-
- if (p == pend)
- return REG_ERANGE;
-
- /* Even though the pattern is a signed `char *', we need to fetch
- with unsigned char *'s; if the high bit of the pattern character
- is set, the range endpoints will be negative if we fetch using a
- signed char *.
-
- We also want to fetch the endpoints without translating them; the
- appropriate translation is done in the bit-setting loop below. */
- range_start = ((unsigned char *) p)[-2];
- range_end = ((unsigned char *) p)[0];
-
- /* Have to increment the pointer into the pattern string, so the
- caller isn't still at the ending character. */
- (*p_ptr)++;
-
- /* If the start is after the end, the range is empty. */
- if (range_start > range_end)
- return syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR;
-
- /* Here we see why `this_char' has to be larger than an `unsigned
- char' -- the range is inclusive, so if `range_end' == 0xff
- (assuming 8-bit characters), we would otherwise go into an infinite
- loop, since all characters <= 0xff. */
- for (this_char = range_start; this_char <= range_end; this_char++)
- {
- SET_LIST_BIT (TRANSLATE (this_char));
- }
-
- return REG_NOERROR;
-}
-
-/* Failure stack declarations and macros; both re_compile_fastmap and
- re_match_2 use a failure stack. These have to be macros because of
- REGEX_ALLOCATE. */
-
-
-/* Number of failure points for which to initially allocate space
- when matching. If this number is exceeded, we allocate more
- space, so it is not a hard limit. */
-#ifndef INIT_FAILURE_ALLOC
-#define INIT_FAILURE_ALLOC 5
-#endif
-
-/* Roughly the maximum number of failure points on the stack. Would be
- exactly that if always used MAX_FAILURE_SPACE each time we failed.
- This is a variable only so users of regex can assign to it; we never
- change it ourselves. */
-int re_max_failures = 2000;
-
-typedef const unsigned char *fail_stack_elt_t;
-
-typedef struct
-{
- fail_stack_elt_t *stack;
- unsigned size;
- unsigned avail; /* Offset of next open position. */
-} fail_stack_type;
-
-#define FAIL_STACK_EMPTY() (fail_stack.avail == 0)
-#define FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0)
-#define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size)
-#define FAIL_STACK_TOP() (fail_stack.stack[fail_stack.avail])
-
-
-/* Initialize `fail_stack'. Do `return -2' if the alloc fails. */
-
-#define INIT_FAIL_STACK() \
- do { \
- fail_stack.stack = (fail_stack_elt_t *) \
- REGEX_ALLOCATE (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t)); \
- \
- if (fail_stack.stack == NULL) \
- return -2; \
- \
- fail_stack.size = INIT_FAILURE_ALLOC; \
- fail_stack.avail = 0; \
- } while (0)
-
-
-/* Double the size of FAIL_STACK, up to approximately `re_max_failures' items.
-
- Return 1 if succeeds, and 0 if either ran out of memory
- allocating space for it or it was already too large.
-
- REGEX_REALLOCATE requires `destination' be declared. */
-
-#define DOUBLE_FAIL_STACK(fail_stack) \
- ((fail_stack).size > re_max_failures * MAX_FAILURE_ITEMS \
- ? 0 \
- : ((fail_stack).stack = (fail_stack_elt_t *) \
- REGEX_REALLOCATE ((fail_stack).stack, \
- (fail_stack).size * sizeof (fail_stack_elt_t), \
- ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)), \
- \
- (fail_stack).stack == NULL \
- ? 0 \
- : ((fail_stack).size <<= 1, \
- 1)))
-
-
-/* Push PATTERN_OP on FAIL_STACK.
-
- Return 1 if was able to do so and 0 if ran out of memory allocating
- space to do so. */
-#define PUSH_PATTERN_OP(pattern_op, fail_stack) \
- ((FAIL_STACK_FULL () \
- && !DOUBLE_FAIL_STACK (fail_stack)) \
- ? 0 \
- : ((fail_stack).stack[(fail_stack).avail++] = pattern_op, \
- 1))
-
-/* This pushes an item onto the failure stack. Must be a four-byte
- value. Assumes the variable `fail_stack'. Probably should only
- be called from within `PUSH_FAILURE_POINT'. */
-#define PUSH_FAILURE_ITEM(item) \
- fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item
-
-/* The complement operation. Assumes `fail_stack' is nonempty. */
-#define POP_FAILURE_ITEM() fail_stack.stack[--fail_stack.avail]
-
-/* Used to omit pushing failure point id's when we're not debugging. */
-#ifdef DEBUG
-#define DEBUG_PUSH PUSH_FAILURE_ITEM
-#define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_ITEM ()
-#else
-#define DEBUG_PUSH(item)
-#define DEBUG_POP(item_addr)
-#endif
-
-
-/* Push the information about the state we will need
- if we ever fail back to it.
-
- Requires variables fail_stack, regstart, regend, reg_info, and
- num_regs be declared. DOUBLE_FAIL_STACK requires `destination' be
- declared.
-
- Does `return FAILURE_CODE' if runs out of memory. */
-
-#define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \
- do { \
- char *destination; \
- /* Must be int, so when we don't save any registers, the arithmetic \
- of 0 + -1 isn't done as unsigned. */ \
- /* Can't be int, since there is not a shred of a guarantee that int \
- is wide enough to hold a value of something to which pointer can \
- be assigned */ \
- s_reg_t this_reg; \
- \
- DEBUG_STATEMENT (failure_id++); \
- DEBUG_STATEMENT (nfailure_points_pushed++); \
- DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \
- DEBUG_PRINT2 (" Before push, next avail: %d\n", (fail_stack).avail);\
- DEBUG_PRINT2 (" size: %d\n", (fail_stack).size);\
- \
- DEBUG_PRINT2 (" slots needed: %d\n", NUM_FAILURE_ITEMS); \
- DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \
- \
- /* Ensure we have enough space allocated for what we will push. */ \
- while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \
- { \
- if (!DOUBLE_FAIL_STACK (fail_stack)) \
- return failure_code; \
- \
- DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \
- (fail_stack).size); \
- DEBUG_PRINT2 (" slots available: %d\n", REMAINING_AVAIL_SLOTS);\
- }
-
-#define PUSH_FAILURE_POINT2(pattern_place, string_place, failure_code) \
- /* Push the info, starting with the registers. */ \
- DEBUG_PRINT1 ("\n"); \
- \
- PUSH_FAILURE_POINT_LOOP (); \
- \
- DEBUG_PRINT2 (" Pushing low active reg: %d\n", lowest_active_reg);\
- PUSH_FAILURE_ITEM (lowest_active_reg); \
- \
- DEBUG_PRINT2 (" Pushing high active reg: %d\n", highest_active_reg);\
- PUSH_FAILURE_ITEM (highest_active_reg); \
- \
- DEBUG_PRINT2 (" Pushing pattern 0x%x: ", pattern_place); \
- DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \
- PUSH_FAILURE_ITEM (pattern_place); \
- \
- DEBUG_PRINT2 (" Pushing string 0x%x: `", string_place); \
- DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \
- size2); \
- DEBUG_PRINT1 ("'\n"); \
- PUSH_FAILURE_ITEM (string_place); \
- \
- DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \
- DEBUG_PUSH (failure_id); \
- } while (0)
-
-/* Pulled out of PUSH_FAILURE_POINT() to shorten the definition
- of that macro. (for VAX C) */
-#define PUSH_FAILURE_POINT_LOOP() \
- for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \
- this_reg++) \
- { \
- DEBUG_PRINT2 (" Pushing reg: %d\n", this_reg); \
- DEBUG_STATEMENT (num_regs_pushed++); \
- \
- DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \
- PUSH_FAILURE_ITEM (regstart[this_reg]); \
- \
- DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \
- PUSH_FAILURE_ITEM (regend[this_reg]); \
- \
- DEBUG_PRINT2 (" info: 0x%x\n ", reg_info[this_reg]); \
- DEBUG_PRINT2 (" match_null=%d", \
- REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \
- DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \
- DEBUG_PRINT2 (" matched_something=%d", \
- MATCHED_SOMETHING (reg_info[this_reg])); \
- DEBUG_PRINT2 (" ever_matched=%d", \
- EVER_MATCHED_SOMETHING (reg_info[this_reg])); \
- DEBUG_PRINT1 ("\n"); \
- PUSH_FAILURE_ITEM (reg_info[this_reg].word); \
- }
-
-/* This is the number of items that are pushed and popped on the stack
- for each register. */
-#define NUM_REG_ITEMS 3
-
-/* Individual items aside from the registers. */
-#ifdef DEBUG
-#define NUM_NONREG_ITEMS 5 /* Includes failure point id. */
-#else
-#define NUM_NONREG_ITEMS 4
-#endif
-
-/* We push at most this many items on the stack. */
-#define MAX_FAILURE_ITEMS ((num_regs - 1) * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
-
-/* We actually push this many items. */
-#define NUM_FAILURE_ITEMS \
- ((highest_active_reg - lowest_active_reg + 1) * NUM_REG_ITEMS \
- + NUM_NONREG_ITEMS)
-
-/* How many items can still be added to the stack without overflowing it. */
-#define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail)
-
-
-/* Pops what PUSH_FAIL_STACK pushes.
-
- We restore into the parameters, all of which should be lvalues:
- STR -- the saved data position.
- PAT -- the saved pattern position.
- LOW_REG, HIGH_REG -- the highest and lowest active registers.
- REGSTART, REGEND -- arrays of string positions.
- REG_INFO -- array of information about each subexpression.
-
- Also assumes the variables `fail_stack' and (if debugging), `bufp',
- `pend', `string1', `size1', `string2', and `size2'. */
-
-#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\
-{ \
- DEBUG_STATEMENT (fail_stack_elt_t failure_id;) \
- s_reg_t this_reg; \
- const unsigned char *string_temp; \
- \
- assert (!FAIL_STACK_EMPTY ()); \
- \
- /* Remove failure points and point to how many regs pushed. */ \
- DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \
- DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \
- DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \
- \
- assert (fail_stack.avail >= NUM_NONREG_ITEMS); \
- \
- DEBUG_POP (&failure_id); \
- DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \
- \
- /* If the saved string location is NULL, it came from an \
- on_failure_keep_string_jump opcode, and we want to throw away the \
- saved NULL, thus retaining our current position in the string. */ \
- string_temp = POP_FAILURE_ITEM (); \
- if (string_temp != NULL) \
- str = (const char *) string_temp; \
- \
- DEBUG_PRINT2 (" Popping string 0x%x: `", str); \
- DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \
- DEBUG_PRINT1 ("'\n"); \
- \
- pat = (unsigned char *) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" Popping pattern 0x%x: ", pat); \
- DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \
- \
- POP_FAILURE_POINT2 (low_reg, high_reg, regstart, regend, reg_info);
-
-/* Pulled out of POP_FAILURE_POINT() to shorten the definition
- of that macro. (for MSC 5.1) */
-#define POP_FAILURE_POINT2(low_reg, high_reg, regstart, regend, reg_info) \
- \
- /* Restore register info. */ \
- high_reg = (active_reg_t) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" Popping high active reg: %d\n", high_reg); \
- \
- low_reg = (active_reg_t) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \
- \
- for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \
- { \
- DEBUG_PRINT2 (" Popping reg: %d\n", this_reg); \
- \
- reg_info[this_reg].word = POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" info: 0x%x\n", reg_info[this_reg]); \
- \
- regend[this_reg] = (const char *) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \
- \
- regstart[this_reg] = (const char *) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \
- } \
- \
- DEBUG_STATEMENT (nfailure_points_popped++); \
-} /* POP_FAILURE_POINT */
-
-
-/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in
- BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible
- characters can start a string that matches the pattern. This fastmap
- is used by re_search to skip quickly over impossible starting points.
-
- The caller must supply the address of a (1 << BYTEWIDTH)-byte data
- area as BUFP->fastmap.
-
- We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in
- the pattern buffer.
-
- Returns 0 if we succeed, -2 if an internal error. */
-
-int
-re_compile_fastmap (bufp)
- struct re_pattern_buffer *bufp;
-{
- int j, k;
- fail_stack_type fail_stack;
-#ifndef REGEX_MALLOC
- char *destination;
-#endif
- /* We don't push any register information onto the failure stack. */
- unsigned num_regs = 0;
-
- register char *fastmap = bufp->fastmap;
- unsigned char *pattern = bufp->buffer;
- const unsigned char *p = pattern;
- register unsigned char *pend = pattern + bufp->used;
-
- /* Assume that each path through the pattern can be null until
- proven otherwise. We set this false at the bottom of switch
- statement, to which we get only if a particular path doesn't
- match the empty string. */
- boolean path_can_be_null = true;
-
- /* We aren't doing a `succeed_n' to begin with. */
- boolean succeed_n_p = false;
-
- assert (fastmap != NULL && p != NULL);
-
- INIT_FAIL_STACK ();
- bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */
- bufp->fastmap_accurate = 1; /* It will be when we're done. */
- bufp->can_be_null = 0;
-
- while (p != pend || !FAIL_STACK_EMPTY ())
- {
- if (p == pend)
- {
- bufp->can_be_null |= path_can_be_null;
-
- /* Reset for next path. */
- path_can_be_null = true;
-
- p = fail_stack.stack[--fail_stack.avail];
- }
-
- /* We should never be about to go beyond the end of the pattern. */
- assert (p < pend);
-
-#ifdef SWITCH_ENUM_BUG
- switch ((int) ((re_opcode_t) *p++))
-#else
- switch ((re_opcode_t) *p++)
-#endif
- {
-
- /* I guess the idea here is to simply not bother with a fastmap
- if a backreference is used, since it's too hard to figure out
- the fastmap for the corresponding group. Setting
- `can_be_null' stops `re_search_2' from using the fastmap, so
- that is all we do. */
- case duplicate:
- bufp->can_be_null = 1;
- return 0;
-
-
- /* Following are the cases which match a character. These end
- with `break'. */
-
- case exactn:
- fastmap[p[1]] = 1;
- break;
-
-
- case charset:
- for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
- fastmap[j] = 1;
- break;
-
-
- case charset_not:
- /* Chars beyond end of map must be allowed. */
- for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
- fastmap[j] = 1;
-
- for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
- fastmap[j] = 1;
- break;
-
-
- case wordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == Sword)
- fastmap[j] = 1;
- break;
-
-
- case notwordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != Sword)
- fastmap[j] = 1;
- break;
-
-
- case anychar:
- /* `.' matches anything ... */
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- fastmap[j] = 1;
-
- /* ... except perhaps newline. */
- if (!(bufp->syntax & RE_DOT_NEWLINE))
- fastmap['\n'] = 0;
-
- /* Return if we have already set `can_be_null'; if we have,
- then the fastmap is irrelevant. Something's wrong here. */
- else if (bufp->can_be_null)
- return 0;
-
- /* Otherwise, have to check alternative paths. */
- break;
-
-
-#ifdef emacs
- case syntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
-
-
- case notsyntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
-
-
- /* All cases after this match the empty string. These end with
- `continue'. */
-
-
- case before_dot:
- case at_dot:
- case after_dot:
- continue;
-#endif /* not emacs */
-
-
- case no_op:
- case begline:
- case endline:
- case begbuf:
- case endbuf:
- case wordbound:
- case notwordbound:
- case wordbeg:
- case wordend:
- case push_dummy_failure:
- continue;
-
-
- case jump_n:
- case pop_failure_jump:
- case maybe_pop_jump:
- case jump:
- case jump_past_alt:
- case dummy_failure_jump:
- EXTRACT_NUMBER_AND_INCR (j, p);
- p += j;
- if (j > 0)
- continue;
-
- /* Jump backward implies we just went through the body of a
- loop and matched nothing. Opcode jumped to should be
- `on_failure_jump' or `succeed_n'. Just treat it like an
- ordinary jump. For a * loop, it has pushed its failure
- point already; if so, discard that as redundant. */
- if ((re_opcode_t) *p != on_failure_jump
- && (re_opcode_t) *p != succeed_n)
- continue;
-
- p++;
- EXTRACT_NUMBER_AND_INCR (j, p);
- p += j;
-
- /* If what's on the stack is where we are now, pop it. */
- if (!FAIL_STACK_EMPTY ()
- && fail_stack.stack[fail_stack.avail - 1] == p)
- fail_stack.avail--;
-
- continue;
-
-
- case on_failure_jump:
- case on_failure_keep_string_jump:
- handle_on_failure_jump:
- EXTRACT_NUMBER_AND_INCR (j, p);
-
- /* For some patterns, e.g., `(a?)?', `p+j' here points to the
- end of the pattern. We don't want to push such a point,
- since when we restore it above, entering the switch will
- increment `p' past the end of the pattern. We don't need
- to push such a point since we obviously won't find any more
- fastmap entries beyond `pend'. Such a pattern can match
- the null string, though. */
- if (p + j < pend)
- {
- if (!PUSH_PATTERN_OP (p + j, fail_stack))
- return -2;
- }
- else
- bufp->can_be_null = 1;
-
- if (succeed_n_p)
- {
- EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */
- succeed_n_p = false;
- }
-
- continue;
-
-
- case succeed_n:
- /* Get to the number of times to succeed. */
- p += 2;
-
- /* Increment p past the n for when k != 0. */
- EXTRACT_NUMBER_AND_INCR (k, p);
- if (k == 0)
- {
- p -= 4;
- succeed_n_p = true; /* Spaghetti code alert. */
- goto handle_on_failure_jump;
- }
- continue;
-
-
- case set_number_at:
- p += 4;
- continue;
-
-
- case start_memory:
- case stop_memory:
- p += 2;
- continue;
-
-
- default:
- abort (); /* We have listed all the cases. */
- } /* switch *p++ */
-
- /* Getting here means we have found the possible starting
- characters for one path of the pattern -- and that the empty
- string does not match. We need not follow this path further.
- Instead, look at the next alternative (remembered on the
- stack), or quit if no more. The test at the top of the loop
- does these things. */
- path_can_be_null = false;
- p = pend;
- } /* while p */
-
- /* Set `can_be_null' for the last path (also the first path, if the
- pattern is empty). */
- bufp->can_be_null |= path_can_be_null;
- return 0;
-} /* re_compile_fastmap */
-
-/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
- ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use
- this memory for recording register information. STARTS and ENDS
- must be allocated using the malloc library routine, and must each
- be at least NUM_REGS * sizeof (regoff_t) bytes long.
-
- If NUM_REGS == 0, then subsequent matches should allocate their own
- register data.
-
- Unless this function is called, the first search or match using
- PATTERN_BUFFER will allocate its own register data, without
- freeing the old data. */
-
-void
-re_set_registers (bufp, regs, num_regs, starts, ends)
- struct re_pattern_buffer *bufp;
- struct re_registers *regs;
- unsigned num_regs;
- regoff_t *starts, *ends;
-{
- if (num_regs)
- {
- bufp->regs_allocated = REGS_REALLOCATE;
- regs->num_regs = num_regs;
- regs->start = starts;
- regs->end = ends;
- }
- else
- {
- bufp->regs_allocated = REGS_UNALLOCATED;
- regs->num_regs = 0;
- regs->start = regs->end = 0;
- }
-}
-
-/* Searching routines. */
-
-/* Like re_search_2, below, but only one string is specified, and
- doesn't let you say where to stop matching. */
-
-int
-re_search (bufp, string, size, startpos, range, regs)
- struct re_pattern_buffer *bufp;
- const char *string;
- int size, startpos, range;
- struct re_registers *regs;
-{
- return re_search_2 (bufp, NULL, 0, string, size, startpos, range,
- regs, size);
-}
-
-
-/* Using the compiled pattern in BUFP->buffer, first tries to match the
- virtual concatenation of STRING1 and STRING2, starting first at index
- STARTPOS, then at STARTPOS + 1, and so on.
-
- STRING1 and STRING2 have length SIZE1 and SIZE2, respectively.
-
- RANGE is how far to scan while trying to match. RANGE = 0 means try
- only at STARTPOS; in general, the last start tried is STARTPOS +
- RANGE.
-
- In REGS, return the indices of the virtual concatenation of STRING1
- and STRING2 that matched the entire BUFP->buffer and its contained
- subexpressions.
-
- Do not consider matching one past the index STOP in the virtual
- concatenation of STRING1 and STRING2.
-
- We return either the position in the strings at which the match was
- found, -1 if no match, or -2 if error (such as failure
- stack overflow). */
-
-int
-re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
- struct re_pattern_buffer *bufp;
- const char *string1, *string2;
- int size1, size2;
- int startpos;
- int range;
- struct re_registers *regs;
- int stop;
-{
- int val;
- register char *fastmap = bufp->fastmap;
- register char *translate = bufp->translate;
- int total_size = size1 + size2;
- int endpos = startpos + range;
-
- /* Check for out-of-range STARTPOS. */
- if (startpos < 0 || startpos > total_size)
- return -1;
-
- /* Fix up RANGE if it might eventually take us outside
- the virtual concatenation of STRING1 and STRING2. */
- if (endpos < -1)
- range = -1 - startpos;
- else if (endpos > total_size)
- range = total_size - startpos;
-
- /* If the search isn't to be a backwards one, don't waste time in a
- search for a pattern that must be anchored. */
- if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == begbuf && range > 0)
- {
- if (startpos > 0)
- return -1;
- else
- range = 1;
- }
-
- /* Update the fastmap now if not correct already. */
- if (fastmap && !bufp->fastmap_accurate)
- if (re_compile_fastmap (bufp) == -2)
- return -2;
-
- /* Loop through the string, looking for a place to start matching. */
- for (;;)
- {
- /* If a fastmap is supplied, skip quickly over characters that
- cannot be the start of a match. If the pattern can match the
- null string, however, we don't need to skip characters; we want
- the first null string. */
- if (fastmap && startpos < total_size && !bufp->can_be_null)
- {
- if (range > 0) /* Searching forwards. */
- {
- register const char *d;
- register int lim = 0;
- int irange = range;
-
- if (startpos < size1 && startpos + range >= size1)
- lim = range - (size1 - startpos);
-
- d = (startpos >= size1 ? string2 - size1 : string1) + startpos;
-
- /* Written out as an if-else to avoid testing `translate'
- inside the loop. */
- if (translate)
- while (range > lim
- && !fastmap[(unsigned char)
- translate[(unsigned char) *d++]])
- range--;
- else
- while (range > lim && !fastmap[(unsigned char) *d++])
- range--;
-
- startpos += irange - range;
- }
- else /* Searching backwards. */
- {
- register char c = (size1 == 0 || startpos >= size1
- ? string2[startpos - size1]
- : string1[startpos]);
-
- if (!fastmap[(unsigned char) TRANSLATE (c)])
- goto advance;
- }
- }
-
- /* If can't match the null string, and that's all we have left, fail. */
- if (range >= 0 && startpos == total_size && fastmap
- && !bufp->can_be_null)
- return -1;
-
- val = re_match_2 (bufp, string1, size1, string2, size2,
- startpos, regs, stop);
- if (val >= 0)
- return startpos;
-
- if (val == -2)
- return -2;
-
- advance:
- if (!range)
- break;
- else if (range > 0)
- {
- range--;
- startpos++;
- }
- else
- {
- range++;
- startpos--;
- }
- }
- return -1;
-} /* re_search_2 */
-
-/* Structure for per-register (a.k.a. per-group) information.
- This must not be longer than one word, because we push this value
- onto the failure stack. Other register information, such as the
- starting and ending positions (which are addresses), and the list of
- inner groups (which is a bits list) are maintained in separate
- variables.
-
- We are making a (strictly speaking) nonportable assumption here: that
- the compiler will pack our bit fields into something that fits into
- the type of `word', i.e., is something that fits into one item on the
- failure stack. */
-
-/* Declarations and macros for re_match_2. */
-
-typedef union
-{
- fail_stack_elt_t word;
- struct
- {
- /* This field is one if this group can match the empty string,
- zero if not. If not yet determined, `MATCH_NULL_UNSET_VALUE'. */
-#define MATCH_NULL_UNSET_VALUE 3
- unsigned match_null_string_p : 2;
- unsigned is_active : 1;
- unsigned matched_something : 1;
- unsigned ever_matched_something : 1;
- } bits;
-} register_info_type;
-
-#define REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p)
-#define IS_ACTIVE(R) ((R).bits.is_active)
-#define MATCHED_SOMETHING(R) ((R).bits.matched_something)
-#define EVER_MATCHED_SOMETHING(R) ((R).bits.ever_matched_something)
-
-static boolean group_match_null_string_p _RE_ARGS((unsigned char **p,
- unsigned char *end,
- register_info_type *reg_info));
-static boolean alt_match_null_string_p _RE_ARGS((unsigned char *p,
- unsigned char *end,
- register_info_type *reg_info));
-static boolean common_op_match_null_string_p _RE_ARGS((unsigned char **p,
- unsigned char *end,
- register_info_type *reg_info));
-static int bcmp_translate _RE_ARGS((const char *s1, const char *s2,
- int len, char *translate));
-
-/* Call this when have matched a real character; it sets `matched' flags
- for the subexpressions which we are currently inside. Also records
- that those subexprs have matched. */
-#define SET_REGS_MATCHED() \
- do \
- { \
- active_reg_t r; \
- for (r = lowest_active_reg; r <= highest_active_reg; r++) \
- { \
- MATCHED_SOMETHING (reg_info[r]) \
- = EVER_MATCHED_SOMETHING (reg_info[r]) \
- = 1; \
- } \
- } \
- while (0)
-
-
-/* This converts PTR, a pointer into one of the search strings `string1'
- and `string2' into an offset from the beginning of that string. */
-#define POINTER_TO_OFFSET(ptr) \
- (FIRST_STRING_P (ptr) ? (ptr) - string1 : (ptr) - string2 + size1)
-
-/* Registers are set to a sentinel when they haven't yet matched. */
-#define REG_UNSET_VALUE ((char *) -1)
-#define REG_UNSET(e) ((e) == REG_UNSET_VALUE)
-
-
-/* Macros for dealing with the split strings in re_match_2. */
-
-#define MATCHING_IN_FIRST_STRING (dend == end_match_1)
-
-/* Call before fetching a character with *d. This switches over to
- string2 if necessary. */
-#define PREFETCH() \
- while (d == dend) \
- { \
- /* End of string2 => fail. */ \
- if (dend == end_match_2) \
- goto fail; \
- /* End of string1 => advance to string2. */ \
- d = string2; \
- dend = end_match_2; \
- }
-
-
-/* Test if at very beginning or at very end of the virtual concatenation
- of `string1' and `string2'. If only one string, it's `string2'. */
-#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2)
-#define AT_STRINGS_END(d) ((d) == end2)
-
-
-/* Test if D points to a character which is word-constituent. We have
- two special cases to check for: if past the end of string1, look at
- the first character in string2; and if before the beginning of
- string2, look at the last character in string1. */
-#define WORDCHAR_P(d) \
- (SYNTAX ((d) == end1 ? *string2 \
- : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \
- == Sword)
-
-/* Test if the character before D and the one at D differ with respect
- to being word-constituent. */
-#define AT_WORD_BOUNDARY(d) \
- (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \
- || WORDCHAR_P (d - 1) != WORDCHAR_P (d))
-
-
-/* Free everything we malloc. */
-#ifdef REGEX_MALLOC
-#define FREE_VAR(var) if (var) free (var); var = NULL
-#define FREE_VARIABLES() \
- do { \
- FREE_VAR (fail_stack.stack); \
- FREE_VAR (regstart); \
- FREE_VAR (regend); \
- FREE_VAR (old_regstart); \
- FREE_VAR (old_regend); \
- FREE_VAR (best_regstart); \
- FREE_VAR (best_regend); \
- FREE_VAR (reg_info); \
- FREE_VAR (reg_dummy); \
- FREE_VAR (reg_info_dummy); \
- } while (0)
-#else /* not REGEX_MALLOC */
-/* Some MIPS systems (at least) want this to free alloca'd storage. */
-#define FREE_VARIABLES() alloca (0)
-#endif /* not REGEX_MALLOC */
-
-
-/* These values must meet several constraints. They must not be valid
- register values; since we have a limit of 255 registers (because
- we use only one byte in the pattern for the register number), we can
- use numbers larger than 255. They must differ by 1, because of
- NUM_FAILURE_ITEMS above. And the value for the lowest register must
- be larger than the value for the highest register, so we do not try
- to actually save any registers when none are active. */
-#define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH)
-#define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1)
-
-/* Matching routines. */
-
-#ifndef emacs /* Emacs never uses this. */
-/* re_match is like re_match_2 except it takes only a single string. */
-
-int
-re_match (bufp, string, size, pos, regs)
- struct re_pattern_buffer *bufp;
- const char *string;
- int size, pos;
- struct re_registers *regs;
- {
- return re_match_2 (bufp, NULL, 0, string, size, pos, regs, size);
-}
-#endif /* not emacs */
-
-
-/* re_match_2 matches the compiled pattern in BUFP against the
- the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1
- and SIZE2, respectively). We start matching at POS, and stop
- matching at STOP.
-
- If REGS is non-null and the `no_sub' field of BUFP is nonzero, we
- store offsets for the substring each group matched in REGS. See the
- documentation for exactly how many groups we fill.
-
- We return -1 if no match, -2 if an internal error (such as the
- failure stack overflowing). Otherwise, we return the length of the
- matched substring. */
-
-int
-re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
- struct re_pattern_buffer *bufp;
- const char *string1, *string2;
- int size1, size2;
- int pos;
- struct re_registers *regs;
- int stop;
-{
- /* General temporaries. */
- int mcnt;
- unsigned char *p1;
-
- /* Just past the end of the corresponding string. */
- const char *end1, *end2;
-
- /* Pointers into string1 and string2, just past the last characters in
- each to consider matching. */
- const char *end_match_1, *end_match_2;
-
- /* Where we are in the data, and the end of the current string. */
- const char *d, *dend;
-
- /* Where we are in the pattern, and the end of the pattern. */
- unsigned char *p = bufp->buffer;
- register unsigned char *pend = p + bufp->used;
-
- /* We use this to map every character in the string. */
- char *translate = bufp->translate;
-
- /* Failure point stack. Each place that can handle a failure further
- down the line pushes a failure point on this stack. It consists of
- restart, regend, and reg_info for all registers corresponding to
- the subexpressions we're currently inside, plus the number of such
- registers, and, finally, two char *'s. The first char * is where
- to resume scanning the pattern; the second one is where to resume
- scanning the strings. If the latter is zero, the failure point is
- a ``dummy''; if a failure happens and the failure point is a dummy,
- it gets discarded and the next next one is tried. */
- fail_stack_type fail_stack;
-#ifdef DEBUG
- static unsigned failure_id = 0;
- unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0;
-#endif
-
- /* We fill all the registers internally, independent of what we
- return, for use in backreferences. The number here includes
- an element for register zero. */
- size_t num_regs = bufp->re_nsub + 1;
-
- /* The currently active registers. */
- active_reg_t lowest_active_reg = NO_LOWEST_ACTIVE_REG;
- active_reg_t highest_active_reg = NO_HIGHEST_ACTIVE_REG;
-
- /* Information on the contents of registers. These are pointers into
- the input strings; they record just what was matched (on this
- attempt) by a subexpression part of the pattern, that is, the
- regnum-th regstart pointer points to where in the pattern we began
- matching and the regnum-th regend points to right after where we
- stopped matching the regnum-th subexpression. (The zeroth register
- keeps track of what the whole pattern matches.) */
- const char **regstart = 0, **regend = 0;
-
- /* If a group that's operated upon by a repetition operator fails to
- match anything, then the register for its start will need to be
- restored because it will have been set to wherever in the string we
- are when we last see its open-group operator. Similarly for a
- register's end. */
- const char **old_regstart = 0, **old_regend = 0;
-
- /* The is_active field of reg_info helps us keep track of which (possibly
- nested) subexpressions we are currently in. The matched_something
- field of reg_info[reg_num] helps us tell whether or not we have
- matched any of the pattern so far this time through the reg_num-th
- subexpression. These two fields get reset each time through any
- loop their register is in. */
- register_info_type *reg_info = 0;
-
- /* The following record the register info as found in the above
- variables when we find a match better than any we've seen before.
- This happens as we backtrack through the failure points, which in
- turn happens only if we have not yet matched the entire string. */
- unsigned best_regs_set = false;
- const char **best_regstart = 0, **best_regend = 0;
-
- /* Logically, this is `best_regend[0]'. But we don't want to have to
- allocate space for that if we're not allocating space for anything
- else (see below). Also, we never need info about register 0 for
- any of the other register vectors, and it seems rather a kludge to
- treat `best_regend' differently than the rest. So we keep track of
- the end of the best match so far in a separate variable. We
- initialize this to NULL so that when we backtrack the first time
- and need to test it, it's not garbage. */
- const char *match_end = NULL;
-
- /* Used when we pop values we don't care about. */
- const char **reg_dummy = 0;
- register_info_type *reg_info_dummy = 0;
-
-#ifdef DEBUG
- /* Counts the total number of registers pushed. */
- unsigned num_regs_pushed = 0;
-#endif
-
- DEBUG_PRINT1 ("\n\nEntering re_match_2.\n");
-
- INIT_FAIL_STACK ();
-
- /* Do not bother to initialize all the register variables if there are
- no groups in the pattern, as it takes a fair amount of time. If
- there are groups, we include space for register 0 (the whole
- pattern), even though we never use it, since it simplifies the
- array indexing. We should fix this. */
- if (bufp->re_nsub)
- {
- regstart = REGEX_TALLOC (num_regs, const char *);
- regend = REGEX_TALLOC (num_regs, const char *);
- old_regstart = REGEX_TALLOC (num_regs, const char *);
- old_regend = REGEX_TALLOC (num_regs, const char *);
- best_regstart = REGEX_TALLOC (num_regs, const char *);
- best_regend = REGEX_TALLOC (num_regs, const char *);
- reg_info = REGEX_TALLOC (num_regs, register_info_type);
- reg_dummy = REGEX_TALLOC (num_regs, const char *);
- reg_info_dummy = REGEX_TALLOC (num_regs, register_info_type);
-
- if (!(regstart && regend && old_regstart && old_regend && reg_info
- && best_regstart && best_regend && reg_dummy && reg_info_dummy))
- {
- FREE_VARIABLES ();
- return -2;
- }
- }
-#ifdef REGEX_MALLOC
- else
- {
- /* We must initialize all our variables to NULL, so that
- `FREE_VARIABLES' doesn't try to free them. */
- regstart = regend = old_regstart = old_regend = best_regstart
- = best_regend = reg_dummy = NULL;
- reg_info = reg_info_dummy = (register_info_type *) NULL;
- }
-#endif /* REGEX_MALLOC */
-
- /* The starting position is bogus. */
- if (pos < 0 || pos > size1 + size2)
- {
- FREE_VARIABLES ();
- return -1;
- }
-
- /* Initialize subexpression text positions to -1 to mark ones that no
- start_memory/stop_memory has been seen for. Also initialize the
- register information struct. */
- for (mcnt = 1; mcnt < num_regs; mcnt++)
- {
- regstart[mcnt] = regend[mcnt]
- = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE;
-
- REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE;
- IS_ACTIVE (reg_info[mcnt]) = 0;
- MATCHED_SOMETHING (reg_info[mcnt]) = 0;
- EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0;
- }
-
- /* We move `string1' into `string2' if the latter's empty -- but not if
- `string1' is null. */
- if (size2 == 0 && string1 != NULL)
- {
- string2 = string1;
- size2 = size1;
- string1 = 0;
- size1 = 0;
- }
- end1 = string1 + size1;
- end2 = string2 + size2;
-
- /* Compute where to stop matching, within the two strings. */
- if (stop <= size1)
- {
- end_match_1 = string1 + stop;
- end_match_2 = string2;
- }
- else
- {
- end_match_1 = end1;
- end_match_2 = string2 + stop - size1;
- }
-
- /* `p' scans through the pattern as `d' scans through the data.
- `dend' is the end of the input string that `d' points within. `d'
- is advanced into the following input string whenever necessary, but
- this happens before fetching; therefore, at the beginning of the
- loop, `d' can be pointing at the end of a string, but it cannot
- equal `string2'. */
- if (size1 > 0 && pos <= size1)
- {
- d = string1 + pos;
- dend = end_match_1;
- }
- else
- {
- d = string2 + pos - size1;
- dend = end_match_2;
- }
-
- DEBUG_PRINT1 ("The compiled pattern is: ");
- DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend);
- DEBUG_PRINT1 ("The string to match is: `");
- DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2);
- DEBUG_PRINT1 ("'\n");
-
- /* This loops over pattern commands. It exits by returning from the
- function if the match is complete, or it drops through if the match
- fails at this starting point in the input data. */
- for (;;)
- {
- DEBUG_PRINT2 ("\n0x%x: ", p);
-
- if (p == pend)
- { /* End of pattern means we might have succeeded. */
- DEBUG_PRINT1 ("end of pattern ... ");
-
- /* If we haven't matched the entire string, and we want the
- longest match, try backtracking. */
- if (d != end_match_2)
- {
- DEBUG_PRINT1 ("backtracking.\n");
-
- if (!FAIL_STACK_EMPTY ())
- { /* More failure points to try. */
- boolean same_str_p = (FIRST_STRING_P (match_end)
- == MATCHING_IN_FIRST_STRING);
-
- /* If exceeds best match so far, save it. */
- if (!best_regs_set
- || (same_str_p && d > match_end)
- || (!same_str_p && !MATCHING_IN_FIRST_STRING))
- {
- best_regs_set = true;
- match_end = d;
-
- DEBUG_PRINT1 ("\nSAVING match as best so far.\n");
-
- for (mcnt = 1; mcnt < num_regs; mcnt++)
- {
- best_regstart[mcnt] = regstart[mcnt];
- best_regend[mcnt] = regend[mcnt];
- }
- }
- goto fail;
- }
-
- /* If no failure points, don't restore garbage. */
- else if (best_regs_set)
- {
- restore_best_regs:
- /* Restore best match. It may happen that `dend ==
- end_match_1' while the restored d is in string2.
- For example, the pattern `x.*y.*z' against the
- strings `x-' and `y-z-', if the two strings are
- not consecutive in memory. */
- DEBUG_PRINT1 ("Restoring best registers.\n");
-
- d = match_end;
- dend = ((d >= string1 && d <= end1)
- ? end_match_1 : end_match_2);
-
- for (mcnt = 1; mcnt < num_regs; mcnt++)
- {
- regstart[mcnt] = best_regstart[mcnt];
- regend[mcnt] = best_regend[mcnt];
- }
- }
- } /* d != end_match_2 */
-
- DEBUG_PRINT1 ("Accepting match.\n");
-
- /* If caller wants register contents data back, do it. */
- if (regs && !bufp->no_sub)
- {
- /* Have the register data arrays been allocated? */
- if (bufp->regs_allocated == REGS_UNALLOCATED)
- { /* No. So allocate them with malloc. We need one
- extra element beyond `num_regs' for the `-1' marker
- GNU code uses. */
- regs->num_regs = MAX (RE_NREGS, num_regs + 1);
- regs->start = TALLOC (regs->num_regs, regoff_t);
- regs->end = TALLOC (regs->num_regs, regoff_t);
- if (regs->start == NULL || regs->end == NULL)
- return -2;
- bufp->regs_allocated = REGS_REALLOCATE;
- }
- else if (bufp->regs_allocated == REGS_REALLOCATE)
- { /* Yes. If we need more elements than were already
- allocated, reallocate them. If we need fewer, just
- leave it alone. */
- if (regs->num_regs < num_regs + 1)
- {
- regs->num_regs = num_regs + 1;
- RETALLOC (regs->start, regs->num_regs, regoff_t);
- RETALLOC (regs->end, regs->num_regs, regoff_t);
- if (regs->start == NULL || regs->end == NULL)
- return -2;
- }
- }
- else
- {
- /* These braces fend off a "empty body in an else-statement"
- warning under GCC when assert expands to nothing. */
- assert (bufp->regs_allocated == REGS_FIXED);
- }
-
- /* Convert the pointer data in `regstart' and `regend' to
- indices. Register zero has to be set differently,
- since we haven't kept track of any info for it. */
- if (regs->num_regs > 0)
- {
- regs->start[0] = pos;
- regs->end[0] = (MATCHING_IN_FIRST_STRING ? d - string1
- : d - string2 + size1);
- }
-
- /* Go through the first `min (num_regs, regs->num_regs)'
- registers, since that is all we initialized. */
- for (mcnt = 1; mcnt < MIN (num_regs, regs->num_regs); mcnt++)
- {
- if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt]))
- regs->start[mcnt] = regs->end[mcnt] = -1;
- else
- {
- regs->start[mcnt] = POINTER_TO_OFFSET (regstart[mcnt]);
- regs->end[mcnt] = POINTER_TO_OFFSET (regend[mcnt]);
- }
- }
-
- /* If the regs structure we return has more elements than
- were in the pattern, set the extra elements to -1. If
- we (re)allocated the registers, this is the case,
- because we always allocate enough to have at least one
- -1 at the end. */
- for (mcnt = num_regs; mcnt < regs->num_regs; mcnt++)
- regs->start[mcnt] = regs->end[mcnt] = -1;
- } /* regs && !bufp->no_sub */
-
- FREE_VARIABLES ();
- DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n",
- nfailure_points_pushed, nfailure_points_popped,
- nfailure_points_pushed - nfailure_points_popped);
- DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed);
-
- mcnt = d - pos - (MATCHING_IN_FIRST_STRING
- ? string1
- : string2 - size1);
-
- DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt);
-
- return mcnt;
- }
-
- /* Otherwise match next pattern command. */
-#ifdef SWITCH_ENUM_BUG
- switch ((int) ((re_opcode_t) *p++))
-#else
- switch ((re_opcode_t) *p++)
-#endif
- {
- /* Ignore these. Used to ignore the n of succeed_n's which
- currently have n == 0. */
- case no_op:
- DEBUG_PRINT1 ("EXECUTING no_op.\n");
- break;
-
-
- /* Match the next n pattern characters exactly. The following
- byte in the pattern defines n, and the n bytes after that
- are the characters to match. */
- case exactn:
- mcnt = *p++;
- DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt);
-
- /* This is written out as an if-else so we don't waste time
- testing `translate' inside the loop. */
- if (translate)
- {
- do
- {
- PREFETCH ();
- if (translate[(unsigned char) *d++] != (char) *p++)
- goto fail;
- }
- while (--mcnt);
- }
- else
- {
- do
- {
- PREFETCH ();
- if (*d++ != (char) *p++) goto fail;
- }
- while (--mcnt);
- }
- SET_REGS_MATCHED ();
- break;
-
-
- /* Match any character except possibly a newline or a null. */
- case anychar:
- DEBUG_PRINT1 ("EXECUTING anychar.\n");
-
- PREFETCH ();
-
- if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n')
- || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000'))
- goto fail;
-
- SET_REGS_MATCHED ();
- DEBUG_PRINT2 (" Matched `%d'.\n", *d);
- d++;
- break;
-
-
- case charset:
- case charset_not:
- {
- register unsigned char c;
- boolean not = (re_opcode_t) *(p - 1) == charset_not;
-
- DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : "");
-
- PREFETCH ();
- c = TRANSLATE (*d); /* The character to match. */
-
- /* Cast to `unsigned' instead of `unsigned char' in case the
- bit list is a full 32 bytes long. */
- if (c < (unsigned) (*p * BYTEWIDTH)
- && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
-
- p += 1 + *p;
-
- if (!not) goto fail;
-
- SET_REGS_MATCHED ();
- d++;
- break;
- }
-
-
- /* The beginning of a group is represented by start_memory.
- The arguments are the register number in the next byte, and the
- number of groups inner to this one in the next. The text
- matched within the group is recorded (in the internal
- registers data structure) under the register number. */
- case start_memory:
- DEBUG_PRINT3 ("EXECUTING start_memory %d (%d):\n", *p, p[1]);
-
- /* Find out if this group can match the empty string. */
- p1 = p; /* To send to group_match_null_string_p. */
-
- if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE)
- REG_MATCH_NULL_STRING_P (reg_info[*p])
- = group_match_null_string_p (&p1, pend, reg_info);
-
- /* Save the position in the string where we were the last time
- we were at this open-group operator in case the group is
- operated upon by a repetition operator, e.g., with `(a*)*b'
- against `ab'; then we want to ignore where we are now in
- the string in case this attempt to match fails. */
- old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
- ? REG_UNSET (regstart[*p]) ? d : regstart[*p]
- : regstart[*p];
- DEBUG_PRINT2 (" old_regstart: %d\n",
- POINTER_TO_OFFSET (old_regstart[*p]));
-
- regstart[*p] = d;
- DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p]));
-
- IS_ACTIVE (reg_info[*p]) = 1;
- MATCHED_SOMETHING (reg_info[*p]) = 0;
-
- /* This is the new highest active register. */
- highest_active_reg = *p;
-
- /* If nothing was active before, this is the new lowest active
- register. */
- if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
- lowest_active_reg = *p;
-
- /* Move past the register number and inner group count. */
- p += 2;
- break;
-
-
- /* The stop_memory opcode represents the end of a group. Its
- arguments are the same as start_memory's: the register
- number, and the number of inner groups. */
- case stop_memory:
- DEBUG_PRINT3 ("EXECUTING stop_memory %d (%d):\n", *p, p[1]);
-
- /* We need to save the string position the last time we were at
- this close-group operator in case the group is operated
- upon by a repetition operator, e.g., with `((a*)*(b*)*)*'
- against `aba'; then we want to ignore where we are now in
- the string in case this attempt to match fails. */
- old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
- ? REG_UNSET (regend[*p]) ? d : regend[*p]
- : regend[*p];
- DEBUG_PRINT2 (" old_regend: %d\n",
- POINTER_TO_OFFSET (old_regend[*p]));
-
- regend[*p] = d;
- DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p]));
-
- /* This register isn't active anymore. */
- IS_ACTIVE (reg_info[*p]) = 0;
-
- /* If this was the only register active, nothing is active
- anymore. */
- if (lowest_active_reg == highest_active_reg)
- {
- lowest_active_reg = NO_LOWEST_ACTIVE_REG;
- highest_active_reg = NO_HIGHEST_ACTIVE_REG;
- }
- else
- { /* We must scan for the new highest active register, since
- it isn't necessarily one less than now: consider
- (a(b)c(d(e)f)g). When group 3 ends, after the f), the
- new highest active register is 1. */
- unsigned char r = *p - 1;
- while (r > 0 && !IS_ACTIVE (reg_info[r]))
- r--;
-
- /* If we end up at register zero, that means that we saved
- the registers as the result of an `on_failure_jump', not
- a `start_memory', and we jumped to past the innermost
- `stop_memory'. For example, in ((.)*) we save
- registers 1 and 2 as a result of the *, but when we pop
- back to the second ), we are at the stop_memory 1.
- Thus, nothing is active. */
- if (r == 0)
- {
- lowest_active_reg = NO_LOWEST_ACTIVE_REG;
- highest_active_reg = NO_HIGHEST_ACTIVE_REG;
- }
- else
- highest_active_reg = r;
- }
-
- /* If just failed to match something this time around with a
- group that's operated on by a repetition operator, try to
- force exit from the ``loop'', and restore the register
- information for this group that we had before trying this
- last match. */
- if ((!MATCHED_SOMETHING (reg_info[*p])
- || (re_opcode_t) p[-3] == start_memory)
- && (p + 2) < pend)
- {
- boolean is_a_jump_n = false;
-
- p1 = p + 2;
- mcnt = 0;
- switch ((re_opcode_t) *p1++)
- {
- case jump_n:
- is_a_jump_n = true;
- case pop_failure_jump:
- case maybe_pop_jump:
- case jump:
- case dummy_failure_jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- if (is_a_jump_n)
- p1 += 2;
- break;
-
- default:
- /* do nothing */ ;
- }
- p1 += mcnt;
-
- /* If the next operation is a jump backwards in the pattern
- to an on_failure_jump right before the start_memory
- corresponding to this stop_memory, exit from the loop
- by forcing a failure after pushing on the stack the
- on_failure_jump's jump in the pattern, and d. */
- if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump
- && (re_opcode_t) p1[3] == start_memory && p1[4] == *p)
- {
- /* If this group ever matched anything, then restore
- what its registers were before trying this last
- failed match, e.g., with `(a*)*b' against `ab' for
- regstart[1], and, e.g., with `((a*)*(b*)*)*'
- against `aba' for regend[3].
-
- Also restore the registers for inner groups for,
- e.g., `((a*)(b*))*' against `aba' (register 3 would
- otherwise get trashed). */
-
- if (EVER_MATCHED_SOMETHING (reg_info[*p]))
- {
- unsigned r;
-
- EVER_MATCHED_SOMETHING (reg_info[*p]) = 0;
-
- /* Restore this and inner groups' (if any) registers. */
- for (r = *p; r < *p + *(p + 1); r++)
- {
- regstart[r] = old_regstart[r];
-
- /* xx why this test? */
- if ((s_reg_t) old_regend[r] >= (s_reg_t) regstart[r])
- regend[r] = old_regend[r];
- }
- }
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- PUSH_FAILURE_POINT (p1 + mcnt, d, -2);
- PUSH_FAILURE_POINT2(p1 + mcnt, d, -2);
-
- goto fail;
- }
- }
-
- /* Move past the register number and the inner group count. */
- p += 2;
- break;
-
-
- /* \<digit> has been turned into a `duplicate' command which is
- followed by the numeric value of <digit> as the register number. */
- case duplicate:
- {
- register const char *d2, *dend2;
- int regno = *p++; /* Get which register to match against. */
- DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno);
-
- /* Can't back reference a group which we've never matched. */
- if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno]))
- goto fail;
-
- /* Where in input to try to start matching. */
- d2 = regstart[regno];
-
- /* Where to stop matching; if both the place to start and
- the place to stop matching are in the same string, then
- set to the place to stop, otherwise, for now have to use
- the end of the first string. */
-
- dend2 = ((FIRST_STRING_P (regstart[regno])
- == FIRST_STRING_P (regend[regno]))
- ? regend[regno] : end_match_1);
- for (;;)
- {
- /* If necessary, advance to next segment in register
- contents. */
- while (d2 == dend2)
- {
- if (dend2 == end_match_2) break;
- if (dend2 == regend[regno]) break;
-
- /* End of string1 => advance to string2. */
- d2 = string2;
- dend2 = regend[regno];
- }
- /* At end of register contents => success */
- if (d2 == dend2) break;
-
- /* If necessary, advance to next segment in data. */
- PREFETCH ();
-
- /* How many characters left in this segment to match. */
- mcnt = dend - d;
-
- /* Want how many consecutive characters we can match in
- one shot, so, if necessary, adjust the count. */
- if (mcnt > dend2 - d2)
- mcnt = dend2 - d2;
-
- /* Compare that many; failure if mismatch, else move
- past them. */
- if (translate
- ? bcmp_translate (d, d2, mcnt, translate)
- : bcmp (d, d2, mcnt))
- goto fail;
- d += mcnt, d2 += mcnt;
- }
- }
- break;
-
-
- /* begline matches the empty string at the beginning of the string
- (unless `not_bol' is set in `bufp'), and, if
- `newline_anchor' is set, after newlines. */
- case begline:
- DEBUG_PRINT1 ("EXECUTING begline.\n");
-
- if (AT_STRINGS_BEG (d))
- {
- if (!bufp->not_bol) break;
- }
- else if (d[-1] == '\n' && bufp->newline_anchor)
- {
- break;
- }
- /* In all other cases, we fail. */
- goto fail;
-
-
- /* endline is the dual of begline. */
- case endline:
- DEBUG_PRINT1 ("EXECUTING endline.\n");
-
- if (AT_STRINGS_END (d))
- {
- if (!bufp->not_eol) break;
- }
-
- /* We have to ``prefetch'' the next character. */
- else if ((d == end1 ? *string2 : *d) == '\n'
- && bufp->newline_anchor)
- {
- break;
- }
- goto fail;
-
-
- /* Match at the very beginning of the data. */
- case begbuf:
- DEBUG_PRINT1 ("EXECUTING begbuf.\n");
- if (AT_STRINGS_BEG (d))
- break;
- goto fail;
-
-
- /* Match at the very end of the data. */
- case endbuf:
- DEBUG_PRINT1 ("EXECUTING endbuf.\n");
- if (AT_STRINGS_END (d))
- break;
- goto fail;
-
-
- /* on_failure_keep_string_jump is used to optimize `.*\n'. It
- pushes NULL as the value for the string on the stack. Then
- `pop_failure_point' will keep the current value for the
- string, instead of restoring it. To see why, consider
- matching `foo\nbar' against `.*\n'. The .* matches the foo;
- then the . fails against the \n. But the next thing we want
- to do is match the \n against the \n; if we restored the
- string value, we would be back at the foo.
-
- Because this is used only in specific cases, we don't need to
- check all the things that `on_failure_jump' does, to make
- sure the right things get saved on the stack. Hence we don't
- share its code. The only reason to push anything on the
- stack at all is that otherwise we would have to change
- `anychar's code to do something besides goto fail in this
- case; that seems worse than this. */
- case on_failure_keep_string_jump:
- DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump");
-
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt);
-
- PUSH_FAILURE_POINT (p + mcnt, NULL, -2);
- PUSH_FAILURE_POINT2(p + mcnt, NULL, -2);
- break;
-
-
- /* Uses of on_failure_jump:
-
- Each alternative starts with an on_failure_jump that points
- to the beginning of the next alternative. Each alternative
- except the last ends with a jump that in effect jumps past
- the rest of the alternatives. (They really jump to the
- ending jump of the following alternative, because tensioning
- these jumps is a hassle.)
-
- Repeats start with an on_failure_jump that points past both
- the repetition text and either the following jump or
- pop_failure_jump back to this on_failure_jump. */
- case on_failure_jump:
- on_failure:
- DEBUG_PRINT1 ("EXECUTING on_failure_jump");
-
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt);
-
- /* If this on_failure_jump comes right before a group (i.e.,
- the original * applied to a group), save the information
- for that group and all inner ones, so that if we fail back
- to this point, the group's information will be correct.
- For example, in \(a*\)*\1, we need the preceding group,
- and in \(\(a*\)b*\)\2, we need the inner group. */
-
- /* We can't use `p' to check ahead because we push
- a failure point to `p + mcnt' after we do this. */
- p1 = p;
-
- /* We need to skip no_op's before we look for the
- start_memory in case this on_failure_jump is happening as
- the result of a completed succeed_n, as in \(a\)\{1,3\}b\1
- against aba. */
- while (p1 < pend && (re_opcode_t) *p1 == no_op)
- p1++;
-
- if (p1 < pend && (re_opcode_t) *p1 == start_memory)
- {
- /* We have a new highest active register now. This will
- get reset at the start_memory we are about to get to,
- but we will have saved all the registers relevant to
- this repetition op, as described above. */
- highest_active_reg = *(p1 + 1) + *(p1 + 2);
- if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
- lowest_active_reg = *(p1 + 1);
- }
-
- DEBUG_PRINT1 (":\n");
- PUSH_FAILURE_POINT (p + mcnt, d, -2);
- PUSH_FAILURE_POINT2(p + mcnt, d, -2);
- break;
-
-
- /* A smart repeat ends with `maybe_pop_jump'.
- We change it to either `pop_failure_jump' or `jump'. */
- case maybe_pop_jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt);
- {
- register unsigned char *p2 = p;
-
- /* Compare the beginning of the repeat with what in the
- pattern follows its end. If we can establish that there
- is nothing that they would both match, i.e., that we
- would have to backtrack because of (as in, e.g., `a*a')
- then we can change to pop_failure_jump, because we'll
- never have to backtrack.
-
- This is not true in the case of alternatives: in
- `(a|ab)*' we do need to backtrack to the `ab' alternative
- (e.g., if the string was `ab'). But instead of trying to
- detect that here, the alternative has put on a dummy
- failure point which is what we will end up popping. */
-
- /* Skip over open/close-group commands. */
- while (p2 + 2 < pend
- && ((re_opcode_t) *p2 == stop_memory
- || (re_opcode_t) *p2 == start_memory))
- p2 += 3; /* Skip over args, too. */
-
- /* If we're at the end of the pattern, we can change. */
- if (p2 == pend)
- {
- /* Consider what happens when matching ":\(.*\)"
- against ":/". I don't really understand this code
- yet. */
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT1
- (" End of pattern: change to `pop_failure_jump'.\n");
- }
-
- else if ((re_opcode_t) *p2 == exactn
- || (bufp->newline_anchor && (re_opcode_t) *p2 == endline))
- {
- register unsigned char c
- = *p2 == (unsigned char) endline ? '\n' : p2[2];
- p1 = p + mcnt;
-
- /* p1[0] ... p1[2] are the `on_failure_jump' corresponding
- to the `maybe_finalize_jump' of this case. Examine what
- follows. */
- if ((re_opcode_t) p1[3] == exactn && p1[5] != c)
- {
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n",
- c, p1[5]);
- }
-
- else if ((re_opcode_t) p1[3] == charset
- || (re_opcode_t) p1[3] == charset_not)
- {
- int not = (re_opcode_t) p1[3] == charset_not;
-
- if (c < (unsigned char) (p1[4] * BYTEWIDTH)
- && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
-
- /* `not' is equal to 1 if c would match, which means
- that we can't change to pop_failure_jump. */
- if (!not)
- {
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
- }
- }
- }
- }
- p -= 2; /* Point at relative address again. */
- if ((re_opcode_t) p[-1] != pop_failure_jump)
- {
- p[-1] = (unsigned char) jump;
- DEBUG_PRINT1 (" Match => jump.\n");
- goto unconditional_jump;
- }
- /* Note fall through. */
-
-
- /* The end of a simple repeat has a pop_failure_jump back to
- its matching on_failure_jump, where the latter will push a
- failure point. The pop_failure_jump takes off failure
- points put on by this pop_failure_jump's matching
- on_failure_jump; we got through the pattern to here from the
- matching on_failure_jump, so didn't fail. */
- case pop_failure_jump:
- {
- /* We need to pass separate storage for the lowest and
- highest registers, even though we don't care about the
- actual values. Otherwise, we will restore only one
- register from the stack, since lowest will == highest in
- `pop_failure_point'. */
- active_reg_t dummy_low_reg, dummy_high_reg;
- unsigned char *pdummy;
- const char *sdummy;
-
- DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n");
- POP_FAILURE_POINT (sdummy, pdummy,
- dummy_low_reg, dummy_high_reg,
- reg_dummy, reg_dummy, reg_info_dummy);
- }
- /* Note fall through. */
-
-
- /* Unconditionally jump (without popping any failure points). */
- case jump:
- unconditional_jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */
- DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt);
- p += mcnt; /* Do the jump. */
- DEBUG_PRINT2 ("(to 0x%x).\n", p);
- break;
-
-
- /* We need this opcode so we can detect where alternatives end
- in `group_match_null_string_p' et al. */
- case jump_past_alt:
- DEBUG_PRINT1 ("EXECUTING jump_past_alt.\n");
- goto unconditional_jump;
-
-
- /* Normally, the on_failure_jump pushes a failure point, which
- then gets popped at pop_failure_jump. We will end up at
- pop_failure_jump, also, and with a pattern of, say, `a+', we
- are skipping over the on_failure_jump, so we have to push
- something meaningless for pop_failure_jump to pop. */
- case dummy_failure_jump:
- DEBUG_PRINT1 ("EXECUTING dummy_failure_jump.\n");
- /* It doesn't matter what we push for the string here. What
- the code at `fail' tests is the value for the pattern. */
- PUSH_FAILURE_POINT (0, 0, -2);
- PUSH_FAILURE_POINT2(0, 0, -2);
- goto unconditional_jump;
-
-
- /* At the end of an alternative, we need to push a dummy failure
- point in case we are followed by a `pop_failure_jump', because
- we don't want the failure point for the alternative to be
- popped. For example, matching `(a|ab)*' against `aab'
- requires that we match the `ab' alternative. */
- case push_dummy_failure:
- DEBUG_PRINT1 ("EXECUTING push_dummy_failure.\n");
- /* See comments just above at `dummy_failure_jump' about the
- two zeroes. */
- PUSH_FAILURE_POINT (0, 0, -2);
- PUSH_FAILURE_POINT2(0, 0, -2);
- break;
-
- /* Have to succeed matching what follows at least n times.
- After that, handle like `on_failure_jump'. */
- case succeed_n:
- EXTRACT_NUMBER (mcnt, p + 2);
- DEBUG_PRINT2 ("EXECUTING succeed_n %d.\n", mcnt);
-
- assert (mcnt >= 0);
- /* Originally, this is how many times we HAVE to succeed. */
- if (mcnt > 0)
- {
- mcnt--;
- p += 2;
- STORE_NUMBER_AND_INCR (p, mcnt);
- DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p, mcnt);
- }
- else if (mcnt == 0)
- {
- DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n", p+2);
- p[2] = (unsigned char) no_op;
- p[3] = (unsigned char) no_op;
- goto on_failure;
- }
- break;
-
- case jump_n:
- EXTRACT_NUMBER (mcnt, p + 2);
- DEBUG_PRINT2 ("EXECUTING jump_n %d.\n", mcnt);
-
- /* Originally, this is how many times we CAN jump. */
- if (mcnt)
- {
- mcnt--;
- STORE_NUMBER (p + 2, mcnt);
- goto unconditional_jump;
- }
- /* If don't have to jump any more, skip over the rest of command. */
- else
- p += 4;
- break;
-
- case set_number_at:
- {
- DEBUG_PRINT1 ("EXECUTING set_number_at.\n");
-
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- p1 = p + mcnt;
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt);
- STORE_NUMBER (p1, mcnt);
- break;
- }
-
- case wordbound:
- DEBUG_PRINT1 ("EXECUTING wordbound.\n");
- if (AT_WORD_BOUNDARY (d))
- break;
- goto fail;
-
- case notwordbound:
- DEBUG_PRINT1 ("EXECUTING notwordbound.\n");
- if (AT_WORD_BOUNDARY (d))
- goto fail;
- break;
-
- case wordbeg:
- DEBUG_PRINT1 ("EXECUTING wordbeg.\n");
- if (WORDCHAR_P (d) && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1)))
- break;
- goto fail;
-
- case wordend:
- DEBUG_PRINT1 ("EXECUTING wordend.\n");
- if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1)
- && (!WORDCHAR_P (d) || AT_STRINGS_END (d)))
- break;
- goto fail;
-
-#ifdef emacs
-#ifdef emacs19
- case before_dot:
- DEBUG_PRINT1 ("EXECUTING before_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) >= point)
- goto fail;
- break;
-
- case at_dot:
- DEBUG_PRINT1 ("EXECUTING at_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) != point)
- goto fail;
- break;
-
- case after_dot:
- DEBUG_PRINT1 ("EXECUTING after_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) <= point)
- goto fail;
- break;
-#else /* not emacs19 */
- case at_dot:
- DEBUG_PRINT1 ("EXECUTING at_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) + 1 != point)
- goto fail;
- break;
-#endif /* not emacs19 */
-
- case syntaxspec:
- DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt);
- mcnt = *p++;
- goto matchsyntax;
-
- case wordchar:
- DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n");
- mcnt = (int) Sword;
- matchsyntax:
- PREFETCH ();
- if (SYNTAX (*d++) != (enum syntaxcode) mcnt)
- goto fail;
- SET_REGS_MATCHED ();
- break;
-
- case notsyntaxspec:
- DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt);
- mcnt = *p++;
- goto matchnotsyntax;
-
- case notwordchar:
- DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n");
- mcnt = (int) Sword;
- matchnotsyntax:
- PREFETCH ();
- if (SYNTAX (*d++) == (enum syntaxcode) mcnt)
- goto fail;
- SET_REGS_MATCHED ();
- break;
-
-#else /* not emacs */
- case wordchar:
- DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n");
- PREFETCH ();
- if (!WORDCHAR_P (d))
- goto fail;
- SET_REGS_MATCHED ();
- d++;
- break;
-
- case notwordchar:
- DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n");
- PREFETCH ();
- if (WORDCHAR_P (d))
- goto fail;
- SET_REGS_MATCHED ();
- d++;
- break;
-#endif /* not emacs */
-
- default:
- abort ();
- }
- continue; /* Successfully executed one pattern command; keep going. */
-
-
- /* We goto here if a matching operation fails. */
- fail:
- if (!FAIL_STACK_EMPTY ())
- { /* A restart point is known. Restore to that state. */
- DEBUG_PRINT1 ("\nFAIL:\n");
- POP_FAILURE_POINT (d, p,
- lowest_active_reg, highest_active_reg,
- regstart, regend, reg_info);
-
- /* If this failure point is a dummy, try the next one. */
- if (!p)
- goto fail;
-
- /* If we failed to the end of the pattern, don't examine *p. */
- assert (p <= pend);
- if (p < pend)
- {
- boolean is_a_jump_n = false;
-
- /* If failed to a backwards jump that's part of a repetition
- loop, need to pop this failure point and use the next one. */
- switch ((re_opcode_t) *p)
- {
- case jump_n:
- is_a_jump_n = true;
- case maybe_pop_jump:
- case pop_failure_jump:
- case jump:
- p1 = p + 1;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- p1 += mcnt;
-
- if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n)
- || (!is_a_jump_n
- && (re_opcode_t) *p1 == on_failure_jump))
- goto fail;
- break;
- default:
- /* do nothing */ ;
- }
- }
-
- if (d >= string1 && d <= end1)
- dend = end_match_1;
- }
- else
- break; /* Matching at this starting point really fails. */
- } /* for (;;) */
-
- if (best_regs_set)
- goto restore_best_regs;
-
- FREE_VARIABLES ();
-
- return -1; /* Failure to match. */
-} /* re_match_2 */
-
-/* Subroutine definitions for re_match_2. */
-
-
-/* We are passed P pointing to a register number after a start_memory.
-
- Return true if the pattern up to the corresponding stop_memory can
- match the empty string, and false otherwise.
-
- If we find the matching stop_memory, sets P to point to one past its number.
- Otherwise, sets P to an undefined byte less than or equal to END.
-
- We don't handle duplicates properly (yet). */
-
-static boolean
-group_match_null_string_p (p, end, reg_info)
- unsigned char **p, *end;
- register_info_type *reg_info;
-{
- int mcnt;
- /* Point to after the args to the start_memory. */
- unsigned char *p1 = *p + 2;
-
- while (p1 < end)
- {
- /* Skip over opcodes that can match nothing, and return true or
- false, as appropriate, when we get to one that can't, or to the
- matching stop_memory. */
-
- switch ((re_opcode_t) *p1)
- {
- /* Could be either a loop or a series of alternatives. */
- case on_failure_jump:
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-
- /* If the next operation is not a jump backwards in the
- pattern. */
-
- if (mcnt >= 0)
- {
- /* Go through the on_failure_jumps of the alternatives,
- seeing if any of the alternatives cannot match nothing.
- The last alternative starts with only a jump,
- whereas the rest start with on_failure_jump and end
- with a jump, e.g., here is the pattern for `a|b|c':
-
- /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6
- /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3
- /exactn/1/c
-
- So, we have to first go through the first (n-1)
- alternatives and then deal with the last one separately. */
-
-
- /* Deal with the first (n-1) alternatives, which start
- with an on_failure_jump (see above) that jumps to right
- past a jump_past_alt. */
-
- while ((re_opcode_t) p1[mcnt-3] == jump_past_alt)
- {
- /* `mcnt' holds how many bytes long the alternative
- is, including the ending `jump_past_alt' and
- its number. */
-
- if (!alt_match_null_string_p (p1, p1 + mcnt - 3,
- reg_info))
- return false;
-
- /* Move to right after this alternative, including the
- jump_past_alt. */
- p1 += mcnt;
-
- /* Break if it's the beginning of an n-th alternative
- that doesn't begin with an on_failure_jump. */
- if ((re_opcode_t) *p1 != on_failure_jump)
- break;
-
- /* Still have to check that it's not an n-th
- alternative that starts with an on_failure_jump. */
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- if ((re_opcode_t) p1[mcnt-3] != jump_past_alt)
- {
- /* Get to the beginning of the n-th alternative. */
- p1 -= 3;
- break;
- }
- }
-
- /* Deal with the last alternative: go back and get number
- of the `jump_past_alt' just before it. `mcnt' contains
- the length of the alternative. */
- EXTRACT_NUMBER (mcnt, p1 - 2);
-
- if (!alt_match_null_string_p (p1, p1 + mcnt, reg_info))
- return false;
-
- p1 += mcnt; /* Get past the n-th alternative. */
- } /* if mcnt > 0 */
- break;
-
-
- case stop_memory:
- assert (p1[1] == **p);
- *p = p1 + 2;
- return true;
-
-
- default:
- if (!common_op_match_null_string_p (&p1, end, reg_info))
- return false;
- }
- } /* while p1 < end */
-
- return false;
-} /* group_match_null_string_p */
-
-
-/* Similar to group_match_null_string_p, but doesn't deal with alternatives:
- It expects P to be the first byte of a single alternative and END one
- byte past the last. The alternative can contain groups. */
-
-static boolean
-alt_match_null_string_p (p, end, reg_info)
- unsigned char *p, *end;
- register_info_type *reg_info;
-{
- int mcnt;
- unsigned char *p1 = p;
-
- while (p1 < end)
- {
- /* Skip over opcodes that can match nothing, and break when we get
- to one that can't. */
-
- switch ((re_opcode_t) *p1)
- {
- /* It's a loop. */
- case on_failure_jump:
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- p1 += mcnt;
- break;
-
- default:
- if (!common_op_match_null_string_p (&p1, end, reg_info))
- return false;
- }
- } /* while p1 < end */
-
- return true;
-} /* alt_match_null_string_p */
-
-
-/* Deals with the ops common to group_match_null_string_p and
- alt_match_null_string_p.
-
- Sets P to one after the op and its arguments, if any. */
-
-static boolean
-common_op_match_null_string_p (p, end, reg_info)
- unsigned char **p, *end;
- register_info_type *reg_info;
-{
- int mcnt;
- boolean ret;
- int reg_no;
- unsigned char *p1 = *p;
-
- switch ((re_opcode_t) *p1++)
- {
- case no_op:
- case begline:
- case endline:
- case begbuf:
- case endbuf:
- case wordbeg:
- case wordend:
- case wordbound:
- case notwordbound:
-#ifdef emacs
- case before_dot:
- case at_dot:
- case after_dot:
-#endif
- break;
-
- case start_memory:
- reg_no = *p1;
- assert (reg_no > 0 && reg_no <= MAX_REGNUM);
- ret = group_match_null_string_p (&p1, end, reg_info);
-
- /* Have to set this here in case we're checking a group which
- contains a group and a back reference to it. */
-
- if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE)
- REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret;
-
- if (!ret)
- return false;
- break;
-
- /* If this is an optimized succeed_n for zero times, make the jump. */
- case jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- if (mcnt >= 0)
- p1 += mcnt;
- else
- return false;
- break;
-
- case succeed_n:
- /* Get to the number of times to succeed. */
- p1 += 2;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-
- if (mcnt == 0)
- {
- p1 -= 4;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- p1 += mcnt;
- }
- else
- return false;
- break;
-
- case duplicate:
- if (!REG_MATCH_NULL_STRING_P (reg_info[*p1]))
- return false;
- break;
-
- case set_number_at:
- p1 += 4;
-
- default:
- /* All other opcodes mean we cannot match the empty string. */
- return false;
- }
-
- *p = p1;
- return true;
-} /* common_op_match_null_string_p */
-
-
-/* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN
- bytes; nonzero otherwise. */
-
-static int
-bcmp_translate (s1, s2, len, translate)
- const char *s1, *s2;
- register int len;
- char *translate;
-{
- register const unsigned char *p1 = (const unsigned char *) s1,
- *p2 = (const unsigned char *) s2;
- while (len)
- {
- if (translate[*p1++] != translate[*p2++]) return 1;
- len--;
- }
- return 0;
-}
-
-/* Entry points for GNU code. */
-
-/* re_compile_pattern is the GNU regular expression compiler: it
- compiles PATTERN (of length SIZE) and puts the result in BUFP.
- Returns 0 if the pattern was valid, otherwise an error string.
-
- Assumes the `allocated' (and perhaps `buffer') and `translate' fields
- are set in BUFP on entry.
-
- We call regex_compile to do the actual compilation. */
-
-const char *
-re_compile_pattern (pattern, length, bufp)
- const char *pattern;
- size_t length;
- struct re_pattern_buffer *bufp;
-{
- reg_errcode_t ret;
-
- /* GNU code is written to assume at least RE_NREGS registers will be set
- (and at least one extra will be -1). */
- bufp->regs_allocated = REGS_UNALLOCATED;
-
- /* And GNU code determines whether or not to get register information
- by passing null for the REGS argument to re_match, etc., not by
- setting no_sub. */
- bufp->no_sub = 0;
-
- /* Match anchors at newline. */
- bufp->newline_anchor = 1;
-
- ret = regex_compile (pattern, length, re_syntax_options, bufp);
-
- return re_error_msg[(int) ret];
-}
-
-/* Entry points compatible with 4.2 BSD regex library. We don't define
- them if this is an Emacs or POSIX compilation. */
-
-#if !defined (emacs) && !defined (_POSIX_SOURCE)
-
-/* BSD has one and only one pattern buffer. */
-static struct re_pattern_buffer re_comp_buf;
-
-char *
-re_comp (s)
- const char *s;
-{
- reg_errcode_t ret;
-
- if (!s)
- {
- if (!re_comp_buf.buffer)
- return "No previous regular expression";
- return 0;
- }
-
- if (!re_comp_buf.buffer)
- {
- re_comp_buf.buffer = (unsigned char *) malloc (200);
- if (re_comp_buf.buffer == NULL)
- return "Memory exhausted";
- re_comp_buf.allocated = 200;
-
- re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
- if (re_comp_buf.fastmap == NULL)
- return "Memory exhausted";
- }
-
- /* Since `re_exec' always passes NULL for the `regs' argument, we
- don't need to initialize the pattern buffer fields which affect it. */
-
- /* Match anchors at newlines. */
- re_comp_buf.newline_anchor = 1;
-
- ret = regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf);
-
- /* Yes, we're discarding `const' here. */
- return (char *) re_error_msg[(int) ret];
-}
-
-
-int
-re_exec (s)
- const char *s;
-{
- const int len = strlen (s);
- return
- 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0);
-}
-#endif /* not emacs and not _POSIX_SOURCE */
-
-/* POSIX.2 functions. Don't define these for Emacs. */
-
-#ifndef emacs
-
-/* regcomp takes a regular expression as a string and compiles it.
-
- PREG is a regex_t *. We do not expect any fields to be initialized,
- since POSIX says we shouldn't. Thus, we set
-
- `buffer' to the compiled pattern;
- `used' to the length of the compiled pattern;
- `syntax' to RE_SYNTAX_POSIX_EXTENDED if the
- REG_EXTENDED bit in CFLAGS is set; otherwise, to
- RE_SYNTAX_POSIX_BASIC;
- `newline_anchor' to REG_NEWLINE being set in CFLAGS;
- `fastmap' and `fastmap_accurate' to zero;
- `re_nsub' to the number of subexpressions in PATTERN.
-
- PATTERN is the address of the pattern string.
-
- CFLAGS is a series of bits which affect compilation.
-
- If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we
- use POSIX basic syntax.
-
- If REG_NEWLINE is set, then . and [^...] don't match newline.
- Also, regexec will try a match beginning after every newline.
-
- If REG_ICASE is set, then we considers upper- and lowercase
- versions of letters to be equivalent when matching.
-
- If REG_NOSUB is set, then when PREG is passed to regexec, that
- routine will report only success or failure, and nothing about the
- registers.
-
- It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for
- the return codes and their meanings.) */
-
-int
-regcomp (preg, pattern, cflags)
- regex_t *preg;
- const char *pattern;
- int cflags;
-{
- reg_errcode_t ret;
- reg_syntax_t syntax
- = (cflags & REG_EXTENDED) ?
- RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC;
-
- /* regex_compile will allocate the space for the compiled pattern. */
- preg->buffer = 0;
- preg->allocated = 0;
- preg->used = 0;
-
- /* Don't bother to use a fastmap when searching. This simplifies the
- REG_NEWLINE case: if we used a fastmap, we'd have to put all the
- characters after newlines into the fastmap. This way, we just try
- every character. */
- preg->fastmap = 0;
-
- if (cflags & REG_ICASE)
- {
- unsigned i;
-
- preg->translate = (char *) malloc (CHAR_SET_SIZE);
- if (preg->translate == NULL)
- return (int) REG_ESPACE;
-
- /* Map uppercase characters to corresponding lowercase ones. */
- for (i = 0; i < CHAR_SET_SIZE; i++)
- preg->translate[i] = ISUPPER (i) ? tolower (i) : i;
- }
- else
- preg->translate = NULL;
-
- /* If REG_NEWLINE is set, newlines are treated differently. */
- if (cflags & REG_NEWLINE)
- { /* REG_NEWLINE implies neither . nor [^...] match newline. */
- syntax &= ~RE_DOT_NEWLINE;
- syntax |= RE_HAT_LISTS_NOT_NEWLINE;
- /* It also changes the matching behavior. */
- preg->newline_anchor = 1;
- }
- else
- preg->newline_anchor = 0;
-
- preg->no_sub = !!(cflags & REG_NOSUB);
-
- /* POSIX says a null character in the pattern terminates it, so we
- can use strlen here in compiling the pattern. */
- ret = regex_compile (pattern, strlen (pattern), syntax, preg);
-
- /* POSIX doesn't distinguish between an unmatched open-group and an
- unmatched close-group: both are REG_EPAREN. */
- if (ret == REG_ERPAREN) ret = REG_EPAREN;
-
- return (int) ret;
-}
-
-
-/* regexec searches for a given pattern, specified by PREG, in the
- string STRING.
-
- If NMATCH is zero or REG_NOSUB was set in the cflags argument to
- `regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at
- least NMATCH elements, and we set them to the offsets of the
- corresponding matched substrings.
-
- EFLAGS specifies `execution flags' which affect matching: if
- REG_NOTBOL is set, then ^ does not match at the beginning of the
- string; if REG_NOTEOL is set, then $ does not match at the end.
-
- We return 0 if we find a match and REG_NOMATCH if not. */
-
-int
-regexec (preg, string, nmatch, pmatch, eflags)
- const regex_t *preg;
- const char *string;
- size_t nmatch;
- regmatch_t pmatch[];
- int eflags;
-{
- int ret;
- struct re_registers regs;
- regex_t private_preg;
- int len = strlen (string);
- boolean want_reg_info = !preg->no_sub && nmatch > 0;
-
- private_preg = *preg;
-
- private_preg.not_bol = !!(eflags & REG_NOTBOL);
- private_preg.not_eol = !!(eflags & REG_NOTEOL);
-
- /* The user has told us exactly how many registers to return
- information about, via `nmatch'. We have to pass that on to the
- matching routines. */
- private_preg.regs_allocated = REGS_FIXED;
-
- if (want_reg_info)
- {
- regs.num_regs = nmatch;
- regs.start = TALLOC (nmatch, regoff_t);
- regs.end = TALLOC (nmatch, regoff_t);
- if (regs.start == NULL || regs.end == NULL)
- return (int) REG_NOMATCH;
- }
-
- /* Perform the searching operation. */
- ret = re_search (&private_preg, string, len,
- /* start: */ 0, /* range: */ len,
- want_reg_info ? &regs : (struct re_registers *) 0);
-
- /* Copy the register information to the POSIX structure. */
- if (want_reg_info)
- {
- if (ret >= 0)
- {
- unsigned r;
-
- for (r = 0; r < nmatch; r++)
- {
- pmatch[r].rm_so = regs.start[r];
- pmatch[r].rm_eo = regs.end[r];
- }
- }
-
- /* If we needed the temporary register info, free the space now. */
- free (regs.start);
- free (regs.end);
- }
-
- /* We want zero return to mean success, unlike `re_search'. */
- return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH;
-}
-
-
-/* Returns a message corresponding to an error code, ERRCODE, returned
- from either regcomp or regexec. We don't use PREG here. */
-
-size_t
-regerror (errcode, preg, errbuf, errbuf_size)
- int errcode;
- const regex_t *preg;
- char *errbuf;
- size_t errbuf_size;
-{
- const char *msg;
- size_t msg_size;
-
- if (errcode < 0
- || errcode >= (sizeof (re_error_msg) / sizeof (re_error_msg[0])))
- /* Only error codes returned by the rest of the code should be passed
- to this routine. If we are given anything else, or if other regex
- code generates an invalid error code, then the program has a bug.
- Dump core so we can fix it. */
- abort ();
-
- msg = re_error_msg[errcode];
-
- /* POSIX doesn't require that we do anything in this case, but why
- not be nice. */
- if (! msg)
- msg = "Success";
-
- msg_size = strlen (msg) + 1; /* Includes the null. */
-
- if (errbuf_size != 0)
- {
- if (msg_size > errbuf_size)
- {
- strncpy (errbuf, msg, errbuf_size - 1);
- errbuf[errbuf_size - 1] = 0;
- }
- else
- strcpy (errbuf, msg);
- }
-
- return msg_size;
-}
-
-
-/* Free dynamically allocated space used by PREG. */
-
-void
-regfree (preg)
- regex_t *preg;
-{
- if (preg->buffer != NULL)
- free (preg->buffer);
- preg->buffer = NULL;
-
- preg->allocated = 0;
- preg->used = 0;
-
- if (preg->fastmap != NULL)
- free (preg->fastmap);
- preg->fastmap = NULL;
- preg->fastmap_accurate = 0;
-
- if (preg->translate != NULL)
- free (preg->translate);
- preg->translate = NULL;
-}
-
-#endif /* not emacs */
-
-/*
-Local variables:
-make-backup-files: t
-version-control: t
-trim-versions-without-asking: nil
-End:
-*/
diff --git a/gnu/usr.bin/awk/regex.h b/gnu/usr.bin/awk/regex.h
deleted file mode 100644
index 757dbac..0000000
--- a/gnu/usr.bin/awk/regex.h
+++ /dev/null
@@ -1,505 +0,0 @@
-/* Definitions for data structures and routines for the regular
- expression library, version 0.12.
-
- Copyright (C) 1985, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef __REGEXP_LIBRARY_H__
-#define __REGEXP_LIBRARY_H__
-
-/* POSIX says that <sys/types.h> must be included (by the caller) before
- <regex.h>. */
-
-#ifdef VMS
-/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
- should be there. */
-#include <stddef.h>
-#endif
-
-
-/* The following two types have to be signed and unsigned integer type
- wide enough to hold a value of a pointer. For most ANSI compilers
- ptrdiff_t and size_t should be likely OK. Still size of these two
- types is 2 for Microsoft C. Ugh... */
-typedef long s_reg_t;
-typedef unsigned long active_reg_t;
-
-/* The following bits are used to determine the regexp syntax we
- recognize. The set/not-set meanings are chosen so that Emacs syntax
- remains the value 0. The bits are given in alphabetical order, and
- the definitions shifted by one from the previous bit; thus, when we
- add or remove a bit, only one other definition need change. */
-typedef unsigned long reg_syntax_t;
-
-/* If this bit is not set, then \ inside a bracket expression is literal.
- If set, then such a \ quotes the following character. */
-#define RE_BACKSLASH_ESCAPE_IN_LISTS (1L)
-
-/* If this bit is not set, then + and ? are operators, and \+ and \? are
- literals.
- If set, then \+ and \? are operators and + and ? are literals. */
-#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
-
-/* If this bit is set, then character classes are supported. They are:
- [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
- [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
- If not set, then character classes are not supported. */
-#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
-
-/* If this bit is set, then ^ and $ are always anchors (outside bracket
- expressions, of course).
- If this bit is not set, then it depends:
- ^ is an anchor if it is at the beginning of a regular
- expression or after an open-group or an alternation operator;
- $ is an anchor if it is at the end of a regular expression, or
- before a close-group or an alternation operator.
-
- This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
- POSIX draft 11.2 says that * etc. in leading positions is undefined.
- We already implemented a previous draft which made those constructs
- invalid, though, so we haven't changed the code back. */
-#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
-
-/* If this bit is set, then special characters are always special
- regardless of where they are in the pattern.
- If this bit is not set, then special characters are special only in
- some contexts; otherwise they are ordinary. Specifically,
- * + ? and intervals are only special when not after the beginning,
- open-group, or alternation operator. */
-#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
-
-/* If this bit is set, then *, +, ?, and { cannot be first in an re or
- immediately after an alternation or begin-group operator. */
-#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
-
-/* If this bit is set, then . matches newline.
- If not set, then it doesn't. */
-#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
-
-/* If this bit is set, then . doesn't match NUL.
- If not set, then it does. */
-#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
-
-/* If this bit is set, nonmatching lists [^...] do not match newline.
- If not set, they do. */
-#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
-
-/* If this bit is set, either \{...\} or {...} defines an
- interval, depending on RE_NO_BK_BRACES.
- If not set, \{, \}, {, and } are literals. */
-#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
-
-/* If this bit is set, +, ? and | aren't recognized as operators.
- If not set, they are. */
-#define RE_LIMITED_OPS (RE_INTERVALS << 1)
-
-/* If this bit is set, newline is an alternation operator.
- If not set, newline is literal. */
-#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
-
-/* If this bit is set, then `{...}' defines an interval, and \{ and \}
- are literals.
- If not set, then `\{...\}' defines an interval. */
-#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
-
-/* If this bit is set, (...) defines a group, and \( and \) are literals.
- If not set, \(...\) defines a group, and ( and ) are literals. */
-#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
-
-/* If this bit is set, then \<digit> matches <digit>.
- If not set, then \<digit> is a back-reference. */
-#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
-
-/* If this bit is set, then | is an alternation operator, and \| is literal.
- If not set, then \| is an alternation operator, and | is literal. */
-#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
-
-/* If this bit is set, then an ending range point collating higher
- than the starting range point, as in [z-a], is invalid.
- If not set, then when ending range point collates higher than the
- starting range point, the range is ignored. */
-#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
-
-/* If this bit is set, then an unmatched ) is ordinary.
- If not set, then an unmatched ) is invalid. */
-#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
-
-/* If this bit is set, do not process the GNU regex operators.
- IF not set, then the GNU regex operators are recognized. */
-#define RE_NO_GNU_OPS (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
-
-/* This global variable defines the particular regexp syntax to use (for
- some interfaces). When a regexp is compiled, the syntax used is
- stored in the pattern buffer, so changing this does not affect
- already-compiled regexps. */
-extern reg_syntax_t re_syntax_options;
-
-/* Define combinations of the above bits for the standard possibilities.
- (The [[[ comments delimit what gets put into the Texinfo file, so
- don't delete them!) */
-/* [[[begin syntaxes]]] */
-#define RE_SYNTAX_EMACS 0
-
-#define RE_SYNTAX_AWK \
- (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS \
- | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
- | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
-
-#define RE_SYNTAX_GNU_AWK \
- (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)
-
-#define RE_SYNTAX_POSIX_AWK \
- (RE_SYNTAX_GNU_AWK | RE_NO_GNU_OPS)
-
-#define RE_SYNTAX_GREP \
- (RE_BK_PLUS_QM | RE_CHAR_CLASSES \
- | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
- | RE_NEWLINE_ALT)
-
-#define RE_SYNTAX_EGREP \
- (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
- | RE_NEWLINE_ALT | RE_NO_BK_PARENS \
- | RE_NO_BK_VBAR)
-
-#define RE_SYNTAX_POSIX_EGREP \
- (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)
-
-/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
-#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
-
-#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
-
-/* Syntax bits common to both basic and extended POSIX regex syntax. */
-#define _RE_SYNTAX_POSIX_COMMON \
- (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
- | RE_INTERVALS | RE_NO_EMPTY_RANGES)
-
-#define RE_SYNTAX_POSIX_BASIC \
- (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
-
-/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
- RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
- isn't minimal, since other operators, such as \`, aren't disabled. */
-#define RE_SYNTAX_POSIX_MINIMAL_BASIC \
- (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
-
-#define RE_SYNTAX_POSIX_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_VBAR \
- | RE_UNMATCHED_RIGHT_PAREN_ORD)
-
-/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS
- replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added. */
-#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS \
- | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
-/* [[[end syntaxes]]] */
-
-/* Maximum number of duplicates an interval can allow. Some systems
- (erroneously) define this in other header files, but we want our
- value, so remove any previous define. */
-#ifdef RE_DUP_MAX
-#undef RE_DUP_MAX
-#endif
-/* if sizeof(int) == 2, then ((1 << 15) - 1) overflows */
-#define RE_DUP_MAX (0x7fff)
-
-
-/* POSIX `cflags' bits (i.e., information for `regcomp'). */
-
-/* If this bit is set, then use extended regular expression syntax.
- If not set, then use basic regular expression syntax. */
-#define REG_EXTENDED 1
-
-/* If this bit is set, then ignore case when matching.
- If not set, then case is significant. */
-#define REG_ICASE (REG_EXTENDED << 1)
-
-/* If this bit is set, then anchors do not match at newline
- characters in the string.
- If not set, then anchors do match at newlines. */
-#define REG_NEWLINE (REG_ICASE << 1)
-
-/* If this bit is set, then report only success or fail in regexec.
- If not set, then returns differ between not matching and errors. */
-#define REG_NOSUB (REG_NEWLINE << 1)
-
-
-/* POSIX `eflags' bits (i.e., information for regexec). */
-
-/* If this bit is set, then the beginning-of-line operator doesn't match
- the beginning of the string (presumably because it's not the
- beginning of a line).
- If not set, then the beginning-of-line operator does match the
- beginning of the string. */
-#define REG_NOTBOL 1
-
-/* Like REG_NOTBOL, except for the end-of-line. */
-#define REG_NOTEOL (1 << 1)
-
-
-/* If any error codes are removed, changed, or added, update the
- `re_error_msg' table in regex.c. */
-typedef enum
-{
- REG_NOERROR = 0, /* Success. */
- REG_NOMATCH, /* Didn't find a match (for regexec). */
-
- /* POSIX regcomp return error codes. (In the order listed in the
- standard.) */
- REG_BADPAT, /* Invalid pattern. */
- REG_ECOLLATE, /* Not implemented. */
- REG_ECTYPE, /* Invalid character class name. */
- REG_EESCAPE, /* Trailing backslash. */
- REG_ESUBREG, /* Invalid back reference. */
- REG_EBRACK, /* Unmatched left bracket. */
- REG_EPAREN, /* Parenthesis imbalance. */
- REG_EBRACE, /* Unmatched \{. */
- REG_BADBR, /* Invalid contents of \{\}. */
- REG_ERANGE, /* Invalid range end. */
- REG_ESPACE, /* Ran out of memory. */
- REG_BADRPT, /* No preceding re for repetition op. */
-
- /* Error codes we've added. */
- REG_EEND, /* Premature end. */
- REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
- REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
-} reg_errcode_t;
-
-/* This data structure represents a compiled pattern. Before calling
- the pattern compiler, the fields `buffer', `allocated', `fastmap',
- `translate', and `no_sub' can be set. After the pattern has been
- compiled, the `re_nsub' field is available. All other fields are
- private to the regex routines. */
-
-struct re_pattern_buffer
-{
-/* [[[begin pattern_buffer]]] */
- /* Space that holds the compiled pattern. It is declared as
- `unsigned char *' because its elements are
- sometimes used as array indexes. */
- unsigned char *buffer;
-
- /* Number of bytes to which `buffer' points. */
- unsigned long allocated;
-
- /* Number of bytes actually used in `buffer'. */
- unsigned long used;
-
- /* Syntax setting with which the pattern was compiled. */
- reg_syntax_t syntax;
-
- /* Pointer to a fastmap, if any, otherwise zero. re_search uses
- the fastmap, if there is one, to skip over impossible
- starting points for matches. */
- char *fastmap;
-
- /* Either a translate table to apply to all characters before
- comparing them, or zero for no translation. The translation
- is applied to a pattern when it is compiled and to a string
- when it is matched. */
- char *translate;
-
- /* Number of subexpressions found by the compiler. */
- size_t re_nsub;
-
- /* Zero if this pattern cannot match the empty string, one else.
- Well, in truth it's used only in `re_search_2', to see
- whether or not we should use the fastmap, so we don't set
- this absolutely perfectly; see `re_compile_fastmap' (the
- `duplicate' case). */
- unsigned can_be_null : 1;
-
- /* If REGS_UNALLOCATED, allocate space in the `regs' structure
- for `max (RE_NREGS, re_nsub + 1)' groups.
- If REGS_REALLOCATE, reallocate space if necessary.
- If REGS_FIXED, use what's there. */
-#define REGS_UNALLOCATED 0
-#define REGS_REALLOCATE 1
-#define REGS_FIXED 2
- unsigned regs_allocated : 2;
-
- /* Set to zero when `regex_compile' compiles a pattern; set to one
- by `re_compile_fastmap' if it updates the fastmap. */
- unsigned fastmap_accurate : 1;
-
- /* If set, `re_match_2' does not return information about
- subexpressions. */
- unsigned no_sub : 1;
-
- /* If set, a beginning-of-line anchor doesn't match at the
- beginning of the string. */
- unsigned not_bol : 1;
-
- /* Similarly for an end-of-line anchor. */
- unsigned not_eol : 1;
-
- /* If true, an anchor at a newline matches. */
- unsigned newline_anchor : 1;
-
-/* [[[end pattern_buffer]]] */
-};
-
-typedef struct re_pattern_buffer regex_t;
-
-
-/* search.c (search_buffer) in Emacs needs this one opcode value. It is
- defined both in `regex.c' and here. */
-#define RE_EXACTN_VALUE 1
-
-/* Type for byte offsets within the string. POSIX mandates this. */
-typedef int regoff_t;
-
-
-/* This is the structure we store register match data in. See
- regex.texinfo for a full description of what registers match. */
-struct re_registers
-{
- unsigned num_regs;
- regoff_t *start;
- regoff_t *end;
-};
-
-
-/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
- `re_match_2' returns information about at least this many registers
- the first time a `regs' structure is passed. */
-#ifndef RE_NREGS
-#define RE_NREGS 30
-#endif
-
-
-/* POSIX specification for registers. Aside from the different names than
- `re_registers', POSIX uses an array of structures, instead of a
- structure of arrays. */
-typedef struct
-{
- regoff_t rm_so; /* Byte offset from string's start to substring's start. */
- regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
-} regmatch_t;
-
-/* Declarations for routines. */
-
-/* To avoid duplicating every routine declaration -- once with a
- prototype (if we are ANSI), and once without (if we aren't) -- we
- use the following macro to declare argument types. This
- unfortunately clutters up the declarations a bit, but I think it's
- worth it. */
-
-#ifdef __STDC__
-
-#define _RE_ARGS(args) args
-
-#else /* not __STDC__ */
-
-#define _RE_ARGS(args) ()
-
-#endif /* not __STDC__ */
-
-/* Sets the current default syntax to SYNTAX, and return the old syntax.
- You can also simply assign to the `re_syntax_options' variable. */
-extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
-
-/* Compile the regular expression PATTERN, with length LENGTH
- and syntax given by the global `re_syntax_options', into the buffer
- BUFFER. Return NULL if successful, and an error string if not. */
-extern const char *re_compile_pattern
- _RE_ARGS ((const char *pattern, size_t length,
- struct re_pattern_buffer *buffer));
-
-
-/* Compile a fastmap for the compiled pattern in BUFFER; used to
- accelerate searches. Return 0 if successful and -2 if was an
- internal error. */
-extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
-
-
-/* Search in the string STRING (with length LENGTH) for the pattern
- compiled into BUFFER. Start searching at position START, for RANGE
- characters. Return the starting position of the match, -1 for no
- match, or -2 for an internal error. Also return register
- information in REGS (if REGS and BUFFER->no_sub are nonzero). */
-extern int re_search
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
- int length, int start, int range, struct re_registers *regs));
-
-
-/* Like `re_search', but search in the concatenation of STRING1 and
- STRING2. Also, stop searching at index START + STOP. */
-extern int re_search_2
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
- int length1, const char *string2, int length2,
- int start, int range, struct re_registers *regs, int stop));
-
-
-/* Like `re_search', but return how many characters in STRING the regexp
- in BUFFER matched, starting at position START. */
-extern int re_match
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
- int length, int start, struct re_registers *regs));
-
-
-/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
-extern int re_match_2
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
- int length1, const char *string2, int length2,
- int start, struct re_registers *regs, int stop));
-
-
-/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
- ENDS. Subsequent matches using BUFFER and REGS will use this memory
- for recording register information. STARTS and ENDS must be
- allocated with malloc, and must each be at least `NUM_REGS * sizeof
- (regoff_t)' bytes long.
-
- If NUM_REGS == 0, then subsequent matches should allocate their own
- register data.
-
- Unless this function is called, the first search or match using
- PATTERN_BUFFER will allocate its own register data, without
- freeing the old data. */
-extern void re_set_registers
- _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
- unsigned num_regs, regoff_t *starts, regoff_t *ends));
-
-/* 4.2 bsd compatibility. */
-extern char *re_comp _RE_ARGS ((const char *));
-extern int re_exec _RE_ARGS ((const char *));
-
-/* POSIX compatibility. */
-extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags));
-extern int regexec
- _RE_ARGS ((const regex_t *preg, const char *string, size_t nmatch,
- regmatch_t pmatch[], int eflags));
-extern size_t regerror
- _RE_ARGS ((int errcode, const regex_t *preg, char *errbuf,
- size_t errbuf_size));
-extern void regfree _RE_ARGS ((regex_t *preg));
-
-#endif /* not __REGEXP_LIBRARY_H__ */
-
-/*
-Local variables:
-make-backup-files: t
-version-control: t
-trim-versions-without-asking: nil
-End:
-*/
diff --git a/gnu/usr.bin/cpio/mt.1 b/gnu/usr.bin/cpio/mt.1
deleted file mode 100644
index fc9cb64..0000000
--- a/gnu/usr.bin/cpio/mt.1
+++ /dev/null
@@ -1,107 +0,0 @@
-.TH MT 1L \" -*- nroff -*-
-.SH NAME
-mt \- control magnetic tape drive operation
-.SH SYNOPSIS
-.B mt
-[\-V] [\-f device] [\-\-file=device] [\-\-version]
-operation [count]
-.SH DESCRIPTION
-This manual page
-documents the GNU version of
-.BR mt .
-.B mt
-performs the given
-.IR operation ,
-which must be one of the tape operations listed below, on a tape
-drive.
-.PP
-The default tape device to operate on is taken from the file
-.I /usr/include/sys/mtio.h
-when
-.B mt
-is compiled. It can be overridden by giving a device file name in
-the environment variable
-.BR TAPE
-or by a command line option (see below), which also overrides the
-environment variable.
-.PP
-The device must be either a character special file or a
-remote tape drive. To use a tape drive on another machine as the
-archive, use a filename that starts with `HOSTNAME:'. The
-hostname can be preceded by a username and an `@' to access the remote
-tape drive as that user, if you have permission to do so (typically an
-entry in that user's `~/.rhosts' file).
-.PP
-The available operations are listed below. Unique abbreviations are
-accepted. Not all operations are available on all systems, or work on
-all types of tape drives.
-Some operations optionally take a repeat count, which can be given
-after the operation name and defaults to 1.
-.IP "eof, weof"
-Write
-.I count
-EOF marks at current position.
-.IP fsf
-Forward space
-.I count
-files.
-The tape is positioned on the first block of the next file.
-.IP bsf
-Backward space
-.I count
-files.
-The tape is positioned on the first block of the next file.
-.IP fsr
-Forward space
-.I count
-records.
-.IP bsr
-Backward space
-.I count
-records.
-.IP bsfm
-Backward space
-.I count
-file marks.
-The tape is positioned on the beginning-of-the-tape side of
-the file mark.
-.IP asf
-Absolute space to file number
-.IR count .
-Equivalent to rewind followed by fsf
-.IR count .
-.IP eom
-Space to the end of the recorded media on the tape
-(for appending files onto tapes).
-.IP rewind
-Rewind the tape.
-.IP "offline, rewoffl"
-Rewind the tape and, if applicable, unload the tape.
-.IP status
-Print status information about the tape unit.
-.IP retension
-Rewind the tape, then wind it to the end of the reel,
-then rewind it again.
-.IP erase
-Erase the tape.
-.PP
-.B mt
-exits with a status of 0 if the operation succeeded, 1 if the
-operation or device name given was invalid, or 2 if the operation
-failed.
-.SS OPTIONS
-.TP
-.I "\-f, \-\-file=device"
-Use
-.I device
-as the file name of the tape drive to operate on.
-To use a
-tape drive on another machine, use a filename that
-starts with `HOSTNAME:'. The hostname can be preceded by a
-username and an `@' to access the remote tape drive as that user, if
-you have permission to do so (typically an entry in that user's
-`~/.rhosts' file).
-.TP
-.I "\-V, \-\-version"
-Print the version number of
-.BR mt .
diff --git a/gnu/usr.bin/cpio/rmt.c b/gnu/usr.bin/cpio/rmt.c
deleted file mode 100644
index 442a831..0000000
--- a/gnu/usr.bin/cpio/rmt.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1983 Regents of the University of California.\n\
- All rights reserved.\n";
-#endif /* not lint */
-
-/*
- * rmt
- */
-#include <stdio.h>
-#include <sgtty.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#ifdef HAVE_SYS_GENTAPE_H /* e.g., ISC UNIX */
-#include <sys/gentape.h>
-#else
-#include <sys/mtio.h>
-#endif
-#include <errno.h>
-
-#if defined (_I386) && defined (_AIX)
-#include <fcntl.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#else
-long lseek ();
-#endif
-
-#ifdef STDC_HEADERS
-#include <string.h>
-#include <stdlib.h>
-#else
-extern char *malloc ();
-#endif
-
-int tape = -1;
-
-char *record;
-int maxrecsize = -1;
-char *checkbuf ();
-void getstring ();
-void error ();
-
-#define SSIZE 64
-char device[SSIZE];
-char count[SSIZE], mode[SSIZE], pos[SSIZE], op[SSIZE];
-
-extern errno;
-extern char *sys_errlist[];
-char resp[BUFSIZ];
-
-FILE *debug;
-#define DEBUG(f) if (debug) fprintf(debug, f)
-#define DEBUG1(f,a) if (debug) fprintf(debug, f, a)
-#define DEBUG2(f,a1,a2) if (debug) fprintf(debug, f, a1, a2)
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int rval;
- char c;
- int n, i, cc;
-
- argc--, argv++;
- if (argc > 0)
- {
- debug = fopen (*argv, "w");
- if (debug == 0)
- exit (1);
- (void) setbuf (debug, (char *) 0);
- }
-top:
- errno = 0;
- rval = 0;
- if (read (0, &c, 1) != 1)
- exit (0);
- switch (c)
- {
-
- case 'O':
- if (tape >= 0)
- (void) close (tape);
- getstring (device);
- getstring (mode);
- DEBUG2 ("rmtd: O %s %s\n", device, mode);
-#if defined (i386) && defined (AIX)
- /* This is alleged to fix a byte ordering problem. */
- /* I'm quite suspicious if it's right. -- mib */
- {
- int oflag = atoi (mode);
- int nflag = 0;
- if ((oflag & 3) == 0)
- nflag |= O_RDONLY;
- if (oflag & 1)
- nflag |= O_WRONLY;
- if (oflag & 2)
- nflag |= O_RDWR;
- if (oflag & 0x0008)
- nflag |= O_APPEND;
- if (oflag & 0x0200)
- nflag |= O_CREAT;
- if (oflag & 0x0400)
- nflag |= O_TRUNC;
- if (oflag & 0x0800)
- nflag |= O_EXCL;
- tape = open (device, nflag, 0666);
- }
-#else
- tape = open (device, atoi (mode), 0666);
-#endif
- if (tape < 0)
- goto ioerror;
- goto respond;
-
- case 'C':
- DEBUG ("rmtd: C\n");
- getstring (device); /* discard */
- if (close (tape) < 0)
- goto ioerror;
- tape = -1;
- goto respond;
-
- case 'L':
- getstring (count);
- getstring (pos);
- DEBUG2 ("rmtd: L %s %s\n", count, pos);
- rval = lseek (tape, (long) atoi (count), atoi (pos));
- if (rval < 0)
- goto ioerror;
- goto respond;
-
- case 'W':
- getstring (count);
- n = atoi (count);
- DEBUG1 ("rmtd: W %s\n", count);
- record = checkbuf (record, n);
- for (i = 0; i < n; i += cc)
- {
- cc = read (0, &record[i], n - i);
- if (cc <= 0)
- {
- DEBUG ("rmtd: premature eof\n");
- exit (2);
- }
- }
- rval = write (tape, record, n);
- if (rval < 0)
- goto ioerror;
- goto respond;
-
- case 'R':
- getstring (count);
- DEBUG1 ("rmtd: R %s\n", count);
- n = atoi (count);
- record = checkbuf (record, n);
- rval = read (tape, record, n);
- if (rval < 0)
- goto ioerror;
- (void) sprintf (resp, "A%d\n", rval);
- (void) write (1, resp, strlen (resp));
- (void) write (1, record, rval);
- goto top;
-
- case 'I':
- getstring (op);
- getstring (count);
- DEBUG2 ("rmtd: I %s %s\n", op, count);
-#ifdef MTIOCTOP
- {
- struct mtop mtop;
- mtop.mt_op = atoi (op);
- mtop.mt_count = atoi (count);
- if (ioctl (tape, MTIOCTOP, (char *) &mtop) < 0)
- goto ioerror;
- rval = mtop.mt_count;
- }
-#endif
- goto respond;
-
- case 'S': /* status */
- DEBUG ("rmtd: S\n");
- {
-#ifdef MTIOCGET
- struct mtget mtget;
- if (ioctl (tape, MTIOCGET, (char *) &mtget) < 0)
- goto ioerror;
- rval = sizeof (mtget);
- (void) sprintf (resp, "A%d\n", rval);
- (void) write (1, resp, strlen (resp));
- (void) write (1, (char *) &mtget, sizeof (mtget));
-#endif
- goto top;
- }
-
- default:
- DEBUG1 ("rmtd: garbage command %c\n", c);
- exit (3);
- }
-respond:
- DEBUG1 ("rmtd: A %d\n", rval);
- (void) sprintf (resp, "A%d\n", rval);
- (void) write (1, resp, strlen (resp));
- goto top;
-ioerror:
- error (errno);
- goto top;
-}
-
-void
-getstring (bp)
- char *bp;
-{
- int i;
- char *cp = bp;
-
- for (i = 0; i < SSIZE; i++)
- {
- if (read (0, cp + i, 1) != 1)
- exit (0);
- if (cp[i] == '\n')
- break;
- }
- cp[i] = '\0';
-}
-
-char *
-checkbuf (record, size)
- char *record;
- int size;
-{
- if (size <= maxrecsize)
- return (record);
- if (record != 0)
- free (record);
- record = malloc (size);
- if (record == 0)
- {
- DEBUG ("rmtd: cannot allocate buffer space\n");
- exit (4);
- }
- maxrecsize = size;
-#ifdef SO_RCVBUF
- while (size > 1024 &&
- setsockopt (0, SOL_SOCKET, SO_RCVBUF, (char *) &size, sizeof (size)) < 0)
- size -= 1024;
-#else
- size = 1 + ((size - 1) % 1024);
-#endif
- return (record);
-}
-
-void
-error (num)
- int num;
-{
-
- DEBUG2 ("rmtd: E %d (%s)\n", num, sys_errlist[num]);
- (void) sprintf (resp, "E%d\n%s\n", num, sys_errlist[num]);
- (void) write (1, resp, strlen (resp));
-}
diff --git a/gnu/usr.bin/cvs/lib/regex.h b/gnu/usr.bin/cvs/lib/regex.h
deleted file mode 100644
index 546b8a9..0000000
--- a/gnu/usr.bin/cvs/lib/regex.h
+++ /dev/null
@@ -1,479 +0,0 @@
-/* Definitions for data structures and routines for the regular
- expression library, version REPLACE-WITH-VERSION.
-
- Copyright (C) 1985, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef __REGEXP_LIBRARY_H__
-#define __REGEXP_LIBRARY_H__
-
-/* POSIX says that <sys/types.h> must be included before <regex.h>. */
-
-/* The following bits are used to determine the regexp syntax we
- recognize. The set/not-set meanings are chosen so that Emacs syntax
- remains the value 0. The bits are given in alphabetical order, and
- the definitions shifted by one from the previous bit; thus, when we
- add or remove a bit, only one other definition need change. */
-typedef unsigned reg_syntax_t;
-
-/* If this bit is not set, then \ inside a bracket expression is literal.
- If set, then such a \ quotes the following character. */
-#define RE_BACKSLASH_ESCAPE_IN_LISTS (1)
-
-/* If this bit is not set, then + and ? are operators, and \+ and \? are
- literals.
- If set, then \+ and \? are operators and + and ? are literals. */
-#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
-
-/* If this bit is set, then character classes are supported. They are:
- [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
- [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
- If not set, then character classes are not supported. */
-#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
-
-/* If this bit is set, then ^ and $ are always anchors (outside bracket
- expressions).
- If this bit is not set, then it depends:
- ^ is an anchor if it is at the beginning of a regular
- expression or after an open-group or an alternation operator;
- $ is an anchor if it is at the end of a regular expression, or
- before a close-group or an alternation operator.
- This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
- POSIX now says that the behavior of * etc. in leading positions is
- undefined. We have already implemented a previous draft which
- made those constructs invalid, so we may as well not change the code
- back. */
-#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
-
-/* If this bit is set, then special characters are always special
- regardless of where they are in the pattern.
- If this bit is not set, then special characters are special only in
- some contexts; otherwise they are ordinary. Specifically,
- * + ? and intervals are only special when not after the beginning,
- open-group, or alternation operator. */
-#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
-
-/* If this bit is set, then *, +, ?, and { cannot be first in an re or
- immediately after an alternation or begin-group operator.
- Furthermore, alternation cannot be first or last in an re, or
- immediately follow another alternation or begin-group. */
-#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
-
-/* If this bit is set, then . matches a newline.
- If not set, then it doesn't. */
-#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
-
-/* If this bit is set, then period doesn't match a null.
- If not set, then it does. */
-#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
-
-/* If this bit is set, nonmatching lists [^...] do not match newline.
- If not set, they do. */
-#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
-
-/* If this bit is set, either \{...\} or {...} defines an
- interval, depending on RE_NO_BK_BRACES.
- If not set, \{, \}, {, and } are literals. */
-#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
-
-/* If this bit is set, +, ? and | aren't recognized as operators.
- If not set, they are. */
-#define RE_LIMITED_OPS (RE_INTERVALS << 1)
-
-/* If this bit is set, newline is an alternation operator.
- If not set, newline is literal. */
-#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
-
-/* If this bit is set, newline in the pattern is an ordinary character.
- If not set, newline before ^ or after $ allows the ^ or $ to be an
- anchor. */
-#define RE_NEWLINE_ORDINARY (RE_NEWLINE_ALT << 1)
-
-/* If this bit is not set, then \{ and \} defines an interval,
- and { and } are literals.
- If set, then { and } defines an interval, and \{ and \} are literals. */
-#define RE_NO_BK_BRACES (RE_NEWLINE_ORDINARY << 1)
-
-/* If this bit is set, (...) defines a group, and \( and \) are literals.
- If not set, \(...\) defines a group, and ( and ) are literals. */
-#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
-
-/* If this bit is set, then back references (i.e., \<digit>) are not
- recognized.
- If not set, then they are. */
-#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
-
-/* If this bit is set, then | is an alternation operator, and \| is literal.
- If not set, then \| is an alternation operator, and | is literal. */
-#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
-
-/* If this bit is set, then you can't have empty alternatives.
- If not set, then you can. */
-#define RE_NO_EMPTY_ALTS (RE_NO_BK_VBAR << 1)
-
-/* If this bit is set, then you can't have empty groups.
- If not set, then you can. */
-#define RE_NO_EMPTY_GROUPS (RE_NO_EMPTY_ALTS << 1)
-
-/* If this bit is set, then an ending range point has to collate higher
- than or equal to the starting range point.
- If not set, then when the ending range point collates higher than the
- starting range point, we consider such a range to be empty. */
-#define RE_NO_EMPTY_RANGES (RE_NO_EMPTY_GROUPS << 1)
-
-/* If this bit is set, then all back references must refer to a preceding
- subexpression.
- If not set, then a back reference to a nonexistent subexpression is
- treated as literal characters. */
-#define RE_NO_MISSING_BK_REF (RE_NO_EMPTY_RANGES << 1)
-
-/* If this bit is set, then Regex considers an unmatched close-group
- operator to be the ordinary character parenthesis.
- If not set, then an unmatched close-group operator is invalid. */
-#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_MISSING_BK_REF << 1)
-
-/* This global variable defines the particular regexp syntax to use (for
- some interfaces). When a regexp is compiled, the syntax used is
- stored in the pattern buffer, so changing this does not affect
- already-compiled regexps. */
-extern reg_syntax_t obscure_syntax;
-
-
-
-/* Define combinations of the above bits for the standard possibilities.
- (The [[[ comments delimit what gets put into the Texinfo file.) */
-/* [[[begin syntaxes]]] */
-#define RE_SYNTAX_EMACS 0
-
-#define RE_SYNTAX_POSIX_AWK \
- (RE_CONTEXT_INDEP_ANCHORS | RE_CONTEXT_INDEP_OPS | RE_NO_BK_PARENS \
- | RE_NO_BK_VBAR)
-
-#define RE_SYNTAX_AWK \
- (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_SYNTAX_POSIX_AWK)
-
-#define RE_SYNTAX_GREP \
- (RE_BK_PLUS_QM | RE_NEWLINE_ALT)
-
-#define RE_SYNTAX_EGREP \
- (RE_CONTEXT_INDEP_ANCHORS | RE_CONTEXT_INDEP_OPS \
- | RE_NEWLINE_ALT | RE_NO_BK_PARENS | RE_NO_BK_VBAR)
-
-#define RE_SYNTAX_POSIX_BASIC \
- (RE_CHAR_CLASSES | RE_DOT_NEWLINE \
- | RE_DOT_NOT_NULL | RE_INTERVALS | RE_LIMITED_OPS \
- | RE_NEWLINE_ORDINARY | RE_NO_EMPTY_RANGES | RE_NO_MISSING_BK_REF)
-
-#define RE_SYNTAX_POSIX_EXTENDED \
- (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INVALID_OPS | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
- | RE_INTERVALS | RE_NEWLINE_ORDINARY | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS | RE_NO_BK_VBAR \
- | RE_NO_EMPTY_ALTS | RE_NO_EMPTY_GROUPS | RE_NO_EMPTY_RANGES \
- | RE_UNMATCHED_RIGHT_PAREN_ORD)
-/* [[[end syntaxes]]] */
-
-
-
-
-/* Maximum number of duplicates an interval can allow. */
-#undef RE_DUP_MAX
-#define RE_DUP_MAX ((1 << 15) - 1)
-
-
-/* POSIX `cflags' bits (i.e., information for regcomp). */
-
-/* If this bit is set, then use extended regular expression syntax.
- If not set, then use basic regular expression syntax. */
-#define REG_EXTENDED 1
-
-/* If this bit is set, then ignore case when matching.
- If not set, then case is significant. */
-#define REG_ICASE (REG_EXTENDED << 1)
-
-/* If this bit is set, then anchors do not match at newline
- characters in the string.
- If not set, then anchors do match at newlines. */
-#define REG_NEWLINE (REG_ICASE << 1)
-
-/* If this bit is set, then report only success or fail in regexec.
- If not set, then returns differ between not matching and errors. */
-#define REG_NOSUB (REG_NEWLINE << 1)
-
-
-/* POSIX `eflags' bits (i.e., information for regexec). */
-
-/* If this bit is set, then the beginning-of-line operator doesn't match
- the beginning of the string (presumably because it's not the
- beginning of a line).
- If not set, then the beginning-of-line operator does match the
- beginning of the string. */
-#define REG_NOTBOL 1
-
-/* Like REG_NOTBOL, except for the end-of-line. */
-#define REG_NOTEOL (1 << 1)
-
-
-/* If any error codes are removed, changed, or added, update the
- `re_error_msg' table in regex.c. */
-typedef enum
-{
- REG_NOERROR = 0, /* Success. */
- REG_NOMATCH, /* Didn't find a match (for regexec). */
-
- /* POSIX regcomp return error codes. (In the order listed in the
- standard.) */
- REG_BADPAT, /* Invalid pattern. */
- REG_ECOLLATE, /* Not implemented. */
- REG_ECTYPE, /* Invalid character class name. */
- REG_EESCAPE, /* Trailing backslash. */
- REG_ESUBREG, /* Invalid back reference. */
- REG_EBRACK, /* Unmatched left bracket. */
- REG_EPAREN, /* Parenthesis imbalance. */
- REG_EBRACE, /* Unmatched \{. */
- REG_BADBR, /* Invalid contents of \{\}. */
- REG_ERANGE, /* Invalid range end. */
- REG_ESPACE, /* Ran out of memory. */
- REG_BADRPT, /* No preceding re for repetition op. */
-
- /* Error codes we've added. */
- REG_EEND, /* Premature end. */
- REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
- REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
-} reg_errcode_t;
-
-
-
-
-/* This data structure represents a compiled pattern. Before calling
- the pattern compiler, the fields `buffer', `allocated', `fastmap',
- `translate', and `no_sub' can be set. After the pattern has been
- compiled, the `re_nsub' field is available. All other fields are
- private to the regex routines. */
-
-struct re_pattern_buffer
-{
-/* [[[begin pattern_buffer]]] */
- /* Space that holds the compiled pattern. It is declared as
- `unsigned char *' because its elements are
- sometimes used as array indexes. */
- unsigned char *buffer;
-
- /* Number of bytes to which `buffer' points. */
- unsigned long allocated;
-
- /* Number of bytes actually used in `buffer'. */
- unsigned long used;
-
- /* Syntax setting with which the pattern was compiled. */
- reg_syntax_t syntax;
-
- /* Pointer to a fastmap, if any, otherwise zero. re_search uses
- the fastmap, if there is one, to skip over impossible
- starting points for matches. */
- char *fastmap;
-
- /* Either a translate table to apply to all characters before
- comparing them, or zero for no translation. The translation
- is applied to a pattern when it is compiled and to a string
- when it is matched. */
- char *translate;
-
- /* Number of subexpressions found by the compiler. */
- size_t re_nsub;
-
- /* Set to 1 by re_compile_fastmap if this pattern can match the
- null string; 0 prevents the searcher from matching it with
- the null string. Set to 2 if it might match the null string
- either at the end of a search range or just before a
- character listed in the fastmap. */
- unsigned can_be_null : 2;
-
- /* Set to zero when regex_compile compiles a pattern; set to one
- by re_compile_fastmap when it updates the fastmap, if any. */
- unsigned fastmap_accurate : 1;
-
- /* If set, regexec reports only success or failure and does not
- return anything in pmatch. */
- unsigned no_sub : 1;
-
- /* If set, a beginning-of-line anchor doesn't match at the
- beginning of the string. */
- unsigned not_bol : 1;
-
- /* Similarly for an end-of-line anchor. */
- unsigned not_eol : 1;
-
- /* If true, an anchor at a newline matches. */
- unsigned newline_anchor : 1;
-
- /* If set, re_match_2 assumes a non-null REGS argument is
- initialized. If not set, REGS is initialized to the max of
- RE_NREGS and re_nsub + 1 registers. */
- unsigned caller_allocated_regs : 1;
-/* [[[end pattern_buffer]]] */
-};
-
-typedef struct re_pattern_buffer regex_t;
-
-
-/* search.c (search_buffer) in Emacs needs this one opcode value. It is
- defined both in `regex.c' and here. */
-#define RE_EXACTN_VALUE 1
-
-
-
-
-/* Type for byte offsets within the string. POSIX mandates us defining
- this. */
-typedef int regoff_t;
-
-
-/* This is the structure we store register match data in. See
- regex.texinfo for a full description of what registers match. */
-struct re_registers
-{
- unsigned num_regs;
- regoff_t *start;
- regoff_t *end;
-};
-
-
-/* If `caller_allocated_regs' is zero in the pattern buffer, re_match_2
- returns information about this many registers. */
-#ifndef RE_NREGS
-#define RE_NREGS 30
-#endif
-
-
-/* POSIX specification for registers. Aside from the different names than
- `re_registers', POSIX uses an array of structures, instead of a
- structure of arrays. */
-typedef struct
-{
- regoff_t rm_so; /* Byte offset from string's start to substring's start. */
- regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
-} regmatch_t;
-
-
-
-
-/* Declarations for routines. */
-
-#if __STDC__
-
-/* Sets the current syntax to SYNTAX. You can also simply assign to the
- `obscure_syntax' variable. */
-extern reg_syntax_t re_set_syntax (reg_syntax_t syntax);
-
-/* Compile the regular expression PATTERN, with length LENGTH
- and syntax given by the global `obscure_syntax', into the buffer
- BUFFER. Return NULL if successful, and an error string if not. */
-extern const char *re_compile_pattern (const char *pattern, int length,
- struct re_pattern_buffer *buffer);
-
-
-/* Compile a fastmap for the compiled pattern in BUFFER; used to
- accelerate searches. Return 0 if successful and -2 if was an
- internal error. */
-extern int re_compile_fastmap (struct re_pattern_buffer *buffer);
-
-
-/* Search in the string STRING (with length LENGTH) for the pattern
- compiled into BUFFER. Start searching at position START, for RANGE
- characters. Return the starting position of the match, -1 for no
- match, or -2 for an internal error. Also return register
- information in REGS (if REGS and BUFFER->no_sub are nonzero). */
-extern int re_search (struct re_pattern_buffer *buffer,
- const char *string, int length,
- int start, int range,
- struct re_registers *regs);
-
-
-/* Like `re_search', but search in the concatenation of STRING1 and
- STRING2. Also, stop searching at index START + STOP. */
-extern int re_search_2 (struct re_pattern_buffer *buffer,
- const char *string1, int length1,
- const char *string2, int length2,
- int start, int range,
- struct re_registers *regs,
- int stop);
-
-
-/* Like `re_search', but return how many characters in STRING the regexp
- in BUFFER matched, starting at position START. */
-extern int re_match (const struct re_pattern_buffer *buffer,
- const char *string, int length,
- int start, struct re_registers *regs);
-
-
-/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
-extern int re_match_2 (const struct re_pattern_buffer *buffer,
- const char *string1, int length1,
- const char *string2, int length2,
- int start,
- struct re_registers *regs,
- int stop);
-
-
-#ifndef __FreeBSD__
-/* 4.2 bsd compatibility. */
-#ifndef bsdi
-extern const char *re_comp (const char *);
-#endif
-extern int re_exec (const char *);
-#endif
-
-/* POSIX compatibility. */
-extern int regcomp (regex_t *preg, const char *pattern, int cflags);
-extern int regexec (const regex_t *preg, const char *string, size_t nmatch,
- regmatch_t pmatch[], int eflags);
-extern size_t regerror (int errcode, const regex_t *preg, char *errbuf,
- size_t errbuf_size);
-extern void regfree (regex_t *preg);
-
-#else /* not __STDC__ */
-
-/* Support old C compilers. */
-#define const
-
-extern reg_syntax_t re_set_syntax ();
-extern char *re_compile_pattern ();
-extern int re_search (), re_search_2 ();
-extern int re_match (), re_match_2 ();
-
-/* 4.2 BSD compatibility. */
-extern char *re_comp ();
-extern int re_exec ();
-
-/* POSIX compatibility. */
-extern int regcomp ();
-extern int regexec ();
-extern size_t regerror ();
-extern void regfree ();
-
-#endif /* not __STDC__ */
-#endif /* not __REGEXP_LIBRARY_H__ */
-
-
-
-/*
-Local variables:
-make-backup-files: t
-version-control: t
-trim-versions-without-asking: nil
-End:
-*/
diff --git a/gnu/usr.bin/dialog/inputbox.c b/gnu/usr.bin/dialog/inputbox.c
deleted file mode 100644
index 4c51a1c..0000000
--- a/gnu/usr.bin/dialog/inputbox.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * inputbox.c -- implements the input box
- *
- * AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#include "dialog.h"
-
-
-/*
- * Display a dialog box for inputing a string
- */
-int dialog_inputbox(unsigned char *title, unsigned char *prompt, int height, int width)
-{
- int i, x, y, box_y, box_x, box_width,
- input_x = 0, scroll = 0, key = 0, button = -1;
- unsigned char instr[MAX_LEN+1];
- WINDOW *dialog;
-
- /* center dialog box on screen */
- x = (COLS - width)/2;
- y = (LINES - height)/2;
-
- memset(instr, 0, sizeof(instr));
-
-#ifdef HAVE_NCURSES
- if (use_shadow)
- draw_shadow(stdscr, y, x, height, width);
-#endif
- dialog = newwin(height, width, y, x);
- keypad(dialog, TRUE);
-
- draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
- wattrset(dialog, border_attr);
- wmove(dialog, height-3, 0);
- waddch(dialog, ACS_LTEE);
- for (i = 0; i < width-2; i++)
- waddch(dialog, ACS_HLINE);
- wattrset(dialog, dialog_attr);
- waddch(dialog, ACS_RTEE);
- wmove(dialog, height-2, 1);
- for (i = 0; i < width-2; i++)
- waddch(dialog, ' ');
-
- if (title != NULL) {
- wattrset(dialog, title_attr);
- wmove(dialog, 0, (width - strlen(title))/2 - 1);
- waddch(dialog, ' ');
- waddstr(dialog, title);
- waddch(dialog, ' ');
- }
- wattrset(dialog, dialog_attr);
- print_autowrap(dialog, prompt, width, 1, 3);
-
- /* Draw the input field box */
- box_width = width-6;
- getyx(dialog, y, x);
- box_y = y + 2;
- box_x = (width - box_width)/2;
- draw_box(dialog, y+1, box_x-1, 3, box_width+2, border_attr, dialog_attr);
-
- x = width/2-11;
- y = height-2;
- print_button(dialog, "Cancel", y, x+14, FALSE);
- print_button(dialog, " OK ", y, x, TRUE);
-
- wmove(dialog, box_y, box_x);
- wrefresh(dialog);
- while (key != ESC) {
- key = wgetch(dialog);
-
- if (button == -1) { /* Input box selected */
- switch (key) {
- case TAB:
- case KEY_BTAB:
- case KEY_UP:
- case KEY_DOWN:
- break;
- case KEY_HOME:
- input_x = scroll = 0;
- wmove(dialog, box_y, box_x);
- for (i = 0; i < box_width; i++)
- waddch(dialog, instr[i] ? instr[i] : ' ');
- wmove(dialog, box_y, box_x);
- wrefresh(dialog);
- continue;
- case KEY_END:
- for (i = strlen(instr) - 1; i >= scroll + input_x && instr[i] == ' '; i--)
- instr[i] = '\0';
- i++;
- input_x = i % box_width;
- scroll = i - input_x;
- wmove(dialog, box_y, box_x);
- for (i = 0; i < box_width; i++)
- waddch(dialog, instr[scroll+i] ? instr[scroll+i] : ' ');
- wmove(dialog, box_y, input_x + box_x);
- wrefresh(dialog);
- continue;
- case KEY_LEFT:
- if (input_x || scroll) {
- wattrset(dialog, inputbox_attr);
- if (!input_x) {
- int oldscroll = scroll;
- scroll = scroll < box_width-1 ? 0 : scroll-(box_width-1);
- wmove(dialog, box_y, box_x);
- for (i = 0; i < box_width; i++)
- waddch(dialog, instr[scroll+input_x+i] ? instr[scroll+input_x+i] : ' ');
- input_x = oldscroll - 1 - scroll;
- }
- else
- input_x--;
- wmove(dialog, box_y, input_x + box_x);
- wrefresh(dialog);
- }
- continue;
- case KEY_RIGHT:
- if (scroll+input_x < MAX_LEN) {
- wattrset(dialog, inputbox_attr);
- if (!instr[scroll+input_x])
- instr[scroll+input_x] = ' ';
- if (input_x == box_width-1) {
- scroll++;
- wmove(dialog, box_y, box_x);
- for (i = 0; i < box_width; i++)
- waddch(dialog, instr[scroll+i] ? instr[scroll+i] : ' ');
- wmove(dialog, box_y, box_x + box_width - 1);
- }
- else {
- wmove(dialog, box_y, input_x + box_x);
- waddch(dialog, instr[scroll+input_x]);
- input_x++;
- }
- wrefresh(dialog);
- } else
- flash(); /* Alarm user about overflow */
- continue;
- case KEY_BACKSPACE:
- case KEY_DC:
- if (input_x || scroll) {
- i = strlen(instr);
- memmove(instr+scroll+input_x-1, instr+scroll+input_x, i-scroll+input_x+1);
- wattrset(dialog, inputbox_attr);
- if (!input_x) {
- int oldscroll = scroll;
- scroll = scroll < box_width-1 ? 0 : scroll-(box_width-1);
- wmove(dialog, box_y, box_x);
- for (i = 0; i < box_width; i++)
- waddch(dialog, instr[scroll+input_x+i] ? instr[scroll+input_x+i] : ' ');
- input_x = oldscroll - 1 - scroll;
- }
- else
- input_x--;
- wmove(dialog, box_y, input_x + box_x);
- for (i = input_x; i < box_width; i++)
- waddch(dialog, instr[scroll+i] ? instr[scroll+i] : ' ');
- wmove(dialog, box_y, input_x + box_x);
- wrefresh(dialog);
- }
- continue;
- default:
- if (key < 0x100 && isprint(key)) {
- for (i = strlen(instr) - 1; i >= scroll + input_x && instr[i] == ' '; i--)
- instr[i] = '\0';
- i++;
- if (i < MAX_LEN) {
- memmove(instr+scroll+input_x+1, instr+scroll+input_x, i-scroll+input_x);
- wattrset(dialog, inputbox_attr);
- instr[scroll+input_x] = key;
- if (input_x == box_width-1) {
- scroll++;
- wmove(dialog, box_y, box_x);
- for (i = 0; i < box_width-1; i++)
- waddch(dialog, instr[scroll+i]);
- }
- else {
- wmove(dialog, box_y, input_x + box_x);
- for (i = input_x; i < box_width; i++)
- waddch(dialog, instr[scroll+i] ? instr[scroll+i] : ' ');
- wmove(dialog, box_y, ++input_x + box_x);
- }
- wrefresh(dialog);
- } else
- flash(); /* Alarm user about overflow */
- continue;
- }
- }
- }
-
- switch (key) {
- case 'O':
- case 'o':
- delwin(dialog);
- fprintf(stderr, instr);
- return 0;
- case 'C':
- case 'c':
- delwin(dialog);
- return 1;
- case KEY_UP:
- case KEY_LEFT:
- case KEY_BTAB:
- switch (button) {
- case -1:
- button = 1; /* Indicates "Cancel" button is selected */
- print_button(dialog, " OK ", y, x, FALSE);
- print_button(dialog, "Cancel", y, x+14, TRUE);
- wrefresh(dialog);
- break;
- case 0:
- button = -1; /* Indicates input box is selected */
- print_button(dialog, "Cancel", y, x+14, FALSE);
- print_button(dialog, " OK ", y, x, TRUE);
- wmove(dialog, box_y, box_x + input_x);
- wrefresh(dialog);
- break;
- case 1:
- button = 0; /* Indicates "OK" button is selected */
- print_button(dialog, "Cancel", y, x+14, FALSE);
- print_button(dialog, " OK ", y, x, TRUE);
- wrefresh(dialog);
- break;
- }
- break;
- case TAB:
- case KEY_DOWN:
- case KEY_RIGHT:
- switch (button) {
- case -1:
- button = 0; /* Indicates "OK" button is selected */
- print_button(dialog, "Cancel", y, x+14, FALSE);
- print_button(dialog, " OK ", y, x, TRUE);
- wrefresh(dialog);
- break;
- case 0:
- button = 1; /* Indicates "Cancel" button is selected */
- print_button(dialog, " OK ", y, x, FALSE);
- print_button(dialog, "Cancel", y, x+14, TRUE);
- wrefresh(dialog);
- break;
- case 1:
- button = -1; /* Indicates input box is selected */
- print_button(dialog, "Cancel", y, x+14, FALSE);
- print_button(dialog, " OK ", y, x, TRUE);
- wmove(dialog, box_y, box_x + input_x);
- wrefresh(dialog);
- break;
- }
- break;
- case ' ':
- case '\n':
- delwin(dialog);
- for (i = strlen(instr) - 1; i >= scroll + input_x && instr[i] == ' '; i--)
- instr[i] = '\0';
- fprintf(stderr, instr);
- return (button == -1 ? 0 : button);
- case ESC:
- break;
- }
- }
-
- delwin(dialog);
- return -1; /* ESC pressed */
-}
-/* End of dialog_inputbox() */
diff --git a/gnu/usr.bin/diff/regex.c b/gnu/usr.bin/diff/regex.c
deleted file mode 100644
index 81b06ff..0000000
--- a/gnu/usr.bin/diff/regex.c
+++ /dev/null
@@ -1,5171 +0,0 @@
-/* Extended regular expression matching and search library,
- version 0.12.
- (Implements POSIX draft P10003.2/D11.2, except for
- internationalization features.)
-
- Copyright (C) 1993 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* AIX requires this to be the first thing in the file. */
-#if defined (_AIX) && !defined (REGEX_MALLOC)
- #pragma alloca
-#endif
-
-#define _GNU_SOURCE
-
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
-#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
-/* We need this for `regex.h', and perhaps for the Emacs include files. */
-#include <sys/types.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-/* The `emacs' switch turns on certain matching commands
- that make sense only in Emacs. */
-#ifdef emacs
-
-#include "lisp.h"
-#include "buffer.h"
-#include "syntax.h"
-
-/* Emacs uses `NULL' as a predicate. */
-#undef NULL
-
-#else /* not emacs */
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#else
-char *malloc ();
-char *realloc ();
-#endif
-
-
-/* We used to test for `BSTRING' here, but only GCC and Emacs define
- `BSTRING', as far as I know, and neither of them use this code. */
-#if HAVE_STRING_H || STDC_HEADERS
-#include <string.h>
-#ifndef bcmp
-#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
-#endif
-#ifndef bcopy
-#define bcopy(s, d, n) memcpy ((d), (s), (n))
-#endif
-#ifndef bzero
-#define bzero(s, n) memset ((s), 0, (n))
-#endif
-#else
-#include <strings.h>
-#endif
-
-/* Define the syntax stuff for \<, \>, etc. */
-
-/* This must be nonzero for the wordchar and notwordchar pattern
- commands in re_match_2. */
-#ifndef Sword
-#define Sword 1
-#endif
-
-#ifdef SYNTAX_TABLE
-
-extern char *re_syntax_table;
-
-#else /* not SYNTAX_TABLE */
-
-/* How many characters in the character set. */
-#define CHAR_SET_SIZE 256
-
-static char re_syntax_table[CHAR_SET_SIZE];
-
-static void
-init_syntax_once ()
-{
- register int c;
- static int done = 0;
-
- if (done)
- return;
-
- bzero (re_syntax_table, sizeof re_syntax_table);
-
- for (c = 'a'; c <= 'z'; c++)
- re_syntax_table[c] = Sword;
-
- for (c = 'A'; c <= 'Z'; c++)
- re_syntax_table[c] = Sword;
-
- for (c = '0'; c <= '9'; c++)
- re_syntax_table[c] = Sword;
-
- re_syntax_table['_'] = Sword;
-
- done = 1;
-}
-
-#endif /* not SYNTAX_TABLE */
-
-#define SYNTAX(c) re_syntax_table[c]
-
-#endif /* not emacs */
-
-/* Get the interface, including the syntax bits. */
-#include "regex.h"
-
-/* isalpha etc. are used for the character classes. */
-#include <ctype.h>
-
-/* Jim Meyering writes:
-
- "... Some ctype macros are valid only for character codes that
- isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
- using /bin/cc or gcc but without giving an ansi option). So, all
- ctype uses should be through macros like ISPRINT... If
- STDC_HEADERS is defined, then autoconf has verified that the ctype
- macros don't need to be guarded with references to isascii. ...
- Defining isascii to 1 should let any compiler worth its salt
- eliminate the && through constant folding." */
-#if ! defined (isascii) || defined (STDC_HEADERS)
-#undef isascii
-#define isascii(c) 1
-#endif
-
-#ifdef isblank
-#define ISBLANK(c) (isascii (c) && isblank (c))
-#else
-#define ISBLANK(c) ((c) == ' ' || (c) == '\t')
-#endif
-#ifdef isgraph
-#define ISGRAPH(c) (isascii (c) && isgraph (c))
-#else
-#define ISGRAPH(c) (isascii (c) && isprint (c) && !isspace (c))
-#endif
-
-#define ISPRINT(c) (isascii (c) && isprint (c))
-#define ISDIGIT(c) (isascii (c) && isdigit (c))
-#define ISALNUM(c) (isascii (c) && isalnum (c))
-#define ISALPHA(c) (isascii (c) && isalpha (c))
-#define ISCNTRL(c) (isascii (c) && iscntrl (c))
-#define ISLOWER(c) (isascii (c) && islower (c))
-#define ISPUNCT(c) (isascii (c) && ispunct (c))
-#define ISSPACE(c) (isascii (c) && isspace (c))
-#define ISUPPER(c) (isascii (c) && isupper (c))
-#define ISXDIGIT(c) (isascii (c) && isxdigit (c))
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* We remove any previous definition of `SIGN_EXTEND_CHAR',
- since ours (we hope) works properly with all combinations of
- machines, compilers, `char' and `unsigned char' argument types.
- (Per Bothner suggested the basic approach.) */
-#undef SIGN_EXTEND_CHAR
-#if __STDC__
-#define SIGN_EXTEND_CHAR(c) ((signed char) (c))
-#else /* not __STDC__ */
-/* As in Harbison and Steele. */
-#define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
-#endif
-
-/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we
- use `alloca' instead of `malloc'. This is because using malloc in
- re_search* or re_match* could cause memory leaks when C-g is used in
- Emacs; also, malloc is slower and causes storage fragmentation. On
- the other hand, malloc is more portable, and easier to debug.
-
- Because we sometimes use alloca, some routines have to be macros,
- not functions -- `alloca'-allocated space disappears at the end of the
- function it is called in. */
-
-#ifdef REGEX_MALLOC
-
-#define REGEX_ALLOCATE malloc
-#define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize)
-
-#else /* not REGEX_MALLOC */
-
-/* Emacs already defines alloca, sometimes. */
-#ifndef alloca
-
-/* Make alloca work the best possible way. */
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else /* not __GNUC__ */
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#else /* not __GNUC__ or HAVE_ALLOCA_H */
-#ifndef _AIX /* Already did AIX, up at the top. */
-char *alloca ();
-#endif /* not _AIX */
-#endif /* not HAVE_ALLOCA_H */
-#endif /* not __GNUC__ */
-
-#endif /* not alloca */
-
-#define REGEX_ALLOCATE alloca
-
-/* Assumes a `char *destination' variable. */
-#define REGEX_REALLOCATE(source, osize, nsize) \
- (destination = (char *) alloca (nsize), \
- bcopy (source, destination, osize), \
- destination)
-
-#endif /* not REGEX_MALLOC */
-
-
-/* True if `size1' is non-NULL and PTR is pointing anywhere inside
- `string1' or just past its end. This works if PTR is NULL, which is
- a good thing. */
-#define FIRST_STRING_P(ptr) \
- (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
-
-/* (Re)Allocate N items of type T using malloc, or fail. */
-#define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t)))
-#define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
-#define RETALLOC_IF(addr, n, t) \
- if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t)
-#define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
-
-#define BYTEWIDTH 8 /* In bits. */
-
-#define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
-
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-
-typedef char boolean;
-#define false 0
-#define true 1
-
-/* These are the command codes that appear in compiled regular
- expressions. Some opcodes are followed by argument bytes. A
- command code can specify any interpretation whatsoever for its
- arguments. Zero bytes may appear in the compiled regular expression.
-
- The value of `exactn' is needed in search.c (search_buffer) in Emacs.
- So regex.h defines a symbol `RE_EXACTN_VALUE' to be 1; the value of
- `exactn' we use here must also be 1. */
-
-typedef enum
-{
- no_op = 0,
-
- /* Followed by one byte giving n, then by n literal bytes. */
- exactn = 1,
-
- /* Matches any (more or less) character. */
- anychar,
-
- /* Matches any one char belonging to specified set. First
- following byte is number of bitmap bytes. Then come bytes
- for a bitmap saying which chars are in. Bits in each byte
- are ordered low-bit-first. A character is in the set if its
- bit is 1. A character too large to have a bit in the map is
- automatically not in the set. */
- charset,
-
- /* Same parameters as charset, but match any character that is
- not one of those specified. */
- charset_not,
-
- /* Start remembering the text that is matched, for storing in a
- register. Followed by one byte with the register number, in
- the range 0 to one less than the pattern buffer's re_nsub
- field. Then followed by one byte with the number of groups
- inner to this one. (This last has to be part of the
- start_memory only because we need it in the on_failure_jump
- of re_match_2.) */
- start_memory,
-
- /* Stop remembering the text that is matched and store it in a
- memory register. Followed by one byte with the register
- number, in the range 0 to one less than `re_nsub' in the
- pattern buffer, and one byte with the number of inner groups,
- just like `start_memory'. (We need the number of inner
- groups here because we don't have any easy way of finding the
- corresponding start_memory when we're at a stop_memory.) */
- stop_memory,
-
- /* Match a duplicate of something remembered. Followed by one
- byte containing the register number. */
- duplicate,
-
- /* Fail unless at beginning of line. */
- begline,
-
- /* Fail unless at end of line. */
- endline,
-
- /* Succeeds if at beginning of buffer (if emacs) or at beginning
- of string to be matched (if not). */
- begbuf,
-
- /* Analogously, for end of buffer/string. */
- endbuf,
-
- /* Followed by two byte relative address to which to jump. */
- jump,
-
- /* Same as jump, but marks the end of an alternative. */
- jump_past_alt,
-
- /* Followed by two-byte relative address of place to resume at
- in case of failure. */
- on_failure_jump,
-
- /* Like on_failure_jump, but pushes a placeholder instead of the
- current string position when executed. */
- on_failure_keep_string_jump,
-
- /* Throw away latest failure point and then jump to following
- two-byte relative address. */
- pop_failure_jump,
-
- /* Change to pop_failure_jump if know won't have to backtrack to
- match; otherwise change to jump. This is used to jump
- back to the beginning of a repeat. If what follows this jump
- clearly won't match what the repeat does, such that we can be
- sure that there is no use backtracking out of repetitions
- already matched, then we change it to a pop_failure_jump.
- Followed by two-byte address. */
- maybe_pop_jump,
-
- /* Jump to following two-byte address, and push a dummy failure
- point. This failure point will be thrown away if an attempt
- is made to use it for a failure. A `+' construct makes this
- before the first repeat. Also used as an intermediary kind
- of jump when compiling an alternative. */
- dummy_failure_jump,
-
- /* Push a dummy failure point and continue. Used at the end of
- alternatives. */
- push_dummy_failure,
-
- /* Followed by two-byte relative address and two-byte number n.
- After matching N times, jump to the address upon failure. */
- succeed_n,
-
- /* Followed by two-byte relative address, and two-byte number n.
- Jump to the address N times, then fail. */
- jump_n,
-
- /* Set the following two-byte relative address to the
- subsequent two-byte number. The address *includes* the two
- bytes of number. */
- set_number_at,
-
- wordchar, /* Matches any word-constituent character. */
- notwordchar, /* Matches any char that is not a word-constituent. */
-
- wordbeg, /* Succeeds if at word beginning. */
- wordend, /* Succeeds if at word end. */
-
- wordbound, /* Succeeds if at a word boundary. */
- notwordbound /* Succeeds if not at a word boundary. */
-
-#ifdef emacs
- ,before_dot, /* Succeeds if before point. */
- at_dot, /* Succeeds if at point. */
- after_dot, /* Succeeds if after point. */
-
- /* Matches any character whose syntax is specified. Followed by
- a byte which contains a syntax code, e.g., Sword. */
- syntaxspec,
-
- /* Matches any character whose syntax is not that specified. */
- notsyntaxspec
-#endif /* emacs */
-} re_opcode_t;
-
-/* Common operations on the compiled pattern. */
-
-/* Store NUMBER in two contiguous bytes starting at DESTINATION. */
-
-#define STORE_NUMBER(destination, number) \
- do { \
- (destination)[0] = (number) & 0377; \
- (destination)[1] = (number) >> 8; \
- } while (0)
-
-/* Same as STORE_NUMBER, except increment DESTINATION to
- the byte after where the number is stored. Therefore, DESTINATION
- must be an lvalue. */
-
-#define STORE_NUMBER_AND_INCR(destination, number) \
- do { \
- STORE_NUMBER (destination, number); \
- (destination) += 2; \
- } while (0)
-
-/* Put into DESTINATION a number stored in two contiguous bytes starting
- at SOURCE. */
-
-#define EXTRACT_NUMBER(destination, source) \
- do { \
- (destination) = *(source) & 0377; \
- (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \
- } while (0)
-
-#ifdef DEBUG
-static void
-extract_number (dest, source)
- int *dest;
- unsigned char *source;
-{
- int temp = SIGN_EXTEND_CHAR (*(source + 1));
- *dest = *source & 0377;
- *dest += temp << 8;
-}
-
-#ifndef EXTRACT_MACROS /* To debug the macros. */
-#undef EXTRACT_NUMBER
-#define EXTRACT_NUMBER(dest, src) extract_number (&dest, src)
-#endif /* not EXTRACT_MACROS */
-
-#endif /* DEBUG */
-
-/* Same as EXTRACT_NUMBER, except increment SOURCE to after the number.
- SOURCE must be an lvalue. */
-
-#define EXTRACT_NUMBER_AND_INCR(destination, source) \
- do { \
- EXTRACT_NUMBER (destination, source); \
- (source) += 2; \
- } while (0)
-
-#ifdef DEBUG
-static void
-extract_number_and_incr (destination, source)
- int *destination;
- unsigned char **source;
-{
- extract_number (destination, *source);
- *source += 2;
-}
-
-#ifndef EXTRACT_MACROS
-#undef EXTRACT_NUMBER_AND_INCR
-#define EXTRACT_NUMBER_AND_INCR(dest, src) \
- extract_number_and_incr (&dest, &src)
-#endif /* not EXTRACT_MACROS */
-
-#endif /* DEBUG */
-
-/* If DEBUG is defined, Regex prints many voluminous messages about what
- it is doing (if the variable `debug' is nonzero). If linked with the
- main program in `iregex.c', you can enter patterns and strings
- interactively. And if linked with the main program in `main.c' and
- the other test files, you can run the already-written tests. */
-
-#ifdef DEBUG
-
-/* We use standard I/O for debugging. */
-#include <stdio.h>
-
-/* It is useful to test things that ``must'' be true when debugging. */
-#include <assert.h>
-
-static int debug = 0;
-
-#define DEBUG_STATEMENT(e) e
-#define DEBUG_PRINT1(x) if (debug) printf (x)
-#define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2)
-#define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3)
-#define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4)
-#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \
- if (debug) print_partial_compiled_pattern (s, e)
-#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \
- if (debug) print_double_string (w, s1, sz1, s2, sz2)
-
-
-extern void printchar ();
-
-/* Print the fastmap in human-readable form. */
-
-void
-print_fastmap (fastmap)
- char *fastmap;
-{
- unsigned was_a_range = 0;
- unsigned i = 0;
-
- while (i < (1 << BYTEWIDTH))
- {
- if (fastmap[i++])
- {
- was_a_range = 0;
- printchar (i - 1);
- while (i < (1 << BYTEWIDTH) && fastmap[i])
- {
- was_a_range = 1;
- i++;
- }
- if (was_a_range)
- {
- printf ("-");
- printchar (i - 1);
- }
- }
- }
- putchar ('\n');
-}
-
-
-/* Print a compiled pattern string in human-readable form, starting at
- the START pointer into it and ending just before the pointer END. */
-
-void
-print_partial_compiled_pattern (start, end)
- unsigned char *start;
- unsigned char *end;
-{
- int mcnt, mcnt2;
- unsigned char *p = start;
- unsigned char *pend = end;
-
- if (start == NULL)
- {
- printf ("(null)\n");
- return;
- }
-
- /* Loop over pattern commands. */
- while (p < pend)
- {
- printf ("%d:\t", p - start);
-
- switch ((re_opcode_t) *p++)
- {
- case no_op:
- printf ("/no_op");
- break;
-
- case exactn:
- mcnt = *p++;
- printf ("/exactn/%d", mcnt);
- do
- {
- putchar ('/');
- printchar (*p++);
- }
- while (--mcnt);
- break;
-
- case start_memory:
- mcnt = *p++;
- printf ("/start_memory/%d/%d", mcnt, *p++);
- break;
-
- case stop_memory:
- mcnt = *p++;
- printf ("/stop_memory/%d/%d", mcnt, *p++);
- break;
-
- case duplicate:
- printf ("/duplicate/%d", *p++);
- break;
-
- case anychar:
- printf ("/anychar");
- break;
-
- case charset:
- case charset_not:
- {
- register int c, last = -100;
- register int in_range = 0;
-
- printf ("/charset [%s",
- (re_opcode_t) *(p - 1) == charset_not ? "^" : "");
-
- assert (p + *p < pend);
-
- for (c = 0; c < 256; c++)
- if (c / 8 < *p
- && (p[1 + (c/8)] & (1 << (c % 8))))
- {
- /* Are we starting a range? */
- if (last + 1 == c && ! in_range)
- {
- putchar ('-');
- in_range = 1;
- }
- /* Have we broken a range? */
- else if (last + 1 != c && in_range)
- {
- printchar (last);
- in_range = 0;
- }
-
- if (! in_range)
- printchar (c);
-
- last = c;
- }
-
- if (in_range)
- printchar (last);
-
- putchar (']');
-
- p += 1 + *p;
- }
- break;
-
- case begline:
- printf ("/begline");
- break;
-
- case endline:
- printf ("/endline");
- break;
-
- case on_failure_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/on_failure_jump to %d", p + mcnt - start);
- break;
-
- case on_failure_keep_string_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/on_failure_keep_string_jump to %d", p + mcnt - start);
- break;
-
- case dummy_failure_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/dummy_failure_jump to %d", p + mcnt - start);
- break;
-
- case push_dummy_failure:
- printf ("/push_dummy_failure");
- break;
-
- case maybe_pop_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/maybe_pop_jump to %d", p + mcnt - start);
- break;
-
- case pop_failure_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/pop_failure_jump to %d", p + mcnt - start);
- break;
-
- case jump_past_alt:
- extract_number_and_incr (&mcnt, &p);
- printf ("/jump_past_alt to %d", p + mcnt - start);
- break;
-
- case jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/jump to %d", p + mcnt - start);
- break;
-
- case succeed_n:
- extract_number_and_incr (&mcnt, &p);
- extract_number_and_incr (&mcnt2, &p);
- printf ("/succeed_n to %d, %d times", p + mcnt - start, mcnt2);
- break;
-
- case jump_n:
- extract_number_and_incr (&mcnt, &p);
- extract_number_and_incr (&mcnt2, &p);
- printf ("/jump_n to %d, %d times", p + mcnt - start, mcnt2);
- break;
-
- case set_number_at:
- extract_number_and_incr (&mcnt, &p);
- extract_number_and_incr (&mcnt2, &p);
- printf ("/set_number_at location %d to %d", p + mcnt - start, mcnt2);
- break;
-
- case wordbound:
- printf ("/wordbound");
- break;
-
- case notwordbound:
- printf ("/notwordbound");
- break;
-
- case wordbeg:
- printf ("/wordbeg");
- break;
-
- case wordend:
- printf ("/wordend");
-
-#ifdef emacs
- case before_dot:
- printf ("/before_dot");
- break;
-
- case at_dot:
- printf ("/at_dot");
- break;
-
- case after_dot:
- printf ("/after_dot");
- break;
-
- case syntaxspec:
- printf ("/syntaxspec");
- mcnt = *p++;
- printf ("/%d", mcnt);
- break;
-
- case notsyntaxspec:
- printf ("/notsyntaxspec");
- mcnt = *p++;
- printf ("/%d", mcnt);
- break;
-#endif /* emacs */
-
- case wordchar:
- printf ("/wordchar");
- break;
-
- case notwordchar:
- printf ("/notwordchar");
- break;
-
- case begbuf:
- printf ("/begbuf");
- break;
-
- case endbuf:
- printf ("/endbuf");
- break;
-
- default:
- printf ("?%d", *(p-1));
- }
-
- putchar ('\n');
- }
-
- printf ("%d:\tend of pattern.\n", p - start);
-}
-
-
-void
-print_compiled_pattern (bufp)
- struct re_pattern_buffer *bufp;
-{
- unsigned char *buffer = bufp->buffer;
-
- print_partial_compiled_pattern (buffer, buffer + bufp->used);
- printf ("%d bytes used/%d bytes allocated.\n", bufp->used, bufp->allocated);
-
- if (bufp->fastmap_accurate && bufp->fastmap)
- {
- printf ("fastmap: ");
- print_fastmap (bufp->fastmap);
- }
-
- printf ("re_nsub: %d\t", bufp->re_nsub);
- printf ("regs_alloc: %d\t", bufp->regs_allocated);
- printf ("can_be_null: %d\t", bufp->can_be_null);
- printf ("newline_anchor: %d\n", bufp->newline_anchor);
- printf ("no_sub: %d\t", bufp->no_sub);
- printf ("not_bol: %d\t", bufp->not_bol);
- printf ("not_eol: %d\t", bufp->not_eol);
- printf ("syntax: %d\n", bufp->syntax);
- /* Perhaps we should print the translate table? */
-}
-
-
-void
-print_double_string (where, string1, size1, string2, size2)
- const char *where;
- const char *string1;
- const char *string2;
- int size1;
- int size2;
-{
- unsigned this_char;
-
- if (where == NULL)
- printf ("(null)");
- else
- {
- if (FIRST_STRING_P (where))
- {
- for (this_char = where - string1; this_char < size1; this_char++)
- printchar (string1[this_char]);
-
- where = string2;
- }
-
- for (this_char = where - string2; this_char < size2; this_char++)
- printchar (string2[this_char]);
- }
-}
-
-#else /* not DEBUG */
-
-#undef assert
-#define assert(e)
-
-#define DEBUG_STATEMENT(e)
-#define DEBUG_PRINT1(x)
-#define DEBUG_PRINT2(x1, x2)
-#define DEBUG_PRINT3(x1, x2, x3)
-#define DEBUG_PRINT4(x1, x2, x3, x4)
-#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
-#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)
-
-#endif /* not DEBUG */
-
-/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can
- also be assigned to arbitrarily: each pattern buffer stores its own
- syntax, so it can be changed between regex compilations. */
-reg_syntax_t re_syntax_options = RE_SYNTAX_EMACS;
-
-
-/* Specify the precise syntax of regexps for compilation. This provides
- for compatibility for various utilities which historically have
- different, incompatible syntaxes.
-
- The argument SYNTAX is a bit mask comprised of the various bits
- defined in regex.h. We return the old syntax. */
-
-reg_syntax_t
-re_set_syntax (syntax)
- reg_syntax_t syntax;
-{
- reg_syntax_t ret = re_syntax_options;
-
- re_syntax_options = syntax;
- return ret;
-}
-
-/* This table gives an error message for each of the error codes listed
- in regex.h. Obviously the order here has to be same as there. */
-
-static const char *re_error_msg[] =
- { NULL, /* REG_NOERROR */
- "No match", /* REG_NOMATCH */
- "Invalid regular expression", /* REG_BADPAT */
- "Invalid collation character", /* REG_ECOLLATE */
- "Invalid character class name", /* REG_ECTYPE */
- "Trailing backslash", /* REG_EESCAPE */
- "Invalid back reference", /* REG_ESUBREG */
- "Unmatched [ or [^", /* REG_EBRACK */
- "Unmatched ( or \\(", /* REG_EPAREN */
- "Unmatched \\{", /* REG_EBRACE */
- "Invalid content of \\{\\}", /* REG_BADBR */
- "Invalid range end", /* REG_ERANGE */
- "Memory exhausted", /* REG_ESPACE */
- "Invalid preceding regular expression", /* REG_BADRPT */
- "Premature end of regular expression", /* REG_EEND */
- "Regular expression too big", /* REG_ESIZE */
- "Unmatched ) or \\)", /* REG_ERPAREN */
- };
-
-/* Avoiding alloca during matching, to placate r_alloc. */
-
-/* Define MATCH_MAY_ALLOCATE if we need to make sure that the
- searching and matching functions should not call alloca. On some
- systems, alloca is implemented in terms of malloc, and if we're
- using the relocating allocator routines, then malloc could cause a
- relocation, which might (if the strings being searched are in the
- ralloc heap) shift the data out from underneath the regexp
- routines.
-
- Here's another reason to avoid allocation: Emacs insists on
- processing input from X in a signal handler; processing X input may
- call malloc; if input arrives while a matching routine is calling
- malloc, then we're scrod. But Emacs can't just block input while
- calling matching routines; then we don't notice interrupts when
- they come in. So, Emacs blocks input around all regexp calls
- except the matching calls, which it leaves unprotected, in the
- faith that they will not malloc. */
-
-/* Normally, this is fine. */
-#define MATCH_MAY_ALLOCATE
-
-/* But under some circumstances, it's not. */
-#if defined (emacs) || (defined (REL_ALLOC) && defined (C_ALLOCA))
-#undef MATCH_MAY_ALLOCATE
-#endif
-
-
-/* Failure stack declarations and macros; both re_compile_fastmap and
- re_match_2 use a failure stack. These have to be macros because of
- REGEX_ALLOCATE. */
-
-
-/* Number of failure points for which to initially allocate space
- when matching. If this number is exceeded, we allocate more
- space, so it is not a hard limit. */
-#ifndef INIT_FAILURE_ALLOC
-#define INIT_FAILURE_ALLOC 5
-#endif
-
-/* Roughly the maximum number of failure points on the stack. Would be
- exactly that if always used MAX_FAILURE_SPACE each time we failed.
- This is a variable only so users of regex can assign to it; we never
- change it ourselves. */
-int re_max_failures = 2000;
-
-typedef unsigned char *fail_stack_elt_t;
-
-typedef struct
-{
- fail_stack_elt_t *stack;
- unsigned size;
- unsigned avail; /* Offset of next open position. */
-} fail_stack_type;
-
-#define FAIL_STACK_EMPTY() (fail_stack.avail == 0)
-#define FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0)
-#define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size)
-#define FAIL_STACK_TOP() (fail_stack.stack[fail_stack.avail])
-
-
-/* Initialize `fail_stack'. Do `return -2' if the alloc fails. */
-
-#ifdef MATCH_MAY_ALLOCATE
-#define INIT_FAIL_STACK() \
- do { \
- fail_stack.stack = (fail_stack_elt_t *) \
- REGEX_ALLOCATE (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t)); \
- \
- if (fail_stack.stack == NULL) \
- return -2; \
- \
- fail_stack.size = INIT_FAILURE_ALLOC; \
- fail_stack.avail = 0; \
- } while (0)
-#else
-#define INIT_FAIL_STACK() \
- do { \
- fail_stack.avail = 0; \
- } while (0)
-#endif
-
-
-/* Double the size of FAIL_STACK, up to approximately `re_max_failures' items.
-
- Return 1 if succeeds, and 0 if either ran out of memory
- allocating space for it or it was already too large.
-
- REGEX_REALLOCATE requires `destination' be declared. */
-
-#define DOUBLE_FAIL_STACK(fail_stack) \
- ((fail_stack).size > re_max_failures * MAX_FAILURE_ITEMS \
- ? 0 \
- : ((fail_stack).stack = (fail_stack_elt_t *) \
- REGEX_REALLOCATE ((fail_stack).stack, \
- (fail_stack).size * sizeof (fail_stack_elt_t), \
- ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)), \
- \
- (fail_stack).stack == NULL \
- ? 0 \
- : ((fail_stack).size <<= 1, \
- 1)))
-
-
-/* Push PATTERN_OP on FAIL_STACK.
-
- Return 1 if was able to do so and 0 if ran out of memory allocating
- space to do so. */
-#define PUSH_PATTERN_OP(pattern_op, fail_stack) \
- ((FAIL_STACK_FULL () \
- && !DOUBLE_FAIL_STACK (fail_stack)) \
- ? 0 \
- : ((fail_stack).stack[(fail_stack).avail++] = pattern_op, \
- 1))
-
-/* This pushes an item onto the failure stack. Must be a four-byte
- value. Assumes the variable `fail_stack'. Probably should only
- be called from within `PUSH_FAILURE_POINT'. */
-#define PUSH_FAILURE_ITEM(item) \
- fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item
-
-/* The complement operation. Assumes `fail_stack' is nonempty. */
-#define POP_FAILURE_ITEM() fail_stack.stack[--fail_stack.avail]
-
-/* Used to omit pushing failure point id's when we're not debugging. */
-#ifdef DEBUG
-#define DEBUG_PUSH PUSH_FAILURE_ITEM
-#define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_ITEM ()
-#else
-#define DEBUG_PUSH(item)
-#define DEBUG_POP(item_addr)
-#endif
-
-
-/* Push the information about the state we will need
- if we ever fail back to it.
-
- Requires variables fail_stack, regstart, regend, reg_info, and
- num_regs be declared. DOUBLE_FAIL_STACK requires `destination' be
- declared.
-
- Does `return FAILURE_CODE' if runs out of memory. */
-
-#define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \
- do { \
- char *destination; \
- /* Must be int, so when we don't save any registers, the arithmetic \
- of 0 + -1 isn't done as unsigned. */ \
- int this_reg; \
- \
- DEBUG_STATEMENT (failure_id++); \
- DEBUG_STATEMENT (nfailure_points_pushed++); \
- DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \
- DEBUG_PRINT2 (" Before push, next avail: %d\n", (fail_stack).avail);\
- DEBUG_PRINT2 (" size: %d\n", (fail_stack).size);\
- \
- DEBUG_PRINT2 (" slots needed: %d\n", NUM_FAILURE_ITEMS); \
- DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \
- \
- /* Ensure we have enough space allocated for what we will push. */ \
- while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \
- { \
- if (!DOUBLE_FAIL_STACK (fail_stack)) \
- return failure_code; \
- \
- DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \
- (fail_stack).size); \
- DEBUG_PRINT2 (" slots available: %d\n", REMAINING_AVAIL_SLOTS);\
- } \
- \
- /* Push the info, starting with the registers. */ \
- DEBUG_PRINT1 ("\n"); \
- \
- for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \
- this_reg++) \
- { \
- DEBUG_PRINT2 (" Pushing reg: %d\n", this_reg); \
- DEBUG_STATEMENT (num_regs_pushed++); \
- \
- DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \
- PUSH_FAILURE_ITEM (regstart[this_reg]); \
- \
- DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \
- PUSH_FAILURE_ITEM (regend[this_reg]); \
- \
- DEBUG_PRINT2 (" info: 0x%x\n ", reg_info[this_reg]); \
- DEBUG_PRINT2 (" match_null=%d", \
- REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \
- DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \
- DEBUG_PRINT2 (" matched_something=%d", \
- MATCHED_SOMETHING (reg_info[this_reg])); \
- DEBUG_PRINT2 (" ever_matched=%d", \
- EVER_MATCHED_SOMETHING (reg_info[this_reg])); \
- DEBUG_PRINT1 ("\n"); \
- PUSH_FAILURE_ITEM (reg_info[this_reg].word); \
- } \
- \
- DEBUG_PRINT2 (" Pushing low active reg: %d\n", lowest_active_reg);\
- PUSH_FAILURE_ITEM (lowest_active_reg); \
- \
- DEBUG_PRINT2 (" Pushing high active reg: %d\n", highest_active_reg);\
- PUSH_FAILURE_ITEM (highest_active_reg); \
- \
- DEBUG_PRINT2 (" Pushing pattern 0x%x: ", pattern_place); \
- DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \
- PUSH_FAILURE_ITEM (pattern_place); \
- \
- DEBUG_PRINT2 (" Pushing string 0x%x: `", string_place); \
- DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \
- size2); \
- DEBUG_PRINT1 ("'\n"); \
- PUSH_FAILURE_ITEM (string_place); \
- \
- DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \
- DEBUG_PUSH (failure_id); \
- } while (0)
-
-/* This is the number of items that are pushed and popped on the stack
- for each register. */
-#define NUM_REG_ITEMS 3
-
-/* Individual items aside from the registers. */
-#ifdef DEBUG
-#define NUM_NONREG_ITEMS 5 /* Includes failure point id. */
-#else
-#define NUM_NONREG_ITEMS 4
-#endif
-
-/* We push at most this many items on the stack. */
-#define MAX_FAILURE_ITEMS ((num_regs - 1) * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
-
-/* We actually push this many items. */
-#define NUM_FAILURE_ITEMS \
- ((highest_active_reg - lowest_active_reg + 1) * NUM_REG_ITEMS \
- + NUM_NONREG_ITEMS)
-
-/* How many items can still be added to the stack without overflowing it. */
-#define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail)
-
-
-/* Pops what PUSH_FAIL_STACK pushes.
-
- We restore into the parameters, all of which should be lvalues:
- STR -- the saved data position.
- PAT -- the saved pattern position.
- LOW_REG, HIGH_REG -- the highest and lowest active registers.
- REGSTART, REGEND -- arrays of string positions.
- REG_INFO -- array of information about each subexpression.
-
- Also assumes the variables `fail_stack' and (if debugging), `bufp',
- `pend', `string1', `size1', `string2', and `size2'. */
-
-#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\
-{ \
- DEBUG_STATEMENT (fail_stack_elt_t failure_id;) \
- int this_reg; \
- const unsigned char *string_temp; \
- \
- assert (!FAIL_STACK_EMPTY ()); \
- \
- /* Remove failure points and point to how many regs pushed. */ \
- DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \
- DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \
- DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \
- \
- assert (fail_stack.avail >= NUM_NONREG_ITEMS); \
- \
- DEBUG_POP (&failure_id); \
- DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \
- \
- /* If the saved string location is NULL, it came from an \
- on_failure_keep_string_jump opcode, and we want to throw away the \
- saved NULL, thus retaining our current position in the string. */ \
- string_temp = POP_FAILURE_ITEM (); \
- if (string_temp != NULL) \
- str = (const char *) string_temp; \
- \
- DEBUG_PRINT2 (" Popping string 0x%x: `", str); \
- DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \
- DEBUG_PRINT1 ("'\n"); \
- \
- pat = (unsigned char *) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" Popping pattern 0x%x: ", pat); \
- DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \
- \
- /* Restore register info. */ \
- high_reg = (unsigned) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" Popping high active reg: %d\n", high_reg); \
- \
- low_reg = (unsigned) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \
- \
- for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \
- { \
- DEBUG_PRINT2 (" Popping reg: %d\n", this_reg); \
- \
- reg_info[this_reg].word = POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" info: 0x%x\n", reg_info[this_reg]); \
- \
- regend[this_reg] = (const char *) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \
- \
- regstart[this_reg] = (const char *) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \
- } \
- \
- DEBUG_STATEMENT (nfailure_points_popped++); \
-} /* POP_FAILURE_POINT */
-
-
-
-/* Structure for per-register (a.k.a. per-group) information.
- This must not be longer than one word, because we push this value
- onto the failure stack. Other register information, such as the
- starting and ending positions (which are addresses), and the list of
- inner groups (which is a bits list) are maintained in separate
- variables.
-
- We are making a (strictly speaking) nonportable assumption here: that
- the compiler will pack our bit fields into something that fits into
- the type of `word', i.e., is something that fits into one item on the
- failure stack. */
-typedef union
-{
- fail_stack_elt_t word;
- struct
- {
- /* This field is one if this group can match the empty string,
- zero if not. If not yet determined, `MATCH_NULL_UNSET_VALUE'. */
-#define MATCH_NULL_UNSET_VALUE 3
- unsigned match_null_string_p : 2;
- unsigned is_active : 1;
- unsigned matched_something : 1;
- unsigned ever_matched_something : 1;
- } bits;
-} register_info_type;
-
-#define REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p)
-#define IS_ACTIVE(R) ((R).bits.is_active)
-#define MATCHED_SOMETHING(R) ((R).bits.matched_something)
-#define EVER_MATCHED_SOMETHING(R) ((R).bits.ever_matched_something)
-
-
-/* Call this when have matched a real character; it sets `matched' flags
- for the subexpressions which we are currently inside. Also records
- that those subexprs have matched. */
-#define SET_REGS_MATCHED() \
- do \
- { \
- unsigned r; \
- for (r = lowest_active_reg; r <= highest_active_reg; r++) \
- { \
- MATCHED_SOMETHING (reg_info[r]) \
- = EVER_MATCHED_SOMETHING (reg_info[r]) \
- = 1; \
- } \
- } \
- while (0)
-
-
-/* Registers are set to a sentinel when they haven't yet matched. */
-#define REG_UNSET_VALUE ((char *) -1)
-#define REG_UNSET(e) ((e) == REG_UNSET_VALUE)
-
-
-
-/* How do we implement a missing MATCH_MAY_ALLOCATE?
- We make the fail stack a global thing, and then grow it to
- re_max_failures when we compile. */
-#ifndef MATCH_MAY_ALLOCATE
-static fail_stack_type fail_stack;
-
-static const char ** regstart, ** regend;
-static const char ** old_regstart, ** old_regend;
-static const char **best_regstart, **best_regend;
-static register_info_type *reg_info;
-static const char **reg_dummy;
-static register_info_type *reg_info_dummy;
-#endif
-
-
-/* Subroutine declarations and macros for regex_compile. */
-
-static void store_op1 (), store_op2 ();
-static void insert_op1 (), insert_op2 ();
-static boolean at_begline_loc_p (), at_endline_loc_p ();
-static boolean group_in_compile_stack ();
-static reg_errcode_t compile_range ();
-
-/* Fetch the next character in the uncompiled pattern---translating it
- if necessary. Also cast from a signed character in the constant
- string passed to us by the user to an unsigned char that we can use
- as an array index (in, e.g., `translate'). */
-#define PATFETCH(c) \
- do {if (p == pend) return REG_EEND; \
- c = (unsigned char) *p++; \
- if (translate) c = translate[c]; \
- } while (0)
-
-/* Fetch the next character in the uncompiled pattern, with no
- translation. */
-#define PATFETCH_RAW(c) \
- do {if (p == pend) return REG_EEND; \
- c = (unsigned char) *p++; \
- } while (0)
-
-/* Go backwards one character in the pattern. */
-#define PATUNFETCH p--
-
-
-/* If `translate' is non-null, return translate[D], else just D. We
- cast the subscript to translate because some data is declared as
- `char *', to avoid warnings when a string constant is passed. But
- when we use a character as a subscript we must make it unsigned. */
-#define TRANSLATE(d) (translate ? translate[(unsigned char) (d)] : (d))
-
-
-/* Macros for outputting the compiled pattern into `buffer'. */
-
-/* If the buffer isn't allocated when it comes in, use this. */
-#define INIT_BUF_SIZE 32
-
-/* Make sure we have at least N more bytes of space in buffer. */
-#define GET_BUFFER_SPACE(n) \
- while (b - bufp->buffer + (n) > bufp->allocated) \
- EXTEND_BUFFER ()
-
-/* Make sure we have one more byte of buffer space and then add C to it. */
-#define BUF_PUSH(c) \
- do { \
- GET_BUFFER_SPACE (1); \
- *b++ = (unsigned char) (c); \
- } while (0)
-
-
-/* Ensure we have two more bytes of buffer space and then append C1 and C2. */
-#define BUF_PUSH_2(c1, c2) \
- do { \
- GET_BUFFER_SPACE (2); \
- *b++ = (unsigned char) (c1); \
- *b++ = (unsigned char) (c2); \
- } while (0)
-
-
-/* As with BUF_PUSH_2, except for three bytes. */
-#define BUF_PUSH_3(c1, c2, c3) \
- do { \
- GET_BUFFER_SPACE (3); \
- *b++ = (unsigned char) (c1); \
- *b++ = (unsigned char) (c2); \
- *b++ = (unsigned char) (c3); \
- } while (0)
-
-
-/* Store a jump with opcode OP at LOC to location TO. We store a
- relative address offset by the three bytes the jump itself occupies. */
-#define STORE_JUMP(op, loc, to) \
- store_op1 (op, loc, (to) - (loc) - 3)
-
-/* Likewise, for a two-argument jump. */
-#define STORE_JUMP2(op, loc, to, arg) \
- store_op2 (op, loc, (to) - (loc) - 3, arg)
-
-/* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */
-#define INSERT_JUMP(op, loc, to) \
- insert_op1 (op, loc, (to) - (loc) - 3, b)
-
-/* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */
-#define INSERT_JUMP2(op, loc, to, arg) \
- insert_op2 (op, loc, (to) - (loc) - 3, arg, b)
-
-
-/* This is not an arbitrary limit: the arguments which represent offsets
- into the pattern are two bytes long. So if 2^16 bytes turns out to
- be too small, many things would have to change. */
-#define MAX_BUF_SIZE (1L << 16)
-
-
-/* Extend the buffer by twice its current size via realloc and
- reset the pointers that pointed into the old block to point to the
- correct places in the new one. If extending the buffer results in it
- being larger than MAX_BUF_SIZE, then flag memory exhausted. */
-#define EXTEND_BUFFER() \
- do { \
- unsigned char *old_buffer = bufp->buffer; \
- if (bufp->allocated == MAX_BUF_SIZE) \
- return REG_ESIZE; \
- bufp->allocated <<= 1; \
- if (bufp->allocated > MAX_BUF_SIZE) \
- bufp->allocated = MAX_BUF_SIZE; \
- bufp->buffer = (unsigned char *) realloc (bufp->buffer, bufp->allocated);\
- if (bufp->buffer == NULL) \
- return REG_ESPACE; \
- /* If the buffer moved, move all the pointers into it. */ \
- if (old_buffer != bufp->buffer) \
- { \
- b = (b - old_buffer) + bufp->buffer; \
- begalt = (begalt - old_buffer) + bufp->buffer; \
- if (fixup_alt_jump) \
- fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer;\
- if (laststart) \
- laststart = (laststart - old_buffer) + bufp->buffer; \
- if (pending_exact) \
- pending_exact = (pending_exact - old_buffer) + bufp->buffer; \
- } \
- } while (0)
-
-
-/* Since we have one byte reserved for the register number argument to
- {start,stop}_memory, the maximum number of groups we can report
- things about is what fits in that byte. */
-#define MAX_REGNUM 255
-
-/* But patterns can have more than `MAX_REGNUM' registers. We just
- ignore the excess. */
-typedef unsigned regnum_t;
-
-
-/* Macros for the compile stack. */
-
-/* Since offsets can go either forwards or backwards, this type needs to
- be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */
-typedef int pattern_offset_t;
-
-typedef struct
-{
- pattern_offset_t begalt_offset;
- pattern_offset_t fixup_alt_jump;
- pattern_offset_t inner_group_offset;
- pattern_offset_t laststart_offset;
- regnum_t regnum;
-} compile_stack_elt_t;
-
-
-typedef struct
-{
- compile_stack_elt_t *stack;
- unsigned size;
- unsigned avail; /* Offset of next open position. */
-} compile_stack_type;
-
-
-#define INIT_COMPILE_STACK_SIZE 32
-
-#define COMPILE_STACK_EMPTY (compile_stack.avail == 0)
-#define COMPILE_STACK_FULL (compile_stack.avail == compile_stack.size)
-
-/* The next available element. */
-#define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail])
-
-
-/* Set the bit for character C in a list. */
-#define SET_LIST_BIT(c) \
- (b[((unsigned char) (c)) / BYTEWIDTH] \
- |= 1 << (((unsigned char) c) % BYTEWIDTH))
-
-
-/* Get the next unsigned number in the uncompiled pattern. */
-#define GET_UNSIGNED_NUMBER(num) \
- { if (p != pend) \
- { \
- PATFETCH (c); \
- while (ISDIGIT (c)) \
- { \
- if (num < 0) \
- num = 0; \
- num = num * 10 + c - '0'; \
- if (p == pend) \
- break; \
- PATFETCH (c); \
- } \
- } \
- }
-
-#define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */
-
-#define IS_CHAR_CLASS(string) \
- (STREQ (string, "alpha") || STREQ (string, "upper") \
- || STREQ (string, "lower") || STREQ (string, "digit") \
- || STREQ (string, "alnum") || STREQ (string, "xdigit") \
- || STREQ (string, "space") || STREQ (string, "print") \
- || STREQ (string, "punct") || STREQ (string, "graph") \
- || STREQ (string, "cntrl") || STREQ (string, "blank"))
-
-/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
- Returns one of error codes defined in `regex.h', or zero for success.
-
- Assumes the `allocated' (and perhaps `buffer') and `translate'
- fields are set in BUFP on entry.
-
- If it succeeds, results are put in BUFP (if it returns an error, the
- contents of BUFP are undefined):
- `buffer' is the compiled pattern;
- `syntax' is set to SYNTAX;
- `used' is set to the length of the compiled pattern;
- `fastmap_accurate' is zero;
- `re_nsub' is the number of subexpressions in PATTERN;
- `not_bol' and `not_eol' are zero;
-
- The `fastmap' and `newline_anchor' fields are neither
- examined nor set. */
-
-static reg_errcode_t
-regex_compile (pattern, size, syntax, bufp)
- const char *pattern;
- int size;
- reg_syntax_t syntax;
- struct re_pattern_buffer *bufp;
-{
- /* We fetch characters from PATTERN here. Even though PATTERN is
- `char *' (i.e., signed), we declare these variables as unsigned, so
- they can be reliably used as array indices. */
- register unsigned char c, c1;
-
- /* A random tempory spot in PATTERN. */
- const char *p1;
-
- /* Points to the end of the buffer, where we should append. */
- register unsigned char *b;
-
- /* Keeps track of unclosed groups. */
- compile_stack_type compile_stack;
-
- /* Points to the current (ending) position in the pattern. */
- const char *p = pattern;
- const char *pend = pattern + size;
-
- /* How to translate the characters in the pattern. */
- char *translate = bufp->translate;
-
- /* Address of the count-byte of the most recently inserted `exactn'
- command. This makes it possible to tell if a new exact-match
- character can be added to that command or if the character requires
- a new `exactn' command. */
- unsigned char *pending_exact = 0;
-
- /* Address of start of the most recently finished expression.
- This tells, e.g., postfix * where to find the start of its
- operand. Reset at the beginning of groups and alternatives. */
- unsigned char *laststart = 0;
-
- /* Address of beginning of regexp, or inside of last group. */
- unsigned char *begalt;
-
- /* Place in the uncompiled pattern (i.e., the {) to
- which to go back if the interval is invalid. */
- const char *beg_interval;
-
- /* Address of the place where a forward jump should go to the end of
- the containing expression. Each alternative of an `or' -- except the
- last -- ends with a forward jump of this sort. */
- unsigned char *fixup_alt_jump = 0;
-
- /* Counts open-groups as they are encountered. Remembered for the
- matching close-group on the compile stack, so the same register
- number is put in the stop_memory as the start_memory. */
- regnum_t regnum = 0;
-
-#ifdef DEBUG
- DEBUG_PRINT1 ("\nCompiling pattern: ");
- if (debug)
- {
- unsigned debug_count;
-
- for (debug_count = 0; debug_count < size; debug_count++)
- printchar (pattern[debug_count]);
- putchar ('\n');
- }
-#endif /* DEBUG */
-
- /* Initialize the compile stack. */
- compile_stack.stack = TALLOC (INIT_COMPILE_STACK_SIZE, compile_stack_elt_t);
- if (compile_stack.stack == NULL)
- return REG_ESPACE;
-
- compile_stack.size = INIT_COMPILE_STACK_SIZE;
- compile_stack.avail = 0;
-
- /* Initialize the pattern buffer. */
- bufp->syntax = syntax;
- bufp->fastmap_accurate = 0;
- bufp->not_bol = bufp->not_eol = 0;
-
- /* Set `used' to zero, so that if we return an error, the pattern
- printer (for debugging) will think there's no pattern. We reset it
- at the end. */
- bufp->used = 0;
-
- /* Always count groups, whether or not bufp->no_sub is set. */
- bufp->re_nsub = 0;
-
-#if !defined (emacs) && !defined (SYNTAX_TABLE)
- /* Initialize the syntax table. */
- init_syntax_once ();
-#endif
-
- if (bufp->allocated == 0)
- {
- if (bufp->buffer)
- { /* If zero allocated, but buffer is non-null, try to realloc
- enough space. This loses if buffer's address is bogus, but
- that is the user's responsibility. */
- RETALLOC (bufp->buffer, INIT_BUF_SIZE, unsigned char);
- }
- else
- { /* Caller did not allocate a buffer. Do it for them. */
- bufp->buffer = TALLOC (INIT_BUF_SIZE, unsigned char);
- }
- if (!bufp->buffer) return REG_ESPACE;
-
- bufp->allocated = INIT_BUF_SIZE;
- }
-
- begalt = b = bufp->buffer;
-
- /* Loop through the uncompiled pattern until we're at the end. */
- while (p != pend)
- {
- PATFETCH (c);
-
- switch (c)
- {
- case '^':
- {
- if ( /* If at start of pattern, it's an operator. */
- p == pattern + 1
- /* If context independent, it's an operator. */
- || syntax & RE_CONTEXT_INDEP_ANCHORS
- /* Otherwise, depends on what's come before. */
- || at_begline_loc_p (pattern, p, syntax))
- BUF_PUSH (begline);
- else
- goto normal_char;
- }
- break;
-
-
- case '$':
- {
- if ( /* If at end of pattern, it's an operator. */
- p == pend
- /* If context independent, it's an operator. */
- || syntax & RE_CONTEXT_INDEP_ANCHORS
- /* Otherwise, depends on what's next. */
- || at_endline_loc_p (p, pend, syntax))
- BUF_PUSH (endline);
- else
- goto normal_char;
- }
- break;
-
-
- case '+':
- case '?':
- if ((syntax & RE_BK_PLUS_QM)
- || (syntax & RE_LIMITED_OPS))
- goto normal_char;
- handle_plus:
- case '*':
- /* If there is no previous pattern... */
- if (!laststart)
- {
- if (syntax & RE_CONTEXT_INVALID_OPS)
- return REG_BADRPT;
- else if (!(syntax & RE_CONTEXT_INDEP_OPS))
- goto normal_char;
- }
-
- {
- /* Are we optimizing this jump? */
- boolean keep_string_p = false;
-
- /* 1 means zero (many) matches is allowed. */
- char zero_times_ok = 0, many_times_ok = 0;
-
- /* If there is a sequence of repetition chars, collapse it
- down to just one (the right one). We can't combine
- interval operators with these because of, e.g., `a{2}*',
- which should only match an even number of `a's. */
-
- for (;;)
- {
- zero_times_ok |= c != '+';
- many_times_ok |= c != '?';
-
- if (p == pend)
- break;
-
- PATFETCH (c);
-
- if (c == '*'
- || (!(syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?')))
- ;
-
- else if (syntax & RE_BK_PLUS_QM && c == '\\')
- {
- if (p == pend) return REG_EESCAPE;
-
- PATFETCH (c1);
- if (!(c1 == '+' || c1 == '?'))
- {
- PATUNFETCH;
- PATUNFETCH;
- break;
- }
-
- c = c1;
- }
- else
- {
- PATUNFETCH;
- break;
- }
-
- /* If we get here, we found another repeat character. */
- }
-
- /* Star, etc. applied to an empty pattern is equivalent
- to an empty pattern. */
- if (!laststart)
- break;
-
- /* Now we know whether or not zero matches is allowed
- and also whether or not two or more matches is allowed. */
- if (many_times_ok)
- { /* More than one repetition is allowed, so put in at the
- end a backward relative jump from `b' to before the next
- jump we're going to put in below (which jumps from
- laststart to after this jump).
-
- But if we are at the `*' in the exact sequence `.*\n',
- insert an unconditional jump backwards to the .,
- instead of the beginning of the loop. This way we only
- push a failure point once, instead of every time
- through the loop. */
- assert (p - 1 > pattern);
-
- /* Allocate the space for the jump. */
- GET_BUFFER_SPACE (3);
-
- /* We know we are not at the first character of the pattern,
- because laststart was nonzero. And we've already
- incremented `p', by the way, to be the character after
- the `*'. Do we have to do something analogous here
- for null bytes, because of RE_DOT_NOT_NULL? */
- if (TRANSLATE (*(p - 2)) == TRANSLATE ('.')
- && zero_times_ok
- && p < pend && TRANSLATE (*p) == TRANSLATE ('\n')
- && !(syntax & RE_DOT_NEWLINE))
- { /* We have .*\n. */
- STORE_JUMP (jump, b, laststart);
- keep_string_p = true;
- }
- else
- /* Anything else. */
- STORE_JUMP (maybe_pop_jump, b, laststart - 3);
-
- /* We've added more stuff to the buffer. */
- b += 3;
- }
-
- /* On failure, jump from laststart to b + 3, which will be the
- end of the buffer after this jump is inserted. */
- GET_BUFFER_SPACE (3);
- INSERT_JUMP (keep_string_p ? on_failure_keep_string_jump
- : on_failure_jump,
- laststart, b + 3);
- pending_exact = 0;
- b += 3;
-
- if (!zero_times_ok)
- {
- /* At least one repetition is required, so insert a
- `dummy_failure_jump' before the initial
- `on_failure_jump' instruction of the loop. This
- effects a skip over that instruction the first time
- we hit that loop. */
- GET_BUFFER_SPACE (3);
- INSERT_JUMP (dummy_failure_jump, laststart, laststart + 6);
- b += 3;
- }
- }
- break;
-
-
- case '.':
- laststart = b;
- BUF_PUSH (anychar);
- break;
-
-
- case '[':
- {
- boolean had_char_class = false;
-
- if (p == pend) return REG_EBRACK;
-
- /* Ensure that we have enough space to push a charset: the
- opcode, the length count, and the bitset; 34 bytes in all. */
- GET_BUFFER_SPACE (34);
-
- laststart = b;
-
- /* We test `*p == '^' twice, instead of using an if
- statement, so we only need one BUF_PUSH. */
- BUF_PUSH (*p == '^' ? charset_not : charset);
- if (*p == '^')
- p++;
-
- /* Remember the first position in the bracket expression. */
- p1 = p;
-
- /* Push the number of bytes in the bitmap. */
- BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
-
- /* Clear the whole map. */
- bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH);
-
- /* charset_not matches newline according to a syntax bit. */
- if ((re_opcode_t) b[-2] == charset_not
- && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
- SET_LIST_BIT ('\n');
-
- /* Read in characters and ranges, setting map bits. */
- for (;;)
- {
- if (p == pend) return REG_EBRACK;
-
- PATFETCH (c);
-
- /* \ might escape characters inside [...] and [^...]. */
- if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
- {
- if (p == pend) return REG_EESCAPE;
-
- PATFETCH (c1);
- SET_LIST_BIT (c1);
- continue;
- }
-
- /* Could be the end of the bracket expression. If it's
- not (i.e., when the bracket expression is `[]' so
- far), the ']' character bit gets set way below. */
- if (c == ']' && p != p1 + 1)
- break;
-
- /* Look ahead to see if it's a range when the last thing
- was a character class. */
- if (had_char_class && c == '-' && *p != ']')
- return REG_ERANGE;
-
- /* Look ahead to see if it's a range when the last thing
- was a character: if this is a hyphen not at the
- beginning or the end of a list, then it's the range
- operator. */
- if (c == '-'
- && !(p - 2 >= pattern && p[-2] == '[')
- && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^')
- && *p != ']')
- {
- reg_errcode_t ret
- = compile_range (&p, pend, translate, syntax, b);
- if (ret != REG_NOERROR) return ret;
- }
-
- else if (p[0] == '-' && p[1] != ']')
- { /* This handles ranges made up of characters only. */
- reg_errcode_t ret;
-
- /* Move past the `-'. */
- PATFETCH (c1);
-
- ret = compile_range (&p, pend, translate, syntax, b);
- if (ret != REG_NOERROR) return ret;
- }
-
- /* See if we're at the beginning of a possible character
- class. */
-
- else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
- { /* Leave room for the null. */
- char str[CHAR_CLASS_MAX_LENGTH + 1];
-
- PATFETCH (c);
- c1 = 0;
-
- /* If pattern is `[[:'. */
- if (p == pend) return REG_EBRACK;
-
- for (;;)
- {
- PATFETCH (c);
- if (c == ':' || c == ']' || p == pend
- || c1 == CHAR_CLASS_MAX_LENGTH)
- break;
- str[c1++] = c;
- }
- str[c1] = '\0';
-
- /* If isn't a word bracketed by `[:' and:`]':
- undo the ending character, the letters, and leave
- the leading `:' and `[' (but set bits for them). */
- if (c == ':' && *p == ']')
- {
- int ch;
- boolean is_alnum = STREQ (str, "alnum");
- boolean is_alpha = STREQ (str, "alpha");
- boolean is_blank = STREQ (str, "blank");
- boolean is_cntrl = STREQ (str, "cntrl");
- boolean is_digit = STREQ (str, "digit");
- boolean is_graph = STREQ (str, "graph");
- boolean is_lower = STREQ (str, "lower");
- boolean is_print = STREQ (str, "print");
- boolean is_punct = STREQ (str, "punct");
- boolean is_space = STREQ (str, "space");
- boolean is_upper = STREQ (str, "upper");
- boolean is_xdigit = STREQ (str, "xdigit");
-
- if (!IS_CHAR_CLASS (str)) return REG_ECTYPE;
-
- /* Throw away the ] at the end of the character
- class. */
- PATFETCH (c);
-
- if (p == pend) return REG_EBRACK;
-
- for (ch = 0; ch < 1 << BYTEWIDTH; ch++)
- {
- if ( (is_alnum && ISALNUM (ch))
- || (is_alpha && ISALPHA (ch))
- || (is_blank && ISBLANK (ch))
- || (is_cntrl && ISCNTRL (ch))
- || (is_digit && ISDIGIT (ch))
- || (is_graph && ISGRAPH (ch))
- || (is_lower && ISLOWER (ch))
- || (is_print && ISPRINT (ch))
- || (is_punct && ISPUNCT (ch))
- || (is_space && ISSPACE (ch))
- || (is_upper && ISUPPER (ch))
- || (is_xdigit && ISXDIGIT (ch)))
- SET_LIST_BIT (ch);
- }
- had_char_class = true;
- }
- else
- {
- c1++;
- while (c1--)
- PATUNFETCH;
- SET_LIST_BIT ('[');
- SET_LIST_BIT (':');
- had_char_class = false;
- }
- }
- else
- {
- had_char_class = false;
- SET_LIST_BIT (c);
- }
- }
-
- /* Discard any (non)matching list bytes that are all 0 at the
- end of the map. Decrease the map-length byte too. */
- while ((int) b[-1] > 0 && b[b[-1] - 1] == 0)
- b[-1]--;
- b += b[-1];
- }
- break;
-
-
- case '(':
- if (syntax & RE_NO_BK_PARENS)
- goto handle_open;
- else
- goto normal_char;
-
-
- case ')':
- if (syntax & RE_NO_BK_PARENS)
- goto handle_close;
- else
- goto normal_char;
-
-
- case '\n':
- if (syntax & RE_NEWLINE_ALT)
- goto handle_alt;
- else
- goto normal_char;
-
-
- case '|':
- if (syntax & RE_NO_BK_VBAR)
- goto handle_alt;
- else
- goto normal_char;
-
-
- case '{':
- if (syntax & RE_INTERVALS && syntax & RE_NO_BK_BRACES)
- goto handle_interval;
- else
- goto normal_char;
-
-
- case '\\':
- if (p == pend) return REG_EESCAPE;
-
- /* Do not translate the character after the \, so that we can
- distinguish, e.g., \B from \b, even if we normally would
- translate, e.g., B to b. */
- PATFETCH_RAW (c);
-
- switch (c)
- {
- case '(':
- if (syntax & RE_NO_BK_PARENS)
- goto normal_backslash;
-
- handle_open:
- bufp->re_nsub++;
- regnum++;
-
- if (COMPILE_STACK_FULL)
- {
- RETALLOC (compile_stack.stack, compile_stack.size << 1,
- compile_stack_elt_t);
- if (compile_stack.stack == NULL) return REG_ESPACE;
-
- compile_stack.size <<= 1;
- }
-
- /* These are the values to restore when we hit end of this
- group. They are all relative offsets, so that if the
- whole pattern moves because of realloc, they will still
- be valid. */
- COMPILE_STACK_TOP.begalt_offset = begalt - bufp->buffer;
- COMPILE_STACK_TOP.fixup_alt_jump
- = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0;
- COMPILE_STACK_TOP.laststart_offset = b - bufp->buffer;
- COMPILE_STACK_TOP.regnum = regnum;
-
- /* We will eventually replace the 0 with the number of
- groups inner to this one. But do not push a
- start_memory for groups beyond the last one we can
- represent in the compiled pattern. */
- if (regnum <= MAX_REGNUM)
- {
- COMPILE_STACK_TOP.inner_group_offset = b - bufp->buffer + 2;
- BUF_PUSH_3 (start_memory, regnum, 0);
- }
-
- compile_stack.avail++;
-
- fixup_alt_jump = 0;
- laststart = 0;
- begalt = b;
- /* If we've reached MAX_REGNUM groups, then this open
- won't actually generate any code, so we'll have to
- clear pending_exact explicitly. */
- pending_exact = 0;
- break;
-
-
- case ')':
- if (syntax & RE_NO_BK_PARENS) goto normal_backslash;
-
- if (COMPILE_STACK_EMPTY)
- if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
- goto normal_backslash;
- else
- return REG_ERPAREN;
-
- handle_close:
- if (fixup_alt_jump)
- { /* Push a dummy failure point at the end of the
- alternative for a possible future
- `pop_failure_jump' to pop. See comments at
- `push_dummy_failure' in `re_match_2'. */
- BUF_PUSH (push_dummy_failure);
-
- /* We allocated space for this jump when we assigned
- to `fixup_alt_jump', in the `handle_alt' case below. */
- STORE_JUMP (jump_past_alt, fixup_alt_jump, b - 1);
- }
-
- /* See similar code for backslashed left paren above. */
- if (COMPILE_STACK_EMPTY)
- if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
- goto normal_char;
- else
- return REG_ERPAREN;
-
- /* Since we just checked for an empty stack above, this
- ``can't happen''. */
- assert (compile_stack.avail != 0);
- {
- /* We don't just want to restore into `regnum', because
- later groups should continue to be numbered higher,
- as in `(ab)c(de)' -- the second group is #2. */
- regnum_t this_group_regnum;
-
- compile_stack.avail--;
- begalt = bufp->buffer + COMPILE_STACK_TOP.begalt_offset;
- fixup_alt_jump
- = COMPILE_STACK_TOP.fixup_alt_jump
- ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1
- : 0;
- laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset;
- this_group_regnum = COMPILE_STACK_TOP.regnum;
- /* If we've reached MAX_REGNUM groups, then this open
- won't actually generate any code, so we'll have to
- clear pending_exact explicitly. */
- pending_exact = 0;
-
- /* We're at the end of the group, so now we know how many
- groups were inside this one. */
- if (this_group_regnum <= MAX_REGNUM)
- {
- unsigned char *inner_group_loc
- = bufp->buffer + COMPILE_STACK_TOP.inner_group_offset;
-
- *inner_group_loc = regnum - this_group_regnum;
- BUF_PUSH_3 (stop_memory, this_group_regnum,
- regnum - this_group_regnum);
- }
- }
- break;
-
-
- case '|': /* `\|'. */
- if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR)
- goto normal_backslash;
- handle_alt:
- if (syntax & RE_LIMITED_OPS)
- goto normal_char;
-
- /* Insert before the previous alternative a jump which
- jumps to this alternative if the former fails. */
- GET_BUFFER_SPACE (3);
- INSERT_JUMP (on_failure_jump, begalt, b + 6);
- pending_exact = 0;
- b += 3;
-
- /* The alternative before this one has a jump after it
- which gets executed if it gets matched. Adjust that
- jump so it will jump to this alternative's analogous
- jump (put in below, which in turn will jump to the next
- (if any) alternative's such jump, etc.). The last such
- jump jumps to the correct final destination. A picture:
- _____ _____
- | | | |
- | v | v
- a | b | c
-
- If we are at `b', then fixup_alt_jump right now points to a
- three-byte space after `a'. We'll put in the jump, set
- fixup_alt_jump to right after `b', and leave behind three
- bytes which we'll fill in when we get to after `c'. */
-
- if (fixup_alt_jump)
- STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
-
- /* Mark and leave space for a jump after this alternative,
- to be filled in later either by next alternative or
- when know we're at the end of a series of alternatives. */
- fixup_alt_jump = b;
- GET_BUFFER_SPACE (3);
- b += 3;
-
- laststart = 0;
- begalt = b;
- break;
-
-
- case '{':
- /* If \{ is a literal. */
- if (!(syntax & RE_INTERVALS)
- /* If we're at `\{' and it's not the open-interval
- operator. */
- || ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES))
- || (p - 2 == pattern && p == pend))
- goto normal_backslash;
-
- handle_interval:
- {
- /* If got here, then the syntax allows intervals. */
-
- /* At least (most) this many matches must be made. */
- int lower_bound = -1, upper_bound = -1;
-
- beg_interval = p - 1;
-
- if (p == pend)
- {
- if (syntax & RE_NO_BK_BRACES)
- goto unfetch_interval;
- else
- return REG_EBRACE;
- }
-
- GET_UNSIGNED_NUMBER (lower_bound);
-
- if (c == ',')
- {
- GET_UNSIGNED_NUMBER (upper_bound);
- if (upper_bound < 0) upper_bound = RE_DUP_MAX;
- }
- else
- /* Interval such as `{1}' => match exactly once. */
- upper_bound = lower_bound;
-
- if (lower_bound < 0 || upper_bound > RE_DUP_MAX
- || lower_bound > upper_bound)
- {
- if (syntax & RE_NO_BK_BRACES)
- goto unfetch_interval;
- else
- return REG_BADBR;
- }
-
- if (!(syntax & RE_NO_BK_BRACES))
- {
- if (c != '\\') return REG_EBRACE;
-
- PATFETCH (c);
- }
-
- if (c != '}')
- {
- if (syntax & RE_NO_BK_BRACES)
- goto unfetch_interval;
- else
- return REG_BADBR;
- }
-
- /* We just parsed a valid interval. */
-
- /* If it's invalid to have no preceding re. */
- if (!laststart)
- {
- if (syntax & RE_CONTEXT_INVALID_OPS)
- return REG_BADRPT;
- else if (syntax & RE_CONTEXT_INDEP_OPS)
- laststart = b;
- else
- goto unfetch_interval;
- }
-
- /* If the upper bound is zero, don't want to succeed at
- all; jump from `laststart' to `b + 3', which will be
- the end of the buffer after we insert the jump. */
- if (upper_bound == 0)
- {
- GET_BUFFER_SPACE (3);
- INSERT_JUMP (jump, laststart, b + 3);
- b += 3;
- }
-
- /* Otherwise, we have a nontrivial interval. When
- we're all done, the pattern will look like:
- set_number_at <jump count> <upper bound>
- set_number_at <succeed_n count> <lower bound>
- succeed_n <after jump addr> <succed_n count>
- <body of loop>
- jump_n <succeed_n addr> <jump count>
- (The upper bound and `jump_n' are omitted if
- `upper_bound' is 1, though.) */
- else
- { /* If the upper bound is > 1, we need to insert
- more at the end of the loop. */
- unsigned nbytes = 10 + (upper_bound > 1) * 10;
-
- GET_BUFFER_SPACE (nbytes);
-
- /* Initialize lower bound of the `succeed_n', even
- though it will be set during matching by its
- attendant `set_number_at' (inserted next),
- because `re_compile_fastmap' needs to know.
- Jump to the `jump_n' we might insert below. */
- INSERT_JUMP2 (succeed_n, laststart,
- b + 5 + (upper_bound > 1) * 5,
- lower_bound);
- b += 5;
-
- /* Code to initialize the lower bound. Insert
- before the `succeed_n'. The `5' is the last two
- bytes of this `set_number_at', plus 3 bytes of
- the following `succeed_n'. */
- insert_op2 (set_number_at, laststart, 5, lower_bound, b);
- b += 5;
-
- if (upper_bound > 1)
- { /* More than one repetition is allowed, so
- append a backward jump to the `succeed_n'
- that starts this interval.
-
- When we've reached this during matching,
- we'll have matched the interval once, so
- jump back only `upper_bound - 1' times. */
- STORE_JUMP2 (jump_n, b, laststart + 5,
- upper_bound - 1);
- b += 5;
-
- /* The location we want to set is the second
- parameter of the `jump_n'; that is `b-2' as
- an absolute address. `laststart' will be
- the `set_number_at' we're about to insert;
- `laststart+3' the number to set, the source
- for the relative address. But we are
- inserting into the middle of the pattern --
- so everything is getting moved up by 5.
- Conclusion: (b - 2) - (laststart + 3) + 5,
- i.e., b - laststart.
-
- We insert this at the beginning of the loop
- so that if we fail during matching, we'll
- reinitialize the bounds. */
- insert_op2 (set_number_at, laststart, b - laststart,
- upper_bound - 1, b);
- b += 5;
- }
- }
- pending_exact = 0;
- beg_interval = NULL;
- }
- break;
-
- unfetch_interval:
- /* If an invalid interval, match the characters as literals. */
- assert (beg_interval);
- p = beg_interval;
- beg_interval = NULL;
-
- /* normal_char and normal_backslash need `c'. */
- PATFETCH (c);
-
- if (!(syntax & RE_NO_BK_BRACES))
- {
- if (p > pattern && p[-1] == '\\')
- goto normal_backslash;
- }
- goto normal_char;
-
-#ifdef emacs
- /* There is no way to specify the before_dot and after_dot
- operators. rms says this is ok. --karl */
- case '=':
- BUF_PUSH (at_dot);
- break;
-
- case 's':
- laststart = b;
- PATFETCH (c);
- BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]);
- break;
-
- case 'S':
- laststart = b;
- PATFETCH (c);
- BUF_PUSH_2 (notsyntaxspec, syntax_spec_code[c]);
- break;
-#endif /* emacs */
-
-
- case 'w':
- laststart = b;
- BUF_PUSH (wordchar);
- break;
-
-
- case 'W':
- laststart = b;
- BUF_PUSH (notwordchar);
- break;
-
-
- case '<':
- BUF_PUSH (wordbeg);
- break;
-
- case '>':
- BUF_PUSH (wordend);
- break;
-
- case 'b':
- BUF_PUSH (wordbound);
- break;
-
- case 'B':
- BUF_PUSH (notwordbound);
- break;
-
- case '`':
- BUF_PUSH (begbuf);
- break;
-
- case '\'':
- BUF_PUSH (endbuf);
- break;
-
- case '1': case '2': case '3': case '4': case '5':
- case '6': case '7': case '8': case '9':
- if (syntax & RE_NO_BK_REFS)
- goto normal_char;
-
- c1 = c - '0';
-
- if (c1 > regnum)
- return REG_ESUBREG;
-
- /* Can't back reference to a subexpression if inside of it. */
- if (group_in_compile_stack (compile_stack, c1))
- goto normal_char;
-
- laststart = b;
- BUF_PUSH_2 (duplicate, c1);
- break;
-
-
- case '+':
- case '?':
- if (syntax & RE_BK_PLUS_QM)
- goto handle_plus;
- else
- goto normal_backslash;
-
- default:
- normal_backslash:
- /* You might think it would be useful for \ to mean
- not to translate; but if we don't translate it
- it will never match anything. */
- c = TRANSLATE (c);
- goto normal_char;
- }
- break;
-
-
- default:
- /* Expects the character in `c'. */
- normal_char:
- /* If no exactn currently being built. */
- if (!pending_exact
-
- /* If last exactn not at current position. */
- || pending_exact + *pending_exact + 1 != b
-
- /* We have only one byte following the exactn for the count. */
- || *pending_exact == (1 << BYTEWIDTH) - 1
-
- /* If followed by a repetition operator. */
- || *p == '*' || *p == '^'
- || ((syntax & RE_BK_PLUS_QM)
- ? *p == '\\' && (p[1] == '+' || p[1] == '?')
- : (*p == '+' || *p == '?'))
- || ((syntax & RE_INTERVALS)
- && ((syntax & RE_NO_BK_BRACES)
- ? *p == '{'
- : (p[0] == '\\' && p[1] == '{'))))
- {
- /* Start building a new exactn. */
-
- laststart = b;
-
- BUF_PUSH_2 (exactn, 0);
- pending_exact = b - 1;
- }
-
- BUF_PUSH (c);
- (*pending_exact)++;
- break;
- } /* switch (c) */
- } /* while p != pend */
-
-
- /* Through the pattern now. */
-
- if (fixup_alt_jump)
- STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
-
- if (!COMPILE_STACK_EMPTY)
- return REG_EPAREN;
-
- free (compile_stack.stack);
-
- /* We have succeeded; set the length of the buffer. */
- bufp->used = b - bufp->buffer;
-
-#ifdef DEBUG
- if (debug)
- {
- DEBUG_PRINT1 ("\nCompiled pattern: \n");
- print_compiled_pattern (bufp);
- }
-#endif /* DEBUG */
-
-#ifndef MATCH_MAY_ALLOCATE
- /* Initialize the failure stack to the largest possible stack. This
- isn't necessary unless we're trying to avoid calling alloca in
- the search and match routines. */
- {
- int num_regs = bufp->re_nsub + 1;
-
- /* Since DOUBLE_FAIL_STACK refuses to double only if the current size
- is strictly greater than re_max_failures, the largest possible stack
- is 2 * re_max_failures failure points. */
- fail_stack.size = (2 * re_max_failures * MAX_FAILURE_ITEMS);
- if (fail_stack.stack)
- fail_stack.stack =
- (fail_stack_elt_t *) realloc (fail_stack.stack,
- (fail_stack.size
- * sizeof (fail_stack_elt_t)));
- else
- fail_stack.stack =
- (fail_stack_elt_t *) malloc (fail_stack.size
- * sizeof (fail_stack_elt_t));
-
- /* Initialize some other variables the matcher uses. */
- RETALLOC_IF (regstart, num_regs, const char *);
- RETALLOC_IF (regend, num_regs, const char *);
- RETALLOC_IF (old_regstart, num_regs, const char *);
- RETALLOC_IF (old_regend, num_regs, const char *);
- RETALLOC_IF (best_regstart, num_regs, const char *);
- RETALLOC_IF (best_regend, num_regs, const char *);
- RETALLOC_IF (reg_info, num_regs, register_info_type);
- RETALLOC_IF (reg_dummy, num_regs, const char *);
- RETALLOC_IF (reg_info_dummy, num_regs, register_info_type);
- }
-#endif
-
- return REG_NOERROR;
-} /* regex_compile */
-
-/* Subroutines for `regex_compile'. */
-
-/* Store OP at LOC followed by two-byte integer parameter ARG. */
-
-static void
-store_op1 (op, loc, arg)
- re_opcode_t op;
- unsigned char *loc;
- int arg;
-{
- *loc = (unsigned char) op;
- STORE_NUMBER (loc + 1, arg);
-}
-
-
-/* Like `store_op1', but for two two-byte parameters ARG1 and ARG2. */
-
-static void
-store_op2 (op, loc, arg1, arg2)
- re_opcode_t op;
- unsigned char *loc;
- int arg1, arg2;
-{
- *loc = (unsigned char) op;
- STORE_NUMBER (loc + 1, arg1);
- STORE_NUMBER (loc + 3, arg2);
-}
-
-
-/* Copy the bytes from LOC to END to open up three bytes of space at LOC
- for OP followed by two-byte integer parameter ARG. */
-
-static void
-insert_op1 (op, loc, arg, end)
- re_opcode_t op;
- unsigned char *loc;
- int arg;
- unsigned char *end;
-{
- register unsigned char *pfrom = end;
- register unsigned char *pto = end + 3;
-
- while (pfrom != loc)
- *--pto = *--pfrom;
-
- store_op1 (op, loc, arg);
-}
-
-
-/* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2. */
-
-static void
-insert_op2 (op, loc, arg1, arg2, end)
- re_opcode_t op;
- unsigned char *loc;
- int arg1, arg2;
- unsigned char *end;
-{
- register unsigned char *pfrom = end;
- register unsigned char *pto = end + 5;
-
- while (pfrom != loc)
- *--pto = *--pfrom;
-
- store_op2 (op, loc, arg1, arg2);
-}
-
-
-/* P points to just after a ^ in PATTERN. Return true if that ^ comes
- after an alternative or a begin-subexpression. We assume there is at
- least one character before the ^. */
-
-static boolean
-at_begline_loc_p (pattern, p, syntax)
- const char *pattern, *p;
- reg_syntax_t syntax;
-{
- const char *prev = p - 2;
- boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\';
-
- return
- /* After a subexpression? */
- (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash))
- /* After an alternative? */
- || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash));
-}
-
-
-/* The dual of at_begline_loc_p. This one is for $. We assume there is
- at least one character after the $, i.e., `P < PEND'. */
-
-static boolean
-at_endline_loc_p (p, pend, syntax)
- const char *p, *pend;
- int syntax;
-{
- const char *next = p;
- boolean next_backslash = *next == '\\';
- const char *next_next = p + 1 < pend ? p + 1 : NULL;
-
- return
- /* Before a subexpression? */
- (syntax & RE_NO_BK_PARENS ? *next == ')'
- : next_backslash && next_next && *next_next == ')')
- /* Before an alternative? */
- || (syntax & RE_NO_BK_VBAR ? *next == '|'
- : next_backslash && next_next && *next_next == '|');
-}
-
-
-/* Returns true if REGNUM is in one of COMPILE_STACK's elements and
- false if it's not. */
-
-static boolean
-group_in_compile_stack (compile_stack, regnum)
- compile_stack_type compile_stack;
- regnum_t regnum;
-{
- int this_element;
-
- for (this_element = compile_stack.avail - 1;
- this_element >= 0;
- this_element--)
- if (compile_stack.stack[this_element].regnum == regnum)
- return true;
-
- return false;
-}
-
-
-/* Read the ending character of a range (in a bracket expression) from the
- uncompiled pattern *P_PTR (which ends at PEND). We assume the
- starting character is in `P[-2]'. (`P[-1]' is the character `-'.)
- Then we set the translation of all bits between the starting and
- ending characters (inclusive) in the compiled pattern B.
-
- Return an error code.
-
- We use these short variable names so we can use the same macros as
- `regex_compile' itself. */
-
-static reg_errcode_t
-compile_range (p_ptr, pend, translate, syntax, b)
- const char **p_ptr, *pend;
- char *translate;
- reg_syntax_t syntax;
- unsigned char *b;
-{
- unsigned this_char;
-
- const char *p = *p_ptr;
- int range_start, range_end;
-
- if (p == pend)
- return REG_ERANGE;
-
- /* Even though the pattern is a signed `char *', we need to fetch
- with unsigned char *'s; if the high bit of the pattern character
- is set, the range endpoints will be negative if we fetch using a
- signed char *.
-
- We also want to fetch the endpoints without translating them; the
- appropriate translation is done in the bit-setting loop below. */
- range_start = ((unsigned char *) p)[-2];
- range_end = ((unsigned char *) p)[0];
-
- /* Have to increment the pointer into the pattern string, so the
- caller isn't still at the ending character. */
- (*p_ptr)++;
-
- /* If the start is after the end, the range is empty. */
- if (range_start > range_end)
- return syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR;
-
- /* Here we see why `this_char' has to be larger than an `unsigned
- char' -- the range is inclusive, so if `range_end' == 0xff
- (assuming 8-bit characters), we would otherwise go into an infinite
- loop, since all characters <= 0xff. */
- for (this_char = range_start; this_char <= range_end; this_char++)
- {
- SET_LIST_BIT (TRANSLATE (this_char));
- }
-
- return REG_NOERROR;
-}
-
-/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in
- BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible
- characters can start a string that matches the pattern. This fastmap
- is used by re_search to skip quickly over impossible starting points.
-
- The caller must supply the address of a (1 << BYTEWIDTH)-byte data
- area as BUFP->fastmap.
-
- We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in
- the pattern buffer.
-
- Returns 0 if we succeed, -2 if an internal error. */
-
-int
-re_compile_fastmap (bufp)
- struct re_pattern_buffer *bufp;
-{
- int j, k;
-#ifdef MATCH_MAY_ALLOCATE
- fail_stack_type fail_stack;
-#endif
-#ifndef REGEX_MALLOC
- char *destination;
-#endif
- /* We don't push any register information onto the failure stack. */
- unsigned num_regs = 0;
-
- register char *fastmap = bufp->fastmap;
- unsigned char *pattern = bufp->buffer;
- unsigned long size = bufp->used;
- unsigned char *p = pattern;
- register unsigned char *pend = pattern + size;
-
- /* Assume that each path through the pattern can be null until
- proven otherwise. We set this false at the bottom of switch
- statement, to which we get only if a particular path doesn't
- match the empty string. */
- boolean path_can_be_null = true;
-
- /* We aren't doing a `succeed_n' to begin with. */
- boolean succeed_n_p = false;
-
- assert (fastmap != NULL && p != NULL);
-
- INIT_FAIL_STACK ();
- bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */
- bufp->fastmap_accurate = 1; /* It will be when we're done. */
- bufp->can_be_null = 0;
-
- while (p != pend || !FAIL_STACK_EMPTY ())
- {
- if (p == pend)
- {
- bufp->can_be_null |= path_can_be_null;
-
- /* Reset for next path. */
- path_can_be_null = true;
-
- p = fail_stack.stack[--fail_stack.avail];
- }
-
- /* We should never be about to go beyond the end of the pattern. */
- assert (p < pend);
-
-#ifdef SWITCH_ENUM_BUG
- switch ((int) ((re_opcode_t) *p++))
-#else
- switch ((re_opcode_t) *p++)
-#endif
- {
-
- /* I guess the idea here is to simply not bother with a fastmap
- if a backreference is used, since it's too hard to figure out
- the fastmap for the corresponding group. Setting
- `can_be_null' stops `re_search_2' from using the fastmap, so
- that is all we do. */
- case duplicate:
- bufp->can_be_null = 1;
- return 0;
-
-
- /* Following are the cases which match a character. These end
- with `break'. */
-
- case exactn:
- fastmap[p[1]] = 1;
- break;
-
-
- case charset:
- for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
- fastmap[j] = 1;
- break;
-
-
- case charset_not:
- /* Chars beyond end of map must be allowed. */
- for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
- fastmap[j] = 1;
-
- for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
- fastmap[j] = 1;
- break;
-
-
- case wordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == Sword)
- fastmap[j] = 1;
- break;
-
-
- case notwordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != Sword)
- fastmap[j] = 1;
- break;
-
-
- case anychar:
- /* `.' matches anything ... */
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- fastmap[j] = 1;
-
- /* ... except perhaps newline. */
- if (!(bufp->syntax & RE_DOT_NEWLINE))
- fastmap['\n'] = 0;
-
- /* Return if we have already set `can_be_null'; if we have,
- then the fastmap is irrelevant. Something's wrong here. */
- else if (bufp->can_be_null)
- return 0;
-
- /* Otherwise, have to check alternative paths. */
- break;
-
-
-#ifdef emacs
- case syntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
-
-
- case notsyntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
-
-
- /* All cases after this match the empty string. These end with
- `continue'. */
-
-
- case before_dot:
- case at_dot:
- case after_dot:
- continue;
-#endif /* not emacs */
-
-
- case no_op:
- case begline:
- case endline:
- case begbuf:
- case endbuf:
- case wordbound:
- case notwordbound:
- case wordbeg:
- case wordend:
- case push_dummy_failure:
- continue;
-
-
- case jump_n:
- case pop_failure_jump:
- case maybe_pop_jump:
- case jump:
- case jump_past_alt:
- case dummy_failure_jump:
- EXTRACT_NUMBER_AND_INCR (j, p);
- p += j;
- if (j > 0)
- continue;
-
- /* Jump backward implies we just went through the body of a
- loop and matched nothing. Opcode jumped to should be
- `on_failure_jump' or `succeed_n'. Just treat it like an
- ordinary jump. For a * loop, it has pushed its failure
- point already; if so, discard that as redundant. */
- if ((re_opcode_t) *p != on_failure_jump
- && (re_opcode_t) *p != succeed_n)
- continue;
-
- p++;
- EXTRACT_NUMBER_AND_INCR (j, p);
- p += j;
-
- /* If what's on the stack is where we are now, pop it. */
- if (!FAIL_STACK_EMPTY ()
- && fail_stack.stack[fail_stack.avail - 1] == p)
- fail_stack.avail--;
-
- continue;
-
-
- case on_failure_jump:
- case on_failure_keep_string_jump:
- handle_on_failure_jump:
- EXTRACT_NUMBER_AND_INCR (j, p);
-
- /* For some patterns, e.g., `(a?)?', `p+j' here points to the
- end of the pattern. We don't want to push such a point,
- since when we restore it above, entering the switch will
- increment `p' past the end of the pattern. We don't need
- to push such a point since we obviously won't find any more
- fastmap entries beyond `pend'. Such a pattern can match
- the null string, though. */
- if (p + j < pend)
- {
- if (!PUSH_PATTERN_OP (p + j, fail_stack))
- return -2;
- }
- else
- bufp->can_be_null = 1;
-
- if (succeed_n_p)
- {
- EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */
- succeed_n_p = false;
- }
-
- continue;
-
-
- case succeed_n:
- /* Get to the number of times to succeed. */
- p += 2;
-
- /* Increment p past the n for when k != 0. */
- EXTRACT_NUMBER_AND_INCR (k, p);
- if (k == 0)
- {
- p -= 4;
- succeed_n_p = true; /* Spaghetti code alert. */
- goto handle_on_failure_jump;
- }
- continue;
-
-
- case set_number_at:
- p += 4;
- continue;
-
-
- case start_memory:
- case stop_memory:
- p += 2;
- continue;
-
-
- default:
- abort (); /* We have listed all the cases. */
- } /* switch *p++ */
-
- /* Getting here means we have found the possible starting
- characters for one path of the pattern -- and that the empty
- string does not match. We need not follow this path further.
- Instead, look at the next alternative (remembered on the
- stack), or quit if no more. The test at the top of the loop
- does these things. */
- path_can_be_null = false;
- p = pend;
- } /* while p */
-
- /* Set `can_be_null' for the last path (also the first path, if the
- pattern is empty). */
- bufp->can_be_null |= path_can_be_null;
- return 0;
-} /* re_compile_fastmap */
-
-/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
- ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use
- this memory for recording register information. STARTS and ENDS
- must be allocated using the malloc library routine, and must each
- be at least NUM_REGS * sizeof (regoff_t) bytes long.
-
- If NUM_REGS == 0, then subsequent matches should allocate their own
- register data.
-
- Unless this function is called, the first search or match using
- PATTERN_BUFFER will allocate its own register data, without
- freeing the old data. */
-
-void
-re_set_registers (bufp, regs, num_regs, starts, ends)
- struct re_pattern_buffer *bufp;
- struct re_registers *regs;
- unsigned num_regs;
- regoff_t *starts, *ends;
-{
- if (num_regs)
- {
- bufp->regs_allocated = REGS_REALLOCATE;
- regs->num_regs = num_regs;
- regs->start = starts;
- regs->end = ends;
- }
- else
- {
- bufp->regs_allocated = REGS_UNALLOCATED;
- regs->num_regs = 0;
- regs->start = regs->end = (regoff_t) 0;
- }
-}
-
-/* Searching routines. */
-
-/* Like re_search_2, below, but only one string is specified, and
- doesn't let you say where to stop matching. */
-
-int
-re_search (bufp, string, size, startpos, range, regs)
- struct re_pattern_buffer *bufp;
- const char *string;
- int size, startpos, range;
- struct re_registers *regs;
-{
- return re_search_2 (bufp, NULL, 0, string, size, startpos, range,
- regs, size);
-}
-
-
-/* Using the compiled pattern in BUFP->buffer, first tries to match the
- virtual concatenation of STRING1 and STRING2, starting first at index
- STARTPOS, then at STARTPOS + 1, and so on.
-
- STRING1 and STRING2 have length SIZE1 and SIZE2, respectively.
-
- RANGE is how far to scan while trying to match. RANGE = 0 means try
- only at STARTPOS; in general, the last start tried is STARTPOS +
- RANGE.
-
- In REGS, return the indices of the virtual concatenation of STRING1
- and STRING2 that matched the entire BUFP->buffer and its contained
- subexpressions.
-
- Do not consider matching one past the index STOP in the virtual
- concatenation of STRING1 and STRING2.
-
- We return either the position in the strings at which the match was
- found, -1 if no match, or -2 if error (such as failure
- stack overflow). */
-
-int
-re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
- struct re_pattern_buffer *bufp;
- const char *string1, *string2;
- int size1, size2;
- int startpos;
- int range;
- struct re_registers *regs;
- int stop;
-{
- int val;
- register char *fastmap = bufp->fastmap;
- register char *translate = bufp->translate;
- int total_size = size1 + size2;
- int endpos = startpos + range;
-
- /* Check for out-of-range STARTPOS. */
- if (startpos < 0 || startpos > total_size)
- return -1;
-
- /* Fix up RANGE if it might eventually take us outside
- the virtual concatenation of STRING1 and STRING2. */
- if (endpos < -1)
- range = -1 - startpos;
- else if (endpos > total_size)
- range = total_size - startpos;
-
- /* If the search isn't to be a backwards one, don't waste time in a
- search for a pattern that must be anchored. */
- if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == begbuf && range > 0)
- {
- if (startpos > 0)
- return -1;
- else
- range = 1;
- }
-
- /* Update the fastmap now if not correct already. */
- if (fastmap && !bufp->fastmap_accurate)
- if (re_compile_fastmap (bufp) == -2)
- return -2;
-
- /* Loop through the string, looking for a place to start matching. */
- for (;;)
- {
- /* If a fastmap is supplied, skip quickly over characters that
- cannot be the start of a match. If the pattern can match the
- null string, however, we don't need to skip characters; we want
- the first null string. */
- if (fastmap && startpos < total_size && !bufp->can_be_null)
- {
- if (range > 0) /* Searching forwards. */
- {
- register const char *d;
- register int lim = 0;
- int irange = range;
-
- if (startpos < size1 && startpos + range >= size1)
- lim = range - (size1 - startpos);
-
- d = (startpos >= size1 ? string2 - size1 : string1) + startpos;
-
- /* Written out as an if-else to avoid testing `translate'
- inside the loop. */
- if (translate)
- while (range > lim
- && !fastmap[(unsigned char)
- translate[(unsigned char) *d++]])
- range--;
- else
- while (range > lim && !fastmap[(unsigned char) *d++])
- range--;
-
- startpos += irange - range;
- }
- else /* Searching backwards. */
- {
- register char c = (size1 == 0 || startpos >= size1
- ? string2[startpos - size1]
- : string1[startpos]);
-
- if (!fastmap[(unsigned char) TRANSLATE (c)])
- goto advance;
- }
- }
-
- /* If can't match the null string, and that's all we have left, fail. */
- if (range >= 0 && startpos == total_size && fastmap
- && !bufp->can_be_null)
- return -1;
-
- val = re_match_2 (bufp, string1, size1, string2, size2,
- startpos, regs, stop);
- if (val >= 0)
- return startpos;
-
- if (val == -2)
- return -2;
-
- advance:
- if (!range)
- break;
- else if (range > 0)
- {
- range--;
- startpos++;
- }
- else
- {
- range++;
- startpos--;
- }
- }
- return -1;
-} /* re_search_2 */
-
-/* Declarations and macros for re_match_2. */
-
-static int bcmp_translate ();
-static boolean alt_match_null_string_p (),
- common_op_match_null_string_p (),
- group_match_null_string_p ();
-
-/* This converts PTR, a pointer into one of the search strings `string1'
- and `string2' into an offset from the beginning of that string. */
-#define POINTER_TO_OFFSET(ptr) \
- (FIRST_STRING_P (ptr) \
- ? ((regoff_t) ((ptr) - string1)) \
- : ((regoff_t) ((ptr) - string2 + size1)))
-
-/* Macros for dealing with the split strings in re_match_2. */
-
-#define MATCHING_IN_FIRST_STRING (dend == end_match_1)
-
-/* Call before fetching a character with *d. This switches over to
- string2 if necessary. */
-#define PREFETCH() \
- while (d == dend) \
- { \
- /* End of string2 => fail. */ \
- if (dend == end_match_2) \
- goto fail; \
- /* End of string1 => advance to string2. */ \
- d = string2; \
- dend = end_match_2; \
- }
-
-
-/* Test if at very beginning or at very end of the virtual concatenation
- of `string1' and `string2'. If only one string, it's `string2'. */
-#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2)
-#define AT_STRINGS_END(d) ((d) == end2)
-
-
-/* Test if D points to a character which is word-constituent. We have
- two special cases to check for: if past the end of string1, look at
- the first character in string2; and if before the beginning of
- string2, look at the last character in string1. */
-#define WORDCHAR_P(d) \
- (SYNTAX ((d) == end1 ? *string2 \
- : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \
- == Sword)
-
-/* Test if the character before D and the one at D differ with respect
- to being word-constituent. */
-#define AT_WORD_BOUNDARY(d) \
- (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \
- || WORDCHAR_P (d - 1) != WORDCHAR_P (d))
-
-
-/* Free everything we malloc. */
-#ifdef MATCH_MAY_ALLOCATE
-#ifdef REGEX_MALLOC
-#define FREE_VAR(var) if (var) free (var); var = NULL
-#define FREE_VARIABLES() \
- do { \
- FREE_VAR (fail_stack.stack); \
- FREE_VAR (regstart); \
- FREE_VAR (regend); \
- FREE_VAR (old_regstart); \
- FREE_VAR (old_regend); \
- FREE_VAR (best_regstart); \
- FREE_VAR (best_regend); \
- FREE_VAR (reg_info); \
- FREE_VAR (reg_dummy); \
- FREE_VAR (reg_info_dummy); \
- } while (0)
-#else /* not REGEX_MALLOC */
-/* Some MIPS systems (at least) want this to free alloca'd storage. */
-#define FREE_VARIABLES() alloca (0)
-#endif /* not REGEX_MALLOC */
-#else
-#define FREE_VARIABLES() /* Do nothing! */
-#endif /* not MATCH_MAY_ALLOCATE */
-
-/* These values must meet several constraints. They must not be valid
- register values; since we have a limit of 255 registers (because
- we use only one byte in the pattern for the register number), we can
- use numbers larger than 255. They must differ by 1, because of
- NUM_FAILURE_ITEMS above. And the value for the lowest register must
- be larger than the value for the highest register, so we do not try
- to actually save any registers when none are active. */
-#define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH)
-#define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1)
-
-/* Matching routines. */
-
-#ifndef emacs /* Emacs never uses this. */
-/* re_match is like re_match_2 except it takes only a single string. */
-
-int
-re_match (bufp, string, size, pos, regs)
- struct re_pattern_buffer *bufp;
- const char *string;
- int size, pos;
- struct re_registers *regs;
- {
- return re_match_2 (bufp, NULL, 0, string, size, pos, regs, size);
-}
-#endif /* not emacs */
-
-
-/* re_match_2 matches the compiled pattern in BUFP against the
- the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1
- and SIZE2, respectively). We start matching at POS, and stop
- matching at STOP.
-
- If REGS is non-null and the `no_sub' field of BUFP is nonzero, we
- store offsets for the substring each group matched in REGS. See the
- documentation for exactly how many groups we fill.
-
- We return -1 if no match, -2 if an internal error (such as the
- failure stack overflowing). Otherwise, we return the length of the
- matched substring. */
-
-int
-re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
- struct re_pattern_buffer *bufp;
- const char *string1, *string2;
- int size1, size2;
- int pos;
- struct re_registers *regs;
- int stop;
-{
- /* General temporaries. */
- int mcnt;
- unsigned char *p1;
-
- /* Just past the end of the corresponding string. */
- const char *end1, *end2;
-
- /* Pointers into string1 and string2, just past the last characters in
- each to consider matching. */
- const char *end_match_1, *end_match_2;
-
- /* Where we are in the data, and the end of the current string. */
- const char *d, *dend;
-
- /* Where we are in the pattern, and the end of the pattern. */
- unsigned char *p = bufp->buffer;
- register unsigned char *pend = p + bufp->used;
-
- /* We use this to map every character in the string. */
- char *translate = bufp->translate;
-
- /* Failure point stack. Each place that can handle a failure further
- down the line pushes a failure point on this stack. It consists of
- restart, regend, and reg_info for all registers corresponding to
- the subexpressions we're currently inside, plus the number of such
- registers, and, finally, two char *'s. The first char * is where
- to resume scanning the pattern; the second one is where to resume
- scanning the strings. If the latter is zero, the failure point is
- a ``dummy''; if a failure happens and the failure point is a dummy,
- it gets discarded and the next next one is tried. */
-#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */
- fail_stack_type fail_stack;
-#endif
-#ifdef DEBUG
- static unsigned failure_id = 0;
- unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0;
-#endif
-
- /* We fill all the registers internally, independent of what we
- return, for use in backreferences. The number here includes
- an element for register zero. */
- unsigned num_regs = bufp->re_nsub + 1;
-
- /* The currently active registers. */
- unsigned lowest_active_reg = NO_LOWEST_ACTIVE_REG;
- unsigned highest_active_reg = NO_HIGHEST_ACTIVE_REG;
-
- /* Information on the contents of registers. These are pointers into
- the input strings; they record just what was matched (on this
- attempt) by a subexpression part of the pattern, that is, the
- regnum-th regstart pointer points to where in the pattern we began
- matching and the regnum-th regend points to right after where we
- stopped matching the regnum-th subexpression. (The zeroth register
- keeps track of what the whole pattern matches.) */
-#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
- const char **regstart, **regend;
-#endif
-
- /* If a group that's operated upon by a repetition operator fails to
- match anything, then the register for its start will need to be
- restored because it will have been set to wherever in the string we
- are when we last see its open-group operator. Similarly for a
- register's end. */
-#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
- const char **old_regstart, **old_regend;
-#endif
-
- /* The is_active field of reg_info helps us keep track of which (possibly
- nested) subexpressions we are currently in. The matched_something
- field of reg_info[reg_num] helps us tell whether or not we have
- matched any of the pattern so far this time through the reg_num-th
- subexpression. These two fields get reset each time through any
- loop their register is in. */
-#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */
- register_info_type *reg_info;
-#endif
-
- /* The following record the register info as found in the above
- variables when we find a match better than any we've seen before.
- This happens as we backtrack through the failure points, which in
- turn happens only if we have not yet matched the entire string. */
- unsigned best_regs_set = false;
-#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
- const char **best_regstart, **best_regend;
-#endif
-
- /* Logically, this is `best_regend[0]'. But we don't want to have to
- allocate space for that if we're not allocating space for anything
- else (see below). Also, we never need info about register 0 for
- any of the other register vectors, and it seems rather a kludge to
- treat `best_regend' differently than the rest. So we keep track of
- the end of the best match so far in a separate variable. We
- initialize this to NULL so that when we backtrack the first time
- and need to test it, it's not garbage. */
- const char *match_end = NULL;
-
- /* Used when we pop values we don't care about. */
-#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
- const char **reg_dummy;
- register_info_type *reg_info_dummy;
-#endif
-
-#ifdef DEBUG
- /* Counts the total number of registers pushed. */
- unsigned num_regs_pushed = 0;
-#endif
-
- DEBUG_PRINT1 ("\n\nEntering re_match_2.\n");
-
- INIT_FAIL_STACK ();
-
-#ifdef MATCH_MAY_ALLOCATE
- /* Do not bother to initialize all the register variables if there are
- no groups in the pattern, as it takes a fair amount of time. If
- there are groups, we include space for register 0 (the whole
- pattern), even though we never use it, since it simplifies the
- array indexing. We should fix this. */
- if (bufp->re_nsub)
- {
- regstart = REGEX_TALLOC (num_regs, const char *);
- regend = REGEX_TALLOC (num_regs, const char *);
- old_regstart = REGEX_TALLOC (num_regs, const char *);
- old_regend = REGEX_TALLOC (num_regs, const char *);
- best_regstart = REGEX_TALLOC (num_regs, const char *);
- best_regend = REGEX_TALLOC (num_regs, const char *);
- reg_info = REGEX_TALLOC (num_regs, register_info_type);
- reg_dummy = REGEX_TALLOC (num_regs, const char *);
- reg_info_dummy = REGEX_TALLOC (num_regs, register_info_type);
-
- if (!(regstart && regend && old_regstart && old_regend && reg_info
- && best_regstart && best_regend && reg_dummy && reg_info_dummy))
- {
- FREE_VARIABLES ();
- return -2;
- }
- }
-#if defined (REGEX_MALLOC)
- else
- {
- /* We must initialize all our variables to NULL, so that
- `FREE_VARIABLES' doesn't try to free them. */
- regstart = regend = old_regstart = old_regend = best_regstart
- = best_regend = reg_dummy = NULL;
- reg_info = reg_info_dummy = (register_info_type *) NULL;
- }
-#endif /* REGEX_MALLOC */
-#endif /* MATCH_MAY_ALLOCATE */
-
- /* The starting position is bogus. */
- if (pos < 0 || pos > size1 + size2)
- {
- FREE_VARIABLES ();
- return -1;
- }
-
- /* Initialize subexpression text positions to -1 to mark ones that no
- start_memory/stop_memory has been seen for. Also initialize the
- register information struct. */
- for (mcnt = 1; mcnt < num_regs; mcnt++)
- {
- regstart[mcnt] = regend[mcnt]
- = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE;
-
- REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE;
- IS_ACTIVE (reg_info[mcnt]) = 0;
- MATCHED_SOMETHING (reg_info[mcnt]) = 0;
- EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0;
- }
-
- /* We move `string1' into `string2' if the latter's empty -- but not if
- `string1' is null. */
- if (size2 == 0 && string1 != NULL)
- {
- string2 = string1;
- size2 = size1;
- string1 = 0;
- size1 = 0;
- }
- end1 = string1 + size1;
- end2 = string2 + size2;
-
- /* Compute where to stop matching, within the two strings. */
- if (stop <= size1)
- {
- end_match_1 = string1 + stop;
- end_match_2 = string2;
- }
- else
- {
- end_match_1 = end1;
- end_match_2 = string2 + stop - size1;
- }
-
- /* `p' scans through the pattern as `d' scans through the data.
- `dend' is the end of the input string that `d' points within. `d'
- is advanced into the following input string whenever necessary, but
- this happens before fetching; therefore, at the beginning of the
- loop, `d' can be pointing at the end of a string, but it cannot
- equal `string2'. */
- if (size1 > 0 && pos <= size1)
- {
- d = string1 + pos;
- dend = end_match_1;
- }
- else
- {
- d = string2 + pos - size1;
- dend = end_match_2;
- }
-
- DEBUG_PRINT1 ("The compiled pattern is: ");
- DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend);
- DEBUG_PRINT1 ("The string to match is: `");
- DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2);
- DEBUG_PRINT1 ("'\n");
-
- /* This loops over pattern commands. It exits by returning from the
- function if the match is complete, or it drops through if the match
- fails at this starting point in the input data. */
- for (;;)
- {
- DEBUG_PRINT2 ("\n0x%x: ", p);
-
- if (p == pend)
- { /* End of pattern means we might have succeeded. */
- DEBUG_PRINT1 ("end of pattern ... ");
-
- /* If we haven't matched the entire string, and we want the
- longest match, try backtracking. */
- if (d != end_match_2)
- {
- DEBUG_PRINT1 ("backtracking.\n");
-
- if (!FAIL_STACK_EMPTY ())
- { /* More failure points to try. */
- boolean same_str_p = (FIRST_STRING_P (match_end)
- == MATCHING_IN_FIRST_STRING);
-
- /* If exceeds best match so far, save it. */
- if (!best_regs_set
- || (same_str_p && d > match_end)
- || (!same_str_p && !MATCHING_IN_FIRST_STRING))
- {
- best_regs_set = true;
- match_end = d;
-
- DEBUG_PRINT1 ("\nSAVING match as best so far.\n");
-
- for (mcnt = 1; mcnt < num_regs; mcnt++)
- {
- best_regstart[mcnt] = regstart[mcnt];
- best_regend[mcnt] = regend[mcnt];
- }
- }
- goto fail;
- }
-
- /* If no failure points, don't restore garbage. */
- else if (best_regs_set)
- {
- restore_best_regs:
- /* Restore best match. It may happen that `dend ==
- end_match_1' while the restored d is in string2.
- For example, the pattern `x.*y.*z' against the
- strings `x-' and `y-z-', if the two strings are
- not consecutive in memory. */
- DEBUG_PRINT1 ("Restoring best registers.\n");
-
- d = match_end;
- dend = ((d >= string1 && d <= end1)
- ? end_match_1 : end_match_2);
-
- for (mcnt = 1; mcnt < num_regs; mcnt++)
- {
- regstart[mcnt] = best_regstart[mcnt];
- regend[mcnt] = best_regend[mcnt];
- }
- }
- } /* d != end_match_2 */
-
- DEBUG_PRINT1 ("Accepting match.\n");
-
- /* If caller wants register contents data back, do it. */
- if (regs && !bufp->no_sub)
- {
- /* Have the register data arrays been allocated? */
- if (bufp->regs_allocated == REGS_UNALLOCATED)
- { /* No. So allocate them with malloc. We need one
- extra element beyond `num_regs' for the `-1' marker
- GNU code uses. */
- regs->num_regs = MAX (RE_NREGS, num_regs + 1);
- regs->start = TALLOC (regs->num_regs, regoff_t);
- regs->end = TALLOC (regs->num_regs, regoff_t);
- if (regs->start == NULL || regs->end == NULL)
- return -2;
- bufp->regs_allocated = REGS_REALLOCATE;
- }
- else if (bufp->regs_allocated == REGS_REALLOCATE)
- { /* Yes. If we need more elements than were already
- allocated, reallocate them. If we need fewer, just
- leave it alone. */
- if (regs->num_regs < num_regs + 1)
- {
- regs->num_regs = num_regs + 1;
- RETALLOC (regs->start, regs->num_regs, regoff_t);
- RETALLOC (regs->end, regs->num_regs, regoff_t);
- if (regs->start == NULL || regs->end == NULL)
- return -2;
- }
- }
- else
- {
- /* These braces fend off a "empty body in an else-statement"
- warning under GCC when assert expands to nothing. */
- assert (bufp->regs_allocated == REGS_FIXED);
- }
-
- /* Convert the pointer data in `regstart' and `regend' to
- indices. Register zero has to be set differently,
- since we haven't kept track of any info for it. */
- if (regs->num_regs > 0)
- {
- regs->start[0] = pos;
- regs->end[0] = (MATCHING_IN_FIRST_STRING
- ? ((regoff_t) (d - string1))
- : ((regoff_t) (d - string2 + size1)));
- }
-
- /* Go through the first `min (num_regs, regs->num_regs)'
- registers, since that is all we initialized. */
- for (mcnt = 1; mcnt < MIN (num_regs, regs->num_regs); mcnt++)
- {
- if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt]))
- regs->start[mcnt] = regs->end[mcnt] = -1;
- else
- {
- regs->start[mcnt]
- = (regoff_t) POINTER_TO_OFFSET (regstart[mcnt]);
- regs->end[mcnt]
- = (regoff_t) POINTER_TO_OFFSET (regend[mcnt]);
- }
- }
-
- /* If the regs structure we return has more elements than
- were in the pattern, set the extra elements to -1. If
- we (re)allocated the registers, this is the case,
- because we always allocate enough to have at least one
- -1 at the end. */
- for (mcnt = num_regs; mcnt < regs->num_regs; mcnt++)
- regs->start[mcnt] = regs->end[mcnt] = -1;
- } /* regs && !bufp->no_sub */
-
- FREE_VARIABLES ();
- DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n",
- nfailure_points_pushed, nfailure_points_popped,
- nfailure_points_pushed - nfailure_points_popped);
- DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed);
-
- mcnt = d - pos - (MATCHING_IN_FIRST_STRING
- ? string1
- : string2 - size1);
-
- DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt);
-
- return mcnt;
- }
-
- /* Otherwise match next pattern command. */
-#ifdef SWITCH_ENUM_BUG
- switch ((int) ((re_opcode_t) *p++))
-#else
- switch ((re_opcode_t) *p++)
-#endif
- {
- /* Ignore these. Used to ignore the n of succeed_n's which
- currently have n == 0. */
- case no_op:
- DEBUG_PRINT1 ("EXECUTING no_op.\n");
- break;
-
-
- /* Match the next n pattern characters exactly. The following
- byte in the pattern defines n, and the n bytes after that
- are the characters to match. */
- case exactn:
- mcnt = *p++;
- DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt);
-
- /* This is written out as an if-else so we don't waste time
- testing `translate' inside the loop. */
- if (translate)
- {
- do
- {
- PREFETCH ();
- if (translate[(unsigned char) *d++] != (char) *p++)
- goto fail;
- }
- while (--mcnt);
- }
- else
- {
- do
- {
- PREFETCH ();
- if (*d++ != (char) *p++) goto fail;
- }
- while (--mcnt);
- }
- SET_REGS_MATCHED ();
- break;
-
-
- /* Match any character except possibly a newline or a null. */
- case anychar:
- DEBUG_PRINT1 ("EXECUTING anychar.\n");
-
- PREFETCH ();
-
- if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n')
- || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000'))
- goto fail;
-
- SET_REGS_MATCHED ();
- DEBUG_PRINT2 (" Matched `%d'.\n", *d);
- d++;
- break;
-
-
- case charset:
- case charset_not:
- {
- register unsigned char c;
- boolean not = (re_opcode_t) *(p - 1) == charset_not;
-
- DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : "");
-
- PREFETCH ();
- c = TRANSLATE (*d); /* The character to match. */
-
- /* Cast to `unsigned' instead of `unsigned char' in case the
- bit list is a full 32 bytes long. */
- if (c < (unsigned) (*p * BYTEWIDTH)
- && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
-
- p += 1 + *p;
-
- if (!not) goto fail;
-
- SET_REGS_MATCHED ();
- d++;
- break;
- }
-
-
- /* The beginning of a group is represented by start_memory.
- The arguments are the register number in the next byte, and the
- number of groups inner to this one in the next. The text
- matched within the group is recorded (in the internal
- registers data structure) under the register number. */
- case start_memory:
- DEBUG_PRINT3 ("EXECUTING start_memory %d (%d):\n", *p, p[1]);
-
- /* Find out if this group can match the empty string. */
- p1 = p; /* To send to group_match_null_string_p. */
-
- if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE)
- REG_MATCH_NULL_STRING_P (reg_info[*p])
- = group_match_null_string_p (&p1, pend, reg_info);
-
- /* Save the position in the string where we were the last time
- we were at this open-group operator in case the group is
- operated upon by a repetition operator, e.g., with `(a*)*b'
- against `ab'; then we want to ignore where we are now in
- the string in case this attempt to match fails. */
- old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
- ? REG_UNSET (regstart[*p]) ? d : regstart[*p]
- : regstart[*p];
- DEBUG_PRINT2 (" old_regstart: %d\n",
- POINTER_TO_OFFSET (old_regstart[*p]));
-
- regstart[*p] = d;
- DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p]));
-
- IS_ACTIVE (reg_info[*p]) = 1;
- MATCHED_SOMETHING (reg_info[*p]) = 0;
-
- /* This is the new highest active register. */
- highest_active_reg = *p;
-
- /* If nothing was active before, this is the new lowest active
- register. */
- if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
- lowest_active_reg = *p;
-
- /* Move past the register number and inner group count. */
- p += 2;
- break;
-
-
- /* The stop_memory opcode represents the end of a group. Its
- arguments are the same as start_memory's: the register
- number, and the number of inner groups. */
- case stop_memory:
- DEBUG_PRINT3 ("EXECUTING stop_memory %d (%d):\n", *p, p[1]);
-
- /* We need to save the string position the last time we were at
- this close-group operator in case the group is operated
- upon by a repetition operator, e.g., with `((a*)*(b*)*)*'
- against `aba'; then we want to ignore where we are now in
- the string in case this attempt to match fails. */
- old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
- ? REG_UNSET (regend[*p]) ? d : regend[*p]
- : regend[*p];
- DEBUG_PRINT2 (" old_regend: %d\n",
- POINTER_TO_OFFSET (old_regend[*p]));
-
- regend[*p] = d;
- DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p]));
-
- /* This register isn't active anymore. */
- IS_ACTIVE (reg_info[*p]) = 0;
-
- /* If this was the only register active, nothing is active
- anymore. */
- if (lowest_active_reg == highest_active_reg)
- {
- lowest_active_reg = NO_LOWEST_ACTIVE_REG;
- highest_active_reg = NO_HIGHEST_ACTIVE_REG;
- }
- else
- { /* We must scan for the new highest active register, since
- it isn't necessarily one less than now: consider
- (a(b)c(d(e)f)g). When group 3 ends, after the f), the
- new highest active register is 1. */
- unsigned char r = *p - 1;
- while (r > 0 && !IS_ACTIVE (reg_info[r]))
- r--;
-
- /* If we end up at register zero, that means that we saved
- the registers as the result of an `on_failure_jump', not
- a `start_memory', and we jumped to past the innermost
- `stop_memory'. For example, in ((.)*) we save
- registers 1 and 2 as a result of the *, but when we pop
- back to the second ), we are at the stop_memory 1.
- Thus, nothing is active. */
- if (r == 0)
- {
- lowest_active_reg = NO_LOWEST_ACTIVE_REG;
- highest_active_reg = NO_HIGHEST_ACTIVE_REG;
- }
- else
- highest_active_reg = r;
- }
-
- /* If just failed to match something this time around with a
- group that's operated on by a repetition operator, try to
- force exit from the ``loop'', and restore the register
- information for this group that we had before trying this
- last match. */
- if ((!MATCHED_SOMETHING (reg_info[*p])
- || (re_opcode_t) p[-3] == start_memory)
- && (p + 2) < pend)
- {
- boolean is_a_jump_n = false;
-
- p1 = p + 2;
- mcnt = 0;
- switch ((re_opcode_t) *p1++)
- {
- case jump_n:
- is_a_jump_n = true;
- case pop_failure_jump:
- case maybe_pop_jump:
- case jump:
- case dummy_failure_jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- if (is_a_jump_n)
- p1 += 2;
- break;
-
- default:
- /* do nothing */ ;
- }
- p1 += mcnt;
-
- /* If the next operation is a jump backwards in the pattern
- to an on_failure_jump right before the start_memory
- corresponding to this stop_memory, exit from the loop
- by forcing a failure after pushing on the stack the
- on_failure_jump's jump in the pattern, and d. */
- if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump
- && (re_opcode_t) p1[3] == start_memory && p1[4] == *p)
- {
- /* If this group ever matched anything, then restore
- what its registers were before trying this last
- failed match, e.g., with `(a*)*b' against `ab' for
- regstart[1], and, e.g., with `((a*)*(b*)*)*'
- against `aba' for regend[3].
-
- Also restore the registers for inner groups for,
- e.g., `((a*)(b*))*' against `aba' (register 3 would
- otherwise get trashed). */
-
- if (EVER_MATCHED_SOMETHING (reg_info[*p]))
- {
- unsigned r;
-
- EVER_MATCHED_SOMETHING (reg_info[*p]) = 0;
-
- /* Restore this and inner groups' (if any) registers. */
- for (r = *p; r < *p + *(p + 1); r++)
- {
- regstart[r] = old_regstart[r];
-
- /* xx why this test? */
- if ((int) old_regend[r] >= (int) regstart[r])
- regend[r] = old_regend[r];
- }
- }
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- PUSH_FAILURE_POINT (p1 + mcnt, d, -2);
-
- goto fail;
- }
- }
-
- /* Move past the register number and the inner group count. */
- p += 2;
- break;
-
-
- /* \<digit> has been turned into a `duplicate' command which is
- followed by the numeric value of <digit> as the register number. */
- case duplicate:
- {
- register const char *d2, *dend2;
- int regno = *p++; /* Get which register to match against. */
- DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno);
-
- /* Can't back reference a group which we've never matched. */
- if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno]))
- goto fail;
-
- /* Where in input to try to start matching. */
- d2 = regstart[regno];
-
- /* Where to stop matching; if both the place to start and
- the place to stop matching are in the same string, then
- set to the place to stop, otherwise, for now have to use
- the end of the first string. */
-
- dend2 = ((FIRST_STRING_P (regstart[regno])
- == FIRST_STRING_P (regend[regno]))
- ? regend[regno] : end_match_1);
- for (;;)
- {
- /* If necessary, advance to next segment in register
- contents. */
- while (d2 == dend2)
- {
- if (dend2 == end_match_2) break;
- if (dend2 == regend[regno]) break;
-
- /* End of string1 => advance to string2. */
- d2 = string2;
- dend2 = regend[regno];
- }
- /* At end of register contents => success */
- if (d2 == dend2) break;
-
- /* If necessary, advance to next segment in data. */
- PREFETCH ();
-
- /* How many characters left in this segment to match. */
- mcnt = dend - d;
-
- /* Want how many consecutive characters we can match in
- one shot, so, if necessary, adjust the count. */
- if (mcnt > dend2 - d2)
- mcnt = dend2 - d2;
-
- /* Compare that many; failure if mismatch, else move
- past them. */
- if (translate
- ? bcmp_translate (d, d2, mcnt, translate)
- : bcmp (d, d2, mcnt))
- goto fail;
- d += mcnt, d2 += mcnt;
- }
- }
- break;
-
-
- /* begline matches the empty string at the beginning of the string
- (unless `not_bol' is set in `bufp'), and, if
- `newline_anchor' is set, after newlines. */
- case begline:
- DEBUG_PRINT1 ("EXECUTING begline.\n");
-
- if (AT_STRINGS_BEG (d))
- {
- if (!bufp->not_bol) break;
- }
- else if (d[-1] == '\n' && bufp->newline_anchor)
- {
- break;
- }
- /* In all other cases, we fail. */
- goto fail;
-
-
- /* endline is the dual of begline. */
- case endline:
- DEBUG_PRINT1 ("EXECUTING endline.\n");
-
- if (AT_STRINGS_END (d))
- {
- if (!bufp->not_eol) break;
- }
-
- /* We have to ``prefetch'' the next character. */
- else if ((d == end1 ? *string2 : *d) == '\n'
- && bufp->newline_anchor)
- {
- break;
- }
- goto fail;
-
-
- /* Match at the very beginning of the data. */
- case begbuf:
- DEBUG_PRINT1 ("EXECUTING begbuf.\n");
- if (AT_STRINGS_BEG (d))
- break;
- goto fail;
-
-
- /* Match at the very end of the data. */
- case endbuf:
- DEBUG_PRINT1 ("EXECUTING endbuf.\n");
- if (AT_STRINGS_END (d))
- break;
- goto fail;
-
-
- /* on_failure_keep_string_jump is used to optimize `.*\n'. It
- pushes NULL as the value for the string on the stack. Then
- `pop_failure_point' will keep the current value for the
- string, instead of restoring it. To see why, consider
- matching `foo\nbar' against `.*\n'. The .* matches the foo;
- then the . fails against the \n. But the next thing we want
- to do is match the \n against the \n; if we restored the
- string value, we would be back at the foo.
-
- Because this is used only in specific cases, we don't need to
- check all the things that `on_failure_jump' does, to make
- sure the right things get saved on the stack. Hence we don't
- share its code. The only reason to push anything on the
- stack at all is that otherwise we would have to change
- `anychar's code to do something besides goto fail in this
- case; that seems worse than this. */
- case on_failure_keep_string_jump:
- DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump");
-
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt);
-
- PUSH_FAILURE_POINT (p + mcnt, NULL, -2);
- break;
-
-
- /* Uses of on_failure_jump:
-
- Each alternative starts with an on_failure_jump that points
- to the beginning of the next alternative. Each alternative
- except the last ends with a jump that in effect jumps past
- the rest of the alternatives. (They really jump to the
- ending jump of the following alternative, because tensioning
- these jumps is a hassle.)
-
- Repeats start with an on_failure_jump that points past both
- the repetition text and either the following jump or
- pop_failure_jump back to this on_failure_jump. */
- case on_failure_jump:
- on_failure:
- DEBUG_PRINT1 ("EXECUTING on_failure_jump");
-
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt);
-
- /* If this on_failure_jump comes right before a group (i.e.,
- the original * applied to a group), save the information
- for that group and all inner ones, so that if we fail back
- to this point, the group's information will be correct.
- For example, in \(a*\)*\1, we need the preceding group,
- and in \(\(a*\)b*\)\2, we need the inner group. */
-
- /* We can't use `p' to check ahead because we push
- a failure point to `p + mcnt' after we do this. */
- p1 = p;
-
- /* We need to skip no_op's before we look for the
- start_memory in case this on_failure_jump is happening as
- the result of a completed succeed_n, as in \(a\)\{1,3\}b\1
- against aba. */
- while (p1 < pend && (re_opcode_t) *p1 == no_op)
- p1++;
-
- if (p1 < pend && (re_opcode_t) *p1 == start_memory)
- {
- /* We have a new highest active register now. This will
- get reset at the start_memory we are about to get to,
- but we will have saved all the registers relevant to
- this repetition op, as described above. */
- highest_active_reg = *(p1 + 1) + *(p1 + 2);
- if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
- lowest_active_reg = *(p1 + 1);
- }
-
- DEBUG_PRINT1 (":\n");
- PUSH_FAILURE_POINT (p + mcnt, d, -2);
- break;
-
-
- /* A smart repeat ends with `maybe_pop_jump'.
- We change it to either `pop_failure_jump' or `jump'. */
- case maybe_pop_jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt);
- {
- register unsigned char *p2 = p;
-
- /* Compare the beginning of the repeat with what in the
- pattern follows its end. If we can establish that there
- is nothing that they would both match, i.e., that we
- would have to backtrack because of (as in, e.g., `a*a')
- then we can change to pop_failure_jump, because we'll
- never have to backtrack.
-
- This is not true in the case of alternatives: in
- `(a|ab)*' we do need to backtrack to the `ab' alternative
- (e.g., if the string was `ab'). But instead of trying to
- detect that here, the alternative has put on a dummy
- failure point which is what we will end up popping. */
-
- /* Skip over open/close-group commands.
- If what follows this loop is a ...+ construct,
- look at what begins its body, since we will have to
- match at least one of that. */
- while (1)
- {
- if (p2 + 2 < pend
- && ((re_opcode_t) *p2 == stop_memory
- || (re_opcode_t) *p2 == start_memory))
- p2 += 3;
- else if (p2 + 6 < pend
- && (re_opcode_t) *p2 == dummy_failure_jump)
- p2 += 6;
- else
- break;
- }
-
- p1 = p + mcnt;
- /* p1[0] ... p1[2] are the `on_failure_jump' corresponding
- to the `maybe_finalize_jump' of this case. Examine what
- follows. */
-
- /* If we're at the end of the pattern, we can change. */
- if (p2 == pend)
- {
- /* Consider what happens when matching ":\(.*\)"
- against ":/". I don't really understand this code
- yet. */
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT1
- (" End of pattern: change to `pop_failure_jump'.\n");
- }
-
- else if ((re_opcode_t) *p2 == exactn
- || (bufp->newline_anchor && (re_opcode_t) *p2 == endline))
- {
- register unsigned char c
- = *p2 == (unsigned char) endline ? '\n' : p2[2];
-
- if ((re_opcode_t) p1[3] == exactn && p1[5] != c)
- {
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n",
- c, p1[5]);
- }
-
- else if ((re_opcode_t) p1[3] == charset
- || (re_opcode_t) p1[3] == charset_not)
- {
- int not = (re_opcode_t) p1[3] == charset_not;
-
- if (c < (unsigned char) (p1[4] * BYTEWIDTH)
- && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
-
- /* `not' is equal to 1 if c would match, which means
- that we can't change to pop_failure_jump. */
- if (!not)
- {
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
- }
- }
- }
- else if ((re_opcode_t) *p2 == charset)
- {
- register unsigned char c
- = *p2 == (unsigned char) endline ? '\n' : p2[2];
-
- if ((re_opcode_t) p1[3] == exactn
- && ! (p2[1] * BYTEWIDTH > p1[4]
- && (p2[1 + p1[4] / BYTEWIDTH]
- & (1 << (p1[4] % BYTEWIDTH)))))
- {
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n",
- c, p1[5]);
- }
-
- else if ((re_opcode_t) p1[3] == charset_not)
- {
- int idx;
- /* We win if the charset_not inside the loop
- lists every character listed in the charset after. */
- for (idx = 0; idx < p2[1]; idx++)
- if (! (p2[2 + idx] == 0
- || (idx < p1[4]
- && ((p2[2 + idx] & ~ p1[5 + idx]) == 0))))
- break;
-
- if (idx == p2[1])
- {
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
- }
- }
- else if ((re_opcode_t) p1[3] == charset)
- {
- int idx;
- /* We win if the charset inside the loop
- has no overlap with the one after the loop. */
- for (idx = 0; idx < p2[1] && idx < p1[4]; idx++)
- if ((p2[2 + idx] & p1[5 + idx]) != 0)
- break;
-
- if (idx == p2[1] || idx == p1[4])
- {
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
- }
- }
- }
- }
- p -= 2; /* Point at relative address again. */
- if ((re_opcode_t) p[-1] != pop_failure_jump)
- {
- p[-1] = (unsigned char) jump;
- DEBUG_PRINT1 (" Match => jump.\n");
- goto unconditional_jump;
- }
- /* Note fall through. */
-
-
- /* The end of a simple repeat has a pop_failure_jump back to
- its matching on_failure_jump, where the latter will push a
- failure point. The pop_failure_jump takes off failure
- points put on by this pop_failure_jump's matching
- on_failure_jump; we got through the pattern to here from the
- matching on_failure_jump, so didn't fail. */
- case pop_failure_jump:
- {
- /* We need to pass separate storage for the lowest and
- highest registers, even though we don't care about the
- actual values. Otherwise, we will restore only one
- register from the stack, since lowest will == highest in
- `pop_failure_point'. */
- unsigned dummy_low_reg, dummy_high_reg;
- unsigned char *pdummy;
- const char *sdummy;
-
- DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n");
- POP_FAILURE_POINT (sdummy, pdummy,
- dummy_low_reg, dummy_high_reg,
- reg_dummy, reg_dummy, reg_info_dummy);
- }
- /* Note fall through. */
-
-
- /* Unconditionally jump (without popping any failure points). */
- case jump:
- unconditional_jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */
- DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt);
- p += mcnt; /* Do the jump. */
- DEBUG_PRINT2 ("(to 0x%x).\n", p);
- break;
-
-
- /* We need this opcode so we can detect where alternatives end
- in `group_match_null_string_p' et al. */
- case jump_past_alt:
- DEBUG_PRINT1 ("EXECUTING jump_past_alt.\n");
- goto unconditional_jump;
-
-
- /* Normally, the on_failure_jump pushes a failure point, which
- then gets popped at pop_failure_jump. We will end up at
- pop_failure_jump, also, and with a pattern of, say, `a+', we
- are skipping over the on_failure_jump, so we have to push
- something meaningless for pop_failure_jump to pop. */
- case dummy_failure_jump:
- DEBUG_PRINT1 ("EXECUTING dummy_failure_jump.\n");
- /* It doesn't matter what we push for the string here. What
- the code at `fail' tests is the value for the pattern. */
- PUSH_FAILURE_POINT (0, 0, -2);
- goto unconditional_jump;
-
-
- /* At the end of an alternative, we need to push a dummy failure
- point in case we are followed by a `pop_failure_jump', because
- we don't want the failure point for the alternative to be
- popped. For example, matching `(a|ab)*' against `aab'
- requires that we match the `ab' alternative. */
- case push_dummy_failure:
- DEBUG_PRINT1 ("EXECUTING push_dummy_failure.\n");
- /* See comments just above at `dummy_failure_jump' about the
- two zeroes. */
- PUSH_FAILURE_POINT (0, 0, -2);
- break;
-
- /* Have to succeed matching what follows at least n times.
- After that, handle like `on_failure_jump'. */
- case succeed_n:
- EXTRACT_NUMBER (mcnt, p + 2);
- DEBUG_PRINT2 ("EXECUTING succeed_n %d.\n", mcnt);
-
- assert (mcnt >= 0);
- /* Originally, this is how many times we HAVE to succeed. */
- if (mcnt > 0)
- {
- mcnt--;
- p += 2;
- STORE_NUMBER_AND_INCR (p, mcnt);
- DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p, mcnt);
- }
- else if (mcnt == 0)
- {
- DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n", p+2);
- p[2] = (unsigned char) no_op;
- p[3] = (unsigned char) no_op;
- goto on_failure;
- }
- break;
-
- case jump_n:
- EXTRACT_NUMBER (mcnt, p + 2);
- DEBUG_PRINT2 ("EXECUTING jump_n %d.\n", mcnt);
-
- /* Originally, this is how many times we CAN jump. */
- if (mcnt)
- {
- mcnt--;
- STORE_NUMBER (p + 2, mcnt);
- goto unconditional_jump;
- }
- /* If don't have to jump any more, skip over the rest of command. */
- else
- p += 4;
- break;
-
- case set_number_at:
- {
- DEBUG_PRINT1 ("EXECUTING set_number_at.\n");
-
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- p1 = p + mcnt;
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt);
- STORE_NUMBER (p1, mcnt);
- break;
- }
-
- case wordbound:
- DEBUG_PRINT1 ("EXECUTING wordbound.\n");
- if (AT_WORD_BOUNDARY (d))
- break;
- goto fail;
-
- case notwordbound:
- DEBUG_PRINT1 ("EXECUTING notwordbound.\n");
- if (AT_WORD_BOUNDARY (d))
- goto fail;
- break;
-
- case wordbeg:
- DEBUG_PRINT1 ("EXECUTING wordbeg.\n");
- if (WORDCHAR_P (d) && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1)))
- break;
- goto fail;
-
- case wordend:
- DEBUG_PRINT1 ("EXECUTING wordend.\n");
- if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1)
- && (!WORDCHAR_P (d) || AT_STRINGS_END (d)))
- break;
- goto fail;
-
-#ifdef emacs
-#ifdef emacs19
- case before_dot:
- DEBUG_PRINT1 ("EXECUTING before_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) >= point)
- goto fail;
- break;
-
- case at_dot:
- DEBUG_PRINT1 ("EXECUTING at_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) != point)
- goto fail;
- break;
-
- case after_dot:
- DEBUG_PRINT1 ("EXECUTING after_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) <= point)
- goto fail;
- break;
-#else /* not emacs19 */
- case at_dot:
- DEBUG_PRINT1 ("EXECUTING at_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) + 1 != point)
- goto fail;
- break;
-#endif /* not emacs19 */
-
- case syntaxspec:
- DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt);
- mcnt = *p++;
- goto matchsyntax;
-
- case wordchar:
- DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n");
- mcnt = (int) Sword;
- matchsyntax:
- PREFETCH ();
- if (SYNTAX (*d++) != (enum syntaxcode) mcnt)
- goto fail;
- SET_REGS_MATCHED ();
- break;
-
- case notsyntaxspec:
- DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt);
- mcnt = *p++;
- goto matchnotsyntax;
-
- case notwordchar:
- DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n");
- mcnt = (int) Sword;
- matchnotsyntax:
- PREFETCH ();
- if (SYNTAX (*d++) == (enum syntaxcode) mcnt)
- goto fail;
- SET_REGS_MATCHED ();
- break;
-
-#else /* not emacs */
- case wordchar:
- DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n");
- PREFETCH ();
- if (!WORDCHAR_P (d))
- goto fail;
- SET_REGS_MATCHED ();
- d++;
- break;
-
- case notwordchar:
- DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n");
- PREFETCH ();
- if (WORDCHAR_P (d))
- goto fail;
- SET_REGS_MATCHED ();
- d++;
- break;
-#endif /* not emacs */
-
- default:
- abort ();
- }
- continue; /* Successfully executed one pattern command; keep going. */
-
-
- /* We goto here if a matching operation fails. */
- fail:
- if (!FAIL_STACK_EMPTY ())
- { /* A restart point is known. Restore to that state. */
- DEBUG_PRINT1 ("\nFAIL:\n");
- POP_FAILURE_POINT (d, p,
- lowest_active_reg, highest_active_reg,
- regstart, regend, reg_info);
-
- /* If this failure point is a dummy, try the next one. */
- if (!p)
- goto fail;
-
- /* If we failed to the end of the pattern, don't examine *p. */
- assert (p <= pend);
- if (p < pend)
- {
- boolean is_a_jump_n = false;
-
- /* If failed to a backwards jump that's part of a repetition
- loop, need to pop this failure point and use the next one. */
- switch ((re_opcode_t) *p)
- {
- case jump_n:
- is_a_jump_n = true;
- case maybe_pop_jump:
- case pop_failure_jump:
- case jump:
- p1 = p + 1;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- p1 += mcnt;
-
- if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n)
- || (!is_a_jump_n
- && (re_opcode_t) *p1 == on_failure_jump))
- goto fail;
- break;
- default:
- /* do nothing */ ;
- }
- }
-
- if (d >= string1 && d <= end1)
- dend = end_match_1;
- }
- else
- break; /* Matching at this starting point really fails. */
- } /* for (;;) */
-
- if (best_regs_set)
- goto restore_best_regs;
-
- FREE_VARIABLES ();
-
- return -1; /* Failure to match. */
-} /* re_match_2 */
-
-/* Subroutine definitions for re_match_2. */
-
-
-/* We are passed P pointing to a register number after a start_memory.
-
- Return true if the pattern up to the corresponding stop_memory can
- match the empty string, and false otherwise.
-
- If we find the matching stop_memory, sets P to point to one past its number.
- Otherwise, sets P to an undefined byte less than or equal to END.
-
- We don't handle duplicates properly (yet). */
-
-static boolean
-group_match_null_string_p (p, end, reg_info)
- unsigned char **p, *end;
- register_info_type *reg_info;
-{
- int mcnt;
- /* Point to after the args to the start_memory. */
- unsigned char *p1 = *p + 2;
-
- while (p1 < end)
- {
- /* Skip over opcodes that can match nothing, and return true or
- false, as appropriate, when we get to one that can't, or to the
- matching stop_memory. */
-
- switch ((re_opcode_t) *p1)
- {
- /* Could be either a loop or a series of alternatives. */
- case on_failure_jump:
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-
- /* If the next operation is not a jump backwards in the
- pattern. */
-
- if (mcnt >= 0)
- {
- /* Go through the on_failure_jumps of the alternatives,
- seeing if any of the alternatives cannot match nothing.
- The last alternative starts with only a jump,
- whereas the rest start with on_failure_jump and end
- with a jump, e.g., here is the pattern for `a|b|c':
-
- /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6
- /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3
- /exactn/1/c
-
- So, we have to first go through the first (n-1)
- alternatives and then deal with the last one separately. */
-
-
- /* Deal with the first (n-1) alternatives, which start
- with an on_failure_jump (see above) that jumps to right
- past a jump_past_alt. */
-
- while ((re_opcode_t) p1[mcnt-3] == jump_past_alt)
- {
- /* `mcnt' holds how many bytes long the alternative
- is, including the ending `jump_past_alt' and
- its number. */
-
- if (!alt_match_null_string_p (p1, p1 + mcnt - 3,
- reg_info))
- return false;
-
- /* Move to right after this alternative, including the
- jump_past_alt. */
- p1 += mcnt;
-
- /* Break if it's the beginning of an n-th alternative
- that doesn't begin with an on_failure_jump. */
- if ((re_opcode_t) *p1 != on_failure_jump)
- break;
-
- /* Still have to check that it's not an n-th
- alternative that starts with an on_failure_jump. */
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- if ((re_opcode_t) p1[mcnt-3] != jump_past_alt)
- {
- /* Get to the beginning of the n-th alternative. */
- p1 -= 3;
- break;
- }
- }
-
- /* Deal with the last alternative: go back and get number
- of the `jump_past_alt' just before it. `mcnt' contains
- the length of the alternative. */
- EXTRACT_NUMBER (mcnt, p1 - 2);
-
- if (!alt_match_null_string_p (p1, p1 + mcnt, reg_info))
- return false;
-
- p1 += mcnt; /* Get past the n-th alternative. */
- } /* if mcnt > 0 */
- break;
-
-
- case stop_memory:
- assert (p1[1] == **p);
- *p = p1 + 2;
- return true;
-
-
- default:
- if (!common_op_match_null_string_p (&p1, end, reg_info))
- return false;
- }
- } /* while p1 < end */
-
- return false;
-} /* group_match_null_string_p */
-
-
-/* Similar to group_match_null_string_p, but doesn't deal with alternatives:
- It expects P to be the first byte of a single alternative and END one
- byte past the last. The alternative can contain groups. */
-
-static boolean
-alt_match_null_string_p (p, end, reg_info)
- unsigned char *p, *end;
- register_info_type *reg_info;
-{
- int mcnt;
- unsigned char *p1 = p;
-
- while (p1 < end)
- {
- /* Skip over opcodes that can match nothing, and break when we get
- to one that can't. */
-
- switch ((re_opcode_t) *p1)
- {
- /* It's a loop. */
- case on_failure_jump:
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- p1 += mcnt;
- break;
-
- default:
- if (!common_op_match_null_string_p (&p1, end, reg_info))
- return false;
- }
- } /* while p1 < end */
-
- return true;
-} /* alt_match_null_string_p */
-
-
-/* Deals with the ops common to group_match_null_string_p and
- alt_match_null_string_p.
-
- Sets P to one after the op and its arguments, if any. */
-
-static boolean
-common_op_match_null_string_p (p, end, reg_info)
- unsigned char **p, *end;
- register_info_type *reg_info;
-{
- int mcnt;
- boolean ret;
- int reg_no;
- unsigned char *p1 = *p;
-
- switch ((re_opcode_t) *p1++)
- {
- case no_op:
- case begline:
- case endline:
- case begbuf:
- case endbuf:
- case wordbeg:
- case wordend:
- case wordbound:
- case notwordbound:
-#ifdef emacs
- case before_dot:
- case at_dot:
- case after_dot:
-#endif
- break;
-
- case start_memory:
- reg_no = *p1;
- assert (reg_no > 0 && reg_no <= MAX_REGNUM);
- ret = group_match_null_string_p (&p1, end, reg_info);
-
- /* Have to set this here in case we're checking a group which
- contains a group and a back reference to it. */
-
- if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE)
- REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret;
-
- if (!ret)
- return false;
- break;
-
- /* If this is an optimized succeed_n for zero times, make the jump. */
- case jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- if (mcnt >= 0)
- p1 += mcnt;
- else
- return false;
- break;
-
- case succeed_n:
- /* Get to the number of times to succeed. */
- p1 += 2;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-
- if (mcnt == 0)
- {
- p1 -= 4;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- p1 += mcnt;
- }
- else
- return false;
- break;
-
- case duplicate:
- if (!REG_MATCH_NULL_STRING_P (reg_info[*p1]))
- return false;
- break;
-
- case set_number_at:
- p1 += 4;
-
- default:
- /* All other opcodes mean we cannot match the empty string. */
- return false;
- }
-
- *p = p1;
- return true;
-} /* common_op_match_null_string_p */
-
-
-/* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN
- bytes; nonzero otherwise. */
-
-static int
-bcmp_translate (s1, s2, len, translate)
- unsigned char *s1, *s2;
- register int len;
- char *translate;
-{
- register unsigned char *p1 = s1, *p2 = s2;
- while (len)
- {
- if (translate[*p1++] != translate[*p2++]) return 1;
- len--;
- }
- return 0;
-}
-
-/* Entry points for GNU code. */
-
-/* re_compile_pattern is the GNU regular expression compiler: it
- compiles PATTERN (of length SIZE) and puts the result in BUFP.
- Returns 0 if the pattern was valid, otherwise an error string.
-
- Assumes the `allocated' (and perhaps `buffer') and `translate' fields
- are set in BUFP on entry.
-
- We call regex_compile to do the actual compilation. */
-
-const char *
-re_compile_pattern (pattern, length, bufp)
- const char *pattern;
- int length;
- struct re_pattern_buffer *bufp;
-{
- reg_errcode_t ret;
-
- /* GNU code is written to assume at least RE_NREGS registers will be set
- (and at least one extra will be -1). */
- bufp->regs_allocated = REGS_UNALLOCATED;
-
- /* And GNU code determines whether or not to get register information
- by passing null for the REGS argument to re_match, etc., not by
- setting no_sub. */
- bufp->no_sub = 0;
-
- /* Match anchors at newline. */
- bufp->newline_anchor = 1;
-
- ret = regex_compile (pattern, length, re_syntax_options, bufp);
-
- return re_error_msg[(int) ret];
-}
-
-/* Entry points compatible with 4.2 BSD regex library. We don't define
- them if this is an Emacs or POSIX compilation. */
-
-#if !defined (emacs) && !defined (_POSIX_SOURCE)
-
-/* BSD has one and only one pattern buffer. */
-static struct re_pattern_buffer re_comp_buf;
-
-char *
-re_comp (s)
- const char *s;
-{
- reg_errcode_t ret;
-
- if (!s)
- {
- if (!re_comp_buf.buffer)
- return "No previous regular expression";
- return 0;
- }
-
- if (!re_comp_buf.buffer)
- {
- re_comp_buf.buffer = (unsigned char *) malloc (200);
- if (re_comp_buf.buffer == NULL)
- return "Memory exhausted";
- re_comp_buf.allocated = 200;
-
- re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
- if (re_comp_buf.fastmap == NULL)
- return "Memory exhausted";
- }
-
- /* Since `re_exec' always passes NULL for the `regs' argument, we
- don't need to initialize the pattern buffer fields which affect it. */
-
- /* Match anchors at newlines. */
- re_comp_buf.newline_anchor = 1;
-
- ret = regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf);
-
- /* Yes, we're discarding `const' here. */
- return (char *) re_error_msg[(int) ret];
-}
-
-
-int
-re_exec (s)
- const char *s;
-{
- const int len = strlen (s);
- return
- 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0);
-}
-#endif /* not emacs and not _POSIX_SOURCE */
-
-/* POSIX.2 functions. Don't define these for Emacs. */
-
-#ifndef emacs
-
-/* regcomp takes a regular expression as a string and compiles it.
-
- PREG is a regex_t *. We do not expect any fields to be initialized,
- since POSIX says we shouldn't. Thus, we set
-
- `buffer' to the compiled pattern;
- `used' to the length of the compiled pattern;
- `syntax' to RE_SYNTAX_POSIX_EXTENDED if the
- REG_EXTENDED bit in CFLAGS is set; otherwise, to
- RE_SYNTAX_POSIX_BASIC;
- `newline_anchor' to REG_NEWLINE being set in CFLAGS;
- `fastmap' and `fastmap_accurate' to zero;
- `re_nsub' to the number of subexpressions in PATTERN.
-
- PATTERN is the address of the pattern string.
-
- CFLAGS is a series of bits which affect compilation.
-
- If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we
- use POSIX basic syntax.
-
- If REG_NEWLINE is set, then . and [^...] don't match newline.
- Also, regexec will try a match beginning after every newline.
-
- If REG_ICASE is set, then we considers upper- and lowercase
- versions of letters to be equivalent when matching.
-
- If REG_NOSUB is set, then when PREG is passed to regexec, that
- routine will report only success or failure, and nothing about the
- registers.
-
- It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for
- the return codes and their meanings.) */
-
-int
-regcomp (preg, pattern, cflags)
- regex_t *preg;
- const char *pattern;
- int cflags;
-{
- reg_errcode_t ret;
- unsigned syntax
- = (cflags & REG_EXTENDED) ?
- RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC;
-
- /* regex_compile will allocate the space for the compiled pattern. */
- preg->buffer = 0;
- preg->allocated = 0;
- preg->used = 0;
-
- /* Don't bother to use a fastmap when searching. This simplifies the
- REG_NEWLINE case: if we used a fastmap, we'd have to put all the
- characters after newlines into the fastmap. This way, we just try
- every character. */
- preg->fastmap = 0;
-
- if (cflags & REG_ICASE)
- {
- unsigned i;
-
- preg->translate = (char *) malloc (CHAR_SET_SIZE);
- if (preg->translate == NULL)
- return (int) REG_ESPACE;
-
- /* Map uppercase characters to corresponding lowercase ones. */
- for (i = 0; i < CHAR_SET_SIZE; i++)
- preg->translate[i] = ISUPPER (i) ? tolower (i) : i;
- }
- else
- preg->translate = NULL;
-
- /* If REG_NEWLINE is set, newlines are treated differently. */
- if (cflags & REG_NEWLINE)
- { /* REG_NEWLINE implies neither . nor [^...] match newline. */
- syntax &= ~RE_DOT_NEWLINE;
- syntax |= RE_HAT_LISTS_NOT_NEWLINE;
- /* It also changes the matching behavior. */
- preg->newline_anchor = 1;
- }
- else
- preg->newline_anchor = 0;
-
- preg->no_sub = !!(cflags & REG_NOSUB);
-
- /* POSIX says a null character in the pattern terminates it, so we
- can use strlen here in compiling the pattern. */
- ret = regex_compile (pattern, strlen (pattern), syntax, preg);
-
- /* POSIX doesn't distinguish between an unmatched open-group and an
- unmatched close-group: both are REG_EPAREN. */
- if (ret == REG_ERPAREN) ret = REG_EPAREN;
-
- return (int) ret;
-}
-
-
-/* regexec searches for a given pattern, specified by PREG, in the
- string STRING.
-
- If NMATCH is zero or REG_NOSUB was set in the cflags argument to
- `regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at
- least NMATCH elements, and we set them to the offsets of the
- corresponding matched substrings.
-
- EFLAGS specifies `execution flags' which affect matching: if
- REG_NOTBOL is set, then ^ does not match at the beginning of the
- string; if REG_NOTEOL is set, then $ does not match at the end.
-
- We return 0 if we find a match and REG_NOMATCH if not. */
-
-int
-regexec (preg, string, nmatch, pmatch, eflags)
- const regex_t *preg;
- const char *string;
- size_t nmatch;
- regmatch_t pmatch[];
- int eflags;
-{
- int ret;
- struct re_registers regs;
- regex_t private_preg;
- int len = strlen (string);
- boolean want_reg_info = !preg->no_sub && nmatch > 0;
-
- private_preg = *preg;
-
- private_preg.not_bol = !!(eflags & REG_NOTBOL);
- private_preg.not_eol = !!(eflags & REG_NOTEOL);
-
- /* The user has told us exactly how many registers to return
- information about, via `nmatch'. We have to pass that on to the
- matching routines. */
- private_preg.regs_allocated = REGS_FIXED;
-
- if (want_reg_info)
- {
- regs.num_regs = nmatch;
- regs.start = TALLOC (nmatch, regoff_t);
- regs.end = TALLOC (nmatch, regoff_t);
- if (regs.start == NULL || regs.end == NULL)
- return (int) REG_NOMATCH;
- }
-
- /* Perform the searching operation. */
- ret = re_search (&private_preg, string, len,
- /* start: */ 0, /* range: */ len,
- want_reg_info ? &regs : (struct re_registers *) 0);
-
- /* Copy the register information to the POSIX structure. */
- if (want_reg_info)
- {
- if (ret >= 0)
- {
- unsigned r;
-
- for (r = 0; r < nmatch; r++)
- {
- pmatch[r].rm_so = regs.start[r];
- pmatch[r].rm_eo = regs.end[r];
- }
- }
-
- /* If we needed the temporary register info, free the space now. */
- free (regs.start);
- free (regs.end);
- }
-
- /* We want zero return to mean success, unlike `re_search'. */
- return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH;
-}
-
-
-/* Returns a message corresponding to an error code, ERRCODE, returned
- from either regcomp or regexec. We don't use PREG here. */
-
-size_t
-regerror (errcode, preg, errbuf, errbuf_size)
- int errcode;
- const regex_t *preg;
- char *errbuf;
- size_t errbuf_size;
-{
- const char *msg;
- size_t msg_size;
-
- if (errcode < 0
- || errcode >= (sizeof (re_error_msg) / sizeof (re_error_msg[0])))
- /* Only error codes returned by the rest of the code should be passed
- to this routine. If we are given anything else, or if other regex
- code generates an invalid error code, then the program has a bug.
- Dump core so we can fix it. */
- abort ();
-
- msg = re_error_msg[errcode];
-
- /* POSIX doesn't require that we do anything in this case, but why
- not be nice. */
- if (! msg)
- msg = "Success";
-
- msg_size = strlen (msg) + 1; /* Includes the null. */
-
- if (errbuf_size != 0)
- {
- if (msg_size > errbuf_size)
- {
- strncpy (errbuf, msg, errbuf_size - 1);
- errbuf[errbuf_size - 1] = 0;
- }
- else
- strcpy (errbuf, msg);
- }
-
- return msg_size;
-}
-
-
-/* Free dynamically allocated space used by PREG. */
-
-void
-regfree (preg)
- regex_t *preg;
-{
- if (preg->buffer != NULL)
- free (preg->buffer);
- preg->buffer = NULL;
-
- preg->allocated = 0;
- preg->used = 0;
-
- if (preg->fastmap != NULL)
- free (preg->fastmap);
- preg->fastmap = NULL;
- preg->fastmap_accurate = 0;
-
- if (preg->translate != NULL)
- free (preg->translate);
- preg->translate = NULL;
-}
-
-#endif /* not emacs */
-
-/*
-Local variables:
-make-backup-files: t
-version-control: t
-trim-versions-without-asking: nil
-End:
-*/
diff --git a/gnu/usr.bin/diff/regex.h b/gnu/usr.bin/diff/regex.h
deleted file mode 100644
index a495005..0000000
--- a/gnu/usr.bin/diff/regex.h
+++ /dev/null
@@ -1,490 +0,0 @@
-/* Definitions for data structures and routines for the regular
- expression library, version 0.12.
-
- Copyright (C) 1985, 89, 90, 91, 92, 1993 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef __REGEXP_LIBRARY_H__
-#define __REGEXP_LIBRARY_H__
-
-/* POSIX says that <sys/types.h> must be included (by the caller) before
- <regex.h>. */
-
-#ifdef VMS
-/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
- should be there. */
-#include <stddef.h>
-#endif
-
-
-/* The following bits are used to determine the regexp syntax we
- recognize. The set/not-set meanings are chosen so that Emacs syntax
- remains the value 0. The bits are given in alphabetical order, and
- the definitions shifted by one from the previous bit; thus, when we
- add or remove a bit, only one other definition need change. */
-typedef unsigned reg_syntax_t;
-
-/* If this bit is not set, then \ inside a bracket expression is literal.
- If set, then such a \ quotes the following character. */
-#define RE_BACKSLASH_ESCAPE_IN_LISTS (1)
-
-/* If this bit is not set, then + and ? are operators, and \+ and \? are
- literals.
- If set, then \+ and \? are operators and + and ? are literals. */
-#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
-
-/* If this bit is set, then character classes are supported. They are:
- [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
- [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
- If not set, then character classes are not supported. */
-#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
-
-/* If this bit is set, then ^ and $ are always anchors (outside bracket
- expressions, of course).
- If this bit is not set, then it depends:
- ^ is an anchor if it is at the beginning of a regular
- expression or after an open-group or an alternation operator;
- $ is an anchor if it is at the end of a regular expression, or
- before a close-group or an alternation operator.
-
- This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
- POSIX draft 11.2 says that * etc. in leading positions is undefined.
- We already implemented a previous draft which made those constructs
- invalid, though, so we haven't changed the code back. */
-#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
-
-/* If this bit is set, then special characters are always special
- regardless of where they are in the pattern.
- If this bit is not set, then special characters are special only in
- some contexts; otherwise they are ordinary. Specifically,
- * + ? and intervals are only special when not after the beginning,
- open-group, or alternation operator. */
-#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
-
-/* If this bit is set, then *, +, ?, and { cannot be first in an re or
- immediately after an alternation or begin-group operator. */
-#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
-
-/* If this bit is set, then . matches newline.
- If not set, then it doesn't. */
-#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
-
-/* If this bit is set, then . doesn't match NUL.
- If not set, then it does. */
-#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
-
-/* If this bit is set, nonmatching lists [^...] do not match newline.
- If not set, they do. */
-#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
-
-/* If this bit is set, either \{...\} or {...} defines an
- interval, depending on RE_NO_BK_BRACES.
- If not set, \{, \}, {, and } are literals. */
-#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
-
-/* If this bit is set, +, ? and | aren't recognized as operators.
- If not set, they are. */
-#define RE_LIMITED_OPS (RE_INTERVALS << 1)
-
-/* If this bit is set, newline is an alternation operator.
- If not set, newline is literal. */
-#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
-
-/* If this bit is set, then `{...}' defines an interval, and \{ and \}
- are literals.
- If not set, then `\{...\}' defines an interval. */
-#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
-
-/* If this bit is set, (...) defines a group, and \( and \) are literals.
- If not set, \(...\) defines a group, and ( and ) are literals. */
-#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
-
-/* If this bit is set, then \<digit> matches <digit>.
- If not set, then \<digit> is a back-reference. */
-#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
-
-/* If this bit is set, then | is an alternation operator, and \| is literal.
- If not set, then \| is an alternation operator, and | is literal. */
-#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
-
-/* If this bit is set, then an ending range point collating higher
- than the starting range point, as in [z-a], is invalid.
- If not set, then when ending range point collates higher than the
- starting range point, the range is ignored. */
-#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
-
-/* If this bit is set, then an unmatched ) is ordinary.
- If not set, then an unmatched ) is invalid. */
-#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
-
-/* This global variable defines the particular regexp syntax to use (for
- some interfaces). When a regexp is compiled, the syntax used is
- stored in the pattern buffer, so changing this does not affect
- already-compiled regexps. */
-extern reg_syntax_t re_syntax_options;
-
-/* Define combinations of the above bits for the standard possibilities.
- (The [[[ comments delimit what gets put into the Texinfo file, so
- don't delete them!) */
-/* [[[begin syntaxes]]] */
-#define RE_SYNTAX_EMACS 0
-
-#define RE_SYNTAX_AWK \
- (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS \
- | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
- | RE_UNMATCHED_RIGHT_PAREN_ORD)
-
-#define RE_SYNTAX_POSIX_AWK \
- (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)
-
-#define RE_SYNTAX_GREP \
- (RE_BK_PLUS_QM | RE_CHAR_CLASSES \
- | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
- | RE_NEWLINE_ALT)
-
-#define RE_SYNTAX_EGREP \
- (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
- | RE_NEWLINE_ALT | RE_NO_BK_PARENS \
- | RE_NO_BK_VBAR)
-
-#define RE_SYNTAX_POSIX_EGREP \
- (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)
-
-/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
-#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
-
-#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
-
-/* Syntax bits common to both basic and extended POSIX regex syntax. */
-#define _RE_SYNTAX_POSIX_COMMON \
- (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
- | RE_INTERVALS | RE_NO_EMPTY_RANGES)
-
-#define RE_SYNTAX_POSIX_BASIC \
- (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
-
-/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
- RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
- isn't minimal, since other operators, such as \`, aren't disabled. */
-#define RE_SYNTAX_POSIX_MINIMAL_BASIC \
- (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
-
-#define RE_SYNTAX_POSIX_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_VBAR \
- | RE_UNMATCHED_RIGHT_PAREN_ORD)
-
-/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS
- replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added. */
-#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS \
- | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
-/* [[[end syntaxes]]] */
-
-/* Maximum number of duplicates an interval can allow. Some systems
- (erroneously) define this in other header files, but we want our
- value, so remove any previous define. */
-#ifdef RE_DUP_MAX
-#undef RE_DUP_MAX
-#endif
-#define RE_DUP_MAX ((1 << 15) - 1)
-
-
-/* POSIX `cflags' bits (i.e., information for `regcomp'). */
-
-/* If this bit is set, then use extended regular expression syntax.
- If not set, then use basic regular expression syntax. */
-#define REG_EXTENDED 1
-
-/* If this bit is set, then ignore case when matching.
- If not set, then case is significant. */
-#define REG_ICASE (REG_EXTENDED << 1)
-
-/* If this bit is set, then anchors do not match at newline
- characters in the string.
- If not set, then anchors do match at newlines. */
-#define REG_NEWLINE (REG_ICASE << 1)
-
-/* If this bit is set, then report only success or fail in regexec.
- If not set, then returns differ between not matching and errors. */
-#define REG_NOSUB (REG_NEWLINE << 1)
-
-
-/* POSIX `eflags' bits (i.e., information for regexec). */
-
-/* If this bit is set, then the beginning-of-line operator doesn't match
- the beginning of the string (presumably because it's not the
- beginning of a line).
- If not set, then the beginning-of-line operator does match the
- beginning of the string. */
-#define REG_NOTBOL 1
-
-/* Like REG_NOTBOL, except for the end-of-line. */
-#define REG_NOTEOL (1 << 1)
-
-
-/* If any error codes are removed, changed, or added, update the
- `re_error_msg' table in regex.c. */
-typedef enum
-{
- REG_NOERROR = 0, /* Success. */
- REG_NOMATCH, /* Didn't find a match (for regexec). */
-
- /* POSIX regcomp return error codes. (In the order listed in the
- standard.) */
- REG_BADPAT, /* Invalid pattern. */
- REG_ECOLLATE, /* Not implemented. */
- REG_ECTYPE, /* Invalid character class name. */
- REG_EESCAPE, /* Trailing backslash. */
- REG_ESUBREG, /* Invalid back reference. */
- REG_EBRACK, /* Unmatched left bracket. */
- REG_EPAREN, /* Parenthesis imbalance. */
- REG_EBRACE, /* Unmatched \{. */
- REG_BADBR, /* Invalid contents of \{\}. */
- REG_ERANGE, /* Invalid range end. */
- REG_ESPACE, /* Ran out of memory. */
- REG_BADRPT, /* No preceding re for repetition op. */
-
- /* Error codes we've added. */
- REG_EEND, /* Premature end. */
- REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
- REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
-} reg_errcode_t;
-
-/* This data structure represents a compiled pattern. Before calling
- the pattern compiler, the fields `buffer', `allocated', `fastmap',
- `translate', and `no_sub' can be set. After the pattern has been
- compiled, the `re_nsub' field is available. All other fields are
- private to the regex routines. */
-
-struct re_pattern_buffer
-{
-/* [[[begin pattern_buffer]]] */
- /* Space that holds the compiled pattern. It is declared as
- `unsigned char *' because its elements are
- sometimes used as array indexes. */
- unsigned char *buffer;
-
- /* Number of bytes to which `buffer' points. */
- unsigned long allocated;
-
- /* Number of bytes actually used in `buffer'. */
- unsigned long used;
-
- /* Syntax setting with which the pattern was compiled. */
- reg_syntax_t syntax;
-
- /* Pointer to a fastmap, if any, otherwise zero. re_search uses
- the fastmap, if there is one, to skip over impossible
- starting points for matches. */
- char *fastmap;
-
- /* Either a translate table to apply to all characters before
- comparing them, or zero for no translation. The translation
- is applied to a pattern when it is compiled and to a string
- when it is matched. */
- char *translate;
-
- /* Number of subexpressions found by the compiler. */
- size_t re_nsub;
-
- /* Zero if this pattern cannot match the empty string, one else.
- Well, in truth it's used only in `re_search_2', to see
- whether or not we should use the fastmap, so we don't set
- this absolutely perfectly; see `re_compile_fastmap' (the
- `duplicate' case). */
- unsigned can_be_null : 1;
-
- /* If REGS_UNALLOCATED, allocate space in the `regs' structure
- for `max (RE_NREGS, re_nsub + 1)' groups.
- If REGS_REALLOCATE, reallocate space if necessary.
- If REGS_FIXED, use what's there. */
-#define REGS_UNALLOCATED 0
-#define REGS_REALLOCATE 1
-#define REGS_FIXED 2
- unsigned regs_allocated : 2;
-
- /* Set to zero when `regex_compile' compiles a pattern; set to one
- by `re_compile_fastmap' if it updates the fastmap. */
- unsigned fastmap_accurate : 1;
-
- /* If set, `re_match_2' does not return information about
- subexpressions. */
- unsigned no_sub : 1;
-
- /* If set, a beginning-of-line anchor doesn't match at the
- beginning of the string. */
- unsigned not_bol : 1;
-
- /* Similarly for an end-of-line anchor. */
- unsigned not_eol : 1;
-
- /* If true, an anchor at a newline matches. */
- unsigned newline_anchor : 1;
-
-/* [[[end pattern_buffer]]] */
-};
-
-typedef struct re_pattern_buffer regex_t;
-
-
-/* search.c (search_buffer) in Emacs needs this one opcode value. It is
- defined both in `regex.c' and here. */
-#define RE_EXACTN_VALUE 1
-
-/* Type for byte offsets within the string. POSIX mandates this. */
-typedef int regoff_t;
-
-
-/* This is the structure we store register match data in. See
- regex.texinfo for a full description of what registers match. */
-struct re_registers
-{
- unsigned num_regs;
- regoff_t *start;
- regoff_t *end;
-};
-
-
-/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
- `re_match_2' returns information about at least this many registers
- the first time a `regs' structure is passed. */
-#ifndef RE_NREGS
-#define RE_NREGS 30
-#endif
-
-
-/* POSIX specification for registers. Aside from the different names than
- `re_registers', POSIX uses an array of structures, instead of a
- structure of arrays. */
-typedef struct
-{
- regoff_t rm_so; /* Byte offset from string's start to substring's start. */
- regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
-} regmatch_t;
-
-/* Declarations for routines. */
-
-/* To avoid duplicating every routine declaration -- once with a
- prototype (if we are ANSI), and once without (if we aren't) -- we
- use the following macro to declare argument types. This
- unfortunately clutters up the declarations a bit, but I think it's
- worth it. */
-
-#if __STDC__
-
-#define _RE_ARGS(args) args
-
-#else /* not __STDC__ */
-
-#define _RE_ARGS(args) ()
-
-#endif /* not __STDC__ */
-
-/* Sets the current default syntax to SYNTAX, and return the old syntax.
- You can also simply assign to the `re_syntax_options' variable. */
-extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
-
-/* Compile the regular expression PATTERN, with length LENGTH
- and syntax given by the global `re_syntax_options', into the buffer
- BUFFER. Return NULL if successful, and an error string if not. */
-extern const char *re_compile_pattern
- _RE_ARGS ((const char *pattern, int length,
- struct re_pattern_buffer *buffer));
-
-
-/* Compile a fastmap for the compiled pattern in BUFFER; used to
- accelerate searches. Return 0 if successful and -2 if was an
- internal error. */
-extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
-
-
-/* Search in the string STRING (with length LENGTH) for the pattern
- compiled into BUFFER. Start searching at position START, for RANGE
- characters. Return the starting position of the match, -1 for no
- match, or -2 for an internal error. Also return register
- information in REGS (if REGS and BUFFER->no_sub are nonzero). */
-extern int re_search
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
- int length, int start, int range, struct re_registers *regs));
-
-
-/* Like `re_search', but search in the concatenation of STRING1 and
- STRING2. Also, stop searching at index START + STOP. */
-extern int re_search_2
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
- int length1, const char *string2, int length2,
- int start, int range, struct re_registers *regs, int stop));
-
-
-/* Like `re_search', but return how many characters in STRING the regexp
- in BUFFER matched, starting at position START. */
-extern int re_match
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
- int length, int start, struct re_registers *regs));
-
-
-/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
-extern int re_match_2
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
- int length1, const char *string2, int length2,
- int start, struct re_registers *regs, int stop));
-
-
-/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
- ENDS. Subsequent matches using BUFFER and REGS will use this memory
- for recording register information. STARTS and ENDS must be
- allocated with malloc, and must each be at least `NUM_REGS * sizeof
- (regoff_t)' bytes long.
-
- If NUM_REGS == 0, then subsequent matches should allocate their own
- register data.
-
- Unless this function is called, the first search or match using
- PATTERN_BUFFER will allocate its own register data, without
- freeing the old data. */
-extern void re_set_registers
- _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
- unsigned num_regs, regoff_t *starts, regoff_t *ends));
-
-/* 4.2 bsd compatibility. */
-extern char *re_comp _RE_ARGS ((const char *));
-extern int re_exec _RE_ARGS ((const char *));
-
-/* POSIX compatibility. */
-extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags));
-extern int regexec
- _RE_ARGS ((const regex_t *preg, const char *string, size_t nmatch,
- regmatch_t pmatch[], int eflags));
-extern size_t regerror
- _RE_ARGS ((int errcode, const regex_t *preg, char *errbuf,
- size_t errbuf_size));
-extern void regfree _RE_ARGS ((regex_t *preg));
-
-#endif /* not __REGEXP_LIBRARY_H__ */
-
-/*
-Local variables:
-make-backup-files: t
-version-control: t
-trim-versions-without-asking: nil
-End:
-*/
diff --git a/gnu/usr.bin/gdb/ChangeLog b/gnu/usr.bin/gdb/ChangeLog
deleted file mode 100644
index 1f2342b..0000000
--- a/gnu/usr.bin/gdb/ChangeLog
+++ /dev/null
@@ -1,4887 +0,0 @@
-Thu Feb 8 01:11:55 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu)
-
- * GDB 3.5 released.
-
- * version.c: Change version number to 3.5
-
-Tue Feb 6 15:58:06 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu)
-
- * m-hp9k320.h: define ATTACH_DETACH.
- hp9k320-dep.c [ATTACH_DETACH]: New code.
-
-Thu Feb 1 17:43:00 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu)
-
- * valprint.c (is_nan, val_print): Use char * not void *.
-
- * symmisc.c (print_symbol): Print newline after label.
-
-Tue Jan 30 15:35:52 1990 Jim Kingdon (kingdon at albert.ai.mit.edu)
-
- * Makefile.dist (READLINE): Add {readline,history}.texinfo.
-
- * m-merlin.h: Put in clarifying comments about SHELL_FILE.
- config.gdb (merlin): Explain about /usr/local/lib/gdb-sh.
-
-Sat Jan 27 02:30:27 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu)
-
- * version.c: Change version number to 3.5alpha.1.
-
- * dbxread.c (process_one_symbol): Compare context_stack_depth
- with !VARIABLES_INSIDE_BLOCK, not VARIABLES_INSIDE_BLOCK.
-
-Fri Jan 26 01:21:51 1990 Jim Kingdon (kingdon at mole.ai.mit.edu)
-
- * main.c [ALIGN_STACK_ON_STARTUP]: New code.
- m-i386.h: Define ALIGN_STACK_ON_STARTUP.
-
- * m-merlin.h (NO_SIGINTERRUPT, SHELL_FILE): Define.
-
- * umax-dep.c (exec_file_command): Add commas to call to
- read_section_hdr.
-
-Tue Jan 23 15:49:47 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu)
-
- * dbxread.c (define_symbol): Deal with deftype 'X'.
-
- * convex-dep.c (wait): Make it pid_t.
-
- * convex-dep.c (comm_registers_info): accept decimal comm register
- specification, as "i comm 32768".
-
- * dbxread.c (process_one_symbol): Make VARIABLES_INSIDE_BLOCK
- macro say by itself where variables are. Pass it desc.
- m-convex.h (VARIABLES_INSIDE_BLOCK): Nonzero for native compiler.
-
- * m-convex.h (SET_STACK_LIMIT_HUGE): Define.
- (IGNORE_SYMBOL): Take out #ifdef N_MONPT and put in 0xc4.
-
-Fri Jan 19 20:04:15 1990 Jim Kingdon (kingdon at albert.ai.mit.edu)
-
- * printcmd.c (print_frame_args): Always set highest_offset to
- current_offset when former is -1.
-
- * dbxread.c (read_struct_type): Print nice error message
- when encountering multiple inheritance.
-
-Thu Jan 18 13:43:30 1990 Jim Kingdon (kingdon at mole.ai.mit.edu)
-
- * dbxread.c (read_dbx_symtab): Always treat N_FN as a potential
- source for a x.o or -lx symbol, ignoring OFILE_FN_FLAGGED.
-
- * printcmd.c (print_frame_args): Cast -1 to (CORE_ADDR).
-
- * hp300bsd-dep.c (_initialize_hp300_dep): Get kernel_u_addr.
- m-hp300bsd.h (KERNEL_U_ADDR): Use kernel_u_addr.
-
- * infcmd.c (run_command): #if 0 out call to
- breakpoint_clear_ignore_counts.
-
-Thu Jan 11 12:58:12 1990 Jim Kingdon (kingdon at mole)
-
- * printcmd.c (print_frame_args) [STRUCT_ARG_SYM_GARBAGE]:
- Try looking up name of var before giving up & printing '?'.
-
-Wed Jan 10 14:00:14 1990 Jim Kingdon (kingdon at pogo)
-
- * many files: Move stdio.h before param.h.
-
- * sun3-dep.c (store_inferior_registers): Only try to write FP
- regs #ifdef FP0_REGNUM.
-
-Mon Jan 8 17:56:15 1990 Jim Kingdon (kingdon at pogo)
-
- * symtab.c: #if 0 out "info methods" code.
-
-Sat Jan 6 12:33:04 1990 Jim Kingdon (kingdon at pogo)
-
- * dbxread.c (read_struct_type): Set TYPE_NFN_FIELDS_TOTAL
- from all baseclasses; remove vestigial variable baseclass.
-
- * findvar.c (read_var_value): Check REG_STRUCT_HAS_ADDR.
- printcmd.c (print_frame_args): Check STRUCT_ARG_SYM_GARBAGE.
- m-sparc.h: Define REG_STRUCT_HAS_ADDR and STRUCT_ARG_SYM_GARBAGE.
-
- * blockframe.c (get_frame_block): Subtract one from pc if not
- innermost frame.
-
-Fri Dec 29 15:26:33 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * printcmd.c (print_frame_args): check highest_offset != -1, not i.
-
-Thu Dec 28 16:21:02 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * valops.c (value_struct_elt): Clean up error msg.
-
- * breakpoint.c (describe_other_breakpoints):
- Delete extra space before "also set at" and add period at end.
-
-Tue Dec 19 10:28:42 1989 Jim Kingdon (kingdon at pogo)
-
- * source.c (print_source_lines): Tell user which line number
- was out of range when printing error message.
-
-Sun Dec 17 14:14:09 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * blockframe.c (find_pc_partial_function): Use
- BLOCK_START (SYMBOL_BLOCK_VALUE (f)) instead of
- SYMBOL_VALUE (f) to get start of function.
-
- * dbxread.c: Make xxmalloc just a #define for xmalloc.
-
-Thu Dec 14 16:13:16 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * m68k-opcode.h (fseq & following fp instructions):
- Change @ to $.
-
-Fri Dec 8 19:06:44 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * breakpoint.c (breakpoint_clear_ignore_counts): New function.
- infcmd.c (run_command): Call it.
-
-Wed Dec 6 15:03:38 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * valprint.c: Change it so "array-max 0" means there is
- no limit.
-
- * expread.y (yylex): Change error message "invalid token in
- expression" to "invalid character '%c' in expression".
-
-Mon Dec 4 16:12:54 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * blockframe.c (find_pc_partial_function): Always return 1
- for success, 0 for failure, and set *NAME and *ADDRESS to
- match the return value.
-
- * dbxread.c (symbol_file_command): Use perror_with_name on
- error from stat.
- (psymtab_to_symtab, add_file_command),
- core.c (validate_files), source.c (find_source_lines),
- default-dep.c (exec_file_command): Check for errors from stat,
- fstat, and myread.
-
-Fri Dec 1 05:16:42 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * valops.c (check_field): When following pointers, just get
- their types; don't call value_ind.
-
-Thu Nov 30 14:45:29 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * config.gdb (pyr): New machine.
- core.c [REG_STACK_SEGMENT]: New code.
- dbxread.c (process_one_symbol): Cast return from copy_pending
- to long before casting to enum namespace.
- infrun.c: Split registers_info into DO_REGISTERS_INFO
- and registers_info.
- m-pyr.h, pyr-{dep.c,opcode.h,pinsn.c}: New files.
-
- * hp300bsd-dep.c: Stay in sync with default-dep.c.
-
- * m-hp300bsd.h (IN_SIGTRAMP): Define.
-
-Mon Nov 27 23:48:21 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * m-sparc.h (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE):
- Return floating point values in %f0.
-
-Tue Nov 21 00:34:46 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * dbxread.c (read_type): #if 0 out code which skips to
- comma following x-ref.
-
-Sat Nov 18 20:10:54 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * valprint.c (val_print): Undo changes of Nov 11 & 16.
- (print_string): Add parameter force_ellipses.
- (val_print): Pass force_ellipses true when we stop fetching string
- before we get to the end, else pass false.
-
-Thu Nov 16 11:59:50 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * infrun.c (restore_inferior_status): Don't try to restore
- selected frame if the inferior no longer exists.
-
- * valprint.c (val_print): Rewrite string printing code not to
- call print_string.
-
- * Makefile.dist (clean): Remove xgdb and xgdb.o.
-
-Tue Nov 14 12:41:47 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * Makefile.dist (XGDB, bindir, xbindir, install, all): New stuff.
-
-Sat Nov 11 15:29:38 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * valprint.c (val_print): chars_to_get: New variable.
-
-Thu Nov 9 12:31:47 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * main.c (main): Process "-help" as a switch that doesn't
- take an argument.
-
-Wed Nov 8 13:07:02 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * Makefile.dist (gdb.tar.Z): Add "else true".
-
-Tue Nov 7 12:25:14 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * infrun.c (restore_inferior_status): Don't dereference fid if NULL.
-
- * config.gdb (sun3, sun4): Accept "sun3" and "sun4".
-
-Mon Nov 6 09:49:23 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * Makefile.dist (Makefile): Move comments after commands.
-
- * *-dep.c [READ_COFF_SYMTAB]: Pass optional header size to
- read_section_hdr().
-
- * inflow.c: Include <fcntl.h> regardless of USG.
-
- * coffread.c (read_section_hdr): Add optional_header_size.
- (symbol_file_command): Pass optional header size to
- read_section_hdr().
- (read_coff_symtab): Initialize filestring.
-
- * version.c: Change version to 3.4.xxx.
-
- * GDB 3.4 released.
-
-Sun Nov 5 11:39:01 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * version.c: Change version to 3.4.
-
- * symtab.c (decode_line_1): Only skip past "struct" if it
- is there.
-
- * valops.c (value_ind), eval.c (evaluate_subexp, case UNOP_IND):
- Have "*" <int-valued-exp> return an int, not a LONGEST.
-
- * utils.c (fprintf_filtered): Pass arg{4,5,6} to sprintf.
-
- * printcmd.c (x_command): Use variable itself rather
- than treating it as a pointer only if it is a function.
- (See comment "this makes x/i main work").
-
- * coffread.c (symbol_file_command): Use error for
- "%s does not have a symbol-table.\n".
-
-Wed Nov 1 19:56:18 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * dbxread.c [BELIEVE_PCC_PROMOTION_TYPE]: New code.
- m-sparc.h: Define BELIEVE_PCC_PROMOTION_TYPE.
-
-Thu Oct 26 12:45:00 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * infrun.c: Include <sys/dir.h>.
-
- * dbxread.c (read_dbx_symtab, case N_LSYM, case 'T'):
- Check for enum types and put constants in psymtab.
-
-Mon Oct 23 15:02:25 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * dbxread.c (define_symbol, read_dbx_symtab): Handle enum
- constants (e.g. "b:c=e6,0").
-
-Thu Oct 19 14:57:26 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * stack.c (frame_info): Use FRAME_ARGS_ADDRESS_CORRECT
- m-vax.h (FRAME_ARGS_ADDRESS_CORRECT): New macro.
- (FRAME_ARGS_ADDRESS): Restore old meaning.
-
- * frame.h (Frame_unknown): New macro.
- stack.c (frame_info): Check for Frame_unknown return from
- FRAME_ARGS_ADDRESS.
- m-vax.h (FRAME_ARGS_ADDRESS): Sometimes return Frame_unknown.
-
- * utils.c (fatal_dump_core): Add "internal error" to message.
-
- * infrun.c (IN_SIGTRAMP): New macro.
- (wait_for_inferior): Use IN_SIGTRAMP.
- m-vax.h (IN_SIGTRAMP): New macro.
-
-Wed Oct 18 15:09:22 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * config.gdb, Makefile.dist: Shorten m-i386-sv32.h.
-
- * coffread.c (symbol_file_command): Pass 0 to select_source_symtab.
-
-Tue Oct 17 12:24:41 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * i386-dep.c (i386_frame_num_args): Take function from m-i386.h
- file. Check for pfi null.
- m-i386.h (FRAME_NUM_ARGS): Use i386_frame_num_args.
-
- * infrun.c (wait_for_inferior): set stop_func_name to 0
- before calling find_pc_partial_function.
-
-Thu Oct 12 01:08:50 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * breakpoint.c (_initialize_breakpoint): Add "disa".
-
- * Makefile.dist: Add GLOBAL_CFLAGS and pass to readline.
-
- * config.gdb (various): "$machine =" -> "machine =".
-
-Wed Oct 11 11:54:31 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * inflow.c (try_writing_regs): #if 0 out this function.
-
- * main.c (main): Add "-help" option.
-
- * dbxread.c (read_dbx_symtab): Merge code for N_FUN with
- N_STSYM, etc.
-
-Mon Oct 9 14:21:55 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * inflow.c (try_writing_regs_command): Don't write past end
- of struct user.
-
- * dbxread.c (read_struct_type): #if 0 out code which checks for
- bitpos and bitsize 0.
-
- * config.gdb: Accept sequent-i386 (not seq386).
- (symmetry): Set depfile and paramfile.
-
- * m-convex.h (IGNORE_SYMBOL): Check for N_MONPT if defined.
-
-Thu Oct 5 10:14:26 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * default-dep.c (read_inferior_memory): Put #if 0'd out comment
- within /* */.
-
-Wed Oct 4 18:44:41 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * config.gdb: Change /dev/null to m-i386.h for various
- 386 machine "opcodefile" entries.
-
- * config.gdb: Accept seq386 for sequent symmetry.
-
-Mon Oct 2 09:59:50 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * hp300bsd-dep.c: Fix copyright notice.
-
-Sun Oct 1 16:25:30 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * Makefile.dist (DEPFILES): Add isi-dep.c.
-
- * default-dep.c (read_inferior_memory): Move #endif after else.
-
-Sat Sep 30 12:50:16 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * version.c: Change version number to 3.3.xxx.
-
- * GDB 3.3 released.
-
- * version.c: Change version number to 3.3.
-
- * Makefile.dist (READLINE): Add vi_mode.c
-
- * config.gdb (i386): Change /dev/null to m-i386.h
-
- * config.gdb: Add ';;' before 'esac'.
-
- * Makefile.dist (gdb.tar.Z): Move comment above dependency.
-
- * dbxread.c (read_ofile_symtab): Check symbol before start
- of source file for GCC_COMPILED_FLAG_SYMBOL.
- (start_symtab): Don't clear processing_gcc_compilation.
-
-Thu Sep 28 22:30:23 1989 Roland McGrath (roland at hobbes.ai.mit.edu)
-
- * valprint.c (print_string): If LENGTH is zero, print "".
-
-Wed Sep 27 10:15:10 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * config.gdb: "rm tmp.c" -> "rm -f tmp.c".
-
-Tue Sep 26 13:02:10 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * utils.c (_initialize_utils): Use termcap to set lines_per_page
- and chars_per_line.
-
-Mon Sep 25 10:06:43 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * dbxread.c (read_dbx_symtab, N_SOL): Do not add the same file
- more than once.
-
-Thu Sep 21 12:43:18 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * infcmd.c (unset_environment_command): Delete all variables
- if called with no arg.
-
- * remote.c, inferior.h (remote_{read,write}_inferior_memory):
- New functions.
- core.c ({read,write}_memory): Use remote_{read,write}_inferior_memory.
-
- * valops.c (call_function): When reserving stack space for
- arguments, call value_arg_coerce.
-
- * m-hp9k320.h: define BROKEN_LARGE_ALLOCA.
-
- * breakpoint.c (delete_command): Ask for confirmation only
- when there are breakpoints.
-
- * dbxread.c (read_struct_type): If lookup_basetype_type has
- copied a stub type, call add_undefined_type.
-
- * sparc_pinsn.c (compare_opcodes): Check for "1+i" anywhere
- in args.
-
- * val_print.c (type_print_base): Print stub types as
- "<incomplete type>".
-
-Wed Sep 20 07:32:00 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * sparc-opcode.h (swapa): Remove i bit from match.
- (all alternate space instructions): Delete surplus "foo rs1+0"
- patterns.
-
- * Makefile.dist (LDFLAGS): Set to $(CFLAGS).
-
- * remote-multi.shar (remote_utils.c, putpkt): Change csum to unsigned.
-
-Tue Sep 19 14:15:16 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * sparc-opcode.h: Set i bit in lose for many instructions which
- aren't immediate.
-
- * stack.c (print_frame_info): add "func = 0".
-
-Mon Sep 18 16:19:48 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * sparc-opcode.h (mov): Add mov to/from %tbr, %psr, %wim.
-
- * sparc-opcode.h (rett): Fix notation to use suggested assembler
- syntax from architecture manual.
-
- * symmetry-dep.c (I386_REGNO_TO_SYMMETRY): New macro.
- (i386_frame_find_saved_regs): Use I386_REGNO_TO_SYMMETRY.
-
-Sat Sep 16 22:21:17 1989 Jim Kingdon (kingdon at spiff)
-
- * remote.c (remote_close): Set remote_desc to -1.
-
- * gdb.texinfo (Output): Fix description of echo to match
- reality and ANSI C.
-
-Fri Sep 15 14:28:59 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * symtab.c (lookup_symbol): Add comment about "asm".
-
- * sparc-pinsn.c: Use NUMOPCODES.
-
- * sparc-opcode.h (NUMOPCODES): Use sparc_opcodes[0] not *sparc_opcodes.
-
-Thu Sep 14 15:25:20 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * dbxread.c (xxmalloc): Print error message before calling abort().
-
- * infrun.c (wait_for_inferior): Check for {stop,prev}_func_name
- null before passing to strcmp.
-
-Wed Sep 13 12:34:15 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * sparc-opcode.h: New field delayed.
- sparc-pinsn.c (is_delayed_branch): New function.
- (print_insn): Check for delayed branches.
-
- * stack.c (print_frame_info): Use misc_function_vector in
- case where ar truncates file names.
-
-Tue Sep 12 00:16:14 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * convex-dep.c (psw_info): Move "struct pswbit *p" with declarations.
-
-Mon Sep 11 14:59:57 1989 Jim Kingdon (kingdon at spiff)
-
- * convex-dep.c (core_file_command): Delete redundant printing
- of "Program %s".
-
- * m-convex.h (ENTRY_POINT): New macro.
-
- * m-convex.h (FRAME_CHAIN_VALID): Change outside_first_object_file
- to outside_startup_file
-
- * main.c: #if 0 out catch_termination and related code.
-
- * command.c (lookup_cmd_1): Consider underscores part of
- command names.
-
-Sun Sep 10 09:20:12 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * printcmd.c: Change asdump_command to disassemble_command
- (_initialize_printcmd): Change asdump to diassemble.
-
- * main.c (main): Exit with code 0 if we hit the end of a batch
- file.
-
- * Makefile.dist (libreadline.a): Fix syntax of "CC=${CC}".
-
-Sat Sep 9 01:07:18 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * values.c (history_info): Renamed to value_history_info.
- Command renamed to "info value" (with "info history" still
- accepted).
-
- * sparc-pinsn.c (print_insn): Extend symbolic address printing
- to cover "sethi" following by an insn which uses 1+i.
-
-Fri Sep 8 14:24:01 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * m-hp9k320.h, m-hp300bsd.h, m-altos.h, m-sparc.h, m-sun3.h
- (READ_GDB_SYMSEGS): Remove.
- dbxread.c [READ_GDB_SYMSEGS]: Remove code to read symsegs.
-
- * sparc-pinsn.c (print_insn): Detect "sethi-or" pairs and
- print symbolic address.
-
- * sparc-opcode.h (sethi, set): Change lose from 0xc0000000 to
- 0xc0c00000000.
-
- * remote.c (remote_desc): Initialize to -1.
-
- * Makefile.dist (libreadline.a): Pass CC='${CC}' to readline makefile.
-
-Thu Sep 7 00:07:17 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * dbxread.c (read_struct_type): Check for static member functions.
- values.c, eval.c, valarith.c, valprint.c, valops.c: Merge changes
- from Tiemann for static member functions.
-
- * sparc-opcode.h (tst): Fix all 3 patterns.
-
- * Makefile.dist (gdb1): New rule.
-
- * sparc-opcode.h: Change comment about what the disassembler
- does with the order of the opcodes.
-
- * sparc-pinsn.c (compare_opcodes): Put 1+i before i+1.
- Also fix mistaken comment about preserving order of original table.
-
- * sparc-opcode.h (clr, mov): Fix incorrect lose entries.
-
- * m-symmetry.h (FRAME_NUM_ARGS): Add check to deal with code that
- GCC sometimes generates.
-
- * config.gdb: Change all occurances of "skip" to "/dev/null".
-
- * README (about languages other than C): Update comments about
- Pascal and FORTRAN.
-
- * sparc-opcode.h (nop): Change lose from 0xae3fffff to 0xfe3fffff.
-
- * values.c (value_virtual_fn_field): #if 0-out assignment to
- VALUE_TYPE(vtbl).
-
-Wed Sep 6 12:19:22 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * utils.c (fatal_dump_core): New function.
- Makefile.dist (MALLOC_FLAGS): use -Dbotch=fatal_dump_core
-
-Tue Sep 5 15:47:18 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * breakpoint.c (enable_command): With no arg, enable all bkpts.
-
- * Makefile.dist (Makefile): Remove \"'s around $(MD).
-
- * Makefile.dist: In "cd readline; make . . ." change first
- SYSV_DEFINE to SYSV.
-
- * m68k-pinsn.c (_initialize_pinsn): Use alternate assembler
- syntax #ifdef HPUX_ASM
-
-Sat Sep 2 23:24:43 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * values.c (history_info): Don't check num_exp[0] if num_exp
- is nil (just like recent editing_info change).
-
-Fri Sep 1 19:19:01 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * gdb.texinfo (inc-history, inc-readline): Copy in the inc-* files
- because people might not have makeinfo.
-
- * README (xgdb): Strengthen nasty comments.
-
- * gdb.texinfo: Change @setfilename to "gdb.info".
-
-Thu Aug 31 17:23:50 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * main.c (editing_info): Don't check arg[0] if arg is null.
-
- * m-vax.h: Add comment about known sigtramp bug.
-
- * sun3-dep.c, sparc-dep.c (IS_OBJECT_FILE, exec_file_command):
- Get right text & data addresses for .o files.
-
-Wed Aug 30 13:54:19 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * utils.c (tilde_expand): Remove function (it's in readline).
-
- * sparc-opcode.h (call): Change "8" to "9" in first two
- patterns (%g7->%o7).
-
-Tue Aug 29 16:44:41 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * printcmd.c (whatis_command): Change 4th arg to type_print
- from 1 to -1.
-
-Mon Aug 28 12:22:41 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * dbxread.c (psymtab_to_symtab_1): In "and %s ..." change
- pst->filename to pst->dependencies[i]->filename.
-
- * blockframe.c (FRAMELESS_LOOK_FOR_PROLOGUE): New macro
- made from FRAMELESS_FUNCTION_INVOCATION from m-sun3.h except
- that it checks for zero return from get_pc_function_start.
- m-hp9k320.h, m-hp300bsd.h, m-i386.h, m-isi.h, m-altos.h,
- m-news.h, m-sparc.h, m-sun2.h, m-sun3.h, m-symmetry.h
- (FRAMELESS_FUNCTION_INVOCATION): Use FRAMELESS_LOOK_FOR_PROLOGUE.
-
- * dbxread.c (read_struct_type): Give warning and ignore field
- if bitpos and bitsize are zero.
-
-Sun Aug 27 04:55:20 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * dbxread.c (psymtab_to_symtab{,_1}): Print message about
- reading in symbols before reading stringtab, not after.
-
-Sat Aug 26 02:01:53 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * dbxread.c (IS_OBJECT_FILE, ADDR_OF_TEXT_SEGMENT): New macros.
- (read_dbx_symtab): Use text_addr & text_size to set end_of_text_addr.
- (symbol_file_command): pass text_addr & text_size to read_dbx_symtab.
-
-Fri Aug 25 23:08:13 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * valprint.c (value_print): Try to give the name of function
- pointed to when printing a function pointer.
-
-Thu Aug 24 23:18:40 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * core.c (xfer_core_file): In cases where MEMADDR is above the
- largest address that makes sense, set i to len.
-
-Thu Aug 24 16:04:17 1989 Roland McGrath (roland at hobbes.ai.mit.edu)
-
- * valprint.c (print_string): New function to print a character
- string, doing array-max limiting and repeat count processing.
- (val_print, value_print): Use print_string.
- (REPEAT_COUNT_THRESHOLD): New #define, the max number of elts to print
- without using a repeat count. Set to ten.
- (value_print, val_print): Use REPEAT_COUNT_THRESHOLD.
-
- * utils.c (printchar): Use {fputs,fprintf}_filtered.
-
- * valprint.c (val_print): Pass the repeat count arg to the
- fprintf_filtered call for "<repeats N times>" messages.
-
-Wed Aug 23 22:53:47 1989 Roland McGrath (roland at hobbes.ai.mit.edu)
-
- * utils.c: Include <pwd.h>.
-
- * main.c: Declare free.
-
-Wed Aug 23 05:05:59 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * utils.c, defs.h: Add tilde_expand.
- source.c (directory_command),
- main.c (cd_command),
- main.c (set_history_filename),
- dbxread.c (symbol_file_command),
- coffread.c (symbol_file_command),
- dbxread.c (add_file_command),
- symmisc.c (print_symtabs),
- *-dep.c (exec_file_command, core_file_command),
- main.c (source_command): Use tilde_expand.
-
- * dbxread.c (read_type): When we get a cross-reference, resolve
- it immediately if possible, only calling add_undefined_type if
- necessary.
-
- * gdb.texinfo: Uncomment @includes and put comment at start
- of file telling people to use makeinfo.
-
- * valprint.c (type_print_base): Print the right thing for
- bitfields.
-
- * config.gdb (sun3os3): Set paramfile and depfile.
-
-Tue Aug 22 05:38:36 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * dbxread.c (symbol_file_command): Pass string table size to
- read_dbx_symtab().
- (read_dbx_symtab): Before indexing into string table, check
- string table index for reasonableness.
- (psymtab_to_symtab{,_1}, read_ofile_symtab): Same.
-
-Tue Aug 22 04:04:39 1989 Roland McGrath (roland at hobbes.ai.mit.edu)
-
- * m68k-pinsn.c: Replaced many calls to fprintf and fputs with
- calls to fprintf_filtered and fputs_filtered.
- (print_insn_arg): Use normal MIT 68k syntax for postincrement,
- predecrement, and register indirect addressing modes.
-
-Mon Aug 21 10:08:02 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * main.c (initialize_signals): Set signal handler for SIGQUIT
- and SIGHUP to do_nothing.
-
- * ns32k-opcode.h (ord): Change 1D1D to 1D2D.
-
- * ns32k-pinsn.c (print_insn_arg, print_insn): Handle index
- bytes correctly.
-
- * ns32k-opcode.h: Add comments.
-
- * dbxread.c (read_type): Put enum fields in type.fields in order
- that they were found in the debugging symbols (not reverse order).
-
-Sun Aug 20 21:17:13 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * main.c (source_command): Read .gdbinit if run without argument.
-
- * source.c (directory_command): Only print "foo already in path"
- if from_tty.
-
- * version.c: Change version number to 3.2.xxx
-
-Sat Aug 19 00:24:08 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * m-news.h: Define HAVE_WAIT_STRUCT.
-
- * m-isi.h, isi-dep.c: Replace with new version from Adam de Boor.
- config.gdb: Remove isibsd43.
-
- * main.c (catch_termination): Don't say we have written
- .gdb_history until after we really have.
-
- * convex-dep.c (attach): Add "sleep (1)".
- (write_vector_register): Use "LL" with long long constant.
- (wait): Close comment.
- (wait): Change "unix 7.1 bug" to "unix 7.1 feature" & related
- changes in comment.
- (scan_stack): And fp with 0x80000000 in while loop test.
- (core_file_command): Move code to set COREFILE.
- (many places): Change printf to printf_filtered.
- (psw_info): Allow argument giving value to print as a psw.
- (_initialize_convex_dep): Update docstrings.
-
- * m-convex.h (WORDS_BIG_ENDIAN): Correct typo ("WRODS")
- define NO_SIGINTERRUPT.
- define SET_STACK_LIMIT_HUGE.
- add "undef BUILTIN_TYPE_LONGEST" before defining it.
- Use "LL" after constants in CALL_DUMMY.
-
- * dbxread.c: In the 3 places it says error "ridiculous string
- table size"... delete extra parameter to error.
-
- * dbxread.c (scan_file_globals): Check for FORTRAN common block.
- Allow multiple references for the sake of common blocks.
-
- * main.c (initialize_main): Set history_filename to include
- current directory.
-
- * valprint.c (decode_format): Don't return a defaulted size
- field if osize is zero.
-
- * gdb.texinfo (Compilation): Update information on -gg symbols.
- Document problem with ar.
-
-Fri Aug 18 19:45:20 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * valprint.c (val_print, value_print): Add "<repeats %d times>" code.
- Also put "..." outside quotes for strings.
-
- * main.c (initialize_main): Add comment about history output file
- being different from history input file.
-
- * m-newsos3.h: Undefine NO_SIGINTERRUPT. Rearrange a few comments.
-
- * m-newsos3.h (REGISTER_U_ADDR): Use new version from Hikichi.
-
- * sparc-opcode.h: Add comment clarifying meaning of the order of
- the entries in sparc_opcodes.
-
- * eval.c (evaluate_subexp, case UNOP_IND): Deal with deferencing
- things that are not pointers.
-
- * valops.c (value_ind): Make dereferencing an int give a LONGEST.
-
- * expprint.c (print_subexp): Add (int) cast in OP_LAST case.
-
- * dbxread.c (read_array_type): Set lower and upper if adjustable.
-
- * symtab.c (lookup_symbol): Don't abort if symbol found in psymtab
- but not in symtab.
-
-Thu Aug 17 15:51:20 1989 Randy Smith (randy at hobbes.ai.mit.edu)
-
- * config.gdb: Changed "Makefile.c" to "Makefile.dist".
-
-Thu Aug 17 01:58:04 1989 Roland McGrath (roland at apple-gunkies.ai.mit.edu)
-
- * sparc-opcode.h (or): Removed incorrect lose bit 0x08000000.
- [many]: Changed many `lose' entries to have the 0x10 bit set, so
- they don't think %l0 is %g0.
-
-Wed Aug 16 00:30:44 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * m-symmetry.h (STORE_STRUCT_RETURN): Also write reg 0.
- (EXTRACT_RETURN_VALUE): Call symmetry_extract_return_value.
- symmetry-dep.c (symmetry_extract_return_value): New fn.
-
- * main.c (symbol_completion_function): Deal with changed
- result_list from lookup_cmd_1 for ambiguous return.
- command.c (lookup_cmd): Same.
-
- * inflow.c [TIOCGETC]: Move #include "param.h" back before
- system #includes. Change all #ifdef TIOCGETC to
- #if defined(TIOCGETC) && !defined(TIOCGETC_BROKEN)
- m-i386-sysv3.2.h, m-i386gas-sysv3.2.h: Remove "#undef TIOCGETC"
- and add "#define TIOCGETC_BROKEN".
-
- * command.c (lookup_cmd_1): Give the correct result_list in the
- case of an ambiguous return where there is a partial match
- (e.g. "info a"). Add comment clarifying what is the correct
- result_list.
-
- * gdb.texinfo (GDB History): Document the two changes below.
-
- * main.c (command_line_input): Make history expansion not
- just occur at the beginning of a line.
-
- * main.c (initialize_main): Make history expansion off by default.
-
- * inflow.c: Move #include "param.h" after system #includes.
-
- * i386-dep.c (i386_float_info): Use U_FPSTATE macro.
-
- * m-i386-sysv3.2.h, m-i386gas-sysv3.2.h: New files.
- Makefile.dist, config.gdb: Know about these new files.
-
-Tue Aug 15 21:36:11 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * symtab.c (lookup_struct_elt_type): Use type_print rather
- than assuming type has a name.
-
-Tue Aug 15 02:25:43 1989 Roland McGrath (roland at apple-gunkies.ai.mit.edu)
-
- * sparc-opcode.h (mov): Removed bogus "or i,0,d" pattern.
-
- * sparc-opcode.h (mov, or): Fixed incorrect `lose' members.
-
- * sparc-dep.c: Don't include "sparc-opcode.h".
- (skip_prologue, isanulled): Declare special types to recognize
- instructions, and use them.
-
- * sparc-pinsn.c (print_insn): Sign-extend 13-bit immediate args.
- If they are less than +9, print them in signed decimal instead
- of unsigned hex.
-
- * sparc-opcode.h, sparc-pinsn.c: Completely rewritten to share an
- opcode table with gas, and thus produce disassembly that looks
- like what the assembler accepts.
-
-Tue Aug 15 16:20:52 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * symtab.c (find_pc_psymbol): Move best_pc=psymtab->textlow-1
- after test for psymtab null.
-
- * main.c (editing_info): Remove variable retval.
-
- * config.gdb (sun3, isi): Comment out obsolete message about telling
- it whether you have an FPU (now that it detects it).
-
- * config.gdb (sun3): Accept sun3os3.
-
- * m68k-insn.h: Include <signal.h>.
-
- * m68k-pinsn.h (convert_{to,from}_68881): Add have_fpu code
-
- * m-newsos3.h: Undefine USE_PCB. That code didn't seem to work.
-
- * sparc-dep.c: Put in insn_fmt and other stuff from the old
- sparc-opcode.h.
-
- * sparc-opcode.h, sparc-pinsn.c: Correct copyright notice.
-
- * sparc-opcode.h, sparc-pinsn.c: Replace the old ones with the new
- ones by roland.
-
-Tue Aug 15 02:25:43 1989 Roland McGrath (roland at apple-gunkies.ai.mit.edu)
-
- * Makefile.dist: Don't define CC at all.
-
- * Makefile.dist (Makefile): Remove tmp.c after preprocessing.
- Use $(MD) instead of M_MAKEDEFINE in the cc command.
-
- * Makefile.dist: Don't define RL_LIB as
- "${READLINE}/libreadline.a", since READLINE is a list of files.
-
-Mon Aug 14 23:49:29 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * main.c (print_version): Change 1988 to 1989.
-
- * main.c (copying_info, initialize_main): Remove #if 0'd code.
-
-Tue Aug 1 14:44:56 1989 Hikichi (hikichi at sran203)
-
- * m-newsos3.h
- (NO_SIGINTERRUPT): have SIGINTERRUPT on NEWS os 3.
-
- * m-news.h(FRAME_FIND_SAVED_REGS): use the sun3's instead of old
- one.
-
-Mon Aug 14 15:27:01 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * m-news.h, m-newsos3.h, news-dep.c: Merge additional changes
- by Hikichi (ChangeLog entries above).
-
- * Makefile.dist (READLINE): List readline files individually
- so we don't accidently get random files from the readline
- directory.
-
- * m-news.h (STORE_RETURN_VALUE, EXTRACT_RETURN_VALUE):
- Expect floating point returns to be in fp0.
-
- * gdb.texinfo (Format options): New node.
-
- * gdb.texinfo: Comment out "@include"s until bfox fixes the
- readline & history docs.
-
- * dbxread.c (read_addl_syms): Set startup_file_* if necessary at
- the end (as well as when we hit ".o").
-
- * printcmd.c (decode_format): Set val.format & val.size to '?' at
- start and set defaults at end.
-
- * symtab.c (decode_line_1): Check for class_name null.
-
- * valops.c: Each place where it compares against field names,
- check for null field names. (new t_field_name variables).
-
- * utils.c (fputs_filtered): Check for linebuffer null before
- checking whether to call fputs. Remove later check for linebuffer
- null.
-
-Sun Aug 13 15:56:50 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * m-isi.h, m-sun3.h ({PUSH,POP}_FP_REGS): New macros.
- m-sun3.h (NUM_REGS): Conditionalize on FPU.
- config.gdb (sun3, isi): Add message about support for machines
- without FPU.
-
- * main.c (catch_termination, initialize_signals): new functions.
-
- * main.c (editing_info): Add "info editing n" and "info editing +".
- Rewrite much of this function.
- gdb.texinfo (GDB Readline): Document it.
-
- * values.c (history_info): Add "info history +". Also add code to
- do "info history +" when command is repeated.
- gdb.texinfo (Value History): Document "info history +".
-
- * expprint.c (print_subexp): Add OP_THIS to case stmt.
-
- * config.gdb (sun4os4): Put quotes around make define.
-
- * config.gdb: Canonicalize machine name at beginning.
-
-Sat Aug 12 00:50:59 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * config.gdb: define M_MAKEDEFINE
- Makefile (Makefile, MD): Be able to re-make Makefile.
-
- * main.c (command_line_input): Add comments to
- the command history.
-
- * Makefile.dist (Makefile): Add /bin/false.
-
-Fri Aug 11 14:35:33 1989 Jim Kingdon (kingdon at spiff)
-
- * Makefile.dist: Comment out .c.o rule and add TARGET_ARCH.
-
- * m-altos.h: Include sys/page.h & sys/net.h
-
- * m-altos.h (FRAME_CHAIN{,_VALID}): Use outside_startup_file.
-
- * config.gdb (altos, altosgas): Add M_SYSV & M_BSD_NM and remove
- M_ALLOCA=alloca.o from makedefine.
-
- * coffread.c (complete_symtab): Change a_entry to entry.
-
- * m-altosgas.h: New file.
-
- * m-symmetry (REGISTER_BYTE): Fix dumb mistake.
-
-Fri Aug 11 06:39:49 1989 Roland McGrath (roland at hobbes.ai.mit.edu)
-
- * utils.c (set_screensize_command): Check for ARG being nil, since
- that's what execute_command will pass if there's no argument.
-
- * expread.y (yylex): Recognize "0x" or "0X" as the beginning of a
- number.
-
-Thu Aug 10 15:43:12 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * config.gdb, Makefile.dist: Rename Makefile.c to Makefile.dist.
-
- * m-altos.h: Add comment about porting to USGR2.
-
- * config.gdb (sparc): Add -Usparc.
-
-Wed Aug 9 14:20:39 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * m-sun3os4.h: Define BROKEN_LARGE_ALLOCA.
-
- * values.c (modify_field): Check for value too large to fit in
- bitfield.
-
- * utils.c (fputs_filtered): Allow LINEBUFFER to be NULL.
-
- * breakpoint.c (condition_command): Check for attempt to specify
- non-numeric breakpoint number.
-
- * config.gdb, Makefile, m-altos.h, altos-dep.c: Merge Altos
- port.
-
- * README: Change message about editing Makefile.
-
- * config.gdb: Edit Makefile.
- Copied Makefile to Makefile.c and changed to let config.gdb
- run us through the C preprocessor.
-
- * expread.y (yylex): Test correctly for definition of number.
-
-Wed Aug 9 11:56:05 1989 Randy Smith (randy at hobbes.ai.mit.edu)
-
- * dbxread.c (read_dbx_symtab): Put bracketing of entry point in
- test case for .o symbols so that it will be correct even without
- debugging symbols.
- (end_psymtab): Took bracketing out.
-
- * blockframe.c (outside_startup_file): Reverse the sense of the
- return value to make the functionality implied by the name
- correct.
-
-Tue Aug 8 11:48:38 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * coffread.c (symbol_file_command): Do not assume presence of a.out
- header.
-
- * blockframe.c: Replace first_object_file_end with
- startup_file_{start,end}
- (outside_startup_file): New function.
- dbxread.c (read_addl_syms, read_dbx_symtab, end_psymbol): set
- startup_file_*. Delete first_object_file_end code.
- Add entry_point and ENTRY_POINT
- coffread.c (complete_symtab): Set startup_file_*.
- (first_object_file_end): Add as static.
- m-*.h (FRAME_CHAIN, FRAME_CHAIN_VALID): Call outside_startup_file
- instead of comparing with first_object_file_end.
-
- * breakpoint.c (breakpoint_1): Change -1 to (CORE_ADDR)-1.
-
- * config.gdb (i386, i386gas): Add missing quotes at end of "echo"
-
- * source.c (directory_command): Add dont_repeat ();
-
-Mon Aug 7 18:03:51 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * dbxread.c (read_addl_syms): Change strcmp to strncmp and put 3rd
- arg back.
-
- * command.h (struct cmd_list_element): Add comment clarifying
- purpose of abbrev_flag.
-
-Mon Aug 7 12:51:03 1989 Randy Smith (randy at hobbes.ai.mit.edu)
-
- * printcmd.c (_initialize_printcmd): Changed "undisplay" not to
- have abbrev flag set; it isn't an abbreviation of "delete
- display", it's an alias.
-
-Mon Aug 7 00:25:15 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * symtab.c (lookup_symtab_1): Remove filematch (never used).
-
- * expread.y [type]: Add second argument to 2 calls to
- lookup_member_type which were missing them.
-
- * dbxread.c (symbol_file_command): Add from_tty arg.
- Check it before calling query.
-
- * infcmd.c (tty_command): Add from_tty arg.
-
- * eval.c (evaluate_subexp): Remove 3rd argument from
- calls to value_x_unop.
-
- * dbxread.c (read_addl_syms): Remove 3rd argument from
- call to strcmp.
-
- * gdb.texinfo (Command editing): @include inc-readline.texinfo
- and inc-history.texinfo and reorganize GDB-specific stuff.
-
- * Makefile: Add line MAKE=make.
-
- * README (second paragraph): Fix trivial errors.
-
- * dbxread.c (read_struct_type): Make sure p is initialized.
-
- * main.c (symbol_completion_function): Complete correctly
- on the empty string.
-
-Sun Aug 6 21:01:59 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * symmetry-dep.c: Remove "long" from definition of i386_follow_jump.
-
- * gdb.texinfo (Backtrace): Document "where" and "info stack".
-
- * dbxread.c (cleanup_undefined_types): Strip off "struct "
- or "union " from type names before doing comparison
-
-Sat Aug 5 02:05:36 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * config.gdb (i386, i386gas): Improve makefile editing instructions.
-
- * Makefile: Fix typo in CLIBS for SYSV.
-
- * dbxread.c (read_dbx_symtab): Deal with N_GSYM typedefs.
-
- * dbxread.c (add_file_command): Do not free name. We didn't
- allocate it; it just points into arg_string.
-
- * Makefile, m-*.h: Change LACK_VPRINTF to HAVE_VPRINTF.
-
-Fri Jul 28 00:07:48 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * valprint.c (val_print): Made sure that all returns returned a
- value (usually 0, indicating no memory printed).
-
- * core.c (read_memory): Changed "return" to "return 0".
-
- * expread.y (parse_number): Handle scientific notation when the
- string does not contain a '.'.
-
-Thu Jul 27 15:14:03 1989 Randy Smith (randy at hobbes.ai.mit.edu)
-
- * infrun.c (signals_info): Error if signal number passed is out of
- bounds.
-
- * defs.h: Define alloca to be __builtin_alloca if compiling with
- gcc and localized inclusion of alloca.h on the sparc with the
- other alloca stuff.
- * command.c: Doesn't need to include alloca.h on the sparc; defs.h
- does it for you.
-
- * printcmd.c (print_frame_args): Changed test for call to
- print_frame_nameless_args to check i to tell if any args had been
- printed.
-
-Thu Jul 27 04:40:56 1989 Roland McGrath (roland at hobbes.ai.mit.edu)
-
- * blockframe.c (find_pc_partial_function): Always check that NAME
- and/or ADDRESS are not nil before storing into them.
-
-Wed Jul 26 23:41:21 1989 Roland McGrath (roland at hobbes.ai.mit.edu)
-
- * m-newsos3.h: Define BROKEN_LARGE_ALLOCA.
- * dbxread.c (symbol_file_command, psymtab_to_symtab):
- Use xmalloc #ifdef BROKEN_LARGE_ALLOCA.
-
-Tue Jul 25 16:28:18 1989 Jay Fenlason (hack at apple-gunkies.ai.mit.edu)
-
- * m68k-opcode.h: moved some of the fmovem entries so they're
- all consecutive. This way the assembler doesn't bomb.
-
-Mon Jul 24 22:45:54 1989 Randy Smith (randy at hobbes.ai.mit.edu)
-
- * symtab.c (lookup_symbol): Changed error to an informational (if
- not very comforting) message about internal problems. This will
- get a null symbol returned to decode_line_1, which should force
- things to be looked up in the misc function vector.
-
-Wed Jul 19 13:47:34 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * symtab.c (lookup_symbol): Changed "fatal" to "error" in
- external symbol not found in symtab in which it was supposed to be
- found. This can be reached because of a bug in ar.
-
-Tue Jul 18 22:57:43 1989 Randy Smith (roland at hobbes.ai.mit.edu)
-
- * m-news.h [REGISTER_U_ADDR]: Decreased the assumed offset of fp0
- by 4 to bring it into (apparently) appropriate alignment with
- reality.
-
-Tue Jul 18 18:14:42 1989 Randy Smith (randy at hobbes.ai.mit.edu)
-
- * Makefile: pinsn.o should depend on opcode.h
-
- * m68k-opcode.h: Moved fmovemx with register lists to before other
- fmovemx.
-
-Tue Jul 18 11:21:42 1989 Jim Kingdon (kingdon at susie)
-
- * Makefile, m*.h: Only #define vprintf (to _doprnt or printf,
- depends on the system) if the library lacks it (controlled by
- LACK_VPRINTF_DEFINE in makefile). Unpleasant, but necessary to
- make this work with the GNU C library.
-
-Mon Jul 17 15:17:48 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * breakpoint.c (breakpoint_1): Change addr-b->address to
- b->address-addr.
-
-Sun Jul 16 16:23:39 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * eval.c (evaluate_subexp): Change error message printed when
- right operand of '@' is not an integer to English.
-
- * infcmd.c (registers_info): Fix call to print_spaces_filtered
- to specify right # of arguments.
-
- * gdb.texinfo (Command Editing): Document info editing command.
-
- * coffread.c (read_file_hdr): Add MC68MAGIC.
-
- * source.c (select_source_symtab): Change MAX to max.
-
-Fri Jul 14 21:19:11 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * infcmd.c (registers_info): Clean up display to look good with long
- register names, to say "register" instead of "reg", and to put the
- "relative to selected stack frame" bit at the top.
-
-Fri Jul 14 18:23:09 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * dbxread.c (record_misc_function): Put parens around | to force
- correct evaluation.
-
-Wed Jul 12 12:25:53 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * m-newsos3, m-news, infrun.c, Makefile, config.gdb, news-dep.c:
- Merge in Hikichi's changes for Sony/News-OS 3 support.
-
-Tue Jul 11 21:41:32 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * utils.c (fputs_filtered): Don't do any filtering if output is
- not to stdout, or if stdout is not a tty.
- (fprintf_filtered): Rely on fputs_filtered's check for whether to
- do filtering.
-
-Tue Jul 11 00:33:58 1989 Randy Smith (randy at hobbes.ai.mit.edu)
-
- * GDB 3.2 Released.
-
- * valprint.h: Deleted.
-
- * utils.c (fputs_filtered): Don't do any filtering if filtering is
- disabled (lines_per_page == 0).
-
-Mon Jul 10 22:27:53 1989 Randy Smith (roland at hobbes.ai.mit.edu)
-
- * expread.y [typebase]: Added "unsigned long int" and "unsigned
- short int" to specs.
-
-Mon Jul 10 21:44:55 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * main.c (main): Make -cd use cd_command to avoid
- current_directory with non-absolute pathname.
-
-Mon Jul 10 00:34:29 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * dbxread.c (symbol_file_command): Catch errors from stat (even
- though they should never happen).
-
- * source.c (openp): If the path is null, use the current
- directory.
-
- * dbxread.c (read_dbx_symtab): Put N_SETV symbols into the misc
- function vector ...
- (record_misc_function): ... as data symbols.
-
- * utils.c (fprintf_filtered): Return after printing if we aren't
- going to do filtering.
-
- * Makefile: Added several things for make clean to take care of.
-
- * expread.y: Lowered "@" in precedence below +,-,*,/,%.
-
- * eval.c (evaluate_subexp): Return an error if the rhs of "@"
- isn't integral.
-
- * Makefile: Added removal of core and gdb[0-9] files to clean
- target.
-
- * Makefile: Made a new target "distclean", which cleans things up
- correctly for making a distribution.
-
-Sun Jul 9 23:21:27 1989 Randy Smith (randy at hobbes.ai.mit.edu)
-
- * dbxread.c: Surrounded define of gnu symbols with an #ifndef
- NO_GNU_STABS in case you don't want them on some machines.
- * m-npl.h, m-pn.h: Defined NO_GNU_STABS.
-
-Sun Jul 9 19:25:22 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * utils.c (fputs_filtered): New function.
- (fprintf_filtered): Use fputs_filtered.
- utils.c (print_spaces_filtered),
- command.c (help_cmd,help_cmd_list),
- printcmd.c (print_frame_args),
- stack.c (print_block_frame_locals, print_frame_arg_vars),
- valprint.c (many functions): Use fputs_filtered instead of
- fprintf_filtered to avoid arbitrary limit.
-
- * utils.c (fprintf_filtered): Fix incorrect comment.
-
-Sat Jul 8 18:12:01 1989 Randy Smith (randy at hobbes.ai.mit.edu)
-
- * valprint.c (val_print): Changed assignment of pretty to use
- prettyprint as a conditional rather than rely on values of the
- enum.
-
- * Projects: Cleaned up a little for release.
-
- * main.c (initialize_main): Initialize
- rl_completion_entry_function instead of completion_entry_function.
-
- * Makefile: Modified to use the new readline library setup.
-
- * breakpoint.c (break_command_1, delete_breakpoint,
- enable_breakpoint, disable_breakpoint): Put in new printouts for
- xgdb usage triggered off of xgdb_verbose.
- * main.c (main): Added check for flag to set xgdb_verbose.
- * stack.c (frame_command): Set frame_changed when frame command
- used.
-
-Fri Jul 7 16:20:58 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * Remove valprint.h and move contents to value.h (more logical).
-
-Fri Jul 7 02:28:06 1989 Randall Smith (randy at rice-chex)
-
- * m68k-pinsn.c (print_insn): Included a check for register list;
- if there is one, make sure to start p after it.
-
- * breakpoint.c (break_command_1, delete_breakpoint,
- enable_breakpoint, disable_breakpoint): #ifdef'd out changes
- below; they produce unwanted output in gdb mode in gnu-emacs.
-
- * gdb.texinfo: Spelled. Also removed index references from
- command editing section; the relevance/volume ratio was too low.
- Removed all references to the function index.
-
- * ns32k-opcode.h, ns32k-pinsn.c: Backed out changes of June 24th;
- haven't yet received legal papers.
-
- * .gdbinit: Included message telling the user what it is doing.
-
- * symmetry-dep.c: Added static decls for i386_get_frame_setup,
- i386_follow_jump.
- * values.c (unpack_double): Added a return (double)0 at the end to
- silence a compiler warning.
-
- * printcmd.c (containing_function_bounds, asdump_command): Created
- to dump the assembly code of a function (support for xgdb and a
- useful hack).
- (_initialize_printcmd): Added this to command list.
- * gdb.texinfo [Memory]: Added documentation for the asdump
- command.
- * breakpoint.c (break_command_1, delete_breakpoint,
- enable_breakpoint, disable_breakpoint): Added extra verbosity for
- xgdb conditionalized on the new external frame_full_file_name.
- * source.c (identify_source_line): Increase verbosity of fullname
- prointout to include pc value.
- * stack.c: Added a new variable; "frame_changed" to indicate when
- a frame has been changed so that gdb can print out a frame change
- message when the frame only changes implicitly.
- (print_frame_info): Check the new variable in determining when to
- print out a new message and set it to zero when done.
- (up_command): Increment it.
- (down_command): Decrement it.
-
- * m68k-pinsn.c (print_insn_arg [lL]): Modified cases for register
- lists to reset the point to point to after the word from which the
- list is grabbed *if* that would cause point to point farther than
- it currently is.
-
-Thu Jul 6 14:28:11 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * valprint.c (val_print, value_print): Add parameter to control
- prettyprinting.
- valprint.h: New file containing constants used for passing
- prettyprinting parameter to val{,ue}_print.
- expprint.c, infcmd.c, printcmd.c, valprint.c, values.c:
- Change all calls to val{,ue}_print to use new parameter.
-
-Mon Jul 3 22:38:11 1989 Randy Smith (randy at apple-gunkies.ai.mit.edu)
-
- * dbxread.c (,process_one_symbol): Moved extern declaration for
- index out of function to beginning of file.
-
-Mon Jul 3 18:40:14 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * gdb.texinfo (Registers): Add "ps" to list of standard registers.
-
-Sun Jul 2 23:13:03 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * printcmd.c (enable_display): Change d->next to d = d->next so
- that "enable display" without args works.
-
-Fri Jun 30 23:42:04 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * source.c (list_command): Made error message given when no
- symtab is loaded clearer.
-
- * valops.c (value_assign): Make it so that when assigning to an
- internal variable, the type of the assignment exp is the type of
- the value being assigned.
-
-Fri Jun 30 12:12:43 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * main.c (verbose_info): Created.
- (initialize_main): Put "info verbose" into command list.
-
- * utils.c (screensize_info): Created.
- (_initialize_utils): Defined "info screensize" as a normal command.
-
- * valprint.c (format_info): Added information about maximum number
- of array elements to function.
-
- * blockframe.c (find_pc_partial_function): Again.
-
- * blockframe.c (find_pc_partial_function): Replaced a "shouldn't
- happen" (which does) with a zero return.
-
- * main.c (dont_repeat): Moved ahead of first use.
-
-Thu Jun 29 19:15:08 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * vax-opcode.h: Made minor modifications (moved an instruction and
- removed a typo) to bring this into accord with gas' table; also
- changed copyright to reflect it being part of both gdb and gas.
-
- * m68k-opcode.h: Added whole scads and bunches of new stuff for
- the m68851 and changed the coptyrightto recognize that the file
- was shared between gdb and gas.
-
- * main.c (stop_sig): Use "dont_repeat ()" instead of *line = 0;
-
- * core.c (read_memory): Don't do anything if length is 0.
-
- * Makefile: Added readline.c to the list of files screwed by
- having the ansi ioctl.h compilation with gcc.
-
- * config.gdb: Added sun4os3 & sun4-os3 as availible options.
-
-Wed Jun 28 02:01:26 1989 Jim Kingdon (kingdon at apple-gunkies.ai.mit.edu)
-
- * command.c (lookup_cmd): Add ignore_help_classes argument.
- (lookup_cmd_1): Add ignore_help_classes argument.
- command.c, main.c: Change callers of lookup_cmd{,_1} to supply
- value for ignore_help_classes.
-
-Tue Jun 27 18:01:31 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * utils.c (print_spaces_filtered): Made more efficient.
- * defs.h: Declaration.
- * valprint.c (val_print): Used in a couple of new places.
-
-Mon Jun 26 18:27:28 1989 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * m68k-pinsn.c (print_insn_arg ['#', '^']): Combined them into one
- case which always gets the argument from the word immediately
- following the instruction.
- (print_insn_arg ["[lL]w"]): Make sure to always get the register
- mask from the word immediately following the instruction.
-
-Sun Jun 25 19:14:56 1989 Randall Smith (randy at galapas.ai.mit.edu)
-
- * Makefile: Added hp-include back in as something to distribute.
-
- * stack.c (print_block_frame_locals): Return value changed from
- void to int; return 1 if values printed. Use _filtered.
- (print_frame_local_vars): Use return value from
- print_block_frame_locals to mention if nothing printed; mention
- lack of symbol table, use _filtered.
- (print_frame_arg_vars): Tell the user if no symbol table
- or no values printed. Use fprintf_filtered instead of fprintf.
- * blockframe.c (get_prev_frame_info): Check for no inferior or
- core file before crashing.
-
- * inflow.c (inferior_died): Set current frame to zero to keep from
- looking like we're in start.
-
-Sat Jun 24 15:50:53 1989 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * stack.c (frame_command): Added a check to make sure that there
- was an inferior or a core file.
-
- * expread.y (yylex): Allow floating point numbers of the form ".5"
- to be parsed.
-
- Changes by David Taylor at TMC:
- * ns32k-pinsn.c: Added define for ?floating point coprocessor? and
- tables for register names to be used for each of the possibilities.
- (list_search): Created; searches a list of options for a specific
- value.
- (print_insn_arg): Added 'Q', 'b', 'M', 'P', 'g', and 'G' options
- to the value location switch.
- * ns32k-opcode.h: Added several new location flags.
- [addr, enter, exit, ext[bwd], exts[bwd], lmr, lpr[bwd], restore,
- rett, spr[bwd], smr]: Improved insn format output.
-
- * symtab.c (list_symbols): Rearrange printing to produce readable
- output for "info types".
-
- * eval.c (evaluate_subexp_for_address): Fixed typo.
-
- * dbxread.c (read_type): Don't output an error message when
- there isn't a ',' after a cross-reference.
-
- * dbxread.c (read_dbx_symtab): #if'd out N_FN case in
- read_dbx_symtab if it has the EXT bit set (otherwise multiple
- cases with the same value).
-
-Fri Jun 23 13:12:08 1989 Randall Smith (randy at plantaris.ai.mit.edu)
-
- * symmisc.c: Changed decl of print_spaces from static to extern
- (since it's defined in utils.c).
-
- * remote.c (remote_open): Close remote_desc if it's already been
- opened.
-
- * Remote_Makefile, remote_gutils.c, remote_inflow.c,
- remote_server.c, remote_utils.c: Combined into remote-multi.shar.
- * remote-multi.shar: Created (Vikram Koka's remote stub).
- * remote-sa.m68k.shar: Created (Glenn Engel's remcom.c).
- * README: Updated to reflect new organization of remote stubs.
-
- * dbxread.c (read_dbx_symtab): Put an N_FN in with N_FN | N_EXT to
- account for those machines which don't use the external bit here.
- Sigh.
-
- * m-symmetry.h: Defined NO_SIGINTERRUPT.
-
-Thu Jun 22 12:51:37 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * printcmd.c (decode_format): Make sure characters are printed
- using a byte size.
-
- * utils.c (error): Added a terminal_ours here.
-
- * stack.c (locals_info): Added check for selected frame.
-
- * dbxread.c (read_type): Checked to make sure that a "," was
- actually found in the symbol to end a cross reference.
-
-Wed Jun 21 10:30:01 1989 Randy Smith (randy at tartarus.uchicago.edu)
-
- * expread.y (parse_number, [exp]): Allowed for the return of a
- number marked as unsigned; this will allow inclusion of unsigned
- constants.
-
- * symtab.h: Put in default definitions for BUILTIN_TYPE_LONGEST
- and BUILTIN_TYPE_UNSIGNED_LONGEST.
-
- * expread.y (parse_number): Will now accept integers suffixed with
- a 'u' (though does nothing special with it).
-
- * valarith.c (value_binop): Added cases to deal with unsigned
- arithmetic correctly.
-
-Tue Jun 20 14:25:54 1989 Randy Smith (randy at tartarus.uchicago.edu)
-
- * dbxread.c (psymtab_to_symtab_1): Changed reading in info message
- to go through printf_filtered.
-
- * symtab.c (list_symbols): Placed header message after all calls
- to psymtab_to_symtab.
-
- * symtab.c (smash_to_{function, reference, pointer}_type): Carried
- attribute of permanence for the type being smashed over the bzero
- and allowed any type to point at this one if it is permanent.
-
- * symtab.c (smash_to_{function, reference, pointer}_type): Fix
- typo: check flags of to_type instead of type.
-
- * m-hp9k320.h: Changed check on __GNU__ predefine to __GNUC__.
-
- * Makefile: Made MUNCH_DEFINE seperate and based on SYSV_DEFINE;
- they aren't the same on hp's.
-
-Mon Jun 19 17:10:16 1989 Randy Smith (randy at tartarus.uchicago.edu)
-
- * Makefile: Fixed typo.
-
- * valops.c (call_function): Error if the inferior has not been
- started.
-
- * ns32k-opcode.h [check[wc], cmpm[bwd], movm[bwd], skpsb]: Fixed
- typos.
-
-Fri Jun 9 16:23:04 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * m-news.h [NO_SIGINTERRUPT]: Defined.
-
- * dbxread.c (read_type): Start copy of undefined structure name
- past [sue] defining type of cross ref.
-
- * dbxread.c (process_one_symbol): Changed strchr to index.
-
- * ns32k-opcode.h, ns32k-pinsn.c: More changes to number of
- operands, addition of all of the set condition opcodes, addition
- of several flag letters, all patterned after the gas code.
-
- * ns32k-opcode.h [mov{su,us}[bwd], or[bwd]]: Changed number of
- operands from 1 to 2.
-
-Wed Jun 7 15:04:24 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * symseg.h [TYPE_FLAG_STUB]: Created.
- * dbxread.c (read_type): Set flag bit if type is stub.
- (cleanup_undefined_types): Don't mark it as a stub if it's been
- defined since we first learned about it.
- * valprint.c (val_print): Print out a message to that effect if
- this type is encountered.
-
- * symseg.h, symtab.h: Moved the definition of TYPE_FLAG_PERM over
- to symseg.h so that all such definitions would be in the same place.
-
- * valprint.c (val_print): Print out <No data fields> for a
- structure if there aren't any.
-
- * dbxread.c (read_type): Set type name of a cross reference type
- to "struct whatever" or something.
-
-Tue Jun 6 19:40:52 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * breakpoint.c (breakpoint_1): Print out symbolic location of
- breakpoints for which there are no debugging symbols.
-
-Mon Jun 5 15:14:51 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * command.c (help_cmd_list): Made line_size static.
-
-Sat Jun 3 17:33:45 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * Makefile: Don't include the binutils hp-include directory in the
- distribution anymore; refer the users to the binutils distribution.
-
-Thu Jun 1 16:33:07 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * printcmd.c (disable_display_command): Fixed loop iteration for
- no arg case.
-
- * printcmd.c (disable_display_command): Added from_tty parameter
- to function.
-
- * valops.c (value_of_variable): Call read_var_value with 0 cast to
- FRAME instead of CORE_ADDR.
-
- * eval.c (evaluate_subexp): Corrected number of args passed to
- value_subscript (to 2).
-
- * infrun.c (wait_for_inferior), symtab.c (decode_line_1),
- m-convex.h: Changed name of FIRSTLINE_DEBUG_BROKEN to
- PROLOGUE_FIRSTLINE_OVERLAP.
-
- * m-merlin.h: Fixed typo.
- * ns32k-opcode.h: Added ns32381 opcodes and "cinv" insn, and fixed
- errors in movm[wd], rett, and sfsr.
-
- * eval.c (evaluate_subexp, evaluate_subexp_for_address), valops.c
- (value_zero): Change value_zero over to taking two arguments
- instead of three.
-
- * eval.c (evaluate_subexp)
- [OP_VAR_VALUE]: Get correct lval type for AVOID_SIDE_EFFECTS for
- all types of symbols.
- [BINOP_DIV]: Don't divide if avoiding side effects; just return
- an object of the correct type.
- [BINOP_REPEAT]: Don't call value_repeat, just allocate a
- repeated value.
- (evaluete_subexp_for_address) [OP_VAR_VALUE]: Just return a thing
- of the right type (after checking to make sure that we are allowed
- to take the address of whatever variable has been passed).
-
-Mon May 29 11:01:02 1989 Randall Smith (randy at galapas.ai.mit.edu)
-
- * breakpoint.c (until_break_command): Set the breakpoint with a
- frame specification so that it won't trip in inferior calls to the
- function. Also set things up so that it works based on selected
- frame, not current one.
-
-Sun May 28 15:05:33 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * eval.c (evalue_subexp): Change subscript case to use value_zero
- in EVAL_AVOID_SIDE_EFFECTS case.
-
-Fri May 26 12:03:56 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * dbxread.c (read_addl_syms, psymtab_to_symtab): Removed
- cleanup_undefined_types; this needs to be done on a symtab basis.
- (end_symtab): Called cleanup_undefined_types from here.
- (cleanup_undefined_types): No longer uses lookup_symbol (brain
- dead idea; oh, well), now it searches through file_symbols.
-
-Wed May 24 15:52:43 1989 Randall Smith (randy at galapas)
-
- * source.c (select_source_symtab): Only run through
- partial_symtab_list if it exists.
-
- * coffread.c (read_coff_symtab): Don't unrecord a misc function
- when a function symbol is seen for it.
-
- * expread.y [variable]: Make sure to write a type for memvals if
- you don't get a mft you recognize.
-
-Tue May 23 12:15:57 1989 Randall Smith (randy at plantaris.ai.mit.edu)
-
- * dbxread.c (read_ofile_symtab, psymtab_to_symtab): Moved cleanup
- of undefined types to psymtab_to_symtab. That way it will be
- called once for all readins (which will, among other things,
- help reduce infinite loops).
-
- * symtab.h [misc_function_type]: Forced mf_unknown to 0.
- * dbxread.c (record_misc_function): Cast enum to unsigned char (to
- fit).
- * expread.y [variable]: Cast unsigned char back to enum to test.
-
-Mon May 22 13:08:25 1989 Randall Smith (randy at gluteus.ai.mit.edu)
-
- Patches by John Gilmore for dealing well with floating point:
- * findvar.c (value_from_register, locate_var_value): Used
- BYTES_BIG_ENDIAN instead of an inline test.
- * m-sparc.h [IEEE_FLOAT]: Created to indicate that the sparc is
- IEEE compatible.
- * printcmd.c (print_scalar_formatted): Use BYTES_BIG_ENDIAN and
- the stream argument for printing; also modify default type for
- 'f'. Change handling of invalid floats; changed call syntax for
- is_nan.
- (print_command): Don't print out anything indicating that
- something was recorded on the history list if it wasn't.
- * valprint.c (val_print): Fixed to deal properley with new format
- of is_nan and unpacking doubles without errors occuring.
- (is_nan): Changed argument list and how it figures big endianness
- (uses macros).
- * values.c (record_latest_value): Return -1 and don't record if
- it's an invalid float.
- (value_as_double): Changed to use new unpack_double calling
- convention.
- (unpack_double): Changed not to call error if the float was
- invalid; simply to set invp and return. Changed calling syntax.
- (unpack_field_as_long, modify_field): Changed to use
- BITS_BIG_ENDIAN to determine correct action.
-
- * m-hp9k320.h [HP_OS_BUG]: Created; deals with problem where a
- trap happens after a continue.
- * infrun.c (wait_for_inferior): Used.
-
- * m-convex.h [FIRSTLINE_DEBUG_BROKEN]: Defined a flag to indicate
- that the debugging symbols output by the compiler for the first
- line of a function were broken.
- * infrun.c (wait_for_inferior), symtab.c (decode_line_1): Used.
-
- * gdb.texinfo [Data, Memory]: Minor cleanups of phrasing.
-
-Fri May 19 00:16:59 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * dbxread.c (add_undefined_type, cleanup_undefined_types): Created
- to keep a list of cross references to as yet undefined types.
- (read_type): Call add_undefined_type when we run into such a case.
- (read_addl_syms, read_ofile_symtab): Call cleanup_undefined_types
- when we're done.
-
- * dbxread.c (psymtab_to_symtab, psymtab_to_symtab_1): Broke
- psymtab_to_symtab out into two routines; made sure the string
- table was only readin once and the globals were only scanned once,
- for any number of dependencies.
-
-Thu May 18 19:59:18 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * m-*.h: Defined (or not, as appropriate per machine)
- BITS_BIG_ENDIAN, BYTES_BIG_ENDIAN, and WORDS_BIG_ENDIAN.
-
-Wed May 17 13:37:45 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * main.c (symbol_completion_function): Always complete on result
- command list, even if exact match found. If it's really an exact
- match, it'll find it again; if there's something longer than it,
- it'll get the right result.
-
- * symtab.c (make_symbol_completion_function): Fixed typo; strcmp
- ==> strncmp.
-
- * dbxread.c (read_dbx_symtab): Change 'G' case to mark symbols as
- LOC_EXTERNAL.
-
- * expread.y [variables]: Changed default type of text symbols to
- function returning int so that one can use, eg. strcmp.
-
- * infrun.c (wait_for_inferior): Include a special flag indicating
- that one shouldn't insert the breakpoints on the next step for
- returning from a sigtramp and forcing at least one move forward.
-
- * infrun.c (wait_for_inferior): Change test for nexting into a
- function to check for current stack pointer inner than previous
- stack pointer.
-
- * infrun.c (wait_for_inferior): Check for step resume break
- address before dealing with normal breakpoints.
-
- * infrun.c (wait_for_inferior): Added a case to deal with taking
- and passing along a signal when single stepping past breakpoints
- before inserting breakpoints.
-
- * infrun.c (wait_for_inferior): Inserted special case to keep
- going after taking a signal we are supposed to be taking.
-
-Tue May 16 12:49:55 1989 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * inflow.c (terminal_ours_1): Cast result of signal to (int
- (*)()).
-
- * gdb.texinfo: Made sure that references to the program were in
- upper case. Modify description of the "set prompt" command.
- [Running]: Cleaned up introduction.
- [Attach]: Cleaned up.
- [Stepping]: Change "Proceed" to "Continue running" or "Execute".
- Minor cleanup.
- [Source Path]: Cleaned up intro. Cleared up distinction between
- the executable search path and the source path. Restated effect
- of the "directory" command with no arguments.
- [Data]: Fixed typos and trivial details.
- [Stepping]: Fixed up explanation of "until".
-
- * source.c (print_source_lines): Print through filter.
-
- * printcmd.c (x_command): If the format with which to print is
- "i", use the address of anything that isn't a pointer instead of
- the value. This is for, eg. "x/10i main".
-
- * gdb.texinfo: Updated last modification date on manual.
-
-Mon May 15 12:11:33 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * symtab.c (lookup_symtab): Fixed typo (name ==> copy) in call to
- lookup_symtab_1.
-
- * gdb.texinfo: Added documentation for "break [+-]n" and for new
- actions of "directory" command (taking multiple directory names at
- the same time).
-
- * m68k-opcode.h: Replaced the version in gdb with an up-to-date
- version from the assembler directory.
- * m68k-pinsn.c (print_insn_arg): Added cases 'l' & 'L' to switch
- to print register lists for movem instructions.
-
- * dbxread.c, m-convex.h: Moved convex dependent include files over
- from dbxread.c to m-convex.h.
-
- * printcmd.c (disable_display, disable_display_command): Changed
- name of first to second, and created first which takes an int as
- arg rather than a char pointer. Changed second to use first.
- (_initialize_printcmd): Changed to use second as command to call.
- (delete_current_display, disable_current_display): Changed name of
- first to second, and changed functionality to match.
- * infrun.c (normal_stop), main.c (return_to_top_level): Changed to
- call disable_current_display.
-
- * dbxread.c (process_one_symbol, read_dbx_symtab): Changed N_FN to
- be N_FN | N_EXT to deal with new Berkeley define; this works with
- either the old or the new.
-
- * Remote_Makefile, remote_gutils.c, remote_inflow.c,
- remote_server.c, remote_utils.c: Created.
- * Makefile: Included in tag and tar files.
- * README: Included a note about them.
-
- * printcmd.c (print_address): Use find_pc_partial_function to
- remove need to readin symtabs for symbolic addresses.
-
- * source.c (directory_command): Replaced function with new one
- that can accept lists of directories seperated by spaces or :'s.
-
- * inflow.c (new_tty): Replaced calls to dup2 with calls to dup.
-
-Sun May 14 12:33:16 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * stack.c (args_info): Make sure that you have an inferior or core
- file before taking action.
-
- * ns32k-opcode.h [deiw, deid]: Fixed machine code values for these
- opcodes.
-
- * dbxread.c (scan_file_globals): Modified to use misc function
- vector instead of file itself. Killed all arguments to the
- funciton; no longer needed.
- (psymtab_to_symtab): Changed call for above to reflect new (void)
- argument list.
-
- * dbxread.c (read_dbx_symtab, ): Moved HASH_OFFSET define out of
- read_dbx_symtab.
-
- * expread.y [variable]: Changed default type of misc function in
- text space to be (void ()).
-
- * Makefile: Modified for proper number of s/r conflicts (order is
- confusing; the mod that necessitated this change was on May 12th,
- not today).
-
- * expread.y (yylex): Added SIGNED, LONG, SHORT, and INT keywords.
- [typename]: Created.
- [typebase]: Added rules for LONG, LONG INT, SHORT, SHORT INT,
- SIGNED name, and UNSIGNED name (a good approximation of ansi
- standard).
-
- * Makefile: Included .c.o rule to avoid sun's make from throwing
- any curves at us.
-
- * blockframe.c: Included <obstack.h>
-
- * command.c (lookup_cmd): Clear out trailing whitespace.
-
- * command.c (lookup_cmd_1): Changed malloc to alloca.
-
-Fri May 12 12:13:12 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * printcmd.c (print_frame_args): Only print nameless args when you
- know how many args there are supposed to be and when you've
- printed fewer than them. Don't print nameless args between
- printed args.
-
- * symtab.c (make_symbol_completion_function): Fixed typo (= ==>
- ==).
-
- * remote.c (remote_open): ifdef'd out siginterrupt call by #ifndef
- NO_SIGINTERRUPT.
- * m-umax.h: Defined NO_SIGINTERRUPT.
-
- * expread.y [ptype, array_mod, func_mod, direct_abs_decl,
- abs_decl]: Added rules for parsing and creating arbitrarily
- strange types for casts and sizeofs.
-
- * symtab.c, symtab.h (create_array_type): Created. Some minor
- misfeatures; see comments for details (main one being that you
- might end up creating two arrays when you only needed one).
-
-Thu May 11 13:11:49 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * valops.c (value_zero): Add an argument for type of lval.
- * eval.c (evaluate_subexp_for_address): Take address properly in
- the avoid side affects case (ie. keep track of whether we have an
- lval in memory and we can take the address).
- (evaluate_subexp): Set the lval type of expressions created with
- value_zero properley.
-
- * valops.c, value.h (value_zero): Created--will return a value of
- any type with contents filled with zero.
- * symtab.c, symtab.h (lookup_struct_elt_type): Created.
- * eval.c (evaluate_subexp): Modified to not read memory when
- called with EVAL_AVOID_SIDE_EFFECTS.
-
- * Makefile: Moved dbxread.c ahead of coffread.c in the list of
- source files.
-
-Wed May 10 11:29:19 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * munch: Make sure that sysv version substitutes for the whole
- line.
-
- * symtab.h: Created an enum misc_function_type to hold the type of
- the misc function being recorded.
- * dbxread.c (record_misc_function): Branched on dbx symbols to
- decide which type to assign to a misc function.
- * coffread.c (record_misc_function): Always assign type unknown.
- * expread.y [variable]: Now tests based on new values.
-
-Tue May 9 13:03:54 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * symtab.c: Changed inclusion of <strings.h> (doesn't work on
- SYSV) to declaration of index.
-
- * Makefile: Changed last couple of READLINE_FLAGS SYSV_DEFINE
-
- * source.c ({forward, reverse}_search_command): Made a default
- search file similar to for the list command.
-
-Mon May 8 18:07:51 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * printcmd.c (print_frame_args): If we don't know how many
- arguments there are to this function, don't print the nameless
- arguments. We don't know enough to find them.
-
- * printcmd.c (print_frame_args): Call print_frame_nameless_args
- with proper arguments (start & end as offsets from addr).
-
- * dbxread.c (read_addl_syms): Removed cases to deal with global
- symbols; this should all be done in scan_global_symbols.
-
-Sun May 7 11:36:23 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * Makefile: Added copying.awk to ${OTHERS}.
-
-Fri May 5 16:49:01 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * valprint.c (type_print_varspec_prefix): Don't pass
- passed_a_pointer onto children.
-
- * valprint.c (type_print_varspec_suffix): Print "array of" with
- whatever the "of" is after tha array brackets.
-
- * valprint.c (type_print_varspec_{prefix,suffix}): Arrange to
- parenthesisze pointers to arrays as well as pointers to other
- objects.
-
- * valprint.c (type_print_varspec_suffix): Make sure to print
- subscripts of multi-dimensional arrays in the right order.
-
- * infcmd.c (run_command): Fixed improper usages of variables
- within remote debugging branch.
-
- * Makefile: Added Convex.notes to the list of extra files to carry
- around.
-
- * dbxread.c (symbol_file_command): Made use of alloca or malloc
- dependent on macro define.
-
-Thu May 4 15:47:04 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * Makefile: Changed READLINE_FLAGS to SYSV_DEFINE and called munch
- with it also.
- * munch: Check first argument for -DSYSV and be looser about
- picking up init routines if you find it.
-
- * coffread.c: Made fclose be of type int.
-
- * breakpoint.c (_initialize_breakpoint): Put "unset" into class
- alias.
-
-Wed May 3 14:09:12 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * m-sparc.h [STACK_END_ADDR]: Parameterized off of
- machine/vmparam.h (as per John Gilmore's suggestion).
-
- * blockframe.c (get_prev_frame_info): Changed this function back
- to checking frameless invocation first before checking frame
- chain. This means that a backtrace up from start will produce the
- wrong value, but that a backtrace from a frameless function called
- in main will show up correctly.
-
- * breakpoint.c (_initialize_breakpoint): Added entry in help for
- delete that indicates that unset is an alias for it.
-
- * main.c (symbol_completion_function): Modified recognition of
- being within a single command.
-
-Tue May 2 15:13:45 1989 Randy Smith (randy at gnu)
-
- * expread.y [variable]: Add some parens to get checking of the
- misc function vector right.
-
-Mon May 1 13:07:03 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * default-dep.c (core_file_command): Made reg_offset unsigned.
-
- * default-dep.c (core_file_command): Improved error messages for
- reading in registers.
-
- * expread.y: Allowed a BLOCKNAME to be ok for a variable name (as
- per C syntax).
-
- * dbxread.c (psymtab_to_symtab): Flushed stdout after printing
- starting message about reading in symbols.
-
- * printcmd.c (print_frame_args): Switched starting place for
- printing of frameless args to be sizeof int above last real arg
- printed.
-
- * printcmd.c (print_frame_args): Modified final call to
- print_nameless_args to not use frame slots used array if none had
- been used.
-
- * infrun.c (wait_for_inferior): Take FUNCTION_START_OFFSET into
- account when dealing with comparison of pc values to function
- addresses.
-
- * Makefile: Added note about compiling gdb on a Vax running 4.3.
-
-Sun Apr 30 12:59:46 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * command.c (lookup_cmd): Got correct error message on bad
- command.
-
- * m-sun3.h [ABOUT_TO_RETURN]: Modified to allow any of the return
- instructions, including trapv and return from interupt.
-
- * command.c (lookup_cmd): If a command is found, use it's values
- for error reporting and determination of needed subcommands.
-
- * command.c (lookup_cmd): Use null string for error if cmdtype is
- null; pass *line to error instead of **.
-
- * command.c (lookup_cmd_1): End of command marked by anything but
- alpha numeric or '-'. Included ctype.h.
-
-Fri Apr 28 18:30:49 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * source.c (select_source_symtab): Kept line number from ever
- being less than 1 in main decode.
-
-Wed Apr 26 13:03:20 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * default-dep.c (core_file_command): Fixed typo.
-
- * utils.c (fprintf_filtered): Don't use return value from
- numchars.
-
- * main.c, command.c (complete_on_cmdlist): Moved function to
- command.c.
-
- * command.c (lookup_cmd): Modified to use my new routine. Old
- version is still there, ifdef'd out.
-
- * command.c, command.h (lookup_cmd_1): Added a routine to do all
- of the work of lookup_cmd with no error reporting and full return
- of information garnered in search.
-
-Tue Apr 25 12:37:54 1989 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * breakpoint.c (_initialize_breakpoint): Change "delete
- breakpionts" to be in class alias and not have the abbrev flag
- set.
-
- * main.c (symbol_completion_function): Fix to correctly complete
- things that correspond to multiword aliases.
-
- * main.c (complete_on_cmdlist): Don't complete on something if it
- isn't a command or prefix (ie. if it's just a help topic).
-
- * main.c (symbol_completion_function): Set list index to be 0 if
- creating a list with just one element.
-
- * main.c (complete_on_cmdlist): Don't allow things with
- abbrev_flag set to be completion values.
- (symbol_completion_function): Don't accept an exact match if the
- abbrev flag is set.
-
- * dbxread.c (read_type): Fixed typo in comparision to check if
- type number existed.
-
- * dbxread.c (read_type): Made sure to only call dbx_lookup_type on
- typenums if typenums were not -1.
-
-Mon Apr 24 17:52:12 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * symtab.c: Added strings.h as an include file.
-
-Fri Apr 21 15:28:38 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * symtab.c (lookup_partial_symtab): Changed to only return a match
- if the name match is exact (which is what I want in all cases in
- which this is currently used.
-
-Thu Apr 20 11:12:34 1989 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * m-isi.h [REGISTER_U_ADDR]: Installed new version from net.
- * default-dep.c: Deleted inclusion of fcntl.h; apparently not
- necessary.
- * Makefile: Added comment about compiling on isi under 4.3.
-
- * breakpoint.c (break_command_1): Only give decode_line_1 the
- default_breakpoint_defaults if there's nothing better (ie. make
- the default be off of the current_source notes if at all
- possible).
-
- * blockframe.c (get_prev_frame_info): Clean up comments and
- delete code ifdefed out around FRAMELESS_FUNCTION_INVOCATION test.
-
- * remote.c: Added a "?" message to protocol.
- (remote_open): Used at startup.
- (putpkt): Read whatever garbage comes over the line until we see a
- '+' (ie. don't treat garbage as a timeout).
-
- * valops.c (call_function): Eliminated no longer appropriate
- comment.
-
- * infrun.c (wait_for_inferior): Changed several convex conditional
- compilations to be conditional on CANNOT_EXECUTE_STACK.
-
-Wed Apr 19 10:18:17 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * printcmd.c (print_frame_args): Added code to attempt to deal
- with arguments that are bigger than an int.
-
- Continuation of Convex/Fortran changes:
- * printcmd.c (print_scalar_formatted): Added leading zeros to
- printing of large integers.
- (address_info, print_frame_args): Added code to deal with
- LOC_REF_ARG.
- (print_nameless_args): Allow param file to specify a routine with
- which to print typeless integers.
- (printf_command): Deal with long long values well.
- * stack.c (print_frame_arg_vars): Change to deal with LOC_REF_ARG.
- * symmisc.c (print_symbol): Change to deal with LOC_REF_ARG.
- * symseg.h: Added LOC_REF_ARG to enum address_class.
- * symtab.c (lookup_block_symbol): Changed to deal with
- LOC_REF_ARG.
- * valarith.c (value_subscripted_rvalue): Created.
- (value_subscript): Used above when app.
- (value_less, value_equal): Change to cast to (char *) before doing
- comparison, for machines where that casting does something.
- * valops.c (call_function): Setup to deal with machines where you
- cannot execute code on the stack segment.
- * valprint.c (val_print): Make sure that array element size isn't
- zero before printing. Set address of default array to address of
- first element. Put in a couple of int cast. Removed some convex
- specific code. Added check for endianness of machine in case of a
- packed structure. Added code for printing typeless integers and
- for LONG LONG's.
- (set_maximum_command): Change to use parse_and_eval_address to get
- argument (so can use expressions there).
- * values.c (value_of_internalvar, set_internalvar_component,
- set_internalvar, convenience_info): Add in hooks for trapped
- internal vars.
- (unpack_long): Deal with LONG_LONG.
- (value_field): Remove LONGEST cast.
- (using_struct_return): Fixed typo ENUM ==> UNION.
- * xgdb.c (_initialize_xgdb): Make sure that specify_exec_file_hook
- is not called unless we are setting up a windowing environ.
-
-Tue Apr 18 13:43:37 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- Various changes involved in 1) getting gdb to work on the convex,
- and 2) Getting gdb to work with fortran (due to convex!csmith):
- * convex-dep.c, convex-opcode.h, m-convex.h, convex-pinsn.c:
- Created (or replaced with new files).
- * Makefile: Add convex dependent files. Changed default flags to
- gnu malloc to be CFLAGS.
- * config.gdb: Added convex to list of machines.
- * core.c (files_info): Added a FILES_INFO_HOOK to be used if
- defined.
- (xfer_core_file): Conditionalized compilation of xfer_core_file on
- the macro XFER_CORE_FILE.
- * coffread.c (record_misc_function): Made sure it zerod type field
- (which is now being used; see next).
- * dbxread.c: Included some convex dependent include files.
- (copy_pending, fix_common_blocks): Created.
- [STAB_REG_REGNUM, BELIEVE_PCC_PROMOTION]: Created default values;
- may be overridden in m-*.h.
- Included data structures for keeping track of common blocks.
- (dbx_alloc_type): Modified; if called with negative 1's will
- create a type without putting it into the type vector.
- (read_dbx_symtab, read_addl_syms): Modified calls to
- record_misc_function to include the new information.
- (symbol_file_command, psymtab_to_symtab, add_file_command):
- Modified reading in of string table to adapt to machines which
- *don't* store the size of the string table in the first four bytes
- of the string table.
- (read_dbx_symtab, scan_file_globals, read_ofile_symtab,
- read_addl_syms): Modified assignment of namestring to accept null
- index into symtab as ok.
- (read_addl_syms): Modified readin of a new object file to fiddle
- with common blocks correctly.
- (process_one_symbol): Fixed incorrect comment about convex. Get
- symbols local to a lexical context from correct spot on a per
- machine basis. Catch a bug in pcc which occaisionally puts an SO
- where there should be an SOL. Seperate sections for N_BCOMM &
- N_ECOMM.
- (define_symbol): Ignore symbols with no ":". Use
- STAB_REG_TO_REGNUM. Added support for function args calling by
- reference.
- (read_type): Only read type number if one is there. Remove old
- (#if 0'd out) array code.
- (read_array_type): Added code for dealing with adjustable (by
- parameter) arrays half-heartedly.
- (read_enum_type): Allow a ',' to end a list of values.
- (read_range_type): Added code to check for long long.
- * expread.y: Modified to use LONGEST instead of long where
- necessary. Modified to use a default type of int for objects that
- weren't in text space.
- * findvar.c (locate_var_value, read_var_value): Modified to deal
- with args passed by reference.
- * inflow.c (create_inferior): Used CREATE_INFERIOR_HOOK if it
- exists.
- * infrun.c (attach_program): Run terminal inferior when attaching.
- (wait_for_inferior): Removed several convex dependencies.
- * main.c (float_handler): Created.
- Made whatever signal indicates a stop configurable (via macro
- STOP_SIGNAL).
- (main): Setup use of above as a signal handler. Added check for
- "-nw" in args already processed.
- (command_line_input): SIGTSTP ==>STOP_SIGNAL.
-
- * expread.y: Added token BLOCKNAME to remove reduce/reduce
- conflict.
- * Makefile: Change message to reflect new grammar.
-
-Mon Apr 17 13:24:59 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * printcmd.c (compare_ints): Created.
- (print_frame_args): Modified to always print arguments in the
- order in which they were found in the symbol table. Figure out
- what apots are missing on the fly.
-
- * stack.c (up_command): Error if no inferior or core file.
-
- * m-i386.h, m-symmetry.h [FRAMELESS_FUNCTION_INVOCATION]: Created;
- same as m68k.
-
- * dbxread.c (define_symbol): Changed "desc==0" test to
- "processing_gcc_compilation", which is the correct way to do it.
-
-Sat Apr 15 17:18:38 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * expread.y: Added precedence rules for arglists, ?:, and sizeof
- to eliminate some shift-reduce conflicts.
- * Makefile: Modified "Expect" message to conform to new results.
-
-Thu Apr 13 12:29:26 1989 Randall Smith (randy at plantaris.ai.mit.edu)
-
- * inflow.c (terminal_init_inferior): Fixed typo in recent diff
- installation; TIOGETC ==> TIOCGETC.
-
- * m-vax.h, m-sun2.h, m-sun3.h, m-sparc.h, m-hp*.h, m-isi.h,
- m-news.h [FRAMELESS_FUNCTION_INVOCATION]: Created macro with
- appropriate definition.
-
-Wed Apr 12 15:30:29 1989 Randall Smith (randy at plantaris.ai.mit.edu)
-
- * blockframe.c (get_prev_frame_info): Added in a macro to specify
- when a "frame" is called without a frame pointer being setup.
-
- * Makefile [clean]: Made sure to delete gnu malloc if it was being
- used.
-
-Mon Apr 10 12:43:49 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * dbxread.c (process_one_symbol): Reset within_function to 0 after
- last RBRAC of a function.
-
- * dbxread.c (read_struct_type): Changed check for filling in of
- TYPE_MAIN_VARIANT of type.
-
- * inflow.c (create_inferior): Conditionalized fork so that it
- would be used if USG was defined and HAVE_VFORK was not defined.
-
- * defs.h: Added comment about enum command_class element
- class_alias.
-
- * dbxread.c (process_one_symbol): Fixed a typo with interesting
- implications for associative processing in the brain (':' ==> 'c').
-
- * sparc-dep.c (isabranch): Changed name to isannulled, modified to
- deal with coprocessor branches, and improved comment.
- (single_step): Changed to trap at npc + 4 instead of pc +8 on
- annulled branches. Changed name in call to isabranch as above.
-
- * m-sun4os4.h (STACK_END_ADDRESS): Changed it to 0xf8000000 under
- os 4.0.
-
-Sat Apr 8 17:04:07 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * dbxread.c (process_one_symbol): In the case N_FUN or N_FNAME the
- value being refered to is sometimes just a text segment variable.
- Catch this case.
-
- * infrun.c (wait_for_inferior), breakpoint.c
- (breakpoint_stop_status): Move the selection of the frame to
- inside breakpoint_stop_status so that the frame only gets selected
- (and the symbols potentially read in) if the symbols are needed.
-
- * symtab.c (find_pc_psymbol): Fixed minor misthough (pc >=
- fucntion start, not >).
-
- * breakpoint.c (_initialize_breakpoint): Change "delete" internal
- help entry to simply refer to it being a prefix command (since the
- list of subcommands is right there on a "help delete").
-
-Fri Apr 7 15:22:18 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * blockframe.c (find_pc_partial_function): Created; figures out
- what function pc is in (name and address) without reading in any
- new symbols.
- * symtab.h: Added decl for above.
- * infrun.c (wait_for_inferior): Used instead of
- find_pc_function_start.
- * stack.c (print_frame_info): Used instead of hand coding for same
- thing.
-
- * dbxread.c (psymtab_to_symtab): No longer patch readin pst's out
- of the partial_symtab_list; need them there for some checks.
- * blockframe.c (block_for_pc), source.c (select_source_symtab),
- symtab.c (lookup_symbol, find_pc_symtab, list_symbols): Made extra
- sure not to call psymtab_to_symtab with ->readin == 1, since these
- psymtab now stay on the list.
- * symtab.c (sources_info): Now distinguishes between psymtabs with
- readin set and those with it not set.
-
- * symtab.c (lookup_symtab): Added check through partial symtabs
- for name with .c appended.
-
- * source.c (select_source_symtab): Changed semantics a little so
- that the argument means something.
- * source.c (list_command), symtab.c (decode_line_1): Changed call
- to select_source_symtab to match new conventions.
-
- * dbxread.c (add_file_command): This command no longer selects a
- symbol table to list from.
-
- * infrun.c (wait_for_inferior): Only call find_pc_function (to
- find out if we have debugging symbols for a function and hence if
- we should step over or into it) if we are doing a "step".
-
-Thu Apr 6 12:42:28 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * main.c (command_line_input): Added a local buffer and only
- copied information into the global main.c buffer when it is
- appropriate for it to be saved (and repeated).
- (dont_repeat): Only nail line when we are reading from stdin
- (otherwise null lines won't repeat and what's in line needs to be
- saved).
- (read_command_lines): Fixed typo; you don't what to repeat when
- reading command lines from the input stream unless it's standard
- input.
-
- John Gilmore's (gnu@toad.com) mods for USG gdb:
- * inflow.c: Removed inclusion of sys/user.h; no longer necessary.
- (, terminal_init_inferior, terminal_inferior, terminal_ours_1,
- term_status_command, _initialize_inflow) Seperated out declaration
- and usage of terminal mode structures based on the existence of
- the individual ioctls.
- * utils.c (request_quit): Restore signal handler under USG. If
- running under USG initialize sys_siglist at run time (too much
- variation between systems).
-
-Wed Apr 5 13:47:24 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- John Gilmore's (gnu@toad.com) mods for USG gdb:
- * default-dep.c: Moved include of sys/user.h to after include of
- a.out.h.
- (store_inferior_registers): Fixed error message.
- (core_file_command): Improved error messages from reading in of
- u area in core file. Changed calculation of offset of registers
- to account for some machines putting it in as an offset rather
- than an absolute address. Changed error messages for reading of
- registers from core file.
-
- * coffread.c (read_file_hdr): Added final check for BADMAG macro
- to use if couldn't recognize magic number.
- * Makefile: Added explicit directions for alloca addition.
- Included alloca.c in list of possible library files. Cleaned up
- possible library usage. Included additional information on gcc
- and include files.
-
- * source.c, remote.c, inflow.c, dbxread.c, core.c, coffread.c:
- Changed include of sys/fcntl.h to an include of fcntl.h (as per
- posix; presumably this will break fewer machines. I hopw).
- * README: Added a pointer to comments at top of Makefile.
- * Makefile: Added a comment about machines which need fcntl.h in
- sys.
-
-Tue Apr 4 11:29:04 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * valprint.c (set_prettyprint_command, set_unionprint_command,
- format_info): Created.
- (_initialize_valprint): Added to lists of commands.
-
- * gdb.texinfo [Backtrace]: Added a section describing the format
- if symbols have not yet been read in.
-
- * valprint.c (val_print): Added code to prettyprint structures if
- "prettyprint" is set and only to print unions below the top level
- if "unionprint" is set.
-
- * infcmd.c (registers_info), valprint.c (value_print, val_print):
- Added argument to call to val_print indicating deptch of recursion.
-
- * symtab.[ch] (find_pc_psymbol): Created; finds static function
- psymbol with value nearest to but under value passed.
- * stack.c (print_frame_info): Used above to make sure I have best
- fit to pc value.
-
- * symseg.h (struct partial_symbol): Added value field.
- * dbxread.c (read_dbx_symtab): Set value field for partial symbols
- saved (so that we can lookup static symbols).
-
- * symtab.[ch] (find_pc_symtab): Changed to external.
- * stack.c (select_frame): Call above to make sure that symbols for
- a selected frame is readin.
-
-Mon Apr 3 12:48:16 1989 Randall Smith (randy at plantaris.ai.mit.edu)
-
- * stack.c (print_frame_info): Modified to only print out full
- stack frame info on symbols whose tables have been read in.
- * symtab.c, symtab.h (find_pc_psymtab): Made function external;
- above needed it.
-
- * main.c (,set_verbose_command, initialize_main): Created a
- variable "info_verbose" which says to talk it up in various and
- sundry places. Added command to set this variable.
- * gdb.texinfo (GDB Output): Added documentation on "set verbose"
- and changed the name of the "Screen Output" section to "GDB
- Output".
- * dbxread.c (psymtab_to_symtab): Added information message about
- symbol readin. Conditionalized on above.
-
- * dbxread.c (define_symbol): Made an "i" constant be of class
- LOC_CONST and an "r" constant be of class LOC_CONST_BYTES.
-
- * README: Made a note about modifications which may be necessary
- to the manual for this version of gdb.
-
- * blockframe.c (get_prev_frame_info): Now we get saved address and
- check for validity before we check for leafism. This means that
- we will catch the fact that we are in start, but we will miss any
- fns that start calls without an fp. This should be fine.
-
- * m-*.h (FRAME_CHAIN): Modified to return 0 if we are in start.
- This is usually a test for within the first object file.
- * m-sparc.h (FRAME_CHAIN): The test here is simply if the fp saved
- off the the start sp is 0.
-
- * blockframe.c (get_prev_frame_info): Removed check to see if we
- were in start. Screws up sparc.
-
- * m-sparc.h (FRAME_FIND_SAVED_REGISTERS): Changed test for dummy
- frame to not need frame to be innermost.
-
- * gdb.texinfo: Added section on frameless invocations of functions
- and when gdb can and can't deal with this.
-
- * stack.c (frame_info): Disallowed call if no inferior or core
- file; fails gracefully if truely bad stack specfication has been
- given (ie. parse_frame_specification returns 0).
-
-Fri Mar 31 13:59:33 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * infrun.c (normal_stop): Changed references to "unset-env" to
- "delete env".
-
- * infcmd.c (_initialize_infcmd): Change reference to set-args in
- help run to "set args".
-
- * remote.c (getpkt): Allow immediate quit when reading from
- device; it could be hung.
-
- * coffread.c (process_coff_symbol): Modify handling of REG
- parameter symbols.
-
-Thu Mar 30 15:27:23 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * dbxread.c (symbol_file_command): Use malloc to allocate the
- space for the string table in symbol_file_command (and setup a
- cleanup for this). This allows a more graceful error failure if
- there isn't any memory availible (and probably allows more memory
- to be avail, depending on the machine).
-
- Additional mods for handling GNU C++ (from Tiemann):
- * dbxread.c (read_type): Added case for '#' type (method type, I
- believe).
- (read_struct_type): If type code is undefined, make the main
- variant for the type be itself. Allow recognition of bad format
- in reading of structure fields.
- * eval.c (evaluate_subexp): Modify evaluation of a member of a
- structure and pointer to same to make sure that the syntax is
- being used correctly and that the member is being accessed correctly.
- * symseg.h: Added TYPE_CODE_METHOD to enum type_code. Add a
- pointer to an array of argument types to the type structure.
- * symtab.c (lookout_method_type, smash_to_method_type): Created.
- * symtab.h (TYPE_ARG_TYPES): Created.
- * valops.c (call_function): Modified handling of methods to be the
- same as handling of functions; no longer check for members.
- * valprint.c (val_print, type_print_varspec_{prefix,suffix},
- type_print_base): Added code to print method args correctly.
- * values.c (value_virtual_fn_field): Modify access to virtual
- function table.
-
-Wed Mar 29 13:19:34 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * findvar.c: Special cases for REGISTER_WINDOWS: 1) Return 0 if we
- are the innermost frame, and 2) return the next frame in's value
- if the SP is being looked for.
-
- * blockframe.c (get_next_frame): Created; returns the next (inner)
- frame of the called frame.
- * frame.h: Extern delcaration for above.
-
- * main.c (command_line_input): Stick null at end before doing
- history expansion.
-
-Tue Mar 28 17:35:50 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * dbxread.c (read_dbx_symtab): Added namestring assignment to
- N_DATA/BSS/ABS case. Sigh.
-
-Sat Mar 25 17:49:07 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * expread.y: Defined YYDEBUG.
-
-Fri Mar 24 20:46:55 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * symtab.c (make_symbol_completion_list): Completely rewrote to
- never call psymtab_to_symtab, to do a correct search (no
- duplicates) through the visible symbols, and to include structure
- and union fields in the things that it can match.
-
-Thu Mar 23 15:27:44 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * dbxread.c (dbx_create_type): Created; allocates and inits space
- for a type without putting it on the type vector lists.
- (dbx_alloc_type): Uses above.
-
- * Makefile: xgdb.o now produced by default rules for .o.c.
-
-Fri Mar 17 14:27:50 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * infrun.c: Fixed up inclusion of aouthdr.h on UMAX_PTRACE.
-
- * Makefile, config.gdb: Added hp300bsd to potential
- configurations.
- * hp300bsd-dep.c, m-hp300bsd.h: Created.
-
- * infrun.c (wait_for_inferior): Rewrote to do no access to
- inferior until we make sure it's still there.
-
- * inflow.c (inferior_died): Added a select to force the selected
- frame to null when inferior dies.
-
- * dbxread.c (symbol_file_command): free and zero symfile when
- discarding symbols.
-
- * core.c (xfer_core_file): Extended and cleaned up logic in
- interpeting memory address.
-
- * core.c (xfer_core_file): Extended opening comment.
-
-Thu Mar 16 15:39:42 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * coffread.c (symbol_file_command): Free symfile name when freeing
- contents.
-
- * blockframe.c (get_prev_frame_info): Added to fatal error message
- to indicate that it should never happen.
-
- * stack.c (frame_info): Printed out value of "saved" sp seperately
- to call attention to the fact that it isn't stored in memory
- anywhere; the actual previous frames address is printed.
-
- * m-sparc.h (FRAME_FIND_SAVED_REGS): Set address of sp saved in
- frame to value of fp (rather than value of sp in current frame).
-
- * expread.y: Allow "unsigned" as a type itself, as well as a type
- modifier.
-
- * coffread.c: Added declaration for fclose
-
-Fri Mar 10 17:22:31 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * main.c (command_line_input): Checked for -1 return from
- readline; indicates EOF.
-
-Fri Mar 3 00:31:27 1989 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * remote.c (remote_open): Cast return from signal to (void (*)) to
- avoid problems on machines where the return type of signal is (int
- (*)).
-
- * Makefile: Removed deletion of version control from it (users
- will need it for their changes).
-
-Thu Mar 2 15:32:21 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * symmetry-dep.c (print_1167_regs): Print out effective doubles on
- even number regs.
- (fetch_inferior_registers): Get the floating point regs also.
-
- * xgdb.c (do_command): Copied command before calling execute
- command (so that execute_command wouldn't write into text space).
-
- * copying.awk: Created (will produce copying.c as output when
- given COPYING as input).
- * Makefile: Used above to create copying.c.
- * main.c: Took out info_warranty and info_copying.
-
- * *.*: Changed copyright notice to use new GNU General Public
- License (includes necessary changes to manual).
-
- * xgdb.c (create_text_widget): Created text_widget before I create
- the source and sink.
- (print_prompt): Added fflush (stdout).
-
- * Makefile: Added -lXmu to the compilation line for xgdb. Left
- the old one there incase people still had R2.
-
- * README: Added note about -gg format.
-
- * remote.c (getpkt): Fixed typo; && ==> &.
-
- * Makefile: Added new variable READLINE_FLAGS so that I could
- force compilation of readline.c and history.c with -DSYSV on
- system V machines. Mentioned in Makefile comments at top.
-
-Wed Mar 1 17:01:01 1989 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * hp9k320-dep.c (store_inferior_registers): Fixed typo.
-
-Fri Feb 24 14:58:45 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * hp9k320-dep.c (store_inferior_registers,
- fetch_inferior_registers): Added support for remote debugging.
-
- * remote.c (remote_timer): Created.
- (remote_open, readchar): Setup to timeout reads if they take
- longer than "timeout". This allows one to debug how long such
- things take.
- (putpkt): Modified to print a debugging message (if such things
- are enabled) each time it resends a packet.
- (getpkt): Modified to make the variable CSUM unsigned and read it
- CSUM with an & 0xff (presumably to deal with poor sign extension
- on some machines). Also made c1 and c2 unsigned.
- (remote_wait): Changed buffer to unsigned status.
- (remote_store_registers, remote_write_bytes): Puts a null byte at
- the end of the control string.
-
- * infcmd.c (attach_command, detach_command, _initialize_infcmd):
- Made attach_command and detach_command always availible, but
- modified them to only allow device file attaches if ATTACH_DETACH
- is not defined.
-
- * gdb.texinfo: Added cross reference from attach command to remote
- debugging.
-
-Thu Feb 23 12:37:59 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * remote.c (remote_close): Created to close the remote connection
- and set the remote_debugging flag to 0.
- * infcmd.c (detach_command): Now calls the above when appropriate.
-
- * gdb.texinfo: Removed references to the ``Distribution'' section
- in the copyright.
-
- * main.c, utils.c (ISATTY): Created default defintions of this
- macro which use isatty and fileno.
- * utils.c (fprintf_filtered, print_spaces_filtered), main.c
- (command_loop, command_line_input): Used this macro.
- * m-news.h: Created a definition to override this one.
-
- * utils.c (fprintf_filtered): Made line_size static (clueless).
-
- * utils.c (fprintf_filtered): Changed max length of line printed
- to be 255 chars or twice the format length.
-
- * symmetry-dep.c, m-symmetry: Fixed typo (^L ==> ).
-
- * printcmd.c (do_examine): Fixed typo (\n ==> \t).
-
-Wed Feb 22 16:00:33 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- Contributed by Jay Vosburgh (jay@mentor.cc.purdue.edu)
- * m-symmetry.h, symmetry-dep.c: Created.
- * Makefile: Added above in appropriate lists.
- * config.gdb: Added "symmetry" target.
-
- * utils.c (prompt_for_continue): Zero'd chars_printed also.
-
- * utils.c (fprintf_filtered): Call prompt for continue instead of
- doing it yourself.
-
- * dbxread.c (read_dbx_symtab): Added code to conditionalize what
- symbol type holds to "x.o" or "-lx" symbol that indicates the
- beginning of a new file.
-
-Tue Feb 21 16:22:13 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * gdb.texinfo: Deleted @ignore block at end of file.
-
- * findvar.c, stack.c: Changed comments that refered to "frame
- address" to "frame id".
-
- * findvar.c (locate_var_value): Modified so that taking the
- address of an array generates an object whose type is a pointer to
- the elements of the array.
-
-Sat Feb 18 16:35:14 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * gdb.texinfo: Removed reference to "!" as a shell escape
- character. Added a section on controling screen output
- (pagination); changing "Input" section to "User Interface"
- section. Changed many inappropriate subsubsection nodes into
- subsections nodes (in the readline and history expansion
- sections).
-
-Fri Feb 17 11:10:54 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * utils.c (set_screensize_command): Created.
- (_initialize_utils): Added above to setlist.
-
- * main.c (main): Added check to see if ~/.gdbinit and .gdbinit
- were the same file; only one gets read if so. Had to include
- sys/stat.h for this.
-
- * valprint.c (type_print_base): Changed calls to print_spaces to
- print_spaces_filtered.
-
- * main.c (command_line_input): Chaned test for command line
- editing to check for stdin and isatty.
-
- * main.c (command_loop): Call reinitialize_more_filter before each
- command (if reading from stdin and it's a tty).
- utils.c (initialize_more_filter): Changed name to
- reinitialize_more_filter; killed arguments.
- utils.c (_initialize_utils): Created; initialized lines_per_page
- and chars_per_line here.
-
- * utils.c (fprintf_filtered): Removed printing of "\\\n" after
- printing linesize - 1 chars; assume that the screen display will
- take care of that. Still watching that overflow.
-
- * main.c: Created the global variables linesize and pagesize to
- describe the number of chars per line and lines per page.
-
-Thu Feb 16 17:27:43 1989 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * printcmd.c (do_examine, print_scalar_formatted, print_address,
- whatis_command, do_one_display, ptype_command), valprint.c
- (value_print, val_print, type_print_method_args, type_print_1,
- type_print_derivation_info, type_print_varspec_suffix,
- type_print_base), breakpoint.c (breakpoints_info, breakpoint_1),
- values.c (history_info), main.c (editing_info, warranty_info,
- copying_info), infcmd.c (registers_info), inflow.c
- (term_status_command), infrun.c (signals_info), stack.c
- (backtrace_command, print_frame_info), symtab.c (list_symbols,
- output_source_filename), command.c (help_cmd, help_list,
- help_command_list): Replaced calls to printf, fprintf, and putc
- with calls to [f]printf_filtered to handle more processing.
- Killed local more emulations where I noticed them.
-
-Wed Feb 15 15:27:36 1989 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * defs.h, utils.c (initialize_more_filter, fprintf_filtered,
- printf_filtered): Created a printf that will also act as a more
- filter, prompting the user for a <return> whenever the page length
- is overflowed.
-
- * symtab.c (list_symbols): Elminated some code inside of an #if 0.
-
-Tue Feb 14 11:11:24 1989 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * Makefile: Turned off backup versions for this file; it changes
- too often.
-
- * command.c (lookup_cmd, _initialize_command): Changed '!' so that
- it was no longer a shell escape. "sh" must be used.
-
- * main.c (command_line_input, set_history_expansion,
- initialize_main): Turned history expansion on, made it the
- default, and only execute it if the first character in the line is
- a '!'.
-
- * version.c, gdb.texinfo: Moved version to 3.2 (as usual, jumping
- the gun some time before release).
-
- * gdb.texinfo: Added sections (adapted from Brian's notes) on
- command line editing and history expansion.
-
- * main.c (set_command_editing, initialize_main): Modified name to
- set_editing and modified command to "set editing".
-
- * Makefile: Put in dependencies for READLINEOBJS.
-
- * main.c (history_info, command_info): Combined into new command
- info; deleted history_info.
- (initialize_main): Deleted "info history" command; it was
- interfering with the value history.
-
- * coffread.c (enter_linenos): Modified to do bit copy instead of
- pointer dereference, since the clipper machine can't handle having
- longs on short boundaries.
- (read_file_hdr): Added code to get number of syms for clipper.
-
- * stack.c (return_command): Fixed method for checking when all of
- the necessary frames had been popped.
-
- * dbxread.c (read_dbx_symtab (ADD_PSYMBOL_TO_LIST)): Fixed typo in
- allocation length.
-
-Mon Feb 13 10:03:27 1989 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * dbxread.c (read_dbx_symtab): Split assignment to namestring into
- several different assignments (so that it wouldn't be done except
- when it had to be). Shortened switches and duplicated code to
- produce the lowest possible execution time. Commented (at top of
- switch) which code I duplicated.
-
- * dbxread.c (read_dbx_symtab): Modified which variables were
- register and deleted several variables which weren't used. Also
- eliminated 'F' choice from subswitch, broke out strcmp's, reversed
- compare on line 1986, and elminated test for !namestring[0]; it is
- caught by following test for null index of ':'.
-
-Sun Feb 12 12:57:56 1989 Randall Smith (randy at plantaris.ai.mit.edu)
-
- * main.c (gdb_completer_word_break_characters): Turned \~ into ~.
-
-Sat Feb 11 15:39:06 1989 Randall Smith (randy at plantaris.ai.mit.edu)
-
- * symtab.c (find_pc_psymtab): Created; checks all psymtab's till
- it finds pc.
- (find_pc_symtab): Used; fatal error if psymtab found is readin
- (should have been caught in symtab loop).
- (lookup_symbol): Added check before scan through partial symtab
- list for symbol name to be on the misc function vector (only if in
- VAR_NAMESPACE). Also made sure that psymtab's weren't fooled with
- if they had already been read in.
- (list_symbols): Checked through misc_function_vector for matching
- names if we were looking for functions.
- (make_symbol_completion_list): Checked through
- misc_function_vector for matching names.
- * dbxread.c (read_dbx_symtab): Don't bother to do processing on
- global function types; this will be taken care of by the
- misc_function hack.
-
- * symtab.h: Modified comment on misc_function structure.
-
-Fri Feb 10 18:09:33 1989 Randall Smith (randy at plantaris.ai.mit.edu)
-
- * symseg.h, dbxread.c (read_dbx_symtab, init_psymbol_list,
- start_psymtab, end_psymtab), coffread.c (_initialize_coff),
- symtab.c (lookup_partial_symbol, list_symbols,
- make_symbol_completion_list): Changed separate variables for
- description of partial symbol allocation into a specific kind of
- structure.
-
- (read_dbx_symtab, process_symbol_for_psymtab): Moved most of
- process_symbol_for_psymtab up into read_dbx_symtab, moved a couple
- of symbol types down to the ingore section, streamlined (I hope)
- code some, modularized access to psymbol lists.
-
-Thu Feb 9 13:21:19 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * main.c (command_line_input): Made sure that it could recognize
- newlines as indications to repeat the last line.
-
- * symtab.c (_initialize_symtab): Changed size of builtin_type_void
- to be 1 for compatibility with gcc.
-
- * main.c (initialize_main): Made history_expansion the default
- when gdb is compiled with HISTORY_EXPANSION.
-
- * readline.c, readline.h, history.c, history.h, general.h,
- emacs_keymap.c, vi_keymap.c, keymaps.c, funmap.c: Made all of
- these links to /gp/gnu/bash/* to keep them updated.
- * main.c (initialize_main): Made default be command editing on.
-
-Wed Feb 8 13:32:04 1989 & Smith (randy at hobbes)
-
- * dbxread.c (read_dbx_symtab): Ignore N_BSLINE on first
- readthrough.
-
- * Makefile: Removed convex-dep.c from list of distribution files.
-
-Tue Feb 7 14:06:25 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * main.c: Added command lists sethistlist and unsethistlist to
- accesible command lists.
- (parse_binary_operation): Created to parse a on/1/yes vs. off/0/no
- spec.
- (set_command_edit, set_history, set_history_expansion,
- set_history_write, set_history_size, set_history_filename,
- command_info, history_info): Created to allow users to control
- various aspects of command line editing.
-
- * main.c (symbol_creation_function): Created.
- (command_line_input, initialize_main): Added rest of stuff
- necessary for calling bfox' command editing routines under
- run-time control.
- * Makefile: Included readline and history source files for command
- editing; also made arrangements to make sure that the termcap
- library was available.
- * symtab.c (make_symbol_completion_list): Created.
-
-Mon Feb 6 16:25:25 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * main.c: Invented variables to control command editing.
- command_editing_p, history_expansion_p, history_size,
- write_history_p, history_filename. Initialized them to default
- values in initialize_main.
-
- * infcmd.c (registers_info), infrun.c (signals_info),
- * main.c (gdb_read_line): Changed name to command_line_input.
- (readline): Changed name to gdb_readline; added second argument
- indicating that the read value shouldn't be saved (via malloc).
- * infcmd.c (registers_info), infrun.c (signals_info), main.c
- (copying_info), symtab.c (output_source_filename, MORE,
- list_symbols): Converted to use gdb_readline in place of
- gdb_read_line.
-
-
-Sun Feb 5 17:34:38 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * blockframe.c (get_frame_saved_regs): Removed macro expansion
- that had accidentally been left in the code.
-
-Sat Feb 4 17:54:14 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * main.c (gdb_read_line, readline): Added function readline and
- converted gdb_read_line to use it. This was a conversion to the
- line at a time style of input, in preparation for full command
- editing.
-
-Fri Feb 3 12:39:03 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * dbxread.c (read_dbx_symtab): Call end_psymtab at the end of
- read_dbx_symtab if any psymtab still needs to be completed.
-
- * config.gdb, sun3-dep.c: Brought these into accord with the
- actual sun2 status (no floating point period; sun3-dep.c unless
- has os > 3.0).
- * m-sun2os2.h: Deleted; not needed.
-
- * config.gdb: Added a couple of aliases for machines in the
- script.
-
- * infrun.c: Added inclusion of aouthdr.h inside of #ifdef UMAX
- because ptrace needs to know about the a.out header.
-
- * Makefile: Made dep.o depend on dep.c and config.status only.
-
- * expread.y: Added declarations of all of the new write_exp_elt
- functions at the include section in the top.
-
- * Makefile: Added a YACC definition so that people can use bison
- if they wish.
-
- * Makefile: Added rms' XGDB-README to the distribution.
-
- * Makefile: Added removal of init.o on a "make clean".
-
-Thu Feb 2 16:27:06 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * *-dep.c: Deleted definition of COFF_FORMAT if AOUTHDR was
- defined since 1) We *may* (recent mail message) want to define
- AOUTHDR under a basically BSD system, and 2) AOUTHDR is sometimes
- a typedef in coff encapsulation setups. Also removed #define's of
- AOUTHDR if AOUTHDR is already defined (inside of coff format).
- * core.c, dbxread.c: Removed #define's of AOUTHDR if AOUTHDR is
- already defined (inside of coff format).
-
-Tue Jan 31 12:56:01 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * GDB 3.1 released.
-
- * values.c (modify_field): Changed test for endianness to assign
- to integer and reference character (so that all bits would be
- defined).
-
-Mon Jan 30 11:41:21 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * news-dep.c: Deleted inclusion of fcntl.h; just duplicates stuff
- found in sys/file.h.
-
- * i386-dep.c: Included default definition of N_SET_MAGIC for
- COFF_FORMAT.
-
- * config.gdb: Added checks for several different operating
- systems.
-
- * coffread.c (read_struct_type): Put in a flag variable so that
- one could tell when you got to the end of a structure.
-
- * sun3-dep.c (core_file_command): Changed #ifdef based on SUNOS4
- to ifdef based on FPU.
-
- * infrun.c (restore_inferior_status): Changed error message to
- "unable to restore previously selected frame".
-
- * dbxread.c (read_dbx_symtab): Used intermediate variable in error
- message reporting a bad symbol type. (scan_file_globals,
- read_ofile_symtab, read_addl_syms): Data type of "type" changed to
- unsigned char (which is what it is).
- * i386-dep.c: Removed define of COFF_FORMAT if AOUTHDR is defined.
- Removed define of a_magic to magic (taken care of by N_MAGIC).
- (core_file_command): Zero'd core_aouthdr instead of setting magic
- to zero.
- * i386-pinsn.c: Changed jcxz == jCcxz in jump table.
- (putop): Added a case for 'C'.
- (OP_J): Added code to handle possible masking of PC value on
- certain kinds of data.
- m-i386gas.h: Moved COFF_ENCAPSULATE to before inclusion of
- m-i386.h and defined NAMES_HAVE_UNDERSCORE.
-
- * coffread.c (unrecrod_misc_function, read_coff_symtab): Added
- symbol number on which error occured to error output.
-
-Fri Jan 27 11:55:04 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * Makefile: Removed init.c in make clean. Removed it without -f
- and with leading - in make ?gdb.
-
-Thu Jan 26 15:08:03 1989 Randall Smith (randy at gluteus.ai.mit.edu)
-
- Changes to get it to work on gould NP1.
- * dbxread.c (read_dbx_symtab): Included cases for N_NBDATA and
- N_NBBSS.
- (psymtab_to_symtab): Changed declaration of hdr to
- DECLARE_FILE_HEADERS. Changed access to use STRING_TABLE_SIZE and
- SYMBOL_TABLE_SIZE.
- * gld-pinsn.c (findframe): Added declaration of framechain() as
- FRAME_ADDR.
-
- * coffread.c (read_coff_symtab): Avoided treating typedefs as
- external symbol definitions.
-
-Wed Jan 25 14:45:43 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * Makefile: Removed reference to alloca.c. If they need it, they
- can pull alloca.o from the gnu-emacs directory.
-
- * version.c, gdb.texinfo: Updated version to 3.1 (jumping the gun
- a bit so that I won't forget when I release).
-
- * m-sun2.h, m-sun2os2.h, m-sun3os4.h, config.gdb: Modified code so
- that default includes new sun core, ptrace, and attach-detach.
- Added defaults for sun 2 os 2.
-
- Modifications to reset stack limit back to what it used to be just
- before exec. All mods inside of #ifdef SET_STACK_LIMIT_HUGE.
- * main.c: Added global variable original_stack_limit.
- (main): Set original_stack_limit to original stack limit.
- * inflow.c: Added inclusion of necessary files and external
- reference to original_stack_limit.
- (create_inferior): Reset stack limit to original_stack_limit.
-
- * dbxread.c (read_dbx_symtab): Killed PROFILE_SYMBOLS ifdef.
-
- * sparc-dep.c (isabranch): Multiplied offset by 4 before adding it
- to addr to get target.
-
- * Makefile: Added definition of SHELL to Makefile.
-
- * m-sun2os4.h: Added code to define NEW_SUN_PTRACE, NEW_SUN_CORE,
- and ATTACH_DETACH.
- * sun3-dep.c: Added code to avoid fp regs if we are on a sun2.
-
-Tue Jan 24 17:59:14 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * dbxread.c (read_array_type): Added function.
- (read_type): Added call to above instead of inline code.
-
- * Makefile: Added ${GNU_MALLOC} to the list of dependencies for
- the executables.
-
-Mon Jan 23 15:08:51 1989 Randall Smith (randy at plantaris.ai.mit.edu)
-
- * gdb.texinfo: Added paragraph to summary describing languages
- with which gdb can be run. Also added descriptions of the
- "info-methods" and "add-file" commands.
-
- * symseg.h: Commented a range type as having TYPE_TARGET_TYPE
- pointing at the containing type for the range (often int).
- * dbxread.c (read_range_type): Added code to do actual range types
- if they are defined. Assumed that the length of a range type is
- the length of the target type; this is a lie, but will do until
- somebody gets back to me as to what these silly dbx symbols mean.
-
- * dbxread.c (read_range_type): Added code to be more picky about
- recognizing builtins as range types, to treat types defined as
- subranges of themselves to be subranges of int, and to recognize
- the char type idiom from dbx as a special case.
-
-Sun Jan 22 01:00:13 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * m-vax.h: Removed definition of FUNCTION_HAS_FRAME_POINTER.
- * blockframe.c (get_prev_frame_info): Removed default definition
- and use of above. Instead conditionalized checking for leaf nodes
- on FUNCTION_START_OFFSET (see comment in code).
-
-Sat Jan 21 16:59:19 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * dbxread.c (read_range_type): Fixed assumption that integer was
- always type 1.
-
- * gdb.texinfo: Fixed spelling mistake and added a note in the
- running section making it clear that users may invoke subroutines
- directly from gdb.
-
- * blockframe.c: Setup a default definition for the macro
- FUNCTION_HAS_FRAME_POINTER.
- (get_prev_frame_info): Used this macro instead of checking
- SKIP_PROLOGUE directly.
- * m-vax.h: Overroad definition; all functions on the vax have
- frame pointers.
-
-Fri Jan 20 12:25:35 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * core.c: Added default definition of N_MAGIC for COFF_FORMAT.
-
- * xgdb.c: Installed a fix to keep the thing from dying when there
- isn't any frame selected.
-
- * core.c: Made a change for the UMAX system; needs a different
- file included if using that core format.
-
- * Makefile: Deleted duplicate obstack.h in dbxread.c dependency.
-
- * munch: Modified (much simpler) to cover (I hope) all cases.
-
- * utils.c (save_cleanups, restore_cleanups): Added functions to
- allow you to push and pop the chain of cleanups to be done.
- * defs.h: Declared the new functions.
- * main.c (catch_errors): Made sure that the only cleanups which
- would be done were the ones put on the chain *after* the current
- location.
-
- * m-*.h (FRAME_CHAIN_VALID): Removed check on pc in the current
- frame being valid.
- * blockframe.c (get_prev_frame_info): Made the assumption that if
- a frame's pc value was within the first object file (presumed to
- be /lib/crt0.o), that we shouldn't go any higher.
-
- * infrun.c (wait_for_inferior): Do *not* execute check for stop pc
- at step_resume_break if we are proceeding over a breakpoint (ie.
- if trap_expected != 0).
-
- * Makefile: Added -g to LDFLAGS.
-
- * m-news.h (POP_FRAME) Fixed typo.
-
- * printcmd.c (print_frame_args): Modified to print out register
- params in order by .stabs entry, not by register number.
-
- * sparc-opcode.h: Changed declaration of (struct
- arith_imm_fmt).simm to be signed (as per architecture manual).
- * sparc-pinsn.c (fprint_addr1, print_insn): Forced a cast to an
- int, so that we really would get signed behaivior (default for sun
- cc is unsigned).
-
- * i386-dep.c (i386_get_frame_setup): Replace function with new
- function provided by pace to fix bug in recognizing prologue.
-
-Thu Jan 19 11:01:22 1989 Randall Smith (randy at plantaris.ai.mit.edu)
-
- * infcmd.c (run_command): Changed error message to "Program not
- restarted."
-
- * value.h: Changed "frame" field in value structure to be a
- FRAME_ADDR (actually CORE_ADDR) so that it could survive across
- calls.
-
- * m-sun.h (FRAME_FIND_SAVED_REGS): Fixed a typo.
-
- * value.h: Added lval: "lval_reg_frame_relative" to indicate a
- register that must be interpeted relative to a frame. Added
- single entry to value structure: "frame", used to indicate which
- frame a relative regnum is relative to.
- * findvar.c (value_from_register): Modified to correctly setup
- these fields when needed. Deleted section to fiddle with last
- register copied on little endian machine; multi register
- structures will always occupy an integral number of registers.
- (find_saved_register): Made extern.
- * values.c (allocate_value, allocate_repeat_value): Zero frame
- field on creation.
- * valops.c (value_assign): Added case for lval_reg_frame_relative;
- copy value out, modify it, and copy it back. Desclared
- find_saved_register as being external.
- * value.h: Removed addition of kludgy structure; thoroughly
- commented file.
- * values.c (free_value, free_all_values, clear_value_history,
- set_internalvar, clear_internavars): Killed free_value.
-
-Wed Jan 18 20:09:39 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * value.h: Deleted struct partial_storage; left over from
- yesterday.
-
- * findvar.c (value_from_register): Added code to create a value of
- type lval_reg_partsaved if a value is in seperate registers and
- saved in different places.
-
-Tue Jan 17 13:50:18 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * value.h: Added lval_reg_partsaved to enum lval_type and
- commented enum lval_type. Commented value structure.
- Added "struct partial_register_saved" to value struct; added
- macros to deal with structure to value.h.
- * values.c (free_value): Created; special cases lval_reg_partsaved
- (which has a pointer to an array which also needs to be free).
- (free_all_values, clear_value_history, set_internalvar,
- clear_internalvars): Modified to use free_values.
-
- * m-sunos4.h: Changed name to sun3os4.h.
- * m-sun2os4.h, m-sun4os4.h: Created.
- * config.gdb: Added configuration entries for each of the above.
- * Makefile: Added into correct lists.
-
- * Makefile: Added dependencies on a.out.encap.h. Made
- a.out.encap.h dependent on a.out.gnu.h and dbxread.c dependent on
- stab.gnu.h.
-
- * infrun.c, remote.c: Removed inclusion of any a.out.h files in
- these files; they aren't needed.
-
- * README: Added comment about bug reporting and comment about
- xgdb.
-
- * Makefile: Added note to HPUX dependent section warning about
- problems if compiled with gcc and mentioning the need to add
- -Ihp-include to CFLAGS if you compile on those systems. Added a
- note about needing the GNU nm with compilers *of gdb* that use the
- coff encapsulate feature also. * hp-include: Made symbolic link
- over to /gp/gnu/binutils.
-
- * Makefile: Added TSOBS NTSOBS OBSTACK and REGEX to list of things
- to delete in "make clean". Also changed "squeakyclean" target as
- "realclean".
-
- * findvar.c (value_from_register): Added assignment of VALUE_LVAL
- to be lval_memory when that is appropriate (original code didn't
- bother because it assumed that it was working with a pre lval
- memoried value).
-
- * expread.y (yylex): Changed to only return type THIS if the
- symbol "$this" is defined in some block superior or equal to the
- current expression context block.
-
-Mon Jan 16 13:56:44 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * m-*.h (FRAME_CHAIN_VALID): On machines which check the relation
- of FRAME_SAVED_PC (thisframe) to first_object_file_end (all except
- gould), make sure that the pc of the current frame also passes (in
- case someone stops in _start).
-
- * findvar.c (value_of_register): Changed error message in case of
- no inferior or core file.
-
- * infcmd.c (registers_info): Added a check for inferior or core
- file; error message if not.
-
- * main.c (gdb_read_line): Modified to take prompt as argument and
- output it to stdout.
- * infcmd.c (registers_info, signals_info), main.c (command_loop,
- read_command_lines, copying_info), symtab.c (decode_line_2,
- output_source_filename, MORE, list_symbols): Changed calling
- convention used to call gdb_read_line.
-
- * infcmd.c, infrun.c, main.c, symtab.c: Changed the name of the
- function "read_line" to "gdb_read_line".
- * breakpoint.c: Deleted external referenced to function
- "read_line" (not needed by code).
-
-Fri Jan 13 12:22:05 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * i386-dep.c: Include a.out.encap.h if COFF_ENCAPSULATE.
- (N_SET_MAGIC): Defined if not defined by include file.
- (core_file_command): Used N_SET_MAGIC instead of assignment to
- a_magic.
- (exec_file_command): Stuck in a HEADER_SEEK_FD.
-
- * config.gdb: Added i386-dep.c as depfile for i386gas choice.
-
- * munch: Added -I. to cc to pick up things included by the param
- file.
-
- * stab.gnu.def: Changed name to stab.def (stab.gnu.h needs this name).
- * Makefile: Changed name here also.
- * dbxread.c: Changed name of gnu-stab.h to stab.gnu.h.
-
- * gnu-stab.h: Changed name to stab.gnu.h.
- * stab.gnu.def: Added as link to binutils.
- * Makefile: Put both in in the distribution.
-
-Thu Jan 12 11:33:49 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * dbxread.c: Made which stab.h is included dependent on
- COFF_ENCAPSULATE; either <stab.h> or "gnu-stab.h".
- * Makefile: Included gnu-stab.h in the list of files to include in
- the distribution.
- * gnu-stab.h: Made a link to /gp/gnu/binutils/stab.h
-
- * Makefile: Included a.out.gnu.h and m-i386gas.h in list of
- distribution files.
- * m-i386gas.h: Changed to include m-i386.h and fiddle with it
- instead of being a whole new file.
- * a.out.gnu.h: Made a link to /gp/gnu/binutils/a.out.gnu.h.
-
- Chris Hanson's changes to gdb for hp Unix.
- * Makefile: Modified comments on hpux.
- * hp9k320-dep.c: #define'd WOPR & moved inclusion of signal.h
- * inflow.c: Moved around declaratiosn of <sys/fcntl.h> and
- <sys/ioctl.h> inside of USG depends and deleted all SYSV ifdef's
- (use USG instead).
- * munch: Modified to accept any number of spaces between the T and
- the symbol name.
-
- Pace's changes to gdb to work with COFF_ENCAPSULATE (robotussin):
- * config.gdb: Added i386gas to targets.
- * default-dep.c: Include a.out.encap.h if COFF_ENCAPSULATE.
- (N_SET_MAGIC): Defined if not defined by include file.
- (core_file_command): Used N_SET_MAGIC instead of assignment to a_magic.
- (exec_file_command): Stuck in a HEADER_SEEK_FD.
- * infrun.c, remote.c: Added an include of a.out.encap.h if
- COFF_ENCAPSULATE defined. This is commented out in these two
- files, I presume because the definitions aren't used.
- * m-i386gas.h: Created.
- * dbxread.c: Included defintions for USG.
- (READ_FILE_HEADERS): Now uses HEADER_SEEK_FD if it exists.
- (symbol_file_command): Deleted use of HEADER_SEEK_FD.
- * core.c: Deleted extra definition of COFF_FORMAT.
- (N_MAGIC): Defined to be a_magic if not already defined.
- (validate_files): USed N_MAGIC instead of reading a_magic.
-
-Wed Jan 11 12:51:00 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * remote.c: Upped PBUFSIZ.
- (getpkt): Added zeroing of c inside loop in case of error retry.
-
- * dbxread.c (read_dbx_symtab, process_symbol_for_psymtab): Removed
- code to not put stuff with debugging symbols in the misc function
- list. Had been ifdef'd out.
-
- * gdb.texinfo: Added the fact that the return value for a function
- is printed if you use return.
-
- * infrun.c (wait_for_inferior): Removed test in "Have we hit
- step_resume_breakpoint" for sp values in proper orientation. Was
- in there for recursive calls in functions without frame pointers
- and it was screwing up calls to alloca.
-
- * dbxread.c: Added #ifdef COFF_ENCAPSULATE to include
- a.out.encap.h.
- (symbol_file_command): Do HEADER_SEEK_FD when defined.
- * dbxread.c, core.c: Deleted #ifdef ROBOTUSSIN stuff.
- * robotussin.h: Deleted local copy (was symlink).
- * a.out.encap.h: Created symlink to
- /gp/gnu/binutils/a.out.encap.h.
- * Makefile: Removed robotussin.h and included a.out.encap.h in
- list of files.
-
- * valprint.c (val_print, print_scalar_formatted): Changed default
- precision of printing float value; now 6 for a float and 16 for a
- double.
-
- * findvar.c (value_from_register): Added code to deal with the
- case where a value is spread over several registers. Still don't
- deal with the case when some registers are saved in memory and
- some aren't.
-
-Tue Jan 10 17:04:04 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * xgdb.c (xgdb_create_window): Removed third arg (XtDepth) to
- frameArgs.
-
- * infrun.c (handle_command): Error if signal number is less or
- equal to 0 or greater or equal to NSIG or a signal number is not
- provided.
-
- * command.c (lookup_cmd): Modified to not convert command section
- of command line to lower case in place (in case it isn't a
- subcommand, but an argument to a command).
-
-Fri Jan 6 17:57:34 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * dbxread.c: Changed "text area" to "data area" in comments on
- N_SETV.
-
-Wed Jan 4 12:29:54 1989 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * dbxread.c: Added definitions of gnu symbol types after inclusion
- of a.out.h and stab.h.
-
-Mon Jan 2 20:38:31 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * eval.c (evaluate_subexp): Binary logical operations needed to
- know type to determine whether second value should be evaluated.
- Modified to discover type before binup_user_defined_p branch.
- Also commented "enum noside".
-
- * Makefile: Changed invocations of munch to be "./munch".
-
- * gdb.texinfo: Updated to refer to current version of gdb with
- January 1989 last update.
-
- * coffread.c (end_symtab): Zero context stack when finishing
- lexical contexts.
- (read_coff_symtab): error if context stack 0 in ".ef" else case.
-
- * m-*.h (FRAME_SAVED_PC): Changed name of argument from "frame" to
- "FRAME" to avoid problems with replacement of "->frame" part of
- macro.
-
- * i386-dep.c (i386_get_frame_setup): Added codestream_get() to
- move codestream pointer up to the correct location in "subl $X,
- %esp" case.
-
-Sun Jan 1 14:24:35 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * valprint.c (val_print): Rewrote routine to print string pointed
- to by char pointer; was producing incorrect results when print_max
- was 0.
-
-Fri Dec 30 12:13:35 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * dbxread.c (read_dbx_symtab, process_symbol_for_psymtab): Put
- everything on the misc function list.
-
- * Checkpointed distribution.
-
- * Makefile: Added expread.tab.c to the list of things slated for
- distribution.
-
-Thu Dec 29 10:06:41 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * stack.c (set_backtrace_limit_command, backtrace_limit_info,
- bactrace_command, _initialize_stack): Removed modifications for
- limit on backtrace. Piping the backtrace through an interuptable
- "more" emulation is a better way to do it.
-
-Wed Dec 28 11:43:09 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * stack.c
- (set_backtrace_limit_command): Added command to set a limit to the
- number of frames for a backtrace to print by default.
- (backtrace_limit_info): To print the current limit.
- (backtrace_command): To use the limit.
- (_initialize_stack): To initialize the limit to its default value
- (30), and add the set and info commands onto the appropriate
- command lists.
-
- * gdb.texinfo: Documented changes to "backtrace" and "commands"
- commands.
-
- * stack.c (backtrace_command): Altered so that a negative argument
- would show the last few frames on the stack instead of the first
- few.
- (_initialize_stack): Modified help documentation.
-
- * breakpoint.c (commands_command): Altered so that "commands" with
- no argument would refer to the last breakpoint set.
- (_initialize_breakpoint): Modified help documentation.
-
- * infrun.c (wait_for_inferior): Removed ifdef on Sun4; now you can
- single step through compiler generated sub calls and will die if
- you next off of the end of a function.
-
- * sparc-dep.c (single_step): Fixed typo; "break_insn" ==> "sizeof
- break_insn".
-
- * m-sparc.h (INIT_EXTRA_FRAME_INFO): Set the bottom of a stack
- frame to be the bottom of the stack frame inner from this, if that
- inner one is a leaf node.
-
- * dbxread.c (read_dbx_symtab): Check to make sure we don't add a
- psymtab to it's own dependency list.
-
- * dbxread.c (read_dbx_symtab): Modified check for duplicate
- dependencies to catch them correctly.
-
-Tue Dec 27 17:02:09 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * m-*.h (FRAME_SAVED_PC): Modified macro to take frame info
- pointer as argument.
- * stack.c (frame_info), blockframe.c (get_prev_frame_info),
- gld-pinsn.c (findframe), m-*.h (SAVED_PC_AFTER_CALL,
- FRAME_CHAIN_VALID, FRAME_NUM_ARGS): Changed usage of macros to
- conform to above.
- * m-sparc.h (FRAME_SAVED_PC), sparc-dep.c (frame_saved_pc):
- Changed frame_saved_pc to have a frame info pointer as an
- argument.
-
- * m-vax.h, m-umax.h, m-npl.h, infrun.c (wait_for_inferior),
- blockframe.c (get_prev_frame_info): Modified SAVED_PC_AFTER_CALL
- to take a frame info pointer as an argument.
-
- * blockframe.c (get_prev_frame_info): Altered the use of the
- macros FRAME_CHAIN, FRAME_CHAIN_VALID, and FRAME_CHAIN_COMBINE to
- use frame info pointers as arguments instead of frame addresses.
- * m-vax.h, m-umax.h, m-sun3.h, m-sun3.h, m-sparc.h, m-pn.h,
- m-npl.h, m-news.h, m-merlin.h, m-isi.h, m-hp9k320.h, m-i386.h:
- Modified definitions of the above macros to suit.
- * m-pn.h, m-npl.h, gould-dep.c (findframe): Modified findframe to
- use a frame info argument; also fixed internals (wouldn't work
- before).
-
- * m-sparc.h: Cosmetic changes; reordered some macros and made sure
- that nothing went over 80 lines.
-
-Thu Dec 22 11:49:15 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * Version 3.0 released.
-
- * README: Deleted note about changing -lobstack to obstack.o.
-
-Wed Dec 21 11:12:47 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * m-vax.h (SKIP_PROLOGUE): Now recognizes gcc prologue also.
-
- * blockframe.c (get_prev_frame_info): Added FUNCTION_START_OFFSET
- to result of get_pc_function_start.
- * infrun.c (wait_for_inferior): Same.
-
- * gdb.texinfo: Documented new "step" and "next" behavior in
- functions without line number information.
-
-Tue Dec 20 18:00:45 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * infcmd.c (step_1): Changed behavior of "step" or "next" in a
- function witout line number information. It now sets the step
- range around the function (to single step out of it) using the
- misc function vector, warns the user, and continues.
-
- * symtab.c (find_pc_line): Zero "end" subsection of returned
- symtab_and_line if no symtab found.
-
-Mon Dec 19 17:44:35 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * i386-pinsn.c (OP_REG): Added code from pace to streamline
- disassembly and corrected types.
- * i386-dep.c
- (i386_follow_jump): Code added to follow byte and word offset
- branches.
- (i386_get_frame_setup): Expanded to deal with more wide ranging
- function prologue.
- (i386_frame_find_saved_regs, i386_skip_prologue): Changed to use
- i386_get_frame_setup.
-
-
-Sun Dec 18 11:15:03 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * m-sparc.h: Deleted definition of SUN4_COMPILER_BUG; was designed
- to avoid something that I consider a bug in our code, not theirs,
- and which I fixed earlier. Also deleted definition of
- CANNOT_USE_ARBITRARY_FRAME; no longer used anywhere.
- FRAME_SPECIFICATION_DYADIC used instead.
-
- * infrun.c (wait_for_inferior): On the sun 4, if a function
- doesn't have a prologue, a next over it single steps into it.
- This gets around the problem of a "call .stret4" at the end of
- functions returning structures.
- * m-sparc.h: Defined SUN4_COMPILER_FEATURE.
-
- * main.c (copying_info): Seperated the last printf into two
- printfs. The 386 compiler will now handle it.
-
- * i386-pinsn.c, i386-dep.c: Moved print_387_control_word,
- print_387_status_word, print_387_status, and i386_float_info to
- dep.c Also included reg.h in dep.c.
-
-Sat Dec 17 15:31:38 1988 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * main.c (source_command): Don't close instream if it's null
- (indicating execution of a user-defined command).
- (execute_command): Set instream to null before executing
- commands and setup clean stuff to put it back on error.
-
- * inflow.c (terminal_inferior): Went back to not checking the
- ioctl returns; there are some systems when this will simply fail.
- It seems that, on most of these systems, nothing bad will happen
- by that failure.
-
- * values.c (value_static_field): Fixed dereferencing of null
- pointer.
-
- * i386-dep.c (i386_follow_jump): Modified to deal with
- unconditional byte offsets also.
-
- * dbxread.c (read_type): Fixed typo in function type case of switch.
-
- * infcmd.c (run_command): Does not prompt to restart if command is
- not from a tty.
-
-Fri Dec 16 15:21:58 1988 Randy Smith (randy at calvin)
-
- * gdb.texinfo: Added a third option under the "Cannot Insert
- Breakpoints" workarounds.
-
- * printcmd.c (display_command): Don't do the display unless there
- is an active inferior; only set it.
-
- * findvar.c (value_of_register): Added an error check for calling
- this when the inferior isn't active and a core file isn't being
- read.
-
- * config.gdb: Added reminder about modifying REGEX in the
- makefile for the 386.
-
- * i386-pinsn.c, i386-dep.c: Moved m-i386.h helper functions over
- to i386-dep.c.b
-
-Thu Dec 15 14:04:25 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * README: Added a couple of notes about compiling gdb with itself.
-
- * breakpoint.c (set_momentary_breakpoint): Only takes FRAME_FP of
- frame if frame is non-zero.
-
- * printcmd.c (print_scalar_formatted): Implemented /g size for
- hexadecimal format on machines without an 8 byte integer type. It
- seems to be non-trivial to implement /g for other formats.
- (decode_format): Allowed hexadecimal format to make it through /g
- fileter.
-
-Wed Dec 14 13:27:04 1988 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * expread.y: Converted all calls to write_exp_elt from the parser
- to calls to one of write_exp_elt_{opcode, sym, longcst, dblcst,
- char, type, intern}. Created all of these routines. This gets
- around possible problems in passing one of these things in one ear
- and getting something different out the other. Eliminated
- SUN4_COMPILER_BUG ifdef's; they are now superfluous.
-
- * symmisc.c (free_all_psymtabs): Reinited partial_symtab_list to 0.
- (_initialize_symmisc): Initialized both symtab_list and
- partial_symtab_list.
-
- * dbxread.c (start_psymtab): Didn't allocate anything on
- dependency list.
- (end_psymtab): Allocate dependency list on psymbol obstack from
- local list.
- (add_psymtab_dependency): Deleted.
- (read_dbx_symtab): Put dependency on local list if it isn't on it
- already.
-
- * symtab.c: Added definition of psymbol_obstack.
- * symtab.h: Added declaration of psymbol_obstack.
- * symmisc.c (free_all_psymtabs): Added freeing and
- reinitionaliztion of psymbol_obstack.
- * dbxread.c (free_all_psymbols): Deleted.
- (start_psymtab, end_psymtab,
- process_symbol_for_psymtab): Changed most allocation
- of partial symbol stuff to be off of psymbol_obstack.
-
- * symmisc.c (free_psymtab, free_all_psymtabs): Deleted
- free_psymtab subroutine.
-
- * symtab.h: Removed num_includes and includes from partial_symtab
- structure; no longer needed now that all include files have their
- own psymtab.
- * dbxread.c (start_psymtab): Eliminated initialization of above.
- (end_psymtab): Eliminated finalization of above; get
- includes from seperate list.
- (read_dbx_symtab): Moved includes from psymtab list to
- their own list; included in call to end_psymtab.
- * symmisc.c (free_psymtab): Don't free includes.
-
-Tue Dec 13 14:48:14 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * i386-pinsn.c: Reformatted entire file to correspond to gnu
- software indentation conventions.
-
- * sparc-dep.c (skip_prologue): Added capability of recognizign
- stores of input register parameters into stack slots.
-
- * sparc-dep.c: Added an include of sparc-opcode.h.
- * sparc-pinsn.c, sparc-opcode.h: Moved insn_fmt structures and
- unions from pinsn.c to opcode.h.
- * sparc-pinsn.c, sparc-dep.c (isabranch, skip_prologue): Moved
- this function from pinsn.c to dep.c.
-
- * Makefile: Put in warnings about compiling with gcc (non-ansi
- include files) and compiling with shared libs on Sunos 4.0 (can't
- debug something that's been compiled that way).
-
- * sparc-pinsn.c: Put in a completely new file (provided by
- Tiemann) to handle floating point disassembly, load and store
- instructions, and etc. better. Made the modifications this file
- (ChangeLog) list for sparc-pinsn.c again.
-
- * symtab.c (output_source_filename): Included "more" emulation hack.
-
- * symtab.c (output_source_filename): Initialized COLUMN to 0.
- (sources_info): Modified to not print out a line for
- all of the include files within a partial symtab (since
- they have pst's of their own now). Also modified to
- make a distinction between those pst's read in and
- those not.
-
- * infrun.c: Included void declaration of single_step() if it's
- going to be used.
- * sparc-dep.c (single_step): Moved function previous to use of it.
-
- * Makefile: Took removal of expread.tab.c out of make clean entry
- and put it into a new "squeakyclean" entry.
-
-Mon Dec 12 13:21:02 1988 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * sparc-pinsn.c (skip_prologue): Changed a struct insn_fmt to a
- union insn_fmt.
-
- * inflow.c (terminal_inferior): Checked *all* return codes from
- ioctl's and fcntl's in routine.
-
- * inflow.c (terminal_inferior): Added check for sucess of
- TIOCSPGRP ioctl call. Just notifies if bad.
-
- * dbxread.c (symbol_file_command): Close was getting called twice;
- once directly and once through cleanup. Killed the direct call.
-
-Sun Dec 11 19:40:40 1988 & Smith (randy at hobbes.ai.mit.edu)
-
- * valprint.c (val_print): Deleted spurious printing of "=" from
- TYPE_CODE_REF case.
-
-Sat Dec 10 16:41:07 1988 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * dbxread.c: Changed allocation of psymbols from using malloc and
- realloc to using obstacks. This means they aren't realloc'd out
- from under the pointers to them.
-
-Fri Dec 9 10:33:24 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * sparc-dep.c inflow.c core.c expread.y command.c infrun.c
- infcmd.c dbxread.c symmisc.c symtab.c printcmd.c valprint.c
- values.c source.c stack.c findvar.c breakpoint.c blockframe.c
- main.c: Various cleanups inspired by "gcc -Wall" (without checking
- for implicit declarations).
-
- * Makefile: Cleaned up some more.
-
- * valops.c, m-*.h (FIX_CALL_DUMMY): Modified to take 5 arguments
- as per what sparc needs (programming for a superset of needed
- args).
-
- * dbxread.c (process_symbol_for_psymtab): Modified to be slightly
- more picky about what it puts on the list of things *not* to be
- put on the misc function list. When/if I shift everything over to
- being placed on the misc_function_list, this will go away.
-
- * inferior.h, infrun.c: Added fields to save in inferior_status
- structure.
-
- * maketarfile: Deleted; functionality is in Makefile now.
-
- * infrun.c (wait_for_inferior): Modified algorithm for determining
- whether or not a single-step was through a subroutine call. See
- comments at top of file.
-
- * dbxread.c (read_dbx_symtab): Made sure that the IGNORE_SYMBOL
- macro would be checked during initial readin.
-
- * dbxread.c (read_ofile_symtab): Added macro GCC_COMPILED_FLAG_SYMBOL
- into dbxread.c to indicate what string in a local text symbol will
- indicate a file compiled with gcc. Defaults to "gcc_compiled.".
-
-Thu Dec 8 11:46:22 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * m-sparc.h (FRAME_FIND_SAVED_REGS): Cleaned up a little to take
- advantage of the new frame cache system.
-
- * inferior.h, infrun.c, valops.c, valops.c, infcmd.c: Changed
- mechanism to save inferior status over calls to inferior (eg.
- call_function); implemented save_inferior_info and
- restore_inferior_info.
-
- * blockframe.c (get_prev_frame): Simplified this by a direct call
- to get_prev_frame_info.
-
- * frame.h, stack.c, printcmd.c, m-sparc.h, sparc-dep.c: Removed
- all uses of frame_id_from_addr. There are short routines like it
- still in frame_saved_pc (m-sparc.h) and parse_frame_spec
- (stack.c). Eventually the one in frame_saved_pc will go away.
-
- * infcmd.c, sparc-dep.c: Implemented a new mechanism for
- re-selecting the selected frame on return from a call.
-
- * blockframe.c, stack.c, findvar.c, printcmd.c, m-*.h: Changed
- all routines and macros that took a "struct frame_info" as an
- argument to take a "struct frame_info *". Routines: findarg,
- framechain, print_frame_args, FRAME_ARGS_ADDRESS,
- FRAME_STRUCT_ARGS_ADDRESS, FRAME_LOCALS_ADDRESS, FRAME_NUM_ARGS,
- FRAME_FIND_SAVED_REGS.
-
- * frame.h, stack.c, printcmd.c, infcmd.c, findvar.c, breakpoint.c,
- blockframe.c, xgdb.c, i386-pinsn.c, gld-pinsn.c, m-umax.h,
- m-sun2.h, m-sun3.h, m-sparc.h, m-pn.h, m-npl.h, m-news.h,
- m-merlin.h, m-isi.h, m-i386.h, m-hp9k320.h: Changed routines to
- use "struct frame_info *" internally.
-
-Wed Dec 7 12:07:54 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * frame.h, blockframe.c, m-sparc.h, sparc-dep.c: Changed all calls
- to get_[prev_]frame_cache_item to get_[prev_]frame_info.
-
- * blockframe.c: Elminated get_frame_cache_item and
- get_prev_frame_cache_item; functionality now taken care of by
- get_frame_info and get_prev_frame_info.
-
- * blockframe.c: Put allocation on an obstack and eliminated fancy
- reallocation routines, several variables, and various nasty
- things.
-
- * frame.h, stack.c, infrun.c, blockframe.c, sparc-dep.c: Changed
- type FRAME to be a typedef to "struct frame_info *". Had to also
- change routines that returned frame id's to return the pointer
- instead of the cache index.
-
- * infcmd.c (finish_command): Used proper method of getting from
- function symbol to start of function. Was treating a symbol as a
- value.
-
- * blockframe.c, breakpoint.c, findvar.c, infcmd.c, stack.c,
- xgdb.c, i386-pinsn.c, frame.h, m-hp9k320.h, m-i386.h, m-isi.h,
- m-merlin.h, m-news.h, m-npl.h, m-pn.h, m-sparc.h, m-sun2.h,
- m-sun3.h, m-umax.h: Changed get_frame_info and get_prev_frame_info
- to return pointers instead of structures.
-
- * blockframe.c (get_pc_function_start): Modified to go to misc
- function table instead of bombing if pc was in a block without a
- containing function.
-
- * coffread.c: Dup'd descriptor passed to read_coff_symtab and
- fdopen'd it so that there wouldn't be multiple closes on the same
- fd. Also put (fclose, stream) on the cleanup list.
-
- * printcmd.c, stack.c: Changed print_frame_args to take a
- frame_info struct as argument instead of the address of the args
- to the frame.
-
- * m-i386.h (STORE_STRUCT_RETURN): Decremented sp by sizeof object
- to store (an address) rather than 1.
-
- * dbxread.c (read_dbx_symtab): Set first_object_file_end in
- read_dbx_symtab (oops).
-
- * coffread.c (fill_in_vptr_fieldno): Rewrote TYPE_BASECLASS as
- necessary.
-
-Tue Dec 6 13:03:43 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * coffread.c: Added fake support for partial_symtabs to allow
- compilation and execution without there use.
- * inflow.c: Added a couple of minor USG mods.
- * munch: Put in appropriate conditionals so that it would work on
- USG systems.
- * Makefile: Made regex.* handled same as obstack.*; made sure tar
- file included everything I wanted it to include (including
- malloc.c).
-
- * dbxread.c (end_psymtab): Create an entry in the
- partial_symtab_list for each subfile of the .o file just read in.
- This allows a "list expread.y:10" to work when we haven't read in
- expread.o's symbol stuff yet.
-
- * symtab.h, dbxread.c (psymtab_to_symtab): Recognize pst->ldsymlen
- == 0 as indicating a dummy psymtab, only in existence to cause the
- dependency list to be read in.
-
- * dbxread.c (sort_symtab_syms): Elminated reversal of symbols to
- make sure that register debug symbol decls always come before
- parameter symbols. After mod below, this is not needed.
-
- * symtab.c (lookup_block_symbol): Take parameter type symbols
- (LOC_ARG or LOC_REGPARM) after any other symbols which match.
-
- * dbxread.c (read_type): When defining a type in terms of some
- other type and the other type is supposed to have a pointer back
- to this specific kind of type (pointer, reference, or function),
- check to see if *that* type has been created yet. If it has, use
- it and fill in the appropriate slot with a pointer to it.
-
-Mon Dec 5 11:25:04 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * symmisc.c: Eliminated existence of free_inclink_symtabs and
- init_free_inclink_symtabs; they aren't called from anywhere, and
- if they were they could disrupt gdb's data structure badly
- (elimination of struct type's which values that stick around past
- elimination of inclink symtabs).
-
- * dbxread.c (symbol_file_command): Fixed a return pathway out of
- the routine to do_cleanups before it left.
-
- * infcmd.c (set_environment_command), gdb.texinfo: Added
- capability to set environmental variable values to null.
-
- * gdb.texinfo: Modified doc on "break" without args slightly.
-
-Sun Dec 4 17:03:16 1988 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * dbxread.c (symbol_file_command): Added check; if there weren't
- any debugging symbols in the file just read, the user is warned.
-
- * infcmd.c: Commented set_environment_command (a little).
-
- * createtags: Cleaned up and commented.
-
- * Makefile: Updated depen_memory and write_inferior_memory in that errno is
- checked after each ptrace and returned to the caller. Used in
- value_at to detect references to addresses which are out of
- bounds. Also core.c (xfer_core_file): return 1 if invalid
- address, 0 otherwise.
-
- * inflow.c, <machine>-infdep.c: removed all calls to ptrace from
- inflo, m-sun3.h: Cleaned up dealings with
- functions returning structu0 19:19:36 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * symmisc.c: (read_symsegs) Accept only format number 2. Since
- the size of the type structure changed when C++ support was added,
- format 1 can no longer be used.
-
- * core.c, m-sunos4.h: (core_file_command) support for SunOS 4.0.
- Slight change in the core structure. #ifdef SUNOS4. New file
- m-sunos4.h. May want to change config.gdb also.
-
-Fri Jul 8 19:59:49 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * breakpoint.c: (break_command_1) Allow `break if condition'
- rather than parsing `if' as a function name and returning an
- error.
-
-Thu Jul 7 22:22:47 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * C++: valops.c, valprint.c, value.h, values.c: merged code to deal
- with C++ expressions.
-
-Wed Jul 6 03:28:18 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * C++: dbxread.c: (read_dbx_symtab, condense_misc_bunches,
- add_file_command) Merged code to read symbol information from
- an incrementally linked file. symmisc.c:
- (init_free_inclink_symtabs, free_inclink_symtabs) Cleanup
- routines.
-
-Tue Jul 5 02:50:41 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * C++: symtab.c, breakpoint.c, source.c: Merged code to deal with
- ambiguous line specifications. In C++ one can have overloaded
- function names, so that `list classname::overloadedfuncname'
- refers to several different lines, possibly sure currently configured machine
- dependent files come first in e at corn-chex.ai.mit.edu)
-
- * C++: symtab.c: replaced lookup_symtab_1 and lookup_symtab_2 with
- a modified lookup_symbol which checks for fields of the current
- implied argument `this'. printcmd.c, source.c, symtab.c,
- valops.c: Need to change callers once callers are
- installed.
-
-Wed Jun 29 01:26:56 1988 Peter TerMaat (pete at frosted-flakes.ai.mit.edu)
-
- * C++: eval.c, expprint.c, expread.y, expression.h, valarith.c,
- Merged code to deal with evaluation of user-defined operators,
- member functions, and virtual functions.
- binop_must_be_user_defined tests for user-defined binops,
- value_x_binop calls the appropriate operator function.
-
-Tue Jun 28 02:56:42 1988 Peter TerMaat (pete at frosted-flakes.ai.mit.edu)
-
- * C++: Makefile: changed the echo: expect 101 shift/reduce conflicts
- and 1 reduce/reduce conflict.
-
-
-Local Variables:
-mode: indented-text
-eval: (auto-fill-mode 1)
-left-margin: 8
-fill-column: 74
-version-control: never
-End:
-
- constructors, and flags being defined via public and via
- virtual paths. Added fields NEXT_VARIANT, N_BASECLASSES,
- and BASECLASSES to this type (tr: Changed types from
- having to be derived from a single baseclass to a multiple
- base class).
- * symtab.h: Added macros to access new fields defined in symseg.h.
- Added decl for lookup_basetype_type.
- * dbxread.c
- (condense_addl_misc_bunches): Function added to condense the misc
- function bunches added by reading in a new .o file.
- (read_addl_syms): Function added to read in symbols
- from a new .o file (incremental linking).
- (add_file_command): Command interface function to indicate
- incrmental linking of a new .o file; this now calls
- read_addl_syms and condense_addl_misc_bunches.
- (define_symbol): Modified code to handle types defined from base
- types which were not known when the derived class was
- output.
- (read_struct_type): Modified to better handle description of
- struct types as derived types. Possibly derived from
- several different base classes. Also added new code to
- mark definitions via virtual paths or via public paths.
- Killed seperate code to handle classes with destructors
- but without constructors and improved marking of classes
- as having destructors and constructors.
- * infcmd.c: Modified call to val_print (one more argument).
- * symtab.c (lookup_member_type): Modified to deal with new
- structure in symseg.h.
- (lookup_basetype_type): Function added to find or construct a type
- ?derived? from the given type.
- (decode_line_1): Modified to deal with new type data structures.
- Modified to deal with new number of args for
- decode_line_2.
- (decode_line_2): Changed number of args (?why?).
- (init_type): Added inits for new C++ fields from
- symseg.h.
- *valarith.c
- (value_x_binop, value_binop): Added cases for BINOP_MIN &
- BINOP_MAX.
- * valops.c
- (value_struct_elt, check_field, value_struct_elt_for_address):
- Changed to deal with multiple possible baseclasses.
- (value_of_this): Made SELECTED_FRAME an extern variable.
- * valprint.c
- (val_print): Added an argument DEREF_REF to dereference references
- automatically, instead of printing them like pointers.
- Changed number of arguments in recursive calls to itself.
- Changed to deal with varibale numbers of base classes.
- (value_print): Changed number of arguments to val_print. Print
- type of value also if value is a reference.
- (type_print_derivation_info): Added function to print out
- derivation info a a type.
- (type_print_base): Modified to use type_print_derivation_info and
- to handle multiple baseclasses.
-
-Mon Nov 21 10:32:07 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * inflow.c (term_status_command): Add trailing newline to output.
-
- * sparc-dep.c (do_save_insn, do_restore_insn): Saved
- "stop_registers" over the call for the sake of normal_stop and
- run_stack_dummy.
-
- * m-sparc.h (EXTRACT_RETURN_VALUE): Put in parenthesis to force
- addition of 8 to the int pointer, not the char pointer.
-
- * sparc-pinsn.c (print_addr1): Believe that I have gotten the
- syntax right for loads and stores as adb does it.
-
- * symtab.c (list_symbols): Turned search for match on rexegp into
- a single loop.
-
- * dbxread.c (psymtab_to_symtab): Don't read it in if it's already
- been read in.
-
- * dbxread.c (psymtab_to_symtab): Changed error to fatal in
- psymtab_to_symtab.
-
- * expread.y (parse_number): Fixed bug which treated 'l' at end of
- number as '0'.
-
-Fri Nov 18 13:57:33 1988 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * dbxread.c (read_dbx_symtab, process_symbol_for_psymtab): Was
- being foolish and using pointers into an array I could realloc.
- Converted these pointers into integers.
-
-Wed Nov 16 11:43:10 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * m-sparc.h (POP_FRAME): Made the new frame be PC_ADJUST of the
- old frame.
-
- * i386-pinsn.c, m-hp9k320.h, m-isi.h, m-merlin.h, m-news.h,
- m-npl.h, m-pn.h, m-sparc.h, m-sun2.h, m-sun3.h, m-umax.h, m-vax.h:
- Modified POP_FRAME to use the current frame instead of
- read_register (FP_REGNUM) and to flush_cached_frames before
- setting the current frame. Also added a call to set the current
- frame in those POP_FRAMEs that didn't have it.
-
- * infrun.c (wait_for_inferior): Moved call to set_current_frame up
- to guarrantee that the current frame will always be set when a
- POP_FRAME is done.
-
- * infrun.c (normal_stop): Added something to reset the pc of the
- current frame (was incorrect because of DECR_PC_AFTER_BREAK).
-
- * valprint.c (val_print): Changed to check to see if a string was
- out of bounds when being printed and to indicate this if so.
-
- * convex-dep.c (read_inferior_memory): Changed to return the value
- of errno if the call failed (which will be 0 if the call
- suceeded).
-
-Tue Nov 15 10:17:15 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * infrun.c (wait_for_inferior): Two changes: 1) Added code to
- not trigger the step breakpoint on recursive calls to functions
- without frame info, and 2) Added calls to distinguish recursive
- calls within a function without a frame (which next/nexti might
- wish to step over) from jumps to the beginning of a function
- (which it generally doesn't).
-
- * m-sparc.h (INIT_EXTRA_FRAME_INFO): Bottom set correctly for leaf
- parents.
-
- * blockframe.c (get_prev_frame_cache_item): Put in mod to check
- for a leaf node (by presence or lack of function prologue). If
- there is a leaf node, it is assumed that SAVED_PC_AFTER_CALL is
- valid. Otherwise, FRAME_SAVED_PC or read_pc is used.
-
- * blockframe.c, frame.h: Did final deletion of unused routines and
- commented problems with getting a pointer into the frame cache in
- the frame_info structure comment.
-
- * blockframe.c, frame.h, stack.c: Killed use of
- frame_id_from_frame_info; used frame_id_from_addr instead.
-
- * blockframe.c, frame.h, stack.c, others (oops): Combined stack
- cache and frame info structures.
-
- * blockframe.c, sparc-dep.c, stack.c: Created the function
- create_new_frame and used it in place of bad calls to
- frame_id_from_addr.
-
- * blockframe.c, inflow.c, infrun.c, i386-pinsn.c, m-hp9k320.h,
- m-npl.h, m-pn.h, m-sparc.h, m-sun3.h, m-vax.h, default-dep.c,
- convex-dep.c, gould-dep.c, hp9k320-dep.c, news-dep.c, sparc-dep.c,
- sun3-dep.c, umax-dep.c: Killed use of
- set_current_Frame_by_address. Used set_current_frame
- (create_new_frame...) instead.
-
- * frame.h: Killed use of FRAME_FP_ID.
-
- * infrun.c, blockframe.c: Killed select_frame_by_address. Used
- select_frame (get_current_frame (), 0) (which was correct in all
- cases that we need to worry about.
-
-Mon Nov 14 14:19:32 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * frame.h, blockframe.c, stack.c, m-sparc.h, sparc-dep.c: Added
- mechanisms to deal with possible specification of frames
- dyadically.
-
-Sun Nov 13 16:03:32 1988 Richard Stallman (rms at sugar-bombs.ai.mit.edu)
-
- * ns32k-opcode.h: Add insns acbw, acbd.
-
-Sun Nov 13 15:09:58 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * breakpoint.c: Changed breakpoint structure to use the address of
- a given frame (constant across inferior runs) as the criteria for
- stopping instead of the frame ident (which varies across inferior
- calls).
-
-Fri Nov 11 13:00:22 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * gld-pinsn.c (findframe): Modified to work with the new frame
- id's. Actually, it looks as if this routine should be called with
- an address anyway.
-
- * findvar.c (find_saved_register): Altered bactrace loop to work
- off of frames and not frame infos.
-
- * frame.h, blockframe.c, stack.c, sparc-dep.c, m-sparc.h: Changed
- FRAME from being the address of the frame to being a simple ident
- which is an index into the frame_cache_item list.
- * convex-dep.c, default-dep.c, gould-dep.c, hp9k320-dep.c,
- i386-pinsn.c, inflow.c, infrun.c, news-dep.c, sparc-dep.c,
- sun3-dep.c, umax-dep.c, m-hp9k320.h, m-npl.h, m-pn.h, m-sparc.h,
- m-sun3.h, m-vax.h: Changed calls of the form set_current_frame
- (read_register (FP_REGNUM)) to set_current_frame_by_address (...).
-
-Thu Nov 10 16:57:57 1988 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * frame.h, blockframe.c, gld-pinsn.c, sparc-dep.c, stack.c,
- infrun.c, findvar.c, m-sparc.h: Changed the FRAME type to be
- purely an identifier, using FRAME_FP and FRAME_FP_ID to convert
- back and forth between the two. The identifier is *currently*
- still the frame pointer value for that frame.
-
-Wed Nov 9 17:28:14 1988 Chris Hanson (cph at kleph)
-
- * m-hp9k320.h (FP_REGISTER_ADDR): Redefine this to return
- difference between address of given FP register, and beginning of
- `struct user' that it occurs in.
-
- * hp9k320-dep.c (core_file_command): Fix sign error in size
- argument to myread. Change buffer argument to pointer; was
- copying entire structure.
- (fetch_inferior_registers, store_inferior_registers): Replace
- occurrences of `FP_REGISTER_ADDR_DIFF' with `FP_REGISTER_ADDR'.
- Flush former definition.
-
-Wed Nov 9 12:11:37 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * xgdb.c: Killed include of initialize.h.
-
- * Pulled in xgdb.c from the net.
-
- * Checkpointed distribution (to provide to 3b2 guy).
-
- * coffread.c, dbxread.c, symmisc.c, symtab.c, symseg.h: Changed
- format of table of line number--pc mapping information. Can
- handle negative pc's now.
-
- * command.c: Deleted local copy of savestring; code in utils.c is
- identical.
-
-Tue Nov 8 11:12:16 1988 Randall Smith (randy at plantaris.ai.mit.edu)
-
- * gdb.texinfo: Added documentation for shell escape.
-
-Mon Nov 7 12:27:16 1988 Randall Smith (randy at sugar-bombs.ai.mit.edu)
-
- * command.c: Added commands for shell escape.
-
- * core.c, dbxread.c: Added ROBOTUSSIN mods.
-
- * Checkpointed distribution.
-
- * printcmd.c (x_command): Yanked error if there is no memory to
- examine (could be looking at executable straight).
-
- * sparc-pinsn.c (print_insn): Amount to leftshift sethi imm by is
- now 10 (matches adb in output).
-
- * printcmd.c (x_command): Don't attempt to set $_ & $__ if there
- is no last_examine_value (can happen if you did an x/0).
-
-Fri Nov 4 13:44:49 1988 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * printcmd.c (x_command): Error if there is no memory to examine.
-
- * gdb.texinfo: Added "cont" to the command index.
-
- * sparc-dep.c (do_save_insn): Fixed typo in shift amount.
-
- * m68k-opcode.h: Fixed opcodes for 68881.
-
- * breakpoint.c, infcmd.c, source.c: Changed defaults in several
- places for decode_line_1 to work off of the default_breakpoint_*
- values instead of current_source_* values (the current_source_*
- values are off by 5 or so because of listing defaults).
-
- * stack.c (frame_info): ifdef'd out FRAME_SPECIFCATION_DYADIC in
- the stack.c module. If I can't do this right, I don't want to do
- it at all. Read the comment there for more info.
-
-Mon Oct 31 16:23:06 1988 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * gdb.texinfo: Added documentation on the "until" command.
-
-Sat Oct 29 17:47:10 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * breakpoint.c, infcmd.c: Added UNTIL_COMMAND and subroutines of
- it.
-
- * breakpoint.c, infcmd.c, infrun.c: Added new field to breakpoint
- structure (silent, indicating a silent breakpoint), and modified
- breakpoint_stop_status and things that read it's return value to
- understand it.
-
-Fri Oct 28 17:45:33 1988 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * dbxread.c, symmisc.c: Assorted speedups for readin, including
- special casing most common symbols, and doing buffering instead of
- calling malloc.
-
-Thu Oct 27 11:11:15 1988 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * stack.c, sparc-dep.c, m-sparc.h: Modified to allow "info frame"
- to take two arguments on the sparc and do the right thing with
- them.
-
- * dbxread.c (read_dbx_symtab, process_symbol_for_psymtab): Put
- stuff to put only symbols that didn't have debugging info on the
- misc functions list back in.
-
-Wed Oct 26 10:10:32 1988 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * valprint.c (type_print_varspec_suffix): Added check for
- TYPE_LENGTH(TYPE_TARGET_TYPE(type)) > 0 to prevent divide by 0.
-
- * printcmd.c (print_formatted): Added check for VALUE_REPEATED;
- value_print needs to be called for that.
-
- * infrun.c (wait_for_inferior): Added break when you decide to
- stop on a null function prologue rather than continue stepping.
-
- * m-sun3.h: Added explanatory comment to REGISTER_RAW_SIZE.
-
- * expread.y (parse_c_1): Initialized paren_depth for each parse.
-
-Tue Oct 25 14:19:38 1988 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * valprint.c, coffread.c, dbxread.c: Enum constant values in enum
- type now accessed through TYPE_FIELD_BITPOS.
-
- * dbxread.c (process_symbol_for_psymtab): Added code to deal with
- possible lack of a ":" in a debugging symbol (do nothing).
-
- * symtab.c (decode_line_1): Added check in case of all numbers for
- complete lack of symbols.
-
- * source.c (select_source_symtab): Made sure that this wouldn't
- bomb on complete lack of symbols.
-
-Mon Oct 24 12:28:29 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * m-sparc.h, findvar.c: Ditched REGISTER_SAVED_UNIQUELY and based
- code on REGISTER_IN_WINDOW_P and HAVE_REGISTER_WINDOWS. This will
- break when we find a register window machine which saves the
- window registers within the context of an inferior frame.
-
- * sparc-dep.c (frame_saved_pc): Put PC_ADJUST return back in for
- frame_saved_pc. Seems correct.
-
- * findvar.c, m-sparc.h: Created the macro REGISTER_SAVED_UNIQUELY
- to handle register window issues (ie. that find_saved_register
- wasn't checking the selected frame itself for shit).
-
- * sparc-dep.c (core_file_command): Offset target of o & g register
- bcopy by 1 to hit correct registers.
-
- * m-sparc.h: Changed STACK_END_ADDR.
-
-Sun Oct 23 19:41:51 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * sparc-dep.c (core_file_command): Added in code to get the i & l
- registers from the stack in the corefile, and blew away some wrong
- code to get i & l from inferior.
-
-Fri Oct 21 15:09:19 1988 Randall Smith (randy at apple-gunkies.ai.mit.edu)
-
- * m-sparc.h (PUSH_DUMMY_FRAME): Saved the value of the RP register
- in the location reserved for i7 (in the created frame); this way
- the rp value won't get lost. The pc (what we put into the rp in
- this routine) gets saved seperately, so we loose no information.
-
- * sparc-dep.c (do_save_insn & do_restore_insn): Added a wrapper to
- preserve the proceed status state variables around each call to
- proceed (the current frame was getting munged because this wasn't
- being done).
-
- * m-sparc.h (FRAME_FIND_SAVED_REGS): Fix bug: saved registers
- addresses were being computed using absolute registers number,
- rather than numbers relative to each group of regs.
-
- * m-sparc.h (POP_FRAME): Fixed a bug (I hope) in the context
- within which saved reg numbers were being interpetted. The
- values to be restored were being gotten in the inferior frame, and
- the restoring was done in the superior frame. This means that i
- registers must be restored into o registers.
-
- * sparc-dep.c (do_restore_insn): Modified to take a pc as an
- argument, instead of a raw_buffer. This matches (at least it
- appears to match) usage from POP_FRAME, which is the only place
- from which do_restore_insn is called.
-
- * sparc-dep.c (do_save_insn and do_restore_insn): Added comments.
-
- * m-sparc.h (FRAME_FIND_SAVED_REGS): Modified my code to find the
- save addresses of out registers to use the in regs off the stack
- pointer when the current frame is 1 from the innermost.
-
-Thu Oct 20 13:56:15 1988 & Smith (randy at hobbes.ai.mit.edu)
-
- * blockframe.c, m-sparc.h: Removed code associated with
- GET_PREV_FRAME_FROM_CACHE_ITEM. This code was not needed for the
- sparc; you can always find the previous frames fp from the fp of
- the current frame (which is the sp of the previous). It's getting
- the information associated with a given frame (ie. saved
- registers) that's a bitch, because that stuff is saved relative to
- the stack pointer rather than the frame pointer.
-
- * m-sparc.h (GET_PREV_FRAME_FROM_CACHE_ITEM): Modified to return
- the frame pointer of the previous frame instead of the stack
- pointer of same.
-
- * blockframe.c (flush_cached_frames): Modified call to
- obstack_free to free back to frame_cache instead of back to zero.
- This leaves the obstack control structure in finite state (and
- still frees the entry allocated at frame_cache).
-
-Sat Oct 15 16:30:47 1988 & Smith (randy at tartarus.uchicago.edu)
-
- * valops.c (call_function): Suicide material here. Fixed a typo;
- CALL_DUMMY_STACK_ADJUST was spelled CAll_DUMMY_STACK_ADJUST on
- line 530 of the file. This cost me three days. I'm giving up
- typing for lent.
-
-Fri Oct 14 15:10:43 1988 & Smith (randy at tartarus.uchicago.edu)
-
- * m-sparc.h: Corrected a minor mistake in the dummy frame code
- that was getting the 5th argument and the first argument from the
- same place.
-
-Tue Oct 11 11:49:33 1988 & Smith (randy at tartarus.uchicago.edu)
-
- * infrun.c: Made stop_after_trap and stop_after_attach extern
- instead of static so that code which used proceed from machine
- dependent files could fiddle with them.
-
- * blockframe.c, frame.h, sparc-dep.c, m-sparc.h: Changed sense of
- ->prev and ->next in struct frame_cache_item to fit usage in rest
- of gdb (oops).
-
-Mon Oct 10 15:32:42 1988 Randy Smith (randy at gargoyle.uchicago.edu)
-
- * m-sparc.h, sparc-dep.c, blockframe.c, frame.h: Wrote
- get_frame_cache_item. Modified FRAME_SAVED_PC and frame_saved_pc
- to take only one argument and do the correct thing with it. Added
- the two macros I recently defined in blockframe.c to m-sparc.h.
- Have yet to compile this thing on a sparc, but I've now merged in
- everything that I received from tiemann, either exactly, or simply
- effectively.
-
- * source.c: Added code to allocated space to sals.sals in the case
- where no line was specified.
-
- * blockframe.c, infrun.c: Modified to cache stack frames requested
- to minimize accesses to subprocess.
-
-Tue Oct 4 15:10:39 1988 Randall Smith (randy at cream-of-wheat.ai.mit.edu)
-
- * config.gdb: Added sparc.
-
-Mon Oct 3 23:01:22 1988 Randall Smith (randy at cream-of-wheat.ai.mit.edu)
-
- * Makefile, blockframe.c, command.c, core.c, dbxread.c, defs.h,
- expread.y, findvar.c, infcmd.c, inflow.c, infrun.c, sparc-pinsn.c,
- m-sparc.h, sparc-def.c, printcmd.c, stack.c, symmisc.c, symseg.h,
- valops.c, values.c: Did initial merge of sparc port. This will
- not compile; have to do stack frame caching and finish port.
-
- * inflow.c, gdb.texinfo: `tty' now resets the controling terminal.
-
-Fri Sep 30 11:31:16 1988 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * inferior.h, infcmd.c, infrun.c: Changed the variable
- stop_random_signal to stopped_by_random signal to fit in better
- with name conventions (variable is not a direction to the
- proceed/resume set; it is information from it).
-
-Thu Sep 29 13:30:46 1988 Randall Smith (randy at cream-of-wheat.ai.mit.edu)
-
- * infcmd.c (finish_command): Value type of return value is now
- whatever the function returns, not the type of the function (fixed
- a bug in printing said value).
-
- * dbxread.c (read_dbx_symtab, process_symbol_for_psymtab):
- Put *all* global symbols into misc_functions. This is what was
- happening anyway, and we need it for find_pc_misc_function.
-
- ** This was eventually taken out, but I didn't mark it in the
- ChangeLog. Oops.
-
- * dbxread.c (process_symbol_for_psymtab): Put every debugger
- symbol which survives the top case except for constants on the
- symchain. This means that all of these *won't* show up in misc
- functions (this will be fixed once I make sure it's broken the way
- it's supposed to be).
-
- * dbxread.c: Modified placement of debugger globals onto the hash
- list; now we exclude the stuff after the colon and don't skip the
- first character (debugger symbols don't have underscores).
-
- * dbxread.c: Killed debuginfo stuff with ifdef's.
-
-Wed Sep 28 14:31:51 1988 Randall Smith (randy at cream-of-wheat.ai.mit.edu)
-
- * symtab.h, dbxread.c: Modified to deal with BINCL, EINCL, and
- EXCL symbols produced by the sun loader by adding a list of
- pre-requisite partial_symtabs that each partial symtab needs.
-
- * symtab.h, dbxread.c, symtab.c, symmisc.c: Modified to avoid
- doing a qsort on the local (static) psymbols for each file to
- speed startup. This feature is not completely debugged, but it's
- inclusion has forced the inclusion of another feature (dealing
- with EINCL's, BINCL's and EXCL's) and so I'm going to go in and
- deal with them.
-
- * dbxread.c (process_symbol_for_psymtab): Made sure that the class
- of the symbol made it into the partial_symbol entry.
-
-Tue Sep 27 15:10:26 1988 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * dbxread.c: Fixed bug; init_psymbol_list was not being called
- with the right number of arguments (1).
-
- * dbxread.c: Put ifdef's around N_MAIN, N_M2C, and N_SCOPE to
- allow compilation on a microvax.
-
- * config.gdb: Modified so that "config.gdb vax" would work.
-
- * dbxread.c, symtab.h, symmisc.h, symtab.c, source.c: Put in many
- and varied hacks to speed up gdb startup including: A complete
- rewrite of read_dbx_symtab, a modification of the partial_symtab
- data type, deletion of select_source_symtab from
- symbol_file_command, and optimiztion of the call to strcmp in
- compare_psymbols.
-
-Thu Sep 22 11:08:54 1988 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * dbxread.c (psymtab_to_symtab): Removed call to
- init_misc_functions.
-
- * dbxread.c: Fixed enumeration type clash (used enum instead of
- integer constant).
-
- * breakpoint.c: Fixed typo; lack of \ at end of line in middle of
- string constant.
-
- * symseg.h: Fixed typo; lack of semicolon after structure
- definition.
-
- * command.c, breakpoint.c, printcmd.c: Added cmdlist editing
- functions to add commands with the abbrev flag set. Changed
- help_cmd_list to recognize this flag and modified unset,
- undisplay, and enable, disable, and delete breakpoints to have
- this flag set.
-
-Wed Sep 21 13:34:19 1988 Randall Smith (randy at plantaris.ai.mit.edu)
-
- * breakpoint.c, infcmd.c, gdb.texinfo: Created "unset" as an alias
- for delete, and changed "unset-environment" to be the
- "environment" subcommand of "delete".
-
- * gdb.texinfo, valprint.c: Added documentation in the manual for
- breaking the set-* commands into subcommands of set. Changed "set
- maximum" to "set array-max".
-
- * main.c, printcmd.c, breakpoint.c: Moved the declaration of
- command lists into main and setup a function in main initializing
- them to guarrantee that they would be initialized before calling
- any of the individual files initialize routines.
-
- * command.c (lookup_cmd): A null string subcommand is treated as
- an unknown subcommand rather than an ambiguous one (eg. "set $x =
- 1" will now work).
-
- * infrun.c (wait_for_inferior): Put in ifdef for Sony News in
- check for trap by INNER_THAN macro.
-
- * eval.c (evaluate_subexp): Put in catch to keep the user from
- attempting to call a non function as a function.
-
-Tue Sep 20 10:35:53 1988 Randall Smith (randy at oatmeal.ai.mit.edu)
-
- * dbxread.c (read_dbx_symtab): Installed code to keep track of
- which global symbols did not have debugger symbols refering to
- them, and recording these via record_misc_function.
-
- * dbxread.c: Killed code to check for extra global symbols in the
- debugger symbol table.
-
- * printcmd.c, breakpoint.c: Modified help entries for several
- commands to make sure that abbreviations were clearly marked and
- that the right commands showed up in the help listings.
-
- * main.c, command.c, breakpoint.c, infcmd.c, printcmd.c,
- valprint.c, defs.h: Modified help system to allow help on a class
- name to show subcommands as well as commands and help on a command
- to show *all* subcommands of that command.
-
-Fri Sep 16 16:51:19 1988 Randall Smith (randy at gluteus.ai.mit.edu)
-
- * breakpoint.c (_initialize_breakpoint): Made "breakpoints"
- subcommands of enable, disable, and delete use class 0 (ie. they
- show up when you do a help xxx now).
-
- * infcmd.c,printcmd,c,main.c,valprint.c: Changed the set-*
- commands into subcommands of set. Created "set variable" for use
- with variables whose names might conflict with other subcommands.
-
- * blockframe.c, dbxread.c, coffread.c, expread.y, source.c:
- Fixed mostly minor (and one major one in block_for_pc) bugs
- involving checking the partial_symtab_list when a scan through the
- symtab_list fails.
-
-Wed Sep 14 12:02:05 1988 Randall Smith (randy at sugar-smacks.ai.mit.edu)
-
- * breakpoint.c, gdb.texinfo: Added enable breakpoints, disable
- breakpoints and delete breakpoints as synonyms for enable,
- disable, and delete. This seemed reasonable because of the
- immeninent arrival of watchpoints & etc.
-
- * gdb.texinfo: Added enable display, disable display, and delete
- display to manual.
-
-Tue Sep 13 16:53:56 1988 Randall Smith (randy at sugar-smacks.ai.mit.edu)
-
- * inferior.h, infrun.c, infcmd.c: Added variable
- stop_random_signal to indicate when a proceed had been stopped by
- an unexpected signal. Used this to determine (in normal_stop)
- whether the current display point should be deleted.
-
- * valops.c: Fix to value_ind to check for reference before doing a
- COERCE_ARRAY.
-
-Sun Jul 31 11:42:36 1988 Richard Stallman (rms at frosted-flakes.ai.mit.edu)
-
- * breakpoint.c (_initialize_breakpoint): Clean up doc for commands
- that can now apply also to auto-displays.
-
- * coffread.c (record_line): Corrected a spazz in editing.
- Also removed the two lines that assume line-numbers appear
- only in increasing order.
-
-Tue Jul 26 22:19:06 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * expression.h, eval.c, expprint.c, printcmd.c, valarith.c,
- valops.c, valprint.c, values.c, m-*.h: Changes for evaluating and
- displaying 64-bit `long long' integers. Each machine must define
- a LONGEST type, and a BUILTIN_TYPE_LONGEST.
-
- * symmisc.c: (print_symtab) check the status of the fopen and call
- perror_with_name if needed.
-
-Thu Jul 21 00:56:11 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * Convex: core.c: changes required by Convex's SOFF format were
- isolated in convex-dep.c.
-
-Wed Jul 20 21:26:10 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * coffread.c, core.c, expread.y, i386-pinsn.c, infcmd.c, inflow.c,
- infrun.c, m-i386.h, main.c, remote.c, source.c, valops.c:
- Improvements for the handling of the i386 and other machines
- running USG. (Several of these files just needed extra header files
- such as types.h.) utils.c: added bcopy, bcmp, bzero, getwd, list
- of signals, and queue routines for USG systems. Added vfork macro
- to i386
-
- * printcmd.c, breakpoint.c: New commands to enable/disable
- auto-displays. Also `delete display displaynumber' works like
- `undisplay displaynumber'.
-
-Tue Jul 19 02:17:18 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * coffread.c: (coff_lookup_type) Wrong portion of type_vector was
- being bzero'd after type_vector was reallocated.
-
- * printcmd.c: (delete_display) Check for a display chain before
- attempting to delete a display.
-
- * core.c, *-dep.c (*-infdep moved to *-dep): machine-dependent
- parts of core.c (core_file_command, exec_file_command) moved to
- *-dep.c.
-
-Mon Jul 18 19:45:51 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * dbxread.c: typo in read_struct_type (missing '=') was causing a
- C struct to be parsed as a C++ struct, resulting in a `invalid
- character' message.
-
-Sun Jul 17 22:27:32 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * printcmd.c, symtab.c, valops.c, expread.y: When an expression is
- read, the innermost block required to evaluate the expression is
- saved in the global variable `innermost_block'. This information
- is saved in the `block' field of an auto-display so that
- expressions with inactive variables can be skipped. `info display'
- tells the user which displays are active and which are not. New
- fn `contained_in' returns nonzero if one block is contained within
- another.
-
-Fri Jul 15 01:53:14 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * infrun.c, m-i386.h: Use macro TRAPS_EXPECTED to set number of
- traps to skip when sh execs the program. Default is 2, m-i386.h
- overrides this and sets to 4.
-
- * coffread.c, infrun.c: minor changes for the i386. May be able
- to eliminate them with more general code.
-
- * default-infdep.c: #ifdef SYSTEMV, include header file types.h.
- Also switched the order of signal.h and user.h, since System 5
- requires signal.h to come first.
-
- * core.c main.c, remote,c, source.c, inflow.c: #ifdef SYSTEMV,
- include various header files. Usually types.h and fcntl.h.
-
- * utils.c: added queue routines needed by the i386 (and other sys
- 5 machines).
-
- * sys5.c, regex.c, regex.h: new files for sys 5 systems. (The
- regex files are simply links to /gp/gnu/lib.)
-
-Thu Jul 14 01:47:14 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * config.gdb, README: Provide a list of known machines when user
- enters an invalid machine. New second arg is operating system,
- currently only used with `sunos4' or `os4'. Entry for i386 added.
-
- * news-infdep.c: new file.
-
- * m-news.h: new version which deals with new bugs in news800's OS.
-
-Tue Jul 12 19:52:16 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * Makefile, *.c, munch, config.gdb, README: New initialization
- scheme uses nm to find functions whose names begin with
- `_initialize_'. Files `initialize.h', `firstfile.c',
- `lastfile.c', `m-*init.h' no longer needed.
-
- * eval.c, symtab.c, valarith.c, valops.c, value.h, values.c: Bug
- fixes from gdb+ 2.5.4. evaluate_subexp takes a new arg, type
- expected. New fn value_virtual_fn_field.
-
-Mon Jul 11 00:48:49 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * core.c (read_memory): xfer_core_file was being called with an
- extra argument (0) by read_memory.
-
- * core.c (read_memory), *-infdep.c (read_inferior_memory),
- valops.c (value_at): read_memory and read_inferior_memory now work
- like write_memory and write_inferior_memory in that errno is
- checked after each ptrace and returned to the caller. Used in
- value_at to detect references to addresses which are out of
- bounds. Also core.c (xfer_core_file): return 1 if invalid
- address, 0 otherwise.
-
- * inflow.c, <machine>-infdep.c: removed all calls to ptrace from
- inflow.c and put them in machine-dependent files *-infdep.c.
-
-Sun Jul 10 19:19:36 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * symmisc.c: (read_symsegs) Accept only format number 2. Since
- the size of the type structure changed when C++ support was added,
- format 1 can no longer be used.
-
- * core.c, m-sunos4.h: (core_file_command) support for SunOS 4.0.
- Slight change in the core structure. #ifdef SUNOS4. New file
- m-sunos4.h. May want to change config.gdb also.
-
-Fri Jul 8 19:59:49 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * breakpoint.c: (break_command_1) Allow `break if condition'
- rather than parsing `if' as a function name and returning an
- error.
-
-Thu Jul 7 22:22:47 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * C++: valops.c, valprint.c, value.h, values.c: merged code to deal
- with C++ expressions.
-
-Wed Jul 6 03:28:18 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * C++: dbxread.c: (read_dbx_symtab, condense_misc_bunches,
- add_file_command) Merged code to read symbol information from
- an incrementally linked file. symmisc.c:
- (init_free_inclink_symtabs, free_inclink_symtabs) Cleanup
- routines.
-
-Tue Jul 5 02:50:41 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * C++: symtab.c, breakpoint.c, source.c: Merged code to deal with
- ambiguous line specifications. In C++ one can have overloaded
- function names, so that `list classname::overloadedfuncname'
- refers to several different lines, possibly in different files.
-
-Fri Jul 1 02:44:20 1988 Peter TerMaat (pete at corn-chex.ai.mit.edu)
-
- * C++: symtab.c: replaced lookup_symtab_1 and lookup_symtab_2 with
- a modified lookup_symbol which checks for fields of the current
- implied argument `this'. printcmd.c, source.c, symtab.c,
- valops.c: Need to change callers once callers are
- installed.
-
-Wed Jun 29 01:26:56 1988 Peter TerMaat (pete at frosted-flakes.ai.mit.edu)
-
- * C++: eval.c, expprint.c, expread.y, expression.h, valarith.c,
- Merged code to deal with evaluation of user-defined operators,
- member functions, and virtual functions.
- binop_must_be_user_defined tests for user-defined binops,
- value_x_binop calls the appropriate operator function.
-
-Tue Jun 28 02:56:42 1988 Peter TerMaat (pete at frosted-flakes.ai.mit.edu)
-
- * C++: Makefile: changed the echo: expect 101 shift/reduce conflicts
- and 1 reduce/reduce conflict.
-
-Local Variables:
-mode: indented-text
-left-margin: 8
-fill-column: 74
-version-control: never
-End:
diff --git a/gnu/usr.bin/gdb/Gdbinit b/gnu/usr.bin/gdb/Gdbinit
deleted file mode 100644
index bcacd5d..0000000
--- a/gnu/usr.bin/gdb/Gdbinit
+++ /dev/null
@@ -1,15 +0,0 @@
-echo Setting up the environment for debugging gdb.\n
-
-b fatal
-
-b info_command
-commands
- silent
- return
-end
-
-define rr
- run
-end
-
-set prompt (top-gdb)
diff --git a/gnu/usr.bin/gdb/Makefile.dist b/gnu/usr.bin/gdb/Makefile.dist
deleted file mode 100644
index 3cbc91f..0000000
--- a/gnu/usr.bin/gdb/Makefile.dist
+++ /dev/null
@@ -1,371 +0,0 @@
-/* This file should be run through the C preprocessor by config.gdb
- to produce the Makefile. */
-
-/* Define this to xgdb if you want to compile xgdb as well as gdb. */
-XGDB=
-/* Place to install binaries. */
-bindir=/usr/local/bin
-/* Place to install X binaries. */
-xbindir=$(bindir)
-
-/* System V: If you compile gdb with a compiler which uses the coff
- encapsulation feature (this is a function of the compiler used, NOT
- of the m-?.h file selected by config.gdb), you must make sure that
- the GNU nm is the one that is used by munch. */
-
-/* If you are compiling with GCC, make sure that either 1) You use the
- -traditional flag, or 2) You have the fixed include files where GCC
- can reach them. Otherwise the ioctl calls in inflow.c and readline.c
- will be incorrectly compiled. The "fixincludes" script in the gcc
- distribution will fix your include files up. */
-/* CC=gcc -traditional */
-CC=cc
-
-/* It is also possible that you will need to add -I/usr/include/sys to the
- CFLAGS section if your system doesn't have fcntl.h in /usr/include (which
- is where it should be according to Posix). */
-
-YACC=bison -y -v
-/* YACC=yacc */
-SHELL=/bin/sh
-MAKE=make
-
-/* Set this up with gcc if you have gnu ld and the loader will print out
- line numbers for undefinded refs. */
-/* CC-LD=gcc -static */
-CC-LD=${CC}
-
-/* If you are using the GNU C library, uncomment the following line. */
-/* HAVE_VPRINTF_DEFINE = -DHAVE_VPRINTF */
-
-/* -I. for "#include <obstack.h>". Possibly regex.h also. */
-
-/* M_CFLAGS, if defined, has system-dependent CFLAGS. */
-#if !defined(M_CFLAGS)
-#define M_CFLAGS
-#endif
-
-/* CFLAGS for both GDB and readline. */
-GLOBAL_CFLAGS = -g M_CFLAGS
-CFLAGS = -I. ${HAVE_VPRINTF_DEFINE} ${GLOBAL_CFLAGS}
-/* None of the things in CFLAGS will do any harm, and on some systems
- (e.g. SunOS4) it is important to use the M_CFLAGS. */
-LDFLAGS = $(CFLAGS)
-
-/*
- define this to be "obstack.o" if you don't have the obstack library installed
- you must at the same time define OBSTACK1 as "obstack.o"
- so that the dependencies work right. Similarly with REGEX and "regex.o".
- You must define REGEX and REGEX1 on USG machines.
- If your sysyem is missing alloca(), or, more likely, it's there but
- it doesn't work, define ALLOCA & ALLOCA1 */
-OBSTACK = obstack.o
-OBSTACK1 = obstack.o
-
-#ifdef M_REGEX
-REGEX = M_REGEX
-REGEX1 = M_REGEX
-#else
-REGEX =
-REGEX1 =
-#endif
-
-#ifdef M_ALLOCA
-ALLOCA = M_ALLOCA
-ALLOCA1 = M_ALLOCA
-#else
-ALLOCA =
-ALLOCA1 =
-#endif
-
-/*
- define this to be "malloc.o" if you want to use the gnu malloc routine
- (useful for debugging memory allocation problems in gdb). Otherwise, leave
- it blank. */
-/* GNU_MALLOC = */
-GNU_MALLOC = malloc.o
-
-/* Flags to be used in compiling malloc.o
- Specify range checking for storage allocation. */
-/* MALLOC_FLAGS = ${CFLAGS} */
-MALLOC_FLAGS = ${CFLAGS} -Drcheck -Dbotch=fatal_dump_core -DMSTATS
-
-/* Define SYSV if compiling on a system V or HP machine. */
-#ifdef M_SYSV
-SYSV_DEFINE = -DSYSV
-#else
-SYSV_DEFINE =
-#endif
-
-/* MUNCH_DEFINE should be -DSYSV if have System V-style nm,
- or null if have BSD-style nm. */
-#ifdef M_BSD_NM
-MUNCH_DEFINE =
-#else
-MUNCH_DEFINE = ${SYSV_DEFINE}
-#endif
-
-/* Flags that describe where you can find the termcap library.
- You may need to make other arrangements for USG. */
-TERMCAP = -ltermcap
-
-/* M_CLIBS, if defined, has system-dependent libs
- For example, -lPW for System V to get alloca(). */
-#ifndef M_CLIBS
-#define M_CLIBS
-#endif
-CLIBS = ${ADD_FILES} ${TERMCAP} M_CLIBS
-
-ADD_FILES = ${OBSTACK} ${REGEX} ${ALLOCA} ${GNU_MALLOC}
-ADD_DEPS = ${OBSTACK1} ${REGEX1} ${ALLOCA1} ${GNU_MALLOC}
-
-SFILES = blockframe.c breakpoint.c dbxread.c coffread.c command.c core.c \
- environ.c eval.c expprint.c findvar.c infcmd.c inflow.c infrun.c \
- kdb-start.c main.c printcmd.c \
- remote.c source.c stack.c standalone.c stuff.c symmisc.c symtab.c \
- utils.c valarith.c valops.c valprint.c values.c version.c expread.y \
- xgdb.c
-
-DEPFILES = umax-dep.c gould-dep.c default-dep.c sun3-dep.c \
- sparc-dep.c hp9k320-dep.c hp300bsd-dep.c news-dep.c i386-dep.c \
- symmetry-dep.c convex-dep.c altos-dep.c isi-dep.c pyr-dep.c
-
-PINSNS = gld-pinsn.c i386-pinsn.c sparc-pinsn.c vax-pinsn.c m68k-pinsn.c \
- ns32k-pinsn.c convex-pinsn.c pyr-pinsn.c
-
-HFILES = command.h defs.h environ.h expression.h frame.h getpagesize.h \
- inferior.h symseg.h symtab.h value.h wait.h \
- a.out.encap.h a.out.gnu.h stab.gnu.h
-
-OPCODES = m68k-opcode.h pn-opcode.h sparc-opcode.h npl-opcode.h vax-opcode.h \
- ns32k-opcode.h convex-opcode.h pyr-opcode.h
-
-MFILES = m-hp9k320.h m-hp300bsd.h m-i386.h m-i386gas.h \
- m-i386-sv32.h m-i386g-sv32.h m-isi.h m-merlin.h \
- m-altos.h m-news.h m-newsos3.h m-npl.h m-pn.h \
- m-sparc.h m-sun2.h m-sun3.h m-sun2os4.h \
- m-sun3os4.h m-sun4os4.h m-umax.h m-vax.h m-symmetry.h m-convex.h \
- m-pyr.h
-
-/* This list of files really shouldn't be in this makefile, but I can't think
- of any good way to get the readline makefile to tell us what files
- to put in our tarfile. */
-READLINE = readline.c history.c funmap.c \
- emacs_keymap.c vi_keymap.c vi_mode.c keymaps.c \
- readline.h history.h keymaps.h chardefs.h \
- inc-readline.texinfo inc-history.texinfo \
- readline.texinfo history.texinfo \
- Makefile ChangeLog
-
-REMOTE_EXAMPLES = remote-sa.m68k.shar remote-multi.shar
-
-POSSLIBS = obstack.h obstack.c regex.c regex.h malloc.c alloca.c
-
-TESTS = testbpt.c testfun.c testrec.c testreg.c testregs.c
-
-OTHERS = Makefile.dist createtags munch config.gdb ChangeLog README TAGS \
- gdb.texinfo .gdbinit COPYING expread.tab.c stab.def \
- XGDB-README copying.c Projects Convex.notes copying.awk hp-include
-
-TAGFILES = ${SFILES} ${DEPFILES} ${PINSNS} ${HFILES} ${OPCODES} ${MFILES} \
- ${POSSLIBS}
-TARFILES = ${TAGFILES} ${OTHERS} ${REMOTE_EXAMPLES}
-
-OBS = main.o blockframe.o breakpoint.o findvar.o stack.o source.o \
- values.o eval.o valops.o valarith.o valprint.o printcmd.o \
- symtab.o symmisc.o coffread.o dbxread.o infcmd.o infrun.o remote.o \
- command.o utils.o expread.o expprint.o pinsn.o environ.o version.o \
- copying.o ${READLINEOBS}
-
-TSOBS = core.o inflow.o dep.o
-
-NTSOBS = standalone.o
-
-TSSTART = /lib/crt0.o
-
-NTSSTART = kdb-start.o
-
-RL_LIB = readline/libreadline.a
-
-/* Do some fancy trickery to produce a line like
- -DM_MAKEDEFINE="-DM_SYSV -DM_BSD_NM".
-*/
-MD=M_MAKEDEFINE
-
-/* Avoid funny things that Sun's make throws in for us. */
-/* TARGET_ARCH is supposed to get around it putting in the machine type.
- If the "things" up there really is plural, we'll need to do something
- else as well. */
-/*.c.o:
- ${CC} -c ${CFLAGS} $< */
-TARGET_ARCH=
-
-all: gdb $(XGDB)
-
-install: gdb $(XGDB)
- cp gdb $(bindir)/gdb.new
- mv $(bindir)/gdb.new $(bindir)/gdb
- -if [ "$(XGDB)" = xgdb ]; then \
- cp xgdb $(xbindir)/xgdb.new; \
- mv $(xbindir)/xgdb.new $(xbindir)xgdb; \
- fi
-
-gdb : $(OBS) $(TSOBS) ${ADD_DEPS} ${RL_LIB}
- rm -f init.c
- ./munch ${MUNCH_DEFINE} $(OBS) $(TSOBS) > init.c
- ${CC-LD} $(LDFLAGS) -o gdb init.c $(OBS) $(TSOBS) ${RL_LIB} $(CLIBS)
-
-/* This is useful when debugging GDB, because Unix doesn't let you run GDB
- on itself without copying the executable. So "make gdb1" will make
- gdb and put a copy in gdb1, and you can run it with "gdb gdb1". */
-gdb1 : gdb
- cp gdb gdb1
-
-Makefile : Makefile.dist
- cp Makefile.dist tmp.c
- $(CC) -E >Makefile tmp.c $(MD) "-DM_MAKEDEFINE=$(MD)"
- -rm tmp.c
-/* This did not work-- -Usparc became "-Usparc" became "-Usparc.
- Or something like that. */
-/* $(CC) -E >Makefile tmp.c $(MD) "-DM_MAKEDEFINE=\"$(MD)\"" */
-
-xgdb : $(OBS) $(TSOBS) xgdb.o ${ADD_DEPS} ${RL_LIB}
- rm -f init.c
- ./munch ${MUNCH_DEFINE} $(OBS) $(TSOBS) xgdb.o > init.c
- $(CC-LD) $(LDFLAGS) -o xgdb init.c $(OBS) $(TSOBS) xgdb.o \
- -lXaw -lXmu -lXt -lX11 ${RL_LIB} $(CLIBS)
-
-/* Old (pre R3) xgdb comp.
- $(CC-LD) $(LDFLAGS) -o xgdb init.c $(OBS) $(TSOBS) xgdb.o \
- -lXaw -lXt -lX11 $(CLIBS) */
-
-kdb : $(NTSSTART) $(OBS) $(NTSOBS) ${ADD_DEPS} ${RL_LIB}
- rm -f init.c
- ./munch ${MUNCH_DEFINE} $(OBS) $(NTSOBS) > init.c
- $(CC) $(LDFLAGS) -c init.c $(CLIBS)
- ld -o kdb $(NTSSTART) $(OBS) $(NTSOBS) init.o ${RL_LIB} -lc $(CLIBS)
-
-/* If it can figure out the appropriate order, createtags will make sure
- that the proper m-*, *-dep, *-pinsn, and *-opcode files come first
- in the tags list. It will attempt to do the same for dbxread.c and
- coffread.c. This makes using M-. on machine dependent routines much
- easier. */
-
-TAGS: ${TAGFILES}
- createtags ${TAGFILES}
-tags: TAGS
-
-gdb.tar: ${TARFILES}
- rm -f gdb.tar
- mkdir dist-gdb
- cd dist-gdb ; for i in ${TARFILES} ; do ln -s ../$$i . ; done
- mkdir dist-gdb/readline
- cd dist-gdb/readline ; for i in ${READLINE} ; do ln -s ../../readline/$$i . ; done
- tar chf gdb.tar dist-gdb
- rm -rf dist-gdb
-
-/* Remove gdb.tar.Z so stupid compress doesn't ask whether we want to
- overwrite it. compress -f is not what we want, because we do want
- to know if compress would not make it smaller. */
-gdb.tar.Z: gdb.tar
- if [ -f gdb.tar.Z ]; then rm -f gdb.tar.Z; else true; fi
- compress gdb.tar
-
-clean:
- rm -f ${OBS} ${TSOBS} ${NTSOBS} ${OBSTACK} ${REGEX} ${GNU_MALLOC}
- rm -f init.c init.o
- rm -f xgdb.o xgdb
- rm -f gdb core gdb.tar gdb.tar.Z make.log
- rm -f gdb[0-9]
- cd readline ; make clean
-
-distclean: clean expread.tab.c TAGS
- rm -f dep.c opcode.h param.h pinsn.c config.status
- rm -f y.output yacc.acts yacc.tmp
- rm -f ${TESTS} Makefile
-
-realclean: clean
- rm -f expread.tab.c TAGS
- rm -f dep.c opcode.h param.h pinsn.c config.status
- rm -f Makefile
-
-xgdb.o : defs.h param.h symtab.h frame.h
-
-/* Make copying.c from COPYING */
-copying.c : COPYING copying.awk
- awk -f copying.awk < COPYING > copying.c
-
-expread.tab.c : expread.y
- @echo 'Expect 4 shift/reduce conflict.'
- ${YACC} expread.y
- mv y.tab.c expread.tab.c
-
-expread.o : expread.tab.c defs.h param.h symtab.h frame.h expression.h
- $(CC) -c ${CFLAGS} expread.tab.c
- mv expread.tab.o expread.o
-
-readline/libreadline.a : force_update
- cd readline ; ${MAKE} "SYSV=${SYSV_DEFINE}" \
- "DEBUG_FLAGS=${GLOBAL_CFLAGS}" "CC=${CC}" libreadline.a
-
-force_update :
-
-/* Only useful if you are using the gnu malloc routines. */
-malloc.o : malloc.c
- ${CC} -c ${MALLOC_FLAGS} malloc.c
-
-/* dep.o depends on config.status in case someone reconfigures gdb out
- from under an already compiled gdb. */
-dep.o : dep.c config.status defs.h param.h frame.h inferior.h obstack.h \
- a.out.encap.h
-
-/* pinsn.o depends on config.status in case someone reconfigures gdb out
- from under an already compiled gdb. */
-pinsn.o : pinsn.c config.status defs.h param.h symtab.h obstack.h symseg.h \
- frame.h opcode.h
-
-/* The rest of this is a standard dependencies list (hand edited output of
- cpp -M). It does not include dependencies of .o files on .c files. */
-/* All files which depend on config.status also depend on param.h in case
- someone reconfigures gdb out from under an already compiled gdb. */
-blockframe.o : defs.h param.h config.status symtab.h obstack.h symseg.h frame.h
-breakpoint.o : defs.h param.h config.status symtab.h obstack.h symseg.h frame.h
-coffread.o : defs.h param.h config.status
-command.o : command.h defs.h
-core.o : defs.h param.h config.status a.out.encap.h
-dbxread.o : param.h config.status defs.h symtab.h obstack.h symseg.h a.out.encap.h \
- stab.gnu.h
-environ.o : environ.h
-eval.o : defs.h param.h config.status symtab.h obstack.h symseg.h value.h expression.h
-expprint.o : defs.h symtab.h obstack.h symseg.h param.h config.status expression.h
-findvar.o : defs.h param.h config.status symtab.h obstack.h symseg.h frame.h value.h
-infcmd.o : defs.h param.h config.status symtab.h obstack.h symseg.h frame.h inferior.h \
- environ.h value.h
-inflow.o : defs.h param.h config.status frame.h inferior.h
-infrun.o : defs.h param.h config.status symtab.h obstack.h symseg.h frame.h inferior.h \
- wait.h
-kdb-start.o : defs.h param.h config.status
-main.o : defs.h command.h param.h config.status
-malloc.o : getpagesize.h
-obstack.o : obstack.h
-printcmd.o : defs.h param.h config.status frame.h symtab.h obstack.h symseg.h value.h \
- expression.h
-regex.o : regex.h
-remote.o : defs.h param.h config.status frame.h inferior.h wait.h
-source.o : defs.h symtab.h obstack.h symseg.h param.h config.status
-stack.o : defs.h param.h config.status symtab.h obstack.h symseg.h frame.h
-standalone.o : defs.h param.h config.status symtab.h obstack.h symseg.h frame.h \
- inferior.h wait.h
-symmisc.o : defs.h symtab.h obstack.h symseg.h obstack.h
-symtab.o : defs.h symtab.h obstack.h symseg.h param.h config.status obstack.h
-utils.o : defs.h param.h config.status
-valarith.o : defs.h param.h config.status symtab.h obstack.h symseg.h value.h expression.h
-valops.o : defs.h param.h config.status symtab.h obstack.h symseg.h value.h frame.h \
- inferior.h
-valprint.o : defs.h param.h config.status symtab.h obstack.h symseg.h value.h
-values.o : defs.h param.h config.status symtab.h obstack.h symseg.h value.h
-
-robotussin.h : getpagesize.h
-symtab.h : obstack.h symseg.h
-a.out.encap.h : a.out.gnu.h
-
diff --git a/gnu/usr.bin/gdb/Projects b/gnu/usr.bin/gdb/Projects
deleted file mode 100644
index f38f6c7..0000000
--- a/gnu/usr.bin/gdb/Projects
+++ /dev/null
@@ -1,114 +0,0 @@
-
- Suggested projects for aspiring or current GDB hackers
- ======================================================
-
- (You should probably chat with kingdon@ai.mit.edu to make sure that
- no one else is doing the project you chose).
-
-Add watchpoints (break if a memory location changes). This would
-usually have to involve constant single stepping, but occasionally
-there is operating system support which gdb should be able to cleanly
-use (e.g. on the 80386, there are 4 debug registers. By ptracing an
-address into them, you can get a trap on writes or on reads and
-writes).
-
-Rewrite proceed, wait_for_inferior, and normal_stop to clean them up.
-Suggestions:
-
- 1) Make each test in wait_for_inferior a seperate subroutine
- call.
- 2) Combine wait_for_inferior and normal_stop to clean up
- communication via global variables.
- 3) See if you can find some way to clean up the global
- variables that are used; possibly group them by data flow
- and information content?
-
-Work out some kind of way to allow running the inferior to be done as
-a sub-execution of, eg. breakpoint command lists. Currently running
-the inferior interupts any command list execution. This would require
-some rewriting of wait_for_inferior & friends, and hence should
-probably be done in concert with the above.
-
-Add function arguments to gdb user defined functions.
-
-Add convenience variables that refer to exec file, symbol file,
-selected frame source file, selected frame function, selected frame
-line number, etc.
-
-Add a "suspend" subcommand of the "continue" command to suspend gdb
-while continuing execution of the subprocess. Useful when you are
-debugging servers and you want to dodge out and initiate a connection
-to a server running under gdb.
-
-Make "handle" understand symbolic signal names.
-
-Work out and implement a reasonably general mechanism for multi-threaded
-processies. There are parts of one implemented in convex-dep.c, if
-you want an example.
-
-A standalone version of gdb on the i386 exists. Anyone who wants to
-do some serious working cleaning it up and making it a general
-standalone gdb should contact pace@wheaties.ai.mit.edu.
-
-Add stab information to allow reasonable debugging of inline functions
-(possibly they should show up on a stack backtrace? With a note
-indicating that they weren't "real"?).
-
-Implement support for specifying arbitrary locations of stack frames
-(in practice, this usually requires specification of both the top and
-bottom of the stack frame (fp and sp), since you *must* retrieve the
-pc that was saved in the innermost frame).
-
-Modify the naked "until" command to step until past the current source
-line, rather than past the current pc value. This is tricky simply
-because the low level routines have no way of specifying a multi-line
-step range, and there is no way of saying "don't print stuff when we
-stop" from above (otherwise could just call step many times).
-
-Modify the handling of symbols grouped through BINCL/EINCL stabs to
-allocate a partial symtab for each BINCL/EINCL grouping. This will
-seriously decrease the size of inter-psymtab dependencies and hence
-lessen the amount that needs to be read in when a new source file is
-accessed.
-
-Work out some method of saving breakpoints across the reloading of an
-executable. Probably this should be by saving the commands by which
-the breakpoints were set and re-executing them (as text locations may
-change).
-
-Do an "x/i $pc" after each stepi or nexti.
-
-Modify all of the disassemblers to use printf_filtered to get correct
-more filtering.
-
-Modify gdb to work correctly with Pascal.
-
-Rewrite macros that handle frame chaining and frameless functions.
-They should be able to tell the difference between start, main, and a
-frameless function called from main.
-
-Work out what information would need to be included in an executable
-by the compiler to allow gdb to debug functions which do not have a
-frame pointer. Modify gdb and gcc to do this.
-
-When `attached' to a program (via either OS support or remote
-debugging), gdb should arrange to catch signals which the terminal
-might send, as it is unlikely that the program will be able to notice
-them. SIGINT and SIGTSTP are obvious examples.
-
-Enhance the gdb manual with extra examples where needed.
-
-Arrange for list_command not to use decode_line_1 and thus not require
-symbols to be read in simply to read a source file.
-
-Problem in xgdb; the readline library needs the terminal in CBREAK
-mode for command line editing, but this makes it difficult to dispatch
-on button presses. Possible solution: use a define to replace getc in
-readline.c with a routine that does button dispatches. You should
-probably see XGDB-README before you fiddle with XGDB. Also, someone
-is implementing a new xgdb; it may not be worth while fiddling with
-the old one.
-
-# Local Variables:
-# mode: text
-# End:
diff --git a/gnu/usr.bin/gdb/README.gnu b/gnu/usr.bin/gdb/README.gnu
deleted file mode 100644
index fa54dec..0000000
--- a/gnu/usr.bin/gdb/README.gnu
+++ /dev/null
@@ -1,142 +0,0 @@
-This is GDB, the GNU source-level debugger, presently running under un*x.
-
-Before compiling GDB, you must tell GDB what kind of machine you are
-running on. To do this, type `config.gdb machine', where machine is
-something like `vax' or `sun2'. For a list of valid machine types,
-type `config.gdb'.
-
-Normally config.gdb edits the makefile as necessary. If you have to
-edit the makefile on a standard machine listed in config.gdb this
-should be considered a bug and reported as such.
-
-Once these files are set up, just `make' will do everything,
-producing an executable `gdb' in this directory.
-
-If you want a new (current to this release) version of the manual, you
-will have to use the gdb.texinfo file provided with this distribution.
-The gdb.texinfo file requires the texinfo-format-buffer command from
-emacs 18.55 or later.
-
-About languages other than C...
-
-C++ support has been integrated into gdb. GDB should work with
-FORTRAN programs (if you have problem, please send a bug report), but
-I am not aware of anyone who is working on getting it to use the
-syntax of any language other than C or C++. Pascal programs which use
-sets, subranges, file variables, or nested functions will not
-currently work.
-
-About -gg format...
-
-Currently GDB version 3.x does *not* support GCC's -gg format. This
-is because it (in theory) has fast enough startup on dbx debugging
-format object files that -gg format is unnecessary (and hence
-undesirable, since it wastes space and processing power in gcc). I
-would like to hear people's opinions on the amount of time currently
-spent in startup; is it fast enough?
-
-About remote debugging...
-
-The two files remote-multi.shar and remote-sa.m68k.shar contain two
-examples of a remote stub to be used with remote.c. The the -multi
-file is a general stub that can probably be running on various
-different flavors of unix to allow debugging over a serial line from
-one machine to another. The remote-sa.m68k.shar is designed to run
-standalone on a 68k type cpu and communicate properley with the
-remote.c stub over a serial line.
-
-About reporting bugs...
-
-The correct address for reporting bugs found with gdb is
-"bug-gdb@prep.ai.mit.edu". Please send all bugs to that address.
-
-About xgdb...
-
-xgdb.c was provided to us by the user community; it is not an integral
-part of the gdb distribution. The problem of providing visual
-debugging support on top of gdb is peripheral to the GNU project and
-(at least right now) we can't afford to put time into it. So while we
-will be happy to incorporate user fixes to xgdb.c, we do not guarantee
-that it will work and we will not fix bugs reported in it. Someone is
-working on writing a new XGDB, so improving (e.g. by fixing it so that
-it will work, if it doesn't currently) the current one is not worth it.
-
-For those intersted in auto display of source and the availability of
-an editor while debugging I suggest trying gdb-mode in gnu-emacs.
-Comments on this mode are welcome.
-
-About the machine-dependent files...
-
-m-<machine>.h (param.h is a link to this file).
-This file contains macro definitions that express information
-about the machine's registers, stack frame format and instructions.
-
-<machine>-opcode.h (opcode.h is a link to this file).
-<machine>-pinsn.c (pinsn.c is a link to this file).
-These files contain the information necessary to print instructions
-for your cpu type.
-
-<machine>-dep.c (dep.c is a link to this file).
-Those routines which provide a low level interface to ptrace and which
-tend to be machine-dependent. (The machine-independent routines are in
-`infrun.c' and `inflow.c')
-
-About writing code for GDB...
-
-We appreciate having users contribute code that is of general use, but
-for it to be included in future GDB releases it must be cleanly
-written. We do not want to include changes that will needlessly make future
-maintainance difficult. It is not much harder to do things right, and
-in the long term it is worth it to the GNU project, and probably to
-you individually as well.
-
-Please code according to the GNU coding standards. If you do not have
-a copy, you can request one by sending mail to gnu@prep.ai.mit.edu.
-
-Please try to avoid making machine-specific changes to
-machine-independent files (i.e. all files except "param.h" and
-"dep.c". "pinsn.c" and "opcode.h" are processor-specific but not
-operating system-dependent). If this is unavoidable, put a hook in
-the machine-independent file which calls a (possibly)
-machine-dependent macro (for example, the IGNORE_SYMBOL macro can be
-used for any symbols which need to be ignored on a specific machine.
-Calling IGNORE_SYMBOL in dbxread.c is a lot cleaner than a maze of #if
-defined's). The machine-independent code should do whatever "most"
-machines want if the macro is not defined in param.h. Using #if
-defined can sometimes be OK (e.g. SET_STACK_LIMIT_HUGE) but should be
-conditionalized on a specific feature of an operating system (set in
-param.h) rather than something like #if defined(vax) or #if
-defined(SYSV).
-
-It is better to replace entire routines which may be system-specific,
-rather than put in a whole bunch of hooks which are probably not going
-to be helpful for any purpose other than your changes. For example,
-if you want to modify dbxread.c to deal with DBX debugging symbols
-which are in COFF files rather than BSD a.out files, do something
-along the lines of a macro GET_NEXT_SYMBOL, which could have
-different definitions for COFF and a.out, rather than trying to put
-the necessary changes throughout all the code in dbxread.c that
-currently assumes BSD format.
-
-Please avoid duplicating code. For example, if something needs to be
-changed in read_inferior_memory, it is very painful because there is a
-copy in every dep.c file. The correct way to do this is to put (in
-this case) the standard ptrace interfaces in a separate file ptrace.c,
-which is used by all systems which have ptrace. ptrace.c would deal
-with variations between systems the same way any system-independent
-file would (hooks, #if defined, etc.).
-
-About debugging gdb with itself...
-
-You probably want to do a "make TAGS" after you configure your
-distribution; this will put the machine dependent routines for your
-local machine where they will be accessed first by a M-period .
-
-Also, make sure that you've compiled gdb with your local cc or taken
-appropriate precautions regarding ansification of include files. See
-the Makefile for more information.
-
-The "info" command, when executed without a subcommand in a gdb being
-debugged by gdb, will pop you back up to the top level gdb. See
-.gdbinit for more details.
-
diff --git a/gnu/usr.bin/gdb/XGdbinit.samp b/gnu/usr.bin/gdb/XGdbinit.samp
deleted file mode 100644
index a99f106..0000000
--- a/gnu/usr.bin/gdb/XGdbinit.samp
+++ /dev/null
@@ -1,15 +0,0 @@
-button "show" push-to-file %S
-button "back" pop-file
-button "break in" break %S
-button "break at" break %l
-button delete delete %b%e
-button backtrace
-button up
-button down
-button print print %E
-button print* print *(%E)
-button next
-button step
-button "do upto" until %l%e
-button finish
-button continue cont%e
diff --git a/gnu/usr.bin/gdb/Xgdb.ad b/gnu/usr.bin/gdb/Xgdb.ad
deleted file mode 100644
index 5f9fe99..0000000
--- a/gnu/usr.bin/gdb/Xgdb.ad
+++ /dev/null
@@ -1,8 +0,0 @@
-Xgdb*geometry: 580x874-0+28
-Xgdb*src*scrollVertical: whenneeded
-Xgdb*src*scrollHorizontal: whenneeded
-Xgdb*src*wrap: never
-Xgdb*src*editType: read
-Xgdb*frame.buttons.allowResize: true
-Xgdb*frame.buttons.skipAdjust: true
-Xgdb*frame*showGrip: false
diff --git a/gnu/usr.bin/gdb/bfd/seclet.c b/gnu/usr.bin/gdb/bfd/seclet.c
deleted file mode 100644
index 5dcc59a..0000000
--- a/gnu/usr.bin/gdb/bfd/seclet.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/* seclet.c
- Copyright (C) 1992, 1993 Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* This module is part of BFD */
-
-
-/* The intention is that one day, all the code which uses sections
- will change and use seclets instead - maybe seglet would have been
- a better name..
-
- Anyway, a seclet contains enough info to be able to describe an
- area of output memory in one go.
-
- The only description so far catered for is that of the
- <<bfd_indirect_seclet>>, which is a select which points to a
- <<section>> and the <<asymbols>> associated with the section, so
- that relocation can be done when needed.
-
- One day there will be more types - they will at least migrate from
- the linker's data structures - also there could be extra stuff,
- like a bss seclet, which descibes a lump of memory as containing
- zeros compactly, without the horrible SEC_* flag cruft.
-
-
-*/
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "seclet.h"
-#include "coff/internal.h"
-
-/* Create a new seclet and attach it to a section. */
-
-bfd_seclet_type *
-DEFUN(bfd_new_seclet,(abfd, section),
- bfd *abfd AND
- asection *section)
-{
- bfd_seclet_type *n = (bfd_seclet_type *)bfd_alloc(abfd, sizeof(bfd_seclet_type));
- if (section->seclets_tail != (bfd_seclet_type *)NULL) {
- section->seclets_tail->next = n;
- }
- else
- {
- section->seclets_head = n;
- }
- section->seclets_tail = n;
-
- return n;
-}
-
-/* Given an indirect seclet which points to an input section, relocate
- the contents of the seclet and put the data in its final
- destination. */
-
-static boolean
-DEFUN(rel,(abfd, seclet, output_section, data, relocateable),
- bfd *abfd AND
- bfd_seclet_type *seclet AND
- asection *output_section AND
- PTR data AND
- boolean relocateable)
-{
- if ((output_section->flags & SEC_HAS_CONTENTS) != 0
- && seclet->size)
- {
- data = (PTR) bfd_get_relocated_section_contents(abfd, seclet, data,
- relocateable);
- if(bfd_set_section_contents(abfd,
- output_section,
- data,
- seclet->offset,
- seclet->size) == false)
- {
- abort();
- }
- }
- return true;
-}
-
-/* Put the contents of a seclet in its final destination. */
-
-static boolean
-DEFUN(seclet_dump_seclet,(abfd, seclet, section, data, relocateable),
- bfd *abfd AND
- bfd_seclet_type *seclet AND
- asection *section AND
- PTR data AND
- boolean relocateable)
-{
- switch (seclet->type)
- {
- case bfd_indirect_seclet:
- /* The contents of this section come from another one somewhere
- else */
- return rel(abfd, seclet, section, data, relocateable);
-
- case bfd_fill_seclet:
- /* Fill in the section with us */
- {
- char *d = bfd_xmalloc(seclet->size);
- unsigned int i;
- for (i =0; i < seclet->size; i+=2) {
- d[i] = seclet->u.fill.value >> 8;
- }
- for (i = 1; i < seclet->size; i+=2) {
- d[i] = seclet->u.fill.value ;
- }
- /* Don't bother to fill in empty sections */
- if (!(bfd_get_section_flags(abfd, section) & SEC_HAS_CONTENTS))
- {
- return true;
- }
- return bfd_set_section_contents(abfd, section, d, seclet->offset,
- seclet->size);
- }
-
- default:
- abort();
- }
-
- return true;
-}
-
-/*
-INTERNAL_FUNCTION
- bfd_generic_seclet_link
-
-SYNOPSIS
- boolean bfd_generic_seclet_link
- (bfd *abfd,
- PTR data,
- boolean relocateable);
-
-DESCRIPTION
-
- The generic seclet linking routine. The caller should have
- set up seclets for all the output sections. The DATA argument
- should point to a memory area large enough to hold the largest
- section. This function looks through the seclets and moves
- the contents into the output sections. If RELOCATEABLE is
- true, the orelocation fields of the output sections must
- already be initialized.
-
-*/
-
-boolean
-DEFUN(bfd_generic_seclet_link,(abfd, data, relocateable),
- bfd *abfd AND
- PTR data AND
- boolean relocateable)
-{
- asection *o = abfd->sections;
- while (o != (asection *)NULL)
- {
- bfd_seclet_type *p = o->seclets_head;
- while (p != (bfd_seclet_type *)NULL)
- {
- if (seclet_dump_seclet(abfd, p, o, data, relocateable) == false)
- return false;
- p = p ->next;
- }
- o = o->next;
- }
-
- return true;
-}
diff --git a/gnu/usr.bin/gdb/bfd/seclet.h b/gnu/usr.bin/gdb/bfd/seclet.h
deleted file mode 100644
index de5fdff..0000000
--- a/gnu/usr.bin/gdb/bfd/seclet.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Definitions of little sections (seclets) for BFD.
- Copyright 1992 Free Software Foundation, Inc.
- Hacked by Steve Chamberlain of Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef _SECLET_H
-#define _SECLET_H
-
-enum bfd_seclet_enum
-{
- bfd_indirect_seclet,
- bfd_fill_seclet
-};
-
-struct bfd_seclet
-{
- struct bfd_seclet *next;
- enum bfd_seclet_enum type;
- unsigned int offset;
- unsigned int size;
- union
- {
- struct
- {
- asection *section;
- asymbol **symbols;
- } indirect;
- struct {
- int value;
- } fill;
- }
- u;
-};
-
-typedef struct bfd_seclet bfd_seclet_type;
-
-bfd_seclet_type *
-bfd_new_seclet PARAMS ((bfd *, asection *));
-
-#endif
diff --git a/gnu/usr.bin/gdb/blockframe.c b/gnu/usr.bin/gdb/blockframe.c
deleted file mode 100644
index 236d1cd..0000000
--- a/gnu/usr.bin/gdb/blockframe.c
+++ /dev/null
@@ -1,622 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)blockframe.c 6.4 (Berkeley) 5/11/91";
-#endif /* not lint */
-
-/* Get info from stack frames;
- convert between frames, blocks, functions and pc values.
- Copyright (C) 1986, 1987, 1988, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "defs.h"
-#include "param.h"
-#include "symtab.h"
-#include "frame.h"
-
-#include <obstack.h>
-
-#if defined(NEWVM) && defined(KERNELDEBUG)
-#include <sys/param.h> /* XXX for FRAME_CHAIN_VALID */
-#endif
-
-/* Start and end of object file containing the entry point.
- STARTUP_FILE_END is the first address of the next file.
- This file is assumed to be a startup file
- and frames with pc's inside it
- are treated as nonexistent.
-
- Setting these variables is necessary so that backtraces do not fly off
- the bottom of the stack. */
-CORE_ADDR startup_file_start;
-CORE_ADDR startup_file_end;
-
-/* Is ADDR outside the startup file? */
-int
-outside_startup_file (addr)
- CORE_ADDR addr;
-{
- return !(addr >= startup_file_start && addr < startup_file_end);
-}
-
-/* Address of innermost stack frame (contents of FP register) */
-
-static FRAME current_frame;
-
-struct block *block_for_pc ();
-CORE_ADDR get_pc_function_start ();
-
-/*
- * Cache for frame addresses already read by gdb. Valid only while
- * inferior is stopped. Control variables for the frame cache should
- * be local to this module.
- */
-struct obstack frame_cache_obstack;
-
-/* Return the innermost (currently executing) stack frame. */
-
-FRAME
-get_current_frame ()
-{
- /* We assume its address is kept in a general register;
- param.h says which register. */
-
- return current_frame;
-}
-
-void
-set_current_frame (frame)
- FRAME frame;
-{
- current_frame = frame;
-}
-
-FRAME
-create_new_frame (addr, pc)
- FRAME_ADDR addr;
- CORE_ADDR pc;
-{
- struct frame_info *fci; /* Same type as FRAME */
-
- fci = (struct frame_info *)
- obstack_alloc (&frame_cache_obstack,
- sizeof (struct frame_info));
-
- /* Arbitrary frame */
- fci->next = (struct frame_info *) 0;
- fci->prev = (struct frame_info *) 0;
- fci->frame = addr;
- fci->next_frame = 0; /* Since arbitrary */
- fci->pc = pc;
-
-#ifdef INIT_EXTRA_FRAME_INFO
- INIT_EXTRA_FRAME_INFO (fci);
-#endif
-
- return fci;
-}
-
-/* Return the frame that called FRAME.
- If FRAME is the original frame (it has no caller), return 0. */
-
-FRAME
-get_prev_frame (frame)
- FRAME frame;
-{
- /* We're allowed to know that FRAME and "struct frame_info *" are
- the same */
- return get_prev_frame_info (frame);
-}
-
-/* Return the frame that FRAME calls (0 if FRAME is the innermost
- frame). */
-
-FRAME
-get_next_frame (frame)
- FRAME frame;
-{
- /* We're allowed to know that FRAME and "struct frame_info *" are
- the same */
- return frame->next;
-}
-
-/*
- * Flush the entire frame cache.
- */
-void
-flush_cached_frames ()
-{
- /* Since we can't really be sure what the first object allocated was */
- obstack_free (&frame_cache_obstack, 0);
- obstack_init (&frame_cache_obstack);
-
- current_frame = (struct frame_info *) 0; /* Invalidate cache */
-}
-
-/* Return a structure containing various interesting information
- about a specified stack frame. */
-/* How do I justify including this function? Well, the FRAME
- identifier format has gone through several changes recently, and
- it's not completely inconceivable that it could happen again. If
- it does, have this routine around will help */
-
-struct frame_info *
-get_frame_info (frame)
- FRAME frame;
-{
- return frame;
-}
-
-/* If a machine allows frameless functions, it should define a macro
- FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) in param.h. FI is the struct
- frame_info for the frame, and FRAMELESS should be set to nonzero
- if it represents a frameless function invocation. */
-
-/* Many machines which allow frameless functions can detect them using
- this macro. Such machines should define FRAMELESS_FUNCTION_INVOCATION
- to just call this macro. */
-#define FRAMELESS_LOOK_FOR_PROLOGUE(FI, FRAMELESS) \
-{ \
- CORE_ADDR func_start, after_prologue; \
- func_start = (get_pc_function_start ((FI)->pc) + \
- FUNCTION_START_OFFSET); \
- if (func_start) \
- { \
- after_prologue = func_start; \
- SKIP_PROLOGUE (after_prologue); \
- (FRAMELESS) = (after_prologue == func_start); \
- } \
- else \
- /* If we can't find the start of the function, we don't really */ \
- /* know whether the function is frameless, but we should be */ \
- /* able to get a reasonable (i.e. best we can do under the */ \
- /* circumstances) backtrace by saying that it isn't. */ \
- (FRAMELESS) = 0; \
-}
-
-/* Return a structure containing various interesting information
- about the frame that called NEXT_FRAME. Returns NULL
- if there is no such frame. */
-
-struct frame_info *
-get_prev_frame_info (next_frame)
- FRAME next_frame;
-{
- FRAME_ADDR address;
- struct frame_info *prev;
- int fromleaf = 0;
-
- /* If the requested entry is in the cache, return it.
- Otherwise, figure out what the address should be for the entry
- we're about to add to the cache. */
-
- if (!next_frame)
- {
- if (!current_frame)
- {
- if (!have_inferior_p () && !have_core_file_p ())
- fatal ("get_prev_frame_info: Called before cache primed. \"Shouldn't happen.\"");
- else
- error ("No inferior or core file.");
- }
-
- return current_frame;
- }
-
- /* If we have the prev one, return it */
- if (next_frame->prev)
- return next_frame->prev;
-
- /* On some machines it is possible to call a function without
- setting up a stack frame for it. On these machines, we
- define this macro to take two args; a frameinfo pointer
- identifying a frame and a variable to set or clear if it is
- or isn't leafless. */
-#ifdef FRAMELESS_FUNCTION_INVOCATION
- /* Still don't want to worry about this except on the innermost
- frame. This macro will set FROMLEAF if NEXT_FRAME is a
- frameless function invocation. */
- if (!(next_frame->next))
- {
- FRAMELESS_FUNCTION_INVOCATION (next_frame, fromleaf);
- if (fromleaf)
- address = next_frame->frame;
- }
-#endif
-
- if (!fromleaf)
- {
- /* Two macros defined in param.h specify the machine-dependent
- actions to be performed here.
- First, get the frame's chain-pointer.
- If that is zero, the frame is the outermost frame or a leaf
- called by the outermost frame. This means that if start
- calls main without a frame, we'll return 0 (which is fine
- anyway).
-
- Nope; there's a problem. This also returns when the current
- routine is a leaf of main. This is unacceptable. We move
- this to after the ffi test; I'd rather have backtraces from
- start go curfluy than have an abort called from main not show
- main. */
- address = FRAME_CHAIN (next_frame);
- if (!FRAME_CHAIN_VALID (address, next_frame))
- return 0;
- /* If this frame is a leaf, this will be superceeded by the
- code below. */
- address = FRAME_CHAIN_COMBINE (address, next_frame);
- }
- if (address == 0)
- return 0;
-
- prev = (struct frame_info *)
- obstack_alloc (&frame_cache_obstack,
- sizeof (struct frame_info));
-
- if (next_frame)
- next_frame->prev = prev;
- prev->next = next_frame;
- prev->prev = (struct frame_info *) 0;
- prev->frame = address;
- prev->next_frame = prev->next ? prev->next->frame : 0;
-
-#ifdef INIT_EXTRA_FRAME_INFO
- INIT_EXTRA_FRAME_INFO(prev);
-#endif
-
- /* This entry is in the frame queue now, which is good since
- FRAME_SAVED_PC may use that queue to figure out it's value
- (see m-sparc.h). We want the pc saved in the inferior frame. */
- prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (next_frame) :
- next_frame ? FRAME_SAVED_PC (next_frame) : read_pc ());
-
- return prev;
-}
-
-CORE_ADDR
-get_frame_pc (frame)
- FRAME frame;
-{
- struct frame_info *fi;
- fi = get_frame_info (frame);
- return fi->pc;
-}
-
-/* Find the addresses in which registers are saved in FRAME. */
-
-void
-get_frame_saved_regs (frame_info_addr, saved_regs_addr)
- struct frame_info *frame_info_addr;
- struct frame_saved_regs *saved_regs_addr;
-{
- FRAME_FIND_SAVED_REGS (frame_info_addr, *saved_regs_addr);
-}
-
-/* Return the innermost lexical block in execution
- in a specified stack frame. The frame address is assumed valid. */
-
-struct block *
-get_frame_block (frame)
- FRAME frame;
-{
- struct frame_info *fi;
- CORE_ADDR pc;
-
- fi = get_frame_info (frame);
-
- pc = fi->pc;
- if (fi->next_frame != 0)
- /* We are not in the innermost frame. We need to subtract one to
- get the correct block, in case the call instruction was the
- last instruction of the block. If there are any machines on
- which the saved pc does not point to after the call insn, we
- probably want to make fi->pc point after the call insn anyway. */
- --pc;
- return block_for_pc (pc);
-}
-
-struct block *
-get_current_block ()
-{
- return block_for_pc (read_pc ());
-}
-
-CORE_ADDR
-get_pc_function_start (pc)
- CORE_ADDR pc;
-{
- register struct block *bl = block_for_pc (pc);
- register struct symbol *symbol;
- if (bl == 0 || (symbol = block_function (bl)) == 0)
- {
- register int misc_index = find_pc_misc_function (pc);
- if (misc_index >= 0)
- return misc_function_vector[misc_index].address;
- return 0;
- }
- bl = SYMBOL_BLOCK_VALUE (symbol);
- return BLOCK_START (bl);
-}
-
-/* Return the symbol for the function executing in frame FRAME. */
-
-struct symbol *
-get_frame_function (frame)
- FRAME frame;
-{
- register struct block *bl = get_frame_block (frame);
- if (bl == 0)
- return 0;
- return block_function (bl);
-}
-
-/* Return the innermost lexical block containing the specified pc value,
- or 0 if there is none. */
-
-extern struct symtab *psymtab_to_symtab ();
-
-struct block *
-block_for_pc (pc)
- register CORE_ADDR pc;
-{
- register struct block *b;
- register int bot, top, half;
- register struct symtab *s;
- register struct partial_symtab *ps;
- struct blockvector *bl;
-
- /* First search all symtabs for one whose file contains our pc */
-
- for (s = symtab_list; s; s = s->next)
- {
- bl = BLOCKVECTOR (s);
- b = BLOCKVECTOR_BLOCK (bl, 0);
- if (BLOCK_START (b) <= pc
- && BLOCK_END (b) > pc)
- break;
- }
-
- if (s == 0)
- for (ps = partial_symtab_list; ps; ps = ps->next)
- {
- if (ps->textlow <= pc
- && ps->texthigh > pc)
- {
- if (ps->readin)
- fatal ("Internal error: pc found in readin psymtab and not in any symtab.");
- s = psymtab_to_symtab (ps);
- bl = BLOCKVECTOR (s);
- b = BLOCKVECTOR_BLOCK (bl, 0);
- break;
- }
- }
-
- if (s == 0)
- return 0;
-
- /* Then search that symtab for the smallest block that wins. */
- /* Use binary search to find the last block that starts before PC. */
-
- bot = 0;
- top = BLOCKVECTOR_NBLOCKS (bl);
-
- while (top - bot > 1)
- {
- half = (top - bot + 1) >> 1;
- b = BLOCKVECTOR_BLOCK (bl, bot + half);
- if (BLOCK_START (b) <= pc)
- bot += half;
- else
- top = bot + half;
- }
-
- /* Now search backward for a block that ends after PC. */
-
- while (bot >= 0)
- {
- b = BLOCKVECTOR_BLOCK (bl, bot);
- if (BLOCK_END (b) > pc)
- return b;
- bot--;
- }
-
- return 0;
-}
-
-/* Return the function containing pc value PC.
- Returns 0 if function is not known. */
-
-struct symbol *
-find_pc_function (pc)
- CORE_ADDR pc;
-{
- register struct block *b = block_for_pc (pc);
- if (b == 0)
- return 0;
- return block_function (b);
-}
-
-/* Finds the "function" (text symbol) that is smaller than PC
- but greatest of all of the potential text symbols. Sets
- *NAME and/or *ADDRESS conditionally if that pointer is non-zero.
- Returns 0 if it couldn't find anything, 1 if it did. On a zero
- return, *NAME and *ADDRESS are always set to zero. On a 1 return,
- *NAME and *ADDRESS contain real information. */
-
-int
-find_pc_partial_function (pc, name, address)
- CORE_ADDR pc;
- char **name;
- CORE_ADDR *address;
-{
- struct partial_symtab *pst = find_pc_psymtab (pc);
- struct symbol *f;
- int miscfunc;
- struct partial_symbol *psb;
-
- if (pst)
- {
- if (pst->readin)
- {
- /* The information we want has already been read in.
- We can go to the already readin symbols and we'll get
- the best possible answer. */
- f = find_pc_function (pc);
- if (!f)
- {
- return_error:
- /* No availible symbol. */
- if (name != 0)
- *name = 0;
- if (address != 0)
- *address = 0;
- return 0;
- }
-
- if (name)
- *name = SYMBOL_NAME (f);
- if (address)
- *address = BLOCK_START (SYMBOL_BLOCK_VALUE (f));
- return 1;
- }
-
- /* Get the information from a combination of the pst
- (static symbols), and the misc function vector (extern
- symbols). */
- miscfunc = find_pc_misc_function (pc);
- psb = find_pc_psymbol (pst, pc);
-
- if (!psb && miscfunc == -1)
- {
- goto return_error;
- }
- if (!psb
- || (miscfunc != -1
- && (SYMBOL_VALUE(psb)
- < misc_function_vector[miscfunc].address)))
- {
- if (address)
- *address = misc_function_vector[miscfunc].address;
- if (name)
- *name = misc_function_vector[miscfunc].name;
- return 1;
- }
- else
- {
- if (address)
- *address = SYMBOL_VALUE (psb);
- if (name)
- *name = SYMBOL_NAME (psb);
- return 1;
- }
- }
- else
- /* Must be in the misc function stuff. */
- {
- miscfunc = find_pc_misc_function (pc);
- if (miscfunc == -1)
- goto return_error;
- if (address)
- *address = misc_function_vector[miscfunc].address;
- if (name)
- *name = misc_function_vector[miscfunc].name;
- return 1;
- }
-}
-
-/* Find the misc function whose address is the largest
- while being less than PC. Return its index in misc_function_vector.
- Returns -1 if PC is not in suitable range. */
-
-int
-find_pc_misc_function (pc)
- register CORE_ADDR pc;
-{
- register int lo = 0;
- register int hi = misc_function_count-1;
- register int new;
- register int distance;
-
- /* Note that the last thing in the vector is always _etext. */
- /* Actually, "end", now that non-functions
- go on the misc_function_vector. */
-
- /* Above statement is not *always* true - fix for case where there are */
- /* no misc functions at all (ie no symbol table has been read). */
- if (hi < 0) return -1; /* no misc functions recorded */
-
- /* trivial reject range test */
- if (pc < misc_function_vector[0].address ||
- pc > misc_function_vector[hi].address)
- return -1;
-
- /* Note that the following search will not return hi if
- pc == misc_function_vector[hi].address. If "end" points to the
- first unused location, this is correct and the above test
- simply needs to be changed to
- "pc >= misc_function_vector[hi].address". */
- do {
- new = (lo + hi) >> 1;
- distance = misc_function_vector[new].address - pc;
- if (distance == 0)
- return new; /* an exact match */
- else if (distance > 0)
- hi = new;
- else
- lo = new;
- } while (hi-lo != 1);
-
- /* if here, we had no exact match, so return the lower choice */
- return lo;
-}
-
-/* Return the innermost stack frame executing inside of the specified block,
- or zero if there is no such frame. */
-
-FRAME
-block_innermost_frame (block)
- struct block *block;
-{
- struct frame_info *fi;
- register FRAME frame;
- register CORE_ADDR start = BLOCK_START (block);
- register CORE_ADDR end = BLOCK_END (block);
-
- frame = 0;
- while (1)
- {
- frame = get_prev_frame (frame);
- if (frame == 0)
- return 0;
- fi = get_frame_info (frame);
- if (fi->pc >= start && fi->pc < end)
- return frame;
- }
-}
-
-void
-_initialize_blockframe ()
-{
- obstack_init (&frame_cache_obstack);
-}
diff --git a/gnu/usr.bin/gdb/breakpoint.c b/gnu/usr.bin/gdb/breakpoint.c
deleted file mode 100644
index b515ed3..0000000
--- a/gnu/usr.bin/gdb/breakpoint.c
+++ /dev/null
@@ -1,1383 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)breakpoint.c 6.3 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* Everything about breakpoints, for GDB.
- Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include "defs.h"
-#include "param.h"
-#include "symtab.h"
-#include "frame.h"
-
-/* This is the sequence of bytes we insert for a breakpoint. */
-
-static char break_insn[] = BREAKPOINT;
-
-/* States of enablement of breakpoint.
- `temporary' means disable when hit.
- `delete' means delete when hit. */
-
-enum enable { disabled, enabled, temporary, delete};
-
-/* Not that the ->silent field is not currently used by any commands
- (though the code is in there if it was to be and set_raw_breakpoint
- does set it to 0). I implemented it because I thought it would be
- useful for a hack I had to put in; I'm going to leave it in because
- I can see how there might be times when it would indeed be useful */
-
-struct breakpoint
-{
- struct breakpoint *next;
- /* Number assigned to distinguish breakpoints. */
- int number;
- /* Address to break at. */
- CORE_ADDR address;
- /* Line number of this address. Redundant. */
- int line_number;
- /* Symtab of file of this address. Redundant. */
- struct symtab *symtab;
- /* Zero means disabled; remember the info but don't break here. */
- enum enable enable;
- /* Non-zero means a silent breakpoint (don't print frame info
- if we stop here). */
- unsigned char silent;
- /* Number of stops at this breakpoint that should
- be continued automatically before really stopping. */
- int ignore_count;
- /* "Real" contents of byte where breakpoint has been inserted.
- Valid only when breakpoints are in the program. */
- char shadow_contents[sizeof break_insn];
- /* Nonzero if this breakpoint is now inserted. */
- char inserted;
- /* Nonzero if this is not the first breakpoint in the list
- for the given address. */
- char duplicate;
- /* Chain of command lines to execute when this breakpoint is hit. */
- struct command_line *commands;
- /* Stack depth (address of frame). If nonzero, break only if fp
- equals this. */
- FRAME_ADDR frame;
- /* Conditional. Break only if this expression's value is nonzero. */
- struct expression *cond;
-};
-
-#define ALL_BREAKPOINTS(b) for (b = breakpoint_chain; b; b = b->next)
-
-/* Chain of all breakpoints defined. */
-
-struct breakpoint *breakpoint_chain;
-
-/* Number of last breakpoint made. */
-
-static int breakpoint_count;
-
-/* Default address, symtab and line to put a breakpoint at
- for "break" command with no arg.
- if default_breakpoint_valid is zero, the other three are
- not valid, and "break" with no arg is an error.
-
- This set by print_stack_frame, which calls set_default_breakpoint. */
-
-int default_breakpoint_valid;
-CORE_ADDR default_breakpoint_address;
-struct symtab *default_breakpoint_symtab;
-int default_breakpoint_line;
-
-/* Remaining commands (not yet executed)
- of last breakpoint hit. */
-
-struct command_line *breakpoint_commands;
-
-static void delete_breakpoint ();
-void clear_momentary_breakpoints ();
-void breakpoint_auto_delete ();
-
-/* Flag indicating extra verbosity for xgdb. */
-extern int xgdb_verbose;
-
-/* condition N EXP -- set break condition of breakpoint N to EXP. */
-
-static void
-condition_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- register struct breakpoint *b;
- register char *p;
- register int bnum;
- register struct expression *expr;
-
- if (arg == 0)
- error_no_arg ("breakpoint number");
-
- p = arg;
- while (*p >= '0' && *p <= '9') p++;
- if (p == arg)
- /* There is no number here. (e.g. "cond a == b"). */
- error_no_arg ("breakpoint number");
- bnum = atoi (arg);
-
- ALL_BREAKPOINTS (b)
- if (b->number == bnum)
- {
- if (b->cond)
- {
- free (b->cond);
- b->cond = 0; /* parse_c_1 can leave this unchanged. */
- }
- if (*p == 0)
- {
- b->cond = 0;
- if (from_tty)
- printf ("Breakpoint %d now unconditional.\n", bnum);
- }
- else
- {
- if (*p != ' ' && *p != '\t')
- error ("Arguments must be an integer (breakpoint number) and an expression.");
-
- /* Find start of expression */
- while (*p == ' ' || *p == '\t') p++;
-
- arg = p;
- b->cond = (struct expression *) parse_c_1 (&arg, block_for_pc (b->address), 0);
- if (*arg)
- error ("Junk at end of expression");
- }
- return;
- }
-
- error ("No breakpoint number %d.", bnum);
-}
-
-static void
-commands_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- register struct breakpoint *b;
- register char *p, *p1;
- register int bnum;
- struct command_line *l;
-
- /* If we allowed this, we would have problems with when to
- free the storage, if we change the commands currently
- being read from. */
-
- if (breakpoint_commands)
- error ("Can't use the \"commands\" command among a breakpoint's commands.");
-
- /* Allow commands by itself to refer to the last breakpoint. */
- if (arg == 0)
- bnum = breakpoint_count;
- else
- {
- p = arg;
- if (! (*p >= '0' && *p <= '9'))
- error ("Argument must be integer (a breakpoint number).");
-
- while (*p >= '0' && *p <= '9') p++;
- if (*p)
- error ("Unexpected extra arguments following breakpoint number.");
-
- bnum = atoi (arg);
- }
-
- ALL_BREAKPOINTS (b)
- if (b->number == bnum)
- {
- if (from_tty && input_from_terminal_p ())
- {
- printf ("Type commands for when breakpoint %d is hit, one per line.\n\
-End with a line saying just \"end\".\n", bnum);
- fflush (stdout);
- }
- l = read_command_lines (from_tty);
- free_command_lines (b->commands);
- b->commands = l;
- return;
- }
- error ("No breakpoint number %d.", bnum);
-}
-
-/* Called from command loop to execute the commands
- associated with the breakpoint we just stopped at. */
-
-void
-do_breakpoint_commands ()
-{
- struct command_line *cmd;
-
- while (cmd = breakpoint_commands)
- {
- breakpoint_commands = 0;
- execute_command_lines(cmd);
- /* If command was "cont", breakpoint_commands is now 0,
- of if we stopped at yet another breakpoint which has commands,
- it is now the commands for the new breakpoint. */
- }
- clear_momentary_breakpoints ();
-}
-
-/* Used when the program is proceeded, to eliminate any remaining
- commands attached to the previous breakpoint we stopped at. */
-
-void
-clear_breakpoint_commands ()
-{
- breakpoint_commands = 0;
- breakpoint_auto_delete (0);
-}
-
-/* Functions to get and set the current list of pending
- breakpoint commands. These are used by run_stack_dummy
- to preserve the commands around a function call. */
-
-struct command_line *
-get_breakpoint_commands ()
-{
- return breakpoint_commands;
-}
-
-void
-set_breakpoint_commands (cmds)
- struct command_line *cmds;
-{
- breakpoint_commands = cmds;
-}
-
-/* insert_breakpoints is used when starting or continuing the program.
- remove_breakpoints is used when the program stops.
- Both return zero if successful,
- or an `errno' value if could not write the inferior. */
-
-int
-insert_breakpoints ()
-{
- register struct breakpoint *b;
- int val;
-
-#ifdef BREAKPOINT_DEBUG
- printf ("Inserting breakpoints.\n");
-#endif /* BREAKPOINT_DEBUG */
-
- ALL_BREAKPOINTS (b)
- if (b->enable != disabled && ! b->inserted && ! b->duplicate)
- {
- read_memory (b->address, b->shadow_contents, sizeof break_insn);
- val = write_memory (b->address, break_insn, sizeof break_insn);
- if (val)
- return val;
-#ifdef BREAKPOINT_DEBUG
- printf ("Inserted breakpoint at 0x%x, shadow 0x%x, 0x%x.\n",
- b->address, b->shadow_contents[0], b->shadow_contents[1]);
-#endif /* BREAKPOINT_DEBUG */
- b->inserted = 1;
- }
- return 0;
-}
-
-int
-remove_breakpoints ()
-{
- register struct breakpoint *b;
- int val;
-
-#ifdef BREAKPOINT_DEBUG
- printf ("Removing breakpoints.\n");
-#endif /* BREAKPOINT_DEBUG */
-
- ALL_BREAKPOINTS (b)
- if (b->inserted)
- {
- val = write_memory (b->address, b->shadow_contents, sizeof break_insn);
- if (val)
- return val;
- b->inserted = 0;
-#ifdef BREAKPOINT_DEBUG
- printf ("Removed breakpoint at 0x%x, shadow 0x%x, 0x%x.\n",
- b->address, b->shadow_contents[0], b->shadow_contents[1]);
-#endif /* BREAKPOINT_DEBUG */
- }
-
- return 0;
-}
-
-/* Clear the "inserted" flag in all breakpoints.
- This is done when the inferior is loaded. */
-
-void
-mark_breakpoints_out ()
-{
- register struct breakpoint *b;
-
- ALL_BREAKPOINTS (b)
- b->inserted = 0;
-}
-
-/* breakpoint_here_p (PC) returns 1 if an enabled breakpoint exists at PC.
- When continuing from a location with a breakpoint,
- we actually single step once before calling insert_breakpoints. */
-
-int
-breakpoint_here_p (pc)
- CORE_ADDR pc;
-{
- register struct breakpoint *b;
-
- ALL_BREAKPOINTS (b)
- if (b->enable != disabled && b->address == pc)
- return 1;
-
- return 0;
-}
-
-/* Evaluate the expression EXP and return 1 if value is zero.
- This is used inside a catch_errors to evaluate the breakpoint condition. */
-
-int
-breakpoint_cond_eval (exp)
- struct expression *exp;
-{
- return value_zerop (evaluate_expression (exp));
-}
-
-/* Return 0 if PC is not the address just after a breakpoint,
- or -1 if breakpoint says do not stop now,
- or -2 if breakpoint says it has deleted itself and don't stop,
- or -3 if hit a breakpoint number -3 (delete when program stops),
- or else the number of the breakpoint,
- with 0x1000000 added (or subtracted, for a negative return value) for
- a silent breakpoint. */
-
-int
-breakpoint_stop_status (pc, frame_address)
- CORE_ADDR pc;
- FRAME_ADDR frame_address;
-{
- register struct breakpoint *b;
- register int cont = 0;
-
- /* Get the address where the breakpoint would have been. */
- pc -= DECR_PC_AFTER_BREAK;
-
- ALL_BREAKPOINTS (b)
- if (b->enable != disabled && b->address == pc)
- {
- if (b->frame && b->frame != frame_address)
- cont = -1;
- else
- {
- int value_zero;
- if (b->cond)
- {
- /* Need to select the frame, with all that implies
- so that the conditions will have the right context. */
- select_frame (get_current_frame (), 0);
- value_zero
- = catch_errors (breakpoint_cond_eval, b->cond,
- "Error occurred in testing breakpoint condition.");
- free_all_values ();
- }
- if (b->cond && value_zero)
- {
- cont = -1;
- }
- else if (b->ignore_count > 0)
- {
- b->ignore_count--;
- cont = -1;
- }
- else
- {
- if (b->enable == temporary)
- b->enable = disabled;
- breakpoint_commands = b->commands;
- if (b->silent
- || (breakpoint_commands
- && !strcmp ("silent", breakpoint_commands->line)))
- {
- if (breakpoint_commands)
- breakpoint_commands = breakpoint_commands->next;
- return (b->number > 0 ?
- 0x1000000 + b->number :
- b->number - 0x1000000);
- }
- return b->number;
- }
- }
- }
-
- return cont;
-}
-
-static void
-breakpoint_1 (bnum)
- int bnum;
-{
- register struct breakpoint *b;
- register struct command_line *l;
- register struct symbol *sym;
- CORE_ADDR last_addr = (CORE_ADDR)-1;
-
- ALL_BREAKPOINTS (b)
- if (bnum == -1 || bnum == b->number)
- {
- printf_filtered ("#%-3d %c 0x%08x", b->number,
- "nyod"[(int) b->enable],
- b->address);
- last_addr = b->address;
- if (b->symtab)
- {
- sym = find_pc_function (b->address);
- if (sym)
- {
- fputs_filtered (" in ", stdout);
- fputs_demangled (SYMBOL_NAME (sym), stdout, 1);
- fputs_filtered (" (", stdout);
- }
- fputs_filtered (b->symtab->filename, stdout);
- printf_filtered (" line %d", b->line_number);
- if (sym) fputs_filtered(")", stdout);
- }
- else
- print_address_symbolic (b->address, stdout);
-
- printf_filtered ("\n");
-
- if (b->ignore_count)
- printf_filtered ("\tignore next %d hits\n", b->ignore_count);
- if (b->frame)
- printf_filtered ("\tstop only in stack frame at 0x%x\n", b->frame);
- if (b->cond)
- {
- printf_filtered ("\tbreak only if ");
- print_expression (b->cond, stdout);
- printf_filtered ("\n");
- }
- if (l = b->commands)
- while (l)
- {
- printf_filtered ("\t%s\n", l->line);
- l = l->next;
- }
- }
-
- /* Compare against (CORE_ADDR)-1 in case some compiler decides
- that a comparison of an unsigned with -1 is always false. */
- if (last_addr != (CORE_ADDR)-1)
- set_next_address (last_addr);
-}
-
-static void
-breakpoints_info (bnum_exp)
- char *bnum_exp;
-{
- int bnum = -1;
-
- if (bnum_exp)
- bnum = parse_and_eval_address (bnum_exp);
- else if (breakpoint_chain == 0)
- printf_filtered ("No breakpoints.\n");
- else
- printf_filtered ("Breakpoints:\n\
-Num Enb Address Where\n");
-
- breakpoint_1 (bnum);
-}
-
-/* Print a message describing any breakpoints set at PC. */
-
-static void
-describe_other_breakpoints (pc)
- register CORE_ADDR pc;
-{
- register int others = 0;
- register struct breakpoint *b;
-
- ALL_BREAKPOINTS (b)
- if (b->address == pc)
- others++;
- if (others > 0)
- {
- printf ("Note: breakpoint%s ", (others > 1) ? "s" : "");
- ALL_BREAKPOINTS (b)
- if (b->address == pc)
- {
- others--;
- printf ("%d%s%s ",
- b->number,
- (b->enable == disabled) ? " (disabled)" : "",
- (others > 1) ? "," : ((others == 1) ? " and" : ""));
- }
- printf ("also set at pc 0x%x.\n", pc);
- }
-}
-
-/* Set the default place to put a breakpoint
- for the `break' command with no arguments. */
-
-void
-set_default_breakpoint (valid, addr, symtab, line)
- int valid;
- CORE_ADDR addr;
- struct symtab *symtab;
- int line;
-{
- default_breakpoint_valid = valid;
- default_breakpoint_address = addr;
- default_breakpoint_symtab = symtab;
- default_breakpoint_line = line;
-}
-
-/* Rescan breakpoints at address ADDRESS,
- marking the first one as "first" and any others as "duplicates".
- This is so that the bpt instruction is only inserted once. */
-
-static void
-check_duplicates (address)
- CORE_ADDR address;
-{
- register struct breakpoint *b;
- register int count = 0;
-
- ALL_BREAKPOINTS (b)
- if (b->enable != disabled && b->address == address)
- {
- count++;
- b->duplicate = count > 1;
- }
-}
-
-/* Low level routine to set a breakpoint.
- Takes as args the three things that every breakpoint must have.
- Returns the breakpoint object so caller can set other things.
- Does not set the breakpoint number!
- Does not print anything. */
-
-static struct breakpoint *
-set_raw_breakpoint (sal)
- struct symtab_and_line sal;
-{
- register struct breakpoint *b, *b1;
-
- b = (struct breakpoint *) xmalloc (sizeof (struct breakpoint));
- bzero (b, sizeof *b);
- b->address = sal.pc;
- b->symtab = sal.symtab;
- b->line_number = sal.line;
- b->enable = enabled;
- b->next = 0;
- b->silent = 0;
-
- /* Add this breakpoint to the end of the chain
- so that a list of breakpoints will come out in order
- of increasing numbers. */
-
- b1 = breakpoint_chain;
- if (b1 == 0)
- breakpoint_chain = b;
- else
- {
- while (b1->next)
- b1 = b1->next;
- b1->next = b;
- }
-
- check_duplicates (sal.pc);
-
- return b;
-}
-
-/* Set a breakpoint that will evaporate an end of command
- at address specified by SAL.
- Restrict it to frame FRAME if FRAME is nonzero. */
-
-void
-set_momentary_breakpoint (sal, frame)
- struct symtab_and_line sal;
- FRAME frame;
-{
- register struct breakpoint *b;
- b = set_raw_breakpoint (sal);
- b->number = -3;
- b->enable = delete;
- b->frame = (frame ? FRAME_FP (frame) : 0);
-}
-
-void
-clear_momentary_breakpoints ()
-{
- register struct breakpoint *b;
- ALL_BREAKPOINTS (b)
- if (b->number == -3)
- {
- delete_breakpoint (b);
- break;
- }
-}
-
-/* Set a breakpoint from a symtab and line.
- If TEMPFLAG is nonzero, it is a temporary breakpoint.
- Print the same confirmation messages that the breakpoint command prints. */
-
-void
-set_breakpoint (s, line, tempflag)
- struct symtab *s;
- int line;
- int tempflag;
-{
- register struct breakpoint *b;
- struct symtab_and_line sal;
-
- sal.symtab = s;
- sal.line = line;
- sal.pc = find_line_pc (sal.symtab, sal.line);
- if (sal.pc == 0)
- error ("No line %d in file \"%s\".\n", sal.line, sal.symtab->filename);
- else
- {
- describe_other_breakpoints (sal.pc);
-
- b = set_raw_breakpoint (sal);
- b->number = ++breakpoint_count;
- b->cond = 0;
- if (tempflag)
- b->enable = temporary;
-
- printf ("Breakpoint %d at 0x%x", b->number, b->address);
- if (b->symtab)
- printf (": file %s, line %d.", b->symtab->filename, b->line_number);
- printf ("\n");
- }
-}
-
-/* Set a breakpoint according to ARG (function, linenum or *address)
- and make it temporary if TEMPFLAG is nonzero. */
-
-static void
-break_command_1 (arg, tempflag, from_tty)
- char *arg;
- int tempflag, from_tty;
-{
- struct symtabs_and_lines sals;
- struct symtab_and_line sal;
- register struct expression *cond = 0;
- register struct breakpoint *b;
- char *save_arg;
- int i;
- CORE_ADDR pc;
-
- sals.sals = NULL;
- sals.nelts = 0;
-
- sal.line = sal.pc = sal.end = 0;
- sal.symtab = 0;
-
- /* If no arg given, or if first arg is 'if ', use the default breakpoint. */
-
- if (!arg || (arg[0] == 'i' && arg[1] == 'f'
- && (arg[2] == ' ' || arg[2] == '\t')))
- {
- if (default_breakpoint_valid)
- {
- sals.sals = (struct symtab_and_line *)
- malloc (sizeof (struct symtab_and_line));
- sal.pc = default_breakpoint_address;
- sal.line = default_breakpoint_line;
- sal.symtab = default_breakpoint_symtab;
- sals.sals[0] = sal;
- sals.nelts = 1;
- }
- else
- error ("No default breakpoint address now.");
- }
- else
- /* Force almost all breakpoints to be in terms of the
- current_source_symtab (which is decode_line_1's default). This
- should produce the results we want almost all of the time while
- leaving default_breakpoint_* alone. */
- if (default_breakpoint_valid
- && (!current_source_symtab
- || (arg && (*arg == '+' || *arg == '-'))))
- sals = decode_line_1 (&arg, 1, default_breakpoint_symtab,
- default_breakpoint_line);
- else
- sals = decode_line_1 (&arg, 1, 0, 0);
-
- if (! sals.nelts)
- return;
-
- save_arg = arg;
- for (i = 0; i < sals.nelts; i++)
- {
- sal = sals.sals[i];
- if (sal.pc == 0 && sal.symtab != 0)
- {
- pc = find_line_pc (sal.symtab, sal.line);
- if (pc == 0)
- error ("No line %d in file \"%s\".",
- sal.line, sal.symtab->filename);
- }
- else
- pc = sal.pc;
-
- while (arg && *arg)
- {
- if (arg[0] == 'i' && arg[1] == 'f'
- && (arg[2] == ' ' || arg[2] == '\t'))
- cond = (struct expression *) parse_c_1 ((arg += 2, &arg),
- block_for_pc (pc), 0);
- else
- error ("Junk at end of arguments.");
- }
- arg = save_arg;
- sals.sals[i].pc = pc;
- }
-
- for (i = 0; i < sals.nelts; i++)
- {
- sal = sals.sals[i];
-
- if (from_tty)
- describe_other_breakpoints (sal.pc);
-
- b = set_raw_breakpoint (sal);
- b->number = ++breakpoint_count;
- b->cond = cond;
- if (tempflag)
- b->enable = temporary;
-
- printf ("Breakpoint %d at 0x%x", b->number, b->address);
- if (b->symtab)
- printf (": file %s, line %d.", b->symtab->filename, b->line_number);
- printf ("\n");
- }
-
- if (sals.nelts > 1)
- {
- printf ("Multiple breakpoints were set.\n");
- printf ("Use the \"delete\" command to delete unwanted breakpoints.\n");
- }
- free (sals.sals);
-}
-
-static void
-break_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- break_command_1 (arg, 0, from_tty);
-}
-
-static void
-tbreak_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- break_command_1 (arg, 1, from_tty);
-}
-
-/*
- * Helper routine for the until_command routine in infcmd.c. Here
- * because it uses the mechanisms of breakpoints.
- */
-void
-until_break_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- struct symtabs_and_lines sals;
- struct symtab_and_line sal;
- FRAME prev_frame = get_prev_frame (selected_frame);
-
- clear_proceed_status ();
-
- /* Set a breakpoint where the user wants it and at return from
- this function */
-
- if (default_breakpoint_valid)
- sals = decode_line_1 (&arg, 1, default_breakpoint_symtab,
- default_breakpoint_line);
- else
- sals = decode_line_1 (&arg, 1, 0, 0);
-
- if (sals.nelts != 1)
- error ("Couldn't get information on specified line.");
-
- sal = sals.sals[0];
- free (sals.sals); /* malloc'd, so freed */
-
- if (*arg)
- error ("Junk at end of arguments.");
-
- if (sal.pc == 0 && sal.symtab != 0)
- sal.pc = find_line_pc (sal.symtab, sal.line);
-
- if (sal.pc == 0)
- error ("No line %d in file \"%s\".", sal.line, sal.symtab->filename);
-
- set_momentary_breakpoint (sal, selected_frame);
-
- /* Keep within the current frame */
-
- if (prev_frame)
- {
- struct frame_info *fi;
-
- fi = get_frame_info (prev_frame);
- sal = find_pc_line (fi->pc, 0);
- sal.pc = fi->pc;
- set_momentary_breakpoint (sal, prev_frame);
- }
-
- proceed (-1, -1, 0);
-}
-
-static void
-clear_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- register struct breakpoint *b, *b1;
- struct symtabs_and_lines sals;
- struct symtab_and_line sal;
- register struct breakpoint *found;
- int i;
-
- if (arg)
- {
- sals = decode_line_spec (arg, 1);
- }
- else
- {
- sals.sals = (struct symtab_and_line *) malloc (sizeof (struct symtab_and_line));
- sal.line = default_breakpoint_line;
- sal.symtab = default_breakpoint_symtab;
- sal.pc = 0;
- if (sal.symtab == 0)
- error ("No source file specified.");
-
- sals.sals[0] = sal;
- sals.nelts = 1;
- }
-
- for (i = 0; i < sals.nelts; i++)
- {
- /* If exact pc given, clear bpts at that pc.
- But if sal.pc is zero, clear all bpts on specified line. */
- sal = sals.sals[i];
- found = (struct breakpoint *) 0;
- while (breakpoint_chain
- && (sal.pc ? breakpoint_chain->address == sal.pc
- : (breakpoint_chain->symtab == sal.symtab
- && breakpoint_chain->line_number == sal.line)))
- {
- b1 = breakpoint_chain;
- breakpoint_chain = b1->next;
- b1->next = found;
- found = b1;
- }
-
- ALL_BREAKPOINTS (b)
- while (b->next
- && (sal.pc ? b->next->address == sal.pc
- : (b->next->symtab == sal.symtab
- && b->next->line_number == sal.line)))
- {
- b1 = b->next;
- b->next = b1->next;
- b1->next = found;
- found = b1;
- }
-
- if (found == 0)
- error ("No breakpoint at %s.", arg);
-
- if (found->next) from_tty = 1; /* Always report if deleted more than one */
- if (from_tty) printf ("Deleted breakpoint%s ", found->next ? "s" : "");
- while (found)
- {
- if (from_tty) printf ("%d ", found->number);
- b1 = found->next;
- delete_breakpoint (found);
- found = b1;
- }
- if (from_tty) putchar ('\n');
- }
- free (sals.sals);
-}
-
-/* Delete breakpoint number BNUM if it is a `delete' breakpoint.
- This is called after breakpoint BNUM has been hit.
- Also delete any breakpoint numbered -3 unless there are breakpoint
- commands to be executed. */
-
-void
-breakpoint_auto_delete (bnum)
- int bnum;
-{
- register struct breakpoint *b;
- if (bnum != 0)
- ALL_BREAKPOINTS (b)
- if (b->number == bnum)
- {
- if (b->enable == delete)
- delete_breakpoint (b);
- break;
- }
- if (breakpoint_commands == 0)
- clear_momentary_breakpoints ();
-}
-
-static void
-delete_breakpoint (bpt)
- struct breakpoint *bpt;
-{
- register struct breakpoint *b;
-
- if (bpt->inserted)
- write_memory (bpt->address, bpt->shadow_contents, sizeof break_insn);
-
- if (breakpoint_chain == bpt)
- breakpoint_chain = bpt->next;
-
- ALL_BREAKPOINTS (b)
- if (b->next == bpt)
- {
- b->next = bpt->next;
- break;
- }
-
- check_duplicates (bpt->address);
-
- free_command_lines (bpt->commands);
- if (bpt->cond)
- free (bpt->cond);
-
- if (xgdb_verbose && bpt->number >=0)
- printf ("breakpoint #%d deleted\n", bpt->number);
-
- free (bpt);
-}
-
-static void map_breakpoint_numbers ();
-
-static void
-delete_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- register struct breakpoint *b, *b1;
-
- if (arg == 0)
- {
- /* Ask user only if there are some breakpoints to delete. */
- if (!from_tty
- || breakpoint_chain && query ("Delete all breakpoints? "))
- {
- /* No arg; clear all breakpoints. */
- while (breakpoint_chain)
- delete_breakpoint (breakpoint_chain);
- }
- }
- else
- map_breakpoint_numbers (arg, delete_breakpoint);
-}
-
-/* Delete all breakpoints.
- Done when new symtabs are loaded, since the break condition expressions
- may become invalid, and the breakpoints are probably wrong anyway. */
-
-void
-clear_breakpoints ()
-{
- delete_command (0, 0);
-}
-
-/* Set ignore-count of breakpoint number BPTNUM to COUNT.
- If from_tty is nonzero, it prints a message to that effect,
- which ends with a period (no newline). */
-
-void
-set_ignore_count (bptnum, count, from_tty)
- int bptnum, count, from_tty;
-{
- register struct breakpoint *b;
-
- if (count < 0)
- count = 0;
-
- ALL_BREAKPOINTS (b)
- if (b->number == bptnum)
- {
- b->ignore_count = count;
- if (!from_tty)
- return;
- else if (count == 0)
- printf ("Will stop next time breakpoint %d is reached.", bptnum);
- else if (count == 1)
- printf ("Will ignore next crossing of breakpoint %d.", bptnum);
- else
- printf ("Will ignore next %d crossings of breakpoint %d.",
- count, bptnum);
- return;
- }
-
- error ("No breakpoint number %d.", bptnum);
-}
-
-/* Clear the ignore counts of all breakpoints. */
-void
-breakpoint_clear_ignore_counts ()
-{
- struct breakpoint *b;
-
- ALL_BREAKPOINTS (b)
- b->ignore_count = 0;
-}
-
-/* Command to set ignore-count of breakpoint N to COUNT. */
-
-static void
-ignore_command (args, from_tty)
- char *args;
- int from_tty;
-{
- register char *p = args;
- register int num;
-
- if (p == 0)
- error_no_arg ("a breakpoint number");
-
- while (*p >= '0' && *p <= '9') p++;
- if (*p && *p != ' ' && *p != '\t')
- error ("First argument must be a breakpoint number.");
-
- num = atoi (args);
-
- if (*p == 0)
- error ("Second argument (specified ignore-count) is missing.");
-
- set_ignore_count (num, parse_and_eval_address (p), from_tty);
- printf ("\n");
-}
-
-/* Call FUNCTION on each of the breakpoints
- whose numbers are given in ARGS. */
-
-static void
-map_breakpoint_numbers (args, function)
- char *args;
- void (*function) ();
-{
- register char *p = args;
- register char *p1;
- register int num;
- register struct breakpoint *b;
-
- if (p == 0)
- error_no_arg ("one or more breakpoint numbers");
-
- while (*p)
- {
- p1 = p;
- while (*p1 >= '0' && *p1 <= '9') p1++;
- if (*p1 && *p1 != ' ' && *p1 != '\t')
- error ("Arguments must be breakpoint numbers.");
-
- num = atoi (p);
-
- ALL_BREAKPOINTS (b)
- if (b->number == num)
- {
- function (b);
- goto win;
- }
- printf ("No breakpoint number %d.\n", num);
- win:
- p = p1;
- while (*p == ' ' || *p == '\t') p++;
- }
-}
-
-static void
-enable_breakpoint (bpt)
- struct breakpoint *bpt;
-{
- bpt->enable = enabled;
-
- if (xgdb_verbose && bpt->number >= 0)
- printf ("breakpoint #%d enabled\n", bpt->number);
-
- check_duplicates (bpt->address);
-}
-
-static void
-enable_command (args)
- char *args;
-{
- struct breakpoint *bpt;
- if (args == 0)
- ALL_BREAKPOINTS (bpt)
- enable_breakpoint (bpt);
- else
- map_breakpoint_numbers (args, enable_breakpoint);
-}
-
-static void
-disable_breakpoint (bpt)
- struct breakpoint *bpt;
-{
- bpt->enable = disabled;
-
- if (xgdb_verbose && bpt->number >= 0)
- printf ("breakpoint #%d disabled\n", bpt->number);
-
- check_duplicates (bpt->address);
-}
-
-static void
-disable_command (args)
- char *args;
-{
- register struct breakpoint *bpt;
- if (args == 0)
- ALL_BREAKPOINTS (bpt)
- disable_breakpoint (bpt);
- else
- map_breakpoint_numbers (args, disable_breakpoint);
-}
-
-static void
-enable_once_breakpoint (bpt)
- struct breakpoint *bpt;
-{
- bpt->enable = temporary;
-
- check_duplicates (bpt->address);
-}
-
-static void
-enable_once_command (args)
- char *args;
-{
- map_breakpoint_numbers (args, enable_once_breakpoint);
-}
-
-static void
-enable_delete_breakpoint (bpt)
- struct breakpoint *bpt;
-{
- bpt->enable = delete;
-
- check_duplicates (bpt->address);
-}
-
-static void
-enable_delete_command (args)
- char *args;
-{
- map_breakpoint_numbers (args, enable_delete_breakpoint);
-}
-
-/*
- * Use default_breakpoint_'s, or nothing if they aren't valid.
- */
-struct symtabs_and_lines
-decode_line_spec_1 (string, funfirstline)
- char *string;
- int funfirstline;
-{
- struct symtabs_and_lines sals;
- if (string == 0)
- error ("Empty line specification.");
- if (default_breakpoint_valid)
- sals = decode_line_1 (&string, funfirstline,
- default_breakpoint_symtab, default_breakpoint_line);
- else
- sals = decode_line_1 (&string, funfirstline, 0, 0);
- if (*string)
- error ("Junk at end of line specification: %s", string);
- return sals;
-}
-
-
-/* Chain containing all defined enable commands. */
-
-extern struct cmd_list_element
- *enablelist, *disablelist,
- *deletelist, *enablebreaklist;
-
-extern struct cmd_list_element *cmdlist;
-
-void
-_initialize_breakpoint ()
-{
- breakpoint_chain = 0;
- breakpoint_count = 0;
-
- add_com ("ignore", class_breakpoint, ignore_command,
- "Set ignore-count of breakpoint number N to COUNT.");
-
- add_com ("commands", class_breakpoint, commands_command,
- "Set commands to be executed when a breakpoint is hit.\n\
-Give breakpoint number as argument after \"commands\".\n\
-With no argument, the targeted breakpoint is the last one set.\n\
-The commands themselves follow starting on the next line.\n\
-Type a line containing \"end\" to indicate the end of them.\n\
-Give \"silent\" as the first line to make the breakpoint silent;\n\
-then no output is printed when it is hit, except what the commands print.");
-
- add_com ("condition", class_breakpoint, condition_command,
- "Specify breakpoint number N to break only if COND is true.\n\
-N is an integer; COND is a C expression to be evaluated whenever\n\
-breakpoint N is reached. Actually break only when COND is nonzero.");
-
- add_com ("tbreak", class_breakpoint, tbreak_command,
- "Set a temporary breakpoint. Args like \"break\" command.\n\
-Like \"break\" except the breakpoint is only enabled temporarily,\n\
-so it will be disabled when hit. Equivalent to \"break\" followed\n\
-by using \"enable once\" on the breakpoint number.");
-
- add_prefix_cmd ("enable", class_breakpoint, enable_command,
- "Enable some breakpoints or auto-display expressions.\n\
-Give breakpoint numbers (separated by spaces) as arguments.\n\
-With no subcommand, breakpoints are enabled until you command otherwise.\n\
-This is used to cancel the effect of the \"disable\" command.\n\
-With a subcommand you can enable temporarily.\n\
-\n\
-The \"display\" subcommand applies to auto-displays instead of breakpoints.",
- &enablelist, "enable ", 1, &cmdlist);
-
- add_abbrev_prefix_cmd ("breakpoints", class_breakpoint, enable_command,
- "Enable some breakpoints or auto-display expressions.\n\
-Give breakpoint numbers (separated by spaces) as arguments.\n\
-With no subcommand, breakpoints are enabled until you command otherwise.\n\
-This is used to cancel the effect of the \"disable\" command.\n\
-May be abbreviates to simply \"enable\".\n\
-With a subcommand you can enable temporarily.",
- &enablebreaklist, "enable breakpoints ", 1, &enablelist);
-
- add_cmd ("once", no_class, enable_once_command,
- "Enable breakpoints for one hit. Give breakpoint numbers.\n\
-If a breakpoint is hit while enabled in this fashion, it becomes disabled.\n\
-See the \"tbreak\" command which sets a breakpoint and enables it once.",
- &enablebreaklist);
-
- add_cmd ("delete", no_class, enable_delete_command,
- "Enable breakpoints and delete when hit. Give breakpoint numbers.\n\
-If a breakpoint is hit while enabled in this fashion, it is deleted.",
- &enablebreaklist);
-
- add_cmd ("delete", no_class, enable_delete_command,
- "Enable breakpoints and delete when hit. Give breakpoint numbers.\n\
-If a breakpoint is hit while enabled in this fashion, it is deleted.",
- &enablelist);
-
- add_cmd ("once", no_class, enable_once_command,
- "Enable breakpoints for one hit. Give breakpoint numbers.\n\
-If a breakpoint is hit while enabled in this fashion, it becomes disabled.\n\
-See the \"tbreak\" command which sets a breakpoint and enables it once.",
- &enablelist);
-
- add_prefix_cmd ("disable", class_breakpoint, disable_command,
- "Disable some breakpoints or auto-display expressions.\n\
-Arguments are breakpoint numbers with spaces in between.\n\
-To disable all breakpoints, give no argument.\n\
-A disabled breakpoint is not forgotten, but has no effect until reenabled.\n\
-\n\
-The \"display\" subcommand applies to auto-displays instead of breakpoints.",
- &disablelist, "disable ", 1, &cmdlist);
- add_com_alias ("dis", "disable", class_breakpoint, 1);
- add_com_alias ("disa", "disable", class_breakpoint, 1);
-
- add_abbrev_cmd ("breakpoints", class_breakpoint, disable_command,
- "Disable some breakpoints or auto-display expressions.\n\
-Arguments are breakpoint numbers with spaces in between.\n\
-To disable all breakpoints, give no argument.\n\
-A disabled breakpoint is not forgotten, but has no effect until reenabled.\n\
-This command may be abbreviated \"disable\".",
- &disablelist);
-
- add_prefix_cmd ("delete", class_breakpoint, delete_command,
- "Delete some breakpoints or auto-display expressions.\n\
-Arguments are breakpoint numbers with spaces in between.\n\
-To delete all breakpoints, give no argument.\n\
-\n\
-Also a prefix command for deletion of other GDB objects.\n\
-The \"unset\" command is also an alias for \"delete\".",
- &deletelist, "delete ", 1, &cmdlist);
- add_com_alias ("d", "delete", class_breakpoint, 1);
- add_com_alias ("unset", "delete", class_alias, 1);
-
- add_cmd ("breakpoints", class_alias, delete_command,
- "Delete some breakpoints or auto-display expressions.\n\
-Arguments are breakpoint numbers with spaces in between.\n\
-To delete all breakpoints, give no argument.\n\
-This command may be abbreviated \"delete\".",
- &deletelist);
-
- add_com ("clear", class_breakpoint, clear_command,
- "Clear breakpoint at specified line or function.\n\
-Argument may be line number, function name, or \"*\" and an address.\n\
-If line number is specified, all breakpoints in that line are cleared.\n\
-If function is specified, breakpoints at beginning of function are cleared.\n\
-If an address is specified, breakpoints at that address are cleared.\n\n\
-With no argument, clears all breakpoints in the line that the selected frame\n\
-is executing in.\n\
-\n\
-See also the \"delete\" command which clears breakpoints by number.");
-
- add_com ("break", class_breakpoint, break_command,
- "Set breakpoint at specified line or function.\n\
-Argument may be line number, function name, or \"*\" and an address.\n\
-If line number is specified, break at start of code for that line.\n\
-If function is specified, break at start of code for that function.\n\
-If an address is specified, break at that exact address.\n\
-With no arg, uses current execution address of selected stack frame.\n\
-This is useful for breaking on return to a stack frame.\n\
-\n\
-Multiple breakpoints at one place are permitted, and useful if conditional.\n\
-\n\
-Do \"help breakpoints\" for info on other commands dealing with breakpoints.");
- add_com_alias ("b", "break", class_run, 1);
- add_com_alias ("br", "break", class_run, 1);
- add_com_alias ("bre", "break", class_run, 1);
- add_com_alias ("brea", "break", class_run, 1);
-
- add_info ("breakpoints", breakpoints_info,
- "Status of all breakpoints, or breakpoint number NUMBER.\n\
-Second column is \"y\" for enabled breakpoint, \"n\" for disabled,\n\
-\"o\" for enabled once (disable when hit), \"d\" for enable but delete when hit.\n\
-Then come the address and the file/line number.\n\n\
-Convenience variable \"$_\" and default examine address for \"x\"\n\
-are set to the address of the last breakpoint listed.");
-}
-
diff --git a/gnu/usr.bin/gdb/command.c b/gnu/usr.bin/gdb/command.c
deleted file mode 100644
index 79daea4..0000000
--- a/gnu/usr.bin/gdb/command.c
+++ /dev/null
@@ -1,856 +0,0 @@
-/* Library for reading command lines and decoding commands.
- Copyright (C) 1986, 1989 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. */
-
-#include "command.h"
-#include "defs.h"
-#include <stdio.h>
-#include <ctype.h>
-
-extern char *xmalloc ();
-
-/* Add element named NAME to command list *LIST.
- FUN should be the function to execute the command;
- it will get a character string as argument, with leading
- and trailing blanks already eliminated.
-
- DOC is a documentation string for the command.
- Its first line should be a complete sentence.
- It should start with ? for a command that is an abbreviation
- or with * for a command that most users don't need to know about. */
-
-struct cmd_list_element *
-add_cmd (name, class, fun, doc, list)
- char *name;
- int class;
- void (*fun) ();
- char *doc;
- struct cmd_list_element **list;
-{
- register struct cmd_list_element *c
- = (struct cmd_list_element *) xmalloc (sizeof (struct cmd_list_element));
-
- delete_cmd (name, list);
- c->next = *list;
- c->name = savestring (name, strlen (name));
- c->class = class;
- c->function = fun;
- c->doc = doc;
- c->prefixlist = 0;
- c->allow_unknown = 0;
- c->abbrev_flag = 0;
- c->aux = 0;
- *list = c;
- return c;
-}
-
-/* Same as above, except that the abbrev_flag is set. */
-
-struct cmd_list_element *
-add_abbrev_cmd (name, class, fun, doc, list)
- char *name;
- int class;
- void (*fun) ();
- char *doc;
- struct cmd_list_element **list;
-{
- register struct cmd_list_element *c
- = (struct cmd_list_element *) xmalloc (sizeof (struct cmd_list_element));
-
- delete_cmd (name, list);
- c->next = *list;
- c->name = savestring (name, strlen (name));
- c->class = class;
- c->function = fun;
- c->doc = doc;
- c->prefixlist = 0;
- c->allow_unknown = 0;
- c->abbrev_flag = 1;
- c->aux = 0;
- *list = c;
- return c;
-}
-
-struct cmd_list_element *
-add_alias_cmd (name, oldname, class, abbrev_flag, list)
- char *name;
- char *oldname;
- int class;
- int abbrev_flag;
- struct cmd_list_element **list;
-{
- /* Must do this since lookup_cmd tries to side-effect its first arg */
- char *copied_name;
- register struct cmd_list_element *old;
- register struct cmd_list_element *c;
- copied_name = (char *) alloca (strlen (oldname) + 1);
- strcpy (copied_name, oldname);
- old = lookup_cmd (&copied_name, *list, 0, 1, 1);
-
- if (old == 0)
- {
- delete_cmd (name, list);
- return 0;
- }
-
- c = add_cmd (name, class, old->function, old->doc, list);
- c->prefixlist = old->prefixlist;
- c->prefixname = old->prefixname;
- c->allow_unknown = old->allow_unknown;
- c->abbrev_flag = abbrev_flag;
- c->aux = old->aux;
- return c;
-}
-
-/* Like add_cmd but adds an element for a command prefix:
- a name that should be followed by a subcommand to be looked up
- in another command list. PREFIXLIST should be the address
- of the variable containing that list. */
-
-struct cmd_list_element *
-add_prefix_cmd (name, class, fun, doc, prefixlist, prefixname,
- allow_unknown, list)
- char *name;
- int class;
- void (*fun) ();
- char *doc;
- struct cmd_list_element **prefixlist;
- char *prefixname;
- int allow_unknown;
- struct cmd_list_element **list;
-{
- register struct cmd_list_element *c = add_cmd (name, class, fun, doc, list);
- c->prefixlist = prefixlist;
- c->prefixname = prefixname;
- c->allow_unknown = allow_unknown;
- return c;
-}
-
-/* Like add_prefix_cmd butsets the abbrev_flag on the new command. */
-
-struct cmd_list_element *
-add_abbrev_prefix_cmd (name, class, fun, doc, prefixlist, prefixname,
- allow_unknown, list)
- char *name;
- int class;
- void (*fun) ();
- char *doc;
- struct cmd_list_element **prefixlist;
- char *prefixname;
- int allow_unknown;
- struct cmd_list_element **list;
-{
- register struct cmd_list_element *c = add_cmd (name, class, fun, doc, list);
- c->prefixlist = prefixlist;
- c->prefixname = prefixname;
- c->allow_unknown = allow_unknown;
- c->abbrev_flag = 1;
- return c;
-}
-
-/* Remove the command named NAME from the command list. */
-
-void
-delete_cmd (name, list)
- char *name;
- struct cmd_list_element **list;
-{
- register struct cmd_list_element *c;
-
- while (*list && !strcmp ((*list)->name, name))
- {
- *list = (*list)->next;
- }
-
- if (*list)
- for (c = *list; c->next;)
- {
- if (!strcmp (c->next->name, name))
- c->next = c->next->next;
- else
- c = c->next;
- }
-}
-
-void help_cmd (), help_list (), help_cmd_list ();
-
-/* This command really has to deal with two things:
- * 1) I want documentation on *this string* (usually called by
- * "help commandname").
- * 2) I want documentation on *this list* (usually called by
- * giving a command that requires subcommands. Also called by saying
- * just "help".)
- *
- * I am going to split this into two seperate comamnds, help_cmd and
- * help_list.
- */
-
-void
-help_cmd (command, stream)
- char *command;
- FILE *stream;
-{
- struct cmd_list_element *c;
- extern struct cmd_list_element *cmdlist;
-
- if (!command)
- {
- help_list (cmdlist, "", -2, stream);
- return;
- }
-
- c = lookup_cmd (&command, cmdlist, "", 0, 0);
-
- if (c == 0)
- return;
-
- /* There are three cases here.
- If c->prefixlist is nonzer, we have a prefix command.
- Print its documentation, then list its subcommands.
-
- If c->function is nonzero, we really have a command.
- Print its documentation and return.
-
- If c->function is zero, we have a class name.
- Print its documentation (as if it were a command)
- and then set class to he number of this class
- so that the commands in the class will be listed. */
-
- fputs_filtered (c->doc, stream);
- fputs_filtered ("\n", stream);
-
- if (c->prefixlist == 0 && c->function != 0)
- return;
- fprintf_filtered (stream, "\n");
-
- /* If this is a prefix command, print it's subcommands */
- if (c->prefixlist)
- help_list (*c->prefixlist, c->prefixname, -1, stream);
-
- /* If this is a class name, print all of the commands in the class */
- if (c->function == 0)
- help_list (cmdlist, "", c->class, stream);
-}
-
-/*
- * Get a specific kind of help on a command list.
- *
- * LIST is the list.
- * CMDTYPE is the prefix to use in the title string.
- * CLASS is the class with which to list the nodes of this list (see
- * documentation for help_cmd_list below), As usual, -1 for
- * everything, -2 for just classes, and non-negative for only things
- * in a specific class.
- * and STREAM is the output stream on which to print things.
- * If you call this routine with a class >= 0, it recurses.
- */
-void
-help_list (list, cmdtype, class, stream)
- struct cmd_list_element *list;
- char *cmdtype;
- int class;
- FILE *stream;
-{
- int len;
- char *cmdtype1, *cmdtype2;
-
- /* If CMDTYPE is "foo ", CMDTYPE1 gets " foo" and CMDTYPE2 gets "foo sub" */
- len = strlen (cmdtype);
- cmdtype1 = (char *) alloca (len + 1);
- cmdtype1[0] = 0;
- cmdtype2 = (char *) alloca (len + 4);
- cmdtype2[0] = 0;
- if (len)
- {
- cmdtype1[0] = ' ';
- strncpy (cmdtype1 + 1, cmdtype, len - 1);
- cmdtype1[len] = 0;
- strncpy (cmdtype2, cmdtype, len - 1);
- strcpy (cmdtype2 + len - 1, " sub");
- }
-
- if (class == -2)
- fprintf_filtered (stream, "List of classes of %scommands:\n\n", cmdtype2);
- else
- fprintf_filtered (stream, "List of %scommands:\n\n", cmdtype2);
-
- help_cmd_list (list, class, cmdtype, (class >= 0), stream);
-
- if (class == -2)
- fprintf_filtered (stream, "\n\
-Type \"help%s\" followed by a class name for a list of commands in that class.",
- cmdtype1);
-
- fprintf_filtered (stream, "\n\
-Type \"help%s\" followed by %scommand name for full documentation.\n\
-Command name abbreviations are allowed if unambiguous.\n",
- cmdtype1, cmdtype2);
-}
-
-
-/*
- * Implement a help command on command list LIST.
- * RECURSE should be non-zero if this should be done recursively on
- * all sublists of LIST.
- * PREFIX is the prefix to print before each command name.
- * STREAM is the stream upon which the output should be written.
- * CLASS should be:
- * A non-negative class number to list only commands in that
- * class.
- * -1 to list all commands in list.
- * -2 to list all classes in list.
- *
- * Note that RECURSE will be active on *all* sublists, not just the
- * ones seclected by the criteria above (ie. the selection mechanism
- * is at the low level, not the high-level).
- */
-void
-help_cmd_list (list, class, prefix, recurse, stream)
- struct cmd_list_element *list;
- int class;
- char *prefix;
- int recurse;
- FILE *stream;
-{
- register struct cmd_list_element *c;
- register char *p;
- static char *line_buffer = 0;
- static int line_size;
-
- if (!line_buffer)
- {
- line_size = 80;
- line_buffer = (char *) xmalloc (line_size);
- }
-
- for (c = list; c; c = c->next)
- {
- if (c->abbrev_flag == 0 &&
- (class == -1
- || (class == -2 && c->function == 0)
- || (class == c->class && c->function != 0)))
- {
- fprintf_filtered (stream, "%s%s -- ", prefix, c->name);
- /* Print just the first line */
- p = c->doc;
- while (*p && *p != '\n') p++;
- if (p - c->doc > line_size - 1)
- {
- line_size = p - c->doc + 1;
- free (line_buffer);
- line_buffer = (char *) xmalloc (line_size);
- }
- strncpy (line_buffer, c->doc, p - c->doc);
- line_buffer[p - c->doc] = '\0';
- fputs_filtered (line_buffer, stream);
- fputs_filtered ("\n", stream);
- }
- if (recurse
- && c->prefixlist != 0
- && c->abbrev_flag == 0)
- help_cmd_list (*c->prefixlist, class, c->prefixname, 1, stream);
- }
-}
-
-/* This routine takes a line of TEXT and a CLIST in which to
- start the lookup. When it returns it will have incremented the text
- pointer past the section of text it matched, set *RESULT_LIST to
- the list in which the last word was matched, and will return the
- cmd list element which the text matches. It will return 0 if no
- match at all was possible. It will return -1 if ambigous matches are
- possible; in this case *RESULT_LIST will be set to the list in which
- there are ambiguous choices (and text will be set to the ambiguous
- text string).
-
- It does no error reporting whatsoever; control will always return
- to the superior routine.
-
- In the case of an ambiguous return (-1), *RESULT_LIST will be set to
- point at the prefix_command (ie. the best match) *or* (special
- case) will be 0 if no prefix command was ever found. For example,
- in the case of "info a", "info" matches without ambiguity, but "a"
- could be "args" or "address", so *RESULT_LIST is set to
- the cmd_list_element for "info". So in this case
- result list should not be interpeted as a pointer to the beginning
- of a list; it simply points to a specific command.
-
- This routine does *not* modify the text pointed to by TEXT.
-
- If INGNORE_HELP_CLASSES is nonzero, ignore any command list
- elements which are actually help classes rather than commands (i.e.
- the function field of the struct cmd_list_element is 0). */
-
-struct cmd_list_element *
-lookup_cmd_1 (text, clist, result_list, ignore_help_classes)
- char **text;
- struct cmd_list_element *clist, **result_list;
- int ignore_help_classes;
-{
- char *p, *command;
- int len, tmp, nfound;
- struct cmd_list_element *found, *c;
-
- while (**text == ' ' || **text == '\t')
- (*text)++;
-
- /* Treating underscores as part of command words is important
- so that "set args_foo()" doesn't get interpreted as
- "set args _foo()". */
- for (p = *text;
- *p && (isalnum(*p) || *p == '-' || *p == '_');
- p++)
- ;
-
- /* If nothing but whitespace, return 0. */
- if (p == *text)
- return 0;
-
- len = p - *text;
-
- /* *text and p now bracket the first command word to lookup (and
- it's length is len). We copy this into a local temporary,
- converting to lower case as we go. */
-
- command = (char *) alloca (len + 1);
- for (tmp = 0; tmp < len; tmp++)
- {
- char x = (*text)[tmp];
- command[tmp] = (x >= 'A' && x <= 'Z') ? x - 'A' + 'a' : x;
- }
- command[len] = '\0';
-
- /* Look it up. */
- found = 0;
- nfound = 0;
- for (c = clist; c; c = c->next)
- if (!strncmp (command, c->name, len)
- && (!ignore_help_classes || c->function))
- {
- found = c;
- nfound++;
- if (c->name[len] == '\0')
- {
- nfound = 1;
- break;
- }
- }
-
- /* If nothing matches, we have a simple failure. */
- if (nfound == 0)
- return 0;
-
- if (nfound > 1)
- {
- *result_list = 0; /* Will be modified in calling routine
- if we know what the prefix command is.
- */
- return (struct cmd_list_element *) -1; /* Ambiguous. */
- }
-
- /* We've matched something on this list. Move text pointer forward. */
-
- *text = p;
- if (found->prefixlist)
- {
- c = lookup_cmd_1 (text, *found->prefixlist, result_list,
- ignore_help_classes);
- if (!c)
- {
- /* Didn't find anything; this is as far as we got. */
- *result_list = clist;
- return found;
- }
- else if (c == (struct cmd_list_element *) -1)
- {
- /* We've gotten this far properley, but the next step
- is ambiguous. We need to set the result list to the best
- we've found (if an inferior hasn't already set it). */
- if (!*result_list)
- /* This used to say *result_list = *found->prefixlist
- If that was correct, need to modify the documentation
- at the top of this function to clarify what is supposed
- to be going on. */
- *result_list = found;
- return c;
- }
- else
- {
- /* We matched! */
- return c;
- }
- }
- else
- {
- *result_list = clist;
- return found;
- }
-}
-
-/* Look up the contents of *LINE as a command in the command list LIST.
- LIST is a chain of struct cmd_list_element's.
- If it is found, return the struct cmd_list_element for that command
- and update *LINE to point after the command name, at the first argument.
- If not found, call error if ALLOW_UNKNOWN is zero
- otherwise (or if error returns) return zero.
- Call error if specified command is ambiguous,
- unless ALLOW_UNKNOWN is negative.
- CMDTYPE precedes the word "command" in the error message.
-
- If INGNORE_HELP_CLASSES is nonzero, ignore any command list
- elements which are actually help classes rather than commands (i.e.
- the function field of the struct cmd_list_element is 0). */
-
-struct cmd_list_element *
-lookup_cmd (line, list, cmdtype, allow_unknown, ignore_help_classes)
- char **line;
- struct cmd_list_element *list;
- char *cmdtype;
- int allow_unknown;
- int ignore_help_classes;
-{
- struct cmd_list_element *last_list = 0;
- struct cmd_list_element *c =
- lookup_cmd_1 (line, list, &last_list, ignore_help_classes);
- char *ptr = (*line) + strlen (*line) - 1;
-
- /* Clear off trailing whitespace. */
- while (ptr >= *line && (*ptr == ' ' || *ptr == '\t'))
- ptr--;
- *(ptr + 1) = '\0';
-
- if (!c)
- {
- if (!allow_unknown)
- {
- if (!*line)
- error ("Lack of needed %scommand", cmdtype);
- else
- {
- char *p = *line, *q;
-
- while (isalnum(*p) || *p == '-')
- p++;
-
- q = (char *) alloca (p - *line + 1);
- strncpy (q, *line, p - *line);
- q[p-*line] = '\0';
-
- error ("Undefined %scommand: \"%s\".", cmdtype, q);
- }
- }
- else
- return 0;
- }
- else if (c == (struct cmd_list_element *) -1)
- {
- /* Ambigous. Local values should be off prefixlist or called
- values. */
- int local_allow_unknown = (last_list ? last_list->allow_unknown :
- allow_unknown);
- char *local_cmdtype = last_list ? last_list->prefixname : cmdtype;
- struct cmd_list_element *local_list =
- (last_list ? *(last_list->prefixlist) : list);
-
- if (local_allow_unknown < 0)
- {
- if (last_list)
- return last_list; /* Found something. */
- else
- return 0; /* Found nothing. */
- }
- else
- {
- /* Report as error. */
- int amb_len;
- char ambbuf[100];
-
- for (amb_len = 0;
- ((*line)[amb_len] && (*line)[amb_len] != ' '
- && (*line)[amb_len] != '\t');
- amb_len++)
- ;
-
- ambbuf[0] = 0;
- for (c = local_list; c; c = c->next)
- if (!strncmp (*line, c->name, amb_len))
- {
- if (strlen (ambbuf) + strlen (c->name) + 6 < sizeof ambbuf)
- {
- if (strlen (ambbuf))
- strcat (ambbuf, ", ");
- strcat (ambbuf, c->name);
- }
- else
- {
- strcat (ambbuf, "..");
- break;
- }
- }
- error ("Ambiguous %scommand \"%s\": %s.", local_cmdtype,
- *line, ambbuf);
- }
- }
- else
- {
- /* We've got something. It may still not be what the caller
- wants (if this command *needs* a subcommand). */
- while (**line == ' ' || **line == '\t')
- (*line)++;
-
- if (c->prefixlist && **line && !c->allow_unknown)
- error ("Undefined %scommand: \"%s\".", c->prefixname, *line);
-
- /* Seems to be what he wants. Return it. */
- return c;
- }
-}
-
-#if 0
-/* Look up the contents of *LINE as a command in the command list LIST.
- LIST is a chain of struct cmd_list_element's.
- If it is found, return the struct cmd_list_element for that command
- and update *LINE to point after the command name, at the first argument.
- If not found, call error if ALLOW_UNKNOWN is zero
- otherwise (or if error returns) return zero.
- Call error if specified command is ambiguous,
- unless ALLOW_UNKNOWN is negative.
- CMDTYPE precedes the word "command" in the error message. */
-
-struct cmd_list_element *
-lookup_cmd (line, list, cmdtype, allow_unknown)
- char **line;
- struct cmd_list_element *list;
- char *cmdtype;
- int allow_unknown;
-{
- register char *p;
- register struct cmd_list_element *c, *found;
- int nfound;
- char ambbuf[100];
- char *processed_cmd;
- int i, cmd_len;
-
- /* Skip leading whitespace. */
-
- while (**line == ' ' || **line == '\t')
- (*line)++;
-
- /* Clear out trailing whitespace. */
-
- p = *line + strlen (*line);
- while (p != *line && (p[-1] == ' ' || p[-1] == '\t'))
- p--;
- *p = 0;
-
- /* Find end of command name. */
-
- p = *line;
- while (*p == '-'
- || (*p >= 'a' && *p <= 'z')
- || (*p >= 'A' && *p <= 'Z')
- || (*p >= '0' && *p <= '9'))
- p++;
-
- /* Look up the command name.
- If exact match, keep that.
- Otherwise, take command abbreviated, if unique. Note that (in my
- opinion) a null string does *not* indicate ambiguity; simply the
- end of the argument. */
-
- if (p == *line)
- {
- if (!allow_unknown)
- error ("Lack of needed %scommand", cmdtype);
- return 0;
- }
-
- /* Copy over to a local buffer, converting to lowercase on the way.
- This is in case the command being parsed is a subcommand which
- doesn't match anything, and that's ok. We want the original
- untouched for the routine of the original command. */
-
- processed_cmd = (char *) alloca (p - *line + 1);
- for (cmd_len = 0; cmd_len < p - *line; cmd_len++)
- {
- char x = (*line)[cmd_len];
- if (x >= 'A' && x <= 'Z')
- processed_cmd[cmd_len] = x - 'A' + 'a';
- else
- processed_cmd[cmd_len] = x;
- }
- processed_cmd[cmd_len] = '\0';
-
- /* Check all possibilities in the current command list. */
- found = 0;
- nfound = 0;
- for (c = list; c; c = c->next)
- {
- if (!strncmp (processed_cmd, c->name, cmd_len))
- {
- found = c;
- nfound++;
- if (c->name[cmd_len] == 0)
- {
- nfound = 1;
- break;
- }
- }
- }
-
- /* Report error for undefined command name. */
-
- if (nfound != 1)
- {
- if (nfound > 1 && allow_unknown >= 0)
- {
- ambbuf[0] = 0;
- for (c = list; c; c = c->next)
- if (!strncmp (processed_cmd, c->name, cmd_len))
- {
- if (strlen (ambbuf) + strlen (c->name) + 6 < sizeof ambbuf)
- {
- if (strlen (ambbuf))
- strcat (ambbuf, ", ");
- strcat (ambbuf, c->name);
- }
- else
- {
- strcat (ambbuf, "..");
- break;
- }
- }
- error ("Ambiguous %scommand \"%s\": %s.", cmdtype,
- processed_cmd, ambbuf);
- }
- else if (!allow_unknown)
- error ("Undefined %scommand: \"%s\".", cmdtype, processed_cmd);
- return 0;
- }
-
- /* Skip whitespace before the argument. */
-
- while (*p == ' ' || *p == '\t') p++;
- *line = p;
-
- if (found->prefixlist && *p)
- {
- c = lookup_cmd (line, *found->prefixlist, found->prefixname,
- found->allow_unknown);
- if (c)
- return c;
- }
-
- return found;
-}
-#endif
-
-/* Helper function for SYMBOL_COMPLETION_FUNCTION. */
-
-/* Return a vector of char pointers which point to the different
- possible completions in LIST of TEXT. */
-
-char **
-complete_on_cmdlist (list, text)
- struct cmd_list_element *list;
- char *text;
-{
- struct cmd_list_element *ptr;
- char **matchlist;
- int sizeof_matchlist;
- int matches;
- int textlen = strlen (text);
-
- sizeof_matchlist = 10;
- matchlist = (char **) xmalloc (sizeof_matchlist * sizeof (char *));
- matches = 0;
-
- for (ptr = list; ptr; ptr = ptr->next)
- if (!strncmp (ptr->name, text, textlen)
- && !ptr->abbrev_flag
- && (ptr->function
- || ptr->prefixlist))
- {
- if (matches == sizeof_matchlist)
- {
- sizeof_matchlist *= 2;
- matchlist = (char **) xrealloc (matchlist,
- (sizeof_matchlist
- * sizeof (char *)));
- }
-
- matchlist[matches] = (char *)
- xmalloc (strlen (ptr->name) + 1);
- strcpy (matchlist[matches++], ptr->name);
- }
-
- if (matches == 0)
- {
- free (matchlist);
- matchlist = 0;
- }
- else
- {
- matchlist = (char **) xrealloc (matchlist, ((matches + 1)
- * sizeof (char *)));
- matchlist[matches] = (char *) 0;
- }
-
- return matchlist;
-}
-
-static void
-shell_escape (arg, from_tty)
- char *arg;
- int from_tty;
-{
- int rc, status, pid;
- char *p, *user_shell;
- extern char *rindex ();
-
- if ((user_shell = (char *) getenv ("SHELL")) == NULL)
- user_shell = "/bin/sh";
-
- /* Get the name of the shell for arg0 */
- if ((p = rindex (user_shell, '/')) == NULL)
- p = user_shell;
- else
- p++; /* Get past '/' */
-
- if ((pid = fork()) == 0)
- {
- if (!arg)
- execl (user_shell, p, 0);
- else
- execl (user_shell, p, "-c", arg, 0);
-
- fprintf (stderr, "Exec of shell failed\n");
- exit (0);
- }
-
- if (pid != -1)
- while ((rc = wait (&status)) != pid && rc != -1)
- ;
- else
- error ("Fork failed");
-}
-
-void
-_initialize_command ()
-{
- add_com ("shell", class_support, shell_escape,
- "Execute the rest of the line as a shell command. \n\
-With no arguments, run an inferior shell.");
-}
diff --git a/gnu/usr.bin/gdb/command.h b/gnu/usr.bin/gdb/command.h
deleted file mode 100644
index fe28aef..0000000
--- a/gnu/usr.bin/gdb/command.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* Header file for command-reading library command.c.
- Copyright (C) 1986, 1989 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. */
-
-/* This structure records one command'd definition. */
-
-struct cmd_list_element
- {
- /* Points to next command in this list. */
- struct cmd_list_element *next;
-
- /* Name of this command. */
- char *name;
-
- /* Command class; class values are chosen by application program. */
- int class;
-
- /* Function definition of this command.
- Zero for command class names and for help topics that
- are not really commands. */
- void (*function) ();
-
- /* Documentation of this command (or help topic).
- First line is brief documentation; remaining lines form, with it,
- the full documentation. First line should end with a period.
- Entire string should also end with a period, not a newline. */
- char *doc;
-
- /* Auxiliary information.
- It is up to the calling program to decide what this means. */
- char *aux;
-
- /* Nonzero identifies a prefix command. For them, the address
- of the variable containing the list of subcommands. */
- struct cmd_list_element **prefixlist;
-
- /* For prefix commands only:
- String containing prefix commands to get here: this one
- plus any others needed to get to it. Should end in a space.
- It is used before the word "command" in describing the
- commands reached through this prefix. */
- char *prefixname;
-
- /* For prefix commands only:
- nonzero means do not get an error if subcommand is not
- recognized; call the prefix's own function in that case. */
- char allow_unknown;
-
- /* Nonzero says this is an abbreviation, and should not
- be mentioned in lists of commands.
- This allows "br<tab>" to complete to "break", which it
- otherwise wouldn't. */
- char abbrev_flag;
- };
-
-/* Forward-declarations of the entry-points of command.c. */
-
-extern struct cmd_list_element *add_cmd ();
-extern struct cmd_list_element *add_alias_cmd ();
-extern struct cmd_list_element *add_prefix_cmd ();
-extern struct cmd_list_element *lookup_cmd (), *lookup_cmd_1 ();
-extern char **complete_on_cmdlist ();
-extern void delete_cmd ();
-extern void help_cmd ();
diff --git a/gnu/usr.bin/gdb/config/Makefile.i386 b/gnu/usr.bin/gdb/config/Makefile.i386
deleted file mode 100644
index cc52aa3..0000000
--- a/gnu/usr.bin/gdb/config/Makefile.i386
+++ /dev/null
@@ -1,6 +0,0 @@
-# @(#)Makefile.i386 6.2 (Berkeley) 3/21/91
-
-CONFIGSRCS= i386bsd-dep.c i386-pinsn.c
-
-param.h:
- ln -s $(.CURDIR)/config/m-i386bsd.h param.h
diff --git a/gnu/usr.bin/gdb/config/default-dep.c b/gnu/usr.bin/gdb/config/default-dep.c
deleted file mode 100644
index 13fe7b9..0000000
--- a/gnu/usr.bin/gdb/config/default-dep.c
+++ /dev/null
@@ -1,585 +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[] = "@(#)default-dep.c 6.3 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* Low level interface to ptrace, for GDB when running under Unix.
- Copyright (C) 1988, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include "defs.h"
-#include "param.h"
-#include "frame.h"
-#include "inferior.h"
-
-#ifdef USG
-#include <sys/types.h>
-#endif
-
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-/* #include <fcntl.h> Can we live without this? */
-
-#ifdef COFF_ENCAPSULATE
-#include "a.out.encap.h"
-#else
-#include <a.out.h>
-#endif
-#ifndef N_SET_MAGIC
-#define N_SET_MAGIC(exec, val) ((exec).a_magic = (val))
-#endif
-
-#include <sys/user.h> /* After a.out.h */
-#include <sys/file.h>
-#include <sys/stat.h>
-
-extern int errno;
-
-/* This function simply calls ptrace with the given arguments.
- It exists so that all calls to ptrace are isolated in this
- machine-dependent file. */
-int
-call_ptrace (request, pid, arg3, arg4)
- int request, pid, arg3, arg4;
-{
- return ptrace (request, pid, arg3, arg4);
-}
-
-kill_inferior ()
-{
- if (remote_debugging)
- return;
- if (inferior_pid == 0)
- return;
- ptrace (8, inferior_pid, 0, 0);
- wait (0);
- inferior_died ();
-}
-
-/* This is used when GDB is exiting. It gives less chance of error.*/
-
-kill_inferior_fast ()
-{
- if (remote_debugging)
- return;
- if (inferior_pid == 0)
- return;
- ptrace (8, inferior_pid, 0, 0);
- wait (0);
-}
-
-/* Resume execution of the inferior process.
- If STEP is nonzero, single-step it.
- If SIGNAL is nonzero, give it that signal. */
-
-void
-resume (step, signal)
- int step;
- int signal;
-{
- errno = 0;
- if (remote_debugging)
- remote_resume (step, signal);
- else
- {
- ptrace (step ? 9 : 7, inferior_pid, 1, signal);
- if (errno)
- perror_with_name ("ptrace");
- }
-}
-
-void
-fetch_inferior_registers ()
-{
- register int regno;
- register unsigned int regaddr;
- char buf[MAX_REGISTER_RAW_SIZE];
- register int i;
-
- struct user u;
- unsigned int offset = (char *) &u.u_ar0 - (char *) &u;
- offset = ptrace (3, inferior_pid, offset, 0) - KERNEL_U_ADDR;
-
- for (regno = 0; regno < NUM_REGS; regno++)
- {
- regaddr = register_addr (regno, offset);
- for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
- {
- *(int *) &buf[i] = ptrace (3, inferior_pid, regaddr, 0);
- regaddr += sizeof (int);
- }
- supply_register (regno, buf);
- }
-}
-
-/* Store our register values back into the inferior.
- If REGNO is -1, do this for all registers.
- Otherwise, REGNO specifies which register (so we can save time). */
-
-store_inferior_registers (regno)
- int regno;
-{
- register unsigned int regaddr;
- char buf[80];
-
- struct user u;
- unsigned int offset = (char *) &u.u_ar0 - (char *) &u;
- offset = ptrace (3, inferior_pid, offset, 0) - KERNEL_U_ADDR;
-
- if (regno >= 0)
- {
- regaddr = register_addr (regno, offset);
- errno = 0;
- ptrace (6, inferior_pid, regaddr, read_register (regno));
- if (errno != 0)
- {
- sprintf (buf, "writing register number %d", regno);
- perror_with_name (buf);
- }
- }
- else for (regno = 0; regno < NUM_REGS; regno++)
- {
- regaddr = register_addr (regno, offset);
- errno = 0;
- ptrace (6, inferior_pid, regaddr, read_register (regno));
- if (errno != 0)
- {
- sprintf (buf, "writing all regs, number %d", regno);
- perror_with_name (buf);
- }
- }
-}
-
-/* Copy LEN bytes from inferior's memory starting at MEMADDR
- to debugger memory starting at MYADDR.
- On failure (cannot read from inferior, usually because address is out
- of bounds) returns the value of errno. */
-
-int
-read_inferior_memory (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
-{
- register int i;
- /* Round starting address down to longword boundary. */
- register CORE_ADDR addr = memaddr & - sizeof (int);
- /* Round ending address up; get number of longwords that makes. */
- register int count
- = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
- /* Allocate buffer of that many longwords. */
- register int *buffer = (int *) alloca (count * sizeof (int));
- extern int errno;
-
- /* Read all the longwords */
- for (i = 0; i < count; i++, addr += sizeof (int))
- {
- errno = 0;
-#if 0
- /* This is now done by read_memory, because when this function did it,
- reading a byte or short int hardware port read whole longs, causing
- serious side effects
- such as bus errors and unexpected hardware operation. This would
- also be a problem with ptrace if the inferior process could read
- or write hardware registers, but that's not usually the case. */
- if (remote_debugging)
- buffer[i] = remote_fetch_word (addr);
- else
-#endif
- buffer[i] = ptrace (1, inferior_pid, addr, 0);
- if (errno)
- return errno;
- }
-
- /* Copy appropriate bytes out of the buffer. */
- bcopy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
- return 0;
-}
-
-/* Copy LEN bytes of data from debugger memory at MYADDR
- to inferior's memory at MEMADDR.
- On failure (cannot write the inferior)
- returns the value of errno. */
-
-int
-write_inferior_memory (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
-{
- register int i;
- /* Round starting address down to longword boundary. */
- register CORE_ADDR addr = memaddr & - sizeof (int);
- /* Round ending address up; get number of longwords that makes. */
- register int count
- = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
- /* Allocate buffer of that many longwords. */
- register int *buffer = (int *) alloca (count * sizeof (int));
- extern int errno;
-
- /* Fill start and end extra bytes of buffer with existing memory data. */
-
- if (remote_debugging)
- return (remote_write_inferior_memory(memaddr, myaddr, len));
-
- buffer[0] = ptrace (1, inferior_pid, addr, 0);
-
- if (count > 1)
- buffer[count - 1] = ptrace (1, inferior_pid,
- addr + (count - 1) * sizeof (int), 0);
-
- /* Copy data to be written over corresponding part of buffer */
-
- bcopy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
-
- /* Write the entire buffer. */
-
- for (i = 0; i < count; i++, addr += sizeof (int))
- {
- errno = 0;
- ptrace (4, inferior_pid, addr, buffer[i]);
- if (errno)
- return errno;
- }
-
- return 0;
-}
-
-/* Work with core dump and executable files, for GDB.
- This code would be in core.c if it weren't machine-dependent. */
-
-#ifndef N_TXTADDR
-#define N_TXTADDR(hdr) 0
-#endif /* no N_TXTADDR */
-
-#ifndef N_DATADDR
-#define N_DATADDR(hdr) hdr.a_text
-#endif /* no N_DATADDR */
-
-/* Make COFF and non-COFF names for things a little more compatible
- to reduce conditionals later. */
-
-#ifdef COFF_FORMAT
-#define a_magic magic
-#endif
-
-#ifndef COFF_FORMAT
-#ifndef AOUTHDR
-#define AOUTHDR struct exec
-#endif
-#endif
-
-extern char *sys_siglist[];
-
-
-/* Hook for `exec_file_command' command to call. */
-
-extern void (*exec_file_display_hook) ();
-
-/* File names of core file and executable file. */
-
-extern char *corefile;
-extern char *execfile;
-
-/* Descriptors on which core file and executable file are open.
- Note that the execchan is closed when an inferior is created
- and reopened if the inferior dies or is killed. */
-
-extern int corechan;
-extern int execchan;
-
-/* Last modification time of executable file.
- Also used in source.c to compare against mtime of a source file. */
-
-extern int exec_mtime;
-
-/* Virtual addresses of bounds of the two areas of memory in the core file. */
-
-extern CORE_ADDR data_start;
-extern CORE_ADDR data_end;
-extern CORE_ADDR stack_start;
-extern CORE_ADDR stack_end;
-
-/* Virtual addresses of bounds of two areas of memory in the exec file.
- Note that the data area in the exec file is used only when there is no core file. */
-
-extern CORE_ADDR text_start;
-extern CORE_ADDR text_end;
-
-extern CORE_ADDR exec_data_start;
-extern CORE_ADDR exec_data_end;
-
-/* Address in executable file of start of text area data. */
-
-extern int text_offset;
-
-/* Address in executable file of start of data area data. */
-
-extern int exec_data_offset;
-
-/* Address in core file of start of data area data. */
-
-extern int data_offset;
-
-/* Address in core file of start of stack area data. */
-
-extern int stack_offset;
-
-#ifdef COFF_FORMAT
-/* various coff data structures */
-
-extern FILHDR file_hdr;
-extern SCNHDR text_hdr;
-extern SCNHDR data_hdr;
-
-#endif /* not COFF_FORMAT */
-
-/* a.out header saved in core file. */
-
-extern AOUTHDR core_aouthdr;
-
-/* a.out header of exec file. */
-
-extern AOUTHDR exec_aouthdr;
-
-extern void validate_files ();
-
-core_file_command (filename, from_tty)
- char *filename;
- int from_tty;
-{
- int val;
- extern char registers[];
-
- /* Discard all vestiges of any previous core file
- and mark data and stack spaces as empty. */
-
- if (corefile)
- free (corefile);
- corefile = 0;
-
- if (corechan >= 0)
- close (corechan);
- corechan = -1;
-
- data_start = 0;
- data_end = 0;
- stack_start = STACK_END_ADDR;
- stack_end = STACK_END_ADDR;
-
- /* Now, if a new core file was specified, open it and digest it. */
-
- if (filename)
- {
- filename = tilde_expand (filename);
- make_cleanup (free, filename);
-
- if (have_inferior_p ())
- error ("To look at a core file, you must kill the inferior with \"kill\".");
- corechan = open (filename, O_RDONLY, 0);
- if (corechan < 0)
- perror_with_name (filename);
- /* 4.2-style (and perhaps also sysV-style) core dump file. */
- {
- struct user u;
-
- unsigned int reg_offset;
-
- val = myread (corechan, &u, sizeof u);
- if (val < 0)
- perror_with_name ("Not a core file: reading upage");
- if (val != sizeof u)
- error ("Not a core file: could only read %d bytes", val);
-
- /* We are depending on exec_file_command having been called
- previously to set exec_data_start. Since the executable
- and the core file share the same text segment, the address
- of the data segment will be the same in both. */
- data_start = exec_data_start;
-
- data_end = data_start + NBPG * u.u_dsize;
- stack_start = stack_end - NBPG * u.u_ssize;
- data_offset = NBPG * UPAGES;
- stack_offset = NBPG * (UPAGES + u.u_dsize);
-
- /* Some machines put an absolute address in here and some put
- the offset in the upage of the regs. */
- reg_offset = (int) u.u_ar0;
- if (reg_offset > NBPG * UPAGES)
- reg_offset -= KERNEL_U_ADDR;
-
- /* I don't know where to find this info.
- So, for now, mark it as not available. */
- N_SET_MAGIC (core_aouthdr, 0);
-
- /* Read the register values out of the core file and store
- them where `read_register' will find them. */
-
- {
- register int regno;
-
- for (regno = 0; regno < NUM_REGS; regno++)
- {
- char buf[MAX_REGISTER_RAW_SIZE];
-
- val = lseek (corechan, register_addr (regno, reg_offset), 0);
- if (val < 0
- || (val = myread (corechan, buf, sizeof buf)) < 0)
- {
- char * buffer = (char *) alloca (strlen (reg_names[regno])
- + 30);
- strcpy (buffer, "Reading register ");
- strcat (buffer, reg_names[regno]);
-
- perror_with_name (buffer);
- }
-
- supply_register (regno, buf);
- }
- }
- }
- if (filename[0] == '/')
- corefile = savestring (filename, strlen (filename));
- else
- {
- corefile = concat (current_directory, "/", filename);
- }
-
- set_current_frame ( create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
- select_frame (get_current_frame (), 0);
- validate_files ();
- }
- else if (from_tty)
- printf ("No core file now.\n");
-}
-
-exec_file_command (filename, from_tty)
- char *filename;
- int from_tty;
-{
- int val;
-
- /* Eliminate all traces of old exec file.
- Mark text segment as empty. */
-
- if (execfile)
- free (execfile);
- execfile = 0;
- data_start = 0;
- data_end -= exec_data_start;
- text_start = 0;
- text_end = 0;
- exec_data_start = 0;
- exec_data_end = 0;
- if (execchan >= 0)
- close (execchan);
- execchan = -1;
-
- /* Now open and digest the file the user requested, if any. */
-
- if (filename)
- {
- filename = tilde_expand (filename);
- make_cleanup (free, filename);
-
- execchan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0,
- &execfile);
- if (execchan < 0)
- perror_with_name (filename);
-
-#ifdef COFF_FORMAT
- {
- int aout_hdrsize;
- int num_sections;
-
- if (read_file_hdr (execchan, &file_hdr) < 0)
- error ("\"%s\": not in executable format.", execfile);
-
- aout_hdrsize = file_hdr.f_opthdr;
- num_sections = file_hdr.f_nscns;
-
- if (read_aout_hdr (execchan, &exec_aouthdr, aout_hdrsize) < 0)
- error ("\"%s\": can't read optional aouthdr", execfile);
-
- if (read_section_hdr (execchan, _TEXT, &text_hdr, num_sections,
- aout_hdrsize) < 0)
- error ("\"%s\": can't read text section header", execfile);
-
- if (read_section_hdr (execchan, _DATA, &data_hdr, num_sections,
- aout_hdrsize) < 0)
- error ("\"%s\": can't read data section header", execfile);
-
- text_start = exec_aouthdr.text_start;
- text_end = text_start + exec_aouthdr.tsize;
- text_offset = text_hdr.s_scnptr;
- exec_data_start = exec_aouthdr.data_start;
- exec_data_end = exec_data_start + exec_aouthdr.dsize;
- exec_data_offset = data_hdr.s_scnptr;
- data_start = exec_data_start;
- data_end += exec_data_start;
- exec_mtime = file_hdr.f_timdat;
- }
-#else /* not COFF_FORMAT */
- {
- struct stat st_exec;
-
-#ifdef HEADER_SEEK_FD
- HEADER_SEEK_FD (execchan);
-#endif
-
- val = myread (execchan, &exec_aouthdr, sizeof (AOUTHDR));
-
- if (val < 0)
- perror_with_name (filename);
-
- text_start = N_TXTADDR (exec_aouthdr);
- exec_data_start = N_DATADDR (exec_aouthdr);
-
- text_offset = N_TXTOFF (exec_aouthdr);
- exec_data_offset = N_TXTOFF (exec_aouthdr) + exec_aouthdr.a_text;
-
- text_end = text_start + exec_aouthdr.a_text;
- exec_data_end = exec_data_start + exec_aouthdr.a_data;
- data_start = exec_data_start;
- data_end += exec_data_start;
-
- if (fstat (execchan, &st_exec) < 0)
- perror_with_name (filename);
- exec_mtime = st_exec.st_mtime;
- }
-#endif /* not COFF_FORMAT */
-
- validate_files ();
- }
- else if (from_tty)
- printf ("No exec file now.\n");
-
- /* Tell display code (if any) about the changed file name. */
- if (exec_file_display_hook)
- (*exec_file_display_hook) (filename);
-}
diff --git a/gnu/usr.bin/gdb/config/i386-dep.c b/gnu/usr.bin/gdb/config/i386-dep.c
deleted file mode 100644
index c4630d0..0000000
--- a/gnu/usr.bin/gdb/config/i386-dep.c
+++ /dev/null
@@ -1,1275 +0,0 @@
-/* Low level interface to ptrace, for GDB when running on the Intel 386.
- Copyright (C) 1988, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include "defs.h"
-#include "param.h"
-#include "frame.h"
-#include "inferior.h"
-
-#ifdef USG
-#include <sys/types.h>
-#endif
-
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <signal.h>
-#include <sys/user.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-
-#ifdef COFF_ENCAPSULATE
-#include "a.out.encap.h"
-#else
-#include <a.out.h>
-#endif
-
-#ifndef N_SET_MAGIC
-#ifdef COFF_FORMAT
-#define N_SET_MAGIC(exec, val) ((exec).magic = (val))
-#else
-#define N_SET_MAGIC(exec, val) ((exec).a_magic = (val))
-#endif
-#endif
-
-#include <sys/file.h>
-#include <sys/stat.h>
-
-#include <sys/reg.h>
-
-extern int errno;
-
-/* This function simply calls ptrace with the given arguments.
- It exists so that all calls to ptrace are isolated in this
- machine-dependent file. */
-int
-call_ptrace (request, pid, arg3, arg4)
- int request, pid, arg3, arg4;
-{
- return ptrace (request, pid, arg3, arg4);
-}
-
-kill_inferior ()
-{
- if (remote_debugging)
- return;
- if (inferior_pid == 0)
- return;
- ptrace (8, inferior_pid, 0, 0);
- wait (0);
- inferior_died ();
-}
-
-/* This is used when GDB is exiting. It gives less chance of error.*/
-
-kill_inferior_fast ()
-{
- if (remote_debugging)
- return;
- if (inferior_pid == 0)
- return;
- ptrace (8, inferior_pid, 0, 0);
- wait (0);
-}
-
-/* Resume execution of the inferior process.
- If STEP is nonzero, single-step it.
- If SIGNAL is nonzero, give it that signal. */
-
-void
-resume (step, signal)
- int step;
- int signal;
-{
- errno = 0;
- if (remote_debugging)
- remote_resume (step, signal);
- else
- {
- ptrace (step ? 9 : 7, inferior_pid, 1, signal);
- if (errno)
- perror_with_name ("ptrace");
- }
-}
-
-void
-fetch_inferior_registers ()
-{
- register int regno;
- register unsigned int regaddr;
- char buf[MAX_REGISTER_RAW_SIZE];
- register int i;
-
- struct user u;
- unsigned int offset = (char *) &u.u_ar0 - (char *) &u;
- offset = ptrace (3, inferior_pid, offset, 0) - KERNEL_U_ADDR;
-
- for (regno = 0; regno < NUM_REGS; regno++)
- {
- regaddr = register_addr (regno, offset);
- for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
- {
- *(int *) &buf[i] = ptrace (3, inferior_pid, regaddr, 0);
- regaddr += sizeof (int);
- }
- supply_register (regno, buf);
- }
-}
-
-/* Store our register values back into the inferior.
- If REGNO is -1, do this for all registers.
- Otherwise, REGNO specifies which register (so we can save time). */
-
-store_inferior_registers (regno)
- int regno;
-{
- register unsigned int regaddr;
- char buf[80];
-
- struct user u;
- unsigned int offset = (char *) &u.u_ar0 - (char *) &u;
- offset = ptrace (3, inferior_pid, offset, 0) - KERNEL_U_ADDR;
-
- if (regno >= 0)
- {
- regaddr = register_addr (regno, offset);
- errno = 0;
- ptrace (6, inferior_pid, regaddr, read_register (regno));
- if (errno != 0)
- {
- sprintf (buf, "writing register number %d", regno);
- perror_with_name (buf);
- }
- }
- else for (regno = 0; regno < NUM_REGS; regno++)
- {
- regaddr = register_addr (regno, offset);
- errno = 0;
- ptrace (6, inferior_pid, regaddr, read_register (regno));
- if (errno != 0)
- {
- sprintf (buf, "writing register number %d", regno);
- perror_with_name (buf);
- }
- }
-}
-
-/* Copy LEN bytes from inferior's memory starting at MEMADDR
- to debugger memory starting at MYADDR.
- On failure (cannot read from inferior, usually because address is out
- of bounds) returns the value of errno. */
-
-int
-read_inferior_memory (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
-{
- register int i;
- /* Round starting address down to longword boundary. */
- register CORE_ADDR addr = memaddr & - sizeof (int);
- /* Round ending address up; get number of longwords that makes. */
- register int count
- = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
- /* Allocate buffer of that many longwords. */
- register int *buffer = (int *) alloca (count * sizeof (int));
- extern int errno;
-
- /* Read all the longwords */
- for (i = 0; i < count; i++, addr += sizeof (int))
- {
- errno = 0;
- if (remote_debugging)
- buffer[i] = remote_fetch_word (addr);
- else
- buffer[i] = ptrace (1, inferior_pid, addr, 0);
- if (errno)
- return errno;
- }
-
- /* Copy appropriate bytes out of the buffer. */
- bcopy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
- return 0;
-}
-
-/* Copy LEN bytes of data from debugger memory at MYADDR
- to inferior's memory at MEMADDR.
- On failure (cannot write the inferior)
- returns the value of errno. */
-
-int
-write_inferior_memory (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
-{
- register int i;
- /* Round starting address down to longword boundary. */
- register CORE_ADDR addr = memaddr & - sizeof (int);
- /* Round ending address up; get number of longwords that makes. */
- register int count
- = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
- /* Allocate buffer of that many longwords. */
- register int *buffer = (int *) alloca (count * sizeof (int));
- extern int errno;
-
- /* Fill start and end extra bytes of buffer with existing memory data. */
-
- if (remote_debugging)
- buffer[0] = remote_fetch_word (addr);
- else
- buffer[0] = ptrace (1, inferior_pid, addr, 0);
-
- if (count > 1)
- {
- if (remote_debugging)
- buffer[count - 1]
- = remote_fetch_word (addr + (count - 1) * sizeof (int));
- else
- buffer[count - 1]
- = ptrace (1, inferior_pid,
- addr + (count - 1) * sizeof (int), 0);
- }
-
- /* Copy data to be written over corresponding part of buffer */
-
- bcopy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
-
- /* Write the entire buffer. */
-
- for (i = 0; i < count; i++, addr += sizeof (int))
- {
- errno = 0;
- if (remote_debugging)
- remote_store_word (addr, buffer[i]);
- else
- ptrace (4, inferior_pid, addr, buffer[i]);
- if (errno)
- return errno;
- }
-
- return 0;
-}
-
-/* Work with core dump and executable files, for GDB.
- This code would be in core.c if it weren't machine-dependent. */
-
-#ifndef N_TXTADDR
-#define N_TXTADDR(hdr) 0
-#endif /* no N_TXTADDR */
-
-#ifndef N_DATADDR
-#define N_DATADDR(hdr) hdr.a_text
-#endif /* no N_DATADDR */
-
-/* Make COFF and non-COFF names for things a little more compatible
- to reduce conditionals later. */
-
-#ifndef COFF_FORMAT
-#ifndef AOUTHDR
-#define AOUTHDR struct exec
-#endif
-#endif
-
-extern char *sys_siglist[];
-
-
-/* Hook for `exec_file_command' command to call. */
-
-extern void (*exec_file_display_hook) ();
-
-/* File names of core file and executable file. */
-
-extern char *corefile;
-extern char *execfile;
-
-/* Descriptors on which core file and executable file are open.
- Note that the execchan is closed when an inferior is created
- and reopened if the inferior dies or is killed. */
-
-extern int corechan;
-extern int execchan;
-
-/* Last modification time of executable file.
- Also used in source.c to compare against mtime of a source file. */
-
-extern int exec_mtime;
-
-/* Virtual addresses of bounds of the two areas of memory in the core file. */
-
-extern CORE_ADDR data_start;
-extern CORE_ADDR data_end;
-extern CORE_ADDR stack_start;
-extern CORE_ADDR stack_end;
-
-/* Virtual addresses of bounds of two areas of memory in the exec file.
- Note that the data area in the exec file is used only when there is no core file. */
-
-extern CORE_ADDR text_start;
-extern CORE_ADDR text_end;
-
-extern CORE_ADDR exec_data_start;
-extern CORE_ADDR exec_data_end;
-
-/* Address in executable file of start of text area data. */
-
-extern int text_offset;
-
-/* Address in executable file of start of data area data. */
-
-extern int exec_data_offset;
-
-/* Address in core file of start of data area data. */
-
-extern int data_offset;
-
-/* Address in core file of start of stack area data. */
-
-extern int stack_offset;
-
-#ifdef COFF_FORMAT
-/* various coff data structures */
-
-extern FILHDR file_hdr;
-extern SCNHDR text_hdr;
-extern SCNHDR data_hdr;
-
-#endif /* not COFF_FORMAT */
-
-/* a.out header saved in core file. */
-
-extern AOUTHDR core_aouthdr;
-
-/* a.out header of exec file. */
-
-extern AOUTHDR exec_aouthdr;
-
-extern void validate_files ();
-
-core_file_command (filename, from_tty)
- char *filename;
- int from_tty;
-{
- int val;
- extern char registers[];
-
- /* Discard all vestiges of any previous core file
- and mark data and stack spaces as empty. */
-
- if (corefile)
- free (corefile);
- corefile = 0;
-
- if (corechan >= 0)
- close (corechan);
- corechan = -1;
-
- data_start = 0;
- data_end = 0;
- stack_start = STACK_END_ADDR;
- stack_end = STACK_END_ADDR;
-
- /* Now, if a new core file was specified, open it and digest it. */
-
- if (filename)
- {
- filename = tilde_expand (filename);
- make_cleanup (free, filename);
-
- if (have_inferior_p ())
- error ("To look at a core file, you must kill the inferior with \"kill\".");
- corechan = open (filename, O_RDONLY, 0);
- if (corechan < 0)
- perror_with_name (filename);
- /* 4.2-style (and perhaps also sysV-style) core dump file. */
- {
- struct user u;
-
- int reg_offset;
-
- val = myread (corechan, &u, sizeof u);
- if (val < 0)
- perror_with_name (filename);
- data_start = exec_data_start;
-
- data_end = data_start + NBPG * u.u_dsize;
- stack_start = stack_end - NBPG * u.u_ssize;
- data_offset = NBPG * UPAGES;
- stack_offset = NBPG * (UPAGES + u.u_dsize);
- reg_offset = (int) u.u_ar0 - KERNEL_U_ADDR;
-
- /* I don't know where to find this info.
- So, for now, mark it as not available. */
-/* N_SET_MAGIC (core_aouthdr, 0); */
- bzero ((char *) &core_aouthdr, sizeof core_aouthdr);
-
- /* Read the register values out of the core file and store
- them where `read_register' will find them. */
-
- {
- register int regno;
-
- for (regno = 0; regno < NUM_REGS; regno++)
- {
- char buf[MAX_REGISTER_RAW_SIZE];
-
- val = lseek (corechan, register_addr (regno, reg_offset), 0);
- if (val < 0)
- perror_with_name (filename);
-
- val = myread (corechan, buf, sizeof buf);
- if (val < 0)
- perror_with_name (filename);
- supply_register (regno, buf);
- }
- }
- }
- if (filename[0] == '/')
- corefile = savestring (filename, strlen (filename));
- else
- {
- corefile = concat (current_directory, "/", filename);
- }
-
- set_current_frame ( create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
- select_frame (get_current_frame (), 0);
- validate_files ();
- }
- else if (from_tty)
- printf ("No core file now.\n");
-}
-
-exec_file_command (filename, from_tty)
- char *filename;
- int from_tty;
-{
- int val;
-
- /* Eliminate all traces of old exec file.
- Mark text segment as empty. */
-
- if (execfile)
- free (execfile);
- execfile = 0;
- data_start = 0;
- data_end -= exec_data_start;
- text_start = 0;
- text_end = 0;
- exec_data_start = 0;
- exec_data_end = 0;
- if (execchan >= 0)
- close (execchan);
- execchan = -1;
-
- /* Now open and digest the file the user requested, if any. */
-
- if (filename)
- {
- filename = tilde_expand (filename);
- make_cleanup (free, filename);
-
- execchan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0,
- &execfile);
- if (execchan < 0)
- perror_with_name (filename);
-
-#ifdef COFF_FORMAT
- {
- int aout_hdrsize;
- int num_sections;
-
- if (read_file_hdr (execchan, &file_hdr) < 0)
- error ("\"%s\": not in executable format.", execfile);
-
- aout_hdrsize = file_hdr.f_opthdr;
- num_sections = file_hdr.f_nscns;
-
- if (read_aout_hdr (execchan, &exec_aouthdr, aout_hdrsize) < 0)
- error ("\"%s\": can't read optional aouthdr", execfile);
-
- if (read_section_hdr (execchan, _TEXT, &text_hdr, num_sections,
- aout_hdrsize) < 0)
- error ("\"%s\": can't read text section header", execfile);
-
- if (read_section_hdr (execchan, _DATA, &data_hdr, num_sections,
- aout_hdrsize) < 0)
- error ("\"%s\": can't read data section header", execfile);
-
- text_start = exec_aouthdr.text_start;
- text_end = text_start + exec_aouthdr.tsize;
- text_offset = text_hdr.s_scnptr;
- exec_data_start = exec_aouthdr.data_start;
- exec_data_end = exec_data_start + exec_aouthdr.dsize;
- exec_data_offset = data_hdr.s_scnptr;
- data_start = exec_data_start;
- data_end += exec_data_start;
- exec_mtime = file_hdr.f_timdat;
- }
-#else /* not COFF_FORMAT */
- {
- struct stat st_exec;
-
-#ifdef HEADER_SEEK_FD
- HEADER_SEEK_FD (execchan);
-#endif
-
- val = myread (execchan, &exec_aouthdr, sizeof (AOUTHDR));
-
- if (val < 0)
- perror_with_name (filename);
-
- text_start = N_TXTADDR (exec_aouthdr);
- exec_data_start = N_DATADDR (exec_aouthdr);
-
- text_offset = N_TXTOFF (exec_aouthdr);
- exec_data_offset = N_TXTOFF (exec_aouthdr) + exec_aouthdr.a_text;
-
- text_end = text_start + exec_aouthdr.a_text;
- exec_data_end = exec_data_start + exec_aouthdr.a_data;
- data_start = exec_data_start;
- data_end += exec_data_start;
-
- fstat (execchan, &st_exec);
- exec_mtime = st_exec.st_mtime;
- }
-#endif /* not COFF_FORMAT */
-
- validate_files ();
- }
- else if (from_tty)
- printf ("No exec file now.\n");
-
- /* Tell display code (if any) about the changed file name. */
- if (exec_file_display_hook)
- (*exec_file_display_hook) (filename);
-}
-
-/* helper functions for m-i386.h */
-
-/* stdio style buffering to minimize calls to ptrace */
-static CORE_ADDR codestream_next_addr;
-static CORE_ADDR codestream_addr;
-static unsigned char codestream_buf[sizeof (int)];
-static int codestream_off;
-static int codestream_cnt;
-
-#define codestream_tell() (codestream_addr + codestream_off)
-#define codestream_peek() (codestream_cnt == 0 ? \
- codestream_fill(1): codestream_buf[codestream_off])
-#define codestream_get() (codestream_cnt-- == 0 ? \
- codestream_fill(0) : codestream_buf[codestream_off++])
-
-static unsigned char
-codestream_fill (peek_flag)
-{
- codestream_addr = codestream_next_addr;
- codestream_next_addr += sizeof (int);
- codestream_off = 0;
- codestream_cnt = sizeof (int);
- read_memory (codestream_addr,
- (unsigned char *)codestream_buf,
- sizeof (int));
-
- if (peek_flag)
- return (codestream_peek());
- else
- return (codestream_get());
-}
-
-static void
-codestream_seek (place)
-{
- codestream_next_addr = place & -sizeof (int);
- codestream_cnt = 0;
- codestream_fill (1);
- while (codestream_tell() != place)
- codestream_get ();
-}
-
-static void
-codestream_read (buf, count)
- unsigned char *buf;
-{
- unsigned char *p;
- int i;
- p = buf;
- for (i = 0; i < count; i++)
- *p++ = codestream_get ();
-}
-
-/* next instruction is a jump, move to target */
-static
-i386_follow_jump ()
-{
- int long_delta;
- short short_delta;
- char byte_delta;
- int data16;
- int pos;
-
- pos = codestream_tell ();
-
- data16 = 0;
- if (codestream_peek () == 0x66)
- {
- codestream_get ();
- data16 = 1;
- }
-
- switch (codestream_get ())
- {
- case 0xe9:
- /* relative jump: if data16 == 0, disp32, else disp16 */
- if (data16)
- {
- codestream_read ((unsigned char *)&short_delta, 2);
- pos += short_delta + 3; /* include size of jmp inst */
- }
- else
- {
- codestream_read ((unsigned char *)&long_delta, 4);
- pos += long_delta + 5;
- }
- break;
- case 0xeb:
- /* relative jump, disp8 (ignore data16) */
- codestream_read ((unsigned char *)&byte_delta, 1);
- pos += byte_delta + 2;
- break;
- }
- codestream_seek (pos + data16);
-}
-
-/*
- * find & return amound a local space allocated, and advance codestream to
- * first register push (if any)
- *
- * if entry sequence doesn't make sense, return -1, and leave
- * codestream pointer random
- */
-static long
-i386_get_frame_setup (pc)
-{
- unsigned char op;
-
- codestream_seek (pc);
-
- i386_follow_jump ();
-
- op = codestream_get ();
-
- if (op == 0x58) /* popl %eax */
- {
- /*
- * this function must start with
- *
- * popl %eax 0x58
- * xchgl %eax, (%esp) 0x87 0x04 0x24
- * or xchgl %eax, 0(%esp) 0x87 0x44 0x24 0x00
- *
- * (the system 5 compiler puts out the second xchg
- * inst, and the assembler doesn't try to optimize it,
- * so the 'sib' form gets generated)
- *
- * this sequence is used to get the address of the return
- * buffer for a function that returns a structure
- */
- int pos;
- unsigned char buf[4];
- static unsigned char proto1[3] = { 0x87,0x04,0x24 };
- static unsigned char proto2[4] = { 0x87,0x44,0x24,0x00 };
- pos = codestream_tell ();
- codestream_read (buf, 4);
- if (bcmp (buf, proto1, 3) == 0)
- pos += 3;
- else if (bcmp (buf, proto2, 4) == 0)
- pos += 4;
-
- codestream_seek (pos);
- op = codestream_get (); /* update next opcode */
- }
-
- if (op == 0x55) /* pushl %esp */
- {
- /* check for movl %esp, %ebp - can be written two ways */
- switch (codestream_get ())
- {
- case 0x8b:
- if (codestream_get () != 0xec)
- return (-1);
- break;
- case 0x89:
- if (codestream_get () != 0xe5)
- return (-1);
- break;
- default:
- return (-1);
- }
- /* check for stack adjustment
- *
- * subl $XXX, %esp
- *
- * note: you can't subtract a 16 bit immediate
- * from a 32 bit reg, so we don't have to worry
- * about a data16 prefix
- */
- op = codestream_peek ();
- if (op == 0x83)
- {
- /* subl with 8 bit immed */
- codestream_get ();
- if (codestream_get () != 0xec)
- return (-1);
- /* subl with signed byte immediate
- * (though it wouldn't make sense to be negative)
- */
- return (codestream_get());
- }
- else if (op == 0x81)
- {
- /* subl with 32 bit immed */
- int locals;
- codestream_get();
- if (codestream_get () != 0xec)
- return (-1);
- /* subl with 32 bit immediate */
- codestream_read ((unsigned char *)&locals, 4);
- return (locals);
- }
- else
- {
- return (0);
- }
- }
- else if (op == 0xc8)
- {
- /* enter instruction: arg is 16 bit unsigned immed */
- unsigned short slocals;
- codestream_read ((unsigned char *)&slocals, 2);
- codestream_get (); /* flush final byte of enter instruction */
- return (slocals);
- }
- return (-1);
-}
-
-/* Return number of args passed to a frame.
- Can return -1, meaning no way to tell. */
-
-/* on the 386, the instruction following the call could be:
- * popl %ecx - one arg
- * addl $imm, %esp - imm/4 args; imm may be 8 or 32 bits
- * anything else - zero args
- */
-
-int
-i386_frame_num_args (fi)
- struct frame_info fi;
-{
- int retpc;
- unsigned char op;
- struct frame_info *pfi;
-
- pfi = get_prev_frame_info ((fi));
- if (pfi == 0)
- {
- /* Note: this can happen if we are looking at the frame for
- main, because FRAME_CHAIN_VALID won't let us go into
- start. If we have debugging symbols, that's not really
- a big deal; it just means it will only show as many arguments
- to main as are declared. */
- return -1;
- }
- else
- {
- retpc = pfi->pc;
- op = read_memory_integer (retpc, 1);
- if (op == 0x59)
- /* pop %ecx */
- return 1;
- else if (op == 0x83)
- {
- op = read_memory_integer (retpc+1, 1);
- if (op == 0xc4)
- /* addl $<signed imm 8 bits>, %esp */
- return (read_memory_integer (retpc+2,1)&0xff)/4;
- else
- return 0;
- }
- else if (op == 0x81)
- { /* add with 32 bit immediate */
- op = read_memory_integer (retpc+1, 1);
- if (op == 0xc4)
- /* addl $<imm 32>, %esp */
- return read_memory_integer (retpc+2, 4) / 4;
- else
- return 0;
- }
- else
- {
- return 0;
- }
- }
-}
-
-/*
- * parse the first few instructions of the function to see
- * what registers were stored.
- *
- * We handle these cases:
- *
- * The startup sequence can be at the start of the function,
- * or the function can start with a branch to startup code at the end.
- *
- * %ebp can be set up with either the 'enter' instruction, or
- * 'pushl %ebp, movl %esp, %ebp' (enter is too slow to be useful,
- * but was once used in the sys5 compiler)
- *
- * Local space is allocated just below the saved %ebp by either the
- * 'enter' instruction, or by 'subl $<size>, %esp'. 'enter' has
- * a 16 bit unsigned argument for space to allocate, and the
- * 'addl' instruction could have either a signed byte, or
- * 32 bit immediate.
- *
- * Next, the registers used by this function are pushed. In
- * the sys5 compiler they will always be in the order: %edi, %esi, %ebx
- * (and sometimes a harmless bug causes it to also save but not restore %eax);
- * however, the code below is willing to see the pushes in any order,
- * and will handle up to 8 of them.
- *
- * If the setup sequence is at the end of the function, then the
- * next instruction will be a branch back to the start.
- */
-
-i386_frame_find_saved_regs (fip, fsrp)
- struct frame_info *fip;
- struct frame_saved_regs *fsrp;
-{
- unsigned long locals;
- unsigned char *p;
- unsigned char op;
- CORE_ADDR dummy_bottom;
- CORE_ADDR adr;
- int i;
-
- bzero (fsrp, sizeof *fsrp);
-
- /* if frame is the end of a dummy, compute where the
- * beginning would be
- */
- dummy_bottom = fip->frame - 4 - NUM_REGS*4 - CALL_DUMMY_LENGTH;
-
- /* check if the PC is in the stack, in a dummy frame */
- if (dummy_bottom <= fip->pc && fip->pc <= fip->frame)
- {
- /* all regs were saved by push_call_dummy () */
- adr = fip->frame - 4;
- for (i = 0; i < NUM_REGS; i++)
- {
- fsrp->regs[i] = adr;
- adr -= 4;
- }
- return;
- }
-
- locals = i386_get_frame_setup (get_pc_function_start (fip->pc));
-
- if (locals >= 0)
- {
- adr = fip->frame - 4 - locals;
- for (i = 0; i < 8; i++)
- {
- op = codestream_get ();
- if (op < 0x50 || op > 0x57)
- break;
- fsrp->regs[op - 0x50] = adr;
- adr -= 4;
- }
- }
-
- fsrp->regs[PC_REGNUM] = fip->frame + 4;
- fsrp->regs[FP_REGNUM] = fip->frame;
-}
-
-/* return pc of first real instruction */
-i386_skip_prologue (pc)
-{
- unsigned char op;
- int i;
-
- if (i386_get_frame_setup (pc) < 0)
- return (pc);
-
- /* found valid frame setup - codestream now points to
- * start of push instructions for saving registers
- */
-
- /* skip over register saves */
- for (i = 0; i < 8; i++)
- {
- op = codestream_peek ();
- /* break if not pushl inst */
- if (op < 0x50 || op > 0x57)
- break;
- codestream_get ();
- }
-
- i386_follow_jump ();
-
- return (codestream_tell ());
-}
-
-i386_push_dummy_frame ()
-{
- CORE_ADDR sp = read_register (SP_REGNUM);
- int regnum;
-
- sp = push_word (sp, read_register (PC_REGNUM));
- sp = push_word (sp, read_register (FP_REGNUM));
- write_register (FP_REGNUM, sp);
- for (regnum = 0; regnum < NUM_REGS; regnum++)
- sp = push_word (sp, read_register (regnum));
- write_register (SP_REGNUM, sp);
-}
-
-i386_pop_frame ()
-{
- FRAME frame = get_current_frame ();
- CORE_ADDR fp;
- int regnum;
- struct frame_saved_regs fsr;
- struct frame_info *fi;
-
- fi = get_frame_info (frame);
- fp = fi->frame;
- get_frame_saved_regs (fi, &fsr);
- for (regnum = 0; regnum < NUM_REGS; regnum++)
- {
- CORE_ADDR adr;
- adr = fsr.regs[regnum];
- if (adr)
- write_register (regnum, read_memory_integer (adr, 4));
- }
- write_register (FP_REGNUM, read_memory_integer (fp, 4));
- write_register (PC_REGNUM, read_memory_integer (fp + 4, 4));
- write_register (SP_REGNUM, fp + 8);
- flush_cached_frames ();
- set_current_frame ( create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
-}
-
-/* this table must line up with REGISTER_NAMES in m-i386.h */
-/* symbols like 'EAX' come from <sys/reg.h> */
-static int regmap[] =
-{
- EAX, ECX, EDX, EBX,
- UESP, EBP, ESI, EDI,
- EIP, EFL, CS, SS,
- DS, ES, FS, GS,
-};
-
-/* blockend is the value of u.u_ar0, and points to the
- * place where GS is stored
- */
-i386_register_u_addr (blockend, regnum)
-{
-#if 0
- /* this will be needed if fp registers are reinstated */
- /* for now, you can look at them with 'info float'
- * sys5 wont let you change them with ptrace anyway
- */
- if (regnum >= FP0_REGNUM && regnum <= FP7_REGNUM)
- {
- int ubase, fpstate;
- struct user u;
- ubase = blockend + 4 * (SS + 1) - KSTKSZ;
- fpstate = ubase + ((char *)&u.u_fpstate - (char *)&u);
- return (fpstate + 0x1c + 10 * (regnum - FP0_REGNUM));
- }
- else
-#endif
- return (blockend + 4 * regmap[regnum]);
-
-}
-
-i387_to_double (from, to)
- char *from;
- char *to;
-{
- long *lp;
- /* push extended mode on 387 stack, then pop in double mode
- *
- * first, set exception masks so no error is generated -
- * number will be rounded to inf or 0, if necessary
- */
- asm ("pushl %eax"); /* grab a stack slot */
- asm ("fstcw (%esp)"); /* get 387 control word */
- asm ("movl (%esp),%eax"); /* save old value */
- asm ("orl $0x3f,%eax"); /* mask all exceptions */
- asm ("pushl %eax");
- asm ("fldcw (%esp)"); /* load new value into 387 */
-
- asm ("movl 8(%ebp),%eax");
- asm ("fldt (%eax)"); /* push extended number on 387 stack */
- asm ("fwait");
- asm ("movl 12(%ebp),%eax");
- asm ("fstpl (%eax)"); /* pop double */
- asm ("fwait");
-
- asm ("popl %eax"); /* flush modified control word */
- asm ("fnclex"); /* clear exceptions */
- asm ("fldcw (%esp)"); /* restore original control word */
- asm ("popl %eax"); /* flush saved copy */
-}
-
-double_to_i387 (from, to)
- char *from;
- char *to;
-{
- /* push double mode on 387 stack, then pop in extended mode
- * no errors are possible because every 64-bit pattern
- * can be converted to an extended
- */
- asm ("movl 8(%ebp),%eax");
- asm ("fldl (%eax)");
- asm ("fwait");
- asm ("movl 12(%ebp),%eax");
- asm ("fstpt (%eax)");
- asm ("fwait");
-}
-
-struct env387
-{
- unsigned short control;
- unsigned short r0;
- unsigned short status;
- unsigned short r1;
- unsigned short tag;
- unsigned short r2;
- unsigned long eip;
- unsigned short code_seg;
- unsigned short opcode;
- unsigned long operand;
- unsigned short operand_seg;
- unsigned short r3;
- unsigned char regs[8][10];
-};
-
-static
-print_387_control_word (control)
-unsigned short control;
-{
- printf ("control 0x%04x: ", control);
- printf ("compute to ");
- switch ((control >> 8) & 3)
- {
- case 0: printf ("24 bits; "); break;
- case 1: printf ("(bad); "); break;
- case 2: printf ("53 bits; "); break;
- case 3: printf ("64 bits; "); break;
- }
- printf ("round ");
- switch ((control >> 10) & 3)
- {
- case 0: printf ("NEAREST; "); break;
- case 1: printf ("DOWN; "); break;
- case 2: printf ("UP; "); break;
- case 3: printf ("CHOP; "); break;
- }
- if (control & 0x3f)
- {
- printf ("mask:");
- if (control & 0x0001) printf (" INVALID");
- if (control & 0x0002) printf (" DENORM");
- if (control & 0x0004) printf (" DIVZ");
- if (control & 0x0008) printf (" OVERF");
- if (control & 0x0010) printf (" UNDERF");
- if (control & 0x0020) printf (" LOS");
- printf (";");
- }
- printf ("\n");
- if (control & 0xe080) printf ("warning: reserved bits on 0x%x\n",
- control & 0xe080);
-}
-
-static
-print_387_status_word (status)
- unsigned short status;
-{
- printf ("status 0x%04x: ", status);
- if (status & 0xff)
- {
- printf ("exceptions:");
- if (status & 0x0001) printf (" INVALID");
- if (status & 0x0002) printf (" DENORM");
- if (status & 0x0004) printf (" DIVZ");
- if (status & 0x0008) printf (" OVERF");
- if (status & 0x0010) printf (" UNDERF");
- if (status & 0x0020) printf (" LOS");
- if (status & 0x0040) printf (" FPSTACK");
- printf ("; ");
- }
- printf ("flags: %d%d%d%d; ",
- (status & 0x4000) != 0,
- (status & 0x0400) != 0,
- (status & 0x0200) != 0,
- (status & 0x0100) != 0);
-
- printf ("top %d\n", (status >> 11) & 7);
-}
-
-static
-print_387_status (status, ep)
- unsigned short status;
- struct env387 *ep;
-{
- int i;
- int bothstatus;
- int top;
- int fpreg;
- unsigned char *p;
-
- bothstatus = ((status != 0) && (ep->status != 0));
- if (status != 0)
- {
- if (bothstatus)
- printf ("u: ");
- print_387_status_word (status);
- }
-
- if (ep->status != 0)
- {
- if (bothstatus)
- printf ("e: ");
- print_387_status_word (ep->status);
- }
-
- print_387_control_word (ep->control);
- printf ("last exception: ");
- printf ("opcode 0x%x; ", ep->opcode);
- printf ("pc 0x%x:0x%x; ", ep->code_seg, ep->eip);
- printf ("operand 0x%x:0x%x\n", ep->operand_seg, ep->operand);
-
- top = (ep->status >> 11) & 7;
-
- printf ("regno tag msb lsb value\n");
- for (fpreg = 7; fpreg >= 0; fpreg--)
- {
- double val;
-
- printf ("%s %d: ", fpreg == top ? "=>" : " ", fpreg);
-
- switch ((ep->tag >> (fpreg * 2)) & 3)
- {
- case 0: printf ("valid "); break;
- case 1: printf ("zero "); break;
- case 2: printf ("trap "); break;
- case 3: printf ("empty "); break;
- }
- for (i = 9; i >= 0; i--)
- printf ("%02x", ep->regs[fpreg][i]);
-
- i387_to_double (ep->regs[fpreg], (char *)&val);
- printf (" %g\n", val);
- }
- if (ep->r0)
- printf ("warning: reserved0 is 0x%x\n", ep->r0);
- if (ep->r1)
- printf ("warning: reserved1 is 0x%x\n", ep->r1);
- if (ep->r2)
- printf ("warning: reserved2 is 0x%x\n", ep->r2);
- if (ep->r3)
- printf ("warning: reserved3 is 0x%x\n", ep->r3);
-}
-
-#ifndef U_FPSTATE
-#define U_FPSTATE(u) u.u_fpstate
-#endif
-
-i386_float_info ()
-{
- struct user u; /* just for address computations */
- int i;
- /* fpstate defined in <sys/user.h> */
- struct fpstate *fpstatep;
- char buf[sizeof (struct fpstate) + 2 * sizeof (int)];
- unsigned int uaddr;
- char fpvalid;
- unsigned int rounded_addr;
- unsigned int rounded_size;
- extern int corechan;
- int skip;
-
- uaddr = (char *)&u.u_fpvalid - (char *)&u;
- if (have_inferior_p())
- {
- unsigned int data;
- unsigned int mask;
-
- rounded_addr = uaddr & -sizeof (int);
- data = ptrace (3, inferior_pid, rounded_addr, 0);
- mask = 0xff << ((uaddr - rounded_addr) * 8);
-
- fpvalid = ((data & mask) != 0);
- }
- else
- {
- if (lseek (corechan, uaddr, 0) < 0)
- perror ("seek on core file");
- if (myread (corechan, &fpvalid, 1) < 0)
- perror ("read on core file");
-
- }
-
- if (fpvalid == 0)
- {
- printf ("no floating point status saved\n");
- return;
- }
-
- uaddr = (char *)&U_FPSTATE(u) - (char *)&u;
- if (have_inferior_p ())
- {
- int *ip;
-
- rounded_addr = uaddr & -sizeof (int);
- rounded_size = (((uaddr + sizeof (struct fpstate)) - uaddr) +
- sizeof (int) - 1) / sizeof (int);
- skip = uaddr - rounded_addr;
-
- ip = (int *)buf;
- for (i = 0; i < rounded_size; i++)
- {
- *ip++ = ptrace (3, inferior_pid, rounded_addr, 0);
- rounded_addr += sizeof (int);
- }
- }
- else
- {
- if (lseek (corechan, uaddr, 0) < 0)
- perror_with_name ("seek on core file");
- if (myread (corechan, buf, sizeof (struct fpstate)) < 0)
- perror_with_name ("read from core file");
- skip = 0;
- }
-
- fpstatep = (struct fpstate *)(buf + skip);
- print_387_status (fpstatep->status, (struct env387 *)fpstatep->state);
-}
-
diff --git a/gnu/usr.bin/gdb/config/i386-pinsn.c b/gnu/usr.bin/gdb/config/i386-pinsn.c
deleted file mode 100644
index 649baaf..0000000
--- a/gnu/usr.bin/gdb/config/i386-pinsn.c
+++ /dev/null
@@ -1,1812 +0,0 @@
-/* Print i386 instructions for GDB, the GNU debugger.
- Copyright (C) 1988, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/*
- * 80386 instruction printer by Pace Willisson (pace@prep.ai.mit.edu)
- * July 1988
- */
-
-/*
- * The main tables describing the instructions is essentially a copy
- * of the "Opcode Map" chapter (Appendix A) of the Intel 80386
- * Programmers Manual. Usually, there is a capital letter, followed
- * by a small letter. The capital letter tell the addressing mode,
- * and the small letter tells about the operand size. Refer to
- * the Intel manual for details.
- */
-
-#include <stdio.h>
-#include <ctype.h>
-
-#define Eb OP_E, b_mode
-#define indirEb OP_indirE, b_mode
-#define Gb OP_G, b_mode
-#define Ev OP_E, v_mode
-#define indirEv OP_indirE, v_mode
-#define Ew OP_E, w_mode
-#define Ma OP_E, v_mode
-#define M OP_E, 0
-#define Mp OP_E, 0 /* ? */
-#define Gv OP_G, v_mode
-#define Gw OP_G, w_mode
-#define Rw OP_rm, w_mode
-#define Rd OP_rm, d_mode
-#define Ib OP_I, b_mode
-#define sIb OP_sI, b_mode /* sign extened byte */
-#define Iv OP_I, v_mode
-#define Iw OP_I, w_mode
-#define Jb OP_J, b_mode
-#define Jv OP_J, v_mode
-#define ONE OP_ONE, 0
-#define Cd OP_C, d_mode
-#define Dd OP_D, d_mode
-#define Td OP_T, d_mode
-
-#define eAX OP_REG, eAX_reg
-#define eBX OP_REG, eBX_reg
-#define eCX OP_REG, eCX_reg
-#define eDX OP_REG, eDX_reg
-#define eSP OP_REG, eSP_reg
-#define eBP OP_REG, eBP_reg
-#define eSI OP_REG, eSI_reg
-#define eDI OP_REG, eDI_reg
-#define AL OP_REG, al_reg
-#define CL OP_REG, cl_reg
-#define DL OP_REG, dl_reg
-#define BL OP_REG, bl_reg
-#define AH OP_REG, ah_reg
-#define CH OP_REG, ch_reg
-#define DH OP_REG, dh_reg
-#define BH OP_REG, bh_reg
-#define AX OP_REG, ax_reg
-#define DX OP_REG, dx_reg
-#define indirDX OP_REG, indir_dx_reg
-
-#define Sw OP_SEG, w_mode
-#define Ap OP_DIR, lptr
-#define Av OP_DIR, v_mode
-#define Ob OP_OFF, b_mode
-#define Ov OP_OFF, v_mode
-#define Xb OP_DSSI, b_mode
-#define Xv OP_DSSI, v_mode
-#define Yb OP_ESDI, b_mode
-#define Yv OP_ESDI, v_mode
-
-#define es OP_REG, es_reg
-#define ss OP_REG, ss_reg
-#define cs OP_REG, cs_reg
-#define ds OP_REG, ds_reg
-#define fs OP_REG, fs_reg
-#define gs OP_REG, gs_reg
-
-int OP_E(), OP_indirE(), OP_G(), OP_I(), OP_sI(), OP_REG();
-int OP_J(), OP_SEG();
-int OP_DIR(), OP_OFF(), OP_DSSI(), OP_ESDI(), OP_ONE(), OP_C();
-int OP_D(), OP_T(), OP_rm();
-
-
-#define b_mode 1
-#define v_mode 2
-#define w_mode 3
-#define d_mode 4
-
-#define es_reg 100
-#define cs_reg 101
-#define ss_reg 102
-#define ds_reg 103
-#define fs_reg 104
-#define gs_reg 105
-#define eAX_reg 107
-#define eCX_reg 108
-#define eDX_reg 109
-#define eBX_reg 110
-#define eSP_reg 111
-#define eBP_reg 112
-#define eSI_reg 113
-#define eDI_reg 114
-
-#define lptr 115
-
-#define al_reg 116
-#define cl_reg 117
-#define dl_reg 118
-#define bl_reg 119
-#define ah_reg 120
-#define ch_reg 121
-#define dh_reg 122
-#define bh_reg 123
-
-#define ax_reg 124
-#define cx_reg 125
-#define dx_reg 126
-#define bx_reg 127
-#define sp_reg 128
-#define bp_reg 129
-#define si_reg 130
-#define di_reg 131
-
-#define indir_dx_reg 150
-
-#define GRP1b NULL, NULL, 0
-#define GRP1S NULL, NULL, 1
-#define GRP1Ss NULL, NULL, 2
-#define GRP2b NULL, NULL, 3
-#define GRP2S NULL, NULL, 4
-#define GRP2b_one NULL, NULL, 5
-#define GRP2S_one NULL, NULL, 6
-#define GRP2b_cl NULL, NULL, 7
-#define GRP2S_cl NULL, NULL, 8
-#define GRP3b NULL, NULL, 9
-#define GRP3S NULL, NULL, 10
-#define GRP4 NULL, NULL, 11
-#define GRP5 NULL, NULL, 12
-#define GRP6 NULL, NULL, 13
-#define GRP7 NULL, NULL, 14
-#define GRP8 NULL, NULL, 15
-
-#define FLOATCODE 50
-#define FLOAT NULL, NULL, FLOATCODE
-
-struct dis386 {
- char *name;
- int (*op1)();
- int bytemode1;
- int (*op2)();
- int bytemode2;
- int (*op3)();
- int bytemode3;
-};
-
-struct dis386 dis386[] = {
- /* 00 */
- { "addb", Eb, Gb },
- { "addS", Ev, Gv },
- { "addb", Gb, Eb },
- { "addS", Gv, Ev },
- { "addb", AL, Ib },
- { "addS", eAX, Iv },
- { "pushl", es },
- { "popl", es },
- /* 08 */
- { "orb", Eb, Gb },
- { "orS", Ev, Gv },
- { "orb", Gb, Eb },
- { "orS", Gv, Ev },
- { "orb", AL, Ib },
- { "orS", eAX, Iv },
- { "pushl", cs },
- { "(bad)" }, /* 0x0f extended opcode escape */
- /* 10 */
- { "adcb", Eb, Gb },
- { "adcS", Ev, Gv },
- { "adcb", Gb, Eb },
- { "adcS", Gv, Ev },
- { "adcb", AL, Ib },
- { "adcS", eAX, Iv },
- { "pushl", ss },
- { "popl", ss },
- /* 18 */
- { "sbbb", Eb, Gb },
- { "sbbS", Ev, Gv },
- { "sbbb", Gb, Eb },
- { "sbbS", Gv, Ev },
- { "sbbb", AL, Ib },
- { "sbbS", eAX, Iv },
- { "pushl", ds },
- { "popl", ds },
- /* 20 */
- { "andb", Eb, Gb },
- { "andS", Ev, Gv },
- { "andb", Gb, Eb },
- { "andS", Gv, Ev },
- { "andb", AL, Ib },
- { "andS", eAX, Iv },
- { "(bad)" }, /* SEG ES prefix */
- { "daa" },
- /* 28 */
- { "subb", Eb, Gb },
- { "subS", Ev, Gv },
- { "subb", Gb, Eb },
- { "subS", Gv, Ev },
- { "subb", AL, Ib },
- { "subS", eAX, Iv },
- { "(bad)" }, /* SEG CS prefix */
- { "das" },
- /* 30 */
- { "xorb", Eb, Gb },
- { "xorS", Ev, Gv },
- { "xorb", Gb, Eb },
- { "xorS", Gv, Ev },
- { "xorb", AL, Ib },
- { "xorS", eAX, Iv },
- { "(bad)" }, /* SEG SS prefix */
- { "aaa" },
- /* 38 */
- { "cmpb", Eb, Gb },
- { "cmpS", Ev, Gv },
- { "cmpb", Gb, Eb },
- { "cmpS", Gv, Ev },
- { "cmpb", AL, Ib },
- { "cmpS", eAX, Iv },
- { "(bad)" }, /* SEG DS prefix */
- { "aas" },
- /* 40 */
- { "incS", eAX },
- { "incS", eCX },
- { "incS", eDX },
- { "incS", eBX },
- { "incS", eSP },
- { "incS", eBP },
- { "incS", eSI },
- { "incS", eDI },
- /* 48 */
- { "decS", eAX },
- { "decS", eCX },
- { "decS", eDX },
- { "decS", eBX },
- { "decS", eSP },
- { "decS", eBP },
- { "decS", eSI },
- { "decS", eDI },
- /* 50 */
- { "pushS", eAX },
- { "pushS", eCX },
- { "pushS", eDX },
- { "pushS", eBX },
- { "pushS", eSP },
- { "pushS", eBP },
- { "pushS", eSI },
- { "pushS", eDI },
- /* 58 */
- { "popS", eAX },
- { "popS", eCX },
- { "popS", eDX },
- { "popS", eBX },
- { "popS", eSP },
- { "popS", eBP },
- { "popS", eSI },
- { "popS", eDI },
- /* 60 */
- { "pusha" },
- { "popa" },
- { "boundS", Gv, Ma },
- { "arpl", Ew, Gw },
- { "(bad)" }, /* seg fs */
- { "(bad)" }, /* seg gs */
- { "(bad)" }, /* op size prefix */
- { "(bad)" }, /* adr size prefix */
- /* 68 */
- { "pushS", Iv }, /* 386 book wrong */
- { "imulS", Gv, Ev, Iv },
- { "pushl", sIb }, /* push of byte really pushes 4 bytes */
- { "imulS", Gv, Ev, Ib },
- { "insb", Yb, indirDX },
- { "insS", Yv, indirDX },
- { "outsb", indirDX, Xb },
- { "outsS", indirDX, Xv },
- /* 70 */
- { "jo", Jb },
- { "jno", Jb },
- { "jb", Jb },
- { "jae", Jb },
- { "je", Jb },
- { "jne", Jb },
- { "jbe", Jb },
- { "ja", Jb },
- /* 78 */
- { "js", Jb },
- { "jns", Jb },
- { "jp", Jb },
- { "jnp", Jb },
- { "jl", Jb },
- { "jnl", Jb },
- { "jle", Jb },
- { "jg", Jb },
- /* 80 */
- { GRP1b },
- { GRP1S },
- { "(bad)" },
- { GRP1Ss },
- { "testb", Eb, Gb },
- { "testS", Ev, Gv },
- { "xchgb", Eb, Gb },
- { "xchgS", Ev, Gv },
- /* 88 */
- { "movb", Eb, Gb },
- { "movS", Ev, Gv },
- { "movb", Gb, Eb },
- { "movS", Gv, Ev },
- { "movw", Ew, Sw },
- { "leaS", Gv, M },
- { "movw", Sw, Ew },
- { "popS", Ev },
- /* 90 */
- { "nop" },
- { "xchgS", eCX, eAX },
- { "xchgS", eDX, eAX },
- { "xchgS", eBX, eAX },
- { "xchgS", eSP, eAX },
- { "xchgS", eBP, eAX },
- { "xchgS", eSI, eAX },
- { "xchgS", eDI, eAX },
- /* 98 */
- { "cwtl" },
- { "cltd" },
- { "lcall", Ap },
- { "(bad)" }, /* fwait */
- { "pushf" },
- { "popf" },
- { "sahf" },
- { "lahf" },
- /* a0 */
- { "movb", AL, Ob },
- { "movS", eAX, Ov },
- { "movb", Ob, AL },
- { "movS", Ov, eAX },
- { "movsb", Yb, Xb },
- { "movsS", Yv, Xv },
- { "cmpsb", Yb, Xb },
- { "cmpsS", Yv, Xv },
- /* a8 */
- { "testb", AL, Ib },
- { "testS", eAX, Iv },
- { "stosb", Yb, AL },
- { "stosS", Yv, eAX },
- { "lodsb", AL, Xb },
- { "lodsS", eAX, Xv },
- { "scasb", AL, Xb },
- { "scasS", eAX, Xv },
- /* b0 */
- { "movb", AL, Ib },
- { "movb", CL, Ib },
- { "movb", DL, Ib },
- { "movb", BL, Ib },
- { "movb", AH, Ib },
- { "movb", CH, Ib },
- { "movb", DH, Ib },
- { "movb", BH, Ib },
- /* b8 */
- { "movS", eAX, Iv },
- { "movS", eCX, Iv },
- { "movS", eDX, Iv },
- { "movS", eBX, Iv },
- { "movS", eSP, Iv },
- { "movS", eBP, Iv },
- { "movS", eSI, Iv },
- { "movS", eDI, Iv },
- /* c0 */
- { GRP2b },
- { GRP2S },
- { "ret", Iw },
- { "ret" },
- { "lesS", Gv, Mp },
- { "ldsS", Gv, Mp },
- { "movb", Eb, Ib },
- { "movS", Ev, Iv },
- /* c8 */
- { "enter", Iw, Ib },
- { "leave" },
- { "lret", Iw },
- { "lret" },
- { "int3" },
- { "int", Ib },
- { "into" },
- { "iret" },
- /* d0 */
- { GRP2b_one },
- { GRP2S_one },
- { GRP2b_cl },
- { GRP2S_cl },
- { "aam", Ib },
- { "aad", Ib },
- { "(bad)" },
- { "xlat" },
- /* d8 */
- { FLOAT },
- { FLOAT },
- { FLOAT },
- { FLOAT },
- { FLOAT },
- { FLOAT },
- { FLOAT },
- { FLOAT },
- /* e0 */
- { "loopne", Jb },
- { "loope", Jb },
- { "loop", Jb },
- { "jCcxz", Jb },
- { "inb", AL, Ib },
- { "inS", eAX, Ib },
- { "outb", Ib, AL },
- { "outS", Ib, eAX },
- /* e8 */
- { "call", Av },
- { "jmp", Jv },
- { "ljmp", Ap },
- { "jmp", Jb },
- { "inb", AL, indirDX },
- { "inS", eAX, indirDX },
- { "outb", indirDX, AL },
- { "outS", indirDX, eAX },
- /* f0 */
- { "(bad)" }, /* lock prefix */
- { "(bad)" },
- { "(bad)" }, /* repne */
- { "(bad)" }, /* repz */
- { "hlt" },
- { "cmc" },
- { GRP3b },
- { GRP3S },
- /* f8 */
- { "clc" },
- { "stc" },
- { "cli" },
- { "sti" },
- { "cld" },
- { "std" },
- { GRP4 },
- { GRP5 },
-};
-
-struct dis386 dis386_twobyte[] = {
- /* 00 */
- { GRP6 },
- { GRP7 },
- { "larS", Gv, Ew },
- { "lslS", Gv, Ew },
- { "(bad)" },
- { "(bad)" },
- { "clts" },
- { "(bad)" },
- /* 08 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* 10 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* 18 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* 20 */
- /* these are all backward in appendix A of the intel book */
- { "movl", Rd, Cd },
- { "movl", Rd, Dd },
- { "movl", Cd, Rd },
- { "movl", Dd, Rd },
- { "movl", Rd, Td },
- { "(bad)" },
- { "movl", Td, Rd },
- { "(bad)" },
- /* 28 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* 30 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* 38 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* 40 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* 48 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* 50 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* 58 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* 60 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* 68 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* 70 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* 78 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* 80 */
- { "jo", Jv },
- { "jno", Jv },
- { "jb", Jv },
- { "jae", Jv },
- { "je", Jv },
- { "jne", Jv },
- { "jbe", Jv },
- { "ja", Jv },
- /* 88 */
- { "js", Jv },
- { "jns", Jv },
- { "jp", Jv },
- { "jnp", Jv },
- { "jl", Jv },
- { "jge", Jv },
- { "jle", Jv },
- { "jg", Jv },
- /* 90 */
- { "seto", Eb },
- { "setno", Eb },
- { "setb", Eb },
- { "setae", Eb },
- { "sete", Eb },
- { "setne", Eb },
- { "setbe", Eb },
- { "seta", Eb },
- /* 98 */
- { "sets", Eb },
- { "setns", Eb },
- { "setp", Eb },
- { "setnp", Eb },
- { "setl", Eb },
- { "setge", Eb },
- { "setle", Eb },
- { "setg", Eb },
- /* a0 */
- { "pushl", fs },
- { "popl", fs },
- { "(bad)" },
- { "btS", Ev, Gv },
- { "shldS", Ev, Gv, Ib },
- { "shldS", Ev, Gv, CL },
- { "(bad)" },
- { "(bad)" },
- /* a8 */
- { "pushl", gs },
- { "popl", gs },
- { "(bad)" },
- { "btsS", Ev, Gv },
- { "shrdS", Ev, Gv, Ib },
- { "shrdS", Ev, Gv, CL },
- { "(bad)" },
- { "imulS", Gv, Ev },
- /* b0 */
- { "(bad)" },
- { "(bad)" },
- { "lssS", Gv, Mp }, /* 386 lists only Mp */
- { "btrS", Ev, Gv },
- { "lfsS", Gv, Mp }, /* 386 lists only Mp */
- { "lgsS", Gv, Mp }, /* 386 lists only Mp */
- { "movzbS", Gv, Eb },
- { "movzwS", Gv, Ew },
- /* b8 */
- { "(bad)" },
- { "(bad)" },
- { GRP8 },
- { "btcS", Ev, Gv },
- { "bsfS", Gv, Ev },
- { "bsrS", Gv, Ev },
- { "movsbS", Gv, Eb },
- { "movswS", Gv, Ew },
- /* c0 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* c8 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* d0 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* d8 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* e0 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* e8 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* f0 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- /* f8 */
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
- { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" },
-};
-
-static char obuf[100];
-static char *obufp;
-static char scratchbuf[100];
-static unsigned char *start_codep;
-static unsigned char *codep;
-static int mod;
-static int rm;
-static int reg;
-
-static char *names32[]={
- "%eax","%ecx","%edx","%ebx", "%esp","%ebp","%esi","%edi",
-};
-static char *names16[] = {
- "%ax","%cx","%dx","%bx","%sp","%bp","%si","%di",
-};
-static char *names8[] = {
- "%al","%cl","%dl","%bl","%ah","%ch","%dh","%bh",
-};
-static char *names_seg[] = {
- "%es","%cs","%ss","%ds","%fs","%gs","%?","%?",
-};
-
-struct dis386 grps[][8] = {
- /* GRP1b */
- {
- { "addb", Eb, Ib },
- { "orb", Eb, Ib },
- { "adcb", Eb, Ib },
- { "sbbb", Eb, Ib },
- { "andb", Eb, Ib },
- { "subb", Eb, Ib },
- { "xorb", Eb, Ib },
- { "cmpb", Eb, Ib }
- },
- /* GRP1S */
- {
- { "addS", Ev, Iv },
- { "orS", Ev, Iv },
- { "adcS", Ev, Iv },
- { "sbbS", Ev, Iv },
- { "andS", Ev, Iv },
- { "subS", Ev, Iv },
- { "xorS", Ev, Iv },
- { "cmpS", Ev, Iv }
- },
- /* GRP1Ss */
- {
- { "addS", Ev, sIb },
- { "orS", Ev, sIb },
- { "adcS", Ev, sIb },
- { "sbbS", Ev, sIb },
- { "andS", Ev, sIb },
- { "subS", Ev, sIb },
- { "xorS", Ev, sIb },
- { "cmpS", Ev, sIb }
- },
- /* GRP2b */
- {
- { "rolb", Eb, Ib },
- { "rorb", Eb, Ib },
- { "rclb", Eb, Ib },
- { "rcrb", Eb, Ib },
- { "shlb", Eb, Ib },
- { "shrb", Eb, Ib },
- { "(bad)" },
- { "sarb", Eb, Ib },
- },
- /* GRP2S */
- {
- { "rolS", Ev, Ib },
- { "rorS", Ev, Ib },
- { "rclS", Ev, Ib },
- { "rcrS", Ev, Ib },
- { "shlS", Ev, Ib },
- { "shrS", Ev, Ib },
- { "(bad)" },
- { "sarS", Ev, Ib },
- },
- /* GRP2b_one */
- {
- { "rolb", Eb },
- { "rorb", Eb },
- { "rclb", Eb },
- { "rcrb", Eb },
- { "shlb", Eb },
- { "shrb", Eb },
- { "(bad)" },
- { "sarb", Eb },
- },
- /* GRP2S_one */
- {
- { "rolS", Ev },
- { "rorS", Ev },
- { "rclS", Ev },
- { "rcrS", Ev },
- { "shlS", Ev },
- { "shrS", Ev },
- { "(bad)" },
- { "sarS", Ev },
- },
- /* GRP2b_cl */
- {
- { "rolb", Eb, CL },
- { "rorb", Eb, CL },
- { "rclb", Eb, CL },
- { "rcrb", Eb, CL },
- { "shlb", Eb, CL },
- { "shrb", Eb, CL },
- { "(bad)" },
- { "sarb", Eb, CL },
- },
- /* GRP2S_cl */
- {
- { "rolS", Ev, CL },
- { "rorS", Ev, CL },
- { "rclS", Ev, CL },
- { "rcrS", Ev, CL },
- { "shlS", Ev, CL },
- { "shrS", Ev, CL },
- { "(bad)" },
- { "sarS", Ev, CL }
- },
- /* GRP3b */
- {
- { "testb", Eb, Ib },
- { "(bad)", Eb },
- { "notb", Eb },
- { "negb", Eb },
- { "mulb", AL, Eb },
- { "imulb", AL, Eb },
- { "divb", AL, Eb },
- { "idivb", AL, Eb }
- },
- /* GRP3S */
- {
- { "testS", Ev, Iv },
- { "(bad)" },
- { "notS", Ev },
- { "negS", Ev },
- { "mulS", eAX, Ev },
- { "imulS", eAX, Ev },
- { "divS", eAX, Ev },
- { "idivS", eAX, Ev },
- },
- /* GRP4 */
- {
- { "incb", Eb },
- { "decb", Eb },
- { "(bad)" },
- { "(bad)" },
- { "(bad)" },
- { "(bad)" },
- { "(bad)" },
- { "(bad)" },
- },
- /* GRP5 */
- {
- { "incS", Ev },
- { "decS", Ev },
- { "call", indirEv },
- { "lcall", indirEv },
- { "jmp", indirEv },
- { "ljmp", indirEv },
- { "pushS", Ev },
- { "(bad)" },
- },
- /* GRP6 */
- {
- { "sldt", Ew },
- { "str", Ew },
- { "lldt", Ew },
- { "ltr", Ew },
- { "verr", Ew },
- { "verw", Ew },
- { "(bad)" },
- { "(bad)" }
- },
- /* GRP7 */
- {
- { "sgdt", Ew },
- { "sidt", Ew },
- { "lgdt", Ew },
- { "lidt", Ew },
- { "smsw", Ew },
- { "(bad)" },
- { "lmsw", Ew },
- { "(bad)" },
- },
- /* GRP8 */
- {
- { "(bad)" },
- { "(bad)" },
- { "(bad)" },
- { "(bad)" },
- { "btS", Ev, Ib },
- { "btsS", Ev, Ib },
- { "btrS", Ev, Ib },
- { "btcS", Ev, Ib },
- }
-};
-
-#define PREFIX_REPZ 1
-#define PREFIX_REPNZ 2
-#define PREFIX_LOCK 4
-#define PREFIX_CS 8
-#define PREFIX_SS 0x10
-#define PREFIX_DS 0x20
-#define PREFIX_ES 0x40
-#define PREFIX_FS 0x80
-#define PREFIX_GS 0x100
-#define PREFIX_DATA 0x200
-#define PREFIX_ADR 0x400
-#define PREFIX_FWAIT 0x800
-
-static int prefixes;
-
-ckprefix ()
-{
- prefixes = 0;
- while (1)
- {
- switch (*codep)
- {
- case 0xf3:
- prefixes |= PREFIX_REPZ;
- break;
- case 0xf2:
- prefixes |= PREFIX_REPNZ;
- break;
- case 0xf0:
- prefixes |= PREFIX_LOCK;
- break;
- case 0x2e:
- prefixes |= PREFIX_CS;
- break;
- case 0x36:
- prefixes |= PREFIX_SS;
- break;
- case 0x3e:
- prefixes |= PREFIX_DS;
- break;
- case 0x26:
- prefixes |= PREFIX_ES;
- break;
- case 0x64:
- prefixes |= PREFIX_FS;
- break;
- case 0x65:
- prefixes |= PREFIX_GS;
- break;
- case 0x66:
- prefixes |= PREFIX_DATA;
- break;
- case 0x67:
- prefixes |= PREFIX_ADR;
- break;
- case 0x9b:
- prefixes |= PREFIX_FWAIT;
- break;
- default:
- return;
- }
- codep++;
- }
-}
-
-static int dflag;
-static int aflag;
-
-static char op1out[100], op2out[100], op3out[100];
-static int start_pc;
-
-/*
- * disassemble the first instruction in 'inbuf'. You have to make
- * sure all of the bytes of the instruction are filled in.
- * On the 386's of 1988, the maximum length of an instruction is 15 bytes.
- * (see topic "Redundant prefixes" in the "Differences from 8086"
- * section of the "Virtual 8086 Mode" chapter.)
- * 'pc' should be the address of this instruction, it will
- * be used to print the target address if this is a relative jump or call
- * 'outbuf' gets filled in with the disassembled instruction. it should
- * be long enough to hold the longest disassembled instruction.
- * 100 bytes is certainly enough, unless symbol printing is added later
- * The function returns the length of this instruction in bytes.
- */
-i386dis (pc, inbuf, outbuf)
- int pc;
- unsigned char *inbuf;
- char *outbuf;
-{
- struct dis386 *dp;
- char *p;
- int i;
- int enter_instruction;
- char *first, *second, *third;
- int needcomma;
-
- obuf[0] = 0;
- op1out[0] = 0;
- op2out[0] = 0;
- op3out[0] = 0;
-
- start_pc = pc;
- start_codep = inbuf;
- codep = inbuf;
-
- ckprefix ();
-
- if (*codep == 0xc8)
- enter_instruction = 1;
- else
- enter_instruction = 0;
-
- obufp = obuf;
-
- if (prefixes & PREFIX_REPZ)
- oappend ("repz ");
- if (prefixes & PREFIX_REPNZ)
- oappend ("repnz ");
- if (prefixes & PREFIX_LOCK)
- oappend ("lock ");
-
- if ((prefixes & PREFIX_FWAIT)
- && ((*codep < 0xd8) || (*codep > 0xdf)))
- {
- /* fwait not followed by floating point instruction */
- oappend ("fwait");
- strcpy (outbuf, obuf);
- return (1);
- }
-
- /* these would be initialized to 0 if disassembling for 8086 or 286 */
- dflag = 1;
- aflag = 1;
-
- if (prefixes & PREFIX_DATA)
- dflag ^= 1;
-
- if (prefixes & PREFIX_ADR)
- {
- aflag ^= 1;
- oappend ("addr16 ");
- }
-
- if (*codep == 0x0f)
- dp = &dis386_twobyte[*++codep];
- else
- dp = &dis386[*codep];
- codep++;
- mod = (*codep >> 6) & 3;
- reg = (*codep >> 3) & 7;
- rm = *codep & 7;
-
- if (dp->name == NULL && dp->bytemode1 == FLOATCODE)
- {
- dofloat ();
- }
- else
- {
- if (dp->name == NULL)
- dp = &grps[dp->bytemode1][reg];
-
- putop (dp->name);
-
- obufp = op1out;
- if (dp->op1)
- (*dp->op1)(dp->bytemode1);
-
- obufp = op2out;
- if (dp->op2)
- (*dp->op2)(dp->bytemode2);
-
- obufp = op3out;
- if (dp->op3)
- (*dp->op3)(dp->bytemode3);
- }
-
- obufp = obuf + strlen (obuf);
- for (i = strlen (obuf); i < 6; i++)
- oappend (" ");
- oappend (" ");
-
- /* enter instruction is printed with operands in the
- * same order as the intel book; everything else
- * is printed in reverse order
- */
- if (enter_instruction)
- {
- first = op1out;
- second = op2out;
- third = op3out;
- }
- else
- {
- first = op3out;
- second = op2out;
- third = op1out;
- }
- needcomma = 0;
- if (*first)
- {
- oappend (first);
- needcomma = 1;
- }
- if (*second)
- {
- if (needcomma)
- oappend (",");
- oappend (second);
- needcomma = 1;
- }
- if (*third)
- {
- if (needcomma)
- oappend (",");
- oappend (third);
- }
- strcpy (outbuf, obuf);
- return (codep - inbuf);
-}
-
-char *float_mem[] = {
- /* d8 */
- "fadds",
- "fmuls",
- "fcoms",
- "fcomps",
- "fsubs",
- "fsubrs",
- "fdivs",
- "fdivrs",
- /* d9 */
- "flds",
- "(bad)",
- "fsts",
- "fstps",
- "fldenv",
- "fldcw",
- "fNstenv",
- "fNstcw",
- /* da */
- "fiaddl",
- "fimull",
- "ficoml",
- "ficompl",
- "fisubl",
- "fisubrl",
- "fidivl",
- "fidivrl",
- /* db */
- "fildl",
- "(bad)",
- "fistl",
- "fistpl",
- "(bad)",
- "fldt",
- "(bad)",
- "fstpt",
- /* dc */
- "faddl",
- "fmull",
- "fcoml",
- "fcompl",
- "fsubl",
- "fsubrl",
- "fdivl",
- "fdivrl",
- /* dd */
- "fldl",
- "(bad)",
- "fstl",
- "fstpl",
- "frstor",
- "(bad)",
- "fNsave",
- "fNstsw",
- /* de */
- "fiadd",
- "fimul",
- "ficom",
- "ficomp",
- "fisub",
- "fisubr",
- "fidiv",
- "fidivr",
- /* df */
- "fild",
- "(bad)",
- "fist",
- "fistp",
- "fbld",
- "fildll",
- "fbstp",
- "fistpll",
-};
-
-#define ST OP_ST, 0
-#define STi OP_STi, 0
-int OP_ST(), OP_STi();
-
-#define FGRPd9_2 NULL, NULL, 0
-#define FGRPd9_4 NULL, NULL, 1
-#define FGRPd9_5 NULL, NULL, 2
-#define FGRPd9_6 NULL, NULL, 3
-#define FGRPd9_7 NULL, NULL, 4
-#define FGRPda_5 NULL, NULL, 5
-#define FGRPdb_4 NULL, NULL, 6
-#define FGRPde_3 NULL, NULL, 7
-#define FGRPdf_4 NULL, NULL, 8
-
-struct dis386 float_reg[][8] = {
- /* d8 */
- {
- { "fadd", ST, STi },
- { "fmul", ST, STi },
- { "fcom", STi },
- { "fcomp", STi },
- { "fsub", ST, STi },
- { "fsubr", ST, STi },
- { "fdiv", ST, STi },
- { "fdivr", ST, STi },
- },
- /* d9 */
- {
- { "fld", STi },
- { "fxch", STi },
- { FGRPd9_2 },
- { "(bad)" },
- { FGRPd9_4 },
- { FGRPd9_5 },
- { FGRPd9_6 },
- { FGRPd9_7 },
- },
- /* da */
- {
- { "(bad)" },
- { "(bad)" },
- { "(bad)" },
- { "(bad)" },
- { "(bad)" },
- { FGRPda_5 },
- { "(bad)" },
- { "(bad)" },
- },
- /* db */
- {
- { "(bad)" },
- { "(bad)" },
- { "(bad)" },
- { "(bad)" },
- { FGRPdb_4 },
- { "(bad)" },
- { "(bad)" },
- { "(bad)" },
- },
- /* dc */
- {
- { "fadd", STi, ST },
- { "fmul", STi, ST },
- { "(bad)" },
- { "(bad)" },
- { "fsub", STi, ST },
- { "fsubr", STi, ST },
- { "fdiv", STi, ST },
- { "fdivr", STi, ST },
- },
- /* dd */
- {
- { "ffree", STi },
- { "(bad)" },
- { "fst", STi },
- { "fstp", STi },
- { "fucom", STi },
- { "fucomp", STi },
- { "(bad)" },
- { "(bad)" },
- },
- /* de */
- {
- { "faddp", STi, ST },
- { "fmulp", STi, ST },
- { "(bad)" },
- { FGRPde_3 },
- { "fsubp", STi, ST },
- { "fsubrp", STi, ST },
- { "fdivp", STi, ST },
- { "fdivrp", STi, ST },
- },
- /* df */
- {
- { "(bad)" },
- { "(bad)" },
- { "(bad)" },
- { "(bad)" },
- { FGRPdf_4 },
- { "(bad)" },
- { "(bad)" },
- { "(bad)" },
- },
-};
-
-
-char *fgrps[][8] = {
- /* d9_2 0 */
- {
- "fnop","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
- },
-
- /* d9_4 1 */
- {
- "fchs","fabs","(bad)","(bad)","ftst","fxam","(bad)","(bad)",
- },
-
- /* d9_5 2 */
- {
- "fld1","fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","(bad)",
- },
-
- /* d9_6 3 */
- {
- "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp","fincstp",
- },
-
- /* d9_7 4 */
- {
- "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos",
- },
-
- /* da_5 5 */
- {
- "(bad)","fucompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
- },
-
- /* db_4 6 */
- {
- "feni(287 only)","fdisi(287 only)","fNclex","fNinit",
- "fNsetpm(287 only)","(bad)","(bad)","(bad)",
- },
-
- /* de_3 7 */
- {
- "(bad)","fcompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
- },
-
- /* df_4 8 */
- {
- "fNstsw","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
- },
-};
-
-
-dofloat ()
-{
- struct dis386 *dp;
- unsigned char floatop;
-
- floatop = codep[-1];
-
- if (mod != 3)
- {
- putop (float_mem[(floatop - 0xd8) * 8 + reg]);
- obufp = op1out;
- OP_E (v_mode);
- return;
- }
- codep++;
-
- dp = &float_reg[floatop - 0xd8][reg];
- if (dp->name == NULL)
- {
- putop (fgrps[dp->bytemode1][rm]);
- /* instruction fnstsw is only one with strange arg */
- if (floatop == 0xdf && *codep == 0xe0)
- strcpy (op1out, "%eax");
- }
- else
- {
- putop (dp->name);
- obufp = op1out;
- if (dp->op1)
- (*dp->op1)(dp->bytemode1);
- obufp = op2out;
- if (dp->op2)
- (*dp->op2)(dp->bytemode2);
- }
-}
-
-/* ARGSUSED */
-OP_ST (ignore)
-{
- oappend ("%st");
-}
-
-/* ARGSUSED */
-OP_STi (ignore)
-{
- sprintf (scratchbuf, "%%st(%d)", rm);
- oappend (scratchbuf);
-}
-
-
-/* capital letters in template are macros */
-putop (template)
- char *template;
-{
- char *p;
-
- for (p = template; *p; p++)
- {
- switch (*p)
- {
- default:
- *obufp++ = *p;
- break;
- case 'C': /* For jcxz/jecxz */
- if (aflag == 0)
- *obufp++ = 'e';
- break;
- case 'N':
- if ((prefixes & PREFIX_FWAIT) == 0)
- *obufp++ = 'n';
- break;
- case 'S':
- /* operand size flag */
- if (dflag)
- *obufp++ = 'l';
- else
- *obufp++ = 'w';
- break;
- }
- }
- *obufp = 0;
-}
-
-oappend (s)
-char *s;
-{
- strcpy (obufp, s);
- obufp += strlen (s);
- *obufp = 0;
-}
-
-append_prefix ()
-{
- if (prefixes & PREFIX_CS)
- oappend ("%cs:");
- if (prefixes & PREFIX_DS)
- oappend ("%ds:");
- if (prefixes & PREFIX_SS)
- oappend ("%ss:");
- if (prefixes & PREFIX_ES)
- oappend ("%es:");
- if (prefixes & PREFIX_FS)
- oappend ("%fs:");
- if (prefixes & PREFIX_GS)
- oappend ("%gs:");
-}
-
-OP_indirE (bytemode)
-{
- oappend ("*");
- OP_E (bytemode);
-}
-
-OP_E (bytemode)
-{
- int disp;
- int havesib;
- int didoutput = 0;
- int base;
- int index;
- int scale;
- int havebase;
-
- /* skip mod/rm byte */
- codep++;
-
- havesib = 0;
- havebase = 0;
- disp = 0;
-
- if (mod == 3)
- {
- switch (bytemode)
- {
- case b_mode:
- oappend (names8[rm]);
- break;
- case w_mode:
- oappend (names16[rm]);
- break;
- case v_mode:
- if (dflag)
- oappend (names32[rm]);
- else
- oappend (names16[rm]);
- break;
- default:
- oappend ("<bad dis table>");
- break;
- }
- return;
- }
-
- append_prefix ();
- if (rm == 4)
- {
- havesib = 1;
- havebase = 1;
- scale = (*codep >> 6) & 3;
- index = (*codep >> 3) & 7;
- base = *codep & 7;
- codep++;
- }
-
- switch (mod)
- {
- case 0:
- switch (rm)
- {
- case 4:
- /* implies havesib and havebase */
- if (base == 5) {
- havebase = 0;
- disp = get32 ();
- }
- break;
- case 5:
- disp = get32 ();
- break;
- default:
- havebase = 1;
- base = rm;
- break;
- }
- break;
- case 1:
- disp = *(char *)codep++;
- if (rm != 4)
- {
- havebase = 1;
- base = rm;
- }
- break;
- case 2:
- disp = get32 ();
- if (rm != 4)
- {
- havebase = 1;
- base = rm;
- }
- break;
- }
-
- if (mod != 0 || rm == 5 || (havesib && base == 5))
- {
- sprintf (scratchbuf, "%d", disp);
- oappend (scratchbuf);
- }
-
- if (havebase || havesib)
- {
- oappend ("(");
- if (havebase)
- oappend (names32[base]);
- if (havesib)
- {
- if (index != 4)
- {
- sprintf (scratchbuf, ",%s", names32[index]);
- oappend (scratchbuf);
- }
- sprintf (scratchbuf, ",%d", 1 << scale);
- oappend (scratchbuf);
- }
- oappend (")");
- }
-}
-
-OP_G (bytemode)
-{
- switch (bytemode)
- {
- case b_mode:
- oappend (names8[reg]);
- break;
- case w_mode:
- oappend (names16[reg]);
- break;
- case d_mode:
- oappend (names32[reg]);
- break;
- case v_mode:
- if (dflag)
- oappend (names32[reg]);
- else
- oappend (names16[reg]);
- break;
- default:
- oappend ("<internal disassembler error>");
- break;
- }
-}
-
-get32 ()
-{
- int x = 0;
-
- x = *codep++ & 0xff;
- x |= (*codep++ & 0xff) << 8;
- x |= (*codep++ & 0xff) << 16;
- x |= (*codep++ & 0xff) << 24;
- return (x);
-}
-
-get16 ()
-{
- int x = 0;
-
- x = *codep++ & 0xff;
- x |= (*codep++ & 0xff) << 8;
- return (x);
-}
-
-OP_REG (code)
-{
- char *s;
-
- switch (code)
- {
- case indir_dx_reg: s = "(%dx)"; break;
- case ax_reg: case cx_reg: case dx_reg: case bx_reg:
- case sp_reg: case bp_reg: case si_reg: case di_reg:
- s = names16[code - ax_reg];
- break;
- case es_reg: case ss_reg: case cs_reg:
- case ds_reg: case fs_reg: case gs_reg:
- s = names_seg[code - es_reg];
- break;
- case al_reg: case ah_reg: case cl_reg: case ch_reg:
- case dl_reg: case dh_reg: case bl_reg: case bh_reg:
- s = names8[code - al_reg];
- break;
- case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg:
- case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg:
- if (dflag)
- s = names32[code - eAX_reg];
- else
- s = names16[code - eAX_reg];
- break;
- default:
- s = "<internal disassembler error>";
- break;
- }
- oappend (s);
-}
-
-OP_I (bytemode)
-{
- int op;
-
- switch (bytemode)
- {
- case b_mode:
- op = *codep++ & 0xff;
- break;
- case v_mode:
- if (dflag)
- op = get32 ();
- else
- op = get16 ();
- break;
- case w_mode:
- op = get16 ();
- break;
- default:
- oappend ("<internal disassembler error>");
- return;
- }
- sprintf (scratchbuf, "$0x%x", op);
- oappend (scratchbuf);
-}
-
-OP_sI (bytemode)
-{
- int op;
-
- switch (bytemode)
- {
- case b_mode:
- op = *(char *)codep++;
- break;
- case v_mode:
- if (dflag)
- op = get32 ();
- else
- op = (short)get16();
- break;
- case w_mode:
- op = (short)get16 ();
- break;
- default:
- oappend ("<internal disassembler error>");
- return;
- }
- sprintf (scratchbuf, "$0x%x", op);
- oappend (scratchbuf);
-}
-
-OP_J (bytemode)
-{
- int disp;
- int mask = -1;
-
- switch (bytemode)
- {
- case b_mode:
- disp = *(char *)codep++;
- break;
- case v_mode:
- if (dflag)
- disp = get32 ();
- else
- {
- disp = (short)get16 ();
- /* for some reason, a data16 prefix on a jump instruction
- means that the pc is masked to 16 bits after the
- displacement is added! */
- mask = 0xffff;
- }
- break;
- default:
- oappend ("<internal disassembelr error>");
- return;
- }
-
- sprintf (scratchbuf, "0x%x",
- (start_pc + codep - start_codep + disp) & mask);
- oappend (scratchbuf);
-}
-
-/* ARGSUSED */
-OP_SEG (dummy)
-{
- static char *sreg[] = {
- "%es","%cs","%ss","%ds","%fs","%gs","%?","%?",
- };
-
- oappend (sreg[reg]);
-}
-
-OP_DIR (size)
-{
- int seg, offset;
-
- switch (size)
- {
- case lptr:
- if (aflag)
- {
- offset = get32 ();
- seg = get16 ();
- }
- else
- {
- offset = get16 ();
- seg = get16 ();
- }
- sprintf (scratchbuf, "0x%x,0x%x", seg, offset);
- oappend (scratchbuf);
- break;
- case v_mode:
- if (aflag)
- offset = get32 ();
- else
- offset = (short)get16 ();
-
- sprintf (scratchbuf, "0x%x",
- start_pc + codep - start_codep + offset);
- oappend (scratchbuf);
- break;
- default:
- oappend ("<internal disassembler error>");
- break;
- }
-}
-
-/* ARGSUSED */
-OP_OFF (bytemode)
-{
- int off;
-
- if (aflag)
- off = get32 ();
- else
- off = get16 ();
-
- sprintf (scratchbuf, "0x%x", off);
- oappend (scratchbuf);
-}
-
-/* ARGSUSED */
-OP_ESDI (dummy)
-{
- oappend ("%es:(");
- oappend (aflag ? "%edi" : "%di");
- oappend (")");
-}
-
-/* ARGSUSED */
-OP_DSSI (dummy)
-{
- oappend ("%ds:(");
- oappend (aflag ? "%esi" : "%si");
- oappend (")");
-}
-
-/* ARGSUSED */
-OP_ONE (dummy)
-{
- oappend ("1");
-}
-
-/* ARGSUSED */
-OP_C (dummy)
-{
- codep++; /* skip mod/rm */
- sprintf (scratchbuf, "%%cr%d", reg);
- oappend (scratchbuf);
-}
-
-/* ARGSUSED */
-OP_D (dummy)
-{
- codep++; /* skip mod/rm */
- sprintf (scratchbuf, "%%db%d", reg);
- oappend (scratchbuf);
-}
-
-/* ARGSUSED */
-OP_T (dummy)
-{
- codep++; /* skip mod/rm */
- sprintf (scratchbuf, "%%tr%d", reg);
- oappend (scratchbuf);
-}
-
-OP_rm (bytemode)
-{
- switch (bytemode)
- {
- case d_mode:
- oappend (names32[rm]);
- break;
- case w_mode:
- oappend (names16[rm]);
- break;
- }
-}
-
-/* GDB interface */
-#include "defs.h"
-#include "param.h"
-#include "symtab.h"
-#include "frame.h"
-#include "inferior.h"
-
-#define MAXLEN 20
-print_insn (memaddr, stream)
- CORE_ADDR memaddr;
- FILE *stream;
-{
- unsigned char buffer[MAXLEN];
- /* should be expanded if disassembler prints symbol names */
- char outbuf[100];
- int n;
-
- read_memory (memaddr, buffer, MAXLEN);
-
- n = i386dis ((int)memaddr, buffer, outbuf);
-
- fputs (outbuf, stream);
-
- return (n);
-}
-
diff --git a/gnu/usr.bin/gdb/config/i386bsd-dep.c b/gnu/usr.bin/gdb/config/i386bsd-dep.c
deleted file mode 100644
index 16286ee..0000000
--- a/gnu/usr.bin/gdb/config/i386bsd-dep.c
+++ /dev/null
@@ -1,1889 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)i386bsd-dep.c 6.10 (Berkeley) 6/26/91";
-#endif /* not lint */
-
-/* Low level interface to ptrace, for GDB when running on the Intel 386.
- Copyright (C) 1988, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include "defs.h"
-#include "param.h"
-#include "frame.h"
-#include "inferior.h"
-#include "value.h"
-
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-
-#include <a.out.h>
-
-#ifndef N_SET_MAGIC
-#define N_SET_MAGIC(exec, val) ((exec).a_magic = (val))
-#endif
-
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/uio.h>
-#define curpcb Xcurpcb /* XXX avoid leaking declaration from pcb.h */
-#include <sys/user.h>
-#undef curpcb
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <sys/ptrace.h>
-
-#include <machine/reg.h>
-
-#ifdef KERNELDEBUG
-#ifndef NEWVM
-#include <sys/vmmac.h>
-#include <machine/pte.h>
-#else
-#include <sys/proc.h> /* for curproc */
-#endif
-#include <machine/vmparam.h>
-#include <machine/cpu.h>
-#include <ctype.h>
-#include "symtab.h" /* XXX */
-
-#undef vtophys /* XXX */
-
-extern int kernel_debugging;
-
-#define KERNOFF ((unsigned)KERNBASE)
-#ifndef NEWVM
-#define INKERNEL(x) ((x) >= KERNOFF && (x) < KERNOFF + ctob(slr))
-#define INUPAGE(x) \
- ((x) >= KERNEL_U_ADDR && (x) < KERNEL_U_ADDR + NBPG)
-#else
-#define INKERNEL(x) ((x) >= KERNOFF)
-#endif
-
-#define PT_ADDR_ANY ((caddr_t) 1)
-
-/*
- * Convert from sysmap pte index to system virtual address & vice-versa.
- * (why aren't these in one of the system vm macro files???)
- */
-#define smxtob(a) (sbr + (a) * sizeof(pte))
-#define btosmx(b) (((b) - sbr) / sizeof(pte))
-
-static int ok_to_cache();
-static int found_pcb;
-#ifdef NEWVM
-static CORE_ADDR curpcb;
-static CORE_ADDR kstack;
-#endif
-
-static void setregmap();
-
-extern int errno;
-
-/*
- * This function simply calls ptrace with the given arguments. It exists so
- * that all calls to ptrace are isolated in this machine-dependent file.
- */
-int
-call_ptrace(request, pid, arg3, arg4)
- int request;
- pid_t pid;
- caddr_t arg3;
- int arg4;
-{
- return(ptrace(request, pid, arg3, arg4));
-}
-
-kill_inferior()
-{
- if (remote_debugging) {
-#ifdef KERNELDEBUG
- if (kernel_debugging)
- /*
- * It's a very, very bad idea to go away leaving
- * breakpoints in a remote kernel or to leave it
- * stopped at a breakpoint.
- */
- clear_breakpoints();
-#endif
- remote_close(0);
- inferior_died();
- } else if (inferior_pid != 0) {
- ptrace(PT_KILL, inferior_pid, 0, 0);
- wait(0);
- inferior_died();
- }
-}
-
-/*
- * This is used when GDB is exiting. It gives less chance of error.
- */
-kill_inferior_fast()
-{
- if (remote_debugging) {
-#ifdef KERNELDEBUG
- if (kernel_debugging)
- clear_breakpoints();
-#endif
- remote_close(0);
- return;
- }
- if (inferior_pid == 0)
- return;
-
- ptrace(PT_KILL, inferior_pid, 0, 0);
- wait(0);
-}
-
-/*
- * Resume execution of the inferior process. If STEP is nonzero, single-step
- * it. If SIGNAL is nonzero, give it that signal.
- */
-void
-resume(step, signal)
- int step;
- int signal;
-{
- errno = 0;
- if (remote_debugging)
- remote_resume(step, signal);
- else {
- ptrace(step ? PT_STEP : PT_CONTINUE, inferior_pid,
- PT_ADDR_ANY, signal);
- if (errno)
- perror_with_name("ptrace");
- }
-}
-
-#ifdef ATTACH_DETACH
-extern int attach_flag;
-
-/*
- * Start debugging the process whose number is PID.
- */
-attach(pid)
- int pid;
-{
- errno = 0;
- ptrace(PT_ATTACH, pid, 0, 0);
- if (errno)
- perror_with_name("ptrace");
- attach_flag = 1;
- return pid;
-}
-
-/*
- * Stop debugging the process whose number is PID and continue it
- * with signal number SIGNAL. SIGNAL = 0 means just continue it.
- */
-void
-detach(signal)
- int signal;
-{
- errno = 0;
- ptrace(PT_DETACH, inferior_pid, PT_ADDR_ANY, signal);
- if (errno)
- perror_with_name("ptrace");
- attach_flag = 0;
-}
-#endif /* ATTACH_DETACH */
-
-static unsigned int
-get_register_offset()
-{
- unsigned int offset;
- struct user u; /* XXX */
- unsigned int flags = (char *) &u.u_pcb.pcb_flags - (char *) &u;
-
- setregmap(ptrace(PT_READ_U, inferior_pid, (caddr_t)flags, 0));
-
-#ifdef NEWVM
- offset = (char *) &u.u_kproc.kp_proc.p_regs - (char *) &u;
- offset = ptrace(PT_READ_U, inferior_pid, (caddr_t)offset, 0) -
- USRSTACK;
-#else
- offset = (char *) &u.u_ar0 - (char *) &u;
- offset = ptrace(PT_READ_U, inferior_pid, (caddr_t)offset, 0) -
- KERNEL_U_ADDR;
-#endif
-
- return offset;
-}
-
-void
-fetch_inferior_registers()
-{
- register int regno;
- register unsigned int regaddr;
- char buf[MAX_REGISTER_RAW_SIZE];
- register int i;
- unsigned int offset;
-
- if (remote_debugging) {
- extern char registers[];
-
- remote_fetch_registers(registers);
- return;
- }
-
- offset = get_register_offset();
-
- for (regno = 0; regno < NUM_REGS; regno++) {
- regaddr = register_addr(regno, offset);
- for (i = 0; i < REGISTER_RAW_SIZE(regno); i += sizeof(int)) {
- *(int *)&buf[i] = ptrace(PT_READ_U, inferior_pid,
- (caddr_t)regaddr, 0);
- regaddr += sizeof(int);
- }
- supply_register(regno, buf);
- }
-}
-
-/*
- * Store our register values back into the inferior. If REGNO is -1, do this
- * for all registers. Otherwise, REGNO specifies which register (so we can
- * save time).
- */
-store_inferior_registers(regno)
- int regno;
-{
- register unsigned int regaddr;
- char buf[80];
- extern char registers[];
- register int i;
- unsigned int offset;
-
- if (remote_debugging) {
- extern char registers[];
-
- remote_store_registers(registers);
- return;
- }
-
- offset = get_register_offset();
-
- if (regno >= 0) {
- regaddr = register_addr(regno, offset);
- for (i = 0; i < REGISTER_RAW_SIZE(regno); i += sizeof(int)) {
- errno = 0;
- ptrace(PT_WRITE_U, inferior_pid, (caddr_t)regaddr,
- *(int *) &registers[REGISTER_BYTE(regno) + i]);
- if (errno != 0) {
- sprintf(buf, "writing register number %d(%d)",
- regno, i);
- perror_with_name(buf);
- }
- regaddr += sizeof(int);
- }
- } else
- for (regno = 0; regno < NUM_REGS; regno++) {
- regaddr = register_addr(regno, offset);
- for (i = 0; i < REGISTER_RAW_SIZE(regno);
- i += sizeof(int)) {
- errno = 0;
- ptrace(PT_WRITE_U, inferior_pid,
- (caddr_t)regaddr,
- *(int *) &registers[REGISTER_BYTE(regno) + i]);
- if (errno != 0) {
- sprintf(buf,
- "writing register number %d(%d)",
- regno, i);
- perror_with_name(buf);
- }
- regaddr += sizeof(int);
- }
- }
-}
-
-/*
- * Copy LEN bytes from inferior's memory starting at MEMADDR to debugger
- * memory starting at MYADDR. On failure (cannot read from inferior, usually
- * because address is out of bounds) returns the value of errno.
- */
-int
-read_inferior_memory(memaddr, myaddr, len)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
-{
- register int i;
- /* Round starting address down to longword boundary. */
- register CORE_ADDR addr = memaddr & -sizeof(int);
- /* Round ending address up; get number of longwords that makes. */
- register int count = (((memaddr + len) - addr) + sizeof(int) - 1) /
- sizeof(int);
- /* Allocate buffer of that many longwords. */
- register int *buffer = (int *) alloca(count * sizeof(int));
- extern int errno;
-
- if (remote_debugging)
- return (remote_read_inferior_memory(memaddr, myaddr, len));
-
- /* Read all the longwords */
- errno = 0;
- for (i = 0; i < count && errno == 0; i++, addr += sizeof(int))
- buffer[i] = ptrace(PT_READ_I, inferior_pid, (caddr_t)addr, 0);
-
- /* Copy appropriate bytes out of the buffer. */
- bcopy((char *) buffer + (memaddr & (sizeof(int) - 1)), myaddr, len);
- return(errno);
-}
-
-/*
- * Copy LEN bytes of data from debugger memory at MYADDR to inferior's memory
- * at MEMADDR. On failure (cannot write the inferior) returns the value of
- * errno.
- */
-
-int
-write_inferior_memory(memaddr, myaddr, len)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
-{
- register int i;
- /* Round starting address down to longword boundary. */
- register CORE_ADDR addr = memaddr & -sizeof(int);
- /* Round ending address up; get number of longwords that makes. */
- register int count = (((memaddr + len) - addr) + sizeof(int) - 1) /
- sizeof(int);
- /* Allocate buffer of that many longwords. */
- register int *buffer = (int *) alloca(count * sizeof(int));
- extern int errno;
-
- /*
- * Fill start and end extra bytes of buffer with existing memory
- * data.
- */
- if (remote_debugging)
- return (remote_write_inferior_memory(memaddr, myaddr, len));
-
- /*
- * Fill start and end extra bytes of buffer with existing memory
- * data.
- */
- buffer[0] = ptrace(PT_READ_I, inferior_pid, (caddr_t)addr, 0);
-
- if (count > 1)
- buffer[count - 1] = ptrace(PT_READ_I, inferior_pid,
- (caddr_t)addr + (count - 1) * sizeof(int), 0);
-
- /* Copy data to be written over corresponding part of buffer */
-
- bcopy(myaddr, (char *) buffer + (memaddr & (sizeof(int) - 1)), len);
-
- /* Write the entire buffer. */
-
- errno = 0;
- for (i = 0; i < count && errno == 0; i++, addr += sizeof(int))
- ptrace(PT_WRITE_I, inferior_pid, (caddr_t)addr, buffer[i]);
-
- return(errno);
-}
-
-
-/*
- * Work with core dump and executable files, for GDB.
- * This code would be in core.c if it weren't machine-dependent.
- */
-
-#ifndef N_TXTADDR
-#define N_TXTADDR(hdr) 0
-#endif /* no N_TXTADDR */
-
-#ifndef N_DATADDR
-#define N_DATADDR(hdr) hdr.a_text
-#endif /* no N_DATADDR */
-
-/*
- * Make COFF and non-COFF names for things a little more compatible to reduce
- * conditionals later.
- */
-
-#ifndef AOUTHDR
-#define AOUTHDR struct exec
-#endif
-
-extern char *sys_siglist[];
-
-
-/* Hook for `exec_file_command' command to call. */
-
-extern void (*exec_file_display_hook) ();
-
-/* File names of core file and executable file. */
-
-extern char *corefile;
-extern char *execfile;
-
-/* Descriptors on which core file and executable file are open.
- Note that the execchan is closed when an inferior is created
- and reopened if the inferior dies or is killed. */
-
-extern int corechan;
-extern int execchan;
-
-/* Last modification time of executable file.
- Also used in source.c to compare against mtime of a source file. */
-
-extern int exec_mtime;
-
-/* Virtual addresses of bounds of the two areas of memory in the core file. */
-
-extern CORE_ADDR data_start;
-extern CORE_ADDR data_end;
-extern CORE_ADDR stack_start;
-extern CORE_ADDR stack_end;
-
-/* Virtual addresses of bounds of two areas of memory in the exec file.
- Note that the data area in the exec file is used only when there is no core file. */
-
-extern CORE_ADDR text_start;
-extern CORE_ADDR text_end;
-
-extern CORE_ADDR exec_data_start;
-extern CORE_ADDR exec_data_end;
-
-/* Address in executable file of start of text area data. */
-
-extern int text_offset;
-
-/* Address in executable file of start of data area data. */
-
-extern int exec_data_offset;
-
-/* Address in core file of start of data area data. */
-
-extern int data_offset;
-
-/* Address in core file of start of stack area data. */
-
-extern int stack_offset;
-
-/* a.out header saved in core file. */
-
-extern AOUTHDR core_aouthdr;
-
-/* a.out header of exec file. */
-
-extern AOUTHDR exec_aouthdr;
-
-extern void validate_files ();
-
-extern int (*core_file_hook)();
-
-#ifdef KERNELDEBUG
-/*
- * Kernel debugging routines.
- */
-
-#define IOTOP 0x100000 /* XXX should get this from include file */
-#define IOBASE 0xa0000 /* XXX should get this from include file */
-
-static CORE_ADDR file_offset;
-static CORE_ADDR lowram;
-static CORE_ADDR sbr;
-static CORE_ADDR slr;
-static struct pcb pcb;
-
-static CORE_ADDR
-ksym_lookup(name)
- char *name;
-{
- struct symbol *sym;
- int i;
-
- if ((i = lookup_misc_func(name)) < 0)
- error("kernel symbol `%s' not found.", name);
-
- return (misc_function_vector[i].address);
-}
-
-/*
- * return true if 'len' bytes starting at 'addr' can be read out as
- * longwords and/or locally cached (this is mostly for memory mapped
- * i/o register access when debugging remote kernels).
- *
- * XXX the HP code does this differently with NEWVM
- */
-static int
-ok_to_cache(addr, len)
-{
- static CORE_ADDR atdevbase;
-
- if (! atdevbase)
- atdevbase = ksym_lookup("atdevbase");
-
- if (addr >= atdevbase && addr < atdevbase + (IOTOP - IOBASE))
- return (0);
-
- return (1);
-}
-
-static
-physrd(addr, dat, len)
- u_int addr;
- char *dat;
-{
- if (lseek(corechan, addr - file_offset, L_SET) == -1)
- return (-1);
- if (read(corechan, dat, len) != len)
- return (-1);
-
- return (0);
-}
-
-/*
- * When looking at kernel data space through /dev/mem or with a core file, do
- * virtual memory mapping.
- */
-#ifdef NEWVM
-static CORE_ADDR
-vtophys(addr)
- CORE_ADDR addr;
-{
- CORE_ADDR v;
- struct pte pte;
- static CORE_ADDR PTD = -1;
- CORE_ADDR current_ptd;
-
- /*
- * If we're looking at the kernel stack,
- * munge the address to refer to the user space mapping instead;
- * that way we get the requested process's kstack, not the running one.
- */
- if (addr >= kstack && addr < kstack + ctob(UPAGES))
- addr = (addr - kstack) + curpcb;
-
- /*
- * We may no longer have a linear system page table...
- *
- * Here's the scoop. IdlePTD contains the physical address
- * of a page table directory that always maps the kernel.
- * IdlePTD is in memory that is mapped 1-to-1, so we can
- * find it easily given its 'virtual' address from ksym_lookup().
- * For hysterical reasons, the value of IdlePTD is stored in sbr.
- *
- * To look up a kernel address, we first convert it to a 1st-level
- * address and look it up in IdlePTD. This gives us the physical
- * address of a page table page; we extract the 2nd-level part of
- * VA and read the 2nd-level pte. Finally, we add the offset part
- * of the VA into the physical address from the pte and return it.
- *
- * User addresses are a little more complicated. If we don't have
- * a current PCB from read_pcb(), we use PTD, which is the (fixed)
- * virtual address of the current ptd. Since it's NOT in 1-to-1
- * kernel space, we must look it up using IdlePTD. If we do have
- * a pcb, we get the ptd from pcb_ptd.
- */
-
- if (INKERNEL(addr))
- current_ptd = sbr;
- else if (found_pcb == 0) {
- if (PTD == -1)
- PTD = vtophys(ksym_lookup("PTD"));
- current_ptd = PTD;
- } else
- current_ptd = pcb.pcb_ptd;
-
- /*
- * Read the first-level page table (ptd).
- */
- v = current_ptd + ((unsigned)addr >> PD_SHIFT) * sizeof pte;
- if (physrd(v, (char *)&pte, sizeof pte) || pte.pg_v == 0)
- return (~0);
-
- /*
- * Read the second-level page table.
- */
- v = i386_ptob(pte.pg_pfnum) + ((addr&PT_MASK) >> PG_SHIFT) * sizeof pte;
- if (physrd(v, (char *) &pte, sizeof(pte)) || pte.pg_v == 0)
- return (~0);
-
- addr = i386_ptob(pte.pg_pfnum) + (addr & PGOFSET);
-#if 0
- printf("vtophys(%x) -> %x\n", oldaddr, addr);
-#endif
- return (addr);
-}
-#else
-static CORE_ADDR
-vtophys(addr)
- CORE_ADDR addr;
-{
- CORE_ADDR v;
- struct pte pte;
- CORE_ADDR oldaddr = addr;
-
- if (found_pcb == 0 && INUPAGE(addr)) {
- static CORE_ADDR pSwtchmap;
-
- if (pSwtchmap == 0)
- pSwtchmap = vtophys(ksym_lookup("Swtchmap"));
- addr = pSwtchmap;
- } else if (INKERNEL(addr)) {
- /*
- * In system space get system pte. If valid or reclaimable
- * then physical address is combination of its page number
- * and the page offset of the original address.
- */
- addr = smxtob(btop(addr - KERNOFF)) - KERNOFF;
- } else {
- v = btop(addr);
- if (v < pcb.pcb_p0lr)
- addr = (CORE_ADDR) pcb.pcb_p0br +
- v * sizeof (struct pte);
- else if (v >= pcb.pcb_p1lr && v < P1PAGES)
- addr = (CORE_ADDR) pcb.pcb_p0br +
- ((pcb.pcb_szpt * NPTEPG - HIGHPAGES) -
- (BTOPUSRSTACK - v)) * sizeof (struct pte);
- else
- return (~0);
-
- /*
- * For p0/p1 address, user-level page table should be in
- * kernel vm. Do second-level indirect by recursing.
- */
- if (!INKERNEL(addr))
- return (~0);
-
- addr = vtophys(addr);
- }
- /*
- * Addr is now address of the pte of the page we are interested in;
- * get the pte and paste up the physical address.
- */
- if (physrd(addr, (char *) &pte, sizeof(pte)))
- return (~0);
-
- if (pte.pg_v == 0 && (pte.pg_fod || pte.pg_pfnum == 0))
- return (~0);
-
- addr = (CORE_ADDR)ptob(pte.pg_pfnum) + (oldaddr & PGOFSET);
-#if 0
- printf("vtophys(%x) -> %x\n", oldaddr, addr);
-#endif
- return (addr);
-}
-
-#endif
-
-static
-kvread(addr)
- CORE_ADDR addr;
-{
- CORE_ADDR paddr = vtophys(addr);
-
- if (paddr != ~0)
- if (physrd(paddr, (char *)&addr, sizeof(addr)) == 0);
- return (addr);
-
- return (~0);
-}
-
-static void
-read_pcb(uaddr)
- u_int uaddr;
-{
- int i;
- int *pcb_regs = (int *)&pcb;
-
-#ifdef NEWVM
- if (physrd(uaddr, (char *)&pcb, sizeof pcb))
- error("cannot read pcb at %x\n", uaddr);
- printf("current pcb at %x\n", uaddr);
-#else
- if (physrd(uaddr, (char *)&pcb, sizeof pcb))
- error("cannot read pcb at %x\n", uaddr);
- printf("p0br %x p0lr %x p1br %x p1lr %x\n",
- pcb.pcb_p0br, pcb.pcb_p0lr, pcb.pcb_p1br, pcb.pcb_p1lr);
-#endif
-
- /*
- * get the register values out of the sys pcb and
- * store them where `read_register' will find them.
- */
- for (i = 0; i < 8; ++i)
- supply_register(i, &pcb_regs[i+10]);
- supply_register(8, &pcb_regs[8]); /* eip */
- supply_register(9, &pcb_regs[9]); /* eflags */
- for (i = 10; i < 13; ++i) /* cs, ss, ds */
- supply_register(i, &pcb_regs[i+9]);
- supply_register(13, &pcb_regs[18]); /* es */
- for (i = 14; i < 16; ++i) /* fs, gs */
- supply_register(i, &pcb_regs[i+8]);
-
- /* XXX 80387 registers? */
-}
-
-static void
-setup_kernel_debugging()
-{
- struct stat stb;
- int devmem = 0;
- CORE_ADDR addr;
-
- fstat(corechan, &stb);
- if ((stb.st_mode & S_IFMT) == S_IFCHR && stb.st_rdev == makedev(2, 0))
- devmem = 1;
-
-#ifdef NEWVM
- physrd(ksym_lookup("IdlePTD") - KERNOFF, &sbr, sizeof sbr);
- slr = 2 * NPTEPG; /* XXX temporary */
- printf("IdlePTD %x\n", sbr);
- curpcb = ksym_lookup("curpcb") - KERNOFF;
- physrd(curpcb, &curpcb, sizeof curpcb);
- kstack = ksym_lookup("kstack");
-#else
- sbr = ksym_lookup("Sysmap");
- slr = ksym_lookup("Syssize");
- printf("sbr %x slr %x\n", sbr, slr);
-#endif
-
- /*
- * pcb where "panic" saved registers in first thing in current
- * u area.
- */
-#ifndef NEWVM
- read_pcb(vtophys(ksym_lookup("u")));
-#endif
- found_pcb = 1;
- if (!devmem) {
- /* find stack frame */
- CORE_ADDR panicstr;
- char buf[256];
- register char *cp;
-
- panicstr = kvread(ksym_lookup("panicstr"));
- if (panicstr == ~0)
- return;
- (void) kernel_core_file_hook(panicstr, buf, sizeof(buf));
- for (cp = buf; cp < &buf[sizeof(buf)] && *cp; cp++)
- if (!isascii(*cp) || (!isprint(*cp) && !isspace(*cp)))
- *cp = '?';
- if (*cp)
- *cp = '\0';
- printf("panic: %s\n", buf);
- read_pcb(ksym_lookup("dumppcb") - KERNOFF);
- }
-#ifdef NEWVM
- else
- read_pcb(vtophys(kstack));
-#endif
-
- stack_start = USRSTACK;
- stack_end = USRSTACK + ctob(UPAGES);
-}
-
-set_paddr_command(arg)
- char *arg;
-{
- u_int uaddr;
-
- if (!arg)
- error_no_arg("ps-style address for new current process");
- if (!kernel_debugging)
- error("not debugging kernel");
- uaddr = (u_int) parse_and_eval_address(arg);
-#ifndef NEWVM
- read_pcb(ctob(uaddr));
-#else
- /* p_addr is now a pcb virtual address */
- read_pcb(vtophys(uaddr));
- curpcb = uaddr;
-#endif
-
- flush_cached_frames();
- set_current_frame(create_new_frame(read_register(FP_REGNUM), read_pc()));
- select_frame(get_current_frame(), 0);
-}
-
-/*
- * read len bytes from kernel virtual address 'addr' into local
- * buffer 'buf'. Return 0 if read ok, 1 otherwise. On read
- * errors, portion of buffer not read is zeroed.
- */
-kernel_core_file_hook(addr, buf, len)
- CORE_ADDR addr;
- char *buf;
- int len;
-{
- int i;
- CORE_ADDR paddr;
-
- while (len > 0) {
- paddr = vtophys(addr);
- if (paddr == ~0) {
- bzero(buf, len);
- return (1);
- }
- /* we can't read across a page boundary */
- i = min(len, NBPG - (addr & PGOFSET));
- if (physrd(paddr, buf, i)) {
- bzero(buf, len);
- return (1);
- }
- buf += i;
- addr += i;
- len -= i;
- }
- return (0);
-}
-#endif
-
-core_file_command(filename, from_tty)
- char *filename;
- int from_tty;
-{
- int val;
- extern char registers[];
-#ifdef KERNELDEBUG
- struct stat stb;
-#endif
-
- /*
- * Discard all vestiges of any previous core file and mark data and
- * stack spaces as empty.
- */
- if (corefile)
- free(corefile);
- corefile = 0;
- core_file_hook = 0;
-
- if (corechan >= 0)
- close(corechan);
- corechan = -1;
-
- /* Now, if a new core file was specified, open it and digest it. */
-
- if (filename == 0) {
- if (from_tty)
- printf("No core file now.\n");
- return;
- }
- filename = tilde_expand(filename);
- make_cleanup(free, filename);
- if (have_inferior_p())
- error("To look at a core file, you must kill the inferior with \"kill\".");
- corechan = open(filename, O_RDONLY, 0);
- if (corechan < 0)
- perror_with_name(filename);
-
-#ifdef KERNELDEBUG
- fstat(corechan, &stb);
-
- if (kernel_debugging) {
- setup_kernel_debugging();
- core_file_hook = kernel_core_file_hook;
- } else if ((stb.st_mode & S_IFMT) == S_IFCHR &&
- stb.st_rdev == makedev(2, 1)) {
- /* looking at /dev/kmem */
- data_offset = data_start = KERNOFF;
- data_end = ~0; /* XXX */
- stack_end = stack_start = data_end;
- } else
-#endif
- {
- /*
- * 4.2-style core dump file.
- */
- struct user u;
- unsigned int reg_offset;
-
- val = myread(corechan, &u, sizeof u);
- if (val < 0)
- perror_with_name("Not a core file: reading upage");
- if (val != sizeof u)
- error("Not a core file: could only read %d bytes", val);
-
- /*
- * We are depending on exec_file_command having been
- * called previously to set exec_data_start. Since
- * the executable and the core file share the same
- * text segment, the address of the data segment will
- * be the same in both.
- */
- data_start = exec_data_start;
-
-#ifndef NEWVM
- data_end = data_start + NBPG * u.u_dsize;
- stack_start = stack_end - NBPG * u.u_ssize;
- data_offset = NBPG * UPAGES;
- stack_offset = NBPG * (UPAGES + u.u_dsize);
-
- /*
- * Some machines put an absolute address in here and
- * some put the offset in the upage of the regs.
- */
- reg_offset = (int) u.u_ar0 - KERNEL_U_ADDR;
-#else
- stack_end = (CORE_ADDR) u.u_kproc.kp_eproc.e_vm.vm_maxsaddr
- + MAXSSIZ;
-
- data_end = data_start +
- NBPG * u.u_kproc.kp_eproc.e_vm.vm_dsize;
- stack_start = stack_end -
- NBPG * u.u_kproc.kp_eproc.e_vm.vm_ssize;
- data_offset = NBPG * UPAGES;
- stack_offset = NBPG *
- (UPAGES + u.u_kproc.kp_eproc.e_vm.vm_dsize);
-
- reg_offset = (int) u.u_kproc.kp_proc.p_regs - USRSTACK;
-#endif
-
- setregmap(u.u_pcb.pcb_flags);
-
- /*
- * I don't know where to find this info. So, for now,
- * mark it as not available.
- */
- /* N_SET_MAGIC (core_aouthdr, 0); */
- bzero ((char *) &core_aouthdr, sizeof core_aouthdr);
-
- /*
- * Read the register values out of the core file and
- * store them where `read_register' will find them.
- */
- {
- register int regno;
-
- for (regno = 0; regno < NUM_REGS; regno++) {
- char buf[MAX_REGISTER_RAW_SIZE];
-
- val = lseek(corechan, register_addr(regno, reg_offset), 0);
- if (val < 0
- || (val = myread(corechan, buf, sizeof buf)) < 0) {
- char *buffer = (char *) alloca(strlen(reg_names[regno]) + 30);
- strcpy(buffer, "Reading register ");
- strcat(buffer, reg_names[regno]);
- perror_with_name(buffer);
- }
- supply_register(regno, buf);
- }
- }
- }
-#endif
- if (filename[0] == '/')
- corefile = savestring(filename, strlen(filename));
- else
- corefile = concat(current_directory, "/", filename);
-
- set_current_frame(create_new_frame(read_register(FP_REGNUM),
- read_pc()));
- select_frame(get_current_frame(), 0);
- validate_files();
-}
-
-exec_file_command(filename, from_tty)
- char *filename;
- int from_tty;
-{
- int val;
-
- /*
- * Eliminate all traces of old exec file. Mark text segment as empty.
- */
-
- if (execfile)
- free(execfile);
- execfile = 0;
- data_start = 0;
- data_end = 0;
- stack_start = 0;
- stack_end = 0;
- text_start = 0;
- text_end = 0;
- exec_data_start = 0;
- exec_data_end = 0;
- if (execchan >= 0)
- close(execchan);
- execchan = -1;
-
- /* Now open and digest the file the user requested, if any. */
-
- if (filename) {
- filename = tilde_expand(filename);
- make_cleanup(free, filename);
-
- execchan = openp(getenv("PATH"), 1, filename, O_RDONLY, 0,
- &execfile);
- if (execchan < 0)
- perror_with_name(filename);
-
- {
- struct stat st_exec;
-
-#ifdef HEADER_SEEK_FD
- HEADER_SEEK_FD(execchan);
-#endif
-
- val = myread(execchan, &exec_aouthdr, sizeof(AOUTHDR));
-
- if (val < 0)
- perror_with_name(filename);
-
-#ifdef KERNELDEBUG
- if (kernel_debugging) {
- /* Gross and disgusting XXX */
- text_start = KERNTEXT_BASE;
- exec_data_start = KERNTEXT_BASE +
- (exec_aouthdr.a_text + 4095) & ~ 4095;
- } else {
-#endif
- text_start = N_TXTADDR(exec_aouthdr);
- exec_data_start = N_DATADDR(exec_aouthdr);
-#ifdef KERNELDEBUG
- }
-#endif
-
- text_offset = N_TXTOFF(exec_aouthdr);
- exec_data_offset = N_TXTOFF(exec_aouthdr) + exec_aouthdr.a_text;
-
- text_end = text_start + exec_aouthdr.a_text;
- exec_data_end = exec_data_start + exec_aouthdr.a_data;
-
- fstat(execchan, &st_exec);
- exec_mtime = st_exec.st_mtime;
- }
-
- validate_files();
- } else if (from_tty)
- printf("No exec file now.\n");
-
- /* Tell display code (if any) about the changed file name. */
- if (exec_file_display_hook)
- (*exec_file_display_hook) (filename);
-}
-
-int dummy_code[] = {
- 0xb8909090, /* nop; nop; nop; movl $0x32323232,%eax */
- 0x32323232,
-#define DUMMY_CALL_INDEX 1
- 0x90ccd0ff, /* call %eax; int3; nop */
-};
-
-/*
- * Build `dummy' call instructions on inferior's stack to cause
- * it to call a subroutine.
- *
- * N.B. - code in wait_for_inferior requires that sp < pc < fp when
- * we take the trap 2 above so it will recognize that we stopped
- * at a `dummy' call. So, after the call sp is *not* decremented
- * to clean the arguments, code & other stuff we lay on the stack.
- * Since the regs are restored to saved values at the breakpoint,
- * sp will get reset correctly. Also, this restore means we don't
- * have to construct frame linkage info to save pc & fp. The lack
- * of frame linkage means we can't do a backtrace, etc., if the
- * called function gets a fault or hits a breakpoint but code in
- * run_stack_dummy makes this impossible anyway.
- */
-CORE_ADDR
-setup_dummy(sp, funaddr, nargs, args, struct_return_bytes, pushfn)
- CORE_ADDR sp;
- CORE_ADDR funaddr;
- int nargs;
- value *args;
- int struct_return_bytes;
- CORE_ADDR (*pushfn)();
-{
- int padding, i;
- CORE_ADDR top = sp, struct_addr, pc;
-
- i = arg_stacklen(nargs, args) + struct_return_bytes
- + sizeof(dummy_code);
- if (i & 3)
- padding = 4 - (i & 3);
- else
- padding = 0;
- pc = sp - sizeof(dummy_code);
- sp = pc - padding - struct_return_bytes;
- struct_addr = sp;
- while (--nargs >= 0)
- sp = (*pushfn)(sp, *args++);
- if (struct_return_bytes)
- STORE_STRUCT_RETURN(struct_addr, sp);
- write_register(SP_REGNUM, sp);
-
- dummy_code[DUMMY_CALL_INDEX] = (int)funaddr;
- write_memory(pc, (char *)dummy_code, sizeof(dummy_code));
-
- return pc;
-}
-
-/* helper functions for m-i386.h */
-
-/* stdio style buffering to minimize calls to ptrace */
-static CORE_ADDR codestream_next_addr;
-static CORE_ADDR codestream_addr;
-static unsigned char codestream_buf[sizeof (int)];
-static int codestream_off;
-static int codestream_cnt;
-
-#define codestream_tell() (codestream_addr + codestream_off)
-#define codestream_peek() (codestream_cnt == 0 ? \
- codestream_fill(1): codestream_buf[codestream_off])
-#define codestream_get() (codestream_cnt-- == 0 ? \
- codestream_fill(0) : codestream_buf[codestream_off++])
-
-static unsigned char
-codestream_fill (peek_flag)
-{
- codestream_addr = codestream_next_addr;
- codestream_next_addr += sizeof (int);
- codestream_off = 0;
- codestream_cnt = sizeof (int);
- read_memory (codestream_addr,
- (unsigned char *)codestream_buf,
- sizeof (int));
-
- if (peek_flag)
- return (codestream_peek());
- else
- return (codestream_get());
-}
-
-static void
-codestream_seek (place)
-{
- codestream_next_addr = place & -sizeof (int);
- codestream_cnt = 0;
- codestream_fill (1);
- while (codestream_tell() != place)
- codestream_get ();
-}
-
-static void
-codestream_read (buf, count)
- unsigned char *buf;
-{
- unsigned char *p;
- int i;
- p = buf;
- for (i = 0; i < count; i++)
- *p++ = codestream_get ();
-}
-
-/* next instruction is a jump, move to target */
-static
-i386_follow_jump ()
-{
- int long_delta;
- short short_delta;
- char byte_delta;
- int data16;
- int pos;
-
- pos = codestream_tell ();
-
- data16 = 0;
- if (codestream_peek () == 0x66)
- {
- codestream_get ();
- data16 = 1;
- }
-
- switch (codestream_get ())
- {
- case 0xe9:
- /* relative jump: if data16 == 0, disp32, else disp16 */
- if (data16)
- {
- codestream_read ((unsigned char *)&short_delta, 2);
- pos += short_delta + 3; /* include size of jmp inst */
- }
- else
- {
- codestream_read ((unsigned char *)&long_delta, 4);
- pos += long_delta + 5;
- }
- break;
- case 0xeb:
- /* relative jump, disp8 (ignore data16) */
- codestream_read ((unsigned char *)&byte_delta, 1);
- pos += byte_delta + 2;
- break;
- }
- codestream_seek (pos + data16);
-}
-
-/*
- * find & return amound a local space allocated, and advance codestream to
- * first register push (if any)
- *
- * if entry sequence doesn't make sense, return -1, and leave
- * codestream pointer random
- */
-static long
-i386_get_frame_setup (pc)
-{
- unsigned char op;
-
- codestream_seek (pc);
-
- i386_follow_jump ();
-
- op = codestream_get ();
-
- if (op == 0x58) /* popl %eax */
- {
- /*
- * this function must start with
- *
- * popl %eax 0x58
- * xchgl %eax, (%esp) 0x87 0x04 0x24
- * or xchgl %eax, 0(%esp) 0x87 0x44 0x24 0x00
- *
- * (the system 5 compiler puts out the second xchg
- * inst, and the assembler doesn't try to optimize it,
- * so the 'sib' form gets generated)
- *
- * this sequence is used to get the address of the return
- * buffer for a function that returns a structure
- */
- int pos;
- unsigned char buf[4];
- static unsigned char proto1[3] = { 0x87,0x04,0x24 };
- static unsigned char proto2[4] = { 0x87,0x44,0x24,0x00 };
- pos = codestream_tell ();
- codestream_read (buf, 4);
- if (bcmp (buf, proto1, 3) == 0)
- pos += 3;
- else if (bcmp (buf, proto2, 4) == 0)
- pos += 4;
-
- codestream_seek (pos);
- op = codestream_get (); /* update next opcode */
- }
-
- if (op == 0x55) /* pushl %esp */
- {
- /* check for movl %esp, %ebp - can be written two ways */
- switch (codestream_get ())
- {
- case 0x8b:
- if (codestream_get () != 0xec)
- return (-1);
- break;
- case 0x89:
- if (codestream_get () != 0xe5)
- return (-1);
- break;
- default:
- return (-1);
- }
- /* check for stack adjustment
- *
- * subl $XXX, %esp
- *
- * note: you can't subtract a 16 bit immediate
- * from a 32 bit reg, so we don't have to worry
- * about a data16 prefix
- */
- op = codestream_peek ();
- if (op == 0x83)
- {
- /* subl with 8 bit immed */
- codestream_get ();
- if (codestream_get () != 0xec)
- return (-1);
- /* subl with signed byte immediate
- * (though it wouldn't make sense to be negative)
- */
- return (codestream_get());
- }
- else if (op == 0x81)
- {
- /* subl with 32 bit immed */
- int locals;
- codestream_get();
- if (codestream_get () != 0xec)
- return (-1);
- /* subl with 32 bit immediate */
- codestream_read ((unsigned char *)&locals, 4);
- return (locals);
- }
- else
- {
- return (0);
- }
- }
- else if (op == 0xc8)
- {
- /* enter instruction: arg is 16 bit unsigned immed */
- unsigned short slocals;
- codestream_read ((unsigned char *)&slocals, 2);
- codestream_get (); /* flush final byte of enter instruction */
- return (slocals);
- }
- return (-1);
-}
-
-/* Return number of args passed to a frame.
- Can return -1, meaning no way to tell. */
-
-/* on the 386, the instruction following the call could be:
- * popl %ecx - one arg
- * addl $imm, %esp - imm/4 args; imm may be 8 or 32 bits
- * anything else - zero args
- */
-
-int
-i386_frame_num_args (fi)
- struct frame_info fi;
-{
- int retpc;
- unsigned char op;
- struct frame_info *pfi;
-
- pfi = get_prev_frame_info ((fi));
- if (pfi == 0)
- {
- /* Note: this can happen if we are looking at the frame for
- main, because FRAME_CHAIN_VALID won't let us go into
- start. If we have debugging symbols, that's not really
- a big deal; it just means it will only show as many arguments
- to main as are declared. */
- return -1;
- }
- else
- {
- retpc = pfi->pc;
- op = read_memory_integer (retpc, 1);
- if (op == 0x59)
- /* pop %ecx */
- return 1;
- else if (op == 0x83)
- {
- op = read_memory_integer (retpc+1, 1);
- if (op == 0xc4)
- /* addl $<signed imm 8 bits>, %esp */
- return (read_memory_integer (retpc+2,1)&0xff)/4;
- else
- return 0;
- }
- else if (op == 0x81)
- { /* add with 32 bit immediate */
- op = read_memory_integer (retpc+1, 1);
- if (op == 0xc4)
- /* addl $<imm 32>, %esp */
- return read_memory_integer (retpc+2, 4) / 4;
- else
- return 0;
- }
- else
- {
- return 0;
- }
- }
-}
-
-/*
- * parse the first few instructions of the function to see
- * what registers were stored.
- *
- * We handle these cases:
- *
- * The startup sequence can be at the start of the function,
- * or the function can start with a branch to startup code at the end.
- *
- * %ebp can be set up with either the 'enter' instruction, or
- * 'pushl %ebp, movl %esp, %ebp' (enter is too slow to be useful,
- * but was once used in the sys5 compiler)
- *
- * Local space is allocated just below the saved %ebp by either the
- * 'enter' instruction, or by 'subl $<size>, %esp'. 'enter' has
- * a 16 bit unsigned argument for space to allocate, and the
- * 'addl' instruction could have either a signed byte, or
- * 32 bit immediate.
- *
- * Next, the registers used by this function are pushed. In
- * the sys5 compiler they will always be in the order: %edi, %esi, %ebx
- * (and sometimes a harmless bug causes it to also save but not restore %eax);
- * however, the code below is willing to see the pushes in any order,
- * and will handle up to 8 of them.
- *
- * If the setup sequence is at the end of the function, then the
- * next instruction will be a branch back to the start.
- */
-
-i386_frame_find_saved_regs (fip, fsrp)
- struct frame_info *fip;
- struct frame_saved_regs *fsrp;
-{
- unsigned long locals;
- unsigned char *p;
- unsigned char op;
- CORE_ADDR dummy_bottom;
- CORE_ADDR adr;
- int i;
-
- bzero (fsrp, sizeof *fsrp);
-
-#if 0
- /* if frame is the end of a dummy, compute where the
- * beginning would be
- */
- dummy_bottom = fip->frame - 4 - NUM_REGS*4 - CALL_DUMMY_LENGTH;
-
- /* check if the PC is in the stack, in a dummy frame */
- if (dummy_bottom <= fip->pc && fip->pc <= fip->frame)
- {
- /* all regs were saved by push_call_dummy () */
- adr = fip->frame - 4;
- for (i = 0; i < NUM_REGS; i++)
- {
- fsrp->regs[i] = adr;
- adr -= 4;
- }
- return;
- }
-#endif
-
- locals = i386_get_frame_setup (get_pc_function_start (fip->pc));
-
- if (locals >= 0)
- {
- adr = fip->frame - 4 - locals;
- for (i = 0; i < 8; i++)
- {
- op = codestream_get ();
- if (op < 0x50 || op > 0x57)
- break;
- fsrp->regs[op - 0x50] = adr;
- adr -= 4;
- }
- }
-
- fsrp->regs[PC_REGNUM] = fip->frame + 4;
- fsrp->regs[FP_REGNUM] = fip->frame;
-}
-
-/* return pc of first real instruction */
-i386_skip_prologue (pc)
-{
- unsigned char op;
- int i;
-
- if (i386_get_frame_setup (pc) < 0)
- return (pc);
-
- /* found valid frame setup - codestream now points to
- * start of push instructions for saving registers
- */
-
- /* skip over register saves */
- for (i = 0; i < 8; i++)
- {
- op = codestream_peek ();
- /* break if not pushl inst */
- if (op < 0x50 || op > 0x57)
- break;
- codestream_get ();
- }
-
- i386_follow_jump ();
-
- return (codestream_tell ());
-}
-
-i386_pop_frame ()
-{
- FRAME frame = get_current_frame ();
- CORE_ADDR fp;
- int regnum;
- struct frame_saved_regs fsr;
- struct frame_info *fi;
-
- fi = get_frame_info (frame);
- fp = fi->frame;
- get_frame_saved_regs (fi, &fsr);
- for (regnum = 0; regnum < NUM_REGS; regnum++)
- {
- CORE_ADDR adr;
- adr = fsr.regs[regnum];
- if (adr)
- write_register (regnum, read_memory_integer (adr, 4));
- }
- write_register (FP_REGNUM, read_memory_integer (fp, 4));
- write_register (PC_REGNUM, read_memory_integer (fp + 4, 4));
- write_register (SP_REGNUM, fp + 8);
- flush_cached_frames ();
- set_current_frame ( create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
-}
-
-/* this table must line up with REGISTER_NAMES in m-i386.h */
-/* symbols like 'EAX' come from <sys/reg.h> */
-static int trapmap[] =
-{
- tEAX, tECX, tEDX, tEBX,
- tESP, tEBP, tESI, tEDI,
- tEIP, tEFLAGS, tCS, tSS,
- tDS, tES, tES, tES /* lies: no fs or gs */
-};
-#if defined(FM_TRAP) || defined(EX_TRAPSTK)
-static int syscallmap[] =
-{
- sEAX, sECX, sEDX, sEBX,
- sESP, sEBP, sESI, sEDI,
- sEIP, sEFLAGS, sCS, sSS,
- sCS, sCS, sCS, sCS /* lies: no ds, es, fs or gs */
-};
-#endif
-static int *regmap;
-
-static void
-setregmap(flags)
- int flags;
-{
-#ifdef FM_TRAP
- regmap = flags & FM_TRAP ? trapmap: syscallmap;
-#elif EX_TRAPSTK
- regmap = flags & EX_TRAPSTK ? trapmap : syscallmap;
-#else
- regmap = trapmap; /* the lesser evil */
-#endif
-}
-
-/* blockend is the value of u.u_ar0, and points to the
- * place where GS is stored
- */
-i386_register_u_addr (blockend, regnum)
-{
-#if 0
- /* this will be needed if fp registers are reinstated */
- /* for now, you can look at them with 'info float'
- * sys5 wont let you change them with ptrace anyway
- */
- if (regnum >= FP0_REGNUM && regnum <= FP7_REGNUM)
- {
- int ubase, fpstate;
- struct user u;
- ubase = blockend + 4 * (SS + 1) - KSTKSZ;
- fpstate = ubase + ((char *)&u.u_fpstate - (char *)&u);
- return (fpstate + 0x1c + 10 * (regnum - FP0_REGNUM));
- }
- else
-#endif
- return (blockend + 4 * regmap[regnum]);
-}
-
-i387_to_double (from, to)
- char *from;
- char *to;
-{
- long *lp;
- /* push extended mode on 387 stack, then pop in double mode
- *
- * first, set exception masks so no error is generated -
- * number will be rounded to inf or 0, if necessary
- */
- asm ("pushl %eax"); /* grab a stack slot */
- asm ("fstcw (%esp)"); /* get 387 control word */
- asm ("movl (%esp),%eax"); /* save old value */
- asm ("orl $0x3f,%eax"); /* mask all exceptions */
- asm ("pushl %eax");
- asm ("fldcw (%esp)"); /* load new value into 387 */
-
- asm ("movl 8(%ebp),%eax");
- asm ("fldt (%eax)"); /* push extended number on 387 stack */
- asm ("fwait");
- asm ("movl 12(%ebp),%eax");
- asm ("fstpl (%eax)"); /* pop double */
- asm ("fwait");
-
- asm ("popl %eax"); /* flush modified control word */
- asm ("fnclex"); /* clear exceptions */
- asm ("fldcw (%esp)"); /* restore original control word */
- asm ("popl %eax"); /* flush saved copy */
-}
-
-double_to_i387 (from, to)
- char *from;
- char *to;
-{
- /* push double mode on 387 stack, then pop in extended mode
- * no errors are possible because every 64-bit pattern
- * can be converted to an extended
- */
- asm ("movl 8(%ebp),%eax");
- asm ("fldl (%eax)");
- asm ("fwait");
- asm ("movl 12(%ebp),%eax");
- asm ("fstpt (%eax)");
- asm ("fwait");
-}
-
-struct env387
-{
- unsigned short control;
- unsigned short r0;
- unsigned short status;
- unsigned short r1;
- unsigned short tag;
- unsigned short r2;
- unsigned long eip;
- unsigned short code_seg;
- unsigned short opcode;
- unsigned long operand;
- unsigned short operand_seg;
- unsigned short r3;
- unsigned char regs[8][10];
-};
-
-static
-print_387_control_word (control)
-unsigned short control;
-{
- printf ("control 0x%04x: ", control);
- printf ("compute to ");
- switch ((control >> 8) & 3)
- {
- case 0: printf ("24 bits; "); break;
- case 1: printf ("(bad); "); break;
- case 2: printf ("53 bits; "); break;
- case 3: printf ("64 bits; "); break;
- }
- printf ("round ");
- switch ((control >> 10) & 3)
- {
- case 0: printf ("NEAREST; "); break;
- case 1: printf ("DOWN; "); break;
- case 2: printf ("UP; "); break;
- case 3: printf ("CHOP; "); break;
- }
- if (control & 0x3f)
- {
- printf ("mask:");
- if (control & 0x0001) printf (" INVALID");
- if (control & 0x0002) printf (" DENORM");
- if (control & 0x0004) printf (" DIVZ");
- if (control & 0x0008) printf (" OVERF");
- if (control & 0x0010) printf (" UNDERF");
- if (control & 0x0020) printf (" LOS");
- printf (";");
- }
- printf ("\n");
- if (control & 0xe080) printf ("warning: reserved bits on 0x%x\n",
- control & 0xe080);
-}
-
-static
-print_387_status_word (status)
- unsigned short status;
-{
- printf ("status 0x%04x: ", status);
- if (status & 0xff)
- {
- printf ("exceptions:");
- if (status & 0x0001) printf (" INVALID");
- if (status & 0x0002) printf (" DENORM");
- if (status & 0x0004) printf (" DIVZ");
- if (status & 0x0008) printf (" OVERF");
- if (status & 0x0010) printf (" UNDERF");
- if (status & 0x0020) printf (" LOS");
- if (status & 0x0040) printf (" FPSTACK");
- printf ("; ");
- }
- printf ("flags: %d%d%d%d; ",
- (status & 0x4000) != 0,
- (status & 0x0400) != 0,
- (status & 0x0200) != 0,
- (status & 0x0100) != 0);
-
- printf ("top %d\n", (status >> 11) & 7);
-}
-
-static
-print_387_status (status, ep)
- unsigned short status;
- struct env387 *ep;
-{
- int i;
- int bothstatus;
- int top;
- int fpreg;
- unsigned char *p;
-
- bothstatus = ((status != 0) && (ep->status != 0));
- if (status != 0)
- {
- if (bothstatus)
- printf ("u: ");
- print_387_status_word (status);
- }
-
- if (ep->status != 0)
- {
- if (bothstatus)
- printf ("e: ");
- print_387_status_word (ep->status);
- }
-
- print_387_control_word (ep->control);
- printf ("last exception: ");
- printf ("opcode 0x%x; ", ep->opcode);
- printf ("pc 0x%x:0x%x; ", ep->code_seg, ep->eip);
- printf ("operand 0x%x:0x%x\n", ep->operand_seg, ep->operand);
-
- top = (ep->status >> 11) & 7;
-
- printf (" regno tag msb lsb value\n");
- for (fpreg = 7; fpreg >= 0; fpreg--)
- {
- int st_regno;
- double val;
-
- /* The physical regno `fpreg' is only relevant as an index into the
- * tag word. Logical `%st' numbers are required for indexing `p->regs.
- */
- st_regno = (fpreg + 8 - top) & 0x7;
-
- printf ("%%st(%d) %s ", st_regno, fpreg == top ? "=>" : " ");
-
- switch ((ep->tag >> (fpreg * 2)) & 3)
- {
- case 0: printf ("valid "); break;
- case 1: printf ("zero "); break;
- case 2: printf ("trap "); break;
- case 3: printf ("empty "); break;
- }
- for (i = 9; i >= 0; i--)
- printf ("%02x", ep->regs[st_regno][i]);
-
- i387_to_double (ep->regs[st_regno], (char *)&val);
- printf (" %g\n", val);
- }
-#if 0 /* reserved fields are always 0xffff on 486's */
- if (ep->r0)
- printf ("warning: reserved0 is 0x%x\n", ep->r0);
- if (ep->r1)
- printf ("warning: reserved1 is 0x%x\n", ep->r1);
- if (ep->r2)
- printf ("warning: reserved2 is 0x%x\n", ep->r2);
- if (ep->r3)
- printf ("warning: reserved3 is 0x%x\n", ep->r3);
-#endif
-}
-
-#ifdef __386BSD__
-#define fpstate save87
-#define U_FPSTATE(u) u.u_pcb.pcb_savefpu
-#endif
-
-#ifndef U_FPSTATE
-#define U_FPSTATE(u) u.u_fpstate
-#endif
-
-i386_float_info ()
-{
- struct user u; /* just for address computations */
- int i;
- /* fpstate defined in <sys/user.h> */
- struct fpstate *fpstatep;
- char buf[sizeof (struct fpstate) + 2 * sizeof (int)];
- unsigned int uaddr;
- char fpvalid;
- unsigned int rounded_addr;
- unsigned int rounded_size;
- extern int corechan;
- int skip;
-
-#ifndef __386BSD__ /* XXX - look at pcb flags */
- uaddr = (char *)&u.u_fpvalid - (char *)&u;
- if (have_inferior_p())
- {
- unsigned int data;
- unsigned int mask;
-
- rounded_addr = uaddr & -sizeof (int);
- data = ptrace (PT_READ_U, inferior_pid, (caddr_t)rounded_addr, 0);
- mask = 0xff << ((uaddr - rounded_addr) * 8);
-
- fpvalid = ((data & mask) != 0);
- }
- else
- {
- if (lseek (corechan, uaddr, 0) < 0)
- perror ("seek on core file");
- if (myread (corechan, &fpvalid, 1) < 0)
- perror ("read on core file");
-
- }
-
- if (fpvalid == 0)
- {
- printf ("no floating point status saved\n");
- return;
- }
-#endif /* not __386BSD__ */
-
- uaddr = (char *)&U_FPSTATE(u) - (char *)&u;
- if (have_inferior_p ())
- {
- int *ip;
-
- rounded_addr = uaddr & -sizeof (int);
- rounded_size = (((uaddr + sizeof (struct fpstate)) - uaddr) +
- sizeof (int) - 1) / sizeof (int);
- skip = uaddr - rounded_addr;
-
- ip = (int *)buf;
- for (i = 0; i < rounded_size; i++)
- {
- *ip++ = ptrace (PT_READ_U, inferior_pid, (caddr_t)rounded_addr, 0);
- rounded_addr += sizeof (int);
- }
- }
- else
- {
- if (lseek (corechan, uaddr, 0) < 0)
- perror_with_name ("seek on core file");
- if (myread (corechan, buf, sizeof (struct fpstate)) < 0)
- perror_with_name ("read from core file");
- skip = 0;
- }
-
-#ifdef __386BSD__
- print_387_status (0, (struct env387 *)buf);
-#else
- fpstatep = (struct fpstate *)(buf + skip);
- print_387_status (fpstatep->status, (struct env387 *)fpstatep->state);
-#endif
-}
-
-void
-_initialize_i386bsd_dep()
-{
-#ifdef KERNELDEBUG
- add_com ("process-address", class_obscure, set_paddr_command,
- "The process identified by (ps-style) ADDR becomes the\n\
-\"current\" process context for kernel debugging.");
- add_com_alias ("paddr", "process-address", class_obscure, 0);
-#endif
-}
diff --git a/gnu/usr.bin/gdb/config/m-i386-sv32.h b/gnu/usr.bin/gdb/config/m-i386-sv32.h
deleted file mode 100644
index 38fb4eb..0000000
--- a/gnu/usr.bin/gdb/config/m-i386-sv32.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Macro defintions for i386, running System V 3.2.
- Copyright (C) 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "m-i386.h"
-
-/* Apparently there is inconsistency among various System V's about what
- the name of this field is. */
-#define U_FPSTATE(u) u.u_fps.u_fpstate
-
-/* TIOCGETC is defined in System V 3.2 termio.h, but struct tchars
- is not. This makes problems for inflow.c. */
-#define TIOCGETC_BROKEN
diff --git a/gnu/usr.bin/gdb/config/m-i386.h b/gnu/usr.bin/gdb/config/m-i386.h
deleted file mode 100644
index 5449ec4..0000000
--- a/gnu/usr.bin/gdb/config/m-i386.h
+++ /dev/null
@@ -1,394 +0,0 @@
-/* Macro defintions for i386.
- Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Define the bit, byte, and word ordering of the machine. */
-/* #define BITS_BIG_ENDIAN */
-/* #define BYTES_BIG_ENDIAN */
-/* #define WORDS_BIG_ENDIAN */
-
-/*
- * Changes for 80386 by Pace Willisson (pace@prep.ai.mit.edu)
- * July 1988
- */
-
-
-#ifndef i386
-#define i386
-#endif
-
-/* I'm running gdb 3.4 under 386/ix 2.0.2, which is a derivative of AT&T's
-Sys V/386 3.2.
-
-On some machines, gdb crashes when it's starting up while calling the
-vendor's termio tgetent() routine. It always works when run under
-itself (actually, under 3.2, it's not an infinitely recursive bug.)
-After some poking around, it appears that depending on the environment
-size, or whether you're running YP, or the phase of the moon or something,
-the stack is not always long-aligned when main() is called, and tgetent()
-takes strong offense at that. On some machines this bug never appears, but
-on those where it does, it occurs quite reliably. */
-#define ALIGN_STACK_ON_STARTUP
-
-/* define USG if you are using sys5 /usr/include's */
-#define USG
-
-/* USG systems need these */
-#define vfork() fork()
-#define MAXPATHLEN 500
-
-/* define this if you don't have the extension to coff that allows
- * file names to appear in the string table
- * (aux.x_file.x_foff)
- */
-#define COFF_NO_LONG_FILE_NAMES
-
-/* turn this on when rest of gdb is ready */
-/* #define IEEE_FLOAT */
-
-#define NBPG NBPC
-#define UPAGES USIZE
-
-#define HAVE_TERMIO
-
-/* Get rid of any system-imposed stack limit if possible. */
-
-/* #define SET_STACK_LIMIT_HUGE not in sys5 */
-
-/* Define this if the C compiler puts an underscore at the front
- of external names before giving them to the linker. */
-
-/* #define NAMES_HAVE_UNDERSCORE */
-
-/* Specify debugger information format. */
-
-/* #define READ_DBX_FORMAT */
-#define COFF_FORMAT
-
-/* number of traps that happen between exec'ing the shell
- * to run an inferior, and when we finally get to
- * the inferior code. This is 2 on most implementations.
- */
-#define START_INFERIOR_TRAPS_EXPECTED 4
-
-/* Offset from address of function to start of its code.
- Zero on most machines. */
-
-#define FUNCTION_START_OFFSET 0
-
-/* Advance PC across any function entry prologue instructions
- to reach some "real" code. */
-
-#define SKIP_PROLOGUE(frompc) {(frompc) = i386_skip_prologue((frompc));}
-
-/* Immediately after a function call, return the saved pc.
- Can't always go through the frames for this because on some machines
- the new frame is not set up until the new function executes
- some instructions. */
-
-#define SAVED_PC_AFTER_CALL(frame) \
- (read_memory_integer (read_register (SP_REGNUM), 4))
-
-/* This is the amount to subtract from u.u_ar0
- to get the offset in the core file of the register values. */
-
-#define KERNEL_U_ADDR 0xe0000000
-
-/* Address of end of stack space. */
-
-#define STACK_END_ADDR 0x80000000
-
-/* Stack grows downward. */
-
-#define INNER_THAN <
-
-/* Sequence of bytes for breakpoint instruction. */
-
-#define BREAKPOINT {0xcc}
-
-/* Amount PC must be decremented by after a breakpoint.
- This is often the number of bytes in BREAKPOINT
- but not always. */
-
-#define DECR_PC_AFTER_BREAK 1
-
-/* Nonzero if instruction at PC is a return instruction. */
-
-#define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) == 0xc3)
-
-/* Return 1 if P points to an invalid floating point value.
- LEN is the length in bytes -- not relevant on the 386. */
-
-#define INVALID_FLOAT(p, len) (0)
-
-/* code to execute to print interesting information about the
- * floating point processor (if any)
- * No need to define if there is nothing to do.
- */
-#define FLOAT_INFO { i386_float_info (); }
-
-
-/* Largest integer type */
-#define LONGEST long
-
-/* Name of the builtin type for the LONGEST type above. */
-#define BUILTIN_TYPE_LONGEST builtin_type_long
-
-/* Say how long (ordinary) registers are. */
-
-#define REGISTER_TYPE long
-
-/* Number of machine registers */
-
-#define NUM_REGS 16
-
-/* Initializer for an array of names of registers.
- There should be NUM_REGS strings in this initializer. */
-
-/* the order of the first 8 registers must match the compiler's
- * numbering scheme (which is the same as the 386 scheme)
- * also, this table must match regmap in i386-pinsn.c.
- */
-#define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \
- "esp", "ebp", "esi", "edi", \
- "eip", "ps", "cs", "ss", \
- "ds", "es", "fs", "gs", \
- }
-
-/* Register numbers of various important registers.
- Note that some of these values are "real" register numbers,
- and correspond to the general registers of the machine,
- and some are "phony" register numbers which are too large
- to be actual register numbers as far as the user is concerned
- but do serve to get the desired values when passed to read_register. */
-
-#define FP_REGNUM 5 /* Contains address of executing stack frame */
-#define SP_REGNUM 4 /* Contains address of top of stack */
-
-#define PC_REGNUM 8
-#define PS_REGNUM 9
-
-#define REGISTER_U_ADDR(addr, blockend, regno) \
- (addr) = i386_register_u_addr ((blockend),(regno));
-
-/* Total amount of space needed to store our copies of the machine's
- register state, the array `registers'. */
-#define REGISTER_BYTES (NUM_REGS * 4)
-
-/* Index within `registers' of the first byte of the space for
- register N. */
-
-#define REGISTER_BYTE(N) ((N)*4)
-
-/* Number of bytes of storage in the actual machine representation
- for register N. */
-
-#define REGISTER_RAW_SIZE(N) (4)
-
-/* Number of bytes of storage in the program's representation
- for register N. */
-
-#define REGISTER_VIRTUAL_SIZE(N) (4)
-
-/* Largest value REGISTER_RAW_SIZE can have. */
-
-#define MAX_REGISTER_RAW_SIZE 4
-
-/* Largest value REGISTER_VIRTUAL_SIZE can have. */
-
-#define MAX_REGISTER_VIRTUAL_SIZE 4
-
-/* Nonzero if register N requires conversion
- from raw format to virtual format. */
-
-#define REGISTER_CONVERTIBLE(N) (0)
-
-/* Convert data from raw format for register REGNUM
- to virtual format for register REGNUM. */
-
-#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) {bcopy ((FROM), (TO), 4);}
-
-/* Convert data from virtual format for register REGNUM
- to raw format for register REGNUM. */
-
-#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) {bcopy ((FROM), (TO), 4);}
-
-/* Return the GDB type object for the "standard" data type
- of data in register N. */
-
-#define REGISTER_VIRTUAL_TYPE(N) (builtin_type_int)
-
-/* Store the address of the place in which to copy the structure the
- subroutine will return. This is called from call_function. */
-
-#define STORE_STRUCT_RETURN(ADDR, SP) \
- { (SP) -= sizeof (ADDR); \
- write_memory ((SP), &(ADDR), sizeof (ADDR)); }
-
-/* Extract from an array REGBUF containing the (raw) register state
- a function return value of type TYPE, and copy that, in virtual format,
- into VALBUF. */
-
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- bcopy (REGBUF, VALBUF, TYPE_LENGTH (TYPE))
-
-/* Write into appropriate registers a function return value
- of type TYPE, given in virtual format. */
-
-#define STORE_RETURN_VALUE(TYPE,VALBUF) \
- write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE))
-
-/* Extract from an array REGBUF containing the (raw) register state
- the address in which a function should return its structure value,
- as a CORE_ADDR (or an expression that can be used as one). */
-
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
-
-
-/* Describe the pointer in each stack frame to the previous stack frame
- (its caller). */
-
-/* FRAME_CHAIN takes a frame's nominal address
- and produces the frame's chain-pointer.
-
- FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address
- and produces the nominal address of the caller frame.
-
- However, if FRAME_CHAIN_VALID returns zero,
- it means the given frame is the outermost one and has no caller.
- In that case, FRAME_CHAIN_COMBINE is not used. */
-
-#define FRAME_CHAIN(thisframe) \
- (outside_startup_file ((thisframe)->pc) ? \
- read_memory_integer ((thisframe)->frame, 4) :\
- 0)
-
-#define FRAME_CHAIN_VALID(chain, thisframe) \
- (chain != 0 && (outside_startup_file (FRAME_SAVED_PC (thisframe))))
-
-#define FRAME_CHAIN_COMBINE(chain, thisframe) (chain)
-
-/* Define other aspects of the stack frame. */
-
-/* A macro that tells us whether the function invocation represented
- by FI does not have a frame on the stack associated with it. If it
- does not, FRAMELESS is set to 1, else 0. */
-#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
- FRAMELESS_LOOK_FOR_PROLOGUE(FI, FRAMELESS)
-
-#define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4))
-
-#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
-
-#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
-
-/* Return number of args passed to a frame.
- Can return -1, meaning no way to tell. */
-
-#define FRAME_NUM_ARGS(numargs, fi) (numargs) = i386_frame_num_args(fi)
-
-/* Return number of bytes at start of arglist that are not really args. */
-
-#define FRAME_ARGS_SKIP 8
-
-/* Put here the code to store, into a struct frame_saved_regs,
- the addresses of the saved registers of frame described by FRAME_INFO.
- This includes special registers such as pc and fp saved in special
- ways in the stack frame. sp is even more special:
- the address we return for it IS the sp for the next frame. */
-
-#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
-{ i386_frame_find_saved_regs ((frame_info), &(frame_saved_regs)); }
-
-
-/* Things needed for making the inferior call functions. */
-
-/* Push an empty stack frame, to record the current PC, etc. */
-
-#define PUSH_DUMMY_FRAME { i386_push_dummy_frame (); }
-
-/* Discard from the stack the innermost frame, restoring all registers. */
-
-#define POP_FRAME { i386_pop_frame (); }
-
-/* this is
- * call 11223344 (32 bit relative)
- * int3
- */
-
-#define CALL_DUMMY { 0x223344e8, 0xcc11 }
-
-#define CALL_DUMMY_LENGTH 8
-
-#define CALL_DUMMY_START_OFFSET 0 /* Start execution at beginning of dummy */
-
-/* Insert the specified number of args and function address
- into a call sequence of the above form stored at DUMMYNAME. */
-
-#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, type) \
-{ \
- int from, to, delta, loc; \
- loc = (int)(read_register (SP_REGNUM) - CALL_DUMMY_LENGTH); \
- from = loc + 5; \
- to = (int)(fun); \
- delta = to - from; \
- *(int *)((char *)(dummyname) + 1) = delta; \
-}
-
-
-#if 0
-/* Interface definitions for kernel debugger KDB. */
-
-/* Map machine fault codes into signal numbers.
- First subtract 0, divide by 4, then index in a table.
- Faults for which the entry in this table is 0
- are not handled by KDB; the program's own trap handler
- gets to handle then. */
-
-#define FAULT_CODE_ORIGIN 0
-#define FAULT_CODE_UNITS 4
-#define FAULT_TABLE \
-{ 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0}
-
-/* Start running with a stack stretching from BEG to END.
- BEG and END should be symbols meaningful to the assembler.
- This is used only for kdb. */
-
-#define INIT_STACK(beg, end) {}
-
-/* Push the frame pointer register on the stack. */
-#define PUSH_FRAME_PTR {}
-
-/* Copy the top-of-stack to the frame pointer register. */
-#define POP_FRAME_PTR {}
-
-/* After KDB is entered by a fault, push all registers
- that GDB thinks about (all NUM_REGS of them),
- so that they appear in order of ascending GDB register number.
- The fault code will be on the stack beyond the last register. */
-
-#define PUSH_REGISTERS {}
-
-/* Assuming the registers (including processor status) have been
- pushed on the stack in order of ascending GDB register number,
- restore them and return to the address in the saved PC register. */
-
-#define POP_REGISTERS {}
-#endif
diff --git a/gnu/usr.bin/gdb/config/m-i386bsd.h b/gnu/usr.bin/gdb/config/m-i386bsd.h
deleted file mode 100644
index 15d97b2..0000000
--- a/gnu/usr.bin/gdb/config/m-i386bsd.h
+++ /dev/null
@@ -1,375 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1991 by William Jolitz at UUNET Technologies, Inc.
- *
- * @(#)m-i386bsd.h 6.7 (Berkeley) 5/8/91
- */
-
-/* Macro definitions for i386.
- Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Define the bit, byte, and word ordering of the machine. */
-/* #define BITS_BIG_ENDIAN */
-/* #define BYTES_BIG_ENDIAN */
-/* #define WORDS_BIG_ENDIAN */
-
-/*
- * Changes for 80386 by Pace Willisson (pace@prep.ai.mit.edu)
- * July 1988
- * [ MODIFIED FOR 386BSD W. Jolitz ]
- */
-
-#ifndef i386
-#define i386 1
-#define i386b 1
-#endif
-
-#define IEEE_FLOAT
-#define LONG_LONG
-
-/* Library stuff: POSIX tty (not supported yet), V7 tty (sigh), vprintf. */
-
-#define HAVE_TERMIOS 1
-#define USE_OLD_TTY 1
-#define HAVE_VPRINTF 1
-
-/* We support local and remote kernel debugging. */
-
-#define KERNELDEBUG 1
-
-/* Get rid of any system-imposed stack limit if possible. */
-
-#define SET_STACK_LIMIT_HUGE
-
-/* Define this if the C compiler puts an underscore at the front
- of external names before giving them to the linker. */
-
-#define NAMES_HAVE_UNDERSCORE
-
-/* Specify debugger information format. */
-
-#define READ_DBX_FORMAT
-
-/* number of traps that happen between exec'ing the shell
- * to run an inferior, and when we finally get to
- * the inferior code. This is 2 on most implementations.
- */
-#define START_INFERIOR_TRAPS_EXPECTED 2
-
-/* Offset from address of function to start of its code.
- Zero on most machines. */
-
-#define FUNCTION_START_OFFSET 0
-
-/* Advance PC across any function entry prologue instructions
- to reach some "real" code. */
-
-#define SKIP_PROLOGUE(frompc) {(frompc) = i386_skip_prologue((frompc));}
-
-/* Immediately after a function call, return the saved pc.
- Can't always go through the frames for this because on some machines
- the new frame is not set up until the new function executes
- some instructions. */
-
-#define SAVED_PC_AFTER_CALL(frame) \
- (read_memory_integer (read_register (SP_REGNUM), 4))
-
-/* This is the amount to subtract from u.u_ar0
- to get the offset in the core file of the register values. */
-
-#ifdef NEWVM
-#include <machine/vmparam.h>
-#define KERNEL_U_ADDR USRSTACK
-#else
-#define KERNEL_U_ADDR 0xfdffd000
-#endif
-
-/* Address of end of stack space. */
-
-#define STACK_END_ADDR KERNEL_U_ADDR
-
-/* Stack grows downward. */
-
-#define INNER_THAN <
-
-/* Sequence of bytes for breakpoint instruction. */
-
-#define BREAKPOINT {0xcc}
-
-/* Amount PC must be decremented by after a breakpoint.
- This is often the number of bytes in BREAKPOINT
- but not always. */
-
-#define DECR_PC_AFTER_BREAK 1
-
-/* Nonzero if instruction at PC is a return instruction. */
-
-#define ABOUT_TO_RETURN(pc) \
- strchr("\302\303\312\313\317", read_memory_integer(pc, 1))
-
-/* Return 1 if P points to an invalid floating point value.
- LEN is the length in bytes -- not relevant on the 386. */
-
-#define INVALID_FLOAT(p, len) (0)
-
-/* code to execute to print interesting information about the
- * floating point processor (if any)
- * No need to define if there is nothing to do.
- */
-#define FLOAT_INFO { i386_float_info (); }
-
-
-/* Largest integer type */
-#define LONGEST long long
-
-/* Name of the builtin type for the LONGEST type above. */
-#define BUILTIN_TYPE_LONGEST builtin_type_long_long
-
-/* Say how long (ordinary) registers are. */
-
-#define REGISTER_TYPE long
-
-/* Number of machine registers */
-
-#define NUM_REGS 16
-
-/* Initializer for an array of names of registers.
- There should be NUM_REGS strings in this initializer. */
-
-/* the order of the first 8 registers must match the compiler's
- * numbering scheme (which is the same as the 386 scheme)
- * also, this table must match regmap in i386-pinsn.c.
- */
-#define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \
- "esp", "ebp", "esi", "edi", \
- "eip", "ps", "cs", "ss", \
- "ds", "es", "fs", "gs", \
- }
-
-/* Register numbers of various important registers.
- Note that some of these values are "real" register numbers,
- and correspond to the general registers of the machine,
- and some are "phony" register numbers which are too large
- to be actual register numbers as far as the user is concerned
- but do serve to get the desired values when passed to read_register. */
-
-#define FP_REGNUM 5 /* Contains address of executing stack frame */
-#define SP_REGNUM 4 /* Contains address of top of stack */
-
-#define PC_REGNUM 8
-#define PS_REGNUM 9
-
-#define REGISTER_U_ADDR(addr, blockend, regno) \
- (addr) = i386_register_u_addr ((blockend),(regno));
-
-/* Total amount of space needed to store our copies of the machine's
- register state, the array `registers'. */
-#define REGISTER_BYTES (NUM_REGS * 4)
-
-/* Index within `registers' of the first byte of the space for
- register N. */
-
-#define REGISTER_BYTE(N) ((N)*4)
-
-/* Number of bytes of storage in the actual machine representation
- for register N. */
-
-#define REGISTER_RAW_SIZE(N) (4)
-
-/* Number of bytes of storage in the program's representation
- for register N. */
-
-#define REGISTER_VIRTUAL_SIZE(N) (4)
-
-/* Largest value REGISTER_RAW_SIZE can have. */
-
-#define MAX_REGISTER_RAW_SIZE 4
-
-/* Largest value REGISTER_VIRTUAL_SIZE can have. */
-
-#define MAX_REGISTER_VIRTUAL_SIZE 4
-
-/* Nonzero if register N requires conversion
- from raw format to virtual format. */
-
-#define REGISTER_CONVERTIBLE(N) (0)
-
-/* Convert data from raw format for register REGNUM
- to virtual format for register REGNUM. */
-
-#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) {bcopy ((FROM), (TO), 4);}
-
-/* Convert data from virtual format for register REGNUM
- to raw format for register REGNUM. */
-
-#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) {bcopy ((FROM), (TO), 4);}
-
-/* Return the GDB type object for the "standard" data type
- of data in register N. */
-
-#define REGISTER_VIRTUAL_TYPE(N) (builtin_type_int)
-
-/* Store the address of the place in which to copy the structure the
- subroutine will return. This is called from call_function. */
-
-#define STORE_STRUCT_RETURN(ADDR, SP) \
- { (SP) -= sizeof (ADDR); \
- write_memory ((SP), &(ADDR), sizeof (ADDR)); }
-
-/* Extract from an array REGBUF containing the (raw) register state
- a function return value of type TYPE, and copy that, in virtual format,
- into VALBUF. */
-
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- bcopy (REGBUF, VALBUF, TYPE_LENGTH (TYPE))
-
-/* Write into appropriate registers a function return value
- of type TYPE, given in virtual format. */
-
-#define STORE_RETURN_VALUE(TYPE,VALBUF) \
- write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE))
-
-/* Extract from an array REGBUF containing the (raw) register state
- the address in which a function should return its structure value,
- as a CORE_ADDR (or an expression that can be used as one). */
-
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
-
-
-/* Describe the pointer in each stack frame to the previous stack frame
- (its caller). */
-
-/* FRAME_CHAIN takes a frame's nominal address
- and produces the frame's chain-pointer.
-
- FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address
- and produces the nominal address of the caller frame.
-
- However, if FRAME_CHAIN_VALID returns zero,
- it means the given frame is the outermost one and has no caller.
- In that case, FRAME_CHAIN_COMBINE is not used. */
-
-#define FRAME_CHAIN(thisframe) \
- (outside_startup_file ((thisframe)->pc) ? \
- read_memory_integer ((thisframe)->frame, 4) :\
- 0)
-
-#ifdef KERNELDEBUG
-#define KERNTEXT_BASE 0xfe000000
-#ifdef NEWVM
-#define KERNSTACK_TOP (read_register(SP_REGNUM) + 0x2000) /* approximate */
-#else
-/* #define KERNSTACK_TOP (P1PAGES << PGSHIFT) */
-#define KERNSTACK_TOP 0xfe000000
-#endif
-extern int kernel_debugging;
-#define FRAME_CHAIN_VALID(chain, thisframe) \
- (chain != 0 && \
- !kernel_debugging ? outside_startup_file(FRAME_SAVED_PC(thisframe)) :\
- (chain >= read_register(SP_REGNUM) && chain < KERNSTACK_TOP))
-#else
-#define FRAME_CHAIN_VALID(chain, thisframe) \
- (chain != 0 && (outside_startup_file (FRAME_SAVED_PC (thisframe))))
-#endif
-
-#define FRAME_CHAIN_COMBINE(chain, thisframe) (chain)
-
-/* Define other aspects of the stack frame. */
-
-/* A macro that tells us whether the function invocation represented
- by FI does not have a frame on the stack associated with it. If it
- does not, FRAMELESS is set to 1, else 0. */
-#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
- FRAMELESS_LOOK_FOR_PROLOGUE(FI, FRAMELESS)
-
-#define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4))
-
-#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
-
-#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
-
-/* Return number of args passed to a frame.
- Can return -1, meaning no way to tell. */
-
-#define FRAME_NUM_ARGS(numargs, fi) (numargs) = i386_frame_num_args(fi)
-
-/* Return number of bytes at start of arglist that are not really args. */
-
-#define FRAME_ARGS_SKIP 8
-
-/* Put here the code to store, into a struct frame_saved_regs,
- the addresses of the saved registers of frame described by FRAME_INFO.
- This includes special registers such as pc and fp saved in special
- ways in the stack frame. sp is even more special:
- the address we return for it IS the sp for the next frame. */
-
-#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
-{ i386_frame_find_saved_regs ((frame_info), &(frame_saved_regs)); }
-
-
-/* Discard from the stack the innermost frame, restoring all registers. */
-
-#define POP_FRAME { i386_pop_frame (); }
-
-#define NEW_CALL_FUNCTION
-
-#if 0
-/* Interface definitions for kernel debugger KDB. */
-
-/* Map machine fault codes into signal numbers.
- First subtract 0, divide by 4, then index in a table.
- Faults for which the entry in this table is 0
- are not handled by KDB; the program's own trap handler
- gets to handle then. */
-
-#define FAULT_CODE_ORIGIN 0
-#define FAULT_CODE_UNITS 4
-#define FAULT_TABLE \
-{ 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0}
-
-/* Start running with a stack stretching from BEG to END.
- BEG and END should be symbols meaningful to the assembler.
- This is used only for kdb. */
-
-#define INIT_STACK(beg, end) {}
-
-/* Push the frame pointer register on the stack. */
-#define PUSH_FRAME_PTR {}
-
-/* Copy the top-of-stack to the frame pointer register. */
-#define POP_FRAME_PTR {}
-
-/* After KDB is entered by a fault, push all registers
- that GDB thinks about (all NUM_REGS of them),
- so that they appear in order of ascending GDB register number.
- The fault code will be on the stack beyond the last register. */
-
-#define PUSH_REGISTERS {}
-
-/* Assuming the registers (including processor status) have been
- pushed on the stack in order of ascending GDB register number,
- restore them and return to the address in the saved PC register. */
-
-#define POP_REGISTERS {}
-#endif
diff --git a/gnu/usr.bin/gdb/config/m-i386g-sv32.h b/gnu/usr.bin/gdb/config/m-i386g-sv32.h
deleted file mode 100644
index 3d69eea..0000000
--- a/gnu/usr.bin/gdb/config/m-i386g-sv32.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Macro defintions for i386, running System V 3.2.
- Copyright (C) 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "m-i386gas.h"
-
-/* Apparently there is inconsistency among various System V's about what
- the name of this field is. */
-#define U_FPSTATE(u) u.u_fps.u_fpstate
-
-/* TIOCGETC is defined in System V 3.2 termio.h, but struct tchars
- is not. This makes problems for inflow.c. */
-#define TIOCGETC_BROKEN
diff --git a/gnu/usr.bin/gdb/config/m-i386gas.h b/gnu/usr.bin/gdb/config/m-i386gas.h
deleted file mode 100644
index fbd2138..0000000
--- a/gnu/usr.bin/gdb/config/m-i386gas.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Macro definitions for i386 using the GNU object file format.
- Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/*
- * Changes for 80386 by Pace Willisson (pace@prep.ai.mit.edu)
- * July 1988
- *
- * i386gnu: COFF_ENCAPSULATE
- */
-
-
-#define COFF_ENCAPSULATE
-
-#include "m-i386.h"
-
-
-#define NAMES_HAVE_UNDERSCORE
-
-#undef COFF_FORMAT
-#define READ_DBX_FORMAT
-
diff --git a/gnu/usr.bin/gdb/copying.c b/gnu/usr.bin/gdb/copying.c
deleted file mode 100644
index b3d7519..0000000
--- a/gnu/usr.bin/gdb/copying.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/* Do not modify this file; it is created automatically
- by copying.awk. */
-extern int immediate_quit;
-static void
-copying_info ()
-{
- immediate_quit++;
- printf_filtered ("\n");
- printf_filtered (" GNU GENERAL PUBLIC LICENSE\n");
- printf_filtered (" Version 1, February 1989\n");
- printf_filtered ("\n");
- printf_filtered (" Copyright (C) 1989 Free Software Foundation, Inc.\n");
- printf_filtered (" 675 Mass Ave, Cambridge, MA 02139, USA\n");
- printf_filtered (" Everyone is permitted to copy and distribute verbatim copies\n");
- printf_filtered (" of this license document, but changing it is not allowed.\n");
- printf_filtered ("\n");
- printf_filtered (" Preamble\n");
- printf_filtered ("\n");
- printf_filtered (" The license agreements of most software companies try to keep users\n");
- printf_filtered ("at the mercy of those companies. By contrast, our General Public\n");
- printf_filtered ("License is intended to guarantee your freedom to share and change free\n");
- printf_filtered ("software--to make sure the software is free for all its users. The\n");
- printf_filtered ("General Public License applies to the Free Software Foundation's\n");
- printf_filtered ("software and to any other program whose authors commit to using it.\n");
- printf_filtered ("You can use it for your programs, too.\n");
- printf_filtered ("\n");
- printf_filtered (" When we speak of free software, we are referring to freedom, not\n");
- printf_filtered ("price. Specifically, the General Public License is designed to make\n");
- printf_filtered ("sure that you have the freedom to give away or sell copies of free\n");
- printf_filtered ("software, that you receive source code or can get it if you want it,\n");
- printf_filtered ("that you can change the software or use pieces of it in new free\n");
- printf_filtered ("programs; and that you know you can do these things.\n");
- printf_filtered ("\n");
- printf_filtered (" To protect your rights, we need to make restrictions that forbid\n");
- printf_filtered ("anyone to deny you these rights or to ask you to surrender the rights.\n");
- printf_filtered ("These restrictions translate to certain responsibilities for you if you\n");
- printf_filtered ("distribute copies of the software, or if you modify it.\n");
- printf_filtered ("\n");
- printf_filtered (" For example, if you distribute copies of a such a program, whether\n");
- printf_filtered ("gratis or for a fee, you must give the recipients all the rights that\n");
- printf_filtered ("you have. You must make sure that they, too, receive or can get the\n");
- printf_filtered ("source code. And you must tell them their rights.\n");
- printf_filtered ("\n");
- printf_filtered (" We protect your rights with two steps: (1) copyright the software, and\n");
- printf_filtered ("(2) offer you this license which gives you legal permission to copy,\n");
- printf_filtered ("distribute and/or modify the software.\n");
- printf_filtered ("\n");
- printf_filtered (" Also, for each author's protection and ours, we want to make certain\n");
- printf_filtered ("that everyone understands that there is no warranty for this free\n");
- printf_filtered ("software. If the software is modified by someone else and passed on, we\n");
- printf_filtered ("want its recipients to know that what they have is not the original, so\n");
- printf_filtered ("that any problems introduced by others will not reflect on the original\n");
- printf_filtered ("authors' reputations.\n");
- printf_filtered ("\n");
- printf_filtered (" The precise terms and conditions for copying, distribution and\n");
- printf_filtered ("modification follow.\n");
- printf_filtered (" \n");
- printf_filtered (" GNU GENERAL PUBLIC LICENSE\n");
- printf_filtered (" TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n");
- printf_filtered ("\n");
- printf_filtered (" 0. This License Agreement applies to any program or other work which\n");
- printf_filtered ("contains a notice placed by the copyright holder saying it may be\n");
- printf_filtered ("distributed under the terms of this General Public License. The\n");
- printf_filtered ("\"Program\", below, refers to any such program or work, and a \"work based\n");
- printf_filtered ("on the Program\" means either the Program or any work containing the\n");
- printf_filtered ("Program or a portion of it, either verbatim or with modifications. Each\n");
- printf_filtered ("licensee is addressed as \"you\".\n");
- printf_filtered ("\n");
- printf_filtered (" 1. You may copy and distribute verbatim copies of the Program's source\n");
- printf_filtered ("code as you receive it, in any medium, provided that you conspicuously and\n");
- printf_filtered ("appropriately publish on each copy an appropriate copyright notice and\n");
- printf_filtered ("disclaimer of warranty; keep intact all the notices that refer to this\n");
- printf_filtered ("General Public License and to the absence of any warranty; and give any\n");
- printf_filtered ("other recipients of the Program a copy of this General Public License\n");
- printf_filtered ("along with the Program. You may charge a fee for the physical act of\n");
- printf_filtered ("transferring a copy.\n");
- printf_filtered ("\n");
- printf_filtered (" 2. You may modify your copy or copies of the Program or any portion of\n");
- printf_filtered ("it, and copy and distribute such modifications under the terms of Paragraph\n");
- printf_filtered ("1 above, provided that you also do the following:\n");
- printf_filtered ("\n");
- printf_filtered (" a) cause the modified files to carry prominent notices stating that\n");
- printf_filtered (" you changed the files and the date of any change; and\n");
- printf_filtered ("\n");
- printf_filtered (" b) cause the whole of any work that you distribute or publish, that\n");
- printf_filtered (" in whole or in part contains the Program or any part thereof, either\n");
- printf_filtered (" with or without modifications, to be licensed at no charge to all\n");
- printf_filtered (" third parties under the terms of this General Public License (except\n");
- printf_filtered (" that you may choose to grant warranty protection to some or all\n");
- printf_filtered (" third parties, at your option).\n");
- printf_filtered ("\n");
- printf_filtered (" c) If the modified program normally reads commands interactively when\n");
- printf_filtered (" run, you must cause it, when started running for such interactive use\n");
- printf_filtered (" in the simplest and most usual way, to print or display an\n");
- printf_filtered (" announcement including an appropriate copyright notice and a notice\n");
- printf_filtered (" that there is no warranty (or else, saying that you provide a\n");
- printf_filtered (" warranty) and that users may redistribute the program under these\n");
- printf_filtered (" conditions, and telling the user how to view a copy of this General\n");
- printf_filtered (" Public License.\n");
- printf_filtered ("\n");
- printf_filtered (" d) You may charge a fee for the physical act of transferring a\n");
- printf_filtered (" copy, and you may at your option offer warranty protection in\n");
- printf_filtered (" exchange for a fee.\n");
- printf_filtered ("\n");
- printf_filtered ("Mere aggregation of another independent work with the Program (or its\n");
- printf_filtered ("derivative) on a volume of a storage or distribution medium does not bring\n");
- printf_filtered ("the other work under the scope of these terms.\n");
- printf_filtered (" \n");
- printf_filtered (" 3. You may copy and distribute the Program (or a portion or derivative of\n");
- printf_filtered ("it, under Paragraph 2) in object code or executable form under the terms of\n");
- printf_filtered ("Paragraphs 1 and 2 above provided that you also do one of the following:\n");
- printf_filtered ("\n");
- printf_filtered (" a) accompany it with the complete corresponding machine-readable\n");
- printf_filtered (" source code, which must be distributed under the terms of\n");
- printf_filtered (" Paragraphs 1 and 2 above; or,\n");
- printf_filtered ("\n");
- printf_filtered (" b) accompany it with a written offer, valid for at least three\n");
- printf_filtered (" years, to give any third party free (except for a nominal charge\n");
- printf_filtered (" for the cost of distribution) a complete machine-readable copy of the\n");
- printf_filtered (" corresponding source code, to be distributed under the terms of\n");
- printf_filtered (" Paragraphs 1 and 2 above; or,\n");
- printf_filtered ("\n");
- printf_filtered (" c) accompany it with the information you received as to where the\n");
- printf_filtered (" corresponding source code may be obtained. (This alternative is\n");
- printf_filtered (" allowed only for noncommercial distribution and only if you\n");
- printf_filtered (" received the program in object code or executable form alone.)\n");
- printf_filtered ("\n");
- printf_filtered ("Source code for a work means the preferred form of the work for making\n");
- printf_filtered ("modifications to it. For an executable file, complete source code means\n");
- printf_filtered ("all the source code for all modules it contains; but, as a special\n");
- printf_filtered ("exception, it need not include source code for modules which are standard\n");
- printf_filtered ("libraries that accompany the operating system on which the executable\n");
- printf_filtered ("file runs, or for standard header files or definitions files that\n");
- printf_filtered ("accompany that operating system.\n");
- printf_filtered ("\n");
- printf_filtered (" 4. You may not copy, modify, sublicense, distribute or transfer the\n");
- printf_filtered ("Program except as expressly provided under this General Public License.\n");
- printf_filtered ("Any attempt otherwise to copy, modify, sublicense, distribute or transfer\n");
- printf_filtered ("the Program is void, and will automatically terminate your rights to use\n");
- printf_filtered ("the Program under this License. However, parties who have received\n");
- printf_filtered ("copies, or rights to use copies, from you under this General Public\n");
- printf_filtered ("License will not have their licenses terminated so long as such parties\n");
- printf_filtered ("remain in full compliance.\n");
- printf_filtered ("\n");
- printf_filtered (" 5. By copying, distributing or modifying the Program (or any work based\n");
- printf_filtered ("on the Program) you indicate your acceptance of this license to do so,\n");
- printf_filtered ("and all its terms and conditions.\n");
- printf_filtered ("\n");
- printf_filtered (" 6. Each time you redistribute the Program (or any work based on the\n");
- printf_filtered ("Program), the recipient automatically receives a license from the original\n");
- printf_filtered ("licensor to copy, distribute or modify the Program subject to these\n");
- printf_filtered ("terms and conditions. You may not impose any further restrictions on the\n");
- printf_filtered ("recipients' exercise of the rights granted herein.\n");
- printf_filtered (" \n");
- printf_filtered (" 7. The Free Software Foundation may publish revised and/or new versions\n");
- printf_filtered ("of the General Public License from time to time. Such new versions will\n");
- printf_filtered ("be similar in spirit to the present version, but may differ in detail to\n");
- printf_filtered ("address new problems or concerns.\n");
- printf_filtered ("\n");
- printf_filtered ("Each version is given a distinguishing version number. If the Program\n");
- printf_filtered ("specifies a version number of the license which applies to it and \"any\n");
- printf_filtered ("later version\", you have the option of following the terms and conditions\n");
- printf_filtered ("either of that version or of any later version published by the Free\n");
- printf_filtered ("Software Foundation. If the Program does not specify a version number of\n");
- printf_filtered ("the license, you may choose any version ever published by the Free Software\n");
- printf_filtered ("Foundation.\n");
- printf_filtered ("\n");
- printf_filtered (" 8. If you wish to incorporate parts of the Program into other free\n");
- printf_filtered ("programs whose distribution conditions are different, write to the author\n");
- printf_filtered ("to ask for permission. For software which is copyrighted by the Free\n");
- printf_filtered ("Software Foundation, write to the Free Software Foundation; we sometimes\n");
- printf_filtered ("make exceptions for this. Our decision will be guided by the two goals\n");
- printf_filtered ("of preserving the free status of all derivatives of our free software and\n");
- printf_filtered ("of promoting the sharing and reuse of software generally.\n");
- printf_filtered ("\n");
- immediate_quit--;
-}
-
-static void
-warranty_info ()
-{
- immediate_quit++;
- printf_filtered (" NO WARRANTY\n");
- printf_filtered ("\n");
- printf_filtered (" 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\n");
- printf_filtered ("FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN\n");
- printf_filtered ("OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\n");
- printf_filtered ("PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\n");
- printf_filtered ("OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n");
- printf_filtered ("MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS\n");
- printf_filtered ("TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE\n");
- printf_filtered ("PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\n");
- printf_filtered ("REPAIR OR CORRECTION.\n");
- printf_filtered ("\n");
- printf_filtered (" 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\n");
- printf_filtered ("WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\n");
- printf_filtered ("REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\n");
- printf_filtered ("INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\n");
- printf_filtered ("OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\n");
- printf_filtered ("TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\n");
- printf_filtered ("YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\n");
- printf_filtered ("PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\n");
- printf_filtered ("POSSIBILITY OF SUCH DAMAGES.\n");
- printf_filtered ("\n");
- immediate_quit--;
-}
-
-void
-_initialize_copying ()
-{
- add_info ("copying", copying_info,
- "Conditions for redistributing copies of GDB.");
- add_info ("warranty", warranty_info,
- "Various kinds of warranty you do not have.");
-}
diff --git a/gnu/usr.bin/gdb/core.c b/gnu/usr.bin/gdb/core.c
deleted file mode 100644
index 307addb..0000000
--- a/gnu/usr.bin/gdb/core.c
+++ /dev/null
@@ -1,581 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)core.c 6.3 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* Work with core dump and executable files, for GDB.
- Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include "defs.h"
-#include "param.h"
-#include "frame.h" /* required by inferior.h */
-#include "inferior.h"
-
-#ifdef USG
-#include <sys/types.h>
-#include <fcntl.h>
-#endif
-
-#ifdef COFF_ENCAPSULATE
-#include "a.out.encap.h"
-#else
-#include <a.out.h>
-#endif
-#ifndef N_MAGIC
-#ifdef COFF_FORMAT
-#define N_MAGIC(exec) ((exec).magic)
-#else
-#define N_MAGIC(exec) ((exec).a_magic)
-#endif
-#endif
-#include <signal.h>
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-
-#ifdef UMAX_CORE
-#include <sys/ptrace.h>
-#else
-#include <sys/user.h>
-#endif
-
-#ifndef N_TXTADDR
-#define N_TXTADDR(hdr) 0
-#endif /* no N_TXTADDR */
-
-#ifndef N_DATADDR
-#define N_DATADDR(hdr) hdr.a_text
-#endif /* no N_DATADDR */
-
-#ifndef COFF_FORMAT
-#ifndef AOUTHDR
-#define AOUTHDR struct exec
-#endif
-#endif
-
-extern char *sys_siglist[];
-
-extern core_file_command (), exec_file_command ();
-
-/* Hook for `exec_file_command' command to call. */
-
-void (*exec_file_display_hook) ();
-
-/* File names of core file and executable file. */
-
-char *corefile;
-char *execfile;
-
-/* Descriptors on which core file and executable file are open.
- Note that the execchan is closed when an inferior is created
- and reopened if the inferior dies or is killed. */
-
-int corechan;
-int execchan;
-
-/* Last modification time of executable file.
- Also used in source.c to compare against mtime of a source file. */
-
-int exec_mtime;
-
-/* Virtual addresses of bounds of the two areas of memory in the core file. */
-
-CORE_ADDR data_start;
-CORE_ADDR data_end;
-CORE_ADDR stack_start;
-CORE_ADDR stack_end;
-
-#if defined (REG_STACK_SEGMENT)
-/* Start and end of the register stack segment. */
-CORE_ADDR reg_stack_start;
-CORE_ADDR reg_stack_end;
-#endif /* REG_STACK_SEGMENT */
-
-/* Virtual addresses of bounds of two areas of memory in the exec file.
- Note that the data area in the exec file is used only when there is no core file. */
-
-CORE_ADDR text_start;
-CORE_ADDR text_end;
-
-CORE_ADDR exec_data_start;
-CORE_ADDR exec_data_end;
-
-/* Offset within executable file of start of text area data. */
-
-int text_offset;
-
-/* Offset within executable file of start of data area data. */
-
-int exec_data_offset;
-
-/* Offset within core file of start of data area data. */
-
-int data_offset;
-
-/* Offset within core file of start of stack area data. */
-
-int stack_offset;
-
-#ifdef COFF_FORMAT
-/* various coff data structures */
-
-FILHDR file_hdr;
-SCNHDR text_hdr;
-SCNHDR data_hdr;
-
-#endif /* not COFF_FORMAT */
-
-/* a.out header saved in core file. */
-
-AOUTHDR core_aouthdr;
-
-/* a.out header of exec file. */
-
-AOUTHDR exec_aouthdr;
-
-void validate_files ();
-unsigned int register_addr ();
-
-/* Call this to specify the hook for exec_file_command to call back.
- This is called from the x-window display code. */
-
-void
-specify_exec_file_hook (hook)
- void (*hook) ();
-{
- exec_file_display_hook = hook;
-}
-
-/* The exec file must be closed before running an inferior.
- If it is needed again after the inferior dies, it must
- be reopened. */
-
-void
-close_exec_file ()
-{
- if (execchan >= 0)
- close (execchan);
- execchan = -1;
-}
-
-void
-reopen_exec_file ()
-{
- if (execchan < 0 && execfile != 0)
- {
- char *filename = concat (execfile, "", "");
- exec_file_command (filename, 0);
- free (filename);
- }
-}
-
-/* If we have both a core file and an exec file,
- print a warning if they don't go together.
- This should really check that the core file came
- from that exec file, but I don't know how to do it. */
-
-void
-validate_files ()
-{
- if (execfile != 0 && corefile != 0)
- {
- struct stat st_core;
-
- if (fstat (corechan, &st_core) < 0)
- /* It might be a good idea to print an error message.
- On the other hand, if the user tries to *do* anything with
- the core file, (s)he'll find out soon enough. */
- return;
-
- if (N_MAGIC (core_aouthdr) != 0
- && bcmp (&core_aouthdr, &exec_aouthdr, sizeof core_aouthdr))
- printf ("Warning: core file does not match specified executable file.\n");
- else if (exec_mtime > st_core.st_mtime) {
-#ifdef KERNELDEBUG
- extern int kernel_debugging;
- if (!kernel_debugging)
-#endif
- printf ("Warning: exec file is newer than core file.\n");
- }
- }
-}
-
-/* Return the name of the executable file as a string.
- ERR nonzero means get error if there is none specified;
- otherwise return 0 in that case. */
-
-char *
-get_exec_file (err)
- int err;
-{
- if (err && execfile == 0)
- error ("No executable file specified.\n\
-Use the \"exec-file\" and \"symbol-file\" commands.");
- return execfile;
-}
-
-int
-have_core_file_p ()
-{
- return corefile != 0;
-}
-
-static void
-files_info ()
-{
- char *symfile;
- extern char *get_sym_file ();
-
- if (execfile)
- printf ("Executable file \"%s\".\n", execfile);
- else
- printf ("No executable file\n");
- if (corefile == 0)
- printf ("No core dump file\n");
- else
- printf ("Core dump file \"%s\".\n", corefile);
-
- if (have_inferior_p ())
- printf ("Using the running image of the program, rather than these files.\n");
-
- symfile = get_sym_file ();
- if (symfile != 0)
- printf ("Symbols from \"%s\".\n", symfile);
-
-#ifdef FILES_INFO_HOOK
- if (FILES_INFO_HOOK ())
- return;
-#endif
-
- if (! have_inferior_p ())
- {
- if (execfile)
- {
- printf ("Text segment in executable from 0x%x to 0x%x.\n",
- text_start, text_end);
- printf ("Data segment in executable from 0x%x to 0x%x.\n",
- exec_data_start, exec_data_end);
- if (corefile)
- printf ("(But since we have a core file, we're using...)\n");
- }
- if (corefile)
- {
- printf ("Data segment in core file from 0x%x to 0x%x.\n",
- data_start, data_end);
- printf ("Stack segment in core file from 0x%x to 0x%x.\n",
- stack_start, stack_end);
- }
- }
-}
-
-/* Read "memory data" from core file and/or executable file.
- Returns zero if successful, 1 if xfer_core_file failed, errno value if
- ptrace failed. */
-
-int
-read_memory (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
-{
- if (len == 0)
- return 0;
-
- if (have_inferior_p ())
- {
- if (remote_debugging)
- return remote_read_inferior_memory (memaddr, myaddr, len);
- else
- return read_inferior_memory (memaddr, myaddr, len);
- }
- else
- return xfer_core_file (memaddr, myaddr, len);
-}
-
-/* Write LEN bytes of data starting at address MYADDR
- into debugged program memory at address MEMADDR.
- Returns zero if successful, or an errno value if ptrace failed. */
-
-int
-write_memory (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
-{
- if (have_inferior_p ())
- {
- if (remote_debugging)
- return remote_write_inferior_memory (memaddr, myaddr, len);
- else
- return write_inferior_memory (memaddr, myaddr, len);
- }
- else
- error ("Can write memory only when program being debugged is running.");
-}
-
-#ifndef XFER_CORE_FILE
-int (*core_file_hook)(); /* hook to handle special core files like
- like /dev/mem and crash dumps */
-
-/* Read from the program's memory (except for inferior processes).
- This function is misnamed, since it only reads, never writes; and
- since it will use the core file and/or executable file as necessary.
-
- It should be extended to write as well as read, FIXME, for patching files.
-
- Return 0 if address could be read, 1 if not. */
-
-int
-xfer_core_file (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
-{
- register int i;
- register int val;
- int xferchan;
- char **xferfile;
- int fileptr;
- int returnval = 0;
-
- if (core_file_hook)
- return ((*core_file_hook)(memaddr, myaddr, len));
-
- while (len > 0)
- {
- xferfile = 0;
- xferchan = 0;
-
- /* Determine which file the next bunch of addresses reside in,
- and where in the file. Set the file's read/write pointer
- to point at the proper place for the desired address
- and set xferfile and xferchan for the correct file.
-
- If desired address is nonexistent, leave them zero.
-
- i is set to the number of bytes that can be handled
- along with the next address.
-
- We put the most likely tests first for efficiency. */
-
- /* Note that if there is no core file
- data_start and data_end are equal. */
- if (memaddr >= data_start && memaddr < data_end)
- {
- i = min (len, data_end - memaddr);
- fileptr = memaddr - data_start + data_offset;
- xferfile = &corefile;
- xferchan = corechan;
- }
- /* Note that if there is no core file
- stack_start and stack_end are equal. */
- else if (memaddr >= stack_start && memaddr < stack_end)
- {
- i = min (len, stack_end - memaddr);
- fileptr = memaddr - stack_start + stack_offset;
- xferfile = &corefile;
- xferchan = corechan;
- }
-#ifdef REG_STACK_SEGMENT
- /* Pyramids have an extra segment in the virtual address space
- for the (control) stack of register-window frames */
- else if (memaddr >= reg_stack_start && memaddr < reg_stack_end)
- {
- i = min (len, reg_stack_end - memaddr);
- fileptr = memaddr - reg_stack_start + reg_stack_offset;
- xferfile = &corefile;
- xferchan = corechan;
- }
-#endif /* REG_STACK_SEGMENT */
-
- else if (corechan < 0
- && memaddr >= exec_data_start && memaddr < exec_data_end)
- {
- i = min (len, exec_data_end - memaddr);
- fileptr = memaddr - exec_data_start + exec_data_offset;
- xferfile = &execfile;
- xferchan = execchan;
- }
- else if (memaddr >= text_start && memaddr < text_end)
- {
- i = min (len, text_end - memaddr);
- fileptr = memaddr - text_start + text_offset;
- xferfile = &execfile;
- xferchan = execchan;
- }
- else if (memaddr < text_start)
- {
- i = min (len, text_start - memaddr);
- }
- else if (memaddr >= text_end
- && memaddr < (corechan >= 0? data_start : exec_data_start))
- {
- i = min (len, data_start - memaddr);
- }
- else if (corechan >= 0
- && memaddr >= data_end && memaddr < stack_start)
- {
- i = min (len, stack_start - memaddr);
- }
- else if (corechan < 0 && memaddr >= exec_data_end)
- {
- /* Since there is nothing at higher addresses than data
- (without a core file or an inferior, there is no
- stack, set i to do the rest of the operation now. */
- i = len;
- }
-#ifdef REG_STACK_SEGMENT
- else if (memaddr >= reg_stack_end && reg_stack_end != 0)
- {
- i = min (len, reg_stack_start - memaddr);
- }
- else if (memaddr >= stack_end && memaddr < reg_stack_start)
-#else /* no REG_STACK_SEGMENT. */
- else if (memaddr >= stack_end && stack_end != 0)
-#endif /* no REG_STACK_SEGMENT. */
- {
- /* Since there is nothing at higher addresses than
- the stack, set i to do the rest of the operation now. */
- i = len;
- }
- else
- {
- /* Address did not classify into one of the known ranges.
- This shouldn't happen; we catch the endpoints. */
- fatal ("Internal: Bad case logic in xfer_core_file.");
- }
-
- /* Now we know which file to use.
- Set up its pointer and transfer the data. */
- if (xferfile)
- {
- if (*xferfile == 0)
- if (xferfile == &execfile)
- error ("No program file to examine.");
- else
- error ("No core dump file or running program to examine.");
- val = lseek (xferchan, fileptr, 0);
- if (val == -1)
- perror_with_name (*xferfile);
- val = myread (xferchan, myaddr, i);
- if (val < 0)
- perror_with_name (*xferfile);
- }
- /* If this address is for nonexistent memory,
- read zeros if reading, or do nothing if writing.
- Actually, we never right. */
- else
- {
- bzero (myaddr, i);
- returnval = 1;
- }
-
- memaddr += i;
- myaddr += i;
- len -= i;
- }
- return returnval;
-}
-#endif /* XFER_CORE_FILE */
-
-/* My replacement for the read system call.
- Used like `read' but keeps going if `read' returns too soon. */
-
-int
-myread (desc, addr, len)
- int desc;
- char *addr;
- int len;
-{
- register int val;
- int orglen = len;
-
- while (len > 0)
- {
- val = read (desc, addr, len);
- if (val < 0)
- return val;
- if (val == 0)
- return orglen - len;
- len -= val;
- addr += val;
- }
- return orglen;
-}
-
-#ifdef REGISTER_U_ADDR
-
-/* Return the address in the core dump or inferior of register REGNO.
- BLOCKEND is the address of the end of the user structure. */
-
-unsigned int
-register_addr (regno, blockend)
- int regno;
- int blockend;
-{
- int addr;
-
- if (regno < 0 || regno >= NUM_REGS)
- error ("Invalid register number %d.", regno);
-
- REGISTER_U_ADDR (addr, blockend, regno);
-
- return addr;
-}
-
-#endif /* REGISTER_U_ADDR */
-
-void
-_initialize_core()
-{
- corechan = -1;
- execchan = -1;
- corefile = 0;
- execfile = 0;
- exec_file_display_hook = 0;
-
- text_start = 0;
- text_end = 0;
- data_start = 0;
- data_end = 0;
- exec_data_start = 0;
- exec_data_end = 0;
- stack_start = STACK_END_ADDR;
- stack_end = STACK_END_ADDR;
-
- add_com ("core-file", class_files, core_file_command,
- "Use FILE as core dump for examining memory and registers.\n\
-No arg means have no core file.");
- add_com ("exec-file", class_files, exec_file_command,
- "Use FILE as program for getting contents of pure memory.\n\
-If FILE cannot be found as specified, your execution directory path\n\
-is searched for a command of that name.\n\
-No arg means have no executable file.");
- add_info ("files", files_info, "Names of files being debugged.");
-}
-
diff --git a/gnu/usr.bin/gdb/cplus-dem.c b/gnu/usr.bin/gdb/cplus-dem.c
deleted file mode 100644
index 8ea9c8b..0000000
--- a/gnu/usr.bin/gdb/cplus-dem.c
+++ /dev/null
@@ -1,996 +0,0 @@
-/* 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, int mode)
-
- If NAME is a mangled function name produced by GNU C++, 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.
-
- If MODE > 0, then ANSI qualifiers such as `const' and `void' are output.
- Otherwise they are not.
- If MODE >= 0, parameters are emitted; otherwise not.
-
- For example,
-
- cplus_demangle ("foo__1Ai", 0) => "A::foo(int)"
- cplus_demangle ("foo__1Ai", 1) => "A::foo(int)"
- cplus_demangle ("foo__1Ai", -1) => "A::foo"
-
- cplus_demangle ("foo__1Afe", 0) => "A::foo(float,...)"
- cplus_demangle ("foo__1Afe", 1) => "A::foo(float,...)"
- cplus_demangle ("foo__1Afe", -1) => "A::foo"
-
- 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
-
-#ifndef __STDC__
-#define const
-#endif
-
-#ifdef __STDC__
-extern char *cplus_demangle (const char *type, int mode);
-#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, int arg_mode);
-static int do_type (const char **type, string *result, int arg_mode);
-static int do_arg (const char **type, string *result, int arg_mode);
-static void munge_function_name (string *name, int arg_mode);
-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, arg_mode)
- const char *type;
- int arg_mode;
-{
- 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
-
-# define print_ansi_qualifiers (arg_mode > 0)
-# define print_arg_types (arg_mode >= 0)
-
- 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 "_vt$" */
- 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, arg_mode);
- }
- 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, arg_mode);
- if (const_flag && print_arg_types)
- string_append (&decl, " const");
- break;
- case 'F':
- p += 1;
- success = do_args (&p, &decl, arg_mode);
- 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, arg_mode)
- const char **type;
- string *result;
- int arg_mode;
-{
- 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, arg_mode) || **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, arg_mode)) || **type != '_')
- {
- success = 0;
- break;
- }
- *type += 1;
- if (! print_ansi_qualifiers)
- break;
- 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, "volatile");
- }
- break;
- }
-
- case 'C':
- if ((*type)[1] == 'P')
- {
- *type += 1;
- if (print_ansi_qualifiers)
- {
- 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 (print_ansi_qualifiers)
- {
- 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 (print_ansi_qualifiers)
- {
- 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, arg_mode)
- const char **type;
- string *result;
- int arg_mode;
-{
- const char *start = *type;
-
- if (!do_type (type, result, arg_mode))
- 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, arg_mode)
- const char **type;
- string *decl;
- int arg_mode;
-{
- string arg;
- int need_comma = 0;
-
- if (print_arg_types)
- 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 && print_arg_types)
- string_append (decl, ", ");
- if (!do_arg (&tem, &arg, arg_mode))
- return 0;
- if (print_arg_types)
- string_appends (decl, &arg);
- string_delete (&arg);
- need_comma = 1;
- }
- }
- else
- {
- if (need_comma & print_arg_types)
- string_append (decl, ", ");
- if (!do_arg (type, &arg, arg_mode))
- return 0;
- if (print_arg_types)
- string_appends (decl, &arg);
- string_delete (&arg);
- need_comma = 1;
- }
- }
-
- if (**type == 'v')
- *type += 1;
- else if (**type == 'e')
- {
- *type += 1;
- if (print_arg_types)
- {
- if (need_comma)
- string_append (decl, ",");
- string_append (decl, "...");
- }
- }
-
- if (print_arg_types)
- string_append (decl, ")");
- return 1;
-}
-
-static void
-munge_function_name (name, arg_mode)
- string *name;
- int arg_mode;
-{
- 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, arg_mode))
- {
- 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/gnu/usr.bin/gdb/dbxread.c b/gnu/usr.bin/gdb/dbxread.c
deleted file mode 100644
index 7a25665..0000000
--- a/gnu/usr.bin/gdb/dbxread.c
+++ /dev/null
@@ -1,5727 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)dbxread.c 6.3 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* Read dbx symbol tables and convert to internal format, for GDB.
- Copyright (C) 1986, 1987, 1988, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Symbol read-in occurs in two phases:
- 1. A scan (read_dbx_symtab()) of the entire executable, whose sole
- purpose is to make a list of symbols (partial symbol table)
- which will cause symbols
- to be read in if referenced. This scan happens when the
- "symbol-file" command is given (symbol_file_command()).
- 2. Full read-in of symbols. (psymtab_to_symtab()). This happens
- when a symbol in a file for which symbols have not yet been
- read in is referenced.
- 2a. The "add-file" command. Similar to #2. */
-
-#include <stdio.h>
-#include "defs.h"
-#include "param.h"
-
-#ifdef READ_DBX_FORMAT
-
-#ifdef USG
-#include <sys/types.h>
-#include <fcntl.h>
-#define L_SET 0
-#define L_INCR 1
-#endif
-
-#ifdef COFF_ENCAPSULATE
-#include "a.out.encap.h"
-#include "stab.gnu.h"
-#else
-#include <a.out.h>
-#include <stab.h>
-#endif
-#include <ctype.h>
-
-#ifndef NO_GNU_STABS
-/*
- * Define specifically gnu symbols here.
- */
-
-/* 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. */
-#ifndef N_INDR
-#define N_INDR 0xa
-#endif
-
-/* The following symbols refer to set elements.
- All the N_SET[ATDB] symbols with the same name form one set.
- Space is allocated for the set in the text section, and each set
- element's value is stored into one word of the space.
- The first word of the space is the length of the set (number of elements).
-
- 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. */
-
-#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. */
-
-#ifndef N_WARNING
-#define N_WARNING 0x1E /* Warning message to print if file 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__ */
-#endif /* NO_GNU_STABS */
-
-#include <obstack.h>
-#include <sys/param.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-
-#include "symtab.h"
-
-#ifndef COFF_FORMAT
-#ifndef AOUTHDR
-#define AOUTHDR struct exec
-#endif
-#endif
-
-static void add_symbol_to_list ();
-static void read_dbx_symtab ();
-static void process_one_symbol ();
-static void free_all_psymbols ();
-static struct type *read_type ();
-static struct type *read_range_type ();
-static struct type *read_enum_type ();
-static struct type *read_struct_type ();
-static struct type *read_array_type ();
-static long read_number ();
-static void read_huge_number ();
-static void finish_block ();
-static struct blockvector *make_blockvector ();
-static struct symbol *define_symbol ();
-static void start_subfile ();
-static int hashname ();
-static void hash_symsegs ();
-static struct pending *copy_pending ();
-static void fix_common_block ();
-
-static void add_undefined_type ();
-static void cleanup_undefined_types ();
-
-extern char *index();
-
-extern struct symtab *read_symsegs ();
-extern void free_all_symtabs ();
-extern void free_all_psymtabs ();
-extern void free_inclink_symtabs ();
-
-/* C++ */
-static struct type **read_args ();
-
-/* Macro to determine which symbols to ignore when reading the first symbol
- of a file. Some machines override this definition. */
-#ifdef N_NSYMS
-#ifndef IGNORE_SYMBOL
-/* This code is used on Ultrix systems. Ignore it */
-#define IGNORE_SYMBOL(type) (type == N_NSYMS)
-#endif
-#else
-#ifndef IGNORE_SYMBOL
-/* Don't ignore any symbols. */
-#define IGNORE_SYMBOL(type) (0)
-#endif
-#endif /* not N_NSYMS */
-
-/* Macro for number of symbol table entries (in usual a.out format).
- Some machines override this definition. */
-#ifndef NUMBER_OF_SYMBOLS
-#ifdef COFF_HEADER
-#define NUMBER_OF_SYMBOLS \
- ((COFF_HEADER(hdr) ? hdr.coffhdr.filehdr.f_nsyms : hdr.a_syms) / \
- sizeof (struct nlist))
-#else
-#define NUMBER_OF_SYMBOLS (hdr.a_syms / sizeof (struct nlist))
-#endif
-#endif
-
-/* Macro for file-offset of symbol table (in usual a.out format). */
-#ifndef SYMBOL_TABLE_OFFSET
-#define SYMBOL_TABLE_OFFSET N_SYMOFF (hdr)
-#endif
-
-/* Macro for file-offset of string table (in usual a.out format). */
-#ifndef STRING_TABLE_OFFSET
-#define STRING_TABLE_OFFSET (N_SYMOFF (hdr) + hdr.a_syms)
-#endif
-
-/* Macro to store the length of the string table data in INTO. */
-#ifndef READ_STRING_TABLE_SIZE
-#define READ_STRING_TABLE_SIZE(INTO) \
-{ val = myread (desc, &INTO, sizeof INTO); \
- if (val < 0) perror_with_name (name); }
-#endif
-
-/* Macro to declare variables to hold the file's header data. */
-#ifndef DECLARE_FILE_HEADERS
-#define DECLARE_FILE_HEADERS AOUTHDR hdr
-#endif
-
-/* Macro to read the header data from descriptor DESC and validate it.
- NAME is the file name, for error messages. */
-#ifndef READ_FILE_HEADERS
-#ifdef HEADER_SEEK_FD
-#define READ_FILE_HEADERS(DESC, NAME) \
-{ HEADER_SEEK_FD (DESC); \
- val = myread (DESC, &hdr, sizeof hdr); \
- if (val < 0) perror_with_name (NAME); \
- if (N_BADMAG (hdr)) \
- error ("File \"%s\" not in executable format.", NAME); }
-#else
-#define READ_FILE_HEADERS(DESC, NAME) \
-{ val = myread (DESC, &hdr, sizeof hdr); \
- if (val < 0) perror_with_name (NAME); \
- if (N_BADMAG (hdr)) \
- error ("File \"%s\" not in executable format.", NAME); }
-#endif
-#endif
-
-/* Non-zero if this is an object (.o) file, rather than an executable.
- Distinguishing between the two is rarely necessary (and seems like
- a hack, but there is no other way to do ADDR_OF_TEXT_SEGMENT
- right for SunOS). */
-#if !defined (IS_OBJECT_FILE)
-/* This will not work
- if someone decides to make ld preserve relocation info. */
-#define IS_OBJECT_FILE (hdr.a_trsize != 0)
-#endif
-
-/* Macro for size of text segment */
-#ifndef SIZE_OF_TEXT_SEGMENT
-#define SIZE_OF_TEXT_SEGMENT hdr.a_text
-#endif
-
-/* Get the address in debugged memory of the start
- of the text segment. */
-#if !defined (ADDR_OF_TEXT_SEGMENT)
-#if defined (N_TXTADDR)
-#define ADDR_OF_TEXT_SEGMENT (IS_OBJECT_FILE ? 0 : N_TXTADDR (hdr))
-#else /* no N_TXTADDR */
-#define ADDR_OF_TEXT_SEGMENT 0
-#endif /* no N_TXTADDR */
-#endif /* no ADDR_OF_TEXT_SEGMENT */
-
-/* Macro to get entry point from headers. */
-#ifndef ENTRY_POINT
-#define ENTRY_POINT hdr.a_entry
-#endif
-
-/* Macro for name of symbol to indicate a file compiled with gcc. */
-#ifndef GCC_COMPILED_FLAG_SYMBOL
-#define GCC_COMPILED_FLAG_SYMBOL "gcc_compiled."
-#endif
-
-/* Convert stab register number (from `r' declaration) to a gdb REGNUM. */
-
-#ifndef STAB_REG_TO_REGNUM
-#define STAB_REG_TO_REGNUM(VALUE) (VALUE)
-#endif
-
-/* Define this as 1 if a pcc declaration of a char or short argument
- gives the correct address. Otherwise assume pcc gives the
- address of the corresponding int, which is not the same on a
- big-endian machine. */
-
-#ifndef BELIEVE_PCC_PROMOTION
-#define BELIEVE_PCC_PROMOTION 0
-#endif
-
-/* Nonzero means give verbose info on gdb action. From main.c. */
-extern int info_verbose;
-
-/* Chain of symtabs made from reading the file's symsegs.
- These symtabs do not go into symtab_list themselves,
- but the information is copied from them when appropriate
- to make the symtabs that will exist permanently. */
-
-static struct symtab *symseg_chain;
-
-/* Symseg symbol table for the file whose data we are now processing.
- It is one of those in symseg_chain. Or 0, for a compilation that
- has no symseg. */
-
-static struct symtab *current_symseg;
-
-/* Name of source file whose symbol data we are now processing.
- This comes from a symbol of type N_SO. */
-
-static char *last_source_file;
-
-/* Core address of start of text of current source file.
- This too comes from the N_SO symbol. */
-
-static CORE_ADDR last_source_start_addr;
-
-/* End of the text segment of the executable file,
- as found in the symbol _etext. */
-
-static CORE_ADDR end_of_text_addr;
-
-/* The list of sub-source-files within the current individual compilation.
- Each file gets its own symtab with its own linetable and associated info,
- but they all share one blockvector. */
-
-struct subfile
-{
- struct subfile *next;
- char *name;
- struct linetable *line_vector;
- int line_vector_length;
- int line_vector_index;
- int prev_line_number;
-};
-
-static struct subfile *subfiles;
-
-static struct subfile *current_subfile;
-
-/* Count symbols as they are processed, for error messages. */
-
-static int symnum;
-
-/* Vector of types defined so far, indexed by their dbx type numbers.
- (In newer sun systems, dbx uses a pair of numbers in parens,
- as in "(SUBFILENUM,NUMWITHINSUBFILE)". Then these numbers must be
- translated through the type_translations hash table to get
- the index into the type vector.) */
-
-static struct typevector *type_vector;
-
-/* Number of elements allocated for type_vector currently. */
-
-static int type_vector_length;
-
-/* Vector of line number information. */
-
-static struct linetable *line_vector;
-
-/* Index of next entry to go in line_vector_index. */
-
-static int line_vector_index;
-
-/* Last line number recorded in the line vector. */
-
-static int prev_line_number;
-
-/* Number of elements allocated for line_vector currently. */
-
-static int line_vector_length;
-
-/* Hash table of global symbols whose values are not known yet.
- They are chained thru the SYMBOL_VALUE, since we don't
- have the correct data for that slot yet. */
-/* The use of the LOC_BLOCK code in this chain is nonstandard--
- it refers to a FORTRAN common block rather than the usual meaning. */
-
-#define HASHSIZE 127
-static struct symbol *global_sym_chain[HASHSIZE];
-
-/* Record the symbols defined for each context in a list.
- We don't create a struct block for the context until we
- know how long to make it. */
-
-#define PENDINGSIZE 100
-
-struct pending
-{
- struct pending *next;
- int nsyms;
- struct symbol *symbol[PENDINGSIZE];
-};
-
-/* List of free `struct pending' structures for reuse. */
-struct pending *free_pendings;
-
-/* Here are the three lists that symbols are put on. */
-
-struct pending *file_symbols; /* static at top level, and types */
-
-struct pending *global_symbols; /* global functions and variables */
-
-struct pending *local_symbols; /* everything local to lexical context */
-
-/* List of symbols declared since the last BCOMM. This list is a tail
- of local_symbols. When ECOMM is seen, the symbols on the list
- are noted so their proper addresses can be filled in later,
- using the common block base address gotten from the assembler
- stabs. */
-
-struct pending *common_block;
-int common_block_i;
-
-/* Stack representing unclosed lexical contexts
- (that will become blocks, eventually). */
-
-struct context_stack
-{
- struct pending *locals;
- struct pending_block *old_blocks;
- struct symbol *name;
- CORE_ADDR start_addr;
- int depth;
-};
-
-struct context_stack *context_stack;
-
-/* Index of first unused entry in context stack. */
-int context_stack_depth;
-
-/* Currently allocated size of context stack. */
-
-int context_stack_size;
-
-/* Nonzero if within a function (so symbols should be local,
- if nothing says specifically). */
-
-int within_function;
-
-/* List of blocks already made (lexical contexts already closed).
- This is used at the end to make the blockvector. */
-
-struct pending_block
-{
- struct pending_block *next;
- struct block *block;
-};
-
-struct pending_block *pending_blocks;
-
-extern CORE_ADDR startup_file_start; /* From blockframe.c */
-extern CORE_ADDR startup_file_end; /* From blockframe.c */
-
-/* File name symbols were loaded from. */
-
-static char *symfile;
-
-/* Low and high symbol values (inclusive) for the global variable
- entries in the symbol file. */
-
-static int first_global_sym, last_global_sym;
-
-/* Structures with which to manage partial symbol allocation. */
-
-struct psymbol_allocation_list global_psymbols, static_psymbols;
-
-/* Global variable which, when set, indicates that we are processing a
- .o file compiled with gcc */
-
-static unsigned char processing_gcc_compilation;
-
-/* Make a list of forward references which haven't been defined. */
-static struct type **undef_types;
-static int undef_types_allocated, undef_types_length;
-
- /* Setup a define to deal cleanly with the underscore problem */
-
-#ifdef NAMES_HAVE_UNDERSCORE
-#define HASH_OFFSET 1
-#else
-#define HASH_OFFSET 0
-#endif
-
-#if 0
-/* I'm not sure why this is here. To debug bugs which cause
- an infinite loop of allocations, I suppose. In any event,
- dumping core when out of memory isn't usually right. */
-static int
-xxmalloc (n)
-{
- int v = malloc (n);
- if (v == 0)
- {
- fprintf (stderr, "Virtual memory exhausted.\n");
- abort ();
- }
- return v;
-}
-#else /* not 0 */
-#define xxmalloc xmalloc
-#endif /* not 0 */
-
-/* Make a copy of the string at PTR with SIZE characters in the symbol obstack
- (and add a null character at the end in the copy).
- Returns the address of the copy. */
-
-static char *
-obsavestring (ptr, size)
- char *ptr;
- int size;
-{
- register char *p = (char *) obstack_alloc (symbol_obstack, size + 1);
- /* Open-coded bcopy--saves function call time.
- These strings are usually short. */
- {
- register char *p1 = ptr;
- register char *p2 = p;
- char *end = ptr + size;
- while (p1 != end)
- *p2++ = *p1++;
- }
- p[size] = 0;
- return p;
-}
-
-/* Concatenate strings S1, S2 and S3; return the new string.
- Space is found in the symbol_obstack. */
-
-static char *
-obconcat (s1, s2, s3)
- char *s1, *s2, *s3;
-{
- register int len = strlen (s1) + strlen (s2) + strlen (s3) + 1;
- register char *val = (char *) obstack_alloc (symbol_obstack, len);
- strcpy (val, s1);
- strcat (val, s2);
- strcat (val, s3);
- return val;
-}
-
-/* Support for Sun changes to dbx symbol format */
-
-/* For each identified header file, we have a table of types defined
- in that header file.
-
- header_files maps header file names to their type tables.
- It is a vector of n_header_files elements.
- Each element describes one header file.
- It contains a vector of types.
-
- Sometimes it can happen that the same header file produces
- different results when included in different places.
- This can result from conditionals or from different
- things done before including the file.
- When this happens, there are multiple entries for the file in this table,
- one entry for each distinct set of results.
- The entries are distinguished by the INSTANCE field.
- The INSTANCE field appears in the N_BINCL and N_EXCL symbol table and is
- used to match header-file references to their corresponding data. */
-
-struct header_file
-{
- char *name; /* Name of header file */
- int instance; /* Numeric code distinguishing instances
- of one header file that produced
- different results when included.
- It comes from the N_BINCL or N_EXCL. */
- struct type **vector; /* Pointer to vector of types */
- int length; /* Allocated length (# elts) of that vector */
-};
-
-static struct header_file *header_files;
-
-static int n_header_files;
-
-static int n_allocated_header_files;
-
-/* During initial symbol readin, we need to have a structure to keep
- track of which psymtabs have which bincls in them. This structure
- is used during readin to setup the list of dependencies within each
- partial symbol table. */
-
-struct header_file_location
-{
- char *name; /* Name of header file */
- int instance; /* See above */
- struct partial_symtab *pst; /* Partial symtab that has the
- BINCL/EINCL defs for this file */
-};
-
-/* The actual list and controling variables */
-static struct header_file_location *bincl_list, *next_bincl;
-static int bincls_allocated;
-
-/* Within each object file, various header files are assigned numbers.
- A type is defined or referred to with a pair of numbers
- (FILENUM,TYPENUM) where FILENUM is the number of the header file
- and TYPENUM is the number within that header file.
- TYPENUM is the index within the vector of types for that header file.
-
- FILENUM == 1 is special; it refers to the main source of the object file,
- and not to any header file. FILENUM != 1 is interpreted by looking it up
- in the following table, which contains indices in header_files. */
-
-static int *this_object_header_files;
-
-static int n_this_object_header_files;
-
-static int n_allocated_this_object_header_files;
-
-/* When a header file is getting special overriding definitions
- for one source file, record here the header_files index
- of its normal definition vector.
- At other times, this is -1. */
-
-static int header_file_prev_index;
-
-/* At the start of reading dbx symbols, allocate our tables. */
-
-static void
-init_header_files ()
-{
- n_allocated_header_files = 10;
- header_files = (struct header_file *) xxmalloc (10 * sizeof (struct header_file));
- n_header_files = 0;
-
- n_allocated_this_object_header_files = 10;
- this_object_header_files = (int *) xxmalloc (10 * sizeof (int));
-}
-
-/* At the end of reading dbx symbols, free our tables. */
-
-static void
-free_header_files ()
-{
- register int i;
- for (i = 0; i < n_header_files; i++)
- free (header_files[i].name);
- if (header_files) free (header_files);
- if (this_object_header_files)
- free (this_object_header_files);
-}
-
-/* Called at the start of each object file's symbols.
- Clear out the mapping of header file numbers to header files. */
-
-static void
-new_object_header_files ()
-{
- /* Leave FILENUM of 0 free for builtin types and this file's types. */
- n_this_object_header_files = 1;
- header_file_prev_index = -1;
-}
-
-/* Add header file number I for this object file
- at the next successive FILENUM. */
-
-static void
-add_this_object_header_file (i)
- int i;
-{
- if (n_this_object_header_files == n_allocated_this_object_header_files)
- {
- n_allocated_this_object_header_files *= 2;
- this_object_header_files
- = (int *) xrealloc (this_object_header_files,
- n_allocated_this_object_header_files * sizeof (int));
- }
-
- this_object_header_files[n_this_object_header_files++] = i;
-}
-
-/* Add to this file an "old" header file, one already seen in
- a previous object file. NAME is the header file's name.
- INSTANCE is its instance code, to select among multiple
- symbol tables for the same header file. */
-
-static void
-add_old_header_file (name, instance)
- char *name;
- int instance;
-{
- register struct header_file *p = header_files;
- register int i;
-
- for (i = 0; i < n_header_files; i++)
- if (!strcmp (p[i].name, name) && instance == p[i].instance)
- {
- add_this_object_header_file (i);
- return;
- }
- error ("Invalid symbol data: \"repeated\" header file that hasn't been seen before, at symtab pos %d.",
- symnum);
-}
-
-/* Add to this file a "new" header file: definitions for its types follow.
- NAME is the header file's name.
- Most often this happens only once for each distinct header file,
- but not necessarily. If it happens more than once, INSTANCE has
- a different value each time, and references to the header file
- use INSTANCE values to select among them.
-
- dbx output contains "begin" and "end" markers for each new header file,
- but at this level we just need to know which files there have been;
- so we record the file when its "begin" is seen and ignore the "end". */
-
-static void
-add_new_header_file (name, instance)
- char *name;
- int instance;
-{
- register int i;
- register struct header_file *p = header_files;
- header_file_prev_index = -1;
-
-#if 0
- /* This code was used before I knew about the instance codes.
- My first hypothesis is that it is not necessary now
- that instance codes are handled. */
-
- /* Has this header file a previous definition?
- If so, make a new entry anyway so that this use in this source file
- gets a separate entry. Later source files get the old entry.
- Record here the index of the old entry, so that any type indices
- not previously defined can get defined in the old entry as
- well as in the new one. */
-
- for (i = 0; i < n_header_files; i++)
- if (!strcmp (p[i].name, name))
- {
- header_file_prev_index = i;
- }
-
-#endif
-
- /* Make sure there is room for one more header file. */
-
- if (n_header_files == n_allocated_header_files)
- {
- n_allocated_header_files *= 2;
- header_files = (struct header_file *)
- xrealloc (header_files,
- (n_allocated_header_files
- * sizeof (struct header_file)));
- }
-
- /* Create an entry for this header file. */
-
- i = n_header_files++;
- header_files[i].name = savestring (name, strlen(name));
- header_files[i].instance = instance;
- header_files[i].length = 10;
- header_files[i].vector
- = (struct type **) xxmalloc (10 * sizeof (struct type *));
- bzero (header_files[i].vector, 10 * sizeof (struct type *));
-
- add_this_object_header_file (i);
-}
-
-/* Look up a dbx type-number pair. Return the address of the slot
- where the type for that number-pair is stored.
- The number-pair is in TYPENUMS.
-
- This can be used for finding the type associated with that pair
- or for associating a new type with the pair. */
-
-static struct type **
-dbx_lookup_type (typenums)
- int typenums[2];
-{
- register int filenum = typenums[0], index = typenums[1];
-
- if (filenum < 0 || filenum >= n_this_object_header_files)
- error ("Invalid symbol data: type number (%d,%d) out of range at symtab pos %d.",
- filenum, index, symnum);
-
- if (filenum == 0)
- {
- /* Type is defined outside of header files.
- Find it in this object file's type vector. */
- if (index >= type_vector_length)
- {
- type_vector_length *= 2;
- type_vector = (struct typevector *)
- xrealloc (type_vector,
- (sizeof (struct typevector)
- + type_vector_length * sizeof (struct type *)));
- bzero (&type_vector->type[type_vector_length / 2],
- type_vector_length * sizeof (struct type *) / 2);
- }
- return &type_vector->type[index];
- }
- else
- {
- register int real_filenum = this_object_header_files[filenum];
- register struct header_file *f;
-
- if (real_filenum >= n_header_files)
- abort ();
-
- f = &header_files[real_filenum];
-
- if (index >= f->length)
- {
- f->length *= 2;
- f->vector = (struct type **)
- xrealloc (f->vector, f->length * sizeof (struct type *));
- bzero (&f->vector[f->length / 2],
- f->length * sizeof (struct type *) / 2);
- }
- return &f->vector[index];
- }
-}
-
-/* Create a type object. Occaisionally used when you need a type
- which isn't going to be given a type number. */
-
-static struct type *
-dbx_create_type ()
-{
- register struct type *type =
- (struct type *) obstack_alloc (symbol_obstack, sizeof (struct type));
-
- bzero (type, sizeof (struct type));
- TYPE_VPTR_FIELDNO (type) = -1;
- return type;
-}
-
-/* Make sure there is a type allocated for type numbers TYPENUMS
- and return the type object.
- This can create an empty (zeroed) type object.
- TYPENUMS may be (-1, -1) to return a new type object that is not
- put into the type vector, and so may not be referred to by number. */
-
-static struct type *
-dbx_alloc_type (typenums)
- int typenums[2];
-{
- register struct type **type_addr;
- register struct type *type;
-
- if (typenums[1] != -1)
- {
- type_addr = dbx_lookup_type (typenums);
- type = *type_addr;
- }
- else
- {
- type_addr = 0;
- type = 0;
- }
-
- /* If we are referring to a type not known at all yet,
- allocate an empty type for it.
- We will fill it in later if we find out how. */
- if (type == 0)
- {
- type = dbx_create_type ();
- if (type_addr)
- *type_addr = type;
- }
-
- return type;
-}
-
-#if 0
-static struct type **
-explicit_lookup_type (real_filenum, index)
- int real_filenum, index;
-{
- register struct header_file *f = &header_files[real_filenum];
-
- if (index >= f->length)
- {
- f->length *= 2;
- f->vector = (struct type **)
- xrealloc (f->vector, f->length * sizeof (struct type *));
- bzero (&f->vector[f->length / 2],
- f->length * sizeof (struct type *) / 2);
- }
- return &f->vector[index];
-}
-#endif
-
-/* maintain the lists of symbols and blocks */
-
-/* Add a symbol to one of the lists of symbols. */
-static void
-add_symbol_to_list (symbol, listhead)
- struct symbol *symbol;
- struct pending **listhead;
-{
- /* We keep PENDINGSIZE symbols in each link of the list.
- If we don't have a link with room in it, add a new link. */
- if (*listhead == 0 || (*listhead)->nsyms == PENDINGSIZE)
- {
- register struct pending *link;
- if (free_pendings)
- {
- link = free_pendings;
- free_pendings = link->next;
- }
- else
- link = (struct pending *) xxmalloc (sizeof (struct pending));
-
- link->next = *listhead;
- *listhead = link;
- link->nsyms = 0;
- }
-
- (*listhead)->symbol[(*listhead)->nsyms++] = symbol;
-}
-
-/* At end of reading syms, or in case of quit,
- really free as many `struct pending's as we can easily find. */
-
-static void
-really_free_pendings ()
-{
- struct pending *next, *next1;
- struct pending_block *bnext, *bnext1;
-
- for (next = free_pendings; next; next = next1)
- {
- next1 = next->next;
- free (next);
- }
- free_pendings = 0;
-
- for (bnext = pending_blocks; bnext; bnext = bnext1)
- {
- bnext1 = bnext->next;
- free (bnext);
- }
- pending_blocks = 0;
-
- for (next = file_symbols; next; next = next1)
- {
- next1 = next->next;
- free (next);
- }
- for (next = global_symbols; next; next = next1)
- {
- next1 = next->next;
- free (next);
- }
-}
-
-/* Take one of the lists of symbols and make a block from it.
- Keep the order the symbols have in the list (reversed from the input file).
- Put the block on the list of pending blocks. */
-
-static void
-finish_block (symbol, listhead, old_blocks, start, end)
- struct symbol *symbol;
- struct pending **listhead;
- struct pending_block *old_blocks;
- CORE_ADDR start, end;
-{
- register struct pending *next, *next1;
- register struct block *block;
- register struct pending_block *pblock;
- struct pending_block *opblock;
- register int i;
-
- /* Count the length of the list of symbols. */
-
- for (next = *listhead, i = 0; next; i += next->nsyms, next = next->next);
-
- block = (struct block *) obstack_alloc (symbol_obstack,
- (sizeof (struct block)
- + ((i - 1)
- * sizeof (struct symbol *))));
-
- /* Copy the symbols into the block. */
-
- BLOCK_NSYMS (block) = i;
- for (next = *listhead; next; next = next->next)
- {
- register int j;
- for (j = next->nsyms - 1; j >= 0; j--)
- BLOCK_SYM (block, --i) = next->symbol[j];
- }
-
- BLOCK_START (block) = start;
- BLOCK_END (block) = end;
- BLOCK_SUPERBLOCK (block) = 0; /* Filled in when containing block is made */
- BLOCK_GCC_COMPILED (block) = processing_gcc_compilation;
-
- /* Put the block in as the value of the symbol that names it. */
-
- if (symbol)
- {
- SYMBOL_BLOCK_VALUE (symbol) = block;
- BLOCK_FUNCTION (block) = symbol;
- }
- else
- BLOCK_FUNCTION (block) = 0;
-
- /* Now "free" the links of the list, and empty the list. */
-
- for (next = *listhead; next; next = next1)
- {
- next1 = next->next;
- next->next = free_pendings;
- free_pendings = next;
- }
- *listhead = 0;
-
- /* Install this block as the superblock
- of all blocks made since the start of this scope
- that don't have superblocks yet. */
-
- opblock = 0;
- for (pblock = pending_blocks; pblock != old_blocks; pblock = pblock->next)
- {
- if (BLOCK_SUPERBLOCK (pblock->block) == 0)
- BLOCK_SUPERBLOCK (pblock->block) = block;
- opblock = pblock;
- }
-
- /* Record this block on the list of all blocks in the file.
- Put it after opblock, or at the beginning if opblock is 0.
- This puts the block in the list after all its subblocks. */
-
- /* Allocate in the symbol_obstack to save time.
- It wastes a little space. */
- pblock = (struct pending_block *)
- obstack_alloc (symbol_obstack,
- sizeof (struct pending_block));
- pblock->block = block;
- if (opblock)
- {
- pblock->next = opblock->next;
- opblock->next = pblock;
- }
- else
- {
- pblock->next = pending_blocks;
- pending_blocks = pblock;
- }
-}
-
-static struct blockvector *
-make_blockvector ()
-{
- register struct pending_block *next, *next1;
- register struct blockvector *blockvector;
- register int i;
-
- /* Count the length of the list of blocks. */
-
- for (next = pending_blocks, i = 0; next; next = next->next, i++);
-
- blockvector = (struct blockvector *)
- obstack_alloc (symbol_obstack,
- (sizeof (struct blockvector)
- + (i - 1) * sizeof (struct block *)));
-
- /* Copy the blocks into the blockvector.
- This is done in reverse order, which happens to put
- the blocks into the proper order (ascending starting address).
- finish_block has hair to insert each block into the list
- after its subblocks in order to make sure this is true. */
-
- BLOCKVECTOR_NBLOCKS (blockvector) = i;
- for (next = pending_blocks; next; next = next->next)
- BLOCKVECTOR_BLOCK (blockvector, --i) = next->block;
-
-#if 0 /* Now we make the links in the obstack, so don't free them. */
- /* Now free the links of the list, and empty the list. */
-
- for (next = pending_blocks; next; next = next1)
- {
- next1 = next->next;
- free (next);
- }
-#endif
- pending_blocks = 0;
-
- return blockvector;
-}
-
-/* Manage the vector of line numbers. */
-
-static void
-record_line (line, pc)
- int line;
- CORE_ADDR pc;
-{
- struct linetable_entry *e;
- /* Ignore the dummy line number in libg.o */
-
- if (line == 0xffff)
- return;
-
- /* Make sure line vector is big enough. */
-
- if (line_vector_index + 1 >= line_vector_length)
- {
- line_vector_length *= 2;
- line_vector = (struct linetable *)
- xrealloc (line_vector,
- (sizeof (struct linetable)
- + line_vector_length * sizeof (struct linetable_entry)));
- current_subfile->line_vector = line_vector;
- }
-
- e = line_vector->item + line_vector_index++;
- e->line = line; e->pc = pc;
-}
-
-/* Start a new symtab for a new source file.
- This is called when a dbx symbol of type N_SO is seen;
- it indicates the start of data for one original source file. */
-
-static void
-start_symtab (name, start_addr)
- char *name;
- CORE_ADDR start_addr;
-{
- register struct symtab *s;
-
- last_source_file = name;
- last_source_start_addr = start_addr;
- file_symbols = 0;
- global_symbols = 0;
- within_function = 0;
-
- /* Context stack is initially empty, with room for 10 levels. */
- context_stack
- = (struct context_stack *) xxmalloc (10 * sizeof (struct context_stack));
- context_stack_size = 10;
- context_stack_depth = 0;
-
- new_object_header_files ();
-
- for (s = symseg_chain; s; s = s->next)
- if (s->ldsymoff == symnum * sizeof (struct nlist))
- break;
- current_symseg = s;
- if (s != 0)
- return;
-
- type_vector_length = 160;
- type_vector = (struct typevector *)
- xxmalloc (sizeof (struct typevector)
- + type_vector_length * sizeof (struct type *));
- bzero (type_vector->type, type_vector_length * sizeof (struct type *));
-
- /* Initialize the list of sub source files with one entry
- for this file (the top-level source file). */
-
- subfiles = 0;
- current_subfile = 0;
- start_subfile (name);
-
-#if 0 /* This is now set at the beginning of read_ofile_symtab */
- /* Set default for compiler to pcc; assume that we aren't processing
- a gcc compiled file until proved otherwise. */
-
- processing_gcc_compilation = 0;
-#endif
-}
-
-/* Handle an N_SOL symbol, which indicates the start of
- code that came from an included (or otherwise merged-in)
- source file with a different name. */
-
-static void
-start_subfile (name)
- char *name;
-{
- register struct subfile *subfile;
-
- /* Save the current subfile's line vector data. */
-
- if (current_subfile)
- {
- current_subfile->line_vector_index = line_vector_index;
- current_subfile->line_vector_length = line_vector_length;
- current_subfile->prev_line_number = prev_line_number;
- }
-
- /* See if this subfile is already known as a subfile of the
- current main source file. */
-
- for (subfile = subfiles; subfile; subfile = subfile->next)
- {
- if (!strcmp (subfile->name, name))
- {
- line_vector = subfile->line_vector;
- line_vector_index = subfile->line_vector_index;
- line_vector_length = subfile->line_vector_length;
- prev_line_number = subfile->prev_line_number;
- current_subfile = subfile;
- return;
- }
- }
-
- /* This subfile is not known. Add an entry for it. */
-
- line_vector_index = 0;
- line_vector_length = 1000;
- prev_line_number = -2; /* Force first line number to be explicit */
- line_vector = (struct linetable *)
- xxmalloc (sizeof (struct linetable)
- + line_vector_length * sizeof (struct linetable_entry));
-
- /* Make an entry for this subfile in the list of all subfiles
- of the current main source file. */
-
- subfile = (struct subfile *) xxmalloc (sizeof (struct subfile));
- subfile->next = subfiles;
- subfile->name = savestring (name, strlen (name));
- subfile->line_vector = line_vector;
- subfiles = subfile;
- current_subfile = subfile;
-}
-
-/* Finish the symbol definitions for one main source file,
- close off all the lexical contexts for that file
- (creating struct block's for them), then make the struct symtab
- for that file and put it in the list of all such.
-
- END_ADDR is the address of the end of the file's text. */
-
-static void
-end_symtab (end_addr)
- CORE_ADDR end_addr;
-{
- register struct symtab *symtab;
- register struct blockvector *blockvector;
- register struct subfile *subfile;
- register struct linetable *lv;
- struct subfile *nextsub;
-
- if (current_symseg != 0)
- {
- last_source_file = 0;
- current_symseg = 0;
- return;
- }
-
- /* Finish the lexical context of the last function in the file;
- pop the context stack. */
-
- if (context_stack_depth > 0)
- {
- register struct context_stack *cstk;
- context_stack_depth--;
- cstk = &context_stack[context_stack_depth];
- /* Make a block for the local symbols within. */
- finish_block (cstk->name, &local_symbols, cstk->old_blocks,
- cstk->start_addr, end_addr);
- }
-
- /* Cleanup any undefined types that have been left hanging around
- (this needs to be done before the finish_blocks so that
- file_symbols is still good). */
- cleanup_undefined_types ();
-
- /* Finish defining all the blocks of this symtab. */
- finish_block (0, &file_symbols, 0, last_source_start_addr, end_addr);
- finish_block (0, &global_symbols, 0, last_source_start_addr, end_addr);
- blockvector = make_blockvector ();
-
- current_subfile->line_vector_index = line_vector_index;
-
- /* Now create the symtab objects proper, one for each subfile. */
- /* (The main file is one of them.) */
-
- for (subfile = subfiles; subfile; subfile = nextsub)
- {
- symtab = (struct symtab *) xxmalloc (sizeof (struct symtab));
- symtab->free_ptr = 0;
-
- /* Fill in its components. */
- symtab->blockvector = blockvector;
- type_vector->length = type_vector_length;
- symtab->typevector = type_vector;
- symtab->free_code = free_linetable;
- if (subfile->next == 0)
- symtab->free_ptr = (char *) type_vector;
-
- symtab->filename = subfile->name;
- lv = subfile->line_vector;
- lv->nitems = subfile->line_vector_index;
- symtab->linetable = (struct linetable *)
- xrealloc (lv, (sizeof (struct linetable)
- + lv->nitems * sizeof (struct linetable_entry)));
- symtab->nlines = 0;
- symtab->line_charpos = 0;
-
- /* Link the new symtab into the list of such. */
- symtab->next = symtab_list;
- symtab_list = symtab;
-
- nextsub = subfile->next;
- free (subfile);
- }
-
- type_vector = 0;
- type_vector_length = -1;
- line_vector = 0;
- line_vector_length = -1;
- last_source_file = 0;
-}
-
-#ifdef N_BINCL
-
-/* Handle the N_BINCL and N_EINCL symbol types
- that act like N_SOL for switching source files
- (different subfiles, as we call them) within one object file,
- but using a stack rather than in an arbitrary order. */
-
-struct subfile_stack
-{
- struct subfile_stack *next;
- char *name;
- int prev_index;
-};
-
-struct subfile_stack *subfile_stack;
-
-static void
-push_subfile ()
-{
- register struct subfile_stack *tem
- = (struct subfile_stack *) xxmalloc (sizeof (struct subfile_stack));
-
- tem->next = subfile_stack;
- subfile_stack = tem;
- if (current_subfile == 0 || current_subfile->name == 0)
- abort ();
- tem->name = current_subfile->name;
- tem->prev_index = header_file_prev_index;
-}
-
-static char *
-pop_subfile ()
-{
- register char *name;
- register struct subfile_stack *link = subfile_stack;
-
- if (link == 0)
- abort ();
-
- name = link->name;
- subfile_stack = link->next;
- header_file_prev_index = link->prev_index;
- free (link);
-
- return name;
-}
-#endif /* Have N_BINCL */
-
-/* Accumulate the misc functions in bunches of 127.
- At the end, copy them all into one newly allocated structure. */
-
-#define MISC_BUNCH_SIZE 127
-
-struct misc_bunch
-{
- struct misc_bunch *next;
- struct misc_function contents[MISC_BUNCH_SIZE];
-};
-
-/* Bunch currently being filled up.
- The next field points to chain of filled bunches. */
-
-static struct misc_bunch *misc_bunch;
-
-/* Number of slots filled in current bunch. */
-
-static int misc_bunch_index;
-
-/* Total number of misc functions recorded so far. */
-
-static int misc_count;
-
-static void
-init_misc_functions ()
-{
- misc_count = 0;
- misc_bunch = 0;
- misc_bunch_index = MISC_BUNCH_SIZE;
-}
-
-static void
-record_misc_function (name, address, type)
- char *name;
- CORE_ADDR address;
- int type;
-{
- register struct misc_bunch *new;
- register unsigned char mtype;
-
- if (misc_bunch_index == MISC_BUNCH_SIZE)
- {
- new = (struct misc_bunch *) xxmalloc (sizeof (struct misc_bunch));
- misc_bunch_index = 0;
- new->next = misc_bunch;
- misc_bunch = new;
- }
- misc_bunch->contents[misc_bunch_index].name = name;
- misc_bunch->contents[misc_bunch_index].address = address;
- switch (type &~ N_EXT)
- {
- case N_TEXT: mtype = mf_text; break;
- case N_DATA: mtype = mf_data; break;
- case N_BSS: mtype = mf_bss; break;
- case N_ABS: mtype = mf_abs; break;
-#ifdef N_SETV
- case N_SETV: mtype = mf_data; break;
-#endif
- default: mtype = mf_unknown; break;
- }
- misc_bunch->contents[misc_bunch_index].type = mtype;
- misc_bunch_index++;
- misc_count++;
-}
-
-static int
-compare_misc_functions (fn1, fn2)
- struct misc_function *fn1, *fn2;
-{
- /* Return a signed result based on unsigned comparisons
- so that we sort into unsigned numeric order. */
- if (fn1->address < fn2->address)
- return -1;
- if (fn1->address > fn2->address)
- return 1;
- return 0;
-}
-
-static void
-discard_misc_bunches ()
-{
- register struct misc_bunch *next;
-
- while (misc_bunch)
- {
- next = misc_bunch->next;
- free (misc_bunch);
- misc_bunch = next;
- }
-}
-
-/* INCLINK nonzero means bunches are from an incrementally-linked file.
- Add them to the existing bunches.
- Otherwise INCLINK is zero, and we start from scratch. */
-static void
-condense_misc_bunches (inclink)
- int inclink;
-{
- register int i, j;
- register struct misc_bunch *bunch;
-#ifdef NAMES_HAVE_UNDERSCORE
- int offset = 1;
-#else
- int offset = 0;
-#endif
-
- if (inclink)
- {
- misc_function_vector
- = (struct misc_function *)
- xrealloc (misc_function_vector, (misc_count + misc_function_count)
- * sizeof (struct misc_function));
- j = misc_function_count;
- }
- else
- {
- misc_function_vector
- = (struct misc_function *)
- xxmalloc (misc_count * sizeof (struct misc_function));
- j = 0;
- }
-
- bunch = misc_bunch;
- while (bunch)
- {
- for (i = 0; i < misc_bunch_index; i++)
- {
- misc_function_vector[j] = bunch->contents[i];
- misc_function_vector[j].name
- = obconcat (misc_function_vector[j].name
- + (misc_function_vector[j].name[0] == '_' ? offset : 0),
- "", "");
- j++;
- }
- bunch = bunch->next;
- misc_bunch_index = MISC_BUNCH_SIZE;
- }
-
- if (inclink)
- misc_function_count += misc_count;
- else
- misc_function_count = j;
-
- /* Sort the misc functions by address. */
-
- qsort (misc_function_vector, misc_function_count,
- sizeof (struct misc_function),
- compare_misc_functions);
-
- /* (re)build the hash table (positions changed during the sort) */
-
- for (i = 0; i < MISC_FUNC_HASH_SIZE; ++i)
- misc_function_hash_tab[i] = -1;
- for (i = 0; i < misc_function_count; ++i)
- {
- j = hash_symbol(misc_function_vector[i].name) & (MISC_FUNC_HASH_SIZE - 1);
- misc_function_vector[i].next = misc_function_hash_tab[j];
- misc_function_hash_tab[j] = i;
- }
-}
-
-/* Call sort_syms to sort alphabetically
- the symbols of each block of each symtab. */
-
-static int
-compare_symbols (s1, s2)
- struct symbol **s1, **s2;
-{
- register int namediff;
-
- /* Compare the initial characters. */
- namediff = SYMBOL_NAME (*s1)[0] - SYMBOL_NAME (*s2)[0];
- if (namediff != 0) return namediff;
-
- /* If they match, compare the rest of the names. */
- namediff = strcmp (SYMBOL_NAME (*s1), SYMBOL_NAME (*s2));
- if (namediff != 0) return namediff;
-
- /* For symbols of the same name, registers should come first. */
- return ((SYMBOL_CLASS (*s2) == LOC_REGISTER)
- - (SYMBOL_CLASS (*s1) == LOC_REGISTER));
-}
-
-static void sort_symtab_syms ();
-
-static void
-sort_syms ()
-{
- register struct symtab *s;
-
- for (s = symtab_list; s; s = s->next)
- sort_symtab_syms (s);
-}
-
-static void
-sort_symtab_syms (s)
- register struct symtab *s;
-{
- register struct blockvector *bv = BLOCKVECTOR (s);
- int nbl = BLOCKVECTOR_NBLOCKS (bv);
- int i;
- register struct block *b;
-
- /* Note that in the following sort, we always make sure that
- register debug symbol declarations always come before regular
- debug symbol declarations (as might happen when parameters are
- then put into registers by the compiler). We do this by a
- correct compare in compare_symbols, and by the reversal of the
- symbols if we don't sort. This works as long as a register debug
- symbol always comes after a parameter debug symbol. */
-
- /* This is no longer necessary; lookup_block_symbol now always
- prefers some other declaration over a parameter declaration. We
- still sort the thing (that is necessary), but we don't reverse it
- if we shouldn't sort it. */
-
- for (i = 0; i < nbl; i++)
- {
- b = BLOCKVECTOR_BLOCK (bv, i);
- if (BLOCK_SHOULD_SORT (b))
- qsort (&BLOCK_SYM (b, 0), BLOCK_NSYMS (b),
- sizeof (struct symbol *), compare_symbols);
- }
-}
-
-
-extern struct symtab *psymtab_to_symtab ();
-
-/* The entry point. */
-static CORE_ADDR entry_point;
-
-static char *symfile_string_table;
-static int symfile_string_table_size;
-
-/* This is the symbol-file command. Read the file, analyze its symbols,
- and add a struct symtab to symtab_list. */
-
-void
-symbol_file_command (name, from_tty)
- char *name;
- int from_tty;
-{
- register int desc;
- DECLARE_FILE_HEADERS;
- struct nlist *nlist;
-
- /* The string table. */
- char *stringtab;
-
- /* The size of the string table (buffer is a bizarre name...). */
- long buffer;
-
- register int val;
- extern void close ();
- struct cleanup *old_chain;
- struct symtab *symseg;
- struct stat statbuf;
-
- dont_repeat ();
-
- if (name == 0)
- {
- if ((symtab_list || partial_symtab_list)
- && from_tty
- && !query ("Discard symbol table? ", 0))
- error ("Not confirmed.");
- if (symfile)
- free (symfile);
- symfile = 0;
- free_all_symtabs ();
- free_all_psymtabs ();
- return;
- }
-
- name = tilde_expand (name);
- make_cleanup (free, name);
-
- if ((symtab_list || partial_symtab_list)
- && !query ("Load new symbol table from \"%s\"? ", name))
- error ("Not confirmed.");
-
- {
- char *absolute_name;
- desc = openp (getenv ("PATH"), 1, name, O_RDONLY, 0, &absolute_name);
- if (desc < 0)
- perror_with_name (name);
- else
- name = absolute_name;
- }
-
- old_chain = make_cleanup (close, desc);
- make_cleanup (free_current_contents, &name);
-
- READ_FILE_HEADERS (desc, name);
-
- entry_point = ENTRY_POINT;
-
- if (NUMBER_OF_SYMBOLS == 0)
- {
- if (symfile)
- free (symfile);
- symfile = 0;
- free_all_symtabs ();
- free_all_psymtabs ();
- printf ("%s has no symbol-table; symbols discarded.\n", name);
- fflush (stdout);
- do_cleanups (old_chain);
- return;
- }
-
- printf ("Reading symbol data from %s...", name);
- fflush (stdout);
-
- /* Now read the string table, all at once. */
- val = lseek (desc, STRING_TABLE_OFFSET, 0);
- if (val < 0)
- perror_with_name (name);
- if (stat (name, &statbuf) == -1)
- perror_with_name (name);
- READ_STRING_TABLE_SIZE (buffer);
- if (buffer >= 0 && buffer < statbuf.st_size)
- {
- /* This should speed things up without consuming much
- extra memory (because probably little of the space is going
- to be reused anyway, whether in data or stack space).
-
- A quick test (running GDB on itself and setting 9 breakpoints
- in different files) showed that memory usage was almost
- identical for the two cases. */
-#if 0
-#ifdef BROKEN_LARGE_ALLOCA
- stringtab = (char *) xmalloc (buffer);
- make_cleanup (free, stringtab);
-#else
- stringtab = (char *) alloca (buffer);
-#endif
-#endif
- stringtab = (char *) xmalloc (buffer);
- symfile_string_table = stringtab;
- symfile_string_table_size = buffer;
- }
- else
- stringtab = NULL;
- if (stringtab == NULL)
- error ("ridiculous string table size: %d bytes", buffer);
-
- /* Usually READ_STRING_TABLE_SIZE will have shifted the file pointer.
- Occaisionally, it won't. */
- val = lseek (desc, STRING_TABLE_OFFSET, L_SET);
- if (val < 0)
- perror_with_name (name);
- val = myread (desc, stringtab, buffer);
- if (val < 0)
- perror_with_name (name);
-
- /* Throw away the old symbol table. */
-
- if (symfile)
- free (symfile);
- symfile = 0;
- free_all_symtabs ();
- free_all_psymtabs ();
-
- /* Empty the hash table of global syms looking for values. */
- bzero (global_sym_chain, sizeof global_sym_chain);
-
- /* Symsegs are no longer supported by GDB. Setting symseg_chain to
- 0 is easier than finding all the symseg code and eliminating it. */
- symseg_chain = 0;
-
- /* Position to read the symbol table. Do not read it all at once. */
- val = lseek (desc, SYMBOL_TABLE_OFFSET, 0);
- if (val < 0)
- perror_with_name (name);
-
- /* Don't put these on the cleanup chain; they need to stick around
- until the next call to symbol_file_command. *Then* we'll free
- them. */
- free_header_files ();
- init_header_files ();
-
- init_misc_functions ();
- make_cleanup (discard_misc_bunches, 0);
-
- free_pendings = 0;
- pending_blocks = 0;
- file_symbols = 0;
- global_symbols = 0;
- make_cleanup (really_free_pendings, 0);
-
- /* Now that the symbol table data of the executable file are all in core,
- process them and define symbols accordingly. Closes desc. */
-
- read_dbx_symtab (desc, stringtab, buffer, NUMBER_OF_SYMBOLS, 0,
- ADDR_OF_TEXT_SEGMENT, SIZE_OF_TEXT_SEGMENT);
-
- /* Go over the misc functions and install them in vector. */
-
- condense_misc_bunches (0);
-
- /* Don't allow char * to have a typename (else would get caddr_t.) */
-
- TYPE_NAME (lookup_pointer_type (builtin_type_char)) = 0;
-
- /* Make a default for file to list. */
-
- symfile = savestring (name, strlen (name));
-
- /* Call to select_source_symtab used to be here; it was using too
- much time. I'll make sure that list_sources can handle the lack
- of current_source_symtab */
-
- do_cleanups (old_chain); /* Descriptor closed here */
-
- /* Free the symtabs made by read_symsegs, but not their contents,
- which have been copied into symtabs on symtab_list. */
- while (symseg_chain)
- {
- register struct symtab *s = symseg_chain->next;
- free (symseg_chain);
- symseg_chain = s;
- }
-
- if (!partial_symtab_list)
- printf ("\n(no debugging symbols found)...");
-
- printf ("done.\n");
- fflush (stdout);
-}
-
-/* Return name of file symbols were loaded from, or 0 if none.. */
-
-char *
-get_sym_file ()
-{
- return symfile;
-}
-
-/* Buffer for reading the symbol table entries. */
-static struct nlist symbuf[4096];
-static int symbuf_idx;
-static int symbuf_end;
-
-/* I/O descriptor for reading the symbol table. */
-static int symtab_input_desc;
-
-/* The address of the string table
- of the object file we are reading (as copied into core). */
-static char *stringtab_global;
-
-/* Refill the symbol table input buffer
- and set the variables that control fetching entries from it.
- Reports an error if no data available.
- This function can read past the end of the symbol table
- (into the string table) but this does no harm. */
-
-static int
-fill_symbuf ()
-{
- int nbytes = myread (symtab_input_desc, symbuf, sizeof (symbuf));
- if (nbytes <= 0)
- error ("error or end of file reading symbol table");
- symbuf_end = nbytes / sizeof (struct nlist);
- symbuf_idx = 0;
- return 1;
-}
-
-/* dbx allows the text of a symbol name to be continued into the
- next symbol name! When such a continuation is encountered
- (a \ at the end of the text of a name)
- call this function to get the continuation. */
-
-static char *
-next_symbol_text ()
-{
- if (symbuf_idx == symbuf_end)
- fill_symbuf ();
- symnum++;
- return symbuf[symbuf_idx++].n_un.n_strx + stringtab_global;
-}
-
-/*
- * Initializes storage for all of the partial symbols that will be
- * created by read_dbx_symtab and subsidiaries.
- */
-void
-init_psymbol_list (total_symbols)
- int total_symbols;
-{
- /* Current best guess is that there are approximately a twentieth
- of the total symbols (in a debugging file) are global or static
- oriented symbols */
- global_psymbols.size = total_symbols / 10;
- static_psymbols.size = total_symbols / 10;
- global_psymbols.next = global_psymbols.list = (struct partial_symbol *)
- xmalloc (global_psymbols.size * sizeof (struct partial_symbol));
- static_psymbols.next = static_psymbols.list = (struct partial_symbol *)
- xmalloc (static_psymbols.size * sizeof (struct partial_symbol));
-}
-
-/*
- * Initialize the list of bincls to contain none and have some
- * allocated.
- */
-static void
-init_bincl_list (number)
- int number;
-{
- bincls_allocated = number;
- next_bincl = bincl_list = (struct header_file_location *)
- xmalloc (bincls_allocated * sizeof(struct header_file_location));
-}
-
-/*
- * Add a bincl to the list.
- */
-static void
-add_bincl_to_list (pst, name, instance)
- struct partial_symtab *pst;
- char *name;
- int instance;
-{
- if (next_bincl >= bincl_list + bincls_allocated)
- {
- int offset = next_bincl - bincl_list;
- bincls_allocated *= 2;
- bincl_list = (struct header_file_location *)
- xrealloc (bincl_list,
- bincls_allocated * sizeof (struct header_file_location));
- next_bincl = bincl_list + offset;
- }
- next_bincl->pst = pst;
- next_bincl->instance = instance;
- next_bincl++->name = name;
-}
-
-/*
- * Given a name, value pair, find the corresponding
- * bincl in the list. Return the partial symtab associated
- * with that header_file_location.
- */
-struct partial_symtab *
-find_corresponding_bincl_psymtab (name, instance)
- char *name;
- int instance;
-{
- struct header_file_location *bincl;
-
- for (bincl = bincl_list; bincl < next_bincl; bincl++)
- if (bincl->instance == instance
- && !strcmp (name, bincl->name))
- return bincl->pst;
-
- return (struct partial_symtab *) 0;
-}
-
-/*
- * Free the storage allocated for the bincl list.
- */
-static void
-free_bincl_list ()
-{
- free (bincl_list);
- bincls_allocated = 0;
-}
-
-static struct partial_symtab *start_psymtab ();
-static void add_psymtab_dependency ();
-static void end_psymtab();
-
-static int
-compare_psymbols (s1, s2)
- register struct partial_symbol *s1, *s2;
-{
- register char
- *st1 = SYMBOL_NAME (s1),
- *st2 = SYMBOL_NAME (s2);
- register int i;
-
- if (st1[0] - st2[0])
- return (st1[0] - st2[0]);
- if (st1[1] - st2[1])
- return (st1[1] - st2[1]);
- if (i = strcmp(st1, st2))
- return (i);
- /* Next comparison implements policy that used to be in lookup_symbol:
- * it would search psymtabs in psymtab_list order (reverse order of
- * declaration) & take first occurance of symbol it found. So, we
- * collate duplicate names in reverse psymtab order. */
- return (s2->pst - s1->pst);
-}
-
-/* Given pointers to an a.out symbol table in core containing dbx
- style data, setup partial_symtab's describing each source file for
- which debugging information is available. NLISTLEN is the number
- of symbols in the symbol table. All symbol names are given as
- offsets relative to STRINGTAB. STRINGTAB_SIZE is the size of
- STRINGTAB.
-
- I have no idea whether or not this routine should be setup to deal
- with inclinks. It seems reasonable to me that they be dealt with
- standardly, so I am not going to make a strong effort to deal with
- them here.
- */
-
-static void
-read_dbx_symtab (desc, stringtab, stringtab_size, nlistlen, inclink,
- text_addr, text_size)
- int desc;
- register char *stringtab;
- register long stringtab_size;
- register int nlistlen;
- int inclink;
- unsigned text_addr;
- int text_size;
-{
- register struct nlist *bufp;
- register char *namestring;
- register struct partial_symbol *psym;
- register struct psymbol_allocation_list *psymbol_struct;
-
- int nsl;
- int past_first_source_file = 0;
- CORE_ADDR last_o_file_start = 0;
- char *last_o_file_name = "*bogus*";
- struct cleanup *old_chain;
- char *p;
- enum namespace ns;
- enum address_class class;
-
-#ifdef PROFILE_TYPES
- int i;
- int profile_types [256];
- int strcmp_called = 0;
- int autovars = 0;
- int global_funs = 0;
-#endif
-
- /* Current partial symtab */
- struct partial_symtab *pst;
-
- /* List of current psymtab's include files */
- char **psymtab_include_list;
- int includes_allocated;
- int includes_used;
-
- /* Index within current psymtab dependency list */
- struct partial_symtab **dependency_list;
- int dependencies_used, dependencies_allocated;
-
-#ifdef PROFILE_TYPES
- for (i = 0; i < 256; i++)
- profile_types[i] = 0;
-#endif
-
- stringtab_global = stringtab;
-
- pst = (struct partial_symtab *) 0;
-
- includes_allocated = 30;
- includes_used = 0;
- psymtab_include_list = (char **) alloca (includes_allocated *
- sizeof (char *));
-
- dependencies_allocated = 30;
- dependencies_used = 0;
- dependency_list =
- (struct partial_symtab **) alloca (dependencies_allocated *
- sizeof (struct partial_symtab *));
-
- old_chain = make_cleanup (free_all_psymtabs, 0);
-
- /* Init bincl list */
- init_bincl_list (20);
- make_cleanup (free_bincl_list, 0);
-
- /* Setup global partial symbol list */
- init_psymbol_list (nlistlen);
-
- last_source_file = 0;
-
-#ifdef END_OF_TEXT_DEFAULT
- end_of_text_addr = END_OF_TEXT_DEFAULT;
-#else
- end_of_text_addr = text_addr + text_size;
-#endif
-
- symtab_input_desc = desc; /* This is needed for fill_symbuf below */
- symbuf_end = symbuf_idx = 0;
-
- for (symnum = 0; symnum < nlistlen; symnum++)
- {
- /* Get the symbol for this run and pull out some info */
- QUIT; /* allow this to be interruptable */
- if (symbuf_idx == symbuf_end)
- fill_symbuf ();
- bufp = &symbuf[symbuf_idx++];
-
-#ifdef PROFILE_TYPES
- profile_types[bufp->n_type]++;
-#endif
-
- /*
- * Special case to speed up readin.
- */
- if (bufp->n_type == N_SLINE) continue;
-
- /* Ok. There is a lot of code duplicated in the rest of this
- switch statiement (for efficiency reasons). Since I don't
- like duplicating code, I will do my penance here, and
- describe the code which is duplicated:
-
- *) The assignment to namestring.
- *) The call to index.
- *) The addition of a partial symbol the the two partial
- symbol lists. This last is a large section of code, so
- I've imbedded it in the following macro.
- */
-
-/* Set namestring based on bufp. */
-#define SET_NAMESTRING()\
- if (bufp->n_un.n_strx < 0 || bufp->n_un.n_strx >= stringtab_size) \
- error ("Invalid symbol data: bad string table offset: %d", \
- bufp->n_un.n_strx); \
- namestring = bufp->n_un.n_strx + stringtab
-
-#define ADD_PSYMBOL_TO_LIST(NAME, NAMELENGTH, NAMESPACE, CLASS, LIST, VALUE)\
- do { \
- if ((LIST).next >= \
- (LIST).list + (LIST).size) \
- { \
- (LIST).list = (struct partial_symbol *) \
- xrealloc ((LIST).list, \
- ((LIST).size * 2 \
- * sizeof (struct partial_symbol))); \
- /* Next assumes we only went one over. Should be good if \
- program works correctly */ \
- (LIST).next = \
- (LIST).list + (LIST).size; \
- (LIST).size *= 2; \
- } \
- psym = (LIST).next++; \
- \
- SYMBOL_NAME (psym) = (char *) obstack_alloc (psymbol_obstack, \
- (NAMELENGTH) + 1); \
- strncpy (SYMBOL_NAME (psym), (NAME), (NAMELENGTH)); \
- SYMBOL_NAME (psym)[(NAMELENGTH)] = '\0'; \
- SYMBOL_NAMESPACE (psym) = (NAMESPACE); \
- SYMBOL_CLASS (psym) = (CLASS); \
- SYMBOL_VALUE (psym) = (VALUE); \
- } while (0);
-
-
- switch (bufp->n_type)
- {
- /*
- * Standard, non-debugger, symbols
- */
-
- case N_TEXT | N_EXT:
- /* Catch etext */
-
- SET_NAMESTRING();
-
- if (namestring[6] == '\0' && namestring[5] == 't'
- && namestring[4] == 'x' && namestring[3] == 'e'
- && namestring[2] == 't' && namestring[1] == 'e'
- && namestring[0] == '_')
- end_of_text_addr = bufp->n_value;
-
- /* Figure out beginning and end of global linker symbol
- section and put non-debugger specified symbols on
- tmp_symchain */
-
- last_global_sym = symnum;
- if (!first_global_sym) first_global_sym = symnum;
-
- record_misc_function (namestring, bufp->n_value,
- bufp->n_type); /* Always */
-
- continue;
-
-#ifdef N_NBTEXT
- case N_NBTEXT | N_EXT:
-#endif
-#ifdef N_NBDATA
- case N_NBDATA | N_EXT:
-#endif
-#ifdef N_NBBSS
- case N_NBBSS | N_EXT:
-#endif
-#ifdef N_SETV
- case N_SETV | N_EXT:
-#endif
- case N_ABS | N_EXT:
- case N_DATA | N_EXT:
- case N_BSS | N_EXT:
- /* Figure out beginning and end of global linker symbol
- section and put non-debugger specified symbols on
- tmp_symchain */
-
- SET_NAMESTRING();
-
- last_global_sym = symnum;
- if (!first_global_sym) first_global_sym = symnum;
-
- /* Not really a function here, but... */
- record_misc_function (namestring, bufp->n_value,
- bufp->n_type); /* Always */
-
- continue;
-
-#ifdef N_NBTEXT
- case N_NBTEXT:
-#endif
-
- /* We need to be able to deal with both N_FN or N_TEXT,
- because we have no way of knowing whether the sys-supplied ld
- or GNU ld was used to make the executable. */
-#if ! (N_FN & N_EXT)
- case N_FN:
-#endif
- case N_FN | N_EXT:
- case N_TEXT:
- SET_NAMESTRING();
- if ((namestring[0] == '-' && namestring[1] == 'l')
- || (namestring [(nsl = strlen (namestring)) - 1] == 'o'
- && namestring [nsl - 2] == '.'))
- {
- if (entry_point < bufp->n_value
- && entry_point >= last_o_file_start)
- {
- startup_file_start = last_o_file_start;
- startup_file_end = bufp->n_value;
- }
- if (past_first_source_file && pst)
- {
- end_psymtab (pst, psymtab_include_list, includes_used,
- symnum * sizeof (struct nlist), bufp->n_value,
- dependency_list, dependencies_used,
- global_psymbols.next, static_psymbols.next);
- pst = (struct partial_symtab *) 0;
- includes_used = 0;
- dependencies_used = 0;
- }
- else
- past_first_source_file = 1;
- last_o_file_start = bufp->n_value;
- last_o_file_name = namestring;
- nsl = strlen(namestring);
- if (namestring[nsl-2] == '.' && namestring[nsl-1] == 'o')
- namestring[nsl-2] = 0;
- }
- else if (strcmp(namestring, "gcc_compiled."))
- {
- if (*namestring == '_')
- ++namestring;
- namestring = obconcat(last_o_file_name, ":", namestring);
- last_global_sym = symnum;
- if (!first_global_sym)
- first_global_sym = symnum;
- record_misc_function(namestring, bufp->n_value, bufp->n_type);
- }
- continue;
-
- case N_ABS:
- case N_DATA:
- case N_BSS:
- SET_NAMESTRING();
- if (*namestring == '_')
- ++namestring;
- namestring = obconcat(last_o_file_name, ":", namestring);
- last_global_sym = symnum;
- if (!first_global_sym)
- first_global_sym = symnum;
- record_misc_function(namestring, bufp->n_value, bufp->n_type);
- continue;
-
- case N_UNDF:
- case N_UNDF | N_EXT:
-#ifdef N_NBDATA
- case N_NBDATA:
-#endif
-#ifdef N_NBBSS
- case N_NBBSS:
-#endif
-
- /* Keep going . . .*/
-
- /*
- * Special symbol types for GNU
- */
-#ifdef N_INDR
- case N_INDR:
- case N_INDR | N_EXT:
-#endif
-#ifdef N_SETA
- case N_SETA:
- case N_SETA | N_EXT:
- case N_SETT:
- case N_SETT | N_EXT:
- case N_SETD:
- case N_SETD | N_EXT:
- case N_SETB:
- case N_SETB | N_EXT:
- case N_SETV:
-#endif
- continue;
-
- /*
- * Debugger symbols
- */
-
- case N_SO:
- /* End the current partial symtab and start a new one */
-
- SET_NAMESTRING();
-
- if (pst && past_first_source_file)
- {
- end_psymtab (pst, psymtab_include_list, includes_used,
- symnum * sizeof (struct nlist), bufp->n_value,
- dependency_list, dependencies_used,
- global_psymbols.next, static_psymbols.next);
- pst = (struct partial_symtab *) 0;
- includes_used = 0;
- dependencies_used = 0;
- }
- else
- past_first_source_file = 1;
-
- pst = start_psymtab (namestring, bufp->n_value,
- symnum * sizeof (struct nlist),
- global_psymbols.next, static_psymbols.next);
-
- continue;
-
-#ifdef N_BINCL
- case N_BINCL:
- /* Add this bincl to the bincl_list for future EXCLs. No
- need to save the string; it'll be around until
- read_dbx_symtab function return */
-
- SET_NAMESTRING();
-
- add_bincl_to_list (pst, namestring, bufp->n_value);
-
- /* Mark down an include file in the current psymtab */
-
- psymtab_include_list[includes_used++] = namestring;
- if (includes_used >= includes_allocated)
- {
- char **orig = psymtab_include_list;
-
- psymtab_include_list = (char **)
- alloca ((includes_allocated *= 2) *
- sizeof (char *));
- bcopy (orig, psymtab_include_list,
- includes_used * sizeof (char *));
- }
-
- continue;
-#endif
-
- case N_SOL:
- /* Mark down an include file in the current psymtab */
-
- SET_NAMESTRING();
-
- /* In C++, one may expect the same filename to come round many
- times, when code is coming alternately from the main file
- and from inline functions in other files. So I check to see
- if this is a file we've seen before.
-
- This seems to be a lot of time to be spending on N_SOL, but
- things like "break expread.y:435" need to work (I
- suppose the psymtab_include_list could be hashed or put
- in a binary tree, if profiling shows this is a major hog). */
- {
- register int i;
- for (i = 0; i < includes_used; i++)
- if (!strcmp (namestring, psymtab_include_list[i]))
- {
- i = -1;
- break;
- }
- if (i == -1)
- continue;
- }
-
- psymtab_include_list[includes_used++] = namestring;
- if (includes_used >= includes_allocated)
- {
- char **orig = psymtab_include_list;
-
- psymtab_include_list = (char **)
- alloca ((includes_allocated *= 2) *
- sizeof (char *));
- bcopy (orig, psymtab_include_list,
- includes_used * sizeof (char *));
- }
- continue;
-
- case N_LSYM: /* Typedef or automatic variable. */
- SET_NAMESTRING();
-
- p = (char *) index (namestring, ':');
-
- /* Skip if there is no :. */
- if (!p) continue;
-
- switch (p[1])
- {
- case 'T':
- ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
- STRUCT_NAMESPACE, LOC_TYPEDEF,
- static_psymbols, bufp->n_value);
- goto check_enum;
- case 't':
- ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
- VAR_NAMESPACE, LOC_TYPEDEF,
- static_psymbols, bufp->n_value);
- check_enum:
- /* If this is an enumerated type, we need to
- add all the enum constants to the partial symbol
- table. This does not cover enums without names, e.g.
- "enum {a, b} c;" in C, but fortunately those are
- rare. There is no way for GDB to find those from the
- enum type without spending too much time on it. Thus
- to solve this problem, the compiler needs to put out separate
- constant symbols ('c' N_LSYMS) for enum constants in
- enums without names. */
-
- /* We are looking for something of the form
- <name> ":" ("t" | "T") [<number> "="] "e"
- {<constant> ":" <value> ","} ";". */
-
- /* Skip over the colon and the 't' or 'T'. */
- p += 2;
- /* This type may be given a number. Skip over it. */
- while ((*p >= '0' && *p <= '9')
- || *p == '=')
- p++;
-
- if (*p++ == 'e')
- {
- /* We have found an enumerated type. */
- /* According to comments in read_enum_type
- a comma could end it instead of a semicolon.
- I don't know where that happens.
- Accept either. */
- while (*p && *p != ';' && *p != ',')
- {
- char *q;
-
- /* Check for and handle cretinous dbx symbol name
- continuation! */
- if (*p == '\\')
- p = next_symbol_text ();
-
- /* Point to the character after the name
- of the enum constant. */
- for (q = p; *q && *q != ':'; q++)
- ;
- /* Note that the value doesn't matter for
- enum constants in psymtabs, just in symtabs. */
- ADD_PSYMBOL_TO_LIST (p, q - p,
- VAR_NAMESPACE, LOC_CONST,
- static_psymbols, 0);
- /* Point past the name. */
- p = q;
- /* Skip over the value. */
- while (*p && *p != ',')
- p++;
- /* Advance past the comma. */
- if (*p)
- p++;
- }
- }
-
- continue;
- case 'c':
- /* Constant, e.g. from "const" in Pascal. */
- ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
- VAR_NAMESPACE, LOC_CONST,
- static_psymbols, bufp->n_value);
- continue;
- default:
-#ifdef PROFILE_TYPES
- if (isalpha(p[1]))
- printf ("Funny...LSYM with a letter that isn't a type\n");
- autovars++;
-#endif
- /* Skip if the thing following the : is
- not a letter (which indicates declaration of a local
- variable, which we aren't interested in). */
- continue;
- }
-
- case N_FUN:
-#if 0
- /* This special-casing of N_FUN is just wrong; N_FUN
- does not mean "function"; it means "text segment".
- So N_FUN can go with 'V', etc. as well as 'f' or 'F'. */
-
- SET_NAMESTRING();
-
- p = (char *) index (namestring, ':');
-
- if (!p || p[1] == 'F') continue;
-
-#ifdef PROFILE_TYPES
- if (p[1] != 'f')
- printf ("Funny...FUN with a letter that isn't 'F' or 'f'.\n");
- global_funs++;
-#endif
-
- ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
- VAR_NAMESPACE, LOC_BLOCK,
- static_psymbols, bufp->n_value);
-
- continue;
-#endif /* 0 */
- case N_GSYM: /* Global (extern) variable; can be
- data or bss (sigh). */
- case N_STSYM: /* Data seg var -- static */
- case N_LCSYM: /* BSS " */
-
- /* Following may probably be ignored; I'll leave them here
- for now (until I do Pascal and Modula 2 extensions). */
-
- case N_PC: /* I may or may not need this; I
- suspect not. */
-#ifdef N_M2C
- case N_M2C: /* I suspect that I can ignore this here. */
- case N_SCOPE: /* Same. */
-#endif
-
- SET_NAMESTRING();
-
- p = (char *) index (namestring, ':');
- if (!p)
- continue; /* Not a debugging symbol. */
-
- process_symbol_for_psymtab:
-
- /* Main processing section for debugging symbols which
- the initial read through the symbol tables needs to worry
- about. If we reach this point, the symbol which we are
- considering is definitely one we are interested in.
- p must also contain the (valid) index into the namestring
- which indicates the debugging type symbol. */
-
- switch (p[1])
- {
- case 'c':
- ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
- VAR_NAMESPACE, LOC_CONST,
- static_psymbols, bufp->n_value);
- continue;
- case 'S':
- ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
- VAR_NAMESPACE, LOC_STATIC,
- static_psymbols, bufp->n_value);
- continue;
- case 'G':
- ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
- VAR_NAMESPACE, LOC_EXTERNAL,
- global_psymbols, bufp->n_value);
- continue;
-
- case 't':
- ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
- VAR_NAMESPACE, LOC_TYPEDEF,
- global_psymbols, bufp->n_value);
- continue;
-
- case 'f':
- ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
- VAR_NAMESPACE, LOC_BLOCK,
- static_psymbols, bufp->n_value);
- continue;
-
- /* Two things show up here (hopefully); static symbols of
- local scope (static used inside braces) or extensions
- of structure symbols. We can ignore both. */
- case 'V':
- case '(':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- /* Global functions are ignored here. I'm not
- sure what psymtab they go into (or just the misc
- function vector). */
- case 'F':
- continue;
-
- default:
- fatal ("Internal error: Unexpected debugging symbol type '%c' at symnum %d.\n",
- p[1], symnum);
- }
-
-#ifdef N_BINCL
- case N_EXCL:
-
- SET_NAMESTRING();
-
- /* Find the corresponding bincl and mark that psymtab on the
- psymtab dependency list */
- {
- struct partial_symtab *needed_pst =
- find_corresponding_bincl_psymtab (namestring, bufp->n_value);
-
- /* If this include file was defined earlier in this file,
- leave it alone. */
- if (needed_pst == pst) continue;
-
- if (needed_pst)
- {
- int i;
- int found = 0;
-
- for (i = 0; i < dependencies_used; i++)
- if (dependency_list[i] == needed_pst)
- {
- found = 1;
- break;
- }
-
- /* If it's already in the list, skip the rest. */
- if (found) continue;
-
- dependency_list[dependencies_used++] = needed_pst;
- if (dependencies_used >= dependencies_allocated)
- {
- struct partial_symtab **orig = dependency_list;
- dependency_list =
- (struct partial_symtab **)
- alloca ((dependencies_allocated *= 2)
- * sizeof (struct partial_symtab *));
- bcopy (orig, dependency_list,
- (dependencies_used
- * sizeof (struct partial_symtab *)));
-#ifdef DEBUG_INFO
- fprintf (stderr, "Had to reallocate dependency list.\n");
- fprintf (stderr, "New dependencies allocated: %d\n",
- dependencies_allocated);
-#endif
- }
- }
- else
- error ("Invalid symbol data: \"repeated\" header file not previously seen, at symtab pos %d.",
- symnum);
- }
- continue;
-
- case N_EINCL:
-#endif
-#ifdef N_DSLINE
- case N_DSLINE:
-#endif
-#ifdef N_BSLINE
- case N_BSLINE:
-#endif
- case N_SSYM: /* Claim: Structure or union element.
- Hopefully, I can ignore this. */
- case N_ENTRY: /* Alternate entry point; can ignore. */
-#ifdef N_MAIN
- case N_MAIN: /* Can definitely ignore this. */
-#endif
- case N_LENG:
- case N_BCOMM:
- case N_ECOMM:
- case N_ECOML:
- case N_FNAME:
- case N_SLINE:
- case N_RSYM:
- case N_PSYM:
- case N_LBRAC:
- case N_RBRAC:
- /* These symbols aren't interesting; don't worry about them */
-
- continue;
-
- default:
- /* If we haven't found it yet, we've got problems */
-
- if (IGNORE_SYMBOL (bufp->n_type))
- continue;
-
- fatal ("Bad symbol type 0x%x encountered in gdb scan", bufp->n_type);
- }
- }
-
- /* If there's stuff to be cleaned up, clean it up. */
- if (entry_point < bufp->n_value
- && entry_point >= last_o_file_start)
- {
- startup_file_start = last_o_file_start;
- startup_file_end = bufp->n_value;
- }
-
- if (pst)
- {
- end_psymtab (pst, psymtab_include_list, includes_used,
- symnum * sizeof (struct nlist), end_of_text_addr,
- dependency_list, dependencies_used,
- global_psymbols.next, static_psymbols.next);
- includes_used = 0;
- dependencies_used = 0;
- pst = (struct partial_symtab *) 0;
- }
-
- /* sort the global & static symtab list so we can binary search them */
- qsort (global_psymbols.list, global_psymbols.next - global_psymbols.list,
- sizeof (struct partial_symbol), compare_psymbols);
- qsort (static_psymbols.list, static_psymbols.next - static_psymbols.list,
- sizeof (struct partial_symbol), compare_psymbols);
- free_bincl_list ();
- discard_cleanups (old_chain);
-#ifdef PROFILE_TYPES
- {
- int i, j;
-#define __define_stab(SYM, NUMBER, NAME) {NUMBER, NAME},
- static struct xyzzy {
- unsigned char symnum;
- char *name;
- } tmp_list[] = {
-#include "stab.def"
- {0x1, "eREF"},
- {0x2, "ABS"},
- {0x3, "eABS"},
- {0x4, "TEXT"},
- {0x5, "eTEXT"},
- {0x6, "DATA"},
- {0x7, "eDATA"},
- {0x8, "BSS"},
- {0x9, "eBSS"},
- {0x12, "COMM"},
- {0x13, "eCOMM"},
- {0x1f, "FN"},
- {0, "Unknown"},
-};
- for (i = 0; i < 256; i++)
- {
- for (j = 0; j < (sizeof (tmp_list) / sizeof (struct xyzzy)) - 1; j++)
- if (tmp_list[j].symnum == i)
- break;
- printf ("Symbol \"%s\" (0x%x) occured %d times.\n",
- tmp_list[j].name, i, profile_types[i]);
- }
- printf ("Auto vars (under LSYM): %d\n", autovars);
- printf ("Global funs (under FUN): %d\n", global_funs);
- }
-#endif
-}
-
-/*
- * Allocate and partially fill a partial symtab. It will be
- * completely filled at the end of the symbol list.
- */
-static struct partial_symtab *
-start_psymtab (filename, textlow, ldsymoff, global_syms, static_syms)
- char *filename;
- int textlow;
- int ldsymoff;
- struct partial_symbol *global_syms;
- struct partial_symbol *static_syms;
-{
- struct partial_symtab *result =
- (struct partial_symtab *) obstack_alloc (psymbol_obstack,
- sizeof (struct partial_symtab));
-
- result->filename =
- (char *) obstack_alloc (psymbol_obstack,
- strlen (filename) + 1);
- strcpy (result->filename, filename);
-
- result->textlow = textlow;
- result->ldsymoff = ldsymoff;
-
- result->readin = 0;
-
- result->globals_offset = global_syms - global_psymbols.list;
- result->statics_offset = static_syms - static_psymbols.list;
-
- result->n_global_syms = 0;
- result->n_static_syms = 0;
-
- return result;
-}
-
-
-/* Close off the current usage of a partial_symbol table entry. This
- involves setting the correct number of includes (with a realloc),
- setting the high text mark, setting the symbol length in the
- executable, and setting the length of the global and static lists
- of psymbols.
-
- The global symbols and static symbols are then seperately sorted.
-
- Then the partial symtab is put on the global list.
- *** List variables and peculiarities of same. ***
- */
-static void
-end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
- capping_text, dependency_list, number_dependencies,
- capping_global, capping_static)
- struct partial_symtab *pst;
- char **include_list;
- int num_includes;
- int capping_symbol_offset;
- int capping_text;
- struct partial_symtab **dependency_list;
- int number_dependencies;
- struct partial_symbol *capping_global, *capping_static;
-{
- int i;
- register struct partial_symbol *ps;
-
- pst->ldsymlen = capping_symbol_offset - pst->ldsymoff;
- pst->texthigh = capping_text;
-
- pst->n_global_syms =
- capping_global - (global_psymbols.list + pst->globals_offset);
- pst->n_static_syms =
- capping_static - (static_psymbols.list + pst->statics_offset);
-
- pst->dependencies = (struct partial_symtab **)
- obstack_alloc (psymbol_obstack,
- number_dependencies * sizeof (struct partial_symtab *));
- bcopy (dependency_list, pst->dependencies,
- number_dependencies * sizeof (struct partial_symtab *));
- pst->number_of_dependencies = number_dependencies;
-
- for (i = 0; i < num_includes; i++)
- {
- /* Eventually, put this on obstack */
- struct partial_symtab *subpst =
- (struct partial_symtab *)
- obstack_alloc (psymbol_obstack,
- sizeof (struct partial_symtab));
-
- subpst->filename =
- (char *) obstack_alloc (psymbol_obstack,
- strlen (include_list[i]) + 1);
- strcpy (subpst->filename, include_list[i]);
-
- subpst->ldsymoff =
- subpst->ldsymlen =
- subpst->textlow =
- subpst->texthigh = 0;
- subpst->readin = 0;
-
- subpst->dependencies = (struct partial_symtab **)
- obstack_alloc (psymbol_obstack,
- sizeof (struct partial_symtab *));
- subpst->dependencies[0] = pst;
- subpst->number_of_dependencies = 1;
-
- subpst->globals_offset =
- subpst->n_global_syms =
- subpst->statics_offset =
- subpst->n_static_syms = 0;
-
- subpst->next = partial_symtab_list;
- partial_symtab_list = subpst;
- }
-
- for (ps = global_psymbols.list + pst->globals_offset;
- ps < capping_global; ++ps)
- ps->pst = pst;
- for (ps = static_psymbols.list + pst->statics_offset;
- ps < capping_static; ++ps)
- ps->pst = pst;
-
- /* Put the psymtab on the psymtab list */
- pst->next = partial_symtab_list;
- partial_symtab_list = pst;
-}
-
-
-/* Helper routines for psymtab_to_symtab. */
-static void scan_file_globals ();
-static void read_ofile_symtab ();
-
-static void
-psymtab_to_symtab_1 (pst, desc, stringtab, stringtab_size, sym_offset)
- struct partial_symtab *pst;
- int desc;
- char *stringtab;
- int stringtab_size;
- int sym_offset;
-{
- struct cleanup *old_chain;
- int i;
-
- if (!pst)
- return;
-
- if (pst->readin)
- {
- fprintf (stderr, "Psymtab for %s already read in. Shouldn't happen.\n",
- pst->filename);
- return;
- }
-
- /* Read in all partial symbtabs on which this one is dependent */
- for (i = 0; i < pst->number_of_dependencies; i++)
- if (!pst->dependencies[i]->readin)
- {
- /* Inform about additional files that need to be read in. */
- if (info_verbose)
- {
- printf_filtered (" and %s...", pst->dependencies[i]->filename);
- fflush (stdout);
- }
- psymtab_to_symtab_1 (pst->dependencies[i], desc,
- stringtab, stringtab_size, sym_offset);
- }
-
- if (pst->ldsymlen) /* Otherwise it's a dummy */
- {
- /* Init stuff necessary for reading in symbols */
- free_pendings = 0;
- pending_blocks = 0;
- file_symbols = 0;
- global_symbols = 0;
- old_chain = make_cleanup (really_free_pendings, 0);
-
- /* Read in this files symbols */
- lseek (desc, sym_offset, L_SET);
- read_ofile_symtab (desc, stringtab, stringtab_size,
- pst->ldsymoff,
- pst->ldsymlen, pst->textlow,
- pst->texthigh - pst->textlow, 0);
- sort_symtab_syms (symtab_list); /* At beginning since just added */
-
- do_cleanups (old_chain);
- }
-
- pst->readin = 1;
-}
-
-/*
- * Read in all of the symbols for a given psymtab for real. Return
- * the value of the symtab you create. Do not free the storage
- * allocated to the psymtab; it may have pointers to it.
- */
-struct symtab *
-psymtab_to_symtab(pst)
- struct partial_symtab *pst;
-{
- int desc;
- DECLARE_FILE_HEADERS;
- char *stringtab;
- struct partial_symtab **list_patch;
- int stsize, val;
- struct stat statbuf;
- struct cleanup *old_chain;
- extern void close ();
- int i;
- struct symtab *result;
- char *name = symfile; /* Some of the macros require the */
- /* variable "name" to be defined in */
- /* the context in which they execute */
- /* (Yech!) */
-
- if (!pst)
- return 0;
-
- if (pst->readin)
- {
- fprintf (stderr, "Psymtab for %s already read in. Shouldn't happen.\n",
- pst->filename);
- return 0;
- }
-
- if (!name)
- error("No symbol file currently specified; use command symbol-file");
-
- if (pst->ldsymlen || pst->number_of_dependencies)
- {
- /* Print the message now, before reading the string table,
- to avoid disconcerting pauses. */
- if (info_verbose)
- {
- printf_filtered ("Reading in symbols for %s...", pst->filename);
- fflush (stdout);
- }
-
- /* Open symbol file and read in string table */
- if (stat (name, &statbuf) < 0)
- perror_with_name (name);
- desc = open(name, O_RDONLY, 0); /* symbol_file_command
- guarrantees that the symbol file name
- will be absolute, so there is no
- need for openp */
-
- old_chain = make_cleanup (close, desc);
-
- if (desc < 0)
- error("Symbol file not readable");
-
- READ_FILE_HEADERS (desc, name);
-
-#if 0
- /* Read in the string table */
- lseek (desc, STRING_TABLE_OFFSET, L_SET);
- READ_STRING_TABLE_SIZE (stsize);
- if (stsize >= 0 && stsize < statbuf.st_size)
- {
-#ifdef BROKEN_LARGE_ALLOCA
- stringtab = (char *) xmalloc (stsize);
- make_cleanup (free, stringtab);
-#else
- stringtab = (char *) alloca (stsize);
-#endif
- }
- else
- stringtab = NULL;
- if (stringtab == NULL)
- error ("ridiculous string table size: %d bytes", stsize);
-
- /* Usually READ_STRING_TABLE_SIZE will have shifted the file pointer.
- Occaisionally, it won't. */
- val = lseek (desc, STRING_TABLE_OFFSET, L_SET);
- if (val < 0)
- perror_with_name (name);
- val = myread (desc, stringtab, stsize);
- if (val < 0)
- perror_with_name (name);
-#endif /* 0 */
- stringtab = symfile_string_table;
- stsize = symfile_string_table_size;
-
- psymtab_to_symtab_1 (pst, desc, stringtab, stsize,
- SYMBOL_TABLE_OFFSET);
-
- /* Match with global symbols. This only needs to be done once,
- after all of the symtabs and dependencies have been read in. */
- scan_file_globals ();
-
- do_cleanups (old_chain);
-
- /* Finish up the debug error message. */
- if (info_verbose)
- printf_filtered ("done.\n");
- }
-
- /* Search through list for correct name. */
- for (result = symtab_list; result; result = result->next)
- if (!strcmp (result->filename, pst->filename))
- return result;
-
- return 0;
-}
-
-/*
- * Scan through all of the global symbols defined in the object file,
- * assigning values to the debugging symbols that need to be assigned
- * to. Get these symbols from the misc function list.
- */
-static void
-scan_file_globals ()
-{
- int hash;
- int mf;
-
- for (mf = 0; mf < misc_function_count; mf++)
- {
- char *namestring = misc_function_vector[mf].name;
- struct symbol *sym, *prev;
-
- QUIT;
-
- prev = (struct symbol *) 0;
-
- /* Get the hash index and check all the symbols
- under that hash index. */
-
- hash = hashname (namestring);
-
- for (sym = global_sym_chain[hash]; sym;)
- {
- if (*namestring == SYMBOL_NAME (sym)[0]
- && !strcmp(namestring + 1, SYMBOL_NAME (sym) + 1))
- {
- /* Splice this symbol out of the hash chain and
- assign the value we have to it. */
- if (prev)
- SYMBOL_VALUE (prev) = SYMBOL_VALUE (sym);
- else
- global_sym_chain[hash]
- = (struct symbol *) SYMBOL_VALUE (sym);
-
- /* Check to see whether we need to fix up a common block. */
- /* Note: this code might be executed several times for
- the same symbol if there are multiple references. */
- if (SYMBOL_CLASS (sym) == LOC_BLOCK)
- fix_common_block (sym, misc_function_vector[mf].address);
- else
- SYMBOL_VALUE (sym) = misc_function_vector[mf].address;
-
- if (prev)
- sym = (struct symbol *) SYMBOL_VALUE (prev);
- else
- sym = global_sym_chain[hash];
- }
- else
- {
- prev = sym;
- sym = (struct symbol *) SYMBOL_VALUE (sym);
- }
- }
- }
-}
-
-/*
- * Read in a defined section of a specific object file's symbols.
- *
- * DESC is the file descriptor for the file, positioned at the
- * beginning of the symtab
- * STRINGTAB is a pointer to the files string
- * table, already read in
- * SYM_OFFSET is the offset within the file of
- * the beginning of the symbols we want to read, NUM_SUMBOLS is the
- * number of symbols to read
- * TEXT_OFFSET is the offset to be added to
- * all values of symbols coming in and
- * TEXT_SIZE is the size of the text segment read in.
- * OFFSET is a flag which indicates that the value of all of the
- * symbols should be offset by TEXT_OFFSET (for the purposes of
- * incremental linking).
- */
-
-static void
-read_ofile_symtab (desc, stringtab, stringtab_size, sym_offset,
- sym_size, text_offset, text_size, offset)
- int desc;
- register char *stringtab;
- int sym_offset;
- int sym_size;
- int text_offset;
- int text_size;
- int offset;
-{
- register char *namestring;
- register struct symbol *sym, *prev;
- int hash;
- struct cleanup *old_chain;
- struct nlist *bufp;
- unsigned char type;
-#ifdef N_BINCL
- subfile_stack = 0;
-#endif
-
- stringtab_global = stringtab;
- last_source_file = 0;
-
- symtab_input_desc = desc;
- symbuf_end = symbuf_idx = 0;
-
- /* It is necessary to actually read one symbol *before* the start
- of this symtab's symbols, because the GCC_COMPILED_FLAG_SYMBOL
- occurs before the N_SO symbol.
-
- Detecting this in read_dbx_symtab
- would slow down initial readin, so we look for it here instead. */
- if (sym_offset >= sizeof (struct nlist))
- {
- lseek (desc, sym_offset - sizeof (struct nlist), L_INCR);
- fill_symbuf ();
- bufp = &symbuf[symbuf_idx++];
-
- if (bufp->n_un.n_strx < 0 || bufp->n_un.n_strx >= stringtab_size)
- error ("Invalid symbol data: bad string table offset: %d",
- bufp->n_un.n_strx);
- namestring = bufp->n_un.n_strx + stringtab;
-
- processing_gcc_compilation =
- (bufp->n_type == N_TEXT
- && !strcmp (namestring, GCC_COMPILED_FLAG_SYMBOL));
- }
- else
- {
- /* The N_SO starting this symtab is the first symbol, so we
- better not check the symbol before it. I'm not this can
- happen, but it doesn't hurt to check for it. */
- lseek(desc, sym_offset, L_INCR);
- processing_gcc_compilation = 0;
- }
-
- if (symbuf_idx == symbuf_end)
- fill_symbuf();
- bufp = &symbuf[symbuf_idx];
- if ((unsigned char) bufp->n_type != N_SO)
- fatal("First symbol in segment of executable not a source symbol");
-
- for (symnum = 0;
- symnum < sym_size / sizeof(struct nlist);
- symnum++)
- {
- QUIT; /* Allow this to be interruptable */
- if (symbuf_idx == symbuf_end)
- fill_symbuf();
- bufp = &symbuf[symbuf_idx++];
- type = bufp->n_type;
-
- if (offset &&
- (type == N_TEXT || type == N_DATA || type == N_BSS))
- bufp->n_value += text_offset;
-
- if (bufp->n_un.n_strx < 0 || bufp->n_un.n_strx >= stringtab_size)
- error ("Invalid symbol data: bad string table offset: %d",
- bufp->n_un.n_strx);
- namestring = bufp->n_un.n_strx + stringtab;
-
- if (type & N_STAB)
- process_one_symbol(type, bufp->n_desc,
- bufp->n_value, namestring);
- /* We skip checking for a new .o or -l file; that should never
- happen in this routine. */
- else if (type == N_TEXT
- && !strcmp (namestring, GCC_COMPILED_FLAG_SYMBOL))
- /* I don't think this code will ever be executed, because
- the GCC_COMPILED_FLAG_SYMBOL usually is right before
- the N_SO symbol which starts this source file.
- However, there is no reason not to accept
- the GCC_COMPILED_FLAG_SYMBOL anywhere. */
- processing_gcc_compilation = 1;
- else if (type & N_EXT || type == N_TEXT
-#ifdef N_NBTEXT
- || type == N_NBTEXT
-#endif
- )
- /* Global symbol: see if we came across a dbx defintion for
- a corresponding symbol. If so, store the value. Remove
- syms from the chain when their values are stored, but
- search the whole chain, as there may be several syms from
- different files with the same name. */
- /* This is probably not true. Since the files will be read
- in one at a time, each reference to a global symbol will
- be satisfied in each file as it appears. So we skip this
- section. */
- &stringtab_global; /* For debugger; am I right? */
- }
- end_symtab (text_offset + text_size);
-}
-
-static int
-hashname (name)
- char *name;
-{
- register char *p = name;
- register int total = p[0];
- register int c;
-
- c = p[1];
- total += c << 2;
- if (c)
- {
- c = p[2];
- total += c << 4;
- if (c)
- total += p[3] << 6;
- }
-
- /* Ensure result is positive. */
- if (total < 0) total += (1000 << 6);
- return total % HASHSIZE;
-}
-
-/* Put all appropriate global symbols in the symseg data
- onto the hash chains so that their addresses will be stored
- when seen later in loader global symbols. */
-
-static void
-hash_symsegs ()
-{
- /* Look at each symbol in each block in each symseg symtab. */
- struct symtab *s;
- for (s = symseg_chain; s; s = s->next)
- {
- register int n;
- for (n = BLOCKVECTOR_NBLOCKS (BLOCKVECTOR (s)) - 1; n >= 0; n--)
- {
- register struct block *b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), n);
- register int i;
- for (i = BLOCK_NSYMS (b) - 1; i >= 0; i--)
- {
- register struct symbol *sym = BLOCK_SYM (b, i);
-
- /* Put the symbol on a chain if its value is an address
- that is figured out by the loader. */
-
- if (SYMBOL_CLASS (sym) == LOC_EXTERNAL)
- {
- register int hash = hashname (SYMBOL_NAME (sym));
- SYMBOL_VALUE (sym) = (int) global_sym_chain[hash];
- global_sym_chain[hash] = sym;
- SYMBOL_CLASS (sym) = LOC_STATIC;
- }
- }
- }
- }
-}
-
-static void
-process_one_symbol (type, desc, value, name)
- int type, desc;
- CORE_ADDR value;
- char *name;
-{
- register struct context_stack *new;
- char *colon_pos;
-
- /* Something is wrong if we see real data before
- seeing a source file name. */
-
- if (last_source_file == 0 && type != N_SO)
- {
- /* Currently this ignores N_ENTRY on Gould machines, N_NSYM on machines
- where that code is defined. */
- if (IGNORE_SYMBOL (type))
- return;
-
- error ("Invalid symbol data: does not start by identifying a source file.");
- }
-
- switch (type)
- {
- case N_FUN:
- case N_FNAME:
- /* Either of these types of symbols indicates the start of
- a new function. We must process its "name" normally for dbx,
- but also record the start of a new lexical context, and possibly
- also the end of the lexical context for the previous function. */
- /* This is not always true. This type of symbol may indicate a
- text segment variable. */
-
- colon_pos = index (name, ':');
- if (!colon_pos++
- || (*colon_pos != 'f' && *colon_pos != 'F'))
- {
- define_symbol (value, name, desc);
- break;
- }
-
- within_function = 1;
- if (context_stack_depth > 0)
- {
- new = &context_stack[--context_stack_depth];
- /* Make a block for the local symbols within. */
- finish_block (new->name, &local_symbols, new->old_blocks,
- new->start_addr, value);
- }
- /* Stack must be empty now. */
- if (context_stack_depth != 0)
- error ("Invalid symbol data: unmatched N_LBRAC before symtab pos %d.",
- symnum);
-
- new = &context_stack[context_stack_depth++];
- new->old_blocks = pending_blocks;
- new->start_addr = value;
- new->name = define_symbol (value, name, desc);
- local_symbols = 0;
- break;
-
- case N_LBRAC:
- /* This "symbol" just indicates the start of an inner lexical
- context within a function. */
-
- if (context_stack_depth == context_stack_size)
- {
- context_stack_size *= 2;
- context_stack = (struct context_stack *)
- xrealloc (context_stack,
- (context_stack_size
- * sizeof (struct context_stack)));
- }
-
- new = &context_stack[context_stack_depth++];
- new->depth = desc;
- new->locals = local_symbols;
- new->old_blocks = pending_blocks;
- new->start_addr = value;
- new->name = 0;
- local_symbols = 0;
- break;
-
- case N_RBRAC:
- /* This "symbol" just indicates the end of an inner lexical
- context that was started with N_LBRAC. */
- new = &context_stack[--context_stack_depth];
- if (desc != new->depth)
- error ("Invalid symbol data: N_LBRAC/N_RBRAC symbol mismatch, symtab pos %d.", symnum);
-
- /* Some native compilers put the variable decls inside of an
- LBRAC/RBRAC block. This macro should be nonzero if this
- is true. DESC is N_DESC from the N_RBRAC symbol. */
-#if !defined (VARIABLES_INSIDE_BLOCK)
-#define VARIABLES_INSIDE_BLOCK(desc) 0
-#endif
-
- /* Can only use new->locals as local symbols here if we're in
- gcc or on a machine that puts them before the lbrack. */
- if (!VARIABLES_INSIDE_BLOCK(desc))
- local_symbols = new->locals;
-
- /* If this is not the outermost LBRAC...RBRAC pair in the
- function, its local symbols preceded it, and are the ones
- just recovered from the context stack. Defined the block for them.
-
- If this is the outermost LBRAC...RBRAC pair, there is no
- need to do anything; leave the symbols that preceded it
- to be attached to the function's own block. However, if
- it is so, we need to indicate that we just moved outside
- of the function. */
- if (local_symbols
- && context_stack_depth > !VARIABLES_INSIDE_BLOCK(desc))
- {
- /* Muzzle a compiler bug that makes end < start. */
- if (new->start_addr > value)
- new->start_addr = value;
- /* Make a block for the local symbols within. */
- finish_block (0, &local_symbols, new->old_blocks,
- new->start_addr + last_source_start_addr,
- value + last_source_start_addr);
- }
- else
- {
- within_function = 0;
- }
- if (VARIABLES_INSIDE_BLOCK(desc))
- /* Now pop locals of block just finished. */
- local_symbols = new->locals;
- break;
-
- case N_FN | N_EXT:
- /* This kind of symbol supposedly indicates the start
- of an object file. In fact this type does not appear. */
- break;
-
- case N_SO:
- /* This type of symbol indicates the start of data
- for one source file.
- Finish the symbol table of the previous source file
- (if any) and start accumulating a new symbol table. */
-#ifdef PCC_SOL_BROKEN
- /* pcc bug, occasionally puts out SO for SOL. */
- if (context_stack_depth > 0)
- {
- start_subfile (name);
- break;
- }
-#endif
- if (last_source_file)
- end_symtab (value);
- start_symtab (name, value);
- break;
-
- case N_SOL:
- /* This type of symbol indicates the start of data for
- a sub-source-file, one whose contents were copied or
- included in the compilation of the main source file
- (whose name was given in the N_SO symbol.) */
- start_subfile (name);
- break;
-
-#ifdef N_BINCL
- case N_BINCL:
- push_subfile ();
- add_new_header_file (name, value);
- start_subfile (name);
- break;
-
- case N_EINCL:
- start_subfile (pop_subfile ());
- break;
-
- case N_EXCL:
- add_old_header_file (name, value);
- break;
-#endif /* have N_BINCL */
-
- case N_SLINE:
- /* This type of "symbol" really just records
- one line-number -- core-address correspondence.
- Enter it in the line list for this symbol table. */
- record_line (desc, value);
- break;
-
- case N_BCOMM:
- if (common_block)
- error ("Invalid symbol data: common within common at symtab pos %d",
- symnum);
- common_block = local_symbols;
- common_block_i = local_symbols ? local_symbols->nsyms : 0;
- break;
-
- case N_ECOMM:
- /* Symbols declared since the BCOMM are to have the common block
- start address added in when we know it. common_block points to
- the first symbol after the BCOMM in the local_symbols list;
- copy the list and hang it off the symbol for the common block name
- for later fixup. */
- {
- int i;
- struct pending *link = local_symbols;
- struct symbol *sym =
- (struct symbol *) xmalloc (sizeof (struct symbol));
- bzero (sym, sizeof *sym);
- SYMBOL_NAME (sym) = savestring (name, strlen (name));
- SYMBOL_CLASS (sym) = LOC_BLOCK;
- SYMBOL_NAMESPACE (sym) = (enum namespace)((long)
- copy_pending (local_symbols, common_block_i, common_block));
- i = hashname (SYMBOL_NAME (sym));
- SYMBOL_VALUE (sym) = (int) global_sym_chain[i];
- global_sym_chain[i] = sym;
- common_block = 0;
- break;
- }
-
- case N_ECOML:
- case N_LENG:
- break;
-
- default:
- if (name)
- define_symbol (value, name, desc);
- }
-}
-
-/* This function was added for C++ functionality. I presume that it
- condenses the bunches formed by reading in an additional .o file
- (incremental linking). */
-
-static void
-condense_addl_misc_bunches ()
-{
- register int i, j;
- register struct misc_bunch *bunch;
-#ifdef NAMES_HAVE_UNDERSCORE
- int offset = 1;
-#else
- int offset = 0;
-#endif
-
- misc_function_vector
- = (struct misc_function *) xrealloc (misc_function_vector,
- (misc_count + misc_function_count) * sizeof (struct misc_function));
-
- j = misc_function_count;
- bunch = misc_bunch;
- while (bunch)
- {
- for (i = 0; i < misc_bunch_index; i++)
- {
- misc_function_vector[j] = bunch->contents[i];
- misc_function_vector[j].name
- = concat (misc_function_vector[j].name
- + (misc_function_vector[j].name[0] == '_' ? offset : 0),
- "", "");
- j++;
- }
- bunch = bunch->next;
- misc_bunch_index = MISC_BUNCH_SIZE;
- }
-
- misc_function_count += misc_count;
-
- /* Sort the misc functions by address. */
-
- qsort (misc_function_vector, misc_function_count,
- sizeof (struct misc_function), compare_misc_functions);
-}
-
-
-/* Read in another .o file and create a symtab entry for it.*/
-
-static void
-read_addl_syms (desc, stringtab, nlistlen, text_addr, text_size)
- int desc;
- register char *stringtab;
- register int nlistlen;
- unsigned text_addr;
- int text_size;
-{
- FILE *stream = fdopen (desc, "r");
- register char *namestring;
- register struct symbol *sym, *prev;
- int hash;
-
-#ifdef N_BINCL
- subfile_stack = 0;
-#endif
-
- last_source_file = 0;
- bzero (global_sym_chain, sizeof global_sym_chain);
- symtab_input_desc = desc;
- stringtab_global = stringtab;
- fill_symbuf ();
-
- for (symnum = 0; symnum < nlistlen; symnum++)
- {
- struct nlist *bufp;
- unsigned char type;
-
- QUIT; /* allow this to be interruptable */
- if (symbuf_idx == symbuf_end)
- fill_symbuf ();
- bufp = &symbuf[symbuf_idx++];
- type = bufp->n_type & N_TYPE;
- namestring = bufp->n_un.n_strx + stringtab;
-
- if( (type == N_TEXT) || (type == N_DATA) || (type == N_BSS) )
- {
- /* Relocate this file's symbol table information
- to the address it has been loaded into. */
- bufp->n_value += text_addr;
- }
-
- type = bufp->n_type;
-
- if (type & N_STAB)
- process_one_symbol (type, bufp->n_desc,
- bufp->n_value, namestring);
- /* A static text symbol whose name ends in ".o"
- can only mean the start of another object file.
- So end the symtab of the source file we have been processing.
- This is how we avoid counting the libraries as part
- or the last source file.
- Also this way we find end of first object file (crt0). */
- else if ((type == N_TEXT
-#ifdef N_NBTEXT
- || type == N_NBTEXT
-#endif
- )
- && (!strcmp (namestring + strlen (namestring) - 2, ".o"))
- || ! strncmp (namestring, "-l", 2))
- {
- if (last_source_file)
- end_symtab (bufp->n_value);
- }
- else if (type & N_EXT || type == N_TEXT
-#ifdef N_NBTEXT
- || type == N_NBTEXT
-#endif
- )
- {
- int used_up = 0;
-
- /* Record the location of _etext. */
- if (type == (N_TEXT | N_EXT)
- && !strcmp (namestring, "_etext"))
- end_of_text_addr = bufp->n_value;
-
-#if 0
- /* 25 Sep 89: The following seems to be stolen from
- read_ofile_symtab, and is wrong here (i.e. there was no
- first pass for add-file symbols). */
- /* This shouldn't be necessary, as we now do all of this work
- in scan_global syms and all misc functions should have been
- recorded on the first pass. */
- /* Global symbol: see if we came across a dbx definition
- for a corresponding symbol. If so, store the value.
- Remove syms from the chain when their values are stored,
- but search the whole chain, as there may be several syms
- from different files with the same name. */
- if (type & N_EXT)
- {
- prev = 0;
-#ifdef NAMES_HAVE_UNDERSCORE
- hash = hashname (namestring + 1);
-#else /* not NAMES_HAVE_UNDERSCORE */
- hash = hashname (namestring);
-#endif /* not NAMES_HAVE_UNDERSCORE */
- for (sym = global_sym_chain[hash];
- sym;)
- {
- if (
-#ifdef NAMES_HAVE_UNDERSCORE
- *namestring == '_'
- && namestring[1] == SYMBOL_NAME (sym)[0]
- &&
- !strcmp (namestring + 2, SYMBOL_NAME (sym) + 1)
-#else /* NAMES_HAVE_UNDERSCORE */
- namestring[0] == SYMBOL_NAME (sym)[0]
- &&
- !strcmp (namestring + 1, SYMBOL_NAME (sym) + 1)
-#endif /* NAMES_HAVE_UNDERSCORE */
- )
- {
- if (prev)
- SYMBOL_VALUE (prev) = SYMBOL_VALUE (sym);
- else
- global_sym_chain[hash]
- = (struct symbol *) SYMBOL_VALUE (sym);
- if (SYMBOL_CLASS (sym) == LOC_BLOCK)
- fix_common_block (sym, bufp->n_value);
- else
- SYMBOL_VALUE (sym) = bufp->n_value;
- if (prev)
- sym = (struct symbol *) SYMBOL_VALUE (prev);
- else
- sym = global_sym_chain[hash];
-
- used_up = 1;
- }
- else
- {
- prev = sym;
- sym = (struct symbol *) SYMBOL_VALUE (sym);
- }
- }
- }
-
- /* Defined global or text symbol: record as a misc function
- if it didn't give its address to a debugger symbol above. */
- if (type <= (N_TYPE | N_EXT)
- && type != N_EXT
- && ! used_up)
- record_misc_function (namestring, bufp->n_value,
- bufp->n_type);
-#endif /* 0 */
- }
- }
-
- if (last_source_file)
- end_symtab (text_addr + text_size);
-
- fclose (stream);
-}
-
-/* C++:
- This function allows the addition of incrementally linked object files.
- Since this has a fair amount of code in common with symbol_file_command,
- it might be worthwhile to consolidate things, as was done with
- read_dbx_symtab and condense_misc_bunches. */
-
-void
-add_file_command (arg_string)
- char* arg_string;
-{
- register int desc;
- DECLARE_FILE_HEADERS;
- struct nlist *nlist;
- char *stringtab;
- long buffer;
- register int val;
- extern void close ();
- struct cleanup *old_chain;
- struct symtab *symseg;
- struct stat statbuf;
- char *name;
- unsigned text_addr;
-
- if (arg_string == 0)
- error ("add-file takes a file name and an address");
-
- arg_string = tilde_expand (arg_string);
- make_cleanup (free, arg_string);
-
- for( ; *arg_string == ' '; arg_string++ );
- name = arg_string;
- for( ; *arg_string && *arg_string != ' ' ; arg_string++ );
- *arg_string++ = (char) 0;
-
- if (name[0] == 0)
- error ("add-file takes a file name and an address");
-
- text_addr = parse_and_eval_address (arg_string);
-
- dont_repeat ();
-
- if (!query ("add symbol table from filename \"%s\" at text_addr = 0x%x\n",
- name, text_addr))
- error ("Not confirmed.");
-
- desc = open (name, O_RDONLY);
- if (desc < 0)
- perror_with_name (name);
-
- old_chain = make_cleanup (close, desc);
-
- READ_FILE_HEADERS (desc, name);
-
- if (NUMBER_OF_SYMBOLS == 0)
- {
- printf ("%s does not have a symbol-table.\n", name);
- fflush (stdout);
- return;
- }
-
- printf ("Reading symbol data from %s...", name);
- fflush (stdout);
-
- /* Now read the string table, all at once. */
- val = lseek (desc, STRING_TABLE_OFFSET, 0);
- if (val < 0)
- perror_with_name (name);
- if (stat (name, &statbuf) < 0)
- perror_with_name (name);
- READ_STRING_TABLE_SIZE (buffer);
- if (buffer >= 0 && buffer < statbuf.st_size)
- {
-#ifdef BROKEN_LARGE_ALLOCA
- stringtab = (char *) xmalloc (buffer);
- make_cleanup (free, stringtab);
-#else
- stringtab = (char *) alloca (buffer);
-#endif
- }
- else
- stringtab = NULL;
- if (stringtab == NULL)
- error ("ridiculous string table size: %d bytes", buffer);
-
- /* Usually READ_STRING_TABLE_SIZE will have shifted the file pointer.
- Occaisionally, it won't. */
- val = lseek (desc, STRING_TABLE_OFFSET, 0);
- if (val < 0)
- perror_with_name (name);
- val = myread (desc, stringtab, buffer);
- if (val < 0)
- perror_with_name (name);
-
- /* Symsegs are no longer supported by GDB. Setting symseg_chain to
- 0 is easier than finding all the symseg code and eliminating it. */
- symseg_chain = 0;
-
- /* Position to read the symbol table. Do not read it all at once. */
- val = lseek (desc, SYMBOL_TABLE_OFFSET, 0);
- if (val < 0)
- perror_with_name (name);
-
- init_misc_functions ();
- make_cleanup (discard_misc_bunches, 0);
- init_header_files ();
- make_cleanup (free_header_files, 0);
- free_pendings = 0;
- pending_blocks = 0;
- file_symbols = 0;
- global_symbols = 0;
- make_cleanup (really_free_pendings, 0);
-
- read_addl_syms (desc, stringtab, NUMBER_OF_SYMBOLS, text_addr,
- SIZE_OF_TEXT_SEGMENT);
-
-
- /* Sort symbols alphabetically within each block. */
-
- sort_syms ();
-
- /* Go over the misc functions and install them in vector. */
-
- condense_addl_misc_bunches (1);
-
- /* Don't allow char * to have a typename (else would get caddr_t.) */
-
- TYPE_NAME (lookup_pointer_type (builtin_type_char)) = 0;
-
- do_cleanups (old_chain);
-
- /* Free the symtabs made by read_symsegs, but not their contents,
- which have been copied into symtabs on symtab_list. */
- while (symseg_chain)
- {
- register struct symtab *s = symseg_chain->next;
- free (symseg_chain);
- symseg_chain = s;
- }
-
- printf ("done.\n");
- fflush (stdout);
-}
-
-/* Read a number by which a type is referred to in dbx data,
- or perhaps read a pair (FILENUM, TYPENUM) in parentheses.
- Just a single number N is equivalent to (0,N).
- Return the two numbers by storing them in the vector TYPENUMS.
- TYPENUMS will then be used as an argument to dbx_lookup_type. */
-
-static void
-read_type_number (pp, typenums)
- register char **pp;
- register int *typenums;
-{
- if (**pp == '(')
- {
- (*pp)++;
- typenums[0] = read_number (pp, ',');
- typenums[1] = read_number (pp, ')');
- }
- else
- {
- typenums[0] = 0;
- typenums[1] = read_number (pp, 0);
- }
-}
-
-
-
-static struct symbol *
-define_symbol (value, string, desc)
- int value;
- char *string;
- int desc;
-{
- register struct symbol *sym
- = (struct symbol *) obstack_alloc (symbol_obstack, sizeof (struct symbol));
- char *p = (char *) index (string, ':');
- int deftype;
- register int i;
-
- /* Ignore syms with empty names. */
- if (string[0] == 0)
- return 0;
-
- /* Ignore old-style symbols from cc -go */
- if (p == 0)
- return 0;
-
- SYMBOL_NAME (sym)
- = (char *) obstack_alloc (symbol_obstack, ((p - string) + 1));
- /* Open-coded bcopy--saves function call time. */
- {
- register char *p1 = string;
- register char *p2 = SYMBOL_NAME (sym);
- while (p1 != p)
- *p2++ = *p1++;
- *p2++ = '\0';
- }
- p++;
- /* Determine the type of name being defined. */
- if ((*p >= '0' && *p <= '9') || *p == '(')
- deftype = 'l';
- else
- deftype = *p++;
-
- /* c is a special case, not followed by a type-number.
- SYMBOL:c=iVALUE for an integer constant symbol.
- SYMBOL:c=rVALUE for a floating constant symbol.
- SYMBOL:c=eTYPE,INTVALUE for an enum constant symbol.
- e.g. "b:c=e6,0" for "const b = blob1"
- (where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;"). */
- if (deftype == 'c')
- {
- if (*p++ != '=')
- error ("Invalid symbol data at symtab pos %d.", symnum);
- switch (*p++)
- {
- case 'r':
- {
- double d = atof (p);
- char *value;
-
- SYMBOL_TYPE (sym) = builtin_type_double;
- value = (char *) obstack_alloc (symbol_obstack, sizeof (double));
- bcopy (&d, value, sizeof (double));
- SYMBOL_VALUE_BYTES (sym) = value;
- SYMBOL_CLASS (sym) = LOC_CONST_BYTES;
- }
- break;
- case 'i':
- {
- SYMBOL_TYPE (sym) = builtin_type_int;
- SYMBOL_VALUE (sym) = atoi (p);
- SYMBOL_CLASS (sym) = LOC_CONST;
- }
- break;
- case 'e':
- /* SYMBOL:c=eTYPE,INTVALUE for an enum constant symbol.
- e.g. "b:c=e6,0" for "const b = blob1"
- (where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;"). */
- {
- int typenums[2];
-
- read_type_number (&p, typenums);
- if (*p++ != ',')
- error ("Invalid symbol data: no comma in enum const symbol");
-
- SYMBOL_TYPE (sym) = *dbx_lookup_type (typenums);
- SYMBOL_VALUE (sym) = atoi (p);
- SYMBOL_CLASS (sym) = LOC_CONST;
- }
- break;
- default:
- error ("Invalid symbol data at symtab pos %d.", symnum);
- }
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
- add_symbol_to_list (sym, &file_symbols);
- return sym;
- }
-
- /* Now usually comes a number that says which data type,
- and possibly more stuff to define the type
- (all of which is handled by read_type) */
-
- if (deftype == 'p' && *p == 'F')
- /* pF is a two-letter code that means a function parameter in Fortran.
- The type-number specifies the type of the return value.
- Translate it into a pointer-to-function type. */
- {
- p++;
- SYMBOL_TYPE (sym)
- = lookup_pointer_type (lookup_function_type (read_type (&p)));
- }
- else
- {
- struct type *type = read_type (&p);
-
- if ((deftype == 'F' || deftype == 'f')
- && TYPE_CODE (type) != TYPE_CODE_FUNC)
- SYMBOL_TYPE (sym) = lookup_function_type (type);
- else
- SYMBOL_TYPE (sym) = type;
- }
-
- switch (deftype)
- {
- case 'f':
- SYMBOL_CLASS (sym) = LOC_BLOCK;
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
- add_symbol_to_list (sym, &file_symbols);
- break;
-
- case 'F':
- SYMBOL_CLASS (sym) = LOC_BLOCK;
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
- add_symbol_to_list (sym, &global_symbols);
- break;
-
- case 'G':
- /* For a class G (global) symbol, it appears that the
- value is not correct. It is necessary to search for the
- corresponding linker definition to find the value.
- These definitions appear at the end of the namelist. */
- i = hashname (SYMBOL_NAME (sym));
- SYMBOL_VALUE (sym) = (int) global_sym_chain[i];
- global_sym_chain[i] = sym;
- SYMBOL_CLASS (sym) = LOC_STATIC;
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
- add_symbol_to_list (sym, &global_symbols);
- break;
-
- /* This case is faked by a conditional above,
- when there is no code letter in the dbx data.
- Dbx data never actually contains 'l'. */
- case 'l':
- SYMBOL_CLASS (sym) = LOC_LOCAL;
- SYMBOL_VALUE (sym) = value;
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
- add_symbol_to_list (sym, &local_symbols);
- break;
-
- case 'p':
- SYMBOL_CLASS (sym) = LOC_ARG;
- SYMBOL_VALUE (sym) = value;
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
- add_symbol_to_list (sym, &local_symbols);
-
- /* If it's gcc compiled, if it says `short', believe it. */
- if (processing_gcc_compilation || BELIEVE_PCC_PROMOTION)
- break;
-
-#if defined(BELIEVE_PCC_PROMOTION_TYPE)
- /* This macro is defined on machines (e.g. sparc) where
- we should believe the type of a PCC 'short' argument,
- but shouldn't believe the address (the address is
- the address of the corresponding int). Note that
- this is only different from the BELIEVE_PCC_PROMOTION
- case on big-endian machines.
-
- My guess is that this correction, as opposed to changing
- the parameter to an 'int' (as done below, for PCC
- on most machines), is the right thing to do
- on all machines, but I don't want to risk breaking
- something that already works. On most PCC machines,
- the sparc problem doesn't come up because the calling
- function has to zero the top bytes (not knowing whether
- the called function wants an int or a short), so there
- is no practical difference between an int and a short
- (except perhaps what happens when the GDB user types
- "print short_arg = 0x10000;").
- Hacked for SunOS 4.1 by gnu@cygnus.com. In 4.1, the compiler
- actually produces the correct address (we don't need to fix it
- up). I made this code adapt so that it will offset the symbol
- if it was pointing at an int-aligned location and not
- otherwise. This way you can use the same gdb for 4.0.x and
- 4.1 systems. */
-
- if (0 == SYMBOL_VALUE (sym) % sizeof (int))
- {
- if (SYMBOL_TYPE (sym) == builtin_type_char
- || SYMBOL_TYPE (sym) == builtin_type_unsigned_char)
- SYMBOL_VALUE (sym) += 3;
- else if (SYMBOL_TYPE (sym) == builtin_type_short
- || SYMBOL_TYPE (sym) == builtin_type_unsigned_short)
- SYMBOL_VALUE (sym) += 2;
- }
- break;
-
-#else /* no BELIEVE_PCC_PROMOTION_TYPE. */
-
- /* If PCC says a parameter is a short or a char,
- it is really an int. */
- if (SYMBOL_TYPE (sym) == builtin_type_char
- || SYMBOL_TYPE (sym) == builtin_type_short)
- SYMBOL_TYPE (sym) = builtin_type_int;
- else if (SYMBOL_TYPE (sym) == builtin_type_unsigned_char
- || SYMBOL_TYPE (sym) == builtin_type_unsigned_short)
- SYMBOL_TYPE (sym) = builtin_type_unsigned_int;
- break;
-
-#endif /* no BELIEVE_PCC_PROMOTION_TYPE. */
-
- case 'P':
- SYMBOL_CLASS (sym) = LOC_REGPARM;
- SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (value);
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
- add_symbol_to_list (sym, &local_symbols);
- break;
-
- case 'r':
-/* XXX */
-#ifdef sparc
-{
- struct symbol *s0;
-
- /*
- * If we see a parm decl immediately followed by a reg decl of
- * the same name (and in the same block), we change it to a single
- * instance of a reg parm. Sun's cc will generate these.
- */
- if (local_symbols &&
- (s0 = local_symbols->symbol[local_symbols->nsyms - 1]) &&
- SYMBOL_CLASS(s0) == LOC_ARG &&
- strcmp(SYMBOL_NAME(s0), SYMBOL_NAME(sym)) == 0) {
- SYMBOL_CLASS (s0) = LOC_REGPARM;
- SYMBOL_VALUE (s0) = STAB_REG_TO_REGNUM (value);
- SYMBOL_NAMESPACE (s0) = VAR_NAMESPACE;
- return s0;
- }
-}
-#endif
- SYMBOL_CLASS (sym) = LOC_REGISTER;
- SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (value);
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
- add_symbol_to_list (sym, &local_symbols);
- break;
-
- case 'S':
- /* Static symbol at top level of file */
- SYMBOL_CLASS (sym) = LOC_STATIC;
- SYMBOL_VALUE (sym) = value;
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
- add_symbol_to_list (sym, &file_symbols);
- break;
-
- case 't':
- SYMBOL_CLASS (sym) = LOC_TYPEDEF;
- SYMBOL_VALUE (sym) = value;
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
- if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0
- && (TYPE_FLAGS (SYMBOL_TYPE (sym)) & TYPE_FLAG_PERM) == 0)
- TYPE_NAME (SYMBOL_TYPE (sym)) =
- obsavestring (SYMBOL_NAME (sym),
- strlen (SYMBOL_NAME (sym)));
- /* C++ vagaries: we may have a type which is derived from
- a base type which did not have its name defined when the
- derived class was output. We fill in the derived class's
- base part member's name here in that case. */
- else if ((TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT
- || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION)
- && TYPE_N_BASECLASSES (SYMBOL_TYPE (sym)))
- {
- int i;
- for (i = TYPE_N_BASECLASSES (SYMBOL_TYPE (sym)); i > 0; i--)
- if (TYPE_FIELD_NAME (SYMBOL_TYPE (sym), i - 1) == 0)
- TYPE_FIELD_NAME (SYMBOL_TYPE (sym), i - 1) =
- TYPE_NAME (TYPE_BASECLASS (SYMBOL_TYPE (sym), i));
- }
-
- add_symbol_to_list (sym, &file_symbols);
- break;
-
- case 'T':
- SYMBOL_CLASS (sym) = LOC_TYPEDEF;
- SYMBOL_VALUE (sym) = value;
- SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
- if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0
- && (TYPE_FLAGS (SYMBOL_TYPE (sym)) & TYPE_FLAG_PERM) == 0)
- TYPE_NAME (SYMBOL_TYPE (sym))
- = obconcat ("",
- (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_ENUM
- ? "enum "
- : (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT
- ? "struct " : "union ")),
- SYMBOL_NAME (sym));
- add_symbol_to_list (sym, &file_symbols);
- break;
-
- case 'V':
- /* Static symbol of local scope */
- SYMBOL_CLASS (sym) = LOC_STATIC;
- SYMBOL_VALUE (sym) = value;
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
- add_symbol_to_list (sym, &local_symbols);
- break;
-
- case 'v':
- /* Reference parameter */
- SYMBOL_CLASS (sym) = LOC_REF_ARG;
- SYMBOL_VALUE (sym) = value;
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
- add_symbol_to_list (sym, &local_symbols);
- break;
-
- case 'X':
- /* This is used by Sun FORTRAN for "function result value".
- Sun claims ("dbx and dbxtool interfaces", 2nd ed)
- that Pascal uses it too, but when I tried it Pascal used
- "x:3" (local symbol) instead. */
- SYMBOL_CLASS (sym) = LOC_LOCAL;
- SYMBOL_VALUE (sym) = value;
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
- add_symbol_to_list (sym, &local_symbols);
- break;
-
- default:
- error ("Invalid symbol data: unknown symbol-type code `%c' at symtab pos %d.", deftype, symnum);
- }
- return sym;
-}
-
-/* What about types defined as forward references inside of a small lexical
- scope? */
-/* Add a type to the list of undefined types to be checked through
- once this file has been read in. */
-static void
-add_undefined_type (type)
- struct type *type;
-{
- if (undef_types_length == undef_types_allocated)
- {
- undef_types_allocated *= 2;
- undef_types = (struct type **)
- xrealloc (undef_types,
- undef_types_allocated * sizeof (struct type *));
- }
- undef_types[undef_types_length++] = type;
-}
-
-/* Add here something to go through each undefined type, see if it's
- still undefined, and do a full lookup if so. */
-static void
-cleanup_undefined_types ()
-{
- struct type **type, *ntype;
- struct symbol *sym;
-
- for (type = undef_types; type < undef_types + undef_types_length; type++)
- {
- struct type *ntype = 0;
- /* Reasonable test to see if it's been defined since. */
- if (TYPE_NFIELDS (*type) == 0)
- {
- struct pending *ppt;
- int i;
- /* Name of the type, without "struct" or "union" */
- char *typename = TYPE_NAME (*type);
-
- if (!strncmp (typename, "struct ", 7))
- typename += 7;
- if (!strncmp (typename, "union ", 6))
- typename += 6;
-
- for (ppt = file_symbols; ppt; ppt = ppt->next)
- for (i = 0; i < ppt->nsyms; i++)
- {
- struct symbol *sym = ppt->symbol[i];
-
- if (SYMBOL_CLASS (sym) == LOC_TYPEDEF
- && SYMBOL_NAMESPACE (sym) == STRUCT_NAMESPACE
- && (TYPE_CODE (SYMBOL_TYPE (sym)) ==
- TYPE_CODE (*type))
- && !strcmp (SYMBOL_NAME (sym), typename))
- bcopy (SYMBOL_TYPE (sym), *type, sizeof (struct type));
- }
- }
- else
- /* It has been defined; don't mark it as a stub. */
- TYPE_FLAGS (*type) &= ~TYPE_FLAG_STUB;
- }
- undef_types_length = 0;
-}
-
-
-
-/* Read a dbx type reference or definition;
- return the type that is meant.
- This can be just a number, in which case it references
- a type already defined and placed in type_vector.
- Or the number can be followed by an =, in which case
- it means to define a new type according to the text that
- follows the =. */
-
-static
-struct type *
-read_type (pp)
- register char **pp;
-{
- register struct type *type = 0;
- register int n;
- struct type *type1;
- int typenums[2];
- int xtypenums[2];
- char *tmpc;
-
- /* Read type number if present. The type number may be omitted.
- for instance in a two-dimensional array declared with type
- "ar1;1;10;ar1;1;10;4". */
- if ((**pp >= '0' && **pp <= '9')
- || **pp == '(')
- {
- read_type_number (pp, typenums);
-
- /* Detect random reference to type not yet defined.
- Allocate a type object but leave it zeroed. */
- if (**pp != '=')
- return dbx_alloc_type (typenums);
-
- *pp += 2;
- }
- else
- {
- /* 'typenums=' not present, type is anonymous. Read and return
- the definition, but don't put it in the type vector. */
- typenums[0] = typenums[1] = -1;
- *pp += 1;
- }
-
- switch ((*pp)[-1])
- {
- case 'x':
- {
- enum type_code code;
-
- /* Used to index through file_symbols. */
- struct pending *ppt;
- int i;
-
- /* Name including "struct", etc. */
- char *type_name;
-
- /* Name without "struct", etc. */
- char *type_name_only;
-
- {
- char *prefix;
- char *from, *to;
-
- /* Set the type code according to the following letter. */
- switch ((*pp)[0])
- {
- case 's':
- code = TYPE_CODE_STRUCT;
- prefix = "struct ";
- break;
- case 'u':
- code = TYPE_CODE_UNION;
- prefix = "union ";
- break;
- case 'e':
- code = TYPE_CODE_ENUM;
- prefix = "enum ";
- break;
- default:
- error ("Bad type cross reference at symnum: %d.", symnum);
- }
-
- to = type_name = (char *)
- obstack_alloc (symbol_obstack,
- (strlen (prefix) +
- ((char *) index (*pp, ':') - (*pp)) + 1));
-
- /* Copy the prefix. */
- from = prefix;
- while (*to++ = *from++)
- ;
- to--;
-
- type_name_only = to;
-
- /* Copy the name. */
- from = *pp + 1;
- while ((*to++ = *from++) != ':')
- ;
- *--to = '\0';
-
- /* Set the pointer ahead of the name which we just read. */
- *pp = from;
-
-#if 0
- /* The following hack is clearly wrong, because it doesn't
- check whether we are in a baseclass. I tried to reproduce
- the case that it is trying to fix, but I couldn't get
- g++ to put out a cross reference to a basetype. Perhaps
- it doesn't do it anymore. */
- /* Note: for C++, the cross reference may be to a base type which
- has not yet been seen. In this case, we skip to the comma,
- which will mark the end of the base class name. (The ':'
- at the end of the base class name will be skipped as well.)
- But sometimes (ie. when the cross ref is the last thing on
- the line) there will be no ','. */
- from = (char *) index (*pp, ',');
- if (from)
- *pp = from;
-#endif /* 0 */
- }
-
- /* Now check to see whether the type has already been declared. */
- /* This is necessary at least in the case where the
- program says something like
- struct foo bar[5];
- The compiler puts out a cross-reference; we better find
- set the length of the structure correctly so we can
- set the length of the array. */
- for (ppt = file_symbols; ppt; ppt = ppt->next)
- for (i = 0; i < ppt->nsyms; i++)
- {
- struct symbol *sym = ppt->symbol[i];
-
- if (SYMBOL_CLASS (sym) == LOC_TYPEDEF
- && SYMBOL_NAMESPACE (sym) == STRUCT_NAMESPACE
- && (TYPE_CODE (SYMBOL_TYPE (sym)) == code)
- && !strcmp (SYMBOL_NAME (sym), type_name_only))
- {
- obstack_free (symbol_obstack, type_name);
- type = SYMBOL_TYPE (sym);
- return type;
- }
- }
-
- /* Didn't find the type to which this refers, so we must
- be dealing with a forward reference. Allocate a type
- structure for it, and keep track of it so we can
- fill in the rest of the fields when we get the full
- type. */
- type = dbx_alloc_type (typenums);
- TYPE_CODE (type) = code;
- TYPE_NAME (type) = type_name;
-
- TYPE_FLAGS (type) |= TYPE_FLAG_STUB;
-
- add_undefined_type (type);
- return type;
- }
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case '(':
- (*pp)--;
- read_type_number (pp, xtypenums);
- type = *dbx_lookup_type (xtypenums);
- if (type == 0)
- type = builtin_type_void;
- if (typenums[0] != -1)
- *dbx_lookup_type (typenums) = type;
- break;
-
- case '*':
- type1 = read_type (pp);
- if (TYPE_POINTER_TYPE (type1))
- {
- type = TYPE_POINTER_TYPE (type1);
- if (typenums[0] != -1)
- *dbx_lookup_type (typenums) = type;
- }
- else
- {
- type = dbx_alloc_type (typenums);
- smash_to_pointer_type (type, type1);
- }
- break;
-
- case '@':
- {
- struct type *domain = read_type (pp);
- char c;
- struct type *memtype;
-
- if (*(*pp)++ != ',')
- error ("invalid member type data format, at symtab pos %d.",
- symnum);
-
- memtype = read_type (pp);
- type = dbx_alloc_type (typenums);
- smash_to_member_type (type, domain, memtype);
- }
- break;
-
- case '#':
- {
- struct type *domain = read_type (pp);
- char c;
- struct type *return_type;
- struct type **args;
-
- if (*(*pp)++ != ',')
- error ("invalid member type data format, at symtab pos %d.",
- symnum);
-
- return_type = read_type (pp);
- args = read_args (pp, ';');
- type = dbx_alloc_type (typenums);
- smash_to_method_type (type, domain, return_type, args);
- }
- break;
-
- case '&':
- type1 = read_type (pp);
- if (TYPE_REFERENCE_TYPE (type1))
- {
- type = TYPE_REFERENCE_TYPE (type1);
- if (typenums[0] != -1)
- *dbx_lookup_type (typenums) = type;
- }
- else
- {
- type = dbx_alloc_type (typenums);
- smash_to_reference_type (type, type1);
- }
- break;
-
- case 'f':
- type1 = read_type (pp);
- if (TYPE_FUNCTION_TYPE (type1))
- {
- type = TYPE_FUNCTION_TYPE (type1);
- if (typenums[0] != -1)
- *dbx_lookup_type (typenums) = type;
- }
- else
- {
- type = dbx_alloc_type (typenums);
- smash_to_function_type (type, type1);
- }
- break;
-
- case 'r':
- type = read_range_type (pp, typenums);
- if (typenums[0] != -1)
- *dbx_lookup_type (typenums) = type;
- break;
-
- case 'e':
- type = dbx_alloc_type (typenums);
- type = read_enum_type (pp, type);
- *dbx_lookup_type (typenums) = type;
- break;
-
- case 's':
- type = dbx_alloc_type (typenums);
- type = read_struct_type (pp, type);
- break;
-
- case 'u':
- type = dbx_alloc_type (typenums);
- type = read_struct_type (pp, type);
- TYPE_CODE (type) = TYPE_CODE_UNION;
- break;
-
- case 'a':
- if (*(*pp)++ != 'r')
- error ("Invalid symbol data: unrecognized type-code `a%c' %s %d.",
- (*pp)[-1], "at symtab position", symnum);
-
- type = dbx_alloc_type (typenums);
- type = read_array_type (pp, type);
- break;
-
- default:
- error ("Invalid symbol data: unrecognized type-code `%c' at symtab pos %d.",
- (*pp)[-1], symnum);
- }
-
- if (type == 0)
- abort ();
-
-#if 0
- /* If this is an overriding temporary alteration for a header file's
- contents, and this type number is unknown in the global definition,
- put this type into the global definition at this type number. */
- if (header_file_prev_index >= 0)
- {
- register struct type **tp
- = explicit_lookup_type (header_file_prev_index, typenums[1]);
- if (*tp == 0)
- *tp = type;
- }
-#endif
- return type;
-}
-
-/* This page contains subroutines of read_type. */
-
-/* Read the description of a structure (or union type)
- and return an object describing the type. */
-
-static struct type *
-read_struct_type (pp, type)
- char **pp;
- register struct type *type;
-{
- struct nextfield
- {
- struct nextfield *next;
- int visibility;
- struct field field;
- };
-
- struct next_fnfield
- {
- struct next_fnfield *next;
- int visibility;
- struct fn_field fn_field;
- };
-
- struct next_fnfieldlist
- {
- struct next_fnfieldlist *next;
- struct fn_fieldlist fn_fieldlist;
- };
-
- register struct nextfield *list = 0;
- struct nextfield *new;
- int totalsize;
- char *name;
- register char *p;
- int nfields = 0;
- register int n;
-
- register struct next_fnfieldlist *mainlist = 0;
- int nfn_fields = 0;
- int read_possible_virtual_info = 0;
-
- if (TYPE_MAIN_VARIANT (type) == 0)
- {
- TYPE_MAIN_VARIANT (type) = type;
- }
-
- TYPE_CODE (type) = TYPE_CODE_STRUCT;
-
- /* First comes the total size in bytes. */
-
- TYPE_LENGTH (type) = read_number (pp, 0);
-
- /* C++: Now, if the class is a derived class, then the next character
- will be a '!', followed by the number of base classes derived from.
- Each element in the list contains visibility information,
- the offset of this base class in the derived structure,
- and then the base type. */
- if (**pp == '!')
- {
- int i, n_baseclasses, offset;
- struct type **baseclass_vec;
- struct type *baseclass;
- int via_public;
-
- /* Nonzero if it is a virtual baseclass, i.e.,
-
- struct A{};
- struct B{};
- struct C : public B, public virtual A {};
-
- B is a baseclass of C; A is a virtual baseclass for C. This is a C++
- 2.0 language feature. */
- int via_virtual;
-
- *pp += 1;
-
- n_baseclasses = read_number (pp, ',');
- baseclass_vec = (struct type **)
- obstack_alloc (symbol_obstack,
- (n_baseclasses) * sizeof (struct type **)) - 1;
-
- for (i = 1; i <= n_baseclasses; i++)
- {
- if (**pp == '\\')
- *pp = next_symbol_text ();
-
- switch (*(*pp)++)
- {
- case '0':
- via_virtual = 0;
- break;
- case '1':
- via_virtual = 1;
- break;
- default:
- error ("Invalid symbol data: bad visibility format at symtab pos %d",
- symnum);
- }
-
- switch (*(*pp)++)
- {
- case '0':
- via_public = 0;
- break;
- case '2':
- via_public = 1;
- break;
- default:
- error ("Invalid symbol data: bad visibility format at symtab pos %d.",
- symnum);
- }
-
- /* Offset of the portion of the object corresponding to
- this baseclass. Always zero in the absence of
- multiple inheritance. */
- offset = read_number (pp, ',');
- baseclass = read_type (pp);
- *pp += 1; /* skip trailing ';' */
-
- if (offset != 0)
- {
- static int error_printed = 0;
-
- if (!error_printed)
- {
- fprintf (stderr,
-"\nWarning: GDB has limited understanding of multiple inheritance...");
- error_printed = 1;
- }
- offset = 0;
- }
-
- baseclass_vec[i] = lookup_basetype_type (baseclass, offset, via_virtual, via_public);
-
- /* Since lookup_basetype_type can copy the type,
- it might copy a stub type (complete with stub flag).
- If so, we need to add it to the list of undefined types
- to clean up later. Even if lookup_basetype_type
- didn't copy the type, adding it to the undefined list
- will not do any harm. */
- if (TYPE_FLAGS(baseclass_vec[i]) & TYPE_FLAG_STUB)
- add_undefined_type (baseclass_vec[i]);
-
- /* Make this baseclass visible for structure-printing purposes. */
- new = (struct nextfield *) alloca (sizeof (struct nextfield));
- new->next = list;
- list = new;
- list->field.type = baseclass_vec[i];
- list->field.name = TYPE_NAME (baseclass_vec[i]);
- list->field.bitpos = offset;
- list->field.bitsize = 0; /* this should be an unpacked field! */
- nfields++;
- }
- TYPE_N_BASECLASSES (type) = n_baseclasses;
- TYPE_BASECLASSES (type) = baseclass_vec;
- }
-
- /* Now come the fields, as NAME:?TYPENUM,BITPOS,BITSIZE; for each one.
- At the end, we see a semicolon instead of a field.
-
- In C++, this may wind up being NAME:?TYPENUM:PHYSNAME; for
- a static field.
-
- The `?' is a placeholder for one of '+' (public visibility),
- '0' (protected visibility), and '-' (private visibility). */
-
- /* We better set p right now, in case there are no fields at all... */
- p = *pp;
-
- while (**pp != ';')
- {
- int visibility;
-
- /* Check for and handle cretinous dbx symbol name continuation! */
- if (**pp == '\\') *pp = next_symbol_text ();
-
- /* Get space to record the next field's data. */
- new = (struct nextfield *) alloca (sizeof (struct nextfield));
- new->next = list;
- list = new;
-
- /* Get the field name. */
- p = *pp;
- while (*p != ':') p++;
- list->field.name = obsavestring (*pp, p - *pp);
-
- /* C++: Check to see if we have hit the methods yet. */
- if (p[1] == ':')
- break;
-
- *pp = p + 1;
-
- /* This means we have a visibility for a field coming. */
- if (**pp == '/')
- {
- switch (*++*pp)
- {
- case '0':
- visibility = 0;
- *pp += 1;
- break;
-
- case '1':
- visibility = 1;
- *pp += 1;
- break;
-
- case '2':
- visibility = 2;
- *pp += 1;
- break;
- }
- }
- /* else normal dbx-style format. */
-
- list->field.type = read_type (pp);
- if (**pp == ':')
- {
- list->field.bitpos = (long)-1;
- p = ++(*pp);
- while (*p != ';') p++;
- list->field.bitsize = (long) savestring (*pp, p - *pp);
- *pp = p + 1;
- nfields++;
- continue;
- }
- else if (**pp != ',')
- error ("Invalid symbol data: bad structure-type format at symtab pos %d.",
- symnum);
- (*pp)++; /* Skip the comma. */
- list->field.bitpos = read_number (pp, ',');
- list->field.bitsize = read_number (pp, ';');
-
-#if 0
- /* This is wrong because this is identical to the symbols
- produced for GCC 0-size arrays. For example:
- typedef union {
- int num;
- char str[0];
- } foo;
- The code which dumped core in such circumstances should be
- fixed not to dump core. */
-
- /* g++ -g0 can put out bitpos & bitsize zero for a static
- field. This does not give us any way of getting its
- class, so we can't know its name. But we can just
- ignore the field so we don't dump core and other nasty
- stuff. */
- if (list->field.bitpos == 0
- && list->field.bitsize == 0)
- {
- /* Have we given the warning yet? */
- static int warning_given = 0;
-
- /* Only give the warning once, no matter how many class
- variables there are. */
- if (!warning_given)
- {
- warning_given = 1;
- fprintf_filtered (stderr, "\n\
-Warning: DBX-style class variable debugging information encountered.\n\
-You seem to have compiled your program with \
-\"g++ -g0\" instead of \"g++ -g\".\n\
-Therefore GDB will not know about your class variables.\n\
-");
- }
-
- /* Ignore this field. */
- list = list->next;
- }
- else
-#endif /* 0 */
- {
- /* Detect an unpacked field and mark it as such.
- dbx gives a bit size for all fields.
- Note that forward refs cannot be packed,
- and treat enums as if they had the width of ints. */
- if (TYPE_CODE (list->field.type) != TYPE_CODE_INT
- && TYPE_CODE (list->field.type) != TYPE_CODE_ENUM)
- list->field.bitsize = 0;
- if ((list->field.bitsize == 8 * TYPE_LENGTH (list->field.type)
- || (TYPE_CODE (list->field.type) == TYPE_CODE_ENUM
- && (list->field.bitsize
- == 8 * TYPE_LENGTH (builtin_type_int))
- )
- )
- &&
- list->field.bitpos % 8 == 0)
- list->field.bitsize = 0;
- nfields++;
- }
- }
-
- /* Now come the method fields, as NAME::methods
- where each method is of the form TYPENUM,ARGS,...:PHYSNAME;
- At the end, we see a semicolon instead of a field.
-
- For the case of overloaded operators, the format is
- OPERATOR::*.methods, where OPERATOR is the string "operator",
- `*' holds the place for an operator name (such as `+=')
- and `.' marks the end of the operator name. */
- if (p[1] == ':')
- {
- /* Now, read in the methods. To simplify matters, we
- "unread" the name that has been read, so that we can
- start from the top. */
-
- p = *pp;
-
- /* chill the list of fields: the last entry (at the head)
- is a partially constructed entry which we now scrub. */
- list = list->next;
-
- /* For each list of method lists... */
- do
- {
- int i;
- struct next_fnfield *sublist = 0;
- struct fn_field *fn_fields = 0;
- int length = 0;
- struct next_fnfieldlist *new_mainlist =
- (struct next_fnfieldlist *)alloca (sizeof (struct next_fnfieldlist));
-
- /* read in the name. */
- while (*p != ':') p++;
- if ((*pp)[0] == 'o' && (*pp)[1] == 'p' && (*pp)[2] == '$')
- {
- static char opname[] = "operator";
- char *o = opname + strlen(opname);
-
- /* Skip past '::'. */
- p += 2;
- while (*p != '.')
- *o++ = *p++;
- new_mainlist->fn_fieldlist.name = savestring (opname, o - opname);
- /* Skip past '.' */
- *pp = p + 1;
- }
- else
- {
- i = 0;
- new_mainlist->fn_fieldlist.name = savestring (*pp, p - *pp);
- /* Skip past '::'. */
- *pp = p + 2;
- }
-
- do
- {
- struct next_fnfield *new_sublist =
- (struct next_fnfield *)alloca (sizeof (struct next_fnfield));
-
- /* Check for and handle cretinous dbx symbol name continuation! */
- if (**pp == '\\') *pp = next_symbol_text ();
-
- new_sublist->fn_field.type = read_type (pp);
- if (**pp != ':')
- error ("invalid symtab info for method at symbol number %d.",
- symnum);
- *pp += 1;
- new_sublist->fn_field.args =
- TYPE_ARG_TYPES (new_sublist->fn_field.type);
- p = *pp;
- while (*p != ';') p++;
- new_sublist->fn_field.physname = savestring (*pp, p - *pp);
- *pp = p + 1;
- new_sublist->visibility = *(*pp)++ - '0';
- if (**pp == '\\') *pp = next_symbol_text ();
-
- switch (*(*pp)++)
- {
- case '*':
- /* virtual member function, followed by index. */
- new_sublist->fn_field.voffset = read_number (pp, ';') + 1;
- break;
- case '?':
- /* static member function. */
- new_sublist->fn_field.voffset = 1;
- break;
- default:
- /* **pp == '.'. */
- /* normal member function. */
- new_sublist->fn_field.voffset = 0;
- break;
- }
-
- new_sublist->next = sublist;
- sublist = new_sublist;
- length++;
- }
- while (**pp != ';');
-
- *pp += 1;
-
- new_mainlist->fn_fieldlist.fn_fields =
- (struct fn_field *) obstack_alloc (symbol_obstack,
- sizeof (struct fn_field) * length);
- TYPE_FN_PRIVATE_BITS (new_mainlist->fn_fieldlist) =
- (int *) obstack_alloc (symbol_obstack,
- sizeof (int) * (1 + (length >> 5)));
-
- TYPE_FN_PROTECTED_BITS (new_mainlist->fn_fieldlist) =
- (int *) obstack_alloc (symbol_obstack,
- sizeof (int) * (1 + (length >> 5)));
-
- for (i = length; sublist; sublist = sublist->next)
- {
- new_mainlist->fn_fieldlist.fn_fields[--i] = sublist->fn_field;
- if (sublist->visibility == 0)
- B_SET (new_mainlist->fn_fieldlist.private_fn_field_bits, i);
- else if (sublist->visibility == 1)
- B_SET (new_mainlist->fn_fieldlist.protected_fn_field_bits, i);
- }
-
- new_mainlist->fn_fieldlist.length = length;
- new_mainlist->next = mainlist;
- mainlist = new_mainlist;
- nfn_fields++;
- }
- while (**pp != ';');
- }
-
- *pp += 1;
-
- /* Now create the vector of fields, and record how big it is. */
-
- TYPE_NFIELDS (type) = nfields;
- TYPE_FIELDS (type) = (struct field *) obstack_alloc (symbol_obstack,
- sizeof (struct field) * nfields);
- TYPE_FIELD_PRIVATE_BITS (type) =
- (int *) obstack_alloc (symbol_obstack,
- sizeof (int) * (1 + (nfields >> 5)));
- TYPE_FIELD_PROTECTED_BITS (type) =
- (int *) obstack_alloc (symbol_obstack,
- sizeof (int) * (1 + (nfields >> 5)));
-
- TYPE_NFN_FIELDS (type) = nfn_fields;
- TYPE_NFN_FIELDS_TOTAL (type) = nfn_fields;
-
- {
- int i;
- for (i = 1; i <= TYPE_N_BASECLASSES (type); ++i)
- TYPE_NFN_FIELDS_TOTAL (type) +=
- TYPE_NFN_FIELDS_TOTAL (TYPE_BASECLASS (type, i));
- }
-
- TYPE_FN_FIELDLISTS (type) =
- (struct fn_fieldlist *) obstack_alloc (symbol_obstack,
- sizeof (struct fn_fieldlist) * nfn_fields);
-
- /* Copy the saved-up fields into the field vector. */
-
- for (n = nfields; list; list = list->next)
- {
- TYPE_FIELD (type, --n) = list->field;
- if (list->visibility == 0)
- SET_TYPE_FIELD_PRIVATE (type, n);
- else if (list->visibility == 1)
- SET_TYPE_FIELD_PROTECTED (type, n);
- }
-
- for (n = nfn_fields; mainlist; mainlist = mainlist->next)
- TYPE_FN_FIELDLISTS (type)[--n] = mainlist->fn_fieldlist;
-
- if (**pp == '~')
- {
- *pp += 1;
-
- if (**pp == '=')
- {
- TYPE_FLAGS (type)
- |= TYPE_FLAG_HAS_CONSTRUCTOR | TYPE_FLAG_HAS_DESTRUCTOR;
- *pp += 1;
- }
- else if (**pp == '+')
- {
- TYPE_FLAGS (type) |= TYPE_FLAG_HAS_CONSTRUCTOR;
- *pp += 1;
- }
- else if (**pp == '-')
- {
- TYPE_FLAGS (type) |= TYPE_FLAG_HAS_DESTRUCTOR;
- *pp += 1;
- }
-
- /* Read either a '%' or the final ';'. */
- if (*(*pp)++ == '%')
- {
- /* Now we must record the virtual function table pointer's
- field information. */
-
- struct type *t;
- int i;
-
- t = read_type (pp);
- p = (*pp)++;
- while (*p != ';') p++;
- TYPE_VPTR_BASETYPE (type) = t;
- if (type == t)
- {
- if (TYPE_FIELD_NAME (t, 0) == 0)
- TYPE_VPTR_FIELDNO (type) = i = 0;
- else for (i = TYPE_NFIELDS (t) - 1; i >= 0; --i)
- if (! strncmp (TYPE_FIELD_NAME (t, i), *pp,
- strlen (TYPE_FIELD_NAME (t, i))))
- {
- TYPE_VPTR_FIELDNO (type) = i;
- break;
- }
- if (i < 0)
- error ("virtual function table field not found");
- }
- else
- TYPE_VPTR_FIELDNO (type) = TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type, 1));
- *pp = p + 1;
- }
- else
- {
- TYPE_VPTR_BASETYPE (type) = 0;
- TYPE_VPTR_FIELDNO (type) = -1;
- }
- }
- else
- {
- TYPE_VPTR_BASETYPE (type) = 0;
- TYPE_VPTR_FIELDNO (type) = -1;
- }
-
- return type;
-}
-
-/* Read a definition of an array type,
- and create and return a suitable type object.
- Also creates a range type which represents the bounds of that
- array. */
-static struct type *
-read_array_type (pp, type)
- register char **pp;
- register struct type *type;
-{
- struct type *index_type, *element_type, *range_type;
- int lower, upper;
- int adjustable = 0;
-
- /* Format of an array type:
- "ar<index type>;lower;upper;<array_contents_type>". Put code in
- to handle this.
-
- Fortran adjustable arrays use Adigits or Tdigits for lower or upper;
- for these, produce a type like float[][]. */
-
- index_type = read_type (pp);
- if (*(*pp)++ != ';')
- error ("Invalid symbol data; improper format of array type decl.");
-
- if (!(**pp >= '0' && **pp <= '9'))
- {
- *pp += 1;
- adjustable = 1;
- }
- lower = read_number (pp, ';');
-
- if (!(**pp >= '0' && **pp <= '9'))
- {
- *pp += 1;
- adjustable = 1;
- }
- upper = read_number (pp, ';');
-
- element_type = read_type (pp);
-
- if (adjustable)
- {
- lower = 0;
- upper = -1;
- }
-
- {
- /* Create range type. */
- range_type = (struct type *) obstack_alloc (symbol_obstack,
- sizeof (struct type));
- TYPE_CODE (range_type) = TYPE_CODE_RANGE;
- TYPE_TARGET_TYPE (range_type) = index_type;
-
- /* This should never be needed. */
- TYPE_LENGTH (range_type) = sizeof (int);
-
- TYPE_NFIELDS (range_type) = 2;
- TYPE_FIELDS (range_type) =
- (struct field *) obstack_alloc (symbol_obstack,
- 2 * sizeof (struct field));
- TYPE_FIELD_BITPOS (range_type, 0) = lower;
- TYPE_FIELD_BITPOS (range_type, 1) = upper;
- }
-
- TYPE_CODE (type) = TYPE_CODE_ARRAY;
- TYPE_TARGET_TYPE (type) = element_type;
- TYPE_LENGTH (type) = (upper - lower + 1) * TYPE_LENGTH (element_type);
- TYPE_NFIELDS (type) = 1;
- TYPE_FIELDS (type) =
- (struct field *) obstack_alloc (symbol_obstack,
- sizeof (struct field));
- TYPE_FIELD_TYPE (type, 0) = range_type;
-
- return type;
-}
-
-
-/* Read a definition of an enumeration type,
- and create and return a suitable type object.
- Also defines the symbols that represent the values of the type. */
-
-static struct type *
-read_enum_type (pp, type)
- register char **pp;
- register struct type *type;
-{
- register char *p;
- char *name;
- register long n;
- register struct symbol *sym;
- int nsyms = 0;
- struct pending **symlist;
- struct pending *osyms, *syms;
- int o_nsyms;
-
- if (within_function)
- symlist = &local_symbols;
- else
- symlist = &file_symbols;
- osyms = *symlist;
- o_nsyms = osyms ? osyms->nsyms : 0;
-
- /* Read the value-names and their values.
- The input syntax is NAME:VALUE,NAME:VALUE, and so on.
- A semicolon or comman instead of a NAME means the end. */
- while (**pp && **pp != ';' && **pp != ',')
- {
- /* Check for and handle cretinous dbx symbol name continuation! */
- if (**pp == '\\') *pp = next_symbol_text ();
-
- p = *pp;
- while (*p != ':') p++;
- name = obsavestring (*pp, p - *pp);
- *pp = p + 1;
- n = read_number (pp, ',');
-
- sym = (struct symbol *) obstack_alloc (symbol_obstack, sizeof (struct symbol));
- bzero (sym, sizeof (struct symbol));
- SYMBOL_NAME (sym) = name;
- SYMBOL_CLASS (sym) = LOC_CONST;
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
- SYMBOL_VALUE (sym) = n;
- add_symbol_to_list (sym, symlist);
- nsyms++;
- }
-
- if (**pp == ';')
- (*pp)++; /* Skip the semicolon. */
-
- /* Now fill in the fields of the type-structure. */
-
- TYPE_LENGTH (type) = sizeof (int);
- TYPE_CODE (type) = TYPE_CODE_ENUM;
- TYPE_NFIELDS (type) = nsyms;
- TYPE_FIELDS (type) = (struct field *) obstack_alloc (symbol_obstack, sizeof (struct field) * nsyms);
-
- /* Find the symbols for the values and put them into the type.
- The symbols can be found in the symlist that we put them on
- to cause them to be defined. osyms contains the old value
- of that symlist; everything up to there was defined by us. */
- /* Note that we preserve the order of the enum constants, so
- that in something like "enum {FOO, LAST_THING=FOO}" we print
- FOO, not LAST_THING. */
-
- for (syms = *symlist, n = 0; syms; syms = syms->next)
- {
- int j = 0;
- if (syms == osyms)
- j = o_nsyms;
- for (; j < syms->nsyms; j++)
- {
- struct symbol *sym = syms->symbol[j];
- SYMBOL_TYPE (sym) = type;
- TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (sym);
- TYPE_FIELD_VALUE (type, n) = 0;
- TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (sym);
- TYPE_FIELD_BITSIZE (type, n++) = 0;
- }
- if (syms == osyms)
- break;
- }
-
- return type;
-}
-
-#define MAX_OF_TYPE(t) ((1 << (sizeof (t) - 1)) - 1)
-#define MIN_OF_TYPE(t) (-(1 << (sizeof (t) - 1)))
-
-static struct type *
-read_range_type (pp, typenums)
- char **pp;
- int typenums[2];
-{
- int rangenums[2];
- long n2, n3;
- int n2bits, n3bits;
- int self_subrange;
- struct type *result_type;
- struct type *index_type;
-
- /* First comes a type we are a subrange of.
- In C it is usually 0, 1 or the type being defined. */
- read_type_number (pp, rangenums);
- self_subrange = (rangenums[0] == typenums[0] &&
- rangenums[1] == typenums[1]);
-
- /* A semicolon should now follow; skip it. */
- if (**pp == ';')
- (*pp)++;
-
- /* The remaining two operands are usually lower and upper bounds
- of the range. But in some special cases they mean something else. */
- read_huge_number (pp, ';', &n2, &n2bits);
- read_huge_number (pp, ';', &n3, &n3bits);
-
- if (n2bits == -1 || n3bits == -1)
- error ("Unrecognized type range %s.", pp);
-
- if (n2bits != 0 || n3bits != 0)
-#ifdef LONG_LONG
- {
- char got_signed = 0;
- char got_unsigned = 0;
- /* Number of bits in the type. */
- int nbits;
-
- /* Range from 0 to <large number> is an unsigned large integral type. */
- if ((n2bits == 0 && n2 == 0) && n3bits != 0)
- {
- got_unsigned = 1;
- nbits = n3bits;
- }
- /* Range fro <large number> to <large number>-1 is a large signed
- integral type. */
- else if (n2bits != 0 && n3bits != 0 && n2bits == n3bits + 1)
- {
- got_signed = 1;
- nbits = n2bits;
- }
-
- /* Check for "long long". */
- if (got_signed && nbits == CHAR_BIT * sizeof (long long))
- return builtin_type_long_long;
- if (got_unsigned && nbits == CHAR_BIT * sizeof (long long))
- return builtin_type_unsigned_long_long;
-
- error ("Large type isn't a long long.");
- }
-#else /* LONG_LONG */
- error ("Type long long not supported on this machine.");
-#endif
-
- /* A type defined as a subrange of itself, with bounds both 0, is void. */
- if (self_subrange && n2 == 0 && n3 == 0)
- return builtin_type_void;
-
- /* If n3 is zero and n2 is not, we want a floating type,
- and n2 is the width in bytes.
-
- Fortran programs appear to use this for complex types also,
- and they give no way to distinguish between double and single-complex!
- We don't have complex types, so we would lose on all fortran files!
- So return type `double' for all of those. It won't work right
- for the complex values, but at least it makes the file loadable. */
-
- if (n3 == 0 && n2 > 0)
- {
- if (n2 == sizeof (float))
- return builtin_type_float;
- return builtin_type_double;
- }
-
- /* If the upper bound is -1, it must really be an unsigned int. */
-
- else if (n2 == 0 && n3 == -1)
- {
- if (sizeof (int) == sizeof (long))
- return builtin_type_unsigned_int;
- else
- return builtin_type_unsigned_long;
- }
-
- /* Special case: char is defined (Who knows why) as a subrange of
- itself with range 0-127. */
- else if (self_subrange && n2 == 0 && n3 == 127)
- return builtin_type_char;
-
- /* Assumptions made here: Subrange of self is equivalent to subrange
- of int. */
- else if (n2 == 0
- && (self_subrange ||
- *dbx_lookup_type (rangenums) == builtin_type_int))
- {
- /* an unsigned type */
- if (n3 == UINT_MAX)
- return builtin_type_unsigned_int;
- if (n3 == ULONG_MAX)
- return builtin_type_unsigned_long;
- if (n3 == USHRT_MAX)
- return builtin_type_unsigned_short;
- if (n3 == UCHAR_MAX)
- return builtin_type_unsigned_char;
- }
-#ifdef LONG_LONG
- else if (n3 == 0 && n2 == -sizeof (long long))
- return builtin_type_long_long;
-#endif
- else if (n2 == -n3 -1)
- {
- /* a signed type */
- if (n3 == INT_MAX)
- return builtin_type_int;
- if (n3 == LONG_MAX)
- return builtin_type_long;
- if (n3 == SHRT_MAX)
- return builtin_type_short;
- if (n3 == CHAR_MAX)
- return builtin_type_char;
- }
-
- /* We have a real range type on our hands. Allocate space and
- return a real pointer. */
-
- /* At this point I don't have the faintest idea how to deal with
- a self_subrange type; I'm going to assume that this is used
- as an idiom, and that all of them are special cases. So . . . */
- if (self_subrange)
- error ("Type defined as subrange of itself: %s.", pp);
-
- result_type = (struct type *) obstack_alloc (symbol_obstack,
- sizeof (struct type));
- bzero (result_type, sizeof (struct type));
-
- TYPE_TARGET_TYPE (result_type) = (self_subrange ?
- builtin_type_int :
- *dbx_lookup_type(rangenums));
-
- /* We have to figure out how many bytes it takes to hold this
- range type. I'm going to assume that anything that is pushing
- the bounds of a long was taken care of above. */
- if (n2 >= MIN_OF_TYPE(char) && n3 <= MAX_OF_TYPE(char))
- TYPE_LENGTH (result_type) = 1;
- else if (n2 >= MIN_OF_TYPE(short) && n3 <= MAX_OF_TYPE(short))
- TYPE_LENGTH (result_type) = sizeof (short);
- else if (n2 >= MIN_OF_TYPE(int) && n3 <= MAX_OF_TYPE(int))
- TYPE_LENGTH (result_type) = sizeof (int);
- else if (n2 >= MIN_OF_TYPE(long) && n3 <= MAX_OF_TYPE(long))
- TYPE_LENGTH (result_type) = sizeof (long);
- else
- error ("Ranged type doesn't fit within known sizes.");
-
- TYPE_LENGTH (result_type) = TYPE_LENGTH (TYPE_TARGET_TYPE (result_type));
- TYPE_CODE (result_type) = TYPE_CODE_RANGE;
- TYPE_NFIELDS (result_type) = 2;
- TYPE_FIELDS (result_type) =
- (struct field *) obstack_alloc (symbol_obstack,
- 2 * sizeof (struct field));
- bzero (TYPE_FIELDS (result_type), 2 * sizeof (struct field));
- TYPE_FIELD_BITPOS (result_type, 0) = n2;
- TYPE_FIELD_BITPOS (result_type, 1) = n3;
-
- return result_type;
-}
-
-/* Read a number from the string pointed to by *PP.
- The value of *PP is advanced over the number.
- If END is nonzero, the character that ends the
- number must match END, or an error happens;
- and that character is skipped if it does match.
- If END is zero, *PP is left pointing to that character. */
-
-static long
-read_number (pp, end)
- char **pp;
- int end;
-{
- register char *p = *pp;
- register long n = 0;
- register int c;
- int sign = 1;
-
- /* Handle an optional leading minus sign. */
-
- if (*p == '-')
- {
- sign = -1;
- p++;
- }
-
- /* Read the digits, as far as they go. */
-
- while ((c = *p++) >= '0' && c <= '9')
- {
- n *= 10;
- n += c - '0';
- }
- if (end)
- {
- if (c && c != end)
- error ("Invalid symbol data: invalid character \\%03o at symbol pos %d.", c, symnum);
- }
- else
- --p;
-
- *pp = p;
- return n * sign;
-}
-
-static void
-read_huge_number (pp, end, valu, bits)
- char **pp;
- int end;
- long *valu;
- int *bits;
-{
- char *p = *pp;
- int sign = 1;
- long n = 0;
- int radix = 10;
- char overflow = 0;
- int nbits = 0;
- int c;
- long upper_limit;
-
- /* Handle an optional leading minus sign. */
-
- if (*p == '-')
- {
- sign = -1;
- p++;
- }
-
- /* Leading zero means octal. GCC uses this to output values larger
- than an int (because that would be hard in decimal). */
- if (*p == '0')
- {
- radix = 8;
- p++;
- }
-
- upper_limit = LONG_MAX / radix;
- while ((c = *p++) >= '0' && c <= '9')
- {
- if (n <= upper_limit)
- {
- n *= radix;
- n += c - '0';
- }
- else
- overflow = 1;
-
- /* This depends on large values being output in octal, which is
- what GCC does. */
- if (radix == 8)
- {
- if (nbits == 0)
- {
- if (c == '0')
- /* Ignore leading zeroes. */
- ;
- else if (c == '1')
- nbits = 1;
- else if (c == '2' || c == '3')
- nbits = 2;
- else
- nbits = 3;
- }
- else
- nbits += 3;
- }
- }
- if (end)
- {
- if (c && c != end)
- {
- if (bits != NULL)
- *bits = -1;
- return;
- }
- }
- else
- --p;
-
- *pp = p;
- if (overflow)
- {
- if (nbits == 0)
- {
- /* Large decimal constants are an error (because it is hard to
- count how many bits are in them). */
- if (bits != NULL)
- *bits = -1;
- return;
- }
-
- /* -0x7f is the same as 0x80. So deal with it by adding one to
- the number of bits. */
- if (sign == -1)
- ++nbits;
- if (bits)
- *bits = nbits;
- }
- else
- {
- if (valu)
- *valu = n * sign;
- if (bits)
- *bits = 0;
- }
-}
-
-/* Read in an argument list. This is a list of types. It is terminated with
- a ':', FYI. Return the list of types read in. */
-static struct type **
-read_args (pp, end)
- char **pp;
- int end;
-{
- struct type *types[1024], **rval; /* allow for fns of 1023 parameters */
- int n = 0;
-
- while (**pp != end)
- {
- if (**pp != ',')
- error ("Invalid argument list: no ',', at symtab pos %d", symnum);
- *pp += 1;
-
- /* Check for and handle cretinous dbx symbol name continuation! */
- if (**pp == '\\')
- *pp = next_symbol_text ();
-
- types[n++] = read_type (pp);
- }
- *pp += 1; /* get past `end' (the ':' character) */
-
- if (n == 1)
- {
- rval = (struct type **) xmalloc (2 * sizeof (struct type *));
- }
- else if (TYPE_CODE (types[n-1]) != TYPE_CODE_VOID)
- {
- rval = (struct type **) xmalloc ((n + 1) * sizeof (struct type *));
- bzero (rval + n, sizeof (struct type *));
- }
- else
- {
- rval = (struct type **) xmalloc (n * sizeof (struct type *));
- }
- bcopy (types, rval, n * sizeof (struct type *));
- return rval;
-}
-
-/* This function is really horrible, but to avoid it, there would need
- to be more filling in of forward references. THIS SHOULD BE MOVED OUT
- OF COFFREAD.C AND DBXREAD.C TO SOME PLACE WHERE IT CAN BE SHARED */
-int
-fill_in_vptr_fieldno (type)
- struct type *type;
-{
- if (TYPE_VPTR_FIELDNO (type) < 0)
- TYPE_VPTR_FIELDNO (type) =
- fill_in_vptr_fieldno (TYPE_BASECLASS (type, 1));
- return TYPE_VPTR_FIELDNO (type);
-}
-
-/* Copy a pending list, used to record the contents of a common
- block for later fixup. BUG FIX by rde@topexpress.co.uk */
-static struct pending *
-copy_pending (beg, begi, end)
- struct pending *beg, *end;
- int begi;
-{
- struct pending *new = 0;
- struct pending *next;
-
- /* rde note: `begi' is an offset in block `end', NOT `beg' */
- for (next = beg; next != 0; next = next->next)
- {
- register int j;
- for (j = next == end ? begi : 0; j < next->nsyms; j++)
- add_symbol_to_list (next->symbol[j], &new);
-
- if (next == end)
- break;
- }
- return new;
-}
-
-/* Add a common block's start address to the offset of each symbol
- declared to be in it (by being between a BCOMM/ECOMM pair that uses
- the common block name). */
-
-static void
-fix_common_block (sym, value)
- struct symbol *sym;
- int value;
-{
- struct pending *next = (struct pending *) SYMBOL_NAMESPACE (sym);
- for ( ; next; next = next->next)
- {
- register int j;
- for (j = next->nsyms - 1; j >= 0; j--)
- SYMBOL_VALUE (next->symbol[j]) += value;
- }
-}
-
-void
-_initialize_dbxread ()
-{
- symfile = 0;
- header_files = (struct header_file *) 0;
- this_object_header_files = (int *) 0;
-
- undef_types_allocated = 20;
- undef_types_length = 0;
- undef_types = (struct type **) xmalloc (undef_types_allocated *
- sizeof (struct type *));
-
- add_com ("symbol-file", class_files, symbol_file_command,
- "Load symbol table (in dbx format) from executable file FILE.");
-
- add_com ("add-file", class_files, add_file_command,
- "Load the symbols from FILE, assuming its code is at TEXT_START.") ;
-}
-
-#endif /* READ_DBX_FORMAT */
diff --git a/gnu/usr.bin/gdb/defs.h b/gnu/usr.bin/gdb/defs.h
deleted file mode 100644
index de744fc..0000000
--- a/gnu/usr.bin/gdb/defs.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- *
- * @(#)defs.h 6.3 (Berkeley) 5/8/91
- */
-
-/* Basic definitions for GDB, the GNU debugger.
- Copyright (C) 1986, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#define CORE_ADDR unsigned int
-
-#define min(a, b) ((a) < (b) ? (a) : (b))
-#define max(a, b) ((a) > (b) ? (a) : (b))
-
-extern char *savestring ();
-extern char *concat ();
-extern char *xmalloc (), *xrealloc ();
-extern int parse_escape ();
-extern char *reg_names[];
-
-/* Various possibilities for alloca. */
-#ifdef sparc
-#include <alloca.h>
-#else
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else
-extern char *alloca ();
-#endif
-#endif
-
-extern int quit_flag;
-
-extern int immediate_quit;
-
-#define QUIT { if (quit_flag) quit (); }
-
-/* Notes on classes: class_alias is for alias commands which are not
- abbreviations of the original command. */
-
-enum command_class
-{
- no_class = -1, class_run = 0, class_vars, class_stack,
- class_files, class_support, class_info, class_breakpoint,
- class_alias, class_obscure, class_user,
-};
-
-/* the cleanup list records things that have to be undone
- if an error happens (descriptors to be closed, memory to be freed, etc.)
- Each link in the chain records a function to call and an
- argument to give it.
-
- Use make_cleanup to add an element to the cleanup chain.
- Use do_cleanups to do all cleanup actions back to a given
- point in the chain. Use discard_cleanups to remove cleanups
- from the chain back to a given point, not doing them. */
-
-struct cleanup
-{
- struct cleanup *next;
- void (*function) ();
- int arg;
-};
-
-extern void do_cleanups ();
-extern void discard_cleanups ();
-extern struct cleanup *make_cleanup ();
-extern struct cleanup *save_cleanups ();
-extern void restore_cleanups ();
-extern void free_current_contents ();
-extern void reinitialize_more_filter ();
-extern void fputs_filtered ();
-extern void fprintf_filtered ();
-extern void printf_filtered ();
-extern void print_spaces_filtered ();
-extern char *tilde_expand ();
-
-/* Structure for saved commands lines
- (for breakpoints, defined commands, etc). */
-
-struct command_line
-{
- struct command_line *next;
- char *line;
- int type; /* statement type */
-#define CL_END 0
-#define CL_NORMAL 1
-#define CL_WHILE 2
-#define CL_IF 3
-#define CL_EXITLOOP 4
-#define CL_NOP 5
- struct command_line *body; /* body of loop for while, body of if */
- struct command_line *elsebody; /* body of else part of if */
-};
-
-extern struct command_line *read_command_lines ();
-extern void do_command_lines();
-
-/* String containing the current directory (what getwd would return). */
-
-char *current_directory;
-
diff --git a/gnu/usr.bin/gdb/doc/ChangeLog b/gnu/usr.bin/gdb/doc/ChangeLog
deleted file mode 100644
index fb86719..0000000
--- a/gnu/usr.bin/gdb/doc/ChangeLog
+++ /dev/null
@@ -1,783 +0,0 @@
-Tue Oct 19 14:21:18 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdb.texinfo (Sourc Path): index entries for $cwd, $pdir
-
- * a4rc.sed: update to work with Andreas Vogel papersize params
-
- * refcard.tex: use Andreas Vogel simplifications of papersize
- params; remove useless version info; update copyright date.
-
-Tue Oct 19 10:46:22 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * gdb.texinfo (Symbols): Add class NAME to doc for ptype.
-
-Tue Oct 12 09:11:45 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * gdb.texinfo (Files): Say what address the load command loads it at.
-
- * stabs.texinfo (Common Blocks): Minor cleanups.
-
- * stabs.texinfo: Update ld stabs in elf relocation to reflect the fact
- that Sun has backed away from the linker kludge and thus the relevant
- issue is changes to the SunPRO tools, not the Solaris linker.
-
- * stabs.texinfo (Traditional Integer Types): Clean up description
- of octal bounds a little bit. Document extra leading zeroes.
-
-Thu Oct 7 16:15:37 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * gdb.texinfo (Signaling): Update for symbolic symbol names
- and add a section explaining the difference between the GDB
- signal command and the shell kill utility.
-
-Wed Oct 6 13:23:01 1993 Tom Lord (lord@rtl.cygnus.com)
-
- * libgdb.texinfo: added `@' to braces that were unescaped.
-
-Mon Oct 4 10:42:18 1993 Tom Lord (lord@rtl.cygnus.com)
-
- * libgdb.texinfo: new file. Spec for the gdb library.
-
-Sun Oct 3 15:26:56 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Include Files): Fix typo (start -> end).
-
-Thu Sep 30 18:24:56 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdb.texinfo, remote.texi: assorted small improvements, mostly
- from Melissa at FSF's editing pass.
-
-Thu Sep 30 11:54:38 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * gdb.texinfo: Remove stuff about ar and 14 character filenames.
- I believe this was fixed by the 13 Sep 89 change to print_frame_info.
- Also, modern versions of ar like BSD 4.4 or SVR4 don't have this bug.
-
-Wed Sep 22 21:22:11 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * remote.texi (Bootstrapping): Discuss 386 call gates.
-
-Sat Sep 18 17:10:44 1993 Jim Kingdon (kingdon@poseidon.cygnus.com)
-
- * stabs.texinfo (Based Variables): New node.
-
-Thu Sep 16 17:48:55 1993 Jim Kingdon (kingdon@cirdan.cygnus.com)
-
- * stabs.texinfo (Negative Type Numbers): Re-write discussions of
- names, sizes, and formats to suggest how not to lose.
-
-Sat Sep 11 09:35:11 1993 Jim Kingdon (kingdon@poseidon.cygnus.com)
-
- * stabs.texinfo (Methods): Fix typo.
-
-Fri Sep 10 06:34:20 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * gdb.texinfo: Fix a few typos.
-
-Wed Sep 8 09:11:52 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * gdb.texinfo: Clarify how well it works with Fortran.
-
- * stabs.texinfo (Stabs In ELF, Statics, ELF Transformations):
- More on relocating stabs in ELF files.
-
-Tue Sep 7 13:45:02 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Stabs In ELF): Talk about N_FUN value.
-
-Mon Sep 6 19:23:18 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Local Variable Parameters): Talk about nameless
- parameters on VAX.
-
-Fri Sep 3 17:06:08 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdb.texinfo: @up/@down -> @raisesections/@lowersections
-
-Fri Sep 3 12:04:15 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo: Make info author notice match the TeX author notice.
-
-Tue Aug 31 13:21:06 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * stabs.texinfo: Initial-caps all words in node names and
- non-trivial words in section names.
-
-Mon Aug 30 11:13:16 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo: Many minor cleanups.
-
- * stabs.texinfo: Remove @deffn except from Expanded Reference node.
-
-Sat Aug 28 12:08:09 1993 David J. MacKenzie (djm@edison.eng.umd.edu)
-
- * stabs.texinfo: Remove full description of big example.
- It's not really helpful; just use pieces of it where appropriate.
- Add more Texinfo formatting directives (@samp, etc.).
- Use @deffn to define stab types.
- Eliminate some wordiness. Break up some nodes.
- Add an (alphabetized) index of symbol types.
- Use consistent capitalization style in node and section names.
-
-Thu Aug 26 06:36:31 1993 Fred Fish (fnf@deneb.cygnus.com)
-
- * gdb.texinfo: Change typo "Two two" to "The two".
-
-Sun Aug 22 12:15:18 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (XCOFF-differences): Remove references to
- non-existent types N_DECL and N_RPSYM.
-
- * stabs.texinfo (String Field): Say that type attributes bug is
- fixed in GDB 4.10, since it is.
-
- * stabs.texinfo: Clean up djm cleanups, and more cleanups of my own.
-
-Sat Aug 21 04:32:28 1993 David MacKenzie (djm@cygnus.com)
-
- * stabs.texinfo: Formatting cleanups.
-
-Fri Aug 20 20:49:53 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo: When explaining the n_type of a stab, standardize
- how we do it ('#' as a comment indicator, "36 is N_FUN" as text,
- no tabs, use @r).
- (Global Variables): Clean up.
-
-Tue Aug 17 15:57:27 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Stack Variables): Re-write.
-
-Mon Aug 16 21:20:08 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Stabs-in-elf): Talk about getting the start
- addresses of a source file. Also revise formatting.
- Change "object module" or "object file" to "source file".
- Various: Miscellaneous cleanups.
-
-Thu Aug 12 15:11:51 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo: Point to mangling info in gcc's gpcompare.texi.
-
-Tue Aug 10 16:57:49 1993 Stan Shebs (shebs@rtl.cygnus.com)
-
- * gdbint.texinfo: Removed many nonsensical machine-collected
- host and target conditionals, described some of the remainder.
-
-Tue Aug 10 13:28:30 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * gdbint.texinfo (Getting Started): Use @itemize, not @table.
-
- * gdbint.texinfo (Top): Add name to @top line, and re-write the
- paragraph which follows.
-
- * gdbint.texinfo (Host): Use @code not @samp for Makefile
- variables. Looks better and avoids overful hbox.
-
-Fri Jul 30 18:26:21 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Procedures): Improve stuff on nested functions.
-
-Thu Jul 29 15:10:58 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * remote.texi: (MIPS Remote) clearer doc for set/show timeout,
- retransmit-timeout
-
-Thu Jul 29 13:16:09 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * gdbint.texinfo: Update statement about `some ancient Unix
- systems, like Ultrix 4.0' to Ultrix 4.2.
-
-Wed Jul 28 15:26:53 1993 Roland H. Pesch (pesch@el_bosque.cygnus.com)
-
- * h8-cfg.texi, all-cfg.texi: new flag GDBSERVER
-
- * Makefile.in: depend on remote.texi rather than gdbinv-s.texi
-
- * remote.texi: (Server) New node on gdbserver. (Remote Serial,
- ST2000 Remote, MIPS Remote): mention `host:port' syntax for TCP.
-
- * remote.texi: new name for former gdbinv-s.texi
-
- * gdb.texinfo: use remote.texi rather than gdbinv-s.texi
-
-Wed Jul 28 08:26:24 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * gdbinv-s.texi: Documented timeout and retransmit-timeout
- variables for MIPS remote debugging protocol.
-
-Mon Jul 26 13:00:09 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Negative Type Numbers): FORTRAN LOGICAL fix.
-
-Tue Jul 20 16:30:41 1993 Jim Kingdon (kingdon@deneb.cygnus.com)
-
- * Makefile.in (refcard.dvi): Use srcdir where necessary.
-
-Mon Jul 19 12:02:50 1993 Roland H. Pesch (pesch@cygnus.com)
-
- * gdb.texinfo: repair conditional bugs in text markup
-
-Fri Jul 16 18:57:50 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdb.texinfo, all-cfg.texi, h8-cfg.texi: introduce MOD2 switch
- to select Modula-2 material.
-
-Thu Jul 15 13:15:01 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo: Cleanups regarding statics.
-
- * gdbinv-s.texi (Bootstrapping): Document exceptionHandler.
- (Debug Session): Mention exceptionHandler. Add xref to Bootstrapping.
-
-Mon Jul 12 13:37:02 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo: N_MAIN is sometimes used for C.
-
-Fri Jul 9 09:47:02 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * gdbint.texinfo (Host, Target Conditionals): Remove TM_FILE_OVERRIDE.
-
-Tue Jul 6 12:41:28 1993 John Gilmore (gnu@cygnus.com)
-
- * gdbint.texinfo (Target Conditionals): Remove NO_TYPEDEFS,
- removed from the code by Kingdon.
-
-Tue Jul 6 12:24:34 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * gdb.texinfo (Break Commands): Remove stuff about flushing terminal
- input when evaluating breakpoint conditions; the bug has been fixed.
-
- * gdb.texinfo (Continuing and Stepping): Argument to "continue"
- sets the ignore count to N-1, not to N.
-
-Thu Jul 1 14:57:42 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * refcard.tex (\hoffset): correct longstanding error to match
- intended offset; avoids cutting off edge on some printers
-
-Wed Jun 30 18:23:06 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Parameters): Say that order of stabs is significant.
-
-Fri Jun 25 21:34:52 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Common Blocks): Say what Sun FORTRAN does.
-
-Fri Jun 25 16:15:10 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * Makefile.in: (REFEDITS) new var to control whether PS or CM
- fonts and whether US or A4 paper for GDB refcard; (refcard.dvi)
- collect sed edits if any, apply to refcard before formatting;
- (refcard.ps) stop implying PS fonts if PS output requested;
- (lrefcard.ps) delete extra target for variant PS fonts
-
- * refcard.tex: parametrize papersize dependent info, collect
- in easily replaced spot
-
- * a4rc.sed: new file, edits to refcard for A4 paper
-
-Fri Jun 25 14:21:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Negative Type Numbers): Type -16 is 4 bytes.
-
-Wed Jun 23 15:02:50 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Negative Type Numbers): Minor character cleanups.
-
-Tue Jun 22 16:31:52 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo: Express disapproval of 'D' symbol descriptor
- politely rather than rudely.
-
-Fri Jun 18 19:42:09 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo: Document common blocks.
-
-Fri Jun 18 12:12:57 1993 Fred Fish (fnf@cygnus.com)
-
- * stabs.texinfo: Add some basic info about stabs-in-elf.
-
-Fri Jun 18 13:57:09 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Top): Minor cleanup.
-
-Mon Jun 14 16:16:51 1993 david d `zoo' zuhn (zoo at rtl.cygnus.com)
-
- * Makefile.in (install-info): remove parentdir support
-
-Tue Jun 15 18:11:39 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdb.texinfo (Copying): delete this node and references to it;
- RMS says this manual need not carry GPL. (passim): Improvements
- from last round at FSF, largely due to Ian Taylor review, and
- minor formatting improvements.
-
- * gdbinv-s.texi (passim): Improvements from last round at FSF,
- largely due to Ian Taylor review. (Debug Session): minor edits to
- new text.
-
-Sun Jun 13 12:52:39 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * Makefile.in (realclean): Remove info and dvi files too.
-
-Sat Jun 12 16:09:22 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * {all,h8}-config.texi: Rename to *-cfg.texi for 14 char filenames.
- * Makefile.in: Change accordingly. gdb-config.texi -> gdb-cfg.texi.
- * gdb.texinfo: Change accordingly.
-
- * stabs.texinfo: Clean up N_{L,R}BRAC. Discuss what addresses of
- N_{L,R}BRAC,N_SLINE are relative to.
-
-Fri Jun 11 15:15:55 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * Makefile.in (GDBvn.texi): Update atomically.
-
-Wed Jun 9 10:58:16 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * gdbinv-s.texi (Debug Session): Document exceptionHook.
-
-Tue Jun 8 13:42:04 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * gdb.texinfo (Print Settings): Move all stuff relating to symbolic
- addresses together. Also motivate the set print symbol-filename
- command and suggest other solutions.
-
-Tue Jun 1 22:46:43 1993 Fred Fish (fnf@cygnus.com)
-
- * gdb.texinfo (set print elements): Note that the number of
- elements is set to unlimited by "set print elements 0".
-
-Mon May 31 08:06:55 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * stabs.texinfo (Builtin Type Descriptors): Try to clarify what
- NF_LDOUBLE means.
- (Stab Types): Include Solaris stab types.
- (Procedures): Document Solaris extensions.
-
-Thu May 27 06:20:42 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * gdb.texinfo: Add `set print symbol-filename' doc.
-
-Wed May 26 00:26:42 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Arrays): Talk about type definition vs. type
- information.
-
- * stabs.texinfo (Builtin Type Descriptors): Talk about omitting
- the trailing semicolon.
-
-Tue May 25 14:49:42 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Line Numbers, Source Files): Re-write these two nodes
- and merge in other parts of the document addressing these subjects.
- gdbint.texinfo (XCOFF): Remove info which is now in stabs.texinfo.
-
- * stabs.texinfo (Subranges, Arrays): Try to explain about the semicolon
- at the end of a range type.
-
- * stabs.texinfo (Subranges): "A offset" and "T offset" are not
- AIX extensions.
-
-Mon May 24 09:00:33 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Stabs Format): Misc fixes.
-
-Sat May 22 10:40:56 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Constants): Allow an `e' constant to be non-enum.
- (Traditional builtin types): Document convex convention for long long.
- (Negative builtin types): Discuss type names, and misc fixes.
-
-Fri May 21 11:20:31 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Builtin Type Descriptors): Document the floating
- point types used with @samp{R} type descriptor.
- (Symbol Descriptors): Describe how to handle conflict between
- different meanings of @samp{P} symbol descriptor.
-
-Thu May 20 13:35:10 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo: Remove node Quick Reference and put its children
- directly under the main menu.
-
- * stabs.texinfo: Many more changes to bring it into line with
- AIX documentation and reality. I think it now has all the
- information from the AIX documentation, except that I burned
- out when I got to variant records (Pascal and Modula-2) and
- all the COBOL types. Oh well, we can add them later when we're
- worrying more about those languages.
-
- * stabs.texinfo (Automatic variables): Talk about what it means
- to omit the symbol descriptor.
-
-Tue May 18 17:59:18 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * stabs.texinfo (Parameters): Add "(sometimes)" when describing
- gcc2 behavior with promoted args.
-
-Fri May 14 21:35:29 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdb.texinfo: include readline appendices in info version of manual
-
-Fri May 7 11:56:18 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdbinv-s.texi (Remote Serial): describe new ^C behavior in
- target remote.
-
- * gdb.texinfo (Machine Code): more index entries for disassemble
-
-Fri May 7 10:12:30 1993 Fred Fish (fnf@cygnus.com)
-
- * Clarify the intended use of the gdb-testers and gdb-patches
- mailing lists, and shrink gzip comment.
-
-Thu May 6 16:39:50 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdb.texinfo (Shell Commands): do not mention SHELL env var in
- DOSHOST configuration of manual.
-
- * gdb.texinfo (MIPS Stack): new node.
-
- * all-config.texi (MIPS) new switch.
-
- * gdbinv-s.texi (Nindy Options) Remove two instances of future
- tense; (MIPS Remote) new node.
-
- * gdb.texinfo (passim) rephrases to work around makeinfo @value
- bug; (Environment) less passive, other small cleanups in text about
- .cshrc/.bashrc; (Invoking GDB) new MIPS Remote menu entry;
- (Remote) new MIPS Remote menu entry.
-
-Thu Apr 29 09:36:25 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * stabs.texinfo: Many changes to include information from the
- AIX documentation.
-
- * gdb.texinfo (Environment): Mention pitfall with .cshrc.
-
-Tue Apr 27 14:02:57 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * gdbint.texinfo (new node Debugging GDB, elsewhere):
- Move a bunch of information from ../README.
- (Getting Started): New node.
-
-Fri Apr 23 17:21:13 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdbinv-s.texi, gdb.texinfo: include Hitachi SH target
-
- * gdb.texinfo: advance manual revision dates to present
-
- * gdbinv-s.texi, gdb.texinfo, all-config.texi, h8-config.texi:
- stop using silly Roman numerals in @set variable names
-
-Fri Apr 23 07:30:01 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * stabs.texinfo (Parameters): Keep trying to get this right.
-
-Wed Apr 21 15:18:47 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * stabs.texinfo (Parameters): More on "local parameters".
-
-Mon Apr 19 08:00:51 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * stabs.texinfo (Parameters): Re-do "local parameters" section.
-
-Sun Apr 18 09:47:45 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * stabs.texinfo (Symbol descriptors): Re-do using @table and @xref.
- (Parameters): Rewrite.
- (xcoff-differences, Sun-differences): Minor changes.
-
-Thu Apr 15 02:35:24 1993 John Gilmore (gnu@cacophony.cygnus.com)
-
- * stabs.texinfo: Minor cleanup.
-
-Wed Apr 14 17:31:00 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * gdbint.texinfo: Minor xcoff stuff.
-
-Wed Apr 7 14:11:07 1993 Fred Fish (fnf@cygnus.com)
-
- * gdbint.texinfo: Update for new config directory structure.
- Add info about internal type data structures.
-
-Mon Apr 5 09:06:30 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * Makefile.in (SFILES_INCLUDED): gdb-config.texi is no longer in
- $(srcdir).
- (gdb-config.texi): Depend on file in $(srcdir).
-
-Fri Apr 2 16:55:13 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * stabs.texinfo: Fixes about N_SO.
-
-Fri Mar 26 18:00:35 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdb.texinfo: include list of nonstandard init file names
-
- * *-config.texi: new switch GENERIC for text that applies *only*
- to (usual) multiple-target version of manual
-
- * gdb.texinfo, gdbinv-s.texi: Update conditional markup to correct
- h8 config
-
- * gdb.texinfo: depend on latest fixed makeinfo, use conditionals
- in menus (rather than conditionally selected multiple alternative
- menus).
-
- * Makefile.in: define and use DOC_CONFIG var to select
- configuration for GDB user manual.
-
- * gdb-config.texi: delete from repository, generate from Makefile.
-
- * all-config.texi: normal `generic' configuration file, formerly
- stored as gdb-config.texi
-
-Wed Mar 24 14:03:19 1993 david d `zoo' zuhn (zoo at poseidon.cygnus.com)
-
- * Makefile.in: add dvi target to build all .dvi files
-
-Tue Mar 23 16:03:24 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdb.texinfo, gdvinv-s.texinfo: formatting improvements.
-
-Fri Mar 19 21:46:50 1993 John Gilmore (gnu@cygnus.com)
-
- * gdbint.texinfo: Doc NO_MMALLOC and NO_MMALLOC_CHECK as
- host conditionals.
- * stabs.texinfo: More array fixes inspired by Jim's.
-
-Fri Mar 19 10:23:34 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * stabs.texinfo: Fixes re arrays and continuations.
-
- * gdbint.texinfo: Add XCOFF node.
-
-Mon Mar 8 15:52:18 1993 John Gilmore (gnu@cygnus.com)
-
- * gdb.texinfo: Add `set print max-symbolic-offset' doc.
-
-Sun Feb 21 17:09:38 1993 Per Bothner (bothner@rtl.cygnus.com)
-
- * stabs.texinfo: Fix for array types to mention lower bounds.
-
-Thu Feb 18 01:19:49 1993 John Gilmore (gnu@cygnus.com)
-
- * gdbint.texinfo: Update PTRACE_ARG3_TYPE doc, pull PT_*.
-
-Wed Feb 17 08:15:24 1993 John Gilmore (gnu@cygnus.com)
-
- * gdbint.texinfo: Remove SET_STACK_LIMIT_HUGE from target defines.
-
-Thu Feb 11 10:38:40 1993 John Gilmore (gnu@cygnus.com)
-
- * gdbint.texinfo: Fix thinko (NM_FILE => NAT_FILE). Found
- by Michael Ben-Gershon <mybg@CS.HUJI.AC.IL>.
-
-Wed Feb 10 23:59:19 1993 John Gilmore (gnu@cygnus.com)
-
- * gdbint.texinfo: Eliminate IBM6000_HOST, document IBM6000_TARGET.
-
-Tue Feb 9 18:26:21 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdb.texinfo, gdbinv-s.texi: misc updates
-
-Sat Feb 6 10:25:47 1993 John Gilmore (gnu@cygnus.com)
-
- * gdbint.texinfo: Brief documentation for longjmp support,
- from an email msg by Stu.
-
-Fri Feb 5 14:10:15 1993 John Gilmore (gnu@cygnus.com)
-
- * stabs.texinfo: Fix description of floating point "range"
- types (which really define basic types). Reported by Jim Meehan,
- <meehan@src.dec.com>.
-
- * gdbint.texinfo: Remove COFF_NO_LONG_FILE_NAMES define, now gone.
-
-Thu Feb 4 13:56:46 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * gdbint.texinfo: Slightly expand section on supporting a new
- object file format.
-
-Thu Feb 4 01:49:04 1993 John Gilmore (gnu@cygnus.com)
-
- * Makefile.in (refcard.ps, lrefcard.ps): Remove psref.tex
- intermediate file.
-
-Tue Feb 2 12:18:06 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdb.texinfo, gdbinv-s.texi: miscellaneous stylistic cleanups
-
-Mon Feb 1 15:35:47 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdbinv-s.texi: z8000 simulator target name is just "sim"
-
- * gdbinv-s.texi: Mention that Z8000 simulator can simulate Z8001
- as well as Z8002.
-
-Sat Nov 28 06:51:35 1992 John Gilmore (gnu@cygnus.com)
-
- * gdbint.texinfo: Add sections on clean design and on how to send
- in changes.
-
-Mon Nov 9 23:57:02 1992 John Gilmore (gnu@cygnus.com)
-
- * gdbint.texinfo: Add how to declare the result of make_cleanup.
-
-Mon Oct 26 11:09:47 1992 John Gilmore (gnu@cygnus.com)
-
- * gdb.texinfo: Fix typo, reported by Karl Berry.
-
-Fri Oct 23 00:41:21 1992 John Gilmore (gnu@cygnus.com)
-
- * gdb.texinfo: Add opcodes dir to GDB distribution description.
-
-Sat Oct 10 18:04:58 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * gdbint.texinfo: fixed a stray email address (needs @@),
- added @table @code to node "Native Conditionals"
-
-Tue Sep 22 00:34:15 1992 John Gilmore (gnu@cygnus.com)
-
- * gdbint.texinfo: Describe coding style of GDB.
-
-Mon Sep 21 19:32:16 1992 John Gilmore (gnu@cygnus.com)
-
- * stabs.texinfo: Minor wording changes.
-
-Tue Sep 15 02:57:09 1992 John Gilmore (gnu@cygnus.com)
-
- * gdbint.texinfo: Improve release doc slightly.
-
-Fri Sep 11 01:34:25 1992 John Gilmore (gnu@sphagnum.cygnus.com)
-
- * gdbint.texinfo: Improve doc of GDB config macros.
-
-Wed Sep 9 16:52:06 1992 John Gilmore (gnu@cygnus.com)
-
- * stabs.texinfo: Remove Bothner's changes for C++ nested types.
- These will be reinserted when examined.
-
-Mon Aug 24 01:17:55 1992 John Gilmore (gnu@cygnus.com)
-
- * gdbint.texinfo: Make a start at documenting all the #if macros
- in GDB. At least list them all, and start separating them into
- host-specific and target-specific.
-
-Tue Aug 18 15:59:13 1992 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdbinv-s.m4.in: refrain from using @cartouche for just a few
- examples (not consistent w others).
- gdb.texinfo: issue disclaimer paragraph on cmdline options only
- for generic vn of doc
-
-Tue Aug 18 14:53:27 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * Makefile.in: always create installation directories.
-
-Tue Aug 18 14:11:50 1992 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdb.texinfo: in h8 config, do not describe searching commands.
-
-Mon Aug 17 18:07:59 1992 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdb.texinfo, none.m4, h8.m4, gdbinv-s.m4.in: improve H8/300
- conditionals; introduce a few generic switches that may be
- useful for other cross-dev or dos-hosted configs.
-
- * gdb.texinfo: fix typo in "info reg" description
-
-Sun Aug 16 01:16:18 1992 John Gilmore (gnu@cygnus.com)
-
- * stabs.texinfo: Minor updates from running TeX over it.
- * Makefile.in (stabs.dvi, stabs.ps): Add.
-
-Sat Aug 15 20:52:24 1992 Per Bothner (bothner@rtl.cygnus.com)
-
- * stabs.texinfo: Stabs documentation, written by Julia Menapace.
- First pass at converting it to texinfo.
-
-Sat Aug 15 03:14:59 1992 John Gilmore (gnu@cygnus.com)
-
- * gdb.texinfo, refcard.tex: Document mult args on `info reg'.
- * Makefile.in (refcard.ps, lrefcard.ps): Add missing $(srdir).
-
-Fri Aug 14 21:08:47 1992 John Gilmore (gnu@cygnus.com)
-
- * gdbint.texinfo: Add section on partial symbol tables.
-
-Sat Jun 20 16:31:10 1992 John Gilmore (gnu at cygnus.com)
-
- * gdb.texinfo: document `set remotedebug' and `set
- rstack_high_address'.
-
-Thu May 14 17:09:48 1992 Roland H. Pesch (pesch@fowanton.cygnus.com)
-
- * gdb.texinfo: slight expansion of new text on reading info files
- * gdbinv-s.m4.in: correct and expand info on cross-debugging
- H8/300 from DOS.
-
-Tue May 12 12:22:47 1992 John Gilmore (gnu at cygnus.com)
-
- * gdb.texinfo: `info user' => `show user'. Noticed by David Taylor.
-
-Mon May 11 19:06:27 1992 John Gilmore (gnu at cygnus.com)
-
- * gdb.texinfo: Say how to read the `info' files.
-
-Tue May 5 12:11:38 1992 K. Richard Pixley (rich@cygnus.com)
-
- * Makefile.in: gm4 -> m4.
-
-Fri Apr 10 17:50:43 1992 John Gilmore (gnu at rtl.cygnus.com)
-
- * gdb.texinfo: Update for GDB-4.5. Move `Formatting
- Documentation' ahead of `Installing GDB' to match README.
- Update shared library doc, -readnow and -mapped, and directory
- structure (add glob and mmalloc). Update configure doc.
-
-Tue Mar 24 23:28:38 1992 K. Richard Pixley (rich@cygnus.com)
-
- * Makefile.in: remove $(srcdir) from gdb.info rule.
-
-Sat Mar 7 18:44:50 1992 K. Richard Pixley (rich@rtl.cygnus.com)
-
- * Makefile.in: commented out gdb-all.texinfo rule. This is
- temporary.
-
-Wed Feb 26 18:04:40 1992 K. Richard Pixley (rich@cygnus.com)
-
- * Makefile.in, configure.in: removed traces of namesubdir,
- -subdirs, $(subdir), $(unsubdir), some rcs triggers. Forced
- copyrights to '92, changed some from Cygnus to FSF.
-
-Fri Dec 13 09:47:31 1991 John Gilmore (gnu at cygnus.com)
-
- * gdb.texinfo: Improve how we ask for bug reports.
-
-Tue Dec 10 04:07:21 1991 K. Richard Pixley (rich at rtl.cygnus.com)
-
- * Makefile.in: infodir belongs in datadir.
-
-Fri Dec 6 23:57:34 1991 K. Richard Pixley (rich at rtl.cygnus.com)
-
- * Makefile.in: remove spaces following hyphens, bsd make can't
- cope. install using INSTALL_DATA. added clean-info. added
- standards.text support.
-
-Thu Dec 5 22:46:12 1991 K. Richard Pixley (rich at rtl.cygnus.com)
-
- * Makefile.in: idestdir and ddestdir go away. Added copyrights
- and shift gpl to v2. Added ChangeLog if it didn't exist. docdir
- and mandir now keyed off datadir by default.
-
-
-Local Variables:
-mode: indented-text
-left-margin: 8
-fill-column: 74
-version-control: never
-End:
diff --git a/gnu/usr.bin/gdb/doc/Makefile.in b/gnu/usr.bin/gdb/doc/Makefile.in
deleted file mode 100644
index d5ae290..0000000
--- a/gnu/usr.bin/gdb/doc/Makefile.in
+++ /dev/null
@@ -1,327 +0,0 @@
-##Copyright (C) 1991, 1992 Free Software Foundation, Inc.
-
-# Makefile for GDB documentation.
-# This file is part of GDB.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-srcdir = .
-
-prefix = /usr/local
-
-infodir = $(prefix)/info
-
-SHELL = /bin/sh
-
-INSTALL = install -c
-INSTALL_PROGRAM = $(INSTALL)
-INSTALL_DATA = $(INSTALL)
-
-# main GDB source directory
-gdbdir = $(srcdir)/..
-
-# where to find texinfo; GDB dist should include a recent one
-TEXIDIR=${gdbdir}/../texinfo
-
-# where to find makeinfo, preferably one designed for texinfo-2
-MAKEINFO=makeinfo
-
-# where to find texi2roff, ditto
-TEXI2ROFF=texi2roff
-
-# Where is the source dir for the READLINE library doc?
-# Traditionally readline is in .. or .
-READLINE_DIR = ${gdbdir}/../readline/doc
-
-SET_TEXINPUTS = TEXINPUTS=${TEXIDIR}:.:$(srcdir):$(READLINE_DIR):$$TEXINPUTS
-
-# There may be alternate predefined collections of switches to configure
-# the GDB manual. Normally this is not done in synch with the software
-# config system, since this choice tends to be independent; most people
-# want a doc config of `all' for a generic manual, regardless of sw config.
-DOC_CONFIG = all
-
-# This list of sed edits will edit the GDB reference card
-# for what fonts and what papersize to use.
-# By default (NO edits applied), the refcard uses:
-# - Computer Modern (CM) fonts
-# - US letter paper (8.5x11in)
-# List some of the following files for alternative fonts and paper:
-# a4rc.sed use A4 paper (297 x 210 mm)
-# psrc.sed use PostScript fonts (Karl Berry short TeX names)
-# lpsrc.sed use PostScript fonts (full PostScript names in TeX)
-# e.g. for A4, Postscript: REFEDITS = a4rc.sed psrc.sed
-# for A4, CM fonts: REFEDITS = a4rc.sed
-# for US, PS fonts: REFEDITS = psrc.sed
-# for default:
-REFEDITS =
-
-# Don Knuth's TeX formatter
-TEX = tex
-
-# auxiliary program for sorting Texinfo indices
-TEXINDEX = texindex
-
-# Main GDB manual's source files
-SFILES_INCLUDED = gdb-cfg.texi $(srcdir)/remote.texi
-
-SFILES_LOCAL = $(srcdir)/gdb.texinfo GDBvn.texi $(SFILES_INCLUDED)
-
-SFILES_DOC = $(SFILES_LOCAL) \
- $(READLINE_DIR)/rluser.texinfo $(READLINE_DIR)/inc-hist.texi
-
-#### Host, target, and site specific Makefile fragments come in here.
-###
-
-all install:
-
-info: gdb.info gdbint.info stabs.info
-dvi: gdb.dvi refcard.dvi gdbint.dvi
-all-doc: gdb.info gdb.dvi refcard.dvi gdb-internals gdbint.dvi
-
-install-info: info
- for i in *.info* ; do \
- $(INSTALL_DATA) $$i $(infodir)/$$i ; \
- done
-
-STAGESTUFF = *.info* gdb-all.texi GDBvn.texi
-
-# Copy the object files from a particular stage into a subdirectory.
-stage1: force
- -mkdir stage1
- -mv $(STAGESTUFF) stage1
-
-stage2: force
- -mkdir stage2
- -mv $(STAGESTUFF) stage2
-
-stage3: force
- -mkdir stage3
- -mv $(STAGESTUFF) stage3
-
-against=stage2
-
-comparison: force
- for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
-
-de-stage1: force
- -(cd stage1 ; mv -f * ..)
- -rmdir stage1
-
-de-stage2: force
- -(cd stage2 ; mv -f * ..)
- -rmdir stage2
-
-de-stage3: force
- -(cd stage3 ; mv -f * ..)
- -rmdir stage3
-
-clean-info:
- rm -f gdb.info* gdbint.info* stabs.info*
-
-clean-dvi:
- rm -f gdb.dvi refcard.dvi gdbint.dvi stabs.dvi sedref.dvi
-
-mostlyclean: clean-info clean-dvi
- rm -f gdb.?? gdb.??? gdb.mm gdb.ms gdb.me
- rm -f links2roff
- rm -f refcard.ps lrefcard.ps refcard.log sedref.* *~
- rm -f gdbint.?? gdbint.??? stabs.?? stabs.???
-
-clean: mostlyclean
- rm -f GDBvn.texi rluser.texinfo inc-hist.texi
-
-distclean: clean
- rm -f Makefile config.status
-
-realclean: distclean clean-dvi clean-info
-
-# GDB QUICK REFERENCE (dvi output)
-refcard.dvi : refcard.tex $(REFEDITS)
- if [ -z "$(REFEDITS)" ]; then \
- cp $(srcdir)/refcard.tex sedref.tex ; \
- else \
- echo > tmp.sed ; \
- for f in "$(REFEDITS)" ; do \
- cat $(srcdir)/$$f >>tmp.sed ; done ; \
- sed -f tmp.sed $(srcdir)/refcard.tex >sedref.tex ; \
- fi
- $(SET_TEXINPUTS) $(TEX) sedref.tex
- mv sedref.dvi refcard.dvi
- rm -f sedref.log sedref.tex tmp.sed
-
-refcard.ps : refcard.dvi
- dvips -t landscape refcard.dvi -o
-
-# File to record current GDB version number (copied from main dir Makefile.in)
-GDBvn.texi : ${gdbdir}/Makefile.in
- echo "@set GDBVN `sed <$(srcdir)/../Makefile.in -n 's/VERSION = //p'`" > ./GDBvn.new
- mv GDBvn.new GDBvn.texi
-
-# Updated atomically
-.PRECIOUS: GDBvn.texi
-
-# Choose configuration for GDB manual (normally `all'; normally not tied into
-# `configure' script because most users prefer generic version of manual,
-# not one for their binary config---which may not be specifically
-# defined anyways).
-gdb-cfg.texi: ${srcdir}/${DOC_CONFIG}-cfg.texi
- ln -s ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi || \
- ln ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi || \
- cp ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi
-
-# GDB MANUAL: texinfo source, using @set/@clear/@value/@ifset/@ifclear
-# If your texinfo or makeinfo don't support these, get a new texinfo release
-#
-# The nonsense with GDBvn.texi gets this to run with both Sun and GNU make.
-# Note that we can *generate* GDBvn.texi, but since we distribute one in the
-# source directory for the benefit of people who *don't* use this makefile,
-# VPATH will often tell make not to bother building it, because the one
-# in the srcdir is up to date. (if not, then make should build one here).
-
-# GDB MANUAL: TeX dvi file
-gdb.dvi: ${SFILES_DOC}
- if [ ! -f ./GDBvn.texi ]; then \
- ln -s $(srcdir)/GDBvn.texi . || \
- ln $(srcdir)/GDBvn.texi . || \
- cp $(srcdir)/GDBvn.texi . ; else true; fi
- $(SET_TEXINPUTS) $(TEX) gdb.texinfo
- $(SET_TEXINPUTS) $(TEX) gdb.texinfo
- $(TEXINDEX) gdb.??
- $(SET_TEXINPUTS) $(TEX) gdb.texinfo
- rm -f gdb.?? gdb.log gdb.aux gdb.toc gdb.??s
-
-# GDB MANUAL: info file
-# We're using texinfo2, and older makeinfo's may not be able to
-# cope with all the markup.
-gdb.info: ${SFILES_DOC}
- $(MAKEINFO) -I ${READLINE_DIR} -I $(srcdir) -o ./gdb.info gdb.texinfo
-
-# GDB MANUAL: roff translations
-# Try to use a recent texi2roff. v2 was put on prep in jan91.
-# If you want an index, see texi2roff doc for postprocessing
-# and add -i to texi2roff invocations below.
-# Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
-# corresponding -e lines when later texi2roff's are current)
-# + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
-# + @c's deleted explicitly because texi2roff sees texinfo commands in them
-# + @ (that's at-BLANK) not recognized by texi2roff, turned into blank
-# + @alphaenumerate is ridiculously new, turned into @enumerate
-
-# texi2roff doesn't have a notion of include dirs, so we have to fake
-# it out for gdb manual's include files---but only if not configured
-# in main sourcedir.
-links2roff: $(SFILES_INCLUDED)
- if [ ! -f gdb.texinfo ]; then \
- ln -s $(SFILES_INCLUDED) . || \
- ln $(SFILES_INCLUDED) . || \
- cp $(SFILES_INCLUDED) . ; \
- fi
- touch links2roff
-
-# "Readline" appendices. Get them also due to lack of includes,
-# regardless of whether or not configuring in main sourcedir.
-# @ftable removed due to bug in texi2roff-2; if your texi2roff
-# is newer, try just ln or cp
-rluser.texinfo: ${READLINE_DIR}/rluser.texinfo
- sed -e 's/^@ftable/@table/g' \
- -e 's/^@end ftable/@end table/g' \
- ${READLINE_DIR}/rluser.texinfo > ./rluser.texinfo
-
-inc-hist.texi: ${READLINE_DIR}/inc-hist.texi
- ln -s ${READLINE_DIR}/inc-hist.texi . || \
- ln ${READLINE_DIR}/inc-hist.texi . || \
- cp ${READLINE_DIR}/inc-hist.texi .
-
-# gdb manual suitable for [gtn]roff -me
-gdb.me: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
- sed -e '/\\input texinfo/d' \
- -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
- -e '/^@ifinfo/,/^@end ifinfo/d' \
- -e '/^@c /d' \
- -e 's/{.*,,/{/' \
- -e 's/@ / /g' \
- -e 's/^@alphaenumerate/@enumerate/g' \
- -e 's/^@end alphaenumerate/@end enumerate/g' \
- $(srcdir)/gdb.texinfo | \
- $(TEXI2ROFF) -me | \
- sed -e 's/---/\\(em/g' \
- >gdb.me
-
-# gdb manual suitable for [gtn]roff -ms
-gdb.ms: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
- sed -e '/\\input texinfo/d' \
- -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
- -e '/^@ifinfo/,/^@end ifinfo/d' \
- -e '/^@c /d' \
- -e 's/{.*,,/{/' \
- -e 's/@ / /g' \
- -e 's/^@alphaenumerate/@enumerate/g' \
- -e 's/^@end alphaenumerate/@end enumerate/g' \
- $(srcdir)/gdb.texinfo | \
- $(TEXI2ROFF) -ms | \
- sed -e 's/---/\\(em/g' \
- >gdb.ms
-
-# gdb manual suitable for [tn]roff -mm
-# '@noindent's removed due to texi2roff-2 mm bug; if yours is newer,
-# try leaving them in
-gdb.mm: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
- sed -e '/\\input texinfo/d' \
- -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
- -e '/^@ifinfo/,/^@end ifinfo/d' \
- -e '/^@c /d' \
- -e 's/{.*,,/{/' \
- -e '/@noindent/d' \
- -e 's/@ / /g' \
- -e 's/^@alphaenumerate/@enumerate/g' \
- -e 's/^@end alphaenumerate/@end enumerate/g' \
- $(srcdir)/gdb.texinfo | \
- $(TEXI2ROFF) -mm | \
- sed -e 's/---/\\(em/g' \
- >gdb.mm
-
-# GDB INTERNALS MANUAL: TeX dvi file
-gdbint.dvi : gdbint.texinfo
- $(SET_TEXINPUTS) $(TEX) gdbint.texinfo
- $(TEXINDEX) gdbint.??
- $(SET_TEXINPUTS) $(TEX) gdbint.texinfo
- rm -f gdbint.?? gdbint.aux gdbint.cps gdbint.fns gdbint.kys \
- gdbint.log gdbint.pgs gdbint.toc gdbint.tps gdbint.vrs
-
-# GDB INTERNALS MANUAL: info file
-gdb-internals: gdbint.info
-
-gdbint.info: gdbint.texinfo
- $(MAKEINFO) -o gdbint.info $(srcdir)/gdbint.texinfo
-
-stabs.info: stabs.texinfo
- $(MAKEINFO) -o stabs.info $(srcdir)/stabs.texinfo
-
-# STABS DOCUMENTATION: TeX dvi file
-stabs.dvi : stabs.texinfo
- $(SET_TEXINPUTS) $(TEX) stabs.texinfo
- $(TEXINDEX) stabs.??
- $(SET_TEXINPUTS) $(TEX) stabs.texinfo
- rm -f stabs.?? stabs.aux stabs.cps stabs.fns stabs.kys \
- stabs.log stabs.pgs stabs.toc stabs.tps stabs.vrs
-
-stabs.ps: stabs.dvi
- dvips -o stabs.ps stabs
-
-force:
-
-Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
- $(SHELL) ./config.status
diff --git a/gnu/usr.bin/gdb/doc/a4rc.sed b/gnu/usr.bin/gdb/doc/a4rc.sed
deleted file mode 100644
index 2292290..0000000
--- a/gnu/usr.bin/gdb/doc/a4rc.sed
+++ /dev/null
@@ -1,11 +0,0 @@
-/--- Papersize params:/,/--- end papersize params/c\
-%------- Papersize params:\
-%% A4 paper (297x210mm)\
-%%\
-\\totalwidth=297mm % total width of paper\
-\\totalheight=210mm % total height of paper\
-\\hmargin=5mm % horizontal margin width\
-\\vmargin=10mm % vertical margin width\
-\\secskip=.6pc % space between refcard secs\
-\\lskip=1pt % extra skip between \\sec entries\
-%------- end papersize params
diff --git a/gnu/usr.bin/gdb/doc/config.status b/gnu/usr.bin/gdb/doc/config.status
deleted file mode 100755
index 5d2c6dd..0000000
--- a/gnu/usr.bin/gdb/doc/config.status
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-# This file was generated automatically by configure. Do not edit.
-# This directory was configured as follows:
-../../configure --host=i386-unknown-freebsd --target=i386-unknown-freebsd -norecursion
-#
diff --git a/gnu/usr.bin/gdb/doc/configure.in b/gnu/usr.bin/gdb/doc/configure.in
deleted file mode 100644
index 1d2b47e..0000000
--- a/gnu/usr.bin/gdb/doc/configure.in
+++ /dev/null
@@ -1,7 +0,0 @@
-srcname="GDB doc"
-srctrigger=gdb.texinfo
-# per-host:
-# per-target:
-
-files=""
-links=""
diff --git a/gnu/usr.bin/gdb/doc/gdb.info b/gnu/usr.bin/gdb/doc/gdb.info
deleted file mode 100644
index c326469..0000000
--- a/gnu/usr.bin/gdb/doc/gdb.info
+++ /dev/null
@@ -1,213 +0,0 @@
-This is Info file ./gdb.info, produced by Makeinfo-1.52 from the input
-file gdb.texinfo.
-
-START-INFO-DIR-ENTRY
-* Gdb:: The GNU debugger.
-END-INFO-DIR-ENTRY
- This file documents the GNU debugger GDB.
-
- This is Edition 4.09, August 1993, of `Debugging with GDB: the GNU
-Source-Level Debugger' for GDB Version 4.11.
-
- Copyright (C) 1988, '89, '90, '91, '92, '93 Free Software
-Foundation, Inc.
-
- Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of
-this manual under the conditions for verbatim copying, provided also
-that the entire resulting derived work is distributed under the terms
-of a permission notice identical to this one.
-
- Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions.
-
-
-Indirect:
-gdb.info-1: 992
-gdb.info-2: 50863
-gdb.info-3: 98423
-gdb.info-4: 145674
-gdb.info-5: 194815
-gdb.info-6: 244253
-gdb.info-7: 290141
-gdb.info-8: 335234
-
-Tag Table:
-(Indirect)
-Node: Top992
-Node: Summary2561
-Node: Free Software3754
-Node: Contributors4492
-Node: New Features8199
-Node: Sample Session12215
-Node: Invocation19094
-Node: Invoking GDB19559
-Node: File Options21298
-Node: Mode Options24476
-Node: Quitting GDB26641
-Node: Shell Commands27359
-Node: Commands28106
-Node: Command Syntax28739
-Node: Completion30598
-Node: Help34666
-Node: Running38442
-Node: Compilation39426
-Node: Starting41224
-Node: Arguments44411
-Node: Environment45412
-Node: Working Directory48518
-Node: Input/Output49258
-Node: Attach50863
-Node: Kill Process53122
-Node: Process Information54097
-Node: Stopping55350
-Node: Breakpoints56423
-Node: Set Breaks58622
-Node: Set Watchpoints65221
-Node: Exception Handling66051
-Node: Delete Breaks68610
-Node: Disabling70238
-Node: Conditions72881
-Node: Break Commands77378
-Node: Breakpoint Menus80225
-Node: Error in Breakpoints81935
-Node: Continuing and Stepping82839
-Node: Signals89318
-Node: Stack92940
-Node: Frames94414
-Node: Backtrace96691
-Node: Selection98423
-Node: Frame Info100917
-Node: MIPS Stack102984
-Node: Source103857
-Node: List104806
-Node: Search108286
-Node: Source Path109085
-Node: Machine Code111763
-Node: Data114236
-Node: Expressions116111
-Node: Variables117793
-Node: Arrays120314
-Node: Output Formats122397
-Node: Memory124456
-Node: Auto Display128727
-Node: Print Settings132474
-Node: Value History140630
-Node: Convenience Vars143017
-Node: Registers145674
-Node: Floating Point Hardware150276
-Node: Languages150781
-Node: Setting151949
-Node: Manually152483
-Node: Automatically153663
-Node: Show154980
-Node: Checks155888
-Node: Type Checking157244
-Node: Range Checking159924
-Node: Support162265
-Node: C163185
-Node: C Operators164016
-Node: C Constants168071
-Node: Cplus expressions169974
-Node: C Defaults172597
-Node: C Checks173215
-Node: Debugging C173926
-Node: Debugging C plus plus174404
-Node: Modula-2176416
-Node: M2 Operators177308
-Node: Built-In Func/Proc180308
-Node: M2 Constants183051
-Node: M2 Defaults184640
-Node: Deviations185239
-Node: M2 Checks186330
-Node: M2 Scope187130
-Node: GDB/M2188142
-Node: Symbols189081
-Node: Altering194815
-Node: Assignment195797
-Node: Jumping197907
-Node: Signaling199914
-Node: Returning201034
-Node: Calling202226
-Node: Patching202700
-Node: GDB Files203782
-Node: Files204247
-Node: Symbol Errors214466
-Node: Targets218064
-Node: Active Targets218954
-Node: Target Commands220530
-Node: Remote223904
-Node: Remote Serial225315
-Node: Stub Contents227768
-Node: Bootstrapping229877
-Node: Debug Session233057
-Node: Protocol236218
-Node: Server239069
-Node: i960-Nindy Remote242748
-Node: Nindy Startup243568
-Node: Nindy Options244253
-Node: Nindy Reset245867
-Node: UDI29K Remote246251
-Node: EB29K Remote247172
-Node: Comms (EB29K)248006
-Node: gdb-EB29K251189
-Node: Remote Log252555
-Node: ST2000 Remote253030
-Node: VxWorks Remote254499
-Node: VxWorks Connection256224
-Node: VxWorks Download257150
-Node: VxWorks Attach258886
-Node: Hitachi Remote259281
-Node: MIPS Remote260790
-Node: Simulator262861
-Node: Controlling GDB264351
-Node: Prompt264962
-Node: Editing265571
-Node: History266338
-Node: Screen Size269024
-Node: Numbers270420
-Node: Messages/Warnings271538
-Node: Sequences274587
-Node: Define275147
-Node: Hooks277144
-Node: Command Files278547
-Node: Output280302
-Node: Emacs282714
-Node: GDB Bugs288669
-Node: Bug Criteria289387
-Node: Bug Reporting290141
-Node: Command Line Editing297342
-Node: Introduction and Notation297763
-Node: Readline Interaction298780
-Node: Readline Bare Essentials299914
-Node: Readline Movement Commands301417
-Node: Readline Killing Commands302303
-Node: Readline Arguments303941
-Node: Readline Init File304887
-Node: Readline Init Syntax305708
-Node: Commands For Moving309640
-Node: Commands For History310260
-Node: Commands For Text311330
-Node: Commands For Killing313046
-Node: Numeric Arguments314168
-Node: Commands For Completion314606
-Node: Miscellaneous Commands315325
-Node: Readline Vi Mode316077
-Node: Using History Interactively316784
-Node: History Interaction317141
-Node: Event Designators318189
-Node: Word Designators318828
-Node: Modifiers319724
-Node: Renamed Commands320469
-Node: Formatting Documentation322131
-Node: Installing GDB325465
-Node: Separate Objdir328945
-Node: Config Names331490
-Node: configure Options332918
-Node: Index335234
-
-End Tag Table
diff --git a/gnu/usr.bin/gdb/doc/gdb.info-1 b/gnu/usr.bin/gdb/doc/gdb.info-1
deleted file mode 100644
index a1d7120..0000000
--- a/gnu/usr.bin/gdb/doc/gdb.info-1
+++ /dev/null
@@ -1,1304 +0,0 @@
-This is Info file ./gdb.info, produced by Makeinfo-1.52 from the input
-file gdb.texinfo.
-
-START-INFO-DIR-ENTRY
-* Gdb:: The GNU debugger.
-END-INFO-DIR-ENTRY
- This file documents the GNU debugger GDB.
-
- This is Edition 4.09, August 1993, of `Debugging with GDB: the GNU
-Source-Level Debugger' for GDB Version 4.11.
-
- Copyright (C) 1988, '89, '90, '91, '92, '93 Free Software
-Foundation, Inc.
-
- Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of
-this manual under the conditions for verbatim copying, provided also
-that the entire resulting derived work is distributed under the terms
-of a permission notice identical to this one.
-
- Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions.
-
-
-File: gdb.info, Node: Top, Next: Summary, Prev: (DIR), Up: (DIR)
-
-Debugging with GDB
-******************
-
- This file describes GDB, the GNU symbolic debugger.
-
- This is Edition 4.09, August 1993, for GDB Version 4.11.
-
-* Menu:
-
-* Summary:: Summary of GDB
-
-* New Features:: New features since GDB version 3.5
-
-* Sample Session:: A sample GDB session
-
-* Invocation:: Getting in and out of GDB
-* Commands:: GDB commands
-* Running:: Running programs under GDB
-* Stopping:: Stopping and continuing
-* Stack:: Examining the stack
-* Source:: Examining source files
-* Data:: Examining data
-
-* Languages:: Using GDB with different languages
-
-
-* Symbols:: Examining the symbol table
-* Altering:: Altering execution
-* GDB Files:: GDB files
-* Targets:: Specifying a debugging target
-* Controlling GDB:: Controlling GDB
-* Sequences:: Canned sequences of commands
-
-* Emacs:: Using GDB under GNU Emacs
-
-* GDB Bugs:: Reporting bugs in GDB
-* Command Line Editing:: Facilities of the readline library
-* Using History Interactively::
-
-* Renamed Commands::
-
-* Formatting Documentation:: How to format and print GDB documentation
-* Installing GDB:: Installing GDB
-
-* Index:: Index
-
-
-File: gdb.info, Node: Summary, Next: New Features, Prev: Top, Up: Top
-
-Summary of GDB
-**************
-
- The purpose of a debugger such as GDB is to allow you to see what is
-going on "inside" another program while it executes--or what another
-program was doing at the moment it crashed.
-
- GDB can do four main kinds of things (plus other things in support of
-these) to help you catch bugs in the act:
-
- * Start your program, specifying anything that might affect its
- behavior.
-
- * Make your program stop on specified conditions.
-
- * Examine what has happened, when your program has stopped.
-
- * Change things in your program, so you can experiment with
- correcting the effects of one bug and go on to learn about another.
-
- You can use GDB to debug programs written in C, C++, and Modula-2.
-G{No Value For "DBN"} can be used to debug programs written in Fortran,
-although it does not yet support entering expressions, printing values,
-etc. using Fortran syntax. It may be necessary to refer to some
-variables with a trailing underscore.
-
-* Menu:
-
-* Free Software:: Freely redistributable software
-* Contributors:: Contributors to GDB
-
-
-File: gdb.info, Node: Free Software, Next: Contributors, Up: Summary
-
-Free software
-=============
-
- GDB is "free software", protected by the GNU General Public License
-(GPL). The GPL gives you the freedom to copy or adapt a licensed
-program--but every person getting a copy also gets with it the freedom
-to modify that copy (which means that they must get access to the
-source code), and the freedom to distribute further copies. Typical
-software companies use copyrights to limit your freedoms; the Free
-Software Foundation uses the GPL to preserve these freedoms.
-
- Fundamentally, the General Public License is a license which says
-that you have these freedoms and that you cannot take these freedoms
-away from anyone else.
-
-
-File: gdb.info, Node: Contributors, Prev: Free Software, Up: Summary
-
-Contributors to GDB
-===================
-
- Richard Stallman was the original author of GDB, and of many other
-GNU programs. Many others have contributed to its development. This
-section attempts to credit major contributors. One of the virtues of
-free software is that everyone is free to contribute to it; with
-regret, we cannot actually acknowledge everyone here. The file
-`ChangeLog' in the GDB distribution approximates a blow-by-blow account.
-
- Changes much prior to version 2.0 are lost in the mists of time.
-
- *Plea:* Additions to this section are particularly welcome. If you
- or your friends (or enemies, to be evenhanded) have been unfairly
- omitted from this list, we would like to add your names!
-
- So that they may not regard their long labor as thankless, we
-particularly thank those who shepherded GDB through major releases: Fred
-Fish (releases 4.11, 4.10, 4.9), Stu Grossman and John Gilmore (releases
-4.8, 4.7, 4.6, 4.5, 4.4), John Gilmore (releases 4.3, 4.2, 4.1, 4.0, and
-3.9); Jim Kingdon (releases 3.5, 3.4, 3.3); and Randy Smith (releases
-3.2, 3.1, 3.0). As major maintainer of GDB for some period, each
-contributed significantly to the structure, stability, and capabilities
-of the entire debugger.
-
- Richard Stallman, assisted at various times by Peter TerMaat, Chris
-Hanson, and Richard Mlynarik, handled releases through 2.8.
-
- Michael Tiemann is the author of most of the GNU C++ support in GDB,
-with significant additional contributions from Per Bothner. James
-Clark wrote the GNU C++ demangler. Early work on C++ was by Peter
-TerMaat (who also did much general update work leading to release 3.0).
-
- GDB 4 uses the BFD subroutine library to examine multiple
-object-file formats; BFD was a joint project of David V.
-Henkel-Wallace, Rich Pixley, Steve Chamberlain, and John Gilmore.
-
- David Johnson wrote the original COFF support; Pace Willison did the
-original support for encapsulated COFF.
-
- Adam de Boor and Bradley Davis contributed the ISI Optimum V support.
-Per Bothner, Noboyuki Hikichi, and Alessandro Forin contributed MIPS
-support. Jean-Daniel Fekete contributed Sun 386i support. Chris
-Hanson improved the HP9000 support. Noboyuki Hikichi and Tomoyuki
-Hasei contributed Sony/News OS 3 support. David Johnson contributed
-Encore Umax support. Jyrki Kuoppala contributed Altos 3068 support.
-Keith Packard contributed NS32K support. Doug Rabson contributed Acorn
-Risc Machine support. Chris Smith contributed Convex support (and
-Fortran debugging). Jonathan Stone contributed Pyramid support.
-Michael Tiemann contributed SPARC support. Tim Tucker contributed
-support for the Gould NP1 and Gould Powernode. Pace Willison
-contributed Intel 386 support. Jay Vosburgh contributed Symmetry
-support.
-
- Rich Schaefer and Peter Schauer helped with support of SunOS shared
-libraries.
-
- Jay Fenlason and Roland McGrath ensured that GDB and GAS agree about
-several machine instruction sets.
-
- Patrick Duval, Ted Goldstein, Vikram Koka and Glenn Engel helped
-develop remote debugging. Intel Corporation and Wind River Systems
-contributed remote debugging modules for their products.
-
- Brian Fox is the author of the readline libraries providing
-command-line editing and command history.
-
- Andrew Beers of SUNY Buffalo wrote the language-switching code, the
-Modula-2 support, and contributed the Languages chapter of this manual.
-
- Fred Fish wrote most of the support for Unix System Vr4. He also
-enhanced the command-completion support to cover C++ overloaded symbols.
-
- Hitachi America, Ltd. sponsored the support for Hitachi
-microprocessors.
-
-
-File: gdb.info, Node: New Features, Next: Sample Session, Prev: Summary, Up: Top
-
-New Features since GDB Version 3.5
-**********************************
-
-*Targets*
- Using the new command `target', you can select at runtime whether
- you are debugging local files, local processes, standalone systems
- over a serial port, realtime systems over a TCP/IP connection,
- etc. The command `load' can download programs into a remote
- system. Serial stubs are available for Motorola 680x0, Intel
- 80386, and Sparc remote systems; GDB also supports debugging
- realtime processes running under VxWorks, using SunRPC Remote
- Procedure Calls over TCP/IP to talk to a debugger stub on the
- target system. Internally, GDB now uses a function vector to
- mediate access to different targets; if you need to add your own
- support for a remote protocol, this makes it much easier.
-
-*Watchpoints*
- GDB now sports watchpoints as well as breakpoints. You can use a
- watchpoint to stop execution whenever the value of an expression
- changes, without having to predict a particular place in your
- program where this may happen.
-
-*Wide Output*
- Commands that issue wide output now insert newlines at places
- designed to make the output more readable.
-
-*Object Code Formats*
- GDB uses a new library called the Binary File Descriptor (BFD)
- Library to permit it to switch dynamically, without
- reconfiguration or recompilation, between different object-file
- formats. Formats currently supported are COFF, ELF, a.out, Intel
- 960 b.out, MIPS ECOFF, HPPA SOM (with stabs debugging), and
- S-records; files may be read as .o files, archive libraries, or
- core dumps. BFD is available as a subroutine library so that
- other programs may take advantage of it, and the other GNU binary
- utilities are being converted to use it.
-
-*Configuration and Ports*
- Compile-time configuration (to select a particular architecture and
- operating system) is much easier. The script `configure' now
- allows you to configure GDB as either a native debugger or a
- cross-debugger. *Note Installing GDB::, for details on how to
- configure.
-
-*Interaction*
- The user interface to the GDB control variables is simpler, and is
- consolidated in two commands, `set' and `show'. Output lines are
- now broken at readable places, rather than overflowing onto the
- next line. You can suppress output of machine-level addresses,
- displaying only source language information.
-
-*C++*
- GDB now supports C++ multiple inheritance (if used with a GCC
- version 2 compiler), and also has limited support for C++ exception
- handling, with the commands `catch' and `info catch': GDB can
- break when an exception is raised, before the stack is peeled back
- to the exception handler's context.
-
-*Modula-2*
- GDB now has preliminary support for the GNU Modula-2 compiler,
- currently under development at the State University of New York at
- Buffalo. Coordinated development of both GDB and the GNU Modula-2
- compiler will continue. Other Modula-2 compilers are currently
- not supported, and attempting to debug programs compiled with them
- will likely result in an error as the symbol table of the
- executable is read in.
-
-*Command Rationalization*
- Many GDB commands have been renamed to make them easier to remember
- and use. In particular, the subcommands of `info' and
- `show'/`set' are grouped to make the former refer to the state of
- your program, and the latter refer to the state of GDB itself.
- *Note Renamed Commands::, for details on what commands were
- renamed.
-
-*Shared Libraries*
- GDB 4 can debug programs and core files that use SunOS, SVR4, or
- IBM RS/6000 shared libraries.
-
-*Reference Card*
- GDB 4 has a reference card. *Note Formatting the Documentation:
- Formatting Documentation, for instructions about how to print it.
-
-
-File: gdb.info, Node: Sample Session, Next: Invocation, Prev: New Features, Up: Top
-
-A Sample GDB Session
-********************
-
- You can use this manual at your leisure to read all about GDB.
-However, a handful of commands are enough to get started using the
-debugger. This chapter illustrates those commands.
-
- One of the preliminary versions of GNU `m4' (a generic macro
-processor) exhibits the following bug: sometimes, when we change its
-quote strings from the default, the commands used to capture one macro
-definition within another stop working. In the following short `m4'
-session, we define a macro `foo' which expands to `0000'; we then use
-the `m4' built-in `defn' to define `bar' as the same thing. However,
-when we change the open quote string to `<QUOTE>' and the close quote
-string to `<UNQUOTE>', the same procedure fails to define a new synonym
-`baz':
-
- $ cd gnu/m4
- $ ./m4
- define(foo,0000)
-
- foo
- 0000
- define(bar,defn(`foo'))
-
- bar
- 0000
- changequote(<QUOTE>,<UNQUOTE>)
-
- define(baz,defn(<QUOTE>foo<UNQUOTE>))
- baz
- C-d
- m4: End of input: 0: fatal error: EOF in string
-
-Let us use GDB to try to see what is going on.
-
- $ gdb m4
- GDB is free software and you are welcome to distribute copies
- of it under certain conditions; type "show copying" to see
- the conditions.
- There is absolutely no warranty for GDB; type "show warranty"
- for details.
- GDB 4.11, Copyright 1993 Free Software Foundation, Inc...
- (gdb)
-
-GDB reads only enough symbol data to know where to find the rest when
-needed; as a result, the first prompt comes up very quickly. We now
-tell GDB to use a narrower display width than usual, so that examples
-will fit in this manual.
-
- (gdb) set width 70
-
-We need to see how the `m4' built-in `changequote' works. Having
-looked at the source, we know the relevant subroutine is
-`m4_changequote', so we set a breakpoint there with the GDB `break'
-command.
-
- (gdb) break m4_changequote
- Breakpoint 1 at 0x62f4: file builtin.c, line 879.
-
-Using the `run' command, we start `m4' running under GDB control; as
-long as control does not reach the `m4_changequote' subroutine, the
-program runs as usual:
-
- (gdb) run
- Starting program: /work/Editorial/gdb/gnu/m4/m4
- define(foo,0000)
-
- foo
- 0000
-
-To trigger the breakpoint, we call `changequote'. GDB suspends
-execution of `m4', displaying information about the context where it
-stops.
-
- changequote(<QUOTE>,<UNQUOTE>)
-
- Breakpoint 1, m4_changequote (argc=3, argv=0x33c70)
- at builtin.c:879
- 879 if (bad_argc(TOKEN_DATA_TEXT(argv[0]),argc,1,3))
-
-Now we use the command `n' (`next') to advance execution to the next
-line of the current function.
-
- (gdb) n
- 882 set_quotes((argc >= 2) ? TOKEN_DATA_TEXT(argv[1])\
- : nil,
-
-`set_quotes' looks like a promising subroutine. We can go into it by
-using the command `s' (`step') instead of `next'. `step' goes to the
-next line to be executed in *any* subroutine, so it steps into
-`set_quotes'.
-
- (gdb) s
- set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>")
- at input.c:530
- 530 if (lquote != def_lquote)
-
-The display that shows the subroutine where `m4' is now suspended (and
-its arguments) is called a stack frame display. It shows a summary of
-the stack. We can use the `backtrace' command (which can also be
-spelled `bt'), to see where we are in the stack as a whole: the
-`backtrace' command displays a stack frame for each active subroutine.
-
- (gdb) bt
- #0 set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>")
- at input.c:530
- #1 0x6344 in m4_changequote (argc=3, argv=0x33c70)
- at builtin.c:882
- #2 0x8174 in expand_macro (sym=0x33320) at macro.c:242
- #3 0x7a88 in expand_token (obs=0x0, t=209696, td=0xf7fffa30)
- at macro.c:71
- #4 0x79dc in expand_input () at macro.c:40
- #5 0x2930 in main (argc=0, argv=0xf7fffb20) at m4.c:195
-
-We will step through a few more lines to see what happens. The first
-two times, we can use `s'; the next two times we use `n' to avoid
-falling into the `xstrdup' subroutine.
-
- (gdb) s
- 0x3b5c 532 if (rquote != def_rquote)
- (gdb) s
- 0x3b80 535 lquote = (lq == nil || *lq == '\0') ? \
- def_lquote : xstrdup(lq);
- (gdb) n
- 536 rquote = (rq == nil || *rq == '\0') ? def_rquote\
- : xstrdup(rq);
- (gdb) n
- 538 len_lquote = strlen(rquote);
-
-The last line displayed looks a little odd; we can examine the variables
-`lquote' and `rquote' to see if they are in fact the new left and right
-quotes we specified. We use the command `p' (`print') to see their
-values.
-
- (gdb) p lquote
- $1 = 0x35d40 "<QUOTE>"
- (gdb) p rquote
- $2 = 0x35d50 "<UNQUOTE>"
-
-`lquote' and `rquote' are indeed the new left and right quotes. To
-look at some context, we can display ten lines of source surrounding
-the current line with the `l' (`list') command.
-
- (gdb) l
- 533 xfree(rquote);
- 534
- 535 lquote = (lq == nil || *lq == '\0') ? def_lquote\
- : xstrdup (lq);
- 536 rquote = (rq == nil || *rq == '\0') ? def_rquote\
- : xstrdup (rq);
- 537
- 538 len_lquote = strlen(rquote);
- 539 len_rquote = strlen(lquote);
- 540 }
- 541
- 542 void
-
-Let us step past the two lines that set `len_lquote' and `len_rquote',
-and then examine the values of those variables.
-
- (gdb) n
- 539 len_rquote = strlen(lquote);
- (gdb) n
- 540 }
- (gdb) p len_lquote
- $3 = 9
- (gdb) p len_rquote
- $4 = 7
-
-That certainly looks wrong, assuming `len_lquote' and `len_rquote' are
-meant to be the lengths of `lquote' and `rquote' respectively. We can
-set them to better values using the `p' command, since it can print the
-value of any expression--and that expression can include subroutine
-calls and assignments.
-
- (gdb) p len_lquote=strlen(lquote)
- $5 = 7
- (gdb) p len_rquote=strlen(rquote)
- $6 = 9
-
-Is that enough to fix the problem of using the new quotes with the `m4'
-built-in `defn'? We can allow `m4' to continue executing with the `c'
-(`continue') command, and then try the example that caused trouble
-initially:
-
- (gdb) c
- Continuing.
-
- define(baz,defn(<QUOTE>foo<UNQUOTE>))
-
- baz
- 0000
-
-Success! The new quotes now work just as well as the default ones. The
-problem seems to have been just the two typos defining the wrong
-lengths. We allow `m4' exit by giving it an EOF as input:
-
- C-d
- Program exited normally.
-
-The message `Program exited normally.' is from GDB; it indicates `m4'
-has finished executing. We can end our GDB session with the GDB `quit'
-command.
-
- (gdb) quit
-
-
-File: gdb.info, Node: Invocation, Next: Commands, Prev: Sample Session, Up: Top
-
-Getting In and Out of GDB
-*************************
-
- This chapter discusses how to start GDB, and how to get out of it.
-(The essentials: type `gdb' to start GDB, and type `quit' or `C-d' to
-exit.)
-
-* Menu:
-
-* Invoking GDB:: How to start GDB
-* Quitting GDB:: How to quit GDB
-* Shell Commands:: How to use shell commands inside GDB
-
-
-File: gdb.info, Node: Invoking GDB, Next: Quitting GDB, Up: Invocation
-
-Invoking GDB
-============
-
- Invoke GDB by running the program `gdb'. Once started, GDB reads
-commands from the terminal until you tell it to exit.
-
- You can also run `gdb' with a variety of arguments and options, to
-specify more of your debugging environment at the outset.
-
- The command-line options described here are designed to cover a
-variety of situations; in some environments, some of these options may
-effectively be unavailable.
-
- The most usual way to start GDB is with one argument, specifying an
-executable program:
-
- gdb PROGRAM
-
-You can also start with both an executable program and a core file
-specified:
-
- gdb PROGRAM CORE
-
- You can, instead, specify a process ID as a second argument, if you
-want to debug a running process:
-
- gdb PROGRAM 1234
-
-would attach GDB to process `1234' (unless you also have a file named
-`1234'; GDB does check for a core file first).
-
- Taking advantage of the second command-line argument requires a
-fairly complete operating system; when you use GDB as a remote debugger
-attached to a bare board, there may not be any notion of "process", and
-there is often no way to get a core dump.
-
-You can further control how GDB starts up by using command-line
-options. GDB itself can remind you of the options available.
-
-Type
-
- gdb -help
-
-to display all available options and briefly describe their use (`gdb
--h' is a shorter equivalent).
-
- All options and command line arguments you give are processed in
-sequential order. The order makes a difference when the `-x' option is
-used.
-
-* Menu:
-
-
-
-* File Options:: Choosing files
-* Mode Options:: Choosing modes
-
-
-File: gdb.info, Node: File Options, Next: Mode Options, Up: Invoking GDB
-
-Choosing files
---------------
-
- When GDB starts, it reads any arguments other than options as
-specifying an executable file and core file (or process ID). This is
-the same as if the arguments were specified by the `-se' and `-c'
-options respectively. (GDB reads the first argument that does not have
-an associated option flag as equivalent to the `-se' option followed by
-that argument; and the second argument that does not have an associated
-option flag, if any, as equivalent to the `-c' option followed by that
-argument.)
-
- Many options have both long and short forms; both are shown in the
-following list. GDB also recognizes the long forms if you truncate
-them, so long as enough of the option is present to be unambiguous.
-(If you prefer, you can flag option arguments with `--' rather than
-`-', though we illustrate the more usual convention.)
-
-`-symbols FILE'
-`-s FILE'
- Read symbol table from file FILE.
-
-`-exec FILE'
-`-e FILE'
- Use file FILE as the executable file to execute when appropriate,
- and for examining pure data in conjunction with a core dump.
-
-`-se FILE'
- Read symbol table from file FILE and use it as the executable file.
-
-`-core FILE'
-`-c FILE'
- Use file FILE as a core dump to examine.
-
-`-c NUMBER'
- Connect to process ID NUMBER, as with the `attach' command (unless
- there is a file in core-dump format named NUMBER, in which case
- `-c' specifies that file as a core dump to read).
-
-`-command FILE'
-`-x FILE'
- Execute GDB commands from file FILE. *Note Command files: Command
- Files.
-
-`-directory DIRECTORY'
-`-d DIRECTORY'
- Add DIRECTORY to the path to search for source files.
-
-`-m'
-`-mapped'
- *Warning: this option depends on operating system facilities that
- are not supported on all systems.*
- If memory-mapped files are available on your system through the
- `mmap' system call, you can use this option to have GDB write the
- symbols from your program into a reusable file in the current
- directory. If the program you are debugging is called
- `/tmp/fred', the mapped symbol file will be `./fred.syms'. Future
- GDB debugging sessions will notice the presence of this file, and
- will quickly map in symbol information from it, rather than reading
- the symbol table from the executable program.
-
- The `.syms' file is specific to the host machine where GDB is run.
- It holds an exact image of the internal GDB symbol table. It
- cannot be shared across multiple host platforms.
-
-`-r'
-`-readnow'
- Read each symbol file's entire symbol table immediately, rather
- than the default, which is to read it incrementally as it is
- needed. This makes startup slower, but makes future operations
- faster.
-
- The `-mapped' and `-readnow' options are typically combined in order
-to build a `.syms' file that contains complete symbol information.
-(*Note Commands to specify files: Files, for information on `.syms'
-files.) A simple GDB invocation to do nothing but build a `.syms' file
-for future use is:
-
- gdb -batch -nx -mapped -readnow programname
-
-
-File: gdb.info, Node: Mode Options, Prev: File Options, Up: Invoking GDB
-
-Choosing modes
---------------
-
- You can run GDB in various alternative modes--for example, in batch
-mode or quiet mode.
-
-`-nx'
-`-n'
- Do not execute commands from any initialization files (normally
- called `.gdbinit'). Normally, the commands in these files are
- executed after all the command options and arguments have been
- processed. *Note Command files: Command Files.
-
-`-quiet'
-`-q'
- "Quiet". Do not print the introductory and copyright messages.
- These messages are also suppressed in batch mode.
-
-`-batch'
- Run in batch mode. Exit with status `0' after processing all the
- command files specified with `-x' (and all commands from
- initialization files, if not inhibited with `-n'). Exit with
- nonzero status if an error occurs in executing the GDB commands in
- the command files.
-
- Batch mode may be useful for running GDB as a filter, for example
- to download and run a program on another computer; in order to
- make this more useful, the message
-
- Program exited normally.
-
- (which is ordinarily issued whenever a program running under GDB
- control terminates) is not issued when running in batch mode.
-
-`-cd DIRECTORY'
- Run GDB using DIRECTORY as its working directory, instead of the
- current directory.
-
-`-fullname'
-`-f'
- Emacs sets this option when it runs GDB as a subprocess. It tells
- GDB to output the full file name and line number in a standard,
- recognizable fashion each time a stack frame is displayed (which
- includes each time your program stops). This recognizable format
- looks like two `\032' characters, followed by the file name, line
- number and character position separated by colons, and a newline.
- The Emacs-to-GDB interface program uses the two `\032' characters
- as a signal to display the source code for the frame.
-
-`-b BPS'
- Set the line speed (baud rate or bits per second) of any serial
- interface used by GDB for remote debugging.
-
-`-tty DEVICE'
- Run using DEVICE for your program's standard input and output.
-
-
-File: gdb.info, Node: Quitting GDB, Next: Shell Commands, Prev: Invoking GDB, Up: Invocation
-
-Quitting GDB
-============
-
-`quit'
- To exit GDB, use the `quit' command (abbreviated `q'), or type an
- end-of-file character (usually `C-d').
-
- An interrupt (often `C-c') will not exit from GDB, but rather will
-terminate the action of any GDB command that is in progress and return
-to GDB command level. It is safe to type the interrupt character at
-any time because GDB does not allow it to take effect until a time when
-it is safe.
-
- If you have been using GDB to control an attached process or device,
-you can release it with the `detach' command (*note Debugging an
-already-running process: Attach.).
-
-
-File: gdb.info, Node: Shell Commands, Prev: Quitting GDB, Up: Invocation
-
-Shell commands
-==============
-
- If you need to execute occasional shell commands during your
-debugging session, there is no need to leave or suspend GDB; you can
-just use the `shell' command.
-
-`shell COMMAND STRING'
- Invoke a the standard shell to execute COMMAND STRING. If it
- exists, the environment variable `SHELL' determines which shell to
- run. Otherwise GDB uses `/bin/sh'.
-
- The utility `make' is often needed in development environments. You
-do not have to use the `shell' command for this purpose in GDB:
-
-`make MAKE-ARGS'
- Execute the `make' program with the specified arguments. This is
- equivalent to `shell make MAKE-ARGS'.
-
-
-File: gdb.info, Node: Commands, Next: Running, Prev: Invocation, Up: Top
-
-GDB Commands
-************
-
- You can abbreviate a GDB command to the first few letters of the
-command name, if that abbreviation is unambiguous; and you can repeat
-certain GDB commands by typing just RET. You can also use the TAB key
-to get GDB to fill out the rest of a word in a command (or to show you
-the alternatives available, if there is more than one possibility).
-
-* Menu:
-
-* Command Syntax:: How to give commands to GDB
-* Completion:: Command completion
-* Help:: How to ask GDB for help
-
-
-File: gdb.info, Node: Command Syntax, Next: Completion, Up: Commands
-
-Command syntax
-==============
-
- A GDB command is a single line of input. There is no limit on how
-long it can be. It starts with a command name, which is followed by
-arguments whose meaning depends on the command name. For example, the
-command `step' accepts an argument which is the number of times to
-step, as in `step 5'. You can also use the `step' command with no
-arguments. Some command names do not allow any arguments.
-
- GDB command names may always be truncated if that abbreviation is
-unambiguous. Other possible command abbreviations are listed in the
-documentation for individual commands. In some cases, even ambiguous
-abbreviations are allowed; for example, `s' is specially defined as
-equivalent to `step' even though there are other commands whose names
-start with `s'. You can test abbreviations by using them as arguments
-to the `help' command.
-
- A blank line as input to GDB (typing just RET) means to repeat the
-previous command. Certain commands (for example, `run') will not repeat
-this way; these are commands for which unintentional repetition might
-cause trouble and which you are unlikely to want to repeat.
-
- The `list' and `x' commands, when you repeat them with RET,
-construct new arguments rather than repeating exactly as typed. This
-permits easy scanning of source or memory.
-
- GDB can also use RET in another way: to partition lengthy output, in
-a way similar to the common utility `more' (*note Screen size: Screen
-Size.). Since it is easy to press one RET too many in this situation,
-GDB disables command repetition after any command that generates this
-sort of display.
-
- Any text from a `#' to the end of the line is a comment; it does
-nothing. This is useful mainly in command files (*note Command files:
-Command Files.).
-
-
-File: gdb.info, Node: Completion, Next: Help, Prev: Command Syntax, Up: Commands
-
-Command completion
-==================
-
- GDB can fill in the rest of a word in a command for you, if there is
-only one possibility; it can also show you what the valid possibilities
-are for the next word in a command, at any time. This works for GDB
-commands, GDB subcommands, and the names of symbols in your program.
-
- Press the TAB key whenever you want GDB to fill out the rest of a
-word. If there is only one possibility, GDB will fill in the word, and
-wait for you to finish the command (or press RET to enter it). For
-example, if you type
-
- (gdb) info bre TAB
-
-GDB fills in the rest of the word `breakpoints', since that is the only
-`info' subcommand beginning with `bre':
-
- (gdb) info breakpoints
-
-You can either press RET at this point, to run the `info breakpoints'
-command, or backspace and enter something else, if `breakpoints' does
-not look like the command you expected. (If you were sure you wanted
-`info breakpoints' in the first place, you might as well just type RET
-immediately after `info bre', to exploit command abbreviations rather
-than command completion).
-
- If there is more than one possibility for the next word when you
-press TAB, GDB will sound a bell. You can either supply more
-characters and try again, or just press TAB a second time, and GDB will
-display all the possible completions for that word. For example, you
-might want to set a breakpoint on a subroutine whose name begins with
-`make_', but when you type `b make_TAB' GDB just sounds the bell.
-Typing TAB again will display all the function names in your program
-that begin with those characters, for example:
-
- (gdb) b make_ TAB
-GDB sounds bell; press TAB again, to see:
- make_a_section_from_file make_environ
- make_abs_section make_function_type
- make_blockvector make_pointer_type
- make_cleanup make_reference_type
- make_command make_symbol_completion_list
- (gdb) b make_
-
-After displaying the available possibilities, GDB copies your partial
-input (`b make_' in the example) so you can finish the command.
-
- If you just want to see the list of alternatives in the first place,
-you can press `M-?' rather than pressing TAB twice. `M-?' means `META
-?'. You can type this either by holding down a key designated as the
-META shift on your keyboard (if there is one) while typing `?', or as
-ESC followed by `?'.
-
- Sometimes the string you need, while logically a "word", may contain
-parentheses or other characters that GDB normally excludes from its
-notion of a word. To permit word completion to work in this situation,
-you may enclose words in `'' (single quote marks) in GDB commands.
-
- The most likely situation where you might need this is in typing the
-name of a C++ function. This is because C++ allows function overloading
-(multiple definitions of the same function, distinguished by argument
-type). For example, when you want to set a breakpoint you may need to
-distinguish whether you mean the version of `name' that takes an `int'
-parameter, `name(int)', or the version that takes a `float' parameter,
-`name(float)'. To use the word-completion facilities in this
-situation, type a single quote `'' at the beginning of the function
-name. This alerts GDB that it may need to consider more information
-than usual when you press TAB or `M-?' to request word completion:
-
- (gdb) b 'bubble( M-?
- bubble(double,double) bubble(int,int)
- (gdb) b 'bubble(
-
- In some cases, GDB can tell that completing a name will require
-quotes. When this happens, GDB will insert the quote for you (while
-completing as much as it can) if you do not type the quote in the first
-place:
-
- (gdb) b bub TAB
-GDB alters your input line to the following, and rings a bell:
- (gdb) b 'bubble(
-
-In general, GDB can tell that a quote is needed (and inserts it) if you
-have not yet started typing the argument list when you ask for
-completion on an overloaded symbol.
-
-
-File: gdb.info, Node: Help, Prev: Completion, Up: Commands
-
-Getting help
-============
-
- You can always ask GDB itself for information on its commands, using
-the command `help'.
-
-`help'
-`h'
- You can use `help' (abbreviated `h') with no arguments to display
- a short list of named classes of commands:
-
- (gdb) help
- List of classes of commands:
-
- running -- Running the program
- stack -- Examining the stack
- data -- Examining data
- breakpoints -- Making program stop at certain points
- files -- Specifying and examining files
- status -- Status inquiries
- support -- Support facilities
- user-defined -- User-defined commands
- aliases -- Aliases of other commands
- obscure -- Obscure features
-
- Type "help" followed by a class name for a list of
- commands in that class.
- Type "help" followed by command name for full
- documentation.
- Command name abbreviations are allowed if unambiguous.
- (gdb)
-
-`help CLASS'
- Using one of the general help classes as an argument, you can get a
- list of the individual commands in that class. For example, here
- is the help display for the class `status':
-
- (gdb) help status
- Status inquiries.
-
- List of commands:
-
- show -- Generic command for showing things set
- with "set"
- info -- Generic command for printing status
-
- Type "help" followed by command name for full
- documentation.
- Command name abbreviations are allowed if unambiguous.
- (gdb)
-
-`help COMMAND'
- With a command name as `help' argument, GDB will display a short
- paragraph on how to use that command.
-
- In addition to `help', you can use the GDB commands `info' and
-`show' to inquire about the state of your program, or the state of GDB
-itself. Each command supports many topics of inquiry; this manual
-introduces each of them in the appropriate context. The listings under
-`info' and under `show' in the Index point to all the sub-commands.
-*Note Index::.
-
-`info'
- This command (abbreviated `i') is for describing the state of your
- program. For example, you can list the arguments given to your
- program with `info args', list the registers currently in use with
- `info registers', or list the breakpoints you have set with `info
- breakpoints'. You can get a complete list of the `info'
- sub-commands with `help info'.
-
-`show'
- In contrast, `show' is for describing the state of GDB itself.
- You can change most of the things you can `show', by using the
- related command `set'; for example, you can control what number
- system is used for displays with `set radix', or simply inquire
- which is currently in use with `show radix'.
-
- To display all the settable parameters and their current values,
- you can use `show' with no arguments; you may also use `info set'.
- Both commands produce the same display.
-
- Here are three miscellaneous `show' subcommands, all of which are
-exceptional in lacking corresponding `set' commands:
-
-`show version'
- Show what version of GDB is running. You should include this
- information in GDB bug-reports. If multiple versions of GDB are in
- use at your site, you may occasionally want to determine which
- version of GDB you are running; as GDB evolves, new commands are
- introduced, and old ones may wither away. The version number is
- also announced when you start GDB.
-
-`show copying'
- Display information about permission for copying GDB.
-
-`show warranty'
- Display the GNU "NO WARRANTY" statement.
-
-
-File: gdb.info, Node: Running, Next: Stopping, Prev: Commands, Up: Top
-
-Running Programs Under GDB
-**************************
-
- When you run a program under GDB, you must first generate debugging
-information when you compile it. You may start it with its arguments,
-if any, in an environment of your choice. You may redirect your
-program's input and output, debug an already running process, or kill a
-child process.
-
-* Menu:
-
-* Compilation:: Compiling for debugging
-* Starting:: Starting your program
-
-* Arguments:: Your program's arguments
-* Environment:: Your program's environment
-* Working Directory:: Your program's working directory
-* Input/Output:: Your program's input and output
-* Attach:: Debugging an already-running process
-* Kill Process:: Killing the child process
-* Process Information:: Additional process information
-
-
-File: gdb.info, Node: Compilation, Next: Starting, Up: Running
-
-Compiling for debugging
-=======================
-
- In order to debug a program effectively, you need to generate
-debugging information when you compile it. This debugging information
-is stored in the object file; it describes the data type of each
-variable or function and the correspondence between source line numbers
-and addresses in the executable code.
-
- To request debugging information, specify the `-g' option when you
-run the compiler.
-
- Many C compilers are unable to handle the `-g' and `-O' options
-together. Using those compilers, you cannot generate optimized
-executables containing debugging information.
-
- GCC, the GNU C compiler, supports `-g' with or without `-O', making
-it possible to debug optimized code. We recommend that you *always*
-use `-g' whenever you compile a program. You may think your program is
-correct, but there is no sense in pushing your luck.
-
- When you debug a program compiled with `-g -O', remember that the
-optimizer is rearranging your code; the debugger will show you what is
-really there. Do not be too surprised when the execution path does not
-exactly match your source file! An extreme example: if you define a
-variable, but never use it, GDB will never see that variable--because
-the compiler optimizes it out of existence.
-
- Some things do not work as well with `-g -O' as with just `-g',
-particularly on machines with instruction scheduling. If in doubt,
-recompile with `-g' alone, and if this fixes the problem, please report
-it as a bug (including a test case!).
-
- Older versions of the GNU C compiler permitted a variant option
-`-gg' for debugging information. GDB no longer supports this format;
-if your GNU C compiler has this option, do not use it.
-
-
-File: gdb.info, Node: Starting, Next: Arguments, Prev: Compilation, Up: Running
-
-Starting your program
-=====================
-
-`run'
-`r'
- Use the `run' command to start your program under GDB. You must
- first specify the program name (except on VxWorks) with an
- argument to GDB (*note Getting In and Out of GDB: Invocation.), or
- by using the `file' or `exec-file' command (*note Commands to
- specify files: Files.).
-
- If you are running your program in an execution environment that
-supports processes, `run' creates an inferior process and makes that
-process run your program. (In environments without processes, `run'
-jumps to the start of your program.)
-
- The execution of a program is affected by certain information it
-receives from its superior. GDB provides ways to specify this
-information, which you must do *before* starting your program. (You
-can change it after starting your program, but such changes will only
-affect your program the next time you start it.) This information may
-be divided into four categories:
-
-The *arguments.*
- Specify the arguments to give your program as the arguments of the
- `run' command. If a shell is available on your target, the shell
- is used to pass the arguments, so that you may use normal
- conventions (such as wildcard expansion or variable substitution)
- in describing the arguments. In Unix systems, you can control
- which shell is used with the `SHELL' environment variable. *Note
- Your program's arguments: Arguments.
-
-The *environment.*
- Your program normally inherits its environment from GDB, but you
- can use the GDB commands `set environment' and `unset environment'
- to change parts of the environment that will be given to your
- program. *Note Your program's environment: Environment.
-
-The *working directory.*
- Your program inherits its working directory from GDB. You can set
- the GDB working directory with the `cd' command in GDB. *Note
- Your program's working directory: Working Directory.
-
-The *standard input and output.*
- Your program normally uses the same device for standard input and
- standard output as GDB is using. You can redirect input and output
- in the `run' command line, or you can use the `tty' command to set
- a different device for your program. *Note Your program's input
- and output: Input/Output.
-
- *Warning:* While input and output redirection work, you cannot use
- pipes to pass the output of the program you are debugging to
- another program; if you attempt this, GDB is likely to wind up
- debugging the wrong program.
-
- When you issue the `run' command, your program begins to execute
-immediately. *Note Stopping and continuing: Stopping, for discussion
-of how to arrange for your program to stop. Once your program has
-stopped, you may call functions in your program, using the `print' or
-`call' commands. *Note Examining Data: Data.
-
- If the modification time of your symbol file has changed since the
-last time GDB read its symbols, GDB will discard its symbol table and
-re-read it. When it does this, GDB tries to retain your current
-breakpoints.
-
-
-File: gdb.info, Node: Arguments, Next: Environment, Prev: Starting, Up: Running
-
-Your program's arguments
-========================
-
- The arguments to your program can be specified by the arguments of
-the `run' command. They are passed to a shell, which expands wildcard
-characters and performs redirection of I/O, and thence to your program.
-Your `SHELL' environment variable (if it exists) specifies what shell
-GDB if you do not define `SHELL', GDB uses `/bin/sh'.
-
- `run' with no arguments uses the same arguments used by the previous
-`run', or those set by the `set args' command.
-
-`set args'
- Specify the arguments to be used the next time your program is
- run. If `set args' has no arguments, `run' will execute your
- program with no arguments. Once you have run your program with
- arguments, using `set args' before the next `run' is the only way
- to run it again without arguments.
-
-`show args'
- Show the arguments to give your program when it is started.
-
-
-File: gdb.info, Node: Environment, Next: Working Directory, Prev: Arguments, Up: Running
-
-Your program's environment
-==========================
-
- The "environment" consists of a set of environment variables and
-their values. Environment variables conventionally record such things
-as your user name, your home directory, your terminal type, and your
-search path for programs to run. Usually you set up environment
-variables with the shell and they are inherited by all the other
-programs you run. When debugging, it can be useful to try running your
-program with a modified environment without having to start GDB over
-again.
-
-`path DIRECTORY'
- Add DIRECTORY to the front of the `PATH' environment variable (the
- search path for executables), for both GDB and your program. You
- may specify several directory names, separated by `:' or
- whitespace. If DIRECTORY is already in the path, it is moved to
- the front, so it will be searched sooner.
-
- You can use the string `$cwd' to refer to whatever is the current
- working directory at the time GDB searches the path. If you use
- `.' instead, it refers to the directory where you executed the
- `path' command. GDB replaces `.' in the DIRECTORY argument (with
- the current path) before adding DIRECTORY to the search path.
-
-`show paths'
- Display the list of search paths for executables (the `PATH'
- environment variable).
-
-`show environment [VARNAME]'
- Print the value of environment variable VARNAME to be given to
- your program when it starts. If you do not supply VARNAME, print
- the names and values of all environment variables to be given to
- your program. You can abbreviate `environment' as `env'.
-
-`set environment VARNAME [=] VALUE'
- Set environment variable VARNAME to VALUE. The value changes for
- your program only, not for GDB itself. VALUE may be any string;
- the values of environment variables are just strings, and any
- interpretation is supplied by your program itself. The VALUE
- parameter is optional; if it is eliminated, the variable is set to
- a null value.
-
- For example, this command:
-
- set env USER = foo
-
- tells a Unix program, when subsequently run, that its user is named
- `foo'. (The spaces around `=' are used for clarity here; they are
- not actually required.)
-
-`unset environment VARNAME'
- Remove variable VARNAME from the environment to be passed to your
- program. This is different from `set env VARNAME ='; `unset
- environment' removes the variable from the environment, rather
- than assigning it an empty value.
-
- *Warning:* GDB runs your program using the shell indicated by your
-`SHELL' environment variable if it exists (or `/bin/sh' if not). If
-your `SHELL' variable names a shell that runs an initialization
-file--such as `.cshrc' for C-shell, or `.bashrc' for BASH--any
-variables you set in that file will affect your program. You may wish
-to move setting of environment variables to files that are only run
-when you sign on, such as `.login' or `.profile'.
-
-
-File: gdb.info, Node: Working Directory, Next: Input/Output, Prev: Environment, Up: Running
-
-Your program's working directory
-================================
-
- Each time you start your program with `run', it inherits its working
-directory from the current working directory of GDB. The GDB working
-directory is initially whatever it inherited from its parent process
-(typically the shell), but you can specify a new working directory in
-GDB with the `cd' command.
-
- The GDB working directory also serves as a default for the commands
-that specify files for GDB to operate on. *Note Commands to specify
-files: Files.
-
-`cd DIRECTORY'
- Set the GDB working directory to DIRECTORY.
-
-`pwd'
- Print the GDB working directory.
-
-
-File: gdb.info, Node: Input/Output, Next: Attach, Prev: Working Directory, Up: Running
-
-Your program's input and output
-===============================
-
- By default, the program you run under GDB does input and output to
-the same terminal that GDB uses. GDB switches the terminal to its own
-terminal modes to interact with you, but it records the terminal modes
-your program was using and switches back to them when you continue
-running your program.
-
-`info terminal'
- Displays information recorded by GDB about the terminal modes your
- program is using.
-
- You can redirect your program's input and/or output using shell
-redirection with the `run' command. For example,
-
- run > outfile
-
-starts your program, diverting its output to the file `outfile'.
-
- Another way to specify where your program should do input and output
-is with the `tty' command. This command accepts a file name as
-argument, and causes this file to be the default for future `run'
-commands. It also resets the controlling terminal for the child
-process, for future `run' commands. For example,
-
- tty /dev/ttyb
-
-directs that processes started with subsequent `run' commands default
-to do input and output on the terminal `/dev/ttyb' and have that as
-their controlling terminal.
-
- An explicit redirection in `run' overrides the `tty' command's
-effect on the input/output device, but not its effect on the controlling
-terminal.
-
- When you use the `tty' command or redirect input in the `run'
-command, only the input *for your program* is affected. The input for
-GDB still comes from your terminal.
-
diff --git a/gnu/usr.bin/gdb/doc/gdb.info-2 b/gnu/usr.bin/gdb/doc/gdb.info-2
deleted file mode 100644
index e8be2fa..0000000
--- a/gnu/usr.bin/gdb/doc/gdb.info-2
+++ /dev/null
@@ -1,1165 +0,0 @@
-This is Info file ./gdb.info, produced by Makeinfo-1.52 from the input
-file gdb.texinfo.
-
-START-INFO-DIR-ENTRY
-* Gdb:: The GNU debugger.
-END-INFO-DIR-ENTRY
- This file documents the GNU debugger GDB.
-
- This is Edition 4.09, August 1993, of `Debugging with GDB: the GNU
-Source-Level Debugger' for GDB Version 4.11.
-
- Copyright (C) 1988, '89, '90, '91, '92, '93 Free Software
-Foundation, Inc.
-
- Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of
-this manual under the conditions for verbatim copying, provided also
-that the entire resulting derived work is distributed under the terms
-of a permission notice identical to this one.
-
- Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions.
-
-
-File: gdb.info, Node: Attach, Next: Kill Process, Prev: Input/Output, Up: Running
-
-Debugging an already-running process
-====================================
-
-`attach PROCESS-ID'
- This command attaches to a running process--one that was started
- outside GDB. (`info files' will show your active targets.) The
- command takes as argument a process ID. The usual way to find out
- the process-id of a Unix process is with the `ps' utility, or with
- the `jobs -l' shell command.
-
- `attach' will not repeat if you press RET a second time after
- executing the command.
-
- To use `attach', your program must be running in an environment
-which supports processes; for example, `attach' does not work for
-programs on bare-board targets that lack an operating system. You must
-also have permission to send the process a signal.
-
- When using `attach', you should first use the `file' command to
-specify the program running in the process and load its symbol table.
-*Note Commands to Specify Files: Files.
-
- The first thing GDB does after arranging to debug the specified
-process is to stop it. You can examine and modify an attached process
-with all the GDB commands that are ordinarily available when you start
-processes with `run'. You can insert breakpoints; you can step and
-continue; you can modify storage. If you would rather the process
-continue running, you may use the `continue' command after attaching
-GDB to the process.
-
-`detach'
- When you have finished debugging the attached process, you can use
- the `detach' command to release it from GDB control. Detaching
- the process continues its execution. After the `detach' command,
- that process and GDB become completely independent once more, and
- you are ready to `attach' another process or start one with `run'.
- `detach' will not repeat if you press RET again after executing
- the command.
-
- If you exit GDB or use the `run' command while you have an attached
-process, you kill that process. By default, you will be asked for
-confirmation if you try to do either of these things; you can control
-whether or not you need to confirm by using the `set confirm' command
-(*note Optional warnings and messages: Messages/Warnings.).
-
-
-File: gdb.info, Node: Kill Process, Next: Process Information, Prev: Attach, Up: Running
-
-Killing the child process
-=========================
-
-`kill'
- Kill the child process in which your program is running under GDB.
-
- This command is useful if you wish to debug a core dump instead of a
-running process. GDB ignores any core dump file while your program is
-running.
-
- On some operating systems, a program cannot be executed outside GDB
-while you have breakpoints set on it inside GDB. You can use the
-`kill' command in this situation to permit running your program outside
-the debugger.
-
- The `kill' command is also useful if you wish to recompile and
-relink your program, since on many systems it is impossible to modify an
-executable file while it is running in a process. In this case, when
-you next type `run', GDB will notice that the file has changed, and
-will re-read the symbol table (while trying to preserve your current
-breakpoint settings).
-
-
-File: gdb.info, Node: Process Information, Prev: Kill Process, Up: Running
-
-Additional process information
-==============================
-
- Some operating systems provide a facility called `/proc' that can be
-used to examine the image of a running process using file-system
-subroutines. If GDB is configured for an operating system with this
-facility, the command `info proc' is available to report on several
-kinds of information about the process running your program.
-
-`info proc'
- Summarize available information about the process.
-
-`info proc mappings'
- Report on the address ranges accessible in the program, with
- information on whether your program may read, write, or execute
- each range.
-
-`info proc times'
- Starting time, user CPU time, and system CPU time for your program
- and its children.
-
-`info proc id'
- Report on the process IDs related to your program: its own process
- ID, the ID of its parent, the process group ID, and the session ID.
-
-`info proc status'
- General information on the state of the process. If the process is
- stopped, this report includes the reason for stopping, and any
- signal received.
-
-`info proc all'
- Show all the above information about the process.
-
-
-File: gdb.info, Node: Stopping, Next: Stack, Prev: Running, Up: Top
-
-Stopping and Continuing
-***********************
-
- The principal purposes of using a debugger are so that you can stop
-your program before it terminates; or so that, if your program runs into
-trouble, you can investigate and find out why.
-
- Inside GDB, your program may stop for any of several reasons, such as
-a signal, a breakpoint, or reaching a new line after a GDB command such
-as `step'. You may then examine and change variables, set new
-breakpoints or remove old ones, and then continue execution. Usually,
-the messages shown by GDB provide ample explanation of the status of
-your program--but you can also explicitly request this information at
-any time.
-
-`info program'
- Display information about the status of your program: whether it is
- running or not, what process it is, and why it stopped.
-
-* Menu:
-
-
-* Breakpoints:: Breakpoints, watchpoints, and exceptions
-
-
-* Continuing and Stepping:: Resuming execution
-
-* Signals:: Signals
-
-
-File: gdb.info, Node: Breakpoints, Next: Continuing and Stepping, Up: Stopping
-
-Breakpoints, watchpoints, and exceptions
-========================================
-
- A "breakpoint" makes your program stop whenever a certain point in
-the program is reached. For each breakpoint, you can add various
-conditions to control in finer detail whether your program will stop.
-You can set breakpoints with the `break' command and its variants
-(*note Setting breakpoints: Set Breaks.), to specify the place where
-your program should stop by line number, function name or exact address
-in the program. In languages with exception handling (such as GNU
-C++), you can also set breakpoints where an exception is raised (*note
-Breakpoints and exceptions: Exception Handling.).
-
- A "watchpoint" is a special breakpoint that stops your program when
-the value of an expression changes. You must use a different command
-to set watchpoints (*note Setting watchpoints: Set Watchpoints.), but
-aside from that, you can manage a watchpoint like any other breakpoint:
-you enable, disable, and delete both breakpoints and watchpoints using
-the same commands.
-
- You can arrange to have values from your program displayed
-automatically whenever GDB stops at a breakpoint. *Note Automatic
-display: Auto Display.
-
- GDB assigns a number to each breakpoint or watchpoint when you
-create it; these numbers are successive integers starting with one. In
-many of the commands for controlling various features of breakpoints you
-use the breakpoint number to say which breakpoint you want to change.
-Each breakpoint may be "enabled" or "disabled"; if disabled, it has no
-effect on your program until you enable it again.
-
-* Menu:
-
-* Set Breaks:: Setting breakpoints
-* Set Watchpoints:: Setting watchpoints
-
-* Exception Handling:: Breakpoints and exceptions
-
-* Delete Breaks:: Deleting breakpoints
-* Disabling:: Disabling breakpoints
-* Conditions:: Break conditions
-* Break Commands:: Breakpoint command lists
-
-* Breakpoint Menus:: Breakpoint menus
-
-* Error in Breakpoints:: "Cannot insert breakpoints"
-
-
-File: gdb.info, Node: Set Breaks, Next: Set Watchpoints, Up: Breakpoints
-
-Setting breakpoints
--------------------
-
- Breakpoints are set with the `break' command (abbreviated `b'). The
-debugger convenience variable `$bpnum' records the number of the
-beakpoint you've set most recently; see *Note Convenience variables:
-Convenience Vars, for a discussion of what you can do with convenience
-variables.
-
- You have several ways to say where the breakpoint should go.
-
-`break FUNCTION'
- Set a breakpoint at entry to function FUNCTION. When using source
- languages that permit overloading of symbols, such as C++,
- FUNCTION may refer to more than one possible place to break.
- *Note Breakpoint menus: Breakpoint Menus, for a discussion of that
- situation.
-
-`break +OFFSET'
-`break -OFFSET'
- Set a breakpoint some number of lines forward or back from the
- position at which execution stopped in the currently selected
- frame.
-
-`break LINENUM'
- Set a breakpoint at line LINENUM in the current source file. That
- file is the last file whose source text was printed. This
- breakpoint will stop your program just before it executes any of
- the code on that line.
-
-`break FILENAME:LINENUM'
- Set a breakpoint at line LINENUM in source file FILENAME.
-
-`break FILENAME:FUNCTION'
- Set a breakpoint at entry to function FUNCTION found in file
- FILENAME. Specifying a file name as well as a function name is
- superfluous except when multiple files contain similarly named
- functions.
-
-`break *ADDRESS'
- Set a breakpoint at address ADDRESS. You can use this to set
- breakpoints in parts of your program which do not have debugging
- information or source files.
-
-`break'
- When called without any arguments, `break' sets a breakpoint at
- the next instruction to be executed in the selected stack frame
- (*note Examining the Stack: Stack.). In any selected frame but the
- innermost, this will cause your program to stop as soon as control
- returns to that frame. This is similar to the effect of a
- `finish' command in the frame inside the selected frame--except
- that `finish' does not leave an active breakpoint. If you use
- `break' without an argument in the innermost frame, GDB will stop
- the next time it reaches the current location; this may be useful
- inside loops.
-
- GDB normally ignores breakpoints when it resumes execution, until
- at least one instruction has been executed. If it did not do
- this, you would be unable to proceed past a breakpoint without
- first disabling the breakpoint. This rule applies whether or not
- the breakpoint already existed when your program stopped.
-
-`break ... if COND'
- Set a breakpoint with condition COND; evaluate the expression COND
- each time the breakpoint is reached, and stop only if the value is
- nonzero--that is, if COND evaluates as true. `...' stands for one
- of the possible arguments described above (or no argument)
- specifying where to break. *Note Break conditions: Conditions,
- for more information on breakpoint conditions.
-
-`tbreak ARGS'
- Set a breakpoint enabled only for one stop. ARGS are the same as
- for the `break' command, and the breakpoint is set in the same
- way, but the breakpoint is automatically disabled after the first
- time your program stops there. *Note Disabling breakpoints:
- Disabling.
-
-`rbreak REGEX'
- Set breakpoints on all functions matching the regular expression
- REGEX. This command sets an unconditional breakpoint on all
- matches, printing a list of all breakpoints it set. Once these
- breakpoints are set, they are treated just like the breakpoints
- set with the `break' command. They can be deleted, disabled, made
- conditional, etc., in the standard ways.
-
- When debugging C++ programs, `rbreak' is useful for setting
- breakpoints on overloaded functions that are not members of any
- special classes.
-
-`info breakpoints [N]'
-`info break [N]'
-`info watchpoints [N]'
- Print a table of all breakpoints and watchpoints set and not
- deleted, with the following columns for each breakpoint:
-
- *Breakpoint Numbers*
- *Type*
- Breakpoint or watchpoint.
-
- *Disposition*
- Whether the breakpoint is marked to be disabled or deleted
- when hit.
-
- *Enabled or Disabled*
- Enabled breakpoints are marked with `y'. `n' marks
- breakpoints that are not enabled.
-
- *Address*
- Where the breakpoint is in your program, as a memory address
-
- *What*
- Where the breakpoint is in the source for your program, as a
- file and line number.
-
- If a breakpoint is conditional, `info break' shows the condition on
- the line following the affected breakpoint; breakpoint commands,
- if any, are listed after that.
-
- `info break' with a breakpoint number N as argument lists only
- that breakpoint. The convenience variable `$_' and the default
- examining-address for the `x' command are set to the address of
- the last breakpoint listed (*note Examining memory: Memory.).
-
- GDB allows you to set any number of breakpoints at the same place in
-your program. There is nothing silly or meaningless about this. When
-the breakpoints are conditional, this is even useful (*note Break
-conditions: Conditions.).
-
- GDB itself sometimes sets breakpoints in your program for special
-purposes, such as proper handling of `longjmp' (in C programs). These
-internal breakpoints are assigned negative numbers, starting with `-1';
-`info breakpoints' does not display them.
-
- You can see these breakpoints with the GDB maintenance command
-`maint info breakpoints'.
-
-`maint info breakpoints'
- Using the same format as `info breakpoints', display both the
- breakpoints you've set explicitly, and those GDB is using for
- internal purposes. Internal breakpoints are shown with negative
- breakpoint numbers. The type column identifies what kind of
- breakpoint is shown:
-
- `breakpoint'
- Normal, explicitly set breakpoint.
-
- `watchpoint'
- Normal, explicitly set watchpoint.
-
- `longjmp'
- Internal breakpoint, used to handle correctly stepping through
- `longjmp' calls.
-
- `longjmp resume'
- Internal breakpoint at the target of a `longjmp'.
-
- `until'
- Temporary internal breakpoint used by the GDB `until' command.
-
- `finish'
- Temporary internal breakpoint used by the GDB `finish'
- command.
-
-
-File: gdb.info, Node: Set Watchpoints, Next: Exception Handling, Prev: Set Breaks, Up: Breakpoints
-
-Setting watchpoints
--------------------
-
- You can use a watchpoint to stop execution whenever the value of an
-expression changes, without having to predict a particular place where
-this may happen.
-
- Watchpoints currently execute two orders of magnitude more slowly
-than other breakpoints, but this can be well worth it to catch errors
-where you have no clue what part of your program is the culprit. Some
-processors provide special hardware to support watchpoint evaluation;
-future releases of GDB will use such hardware if it is available.
-
-`watch EXPR'
- Set a watchpoint for an expression.
-
-`info watchpoints'
- This command prints a list of watchpoints and breakpoints; it is
- the same as `info break'.
-
-
-File: gdb.info, Node: Exception Handling, Next: Delete Breaks, Prev: Set Watchpoints, Up: Breakpoints
-
-Breakpoints and exceptions
---------------------------
-
- Some languages, such as GNU C++, implement exception handling. You
-can use GDB to examine what caused your program to raise an exception,
-and to list the exceptions your program is prepared to handle at a
-given point in time.
-
-`catch EXCEPTIONS'
- You can set breakpoints at active exception handlers by using the
- `catch' command. EXCEPTIONS is a list of names of exceptions to
- catch.
-
- You can use `info catch' to list active exception handlers. *Note
-Information about a frame: Frame Info.
-
- There are currently some limitations to exception handling in GDB.
-These will be corrected in a future release.
-
- * If you call a function interactively, GDB normally returns control
- to you when the function has finished executing. If the call
- raises an exception, however, the call may bypass the mechanism
- that returns control to you and cause your program to simply
- continue running until it hits a breakpoint, catches a signal that
- GDB is listening for, or exits.
-
- * You cannot raise an exception interactively.
-
- * You cannot interactively install an exception handler.
-
- Sometimes `catch' is not the best way to debug exception handling:
-if you need to know exactly where an exception is raised, it is better
-to stop *before* the exception handler is called, since that way you
-can see the stack before any unwinding takes place. If you set a
-breakpoint in an exception handler instead, it may not be easy to find
-out where the exception was raised.
-
- To stop just before an exception handler is called, you need some
-knowledge of the implementation. In the case of GNU C++, exceptions are
-raised by calling a library function named `__raise_exception' which
-has the following ANSI C interface:
-
- /* ADDR is where the exception identifier is stored.
- ID is the exception identifier. */
- void __raise_exception (void **ADDR, void *ID);
-
-To make the debugger catch all exceptions before any stack unwinding
-takes place, set a breakpoint on `__raise_exception' (*note
-Breakpoints; watchpoints; and exceptions: Breakpoints.).
-
- With a conditional breakpoint (*note Break conditions: Conditions.)
-that depends on the value of ID, you can stop your program when a
-specific exception is raised. You can use multiple conditional
-breakpoints to stop your program when any of a number of exceptions are
-raised.
-
-
-File: gdb.info, Node: Delete Breaks, Next: Disabling, Prev: Exception Handling, Up: Breakpoints
-
-Deleting breakpoints
---------------------
-
- It is often necessary to eliminate a breakpoint or watchpoint once it
-has done its job and you no longer want your program to stop there.
-This is called "deleting" the breakpoint. A breakpoint that has been
-deleted no longer exists; it is forgotten.
-
- With the `clear' command you can delete breakpoints according to
-where they are in your program. With the `delete' command you can
-delete individual breakpoints or watchpoints by specifying their
-breakpoint numbers.
-
- It is not necessary to delete a breakpoint to proceed past it. GDB
-automatically ignores breakpoints on the first instruction to be
-executed when you continue execution without changing the execution
-address.
-
-`clear'
- Delete any breakpoints at the next instruction to be executed in
- the selected stack frame (*note Selecting a frame: Selection.).
- When the innermost frame is selected, this is a good way to delete
- a breakpoint where your program just stopped.
-
-`clear FUNCTION'
-`clear FILENAME:FUNCTION'
- Delete any breakpoints set at entry to the function FUNCTION.
-
-`clear LINENUM'
-`clear FILENAME:LINENUM'
- Delete any breakpoints set at or within the code of the specified
- line.
-
-`delete [breakpoints] [BNUMS...]'
- Delete the breakpoints or watchpoints of the numbers specified as
- arguments. If no argument is specified, delete all breakpoints
- (GDB asks confirmation, unless you have `set confirm off'). You
- can abbreviate this command as `d'.
-
-
-File: gdb.info, Node: Disabling, Next: Conditions, Prev: Delete Breaks, Up: Breakpoints
-
-Disabling breakpoints
----------------------
-
- Rather than deleting a breakpoint or watchpoint, you might prefer to
-"disable" it. This makes the breakpoint inoperative as if it had been
-deleted, but remembers the information on the breakpoint so that you
-can "enable" it again later.
-
- You disable and enable breakpoints and watchpoints with the `enable'
-and `disable' commands, optionally specifying one or more breakpoint
-numbers as arguments. Use `info break' or `info watch' to print a list
-of breakpoints or watchpoints if you do not know which numbers to use.
-
- A breakpoint or watchpoint can have any of four different states of
-enablement:
-
- * Enabled. The breakpoint will stop your program. A breakpoint set
- with the `break' command starts out in this state.
-
- * Disabled. The breakpoint has no effect on your program.
-
- * Enabled once. The breakpoint will stop your program, but when it
- does so it will become disabled. A breakpoint set with the
- `tbreak' command starts out in this state.
-
- * Enabled for deletion. The breakpoint will stop your program, but
- immediately after it does so it will be deleted permanently.
-
- You can use the following commands to enable or disable breakpoints
-and watchpoints:
-
-`disable [breakpoints] [BNUMS...]'
- Disable the specified breakpoints--or all breakpoints, if none are
- listed. A disabled breakpoint has no effect but is not forgotten.
- All options such as ignore-counts, conditions and commands are
- remembered in case the breakpoint is enabled again later. You may
- abbreviate `disable' as `dis'.
-
-`enable [breakpoints] [BNUMS...]'
- Enable the specified breakpoints (or all defined breakpoints).
- They become effective once again in stopping your program.
-
-`enable [breakpoints] once BNUMS...'
- Enable the specified breakpoints temporarily. Each will be
- disabled again the next time it stops your program.
-
-`enable [breakpoints] delete BNUMS...'
- Enable the specified breakpoints to work once and then die. Each
- of the breakpoints will be deleted the next time it stops your
- program.
-
- Save for a breakpoint set with `tbreak' (*note Setting breakpoints:
-Set Breaks.), breakpoints that you set are initially enabled;
-subsequently, they become disabled or enabled only when you use one of
-the commands above. (The command `until' can set and delete a
-breakpoint of its own, but it will not change the state of your other
-breakpoints; see *Note Continuing and stepping: Continuing and
-Stepping.)
-
-
-File: gdb.info, Node: Conditions, Next: Break Commands, Prev: Disabling, Up: Breakpoints
-
-Break conditions
-----------------
-
- The simplest sort of breakpoint breaks every time your program
-reaches a specified place. You can also specify a "condition" for a
-breakpoint. A condition is just a Boolean expression in your
-programming language (*note Expressions: Expressions.). A breakpoint
-with a condition evaluates the expression each time your program
-reaches it, and your program stops only if the condition is *true*.
-
- This is the converse of using assertions for program validation; in
-that situation, you want to stop when the assertion is violated--that
-is, when the condition is false. In C, if you want to test an
-assertion expressed by the condition ASSERT, you should set the
-condition `! ASSERT' on the appropriate breakpoint.
-
- Conditions are also accepted for watchpoints; you may not need them,
-since a watchpoint is inspecting the value of an expression anyhow--but
-it might be simpler, say, to just set a watchpoint on a variable name,
-and specify a condition that tests whether the new value is an
-interesting one.
-
- Break conditions can have side effects, and may even call functions
-in your program. This can be useful, for example, to activate functions
-that log program progress, or to use your own print functions to format
-special data structures. The effects are completely predictable unless
-there is another enabled breakpoint at the same address. (In that
-case, GDB might see the other breakpoint first and stop your program
-without checking the condition of this one.) Note that breakpoint
-commands are usually more convenient and flexible for the purpose of
-performing side effects when a breakpoint is reached (*note Breakpoint
-command lists: Break Commands.).
-
- Break conditions can be specified when a breakpoint is set, by using
-`if' in the arguments to the `break' command. *Note Setting
-breakpoints: Set Breaks. They can also be changed at any time with the
-`condition' command. The `watch' command does not recognize the `if'
-keyword; `condition' is the only way to impose a further condition on a
-watchpoint.
-
-`condition BNUM EXPRESSION'
- Specify EXPRESSION as the break condition for breakpoint or
- watchpoint number BNUM. From now on, this breakpoint will stop
- your program only if the value of EXPRESSION is true (nonzero, in
- C). When you use `condition', GDB checks EXPRESSION immediately
- for syntactic correctness, and to determine whether symbols in it
- have referents in the context of your breakpoint. GDB does not
- actually evaluate EXPRESSION at the time the `condition' command
- is given, however. *Note Expressions: Expressions.
-
-`condition BNUM'
- Remove the condition from breakpoint number BNUM. It becomes an
- ordinary unconditional breakpoint.
-
- A special case of a breakpoint condition is to stop only when the
-breakpoint has been reached a certain number of times. This is so
-useful that there is a special way to do it, using the "ignore count"
-of the breakpoint. Every breakpoint has an ignore count, which is an
-integer. Most of the time, the ignore count is zero, and therefore has
-no effect. But if your program reaches a breakpoint whose ignore count
-is positive, then instead of stopping, it just decrements the ignore
-count by one and continues. As a result, if the ignore count value is
-N, the breakpoint will not stop the next N times it is reached.
-
-`ignore BNUM COUNT'
- Set the ignore count of breakpoint number BNUM to COUNT. The next
- COUNT times the breakpoint is reached, your program's execution
- will not stop; other than to decrement the ignore count, GDB takes
- no action.
-
- To make the breakpoint stop the next time it is reached, specify a
- count of zero.
-
- When you use `continue' to resume execution of your program from a
- breakpoint, you can specify an ignore count directly as an
- argument to `continue', rather than using `ignore'. *Note
- Continuing and stepping: Continuing and Stepping.
-
- If a breakpoint has a positive ignore count and a condition, the
- condition is not checked. Once the ignore count reaches zero, the
- condition will be checked.
-
- You could achieve the effect of the ignore count with a condition
- such as `$foo-- <= 0' using a debugger convenience variable that
- is decremented each time. *Note Convenience variables:
- Convenience Vars.
-
-
-File: gdb.info, Node: Break Commands, Next: Breakpoint Menus, Prev: Conditions, Up: Breakpoints
-
-Breakpoint command lists
-------------------------
-
- You can give any breakpoint (or watchpoint) a series of commands to
-execute when your program stops due to that breakpoint. For example,
-you might want to print the values of certain expressions, or enable
-other breakpoints.
-
-`commands [BNUM]'
-`... COMMAND-LIST ...'
-`end'
- Specify a list of commands for breakpoint number BNUM. The
- commands themselves appear on the following lines. Type a line
- containing just `end' to terminate the commands.
-
- To remove all commands from a breakpoint, type `commands' and
- follow it immediately with `end'; that is, give no commands.
-
- With no BNUM argument, `commands' refers to the last breakpoint or
- watchpoint set (not to the breakpoint most recently encountered).
-
- Pressing RET as a means of repeating the last GDB command is
-disabled within a COMMAND-LIST.
-
- You can use breakpoint commands to start your program up again.
-Simply use the `continue' command, or `step', or any other command that
-resumes execution.
-
- Any other commands in the command list, after a command that resumes
-execution, are ignored. This is because any time you resume execution
-(even with a simple `next' or `step'), you may encounter another
-breakpoint--which could have its own command list, leading to
-ambiguities about which list to execute.
-
- If the first command you specify in a command list is `silent', the
-usual message about stopping at a breakpoint is not printed. This may
-be desirable for breakpoints that are to print a specific message and
-then continue. If none of the remaining commands print anything, you
-will see no sign that the breakpoint was reached. `silent' is
-meaningful only at the beginning of a breakpoint command list.
-
- The commands `echo', `output', and `printf' allow you to print
-precisely controlled output, and are often useful in silent
-breakpoints. *Note Commands for controlled output: Output.
-
- For example, here is how you could use breakpoint commands to print
-the value of `x' at entry to `foo' whenever `x' is positive.
-
- break foo if x>0
- commands
- silent
- printf "x is %d\n",x
- cont
- end
-
- One application for breakpoint commands is to compensate for one bug
-so you can test for another. Put a breakpoint just after the erroneous
-line of code, give it a condition to detect the case in which something
-erroneous has been done, and give it commands to assign correct values
-to any variables that need them. End with the `continue' command so
-that your program does not stop, and start with the `silent' command so
-that no output is produced. Here is an example:
-
- break 403
- commands
- silent
- set x = y + 4
- cont
- end
-
-
-File: gdb.info, Node: Breakpoint Menus, Next: Error in Breakpoints, Prev: Break Commands, Up: Breakpoints
-
-Breakpoint menus
-----------------
-
- Some programming languages (notably C++) permit a single function
-name to be defined several times, for application in different contexts.
-This is called "overloading". When a function name is overloaded,
-`break FUNCTION' is not enough to tell GDB where you want a breakpoint.
-If you realize this will be a problem, you can use something like
-`break FUNCTION(TYPES)' to specify which particular version of the
-function you want. Otherwise, GDB offers you a menu of numbered
-choices for different possible breakpoints, and waits for your
-selection with the prompt `>'. The first two options are always `[0]
-cancel' and `[1] all'. Typing `1' sets a breakpoint at each definition
-of FUNCTION, and typing `0' aborts the `break' command without setting
-any new breakpoints.
-
- For example, the following session excerpt shows an attempt to set a
-breakpoint at the overloaded symbol `String::after'. We choose three
-particular definitions of that function name:
-
- (gdb) b String::after
- [0] cancel
- [1] all
- [2] file:String.cc; line number:867
- [3] file:String.cc; line number:860
- [4] file:String.cc; line number:875
- [5] file:String.cc; line number:853
- [6] file:String.cc; line number:846
- [7] file:String.cc; line number:735
- > 2 4 6
- Breakpoint 1 at 0xb26c: file String.cc, line 867.
- Breakpoint 2 at 0xb344: file String.cc, line 875.
- Breakpoint 3 at 0xafcc: file String.cc, line 846.
- Multiple breakpoints were set.
- Use the "delete" command to delete unwanted
- breakpoints.
- (gdb)
-
-
-File: gdb.info, Node: Error in Breakpoints, Prev: Breakpoint Menus, Up: Breakpoints
-
-"Cannot insert breakpoints"
----------------------------
-
- Under some operating systems, breakpoints cannot be used in a
-program if any other process is running that program. In this
-situation, attempting to run or continue a program with a breakpoint
-causes GDB to stop the other process.
-
- When this happens, you have three ways to proceed:
-
- 1. Remove or disable the breakpoints, then continue.
-
- 2. Suspend GDB, and copy the file containing your program to a new
- name. Resume GDB and use the `exec-file' command to specify that
- GDB should run your program under that name. Then start your
- program again.
-
- 3. Relink your program so that the text segment is nonsharable, using
- the linker option `-N'. The operating system limitation may not
- apply to nonsharable executables.
-
-
-File: gdb.info, Node: Continuing and Stepping, Next: Signals, Prev: Breakpoints, Up: Stopping
-
-Continuing and stepping
-=======================
-
- "Continuing" means resuming program execution until your program
-completes normally. In contrast, "stepping" means executing just one
-more "step" of your program, where "step" may mean either one line of
-source code, or one machine instruction (depending on what particular
-command you use). Either when continuing or when stepping, your
-program may stop even sooner, due to a breakpoint or a signal. (If due
-to a signal, you may want to use `handle', or use `signal 0' to resume
-execution. *Note Signals: Signals.)
-
-`continue [IGNORE-COUNT]'
-`c [IGNORE-COUNT]'
-`fg [IGNORE-COUNT]'
- Resume program execution, at the address where your program last
- stopped; any breakpoints set at that address are bypassed. The
- optional argument IGNORE-COUNT allows you to specify a further
- number of times to ignore a breakpoint at this location; its
- effect is like that of `ignore' (*note Break conditions:
- Conditions.).
-
- The argument IGNORE-COUNT is meaningful only when your program
- stopped due to a breakpoint. At other times, the argument to
- `continue' is ignored.
-
- The synonyms `c' and `fg' are provided purely for convenience, and
- have exactly the same behavior as `continue'.
-
- To resume execution at a different place, you can use `return'
-(*note Returning from a function: Returning.) to go back to the calling
-function; or `jump' (*note Continuing at a different address: Jumping.)
-to go to an arbitrary location in your program.
-
- A typical technique for using stepping is to set a breakpoint (*note
-Breakpoints; watchpoints; and exceptions: Breakpoints.) at the
-beginning of the function or the section of your program where a
-problem is believed to lie, run your program until it stops at that
-breakpoint, and then step through the suspect area, examining the
-variables that are interesting, until you see the problem happen.
-
-`step'
- Continue running your program until control reaches a different
- source line, then stop it and return control to GDB. This command
- is abbreviated `s'.
-
- *Warning:* If you use the `step' command while control is
- within a function that was compiled without debugging
- information, execution proceeds until control reaches a
- function that does have debugging information.
-
-`step COUNT'
- Continue running as in `step', but do so COUNT times. If a
- breakpoint is reached, or a signal not related to stepping occurs
- before COUNT steps, stepping stops right away.
-
-`next [COUNT]'
- Continue to the next source line in the current (innermost) stack
- frame. Similar to `step', but any function calls appearing within
- the line of code are executed without stopping. Execution stops
- when control reaches a different line of code at the stack level
- which was executing when the `next' command was given. This
- command is abbreviated `n'.
-
- An argument COUNT is a repeat count, as for `step'.
-
- `next' within a function that lacks debugging information acts like
- `step', but any function calls appearing within the code of the
- function are executed without stopping.
-
-`finish'
- Continue running until just after function in the selected stack
- frame returns. Print the returned value (if any).
-
- Contrast this with the `return' command (*note Returning from a
- function: Returning.).
-
-`until'
-`u'
- Continue running until a source line past the current line, in the
- current stack frame, is reached. This command is used to avoid
- single stepping through a loop more than once. It is like the
- `next' command, except that when `until' encounters a jump, it
- automatically continues execution until the program counter is
- greater than the address of the jump.
-
- This means that when you reach the end of a loop after single
- stepping though it, `until' will cause your program to continue
- execution until the loop is exited. In contrast, a `next' command
- at the end of a loop will simply step back to the beginning of the
- loop, which would force you to step through the next iteration.
-
- `until' always stops your program if it attempts to exit the
- current stack frame.
-
- `until' may produce somewhat counterintuitive results if the order
- of machine code does not match the order of the source lines. For
- example, in the following excerpt from a debugging session, the `f'
- (`frame') command shows that execution is stopped at line `206';
- yet when we use `until', we get to line `195':
-
- (gdb) f
- #0 main (argc=4, argv=0xf7fffae8) at m4.c:206
- 206 expand_input();
- (gdb) until
- 195 for ( ; argc > 0; NEXTARG) {
-
- This happened because, for execution efficiency, the compiler had
- generated code for the loop closure test at the end, rather than
- the start, of the loop--even though the test in a C `for'-loop is
- written before the body of the loop. The `until' command appeared
- to step back to the beginning of the loop when it advanced to this
- expression; however, it has not really gone to an earlier
- statement--not in terms of the actual machine code.
-
- `until' with no argument works by means of single instruction
- stepping, and hence is slower than `until' with an argument.
-
-`until LOCATION'
-`u LOCATION'
- Continue running your program until either the specified location
- is reached, or the current stack frame returns. LOCATION is any of
- the forms of argument acceptable to `break' (*note Setting
- breakpoints: Set Breaks.). This form of the command uses
- breakpoints, and hence is quicker than `until' without an argument.
-
-`stepi'
-`si'
- Execute one machine instruction, then stop and return to the
- debugger.
-
- It is often useful to do `display/i $pc' when stepping by machine
- instructions. This will cause the next instruction to be executed
- to be displayed automatically at each stop. *Note Automatic
- display: Auto Display.
-
- An argument is a repeat count, as in `step'.
-
-`nexti'
-`ni'
- Execute one machine instruction, but if it is a function call,
- proceed until the function returns.
-
- An argument is a repeat count, as in `next'.
-
-
-File: gdb.info, Node: Signals, Prev: Continuing and Stepping, Up: Stopping
-
-Signals
-=======
-
- A signal is an asynchronous event that can happen in a program. The
-operating system defines the possible kinds of signals, and gives each
-kind a name and a number. For example, in Unix `SIGINT' is the signal
-a program gets when you type an interrupt (often `C-c'); `SIGSEGV' is
-the signal a program gets from referencing a place in memory far away
-from all the areas in use; `SIGALRM' occurs when the alarm clock timer
-goes off (which happens only if your program has requested an alarm).
-
- Some signals, including `SIGALRM', are a normal part of the
-functioning of your program. Others, such as `SIGSEGV', indicate
-errors; these signals are "fatal" (kill your program immediately) if the
-program has not specified in advance some other way to handle the
-signal. `SIGINT' does not indicate an error in your program, but it is
-normally fatal so it can carry out the purpose of the interrupt: to
-kill the program.
-
- GDB has the ability to detect any occurrence of a signal in your
-program. You can tell GDB in advance what to do for each kind of
-signal.
-
- Normally, GDB is set up to ignore non-erroneous signals like
-`SIGALRM' (so as not to interfere with their role in the functioning of
-your program) but to stop your program immediately whenever an error
-signal happens. You can change these settings with the `handle'
-command.
-
-`info signals'
- Print a table of all the kinds of signals and how GDB has been
- told to handle each one. You can use this to see the signal
- numbers of all the defined types of signals.
-
-`handle SIGNAL KEYWORDS...'
- Change the way GDB handles signal SIGNAL. SIGNAL can be the
- number of a signal or its name (with or without the `SIG' at the
- beginning). The KEYWORDS say what change to make.
-
- The keywords allowed by the `handle' command can be abbreviated.
-Their full names are:
-
-`nostop'
- GDB should not stop your program when this signal happens. It may
- still print a message telling you that the signal has come in.
-
-`stop'
- GDB should stop your program when this signal happens. This
- implies the `print' keyword as well.
-
-`print'
- GDB should print a message when this signal happens.
-
-`noprint'
- GDB should not mention the occurrence of the signal at all. This
- implies the `nostop' keyword as well.
-
-`pass'
- GDB should allow your program to see this signal; your program
- will be able to handle the signal, or may be terminated if the
- signal is fatal and not handled.
-
-`nopass'
- GDB should not allow your program to see this signal.
-
- When a signal stops your program, the signal is not visible until you
-continue. Your program will see the signal then, if `pass' is in
-effect for the signal in question *at that time*. In other words,
-after GDB reports a signal, you can use the `handle' command with
-`pass' or `nopass' to control whether that signal will be seen by your
-program when you later continue it.
-
- You can also use the `signal' command to prevent your program from
-seeing a signal, or cause it to see a signal it normally would not see,
-or to give it any signal at any time. For example, if your program
-stopped due to some sort of memory reference error, you might store
-correct values into the erroneous variables and continue, hoping to see
-more execution; but your program would probably terminate immediately as
-a result of the fatal signal once it saw the signal. To prevent this,
-you can continue with `signal 0'. *Note Giving your program a signal:
-Signaling.
-
-
-File: gdb.info, Node: Stack, Next: Source, Prev: Stopping, Up: Top
-
-Examining the Stack
-*******************
-
- When your program has stopped, the first thing you need to know is
-where it stopped and how it got there.
-
- Each time your program performs a function call, the information
-about where in your program the call was made from is saved in a block
-of data called a "stack frame". The frame also contains the arguments
-of the call and the local variables of the function that was called.
-All the stack frames are allocated in a region of memory called the
-"call stack".
-
- When your program stops, the GDB commands for examining the stack
-allow you to see all of this information.
-
- One of the stack frames is "selected" by GDB and many GDB commands
-refer implicitly to the selected frame. In particular, whenever you
-ask GDB for the value of a variable in your program, the value is found
-in the selected frame. There are special GDB commands to select
-whichever frame you are interested in.
-
- When your program stops, GDB automatically selects the currently
-executing frame and describes it briefly as the `frame' command does
-(*note Information about a frame: Frame Info.).
-
-* Menu:
-
-* Frames:: Stack frames
-* Backtrace:: Backtraces
-* Selection:: Selecting a frame
-* Frame Info:: Information on a frame
-
-* MIPS Stack:: MIPS machines and the function stack
-
-
-File: gdb.info, Node: Frames, Next: Backtrace, Up: Stack
-
-Stack frames
-============
-
- The call stack is divided up into contiguous pieces called "stack
-frames", or "frames" for short; each frame is the data associated with
-one call to one function. The frame contains the arguments given to
-the function, the function's local variables, and the address at which
-the function is executing.
-
- When your program is started, the stack has only one frame, that of
-the function `main'. This is called the "initial" frame or the
-"outermost" frame. Each time a function is called, a new frame is
-made. Each time a function returns, the frame for that function
-invocation is eliminated. If a function is recursive, there can be
-many frames for the same function. The frame for the function in which
-execution is actually occurring is called the "innermost" frame. This
-is the most recently created of all the stack frames that still exist.
-
- Inside your program, stack frames are identified by their addresses.
-A stack frame consists of many bytes, each of which has its own
-address; each kind of computer has a convention for choosing one of
-those bytes whose address serves as the address of the frame. Usually
-this address is kept in a register called the "frame pointer register"
-while execution is going on in that frame.
-
- GDB assigns numbers to all existing stack frames, starting with zero
-for the innermost frame, one for the frame that called it, and so on
-upward. These numbers do not really exist in your program; they are
-assigned by GDB to give you a way of designating stack frames in GDB
-commands.
-
- Some compilers provide a way to compile functions so that they
-operate without stack frames. (For example, the `gcc' option
-`-fomit-frame-pointer' will generate functions without a frame.) This
-is occasionally done with heavily used library functions to save the
-frame setup time. GDB has limited facilities for dealing with these
-function invocations. If the innermost function invocation has no
-stack frame, GDB will nevertheless regard it as though it had a
-separate frame, which is numbered zero as usual, allowing correct
-tracing of the function call chain. However, GDB has no provision for
-frameless functions elsewhere in the stack.
-
-
-File: gdb.info, Node: Backtrace, Next: Selection, Prev: Frames, Up: Stack
-
-Backtraces
-==========
-
- A backtrace is a summary of how your program got where it is. It
-shows one line per frame, for many frames, starting with the currently
-executing frame (frame zero), followed by its caller (frame one), and
-on up the stack.
-
-`backtrace'
-`bt'
- Print a backtrace of the entire stack: one line per frame for all
- frames in the stack.
-
- You can stop the backtrace at any time by typing the system
- interrupt character, normally `C-c'.
-
-`backtrace N'
-`bt N'
- Similar, but print only the innermost N frames.
-
-`backtrace -N'
-`bt -N'
- Similar, but print only the outermost N frames.
-
- The names `where' and `info stack' (abbreviated `info s') are
-additional aliases for `backtrace'.
-
- Each line in the backtrace shows the frame number and the function
-name. The program counter value is also shown--unless you use `set
-print address off'. The backtrace also shows the source file name and
-line number, as well as the arguments to the function. The program
-counter value is omitted if it is at the beginning of the code for that
-line number.
-
- Here is an example of a backtrace. It was made with the command `bt
-3', so it shows the innermost three frames.
-
- #0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8)
- at builtin.c:993
- #1 0x6e38 in expand_macro (sym=0x2b600) at macro.c:242
- #2 0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08)
- at macro.c:71
- (More stack frames follow...)
-
-The display for frame zero does not begin with a program counter value,
-indicating that your program has stopped at the beginning of the code
-for line `993' of `builtin.c'.
-
diff --git a/gnu/usr.bin/gdb/doc/gdb.info-3 b/gnu/usr.bin/gdb/doc/gdb.info-3
deleted file mode 100644
index aea5862..0000000
--- a/gnu/usr.bin/gdb/doc/gdb.info-3
+++ /dev/null
@@ -1,1264 +0,0 @@
-This is Info file ./gdb.info, produced by Makeinfo-1.52 from the input
-file gdb.texinfo.
-
-START-INFO-DIR-ENTRY
-* Gdb:: The GNU debugger.
-END-INFO-DIR-ENTRY
- This file documents the GNU debugger GDB.
-
- This is Edition 4.09, August 1993, of `Debugging with GDB: the GNU
-Source-Level Debugger' for GDB Version 4.11.
-
- Copyright (C) 1988, '89, '90, '91, '92, '93 Free Software
-Foundation, Inc.
-
- Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of
-this manual under the conditions for verbatim copying, provided also
-that the entire resulting derived work is distributed under the terms
-of a permission notice identical to this one.
-
- Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions.
-
-
-File: gdb.info, Node: Selection, Next: Frame Info, Prev: Backtrace, Up: Stack
-
-Selecting a frame
-=================
-
- Most commands for examining the stack and other data in your program
-work on whichever stack frame is selected at the moment. Here are the
-commands for selecting a stack frame; all of them finish by printing a
-brief description of the stack frame just selected.
-
-`frame N'
-`f N'
- Select frame number N. Recall that frame zero is the innermost
- (currently executing) frame, frame one is the frame that called the
- innermost one, and so on. The highest-numbered frame is the one
- for `main'.
-
-`frame ADDR'
-`f ADDR'
- Select the frame at address ADDR. This is useful mainly if the
- chaining of stack frames has been damaged by a bug, making it
- impossible for GDB to assign numbers properly to all frames. In
- addition, this can be useful when your program has multiple stacks
- and switches between them.
-
- On the SPARC architecture, `frame' needs two addresses to select
- an arbitrary frame: a frame pointer and a stack pointer.
-
-`up N'
- Move N frames up the stack. For positive numbers N, this advances
- toward the outermost frame, to higher frame numbers, to frames
- that have existed longer. N defaults to one.
-
-`down N'
- Move N frames down the stack. For positive numbers N, this
- advances toward the innermost frame, to lower frame numbers, to
- frames that were created more recently. N defaults to one. You
- may abbreviate `down' as `do'.
-
- All of these commands end by printing two lines of output describing
-the frame. The first line shows the frame number, the function name,
-the arguments, and the source file and line number of execution in that
-frame. The second line shows the text of that source line.
-
- For example:
- (gdb) up
- #1 0x22f0 in main (argc=1, argv=0xf7fffbf4, env=0xf7fffbfc)
- at env.c:10
- 10 read_input_file (argv[i]);
-
- After such a printout, the `list' command with no arguments will
-print ten lines centered on the point of execution in the frame. *Note
-Printing source lines: List.
-
-`up-silently N'
-`down-silently N'
- These two commands are variants of `up' and `down', respectively;
- they differ in that they do their work silently, without causing
- display of the new frame. They are intended primarily for use in
- GDB command scripts, where the output might be unnecessary and
- distracting.
-
-
-File: gdb.info, Node: Frame Info, Next: MIPS Stack, Prev: Selection, Up: Stack
-
-Information about a frame
-=========================
-
- There are several other commands to print information about the
-selected stack frame.
-
-`frame'
-`f'
- When used without any argument, this command does not change which
- frame is selected, but prints a brief description of the currently
- selected stack frame. It can be abbreviated `f'. With an
- argument, this command is used to select a stack frame. *Note
- Selecting a frame: Selection.
-
-`info frame'
-`info f'
- This command prints a verbose description of the selected stack
- frame, including the address of the frame, the addresses of the
- next frame down (called by this frame) and the next frame up
- (caller of this frame), the language that the source code
- corresponding to this frame was written in, the address of the
- frame's arguments, the program counter saved in it (the address of
- execution in the caller frame), and which registers were saved in
- the frame. The verbose description is useful when something has
- gone wrong that has made the stack format fail to fit the usual
- conventions.
-
-`info frame ADDR'
-`info f ADDR'
- Print a verbose description of the frame at address ADDR, without
- selecting that frame. The selected frame remains unchanged by
- this command.
-
-`info args'
- Print the arguments of the selected frame, each on a separate line.
-
-`info locals'
- Print the local variables of the selected frame, each on a separate
- line. These are all variables (declared either static or
- automatic) accessible at the point of execution of the selected
- frame.
-
-`info catch'
- Print a list of all the exception handlers that are active in the
- current stack frame at the current point of execution. To see
- other exception handlers, visit the associated frame (using the
- `up', `down', or `frame' commands); then type `info catch'. *Note
- Breakpoints and exceptions: Exception Handling.
-
-
-File: gdb.info, Node: MIPS Stack, Prev: Frame Info, Up: Stack
-
-MIPS machines and the function stack
-====================================
-
- MIPS based computers use an unusual stack frame, which sometimes
-requires GDB to search backward in the object code to find the
-beginning of a function.
-
- To improve response time (especially for embedded applications, where
-GDB may be restricted to a slow serial line for this search) you may
-want to limit the size of this search, using one of these commands:
-
-`set heuristic-fence-post LIMIT'
- Restrict GDBN to examining at most LIMIT bytes in its search for
- the beginning of a function. A value of `0' (the default) means
- there is no limit.
-
-`show heuristic-fence-post'
- Display the current limit.
-
-These commands are available *only* when GDB is configured for
-debugging programs on MIPS processors.
-
-
-File: gdb.info, Node: Source, Next: Data, Prev: Stack, Up: Top
-
-Examining Source Files
-**********************
-
- GDB can print parts of your program's source, since the debugging
-information recorded in the program tells GDB what source files were
-used to build it. When your program stops, GDB spontaneously prints
-the line where it stopped. Likewise, when you select a stack frame
-(*note Selecting a frame: Selection.), GDB prints the line where
-execution in that frame has stopped. You can print other portions of
-source files by explicit command.
-
- If you use GDB through its GNU Emacs interface, you may prefer to use
-Emacs facilities to view source; *note Using GDB under GNU Emacs:
-Emacs..
-
-* Menu:
-
-* List:: Printing source lines
-
-* Search:: Searching source files
-
-* Source Path:: Specifying source directories
-* Machine Code:: Source and machine code
-
-
-File: gdb.info, Node: List, Next: Search, Up: Source
-
-Printing source lines
-=====================
-
- To print lines from a source file, use the `list' command
-(abbreviated `l'). There are several ways to specify what part of the
-file you want to print.
-
- Here are the forms of the `list' command most commonly used:
-
-`list LINENUM'
- Print lines centered around line number LINENUM in the current
- source file.
-
-`list FUNCTION'
- Print lines centered around the beginning of function FUNCTION.
-
-`list'
- Print more lines. If the last lines printed were printed with a
- `list' command, this prints lines following the last lines
- printed; however, if the last line printed was a solitary line
- printed as part of displaying a stack frame (*note Examining the
- Stack: Stack.), this prints lines centered around that line.
-
-`list -'
- Print lines just before the lines last printed.
-
- By default, GDB prints ten source lines with any of these forms of
-the `list' command. You can change this using `set listsize':
-
-`set listsize COUNT'
- Make the `list' command display COUNT source lines (unless the
- `list' argument explicitly specifies some other number).
-
-`show listsize'
- Display the number of lines that `list' will currently display by
- default.
-
- Repeating a `list' command with RET discards the argument, so it is
-equivalent to typing just `list'. This is more useful than listing the
-same lines again. An exception is made for an argument of `-'; that
-argument is preserved in repetition so that each repetition moves up in
-the source file.
-
- In general, the `list' command expects you to supply zero, one or two
-"linespecs". Linespecs specify source lines; there are several ways of
-writing them but the effect is always to specify some source line.
-Here is a complete description of the possible arguments for `list':
-
-`list LINESPEC'
- Print lines centered around the line specified by LINESPEC.
-
-`list FIRST,LAST'
- Print lines from FIRST to LAST. Both arguments are linespecs.
-
-`list ,LAST'
- Print lines ending with LAST.
-
-`list FIRST,'
- Print lines starting with FIRST.
-
-`list +'
- Print lines just after the lines last printed.
-
-`list -'
- Print lines just before the lines last printed.
-
-`list'
- As described in the preceding table.
-
- Here are the ways of specifying a single source line--all the kinds
-of linespec.
-
-`NUMBER'
- Specifies line NUMBER of the current source file. When a `list'
- command has two linespecs, this refers to the same source file as
- the first linespec.
-
-`+OFFSET'
- Specifies the line OFFSET lines after the last line printed. When
- used as the second linespec in a `list' command that has two, this
- specifies the line OFFSET lines down from the first linespec.
-
-`-OFFSET'
- Specifies the line OFFSET lines before the last line printed.
-
-`FILENAME:NUMBER'
- Specifies line NUMBER in the source file FILENAME.
-
-`FUNCTION'
- Specifies the line of the open-brace that begins the body of the
- function FUNCTION.
-
-`FILENAME:FUNCTION'
- Specifies the line of the open-brace that begins the body of the
- function FUNCTION in the file FILENAME. You only need the file
- name with a function name to avoid ambiguity when there are
- identically named functions in different source files.
-
-`*ADDRESS'
- Specifies the line containing the program address ADDRESS.
- ADDRESS may be any expression.
-
-
-File: gdb.info, Node: Search, Next: Source Path, Prev: List, Up: Source
-
-Searching source files
-======================
-
- There are two commands for searching through the current source file
-for a regular expression.
-
-`forward-search REGEXP'
-`search REGEXP'
- The command `forward-search REGEXP' checks each line, starting
- with the one following the last line listed, for a match for
- REGEXP. It lists the line that is found. You can use synonym
- `search REGEXP' or abbreviate the command name as `fo'.
-
-`reverse-search REGEXP'
- The command `reverse-search REGEXP' checks each line, starting
- with the one before the last line listed and going backward, for a
- match for REGEXP. It lists the line that is found. You can
- abbreviate this command as `rev'.
-
-
-File: gdb.info, Node: Source Path, Next: Machine Code, Prev: Search, Up: Source
-
-Specifying source directories
-=============================
-
- Executable programs sometimes do not record the directories of the
-source files from which they were compiled, just the names. Even when
-they do, the directories could be moved between the compilation and
-your debugging session. GDB has a list of directories to search for
-source files; this is called the "source path". Each time GDB wants a
-source file, it tries all the directories in the list, in the order
-they are present in the list, until it finds a file with the desired
-name. Note that the executable search path is *not* used for this
-purpose. Neither is the current working directory, unless it happens
-to be in the source path.
-
- If GDB cannot find a source file in the source path, and the object
-program records a directory, GDB tries that directory too. If the
-source path is empty, and there is no record of the compilation
-directory, GDB will, as a last resort, look in the current directory.
-
- Whenever you reset or rearrange the source path, GDB will clear out
-any information it has cached about where source files are found, where
-each line is in the file, etc.
-
- When you start GDB, its source path is empty. To add other
-directories, use the `directory' command.
-
-`directory DIRNAME ...'
- Add directory DIRNAME to the front of the source path. Several
- directory names may be given to this command, separated by `:' or
- whitespace. You may specify a directory that is already in the
- source path; this moves it forward, so it will be searched sooner.
-
- You can use the string `$cdir' to refer to the compilation
- directory (if one is recorded), and `$cwd' to refer to the current
- working directory. `$cwd' is not the same as `.'--the former
- tracks the current working directory as it changes during your GDB
- session, while the latter is immediately expanded to the current
- directory at the time you add an entry to the source path.
-
-`directory'
- Reset the source path to empty again. This requires confirmation.
-
-`show directories'
- Print the source path: show which directories it contains.
-
- If your source path is cluttered with directories that are no longer
-of interest, GDB may sometimes cause confusion by finding the wrong
-versions of source. You can correct the situation as follows:
-
- 1. Use `directory' with no argument to reset the source path to empty.
-
- 2. Use `directory' with suitable arguments to reinstall the
- directories you want in the source path. You can add all the
- directories in one command.
-
-
-File: gdb.info, Node: Machine Code, Prev: Source Path, Up: Source
-
-Source and machine code
-=======================
-
- You can use the command `info line' to map source lines to program
-addresses (and vice versa), and the command `disassemble' to display a
-range of addresses as machine instructions.
-
-`info line LINESPEC'
- Print the starting and ending addresses of the compiled code for
- source line LINESPEC. You can specify source lines in any of the
- ways understood by the `list' command (*note Printing source
- lines: List.).
-
- For example, we can use `info line' to discover the location of the
-object code for the first line of function `m4_changequote':
-
- (gdb) info line m4_changecom
- Line 895 of "builtin.c" starts at pc 0x634c and ends at 0x6350.
-
-We can also inquire (using `*ADDR' as the form for LINESPEC) what
-source line covers a particular address:
- (gdb) info line *0x63ff
- Line 926 of "builtin.c" starts at pc 0x63e4 and ends at 0x6404.
-
- After `info line', the default address for the `x' command is
-changed to the starting address of the line, so that `x/i' is
-sufficient to begin examining the machine code (*note Examining memory:
-Memory.). Also, this address is saved as the value of the convenience
-variable `$_' (*note Convenience variables: Convenience Vars.).
-
-`disassemble'
- This specialized command dumps a range of memory as machine
- instructions. The default memory range is the function
- surrounding the program counter of the selected frame. A single
- argument to this command is a program counter value; the function
- surrounding this value will be dumped. Two arguments specify a
- range of addresses (first inclusive, second exclusive) to dump.
-
- We can use `disassemble' to inspect the object code range shown in
-the last `info line' example (the example shows SPARC machine
-instructions):
-
- (gdb) disas 0x63e4 0x6404
- Dump of assembler code from 0x63e4 to 0x6404:
- 0x63e4 <builtin_init+5340>: ble 0x63f8 <builtin_init+5360>
- 0x63e8 <builtin_init+5344>: sethi %hi(0x4c00), %o0
- 0x63ec <builtin_init+5348>: ld [%i1+4], %o0
- 0x63f0 <builtin_init+5352>: b 0x63fc <builtin_init+5364>
- 0x63f4 <builtin_init+5356>: ld [%o0+4], %o0
- 0x63f8 <builtin_init+5360>: or %o0, 0x1a4, %o0
- 0x63fc <builtin_init+5364>: call 0x9288 <path_search>
- 0x6400 <builtin_init+5368>: nop
- End of assembler dump.
-
-
-File: gdb.info, Node: Data, Next: Languages, Prev: Source, Up: Top
-
-Examining Data
-**************
-
- The usual way to examine data in your program is with the `print'
-command (abbreviated `p'), or its synonym `inspect'. It evaluates and
-prints the value of an expression of the language your program is
-written in (*note Using GDB with Different Languages: Languages.).
-
-`print EXP'
-`print /F EXP'
- EXP is an expression (in the source language). By default the
- value of EXP is printed in a format appropriate to its data type;
- you can choose a different format by specifying `/F', where F is a
- letter specifying the format; *note Output formats: Output
- Formats..
-
-`print'
-`print /F'
- If you omit EXP, GDB displays the last value again (from the
- "value history"; *note Value history: Value History.). This
- allows you to conveniently inspect the same value in an
- alternative format.
-
- A more low-level way of examining data is with the `x' command. It
-examines data in memory at a specified address and prints it in a
-specified format. *Note Examining memory: Memory.
-
- If you are interested in information about types, or about how the
-fields of a struct or class are declared, use the `ptype EXP' command
-rather than `print'. *Note Examining the Symbol Table: Symbols.
-
-* Menu:
-
-* Expressions:: Expressions
-* Variables:: Program variables
-* Arrays:: Artificial arrays
-* Output Formats:: Output formats
-* Memory:: Examining memory
-* Auto Display:: Automatic display
-* Print Settings:: Print settings
-* Value History:: Value history
-* Convenience Vars:: Convenience variables
-* Registers:: Registers
-
-* Floating Point Hardware:: Floating point hardware
-
-
-File: gdb.info, Node: Expressions, Next: Variables, Up: Data
-
-Expressions
-===========
-
- `print' and many other GDB commands accept an expression and compute
-its value. Any kind of constant, variable or operator defined by the
-programming language you are using is valid in an expression in GDB.
-This includes conditional expressions, function calls, casts and string
-constants. It unfortunately does not include symbols defined by
-preprocessor `#define' commands.
-
- Because C is so widespread, most of the expressions shown in
-examples in this manual are in C. *Note Using GDB with Different
-Languages: Languages, for information on how to use expressions in other
-languages.
-
- In this section, we discuss operators that you can use in GDB
-expressions regardless of your programming language.
-
- Casts are supported in all languages, not just in C, because it is so
-useful to cast a number into a pointer so as to examine a structure at
-that address in memory.
-
- GDB supports these operators in addition to those of programming
-languages:
-
-`@'
- `@' is a binary operator for treating parts of memory as arrays.
- *Note Artificial arrays: Arrays, for more information.
-
-`::'
- `::' allows you to specify a variable in terms of the file or
- function where it is defined. *Note Program variables: Variables.
-
-`{TYPE} ADDR'
- Refers to an object of type TYPE stored at address ADDR in memory.
- ADDR may be any expression whose value is an integer or pointer
- (but parentheses are required around binary operators, just as in
- a cast). This construct is allowed regardless of what kind of
- data is normally supposed to reside at ADDR.
-
-
-File: gdb.info, Node: Variables, Next: Arrays, Prev: Expressions, Up: Data
-
-Program variables
-=================
-
- The most common kind of expression to use is the name of a variable
-in your program.
-
- Variables in expressions are understood in the selected stack frame
-(*note Selecting a frame: Selection.); they must either be global (or
-static) or be visible according to the scope rules of the programming
-language from the point of execution in that frame. This means that in
-the function
-
- foo (a)
- int a;
- {
- bar (a);
- {
- int b = test ();
- bar (b);
- }
- }
-
-you can examine and use the variable `a' whenever your program is
-executing within the function `foo', but you can only use or examine
-the variable `b' while your program is executing inside the block where
-`b' is declared.
-
- There is an exception: you can refer to a variable or function whose
-scope is a single source file even if the current execution point is not
-in this file. But it is possible to have more than one such variable or
-function with the same name (in different source files). If that
-happens, referring to that name has unpredictable effects. If you wish,
-you can specify a static variable in a particular function or file,
-using the colon-colon notation:
-
- FILE::VARIABLE
- FUNCTION::VARIABLE
-
-Here FILE or FUNCTION is the name of the context for the static
-VARIABLE. In the case of file names, you can use quotes to make sure
-GDB parses the file name as a single word--for example, to print a
-global value of `x' defined in `f2.c':
-
- (gdb) p 'f2.c'::x
-
- This use of `::' is very rarely in conflict with the very similar
-use of the same notation in C++. GDB also supports use of the C++
-scope resolution operator in GDB expressions.
-
- *Warning:* Occasionally, a local variable may appear to have the
- wrong value at certain points in a function--just after entry to a
- new scope, and just before exit.
- You may see this problem when you are stepping by machine
-instructions. This is because on most machines, it takes more than one
-instruction to set up a stack frame (including local variable
-definitions); if you are stepping by machine instructions, variables
-may appear to have the wrong values until the stack frame is completely
-built. On exit, it usually also takes more than one machine
-instruction to destroy a stack frame; after you begin stepping through
-that group of instructions, local variable definitions may be gone.
-
-
-File: gdb.info, Node: Arrays, Next: Output Formats, Prev: Variables, Up: Data
-
-Artificial arrays
-=================
-
- It is often useful to print out several successive objects of the
-same type in memory; a section of an array, or an array of dynamically
-determined size for which only a pointer exists in the program.
-
- You can do this by referring to a contiguous span of memory as an
-"artificial array", using the binary operator `@'. The left operand of
-`@' should be the first element of the desired array, as an individual
-object. The right operand should be the desired length of the array.
-The result is an array value whose elements are all of the type of the
-left argument. The first element is actually the left argument; the
-second element comes from bytes of memory immediately following those
-that hold the first element, and so on. Here is an example. If a
-program says
-
- int *array = (int *) malloc (len * sizeof (int));
-
-you can print the contents of `array' with
-
- p *array@len
-
- The left operand of `@' must reside in memory. Array values made
-with `@' in this way behave just like other arrays in terms of
-subscripting, and are coerced to pointers when used in expressions.
-Artificial arrays most often appear in expressions via the value history
-(*note Value history: Value History.), after printing one out.
-
- Sometimes the artificial array mechanism is not quite enough; in
-moderately complex data structures, the elements of interest may not
-actually be adjacent--for example, if you are interested in the values
-of pointers in an array. One useful work-around in this situation is
-to use a convenience variable (*note Convenience variables: Convenience
-Vars.) as a counter in an expression that prints the first interesting
-value, and then repeat that expression via RET. For instance, suppose
-you have an array `dtab' of pointers to structures, and you are
-interested in the values of a field `fv' in each structure. Here is an
-example of what you might type:
-
- set $i = 0
- p dtab[$i++]->fv
- RET
- RET
- ...
-
-
-File: gdb.info, Node: Output Formats, Next: Memory, Prev: Arrays, Up: Data
-
-Output formats
-==============
-
- By default, GDB prints a value according to its data type. Sometimes
-this is not what you want. For example, you might want to print a
-number in hex, or a pointer in decimal. Or you might want to view data
-in memory at a certain address as a character string or as an
-instruction. To do these things, specify an "output format" when you
-print a value.
-
- The simplest use of output formats is to say how to print a value
-already computed. This is done by starting the arguments of the
-`print' command with a slash and a format letter. The format letters
-supported are:
-
-`x'
- Regard the bits of the value as an integer, and print the integer
- in hexadecimal.
-
-`d'
- Print as integer in signed decimal.
-
-`u'
- Print as integer in unsigned decimal.
-
-`o'
- Print as integer in octal.
-
-`t'
- Print as integer in binary. The letter `t' stands for "two". (1)
-
-`a'
- Print as an address, both absolute in hex and as an offset from the
- nearest preceding symbol. This format can be used to discover
- where (in what function) an unknown address is located:
-
- (gdb) p/a 0x54320
- $3 = 0x54320 <_initialize_vx+396>
-
-`c'
- Regard as an integer and print it as a character constant.
-
-`f'
- Regard the bits of the value as a floating point number and print
- using typical floating point syntax.
-
- For example, to print the program counter in hex (*note
-Registers::.), type
-
- p/x $pc
-
-Note that no space is required before the slash; this is because command
-names in GDB cannot contain a slash.
-
- To reprint the last value in the value history with a different
-format, you can use the `print' command with just a format and no
-expression. For example, `p/x' reprints the last value in hex.
-
- ---------- Footnotes ----------
-
- (1) `b' cannot be used because these format letters are also used
-with the `x' command, where `b' stands for "byte"; *note Examining
-memory: Memory..
-
-
-File: gdb.info, Node: Memory, Next: Auto Display, Prev: Output Formats, Up: Data
-
-Examining memory
-================
-
- You can use the command `x' (for "examine") to examine memory in any
-of several formats, independently of your program's data types.
-
-`x/NFU ADDR'
-`x ADDR'
-`x'
- Use the `x' command to examine memory.
-
- N, F, and U are all optional parameters that specify how much memory
-to display and how to format it; ADDR is an expression giving the
-address where you want to start displaying memory. If you use defaults
-for NFU, you need not type the slash `/'. Several commands set
-convenient defaults for ADDR.
-
-N, the repeat count
- The repeat count is a decimal integer; the default is 1. It
- specifies how much memory (counting by units U) to display.
-
-F, the display format
- The display format is one of the formats used by `print', or `s'
- (null-terminated string) or `i' (machine instruction). The
- default is `x' (hexadecimal) initially, or the format from the
- last time you used either `x' or `print'.
-
-U, the unit size
- The unit size is any of
-
- `b'
- Bytes.
-
- `h'
- Halfwords (two bytes).
-
- `w'
- Words (four bytes). This is the initial default.
-
- `g'
- Giant words (eight bytes).
-
- Each time you specify a unit size with `x', that size becomes the
- default unit the next time you use `x'. (For the `s' and `i'
- formats, the unit size is ignored and is normally not written.)
-
-ADDR, starting display address
- ADDR is the address where you want GDB to begin displaying memory.
- The expression need not have a pointer value (though it may); it
- is always interpreted as an integer address of a byte of memory.
- *Note Expressions: Expressions, for more information on
- expressions. The default for ADDR is usually just after the last
- address examined--but several other commands also set the default
- address: `info breakpoints' (to the address of the last breakpoint
- listed), `info line' (to the starting address of a line), and
- `print' (if you use it to display a value from memory).
-
- For example, `x/3uh 0x54320' is a request to display three halfwords
-(`h') of memory, formatted as unsigned decimal integers (`u'), starting
-at address `0x54320'. `x/4xw $sp' prints the four words (`w') of
-memory above the stack pointer (here, `$sp'; *note Registers::.) in
-hexadecimal (`x').
-
- Since the letters indicating unit sizes are all distinct from the
-letters specifying output formats, you do not have to remember whether
-unit size or format comes first; either order will work. The output
-specifications `4xw' and `4wx' mean exactly the same thing. (However,
-the count N must come first; `wx4' will not work.)
-
- Even though the unit size U is ignored for the formats `s' and `i',
-you might still want to use a count N; for example, `3i' specifies that
-you want to see three machine instructions, including any operands.
-The command `disassemble' gives an alternative way of inspecting
-machine instructions; *note Source and machine code: Machine Code..
-
- All the defaults for the arguments to `x' are designed to make it
-easy to continue scanning memory with minimal specifications each time
-you use `x'. For example, after you have inspected three machine
-instructions with `x/3i ADDR', you can inspect the next seven with just
-`x/7'. If you use RET to repeat the `x' command, the repeat count N is
-used again; the other arguments default as for successive uses of `x'.
-
- The addresses and contents printed by the `x' command are not saved
-in the value history because there is often too much of them and they
-would get in the way. Instead, GDB makes these values available for
-subsequent use in expressions as values of the convenience variables
-`$_' and `$__'. After an `x' command, the last address examined is
-available for use in expressions in the convenience variable `$_'. The
-contents of that address, as examined, are available in the convenience
-variable `$__'.
-
- If the `x' command has a repeat count, the address and contents saved
-are from the last memory unit printed; this is not the same as the last
-address printed if several units were printed on the last line of
-output.
-
-
-File: gdb.info, Node: Auto Display, Next: Print Settings, Prev: Memory, Up: Data
-
-Automatic display
-=================
-
- If you find that you want to print the value of an expression
-frequently (to see how it changes), you might want to add it to the
-"automatic display list" so that GDB will print its value each time
-your program stops. Each expression added to the list is given a
-number to identify it; to remove an expression from the list, you
-specify that number. The automatic display looks like this:
-
- 2: foo = 38
- 3: bar[5] = (struct hack *) 0x3804
-
-This display shows item numbers, expressions and their current values.
-As with displays you request manually using `x' or `print', you can
-specify the output format you prefer; in fact, `display' decides
-whether to use `print' or `x' depending on how elaborate your format
-specification is--it uses `x' if you specify a unit size, or one of the
-two formats (`i' and `s') that are only supported by `x'; otherwise it
-uses `print'.
-
-`display EXP'
- Add the expression EXP to the list of expressions to display each
- time your program stops. *Note Expressions: Expressions.
-
- `display' will not repeat if you press RET again after using it.
-
-`display/FMT EXP'
- For FMT specifying only a display format and not a size or count,
- add the expression EXP to the auto-display list but arrange to
- display it each time in the specified format FMT. *Note Output
- formats: Output Formats.
-
-`display/FMT ADDR'
- For FMT `i' or `s', or including a unit-size or a number of units,
- add the expression ADDR as a memory address to be examined each
- time your program stops. Examining means in effect doing `x/FMT
- ADDR'. *Note Examining memory: Memory.
-
- For example, `display/i $pc' can be helpful, to see the machine
-instruction about to be executed each time execution stops (`$pc' is a
-common name for the program counter; *note Registers::.).
-
-`undisplay DNUMS...'
-`delete display DNUMS...'
- Remove item numbers DNUMS from the list of expressions to display.
-
- `undisplay' will not repeat if you press RET after using it.
- (Otherwise you would just get the error `No display number ...'.)
-
-`disable display DNUMS...'
- Disable the display of item numbers DNUMS. A disabled display
- item is not printed automatically, but is not forgotten. It may be
- enabled again later.
-
-`enable display DNUMS...'
- Enable display of item numbers DNUMS. It becomes effective once
- again in auto display of its expression, until you specify
- otherwise.
-
-`display'
- Display the current values of the expressions on the list, just as
- is done when your program stops.
-
-`info display'
- Print the list of expressions previously set up to display
- automatically, each one with its item number, but without showing
- the values. This includes disabled expressions, which are marked
- as such. It also includes expressions which would not be
- displayed right now because they refer to automatic variables not
- currently available.
-
- If a display expression refers to local variables, then it does not
-make sense outside the lexical context for which it was set up. Such an
-expression is disabled when execution enters a context where one of its
-variables is not defined. For example, if you give the command
-`display last_char' while inside a function with an argument
-`last_char', then this argument will be displayed while your program
-continues to stop inside that function. When it stops elsewhere--where
-there is no variable `last_char'--display is disabled. The next time
-your program stops where `last_char' is meaningful, you can enable the
-display expression once again.
-
-
-File: gdb.info, Node: Print Settings, Next: Value History, Prev: Auto Display, Up: Data
-
-Print settings
-==============
-
- GDB provides the following ways to control how arrays, structures,
-and symbols are printed.
-
-These settings are useful for debugging programs in any language:
-
-`set print address'
-`set print address on'
- GDB will print memory addresses showing the location of stack
- traces, structure values, pointer values, breakpoints, and so
- forth, even when it also displays the contents of those addresses.
- The default is on. For example, this is what a stack frame
- display looks like, with `set print address on':
-
- (gdb) f
- #0 set_quotes (lq=0x34c78 "<<", rq=0x34c88 ">>")
- at input.c:530
- 530 if (lquote != def_lquote)
-
-`set print address off'
- Do not print addresses when displaying their contents. For
- example, this is the same stack frame displayed with `set print
- address off':
-
- (gdb) set print addr off
- (gdb) f
- #0 set_quotes (lq="<<", rq=">>") at input.c:530
- 530 if (lquote != def_lquote)
-
- You can use `set print address off' to eliminate all machine
- dependent displays from the GDB interface. For example, with
- `print address off', you should get the same text for backtraces on
- all machines--whether or not they involve pointer arguments.
-
-`show print address'
- Show whether or not addresses are to be printed.
-
- When GDB prints a symbolic address, it normally prints the closest
-earlier symbol plus an offset. If that symbol does not uniquely
-identify the address (for example, it is a name whose scope is a single
-source file), you may need to disambiguate. One way to do this is with
-`info line', for example `info line *0x4537'. Alternately, you can set
-GDB to print the source file and line number when it prints a symbolic
-address:
-
-`set print symbol-filename on'
- Tell GDB to print the source file name and line number of a symbol
- in the symbolic form of an address.
-
-`set print symbol-filename off'
- Do not print source file name and line number of a symbol. This
- is the default.
-
-`show print symbol-filename'
- Show whether or not GDB will print the source file name and line
- number of a symbol in the symbolic form of an address.
-
- Also, you may wish to see the symbolic form only if the address being
-printed is reasonably close to the closest earlier symbol:
-
-`set print max-symbolic-offset MAX-OFFSET'
- Tell GDB to only display the symbolic form of an address if the
- offset between the closest earlier symbol and the address is less
- than MAX-OFFSET. The default is 0, which means to always print the
- symbolic form of an address, if any symbol precedes it.
-
-`show print max-symbolic-offset'
- Ask how large the maximum offset is that GDB will print in a
- symbolic address.
-
-`set print array'
-`set print array on'
- GDB will pretty-print arrays. This format is more convenient to
- read, but uses more space. The default is off.
-
-`set print array off'
- Return to compressed format for arrays.
-
-`show print array'
- Show whether compressed or pretty format is selected for displaying
- arrays.
-
-`set print elements NUMBER-OF-ELEMENTS'
- If GDB is printing a large array, it will stop printing after it
- has printed the number of elements set by the `set print elements'
- command. This limit also applies to the display of strings.
- Setting the number of elements to zero means that the printing is
- unlimited.
-
-`show print elements'
- Display the number of elements of a large array that GDB will print
- before losing patience.
-
-`set print pretty on'
- Cause GDB to print structures in an indented format with one
- member per line, like this:
-
- $1 = {
- next = 0x0,
- flags = {
- sweet = 1,
- sour = 1
- },
- meat = 0x54 "Pork"
- }
-
-`set print pretty off'
- Cause GDB to print structures in a compact format, like this:
-
- $1 = {next = 0x0, flags = {sweet = 1, sour = 1}, \
- meat = 0x54 "Pork"}
-
- This is the default format.
-
-`show print pretty'
- Show which format GDB will use to print structures.
-
-`set print sevenbit-strings on'
- Print using only seven-bit characters; if this option is set, GDB
- will display any eight-bit characters (in strings or character
- values) using the notation `\'NNN. For example, `M-a' is
- displayed as `\341'.
-
-`set print sevenbit-strings off'
- Print using either seven-bit or eight-bit characters, as required.
- This is the default.
-
-`show print sevenbit-strings'
- Show whether or not GDB will print only seven-bit characters.
-
-`set print union on'
- Tell GDB to print unions which are contained in structures. This
- is the default setting.
-
-`set print union off'
- Tell GDB not to print unions which are contained in structures.
-
-`show print union'
- Ask GDB whether or not it will print unions which are contained in
- structures.
-
- For example, given the declarations
-
- typedef enum {Tree, Bug} Species;
- typedef enum {Big_tree, Acorn, Seedling} Tree_forms;
- typedef enum {Caterpillar, Cocoon, Butterfly}
- Bug_forms;
-
- struct thing {
- Species it;
- union {
- Tree_forms tree;
- Bug_forms bug;
- } form;
- };
-
- struct thing foo = {Tree, {Acorn}};
-
- with `set print union on' in effect `p foo' would print
-
- $1 = {it = Tree, form = {tree = Acorn, bug = Cocoon}}
-
- and with `set print union off' in effect it would print
-
- $1 = {it = Tree, form = {...}}
-
-These settings are of interest when debugging C++ programs:
-
-`set print demangle'
-`set print demangle on'
- Print C++ names in their source form rather than in the encoded
- ("mangled") form passed to the assembler and linker for type-safe
- linkage. The default is `on'.
-
-`show print demangle'
- Show whether C++ names will be printed in mangled or demangled
- form.
-
-`set print asm-demangle'
-`set print asm-demangle on'
- Print C++ names in their source form rather than their mangled
- form, even in assembler code printouts such as instruction
- disassemblies. The default is off.
-
-`show print asm-demangle'
- Show whether C++ names in assembly listings will be printed in
- mangled or demangled form.
-
-`set demangle-style STYLE'
- Choose among several encoding schemes used by different compilers
- to represent C++ names. The choices for STYLE are currently:
-
- `auto'
- Allow GDB to choose a decoding style by inspecting your
- program.
-
- `gnu'
- Decode based on the GNU C++ compiler (`g++') encoding
- algorithm.
-
- `lucid'
- Decode based on the Lucid C++ compiler (`lcc') encoding
- algorithm.
-
- `arm'
- Decode using the algorithm in the `C++ Annotated Reference
- Manual'. *Warning:* this setting alone is not sufficient to
- allow debugging `cfront'-generated executables. GDB would
- require further enhancement to permit that.
-
-`show demangle-style'
- Display the encoding style currently in use for decoding C++
- symbols.
-
-`set print object'
-`set print object on'
- When displaying a pointer to an object, identify the *actual*
- (derived) type of the object rather than the *declared* type, using
- the virtual function table.
-
-`set print object off'
- Display only the declared type of objects, without reference to the
- virtual function table. This is the default setting.
-
-`show print object'
- Show whether actual, or declared, object types will be displayed.
-
-`set print vtbl'
-`set print vtbl on'
- Pretty print C++ virtual function tables. The default is off.
-
-`set print vtbl off'
- Do not pretty print C++ virtual function tables.
-
-`show print vtbl'
- Show whether C++ virtual function tables are pretty printed, or
- not.
-
-
-File: gdb.info, Node: Value History, Next: Convenience Vars, Prev: Print Settings, Up: Data
-
-Value history
-=============
-
- Values printed by the `print' command are saved in the GDB "value
-history" so that you can refer to them in other expressions. Values are
-kept until the symbol table is re-read or discarded (for example with
-the `file' or `symbol-file' commands). When the symbol table changes,
-the value history is discarded, since the values may contain pointers
-back to the types defined in the symbol table.
-
- The values printed are given "history numbers" by which you can
-refer to them. These are successive integers starting with one.
-`print' shows you the history number assigned to a value by printing
-`$NUM = ' before the value; here NUM is the history number.
-
- To refer to any previous value, use `$' followed by the value's
-history number. The way `print' labels its output is designed to
-remind you of this. Just `$' refers to the most recent value in the
-history, and `$$' refers to the value before that. `$$N' refers to the
-Nth value from the end; `$$2' is the value just prior to `$$', `$$1' is
-equivalent to `$$', and `$$0' is equivalent to `$'.
-
- For example, suppose you have just printed a pointer to a structure
-and want to see the contents of the structure. It suffices to type
-
- p *$
-
- If you have a chain of structures where the component `next' points
-to the next one, you can print the contents of the next one with this:
-
- p *$.next
-
-You can print successive links in the chain by repeating this
-command--which you can do by just typing RET.
-
- Note that the history records values, not expressions. If the value
-of `x' is 4 and you type these commands:
-
- print x
- set x=5
-
-then the value recorded in the value history by the `print' command
-remains 4 even though the value of `x' has changed.
-
-`show values'
- Print the last ten values in the value history, with their item
- numbers. This is like `p $$9' repeated ten times, except that
- `show values' does not change the history.
-
-`show values N'
- Print ten history values centered on history item number N.
-
-`show values +'
- Print ten history values just after the values last printed. If
- no more values are available, produces no display.
-
- Pressing RET to repeat `show values N' has exactly the same effect
-as `show values +'.
-
-
-File: gdb.info, Node: Convenience Vars, Next: Registers, Prev: Value History, Up: Data
-
-Convenience variables
-=====================
-
- GDB provides "convenience variables" that you can use within GDB to
-hold on to a value and refer to it later. These variables exist
-entirely within GDB; they are not part of your program, and setting a
-convenience variable has no direct effect on further execution of your
-program. That is why you can use them freely.
-
- Convenience variables are prefixed with `$'. Any name preceded by
-`$' can be used for a convenience variable, unless it is one of the
-predefined machine-specific register names (*note Registers::.).
-(Value history references, in contrast, are *numbers* preceded by `$'.
-*Note Value history: Value History.)
-
- You can save a value in a convenience variable with an assignment
-expression, just as you would set a variable in your program. For
-example:
-
- set $foo = *object_ptr
-
-would save in `$foo' the value contained in the object pointed to by
-`object_ptr'.
-
- Using a convenience variable for the first time creates it, but its
-value is `void' until you assign a new value. You can alter the value
-with another assignment at any time.
-
- Convenience variables have no fixed types. You can assign a
-convenience variable any type of value, including structures and
-arrays, even if that variable already has a value of a different type.
-The convenience variable, when used as an expression, has the type of
-its current value.
-
-`show convenience'
- Print a list of convenience variables used so far, and their
- values. Abbreviated `show con'.
-
- One of the ways to use a convenience variable is as a counter to be
-incremented or a pointer to be advanced. For example, to print a field
-from successive elements of an array of structures:
-
- set $i = 0
- print bar[$i++]->contents
- ... repeat that command by typing RET.
-
- Some convenience variables are created automatically by GDB and given
-values likely to be useful.
-
-`$_'
- The variable `$_' is automatically set by the `x' command to the
- last address examined (*note Examining memory: Memory.). Other
- commands which provide a default address for `x' to examine also
- set `$_' to that address; these commands include `info line' and
- `info breakpoint'. The type of `$_' is `void *' except when set
- by the `x' command, in which case it is a pointer to the type of
- `$__'.
-
-`$__'
- The variable `$__' is automatically set by the `x' command to the
- value found in the last address examined. Its type is chosen to
- match the format in which the data was printed.
-
diff --git a/gnu/usr.bin/gdb/doc/gdb.info-4 b/gnu/usr.bin/gdb/doc/gdb.info-4
deleted file mode 100644
index b0758fa..0000000
--- a/gnu/usr.bin/gdb/doc/gdb.info-4
+++ /dev/null
@@ -1,1349 +0,0 @@
-This is Info file ./gdb.info, produced by Makeinfo-1.52 from the input
-file gdb.texinfo.
-
-START-INFO-DIR-ENTRY
-* Gdb:: The GNU debugger.
-END-INFO-DIR-ENTRY
- This file documents the GNU debugger GDB.
-
- This is Edition 4.09, August 1993, of `Debugging with GDB: the GNU
-Source-Level Debugger' for GDB Version 4.11.
-
- Copyright (C) 1988, '89, '90, '91, '92, '93 Free Software
-Foundation, Inc.
-
- Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of
-this manual under the conditions for verbatim copying, provided also
-that the entire resulting derived work is distributed under the terms
-of a permission notice identical to this one.
-
- Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions.
-
-
-File: gdb.info, Node: Registers, Next: Floating Point Hardware, Prev: Convenience Vars, Up: Data
-
-Registers
-=========
-
- You can refer to machine register contents, in expressions, as
-variables with names starting with `$'. The names of registers are
-different for each machine; use `info registers' to see the names used
-on your machine.
-
-`info registers'
- Print the names and values of all registers except floating-point
- registers (in the selected stack frame).
-
-`info all-registers'
- Print the names and values of all registers, including
- floating-point registers.
-
-`info registers REGNAME ...'
- Print the relativized value of each specified register REGNAME.
- rEGNAME may be any register name valid on the machine you are
- using, with or without the initial `$'.
-
- GDB has four "standard" register names that are available (in
-expressions) on most machines--whenever they do not conflict with an
-architecture's canonical mnemonics for registers. The register names
-`$pc' and `$sp' are used for the program counter register and the stack
-pointer. `$fp' is used for a register that contains a pointer to the
-current stack frame, and `$ps' is used for a register that contains the
-processor status. For example, you could print the program counter in
-hex with
-
- p/x $pc
-
-or print the instruction to be executed next with
-
- x/i $pc
-
-or add four to the stack pointer(1) with
-
- set $sp += 4
-
- Whenever possible, these four standard register names are available
-on your machine even though the machine has different canonical
-mnemonics, so long as there is no conflict. The `info registers'
-command shows the canonical names. For example, on the SPARC, `info
-registers' displays the processor status register as `$psr' but you can
-also refer to it as `$ps'.
-
- GDB always considers the contents of an ordinary register as an
-integer when the register is examined in this way. Some machines have
-special registers which can hold nothing but floating point; these
-registers are considered to have floating point values. There is no way
-to refer to the contents of an ordinary register as floating point value
-(although you can *print* it as a floating point value with `print/f
-$REGNAME').
-
- Some registers have distinct "raw" and "virtual" data formats. This
-means that the data format in which the register contents are saved by
-the operating system is not the same one that your program normally
-sees. For example, the registers of the 68881 floating point
-coprocessor are always saved in "extended" (raw) format, but all C
-programs expect to work with "double" (virtual) format. In such cases,
-GDB normally works with the virtual format only (the format that makes
-sense for your program), but the `info registers' command prints the
-data in both formats.
-
- Normally, register values are relative to the selected stack frame
-(*note Selecting a frame: Selection.). This means that you get the
-value that the register would contain if all stack frames farther in
-were exited and their saved registers restored. In order to see the
-true contents of hardware registers, you must select the innermost
-frame (with `frame 0').
-
- However, GDB must deduce where registers are saved, from the machine
-code generated by your compiler. If some registers are not saved, or if
-GDB is unable to locate the saved registers, the selected stack frame
-will make no difference.
-
-`set rstack_high_address ADDRESS'
- On AMD 29000 family processors, registers are saved in a separate
- "register stack". There is no way for GDB to determine the extent
- of this stack. Normally, GDB just assumes that the stack is "large
- enough". This may result in GDB referencing memory locations that
- do not exist. If necessary, you can get around this problem by
- specifying the ending address of the register stack with the `set
- rstack_high_address' command. The argument should be an address,
- which you will probably want to precede with `0x' to specify in
- hexadecimal.
-
-`show rstack_high_address'
- Display the current limit of the register stack, on AMD 29000
- family processors.
-
- ---------- Footnotes ----------
-
- (1) This is a way of removing one word from the stack, on machines
-where stacks grow downward in memory (most machines, nowadays). This
-assumes that the innermost stack frame is selected; setting `$sp' is
-not allowed when other stack frames are selected. To pop entire frames
-off the stack, regardless of machine architecture, use `return'; *note
-Returning from a function: Returning..
-
-
-File: gdb.info, Node: Floating Point Hardware, Prev: Registers, Up: Data
-
-Floating point hardware
-=======================
-
- Depending on the host machine architecture, GDB may be able to give
-you more information about the status of the floating point hardware.
-
-`info float'
- Display hardware-dependent information about the floating point
- unit. The exact contents and layout vary depending on the
- floating point chip; on some platforms, `info float' is not
- available at all.
-
-
-File: gdb.info, Node: Languages, Next: Symbols, Prev: Data, Up: Top
-
-Using GDB with Different Languages
-**********************************
-
- Although programming languages generally have common aspects, they
-are rarely expressed in the same manner. For instance, in ANSI C,
-dereferencing a pointer `p' is accomplished by `*p', but in Modula-2,
-it is accomplished by `p^'. Values can also be represented (and
-displayed) differently. Hex numbers in C are written like `0x1ae',
-while in Modula-2 they appear as `1AEH'.
-
- Language-specific information is built into GDB for some languages,
-allowing you to express operations like the above in your program's
-native language, and allowing GDB to output values in a manner
-consistent with the syntax of your program's native language. The
-language you use to build expressions, called the "working language",
-can be selected manually, or GDB can set it automatically.
-
-* Menu:
-
-* Setting:: Switching between source languages
-* Show:: Displaying the language
-
-* Checks:: Type and range checks
-
-* Support:: Supported languages
-
-
-File: gdb.info, Node: Setting, Next: Show, Up: Languages
-
-Switching between source languages
-==================================
-
- There are two ways to control the working language--either have GDB
-set it automatically, or select it manually yourself. You can use the
-`set language' command for either purpose. On startup, GDB defaults to
-setting the language automatically.
-
-* Menu:
-
-* Manually:: Setting the working language manually
-* Automatically:: Having GDB infer the source language
-
-
-File: gdb.info, Node: Manually, Next: Automatically, Up: Setting
-
-Setting the working language
-----------------------------
-
- If you allow GDB to set the language automatically, expressions are
-interpreted the same way in your debugging session and your program.
-
- If you wish, you may set the language manually. To do this, issue
-the command `set language LANG', where LANG is the name of a language,
-such as `c' or `modula-2'. For a list of the supported languages, type
-`set language'.
-
- Setting the language manually prevents GDB from updating the working
-language automatically. This can lead to confusion if you try to debug
-a program when the working language is not the same as the source
-language, when an expression is acceptable to both languages--but means
-different things. For instance, if the current source file were
-written in C, and GDB was parsing Modula-2, a command such as:
-
- print a = b + c
-
-might not have the effect you intended. In C, this means to add `b'
-and `c' and place the result in `a'. The result printed would be the
-value of `a'. In Modula-2, this means to compare `a' to the result of
-`b+c', yielding a `BOOLEAN' value.
-
-
-File: gdb.info, Node: Automatically, Prev: Manually, Up: Setting
-
-Having GDB infer the source language
-------------------------------------
-
- To have GDB set the working language automatically, use `set
-language local' or `set language auto'. GDB then infers the language
-that a program was written in by looking at the name of its source
-files, and examining their extensions:
-
-`*.mod'
- Modula-2 source file
-
-`*.c'
- C source file
-
-`*.C'
-`*.cc'
- C++ source file
-
- This information is recorded for each function or procedure in a
-source file. When your program stops in a frame (usually by
-encountering a breakpoint), GDB sets the working language to the
-language recorded for the function in that frame. If the language for
-a frame is unknown (that is, if the function or block corresponding to
-the frame was defined in a source file that does not have a recognized
-extension), the current working language is not changed, and GDB issues
-a warning.
-
- This may not seem necessary for most programs, which are written
-entirely in one source language. However, program modules and libraries
-written in one source language can be used by a main program written in
-a different source language. Using `set language auto' in this case
-frees you from having to set the working language manually.
-
-
-File: gdb.info, Node: Show, Next: Checks, Prev: Setting, Up: Languages
-
-Displaying the language
-=======================
-
- The following commands will help you find out which language is the
-working language, and also what language source files were written in.
-
-`show language'
- Display the current working language. This is the language you
- can use with commands such as `print' to build and compute
- expressions that may involve variables in your program.
-
-`info frame'
- Among the other information listed here (*note Information about a
- frame: Frame Info.) is the source language for this frame. This
- is the language that will become the working language if you ever
- use an identifier that is in this frame.
-
-`info source'
- Among the other information listed here (*note Examining the
- Symbol Table: Symbols.) is the source language of this source file.
-
-
-File: gdb.info, Node: Checks, Next: Support, Prev: Show, Up: Languages
-
-Type and range checking
-=======================
-
- *Warning:* In this release, the GDB commands for type and range
- checking are included, but they do not yet have any effect. This
- section documents the intended facilities.
-
- Some languages are designed to guard you against making seemingly
-common errors through a series of compile- and run-time checks. These
-include checking the type of arguments to functions and operators, and
-making sure mathematical overflows are caught at run time. Checks such
-as these help to ensure a program's correctness once it has been
-compiled by eliminating type mismatches, and providing active checks
-for range errors when your program is running.
-
- GDB can check for conditions like the above if you wish. Although
-GDB will not check the statements in your program, it can check
-expressions entered directly into GDB for evaluation via the `print'
-command, for example. As with the working language, GDB can also
-decide whether or not to check automatically based on your program's
-source language. *Note Supported languages: Support, for the default
-settings of supported languages.
-
-* Menu:
-
-* Type Checking:: An overview of type checking
-* Range Checking:: An overview of range checking
-
-
-File: gdb.info, Node: Type Checking, Next: Range Checking, Up: Checks
-
-An overview of type checking
-----------------------------
-
- Some languages, such as Modula-2, are strongly typed, meaning that
-the arguments to operators and functions have to be of the correct type,
-otherwise an error occurs. These checks prevent type mismatch errors
-from ever causing any run-time problems. For example,
-
- 1 + 2 => 3
-but
- error--> 1 + 2.3
-
- The second example fails because the `CARDINAL' 1 is not
-type-compatible with the `REAL' 2.3.
-
- For expressions you use in GDB commands, you can tell the GDB type
-checker to skip checking; to treat any mismatches as errors and abandon
-the expression; or only issue warnings when type mismatches occur, but
-evaluate the expression anyway. When you choose the last of these, GDB
-evaluates expressions like the second example above, but also issues a
-warning.
-
- Even though you may turn type checking off, other type-based reasons
-may prevent GDB from evaluating an expression. For instance, GDB does
-not know how to add an `int' and a `struct foo'. These particular type
-errors have nothing to do with the language in use, and usually arise
-from expressions, such as the one described above, which make little
-sense to evaluate anyway.
-
- Each language defines to what degree it is strict about type. For
-instance, both Modula-2 and C require the arguments to arithmetical
-operators to be numbers. In C, enumerated types and pointers can be
-represented as numbers, so that they are valid arguments to mathematical
-operators. *Note Supported languages: Support, for further details on
-specific languages.
-
- GDB provides some additional commands for controlling the type
-checker:
-
-`set check type auto'
- Set type checking on or off based on the current working language.
- *Note Supported languages: Support, for the default settings for
- each language.
-
-`set check type on'
-`set check type off'
- Set type checking on or off, overriding the default setting for the
- current working language. Issue a warning if the setting does not
- match the language default. If any type mismatches occur in
- evaluating an expression while typechecking is on, GDB prints a
- message and aborts evaluation of the expression.
-
-`set check type warn'
- Cause the type checker to issue warnings, but to always attempt to
- evaluate the expression. Evaluating the expression may still be
- impossible for other reasons. For example, GDB cannot add numbers
- and structures.
-
-`show type'
- Show the current setting of the type checker, and whether or not
- GDB is setting it automatically.
-
-
-File: gdb.info, Node: Range Checking, Prev: Type Checking, Up: Checks
-
-An overview of range checking
------------------------------
-
- In some languages (such as Modula-2), it is an error to exceed the
-bounds of a type; this is enforced with run-time checks. Such range
-checking is meant to ensure program correctness by making sure
-computations do not overflow, or indices on an array element access do
-not exceed the bounds of the array.
-
- For expressions you use in GDB commands, you can tell GDB to treat
-range errors in one of three ways: ignore them, always treat them as
-errors and abandon the expression, or issue warnings but evaluate the
-expression anyway.
-
- A range error can result from numerical overflow, from exceeding an
-array index bound, or when you type a constant that is not a member of
-any type. Some languages, however, do not treat overflows as an error.
-In many implementations of C, mathematical overflow causes the result
-to "wrap around" to lower values--for example, if M is the largest
-integer value, and S is the smallest, then
-
- M + 1 => S
-
- This, too, is specific to individual languages, and in some cases
-specific to individual compilers or machines. *Note Supported
-languages: Support, for further details on specific languages.
-
- GDB provides some additional commands for controlling the range
-checker:
-
-`set check range auto'
- Set range checking on or off based on the current working language.
- *Note Supported languages: Support, for the default settings for
- each language.
-
-`set check range on'
-`set check range off'
- Set range checking on or off, overriding the default setting for
- the current working language. A warning is issued if the setting
- does not match the language default. If a range error occurs,
- then a message is printed and evaluation of the expression is
- aborted.
-
-`set check range warn'
- Output messages when the GDB range checker detects a range error,
- but attempt to evaluate the expression anyway. Evaluating the
- expression may still be impossible for other reasons, such as
- accessing memory that the process does not own (a typical example
- from many Unix systems).
-
-`show range'
- Show the current setting of the range checker, and whether or not
- it is being set automatically by GDB.
-
-
-File: gdb.info, Node: Support, Prev: Checks, Up: Languages
-
-Supported languages
-===================
-
- GDB 4 supports C, C++, and Modula-2. Some GDB features may be used
-in expressions regardless of the language you use: the GDB `@' and `::'
-operators, and the `{type}addr' construct (*note Expressions:
-Expressions.) can be used with the constructs of any supported language.
-
- The following sections detail to what degree each source language is
-supported by GDB. These sections are not meant to be language
-tutorials or references, but serve only as a reference guide to what the
-GDB expression parser will accept, and what input and output formats
-should look like for different languages. There are many good books
-written on each of these languages; please look to these for a language
-reference or tutorial.
-
-* Menu:
-
-* C:: C and C++
-* Modula-2:: Modula-2
-
-
-File: gdb.info, Node: C, Next: Modula-2, Up: Support
-
-C and C++
----------
-
- Since C and C++ are so closely related, many features of GDB apply
-to both languages. Whenever this is the case, we discuss both languages
-together.
-
- The C++ debugging facilities are jointly implemented by the GNU C++
-compiler and GDB. Therefore, to debug your C++ code effectively, you
-must compile your C++ programs with the GNU C++ compiler, `g++'.
-
-* Menu:
-
-* C Operators:: C and C++ operators
-* C Constants:: C and C++ constants
-* Cplus expressions:: C++ expressions
-* C Defaults:: Default settings for C and C++
-
-* C Checks:: C and C++ type and range checks
-
-* Debugging C:: GDB and C
-* Debugging C plus plus:: Special features for C++
-
-
-File: gdb.info, Node: C Operators, Next: C Constants, Up: C
-
-C and C++ operators
--------------------
-
- Operators must be defined on values of specific types. For instance,
-`+' is defined on numbers, but not on structures. Operators are often
-defined on groups of types.
-
- For the purposes of C and C++, the following definitions hold:
-
- * *Integral types* include `int' with any of its storage-class
- specifiers; `char'; and `enum'.
-
- * *Floating-point types* include `float' and `double'.
-
- * *Pointer types* include all types defined as `(TYPE *)'.
-
- * *Scalar types* include all of the above.
-
-The following operators are supported. They are listed here in order
-of increasing precedence:
-
-`,'
- The comma or sequencing operator. Expressions in a
- comma-separated list are evaluated from left to right, with the
- result of the entire expression being the last expression
- evaluated.
-
-`='
- Assignment. The value of an assignment expression is the value
- assigned. Defined on scalar types.
-
-`OP='
- Used in an expression of the form `A OP= B', and translated to
- `A = A OP B'. `OP=' and `=' have the same precendence. OP is any
- one of the operators `|', `^', `&', `<<', `>>', `+', `-', `*',
- `/', `%'.
-
-`?:'
- The ternary operator. `A ? B : C' can be thought of as: if A
- then B else C. A should be of an integral type.
-
-`||'
- Logical OR. Defined on integral types.
-
-`&&'
- Logical AND. Defined on integral types.
-
-`|'
- Bitwise OR. Defined on integral types.
-
-`^'
- Bitwise exclusive-OR. Defined on integral types.
-
-`&'
- Bitwise AND. Defined on integral types.
-
-`==, !='
- Equality and inequality. Defined on scalar types. The value of
- these expressions is 0 for false and non-zero for true.
-
-`<, >, <=, >='
- Less than, greater than, less than or equal, greater than or equal.
- Defined on scalar types. The value of these expressions is 0 for
- false and non-zero for true.
-
-`<<, >>'
- left shift, and right shift. Defined on integral types.
-
-`@'
- The GDB "artificial array" operator (*note Expressions:
- Expressions.).
-
-`+, -'
- Addition and subtraction. Defined on integral types,
- floating-point types and pointer types.
-
-`*, /, %'
- Multiplication, division, and modulus. Multiplication and
- division are defined on integral and floating-point types.
- Modulus is defined on integral types.
-
-`++, --'
- Increment and decrement. When appearing before a variable, the
- operation is performed before the variable is used in an
- expression; when appearing after it, the variable's value is used
- before the operation takes place.
-
-`*'
- Pointer dereferencing. Defined on pointer types. Same precedence
- as `++'.
-
-`&'
- Address operator. Defined on variables. Same precedence as `++'.
-
- For debugging C++, GDB implements a use of `&' beyond what is
- allowed in the C++ language itself: you can use `&(&REF)' (or, if
- you prefer, simply `&&REF') to examine the address where a C++
- reference variable (declared with `&REF') is stored.
-
-`-'
- Negative. Defined on integral and floating-point types. Same
- precedence as `++'.
-
-`!'
- Logical negation. Defined on integral types. Same precedence as
- `++'.
-
-`~'
- Bitwise complement operator. Defined on integral types. Same
- precedence as `++'.
-
-`., ->'
- Structure member, and pointer-to-structure member. For
- convenience, GDB regards the two as equivalent, choosing whether
- to dereference a pointer based on the stored type information.
- Defined on `struct' and `union' data.
-
-`[]'
- Array indexing. `A[I]' is defined as `*(A+I)'. Same precedence
- as `->'.
-
-`()'
- Function parameter list. Same precedence as `->'.
-
-`::'
- C++ scope resolution operator. Defined on `struct', `union', and
- `class' types.
-
-`::'
- Doubled colons also represent the GDB scope operator (*note
- Expressions: Expressions.). Same precedence as `::', above.
-
-
-File: gdb.info, Node: C Constants, Next: Cplus expressions, Prev: C Operators, Up: C
-
-C and C++ constants
--------------------
-
- GDB allows you to express the constants of C and C++ in the
-following ways:
-
- * Integer constants are a sequence of digits. Octal constants are
- specified by a leading `0' (ie. zero), and hexadecimal constants by
- a leading `0x' or `0X'. Constants may also end with a letter `l',
- specifying that the constant should be treated as a `long' value.
-
- * Floating point constants are a sequence of digits, followed by a
- decimal point, followed by a sequence of digits, and optionally
- followed by an exponent. An exponent is of the form:
- `e[[+]|-]NNN', where NNN is another sequence of digits. The `+'
- is optional for positive exponents.
-
- * Enumerated constants consist of enumerated identifiers, or their
- integral equivalents.
-
- * Character constants are a single character surrounded by single
- quotes (`''), or a number--the ordinal value of the corresponding
- character (usually its ASCII value). Within quotes, the single
- character may be represented by a letter or by "escape sequences",
- which are of the form `\NNN', where NNN is the octal representation
- of the character's ordinal value; or of the form `\X', where `X'
- is a predefined special character--for example, `\n' for newline.
-
- * String constants are a sequence of character constants surrounded
- by double quotes (`"').
-
- * Pointer constants are an integral value. You can also write
- pointers to constants using the C operator `&'.
-
- * Array constants are comma-separated lists surrounded by braces `{'
- and `}'; for example, `{1,2,3}' is a three-element array of
- integers, `{{1,2}, {3,4}, {5,6}}' is a three-by-two array, and
- `{&"hi", &"there", &"fred"}' is a three-element array of pointers.
-
-
-File: gdb.info, Node: Cplus expressions, Next: C Defaults, Prev: C Constants, Up: C
-
-C++ expressions
----------------
-
- GDB expression handling has a number of extensions to interpret a
-significant subset of C++ expressions.
-
- *Warning:* Most of these extensions depend on the use of additional
- debugging information in the symbol table, and thus require a rich,
- extendable object code format. In particular, if your system uses
- a.out, MIPS ECOFF, RS/6000 XCOFF, or Sun ELF with stabs extensions
- to the symbol table, these facilities are all available. Where
- the object code format is standard COFF, on the other hand, most
- of the C++ support in GDB will *not* work, nor can it. For the
- standard SVr4 debugging format, DWARF in ELF, the standard is
- still evolving, so the C++ support in GDB is still fragile; when
- this debugging format stabilizes, however, C++ support will also
- be available on systems that use it.
-
- 1. Member function calls are allowed; you can use expressions like
-
- count = aml->GetOriginal(x, y)
-
- 2. While a member function is active (in the selected stack frame),
- your expressions have the same namespace available as the member
- function; that is, GDB allows implicit references to the class
- instance pointer `this' following the same rules as C++.
-
- 3. You can call overloaded functions; GDB will resolve the function
- call to the right definition, with one restriction--you must use
- arguments of the type required by the function that you want to
- call. GDB will not perform conversions requiring constructors or
- user-defined type operators.
-
- 4. GDB understands variables declared as C++ references; you can use
- them in expressions just as you do in C++ source--they are
- automatically dereferenced.
-
- In the parameter list shown when GDB displays a frame, the values
- of reference variables are not displayed (unlike other variables);
- this avoids clutter, since references are often used for large
- structures. The *address* of a reference variable is always
- shown, unless you have specified `set print address off'.
-
- 5. GDB supports the C++ name resolution operator `::'--your
- expressions can use it just as expressions in your program do.
- Since one scope may be defined in another, you can use `::'
- repeatedly if necessary, for example in an expression like
- `SCOPE1::SCOPE2::NAME'. GDB also allows resolving name scope by
- reference to source files, in both C and C++ debugging (*note
- Program variables: Variables.).
-
-
-File: gdb.info, Node: C Defaults, Next: C Checks, Prev: Cplus expressions, Up: C
-
-C and C++ defaults
-------------------
-
- If you allow GDB to set type and range checking automatically, they
-both default to `off' whenever the working language changes to C or
-C++. This happens regardless of whether you, or GDB, selected the
-working language.
-
- If you allow GDB to set the language automatically, it sets the
-working language to C or C++ on entering code compiled from a source
-file whose name ends with `.c', `.C', or `.cc'. *Note Having GDB infer
-the source language: Automatically, for further details.
-
-
-File: gdb.info, Node: C Checks, Next: Debugging C, Prev: C Defaults, Up: C
-
-C and C++ type and range checks
--------------------------------
-
- By default, when GDB parses C or C++ expressions, type checking is
-not used. However, if you turn type checking on, GDB will consider two
-variables type equivalent if:
-
- * The two variables are structured and have the same structure,
- union, or enumerated tag.
-
- * Two two variables have the same type name, or types that have been
- declared equivalent through `typedef'.
-
- Range checking, if turned on, is done on mathematical operations.
-Array indices are not checked, since they are often used to index a
-pointer that is not itself an array.
-
-
-File: gdb.info, Node: Debugging C, Next: Debugging C plus plus, Prev: C Checks, Up: C
-
-GDB and C
----------
-
- The `set print union' and `show print union' commands apply to the
-`union' type. When set to `on', any `union' that is inside a `struct'
-or `class' will also be printed. Otherwise, it will appear as `{...}'.
-
- The `@' operator aids in the debugging of dynamic arrays, formed
-with pointers and a memory allocation function. *Note Expressions:
-Expressions.
-
-
-File: gdb.info, Node: Debugging C plus plus, Prev: Debugging C, Up: C
-
-GDB features for C++
---------------------
-
- Some GDB commands are particularly useful with C++, and some are
-designed specifically for use with C++. Here is a summary:
-
-`breakpoint menus'
- When you want a breakpoint in a function whose name is overloaded,
- GDB breakpoint menus help you specify which function definition
- you want. *Note Breakpoint menus: Breakpoint Menus.
-
-`rbreak REGEX'
- Setting breakpoints using regular expressions is helpful for
- setting breakpoints on overloaded functions that are not members
- of any special classes. *Note Setting breakpoints: Set Breaks.
-
-`catch EXCEPTIONS'
-`info catch'
- Debug C++ exception handling using these commands. *Note
- Breakpoints and exceptions: Exception Handling.
-
-`ptype TYPENAME'
- Print inheritance relationships as well as other information for
- type TYPENAME. *Note Examining the Symbol Table: Symbols.
-
-`set print demangle'
-`show print demangle'
-`set print asm-demangle'
-`show print asm-demangle'
- Control whether C++ symbols display in their source form, both when
- displaying code as C++ source and when displaying disassemblies.
- *Note Print settings: Print Settings.
-
-`set print object'
-`show print object'
- Choose whether to print derived (actual) or declared types of
- objects. *Note Print settings: Print Settings.
-
-`set print vtbl'
-`show print vtbl'
- Control the format for printing virtual function tables. *Note
- Print settings: Print Settings.
-
-`Overloaded symbol names'
- You can specify a particular definition of an overloaded symbol,
- using the same notation that is used to declare such symbols in
- C++: type `SYMBOL(TYPES)' rather than just SYMBOL. You can also
- use the GDB command-line word completion facilities to list the
- available choices, or to finish the type list for you. *Note
- Command completion: Completion, for details on how to do this.
-
-
-File: gdb.info, Node: Modula-2, Prev: C, Up: Support
-
-Modula-2
---------
-
- The extensions made to GDB to support Modula-2 only support output
-from the GNU Modula-2 compiler (which is currently being developed).
-Other Modula-2 compilers are not currently supported, and attempting to
-debug executables produced by them will most likely result in an error
-as GDB reads in the executable's symbol table.
-
-* Menu:
-
-* M2 Operators:: Built-in operators
-* Built-In Func/Proc:: Built-in functions and procedures
-* M2 Constants:: Modula-2 constants
-* M2 Defaults:: Default settings for Modula-2
-* Deviations:: Deviations from standard Modula-2
-* M2 Checks:: Modula-2 type and range checks
-* M2 Scope:: The scope operators `::' and `.'
-* GDB/M2:: GDB and Modula-2
-
-
-File: gdb.info, Node: M2 Operators, Next: Built-In Func/Proc, Up: Modula-2
-
-Operators
----------
-
- Operators must be defined on values of specific types. For instance,
-`+' is defined on numbers, but not on structures. Operators are often
-defined on groups of types. For the purposes of Modula-2, the
-following definitions hold:
-
- * *Integral types* consist of `INTEGER', `CARDINAL', and their
- subranges.
-
- * *Character types* consist of `CHAR' and its subranges.
-
- * *Floating-point types* consist of `REAL'.
-
- * *Pointer types* consist of anything declared as `POINTER TO TYPE'.
-
- * *Scalar types* consist of all of the above.
-
- * *Set types* consist of `SET' and `BITSET' types.
-
- * *Boolean types* consist of `BOOLEAN'.
-
-The following operators are supported, and appear in order of
-increasing precedence:
-
-`,'
- Function argument or array index separator.
-
-`:='
- Assignment. The value of VAR `:=' VALUE is VALUE.
-
-`<, >'
- Less than, greater than on integral, floating-point, or enumerated
- types.
-
-`<=, >='
- Less than, greater than, less than or equal to, greater than or
- equal to on integral, floating-point and enumerated types, or set
- inclusion on set types. Same precedence as `<'.
-
-`=, <>, #'
- Equality and two ways of expressing inequality, valid on scalar
- types. Same precedence as `<'. In GDB scripts, only `<>' is
- available for inequality, since `#' conflicts with the script
- comment character.
-
-`IN'
- Set membership. Defined on set types and the types of their
- members. Same precedence as `<'.
-
-`OR'
- Boolean disjunction. Defined on boolean types.
-
-`AND, &'
- Boolean conjuction. Defined on boolean types.
-
-`@'
- The GDB "artificial array" operator (*note Expressions:
- Expressions.).
-
-`+, -'
- Addition and subtraction on integral and floating-point types, or
- union and difference on set types.
-
-`*'
- Multiplication on integral and floating-point types, or set
- intersection on set types.
-
-`/'
- Division on floating-point types, or symmetric set difference on
- set types. Same precedence as `*'.
-
-`DIV, MOD'
- Integer division and remainder. Defined on integral types. Same
- precedence as `*'.
-
-`-'
- Negative. Defined on `INTEGER' and `REAL' data.
-
-`^'
- Pointer dereferencing. Defined on pointer types.
-
-`NOT'
- Boolean negation. Defined on boolean types. Same precedence as
- `^'.
-
-`.'
- `RECORD' field selector. Defined on `RECORD' data. Same
- precedence as `^'.
-
-`[]'
- Array indexing. Defined on `ARRAY' data. Same precedence as `^'.
-
-`()'
- Procedure argument list. Defined on `PROCEDURE' objects. Same
- precedence as `^'.
-
-`::, .'
- GDB and Modula-2 scope operators.
-
- *Warning:* Sets and their operations are not yet supported, so GDB
- will treat the use of the operator `IN', or the use of operators
- `+', `-', `*', `/', `=', , `<>', `#', `<=', and `>=' on sets as an
- error.
-
-
-File: gdb.info, Node: Built-In Func/Proc, Next: M2 Constants, Prev: M2 Operators, Up: Modula-2
-
-Built-in functions and procedures
----------------------------------
-
- Modula-2 also makes available several built-in procedures and
-functions. In describing these, the following metavariables are used:
-
-A
- represents an `ARRAY' variable.
-
-C
- represents a `CHAR' constant or variable.
-
-I
- represents a variable or constant of integral type.
-
-M
- represents an identifier that belongs to a set. Generally used in
- the same function with the metavariable S. The type of S should
- be `SET OF MTYPE' (where MTYPE is the type of M).
-
-N
- represents a variable or constant of integral or floating-point
- type.
-
-R
- represents a variable or constant of floating-point type.
-
-T
- represents a type.
-
-V
- represents a variable.
-
-X
- represents a variable or constant of one of many types. See the
- explanation of the function for details.
-
- All Modula-2 built-in procedures also return a result, described
-below.
-
-`ABS(N)'
- Returns the absolute value of N.
-
-`CAP(C)'
- If C is a lower case letter, it returns its upper case equivalent,
- otherwise it returns its argument
-
-`CHR(I)'
- Returns the character whose ordinal value is I.
-
-`DEC(V)'
- Decrements the value in the variable V. Returns the new value.
-
-`DEC(V,I)'
- Decrements the value in the variable V by I. Returns the new
- value.
-
-`EXCL(M,S)'
- Removes the element M from the set S. Returns the new set.
-
-`FLOAT(I)'
- Returns the floating point equivalent of the integer I.
-
-`HIGH(A)'
- Returns the index of the last member of A.
-
-`INC(V)'
- Increments the value in the variable V. Returns the new value.
-
-`INC(V,I)'
- Increments the value in the variable V by I. Returns the new
- value.
-
-`INCL(M,S)'
- Adds the element M to the set S if it is not already there.
- Returns the new set.
-
-`MAX(T)'
- Returns the maximum value of the type T.
-
-`MIN(T)'
- Returns the minimum value of the type T.
-
-`ODD(I)'
- Returns boolean TRUE if I is an odd number.
-
-`ORD(X)'
- Returns the ordinal value of its argument. For example, the
- ordinal value of a character is its ASCII value (on machines
- supporting the ASCII character set). X must be of an ordered
- type, which include integral, character and enumerated types.
-
-`SIZE(X)'
- Returns the size of its argument. X can be a variable or a type.
-
-`TRUNC(R)'
- Returns the integral part of R.
-
-`VAL(T,I)'
- Returns the member of the type T whose ordinal value is I.
-
- *Warning:* Sets and their operations are not yet supported, so
- GDB will treat the use of procedures `INCL' and `EXCL' as an error.
-
-
-File: gdb.info, Node: M2 Constants, Next: M2 Defaults, Prev: Built-In Func/Proc, Up: Modula-2
-
-Constants
----------
-
- GDB allows you to express the constants of Modula-2 in the following
-ways:
-
- * Integer constants are simply a sequence of digits. When used in an
- expression, a constant is interpreted to be type-compatible with
- the rest of the expression. Hexadecimal integers are specified by
- a trailing `H', and octal integers by a trailing `B'.
-
- * Floating point constants appear as a sequence of digits, followed
- by a decimal point and another sequence of digits. An optional
- exponent can then be specified, in the form `E[+|-]NNN', where
- `[+|-]NNN' is the desired exponent. All of the digits of the
- floating point constant must be valid decimal (base 10) digits.
-
- * Character constants consist of a single character enclosed by a
- pair of like quotes, either single (`'') or double (`"'). They may
- also be expressed by their ordinal value (their ASCII value,
- usually) followed by a `C'.
-
- * String constants consist of a sequence of characters enclosed by a
- pair of like quotes, either single (`'') or double (`"'). Escape
- sequences in the style of C are also allowed. *Note C and C++
- constants: C Constants, for a brief explanation of escape
- sequences.
-
- * Enumerated constants consist of an enumerated identifier.
-
- * Boolean constants consist of the identifiers `TRUE' and `FALSE'.
-
- * Pointer constants consist of integral values only.
-
- * Set constants are not yet supported.
-
-
-File: gdb.info, Node: M2 Defaults, Next: Deviations, Prev: M2 Constants, Up: Modula-2
-
-Modula-2 defaults
------------------
-
- If type and range checking are set automatically by GDB, they both
-default to `on' whenever the working language changes to Modula-2.
-This happens regardless of whether you, or GDB, selected the working
-language.
-
- If you allow GDB to set the language automatically, then entering
-code compiled from a file whose name ends with `.mod' will set the
-working language to Modula-2. *Note Having GDB set the language
-automatically: Automatically, for further details.
-
-
-File: gdb.info, Node: Deviations, Next: M2 Checks, Prev: M2 Defaults, Up: Modula-2
-
-Deviations from standard Modula-2
----------------------------------
-
- A few changes have been made to make Modula-2 programs easier to
-debug. This is done primarily via loosening its type strictness:
-
- * Unlike in standard Modula-2, pointer constants can be formed by
- integers. This allows you to modify pointer variables during
- debugging. (In standard Modula-2, the actual address contained in
- a pointer variable is hidden from you; it can only be modified
- through direct assignment to another pointer variable or
- expression that returned a pointer.)
-
- * C escape sequences can be used in strings and characters to
- represent non-printable characters. GDB will print out strings
- with these escape sequences embedded. Single non-printable
- characters are printed using the `CHR(NNN)' format.
-
- * The assignment operator (`:=') returns the value of its right-hand
- argument.
-
- * All built-in procedures both modify *and* return their argument.
-
-
-File: gdb.info, Node: M2 Checks, Next: M2 Scope, Prev: Deviations, Up: Modula-2
-
-Modula-2 type and range checks
-------------------------------
-
- *Warning:* in this release, GDB does not yet perform type or range
- checking.
-
- GDB considers two Modula-2 variables type equivalent if:
-
- * They are of types that have been declared equivalent via a `TYPE
- T1 = T2' statement
-
- * They have been declared on the same line. (Note: This is true of
- the GNU Modula-2 compiler, but it may not be true of other
- compilers.)
-
- As long as type checking is enabled, any attempt to combine variables
-whose types are not equivalent is an error.
-
- Range checking is done on all mathematical operations, assignment,
-array index bounds, and all built-in functions and procedures.
-
-
-File: gdb.info, Node: M2 Scope, Next: GDB/M2, Prev: M2 Checks, Up: Modula-2
-
-The scope operators `::' and `.'
---------------------------------
-
- There are a few subtle differences between the Modula-2 scope
-operator (`.') and the GDB scope operator (`::'). The two have similar
-syntax:
-
-
- MODULE . ID
- SCOPE :: ID
-
-where SCOPE is the name of a module or a procedure, MODULE the name of
-a module, and ID is any declared identifier within your program, except
-another module.
-
- Using the `::' operator makes GDB search the scope specified by
-SCOPE for the identifier ID. If it is not found in the specified
-scope, then GDB will search all scopes enclosing the one specified by
-SCOPE.
-
- Using the `.' operator makes GDB search the current scope for the
-identifier specified by ID that was imported from the definition module
-specified by MODULE. With this operator, it is an error if the
-identifier ID was not imported from definition module MODULE, or if ID
-is not an identifier in MODULE.
-
-
-File: gdb.info, Node: GDB/M2, Prev: M2 Scope, Up: Modula-2
-
-GDB and Modula-2
-----------------
-
- Some GDB commands have little use when debugging Modula-2 programs.
-Five subcommands of `set print' and `show print' apply specifically to
-C and C++: `vtbl', `demangle', `asm-demangle', `object', and `union'.
-The first four apply to C++, and the last to the C `union' type, which
-has no direct analogue in Modula-2.
-
- The `@' operator (*note Expressions: Expressions.), while available
-while using any language, is not useful with Modula-2. Its intent is
-to aid the debugging of "dynamic arrays", which cannot be created in
-Modula-2 as they can in C or C++. However, because an address can be
-specified by an integral constant, the construct `{TYPE}ADREXP' is
-still useful. (*note Expressions: Expressions.)
-
- In GDB scripts, the Modula-2 inequality operator `#' is interpreted
-as the beginning of a comment. Use `<>' instead.
-
-
-File: gdb.info, Node: Symbols, Next: Altering, Prev: Languages, Up: Top
-
-Examining the Symbol Table
-**************************
-
- The commands described in this section allow you to inquire about the
-symbols (names of variables, functions and types) defined in your
-program. This information is inherent in the text of your program and
-does not change as your program executes. GDB finds it in your
-program's symbol table, in the file indicated when you started GDB
-(*note Choosing files: File Options.), or by one of the file-management
-commands (*note Commands to specify files: Files.).
-
- Occasionally, you may need to refer to symbols that contain unusual
-characters, which GDB ordinarily treats as word delimiters. The most
-frequent case is in referring to static variables in other source files
-(*note Program variables: Variables.). File names are recorded in
-object files as debugging symbols, but GDB would ordinarily parse a
-typical file name, like `foo.c', as the three words `foo' `.' `c'. To
-allow GDB to recognize `foo.c' as a single symbol, enclose it in single
-quotes; for example,
-
- p 'foo.c'::x
-
-looks up the value of `x' in the scope of the file `foo.c'.
-
-`info address SYMBOL'
- Describe where the data for SYMBOL is stored. For a register
- variable, this says which register it is kept in. For a
- non-register local variable, this prints the stack-frame offset at
- which the variable is always stored.
-
- Note the contrast with `print &SYMBOL', which does not work at all
- for a register variable, and for a stack local variable prints the
- exact address of the current instantiation of the variable.
-
-`whatis EXP'
- Print the data type of expression EXP. EXP is not actually
- evaluated, and any side-effecting operations (such as assignments
- or function calls) inside it do not take place. *Note
- Expressions: Expressions.
-
-`whatis'
- Print the data type of `$', the last value in the value history.
-
-`ptype TYPENAME'
- Print a description of data type TYPENAME. TYPENAME may be the
- name of a type, or for C code it may have the form `class
- CLASS-NAME', `struct STRUCT-TAG', `union UNION-TAG' or `enum
- ENUM-TAG'.
-
-`ptype EXP'
-`ptype'
- Print a description of the type of expression EXP. `ptype'
- differs from `whatis' by printing a detailed description, instead
- of just the name of the type.
-
- For example, for this variable declaration:
-
- struct complex {double real; double imag;} v;
-
- the two commands give this output:
-
- (gdb) whatis v
- type = struct complex
- (gdb) ptype v
- type = struct complex {
- double real;
- double imag;
- }
-
- As with `whatis', using `ptype' without an argument refers to the
- type of `$', the last value in the value history.
-
-`info types REGEXP'
-`info types'
- Print a brief description of all types whose name matches REGEXP
- (or all types in your program, if you supply no argument). Each
- complete typename is matched as though it were a complete line;
- thus, `i type value' gives information on all types in your
- program whose name includes the string `value', but `i type
- ^value$' gives information only on types whose complete name is
- `value'.
-
- This command differs from `ptype' in two ways: first, like
- `whatis', it does not print a detailed description; second, it
- lists all source files where a type is defined.
-
-`info source'
- Show the name of the current source file--that is, the source file
- for the function containing the current point of execution--and
- the language it was written in.
-
-`info sources'
- Print the names of all source files in your program for which
- there is debugging information, organized into two lists: files
- whose symbols have already been read, and files whose symbols will
- be read when needed.
-
-`info functions'
- Print the names and data types of all defined functions.
-
-`info functions REGEXP'
- Print the names and data types of all defined functions whose
- names contain a match for regular expression REGEXP. Thus, `info
- fun step' finds all functions whose names include `step'; `info
- fun ^step' finds those whose names start with `step'.
-
-`info variables'
- Print the names and data types of all variables that are declared
- outside of functions (i.e., excluding local variables).
-
-`info variables REGEXP'
- Print the names and data types of all variables (except for local
- variables) whose names contain a match for regular expression
- REGEXP.
-
-`maint print symbols FILENAME'
-`maint print psymbols FILENAME'
-`maint print msymbols FILENAME'
- Write a dump of debugging symbol data into the file FILENAME.
- These commands are used to debug the GDB symbol-reading code. Only
- symbols with debugging data are included. If you use `maint print
- symbols', GDB includes all the symbols for which it has already
- collected full details: that is, FILENAME reflects symbols for
- only those files whose symbols GDB has read. You can use the
- command `info sources' to find out which files these are. If you
- use `maint print psymbols' instead, the dump shows information
- about symbols that GDB only knows partially--that is, symbols
- defined in files that GDB has skimmed, but not yet read
- completely. Finally, `maint print msymbols' dumps just the
- minimal symbol information required for each object file from
- which GDB has read some symbols. *Note Commands to specify files:
- Files, for a discussion of how GDB reads symbols (in the
- description of `symbol-file').
-
diff --git a/gnu/usr.bin/gdb/doc/gdb.info-5 b/gnu/usr.bin/gdb/doc/gdb.info-5
deleted file mode 100644
index ecf3d18..0000000
--- a/gnu/usr.bin/gdb/doc/gdb.info-5
+++ /dev/null
@@ -1,1215 +0,0 @@
-This is Info file ./gdb.info, produced by Makeinfo-1.52 from the input
-file gdb.texinfo.
-
-START-INFO-DIR-ENTRY
-* Gdb:: The GNU debugger.
-END-INFO-DIR-ENTRY
- This file documents the GNU debugger GDB.
-
- This is Edition 4.09, August 1993, of `Debugging with GDB: the GNU
-Source-Level Debugger' for GDB Version 4.11.
-
- Copyright (C) 1988, '89, '90, '91, '92, '93 Free Software
-Foundation, Inc.
-
- Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of
-this manual under the conditions for verbatim copying, provided also
-that the entire resulting derived work is distributed under the terms
-of a permission notice identical to this one.
-
- Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions.
-
-
-File: gdb.info, Node: Altering, Next: GDB Files, Prev: Symbols, Up: Top
-
-Altering Execution
-******************
-
- Once you think you have found an error in your program, you might
-want to find out for certain whether correcting the apparent error
-would lead to correct results in the rest of the run. You can find the
-answer by experiment, using the GDB features for altering execution of
-the program.
-
- For example, you can store new values into variables or memory
-locations, give your program a signal, restart it at a different
-address, or even return prematurely from a function to its caller.
-
-* Menu:
-
-* Assignment:: Assignment to variables
-* Jumping:: Continuing at a different address
-
-* Signaling:: Giving your program a signal
-
-* Returning:: Returning from a function
-* Calling:: Calling your program's functions
-* Patching:: Patching your program
-
-
-File: gdb.info, Node: Assignment, Next: Jumping, Up: Altering
-
-Assignment to variables
-=======================
-
- To alter the value of a variable, evaluate an assignment expression.
-*Note Expressions: Expressions. For example,
-
- print x=4
-
-stores the value 4 into the variable `x', and then prints the value of
-the assignment expression (which is 4). *Note Using GDB with Different
-Languages: Languages, for more information on operators in supported
-languages.
-
- If you are not interested in seeing the value of the assignment, use
-the `set' command instead of the `print' command. `set' is really the
-same as `print' except that the expression's value is not printed and
-is not put in the value history (*note Value history: Value History.).
-The expression is evaluated only for its effects.
-
- If the beginning of the argument string of the `set' command appears
-identical to a `set' subcommand, use the `set variable' command instead
-of just `set'. This command is identical to `set' except for its lack
-of subcommands. For example, if your program has a variable `width',
-you get an error if you try to set a new value with just `set width=13',
-because GDB has the command `set width':
-
- (gdb) whatis width
- type = double
- (gdb) p width
- $4 = 13
- (gdb) set width=47
- Invalid syntax in expression.
-
-The invalid expression, of course, is `=47'. In order to actually set
-the program's variable `width', use
-
- (gdb) set var width=47
-
- GDB allows more implicit conversions in assignments than C; you can
-freely store an integer value into a pointer variable or vice versa,
-and you can convert any structure to any other structure that is the
-same length or shorter.
-
- To store values into arbitrary places in memory, use the `{...}'
-construct to generate a value of specified type at a specified address
-(*note Expressions: Expressions.). For example, `{int}0x83040' refers
-to memory location `0x83040' as an integer (which implies a certain size
-and representation in memory), and
-
- set {int}0x83040 = 4
-
-stores the value 4 into that memory location.
-
-
-File: gdb.info, Node: Jumping, Next: Signaling, Prev: Assignment, Up: Altering
-
-Continuing at a different address
-=================================
-
- Ordinarily, when you continue your program, you do so at the place
-where it stopped, with the `continue' command. You can instead
-continue at an address of your own choosing, with the following
-commands:
-
-`jump LINESPEC'
- Resume execution at line LINESPEC. Execution will stop
- immediately if there is a breakpoint there. *Note Printing source
- lines: List, for a description of the different forms of LINESPEC.
-
- The `jump' command does not change the current stack frame, or the
- stack pointer, or the contents of any memory location or any
- register other than the program counter. If line LINESPEC is in a
- different function from the one currently executing, the results
- may be bizarre if the two functions expect different patterns of
- arguments or of local variables. For this reason, the `jump'
- command requests confirmation if the specified line is not in the
- function currently executing. However, even bizarre results are
- predictable if you are well acquainted with the machine-language
- code of your program.
-
-`jump *ADDRESS'
- Resume execution at the instruction at address ADDRESS.
-
- You can get much the same effect as the `jump' command by storing a
-new value into the register `$pc'. The difference is that this does
-not start your program running; it only changes the address where it
-*will* run when it is continued. For example,
-
- set $pc = 0x485
-
-causes the next `continue' command or stepping command to execute at
-address `0x485', rather than at the address where your program stopped.
-*Note Continuing and stepping: Continuing and Stepping.
-
- The most common occasion to use the `jump' command is to back up,
-perhaps with more breakpoints set, over a portion of a program that has
-already executed, in order to examine its execution in more detail.
-
-
-File: gdb.info, Node: Signaling, Next: Returning, Prev: Jumping, Up: Altering
-
-Giving your program a signal
-============================
-
-`signal SIGNAL'
- Resume execution where your program stopped, but immediately give
- it the signal SIGNAL. SIGNAL can be the name or the number of a
- signal. For example, on many systems `signal 2' and `signal
- SIGINT' are both ways of sending an interrupt signal.
-
- Alternatively, if SIGNAL is zero, continue execution without
- giving a signal. This is useful when your program stopped on
- account of a signal and would ordinary see the signal when resumed
- with the `continue' command; `signal 0' causes it to resume
- without a signal.
-
- `signal' does not repeat when you press RET a second time after
- executing the command.
-
- Invoking the `signal' command is not the same as invoking the `kill'
-utility from the shell. Sending a signal with `kill' causes GDB to
-decide what to do with the signal depending on the signal handling
-tables (*note Signals::.). The `signal' command passes the signal
-directly to your program.
-
-
-File: gdb.info, Node: Returning, Next: Calling, Prev: Signaling, Up: Altering
-
-Returning from a function
-=========================
-
-`return'
-`return EXPRESSION'
- You can cancel execution of a function call with the `return'
- command. If you give an EXPRESSION argument, its value is used as
- the function's return value.
-
- When you use `return', GDB discards the selected stack frame (and
-all frames within it). You can think of this as making the discarded
-frame return prematurely. If you wish to specify a value to be
-returned, give that value as the argument to `return'.
-
- This pops the selected stack frame (*note Selecting a frame:
-Selection.), and any other frames inside of it, leaving its caller as
-the innermost remaining frame. That frame becomes selected. The
-specified value is stored in the registers used for returning values of
-functions.
-
- The `return' command does not resume execution; it leaves the
-program stopped in the state that would exist if the function had just
-returned. In contrast, the `finish' command (*note Continuing and
-stepping: Continuing and Stepping.) resumes execution until the
-selected stack frame returns naturally.
-
-
-File: gdb.info, Node: Calling, Next: Patching, Prev: Returning, Up: Altering
-
-Calling program functions
-=========================
-
-`call EXPR'
- Evaluate the expression EXPR without displaying `void' returned
- values.
-
- You can use this variant of the `print' command if you want to
-execute a function from your program, but without cluttering the output
-with `void' returned values. The result is printed and saved in the
-value history, if it is not void.
-
-
-File: gdb.info, Node: Patching, Prev: Calling, Up: Altering
-
-Patching programs
-=================
-
- By default, GDB opens the file containing your program's executable
-code (or the corefile) read-only. This prevents accidental alterations
-to machine code; but it also prevents you from intentionally patching
-your program's binary.
-
- If you'd like to be able to patch the binary, you can specify that
-explicitly with the `set write' command. For example, you might want
-to turn on internal debugging flags, or even to make emergency repairs.
-
-`set write on'
-`set write off'
- If you specify `set write on', GDB will open executable and core
- files for both reading and writing; if you specify `set write off'
- (the default), GDB will open them read-only.
-
- If you have already loaded a file, you must load it again (using
- the `exec-file' or `core-file' command) after changing `set
- write', for your new setting to take effect.
-
-`show write'
- Display whether executable files and core files will be opened for
- writing as well as reading.
-
-
-File: gdb.info, Node: GDB Files, Next: Targets, Prev: Altering, Up: Top
-
-GDB Files
-*********
-
- GDB needs to know the file name of the program to be debugged, both
-in order to read its symbol table and in order to start your program.
-To debug a core dump of a previous run, you must also tell GDB the name
-of the core dump file.
-
-* Menu:
-
-* Files:: Commands to specify files
-* Symbol Errors:: Errors reading symbol files
-
-
-File: gdb.info, Node: Files, Next: Symbol Errors, Up: GDB Files
-
-Commands to specify files
-=========================
-
- The usual way to specify executable and core dump file names is with
-the command arguments given when you start GDB (*note Getting In and
-Out of GDB: Invocation..
-
- Occasionally it is necessary to change to a different file during a
-GDB session. Or you may run GDB and forget to specify a file you want
-to use. In these situations the GDB commands to specify new files are
-useful.
-
-`file FILENAME'
- Use FILENAME as the program to be debugged. It is read for its
- symbols and for the contents of pure memory. It is also the
- program executed when you use the `run' command. If you do not
- specify a directory and the file is not found in the GDB working
- directory, GDB uses the environment variable `PATH' as a list of
- directories to search, just as the shell does when looking for a
- program to run. You can change the value of this variable, for
- both GDB and your program, using the `path' command.
-
- On systems with memory-mapped files, an auxiliary symbol table file
- `FILENAME.syms' may be available for FILENAME. If it is, GDB will
- map in the symbol table from `FILENAME.syms', starting up more
- quickly. See the descriptions of the options `-mapped' and
- `-readnow' (available on the command line, and with the commands
- `file', `symbol-file', or `add-symbol-file'), for more information.
-
-`file'
- `file' with no argument makes GDB discard any information it has
- on both executable file and the symbol table.
-
-`exec-file [ FILENAME ]'
- Specify that the program to be run (but not the symbol table) is
- found in FILENAME. GDB will search the environment variable `PATH'
- if necessary to locate your program. Omitting FILENAME means to
- discard information on the executable file.
-
-`symbol-file [ FILENAME ]'
- Read symbol table information from file FILENAME. `PATH' is
- searched when necessary. Use the `file' command to get both symbol
- table and program to run from the same file.
-
- `symbol-file' with no argument clears out GDB information on your
- program's symbol table.
-
- The `symbol-file' command causes GDB to forget the contents of its
- convenience variables, the value history, and all breakpoints and
- auto-display expressions. This is because they may contain
- pointers to the internal data recording symbols and data types,
- which are part of the old symbol table data being discarded inside
- GDB.
-
- `symbol-file' will not repeat if you press RET again after
- executing it once.
-
- When GDB is configured for a particular environment, it will
- understand debugging information in whatever format is the standard
- generated for that environment; you may use either a GNU compiler,
- or other compilers that adhere to the local conventions. Best
- results are usually obtained from GNU compilers; for example,
- using `gcc' you can generate debugging information for optimized
- code.
-
- On some kinds of object files, the `symbol-file' command does not
- normally read the symbol table in full right away. Instead, it
- scans the symbol table quickly to find which source files and
- which symbols are present. The details are read later, one source
- file at a time, as they are needed.
-
- The purpose of this two-stage reading strategy is to make GDB
- start up faster. For the most part, it is invisible except for
- occasional pauses while the symbol table details for a particular
- source file are being read. (The `set verbose' command can turn
- these pauses into messages if desired. *Note Optional warnings
- and messages: Messages/Warnings.)
-
- We have not implemented the two-stage strategy for COFF yet. When
- the symbol table is stored in COFF format, `symbol-file' reads the
- symbol table data in full right away.
-
-`symbol-file FILENAME [ -readnow ] [ -mapped ]'
-`file FILENAME [ -readnow ] [ -mapped ]'
- You can override the GDB two-stage strategy for reading symbol
- tables by using the `-readnow' option with any of the commands that
- load symbol table information, if you want to be sure GDB has the
- entire symbol table available.
-
- If memory-mapped files are available on your system through the
- `mmap' system call, you can use another option, `-mapped', to
- cause GDB to write the symbols for your program into a reusable
- file. Future GDB debugging sessions will map in symbol information
- from this auxiliary symbol file (if the program has not changed),
- rather than spending time reading the symbol table from the
- executable program. Using the `-mapped' option has the same
- effect as starting GDB with the `-mapped' command-line option.
-
- You can use both options together, to make sure the auxiliary
- symbol file has all the symbol information for your program.
-
- The auxiliary symbol file for a program called MYPROG is called
- `MYPROG.syms'. Once this file exists (so long as it is newer than
- the corresponding executable), GDB will always attempt to use it
- when you debug MYPROG; no special options or commands are needed.
-
- The `.syms' file is specific to the host machine where you run
- GDB. It holds an exact image of the internal GDB symbol table.
- It cannot be shared across multiple host platforms.
-
-`core-file [ FILENAME ]'
- Specify the whereabouts of a core dump file to be used as the
- "contents of memory". Traditionally, core files contain only some
- parts of the address space of the process that generated them; GDB
- can access the executable file itself for other parts.
-
- `core-file' with no argument specifies that no core file is to be
- used.
-
- Note that the core file is ignored when your program is actually
- running under GDB. So, if you have been running your program and
- you wish to debug a core file instead, you must kill the
- subprocess in which the program is running. To do this, use the
- `kill' command (*note Killing the child process: Kill Process.).
-
-`load FILENAME'
- Depending on what remote debugging facilities are configured into
- GDB, the `load' command may be available. Where it exists, it is
- meant to make FILENAME (an executable) available for debugging on
- the remote system--by downloading, or dynamic linking, for example.
- `load' also records the FILENAME symbol table in GDB, like the
- `add-symbol-file' command.
-
- If your GDB does not have a `load' command, attempting to execute
- it gets the error message "`You can't do that when your target is
- ...'"
-
- The file is loaded at whatever address is specified in the
- executable. For some object file formats, like a.out, the object
- file format fixes the address and so it won't necessarily match
- the address you gave to the linker.
-
- On VxWorks, `load' will dynamically link FILENAME on the current
- target system as well as adding its symbols in GDB.
-
- With the Nindy interface to an Intel 960 board, `load' will
- download FILENAME to the 960 as well as adding its symbols in GDB.
-
- When you select remote debugging to a Hitachi SH, H8/300, or
- H8/500 board (*note GDB and Hitachi Microprocessors: Hitachi
- Remote.), the `load' command downloads your program to the Hitachi
- board and also opens it as the current executable target for GDB
- on your host (like the `file' command).
-
- `load' will not repeat if you press RET again after using it.
-
-`add-symbol-file FILENAME ADDRESS'
-`add-symbol-file FILENAME ADDRESS [ -readnow ] [ -mapped ]'
- The `add-symbol-file' command reads additional symbol table
- information from the file FILENAME. You would use this command
- when FILENAME has been dynamically loaded (by some other means)
- into the program that is running. ADDRESS should be the memory
- address at which the file has been loaded; GDB cannot figure this
- out for itself. You can specify ADDRESS as an expression.
-
- The symbol table of the file FILENAME is added to the symbol table
- originally read with the `symbol-file' command. You can use the
- `add-symbol-file' command any number of times; the new symbol data
- thus read keeps adding to the old. To discard all old symbol data
- instead, use the `symbol-file' command.
-
- `add-symbol-file' will not repeat if you press RET after using it.
-
- You can use the `-mapped' and `-readnow' options just as with the
- `symbol-file' command, to change how GDB manages the symbol table
- information for FILENAME.
-
-`info files'
-`info target'
- `info files' and `info target' are synonymous; both print the
- current target (*note Specifying a Debugging Target: Targets.),
- including the names of the executable and core dump files
- currently in use by GDB, and the files from which symbols were
- loaded. The command `help targets' lists all possible targets
- rather than current ones.
-
- All file-specifying commands allow both absolute and relative file
-names as arguments. GDB always converts the file name to an absolute
-path name and remembers it that way.
-
- GDB supports SunOS, SVR4, and IBM RS/6000 shared libraries. GDB
-automatically loads symbol definitions from shared libraries when you
-use the `run' command, or when you examine a core file. (Before you
-issue the `run' command, GDB will not understand references to a
-function in a shared library, however--unless you are debugging a core
-file).
-
-`info share'
-`info sharedlibrary'
- Print the names of the shared libraries which are currently loaded.
-
-`sharedlibrary REGEX'
-`share REGEX'
- This is an obsolescent command; you can use it to explicitly load
- shared object library symbols for files matching a Unix regular
- expression, but as with files loaded automatically, it will only
- load shared libraries required by your program for a core file or
- after typing `run'. If REGEX is omitted all shared libraries
- required by your program are loaded.
-
-
-File: gdb.info, Node: Symbol Errors, Prev: Files, Up: GDB Files
-
-Errors reading symbol files
-===========================
-
- While reading a symbol file, GDB will occasionally encounter
-problems, such as symbol types it does not recognize, or known bugs in
-compiler output. By default, GDB does not notify you of such problems,
-since they are relatively common and primarily of interest to people
-debugging compilers. If you are interested in seeing information about
-ill-constructed symbol tables, you can either ask GDB to print only one
-message about each such type of problem, no matter how many times the
-problem occurs; or you can ask GDB to print more messages, to see how
-many times the problems occur, with the `set complaints' command (*note
-Optional warnings and messages: Messages/Warnings.).
-
- The messages currently printed, and their meanings, include:
-
-`inner block not inside outer block in SYMBOL'
- The symbol information shows where symbol scopes begin and end
- (such as at the start of a function or a block of statements).
- This error indicates that an inner scope block is not fully
- contained in its outer scope blocks.
-
- GDB circumvents the problem by treating the inner block as if it
- had the same scope as the outer block. In the error message,
- SYMBOL may be shown as "`(don't know)'" if the outer block is not a
- function.
-
-`block at ADDRESS out of order'
- The symbol information for symbol scope blocks should occur in
- order of increasing addresses. This error indicates that it does
- not do so.
-
- GDB does not circumvent this problem, and will have trouble
- locating symbols in the source file whose symbols it is reading.
- (You can often determine what source file is affected by specifying
- `set verbose on'. *Note Optional warnings and messages:
- Messages/Warnings.)
-
-`bad block start address patched'
- The symbol information for a symbol scope block has a start address
- smaller than the address of the preceding source line. This is
- known to occur in the SunOS 4.1.1 (and earlier) C compiler.
-
- GDB circumvents the problem by treating the symbol scope block as
- starting on the previous source line.
-
-`bad string table offset in symbol N'
- Symbol number N contains a pointer into the string table which is
- larger than the size of the string table.
-
- GDB circumvents the problem by considering the symbol to have the
- name `foo', which may cause other problems if many symbols end up
- with this name.
-
-`unknown symbol type `0xNN''
- The symbol information contains new data types that GDB does not
- yet know how to read. `0xNN' is the symbol type of the
- misunderstood information, in hexadecimal.
-
- GDB circumvents the error by ignoring this symbol information.
- This will usually allow your program to be debugged, though
- certain symbols will not be accessible. If you encounter such a
- problem and feel like debugging it, you can debug `gdb' with
- itself, breakpoint on `complain', then go up to the function
- `read_dbx_symtab' and examine `*bufp' to see the symbol.
-
-`stub type has NULL name'
- GDB could not find the full definition for a struct or class.
-
-`const/volatile indicator missing (ok if using g++ v1.x), got...'
- The symbol information for a C++ member function is missing some
- information that recent versions of the compiler should have output
- for it.
-
-`info mismatch between compiler and debugger'
- GDB could not parse a type specification output by the compiler.
-
-
-File: gdb.info, Node: Targets, Next: Controlling GDB, Prev: GDB Files, Up: Top
-
-Specifying a Debugging Target
-*****************************
-
- A "target" is the execution environment occupied by your program.
-Often, GDB runs in the same host environment as your program; in that
-case, the debugging target is specified as a side effect when you use
-the `file' or `core' commands. When you need more flexibility--for
-example, running GDB on a physically separate host, or controlling a
-standalone system over a serial port or a realtime system over a TCP/IP
-connection--you can use the `target' command to specify one of the
-target types configured for GDB (*note Commands for managing targets:
-Target Commands.).
-
-* Menu:
-
-* Active Targets:: Active targets
-* Target Commands:: Commands for managing targets
-* Remote:: Remote debugging
-
-
-File: gdb.info, Node: Active Targets, Next: Target Commands, Up: Targets
-
-Active targets
-==============
-
- There are three classes of targets: processes, core files, and
-executable files. GDB can work concurrently on up to three active
-targets, one in each class. This allows you to (for example) start a
-process and inspect its activity without abandoning your work on a core
-file.
-
- For example, if you execute `gdb a.out', then the executable file
-`a.out' is the only active target. If you designate a core file as
-well--presumably from a prior run that crashed and coredumped--then GDB
-has two active targets and will use them in tandem, looking first in
-the corefile target, then in the executable file, to satisfy requests
-for memory addresses. (Typically, these two classes of target are
-complementary, since core files contain only a program's read-write
-memory--variables and so on--plus machine status, while executable
-files contain only the program text and initialized data.)
-
- When you type `run', your executable file becomes an active process
-target as well. When a process target is active, all GDB commands
-requesting memory addresses refer to that target; addresses in an
-active core file or executable file target are obscured while the
-process target is active.
-
- Use the `core-file' and `exec-file' commands to select a new core
-file or executable target (*note Commands to specify files: Files.).
-To specify as a target a process that is already running, use the
-`attach' command (*note Debugging an already-running process: Attach.).
-
-
-File: gdb.info, Node: Target Commands, Next: Remote, Prev: Active Targets, Up: Targets
-
-Commands for managing targets
-=============================
-
-`target TYPE PARAMETERS'
- Connects the GDB host environment to a target machine or process.
- A target is typically a protocol for talking to debugging
- facilities. You use the argument TYPE to specify the type or
- protocol of the target machine.
-
- Further PARAMETERS are interpreted by the target protocol, but
- typically include things like device names or host names to connect
- with, process numbers, and baud rates.
-
- The `target' command will not repeat if you press RET again after
- executing the command.
-
-`help target'
- Displays the names of all targets available. To display targets
- currently selected, use either `info target' or `info files'
- (*note Commands to specify files: Files.).
-
-`help target NAME'
- Describe a particular target, including any parameters necessary to
- select it.
-
- Here are some common targets (available, or not, depending on the GDB
-configuration):
-
-`target exec PROGRAM'
- An executable file. `target exec PROGRAM' is the same as
- `exec-file PROGRAM'.
-
-`target core FILENAME'
- A core dump file. `target core FILENAME' is the same as
- `core-file FILENAME'.
-
-`target remote DEV'
- Remote serial target in GDB-specific protocol. The argument DEV
- specifies what serial device to use for the connection (e.g.
- `/dev/ttya'). *Note Remote debugging: Remote.
-
-`target sim'
- CPU simulator. *Note Simulated CPU Target: Simulator.
-
-`target udi KEYWORD'
- Remote AMD29K target, using the AMD UDI protocol. The KEYWORD
- argument specifies which 29K board or simulator to use. *Note GDB
- and the UDI protocol for AMD29K: UDI29K Remote.
-
-`target amd-eb DEV SPEED PROG'
- Remote PC-resident AMD EB29K board, attached over serial lines.
- dEV is the serial device, as for `target remote'; SPEED allows you
- to specify the linespeed; and PROG is the name of the program to
- be debugged, as it appears to DOS on the PC. *Note GDB with a
- remote EB29K: EB29K Remote.
-
-`target hms'
- A Hitachi SH, H8/300, or H8/500 board, attached via serial line to
- your host. Use special commands `device' and `speed' to control
- the serial line and the communications speed used. *Note GDB and
- Hitachi Microprocessors: Hitachi Remote.
-
-`target nindy DEVICENAME'
- An Intel 960 board controlled by a Nindy Monitor. DEVICENAME is
- the name of the serial device to use for the connection, e.g.
- `/dev/ttya'. *Note GDB with a remote i960 (Nindy): i960-Nindy
- Remote.
-
-`target st2000 DEV SPEED'
- A Tandem ST2000 phone switch, running Tandem's STDBUG protocol.
- dEV is the name of the device attached to the ST2000 serial line;
- SPEED is the communication line speed. The arguments are not used
- if GDB is configured to connect to the ST2000 using TCP or Telnet.
- *Note GDB with a Tandem ST2000: ST2000 Remote.
-
-`target vxworks MACHINENAME'
- A VxWorks system, attached via TCP/IP. The argument MACHINENAME
- is the target system's machine name or IP address. *Note GDB and
- VxWorks: VxWorks Remote.
-
- Different targets are available on different configurations of GDB;
-your configuration may have more or fewer targets.
-
-
-File: gdb.info, Node: Remote, Prev: Target Commands, Up: Targets
-
-Remote debugging
-================
-
- If you are trying to debug a program running on a machine that
-cannot run GDB in the usual way, it is often useful to use remote
-debugging. For example, you might use remote debugging on an operating
-system kernel, or on a small system which does not have a general
-purpose operating system powerful enough to run a full-featured
-debugger.
-
- Some configurations of GDB have special serial or TCP/IP interfaces
-to make this work with particular debugging targets. In addition, GDB
-comes with a generic serial protocol (specific to GDB, but not specific
-to any particular target system) which you can use if you write the
-remote stubs--the code that will run on the remote system to
-communicate with GDB.
-
- Other remote targets may be available in your configuration of GDB;
-use `help targets' to list them.
-
-* Menu:
-
-
-* Remote Serial:: GDB remote serial protocol
-
-* i960-Nindy Remote:: GDB with a remote i960 (Nindy)
-
-* UDI29K Remote:: GDB and the UDI protocol for AMD29K
-* EB29K Remote:: GDB with a remote EB29K
-
-* VxWorks Remote:: GDB and VxWorks
-
-* ST2000 Remote:: GDB with a Tandem ST2000
-
-* Hitachi Remote:: GDB and Hitachi Microprocessors
-
-* MIPS Remote:: GDB and MIPS boards
-
-* Simulator:: Simulated CPU target
-
-
-File: gdb.info, Node: Remote Serial, Next: i960-Nindy Remote, Up: Remote
-
-The GDB remote serial protocol
-------------------------------
-
- To debug a program running on another machine (the debugging
-"target" machine), you must first arrange for all the usual
-prerequisites for the program to run by itself. For example, for a C
-program, you need
-
- 1. A startup routine to set up the C runtime environment; these
- usually have a name like `crt0'. The startup routine may be
- supplied by your hardware supplier, or you may have to write your
- own.
-
- 2. You probably need a C subroutine library to support your program's
- subroutine calls, notably managing input and output.
-
- 3. A way of getting your program to the other machine--for example, a
- download program. These are often supplied by the hardware
- manufacturer, but you may have to write your own from hardware
- documentation.
-
- The next step is to arrange for your program to use a serial port to
-communicate with the machine where GDB is running (the "host" machine).
-In general terms, the scheme looks like this:
-
-*On the host,*
- GDB already understands how to use this protocol; when everything
- else is set up, you can simply use the `target remote' command
- (*note Specifying a Debugging Target: Targets.).
-
-*On the target,*
- you must link with your program a few special-purpose subroutines
- that implement the GDB remote serial protocol. The file
- containing these subroutines is called a "debugging stub".
-
- On certain remote targets, you can use an auxiliary program
- `gdbserver' instead of linking a stub into your program. *Note
- Using the `gdbserver' program: Server, for details.
-
- The debugging stub is specific to the architecture of the remote
-machine; for example, use `sparc-stub.c' to debug programs on SPARC
-boards.
-
- These working remote stubs are distributed with GDB:
-
-`sparc-stub.c'
- For SPARC architectures.
-
-`m68k-stub.c'
- For Motorola 680x0 architectures.
-
-`i386-stub.c'
- For Intel 386 and compatible architectures.
-
- The `README' file in the GDB distribution may list other recently
-added stubs.
-
-* Menu:
-
-* Stub Contents:: What the stub can do for you
-* Bootstrapping:: What you must do for the stub
-* Debug Session:: Putting it all together
-* Protocol:: Outline of the communication protocol
-
-* Server:: Using the `gdbserver' program
-
-
-File: gdb.info, Node: Stub Contents, Next: Bootstrapping, Up: Remote Serial
-
-What the stub can do for you
-----------------------------
-
- The debugging stub for your architecture supplies these three
-subroutines:
-
-`set_debug_traps'
- This routine arranges for `handle_exception' to run when your
- program stops. You must call this subroutine explicitly near the
- beginning of your program.
-
-`handle_exception'
- This is the central workhorse, but your program never calls it
- explicitly--the setup code arranges for `handle_exception' to run
- when a trap is triggered.
-
- `handle_exception' takes control when your program stops during
- execution (for example, on a breakpoint), and mediates
- communications with GDB on the host machine. This is where the
- communications protocol is implemented; `handle_exception' acts as
- the GDB representative on the target machine; it begins by sending
- summary information on the state of your program, then continues
- to execute, retrieving and transmitting any information GDB needs,
- until you execute a GDB command that makes your program resume; at
- that point, `handle_exception' returns control to your own code on
- the target machine.
-
-`breakpoint'
- Use this auxiliary subroutine to make your program contain a
- breakpoint. Depending on the particular situation, this may be
- the only way for GDB to get control. For instance, if your target
- machine has some sort of interrupt button, you won't need to call
- this; pressing the interrupt button will transfer control to
- `handle_exception'--in effect, to GDB. On some machines, simply
- receiving characters on the serial port may also trigger a trap;
- again, in that situation, you don't need to call `breakpoint' from
- your own program--simply running `target remote' from the host GDB
- session will get control.
-
- Call `breakpoint' if none of these is true, or if you simply want
- to make certain your program stops at a predetermined point for the
- start of your debugging session.
-
-
-File: gdb.info, Node: Bootstrapping, Next: Debug Session, Prev: Stub Contents, Up: Remote Serial
-
-What you must do for the stub
------------------------------
-
- The debugging stubs that come with GDB are set up for a particular
-chip architecture, but they have no information about the rest of your
-debugging target machine. To allow the stub to work, you must supply
-these special low-level subroutines:
-
-`int getDebugChar()'
- Write this subroutine to read a single character from the serial
- port. It may be identical to `getchar' for your target system; a
- different name is used to allow you to distinguish the two if you
- wish.
-
-`void putDebugChar(int)'
- Write this subroutine to write a single character to the serial
- port. It may be identical to `putchar' for your target system; a
- different name is used to allow you to distinguish the two if you
- wish.
-
-`void exceptionHandler (int EXCEPTION_NUMBER, void *EXCEPTION_ADDRESS)'
- Write this function to install EXCEPTION_ADDRESS in the exception
- handling tables. You need to do this because the stub does not
- have any way of knowing what the exception handling tables on your
- target system are like (for example, the processor's table might
- be in ROM, containing entries which point to a table in RAM).
- eXCEPTION_NUMBER is the exception number which should be changed;
- its meaning is architecture-dependent (for example, different
- numbers might represent divide by zero, misaligned access, etc).
- When this exception occurs, control should be transferred directly
- to EXCEPTION_ADDRESS, and the processor state (stack, registers,
- etc.) should be just as it is when a processor exception occurs.
- So if you want to use a jump instruction to reach
- EXCEPTION_ADDRESS, it should be a simple jump, not a jump to
- subroutine.
-
- For the 386, EXCEPTION_ADDRESS should be installed as an interrupt
- gate so that interrupts are masked while the handler runs. The
- gate should be at privilege level 0 (the most privileged level).
- The SPARC and 68k stubs are able to mask interrupts themself
- without help from `exceptionHandler'.
-
-`void flush_i_cache()'
- Write this subroutine to flush the instruction cache, if any, on
- your target machine. If there is no instruction cache, this
- subroutine may be a no-op.
-
- On target machines that have instruction caches, GDB requires this
- function to make certain that the state of your program is stable.
-
-You must also make sure this library routine is available:
-
-`void *memset(void *, int, int)'
- This is the standard library function `memset' that sets an area of
- memory to a known value. If you have one of the free versions of
- `libc.a', `memset' can be found there; otherwise, you must either
- obtain it from your hardware manufacturer, or write your own.
-
- If you do not use the GNU C compiler, you may need other standard
-library subroutines as well; this will vary from one stub to another,
-but in general the stubs are likely to use any of the common library
-subroutines which `gcc' generates as inline code.
-
-
-File: gdb.info, Node: Debug Session, Next: Protocol, Prev: Bootstrapping, Up: Remote Serial
-
-Putting it all together
------------------------
-
- In summary, when your program is ready to debug, you must follow
-these steps.
-
- 1. Make sure you have the supporting low-level routines (*note What
- you must do for the stub: Bootstrapping.):
- `getDebugChar', `putDebugChar',
- `flush_i_cache', `memset', `exceptionHandler'.
-
- 2. Insert these lines near the top of your program:
-
- set_debug_traps();
- breakpoint();
-
- 3. For the 680x0 stub only, you need to provide a variable called
- `exceptionHook'. Normally you just use
-
- void (*exceptionHook)() = 0;
-
- but if before calling `set_debug_traps', you set it to point to a
- function in your program, that function is called when `GDB'
- continues after stopping on a trap (for example, bus error). The
- function indicated by `exceptionHook' is called with one
- parameter: an `int' which is the exception number.
-
- 4. Compile and link together: your program, the GDB debugging stub for
- your target architecture, and the supporting subroutines.
-
- 5. Make sure you have a serial connection between your target machine
- and the GDB host, and identify the serial port used for this on
- the host.
-
- 6. Download your program to your target machine (or get it there by
- whatever means the manufacturer provides), and start it.
-
- 7. To start remote debugging, run GDB on the host machine, and specify
- as an executable file the program that is running in the remote
- machine. This tells GDB how to find your program's symbols and
- the contents of its pure text.
-
- Then establish communication using the `target remote' command.
- Its argument specifies how to communicate with the target
- machine--either via a devicename attached to a direct serial line,
- or a TCP port (usually to a terminal server which in turn has a
- serial line to the target). For example, to use a serial line
- connected to the device named `/dev/ttyb':
-
- target remote /dev/ttyb
-
- To use a TCP connection, use an argument of the form `HOST:port'.
- For example, to connect to port 2828 on a terminal server named
- `manyfarms':
-
- target remote manyfarms:2828
-
- Now you can use all the usual commands to examine and change data
-and to step and continue the remote program.
-
- To resume the remote program and stop debugging it, use the `detach'
-command.
-
- Whenever GDB is waiting for the remote program, if you type the
-interrupt character (often C-C), GDB attempts to stop the program.
-This may or may not succeed, depending in part on the hardware and the
-serial drivers the remote system uses. If you type the interrupt
-character once again, GDB displays this prompt:
-
- Interrupted while waiting for the program.
- Give up (and stop debugging it)? (y or n)
-
- If you type `y', GDB abandons the remote debugging session. (If you
-decide you want to try again later, you can use `target remote' again
-to connect once more.) If you type `n', GDB goes back to waiting.
-
-
-File: gdb.info, Node: Protocol, Next: Server, Prev: Debug Session, Up: Remote Serial
-
-Outline of the communication protocol
--------------------------------------
-
- The stub files provided with GDB implement the target side of the
-communication protocol, and the GDB side is implemented in the GDB
-source file `remote.c'. Normally, you can simply allow these
-subroutines to communicate, and ignore the details. (If you're
-implementing your own stub file, you can still ignore the details: start
-with one of the existing stub files. `sparc-stub.c' is the best
-organized, and therefore the easiest to read.)
-
- However, there may be occasions when you need to know something about
-the protocol--for example, if there is only one serial port to your
-target machine, you might want your program to do something special if
-it recognizes a packet meant for GDB.
-
- All GDB commands and responses (other than acknowledgements, which
-are single characters) are sent as a packet which includes a checksum.
-A packet is introduced with the character `$', and ends with the
-character `#' followed by a two-digit checksum:
-
- $PACKET INFO#CHECKSUM
-
-CHECKSUM is computed as the modulo 256 sum of the PACKET INFO
-characters.
-
- When either the host or the target machine receives a packet, the
-first response expected is an acknowledgement: a single character,
-either `+' (to indicate the package was received correctly) or `-' (to
-request retransmission).
-
- The host (GDB) sends commands, and the target (the debugging stub
-incorporated in your program) sends data in response. The target also
-sends data when your program stops.
-
- Command packets are distinguished by their first character, which
-identifies the kind of command.
-
- These are the commands currently supported:
-
-`g'
- Requests the values of CPU registers.
-
-`G'
- Sets the values of CPU registers.
-
-`mADDR,COUNT'
- Read COUNT bytes at location ADDR.
-
-`MADDR,COUNT:...'
- Write COUNT bytes at location ADDR.
-
-`c'
-`cADDR'
- Resume execution at the current address (or at ADDR if supplied).
-
-`s'
-`sADDR'
- Step the target program for one instruction, from either the
- current program counter or from ADDR if supplied.
-
-`k'
- Kill the target program.
-
-`?'
- Report the most recent signal. To allow you to take advantage of
- the GDB signal handling commands, one of the functions of the
- debugging stub is to report CPU traps as the corresponding POSIX
- signal values.
-
- If you have trouble with the serial connection, you can use the
-command `set remotedebug'. This makes GDB report on all packets sent
-back and forth across the serial line to the remote machine. The
-packet-debugging information is printed on the GDB standard output
-stream. `set remotedebug off' turns it off, and `show remotedebug'
-will show you its current state.
-
-
-File: gdb.info, Node: Server, Prev: Protocol, Up: Remote Serial
-
-Using the `gdbserver' program
------------------------------
-
- `gdbserver' is a control program for Unix-like systems, which allows
-you to connect your program with a remote GDB via `target remote'--but
-without linking in the usual debugging stub.
-
- `gdbserver' is not a complete replacement for the debugging stubs,
-because it requires essentially the same operating-system facilities
-that GDB itself does. In fact, a system that can run `gdbserver' to
-connect to a remote GDB could also run GDBN locally! `gdbserver' is
-sometimes useful nevertheless, because it is a much smaller program
-than GDB itself. It is also easier to port than all of GDBN, so you
-may be able to get started more quickly on a new system by using
-`gdbserver'.
-
- GDB and `gdbserver' communicate via either a serial line or a TCP
-connection, using the standard GDB remote serial protocol.
-
-*On the target,*
- you need to have a copy of the program you want to debug.
- `gdbserver' does not need your program's symbol table, so you can
- strip the program if necessary to save space. GDB on the host
- system does all the symbol handling.
-
- To use the server, you must tell it how to communicate with {No
- Value For "GDB"}; the name of your program; and the arguments for
- your program. The syntax is:
-
- target> gdbserver COMM PROGRAM [ ARGS ... ]
-
- COMM is either a device name (to use a serial line) or a TCP
- hostname and portnumber. For example, to debug emacs with the
- argument `foo.txt' and communicate with GDB over the serial port
- `/dev/com1':
-
- target> gdbserver /dev/com1 emacs foo.txt
-
- `gdbserver' waits passively for the host GDB to communicate with
- it.
-
- To use a TCP connection instead of a serial line:
-
- target> gdbserver host:2345 emacs foo.txt
-
- The only difference from the previous example is the first
- argument, specifying that you are communicating with the host GDB
- via TCP. The `host:2345' argument means that `gdbserver' is to
- expect a TCP connection from machine `host' to local TCP port 2345.
- (Currently, the `host' part is ignored.) You can choose any number
- you want for the port number as long as it does not conflict with
- any TCP ports already in use on the target system.(1) You must use
- the same port number with the host GDB `target remote' command.
-
-*On the host,*
- you need an unstripped copy of your program, since GDB needs
- symbols and debugging information. Start up GDB as usual, using
- the name of the local copy of your program as the first argument.
- (You may also need the `--baud' option if the serial line is
- running at anything other than 9600 bps.) After that, use `target
- remote' to establish communications with `gdbserver'. Its
- argument is either a device name (usually a serial device, like
- `/dev/ttyb'), or a TCP port descriptof in the form `HOST:PORT'.
- For example:
-
- (gdb) target remote /dev/ttyb
-
- communicates with the server via serial line `/dev/ttyb', and
-
- (gdb) target remote the-target:2345
-
- communicates via a TCP connection to port 2345 on host
- `the-target'. For TCP connections, you must start up `gdbserver'
- prior to using the `target remote' command. Otherwise you may get
- an error whose text depends on the host system, but which usually
- looks something like `Connection refused'.
-
- ---------- Footnotes ----------
-
- (1) If you choose a port number that conflicts with another
-service, `gdbserver' prints an error message and exits.
-
-
-File: gdb.info, Node: i960-Nindy Remote, Next: UDI29K Remote, Prev: Remote Serial, Up: Remote
-
-GDB with a remote i960 (Nindy)
-------------------------------
-
- "Nindy" is a ROM Monitor program for Intel 960 target systems. When
-GDB is configured to control a remote Intel 960 using Nindy, you can
-tell GDB how to connect to the 960 in several ways:
-
- * Through command line options specifying serial port, version of the
- Nindy protocol, and communications speed;
-
- * By responding to a prompt on startup;
-
- * By using the `target' command at any point during your GDB
- session. *Note Commands for managing targets: Target Commands.
-
-* Menu:
-
-* Nindy Startup:: Startup with Nindy
-* Nindy Options:: Options for Nindy
-* Nindy Reset:: Nindy reset command
-
-
-File: gdb.info, Node: Nindy Startup, Next: Nindy Options, Up: i960-Nindy Remote
-
-Startup with Nindy
-------------------
-
- If you simply start `gdb' without using any command-line options,
-you are prompted for what serial port to use, *before* you reach the
-ordinary GDB prompt:
-
- Attach /dev/ttyNN -- specify NN, or "quit" to quit:
-
-Respond to the prompt with whatever suffix (after `/dev/tty')
-identifies the serial port you want to use. You can, if you choose,
-simply start up with no Nindy connection by responding to the prompt
-with an empty line. If you do this and later wish to attach to Nindy,
-use `target' (*note Commands for managing targets: Target Commands.).
-
diff --git a/gnu/usr.bin/gdb/doc/gdb.info-6 b/gnu/usr.bin/gdb/doc/gdb.info-6
deleted file mode 100644
index 8a746fd..0000000
--- a/gnu/usr.bin/gdb/doc/gdb.info-6
+++ /dev/null
@@ -1,1220 +0,0 @@
-This is Info file ./gdb.info, produced by Makeinfo-1.52 from the input
-file gdb.texinfo.
-
-START-INFO-DIR-ENTRY
-* Gdb:: The GNU debugger.
-END-INFO-DIR-ENTRY
- This file documents the GNU debugger GDB.
-
- This is Edition 4.09, August 1993, of `Debugging with GDB: the GNU
-Source-Level Debugger' for GDB Version 4.11.
-
- Copyright (C) 1988, '89, '90, '91, '92, '93 Free Software
-Foundation, Inc.
-
- Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of
-this manual under the conditions for verbatim copying, provided also
-that the entire resulting derived work is distributed under the terms
-of a permission notice identical to this one.
-
- Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions.
-
-
-File: gdb.info, Node: Nindy Options, Next: Nindy Reset, Prev: Nindy Startup, Up: i960-Nindy Remote
-
-Options for Nindy
------------------
-
- These are the startup options for beginning your GDB session with a
-Nindy-960 board attached:
-
-`-r PORT'
- Specify the serial port name of a serial interface to be used to
- connect to the target system. This option is only available when
- GDB is configured for the Intel 960 target architecture. You may
- specify PORT as any of: a full pathname (e.g. `-r /dev/ttya'), a
- device name in `/dev' (e.g. `-r ttya'), or simply the unique
- suffix for a specific `tty' (e.g. `-r a').
-
-`-O'
- (An uppercase letter "O", not a zero.) Specify that GDB should use
- the "old" Nindy monitor protocol to connect to the target system.
- This option is only available when GDB is configured for the Intel
- 960 target architecture.
-
- *Warning:* if you specify `-O', but are actually trying to
- connect to a target system that expects the newer protocol,
- the connection fails, appearing to be a speed mismatch. GDB
- repeatedly attempts to reconnect at several different line
- speeds. You can abort this process with an interrupt.
-
-`-brk'
- Specify that GDB should first send a `BREAK' signal to the target
- system, in an attempt to reset it, before connecting to a Nindy
- target.
-
- *Warning:* Many target systems do not have the hardware that
- this requires; it only works with a few boards.
-
- The standard `-b' option controls the line speed used on the serial
-port.
-
-
-File: gdb.info, Node: Nindy Reset, Prev: Nindy Options, Up: i960-Nindy Remote
-
-Nindy reset command
--------------------
-
-`reset'
- For a Nindy target, this command sends a "break" to the remote
- target system; this is only useful if the target has been equipped
- with a circuit to perform a hard reset (or some other interesting
- action) when a break is detected.
-
-
-File: gdb.info, Node: UDI29K Remote, Next: EB29K Remote, Prev: i960-Nindy Remote, Up: Remote
-
-GDB and the UDI protocol for AMD29K
------------------------------------
-
- GDB supports AMD's UDI ("Universal Debugger Interface") protocol for
-debugging the a29k processor family. To use this configuration with
-AMD targets running the MiniMON monitor, you need the program `MONTIP',
-available from AMD at no charge. You can also use GDB with the UDI
-conformant a29k simulator program `ISSTIP', also available from AMD.
-
-`target udi KEYWORD'
- Select the UDI interface to a remote a29k board or simulator, where
- KEYWORD is an entry in the AMD configuration file `udi_soc'. This
- file contains keyword entries which specify parameters used to
- connect to a29k targets. If the `udi_soc' file is not in your
- working directory, you must set the environment variable `UDICONF'
- to its pathname.
-
-
-File: gdb.info, Node: EB29K Remote, Next: VxWorks Remote, Prev: UDI29K Remote, Up: Remote
-
-GDB and the EBMON protocol for AMD29K
--------------------------------------
-
- AMD distributes a 29K development board meant to fit in a PC,
-together with a DOS-hosted monitor program called `EBMON'. As a
-shorthand term, this development system is called the "EB29K". To use
-GDB from a Unix system to run programs on the EB29K board, you must
-first connect a serial cable between the PC (which hosts the EB29K
-board) and a serial port on the Unix system. In the following, we
-assume you've hooked the cable between the PC's `COM1' port and
-`/dev/ttya' on the Unix system.
-
-* Menu:
-
-* Comms (EB29K):: Communications setup
-* gdb-EB29K:: EB29K cross-debugging
-* Remote Log:: Remote log
-
-
-File: gdb.info, Node: Comms (EB29K), Next: gdb-EB29K, Up: EB29K Remote
-
-Communications setup
---------------------
-
- The next step is to set up the PC's port, by doing something like
-this in DOS on the PC:
-
- C:\> MODE com1:9600,n,8,1,none
-
-This example--run on an MS DOS 4.0 system--sets the PC port to 9600
-bps, no parity, eight data bits, one stop bit, and no "retry" action;
-you must match the communications parameters when establishing the Unix
-end of the connection as well.
-
- To give control of the PC to the Unix side of the serial line, type
-the following at the DOS console:
-
- C:\> CTTY com1
-
-(Later, if you wish to return control to the DOS console, you can use
-the command `CTTY con'--but you must send it over the device that had
-control, in our example over the `COM1' serial line).
-
- From the Unix host, use a communications program such as `tip' or
-`cu' to communicate with the PC; for example,
-
- cu -s 9600 -l /dev/ttya
-
-The `cu' options shown specify, respectively, the linespeed and the
-serial port to use. If you use `tip' instead, your command line may
-look something like the following:
-
- tip -9600 /dev/ttya
-
-Your system may require a different name where we show `/dev/ttya' as
-the argument to `tip'. The communications parameters, including which
-port to use, are associated with the `tip' argument in the "remote"
-descriptions file--normally the system table `/etc/remote'.
-
- Using the `tip' or `cu' connection, change the DOS working directory
-to the directory containing a copy of your 29K program, then start the
-PC program `EBMON' (an EB29K control program supplied with your board
-by AMD). You should see an initial display from `EBMON' similar to the
-one that follows, ending with the `EBMON' prompt `#'--
-
- C:\> G:
-
- G:\> CD \usr\joe\work29k
-
- G:\USR\JOE\WORK29K> EBMON
- Am29000 PC Coprocessor Board Monitor, version 3.0-18
- Copyright 1990 Advanced Micro Devices, Inc.
- Written by Gibbons and Associates, Inc.
-
- Enter '?' or 'H' for help
-
- PC Coprocessor Type = EB29K
- I/O Base = 0x208
- Memory Base = 0xd0000
-
- Data Memory Size = 2048KB
- Available I-RAM Range = 0x8000 to 0x1fffff
- Available D-RAM Range = 0x80002000 to 0x801fffff
-
- PageSize = 0x400
- Register Stack Size = 0x800
- Memory Stack Size = 0x1800
-
- CPU PRL = 0x3
- Am29027 Available = No
- Byte Write Available = Yes
-
- # ~.
-
- Then exit the `cu' or `tip' program (done in the example by typing
-`~.' at the `EBMON' prompt). `EBMON' will keep running, ready for GDB
-to take over.
-
- For this example, we've assumed what is probably the most convenient
-way to make sure the same 29K program is on both the PC and the Unix
-system: a PC/NFS connection that establishes "drive `G:'" on the PC as
-a file system on the Unix host. If you do not have PC/NFS or something
-similar connecting the two systems, you must arrange some other
-way--perhaps floppy-disk transfer--of getting the 29K program from the
-Unix system to the PC; GDB will *not* download it over the serial line.
-
-
-File: gdb.info, Node: gdb-EB29K, Next: Remote Log, Prev: Comms (EB29K), Up: EB29K Remote
-
-EB29K cross-debugging
----------------------
-
- Finally, `cd' to the directory containing an image of your 29K
-program on the Unix system, and start GDB--specifying as argument the
-name of your 29K program:
-
- cd /usr/joe/work29k
- gdb myfoo
-
- Now you can use the `target' command:
-
- target amd-eb /dev/ttya 9600 MYFOO
-
-In this example, we've assumed your program is in a file called
-`myfoo'. Note that the filename given as the last argument to `target
-amd-eb' should be the name of the program as it appears to DOS. In our
-example this is simply `MYFOO', but in general it can include a DOS
-path, and depending on your transfer mechanism may not resemble the
-name on the Unix side.
-
- At this point, you can set any breakpoints you wish; when you are
-ready to see your program run on the 29K board, use the GDB command
-`run'.
-
- To stop debugging the remote program, use the GDB `detach' command.
-
- To return control of the PC to its console, use `tip' or `cu' once
-again, after your GDB session has concluded, to attach to `EBMON'. You
-can then type the command `q' to shut down `EBMON', returning control
-to the DOS command-line interpreter. Type `CTTY con' to return command
-input to the main DOS console, and type `~.' to leave `tip' or `cu'.
-
-
-File: gdb.info, Node: Remote Log, Prev: gdb-EB29K, Up: EB29K Remote
-
-Remote log
-----------
-
- The `target amd-eb' command creates a file `eb.log' in the current
-working directory, to help debug problems with the connection.
-`eb.log' records all the output from `EBMON', including echoes of the
-commands sent to it. Running `tail -f' on this file in another window
-often helps to understand trouble with `EBMON', or unexpected events on
-the PC side of the connection.
-
-
-File: gdb.info, Node: ST2000 Remote, Next: Hitachi Remote, Prev: VxWorks Remote, Up: Remote
-
-GDB with a Tandem ST2000
-------------------------
-
- To connect your ST2000 to the host system, see the manufacturer's
-manual. Once the ST2000 is physically attached, you can run
-
- target st2000 DEV SPEED
-
-to establish it as your debugging environment. DEV is normally the
-name of a serial device, such as `/dev/ttya', connected to the ST2000
-via a serial line. You can instead specify DEV as a TCP connection
-(for example, to a serial line attached via a terminal concentrator)
-using the syntax `HOSTNAME:PORTNUMBER'.
-
- The `load' and `attach' commands are *not* defined for this target;
-you must load your program into the ST2000 as you normally would for
-standalone operation. GDB will read debugging information (such as
-symbols) from a separate, debugging version of the program available on
-your host computer.
-
- These auxiliary GDB commands are available to help you with the
-ST2000 environment:
-
-`st2000 COMMAND'
- Send a COMMAND to the STDBUG monitor. See the manufacturer's
- manual for available commands.
-
-`connect'
- Connect the controlling terminal to the STDBUG command monitor.
- When you are done interacting with STDBUG, typing either of two
- character sequences will get you back to the GDB command prompt:
- `RET~.' (Return, followed by tilde and period) or `RET~C-d'
- (Return, followed by tilde and control-D).
-
-
-File: gdb.info, Node: VxWorks Remote, Next: ST2000 Remote, Prev: EB29K Remote, Up: Remote
-
-GDB and VxWorks
----------------
-
- GDB enables developers to spawn and debug tasks running on networked
-VxWorks targets from a Unix host. Already-running tasks spawned from
-the VxWorks shell can also be debugged. GDB uses code that runs on
-both the Unix host and on the VxWorks target. The program `gdb' is
-installed and executed on the Unix host. (It may be installed with the
-name `vxgdb', to distinguish it from a GDB for debugging programs on
-the host itself.)
-
- The following information on connecting to VxWorks was current when
-this manual was produced; newer releases of VxWorks may use revised
-procedures.
-
- The remote debugging interface (RDB) routines are installed and
-executed on the VxWorks target. These routines are included in the
-VxWorks library `rdb.a' and are incorporated into the system image when
-source-level debugging is enabled in the VxWorks configuration.
-
- If you wish, you can define `INCLUDE_RDB' in the VxWorks
-configuration file `configAll.h' to include the RDB interface routines
-and spawn the source debugging task `tRdbTask' when VxWorks is booted.
-For more information on configuring and remaking VxWorks, see the
-manufacturer's manual.
-
- Once you have included the RDB interface in your VxWorks system image
-and set your Unix execution search path to find GDB, you are ready to
-run GDB. From your Unix host, run `gdb' (or `vxgdb', depending on your
-installation).
-
- GDB comes up showing the prompt:
-
- (vxgdb)
-
-* Menu:
-
-* VxWorks Connection:: Connecting to VxWorks
-* VxWorks Download:: VxWorks download
-* VxWorks Attach:: Running tasks
-
-
-File: gdb.info, Node: VxWorks Connection, Next: VxWorks Download, Up: VxWorks Remote
-
-Connecting to VxWorks
----------------------
-
- The GDB command `target' lets you connect to a VxWorks target on the
-network. To connect to a target whose host name is "`tt'", type:
-
- (vxgdb) target vxworks tt
-
- GDB displays messages like these:
-
- Attaching remote machine across net...
- Connected to tt.
-
- GDB then attempts to read the symbol tables of any object modules
-loaded into the VxWorks target since it was last booted. GDB locates
-these files by searching the directories listed in the command search
-path (*note Your program's environment: Environment.); if it fails to
-find an object file, it displays a message such as:
-
- prog.o: No such file or directory.
-
- When this happens, add the appropriate directory to the search path
-with the GDB command `path', and execute the `target' command again.
-
-
-File: gdb.info, Node: VxWorks Download, Next: VxWorks Attach, Prev: VxWorks Connection, Up: VxWorks Remote
-
-VxWorks download
-----------------
-
- If you have connected to the VxWorks target and you want to debug an
-object that has not yet been loaded, you can use the GDB `load' command
-to download a file from Unix to VxWorks incrementally. The object file
-given as an argument to the `load' command is actually opened twice:
-first by the VxWorks target in order to download the code, then by GDB
-in order to read the symbol table. This can lead to problems if the
-current working directories on the two systems differ. If both systems
-have NFS mounted the same filesystems, you can avoid these problems by
-using absolute paths. Otherwise, it is simplest to set the working
-directory on both systems to the directory in which the object file
-resides, and then to reference the file by its name, without any path.
-For instance, a program `prog.o' may reside in `VXPATH/vw/demo/rdb' in
-VxWorks and in `HOSTPATH/vw/demo/rdb' on the host. To load this
-program, type this on VxWorks:
-
- -> cd "VXPATH/vw/demo/rdb"
-
- Then, in GDB, type:
-
- (vxgdb) cd HOSTPATH/vw/demo/rdb
- (vxgdb) load prog.o
-
- GDB displays a response similar to this:
-
- Reading symbol data from wherever/vw/demo/rdb/prog.o... done.
-
- You can also use the `load' command to reload an object module after
-editing and recompiling the corresponding source file. Note that this
-will cause GDB to delete all currently-defined breakpoints,
-auto-displays, and convenience variables, and to clear the value
-history. (This is necessary in order to preserve the integrity of
-debugger data structures that reference the target system's symbol
-table.)
-
-
-File: gdb.info, Node: VxWorks Attach, Prev: VxWorks Download, Up: VxWorks Remote
-
-Running tasks
--------------
-
- You can also attach to an existing task using the `attach' command as
-follows:
-
- (vxgdb) attach TASK
-
-where TASK is the VxWorks hexadecimal task ID. The task can be running
-or suspended when you attach to it. If running, it will be suspended at
-the time of attachment.
-
-
-File: gdb.info, Node: Hitachi Remote, Next: MIPS Remote, Prev: ST2000 Remote, Up: Remote
-
-GDB and Hitachi Microprocessors
--------------------------------
-
- GDB needs to know these things to talk to your Hitachi SH, H8/300,
-or H8/500:
-
- 1. that you want to use `target hms', the remote debugging interface
- for Hitachi microprocessors (this is the default when GDB is
- configured specifically for the Hitachi SH, H8/300, or H8/500);
-
- 2. what serial device connects your host to your Hitachi board (the
- first serial device available on your host is the default);
-
-
- Use the special `gdb' command `device PORT' if you need to
-explicitly set the serial device. The default PORT is the first
-available port on your host. This is only necessary on Unix hosts,
-where it is typically something like `/dev/ttya'.
-
- `gdb' has another special command to set the communications speed:
-`speed BPS'. This command also is only used from Unix hosts; on DOS
-hosts, set the line speed as usual from outside GDB with the DOS `mode'
-command (for instance, `mode com2:9600,n,8,1,p' for a 9600 bps
-connection).
-
- The `device' and `speed' commands are available only when you use a
-Unix host to debug your Hitachi microprocessor programs. If you use a
-DOS host, GDB depends on an auxiliary terminate-and-stay-resident
-program called `asynctsr' to communicate with the development board
-through a PC serial port. You must also use the DOS `mode' command to
-set up the serial port on the DOS side.
-
-
-File: gdb.info, Node: MIPS Remote, Next: Simulator, Prev: Hitachi Remote, Up: Remote
-
-GDB and remote MIPS boards
---------------------------
-
- GDB can use the MIPS remote debugging protocol to talk to a MIPS
-board attached to a serial line. This is available when you configure
-GDB with `--target=mips-idt-ecoff'.
-
- To run a program on the board, start up `gdb' with the name of your
-program as the argument. To connect to the board, use the command
-`target mips PORT', where PORT is the name of the serial port connected
-to the board. If the program has not already been downloaded to the
-board, you may use the `load' command to download it. You can then use
-all the usual GDB commands.
-
- You can also specify PORT as a TCP connection (for instance, to a
-serial line managed by a terminal concentrator), using the syntax
-`HOSTNAME:PORTNUMBER'.
-
- You can see some debugging information about communications with the
-board by setting the `remotedebug' variable. If you set it to 1 using
-`set remotedebug 1' every packet will be displayed. If you set it to 2
-every character will be displayed. You can check the current value at
-any time with the command `show remotedebug'.
-
- You can control the timeout used while waiting for a packet, in the
-MIPS remote protocol, with the `set timeout SECONDS' command. The
-default is 5 seconds. Similarly, you can control the timeout used while
-waiting for an acknowledgement of a packet with the `set
-retransmit-timeout SECONDS' command. The default is 3 seconds. You
-can inspect both values with `show timeout' and `show
-retransmit-timeout'. (These commands are *only* available when GDB is
-configured for `--target=mips-idt-ecoff'.)
-
- If your target board does not support the MIPS floating point
-coprocessor, you should use the command `set mipsfpu off' (you may wish
-to put this in your .gdbinit file). This tells GDB how to find the
-return value of functions which return floating point values. It also
-allows GDB to avoid saving the floating point registers when calling
-functions on the board.
-
-
-File: gdb.info, Node: Simulator, Prev: MIPS Remote, Up: Remote
-
-Simulated CPU target
---------------------
-
- For some configurations, GDB includes a CPU simulator that you can
-use instead of a hardware CPU to debug your programs. Currently, a
-simulator is available when GDB is configured to debug Zilog Z8000 or
-Hitachi microprocessor targets.
-
- For the Z8000 family, `target sim' simulates either the Z8002 (the
-unsegmented variant of the Z8000 architecture) or the Z8001 (the
-segmented variant). The simulator recognizes which architecture is
-appropriate by inspecting the object code.
-
-`target sim'
- Debug programs on a simulated CPU (which CPU depends on the GDB
- configuration)
-
-After specifying this target, you can debug programs for the simulated
-CPU in the same style as programs for your host computer; use the
-`file' command to load a new program image, the `run' command to run
-your program, and so on.
-
- As well as making available all the usual machine registers (see
-`info reg'), this debugging target provides three additional items of
-information as specially named registers:
-
-`cycles'
- Counts clock-ticks in the simulator.
-
-`insts'
- Counts instructions run in the simulator.
-
-`time'
- Execution time in 60ths of a second.
-
- You can refer to these values in GDB expressions with the usual
-conventions; for example, `b fputc if $cycles>5000' sets a conditional
-breakpoint that will suspend only after at least 5000 simulated clock
-ticks.
-
-
-File: gdb.info, Node: Controlling GDB, Next: Sequences, Prev: Targets, Up: Top
-
-Controlling GDB
-***************
-
- You can alter the way GDB interacts with you by using the `set'
-command. For commands controlling how GDB displays data, *note Print
-settings: Print Settings.; other settings are described here.
-
-* Menu:
-
-* Prompt:: Prompt
-* Editing:: Command editing
-* History:: Command history
-* Screen Size:: Screen size
-* Numbers:: Numbers
-* Messages/Warnings:: Optional warnings and messages
-
-
-File: gdb.info, Node: Prompt, Next: Editing, Up: Controlling GDB
-
-Prompt
-======
-
- GDB indicates its readiness to read a command by printing a string
-called the "prompt". This string is normally `(gdb)'. You can change
-the prompt string with the `set prompt' command. For instance, when
-debugging GDB with GDB, it is useful to change the prompt in one of the
-GDB sessions so that you can always tell which one you are talking to.
-
-`set prompt NEWPROMPT'
- Directs GDB to use NEWPROMPT as its prompt string henceforth.
-
-`show prompt'
- Prints a line of the form: `Gdb's prompt is: YOUR-PROMPT'
-
-
-File: gdb.info, Node: Editing, Next: History, Prev: Prompt, Up: Controlling GDB
-
-Command editing
-===============
-
- GDB reads its input commands via the "readline" interface. This GNU
-library provides consistent behavior for programs which provide a
-command line interface to the user. Advantages are `emacs'-style or
-`vi'-style inline editing of commands, `csh'-like history substitution,
-and a storage and recall of command history across debugging sessions.
-
- You may control the behavior of command line editing in GDB with the
-command `set'.
-
-`set editing'
-`set editing on'
- Enable command line editing (enabled by default).
-
-`set editing off'
- Disable command line editing.
-
-`show editing'
- Show whether command line editing is enabled.
-
-
-File: gdb.info, Node: History, Next: Screen Size, Prev: Editing, Up: Controlling GDB
-
-Command history
-===============
-
- GDB can keep track of the commands you type during your debugging
-sessions, so that you can be certain of precisely what happened. Use
-these commands to manage the GDB command history facility.
-
-`set history filename FNAME'
- Set the name of the GDB command history file to FNAME. This is
- the file from which GDB will read an initial command history list
- or to which it will write this list when it exits. This list is
- accessed through history expansion or through the history command
- editing characters listed below. This file defaults to the value
- of the environment variable `GDBHISTFILE', or to `./.gdb_history'
- if this variable is not set.
-
-`set history save'
-`set history save on'
- Record command history in a file, whose name may be specified with
- the `set history filename' command. By default, this option is
- disabled.
-
-`set history save off'
- Stop recording command history in a file.
-
-`set history size SIZE'
- Set the number of commands which GDB will keep in its history list.
- This defaults to the value of the environment variable `HISTSIZE',
- or to 256 if this variable is not set.
-
- History expansion assigns special meaning to the character `!'.
-
- Since `!' is also the logical not operator in C, history expansion
-is off by default. If you decide to enable history expansion with the
-`set history expansion on' command, you may sometimes need to follow
-`!' (when it is used as logical not, in an expression) with a space or
-a tab to prevent it from being expanded. The readline history
-facilities will not attempt substitution on the strings `!=' and `!(',
-even when history expansion is enabled.
-
- The commands to control history expansion are:
-
-`set history expansion on'
-`set history expansion'
- Enable history expansion. History expansion is off by default.
-
-`set history expansion off'
- Disable history expansion.
-
- The readline code comes with more complete documentation of
- editing and history expansion features. Users unfamiliar with
- `emacs' or `vi' may wish to read it.
-
-`show history'
-`show history filename'
-`show history save'
-`show history size'
-`show history expansion'
- These commands display the state of the GDB history parameters.
- `show history' by itself displays all four states.
-
-`show commands'
- Display the last ten commands in the command history.
-
-`show commands N'
- Print ten commands centered on command number N.
-
-`show commands +'
- Print ten commands just after the commands last printed.
-
-
-File: gdb.info, Node: Screen Size, Next: Numbers, Prev: History, Up: Controlling GDB
-
-Screen size
-===========
-
- Certain commands to GDB may produce large amounts of information
-output to the screen. To help you read all of it, GDB pauses and asks
-you for input at the end of each page of output. Type RET when you
-want to continue the output, or `q' to discard the remaining output.
-Also, the screen width setting determines when to wrap lines of output.
-Depending on what is being printed, GDB tries to break the line at a
-readable place, rather than simply letting it overflow onto the
-following line.
-
- Normally GDB knows the size of the screen from the termcap data base
-together with the value of the `TERM' environment variable and the
-`stty rows' and `stty cols' settings. If this is not correct, you can
-override it with the `set height' and `set width' commands:
-
-`set height LPP'
-`show height'
-`set width CPL'
-`show width'
- These `set' commands specify a screen height of LPP lines and a
- screen width of CPL characters. The associated `show' commands
- display the current settings.
-
- If you specify a height of zero lines, GDB will not pause during
- output no matter how long the output is. This is useful if output
- is to a file or to an editor buffer.
-
- Likewise, you can specify `set width 0' to prevent GDB from
- wrapping its output.
-
-
-File: gdb.info, Node: Numbers, Next: Messages/Warnings, Prev: Screen Size, Up: Controlling GDB
-
-Numbers
-=======
-
- You can always enter numbers in octal, decimal, or hexadecimal in
-GDB by the usual conventions: octal numbers begin with `0', decimal
-numbers end with `.', and hexadecimal numbers begin with `0x'. Numbers
-that begin with none of these are, by default, entered in base 10;
-likewise, the default display for numbers--when no particular format is
-specified--is base 10. You can change the default base for both input
-and output with the `set radix' command.
-
-`set radix BASE'
- Set the default base for numeric input and display. Supported
- choices for BASE are decimal 8, 10, or 16. BASE must itself be
- specified either unambiguously or using the current default radix;
- for example, any of
-
- set radix 012
- set radix 10.
- set radix 0xa
-
- will set the base to decimal. On the other hand, `set radix 10'
- will leave the radix unchanged no matter what it was.
-
-`show radix'
- Display the current default base for numeric input and display.
-
-
-File: gdb.info, Node: Messages/Warnings, Prev: Numbers, Up: Controlling GDB
-
-Optional warnings and messages
-==============================
-
- By default, GDB is silent about its inner workings. If you are
-running on a slow machine, you may want to use the `set verbose'
-command. It will make GDB tell you when it does a lengthy internal
-operation, so you will not think it has crashed.
-
- Currently, the messages controlled by `set verbose' are those which
-announce that the symbol table for a source file is being read; see
-`symbol-file' in *Note Commands to specify files: Files.
-
-`set verbose on'
- Enables GDB output of certain informational messages.
-
-`set verbose off'
- Disables GDB output of certain informational messages.
-
-`show verbose'
- Displays whether `set verbose' is on or off.
-
- By default, if GDB encounters bugs in the symbol table of an object
-file, it is silent; but if you are debugging a compiler, you may find
-this information useful (*note Errors reading symbol files: Symbol
-Errors.).
-
-`set complaints LIMIT'
- Permits GDB to output LIMIT complaints about each type of unusual
- symbols before becoming silent about the problem. Set LIMIT to
- zero to suppress all complaints; set it to a large number to
- prevent complaints from being suppressed.
-
-`show complaints'
- Displays how many symbol complaints GDB is permitted to produce.
-
- By default, GDB is cautious, and asks what sometimes seems to be a
-lot of stupid questions to confirm certain commands. For example, if
-you try to run a program which is already running:
-
- (gdb) run
- The program being debugged has been started already.
- Start it from the beginning? (y or n)
-
- If you are willing to unflinchingly face the consequences of your own
-commands, you can disable this "feature":
-
-`set confirm off'
- Disables confirmation requests.
-
-`set confirm on'
- Enables confirmation requests (the default).
-
-`show confirm'
- Displays state of confirmation requests.
-
- Some systems allow individual object files that make up your program
-to be replaced without stopping and restarting your program. For
-example, in VxWorks you can simply recompile a defective object file
-and keep on running. If you are running on one of these systems, you
-can allow GDB to reload the symbols for automatically relinked modules:
-
-`set symbol-reloading on'
- Replace symbol definitions for the corresponding source file when
- an object file with a particular name is seen again.
-
-`set symbol-reloading off'
- Do not replace symbol definitions when re-encountering object
- files of the same name. This is the default state; if you are not
- running on a system that permits automatically relinking modules,
- you should leave `symbol-reloading' off, since otherwise GDB may
- discard symbols when linking large programs, that may contain
- several modules (from different directories or libraries) with the
- same name.
-
-`show symbol-reloading'
- Show the current `on' or `off' setting.
-
-
-File: gdb.info, Node: Sequences, Next: Emacs, Prev: Controlling GDB, Up: Top
-
-Canned Sequences of Commands
-****************************
-
- Aside from breakpoint commands (*note Breakpoint command lists:
-Break Commands.), GDB provides two ways to store sequences of commands
-for execution as a unit: user-defined commands and command files.
-
-* Menu:
-
-* Define:: User-defined commands
-* Hooks:: User-defined command hooks
-* Command Files:: Command files
-* Output:: Commands for controlled output
-
-
-File: gdb.info, Node: Define, Next: Hooks, Up: Sequences
-
-User-defined commands
-=====================
-
- A "user-defined command" is a sequence of GDB commands to which you
-assign a new name as a command. This is done with the `define' command.
-
-`define COMMANDNAME'
- Define a command named COMMANDNAME. If there is already a command
- by that name, you are asked to confirm that you want to redefine
- it.
-
- The definition of the command is made up of other GDB command
- lines, which are given following the `define' command. The end of
- these commands is marked by a line containing `end'.
-
-`document COMMANDNAME'
- Give documentation to the user-defined command COMMANDNAME. The
- command COMMANDNAME must already be defined. This command reads
- lines of documentation just as `define' reads the lines of the
- command definition, ending with `end'. After the `document'
- command is finished, `help' on command COMMANDNAME will print the
- documentation you have specified.
-
- You may use the `document' command again to change the
- documentation of a command. Redefining the command with `define'
- does not change the documentation.
-
-`help user-defined'
- List all user-defined commands, with the first line of the
- documentation (if any) for each.
-
-`show user'
-`show user COMMANDNAME'
- Display the GDB commands used to define COMMANDNAME (but not its
- documentation). If no COMMANDNAME is given, display the
- definitions for all user-defined commands.
-
- User-defined commands do not take arguments. When they are
-executed, the commands of the definition are not printed. An error in
-any command stops execution of the user-defined command.
-
- Commands that would ask for confirmation if used interactively
-proceed without asking when used inside a user-defined command. Many
-GDB commands that normally print messages to say what they are doing
-omit the messages when used in a user-defined command.
-
-
-File: gdb.info, Node: Hooks, Next: Command Files, Prev: Define, Up: Sequences
-
-User-defined command hooks
-==========================
-
- You may define *hooks*, which are a special kind of user-defined
-command. Whenever you run the command `foo', if the user-defined
-command `hook-foo' exists, it is executed (with no arguments) before
-that command.
-
- In addition, a pseudo-command, `stop' exists. Defining
-(`hook-stop') makes the associated commands execute every time
-execution stops in your program: before breakpoint commands are run,
-displays are printed, or the stack frame is printed.
-
- For example, to ignore `SIGALRM' signals while single-stepping, but
-treat them normally during normal execution, you could define:
-
- define hook-stop
- handle SIGALRM nopass
- end
-
- define hook-run
- handle SIGALRM pass
- end
-
- define hook-continue
- handle SIGLARM pass
- end
-
- You can define a hook for any single-word command in GDB, but not
-for command aliases; you should define a hook for the basic command
-name, e.g. `backtrace' rather than `bt'. If an error occurs during
-the execution of your hook, execution of GDB commands stops and GDB
-issues a prompt (before the command that you actually typed had a
-chance to run).
-
- If you try to define a hook which does not match any known command,
-you will get a warning from the `define' command.
-
-
-File: gdb.info, Node: Command Files, Next: Output, Prev: Hooks, Up: Sequences
-
-Command files
-=============
-
- A command file for GDB is a file of lines that are GDB commands.
-Comments (lines starting with `#') may also be included. An empty line
-in a command file does nothing; it does not mean to repeat the last
-command, as it would from the terminal.
-
- When you start GDB, it automatically executes commands from its
-"init files". These are files named `.gdbinit'. GDB reads the init
-file (if any) in your home directory and then the init file (if any) in
-the current working directory. (The init files are not executed if you
-use the `-nx' option; *note Choosing modes: Mode Options..)
-
- On some configurations of GDB, the init file is known by a different
-name (these are typically environments where a specialized form of GDB
-may need to coexist with other forms, hence a different name for the
-specialized version's init file). These are the environments with
-special init file names:
-
- * VxWorks (Wind River Systems real-time OS): `.vxgdbinit'
-
- * OS68K (Enea Data Systems real-time OS): `.os68gdbinit'
-
- * ES-1800 (Ericsson Telecom AB M68000 emulator): `.esgdbinit'
-
- You can also request the execution of a command file with the
-`source' command:
-
-`source FILENAME'
- Execute the command file FILENAME.
-
- The lines in a command file are executed sequentially. They are not
-printed as they are executed. An error in any command terminates
-execution of the command file.
-
- Commands that would ask for confirmation if used interactively
-proceed without asking when used in a command file. Many GDB commands
-that normally print messages to say what they are doing omit the
-messages when called from command files.
-
-
-File: gdb.info, Node: Output, Prev: Command Files, Up: Sequences
-
-Commands for controlled output
-==============================
-
- During the execution of a command file or a user-defined command,
-normal GDB output is suppressed; the only output that appears is what is
-explicitly printed by the commands in the definition. This section
-describes three commands useful for generating exactly the output you
-want.
-
-`echo TEXT'
- Print TEXT. Nonprinting characters can be included in TEXT using
- C escape sequences, such as `\n' to print a newline. *No newline
- will be printed unless you specify one.* In addition to the
- standard C escape sequences, a backslash followed by a space
- stands for a space. This is useful for displaying a string with
- spaces at the beginning or the end, since leading and trailing
- spaces are otherwise trimmed from all arguments. To print ` and
- foo = ', use the command `echo \ and foo = \ '.
-
- A backslash at the end of TEXT can be used, as in C, to continue
- the command onto subsequent lines. For example,
-
- echo This is some text\n\
- which is continued\n\
- onto several lines.\n
-
- produces the same output as
-
- echo This is some text\n
- echo which is continued\n
- echo onto several lines.\n
-
-`output EXPRESSION'
- Print the value of EXPRESSION and nothing but that value: no
- newlines, no `$NN = '. The value is not entered in the value
- history either. *Note Expressions: Expressions, for more
- information on expressions.
-
-`output/FMT EXPRESSION'
- Print the value of EXPRESSION in format FMT. You can use the same
- formats as for `print'. *Note Output formats: Output Formats, for
- more information.
-
-`printf STRING, EXPRESSIONS...'
- Print the values of the EXPRESSIONS under the control of STRING.
- The EXPRESSIONS are separated by commas and may be either numbers
- or pointers. Their values are printed as specified by STRING,
- exactly as if your program were to execute the C subroutine
-
- printf (STRING, EXPRESSIONS...);
-
- For example, you can print two values in hex like this:
-
- printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo
-
- The only backslash-escape sequences that you can use in the format
- string are the simple ones that consist of backslash followed by a
- letter.
-
-
-File: gdb.info, Node: Emacs, Next: GDB Bugs, Prev: Sequences, Up: Top
-
-Using GDB under GNU Emacs
-*************************
-
- A special interface allows you to use GNU Emacs to view (and edit)
-the source files for the program you are debugging with GDB.
-
- To use this interface, use the command `M-x gdb' in Emacs. Give the
-executable file you want to debug as an argument. This command starts
-GDB as a subprocess of Emacs, with input and output through a newly
-created Emacs buffer.
-
- Using GDB under Emacs is just like using GDB normally except for two
-things:
-
- * All "terminal" input and output goes through the Emacs buffer.
-
- This applies both to GDB commands and their output, and to the input
-and output done by the program you are debugging.
-
- This is useful because it means that you can copy the text of
-previous commands and input them again; you can even use parts of the
-output in this way.
-
- All the facilities of Emacs' Shell mode are available for interacting
-with your program. In particular, you can send signals the usual
-way--for example, `C-c C-c' for an interrupt, `C-c C-z' for a stop.
-
- * GDB displays source code through Emacs.
-
- Each time GDB displays a stack frame, Emacs automatically finds the
-source file for that frame and puts an arrow (`=>') at the left margin
-of the current line. Emacs uses a separate buffer for source display,
-and splits the screen to show both your GDB session and the source.
-
- Explicit GDB `list' or search commands still produce output as
-usual, but you probably will have no reason to use them.
-
- *Warning:* If the directory where your program resides is not your
- current directory, it can be easy to confuse Emacs about the
- location of the source files, in which case the auxiliary display
- buffer will not appear to show your source. GDB can find programs
- by searching your environment's `PATH' variable, so the GDB input
- and output session will proceed normally; but Emacs does not get
- enough information back from GDB to locate the source files in
- this situation. To avoid this problem, either start GDB mode from
- the directory where your program resides, or specify a full path
- name when prompted for the `M-x gdb' argument.
-
- A similar confusion can result if you use the GDB `file' command to
- switch to debugging a program in some other location, from an
- existing GDB buffer in Emacs.
-
- By default, `M-x gdb' calls the program called `gdb'. If you need
-to call GDB by a different name (for example, if you keep several
-configurations around, with different names) you can set the Emacs
-variable `gdb-command-name'; for example,
-
- (setq gdb-command-name "mygdb")
-
-(preceded by `ESC ESC', or typed in the `*scratch*' buffer, or in your
-`.emacs' file) will make Emacs call the program named "`mygdb'" instead.
-
- In the GDB I/O buffer, you can use these special Emacs commands in
-addition to the standard Shell mode commands:
-
-`C-h m'
- Describe the features of Emacs' GDB Mode.
-
-`M-s'
- Execute to another source line, like the GDB `step' command; also
- update the display window to show the current file and location.
-
-`M-n'
- Execute to next source line in this function, skipping all function
- calls, like the GDB `next' command. Then update the display window
- to show the current file and location.
-
-`M-i'
- Execute one instruction, like the GDB `stepi' command; update
- display window accordingly.
-
-`M-x gdb-nexti'
- Execute to next instruction, using the GDB `nexti' command; update
- display window accordingly.
-
-`C-c C-f'
- Execute until exit from the selected stack frame, like the GDB
- `finish' command.
-
-`M-c'
- Continue execution of your program, like the GDB `continue'
- command.
-
- *Warning:* In Emacs v19, this command is `C-c C-p'.
-
-`M-u'
- Go up the number of frames indicated by the numeric argument
- (*note Numeric Arguments: (emacs)Arguments.), like the GDB `up'
- command.
-
- *Warning:* In Emacs v19, this command is `C-c C-u'.
-
-`M-d'
- Go down the number of frames indicated by the numeric argument,
- like the GDB `down' command.
-
- *Warning:* In Emacs v19, this command is `C-c C-d'.
-
-`C-x &'
- Read the number where the cursor is positioned, and insert it at
- the end of the GDB I/O buffer. For example, if you wish to
- disassemble code around an address that was displayed earlier,
- type `disassemble'; then move the cursor to the address display,
- and pick up the argument for `disassemble' by typing `C-x &'.
-
- You can customize this further by defining elements of the list
- `gdb-print-command'; once it is defined, you can format or
- otherwise process numbers picked up by `C-x &' before they are
- inserted. A numeric argument to `C-x &' will both indicate that
- you wish special formatting, and act as an index to pick an
- element of the list. If the list element is a string, the number
- to be inserted is formatted using the Emacs function `format';
- otherwise the number is passed as an argument to the corresponding
- list element.
-
- In any source file, the Emacs command `C-x SPC' (`gdb-break') tells
-GDB to set a breakpoint on the source line point is on.
-
- If you accidentally delete the source-display buffer, an easy way to
-get it back is to type the command `f' in the GDB buffer, to request a
-frame display; when you run under Emacs, this will recreate the source
-buffer if necessary to show you the context of the current frame.
-
- The source files displayed in Emacs are in ordinary Emacs buffers
-which are visiting the source files in the usual way. You can edit the
-files with these buffers if you wish; but keep in mind that GDB
-communicates with Emacs in terms of line numbers. If you add or delete
-lines from the text, the line numbers that GDB knows will cease to
-correspond properly with the code.
-
-
-File: gdb.info, Node: GDB Bugs, Next: Command Line Editing, Prev: Emacs, Up: Top
-
-Reporting Bugs in GDB
-*********************
-
- Your bug reports play an essential role in making GDB reliable.
-
- Reporting a bug may help you by bringing a solution to your problem,
-or it may not. But in any case the principal function of a bug report
-is to help the entire community by making the next version of GDB work
-better. Bug reports are your contribution to the maintenance of GDB.
-
- In order for a bug report to serve its purpose, you must include the
-information that enables us to fix the bug.
-
-* Menu:
-
-* Bug Criteria:: Have you found a bug?
-* Bug Reporting:: How to report bugs
-
-
-File: gdb.info, Node: Bug Criteria, Next: Bug Reporting, Up: GDB Bugs
-
-Have you found a bug?
-=====================
-
- If you are not sure whether you have found a bug, here are some
-guidelines:
-
- * If the debugger gets a fatal signal, for any input whatever, that
- is a GDB bug. Reliable debuggers never crash.
-
- * If GDB produces an error message for valid input, that is a bug.
-
- * If GDB does not produce an error message for invalid input, that
- is a bug. However, you should note that your idea of "invalid
- input" might be our idea of "an extension" or "support for
- traditional practice".
-
- * If you are an experienced user of debugging tools, your suggestions
- for improvement of GDB are welcome in any case.
-
diff --git a/gnu/usr.bin/gdb/doc/gdb.info-7 b/gnu/usr.bin/gdb/doc/gdb.info-7
deleted file mode 100644
index 963527e..0000000
--- a/gnu/usr.bin/gdb/doc/gdb.info-7
+++ /dev/null
@@ -1,1233 +0,0 @@
-This is Info file ./gdb.info, produced by Makeinfo-1.52 from the input
-file gdb.texinfo.
-
-START-INFO-DIR-ENTRY
-* Gdb:: The GNU debugger.
-END-INFO-DIR-ENTRY
- This file documents the GNU debugger GDB.
-
- This is Edition 4.09, August 1993, of `Debugging with GDB: the GNU
-Source-Level Debugger' for GDB Version 4.11.
-
- Copyright (C) 1988, '89, '90, '91, '92, '93 Free Software
-Foundation, Inc.
-
- Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of
-this manual under the conditions for verbatim copying, provided also
-that the entire resulting derived work is distributed under the terms
-of a permission notice identical to this one.
-
- Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions.
-
-
-File: gdb.info, Node: Bug Reporting, Prev: Bug Criteria, Up: GDB Bugs
-
-How to report bugs
-==================
-
- A number of companies and individuals offer support for GNU products.
-If you obtained GDB from a support organization, we recommend you
-contact that organization first.
-
- You can find contact information for many support companies and
-individuals in the file `etc/SERVICE' in the GNU Emacs distribution.
-
- In any event, we also recommend that you send bug reports for GDB to
-one of these addresses:
-
- bug-gdb@prep.ai.mit.edu
- {ucbvax|mit-eddie|uunet}!prep.ai.mit.edu!bug-gdb
-
- *Do not send bug reports to `info-gdb', or to `help-gdb', or to any
-newsgroups.* Most users of GDB do not want to receive bug reports.
-Those that do, have arranged to receive `bug-gdb'.
-
- The mailing list `bug-gdb' has a newsgroup `gnu.gdb.bug' which
-serves as a repeater. The mailing list and the newsgroup carry exactly
-the same messages. Often people think of posting bug reports to the
-newsgroup instead of mailing them. This appears to work, but it has one
-problem which can be crucial: a newsgroup posting often lacks a mail
-path back to the sender. Thus, if we need to ask for more information,
-we may be unable to reach you. For this reason, it is better to send
-bug reports to the mailing list.
-
- As a last resort, send bug reports on paper to:
-
- GNU Debugger Bugs
- Free Software Foundation
- 545 Tech Square
- Cambridge, MA 02139
-
- The fundamental principle of reporting bugs usefully is this:
-*report all the facts*. If you are not sure whether to state a fact or
-leave it out, state it!
-
- Often people omit facts because they think they know what causes the
-problem and assume that some details do not matter. Thus, you might
-assume that the name of the variable you use in an example does not
-matter. Well, probably it does not, but one cannot be sure. Perhaps
-the bug is a stray memory reference which happens to fetch from the
-location where that name is stored in memory; perhaps, if the name were
-different, the contents of that location would fool the debugger into
-doing the right thing despite the bug. Play it safe and give a
-specific, complete example. That is the easiest thing for you to do,
-and the most helpful.
-
- Keep in mind that the purpose of a bug report is to enable us to fix
-the bug if it is new to us. It is not as important as what happens if
-the bug is already known. Therefore, always write your bug reports on
-the assumption that the bug has not been reported previously.
-
- Sometimes people give a few sketchy facts and ask, "Does this ring a
-bell?" Those bug reports are useless, and we urge everyone to *refuse
-to respond to them* except to chide the sender to report bugs properly.
-
- To enable us to fix the bug, you should include all these things:
-
- * The version of GDB. GDB announces it if you start with no
- arguments; you can also print it at any time using `show version'.
-
- Without this, we will not know whether there is any point in
- looking for the bug in the current version of GDB.
-
- * The type of machine you are using, and the operating system name
- and version number.
-
- * What compiler (and its version) was used to compile GDB--e.g.
- "gcc-2.0".
-
- * What compiler (and its version) was used to compile the program you
- are debugging--e.g. "gcc-2.0".
-
- * The command arguments you gave the compiler to compile your
- example and observe the bug. For example, did you use `-O'? To
- guarantee you will not omit something important, list them all. A
- copy of the Makefile (or the output from make) is sufficient.
-
- If we were to try to guess the arguments, we would probably guess
- wrong and then we might not encounter the bug.
-
- * A complete input script, and all necessary source files, that will
- reproduce the bug.
-
- * A description of what behavior you observe that you believe is
- incorrect. For example, "It gets a fatal signal."
-
- Of course, if the bug is that GDB gets a fatal signal, then we will
- certainly notice it. But if the bug is incorrect output, we might
- not notice unless it is glaringly wrong. We are human, after all.
- You might as well not give us a chance to make a mistake.
-
- Even if the problem you experience is a fatal signal, you should
- still say so explicitly. Suppose something strange is going on,
- such as, your copy of GDB is out of synch, or you have encountered
- a bug in the C library on your system. (This has happened!) Your
- copy might crash and ours would not. If you told us to expect a
- crash, then when ours fails to crash, we would know that the bug
- was not happening for us. If you had not told us to expect a
- crash, then we would not be able to draw any conclusion from our
- observations.
-
- * If you wish to suggest changes to the GDB source, send us context
- diffs. If you even discuss something in the GDB source, refer to
- it by context, not by line number.
-
- The line numbers in our development sources will not match those
- in your sources. Your line numbers would convey no useful
- information to us.
-
- Here are some things that are not necessary:
-
- * A description of the envelope of the bug.
-
- Often people who encounter a bug spend a lot of time investigating
- which changes to the input file will make the bug go away and which
- changes will not affect it.
-
- This is often time consuming and not very useful, because the way
- we will find the bug is by running a single example under the
- debugger with breakpoints, not by pure deduction from a series of
- examples. We recommend that you save your time for something else.
-
- Of course, if you can find a simpler example to report *instead*
- of the original one, that is a convenience for us. Errors in the
- output will be easier to spot, running under the debugger will take
- less time, etc.
-
- However, simplification is not vital; if you do not want to do
- this, report the bug anyway and send us the entire test case you
- used.
-
- * A patch for the bug.
-
- A patch for the bug does help us if it is a good one. But do not
- omit the necessary information, such as the test case, on the
- assumption that a patch is all we need. We might see problems
- with your patch and decide to fix the problem another way, or we
- might not understand it at all.
-
- Sometimes with a program as complicated as GDB it is very hard to
- construct an example that will make the program follow a certain
- path through the code. If you do not send us the example, we will
- not be able to construct one, so we will not be able to verify
- that the bug is fixed.
-
- And if we cannot understand what bug you are trying to fix, or why
- your patch should be an improvement, we will not install it. A
- test case will help us to understand.
-
- * A guess about what the bug is or what it depends on.
-
- Such guesses are usually wrong. Even we cannot guess right about
- such things without first using the debugger to find the facts.
-
-
-File: gdb.info, Node: Command Line Editing, Next: Using History Interactively, Prev: GDB Bugs, Up: Top
-
-Command Line Editing
-********************
-
- This text describes GNU's command line editing interface.
-
-* Menu:
-
-* Introduction and Notation:: Notation used in this text.
-* Readline Interaction:: The minimum set of commands for editing a line.
-* Readline Init File:: Customizing Readline from a user's view.
-
-
-File: gdb.info, Node: Introduction and Notation, Next: Readline Interaction, Up: Command Line Editing
-
-Introduction to Line Editing
-============================
-
- The following paragraphs describe the notation we use to represent
-keystrokes.
-
- The text C-k is read as `Control-K' and describes the character
-produced when the Control key is depressed and the k key is struck.
-
- The text M-k is read as `Meta-K' and describes the character
-produced when the meta key (if you have one) is depressed, and the k
-key is struck. If you do not have a meta key, the identical keystroke
-can be generated by typing ESC first, and then typing k. Either
-process is known as "metafying" the k key.
-
- The text M-C-k is read as `Meta-Control-k' and describes the
-character produced by "metafying" C-k.
-
- In addition, several keys have their own names. Specifically, DEL,
-ESC, LFD, SPC, RET, and TAB all stand for themselves when seen in this
-text, or in an init file (*note Readline Init File::., for more info).
-
-
-File: gdb.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing
-
-Readline Interaction
-====================
-
- Often during an interactive session you type in a long line of text,
-only to notice that the first word on the line is misspelled. The
-Readline library gives you a set of commands for manipulating the text
-as you type it in, allowing you to just fix your typo, and not forcing
-you to retype the majority of the line. Using these editing commands,
-you move the cursor to the place that needs correction, and delete or
-insert the text of the corrections. Then, when you are satisfied with
-the line, you simply press RETURN. You do not have to be at the end of
-the line to press RETURN; the entire line is accepted regardless of the
-location of the cursor within the line.
-
-* Menu:
-
-* Readline Bare Essentials:: The least you need to know about Readline.
-* Readline Movement Commands:: Moving about the input line.
-* Readline Killing Commands:: How to delete text, and how to get it back!
-* Readline Arguments:: Giving numeric arguments to commands.
-
-
-File: gdb.info, Node: Readline Bare Essentials, Next: Readline Movement Commands, Up: Readline Interaction
-
-Readline Bare Essentials
-------------------------
-
- In order to enter characters into the line, simply type them. The
-typed character appears where the cursor was, and then the cursor moves
-one space to the right. If you mistype a character, you can use DEL to
-back up, and delete the mistyped character.
-
- Sometimes you may miss typing a character that you wanted to type,
-and not notice your error until you have typed several other
-characters. In that case, you can type C-b to move the cursor to the
-left, and then correct your mistake. Aftwerwards, you can move the
-cursor to the right with C-f.
-
- When you add text in the middle of a line, you will notice that
-characters to the right of the cursor get `pushed over' to make room
-for the text that you have inserted. Likewise, when you delete text
-behind the cursor, characters to the right of the cursor get `pulled
-back' to fill in the blank space created by the removal of the text. A
-list of the basic bare essentials for editing the text of an input line
-follows.
-
-C-b
- Move back one character.
-
-C-f
- Move forward one character.
-
-DEL
- Delete the character to the left of the cursor.
-
-C-d
- Delete the character underneath the cursor.
-
-Printing characters
- Insert itself into the line at the cursor.
-
-C-_
- Undo the last thing that you did. You can undo all the way back
- to an empty line.
-
-
-File: gdb.info, Node: Readline Movement Commands, Next: Readline Killing Commands, Prev: Readline Bare Essentials, Up: Readline Interaction
-
-Readline Movement Commands
---------------------------
-
- The above table describes the most basic possible keystrokes that
-you need in order to do editing of the input line. For your
-convenience, many other commands have been added in addition to C-b,
-C-f, C-d, and DEL. Here are some commands for moving more rapidly
-about the line.
-
-C-a
- Move to the start of the line.
-
-C-e
- Move to the end of the line.
-
-M-f
- Move forward a word.
-
-M-b
- Move backward a word.
-
-C-l
- Clear the screen, reprinting the current line at the top.
-
- Notice how C-f moves forward a character, while M-f moves forward a
-word. It is a loose convention that control keystrokes operate on
-characters while meta keystrokes operate on words.
-
-
-File: gdb.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction
-
-Readline Killing Commands
--------------------------
-
- "Killing" text means to delete the text from the line, but to save
-it away for later use, usually by "yanking" it back into the line. If
-the description for a command says that it `kills' text, then you can
-be sure that you can get the text back in a different (or the same)
-place later.
-
- Here is the list of commands for killing text.
-
-C-k
- Kill the text from the current cursor position to the end of the
- line.
-
-M-d
- Kill from the cursor to the end of the current word, or if between
- words, to the end of the next word.
-
-M-DEL
- Kill from the cursor to the start of the previous word, or if
- between words, to the start of the previous word.
-
-C-w
- Kill from the cursor to the previous whitespace. This is
- different than M-DEL because the word boundaries differ.
-
- And, here is how to "yank" the text back into the line. Yanking is
-
-C-y
- Yank the most recently killed text back into the buffer at the
- cursor.
-
-M-y
- Rotate the kill-ring, and yank the new top. You can only do this
- if the prior command is C-y or M-y.
-
- When you use a kill command, the text is saved in a "kill-ring".
-Any number of consecutive kills save all of the killed text together, so
-that when you yank it back, you get it in one clean sweep. The kill
-ring is not line specific; the text that you killed on a previously
-typed line is available to be yanked back later, when you are typing
-another line.
-
-
-File: gdb.info, Node: Readline Arguments, Prev: Readline Killing Commands, Up: Readline Interaction
-
-Readline Arguments
-------------------
-
- You can pass numeric arguments to Readline commands. Sometimes the
-argument acts as a repeat count, other times it is the sign of the
-argument that is significant. If you pass a negative argument to a
-command which normally acts in a forward direction, that command will
-act in a backward direction. For example, to kill text back to the
-start of the line, you might type M- C-k.
-
- The general way to pass numeric arguments to a command is to type
-meta digits before the command. If the first `digit' you type is a
-minus sign (-), then the sign of the argument will be negative. Once
-you have typed one meta digit to get the argument started, you can type
-the remainder of the digits, and then the command. For example, to give
-the C-d command an argument of 10, you could type M-1 0 C-d.
-
-
-File: gdb.info, Node: Readline Init File, Prev: Readline Interaction, Up: Command Line Editing
-
-Readline Init File
-==================
-
- Although the Readline library comes with a set of Emacs-like
-keybindings, it is possible that you would like to use a different set
-of keybindings. You can customize programs that use Readline by putting
-commands in an "init" file in your home directory. The name of this
-file is `~/.inputrc'.
-
- When a program which uses the Readline library starts up, the
-`~/.inputrc' file is read, and the keybindings are set.
-
- In addition, the C-x C-r command re-reads this init file, thus
-incorporating any changes that you might have made to it.
-
-* Menu:
-
-* Readline Init Syntax:: Syntax for the commands in `~/.inputrc'.
-* Readline Vi Mode:: Switching to `vi' mode in Readline.
-
-
-File: gdb.info, Node: Readline Init Syntax, Next: Readline Vi Mode, Up: Readline Init File
-
-Readline Init Syntax
---------------------
-
- There are only four constructs allowed in the `~/.inputrc' file:
-
-Variable Settings
- You can change the state of a few variables in Readline. You do
- this by using the `set' command within the init file. Here is how
- you would specify that you wish to use Vi line editing commands:
-
- set editing-mode vi
-
- Right now, there are only a few variables which can be set; so few
- in fact, that we just iterate them here:
-
- `editing-mode'
- The `editing-mode' variable controls which editing mode you
- are using. By default, GNU Readline starts up in Emacs
- editing mode, where the keystrokes are most similar to Emacs.
- This variable can either be set to `emacs' or `vi'.
-
- `horizontal-scroll-mode'
- This variable can either be set to `On' or `Off'. Setting it
- to `On' means that the text of the lines that you edit will
- scroll horizontally on a single screen line when they are
- larger than the width of the screen, instead of wrapping onto
- a new screen line. By default, this variable is set to `Off'.
-
- `mark-modified-lines'
- This variable when set to `On', says to display an asterisk
- (`*') at the starts of history lines which have been modified.
- This variable is off by default.
-
- `prefer-visible-bell'
- If this variable is set to `On' it means to use a visible
- bell if one is available, rather than simply ringing the
- terminal bell. By default, the value is `Off'.
-
-Key Bindings
- The syntax for controlling keybindings in the `~/.inputrc' file is
- simple. First you have to know the name of the command that you
- want to change. The following pages contain tables of the command
- name, the default keybinding, and a short description of what the
- command does.
-
- Once you know the name of the command, simply place the name of
- the key you wish to bind the command to, a colon, and then the
- name of the command on a line in the `~/.inputrc' file. The name
- of the key can be expressed in different ways, depending on which
- is most comfortable for you.
-
- KEYNAME: FUNCTION-NAME or MACRO
- KEYNAME is the name of a key spelled out in English. For
- example:
- Control-u: universal-argument
- Meta-Rubout: backward-kill-word
- Control-o: ">&output"
-
- In the above example, C-u is bound to the function
- `universal-argument', and C-o is bound to run the macro
- expressed on the right hand side (that is, to insert the text
- `>&output' into the line).
-
- "KEYSEQ": FUNCTION-NAME or MACRO
- KEYSEQ differs from KEYNAME above in that strings denoting an
- entire key sequence can be specified. Simply place the key
- sequence in double quotes. GNU Emacs style key escapes can
- be used, as in the following example:
-
- "\C-u": universal-argument
- "\C-x\C-r": re-read-init-file
- "\e[11~": "Function Key 1"
-
- In the above example, C-u is bound to the function
- `universal-argument' (just as it was in the first example),
- C-x C-r is bound to the function `re-read-init-file', and ESC
- [ 1 1 ~ is bound to insert the text `Function Key 1'.
-
-* Menu:
-
-* Commands For Moving:: Moving about the line.
-* Commands For History:: Getting at previous lines.
-* Commands For Text:: Commands for changing text.
-* Commands For Killing:: Commands for killing and yanking.
-* Numeric Arguments:: Specifying numeric arguments, repeat counts.
-* Commands For Completion:: Getting Readline to do the typing for you.
-* Miscellaneous Commands:: Other miscillaneous commands.
-
-
-File: gdb.info, Node: Commands For Moving, Next: Commands For History, Up: Readline Init Syntax
-
-Commands For Moving
--------------------
-
-`beginning-of-line (C-a)'
- Move to the start of the current line.
-
-`end-of-line (C-e)'
- Move to the end of the line.
-
-`forward-char (C-f)'
- Move forward a character.
-
-`backward-char (C-b)'
- Move back a character.
-
-`forward-word (M-f)'
- Move forward to the end of the next word.
-
-`backward-word (M-b)'
- Move back to the start of this, or the previous, word.
-
-`clear-screen (C-l)'
- Clear the screen leaving the current line at the top of the screen.
-
-
-File: gdb.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Readline Init Syntax
-
-Commands For Manipulating The History
--------------------------------------
-
-`accept-line (Newline, Return)'
- Accept the line regardless of where the cursor is. If this line is
- non-empty, add it to the history list. If this line was a history
- line, then restore the history line to its original state.
-
-`previous-history (C-p)'
- Move `up' through the history list.
-
-`next-history (C-n)'
- Move `down' through the history list.
-
-`beginning-of-history (M-<)'
- Move to the first line in the history.
-
-`end-of-history (M->)'
- Move to the end of the input history, i.e., the line you are
- entering!
-
-`reverse-search-history (C-r)'
- Search backward starting at the current line and moving `up'
- through the history as necessary. This is an incremental search.
-
-`forward-search-history (C-s)'
- Search forward starting at the current line and moving `down'
- through the the history as neccessary.
-
-
-File: gdb.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Readline Init Syntax
-
-Commands For Changing Text
---------------------------
-
-`delete-char (C-d)'
- Delete the character under the cursor. If the cursor is at the
- beginning of the line, and there are no characters in the line, and
- the last character typed was not C-d, then return EOF.
-
-`backward-delete-char (Rubout)'
- Delete the character behind the cursor. A numeric arg says to kill
- the characters instead of deleting them.
-
-`quoted-insert (C-q, C-v)'
- Add the next character that you type to the line verbatim. This is
- how to insert things like C-q for example.
-
-`tab-insert (M-TAB)'
- Insert a tab character.
-
-`self-insert (a, b, A, 1, !, ...)'
- Insert yourself.
-
-`transpose-chars (C-t)'
- Drag the character before point forward over the character at
- point. Point moves forward as well. If point is at the end of
- the line, then transpose the two characters before point.
- Negative args don't work.
-
-`transpose-words (M-t)'
- Drag the word behind the cursor past the word in front of the
- cursor moving the cursor over that word as well.
-
-`upcase-word (M-u)'
- Uppercase all letters in the current (or following) word. With a
- negative argument, do the previous word, but do not move point.
-
-`downcase-word (M-l)'
- Lowercase all letters in the current (or following) word. With a
- negative argument, do the previous word, but do not move point.
-
-`capitalize-word (M-c)'
- Uppercase the first letter in the current (or following) word.
- With a negative argument, do the previous word, but do not move
- point.
-
-
-File: gdb.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Readline Init Syntax
-
-Killing And Yanking
--------------------
-
-`kill-line (C-k)'
- Kill the text from the current cursor position to the end of the
- line.
-
-`backward-kill-line ()'
- Kill backward to the beginning of the line. This is normally
- unbound.
-
-`kill-word (M-d)'
- Kill from the cursor to the end of the current word, or if between
- words, to the end of the next word.
-
-`backward-kill-word (M-DEL)'
- Kill the word behind the cursor.
-
-`unix-line-discard (C-u)'
- Do what C-u used to do in Unix line input. We save the killed
- text on the kill-ring, though.
-
-`unix-word-rubout (C-w)'
- Do what C-w used to do in Unix line input. The killed text is
- saved on the kill-ring. This is different than backward-kill-word
- because the word boundaries differ.
-
-`yank (C-y)'
- Yank the top of the kill ring into the buffer at point.
-
-`yank-pop (M-y)'
- Rotate the kill-ring, and yank the new top. You can only do this
- if the prior command is yank or yank-pop.
-
-
-File: gdb.info, Node: Numeric Arguments, Next: Commands For Completion, Prev: Commands For Killing, Up: Readline Init Syntax
-
-Specifying Numeric Arguments
-----------------------------
-
-`digit-argument (M-0, M-1, ... M--)'
- Add this digit to the argument already accumulating, or start a new
- argument. M- starts a negative argument.
-
-`universal-argument ()'
- Do what C-u does in emacs. By default, this is not bound.
-
-
-File: gdb.info, Node: Commands For Completion, Next: Miscellaneous Commands, Prev: Numeric Arguments, Up: Readline Init Syntax
-
-Letting Readline Type For You
------------------------------
-
-`complete (TAB)'
- Attempt to do completion on the text before point. This is
- implementation defined. Generally, if you are typing a filename
- argument, you can do filename completion; if you are typing a
- command, you can do command completion, if you are typing in a
- symbol to GDB, you can do symbol name completion, if you are
- typing in a variable to Bash, you can do variable name
- completion...
-
-`possible-completions (M-?)'
- List the possible completions of the text before point.
-
-
-File: gdb.info, Node: Miscellaneous Commands, Prev: Commands For Completion, Up: Readline Init Syntax
-
-Some Miscellaneous Commands
----------------------------
-
-`re-read-init-file (C-x C-r)'
- Read in the contents of your `~/.inputrc' file, and incorporate
- any bindings found there.
-
-`abort (C-g)'
- Stop running the current editing command.
-
-`prefix-meta (ESC)'
- Make the next character that you type be metafied. This is for
- people without a meta key. Typing ESC f is equivalent to typing
- M-f.
-
-`undo (C-_)'
- Incremental undo, separately remembered for each line.
-
-`revert-line (M-r)'
- Undo all changes made to this line. This is like typing the `undo'
- command enough times to get back to the beginning.
-
-
-File: gdb.info, Node: Readline Vi Mode, Prev: Readline Init Syntax, Up: Readline Init File
-
-Readline Vi Mode
-----------------
-
- While the Readline library does not have a full set of Vi editing
-functions, it does contain enough to allow simple editing of the line.
-
- In order to switch interactively between Emacs and Vi editing modes,
-use the command M-C-j (toggle-editing-mode).
-
- When you enter a line in Vi mode, you are already placed in
-`insertion' mode, as if you had typed an `i'. Pressing ESC switches
-you into `edit' mode, where you can edit the text of the line with the
-standard Vi movement keys, move to previous history lines with `k', and
-following lines with `j', and so forth.
-
-
-File: gdb.info, Node: Using History Interactively, Next: Renamed Commands, Prev: Command Line Editing, Up: Top
-
-Using History Interactively
-***************************
-
- This chapter describes how to use the GNU History Library
-interactively, from a user's standpoint.
-
-* Menu:
-
-* History Interaction:: What it feels like using History as a user.
-
-
-File: gdb.info, Node: History Interaction, Up: Using History Interactively
-
-History Interaction
-===================
-
- The History library provides a history expansion feature that is
-similar to the history expansion in Csh. The following text describes
-the sytax that you use to manipulate the history information.
-
- History expansion takes place in two parts. The first is to
-determine which line from the previous history should be used during
-substitution. The second is to select portions of that line for
-inclusion into the current one. The line selected from the previous
-history is called the "event", and the portions of that line that are
-acted upon are called "words". The line is broken into words in the
-same fashion that the Bash shell does, so that several English (or
-Unix) words surrounded by quotes are considered as one word.
-
-* Menu:
-
-* Event Designators:: How to specify which history line to use.
-* Word Designators:: Specifying which words are of interest.
-* Modifiers:: Modifying the results of susbstitution.
-
-
-File: gdb.info, Node: Event Designators, Next: Word Designators, Up: History Interaction
-
-Event Designators
------------------
-
- An event designator is a reference to a command line entry in the
-history list.
-
-`!'
- Start a history subsititution, except when followed by a space,
- tab, or the end of the line... = or (.
-
-`!!'
- Refer to the previous command. This is a synonym for `!-1'.
-
-`!n'
- Refer to command line N.
-
-`!-n'
- Refer to the command line N lines back.
-
-`!string'
- Refer to the most recent command starting with STRING.
-
-`!?string'[`?']
- Refer to the most recent command containing STRING.
-
-
-File: gdb.info, Node: Word Designators, Next: Modifiers, Prev: Event Designators, Up: History Interaction
-
-Word Designators
-----------------
-
- A : separates the event specification from the word designator. It
-can be omitted if the word designator begins with a ^, $, * or %.
-Words are numbered from the beginning of the line, with the first word
-being denoted by a 0 (zero).
-
-`0 (zero)'
- The zero'th word. For many applications, this is the command word.
-
-`n'
- The N'th word.
-
-`^'
- The first argument. that is, word 1.
-
-`$'
- The last argument.
-
-`%'
- The word matched by the most recent `?string?' search.
-
-`x-y'
- A range of words; `-Y' Abbreviates `0-Y'.
-
-`*'
- All of the words, excepting the zero'th. This is a synonym for
- `1-$'. It is not an error to use * if there is just one word in
- the event. The empty string is returned in that case.
-
-
-File: gdb.info, Node: Modifiers, Prev: Word Designators, Up: History Interaction
-
-Modifiers
----------
-
- After the optional word designator, you can add a sequence of one or
-more of the following modifiers, each preceded by a :.
-
-`#'
- The entire command line typed so far. This means the current
- command, not the previous command, so it really isn't a word
- designator, and doesn't belong in this section.
-
-`h'
- Remove a trailing pathname component, leaving only the head.
-
-`r'
- Remove a trailing suffix of the form `.'SUFFIX, leaving the
- basename.
-
-`e'
- Remove all but the suffix.
-
-`t'
- Remove all leading pathname components, leaving the tail.
-
-`p'
- Print the new command but do not execute it.
-
-
-File: gdb.info, Node: Renamed Commands, Next: Formatting Documentation, Prev: Using History Interactively, Up: Top
-
-Renamed Commands
-****************
-
- The following commands were renamed in GDB 4, in order to make the
-command set as a whole more consistent and easier to use and remember:
-
- OLD COMMAND NEW COMMAND
- --------------- -------------------------------
- add-syms add-symbol-file
- delete environment unset environment
- info convenience show convenience
- info copying show copying
- info directories show directories
- info editing show commands
- info history show values
- info targets help target
- info values show values
- info version show version
- info warranty show warranty
- set/show addressprint set/show print address
- set/show array-max set/show print elements
- set/show arrayprint set/show print array
- set/show asm-demangle set/show print asm-demangle
- set/show caution set/show confirm
- set/show demangle set/show print demangle
- set/show history write set/show history save
- set/show prettyprint set/show print pretty
- set/show screen-height set/show height
- set/show screen-width set/show width
- set/show sevenbit-strings set/show print sevenbit-strings
- set/show unionprint set/show print union
- set/show vtblprint set/show print vtbl
-
- unset [No longer an alias for delete]
-
-
-File: gdb.info, Node: Formatting Documentation, Next: Installing GDB, Prev: Renamed Commands, Up: Top
-
-Formatting Documentation
-************************
-
- The GDB 4 release includes an already-formatted reference card, ready
-for printing with PostScript or GhostScript, in the `gdb' subdirectory
-of the main source directory(1). If you can use PostScript or
-GhostScript with your printer, you can print the reference card
-immediately with `refcard.ps'.
-
- The release also includes the source for the reference card. You
-can format it, using TeX, by typing:
-
- make refcard.dvi
-
- The GDB reference card is designed to print in landscape mode on US
-"letter" size paper; that is, on a sheet 11 inches wide by 8.5 inches
-high. You will need to specify this form of printing as an option to
-your DVI output program.
-
- All the documentation for GDB comes as part of the machine-readable
-distribution. The documentation is written in Texinfo format, which is
-a documentation system that uses a single source file to produce both
-on-line information and a printed manual. You can use one of the Info
-formatting commands to create the on-line version of the documentation
-and TeX (or `texi2roff') to typeset the printed version.
-
- GDB includes an already formatted copy of the on-line Info version of
-this manual in the `gdb' subdirectory. The main Info file is
-`gdb-VERSION-NUMBER/gdb/gdb.info', and it refers to subordinate files
-matching `gdb.info*' in the same directory. If necessary, you can
-print out these files, or read them with any editor; but they are
-easier to read using the `info' subsystem in GNU Emacs or the
-standalone `info' program, available as part of the GNU Texinfo
-distribution.
-
- If you want to format these Info files yourself, you need one of the
-Info formatting programs, such as `texinfo-format-buffer' or `makeinfo'.
-
- If you have `makeinfo' installed, and are in the top level GDB
-source directory (`gdb-4.11', in the case of version 4.11), you can
-make the Info file by typing:
-
- cd gdb
- make gdb.info
-
- If you want to typeset and print copies of this manual, you need TeX,
-a program to print its DVI output files, and `texinfo.tex', the Texinfo
-definitions file.
-
- TeX is a typesetting program; it does not print files directly, but
-produces output files called DVI files. To print a typeset document,
-you need a program to print DVI files. If your system has TeX
-installed, chances are it has such a program. The precise command to
-use depends on your system; `lpr -d' is common; another (for PostScript
-devices) is `dvips'. The DVI print command may require a file name
-without any extension or a `.dvi' extension.
-
- TeX also requires a macro definitions file called `texinfo.tex'.
-This file tells TeX how to typeset a document written in Texinfo
-format. On its own, TeX cannot read, much less typeset a Texinfo file.
-`texinfo.tex' is distributed with GDB and is located in the
-`gdb-VERSION-NUMBER/texinfo' directory.
-
- If you have TeX and a DVI printer program installed, you can typeset
-and print this manual. First switch to the the `gdb' subdirectory of
-the main source directory (for example, to `gdb-4.11/gdb') and then
-type:
-
- make gdb.dvi
-
- ---------- Footnotes ----------
-
- (1) In `gdb-4.11/gdb/refcard.ps' of the version 4.11 release.
-
-
-File: gdb.info, Node: Installing GDB, Next: Index, Prev: Formatting Documentation, Up: Top
-
-Installing GDB
-**************
-
- GDB comes with a `configure' script that automates the process of
-preparing GDB for installation; you can then use `make' to build the
-`gdb' program.
-
- The GDB distribution includes all the source code you need for GDB in
-a single directory, whose name is usually composed by appending the
-version number to `gdb'.
-
- For example, the GDB version 4.11 distribution is in the `gdb-4.11'
-directory. That directory contains:
-
-`gdb-4.11/configure (and supporting files)'
- script for configuring GDB and all its supporting libraries.
-
-`gdb-4.11/gdb'
- the source specific to GDB itself
-
-`gdb-4.11/bfd'
- source for the Binary File Descriptor library
-
-`gdb-4.11/include'
- GNU include files
-
-`gdb-4.11/libiberty'
- source for the `-liberty' free software library
-
-`gdb-4.11/opcodes'
- source for the library of opcode tables and disassemblers
-
-`gdb-4.11/readline'
- source for the GNU command-line interface
-
-`gdb-4.11/glob'
- source for the GNU filename pattern-matching subroutine
-
-`gdb-4.11/mmalloc'
- source for the GNU memory-mapped malloc package
-
- The simplest way to configure and build GDB is to run `configure'
-from the `gdb-VERSION-NUMBER' source directory, which in this example
-is the `gdb-4.11' directory.
-
- First switch to the `gdb-VERSION-NUMBER' source directory if you are
-not already in it; then run `configure'. Pass the identifier for the
-platform on which GDB will run as an argument.
-
- For example:
-
- cd gdb-4.11
- ./configure HOST
- make
-
-where HOST is an identifier such as `sun4' or `decstation', that
-identifies the platform where GDB will run. (You can often leave off
-HOST; `configure' tries to guess the correct value by examining your
-system.)
-
- Running `configure HOST' and then running `make' builds the `bfd',
-`readline', `mmalloc', and `libiberty' libraries, then `gdb' itself.
-The configured source files, and the binaries, are left in the
-corresponding source directories.
-
- `configure' is a Bourne-shell (`/bin/sh') script; if your system
-does not recognize this automatically when you run a different shell,
-you may need to run `sh' on it explicitly:
-
- sh configure HOST
-
- If you run `configure' from a directory that contains source
-directories for multiple libraries or programs, such as the `gdb-4.11'
-source directory for version 4.11, `configure' creates configuration
-files for every directory level underneath (unless you tell it not to,
-with the `--norecursion' option).
-
- You can run the `configure' script from any of the subordinate
-directories in the GDB distribution if you only want to configure that
-subdirectory, but be sure to specify a path to it.
-
- For example, with version 4.11, type the following to configure only
-the `bfd' subdirectory:
-
- cd gdb-4.11/bfd
- ../configure HOST
-
- You can install `gdb' anywhere; it has no hardwired paths. However,
-you should make sure that the shell on your path (named by the `SHELL'
-environment variable) is publicly readable. Remember that GDB uses the
-shell to start your program--some systems refuse to let GDB debug child
-processes whose programs are not readable.
-
-* Menu:
-
-* Separate Objdir:: Compiling GDB in another directory
-* Config Names:: Specifying names for hosts and targets
-* configure Options:: Summary of options for configure
-
-
-File: gdb.info, Node: Separate Objdir, Next: Config Names, Up: Installing GDB
-
-Compiling GDB in another directory
-==================================
-
- If you want to run GDB versions for several host or target machines,
-you need a different `gdb' compiled for each combination of host and
-target. `configure' is designed to make this easy by allowing you to
-generate each configuration in a separate subdirectory, rather than in
-the source directory. If your `make' program handles the `VPATH'
-feature (GNU `make' does), running `make' in each of these directories
-builds the `gdb' program specified there.
-
- To build `gdb' in a separate directory, run `configure' with the
-`--srcdir' option to specify where to find the source. (You also need
-to specify a path to find `configure' itself from your working
-directory. If the path to `configure' would be the same as the
-argument to `--srcdir', you can leave out the `--srcdir' option; it
-will be assumed.)
-
- For example, with version 4.11, you can build GDB in a separate
-directory for a Sun 4 like this:
-
- cd gdb-4.11
- mkdir ../gdb-sun4
- cd ../gdb-sun4
- ../gdb-4.11/configure sun4
- make
-
- When `configure' builds a configuration using a remote source
-directory, it creates a tree for the binaries with the same structure
-(and using the same names) as the tree under the source directory. In
-the example, you'd find the Sun 4 library `libiberty.a' in the
-directory `gdb-sun4/libiberty', and GDB itself in `gdb-sun4/gdb'.
-
- One popular reason to build several GDB configurations in separate
-directories is to configure GDB for cross-compiling (where GDB runs on
-one machine--the host--while debugging programs that run on another
-machine--the target). You specify a cross-debugging target by giving
-the `--target=TARGET' option to `configure'.
-
- When you run `make' to build a program or library, you must run it
-in a configured directory--whatever directory you were in when you
-called `configure' (or one of its subdirectories).
-
- The `Makefile' that `configure' generates in each source directory
-also runs recursively. If you type `make' in a source directory such
-as `gdb-4.11' (or in a separate configured directory configured with
-`--srcdir=PATH/gdb-4.11'), you will build all the required libraries,
-and then build GDB.
-
- When you have multiple hosts or targets configured in separate
-directories, you can run `make' on them in parallel (for example, if
-they are NFS-mounted on each of the hosts); they will not interfere
-with each other.
-
-
-File: gdb.info, Node: Config Names, Next: configure Options, Prev: Separate Objdir, Up: Installing GDB
-
-Specifying names for hosts and targets
-======================================
-
- The specifications used for hosts and targets in the `configure'
-script are based on a three-part naming scheme, but some short
-predefined aliases are also supported. The full naming scheme encodes
-three pieces of information in the following pattern:
-
- ARCHITECTURE-VENDOR-OS
-
- For example, you can use the alias `sun4' as a HOST argument, or as
-the value for TARGET in a `--target=TARGET' option. The equivalent
-full name is `sparc-sun-sunos4'.
-
- The `configure' script accompanying GDB does not provide any query
-facility to list all supported host and target names or aliases.
-`configure' calls the Bourne shell script `config.sub' to map
-abbreviations to full names; you can read the script, if you wish, or
-you can use it to test your guesses on abbreviations--for example:
-
- % sh config.sub sun4
- sparc-sun-sunos4.1.1
- % sh config.sub sun3
- m68k-sun-sunos4.1.1
- % sh config.sub decstation
- mips-dec-ultrix4.2
- % sh config.sub hp300bsd
- m68k-hp-bsd
- % sh config.sub i386v
- i386-unknown-sysv
- % sh config.sub i786v
- Invalid configuration `i786v': machine `i786v' not recognized
-
-`config.sub' is also distributed in the GDB source directory
-(`gdb-4.11', for version 4.11).
-
-
-File: gdb.info, Node: configure Options, Prev: Config Names, Up: Installing GDB
-
-`configure' options
-===================
-
- Here is a summary of the `configure' options and arguments that are
-most often useful for building GDB. `configure' also has several other
-options not listed here. *note : (configure.info)What Configure Does,
-for a full explanation of `configure'.
-
- configure [--help]
- [--prefix=DIR]
- [--srcdir=PATH]
- [--norecursion] [--rm]
- [--target=TARGET] HOST
-
-You may introduce options with a single `-' rather than `--' if you
-prefer; but you may abbreviate option names if you use `--'.
-
-`--help'
- Display a quick summary of how to invoke `configure'.
-
-`-prefix=DIR'
- Configure the source to install programs and files under directory
- `DIR'.
-
-`--srcdir=PATH'
- *Warning: using this option requires GNU `make', or another `make'
- that implements the `VPATH' feature.*
- Use this option to make configurations in directories separate
- from the GDB source directories. Among other things, you can use
- this to build (or maintain) several configurations simultaneously,
- in separate directories. `configure' writes configuration
- specific files in the current directory, but arranges for them to
- use the source in the directory PATH. `configure' will create
- directories under the working directory in parallel to the source
- directories below PATH.
-
-`--norecursion'
- Configure only the directory level where `configure' is executed;
- do not propagate configuration to subdirectories.
-
-`--rm'
- *Remove* files otherwise built during configuration.
-
-`--target=TARGET'
- Configure GDB for cross-debugging programs running on the specified
- TARGET. Without this option, GDB is configured to debug programs
- that run on the same machine (HOST) as GDB itself.
-
- There is no convenient way to generate a list of all available
- targets.
-
-`HOST ...'
- Configure GDB to run on the specified HOST.
-
- There is no convenient way to generate a list of all available
- hosts.
-
-`configure' accepts other options, for compatibility with configuring
-other GNU tools recursively; but these are the only options that affect
-GDB or its supporting libraries.
-
diff --git a/gnu/usr.bin/gdb/doc/gdb.info-8 b/gnu/usr.bin/gdb/doc/gdb.info-8
deleted file mode 100644
index 1d259e0..0000000
--- a/gnu/usr.bin/gdb/doc/gdb.info-8
+++ /dev/null
@@ -1,657 +0,0 @@
-This is Info file ./gdb.info, produced by Makeinfo-1.52 from the input
-file gdb.texinfo.
-
-START-INFO-DIR-ENTRY
-* Gdb:: The GNU debugger.
-END-INFO-DIR-ENTRY
- This file documents the GNU debugger GDB.
-
- This is Edition 4.09, August 1993, of `Debugging with GDB: the GNU
-Source-Level Debugger' for GDB Version 4.11.
-
- Copyright (C) 1988, '89, '90, '91, '92, '93 Free Software
-Foundation, Inc.
-
- Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of
-this manual under the conditions for verbatim copying, provided also
-that the entire resulting derived work is distributed under the terms
-of a permission notice identical to this one.
-
- Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions.
-
-
-File: gdb.info, Node: Index, Prev: Installing GDB, Up: Top
-
-Index
-*****
-
-* Menu:
-
-* #: Command Syntax.
-* $bpnum: Set Breaks.
-* $cdir: Source Path.
-* $cwd: Source Path.
-* $_: Convenience Vars.
-* $__: Convenience Vars.
-* .: M2 Scope.
-* .esgdbinit: Command Files.
-* .os68gdbinit: Command Files.
-* .vxgdbinit: Command Files.
-* /proc: Process Information.
-* 386: Remote Serial.
-* 680x0: Remote Serial.
-* @: Arrays.
-* # in Modula-2: GDB/M2.
-* $$: Value History.
-* $_ and info breakpoints: Set Breaks.
-* $_ and info line: Machine Code.
-* $_, $__, and value history: Memory.
-* $: Value History.
-* breakpoint subroutine, remote: Stub Contents.
-* heuristic-fence-post (MIPS): MIPS Stack.
-* remotedebug, MIPS protocol: MIPS Remote.
-* retransmit-timeout, MIPS protocol: MIPS Remote.
-* timeout, MIPS protocol: MIPS Remote.
-* vi style command editing: Readline Vi Mode.
-* .gdbinit: Command Files.
-* COFF versus C++: Cplus expressions.
-* ECOFF and C++: Cplus expressions.
-* ELF/DWARF and C++: Cplus expressions.
-* ELF/stabs and C++: Cplus expressions.
-* XCOFF and C++: Cplus expressions.
-* GDB bugs, reporting: Bug Reporting.
-* {TYPE}: Expressions.
-* a.out and C++: Cplus expressions.
-* abbreviation: Command Syntax.
-* active targets: Active Targets.
-* add-symbol-file: Files.
-* add-syms: Renamed Commands.
-* AMD 29K register stack: Registers.
-* AMD EB29K: Target Commands.
-* AMD29K via UDI: UDI29K Remote.
-* arguments (to your program): Arguments.
-* artificial array: Arrays.
-* assembly instructions: Machine Code.
-* assignment: Assignment.
-* attach: Attach.
-* attach: Attach.
-* automatic display: Auto Display.
-* b: Set Breaks.
-* backtrace: Backtrace.
-* break: Set Breaks.
-* break in overloaded functions: Debugging C plus plus.
-* breakpoint commands: Break Commands.
-* breakpoint conditions: Conditions.
-* breakpoint numbers: Breakpoints.
-* breakpoint on memory address: Breakpoints.
-* breakpoint on variable modification: Breakpoints.
-* breakpoints: Breakpoints.
-* bt: Backtrace.
-* bug criteria: Bug Criteria.
-* bug reports: Bug Reporting.
-* bugs in GDB: GDB Bugs.
-* c: Continuing and Stepping.
-* C and C++: C.
-* C and C++ checks: C Checks.
-* C and C++ constants: C Operators.
-* C and C++ defaults: C Defaults.
-* C and C++ operators: C.
-* C++: C.
-* C++ and object formats: Cplus expressions.
-* C++ exception handling: Debugging C plus plus.
-* C++ scope resolution: Variables.
-* C++ support, not in COFF: Cplus expressions.
-* C++ symbol decoding style: Print Settings.
-* C++ symbol display: Debugging C plus plus.
-* call: Calling.
-* call overloaded functions: Cplus expressions.
-* call stack: Stack.
-* calling functions: Calling.
-* calling make: Shell Commands.
-* casts, to view memory: Expressions.
-* catch: Exception Handling.
-* catch exceptions: Frame Info.
-* cd: Working Directory.
-* cdir: Source Path.
-* checks, range: Type Checking.
-* checks, type: Checks.
-* checksum, for GDB remote: Protocol.
-* clear: Delete Breaks.
-* clearing breakpoints, watchpoints: Delete Breaks.
-* colon, doubled as scope operator: M2 Scope.
-* colon-colon: M2 Scope.
-* colon-colon: Variables.
-* command files: Hooks.
-* command files: Command Files.
-* command line editing: Editing.
-* commands: Break Commands.
-* commands for C++: Debugging C plus plus.
-* commands to STDBUG (ST2000): ST2000 Remote.
-* comment: Command Syntax.
-* compilation directory: Source Path.
-* completion: Completion.
-* completion of quoted strings: Completion.
-* condition: Conditions.
-* conditional breakpoints: Conditions.
-* configuring GDB: Installing GDB.
-* confirmation: Messages/Warnings.
-* connect (to STDBUG): ST2000 Remote.
-* continue: Continuing and Stepping.
-* continuing: Continuing and Stepping.
-* controlling terminal: Input/Output.
-* convenience variables: Convenience Vars.
-* core: Files.
-* core dump file: Files.
-* core-file: Files.
-* CPU simulator: Simulator.
-* crash of debugger: Bug Criteria.
-* current directory: Source Path.
-* cwd: Source Path.
-* d: Delete Breaks.
-* debugger crash: Bug Criteria.
-* debugging optimized code: Compilation.
-* debugging stub, example: Protocol.
-* debugging target: Targets.
-* define: Define.
-* delete: Delete Breaks.
-* delete breakpoints: Delete Breaks.
-* delete display: Auto Display.
-* delete environment: Renamed Commands.
-* deleting breakpoints, watchpoints: Delete Breaks.
-* detach: Attach.
-* device: Hitachi Remote.
-* directories for source files: Source Path.
-* directory: Source Path.
-* directory, compilation: Source Path.
-* directory, current: Source Path.
-* dis: Disabling.
-* disable: Disabling.
-* disable breakpoints: Disabling.
-* disable display: Auto Display.
-* disabled breakpoints: Disabling.
-* disassemble: Machine Code.
-* display: Auto Display.
-* display of expressions: Auto Display.
-* do: Selection.
-* document: Define.
-* documentation: Formatting Documentation.
-* down: Selection.
-* down-silently: Selection.
-* download to H8/300 or H8/500: Files.
-* download to Hitachi SH: Files.
-* download to Nindy-960: Files.
-* download to VxWorks: VxWorks Download.
-* dynamic linking: Files.
-* eb.log: Remote Log.
-* EB29K board: EB29K Remote.
-* EBMON: Comms (EB29K).
-* echo: Output.
-* editing: Editing.
-* editing-mode: Readline Init Syntax.
-* emacs: Emacs.
-* enable: Disabling.
-* enable breakpoints: Disabling.
-* enable display: Auto Display.
-* enabled breakpoints: Disabling.
-* end: Break Commands.
-* entering numbers: Numbers.
-* environment (of your program): Environment.
-* error on valid input: Bug Criteria.
-* event designators: Event Designators.
-* examining data: Data.
-* examining memory: Memory.
-* exception handlers: Exception Handling.
-* exception handlers: Frame Info.
-* exceptionHandler: Bootstrapping.
-* exec-file: Files.
-* executable file: Files.
-* exiting GDB: Quitting GDB.
-* expansion: History Interaction.
-* expressions: Expressions.
-* expressions in C or C++: C.
-* expressions in C++: Cplus expressions.
-* expressions in Modula-2: Modula-2.
-* f: Selection.
-* fatal signal: Bug Criteria.
-* fatal signals: Signals.
-* fg: Continuing and Stepping.
-* file: Files.
-* finish: Continuing and Stepping.
-* flinching: Messages/Warnings.
-* floating point: Floating Point Hardware.
-* floating point registers: Registers.
-* floating point, MIPS remote: MIPS Remote.
-* flush_i_cache: Bootstrapping.
-* foo: Symbol Errors.
-* format options: Print Settings.
-* formatted output: Output Formats.
-* Fortran: Summary.
-* forward-search: Search.
-* frame: Selection.
-* frame: Frames.
-* frame number: Frames.
-* frame pointer: Frames.
-* frameless execution: Frames.
-* g++: C.
-* GDB reference card: Formatting Documentation.
-* gdbserver: Server.
-* getDebugChar: Bootstrapping.
-* GNU C++: C.
-* h: Help.
-* H8/300 or H8/500 download: Files.
-* H8/300 or H8/500 simulator: Simulator.
-* handle: Signals.
-* handle_exception: Stub Contents.
-* handling signals: Signals.
-* help: Help.
-* help target: Target Commands.
-* help user-defined: Define.
-* history expansion: History.
-* history file: History.
-* history number: Value History.
-* history save: History.
-* history size: History.
-* history substitution: History.
-* Hitachi SH download: Files.
-* Hitachi SH simulator: Simulator.
-* horizontal-scroll-mode: Readline Init Syntax.
-* i: Help.
-* i/o: Input/Output.
-* i386-stub.c: Remote Serial.
-* i960: i960-Nindy Remote.
-* ignore: Conditions.
-* ignore count (of breakpoint): Conditions.
-* INCLUDE_RDB: VxWorks Remote.
-* info: Help.
-* info address: Symbols.
-* info all-registers: Registers.
-* info args: Frame Info.
-* info breakpoints: Set Breaks.
-* info catch: Frame Info.
-* info convenience: Renamed Commands.
-* info copying: Renamed Commands.
-* info directories: Renamed Commands.
-* info display: Auto Display.
-* info editing: Renamed Commands.
-* info f: Frame Info.
-* info files: Files.
-* info float: Floating Point Hardware.
-* info frame: Frame Info.
-* info frame: Show.
-* info functions: Symbols.
-* info history: Renamed Commands.
-* info line: Machine Code.
-* info locals: Frame Info.
-* info proc: Process Information.
-* info proc id: Process Information.
-* info proc mappings: Process Information.
-* info proc status: Process Information.
-* info proc times: Process Information.
-* info program: Stopping.
-* info registers: Registers.
-* info s: Backtrace.
-* info set: Help.
-* info share: Files.
-* info sharedlibrary: Files.
-* info signals: Signals.
-* info source: Symbols.
-* info source: Show.
-* info sources: Symbols.
-* info stack: Backtrace.
-* info target: Files.
-* info targets: Renamed Commands.
-* info terminal: Input/Output.
-* info types: Symbols.
-* info values: Renamed Commands.
-* info variables: Symbols.
-* info version: Renamed Commands.
-* info warranty: Renamed Commands.
-* info watchpoints: Set Watchpoints.
-* inheritance: Debugging C plus plus.
-* init file: Command Files.
-* init file name: Command Files.
-* initial frame: Frames.
-* innermost frame: Frames.
-* inspect: Data.
-* installation: Installing GDB.
-* instructions, assembly: Machine Code.
-* Intel: Remote Serial.
-* interaction, readline: Readline Interaction.
-* internal GDB breakpoints: Set Breaks.
-* interrupt: Quitting GDB.
-* interrupting remote programs: Debug Session.
-* invalid input: Bug Criteria.
-* jump: Jumping.
-* kill: Kill Process.
-* l: List.
-* languages: Languages.
-* latest breakpoint: Set Breaks.
-* leaving GDB: Quitting GDB.
-* linespec: List.
-* list: List.
-* listing machine instructions: Machine Code.
-* load: Files.
-* log file for EB29K: Remote Log.
-* m68k-stub.c: Remote Serial.
-* machine instructions: Machine Code.
-* maint info breakpoints: Set Breaks.
-* maint print psymbols: Symbols.
-* maint print symbols: Symbols.
-* make: Shell Commands.
-* mapped: Files.
-* mark-modified-lines: Readline Init Syntax.
-* member functions: Cplus expressions.
-* memory tracing: Breakpoints.
-* memory, viewing as typed object: Expressions.
-* memory-mapped symbol file: Files.
-* memset: Bootstrapping.
-* MIPS boards: MIPS Remote.
-* MIPS remote floating point: MIPS Remote.
-* MIPS stack: MIPS Stack.
-* Modula-2: Modula-2.
-* Modula-2 built-ins: M2 Operators.
-* Modula-2 checks: M2 Checks.
-* Modula-2 constants: Built-In Func/Proc.
-* Modula-2 defaults: M2 Defaults.
-* Modula-2 operators: M2 Operators.
-* Modula-2, deviations from: Deviations.
-* Motorola 680x0: Remote Serial.
-* multiple targets: Active Targets.
-* n: Continuing and Stepping.
-* names of symbols: Symbols.
-* namespace in C++: Cplus expressions.
-* negative breakpoint numbers: Set Breaks.
-* next: Continuing and Stepping.
-* nexti: Continuing and Stepping.
-* ni: Continuing and Stepping.
-* Nindy: i960-Nindy Remote.
-* number representation: Numbers.
-* numbers for breakpoints: Breakpoints.
-* object formats and C++: Cplus expressions.
-* online documentation: Help.
-* optimized code, debugging: Compilation.
-* outermost frame: Frames.
-* output: Output.
-* output formats: Output Formats.
-* overloading: Breakpoint Menus.
-* overloading in C++: Debugging C plus plus.
-* packets, reporting on stdout: Protocol.
-* partial symbol dump: Symbols.
-* patching binaries: Patching.
-* path: Environment.
-* pauses in output: Screen Size.
-* pipes: Starting.
-* prefer-visible-bell: Readline Init Syntax.
-* print: Data.
-* print settings: Print Settings.
-* printf: Output.
-* printing data: Data.
-* process image: Process Information.
-* prompt: Prompt.
-* protocol, GDB remote serial: Protocol.
-* ptype: Symbols.
-* putDebugChar: Bootstrapping.
-* pwd: Working Directory.
-* q: Quitting GDB.
-* quit: Quitting GDB.
-* quotes in commands: Completion.
-* quoting names: Symbols.
-* raise exceptions: Exception Handling.
-* range checking: Type Checking.
-* rbreak: Set Breaks.
-* reading symbols immediately: Files.
-* readline: Editing.
-* readnow: Files.
-* redirection: Input/Output.
-* reference card: Formatting Documentation.
-* reference declarations: Cplus expressions.
-* register stack, AMD29K: Registers.
-* registers: Registers.
-* regular expression: Set Breaks.
-* reloading symbols: Messages/Warnings.
-* remote connection without stubs: Server.
-* remote debugging: Remote.
-* remote programs, interrupting: Debug Session.
-* remote serial debugging summary: Debug Session.
-* remote serial debugging, overview: Remote Serial.
-* remote serial protocol: Protocol.
-* remote serial stub: Stub Contents.
-* remote serial stub list: Remote Serial.
-* remote serial stub, initialization: Stub Contents.
-* remote serial stub, main routine: Stub Contents.
-* remote stub, example: Protocol.
-* remote stub, support routines: Bootstrapping.
-* repeating commands: Command Syntax.
-* reporting bugs in GDB: GDB Bugs.
-* reset: Nindy Reset.
-* response time, MIPS debugging: MIPS Stack.
-* resuming execution: Continuing and Stepping.
-* RET: Command Syntax.
-* return: Returning.
-* returning from a function: Returning.
-* reverse-search: Search.
-* run: Starting.
-* running: Starting.
-* running 29K programs: EB29K Remote.
-* running VxWorks tasks: VxWorks Attach.
-* s: Continuing and Stepping.
-* saving symbol table: Files.
-* scope: M2 Scope.
-* search: Search.
-* searching: Search.
-* selected frame: Stack.
-* serial connections, debugging: Protocol.
-* serial device, Hitachi micros: Hitachi Remote.
-* serial line speed, Hitachi micros: Hitachi Remote.
-* serial line, target remote: Debug Session.
-* serial protocol, GDB remote: Protocol.
-* set addressprint: Renamed Commands.
-* set args: Arguments.
-* set array-max: Renamed Commands.
-* set arrayprint: Renamed Commands.
-* set asm-demangle: Renamed Commands.
-* set caution: Renamed Commands.
-* set check: Range Checking.
-* set check: Type Checking.
-* set check range: Range Checking.
-* set check type: Type Checking.
-* set complaints: Messages/Warnings.
-* set confirm: Messages/Warnings.
-* set demangle: Renamed Commands.
-* set demangle-style: Print Settings.
-* set editing: Editing.
-* set environment: Environment.
-* set height: Screen Size.
-* set history expansion: History.
-* set history filename: History.
-* set history save: History.
-* set history size: History.
-* set history write: Renamed Commands.
-* set language: Manually.
-* set listsize: List.
-* set mipsfpu off: MIPS Remote.
-* set prettyprint: Renamed Commands.
-* set print address: Print Settings.
-* set print array: Print Settings.
-* set print asm-demangle: Print Settings.
-* set print demangle: Print Settings.
-* set print elements: Print Settings.
-* set print max-symbolic-offset: Print Settings.
-* set print object: Print Settings.
-* set print pretty: Print Settings.
-* set print sevenbit-strings: Print Settings.
-* set print symbol-filename: Print Settings.
-* set print union: Print Settings.
-* set print vtbl: Print Settings.
-* set prompt: Prompt.
-* set radix: Numbers.
-* set remotedebug: Protocol.
-* set retransmit-timeout: MIPS Remote.
-* set rstack_high_address: Registers.
-* set screen-height: Renamed Commands.
-* set screen-width: Renamed Commands.
-* set sevenbit-strings: Renamed Commands.
-* set symbol-reloading: Messages/Warnings.
-* set timeout: MIPS Remote.
-* set unionprint: Renamed Commands.
-* set variable: Assignment.
-* set verbose: Messages/Warnings.
-* set vtblprint: Renamed Commands.
-* set width: Screen Size.
-* set write: Patching.
-* setting variables: Assignment.
-* setting watchpoints: Set Watchpoints.
-* set_debug_traps: Stub Contents.
-* share: Files.
-* shared libraries: Files.
-* sharedlibrary: Files.
-* shell: Shell Commands.
-* shell escape: Shell Commands.
-* show: Help.
-* show addressprint: Renamed Commands.
-* show args: Arguments.
-* show array-max: Renamed Commands.
-* show arrayprint: Renamed Commands.
-* show asm-demangle: Renamed Commands.
-* show caution: Renamed Commands.
-* show check range: Range Checking.
-* show check type: Type Checking.
-* show commands: History.
-* show complaints: Messages/Warnings.
-* show confirm: Messages/Warnings.
-* show convenience: Convenience Vars.
-* show copying: Help.
-* show demangle: Renamed Commands.
-* show demangle-style: Print Settings.
-* show directories: Source Path.
-* show editing: Editing.
-* show environment: Environment.
-* show height: Screen Size.
-* show history: History.
-* show history write: Renamed Commands.
-* show language: Show.
-* show listsize: List.
-* show paths: Environment.
-* show prettyprint: Renamed Commands.
-* show print address: Print Settings.
-* show print array: Print Settings.
-* show print asm-demangle: Print Settings.
-* show print demangle: Print Settings.
-* show print elements: Print Settings.
-* show print max-symbolic-offset: Print Settings.
-* show print object: Print Settings.
-* show print pretty: Print Settings.
-* show print sevenbit-strings: Print Settings.
-* show print symbol-filename: Print Settings.
-* show print union: Print Settings.
-* show print vtbl: Print Settings.
-* show prompt: Prompt.
-* show radix: Numbers.
-* show remotedebug: Protocol.
-* show retransmit-timeout: MIPS Remote.
-* show rstack_high_address: Registers.
-* show screen-height: Renamed Commands.
-* show screen-width: Renamed Commands.
-* show sevenbit-strings: Renamed Commands.
-* show timeout: MIPS Remote.
-* show unionprint: Renamed Commands.
-* show user: Define.
-* show values: Value History.
-* show verbose: Messages/Warnings.
-* show version: Help.
-* show vtblprint: Renamed Commands.
-* show warranty: Help.
-* show width: Screen Size.
-* show write: Patching.
-* si: Continuing and Stepping.
-* signal: Signaling.
-* signals: Signals.
-* silent: Break Commands.
-* sim: Simulator.
-* simulator: Simulator.
-* simulator, H8/300 or H8/500: Simulator.
-* simulator, Hitachi SH: Simulator.
-* simulator, Z8000: Simulator.
-* size of screen: Screen Size.
-* source: Command Files.
-* source path: Source Path.
-* sparc-stub.c: Remote Serial.
-* speed: Hitachi Remote.
-* st2000 CMD: ST2000 Remote.
-* ST2000 auxiliary commands: ST2000 Remote.
-* stack frame: Frames.
-* stack on MIPS: MIPS Stack.
-* stacking targets: Active Targets.
-* starting: Starting.
-* STDBUG commands (ST2000): ST2000 Remote.
-* step: Continuing and Stepping.
-* stepi: Continuing and Stepping.
-* stepping: Continuing and Stepping.
-* stub example, remote debugging: Protocol.
-* stupid questions: Messages/Warnings.
-* symbol decoding style, C++: Print Settings.
-* symbol dump: Symbols.
-* symbol names: Symbols.
-* symbol overloading: Breakpoint Menus.
-* symbol table: Files.
-* symbol-file: Files.
-* symbols, reading immediately: Files.
-* target: Targets.
-* target amd-eb: Target Commands.
-* target core: Target Commands.
-* target exec: Target Commands.
-* target hms: Target Commands.
-* target mips PORT: MIPS Remote.
-* target nindy: Target Commands.
-* target remote: Target Commands.
-* target sim: Target Commands.
-* target sim: Simulator.
-* target st2000: Target Commands.
-* target udi: Target Commands.
-* target vxworks: Target Commands.
-* tbreak: Set Breaks.
-* TCP port, target remote: Debug Session.
-* terminal: Input/Output.
-* this: Cplus expressions.
-* toggle-editing-mode: Readline Vi Mode.
-* tty: Input/Output.
-* type casting memory: Expressions.
-* type checking: Checks.
-* type conversions in C++: Cplus expressions.
-* u: Continuing and Stepping.
-* udi: UDI29K Remote.
-* UDI: UDI29K Remote.
-* undisplay: Auto Display.
-* unset: Renamed Commands.
-* unset environment: Environment.
-* until: Continuing and Stepping.
-* up: Selection.
-* up-silently: Selection.
-* user-defined command: Define.
-* value history: Value History.
-* variable name conflict: Variables.
-* variable values, wrong: Variables.
-* variables, setting: Assignment.
-* version number: Help.
-* VxWorks: VxWorks Remote.
-* watch: Set Watchpoints.
-* watchpoints: Breakpoints.
-* whatis: Symbols.
-* where: Backtrace.
-* word completion: Completion.
-* working directory: Source Path.
-* working directory (of your program): Working Directory.
-* working language: Languages.
-* writing into corefiles: Patching.
-* writing into executables: Patching.
-* wrong values: Variables.
-* x: Memory.
-* Z8000 simulator: Simulator.
-
-
diff --git a/gnu/usr.bin/gdb/doc/libgdb.texinfo b/gnu/usr.bin/gdb/doc/libgdb.texinfo
deleted file mode 100644
index c67c3a8..0000000
--- a/gnu/usr.bin/gdb/doc/libgdb.texinfo
+++ /dev/null
@@ -1,1471 +0,0 @@
-\input texinfo @c -*-texinfo-*-
-@c %**start of header
-@setfilename libgdb.info
-@settitle Libgdb
-@setchapternewpage odd
-@c %**end of header
-
-@ifinfo
-This file documents libgdb, the GNU library for symbolic debuggers.
-
-Copyright 1993 Cygnus Support
-
-Permission is granted to ...
-@end ifinfo
-
-@c This title page illustrates only one of the
-@c two methods of forming a title page.
-
-@titlepage
-@title Libgdb
-@subtitle Version 0.1
-@subtitle 27 Sep 1993
-@author Thomas Lord
-
-@c The following two commands
-@c start the copyright page.
-@page
-@vskip 0pt plus 1filll
-Copyright @copyright{} 1993 COPYRIGHT-OWNER
-
-Published by ...
-
-Permission is granted to ...
-@end titlepage
-
-@node Top, Overview, (dir), (dir)
-
-@ifinfo
-
-Libgdb is a library which provides the core functionality of a symbolic
-debugger. It is derived from GNU GDB and depends on the BFD library.
-
-This is an early draft of this document. Subsequent versions will likely
-contain revisions, deletions and additions.
-
-This document applies to version 0.0.
-
-Text marked `[[[' indicates areas which require expansion.
-
-Many nodes describe library entry points by giving a prototype and brief
-description:
-
-@deftypefun {const char **} gdb_warranty ()
-(warranty_info)
-Return a pointer to the text of the GDB disclaimer.
-@end deftypefun
-
-The parenthesized symbols (e.g. `(warranty_info)') refer to the
-existing GDB source and generally indicate where to find code with
-which to implement the library function.
-@end ifinfo
-
-@menu
-* Copying:: Your rights and freedoms.
-* Overview:: The basics of libgdb and this document.
-* Conventions:: Programming conventions for users of libgdb.
-* Targets:: Selecting debugging targets and symbol tables.
-* Symtabs:: Accessing symbol tables and debugging information.
-* Source:: Relating inferiors to source files.
-* Running:: Creating, continuing, and stepping through an
- inferior process.
-* Stopping:: Using breakpoints, signaling an inferior.
-* Stack:: Accessing an inferior's execution stack.
-* Expressions:: How to parse and evaluate expressions in the
- context of an inferior.
-* Values:: Data from the inferior, the values of expressions.
-* Examining:: Formatting values as strings.
-* Types:: Examining the types of an inferiors data.
-@end menu
-
-
-@node Copying, Overview, top, top
-@comment node-name, next, previous, up
-@chapter Copying
-@cindex copying
-
-blah blah
-
-@node Overview, Conventions, Copying, top
-@comment node-name, next, previous, up
-@chapter Overview
-@cindex overview
-@cindex definitions
-
-
-Libgdb is a library which provides the core functionality of a symbolic
-debugger. It is derived from GNU GDB and depends on the BFD library.
-
-target
-inferior
-
-
-
-@node Conventions, Targets, Overview, top
-@comment node-name, next, previous, up
-@chapter Programming Conventions for Libgdb Clients
-@cindex Conventions
-
-@heading Naming Conventions
-
-Names intentionally exported from libgdb all begin @code{gdb_}
-as in @code{gdb_use_file}.
-
-
-@heading Error Returns
-
-Libgdb functions that might not succeed generally have a return
-type of @code{gdb_error_t}.
-
-@deftypefun {const char *} gdb_error_msg (gdb_error_t @var{error})
-returns a reasonable error message for @var{error}.
-@end deftypefun
-
-
-@heading Blocking I/O
-
-[[[....]]]
-
-
-@heading Global Parameters
-@subheading the current directory
-@deftypefun gdb_error_t gdb_cd (char * @var{dir})
-Specify gdb's default directory as well as the working
-directory for the inferior (when first started).@*
-(cd_command)
-@end deftypefun
-
-@deftypefun {char *} gdb_copy_pwd ()
-Make a copy of the name of gdb's default directory.@*
-(pwd_command)
-@end deftypefun
-
-
-@subheading controlling the input/output radix
-@deftypefun gdb_error_t gdb_set_base (int)
-Change the default output radix to 10 or 16, or set it to 0
-(heuristic). This command is mostly obsolete now that the print
-command allows formats to apply to aggregates, but is still handy
-occasionally.@*
-(set_base_command)
-@end deftypefun
-
-@deftypefun gdb_error_t gdb_set_input_radix (int)
-@deftypefunx gdb_error_t gdb_set_output_radix (int)
-@deftypefunx gdb_error_t gdb_set_radix (int)
-Valid output radixes are only 0 (heuristic), 10, and 16.@*
-(set_radix)
-@end deftypefun
-
-
-@subheading manipulating environments
-@deftp Type {struct environ}
-@example
-struct environ
-@{
- int allocated;
- char ** vector;
-@}
-@end example
-A `struct environ' holds a description of environment
-variable bindings.
-@end deftp
-
-@deftypefun {struct environ *} gdb_make_environ ()
-Create a new (empty) environment.@*
-(make_environ)
-@end deftypefun
-
-@deftypefun {void} gdb_free_environ (struct environ *)
-Free an environment allocated by `gdb_make_environ'.@*
-(free_environ)
-@end deftypefun
-
-@deftypefun {void} gdb_init_environ (struct environ * env)
-Copy the processes environment into ENV.@*
-(init_environ)
-@end deftypefun
-
-@deftypefun {char **} gdb_get_in_environ (const struct environ * @var{env}, const char * @var{var})
-Look up the binding of @var{var} in @var{env}.@*
-(get_in_environ)
-@end deftypefun
-
-
-@deftypefun {void} gdb_set_in_environ (struct environ * @var{env}, const char * @var{var}, const char * @var{value})
-Lookup/bind variables within an environment.
-(set_in_environ)
-@end deftypefun
-
-
-@subheading legal notices
-@deftypefun {char **} gdb_copying ()
-@deftypefunx {char **} gdb_warranty ()
-These return pointers to NULL terminated arrays of strings.
-They contain text which describes the conditions under which
-libgdb is distributed (`gdb_copying') and which explains to
-users that there is no warranty for libgdb (`gdb_warranty').@*
-(show_warranty_command, show_copying_command)
-@end deftypefun
-
-
-@subheading the inferior's terminal
-@deftypefun void gdb_inferiors_io (int @var{std_in}, int @var{std_out}, int @var{std_err})
-Assert that the given descriptors should be copied into
-descriptors 0, 1, and 2 of the inferior when it
-is next run.
-@end deftypefun
-
-
-@heading callbacks
-
-One idiom used in several places deserves mention.
-At times, it makes sense for libgdb functions to
-invoke functions provided by the libgdb client.
-Where this is the case, callback structures are used
-to refer to client functions. For example, here
-are the declarations for a callback to which libgdb
-will pass an integer and a character pointer.
-
-@example
-struct a_gdb_cback;
-typedef void (*a_gdb_cback_fn) (struct a_gdb_cback *,
- int, char *);
-@end example
-
-Suppose the client wants the callback to be implemented
-by @code{foo} which we will assume takes not only the integer
-and character pointer, but also a floating point number.
-The client could use these declarations:
-
-@example
-struct my_cback
-@{
- struct a_gdb_cback gdb_cback; /* must be first */
- float magic_number;
-@};
-
-void
-foo_helper (struct a_gdb_cback * callback, int i, char * cp)
-@{
- foo ( ((struct my_cback *)callback)->magic_number, i, c);
-@}
-
-struct my_cback
-@{
- foo_helper,
- 1079252848.8
-@} the_cback;
-@end example
-
-
-@subheading stream callbacks
-
-A common kind of callback takes just a character pointer,
-presumed to point to part or all of an informational
-message.
-
-@example
-struct gdb_stream_cback;
-typedef void (*gdb_stream_cback_fn) (struct gdb_stream_cback *,
- char *);
-@end example
-
-
-@subheading integer callbacks
-
-Another common kind of callback takes just an integer.
-
-@example
-struct gdb_int_cback;
-typedef void (*gdb_int_cback_fn) (struct gdb_int_cback *, int);
-@end example
-
-@node Targets, Symtabs, Conventions, top
-@comment node-name, next, previous, up
-@chapter Selecting Targets and Symbol Tables for Debugging
-@cindex targets
-
-@deftypefun gdb_error_t gdb_use_file (char * @var{filename})
-Arrange to read both executable code and symbol table information
-from FILENAME.
-
-This is exactly equivalent to a sequence of two calls:
-@example
- gdb_use_exec_file (filename);
- gdb_use_symbol_file (filename);
-@end example
-(file_command)
-@end deftypefun
-
-
-@deftypefun gdb_error_t gdb_use_exec_file (char * @var{filename})
-Read the code to debug from `filename'.@*
-(exec_file_command)
-@end deftypefun
-
-
-@deftypefun {char *} gdb_get_exec_file ()
-Return the name of the executable file as a string or 0
-if there is none.
-@end deftypefun
-
-
-@deftypefun gdb_error_t gdb_use_core (char * @var{filename})
-Specify the whereabouts of a core dump file to be used as the
-"contents of memory". Traditionally, core files contain only some
-parts of the address space of the process that generated them; GDB
-can access the executable file itself for other parts.
-
-If @var{filename} is @code{NULL}, no core file is used.@*
-(core_file_command)
-@end deftypefun
-
-
-@deftypefun gdb_error_t gdb_use_symbol_file (char * @var{filename})
-Arrange to read symbol table information from `filename'.
-
-This is the same as:
-
- gdb_symbol_file_add (filename, 1, (CORE_ADDR)0, 1, 0, 0);
-
-See @code{gdb_symbol_file_add} for finer control over the symbol
-table.@*
-(symbol_file_command)
-@end deftypefun
-
-
-@deftypefun gdb_error_t gdb_symbol_file_add (@var{name}, @var{verbose}, @var{text_addr}, @var{replace}, @var{eager})
-Arrange to read additional symbol table information from
-the file `name'.
-
-The arguments are:
-@itemize @minus
-@item struct gdb_stream_cback * @var{info_out}
-
-Callback to handle informational output.
-
-@item char * @var{name}
-
-If not 0, verbose output will occur.
-
-@item int @var{be_verbose}
-
-Regulates the amount of informational output produced.
-
-@item CORE_ADDR @var{text_addr}
-
-is the address at which the named file is presumed to have
-been loaded.
-
-@item int @var{replace}@*
-
-If not 0, this will become the only file
-in the symbol table -- all previously loaded
-symbol table information will be discarded.
-
-@item int @var{readnow}
-
-If not 0, eagerly read symbols from this file,otherwise
-symbols will only be read lazily (as needed).
-@end itemize
-@end deftypefun
-
-
-@deftypefun {char *} gdb_copy_exec_path ()
-Make a copy of the execution path.@*
-[[[implement: strsave(get_in_environ (inferior_environ, "PATH"));]]]@*
-(path_info)
-@end deftypefun
-
-
-@deftypefun void gdb_mod_exec_path (char * @var{dirnames})
-Add zero or more directories to the front of the execution path.
-@var{dirnames} should be a colon separated list of directory names.@*
-(path_command)
-@end deftypefun
-
-
-@deftypefun gdb_error_t gdb_target_device (char * @var{name})
-Connects the libgdb host environment to a target machine
-or process.@*
-(target foo)
-@end deftypefun
-
-
-@deftypefun gdb_error_t gdb_set_baud (int @var{rate})
-If using a remote target connected by a serial port,
-use RATE as the communication speed.
-@end deftypefun
-
-
-@deftypefun gdb_error_t gdb_set_target_debugging (int @var{level})
-Choose the level of verboseness of with which a remote
-target produces debugging output.
-@end deftypefun
-
-@node Symtabs, Source, Targets, top
-@comment node-name, next, previous, up
-@chapter Accessing symbol tables and debugging information.
-@cindex Symtabs
-@cindex {Symbol Tables}
-
-@deftp Type {struct symtab}
-Each source file is represented by a struct symtab.
-In many contexts, @code{struct symtab *} is used in preference
-to a {char *} filename to refer to the source.
-@end deftp
-
-
-@deftypefun {char *} gdb_symtab_to_filename (struct symtab *)
-@deftypefunx {char *} gdb_symtab_to_dirname (struct symtab *)
-Return the location of the file corresponding to this symtab.
-@code{gdb_symtab_to_dirname} might return @code{NULL} if no directory
-is known. @code{gdb_symtab_to_line_count} might return -1 if line
-number information is unavailable.
-@end deftypefun
-
-@deftypefun int gdb_symtab_to_line_count (struct symtab *)
-(See also `Source')
-@end deftypefun
-
-
-@deftypefun {struct symtab *} gdb_filename_to_symtab (char * @var{filename})
-Lookup the symbol table of a source file named NAME.@*
-(lookup_symtab)
-@end deftypefun
-
-
-@deftp Type {struct symtab_and_line}
-@example
-struct symtab_and_line
-@{
- struct symtab *symtab;
- int line;
- CORE_ADDR pc;
- CORE_ADDR end;
-@}
-@end example
-
-@code{struct symtab_and_line} is used to refer to a particular line
-of source code. It is used to locate breakpoints in the source
-code and the executable.
-
-@code{line} starts at 1 and proceeds through symtab->nlines.
-0 is never a valid line number; it is used to indicate
-that line number information is not available.
-@end deftp
-
-
-@deftypefun {struct symtab_and_line} gdb_find_pc_line (CORE_ADDR @var{pc}, int @var{notcurrent})
-Find the source file and line number for a given @var{pc} value.
-Return a structure containing a symtab pointer, a line number,
-and a pc range for the entire source line.
-The value's @code{.pc} field is NOT the specified @var{pc}.
-@var{notcurrent} nonzero means, if specified pc is on a line boundary,
-use the line that ends there. Otherwise, in that case, the line
-that begins there is used.@*
-(find_pc_line)
-@end deftypefun
-
-
-@deftypefun gdb_error_t gdb_find_line (struct symtab_and_line * @var{out}, struct symtab *, int)
-Create a symtab_and_line for a given symtab and line number.
-In other words, if you know the source file and line,
-this returns a location for the breakpoint.@*
-(resolve_sal_pc)
-@end deftypefun
-
-
-@deftypefun {struct symtabs_and_lines} gdb_decode_line (@var{argptr}, @var{firstln}, @var{default_symtab}, @var{default_line}, @var{canonical})
-@example
- char ** argptr;
- int funfirstline;
- struct symtab * default_symtab;
- int default_line;
- char *** canonical;
-@end example
- Parse a string that specifies a line number in GDB syntax.
- @var{argptr} will be advanced over the characters actually parsed.
-
- The string can be:
-
- LINENUM -- that line number in current file. PC returned is 0.
- FILE:LINENUM -- that line in that file. PC returned is 0.
- FUNCTION -- line number of openbrace of that function.
- PC returned is the start of the function.
- VARIABLE -- line number of definition of that variable.
- PC returned is 0.
- FILE:FUNCTION -- likewise, but prefer functions in that file.
- *EXPR -- line in which address EXPR appears.
-
- FUNCTION may be an undebuggable function found in minimal symbol
- table.
-
- If the argument FUNFIRSTLINE is nonzero, we want the first line
- of real code inside a function when a function is specified.
-
- DEFAULT_SYMTAB specifies the file to use if none is specified.
- It defaults to current_source_symtab.
-
- DEFAULT_LINE specifies the line number to use for relative line
- numbers (that start with signs). Defaults to current_source_line.
- If CANONICAL is non-NULL, store an array of strings containing the
- canonical line specs there if necessary. Currently overloaded
- member functions and line numbers or static functions without a
- filename yield a canonical line spec. The array and the line spec
- strings are allocated on the heap, it is the callers responsibility
- to free them.
-
- Note that it is possible to return zero for the symtab
- if no file is validly specified. Callers must check that.
- Also, the line number returned may be invalid.
-
- The return value of this function includes allocated memory
- which the caller is responsible for freeing:
-
- struct symtabs_and_lines sals;
- sals = decode_line_spec (arg, 1);
- ....
- free (sals.sals);@*
-(decode_line_1)
-@end deftypefun
-
-
-@deftp Type {struct block *}
-Lexical environments in the program are represented by struct block.
-These are useful as arguements to expression parsing functions (see
-`Expressions').
-@end deftp
-
-
-@deftypefun {struct block *} gdb_block_for_pc (CORE_ADDR)
-Return the innermost lexical block containing the
-specified pc value, or 0 if there is none.@*
-(block_for_pc)
-@end deftypefun
-
-
-@deftypefun {struct block *} gdb_get_frame_block (FRAME @var{frame})
-This returns the block being executed by a given
-stack frame (see `Stack')@*
-(get_frame_block)
-@end deftypefun
-
-
-@deftypefun int gdb_find_line_pc_range (@var{syms}, @var{line}, @var{start_out}, @var{end_out})
-@example
-struct symtab * @var{start_out};
-int @var{line};
-CORE_ADDR * @var{start_out};
-CORE_ADDR * @var{end_out};
-@end example
-Find the range of pc values in a line.@*
-Store the starting pc of the line into @code{*@var{startptr}}.
-and the ending pc (start of next line) into @code{*@var{endptr}}.
-
-Returns 1 to indicate success.@*
-Returns 0 if could not find the specified line.@*
-(find_line_pc_range)
-@end deftypefun
-
-
-@deftypefun int gdb_find_pc_partial_function (@var{pc}, @var{name}, @var{address}, @var{endaddr})
-@example
-CORE_ADDR @var{pc};
-char **@var{name};
-CORE_ADDR *@var{address};
-CORE_ADDR *@var{endaddr};
-@end example
-Finds the "function" (text symbol) that is smaller than @var{pc} but
-greatest of all of the potential text symbols. Sets @code{*@var{name}}
-and/or @code{*@var{address}} conditionally if that pointer is non-null. If
-@var{endaddr} is non-null, then set @code{*@var{endaddr}} to be the end of
-the function (exclusive), but passing @var{endaddr} as non-null means that
-the function might cause symbols to be read. This function either succeeds
-or fails (not halfway succeeds). If it succeeds, it sets
-@code{*@var{name}}, @code{*@var{address}}, and @code{*@var{endaddr}} to
-real information and returns 1. If it fails, it sets @code{*@var{name}},
-@code{*@var{address}}, and @code{*@var{endaddr}} to zero and returns 0.
-
-@example
- pc = get_frame_pc (selected_frame);
- if (find_pc_partial_function (pc, &name, &low, &high) == 0)
- error ("No function contains program counter for selected frame.\n");
-@end example
-(find_pc_partial_function)
-@end deftypefun
-
-
-@deftypefun void gdb_list_symbols (@var{info_out}, @var{regexp}, @var{class}, @var{bpt})
-@example
-struct gdb_stream_cback * @var{info_out};
-char * @var{regexp};
-int @var{class};
-int @var{bpt};
-@end example
-List all symbols (if @var{regexp} is NULL) or all symbols matching @var{regexp}.
-
-
-If @var{class} is ...
-@itemize @bullet
-@item
-0, list all symbols except functions, type names, and
-constants (enums).
-@item
-1, list only functions.
-@item
-2, list only type names.
-@item
-3, list only method names.
-@end itemize
-BPT is non-zero if set a breakpoint at the functions we find.@*
-(variables_info, functions_info, types_info, list_symbols)
-@end deftypefun
-
-
-@deftypefun int gdb_locals_info (struct gdb_stream_cback * @var{info_out}, FRAME @var{frame})
-Print all the local variables in the given frame.
-including all the blocks active in that frame
-at its current pc.
-
-Returns 1 if the job was done,
-or 0 if nothing was printed because we have no info
-on the function running in @var{frame}.@*
-(locals_info)
-@end deftypefun
-
-
-@deftypefun int print_frame_arg_vars (struct gdb_stream_cback *, FRAME)
-Similar to `gdb_locals_info'.@*
-(args_info)
-@end deftypefun
-
-@node Source, Running, Symtabs, top
-@comment node-name, next, previous, up
-@chapter Relating Inferiors to Source Files
-@cindex source
-@cindex {source files}
-
-How to find the source that corresponds to executable code and the
-executable code that corresponds to a line of source.
-
-@deftypefun {char *} gdb_copy_source_fullname (struct symtab *@var{s})
-Return a copy of the full path name to a source file.
-(See `Symtabs' for more information about filenames
-and symbol tables.).
-@end deftypefun
-
-
-@deftypefun int gdb_open_source_file (struct symtab *@var{s})
-Open a source file corresponding to @var{s}. Returns a file descriptor
-or negative number for error.
-[[[We may decide not to provide this function.]]]@*
-(open_source_file)
-@end deftypefun
-
-
-@deftypefun int gdb_source_line_pos (struct symtab * @var{s}, int @var{lineno})
-Return the byte offset of a given line of source
-or a negative number if @var{lineno} is out of range.@*
-(find_source_lines)
-@end deftypefun
-
-
- -- IDIOM: The gdb command `show directories'.
-@example
- puts_filtered ("Source directories searched: ");
- puts_filtered (source_path);
- puts_filtered ("\n");
-@end example
-(show_directories)
-
-
-@deftypefun {char *} gdb_source_path ()
-Return the path in which source files are sought.@*
-(source_path)
-@end deftypefun
-
-
-@deftypefun void gdb_modify_source_path (char * @var{dirnames})
-Change the source path according to dirnames.@*
-(directory_command)
-@end deftypefun
-
-
-See `Symtabs' for functions relating symbol tables to files.
-(source_info)
-
-
-See `Symtabs' for functions relating source lines to PC values.
-(line_info)
-
-
-[[[Try to expose sources_info without having to introduce struct object *?]]]
-(sources_info)
-
-
-@node Running, Stopping, Source, top
-@comment node-name, next, previous, up
-@chapter Creating, Continuing, and Stepping Through an Inferior Process
-@cindex running
-
-
-@deftypefun gdb_error_t gdb_target_create_inferior (@var{exec}, @var{args}, @var{environ})
-@example
-char * @var{exec_file};
-char * @var{inferior_args};
-char ** @var{inferior_environment_vector};
-@end example
-Create a running inferior.
-[[[I think the exec_file parameter is redundant. Perhaps this will take
-only two arguments.]]]@*
-(run_command, target_create_inferior)
-@end deftypefun
-
-
-@deftypefun int gdb_target_has_execution ()
-Return non-0 if an inferior is running.@*
-(target_has_execution)
-@end deftypefun
-
-
-@deftypefun void gdb_target_kill ()
-Kill the inferior process. Make it go away.
-The inferior may become a core file.
-If so, gdb_target_has_stack() will return non-0.@*
-(target_kill)
-@end deftypefun
-
-
-@deftypefun gdb_error_t gdb_step_1 (@var{skip_subs}, @var{single_inst}, @var{repeat_count})
-@example
-int skip_subs;
-int single_inst;
-int repeat_count;
-@end example
-Continue a program a little bit. Roughly:
-@example
- for (; count > 0; --count)
- gdb_clear_proceed_status ();
- gdb_proceed (...);
-@end example
-(next_command, nexti_command, step_command, stepi_command)
-@end deftypefun
-
-
- -- IDIOM: Continuing a program where it stopped.
-@example
- gdb_clear_proceed_status ();
- gdb_proceed ((CORE_ADDR) -1, -1, 0);
-@end example
-(continue_command)
-
-
- -- IDIOM: Continuing a program giving it a specified signal.
-@example
- gdb_clear_proceed_status ();
- gdb_proceed ((CORE_ADDR) -1, signum, 0);
-@end example
-(signal_command)
-
-
-@deftypefun {char *} strtosigno (char * @var{str})
-(Typical use:)
-@example
- signum = strtosigno (signum_exp);
-
- if (signum == 0)
- /* Not found as a name, try it as an expression. */
- signum = parse_and_eval_address (signum_exp);
-
- gdb_clear_proceed_status ();
- gdb_proceed ();
-@end example
-@end deftypefun
-
-
- -- IDIOM: Continuing a program at a specified address.
-@example
- gdb_clear_proceed_status ();
- gdb_proceed (addr, 0, 0);
-@end example
-(jump_command)
-
-
-@deftypefun gdb_error_t gdb_finish ()
-"finish": Set a temporary breakpoint at the place
-the selected frame will return to, then continue.
-This is a convenience function but it summarizes a lot
-of other stuff.@*
-(finish_command)
-@end deftypefun
-
-
-@deftypefun void gdb_clear_proceed_status ()
-Clear out all variables saying what to do when inferior is continued.
-First do this, then set the ones you want, then call @code{gdb_proceed}.
-
- [[[Some of these should be documented, others hidden.]]]
-@example
- The variables are:
- trap_expected = 0;
- step_range_start = 0;
- step_range_end = 0;
- step_frame_address = 0;
- step_over_calls = -1;
- stop_after_trap = 0;
- stop_soon_quietly = 0;
- proceed_to_finish = 0;
- breakpoint_proceeded = 1; /* We're about to proceed... */
-
- /* Discard any remaining commands or status from previous stop. */
- bpstat_clear (&stop_bpstat);
-@end example
-(clear_proceed_status)
-@end deftypefun
-
-
-@deftypefun void gdb_proceed (CORE_ADDR @var{addr}, int @var{signal}, int @var{step})
-Basic routine for continuing the program in various fashions.
-
-@var{addr} is the address to resume at, or -1 for resume where stopped.@*
-@var{signal} is the signal to give it, or 0 for none,
-or -1 for act according to how it stopped.@*
-@var{step} is nonzero if should trap after one instruction.
--1 means return after that and print nothing.@*
-You should probably set various step_... variables
-before calling here, if you are stepping.
-
-You should call @code{gdb_clear_proceed_status} before calling proceed.
-(See the documentation for @code{gdb_clear_proceed_status} for more
-parameters to @code{gdb_proceed}).@*
-(proceed)
-@end deftypefun
-
-
-@deftypefun gdb_error_t gdb_return (value @var{return_value}, FRAME @var{frame})
-Make @var{frame} return to @var{value} to it's caller.
-Unlike the other functions in this section, this doesn't
-call proceed.
-(return_command)
-@end deftypefun
-
-
-@deftypefun int gdb_inferior_pid ()
-0 or the valid pid of an inferior.
-@end deftypefun
-
-
-@deftypefun gdb_error_t gdb_attach (int @var{pid})
-takes a program started up outside of gdb and
-`attaches'' to it. This stops it cold in its tracks and allows us
-to start debugging it. and wait for the trace-trap that results
-from attaching.@*
-(attach_command)
-@end deftypefun
-
-
-@deftypefun gdb_error_t gdb_detach (int @var{signal_num})
-Takes a program previously attached to and detaches it.
-The program resumes execution and will no longer stop
-on signals, etc. We better not have left any breakpoints
-in the program or it'll die when it hits one. For this
-to work, it may be necessary for the process to have been
-previously attached. It *might* work if the program was
-started via the normal ptrace (PTRACE_TRACEME).@*
-(detach_command)
-@end deftypefun
-
-@node Stopping, Stack, Running, top
-@comment node-name, next, previous, up
-@chapter Using Breakpoints, Signaling an Inferior
-@cindex stopping
-@cindex breakpoints
-
-
-@deftp Type {struct breakpoint}
-Breakpoints are typically represented @code{struct breakpoint *}.
-@end deftp
-
-
-@deftypefun {struct breakpoint *} gdb_find_breakpoint (int)
-Find a breakpoint given it's number (return 0 if it doesn't exist).
-@end deftypefun
-
-@deftypefun gdb_error_t gdb_set_break (struct breakpoint * @var{brk_out}, struct symtab_and_line)
-@deftypefunx gdb_error_t gdb_set_tbreak (struct breakpoint *, struct symtab_and_line)
-@deftypefunx gdb_error_t gdb_set_until (struct breakpoint *, struct symtab_and_line)
-These three are like their command language counterparts.
-They are front ends to `gdb_set_raw_breakpoint'.
-See `Symtabs' for sources of `struct symtab_and_line'.@*
-(break_command, break_command_1, until_command, tbreak_command)
-@end deftypefun
-
-
-@deftypefun gdb_error_t gdb_set_watchpt (@var{brk_out}, @var{exp_string}, @var{exp}, @var{exp_valid_block})
-@example
-struct breakpoint * @var{brk_out};
-char * @var{exp_string};
-struct expression * @var{exp};
-struct block * @var{expression_valid_block};
-@end example
-Set a watchpoint for the given expression.@*
-(watch_command)
-@end deftypefun
-
-
-@deftypefun void gdb_set_ignore_count (int @var{bptnum}, int @var{count})
-Set ignore-count of breakpoint number BPTNUM to COUNT.@*
-(set_ignore_count)
-@end deftypefun
-
-
-@deftypefun {struct gdb_bp_condition *} gdb_set_condition (@var{bp}, @var{exp_str}, @var{cond})
-@example
-int @var{pbtnum};
-char * @var{exp_str};
-struct gdb_bp_condition * @var{cond};
-
-typedef int (*gdb_bp_fn) (struct gdb_bp_condition *, int bp_num);
-struct gdb_bp_condition
-@{
- gdb_bp_fn fn;
-@};
-@end example
-Add a condition to a breakpoint.
-The condition is a callback which should return
-0 to skip the breakpoint, and 1 to break at it.
-It is called at times when the break might occur.
-
-A useful application of these callbacks to attach
-an expression to breakpoints like the gdb `condition'
-command. See `Expressions' for the parsing and
-evaluation of expressions.@*
-(condition_command)
-@end deftypefun
-
-
-@deftypefun gdb_error_t gdb_enable_breakpoint (struct breakpoint * @var{bpt}, int @var{once})
-@deftypefunx gdb_error_t gdb_disable_breakpoint (struct breakpoint * @var{bpt})
-Enable/disable a breakpoint. If `once' is not 0, the
-breakpoint is only temporarily enabled.@*
-(enable_breakpoint, disable_breakpoint, enable_command)
-@end deftypefun
-
-
-@deftypefun gdb_error_t gdb_delete_breakpoint (struct breakpoint * @var{bpt})
-Delete a breakpoint and clean up all traces of it in the
-data structures.@*
-(delete_breakpoint)
-@end deftypefun
-
-
-@deftypefun void gdb_clear_breakpoints (struct symtabs_and_lines * @var{sals})
-Clear breakpoints from a list of program locations as
-might be returned by `gdb_decode_line' (see `Symtabs').@*
-(clear_command)
-@end deftypefun
-
-
-@deftypefun {static struct symtabs_and_lines} get_catch_sals (int @var{this_level_only})
-Return the line numbers of all exception handlers currently
-active (or `this_level_only'?? [[[?]]]).
-[[[The implementation should remember to resolve_sal_pc]]]
-@end deftypefun
-
-
-@deftp Type {struct breakpoint_cback}
-@example
-typedef void (*breakpoint_cback_fn) (struct breakpoint_cback *, int bp_num);
-struct breakpoint_cback
-@{
- breakpoint_cback_fn fn;
-@};
-@end example
-
-Breakpoints can have an associated function which is called
-when the program is stopped by that breakpoint.@*
-(commands_command)
-@end deftp
-
-
-@deftypefun {struct breakpoint_cback *} gdb_set_breakpoint_cback (int @var{bp_num}, struct breakpoint_cback *)
-This sets a breakpoint callback and returns the previous callback value
-for that breakpoint.
-[[[In the long run, the command interpreter should be available
- for the use of hooks like this one.]]]
-@end deftypefun
-
-
-@deftypefun {struct breakpoint_cback *} gdb_get_breakpoint_cback (int @var{bp_num})
-@end deftypefun
-
-
-@deftypefun void gdb_breakpoints_info (struct gdb_stream_cback, int @var{bp_num}, int @var{watches})
-Print information on breakpoint number @var{bnum}, or -1 if all.
-If @var{watches} is zero, process only breakpoints; if @var{watches}
-is nonzero, process only watchpoints.
-[[[In the long run, expose the information read off by this function.]]]@*
-(info breakpoints, info watchpoints, breakpoints_info, breakpoint_1)
-@end deftypefun
-
-
-@deftypefun void gdb_catch_info (struct gdb_stream_cback *)
-Print a list of all the exception handlers that are active in the
-current stack frame at the current point of execution.@*
-(catch_info)
-@end deftypefun
-
-
-@deftypefun void gdb_handle_command (char * @var{args})
-Takes arguments like the gdb command `handle' and has
-the same effect.@*
-(handle_command)
-@end deftypefun
-
-
-@deftypefun void gdb_signals_info (struct gdb_stream_cback *)
-Show how signals are handled.@*
-(signals_info)
-@end deftypefun
-
-
-@node Stack, Expressions, Stopping, top
-@comment node-name, next, previous, up
-@chapter Accessing An Inferior's Execution Stack
-@cindex stack
-@cindex FRAME
-@cindex {stack frames}
-
-
-
-@deftp Type FRAME
-This type representing active stack frames in the inferior.
-Consider this type opaque.
-@end deftp
-
-
-@deftypefun FRAME gdb_get_innermost_frame ()
-Returns the innermost frame or the frame most recently designated
-as current by a call to gdb_set_current_frame.@*
-(get_current_frame)
-@end deftypefun
-
-
-@deftypefun FRAME gdb_get_caller_frame (FRAME @var{frame})
-Return the frame that called @var{frame}.@*
-If @var{frame} is the original frame (it has no caller), return 0.@*
-(get_prev_frame)
-@end deftypefun
-
-
-@deftypefun FRAME gdb_get_called_frame (FRAME @var{frame})
-Return the frame that @var{frame} calls (0 if @var{frame} is the innermost
-frame).@*
-(get_next_frame)
-@end deftypefun
-
-
-@deftypefun FRAME gdb_parse_frame_specification (char * @var{frame_exp})
-Read a frame specification in whatever the appropriate format is.
-Call @code{error}() If the specification is in any way invalid (i.e.
-this function never returns NULL).@*
-(parse_frame_specification)
-@end deftypefun
-
-
-@deftypefun CORE_ADDR get_frame_pc (FRAME @var{frame})@*
-(Example use: Implementing @code{disassemble_command})@*
-(get_frame_pc)
-@end deftypefun
-
-
-@deftypefun FRAME gdb_selected_frame ()
-The "selected" stack frame is used by default for local and
-arg access. May be @code{NULL}, for no selected frame.@*
-(variable selected_frame)
-@end deftypefun
-
-
-@deftypefun int gdb_selected_frame_level ()
-Level of the selected frame:@*
-0 for innermost,@*
-1 for its caller,@*
-or -1 for frame specified by address with no defined level.@*
-(variable selected_frame_level)
-@end deftypefun
-
-
-@deftypefun void gdb_select_frame (FRAME @var{frame}, int @var{level})
-Select frame @var{frame}, and note that its stack level is @var{level}.
-@var{level} may be -1 if an actual level number is not known.
-Calls @code{set_language} to establish the correct language for the
-selected frame.
-@end deftypefun
-
-
- -- IDIOM: Computing Frame Levels@*
-@example
-/* Try to figure out what level this frame is as before a
- call to gdb_select_frame. But if there is
- no current stack, don't error out, just pass -1
- instead. */
-frame1 = 0;
-level = -1;
-if (get_current_frame()) @{
- for (frame1 = get_prev_frame (0);
- frame1 && frame1 != frame;
- frame1 = get_prev_frame (frame1))
- level++;
-@}
-@end example
-
-
-@deftypefun void gdb_print_stack_frame (@var{cback}, @var{frame}, @var{level}, @var{source})
-@example
-struct gdb_stream_cback * @var{cback};
-FRAME @var{frame};
-int @var{level};
-int @var{source};
-@end example
-Print a stack frame briefly. @var{frame} should be the frame id
-and @var{level} should be its level in the stack (or -1 for level not defined).
-This prints the level, the function executing, the arguments,
-and the file name and line number.@*
-If the pc is not at the beginning of the source line,
-the actual pc is printed at the beginning.@*
-If @var{source} is 1, print the source line as well.@*
-If @var{source} is -1, print ONLY the source line.@*
-(print_stack_frame)
-@end deftypefun
-
-
-@deftypefun void gdb_print_backtrace (cback, @var{count}, @var{from_tty})
-@example
-struct gdb_stream_cback * @var{cback};
-int @var{count};
-int @var{from_tty};
-@end example
-Print briefly all stack frames or just the innermost @var{count} frames.@*
-(backtrace_command)
-@end deftypefun
-
-
-@deftypefun FRAME gdb_find_relative_frame (FRAME @var{frame}, int * @var{level_offset_ptr})
-Find a frame a certain number of levels away from @var{frame}.
-@var{level_offset_ptr} points to an int containing the number of levels.
-Positive means go to earlier frames (up); negative, the reverse.
-The int that contains the number of levels is counted toward
-zero as the frames for those levels are found.
-If the top or bottom frame is reached, that frame is returned,
-but the final value of @var{*level_offset_ptr} is nonzero and indicates
-how much farther the original request asked to go.
-@end deftypefun
-
-
-@deftypefun FRAME gdb_select_frame_downward (int @var{count})
-@deftypefunx FRAME gdb_select_frame_upward (int @var{count})
-Simply a combination of find_relative_frame and select_frame.
-Returns the newly selected frame.@*
-(down_silently_command, up_silently_command)
-@end deftypefun
-
-
-@deftypefun void gdb_frame_info (struct gdb_stream_cback * @var{cback}, FRAME @var{frame})
-Print verbosely the selected the argument @var{frame}.
-This means absolutely all information in the frame is printed.@*
-(frame_info)
-@end deftypefun
-
-
-@node Expressions, Values, Stack, top
-@comment node-name, next, previous, up
-@chapter How to Parse and Evaluate Expressions
-@cindex parsing
-@cindex expressions
-@cindex {expression evaluation}
-@cindex evaluation
-
-
-@deftp Type {struct expression *}
-This represents a parsed expression as might be used for a
-breakpoint condition.
-@end deftp
-
-
-@deftp Type {struct block}
-Describes a lexical environment.
-@end deftp
-
-See also `Values'
-See also `Examining'
-
-
-@deftypefun struct expression * parse_exp_1 (char ** @var{stringptr}, struct block * @var{block} int @var{comma})
-Read an expression from the string @code{*@var{stringptr}} points to,
-parse it, and return a pointer to a struct expression that we malloc.
-Use @var{block} as the lexical context for variable names;
-if @var{block} is zero, use the block of the selected stack frame.
-Meanwhile, advance @code{*@var{stringptr}} to point after the expression,
-at the first nonwhite character that is not part of the expression
-(possibly a null character).
-
-If @var{comma} is nonzero, stop if a comma is reached.
-(See `Stack' for information about the selected frame)
-@end deftypefun
-
-
-@deftypefun gdb_error_t gdb_evaluate_expression (value * @var{value_out}, struct expression * @var{exp})
-Evaluate an expression. See `values' for more information about
-the return type.@*
-(evaluate_expression)
-@end deftypefun
-
-
-@deftypefun value gdb_evaluate_type (struct expression @var{*exp})
-Evaluate an expression, avoiding all memory references
-and getting a value whose type alone is correct.@*
-(evaluate_type)
-@end deftypefun
-
-
-
-@node Values, Examining, Expressions, top
-@comment node-name, next, previous, up
-@chapter Data from the Inferior, the Values of Expressions
-@cindex values
-@cindex {expression values}
-
-Values are allocated by functions such as @code{gdb_evaluate_expression}.
-All currently allocated values are on the list @code{all_values} and can be
-freed by calling @code{gdb_free_all_values}.
-
-To preserve a value across calls to @code{gdb_free_all_values}, use
-@code{gdb_release_value}. Values added to the history list are automaticly
-released. To free a released value use @code{gdb_free_value}.
-
-
-@deftypefun void gdb_free_value (value)
-Free the memory associated with a released value.
-Do not call this function except on values that have been
-passed to @code{gdb_release_value}.@*
-(gdb_value_free)
-@end deftypefun
-
-
-@deftypefun void gdb_free_all_values (void)
-Free all allocated values which haven't been released.
-This should be called periodically from outside the dynamic
-scope of libgdb functions.@*
-(free_all_values)
-@end deftypefun
-
-
-@deftypefun void gdb_release_value (value @var{val})
-Remove a value from the list @code{all_values} in order to
-protect it from @code{gdb_free_all_values}.@*
-(release_value)
-@end deftypefun
-
-
-There is a `history list' -- a numbered list of values for
-future reference. These can be referred to in expressions,
-for example.
-
-@deftypefun int gdb_record_latest_value (value @var{val})
-Add a value to the history list.@*
-(record_latest_value)
-@end deftypefun
-
-
-@deftypefun value gdb_access_value_history (int @var{index})
-Retrieve a value from the history list.@*
-(access_value_history)
-@end deftypefun
-
-
-[[[At the moment, the only libgdb use for values is
- string formatting (see `Examining'). So, they are treated
- as opaque. It'd be useful to expose more of them in the long run.]]]
-
-
-@node Examining, Types, Values, top
-@comment node-name, next, previous, up
-@chapter Formatting Values as Strings
-@cindex examining
-@cindex printing
-@cindex formatting
-@cindex {pretty printing}
-
-
-Many functions in this section use @code{struct gdb_stream_cback}.
-That structure is explained in `Basics'.
-
-
-@deftypefun void gdb_print_formatted (struct gdb_stream_cback * @var{cback}, value @var{val}, int @var{format}, int @var{size})
-Print value @var{val} on a stream according to @var{format}, a letter or 0.
-Do not end with a newline.
-0 means print @var{val} according to its own type.
-@var{size} is the letter for the size of datum being printed.
-This is used to pad hex numbers so they line up.@*
-(print_formatted)
-@end deftypefun
-
-
-@deftypefun static void gdb_printf_command (struct gdb_stream_cback * @var{cback}, char * @var{format}, value * @var{values}, int @var{n_values})@*
-(printf_command)
-@end deftypefun
-
-
-@deftypefun int gdb_value_print (struct gdb_stream_cback * @var{cback}, @var{value}, int @var{format}, enum @var{val_prettyprint})
-Print the value @var{val} in C-ish syntax on @var{stream}.
-@var{format} is a format-letter, or 0 for print in natural format of data type.
-If the object printed is a string pointer, returns
-the number of string bytes printed.
-[[[implementation: watch the change in argument order]]]@*
-(value_print)
-@end deftypefun
-
-
- -- IDIOM: This prints the values of all convenience variables:
-@example
-for (var = internalvars; var; var = var->next)
-@{
-printf_filtered ("$%s = ", var->name);
-value_print (var->value, stdout, 0, Val_pretty_default);
-printf_filtered ("\n");
-@}
-@end example
-
-
-@deftypefun int gdb_print_insn (struct gdb_stream_cback * @var{cback}, CORE_ADDR @var{memaddr})
-Print the instruction at @var{memaddr} and return the
-length of the instruction in bytes.@*
-(print_insn)
-@end deftypefun
-
-
-@deftypefun void gdb_print_address (struct gdb_stream_cback * @var{cback}, CORE_ADDR @var{addr})
-Print address @var{addr} symbolically on @var{stream}.
-First print it as a number. Then perhaps print
-@code{<SYMBOL + OFFSET>} after the number.@*
-(print_address)
-@end deftypefun
-
-
- -- IDIOM: This is the core of a dissasemble command:
-@example
-for (pc = low; pc < high; )
-@{
- print_address (pc, stdout);
- printf_filtered (":\t");
- pc += print_insn (pc, stdout);
- printf_filtered ("\n");
-@}
-@end example
-Advice for computing pc extents like @code{low} and @code{high}
-can be found in `Symtabs' -- for example, @code{gdb_find_line_pc_range}.@*
-(disassemble_command)
-
-
-@deftypefun void gdb_print_registers (struct gdb_stream_cback * @var{cback}, int @var{regnum}, int @var{fpregs}, int @var{fancy})
-Print the values of registers.
-@var{regnum} can be -1 (print all the registers) or a specific register number.
-If @var{regnum} is -1, @var{fpregs} determines whether floating point registers are
-shown.@*
-(info registers, info all-registers, nofp_registers_info, all_registers_info)
-@end deftypefun
-
-
-@deftypefun char * gdb_register_name (int @var{i})
-Look up a register name by number.
-@end deftypefun
-
-
-@deftypefun int gdb_parse_register_name (char ** @var{name})
-Parse a register name and advance a text pointer.
-Return -1 for bogus names.
-@end deftypefun
-
-
-@deftypefun CORE_ADDR gdb_read_pc ()
-Return the contents of the inferior's program counter.
-@end deftypefun
-
-
-@deftypefun int gdb_is_stepping ()
-If true, the inferior is stopped after being stepped.
-@end deftypefun
-
-
-@deftypefun void gdb_current_breakpoints (gdb_int_cback)
-Call a callback for each of the current breakpoints.@*
-(program_info)
-@end deftypefun
-
-
-@deftypefun int gdb_stop_signal ()
-Return the signal that stopped the inferior.
-@end deftypefun
-
-
-@deftypefun char * strsigno (int)
-Return a symbolic name for a signal.
-@end deftypefun
-
-
-@deftypefun void gdb_target_info (struct gdb_stream_cback *)
-Print status information about target we're accessing.@*
-(target_files_info, e.g. child_files_info)
-@end deftypefun
-
-
-float_info
-[[[what is appropriate?]]]
-
-
-@deftypefun void gdb_address_info (struct gdb_stream_cback * @var{cback}, char * @var{symbol});
-Like the `info address' command -- show where @var{symbol}
-is located.@*
-(address_info)
-@end deftypefun
-
-
-@node Types, top, Examining, top
-@comment node-name, next, previous, up
-@chapter Examining the Types of an Inferior's Data
-@cindex types
-
-
-@deftp Type {struct type}
-@code{struct type *} is used to represent a type. For example, that is
-the type returned by the macro @code{VALUE_TYPE(val)} which yields the
-type of inferior data recorded in @code{val}. (see `evaluate_type' in
-`Expressions').
-@end deftp
-
-
-@deftypefun void type_print (@var{type}, @var{varstring}, @var{stream_cback}, @var{show})
-@example
-struct type @var{*type};
-char @var{*varstring};
-struct gdb_stream_cback * @var{stream_cback};
-FILE @var{*stream};
-int @var{show};
-@end example
-Print a description of a type @var{type} in the form of a declaration of a
-variable named @var{varstring}. (@var{varstring} is demangled if necessary.)
-Output goes to @var{stream_cback}.
-
-If @var{show} is positive, we show the contents of the outermost level
-of structure even if there is a type name that could be used instead.
-If @var{show} is negative, we never show the details of elements' types.
-(See `Basics' for an explanation of `struct gdb_stream_cback').
-@end deftypefun
-
-
-[[[In the long run, we need something to programmaticly read off type
- structures in a machine/language independent way.]]]
-
-@bye
diff --git a/gnu/usr.bin/gdb/doc/lpsrc.sed b/gnu/usr.bin/gdb/doc/lpsrc.sed
deleted file mode 100644
index 1c7af4a..0000000
--- a/gnu/usr.bin/gdb/doc/lpsrc.sed
+++ /dev/null
@@ -1,13 +0,0 @@
-/font defs: ---/,/end font defs ---/c\
-%-------------------- PostScript (long names) font defs: -----------------\
-\\font\\bbf=Times-Bold at 10pt\
-\\font\\vbbf=Times-Bold at 12pt\
-\\font\\smrm=Times-Roman at 6pt\
-\\font\\brm=Times-Roman at 10pt\
-\\font\\rm=Times-Roman at 8pt\
-\\font\\it=Times-Italic at 8pt\
-\\font\\tt=Courier at 8pt\
-% Used only for \copyright, replacing plain TeX macro.\
-\\font\\sym=Symbol at 7pt\
-\\def\\copyright{{\\sym\\char'323}}\
-%-------------------- end font defs ---------------------------------
diff --git a/gnu/usr.bin/gdb/doc/psrc.sed b/gnu/usr.bin/gdb/doc/psrc.sed
deleted file mode 100644
index 9bb557e..0000000
--- a/gnu/usr.bin/gdb/doc/psrc.sed
+++ /dev/null
@@ -1,13 +0,0 @@
-/font defs: ---/,/end font defs ---/c\
-%-------------------- PostScript (K Berry names) font defs: --------------\
-\\font\\bbf=ptmb at 10pt\
-\\font\\vbbf=ptmb at 12pt\
-\\font\\smrm=ptmr at 6pt\
-\\font\\brm=ptmr at 10pt\
-\\font\\rm=ptmr at 8pt\
-\\font\\it=ptmri at 8pt\
-\\font\\tt=pcrr at 8pt\
-% Used only for \copyright, replacing plain TeX macro.\
-\\font\\sym=psyr at 7pt\
-\\def\\copyright{{\\sym\\char'323}}\
-%-------------------- end font defs ---------------------------------
diff --git a/gnu/usr.bin/gdb/doc/refcard.ps b/gnu/usr.bin/gdb/doc/refcard.ps
deleted file mode 100644
index 0046b79..0000000
--- a/gnu/usr.bin/gdb/doc/refcard.ps
+++ /dev/null
@@ -1,798 +0,0 @@
-%!PS-Adobe-2.0
-%%Creator: dvips 5.47 Copyright 1986-91 Radical Eye Software
-%%Title: refcard.dvi
-%%Pages: 2 1
-%%BoundingBox: 0 0 612 792
-%%EndComments
-%%BeginProcSet: tex.pro
-/TeXDict 200 dict def TeXDict begin /N /def load def /B{bind def}N /S /exch
-load def /X{S N}B /TR /translate load N /isls false N /vsize 10 N /@rigin{
-isls{[0 1 -1 0 0 0]concat}if 72 Resolution div 72 VResolution div neg scale
-Resolution VResolution vsize neg mul TR matrix currentmatrix dup dup 4 get
-round 4 exch put dup dup 5 get round 5 exch put setmatrix}N /@letter{/vsize 10
-N}B /@landscape{/isls true N /vsize -1 N}B /@a4{/vsize 10.6929133858 N}B /@a3{
-/vsize 15.5531 N}B /@ledger{/vsize 16 N}B /@legal{/vsize 13 N}B /@manualfeed{
-statusdict /manualfeed true put}B /@copies{/#copies X}B /FMat[1 0 0 -1 0 0]N
-/FBB[0 0 0 0]N /nn 0 N /IE 0 N /ctr 0 N /df-tail{/nn 8 dict N nn begin
-/FontType 3 N /FontMatrix fntrx N /FontBBox FBB N string /base X array
-/BitMaps X /BuildChar{CharBuilder}N /Encoding IE N end dup{/foo setfont}2
-array copy cvx N load 0 nn put /ctr 0 N[}B /df{/sf 1 N /fntrx FMat N df-tail}
-B /dfs{div /sf X /fntrx[sf 0 0 sf neg 0 0]N df-tail}B /E{pop nn dup definefont
-setfont}B /ch-width{ch-data dup length 5 sub get}B /ch-height{ch-data dup
-length 4 sub get}B /ch-xoff{128 ch-data dup length 3 sub get sub}B /ch-yoff{
-ch-data dup length 2 sub get 127 sub}B /ch-dx{ch-data dup length 1 sub get}B
-/ch-image{ch-data dup type /stringtype ne{ctr get /ctr ctr 1 add N}if}B /id 0
-N /rw 0 N /rc 0 N /gp 0 N /cp 0 N /G 0 N /sf 0 N /CharBuilder{save 3 1 roll S
-dup /base get 2 index get S /BitMaps get S get /ch-data X pop /ctr 0 N ch-dx 0
-ch-xoff ch-yoff ch-height sub ch-xoff ch-width add ch-yoff setcachedevice
-ch-width ch-height true[1 0 0 -1 -.1 ch-xoff sub ch-yoff .1 add]{ch-image}
-imagemask restore}B /D{/cc X dup type /stringtype ne{]}if nn /base get cc ctr
-put nn /BitMaps get S ctr S sf 1 ne{dup dup length 1 sub dup 2 index S get sf
-div put}if put /ctr ctr 1 add N}B /I{cc 1 add D}B /bop{userdict /bop-hook
-known{bop-hook}if /SI save N @rigin 0 0 moveto}N /eop{clear SI restore
-showpage userdict /eop-hook known{eop-hook}if}N /@start{userdict /start-hook
-known{start-hook}if /VResolution X /Resolution X 1000 div /DVImag X /IE 256
-array N 0 1 255{IE S 1 string dup 0 3 index put cvn put}for}N /p /show load N
-/RMat[1 0 0 -1 0 0]N /BDot 260 string N /rulex 0 N /ruley 0 N /v{/ruley X
-/rulex X V}B /V statusdict begin /product where{pop product dup length 7 ge{0
-7 getinterval(Display)eq}{pop false}ifelse}{false}ifelse end{{gsave TR -.1 -.1
-TR 1 1 scale rulex ruley false RMat{BDot}imagemask grestore}}{{gsave TR -.1
--.1 TR rulex ruley scale 1 1 false RMat{BDot}imagemask grestore}}ifelse B /a{
-moveto}B /delta 0 N /tail{dup /delta X 0 rmoveto}B /M{S p delta add tail}B /b{
-S p tail}B /c{-4 M}B /d{-3 M}B /e{-2 M}B /f{-1 M}B /g{0 M}B /h{1 M}B /i{2 M}B
-/j{3 M}B /k{4 M}B /w{0 rmoveto}B /l{p -4 w}B /m{p -3 w}B /n{p -2 w}B /o{p -1 w
-}B /q{p 1 w}B /r{p 2 w}B /s{p 3 w}B /t{p 4 w}B /x{0 S rmoveto}B /y{3 2 roll p
-a}B /bos{/SS save N}B /eos{clear SS restore}B end
-%%EndProcSet
-TeXDict begin 1000 300 300 @start /Fa 3 104 df<0003FE0000000FFF8000003C01E000
-00F000780001C0001C00030000060006000003000C0000018018000000C018000000C030000000
-603000000060600000003060000000306000000030C000000018C000000018C000000018C00000
-0018C000000018C000000018C000000018C000000018C000000018600000003060000000306000
-0000303000000060300000006018000000C018000000C00C000001800600000300030000060001
-C0001C0000F0007800003C01E000000FFF80000003FE000025277E9D2A>13
-D<003C00E001C00180038003800380038003800380038003800380038003800380038003000700
-1C00F0001C00070003000380038003800380038003800380038003800380038003800380018001
-C000E0003C0E297D9E15>102 D<F0001C00070003000380038003800380038003800380038003
-800380038003800380018001C000E0003C00E001C0018003800380038003800380038003800380
-03800380038003800380030007001C00F0000E297D9E15>I E /Fb 1 59
-df<60F0F06004047C830C>58 D E /Fc 61 125 df<01F8000604000C0E00180E001800001800
-00180000FFFE001806001806001806001806001806001806001806001806001806001806001806
-007E1F801114809313>12 D<01FE00060E000C0E00180600180600180600180600FFFE00180600
-1806001806001806001806001806001806001806001806001806001806007E1F801114809313>
-I<4100E380618020802080208041004100820009097F9311>34 D<020002000F8032406220C210
-C270C270E220F2007F003FC00FE002E002704230E230C2308220426022C01F00020002000C187E
-9511>36 D<40E06020202040408003097D9309>39 D<01020408103020606040C0C0C0C0C0C0C0
-C0C0C040606020301008040201081E7E950D>I<80402010080C04060602030303030303030303
-03020606040C0810204080081E7E950D>I<006000006000006000006000006000006000006000
-006000006000006000FFFFF0FFFFF0006000006000006000006000006000006000006000006000
-00600000600014167E9119>43 D<40E06020202040408003097D8209>I<FFFF080280860B>I<40
-E04003037D8209>I<0010003000600060006000C000C000C00180018003000300030006000600
-06000C000C000C0018001800300030003000600060006000C000C0000C1D7E9511>I<0F0030C0
-606060604020C030C030C030C030C030C030C030C030C03040206060606030C00F000C137E9211
->I<0C001C00EC000C000C000C000C000C000C000C000C000C000C000C000C000C000C000C00FF
-C00A137D9211>I<1F0060C06060F070F030603000700070006000C001C0018002000400081010
-1020207FE0FFE00C137E9211>I<40E0400000000000000040E040030D7D8C09>58
-D<40E0400000000000000040E06020202040408003137D8C09>I<003000003000007800007800
-007800009C00009C00011E00010E00010E0002070002070004038007FF800403800801C00801C0
-1000E03800E0FE07FC16147F9319>65 D<FFFC001C07001C03801C01C01C01C01C01C01C01C01C
-03801C07001FFE001C03801C01C01C00E01C00E01C00E01C00E01C00E01C01C01C0380FFFE0013
-147F9317>I<00FC200703600C00E0180060300060700020600020E00000E00000E00000E00000
-E00000E000006000207000203000201800400C008007030000FC0013147E9318>I<FFFC001C07
-001C01C01C00E01C00601C00701C00301C00381C00381C00381C00381C00381C00381C00301C00
-701C00601C00E01C01C01C0380FFFC0015147F9319>I<FFFF801C03801C00801C00801C00401C
-00401C08401C08001C18001FF8001C18001C08001C08201C00201C00201C00601C00401C00C01C
-01C0FFFFC013147F9316>I<00FC200703600C00E0180060300060700020600020E00000E00000
-E00000E00000E00FF8E000E06000E07000E03000E01800E00C00E007036000FC2015147E931A>
-71 D<FFC0001C00001C00001C00001C00001C00001C00001C00001C00001C00001C00001C0000
-1C00401C00401C00401C00C01C00801C01801C0380FFFF8012147F9315>76
-D<FE000FE01E000F00170017001700170017001700138027001380270011C0470011C0470010E0
-870010E0870010E087001071070010710700103A0700103A0700101C0700101C0700381C0700FE
-083FE01B147F931E>I<FC01FC1E007017002017802013802011C02010E0201070201070201038
-20101C20100E20100F201007201003A01001E01000E01000E0380060FE002016147F9319>I<01
-F800070E001C03803801C03000C07000E0600060E00070E00070E00070E00070E00070E0007070
-00E07000E03000C03801C01C0380070E0001F80014147E9319>I<FFFC001C07001C03801C01C0
-1C01C01C01C01C01C01C01C01C03801C07001FFC001C00001C00001C00001C00001C00001C0000
-1C00001C0000FF800012147F9316>I<FFF8001C07001C03801C01C01C01C01C01C01C01C01C03
-801C07001FF8001C0E001C07001C03801C03801C03801C03801C03841C03841C01CCFF80F81614
-7F9318>82 D<7FFFF0607030407010407010807008807008807008007000007000007000007000
-00700000700000700000700000700000700000700000700007FF0015147F9318>84
-D<FF81FC1C00701C00201C00201C00201C00201C00201C00201C00201C00201C00201C00201C00
-201C00201C00200C00200E004006008003830000FC0016147F9319>I<FF1FF0FC380380303803
-80301C03C0201C03C0201E03C0600E04E0400E04E0400704E08007087080070870800388710003
-9039000390390001F03E0001E01E0001E01E0000C00C0000C00C0000C00C001E147F9321>87
-D<FF00FC3C00301E00200E004007004007808003C10001C10001E20000F6000074000038000038
-0000380000380000380000380000380000380001FF0016147F9319>89 D<208041004100820082
-008200C300E380410009097A9311>92 D<7F00E1C0E0404060006007E038606060C060C064C064
-61E43E380E0D7E8C11>97 D<F00030003000300030003000300033E034103808300C3006300630
-0630063006300C3808343023E00F147F9312>I<0FE0187020706020C000C000C000C000C00060
-00201018200FC00C0D7F8C0F>I<00780018001800180018001800180F98187820386018C018C0
-18C018C018C0186018203810580F9E0F147F9312>I<0F80104020206030C010FFF0C000C000C0
-006000201018200FC00C0D7F8C0F>I<03C00CE018E01840180018001800FF0018001800180018
-0018001800180018001800180018007F000B1480930A>I<0F3C30E62040606060606060204030
-C02F00600060003FE03FF06018C00CC00CC00C601830300FC00F147F8C11>I<F0003000300030
-0030003000300033E034303818301830183018301830183018301830183018FC7E0F147F9312>
-I<2070200000000000F03030303030303030303030FC06157F9409>I<02070200000000000F03
-0303030303030303030303030343E2E67C081B82940A>I<F00030003000300030003000300030
-F8306030403080330037003B80318030C0306030703030FC7C0E147F9311>I<F0303030303030
-303030303030303030303030FC06147F9309>I<F3E1F0343218381C0C30180C30180C30180C30
-180C30180C30180C30180C30180C30180CFC7E3F180D7F8C1B>I<F3E034303818301830183018
-301830183018301830183018FC7E0F0D7F8C12>I<0FC0186020106018C00CC00CC00CC00CC00C
-6018601838700FC00E0D7F8C11>I<F3E034303808300C30063006300630063006300C38083430
-33E030003000300030003000FC000F137F8C12>I<0F88184820386018C018C018C018C018C018
-6018203818580F9800180018001800180018007E0F137F8C11>I<F3C034E038E0304030003000
-300030003000300030003000FE000B0D7F8C0D>I<3E806180C080C080E0007E003F8003C080C0
-80C0C0C0E1809F000A0D7F8C0D>I<10001000100030007000FF80300030003000300030003000
-300030803080308011000E0009127F910D>I<F078301830183018301830183018301830183018
-303818580F9E0F0D7F8C12>I<F87C301830101820182018200C400C4006800680078003000300
-0E0D7F8C11>I<F87CF8707030305820305820188840188C40188C400D04800D06800D06800603
-00060300060300150D7F8C18>I<F87C303018600C400C800700030007800CC008E010603030F8
-7C0E0D7F8C11>I<F87C301830101820182018200C400C400680068007800300030002000200E6
-00E400E80070000E137F8C11>I<FFF0C06080C081C08180030006000C101810383030206060FF
-E00C0D7F8C0F>I<FFFFFFFF2001808821>124 D E /Fd 2 94 df<FEFEC0C0C0C0C0C0C0C0C0C0
-C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0FEFE07297C9E0C>91
-D<FEFE060606060606060606060606060606060606060606060606060606060606060606060606
-06FEFE0729809E0C>93 D E /Fe 27 123 df<001F8F000020D9800060990000C0300000C03000
-00C0300000C0300007FFFE000180300001806000018060000180600001806000030060000300C0
-000300C0000300C0000300C0000600C00006018000060180000601800004010000CCC30000C8C6
-000070780000191A819315>11 D<000FF000301800601000600000C00000C00000C00007FFE000
-C0600180600180C00180C00180C00180C00181800301900301900301900301A00300E006000006
-0000060000C40000C80000700000151A819314>I<FEFC07027D860C>45
-D<000080000180000300000300000600000600000C000018000018000030000030000060000060
-0000C0000180000180000300000300000600000C00000C00001800001800003000003000006000
-00C00000C00000800000111D7E9512>47 D<07C03F8000C00C0001600800016008000120080001
-300800023010000218100002181000020C1000040C200004042000040620000402200008034000
-080340000801C0000801C00018008000FE00800019147E9319>78 D<07B00C7010703060606060
-606060C0C0C0C8C0C841C862D03C700D0D7C8C12>97 D<7C000C00180018001800180030003700
-388030C060C060C060C060C0C180C180C1004300660038000A147C9310>I<07800C4010603040
-600060006000C000C0004020404021801E000B0D7C8C10>I<007C000C00180018001800180030
-07B00C7010703060606060606060C0C0C0C8C0C841C862D03C700E147C9312>I<07800C401020
-304060407F8060004000C0004020604021801E000B0D7C8C10>I<001C00660064006000C000C0
-00C007F800C001800180018001800180030003000300030003000200060006000600C400C80070
-000F1A81930B>I<01D8023804380C3018301830183030603060306010E019C00EC000C000C001
-80C180C3007C000D137E8C10>I<3E0006000C000C000C000C00180019E01E3018303830303030
-3030306060606460C460C4C0C8C0700E147D9312>I<02060000000000384C4C8C981818303262
-62643807147D930B>I<7C0C181818183030303060606060C0D0D0D0D06006147C9309>108
-D<30F878590D8C4E0E0C9C0E0C980C0C180C0C180C0C3018183018193018313018316030326030
-1C180D7D8C1C>I<30F05B184C189C189818181818183030303230623062606460380F0D7D8C13>
-I<03800C6018203030603060306030C060C06040C0608023001E000C0D7C8C12>I<0C78168C13
-0426062606060606060C0C0C0C0C080C101A2019C018001800300030003000FC000F137F8C12>
-I<31F05A184C109C009800180018003000300030003000600060000D0D7D8C0F>114
-D<0700188018C0308038001E001F0003800180C180810082007C000A0D7D8C0E>I<04000C000C
-000C001800FF8018001800300030003000300060006100610062006400380009127D910C>I<38
-184C184C188C3098301830183030603064306430E411E80E380E0D7D8C12>I<38104C384C108C
-10981018101810302030203040304018800F000D0D7D8C10>I<071E09E311C221802180018001
-800300030403044308C51078E0100D7F8C10>120 D<38184C184C188C30983018301830306030
-60306030E011C00EC000C000802180630046003C000D137D8C11>I<06100F2010E00040008001
-0002000C00102020203840478083000C0D7E8C0E>I E /Ff 55 123 df<0100030003000F803F
-E073704338C338C338C31073007F003FC00FE003F003384318E318E318E33073603FC00F800300
-030001000D1A7E9612>36 D<07001F8019C039C039C039C039BE3B3E3E701C701C701CE03EE06F
-E0E7C0E3C4E38E63CE7EFC3C380F147F9312>38 D<070007000700E738FFF87FF01FC01FC07FF0
-FFF8E7380700070007000D0E7E9012>42 D<038003800380038003800380FFFEFFFEFFFE038003
-8003800380038003800F0F7F9112>I<60F0F878183030E0C00509798312>I<FFF8FFF8FFF80D03
-7E8B12>I<60F0F0600404798312>I<0018003800380070007000E000E001C001C001C003800380
-070007000E000E001C001C001C003800380070007000E000E000C0000D1A7E9612>I<07C00FE0
-1C703838701C701CE00EE00EE00EE00EE00EE00EE00EE01E701C701C38381C700FE007C00F147F
-9312>I<0F803FC070E0E070E038E038403800380030007000E000C00180030006000C00183830
-387FF87FF80D147E9312>50 D<0FE03FF07838701C201C001C0038007807E007F00038001C000E
-000E400EE00EE01C78383FF00FC00F147F9312>I<E000FFFEFFFEE018E038007000E000C001C0
-0380038007000700070007000E000E000E000E000E0004000F157F9412>55
-D<60F0F06000000000000060F0F060040E798D12>58 D<0038007801F003E00F801F003C00F800
-F000F8003C001F000F8003E001F0007800380D117E9212>60 D<FFFEFFFE7FFE0000000000007F
-FEFFFEFFFE0F097F8E12>I<4000E000F0007C003E000F8007C001E000F8007800F801E007C00F
-803E007C00F000E00040000D137E9312>I<03E007F01E18381C30FC71FE739EE30EE70EE70EE7
-0EE70EE30C739C71F830F038001E0E07FE03F80F147F9312>64 D<03E60FFE1C3E381E700E700E
-600EE000E000E000E000E000E000600E700E700E381C1C380FF003E00F147F9312>67
-D<FFFEFFFE380E380E380E3800380038E038E03FE03FE038E038E03800380E380E380E380EFFFE
-FFFE0F147F9312>69 D<FFFEFFFE380E380E380E3800380038E038E03FE03FE038E038E0380038
-00380038003800FF00FF000F147F9312>I<FFE0FFE00E000E000E000E000E000E000E000E000E
-000E000E000E000E000E000E000E00FFE0FFE00B147D9312>73 D<FC7EFC7E7C7C745C76DC76DC
-76DC76DC76DC76DC77DC739C739C701C701C701C701C701CF83EF83E0F147F9312>77
-D<FEFEFEFE3E383A383B383B383B383B383B383B3839B839B839B839B839B839B838B838F8FEF8
-FEF80F147F9312>I<3FE07FF07070E038E038E038E038E038E038E038E038E038E038E038E038
-E038E03870707FF03FE00D147E9312>I<FFE0FFF8383C381C380E380E380E380E381C383C3FF8
-3FE0380038003800380038003800FE00FE000F147F9312>I<FF80FFE038F03878383838383838
-387838F03FE03FC038E0387038703870387038773877FE3EFE1C10147F9312>82
-D<1F303FF070F0E070E070E070E00070007F003FC00FE000F0003800386038E038E030F070FFE0
-CF800D147E9312>I<7FFEFFFEE38EE38EE38E0380038003800380038003800380038003800380
-0380038003801FF01FF00F147F9312>I<FE3F80FE3F80380E00380E00380E00380E00380E0038
-0E00380E00380E00380E00380E00380E00380E00380E00380E001C1C000E380007F00003E00011
-14809312>I<3F807FC070E0207000700FF03FF07870E070E070E07070F03FFE1F3E0F0E7E8D12>
-97 D<F800F80038003800380038003BE03FF03C38381C380C380E380E380E380E380C381C3C38
-3FF01BC00F147F9312>I<07F01FF8383870106000E000E000E000E0006000703838381FF007E0
-0D0E7E8D12>I<00F800F8003800380038003807B81FF8387870386038E038E038E038E0386038
-707838781FFE0FBE0F147F9312>I<07801FE0387070706038E038FFF8FFF8E000600070383838
-1FF007C00D0E7E8D12>I<007E00FF01C70382038003807FFEFFFE038003800380038003800380
-03800380038003803FF83FF81014809312>I<0F9E1FFF38E7707070707070707038E03FC03F80
-70003FE03FF83FFC701EE00EE00EE00E600C783C1FF00FE010167F8D12>I<F800F80038003800
-3800380039E03FF03E383C3838383838383838383838383838383838FE3EFE3E0F147F9312>I<
-06000F000F000600000000000000FF00FF000700070007000700070007000700070007000700FF
-F0FFF00C157D9412>I<00C001E001E000C00000000000001FE01FE000E000E000E000E000E000
-E000E000E000E000E000E000E000E000E000E040C0E1C0FF807E000B1C7E9412>I<F800F80038
-003800380038003BFC3BFC38F039E03BC03F803F803FC03DE038E038703838FC7EFC7E0F147F93
-12>I<FF00FF000700070007000700070007000700070007000700070007000700070007000700
-FFF8FFF80D147E9312>I<F71C00FFBE0079E70079E70071C70071C70071C70071C70071C70071
-C70071C70071C700F9E780F8E380110E808D12>I<F9E0FFF03E383C3838383838383838383838
-383838383838FE3EFE3E0F0E7F8D12>I<0F803FE038E07070E038E038E038E038E038F0787070
-38E03FE00F800D0E7E8D12>I<FBE0FFF03C38381C380C380E380E380E380E380C381C3C383FF0
-3BC038003800380038003800FE00FE000F157F8D12>I<079C1FFC387C703C601CE01CE01CE01C
-E01C601C703C387C1FFC079C001C001C001C001C001C007F007F10157F8D12>I<FCF8FDFC1F1C
-1E081E001C001C001C001C001C001C001C00FFC0FFC00E0E7E8D12>I<1FF03FF06070C070E000
-7F003FE00FF000786018E018F030FFE0DFC00D0E7E8D12>I<06000E000E000E007FF8FFF80E00
-0E000E000E000E000E000E000E380E380E3807F003C00D127F9112>I<F8F8F8F8383838383838
-38383838383838383838383838781FFE0FBE0F0E7F8D12>I<FC7EFC7E38383C781C701C701C70
-0EE00EE00EE006C007C007C003800F0E7F8D12>I<FEFEFEFE701C701C301838383BB83FF83FF8
-3AB838B81CF01CF01CF00F0E7F8D12>I<7C7C7C7C1CF00EE00FC007C00380078007C00EE01EF0
-1C70FC7EFC7E0F0E7F8D12>I<FC7EFC7E3C381C381C701C700E700E600E6006E006E003C003C0
-03C0038003800380778077007E003C000F157F8D12>I<3FFC7FFC7038707000E001C003800700
-0E001C1C381C701CFFFCFFFC0E0E7F8D12>I E /Fg 35 122 df<00038000000380000007C000
-0007C0000007C000000FE000000FE000001FF000001BF000001BF0000031F8000031F8000061FC
-000060FC0000E0FE0000C07E0000C07E0001803F0001FFFF0003FFFF8003001F8003001F800600
-0FC006000FC00E000FE00C0007E0FFC07FFEFFC07FFE1F1C7E9B24>65 D<FFFFF800FFFFFF000F
-C01F800FC00FC00FC007C00FC007E00FC007E00FC007E00FC007E00FC007E00FC007C00FC00F80
-0FC03F000FFFFE000FC00F800FC007C00FC007E00FC003E00FC003F00FC003F00FC003F00FC003
-F00FC003F00FC007E00FC007E00FC01FC0FFFFFF00FFFFFC001C1C7E9B22>I<001FE02000FFF8
-E003F80FE007C003E00F8001E01F0000E03E0000E03E0000607E0000607C000060FC000000FC00
-0000FC000000FC000000FC000000FC000000FC000000FC0000007C0000607E0000603E0000603E
-0000C01F0000C00F80018007C0030003F80E0000FFFC00001FE0001B1C7D9B22>I<FFFFF800FF
-FFFF000FC01FC00FC007E00FC001F00FC001F80FC000F80FC000FC0FC0007C0FC0007C0FC0007E
-0FC0007E0FC0007E0FC0007E0FC0007E0FC0007E0FC0007E0FC0007E0FC0007C0FC0007C0FC000
-7C0FC000F80FC000F80FC001F00FC007E00FC01FC0FFFFFF00FFFFF8001F1C7E9B25>I<FFFFFF
-00FFFFFF000FC01F000FC007000FC003000FC003800FC003800FC181800FC181800FC181800FC1
-80000FC380000FFF80000FFF80000FC380000FC180000FC180000FC180600FC180600FC000E00F
-C000C00FC000C00FC001C00FC001C00FC003C00FC00F80FFFFFF80FFFFFF801B1C7E9B1F>I<FF
-FFFF00FFFFFF000FC01F000FC007000FC003000FC003800FC003800FC001800FC181800FC18180
-0FC180000FC180000FC380000FFF80000FFF80000FC380000FC180000FC180000FC180000FC180
-000FC000000FC000000FC000000FC000000FC000000FC00000FFFF0000FFFF0000191C7E9B1E>
-I<000FF008007FFE3801FC07F807E001F80F8000781F0000783F0000383E0000387E0000187C00
-0018FC000000FC000000FC000000FC000000FC000000FC000000FC007FFFFC007FFF7C0001F87E
-0001F83E0001F83F0001F81F0001F80F8001F807E001F801FC07F8007FFE78000FF818201C7D9B
-26>I<FFFC3FFFFFFC3FFF0FC003F00FC003F00FC003F00FC003F00FC003F00FC003F00FC003F0
-0FC003F00FC003F00FC003F00FFFFFF00FFFFFF00FC003F00FC003F00FC003F00FC003F00FC003
-F00FC003F00FC003F00FC003F00FC003F00FC003F00FC003F00FC003F0FFFC3FFFFFFC3FFF201C
-7E9B25>I<FFFF00FFFF000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000F
-C0000FC0000FC0000FC0000FC0000FC0000FC0030FC0030FC0030FC0070FC0070FC0060FC00E0F
-C01E0FC07EFFFFFEFFFFFE181C7E9B1D>76 D<FFE003FFFFE003FF0FF000300FF800300DFC0030
-0CFE00300C7E00300C3F00300C1F80300C1FC0300C0FE0300C07F0300C03F0300C01F8300C01FC
-300C00FE300C007F300C003F300C001FB00C001FF00C000FF00C0007F00C0003F00C0001F00C00
-00F00C0000F0FFC00070FFC00030201C7E9B25>78 D<FFFFF800FFFFFE000FC03F800FC00F800F
-C007C00FC007E00FC007E00FC007E00FC007E00FC007E00FC007C00FC007C00FC00F800FC03F00
-0FFFFC000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000
-000FC000000FC00000FFFC0000FFFC00001B1C7E9B21>80 D<07F8201FFEE03C07E07801E07000
-E0F000E0F00060F00060F80000FE0000FFE0007FFE003FFF003FFF800FFFC007FFE0007FE00003
-F00001F00000F0C000F0C000F0C000E0E000E0F001C0FC03C0EFFF0083FC00141C7D9B1B>83
-D<7FFFFFE07FFFFFE0781F81E0701F80E0601F8060E01F8070C01F8030C01F8030C01F8030C01F
-8030001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F800000
-1F8000001F8000001F8000001F8000001F8000001F8000001F800007FFFE0007FFFE001C1C7E9B
-21>I<FFFC03FFFFFC03FF0FC000300FC000300FC000300FC000300FC000300FC000300FC00030
-0FC000300FC000300FC000300FC000300FC000300FC000300FC000300FC000300FC000300FC000
-300FC000300FC0003007C0003007C0006003E000E001F001C000FC0780007FFE00000FF800201C
-7E9B25>I<FFFC7FFE0FFCFFFC7FFE0FFC0FC007E000C00FC007F000C00FE003F001C007E003F0
-018007E007F8018003F007F8030003F007F8030003F80CFC070001F80CFC060001F81CFE060001
-FC187E0E0000FC187E0C0000FC387F0C00007E303F1800007E303F1800007F601FB800003F601F
-B000003FE01FF000003FC00FF000001FC00FE000001FC00FE000000F8007C000000F8007C00000
-0F0003C0000007000380000007000380002E1C7F9B31>87 D<0FF8001C1E003E0F803E07803E07
-C01C07C00007C0007FC007E7C01F07C03C07C07C07C0F807C0F807C0F807C0780BC03E13F80FE1
-F815127F9117>97 D<FF0000FF00001F00001F00001F00001F00001F00001F00001F00001F0000
-1F00001F3F801FE1E01F80701F00781F003C1F003C1F003E1F003E1F003E1F003E1F003E1F003E
-1F003C1F003C1F00781F80701EC1E01C3F00171D7F9C1B>I<03FC000E0E001C1F003C1F00781F
-00780E00F80000F80000F80000F80000F80000F800007800007801803C01801C03000E0E0003F8
-0011127E9115>I<000FF0000FF00001F00001F00001F00001F00001F00001F00001F00001F000
-01F001F9F00F07F01C03F03C01F07801F07801F0F801F0F801F0F801F0F801F0F801F0F801F078
-01F07801F03C01F01C03F00F0FFE03F9FE171D7E9C1B>I<01FC000F07001C03803C01C07801C0
-7801E0F801E0F801E0FFFFE0F80000F80000F800007800007C00603C00601E00C00F038001FC00
-13127F9116>I<03F8F00E0F381E0F381C07303C07803C07803C07803C07801C07001E0F000E0E
-001BF8001000001800001800001FFF001FFFC00FFFE01FFFF07801F8F00078F00078F000787000
-707800F01E03C007FF00151B7F9118>103 D<FF0000FF00001F00001F00001F00001F00001F00
-001F00001F00001F00001F00001F0FC01F31E01F40F01F80F81F80F81F00F81F00F81F00F81F00
-F81F00F81F00F81F00F81F00F81F00F81F00F81F00F8FFE7FFFFE7FF181D7F9C1B>I<1E003F00
-3F003F003F001E00000000000000000000000000FF00FF001F001F001F001F001F001F001F001F
-001F001F001F001F001F001F00FFE0FFE00B1E7F9D0E>I<FF0000FF00001F00001F00001F0000
-1F00001F00001F00001F00001F00001F00001F0FF81F0FF81F03801F07001F0C001F18001F7000
-1FF8001FFC001FBC001F3E001F1F001F0F001F0F801F07C01F03E0FFC7FCFFC7FC161D7F9C19>
-107 D<FF00FF001F001F001F001F001F001F001F001F001F001F001F001F001F001F001F001F00
-1F001F001F001F001F001F001F001F001F00FFE0FFE00B1D7F9C0E>I<FF0FC07E00FF31E18F00
-1F40F207801F80FC07C01F80FC07C01F00F807C01F00F807C01F00F807C01F00F807C01F00F807
-C01F00F807C01F00F807C01F00F807C01F00F807C01F00F807C01F00F807C0FFE7FF3FF8FFE7FF
-3FF825127F9128>I<FF0FC0FF31E01F40F01F80F81F80F81F00F81F00F81F00F81F00F81F00F8
-1F00F81F00F81F00F81F00F81F00F81F00F8FFE7FFFFE7FF18127F911B>I<01FC000F07801C01
-C03C01E07800F07800F0F800F8F800F8F800F8F800F8F800F8F800F87800F07800F03C01E01E03
-C00F078001FC0015127F9118>I<FF3F80FFE1E01F80F01F00781F007C1F003C1F003E1F003E1F
-003E1F003E1F003E1F003E1F003C1F007C1F00781F80F01FC1E01F3F001F00001F00001F00001F
-00001F00001F0000FFE000FFE000171A7F911B>I<FE3E00FE47001E8F801E8F801E8F801F0700
-1F00001F00001F00001F00001F00001F00001F00001F00001F00001F0000FFF000FFF00011127F
-9114>114 D<1FD830786018E018E018F000FF807FE07FF01FF807FC007CC01CC01CE01CE018F8
-30CFC00E127E9113>I<0300030003000300070007000F000F003FFCFFFC1F001F001F001F001F
-001F001F001F001F001F0C1F0C1F0C1F0C0F08079803F00E1A7F9913>I<FF07F8FF07F81F00F8
-1F00F81F00F81F00F81F00F81F00F81F00F81F00F81F00F81F00F81F00F81F00F81F01F80F01F8
-0786FF01F8FF18127F911B>I<FFC7FCFFC7FC1F81800F838007C70003EE0001FC0001F80000F8
-00007C0000FE0001DF00039F00070F800607C00C03E0FF07FCFF07FC16127F9119>120
-D<FFC1FCFFC1FC1F00601F80E00F80C00FC0C007C18007C18003E30003E30001F70001F60000FE
-0000FC0000FC00007800007800003000003000007000706000F86000F8C000F980007300003E00
-00161A7F9119>I E /Fh 47 122 df<020408103020604040C0C0C0C0C0C0C0C0404060203010
-080402071A7F920C>40 D<8040201018080C0404060606060606060604040C081810204080071A
-7E920C>I<40E060202040408003087E8209>44 D<40E04003037E8209>46
-D<0C003C00CC000C000C000C000C000C000C000C000C000C000C000C000C00FF8009107E8F0F>
-49 D<1F00618040C08060C0600060006000C00180030006000C00102020207FC0FFC00B107F8F
-0F>I<1F00218060C060C000C0008001800F00008000400060C060C060804060801F000B107F8F
-0F>I<0300030007000F000B001300330023004300C300FFE003000300030003001FE00B107F8F
-0F>I<1F00318060C0C040C060C060C06040E021E01E600060004060C0608043003E000B107F8F
-0F>57 D<40E040000000000040E060202040408003107E8A09>59 D<03E0000C180010040023C2
-004631004C0D00980C80980C80980C80980C80980C804C0C80463C8023C7001000000C038003FC
-0011117E9017>64 D<FFF8180C18061803180318031806181C1FFC180618031803180318031806
-180EFFF810117F9015>66 D<03F10C0B1807300360014001C000C000C000C000C0004001600130
-0218020C0C03F010117E9016>I<FFF800180C001803001801001801801800801800C01800C018
-00C01800C01800C01800C0180180180100180300180E00FFF80012117F9017>I<FFFE18061802
-180318011821182018601FE01860182018201800180018001800FF0010117F9014>70
-D<03F1000C0B00180700300300600100400100C00000C00000C00000C03FC0C003004003006003
-003003001803000C070003F90012117E9017>I<FF181818181818181818181818181818FF0811
-7F900B>73 D<FF0018001800180018001800180018001800180018021802180218061804181CFF
-FC0F117F9013>76 D<F81FC01C07001C020016020013020013020011820010C20010C200106200
-103200101200101A00100E00100600380600FE020012117F9016>78 D<FFF0181C180418061806
-18061804181C1FF01800180018001800180018001800FF000F117F9014>80
-D<FFE000181800180C00180600180600180600180C001818001FE000181800180C00180C00180C
-00180C00180C20180420FF03C013117F9016>82 D<1F2060E0006080208020800060003E001F80
-00C00060002080208020C040E0C09F000B117E9011>I<7FFF8060C18040C080C0C0C080C04080
-C04000C00000C00000C00000C00000C00000C00000C00000C00000C00000C0000FFC0012117F90
-16>I<FF1FC0180700180200180200180200180200180200180200180200180200180200180200
-1802000802000C040006080001F00012117F9016>I<FC07C03003003003001802001802000C04
-000C040006080006080006080003100003100001A00001A00001E00000C00000C00012117F9016
->I<3E006300018001800F8031804180C190C19063903DE00C0B7F8A0F>97
-D<F0003000300030003000300037C038603030301830183018301830183030386027800D117F90
-11>I<1F8030C06000C000C000C000C000C000604030801F000A0B7F8A0E>I<01E0006000600060
-006000600F6030E06060C060C060C060C060C060606030E01F780D117F9011>I<1F00318060C0
-C0C0FFC0C000C000C000604030801F000A0B7F8A0E>I<07000D801800180018001800FE001800
-180018001800180018001800180018007E00091180900A>I<1EF0331061806180618033003E00
-400060003F803FC060E0C060C060C06060C01F000C117F8A0F>I<F00030003000300030003000
-33C03C6030603060306030603060306030603060FCF80D117F9011>I<30703000000000F03030
-30303030303030FC0612809108>I<F0003000300030003000300031F030C03080330036003F00
-3300318031C030C0F9F00C117F9010>107 D<F0303030303030303030303030303030FC061180
-9008>I<F3C3C03C2C20383830303030303030303030303030303030303030303030FCFCFC160B
-7F8A1A>I<F3C03C6030603060306030603060306030603060FCF80D0B7F8A11>I<1F00318060C0
-C060C060C060C060C06060C031801F000B0B7F8A0F>I<F7C03860303030183018301830183018
-3030386037803000300030003000FC000D107F8A11>I<F7003980300030003000300030003000
-30003000FC00090B7F8A0C>114 D<3E028280783E038181C2BC080B7F8A0C>I<10103030FE3030
-303030323232321C070F7F8E0C>I<F1E03060306030603060306030603060306030E00F780D0B
-7F8A11>I<F8F0706030403040188018800D000D000D00060006000C0B7F8A10>I<F9F3C060E180
-30E10030E1003131001932001A12000E1C000E1C000C0C00040800120B7F8A16>I<F8F0306030
-403040188018800D000D000F000600060004000400CC00C80070000C107F8A10>121
-D E /Fi 12 86 df<FFFFFF8000FFFFFFE00007F001F80007F000FC0007F0007E0007F0007E00
-07F0007F0007F0007F0007F0007F0007F0007F0007F0007F0007F0007E0007F000FE0007F000FC
-0007F003F80007FFFFF00007FFFFF00007F001FC0007F0007E0007F0003F0007F0003F8007F000
-1F8007F0001FC007F0001FC007F0001FC007F0001FC007F0001FC007F0001FC007F0003F8007F0
-003F8007F0007F0007F001FE00FFFFFFF800FFFFFFC00022227EA128>66
-D<0003FE0080001FFF818000FF01E38001F8003F8003E0001F8007C0000F800F800007801F8000
-07803F000003803F000003807F000001807E000001807E00000180FE00000000FE00000000FE00
-000000FE00000000FE00000000FE00000000FE00000000FE000000007E000000007E000001807F
-000001803F000001803F000003801F800003000F8000030007C000060003F0000C0001F8003800
-00FF00F000001FFFC0000003FE000021227DA128>I<FFFFFF8000FFFFFFF00007F003FC0007F0
-007E0007F0003F0007F0001F8007F0000FC007F00007E007F00007E007F00007F007F00003F007
-F00003F007F00003F007F00003F807F00003F807F00003F807F00003F807F00003F807F00003F8
-07F00003F807F00003F807F00003F807F00003F007F00003F007F00003F007F00007E007F00007
-E007F0000FC007F0001F8007F0003F0007F0007E0007F003FC00FFFFFFF000FFFFFF800025227E
-A12B>I<FFFFFFFCFFFFFFFC07F000FC07F0003C07F0001C07F0000C07F0000E07F0000E07F000
-0607F0180607F0180607F0180607F0180007F0380007F0780007FFF80007FFF80007F0780007F0
-380007F0180007F0180007F0180307F0180307F0000307F0000607F0000607F0000607F0000E07
-F0000E07F0001E07F0003E07F001FCFFFFFFFCFFFFFFFC20227EA125>I<FFFFFFF8FFFFFFF807
-F001F807F0007807F0003807F0001807F0001C07F0001C07F0000C07F0000C07F0180C07F0180C
-07F0180007F0180007F0380007F0780007FFF80007FFF80007F0780007F0380007F0180007F018
-0007F0180007F0180007F0000007F0000007F0000007F0000007F0000007F0000007F0000007F0
-0000FFFFE000FFFFE0001E227EA123>I<0003FE0040001FFFC0C0007F00F1C001F8003FC003F0
-000FC007C00007C00FC00003C01F800003C03F000001C03F000001C07F000000C07E000000C07E
-000000C0FE00000000FE00000000FE00000000FE00000000FE00000000FE00000000FE00000000
-FE000FFFFC7E000FFFFC7F00001FC07F00001FC03F00001FC03F00001FC01F80001FC00FC0001F
-C007E0001FC003F0001FC001FC003FC0007F80E7C0001FFFC3C00003FF00C026227DA12C>I<FF
-FFE0FFFFE003F80003F80003F80003F80003F80003F80003F80003F80003F80003F80003F80003
-F80003F80003F80003F80003F80003F80003F80003F80003F80003F80003F80003F80003F80003
-F80003F80003F80003F80003F80003F800FFFFE0FFFFE013227FA115>73
-D<FFFF803FFCFFFF803FFC07F000038007F000070007F0000E0007F000180007F000300007F000
-E00007F001C00007F003800007F007000007F00E000007F018000007F038000007F0FC000007F1
-FE000007F3FE000007F77F000007FE7F800007F83F800007F01FC00007F01FE00007F00FE00007
-F007F00007F007F80007F003F80007F001FC0007F001FE0007F000FF0007F0007F0007F0007F80
-07F0003FC0FFFF83FFFCFFFF83FFFC26227EA12C>75 D<FFF8001FFEFFFC001FFE07FC0000C007
-FE0000C006FF0000C0067F8000C0063FC000C0061FE000C0060FE000C0060FF000C00607F800C0
-0603FC00C00601FE00C00600FE00C00600FF00C006007F80C006003FC0C006001FE0C006000FF0
-C0060007F0C0060007F8C0060003FCC0060001FEC0060000FFC00600007FC00600007FC0060000
-3FC00600001FC00600000FC006000007C006000003C006000003C0FFF00001C0FFF00000C02722
-7EA12C>78 D<0007FC0000003FFF800000FC07E00003F001F80007E000FC000FC0007E001F8000
-3F001F80003F003F00001F803F00001F807F00001FC07E00000FC07E00000FC0FE00000FE0FE00
-000FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE07E
-00000FC07F00001FC07F00001FC03F00001F803F81F03F801F83F83F000FC70C7E0007E606FC00
-03F607F80000FF07E000003FFF80000007FF80200000038020000001C020000001E0E0000001FF
-E0000001FFC0000000FFC0000000FFC00000007F800000007F000000001E00232C7DA12A>81
-D<FFFFFE0000FFFFFFC00007F007F00007F001F80007F000FC0007F0007E0007F0007F0007F000
-7F0007F0007F0007F0007F0007F0007F0007F0007F0007F0007E0007F000FC0007F001F80007F0
-07F00007FFFFC00007FFFF800007F00FE00007F007F00007F003F80007F001FC0007F001FC0007
-F001FC0007F001FC0007F001FC0007F001FC0007F001FC0007F001FC0007F001FC0607F000FE06
-07F000FF0CFFFF803FF8FFFF800FF027227EA12A>I<FFFF803FFCFFFF803FFC07F000018007F0
-00018007F000018007F000018007F000018007F000018007F000018007F000018007F000018007
-F000018007F000018007F000018007F000018007F000018007F000018007F000018007F0000180
-07F000018007F000018007F000018007F000018007F000018007F000018007F000018003F00003
-0003F800030001F800060000FC000E00007E001C00003F80F800000FFFE0000001FF000026227E
-A12B>85 D E end
-%%EndProlog
-%%BeginSetup
-%%Feature: *Resolution 300
-TeXDict begin @landscape
-%%EndSetup
-%%Page: 1 1
-bop -225 -183 a Fi(GDB)14 b(QUICK)g(REFERENCE)22 b Fh(GDB)14
-b(V)n(ersion)h(4)-225 -91 y Fg(Essen)o(tial)c(Commands)-225
--45 y Ff(gdb)i Fe(pr)n(o)n(gr)n(am)f Fd([)p Fe(c)n(or)n(e)p
-Fd(])24 b Fc(debug)14 b Fe(pr)n(o)n(gr)n(am)e Fd([)p Fc(using)i(coredump)g
-Fe(c)n(or)n(e)p Fd(])-225 9 y Ff(b)f Fd([)p Fe(\014le)p Ff(:)p
-Fd(])p Fe(function)68 b Fc(set)13 b(breakp)q(oin)o(t)i(at)e
-Fe(function)g Fd([)p Fc(in)h Fe(\014le)p Fd(])-225 63 y Ff(run)f
-Fd([)p Fe(ar)n(glist)p Fd(])126 b Fc(start)13 b(y)o(our)h(program)f
-Fd([)p Fc(with)h Fe(ar)n(glist)p Fd(])-225 106 y Ff(bt)274
-b Fc(bac)o(ktrace:)20 b(displa)o(y)c(program)d(stac)o(k)-225
-143 y Ff(p)g Fe(expr)214 b Fc(displa)o(y)15 b(the)f(v)n(alue)h(of)e(an)h
-(expression)-225 180 y Ff(c)292 b Fc(con)o(tin)o(ue)14 b(running)h(y)o(our)f
-(program)-225 218 y Ff(n)292 b Fc(next)14 b(line,)h(stepping)g(o)o(v)o(er)f
-(function)g(calls)-225 255 y Ff(s)292 b Fc(next)14 b(line,)h(stepping)g(in)o
-(to)f(function)h(calls)-225 352 y Fg(Starting)c(GDB)-225 398
-y Ff(gdb)256 b Fc(start)13 b(GDB,)h(with)g(no)g(debugging)g(\014les)-225
-435 y Ff(gdb)f Fe(pr)n(o)n(gr)n(am)121 b Fc(b)q(egin)14 b(debugging)g
-Fe(pr)n(o)n(gr)n(am)-225 472 y Ff(gdb)f Fe(pr)n(o)n(gr)n(am)f(c)n(or)n(e)48
-b Fc(debug)14 b(coredump)g Fe(c)n(or)n(e)f Fc(pro)q(duced)h(b)o(y)105
-510 y Fe(pr)n(o)n(gr)n(am)-225 548 y Ff(gdb)f(--help)135 b
-Fc(describ)q(e)14 b(command)g(line)g(options)-225 647 y Fg(Stopping)c(GDB)
--225 692 y Ff(quit)238 b Fc(exit)14 b(GDB;)g(also)g Ff(q)f
-Fc(or)g Ff(EOF)g Fc(\(eg)g Ff(C-d)p Fc(\))-225 734 y Ff(INTERRUPT)148
-b Fc(\(eg)13 b Ff(C-c)p Fc(\))g(terminate)g(curren)o(t)h(command,)h(or)105
-771 y(send)g(to)e(running)i(pro)q(cess)-225 868 y Fg(Getting)c(Help)-225
-914 y Ff(help)238 b Fc(list)14 b(classes)g(of)g(commands)-225
-951 y Ff(help)e Fe(class)155 b Fc(one-line)14 b(descriptions)h(for)f
-(commands)g(in)105 988 y Fe(class)-225 1021 y Ff(help)e Fe(c)n(ommand)83
-b Fc(describ)q(e)14 b Fe(c)n(ommand)-225 1119 y Fg(Executing)e(y)o(our)h
-(Program)-225 1165 y Ff(run)g Fe(ar)n(glist)150 b Fc(start)13
-b(y)o(our)h(program)f(with)i Fe(ar)n(glist)-225 1203 y Ff(run)256
-b Fc(start)13 b(y)o(our)h(program)f(with)i(curren)o(t)f(argumen)o(t)105
-1240 y(list)-225 1273 y Ff(run)f Fb(:)7 b(:)g(:)12 b Ff(<)p
-Fe(inf)h Ff(>)p Fe(outf)32 b Fc(start)13 b(y)o(our)h(program)f(with)i(input,)
-g(output)105 1310 y(redirected)-225 1360 y Ff(kill)238 b Fc(kill)15
-b(running)g(program)-225 1434 y Ff(tty)e Fe(dev)193 b Fc(use)14
-b Fe(dev)f Fc(as)g(stdin)i(and)f(stdout)g(for)g(next)g Ff(run)-225
-1472 y(set)f(args)f Fe(ar)n(glist)66 b Fc(sp)q(ecify)15 b Fe(ar)n(glist)d
-Fc(for)i(next)g Ff(run)-225 1509 y(set)f(args)171 b Fc(sp)q(ecify)15
-b(empt)o(y)f(argumen)o(t)g(list)-225 1546 y Ff(show)e(args)154
-b Fc(displa)o(y)15 b(argumen)o(t)f(list)-225 1621 y Ff(show)e(environment)28
-b Fc(sho)o(w)13 b(all)i(en)o(vironmen)o(t)g(v)n(ariables)-225
-1659 y Ff(show)d(env)h Fe(var)110 b Fc(sho)o(w)13 b(v)n(alue)i(of)f(en)o
-(vironmen)o(t)h(v)n(ariable)f Fe(var)-225 1696 y Ff(set)f(env)g
-Fe(var)f(string)28 b Fc(set)13 b(en)o(vironmen)o(t)j(v)n(ariable)e
-Fe(var)-225 1733 y Ff(unset)e(env)h Fe(var)92 b Fc(remo)o(v)o(e)13
-b Fe(var)g Fc(from)h(en)o(vironmen)o(t)-225 1820 y Fg(Shell)d(Commands)-225
-1866 y Ff(cd)i Fe(dir)217 b Fc(c)o(hange)13 b(w)o(orking)h(directory)g(to)f
-Fe(dir)-225 1903 y Ff(pwd)256 b Fc(Prin)o(t)15 b(w)o(orking)e(directory)-225
-1941 y Ff(make)f Fb(:)7 b(:)g(:)176 b Fc(call)14 b(\\)p Ff(make)p
-Fc(")-225 1978 y Ff(shell)e Fe(cmd)146 b Fc(execute)13 b(arbitrary)h(shell)h
-(command)f(string)-225 2100 y Fd([)f(])h Fh(surround)f(optional)j(argumen)o
-(ts)45 b Fb(:)7 b(:)g(:)13 b Fh(sho)o(w)h(one)f(or)h(more)f(argumen)o(ts)-216
-2174 y(c)-230 2175 y Fa(\015)p Fh(1991,)h(1992)h(F)n(ree)d(Soft)o(w)o(are)h
-(F)n(oundation,)h(Inc.)60 b(P)o(ermissions)15 b(on)f(bac)o(k)p
-800 -217 1 9 v 800 2175 V 875 -183 a Fg(Breakp)q(oin)o(ts)d(and)j(W)l(atc)o
-(hp)q(oin)o(ts)875 -132 y Ff(break)e Fd([)p Fe(\014le)p Ff(:)p
-Fd(])p Fe(line)875 -86 y Ff(b)i Fd([)p Fe(\014le)p Ff(:)p Fd(])p
-Fe(line)1185 -132 y Fc(set)g(breakp)q(oin)o(t)g(at)f Fe(line)h
-Fc(n)o(um)o(b)q(er)h Fd([)p Fc(in)f Fe(\014le)p Fd(])1185 -94
-y Fc(eg:)33 b Ff(break)12 b(main.c:37)875 -32 y(break)g Fd([)p
-Fe(\014le)p Ff(:)p Fd(])p Fe(func)57 b Fc(set)14 b(breakp)q(oin)o(t)g(at)f
-Fe(func)h Fd([)p Fc(in)g Fe(\014le)p Fd(])875 11 y Ff(break)e(+)p
-Fe(o\013set)875 48 y Ff(break)g(-)p Fe(o\013set)1185 11 y Fc(set)i(break)f
-(at)h Fe(o\013set)f Fc(lines)i(from)f(curren)o(t)g(stop)875
-87 y Ff(break)e(*)p Fe(addr)121 b Fc(set)14 b(breakp)q(oin)o(t)g(at)f
-(address)h Fe(addr)875 124 y Ff(break)220 b Fc(set)14 b(breakp)q(oin)o(t)g
-(at)f(next)i(instruction)875 161 y Ff(break)d Fb(:)7 b(:)g(:)12
-b Ff(if)i Fe(expr)31 b Fc(break)14 b(conditionally)h(on)f(nonzero)f
-Fe(expr)875 211 y Ff(cond)g Fe(n)h Fd([)p Fe(expr)p Fd(])103
-b Fc(new)13 b(conditional)i(expression)g(on)e(breakp)q(oin)o(t)1206
-248 y Fe(n)p Fc(;)h(mak)o(e)g(unconditional)h(if)g(no)e Fe(expr)875
-286 y Ff(tbreak)f Fb(:)7 b(:)g(:)140 b Fc(temp)q(orary)13 b(break;)i(disable)
-f(when)g(reac)o(hed)875 324 y Ff(rbreak)e Fe(r)n(e)n(gex)115
-b Fc(break)14 b(on)f(all)i(functions)g(matc)o(hing)f Fe(r)n(e)n(gex)875
-361 y Ff(watch)e Fe(expr)143 b Fc(set)14 b(a)f(w)o(atc)o(hp)q(oin)o(t)h(for)f
-(expression)i Fe(expr)875 398 y Ff(catch)d Fe(x)192 b Fc(break)14
-b(at)f(C++)i(handler)f(for)g(exception)g Fe(x)875 473 y Ff(info)f(break)135
-b Fc(sho)o(w)13 b(de\014ned)i(breakp)q(oin)o(ts)875 511 y Ff(info)e(watch)135
-b Fc(sho)o(w)13 b(de\014ned)i(w)o(atc)o(hp)q(oin)o(ts)875 585
-y Ff(clear)220 b Fc(delete)14 b(breakp)q(oin)o(ts)g(at)g(next)g(instruction)
-875 635 y Ff(clear)e Fd([)p Fe(\014le)p Ff(:)p Fd(])p Fe(fun)73
-b Fc(delete)14 b(breakp)q(oin)o(ts)g(at)g(en)o(try)g(to)f Fe(fun)p
-Fc(\(\))875 688 y Ff(clear)f Fd([)p Fe(\014le)p Ff(:)p Fd(])p
-Fe(line)66 b Fc(delete)14 b(breakp)q(oin)o(ts)g(on)g(source)f(line)875
-742 y Ff(delete)f Fd([)p Fe(n)p Fd(])147 b Fc(delete)14 b(breakp)q(oin)o(ts)g
-Fd([)p Fc(or)f(breakp)q(oin)o(t)i Fe(n)p Fd(])875 823 y Ff(disable)c
-Fd([)p Fe(n)p Fd(])130 b Fc(disable)15 b(breakp)q(oin)o(ts)f
-Fd([)p Fc(or)f(breakp)q(oin)o(t)i Fe(n)p Fd(])875 877 y Ff(enable)d
-Fd([)p Fe(n)p Fd(])147 b Fc(enable)14 b(breakp)q(oin)o(ts)g
-Fd([)p Fc(or)f(breakp)q(oin)o(t)i Fe(n)p Fd(])875 931 y Ff(enable)d(once)g
-Fd([)p Fe(n)p Fd(])63 b Fc(enable)14 b(breakp)q(oin)o(ts)g
-Fd([)p Fc(or)f(breakp)q(oin)o(t)i Fe(n)p Fd(])p Fc(;)1206 969
-y(disable)f(again)g(when)f(reac)o(hed)875 1018 y Ff(enable)f(del)h
-Fd([)p Fe(n)p Fd(])80 b Fc(enable)14 b(breakp)q(oin)o(ts)g
-Fd([)p Fc(or)f(breakp)q(oin)o(t)i Fe(n)p Fd(])p Fc(;)1206 1055
-y(delete)e(when)h(reac)o(hed)875 1105 y Ff(ignore)e Fe(n)i(c)n(ount)76
-b Fc(ignore)13 b(breakp)q(oin)o(t)i Fe(n)p Fc(,)f Fe(c)n(ount)g
-Fc(times)875 1180 y Ff(commands)d Fe(n)946 1217 y Fd([)p Ff(silent)p
-Fd(])946 1255 y Fe(c)n(ommand-list)1185 1180 y Fc(execute)i(GDB)h
-Fe(c)n(ommand-list)e Fc(ev)o(ery)j(time)1206 1217 y(breakp)q(oin)o(t)f
-Fe(n)g Fc(is)g(reac)o(hed.)21 b Fd([)p Ff(silent)1206 1263
-y Fc(suppresses)14 b(default)h(displa)o(y)p Fd(])875 1306 y
-Ff(end)256 b Fc(end)14 b(of)g Fe(c)n(ommand-list)875 1393 y
-Fg(Program)f(Stac)o(k)875 1445 y Ff(backtrace)e Fd([)p Fe(n)p
-Fd(])875 1490 y Ff(bt)i Fd([)p Fe(n)p Fd(])1185 1445 y Fc(prin)o(t)i(trace)e
-(of)g(all)h(frames)g(in)h(stac)o(k;)f(or)f(of)h Fe(n)1206 1482
-y Fc(frames|innermost)g(if)h Fe(n)p Ff(>0)p Fc(,)e(outermost)h(if)1206
-1519 y Fe(n)p Ff(<0)875 1563 y(frame)e Fd([)p Fe(n)p Fd(])165
-b Fc(select)13 b(frame)h(n)o(um)o(b)q(er)h Fe(n)f Fc(or)f(frame)h(at)g
-(address)1206 1600 y Fe(n)p Fc(;)g(if)h(no)e Fe(n)p Fc(,)i(displa)o(y)g
-(curren)o(t)f(frame)875 1639 y Ff(up)f Fe(n)242 b Fc(select)13
-b(frame)h Fe(n)g Fc(frames)g(up)875 1676 y Ff(down)f Fe(n)206
-b Fc(select)13 b(frame)h Fe(n)g Fc(frames)g(do)o(wn)875 1720
-y Ff(info)f(frame)f Fd([)p Fe(addr)p Fd(])30 b Fc(describ)q(e)14
-b(selected)g(frame,)g(or)f(frame)h(at)f Fe(addr)875 1763 y
-Ff(info)g(args)153 b Fc(argumen)o(ts)14 b(of)f(selected)h(frame)875
-1800 y Ff(info)f(locals)117 b Fc(lo)q(cal)13 b(v)n(ariables)i(of)e(selected)h
-(frame)875 1844 y Ff(info)f(reg)f Fd([)p Fe(rn)p Fd(])p Fb(:)7
-b(:)g(:)875 1889 y Ff(info)13 b(all-reg)e Fd([)p Fe(rn)p Fd(])1185
-1844 y Fc(register)i(v)n(alues)i Fd([)p Fc(for)e(regs)g Fe(rn)s
-Fd(])g Fc(in)h(selected)1206 1881 y(frame;)g Ff(all-reg)d Fc(includes)k
-(\015oating)e(p)q(oin)o(t)875 1933 y Ff(info)g(catch)135 b
-Fc(exception)14 b(handlers)h(activ)o(e)e(in)i(selected)f(frame)p
-1900 -217 V 1900 2175 V 1975 -183 a Fg(Execution)f(Con)o(trol)1975
--138 y Ff(continue)e Fd([)p Fe(c)n(ount)p Fd(])1975 -92 y Ff(c)j
-Fd([)p Fe(c)n(ount)p Fd(])2285 -138 y Fc(con)o(tin)o(ue)g(running;)i(if)e
-Fe(c)n(ount)g Fc(sp)q(eci\014ed,)g(ignore)2306 -100 y(this)g(breakp)q(oin)o
-(t)h(next)f Fe(c)n(ount)g Fc(times)1975 -26 y Ff(step)f Fd([)p
-Fe(c)n(ount)p Fd(])1975 20 y Ff(s)h Fd([)p Fe(c)n(ount)p Fd(])2285
--26 y Fc(execute)g(un)o(til)h(another)e(line)i(reac)o(hed;)f(rep)q(eat)2306
-12 y Fe(c)n(ount)f Fc(times)i(if)f(sp)q(eci\014ed)1975 74 y
-Ff(stepi)e Fd([)p Fe(c)n(ount)p Fd(])1975 120 y Ff(si)h Fd([)p
-Fe(c)n(ount)p Fd(])2285 74 y Fc(step)h(b)o(y)h(mac)o(hine)f(instructions)h
-(rather)f(than)2306 111 y(source)f(lines)1975 186 y Ff(next)g
-Fd([)p Fe(c)n(ount)p Fd(])1975 232 y Ff(n)h Fd([)p Fe(c)n(ount)p
-Fd(])2285 186 y Fc(execute)g(next)g(line,)h(including)h(an)o(y)e(function)
-2306 223 y(calls)1975 286 y Ff(nexti)e Fd([)p Fe(c)n(ount)p
-Fd(])1975 331 y Ff(ni)h Fd([)p Fe(c)n(ount)p Fd(])2285 286
-y Fc(next)h(mac)o(hine)h(instruction)g(rather)e(than)2306 323
-y(source)g(line)1975 398 y Ff(until)f Fd([)p Fe(lo)n(c)n(ation)p
-Fd(])67 b Fc(run)14 b(un)o(til)i(next)e(instruction)h(\(or)e
-Fe(lo)n(c)n(ation)p Fc(\))1975 441 y Ff(finish)202 b Fc(run)14
-b(un)o(til)i(selected)e(stac)o(k)f(frame)h(returns)1975 484
-y Ff(return)e Fd([)p Fe(expr)p Fd(])101 b Fc(p)q(op)14 b(selected)g(stac)o(k)
-f(frame)h(without)2306 522 y(executing)g Fd([)p Fc(setting)f(return)i(v)n
-(alue)p Fd(])1975 566 y Ff(signal)d Fe(num)125 b Fc(resume)14
-b(execution)g(with)g(signal)h Fe(s)f Fc(\(none)f(if)i Ff(0)p
-Fc(\))1975 604 y Ff(jump)e Fe(line)1975 641 y Ff(jump)g(*)p
-Fe(addr)n(ess)2285 604 y Fc(resume)h(execution)g(at)g(sp)q(eci\014ed)g
-Fe(line)f Fc(n)o(um)o(b)q(er)2306 641 y(or)g Fe(addr)n(ess)1975
-681 y Ff(set)g(var=)p Fe(expr)106 b Fc(ev)n(aluate)14 b Fe(expr)e
-Fc(without)i(displa)o(ying)i(it;)f(use)2306 718 y(for)e(altering)h(program)f
-(v)n(ariables)1975 815 y Fg(Displa)o(y)1975 867 y Ff(print)f
-Fd([)p Ff(/)p Fe(f)6 b Fd(])13 b([)p Fe(expr)p Fd(])1975 913
-y Ff(p)h Fd([)p Ff(/)p Fe(f)5 b Fd(])13 b([)p Fe(expr)p Fd(])2285
-867 y Fc(sho)o(w)h(v)n(alue)g(of)g Fe(expr)e Fd([)p Fc(or)h(last)h(v)n(alue)h
-Ff($)p Fd(])2306 904 y Fc(according)e(to)g(format)h Fe(f)p
-Fc(:)2046 956 y Ff(x)221 b Fc(hexadecimal)2046 993 y Ff(d)g
-Fc(signed)14 b(decimal)2046 1030 y Ff(u)221 b Fc(unsigned)15
-b(decimal)2046 1068 y Ff(o)221 b Fc(o)q(ctal)2046 1105 y Ff(t)g
-Fc(binary)2046 1142 y Ff(a)g Fc(address,)14 b(absolute)g(and)g(relativ)o(e)
-2046 1180 y Ff(c)221 b Fc(c)o(haracter)2046 1217 y Ff(f)g Fc(\015oating)13
-b(p)q(oin)o(t)1975 1266 y Ff(call)g Fd([)p Ff(/)p Fe(f)5 b
-Fd(])13 b Fe(expr)89 b Fc(lik)o(e)15 b Ff(print)d Fc(but)i(do)q(es)g(not)g
-(displa)o(y)h Ff(void)1975 1320 y(x)f Fd([)p Ff(/)p Fe(Nuf)5
-b Fd(])14 b Fe(expr)98 b Fc(examine)14 b(memory)g(at)g(address)g
-Fe(expr)p Fc(;)f(optional)2306 1358 y(format)g(sp)q(ec)h(follo)o(ws)g(slash)
-2011 1396 y Fe(N)249 b Fc(coun)o(t)14 b(of)f(ho)o(w)h(man)o(y)h(units)g(to)e
-(displa)o(y)2011 1433 y Fe(u)256 b Fc(unit)15 b(size;)f(one)g(of)2356
-1471 y Ff(b)f Fc(individual)k(b)o(ytes)2356 1508 y Ff(h)c Fc(halfw)o(ords)h
-(\(t)o(w)o(o)f(b)o(ytes\))2356 1545 y Ff(w)g Fc(w)o(ords)h(\(four)g(b)o
-(ytes\))2356 1583 y Ff(g)f Fc(gian)o(t)h(w)o(ords)f(\(eigh)o(t)h(b)o(ytes\))
-2011 1620 y Fe(f)263 b Fc(prin)o(ting)15 b(format.)21 b(An)o(y)14
-b Ff(print)e Fc(format,)i(or)2356 1657 y Ff(s)f Fc(n)o(ull-terminated)j
-(string)2356 1695 y Ff(i)d Fc(mac)o(hine)h(instructions)1975
-1738 y Ff(disassem)d Fd([)p Fe(addr)p Fd(])62 b Fc(displa)o(y)15
-b(memory)g(as)e(mac)o(hine)h(instructions)1975 1840 y Fg(Automatic)e(Displa)o
-(y)1975 1891 y Ff(display)g Fd([)p Ff(/)p Fe(f)5 b Fd(])13
-b Fe(expr)36 b Fc(sho)o(w)14 b(v)n(alue)g(of)g Fe(expr)e Fc(eac)o(h)i(time)g
-(program)2306 1929 y(stops)g Fd([)p Fc(according)e(to)i(format)f
-Fe(f)6 b Fd(])1975 1972 y Ff(display)184 b Fc(displa)o(y)15
-b(all)g(enabled)f(expressions)h(on)f(list)1975 2014 y Ff(undisplay)d
-Fe(n)118 b Fc(remo)o(v)o(e)14 b(n)o(um)o(b)q(er\(s\))h Fe(n)f
-Fc(from)g(list)h(of)2306 2051 y(automatically)f(displa)o(y)o(ed)h
-(expressions)1975 2091 y Ff(disable)d(disp)g Fe(n)69 b Fc(disable)15
-b(displa)o(y)g(for)f(expression\(s\))h(n)o(um)o(b)q(er)g Fe(n)1975
-2132 y Ff(enable)d(disp)g Fe(n)87 b Fc(enable)14 b(displa)o(y)h(for)f
-(expression\(s\))h(n)o(um)o(b)q(er)g Fe(n)1975 2170 y Ff(info)e(display)99
-b Fc(n)o(um)o(b)q(ered)15 b(list)g(of)e(displa)o(y)j(expressions)p
-eop
-%%Page: 2 2
-bop -225 -183 a Fg(Expressions)-225 -138 y Fe(expr)245 b Fc(an)13
-b(expression)i(in)g(C,)f(C++,)g(or)g(Mo)q(dula-2)105 -100 y(\(including)i
-(function)f(calls\),)f(or:)-225 -60 y Fe(addr)s Ff(@)p Fe(len)176
-b Fc(an)13 b(arra)o(y)h(of)f Fe(len)h Fc(elemen)o(ts)h(b)q(eginning)f(at)105
--23 y Fe(addr)-225 10 y(\014le)p Ff(::)p Fe(nm)182 b Fc(a)13
-b(v)n(ariable)h(or)g(function)h Fe(nm)e Fc(de\014ned)i(in)f
-Fe(\014le)-225 59 y Fa(f)p Fe(typ)n(e)p Fa(g)p Fe(addr)138
-b Fc(read)13 b(memory)h(at)g Fe(addr)e Fc(as)h(sp)q(eci\014ed)h
-Fe(typ)n(e)-225 105 y Ff($)292 b Fc(most)13 b(recen)o(t)h(displa)o(y)o(ed)i
-(v)n(alue)-225 142 y Ff($)p Fe(n)273 b(n)p Fc(th)14 b(displa)o(y)o(ed)i(v)n
-(alue)-225 179 y Ff($$)274 b Fc(displa)o(y)o(ed)15 b(v)n(alue)g(previous)g
-(to)e($)-225 217 y Ff($$)p Fe(n)255 b(n)p Fc(th)14 b(displa)o(y)o(ed)i(v)n
-(alue)e(bac)o(k)g(from)g($)-225 254 y Ff($)p -205 254 11 2
-v 292 w Fc(last)g(address)g(examined)g(with)h Ff(x)-225 291
-y($)p -205 291 V -193 291 V 292 w Fc(v)n(alue)f(at)g(address)g($)p
-357 291 10 2 v -225 329 a Ff($)p Fe(var)243 b Fc(con)o(v)o(enience)14
-b(v)n(ariable;)h(assign)f(an)o(y)g(v)n(alue)-225 410 y Ff(show)e(values)g
-Fd([)p Fe(n)p Fd(])63 b Fc(sho)o(w)13 b(last)h(10)f(v)n(alues)i
-Fd([)p Fc(or)e(surrounding)i($)p Fe(n)p Fd(])-225 453 y Ff(show)d
-(convenience)28 b Fc(displa)o(y)15 b(all)f(con)o(v)o(enience)h(v)n(ariables)
--225 550 y Fg(Sym)o(b)q(ol)d(T)l(able)-225 595 y Ff(info)g(address)g
-Fe(s)74 b Fc(sho)o(w)13 b(where)h(sym)o(b)q(ol)h Fe(s)f Fc(is)g(stored)-225
-645 y Ff(info)e(func)h Fd([)p Fe(r)n(e)n(gex)p Fd(])42 b Fc(sho)o(w)13
-b(names,)i(t)o(yp)q(es)f(of)g(de\014ned)g(functions)105 682
-y(\(all,)h(or)e(matc)o(hing)h Fe(r)n(e)n(gex)p Fc(\))-225 733
-y Ff(info)e(var)h Fd([)p Fe(r)n(e)n(gex)p Fd(])60 b Fc(sho)o(w)13
-b(names,)i(t)o(yp)q(es)f(of)g(global)f(v)n(ariables)i(\(all,)105
-770 y(or)f(matc)o(hing)g Fe(r)n(e)n(gex)p Fc(\))-225 821 y
-Ff(whatis)e Fd([)p Fe(expr)p Fd(])-225 867 y Ff(ptype)g Fd([)p
-Fe(expr)p Fd(])85 821 y Fc(sho)o(w)h(data)h(t)o(yp)q(e)g(of)g
-Fe(expr)e Fd([)p Fc(or)h Ff($)p Fd(])g Fc(without)105 858 y(ev)n(aluating;)i
-Ff(ptype)d Fc(giv)o(es)i(more)g(detail)-225 910 y Ff(ptype)e
-Fe(typ)n(e)147 b Fc(describ)q(e)14 b(t)o(yp)q(e,)h(struct,)f(union,)h(or)f
-(en)o(um)-225 1008 y Fg(GDB)f(Scripts)-225 1054 y Ff(source)f
-Fe(script)104 b Fc(read,)14 b(execute)f(GDB)h(commands)g(from)g(\014le)105
-1091 y Fe(script)-225 1147 y Ff(define)e Fe(cmd)-154 1184 y(c)n(ommand-list)
-85 1147 y Fc(create)g(new)i(GDB)g(command)g Fe(cmd)p Fc(;)f(execute)105
-1184 y(script)i(de\014ned)f(b)o(y)h Fe(c)n(ommand-list)-225
-1222 y Ff(end)256 b Fc(end)14 b(of)g Fe(c)n(ommand-list)-225
-1260 y Ff(document)d Fe(cmd)-154 1297 y(help-text)85 1260 y
-Fc(create)h(online)j(do)q(cumen)o(tation)f(for)f(new)h(GDB)105
-1297 y(command)g Fe(cmd)-225 1335 y Ff(end)256 b Fc(end)14
-b(of)g Fe(help-text)-225 1432 y Fg(Signals)-225 1478 y Ff(handle)e
-Fe(signal)h(act)44 b Fc(sp)q(ecify)15 b(GDB)e(actions)h(for)f
-Fe(signal)p Fc(:)-190 1515 y Ff(print)185 b Fc(announce)13
-b(signal)-190 1553 y Ff(noprint)149 b Fc(b)q(e)13 b(silen)o(t)i(for)f(signal)
--190 1590 y Ff(stop)203 b Fc(halt)14 b(execution)g(on)g(signal)-190
-1627 y Ff(nostop)167 b Fc(do)13 b(not)h(halt)g(execution)-190
-1665 y Ff(pass)203 b Fc(allo)o(w)13 b(y)o(our)h(program)f(to)h(handle)g
-(signal)-190 1702 y Ff(nopass)167 b Fc(do)13 b(not)h(allo)o(w)g(y)o(our)g
-(program)f(to)g(see)h(signal)-225 1739 y Ff(info)e(signals)100
-b Fc(sho)o(w)13 b(table)h(of)g(signals,)h(GDB)e(action)h(for)f(eac)o(h)-225
-1838 y Fg(Debugging)e(T)l(argets)-225 1884 y Ff(target)h Fe(typ)n(e)g(p)n(ar)
-n(am)24 b Fc(connect)13 b(to)g(target)g(mac)o(hine,)i(pro)q(cess,)e(or)h
-(\014le)-225 1921 y Ff(help)e(target)118 b Fc(displa)o(y)15
-b(a)o(v)n(ailable)g(targets)-225 1958 y Ff(attach)d Fe(p)n(ar)n(am)97
-b Fc(connect)13 b(to)g(another)h(pro)q(cess)-225 1996 y Ff(detach)202
-b Fc(release)13 b(target)f(from)i(GDB)g(con)o(trol)p 800 -217
-1 9 v 800 2175 V 875 -183 a Fg(Con)o(trollin)o(g)d(GDB)875
--138 y Ff(set)i Fe(p)n(ar)n(am)f(value)61 b Fc(set)14 b(one)f(of)h(GDB's)g
-(in)o(ternal)h(parameters)875 -100 y Ff(show)e Fe(p)n(ar)n(am)132
-b Fc(displa)o(y)15 b(curren)o(t)f(setting)g(of)g(parameter)875
--51 y(P)o(arameters)f(understo)q(o)q(d)h(b)o(y)h Ff(set)e Fc(and)h
-Ff(show)p Fc(:)910 -13 y Ff(complaints)d Fe(limit)i Fc(n)o(um)o(b)q(er)i(of)e
-(messages)h(on)f(un)o(usual)j(sym)o(b)q(ols)910 28 y Ff(confirm)c
-Fe(on/o\013)43 b Fc(enable)14 b(or)f(disable)i(cautionary)f(queries)910
-66 y Ff(editing)e Fe(on/o\013)43 b Fc(con)o(trol)13 b Ff(readline)e
-Fc(command-line)k(editing)910 103 y Ff(height)d Fe(lpp)110
-b Fc(n)o(um)o(b)q(er)15 b(of)e(lines)i(b)q(efore)f(pause)g(in)g(displa)o(y)
-910 145 y Ff(language)d Fe(lang)58 b Fc(Language)12 b(for)h(GDB)h
-(expressions)h(\()p Ff(auto)p Fc(,)e Ff(c)g Fc(or)1206 182
-y Ff(modula-2)p Fc(\))910 222 y Ff(listsize)e Fe(n)101 b Fc(n)o(um)o(b)q(er)
-15 b(of)e(lines)i(sho)o(wn)f(b)o(y)h Ff(list)910 259 y(prompt)d
-Fe(str)114 b Fc(use)14 b Fe(str)f Fc(as)g(GDB)h(prompt)910
-297 y Ff(radix)e Fe(b)n(ase)111 b Fc(o)q(ctal,)13 b(decimal,)i(or)e(hex)i(n)o
-(um)o(b)q(er)1206 334 y(represen)o(tation)910 374 y Ff(verbose)d
-Fe(on/o\013)43 b Fc(con)o(trol)13 b(messages)g(when)h(loading)g(sym)o(b)q
-(ols)910 411 y Ff(width)e Fe(cpl)130 b Fc(n)o(um)o(b)q(er)15
-b(of)e(c)o(haracters)g(b)q(efore)h(line)g(folded)910 449 y
-Ff(write)e Fe(on/o\013)79 b Fc(Allo)o(w)13 b(or)h(forbid)g(patc)o(hing)h
-(binary)m(,)g(core)e(\014les)1206 486 y(\(when)g(reop)q(ened)h(with)g
-Ff(exec)f Fc(or)g Ff(core)p Fc(\))910 526 y Ff(history)f Fb(:)7
-b(:)g(:)910 563 y Ff(h)14 b Fb(:)7 b(:)g(:)1185 526 y Fc(groups)14
-b(with)g(the)g(follo)o(wing)g(options:)910 598 y Ff(h)g(exp)f
-Fe(o\013/on)82 b Fc(disable/enable)14 b Ff(readline)d Fc(history)k(expansion)
-910 635 y Ff(h)f(file)e Fe(\014lename)33 b Fc(\014le)14 b(for)f(recording)h
-(GDB)f(command)h(history)910 672 y Ff(h)g(size)e Fe(size)104
-b Fc(n)o(um)o(b)q(er)15 b(of)e(commands)h(k)o(ept)h(in)f(history)h(list)910
-710 y Ff(h)f(save)e Fe(o\013/on)65 b Fc(con)o(trol)13 b(use)h(of)g(external)g
-(\014le)g(for)f(command)1206 747 y(history)910 803 y Ff(print)f
-Fb(:)7 b(:)g(:)910 840 y Ff(p)14 b Fb(:)7 b(:)g(:)1185 803
-y Fc(groups)14 b(with)g(the)g(follo)o(wing)g(options:)910 882
-y Ff(p)g(address)d Fe(on/o\013)h Fc(prin)o(t)j(memory)f(addresses)g(in)g
-(stac)o(ks,)h(v)n(alues)910 923 y Ff(p)f(array)e Fe(o\013/on)47
-b Fc(compact)13 b(or)g(attractiv)o(e)g(format)h(for)g(arra)o(ys)910
-965 y Ff(p)g(demangl)d Fe(on/o\013)h Fc(source)h(\(demangled\))h(or)g(in)o
-(ternal)g(form)g(for)1206 1002 y(C++)g(sym)o(b)q(ols)910 1042
-y Ff(p)g(asm-dem)d Fe(on/o\013)h Fc(demangle)i(C++)g(sym)o(b)q(ols)h(in)g
-(mac)o(hine-)1206 1079 y(instruction)g(output)910 1118 y Ff(p)f(elements)d
-Fe(limit)17 b Fc(n)o(um)o(b)q(er)e(of)e(arra)o(y)h(elemen)o(ts)g(to)g(displa)
-o(y)910 1160 y Ff(p)g(object)e Fe(on/o\013)29 b Fc(prin)o(t)15
-b(C++)f(deriv)o(ed)h(t)o(yp)q(es)g(for)e(ob)r(jects)910 1201
-y Ff(p)h(pretty)e Fe(o\013/on)29 b Fc(struct)14 b(displa)o(y:)23
-b(compact)13 b(or)g(inden)o(ted)910 1243 y Ff(p)h(union)e Fe(on/o\013)47
-b Fc(displa)o(y)15 b(of)f(union)h(mem)o(b)q(ers)910 1284 y
-Ff(p)f(vtbl)e Fe(o\013/on)65 b Fc(displa)o(y)15 b(of)f(C++)h(virtual)f
-(function)h(tables)875 1359 y Ff(show)e(commands)81 b Fc(sho)o(w)13
-b(last)h(10)f(commands)875 1396 y Ff(show)g(commands)e Fe(n)51
-b Fc(sho)o(w)13 b(10)g(commands)h(around)g(n)o(um)o(b)q(er)h
-Fe(n)875 1434 y Ff(show)e(commands)e(+)52 b Fc(sho)o(w)13 b(next)i(10)e
-(commands)875 1521 y Fg(W)l(orking)g(Files)875 1573 y Ff(file)g
-Fd([)p Fe(\014le)p Fd(])156 b Fc(use)14 b Fe(\014le)f Fc(for)h(b)q(oth)g(sym)
-o(b)q(ols)h(and)f(executable;)1206 1610 y(with)g(no)g(arg,)f(discard)h(b)q
-(oth)875 1659 y Ff(core)f Fd([)p Fe(\014le)p Fd(])156 b Fc(read)13
-b Fe(\014le)h Fc(as)f(coredump;)i(or)e(discard)875 1713 y Ff(exec)g
-Fd([)p Fe(\014le)p Fd(])156 b Fc(use)14 b Fe(\014le)f Fc(as)h(executable)g
-(only;)h(or)e(discard)875 1767 y Ff(symbol)f Fd([)p Fe(\014le)p
-Fd(])121 b Fc(use)14 b(sym)o(b)q(ol)h(table)f(from)g Fe(\014le)p
-Fc(;)f(or)h(discard)875 1810 y Ff(load)f Fe(\014le)180 b Fc(dynamically)15
-b(link)h Fe(\014le)f Fc(and)f(add)g(its)h(sym)o(b)q(ols)875
-1848 y Ff(add-sym)c Fe(\014le)j(addr)45 b Fc(read)13 b(additional)i(sym)o(b)q
-(ols)g(from)f Fe(\014le)p Fc(,)1206 1885 y(dynamically)h(loaded)f(at)f
-Fe(addr)875 1923 y Ff(info)g(files)135 b Fc(displa)o(y)15 b(w)o(orking)f
-(\014les)g(and)g(targets)f(in)i(use)875 1961 y Ff(path)e Fe(dirs)167
-b Fc(add)14 b Fe(dirs)f Fc(to)g(fron)o(t)h(of)g(path)g(searc)o(hed)f(for)1206
-1998 y(executable)g(and)h(sym)o(b)q(ol)h(\014les)875 2037 y
-Ff(show)e(path)153 b Fc(displa)o(y)15 b(executable)f(and)g(sym)o(b)q(ol)h
-(\014le)f(path)875 2074 y Ff(info)f(share)135 b Fc(list)15
-b(names)e(of)h(shared)g(libraries)h(curren)o(tly)1206 2111
-y(loaded)p 1900 -217 V 1900 2175 V 1975 -183 a Fg(Source)e(Files)1975
--138 y Ff(dir)g Fe(names)148 b Fc(add)14 b(directory)g Fe(names)f
-Fc(to)h(fron)o(t)g(of)f(source)2306 -100 y(path)1975 -62 y
-Ff(dir)256 b Fc(clear)13 b(source)h(path)1975 -25 y Ff(show)f(dir)171
-b Fc(sho)o(w)14 b(curren)o(t)g(source)f(path)1975 50 y Ff(list)238
-b Fc(sho)o(w)14 b(next)g(ten)g(lines)h(of)e(source)1975 87
-y Ff(list)g(-)207 b Fc(sho)o(w)14 b(previous)g(ten)g(lines)1975
-125 y Ff(list)f Fe(lines)156 b Fc(displa)o(y)15 b(source)f(surrounding)h
-Fe(lines)p Fc(,)f(sp)q(eci\014ed)2306 162 y(as:)2011 206 y
-Fd([)p Fe(\014le)p Ff(:)p Fd(])p Fe(num)122 b Fc(line)15 b(n)o(um)o(b)q(er)g
-Fd([)p Fc(in)f(named)g(\014le)p Fd(])2011 260 y([)p Fe(\014le)p
-Ff(:)p Fd(])p Fe(function)63 b Fc(b)q(eginning)15 b(of)e(function)i
-Fd([)p Fc(in)f(named)g(\014le)p Fd(])2011 303 y Ff(+)p Fe(o\013)217
-b(o\013)14 b Fc(lines)h(after)e(last)h(prin)o(ted)2011 340
-y Ff(-)p Fe(o\013)217 b(o\013)14 b Fc(lines)h(previous)f(to)g(last)g(prin)o
-(ted)2011 377 y Ff(*)p Fe(addr)n(ess)145 b Fc(line)15 b(con)o(taining)f
-Fe(addr)n(ess)1975 415 y Ff(list)f Fe(f)p Ff(,)p Fe(l)187 b
-Fc(from)14 b(line)h Fe(f)e Fc(to)g(line)i Fe(l)1975 452 y Ff(info)e(line)f
-Fe(num)76 b Fc(sho)o(w)14 b(starting,)g(ending)g(addresses)g(of)2306
-489 y(compiled)g(co)q(de)f(for)h(source)f(line)i Fe(num)1975
-528 y Ff(info)e(source)117 b Fc(sho)o(w)14 b(name)f(of)h(curren)o(t)g(source)
-f(\014le)1975 565 y Ff(info)g(sources)99 b Fc(list)15 b(all)f(source)f
-(\014les)h(in)h(use)1975 603 y Ff(forw)e Fe(r)n(e)n(gex)150
-b Fc(searc)o(h)13 b(follo)o(wing)h(source)g(lines)h(for)e Fe(r)n(e)n(gex)1975
-640 y Ff(rev)g Fe(r)n(e)n(gex)168 b Fc(searc)o(h)13 b(preceding)h(source)g
-(lines)h(for)e Fe(r)n(e)n(gex)1975 737 y Fg(GDB)g(under)f(GNU)i(Emacs)1975
-782 y Ff(M-x)f(gdb)189 b Fc(run)14 b(GDB)g(under)h(Emacs)1975
-820 y Ff(C-h)e(m)225 b Fc(describ)q(e)14 b(GDB)g(mo)q(de)1975
-857 y Ff(M-s)256 b Fc(step)14 b(one)f(line)i(\()p Ff(step)p
-Fc(\))1975 899 y Ff(M-n)256 b Fc(next)14 b(line)h(\()p Ff(next)p
-Fc(\))1975 936 y Ff(M-i)256 b Fc(step)14 b(one)f(instruction)i(\()p
-Ff(stepi)p Fc(\))1975 978 y Ff(C-c)e(C-f)189 b Fc(\014nish)15
-b(curren)o(t)f(stac)o(k)g(frame)f(\()p Ff(finish)p Fc(\))1975
-1015 y Ff(M-c)256 b Fc(con)o(tin)o(ue)14 b(\()p Ff(cont)p Fc(\))1975
-1052 y Ff(M-u)256 b Fc(up)14 b Fe(ar)n(g)f Fc(frames)h(\()p
-Ff(up)p Fc(\))1975 1094 y Ff(M-d)256 b Fc(do)o(wn)14 b Fe(ar)n(g)f
-Fc(frames)h(\()p Ff(down)p Fc(\))1975 1131 y Ff(C-x)f(&)225
-b Fc(cop)o(y)14 b(n)o(um)o(b)q(er)h(from)f(p)q(oin)o(t,)h(insert)f(at)f(end)
-1975 1169 y Ff(C-x)g(SPC)189 b Fc(\(in)14 b(source)g(\014le\))g(set)f(break)h
-(at)g(p)q(oin)o(t)1975 1267 y Fg(GDB)f(License)1975 1313 y
-Ff(show)g(copying)99 b Fc(Displa)o(y)15 b(GNU)e(General)g(Public)i(License)
-1975 1350 y Ff(show)e(warranty)81 b Fc(There)13 b(is)i(NO)e(W)l(ARRANTY)g
-(for)h(GDB.)2306 1387 y(Displa)o(y)h(full)g(no-w)o(arran)o(t)o(y)f(statemen)o
-(t.)2024 1622 y Fh(Cop)o(yrigh)o(t)2185 1621 y(c)2171 1622
-y Fa(\015)o Fh(1991,)h(1992,)f(1993)h(F)n(ree)d(Soft)o(w)o(are)i(F)n
-(oundation,)f(Inc.)2215 1660 y(Roland)i(P)o(esc)o(h)f(\(p)q(esc)o(h@cygn)o
-(us.com\))1997 1697 y(The)f(author)h(assumes)f(no)h(resp)q(onsibilit)o(y)j
-(for)c(an)o(y)h(errors)g(on)g(this)h(card.)1975 1759 y(This)g(card)e(ma)o(y)g
-(b)q(e)g(freely)h(distributed)g(under)f(the)g(terms)g(of)g(the)h(GNU)1975
-1797 y(General)h(Public)g(License.)2012 1834 y(Please)f(con)o(tribute)g(to)g
-(dev)o(elopmen)o(t)e(of)i(this)h(card)e(b)o(y)h(annotating)h(it.)1975
-1896 y(GDB)g(itself)f(is)h(free)e(soft)o(w)o(are;)g(y)o(ou)h(are)g(w)o
-(elcome)e(to)i(distribute)h(copies)f(of)1975 1934 y(it)h(under)e(the)g(terms)
-g(of)g(the)g(GNU)i(General)g(Public)g(License.)20 b(There)12
-b(is)1975 1971 y(absolutely)k(no)d(w)o(arran)o(t)o(y)i(for)e(GDB.)p
-eop
-%%Trailer
-end
-userdict /end-hook known{end-hook}if
-%%EOF
diff --git a/gnu/usr.bin/gdb/doc/refcard.tex b/gnu/usr.bin/gdb/doc/refcard.tex
deleted file mode 100644
index 5899608..0000000
--- a/gnu/usr.bin/gdb/doc/refcard.tex
+++ /dev/null
@@ -1,646 +0,0 @@
-%%%%%%%%%%%%%%%% gdb-refcard.tex %%%%%%%%%%%%%%%%
-
-%This file is TeX source for a reference card describing GDB, the GNU debugger.
-%$Id: refcard.tex,v 1.1.1.1 1993/10/30 21:59:42 jkh Exp $
-%Copyright (C) 1991, 1992 Free Software Foundation, Inc.
-%Permission is granted to make and distribute verbatim copies of
-%this reference provided the copyright notices and permission notices
-%are preserved on all copies.
-%
-%TeX markup is a programming language; accordingly this file is source
-%for a program to generate a reference.
-%
-%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 can find a copy of the GNU General Public License in the GDB
-%manual; or write to the Free Software Foundation, Inc.,
-%675 Mass Ave, Cambridge, MA 02139, USA.
-%
-%You can contact the author as: pesch@cygnus.com
-%
-% Roland Pesch
-% Cygnus Support
-% 1937 Landings Drive
-% Mountain View, CA 94043 USA
-%
-% +1 415 903 1400
-%
-%
-%
-% 22-AUG-1993 Andreas Vogel
-%
-% Modifications made in order to handle different papersizes correctly.
-% You only have to set the total width and height of the paper, the
-% horizontal and vertical margin space measured from *paper edge*
-% and the interline and interspec spacing.
-% In order to support a new papersize, you have to fiddle with the
-% latter four dimensions. Just try out a few values.
-% All other values will be computed at process time so it should be
-% quite easy to support different paper sizes - only four values to
-% guess :-)
-%
-% To find the configuration places, just search for the string
-% "CONFIGURATION".
-%
-% Andreas Vogel (av@ssw.de)
-%
-%
-%
-% Uncomment the following `magnification' command if you want to print
-% out in a larger font. Caution! You may need larger paper. You had
-% best avoid using 3-column output if you try this. See the ``Three
-% column format'' section below if you want to print in three column
-% format.
-%
-%\magnification=\magstep 1
-%
-% NOTE ON INTENTIONAL OMISSIONS: This reference card includes most GDB
-% commands, but due to space constraints there are some things I chose
-% to omit. In general, not all synonyms for commands are covered, nor
-% all variations of a command.
-% The GDB-under-Emacs section omits gdb-mode functions without default
-% keybindings. GDB startup options are not described.
-% set print sevenbit-strings, set symbol-reloading omitted.
-% printsyms, printpsyms, omitted since they're for GDB maintenance primarily
-% share omitted due to obsolescence
-% set check range/type omitted at least til code is in GDB.
-%
-%-------------------- Three column format -----------------------
-
-%%%% --- To disable three column format, comment out this entire section
-
-% Three-column format for landscape printing
-
-%-------- Papersize defs:
-
-\newdimen\totalwidth \newdimen\totalheight
-\newdimen\hmargin \newdimen\vmargin
-\newdimen\secskip \newdimen\lskip
-\newdimen\barwidth \newdimen\barheight
-\newdimen\intersecwidth
-
-%%
-%% START CONFIGURATION - PAPERSIZE DEFINITIONS
-%------- Papersize params:
-%% US letter paper (8.5x11in)
-%%
-\totalwidth=11in % total width of paper
-\totalheight=8.5in % total height of paper
-\hmargin=.25in % horizontal margin width
-\vmargin=.25in % vertical margin width
-\secskip=1pc % space between refcard secs
-\lskip=2pt % extra skip between \sec entries
-%------- end papersize params
-%%
-%% change according to personal taste, not papersize dependent
-%%
-\barwidth=.1pt % width of the cropmark bar
-\barheight=2pt % height of the cropmark bar
-\intersecwidth=0.5em % width between \itmwid and \dfnwid
-%%
-%% END CONFIGURATION - PAPERSIZE DEFINITIONS
-%%
-
-%%
-%% values to be computed - nothing to configure
-%%
-\newdimen\fullhsize % width of area without margins
-\newdimen\itmwid % width of item column
-\newdimen\dfnwid % width of definition column
-\newdimen\temp % only for temporary use
-
-%%
-%% adjust the offsets so the margins are measured *from paper edge*
-%%
-\hoffset=-1in \advance \hoffset by \hmargin
-\voffset=-1in \advance \voffset by \vmargin
-
-%%
-%% fullhsize = totalwidth - (2 * hmargin)
-%%
-\fullhsize=\totalwidth
-\temp=\hmargin \multiply \temp by 2 \advance \fullhsize by -\temp
-
-%%
-%% hsize = (fullhsize - (4 * hmargin) - (2 * barwidth)) / 3
-%%
-\hsize=\fullhsize
-\temp=\hmargin \multiply \temp by 4 \advance \hsize by -\temp
-\temp=\barwidth \multiply \temp by 2 \advance \hsize by -\temp
-\divide \hsize by 3
-
-%%
-%% vsize = totalheight - (2 * vmargin)
-%%
-\vsize=\totalheight
-\temp=\vmargin \multiply \temp by 2 \advance \vsize by -\temp
-
-%%
-%% itmwid = (hsize - intersecwidth) * 1/3
-%% dfnwid = (hsize - intersecwidth) * 2/3
-%%
-\temp=\hsize \advance \temp by -\intersecwidth \divide \temp by 3
-\itmwid=\temp
-\dfnwid=\hsize \advance \dfnwid by -\itmwid
-
-%-------- end papersize defs
-
-
-\def\fulline{\hbox to \fullhsize}
-\let\lcr=L \newbox\leftcolumn\newbox\centercolumn
-\output={\if L\lcr
- \global\setbox\leftcolumn=\columnbox \global\let\lcr=C
- \else
- \if C\lcr
- \global\setbox\centercolumn=\columnbox \global\let\lcr=R
- \else \tripleformat \global\let\lcr=L
- \fi
- \fi
-% \ifnum\outputpenalty>-20000 \else\dosupereject\fi
- }
-
-%%
-%% START CONFIGURATION - ALTERNATIVE FOLDING GUIDES
-%%
-%% For NO printed folding guide,
-%% comment out other \def\vdecor's and uncomment:
-
-%\def\vdecor{\hskip\hmargin plus1fil\hskip\barwidth plus1fil\hskip\hmargin plus1fil}
-
-%% For SOLID LINE folding guide,
-%% comment out other \def\vdecor's and uncomment:
-
-%\def\vdecor{\hskip\hmargin plus1fil \vrule width \barwidth \hskip\hmargin plus1fil}
-
-%% For SMALL MARKS NEAR TOP AND BOTTOM as folding guide,
-%% comment out other \def\vdecor's and uncomment:
-
-\def\vdecor{\hskip\hmargin plus1fil
-\vbox to \vsize{\hbox to \barwidth{\vrule height\barheight width\barwidth}\vfill
-\hbox to \barwidth{\vrule height\barheight width\barwidth}}%THIS PERCENT SIGN IS ESSENTIAL
-\hskip\hmargin plus1fil}
-
-%%
-%% END CONFIGURATION - ALTERNATIVES FOR FOLDING GUIDES
-%%
-
-\def\tripleformat{\shipout\vbox{\fulline{\box\leftcolumn\vdecor
- \box\centercolumn\vdecor
- \columnbox}
- }
- \advancepageno}
-\def\columnbox{\leftline{\pagebody}}
-\def\bye{\par\vfill
- \supereject
- \if R\lcr \null\vfill\eject\fi
- \end}
-
-%-------------------- end three column format -----------------------
-
-%-------------------- Computer Modern font defs: --------------------
-\font\bbf=cmbx10
-\font\vbbf=cmbx12
-\font\smrm=cmr6
-\font\brm=cmr10
-\font\rm=cmr7
-\font\it=cmti7
-\font\tt=cmtt8
-%-------------------- end font defs ---------------------------------
-
-%
-\hyphenpenalty=5000\tolerance=2000\raggedright\raggedbottom
-\normalbaselineskip=9pt\baselineskip=9pt
-%
-\parindent=0pt
-\parskip=0pt
-\footline={\vbox to0pt{\hss}}
-%
-\def\ctl#1{{\tt C-#1}}
-\def\opt#1{{\brm[{\rm #1}]}}
-\def\xtra#1{\noalign{\smallskip{\tt#1}}}
-%
-\long\def\sec#1;#2\endsec{\vskip \secskip
-\halign{%
-%COL 1 (of halign):
-\vtop{\hsize=\itmwid\tt
-##\par\vskip \lskip }\hfil
-%COL 2 (of halign):
-&\vtop{\hsize=\dfnwid\hangafter=1\hangindent=\intersecwidth
-\rm ##\par\vskip \lskip}\cr
-%Tail of \long\def fills in halign body with \sec args:
-\noalign{{\bbf #1}\vskip \lskip}
-#2
-}
-}
-
-{\vbbf GDB QUICK REFERENCE}\hfil{\smrm GDB Version 4}\qquad
-
-\sec Essential Commands;
-gdb {\it program} \opt{{\it core}}&debug {\it program} \opt{using
-coredump {\it core}}\cr
-b \opt{\it file\tt:}{\it function}&set breakpoint at {\it function} \opt{in \it file}\cr
-run \opt{{\it arglist}}&start your program \opt{with {\it arglist}}\cr
-bt& backtrace: display program stack\cr
-p {\it expr}&display the value of an expression\cr
-c &continue running your program\cr
-n &next line, stepping over function calls\cr
-s &next line, stepping into function calls\cr
-\endsec
-
-\sec Starting GDB;
-gdb&start GDB, with no debugging files\cr
-gdb {\it program}&begin debugging {\it program}\cr
-gdb {\it program core}&debug coredump {\it core} produced by {\it
-program}\cr
-gdb --help&describe command line options\cr
-\endsec
-
-\sec Stopping GDB;
-quit&exit GDB; also {\tt q} or {\tt EOF} (eg \ctl{d})\cr
-INTERRUPT&(eg \ctl{c}) terminate current command, or send to running process\cr
-\endsec
-
-\sec Getting Help;
-help&list classes of commands\cr
-help {\it class}&one-line descriptions for commands in {\it class}\cr
-help {\it command}&describe {\it command}\cr
-\endsec
-
-\sec Executing your Program;
-run {\it arglist}&start your program with {\it arglist}\cr
-run&start your program with current argument list\cr
-run $\ldots$ <{\it inf} >{\it outf}&start your program with input, output
-redirected\cr
-\cr
-kill&kill running program\cr
-\cr
-tty {\it dev}&use {\it dev} as stdin and stdout for next {\tt run}\cr
-set args {\it arglist}&specify {\it arglist} for next
-{\tt run}\cr
-set args&specify empty argument list\cr
-show args&display argument list\cr
-\cr
-show environment&show all environment variables\cr
-show env {\it var}&show value of environment variable {\it var}\cr
-set env {\it var} {\it string}&set environment variable {\it var}\cr
-unset env {\it var}&remove {\it var} from environment\cr
-\endsec
-
-\sec Shell Commands;
-cd {\it dir}&change working directory to {\it dir}\cr
-pwd&Print working directory\cr
-make $\ldots$&call ``{\tt make}''\cr
-shell {\it cmd}&execute arbitrary shell command string\cr
-\endsec
-
-\vfill
-\line{\smrm \opt{ } surround optional arguments \hfill $\ldots$ show
-one or more arguments}
-\vskip\baselineskip
-\centerline{\smrm \copyright 1991, 1992 Free Software Foundation, Inc.\qquad Permissions on back}
-\eject
-\sec Breakpoints and Watchpoints;
-break \opt{\it file\tt:}{\it line}\par
-b \opt{\it file\tt:}{\it line}&set breakpoint at {\it line} number \opt{in \it file}\par
-eg:\quad{\tt break main.c:37}\quad\cr
-break \opt{\it file\tt:}{\it func}&set breakpoint at {\it
-func} \opt{in \it file}\cr
-break +{\it offset}\par
-break -{\it offset}&set break at {\it offset} lines from current stop\cr
-break *{\it addr}&set breakpoint at address {\it addr}\cr
-break&set breakpoint at next instruction\cr
-break $\ldots$ if {\it expr}&break conditionally on nonzero {\it expr}\cr
-cond {\it n} \opt{\it expr}&new conditional expression on breakpoint
-{\it n}; make unconditional if no {\it expr}\cr
-tbreak $\ldots$&temporary break; disable when reached\cr
-rbreak {\it regex}&break on all functions matching {\it regex}\cr
-watch {\it expr}&set a watchpoint for expression {\it expr}\cr
-catch {\it x}&break at C++ handler for exception {\it x}\cr
-\cr
-info break&show defined breakpoints\cr
-info watch&show defined watchpoints\cr
-\cr
-clear&delete breakpoints at next instruction\cr
-clear \opt{\it file\tt:}{\it fun}&delete breakpoints at entry to {\it fun}()\cr
-clear \opt{\it file\tt:}{\it line}&delete breakpoints on source line \cr
-delete \opt{{\it n}}&delete breakpoints
-\opt{or breakpoint {\it n}}\cr
-\cr
-disable \opt{{\it n}}&disable breakpoints
-\opt{or breakpoint {\it n}}
-\cr
-enable \opt{{\it n}}&enable breakpoints
-\opt{or breakpoint {\it n}}
-\cr
-enable once \opt{{\it n}}&enable breakpoints \opt{or breakpoint {\it n}};
-disable again when reached
-\cr
-enable del \opt{{\it n}}&enable breakpoints \opt{or breakpoint {\it n}};
-delete when reached
-\cr
-\cr
-ignore {\it n} {\it count}&ignore breakpoint {\it n}, {\it count}
-times\cr
-\cr
-commands {\it n}\par
-\qquad \opt{\tt silent}\par
-\qquad {\it command-list}&execute GDB {\it command-list} every time breakpoint {\it n} is reached. \opt{{\tt silent} suppresses default
-display}\cr
-end&end of {\it command-list}\cr
-\endsec
-
-\sec Program Stack;
-backtrace \opt{\it n}\par
-bt \opt{\it n}&print trace of all frames in stack; or of {\it n}
-frames---innermost if {\it n}{\tt >0}, outermost if {\it n}{\tt <0}\cr
-frame \opt{\it n}&select frame number {\it n} or frame at address {\it
-n}; if no {\it n}, display current frame\cr
-up {\it n}&select frame {\it n} frames up\cr
-down {\it n}&select frame {\it n} frames down\cr
-info frame \opt{\it addr}&describe selected frame, or frame at
-{\it addr}\cr
-info args&arguments of selected frame\cr
-info locals&local variables of selected frame\cr
-info reg \opt{\it rn}$\ldots$\par
-info all-reg \opt{\it rn}&register values \opt{for regs {\it rn\/}} in
-selected frame; {\tt all-reg} includes floating point\cr
-info catch&exception handlers active in selected frame\cr
-\endsec
-
-\vfill\eject
-\sec Execution Control;
-continue \opt{\it count}\par
-c \opt{\it count}&continue running; if {\it count} specified, ignore
-this breakpoint next {\it count} times\cr
-\cr
-step \opt{\it count}\par
-s \opt{\it count}&execute until another line reached; repeat {\it count} times if
-specified\cr
-stepi \opt{\it count}\par
-si \opt{\it count}&step by machine instructions rather than source
-lines\cr
-\cr
-next \opt{\it count}\par
-n \opt{\it count}&execute next line, including any function calls\cr
-nexti \opt{\it count}\par
-ni \opt{\it count}&next machine instruction rather than source
-line\cr
-\cr
-until \opt{\it location}&run until next instruction (or {\it
-location})\cr
-finish&run until selected stack frame returns\cr
-return \opt{\it expr}&pop selected stack frame without executing
-\opt{setting return value}\cr
-signal {\it num}&resume execution with signal {\it s} (none if {\tt 0})\cr
-jump {\it line}\par
-jump *{\it address}&resume execution at specified {\it line} number or
-{\it address}\cr
-set var={\it expr}&evaluate {\it expr} without displaying it; use for
-altering program variables\cr
-\endsec
-
-\sec Display;
-print \opt{\tt/{\it f}\/} \opt{\it expr}\par
-p \opt{\tt/{\it f}\/} \opt{\it expr}&show value of {\it expr} \opt{or
-last value \tt \$} according to format {\it f}:\cr
-\qquad x&hexadecimal\cr
-\qquad d&signed decimal\cr
-\qquad u&unsigned decimal\cr
-\qquad o&octal\cr
-\qquad t&binary\cr
-\qquad a&address, absolute and relative\cr
-\qquad c&character\cr
-\qquad f&floating point\cr
-call \opt{\tt /{\it f}\/} {\it expr}&like {\tt print} but does not display
-{\tt void}\cr
-x \opt{\tt/{\it Nuf}\/} {\it expr}&examine memory at address {\it expr};
-optional format spec follows slash\cr
-\quad {\it N}&count of how many units to display\cr
-\quad {\it u}&unit size; one of\cr
-&{\tt\qquad b}\ individual bytes\cr
-&{\tt\qquad h}\ halfwords (two bytes)\cr
-&{\tt\qquad w}\ words (four bytes)\cr
-&{\tt\qquad g}\ giant words (eight bytes)\cr
-\quad {\it f}&printing format. Any {\tt print} format, or\cr
-&{\tt\qquad s}\ null-terminated string\cr
-&{\tt\qquad i}\ machine instructions\cr
-disassem \opt{\it addr}&display memory as machine instructions\cr
-\endsec
-
-\sec Automatic Display;
-display \opt{\tt/\it f\/} {\it expr}&show value of {\it expr} each time
-program stops \opt{according to format {\it f}\/}\cr
-display&display all enabled expressions on list\cr
-undisplay {\it n}&remove number(s) {\it n} from list of
-automatically displayed expressions\cr
-disable disp {\it n}&disable display for expression(s) number {\it
-n}\cr
-enable disp {\it n}&enable display for expression(s) number {\it
-n}\cr
-info display&numbered list of display expressions\cr
-\endsec
-
-\vfill\eject
-
-\sec Expressions;
-{\it expr}&an expression in C, C++, or Modula-2 (including function calls), or:\cr
-{\it addr\/}@{\it len}&an array of {\it len} elements beginning at {\it
-addr}\cr
-{\it file}::{\it nm}&a variable or function {\it nm} defined in {\it
-file}\cr
-$\tt\{${\it type}$\tt\}${\it addr}&read memory at {\it addr} as specified
-{\it type}\cr
-\$&most recent displayed value\cr
-\${\it n}&{\it n}th displayed value\cr
-\$\$&displayed value previous to \$\cr
-\$\${\it n}&{\it n}th displayed value back from \$\cr
-\$\_&last address examined with {\tt x}\cr
-\$\_\_&value at address \$\_\cr
-\${\it var}&convenience variable; assign any value\cr
-\cr
-show values \opt{{\it n}}&show last 10 values \opt{or surrounding
-\${\it n}}\cr
-show convenience&display all convenience variables\cr
-\endsec
-
-\sec Symbol Table;
-info address {\it s}&show where symbol {\it s} is stored\cr
-info func \opt{\it regex}&show names, types of defined functions
-(all, or matching {\it regex})\cr
-info var \opt{\it regex}&show names, types of global variables (all,
-or matching {\it regex})\cr
-whatis \opt{\it expr}\par
-ptype \opt{\it expr}&show data type of {\it expr} \opt{or \tt \$}
-without evaluating; {\tt ptype} gives more detail\cr
-ptype {\it type}&describe type, struct, union, or enum\cr
-\endsec
-
-\sec GDB Scripts;
-source {\it script}&read, execute GDB commands from file {\it
-script}\cr
-\cr
-define {\it cmd}\par
-\qquad {\it command-list}&create new GDB command {\it cmd};
-execute script defined by {\it command-list}\cr
-end&end of {\it command-list}\cr
-document {\it cmd}\par
-\qquad {\it help-text}&create online documentation
-for new GDB command {\it cmd}\cr
-end&end of {\it help-text}\cr
-\endsec
-
-\sec Signals;
-handle {\it signal} {\it act}&specify GDB actions for {\it signal}:\cr
-\quad print&announce signal\cr
-\quad noprint&be silent for signal\cr
-\quad stop&halt execution on signal\cr
-\quad nostop&do not halt execution\cr
-\quad pass&allow your program to handle signal\cr
-\quad nopass&do not allow your program to see signal\cr
-info signals&show table of signals, GDB action for each\cr
-\endsec
-
-\sec Debugging Targets;
-target {\it type} {\it param}&connect to target machine, process, or file\cr
-help target&display available targets\cr
-attach {\it param}&connect to another process\cr
-detach&release target from GDB control\cr
-\endsec
-
-\vfill\eject
-\sec Controlling GDB;
-set {\it param} {\it value}&set one of GDB's internal parameters\cr
-show {\it param}&display current setting of parameter\cr
-\xtra{\rm Parameters understood by {\tt set} and {\tt show}:}
-\quad complaints {\it limit}&number of messages on unusual symbols\cr
-\quad confirm {\it on/off}&enable or disable cautionary queries\cr
-\quad editing {\it on/off}&control {\tt readline} command-line editing\cr
-\quad height {\it lpp}&number of lines before pause in display\cr
-\quad language {\it lang}&Language for GDB expressions ({\tt auto}, {\tt c} or
-{\tt modula-2})\cr
-\quad listsize {\it n}&number of lines shown by {\tt list}\cr
-\quad prompt {\it str}&use {\it str} as GDB prompt\cr
-\quad radix {\it base}&octal, decimal, or hex number representation\cr
-\quad verbose {\it on/off}&control messages when loading
-symbols\cr
-\quad width {\it cpl}&number of characters before line folded\cr
-\quad write {\it on/off}&Allow or forbid patching binary, core files
-(when reopened with {\tt exec} or {\tt core})
-\cr
-\quad history $\ldots$\par
-\quad h $\ldots$&groups with the following options:\cr
-\quad h exp {\it off/on}&disable/enable {\tt readline} history expansion\cr
-\quad h file {\it filename}&file for recording GDB command history\cr
-\quad h size {\it size}&number of commands kept in history list\cr
-\quad h save {\it off/on}&control use of external file for
-command history\cr
-\cr
-\quad print $\ldots$\par
-\quad p $\ldots$&groups with the following options:\cr
-\quad p address {\it on/off}&print memory addresses in stacks,
-values\cr
-\quad p array {\it off/on}&compact or attractive format for
-arrays\cr
-\quad p demangl {\it on/off}&source (demangled) or internal form for C++
-symbols\cr
-\quad p asm-dem {\it on/off}&demangle C++ symbols in
-machine-instruction output\cr
-\quad p elements {\it limit}&number of array elements to display\cr
-\quad p object {\it on/off}&print C++ derived types for objects\cr
-\quad p pretty {\it off/on}&struct display: compact or indented\cr
-\quad p union {\it on/off}&display of union members\cr
-\quad p vtbl {\it off/on}&display of C++ virtual function
-tables\cr
-\cr
-show commands&show last 10 commands\cr
-show commands {\it n}&show 10 commands around number {\it n}\cr
-show commands +&show next 10 commands\cr
-\endsec
-
-\sec Working Files;
-file \opt{\it file}&use {\it file} for both symbols and executable;
-with no arg, discard both\cr
-core \opt{\it file}&read {\it file} as coredump; or discard\cr
-exec \opt{\it file}&use {\it file} as executable only; or discard\cr
-symbol \opt{\it file}&use symbol table from {\it file}; or discard\cr
-load {\it file}&dynamically link {\it file\/} and add its symbols\cr
-add-sym {\it file} {\it addr}&read additional symbols from {\it file},
-dynamically loaded at {\it addr}\cr
-info files&display working files and targets in use\cr
-path {\it dirs}&add {\it dirs} to front of path searched for
-executable and symbol files\cr
-show path&display executable and symbol file path\cr
-info share&list names of shared libraries currently loaded\cr
-\endsec
-
-\vfill\eject
-\sec Source Files;
-dir {\it names}&add directory {\it names} to front of source path\cr
-dir&clear source path\cr
-show dir&show current source path\cr
-\cr
-list&show next ten lines of source\cr
-list -&show previous ten lines\cr
-list {\it lines}&display source surrounding {\it lines},
-specified as:\cr
-\quad{\opt{\it file\tt:}\it num}&line number \opt{in named file}\cr
-\quad{\opt{\it file\tt:}\it function}&beginning of function \opt{in
-named file}\cr
-\quad{\tt +\it off}&{\it off} lines after last printed\cr
-\quad{\tt -\it off}&{\it off} lines previous to last printed\cr
-\quad{\tt*\it address}&line containing {\it address}\cr
-list {\it f},{\it l}&from line {\it f} to line {\it l}\cr
-info line {\it num}&show starting, ending addresses of compiled code for
-source line {\it num}\cr
-info source&show name of current source file\cr
-info sources&list all source files in use\cr
-forw {\it regex}&search following source lines for {\it regex}\cr
-rev {\it regex}&search preceding source lines for {\it regex}\cr
-\endsec
-
-\sec GDB under GNU Emacs;
-M-x gdb&run GDB under Emacs\cr
-\ctl{h} m&describe GDB mode\cr
-M-s&step one line ({\tt step})\cr
-M-n&next line ({\tt next})\cr
-M-i&step one instruction ({\tt stepi})\cr
-\ctl{c} \ctl{f}&finish current stack frame ({\tt finish})\cr
-M-c&continue ({\tt cont})\cr
-M-u&up {\it arg} frames ({\tt up})\cr
-M-d&down {\it arg} frames ({\tt down})\cr
-\ctl{x} \&&copy number from point, insert at end\cr
-\ctl{x} SPC&(in source file) set break at point\cr
-\endsec
-
-\sec GDB License;
-show copying&Display GNU General Public License\cr
-show warranty&There is NO WARRANTY for GDB. Display full no-warranty
-statement.\cr
-\endsec
-
-
-\vfill
-{\smrm\parskip=6pt
-\centerline{Copyright \copyright 1991, 1992, 1993 Free Software Foundation, Inc.}
-\centerline{Roland Pesch (pesch@cygnus.com)}
-\centerline{The author assumes no responsibility for any errors on this card.}
-
-This card may be freely distributed under the terms of the GNU
-General Public License.
-
-\centerline{Please contribute to development of this card by
-annotating it.}
-
-GDB itself is free software; you are welcome to distribute copies of
-it under the terms of the GNU General Public License. There is
-absolutely no warranty for GDB.
-}
-\end
diff --git a/gnu/usr.bin/gdb/environ.c b/gnu/usr.bin/gdb/environ.c
deleted file mode 100644
index 0220166..0000000
--- a/gnu/usr.bin/gdb/environ.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)environ.c 6.3 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* environ.c -- library for manipulating environments for GNU.
- Copyright (C) 1986, 1989 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. */
-
-#define min(a, b) ((a) < (b) ? (a) : (b))
-#define max(a, b) ((a) > (b) ? (a) : (b))
-
-#include "environ.h"
-
-/* Return a new environment object. */
-
-struct environ *
-make_environ ()
-{
- register struct environ *e;
-
- e = (struct environ *) xmalloc (sizeof (struct environ));
-
- e->allocated = 10;
- e->vector = (char **) xmalloc ((e->allocated + 1) * sizeof (char *));
- e->vector[0] = 0;
- return e;
-}
-
-/* Free an environment and all the strings in it. */
-
-void
-free_environ (e)
- register struct environ *e;
-{
- register char **vector = e->vector;
-
- while (*vector)
- free (*vector++);
-
- free (e);
-}
-
-/* Copy the environment given to this process into E.
- Also copies all the strings in it, so we can be sure
- that all strings in these environments are safe to free. */
-
-void
-init_environ (e)
- register struct environ *e;
-{
- extern char **environ;
- register int i;
-
- for (i = 0; environ[i]; i++);
-
- if (e->allocated < i)
- {
- e->allocated = max (i, e->allocated + 10);
- e->vector = (char **) xrealloc (e->vector,
- (e->allocated + 1) * sizeof (char *));
- }
-
- bcopy (environ, e->vector, (i + 1) * sizeof (char *));
-
- while (--i >= 0)
- {
- register int len = strlen (e->vector[i]) + 1;
- register char *new = (char *) xmalloc (len);
- bcopy (e->vector[i], new, len);
- e->vector[i] = new;
- }
-}
-
-/* Return the vector of environment E.
- This is used to get something to pass to execve. */
-
-char **
-environ_vector (e)
- struct environ *e;
-{
- return e->vector;
-}
-
-/* Return the value in environment E of variable VAR. */
-
-char *
-get_in_environ (e, var)
- struct environ *e;
- char *var;
-{
- register int len = strlen (var);
- register char **vector = e->vector;
- register char *s;
-
- for (; s = *vector; vector++)
- if (!strncmp (s, var, len)
- && s[len] == '=')
- return &s[len + 1];
-
- return 0;
-}
-
-/* Store the value in E of VAR as VALUE. */
-
-void
-set_in_environ (e, var, value)
- struct environ *e;
- char *var;
- char *value;
-{
- register int i;
- register int len = strlen (var);
- register char **vector = e->vector;
- register char *s;
-
- for (i = 0; s = vector[i]; i++)
- if (!strncmp (s, var, len)
- && s[len] == '=')
- break;
-
- if (s == 0)
- {
- if (i == e->allocated)
- {
- e->allocated += 10;
- vector = (char **) xrealloc (vector,
- (e->allocated + 1) * sizeof (char *));
- e->vector = vector;
- }
- vector[i + 1] = 0;
- }
- else
- free (s);
-
- s = (char *) xmalloc (len + strlen (value) + 2);
- strcpy (s, var);
- strcat (s, "=");
- strcat (s, value);
- vector[i] = s;
- return;
-}
-
-/* Remove the setting for variable VAR from environment E. */
-
-void
-unset_in_environ (e, var)
- struct environ *e;
- char *var;
-{
- register int len = strlen (var);
- register char **vector = e->vector;
- register char *s;
-
- for (; s = *vector; vector++)
- if (!strncmp (s, var, len)
- && s[len] == '=')
- {
- free (s);
- bcopy (vector + 1, vector,
- (e->allocated - (vector - e->vector)) * sizeof (char *));
- e->vector[e->allocated - 1] = 0;
- return;
- }
-}
diff --git a/gnu/usr.bin/gdb/environ.h b/gnu/usr.bin/gdb/environ.h
deleted file mode 100644
index 13f31f4..0000000
--- a/gnu/usr.bin/gdb/environ.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Header for environment manipulation library.
- Copyright (C) 1989, Free Software Foundation.
-
- 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. */
-
-/* We manipulate environments represented as these structures. */
-
-struct environ
-{
- /* Number of usable slots allocated in VECTOR.
- VECTOR always has one slot not counted here,
- to hold the terminating zero. */
- int allocated;
- /* A vector of slots, ALLOCATED + 1 of them.
- The first few slots contain strings "VAR=VALUE"
- and the next one contains zero.
- Then come some unused slots. */
- char **vector;
-};
-
-struct environ *make_environ ();
-void free_environ ();
-void init_environ ();
-char *get_in_environ ();
-void set_in_environ ();
-void unset_in_environ ();
-char **environ_vector ();
diff --git a/gnu/usr.bin/gdb/eval.c b/gnu/usr.bin/gdb/eval.c
deleted file mode 100644
index 60779e6..0000000
--- a/gnu/usr.bin/gdb/eval.c
+++ /dev/null
@@ -1,1065 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)eval.c 6.3 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* Evaluate expressions for GDB.
- Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "defs.h"
-#include "param.h"
-#include "symtab.h"
-#include "value.h"
-#include "expression.h"
-
-
-/* Parse the string EXP as a C expression, evaluate it,
- and return the result as a number. */
-
-CORE_ADDR
-parse_and_eval_address (exp)
- char *exp;
-{
- struct expression *expr = parse_c_expression (exp);
- register CORE_ADDR addr;
- register struct cleanup *old_chain
- = make_cleanup (free_current_contents, &expr);
-
- addr = (CORE_ADDR) value_as_long (evaluate_expression (expr));
- do_cleanups (old_chain);
- return addr;
-}
-
-/* Like parse_and_eval_address but takes a pointer to a char * variable
- and advanced that variable across the characters parsed. */
-
-CORE_ADDR
-parse_and_eval_address_1 (expptr)
- char **expptr;
-{
- struct expression *expr = parse_c_1 (expptr, 0, 0);
- register CORE_ADDR addr;
- register struct cleanup *old_chain
- = make_cleanup (free_current_contents, &expr);
-
- addr = value_as_long (evaluate_expression (expr));
- do_cleanups (old_chain);
- return addr;
-}
-
-value
-parse_and_eval (exp)
- char *exp;
-{
- struct expression *expr = parse_c_expression (exp);
- register value val;
- register struct cleanup *old_chain
- = make_cleanup (free_current_contents, &expr);
-
- val = evaluate_expression (expr);
- do_cleanups (old_chain);
- return val;
-}
-
-/* Parse up to a comma (or to a closeparen)
- in the string EXPP as an expression, evaluate it, and return the value.
- EXPP is advanced to point to the comma. */
-
-value
-parse_to_comma_and_eval (expp)
- char **expp;
-{
- struct expression *expr = parse_c_1 (expp, 0, 1);
- register value val;
- register struct cleanup *old_chain
- = make_cleanup (free_current_contents, &expr);
-
- val = evaluate_expression (expr);
- do_cleanups (old_chain);
- return val;
-}
-
-/* Evaluate an expression in internal prefix form
- such as is constructed by expread.y.
-
- See expression.h for info on the format of an expression. */
-
-static value evaluate_subexp ();
-static value evaluate_subexp_for_address ();
-static value evaluate_subexp_for_sizeof ();
-static value evaluate_subexp_with_coercion ();
-
-/* return true if 'var' has an address in inferior's memory. */
-static int
-value_has_lval(var)
- register struct symbol *var;
-{
- switch (SYMBOL_CLASS(var))
- {
- case LOC_STATIC:
- case LOC_LABEL:
- case LOC_ARG:
- case LOC_REF_ARG:
- case LOC_LOCAL:
- case LOC_BLOCK:
- return (1);
- }
- return (0);
-}
-
-/* Values of NOSIDE argument to eval_subexp. */
-enum noside
-{ EVAL_NORMAL,
- EVAL_SKIP, /* Only effect is to increment pos. */
- EVAL_AVOID_SIDE_EFFECTS, /* Don't modify any variables or
- call any functions. The value
- returned will have the correct
- type, and will have an
- approximately correct lvalue
- type (inaccuracy: anything that is
- listed as being in a register in
- the function in which it was
- declared will be lval_register). */
-};
-
-value
-evaluate_expression (exp)
- struct expression *exp;
-{
- int pc = 0;
- return evaluate_subexp (0, exp, &pc, EVAL_NORMAL);
-}
-
-/* Evaluate an expression, avoiding all memory references
- and getting a value whose type alone is correct. */
-
-value
-evaluate_type (exp)
- struct expression *exp;
-{
- int pc = 0;
- return evaluate_subexp (0, exp, &pc, EVAL_AVOID_SIDE_EFFECTS);
-}
-
-static value
-evaluate_subexp (expect_type, exp, pos, noside)
- struct type *expect_type;
- register struct expression *exp;
- register int *pos;
- enum noside noside;
-{
- enum exp_opcode op;
- int tem;
- register int pc, pc2, oldpos;
- register value arg1, arg2, arg3;
- int nargs;
- value *argvec;
-
- pc = (*pos)++;
- op = exp->elts[pc].opcode;
-
- switch (op)
- {
- case OP_SCOPE:
- tem = strlen (&exp->elts[pc + 2].string);
- (*pos) += 3 + ((tem + sizeof (union exp_element))
- / sizeof (union exp_element));
- return value_static_field (exp->elts[pc + 1].type,
- &exp->elts[pc + 2].string, -1);
-
- case OP_LONG:
- (*pos) += 3;
- return value_from_long (exp->elts[pc + 1].type,
- exp->elts[pc + 2].longconst);
-
- case OP_DOUBLE:
- (*pos) += 3;
- return value_from_double (exp->elts[pc + 1].type,
- exp->elts[pc + 2].doubleconst);
-
- case OP_VAR_VALUE:
- (*pos) += 2;
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- {
- struct symbol * sym = exp->elts[pc + 1].symbol;
- enum lval_type lv;
-
- switch (SYMBOL_CLASS (sym))
- {
- case LOC_CONST:
- case LOC_LABEL:
- case LOC_CONST_BYTES:
- lv = not_lval;
- case LOC_REGISTER:
- case LOC_REGPARM:
- lv = lval_register;
- default:
- lv = lval_memory;
- }
-
- return value_zero (SYMBOL_TYPE (sym), lv);
- }
- else
- return value_of_variable (exp->elts[pc + 1].symbol);
-
- case OP_LAST:
- (*pos) += 2;
- return access_value_history ((int) exp->elts[pc + 1].longconst);
-
- case OP_REGISTER:
- (*pos) += 2;
- return value_of_register ((int) exp->elts[pc + 1].longconst);
-
- case OP_INTERNALVAR:
- (*pos) += 2;
- return value_of_internalvar (exp->elts[pc + 1].internalvar);
-
- case OP_STRING:
- tem = strlen (&exp->elts[pc + 1].string);
- (*pos) += 2 + ((tem + sizeof (union exp_element))
- / sizeof (union exp_element));
- if (noside == EVAL_SKIP)
- goto nosideret;
- return value_string (&exp->elts[pc + 1].string, tem);
-
- case TERNOP_COND:
- /* Skip third and second args to evaluate the first one. */
- arg1 = evaluate_subexp (0, exp, pos, noside);
- if (value_zerop (arg1))
- {
- evaluate_subexp (0, exp, pos, EVAL_SKIP);
- return evaluate_subexp (0, exp, pos, noside);
- }
- else
- {
- arg2 = evaluate_subexp (0, exp, pos, noside);
- evaluate_subexp (0, exp, pos, EVAL_SKIP);
- return arg2;
- }
-
- case OP_FUNCALL:
- (*pos) += 2;
- op = exp->elts[*pos].opcode;
- if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR)
- {
- int fnptr;
- int tem2;
-
- nargs = (int) exp->elts[pc + 1].longconst + 1;
- /* First, evaluate the structure into arg2 */
- pc2 = (*pos)++;
-
- if (noside == EVAL_SKIP)
- goto nosideret;
-
- if (op == STRUCTOP_MEMBER)
- {
- arg2 = evaluate_subexp_for_address (exp, pos, noside);
- }
- else
- {
- arg2 = evaluate_subexp (0, exp, pos, noside);
- }
-
- /* If the function is a virtual function, then the
- aggregate value (providing the structure) plays
- its part by providing the vtable. Otherwise,
- it is just along for the ride: call the function
- directly. */
-
- arg1 = evaluate_subexp (0, exp, pos, noside);
-
- fnptr = (int) value_as_long (arg1);
- if (fnptr < 128)
- {
- struct type *basetype;
- int i, j;
- basetype = TYPE_TARGET_TYPE (VALUE_TYPE (arg2));
- basetype = TYPE_VPTR_BASETYPE (basetype);
- for (i = TYPE_NFN_FIELDS (basetype) - 1; i >= 0; i--)
- {
- struct fn_field *f = TYPE_FN_FIELDLIST1 (basetype, i);
- /* If one is virtual, then all are virtual. */
- if (TYPE_FN_FIELD_VIRTUAL_P (f, 0))
- for (j = TYPE_FN_FIELDLIST_LENGTH (basetype, i) - 1; j >= 0; --j)
- if (TYPE_FN_FIELD_VOFFSET (f, j) == fnptr)
- {
- value vtbl;
- value base = value_ind (arg2);
- struct type *fntype = lookup_pointer_type (TYPE_FN_FIELD_TYPE (f, j));
-
- if (TYPE_VPTR_FIELDNO (basetype) < 0)
- TYPE_VPTR_FIELDNO (basetype)
- = fill_in_vptr_fieldno (basetype);
-
- VALUE_TYPE (base) = basetype;
- vtbl = value_field (base, TYPE_VPTR_FIELDNO (basetype));
- VALUE_TYPE (vtbl) = lookup_pointer_type (fntype);
- VALUE_TYPE (arg1) = builtin_type_int;
- arg1 = value_subscript (vtbl, arg1);
- VALUE_TYPE (arg1) = fntype;
- goto got_it;
- }
- }
- if (i < 0)
- error ("virtual function at index %d not found", fnptr);
- }
- else
- {
- VALUE_TYPE (arg1) = lookup_pointer_type (TYPE_TARGET_TYPE (VALUE_TYPE (arg1)));
- }
- got_it:
-
- /* Now, say which argument to start evaluating from */
- tem = 2;
- }
- else if (op == STRUCTOP_STRUCT || op == STRUCTOP_PTR)
- {
- /* Hair for method invocations */
- int tem2;
-
- nargs = (int) exp->elts[pc + 1].longconst + 1;
- /* First, evaluate the structure into arg2 */
- pc2 = (*pos)++;
- tem2 = strlen (&exp->elts[pc2 + 1].string);
- *pos += 2 + (tem2 + sizeof (union exp_element)) / sizeof (union exp_element);
- if (noside == EVAL_SKIP)
- goto nosideret;
-
- if (op == STRUCTOP_STRUCT)
- {
- arg2 = evaluate_subexp_for_address (exp, pos, noside);
- }
- else
- {
- arg2 = evaluate_subexp (0, exp, pos, noside);
- }
- /* Now, say which argument to start evaluating from */
- tem = 2;
- }
- else
- {
- nargs = (int) exp->elts[pc + 1].longconst;
- tem = 0;
- }
- argvec = (value *) alloca (sizeof (value) * (nargs + 2));
- for (; tem <= nargs; tem++)
- /* Ensure that array expressions are coerced into pointer objects. */
- argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);
-
- /* signal end of arglist */
- argvec[tem] = 0;
-
- if (op == STRUCTOP_STRUCT || op == STRUCTOP_PTR)
- {
- int static_memfuncp;
-
- argvec[1] = arg2;
- argvec[0] =
- value_struct_elt (arg2, argvec+1, &exp->elts[pc2 + 1].string,
- &static_memfuncp,
- op == STRUCTOP_STRUCT
- ? "structure" : "structure pointer");
- if (static_memfuncp)
- {
- argvec[1] = argvec[0];
- nargs--;
- argvec++;
- }
- }
- else if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR)
- {
- argvec[1] = arg2;
- argvec[0] = arg1;
- }
-
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- {
- /* If the return type doesn't look like a function type, call an
- error. This can happen if somebody tries to turn a variable into
- a function call. This is here because people often want to
- call, eg, strcmp, which gdb doesn't know is a function. If
- gdb isn't asked for it's opinion (ie. through "whatis"),
- it won't offer it. */
-
- struct type *ftype =
- TYPE_TARGET_TYPE (VALUE_TYPE (argvec[0]));
-
- if (ftype)
- return allocate_value (TYPE_TARGET_TYPE (VALUE_TYPE (argvec[0])));
- else
- error ("Expression of type other than \"Function returning ...\" used as function");
- }
- return call_function (argvec[0], nargs, argvec + 1);
-
- case STRUCTOP_STRUCT:
- tem = strlen (&exp->elts[pc + 1].string);
- (*pos) += 2 + ((tem + sizeof (union exp_element))
- / sizeof (union exp_element));
-
- /* Try to convert "foo.bar" into "(&foo)->bar" so we won't copy
- * the entire contents of a large struct just to extract one
- * value from it. */
- if (noside == EVAL_NORMAL && exp->elts[*pos].opcode == OP_VAR_VALUE
- && value_has_lval(exp->elts[*pos + 1].symbol))
- arg1 = evaluate_subexp_for_address(exp, pos, noside);
- else
- arg1 = evaluate_subexp (0, exp, pos, noside);
-
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- {
- register struct type *type = VALUE_TYPE (arg1);
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
- type = TYPE_TARGET_TYPE (type);
- return value_zero (lookup_struct_elt_type (type,
- &exp->elts[pc + 1].string),
- lval_memory);
- }
- else
- return value_struct_elt (arg1, 0, &exp->elts[pc + 1].string, 0,
- "structure");
-
- case STRUCTOP_PTR:
- tem = strlen (&exp->elts[pc + 1].string);
- (*pos) += 2 + (tem + sizeof (union exp_element)) / sizeof (union exp_element);
- arg1 = evaluate_subexp (0, exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (lookup_struct_elt_type (TYPE_TARGET_TYPE
- (VALUE_TYPE (arg1)),
- &exp->elts[pc + 1].string),
- lval_memory);
- else
- return value_struct_elt (arg1, 0, &exp->elts[pc + 1].string, 0,
- "structure pointer");
-
- case STRUCTOP_MEMBER:
- arg1 = evaluate_subexp_for_address (exp, pos, noside);
- arg2 = evaluate_subexp (0, exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- /* Now, convert these values to an address. */
- if (TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_PTR
- || ((TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg2)))
- != TYPE_CODE_MEMBER)
- && (TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg2)))
- != TYPE_CODE_METHOD)))
- error ("non-pointer-to-member value used in pointer-to-member construct");
- arg3 = value_from_long (builtin_type_long,
- value_as_long (arg1) + value_as_long (arg2));
- VALUE_TYPE (arg3) =
- lookup_pointer_type (TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (VALUE_TYPE (arg2))));
- return value_ind (arg3);
-
- case STRUCTOP_MPTR:
- arg1 = evaluate_subexp (0, exp, pos, noside);
- arg2 = evaluate_subexp (0, exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- /* Now, convert these values to an address. */
- if (TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_PTR
- || (TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg2))) != TYPE_CODE_MEMBER
- && TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg2))) != TYPE_CODE_METHOD))
- error ("non-pointer-to-member value used in pointer-to-member construct");
- arg3 = value_from_long (builtin_type_long,
- value_as_long (arg1) + value_as_long (arg2));
- VALUE_TYPE (arg3) =
- lookup_pointer_type (TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (VALUE_TYPE (arg2))));
- return value_ind (arg3);
-
- case BINOP_ASSIGN:
- arg1 = evaluate_subexp (0, exp, pos, noside);
- arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
- if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
- return arg1;
- if (binop_user_defined_p (op, arg1, arg2))
- return value_x_binop (arg1, arg2, op, 0);
- else
- return value_assign (arg1, arg2);
-
- case BINOP_ASSIGN_MODIFY:
- (*pos) += 2;
- arg1 = evaluate_subexp (0, exp, pos, noside);
- arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
- if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
- return arg1;
- op = exp->elts[pc + 1].opcode;
- if (binop_user_defined_p (op, arg1, arg2))
- return value_x_binop (arg1, arg2, BINOP_ASSIGN_MODIFY, op);
- else if (op == BINOP_ADD)
- arg2 = value_add (arg1, arg2);
- else if (op == BINOP_SUB)
- arg2 = value_sub (arg1, arg2);
- else
- arg2 = value_binop (arg1, arg2, op);
- return value_assign (arg1, arg2);
-
- case BINOP_ADD:
- arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
- arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (binop_user_defined_p (op, arg1, arg2))
- return value_x_binop (arg1, arg2, op, 0);
- else
- return value_add (arg1, arg2);
-
- case BINOP_SUB:
- arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
- arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (binop_user_defined_p (op, arg1, arg2))
- return value_x_binop (arg1, arg2, op, 0);
- else
- return value_sub (arg1, arg2);
-
- case BINOP_MUL:
- case BINOP_DIV:
- case BINOP_REM:
- case BINOP_LSH:
- case BINOP_RSH:
- case BINOP_LOGAND:
- case BINOP_LOGIOR:
- case BINOP_LOGXOR:
- arg1 = evaluate_subexp (0, exp, pos, noside);
- arg2 = evaluate_subexp (0, exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (binop_user_defined_p (op, arg1, arg2))
- return value_x_binop (arg1, arg2, op, 0);
- else
- if (noside == EVAL_AVOID_SIDE_EFFECTS
- && op == BINOP_DIV)
- return value_zero (VALUE_TYPE (arg1), not_lval);
- else
- return value_binop (arg1, arg2, op);
-
- case BINOP_SUBSCRIPT:
- arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
- arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (TYPE_TARGET_TYPE (VALUE_TYPE (arg1)),
- VALUE_LVAL (arg1));
-
- if (binop_user_defined_p (op, arg1, arg2))
- return value_x_binop (arg1, arg2, op, 0);
- else
- return value_subscript (arg1, arg2);
-
- case BINOP_AND:
- arg1 = evaluate_subexp (0, exp, pos, noside);
- if (noside == EVAL_SKIP)
- {
- arg2 = evaluate_subexp (0, exp, pos, noside);
- goto nosideret;
- }
-
- oldpos = *pos;
- arg2 = evaluate_subexp (0, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
- *pos = oldpos;
-
- if (binop_user_defined_p (op, arg1, arg2))
- {
- arg2 = evaluate_subexp (0, exp, pos, noside);
- return value_x_binop (arg1, arg2, op, 0);
- }
- else
- {
- tem = value_zerop (arg1);
- arg2 = evaluate_subexp (0, exp, pos,
- (tem ? EVAL_SKIP : noside));
- return value_from_long (builtin_type_int,
- (LONGEST) (!tem && !value_zerop (arg2)));
- }
-
- case BINOP_OR:
- arg1 = evaluate_subexp (0, exp, pos, noside);
- if (noside == EVAL_SKIP)
- {
- arg2 = evaluate_subexp (0, exp, pos, noside);
- goto nosideret;
- }
-
- oldpos = *pos;
- arg2 = evaluate_subexp (0, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
- *pos = oldpos;
-
- if (binop_user_defined_p (op, arg1, arg2))
- {
- arg2 = evaluate_subexp (0, exp, pos, noside);
- return value_x_binop (arg1, arg2, op, 0);
- }
- else
- {
- tem = value_zerop (arg1);
- arg2 = evaluate_subexp (0, exp, pos,
- (!tem ? EVAL_SKIP : noside));
- return value_from_long (builtin_type_int,
- (LONGEST) (!tem || !value_zerop (arg2)));
- }
-
- case BINOP_EQUAL:
- arg1 = evaluate_subexp (0, exp, pos, noside);
- arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (binop_user_defined_p (op, arg1, arg2))
- {
- return value_x_binop (arg1, arg2, op, 0);
- }
- else
- {
- tem = value_equal (arg1, arg2);
- return value_from_long (builtin_type_int, (LONGEST) tem);
- }
-
- case BINOP_NOTEQUAL:
- arg1 = evaluate_subexp (0, exp, pos, noside);
- arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (binop_user_defined_p (op, arg1, arg2))
- {
- return value_x_binop (arg1, arg2, op, 0);
- }
- else
- {
- tem = value_equal (arg1, arg2);
- return value_from_long (builtin_type_int, (LONGEST) ! tem);
- }
-
- case BINOP_LESS:
- arg1 = evaluate_subexp (0, exp, pos, noside);
- arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (binop_user_defined_p (op, arg1, arg2))
- {
- return value_x_binop (arg1, arg2, op, 0);
- }
- else
- {
- tem = value_less (arg1, arg2);
- return value_from_long (builtin_type_int, (LONGEST) tem);
- }
-
- case BINOP_GTR:
- arg1 = evaluate_subexp (0, exp, pos, noside);
- arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (binop_user_defined_p (op, arg1, arg2))
- {
- return value_x_binop (arg1, arg2, op, 0);
- }
- else
- {
- tem = value_less (arg2, arg1);
- return value_from_long (builtin_type_int, (LONGEST) tem);
- }
-
- case BINOP_GEQ:
- arg1 = evaluate_subexp (0, exp, pos, noside);
- arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (binop_user_defined_p (op, arg1, arg2))
- {
- return value_x_binop (arg1, arg2, op, 0);
- }
- else
- {
- tem = value_less (arg1, arg2);
- return value_from_long (builtin_type_int, (LONGEST) ! tem);
- }
-
- case BINOP_LEQ:
- arg1 = evaluate_subexp (0, exp, pos, noside);
- arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (binop_user_defined_p (op, arg1, arg2))
- {
- return value_x_binop (arg1, arg2, op, 0);
- }
- else
- {
- tem = value_less (arg2, arg1);
- return value_from_long (builtin_type_int, (LONGEST) ! tem);
- }
-
- case BINOP_REPEAT:
- arg1 = evaluate_subexp (0, exp, pos, noside);
- arg2 = evaluate_subexp (0, exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_INT)
- error ("Non-integral right operand for \"@\" operator.");
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return allocate_repeat_value (VALUE_TYPE (arg1),
- (int) value_as_long (arg2));
- else
- return value_repeat (arg1, (int) value_as_long (arg2));
-
- case BINOP_COMMA:
- evaluate_subexp (0, exp, pos, noside);
- return evaluate_subexp (0, exp, pos, noside);
-
- case UNOP_NEG:
- arg1 = evaluate_subexp (0, exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (unop_user_defined_p (op, arg1))
- return value_x_unop (arg1, op);
- else
- return value_neg (arg1);
-
- case UNOP_LOGNOT:
- arg1 = evaluate_subexp (0, exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (unop_user_defined_p (op, arg1))
- return value_x_unop (arg1, op);
- else
- return value_lognot (arg1);
-
- case UNOP_ZEROP:
- arg1 = evaluate_subexp (0, exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (unop_user_defined_p (op, arg1))
- return value_x_unop (arg1, op);
- else
- return value_from_long (builtin_type_int,
- (LONGEST) value_zerop (arg1));
-
- case UNOP_IND:
- if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR)
- expect_type = TYPE_TARGET_TYPE (expect_type);
- arg1 = evaluate_subexp (expect_type, exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- {
- if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_PTR
- || TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_REF
- /* In C you can dereference an array to get the 1st elt. */
- || TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_ARRAY
- )
- return value_zero (TYPE_TARGET_TYPE (VALUE_TYPE (arg1)),
- lval_memory);
- else if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_INT)
- /* GDB allows dereferencing an int. */
- return value_zero (builtin_type_int, lval_memory);
- else
- error ("Attempt to take contents of a non-pointer value.");
- }
- return value_ind (arg1);
-
- case UNOP_ADDR:
- /* C++: check for and handle pointer to members. */
-
- op = exp->elts[*pos].opcode;
-
- if (noside == EVAL_SKIP)
- {
- if (op == OP_SCOPE)
- {
- char *name = &exp->elts[pc+3].string;
- int tem = strlen (name);
- (*pos) += 2 + (tem + sizeof (union exp_element)) / sizeof (union exp_element);
- }
- else
- evaluate_subexp (expect_type, exp, pos, EVAL_SKIP);
- goto nosideret;
- }
-
- if (op == OP_SCOPE)
- {
- char *name = &exp->elts[pc+3].string;
- int tem = strlen (name);
- struct type *domain = exp->elts[pc+2].type;
- (*pos) += 2 + (tem + sizeof (union exp_element)) / sizeof (union exp_element);
- arg1 = value_struct_elt_for_address (domain, expect_type, name);
- if (arg1)
- return arg1;
- error ("no field `%s' in structure", name);
- }
- else
- return evaluate_subexp_for_address (exp, pos, noside);
-
- case UNOP_SIZEOF:
- if (noside == EVAL_SKIP)
- {
- evaluate_subexp (0, exp, pos, EVAL_SKIP);
- goto nosideret;
- }
- return evaluate_subexp_for_sizeof (exp, pos);
-
- case UNOP_CAST:
- (*pos) += 2;
- arg1 = evaluate_subexp (expect_type, exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- return value_cast (exp->elts[pc + 1].type, arg1);
-
- case UNOP_MEMVAL:
- (*pos) += 2;
- arg1 = evaluate_subexp (expect_type, exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (exp->elts[pc + 1].type, lval_memory);
- else
- return value_at (exp->elts[pc + 1].type,
- (CORE_ADDR) value_as_long (arg1));
-
- case UNOP_PREINCREMENT:
- arg1 = evaluate_subexp (expect_type, exp, pos, noside);
- if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
- return arg1;
- else if (unop_user_defined_p (op, arg1))
- {
- return value_x_unop (arg1, op);
- }
- else
- {
- arg2 = value_add (arg1, value_from_long (builtin_type_char,
- (LONGEST) 1));
- return value_assign (arg1, arg2);
- }
-
- case UNOP_PREDECREMENT:
- arg1 = evaluate_subexp (expect_type, exp, pos, noside);
- if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
- return arg1;
- else if (unop_user_defined_p (op, arg1))
- {
- return value_x_unop (arg1, op);
- }
- else
- {
- arg2 = value_sub (arg1, value_from_long (builtin_type_char,
- (LONGEST) 1));
- return value_assign (arg1, arg2);
- }
-
- case UNOP_POSTINCREMENT:
- arg1 = evaluate_subexp (expect_type, exp, pos, noside);
- if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
- return arg1;
- else if (unop_user_defined_p (op, arg1))
- {
- return value_x_unop (arg1, op);
- }
- else
- {
- arg2 = value_add (arg1, value_from_long (builtin_type_char,
- (LONGEST) 1));
- value_assign (arg1, arg2);
- return arg1;
- }
-
- case UNOP_POSTDECREMENT:
- arg1 = evaluate_subexp (expect_type, exp, pos, noside);
- if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
- return arg1;
- else if (unop_user_defined_p (op, arg1))
- {
- return value_x_unop (arg1, op);
- }
- else
- {
- arg2 = value_sub (arg1, value_from_long (builtin_type_char,
- (LONGEST) 1));
- value_assign (arg1, arg2);
- return arg1;
- }
-
- case OP_THIS:
- (*pos) += 1;
- return value_of_this (1);
-
- default:
- error ("internal error: I do not know how to evaluate what you gave me");
- }
-
- nosideret:
- return value_from_long (builtin_type_long, (LONGEST) 1);
-}
-
-/* Evaluate a subexpression of EXP, at index *POS,
- and return the address of that subexpression.
- Advance *POS over the subexpression.
- If the subexpression isn't an lvalue, get an error.
- NOSIDE may be EVAL_AVOID_SIDE_EFFECTS;
- then only the type of the result need be correct. */
-
-static value
-evaluate_subexp_for_address (exp, pos, noside)
- register struct expression *exp;
- register int *pos;
- enum noside noside;
-{
- enum exp_opcode op;
- register int pc;
-
- pc = (*pos);
- op = exp->elts[pc].opcode;
-
- switch (op)
- {
- case UNOP_IND:
- (*pos)++;
- return evaluate_subexp (0, exp, pos, noside);
-
- case UNOP_MEMVAL:
- (*pos) += 3;
- return value_cast (lookup_pointer_type (exp->elts[pc + 1].type),
- evaluate_subexp (0, exp, pos, noside));
-
- case OP_VAR_VALUE:
- (*pos) += 3;
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- {
- struct type *type =
- lookup_pointer_type (SYMBOL_TYPE (exp->elts[pc + 1].symbol));
- enum address_class sym_class =
- SYMBOL_CLASS (exp->elts[pc + 1].symbol);
-
- if (sym_class == LOC_CONST
- || sym_class == LOC_CONST_BYTES
- || sym_class == LOC_REGISTER
- || sym_class == LOC_REGPARM)
- error ("Attempt to take address of register or constant.");
-
- return
- value_zero (type, not_lval);
- }
- else
- return locate_var_value (exp->elts[pc + 1].symbol, (CORE_ADDR) 0);
-
- default:
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- {
- value x = evaluate_subexp (0, exp, pos, noside);
- if (VALUE_LVAL (x) == lval_memory)
- return value_zero (TYPE_POINTER_TYPE (VALUE_TYPE (x)),
- not_lval);
- else
- error ("Attempt to take address of non-lval");
- }
- return value_addr (evaluate_subexp (0, exp, pos, noside));
- }
-}
-
-/* Evaluate like `evaluate_subexp' except coercing arrays to pointers.
- When used in contexts where arrays will be coerced anyway,
- this is equivalent to `evaluate_subexp'
- but much faster because it avoids actually fetching array contents. */
-
-static value
-evaluate_subexp_with_coercion (exp, pos, noside)
- register struct expression *exp;
- register int *pos;
- enum noside noside;
-{
- register enum exp_opcode op;
- register int pc;
- register value val;
-
- pc = (*pos);
- op = exp->elts[pc].opcode;
-
- switch (op)
- {
- case OP_VAR_VALUE:
- if (TYPE_CODE (SYMBOL_TYPE (exp->elts[pc + 1].symbol)) == TYPE_CODE_ARRAY)
- {
- (*pos) += 3;
- val = locate_var_value (exp->elts[pc + 1].symbol, (CORE_ADDR) 0);
- return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (SYMBOL_TYPE (exp->elts[pc + 1].symbol))),
- val);
- }
- }
-
- return evaluate_subexp (0, exp, pos, noside);
-}
-
-/* Evaluate a subexpression of EXP, at index *POS,
- and return a value for the size of that subexpression.
- Advance *POS over the subexpression. */
-
-static value
-evaluate_subexp_for_sizeof (exp, pos)
- register struct expression *exp;
- register int *pos;
-{
- enum exp_opcode op;
- register int pc;
- value val;
-
- pc = (*pos);
- op = exp->elts[pc].opcode;
-
- switch (op)
- {
- /* This case is handled specially
- so that we avoid creating a value for the result type.
- If the result type is very big, it's desirable not to
- create a value unnecessarily. */
- case UNOP_IND:
- (*pos)++;
- val = evaluate_subexp (0, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
- return value_from_long (builtin_type_int, (LONGEST)
- TYPE_LENGTH (TYPE_TARGET_TYPE (VALUE_TYPE (val))));
-
- case UNOP_MEMVAL:
- (*pos) += 3;
- return value_from_long (builtin_type_int,
- (LONGEST) TYPE_LENGTH (exp->elts[pc + 1].type));
-
- case OP_VAR_VALUE:
- (*pos) += 3;
- return value_from_long (builtin_type_int,
- (LONGEST) TYPE_LENGTH (SYMBOL_TYPE (exp->elts[pc + 1].symbol)));
-
- default:
- val = evaluate_subexp (0, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
- return value_from_long (builtin_type_int,
- (LONGEST) TYPE_LENGTH (VALUE_TYPE (val)));
- }
-}
diff --git a/gnu/usr.bin/gdb/expprint.c b/gnu/usr.bin/gdb/expprint.c
deleted file mode 100644
index 2c63cf8..0000000
--- a/gnu/usr.bin/gdb/expprint.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/* Print in infix form a struct expression.
- Copyright (C) 1986, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include "defs.h"
-#include "param.h"
-#include "symtab.h"
-#include "expression.h"
-#include "value.h"
-
-
-/* These codes indicate operator precedences, least tightly binding first. */
-/* Adding 1 to a precedence value is done for binary operators,
- on the operand which is more tightly bound, so that operators
- of equal precedence within that operand will get parentheses. */
-/* PREC_HYPER and PREC_ABOVE_COMMA are not the precedence of any operator;
- they are used as the "surrounding precedence" to force
- various kinds of things to be parenthesized. */
-enum precedence
-{ PREC_NULL, PREC_COMMA, PREC_ABOVE_COMMA, PREC_ASSIGN, PREC_OR, PREC_AND,
- PREC_LOGIOR, PREC_LOGAND, PREC_LOGXOR, PREC_EQUAL, PREC_ORDER,
- PREC_SHIFT, PREC_ADD, PREC_MUL, PREC_REPEAT,
- PREC_HYPER, PREC_PREFIX, PREC_SUFFIX };
-
-/* Table mapping opcodes into strings for printing operators
- and precedences of the operators. */
-
-struct op_print
-{
- char *string;
- enum exp_opcode opcode;
- /* Precedence of operator. These values are used only by comparisons. */
- enum precedence precedence;
- int right_assoc;
-};
-
-static struct op_print op_print_tab[] =
- {
- {",", BINOP_COMMA, PREC_COMMA, 0},
- {"=", BINOP_ASSIGN, PREC_ASSIGN, 1},
- {"||", BINOP_OR, PREC_OR, 0},
- {"&&", BINOP_AND, PREC_AND, 0},
- {"|", BINOP_LOGIOR, PREC_LOGIOR, 0},
- {"&", BINOP_LOGAND, PREC_LOGAND, 0},
- {"^", BINOP_LOGXOR, PREC_LOGXOR, 0},
- {"==", BINOP_EQUAL, PREC_EQUAL, 0},
- {"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
- {"<=", BINOP_LEQ, PREC_ORDER, 0},
- {">=", BINOP_GEQ, PREC_ORDER, 0},
- {">", BINOP_GTR, PREC_ORDER, 0},
- {"<", BINOP_LESS, PREC_ORDER, 0},
- {">>", BINOP_RSH, PREC_SHIFT, 0},
- {"<<", BINOP_LSH, PREC_SHIFT, 0},
- {"+", BINOP_ADD, PREC_ADD, 0},
- {"-", BINOP_SUB, PREC_ADD, 0},
- {"*", BINOP_MUL, PREC_MUL, 0},
- {"/", BINOP_DIV, PREC_MUL, 0},
- {"%", BINOP_REM, PREC_MUL, 0},
- {"@", BINOP_REPEAT, PREC_REPEAT, 0},
- {"-", UNOP_NEG, PREC_PREFIX, 0},
- {"!", UNOP_ZEROP, PREC_PREFIX, 0},
- {"~", UNOP_LOGNOT, PREC_PREFIX, 0},
- {"*", UNOP_IND, PREC_PREFIX, 0},
- {"&", UNOP_ADDR, PREC_PREFIX, 0},
- {"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0},
- {"++", UNOP_PREINCREMENT, PREC_PREFIX, 0},
- {"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
- /* C++ */
- {"::", BINOP_SCOPE, PREC_PREFIX, 0},
- };
-
-static void print_subexp ();
-
-void
-print_expression (exp, stream)
- struct expression *exp;
- FILE *stream;
-{
- int pc = 0;
- print_subexp (exp, &pc, stream, PREC_NULL);
-}
-
-/* Print the subexpression of EXP that starts in position POS, on STREAM.
- PREC is the precedence of the surrounding operator;
- if the precedence of the main operator of this subexpression is less,
- parentheses are needed here. */
-
-static void
-print_subexp (exp, pos, stream, prec)
- register struct expression *exp;
- register int *pos;
- FILE *stream;
- enum precedence prec;
-{
- register int tem;
- register int pc;
- int nargs;
- register char *op_str;
- int assign_modify = 0;
- enum exp_opcode opcode;
- enum precedence myprec;
- /* Set to 1 for a right-associative operator. */
- int assoc;
-
- pc = (*pos)++;
- opcode = exp->elts[pc].opcode;
- switch (opcode)
- {
- case OP_SCOPE:
- myprec = PREC_PREFIX;
- assoc = 0;
- (*pos) += 2;
- print_subexp (exp, pos, stream, (int) myprec + assoc);
- fprintf (stream, " :: ");
- nargs = strlen (&exp->elts[pc + 2].string);
- (*pos) += 1 + (nargs + sizeof (union exp_element)) / sizeof (union exp_element);
-
- fprintf (stream, &exp->elts[pc + 2].string);
- return;
-
- case OP_LONG:
- (*pos) += 3;
- value_print (value_from_long (exp->elts[pc + 1].type,
- exp->elts[pc + 2].longconst),
- stream, 0, Val_no_prettyprint);
- return;
-
- case OP_DOUBLE:
- (*pos) += 3;
- value_print (value_from_double (exp->elts[pc + 1].type,
- exp->elts[pc + 2].doubleconst),
- stream, 0, Val_no_prettyprint);
- return;
-
- case OP_VAR_VALUE:
- (*pos) += 2;
- fprintf (stream, "%s", SYMBOL_NAME (exp->elts[pc + 1].symbol));
- return;
-
- case OP_LAST:
- (*pos) += 2;
- fprintf (stream, "$%d", (int) exp->elts[pc + 1].longconst);
- return;
-
- case OP_REGISTER:
- (*pos) += 2;
- fprintf (stream, "$%s", reg_names[exp->elts[pc + 1].longconst]);
- return;
-
- case OP_INTERNALVAR:
- (*pos) += 2;
- fprintf (stream, "$%s",
- internalvar_name (exp->elts[pc + 1].internalvar));
- return;
-
- case OP_FUNCALL:
- (*pos) += 2;
- nargs = exp->elts[pc + 1].longconst;
- print_subexp (exp, pos, stream, PREC_SUFFIX);
- fprintf (stream, " (");
- for (tem = 0; tem < nargs; tem++)
- {
- if (tem > 0)
- fprintf (stream, ", ");
- print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
- }
- fprintf (stream, ")");
- return;
-
- case OP_STRING:
- nargs = strlen (&exp->elts[pc + 1].string);
- (*pos) += 2 + (nargs + sizeof (union exp_element)) / sizeof (union exp_element);
- fprintf (stream, "\"");
- for (tem = 0; tem < nargs; tem++)
- printchar ((&exp->elts[pc + 1].string)[tem], stream, '"');
- fprintf (stream, "\"");
- return;
-
- case TERNOP_COND:
- if ((int) prec > (int) PREC_COMMA)
- fprintf (stream, "(");
- /* Print the subexpressions, forcing parentheses
- around any binary operations within them.
- This is more parentheses than are strictly necessary,
- but it looks clearer. */
- print_subexp (exp, pos, stream, PREC_HYPER);
- fprintf (stream, " ? ");
- print_subexp (exp, pos, stream, PREC_HYPER);
- fprintf (stream, " : ");
- print_subexp (exp, pos, stream, PREC_HYPER);
- if ((int) prec > (int) PREC_COMMA)
- fprintf (stream, ")");
- return;
-
- case STRUCTOP_STRUCT:
- tem = strlen (&exp->elts[pc + 1].string);
- (*pos) += 2 + (tem + sizeof (union exp_element)) / sizeof (union exp_element);
- print_subexp (exp, pos, stream, PREC_SUFFIX);
- fprintf (stream, ".%s", &exp->elts[pc + 1].string);
- return;
-
- case STRUCTOP_PTR:
- tem = strlen (&exp->elts[pc + 1].string);
- (*pos) += 2 + (tem + sizeof (union exp_element)) / sizeof (union exp_element);
- print_subexp (exp, pos, stream, PREC_SUFFIX);
- fprintf (stream, "->%s", &exp->elts[pc + 1].string);
- return;
-
- case BINOP_SUBSCRIPT:
- print_subexp (exp, pos, stream, PREC_SUFFIX);
- fprintf (stream, "[");
- print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
- fprintf (stream, "]");
- return;
-
- case UNOP_POSTINCREMENT:
- print_subexp (exp, pos, stream, PREC_SUFFIX);
- fprintf (stream, "++");
- return;
-
- case UNOP_POSTDECREMENT:
- print_subexp (exp, pos, stream, PREC_SUFFIX);
- fprintf (stream, "--");
- return;
-
- case UNOP_CAST:
- (*pos) += 2;
- if ((int) prec > (int) PREC_PREFIX)
- fprintf (stream, "(");
- fprintf (stream, "(");
- type_print (exp->elts[pc + 1].type, "", stream, 0);
- fprintf (stream, ") ");
- print_subexp (exp, pos, stream, PREC_PREFIX);
- if ((int) prec > (int) PREC_PREFIX)
- fprintf (stream, ")");
- return;
-
- case UNOP_MEMVAL:
- (*pos) += 2;
- if ((int) prec > (int) PREC_PREFIX)
- fprintf (stream, "(");
- fprintf (stream, "{");
- type_print (exp->elts[pc + 1].type, "", stream, 0);
- fprintf (stream, "} ");
- print_subexp (exp, pos, stream, PREC_PREFIX);
- if ((int) prec > (int) PREC_PREFIX)
- fprintf (stream, ")");
- return;
-
- case BINOP_ASSIGN_MODIFY:
- opcode = exp->elts[pc + 1].opcode;
- (*pos) += 2;
- myprec = PREC_ASSIGN;
- assoc = 1;
- assign_modify = 1;
- for (tem = 0; tem < sizeof op_print_tab / sizeof op_print_tab[0]; tem++)
- if (op_print_tab[tem].opcode == opcode)
- {
- op_str = op_print_tab[tem].string;
- break;
- }
-
- case OP_THIS:
- ++(*pos);
- fprintf (stream, "this");
- return;
-
- default:
- for (tem = 0; tem < sizeof op_print_tab / sizeof op_print_tab[0]; tem++)
- if (op_print_tab[tem].opcode == opcode)
- {
- op_str = op_print_tab[tem].string;
- myprec = op_print_tab[tem].precedence;
- assoc = op_print_tab[tem].right_assoc;
- break;
- }
- }
-
- if ((int) myprec < (int) prec)
- fprintf (stream, "(");
- if ((int) opcode > (int) BINOP_END)
- {
- /* Unary prefix operator. */
- fprintf (stream, "%s", op_str);
- print_subexp (exp, pos, stream, PREC_PREFIX);
- }
- else
- {
- /* Binary operator. */
- /* Print left operand.
- If operator is right-associative,
- increment precedence for this operand. */
- print_subexp (exp, pos, stream, (int) myprec + assoc);
- /* Print the operator itself. */
- if (assign_modify)
- fprintf (stream, " %s= ", op_str);
- else if (op_str[0] == ',')
- fprintf (stream, "%s ", op_str);
- else
- fprintf (stream, " %s ", op_str);
- /* Print right operand.
- If operator is left-associative,
- increment precedence for this operand. */
- print_subexp (exp, pos, stream, (int) myprec + !assoc);
- }
- if ((int) myprec < (int) prec)
- fprintf (stream, ")");
-}
diff --git a/gnu/usr.bin/gdb/expread.y b/gnu/usr.bin/gdb/expread.y
deleted file mode 100644
index 96a12c4..0000000
--- a/gnu/usr.bin/gdb/expread.y
+++ /dev/null
@@ -1,1782 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-/* Parse C expressions for GDB.
- Copyright (C) 1986, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Parse a C expression from text in a string,
- and return the result as a struct expression pointer.
- That structure contains arithmetic operations in reverse polish,
- with constants represented by operations that are followed by special data.
- See expression.h for the details of the format.
- What is important here is that it can be built up sequentially
- during the process of parsing; the lower levels of the tree always
- come first in the result. */
-
-%{
-#ifndef lint
-static char sccsid[] = "@(#)expread.y 6.3 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-#include <stdio.h>
-#include "defs.h"
-#include "param.h"
-#include "symtab.h"
-#include "frame.h"
-#include "expression.h"
-
-#include <a.out.h>
-
-static struct expression *expout;
-static int expout_size;
-static int expout_ptr;
-
-static int yylex ();
-static void yyerror ();
-static void write_exp_elt ();
-static void write_exp_elt_opcode ();
-static void write_exp_elt_sym ();
-static void write_exp_elt_longcst ();
-static void write_exp_elt_dblcst ();
-static void write_exp_elt_type ();
-static void write_exp_elt_intern ();
-static void write_exp_string ();
-static void start_arglist ();
-static int end_arglist ();
-static void free_funcalls ();
-static char *copy_name ();
-
-/* If this is nonzero, this block is used as the lexical context
- for symbol names. */
-
-static struct block *expression_context_block;
-
-/* The innermost context required by the stack and register variables
- we've encountered so far. */
-struct block *innermost_block;
-
-/* The block in which the most recently discovered symbol was found. */
-struct block *block_found;
-
-/* Number of arguments seen so far in innermost function call. */
-static int arglist_len;
-
-/* Data structure for saving values of arglist_len
- for function calls whose arguments contain other function calls. */
-
-struct funcall
- {
- struct funcall *next;
- int arglist_len;
- };
-
-struct funcall *funcall_chain;
-
-/* This kind of datum is used to represent the name
- of a symbol token. */
-
-struct stoken
- {
- char *ptr;
- int length;
- };
-
-/* For parsing of complicated types.
- An array should be preceded in the list by the size of the array. */
-enum type_pieces
- {tp_end = -1, tp_pointer, tp_reference, tp_array, tp_function};
-static enum type_pieces *type_stack;
-static int type_stack_depth, type_stack_size;
-
-static void push_type ();
-static enum type_pieces pop_type ();
-
-/* Allow debugging of parsing. */
-#define YYDEBUG 1
-%}
-
-/* Although the yacc "value" of an expression is not used,
- since the result is stored in the structure being created,
- other node types do have values. */
-
-%union
- {
- LONGEST lval;
- unsigned LONGEST ulval;
- double dval;
- struct symbol *sym;
- struct type *tval;
- struct stoken sval;
- int voidval;
- struct block *bval;
- enum exp_opcode opcode;
- struct internalvar *ivar;
-
- struct type **tvec;
- int *ivec;
- }
-
-%type <voidval> exp exp1 start variable
-%type <tval> type typebase
-%type <tvec> nonempty_typelist
-%type <bval> block
-
-/* Fancy type parsing. */
-%type <voidval> func_mod direct_abs_decl abs_decl
-%type <tval> ptype
-%type <lval> array_mod
-
-%token <lval> INT CHAR
-%token <ulval> UINT
-%token <dval> FLOAT
-
-/* Both NAME and TYPENAME tokens represent symbols in the input,
- and both convey their data as strings.
- But a TYPENAME is a string that happens to be defined as a typedef
- or builtin type name (such as int or char)
- and a NAME is any other symbol.
-
- Contexts where this distinction is not important can use the
- nonterminal "name", which matches either NAME or TYPENAME. */
-
-%token <sval> NAME TYPENAME BLOCKNAME STRING
-%type <sval> name name_not_typename typename
-
-%token STRUCT UNION ENUM SIZEOF UNSIGNED COLONCOLON
-
-/* Special type cases, put in to allow the parser to distinguish different
- legal basetypes. */
-%token SIGNED LONG SHORT INT_KEYWORD
-
-%token <lval> LAST REGNAME
-
-%token <ivar> VARIABLE
-
-%token <opcode> ASSIGN_MODIFY
-
-/* C++ */
-%token THIS
-
-%left ','
-%left ABOVE_COMMA
-%right '=' ASSIGN_MODIFY
-%right '?'
-%left OR
-%left AND
-%left '|'
-%left '^'
-%left '&'
-%left EQUAL NOTEQUAL
-%left '<' '>' LEQ GEQ
-%left LSH RSH
-%left '@'
-%left '+' '-'
-%left '*' '/' '%'
-%right UNARY INCREMENT DECREMENT
-%right ARROW '.' '[' '('
-%left COLONCOLON
-
-%%
-
-start : exp1
- ;
-
-/* Expressions, including the comma operator. */
-exp1 : exp
- | exp1 ',' exp
- { write_exp_elt_opcode (BINOP_COMMA); }
- ;
-
-/* Expressions, not including the comma operator. */
-exp : '*' exp %prec UNARY
- { write_exp_elt_opcode (UNOP_IND); }
-
-exp : '&' exp %prec UNARY
- { write_exp_elt_opcode (UNOP_ADDR); }
-
-exp : '-' exp %prec UNARY
- { write_exp_elt_opcode (UNOP_NEG); }
- ;
-
-exp : '!' exp %prec UNARY
- { write_exp_elt_opcode (UNOP_ZEROP); }
- ;
-
-exp : '~' exp %prec UNARY
- { write_exp_elt_opcode (UNOP_LOGNOT); }
- ;
-
-exp : INCREMENT exp %prec UNARY
- { write_exp_elt_opcode (UNOP_PREINCREMENT); }
- ;
-
-exp : DECREMENT exp %prec UNARY
- { write_exp_elt_opcode (UNOP_PREDECREMENT); }
- ;
-
-exp : exp INCREMENT %prec UNARY
- { write_exp_elt_opcode (UNOP_POSTINCREMENT); }
- ;
-
-exp : exp DECREMENT %prec UNARY
- { write_exp_elt_opcode (UNOP_POSTDECREMENT); }
- ;
-
-exp : SIZEOF exp %prec UNARY
- { write_exp_elt_opcode (UNOP_SIZEOF); }
- ;
-
-exp : exp ARROW name
- { write_exp_elt_opcode (STRUCTOP_PTR);
- write_exp_string ($3);
- write_exp_elt_opcode (STRUCTOP_PTR); }
- ;
-
-exp : exp ARROW '*' exp
- { write_exp_elt_opcode (STRUCTOP_MPTR); }
- ;
-
-exp : exp '.' name
- { write_exp_elt_opcode (STRUCTOP_STRUCT);
- write_exp_string ($3);
- write_exp_elt_opcode (STRUCTOP_STRUCT); }
- ;
-
-exp : exp '.' '*' exp
- { write_exp_elt_opcode (STRUCTOP_MEMBER); }
- ;
-
-exp : exp '[' exp1 ']'
- { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
- ;
-
-exp : exp '('
- /* This is to save the value of arglist_len
- being accumulated by an outer function call. */
- { start_arglist (); }
- arglist ')' %prec ARROW
- { write_exp_elt_opcode (OP_FUNCALL);
- write_exp_elt_longcst ((LONGEST) end_arglist ());
- write_exp_elt_opcode (OP_FUNCALL); }
- ;
-
-arglist :
- ;
-
-arglist : exp
- { arglist_len = 1; }
- ;
-
-arglist : arglist ',' exp %prec ABOVE_COMMA
- { arglist_len++; }
- ;
-
-exp : '{' type '}' exp %prec UNARY
- { write_exp_elt_opcode (UNOP_MEMVAL);
- write_exp_elt_type ($2);
- write_exp_elt_opcode (UNOP_MEMVAL); }
- ;
-
-exp : '(' type ')' exp %prec UNARY
- { write_exp_elt_opcode (UNOP_CAST);
- write_exp_elt_type ($2);
- write_exp_elt_opcode (UNOP_CAST); }
- ;
-
-exp : '(' exp1 ')'
- { }
- ;
-
-/* Binary operators in order of decreasing precedence. */
-
-exp : exp '@' exp
- { write_exp_elt_opcode (BINOP_REPEAT); }
- ;
-
-exp : exp '*' exp
- { write_exp_elt_opcode (BINOP_MUL); }
- ;
-
-exp : exp '/' exp
- { write_exp_elt_opcode (BINOP_DIV); }
- ;
-
-exp : exp '%' exp
- { write_exp_elt_opcode (BINOP_REM); }
- ;
-
-exp : exp '+' exp
- { write_exp_elt_opcode (BINOP_ADD); }
- ;
-
-exp : exp '-' exp
- { write_exp_elt_opcode (BINOP_SUB); }
- ;
-
-exp : exp LSH exp
- { write_exp_elt_opcode (BINOP_LSH); }
- ;
-
-exp : exp RSH exp
- { write_exp_elt_opcode (BINOP_RSH); }
- ;
-
-exp : exp EQUAL exp
- { write_exp_elt_opcode (BINOP_EQUAL); }
- ;
-
-exp : exp NOTEQUAL exp
- { write_exp_elt_opcode (BINOP_NOTEQUAL); }
- ;
-
-exp : exp LEQ exp
- { write_exp_elt_opcode (BINOP_LEQ); }
- ;
-
-exp : exp GEQ exp
- { write_exp_elt_opcode (BINOP_GEQ); }
- ;
-
-exp : exp '<' exp
- { write_exp_elt_opcode (BINOP_LESS); }
- ;
-
-exp : exp '>' exp
- { write_exp_elt_opcode (BINOP_GTR); }
- ;
-
-exp : exp '&' exp
- { write_exp_elt_opcode (BINOP_LOGAND); }
- ;
-
-exp : exp '^' exp
- { write_exp_elt_opcode (BINOP_LOGXOR); }
- ;
-
-exp : exp '|' exp
- { write_exp_elt_opcode (BINOP_LOGIOR); }
- ;
-
-exp : exp AND exp
- { write_exp_elt_opcode (BINOP_AND); }
- ;
-
-exp : exp OR exp
- { write_exp_elt_opcode (BINOP_OR); }
- ;
-
-exp : exp '?' exp ':' exp %prec '?'
- { write_exp_elt_opcode (TERNOP_COND); }
- ;
-
-exp : exp '=' exp
- { write_exp_elt_opcode (BINOP_ASSIGN); }
- ;
-
-exp : exp ASSIGN_MODIFY exp
- { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
- write_exp_elt_opcode ($2);
- write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
- ;
-
-exp : INT
- { write_exp_elt_opcode (OP_LONG);
- if ($1 == (int) $1 || $1 == (unsigned int) $1)
- write_exp_elt_type (builtin_type_int);
- else
- write_exp_elt_type (BUILTIN_TYPE_LONGEST);
- write_exp_elt_longcst ((LONGEST) $1);
- write_exp_elt_opcode (OP_LONG); }
- ;
-
-exp : UINT
- {
- write_exp_elt_opcode (OP_LONG);
- if ($1 == (unsigned int) $1)
- write_exp_elt_type (builtin_type_unsigned_int);
- else
- write_exp_elt_type (BUILTIN_TYPE_UNSIGNED_LONGEST);
- write_exp_elt_longcst ((LONGEST) $1);
- write_exp_elt_opcode (OP_LONG);
- }
- ;
-
-exp : CHAR
- { write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_char);
- write_exp_elt_longcst ((LONGEST) $1);
- write_exp_elt_opcode (OP_LONG); }
- ;
-
-exp : FLOAT
- { write_exp_elt_opcode (OP_DOUBLE);
- write_exp_elt_type (builtin_type_double);
- write_exp_elt_dblcst ($1);
- write_exp_elt_opcode (OP_DOUBLE); }
- ;
-
-exp : variable
- ;
-
-exp : LAST
- { write_exp_elt_opcode (OP_LAST);
- write_exp_elt_longcst ((LONGEST) $1);
- write_exp_elt_opcode (OP_LAST); }
- ;
-
-exp : REGNAME
- { write_exp_elt_opcode (OP_REGISTER);
- write_exp_elt_longcst ((LONGEST) $1);
- write_exp_elt_opcode (OP_REGISTER); }
- ;
-
-exp : VARIABLE
- { write_exp_elt_opcode (OP_INTERNALVAR);
- write_exp_elt_intern ($1);
- write_exp_elt_opcode (OP_INTERNALVAR); }
- ;
-
-exp : SIZEOF '(' type ')' %prec UNARY
- { write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_int);
- write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
- write_exp_elt_opcode (OP_LONG); }
- ;
-
-exp : STRING
- { write_exp_elt_opcode (OP_STRING);
- write_exp_string ($1);
- write_exp_elt_opcode (OP_STRING); }
- ;
-
-/* C++. */
-exp : THIS
- { write_exp_elt_opcode (OP_THIS);
- write_exp_elt_opcode (OP_THIS); }
- ;
-
-/* end of C++. */
-
-block : BLOCKNAME
- {
- struct symtab *tem = lookup_symtab (copy_name ($1));
- struct symbol *sym;
-
- if (tem)
- $$ = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), 1);
- else
- {
- sym = lookup_symbol (copy_name ($1),
- expression_context_block,
- VAR_NAMESPACE, 0);
- if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
- $$ = SYMBOL_BLOCK_VALUE (sym);
- else
- error ("No file or function \"%s\".",
- copy_name ($1));
- }
- }
- ;
-
-block : block COLONCOLON name
- { struct symbol *tem
- = lookup_symbol (copy_name ($3), $1, VAR_NAMESPACE, 0);
- if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
- error ("No function \"%s\" in specified context.",
- copy_name ($3));
- $$ = SYMBOL_BLOCK_VALUE (tem); }
- ;
-
-variable: block COLONCOLON name
- { struct symbol *sym;
- sym = lookup_symbol (copy_name ($3), $1, VAR_NAMESPACE, 0);
- if (sym == 0)
- error ("No symbol \"%s\" in specified context.",
- copy_name ($3));
- write_exp_elt_opcode (OP_VAR_VALUE);
- write_exp_elt_sym (sym);
- write_exp_elt_opcode (OP_VAR_VALUE); }
- ;
-
-variable: typebase COLONCOLON name
- {
- struct type *type = $1;
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION)
- error ("`%s' is not defined as an aggregate type.",
- TYPE_NAME (type));
-
- write_exp_elt_opcode (OP_SCOPE);
- write_exp_elt_type (type);
- write_exp_string ($3);
- write_exp_elt_opcode (OP_SCOPE);
- }
- | COLONCOLON name
- {
- char *name = copy_name ($2);
- struct symbol *sym;
- int i;
-
- sym = lookup_symbol (name, 0, VAR_NAMESPACE, 0);
- if (sym)
- {
- write_exp_elt_opcode (OP_VAR_VALUE);
- write_exp_elt_sym (sym);
- write_exp_elt_opcode (OP_VAR_VALUE);
- break;
- }
- for (i = 0; i < misc_function_count; i++)
- if (!strcmp (misc_function_vector[i].name, name))
- break;
-
- if (i < misc_function_count)
- {
- enum misc_function_type mft =
- (enum misc_function_type)
- misc_function_vector[i].type;
-
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_int);
- write_exp_elt_longcst ((LONGEST) misc_function_vector[i].address);
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_opcode (UNOP_MEMVAL);
- if (mft == mf_data || mft == mf_bss)
- write_exp_elt_type (builtin_type_int);
- else if (mft == mf_text)
- write_exp_elt_type (lookup_function_type (builtin_type_int));
- else
- write_exp_elt_type (builtin_type_char);
- write_exp_elt_opcode (UNOP_MEMVAL);
- }
- else
- if (symtab_list == 0
- && partial_symtab_list == 0)
- error ("No symbol table is loaded. Use the \"symbol-file\" command.");
- else
- error ("No symbol \"%s\" in current context.", name);
- }
- ;
-
-variable: name_not_typename
- { struct symbol *sym;
- int is_a_field_of_this;
-
- sym = lookup_symbol (copy_name ($1),
- expression_context_block,
- VAR_NAMESPACE,
- &is_a_field_of_this);
- if (sym)
- {
- switch (sym->class)
- {
- case LOC_REGISTER:
- case LOC_ARG:
- case LOC_LOCAL:
- if (innermost_block == 0 ||
- contained_in (block_found,
- innermost_block))
- innermost_block = block_found;
- }
- write_exp_elt_opcode (OP_VAR_VALUE);
- write_exp_elt_sym (sym);
- write_exp_elt_opcode (OP_VAR_VALUE);
- }
- else if (is_a_field_of_this)
- {
- /* C++: it hangs off of `this'. Must
- not inadvertently convert from a method call
- to data ref. */
- if (innermost_block == 0 ||
- contained_in (block_found, innermost_block))
- innermost_block = block_found;
- write_exp_elt_opcode (OP_THIS);
- write_exp_elt_opcode (OP_THIS);
- write_exp_elt_opcode (STRUCTOP_PTR);
- write_exp_string ($1);
- write_exp_elt_opcode (STRUCTOP_PTR);
- }
- else
- {
- register int i;
- register char *arg = copy_name ($1);
-
- for (i = 0; i < misc_function_count; i++)
- if (!strcmp (misc_function_vector[i].name, arg))
- break;
-
- if (i < misc_function_count)
- {
- enum misc_function_type mft =
- (enum misc_function_type)
- misc_function_vector[i].type;
-
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_int);
- write_exp_elt_longcst ((LONGEST) misc_function_vector[i].address);
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_opcode (UNOP_MEMVAL);
- if (mft == mf_data || mft == mf_bss)
- write_exp_elt_type (builtin_type_int);
- else if (mft == mf_text)
- write_exp_elt_type (lookup_function_type (builtin_type_int));
- else
- write_exp_elt_type (builtin_type_char);
- write_exp_elt_opcode (UNOP_MEMVAL);
- }
- else if (symtab_list == 0
- && partial_symtab_list == 0)
- error ("No symbol table is loaded. Use the \"symbol-file\" command.");
- else
- error ("No symbol \"%s\" in current context.",
- copy_name ($1));
- }
- }
- ;
-
-
-ptype : typebase
- | typebase abs_decl
- {
- /* This is where the interesting stuff happens. */
- int done = 0;
- int array_size;
- struct type *follow_type = $1;
-
- while (!done)
- switch (pop_type ())
- {
- case tp_end:
- done = 1;
- break;
- case tp_pointer:
- follow_type = lookup_pointer_type (follow_type);
- break;
- case tp_reference:
- follow_type = lookup_reference_type (follow_type);
- break;
- case tp_array:
- array_size = (int) pop_type ();
- if (array_size != -1)
- follow_type = create_array_type (follow_type,
- array_size);
- else
- follow_type = lookup_pointer_type (follow_type);
- break;
- case tp_function:
- follow_type = lookup_function_type (follow_type);
- break;
- }
- $$ = follow_type;
- }
- ;
-
-abs_decl: '*'
- { push_type (tp_pointer); $$ = 0; }
- | '*' abs_decl
- { push_type (tp_pointer); $$ = $2; }
- | direct_abs_decl
- ;
-
-direct_abs_decl: '(' abs_decl ')'
- { $$ = $2; }
- | direct_abs_decl array_mod
- {
- push_type ((enum type_pieces) $2);
- push_type (tp_array);
- }
- | array_mod
- {
- push_type ((enum type_pieces) $1);
- push_type (tp_array);
- $$ = 0;
- }
- | direct_abs_decl func_mod
- { push_type (tp_function); }
- | func_mod
- { push_type (tp_function); }
- ;
-
-array_mod: '[' ']'
- { $$ = -1; }
- | '[' INT ']'
- { $$ = $2; }
- ;
-
-func_mod: '(' ')'
- { $$ = 0; }
- ;
-
-type : ptype
- | typebase COLONCOLON '*'
- { $$ = lookup_member_type (builtin_type_int, $1); }
- | type '(' typebase COLONCOLON '*' ')'
- { $$ = lookup_member_type ($1, $3); }
- | type '(' typebase COLONCOLON '*' ')' '(' ')'
- { $$ = lookup_member_type
- (lookup_function_type ($1), $3); }
- | type '(' typebase COLONCOLON '*' ')' '(' nonempty_typelist ')'
- { $$ = lookup_member_type
- (lookup_function_type ($1), $3);
- free ($8); }
- ;
-
-typebase
- : TYPENAME
- { $$ = lookup_typename (copy_name ($1),
- expression_context_block, 0); }
- | INT_KEYWORD
- { $$ = builtin_type_int; }
- | LONG
- { $$ = builtin_type_long; }
- | SHORT
- { $$ = builtin_type_short; }
- | LONG INT_KEYWORD
- { $$ = builtin_type_long; }
- | UNSIGNED LONG INT_KEYWORD
- { $$ = builtin_type_unsigned_long; }
- | SHORT INT_KEYWORD
- { $$ = builtin_type_short; }
- | UNSIGNED SHORT INT_KEYWORD
- { $$ = builtin_type_unsigned_short; }
- | STRUCT name
- { $$ = lookup_struct (copy_name ($2),
- expression_context_block); }
- | UNION name
- { $$ = lookup_union (copy_name ($2),
- expression_context_block); }
- | ENUM name
- { $$ = lookup_enum (copy_name ($2),
- expression_context_block); }
- | UNSIGNED typename
- { $$ = lookup_unsigned_typename (copy_name ($2)); }
- | UNSIGNED
- { $$ = builtin_type_unsigned_int; }
- | SIGNED typename
- { $$ = lookup_typename (copy_name ($2),
- expression_context_block, 0); }
- | SIGNED
- { $$ = builtin_type_int; }
- ;
-
-typename: TYPENAME
- | INT_KEYWORD
- {
- $$.ptr = "int";
- $$.length = 3;
- }
- | LONG
- {
- $$.ptr = "long";
- $$.length = 4;
- }
- | SHORT
- {
- $$.ptr = "short";
- $$.length = 5;
- }
- ;
-
-nonempty_typelist
- : type
- { $$ = (struct type **)xmalloc (sizeof (struct type *) * 2);
- $$[0] = (struct type *)0;
- $$[1] = $1;
- }
- | nonempty_typelist ',' type
- { int len = sizeof (struct type *) * ++($<ivec>1[0]);
- $$ = (struct type **)xrealloc ($1, len);
- $$[$<ivec>$[0]] = $3;
- }
- ;
-
-name : NAME
- | BLOCKNAME
- | TYPENAME
- ;
-
-name_not_typename : NAME
- | BLOCKNAME
- ;
-
-%%
-
-/* Begin counting arguments for a function call,
- saving the data about any containing call. */
-
-static void
-start_arglist ()
-{
- register struct funcall *new = (struct funcall *) xmalloc (sizeof (struct funcall));
-
- new->next = funcall_chain;
- new->arglist_len = arglist_len;
- arglist_len = 0;
- funcall_chain = new;
-}
-
-/* Return the number of arguments in a function call just terminated,
- and restore the data for the containing function call. */
-
-static int
-end_arglist ()
-{
- register int val = arglist_len;
- register struct funcall *call = funcall_chain;
- funcall_chain = call->next;
- arglist_len = call->arglist_len;
- free (call);
- return val;
-}
-
-/* Free everything in the funcall chain.
- Used when there is an error inside parsing. */
-
-static void
-free_funcalls ()
-{
- register struct funcall *call, *next;
-
- for (call = funcall_chain; call; call = next)
- {
- next = call->next;
- free (call);
- }
-}
-
-/* This page contains the functions for adding data to the struct expression
- being constructed. */
-
-/* Add one element to the end of the expression. */
-
-/* To avoid a bug in the Sun 4 compiler, we pass things that can fit into
- a register through here */
-
-static void
-write_exp_elt (expelt)
- union exp_element expelt;
-{
- if (expout_ptr >= expout_size)
- {
- expout_size *= 2;
- expout = (struct expression *) xrealloc (expout,
- sizeof (struct expression)
- + expout_size * sizeof (union exp_element));
- }
- expout->elts[expout_ptr++] = expelt;
-}
-
-static void
-write_exp_elt_opcode (expelt)
- enum exp_opcode expelt;
-{
- union exp_element tmp;
-
- tmp.opcode = expelt;
-
- write_exp_elt (tmp);
-}
-
-static void
-write_exp_elt_sym (expelt)
- struct symbol *expelt;
-{
- union exp_element tmp;
-
- tmp.symbol = expelt;
-
- write_exp_elt (tmp);
-}
-
-static void
-write_exp_elt_longcst (expelt)
- LONGEST expelt;
-{
- union exp_element tmp;
-
- tmp.longconst = expelt;
-
- write_exp_elt (tmp);
-}
-
-static void
-write_exp_elt_dblcst (expelt)
- double expelt;
-{
- union exp_element tmp;
-
- tmp.doubleconst = expelt;
-
- write_exp_elt (tmp);
-}
-
-static void
-write_exp_elt_type (expelt)
- struct type *expelt;
-{
- union exp_element tmp;
-
- tmp.type = expelt;
-
- write_exp_elt (tmp);
-}
-
-static void
-write_exp_elt_intern (expelt)
- struct internalvar *expelt;
-{
- union exp_element tmp;
-
- tmp.internalvar = expelt;
-
- write_exp_elt (tmp);
-}
-
-/* Add a string constant to the end of the expression.
- Follow it by its length in bytes, as a separate exp_element. */
-
-static void
-write_exp_string (str)
- struct stoken str;
-{
- register int len = str.length;
- register int lenelt
- = (len + sizeof (union exp_element)) / sizeof (union exp_element);
-
- expout_ptr += lenelt;
-
- if (expout_ptr >= expout_size)
- {
- expout_size = max (expout_size * 2, expout_ptr + 10);
- expout = (struct expression *)
- xrealloc (expout, (sizeof (struct expression)
- + (expout_size * sizeof (union exp_element))));
- }
- bcopy (str.ptr, (char *) &expout->elts[expout_ptr - lenelt], len);
- ((char *) &expout->elts[expout_ptr - lenelt])[len] = 0;
- write_exp_elt_longcst ((LONGEST) len);
-}
-
-/* During parsing of a C expression, the pointer to the next character
- is in this variable. */
-
-static char *lexptr;
-
-/* Tokens that refer to names do so with explicit pointer and length,
- so they can share the storage that lexptr is parsing.
-
- When it is necessary to pass a name to a function that expects
- a null-terminated string, the substring is copied out
- into a block of storage that namecopy points to.
-
- namecopy is allocated once, guaranteed big enough, for each parsing. */
-
-static char *namecopy;
-
-/* Current depth in parentheses within the expression. */
-
-static int paren_depth;
-
-/* Nonzero means stop parsing on first comma (if not within parentheses). */
-
-static int comma_terminates;
-
-/* Take care of parsing a number (anything that starts with a digit).
- Set yylval and return the token type; update lexptr.
- LEN is the number of characters in it. */
-
-/*** Needs some error checking for the float case ***/
-
-static int
-parse_number (olen)
- int olen;
-{
- register char *p = lexptr;
- register LONGEST n = 0;
- register int c;
- register int base = 10;
- register int len = olen;
- char *err_copy;
- int unsigned_p = 0;
-
- extern double atof ();
-
- for (c = 0; c < len; c++)
- if (p[c] == '.')
- {
- /* It's a float since it contains a point. */
- yylval.dval = atof (p);
- lexptr += len;
- return FLOAT;
- }
-
- if (len >= 3 && (!strncmp (p, "0x", 2) || !strncmp (p, "0X", 2)))
- {
- p += 2;
- base = 16;
- len -= 2;
- }
- else if (*p == '0')
- base = 8;
-
- while (len-- > 0)
- {
- c = *p++;
- if (c >= 'A' && c <= 'Z') c += 'a' - 'A';
- if (c != 'l' && c != 'u')
- n *= base;
- if (c >= '0' && c <= '9')
- n += c - '0';
- else
- {
- if (base == 16 && c >= 'a' && c <= 'f')
- n += c - 'a' + 10;
- else if (len == 0 && c == 'l')
- ;
- else if (len == 0 && c == 'u')
- unsigned_p = 1;
- else if (base == 10 && len != 0 && (c == 'e' || c == 'E'))
- {
- /* Scientific notation, where we are unlucky enough not
- to have a '.' in the string. */
- yylval.dval = atof (lexptr);
- lexptr += olen;
- return FLOAT;
- }
- else
- {
- err_copy = (char *) alloca (olen + 1);
- bcopy (lexptr, err_copy, olen);
- err_copy[olen] = 0;
- error ("Invalid number \"%s\".", err_copy);
- }
- }
- }
-
- lexptr = p;
- if (unsigned_p)
- {
- yylval.ulval = n;
- return UINT;
- }
- else
- {
- yylval.lval = n;
- return INT;
- }
-}
-
-struct token
-{
- char *operator;
- int token;
- enum exp_opcode opcode;
-};
-
-static struct token tokentab3[] =
- {
- {">>=", ASSIGN_MODIFY, BINOP_RSH},
- {"<<=", ASSIGN_MODIFY, BINOP_LSH}
- };
-
-static struct token tokentab2[] =
- {
- {"+=", ASSIGN_MODIFY, BINOP_ADD},
- {"-=", ASSIGN_MODIFY, BINOP_SUB},
- {"*=", ASSIGN_MODIFY, BINOP_MUL},
- {"/=", ASSIGN_MODIFY, BINOP_DIV},
- {"%=", ASSIGN_MODIFY, BINOP_REM},
- {"|=", ASSIGN_MODIFY, BINOP_LOGIOR},
- {"&=", ASSIGN_MODIFY, BINOP_LOGAND},
- {"^=", ASSIGN_MODIFY, BINOP_LOGXOR},
- {"++", INCREMENT, BINOP_END},
- {"--", DECREMENT, BINOP_END},
- {"->", ARROW, BINOP_END},
- {"&&", AND, BINOP_END},
- {"||", OR, BINOP_END},
- {"::", COLONCOLON, BINOP_END},
- {"<<", LSH, BINOP_END},
- {">>", RSH, BINOP_END},
- {"==", EQUAL, BINOP_END},
- {"!=", NOTEQUAL, BINOP_END},
- {"<=", LEQ, BINOP_END},
- {">=", GEQ, BINOP_END}
- };
-
-/* assign machine-independent names to certain registers
- * (unless overridden by the REGISTER_NAMES table)
- */
-struct std_regs {
- char *name;
- int regnum;
-} std_regs[] = {
-#ifdef PC_REGNUM
- { "pc", PC_REGNUM },
-#endif
-#ifdef FP_REGNUM
- { "fp", FP_REGNUM },
-#endif
-#ifdef SP_REGNUM
- { "sp", SP_REGNUM },
-#endif
-#ifdef PS_REGNUM
- { "ps", PS_REGNUM },
-#endif
-};
-
-#define NUM_STD_REGS (sizeof std_regs / sizeof std_regs[0])
-
-/* Read one token, getting characters through lexptr. */
-
-static int
-yylex ()
-{
- register int c;
- register int namelen;
- register int i;
- register char *tokstart;
-
- retry:
-
- tokstart = lexptr;
- /* See if it is a special token of length 3. */
- for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
- if (!strncmp (tokstart, tokentab3[i].operator, 3))
- {
- lexptr += 3;
- yylval.opcode = tokentab3[i].opcode;
- return tokentab3[i].token;
- }
-
- /* See if it is a special token of length 2. */
- for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
- if (!strncmp (tokstart, tokentab2[i].operator, 2))
- {
- lexptr += 2;
- yylval.opcode = tokentab2[i].opcode;
- return tokentab2[i].token;
- }
-
- switch (c = *tokstart)
- {
- case 0:
- return 0;
-
- case ' ':
- case '\t':
- case '\n':
- lexptr++;
- goto retry;
-
- case '\'':
- lexptr++;
- c = *lexptr++;
- if (c == '\\')
- c = parse_escape (&lexptr);
- yylval.lval = c;
- c = *lexptr++;
- if (c != '\'')
- error ("Invalid character constant.");
- return CHAR;
-
- case '(':
- paren_depth++;
- lexptr++;
- return c;
-
- case ')':
- if (paren_depth == 0)
- return 0;
- paren_depth--;
- lexptr++;
- return c;
-
- case ',':
- if (comma_terminates && paren_depth == 0)
- return 0;
- lexptr++;
- return c;
-
- case '.':
- /* Might be a floating point number. */
- if (lexptr[1] >= '0' && lexptr[1] <= '9')
- break; /* Falls into number code. */
-
- case '+':
- case '-':
- case '*':
- case '/':
- case '%':
- case '|':
- case '&':
- case '^':
- case '~':
- case '!':
- case '@':
- case '<':
- case '>':
- case '[':
- case ']':
- case '?':
- case ':':
- case '=':
- case '{':
- case '}':
- lexptr++;
- return c;
-
- case '"':
- for (namelen = 1; (c = tokstart[namelen]) != '"'; namelen++)
- if (c == '\\')
- {
- c = tokstart[++namelen];
- if (c >= '0' && c <= '9')
- {
- c = tokstart[++namelen];
- if (c >= '0' && c <= '9')
- c = tokstart[++namelen];
- }
- }
- yylval.sval.ptr = tokstart + 1;
- yylval.sval.length = namelen - 1;
- lexptr += namelen + 1;
- return STRING;
- }
-
- /* Is it a number? */
- /* Note: We have already dealt with the case of the token '.'.
- See case '.' above. */
- if ((c >= '0' && c <= '9') || c == '.')
- {
- /* It's a number. */
- int got_dot = 0, got_e = 0;
- register char *p = tokstart;
- int hex = c == '0' && (p[1] == 'x' || p[1] == 'X');
- if (hex)
- p += 2;
- for (;; ++p)
- {
- if (!hex && !got_e && (*p == 'e' || *p == 'E'))
- got_dot = got_e = 1;
- else if (!hex && !got_dot && *p == '.')
- got_dot = 1;
- else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
- && (*p == '-' || *p == '+'))
- /* This is the sign of the exponent, not the end of the
- number. */
- continue;
- else if (!got_dot && !got_e && (*p=='l'||*p=='L')){
- ++p; break;
- }
- else if (!got_dot && !got_e && !hex && (*p=='u'||*p=='U')){
- ++p; break;
- }
- else if (*p < '0' || *p > '9'
- && (!hex || ((*p < 'a' || *p > 'f')
- && (*p < 'A' || *p > 'F'))))
- break;
- }
- return parse_number (p - tokstart);
- }
-
- if (!(c == '_' || c == '$'
- || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
- /* We must have come across a bad character (e.g. ';'). */
- error ("Invalid character '%c' in expression.", c);
-
- /* It's a name. See how long it is. */
- namelen = 0;
- for (c = tokstart[namelen];
- (c == '_' || c == '$' || (c >= '0' && c <= '9')
- || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
- c = tokstart[++namelen])
- ;
-
- /* The token "if" terminates the expression and is NOT
- removed from the input stream. */
- if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
- {
- return 0;
- }
-
- lexptr += namelen;
-
- /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
- and $$digits (equivalent to $<-digits> if you could type that).
- Make token type LAST, and put the number (the digits) in yylval. */
-
- if (*tokstart == '$')
- {
- register int negate = 0;
- c = 1;
- /* Double dollar means negate the number and add -1 as well.
- Thus $$ alone means -1. */
- if (namelen >= 2 && tokstart[1] == '$')
- {
- negate = 1;
- c = 2;
- }
- if (c == namelen)
- {
- /* Just dollars (one or two) */
- yylval.lval = - negate;
- return LAST;
- }
- /* Is the rest of the token digits? */
- for (; c < namelen; c++)
- if (!(tokstart[c] >= '0' && tokstart[c] <= '9'))
- break;
- if (c == namelen)
- {
- yylval.lval = atoi (tokstart + 1 + negate);
- if (negate)
- yylval.lval = - yylval.lval;
- return LAST;
- }
- }
-
- /* Handle tokens that refer to machine registers:
- $ followed by a register name. */
-
- if (*tokstart == '$') {
- for (c = 0; c < NUM_REGS; c++)
- if (namelen - 1 == strlen (reg_names[c])
- && !strncmp (tokstart + 1, reg_names[c], namelen - 1))
- {
- yylval.lval = c;
- return REGNAME;
- }
- for (c = 0; c < NUM_STD_REGS; c++)
- if (namelen - 1 == strlen (std_regs[c].name)
- && !strncmp (tokstart + 1, std_regs[c].name, namelen - 1))
- {
- yylval.lval = std_regs[c].regnum;
- return REGNAME;
- }
- }
- /* Catch specific keywords. Should be done with a data structure. */
- switch (namelen)
- {
- case 8:
- if (!strncmp (tokstart, "unsigned", 8))
- return UNSIGNED;
- break;
- case 6:
- if (!strncmp (tokstart, "struct", 6))
- return STRUCT;
- if (!strncmp (tokstart, "signed", 6))
- return SIGNED;
- if (!strncmp (tokstart, "sizeof", 6))
- return SIZEOF;
- break;
- case 5:
- if (!strncmp (tokstart, "union", 5))
- return UNION;
- if (!strncmp (tokstart, "short", 5))
- return SHORT;
- break;
- case 4:
- if (!strncmp (tokstart, "enum", 4))
- return ENUM;
- if (!strncmp (tokstart, "long", 4))
- return LONG;
- if (!strncmp (tokstart, "this", 4)
- && lookup_symbol ("$this", expression_context_block,
- VAR_NAMESPACE, 0))
- return THIS;
- break;
- case 3:
- if (!strncmp (tokstart, "int", 3))
- return INT_KEYWORD;
- break;
- default:
- break;
- }
-
- yylval.sval.ptr = tokstart;
- yylval.sval.length = namelen;
-
- /* Any other names starting in $ are debugger internal variables. */
-
- if (*tokstart == '$')
- {
- yylval.ivar = (struct internalvar *) lookup_internalvar (copy_name (yylval.sval) + 1);
- return VARIABLE;
- }
-
- /* Use token-type BLOCKNAME for symbols that happen to be defined as
- functions or symtabs. If this is not so, then ...
- Use token-type TYPENAME for symbols that happen to be defined
- currently as names of types; NAME for other symbols.
- The caller is not constrained to care about the distinction. */
- {
- char *tmp = copy_name (yylval.sval);
- struct symbol *sym;
-
- if (lookup_partial_symtab (tmp))
- return BLOCKNAME;
- sym = lookup_symbol (tmp, expression_context_block,
- VAR_NAMESPACE, 0);
- if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
- return BLOCKNAME;
- if (lookup_typename (copy_name (yylval.sval), expression_context_block, 1))
- return TYPENAME;
- return NAME;
- }
-}
-
-static void
-yyerror ()
-{
- error ("Invalid syntax in expression.");
-}
-
-/* Return a null-terminated temporary copy of the name
- of a string token. */
-
-static char *
-copy_name (token)
- struct stoken token;
-{
- bcopy (token.ptr, namecopy, token.length);
- namecopy[token.length] = 0;
- return namecopy;
-}
-
-/* Reverse an expression from suffix form (in which it is constructed)
- to prefix form (in which we can conveniently print or execute it). */
-
-static void prefixify_subexp ();
-
-static void
-prefixify_expression (expr)
- register struct expression *expr;
-{
- register int len = sizeof (struct expression) +
- expr->nelts * sizeof (union exp_element);
- register struct expression *temp;
- register int inpos = expr->nelts, outpos = 0;
-
- temp = (struct expression *) alloca (len);
-
- /* Copy the original expression into temp. */
- bcopy (expr, temp, len);
-
- prefixify_subexp (temp, expr, inpos, outpos);
-}
-
-/* Return the number of exp_elements in the subexpression of EXPR
- whose last exp_element is at index ENDPOS - 1 in EXPR. */
-
-static int
-length_of_subexp (expr, endpos)
- register struct expression *expr;
- register int endpos;
-{
- register int oplen = 1;
- register int args = 0;
- register int i;
-
- if (endpos < 0)
- error ("?error in length_of_subexp");
-
- i = (int) expr->elts[endpos - 1].opcode;
-
- switch (i)
- {
- /* C++ */
- case OP_SCOPE:
- oplen = 4 + ((expr->elts[endpos - 2].longconst
- + sizeof (union exp_element))
- / sizeof (union exp_element));
- break;
-
- case OP_LONG:
- case OP_DOUBLE:
- oplen = 4;
- break;
-
- case OP_VAR_VALUE:
- case OP_LAST:
- case OP_REGISTER:
- case OP_INTERNALVAR:
- oplen = 3;
- break;
-
- case OP_FUNCALL:
- oplen = 3;
- args = 1 + expr->elts[endpos - 2].longconst;
- break;
-
- case UNOP_CAST:
- case UNOP_MEMVAL:
- oplen = 3;
- args = 1;
- break;
-
- case STRUCTOP_STRUCT:
- case STRUCTOP_PTR:
- args = 1;
- case OP_STRING:
- oplen = 3 + ((expr->elts[endpos - 2].longconst
- + sizeof (union exp_element))
- / sizeof (union exp_element));
- break;
-
- case TERNOP_COND:
- args = 3;
- break;
-
- case BINOP_ASSIGN_MODIFY:
- oplen = 3;
- args = 2;
- break;
-
- /* C++ */
- case OP_THIS:
- oplen = 2;
- break;
-
- default:
- args = 1 + (i < (int) BINOP_END);
- }
-
- while (args > 0)
- {
- oplen += length_of_subexp (expr, endpos - oplen);
- args--;
- }
-
- return oplen;
-}
-
-/* Copy the subexpression ending just before index INEND in INEXPR
- into OUTEXPR, starting at index OUTBEG.
- In the process, convert it from suffix to prefix form. */
-
-static void
-prefixify_subexp (inexpr, outexpr, inend, outbeg)
- register struct expression *inexpr;
- struct expression *outexpr;
- register int inend;
- int outbeg;
-{
- register int oplen = 1;
- register int args = 0;
- register int i;
- int *arglens;
- enum exp_opcode opcode;
-
- /* Compute how long the last operation is (in OPLEN),
- and also how many preceding subexpressions serve as
- arguments for it (in ARGS). */
-
- opcode = inexpr->elts[inend - 1].opcode;
- switch (opcode)
- {
- /* C++ */
- case OP_SCOPE:
- oplen = 4 + ((inexpr->elts[inend - 2].longconst
- + sizeof (union exp_element))
- / sizeof (union exp_element));
- break;
-
- case OP_LONG:
- case OP_DOUBLE:
- oplen = 4;
- break;
-
- case OP_VAR_VALUE:
- case OP_LAST:
- case OP_REGISTER:
- case OP_INTERNALVAR:
- oplen = 3;
- break;
-
- case OP_FUNCALL:
- oplen = 3;
- args = 1 + inexpr->elts[inend - 2].longconst;
- break;
-
- case UNOP_CAST:
- case UNOP_MEMVAL:
- oplen = 3;
- args = 1;
- break;
-
- case STRUCTOP_STRUCT:
- case STRUCTOP_PTR:
- args = 1;
- case OP_STRING:
- oplen = 3 + ((inexpr->elts[inend - 2].longconst
- + sizeof (union exp_element))
- / sizeof (union exp_element));
-
- break;
-
- case TERNOP_COND:
- args = 3;
- break;
-
- case BINOP_ASSIGN_MODIFY:
- oplen = 3;
- args = 2;
- break;
-
- /* C++ */
- case OP_THIS:
- oplen = 2;
- break;
-
- default:
- args = 1 + ((int) opcode < (int) BINOP_END);
- }
-
- /* Copy the final operator itself, from the end of the input
- to the beginning of the output. */
- inend -= oplen;
- bcopy (&inexpr->elts[inend], &outexpr->elts[outbeg],
- oplen * sizeof (union exp_element));
- outbeg += oplen;
-
- /* Find the lengths of the arg subexpressions. */
- arglens = (int *) alloca (args * sizeof (int));
- for (i = args - 1; i >= 0; i--)
- {
- oplen = length_of_subexp (inexpr, inend);
- arglens[i] = oplen;
- inend -= oplen;
- }
-
- /* Now copy each subexpression, preserving the order of
- the subexpressions, but prefixifying each one.
- In this loop, inend starts at the beginning of
- the expression this level is working on
- and marches forward over the arguments.
- outbeg does similarly in the output. */
- for (i = 0; i < args; i++)
- {
- oplen = arglens[i];
- inend += oplen;
- prefixify_subexp (inexpr, outexpr, inend, outbeg);
- outbeg += oplen;
- }
-}
-
-/* This page contains the two entry points to this file. */
-
-/* Read a C expression from the string *STRINGPTR points to,
- parse it, and return a pointer to a struct expression that we malloc.
- Use block BLOCK as the lexical context for variable names;
- if BLOCK is zero, use the block of the selected stack frame.
- Meanwhile, advance *STRINGPTR to point after the expression,
- at the first nonwhite character that is not part of the expression
- (possibly a null character).
-
- If COMMA is nonzero, stop if a comma is reached. */
-
-struct expression *
-parse_c_1 (stringptr, block, comma)
- char **stringptr;
- struct block *block;
-{
- struct cleanup *old_chain;
-
- lexptr = *stringptr;
-
- paren_depth = 0;
- type_stack_depth = 0;
-
- comma_terminates = comma;
-
- if (lexptr == 0 || *lexptr == 0)
- error_no_arg ("expression to compute");
-
- old_chain = make_cleanup (free_funcalls, 0);
- funcall_chain = 0;
-
- expression_context_block = block ? block : get_selected_block ();
-
- namecopy = (char *) alloca (strlen (lexptr) + 1);
- expout_size = 10;
- expout_ptr = 0;
- expout = (struct expression *)
- xmalloc (sizeof (struct expression)
- + expout_size * sizeof (union exp_element));
- make_cleanup (free_current_contents, &expout);
- if (yyparse ())
- yyerror ();
- discard_cleanups (old_chain);
- expout->nelts = expout_ptr;
- expout = (struct expression *)
- xrealloc (expout,
- sizeof (struct expression)
- + expout_ptr * sizeof (union exp_element));
- prefixify_expression (expout);
- *stringptr = lexptr;
- return expout;
-}
-
-/* Parse STRING as an expression, and complain if this fails
- to use up all of the contents of STRING. */
-
-struct expression *
-parse_c_expression (string)
- char *string;
-{
- register struct expression *exp;
- exp = parse_c_1 (&string, 0, 0);
- if (*string)
- error ("Junk after end of expression.");
- return exp;
-}
-
-static void
-push_type (tp)
- enum type_pieces tp;
-{
- if (type_stack_depth == type_stack_size)
- {
- type_stack_size *= 2;
- type_stack = (enum type_pieces *)
- xrealloc (type_stack, type_stack_size * sizeof (enum type_pieces));
- }
- type_stack[type_stack_depth++] = tp;
-}
-
-static enum type_pieces
-pop_type ()
-{
- if (type_stack_depth)
- return type_stack[--type_stack_depth];
- return tp_end;
-}
-
-void
-_initialize_expread ()
-{
- type_stack_size = 80;
- type_stack_depth = 0;
- type_stack = (enum type_pieces *)
- xmalloc (type_stack_size * sizeof (enum type_pieces));
-}
diff --git a/gnu/usr.bin/gdb/expression.h b/gnu/usr.bin/gdb/expression.h
deleted file mode 100644
index 5a5e20e..0000000
--- a/gnu/usr.bin/gdb/expression.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/* Definitions for expressions stored in reversed prefix form, for GDB.
- Copyright (C) 1986, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Definitions for saved C expressions. */
-
-/* An expression is represented as a vector of union exp_element's.
- Each exp_element is an opcode, except that some opcodes cause
- the following exp_element to be treated as a long or double constant
- or as a variable. The opcodes are obeyed, using a stack for temporaries.
- The value is left on the temporary stack at the end. */
-
-/* When it is necessary to include a string,
- it can occupy as many exp_elements as it needs.
- We find the length of the string using strlen,
- divide to find out how many exp_elements are used up,
- and skip that many. Strings, like numbers, are indicated
- by the preceding opcode. */
-
-enum exp_opcode
-{
-/* BINOP_... operate on two values computed by following subexpressions,
- replacing them by one result value. They take no immediate arguments. */
- BINOP_ADD, /* + */
- BINOP_SUB, /* - */
- BINOP_MUL, /* * */
- BINOP_DIV, /* / */
- BINOP_REM, /* % */
- BINOP_LSH, /* << */
- BINOP_RSH, /* >> */
- BINOP_AND, /* && */
- BINOP_OR, /* || */
- BINOP_LOGAND, /* & */
- BINOP_LOGIOR, /* | */
- BINOP_LOGXOR, /* ^ */
- BINOP_EQUAL, /* == */
- BINOP_NOTEQUAL, /* != */
- BINOP_LESS, /* < */
- BINOP_GTR, /* > */
- BINOP_LEQ, /* <= */
- BINOP_GEQ, /* >= */
- BINOP_REPEAT, /* @ */
- BINOP_ASSIGN, /* = */
- BINOP_COMMA, /* , */
- BINOP_SUBSCRIPT, /* x[y] */
- BINOP_EXP, /* Exponentiation */
-
-/* C++. */
- BINOP_MIN, /* <? */
- BINOP_MAX, /* >? */
- BINOP_SCOPE, /* :: */
-
- /* STRUCTOP_MEMBER is used for pointer-to-member constructs.
- X . * Y translates into X STRUCTOP_MEMBER Y. */
- STRUCTOP_MEMBER,
- /* STRUCTOP_MPTR is used for pointer-to-member constructs
- when X is a pointer instead of an aggregate. */
- STRUCTOP_MPTR,
-/* end of C++. */
-
- BINOP_END,
-
- BINOP_ASSIGN_MODIFY, /* +=, -=, *=, and so on.
- The following exp_element is another opcode,
- a BINOP_, saying how to modify.
- Then comes another BINOP_ASSIGN_MODIFY,
- making three exp_elements in total. */
-
-/* Operates on three values computed by following subexpressions. */
- TERNOP_COND, /* ?: */
-
-/* The OP_... series take immediate following arguments.
- After the arguments come another OP_... (the same one)
- so that the grouping can be recognized from the end. */
-
-/* OP_LONG is followed by a type pointer in the next exp_element
- and the long constant value in the following exp_element.
- Then comes another OP_LONG.
- Thus, the operation occupies four exp_elements. */
-
- OP_LONG,
-/* OP_DOUBLE is similar but takes a double constant instead of a long one. */
- OP_DOUBLE,
-/* OP_VAR_VALUE takes one struct symbol * in the following exp_element,
- followed by another OP_VAR_VALUE, making three exp_elements. */
- OP_VAR_VALUE,
-/* OP_LAST is followed by an integer in the next exp_element.
- The integer is zero for the last value printed,
- or it is the absolute number of a history element.
- With another OP_LAST at the end, this makes three exp_elements. */
- OP_LAST,
-/* OP_REGISTER is followed by an integer in the next exp_element.
- This is the number of a register to fetch (as an int).
- With another OP_REGISTER at the end, this makes three exp_elements. */
- OP_REGISTER,
-/* OP_INTERNALVAR is followed by an internalvar ptr in the next exp_element.
- With another OP_INTERNALVAR at the end, this makes three exp_elements. */
- OP_INTERNALVAR,
-/* OP_FUNCALL is followed by an integer in the next exp_element.
- The integer is the number of args to the function call.
- That many plus one values from following subexpressions
- are used, the first one being the function.
- The integer is followed by a repeat of OP_FUNCALL,
- making three exp_elements. */
- OP_FUNCALL,
-/* OP_STRING represents a string constant.
- Its format is the same as that of a STRUCTOP, but the string
- data is just made into a string constant when the operation
- is executed. */
- OP_STRING,
-
-/* UNOP_CAST is followed by a type pointer in the next exp_element.
- With another UNOP_CAST at the end, this makes three exp_elements.
- It casts the value of the following subexpression. */
- UNOP_CAST,
-/* UNOP_MEMVAL is followed by a type pointer in the next exp_element
- With another UNOP_MEMVAL at the end, this makes three exp_elements.
- It casts the contents of the word addressed by the value of the
- following subexpression. */
- UNOP_MEMVAL,
-/* UNOP_... operate on one value from a following subexpression
- and replace it with a result. They take no immediate arguments. */
- UNOP_NEG, /* Unary - */
- UNOP_ZEROP, /* Unary ! */
- UNOP_LOGNOT, /* Unary ~ */
- UNOP_IND, /* Unary * */
- UNOP_ADDR, /* Unary & */
- UNOP_PREINCREMENT, /* ++ before an expression */
- UNOP_POSTINCREMENT, /* ++ after an expression */
- UNOP_PREDECREMENT, /* -- before an expression */
- UNOP_POSTDECREMENT, /* -- after an expression */
- UNOP_SIZEOF, /* Unary sizeof (followed by expression) */
-
-/* STRUCTOP_... operate on a value from a following subexpression
- by extracting a structure component specified by a string
- that appears in the following exp_elements (as many as needed).
- STRUCTOP_STRUCT is used for "." and STRUCTOP_PTR for "->".
- They differ only in the error message given in case the value is
- not suitable or the structure component specified is not found.
-
- The length of the string follows in the next exp_element,
- (after the string), followed by another STRUCTOP_... code. */
- STRUCTOP_STRUCT,
- STRUCTOP_PTR,
-
-/* C++ */
- /* OP_THIS is just a placeholder for the class instance variable.
- It just comes in a tight (OP_THIS, OP_THIS) pair. */
- OP_THIS,
-
- /* OP_SCOPE surrounds a type name and a field name. The type
- name is encoded as one element, but the field name stays as
- a string, which, of course, is variable length. */
- OP_SCOPE,
-
-};
-
-union exp_element
-{
- enum exp_opcode opcode;
- struct symbol *symbol;
- LONGEST longconst;
- double doubleconst;
- char string;
- struct type *type;
- struct internalvar *internalvar;
-};
-
-struct expression
-{
- int nelts;
- union exp_element elts[1];
-};
-
-struct expression *parse_c_expression ();
-struct expression *parse_c_1 ();
diff --git a/gnu/usr.bin/gdb/findvar.c b/gnu/usr.bin/gdb/findvar.c
deleted file mode 100644
index 0157d10..0000000
--- a/gnu/usr.bin/gdb/findvar.c
+++ /dev/null
@@ -1,579 +0,0 @@
-/* Find a variable's value in memory, for GDB, the GNU debugger.
- Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "defs.h"
-#include "param.h"
-#include "symtab.h"
-#include "frame.h"
-#include "value.h"
-
-CORE_ADDR read_register ();
-
-/* Return the address in which frame FRAME's value of register REGNUM
- has been saved in memory. Or return zero if it has not been saved.
- If REGNUM specifies the SP, the value we return is actually
- the SP value, not an address where it was saved. */
-
-CORE_ADDR
-find_saved_register (frame, regnum)
- FRAME frame;
- int regnum;
-{
- struct frame_info *fi;
- struct frame_saved_regs saved_regs;
-
- register FRAME frame1 = 0;
- register CORE_ADDR addr = 0;
-
-#ifdef HAVE_REGISTER_WINDOWS
- /* We assume that a register in a register window will only be saved
- in one place (since the name changes and disappears as you go
- towards inner frames), so we only call get_frame_saved_regs on
- the current frame. This is directly in contradiction to the
- usage below, which assumes that registers used in a frame must be
- saved in a lower (more interior) frame. This change is a result
- of working on a register window machine; get_frame_saved_regs
- always returns the registers saved within a frame, within the
- context (register namespace) of that frame. */
-
- /* However, note that we don't want this to return anything if
- nothing is saved (if there's a frame inside of this one). Also,
- callers to this routine asking for the stack pointer want the
- stack pointer saved for *this* frame; this is returned from the
- next frame. */
-
-
- if (REGISTER_IN_WINDOW_P(regnum))
- {
- frame1 = get_next_frame (frame);
- if (!frame1) return 0; /* Registers of this frame are
- active. */
-
- /* Get the SP from the next frame in; it will be this
- current frame. */
- if (regnum != SP_REGNUM)
- frame1 = frame;
-
- fi = get_frame_info (frame1);
- get_frame_saved_regs (fi, &saved_regs);
- return (saved_regs.regs[regnum] ?
- saved_regs.regs[regnum] : 0);
- }
-#endif /* HAVE_REGISTER_WINDOWS */
-
- /* Note that this next routine assumes that registers used in
- frame x will be saved only in the frame that x calls and
- frames interior to it. This is not true on the sparc, but the
- above macro takes care of it, so we should be all right. */
- while (1)
- {
- QUIT;
- frame1 = get_prev_frame (frame1);
- if (frame1 == 0 || frame1 == frame)
- break;
- fi = get_frame_info (frame1);
- get_frame_saved_regs (fi, &saved_regs);
- if (saved_regs.regs[regnum])
- addr = saved_regs.regs[regnum];
- }
-
- return addr;
-}
-
-/* Copy the bytes of register REGNUM, relative to the current stack frame,
- into our memory at MYADDR.
- The number of bytes copied is REGISTER_RAW_SIZE (REGNUM). */
-
-void
-read_relative_register_raw_bytes (regnum, myaddr)
- int regnum;
- char *myaddr;
-{
- register CORE_ADDR addr;
-
- if (regnum == FP_REGNUM)
- {
- bcopy (&FRAME_FP(selected_frame), myaddr, sizeof (CORE_ADDR));
- return;
- }
-
- addr = find_saved_register (selected_frame, regnum);
-
- if (addr)
- {
- if (regnum == SP_REGNUM)
- {
- CORE_ADDR buffer = addr;
- bcopy (&buffer, myaddr, sizeof (CORE_ADDR));
- }
- else
- read_memory (addr, myaddr, REGISTER_RAW_SIZE (regnum));
- return;
- }
- read_register_bytes (REGISTER_BYTE (regnum),
- myaddr, REGISTER_RAW_SIZE (regnum));
-}
-
-/* Return a `value' with the contents of register REGNUM
- in its virtual format, with the type specified by
- REGISTER_VIRTUAL_TYPE. */
-
-value
-value_of_register (regnum)
- int regnum;
-{
- register CORE_ADDR addr;
- register value val;
- char raw_buffer[MAX_REGISTER_RAW_SIZE];
- char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
-
- if (! (have_inferior_p () || have_core_file_p ()))
- error ("Can't get value of register without inferior or core file");
-
- addr = find_saved_register (selected_frame, regnum);
- if (addr)
- {
- if (regnum == SP_REGNUM)
- return value_from_long (builtin_type_int, (LONGEST) addr);
- read_memory (addr, raw_buffer, REGISTER_RAW_SIZE (regnum));
- }
- else
- read_register_bytes (REGISTER_BYTE (regnum), raw_buffer,
- REGISTER_RAW_SIZE (regnum));
-
- REGISTER_CONVERT_TO_VIRTUAL (regnum, raw_buffer, virtual_buffer);
- val = allocate_value (REGISTER_VIRTUAL_TYPE (regnum));
- bcopy (virtual_buffer, VALUE_CONTENTS (val), REGISTER_VIRTUAL_SIZE (regnum));
- VALUE_LVAL (val) = addr ? lval_memory : lval_register;
- VALUE_ADDRESS (val) = addr ? addr : REGISTER_BYTE (regnum);
- VALUE_REGNO (val) = regnum;
- return val;
-}
-
-/* Low level examining and depositing of registers.
-
- Note that you must call `fetch_registers' once
- before examining or depositing any registers. */
-
-char registers[REGISTER_BYTES];
-
-/* Copy LEN bytes of consecutive data from registers
- starting with the REGBYTE'th byte of register data
- into memory at MYADDR. */
-
-void
-read_register_bytes (regbyte, myaddr, len)
- int regbyte;
- char *myaddr;
- int len;
-{
- bcopy (&registers[regbyte], myaddr, len);
-}
-
-/* Copy LEN bytes of consecutive data from memory at MYADDR
- into registers starting with the REGBYTE'th byte of register data. */
-
-void
-write_register_bytes (regbyte, myaddr, len)
- int regbyte;
- char *myaddr;
- int len;
-{
- bcopy (myaddr, &registers[regbyte], len);
- if (have_inferior_p ())
- store_inferior_registers (-1);
-}
-
-/* Return the contents of register REGNO,
- regarding it as an integer. */
-
-CORE_ADDR
-read_register (regno)
- int regno;
-{
- /* This loses when REGISTER_RAW_SIZE (regno) != sizeof (int) */
- return *(int *) &registers[REGISTER_BYTE (regno)];
-}
-
-/* Store VALUE in the register number REGNO, regarded as an integer. */
-
-void
-write_register (regno, val)
- int regno, val;
-{
- /* This loses when REGISTER_RAW_SIZE (regno) != sizeof (int) */
-#if defined(sun4)
- /* This is a no-op on a Sun 4. */
- if (regno == 0)
- return;
-#endif
-
- *(int *) &registers[REGISTER_BYTE (regno)] = val;
-
- if (have_inferior_p ())
- store_inferior_registers (regno);
-}
-
-/* Record that register REGNO contains VAL.
- This is used when the value is obtained from the inferior or core dump,
- so there is no need to store the value there. */
-
-void
-supply_register (regno, val)
- int regno;
- char *val;
-{
- bcopy (val, &registers[REGISTER_BYTE (regno)], REGISTER_RAW_SIZE (regno));
-}
-
-/* Given a struct symbol for a variable,
- and a stack frame id, read the value of the variable
- and return a (pointer to a) struct value containing the value. */
-
-value
-read_var_value (var, frame)
- register struct symbol *var;
- FRAME frame;
-{
- register value v;
-
- struct frame_info *fi;
-
- struct type *type = SYMBOL_TYPE (var);
- register CORE_ADDR addr = 0;
- int val = SYMBOL_VALUE (var);
- register int len;
-
- v = allocate_value (type);
- VALUE_LVAL (v) = lval_memory; /* The most likely possibility. */
- len = TYPE_LENGTH (type);
-
- if (frame == 0) frame = selected_frame;
-
- switch (SYMBOL_CLASS (var))
- {
- case LOC_CONST:
- case LOC_LABEL:
- bcopy (&val, VALUE_CONTENTS (v), len);
- VALUE_LVAL (v) = not_lval;
- return v;
-
- case LOC_CONST_BYTES:
- bcopy (val, VALUE_CONTENTS (v), len);
- VALUE_LVAL (v) = not_lval;
- return v;
-
- case LOC_STATIC:
- addr = val;
- break;
-
-/* Nonzero if a struct which is located in a register or a LOC_ARG
- really contains
- the address of the struct, not the struct itself. GCC_P is nonzero
- if the function was compiled with GCC. */
-#if !defined (REG_STRUCT_HAS_ADDR)
-#define REG_STRUCT_HAS_ADDR(gcc_p) 0
-#endif
-
- case LOC_ARG:
- fi = get_frame_info (frame);
- addr = val + FRAME_ARGS_ADDRESS (fi);
- break;
-
- case LOC_REF_ARG:
- fi = get_frame_info (frame);
- addr = val + FRAME_ARGS_ADDRESS (fi);
- addr = read_memory_integer (addr, sizeof (CORE_ADDR));
- break;
-
- case LOC_LOCAL:
- fi = get_frame_info (frame);
- addr = val + FRAME_LOCALS_ADDRESS (fi);
- break;
-
- case LOC_TYPEDEF:
- error ("Cannot look up value of a typedef");
-
- case LOC_BLOCK:
- VALUE_ADDRESS (v) = BLOCK_START (SYMBOL_BLOCK_VALUE (var));
- return v;
-
- case LOC_REGISTER:
- case LOC_REGPARM:
- {
- struct block *b = get_frame_block (frame);
-
- v = value_from_register (type, val, frame);
-
- if (REG_STRUCT_HAS_ADDR(b->gcc_compile_flag)
- && TYPE_CODE (type) == TYPE_CODE_STRUCT)
- addr = *(CORE_ADDR *)VALUE_CONTENTS (v);
- else
- return v;
- }
- }
-
- read_memory (addr, VALUE_CONTENTS (v), len);
- VALUE_ADDRESS (v) = addr;
- return v;
-}
-
-/* Return a value of type TYPE, stored in register REGNUM, in frame
- FRAME. */
-
-value
-value_from_register (type, regnum, frame)
- struct type *type;
- int regnum;
- FRAME frame;
-{
- char raw_buffer [MAX_REGISTER_RAW_SIZE];
- char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
- CORE_ADDR addr;
- value v = allocate_value (type);
- int len = TYPE_LENGTH (type);
- char *value_bytes = 0;
- int value_bytes_copied = 0;
- int num_storage_locs;
-
- VALUE_REGNO (v) = regnum;
-
- num_storage_locs = (len > REGISTER_VIRTUAL_SIZE (regnum) ?
- ((len - 1) / REGISTER_RAW_SIZE (regnum)) + 1 :
- 1);
-
- if (num_storage_locs > 1)
- {
- /* Value spread across multiple storage locations. */
-
- int local_regnum;
- int mem_stor = 0, reg_stor = 0;
- int mem_tracking = 1;
- CORE_ADDR last_addr = 0;
-
- value_bytes = (char *) alloca (len + MAX_REGISTER_RAW_SIZE);
-
- /* Copy all of the data out, whereever it may be. */
-
- for (local_regnum = regnum;
- value_bytes_copied < len;
- (value_bytes_copied += REGISTER_RAW_SIZE (local_regnum),
- ++local_regnum))
- {
- int register_index = local_regnum - regnum;
- addr = find_saved_register (frame, local_regnum);
- if (addr == 0)
- {
- read_register_bytes (REGISTER_BYTE (local_regnum),
- value_bytes + value_bytes_copied,
- REGISTER_RAW_SIZE (local_regnum));
- reg_stor++;
- }
- else
- {
- read_memory (addr, value_bytes + value_bytes_copied,
- REGISTER_RAW_SIZE (local_regnum));
- mem_stor++;
- mem_tracking =
- (mem_tracking
- && (regnum == local_regnum
- || addr == last_addr));
- }
- last_addr = addr;
- }
-
- if ((reg_stor && mem_stor)
- || (mem_stor && !mem_tracking))
- /* Mixed storage; all of the hassle we just went through was
- for some good purpose. */
- {
- VALUE_LVAL (v) = lval_reg_frame_relative;
- VALUE_FRAME (v) = FRAME_FP (frame);
- VALUE_FRAME_REGNUM (v) = regnum;
- }
- else if (mem_stor)
- {
- VALUE_LVAL (v) = lval_memory;
- VALUE_ADDRESS (v) = find_saved_register (frame, regnum);
- }
- else if (reg_stor)
- {
- VALUE_LVAL (v) = lval_register;
- VALUE_ADDRESS (v) = REGISTER_BYTE (regnum);
- }
- else
- fatal ("value_from_register: Value not stored anywhere!");
-
- /* Any structure stored in more than one register will always be
- an inegral number of registers. Otherwise, you'd need to do
- some fiddling with the last register copied here for little
- endian machines. */
-
- /* Copy into the contents section of the value. */
- bcopy (value_bytes, VALUE_CONTENTS (v), len);
-
- return v;
- }
-
- /* Data is completely contained within a single register. Locate the
- register's contents in a real register or in core;
- read the data in raw format. */
-
- addr = find_saved_register (frame, regnum);
- if (addr == 0)
- {
- /* Value is really in a register. */
-
- VALUE_LVAL (v) = lval_register;
- VALUE_ADDRESS (v) = REGISTER_BYTE (regnum);
-
- read_register_bytes (REGISTER_BYTE (regnum),
- raw_buffer, REGISTER_RAW_SIZE (regnum));
- }
- else
- {
- /* Value was in a register that has been saved in memory. */
-
- read_memory (addr, raw_buffer, REGISTER_RAW_SIZE (regnum));
- VALUE_LVAL (v) = lval_memory;
- VALUE_ADDRESS (v) = addr;
- }
-
- /* Convert the raw contents to virtual contents.
- (Just copy them if the formats are the same.) */
-
- REGISTER_CONVERT_TO_VIRTUAL (regnum, raw_buffer, virtual_buffer);
-
- if (REGISTER_CONVERTIBLE (regnum))
- {
- /* When the raw and virtual formats differ, the virtual format
- corresponds to a specific data type. If we want that type,
- copy the data into the value.
- Otherwise, do a type-conversion. */
-
- if (type != REGISTER_VIRTUAL_TYPE (regnum))
- {
- /* eg a variable of type `float' in a 68881 register
- with raw type `extended' and virtual type `double'.
- Fetch it as a `double' and then convert to `float'. */
- v = allocate_value (REGISTER_VIRTUAL_TYPE (regnum));
- bcopy (virtual_buffer, VALUE_CONTENTS (v), len);
- v = value_cast (type, v);
- }
- else
- bcopy (virtual_buffer, VALUE_CONTENTS (v), len);
- }
- else
- {
- /* Raw and virtual formats are the same for this register. */
-
-#ifdef BYTES_BIG_ENDIAN
- if (len < REGISTER_RAW_SIZE (regnum))
- {
- /* Big-endian, and we want less than full size. */
- VALUE_OFFSET (v) = REGISTER_RAW_SIZE (regnum) - len;
- }
-#endif
-
- bcopy (virtual_buffer + VALUE_OFFSET (v),
- VALUE_CONTENTS (v), len);
- }
-
- return v;
-}
-
-/* Given a struct symbol for a variable,
- and a stack frame id,
- return a (pointer to a) struct value containing the variable's address. */
-
-value
-locate_var_value (var, frame)
- register struct symbol *var;
- FRAME frame;
-{
- register CORE_ADDR addr = 0;
- int val = SYMBOL_VALUE (var);
- struct frame_info *fi;
- struct type *type = SYMBOL_TYPE (var);
- struct type *result_type;
-
- if (frame == 0) frame = selected_frame;
-
- switch (SYMBOL_CLASS (var))
- {
- case LOC_CONST:
- case LOC_CONST_BYTES:
- error ("Address requested for identifier \"%s\" which is a constant.",
- SYMBOL_NAME (var));
-
- case LOC_REGISTER:
- case LOC_REGPARM:
- addr = find_saved_register (frame, val);
- if (addr != 0)
- {
- int len = TYPE_LENGTH (type);
-#ifdef BYTES_BIG_ENDIAN
- if (len < REGISTER_RAW_SIZE (val))
- /* Big-endian, and we want less than full size. */
- addr += REGISTER_RAW_SIZE (val) - len;
-#endif
- break;
- }
- error ("Address requested for identifier \"%s\" which is in a register.",
- SYMBOL_NAME (var));
-
- case LOC_STATIC:
- case LOC_LABEL:
- addr = val;
- break;
-
- case LOC_ARG:
- fi = get_frame_info (frame);
- addr = val + FRAME_ARGS_ADDRESS (fi);
- break;
-
- case LOC_REF_ARG:
- fi = get_frame_info (frame);
- addr = val + FRAME_ARGS_ADDRESS (fi);
- addr = read_memory_integer (addr, sizeof (CORE_ADDR));
- break;
-
- case LOC_LOCAL:
- fi = get_frame_info (frame);
- addr = val + FRAME_LOCALS_ADDRESS (fi);
- break;
-
- case LOC_TYPEDEF:
- error ("Address requested for identifier \"%s\" which is a typedef.",
- SYMBOL_NAME (var));
-
- case LOC_BLOCK:
- addr = BLOCK_START (SYMBOL_BLOCK_VALUE (var));
- break;
- }
-
- /* Address of an array is of the type of address of it's elements. */
- result_type =
- lookup_pointer_type (TYPE_CODE (type) == TYPE_CODE_ARRAY ?
- TYPE_TARGET_TYPE (type) : type);
-
- return value_cast (result_type,
- value_from_long (builtin_type_long, (LONGEST) addr));
-}
-
diff --git a/gnu/usr.bin/gdb/frame.h b/gnu/usr.bin/gdb/frame.h
deleted file mode 100644
index 322ddba..0000000
--- a/gnu/usr.bin/gdb/frame.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* Definitions for dealing with stack frames, for GDB, the GNU debugger.
- Copyright (C) 1986, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Note that frame.h requires param.h! */
-
-/*
- * FRAME is the type of the identifier of a specific stack frame. It
- * is a pointer to the frame cache item corresponding to this frame.
- * Please note that frame id's are *not* constant over calls to the
- * inferior. Use frame addresses, which are.
- *
- * FRAME_ADDR is the type of the address of a specific frame. I
- * cannot imagine a case in which this would not be CORE_ADDR, so
- * maybe it's silly to give it it's own type. Life's rough.
- *
- * FRAME_FP is a macro which converts from a frame identifier into a
- * frame_address.
- *
- * FRAME_INFO_ID is a macro which "converts" from a frame info pointer
- * to a frame id. This is here in case I or someone else decides to
- * change the FRAME type again.
- *
- * This file and blockframe.c are the only places which are allowed to
- * use the equivalence between FRAME and struct frame_info *. EXCEPTION:
- * value.h uses CORE_ADDR instead of FRAME_ADDR because the compiler
- * will accept that in the absense of this file.
- */
-typedef struct frame_info *FRAME;
-typedef CORE_ADDR FRAME_ADDR;
-#define FRAME_FP(fr) ((fr)->frame)
-#define FRAME_INFO_ID(f) (f)
-
-/*
- * Caching structure for stack frames. This is also the structure
- * used for extended info about stack frames. May add more to this
- * structure as it becomes necessary.
- *
- * Note that the first entry in the cache will always refer to the
- * innermost executing frame. This value should be set (is it?
- * Check) in something like normal_stop.
- */
-struct frame_info
- {
- /* Nominal address of the frame described. */
- FRAME_ADDR frame;
- /* Address at which execution is occurring in this frame.
- For the innermost frame, it's the current pc.
- For other frames, it is a pc saved in the next frame. */
- CORE_ADDR pc;
- /* The frame called by the frame we are describing, or 0.
- This may be set even if there isn't a frame called by the one
- we are describing (.->next == 0); in that case it is simply the
- bottom of this frame */
- FRAME_ADDR next_frame;
- /* Anything extra for this structure that may have been defined
- in the machine depedent files. */
-#ifdef EXTRA_FRAME_INFO
- EXTRA_FRAME_INFO
-#endif
- /* Pointers to the next and previous frame_info's in this stack. */
- FRAME next, prev;
- };
-
-/* Describe the saved registers of a frame. */
-
-struct frame_saved_regs
- {
- /* For each register, address of where it was saved on entry to the frame,
- or zero if it was not saved on entry to this frame. */
- CORE_ADDR regs[NUM_REGS];
- };
-
-/* The stack frame that the user has specified for commands to act on.
- Note that one cannot assume this is the address of valid data. */
-
-extern FRAME selected_frame;
-
-extern struct frame_info *get_frame_info ();
-extern struct frame_info *get_prev_frame_info ();
-
-extern FRAME create_new_frame ();
-
-extern void get_frame_saved_regs ();
-
-extern FRAME get_prev_frame ();
-extern FRAME get_current_frame ();
-extern FRAME get_next_frame ();
-
-extern struct block *get_frame_block ();
-extern struct block *get_current_block ();
-extern struct block *get_selected_block ();
-extern struct symbol *get_frame_function ();
-extern struct symbol *get_pc_function ();
-
-/* In stack.c */
-extern FRAME find_relative_frame ();
-
-/* Generic pointer value indicating "I don't know." */
-#define Frame_unknown (CORE_ADDR)-1
diff --git a/gnu/usr.bin/gdb/gdb.1 b/gnu/usr.bin/gdb/gdb.1
deleted file mode 100644
index 57d744b..0000000
--- a/gnu/usr.bin/gdb/gdb.1
+++ /dev/null
@@ -1,3 +0,0 @@
-.\" %W% (Berkeley) %G%
-.\"
-.\" placeholder, until we can produce the manual page
diff --git a/gnu/usr.bin/gdb/gdb/c-exp.tab.c b/gnu/usr.bin/gdb/gdb/c-exp.tab.c
deleted file mode 100644
index 924dfc6..0000000
--- a/gnu/usr.bin/gdb/gdb/c-exp.tab.c
+++ /dev/null
@@ -1,2648 +0,0 @@
-#ifndef lint
-static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define yyclearin (yychar=(-1))
-#define yyerrok (yyerrflag=0)
-#define YYRECOVERING (yyerrflag!=0)
-#define yyparse c_parse
-#define yylex c_lex
-#define yyerror c_error
-#define yychar c_char
-#define yyval c_val
-#define yylval c_lval
-#define yydebug c_debug
-#define yynerrs c_nerrs
-#define yyerrflag c_errflag
-#define yyss c_ss
-#define yyssp c_ssp
-#define yyvs c_vs
-#define yyvsp c_vsp
-#define yylhs c_lhs
-#define yylen c_len
-#define yydefred c_defred
-#define yydgoto c_dgoto
-#define yysindex c_sindex
-#define yyrindex c_rindex
-#define yygindex c_gindex
-#define yytable c_table
-#define yycheck c_check
-#define yyname c_name
-#define yyrule c_rule
-#define YYPREFIX "c_"
-#line 38 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-
-#include "defs.h"
-#include "expression.h"
-#include "parser-defs.h"
-#include "value.h"
-#include "language.h"
-#include "c-lang.h"
-
-/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
- as well as gratuitiously global symbol names, so we can have multiple
- yacc generated parsers in gdb. Note that these are only the variables
- produced by yacc. If other parser generators (bison, byacc, etc) produce
- additional global names that conflict at link time, then those parser
- generators need to be fixed instead of adding those names to this list. */
-
-#define yymaxdepth c_maxdepth
-#define yyparse c_parse
-#define yylex c_lex
-#define yyerror c_error
-#define yylval c_lval
-#define yychar c_char
-#define yydebug c_debug
-#define yypact c_pact
-#define yyr1 c_r1
-#define yyr2 c_r2
-#define yydef c_def
-#define yychk c_chk
-#define yypgo c_pgo
-#define yyact c_act
-#define yyexca c_exca
-#define yyerrflag c_errflag
-#define yynerrs c_nerrs
-#define yyps c_ps
-#define yypv c_pv
-#define yys c_s
-#define yy_yys c_yys
-#define yystate c_state
-#define yytmp c_tmp
-#define yyv c_v
-#define yy_yyv c_yyv
-#define yyval c_val
-#define yylloc c_lloc
-#define yyreds c_reds /* With YYDEBUG defined */
-#define yytoks c_toks /* With YYDEBUG defined */
-
-#ifndef YYDEBUG
-#define YYDEBUG 0 /* Default to no yydebug support */
-#endif
-
-int
-yyparse PARAMS ((void));
-
-static int
-yylex PARAMS ((void));
-
-void
-yyerror PARAMS ((char *));
-
-#line 102 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-typedef union
- {
- LONGEST lval;
- struct {
- LONGEST val;
- struct type *type;
- } typed_val;
- double dval;
- struct symbol *sym;
- struct type *tval;
- struct stoken sval;
- struct ttype tsym;
- struct symtoken ssym;
- int voidval;
- struct block *bval;
- enum exp_opcode opcode;
- struct internalvar *ivar;
-
- struct type **tvec;
- int *ivec;
- } YYSTYPE;
-#line 125 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-/* YYSTYPE gets defined by %union */
-static int
-parse_number PARAMS ((char *, int, int, YYSTYPE *));
-#line 121 "y.tab.c"
-#define INT 257
-#define FLOAT 258
-#define STRING 259
-#define NAME 260
-#define TYPENAME 261
-#define NAME_OR_INT 262
-#define STRUCT 263
-#define CLASS 264
-#define UNION 265
-#define ENUM 266
-#define SIZEOF 267
-#define UNSIGNED 268
-#define COLONCOLON 269
-#define TEMPLATE 270
-#define ERROR 271
-#define SIGNED_KEYWORD 272
-#define LONG 273
-#define SHORT 274
-#define INT_KEYWORD 275
-#define CONST_KEYWORD 276
-#define VOLATILE_KEYWORD 277
-#define LAST 278
-#define REGNAME 279
-#define VARIABLE 280
-#define ASSIGN_MODIFY 281
-#define THIS 282
-#define ABOVE_COMMA 283
-#define OROR 284
-#define ANDAND 285
-#define EQUAL 286
-#define NOTEQUAL 287
-#define LEQ 288
-#define GEQ 289
-#define LSH 290
-#define RSH 291
-#define UNARY 292
-#define INCREMENT 293
-#define DECREMENT 294
-#define ARROW 295
-#define BLOCKNAME 296
-#define YYERRCODE 256
-short c_lhs[] = { -1,
- 0, 0, 3, 2, 2, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 21, 1, 6, 20, 20, 20, 7, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 19, 19, 4, 5, 5,
- 4, 4, 4, 14, 14, 14, 14, 14, 14, 13,
- 13, 13, 13, 13, 12, 12, 12, 12, 12, 15,
- 15, 11, 11, 8, 8, 8, 8, 8, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 18, 18, 18, 18, 10, 10, 16, 16, 16,
- 16, 17, 17,
-};
-short c_len[] = { 2,
- 1, 1, 1, 1, 3, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 3, 3, 4, 3, 3,
- 4, 4, 0, 5, 1, 0, 1, 3, 1, 3,
- 4, 4, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 5, 3, 3, 1, 1, 1, 1, 1,
- 1, 1, 4, 1, 1, 1, 3, 3, 3, 4,
- 1, 2, 1, 1, 2, 2, 2, 3, 3, 1,
- 2, 1, 2, 1, 3, 2, 1, 2, 1, 2,
- 3, 2, 3, 1, 3, 6, 8, 9, 1, 1,
- 1, 1, 2, 3, 2, 3, 3, 4, 2, 3,
- 2, 2, 2, 2, 2, 1, 2, 1, 5, 2,
- 2, 1, 1, 1, 1, 1, 3, 1, 1, 1,
- 1, 1, 1,
-};
-short c_defred[] = { 0,
- 56, 58, 64, 132, 99, 57, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 100, 0, 0,
- 60, 61, 62, 65, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 25, 0, 0, 0, 2, 59, 71,
- 0, 0, 0, 94, 73, 0, 128, 130, 131, 129,
- 111, 112, 113, 114, 0, 0, 0, 122, 0, 0,
- 123, 115, 72, 0, 124, 125, 117, 0, 103, 109,
- 120, 121, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 13, 14, 0, 0, 0, 23, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 89, 0, 77, 87, 0, 0, 0, 0, 104,
- 110, 0, 106, 33, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 17,
- 16, 0, 20, 19, 0, 0, 0, 29, 0, 0,
- 30, 0, 95, 0, 69, 78, 79, 83, 81, 0,
- 90, 92, 0, 0, 0, 0, 0, 88, 86, 0,
- 0, 108, 0, 0, 0, 0, 0, 22, 0, 0,
- 0, 0, 70, 91, 0, 0, 93, 85, 119, 0,
- 24, 0, 0, 0, 0, 97, 0, 98,
-};
-short c_dgoto[] = { 35,
- 36, 78, 38, 39, 40, 41, 169, 183, 57, 185,
- 122, 123, 124, 44, 125, 175, 45, 62, 46, 113,
- 166,
-};
-short c_sindex[] = { 1773,
- 0, 0, 0, 0, 0, 0, -243, -243, -243, -243,
- 1839, -240, -243, -243, -56, -260, -266, 0, 1303, 1303,
- 0, 0, 0, 0, 1773, 1773, 1773, 1773, 1773, 1773,
- 0, 1773, 1773, 0, 0, 2134, -24, 0, 0, 0,
- 1773, -16, -36, 0, 0, -233, 0, 0, 0, 0,
- 0, 0, 0, 0, 1773, 83, -219, 0, -217, -208,
- 0, 0, 0, 57, 0, 0, 0, -199, 0, 0,
- 0, 0, 83, 83, 83, 83, 83, 74, -12, 83,
- 83, 1773, 1773, 1773, 1773, 1773, 1773, 1773, 1773, 1773,
- 1773, 1773, 1773, 1773, 1773, 1773, 1773, 1773, 1773, 1773,
- 1773, 1773, 1773, 0, 0, 2136, 2175, 1773, 0, 1773,
- 2134, -28, -17, 1303, -35, 31, 31, 31, 31, -90,
- 1807, 0, -3, 0, 0, -243, 49, -52, -148, 0,
- 0, 1303, 0, 0, 1773, 2134, 2134, 2099, 2197, 2208,
- 2236, 2269, 2304, 2474, 2474, 743, 743, 743, 743, 615,
- 615, 273, 320, 320, 83, 83, 83, 0, 1773, 0,
- 0, 1773, 0, 0, -44, 1773, 2134, 0, 1773, 1773,
- 0, -137, 0, -243, 0, 0, 0, 0, 0, 63,
- 0, 0, -16, 28, 80, 117, 477, 0, 0, 0,
- 1653, 0, -32, 83, 1773, 83, 83, 0, 106, 83,
- 2134, 136, 0, 0, 145, 1303, 0, 0, 0, 2169,
- 0, 129, -16, 155, 2276, 0, 171, 0,
-};
-short c_rindex[] = { 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1146, 0, 0, 1403, 1413, 1691, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 16, 188, 0, 0, 0,
- -13, 206, 79, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 213, 0, 0, 1716, 1721,
- 0, 0, 0, 0, 0, 0, 0, 1730, 0, 0,
- 0, 0, 311, 402, 414, 487, 515, 0, 0, 583,
- 673, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- -19, 0, 0, 0, 0, 10, 52, 111, 359, 0,
- 0, 0, 492, 0, 0, 0, 0, 0, 1746, 0,
- 0, 0, 0, 0, 0, 668, 892, 0, 881, 153,
- 479, 1135, 128, 1583, 1620, 1366, 1438, 1546, 1572, 1264,
- 1312, 1236, 1182, 1224, 782, 794, 853, 40, 0, 0,
- 0, 0, 0, 0, 0, 193, 239, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 201, -30, 0, 0, 0, 0, 0, 99,
- 138, 0, 0, 928, 0, 967, 1056, 0, 0, 1110,
- -18, 0, 0, 0, 0, 0, 0, 0, 0, 110,
- 0, 0, 257, 544, 0, 0, 0, 0,
-};
-short c_gindex[] = { 0,
- 2543, 5, 0, 0, 42, 0, 107, 75, 450, 13,
- 115, 0, 148, 0, 120, 989, 0, 215, 0, 81,
- 0,
-};
-#define YYTABLESIZE 2769
-short c_table[] = { 110,
- 133, 118, 181, 121, 37, 119, 173, 114, 70, 75,
- 74, 114, 68, 74, 69, 4, 47, 48, 49, 110,
- 58, 27, 28, 114, 27, 28, 170, 114, 135, 209,
- 26, 74, 59, 60, 61, 126, 187, 133, 133, 130,
- 133, 133, 133, 133, 133, 133, 133, 133, 198, 128,
- 75, 76, 50, 75, 120, 129, 4, 130, 133, 4,
- 133, 133, 133, 133, 133, 118, 131, 121, 118, 119,
- 121, 75, 119, 174, 42, 133, 130, 130, 74, 130,
- 130, 130, 130, 130, 130, 130, 130, 120, 114, 191,
- 174, 133, 76, 133, 133, 76, 168, 130, 68, 130,
- 130, 130, 130, 130, 79, 27, 28, 168, 4, 53,
- 82, 26, 165, 76, 134, 112, 132, 110, 120, 74,
- 207, 120, 109, 206, 133, 133, 192, 48, 107, 127,
- 130, 202, 130, 130, 75, 68, 68, 63, 68, 68,
- 68, 68, 68, 68, 68, 68, 211, 160, 163, 170,
- 53, 82, 51, 53, 82, 204, 68, 208, 68, 68,
- 68, 68, 68, 130, 130, 48, 180, 53, 48, 214,
- 53, 48, 82, 108, 63, 63, 76, 212, 63, 63,
- 63, 63, 63, 63, 63, 48, 173, 1, 48, 68,
- 48, 68, 68, 51, 215, 63, 51, 63, 63, 63,
- 63, 63, 53, 74, 58, 3, 193, 47, 48, 49,
- 51, 218, 15, 51, 206, 51, 65, 66, 61, 171,
- 48, 48, 68, 68, 47, 48, 49, 217, 63, 67,
- 63, 63, 115, 26, 53, 82, 26, 188, 5, 116,
- 117, 126, 189, 50, 126, 51, 199, 0, 0, 15,
- 15, 48, 48, 15, 15, 15, 15, 15, 0, 15,
- 50, 63, 63, 176, 177, 178, 179, 0, 186, 66,
- 15, 0, 15, 15, 15, 15, 15, 51, 0, 5,
- 213, 133, 5, 0, 133, 133, 133, 133, 133, 133,
- 133, 133, 0, 133, 133, 133, 205, 127, 0, 0,
- 127, 0, 0, 116, 117, 15, 15, 0, 99, 103,
- 7, 0, 109, 0, 101, 99, 0, 100, 107, 102,
- 130, 0, 0, 130, 130, 130, 130, 130, 130, 130,
- 130, 5, 130, 130, 130, 0, 15, 15, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 7, 7, 0,
- 0, 7, 7, 7, 7, 7, 103, 7, 80, 109,
- 0, 101, 0, 108, 0, 107, 102, 67, 7, 0,
- 7, 7, 7, 7, 7, 104, 105, 106, 0, 68,
- 0, 0, 68, 68, 68, 68, 68, 68, 68, 68,
- 53, 68, 68, 68, 0, 0, 0, 0, 0, 80,
- 0, 8, 80, 7, 7, 0, 0, 0, 48, 0,
- 108, 48, 48, 6, 0, 0, 0, 0, 63, 0,
- 80, 63, 63, 63, 63, 63, 63, 63, 63, 0,
- 0, 0, 63, 51, 7, 7, 51, 51, 8, 8,
- 0, 0, 8, 8, 8, 8, 8, 0, 8, 43,
- 6, 6, 0, 0, 6, 6, 6, 6, 6, 8,
- 6, 8, 8, 8, 8, 8, 0, 0, 71, 72,
- 0, 6, 0, 6, 6, 6, 6, 6, 50, 43,
- 0, 0, 0, 80, 0, 0, 11, 0, 0, 0,
- 43, 84, 0, 15, 8, 8, 15, 15, 15, 15,
- 15, 15, 15, 15, 43, 0, 6, 6, 0, 0,
- 0, 0, 0, 0, 12, 0, 0, 182, 0, 50,
- 0, 0, 50, 11, 11, 8, 8, 11, 11, 11,
- 11, 11, 84, 11, 0, 84, 50, 6, 6, 50,
- 0, 50, 0, 96, 11, 0, 11, 11, 11, 11,
- 11, 12, 12, 84, 0, 12, 12, 12, 12, 12,
- 0, 12, 0, 172, 0, 104, 105, 106, 0, 0,
- 184, 50, 12, 0, 12, 12, 12, 12, 12, 11,
- 11, 184, 9, 0, 96, 0, 0, 96, 0, 0,
- 0, 7, 0, 0, 7, 7, 7, 7, 7, 7,
- 7, 7, 50, 50, 0, 96, 0, 12, 12, 0,
- 11, 11, 104, 105, 106, 0, 84, 0, 0, 9,
- 9, 0, 0, 9, 9, 9, 9, 9, 0, 9,
- 0, 0, 0, 0, 0, 0, 184, 0, 12, 12,
- 9, 0, 9, 9, 9, 9, 9, 0, 0, 0,
- 0, 103, 0, 0, 109, 184, 101, 99, 0, 100,
- 107, 102, 0, 0, 184, 0, 0, 55, 96, 0,
- 0, 0, 10, 0, 0, 9, 9, 0, 98, 0,
- 0, 0, 8, 0, 0, 8, 8, 8, 8, 8,
- 8, 8, 8, 0, 6, 0, 0, 6, 6, 6,
- 6, 6, 6, 6, 6, 108, 9, 9, 55, 10,
- 10, 55, 0, 10, 10, 10, 10, 10, 0, 10,
- 0, 0, 0, 0, 0, 55, 0, 0, 0, 0,
- 10, 0, 10, 10, 10, 10, 10, 5, 0, 7,
- 8, 9, 10, 0, 12, 0, 14, 0, 15, 16,
- 17, 18, 19, 20, 0, 0, 0, 0, 0, 50,
- 55, 0, 50, 50, 0, 10, 10, 11, 0, 0,
- 11, 11, 11, 11, 11, 11, 11, 11, 0, 103,
- 0, 35, 109, 0, 101, 99, 0, 100, 107, 102,
- 0, 0, 55, 36, 0, 12, 10, 10, 12, 12,
- 12, 12, 12, 12, 12, 12, 98, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 35, 35,
- 0, 0, 35, 35, 35, 35, 35, 0, 35, 0,
- 36, 36, 0, 108, 36, 36, 36, 36, 36, 35,
- 36, 35, 35, 35, 35, 35, 0, 0, 0, 0,
- 0, 36, 37, 36, 36, 36, 36, 36, 0, 0,
- 0, 0, 0, 9, 0, 0, 9, 9, 9, 9,
- 9, 9, 9, 9, 35, 35, 0, 0, 0, 0,
- 52, 0, 0, 0, 0, 0, 36, 36, 0, 37,
- 37, 54, 0, 37, 37, 37, 37, 37, 0, 37,
- 0, 0, 0, 0, 0, 35, 35, 104, 105, 106,
- 37, 0, 37, 37, 37, 37, 37, 36, 36, 0,
- 0, 52, 0, 0, 52, 0, 0, 32, 0, 0,
- 0, 0, 54, 0, 0, 54, 0, 0, 52, 0,
- 0, 52, 0, 52, 0, 37, 37, 0, 0, 54,
- 0, 0, 0, 10, 0, 0, 10, 10, 10, 10,
- 10, 10, 10, 10, 32, 32, 18, 0, 32, 32,
- 32, 32, 32, 52, 32, 0, 37, 37, 0, 0,
- 0, 0, 0, 0, 54, 32, 0, 32, 32, 32,
- 32, 32, 0, 0, 0, 51, 52, 53, 54, 0,
- 0, 63, 64, 18, 18, 52, 0, 18, 18, 18,
- 18, 18, 0, 18, 0, 0, 54, 0, 0, 0,
- 32, 32, 0, 0, 18, 0, 18, 18, 18, 18,
- 18, 0, 96, 97, 0, 104, 105, 106, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 32, 32, 0, 0, 21, 0, 0, 0, 18,
- 18, 0, 35, 0, 0, 35, 35, 35, 35, 35,
- 35, 35, 35, 0, 36, 0, 0, 36, 36, 36,
- 36, 36, 36, 36, 36, 0, 0, 0, 0, 0,
- 18, 18, 21, 21, 161, 164, 21, 21, 21, 21,
- 21, 0, 21, 0, 0, 0, 0, 0, 0, 31,
- 0, 0, 0, 21, 190, 21, 21, 21, 21, 21,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 37, 49, 0, 37, 37, 37, 37,
- 37, 37, 37, 37, 0, 116, 31, 31, 21, 21,
- 31, 31, 31, 31, 31, 0, 31, 0, 0, 0,
- 0, 52, 203, 0, 52, 0, 0, 31, 0, 31,
- 31, 31, 31, 31, 0, 49, 0, 0, 49, 21,
- 21, 38, 0, 116, 0, 116, 116, 116, 0, 116,
- 0, 0, 49, 0, 0, 49, 0, 49, 0, 0,
- 0, 0, 31, 31, 0, 0, 0, 116, 32, 0,
- 0, 32, 32, 32, 32, 32, 32, 32, 32, 38,
- 0, 0, 38, 39, 38, 38, 38, 49, 49, 0,
- 0, 0, 0, 31, 31, 34, 116, 0, 0, 38,
- 0, 38, 38, 38, 38, 38, 0, 18, 0, 0,
- 18, 18, 18, 18, 18, 18, 18, 18, 49, 49,
- 0, 39, 0, 40, 39, 0, 39, 39, 39, 0,
- 116, 0, 0, 34, 38, 38, 34, 0, 0, 34,
- 0, 39, 0, 39, 39, 39, 39, 39, 0, 0,
- 0, 0, 0, 34, 0, 34, 34, 34, 34, 34,
- 0, 40, 0, 0, 40, 38, 38, 40, 0, 0,
- 0, 41, 0, 0, 0, 0, 39, 39, 0, 0,
- 0, 40, 0, 40, 40, 40, 40, 0, 34, 34,
- 0, 0, 0, 0, 0, 0, 21, 0, 0, 21,
- 21, 21, 21, 21, 21, 21, 21, 39, 39, 41,
- 0, 0, 41, 0, 0, 41, 40, 40, 0, 34,
- 34, 0, 0, 0, 0, 46, 0, 0, 0, 41,
- 0, 41, 41, 41, 41, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 40, 40, 0,
- 31, 0, 0, 31, 31, 31, 31, 31, 31, 31,
- 31, 0, 118, 46, 41, 41, 46, 0, 0, 46,
- 0, 0, 101, 0, 116, 49, 0, 0, 49, 49,
- 0, 116, 116, 46, 0, 46, 46, 46, 46, 0,
- 0, 0, 0, 0, 0, 41, 41, 47, 0, 0,
- 118, 0, 118, 118, 118, 0, 118, 0, 0, 0,
- 101, 0, 101, 101, 101, 0, 101, 0, 46, 46,
- 0, 0, 38, 0, 118, 38, 38, 38, 38, 38,
- 38, 38, 38, 0, 101, 47, 0, 0, 47, 0,
- 0, 47, 0, 0, 0, 0, 0, 0, 0, 46,
- 46, 0, 0, 118, 0, 47, 0, 47, 47, 47,
- 47, 0, 0, 101, 39, 0, 0, 39, 39, 39,
- 39, 39, 39, 39, 39, 0, 34, 0, 0, 34,
- 34, 34, 34, 34, 34, 34, 34, 118, 0, 0,
- 47, 47, 0, 0, 0, 0, 0, 101, 0, 0,
- 0, 0, 0, 0, 40, 44, 0, 40, 40, 40,
- 40, 40, 40, 40, 40, 0, 0, 0, 0, 0,
- 0, 47, 47, 5, 0, 7, 8, 9, 10, 0,
- 12, 45, 14, 0, 15, 16, 17, 18, 19, 20,
- 0, 0, 42, 44, 0, 0, 44, 0, 0, 44,
- 0, 0, 41, 0, 0, 41, 41, 41, 41, 41,
- 41, 41, 41, 44, 0, 44, 44, 44, 44, 45,
- 0, 0, 45, 0, 0, 45, 0, 0, 0, 43,
- 42, 0, 0, 42, 0, 0, 42, 0, 0, 45,
- 0, 45, 45, 45, 45, 0, 0, 0, 44, 44,
- 42, 0, 0, 42, 0, 42, 46, 0, 0, 46,
- 46, 46, 46, 46, 46, 0, 0, 43, 0, 0,
- 43, 0, 0, 43, 45, 45, 0, 0, 0, 44,
- 44, 118, 0, 0, 0, 42, 42, 43, 118, 118,
- 43, 101, 43, 0, 0, 32, 0, 0, 101, 101,
- 102, 0, 30, 0, 0, 45, 45, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 42, 42, 0, 0,
- 0, 0, 43, 43, 0, 124, 0, 0, 47, 0,
- 125, 47, 47, 47, 47, 47, 47, 0, 102, 105,
- 102, 102, 102, 0, 102, 0, 0, 0, 0, 0,
- 0, 0, 0, 43, 43, 107, 0, 0, 0, 0,
- 0, 0, 102, 124, 0, 124, 124, 124, 125, 124,
- 125, 125, 125, 0, 125, 0, 0, 105, 0, 105,
- 105, 105, 0, 105, 0, 34, 0, 124, 33, 0,
- 0, 102, 125, 107, 0, 107, 107, 107, 0, 107,
- 0, 105, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 32, 124, 107, 0, 0,
- 25, 125, 30, 0, 27, 102, 0, 26, 0, 0,
- 105, 0, 0, 0, 0, 0, 44, 0, 0, 44,
- 44, 44, 44, 44, 44, 0, 107, 0, 0, 0,
- 124, 0, 0, 0, 118, 125, 121, 182, 119, 0,
- 0, 0, 45, 0, 105, 45, 45, 45, 45, 45,
- 45, 0, 0, 42, 0, 0, 42, 42, 42, 42,
- 107, 32, 0, 0, 0, 0, 25, 0, 55, 0,
- 27, 0, 0, 26, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 34, 0, 120, 33, 0,
- 43, 0, 0, 43, 43, 43, 43, 0, 0, 1,
- 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 13, 14, 0, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 0, 24, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 28, 29, 0, 31, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 102,
- 0, 34, 0, 0, 33, 0, 102, 102, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 124, 0, 0, 0, 0, 125,
- 0, 124, 124, 0, 0, 0, 125, 125, 105, 0,
- 0, 0, 0, 0, 0, 105, 105, 0, 0, 0,
- 0, 0, 0, 0, 107, 0, 0, 0, 0, 0,
- 0, 107, 107, 0, 0, 0, 0, 0, 0, 1,
- 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 13, 14, 0, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 0, 24, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 28, 29, 5, 31, 7,
- 8, 9, 10, 0, 12, 0, 14, 0, 15, 16,
- 17, 18, 19, 20, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10, 11, 12, 13, 14, 0,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 0,
- 24, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 28, 29, 0, 31, 103, 89, 0, 109, 0,
- 101, 99, 0, 100, 107, 102, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 195, 0, 92, 83,
- 93, 84, 98, 0, 0, 0, 0, 0, 0, 0,
- 103, 89, 0, 109, 0, 101, 99, 159, 100, 107,
- 102, 0, 0, 0, 0, 0, 0, 0, 0, 108,
- 0, 0, 88, 92, 83, 93, 84, 98, 0, 0,
- 0, 0, 0, 0, 0, 103, 89, 0, 109, 0,
- 101, 99, 0, 100, 107, 102, 162, 0, 0, 0,
- 0, 0, 87, 0, 108, 0, 0, 88, 92, 0,
- 93, 84, 98, 103, 89, 0, 109, 0, 101, 99,
- 0, 100, 107, 102, 103, 89, 0, 109, 0, 101,
- 99, 0, 100, 107, 102, 0, 92, 87, 93, 108,
- 98, 0, 88, 0, 0, 0, 0, 92, 0, 93,
- 0, 98, 103, 89, 0, 109, 0, 101, 99, 0,
- 100, 107, 102, 0, 0, 0, 0, 108, 0, 0,
- 88, 0, 87, 0, 0, 92, 0, 93, 108, 98,
- 0, 88, 0, 0, 0, 103, 89, 0, 109, 0,
- 101, 99, 0, 100, 107, 102, 216, 0, 0, 0,
- 87, 0, 0, 0, 0, 0, 108, 0, 92, 88,
- 93, 87, 98, 0, 0, 0, 0, 0, 0, 0,
- 103, 0, 0, 109, 0, 101, 99, 0, 100, 107,
- 102, 0, 0, 0, 0, 0, 0, 0, 0, 108,
- 0, 0, 0, 92, 0, 93, 0, 98, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 82,
- 0, 0, 85, 86, 90, 91, 94, 95, 96, 97,
- 0, 104, 105, 106, 108, 47, 158, 49, 7, 8,
- 9, 10, 0, 12, 0, 14, 0, 15, 16, 17,
- 18, 19, 20, 0, 82, 0, 0, 85, 86, 90,
- 91, 94, 95, 96, 97, 0, 104, 105, 106, 0,
- 0, 50, 0, 0, 47, 158, 49, 7, 8, 9,
- 10, 0, 12, 0, 14, 0, 15, 16, 17, 18,
- 19, 20, 85, 86, 90, 91, 94, 95, 96, 97,
- 0, 104, 105, 106, 0, 0, 0, 0, 0, 0,
- 50, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 86, 90, 91, 94, 95, 96, 97, 0, 104,
- 105, 106, 0, 90, 91, 94, 95, 96, 97, 0,
- 104, 105, 106, 0, 0, 0, 0, 0, 0, 0,
- 103, 0, 0, 109, 0, 101, 99, 0, 100, 107,
- 102, 90, 91, 94, 95, 96, 97, 0, 104, 105,
- 106, 0, 0, 92, 0, 93, 5, 98, 7, 8,
- 9, 10, 0, 12, 0, 14, 0, 15, 16, 17,
- 18, 19, 20, 56, 90, 91, 94, 95, 96, 97,
- 0, 104, 105, 106, 108, 0, 0, 73, 74, 75,
- 76, 77, 0, 0, 80, 81, 0, 0, 0, 0,
- 0, 0, 0, 111, 0, 0, 0, 0, 0, 90,
- 91, 94, 95, 96, 97, 0, 104, 105, 106, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 136, 137, 138, 139, 140, 141,
- 142, 143, 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 0, 0, 0, 0,
- 0, 0, 167, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 194, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 196, 0, 0, 197, 0, 0, 0, 111, 0,
- 0, 200, 201, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 194, 0, 0, 0, 210, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 94, 95, 96, 97, 0, 104, 105, 106,
-};
-short c_check[] = { 44,
- 0, 38, 93, 40, 0, 42, 42, 40, 275, 0,
- 41, 40, 273, 44, 275, 0, 260, 261, 262, 44,
- 261, 41, 41, 40, 44, 44, 44, 40, 41, 62,
- 44, 62, 273, 274, 275, 269, 40, 37, 38, 0,
- 40, 41, 42, 43, 44, 45, 46, 47, 93, 269,
- 41, 0, 296, 44, 91, 273, 41, 275, 58, 44,
- 60, 61, 62, 63, 64, 38, 275, 40, 38, 42,
- 40, 62, 42, 126, 0, 275, 37, 38, 0, 40,
- 41, 42, 43, 44, 45, 46, 47, 91, 40, 41,
- 126, 91, 41, 93, 94, 44, 125, 58, 0, 60,
- 61, 62, 63, 64, 30, 125, 125, 125, 93, 0,
- 0, 125, 108, 62, 41, 41, 60, 44, 91, 41,
- 41, 91, 40, 44, 124, 125, 275, 0, 46, 55,
- 91, 269, 93, 94, 125, 37, 38, 0, 40, 41,
- 42, 43, 44, 45, 46, 47, 41, 106, 107, 44,
- 41, 41, 0, 44, 44, 93, 58, 41, 60, 61,
- 62, 63, 64, 124, 125, 38, 257, 58, 41, 41,
- 61, 44, 62, 91, 37, 38, 125, 42, 41, 42,
- 43, 44, 45, 46, 47, 58, 42, 0, 61, 91,
- 63, 93, 94, 41, 40, 58, 44, 60, 61, 62,
- 63, 64, 93, 125, 261, 0, 132, 260, 261, 262,
- 58, 41, 0, 61, 44, 63, 273, 274, 275, 113,
- 93, 94, 124, 125, 260, 261, 262, 215, 91, 15,
- 93, 94, 269, 41, 125, 125, 44, 123, 0, 276,
- 277, 41, 123, 296, 44, 93, 166, -1, -1, 37,
- 38, 124, 125, 41, 42, 43, 44, 45, -1, 47,
- 296, 124, 125, 116, 117, 118, 119, -1, 121, 269,
- 58, -1, 60, 61, 62, 63, 64, 125, -1, 41,
- 206, 281, 44, -1, 284, 285, 286, 287, 288, 289,
- 290, 291, -1, 293, 294, 295, 269, 41, -1, -1,
- 44, -1, -1, 276, 277, 93, 94, -1, 269, 37,
- 0, -1, 40, -1, 42, 43, -1, 45, 46, 47,
- 281, -1, -1, 284, 285, 286, 287, 288, 289, 290,
- 291, 93, 293, 294, 295, -1, 124, 125, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 37, 38, -1,
- -1, 41, 42, 43, 44, 45, 37, 47, 0, 40,
- -1, 42, -1, 91, -1, 46, 47, 269, 58, -1,
- 60, 61, 62, 63, 64, 293, 294, 295, -1, 281,
- -1, -1, 284, 285, 286, 287, 288, 289, 290, 291,
- 281, 293, 294, 295, -1, -1, -1, -1, -1, 41,
- -1, 0, 44, 93, 94, -1, -1, -1, 281, -1,
- 91, 284, 285, 0, -1, -1, -1, -1, 281, -1,
- 62, 284, 285, 286, 287, 288, 289, 290, 291, -1,
- -1, -1, 295, 281, 124, 125, 284, 285, 37, 38,
- -1, -1, 41, 42, 43, 44, 45, -1, 47, 0,
- 37, 38, -1, -1, 41, 42, 43, 44, 45, 58,
- 47, 60, 61, 62, 63, 64, -1, -1, 19, 20,
- -1, 58, -1, 60, 61, 62, 63, 64, 0, 30,
- -1, -1, -1, 125, -1, -1, 0, -1, -1, -1,
- 41, 0, -1, 281, 93, 94, 284, 285, 286, 287,
- 288, 289, 290, 291, 55, -1, 93, 94, -1, -1,
- -1, -1, -1, -1, 0, -1, -1, 41, -1, 41,
- -1, -1, 44, 37, 38, 124, 125, 41, 42, 43,
- 44, 45, 41, 47, -1, 44, 58, 124, 125, 61,
- -1, 63, -1, 0, 58, -1, 60, 61, 62, 63,
- 64, 37, 38, 62, -1, 41, 42, 43, 44, 45,
- -1, 47, -1, 114, -1, 293, 294, 295, -1, -1,
- 121, 93, 58, -1, 60, 61, 62, 63, 64, 93,
- 94, 132, 0, -1, 41, -1, -1, 44, -1, -1,
- -1, 281, -1, -1, 284, 285, 286, 287, 288, 289,
- 290, 291, 124, 125, -1, 62, -1, 93, 94, -1,
- 124, 125, 293, 294, 295, -1, 125, -1, -1, 37,
- 38, -1, -1, 41, 42, 43, 44, 45, -1, 47,
- -1, -1, -1, -1, -1, -1, 187, -1, 124, 125,
- 58, -1, 60, 61, 62, 63, 64, -1, -1, -1,
- -1, 37, -1, -1, 40, 206, 42, 43, -1, 45,
- 46, 47, -1, -1, 215, -1, -1, 0, 125, -1,
- -1, -1, 0, -1, -1, 93, 94, -1, 64, -1,
- -1, -1, 281, -1, -1, 284, 285, 286, 287, 288,
- 289, 290, 291, -1, 281, -1, -1, 284, 285, 286,
- 287, 288, 289, 290, 291, 91, 124, 125, 41, 37,
- 38, 44, -1, 41, 42, 43, 44, 45, -1, 47,
- -1, -1, -1, -1, -1, 58, -1, -1, -1, -1,
- 58, -1, 60, 61, 62, 63, 64, 261, -1, 263,
- 264, 265, 266, -1, 268, -1, 270, -1, 272, 273,
- 274, 275, 276, 277, -1, -1, -1, -1, -1, 281,
- 93, -1, 284, 285, -1, 93, 94, 281, -1, -1,
- 284, 285, 286, 287, 288, 289, 290, 291, -1, 37,
- -1, 0, 40, -1, 42, 43, -1, 45, 46, 47,
- -1, -1, 125, 0, -1, 281, 124, 125, 284, 285,
- 286, 287, 288, 289, 290, 291, 64, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 37, 38,
- -1, -1, 41, 42, 43, 44, 45, -1, 47, -1,
- 37, 38, -1, 91, 41, 42, 43, 44, 45, 58,
- 47, 60, 61, 62, 63, 64, -1, -1, -1, -1,
- -1, 58, 0, 60, 61, 62, 63, 64, -1, -1,
- -1, -1, -1, 281, -1, -1, 284, 285, 286, 287,
- 288, 289, 290, 291, 93, 94, -1, -1, -1, -1,
- 0, -1, -1, -1, -1, -1, 93, 94, -1, 37,
- 38, 0, -1, 41, 42, 43, 44, 45, -1, 47,
- -1, -1, -1, -1, -1, 124, 125, 293, 294, 295,
- 58, -1, 60, 61, 62, 63, 64, 124, 125, -1,
- -1, 41, -1, -1, 44, -1, -1, 0, -1, -1,
- -1, -1, 41, -1, -1, 44, -1, -1, 58, -1,
- -1, 61, -1, 63, -1, 93, 94, -1, -1, 58,
- -1, -1, -1, 281, -1, -1, 284, 285, 286, 287,
- 288, 289, 290, 291, 37, 38, 0, -1, 41, 42,
- 43, 44, 45, 93, 47, -1, 124, 125, -1, -1,
- -1, -1, -1, -1, 93, 58, -1, 60, 61, 62,
- 63, 64, -1, -1, -1, 7, 8, 9, 10, -1,
- -1, 13, 14, 37, 38, 125, -1, 41, 42, 43,
- 44, 45, -1, 47, -1, -1, 125, -1, -1, -1,
- 93, 94, -1, -1, 58, -1, 60, 61, 62, 63,
- 64, -1, 290, 291, -1, 293, 294, 295, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 124, 125, -1, -1, 0, -1, -1, -1, 93,
- 94, -1, 281, -1, -1, 284, 285, 286, 287, 288,
- 289, 290, 291, -1, 281, -1, -1, 284, 285, 286,
- 287, 288, 289, 290, 291, -1, -1, -1, -1, -1,
- 124, 125, 37, 38, 106, 107, 41, 42, 43, 44,
- 45, -1, 47, -1, -1, -1, -1, -1, -1, 0,
- -1, -1, -1, 58, 126, 60, 61, 62, 63, 64,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 281, 0, -1, 284, 285, 286, 287,
- 288, 289, 290, 291, -1, 0, 37, 38, 93, 94,
- 41, 42, 43, 44, 45, -1, 47, -1, -1, -1,
- -1, 281, 174, -1, 284, -1, -1, 58, -1, 60,
- 61, 62, 63, 64, -1, 41, -1, -1, 44, 124,
- 125, 0, -1, 38, -1, 40, 41, 42, -1, 44,
- -1, -1, 58, -1, -1, 61, -1, 63, -1, -1,
- -1, -1, 93, 94, -1, -1, -1, 62, 281, -1,
- -1, 284, 285, 286, 287, 288, 289, 290, 291, 38,
- -1, -1, 41, 0, 43, 44, 45, 93, 94, -1,
- -1, -1, -1, 124, 125, 0, 91, -1, -1, 58,
- -1, 60, 61, 62, 63, 64, -1, 281, -1, -1,
- 284, 285, 286, 287, 288, 289, 290, 291, 124, 125,
- -1, 38, -1, 0, 41, -1, 43, 44, 45, -1,
- 125, -1, -1, 38, 93, 94, 41, -1, -1, 44,
- -1, 58, -1, 60, 61, 62, 63, 64, -1, -1,
- -1, -1, -1, 58, -1, 60, 61, 62, 63, 64,
- -1, 38, -1, -1, 41, 124, 125, 44, -1, -1,
- -1, 0, -1, -1, -1, -1, 93, 94, -1, -1,
- -1, 58, -1, 60, 61, 62, 63, -1, 93, 94,
- -1, -1, -1, -1, -1, -1, 281, -1, -1, 284,
- 285, 286, 287, 288, 289, 290, 291, 124, 125, 38,
- -1, -1, 41, -1, -1, 44, 93, 94, -1, 124,
- 125, -1, -1, -1, -1, 0, -1, -1, -1, 58,
- -1, 60, 61, 62, 63, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 124, 125, -1,
- 281, -1, -1, 284, 285, 286, 287, 288, 289, 290,
- 291, -1, 0, 38, 93, 94, 41, -1, -1, 44,
- -1, -1, 0, -1, 269, 281, -1, -1, 284, 285,
- -1, 276, 277, 58, -1, 60, 61, 62, 63, -1,
- -1, -1, -1, -1, -1, 124, 125, 0, -1, -1,
- 38, -1, 40, 41, 42, -1, 44, -1, -1, -1,
- 38, -1, 40, 41, 42, -1, 44, -1, 93, 94,
- -1, -1, 281, -1, 62, 284, 285, 286, 287, 288,
- 289, 290, 291, -1, 62, 38, -1, -1, 41, -1,
- -1, 44, -1, -1, -1, -1, -1, -1, -1, 124,
- 125, -1, -1, 91, -1, 58, -1, 60, 61, 62,
- 63, -1, -1, 91, 281, -1, -1, 284, 285, 286,
- 287, 288, 289, 290, 291, -1, 281, -1, -1, 284,
- 285, 286, 287, 288, 289, 290, 291, 125, -1, -1,
- 93, 94, -1, -1, -1, -1, -1, 125, -1, -1,
- -1, -1, -1, -1, 281, 0, -1, 284, 285, 286,
- 287, 288, 289, 290, 291, -1, -1, -1, -1, -1,
- -1, 124, 125, 261, -1, 263, 264, 265, 266, -1,
- 268, 0, 270, -1, 272, 273, 274, 275, 276, 277,
- -1, -1, 0, 38, -1, -1, 41, -1, -1, 44,
- -1, -1, 281, -1, -1, 284, 285, 286, 287, 288,
- 289, 290, 291, 58, -1, 60, 61, 62, 63, 38,
- -1, -1, 41, -1, -1, 44, -1, -1, -1, 0,
- 38, -1, -1, 41, -1, -1, 44, -1, -1, 58,
- -1, 60, 61, 62, 63, -1, -1, -1, 93, 94,
- 58, -1, -1, 61, -1, 63, 281, -1, -1, 284,
- 285, 286, 287, 288, 289, -1, -1, 38, -1, -1,
- 41, -1, -1, 44, 93, 94, -1, -1, -1, 124,
- 125, 269, -1, -1, -1, 93, 94, 58, 276, 277,
- 61, 269, 63, -1, -1, 33, -1, -1, 276, 277,
- 0, -1, 40, -1, -1, 124, 125, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 124, 125, -1, -1,
- -1, -1, 93, 94, -1, 0, -1, -1, 281, -1,
- 0, 284, 285, 286, 287, 288, 289, -1, 38, 0,
- 40, 41, 42, -1, 44, -1, -1, -1, -1, -1,
- -1, -1, -1, 124, 125, 0, -1, -1, -1, -1,
- -1, -1, 62, 38, -1, 40, 41, 42, 38, 44,
- 40, 41, 42, -1, 44, -1, -1, 38, -1, 40,
- 41, 42, -1, 44, -1, 123, -1, 62, 126, -1,
- -1, 91, 62, 38, -1, 40, 41, 42, -1, 44,
- -1, 62, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 33, 91, 62, -1, -1,
- 38, 91, 40, -1, 42, 125, -1, 45, -1, -1,
- 91, -1, -1, -1, -1, -1, 281, -1, -1, 284,
- 285, 286, 287, 288, 289, -1, 91, -1, -1, -1,
- 125, -1, -1, -1, 38, 125, 40, 41, 42, -1,
- -1, -1, 281, -1, 125, 284, 285, 286, 287, 288,
- 289, -1, -1, 281, -1, -1, 284, 285, 286, 287,
- 125, 33, -1, -1, -1, -1, 38, -1, 40, -1,
- 42, -1, -1, 45, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 123, -1, 91, 126, -1,
- 281, -1, -1, 284, 285, 286, 287, -1, -1, 257,
- 258, 259, 260, 261, 262, 263, 264, 265, 266, 267,
- 268, 269, 270, -1, 272, 273, 274, 275, 276, 277,
- 278, 279, 280, -1, 282, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 293, 294, -1, 296, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 269,
- -1, 123, -1, -1, 126, -1, 276, 277, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 269, -1, -1, -1, -1, 269,
- -1, 276, 277, -1, -1, -1, 276, 277, 269, -1,
- -1, -1, -1, -1, -1, 276, 277, -1, -1, -1,
- -1, -1, -1, -1, 269, -1, -1, -1, -1, -1,
- -1, 276, 277, -1, -1, -1, -1, -1, -1, 257,
- 258, 259, 260, 261, 262, 263, 264, 265, 266, 267,
- 268, 269, 270, -1, 272, 273, 274, 275, 276, 277,
- 278, 279, 280, -1, 282, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 293, 294, 261, 296, 263,
- 264, 265, 266, -1, 268, -1, 270, -1, 272, 273,
- 274, 275, 276, 277, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
- 262, 263, 264, 265, 266, 267, 268, 269, 270, -1,
- 272, 273, 274, 275, 276, 277, 278, 279, 280, -1,
- 282, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 293, 294, -1, 296, 37, 38, -1, 40, -1,
- 42, 43, -1, 45, 46, 47, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 58, -1, 60, 61,
- 62, 63, 64, -1, -1, -1, -1, -1, -1, -1,
- 37, 38, -1, 40, -1, 42, 43, 42, 45, 46,
- 47, -1, -1, -1, -1, -1, -1, -1, -1, 91,
- -1, -1, 94, 60, 61, 62, 63, 64, -1, -1,
- -1, -1, -1, -1, -1, 37, 38, -1, 40, -1,
- 42, 43, -1, 45, 46, 47, 42, -1, -1, -1,
- -1, -1, 124, -1, 91, -1, -1, 94, 60, -1,
- 62, 63, 64, 37, 38, -1, 40, -1, 42, 43,
- -1, 45, 46, 47, 37, 38, -1, 40, -1, 42,
- 43, -1, 45, 46, 47, -1, 60, 124, 62, 91,
- 64, -1, 94, -1, -1, -1, -1, 60, -1, 62,
- -1, 64, 37, 38, -1, 40, -1, 42, 43, -1,
- 45, 46, 47, -1, -1, -1, -1, 91, -1, -1,
- 94, -1, 124, -1, -1, 60, -1, 62, 91, 64,
- -1, 94, -1, -1, -1, 37, 38, -1, 40, -1,
- 42, 43, -1, 45, 46, 47, 41, -1, -1, -1,
- 124, -1, -1, -1, -1, -1, 91, -1, 60, 94,
- 62, 124, 64, -1, -1, -1, -1, -1, -1, -1,
- 37, -1, -1, 40, -1, 42, 43, -1, 45, 46,
- 47, -1, -1, -1, -1, -1, -1, -1, -1, 91,
- -1, -1, -1, 60, -1, 62, -1, 64, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 281,
- -1, -1, 284, 285, 286, 287, 288, 289, 290, 291,
- -1, 293, 294, 295, 91, 260, 261, 262, 263, 264,
- 265, 266, -1, 268, -1, 270, -1, 272, 273, 274,
- 275, 276, 277, -1, 281, -1, -1, 284, 285, 286,
- 287, 288, 289, 290, 291, -1, 293, 294, 295, -1,
- -1, 296, -1, -1, 260, 261, 262, 263, 264, 265,
- 266, -1, 268, -1, 270, -1, 272, 273, 274, 275,
- 276, 277, 284, 285, 286, 287, 288, 289, 290, 291,
- -1, 293, 294, 295, -1, -1, -1, -1, -1, -1,
- 296, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 285, 286, 287, 288, 289, 290, 291, -1, 293,
- 294, 295, -1, 286, 287, 288, 289, 290, 291, -1,
- 293, 294, 295, -1, -1, -1, -1, -1, -1, -1,
- 37, -1, -1, 40, -1, 42, 43, -1, 45, 46,
- 47, 286, 287, 288, 289, 290, 291, -1, 293, 294,
- 295, -1, -1, 60, -1, 62, 261, 64, 263, 264,
- 265, 266, -1, 268, -1, 270, -1, 272, 273, 274,
- 275, 276, 277, 11, 286, 287, 288, 289, 290, 291,
- -1, 293, 294, 295, 91, -1, -1, 25, 26, 27,
- 28, 29, -1, -1, 32, 33, -1, -1, -1, -1,
- -1, -1, -1, 41, -1, -1, -1, -1, -1, 286,
- 287, 288, 289, 290, 291, -1, 293, 294, 295, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 82, 83, 84, 85, 86, 87,
- 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
- 98, 99, 100, 101, 102, 103, -1, -1, -1, -1,
- -1, -1, 110, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 135, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 159, -1, -1, 162, -1, -1, -1, 166, -1,
- -1, 169, 170, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 191, -1, -1, -1, 195, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 288, 289, 290, 291, -1, 293, 294, 295,
-};
-#define YYFINAL 35
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 296
-#if YYDEBUG
-char *c_name[] = {
-"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-"'!'",0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",0,0,0,
-0,0,0,0,0,0,0,"':'",0,"'<'","'='","'>'","'?'","'@'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,"'['",0,"']'","'^'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,"'{'","'|'","'}'","'~'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"INT","FLOAT",
-"STRING","NAME","TYPENAME","NAME_OR_INT","STRUCT","CLASS","UNION","ENUM",
-"SIZEOF","UNSIGNED","COLONCOLON","TEMPLATE","ERROR","SIGNED_KEYWORD","LONG",
-"SHORT","INT_KEYWORD","CONST_KEYWORD","VOLATILE_KEYWORD","LAST","REGNAME",
-"VARIABLE","ASSIGN_MODIFY","THIS","ABOVE_COMMA","OROR","ANDAND","EQUAL",
-"NOTEQUAL","LEQ","GEQ","LSH","RSH","UNARY","INCREMENT","DECREMENT","ARROW",
-"BLOCKNAME",
-};
-char *c_rule[] = {
-"$accept : start",
-"start : exp1",
-"start : type_exp",
-"type_exp : type",
-"exp1 : exp",
-"exp1 : exp1 ',' exp",
-"exp : '*' exp",
-"exp : '&' exp",
-"exp : '-' exp",
-"exp : '!' exp",
-"exp : '~' exp",
-"exp : INCREMENT exp",
-"exp : DECREMENT exp",
-"exp : exp INCREMENT",
-"exp : exp DECREMENT",
-"exp : SIZEOF exp",
-"exp : exp ARROW name",
-"exp : exp ARROW qualified_name",
-"exp : exp ARROW '*' exp",
-"exp : exp '.' name",
-"exp : exp '.' qualified_name",
-"exp : exp '.' '*' exp",
-"exp : exp '[' exp1 ']'",
-"$$1 :",
-"exp : exp '(' $$1 arglist ')'",
-"lcurly : '{'",
-"arglist :",
-"arglist : exp",
-"arglist : arglist ',' exp",
-"rcurly : '}'",
-"exp : lcurly arglist rcurly",
-"exp : lcurly type rcurly exp",
-"exp : '(' type ')' exp",
-"exp : '(' exp1 ')'",
-"exp : exp '@' exp",
-"exp : exp '*' exp",
-"exp : exp '/' exp",
-"exp : exp '%' exp",
-"exp : exp '+' exp",
-"exp : exp '-' exp",
-"exp : exp LSH exp",
-"exp : exp RSH exp",
-"exp : exp EQUAL exp",
-"exp : exp NOTEQUAL exp",
-"exp : exp LEQ exp",
-"exp : exp GEQ exp",
-"exp : exp '<' exp",
-"exp : exp '>' exp",
-"exp : exp '&' exp",
-"exp : exp '^' exp",
-"exp : exp '|' exp",
-"exp : exp ANDAND exp",
-"exp : exp OROR exp",
-"exp : exp '?' exp ':' exp",
-"exp : exp '=' exp",
-"exp : exp ASSIGN_MODIFY exp",
-"exp : INT",
-"exp : NAME_OR_INT",
-"exp : FLOAT",
-"exp : variable",
-"exp : LAST",
-"exp : REGNAME",
-"exp : VARIABLE",
-"exp : SIZEOF '(' type ')'",
-"exp : STRING",
-"exp : THIS",
-"block : BLOCKNAME",
-"block : block COLONCOLON name",
-"variable : block COLONCOLON name",
-"qualified_name : typebase COLONCOLON name",
-"qualified_name : typebase COLONCOLON '~' name",
-"variable : qualified_name",
-"variable : COLONCOLON name",
-"variable : name_not_typename",
-"ptype : typebase",
-"ptype : typebase CONST_KEYWORD",
-"ptype : typebase VOLATILE_KEYWORD",
-"ptype : typebase abs_decl",
-"ptype : typebase CONST_KEYWORD abs_decl",
-"ptype : typebase VOLATILE_KEYWORD abs_decl",
-"abs_decl : '*'",
-"abs_decl : '*' abs_decl",
-"abs_decl : '&'",
-"abs_decl : '&' abs_decl",
-"abs_decl : direct_abs_decl",
-"direct_abs_decl : '(' abs_decl ')'",
-"direct_abs_decl : direct_abs_decl array_mod",
-"direct_abs_decl : array_mod",
-"direct_abs_decl : direct_abs_decl func_mod",
-"direct_abs_decl : func_mod",
-"array_mod : '[' ']'",
-"array_mod : '[' INT ']'",
-"func_mod : '(' ')'",
-"func_mod : '(' nonempty_typelist ')'",
-"type : ptype",
-"type : typebase COLONCOLON '*'",
-"type : type '(' typebase COLONCOLON '*' ')'",
-"type : type '(' typebase COLONCOLON '*' ')' '(' ')'",
-"type : type '(' typebase COLONCOLON '*' ')' '(' nonempty_typelist ')'",
-"typebase : TYPENAME",
-"typebase : INT_KEYWORD",
-"typebase : LONG",
-"typebase : SHORT",
-"typebase : LONG INT_KEYWORD",
-"typebase : UNSIGNED LONG INT_KEYWORD",
-"typebase : LONG LONG",
-"typebase : LONG LONG INT_KEYWORD",
-"typebase : UNSIGNED LONG LONG",
-"typebase : UNSIGNED LONG LONG INT_KEYWORD",
-"typebase : SHORT INT_KEYWORD",
-"typebase : UNSIGNED SHORT INT_KEYWORD",
-"typebase : STRUCT name",
-"typebase : CLASS name",
-"typebase : UNION name",
-"typebase : ENUM name",
-"typebase : UNSIGNED typename",
-"typebase : UNSIGNED",
-"typebase : SIGNED_KEYWORD typename",
-"typebase : SIGNED_KEYWORD",
-"typebase : TEMPLATE name '<' type '>'",
-"typebase : CONST_KEYWORD typebase",
-"typebase : VOLATILE_KEYWORD typebase",
-"typename : TYPENAME",
-"typename : INT_KEYWORD",
-"typename : LONG",
-"typename : SHORT",
-"nonempty_typelist : type",
-"nonempty_typelist : nonempty_typelist ',' type",
-"name : NAME",
-"name : BLOCKNAME",
-"name : TYPENAME",
-"name : NAME_OR_INT",
-"name_not_typename : NAME",
-"name_not_typename : BLOCKNAME",
-};
-#endif
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 500
-#define YYMAXDEPTH 500
-#endif
-#endif
-int yydebug;
-int yynerrs;
-int yyerrflag;
-int yychar;
-short *yyssp;
-YYSTYPE *yyvsp;
-YYSTYPE yyval;
-YYSTYPE yylval;
-short yyss[YYSTACKSIZE];
-YYSTYPE yyvs[YYSTACKSIZE];
-#define yystacksize YYSTACKSIZE
-#line 914 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-
-/* Take care of parsing a number (anything that starts with a digit).
- Set yylval and return the token type; update lexptr.
- LEN is the number of characters in it. */
-
-/*** Needs some error checking for the float case ***/
-
-static int
-parse_number (p, len, parsed_float, putithere)
- register char *p;
- register int len;
- int parsed_float;
- YYSTYPE *putithere;
-{
- register LONGEST n = 0;
- register LONGEST prevn = 0;
- register int i = 0;
- register int c;
- register int base = input_radix;
- int unsigned_p = 0;
- int long_p = 0;
- unsigned LONGEST high_bit;
- struct type *signed_type;
- struct type *unsigned_type;
-
- if (parsed_float)
- {
- /* It's a float since it contains a point or an exponent. */
- putithere->dval = atof (p);
- return FLOAT;
- }
-
- /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
- if (p[0] == '0')
- switch (p[1])
- {
- case 'x':
- case 'X':
- if (len >= 3)
- {
- p += 2;
- base = 16;
- len -= 2;
- }
- break;
-
- case 't':
- case 'T':
- case 'd':
- case 'D':
- if (len >= 3)
- {
- p += 2;
- base = 10;
- len -= 2;
- }
- break;
-
- default:
- base = 8;
- break;
- }
-
- while (len-- > 0)
- {
- c = *p++;
- if (c >= 'A' && c <= 'Z')
- c += 'a' - 'A';
- if (c != 'l' && c != 'u')
- n *= base;
- if (c >= '0' && c <= '9')
- n += i = c - '0';
- else
- {
- if (base > 10 && c >= 'a' && c <= 'f')
- n += i = c - 'a' + 10;
- else if (len == 0 && c == 'l')
- long_p = 1;
- else if (len == 0 && c == 'u')
- unsigned_p = 1;
- else
- return ERROR; /* Char not a digit */
- }
- if (i >= base)
- return ERROR; /* Invalid digit in this base */
-
- /* Portably test for overflow (only works for nonzero values, so make
- a second check for zero). */
- if((prevn >= n) && n != 0)
- unsigned_p=1; /* Try something unsigned */
- /* If range checking enabled, portably test for unsigned overflow. */
- if(RANGE_CHECK && n!=0)
- {
- if((unsigned_p && (unsigned)prevn >= (unsigned)n))
- range_error("Overflow on numeric constant.");
- }
- prevn=n;
- }
-
- /* If the number is too big to be an int, or it's got an l suffix
- then it's a long. Work out if this has to be a long by
- shifting right and and seeing if anything remains, and the
- target int size is different to the target long size.
-
- In the expression below, we could have tested
- (n >> TARGET_INT_BIT)
- to see if it was zero,
- but too many compilers warn about that, when ints and longs
- are the same size. So we shift it twice, with fewer bits
- each time, for the same result. */
-
- if ( (TARGET_INT_BIT != TARGET_LONG_BIT
- && ((n >> 2) >> (TARGET_INT_BIT-2))) /* Avoid shift warning */
- || long_p)
- {
- high_bit = ((unsigned LONGEST)1) << (TARGET_LONG_BIT-1);
- unsigned_type = builtin_type_unsigned_long;
- signed_type = builtin_type_long;
- }
- else
- {
- high_bit = ((unsigned LONGEST)1) << (TARGET_INT_BIT-1);
- unsigned_type = builtin_type_unsigned_int;
- signed_type = builtin_type_int;
- }
-
- putithere->typed_val.val = n;
-
- /* If the high bit of the worked out type is set then this number
- has to be unsigned. */
-
- if (unsigned_p || (n & high_bit))
- {
- putithere->typed_val.type = unsigned_type;
- }
- else
- {
- putithere->typed_val.type = signed_type;
- }
-
- return INT;
-}
-
-struct token
-{
- char *operator;
- int token;
- enum exp_opcode opcode;
-};
-
-static const struct token tokentab3[] =
- {
- {">>=", ASSIGN_MODIFY, BINOP_RSH},
- {"<<=", ASSIGN_MODIFY, BINOP_LSH}
- };
-
-static const struct token tokentab2[] =
- {
- {"+=", ASSIGN_MODIFY, BINOP_ADD},
- {"-=", ASSIGN_MODIFY, BINOP_SUB},
- {"*=", ASSIGN_MODIFY, BINOP_MUL},
- {"/=", ASSIGN_MODIFY, BINOP_DIV},
- {"%=", ASSIGN_MODIFY, BINOP_REM},
- {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
- {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
- {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
- {"++", INCREMENT, BINOP_END},
- {"--", DECREMENT, BINOP_END},
- {"->", ARROW, BINOP_END},
- {"&&", ANDAND, BINOP_END},
- {"||", OROR, BINOP_END},
- {"::", COLONCOLON, BINOP_END},
- {"<<", LSH, BINOP_END},
- {">>", RSH, BINOP_END},
- {"==", EQUAL, BINOP_END},
- {"!=", NOTEQUAL, BINOP_END},
- {"<=", LEQ, BINOP_END},
- {">=", GEQ, BINOP_END}
- };
-
-/* Read one token, getting characters through lexptr. */
-
-static int
-yylex ()
-{
- int c;
- int namelen;
- unsigned int i;
- char *tokstart;
- char *tokptr;
- int tempbufindex;
- static char *tempbuf;
- static int tempbufsize;
-
- retry:
-
- tokstart = lexptr;
- /* See if it is a special token of length 3. */
- for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
- if (STREQN (tokstart, tokentab3[i].operator, 3))
- {
- lexptr += 3;
- yylval.opcode = tokentab3[i].opcode;
- return tokentab3[i].token;
- }
-
- /* See if it is a special token of length 2. */
- for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
- if (STREQN (tokstart, tokentab2[i].operator, 2))
- {
- lexptr += 2;
- yylval.opcode = tokentab2[i].opcode;
- return tokentab2[i].token;
- }
-
- switch (c = *tokstart)
- {
- case 0:
- return 0;
-
- case ' ':
- case '\t':
- case '\n':
- lexptr++;
- goto retry;
-
- case '\'':
- /* We either have a character constant ('0' or '\177' for example)
- or we have a quoted symbol reference ('foo(int,int)' in C++
- for example). */
- lexptr++;
- c = *lexptr++;
- if (c == '\\')
- c = parse_escape (&lexptr);
-
- yylval.typed_val.val = c;
- yylval.typed_val.type = builtin_type_char;
-
- c = *lexptr++;
- if (c != '\'')
- {
- namelen = skip_quoted (tokstart) - tokstart;
- if (namelen > 2)
- {
- lexptr = tokstart + namelen;
- if (lexptr[-1] != '\'')
- error ("Unmatched single quote.");
- namelen -= 2;
- tokstart++;
- goto tryname;
- }
- error ("Invalid character constant.");
- }
- return INT;
-
- case '(':
- paren_depth++;
- lexptr++;
- return c;
-
- case ')':
- if (paren_depth == 0)
- return 0;
- paren_depth--;
- lexptr++;
- return c;
-
- case ',':
- if (comma_terminates && paren_depth == 0)
- return 0;
- lexptr++;
- return c;
-
- case '.':
- /* Might be a floating point number. */
- if (lexptr[1] < '0' || lexptr[1] > '9')
- goto symbol; /* Nope, must be a symbol. */
- /* FALL THRU into number case. */
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- {
- /* It's a number. */
- int got_dot = 0, got_e = 0, toktype;
- register char *p = tokstart;
- int hex = input_radix > 10;
-
- if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
- {
- p += 2;
- hex = 1;
- }
- else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
- {
- p += 2;
- hex = 0;
- }
-
- for (;; ++p)
- {
- /* This test includes !hex because 'e' is a valid hex digit
- and thus does not indicate a floating point number when
- the radix is hex. */
- if (!hex && !got_e && (*p == 'e' || *p == 'E'))
- got_dot = got_e = 1;
- /* This test does not include !hex, because a '.' always indicates
- a decimal floating point number regardless of the radix. */
- else if (!got_dot && *p == '.')
- got_dot = 1;
- else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
- && (*p == '-' || *p == '+'))
- /* This is the sign of the exponent, not the end of the
- number. */
- continue;
- /* We will take any letters or digits. parse_number will
- complain if past the radix, or if L or U are not final. */
- else if ((*p < '0' || *p > '9')
- && ((*p < 'a' || *p > 'z')
- && (*p < 'A' || *p > 'Z')))
- break;
- }
- toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
- if (toktype == ERROR)
- {
- char *err_copy = (char *) alloca (p - tokstart + 1);
-
- memcpy (err_copy, tokstart, p - tokstart);
- err_copy[p - tokstart] = 0;
- error ("Invalid number \"%s\".", err_copy);
- }
- lexptr = p;
- return toktype;
- }
-
- case '+':
- case '-':
- case '*':
- case '/':
- case '%':
- case '|':
- case '&':
- case '^':
- case '~':
- case '!':
- case '@':
- case '<':
- case '>':
- case '[':
- case ']':
- case '?':
- case ':':
- case '=':
- case '{':
- case '}':
- symbol:
- lexptr++;
- return c;
-
- case '"':
-
- /* Build the gdb internal form of the input string in tempbuf,
- translating any standard C escape forms seen. Note that the
- buffer is null byte terminated *only* for the convenience of
- debugging gdb itself and printing the buffer contents when
- the buffer contains no embedded nulls. Gdb does not depend
- upon the buffer being null byte terminated, it uses the length
- string instead. This allows gdb to handle C strings (as well
- as strings in other languages) with embedded null bytes */
-
- tokptr = ++tokstart;
- tempbufindex = 0;
-
- do {
- /* Grow the static temp buffer if necessary, including allocating
- the first one on demand. */
- if (tempbufindex + 1 >= tempbufsize)
- {
- tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
- }
- switch (*tokptr)
- {
- case '\0':
- case '"':
- /* Do nothing, loop will terminate. */
- break;
- case '\\':
- tokptr++;
- c = parse_escape (&tokptr);
- if (c == -1)
- {
- continue;
- }
- tempbuf[tempbufindex++] = c;
- break;
- default:
- tempbuf[tempbufindex++] = *tokptr++;
- break;
- }
- } while ((*tokptr != '"') && (*tokptr != '\0'));
- if (*tokptr++ != '"')
- {
- error ("Unterminated string in expression.");
- }
- tempbuf[tempbufindex] = '\0'; /* See note above */
- yylval.sval.ptr = tempbuf;
- yylval.sval.length = tempbufindex;
- lexptr = tokptr;
- return (STRING);
- }
-
- if (!(c == '_' || c == '$'
- || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
- /* We must have come across a bad character (e.g. ';'). */
- error ("Invalid character '%c' in expression.", c);
-
- /* It's a name. See how long it is. */
- namelen = 0;
- for (c = tokstart[namelen];
- (c == '_' || c == '$' || (c >= '0' && c <= '9')
- || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
- c = tokstart[++namelen])
- ;
-
- /* The token "if" terminates the expression and is NOT
- removed from the input stream. */
- if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
- {
- return 0;
- }
-
- lexptr += namelen;
-
- /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
- and $$digits (equivalent to $<-digits> if you could type that).
- Make token type LAST, and put the number (the digits) in yylval. */
-
- tryname:
- if (*tokstart == '$')
- {
- register int negate = 0;
- c = 1;
- /* Double dollar means negate the number and add -1 as well.
- Thus $$ alone means -1. */
- if (namelen >= 2 && tokstart[1] == '$')
- {
- negate = 1;
- c = 2;
- }
- if (c == namelen)
- {
- /* Just dollars (one or two) */
- yylval.lval = - negate;
- return LAST;
- }
- /* Is the rest of the token digits? */
- for (; c < namelen; c++)
- if (!(tokstart[c] >= '0' && tokstart[c] <= '9'))
- break;
- if (c == namelen)
- {
- yylval.lval = atoi (tokstart + 1 + negate);
- if (negate)
- yylval.lval = - yylval.lval;
- return LAST;
- }
- }
-
- /* Handle tokens that refer to machine registers:
- $ followed by a register name. */
-
- if (*tokstart == '$') {
- for (c = 0; c < NUM_REGS; c++)
- if (namelen - 1 == strlen (reg_names[c])
- && STREQN (tokstart + 1, reg_names[c], namelen - 1))
- {
- yylval.lval = c;
- return REGNAME;
- }
- for (c = 0; c < num_std_regs; c++)
- if (namelen - 1 == strlen (std_regs[c].name)
- && STREQN (tokstart + 1, std_regs[c].name, namelen - 1))
- {
- yylval.lval = std_regs[c].regnum;
- return REGNAME;
- }
- }
- /* Catch specific keywords. Should be done with a data structure. */
- switch (namelen)
- {
- case 8:
- if (STREQN (tokstart, "unsigned", 8))
- return UNSIGNED;
- if (current_language->la_language == language_cplus
- && STREQN (tokstart, "template", 8))
- return TEMPLATE;
- if (STREQN (tokstart, "volatile", 8))
- return VOLATILE_KEYWORD;
- break;
- case 6:
- if (STREQN (tokstart, "struct", 6))
- return STRUCT;
- if (STREQN (tokstart, "signed", 6))
- return SIGNED_KEYWORD;
- if (STREQN (tokstart, "sizeof", 6))
- return SIZEOF;
- break;
- case 5:
- if (current_language->la_language == language_cplus
- && STREQN (tokstart, "class", 5))
- return CLASS;
- if (STREQN (tokstart, "union", 5))
- return UNION;
- if (STREQN (tokstart, "short", 5))
- return SHORT;
- if (STREQN (tokstart, "const", 5))
- return CONST_KEYWORD;
- break;
- case 4:
- if (STREQN (tokstart, "enum", 4))
- return ENUM;
- if (STREQN (tokstart, "long", 4))
- return LONG;
- if (current_language->la_language == language_cplus
- && STREQN (tokstart, "this", 4))
- {
- static const char this_name[] =
- { CPLUS_MARKER, 't', 'h', 'i', 's', '\0' };
-
- if (lookup_symbol (this_name, expression_context_block,
- VAR_NAMESPACE, (int *) NULL,
- (struct symtab **) NULL))
- return THIS;
- }
- break;
- case 3:
- if (STREQN (tokstart, "int", 3))
- return INT_KEYWORD;
- break;
- default:
- break;
- }
-
- yylval.sval.ptr = tokstart;
- yylval.sval.length = namelen;
-
- /* Any other names starting in $ are debugger internal variables. */
-
- if (*tokstart == '$')
- {
- yylval.ivar = lookup_internalvar (copy_name (yylval.sval) + 1);
- return VARIABLE;
- }
-
- /* Use token-type BLOCKNAME for symbols that happen to be defined as
- functions or symtabs. If this is not so, then ...
- Use token-type TYPENAME for symbols that happen to be defined
- currently as names of types; NAME for other symbols.
- The caller is not constrained to care about the distinction. */
- {
- char *tmp = copy_name (yylval.sval);
- struct symbol *sym;
- int is_a_field_of_this = 0;
- int hextype;
-
- sym = lookup_symbol (tmp, expression_context_block,
- VAR_NAMESPACE,
- current_language->la_language == language_cplus
- ? &is_a_field_of_this : (int *) NULL,
- (struct symtab **) NULL);
- if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) ||
- lookup_partial_symtab (tmp))
- {
- yylval.ssym.sym = sym;
- yylval.ssym.is_a_field_of_this = is_a_field_of_this;
- return BLOCKNAME;
- }
- if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
- {
- char *p;
- char *namestart;
- struct symbol *best_sym;
-
- /* Look ahead to detect nested types. This probably should be
- done in the grammar, but trying seemed to introduce a lot
- of shift/reduce and reduce/reduce conflicts. It's possible
- that it could be done, though. Or perhaps a non-grammar, but
- less ad hoc, approach would work well. */
-
- /* Since we do not currently have any way of distinguishing
- a nested type from a non-nested one (the stabs don't tell
- us whether a type is nested), we just ignore the
- containing type. */
-
- p = lexptr;
- best_sym = sym;
- while (1)
- {
- /* Skip whitespace. */
- while (*p == ' ' || *p == '\t' || *p == '\n')
- ++p;
- if (*p == ':' && p[1] == ':')
- {
- /* Skip the `::'. */
- p += 2;
- /* Skip whitespace. */
- while (*p == ' ' || *p == '\t' || *p == '\n')
- ++p;
- namestart = p;
- while (*p == '_' || *p == '$' || (*p >= '0' && *p <= '9')
- || (*p >= 'a' && *p <= 'z')
- || (*p >= 'A' && *p <= 'Z'))
- ++p;
- if (p != namestart)
- {
- struct symbol *cur_sym;
- /* As big as the whole rest of the expression, which is
- at least big enough. */
- char *tmp = alloca (strlen (namestart));
-
- memcpy (tmp, namestart, p - namestart);
- tmp[p - namestart] = '\0';
- cur_sym = lookup_symbol (tmp, expression_context_block,
- VAR_NAMESPACE, (int *) NULL,
- (struct symtab **) NULL);
- if (cur_sym)
- {
- if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF)
- {
- best_sym = cur_sym;
- lexptr = p;
- }
- else
- break;
- }
- else
- break;
- }
- else
- break;
- }
- else
- break;
- }
-
- yylval.tsym.type = SYMBOL_TYPE (best_sym);
- return TYPENAME;
- }
- if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
- return TYPENAME;
-
- /* Input names that aren't symbols but ARE valid hex numbers,
- when the input radix permits them, can be names or numbers
- depending on the parse. Note we support radixes > 16 here. */
- if (!sym &&
- ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
- (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
- {
- YYSTYPE newlval; /* Its value is ignored. */
- hextype = parse_number (tokstart, namelen, 0, &newlval);
- if (hextype == INT)
- {
- yylval.ssym.sym = sym;
- yylval.ssym.is_a_field_of_this = is_a_field_of_this;
- return NAME_OR_INT;
- }
- }
-
- /* Any other kind of symbol */
- yylval.ssym.sym = sym;
- yylval.ssym.is_a_field_of_this = is_a_field_of_this;
- return NAME;
- }
-}
-
-void
-yyerror (msg)
- char *msg;
-{
- error (msg ? msg : "Invalid syntax in expression.");
-}
-#line 1706 "y.tab.c"
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-int
-yyparse()
-{
- register int yym, yyn, yystate;
-#if YYDEBUG
- register char *yys;
- extern char *getenv();
-
- if (yys = getenv("YYDEBUG"))
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = (-1);
-
- yyssp = yyss;
- yyvsp = yyvs;
- *yyssp = yystate = 0;
-
-yyloop:
- if (yyn = yydefred[yystate]) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = yylex()) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
- yychar = (-1);
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-#ifdef lint
- goto yynewerror;
-#endif
-yynewerror:
- yyerror("syntax error");
-#ifdef lint
- goto yyerrlab;
-#endif
-yyerrlab:
- ++yynerrs;
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
-#endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yyssp);
-#endif
- if (yyssp <= yyss) goto yyabort;
- --yyssp;
- --yyvsp;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = (-1);
- goto yyloop;
- }
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- yyval = yyvsp[1-yym];
- switch (yyn)
- {
-case 3:
-#line 211 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode(OP_TYPE);
- write_exp_elt_type(yyvsp[0].tval);
- write_exp_elt_opcode(OP_TYPE);}
-break;
-case 5:
-#line 219 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_COMMA); }
-break;
-case 6:
-#line 224 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (UNOP_IND); }
-break;
-case 7:
-#line 227 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (UNOP_ADDR); }
-break;
-case 8:
-#line 230 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (UNOP_NEG); }
-break;
-case 9:
-#line 234 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
-break;
-case 10:
-#line 238 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (UNOP_COMPLEMENT); }
-break;
-case 11:
-#line 242 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (UNOP_PREINCREMENT); }
-break;
-case 12:
-#line 246 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (UNOP_PREDECREMENT); }
-break;
-case 13:
-#line 250 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (UNOP_POSTINCREMENT); }
-break;
-case 14:
-#line 254 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (UNOP_POSTDECREMENT); }
-break;
-case 15:
-#line 258 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (UNOP_SIZEOF); }
-break;
-case 16:
-#line 262 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (STRUCTOP_PTR);
- write_exp_string (yyvsp[0].sval);
- write_exp_elt_opcode (STRUCTOP_PTR); }
-break;
-case 17:
-#line 268 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ /* exp->type::name becomes exp->*(&type::name) */
- /* Note: this doesn't work if name is a
- static member! FIXME */
- write_exp_elt_opcode (UNOP_ADDR);
- write_exp_elt_opcode (STRUCTOP_MPTR); }
-break;
-case 18:
-#line 275 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (STRUCTOP_MPTR); }
-break;
-case 19:
-#line 279 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (STRUCTOP_STRUCT);
- write_exp_string (yyvsp[0].sval);
- write_exp_elt_opcode (STRUCTOP_STRUCT); }
-break;
-case 20:
-#line 285 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ /* exp.type::name becomes exp.*(&type::name) */
- /* Note: this doesn't work if name is a
- static member! FIXME */
- write_exp_elt_opcode (UNOP_ADDR);
- write_exp_elt_opcode (STRUCTOP_MEMBER); }
-break;
-case 21:
-#line 293 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (STRUCTOP_MEMBER); }
-break;
-case 22:
-#line 297 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_SUBSCRIPT); }
-break;
-case 23:
-#line 303 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ start_arglist (); }
-break;
-case 24:
-#line 305 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (OP_FUNCALL);
- write_exp_elt_longcst ((LONGEST) end_arglist ());
- write_exp_elt_opcode (OP_FUNCALL); }
-break;
-case 25:
-#line 311 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ start_arglist (); }
-break;
-case 27:
-#line 318 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ arglist_len = 1; }
-break;
-case 28:
-#line 322 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ arglist_len++; }
-break;
-case 29:
-#line 326 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.lval = end_arglist () - 1; }
-break;
-case 30:
-#line 329 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (OP_ARRAY);
- write_exp_elt_longcst ((LONGEST) 0);
- write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
- write_exp_elt_opcode (OP_ARRAY); }
-break;
-case 31:
-#line 336 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (UNOP_MEMVAL);
- write_exp_elt_type (yyvsp[-2].tval);
- write_exp_elt_opcode (UNOP_MEMVAL); }
-break;
-case 32:
-#line 342 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (UNOP_CAST);
- write_exp_elt_type (yyvsp[-2].tval);
- write_exp_elt_opcode (UNOP_CAST); }
-break;
-case 33:
-#line 348 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ }
-break;
-case 34:
-#line 354 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_REPEAT); }
-break;
-case 35:
-#line 358 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_MUL); }
-break;
-case 36:
-#line 362 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_DIV); }
-break;
-case 37:
-#line 366 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_REM); }
-break;
-case 38:
-#line 370 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_ADD); }
-break;
-case 39:
-#line 374 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_SUB); }
-break;
-case 40:
-#line 378 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_LSH); }
-break;
-case 41:
-#line 382 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_RSH); }
-break;
-case 42:
-#line 386 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_EQUAL); }
-break;
-case 43:
-#line 390 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_NOTEQUAL); }
-break;
-case 44:
-#line 394 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_LEQ); }
-break;
-case 45:
-#line 398 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_GEQ); }
-break;
-case 46:
-#line 402 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_LESS); }
-break;
-case 47:
-#line 406 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_GTR); }
-break;
-case 48:
-#line 410 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_BITWISE_AND); }
-break;
-case 49:
-#line 414 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_BITWISE_XOR); }
-break;
-case 50:
-#line 418 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_BITWISE_IOR); }
-break;
-case 51:
-#line 422 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_LOGICAL_AND); }
-break;
-case 52:
-#line 426 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_LOGICAL_OR); }
-break;
-case 53:
-#line 430 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (TERNOP_COND); }
-break;
-case 54:
-#line 434 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_ASSIGN); }
-break;
-case 55:
-#line 438 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
- write_exp_elt_opcode (yyvsp[-1].opcode);
- write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
-break;
-case 56:
-#line 444 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (yyvsp[0].typed_val.type);
- write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val.val));
- write_exp_elt_opcode (OP_LONG); }
-break;
-case 57:
-#line 451 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ YYSTYPE val;
- parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (val.typed_val.type);
- write_exp_elt_longcst ((LONGEST)val.typed_val.val);
- write_exp_elt_opcode (OP_LONG);
- }
-break;
-case 58:
-#line 462 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (OP_DOUBLE);
- write_exp_elt_type (builtin_type_double);
- write_exp_elt_dblcst (yyvsp[0].dval);
- write_exp_elt_opcode (OP_DOUBLE); }
-break;
-case 60:
-#line 472 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (OP_LAST);
- write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
- write_exp_elt_opcode (OP_LAST); }
-break;
-case 61:
-#line 478 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (OP_REGISTER);
- write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
- write_exp_elt_opcode (OP_REGISTER); }
-break;
-case 62:
-#line 484 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (OP_INTERNALVAR);
- write_exp_elt_intern (yyvsp[0].ivar);
- write_exp_elt_opcode (OP_INTERNALVAR); }
-break;
-case 63:
-#line 490 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_int);
- write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
- write_exp_elt_opcode (OP_LONG); }
-break;
-case 64:
-#line 497 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ /* C strings are converted into array constants with
- an explicit null byte added at the end. Thus
- the array upper bound is the string length.
- There is no such thing in C as a completely empty
- string. */
- char *sp = yyvsp[0].sval.ptr; int count = yyvsp[0].sval.length;
- while (count-- > 0)
- {
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_char);
- write_exp_elt_longcst ((LONGEST)(*sp++));
- write_exp_elt_opcode (OP_LONG);
- }
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_char);
- write_exp_elt_longcst ((LONGEST)'\0');
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_opcode (OP_ARRAY);
- write_exp_elt_longcst ((LONGEST) 0);
- write_exp_elt_longcst ((LONGEST) (yyvsp[0].sval.length));
- write_exp_elt_opcode (OP_ARRAY); }
-break;
-case 65:
-#line 522 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ write_exp_elt_opcode (OP_THIS);
- write_exp_elt_opcode (OP_THIS); }
-break;
-case 66:
-#line 529 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{
- if (yyvsp[0].ssym.sym != 0)
- yyval.bval = SYMBOL_BLOCK_VALUE (yyvsp[0].ssym.sym);
- else
- {
- struct symtab *tem =
- lookup_symtab (copy_name (yyvsp[0].ssym.stoken));
- if (tem)
- yyval.bval = BLOCKVECTOR_BLOCK
- (BLOCKVECTOR (tem), STATIC_BLOCK);
- else
- error ("No file or function \"%s\".",
- copy_name (yyvsp[0].ssym.stoken));
- }
- }
-break;
-case 67:
-#line 547 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ struct symbol *tem
- = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
- VAR_NAMESPACE, (int *) NULL,
- (struct symtab **) NULL);
- if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
- error ("No function \"%s\" in specified context.",
- copy_name (yyvsp[0].sval));
- yyval.bval = SYMBOL_BLOCK_VALUE (tem); }
-break;
-case 68:
-#line 558 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ struct symbol *sym;
- sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
- VAR_NAMESPACE, (int *) NULL,
- (struct symtab **) NULL);
- if (sym == 0)
- error ("No symbol \"%s\" in specified context.",
- copy_name (yyvsp[0].sval));
-
- write_exp_elt_opcode (OP_VAR_VALUE);
- /* block_found is set by lookup_symbol. */
- write_exp_elt_block (block_found);
- write_exp_elt_sym (sym);
- write_exp_elt_opcode (OP_VAR_VALUE); }
-break;
-case 69:
-#line 574 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{
- struct type *type = yyvsp[-2].tval;
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION)
- error ("`%s' is not defined as an aggregate type.",
- TYPE_NAME (type));
-
- write_exp_elt_opcode (OP_SCOPE);
- write_exp_elt_type (type);
- write_exp_string (yyvsp[0].sval);
- write_exp_elt_opcode (OP_SCOPE);
- }
-break;
-case 70:
-#line 587 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{
- struct type *type = yyvsp[-3].tval;
- struct stoken tmp_token;
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION)
- error ("`%s' is not defined as an aggregate type.",
- TYPE_NAME (type));
-
- if (!STREQ (type_name_no_tag (type), yyvsp[0].sval.ptr))
- error ("invalid destructor `%s::~%s'",
- type_name_no_tag (type), yyvsp[0].sval.ptr);
-
- tmp_token.ptr = (char*) alloca (yyvsp[0].sval.length + 2);
- tmp_token.length = yyvsp[0].sval.length + 1;
- tmp_token.ptr[0] = '~';
- memcpy (tmp_token.ptr+1, yyvsp[0].sval.ptr, yyvsp[0].sval.length);
- tmp_token.ptr[tmp_token.length] = 0;
- write_exp_elt_opcode (OP_SCOPE);
- write_exp_elt_type (type);
- write_exp_string (tmp_token);
- write_exp_elt_opcode (OP_SCOPE);
- }
-break;
-case 72:
-#line 613 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{
- char *name = copy_name (yyvsp[0].sval);
- struct symbol *sym;
- struct minimal_symbol *msymbol;
-
- sym =
- lookup_symbol (name, (const struct block *) NULL,
- VAR_NAMESPACE, (int *) NULL,
- (struct symtab **) NULL);
- if (sym)
- {
- write_exp_elt_opcode (OP_VAR_VALUE);
- write_exp_elt_block (NULL);
- write_exp_elt_sym (sym);
- write_exp_elt_opcode (OP_VAR_VALUE);
- break;
- }
-
- msymbol = lookup_minimal_symbol (name,
- (struct objfile *) NULL);
- if (msymbol != NULL)
- {
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_long);
- write_exp_elt_longcst ((LONGEST) SYMBOL_VALUE_ADDRESS (msymbol));
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_opcode (UNOP_MEMVAL);
- if (msymbol -> type == mst_data ||
- msymbol -> type == mst_bss)
- write_exp_elt_type (builtin_type_int);
- else if (msymbol -> type == mst_text)
- write_exp_elt_type (lookup_function_type (builtin_type_int));
- else
- write_exp_elt_type (builtin_type_char);
- write_exp_elt_opcode (UNOP_MEMVAL);
- }
- else
- if (!have_full_symbols () && !have_partial_symbols ())
- error ("No symbol table is loaded. Use the \"file\" command.");
- else
- error ("No symbol \"%s\" in current context.", name);
- }
-break;
-case 73:
-#line 658 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ struct symbol *sym = yyvsp[0].ssym.sym;
-
- if (sym)
- {
- if (symbol_read_needs_frame (sym))
- {
- if (innermost_block == 0 ||
- contained_in (block_found,
- innermost_block))
- innermost_block = block_found;
- }
-
- write_exp_elt_opcode (OP_VAR_VALUE);
- /* We want to use the selected frame, not
- another more inner frame which happens to
- be in the same block. */
- write_exp_elt_block (NULL);
- write_exp_elt_sym (sym);
- write_exp_elt_opcode (OP_VAR_VALUE);
- }
- else if (yyvsp[0].ssym.is_a_field_of_this)
- {
- /* C++: it hangs off of `this'. Must
- not inadvertently convert from a method call
- to data ref. */
- if (innermost_block == 0 ||
- contained_in (block_found, innermost_block))
- innermost_block = block_found;
- write_exp_elt_opcode (OP_THIS);
- write_exp_elt_opcode (OP_THIS);
- write_exp_elt_opcode (STRUCTOP_PTR);
- write_exp_string (yyvsp[0].ssym.stoken);
- write_exp_elt_opcode (STRUCTOP_PTR);
- }
- else
- {
- struct minimal_symbol *msymbol;
- register char *arg = copy_name (yyvsp[0].ssym.stoken);
-
- msymbol = lookup_minimal_symbol (arg,
- (struct objfile *) NULL);
- if (msymbol != NULL)
- {
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_long);
- write_exp_elt_longcst ((LONGEST) SYMBOL_VALUE_ADDRESS (msymbol));
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_opcode (UNOP_MEMVAL);
- if (msymbol -> type == mst_data ||
- msymbol -> type == mst_bss)
- write_exp_elt_type (builtin_type_int);
- else if (msymbol -> type == mst_text)
- write_exp_elt_type (lookup_function_type (builtin_type_int));
- else
- write_exp_elt_type (builtin_type_char);
- write_exp_elt_opcode (UNOP_MEMVAL);
- }
- else if (!have_full_symbols () && !have_partial_symbols ())
- error ("No symbol table is loaded. Use the \"file\" command.");
- else
- error ("No symbol \"%s\" in current context.",
- copy_name (yyvsp[0].ssym.stoken));
- }
- }
-break;
-case 77:
-#line 737 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = follow_types (yyvsp[-1].tval); }
-break;
-case 78:
-#line 739 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = follow_types (yyvsp[-2].tval); }
-break;
-case 79:
-#line 741 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = follow_types (yyvsp[-2].tval); }
-break;
-case 80:
-#line 745 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ push_type (tp_pointer); yyval.voidval = 0; }
-break;
-case 81:
-#line 747 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; }
-break;
-case 82:
-#line 749 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ push_type (tp_reference); yyval.voidval = 0; }
-break;
-case 83:
-#line 751 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; }
-break;
-case 85:
-#line 756 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.voidval = yyvsp[-1].voidval; }
-break;
-case 86:
-#line 758 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{
- push_type_int (yyvsp[0].lval);
- push_type (tp_array);
- }
-break;
-case 87:
-#line 763 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{
- push_type_int (yyvsp[0].lval);
- push_type (tp_array);
- yyval.voidval = 0;
- }
-break;
-case 88:
-#line 773 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ push_type (tp_function); }
-break;
-case 89:
-#line 775 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ push_type (tp_function); }
-break;
-case 90:
-#line 779 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.lval = -1; }
-break;
-case 91:
-#line 781 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.lval = yyvsp[-1].typed_val.val; }
-break;
-case 92:
-#line 785 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 93:
-#line 787 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ free ((PTR)yyvsp[-1].tvec); yyval.voidval = 0; }
-break;
-case 95:
-#line 794 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = lookup_member_type (builtin_type_int, yyvsp[-2].tval); }
-break;
-case 96:
-#line 796 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = lookup_member_type (yyvsp[-5].tval, yyvsp[-3].tval); }
-break;
-case 97:
-#line 798 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = lookup_member_type
- (lookup_function_type (yyvsp[-7].tval), yyvsp[-5].tval); }
-break;
-case 98:
-#line 801 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = lookup_member_type
- (lookup_function_type (yyvsp[-8].tval), yyvsp[-6].tval);
- free ((PTR)yyvsp[-1].tvec); }
-break;
-case 99:
-#line 808 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = yyvsp[0].tsym.type; }
-break;
-case 100:
-#line 810 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = builtin_type_int; }
-break;
-case 101:
-#line 812 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = builtin_type_long; }
-break;
-case 102:
-#line 814 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = builtin_type_short; }
-break;
-case 103:
-#line 816 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = builtin_type_long; }
-break;
-case 104:
-#line 818 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = builtin_type_unsigned_long; }
-break;
-case 105:
-#line 820 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = builtin_type_long_long; }
-break;
-case 106:
-#line 822 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = builtin_type_long_long; }
-break;
-case 107:
-#line 824 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = builtin_type_unsigned_long_long; }
-break;
-case 108:
-#line 826 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = builtin_type_unsigned_long_long; }
-break;
-case 109:
-#line 828 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = builtin_type_short; }
-break;
-case 110:
-#line 830 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = builtin_type_unsigned_short; }
-break;
-case 111:
-#line 832 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
- expression_context_block); }
-break;
-case 112:
-#line 835 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
- expression_context_block); }
-break;
-case 113:
-#line 838 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = lookup_union (copy_name (yyvsp[0].sval),
- expression_context_block); }
-break;
-case 114:
-#line 841 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = lookup_enum (copy_name (yyvsp[0].sval),
- expression_context_block); }
-break;
-case 115:
-#line 844 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = lookup_unsigned_typename (TYPE_NAME(yyvsp[0].tsym.type)); }
-break;
-case 116:
-#line 846 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = builtin_type_unsigned_int; }
-break;
-case 117:
-#line 848 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = lookup_signed_typename (TYPE_NAME(yyvsp[0].tsym.type)); }
-break;
-case 118:
-#line 850 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = builtin_type_int; }
-break;
-case 119:
-#line 852 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = lookup_template_type(copy_name(yyvsp[-3].sval), yyvsp[-1].tval,
- expression_context_block);
- }
-break;
-case 120:
-#line 858 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = yyvsp[0].tval; }
-break;
-case 121:
-#line 859 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tval = yyvsp[0].tval; }
-break;
-case 123:
-#line 864 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{
- yyval.tsym.stoken.ptr = "int";
- yyval.tsym.stoken.length = 3;
- yyval.tsym.type = builtin_type_int;
- }
-break;
-case 124:
-#line 870 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{
- yyval.tsym.stoken.ptr = "long";
- yyval.tsym.stoken.length = 4;
- yyval.tsym.type = builtin_type_long;
- }
-break;
-case 125:
-#line 876 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{
- yyval.tsym.stoken.ptr = "short";
- yyval.tsym.stoken.length = 5;
- yyval.tsym.type = builtin_type_short;
- }
-break;
-case 126:
-#line 885 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.tvec = (struct type **) xmalloc (sizeof (struct type *) * 2);
- yyval.ivec[0] = 1; /* Number of types in vector */
- yyval.tvec[1] = yyvsp[0].tval;
- }
-break;
-case 127:
-#line 890 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ int len = sizeof (struct type *) * (++(yyvsp[-2].ivec[0]) + 1);
- yyval.tvec = (struct type **) xrealloc ((char *) yyvsp[-2].tvec, len);
- yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval;
- }
-break;
-case 128:
-#line 896 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.sval = yyvsp[0].ssym.stoken; }
-break;
-case 129:
-#line 897 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.sval = yyvsp[0].ssym.stoken; }
-break;
-case 130:
-#line 898 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.sval = yyvsp[0].tsym.stoken; }
-break;
-case 131:
-#line 899 "/usr/src/gnu/usr.bin/gdb/gdb/c-exp.y"
-{ yyval.sval = yyvsp[0].ssym.stoken; }
-break;
-#line 2593 "y.tab.c"
- }
- yyssp -= yym;
- yystate = *yyssp;
- yyvsp -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yyssp = YYFINAL;
- *++yyvsp = yyval;
- if (yychar < 0)
- {
- if ((yychar = yylex()) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yyssp, yystate);
-#endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate;
- *++yyvsp = yyval;
- goto yyloop;
-yyoverflow:
- yyerror("yacc stack overflow");
-yyabort:
- return (1);
-yyaccept:
- return (0);
-}
diff --git a/gnu/usr.bin/gdb/gdb/ch-exp.tab.c b/gnu/usr.bin/gdb/gdb/ch-exp.tab.c
deleted file mode 100644
index 7adab65..0000000
--- a/gnu/usr.bin/gdb/gdb/ch-exp.tab.c
+++ /dev/null
@@ -1,2854 +0,0 @@
-#ifndef lint
-static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define yyclearin (yychar=(-1))
-#define yyerrok (yyerrflag=0)
-#define YYRECOVERING (yyerrflag!=0)
-#define yyparse ch_parse
-#define yylex ch_lex
-#define yyerror ch_error
-#define yychar ch_char
-#define yyval ch_val
-#define yylval ch_lval
-#define yydebug ch_debug
-#define yynerrs ch_nerrs
-#define yyerrflag ch_errflag
-#define yyss ch_ss
-#define yyssp ch_ssp
-#define yyvs ch_vs
-#define yyvsp ch_vsp
-#define yylhs ch_lhs
-#define yylen ch_len
-#define yydefred ch_defred
-#define yydgoto ch_dgoto
-#define yysindex ch_sindex
-#define yyrindex ch_rindex
-#define yygindex ch_gindex
-#define yytable ch_table
-#define yycheck ch_check
-#define yyname ch_name
-#define yyrule ch_rule
-#define YYPREFIX "ch_"
-#line 55 "./ch-exp.y"
-
-#include "defs.h"
-#include <ctype.h>
-#include "expression.h"
-#include "language.h"
-#include "value.h"
-#include "parser-defs.h"
-#include "ch-lang.h"
-
-/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
- as well as gratuitiously global symbol names, so we can have multiple
- yacc generated parsers in gdb. Note that these are only the variables
- produced by yacc. If other parser generators (bison, byacc, etc) produce
- additional global names that conflict at link time, then those parser
- generators need to be fixed instead of adding those names to this list. */
-
-#define yymaxdepth chill_maxdepth
-#define yyparse chill_parse
-#define yylex chill_lex
-#define yyerror chill_error
-#define yylval chill_lval
-#define yychar chill_char
-#define yydebug chill_debug
-#define yypact chill_pact
-#define yyr1 chill_r1
-#define yyr2 chill_r2
-#define yydef chill_def
-#define yychk chill_chk
-#define yypgo chill_pgo
-#define yyact chill_act
-#define yyexca chill_exca
-#define yyerrflag chill_errflag
-#define yynerrs chill_nerrs
-#define yyps chill_ps
-#define yypv chill_pv
-#define yys chill_s
-#define yy_yys chill_yys
-#define yystate chill_state
-#define yytmp chill_tmp
-#define yyv chill_v
-#define yy_yyv chill_yyv
-#define yyval chill_val
-#define yylloc chill_lloc
-#define yyreds chill_reds /* With YYDEBUG defined */
-#define yytoks chill_toks /* With YYDEBUG defined */
-
-#ifndef YYDEBUG
-#define YYDEBUG 0 /* Default to no yydebug support */
-#endif
-
-int
-yyparse PARAMS ((void));
-
-static int
-yylex PARAMS ((void));
-
-void
-yyerror PARAMS ((char *));
-
-#line 120 "./ch-exp.y"
-typedef union
- {
- LONGEST lval;
- unsigned LONGEST ulval;
- struct {
- LONGEST val;
- struct type *type;
- } typed_val;
- double dval;
- struct symbol *sym;
- struct type *tval;
- struct stoken sval;
- struct ttype tsym;
- struct symtoken ssym;
- int voidval;
- struct block *bval;
- enum exp_opcode opcode;
- struct internalvar *ivar;
-
- struct type **tvec;
- int *ivec;
- } YYSTYPE;
-#line 119 "y.tab.c"
-#define FIXME_01 257
-#define FIXME_02 258
-#define FIXME_03 259
-#define FIXME_04 260
-#define FIXME_05 261
-#define FIXME_06 262
-#define FIXME_07 263
-#define FIXME_08 264
-#define FIXME_09 265
-#define FIXME_10 266
-#define FIXME_11 267
-#define FIXME_12 268
-#define FIXME_13 269
-#define FIXME_14 270
-#define FIXME_15 271
-#define FIXME_16 272
-#define FIXME_17 273
-#define FIXME_18 274
-#define FIXME_19 275
-#define FIXME_20 276
-#define FIXME_21 277
-#define FIXME_22 278
-#define FIXME_24 279
-#define FIXME_25 280
-#define FIXME_26 281
-#define FIXME_27 282
-#define FIXME_28 283
-#define FIXME_29 284
-#define FIXME_30 285
-#define INTEGER_LITERAL 286
-#define BOOLEAN_LITERAL 287
-#define CHARACTER_LITERAL 288
-#define FLOAT_LITERAL 289
-#define GENERAL_PROCEDURE_NAME 290
-#define LOCATION_NAME 291
-#define SET_LITERAL 292
-#define EMPTINESS_LITERAL 293
-#define CHARACTER_STRING_LITERAL 294
-#define BIT_STRING_LITERAL 295
-#define TYPENAME 296
-#define FIELD_NAME 297
-#define CASE 298
-#define OF 299
-#define ESAC 300
-#define LOGIOR 301
-#define ORIF 302
-#define LOGXOR 303
-#define LOGAND 304
-#define ANDIF 305
-#define NOTEQUAL 306
-#define GTR 307
-#define LEQ 308
-#define IN 309
-#define SLASH_SLASH 310
-#define MOD 311
-#define REM 312
-#define NOT 313
-#define POINTER 314
-#define RECEIVE 315
-#define UP 316
-#define IF 317
-#define THEN 318
-#define ELSE 319
-#define FI 320
-#define ELSIF 321
-#define ILLEGAL_TOKEN 322
-#define NUM 323
-#define PRED 324
-#define SUCC 325
-#define ABS 326
-#define CARD 327
-#define MAX_TOKEN 328
-#define MIN_TOKEN 329
-#define SIZE 330
-#define UPPER 331
-#define LOWER 332
-#define LENGTH 333
-#define GDB_REGNAME 334
-#define GDB_LAST 335
-#define GDB_VARIABLE 336
-#define GDB_ASSIGNMENT 337
-#define YYERRCODE 256
-short ch_lhs[] = { -1,
- 0, 0, 20, 20, 21, 1, 1, 2, 2, 2,
- 2, 2, 45, 45, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 4,
- 5, 5, 5, 5, 5, 6, 6, 6, 6, 6,
- 6, 6, 6, 7, 8, 9, 9, 62, 10, 11,
- 11, 12, 13, 14, 15, 17, 18, 19, 22, 22,
- 22, 23, 23, 24, 25, 25, 26, 27, 28, 28,
- 28, 28, 29, 29, 29, 30, 30, 30, 30, 30,
- 30, 30, 30, 31, 31, 31, 31, 32, 32, 32,
- 32, 32, 33, 33, 33, 33, 34, 34, 34, 60,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 49, 49, 49, 49, 61, 50, 50, 51,
- 44, 52, 53, 54, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 46, 47, 48, 55, 56, 57, 58,
- 59,
-};
-short ch_len[] = { 2,
- 1, 1, 1, 1, 1, 1, 2, 1, 1, 1,
- 1, 1, 1, 3, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 4, 6, 6, 0, 5, 6,
- 6, 2, 2, 1, 1, 1, 1, 3, 1, 1,
- 1, 5, 9, 2, 2, 4, 1, 4, 1, 3,
- 3, 3, 1, 3, 3, 1, 3, 3, 3, 3,
- 3, 3, 3, 1, 3, 3, 3, 1, 3, 3,
- 3, 3, 1, 2, 2, 2, 2, 2, 1, 3,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 1, 4, 4, 4, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1,
-};
-short ch_defred[] = { 0,
- 5, 12, 44, 54, 56, 57, 125, 126, 127, 128,
- 129, 36, 37, 38, 39, 35, 8, 40, 41, 42,
- 43, 117, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 10, 9, 11, 0, 0, 6, 0, 15, 16, 17,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 55,
- 27, 28, 0, 1, 4, 3, 61, 0, 0, 0,
- 0, 0, 88, 93, 31, 32, 33, 34, 0, 0,
- 60, 0, 138, 0, 30, 29, 94, 0, 95, 0,
- 0, 141, 98, 0, 137, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 52, 7,
- 96, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 53, 0, 58, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 122, 123, 124, 0, 0, 0,
- 0, 0, 0, 118, 0, 0, 0, 120, 0, 100,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 89, 90, 91, 92, 130,
- 131, 0, 0, 134, 136, 0, 0, 0, 140, 0,
- 0, 139, 64, 0, 0, 0, 101, 102, 103, 104,
- 105, 106, 107, 108, 109, 0, 0, 0, 110, 111,
- 112, 45, 0, 0, 0, 0, 13, 0, 0, 0,
- 65, 0, 62, 0, 0, 0, 133, 0, 132, 0,
- 135, 0, 0, 49, 0, 0, 67, 0, 0, 114,
- 115, 116, 47, 46, 50, 51, 14, 0, 68, 66,
- 0, 63,
-};
-short ch_dgoto[] = { 44,
- 85, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 137, 196, 238, 190, 68, 69, 70,
- 71, 72, 73, 74, 75, 76, 77, 78, 79, 182,
- 183, 230, 228, 80, 218, 186, 232, 187, 149, 155,
- 159, 150, 151, 152, 96, 84, 193, 191, 93, 81,
- 88, 188,
-};
-short ch_sindex[] = { 457,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, -262, 879, 879, 893, -215, 622, -258, 50,
- 51, 52, 53, 56, 57, 58, 67, 72, 73, 75,
- 0, 0, 0, 0, -221, 0, -293, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, -261, 0, 0, 0, 0, -248, -275, -44,
- -30, -33, 0, 0, 0, 0, 0, 0, 88, 91,
- 0, 92, 0, -165, 0, 0, 0, 92, 0, 0,
- -293, 0, 0, 94, 0, -181, 622, 622, 622, 622,
- 622, 622, 622, 636, 622, 622, 622, 457, 0, 0,
- 0, 797, 797, 797, 797, 797, 797, 797, 797, 797,
- 797, 797, 797, 797, 797, 797, 797, 797, 797, 797,
- -233, -270, 0, -137, 0, -132, -272, 112, 118, 119,
- 120, 121, 122, 128, 0, 0, 0, 129, 130, 132,
- 141, 143, 92, 0, 144, 92, 146, 0, 149, 0,
- -275, -275, -275, -44, -44, -30, -30, -30, -30, -30,
- -30, -30, -33, -33, -33, 0, 0, 0, 0, 0,
- 0, -39, 115, 0, 0, 126, -120, 622, 0, 106,
- 142, 0, 0, -132, -258, -110, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 622, 622, 622, 0, 0,
- 0, 0, -64, -61, -63, -64, 0, -34, -103, 622,
- 0, -181, 0, 174, 181, -22, 0, 182, 0, 184,
- 0, 192, 193, 0, 622, 622, 0, 177, -272, 0,
- 0, 0, 0, 0, 0, 0, 0, 150, 0, 0,
- -55, 0,
-};
-short ch_rindex[] = { 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 82, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 24, 0, 0, 0, 0, 506, 255, 191,
- 145, 95, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 237, 0, 0, 0, 0, 0, 0, 0, 59,
- 204, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 714, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, -40, 0, 0,
- 0, 0, 205, 0, 0, 206, 0, 0, 0, 0,
- 567, 573, 577, 531, 554, 168, 180, 208, 231, 500,
- 522, 545, 105, 133, 158, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,
-};
-short ch_gindex[] = { 0,
- 1230, 0, -23, 0, 0, 185, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 26, 148,
- 0, 1162, 0, 31, 15, 22, 0, 0, -56, -104,
- -45, -37, -92, 55, 0, 0, 0, 0, 0, 0,
- 0, 0, 43, 0, 63, 0, 0, 0, 0, 154,
- 0, 0, 0, 0, 71, 0, 87, 0, 0, 0,
- 5, 0,
-};
-#define YYTABLESIZE 1466
-short ch_table[] = { 30,
- 30, 212, 91, 109, 82, 184, 234, 185, 127, 235,
- 164, 165, 124, 128, 125, 121, 117, 119, 242, 83,
- 110, 235, 95, 29, 12, 13, 14, 15, 115, 116,
- 18, 19, 20, 21, 176, 177, 178, 179, 180, 181,
- 30, 30, 30, 30, 30, 30, 194, 30, 195, 86,
- 86, 86, 112, 113, 114, 161, 162, 163, 97, 30,
- 30, 30, 30, 29, 29, 29, 29, 29, 29, 92,
- 29, 166, 167, 168, 169, 170, 171, 172, 87, 89,
- 91, 99, 29, 29, 29, 29, 173, 174, 175, 97,
- 98, 99, 100, 30, 84, 101, 102, 103, 30, 97,
- 97, 97, 97, 97, 85, 97, 104, 133, 153, 156,
- 156, 105, 106, 133, 107, 108, 29, 97, 97, 97,
- 97, 121, 99, 99, 99, 99, 99, 131, 99, 86,
- 132, 28, 86, 134, 135, 84, 136, 84, 84, 84,
- 99, 99, 99, 99, 76, 85, 189, 85, 85, 85,
- 192, 97, 197, 84, 84, 84, 84, 87, 198, 199,
- 200, 201, 202, 85, 85, 85, 85, 77, 203, 204,
- 205, 206, 214, 86, 99, 86, 86, 86, 133, 78,
- 207, 133, 208, 215, 209, 76, 210, 84, 76, 211,
- 73, 86, 86, 86, 86, 216, 219, 85, 87, 220,
- 87, 87, 87, 76, 76, 76, 76, 79, 77, 223,
- 227, 77, 229, 231, 240, 236, 87, 87, 87, 87,
- 78, 241, 243, 78, 244, 86, 77, 77, 77, 77,
- 80, 73, 245, 246, 73, 249, 2, 76, 78, 78,
- 78, 78, 251, 121, 252, 113, 119, 111, 79, 73,
- 87, 79, 239, 250, 69, 160, 30, 248, 233, 157,
- 77, 118, 120, 122, 123, 222, 79, 79, 79, 79,
- 226, 80, 78, 30, 80, 0, 213, 129, 130, 126,
- 221, 0, 0, 73, 0, 0, 0, 0, 0, 80,
- 80, 80, 80, 0, 0, 69, 0, 30, 69, 0,
- 79, 30, 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 69, 30, 0, 0, 0, 0, 0,
- 29, 0, 0, 80, 29, 29, 29, 29, 29, 29,
- 29, 29, 29, 29, 29, 29, 0, 29, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 69, 0, 0,
- 0, 0, 0, 0, 0, 30, 0, 0, 0, 97,
- 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
- 97, 0, 30, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 0, 84, 84, 84, 84, 84,
- 84, 84, 84, 84, 84, 85, 85, 85, 85, 85,
- 85, 85, 85, 85, 85, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 0, 0, 76, 76, 76, 76, 76,
- 76, 76, 76, 76, 0, 0, 0, 0, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 77, 77,
- 77, 77, 77, 77, 77, 77, 77, 0, 0, 0,
- 78, 78, 78, 78, 78, 78, 78, 78, 78, 0,
- 0, 73, 73, 73, 73, 73, 28, 0, 0, 81,
- 0, 24, 0, 0, 0, 59, 0, 0, 79, 79,
- 79, 79, 79, 79, 79, 79, 79, 0, 0, 0,
- 0, 82, 0, 0, 0, 0, 0, 0, 0, 0,
- 74, 80, 80, 80, 80, 80, 80, 80, 80, 80,
- 81, 0, 0, 81, 83, 0, 59, 0, 0, 59,
- 0, 0, 0, 75, 0, 69, 69, 69, 81, 81,
- 81, 81, 82, 0, 59, 82, 70, 0, 0, 0,
- 0, 74, 71, 0, 74, 0, 72, 0, 0, 0,
- 82, 82, 82, 82, 0, 83, 0, 0, 83, 74,
- 0, 0, 81, 0, 75, 0, 0, 75, 59, 0,
- 0, 0, 0, 83, 83, 83, 83, 70, 0, 0,
- 70, 0, 75, 71, 82, 0, 71, 72, 0, 0,
- 72, 0, 0, 74, 0, 70, 0, 0, 0, 0,
- 0, 71, 0, 0, 0, 72, 0, 83, 0, 0,
- 0, 0, 0, 0, 0, 0, 75, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 70,
- 0, 28, 0, 0, 0, 71, 24, 0, 0, 72,
- 0, 0, 0, 0, 0, 28, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 2, 3, 4, 5, 6,
- 0, 0, 0, 7, 8, 9, 10, 11, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 48, 23, 0, 0, 0, 48, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 25,
- 26, 27, 0, 29, 0, 0, 0, 0, 0, 30,
- 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 0, 0, 0, 0, 0, 0, 0,
- 81, 81, 81, 81, 81, 81, 81, 81, 81, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 82, 82, 82, 82, 82, 82, 82, 82,
- 82, 74, 74, 74, 74, 74, 28, 0, 0, 0,
- 0, 24, 0, 0, 0, 83, 83, 83, 83, 83,
- 83, 83, 83, 83, 75, 75, 75, 75, 75, 0,
- 0, 0, 0, 0, 0, 0, 0, 70, 70, 70,
- 0, 0, 0, 71, 71, 71, 0, 72, 72, 72,
- 2, 3, 4, 5, 6, 0, 0, 0, 7, 8,
- 9, 10, 11, 0, 2, 3, 4, 5, 6, 145,
- 146, 147, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 28, 23,
- 0, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 28, 0, 25, 26, 27, 0, 29, 0,
- 0, 0, 0, 0, 30, 31, 32, 33, 34, 35,
- 36, 37, 38, 39, 40, 41, 42, 43, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
- 42, 43, 48, 48, 48, 48, 48, 0, 0, 0,
- 48, 48, 48, 48, 48, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 0, 48, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 48, 48, 48, 0,
- 48, 0, 0, 0, 0, 0, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 0, 0, 0, 0, 0, 2, 3, 4, 5, 6,
- 0, 0, 0, 7, 8, 9, 10, 11, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 25,
- 26, 27, 0, 0, 0, 0, 0, 0, 0, 30,
- 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 0, 0, 0, 0, 2, 3, 4,
- 5, 6, 0, 0, 0, 7, 8, 9, 10, 11,
- 0, 2, 3, 4, 5, 6, 0, 0, 0, 7,
- 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
- 18, 19, 20, 21, 22, 0, 0, 0, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 94,
- 0, 0, 26, 27, 0, 0, 0, 0, 0, 0,
- 0, 30, 31, 32, 33, 34, 35, 36, 37, 38,
- 39, 40, 41, 42, 43, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 43, 45,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 90, 0, 45, 138, 139,
- 140, 141, 142, 143, 144, 0, 154, 154, 158, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 45, 45, 45, 45,
- 45, 45, 45, 148, 45, 45, 45, 45, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 217,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 224, 225, 217,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 237, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 247, 237, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 45, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 45, 45, 45, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 45,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 45, 45,
-};
-short ch_check[] = { 40,
- 0, 41, 26, 297, 0, 276, 41, 278, 42, 44,
- 115, 116, 43, 47, 45, 60, 61, 62, 41, 282,
- 314, 44, 281, 0, 286, 287, 288, 289, 304, 305,
- 292, 293, 294, 295, 127, 128, 129, 130, 272, 273,
- 40, 41, 42, 43, 44, 45, 319, 47, 321, 24,
- 25, 26, 301, 302, 303, 112, 113, 114, 0, 59,
- 60, 61, 62, 40, 41, 42, 43, 44, 45, 285,
- 47, 117, 118, 119, 120, 121, 122, 123, 24, 25,
- 104, 0, 59, 60, 61, 62, 124, 125, 126, 40,
- 40, 40, 40, 93, 0, 40, 40, 40, 40, 41,
- 42, 43, 44, 45, 0, 47, 40, 82, 104, 105,
- 106, 40, 40, 88, 40, 337, 93, 59, 60, 61,
- 62, 40, 41, 42, 43, 44, 45, 40, 47, 104,
- 40, 40, 0, 299, 41, 41, 318, 43, 44, 45,
- 59, 60, 61, 62, 0, 41, 284, 43, 44, 45,
- 283, 93, 41, 59, 60, 61, 62, 0, 41, 41,
- 41, 41, 41, 59, 60, 61, 62, 0, 41, 41,
- 41, 40, 58, 41, 93, 43, 44, 45, 153, 0,
- 40, 156, 40, 58, 41, 41, 41, 93, 44, 41,
- 0, 59, 60, 61, 62, 316, 91, 93, 41, 58,
- 43, 44, 45, 59, 60, 61, 62, 0, 41, 320,
- 275, 44, 274, 277, 41, 319, 59, 60, 61, 62,
- 41, 41, 41, 44, 41, 93, 59, 60, 61, 62,
- 0, 41, 41, 41, 44, 59, 0, 93, 59, 60,
- 61, 62, 93, 40, 300, 41, 41, 63, 41, 59,
- 93, 44, 222, 239, 0, 108, 297, 236, 216, 106,
- 93, 306, 307, 308, 309, 195, 59, 60, 61, 62,
- 208, 41, 93, 314, 44, -1, 316, 311, 312, 310,
- 194, -1, -1, 93, -1, -1, -1, -1, -1, 59,
- 60, 61, 62, -1, -1, 41, -1, 297, 44, -1,
- 93, 301, 302, 303, 304, 305, 306, 307, 308, 309,
- 310, 311, 312, 59, 314, -1, -1, -1, -1, -1,
- 297, -1, -1, 93, 301, 302, 303, 304, 305, 306,
- 307, 308, 309, 310, 311, 312, -1, 314, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 93, -1, -1,
- -1, -1, -1, -1, -1, 297, -1, -1, -1, 301,
- 302, 303, 304, 305, 306, 307, 308, 309, 310, 311,
- 312, -1, 314, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 301, 302, 303, 304, 305, 306, 307, 308,
- 309, 310, 311, 312, -1, 301, 302, 303, 304, 305,
- 306, 307, 308, 309, 310, 301, 302, 303, 304, 305,
- 306, 307, 308, 309, 310, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 301, 302, 303, 304, 305, 306, 307,
- 308, 309, 310, -1, -1, 301, 302, 303, 304, 305,
- 306, 307, 308, 309, -1, -1, -1, -1, 301, 302,
- 303, 304, 305, 306, 307, 308, 309, 310, 301, 302,
- 303, 304, 305, 306, 307, 308, 309, -1, -1, -1,
- 301, 302, 303, 304, 305, 306, 307, 308, 309, -1,
- -1, 301, 302, 303, 304, 305, 40, -1, -1, 0,
- -1, 45, -1, -1, -1, 0, -1, -1, 301, 302,
- 303, 304, 305, 306, 307, 308, 309, -1, -1, -1,
- -1, 0, -1, -1, -1, -1, -1, -1, -1, -1,
- 0, 301, 302, 303, 304, 305, 306, 307, 308, 309,
- 41, -1, -1, 44, 0, -1, 41, -1, -1, 44,
- -1, -1, -1, 0, -1, 301, 302, 303, 59, 60,
- 61, 62, 41, -1, 59, 44, 0, -1, -1, -1,
- -1, 41, 0, -1, 44, -1, 0, -1, -1, -1,
- 59, 60, 61, 62, -1, 41, -1, -1, 44, 59,
- -1, -1, 93, -1, 41, -1, -1, 44, 93, -1,
- -1, -1, -1, 59, 60, 61, 62, 41, -1, -1,
- 44, -1, 59, 41, 93, -1, 44, 41, -1, -1,
- 44, -1, -1, 93, -1, 59, -1, -1, -1, -1,
- -1, 59, -1, -1, -1, 59, -1, 93, -1, -1,
- -1, -1, -1, -1, -1, -1, 93, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 93,
- -1, 40, -1, -1, -1, 93, 45, -1, -1, 93,
- -1, -1, -1, -1, -1, 40, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 257, -1, 259, 260, 261, 262, 263,
- -1, -1, -1, 267, 268, 269, 270, 271, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 286, 287, 288, 289, 290, 291, 292, 293,
- 294, 295, 296, 40, 298, -1, -1, -1, 45, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 313,
- 314, 315, -1, 317, -1, -1, -1, -1, -1, 323,
- 324, 325, 326, 327, 328, 329, 330, 331, 332, 333,
- 334, 335, 336, -1, -1, -1, -1, -1, -1, -1,
- 301, 302, 303, 304, 305, 306, 307, 308, 309, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 301, 302, 303, 304, 305, 306, 307, 308,
- 309, 301, 302, 303, 304, 305, 40, -1, -1, -1,
- -1, 45, -1, -1, -1, 301, 302, 303, 304, 305,
- 306, 307, 308, 309, 301, 302, 303, 304, 305, -1,
- -1, -1, -1, -1, -1, -1, -1, 301, 302, 303,
- -1, -1, -1, 301, 302, 303, -1, 301, 302, 303,
- 259, 260, 261, 262, 263, -1, -1, -1, 267, 268,
- 269, 270, 271, -1, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, 286, 287, 288,
- 289, 290, 291, 292, 293, 294, 295, 296, 40, 298,
- -1, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 296, 40, -1, 313, 314, 315, -1, 317, -1,
- -1, -1, -1, -1, 323, 324, 325, 326, 327, 328,
- 329, 330, 331, 332, 333, 334, 335, 336, 323, 324,
- 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
- 335, 336, 259, 260, 261, 262, 263, -1, -1, -1,
- 267, 268, 269, 270, 271, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 286,
- 287, 288, 289, 290, 291, 292, 293, 294, 295, 296,
- -1, 298, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 313, 314, 315, -1,
- 317, -1, -1, -1, -1, -1, 323, 324, 325, 326,
- 327, 328, 329, 330, 331, 332, 333, 334, 335, 336,
- -1, -1, -1, -1, -1, 259, 260, 261, 262, 263,
- -1, -1, -1, 267, 268, 269, 270, 271, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 286, 287, 288, 289, 290, 291, 292, 293,
- 294, 295, 296, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 313,
- 314, 315, -1, -1, -1, -1, -1, -1, -1, 323,
- 324, 325, 326, 327, 328, 329, 330, 331, 332, 333,
- 334, 335, 336, -1, -1, -1, -1, 259, 260, 261,
- 262, 263, -1, -1, -1, 267, 268, 269, 270, 271,
- -1, 259, 260, 261, 262, 263, -1, -1, -1, 267,
- 268, 269, 270, 271, 286, 287, 288, 289, 290, 291,
- 292, 293, 294, 295, 296, -1, -1, -1, 286, 287,
- 288, 289, 290, 291, 292, 293, 294, 295, 296, 28,
- -1, -1, 314, 315, -1, -1, -1, -1, -1, -1,
- -1, 323, 324, 325, 326, 327, 328, 329, 330, 331,
- 332, 333, 334, 335, 336, 323, 324, 325, 326, 327,
- 328, 329, 330, 331, 332, 333, 334, 335, 336, 0,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 26, -1, 28, 97, 98,
- 99, 100, 101, 102, 103, -1, 105, 106, 107, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 97, 98, 99, 100,
- 101, 102, 103, 104, 105, 106, 107, 108, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 188,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 206, 207, 208,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 220, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 235, 236, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 188, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 206, 207, 208, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 220,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 235, 236,
-};
-#define YYFINAL 44
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 337
-#if YYDEBUG
-char *ch_name[] = {
-"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",0,0,0,0,0,0,0,0,0,0,
-"':'","';'","'<'","'='","'>'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,"'['",0,"']'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,"FIXME_01","FIXME_02","FIXME_03","FIXME_04",
-"FIXME_05","FIXME_06","FIXME_07","FIXME_08","FIXME_09","FIXME_10","FIXME_11",
-"FIXME_12","FIXME_13","FIXME_14","FIXME_15","FIXME_16","FIXME_17","FIXME_18",
-"FIXME_19","FIXME_20","FIXME_21","FIXME_22","FIXME_24","FIXME_25","FIXME_26",
-"FIXME_27","FIXME_28","FIXME_29","FIXME_30","INTEGER_LITERAL","BOOLEAN_LITERAL",
-"CHARACTER_LITERAL","FLOAT_LITERAL","GENERAL_PROCEDURE_NAME","LOCATION_NAME",
-"SET_LITERAL","EMPTINESS_LITERAL","CHARACTER_STRING_LITERAL",
-"BIT_STRING_LITERAL","TYPENAME","FIELD_NAME","CASE","OF","ESAC","LOGIOR","ORIF",
-"LOGXOR","LOGAND","ANDIF","NOTEQUAL","GTR","LEQ","IN","SLASH_SLASH","MOD","REM",
-"NOT","POINTER","RECEIVE","UP","IF","THEN","ELSE","FI","ELSIF","ILLEGAL_TOKEN",
-"NUM","PRED","SUCC","ABS","CARD","MAX_TOKEN","MIN_TOKEN","SIZE","UPPER","LOWER",
-"LENGTH","GDB_REGNAME","GDB_LAST","GDB_VARIABLE","GDB_ASSIGNMENT",
-};
-char *ch_rule[] = {
-"$accept : start",
-"start : value",
-"start : mode_name",
-"value : expression",
-"value : undefined_value",
-"undefined_value : FIXME_01",
-"location : access_name",
-"location : primitive_value POINTER",
-"access_name : LOCATION_NAME",
-"access_name : GDB_LAST",
-"access_name : GDB_REGNAME",
-"access_name : GDB_VARIABLE",
-"access_name : FIXME_03",
-"expression_list : expression",
-"expression_list : expression_list ',' expression",
-"primitive_value : location_contents",
-"primitive_value : value_name",
-"primitive_value : literal",
-"primitive_value : tuple",
-"primitive_value : value_string_element",
-"primitive_value : value_string_slice",
-"primitive_value : value_array_element",
-"primitive_value : value_array_slice",
-"primitive_value : value_structure_field",
-"primitive_value : expression_conversion",
-"primitive_value : value_procedure_call",
-"primitive_value : value_built_in_routine_call",
-"primitive_value : start_expression",
-"primitive_value : zero_adic_operator",
-"primitive_value : parenthesised_expression",
-"location_contents : location",
-"value_name : synonym_name",
-"value_name : value_enumeration_name",
-"value_name : value_do_with_name",
-"value_name : value_receive_name",
-"value_name : GENERAL_PROCEDURE_NAME",
-"literal : INTEGER_LITERAL",
-"literal : BOOLEAN_LITERAL",
-"literal : CHARACTER_LITERAL",
-"literal : FLOAT_LITERAL",
-"literal : SET_LITERAL",
-"literal : EMPTINESS_LITERAL",
-"literal : CHARACTER_STRING_LITERAL",
-"literal : BIT_STRING_LITERAL",
-"tuple : FIXME_04",
-"value_string_element : string_primitive_value '(' start_element ')'",
-"value_string_slice : string_primitive_value '(' left_element ':' right_element ')'",
-"value_string_slice : string_primitive_value '(' start_element UP slice_size ')'",
-"$$1 :",
-"value_array_element : array_primitive_value '(' $$1 expression_list ')'",
-"value_array_slice : array_primitive_value '(' lower_element ':' upper_element ')'",
-"value_array_slice : array_primitive_value '(' first_element UP slice_size ')'",
-"value_structure_field : primitive_value FIELD_NAME",
-"expression_conversion : mode_name parenthesised_expression",
-"value_procedure_call : FIXME_05",
-"value_built_in_routine_call : chill_value_built_in_routine_call",
-"start_expression : FIXME_06",
-"zero_adic_operator : FIXME_07",
-"parenthesised_expression : '(' expression ')'",
-"expression : operand_0",
-"expression : single_assignment_action",
-"expression : conditional_expression",
-"conditional_expression : IF boolean_expression then_alternative else_alternative FI",
-"conditional_expression : CASE case_selector_list OF value_case_alternative '[' ELSE sub_expression ']' ESAC",
-"then_alternative : THEN subexpression",
-"else_alternative : ELSE subexpression",
-"else_alternative : ELSIF boolean_expression then_alternative else_alternative",
-"sub_expression : expression",
-"value_case_alternative : case_label_specification ':' sub_expression ';'",
-"operand_0 : operand_1",
-"operand_0 : operand_0 LOGIOR operand_1",
-"operand_0 : operand_0 ORIF operand_1",
-"operand_0 : operand_0 LOGXOR operand_1",
-"operand_1 : operand_2",
-"operand_1 : operand_1 LOGAND operand_2",
-"operand_1 : operand_1 ANDIF operand_2",
-"operand_2 : operand_3",
-"operand_2 : operand_2 '=' operand_3",
-"operand_2 : operand_2 NOTEQUAL operand_3",
-"operand_2 : operand_2 '>' operand_3",
-"operand_2 : operand_2 GTR operand_3",
-"operand_2 : operand_2 '<' operand_3",
-"operand_2 : operand_2 LEQ operand_3",
-"operand_2 : operand_2 IN operand_3",
-"operand_3 : operand_4",
-"operand_3 : operand_3 '+' operand_4",
-"operand_3 : operand_3 '-' operand_4",
-"operand_3 : operand_3 SLASH_SLASH operand_4",
-"operand_4 : operand_5",
-"operand_4 : operand_4 '*' operand_5",
-"operand_4 : operand_4 '/' operand_5",
-"operand_4 : operand_4 MOD operand_5",
-"operand_4 : operand_4 REM operand_5",
-"operand_5 : operand_6",
-"operand_5 : '-' operand_6",
-"operand_5 : NOT operand_6",
-"operand_5 : parenthesised_expression literal",
-"operand_6 : POINTER location",
-"operand_6 : RECEIVE buffer_location",
-"operand_6 : primitive_value",
-"single_assignment_action : location GDB_ASSIGNMENT value",
-"chill_value_built_in_routine_call : NUM '(' expression ')'",
-"chill_value_built_in_routine_call : PRED '(' expression ')'",
-"chill_value_built_in_routine_call : SUCC '(' expression ')'",
-"chill_value_built_in_routine_call : ABS '(' expression ')'",
-"chill_value_built_in_routine_call : CARD '(' expression ')'",
-"chill_value_built_in_routine_call : MAX_TOKEN '(' expression ')'",
-"chill_value_built_in_routine_call : MIN_TOKEN '(' expression ')'",
-"chill_value_built_in_routine_call : SIZE '(' location ')'",
-"chill_value_built_in_routine_call : SIZE '(' mode_argument ')'",
-"chill_value_built_in_routine_call : UPPER '(' upper_lower_argument ')'",
-"chill_value_built_in_routine_call : LOWER '(' upper_lower_argument ')'",
-"chill_value_built_in_routine_call : LENGTH '(' length_argument ')'",
-"mode_argument : mode_name",
-"mode_argument : array_mode_name '(' expression ')'",
-"mode_argument : string_mode_name '(' expression ')'",
-"mode_argument : variant_structure_mode_name '(' expression_list ')'",
-"mode_name : TYPENAME",
-"upper_lower_argument : expression",
-"upper_lower_argument : mode_name",
-"length_argument : expression",
-"array_primitive_value : primitive_value",
-"array_mode_name : FIXME_08",
-"string_mode_name : FIXME_09",
-"variant_structure_mode_name : FIXME_10",
-"synonym_name : FIXME_11",
-"value_enumeration_name : FIXME_12",
-"value_do_with_name : FIXME_13",
-"value_receive_name : FIXME_14",
-"string_primitive_value : FIXME_15",
-"start_element : FIXME_16",
-"left_element : FIXME_17",
-"right_element : FIXME_18",
-"slice_size : FIXME_19",
-"lower_element : FIXME_20",
-"upper_element : FIXME_21",
-"first_element : FIXME_22",
-"boolean_expression : FIXME_26",
-"case_selector_list : FIXME_27",
-"subexpression : FIXME_28",
-"case_label_specification : FIXME_29",
-"buffer_location : FIXME_30",
-};
-#endif
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 500
-#define YYMAXDEPTH 500
-#endif
-#endif
-int yydebug;
-int yynerrs;
-int yyerrflag;
-int yychar;
-short *yyssp;
-YYSTYPE *yyvsp;
-YYSTYPE yyval;
-YYSTYPE yylval;
-short yyss[YYSTACKSIZE];
-YYSTYPE yyvs[YYSTACKSIZE];
-#define yystacksize YYSTACKSIZE
-#line 994 "./ch-exp.y"
-
-/* Implementation of a dynamically expandable buffer for processing input
- characters acquired through lexptr and building a value to return in
- yylval. */
-
-static char *tempbuf; /* Current buffer contents */
-static int tempbufsize; /* Size of allocated buffer */
-static int tempbufindex; /* Current index into buffer */
-
-#define GROWBY_MIN_SIZE 64 /* Minimum amount to grow buffer by */
-
-#define CHECKBUF(size) \
- do { \
- if (tempbufindex + (size) >= tempbufsize) \
- { \
- growbuf_by_size (size); \
- } \
- } while (0);
-
-/* Grow the static temp buffer if necessary, including allocating the first one
- on demand. */
-
-static void
-growbuf_by_size (count)
- int count;
-{
- int growby;
-
- growby = max (count, GROWBY_MIN_SIZE);
- tempbufsize += growby;
- if (tempbuf == NULL)
- {
- tempbuf = (char *) xmalloc (tempbufsize);
- }
- else
- {
- tempbuf = (char *) xrealloc (tempbuf, tempbufsize);
- }
-}
-
-/* Try to consume a simple name string token. If successful, returns
- a pointer to a nullbyte terminated copy of the name that can be used
- in symbol table lookups. If not successful, returns NULL. */
-
-static char *
-match_simple_name_string ()
-{
- char *tokptr = lexptr;
-
- if (isalpha (*tokptr))
- {
- char *result;
- do {
- tokptr++;
- } while (isalnum (*tokptr) || (*tokptr == '_'));
- yylval.sval.ptr = lexptr;
- yylval.sval.length = tokptr - lexptr;
- lexptr = tokptr;
- result = copy_name (yylval.sval);
- for (tokptr = result; *tokptr; tokptr++)
- if (isupper (*tokptr))
- *tokptr = tolower(*tokptr);
- return result;
- }
- return (NULL);
-}
-
-/* Start looking for a value composed of valid digits as set by the base
- in use. Note that '_' characters are valid anywhere, in any quantity,
- and are simply ignored. Since we must find at least one valid digit,
- or reject this token as an integer literal, we keep track of how many
- digits we have encountered. */
-
-static int
-decode_integer_value (base, tokptrptr, ivalptr)
- int base;
- char **tokptrptr;
- int *ivalptr;
-{
- char *tokptr = *tokptrptr;
- int temp;
- int digits = 0;
-
- while (*tokptr != '\0')
- {
- temp = tolower (*tokptr);
- tokptr++;
- switch (temp)
- {
- case '_':
- continue;
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- temp -= '0';
- break;
- case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
- temp -= 'a';
- temp += 10;
- break;
- default:
- temp = base;
- break;
- }
- if (temp < base)
- {
- digits++;
- *ivalptr *= base;
- *ivalptr += temp;
- }
- else
- {
- /* Found something not in domain for current base. */
- tokptr--; /* Unconsume what gave us indigestion. */
- break;
- }
- }
-
- /* If we didn't find any digits, then we don't have a valid integer
- value, so reject the entire token. Otherwise, update the lexical
- scan pointer, and return non-zero for success. */
-
- if (digits == 0)
- {
- return (0);
- }
- else
- {
- *tokptrptr = tokptr;
- return (1);
- }
-}
-
-static int
-decode_integer_literal (valptr, tokptrptr)
- int *valptr;
- char **tokptrptr;
-{
- char *tokptr = *tokptrptr;
- int base = 0;
- int ival = 0;
- int explicit_base = 0;
-
- /* Look for an explicit base specifier, which is optional. */
-
- switch (*tokptr)
- {
- case 'd':
- case 'D':
- explicit_base++;
- base = 10;
- tokptr++;
- break;
- case 'b':
- case 'B':
- explicit_base++;
- base = 2;
- tokptr++;
- break;
- case 'h':
- case 'H':
- explicit_base++;
- base = 16;
- tokptr++;
- break;
- case 'o':
- case 'O':
- explicit_base++;
- base = 8;
- tokptr++;
- break;
- default:
- base = 10;
- break;
- }
-
- /* If we found an explicit base ensure that the character after the
- explicit base is a single quote. */
-
- if (explicit_base && (*tokptr++ != '\''))
- {
- return (0);
- }
-
- /* Attempt to decode whatever follows as an integer value in the
- indicated base, updating the token pointer in the process and
- computing the value into ival. Also, if we have an explicit
- base, then the next character must not be a single quote, or we
- have a bitstring literal, so reject the entire token in this case.
- Otherwise, update the lexical scan pointer, and return non-zero
- for success. */
-
- if (!decode_integer_value (base, &tokptr, &ival))
- {
- return (0);
- }
- else if (explicit_base && (*tokptr == '\''))
- {
- return (0);
- }
- else
- {
- *valptr = ival;
- *tokptrptr = tokptr;
- return (1);
- }
-}
-
-/* If it wasn't for the fact that floating point values can contain '_'
- characters, we could just let strtod do all the hard work by letting it
- try to consume as much of the current token buffer as possible and
- find a legal conversion. Unfortunately we need to filter out the '_'
- characters before calling strtod, which we do by copying the other
- legal chars to a local buffer to be converted. However since we also
- need to keep track of where the last unconsumed character in the input
- buffer is, we have transfer only as many characters as may compose a
- legal floating point value. */
-
-static int
-match_float_literal ()
-{
- char *tokptr = lexptr;
- char *buf;
- char *copy;
- double dval;
- extern double strtod ();
-
- /* Make local buffer in which to build the string to convert. This is
- required because underscores are valid in chill floating point numbers
- but not in the string passed to strtod to convert. The string will be
- no longer than our input string. */
-
- copy = buf = (char *) alloca (strlen (tokptr) + 1);
-
- /* Transfer all leading digits to the conversion buffer, discarding any
- underscores. */
-
- while (isdigit (*tokptr) || *tokptr == '_')
- {
- if (*tokptr != '_')
- {
- *copy++ = *tokptr;
- }
- tokptr++;
- }
-
- /* Now accept either a '.', or one of [eEdD]. Dot is legal regardless
- of whether we found any leading digits, and we simply accept it and
- continue on to look for the fractional part and/or exponent. One of
- [eEdD] is legal only if we have seen digits, and means that there
- is no fractional part. If we find neither of these, then this is
- not a floating point number, so return failure. */
-
- switch (*tokptr++)
- {
- case '.':
- /* Accept and then look for fractional part and/or exponent. */
- *copy++ = '.';
- break;
-
- case 'e':
- case 'E':
- case 'd':
- case 'D':
- if (copy == buf)
- {
- return (0);
- }
- *copy++ = 'e';
- goto collect_exponent;
- break;
-
- default:
- return (0);
- break;
- }
-
- /* We found a '.', copy any fractional digits to the conversion buffer, up
- to the first nondigit, non-underscore character. */
-
- while (isdigit (*tokptr) || *tokptr == '_')
- {
- if (*tokptr != '_')
- {
- *copy++ = *tokptr;
- }
- tokptr++;
- }
-
- /* Look for an exponent, which must start with one of [eEdD]. If none
- is found, jump directly to trying to convert what we have collected
- so far. */
-
- switch (*tokptr)
- {
- case 'e':
- case 'E':
- case 'd':
- case 'D':
- *copy++ = 'e';
- tokptr++;
- break;
- default:
- goto convert_float;
- break;
- }
-
- /* Accept an optional '-' or '+' following one of [eEdD]. */
-
- collect_exponent:
- if (*tokptr == '+' || *tokptr == '-')
- {
- *copy++ = *tokptr++;
- }
-
- /* Now copy an exponent into the conversion buffer. Note that at the
- moment underscores are *not* allowed in exponents. */
-
- while (isdigit (*tokptr))
- {
- *copy++ = *tokptr++;
- }
-
- /* If we transfered any chars to the conversion buffer, try to interpret its
- contents as a floating point value. If any characters remain, then we
- must not have a valid floating point string. */
-
- convert_float:
- *copy = '\0';
- if (copy != buf)
- {
- dval = strtod (buf, &copy);
- if (*copy == '\0')
- {
- yylval.dval = dval;
- lexptr = tokptr;
- return (FLOAT_LITERAL);
- }
- }
- return (0);
-}
-
-/* Recognize a string literal. A string literal is a nonzero sequence
- of characters enclosed in matching single or double quotes, except that
- a single character inside single quotes is a character literal, which
- we reject as a string literal. To embed the terminator character inside
- a string, it is simply doubled (I.E. "this""is""one""string") */
-
-static int
-match_string_literal ()
-{
- char *tokptr = lexptr;
-
- for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++)
- {
- CHECKBUF (1);
- if (*tokptr == *lexptr)
- {
- if (*(tokptr + 1) == *lexptr)
- {
- tokptr++;
- }
- else
- {
- break;
- }
- }
- tempbuf[tempbufindex++] = *tokptr;
- }
- if (*tokptr == '\0' /* no terminator */
- || tempbufindex == 0 /* no string */
- || (tempbufindex == 1 && *tokptr == '\'')) /* char literal */
- {
- return (0);
- }
- else
- {
- tempbuf[tempbufindex] = '\0';
- yylval.sval.ptr = tempbuf;
- yylval.sval.length = tempbufindex;
- lexptr = ++tokptr;
- return (CHARACTER_STRING_LITERAL);
- }
-}
-
-/* Recognize a character literal. A character literal is single character
- or a control sequence, enclosed in single quotes. A control sequence
- is a comma separated list of one or more integer literals, enclosed
- in parenthesis and introduced with a circumflex character.
-
- EX: 'a' '^(7)' '^(7,8)'
-
- As a GNU chill extension, the syntax C'xx' is also recognized as a
- character literal, where xx is a hex value for the character.
-
- Note that more than a single character, enclosed in single quotes, is
- a string literal.
-
- Also note that the control sequence form is not in GNU Chill since it
- is ambiguous with the string literal form using single quotes. I.E.
- is '^(7)' a character literal or a string literal. In theory it it
- possible to tell by context, but GNU Chill doesn't accept the control
- sequence form, so neither do we (for now the code is disabled).
-
- Returns CHARACTER_LITERAL if a match is found.
- */
-
-static int
-match_character_literal ()
-{
- char *tokptr = lexptr;
- int ival = 0;
-
- if ((tolower (*tokptr) == 'c') && (*(tokptr + 1) == '\''))
- {
- /* We have a GNU chill extension form, so skip the leading "C'",
- decode the hex value, and then ensure that we have a trailing
- single quote character. */
- tokptr += 2;
- if (!decode_integer_value (16, &tokptr, &ival) || (*tokptr != '\''))
- {
- return (0);
- }
- tokptr++;
- }
- else if (*tokptr == '\'')
- {
- tokptr++;
-
- /* Determine which form we have, either a control sequence or the
- single character form. */
-
- if ((*tokptr == '^') && (*(tokptr + 1) == '('))
- {
-#if 0 /* Disable, see note above. -fnf */
- /* Match and decode a control sequence. Return zero if we don't
- find a valid integer literal, or if the next unconsumed character
- after the integer literal is not the trailing ')'.
- FIXME: We currently don't handle the multiple integer literal
- form. */
- tokptr += 2;
- if (!decode_integer_literal (&ival, &tokptr) || (*tokptr++ != ')'))
- {
- return (0);
- }
-#else
- return (0);
-#endif
- }
- else
- {
- ival = *tokptr++;
- }
-
- /* The trailing quote has not yet been consumed. If we don't find
- it, then we have no match. */
-
- if (*tokptr++ != '\'')
- {
- return (0);
- }
- }
- else
- {
- /* Not a character literal. */
- return (0);
- }
- yylval.typed_val.val = ival;
- yylval.typed_val.type = builtin_type_chill_char;
- lexptr = tokptr;
- return (CHARACTER_LITERAL);
-}
-
-/* Recognize an integer literal, as specified in Z.200 sec 5.2.4.2.
- Note that according to 5.2.4.2, a single "_" is also a valid integer
- literal, however GNU-chill requires there to be at least one "digit"
- in any integer literal. */
-
-static int
-match_integer_literal ()
-{
- char *tokptr = lexptr;
- int ival;
-
- if (!decode_integer_literal (&ival, &tokptr))
- {
- return (0);
- }
- else
- {
- yylval.typed_val.val = ival;
- yylval.typed_val.type = builtin_type_int;
- lexptr = tokptr;
- return (INTEGER_LITERAL);
- }
-}
-
-/* Recognize a bit-string literal, as specified in Z.200 sec 5.2.4.8
- Note that according to 5.2.4.8, a single "_" is also a valid bit-string
- literal, however GNU-chill requires there to be at least one "digit"
- in any bit-string literal. */
-
-static int
-match_bitstring_literal ()
-{
- char *tokptr = lexptr;
- int mask;
- int bitoffset = 0;
- int bitcount = 0;
- int base;
- int digit;
-
- tempbufindex = 0;
-
- /* Look for the required explicit base specifier. */
-
- switch (*tokptr++)
- {
- case 'b':
- case 'B':
- base = 2;
- break;
- case 'o':
- case 'O':
- base = 8;
- break;
- case 'h':
- case 'H':
- base = 16;
- break;
- default:
- return (0);
- break;
- }
-
- /* Ensure that the character after the explicit base is a single quote. */
-
- if (*tokptr++ != '\'')
- {
- return (0);
- }
-
- while (*tokptr != '\0' && *tokptr != '\'')
- {
- digit = tolower (*tokptr);
- tokptr++;
- switch (digit)
- {
- case '_':
- continue;
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- digit -= '0';
- break;
- case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
- digit -= 'a';
- digit += 10;
- break;
- default:
- return (0);
- break;
- }
- if (digit >= base)
- {
- /* Found something not in domain for current base. */
- return (0);
- }
- else
- {
- /* Extract bits from digit, starting with the msbit appropriate for
- the current base, and packing them into the bitstring byte,
- starting at the lsbit. */
- for (mask = (base >> 1); mask > 0; mask >>= 1)
- {
- bitcount++;
- CHECKBUF (1);
- if (digit & mask)
- {
- tempbuf[tempbufindex] |= (1 << bitoffset);
- }
- bitoffset++;
- if (bitoffset == HOST_CHAR_BIT)
- {
- bitoffset = 0;
- tempbufindex++;
- }
- }
- }
- }
-
- /* Verify that we consumed everything up to the trailing single quote,
- and that we found some bits (IE not just underbars). */
-
- if (*tokptr++ != '\'')
- {
- return (0);
- }
- else
- {
- yylval.sval.ptr = tempbuf;
- yylval.sval.length = bitcount;
- lexptr = tokptr;
- return (BIT_STRING_LITERAL);
- }
-}
-
-/* Recognize tokens that start with '$'. These include:
-
- $regname A native register name or a "standard
- register name".
- Return token GDB_REGNAME.
-
- $variable A convenience variable with a name chosen
- by the user.
- Return token GDB_VARIABLE.
-
- $digits Value history with index <digits>, starting
- from the first value which has index 1.
- Return GDB_LAST.
-
- $$digits Value history with index <digits> relative
- to the last value. I.E. $$0 is the last
- value, $$1 is the one previous to that, $$2
- is the one previous to $$1, etc.
- Return token GDB_LAST.
-
- $ | $0 | $$0 The last value in the value history.
- Return token GDB_LAST.
-
- $$ An abbreviation for the second to the last
- value in the value history, I.E. $$1
- Return token GDB_LAST.
-
- Note that we currently assume that register names and convenience
- variables follow the convention of starting with a letter or '_'.
-
- */
-
-static int
-match_dollar_tokens ()
-{
- char *tokptr;
- int regno;
- int namelength;
- int negate;
- int ival;
-
- /* We will always have a successful match, even if it is just for
- a single '$', the abbreviation for $$0. So advance lexptr. */
-
- tokptr = ++lexptr;
-
- if (*tokptr == '_' || isalpha (*tokptr))
- {
- /* Look for a match with a native register name, usually something
- like "r0" for example. */
-
- for (regno = 0; regno < NUM_REGS; regno++)
- {
- namelength = strlen (reg_names[regno]);
- if (STREQN (tokptr, reg_names[regno], namelength)
- && !isalnum (tokptr[namelength]))
- {
- yylval.lval = regno;
- lexptr += namelength + 1;
- return (GDB_REGNAME);
- }
- }
-
- /* Look for a match with a standard register name, usually something
- like "pc", which gdb always recognizes as the program counter
- regardless of what the native register name is. */
-
- for (regno = 0; regno < num_std_regs; regno++)
- {
- namelength = strlen (std_regs[regno].name);
- if (STREQN (tokptr, std_regs[regno].name, namelength)
- && !isalnum (tokptr[namelength]))
- {
- yylval.lval = std_regs[regno].regnum;
- lexptr += namelength;
- return (GDB_REGNAME);
- }
- }
-
- /* Attempt to match against a convenience variable. Note that
- this will always succeed, because if no variable of that name
- already exists, the lookup_internalvar will create one for us.
- Also note that both lexptr and tokptr currently point to the
- start of the input string we are trying to match, and that we
- have already tested the first character for non-numeric, so we
- don't have to treat it specially. */
-
- while (*tokptr == '_' || isalnum (*tokptr))
- {
- tokptr++;
- }
- yylval.sval.ptr = lexptr;
- yylval.sval.length = tokptr - lexptr;
- yylval.ivar = lookup_internalvar (copy_name (yylval.sval));
- lexptr = tokptr;
- return (GDB_VARIABLE);
- }
-
- /* Since we didn't match against a register name or convenience
- variable, our only choice left is a history value. */
-
- if (*tokptr == '$')
- {
- negate = 1;
- ival = 1;
- tokptr++;
- }
- else
- {
- negate = 0;
- ival = 0;
- }
-
- /* Attempt to decode more characters as an integer value giving
- the index in the history list. If successful, the value will
- overwrite ival (currently 0 or 1), and if not, ival will be
- left alone, which is good since it is currently correct for
- the '$' or '$$' case. */
-
- decode_integer_literal (&ival, &tokptr);
- yylval.lval = negate ? -ival : ival;
- lexptr = tokptr;
- return (GDB_LAST);
-}
-
-struct token
-{
- char *operator;
- int token;
-};
-
-static const struct token idtokentab[] =
-{
- { "length", LENGTH },
- { "lower", LOWER },
- { "upper", UPPER },
- { "andif", ANDIF },
- { "pred", PRED },
- { "succ", SUCC },
- { "card", CARD },
- { "size", SIZE },
- { "orif", ORIF },
- { "num", NUM },
- { "abs", ABS },
- { "max", MAX_TOKEN },
- { "min", MIN_TOKEN },
- { "mod", MOD },
- { "rem", REM },
- { "not", NOT },
- { "xor", LOGXOR },
- { "and", LOGAND },
- { "in", IN },
- { "or", LOGIOR }
-};
-
-static const struct token tokentab2[] =
-{
- { ":=", GDB_ASSIGNMENT },
- { "//", SLASH_SLASH },
- { "->", POINTER },
- { "/=", NOTEQUAL },
- { "<=", LEQ },
- { ">=", GTR }
-};
-
-/* Read one token, getting characters through lexptr. */
-/* This is where we will check to make sure that the language and the
- operators used are compatible. */
-
-static int
-yylex ()
-{
- unsigned int i;
- int token;
- char *simplename;
- struct symbol *sym;
-
- /* Skip over any leading whitespace. */
- while (isspace (*lexptr))
- {
- lexptr++;
- }
- /* Look for special single character cases which can't be the first
- character of some other multicharacter token. */
- switch (*lexptr)
- {
- case '\0':
- return (0);
- case ',':
- case '=':
- case ';':
- case '!':
- case '+':
- case '*':
- case '(':
- case ')':
- case '[':
- case ']':
- return (*lexptr++);
- }
- /* Look for characters which start a particular kind of multicharacter
- token, such as a character literal, register name, convenience
- variable name, string literal, etc. */
- switch (*lexptr)
- {
- case '\'':
- case '\"':
- /* First try to match a string literal, which is any nonzero
- sequence of characters enclosed in matching single or double
- quotes, except that a single character inside single quotes
- is a character literal, so we have to catch that case also. */
- token = match_string_literal ();
- if (token != 0)
- {
- return (token);
- }
- if (*lexptr == '\'')
- {
- token = match_character_literal ();
- if (token != 0)
- {
- return (token);
- }
- }
- break;
- case 'C':
- case 'c':
- token = match_character_literal ();
- if (token != 0)
- {
- return (token);
- }
- break;
- case '$':
- token = match_dollar_tokens ();
- if (token != 0)
- {
- return (token);
- }
- break;
- }
- /* See if it is a special token of length 2. */
- for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
- {
- if (STREQN (lexptr, tokentab2[i].operator, 2))
- {
- lexptr += 2;
- return (tokentab2[i].token);
- }
- }
- /* Look for single character cases which which could be the first
- character of some other multicharacter token, but aren't, or we
- would already have found it. */
- switch (*lexptr)
- {
- case '-':
- case ':':
- case '/':
- case '<':
- case '>':
- return (*lexptr++);
- }
- /* Look for a float literal before looking for an integer literal, so
- we match as much of the input stream as possible. */
- token = match_float_literal ();
- if (token != 0)
- {
- return (token);
- }
- token = match_bitstring_literal ();
- if (token != 0)
- {
- return (token);
- }
- token = match_integer_literal ();
- if (token != 0)
- {
- return (token);
- }
-
- /* Try to match a simple name string, and if a match is found, then
- further classify what sort of name it is and return an appropriate
- token. Note that attempting to match a simple name string consumes
- the token from lexptr, so we can't back out if we later find that
- we can't classify what sort of name it is. */
-
- simplename = match_simple_name_string ();
-
- if (simplename != NULL)
- {
- /* See if it is a reserved identifier. */
- for (i = 0; i < sizeof (idtokentab) / sizeof (idtokentab[0]); i++)
- {
- if (STREQ (simplename, idtokentab[i].operator))
- {
- return (idtokentab[i].token);
- }
- }
-
- /* Look for other special tokens. */
- if (STREQ (simplename, "true"))
- {
- yylval.ulval = 1;
- return (BOOLEAN_LITERAL);
- }
- if (STREQ (simplename, "false"))
- {
- yylval.ulval = 0;
- return (BOOLEAN_LITERAL);
- }
-
- sym = lookup_symbol (simplename, expression_context_block,
- VAR_NAMESPACE, (int *) NULL,
- (struct symtab **) NULL);
- if (sym != NULL)
- {
- yylval.ssym.stoken.ptr = NULL;
- yylval.ssym.stoken.length = 0;
- yylval.ssym.sym = sym;
- yylval.ssym.is_a_field_of_this = 0; /* FIXME, C++'ism */
- switch (SYMBOL_CLASS (sym))
- {
- case LOC_BLOCK:
- /* Found a procedure name. */
- return (GENERAL_PROCEDURE_NAME);
- case LOC_STATIC:
- /* Found a global or local static variable. */
- return (LOCATION_NAME);
- case LOC_REGISTER:
- case LOC_ARG:
- case LOC_REF_ARG:
- case LOC_REGPARM:
- case LOC_REGPARM_ADDR:
- case LOC_LOCAL:
- case LOC_LOCAL_ARG:
- case LOC_BASEREG:
- case LOC_BASEREG_ARG:
- if (innermost_block == NULL
- || contained_in (block_found, innermost_block))
- {
- innermost_block = block_found;
- }
- return (LOCATION_NAME);
- break;
- case LOC_CONST:
- case LOC_LABEL:
- return (LOCATION_NAME);
- break;
- case LOC_TYPEDEF:
- yylval.tsym.type = SYMBOL_TYPE (sym);
- return TYPENAME;
- case LOC_UNDEF:
- case LOC_CONST_BYTES:
- case LOC_OPTIMIZED_OUT:
- error ("Symbol \"%s\" names no location.", simplename);
- break;
- }
- }
- else if (!have_full_symbols () && !have_partial_symbols ())
- {
- error ("No symbol table is loaded. Use the \"file\" command.");
- }
- else
- {
- error ("No symbol \"%s\" in current context.", simplename);
- }
- }
-
- /* Catch single character tokens which are not part of some
- longer token. */
-
- switch (*lexptr)
- {
- case '.': /* Not float for example. */
- lexptr++;
- while (isspace (*lexptr)) lexptr++;
- simplename = match_simple_name_string ();
- if (!simplename)
- return '.';
- return FIELD_NAME;
- }
-
- return (ILLEGAL_TOKEN);
-}
-
-void
-yyerror (msg)
- char *msg; /* unused */
-{
- printf ("Parsing: %s\n", lexptr);
- if (yychar < 256)
- {
- error ("Invalid syntax in expression near character '%c'.", yychar);
- }
- else
- {
- error ("Invalid syntax in expression");
- }
-}
-#line 1836 "y.tab.c"
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-int
-yyparse()
-{
- register int yym, yyn, yystate;
-#if YYDEBUG
- register char *yys;
- extern char *getenv();
-
- if (yys = getenv("YYDEBUG"))
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = (-1);
-
- yyssp = yyss;
- yyvsp = yyvs;
- *yyssp = yystate = 0;
-
-yyloop:
- if (yyn = yydefred[yystate]) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = yylex()) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
- yychar = (-1);
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-#ifdef lint
- goto yynewerror;
-#endif
-yynewerror:
- yyerror("syntax error");
-#ifdef lint
- goto yyerrlab;
-#endif
-yyerrlab:
- ++yynerrs;
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
-#endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yyssp);
-#endif
- if (yyssp <= yyss) goto yyabort;
- --yyssp;
- --yyvsp;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = (-1);
- goto yyloop;
- }
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- yyval = yyvsp[1-yym];
- switch (yyn)
- {
-case 1:
-#line 312 "./ch-exp.y"
-{ }
-break;
-case 2:
-#line 314 "./ch-exp.y"
-{ write_exp_elt_opcode(OP_TYPE);
- write_exp_elt_type(yyvsp[0].tsym.type);
- write_exp_elt_opcode(OP_TYPE);}
-break;
-case 3:
-#line 320 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 4:
-#line 324 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 5:
-#line 330 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 7:
-#line 339 "./ch-exp.y"
-{
- write_exp_elt_opcode (UNOP_IND);
- }
-break;
-case 8:
-#line 347 "./ch-exp.y"
-{
- write_exp_elt_opcode (OP_VAR_VALUE);
- write_exp_elt_block (NULL);
- write_exp_elt_sym (yyvsp[0].ssym.sym);
- write_exp_elt_opcode (OP_VAR_VALUE);
- }
-break;
-case 9:
-#line 354 "./ch-exp.y"
-{
- write_exp_elt_opcode (OP_LAST);
- write_exp_elt_longcst (yyvsp[0].lval);
- write_exp_elt_opcode (OP_LAST);
- }
-break;
-case 10:
-#line 360 "./ch-exp.y"
-{
- write_exp_elt_opcode (OP_REGISTER);
- write_exp_elt_longcst (yyvsp[0].lval);
- write_exp_elt_opcode (OP_REGISTER);
- }
-break;
-case 11:
-#line 366 "./ch-exp.y"
-{
- write_exp_elt_opcode (OP_INTERNALVAR);
- write_exp_elt_intern (yyvsp[0].ivar);
- write_exp_elt_opcode (OP_INTERNALVAR);
- }
-break;
-case 12:
-#line 372 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 13:
-#line 380 "./ch-exp.y"
-{
- arglist_len = 1;
- }
-break;
-case 14:
-#line 384 "./ch-exp.y"
-{
- arglist_len++;
- }
-break;
-case 15:
-#line 391 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 16:
-#line 395 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 17:
-#line 399 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 18:
-#line 403 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 19:
-#line 407 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 20:
-#line 411 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 21:
-#line 415 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 22:
-#line 419 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 23:
-#line 423 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 24:
-#line 427 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 25:
-#line 431 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 26:
-#line 435 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 27:
-#line 439 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 28:
-#line 443 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 29:
-#line 447 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 30:
-#line 455 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 31:
-#line 463 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 32:
-#line 467 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 33:
-#line 471 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 34:
-#line 475 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 35:
-#line 479 "./ch-exp.y"
-{
- write_exp_elt_opcode (OP_VAR_VALUE);
- write_exp_elt_block (NULL);
- write_exp_elt_sym (yyvsp[0].ssym.sym);
- write_exp_elt_opcode (OP_VAR_VALUE);
- }
-break;
-case 36:
-#line 490 "./ch-exp.y"
-{
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (yyvsp[0].typed_val.type);
- write_exp_elt_longcst ((LONGEST) (yyvsp[0].typed_val.val));
- write_exp_elt_opcode (OP_LONG);
- }
-break;
-case 37:
-#line 497 "./ch-exp.y"
-{
- write_exp_elt_opcode (OP_BOOL);
- write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
- write_exp_elt_opcode (OP_BOOL);
- }
-break;
-case 38:
-#line 503 "./ch-exp.y"
-{
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (yyvsp[0].typed_val.type);
- write_exp_elt_longcst ((LONGEST) (yyvsp[0].typed_val.val));
- write_exp_elt_opcode (OP_LONG);
- }
-break;
-case 39:
-#line 510 "./ch-exp.y"
-{
- write_exp_elt_opcode (OP_DOUBLE);
- write_exp_elt_type (builtin_type_double);
- write_exp_elt_dblcst (yyvsp[0].dval);
- write_exp_elt_opcode (OP_DOUBLE);
- }
-break;
-case 40:
-#line 517 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 41:
-#line 521 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 42:
-#line 525 "./ch-exp.y"
-{
- write_exp_elt_opcode (OP_STRING);
- write_exp_string (yyvsp[0].sval);
- write_exp_elt_opcode (OP_STRING);
- }
-break;
-case 43:
-#line 531 "./ch-exp.y"
-{
- write_exp_elt_opcode (OP_BITSTRING);
- write_exp_bitstring (yyvsp[0].sval);
- write_exp_elt_opcode (OP_BITSTRING);
- }
-break;
-case 44:
-#line 541 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 45:
-#line 550 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 46:
-#line 558 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 47:
-#line 562 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 48:
-#line 572 "./ch-exp.y"
-{ start_arglist (); }
-break;
-case 49:
-#line 574 "./ch-exp.y"
-{
- write_exp_elt_opcode (MULTI_SUBSCRIPT);
- write_exp_elt_longcst ((LONGEST) end_arglist ());
- write_exp_elt_opcode (MULTI_SUBSCRIPT);
- }
-break;
-case 50:
-#line 584 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 51:
-#line 588 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 52:
-#line 596 "./ch-exp.y"
-{ write_exp_elt_opcode (STRUCTOP_STRUCT);
- write_exp_string (yyvsp[0].sval);
- write_exp_elt_opcode (STRUCTOP_STRUCT);
- }
-break;
-case 53:
-#line 605 "./ch-exp.y"
-{
- write_exp_elt_opcode (UNOP_CAST);
- write_exp_elt_type (yyvsp[-1].tsym.type);
- write_exp_elt_opcode (UNOP_CAST);
- }
-break;
-case 54:
-#line 615 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 55:
-#line 623 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 56:
-#line 631 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 57:
-#line 639 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 58:
-#line 647 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 59:
-#line 655 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 60:
-#line 659 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 61:
-#line 663 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 62:
-#line 669 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 63:
-#line 673 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 64:
-#line 679 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 65:
-#line 685 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 66:
-#line 689 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 67:
-#line 695 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 68:
-#line 701 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 69:
-#line 709 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 70:
-#line 713 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_BITWISE_IOR);
- }
-break;
-case 71:
-#line 717 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 72:
-#line 721 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_BITWISE_XOR);
- }
-break;
-case 73:
-#line 729 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 74:
-#line 733 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_BITWISE_AND);
- }
-break;
-case 75:
-#line 737 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 76:
-#line 745 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 77:
-#line 749 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_EQUAL);
- }
-break;
-case 78:
-#line 753 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_NOTEQUAL);
- }
-break;
-case 79:
-#line 757 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_GTR);
- }
-break;
-case 80:
-#line 761 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_GEQ);
- }
-break;
-case 81:
-#line 765 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_LESS);
- }
-break;
-case 82:
-#line 769 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_LEQ);
- }
-break;
-case 83:
-#line 773 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 84:
-#line 782 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 85:
-#line 786 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_ADD);
- }
-break;
-case 86:
-#line 790 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_SUB);
- }
-break;
-case 87:
-#line 794 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_CONCAT);
- }
-break;
-case 88:
-#line 802 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 89:
-#line 806 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_MUL);
- }
-break;
-case 90:
-#line 810 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_DIV);
- }
-break;
-case 91:
-#line 814 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_MOD);
- }
-break;
-case 92:
-#line 818 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_REM);
- }
-break;
-case 93:
-#line 826 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 94:
-#line 830 "./ch-exp.y"
-{
- write_exp_elt_opcode (UNOP_NEG);
- }
-break;
-case 95:
-#line 834 "./ch-exp.y"
-{
- write_exp_elt_opcode (UNOP_LOGICAL_NOT);
- }
-break;
-case 96:
-#line 840 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_CONCAT);
- }
-break;
-case 97:
-#line 848 "./ch-exp.y"
-{
- write_exp_elt_opcode (UNOP_ADDR);
- }
-break;
-case 98:
-#line 852 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 99:
-#line 856 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 100:
-#line 866 "./ch-exp.y"
-{
- write_exp_elt_opcode (BINOP_ASSIGN);
- }
-break;
-case 101:
-#line 875 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 102:
-#line 879 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 103:
-#line 883 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 104:
-#line 887 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 105:
-#line 891 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 106:
-#line 895 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 107:
-#line 899 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 108:
-#line 903 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 109:
-#line 907 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 110:
-#line 911 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 111:
-#line 915 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 112:
-#line 919 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 113:
-#line 925 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 114:
-#line 929 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 115:
-#line 933 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 116:
-#line 937 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 118:
-#line 946 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 119:
-#line 950 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 120:
-#line 956 "./ch-exp.y"
-{
- yyval.voidval = 0; /* FIXME */
- }
-break;
-case 121:
-#line 964 "./ch-exp.y"
-{
- yyval.voidval = 0;
- }
-break;
-case 122:
-#line 972 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 123:
-#line 973 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 124:
-#line 974 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 125:
-#line 975 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 126:
-#line 976 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 127:
-#line 977 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 128:
-#line 978 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 129:
-#line 979 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 130:
-#line 980 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 131:
-#line 981 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 132:
-#line 982 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 133:
-#line 983 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 134:
-#line 984 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 135:
-#line 985 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 136:
-#line 986 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 137:
-#line 987 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 138:
-#line 988 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 139:
-#line 989 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 140:
-#line 990 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-case 141:
-#line 991 "./ch-exp.y"
-{ yyval.voidval = 0; }
-break;
-#line 2799 "y.tab.c"
- }
- yyssp -= yym;
- yystate = *yyssp;
- yyvsp -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yyssp = YYFINAL;
- *++yyvsp = yyval;
- if (yychar < 0)
- {
- if ((yychar = yylex()) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yyssp, yystate);
-#endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate;
- *++yyvsp = yyval;
- goto yyloop;
-yyoverflow:
- yyerror("yacc stack overflow");
-yyabort:
- return (1);
-yyaccept:
- return (0);
-}
diff --git a/gnu/usr.bin/gdb/gdb/freebsd-solib.c b/gnu/usr.bin/gdb/gdb/freebsd-solib.c
deleted file mode 100644
index 5b6e4c0..0000000
--- a/gnu/usr.bin/gdb/gdb/freebsd-solib.c
+++ /dev/null
@@ -1,1469 +0,0 @@
-/* Handle SunOS and SVR4 shared libraries for GDB, the GNU Debugger.
- Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-/* modified for FreeBSD, since the names in link.h are totally different!
- 6.1.94 */
-
-#include "defs.h"
-
-#include <sys/types.h>
-#include <signal.h>
-#include <string.h>
-#ifndef SVR4_SHARED_LIBS
- /* SunOS shared libs need the nlist structure. */
-#include <a.out.h>
-#endif
-#include <link.h>
-#include <sys/param.h>
-#include <fcntl.h>
-
-#include "symtab.h"
-#include "bfd.h"
-#include "symfile.h"
-#include "objfiles.h"
-#include "gdbcore.h"
-#include "command.h"
-#include "target.h"
-#include "frame.h"
-#include "regex.h"
-#include "inferior.h"
-#include "language.h"
-
-#define MAX_PATH_SIZE 256 /* FIXME: Should be dynamic */
-
-/* On SVR4 systems, for the initial implementation, use some runtime startup
- symbol as the "startup mapping complete" breakpoint address. The models
- for SunOS and SVR4 dynamic linking debugger support are different in that
- SunOS hits one breakpoint when all mapping is complete while using the SVR4
- debugger support takes two breakpoint hits for each file mapped, and
- there is no way to know when the "last" one is hit. Both these
- mechanisms should be tied to a "breakpoint service routine" that
- gets automatically executed whenever one of the breakpoints indicating
- a change in mapping is hit. This is a future enhancement. (FIXME) */
-
-#define BKPT_AT_SYMBOL 1
-
-#if defined (BKPT_AT_SYMBOL) && defined (SVR4_SHARED_LIBS)
-static char *bkpt_names[] = {
-#ifdef SOLIB_BKPT_NAME
- SOLIB_BKPT_NAME, /* Prefer configured name if it exists. */
-#endif
- "_start",
- "main",
- NULL
-};
-#endif
-
-/* local data declarations */
-
-#ifndef SVR4_SHARED_LIBS
-
-#define DEBUG_BASE "_DYNAMIC"
-#ifdef OLD_FreeBSD_LD
-#define LM_ADDR(so) ((so) -> lm.lm_addr)
-#define LM_NEXT(so) ((so) -> lm.lm_next)
-#define LM_NAME(so) ((so) -> lm.lm_name)
-static struct link_dynamic dynamic_copy;
-static struct link_dynamic_2 ld_2_copy;
-static struct ld_debug debug_copy;
-#else
-#define LM_ADDR(so) ((so) -> lm.som_addr)
-#define LM_NEXT(so) ((so) -> lm.som_next)
-#define LM_NAME(so) ((so) -> lm.som_path)
-static struct _dynamic dynamic_copy;
-static struct section_dispatch_table ld_2_copy;
-static struct so_debug debug_copy;
-#endif
-static CORE_ADDR debug_addr;
-static CORE_ADDR flag_addr;
-
-#else /* SVR4_SHARED_LIBS */
-
-#define DEBUG_BASE "_r_debug"
-#define LM_ADDR(so) ((so) -> lm.l_addr)
-#define LM_NEXT(so) ((so) -> lm.l_next)
-#define LM_NAME(so) ((so) -> lm.l_name)
-static struct r_debug debug_copy;
-char shadow_contents[BREAKPOINT_MAX]; /* Stash old bkpt addr contents */
-
-#endif /* !SVR4_SHARED_LIBS */
-
-struct so_list {
- struct so_list *next; /* next structure in linked list */
-#ifdef OLD_FreeBSD_LD
- struct link_map lm; /* copy of link map from inferior */
- struct link_map *lmaddr; /* addr in inferior lm was read from */
-#else
- struct so_map lm; /* copy of link map from inferior */
- struct so_map *lmaddr; /* addr in inferior lm was read from */
-#endif
- CORE_ADDR lmend; /* upper addr bound of mapped object */
- char so_name[MAX_PATH_SIZE]; /* shared object lib name (FIXME) */
- char symbols_loaded; /* flag: symbols read in yet? */
- char from_tty; /* flag: print msgs? */
- struct objfile *objfile; /* objfile for loaded lib */
- struct section_table *sections;
- struct section_table *sections_end;
- struct section_table *textsection;
- bfd *abfd;
-};
-
-static struct so_list *so_list_head; /* List of known shared objects */
-static CORE_ADDR debug_base; /* Base of dynamic linker structures */
-static CORE_ADDR breakpoint_addr; /* Address where end bkpt is set */
-
-extern int
-fdmatch PARAMS ((int, int)); /* In libiberty */
-
-/* Local function prototypes */
-
-static void
-special_symbol_handling PARAMS ((struct so_list *));
-
-static void
-sharedlibrary_command PARAMS ((char *, int));
-
-static int
-enable_break PARAMS ((void));
-
-static int
-disable_break PARAMS ((void));
-
-static void
-info_sharedlibrary_command PARAMS ((char *, int));
-
-static int
-symbol_add_stub PARAMS ((char *));
-
-static struct so_list *
-find_solib PARAMS ((struct so_list *));
-
-#ifdef OLD_FreeBSD_LD
-static struct link_map *
-#else
-static struct so_map *
-#endif
-first_link_map_member PARAMS ((void));
-
-static CORE_ADDR
-locate_base PARAMS ((void));
-
-static void
-solib_map_sections PARAMS ((struct so_list *));
-
-#ifdef SVR4_SHARED_LIBS
-
-static int
-look_for_base PARAMS ((int, CORE_ADDR));
-
-static CORE_ADDR
-bfd_lookup_symbol PARAMS ((bfd *, char *));
-
-#else
-
-static void
-solib_add_common_symbols PARAMS ((struct rt_symbol *, struct objfile *));
-
-#endif
-
-/*
-
-LOCAL FUNCTION
-
- solib_map_sections -- open bfd and build sections for shared lib
-
-SYNOPSIS
-
- static void solib_map_sections (struct so_list *so)
-
-DESCRIPTION
-
- Given a pointer to one of the shared objects in our list
- of mapped objects, use the recorded name to open a bfd
- descriptor for the object, build a section table, and then
- relocate all the section addresses by the base address at
- which the shared object was mapped.
-
-FIXMES
-
- In most (all?) cases the shared object file name recorded in the
- dynamic linkage tables will be a fully qualified pathname. For
- cases where it isn't, do we really mimic the systems search
- mechanism correctly in the below code (particularly the tilde
- expansion stuff?).
- */
-
-static void
-solib_map_sections (so)
- struct so_list *so;
-{
- char *filename;
- char *scratch_pathname;
- int scratch_chan;
- struct section_table *p;
- struct cleanup *old_chain;
- bfd *abfd;
-
- filename = tilde_expand (so -> so_name);
- old_chain = make_cleanup (free, filename);
-
- scratch_chan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0,
- &scratch_pathname);
- if (scratch_chan < 0)
- {
- scratch_chan = openp (getenv ("LD_LIBRARY_PATH"), 1, filename,
- O_RDONLY, 0, &scratch_pathname);
- }
- if (scratch_chan < 0)
- {
- perror_with_name (filename);
- }
- /* Leave scratch_pathname allocated. abfd->name will point to it. */
-
- abfd = bfd_fdopenr (scratch_pathname, gnutarget, scratch_chan);
- if (!abfd)
- {
- close (scratch_chan);
- error ("Could not open `%s' as an executable file: %s",
- scratch_pathname, bfd_errmsg (bfd_error));
- }
- /* Leave bfd open, core_xfer_memory and "info files" need it. */
- so -> abfd = abfd;
- abfd -> cacheable = true;
-
- if (!bfd_check_format (abfd, bfd_object))
- {
- error ("\"%s\": not in executable format: %s.",
- scratch_pathname, bfd_errmsg (bfd_error));
- }
- if (build_section_table (abfd, &so -> sections, &so -> sections_end))
- {
- error ("Can't find the file sections in `%s': %s",
- bfd_get_filename (exec_bfd), bfd_errmsg (bfd_error));
- }
-
- for (p = so -> sections; p < so -> sections_end; p++)
- {
- /* Relocate the section binding addresses as recorded in the shared
- object's file by the base address to which the object was actually
- mapped. */
- p -> addr += (CORE_ADDR) LM_ADDR (so);
- p -> endaddr += (CORE_ADDR) LM_ADDR (so);
- so -> lmend = (CORE_ADDR) max (p -> endaddr, so -> lmend);
- if (STREQ (p -> sec_ptr -> name, ".text"))
- {
- so -> textsection = p;
- }
- }
-
- /* Free the file names, close the file now. */
- do_cleanups (old_chain);
-}
-
-/* Read all dynamically loaded common symbol definitions from the inferior
- and add them to the minimal symbol table for the shared library objfile. */
-
-#ifndef SVR4_SHARED_LIBS
-
-/* In GDB 4.9 this routine was a real performance hog. According to
- some gprof data which mtranle@paris.IntelliCorp.COM (Minh Tran-Le)
- sent, almost all the time spend in solib_add (up to 20 minutes with
- 35 shared libraries) was spent here, with 5/6 in
- lookup_minimal_symbol and 1/6 in read_memory.
-
- To fix this, we moved the call to special_symbol_handling out of the
- loop in solib_add, so this only gets called once, rather than once
- for every shared library, and also removed the call to lookup_minimal_symbol
- in this routine. */
-
-static void
-solib_add_common_symbols (rtc_symp, objfile)
- struct rt_symbol *rtc_symp;
- struct objfile *objfile;
-{
- struct rt_symbol inferior_rtc_symb;
- struct nzlist inferior_rtc_nzlist;
- int len;
- char *name;
- char *origname;
-
- init_minimal_symbol_collection ();
- make_cleanup (discard_minimal_symbols, 0);
-
- while (rtc_symp)
- {
- read_memory ((CORE_ADDR) rtc_symp,
- (char *) &inferior_rtc_symb,
- sizeof (inferior_rtc_symb));
- read_memory ((CORE_ADDR) inferior_rtc_symb.rt_sp,
- (char *) &inferior_rtc_nzlist,
- sizeof(inferior_rtc_nzlist));
- if (inferior_rtc_nzlist.nz_type == N_COMM)
- {
- /* FIXME: The length of the symbol name is not available, but in the
- current implementation the common symbol is allocated immediately
- behind the name of the symbol. */
- len = inferior_rtc_nzlist.nz_value - inferior_rtc_nzlist.nz_strx;
-
- origname = name = xmalloc (len);
- read_memory ((CORE_ADDR) inferior_rtc_nzlist.nz_name, name, len);
-
- /* Don't enter the symbol twice if the target is re-run. */
-
- if (name[0] == bfd_get_symbol_leading_char (objfile->obfd))
- {
- name++;
- }
-
-#if 0
- /* I think this is unnecessary, GDB can probably deal with
- duplicate minimal symbols, more or less. And the duplication
- which used to happen because this was called for each shared
- library is gone now that we are just called once. */
- /* FIXME: Do we really want to exclude symbols which happen
- to match symbols for other locations in the inferior's
- address space, even when they are in different linkage units? */
- if (lookup_minimal_symbol (name, (struct objfile *) NULL) == NULL)
-#endif
- {
- name = obsavestring (name, strlen (name),
- &objfile -> symbol_obstack);
- prim_record_minimal_symbol (name, inferior_rtc_nzlist.nz_value,
- mst_bss);
- }
- free (origname);
- }
- rtc_symp = inferior_rtc_symb.rt_next;
- }
-
- /* Install any minimal symbols that have been collected as the current
- minimal symbols for this objfile. */
-
- install_minimal_symbols (objfile);
-}
-
-#endif /* SVR4_SHARED_LIBS */
-
-#ifdef SVR4_SHARED_LIBS
-
-/*
-
-LOCAL FUNCTION
-
- bfd_lookup_symbol -- lookup the value for a specific symbol
-
-SYNOPSIS
-
- CORE_ADDR bfd_lookup_symbol (bfd *abfd, char *symname)
-
-DESCRIPTION
-
- An expensive way to lookup the value of a single symbol for
- bfd's that are only temporary anyway. This is used by the
- shared library support to find the address of the debugger
- interface structures in the shared library.
-
- Note that 0 is specifically allowed as an error return (no
- such symbol).
-
- FIXME: See if there is a less "expensive" way of doing this.
- Also see if there is already another bfd or gdb function
- that specifically does this, and if so, use it.
-*/
-
-static CORE_ADDR
-bfd_lookup_symbol (abfd, symname)
- bfd *abfd;
- char *symname;
-{
- unsigned int storage_needed;
- asymbol *sym;
- asymbol **symbol_table;
- unsigned int number_of_symbols;
- unsigned int i;
- struct cleanup *back_to;
- CORE_ADDR symaddr = 0;
-
- storage_needed = get_symtab_upper_bound (abfd);
-
- if (storage_needed > 0)
- {
- symbol_table = (asymbol **) xmalloc (storage_needed);
- back_to = make_cleanup (free, (PTR)symbol_table);
- number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
-
- for (i = 0; i < number_of_symbols; i++)
- {
- sym = *symbol_table++;
- if (STREQ (sym -> name, symname))
- {
- /* Bfd symbols are section relative. */
- symaddr = sym -> value + sym -> section -> vma;
- break;
- }
- }
- do_cleanups (back_to);
- }
- return (symaddr);
-}
-
-/*
-
-LOCAL FUNCTION
-
- look_for_base -- examine file for each mapped address segment
-
-SYNOPSYS
-
- static int look_for_base (int fd, CORE_ADDR baseaddr)
-
-DESCRIPTION
-
- This function is passed to proc_iterate_over_mappings, which
- causes it to get called once for each mapped address space, with
- an open file descriptor for the file mapped to that space, and the
- base address of that mapped space.
-
- Our job is to find the symbol DEBUG_BASE in the file that this
- fd is open on, if it exists, and if so, initialize the dynamic
- linker structure base address debug_base.
-
- Note that this is a computationally expensive proposition, since
- we basically have to open a bfd on every call, so we specifically
- avoid opening the exec file.
- */
-
-static int
-look_for_base (fd, baseaddr)
- int fd;
- CORE_ADDR baseaddr;
-{
- bfd *interp_bfd;
- CORE_ADDR address;
-
- /* If the fd is -1, then there is no file that corresponds to this
- mapped memory segment, so skip it. Also, if the fd corresponds
- to the exec file, skip it as well. */
-
- if ((fd == -1) || fdmatch (fileno ((FILE *)(exec_bfd -> iostream)), fd))
- {
- return (0);
- }
-
- /* Try to open whatever random file this fd corresponds to. Note that
- we have no way currently to find the filename. Don't gripe about
- any problems we might have, just fail. */
-
- if ((interp_bfd = bfd_fdopenr ("unnamed", gnutarget, fd)) == NULL)
- {
- return (0);
- }
- if (!bfd_check_format (interp_bfd, bfd_object))
- {
- bfd_close (interp_bfd);
- return (0);
- }
-
- /* Now try to find our DEBUG_BASE symbol in this file, which we at
- least know to be a valid ELF executable or shared library. */
-
- if ((address = bfd_lookup_symbol (interp_bfd, DEBUG_BASE)) == 0)
- {
- bfd_close (interp_bfd);
- return (0);
- }
-
- /* Eureka! We found the symbol. But now we may need to relocate it
- by the base address. If the symbol's value is less than the base
- address of the shared library, then it hasn't yet been relocated
- by the dynamic linker, and we have to do it ourself. FIXME: Note
- that we make the assumption that the first segment that corresponds
- to the shared library has the base address to which the library
- was relocated. */
-
- if (address < baseaddr)
- {
- address += baseaddr;
- }
- debug_base = address;
- bfd_close (interp_bfd);
- return (1);
-}
-
-#endif
-
-/*
-
-LOCAL FUNCTION
-
- locate_base -- locate the base address of dynamic linker structs
-
-SYNOPSIS
-
- CORE_ADDR locate_base (void)
-
-DESCRIPTION
-
- For both the SunOS and SVR4 shared library implementations, if the
- inferior executable has been linked dynamically, there is a single
- address somewhere in the inferior's data space which is the key to
- locating all of the dynamic linker's runtime structures. This
- address is the value of the symbol defined by the macro DEBUG_BASE.
- The job of this function is to find and return that address, or to
- return 0 if there is no such address (the executable is statically
- linked for example).
-
- For SunOS, the job is almost trivial, since the dynamic linker and
- all of it's structures are statically linked to the executable at
- link time. Thus the symbol for the address we are looking for has
- already been added to the minimal symbol table for the executable's
- objfile at the time the symbol file's symbols were read, and all we
- have to do is look it up there. Note that we explicitly do NOT want
- to find the copies in the shared library.
-
- The SVR4 version is much more complicated because the dynamic linker
- and it's structures are located in the shared C library, which gets
- run as the executable's "interpreter" by the kernel. We have to go
- to a lot more work to discover the address of DEBUG_BASE. Because
- of this complexity, we cache the value we find and return that value
- on subsequent invocations. Note there is no copy in the executable
- symbol tables.
-
- Note that we can assume nothing about the process state at the time
- we need to find this address. We may be stopped on the first instruc-
- tion of the interpreter (C shared library), the first instruction of
- the executable itself, or somewhere else entirely (if we attached
- to the process for example).
-
- */
-
-static CORE_ADDR
-locate_base ()
-{
-
-#ifndef SVR4_SHARED_LIBS
-
- struct minimal_symbol *msymbol;
- CORE_ADDR address = 0;
-
- /* For SunOS, we want to limit the search for DEBUG_BASE to the executable
- being debugged, since there is a duplicate named symbol in the shared
- library. We don't want the shared library versions. */
-
- msymbol = lookup_minimal_symbol (DEBUG_BASE, symfile_objfile);
- if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
- {
- address = SYMBOL_VALUE_ADDRESS (msymbol);
- }
- return (address);
-
-#else /* SVR4_SHARED_LIBS */
-
- /* Check to see if we have a currently valid address, and if so, avoid
- doing all this work again and just return the cached address. If
- we have no cached address, ask the /proc support interface to iterate
- over the list of mapped address segments, calling look_for_base() for
- each segment. When we are done, we will have either found the base
- address or not. */
-
- if (debug_base == 0)
- {
- proc_iterate_over_mappings (look_for_base);
- }
- return (debug_base);
-
-#endif /* !SVR4_SHARED_LIBS */
-
-}
-
-/*
-
-LOCAL FUNCTION
-
- first_link_map_member -- locate first member in dynamic linker's map
-
-SYNOPSIS
-
- static struct link_map *first_link_map_member (void)
-
-DESCRIPTION
-
- Read in a copy of the first member in the inferior's dynamic
- link map from the inferior's dynamic linker structures, and return
- a pointer to the copy in our address space.
-*/
-
-#ifdef OLD_FreeBSD_LD
-static struct link_map *
-#else
-static struct so_map *
-#endif
-first_link_map_member ()
-{
-#ifdef OLD_FreeBSD_LD
- struct link_map *lm = NULL;
-#else
- struct so_map *lm = NULL;
-#endif
-
-#ifndef SVR4_SHARED_LIBS
-
- read_memory (debug_base, (char *) &dynamic_copy, sizeof (dynamic_copy));
-#ifdef OLD_FreeBSD_LD
- if (dynamic_copy.ld_version >= 2)
- {
- /* It is a version that we can deal with, so read in the secondary
- structure and find the address of the link map list from it. */
- read_memory ((CORE_ADDR) dynamic_copy.ld_un.ld_2, (char *) &ld_2_copy,
- sizeof (struct link_dynamic_2));
- lm = ld_2_copy.ld_loaded;
- }
-#else
- if (dynamic_copy.d_version >= 2)
- {
- /* It is a version that we can deal with, so read in the secondary
- structure and find the address of the link map list from it. */
- read_memory ((CORE_ADDR) dynamic_copy.d_un.d_sdt, (char *) &ld_2_copy,
- sizeof (struct section_dispatch_table));
- lm = ld_2_copy.sdt_loaded;
- }
-#endif
-#else /* SVR4_SHARED_LIBS */
-
- read_memory (debug_base, (char *) &debug_copy, sizeof (struct r_debug));
- /* FIXME: Perhaps we should validate the info somehow, perhaps by
- checking r_version for a known version number, or r_state for
- RT_CONSISTENT. */
- lm = debug_copy.r_map;
-
-#endif /* !SVR4_SHARED_LIBS */
-
- return (lm);
-}
-
-/*
-
-LOCAL FUNCTION
-
- find_solib -- step through list of shared objects
-
-SYNOPSIS
-
- struct so_list *find_solib (struct so_list *so_list_ptr)
-
-DESCRIPTION
-
- This module contains the routine which finds the names of any
- loaded "images" in the current process. The argument in must be
- NULL on the first call, and then the returned value must be passed
- in on subsequent calls. This provides the capability to "step" down
- the list of loaded objects. On the last object, a NULL value is
- returned.
-
- The arg and return value are "struct link_map" pointers, as defined
- in <link.h>.
- */
-
-static struct so_list *
-find_solib (so_list_ptr)
- struct so_list *so_list_ptr; /* Last lm or NULL for first one */
-{
- struct so_list *so_list_next = NULL;
-#ifdef OLD_FreeBSD_LD
- struct link_map *lm = NULL;
-#else
- struct so_map *lm = NULL;
-#endif
- struct so_list *new;
-
- if (so_list_ptr == NULL)
- {
- /* We are setting up for a new scan through the loaded images. */
- if ((so_list_next = so_list_head) == NULL)
- {
- /* We have not already read in the dynamic linking structures
- from the inferior, lookup the address of the base structure. */
- debug_base = locate_base ();
- if (debug_base != 0)
- {
- /* Read the base structure in and find the address of the first
- link map list member. */
- lm = first_link_map_member ();
- }
- }
- }
- else
- {
- /* We have been called before, and are in the process of walking
- the shared library list. Advance to the next shared object. */
- if ((lm = LM_NEXT (so_list_ptr)) == NULL)
- {
- /* We have hit the end of the list, so check to see if any were
- added, but be quiet if we can't read from the target any more. */
- int status = target_read_memory ((CORE_ADDR) so_list_ptr -> lmaddr,
- (char *) &(so_list_ptr -> lm),
-#ifdef OLD_FreeBSD_LD
- sizeof (struct link_map));
-#else
- sizeof (struct so_map));
-#endif
- if (status == 0)
- {
- lm = LM_NEXT (so_list_ptr);
- }
- else
- {
- lm = NULL;
- }
- }
- so_list_next = so_list_ptr -> next;
- }
- if ((so_list_next == NULL) && (lm != NULL))
- {
- /* Get next link map structure from inferior image and build a local
- abbreviated load_map structure */
- new = (struct so_list *) xmalloc (sizeof (struct so_list));
- memset ((char *) new, 0, sizeof (struct so_list));
- new -> lmaddr = lm;
- /* Add the new node as the next node in the list, or as the root
- node if this is the first one. */
- if (so_list_ptr != NULL)
- {
- so_list_ptr -> next = new;
- }
- else
- {
- so_list_head = new;
- }
- so_list_next = new;
- read_memory ((CORE_ADDR) lm, (char *) &(new -> lm),
-#ifdef OLD_FreeBSD_LD
- sizeof (struct link_map));
-#else
- sizeof (struct so_map));
-#endif
- /* For the SVR4 version, there is one entry that has no name
- (for the inferior executable) since it is not a shared object. */
- if (LM_NAME (new) != 0)
- {
- if (!target_read_string((CORE_ADDR) LM_NAME (new), new -> so_name,
- MAX_PATH_SIZE - 1))
- error ("find_solib: Can't read pathname for load map\n");
- new -> so_name[MAX_PATH_SIZE - 1] = 0;
- solib_map_sections (new);
- }
- }
- return (so_list_next);
-}
-
-/* A small stub to get us past the arg-passing pinhole of catch_errors. */
-
-static int
-symbol_add_stub (arg)
- char *arg;
-{
- register struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */
-
- so -> objfile = symbol_file_add (so -> so_name, so -> from_tty,
- (unsigned int) so -> textsection -> addr,
- 0, 0, 0);
- return (1);
-}
-
-/*
-
-GLOBAL FUNCTION
-
- solib_add -- add a shared library file to the symtab and section list
-
-SYNOPSIS
-
- void solib_add (char *arg_string, int from_tty,
- struct target_ops *target)
-
-DESCRIPTION
-
-*/
-
-void
-solib_add (arg_string, from_tty, target)
- char *arg_string;
- int from_tty;
- struct target_ops *target;
-{
- register struct so_list *so = NULL; /* link map state variable */
-
- /* Last shared library that we read. */
- struct so_list *so_last = NULL;
-
- char *re_err;
- int count;
- int old;
-
- if ((re_err = re_comp (arg_string ? arg_string : ".")) != NULL)
- {
- error ("Invalid regexp: %s", re_err);
- }
-
- /* Getting new symbols may change our opinion about what is
- frameless. */
- reinit_frame_cache ();
-
- while ((so = find_solib (so)) != NULL)
- {
- if (so -> so_name[0] && re_exec (so -> so_name))
- {
- so -> from_tty = from_tty;
- if (so -> symbols_loaded)
- {
- if (from_tty)
- {
- printf ("Symbols already loaded for %s\n", so -> so_name);
- }
- }
- else if (catch_errors
- (symbol_add_stub, (char *) so,
- "Error while reading shared library symbols:\n",
- RETURN_MASK_ALL))
- {
- so_last = so;
- so -> symbols_loaded = 1;
- }
- }
- }
-
- /* Now add the shared library sections to the section table of the
- specified target, if any. */
- if (target)
- {
- /* Count how many new section_table entries there are. */
- so = NULL;
- count = 0;
- while ((so = find_solib (so)) != NULL)
- {
- if (so -> so_name[0])
- {
- count += so -> sections_end - so -> sections;
- }
- }
-
- if (count)
- {
- /* Reallocate the target's section table including the new size. */
- if (target -> to_sections)
- {
- old = target -> to_sections_end - target -> to_sections;
- target -> to_sections = (struct section_table *)
- xrealloc ((char *)target -> to_sections,
- (sizeof (struct section_table)) * (count + old));
- }
- else
- {
- old = 0;
- target -> to_sections = (struct section_table *)
- xmalloc ((sizeof (struct section_table)) * count);
- }
- target -> to_sections_end = target -> to_sections + (count + old);
-
- /* Add these section table entries to the target's table. */
- while ((so = find_solib (so)) != NULL)
- {
- if (so -> so_name[0])
- {
- count = so -> sections_end - so -> sections;
- memcpy ((char *) (target -> to_sections + old),
- so -> sections,
- (sizeof (struct section_table)) * count);
- old += count;
- }
- }
- }
- }
-
- /* Calling this once at the end means that we put all the minimal
- symbols for commons into the objfile for the last shared library.
- Since they are in common, this should not be a problem. If we
- delete the objfile with the minimal symbols, we can put all the
- symbols into a new objfile (and will on the next call to solib_add).
-
- An alternate approach would be to create an objfile just for
- common minsyms, thus not needing any objfile argument to
- solib_add_common_symbols. */
-
- if (so_last)
- special_symbol_handling (so_last);
-}
-
-/*
-
-LOCAL FUNCTION
-
- info_sharedlibrary_command -- code for "info sharedlibrary"
-
-SYNOPSIS
-
- static void info_sharedlibrary_command ()
-
-DESCRIPTION
-
- Walk through the shared library list and print information
- about each attached library.
-*/
-
-static void
-info_sharedlibrary_command (ignore, from_tty)
- char *ignore;
- int from_tty;
-{
- register struct so_list *so = NULL; /* link map state variable */
- int header_done = 0;
-
- if (exec_bfd == NULL)
- {
- printf ("No exec file.\n");
- return;
- }
- while ((so = find_solib (so)) != NULL)
- {
- if (so -> so_name[0])
- {
- if (!header_done)
- {
- printf("%-12s%-12s%-12s%s\n", "From", "To", "Syms Read",
- "Shared Object Library");
- header_done++;
- }
- printf ("%-12s",
- local_hex_string_custom ((unsigned long) LM_ADDR (so),
- "08l"));
- printf ("%-12s",
- local_hex_string_custom ((unsigned long) so -> lmend,
- "08l"));
- printf ("%-12s", so -> symbols_loaded ? "Yes" : "No");
- printf ("%s\n", so -> so_name);
- }
- }
- if (so_list_head == NULL)
- {
- printf ("No shared libraries loaded at this time.\n");
- }
-}
-
-/*
-
-GLOBAL FUNCTION
-
- solib_address -- check to see if an address is in a shared lib
-
-SYNOPSIS
-
- int solib_address (CORE_ADDR address)
-
-DESCRIPTION
-
- Provides a hook for other gdb routines to discover whether or
- not a particular address is within the mapped address space of
- a shared library. Any address between the base mapping address
- and the first address beyond the end of the last mapping, is
- considered to be within the shared library address space, for
- our purposes.
-
- For example, this routine is called at one point to disable
- breakpoints which are in shared libraries that are not currently
- mapped in.
- */
-
-int
-solib_address (address)
- CORE_ADDR address;
-{
- register struct so_list *so = 0; /* link map state variable */
-
- while ((so = find_solib (so)) != NULL)
- {
- if (so -> so_name[0])
- {
- if ((address >= (CORE_ADDR) LM_ADDR (so)) &&
- (address < (CORE_ADDR) so -> lmend))
- {
- return (1);
- }
- }
- }
- return (0);
-}
-
-/* Called by free_all_symtabs */
-
-void
-clear_solib()
-{
- struct so_list *next;
- char *bfd_filename;
-
- while (so_list_head)
- {
- if (so_list_head -> sections)
- {
- free ((PTR)so_list_head -> sections);
- }
- if (so_list_head -> abfd)
- {
- bfd_filename = bfd_get_filename (so_list_head -> abfd);
- bfd_close (so_list_head -> abfd);
- }
- else
- /* This happens for the executable on SVR4. */
- bfd_filename = NULL;
-
- next = so_list_head -> next;
- if (bfd_filename)
- free ((PTR)bfd_filename);
- free ((PTR)so_list_head);
- so_list_head = next;
- }
- debug_base = 0;
-}
-
-/*
-
-LOCAL FUNCTION
-
- disable_break -- remove the "mapping changed" breakpoint
-
-SYNOPSIS
-
- static int disable_break ()
-
-DESCRIPTION
-
- Removes the breakpoint that gets hit when the dynamic linker
- completes a mapping change.
-
-*/
-
-static int
-disable_break ()
-{
- int status = 1;
-
-#ifndef SVR4_SHARED_LIBS
-
- int in_debugger = 0;
-
- /* Read the debugger structure from the inferior to retrieve the
- address of the breakpoint and the original contents of the
- breakpoint address. Remove the breakpoint by writing the original
- contents back. */
-
- read_memory (debug_addr, (char *) &debug_copy, sizeof (debug_copy));
-
- /* Set `in_debugger' to zero now. */
-
- write_memory (flag_addr, (char *) &in_debugger, sizeof (in_debugger));
-
-#ifdef OLD_FreeBSD_LD
- breakpoint_addr = (CORE_ADDR) debug_copy.ldd_bp_addr;
- write_memory (breakpoint_addr, (char *) &debug_copy.ldd_bp_inst,
- sizeof (debug_copy.ldd_bp_inst));
-#else
- breakpoint_addr = (CORE_ADDR) debug_copy.dd_bpt_addr;
- write_memory (breakpoint_addr, (char *) &debug_copy.dd_bpt_shadow,
- sizeof (debug_copy.dd_bpt_shadow));
-#endif
-
-#else /* SVR4_SHARED_LIBS */
-
- /* Note that breakpoint address and original contents are in our address
- space, so we just need to write the original contents back. */
-
- if (memory_remove_breakpoint (breakpoint_addr, shadow_contents) != 0)
- {
- status = 0;
- }
-
-#endif /* !SVR4_SHARED_LIBS */
-
- /* For the SVR4 version, we always know the breakpoint address. For the
- SunOS version we don't know it until the above code is executed.
- Grumble if we are stopped anywhere besides the breakpoint address. */
-
- if (stop_pc != breakpoint_addr)
- {
- warning ("stopped at unknown breakpoint while handling shared libraries");
- }
-
- return (status);
-}
-
-/*
-
-LOCAL FUNCTION
-
- enable_break -- arrange for dynamic linker to hit breakpoint
-
-SYNOPSIS
-
- int enable_break (void)
-
-DESCRIPTION
-
- Both the SunOS and the SVR4 dynamic linkers have, as part of their
- debugger interface, support for arranging for the inferior to hit
- a breakpoint after mapping in the shared libraries. This function
- enables that breakpoint.
-
- For SunOS, there is a special flag location (in_debugger) which we
- set to 1. When the dynamic linker sees this flag set, it will set
- a breakpoint at a location known only to itself, after saving the
- original contents of that place and the breakpoint address itself,
- in it's own internal structures. When we resume the inferior, it
- will eventually take a SIGTRAP when it runs into the breakpoint.
- We handle this (in a different place) by restoring the contents of
- the breakpointed location (which is only known after it stops),
- chasing around to locate the shared libraries that have been
- loaded, then resuming.
-
- For SVR4, the debugger interface structure contains a member (r_brk)
- which is statically initialized at the time the shared library is
- built, to the offset of a function (_r_debug_state) which is guaran-
- teed to be called once before mapping in a library, and again when
- the mapping is complete. At the time we are examining this member,
- it contains only the unrelocated offset of the function, so we have
- to do our own relocation. Later, when the dynamic linker actually
- runs, it relocates r_brk to be the actual address of _r_debug_state().
-
- The debugger interface structure also contains an enumeration which
- is set to either RT_ADD or RT_DELETE prior to changing the mapping,
- depending upon whether or not the library is being mapped or unmapped,
- and then set to RT_CONSISTENT after the library is mapped/unmapped.
-*/
-
-static int
-enable_break ()
-{
- int success = 0;
-
-#ifndef SVR4_SHARED_LIBS
-
- int j;
- int in_debugger;
-
- /* Get link_dynamic structure */
-
- j = target_read_memory (debug_base, (char *) &dynamic_copy,
- sizeof (dynamic_copy));
- if (j)
- {
- /* unreadable */
- return (0);
- }
-
- /* Calc address of debugger interface structure */
-
-#ifdef OLD_FreeBSD_LD
- debug_addr = (CORE_ADDR) dynamic_copy.ldd;
-#else
- debug_addr = (CORE_ADDR) dynamic_copy.d_debug;
-#endif
-
- /* Calc address of `in_debugger' member of debugger interface structure */
-
-#ifdef OLD_FreeBSD_LD
- flag_addr = debug_addr + (CORE_ADDR) ((char *) &debug_copy.ldd_in_debugger -
- (char *) &debug_copy);
-#else
- flag_addr = debug_addr + (CORE_ADDR) ((char *) &debug_copy.dd_in_debugger -
- (char *) &debug_copy);
-#endif
-
- /* Write a value of 1 to this member. */
-
- in_debugger = 1;
- write_memory (flag_addr, (char *) &in_debugger, sizeof (in_debugger));
- success = 1;
-
-#else /* SVR4_SHARED_LIBS */
-
-#ifdef BKPT_AT_SYMBOL
-
- struct minimal_symbol *msymbol;
- char **bkpt_namep;
- CORE_ADDR bkpt_addr;
-
- /* Scan through the list of symbols, trying to look up the symbol and
- set a breakpoint there. Terminate loop when we/if we succeed. */
-
- breakpoint_addr = 0;
- for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++)
- {
- msymbol = lookup_minimal_symbol (*bkpt_namep, symfile_objfile);
- if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
- {
- bkpt_addr = SYMBOL_VALUE_ADDRESS (msymbol);
- if (target_insert_breakpoint (bkpt_addr, shadow_contents) == 0)
- {
- breakpoint_addr = bkpt_addr;
- success = 1;
- break;
- }
- }
- }
-
-#else /* !BKPT_AT_SYMBOL */
-
- struct symtab_and_line sal;
-
- /* Read the debugger interface structure directly. */
-
- read_memory (debug_base, (char *) &debug_copy, sizeof (debug_copy));
-
- /* Set breakpoint at the debugger interface stub routine that will
- be called just prior to each mapping change and again after the
- mapping change is complete. Set up the (nonexistent) handler to
- deal with hitting these breakpoints. (FIXME). */
-
- warning ("'%s': line %d: missing SVR4 support code", __FILE__, __LINE__);
- success = 1;
-
-#endif /* BKPT_AT_SYMBOL */
-
-#endif /* !SVR4_SHARED_LIBS */
-
- return (success);
-}
-
-/*
-
-GLOBAL FUNCTION
-
- solib_create_inferior_hook -- shared library startup support
-
-SYNOPSIS
-
- void solib_create_inferior_hook()
-
-DESCRIPTION
-
- When gdb starts up the inferior, it nurses it along (through the
- shell) until it is ready to execute it's first instruction. At this
- point, this function gets called via expansion of the macro
- SOLIB_CREATE_INFERIOR_HOOK.
-
- For SunOS executables, this first instruction is typically the
- one at "_start", or a similar text label, regardless of whether
- the executable is statically or dynamically linked. The runtime
- startup code takes care of dynamically linking in any shared
- libraries, once gdb allows the inferior to continue.
-
- For SVR4 executables, this first instruction is either the first
- instruction in the dynamic linker (for dynamically linked
- executables) or the instruction at "start" for statically linked
- executables. For dynamically linked executables, the system
- first exec's /lib/libc.so.N, which contains the dynamic linker,
- and starts it running. The dynamic linker maps in any needed
- shared libraries, maps in the actual user executable, and then
- jumps to "start" in the user executable.
-
- For both SunOS shared libraries, and SVR4 shared libraries, we
- can arrange to cooperate with the dynamic linker to discover the
- names of shared libraries that are dynamically linked, and the
- base addresses to which they are linked.
-
- This function is responsible for discovering those names and
- addresses, and saving sufficient information about them to allow
- their symbols to be read at a later time.
-
-FIXME
-
- Between enable_break() and disable_break(), this code does not
- properly handle hitting breakpoints which the user might have
- set in the startup code or in the dynamic linker itself. Proper
- handling will probably have to wait until the implementation is
- changed to use the "breakpoint handler function" method.
-
- Also, what if child has exit()ed? Must exit loop somehow.
- */
-
-void
-solib_create_inferior_hook()
-{
- /* If we are using the BKPT_AT_SYMBOL code, then we don't need the base
- yet. In fact, in the case of a SunOS4 executable being run on
- Solaris, we can't get it yet. find_solib will get it when it needs
- it. */
-#if !(defined (SVR4_SHARED_LIBS) && defined (BKPT_AT_SYMBOL))
- if ((debug_base = locate_base ()) == 0)
- {
- /* Can't find the symbol or the executable is statically linked. */
- return;
- }
-#endif
-
- if (!enable_break ())
- {
- warning ("shared library handler failed to enable breakpoint");
- return;
- }
-
- /* Now run the target. It will eventually hit the breakpoint, at
- which point all of the libraries will have been mapped in and we
- can go groveling around in the dynamic linker structures to find
- out what we need to know about them. */
-
- clear_proceed_status ();
- stop_soon_quietly = 1;
- stop_signal = 0;
- do
- {
- target_resume (-1, 0, stop_signal);
- wait_for_inferior ();
- }
- while (stop_signal != SIGTRAP);
- stop_soon_quietly = 0;
-
- /* We are now either at the "mapping complete" breakpoint (or somewhere
- else, a condition we aren't prepared to deal with anyway), so adjust
- the PC as necessary after a breakpoint, disable the breakpoint, and
- add any shared libraries that were mapped in. */
-
- if (DECR_PC_AFTER_BREAK)
- {
- stop_pc -= DECR_PC_AFTER_BREAK;
- write_register (PC_REGNUM, stop_pc);
- }
-
- if (!disable_break ())
- {
- warning ("shared library handler failed to disable breakpoint");
- }
-
- solib_add ((char *) 0, 0, (struct target_ops *) 0);
-}
-
-/*
-
-LOCAL FUNCTION
-
- special_symbol_handling -- additional shared library symbol handling
-
-SYNOPSIS
-
- void special_symbol_handling (struct so_list *so)
-
-DESCRIPTION
-
- Once the symbols from a shared object have been loaded in the usual
- way, we are called to do any system specific symbol handling that
- is needed.
-
- For Suns, this consists of grunging around in the dynamic linkers
- structures to find symbol definitions for "common" symbols and
- adding them to the minimal symbol table for the corresponding
- objfile.
-
-*/
-
-static void
-special_symbol_handling (so)
-struct so_list *so;
-{
-#ifndef SVR4_SHARED_LIBS
- int j;
-
- if (debug_addr == 0)
- {
- /* Get link_dynamic structure */
-
- j = target_read_memory (debug_base, (char *) &dynamic_copy,
- sizeof (dynamic_copy));
- if (j)
- {
- /* unreadable */
- return;
- }
-
- /* Calc address of debugger interface structure */
- /* FIXME, this needs work for cross-debugging of core files
- (byteorder, size, alignment, etc). */
-
-#ifdef OLD_FreeBSD_LD
- debug_addr = (CORE_ADDR) dynamic_copy.ldd;
-#else
- debug_addr = (CORE_ADDR) dynamic_copy.d_debug;
-#endif
- }
-
- /* Read the debugger structure from the inferior, just to make sure
- we have a current copy. */
-
- j = target_read_memory (debug_addr, (char *) &debug_copy,
- sizeof (debug_copy));
- if (j)
- return; /* unreadable */
-
- /* Get common symbol definitions for the loaded object. */
-
-#ifdef OLD_FreeBSD_LD
- if (debug_copy.ldd_cp)
- {
- solib_add_common_symbols (debug_copy.ldd_cp, so -> objfile);
- }
-#else
- if (debug_copy.dd_cc)
- {
- solib_add_common_symbols (debug_copy.dd_cc, so -> objfile);
- }
-#endif
-
-#endif /* !SVR4_SHARED_LIBS */
-}
-
-
-/*
-
-LOCAL FUNCTION
-
- sharedlibrary_command -- handle command to explicitly add library
-
-SYNOPSIS
-
- static void sharedlibrary_command (char *args, int from_tty)
-
-DESCRIPTION
-
-*/
-
-static void
-sharedlibrary_command (args, from_tty)
-char *args;
-int from_tty;
-{
- dont_repeat ();
- solib_add (args, from_tty, (struct target_ops *) 0);
-}
-
-void
-_initialize_solib()
-{
-
- add_com ("sharedlibrary", class_files, sharedlibrary_command,
- "Load shared object library symbols for files matching REGEXP.");
- add_info ("sharedlibrary", info_sharedlibrary_command,
- "Status of loaded shared object libraries.");
-}
diff --git a/gnu/usr.bin/gdb/gdb/m2-exp.tab.c b/gnu/usr.bin/gdb/gdb/m2-exp.tab.c
deleted file mode 100644
index 53b1385..0000000
--- a/gnu/usr.bin/gdb/gdb/m2-exp.tab.c
+++ /dev/null
@@ -1,1991 +0,0 @@
-#ifndef lint
-static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define yyclearin (yychar=(-1))
-#define yyerrok (yyerrflag=0)
-#define YYRECOVERING (yyerrflag!=0)
-#define yyparse m2_parse
-#define yylex m2_lex
-#define yyerror m2_error
-#define yychar m2_char
-#define yyval m2_val
-#define yylval m2_lval
-#define yydebug m2_debug
-#define yynerrs m2_nerrs
-#define yyerrflag m2_errflag
-#define yyss m2_ss
-#define yyssp m2_ssp
-#define yyvs m2_vs
-#define yyvsp m2_vsp
-#define yylhs m2_lhs
-#define yylen m2_len
-#define yydefred m2_defred
-#define yydgoto m2_dgoto
-#define yysindex m2_sindex
-#define yyrindex m2_rindex
-#define yygindex m2_gindex
-#define yytable m2_table
-#define yycheck m2_check
-#define yyname m2_name
-#define yyrule m2_rule
-#define YYPREFIX "m2_"
-#line 40 "./m2-exp.y"
-
-#include "defs.h"
-#include "expression.h"
-#include "language.h"
-#include "value.h"
-#include "parser-defs.h"
-#include "m2-lang.h"
-
-/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
- as well as gratuitiously global symbol names, so we can have multiple
- yacc generated parsers in gdb. Note that these are only the variables
- produced by yacc. If other parser generators (bison, byacc, etc) produce
- additional global names that conflict at link time, then those parser
- generators need to be fixed instead of adding those names to this list. */
-
-#define yymaxdepth m2_maxdepth
-#define yyparse m2_parse
-#define yylex m2_lex
-#define yyerror m2_error
-#define yylval m2_lval
-#define yychar m2_char
-#define yydebug m2_debug
-#define yypact m2_pact
-#define yyr1 m2_r1
-#define yyr2 m2_r2
-#define yydef m2_def
-#define yychk m2_chk
-#define yypgo m2_pgo
-#define yyact m2_act
-#define yyexca m2_exca
-#define yyerrflag m2_errflag
-#define yynerrs m2_nerrs
-#define yyps m2_ps
-#define yypv m2_pv
-#define yys m2_s
-#define yy_yys m2_yys
-#define yystate m2_state
-#define yytmp m2_tmp
-#define yyv m2_v
-#define yy_yyv m2_yyv
-#define yyval m2_val
-#define yylloc m2_lloc
-#define yyreds m2_reds /* With YYDEBUG defined */
-#define yytoks m2_toks /* With YYDEBUG defined */
-
-#ifndef YYDEBUG
-#define YYDEBUG 0 /* Default to no yydebug support */
-#endif
-
-int
-yyparse PARAMS ((void));
-
-static int
-yylex PARAMS ((void));
-
-void
-yyerror PARAMS ((char *));
-
-#if 0
-static char *
-make_qualname PARAMS ((char *, char *));
-#endif
-
-static int
-parse_number PARAMS ((int));
-
-/* The sign of the number being parsed. */
-static int number_sign = 1;
-
-/* The block that the module specified by the qualifer on an identifer is
- contained in, */
-#if 0
-static struct block *modblock=0;
-#endif
-
-#line 121 "./m2-exp.y"
-typedef union
- {
- LONGEST lval;
- unsigned LONGEST ulval;
- double dval;
- struct symbol *sym;
- struct type *tval;
- struct stoken sval;
- int voidval;
- struct block *bval;
- enum exp_opcode opcode;
- struct internalvar *ivar;
-
- struct type **tvec;
- int *ivec;
- } YYSTYPE;
-#line 129 "y.tab.c"
-#define INT 257
-#define HEX 258
-#define ERROR 259
-#define UINT 260
-#define M2_TRUE 261
-#define M2_FALSE 262
-#define CHAR 263
-#define FLOAT 264
-#define STRING 265
-#define NAME 266
-#define BLOCKNAME 267
-#define IDENT 268
-#define VARNAME 269
-#define TYPENAME 270
-#define SIZE 271
-#define CAP 272
-#define ORD 273
-#define HIGH 274
-#define ABS 275
-#define MIN_FUNC 276
-#define MAX_FUNC 277
-#define FLOAT_FUNC 278
-#define VAL 279
-#define CHR 280
-#define ODD 281
-#define TRUNC 282
-#define INC 283
-#define DEC 284
-#define INCL 285
-#define EXCL 286
-#define COLONCOLON 287
-#define LAST 288
-#define REGNAME 289
-#define INTERNAL_VAR 290
-#define ABOVE_COMMA 291
-#define ASSIGN 292
-#define LEQ 293
-#define GEQ 294
-#define NOTEQUAL 295
-#define IN 296
-#define OROR 297
-#define LOGICAL_AND 298
-#define DIV 299
-#define MOD 300
-#define UNARY 301
-#define DOT 302
-#define NOT 303
-#define QID 304
-#define YYERRCODE 256
-short m2_lhs[] = { -1,
- 0, 0, 2, 1, 8, 1, 1, 1, 9, 9,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 3, 3, 12, 1, 13, 1, 10, 10, 10,
- 11, 11, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 6, 7, 7, 4, 4, 4, 4,
- 5,
-};
-short m2_len[] = { 2,
- 1, 1, 1, 2, 0, 3, 2, 2, 1, 1,
- 4, 4, 4, 4, 4, 4, 4, 6, 4, 4,
- 4, 2, 4, 6, 4, 6, 3, 1, 3, 6,
- 6, 3, 4, 0, 5, 0, 5, 0, 1, 3,
- 1, 3, 4, 4, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 4, 1, 1, 1, 3, 1, 1, 3, 1,
- 1,
-};
-short m2_defred[] = { 0,
- 65, 66, 63, 64, 67, 68, 73, 80, 75, 81,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 70, 71, 78, 0,
- 5, 0, 9, 10, 0, 0, 0, 2, 28, 69,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 4, 0, 34, 36,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 45, 0, 0, 32, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 29, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 27, 0, 0, 0, 0,
- 79, 76, 72, 11, 12, 14, 13, 15, 16, 17,
- 0, 19, 20, 21, 0, 23, 0, 25, 0, 0,
- 0, 0, 0, 0, 0, 44, 33, 0, 0, 0,
- 0, 0, 0, 35, 37, 18, 24, 26, 30, 31,
- 0,
-};
-short m2_dgoto[] = { 36,
- 66, 38, 39, 40, 47, 42, 43, 64, 44, 68,
- 164, 137, 138,
-};
-short m2_sindex[] = { 1597,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1779, -27, -21, -15, -10, -6, -3, -2, 18, 20,
- 24, 31, 38, 39, 59, 77, 0, 0, 0, 1597,
- 0, 1597, 0, 0, 1597, 0, 1670, 0, 0, 0,
- -26, -256, 0, 1597, 1597, -24, -26, 1597, 1597, 1597,
- 1597, -218, -218, 1597, -218, 1597, 1597, 1597, 1597, 1597,
- 1597, 1597, -24, 1597, 939, 1670, -37, -17, 1597, 1597,
- 1597, 1597, 1597, 1597, 1597, 1597, -118, 1597, 1597, 1597,
- 1597, 1597, 1597, 1597, 1597, 1597, 0, -186, 0, 0,
- 1597, 1597, -259, -24, -30, 967, 1002, 1044, 1079, 78,
- 83, 1160, 74, 1268, 1323, 1351, 866, 894, 1183, 1404,
- -24, 0, 1597, 1597, 0, 1727, -25, -25, -25, -25,
- -25, -25, -25, 1597, 0, 8, 80, 192, 117, 49,
- 49, -24, -24, -24, -24, 0, 1597, 1597, 1449, -11,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1597, 0, 0, 0, 1597, 0, 1597, 0, 1597, 1597,
- -24, 1670, 1670, -44, -20, 0, 0, 1484, 1512, 1547,
- 1617, 1628, 1597, 0, 0, 0, 0, 0, 0, 0,
- 1670,
-};
-short m2_rindex[] = { 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, -9, 0, 121, 0, 0, 0,
- 135, 0, 1, 0, 0, 12, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 40, 0, 0, -35, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, -9, 0, 68, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 106, 0, 0, 0, 0, 98, 568, 575, 598, 653,
- 677, 779, 838, -9, 0, 0, 561, 539, 502, 465,
- 489, 134, 145, 220, 411, 0, 0, -12, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 435, -18, -42, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- -16,
-};
-short m2_gindex[] = { 0,
- 2066, 0, 61, 0, 341, 0, 0, 0, 0, -88,
- 0, 0, 0,
-};
-#define YYTABLESIZE 2239
-short m2_table[] = { 173,
- 77, 41, 91, 140, 124, 39, 141, 142, 39, 91,
- 143, 22, 48, 91, 90, 90, 83, 81, 49, 82,
- 175, 84, 40, 114, 50, 40, 114, 42, 38, 51,
- 93, 38, 114, 52, 38, 77, 53, 54, 80, 7,
- 77, 77, 77, 77, 77, 77, 22, 77, 174, 165,
- 41, 10, 22, 22, 22, 22, 22, 55, 22, 56,
- 77, 77, 77, 57, 77, 89, 89, 8, 87, 87,
- 58, 22, 22, 22, 7, 22, 42, 59, 60, 136,
- 7, 7, 7, 7, 7, 92, 7, 113, 90, 39,
- 83, 77, 92, 77, 77, 84, 92, 62, 61, 7,
- 7, 7, 8, 7, 22, 6, 40, 115, 8, 8,
- 8, 8, 8, 167, 8, 38, 62, 151, 148, 90,
- 1, 83, 81, 149, 82, 77, 84, 8, 8, 8,
- 92, 8, 7, 47, 3, 0, 22, 125, 62, 89,
- 6, 62, 87, 80, 48, 0, 6, 6, 6, 6,
- 6, 10, 6, 0, 0, 0, 90, 0, 83, 81,
- 8, 82, 0, 84, 7, 6, 6, 6, 47, 6,
- 89, 0, 0, 87, 47, 47, 47, 47, 47, 48,
- 47, 0, 0, 0, 0, 48, 48, 48, 48, 48,
- 62, 48, 8, 47, 47, 47, 0, 47, 6, 0,
- 0, 0, 0, 0, 48, 48, 48, 89, 48, 0,
- 87, 0, 0, 0, 0, 0, 0, 0, 0, 49,
- 0, 0, 62, 0, 0, 0, 47, 0, 0, 0,
- 6, 90, 0, 83, 81, 0, 82, 48, 84, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 49, 80, 0, 0, 47, 0,
- 49, 49, 49, 49, 49, 0, 49, 0, 0, 48,
- 0, 78, 79, 85, 86, 0, 88, 88, 0, 49,
- 49, 49, 89, 49, 0, 87, 0, 74, 0, 0,
- 0, 0, 77, 77, 77, 77, 77, 77, 77, 77,
- 77, 0, 77, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 49, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 41, 0, 0, 0, 49, 0, 0, 85, 86, 0,
- 88, 0, 0, 0, 0, 0, 0, 0, 0, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 0, 0,
- 0, 0, 0, 0, 0, 67, 0, 79, 85, 86,
- 0, 88, 0, 0, 0, 95, 0, 0, 0, 0,
- 0, 0, 100, 101, 0, 103, 0, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 0, 0, 0, 0,
- 50, 0, 0, 0, 0, 85, 86, 126, 88, 0,
- 0, 0, 0, 0, 0, 47, 47, 47, 47, 47,
- 47, 47, 47, 47, 43, 0, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 50, 0, 0, 0, 0,
- 0, 50, 50, 50, 50, 50, 0, 50, 0, 0,
- 0, 0, 0, 0, 51, 0, 0, 0, 0, 43,
- 50, 50, 50, 0, 50, 43, 43, 43, 43, 43,
- 0, 43, 0, 0, 0, 0, 0, 0, 52, 0,
- 85, 86, 0, 88, 43, 43, 43, 0, 43, 51,
- 0, 46, 0, 50, 0, 51, 0, 51, 51, 51,
- 0, 49, 49, 49, 49, 49, 49, 49, 49, 49,
- 0, 0, 0, 52, 51, 51, 51, 43, 51, 52,
- 0, 52, 52, 52, 0, 50, 46, 0, 60, 0,
- 0, 0, 46, 0, 0, 46, 0, 0, 52, 52,
- 52, 0, 52, 0, 0, 0, 0, 51, 0, 43,
- 61, 46, 46, 46, 0, 46, 0, 58, 0, 0,
- 0, 0, 0, 60, 59, 0, 0, 0, 0, 60,
- 0, 52, 60, 0, 0, 0, 0, 0, 0, 51,
- 0, 0, 0, 0, 46, 61, 0, 56, 60, 60,
- 60, 61, 58, 0, 61, 0, 0, 0, 58, 59,
- 0, 58, 0, 52, 0, 59, 0, 0, 59, 0,
- 61, 61, 61, 0, 0, 0, 46, 58, 58, 58,
- 0, 60, 56, 0, 59, 59, 59, 0, 56, 0,
- 0, 56, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 57, 61, 0, 0, 0, 56, 56, 56,
- 58, 0, 0, 60, 0, 0, 0, 59, 0, 0,
- 0, 0, 0, 0, 0, 0, 53, 0, 0, 0,
- 0, 0, 0, 0, 0, 61, 0, 57, 0, 0,
- 56, 0, 58, 57, 0, 0, 57, 0, 0, 59,
- 0, 0, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 53, 57, 57, 57, 0, 0, 53, 0, 0,
- 53, 0, 56, 0, 0, 0, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 0, 53, 53, 53, 0,
- 0, 0, 0, 0, 0, 57, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 51, 51, 51, 51,
- 51, 51, 51, 0, 0, 0, 0, 0, 0, 53,
- 0, 0, 0, 0, 0, 0, 0, 57, 54, 0,
- 52, 52, 52, 52, 52, 52, 52, 0, 0, 0,
- 0, 0, 0, 46, 46, 46, 46, 46, 46, 46,
- 0, 53, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 54, 0, 0, 0, 0, 0, 54,
- 0, 0, 54, 0, 0, 0, 0, 0, 0, 0,
- 60, 60, 60, 60, 60, 60, 60, 55, 54, 54,
- 54, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 61, 61, 61, 61, 61, 61, 0, 58,
- 58, 58, 58, 58, 0, 0, 59, 59, 59, 59,
- 59, 54, 55, 0, 0, 0, 0, 0, 55, 0,
- 0, 55, 0, 0, 0, 0, 0, 0, 0, 56,
- 56, 56, 56, 56, 0, 0, 0, 55, 55, 55,
- 76, 0, 0, 54, 0, 90, 156, 83, 81, 155,
- 82, 0, 84, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 70, 74, 71, 76, 80,
- 55, 0, 0, 90, 158, 83, 81, 157, 82, 0,
- 84, 0, 0, 0, 57, 57, 57, 57, 57, 0,
- 0, 0, 0, 70, 74, 71, 89, 80, 0, 87,
- 0, 0, 55, 0, 0, 0, 0, 0, 53, 53,
- 53, 53, 53, 76, 0, 0, 0, 0, 90, 112,
- 83, 81, 0, 82, 89, 84, 0, 87, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 70, 74,
- 71, 76, 80, 0, 0, 0, 90, 144, 83, 81,
- 0, 82, 0, 84, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 70, 74, 71, 89,
- 80, 0, 87, 0, 0, 0, 76, 0, 0, 0,
- 0, 90, 145, 83, 81, 0, 82, 0, 84, 0,
- 0, 0, 0, 0, 0, 0, 0, 89, 0, 0,
- 87, 70, 74, 71, 0, 80, 0, 0, 0, 0,
- 54, 54, 54, 54, 54, 0, 0, 0, 76, 0,
- 0, 0, 0, 90, 146, 83, 81, 0, 82, 0,
- 84, 0, 89, 0, 0, 87, 0, 0, 0, 0,
- 0, 0, 0, 70, 74, 71, 0, 80, 0, 0,
- 0, 0, 0, 76, 0, 0, 0, 0, 90, 147,
- 83, 81, 0, 82, 0, 84, 0, 0, 0, 55,
- 55, 55, 55, 55, 89, 0, 0, 87, 70, 74,
- 71, 0, 80, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 69, 72, 73,
- 75, 77, 78, 79, 85, 86, 0, 88, 0, 89,
- 0, 0, 87, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 69, 72, 73, 75, 77,
- 78, 79, 85, 86, 76, 88, 0, 0, 0, 90,
- 150, 83, 81, 0, 82, 0, 84, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 76, 0, 70,
- 74, 71, 90, 80, 83, 81, 159, 82, 0, 84,
- 69, 72, 73, 75, 77, 78, 79, 85, 86, 0,
- 88, 0, 70, 74, 71, 0, 80, 0, 0, 0,
- 89, 0, 0, 87, 0, 0, 0, 0, 69, 72,
- 73, 75, 77, 78, 79, 85, 86, 0, 88, 0,
- 0, 0, 0, 89, 0, 0, 87, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 69, 72, 73, 75, 77, 78, 79,
- 85, 86, 76, 88, 0, 0, 0, 90, 152, 83,
- 81, 0, 82, 0, 84, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 70, 74, 71,
- 0, 80, 0, 0, 0, 69, 72, 73, 75, 77,
- 78, 79, 85, 86, 0, 88, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 76, 89, 0,
- 0, 87, 90, 153, 83, 81, 0, 82, 0, 84,
- 69, 72, 73, 75, 77, 78, 79, 85, 86, 0,
- 88, 0, 70, 74, 71, 76, 80, 0, 0, 0,
- 90, 154, 83, 81, 0, 82, 0, 84, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 70, 74, 71, 89, 80, 0, 87, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 76, 0,
- 0, 89, 0, 90, 87, 83, 81, 160, 82, 0,
- 84, 69, 72, 73, 75, 77, 78, 79, 85, 86,
- 0, 88, 0, 70, 74, 71, 0, 80, 0, 0,
- 0, 0, 0, 0, 69, 72, 73, 75, 77, 78,
- 79, 85, 86, 76, 88, 0, 0, 0, 90, 166,
- 83, 81, 0, 82, 89, 84, 0, 87, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 70, 74,
- 71, 0, 80, 0, 0, 0, 0, 0, 76, 0,
- 0, 0, 0, 90, 176, 83, 81, 0, 82, 0,
- 84, 0, 0, 0, 0, 0, 0, 0, 0, 89,
- 0, 0, 87, 70, 74, 71, 76, 80, 0, 0,
- 0, 90, 177, 83, 81, 0, 82, 0, 84, 69,
- 72, 73, 75, 77, 78, 79, 85, 86, 0, 88,
- 0, 70, 74, 71, 89, 80, 0, 87, 0, 0,
- 0, 76, 0, 0, 0, 0, 90, 178, 83, 81,
- 0, 82, 0, 84, 0, 0, 0, 0, 0, 0,
- 0, 0, 89, 0, 0, 87, 70, 74, 71, 0,
- 80, 0, 0, 0, 69, 72, 73, 75, 77, 78,
- 79, 85, 86, 0, 88, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 32, 89, 0, 30,
- 87, 31, 69, 72, 73, 75, 77, 78, 79, 85,
- 86, 76, 88, 0, 0, 0, 90, 179, 83, 81,
- 0, 82, 76, 84, 0, 0, 0, 90, 180, 83,
- 81, 0, 82, 0, 84, 0, 70, 74, 71, 0,
- 80, 0, 0, 0, 0, 0, 0, 70, 74, 71,
- 0, 80, 0, 0, 0, 69, 72, 73, 75, 77,
- 78, 79, 85, 86, 76, 88, 0, 89, 0, 90,
- 87, 83, 81, 0, 82, 0, 84, 0, 89, 35,
- 0, 87, 34, 0, 0, 0, 0, 0, 0, 70,
- 74, 71, 0, 80, 0, 0, 0, 0, 0, 0,
- 69, 72, 73, 75, 77, 78, 79, 85, 86, 0,
- 88, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 89, 76, 0, 87, 0, 0, 90, 0, 83, 81,
- 0, 82, 0, 84, 0, 69, 72, 73, 75, 77,
- 78, 79, 85, 86, 0, 88, 70, 74, 71, 0,
- 80, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 69, 72, 73, 75, 77, 78, 79,
- 85, 86, 0, 88, 0, 0, 0, 89, 45, 0,
- 87, 30, 0, 31, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 69, 72,
- 73, 75, 77, 78, 79, 85, 86, 0, 88, 0,
- 0, 0, 0, 1, 0, 0, 2, 3, 4, 5,
- 6, 7, 8, 9, 0, 0, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 0, 27, 28, 29, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 33,
- 0, 35, 0, 0, 34, 0, 0, 0, 69, 72,
- 73, 75, 77, 78, 79, 85, 86, 0, 88, 69,
- 72, 73, 75, 77, 78, 79, 85, 86, 0, 88,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 69, 72, 73, 75, 77, 78, 79, 85, 86,
- 0, 88, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 72,
- 73, 75, 77, 78, 79, 85, 86, 0, 88, 0,
- 0, 0, 0, 0, 0, 1, 0, 0, 2, 3,
- 4, 5, 6, 7, 8, 9, 0, 0, 10, 11,
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 37, 27, 28, 29, 0,
- 0, 0, 0, 0, 0, 0, 46, 0, 0, 0,
- 0, 33, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 63, 0, 65, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
- 65, 0, 0, 96, 97, 98, 99, 0, 0, 102,
- 0, 104, 105, 106, 107, 108, 109, 110, 0, 111,
- 0, 0, 0, 0, 116, 117, 118, 119, 120, 121,
- 122, 123, 0, 127, 128, 129, 130, 131, 132, 133,
- 134, 135, 0, 0, 0, 0, 139, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 161, 162,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 163, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 168, 0, 0, 0,
- 169, 0, 170, 0, 171, 172, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 181,
-};
-short m2_check[] = { 44,
- 0, 44, 40, 92, 123, 41, 266, 267, 44, 40,
- 41, 0, 40, 40, 40, 40, 42, 43, 40, 45,
- 41, 47, 41, 44, 40, 44, 44, 44, 41, 40,
- 287, 44, 44, 40, 44, 35, 40, 40, 64, 0,
- 40, 41, 42, 43, 44, 45, 35, 47, 93, 138,
- 93, 270, 41, 42, 43, 44, 45, 40, 47, 40,
- 60, 61, 62, 40, 64, 91, 91, 0, 94, 94,
- 40, 60, 61, 62, 35, 64, 93, 40, 40, 266,
- 41, 42, 43, 44, 45, 123, 47, 125, 40, 125,
- 42, 91, 123, 93, 94, 47, 123, 0, 40, 60,
- 61, 62, 35, 64, 93, 0, 125, 125, 41, 42,
- 43, 44, 45, 125, 47, 125, 40, 44, 41, 40,
- 0, 42, 43, 41, 45, 125, 47, 60, 61, 62,
- 123, 64, 93, 0, 0, -1, 125, 77, 41, 91,
- 35, 44, 94, 64, 0, -1, 41, 42, 43, 44,
- 45, 270, 47, -1, -1, -1, 40, -1, 42, 43,
- 93, 45, -1, 47, 125, 60, 61, 62, 35, 64,
- 91, -1, -1, 94, 41, 42, 43, 44, 45, 35,
- 47, -1, -1, -1, -1, 41, 42, 43, 44, 45,
- 93, 47, 125, 60, 61, 62, -1, 64, 93, -1,
- -1, -1, -1, -1, 60, 61, 62, 91, 64, -1,
- 94, -1, -1, -1, -1, -1, -1, -1, -1, 0,
- -1, -1, 125, -1, -1, -1, 93, -1, -1, -1,
- 125, 40, -1, 42, 43, -1, 45, 93, 47, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 35, 64, -1, -1, 125, -1,
- 41, 42, 43, 44, 45, -1, 47, -1, -1, 125,
- -1, 297, 298, 299, 300, -1, 302, 302, -1, 60,
- 61, 62, 91, 64, -1, 94, -1, 287, -1, -1,
- -1, -1, 292, 293, 294, 295, 296, 297, 298, 299,
- 300, -1, 302, 292, 293, 294, 295, 296, 297, 298,
- 299, 300, 93, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 292, 293, 294, 295, 296, 297, 298, 299, 300,
- 0, -1, -1, -1, 125, -1, -1, 299, 300, -1,
- 302, -1, -1, -1, -1, -1, -1, -1, -1, 292,
- 293, 294, 295, 296, 297, 298, 299, 300, -1, -1,
- -1, -1, -1, -1, -1, 35, -1, 298, 299, 300,
- -1, 302, -1, -1, -1, 45, -1, -1, -1, -1,
- -1, -1, 52, 53, -1, 55, -1, 292, 293, 294,
- 295, 296, 297, 298, 299, 300, -1, -1, -1, -1,
- 0, -1, -1, -1, -1, 299, 300, 77, 302, -1,
- -1, -1, -1, -1, -1, 292, 293, 294, 295, 296,
- 297, 298, 299, 300, 0, -1, 292, 293, 294, 295,
- 296, 297, 298, 299, 300, 35, -1, -1, -1, -1,
- -1, 41, 42, 43, 44, 45, -1, 47, -1, -1,
- -1, -1, -1, -1, 0, -1, -1, -1, -1, 35,
- 60, 61, 62, -1, 64, 41, 42, 43, 44, 45,
- -1, 47, -1, -1, -1, -1, -1, -1, 0, -1,
- 299, 300, -1, 302, 60, 61, 62, -1, 64, 35,
- -1, 0, -1, 93, -1, 41, -1, 43, 44, 45,
- -1, 292, 293, 294, 295, 296, 297, 298, 299, 300,
- -1, -1, -1, 35, 60, 61, 62, 93, 64, 41,
- -1, 43, 44, 45, -1, 125, 35, -1, 0, -1,
- -1, -1, 41, -1, -1, 44, -1, -1, 60, 61,
- 62, -1, 64, -1, -1, -1, -1, 93, -1, 125,
- 0, 60, 61, 62, -1, 64, -1, 0, -1, -1,
- -1, -1, -1, 35, 0, -1, -1, -1, -1, 41,
- -1, 93, 44, -1, -1, -1, -1, -1, -1, 125,
- -1, -1, -1, -1, 93, 35, -1, 0, 60, 61,
- 62, 41, 35, -1, 44, -1, -1, -1, 41, 35,
- -1, 44, -1, 125, -1, 41, -1, -1, 44, -1,
- 60, 61, 62, -1, -1, -1, 125, 60, 61, 62,
- -1, 93, 35, -1, 60, 61, 62, -1, 41, -1,
- -1, 44, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 0, 93, -1, -1, -1, 60, 61, 62,
- 93, -1, -1, 125, -1, -1, -1, 93, -1, -1,
- -1, -1, -1, -1, -1, -1, 0, -1, -1, -1,
- -1, -1, -1, -1, -1, 125, -1, 35, -1, -1,
- 93, -1, 125, 41, -1, -1, 44, -1, -1, 125,
- -1, -1, 292, 293, 294, 295, 296, 297, 298, 299,
- 300, 35, 60, 61, 62, -1, -1, 41, -1, -1,
- 44, -1, 125, -1, -1, -1, 292, 293, 294, 295,
- 296, 297, 298, 299, 300, -1, 60, 61, 62, -1,
- -1, -1, -1, -1, -1, 93, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 292, 293, 294, 295,
- 296, 297, 298, -1, -1, -1, -1, -1, -1, 93,
- -1, -1, -1, -1, -1, -1, -1, 125, 0, -1,
- 292, 293, 294, 295, 296, 297, 298, -1, -1, -1,
- -1, -1, -1, 292, 293, 294, 295, 296, 297, 298,
- -1, 125, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 35, -1, -1, -1, -1, -1, 41,
- -1, -1, 44, -1, -1, -1, -1, -1, -1, -1,
- 292, 293, 294, 295, 296, 297, 298, 0, 60, 61,
- 62, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 292, 293, 294, 295, 296, 297, -1, 292,
- 293, 294, 295, 296, -1, -1, 292, 293, 294, 295,
- 296, 93, 35, -1, -1, -1, -1, -1, 41, -1,
- -1, 44, -1, -1, -1, -1, -1, -1, -1, 292,
- 293, 294, 295, 296, -1, -1, -1, 60, 61, 62,
- 35, -1, -1, 125, -1, 40, 41, 42, 43, 44,
- 45, -1, 47, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 60, 61, 62, 35, 64,
- 93, -1, -1, 40, 41, 42, 43, 44, 45, -1,
- 47, -1, -1, -1, 292, 293, 294, 295, 296, -1,
- -1, -1, -1, 60, 61, 62, 91, 64, -1, 94,
- -1, -1, 125, -1, -1, -1, -1, -1, 292, 293,
- 294, 295, 296, 35, -1, -1, -1, -1, 40, 41,
- 42, 43, -1, 45, 91, 47, -1, 94, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 60, 61,
- 62, 35, 64, -1, -1, -1, 40, 41, 42, 43,
- -1, 45, -1, 47, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 60, 61, 62, 91,
- 64, -1, 94, -1, -1, -1, 35, -1, -1, -1,
- -1, 40, 41, 42, 43, -1, 45, -1, 47, -1,
- -1, -1, -1, -1, -1, -1, -1, 91, -1, -1,
- 94, 60, 61, 62, -1, 64, -1, -1, -1, -1,
- 292, 293, 294, 295, 296, -1, -1, -1, 35, -1,
- -1, -1, -1, 40, 41, 42, 43, -1, 45, -1,
- 47, -1, 91, -1, -1, 94, -1, -1, -1, -1,
- -1, -1, -1, 60, 61, 62, -1, 64, -1, -1,
- -1, -1, -1, 35, -1, -1, -1, -1, 40, 41,
- 42, 43, -1, 45, -1, 47, -1, -1, -1, 292,
- 293, 294, 295, 296, 91, -1, -1, 94, 60, 61,
- 62, -1, 64, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 292, 293, 294,
- 295, 296, 297, 298, 299, 300, -1, 302, -1, 91,
- -1, -1, 94, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 292, 293, 294, 295, 296,
- 297, 298, 299, 300, 35, 302, -1, -1, -1, 40,
- 41, 42, 43, -1, 45, -1, 47, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 35, -1, 60,
- 61, 62, 40, 64, 42, 43, 44, 45, -1, 47,
- 292, 293, 294, 295, 296, 297, 298, 299, 300, -1,
- 302, -1, 60, 61, 62, -1, 64, -1, -1, -1,
- 91, -1, -1, 94, -1, -1, -1, -1, 292, 293,
- 294, 295, 296, 297, 298, 299, 300, -1, 302, -1,
- -1, -1, -1, 91, -1, -1, 94, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 292, 293, 294, 295, 296, 297, 298,
- 299, 300, 35, 302, -1, -1, -1, 40, 41, 42,
- 43, -1, 45, -1, 47, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 60, 61, 62,
- -1, 64, -1, -1, -1, 292, 293, 294, 295, 296,
- 297, 298, 299, 300, -1, 302, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 35, 91, -1,
- -1, 94, 40, 41, 42, 43, -1, 45, -1, 47,
- 292, 293, 294, 295, 296, 297, 298, 299, 300, -1,
- 302, -1, 60, 61, 62, 35, 64, -1, -1, -1,
- 40, 41, 42, 43, -1, 45, -1, 47, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 60, 61, 62, 91, 64, -1, 94, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 35, -1,
- -1, 91, -1, 40, 94, 42, 43, 44, 45, -1,
- 47, 292, 293, 294, 295, 296, 297, 298, 299, 300,
- -1, 302, -1, 60, 61, 62, -1, 64, -1, -1,
- -1, -1, -1, -1, 292, 293, 294, 295, 296, 297,
- 298, 299, 300, 35, 302, -1, -1, -1, 40, 41,
- 42, 43, -1, 45, 91, 47, -1, 94, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 60, 61,
- 62, -1, 64, -1, -1, -1, -1, -1, 35, -1,
- -1, -1, -1, 40, 41, 42, 43, -1, 45, -1,
- 47, -1, -1, -1, -1, -1, -1, -1, -1, 91,
- -1, -1, 94, 60, 61, 62, 35, 64, -1, -1,
- -1, 40, 41, 42, 43, -1, 45, -1, 47, 292,
- 293, 294, 295, 296, 297, 298, 299, 300, -1, 302,
- -1, 60, 61, 62, 91, 64, -1, 94, -1, -1,
- -1, 35, -1, -1, -1, -1, 40, 41, 42, 43,
- -1, 45, -1, 47, -1, -1, -1, -1, -1, -1,
- -1, -1, 91, -1, -1, 94, 60, 61, 62, -1,
- 64, -1, -1, -1, 292, 293, 294, 295, 296, 297,
- 298, 299, 300, -1, 302, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 40, 91, -1, 43,
- 94, 45, 292, 293, 294, 295, 296, 297, 298, 299,
- 300, 35, 302, -1, -1, -1, 40, 41, 42, 43,
- -1, 45, 35, 47, -1, -1, -1, 40, 41, 42,
- 43, -1, 45, -1, 47, -1, 60, 61, 62, -1,
- 64, -1, -1, -1, -1, -1, -1, 60, 61, 62,
- -1, 64, -1, -1, -1, 292, 293, 294, 295, 296,
- 297, 298, 299, 300, 35, 302, -1, 91, -1, 40,
- 94, 42, 43, -1, 45, -1, 47, -1, 91, 123,
- -1, 94, 126, -1, -1, -1, -1, -1, -1, 60,
- 61, 62, -1, 64, -1, -1, -1, -1, -1, -1,
- 292, 293, 294, 295, 296, 297, 298, 299, 300, -1,
- 302, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 91, 35, -1, 94, -1, -1, 40, -1, 42, 43,
- -1, 45, -1, 47, -1, 292, 293, 294, 295, 296,
- 297, 298, 299, 300, -1, 302, 60, 61, 62, -1,
- 64, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 292, 293, 294, 295, 296, 297, 298,
- 299, 300, -1, 302, -1, -1, -1, 91, 40, -1,
- 94, 43, -1, 45, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 292, 293,
- 294, 295, 296, 297, 298, 299, 300, -1, 302, -1,
- -1, -1, -1, 257, -1, -1, 260, 261, 262, 263,
- 264, 265, 266, 267, -1, -1, 270, 271, 272, 273,
- 274, 275, 276, 277, 278, 279, 280, 281, 282, 283,
- 284, 285, 286, -1, 288, 289, 290, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 303,
- -1, 123, -1, -1, 126, -1, -1, -1, 292, 293,
- 294, 295, 296, 297, 298, 299, 300, -1, 302, 292,
- 293, 294, 295, 296, 297, 298, 299, 300, -1, 302,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 292, 293, 294, 295, 296, 297, 298, 299, 300,
- -1, 302, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 293,
- 294, 295, 296, 297, 298, 299, 300, -1, 302, -1,
- -1, -1, -1, -1, -1, 257, -1, -1, 260, 261,
- 262, 263, 264, 265, 266, 267, -1, -1, 270, 271,
- 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
- 282, 283, 284, 285, 286, 0, 288, 289, 290, -1,
- -1, -1, -1, -1, -1, -1, 11, -1, -1, -1,
- -1, 303, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 30, -1, 32, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 44,
- 45, -1, -1, 48, 49, 50, 51, -1, -1, 54,
- -1, 56, 57, 58, 59, 60, 61, 62, -1, 64,
- -1, -1, -1, -1, 69, 70, 71, 72, 73, 74,
- 75, 76, -1, 78, 79, 80, 81, 82, 83, 84,
- 85, 86, -1, -1, -1, -1, 91, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 113, 114,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 137, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 151, -1, -1, -1,
- 155, -1, 157, -1, 159, 160, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 173,
-};
-#define YYFINAL 36
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 304
-#if YYDEBUG
-char *m2_name[] = {
-"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,"'#'",0,0,"'&'",0,"'('","')'","'*'","'+'","','","'-'",0,"'/'",0,0,0,0,0,0,0,0,
-0,0,0,0,"'<'","'='","'>'",0,"'@'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,"'['",0,"']'","'^'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,"'{'",0,"'}'","'~'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"INT","HEX","ERROR","UINT","M2_TRUE",
-"M2_FALSE","CHAR","FLOAT","STRING","NAME","BLOCKNAME","IDENT","VARNAME",
-"TYPENAME","SIZE","CAP","ORD","HIGH","ABS","MIN_FUNC","MAX_FUNC","FLOAT_FUNC",
-"VAL","CHR","ODD","TRUNC","INC","DEC","INCL","EXCL","COLONCOLON","LAST",
-"REGNAME","INTERNAL_VAR","ABOVE_COMMA","ASSIGN","LEQ","GEQ","NOTEQUAL","IN",
-"OROR","LOGICAL_AND","DIV","MOD","UNARY","DOT","NOT","QID",
-};
-char *m2_rule[] = {
-"$accept : start",
-"start : exp",
-"start : type_exp",
-"type_exp : type",
-"exp : exp '^'",
-"$$1 :",
-"exp : '-' $$1 exp",
-"exp : '+' exp",
-"exp : not_exp exp",
-"not_exp : NOT",
-"not_exp : '~'",
-"exp : CAP '(' exp ')'",
-"exp : ORD '(' exp ')'",
-"exp : ABS '(' exp ')'",
-"exp : HIGH '(' exp ')'",
-"exp : MIN_FUNC '(' type ')'",
-"exp : MAX_FUNC '(' type ')'",
-"exp : FLOAT_FUNC '(' exp ')'",
-"exp : VAL '(' type ',' exp ')'",
-"exp : CHR '(' exp ')'",
-"exp : ODD '(' exp ')'",
-"exp : TRUNC '(' exp ')'",
-"exp : SIZE exp",
-"exp : INC '(' exp ')'",
-"exp : INC '(' exp ',' exp ')'",
-"exp : DEC '(' exp ')'",
-"exp : DEC '(' exp ',' exp ')'",
-"exp : exp DOT NAME",
-"exp : set",
-"exp : exp IN set",
-"exp : INCL '(' exp ',' exp ')'",
-"exp : EXCL '(' exp ',' exp ')'",
-"set : '{' arglist '}'",
-"set : type '{' arglist '}'",
-"$$2 :",
-"exp : exp '[' $$2 non_empty_arglist ']'",
-"$$3 :",
-"exp : exp '(' $$3 arglist ')'",
-"arglist :",
-"arglist : exp",
-"arglist : arglist ',' exp",
-"non_empty_arglist : exp",
-"non_empty_arglist : non_empty_arglist ',' exp",
-"exp : '{' type '}' exp",
-"exp : type '(' exp ')'",
-"exp : '(' exp ')'",
-"exp : exp '@' exp",
-"exp : exp '*' exp",
-"exp : exp '/' exp",
-"exp : exp DIV exp",
-"exp : exp MOD exp",
-"exp : exp '+' exp",
-"exp : exp '-' exp",
-"exp : exp '=' exp",
-"exp : exp NOTEQUAL exp",
-"exp : exp '#' exp",
-"exp : exp LEQ exp",
-"exp : exp GEQ exp",
-"exp : exp '<' exp",
-"exp : exp '>' exp",
-"exp : exp LOGICAL_AND exp",
-"exp : exp OROR exp",
-"exp : exp ASSIGN exp",
-"exp : M2_TRUE",
-"exp : M2_FALSE",
-"exp : INT",
-"exp : UINT",
-"exp : CHAR",
-"exp : FLOAT",
-"exp : variable",
-"exp : LAST",
-"exp : REGNAME",
-"exp : SIZE '(' type ')'",
-"exp : STRING",
-"block : fblock",
-"fblock : BLOCKNAME",
-"fblock : block COLONCOLON BLOCKNAME",
-"variable : fblock",
-"variable : INTERNAL_VAR",
-"variable : block COLONCOLON NAME",
-"variable : NAME",
-"type : TYPENAME",
-};
-#endif
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 500
-#define YYMAXDEPTH 500
-#endif
-#endif
-int yydebug;
-int yynerrs;
-int yyerrflag;
-int yychar;
-short *yyssp;
-YYSTYPE *yyvsp;
-YYSTYPE yyval;
-YYSTYPE yylval;
-short yyss[YYSTACKSIZE];
-YYSTYPE yyvs[YYSTACKSIZE];
-#define yystacksize YYSTACKSIZE
-#line 658 "./m2-exp.y"
-
-#if 0 /* FIXME! */
-int
-overflow(a,b)
- long a,b;
-{
- return (MAX_OF_TYPE(builtin_type_m2_int) - b) < a;
-}
-
-int
-uoverflow(a,b)
- unsigned long a,b;
-{
- return (MAX_OF_TYPE(builtin_type_m2_card) - b) < a;
-}
-#endif /* FIXME */
-
-/* Take care of parsing a number (anything that starts with a digit).
- Set yylval and return the token type; update lexptr.
- LEN is the number of characters in it. */
-
-/*** Needs some error checking for the float case ***/
-
-static int
-parse_number (olen)
- int olen;
-{
- register char *p = lexptr;
- register LONGEST n = 0;
- register LONGEST prevn = 0;
- register int c,i,ischar=0;
- register int base = input_radix;
- register int len = olen;
- int unsigned_p = number_sign == 1 ? 1 : 0;
-
- if(p[len-1] == 'H')
- {
- base = 16;
- len--;
- }
- else if(p[len-1] == 'C' || p[len-1] == 'B')
- {
- base = 8;
- ischar = p[len-1] == 'C';
- len--;
- }
-
- /* Scan the number */
- for (c = 0; c < len; c++)
- {
- if (p[c] == '.' && base == 10)
- {
- /* It's a float since it contains a point. */
- yylval.dval = atof (p);
- lexptr += len;
- return FLOAT;
- }
- if (p[c] == '.' && base != 10)
- error("Floating point numbers must be base 10.");
- if (base == 10 && (p[c] < '0' || p[c] > '9'))
- error("Invalid digit \'%c\' in number.",p[c]);
- }
-
- while (len-- > 0)
- {
- c = *p++;
- n *= base;
- if( base == 8 && (c == '8' || c == '9'))
- error("Invalid digit \'%c\' in octal number.",c);
- if (c >= '0' && c <= '9')
- i = c - '0';
- else
- {
- if (base == 16 && c >= 'A' && c <= 'F')
- i = c - 'A' + 10;
- else
- return ERROR;
- }
- n+=i;
- if(i >= base)
- return ERROR;
- if(!unsigned_p && number_sign == 1 && (prevn >= n))
- unsigned_p=1; /* Try something unsigned */
- /* Don't do the range check if n==i and i==0, since that special
- case will give an overflow error. */
- if(RANGE_CHECK && n!=i && i)
- {
- if((unsigned_p && (unsigned)prevn >= (unsigned)n) ||
- ((!unsigned_p && number_sign==-1) && -prevn <= -n))
- range_error("Overflow on numeric constant.");
- }
- prevn=n;
- }
-
- lexptr = p;
- if(*p == 'B' || *p == 'C' || *p == 'H')
- lexptr++; /* Advance past B,C or H */
-
- if (ischar)
- {
- yylval.ulval = n;
- return CHAR;
- }
- else if ( unsigned_p && number_sign == 1)
- {
- yylval.ulval = n;
- return UINT;
- }
- else if((unsigned_p && (n<0))) {
- range_error("Overflow on numeric constant -- number too large.");
- /* But, this can return if range_check == range_warn. */
- }
- yylval.lval = n;
- return INT;
-}
-
-
-/* Some tokens */
-
-static struct
-{
- char name[2];
- int token;
-} tokentab2[] =
-{
- { {'<', '>'}, NOTEQUAL },
- { {':', '='}, ASSIGN },
- { {'<', '='}, LEQ },
- { {'>', '='}, GEQ },
- { {':', ':'}, COLONCOLON },
-
-};
-
-/* Some specific keywords */
-
-struct keyword {
- char keyw[10];
- int token;
-};
-
-static struct keyword keytab[] =
-{
- {"OR" , OROR },
- {"IN", IN },/* Note space after IN */
- {"AND", LOGICAL_AND},
- {"ABS", ABS },
- {"CHR", CHR },
- {"DEC", DEC },
- {"NOT", NOT },
- {"DIV", DIV },
- {"INC", INC },
- {"MAX", MAX_FUNC },
- {"MIN", MIN_FUNC },
- {"MOD", MOD },
- {"ODD", ODD },
- {"CAP", CAP },
- {"ORD", ORD },
- {"VAL", VAL },
- {"EXCL", EXCL },
- {"HIGH", HIGH },
- {"INCL", INCL },
- {"SIZE", SIZE },
- {"FLOAT", FLOAT_FUNC },
- {"TRUNC", TRUNC },
-};
-
-
-/* Read one token, getting characters through lexptr. */
-
-/* This is where we will check to make sure that the language and the operators used are
- compatible */
-
-static int
-yylex ()
-{
- register int c;
- register int namelen;
- register int i;
- register char *tokstart;
- register char quote;
-
- retry:
-
- tokstart = lexptr;
-
-
- /* See if it is a special token of length 2 */
- for( i = 0 ; i < sizeof tokentab2 / sizeof tokentab2[0] ; i++)
- if(STREQN(tokentab2[i].name, tokstart, 2))
- {
- lexptr += 2;
- return tokentab2[i].token;
- }
-
- switch (c = *tokstart)
- {
- case 0:
- return 0;
-
- case ' ':
- case '\t':
- case '\n':
- lexptr++;
- goto retry;
-
- case '(':
- paren_depth++;
- lexptr++;
- return c;
-
- case ')':
- if (paren_depth == 0)
- return 0;
- paren_depth--;
- lexptr++;
- return c;
-
- case ',':
- if (comma_terminates && paren_depth == 0)
- return 0;
- lexptr++;
- return c;
-
- case '.':
- /* Might be a floating point number. */
- if (lexptr[1] >= '0' && lexptr[1] <= '9')
- break; /* Falls into number code. */
- else
- {
- lexptr++;
- return DOT;
- }
-
-/* These are character tokens that appear as-is in the YACC grammar */
- case '+':
- case '-':
- case '*':
- case '/':
- case '^':
- case '<':
- case '>':
- case '[':
- case ']':
- case '=':
- case '{':
- case '}':
- case '#':
- case '@':
- case '~':
- case '&':
- lexptr++;
- return c;
-
- case '\'' :
- case '"':
- quote = c;
- for (namelen = 1; (c = tokstart[namelen]) != quote && c != '\0'; namelen++)
- if (c == '\\')
- {
- c = tokstart[++namelen];
- if (c >= '0' && c <= '9')
- {
- c = tokstart[++namelen];
- if (c >= '0' && c <= '9')
- c = tokstart[++namelen];
- }
- }
- if(c != quote)
- error("Unterminated string or character constant.");
- yylval.sval.ptr = tokstart + 1;
- yylval.sval.length = namelen - 1;
- lexptr += namelen + 1;
-
- if(namelen == 2) /* Single character */
- {
- yylval.ulval = tokstart[1];
- return CHAR;
- }
- else
- return STRING;
- }
-
- /* Is it a number? */
- /* Note: We have already dealt with the case of the token '.'.
- See case '.' above. */
- if ((c >= '0' && c <= '9'))
- {
- /* It's a number. */
- int got_dot = 0, got_e = 0;
- register char *p = tokstart;
- int toktype;
-
- for (++p ;; ++p)
- {
- if (!got_e && (*p == 'e' || *p == 'E'))
- got_dot = got_e = 1;
- else if (!got_dot && *p == '.')
- got_dot = 1;
- else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
- && (*p == '-' || *p == '+'))
- /* This is the sign of the exponent, not the end of the
- number. */
- continue;
- else if ((*p < '0' || *p > '9') &&
- (*p < 'A' || *p > 'F') &&
- (*p != 'H')) /* Modula-2 hexadecimal number */
- break;
- }
- toktype = parse_number (p - tokstart);
- if (toktype == ERROR)
- {
- char *err_copy = (char *) alloca (p - tokstart + 1);
-
- memcpy (err_copy, tokstart, p - tokstart);
- err_copy[p - tokstart] = 0;
- error ("Invalid number \"%s\".", err_copy);
- }
- lexptr = p;
- return toktype;
- }
-
- if (!(c == '_' || c == '$'
- || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
- /* We must have come across a bad character (e.g. ';'). */
- error ("Invalid character '%c' in expression.", c);
-
- /* It's a name. See how long it is. */
- namelen = 0;
- for (c = tokstart[namelen];
- (c == '_' || c == '$' || (c >= '0' && c <= '9')
- || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
- c = tokstart[++namelen])
- ;
-
- /* The token "if" terminates the expression and is NOT
- removed from the input stream. */
- if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
- {
- return 0;
- }
-
- lexptr += namelen;
-
- /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
- and $$digits (equivalent to $<-digits> if you could type that).
- Make token type LAST, and put the number (the digits) in yylval. */
-
- if (*tokstart == '$')
- {
- register int negate = 0;
- c = 1;
- /* Double dollar means negate the number and add -1 as well.
- Thus $$ alone means -1. */
- if (namelen >= 2 && tokstart[1] == '$')
- {
- negate = 1;
- c = 2;
- }
- if (c == namelen)
- {
- /* Just dollars (one or two) */
- yylval.lval = - negate;
- return LAST;
- }
- /* Is the rest of the token digits? */
- for (; c < namelen; c++)
- if (!(tokstart[c] >= '0' && tokstart[c] <= '9'))
- break;
- if (c == namelen)
- {
- yylval.lval = atoi (tokstart + 1 + negate);
- if (negate)
- yylval.lval = - yylval.lval;
- return LAST;
- }
- }
-
- /* Handle tokens that refer to machine registers:
- $ followed by a register name. */
-
- if (*tokstart == '$') {
- for (c = 0; c < NUM_REGS; c++)
- if (namelen - 1 == strlen (reg_names[c])
- && STREQN (tokstart + 1, reg_names[c], namelen - 1))
- {
- yylval.lval = c;
- return REGNAME;
- }
- for (c = 0; c < num_std_regs; c++)
- if (namelen - 1 == strlen (std_regs[c].name)
- && STREQN (tokstart + 1, std_regs[c].name, namelen - 1))
- {
- yylval.lval = std_regs[c].regnum;
- return REGNAME;
- }
- }
-
-
- /* Lookup special keywords */
- for(i = 0 ; i < sizeof(keytab) / sizeof(keytab[0]) ; i++)
- if(namelen == strlen(keytab[i].keyw) && STREQN(tokstart,keytab[i].keyw,namelen))
- return keytab[i].token;
-
- yylval.sval.ptr = tokstart;
- yylval.sval.length = namelen;
-
- /* Any other names starting in $ are debugger internal variables. */
-
- if (*tokstart == '$')
- {
- yylval.ivar = (struct internalvar *) lookup_internalvar (copy_name (yylval.sval) + 1);
- return INTERNAL_VAR;
- }
-
-
- /* Use token-type BLOCKNAME for symbols that happen to be defined as
- functions. If this is not so, then ...
- Use token-type TYPENAME for symbols that happen to be defined
- currently as names of types; NAME for other symbols.
- The caller is not constrained to care about the distinction. */
- {
-
-
- char *tmp = copy_name (yylval.sval);
- struct symbol *sym;
-
- if (lookup_partial_symtab (tmp))
- return BLOCKNAME;
- sym = lookup_symbol (tmp, expression_context_block,
- VAR_NAMESPACE, 0, NULL);
- if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
- return BLOCKNAME;
- if (lookup_typename (copy_name (yylval.sval), expression_context_block, 1))
- return TYPENAME;
-
- if(sym)
- {
- switch(sym->class)
- {
- case LOC_STATIC:
- case LOC_REGISTER:
- case LOC_ARG:
- case LOC_REF_ARG:
- case LOC_REGPARM:
- case LOC_REGPARM_ADDR:
- case LOC_LOCAL:
- case LOC_LOCAL_ARG:
- case LOC_BASEREG:
- case LOC_BASEREG_ARG:
- case LOC_CONST:
- case LOC_CONST_BYTES:
- case LOC_OPTIMIZED_OUT:
- return NAME;
-
- case LOC_TYPEDEF:
- return TYPENAME;
-
- case LOC_BLOCK:
- return BLOCKNAME;
-
- case LOC_UNDEF:
- error("internal: Undefined class in m2lex()");
-
- case LOC_LABEL:
- error("internal: Unforseen case in m2lex()");
- }
- }
- else
- {
- /* Built-in BOOLEAN type. This is sort of a hack. */
- if(STREQN(tokstart,"TRUE",4))
- {
- yylval.ulval = 1;
- return M2_TRUE;
- }
- else if(STREQN(tokstart,"FALSE",5))
- {
- yylval.ulval = 0;
- return M2_FALSE;
- }
- }
-
- /* Must be another type of name... */
- return NAME;
- }
-}
-
-#if 0 /* Unused */
-static char *
-make_qualname(mod,ident)
- char *mod, *ident;
-{
- char *new = xmalloc(strlen(mod)+strlen(ident)+2);
-
- strcpy(new,mod);
- strcat(new,".");
- strcat(new,ident);
- return new;
-}
-#endif /* 0 */
-
-void
-yyerror(msg)
- char *msg; /* unused */
-{
- printf("Parsing: %s\n",lexptr);
- if (yychar < 256)
- error("Invalid syntax in expression near character '%c'.",yychar);
- else
- error("Invalid syntax in expression");
-}
-
-#line 1366 "y.tab.c"
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-int
-yyparse()
-{
- register int yym, yyn, yystate;
-#if YYDEBUG
- register char *yys;
- extern char *getenv();
-
- if (yys = getenv("YYDEBUG"))
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = (-1);
-
- yyssp = yyss;
- yyvsp = yyvs;
- *yyssp = yystate = 0;
-
-yyloop:
- if (yyn = yydefred[yystate]) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = yylex()) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
- yychar = (-1);
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-#ifdef lint
- goto yynewerror;
-#endif
-yynewerror:
- yyerror("syntax error");
-#ifdef lint
- goto yyerrlab;
-#endif
-yyerrlab:
- ++yynerrs;
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
-#endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yyssp);
-#endif
- if (yyssp <= yyss) goto yyabort;
- --yyssp;
- --yyvsp;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = (-1);
- goto yyloop;
- }
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- yyval = yyvsp[1-yym];
- switch (yyn)
- {
-case 3:
-#line 197 "./m2-exp.y"
-{ write_exp_elt_opcode(OP_TYPE);
- write_exp_elt_type(yyvsp[0].tval);
- write_exp_elt_opcode(OP_TYPE);
- }
-break;
-case 4:
-#line 206 "./m2-exp.y"
-{ write_exp_elt_opcode (UNOP_IND); }
-break;
-case 5:
-#line 209 "./m2-exp.y"
-{ number_sign = -1; }
-break;
-case 6:
-#line 211 "./m2-exp.y"
-{ number_sign = 1;
- write_exp_elt_opcode (UNOP_NEG); }
-break;
-case 7:
-#line 216 "./m2-exp.y"
-{ write_exp_elt_opcode(UNOP_PLUS); }
-break;
-case 8:
-#line 220 "./m2-exp.y"
-{ write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
-break;
-case 11:
-#line 228 "./m2-exp.y"
-{ write_exp_elt_opcode (UNOP_CAP); }
-break;
-case 12:
-#line 232 "./m2-exp.y"
-{ write_exp_elt_opcode (UNOP_ORD); }
-break;
-case 13:
-#line 236 "./m2-exp.y"
-{ write_exp_elt_opcode (UNOP_ABS); }
-break;
-case 14:
-#line 240 "./m2-exp.y"
-{ write_exp_elt_opcode (UNOP_HIGH); }
-break;
-case 15:
-#line 244 "./m2-exp.y"
-{ write_exp_elt_opcode (UNOP_MIN);
- write_exp_elt_type (yyvsp[-1].tval);
- write_exp_elt_opcode (UNOP_MIN); }
-break;
-case 16:
-#line 250 "./m2-exp.y"
-{ write_exp_elt_opcode (UNOP_MAX);
- write_exp_elt_type (yyvsp[-1].tval);
- write_exp_elt_opcode (UNOP_MIN); }
-break;
-case 17:
-#line 256 "./m2-exp.y"
-{ write_exp_elt_opcode (UNOP_FLOAT); }
-break;
-case 18:
-#line 260 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_VAL);
- write_exp_elt_type (yyvsp[-3].tval);
- write_exp_elt_opcode (BINOP_VAL); }
-break;
-case 19:
-#line 266 "./m2-exp.y"
-{ write_exp_elt_opcode (UNOP_CHR); }
-break;
-case 20:
-#line 270 "./m2-exp.y"
-{ write_exp_elt_opcode (UNOP_ODD); }
-break;
-case 21:
-#line 274 "./m2-exp.y"
-{ write_exp_elt_opcode (UNOP_TRUNC); }
-break;
-case 22:
-#line 278 "./m2-exp.y"
-{ write_exp_elt_opcode (UNOP_SIZEOF); }
-break;
-case 23:
-#line 283 "./m2-exp.y"
-{ write_exp_elt_opcode(UNOP_PREINCREMENT); }
-break;
-case 24:
-#line 287 "./m2-exp.y"
-{ write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
- write_exp_elt_opcode(BINOP_ADD);
- write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); }
-break;
-case 25:
-#line 293 "./m2-exp.y"
-{ write_exp_elt_opcode(UNOP_PREDECREMENT);}
-break;
-case 26:
-#line 297 "./m2-exp.y"
-{ write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
- write_exp_elt_opcode(BINOP_SUB);
- write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); }
-break;
-case 27:
-#line 303 "./m2-exp.y"
-{ write_exp_elt_opcode (STRUCTOP_STRUCT);
- write_exp_string (yyvsp[0].sval);
- write_exp_elt_opcode (STRUCTOP_STRUCT); }
-break;
-case 29:
-#line 312 "./m2-exp.y"
-{ error("Sets are not implemented.");}
-break;
-case 30:
-#line 316 "./m2-exp.y"
-{ error("Sets are not implemented.");}
-break;
-case 31:
-#line 320 "./m2-exp.y"
-{ error("Sets are not implemented.");}
-break;
-case 32:
-#line 323 "./m2-exp.y"
-{ error("Sets are not implemented.");}
-break;
-case 33:
-#line 325 "./m2-exp.y"
-{ error("Sets are not implemented.");}
-break;
-case 34:
-#line 334 "./m2-exp.y"
-{ start_arglist(); }
-break;
-case 35:
-#line 336 "./m2-exp.y"
-{ write_exp_elt_opcode (MULTI_SUBSCRIPT);
- write_exp_elt_longcst ((LONGEST) end_arglist());
- write_exp_elt_opcode (MULTI_SUBSCRIPT); }
-break;
-case 36:
-#line 344 "./m2-exp.y"
-{ start_arglist (); }
-break;
-case 37:
-#line 346 "./m2-exp.y"
-{ write_exp_elt_opcode (OP_FUNCALL);
- write_exp_elt_longcst ((LONGEST) end_arglist ());
- write_exp_elt_opcode (OP_FUNCALL); }
-break;
-case 39:
-#line 355 "./m2-exp.y"
-{ arglist_len = 1; }
-break;
-case 40:
-#line 359 "./m2-exp.y"
-{ arglist_len++; }
-break;
-case 41:
-#line 364 "./m2-exp.y"
-{ arglist_len = 1; }
-break;
-case 42:
-#line 369 "./m2-exp.y"
-{ arglist_len++; }
-break;
-case 43:
-#line 374 "./m2-exp.y"
-{ write_exp_elt_opcode (UNOP_MEMVAL);
- write_exp_elt_type (yyvsp[-2].tval);
- write_exp_elt_opcode (UNOP_MEMVAL); }
-break;
-case 44:
-#line 380 "./m2-exp.y"
-{ write_exp_elt_opcode (UNOP_CAST);
- write_exp_elt_type (yyvsp[-3].tval);
- write_exp_elt_opcode (UNOP_CAST); }
-break;
-case 45:
-#line 386 "./m2-exp.y"
-{ }
-break;
-case 46:
-#line 394 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_REPEAT); }
-break;
-case 47:
-#line 398 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_MUL); }
-break;
-case 48:
-#line 402 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_DIV); }
-break;
-case 49:
-#line 406 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_INTDIV); }
-break;
-case 50:
-#line 410 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_REM); }
-break;
-case 51:
-#line 414 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_ADD); }
-break;
-case 52:
-#line 418 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_SUB); }
-break;
-case 53:
-#line 422 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_EQUAL); }
-break;
-case 54:
-#line 426 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_NOTEQUAL); }
-break;
-case 55:
-#line 428 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_NOTEQUAL); }
-break;
-case 56:
-#line 432 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_LEQ); }
-break;
-case 57:
-#line 436 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_GEQ); }
-break;
-case 58:
-#line 440 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_LESS); }
-break;
-case 59:
-#line 444 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_GTR); }
-break;
-case 60:
-#line 448 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_LOGICAL_AND); }
-break;
-case 61:
-#line 452 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_LOGICAL_OR); }
-break;
-case 62:
-#line 456 "./m2-exp.y"
-{ write_exp_elt_opcode (BINOP_ASSIGN); }
-break;
-case 63:
-#line 463 "./m2-exp.y"
-{ write_exp_elt_opcode (OP_BOOL);
- write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
- write_exp_elt_opcode (OP_BOOL); }
-break;
-case 64:
-#line 469 "./m2-exp.y"
-{ write_exp_elt_opcode (OP_BOOL);
- write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
- write_exp_elt_opcode (OP_BOOL); }
-break;
-case 65:
-#line 475 "./m2-exp.y"
-{ write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_m2_int);
- write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
- write_exp_elt_opcode (OP_LONG); }
-break;
-case 66:
-#line 482 "./m2-exp.y"
-{
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_m2_card);
- write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
- write_exp_elt_opcode (OP_LONG);
- }
-break;
-case 67:
-#line 491 "./m2-exp.y"
-{ write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_m2_char);
- write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
- write_exp_elt_opcode (OP_LONG); }
-break;
-case 68:
-#line 499 "./m2-exp.y"
-{ write_exp_elt_opcode (OP_DOUBLE);
- write_exp_elt_type (builtin_type_m2_real);
- write_exp_elt_dblcst (yyvsp[0].dval);
- write_exp_elt_opcode (OP_DOUBLE); }
-break;
-case 70:
-#line 510 "./m2-exp.y"
-{ write_exp_elt_opcode (OP_LAST);
- write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
- write_exp_elt_opcode (OP_LAST); }
-break;
-case 71:
-#line 516 "./m2-exp.y"
-{ write_exp_elt_opcode (OP_REGISTER);
- write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
- write_exp_elt_opcode (OP_REGISTER); }
-break;
-case 72:
-#line 522 "./m2-exp.y"
-{ write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_int);
- write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
- write_exp_elt_opcode (OP_LONG); }
-break;
-case 73:
-#line 529 "./m2-exp.y"
-{ write_exp_elt_opcode (OP_M2_STRING);
- write_exp_string (yyvsp[0].sval);
- write_exp_elt_opcode (OP_M2_STRING); }
-break;
-case 74:
-#line 536 "./m2-exp.y"
-{ yyval.bval = SYMBOL_BLOCK_VALUE(yyvsp[0].sym); }
-break;
-case 75:
-#line 540 "./m2-exp.y"
-{ struct symbol *sym
- = lookup_symbol (copy_name (yyvsp[0].sval), expression_context_block,
- VAR_NAMESPACE, 0, NULL);
- yyval.sym = sym;}
-break;
-case 76:
-#line 549 "./m2-exp.y"
-{ struct symbol *tem
- = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
- VAR_NAMESPACE, 0, NULL);
- if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
- error ("No function \"%s\" in specified context.",
- copy_name (yyvsp[0].sval));
- yyval.sym = tem;
- }
-break;
-case 77:
-#line 561 "./m2-exp.y"
-{ write_exp_elt_opcode(OP_VAR_VALUE);
- write_exp_elt_block (NULL);
- write_exp_elt_sym (yyvsp[0].sym);
- write_exp_elt_opcode (OP_VAR_VALUE); }
-break;
-case 78:
-#line 569 "./m2-exp.y"
-{ write_exp_elt_opcode (OP_INTERNALVAR);
- write_exp_elt_intern (yyvsp[0].ivar);
- write_exp_elt_opcode (OP_INTERNALVAR); }
-break;
-case 79:
-#line 576 "./m2-exp.y"
-{ struct symbol *sym;
- sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
- VAR_NAMESPACE, 0, NULL);
- if (sym == 0)
- error ("No symbol \"%s\" in specified context.",
- copy_name (yyvsp[0].sval));
-
- write_exp_elt_opcode (OP_VAR_VALUE);
- /* block_found is set by lookup_symbol. */
- write_exp_elt_block (block_found);
- write_exp_elt_sym (sym);
- write_exp_elt_opcode (OP_VAR_VALUE); }
-break;
-case 80:
-#line 592 "./m2-exp.y"
-{ struct symbol *sym;
- int is_a_field_of_this;
-
- sym = lookup_symbol (copy_name (yyvsp[0].sval),
- expression_context_block,
- VAR_NAMESPACE,
- &is_a_field_of_this,
- NULL);
- if (sym)
- {
- if (symbol_read_needs_frame (sym))
- {
- if (innermost_block == 0 ||
- contained_in (block_found,
- innermost_block))
- innermost_block = block_found;
- }
-
- write_exp_elt_opcode (OP_VAR_VALUE);
- /* We want to use the selected frame, not
- another more inner frame which happens to
- be in the same block. */
- write_exp_elt_block (NULL);
- write_exp_elt_sym (sym);
- write_exp_elt_opcode (OP_VAR_VALUE);
- }
- else
- {
- struct minimal_symbol *msymbol;
- register char *arg = copy_name (yyvsp[0].sval);
-
- msymbol = lookup_minimal_symbol (arg,
- (struct objfile *) NULL);
- if (msymbol != NULL)
- {
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type_long);
- write_exp_elt_longcst ((LONGEST) SYMBOL_VALUE_ADDRESS (msymbol));
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_opcode (UNOP_MEMVAL);
- if (msymbol -> type == mst_data ||
- msymbol -> type == mst_bss)
- write_exp_elt_type (builtin_type_int);
- else if (msymbol -> type == mst_text)
- write_exp_elt_type (lookup_function_type (builtin_type_int));
- else
- write_exp_elt_type (builtin_type_char);
- write_exp_elt_opcode (UNOP_MEMVAL);
- }
- else if (!have_full_symbols () && !have_partial_symbols ())
- error ("No symbol table is loaded. Use the \"symbol-file\" command.");
- else
- error ("No symbol \"%s\" in current context.",
- copy_name (yyvsp[0].sval));
- }
- }
-break;
-case 81:
-#line 652 "./m2-exp.y"
-{ yyval.tval = lookup_typename (copy_name (yyvsp[0].sval),
- expression_context_block, 0); }
-break;
-#line 1936 "y.tab.c"
- }
- yyssp -= yym;
- yystate = *yyssp;
- yyvsp -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yyssp = YYFINAL;
- *++yyvsp = yyval;
- if (yychar < 0)
- {
- if ((yychar = yylex()) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yyssp, yystate);
-#endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate;
- *++yyvsp = yyval;
- goto yyloop;
-yyoverflow:
- yyerror("yacc stack overflow");
-yyabort:
- return (1);
-yyaccept:
- return (0);
-}
diff --git a/gnu/usr.bin/gdb/gdb/putenv.c b/gnu/usr.bin/gdb/gdb/putenv.c
deleted file mode 100644
index e2ea357..0000000
--- a/gnu/usr.bin/gdb/gdb/putenv.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************/
-/* */
-/* putenv(3) */
-/* */
-/* Change or add an environment entry */
-/* */
-/****************************************************************/
-/* origination 1987-Oct-7 T. Holm */
-/****************************************************************/
-
-/*
-Path: hoptoad!pacbell!ames!ll-xn!mit-eddie!uw-beaver!ssc-vax!uvicctr!tholm
-From: tholm@uvicctr.UUCP (Terrence W. Holm)
-Newsgroups: comp.os.minix
-Subject: putenv(3)
-Message-ID: <395@uvicctr.UUCP>
-Date: 5 May 88 06:40:52 GMT
-Organization: University of Victoria, Victoria B.C. Canada
-
-EFTH Minix report #2 - May 1988 - putenv(3)
-
-This is an implementation of putenv(3) that we
-wrote for Minix. Please consider this a public
-domain program.
-*/
-
-#include <stdio.h>
-
-#define PSIZE sizeof(char *)
-
-extern char **environ;
-
-char *strchr();
-char *malloc();
-
-/****************************************************************/
-/* */
-/* int */
-/* putenv( entry ) */
-/* */
-/* The "entry" should follow the form */
-/* "NAME=VALUE". This routine will search the */
-/* user environment for "NAME" and replace its */
-/* value with "VALUE". */
-/* */
-/* Note that "entry" is not copied, it is used */
-/* as the environment entry. This means that it */
-/* must not be unallocated or otherwise modifed */
-/* by the caller, unless it is replaced by a */
-/* subsequent putenv(). */
-/* */
-/* If the name is not found in the environment, */
-/* then a new vector of pointers is allocated, */
-/* "entry" is put at the end and the global */
-/* variable "environ" is updated. */
-/* */
-/* This function normally returns NULL, but -1 */
-/* is returned if it can not allocate enough */
-/* space using malloc(3), or "entry" does not */
-/* contain a '='. */
-/* */
-/****************************************************************/
-
-
-int
-putenv( entry )
- char *entry;
-{
- unsigned length;
- unsigned size;
- char *temp;
- char **p;
- char **new_environ;
-
- /* Find the length of the "NAME=" */
-
- temp = strchr(entry,'=');
- if ( temp == 0 )
- return( -1 );
-
- length = (unsigned) (temp - entry + 1);
-
-
- /* Scan through the environment looking for "NAME=" */
-
- for ( p=environ; *p != 0 ; p++ )
- if ( strncmp( entry, *p, length ) == 0 )
- {
- *p = entry;
- return( 0 );
- }
-
-
- /* The name was not found, build a bigger environment */
-
- size = p - environ;
-
- new_environ = (char **) malloc( (size+2)*PSIZE );
-
- if ( new_environ == (char **) NULL )
- return( -1 );
-
- memcpy ((char *) new_environ, (char *) environ, size*PSIZE );
-
- new_environ[size] = entry;
- new_environ[size+1] = NULL;
-
- environ = new_environ;
-
- return(0);
-}
diff --git a/gnu/usr.bin/gdb/gdb/regex.c b/gnu/usr.bin/gdb/gdb/regex.c
deleted file mode 100644
index 3f30284..0000000
--- a/gnu/usr.bin/gdb/gdb/regex.c
+++ /dev/null
@@ -1,1744 +0,0 @@
-/* Extended regular expression matching and search library.
- Copyright (C) 1985, 1989 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* To test, compile with -Dtest.
- This Dtestable feature turns this into a self-contained program
- which reads a pattern, describes how it compiles,
- then reads a string and searches for it. */
-
-#ifdef emacs
-
-/* The `emacs' switch turns on certain special matching commands
- that make sense only in emacs. */
-
-#include "config.h"
-#include "lisp.h"
-#include "buffer.h"
-#include "syntax.h"
-
-#else /* not emacs */
-
-#include "defs.h"
-#include <string.h>
-
-/*
- * Define the syntax stuff, so we can do the \<...\> things.
- */
-
-#ifndef Sword /* must be non-zero in some of the tests below... */
-#define Sword 1
-#endif
-
-#define SYNTAX(c) re_syntax_table[c]
-
-#ifdef SYNTAX_TABLE
-
-char *re_syntax_table;
-
-#else
-
-static char re_syntax_table[256];
-
-static void
-init_syntax_once ()
-{
- register int c;
- static int done = 0;
-
- if (done)
- return;
-
- memset (re_syntax_table, '\0', sizeof re_syntax_table);
-
- for (c = 'a'; c <= 'z'; c++)
- re_syntax_table[c] = Sword;
-
- for (c = 'A'; c <= 'Z'; c++)
- re_syntax_table[c] = Sword;
-
- for (c = '0'; c <= '9'; c++)
- re_syntax_table[c] = Sword;
-
- done = 1;
-}
-
-#endif /* SYNTAX_TABLE */
-#endif /* not emacs */
-
-#include "regex.h"
-
-/* Number of failure points to allocate space for initially,
- when matching. If this number is exceeded, more space is allocated,
- so it is not a hard limit. */
-
-#ifndef NFAILURES
-#define NFAILURES 80
-#endif /* NFAILURES */
-
-/* width of a byte in bits */
-
-#define BYTEWIDTH 8
-
-/* We remove any previous definition of `SIGN_EXTEND_CHAR',
- since ours (we hope) works properly with all combinations of
- machines, compilers, `char' and `unsigned char' argument types.
- (Per Bothner suggested the basic approach.) */
-#undef SIGN_EXTEND_CHAR
-#if __STDC__
-#define SIGN_EXTEND_CHAR(c) ((signed char) (c))
-#else /* not __STDC__ */
-/* As in Harbison and Steele. */
-#define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
-#endif
-
-static int obscure_syntax = 0;
-
-/* Specify the precise syntax of regexp for compilation.
- This provides for compatibility for various utilities
- which historically have different, incompatible syntaxes.
-
- The argument SYNTAX is a bit-mask containing the two bits
- RE_NO_BK_PARENS and RE_NO_BK_VBAR. */
-
-int
-re_set_syntax (syntax)
- int syntax;
-{
- int ret;
-
- ret = obscure_syntax;
- obscure_syntax = syntax;
- return ret;
-}
-
-/* re_compile_pattern takes a regular-expression string
- and converts it into a buffer full of byte commands for matching.
-
- PATTERN is the address of the pattern string
- SIZE is the length of it.
- BUFP is a struct re_pattern_buffer * which points to the info
- on where to store the byte commands.
- This structure contains a char * which points to the
- actual space, which should have been obtained with malloc.
- re_compile_pattern may use realloc to grow the buffer space.
-
- The number of bytes of commands can be found out by looking in
- the struct re_pattern_buffer that bufp pointed to,
- after re_compile_pattern returns.
-*/
-
-#define PATPUSH(ch) (*b++ = (char) (ch))
-
-#define PATFETCH(c) \
- {if (p == pend) goto end_of_pattern; \
- c = * (unsigned char *) p++; \
- if (translate) c = translate[c]; }
-
-#define PATFETCH_RAW(c) \
- {if (p == pend) goto end_of_pattern; \
- c = * (unsigned char *) p++; }
-
-#define PATUNFETCH p--
-
-/* This is not an arbitrary limit: the arguments which represent offsets
- into the pattern are two bytes long. So if 2^16 bytes turns out to
- be too small, many things would have to change. */
-#define MAX_BUF_SIZE (1 << 16)
-
-
-/* Extend the buffer by twice its current size via realloc and
- reset the pointers that pointed into the old block to point to the
- correct places in the new one. If extending the buffer results in it
- being larger than MAX_BUF_SIZE, then flag memory exhausted. */
-#define EXTEND_BUFFER \
- do { \
- char *old_buffer = bufp->buffer; \
- if (bufp->allocated == MAX_BUF_SIZE) \
- goto too_big; \
- bufp->allocated <<= 1; \
- if (bufp->allocated > MAX_BUF_SIZE) \
- bufp->allocated = MAX_BUF_SIZE; \
- bufp->buffer = (char *) realloc (bufp->buffer, bufp->allocated);\
- if (bufp->buffer == NULL) \
- goto memory_exhausted; \
- /* If the buffer moved, move all the pointers into it. */ \
- if (old_buffer != bufp->buffer) \
- { \
- b = (b - old_buffer) + bufp->buffer; \
- begalt = (begalt - old_buffer) + bufp->buffer; \
- if (fixup_jump) \
- fixup_jump = (fixup_jump - old_buffer) + bufp->buffer;\
- if (laststart) \
- laststart = (laststart - old_buffer) + bufp->buffer; \
- if (pending_exact) \
- pending_exact = (pending_exact - old_buffer) + bufp->buffer; \
- } \
- } while (0)
-
-static void store_jump (), insert_jump ();
-
-char *
-re_compile_pattern (pattern, size, bufp)
- char *pattern;
- int size;
- struct re_pattern_buffer *bufp;
-{
- register char *b = bufp->buffer;
- register char *p = pattern;
- char *pend = pattern + size;
- register unsigned c, c1;
- char *p1;
- unsigned char *translate = (unsigned char *) bufp->translate;
-
- /* address of the count-byte of the most recently inserted "exactn" command.
- This makes it possible to tell whether a new exact-match character
- can be added to that command or requires a new "exactn" command. */
-
- char *pending_exact = 0;
-
- /* address of the place where a forward-jump should go
- to the end of the containing expression.
- Each alternative of an "or", except the last, ends with a forward-jump
- of this sort. */
-
- char *fixup_jump = 0;
-
- /* address of start of the most recently finished expression.
- This tells postfix * where to find the start of its operand. */
-
- char *laststart = 0;
-
- /* In processing a repeat, 1 means zero matches is allowed */
-
- char zero_times_ok;
-
- /* In processing a repeat, 1 means many matches is allowed */
-
- char many_times_ok;
-
- /* address of beginning of regexp, or inside of last \( */
-
- char *begalt = b;
-
- /* Stack of information saved by \( and restored by \).
- Four stack elements are pushed by each \(:
- First, the value of b.
- Second, the value of fixup_jump.
- Third, the value of regnum.
- Fourth, the value of begalt. */
-
- int stackb[40];
- int *stackp = stackb;
- int *stacke = stackb + 40;
- int *stackt;
-
- /* Counts \('s as they are encountered. Remembered for the matching \),
- where it becomes the "register number" to put in the stop_memory command */
-
- int regnum = 1;
-
- bufp->fastmap_accurate = 0;
-
-#ifndef emacs
-#ifndef SYNTAX_TABLE
- /*
- * Initialize the syntax table.
- */
- init_syntax_once();
-#endif
-#endif
-
- if (bufp->allocated == 0)
- {
- bufp->allocated = 28;
- if (bufp->buffer)
- /* EXTEND_BUFFER loses when bufp->allocated is 0 */
- bufp->buffer = (char *) realloc (bufp->buffer, 28);
- else
- /* Caller did not allocate a buffer. Do it for him */
- bufp->buffer = (char *) malloc (28);
- if (!bufp->buffer) goto memory_exhausted;
- begalt = b = bufp->buffer;
- }
-
- while (p != pend)
- {
- if (b - bufp->buffer > bufp->allocated - 10)
- /* Note that EXTEND_BUFFER clobbers c */
- EXTEND_BUFFER;
-
- PATFETCH (c);
-
- switch (c)
- {
- case '$':
- if (obscure_syntax & RE_TIGHT_VBAR)
- {
- if (! (obscure_syntax & RE_CONTEXT_INDEP_OPS) && p != pend)
- goto normal_char;
- /* Make operand of last vbar end before this `$'. */
- if (fixup_jump)
- store_jump (fixup_jump, jump, b);
- fixup_jump = 0;
- PATPUSH (endline);
- break;
- }
-
- /* $ means succeed if at end of line, but only in special contexts.
- If randomly in the middle of a pattern, it is a normal character. */
- if (p == pend || *p == '\n'
- || (obscure_syntax & RE_CONTEXT_INDEP_OPS)
- || (obscure_syntax & RE_NO_BK_PARENS
- ? *p == ')'
- : *p == '\\' && p[1] == ')')
- || (obscure_syntax & RE_NO_BK_VBAR
- ? *p == '|'
- : *p == '\\' && p[1] == '|'))
- {
- PATPUSH (endline);
- break;
- }
- goto normal_char;
-
- case '^':
- /* ^ means succeed if at beg of line, but only if no preceding pattern. */
-
- if (laststart && p[-2] != '\n'
- && ! (obscure_syntax & RE_CONTEXT_INDEP_OPS))
- goto normal_char;
- if (obscure_syntax & RE_TIGHT_VBAR)
- {
- if (p != pattern + 1
- && ! (obscure_syntax & RE_CONTEXT_INDEP_OPS))
- goto normal_char;
- PATPUSH (begline);
- begalt = b;
- }
- else
- PATPUSH (begline);
- break;
-
- case '+':
- case '?':
- if (obscure_syntax & RE_BK_PLUS_QM)
- goto normal_char;
- handle_plus:
- case '*':
- /* If there is no previous pattern, char not special. */
- if (!laststart && ! (obscure_syntax & RE_CONTEXT_INDEP_OPS))
- goto normal_char;
- /* If there is a sequence of repetition chars,
- collapse it down to equivalent to just one. */
- zero_times_ok = 0;
- many_times_ok = 0;
- while (1)
- {
- zero_times_ok |= c != '+';
- many_times_ok |= c != '?';
- if (p == pend)
- break;
- PATFETCH (c);
- if (c == '*')
- ;
- else if (!(obscure_syntax & RE_BK_PLUS_QM)
- && (c == '+' || c == '?'))
- ;
- else if ((obscure_syntax & RE_BK_PLUS_QM)
- && c == '\\')
- {
- int c1;
- PATFETCH (c1);
- if (!(c1 == '+' || c1 == '?'))
- {
- PATUNFETCH;
- PATUNFETCH;
- break;
- }
- c = c1;
- }
- else
- {
- PATUNFETCH;
- break;
- }
- }
-
- /* Star, etc. applied to an empty pattern is equivalent
- to an empty pattern. */
- if (!laststart)
- break;
-
- /* Now we know whether 0 matches is allowed,
- and whether 2 or more matches is allowed. */
- if (many_times_ok)
- {
- /* If more than one repetition is allowed,
- put in a backward jump at the end. */
- store_jump (b, maybe_finalize_jump, laststart - 3);
- b += 3;
- }
- insert_jump (on_failure_jump, laststart, b + 3, b);
- pending_exact = 0;
- b += 3;
- if (!zero_times_ok)
- {
- /* At least one repetition required: insert before the loop
- a skip over the initial on-failure-jump instruction */
- insert_jump (dummy_failure_jump, laststart, laststart + 6, b);
- b += 3;
- }
- break;
-
- case '.':
- laststart = b;
- PATPUSH (anychar);
- break;
-
- case '[':
- while (b - bufp->buffer
- > bufp->allocated - 3 - (1 << BYTEWIDTH) / BYTEWIDTH)
- /* Note that EXTEND_BUFFER clobbers c */
- EXTEND_BUFFER;
-
- laststart = b;
- if (*p == '^')
- PATPUSH (charset_not), p++;
- else
- PATPUSH (charset);
- p1 = p;
-
- PATPUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
- /* Clear the whole map */
- memset (b, '\0', (1 << BYTEWIDTH) / BYTEWIDTH);
- /* Read in characters and ranges, setting map bits */
- while (1)
- {
- PATFETCH (c);
- if (c == ']' && p != p1 + 1) break;
- if (*p == '-' && p[1] != ']')
- {
- PATFETCH (c1);
- PATFETCH (c1);
- while (c <= c1)
- b[c / BYTEWIDTH] |= 1 << (c % BYTEWIDTH), c++;
- }
- else
- {
- b[c / BYTEWIDTH] |= 1 << (c % BYTEWIDTH);
- }
- }
- /* Discard any bitmap bytes that are all 0 at the end of the map.
- Decrement the map-length byte too. */
- while ((int) b[-1] > 0 && b[b[-1] - 1] == 0)
- b[-1]--;
- b += b[-1];
- break;
-
- case '(':
- if (! (obscure_syntax & RE_NO_BK_PARENS))
- goto normal_char;
- else
- goto handle_open;
-
- case ')':
- if (! (obscure_syntax & RE_NO_BK_PARENS))
- goto normal_char;
- else
- goto handle_close;
-
- case '\n':
- if (! (obscure_syntax & RE_NEWLINE_OR))
- goto normal_char;
- else
- goto handle_bar;
-
- case '|':
- if (! (obscure_syntax & RE_NO_BK_VBAR))
- goto normal_char;
- else
- goto handle_bar;
-
- case '\\':
- if (p == pend) goto invalid_pattern;
- PATFETCH_RAW (c);
- switch (c)
- {
- case '(':
- if (obscure_syntax & RE_NO_BK_PARENS)
- goto normal_backsl;
- handle_open:
- if (stackp == stacke) goto nesting_too_deep;
- if (regnum < RE_NREGS)
- {
- PATPUSH (start_memory);
- PATPUSH (regnum);
- }
- *stackp++ = b - bufp->buffer;
- *stackp++ = fixup_jump ? fixup_jump - bufp->buffer + 1 : 0;
- *stackp++ = regnum++;
- *stackp++ = begalt - bufp->buffer;
- fixup_jump = 0;
- laststart = 0;
- begalt = b;
- break;
-
- case ')':
- if (obscure_syntax & RE_NO_BK_PARENS)
- goto normal_backsl;
- handle_close:
- if (stackp == stackb) goto unmatched_close;
- begalt = *--stackp + bufp->buffer;
- if (fixup_jump)
- store_jump (fixup_jump, jump, b);
- if (stackp[-1] < RE_NREGS)
- {
- PATPUSH (stop_memory);
- PATPUSH (stackp[-1]);
- }
- stackp -= 2;
- fixup_jump = 0;
- if (*stackp)
- fixup_jump = *stackp + bufp->buffer - 1;
- laststart = *--stackp + bufp->buffer;
- break;
-
- case '|':
- if (obscure_syntax & RE_NO_BK_VBAR)
- goto normal_backsl;
- handle_bar:
- insert_jump (on_failure_jump, begalt, b + 6, b);
- pending_exact = 0;
- b += 3;
- if (fixup_jump)
- store_jump (fixup_jump, jump, b);
- fixup_jump = b;
- b += 3;
- laststart = 0;
- begalt = b;
- break;
-
-#ifdef emacs
- case '=':
- PATPUSH (at_dot);
- break;
-
- case 's':
- laststart = b;
- PATPUSH (syntaxspec);
- PATFETCH (c);
- PATPUSH (syntax_spec_code[c]);
- break;
-
- case 'S':
- laststart = b;
- PATPUSH (notsyntaxspec);
- PATFETCH (c);
- PATPUSH (syntax_spec_code[c]);
- break;
-#endif /* emacs */
-
- case 'w':
- laststart = b;
- PATPUSH (wordchar);
- break;
-
- case 'W':
- laststart = b;
- PATPUSH (notwordchar);
- break;
-
- case '<':
- PATPUSH (wordbeg);
- break;
-
- case '>':
- PATPUSH (wordend);
- break;
-
- case 'b':
- PATPUSH (wordbound);
- break;
-
- case 'B':
- PATPUSH (notwordbound);
- break;
-
- case '`':
- PATPUSH (begbuf);
- break;
-
- case '\'':
- PATPUSH (endbuf);
- break;
-
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- c1 = c - '0';
- if (c1 >= regnum)
- goto normal_char;
- for (stackt = stackp - 2; stackt > stackb; stackt -= 4)
- if (*stackt == c1)
- goto normal_char;
- laststart = b;
- PATPUSH (duplicate);
- PATPUSH (c1);
- break;
-
- case '+':
- case '?':
- if (obscure_syntax & RE_BK_PLUS_QM)
- goto handle_plus;
-
- default:
- normal_backsl:
- /* You might think it would be useful for \ to mean
- not to translate; but if we don't translate it
- it will never match anything. */
- if (translate) c = translate[c];
- goto normal_char;
- }
- break;
-
- default:
- normal_char:
- if (!pending_exact || pending_exact + *pending_exact + 1 != b
- || *pending_exact == 0177 || *p == '*' || *p == '^'
- || ((obscure_syntax & RE_BK_PLUS_QM)
- ? *p == '\\' && (p[1] == '+' || p[1] == '?')
- : (*p == '+' || *p == '?')))
- {
- laststart = b;
- PATPUSH (exactn);
- pending_exact = b;
- PATPUSH (0);
- }
- PATPUSH (c);
- (*pending_exact)++;
- }
- }
-
- if (fixup_jump)
- store_jump (fixup_jump, jump, b);
-
- if (stackp != stackb) goto unmatched_open;
-
- bufp->used = b - bufp->buffer;
- return 0;
-
- invalid_pattern:
- return "Invalid regular expression";
-
- unmatched_open:
- return "Unmatched \\(";
-
- unmatched_close:
- return "Unmatched \\)";
-
- end_of_pattern:
- return "Premature end of regular expression";
-
- nesting_too_deep:
- return "Nesting too deep";
-
- too_big:
- return "Regular expression too big";
-
- memory_exhausted:
- return "Memory exhausted";
-}
-
-/* Store where `from' points a jump operation to jump to where `to' points.
- `opcode' is the opcode to store. */
-
-static void
-store_jump (from, opcode, to)
- char *from, *to;
- char opcode;
-{
- from[0] = opcode;
- from[1] = (to - (from + 3)) & 0377;
- from[2] = (to - (from + 3)) >> 8;
-}
-
-/* Open up space at char FROM, and insert there a jump to TO.
- CURRENT_END gives te end of the storage no in use,
- so we know how much data to copy up.
- OP is the opcode of the jump to insert.
-
- If you call this function, you must zero out pending_exact. */
-
-static void
-insert_jump (op, from, to, current_end)
- char op;
- char *from, *to, *current_end;
-{
- register char *pto = current_end + 3;
- register char *pfrom = current_end;
- while (pfrom != from)
- *--pto = *--pfrom;
- store_jump (from, op, to);
-}
-
-/* Given a pattern, compute a fastmap from it.
- The fastmap records which of the (1 << BYTEWIDTH) possible characters
- can start a string that matches the pattern.
- This fastmap is used by re_search to skip quickly over totally implausible text.
-
- The caller must supply the address of a (1 << BYTEWIDTH)-byte data area
- as bufp->fastmap.
- The other components of bufp describe the pattern to be used. */
-
-void
-re_compile_fastmap (bufp)
- struct re_pattern_buffer *bufp;
-{
- unsigned char *pattern = (unsigned char *) bufp->buffer;
- int size = bufp->used;
- register char *fastmap = bufp->fastmap;
- register unsigned char *p = pattern;
- register unsigned char *pend = pattern + size;
- register int j;
- unsigned char *translate = (unsigned char *) bufp->translate;
-
- unsigned char *stackb[NFAILURES];
- unsigned char **stackp = stackb;
-
- memset (fastmap, '\0', (1 << BYTEWIDTH));
- bufp->fastmap_accurate = 1;
- bufp->can_be_null = 0;
-
- while (p)
- {
- if (p == pend)
- {
- bufp->can_be_null = 1;
- break;
- }
-#ifdef SWITCH_ENUM_BUG
- switch ((int) ((enum regexpcode) *p++))
-#else
- switch ((enum regexpcode) *p++)
-#endif
- {
- case exactn:
- if (translate)
- fastmap[translate[p[1]]] = 1;
- else
- fastmap[p[1]] = 1;
- break;
-
- case begline:
- case before_dot:
- case at_dot:
- case after_dot:
- case begbuf:
- case endbuf:
- case wordbound:
- case notwordbound:
- case wordbeg:
- case wordend:
- continue;
-
- case endline:
- if (translate)
- fastmap[translate['\n']] = 1;
- else
- fastmap['\n'] = 1;
- if (bufp->can_be_null != 1)
- bufp->can_be_null = 2;
- break;
-
- case finalize_jump:
- case maybe_finalize_jump:
- case jump:
- case dummy_failure_jump:
- bufp->can_be_null = 1;
- j = *p++ & 0377;
- j += SIGN_EXTEND_CHAR (*(char *)p) << 8;
- p += j + 1; /* The 1 compensates for missing ++ above */
- if (j > 0)
- continue;
- /* Jump backward reached implies we just went through
- the body of a loop and matched nothing.
- Opcode jumped to should be an on_failure_jump.
- Just treat it like an ordinary jump.
- For a * loop, it has pushed its failure point already;
- if so, discard that as redundant. */
- if ((enum regexpcode) *p != on_failure_jump)
- continue;
- p++;
- j = *p++ & 0377;
- j += SIGN_EXTEND_CHAR (*(char *)p) << 8;
- p += j + 1; /* The 1 compensates for missing ++ above */
- if (stackp != stackb && *stackp == p)
- stackp--;
- continue;
-
- case on_failure_jump:
- j = *p++ & 0377;
- j += SIGN_EXTEND_CHAR (*(char *)p) << 8;
- p++;
- *++stackp = p + j;
- continue;
-
- case start_memory:
- case stop_memory:
- p++;
- continue;
-
- case duplicate:
- bufp->can_be_null = 1;
- fastmap['\n'] = 1;
- case anychar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (j != '\n')
- fastmap[j] = 1;
- if (bufp->can_be_null)
- return;
- /* Don't return; check the alternative paths
- so we can set can_be_null if appropriate. */
- break;
-
- case wordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == Sword)
- fastmap[j] = 1;
- break;
-
- case notwordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != Sword)
- fastmap[j] = 1;
- break;
-
-#ifdef emacs
- case syntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
-
- case notsyntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
-#endif /* emacs */
-
- case charset:
- for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
- {
- if (translate)
- fastmap[translate[j]] = 1;
- else
- fastmap[j] = 1;
- }
- break;
-
- case charset_not:
- /* Chars beyond end of map must be allowed */
- for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
- if (translate)
- fastmap[translate[j]] = 1;
- else
- fastmap[j] = 1;
-
- for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
- {
- if (translate)
- fastmap[translate[j]] = 1;
- else
- fastmap[j] = 1;
- }
- break;
- }
-
- /* Get here means we have successfully found the possible starting characters
- of one path of the pattern. We need not follow this path any farther.
- Instead, look at the next alternative remembered in the stack. */
- if (stackp != stackb)
- p = *stackp--;
- else
- break;
- }
-}
-
-/* Like re_search_2, below, but only one string is specified. */
-
-int
-re_search (pbufp, string, size, startpos, range, regs)
- struct re_pattern_buffer *pbufp;
- char *string;
- int size, startpos, range;
- struct re_registers *regs;
-{
- return re_search_2 (pbufp, 0, 0, string, size, startpos, range, regs, size);
-}
-
-/* Like re_match_2 but tries first a match starting at index STARTPOS,
- then at STARTPOS + 1, and so on.
- RANGE is the number of places to try before giving up.
- If RANGE is negative, the starting positions tried are
- STARTPOS, STARTPOS - 1, etc.
- It is up to the caller to make sure that range is not so large
- as to take the starting position outside of the input strings.
-
-The value returned is the position at which the match was found,
- or -1 if no match was found,
- or -2 if error (such as failure stack overflow). */
-
-int
-re_search_2 (pbufp, string1, size1, string2, size2, startpos, range, regs, mstop)
- struct re_pattern_buffer *pbufp;
- char *string1, *string2;
- int size1, size2;
- int startpos;
- register int range;
- struct re_registers *regs;
- int mstop;
-{
- register char *fastmap = pbufp->fastmap;
- register unsigned char *translate = (unsigned char *) pbufp->translate;
- int total = size1 + size2;
- int val;
-
- /* Update the fastmap now if not correct already */
- if (fastmap && !pbufp->fastmap_accurate)
- re_compile_fastmap (pbufp);
-
- /* Don't waste time in a long search for a pattern
- that says it is anchored. */
- if (pbufp->used > 0 && (enum regexpcode) pbufp->buffer[0] == begbuf
- && range > 0)
- {
- if (startpos > 0)
- return -1;
- else
- range = 1;
- }
-
- while (1)
- {
- /* If a fastmap is supplied, skip quickly over characters
- that cannot possibly be the start of a match.
- Note, however, that if the pattern can possibly match
- the null string, we must test it at each starting point
- so that we take the first null string we get. */
-
- if (fastmap && startpos < total && pbufp->can_be_null != 1)
- {
- if (range > 0)
- {
- register int lim = 0;
- register unsigned char *p;
- int irange = range;
- if (startpos < size1 && startpos + range >= size1)
- lim = range - (size1 - startpos);
-
- p = ((unsigned char *)
- &(startpos >= size1 ? string2 - size1 : string1)[startpos]);
-
- if (translate)
- {
- while (range > lim && !fastmap[translate[*p++]])
- range--;
- }
- else
- {
- while (range > lim && !fastmap[*p++])
- range--;
- }
- startpos += irange - range;
- }
- else
- {
- register unsigned char c;
- if (startpos >= size1)
- c = string2[startpos - size1];
- else
- c = string1[startpos];
- c &= 0xff;
- if (translate ? !fastmap[translate[c]] : !fastmap[c])
- goto advance;
- }
- }
-
- if (range >= 0 && startpos == total
- && fastmap && pbufp->can_be_null == 0)
- return -1;
-
- val = re_match_2 (pbufp, string1, size1, string2, size2, startpos, regs, mstop);
- if (0 <= val)
- {
- if (val == -2)
- return -2;
- return startpos;
- }
-
-#ifdef C_ALLOCA
- alloca (0);
-#endif /* C_ALLOCA */
-
- advance:
- if (!range) break;
- if (range > 0) range--, startpos++; else range++, startpos--;
- }
- return -1;
-}
-
-#ifndef emacs /* emacs never uses this */
-int
-re_match (pbufp, string, size, pos, regs)
- struct re_pattern_buffer *pbufp;
- char *string;
- int size, pos;
- struct re_registers *regs;
-{
- return re_match_2 (pbufp, 0, 0, string, size, pos, regs, size);
-}
-#endif /* emacs */
-
-/* Maximum size of failure stack. Beyond this, overflow is an error. */
-
-int re_max_failures = 2000;
-
-static int memcmp_translate();
-/* Match the pattern described by PBUFP
- against data which is the virtual concatenation of STRING1 and STRING2.
- SIZE1 and SIZE2 are the sizes of the two data strings.
- Start the match at position POS.
- Do not consider matching past the position MSTOP.
-
- If pbufp->fastmap is nonzero, then it had better be up to date.
-
- The reason that the data to match are specified as two components
- which are to be regarded as concatenated
- is so this function can be used directly on the contents of an Emacs buffer.
-
- -1 is returned if there is no match. -2 is returned if there is
- an error (such as match stack overflow). Otherwise the value is the length
- of the substring which was matched. */
-
-int
-re_match_2 (pbufp, string1, size1, string2, size2, pos, regs, mstop)
- struct re_pattern_buffer *pbufp;
- unsigned char *string1, *string2;
- int size1, size2;
- int pos;
- struct re_registers *regs;
- int mstop;
-{
- register unsigned char *p = (unsigned char *) pbufp->buffer;
- register unsigned char *pend = p + pbufp->used;
- /* End of first string */
- unsigned char *end1;
- /* End of second string */
- unsigned char *end2;
- /* Pointer just past last char to consider matching */
- unsigned char *end_match_1, *end_match_2;
- register unsigned char *d, *dend;
- register int mcnt;
- unsigned char *translate = (unsigned char *) pbufp->translate;
-
- /* Failure point stack. Each place that can handle a failure further down the line
- pushes a failure point on this stack. It consists of two char *'s.
- The first one pushed is where to resume scanning the pattern;
- the second pushed is where to resume scanning the strings.
- If the latter is zero, the failure point is a "dummy".
- If a failure happens and the innermost failure point is dormant,
- it discards that failure point and tries the next one. */
-
- unsigned char *initial_stack[2 * NFAILURES];
- unsigned char **stackb = initial_stack;
- unsigned char **stackp = stackb, **stacke = &stackb[2 * NFAILURES];
-
- /* Information on the "contents" of registers.
- These are pointers into the input strings; they record
- just what was matched (on this attempt) by some part of the pattern.
- The start_memory command stores the start of a register's contents
- and the stop_memory command stores the end.
-
- At that point, regstart[regnum] points to the first character in the register,
- regend[regnum] points to the first character beyond the end of the register,
- regstart_seg1[regnum] is true iff regstart[regnum] points into string1,
- and regend_seg1[regnum] is true iff regend[regnum] points into string1. */
-
- unsigned char *regstart[RE_NREGS];
- unsigned char *regend[RE_NREGS];
- unsigned char regstart_seg1[RE_NREGS], regend_seg1[RE_NREGS];
-
- /* Set up pointers to ends of strings.
- Don't allow the second string to be empty unless both are empty. */
- if (!size2)
- {
- string2 = string1;
- size2 = size1;
- string1 = 0;
- size1 = 0;
- }
- end1 = string1 + size1;
- end2 = string2 + size2;
-
- /* Compute where to stop matching, within the two strings */
- if (mstop <= size1)
- {
- end_match_1 = string1 + mstop;
- end_match_2 = string2;
- }
- else
- {
- end_match_1 = end1;
- end_match_2 = string2 + mstop - size1;
- }
-
- /* Initialize \) text positions to -1
- to mark ones that no \( or \) has been seen for. */
-
- for (mcnt = 0; mcnt < sizeof (regend) / sizeof (*regend); mcnt++)
- regend[mcnt] = (unsigned char *) -1;
-
- /* `p' scans through the pattern as `d' scans through the data.
- `dend' is the end of the input string that `d' points within.
- `d' is advanced into the following input string whenever necessary,
- but this happens before fetching;
- therefore, at the beginning of the loop,
- `d' can be pointing at the end of a string,
- but it cannot equal string2. */
-
- if (pos <= size1)
- d = string1 + pos, dend = end_match_1;
- else
- d = string2 + pos - size1, dend = end_match_2;
-
-/* Write PREFETCH; just before fetching a character with *d. */
-#define PREFETCH \
- while (d == dend) \
- { if (dend == end_match_2) goto fail; /* end of string2 => failure */ \
- d = string2; /* end of string1 => advance to string2. */ \
- dend = end_match_2; }
-
- /* This loop loops over pattern commands.
- It exits by returning from the function if match is complete,
- or it drops through if match fails at this starting point in the input data. */
-
- while (1)
- {
- if (p == pend)
- /* End of pattern means we have succeeded! */
- {
- /* If caller wants register contents data back, convert it to indices */
- if (regs)
- {
- regs->start[0] = pos;
- if (dend == end_match_1)
- regs->end[0] = d - string1;
- else
- regs->end[0] = d - string2 + size1;
- for (mcnt = 1; mcnt < RE_NREGS; mcnt++)
- {
- if (regend[mcnt] == (unsigned char *) -1)
- {
- regs->start[mcnt] = -1;
- regs->end[mcnt] = -1;
- continue;
- }
- if (regstart_seg1[mcnt])
- regs->start[mcnt] = regstart[mcnt] - string1;
- else
- regs->start[mcnt] = regstart[mcnt] - string2 + size1;
- if (regend_seg1[mcnt])
- regs->end[mcnt] = regend[mcnt] - string1;
- else
- regs->end[mcnt] = regend[mcnt] - string2 + size1;
- }
- }
- if (dend == end_match_1)
- return (d - string1 - pos);
- else
- return d - string2 + size1 - pos;
- }
-
- /* Otherwise match next pattern command */
-#ifdef SWITCH_ENUM_BUG
- switch ((int) ((enum regexpcode) *p++))
-#else
- switch ((enum regexpcode) *p++)
-#endif
- {
-
- /* \( is represented by a start_memory, \) by a stop_memory.
- Both of those commands contain a "register number" argument.
- The text matched within the \( and \) is recorded under that number.
- Then, \<digit> turns into a `duplicate' command which
- is followed by the numeric value of <digit> as the register number. */
-
- case start_memory:
- regstart[*p] = d;
- regstart_seg1[*p++] = (dend == end_match_1);
- break;
-
- case stop_memory:
- regend[*p] = d;
- regend_seg1[*p++] = (dend == end_match_1);
- break;
-
- case duplicate:
- {
- int regno = *p++; /* Get which register to match against */
- register unsigned char *d2, *dend2;
-
- d2 = regstart[regno];
- dend2 = ((regstart_seg1[regno] == regend_seg1[regno])
- ? regend[regno] : end_match_1);
- while (1)
- {
- /* Advance to next segment in register contents, if necessary */
- while (d2 == dend2)
- {
- if (dend2 == end_match_2) break;
- if (dend2 == regend[regno]) break;
- d2 = string2, dend2 = regend[regno]; /* end of string1 => advance to string2. */
- }
- /* At end of register contents => success */
- if (d2 == dend2) break;
-
- /* Advance to next segment in data being matched, if necessary */
- PREFETCH;
-
- /* mcnt gets # consecutive chars to compare */
- mcnt = dend - d;
- if (mcnt > dend2 - d2)
- mcnt = dend2 - d2;
- /* Compare that many; failure if mismatch, else skip them. */
- if (translate ? memcmp_translate (d, d2, mcnt, translate) : memcmp (d, d2, mcnt))
- goto fail;
- d += mcnt, d2 += mcnt;
- }
- }
- break;
-
- case anychar:
- /* fetch a data character */
- PREFETCH;
- /* Match anything but a newline. */
- if ((translate ? translate[*d++] : *d++) == '\n')
- goto fail;
- break;
-
- case charset:
- case charset_not:
- {
- /* Nonzero for charset_not */
- int not = 0;
- register int c;
- if (*(p - 1) == (unsigned char) charset_not)
- not = 1;
-
- /* fetch a data character */
- PREFETCH;
-
- if (translate)
- c = translate [*d];
- else
- c = *d;
-
- if (c < *p * BYTEWIDTH
- && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
-
- p += 1 + *p;
-
- if (!not) goto fail;
- d++;
- break;
- }
-
- case begline:
- if (d == string1 || d[-1] == '\n')
- break;
- goto fail;
-
- case endline:
- if (d == end2
- || (d == end1 ? (size2 == 0 || *string2 == '\n') : *d == '\n'))
- break;
- goto fail;
-
- /* "or" constructs ("|") are handled by starting each alternative
- with an on_failure_jump that points to the start of the next alternative.
- Each alternative except the last ends with a jump to the joining point.
- (Actually, each jump except for the last one really jumps
- to the following jump, because tensioning the jumps is a hassle.) */
-
- /* The start of a stupid repeat has an on_failure_jump that points
- past the end of the repeat text.
- This makes a failure point so that, on failure to match a repetition,
- matching restarts past as many repetitions have been found
- with no way to fail and look for another one. */
-
- /* A smart repeat is similar but loops back to the on_failure_jump
- so that each repetition makes another failure point. */
-
- case on_failure_jump:
- if (stackp == stacke)
- {
- unsigned char **stackx;
- if (stacke - stackb > re_max_failures * 2)
- return -2;
- stackx = (unsigned char **) alloca (2 * (stacke - stackb)
- * sizeof (char *));
- memcpy (stackx, stackb, (stacke - stackb) * sizeof (char *));
- stackp = stackx + (stackp - stackb);
- stacke = stackx + 2 * (stacke - stackb);
- stackb = stackx;
- }
- mcnt = *p++ & 0377;
- mcnt += SIGN_EXTEND_CHAR (*(char *)p) << 8;
- p++;
- *stackp++ = mcnt + p;
- *stackp++ = d;
- break;
-
- /* The end of a smart repeat has an maybe_finalize_jump back.
- Change it either to a finalize_jump or an ordinary jump. */
-
- case maybe_finalize_jump:
- mcnt = *p++ & 0377;
- mcnt += SIGN_EXTEND_CHAR (*(char *)p) << 8;
- p++;
- {
- register unsigned char *p2 = p;
- /* Compare what follows with the begining of the repeat.
- If we can establish that there is nothing that they would
- both match, we can change to finalize_jump */
- while (p2 != pend
- && (*p2 == (unsigned char) stop_memory
- || *p2 == (unsigned char) start_memory))
- p2++;
- if (p2 == pend)
- p[-3] = (unsigned char) finalize_jump;
- else if (*p2 == (unsigned char) exactn
- || *p2 == (unsigned char) endline)
- {
- register int c = *p2 == (unsigned char) endline ? '\n' : p2[2];
- register unsigned char *p1 = p + mcnt;
- /* p1[0] ... p1[2] are an on_failure_jump.
- Examine what follows that */
- if (p1[3] == (unsigned char) exactn && p1[5] != c)
- p[-3] = (unsigned char) finalize_jump;
- else if (p1[3] == (unsigned char) charset
- || p1[3] == (unsigned char) charset_not)
- {
- int not = p1[3] == (unsigned char) charset_not;
- if (c < p1[4] * BYTEWIDTH
- && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
- /* not is 1 if c would match */
- /* That means it is not safe to finalize */
- if (!not)
- p[-3] = (unsigned char) finalize_jump;
- }
- }
- }
- p -= 2;
- if (p[-1] != (unsigned char) finalize_jump)
- {
- p[-1] = (unsigned char) jump;
- goto nofinalize;
- }
-
- /* The end of a stupid repeat has a finalize-jump
- back to the start, where another failure point will be made
- which will point after all the repetitions found so far. */
-
- case finalize_jump:
- stackp -= 2;
-
- case jump:
- nofinalize:
- mcnt = *p++ & 0377;
- mcnt += SIGN_EXTEND_CHAR (*(char *)p) << 8;
- p += mcnt + 1; /* The 1 compensates for missing ++ above */
- break;
-
- case dummy_failure_jump:
- if (stackp == stacke)
- {
- unsigned char **stackx
- = (unsigned char **) alloca (2 * (stacke - stackb)
- * sizeof (char *));
- memcpy (stackx, stackb, (stacke - stackb) * sizeof (char *));
- stackp = stackx + (stackp - stackb);
- stacke = stackx + 2 * (stacke - stackb);
- stackb = stackx;
- }
- *stackp++ = 0;
- *stackp++ = 0;
- goto nofinalize;
-
- case wordbound:
- if (d == string1 /* Points to first char */
- || d == end2 /* Points to end */
- || (d == end1 && size2 == 0)) /* Points to end */
- break;
- if ((SYNTAX (d[-1]) == Sword)
- != (SYNTAX (d == end1 ? *string2 : *d) == Sword))
- break;
- goto fail;
-
- case notwordbound:
- if (d == string1 /* Points to first char */
- || d == end2 /* Points to end */
- || (d == end1 && size2 == 0)) /* Points to end */
- goto fail;
- if ((SYNTAX (d[-1]) == Sword)
- != (SYNTAX (d == end1 ? *string2 : *d) == Sword))
- goto fail;
- break;
-
- case wordbeg:
- if (d == end2 /* Points to end */
- || (d == end1 && size2 == 0) /* Points to end */
- || SYNTAX (* (d == end1 ? string2 : d)) != Sword) /* Next char not a letter */
- goto fail;
- if (d == string1 /* Points to first char */
- || SYNTAX (d[-1]) != Sword) /* prev char not letter */
- break;
- goto fail;
-
- case wordend:
- if (d == string1 /* Points to first char */
- || SYNTAX (d[-1]) != Sword) /* prev char not letter */
- goto fail;
- if (d == end2 /* Points to end */
- || (d == end1 && size2 == 0) /* Points to end */
- || SYNTAX (d == end1 ? *string2 : *d) != Sword) /* Next char not a letter */
- break;
- goto fail;
-
-#ifdef emacs
- case before_dot:
- if (((d - string2 <= (unsigned) size2)
- ? d - bf_p2 : d - bf_p1)
- <= point)
- goto fail;
- break;
-
- case at_dot:
- if (((d - string2 <= (unsigned) size2)
- ? d - bf_p2 : d - bf_p1)
- == point)
- goto fail;
- break;
-
- case after_dot:
- if (((d - string2 <= (unsigned) size2)
- ? d - bf_p2 : d - bf_p1)
- >= point)
- goto fail;
- break;
-
- case wordchar:
- mcnt = (int) Sword;
- goto matchsyntax;
-
- case syntaxspec:
- mcnt = *p++;
- matchsyntax:
- PREFETCH;
- if (SYNTAX (*d++) != (enum syntaxcode) mcnt) goto fail;
- break;
-
- case notwordchar:
- mcnt = (int) Sword;
- goto matchnotsyntax;
-
- case notsyntaxspec:
- mcnt = *p++;
- matchnotsyntax:
- PREFETCH;
- if (SYNTAX (*d++) == (enum syntaxcode) mcnt) goto fail;
- break;
-#else
- case wordchar:
- PREFETCH;
- if (SYNTAX (*d++) == 0) goto fail;
- break;
-
- case notwordchar:
- PREFETCH;
- if (SYNTAX (*d++) != 0) goto fail;
- break;
-#endif /* not emacs */
-
- case begbuf:
- if (d == string1) /* Note, d cannot equal string2 */
- break; /* unless string1 == string2. */
- goto fail;
-
- case endbuf:
- if (d == end2 || (d == end1 && size2 == 0))
- break;
- goto fail;
-
- case exactn:
- /* Match the next few pattern characters exactly.
- mcnt is how many characters to match. */
- mcnt = *p++;
- if (translate)
- {
- do
- {
- PREFETCH;
- if (translate[*d++] != *p++) goto fail;
- }
- while (--mcnt);
- }
- else
- {
- do
- {
- PREFETCH;
- if (*d++ != *p++) goto fail;
- }
- while (--mcnt);
- }
- break;
- }
- continue; /* Successfully matched one pattern command; keep matching */
-
- /* Jump here if any matching operation fails. */
- fail:
- if (stackp != stackb)
- /* A restart point is known. Restart there and pop it. */
- {
- if (!stackp[-2])
- { /* If innermost failure point is dormant, flush it and keep looking */
- stackp -= 2;
- goto fail;
- }
- d = *--stackp;
- p = *--stackp;
- if (d >= string1 && d <= end1)
- dend = end_match_1;
- }
- else break; /* Matching at this starting point really fails! */
- }
- return -1; /* Failure to match */
-}
-
-static int
-memcmp_translate (s1, s2, len, translate)
- unsigned char *s1, *s2;
- register int len;
- unsigned char *translate;
-{
- register unsigned char *p1 = s1, *p2 = s2;
- while (len)
- {
- if (translate [*p1++] != translate [*p2++]) return 1;
- len--;
- }
- return 0;
-}
-
-/* Entry points compatible with bsd4.2 regex library */
-
-#ifndef emacs
-
-static struct re_pattern_buffer re_comp_buf;
-
-char *
-re_comp (s)
- const char *s;
-{
- if (!s)
- {
- if (!re_comp_buf.buffer)
- return "No previous regular expression";
- return 0;
- }
-
- if (!re_comp_buf.buffer)
- {
- if (!(re_comp_buf.buffer = (char *) malloc (200)))
- return "Memory exhausted";
- re_comp_buf.allocated = 200;
- if (!(re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH)))
- return "Memory exhausted";
- }
- return re_compile_pattern (s, strlen (s), &re_comp_buf);
-}
-
-int
-re_exec (s)
- char *s;
-{
- int len = strlen (s);
- return 0 <= re_search (&re_comp_buf, s, len, 0, len, 0);
-}
-
-#endif /* emacs */
-
-#ifdef test
-
-#include <stdio.h>
-
-/* Indexed by a character, gives the upper case equivalent of the character */
-
-static char upcase[0400] =
- { 000, 001, 002, 003, 004, 005, 006, 007,
- 010, 011, 012, 013, 014, 015, 016, 017,
- 020, 021, 022, 023, 024, 025, 026, 027,
- 030, 031, 032, 033, 034, 035, 036, 037,
- 040, 041, 042, 043, 044, 045, 046, 047,
- 050, 051, 052, 053, 054, 055, 056, 057,
- 060, 061, 062, 063, 064, 065, 066, 067,
- 070, 071, 072, 073, 074, 075, 076, 077,
- 0100, 0101, 0102, 0103, 0104, 0105, 0106, 0107,
- 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117,
- 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127,
- 0130, 0131, 0132, 0133, 0134, 0135, 0136, 0137,
- 0140, 0101, 0102, 0103, 0104, 0105, 0106, 0107,
- 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117,
- 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127,
- 0130, 0131, 0132, 0173, 0174, 0175, 0176, 0177,
- 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207,
- 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217,
- 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227,
- 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237,
- 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247,
- 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257,
- 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267,
- 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277,
- 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307,
- 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317,
- 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327,
- 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337,
- 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347,
- 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357,
- 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367,
- 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377
- };
-
-main (argc, argv)
- int argc;
- char **argv;
-{
- char pat[80];
- struct re_pattern_buffer buf;
- int i;
- char c;
- char fastmap[(1 << BYTEWIDTH)];
-
- /* Allow a command argument to specify the style of syntax. */
- if (argc > 1)
- obscure_syntax = atoi (argv[1]);
-
- buf.allocated = 40;
- buf.buffer = (char *) malloc (buf.allocated);
- buf.fastmap = fastmap;
- buf.translate = upcase;
-
- while (1)
- {
- gets (pat);
-
- if (*pat)
- {
- re_compile_pattern (pat, strlen(pat), &buf);
-
- for (i = 0; i < buf.used; i++)
- printchar (buf.buffer[i]);
-
- putchar_unfiltered ('\n');
-
- printf_unfiltered ("%d allocated, %d used.\n", buf.allocated, buf.used);
-
- re_compile_fastmap (&buf);
- printf_unfiltered ("Allowed by fastmap: ");
- for (i = 0; i < (1 << BYTEWIDTH); i++)
- if (fastmap[i]) printchar (i);
- putchar_unfiltered ('\n');
- }
-
- gets (pat); /* Now read the string to match against */
-
- i = re_match (&buf, pat, strlen (pat), 0, 0);
- printf_unfiltered ("Match value %d.\n", i);
- }
-}
-
-#ifdef NOTDEF
-print_buf (bufp)
- struct re_pattern_buffer *bufp;
-{
- int i;
-
- printf_unfiltered ("buf is :\n----------------\n");
- for (i = 0; i < bufp->used; i++)
- printchar (bufp->buffer[i]);
-
- printf_unfiltered ("\n%d allocated, %d used.\n", bufp->allocated, bufp->used);
-
- printf_unfiltered ("Allowed by fastmap: ");
- for (i = 0; i < (1 << BYTEWIDTH); i++)
- if (bufp->fastmap[i])
- printchar (i);
- printf_unfiltered ("\nAllowed by translate: ");
- if (bufp->translate)
- for (i = 0; i < (1 << BYTEWIDTH); i++)
- if (bufp->translate[i])
- printchar (i);
- printf_unfiltered ("\nfastmap is%s accurate\n", bufp->fastmap_accurate ? "" : "n't");
- printf_unfiltered ("can %s be null\n----------", bufp->can_be_null ? "" : "not");
-}
-#endif
-
-printchar (c)
- char c;
-{
- if (c < 041 || c >= 0177)
- {
- putchar_unfiltered ('\\');
- putchar_unfiltered (((c >> 6) & 3) + '0');
- putchar_unfiltered (((c >> 3) & 7) + '0');
- putchar_unfiltered ((c & 7) + '0');
- }
- else
- putchar_unfiltered (c);
-}
-
-error (string)
- char *string;
-{
- puts_unfiltered (string);
- exit (1);
-}
-
-#endif /* test */
diff --git a/gnu/usr.bin/gdb/gdb/regex.h b/gnu/usr.bin/gdb/gdb/regex.h
deleted file mode 100644
index a4ed6d3..0000000
--- a/gnu/usr.bin/gdb/gdb/regex.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/* Definitions for data structures callers pass the regex library.
- Copyright (C) 1985, 1989 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Define number of parens for which we record the beginnings and ends.
- This affects how much space the `struct re_registers' type takes up. */
-#ifndef RE_NREGS
-#define RE_NREGS 10
-#endif
-
-/* These bits are used in the obscure_syntax variable to choose among
- alternative regexp syntaxes. */
-
-/* 1 means plain parentheses serve as grouping, and backslash
- parentheses are needed for literal searching.
- 0 means backslash-parentheses are grouping, and plain parentheses
- are for literal searching. */
-#define RE_NO_BK_PARENS 1
-
-/* 1 means plain | serves as the "or"-operator, and \| is a literal.
- 0 means \| serves as the "or"-operator, and | is a literal. */
-#define RE_NO_BK_VBAR 2
-
-/* 0 means plain + or ? serves as an operator, and \+, \? are literals.
- 1 means \+, \? are operators and plain +, ? are literals. */
-#define RE_BK_PLUS_QM 4
-
-/* 1 means | binds tighter than ^ or $.
- 0 means the contrary. */
-#define RE_TIGHT_VBAR 8
-
-/* 1 means treat \n as an _OR operator
- 0 means treat it as a normal character */
-#define RE_NEWLINE_OR 16
-
-/* 0 means that a special characters (such as *, ^, and $) always have
- their special meaning regardless of the surrounding context.
- 1 means that special characters may act as normal characters in some
- contexts. Specifically, this applies to:
- ^ - only special at the beginning, or after ( or |
- $ - only special at the end, or before ) or |
- *, +, ? - only special when not after the beginning, (, or | */
-#define RE_CONTEXT_INDEP_OPS 32
-
-/* Now define combinations of bits for the standard possibilities. */
-#define RE_SYNTAX_AWK (RE_NO_BK_PARENS | RE_NO_BK_VBAR | RE_CONTEXT_INDEP_OPS)
-#define RE_SYNTAX_EGREP (RE_SYNTAX_AWK | RE_NEWLINE_OR)
-#define RE_SYNTAX_GREP (RE_BK_PLUS_QM | RE_NEWLINE_OR)
-#define RE_SYNTAX_EMACS 0
-
-/* This data structure is used to represent a compiled pattern. */
-
-struct re_pattern_buffer
- {
- char *buffer; /* Space holding the compiled pattern commands. */
- int allocated; /* Size of space that buffer points to */
- int used; /* Length of portion of buffer actually occupied */
- char *fastmap; /* Pointer to fastmap, if any, or zero if none. */
- /* re_search uses the fastmap, if there is one,
- to skip quickly over totally implausible characters */
- char *translate; /* Translate table to apply to all characters before comparing.
- Or zero for no translation.
- The translation is applied to a pattern when it is compiled
- and to data when it is matched. */
- char fastmap_accurate;
- /* Set to zero when a new pattern is stored,
- set to one when the fastmap is updated from it. */
- char can_be_null; /* Set to one by compiling fastmap
- if this pattern might match the null string.
- It does not necessarily match the null string
- in that case, but if this is zero, it cannot.
- 2 as value means can match null string
- but at end of range or before a character
- listed in the fastmap. */
- };
-
-/* Structure to store "register" contents data in.
-
- Pass the address of such a structure as an argument to re_match, etc.,
- if you want this information back.
-
- start[i] and end[i] record the string matched by \( ... \) grouping i,
- for i from 1 to RE_NREGS - 1.
- start[0] and end[0] record the entire string matched. */
-
-struct re_registers
- {
- int start[RE_NREGS];
- int end[RE_NREGS];
- };
-
-/* These are the command codes that appear in compiled regular expressions, one per byte.
- Some command codes are followed by argument bytes.
- A command code can specify any interpretation whatever for its arguments.
- Zero-bytes may appear in the compiled regular expression. */
-
-enum regexpcode
- {
- unused,
- exactn, /* followed by one byte giving n, and then by n literal bytes */
- begline, /* fails unless at beginning of line */
- endline, /* fails unless at end of line */
- jump, /* followed by two bytes giving relative address to jump to */
- on_failure_jump, /* followed by two bytes giving relative address of place
- to resume at in case of failure. */
- finalize_jump, /* Throw away latest failure point and then jump to address. */
- maybe_finalize_jump, /* Like jump but finalize if safe to do so.
- This is used to jump back to the beginning
- of a repeat. If the command that follows
- this jump is clearly incompatible with the
- one at the beginning of the repeat, such that
- we can be sure that there is no use backtracking
- out of repetitions already completed,
- then we finalize. */
- dummy_failure_jump, /* jump, and push a dummy failure point.
- This failure point will be thrown away
- if an attempt is made to use it for a failure.
- A + construct makes this before the first repeat. */
- anychar, /* matches any one character */
- charset, /* matches any one char belonging to specified set.
- First following byte is # bitmap bytes.
- Then come bytes for a bit-map saying which chars are in.
- Bits in each byte are ordered low-bit-first.
- A character is in the set if its bit is 1.
- A character too large to have a bit in the map
- is automatically not in the set */
- charset_not, /* similar but match any character that is NOT one of those specified */
- start_memory, /* starts remembering the text that is matched
- and stores it in a memory register.
- followed by one byte containing the register number.
- Register numbers must be in the range 0 through NREGS. */
- stop_memory, /* stops remembering the text that is matched
- and stores it in a memory register.
- followed by one byte containing the register number.
- Register numbers must be in the range 0 through NREGS. */
- duplicate, /* match a duplicate of something remembered.
- Followed by one byte containing the index of the memory register. */
- before_dot, /* Succeeds if before dot */
- at_dot, /* Succeeds if at dot */
- after_dot, /* Succeeds if after dot */
- begbuf, /* Succeeds if at beginning of buffer */
- endbuf, /* Succeeds if at end of buffer */
- wordchar, /* Matches any word-constituent character */
- notwordchar, /* Matches any char that is not a word-constituent */
- wordbeg, /* Succeeds if at word beginning */
- wordend, /* Succeeds if at word end */
- wordbound, /* Succeeds if at a word boundary */
- notwordbound, /* Succeeds if not at a word boundary */
- syntaxspec, /* Matches any character whose syntax is specified.
- followed by a byte which contains a syntax code, Sword or such like */
- notsyntaxspec /* Matches any character whose syntax differs from the specified. */
- };
-
-extern char *re_compile_pattern ();
-/* Is this really advertised? */
-extern void re_compile_fastmap ();
-extern int re_search (), re_search_2 ();
-extern int re_match (), re_match_2 ();
-
-/* 4.2 bsd compatibility (yuck) */
-extern char *re_comp ();
-extern int re_exec ();
-
-#ifdef SYNTAX_TABLE
-extern char *re_syntax_table;
-#endif
-
-extern int re_set_syntax ();
diff --git a/gnu/usr.bin/gdb/gdb/y.tab.h b/gnu/usr.bin/gdb/gdb/y.tab.h
deleted file mode 100644
index 62e0883..0000000
--- a/gnu/usr.bin/gdb/gdb/y.tab.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#define INT 257
-#define HEX 258
-#define ERROR 259
-#define UINT 260
-#define M2_TRUE 261
-#define M2_FALSE 262
-#define CHAR 263
-#define FLOAT 264
-#define STRING 265
-#define NAME 266
-#define BLOCKNAME 267
-#define IDENT 268
-#define VARNAME 269
-#define TYPENAME 270
-#define SIZE 271
-#define CAP 272
-#define ORD 273
-#define HIGH 274
-#define ABS 275
-#define MIN_FUNC 276
-#define MAX_FUNC 277
-#define FLOAT_FUNC 278
-#define VAL 279
-#define CHR 280
-#define ODD 281
-#define TRUNC 282
-#define INC 283
-#define DEC 284
-#define INCL 285
-#define EXCL 286
-#define COLONCOLON 287
-#define LAST 288
-#define REGNAME 289
-#define INTERNAL_VAR 290
-#define ABOVE_COMMA 291
-#define ASSIGN 292
-#define LEQ 293
-#define GEQ 294
-#define NOTEQUAL 295
-#define IN 296
-#define OROR 297
-#define LOGICAL_AND 298
-#define DIV 299
-#define MOD 300
-#define UNARY 301
-#define DOT 302
-#define NOT 303
-#define QID 304
-typedef union
- {
- LONGEST lval;
- unsigned LONGEST ulval;
- double dval;
- struct symbol *sym;
- struct type *tval;
- struct stoken sval;
- int voidval;
- struct block *bval;
- enum exp_opcode opcode;
- struct internalvar *ivar;
-
- struct type **tvec;
- int *ivec;
- } YYSTYPE;
-extern YYSTYPE m2_lval;
diff --git a/gnu/usr.bin/gdb/getpagesize.h b/gnu/usr.bin/gdb/getpagesize.h
deleted file mode 100644
index 32adae6..0000000
--- a/gnu/usr.bin/gdb/getpagesize.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifdef BSD
-#ifndef BSD4_1
-#define HAVE_GETPAGESIZE
-#endif
-#endif
-
-#ifndef HAVE_GETPAGESIZE
-
-#include <sys/param.h>
-
-#ifdef EXEC_PAGESIZE
-#define getpagesize() EXEC_PAGESIZE
-#else
-#ifdef NBPG
-#define getpagesize() NBPG * CLSIZE
-#ifndef CLSIZE
-#define CLSIZE 1
-#endif /* no CLSIZE */
-#else /* no NBPG */
-#define getpagesize() NBPC
-#endif /* no NBPG */
-#endif /* no EXEC_PAGESIZE */
-
-#endif /* not HAVE_GETPAGESIZE */
-
diff --git a/gnu/usr.bin/gdb/infcmd.c b/gnu/usr.bin/gdb/infcmd.c
deleted file mode 100644
index 378784f..0000000
--- a/gnu/usr.bin/gdb/infcmd.c
+++ /dev/null
@@ -1,1204 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)infcmd.c 6.4 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* Memory-access and commands for inferior process, for GDB.
- Copyright (C) 1986, 1987, 1988, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include "defs.h"
-#include "param.h"
-#include "symtab.h"
-#include "frame.h"
-#include "inferior.h"
-#include "environ.h"
-#include "value.h"
-
-#include <signal.h>
-#include <sys/param.h>
-
-extern char *sys_siglist[];
-
-#define ERROR_NO_INFERIOR \
- if (inferior_pid == 0) error ("The program is not being run.");
-
-/* String containing arguments to give to the program,
- with a space added at the front. Just a space means no args. */
-
-static char *inferior_args;
-
-/* File name for default use for standard in/out in the inferior. */
-
-char *inferior_io_terminal;
-
-/* Pid of our debugged inferior, or 0 if no inferior now. */
-
-int inferior_pid;
-
-/* Last signal that the inferior received (why it stopped). */
-
-int stop_signal;
-
-/* Address at which inferior stopped. */
-
-CORE_ADDR stop_pc;
-
-/* Stack frame when program stopped. */
-
-FRAME_ADDR stop_frame_address;
-
-/* Number of breakpoint it stopped at, or 0 if none. */
-
-int stop_breakpoint;
-
-/* Nonzero if stopped due to a step command. */
-
-int stop_step;
-
-/* Nonzero if stopped due to completion of a stack dummy routine. */
-
-int stop_stack_dummy;
-
-/* Nonzero if stopped due to a random (unexpected) signal in inferior
- process. */
-
-int stopped_by_random_signal;
-
-/* Range to single step within.
- If this is nonzero, respond to a single-step signal
- by continuing to step if the pc is in this range. */
-
-CORE_ADDR step_range_start; /* Inclusive */
-CORE_ADDR step_range_end; /* Exclusive */
-
-/* Stack frame address as of when stepping command was issued.
- This is how we know when we step into a subroutine call,
- and how to set the frame for the breakpoint used to step out. */
-
-FRAME_ADDR step_frame_address;
-
-/* 1 means step over all subroutine calls.
- -1 means step over calls to undebuggable functions. */
-
-int step_over_calls;
-
-/* If stepping, nonzero means step count is > 1
- so don't print frame next time inferior stops
- if it stops due to stepping. */
-
-int step_multi;
-
-/* Environment to use for running inferior,
- in format described in environ.h. */
-
-struct environ *inferior_environ;
-
-CORE_ADDR read_pc ();
-struct command_line *get_breakpoint_commands ();
-void breakpoint_clear_ignore_counts ();
-
-
-int
-have_inferior_p ()
-{
- return inferior_pid != 0;
-}
-
-static void
-set_args_command (args)
- char *args;
-{
- free (inferior_args);
- if (!args) args = "";
- inferior_args = concat (" ", args, "");
-}
-
-void
-tty_command (file, from_tty)
- char *file;
- int from_tty;
-{
- if (file == 0)
- error_no_arg ("terminal name for running target process");
-
- inferior_io_terminal = savestring (file, strlen (file));
-}
-
-static void
-run_command (args, from_tty)
- char *args;
- int from_tty;
-{
- extern char **environ;
- register int i;
- char *exec_file;
- char *allargs;
-
- extern int sys_nerr;
- extern char *sys_errlist[];
- extern int errno;
-
- dont_repeat ();
-
- if (inferior_pid)
- {
- extern int inhibit_confirm;
- if (!(inhibit_confirm ||
- query ("The program being debugged has been started already.\n\
-Start it from the beginning? ")))
- error ("Program not restarted.");
- kill_inferior ();
- }
-
-#if 0
- /* On the other hand, some users want to do
- break open
- ignore 1 40
- run
- So it's not clear what is best. */
-
- /* It is confusing to the user for ignore counts to stick around
- from previous runs of the inferior. So clear them. */
- breakpoint_clear_ignore_counts ();
-#endif
-
- exec_file = (char *) get_exec_file (1);
-
- if (remote_debugging)
- {
- if (from_tty)
- {
- printf ("Starting program: %s\n", exec_file);
- fflush (stdout);
- }
- }
- else
- {
- if (args)
- set_args_command (args);
-
- if (from_tty)
- {
- printf ("Starting program: %s%s\n",
- exec_file, inferior_args);
- fflush (stdout);
- }
-
- allargs = concat ("exec ", exec_file, inferior_args);
- inferior_pid = create_inferior (allargs, environ_vector (inferior_environ));
- }
-
- clear_proceed_status ();
-
- start_inferior ();
-}
-
-void
-cont_command (proc_count_exp, from_tty)
- char *proc_count_exp;
- int from_tty;
-{
- ERROR_NO_INFERIOR;
-
- clear_proceed_status ();
-
- /* If have argument, set proceed count of breakpoint we stopped at. */
-
- if (stop_breakpoint > 0 && proc_count_exp)
- {
- set_ignore_count (stop_breakpoint,
- parse_and_eval_address (proc_count_exp) - 1,
- from_tty);
- if (from_tty)
- printf (" ");
- }
-
- if (from_tty)
- printf ("Continuing.\n");
-
- proceed (-1, -1, 0);
-}
-
-/* Step until outside of current statement. */
-static void step_1 ();
-
-static void
-step_command (count_string)
-{
- step_1 (0, 0, count_string);
-}
-
-/* Likewise, but skip over subroutine calls as if single instructions. */
-
-static void
-next_command (count_string)
-{
- step_1 (1, 0, count_string);
-}
-
-/* Likewise, but step only one instruction. */
-
-static void
-stepi_command (count_string)
-{
- step_1 (0, 1, count_string);
-}
-
-static void
-nexti_command (count_string)
-{
- step_1 (1, 1, count_string);
-}
-
-static void
-step_1 (skip_subroutines, single_inst, count_string)
- int skip_subroutines;
- int single_inst;
- char *count_string;
-{
- register int count = 1;
-
- ERROR_NO_INFERIOR;
- count = count_string ? parse_and_eval_address (count_string) : 1;
-
- for (; count > 0; count--)
- {
- clear_proceed_status ();
-
- step_frame_address = FRAME_FP (get_current_frame ());
-
- if (! single_inst)
- {
- find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end);
- if (step_range_end == 0)
- {
- int misc;
-
- misc = find_pc_misc_function (stop_pc);
- terminal_ours ();
- printf ("Current function has no line number information.\n");
- fflush (stdout);
-
- /* No info or after _etext ("Can't happen") */
- if (misc == -1 || misc == misc_function_count - 1)
- error ("No data available on pc function.");
-
- printf ("Single stepping until function exit.\n");
- fflush (stdout);
-
- step_range_start = misc_function_vector[misc].address;
- step_range_end = misc_function_vector[misc + 1].address;
- }
- }
- else
- {
- /* Say we are stepping, but stop after one insn whatever it does.
- Don't step through subroutine calls even to undebuggable
- functions. */
- step_range_start = step_range_end = 1;
- if (!skip_subroutines)
- step_over_calls = 0;
- }
-
- if (skip_subroutines)
- step_over_calls = 1;
-
- step_multi = (count > 1);
- proceed (-1, -1, 1);
- if (! stop_step)
- break;
- }
-}
-
-/* Continue program at specified address. */
-
-static void
-jump_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- register CORE_ADDR addr;
- struct symtabs_and_lines sals;
- struct symtab_and_line sal;
-
- ERROR_NO_INFERIOR;
-
- if (!arg)
- error_no_arg ("starting address");
-
- sals = decode_line_spec_1 (arg, 1);
- if (sals.nelts != 1)
- {
- error ("Unreasonable jump request");
- }
-
- sal = sals.sals[0];
- free (sals.sals);
-
- if (sal.symtab == 0 && sal.pc == 0)
- error ("No source file has been specified.");
-
- if (sal.pc == 0)
- sal.pc = find_line_pc (sal.symtab, sal.line);
-
- {
- struct symbol *fn = get_frame_function (get_current_frame ());
- struct symbol *sfn = find_pc_function (sal.pc);
- if (fn != 0 && sfn != fn
- && ! query ("Line %d is not in `%s'. Jump anyway? ",
- sal.line, SYMBOL_NAME (fn)))
- error ("Not confirmed.");
- }
-
- if (sal.pc == 0)
- error ("No line %d in file \"%s\".", sal.line, sal.symtab->filename);
-
- addr = sal.pc;
-
- clear_proceed_status ();
-
- if (from_tty)
- printf ("Continuing at 0x%x.\n", addr);
-
- proceed (addr, 0, 0);
-}
-
-/* Continue program giving it specified signal. */
-
-static void
-signal_command (signum_exp, from_tty)
- char *signum_exp;
- int from_tty;
-{
- register int signum;
-
- dont_repeat (); /* Too dangerous. */
- ERROR_NO_INFERIOR;
-
- if (!signum_exp)
- error_no_arg ("signal number");
-
- signum = parse_and_eval_address (signum_exp);
-
- clear_proceed_status ();
-
- if (from_tty)
- printf ("Continuing with signal %d.\n", signum);
-
- proceed (stop_pc, signum, 0);
-}
-
-/* Execute a "stack dummy", a piece of code stored in the stack
- by the debugger to be executed in the inferior.
-
- To call: first, do PUSH_DUMMY_FRAME.
- Then push the contents of the dummy. It should end with a breakpoint insn.
- Then call here, passing address at which to start the dummy.
-
- The contents of all registers are saved before the dummy frame is popped
- and copied into the buffer BUFFER.
-
- The dummy's frame is automatically popped whenever that break is hit.
- If that is the first time the program stops, run_stack_dummy
- returns to its caller with that frame already gone.
- Otherwise, the caller never gets returned to. */
-
-/* 4 => return instead of letting the stack dummy run. */
-
-static int stack_dummy_testing = 0;
-
-void
-run_stack_dummy (addr, buffer)
- CORE_ADDR addr;
- REGISTER_TYPE *buffer;
-{
- /* Now proceed, having reached the desired place. */
- clear_proceed_status ();
-#ifdef notdef
- if (stack_dummy_testing & 4)
- {
- POP_FRAME;
- return;
- }
-#endif
- proceed (addr, 0, 0);
-
- if (!stop_stack_dummy)
- error ("Cannot continue previously requested operation.");
-
- /* On return, the stack dummy has been popped already. */
-
- read_register_bytes(0, buffer, REGISTER_BYTES);
-}
-
-/* Proceed until we reach the given line as argument or exit the
- function. When called with no argument, proceed until we reach a
- different source line with pc greater than our current one or exit
- the function. We skip calls in both cases.
-
- The effect of this command with an argument is identical to setting
- a momentary breakpoint at the line specified and executing
- "finish".
-
- Note that eventually this command should probably be changed so
- that only source lines are printed out when we hit the breakpoint
- we set. I'm going to postpone this until after a hopeful rewrite
- of wait_for_inferior and the proceed status code. -- randy */
-
-void
-until_next_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- FRAME frame;
- CORE_ADDR pc;
- struct symbol *func;
- struct symtab_and_line sal;
-
- clear_proceed_status ();
-
- frame = get_current_frame ();
-
- /* Step until either exited from this function or greater
- than the current line (if in symbolic section) or pc (if
- not). */
-
- pc = read_pc ();
- func = find_pc_function (pc);
-
- if (!func)
- {
- int misc_func = find_pc_misc_function (pc);
-
- if (misc_func != -1)
- error ("Execution is not within a known function.");
-
- step_range_start = misc_function_vector[misc_func].address;
- step_range_end = pc;
- }
- else
- {
- sal = find_pc_line (pc, 0);
-
- step_range_start = BLOCK_START (SYMBOL_BLOCK_VALUE (func));
- step_range_end = sal.end;
- }
-
- step_over_calls = 1;
- step_frame_address = FRAME_FP (frame);
-
- step_multi = 0; /* Only one call to proceed */
-
- proceed (-1, -1, 1);
-}
-
-void
-until_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- if (!have_inferior_p ())
- error ("The program is not being run.");
-
- if (arg)
- until_break_command (arg, from_tty);
- else
- until_next_command (arg, from_tty);
-}
-
-/* "finish": Set a temporary breakpoint at the place
- the selected frame will return to, then continue. */
-
-static void
-finish_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- struct symtab_and_line sal;
- register FRAME frame;
- struct frame_info *fi;
- register struct symbol *function;
-
- if (!have_inferior_p ())
- error ("The program is not being run.");
- if (arg)
- error ("The \"finish\" command does not take any arguments.");
-
- frame = get_prev_frame (selected_frame);
- if (frame == 0)
- error ("\"finish\" not meaningful in the outermost frame.");
-
- clear_proceed_status ();
-
- fi = get_frame_info (frame);
- sal = find_pc_line (fi->pc, 0);
- sal.pc = fi->pc;
- set_momentary_breakpoint (sal, frame);
-
- /* Find the function we will return from. */
-
- fi = get_frame_info (selected_frame);
- function = find_pc_function (fi->pc);
-
- if (from_tty)
- {
- printf ("Run till exit from ");
- print_selected_frame ();
- }
-
- proceed (-1, -1, 0);
-
- if (stop_breakpoint == -3 && function != 0)
- {
- struct type *value_type;
- register value val;
- CORE_ADDR funcaddr;
- extern char registers[];
-
- value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
- if (!value_type)
- fatal ("internal: finish_command: function has no target type");
-
- if (TYPE_CODE (value_type) == TYPE_CODE_VOID)
- return;
-
- funcaddr = BLOCK_START (SYMBOL_BLOCK_VALUE (function));
-
- val = value_being_returned (value_type, registers,
- using_struct_return (function,
- funcaddr,
- value_type));
-
- printf ("Value returned is $%d = ", record_latest_value (val));
- value_print (val, stdout, 0, Val_no_prettyprint);
- putchar ('\n');
- }
-}
-
-static void
-program_info ()
-{
- if (inferior_pid == 0)
- {
- printf ("The program being debugged is not being run.\n");
- return;
- }
-
- printf ("Program being debugged is in process %d, stopped at 0x%x.\n",
- inferior_pid, stop_pc);
- if (stop_step)
- printf ("It stopped after being stepped.\n");
- else if (stop_breakpoint > 0)
- printf ("It stopped at breakpoint %d.\n", stop_breakpoint);
- else if (stop_signal)
- printf ("It stopped with signal %d (%s).\n",
- stop_signal, sys_siglist[stop_signal]);
-
- printf ("\nType \"info stack\" or \"info reg\" for more information.\n");
-}
-
-static void
-environment_info (var)
- char *var;
-{
- if (var)
- {
- register char *val = get_in_environ (inferior_environ, var);
- if (val)
- printf ("%s = %s\n", var, val);
- else
- printf ("Environment variable \"%s\" not defined.\n", var);
- }
- else
- {
- register char **vector = environ_vector (inferior_environ);
- while (*vector)
- printf ("%s\n", *vector++);
- }
-}
-
-static void
-set_environment_command (arg)
- char *arg;
-{
- register char *p, *val, *var;
- int nullset = 0;
-
- if (arg == 0)
- error_no_arg ("environment variable and value");
-
- /* Find seperation between variable name and value */
- p = (char *) index (arg, '=');
- val = (char *) index (arg, ' ');
-
- if (p != 0 && val != 0)
- {
- /* We have both a space and an equals. If the space is before the
- equals and the only thing between the two is more space, use
- the equals */
- if (p > val)
- while (*val == ' ')
- val++;
-
- /* Take the smaller of the two. If there was space before the
- "=", they will be the same right now. */
- p = arg + min (p - arg, val - arg);
- }
- else if (val != 0 && p == 0)
- p = val;
-
- if (p == arg)
- error_no_arg ("environment variable to set");
-
- if (p == 0 || p[1] == 0)
- {
- nullset = 1;
- if (p == 0)
- p = arg + strlen (arg); /* So that savestring below will work */
- }
- else
- {
- /* Not setting variable value to null */
- val = p + 1;
- while (*val == ' ' || *val == '\t')
- val++;
- }
-
- while (p != arg && (p[-1] == ' ' || p[-1] == '\t')) p--;
-
- var = savestring (arg, p - arg);
- if (nullset)
- {
- printf ("Setting environment variable \"%s\" to null value.\n", var);
- set_in_environ (inferior_environ, var, "");
- }
- else
- set_in_environ (inferior_environ, var, val);
- free (var);
-}
-
-static void
-unset_environment_command (var, from_tty)
- char *var;
- int from_tty;
-{
- if (var == 0)
- /* If there is no argument, delete all environment variables.
- Ask for confirmation if reading from the terminal. */
- if (!from_tty || query ("Delete all environment variables? "))
- {
- free_environ (inferior_environ);
- inferior_environ = make_environ ();
- }
-
- unset_in_environ (inferior_environ, var);
-}
-
-/* Read an integer from debugged memory, given address and number of bytes. */
-
-long
-read_memory_integer (memaddr, len)
- CORE_ADDR memaddr;
- int len;
-{
- char cbuf;
- short sbuf;
- int ibuf;
- long lbuf;
- int result_err;
- extern int sys_nerr;
- extern char *sys_errlist[];
-
- if (len == sizeof (char))
- {
- result_err = read_memory (memaddr, &cbuf, len);
- if (result_err)
- error ("Error reading memory address 0x%x: %s (%d).",
- memaddr, (result_err < sys_nerr ?
- sys_errlist[result_err] :
- "uknown error"), result_err);
- return cbuf;
- }
- if (len == sizeof (short))
- {
- result_err = read_memory (memaddr, &sbuf, len);
- if (result_err)
- error ("Error reading memory address 0x%x: %s (%d).",
- memaddr, (result_err < sys_nerr ?
- sys_errlist[result_err] :
- "uknown error"), result_err);
- return sbuf;
- }
- if (len == sizeof (int))
- {
- result_err = read_memory (memaddr, &ibuf, len);
- if (result_err)
- error ("Error reading memory address 0x%x: %s (%d).",
- memaddr, (result_err < sys_nerr ?
- sys_errlist[result_err] :
- "uknown error"), result_err);
- return ibuf;
- }
- if (len == sizeof (lbuf))
- {
- result_err = read_memory (memaddr, &lbuf, len);
- if (result_err)
- error ("Error reading memory address 0x%x: %s (%d).",
- memaddr, (result_err < sys_nerr ?
- sys_errlist[result_err] :
- "uknown error"), result_err);
- return lbuf;
- }
- error ("Cannot handle integers of %d bytes.", len);
-}
-
-CORE_ADDR
-read_pc ()
-{
- return (CORE_ADDR) read_register (PC_REGNUM);
-}
-
-void
-write_pc (val)
- CORE_ADDR val;
-{
- write_register (PC_REGNUM, (long) val);
-#ifdef NPC_REGNUM
- write_register (NPC_REGNUM, (long) val+4);
-#endif
-}
-
-char *reg_names[] = REGISTER_NAMES;
-
-#if !defined (DO_REGISTERS_INFO)
-static void
-print_one_register(i)
- int i;
-{
- unsigned char raw_buffer[MAX_REGISTER_RAW_SIZE];
- unsigned char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
- REGISTER_TYPE val;
-
- /* Get the data in raw format, then convert also to virtual format. */
- read_relative_register_raw_bytes (i, raw_buffer);
- REGISTER_CONVERT_TO_VIRTUAL (i, raw_buffer, virtual_buffer);
-
- fputs_filtered (reg_names[i], stdout);
- print_spaces_filtered (15 - strlen (reg_names[i]), stdout);
-
- /* If virtual format is floating, print it that way. */
- if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT
- && ! INVALID_FLOAT (virtual_buffer, REGISTER_VIRTUAL_SIZE (i)))
- val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0,
- stdout, 0, 1, 0, Val_pretty_default);
- /* Else if virtual format is too long for printf,
- print in hex a byte at a time. */
- else if (REGISTER_VIRTUAL_SIZE (i) > sizeof (long))
- {
- register int j;
- printf_filtered ("0x");
- for (j = 0; j < REGISTER_VIRTUAL_SIZE (i); j++)
- printf_filtered ("%02x", virtual_buffer[j]);
- }
- /* Else print as integer in hex and in decimal. */
- else
- {
- long val;
-
- bcopy (virtual_buffer, &val, sizeof (long));
- if (val == 0)
- printf_filtered ("0");
- else
- printf_filtered ("0x%08x %d", val, val);
- }
-
- /* If register has different raw and virtual formats,
- print the raw format in hex now. */
-
- if (REGISTER_CONVERTIBLE (i))
- {
- register int j;
-
- printf_filtered (" (raw 0x");
- for (j = 0; j < REGISTER_RAW_SIZE (i); j++)
- printf_filtered ("%02x", raw_buffer[j]);
- printf_filtered (")");
- }
- printf_filtered ("\n");
-}
-
-
-/* Print out the machine register regnum. If regnum is -1,
- print all registers.
- For most machines, having all_registers_info() print the
- register(s) one per line is good enough. If a different format
- is required, (eg, for SPARC or Pyramid 90x, which both have
- lots of regs), or there is an existing convention for showing
- all the registers, define the macro DO_REGISTERS_INFO(regnum)
- to provide that format. */
-static void
-do_registers_info (regnum, fpregs)
- int regnum;
- int fpregs;
-{
- register int i;
-
- if (regnum >= 0) {
- print_one_register(regnum);
- return;
- }
-#ifdef notdef
- printf_filtered (
-"Register Contents (relative to selected stack frame)\n\n");
-#endif
- for (i = 0; i < NUM_REGS; i++)
- if (TYPE_CODE(REGISTER_VIRTUAL_TYPE(i)) != TYPE_CODE_FLT ||
- fpregs)
- print_one_register(i);
-}
-#endif /* no DO_REGISTERS_INFO. */
-
-static void
-registers_info (addr_exp, fpregs)
- char *addr_exp;
- int fpregs;
-{
- int regnum;
-
- if (!have_inferior_p () && !have_core_file_p ())
- error ("No inferior or core file");
-
- if (addr_exp)
- {
- if (*addr_exp >= '0' && *addr_exp <= '9')
- regnum = atoi (addr_exp);
- else
- {
- register char *p = addr_exp;
- if (p[0] == '$')
- p++;
- for (regnum = 0; regnum < NUM_REGS; regnum++)
- if (!strcmp (p, reg_names[regnum]))
- break;
- if (regnum == NUM_REGS)
- error ("%s: invalid register name.", addr_exp);
- }
- }
- else
- regnum = -1;
-
-#ifdef DO_REGISTERS_INFO
- DO_REGISTERS_INFO(regnum);
-#else
- do_registers_info(regnum, fpregs);
-#endif
-}
-
-static void
-all_registers_info (addr_exp)
- char *addr_exp;
-{
- registers_info(addr_exp, 1);
-}
-
-static void
-nofp_registers_info (addr_exp)
- char *addr_exp;
-{
- registers_info(addr_exp, 0);
-}
-
-
-#ifdef ATTACH_DETACH
-#define PROCESS_ATTACH_ALLOWED 1
-#else
-#define PROCESS_ATTACH_ALLOWED 0
-#endif
-/*
- * TODO:
- * Should save/restore the tty state since it might be that the
- * program to be debugged was started on this tty and it wants
- * the tty in some state other than what we want. If it's running
- * on another terminal or without a terminal, then saving and
- * restoring the tty state is a harmless no-op.
- * This only needs to be done if we are attaching to a process.
- */
-
-/*
- * attach_command --
- * takes a program started up outside of gdb and ``attaches'' to it.
- * This stops it cold in its tracks and allows us to start tracing it.
- * For this to work, we must be able to send the process a
- * signal and we must have the same effective uid as the program.
- */
-static void
-attach_command (args, from_tty)
- char *args;
- int from_tty;
-{
- char *exec_file;
- int pid;
- int remote = 0;
-
- dont_repeat();
-
- if (!args)
- error_no_arg ("process-id or device file to attach");
-
- while (*args == ' ' || *args == '\t') args++;
-
- if (args[0] < '0' || args[0] > '9')
- remote = 1;
- else
-#ifndef ATTACH_DETACH
- error ("Can't attach to a process on this machine.");
-#else
- pid = atoi (args);
-#endif
-
- if (inferior_pid)
- {
- if (query ("A program is being debugged already. Kill it? "))
- kill_inferior ();
- else
- error ("Inferior not killed.");
- }
-
- exec_file = (char *) get_exec_file (1);
-
- if (from_tty)
- {
- if (remote)
- printf ("Attaching remote machine\n");
- else
- printf ("Attaching program: %s pid %d\n",
- exec_file, pid);
- fflush (stdout);
- }
-
- if (remote)
- {
- remote_open (args, from_tty);
- start_remote ();
- }
-#ifdef ATTACH_DETACH
- else
- attach_program (pid);
-#endif
-}
-
-/*
- * detach_command --
- * takes a program previously attached to and detaches it.
- * The program resumes execution and will no longer stop
- * on signals, etc. We better not have left any breakpoints
- * in the program or it'll die when it hits one. For this
- * to work, it may be necessary for the process to have been
- * previously attached. It *might* work if the program was
- * started via the normal ptrace (PTRACE_TRACEME).
- */
-
-static void
-detach_command (args, from_tty)
- char *args;
- int from_tty;
-{
- int signal = 0;
-
-#ifdef ATTACH_DETACH
- if (inferior_pid && !remote_debugging)
- {
- if (from_tty)
- {
- char *exec_file = (char *)get_exec_file (0);
- if (exec_file == 0)
- exec_file = "";
- printf ("Detaching program: %s pid %d\n",
- exec_file, inferior_pid);
- fflush (stdout);
- }
- if (args)
- signal = atoi (args);
-
- detach (signal);
- inferior_pid = 0;
- }
- else
-#endif
- {
- if (!remote_debugging)
- error ("Not currently attached to subsidiary or remote process.");
-
- if (args)
- error ("Argument given to \"detach\" when remotely debugging.");
-
- inferior_pid = 0;
- remote_close (from_tty);
- }
-}
-
-/* ARGSUSED */
-static void
-float_info (addr_exp)
- char *addr_exp;
-{
-#ifdef FLOAT_INFO
- FLOAT_INFO;
-#else
- printf ("No floating point info available for this processor.\n");
-#endif
-}
-
-extern struct cmd_list_element *setlist, *deletelist;
-
-void
-_initialize_infcmd ()
-{
- add_com ("tty", class_run, tty_command,
- "Set terminal for future runs of program being debugged.");
-
- add_cmd ("args", class_run, set_args_command,
- "Specify arguments to give program being debugged when it is started.\n\
-Follow this command with any number of args, to be passed to the program.",
- &setlist);
-
- add_info ("environment", environment_info,
- "The environment to give the program, or one variable's value.\n\
-With an argument VAR, prints the value of environment variable VAR to\n\
-give the program being debugged. With no arguments, prints the entire\n\
-environment to be given to the program.");
-
- add_cmd ("environment", class_run, unset_environment_command,
- "Cancel environment variable VAR for the program.\n\
-This does not affect the program until the next \"run\" command.",
- &deletelist);
-
- add_cmd ("environment", class_run, set_environment_command,
- "Set environment variable value to give the program.\n\
-Arguments are VAR VALUE where VAR is variable name and VALUE is value.\n\
-VALUES of environment variables are uninterpreted strings.\n\
-This does not affect the program until the next \"run\" command.",
- &setlist);
-
-#ifdef ATTACH_DETACH
- add_com ("attach", class_run, attach_command,
- "Attach to a process that was started up outside of GDB.\n\
-This command may take as argument a process id or a device file.\n\
-For a process id, you must have permission to send the process a signal,\n\
-and it must have the same effective uid as the debugger.\n\
-For a device file, the file must be a connection to a remote debug server.\n\n\
-Before using \"attach\", you must use the \"exec-file\" command\n\
-to specify the program running in the process,\n\
-and the \"symbol-file\" command to load its symbol table.");
-#else
- add_com ("attach", class_run, attach_command,
- "Attach to a process that was started up outside of GDB.\n\
-This commands takes as an argument the name of a device file.\n\
-This file must be a connection to a remote debug server.\n\n\
-Before using \"attach\", you must use the \"exec-file\" command\n\
-to specify the program running in the process,\n\
-and the \"symbol-file\" command to load its symbol table.");
-#endif
- add_com ("detach", class_run, detach_command,
- "Detach the process previously attached.\n\
-The process is no longer traced and continues its execution.");
-
- add_com ("signal", class_run, signal_command,
- "Continue program giving it signal number SIGNUMBER.");
-
- add_com ("stepi", class_run, stepi_command,
- "Step one instruction exactly.\n\
-Argument N means do this N times (or till program stops for another reason).");
- add_com_alias ("si", "stepi", class_alias, 0);
-
- add_com ("nexti", class_run, nexti_command,
- "Step one instruction, but proceed through subroutine calls.\n\
-Argument N means do this N times (or till program stops for another reason).");
- add_com_alias ("ni", "nexti", class_alias, 0);
-
- add_com ("finish", class_run, finish_command,
- "Execute until selected stack frame returns.\n\
-Upon return, the value returned is printed and put in the value history.");
-
- add_com ("next", class_run, next_command,
- "Step program, proceeding through subroutine calls.\n\
-Like the \"step\" command as long as subroutine calls do not happen;\n\
-when they do, the call is treated as one instruction.\n\
-Argument N means do this N times (or till program stops for another reason).");
- add_com_alias ("n", "next", class_run, 1);
-
- add_com ("step", class_run, step_command,
- "Step program until it reaches a different source line.\n\
-Argument N means do this N times (or till program stops for another reason).");
- add_com_alias ("s", "step", class_run, 1);
-
- add_com ("until", class_run, until_command,
- "Execute until the program reaches a source line greater than the current\n\
-or a specified line or address or function (same args as break command).\n\
-Execution will also stop upon exit from the current stack frame.");
- add_com_alias ("u", "until", class_run, 1);
-
- add_com ("jump", class_run, jump_command,
- "Continue program being debugged at specified line or address.\n\
-Give as argument either LINENUM or *ADDR, where ADDR is an expression\n\
-for an address to start at.");
-
- add_com ("cont", class_run, cont_command,
- "Continue program being debugged, after signal or breakpoint.\n\
-If proceeding from breakpoint, a number N may be used as an argument:\n\
-then the same breakpoint won't break until the Nth time it is reached.");
- add_com_alias ("c", "cont", class_run, 1);
-
- add_com ("run", class_run, run_command,
- "Start debugged program. You may specify arguments to give it.\n\
-Args may include \"*\", or \"[...]\"; they are expanded using \"sh\".\n\
-Input and output redirection with \">\", \"<\", or \">>\" are also allowed.\n\n\
-With no arguments, uses arguments last specified (with \"run\" or \"set args\".\n\
-To cancel previous arguments and run with no arguments,\n\
-use \"set args\" without arguments.");
- add_com_alias ("r", "run", class_run, 1);
-
- add_info ("registers", nofp_registers_info,
- "List of registers and their contents, for selected stack frame.\n\
-Register name as argument means describe only that register.\n\
-(Doesn't display floating point registers; use 'info all-registers'.)\n");
-
- add_info ("all-registers", all_registers_info,
- "List of registers and their contents, for selected stack frame.\n\
-Register name as argument means describe only that register.");
-
- add_info ("program", program_info,
- "Execution status of the program.");
-
- add_info ("float", float_info,
- "Print the status of the floating point unit\n");
-
- inferior_args = savestring (" ", 1); /* By default, no args. */
- inferior_environ = make_environ ();
- init_environ (inferior_environ);
-}
-
diff --git a/gnu/usr.bin/gdb/inferior.h b/gnu/usr.bin/gdb/inferior.h
deleted file mode 100644
index 04c662e..0000000
--- a/gnu/usr.bin/gdb/inferior.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- *
- * @(#)inferior.h 6.3 (Berkeley) 5/8/91
- */
-
-/* Variables that describe the inferior process running under GDB:
- Where it is, why it stopped, and how to step it.
- Copyright (C) 1986, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/*
- * Structure in which to save the status of the inferior. Save
- * through "save_inferior_status", restore through
- * "restore_inferior_status".
- * This pair of routines should be called around any transfer of
- * control to the inferior which you don't want showing up in your
- * control variables.
- */
-struct inferior_status {
- int pc_changed;
- int stop_signal;
- int stop_pc;
- int stop_frame_address;
- int stop_breakpoint;
- int stop_step;
- int stop_stack_dummy;
- int stopped_by_random_signal;
- int trap_expected;
- CORE_ADDR step_range_start;
- CORE_ADDR step_range_end;
- FRAME_ADDR step_frame_address;
- int step_over_calls;
- CORE_ADDR step_resume_break_address;
- int stop_after_trap;
- int stop_after_attach;
- FRAME_ADDR selected_frame_address;
- int selected_level;
- struct command_line *breakpoint_commands;
- char register_context[REGISTER_BYTES];
- int restore_stack_info;
-};
-
-void save_inferior_status (), restore_inferior_status ();
-
-/* File name for default use for standard in/out in the inferior. */
-
-extern char *inferior_io_terminal;
-
-/* Pid of our debugged inferior, or 0 if no inferior now. */
-
-extern int inferior_pid;
-
-/* Nonzero if debugging a remote machine via a serial link or ethernet. */
-extern int remote_debugging;
-
-/* Routines for use in remote debugging. Documented in remote.c. */
-int remote_read_inferior_memory ();
-int remote_write_inferior_memory ();
-
-/* Last signal that the inferior received (why it stopped). */
-
-extern int stop_signal;
-
-/* Address at which inferior stopped. */
-
-extern CORE_ADDR stop_pc;
-
-/* Stack frame when program stopped. */
-
-extern FRAME_ADDR stop_frame_address;
-
-/* Number of breakpoint it stopped at, or 0 if none. */
-
-extern int stop_breakpoint;
-
-/* Nonzero if stopped due to a step command. */
-
-extern int stop_step;
-
-/* Nonzero if stopped due to completion of a stack dummy routine. */
-
-extern int stop_stack_dummy;
-
-/* Nonzero if program stopped due to a random (unexpected) signal in
- inferior process. */
-
-extern int stopped_by_random_signal;
-
-/* Range to single step within.
- If this is nonzero, respond to a single-step signal
- by continuing to step if the pc is in this range. */
-
-extern CORE_ADDR step_range_start; /* Inclusive */
-extern CORE_ADDR step_range_end; /* Exclusive */
-
-/* Stack frame address as of when stepping command was issued.
- This is how we know when we step into a subroutine call,
- and how to set the frame for the breakpoint used to step out. */
-
-extern FRAME_ADDR step_frame_address;
-
-/* 1 means step over all subroutine calls.
- -1 means step over calls to undebuggable functions. */
-
-extern int step_over_calls;
-
-/* If stepping, nonzero means step count is > 1
- so don't print frame next time inferior stops
- if it stops due to stepping. */
-
-extern int step_multi;
-
-/* Save register contents here when about to pop a stack dummy frame. */
-
-extern char stop_registers[REGISTER_BYTES];
-
-/* Nonzero if pc has been changed by the debugger
- since the inferior stopped. */
-
-extern int pc_changed;
-
-long read_memory_integer ();
diff --git a/gnu/usr.bin/gdb/inflow.c b/gnu/usr.bin/gdb/inflow.c
deleted file mode 100644
index 209fcf3..0000000
--- a/gnu/usr.bin/gdb/inflow.c
+++ /dev/null
@@ -1,569 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)inflow.c 6.5 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* Low level interface to ptrace, for GDB when running under Unix.
- Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include "defs.h"
-#include "param.h"
-#include "frame.h"
-#include "inferior.h"
-
-#ifdef USG
-#include <sys/types.h>
-#endif
-
-/* Some USG-esque systems (some of which are BSD-esque enough so that USG
- is not defined) want this header, and it won't do any harm. */
-#include <fcntl.h>
-
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <signal.h>
-
-#ifdef HAVE_TERMIO
-#include <termio.h>
-#undef TIOCGETP
-#define TIOCGETP TCGETA
-#undef TIOCSETN
-#define TIOCSETN TCSETA
-#undef TIOCSETP
-#define TIOCSETP TCSETAF
-#define TERMINAL struct termio
-#else
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <sgtty.h>
-#define TERMINAL struct sgttyb
-#endif
-
-#ifdef SET_STACK_LIMIT_HUGE
-#include <sys/time.h>
-#include <sys/resource.h>
-extern int original_stack_limit;
-#endif /* SET_STACK_LIMIT_HUGE */
-
-extern int errno;
-
-/* Nonzero if we are debugging an attached outside process
- rather than an inferior. */
-
-int attach_flag;
-
-
-/* Record terminal status separately for debugger and inferior. */
-
-static TERMINAL sg_inferior;
-static TERMINAL sg_ours;
-
-static int tflags_inferior;
-static int tflags_ours;
-
-#if defined(TIOCGETC) && !defined(TIOCGETC_BROKEN)
-static struct tchars tc_inferior;
-static struct tchars tc_ours;
-#endif
-
-#ifdef TIOCGLTC
-static struct ltchars ltc_inferior;
-static struct ltchars ltc_ours;
-#endif
-
-#ifdef TIOCLGET
-static int lmode_inferior;
-static int lmode_ours;
-#endif
-
-#ifdef TIOCGPGRP
-static int pgrp_inferior;
-static int pgrp_ours;
-#else
-static int (*sigint_ours) ();
-static int (*sigquit_ours) ();
-#endif /* TIOCGPGRP */
-
-/* Copy of inferior_io_terminal when inferior was last started. */
-static char *inferior_thisrun_terminal;
-
-static void terminal_ours_1 ();
-
-/* Nonzero if our terminal settings are in effect.
- Zero if the inferior's settings are in effect. */
-static int terminal_is_ours;
-
-/* Initialize the terminal settings we record for the inferior,
- before we actually run the inferior. */
-
-void
-terminal_init_inferior ()
-{
- if (remote_debugging)
- return;
-
- sg_inferior = sg_ours;
- tflags_inferior = tflags_ours;
-
-#if defined(TIOCGETC) && !defined(TIOCGETC_BROKEN)
- tc_inferior = tc_ours;
-#endif
-
-#ifdef TIOCGLTC
- ltc_inferior = ltc_ours;
-#endif
-
-#ifdef TIOCLGET
- lmode_inferior = lmode_ours;
-#endif
-
-#ifdef TIOCGPGRP
- pgrp_inferior = inferior_pid;
-#endif /* TIOCGPGRP */
-
- terminal_is_ours = 1;
-}
-
-/* Put the inferior's terminal settings into effect.
- This is preparation for starting or resuming the inferior. */
-
-void
-terminal_inferior ()
-{
- if (remote_debugging)
- return;
-
- if (terminal_is_ours) /* && inferior_thisrun_terminal == 0) */
- {
- fcntl (0, F_SETFL, tflags_inferior);
- fcntl (0, F_SETFL, tflags_inferior);
- ioctl (0, TIOCSETN, &sg_inferior);
-
-#if defined(TIOCGETC) && !defined(TIOCGETC_BROKEN)
- ioctl (0, TIOCSETC, &tc_inferior);
-#endif
-#ifdef TIOCGLTC
- ioctl (0, TIOCSLTC, &ltc_inferior);
-#endif
-#ifdef TIOCLGET
- ioctl (0, TIOCLSET, &lmode_inferior);
-#endif
-
-#ifdef TIOCGPGRP
- ioctl (0, TIOCSPGRP, &pgrp_inferior);
-#else
- sigint_ours = (int (*) ()) signal (SIGINT, SIG_IGN);
- sigquit_ours = (int (*) ()) signal (SIGQUIT, SIG_IGN);
-#endif /* TIOCGPGRP */
- }
- terminal_is_ours = 0;
-}
-
-/* Put some of our terminal settings into effect,
- enough to get proper results from our output,
- but do not change into or out of RAW mode
- so that no input is discarded.
-
- After doing this, either terminal_ours or terminal_inferior
- should be called to get back to a normal state of affairs. */
-
-void
-terminal_ours_for_output ()
-{
- if (remote_debugging)
- return;
-
- terminal_ours_1 (1);
-}
-
-/* Put our terminal settings into effect.
- First record the inferior's terminal settings
- so they can be restored properly later. */
-
-void
-terminal_ours ()
-{
- if (remote_debugging)
- return;
-
- terminal_ours_1 (0);
-}
-
-static void
-terminal_ours_1 (output_only)
- int output_only;
-{
-#ifdef TIOCGPGRP
- /* Ignore this signal since it will happen when we try to set the pgrp. */
- void (*osigttou) ();
-#endif /* TIOCGPGRP */
-
- if (!terminal_is_ours) /* && inferior_thisrun_terminal == 0) */
- {
- terminal_is_ours = 1;
-
-#ifdef TIOCGPGRP
- osigttou = signal (SIGTTOU, SIG_IGN);
-
- ioctl (0, TIOCGPGRP, &pgrp_inferior);
- ioctl (0, TIOCSPGRP, &pgrp_ours);
-
- signal (SIGTTOU, osigttou);
-#else
- signal (SIGINT, sigint_ours);
- signal (SIGQUIT, sigquit_ours);
-#endif /* TIOCGPGRP */
-
- tflags_inferior = fcntl (0, F_GETFL, 0);
- ioctl (0, TIOCGETP, &sg_inferior);
-
-#if defined(TIOCGETC) && !defined(TIOCGETC_BROKEN)
- ioctl (0, TIOCGETC, &tc_inferior);
-#endif
-#ifdef TIOCGLTC
- ioctl (0, TIOCGLTC, &ltc_inferior);
-#endif
-#ifdef TIOCLGET
- ioctl (0, TIOCLGET, &lmode_inferior);
-#endif
- }
-
-#ifdef HAVE_TERMIO
- sg_ours.c_lflag |= ICANON;
- if (output_only && !(sg_inferior.c_lflag & ICANON))
- sg_ours.c_lflag &= ~ICANON;
-#else /* not HAVE_TERMIO */
- sg_ours.sg_flags &= ~RAW & ~CBREAK;
- if (output_only)
- sg_ours.sg_flags |= (RAW | CBREAK) & sg_inferior.sg_flags;
-#endif /* not HAVE_TERMIO */
-
- fcntl (0, F_SETFL, tflags_ours);
- fcntl (0, F_SETFL, tflags_ours);
- ioctl (0, TIOCSETN, &sg_ours);
-
-#if defined(TIOCGETC) && !defined(TIOCGETC_BROKEN)
- ioctl (0, TIOCSETC, &tc_ours);
-#endif
-#ifdef TIOCGLTC
- ioctl (0, TIOCSLTC, &ltc_ours);
-#endif
-#ifdef TIOCLGET
- ioctl (0, TIOCLSET, &lmode_ours);
-#endif
-
-#ifdef HAVE_TERMIO
- sg_ours.c_lflag |= ICANON;
-#else /* not HAVE_TERMIO */
- sg_ours.sg_flags &= ~RAW & ~CBREAK;
-#endif /* not HAVE_TERMIO */
-}
-
-static void
-term_status_command ()
-{
- register int i;
-
- if (remote_debugging)
- {
- printf_filtered ("No terminal status when remote debugging.\n");
- return;
- }
-
- printf_filtered ("Inferior's terminal status (currently saved by GDB):\n");
-
-#ifdef HAVE_TERMIO
-
- printf_filtered ("fcntl flags = 0x%x, c_iflag = 0x%x, c_oflag = 0x%x,\n",
- tflags_inferior, sg_inferior.c_iflag, sg_inferior.c_oflag);
- printf_filtered ("c_cflag = 0x%x, c_lflag = 0x%x, c_line = 0x%x.\n",
- sg_inferior.c_cflag, sg_inferior.c_lflag, sg_inferior.c_line);
- printf_filtered ("c_cc: ");
- for (i = 0; (i < NCC); i += 1)
- printf_filtered ("0x%x ", sg_inferior.c_cc[i]);
- printf_filtered ("\n");
-
-#else /* not HAVE_TERMIO */
-
- printf_filtered ("fcntl flags = 0x%x, sgttyb.sg_flags = 0x%x, owner pid = %d.\n",
- tflags_inferior, sg_inferior.sg_flags, pgrp_inferior);
-
-#endif /* not HAVE_TERMIO */
-
-#if defined(TIOCGETC) && !defined(TIOCGETC_BROKEN)
- printf_filtered ("tchars: ");
- for (i = 0; i < sizeof (struct tchars); i++)
- printf_filtered ("0x%x ", ((char *)&tc_inferior)[i]);
- printf_filtered ("\n");
-#endif
-
-#ifdef TIOCGLTC
- printf_filtered ("ltchars: ");
- for (i = 0; i < sizeof (struct ltchars); i++)
- printf_filtered ("0x%x ", ((char *)&ltc_inferior)[i]);
- printf_filtered ("\n");
- ioctl (0, TIOCSLTC, &ltc_ours);
-#endif
-
-#ifdef TIOCLGET
- printf_filtered ("lmode: %x\n", lmode_inferior);
-#endif
-}
-
-static void
-new_tty (ttyname)
- char *ttyname;
-{
- register int tty;
- register int fd;
-
-#ifdef TIOCNOTTY
- /* Disconnect the child process from our controlling terminal. */
- tty = open("/dev/tty", O_RDWR);
- if (tty > 0)
- {
- ioctl(tty, TIOCNOTTY, 0);
- close(tty);
- }
-#endif
-
- /* Now open the specified new terminal. */
-
- tty = open(ttyname, O_RDWR);
- if (tty == -1)
- _exit(1);
-
- /* Avoid use of dup2; doesn't exist on all systems. */
- if (tty != 0)
- { close (0); dup (tty); }
- if (tty != 1)
- { close (1); dup (tty); }
- if (tty != 2)
- { close (2); dup (tty); }
- if (tty > 2)
- close(tty);
-}
-
-/* Start an inferior process and returns its pid.
- ALLARGS is a string containing shell command to run the program.
- ENV is the environment vector to pass. */
-
-#ifndef SHELL_FILE
-#define SHELL_FILE "/bin/sh"
-#endif
-
-int
-create_inferior (allargs, env)
- char *allargs;
- char **env;
-{
- int pid;
- char *shell_command;
- extern int sys_nerr;
- extern char *sys_errlist[];
- extern int errno;
-
- /* If desired, concat something onto the front of ALLARGS.
- SHELL_COMMAND is the result. */
-#ifdef SHELL_COMMAND_CONCAT
- shell_command = (char *) alloca (strlen (SHELL_COMMAND_CONCAT) + strlen (allargs) + 1);
- strcpy (shell_command, SHELL_COMMAND_CONCAT);
- strcat (shell_command, allargs);
-#else
- shell_command = allargs;
-#endif
-
- /* exec is said to fail if the executable is open. */
- close_exec_file ();
-
-#if defined(USG) && !defined(HAVE_VFORK)
- pid = fork ();
-#else
- pid = vfork ();
-#endif
-
- if (pid < 0)
- perror_with_name ("vfork");
-
- if (pid == 0)
- {
-#ifdef TIOCGPGRP
- /* Run inferior in a separate process group. */
- setpgrp (getpid (), getpid ());
-#endif /* TIOCGPGRP */
-
-#ifdef SET_STACK_LIMIT_HUGE
- /* Reset the stack limit back to what it was. */
- {
- struct rlimit rlim;
-
- getrlimit (RLIMIT_STACK, &rlim);
- rlim.rlim_cur = original_stack_limit;
- setrlimit (RLIMIT_STACK, &rlim);
- }
-#endif /* SET_STACK_LIMIT_HUGE */
-
-
- inferior_thisrun_terminal = inferior_io_terminal;
- if (inferior_io_terminal != 0)
- new_tty (inferior_io_terminal);
-
-/* It seems that changing the signal handlers for the inferior after
- a vfork also changes them for the superior. See comments in
- initialize_signals for how we get the right signal handlers
- for the inferior. */
-/* Not needed on Sun, at least, and loses there
- because it clobbers the superior. */
-/*??? signal (SIGQUIT, SIG_DFL);
- signal (SIGINT, SIG_DFL); */
-
- call_ptrace (0);
- execle (SHELL_FILE, "sh", "-c", shell_command, 0, env);
-
- fprintf (stderr, "Cannot exec %s: %s.\n", SHELL_FILE,
- errno < sys_nerr ? sys_errlist[errno] : "unknown error");
- fflush (stderr);
- _exit (0177);
- }
-
-#ifdef TIOCGPGRP
- /* Avoid race with TIOCSPGRP: guarantee that inferior's pgrp exists. */
- setpgrp (pid, pid);
-#endif /* TIOCGPGRP */
-
-#ifdef CREATE_INFERIOR_HOOK
- CREATE_INFERIOR_HOOK (pid);
-#endif
- return pid;
-}
-
-/* Kill the inferior process. Make us have no inferior. */
-
-static void
-kill_command ()
-{
- if (remote_debugging)
- {
- inferior_pid = 0;
- return;
- }
- if (inferior_pid == 0)
- error ("The program is not being run.");
- if (!query ("Kill the inferior process? "))
- error ("Not confirmed.");
- kill_inferior ();
-}
-
-void
-inferior_died ()
-{
- inferior_pid = 0;
- attach_flag = 0;
- mark_breakpoints_out ();
- select_frame ((FRAME) 0, -1);
- reopen_exec_file ();
- if (have_core_file_p ())
- set_current_frame ( create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
- else
- set_current_frame (0);
-}
-
-#if 0
-/* This function is just for testing, and on some systems (Sony NewsOS
- 3.2) <sys/user.h> also includes <sys/time.h> which leads to errors
- (since on this system at least sys/time.h is not protected against
- multiple inclusion). */
-static void
-try_writing_regs_command ()
-{
- register int i;
- register int value;
- extern int errno;
-
- if (inferior_pid == 0)
- error ("There is no inferior process now.");
-
- /* A Sun 3/50 or 3/60 (at least) running SunOS 4.0.3 will have a
- kernel panic if we try to write past the end of the user area.
- Presumably Sun will fix this bug (it has been reported), but it
- is tacky to crash the system, so at least on SunOS4 we need to
- stop writing when we hit the end of the user area. */
- for (i = 0; i < sizeof (struct user); i += 2)
- {
- QUIT;
- errno = 0;
- value = call_ptrace (3, inferior_pid, i, 0);
- call_ptrace (6, inferior_pid, i, value);
- if (errno == 0)
- {
- printf (" Succeeded with address 0x%x; value 0x%x (%d).\n",
- i, value, value);
- }
- else if ((i & 0377) == 0)
- printf (" Failed at 0x%x.\n", i);
- }
-}
-#endif
-
-void
-_initialize_inflow ()
-{
- add_com ("term-status", class_obscure, term_status_command,
- "Print info on inferior's saved terminal status.");
-
-#if 0
- add_com ("try-writing-regs", class_obscure, try_writing_regs_command,
- "Try writing all locations in inferior's system block.\n\
-Report which ones can be written.");
-#endif
-
- add_com ("kill", class_run, kill_command,
- "Kill execution of program being debugged.");
-
- inferior_pid = 0;
-
- ioctl (0, TIOCGETP, &sg_ours);
- tflags_ours = fcntl (0, F_GETFL, 0);
-
-#if defined(TIOCGETC) && !defined(TIOCGETC_BROKEN)
- ioctl (0, TIOCGETC, &tc_ours);
-#endif
-#ifdef TIOCGLTC
- ioctl (0, TIOCGLTC, &ltc_ours);
-#endif
-#ifdef TIOCLGET
- ioctl (0, TIOCLGET, &lmode_ours);
-#endif
-
-#ifdef TIOCGPGRP
- ioctl (0, TIOCGPGRP, &pgrp_ours);
-#endif /* TIOCGPGRP */
-
- terminal_is_ours = 1;
-}
-
diff --git a/gnu/usr.bin/gdb/infrun.c b/gnu/usr.bin/gdb/infrun.c
deleted file mode 100644
index 887a0bb..0000000
--- a/gnu/usr.bin/gdb/infrun.c
+++ /dev/null
@@ -1,1459 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)infrun.c 6.4 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* Start and stop the inferior process, for GDB.
- Copyright (C) 1986, 1987, 1988, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Notes on the algorithm used in wait_for_inferior to determine if we
- just did a subroutine call when stepping. We have the following
- information at that point:
-
- Current and previous (just before this step) pc.
- Current and previous sp.
- Current and previous start of current function.
-
- If the start's of the functions don't match, then
-
- a) We did a subroutine call.
-
- In this case, the pc will be at the beginning of a function.
-
- b) We did a subroutine return.
-
- Otherwise.
-
- c) We did a longjmp.
-
- If we did a longjump, we were doing "nexti", since a next would
- have attempted to skip over the assembly language routine in which
- the longjmp is coded and would have simply been the equivalent of a
- continue. I consider this ok behaivior. We'd like one of two
- things to happen if we are doing a nexti through the longjmp()
- routine: 1) It behaves as a stepi, or 2) It acts like a continue as
- above. Given that this is a special case, and that anybody who
- thinks that the concept of sub calls is meaningful in the context
- of a longjmp, I'll take either one. Let's see what happens.
-
- Acts like a subroutine return. I can handle that with no problem
- at all.
-
- -->So: If the current and previous beginnings of the current
- function don't match, *and* the pc is at the start of a function,
- we've done a subroutine call. If the pc is not at the start of a
- function, we *didn't* do a subroutine call.
-
- -->If the beginnings of the current and previous function do match,
- either:
-
- a) We just did a recursive call.
-
- In this case, we would be at the very beginning of a
- function and 1) it will have a prologue (don't jump to
- before prologue, or 2) (we assume here that it doesn't have
- a prologue) there will have been a change in the stack
- pointer over the last instruction. (Ie. it's got to put
- the saved pc somewhere. The stack is the usual place. In
- a recursive call a register is only an option if there's a
- prologue to do something with it. This is even true on
- register window machines; the prologue sets up the new
- window. It might not be true on a register window machine
- where the call instruction moved the register window
- itself. Hmmm. One would hope that the stack pointer would
- also change. If it doesn't, somebody send me a note, and
- I'll work out a more general theory.
- randy@wheaties.ai.mit.edu). This is true (albeit slipperly
- so) on all machines I'm aware of:
-
- m68k: Call changes stack pointer. Regular jumps don't.
-
- sparc: Recursive calls must have frames and therefor,
- prologues.
-
- vax: All calls have frames and hence change the
- stack pointer.
-
- b) We did a return from a recursive call. I don't see that we
- have either the ability or the need to distinguish this
- from an ordinary jump. The stack frame will be printed
- when and if the frame pointer changes; if we are in a
- function without a frame pointer, it's the users own
- lookout.
-
- c) We did a jump within a function. We assume that this is
- true if we didn't do a recursive call.
-
- d) We are in no-man's land ("I see no symbols here"). We
- don't worry about this; it will make calls look like simple
- jumps (and the stack frames will be printed when the frame
- pointer moves), which is a reasonably non-violent response.
-
-#if 0
- We skip this; it causes more problems than it's worth.
-#ifdef SUN4_COMPILER_FEATURE
- We do a special ifdef for the sun 4, forcing it to single step
- into calls which don't have prologues. This means that we can't
- nexti over leaf nodes, we can probably next over them (since they
- won't have debugging symbols, usually), and we can next out of
- functions returning structures (with a "call .stret4" at the end).
-#endif
-#endif
-*/
-
-
-
-
-
-#include <stdio.h>
-#include "defs.h"
-#include "param.h"
-#include "symtab.h"
-#include "frame.h"
-#include "inferior.h"
-#include "wait.h"
-
-#include <signal.h>
-
-/* unistd.h is needed to #define X_OK */
-#ifdef USG
-#include <unistd.h>
-#else
-#include <sys/file.h>
-#endif
-
-#ifdef UMAX_PTRACE
-#include <aouthdr.h>
-#include <sys/param.h>
-#include <sys/ptrace.h>
-#endif /* UMAX_PTRACE */
-
-/* Required by <sys/user.h>. */
-#include <sys/types.h>
-/* Required by <sys/user.h>, at least on system V. */
-#include <sys/dir.h>
-/* Needed by IN_SIGTRAMP on some machines (e.g. vax). */
-#include <sys/param.h>
-/* Needed by IN_SIGTRAMP on some machines (e.g. vax). */
-#include <sys/user.h>
-
-extern char *sys_siglist[];
-extern int errno;
-
-/* Sigtramp is a routine that the kernel calls (which then calls the
- signal handler). On most machines it is a library routine that
- is linked into the executable.
-
- This macro, given a program counter value and the name of the
- function in which that PC resides (which can be null if the
- name is not known), returns nonzero if the PC and name show
- that we are in sigtramp.
-
- On most machines just see if the name is sigtramp (and if we have
- no name, assume we are not in sigtramp). */
-#if !defined (IN_SIGTRAMP)
-#define IN_SIGTRAMP(pc, name) \
- name && !strcmp ("_sigtramp", name)
-#endif
-
-/* Tables of how to react to signals; the user sets them. */
-
-static char signal_stop[NSIG];
-static char signal_print[NSIG];
-static char signal_program[NSIG];
-
-/* Nonzero if breakpoints are now inserted in the inferior. */
-
-static int breakpoints_inserted;
-
-/* Function inferior was in as of last step command. */
-
-static struct symbol *step_start_function;
-
-/* This is the sequence of bytes we insert for a breakpoint. */
-
-static char break_insn[] = BREAKPOINT;
-
-/* Nonzero => address for special breakpoint for resuming stepping. */
-
-static CORE_ADDR step_resume_break_address;
-
-/* Original contents of the byte where the special breakpoint is. */
-
-static char step_resume_break_shadow[sizeof break_insn];
-
-/* Nonzero means the special breakpoint is a duplicate
- so it has not itself been inserted. */
-
-static int step_resume_break_duplicate;
-
-/* Nonzero if we are expecting a trace trap and should proceed from it.
- 2 means expecting 2 trace traps and should continue both times.
- That occurs when we tell sh to exec the program: we will get
- a trap after the exec of sh and a second when the program is exec'd. */
-
-static int trap_expected;
-
-/* Nonzero if the next time we try to continue the inferior, it will
- step one instruction and generate a spurious trace trap.
- This is used to compensate for a bug in HP-UX. */
-
-static int trap_expected_after_continue;
-
-/* Nonzero means expecting a trace trap
- and should stop the inferior and return silently when it happens. */
-
-int stop_after_trap;
-
-/* Nonzero means expecting a trace trap due to attaching to a process. */
-
-int stop_after_attach;
-
-/* Nonzero if pc has been changed by the debugger
- since the inferior stopped. */
-
-int pc_changed;
-
-/* Nonzero if debugging a remote machine via a serial link or ethernet. */
-
-int remote_debugging;
-
-/* Nonzero if program stopped due to error trying to insert breakpoints. */
-
-static int breakpoints_failed;
-
-/* Nonzero if inferior is in sh before our program got exec'd. */
-
-static int running_in_shell;
-
-/* Nonzero after stop if current stack frame should be printed. */
-
-static int stop_print_frame;
-
-#ifdef NO_SINGLE_STEP
-extern int one_stepped; /* From machine dependent code */
-extern void single_step (); /* Same. */
-#endif /* NO_SINGLE_STEP */
-
-static void insert_step_breakpoint ();
-static void remove_step_breakpoint ();
-static void wait_for_inferior ();
-static void normal_stop ();
-
-
-/* Clear out all variables saying what to do when inferior is continued.
- First do this, then set the ones you want, then call `proceed'. */
-
-void
-clear_proceed_status ()
-{
- trap_expected = 0;
- step_range_start = 0;
- step_range_end = 0;
- step_frame_address = 0;
- step_over_calls = -1;
- step_resume_break_address = 0;
- stop_after_trap = 0;
- stop_after_attach = 0;
-
- /* Discard any remaining commands left by breakpoint we had stopped at. */
- clear_breakpoint_commands ();
-}
-
-/* Basic routine for continuing the program in various fashions.
-
- ADDR is the address to resume at, or -1 for resume where stopped.
- SIGNAL is the signal to give it, or 0 for none,
- or -1 for act according to how it stopped.
- STEP is nonzero if should trap after one instruction.
- -1 means return after that and print nothing.
- You should probably set various step_... variables
- before calling here, if you are stepping.
-
- You should call clear_proceed_status before calling proceed. */
-
-void
-proceed (addr, signal, step)
- CORE_ADDR addr;
- int signal;
- int step;
-{
- int oneproc = 0;
-
- if (step > 0)
- step_start_function = find_pc_function (read_pc ());
- if (step < 0)
- stop_after_trap = 1;
-
- if (addr == -1)
- {
- /* If there is a breakpoint at the address we will resume at,
- step one instruction before inserting breakpoints
- so that we do not stop right away. */
-
- if (!pc_changed && breakpoint_here_p (read_pc ()))
- oneproc = 1;
- }
- else
- {
- write_register (PC_REGNUM, addr);
-#ifdef NPC_REGNUM
- write_register (NPC_REGNUM, addr + 4);
-#endif
- }
-
- if (trap_expected_after_continue)
- {
- /* If (step == 0), a trap will be automatically generated after
- the first instruction is executed. Force step one
- instruction to clear this condition. This should not occur
- if step is nonzero, but it is harmless in that case. */
- oneproc = 1;
- trap_expected_after_continue = 0;
- }
-
- if (oneproc)
- /* We will get a trace trap after one instruction.
- Continue it automatically and insert breakpoints then. */
- trap_expected = 1;
- else
- {
- int temp = insert_breakpoints ();
- if (temp)
- {
- print_sys_errmsg ("ptrace", temp);
- error ("Cannot insert breakpoints.\n\
-The same program may be running in another process.");
- }
- breakpoints_inserted = 1;
- }
-
- /* Install inferior's terminal modes. */
- terminal_inferior ();
-
- if (signal >= 0)
- stop_signal = signal;
- /* If this signal should not be seen by program,
- give it zero. Used for debugging signals. */
- else if (stop_signal < NSIG && !signal_program[stop_signal])
- stop_signal= 0;
-
- /* Resume inferior. */
- resume (oneproc || step, stop_signal);
-
- /* Wait for it to stop (if not standalone)
- and in any case decode why it stopped, and act accordingly. */
-
- wait_for_inferior ();
- normal_stop ();
-}
-
-/* Writing the inferior pc as a register calls this function
- to inform infrun that the pc has been set in the debugger. */
-
-void
-writing_pc (val)
- CORE_ADDR val;
-{
- stop_pc = val;
- pc_changed = 1;
-}
-
-/* Start an inferior process for the first time.
- Actually it was started by the fork that created it,
- but it will have stopped one instruction after execing sh.
- Here we must get it up to actual execution of the real program. */
-
-void
-start_inferior ()
-{
- /* We will get a trace trap after one instruction.
- Continue it automatically. Eventually (after shell does an exec)
- it will get another trace trap. Then insert breakpoints and continue. */
-
-#ifdef START_INFERIOR_TRAPS_EXPECTED
- trap_expected = START_INFERIOR_TRAPS_EXPECTED;
-#else
- trap_expected = 2;
-#endif
-
- running_in_shell = 0; /* Set to 1 at first SIGTRAP, 0 at second. */
- trap_expected_after_continue = 0;
- breakpoints_inserted = 0;
- mark_breakpoints_out ();
-
- /* Set up the "saved terminal modes" of the inferior
- based on what modes we are starting it with. */
- terminal_init_inferior ();
-
- /* Install inferior's terminal modes. */
- terminal_inferior ();
-
- if (remote_debugging)
- {
- trap_expected = 0;
- fetch_inferior_registers();
- set_current_frame (create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
- stop_frame_address = FRAME_FP (get_current_frame());
- inferior_pid = 3;
- if (insert_breakpoints())
- fatal("Can't insert breakpoints");
- breakpoints_inserted = 1;
- proceed(-1, -1, 0);
- }
- else
- {
- wait_for_inferior ();
- normal_stop ();
- }
-}
-
-/* Start or restart remote-debugging of a machine over a serial link. */
-
-void
-restart_remote ()
-{
- clear_proceed_status ();
- running_in_shell = 0;
- trap_expected = 0;
- stop_after_attach = 1;
- inferior_pid = 3;
- wait_for_inferior ();
- normal_stop();
-}
-
-void
-start_remote ()
-{
- breakpoints_inserted = 0;
- mark_breakpoints_out ();
- restart_remote();
-}
-
-#ifdef ATTACH_DETACH
-
-/* Attach to process PID, then initialize for debugging it
- and wait for the trace-trap that results from attaching. */
-
-void
-attach_program (pid)
- int pid;
-{
- attach (pid);
- inferior_pid = pid;
-
- mark_breakpoints_out ();
- terminal_init_inferior ();
- clear_proceed_status ();
- stop_after_attach = 1;
- /*proceed (-1, 0, -2);*/
- terminal_inferior ();
- wait_for_inferior ();
- normal_stop ();
-}
-#endif /* ATTACH_DETACH */
-
-/* Wait for control to return from inferior to debugger.
- If inferior gets a signal, we may decide to start it up again
- instead of returning. That is why there is a loop in this function.
- When this function actually returns it means the inferior
- should be left stopped and GDB should read more commands. */
-
-static void
-wait_for_inferior ()
-{
- register int pid;
- WAITTYPE w;
- CORE_ADDR pc;
- int tem;
- int another_trap;
- int random_signal;
- CORE_ADDR stop_sp, prev_sp;
- CORE_ADDR prev_func_start, stop_func_start;
- char *prev_func_name, *stop_func_name;
- CORE_ADDR prologue_pc;
- int stop_step_resume_break;
- CORE_ADDR step_resume_break_sp;
- int newmisc;
- int newfun_pc;
- struct symtab_and_line sal;
- int prev_pc;
- extern CORE_ADDR text_end;
- int remove_breakpoints_on_following_step = 0;
-
- prev_pc = read_pc ();
- (void) find_pc_partial_function (prev_pc, &prev_func_name,
- &prev_func_start);
- prev_func_start += FUNCTION_START_OFFSET;
- prev_sp = read_register (SP_REGNUM);
-
- while (1)
- {
- /* Clean up saved state that will become invalid. */
- pc_changed = 0;
- flush_cached_frames ();
-
- if (remote_debugging)
- remote_wait (&w);
- else
- {
- pid = wait (&w);
- if (pid != inferior_pid)
- continue;
- }
-
- /* See if the process still exists; clean up if it doesn't. */
- if (WIFEXITED (w))
- {
- terminal_ours_for_output ();
- if (WEXITSTATUS (w))
- printf ("\nProgram exited with code 0%o.\n", WEXITSTATUS (w));
- else
- printf ("\nProgram exited normally.\n");
- fflush (stdout);
- inferior_died ();
-#ifdef NO_SINGLE_STEP
- one_stepped = 0;
-#endif
- stop_print_frame = 0;
- break;
- }
- else if (!WIFSTOPPED (w))
- {
- kill_inferior ();
- stop_print_frame = 0;
- stop_signal = WTERMSIG (w);
- terminal_ours_for_output ();
- printf ("\nProgram terminated with signal %d, %s\n",
- stop_signal,
- stop_signal < NSIG
- ? sys_siglist[stop_signal]
- : "(undocumented)");
- printf ("The inferior process no longer exists.\n");
- fflush (stdout);
-#ifdef NO_SINGLE_STEP
- one_stepped = 0;
-#endif
- break;
- }
-
-#ifdef NO_SINGLE_STEP
- if (one_stepped)
- single_step (0); /* This actually cleans up the ss */
-#endif /* NO_SINGLE_STEP */
-
- fetch_inferior_registers ();
- stop_pc = read_pc ();
- set_current_frame ( create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
-
- stop_frame_address = FRAME_FP (get_current_frame ());
- stop_sp = read_register (SP_REGNUM);
- stop_func_start = 0;
- stop_func_name = 0;
- /* Don't care about return value; stop_func_start and stop_func_name
- will both be 0 if it doesn't work. */
- (void) find_pc_partial_function (stop_pc, &stop_func_name,
- &stop_func_start);
- stop_func_start += FUNCTION_START_OFFSET;
- another_trap = 0;
- stop_breakpoint = 0;
- stop_step = 0;
- stop_stack_dummy = 0;
- stop_print_frame = 1;
- stop_step_resume_break = 0;
- random_signal = 0;
- stopped_by_random_signal = 0;
- breakpoints_failed = 0;
-
- /* Look at the cause of the stop, and decide what to do.
- The alternatives are:
- 1) break; to really stop and return to the debugger,
- 2) drop through to start up again
- (set another_trap to 1 to single step once)
- 3) set random_signal to 1, and the decision between 1 and 2
- will be made according to the signal handling tables. */
-
- stop_signal = WSTOPSIG (w);
-
- /* First, distinguish signals caused by the debugger from signals
- that have to do with the program's own actions.
- Note that breakpoint insns may cause SIGTRAP or SIGILL
- or SIGEMT, depending on the operating system version.
- Here we detect when a SIGILL or SIGEMT is really a breakpoint
- and change it to SIGTRAP. */
-
- if (stop_signal == SIGTRAP
- || (breakpoints_inserted &&
- (stop_signal == SIGILL
- || stop_signal == SIGEMT))
- || stop_after_attach)
- {
- if (stop_signal == SIGTRAP && stop_after_trap)
- {
- stop_print_frame = 0;
- break;
- }
- if (stop_after_attach)
- break;
- /* Don't even think about breakpoints
- if still running the shell that will exec the program
- or if just proceeded over a breakpoint. */
- if (stop_signal == SIGTRAP && trap_expected)
- stop_breakpoint = 0;
- else
- {
- /* See if there is a breakpoint at the current PC. */
-#if DECR_PC_AFTER_BREAK
- /* Notice the case of stepping through a jump
- that leads just after a breakpoint.
- Don't confuse that with hitting the breakpoint.
- What we check for is that 1) stepping is going on
- and 2) the pc before the last insn does not match
- the address of the breakpoint before the current pc. */
- if (!(prev_pc != stop_pc - DECR_PC_AFTER_BREAK
- && step_range_end && !step_resume_break_address))
-#endif /* DECR_PC_AFTER_BREAK not zero */
- {
- /* See if we stopped at the special breakpoint for
- stepping over a subroutine call. */
- if (stop_pc - DECR_PC_AFTER_BREAK
- == step_resume_break_address)
- {
- stop_step_resume_break = 1;
- if (DECR_PC_AFTER_BREAK)
- {
- stop_pc -= DECR_PC_AFTER_BREAK;
- write_register (PC_REGNUM, stop_pc);
- pc_changed = 0;
- }
- }
- else
- {
- stop_breakpoint =
- breakpoint_stop_status (stop_pc, stop_frame_address);
- /* Following in case break condition called a
- function. */
- stop_print_frame = 1;
- if (stop_breakpoint && DECR_PC_AFTER_BREAK)
- {
- stop_pc -= DECR_PC_AFTER_BREAK;
- write_register (PC_REGNUM, stop_pc);
-#ifdef NPC_REGNUM
- write_register (NPC_REGNUM, stop_pc + 4);
-#endif
- pc_changed = 0;
- }
- }
- }
- }
-
- if (stop_signal == SIGTRAP)
- random_signal
- = !(stop_breakpoint || trap_expected
- || stop_step_resume_break
-#ifndef CANNOT_EXECUTE_STACK
- || (stop_sp INNER_THAN stop_pc
- && stop_pc INNER_THAN stop_frame_address)
-#else
- || stop_pc == text_end - 2
-#endif
- || (step_range_end && !step_resume_break_address));
- else
- {
- random_signal
- = !(stop_breakpoint
- || stop_step_resume_break
-#ifdef sony_news
- || (stop_sp INNER_THAN stop_pc
- && stop_pc INNER_THAN stop_frame_address)
-#endif
-
- );
- if (!random_signal)
- stop_signal = SIGTRAP;
- }
- }
- else
- random_signal = 1;
-
- /* For the program's own signals, act according to
- the signal handling tables. */
-
- if (random_signal
- && !(running_in_shell && stop_signal == SIGSEGV))
- {
- /* Signal not for debugging purposes. */
- int printed = 0;
-
- stopped_by_random_signal = 1;
-
- if (stop_signal >= NSIG
- || signal_print[stop_signal])
- {
- printed = 1;
- terminal_ours_for_output ();
- printf ("\nProgram received signal %d, %s\n",
- stop_signal,
- stop_signal < NSIG
- ? sys_siglist[stop_signal]
- : "(undocumented)");
- fflush (stdout);
- }
- if (stop_signal >= NSIG
- || signal_stop[stop_signal])
- break;
- /* If not going to stop, give terminal back
- if we took it away. */
- else if (printed)
- terminal_inferior ();
- }
-
- /* Handle cases caused by hitting a breakpoint. */
-
- if (!random_signal
- && (stop_breakpoint || stop_step_resume_break))
- {
- /* Does a breakpoint want us to stop? */
- if (stop_breakpoint && stop_breakpoint != -1
- && stop_breakpoint != -0x1000001)
- {
- /* 0x1000000 is set in stop_breakpoint as returned by
- breakpoint_stop_status to indicate a silent
- breakpoint. */
- if ((stop_breakpoint > 0 ? stop_breakpoint :
- -stop_breakpoint)
- & 0x1000000)
- {
- stop_print_frame = 0;
- if (stop_breakpoint > 0)
- stop_breakpoint -= 0x1000000;
- else
- stop_breakpoint += 0x1000000;
- }
- break;
- }
- /* But if we have hit the step-resumption breakpoint,
- remove it. It has done its job getting us here.
- The sp test is to make sure that we don't get hung
- up in recursive calls in functions without frame
- pointers. If the stack pointer isn't outside of
- where the breakpoint was set (within a routine to be
- stepped over), we're in the middle of a recursive
- call. Not true for reg window machines (sparc)
- because the must change frames to call things and
- the stack pointer doesn't have to change if it
- the bp was set in a routine without a frame (pc can
- be stored in some other window).
-
- The removal of the sp test is to allow calls to
- alloca. Nasty things were happening. Oh, well,
- gdb can only handle one level deep of lack of
- frame pointer. */
- if (stop_step_resume_break
- && (step_frame_address == 0
- || (stop_frame_address == step_frame_address)))
- {
- remove_step_breakpoint ();
- step_resume_break_address = 0;
- }
- /* Otherwise, must remove breakpoints and single-step
- to get us past the one we hit. */
- else
- {
- remove_breakpoints ();
- remove_step_breakpoint ();
- breakpoints_inserted = 0;
- another_trap = 1;
- }
-
- /* We come here if we hit a breakpoint but should not
- stop for it. Possibly we also were stepping
- and should stop for that. So fall through and
- test for stepping. But, if not stepping,
- do not stop. */
- }
-
- /* If this is the breakpoint at the end of a stack dummy,
- just stop silently. */
-#ifndef CANNOT_EXECUTE_STACK
- if (stop_sp INNER_THAN stop_pc
- && stop_pc INNER_THAN stop_frame_address)
-#else
- if (stop_pc == text_end - 2)
-#endif
- {
- stop_print_frame = 0;
- stop_stack_dummy = 1;
-#ifdef HP_OS_BUG
- trap_expected_after_continue = 1;
-#endif
- break;
- }
-
- if (step_resume_break_address)
- /* Having a step-resume breakpoint overrides anything
- else having to do with stepping commands until
- that breakpoint is reached. */
- ;
- /* If stepping through a line, keep going if still within it. */
- else if (!random_signal
- && step_range_end
- && stop_pc >= step_range_start
- && stop_pc < step_range_end
- /* The step range might include the start of the
- function, so if we are at the start of the
- step range and either the stack or frame pointers
- just changed, we've stepped outside */
- && !(stop_pc == step_range_start
- && stop_frame_address
- && (stop_sp INNER_THAN prev_sp
- || stop_frame_address != step_frame_address)))
- {
- /* Don't step through the return from a function
- unless that is the first instruction stepped through. */
- if (ABOUT_TO_RETURN (stop_pc))
- {
- stop_step = 1;
- break;
- }
- }
-
- /* We stepped out of the stepping range. See if that was due
- to a subroutine call that we should proceed to the end of. */
- else if (!random_signal && step_range_end)
- {
- if (stop_func_start)
- {
- prologue_pc = stop_func_start;
- SKIP_PROLOGUE (prologue_pc);
- }
-
- /* Did we just take a signal? */
- if (IN_SIGTRAMP (stop_pc, stop_func_name)
- && !IN_SIGTRAMP (prev_pc, prev_func_name))
- {
- /* This code is needed at least in the following case:
- The user types "next" and then a signal arrives (before
- the "next" is done). */
- /* We've just taken a signal; go until we are back to
- the point where we took it and one more. */
- step_resume_break_address = prev_pc;
- step_resume_break_duplicate =
- breakpoint_here_p (step_resume_break_address);
- step_resume_break_sp = stop_sp;
- if (breakpoints_inserted)
- insert_step_breakpoint ();
- /* Make sure that the stepping range gets us past
- that instruction. */
- if (step_range_end == 1)
- step_range_end = (step_range_start = prev_pc) + 1;
- remove_breakpoints_on_following_step = 1;
- }
-
- /* ==> See comments at top of file on this algorithm. <==*/
-
- else if (stop_pc == stop_func_start
- && (stop_func_start != prev_func_start
- || prologue_pc != stop_func_start
- || stop_sp != prev_sp))
- {
- /* It's a subroutine call */
- if (step_over_calls > 0
- || (step_over_calls && find_pc_function (stop_pc) == 0))
- {
- /* A subroutine call has happened. */
- /* Set a special breakpoint after the return */
- step_resume_break_address =
- SAVED_PC_AFTER_CALL (get_current_frame ());
- step_resume_break_duplicate
- = breakpoint_here_p (step_resume_break_address);
- step_resume_break_sp = stop_sp;
- if (breakpoints_inserted)
- insert_step_breakpoint ();
- }
- /* Subroutine call with source code we should not step over.
- Do step to the first line of code in it. */
- else if (step_over_calls)
- {
- SKIP_PROLOGUE (stop_func_start);
- sal = find_pc_line (stop_func_start, 0);
- /* Use the step_resume_break to step until
- the end of the prologue, even if that involves jumps
- (as it seems to on the vax under 4.2). */
- /* If the prologue ends in the middle of a source line,
- continue to the end of that source line.
- Otherwise, just go to end of prologue. */
-#ifdef PROLOGUE_FIRSTLINE_OVERLAP
- /* no, don't either. It skips any code that's
- legitimately on the first line. */
-#else
- if (sal.end && sal.pc != stop_func_start)
- stop_func_start = sal.end;
-#endif
-
- if (stop_func_start == stop_pc)
- {
- /* We are already there: stop now. */
- stop_step = 1;
- break;
- }
- else
- /* Put the step-breakpoint there and go until there. */
- {
- step_resume_break_address = stop_func_start;
- step_resume_break_sp = stop_sp;
-
- step_resume_break_duplicate
- = breakpoint_here_p (step_resume_break_address);
- if (breakpoints_inserted)
- insert_step_breakpoint ();
- /* Do not specify what the fp should be when we stop
- since on some machines the prologue
- is where the new fp value is established. */
- step_frame_address = 0;
- /* And make sure stepping stops right away then. */
- step_range_end = step_range_start;
- }
- }
- else
- {
- /* We get here only if step_over_calls is 0 and we
- just stepped into a subroutine. I presume
- that step_over_calls is only 0 when we're
- supposed to be stepping at the assembly
- language level.*/
- stop_step = 1;
- break;
- }
- }
- /* No subroutince call; stop now. */
- else
- {
- stop_step = 1;
- break;
- }
- }
-
- /* Save the pc before execution, to compare with pc after stop. */
- prev_pc = read_pc (); /* Might have been DECR_AFTER_BREAK */
- prev_func_start = stop_func_start; /* Ok, since if DECR_PC_AFTER
- BREAK is defined, the
- original pc would not have
- been at the start of a
- function. */
- prev_func_name = stop_func_name;
- prev_sp = stop_sp;
-
- /* If we did not do break;, it means we should keep
- running the inferior and not return to debugger. */
-
- /* If trap_expected is 2, it means continue once more
- and insert breakpoints at the next trap.
- If trap_expected is 1 and the signal was SIGSEGV, it means
- the shell is doing some memory allocation--just resume it
- with SIGSEGV.
- Otherwise insert breakpoints now, and possibly single step. */
-
- if (trap_expected > 1)
- {
- trap_expected--;
- running_in_shell = 1;
- resume (0, 0);
- }
- else if (running_in_shell && stop_signal == SIGSEGV)
- {
- resume (0, SIGSEGV);
- }
- else if (trap_expected && stop_signal != SIGTRAP)
- {
- /* We took a signal which we are supposed to pass through to
- the inferior and we haven't yet gotten our trap. Simply
- continue. */
- resume ((step_range_end && !step_resume_break_address)
- || trap_expected,
- stop_signal);
- }
- else
- {
- /* Here, we are not awaiting another exec to get
- the program we really want to debug.
- Insert breakpoints now, unless we are trying
- to one-proceed past a breakpoint. */
- running_in_shell = 0;
- /* If we've just finished a special step resume and we don't
- want to hit a breakpoint, pull em out. */
- if (!step_resume_break_address &&
- remove_breakpoints_on_following_step)
- {
- remove_breakpoints_on_following_step = 0;
- remove_breakpoints ();
- breakpoints_inserted = 0;
- }
- else if (!breakpoints_inserted && !another_trap)
- {
- insert_step_breakpoint ();
- breakpoints_failed = insert_breakpoints ();
- if (breakpoints_failed)
- break;
- breakpoints_inserted = 1;
- }
-
- trap_expected = another_trap;
-
- if (stop_signal == SIGTRAP)
- stop_signal = 0;
-
- resume ((step_range_end && !step_resume_break_address)
- || trap_expected,
- stop_signal);
- }
- }
-}
-
-/* Here to return control to GDB when the inferior stops for real.
- Print appropriate messages, remove breakpoints, give terminal our modes.
-
- RUNNING_IN_SHELL nonzero means the shell got a signal before
- exec'ing the program we wanted to run.
- STOP_PRINT_FRAME nonzero means print the executing frame
- (pc, function, args, file, line number and line text).
- BREAKPOINTS_FAILED nonzero means stop was due to error
- attempting to insert breakpoints. */
-
-static void
-normal_stop ()
-{
- /* Make sure that the current_frame's pc is correct. This
- is a correction for setting up the frame info before doing
- DECR_PC_AFTER_BREAK */
- if (inferior_pid)
- (get_current_frame ())->pc = read_pc ();
-
- if (breakpoints_failed)
- {
- terminal_ours_for_output ();
- print_sys_errmsg ("ptrace", breakpoints_failed);
- printf ("Stopped; cannot insert breakpoints.\n\
-The same program may be running in another process.\n");
- }
-
- if (inferior_pid)
- remove_step_breakpoint ();
-
- if (inferior_pid && breakpoints_inserted)
- if (remove_breakpoints ())
- {
- terminal_ours_for_output ();
- printf ("Cannot remove breakpoints because program is no longer writable.\n\
-It must be running in another process.\n\
-Further execution is probably impossible.\n");
- }
-
- breakpoints_inserted = 0;
-
- /* Delete the breakpoint we stopped at, if it wants to be deleted.
- Delete any breakpoint that is to be deleted at the next stop. */
-
- breakpoint_auto_delete (stop_breakpoint);
-
- /* If an auto-display called a function and that got a signal,
- delete that auto-display to avoid an infinite recursion. */
-
- if (stopped_by_random_signal)
- disable_current_display ();
-
- if (step_multi && stop_step)
- return;
-
- terminal_ours ();
-
- if (running_in_shell)
- {
- if (stop_signal == SIGSEGV)
- {
- char *exec_file = (char *) get_exec_file (1);
-
- if (access (exec_file, X_OK) != 0)
- printf ("The file \"%s\" is not executable.\n", exec_file);
- else
- /* I don't think we should ever get here.
- wait_for_inferior now ignores SIGSEGV's which happen in
- the shell (since the Bourne shell (/bin/sh) has some
- rather, er, uh, *unorthodox* memory management
- involving catching SIGSEGV). */
- printf ("\
-You have just encountered a bug in \"sh\". GDB starts your program\n\
-by running \"sh\" with a command to exec your program.\n\
-This is so that \"sh\" will process wildcards and I/O redirection.\n\
-This time, \"sh\" crashed.\n\
-\n\
-One known bug in \"sh\" bites when the environment takes up a lot of space.\n\
-Try \"info env\" to see the environment; then use \"delete env\" to kill\n\
-some variables whose values are large; then do \"run\" again.\n\
-\n\
-If that works, you might want to put those \"delete env\" commands\n\
-into a \".gdbinit\" file in this directory so they will happen every time.\n");
- }
- /* Don't confuse user with his program's symbols on sh's data. */
- stop_print_frame = 0;
- }
-
- if (inferior_pid == 0)
- return;
-
- /* Select innermost stack frame except on return from a stack dummy routine,
- or if the program has exited. */
- if (!stop_stack_dummy)
- {
- select_frame (get_current_frame (), 0);
-
- if (stop_print_frame)
- {
- if (stop_breakpoint > 0)
- printf ("\nBpt %d, ", stop_breakpoint);
- print_sel_frame (stop_step
- && step_frame_address == stop_frame_address
- && step_start_function == find_pc_function (stop_pc));
- /* Display the auto-display expressions. */
- do_displays ();
- }
- }
-
- if (stop_stack_dummy)
- {
- /* Pop the empty frame that contains the stack dummy.
- POP_FRAME ends with a setting of the current frame, so we
- can use that next. */
-#ifndef NEW_CALL_FUNCTION
- POP_FRAME;
-#endif
- select_frame (get_current_frame (), 0);
- }
-}
-
-static void
-insert_step_breakpoint ()
-{
- if (step_resume_break_address && !step_resume_break_duplicate)
- {
- read_memory (step_resume_break_address,
- step_resume_break_shadow, sizeof break_insn);
- write_memory (step_resume_break_address,
- break_insn, sizeof break_insn);
- }
-}
-
-static void
-remove_step_breakpoint ()
-{
- if (step_resume_break_address && !step_resume_break_duplicate)
- write_memory (step_resume_break_address, step_resume_break_shadow,
- sizeof break_insn);
-}
-
-/* Specify how various signals in the inferior should be handled. */
-
-static void
-handle_command (args, from_tty)
- char *args;
- int from_tty;
-{
- register char *p = args;
- int signum = 0;
- register int digits, wordlen;
-
- if (!args)
- error_no_arg ("signal to handle");
-
- while (*p)
- {
- /* Find the end of the next word in the args. */
- for (wordlen = 0; p[wordlen] && p[wordlen] != ' ' && p[wordlen] != '\t';
- wordlen++);
- for (digits = 0; p[digits] >= '0' && p[digits] <= '9'; digits++);
-
- /* If it is all digits, it is signal number to operate on. */
- if (digits == wordlen)
- {
- signum = atoi (p);
- if (signum <= 0 || signum >= NSIG)
- {
- p[wordlen] = '\0';
- error ("Invalid signal %s given as argument to \"handle\".", p);
- }
- if (signum == SIGTRAP || signum == SIGINT)
- {
- if (!query ("Signal %d is used by the debugger.\nAre you sure you want to change it? ", signum))
- error ("Not confirmed.");
- }
- }
- else if (signum == 0)
- error ("First argument is not a signal number.");
-
- /* Else, if already got a signal number, look for flag words
- saying what to do for it. */
- else if (!strncmp (p, "stop", wordlen))
- {
- signal_stop[signum] = 1;
- signal_print[signum] = 1;
- }
- else if (wordlen >= 2 && !strncmp (p, "print", wordlen))
- signal_print[signum] = 1;
- else if (wordlen >= 2 && !strncmp (p, "pass", wordlen))
- signal_program[signum] = 1;
- else if (!strncmp (p, "ignore", wordlen))
- signal_program[signum] = 0;
- else if (wordlen >= 3 && !strncmp (p, "nostop", wordlen))
- signal_stop[signum] = 0;
- else if (wordlen >= 4 && !strncmp (p, "noprint", wordlen))
- {
- signal_print[signum] = 0;
- signal_stop[signum] = 0;
- }
- else if (wordlen >= 4 && !strncmp (p, "nopass", wordlen))
- signal_program[signum] = 0;
- else if (wordlen >= 3 && !strncmp (p, "noignore", wordlen))
- signal_program[signum] = 1;
- /* Not a number and not a recognized flag word => complain. */
- else
- {
- p[wordlen] = 0;
- error ("Unrecognized flag word: \"%s\".", p);
- }
-
- /* Find start of next word. */
- p += wordlen;
- while (*p == ' ' || *p == '\t') p++;
- }
-
- if (from_tty)
- {
- /* Show the results. */
- printf ("Number\tStop\tPrint\tPass to program\tDescription\n");
- printf ("%d\t", signum);
- printf ("%s\t", signal_stop[signum] ? "Yes" : "No");
- printf ("%s\t", signal_print[signum] ? "Yes" : "No");
- printf ("%s\t\t", signal_program[signum] ? "Yes" : "No");
- printf ("%s\n", sys_siglist[signum]);
- }
-}
-
-/* Print current contents of the tables set by the handle command. */
-
-static void
-signals_info (signum_exp)
- char *signum_exp;
-{
- register int i;
- printf_filtered ("Number\tStop\tPrint\tPass to program\tDescription\n");
-
- if (signum_exp)
- {
- i = parse_and_eval_address (signum_exp);
- if (i >= NSIG || i < 0)
- error ("Signal number out of bounds.");
- printf_filtered ("%d\t", i);
- printf_filtered ("%s\t", signal_stop[i] ? "Yes" : "No");
- printf_filtered ("%s\t", signal_print[i] ? "Yes" : "No");
- printf_filtered ("%s\t\t", signal_program[i] ? "Yes" : "No");
- printf_filtered ("%s\n", sys_siglist[i]);
- return;
- }
-
- printf_filtered ("\n");
- for (i = 0; i < NSIG; i++)
- {
- QUIT;
-
- printf_filtered ("%d\t", i);
- printf_filtered ("%s\t", signal_stop[i] ? "Yes" : "No");
- printf_filtered ("%s\t", signal_print[i] ? "Yes" : "No");
- printf_filtered ("%s\t\t", signal_program[i] ? "Yes" : "No");
- printf_filtered ("%s\n", sys_siglist[i]);
- }
-
- printf_filtered ("\nUse the \"handle\" command to change these tables.\n");
-}
-
-/* Save all of the information associated with the inferior<==>gdb
- connection. INF_STATUS is a pointer to a "struct inferior_status"
- (defined in inferior.h). */
-
-struct command_line *get_breakpoint_commands ();
-
-void
-save_inferior_status (inf_status, restore_stack_info)
- struct inferior_status *inf_status;
- int restore_stack_info;
-{
- inf_status->pc_changed = pc_changed;
- inf_status->stop_signal = stop_signal;
- inf_status->stop_pc = stop_pc;
- inf_status->stop_frame_address = stop_frame_address;
- inf_status->stop_breakpoint = stop_breakpoint;
- inf_status->stop_step = stop_step;
- inf_status->stop_stack_dummy = stop_stack_dummy;
- inf_status->stopped_by_random_signal = stopped_by_random_signal;
- inf_status->trap_expected = trap_expected;
- inf_status->step_range_start = step_range_start;
- inf_status->step_range_end = step_range_end;
- inf_status->step_frame_address = step_frame_address;
- inf_status->step_over_calls = step_over_calls;
- inf_status->step_resume_break_address = step_resume_break_address;
- inf_status->stop_after_trap = stop_after_trap;
- inf_status->stop_after_attach = stop_after_attach;
- inf_status->breakpoint_commands = get_breakpoint_commands ();
- inf_status->restore_stack_info = restore_stack_info;
-
- read_register_bytes(0, inf_status->register_context, REGISTER_BYTES);
- record_selected_frame (&(inf_status->selected_frame_address),
- &(inf_status->selected_level));
- return;
-}
-
-void
-restore_inferior_status (inf_status)
- struct inferior_status *inf_status;
-{
- FRAME fid;
- int level = inf_status->selected_level;
-
- pc_changed = inf_status->pc_changed;
- stop_signal = inf_status->stop_signal;
- stop_pc = inf_status->stop_pc;
- stop_frame_address = inf_status->stop_frame_address;
- stop_breakpoint = inf_status->stop_breakpoint;
- stop_step = inf_status->stop_step;
- stop_stack_dummy = inf_status->stop_stack_dummy;
- stopped_by_random_signal = inf_status->stopped_by_random_signal;
- trap_expected = inf_status->trap_expected;
- step_range_start = inf_status->step_range_start;
- step_range_end = inf_status->step_range_end;
- step_frame_address = inf_status->step_frame_address;
- step_over_calls = inf_status->step_over_calls;
- step_resume_break_address = inf_status->step_resume_break_address;
- stop_after_trap = inf_status->stop_after_trap;
- stop_after_attach = inf_status->stop_after_attach;
- set_breakpoint_commands (inf_status->breakpoint_commands);
-
- write_register_bytes(0, inf_status->register_context, REGISTER_BYTES);
-
- /* The inferior can be gone if the user types "print exit(0)"
- (and perhaps other times). */
- if (have_inferior_p() && inf_status->restore_stack_info)
- {
- flush_cached_frames();
- set_current_frame(create_new_frame(read_register (FP_REGNUM),
- read_pc()));
-
- fid = find_relative_frame (get_current_frame (), &level);
-
- if (fid == 0 ||
- FRAME_FP (fid) != inf_status->selected_frame_address ||
- level != 0)
- {
- /* I'm not sure this error message is a good idea. I have
- only seen it occur after "Can't continue previously
- requested operation" (we get called from do_cleanups), in
- which case it just adds insult to injury (one confusing
- error message after another. Besides which, does the
- user really care if we can't restore the previously
- selected frame? */
- fprintf (stderr, "Unable to restore previously selected frame.\n");
- select_frame (get_current_frame (), 0);
- return;
- }
-
- select_frame (fid, inf_status->selected_level);
- }
- return;
-}
-
-
-void
-_initialize_infrun ()
-{
- register int i;
-
- add_info ("signals", signals_info,
- "What debugger does when program gets various signals.\n\
-Specify a signal number as argument to print info on that signal only.");
-
- add_com ("handle", class_run, handle_command,
- "Specify how to handle a signal.\n\
-Args are signal number followed by flags.\n\
-Flags allowed are \"stop\", \"print\", \"pass\",\n\
- \"nostop\", \"noprint\" or \"nopass\".\n\
-Print means print a message if this signal happens.\n\
-Stop means reenter debugger if this signal happens (implies print).\n\
-Pass means let program see this signal; otherwise program doesn't know.\n\
-Pass and Stop may be combined.");
-
- for (i = 0; i < NSIG; i++)
- {
- signal_stop[i] = 1;
- signal_print[i] = 1;
- signal_program[i] = 1;
- }
-
- /* Signals caused by debugger's own actions
- should not be given to the program afterwards. */
- signal_program[SIGTRAP] = 0;
- signal_program[SIGINT] = 0;
-
- /* Signals that are not errors should not normally enter the debugger. */
-#ifdef SIGALRM
- signal_stop[SIGALRM] = 0;
- signal_print[SIGALRM] = 0;
-#endif /* SIGALRM */
-#ifdef SIGVTALRM
- signal_stop[SIGVTALRM] = 0;
- signal_print[SIGVTALRM] = 0;
-#endif /* SIGVTALRM */
-#ifdef SIGPROF
- signal_stop[SIGPROF] = 0;
- signal_print[SIGPROF] = 0;
-#endif /* SIGPROF */
-#ifdef SIGCHLD
- signal_stop[SIGCHLD] = 0;
- signal_print[SIGCHLD] = 0;
-#endif /* SIGCHLD */
-#ifdef SIGCLD
- signal_stop[SIGCLD] = 0;
- signal_print[SIGCLD] = 0;
-#endif /* SIGCLD */
-#ifdef SIGIO
- signal_stop[SIGIO] = 0;
- signal_print[SIGIO] = 0;
-#endif /* SIGIO */
-#ifdef SIGURG
- signal_stop[SIGURG] = 0;
- signal_print[SIGURG] = 0;
-#endif /* SIGURG */
-}
-
diff --git a/gnu/usr.bin/gdb/kgdb_proto.h b/gnu/usr.bin/gdb/kgdb_proto.h
deleted file mode 100644
index 8bbd5be..0000000
--- a/gnu/usr.bin/gdb/kgdb_proto.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Steven McCanne of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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.
- *
- * @(#)kgdb_proto.h 6.3 (Berkeley) 5/8/91
- *
- *
- * $Header: /home/cvs/386BSD/src/usr.bin/gdb/kgdb_proto.h,v 1.1.1.1 1993/06/12 14:52:25 rgrimes Exp $ (LBL)
- */
-
-/*
- * Message types.
- */
-#define KGDB_MEM_R 0x01
-#define KGDB_MEM_W 0x02
-#define KGDB_REG_R 0x03
-#define KGDB_REG_W 0x04
-#define KGDB_CONT 0x05
-#define KGDB_STEP 0x06
-#define KGDB_KILL 0x07
-#define KGDB_SIGNAL 0x08
-#define KGDB_EXEC 0x09
-
-#define KGDB_CMD(x) ((x) & 0x0f)
-
-/*
- * Message flags.
- */
-#define KGDB_ACK 0x80
-#define KGDB_DELTA 0x40
-#define KGDB_MORE 0x20
-#define KGDB_SEQ 0x10
diff --git a/gnu/usr.bin/gdb/main.c b/gnu/usr.bin/gdb/main.c
deleted file mode 100644
index 323de87..0000000
--- a/gnu/usr.bin/gdb/main.c
+++ /dev/null
@@ -1,2241 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)main.c 6.6 (Berkeley) 5/13/91";
-#endif /* not lint */
-
-/* Top level for GDB, the GNU debugger.
- Copyright (C) 1986, 1987, 1988, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include "defs.h"
-#include "command.h"
-#include "param.h"
-#include "expression.h"
-
-#ifdef USG
-#include <sys/types.h>
-#include <unistd.h>
-#endif
-
-#include <sys/file.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <ctype.h>
-
-#ifdef SET_STACK_LIMIT_HUGE
-#include <sys/time.h>
-#include <sys/resource.h>
-
-int original_stack_limit;
-#endif
-
-/* If this definition isn't overridden by the header files, assume
- that isatty and fileno exist on this system. */
-#ifndef ISATTY
-#define ISATTY(FP) (isatty (fileno (FP)))
-#endif
-
-extern void free ();
-
-/* Version number of GDB, as a string. */
-
-extern char *version;
-
-/*
- * Declare all cmd_list_element's
- */
-
-/* Chain containing all defined commands. */
-
-struct cmd_list_element *cmdlist;
-
-/* Chain containing all defined info subcommands. */
-
-struct cmd_list_element *infolist;
-
-/* Chain containing all defined enable subcommands. */
-
-struct cmd_list_element *enablelist;
-
-/* Chain containing all defined disable subcommands. */
-
-struct cmd_list_element *disablelist;
-
-/* Chain containing all defined delete subcommands. */
-
-struct cmd_list_element *deletelist;
-
-/* Chain containing all defined "enable breakpoint" subcommands. */
-
-struct cmd_list_element *enablebreaklist;
-
-/* Chain containing all defined set subcommands */
-
-struct cmd_list_element *setlist;
-
-/* Chain containing all defined \"set history\". */
-
-struct cmd_list_element *sethistlist;
-
-/* Chain containing all defined \"unset history\". */
-
-struct cmd_list_element *unsethistlist;
-
-/* stdio stream that command input is being read from. */
-
-FILE *instream;
-
-/* Current working directory. */
-
-char *current_directory;
-
-/* The directory name is actually stored here (usually). */
-static char dirbuf[MAXPATHLEN];
-
-#ifdef KERNELDEBUG
-/* Nonzero if we're debugging /dev/mem or a kernel crash dump */
-
-int kernel_debugging;
-#endif
-
-/* Nonzero to inhibit confirmation of quitting or restarting
- a stopped inferior. */
-int inhibit_confirm;
-
-/* Nonzero if we can write in text or core file */
-
-int writeable_text;
-
-/* The number of lines on a page, and the number of spaces
- in a line. */
-int linesize, pagesize;
-
-/* Nonzero if we should refrain from using an X window. */
-
-int inhibit_windows = 0;
-
-/* Function to call before reading a command, if nonzero.
- The function receives two args: an input stream,
- and a prompt string. */
-
-void (*window_hook) ();
-
-extern int frame_file_full_name;
-int xgdb_verbose;
-
-void execute_command();
-void free_command_lines ();
-char *gdb_readline ();
-char *command_line_input ();
-static void initialize_main ();
-static void initialize_cmd_lists ();
-void command_loop ();
-static void source_command ();
-static void print_gdb_version ();
-static void float_handler ();
-static void cd_command ();
-
-char *getenv ();
-
-/* gdb prints this when reading a command interactively */
-static char *prompt;
-
-/* Buffer used for reading command lines, and the size
- allocated for it so far. */
-
-char *line;
-int linesize;
-
-
-/* This is how `error' returns to command level. */
-
-jmp_buf to_top_level;
-
-void
-return_to_top_level ()
-{
- quit_flag = 0;
- immediate_quit = 0;
- clear_breakpoint_commands ();
- clear_momentary_breakpoints ();
- disable_current_display ();
- do_cleanups (0);
- longjmp (to_top_level, 1);
-}
-
-/* Call FUNC with arg ARG, catching any errors.
- If there is no error, return the value returned by FUNC.
- If there is an error, return zero after printing ERRSTRING
- (which is in addition to the specific error message already printed). */
-
-int
-catch_errors (func, arg, errstring)
- int (*func) ();
- int arg;
- char *errstring;
-{
- jmp_buf saved;
- int val;
- struct cleanup *saved_cleanup_chain;
-
- saved_cleanup_chain = save_cleanups ();
-
- bcopy (to_top_level, saved, sizeof (jmp_buf));
-
- if (setjmp (to_top_level) == 0)
- val = (*func) (arg);
- else
- {
- fprintf (stderr, "%s\n", errstring);
- val = 0;
- }
-
- restore_cleanups (saved_cleanup_chain);
-
- bcopy (saved, to_top_level, sizeof (jmp_buf));
- return val;
-}
-
-/* Handler for SIGHUP. */
-
-static void
-disconnect ()
-{
- kill_inferior_fast ();
- signal (SIGHUP, SIG_DFL);
- kill (getpid (), SIGHUP);
-}
-
-/* Clean up on error during a "source" command (or execution of a
- user-defined command).
- Close the file opened by the command
- and restore the previous input stream. */
-
-static void
-source_cleanup (stream)
- FILE *stream;
-{
- /* Instream may be 0; set to it when executing user-defined command. */
- if (instream)
- fclose (instream);
- instream = stream;
-}
-
-/*
- * Source $HOME/.gdbinit and $cwd/.gdbinit.
- * If X is enabled, also $HOME/.xgdbinit and $cwd/.xgdbinit.source
- */
-void
-source_init_files()
-{
- char *homedir, initfile[256];
- int samedir = 0;
-
- /* Read init file, if it exists in home directory */
- homedir = getenv ("HOME");
- if (homedir) {
- struct stat homebuf, cwdbuf;
-
- sprintf(initfile, "%s/.gdbinit", homedir);
- if (access (initfile, R_OK) == 0)
- if (!setjmp (to_top_level))
- source_command (initfile);
- if (!inhibit_windows) {
- sprintf(initfile, "%s/.xgdbinit", homedir);
- if (access (initfile, R_OK) == 0)
- if (!setjmp (to_top_level))
- source_command (initfile);
- }
- /* Determine if current directory is the same as the home
- directory, so we don't source the same file twice. */
-
- bzero (&homebuf, sizeof (struct stat));
- bzero (&cwdbuf, sizeof (struct stat));
-
- stat(homedir, &homebuf);
- stat(".", &cwdbuf);
-
- samedir = bcmp(&homebuf, &cwdbuf, sizeof(struct stat)) == 0;
- }
- /* Read the input file in the current directory, *if* it isn't
- the same file (it should exist, also). */
- if (!samedir) {
- if (access (".gdbinit", R_OK) == 0)
- if (!setjmp (to_top_level))
- source_command (".gdbinit");
- if (access (".xgdbinit", R_OK) == 0)
- if (!setjmp (to_top_level))
- source_command (".xgdbinit");
- }
-}
-
-
-int
-main (argc, argv, envp)
- int argc;
- char **argv;
- char **envp;
-{
- int count;
- int inhibit_gdbinit = 0;
- int quiet = 1;
- int batch = 0;
- register int i;
- char *cp;
-
- /* XXX Windows only for xgdb. */
- char *strrchr();
- if (cp = strrchr(argv[0], '/'))
- ++cp;
- else
- cp = argv[0];
- if (*cp != 'x')
- inhibit_windows = 1;
-
-#if defined (ALIGN_STACK_ON_STARTUP)
- i = (int) &count & 0x3;
- if (i != 0)
- alloca (4 - i);
-#endif
-
- quit_flag = 0;
- linesize = 100;
- line = (char *) xmalloc (linesize);
- *line = 0;
- instream = stdin;
-
- getwd (dirbuf);
- current_directory = dirbuf;
-
-#ifdef SET_STACK_LIMIT_HUGE
- {
- struct rlimit rlim;
-
- /* Set the stack limit huge so that alloca (particularly stringtab
- * in dbxread.c) does not fail. */
- getrlimit (RLIMIT_STACK, &rlim);
- original_stack_limit = rlim.rlim_cur;
- rlim.rlim_cur = rlim.rlim_max;
- setrlimit (RLIMIT_STACK, &rlim);
- }
-#endif /* SET_STACK_LIMIT_HUGE */
-
- /* Look for flag arguments. */
-
- for (i = 1; i < argc; i++)
- {
- if (!strcmp (argv[i], "-q") || !strcmp (argv[i], "-quiet"))
- quiet = 1;
- else if (!strcmp (argv[i], "-nx"))
- inhibit_gdbinit = 1;
- else if (!strcmp (argv[i], "-nw"))
- inhibit_windows = 1;
- else if (!strcmp (argv[i], "-batch"))
- batch = 1, quiet = 1;
- else if (!strcmp (argv[i], "-fullname"))
- frame_file_full_name = 1;
- else if (!strcmp (argv[i], "-xgdb_verbose"))
- xgdb_verbose = 1;
- /* -help: print a summary of command line switches. */
- else if (!strcmp (argv[i], "-help"))
- {
- fputs ("\
-This is GDB, the GNU debugger. Use the command\n\
- gdb [options] [executable [core-file]]\n\
-to enter the debugger.\n\
-\n\
-Options available are:\n\
- -help Print this message.\n\
- -quiet Do not print version number on startup.\n\
- -fullname Output information used by emacs-GDB interface.\n\
- -batch Exit after processing options.\n\
- -nx Do not read .gdbinit file.\n\
- -tty TTY Use TTY for input/output by the program being debugged.\n\
- -cd DIR Change current directory to DIR.\n\
- -directory DIR Search for source files in DIR.\n\
- -command FILE Execute GDB commands from FILE.\n\
- -symbols SYMFILE Read symbols from SYMFILE.\n\
- -exec EXECFILE Use EXECFILE as the executable.\n\
- -se FILE Use FILE as symbol file and executable file.\n\
- -core COREFILE Analyze the core dump COREFILE.\n\
- -k Kernel debugging.\n\
- -w Writeable text.\n\
- -v Print GNU message and version number on startup.\n\
- -nc Don't confirm quit or run commands.\n\
-\n\
-For more information, type \"help\" from within GDB, or consult the\n\
-GDB manual (available as on-line info or a printed manual).\n", stderr);
- /* Exiting after printing this message seems like
- the most useful thing to do. */
- exit (0);
- }
-#ifdef KERNELDEBUG
- else if (!strcmp (argv[i], "-k"))
- kernel_debugging = 1;
-#endif
- else if (!strcmp (argv[i], "-w"))
- writeable_text = 1;
- else if (!strcmp (argv[i], "-v"))
- quiet = 0;
- else if (!strcmp (argv[i], "-nc"))
- inhibit_confirm = 1;
- else if (argv[i][0] == '-')
- /* Other options take arguments, so don't confuse an
- argument with an option. */
- i++;
- }
-
- /* Run the init function of each source file */
-
- initialize_cmd_lists (); /* This needs to be done first */
- initialize_all_files ();
- initialize_main (); /* But that omits this file! Do it now */
- initialize_signals ();
-
- if (!quiet)
- print_gdb_version ();
-
- /* Process the command line arguments. */
-
- count = 0;
- for (i = 1; i < argc; i++)
- {
- extern void exec_file_command (), symbol_file_command ();
- extern void core_file_command ();
- register char *arg = argv[i];
- /* Args starting with - say what to do with the following arg
- as a filename. */
- if (arg[0] == '-')
- {
- extern void tty_command (), directory_command ();
-
- if (!strcmp (arg, "-q") || !strcmp (arg, "-nx")
- || !strcmp (arg, "-quiet") || !strcmp (arg, "-batch")
- || !strcmp (arg, "-fullname") || !strcmp (arg, "-nw")
- || !strcmp (arg, "-xgdb_verbose")
- || !strcmp (arg, "-help")
- || !strcmp (arg, "-k")
- || !strcmp (arg, "-w")
- || !strcmp (arg, "-v")
- || !strcmp (arg, "-nc"))
- /* Already processed above */
- continue;
-
- if (++i == argc)
- fprintf (stderr, "No argument follows \"%s\".\n", arg);
- if (!setjmp (to_top_level))
- {
- /* -s foo: get syms from foo. -e foo: execute foo.
- -se foo: do both with foo. -c foo: use foo as core dump. */
- if (!strcmp (arg, "-se"))
- {
- exec_file_command (argv[i], !batch);
- symbol_file_command (argv[i], !batch);
- }
- else if (!strcmp (arg, "-s") || !strcmp (arg, "-symbols"))
- symbol_file_command (argv[i], !batch);
- else if (!strcmp (arg, "-e") || !strcmp (arg, "-exec"))
- exec_file_command (argv[i], !batch);
- else if (!strcmp (arg, "-c") || !strcmp (arg, "-core"))
- core_file_command (argv[i], !batch);
- /* -x foo: execute commands from foo. */
- else if (!strcmp (arg, "-x") || !strcmp (arg, "-command")
- || !strcmp (arg, "-commands"))
- source_command (argv[i]);
- /* -d foo: add directory `foo' to source-file directory
- search-list */
- else if (!strcmp (arg, "-d") || !strcmp (arg, "-dir")
- || !strcmp (arg, "-directory"))
- directory_command (argv[i], 0);
- /* -cd FOO: specify current directory as FOO.
- GDB remembers the precise string FOO as the dirname. */
- else if (!strcmp (arg, "-cd"))
- {
- cd_command (argv[i], 0);
- init_source_path ();
- }
- /* -t /def/ttyp1: use /dev/ttyp1 for inferior I/O. */
- else if (!strcmp (arg, "-t") || !strcmp (arg, "-tty"))
- tty_command (argv[i], 0);
-
- else
- error ("Unknown command-line switch: \"%s\"\n", arg);
- }
- }
- else
- {
- /* Args not thus accounted for
- are treated as, first, the symbol/executable file
- and, second, the core dump file. */
- count++;
- if (!setjmp (to_top_level))
- switch (count)
- {
- case 1:
- exec_file_command (arg, !batch);
- symbol_file_command (arg, !batch);
- break;
-
- case 2:
- core_file_command (arg, !batch);
- break;
-
- case 3:
- fprintf (stderr, "Excess command line args ignored. (%s%s)\n",
- arg, (i == argc - 1) ? "" : " ...");
- }
- }
- }
-
- if (!inhibit_gdbinit)
- source_init_files();
-
- if (batch)
- {
-#if 0
- fatal ("Attempt to read commands from stdin in batch mode.");
-#endif
- /* We have hit the end of the batch file. */
- exit (0);
- }
-
- if (!quiet)
- printf ("Type \"help\" for a list of commands.\n");
-
- /* The command loop. */
-
- while (1)
- {
- if (!setjmp (to_top_level))
- command_loop ();
- if (ISATTY(stdin))
- clearerr (stdin); /* Don't get hung if C-d is typed. */
- else if (feof(instream)) /* Avoid endless loops for redirected stdin */
- break;
- }
- exit (0);
-}
-
-
-static void
-do_nothing ()
-{
-}
-
-/* Read commands from `instream' and execute them
- until end of file. */
-void
-command_loop ()
-{
- struct cleanup *old_chain;
- register int toplevel = (instream == stdin);
- register int interactive = (toplevel && ISATTY(stdin));
-
- while (!feof (instream))
- {
- register char *cmd_line;
-
- quit_flag = 0;
- if (interactive)
- reinitialize_more_filter ();
- old_chain = make_cleanup (do_nothing, 0);
- cmd_line = command_line_input (prompt, toplevel);
- execute_command (cmd_line, toplevel);
- /* Do any commands attached to breakpoint we stopped at. */
- do_breakpoint_commands ();
- do_cleanups (old_chain);
- }
-}
-
-/* Commands call this if they do not want to be repeated by null lines. */
-
-void
-dont_repeat ()
-{
- /* If we aren't reading from standard input, we are saving the last
- thing read from stdin in line and don't want to delete it. Null lines
- won't repeat here in any case. */
- if (instream == stdin)
- *line = 0;
-}
-
-/* Read a line from the stream "instream" without command line editing.
-
- It prints PROMPT once at the start.
- Action is compatible with "readline" (i.e., space for typing is
- malloced & should be freed by caller). */
-char *
-gdb_readline (prompt)
- char *prompt;
-{
- int c;
- char *result;
- int input_index = 0;
- int result_size = 80;
-
- if (prompt)
- {
- printf (prompt);
- fflush (stdout);
- }
-
- result = (char *) xmalloc (result_size);
-
- while (1)
- {
- c = fgetc (instream ? instream : stdin);
- if (c == EOF)
- {
- free(result);
- return ((char *)0);
- }
- if (c == '\n')
- break;
-
- result[input_index++] = c;
- if (input_index >= result_size)
- {
- result_size <= 1;
- result = (char *)xrealloc(result, result_size);
- }
- }
- result[input_index++] = '\0';
- return result;
-}
-
-/* Declaration for fancy readline with command line editing. */
-char *readline ();
-
-/* Variables which control command line editing and history
- substitution. These variables are given default values at the end
- of this file. */
-static int command_editing_p;
-static int history_expansion_p;
-static int write_history_p;
-static int history_size;
-static char *history_filename;
-
-/* Variables which are necessary for fancy command line editing. */
-char *gdb_completer_word_break_characters =
- " \t\n!@#$%^&*()-+=|~`}{[]\"';:?/>.<,";
-
-/* Functions that are used as part of the fancy command line editing. */
-
-/* Generate symbol names one by one for the completer. If STATE is
- zero, then we need to initialize, otherwise the initialization has
- already taken place. TEXT is what we expect the symbol to start
- with. RL_LINE_BUFFER is available to be looked at; it contains the
- entire text of the line. RL_POINT is the offset in that line of
- the cursor. You should pretend that the line ends at RL_POINT. */
-char *
-symbol_completion_function (text, state)
- char *text;
- int state;
-{
- char **make_symbol_completion_list ();
- static char **list = (char **)NULL;
- static int index;
- char *output;
- extern char *rl_line_buffer;
- extern int rl_point;
- char *tmp_command, *p;
- struct cmd_list_element *c, *result_list;
-
- if (!state)
- {
- /* Free the storage used by LIST, but not by the strings inside. This is
- because rl_complete_internal () frees the strings. */
- if (list)
- free (list);
- list = 0;
- index = 0;
-
- /* Decide whether to complete on a list of gdb commands or on
- symbols. */
- tmp_command = (char *) alloca (rl_point + 1);
- p = tmp_command;
-
- strncpy (tmp_command, rl_line_buffer, rl_point);
- tmp_command[rl_point] = '\0';
-
- if (rl_point == 0)
- {
- /* An empty line we want to consider ambiguous; that is,
- it could be any command. */
- c = (struct cmd_list_element *) -1;
- result_list = 0;
- }
- else
- c = lookup_cmd_1 (&p, cmdlist, &result_list, 1);
-
- /* Move p up to the next interesting thing. */
- while (*p == ' ' || *p == '\t')
- p++;
-
- if (!c)
- /* He's typed something unrecognizable. Sigh. */
- list = (char **) 0;
- else if (c == (struct cmd_list_element *) -1)
- {
- if (p + strlen(text) != tmp_command + rl_point)
- error ("Unrecognized command.");
-
- /* He's typed something ambiguous. This is easier. */
- if (result_list)
- list = complete_on_cmdlist (*result_list->prefixlist, text);
- else
- list = complete_on_cmdlist (cmdlist, text);
- }
- else
- {
- /* If we've gotten this far, gdb has recognized a full
- command. There are several possibilities:
-
- 1) We need to complete on the command.
- 2) We need to complete on the possibilities coming after
- the command.
- 2) We need to complete the text of what comes after the
- command. */
-
- if (!*p && *text)
- /* Always (might be longer versions of thie command). */
- list = complete_on_cmdlist (result_list, text);
- else if (!*p && !*text)
- {
- if (c->prefixlist)
- list = complete_on_cmdlist (*c->prefixlist, "");
- else
- list = make_symbol_completion_list ("");
- }
- else
- {
- if (c->prefixlist && !c->allow_unknown)
- {
- *p = '\0';
- error ("\"%s\" command requires a subcommand.",
- tmp_command);
- }
- else
- list = make_symbol_completion_list (text);
- }
- }
- }
-
- /* If the debugged program wasn't compiled with symbols, or if we're
- clearly completing on a command and no command matches, return
- NULL. */
- if (!list)
- return ((char *)NULL);
-
- output = list[index];
- if (output)
- index++;
-
- return (output);
-}
-
-
-void
-print_prompt ()
-{
- if (prompt)
- {
- printf ("%s", prompt);
- fflush (stdout);
- }
-}
-
-
-#ifdef HAVE_TERMIO
-#include <termio.h>
-static struct termio norm_tty;
-
-static void
-suspend_sig()
-{
- int tty = fileno(stdin);
- struct termio cur_tty;
-
- ioctl(tty, TCGETA, &cur_tty);
- ioctl(tty, TCSETAW, &norm_tty);
-
- (void) sigsetmask(0);
- signal(SIGTSTP, SIG_DFL);
- kill(0, SIGTSTP);
-
- /*
- * we've just been resumed -- current tty params become new
- * 'normal' params (in case tset/stty was done while we were
- * suspended). Merge values that readline might have changed
- * into new params, then restore term mode.
- */
- ioctl(tty, TCGETA, &norm_tty);
- cur_tty.c_lflag = (cur_tty.c_lflag & (ICANON|ECHO|ISIG)) |
- (norm_tty.c_lflag &~ (ICANON|ECHO|ISIG));
- cur_tty.c_iflag = (cur_tty.c_iflag & (IXON|ISTRIP|INPCK)) |
- (norm_tty.c_iflag &~ (IXON|ISTRIP|INPCK));
- ioctl(tty, TCSETAW, &cur_tty);
-
- signal(SIGTSTP, suspend_sig);
- print_prompt();
-
- /*
- * Forget about any previous command -- null line now will do
- * nothing.
- */
- dont_repeat();
-}
-
-#else
-
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <sgtty.h>
-
-static struct sgttyb norm_tty;
-static struct tchars norm_tchars;
-static struct ltchars norm_ltchars;
-static int norm_lflags;
-
-#ifdef PASS8
-#define RL_TFLAGS (RAW|CRMOD|ECHO|CBREAK|PASS8)
-#else
-#define RL_TFLAGS (RAW|CRMOD|ECHO|CBREAK)
-#endif
-
-static void
-suspend_sig()
-{
- int tty = fileno(stdin);
- struct sgttyb cur_tty;
- struct tchars cur_tchars;
- struct ltchars cur_ltchars;
- int cur_lflags;
- int cur_flags;
-
- ioctl(tty, TIOCGETP, &cur_tty);
- ioctl(tty, TIOCGETC, &cur_tchars);
- ioctl(tty, TIOCLGET, &cur_lflags);
- ioctl(tty, TIOCGLTC, &cur_ltchars);
-
- ioctl(tty, TIOCSETP, &norm_tty);
- ioctl(tty, TIOCSETC, &norm_tchars);
- ioctl(tty, TIOCLSET, &norm_lflags);
- ioctl(tty, TIOCSLTC, &norm_ltchars);
-
- (void) sigsetmask(0);
- signal(SIGTSTP, SIG_DFL);
- kill(0, SIGTSTP);
-
- /*
- * we've just been resumed -- current tty params become new
- * 'normal' params (in case tset/stty was done while we were
- * suspended). Merge values that readline might have changed
- * into new params, then restore term mode.
- */
- ioctl(tty, TIOCGETP, &norm_tty);
- cur_flags = cur_tty.sg_flags;
- cur_tty = norm_tty;
- cur_tty.sg_flags = (cur_tty.sg_flags &~ RL_TFLAGS)
- | (cur_flags & RL_TFLAGS);
-
- ioctl(tty, TIOCLGET, &norm_lflags);
-#ifdef LPASS8
- cur_lflags = (cur_lflags &~ LPASS8) | (cur_flags & LPASS8);
-#endif
- ioctl(tty, TIOCGETC, &norm_tchars);
- ioctl(tty, TIOCGLTC, &norm_ltchars);
-
- ioctl(tty, TIOCSETP, &cur_tty);
- ioctl(tty, TIOCSETC, &cur_tchars);
- ioctl(tty, TIOCLSET, &cur_lflags);
- ioctl(tty, TIOCSLTC, &cur_ltchars);
-
- signal(SIGTSTP, suspend_sig);
- print_prompt();
-
- /*
- * Forget about any previous command -- null line now will do
- * nothing.
- */
- dont_repeat();
-}
-#endif /* HAVE_TERMIO */
-
-/* Initialize signal handlers. */
-initialize_signals ()
-{
- extern void request_quit ();
- int tty = fileno(stdin);
-
- signal (SIGINT, request_quit);
-
- /* If we initialize SIGQUIT to SIG_IGN, then the SIG_IGN will get
- passed to the inferior, which we don't want. It would be
- possible to do a "signal (SIGQUIT, SIG_DFL)" after we fork, but
- on BSD4.3 systems using vfork, that will (apparently) affect the
- GDB process as well as the inferior (the signal handling tables
- being shared between the two, apparently). Since we establish
- a handler for SIGQUIT, when we call exec it will set the signal
- to SIG_DFL for us. */
- signal (SIGQUIT, do_nothing);
- if (signal (SIGHUP, do_nothing) != SIG_IGN)
- signal (SIGHUP, disconnect);
- signal (SIGFPE, float_handler);
-
- ioctl(tty, TIOCGETP, &norm_tty);
- ioctl(tty, TIOCLGET, &norm_lflags);
- ioctl(tty, TIOCGETC, &norm_tchars);
- ioctl(tty, TIOCGLTC, &norm_ltchars);
- signal(SIGTSTP, suspend_sig);
-}
-
-char *
-finish_command_input(inputline, repeat, interactive)
- register char *inputline;
- int repeat;
- int interactive;
-{
- static char *do_free;
-
- if (do_free) {
- free(do_free);
- do_free = NULL;
- }
-
- /* Do history expansion if that is wished. */
- if (interactive && history_expansion_p) {
- int expanded;
-
- expanded = history_expand(inputline, &do_free);
- if (expanded) {
- /* Print the changes. */
- puts(do_free);
-
- /* An error acts like no input. */
- if (expanded < 0) {
- *do_free = 0;
- return (do_free);
- }
- }
- inputline = do_free;
- }
- /* get rid of any leading whitespace */
- while (isspace(*inputline))
- ++inputline;
- /*
- * If we just got an empty line, and that is supposed to repeat the
- * previous command, return the value in the global buffer.
- */
- if (*inputline == 0) {
- if (repeat)
- return (line);
- } else if (interactive)
- add_history(inputline);
-
- /*
- * If line is a comment, clear it out.
- * Note: comments are added to the command history. This is useful
- * when you type a command, and then realize you don't want to
- * execute it quite yet. You can comment out the command and then
- * later fetch it from the value history and remove the '#'.
- */
- if (*inputline == '#')
- *inputline = 0;
- else if (repeat) {
- /* Save into global buffer. */
- register int i = strlen(inputline) + 1;
-
- if (i > linesize) {
- line = xrealloc(line, i);
- linesize = i;
- }
- strcpy(line, inputline);
- }
- return (inputline);
-}
-
-static char *
-get_a_cmd_line(prompt, interactive)
- char *prompt;
- int interactive;
-{
- register char *cp;
-
- /* Control-C quits instantly if typed while reading input. */
- immediate_quit++;
- if (interactive && command_editing_p) {
- extern void (*rl_event_hook)();
-
- rl_event_hook = window_hook;
- cp = readline(prompt);
- } else {
- if (interactive) {
- if (window_hook) {
- print_prompt();
- (*window_hook)();
- }
- } else
- prompt = NULL;
- cp = gdb_readline(prompt);
- }
- --immediate_quit;
- return (cp);
-}
-
-/* Read one line from the command input stream `instream'
- Returns the address of the start of the line.
-
- *If* the instream == stdin & stdin is a terminal, the line read
- is copied into the file line saver (global var char *line,
- length linesize) so that it can be duplicated.
-
- This routine either uses fancy command line editing or
- simple input as the user has requested. */
-
-char *
-command_line_input(prompt, repeat)
- char *prompt;
- int repeat;
-{
- static char *do_free;
- register int interactive = (instream == stdin && ISATTY(instream));
- register char *cp;
- register int i;
-
- if (do_free) {
- free(do_free);
- do_free = NULL;
- }
- cp = get_a_cmd_line(prompt, interactive);
-
- /*
- * handle continued lines (this loop is not particularly
- * efficient because it's rare).
- */
- while (cp && cp[i = strlen(cp) - 1] == '\\') {
- register char *np = get_a_cmd_line(prompt, interactive);
- register int j;
-
- if (np == NULL) {
- cp[i] = 0;
- break;
- }
- j = strlen(np);
- cp = xrealloc(cp, i + j + 1);
- strcpy(cp + i, np);
- free(np);
- }
- if (cp == NULL)
- return ("");
- do_free = cp;
- return (finish_command_input(cp, repeat, interactive));
-}
-
-
-#define MAX_USER_ARGS 32
-
-static struct user_args {
- struct {
- char *arg;
- int len;
- } a[10];
-} uargs[MAX_USER_ARGS];
-
-static struct user_args *user_arg = uargs;
-
-static void
-arg_cleanup(ap)
- struct user_args *ap;
-{
- user_arg = ap;
-}
-
-/* Bind arguments $arg0, $arg1, ..., for a user defined command. */
-struct cleanup *
-setup_user_args(p)
- char *p;
-{
- register int i;
- struct cleanup *old_chain = make_cleanup(arg_cleanup, user_arg);
-
- if (++user_arg >= &uargs[MAX_USER_ARGS])
- error("user defined functions nested too deeply\n");
-
- bzero(user_arg, sizeof(*user_arg));
-
- i = 0;
- while (*p) {
- while (isspace(*p))
- ++p;
- user_arg->a[i].arg = p;
- while (*p && ! isspace(*p))
- ++p;
- user_arg->a[i].len = p - user_arg->a[i].arg;
- ++i;
- }
- return (old_chain);
-}
-
-static char *
-findarg(str)
- register char *str;
-{
- register char *cp = str;
- extern char *index();
-
- while (cp = index(cp, '$')) {
- if (strncmp(cp, "$arg", 4) == 0 && isdigit(cp[4]))
- return (cp);
- ++cp;
- }
- return (char *)0;
-}
-
-/* expand arguments from "line" into "new" */
-static void
-expand_args(line, new)
- register char *line, *new;
-{
- register char *cp = findarg(line);
-
- while (cp = findarg(line)) {
- int i, len;
-
- bcopy(line, new, cp - line);
- new += cp - line;
- i = cp[4] - '0';
- if (len = user_arg->a[i].len) {
- bcopy(user_arg->a[i].arg, new, len);
- new += len;
- }
- line = cp + 5;
- }
- strcpy(new, line);
-}
-
-/* expand any arguments in "line" then execute the result */
-static void
-expand_and_execute(line, from_tty)
- char *line;
- int from_tty;
-{
- void execute_command();
- char new[1024];
-
- if (! findarg(line)) {
- execute_command(line, from_tty);
- return;
- }
- expand_args(line, new);
- execute_command(new, from_tty);
-}
-
-char *
-read_one_command_line(prompt, from_tty)
- char *prompt;
-{
- register char *p, *p1;
-
- dont_repeat();
- p = command_line_input(prompt, from_tty);
-
- /* Remove trailing blanks. */
- p1 = p + strlen(p);
- while (--p1 > p && (*p1 == ' ' || *p1 == '\t'))
- ;
- *++p1 = 0;
- return (p);
-}
-
-static char cmd_prompt[] = " > ";
-
-int
-parse_control_structure(rootcmd, from_tty, level)
- struct command_line *rootcmd;
- int from_tty;
-{
- struct command_line *cmd = (struct command_line *)xmalloc(sizeof(*cmd));
- char *prompt;
-
- ++level;
- prompt = from_tty? &cmd_prompt[sizeof(cmd_prompt) - 1 - 2*level] :
- (char *)0;
- bzero(cmd, sizeof(*cmd));
- rootcmd->body = cmd;
- while (1) {
- char *p = read_one_command_line(prompt, from_tty);
-
- p = savestring(p, strlen(p));
- cmd->line = p;
- if (!strncmp(p, "while ", 6)) {
- cmd->type = CL_WHILE;
- if (parse_control_structure(cmd, from_tty, level))
- return (1);
- } else if (!strncmp(p, "if ", 3)) {
- cmd->type = CL_IF;
- if (parse_control_structure(cmd, from_tty, level)) {
- struct command_line *tmp;
- int stat;
-
- cmd->elsebody = cmd->body;
- stat = parse_control_structure(cmd, from_tty,
- level);
- tmp = cmd->elsebody;
- cmd->elsebody = cmd->body;
- cmd->body = tmp;
- if (stat)
- return (1);
- }
- } else if (!strcmp(p, "else")) {
- cmd->type = CL_END;
- return (1);
- } else if (!strcmp(p, "end")) {
- cmd->type = CL_END;
- return (0);
- } else if (!strcmp(p, "exitloop")) {
- cmd->type = CL_EXITLOOP;
- } else {
- cmd->type = CL_NORMAL;
- }
- cmd->next = (struct command_line *)xmalloc(sizeof(*cmd));
- cmd = cmd->next;
- bzero(cmd, sizeof(*cmd));
- }
- /* NOTREACHED */
-}
-
-int
-execute_control_structure(cmd)
- register struct command_line *cmd;
-{
- char expn[1024];
- struct expression *cond;
- int stat;
-
- while (cmd) {
- QUIT;
- switch (cmd->type) {
- case CL_END:
- return (0);
- case CL_NORMAL:
- expand_and_execute(cmd->line, 0);
- break;
- case CL_WHILE:
- expand_args(cmd->line + 6, expn);
- cond = parse_c_expression(expn);
- while (breakpoint_cond_eval(cond) == 0)
- if (execute_control_structure(cmd->body))
- break;
- free(cond);
- break;
- case CL_IF:
- expand_args(cmd->line + 3, expn);
- cond = parse_c_expression(expn);
- stat = breakpoint_cond_eval(cond);
- free(cond);
- if (stat == 0) {
- if (execute_control_structure(cmd->body))
- return (1);
- } else if (cmd->elsebody) {
- if (execute_control_structure(cmd->elsebody))
- return (1);
- }
- break;
- case CL_EXITLOOP:
- return (1);
- }
- cmd = cmd->next;
- }
- free_all_values();
-}
-
-execute_command_lines(cmd)
- struct command_line *cmd;
-{
- struct cleanup *old_chain = make_cleanup(source_cleanup, instream);
-
- /*
- * Set the instream to 0, indicating execution of a user-defined
- * function.
- */
- ++immediate_quit;
- instream = (FILE *) 0;
- (void)execute_control_structure(cmd);
- --immediate_quit;
- do_cleanups(old_chain);
-}
-
-/* do following command lines if expression true */
-if_command(p, from_tty)
- char *p;
- int from_tty;
-{
- struct cleanup *old_chain;
- struct command_line *cmd = (struct command_line *)xmalloc(sizeof(*cmd));
- char buf[128];
-
- sprintf(buf, "if %s", p);
-
- bzero(cmd, sizeof(*cmd));
- old_chain = make_cleanup(free_command_lines, cmd);
- cmd->type = CL_IF;
- cmd->line = savestring(buf, strlen(buf));
- /* XXX cmd->line? */
- if (parse_control_structure(cmd, from_tty, 0)) {
- struct command_line *tmp;
-
- cmd->elsebody = cmd->body;
- (void) parse_control_structure(cmd, from_tty, 0);
- tmp = cmd->elsebody;
- cmd->elsebody = cmd->body;
- cmd->body = tmp;
- }
- (void) execute_command_lines(cmd);
- do_cleanups(old_chain);
-}
-
-/* do following command lines while expression true */
-while_command(p, from_tty)
- char *p;
- int from_tty;
-{
- struct cleanup *old_chain;
- struct command_line *cmd = (struct command_line *)xmalloc(sizeof(*cmd));
- char buf[128];
-
- sprintf(buf, "while %s", p);
-
- bzero(cmd, sizeof(*cmd));
- old_chain = make_cleanup(free_command_lines, cmd);
- cmd->type = CL_WHILE;
- cmd->line = savestring(buf, strlen(buf));
- (void)parse_control_structure(cmd, from_tty, 0);
- (void)execute_command_lines(cmd);
- do_cleanups(old_chain);
-}
-
-/*
- * Execute the line P as a command.
- * Pass FROM_TTY as second argument to the defining function.
- */
-void
-execute_command (p, from_tty)
- char *p;
- int from_tty;
-{
- register struct cmd_list_element *c;
- register struct command_line *cmdlines;
-
- free_all_values();
- if (*p) {
- c = lookup_cmd(&p, cmdlist, "", 0, 1);
- if (c->function == 0)
- error("That is not a command, just a help topic.");
- else if (c->class == (int) class_user) {
- struct cleanup *old_chain = setup_user_args(p);
-
- cmdlines = (struct command_line *) c->function;
- if (cmdlines)
- (void)execute_command_lines(cmdlines);
-
- do_cleanups(old_chain);
- } else
- /* Pass null arg rather than an empty one. */
- (*c->function) (*p ? p : 0, from_tty);
- }
-}
-
-/*
- * Read lines from the input stream and accumulate them in a chain of struct
- * command_line's which is then returned.
- */
-struct command_line *
-read_command_lines(from_tty)
- int from_tty;
-{
- struct cleanup *old_chain;
- struct command_line *cmd = (struct command_line *)xmalloc(sizeof(*cmd));
- struct command_line *next;
-
- bzero(cmd, sizeof(*cmd));
- old_chain = make_cleanup(free_command_lines, cmd);
- cmd->type = CL_NOP;
- (void)parse_control_structure(cmd, from_tty, 0);
- dont_repeat();
- discard_cleanups(old_chain);
- next = cmd->body;
- free(cmd);
- return (next);
-}
-
-/* Free a chain of struct command_line's. */
-
-void
-free_command_lines(cmds)
- struct command_line *cmds;
-{
- struct command_line *next;
-
- while (cmds) {
- if (cmds->body)
- free(cmds->body);
- if (cmds->elsebody)
- free(cmds->elsebody);
- if (cmds->line)
- free(cmds->line);
- next = cmds->next;
- free(cmds);
- cmds = next;
- }
-}
-
-/* Add an element to the list of info subcommands. */
-
-void
-add_info (name, fun, doc)
- char *name;
- void (*fun) ();
- char *doc;
-{
- add_cmd (name, no_class, fun, doc, &infolist);
-}
-
-/* Add an alias to the list of info subcommands. */
-
-void
-add_info_alias (name, oldname, abbrev_flag)
- char *name;
- char *oldname;
- int abbrev_flag;
-{
- add_alias_cmd (name, oldname, 0, abbrev_flag, &infolist);
-}
-
-/* The "info" command is defined as a prefix, with allow_unknown = 0.
- Therefore, its own definition is called only for "info" with no args. */
-
-static void
-info_command ()
-{
- printf ("\"info\" must be followed by the name of an info command.\n");
- help_list (infolist, "info ", -1, stdout);
-}
-
-/* Add an element to the list of commands. */
-
-void
-add_com (name, class, fun, doc)
- char *name;
- int class;
- void (*fun) ();
- char *doc;
-{
- add_cmd (name, class, fun, doc, &cmdlist);
-}
-
-/* Add an alias or abbreviation command to the list of commands. */
-
-void
-add_com_alias (name, oldname, class, abbrev_flag)
- char *name;
- char *oldname;
- int class;
- int abbrev_flag;
-{
- add_alias_cmd (name, oldname, class, abbrev_flag, &cmdlist);
-}
-
-void
-error_no_arg (why)
- char *why;
-{
- error ("Argument required (%s).", why);
-}
-
-static void
-help_command (command, from_tty)
- char *command;
- int from_tty; /* Ignored */
-{
- help_cmd (command, stdout);
-}
-
-static void
-validate_comname (comname)
- char *comname;
-{
- register char *p;
-
- if (comname == 0)
- error_no_arg ("name of command to define");
-
- p = comname;
- while (*p)
- {
- if (!(*p >= 'A' && *p <= 'Z')
- && !(*p >= 'a' && *p <= 'z')
- && !(*p >= '0' && *p <= '9')
- && *p != '-')
- error ("Junk in argument list: \"%s\"", p);
- p++;
- }
-}
-
-static void
-define_command (comname, from_tty)
- char *comname;
- int from_tty;
-{
- register struct command_line *cmds;
- register struct cmd_list_element *c;
- char *tem = comname;
-
- validate_comname (comname);
-
- c = lookup_cmd (&tem, cmdlist, "", -1, 1);
- if (c)
- {
- if (c->class == (int) class_user || c->class == (int) class_alias)
- tem = "Redefine command \"%s\"? ";
- else
- tem = "Really redefine built-in command \"%s\"? ";
- if (!query (tem, comname))
- error ("Command \"%s\" not redefined.", comname);
- }
-
- if (from_tty)
- {
- printf ("Type commands for definition of \"%s\".\n\
-End with a line saying just \"end\".\n", comname);
- fflush (stdout);
- }
- comname = savestring (comname, strlen (comname));
-
- cmds = read_command_lines (from_tty);
-
- if (c && c->class == (int) class_user)
- free_command_lines (c->function);
-
- add_com (comname, class_user, cmds,
- (c && c->class == (int) class_user)
- ? c->doc : savestring ("User-defined.", 13));
-}
-
-static void
-document_command (comname, from_tty)
- char *comname;
- int from_tty;
-{
- register struct cmd_list_element *c;
- register char *p;
- register char *cp;
- register char *doc = 0;
- register int len;
- char *tmp = comname;
-
- validate_comname (comname);
- c = lookup_cmd (&tmp, cmdlist, "", 0, 1);
- if (c->class != (int) class_user)
- error ("Command \"%s\" is built-in.", comname);
-
- if (from_tty)
- printf ("Type documentation for \"%s\". \
-End with a line saying just \"end\".\n", comname);
-
- while (p = read_one_command_line(from_tty? "> " : 0, from_tty))
- {
- if (strcmp(p, "end") == 0)
- break;
- len = strlen(p) + 1;
- if (! doc)
- {
- doc = xmalloc(len);
- cp = doc;
- }
- else
- {
- int i = cp - doc;
- doc = xrealloc(doc, i + len);
- cp = doc + i;
- }
- strcpy(cp, p);
- cp += len;
- cp[-1] = '\n';
- }
- if (doc && cp > doc)
- cp[-1] = 0;
- if (c->doc)
- free (c->doc);
- c->doc = doc;
-}
-
-static void
-print_gdb_version ()
-{
- printf ("GDB %s, Copyright (C) 1989 Free Software Foundation, Inc.\n\
-There is ABSOLUTELY NO WARRANTY for GDB; type \"info warranty\" for details.\n\
-GDB is free software and you are welcome to distribute copies of it\n\
- under certain conditions; type \"info copying\" to see the conditions.\n",
- version);
-}
-
-static void
-version_info ()
-{
- immediate_quit++;
- print_gdb_version ();
- immediate_quit--;
-}
-
-
-/* Command to specify a prompt string instead of "(gdb) ". */
-
-void
-set_prompt_command (text)
- char *text;
-{
- char *p, *q;
- register int c;
- char *new;
-
- if (text == 0)
- error_no_arg ("string to which to set prompt");
-
- new = (char *) xmalloc (strlen (text) + 2);
- p = text; q = new;
- while (c = *p++)
- {
- if (c == '\\')
- {
- /* \ at end of argument is used after spaces
- so they won't be lost. */
- if (*p == 0)
- break;
- c = parse_escape (&p);
- if (c == 0)
- break; /* C loses */
- else if (c > 0)
- *q++ = c;
- }
- else
- *q++ = c;
- }
- if (*(p - 1) != '\\')
- *q++ = ' ';
- *q++ = '\0';
- new = (char *) xrealloc (new, q - new);
- free (prompt);
- prompt = new;
-}
-
-static void
-quit_command ()
-{
- extern void exec_file_command ();
- if (have_inferior_p ())
- {
- if (inhibit_confirm || query ("The program is running. Quit anyway? "))
- {
- /* Prevent any warning message from reopen_exec_file, in case
- we have a core file that's inconsistent with the exec file. */
- exec_file_command (0, 0);
- kill_inferior ();
- }
- else
- error ("Not confirmed.");
- }
- /* Save the history information if it is appropriate to do so. */
- if (write_history_p && history_filename)
- write_history (history_filename);
- exit (0);
-}
-
-int
-input_from_terminal_p ()
-{
- return instream == stdin;
-}
-
-static void
-pwd_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- if (arg) error ("The \"pwd\" command does not take an argument: %s", arg);
- getwd (dirbuf);
-
- if (strcmp (dirbuf, current_directory))
- printf ("Working directory %s\n (canonically %s).\n",
- current_directory, dirbuf);
- else
- printf ("Working directory %s.\n", current_directory);
-}
-
-static void
-cd_command (dir, from_tty)
- char *dir;
- int from_tty;
-{
- int len;
- int change;
-
- if (dir == 0)
- error_no_arg ("new working directory");
-
- dir = tilde_expand (dir);
- make_cleanup (free, dir);
-
- len = strlen (dir);
- dir = savestring (dir, len - (len > 1 && dir[len-1] == '/'));
- if (dir[0] == '/')
- current_directory = dir;
- else
- {
- current_directory = concat (current_directory, "/", dir);
- free (dir);
- }
-
- /* Now simplify any occurrences of `.' and `..' in the pathname. */
-
- change = 1;
- while (change)
- {
- char *p;
- change = 0;
-
- for (p = current_directory; *p;)
- {
- if (!strncmp (p, "/./", 2)
- && (p[2] == 0 || p[2] == '/'))
- strcpy (p, p + 2);
- else if (!strncmp (p, "/..", 3)
- && (p[3] == 0 || p[3] == '/')
- && p != current_directory)
- {
- char *q = p;
- while (q != current_directory && q[-1] != '/') q--;
- if (q != current_directory)
- {
- strcpy (q-1, p+3);
- p = q-1;
- }
- }
- else p++;
- }
- }
-
- if (chdir (dir) < 0)
- perror_with_name (dir);
-
- if (from_tty)
- pwd_command ((char *) 0, 1);
-}
-
-static void
-source_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- FILE *stream;
- struct cleanup *cleanups;
- char *file = arg;
- char *path;
-
- if (file == 0)
- /* Let source without arguments read .gdbinit. */
- file = ".gdbinit";
-
- file = tilde_expand (file);
- make_cleanup (free, file);
-
-#ifdef KERNELDEBUG
- if (path = getenv(kernel_debugging? "KGDBPATH" : "GDBPATH"))
-#else
- if (path = getenv("GDBPATH"))
-#endif
- {
- int fd = openp(path, 1, file, O_RDONLY, 0, 0);
-
- if (fd == -1)
- stream = 0;
- else
- stream = fdopen(fd, "r");
- }
- else
- stream = fopen (file, "r");
-
- if (stream == 0)
- perror_with_name (file);
-
- cleanups = make_cleanup (source_cleanup, instream);
-
- instream = stream;
-
- command_loop ();
-
- do_cleanups (cleanups);
-}
-
-static void
-echo_command (text)
- char *text;
-{
- char *p = text;
- register int c;
-
- if (text)
- while (c = *p++)
- {
- if (c == '\\')
- {
- /* \ at end of argument is used after spaces
- so they won't be lost. */
- if (*p == 0)
- return;
-
- c = parse_escape (&p);
- if (c >= 0)
- fputc (c, stdout);
- }
- else
- fputc (c, stdout);
- }
- fflush(stdout);
-}
-
-static void
-dump_me_command ()
-{
- if (query ("Should GDB dump core? "))
- {
- signal (SIGQUIT, SIG_DFL);
- kill (getpid (), SIGQUIT);
- }
-}
-
-int
-parse_binary_operation (caller, arg)
- char *caller, *arg;
-{
- int length;
-
- if (!arg || !*arg)
- return 1;
-
- length = strlen (arg);
-
- while (arg[length - 1] == ' ' || arg[length - 1] == '\t')
- length--;
-
- if (!strncmp (arg, "on", length)
- || !strncmp (arg, "1", length)
- || !strncmp (arg, "yes", length))
- return 1;
- else
- if (!strncmp (arg, "off", length)
- || !strncmp (arg, "0", length)
- || !strncmp (arg, "no", length))
- return 0;
- else
- error ("\"%s\" not given a binary valued argument.", caller);
-}
-
-/* Functions to manipulate command line editing control variables. */
-
-static void
-set_editing (arg, from_tty)
- char *arg;
- int from_tty;
-{
- command_editing_p = parse_binary_operation ("set command-editing", arg);
-}
-
-/* Number of commands to print in each call to editing_info. */
-#define Hist_print 10
-static void
-editing_info (arg, from_tty)
- char *arg;
- int from_tty;
-{
- /* Index for history commands. Relative to history_base. */
- int offset;
-
- /* Number of the history entry which we are planning to display next.
- Relative to history_base. */
- static int num = 0;
-
- /* The first command in the history which doesn't exist (i.e. one more
- than the number of the last command). Relative to history_base. */
- int hist_len;
-
- struct _hist_entry {
- char *line;
- char *data;
- } *history_get();
- extern int history_base;
-
- printf_filtered ("Interactive command editing is %s.\n",
- command_editing_p ? "on" : "off");
-
- printf_filtered ("History expansion of command input is %s.\n",
- history_expansion_p ? "on" : "off");
- printf_filtered ("Writing of a history record upon exit is %s.\n",
- write_history_p ? "enabled" : "disabled");
- printf_filtered ("The size of the history list (number of stored commands) is %d.\n",
- history_size);
- printf_filtered ("The name of the history record is \"%s\".\n\n",
- history_filename ? history_filename : "");
-
- /* Print out some of the commands from the command history. */
- /* First determine the length of the history list. */
- hist_len = history_size;
- for (offset = 0; offset < history_size; offset++)
- {
- if (!history_get (history_base + offset))
- {
- hist_len = offset;
- break;
- }
- }
-
- if (arg)
- {
- if (arg[0] == '+' && arg[1] == '\0')
- /* "info editing +" should print from the stored position. */
- ;
- else
- /* "info editing <exp>" should print around command number <exp>. */
- num = (parse_and_eval_address (arg) - history_base) - Hist_print / 2;
- }
- /* "info editing" means print the last Hist_print commands. */
- else
- {
- num = hist_len - Hist_print;
- }
-
- if (num < 0)
- num = 0;
-
- /* If there are at least Hist_print commands, we want to display the last
- Hist_print rather than, say, the last 6. */
- if (hist_len - num < Hist_print)
- {
- num = hist_len - Hist_print;
- if (num < 0)
- num = 0;
- }
-
- if (num == hist_len - Hist_print)
- printf_filtered ("The list of the last %d commands is:\n\n", Hist_print);
- else
- printf_filtered ("Some of the stored commands are:\n\n");
-
- for (offset = num; offset < num + Hist_print && offset < hist_len; offset++)
- {
- printf_filtered ("%5d %s\n", history_base + offset,
- (history_get (history_base + offset))->line);
- }
-
- /* The next command we want to display is the next one that we haven't
- displayed yet. */
- num += Hist_print;
-
- /* If the user repeats this command with return, it should do what
- "info editing +" does. This is unnecessary if arg is null,
- because "info editing +" is not useful after "info editing". */
- if (from_tty && arg)
- {
- arg[0] = '+';
- arg[1] = '\0';
- }
-}
-
-static void
-set_history_expansion (arg, from_tty)
- char *arg;
- int from_tty;
-{
- history_expansion_p = parse_binary_operation ("set history expansion", arg);
-}
-
-static void
-set_history_write (arg, from_tty)
- char *arg;
- int from_tty;
-{
- write_history_p = parse_binary_operation ("set history write", arg);
-}
-
-static void
-set_history (arg, from_tty)
- char *arg;
- int from_tty;
-{
- printf ("\"set history\" must be followed by the name of a history subcommand.\n");
- help_list (sethistlist, "set history ", -1, stdout);
-}
-
-static void
-set_history_size (arg, from_tty)
- char *arg;
- int from_tty;
-{
- if (!*arg)
- error_no_arg ("set history size");
-
- history_size = atoi (arg);
-}
-
-static void
-set_history_filename (arg, from_tty)
- char *arg;
- int from_tty;
-{
- int i;
-
- if (!arg)
- error_no_arg ("history file name");
-
- arg = tilde_expand (arg);
- make_cleanup (free, arg);
-
- i = strlen (arg) - 1;
-
- free (history_filename);
-
- while (i > 0 && (arg[i] == ' ' || arg[i] == '\t'))
- i--;
- ++i;
-
- if (!*arg)
- history_filename = (char *) 0;
- else
- history_filename = savestring (arg, i + 1);
- history_filename[i] = '\0';
-}
-
-int info_verbose;
-
-static void
-set_verbose_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- info_verbose = parse_binary_operation ("set verbose", arg);
-}
-
-static void
-verbose_info (arg, from_tty)
- char *arg;
- int from_tty;
-{
- if (arg)
- error ("\"info verbose\" does not take any arguments.\n");
-
- printf ("Verbose printing of information is %s.\n",
- info_verbose ? "on" : "off");
-}
-
-static void
-float_handler ()
-{
- error ("Invalid floating value encountered or computed.");
-}
-
-
-static void
-initialize_cmd_lists ()
-{
- cmdlist = (struct cmd_list_element *) 0;
- infolist = (struct cmd_list_element *) 0;
- enablelist = (struct cmd_list_element *) 0;
- disablelist = (struct cmd_list_element *) 0;
- deletelist = (struct cmd_list_element *) 0;
- enablebreaklist = (struct cmd_list_element *) 0;
- setlist = (struct cmd_list_element *) 0;
- sethistlist = (struct cmd_list_element *) 0;
- unsethistlist = (struct cmd_list_element *) 0;
-}
-
-static void
-initialize_main ()
-{
- char *tmpenv;
- /* Command line editing externals. */
- extern int (*rl_completion_entry_function)();
- extern char *rl_completer_word_break_characters;
- extern char *rl_readline_name;
-
- /* Set default verbose mode on. */
- info_verbose = 1;
-
-#ifdef KERNELDEBUG
- if (kernel_debugging)
- prompt = savestring ("(kgdb) ", 7);
- else
-#endif
- prompt = savestring ("(gdb) ", 6);
-
- /* Set the important stuff up for command editing. */
- command_editing_p = 1;
- history_expansion_p = 0;
- write_history_p = 0;
-
- if (tmpenv = getenv ("HISTSIZE"))
- history_size = atoi (tmpenv);
- else
- history_size = 256;
-
- stifle_history (history_size);
-
- if (tmpenv = getenv ("GDBHISTFILE"))
- history_filename = savestring (tmpenv, strlen(tmpenv));
- else
- /* We include the current directory so that if the user changes
- directories the file written will be the same as the one
- that was read. */
- history_filename = concat (current_directory, "/.gdb_history", "");
-
- read_history (history_filename);
-
- /* Setup important stuff for command line editing. */
- rl_completion_entry_function = (int (*)()) symbol_completion_function;
- rl_completer_word_break_characters = gdb_completer_word_break_characters;
- rl_readline_name = "gdb";
-
- /* Define the classes of commands.
- They will appear in the help list in the reverse of this order. */
-
- add_cmd ("obscure", class_obscure, 0, "Obscure features.", &cmdlist);
- add_cmd ("alias", class_alias, 0, "Aliases of other commands.", &cmdlist);
- add_cmd ("user", class_user, 0, "User-defined commands.\n\
-The commands in this class are those defined by the user.\n\
-Use the \"define\" command to define a command.", &cmdlist);
- add_cmd ("support", class_support, 0, "Support facilities.", &cmdlist);
- add_cmd ("status", class_info, 0, "Status inquiries.", &cmdlist);
- add_cmd ("files", class_files, 0, "Specifying and examining files.", &cmdlist);
- add_cmd ("breakpoints", class_breakpoint, 0, "Making program stop at certain points.", &cmdlist);
- add_cmd ("data", class_vars, 0, "Examining data.", &cmdlist);
- add_cmd ("stack", class_stack, 0, "Examining the stack.\n\
-The stack is made up of stack frames. Gdb assigns numbers to stack frames\n\
-counting from zero for the innermost (currently executing) frame.\n\n\
-At any time gdb identifies one frame as the \"selected\" frame.\n\
-Variable lookups are done with respect to the selected frame.\n\
-When the program being debugged stops, gdb selects the innermost frame.\n\
-The commands below can be used to select other frames by number or address.",
- &cmdlist);
- add_cmd ("running", class_run, 0, "Running the program.", &cmdlist);
-
- add_com ("pwd", class_files, pwd_command,
- "Print working directory. This is used for your program as well.");
- add_com ("cd", class_files, cd_command,
- "Set working directory to DIR for debugger and program being debugged.\n\
-The change does not take effect for the program being debugged\n\
-until the next time it is started.");
-
- add_cmd ("prompt", class_support, set_prompt_command,
- "Change gdb's prompt from the default of \"(gdb)\"",
- &setlist);
- add_com ("echo", class_support, echo_command,
- "Print a constant string. Give string as argument.\n\
-C escape sequences may be used in the argument.\n\
-No newline is added at the end of the argument;\n\
-use \"\\n\" if you want a newline to be printed.\n\
-Since leading and trailing whitespace are ignored in command arguments,\n\
-if you want to print some you must use \"\\\" before leading whitespace\n\
-to be printed or after trailing whitespace.");
- add_com ("document", class_support, document_command,
- "Document a user-defined command.\n\
-Give command name as argument. Give documentation on following lines.\n\
-End with a line of just \"end\".");
- add_com ("define", class_support, define_command,
- "Define a new command name. Command name is argument.\n\
-Definition appears on following lines, one command per line.\n\
-End with a line of just \"end\".\n\
-Use the \"document\" command to give documentation for the new command.\n\
-Commands defined in this way do not take arguments.");
-
- add_com ("source", class_support, source_command,
- "Read commands from a file named FILE.\n\
-Note that the file \".gdbinit\" is read automatically in this way\n\
-when gdb is started.");
- add_com ("quit", class_support, quit_command, "Exit gdb.");
- add_com ("help", class_support, help_command, "Print list of commands.");
- add_com_alias ("q", "quit", class_support, 1);
- add_com_alias ("h", "help", class_support, 1);
- add_com ("while", class_support, while_command,
- "execute following commands while condition is true.\n\
-Expression for condition follows \"while\" keyword.");
- add_com ("if", class_support, if_command,
- "execute following commands if condition is true.\n\
-Expression for condition follows \"if\" keyword.");
- add_cmd ("verbose", class_support, set_verbose_command,
- "Change the number of informational messages gdb prints.",
- &setlist);
- add_info ("verbose", verbose_info,
- "Status of gdb's verbose printing option.\n");
-
- add_com ("dump-me", class_obscure, dump_me_command,
- "Get fatal error; make debugger dump its core.");
-
- add_cmd ("editing", class_support, set_editing,
- "Enable or disable command line editing.\n\
-Use \"on\" to enable to enable the editing, and \"off\" to disable it.\n\
-Without an argument, command line editing is enabled.", &setlist);
-
- add_prefix_cmd ("history", class_support, set_history,
- "Generic command for setting command history parameters.",
- &sethistlist, "set history ", 0, &setlist);
-
- add_cmd ("expansion", no_class, set_history_expansion,
- "Enable or disable history expansion on command input.\n\
-Without an argument, history expansion is enabled.", &sethistlist);
-
- add_cmd ("write", no_class, set_history_write,
- "Enable or disable saving of the history record on exit.\n\
-Use \"on\" to enable to enable the saving, and \"off\" to disable it.\n\
-Without an argument, saving is enabled.", &sethistlist);
-
- add_cmd ("size", no_class, set_history_size,
- "Set the size of the command history, \n\
-ie. the number of previous commands to keep a record of.", &sethistlist);
-
- add_cmd ("filename", no_class, set_history_filename,
- "Set the filename in which to record the command history\n\
- (the list of previous commands of which a record is kept).", &sethistlist);
-
- add_prefix_cmd ("info", class_info, info_command,
- "Generic command for printing status.",
- &infolist, "info ", 0, &cmdlist);
- add_com_alias ("i", "info", class_info, 1);
-
- add_info ("editing", editing_info, "Status of command editor.");
-
- add_info ("version", version_info, "Report what version of GDB this is.");
-}
diff --git a/gnu/usr.bin/gdb/ngdb.i386/Makefile b/gnu/usr.bin/gdb/ngdb.i386/Makefile
deleted file mode 100644
index 3bf4c6c..0000000
--- a/gnu/usr.bin/gdb/ngdb.i386/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-# %W% (Berkeley) %G%
-
-.include "../config/Makefile.$(MACHINE)"
-
-PROG= ngdb
-SRCS= i386bsd-dep.c blockframe.c
-GDBOBJS+= i386-pinsn.o \
- breakpoint.o command.o copying.o core.o \
- cplus-dem.o dbxread.o environ.o eval.o expprint.o \
- expread.o findvar.o infcmd.o inflow.o infrun.o \
- main.o obstack.o printcmd.o regex.o remote.o \
- remote-sl.o source.o stack.o symmisc.o symtab.o \
- utils.o valarith.o valops.o valprint.o values.o \
- version.o \
- funmap.o history.o keymaps.o readline.o \
- init.o
-CFLAGS+= -g -I$(.CURDIR) -I.. -I$(.CURDIR)/.. -I$(.CURDIR)/../config \
- -I/usr/src/sys.newvm \
- -DNEWVM -DHAVE_VPRINTF -DVI_MODE -DKERNELDEBUG
-# CC= /usr/old/bin/cc
-# CC= cc -traditional
-LDADD+= $(GDBOBJS:S/^/..\//g) -ltermcap
-NOMAN= noman
-
-.PATH: $(.CURDIR)/../config $(.CURDIR)/..
-
-.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/gdb/obstack.c b/gnu/usr.bin/gdb/obstack.c
deleted file mode 100644
index 6f4b282..0000000
--- a/gnu/usr.bin/gdb/obstack.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/* obstack.c - subroutines used implicitly by object stack macros
- 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, 675 Mass Ave, Cambridge, MA 02139, USA.
-
-
-In other words, you are welcome to use, share and improve this program.
-You are forbidden to forbid anyone else to use, share and improve
-what you give them. Help stamp out software-hoarding! */
-
-
-#include "obstack.h"
-
-#ifdef __STDC__
-#define POINTER void *
-#else
-#define POINTER char *
-#endif
-
-/* Determine default alignment. */
-struct fooalign {char x; double d;};
-#define DEFAULT_ALIGNMENT ((char *)&((struct fooalign *) 0)->d - (char *)0)
-/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT.
- But in fact it might be less smart and round addresses to as much as
- DEFAULT_ROUNDING. So we prepare for it to do that. */
-union fooround {long x; double d;};
-#define DEFAULT_ROUNDING (sizeof (union fooround))
-
-/* When we copy a long block of data, this is the unit to do it with.
- On some machines, copying successive ints does not work;
- in such a case, redefine COPYING_UNIT to `long' (if that works)
- or `char' as a last resort. */
-#ifndef COPYING_UNIT
-#define COPYING_UNIT int
-#endif
-
-/* The non-GNU-C macros copy the obstack into this global variable
- to avoid multiple evaluation. */
-
-struct obstack *_obstack;
-
-/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default).
- Objects start on multiples of ALIGNMENT (0 means use default).
- CHUNKFUN is the function to use to allocate chunks,
- and FREEFUN the function to free them. */
-
-void
-_obstack_begin (h, size, alignment, chunkfun, freefun)
- struct obstack *h;
- int size;
- int alignment;
- POINTER (*chunkfun) ();
- void (*freefun) ();
-{
- register struct _obstack_chunk* chunk; /* points to new chunk */
-
- if (alignment == 0)
- alignment = DEFAULT_ALIGNMENT;
- if (size == 0)
- /* Default size is what GNU malloc can fit in a 4096-byte block.
- Pick a number small enough that when rounded up to DEFAULT_ROUNDING
- it is still smaller than 4096 - 4. */
- {
- int extra = 4;
- if (extra < DEFAULT_ROUNDING)
- extra = DEFAULT_ROUNDING;
- size = 4096 - extra;
- }
-
- h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
- h->freefun = freefun;
- h->chunk_size = size;
- h->alignment_mask = alignment - 1;
-
- chunk = h->chunk = (*h->chunkfun) (h->chunk_size);
- h->next_free = h->object_base = chunk->contents;
- h->chunk_limit = chunk->limit
- = (char *) chunk + h->chunk_size;
- chunk->prev = 0;
-}
-
-/* Allocate a new current chunk for the obstack *H
- on the assumption that LENGTH bytes need to be added
- to the current object, or a new object of length LENGTH allocated.
- Copies any partial object from the end of the old chunk
- to the beginning of the new one. */
-
-void
-_obstack_newchunk (h, length)
- struct obstack *h;
- int length;
-{
- register struct _obstack_chunk* old_chunk = h->chunk;
- register struct _obstack_chunk* new_chunk;
- register long new_size;
- register int obj_size = h->next_free - h->object_base;
- register int i;
-
- /* Compute size for new chunk. */
- new_size = (obj_size + length) << 1;
- if (new_size < h->chunk_size)
- new_size = h->chunk_size;
-
- /* Allocate and initialize the new chunk. */
- new_chunk = h->chunk = (*h->chunkfun) (new_size);
- new_chunk->prev = old_chunk;
- new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size;
-
- /* Move the existing object to the new chunk.
- Word at a time is fast and is safe because these
- structures are aligned at least that much. */
- for (i = (obj_size + sizeof (COPYING_UNIT) - 1) / sizeof (COPYING_UNIT) - 1;
- i >= 0; i--)
- ((COPYING_UNIT *)new_chunk->contents)[i]
- = ((COPYING_UNIT *)h->object_base)[i];
-
- h->object_base = new_chunk->contents;
- h->next_free = h->object_base + obj_size;
-}
-
-/* Return nonzero if object OBJ has been allocated from obstack H.
- This is here for debugging.
- If you use it in a program, you are probably losing. */
-
-int
-_obstack_allocated_p (h, obj)
- struct obstack *h;
- POINTER obj;
-{
- register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */
- register struct _obstack_chunk* plp; /* point to previous chunk if any */
-
- lp = (h)->chunk;
- while (lp != 0 && ((POINTER)lp > obj || (POINTER)(lp)->limit < obj))
- {
- plp = lp -> prev;
- lp = plp;
- }
- return lp != 0;
-}
-
-/* Free objects in obstack H, including OBJ and everything allocate
- more recently than OBJ. If OBJ is zero, free everything in H. */
-
-void
-#ifdef __STDC__
-#undef obstack_free
-obstack_free (struct obstack *h, POINTER obj)
-#else
-_obstack_free (h, obj)
- struct obstack *h;
- POINTER obj;
-#endif
-{
- register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */
- register struct _obstack_chunk* plp; /* point to previous chunk if any */
-
- lp = (h)->chunk;
- while (lp != 0 && ((POINTER)lp > obj || (POINTER)(lp)->limit < obj))
- {
- plp = lp -> prev;
- (*h->freefun) (lp);
- lp = plp;
- }
- if (lp)
- {
- (h)->object_base = (h)->next_free = (char *)(obj);
- (h)->chunk_limit = lp->limit;
- (h)->chunk = lp;
- }
- else if (obj != 0)
- /* obj is not in any of the chunks! */
- abort ();
-}
-
-/* Let same .o link with output of gcc and other compilers. */
-
-#ifdef __STDC__
-void
-_obstack_free (h, obj)
- struct obstack *h;
- POINTER obj;
-{
- obstack_free (h, obj);
-}
-#endif
-
-#if 0
-/* These are now turned off because the applications do not use it
- and it uses bcopy via obstack_grow, which causes trouble on sysV. */
-
-/* Now define the functional versions of the obstack macros.
- Define them to simply use the corresponding macros to do the job. */
-
-#ifdef __STDC__
-/* These function definitions do not work with non-ANSI preprocessors;
- they won't pass through the macro names in parentheses. */
-
-/* The function names appear in parentheses in order to prevent
- the macro-definitions of the names from being expanded there. */
-
-POINTER (obstack_base) (obstack)
- struct obstack *obstack;
-{
- return obstack_base (obstack);
-}
-
-POINTER (obstack_next_free) (obstack)
- struct obstack *obstack;
-{
- return obstack_next_free (obstack);
-}
-
-int (obstack_object_size) (obstack)
- struct obstack *obstack;
-{
- return obstack_object_size (obstack);
-}
-
-int (obstack_room) (obstack)
- struct obstack *obstack;
-{
- return obstack_room (obstack);
-}
-
-void (obstack_grow) (obstack, pointer, length)
- struct obstack *obstack;
- POINTER pointer;
- int length;
-{
- obstack_grow (obstack, pointer, length);
-}
-
-void (obstack_grow0) (obstack, pointer, length)
- struct obstack *obstack;
- POINTER pointer;
- int length;
-{
- obstack_grow0 (obstack, pointer, length);
-}
-
-void (obstack_1grow) (obstack, character)
- struct obstack *obstack;
- int character;
-{
- obstack_1grow (obstack, character);
-}
-
-void (obstack_blank) (obstack, length)
- struct obstack *obstack;
- int length;
-{
- obstack_blank (obstack, length);
-}
-
-void (obstack_1grow_fast) (obstack, character)
- struct obstack *obstack;
- int character;
-{
- obstack_1grow_fast (obstack, character);
-}
-
-void (obstack_blank_fast) (obstack, length)
- struct obstack *obstack;
- int length;
-{
- obstack_blank_fast (obstack, length);
-}
-
-POINTER (obstack_finish) (obstack)
- struct obstack *obstack;
-{
- return obstack_finish (obstack);
-}
-
-POINTER (obstack_alloc) (obstack, length)
- struct obstack *obstack;
- int length;
-{
- return obstack_alloc (obstack, length);
-}
-
-POINTER (obstack_copy) (obstack, pointer, length)
- struct obstack *obstack;
- POINTER pointer;
- int length;
-{
- return obstack_copy (obstack, pointer, length);
-}
-
-POINTER (obstack_copy0) (obstack, pointer, length)
- struct obstack *obstack;
- POINTER pointer;
- int length;
-{
- return obstack_copy0 (obstack, pointer, length);
-}
-
-#endif /* __STDC__ */
-
-#endif /* 0 */
diff --git a/gnu/usr.bin/gdb/obstack.h b/gnu/usr.bin/gdb/obstack.h
deleted file mode 100644
index 27c017e..0000000
--- a/gnu/usr.bin/gdb/obstack.h
+++ /dev/null
@@ -1,372 +0,0 @@
-/* obstack.h - object stack macros
- 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, 675 Mass Ave, Cambridge, MA 02139, USA.
-
-
-In other words, you are welcome to use, share and improve this program.
-You are forbidden to forbid anyone else to use, share and improve
-what you give them. Help stamp out software-hoarding! */
-
-
-/* Summary:
-
-All the apparent functions defined here are macros. The idea
-is that you would use these pre-tested macros to solve a
-very specific set of problems, and they would run fast.
-Caution: no side-effects in arguments please!! They may be
-evaluated MANY times!!
-
-These macros operate a stack of objects. Each object starts life
-small, and may grow to maturity. (Consider building a word syllable
-by syllable.) An object can move while it is growing. Once it has
-been "finished" it never changes address again. So the "top of the
-stack" is typically an immature growing object, while the rest of the
-stack is of mature, fixed size and fixed address objects.
-
-These routines grab large chunks of memory, using a function you
-supply, called `obstack_chunk_alloc'. On occasion, they free chunks,
-by calling `obstack_chunk_free'. You must define them and declare
-them before using any obstack macros.
-
-Each independent stack is represented by a `struct obstack'.
-Each of the obstack macros expects a pointer to such a structure
-as the first argument.
-
-One motivation for this package is the problem of growing char strings
-in symbol tables. Unless you are "facist pig with a read-only mind"
-[Gosper's immortal quote from HAKMEM item 154, out of context] you
-would not like to put any arbitrary upper limit on the length of your
-symbols.
-
-In practice this often means you will build many short symbols and a
-few long symbols. At the time you are reading a symbol you don't know
-how long it is. One traditional method is to read a symbol into a
-buffer, realloc()ating the buffer every time you try to read a symbol
-that is longer than the buffer. This is beaut, but you still will
-want to copy the symbol from the buffer to a more permanent
-symbol-table entry say about half the time.
-
-With obstacks, you can work differently. Use one obstack for all symbol
-names. As you read a symbol, grow the name in the obstack gradually.
-When the name is complete, finalize it. Then, if the symbol exists already,
-free the newly read name.
-
-The way we do this is to take a large chunk, allocating memory from
-low addresses. When you want to build a aymbol in the chunk you just
-add chars above the current "high water mark" in the chunk. When you
-have finished adding chars, because you got to the end of the symbol,
-you know how long the chars are, and you can create a new object.
-Mostly the chars will not burst over the highest address of the chunk,
-because you would typically expect a chunk to be (say) 100 times as
-long as an average object.
-
-In case that isn't clear, when we have enough chars to make up
-the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed)
-so we just point to it where it lies. No moving of chars is
-needed and this is the second win: potentially long strings need
-never be explicitly shuffled. Once an object is formed, it does not
-change its address during its lifetime.
-
-When the chars burst over a chunk boundary, we allocate a larger
-chunk, and then copy the partly formed object from the end of the old
-chunk to the beggining of the new larger chunk. We then carry on
-accreting characters to the end of the object as we normaly would.
-
-A special macro is provided to add a single char at a time to a
-growing object. This allows the use of register variables, which
-break the ordinary 'growth' macro.
-
-Summary:
- We allocate large chunks.
- We carve out one object at a time from the current chunk.
- Once carved, an object never moves.
- We are free to append data of any size to the currently
- growing object.
- Exactly one object is growing in an obstack at any one time.
- You can run one obstack per control block.
- You may have as many control blocks as you dare.
- Because of the way we do it, you can `unwind' a obstack
- back to a previous state. (You may remove objects much
- as you would with a stack.)
-*/
-
-
-/* Don't do the contents of this file more than once. */
-
-#ifndef __OBSTACKS__
-#define __OBSTACKS__
-
-/* We use subtraction of (char *)0 instead of casting to int
- because on word-addressable machines a simple cast to int
- may ignore the byte-within-word field of the pointer. */
-
-#ifndef __PTR_TO_INT
-#define __PTR_TO_INT(P) ((P) - (char *)0)
-#endif
-
-#ifndef __INT_TO_PTR
-#define __INT_TO_PTR(P) ((P) + (char *)0)
-#endif
-
-struct _obstack_chunk /* Lives at front of each chunk. */
-{
- char *limit; /* 1 past end of this chunk */
- struct _obstack_chunk *prev; /* address of prior chunk or NULL */
- char contents[4]; /* objects begin here */
-};
-
-struct obstack /* control current object in current chunk */
-{
- long chunk_size; /* preferred size to allocate chunks in */
- struct _obstack_chunk* chunk; /* address of current struct obstack_chunk */
- char *object_base; /* address of object we are building */
- char *next_free; /* where to add next char to current object */
- char *chunk_limit; /* address of char after current chunk */
- int temp; /* Temporary for some macros. */
- int alignment_mask; /* Mask of alignment for each object. */
- struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */
- void (*freefun) (); /* User's function to free a chunk. */
-};
-
-#ifdef __STDC__
-
-/* Do the function-declarations after the structs
- but before defining the macros. */
-
-void obstack_init (struct obstack *obstack);
-
-void * obstack_alloc (struct obstack *obstack, int size);
-
-void * obstack_copy (struct obstack *obstack, void *address, int size);
-void * obstack_copy0 (struct obstack *obstack, void *address, int size);
-
-void obstack_free (struct obstack *obstack, void *block);
-
-void obstack_blank (struct obstack *obstack, int size);
-
-void obstack_grow (struct obstack *obstack, void *data, int size);
-void obstack_grow0 (struct obstack *obstack, void *data, int size);
-
-void obstack_1grow (struct obstack *obstack, int data_char);
-
-void * obstack_finish (struct obstack *obstack);
-
-int obstack_object_size (struct obstack *obstack);
-
-int obstack_room (struct obstack *obstack);
-void obstack_1grow_fast (struct obstack *obstack, int data_char);
-void obstack_blank_fast (struct obstack *obstack, int size);
-
-void * obstack_base (struct obstack *obstack);
-void * obstack_next_free (struct obstack *obstack);
-int obstack_alignment_mask (struct obstack *obstack);
-int obstack_chunk_size (struct obstack *obstack);
-
-#endif /* __STDC__ */
-
-/* Non-ANSI C cannot really support alternative functions for these macros,
- so we do not declare them. */
-
-/* Pointer to beginning of object being allocated or to be allocated next.
- Note that this might not be the final address of the object
- because a new chunk might be needed to hold the final size. */
-
-#define obstack_base(h) ((h)->object_base)
-
-/* Size for allocating ordinary chunks. */
-
-#define obstack_chunk_size(h) ((h)->chunk_size)
-
-/* Pointer to next byte not yet allocated in current chunk. */
-
-#define obstack_next_free(h) ((h)->next_free)
-
-/* Mask specifying low bits that should be clear in address of an object. */
-
-#define obstack_alignment_mask(h) ((h)->alignment_mask)
-
-#define obstack_init(h) \
- _obstack_begin ((h), 0, 0, obstack_chunk_alloc, obstack_chunk_free)
-
-#define obstack_begin(h, size) \
- _obstack_begin ((h), (size), 0, obstack_chunk_alloc, obstack_chunk_free)
-
-#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar)
-
-#define obstack_blank_fast(h,n) ((h)->next_free += (n))
-
-#if defined (__GNUC__) && defined (__STDC__)
-
-/* For GNU C, if not -traditional,
- we can define these macros to compute all args only once
- without using a global variable.
- Also, we can avoid using the `temp' slot, to make faster code. */
-
-#define obstack_object_size(OBSTACK) \
- ({ struct obstack *__o = (OBSTACK); \
- (unsigned) (__o->next_free - __o->object_base); })
-
-#define obstack_room(OBSTACK) \
- ({ struct obstack *__o = (OBSTACK); \
- (unsigned) (__o->chunk_limit - __o->next_free); })
-
-#define obstack_grow(OBSTACK,where,length) \
-({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
- ((__o->next_free + __len > __o->chunk_limit) \
- ? _obstack_newchunk (__o, __len) : 0); \
- bcopy (where, __o->next_free, __len); \
- __o->next_free += __len; \
- (void) 0; })
-
-#define obstack_grow0(OBSTACK,where,length) \
-({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
- ((__o->next_free + __len + 1 > __o->chunk_limit) \
- ? _obstack_newchunk (__o, __len + 1) : 0), \
- bcopy (where, __o->next_free, __len), \
- __o->next_free += __len, \
- *(__o->next_free)++ = 0; \
- (void) 0; })
-
-#define obstack_1grow(OBSTACK,datum) \
-({ struct obstack *__o = (OBSTACK); \
- ((__o->next_free + 1 > __o->chunk_limit) \
- ? _obstack_newchunk (__o, 1) : 0), \
- *(__o->next_free)++ = (datum); \
- (void) 0; })
-
-#define obstack_blank(OBSTACK,length) \
-({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
- ((__o->next_free + __len > __o->chunk_limit) \
- ? _obstack_newchunk (__o, __len) : 0); \
- __o->next_free += __len; \
- (void) 0; })
-
-#define obstack_alloc(OBSTACK,length) \
-({ struct obstack *__h = (OBSTACK); \
- obstack_blank (__h, (length)); \
- obstack_finish (__h); })
-
-#define obstack_copy(OBSTACK,where,length) \
-({ struct obstack *__h = (OBSTACK); \
- obstack_grow (__h, (where), (length)); \
- obstack_finish (__h); })
-
-#define obstack_copy0(OBSTACK,where,length) \
-({ struct obstack *__h = (OBSTACK); \
- obstack_grow0 (__h, (where), (length)); \
- obstack_finish (__h); })
-
-#define obstack_finish(OBSTACK) \
-({ struct obstack *__o = (OBSTACK); \
- void *value = (void *) __o->object_base; \
- __o->next_free \
- = __INT_TO_PTR ((__PTR_TO_INT (__o->next_free)+__o->alignment_mask)\
- & ~ (__o->alignment_mask)); \
- ((__o->next_free - (char *)__o->chunk \
- > __o->chunk_limit - (char *)__o->chunk) \
- ? (__o->next_free = __o->chunk_limit) : 0); \
- __o->object_base = __o->next_free; \
- value; })
-
-#define obstack_free(OBSTACK, OBJ) \
-({ struct obstack *__o = (OBSTACK); \
- void *__obj = (OBJ); \
- if (__obj >= (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \
- __o->next_free = __o->object_base = __obj; \
- else (obstack_free) (__o, __obj); })
-
-#else /* not __GNUC__ or not __STDC__ */
-
-/* The non-GNU macros copy the obstack-pointer into this global variable
- to avoid multiple evaluation. */
-
-extern struct obstack *_obstack;
-
-#define obstack_object_size(h) \
- (unsigned) (_obstack = (h), (h)->next_free - (h)->object_base)
-
-#define obstack_room(h) \
- (unsigned) (_obstack = (h), (h)->chunk_limit - (h)->next_free)
-
-#define obstack_grow(h,where,length) \
-( (h)->temp = (length), \
- (((h)->next_free + (h)->temp > (h)->chunk_limit) \
- ? _obstack_newchunk ((h), (h)->temp) : 0), \
- bcopy (where, (h)->next_free, (h)->temp), \
- (h)->next_free += (h)->temp)
-
-#define obstack_grow0(h,where,length) \
-( (h)->temp = (length), \
- (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \
- ? _obstack_newchunk ((h), (h)->temp + 1) : 0), \
- bcopy (where, (h)->next_free, (h)->temp), \
- (h)->next_free += (h)->temp, \
- *((h)->next_free)++ = 0)
-
-#define obstack_1grow(h,datum) \
-( (((h)->next_free + 1 > (h)->chunk_limit) \
- ? _obstack_newchunk ((h), 1) : 0), \
- *((h)->next_free)++ = (datum))
-
-#define obstack_blank(h,length) \
-( (h)->temp = (length), \
- (((h)->next_free + (h)->temp > (h)->chunk_limit) \
- ? _obstack_newchunk ((h), (h)->temp) : 0), \
- (h)->next_free += (h)->temp)
-
-#define obstack_alloc(h,length) \
- (obstack_blank ((h), (length)), obstack_finish ((h)))
-
-#define obstack_copy(h,where,length) \
- (obstack_grow ((h), (where), (length)), obstack_finish ((h)))
-
-#define obstack_copy0(h,where,length) \
- (obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
-
-#define obstack_finish(h) \
-( (h)->temp = __PTR_TO_INT ((h)->object_base), \
- (h)->next_free \
- = __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \
- & ~ ((h)->alignment_mask)), \
- (((h)->next_free - (char *)(h)->chunk \
- > (h)->chunk_limit - (char *)(h)->chunk) \
- ? ((h)->next_free = (h)->chunk_limit) : 0), \
- (h)->object_base = (h)->next_free, \
- __INT_TO_PTR ((h)->temp))
-
-#ifdef __STDC__
-#define obstack_free(h,obj) \
-( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \
- (((h)->temp >= 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
- ? (int) ((h)->next_free = (h)->object_base \
- = (h)->temp + (char *) (h)->chunk) \
- : ((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0)))
-#else
-#define obstack_free(h,obj) \
-( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \
- (((h)->temp >= 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
- ? (int) ((h)->next_free = (h)->object_base \
- = (h)->temp + (char *) (h)->chunk) \
- : (int) _obstack_free ((h), (h)->temp + (char *) (h)->chunk)))
-#endif
-
-#endif /* not __GNUC__ or not __STDC__ */
-
-#endif /* not __OBSTACKS__ */
-
diff --git a/gnu/usr.bin/gdb/printcmd.c b/gnu/usr.bin/gdb/printcmd.c
deleted file mode 100644
index 6edd7bd..0000000
--- a/gnu/usr.bin/gdb/printcmd.c
+++ /dev/null
@@ -1,1867 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)printcmd.c 6.5 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* Print values for GNU debugger GDB.
- Copyright (C) 1986, 1987, 1988, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include "defs.h"
-#include "param.h"
-#include "frame.h"
-#include "symtab.h"
-#include "value.h"
-#include "expression.h"
-
-struct format_data
-{
- int count;
- char format;
- char size;
-};
-
-/* Last specified output format. */
-
-static char last_format = 'x';
-
-/* Last specified examination size. 'b', 'h', 'w' or `q'. */
-
-static char last_size = 'w';
-
-/* Default address to examine next. */
-
-static CORE_ADDR next_address;
-
-/* Last address examined. */
-
-static CORE_ADDR last_examine_address;
-
-/* Contents of last address examined.
- This is not valid past the end of the `x' command! */
-
-static value last_examine_value;
-
-/* Number of auto-display expression currently being displayed.
- So that we can deleted it if we get an error or a signal within it.
- -1 when not doing one. */
-
-int current_display_number;
-
-static void do_one_display ();
-
-void do_displays ();
-void print_address ();
-void print_floating ();
-void print_scalar_formatted ();
-void print_formatted_address ();
-
-
-/* Decode a format specification. *STRING_PTR should point to it.
- OFORMAT and OSIZE are used as defaults for the format and size
- if none are given in the format specification.
- If OSIZE is zero, then the size field of the returned value
- should be set only if a size is explicitly specified by the
- user.
- The structure returned describes all the data
- found in the specification. In addition, *STRING_PTR is advanced
- past the specification and past all whitespace following it. */
-
-struct format_data
-decode_format (string_ptr, oformat, osize)
- char **string_ptr;
- char oformat;
- char osize;
-{
- struct format_data val;
- register char *p = *string_ptr;
-
- val.format = '?';
- val.size = '?';
- val.count = 1;
-
- if (*p >= '0' && *p <= '9')
- val.count = atoi (p);
- while (*p >= '0' && *p <= '9') p++;
-
- /* Now process size or format letters that follow. */
-
- while (1)
- {
- if (*p == 'b' || *p == 'h' || *p == 'w' || *p == 'g')
- val.size = *p++;
-#ifdef LONG_LONG
- else if (*p == 'l')
- {
- val.size = 'g';
- p++;
- }
-#endif
- else if ((*p >= 'a' && *p <= 'z') || (*p >= 'A' && *p <= 'Z'))
- val.format = *p++;
- else
- break;
- }
-
-#ifndef LONG_LONG
- /* Make sure 'g' size is not used on integer types.
- Well, actually, we can handle hex. */
- if (val.size == 'g' && val.format != 'f' && val.format != 'x')
- val.size = 'w';
-#endif
-
- while (*p == ' ' || *p == '\t') p++;
- *string_ptr = p;
-
- /* Set defaults for format and size if not specified. */
- if (val.format == '?')
- {
- if (val.size == '?')
- {
- /* Neither has been specified. */
- val.format = oformat;
- val.size = osize;
- }
- else
- /* If a size is specified, any format makes a reasonable
- default except 'i'. */
- val.format = oformat == 'i' ? 'x' : oformat;
- }
- else if (val.size == '?')
- switch (val.format)
- {
- case 'a':
- case 's':
- case 'A':
- /* Addresses must be words. */
- val.size = osize ? 'w' : osize;
- break;
- case 'f':
- /* Floating point has to be word or giantword. */
- if (osize == 'w' || osize == 'g')
- val.size = osize;
- else
- /* Default it to giantword if the last used size is not
- appropriate. */
- val.size = osize ? 'g' : osize;
- break;
- case 'c':
- /* Characters default to one byte. */
- val.size = osize ? 'b' : osize;
- break;
- default:
- /* The default is the size most recently specified. */
- val.size = osize;
- }
-
- return val;
-}
-
-/* Print value VAL on stdout according to FORMAT, a letter or 0.
- Do not end with a newline.
- 0 means print VAL according to its own type.
- SIZE is the letter for the size of datum being printed.
- This is used to pad hex numbers so they line up. */
-
-static void
-print_formatted (val, format, size)
- register value val;
- register char format;
- char size;
-{
- int len = TYPE_LENGTH (VALUE_TYPE (val));
-
- if (VALUE_LVAL (val) == lval_memory)
- next_address = VALUE_ADDRESS (val) + len;
-
- switch (format)
- {
- case 's':
- next_address = VALUE_ADDRESS (val)
- + value_print (value_addr (val), stdout, 0, Val_pretty_default);
- break;
-
- case 'i':
- next_address = VALUE_ADDRESS (val)
- + print_insn (VALUE_ADDRESS (val), stdout);
- break;
-
- default:
- if (format == 0
- || TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_ARRAY
- || TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_STRUCT
- || TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_UNION
- || VALUE_REPEATED (val))
- value_print (val, stdout, format, Val_pretty_default);
- else
- print_scalar_formatted (VALUE_CONTENTS (val), VALUE_TYPE (val),
- format, size, stdout);
- }
-}
-
-/* Print a scalar of data of type TYPE, pointed to in GDB by VALADDR,
- according to letters FORMAT and SIZE on STREAM.
- FORMAT may not be zero. Formats s and i are not supported at this level.
-
- This is how the elements of an array or structure are printed
- with a format. */
-
-void
-print_scalar_formatted (valaddr, type, format, size, stream)
- char *valaddr;
- struct type *type;
- char format;
- int size;
- FILE *stream;
-{
- LONGEST val_long;
- int len = TYPE_LENGTH (type);
-
- if (size == 'g' && sizeof (LONGEST) < 8
- && format == 'x')
- {
- /* ok, we're going to have to get fancy here. Assumption: a
- long is four bytes. */
- unsigned long v1, v2, tmp;
-
- v1 = unpack_long (builtin_type_long, valaddr);
- v2 = unpack_long (builtin_type_long, valaddr + 4);
-
-#ifdef BYTES_BIG_ENDIAN
-#else
- /* Little endian -- swap the two for printing */
- tmp = v1;
- v1 = v2;
- v2 = tmp;
-#endif
-
- switch (format)
- {
- case 'x':
- fprintf_filtered (stream, "0x%08x%08x", v1, v2);
- break;
- default:
- error ("Output size \"g\" unimplemented for format \"%c\".",
- format);
- }
- return;
- }
-
- val_long = unpack_long (type, valaddr);
-
- /* If value is unsigned, truncate it in case negative. */
- if (format != 'd')
- {
- if (len == sizeof (char))
- val_long &= (1 << 8 * sizeof(char)) - 1;
- else if (len == sizeof (short))
- val_long &= (1 << 8 * sizeof(short)) - 1;
- else if (len == sizeof (long))
- val_long &= (unsigned long) - 1;
- }
-
- switch (format)
- {
- case 'x':
-#ifdef LONG_LONG
- if (!size)
- size = (len < sizeof (long long) ? 'w' : 'g');
- switch (size)
- {
- case 'b':
- fprintf_filtered (stream, "0x%02llx", val_long);
- break;
- case 'h':
- fprintf_filtered (stream, "0x%04llx", val_long);
- break;
- case 0: /* no size specified, like in print */
- case 'w':
- fprintf_filtered (stream, "0x%08llx", val_long);
- break;
- case 'g':
- fprintf_filtered (stream, "0x%016llx", val_long);
- break;
- default:
- error ("Undefined output size \"%c\".", size);
- }
-#else
- switch (size)
- {
- case 'b':
- fprintf_filtered (stream, "0x%02x", val_long);
- break;
- case 'h':
- fprintf_filtered (stream, "0x%04x", val_long);
- break;
- case 0: /* no size specified, like in print */
- case 'w':
- fprintf_filtered (stream, "0x%08x", val_long);
- break;
- case 'g':
- fprintf_filtered (stream, "0x%o16x", val_long);
- break;
- default:
- error ("Undefined output size \"%c\".", size);
- }
-#endif /* not LONG_LONG */
- break;
-
- case 'd':
-#ifdef LONG_LONG
- fprintf_filtered (stream, "%lld", val_long);
-#else
- fprintf_filtered (stream, "%d", val_long);
-#endif
- break;
-
- case 'u':
-#ifdef LONG_LONG
- fprintf_filtered (stream, "%llu", val_long);
-#else
- fprintf_filtered (stream, "%u", val_long);
-#endif
- break;
-
- case 'o':
- if (val_long)
-#ifdef LONG_LONG
- fprintf_filtered (stream, "0%llo", val_long);
-#else
- fprintf_filtered (stream, "0%o", val_long);
-#endif
- else
- fprintf_filtered (stream, "0");
- break;
-
- case 'a':
- print_address ((CORE_ADDR) val_long, stream);
- break;
-
- case 'A':
- print_formatted_address ((CORE_ADDR) val_long, stream);
- break;
-
- case 'c':
- value_print (value_from_long (builtin_type_char, val_long), stream, 0,
- Val_pretty_default);
- break;
-
- case 'f':
- if (len == sizeof (float))
- type = builtin_type_float;
- else if (len == sizeof (double))
- type = builtin_type_double;
- print_floating(valaddr, type, stream);
- break;
-
- case 0:
- abort ();
-
- default:
- error ("Undefined output format \"%c\".", format);
- }
-}
-
-/* Print a floating point value of type TYPE, pointed to in GDB by VALADDR,
- on STREAM. */
-
-void
-print_floating(valaddr, type, stream)
- char *valaddr;
- struct type *type;
- FILE *stream;
-{
- double doub;
- int inv;
- int len = TYPE_LENGTH (type);
-
- doub = unpack_double (type, valaddr, &inv);
- if (inv)
- fprintf_filtered (stream, "Invalid float value");
- else if (doub != doub)
- {
- /* Surely it is an IEEE floating point NaN. */
-
- long low, high, *arg = (long *)valaddr; /* ASSUMED 32 BITS */
- int nonneg;
-
- if (len <= sizeof(float))
- {
- /* It's single precision. */
- low = *arg;
- nonneg = low >= 0;
- low &= 0x7fffff;
- high = 0;
- }
- else
- {
- /* It's double precision.
- Get the high and low words of the fraction.
- Distinguish big and little-endian machines. */
-#ifdef WORDS_BIG_ENDIAN
- low = arg[1], high = arg[0];
-#else
- low = arg[0], high = arg[1];
-#endif
- nonneg = high >= 0;
- high &= 0xfffff;
- }
- if (high)
- fprintf_filtered (stream, "-NaN(0x%lx%.8lx)" + nonneg, high, low);
- else
- fprintf_filtered (stream, "-NaN(0x%lx)" + nonneg, low);
- }
- else
- fprintf_filtered (stream, len <= sizeof(float) ? "%.6g" : "%.17g", doub);
-}
-
-/* Specify default address for `x' command.
- `info lines' uses this. */
-
-void
-set_next_address (addr)
- CORE_ADDR addr;
-{
- next_address = addr;
-
- /* Make address available to the user as $_. */
- set_internalvar (lookup_internalvar ("_"),
- value_from_long (builtin_type_int, (LONGEST) addr));
-}
-
-/* Optionally print address ADDR symbolically as <SYMBOL+OFFSET> on STREAM. */
-
-void
-print_address_symbolic (addr, stream)
- CORE_ADDR addr;
- FILE *stream;
-{
- register char *format;
- int name_location;
- register int i = find_pc_misc_function (addr);
-
- /* If nothing comes out, don't print anything symbolic. */
- if (i < 0) return;
- name_location = misc_function_vector[i].address;
-
- if (addr - name_location)
- format = " <%s+%d>";
- else
- format = " <%s>";
-
- fprintf_filtered (stream, format,
- misc_function_vector[i].name, addr - name_location);
-}
-
-/* Print address ADDR symbolically on STREAM.
- First print it as a number. Then perhaps print
- <SYMBOL + OFFSET> after the number. */
-
-void
-print_address (addr, stream)
- CORE_ADDR addr;
- FILE *stream;
-{
- fprintf_filtered (stream, "0x%x", addr);
- print_address_symbolic (addr, stream);
-}
-
-/* Like print_address but opnly prints symbolically. */
-
-void
-print_formatted_address (addr, stream)
- CORE_ADDR addr;
- FILE *stream;
-{
- register int i = 0;
- register char *format;
- register struct symbol *fs;
- char *name;
- int name_location;
-
- i = find_pc_partial_function (addr, &name, &name_location);
-
- /* If nothing comes out, don't print anything symbolic. */
-
- if (i == 0)
- fprintf_filtered (stream, "0x%x", addr);
- else if (addr - name_location)
- fprintf_filtered (stream, "%s+%d", name, addr - name_location);
- else
- fprintf_filtered (stream, "%s", name);
-}
-
-/* Examine data at address ADDR in format FMT.
- Fetch it from memory and print on stdout. */
-
-static void
-do_examine (fmt, addr)
- struct format_data fmt;
- CORE_ADDR addr;
-{
- register char format = 0;
- register char size;
- register int count = 1;
- struct type *val_type;
- register int i;
- register int maxelts;
-
- format = fmt.format;
- size = fmt.size;
- count = fmt.count;
- next_address = addr;
-
- /* String or instruction format implies fetch single bytes
- regardless of the specified size. */
- if (format == 's' || format == 'i')
- size = 'b';
-
- if (size == 'b')
- val_type = builtin_type_char;
- else if (size == 'h')
- val_type = builtin_type_short;
- else if (size == 'w')
- val_type = builtin_type_long;
- else if (size == 'g')
-#ifndef LONG_LONG
- val_type = builtin_type_double;
-#else
- val_type = builtin_type_long_long;
-#endif
-
- maxelts = 8;
- if (size == 'w')
- maxelts = 4;
- if (size == 'g')
- maxelts = 2;
- if (format == 's' || format == 'i')
- maxelts = 1;
-
- /* Print as many objects as specified in COUNT, at most maxelts per line,
- with the address of the next one at the start of each line. */
-
- while (count > 0)
- {
- print_address (next_address, stdout);
- printf_filtered (":");
- for (i = maxelts;
- i > 0 && count > 0;
- i--, count--)
- {
- printf_filtered ("\t");
- /* Note that print_formatted sets next_address for the next
- object. */
- last_examine_address = next_address;
- last_examine_value = value_at (val_type, next_address);
- print_formatted (last_examine_value, format, size);
- }
- printf_filtered ("\n");
- fflush (stdout);
- }
-}
-
-static void
-validate_format (fmt, cmdname)
- struct format_data fmt;
- char *cmdname;
-{
- if (fmt.size != 0)
- error ("Size letters are meaningless in \"%s\" command.", cmdname);
- if (fmt.count != 1)
- error ("Item count other than 1 is meaningless in \"%s\" command.",
- cmdname);
- if (fmt.format == 'i' || fmt.format == 's')
- error ("Format letter \"%c\" is meaningless in \"%s\" command.",
- fmt.format, cmdname);
-}
-
-static void
-print_command (exp)
- char *exp;
-{
- struct expression *expr;
- register struct cleanup *old_chain = 0;
- register char format = 0;
- register value val;
- struct format_data fmt;
- int histindex;
- int cleanup = 0;
-
- if (exp && *exp == '/')
- {
- exp++;
- fmt = decode_format (&exp, last_format, 0);
- validate_format (fmt, "print");
- last_format = format = fmt.format;
- }
-
- if (exp && *exp)
- {
- expr = parse_c_expression (exp);
- old_chain = make_cleanup (free_current_contents, &expr);
- cleanup = 1;
- val = evaluate_expression (expr);
- }
- else
- val = access_value_history (0);
-
- histindex = record_latest_value (val);
- if (histindex >= 0) printf_filtered ("$%d = ", histindex);
-
- print_formatted (val, format, fmt.size);
- printf_filtered ("\n");
-
- if (cleanup)
- do_cleanups (old_chain);
-}
-
-static void
-output_command (exp)
- char *exp;
-{
- struct expression *expr;
- register struct cleanup *old_chain;
- register char format = 0;
- register value val;
- struct format_data fmt;
-
- if (exp && *exp == '/')
- {
- exp++;
- fmt = decode_format (&exp, 0, 0);
- validate_format (fmt, "print");
- format = fmt.format;
- }
-
- expr = parse_c_expression (exp);
- old_chain = make_cleanup (free_current_contents, &expr);
-
- val = evaluate_expression (expr);
-
- print_formatted (val, format, fmt.size);
-
- do_cleanups (old_chain);
-}
-
-static void
-set_command (exp)
- char *exp;
-{
- struct expression *expr = parse_c_expression (exp);
- register struct cleanup *old_chain
- = make_cleanup (free_current_contents, &expr);
- evaluate_expression (expr);
- do_cleanups (old_chain);
-}
-
-static void
-address_info (exp)
- char *exp;
-{
- register struct symbol *sym;
- register CORE_ADDR val;
- int is_a_field_of_this; /* C++: lookup_symbol sets this to nonzero
- if exp is a field of `this'. */
-
- if (exp == 0)
- error ("Argument required.");
-
- sym = lookup_symbol (exp, get_selected_block (), VAR_NAMESPACE,
- &is_a_field_of_this);
- if (sym == 0)
- {
- register int i;
-
- if (is_a_field_of_this)
- {
- printf ("Symbol \"%s\" is a field of the local class variable `this'\n", exp);
- return;
- }
-
- for (i = 0; i < misc_function_count; i++)
- if (!strcmp (misc_function_vector[i].name, exp))
- break;
-
- if (i < misc_function_count)
- printf ("Symbol \"%s\" is at 0x%x in a file compiled without -g.\n",
- exp, misc_function_vector[i].address);
- else
- error ("No symbol \"%s\" in current context.", exp);
- return;
- }
-
- printf ("Symbol \"%s\" is ", SYMBOL_NAME (sym));
- val = SYMBOL_VALUE (sym);
-
- switch (SYMBOL_CLASS (sym))
- {
- case LOC_CONST:
- case LOC_CONST_BYTES:
- printf ("constant");
- break;
-
- case LOC_LABEL:
- printf ("a label at address 0x%x", val);
- break;
-
- case LOC_REGISTER:
- printf ("a variable in register %s", reg_names[val]);
- break;
-
- case LOC_STATIC:
- printf ("static at address 0x%x", val);
- break;
-
- case LOC_REGPARM:
- printf ("an argument in register %s", reg_names[val]);
- break;
-
- case LOC_ARG:
- printf ("an argument at offset %d", val);
- break;
-
- case LOC_LOCAL:
- printf ("a local variable at frame offset %d", val);
- break;
-
- case LOC_REF_ARG:
- printf ("a reference argument at offset %d", val);
- break;
-
- case LOC_TYPEDEF:
- printf ("a typedef");
- break;
-
- case LOC_BLOCK:
- printf ("a function at address 0x%x",
- BLOCK_START (SYMBOL_BLOCK_VALUE (sym)));
- break;
- }
- printf (".\n");
-}
-
-static void
-x_command (exp, from_tty)
- char *exp;
- int from_tty;
-{
- struct expression *expr;
- struct format_data fmt;
- struct cleanup *old_chain;
- struct value *val;
-
- fmt.format = last_format;
- fmt.size = last_size;
- fmt.count = 1;
-
- if (exp && *exp == '/')
- {
- exp++;
- fmt = decode_format (&exp, last_format, last_size);
- last_size = fmt.size;
- last_format = fmt.format;
- }
-
- /* If we have an expression, evaluate it and use it as the address. */
-
- if (exp != 0 && *exp != 0)
- {
- expr = parse_c_expression (exp);
- /* Cause expression not to be there any more
- if this command is repeated with Newline.
- But don't clobber a user-defined command's definition. */
- if (from_tty)
- *exp = 0;
- old_chain = make_cleanup (free_current_contents, &expr);
- val = evaluate_expression (expr);
- /* In rvalue contexts, such as this, functions are coerced into
- pointers to functions. This makes "x/i main" work. */
- if (/* last_format == 'i'
- && */ TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_FUNC
- && VALUE_LVAL (val) == lval_memory)
- next_address = VALUE_ADDRESS (val);
- else
- next_address = (CORE_ADDR) value_as_long (val);
- do_cleanups (old_chain);
- }
-
- do_examine (fmt, next_address);
-
- /* Set a couple of internal variables if appropriate. */
- if (last_examine_value)
- {
- /* Make last address examined available to the user as $_. */
- set_internalvar (lookup_internalvar ("_"),
- value_from_long (builtin_type_int,
- (LONGEST) last_examine_address));
-
- /* Make contents of last address examined available to the user as $__.*/
- set_internalvar (lookup_internalvar ("__"), last_examine_value);
- }
-}
-
-/* Commands for printing types of things. */
-
-static void
-whatis_command (exp)
- char *exp;
-{
- struct expression *expr;
- register value val;
- register struct cleanup *old_chain;
-
- if (exp)
- {
- expr = parse_c_expression (exp);
- old_chain = make_cleanup (free_current_contents, &expr);
- val = evaluate_type (expr);
- }
- else
- val = access_value_history (0);
-
- printf_filtered ("type = ");
- /* Most of the time users do not want to see all the fields
- in a structure. If they do they can use the "ptype" command.
- Hence the "-1" below. */
- type_print (VALUE_TYPE (val), "", stdout, -1);
- printf_filtered ("\n");
-
- if (exp)
- do_cleanups (old_chain);
-}
-
-static void
-ptype_command (typename)
- char *typename;
-{
- register char *p = typename;
- register int len;
- extern struct block *get_current_block ();
- register struct block *b
- = (have_inferior_p () || have_core_file_p ()) ? get_current_block () : 0;
- register struct type *type;
-
- if (typename == 0)
- error_no_arg ("type name");
-
- while (*p && *p != ' ' && *p != '\t') p++;
- len = p - typename;
- while (*p == ' ' || *p == '\t') p++;
-
- if (len == 6 && !strncmp (typename, "struct", 6))
- type = lookup_struct (p, b);
- else if (len == 5 && !strncmp (typename, "union", 5))
- type = lookup_union (p, b);
- else if (len == 4 && !strncmp (typename, "enum", 4))
- type = lookup_enum (p, b);
- else
- {
- type = lookup_typename (typename, b, 1);
- if (type == 0)
- {
- register struct symbol *sym
- = lookup_symbol (typename, b, STRUCT_NAMESPACE, 0);
- if (sym == 0)
- error ("No type named %s.", typename);
- printf_filtered ("No type named %s, but there is a ",
- typename);
- switch (TYPE_CODE (SYMBOL_TYPE (sym)))
- {
- case TYPE_CODE_STRUCT:
- printf_filtered ("struct");
- break;
-
- case TYPE_CODE_UNION:
- printf_filtered ("union");
- break;
-
- case TYPE_CODE_ENUM:
- printf_filtered ("enum");
- }
- printf_filtered (" %s. Type \"help ptype\".\n", typename);
- type = SYMBOL_TYPE (sym);
- }
- }
-
- type_print (type, "", stdout, 1);
- printf_filtered ("\n");
-}
-
-enum display_status {disabled, enabled};
-
-struct display
-{
- /* Chain link to next auto-display item. */
- struct display *next;
- /* Expression to be evaluated and displayed. */
- struct expression *exp;
- /* Item number of this auto-display item. */
- int number;
- /* Display format specified. */
- struct format_data format;
- /* Innermost block required by this expression when evaluated */
- struct block *block;
- /* Status of this display (enabled or disabled) */
- enum display_status status;
-};
-
-/* Chain of expressions whose values should be displayed
- automatically each time the program stops. */
-
-static struct display *display_chain;
-
-static int display_number;
-
-/* Add an expression to the auto-display chain.
- Specify the expression. */
-
-static void
-display_command (exp, from_tty)
- char *exp;
- int from_tty;
-{
- struct format_data fmt;
- register struct expression *expr;
- register struct display *new;
- extern struct block *innermost_block;
-
- if (exp == 0)
- {
- do_displays ();
- return;
- }
-
- if (*exp == '/')
- {
- exp++;
- fmt = decode_format (&exp, 0, 0);
- if (fmt.size && fmt.format == 0)
- fmt.format = 'x';
- if (fmt.format == 'i' || fmt.format == 's')
- fmt.size = 'b';
- }
- else
- {
- fmt.format = 0;
- fmt.size = 0;
- fmt.count = 0;
- }
-
- innermost_block = 0;
- expr = parse_c_expression (exp);
-
- new = (struct display *) xmalloc (sizeof (struct display));
-
- new->exp = expr;
- new->block = innermost_block;
- new->next = display_chain;
- new->number = ++display_number;
- new->format = fmt;
- new->status = enabled;
- display_chain = new;
-
- if (from_tty && have_inferior_p ())
- do_one_display (new);
-
- dont_repeat ();
-}
-
-static void
-free_display (d)
- struct display *d;
-{
- free (d->exp);
- free (d);
-}
-
-/* Clear out the display_chain.
- Done when new symtabs are loaded, since this invalidates
- the types stored in many expressions. */
-
-void
-clear_displays ()
-{
- register struct display *d;
-
- while (d = display_chain)
- {
- free (d->exp);
- display_chain = d->next;
- free (d);
- }
-}
-
-/* Delete the auto-display number NUM. */
-
-void
-delete_display (num)
- int num;
-{
- register struct display *d1, *d;
-
- if (!display_chain)
- error ("No display number %d.", num);
-
- if (display_chain->number == num)
- {
- d1 = display_chain;
- display_chain = d1->next;
- free_display (d1);
- }
- else
- for (d = display_chain; ; d = d->next)
- {
- if (d->next == 0)
- error ("No display number %d.", num);
- if (d->next->number == num)
- {
- d1 = d->next;
- d->next = d1->next;
- free_display (d1);
- break;
- }
- }
-}
-
-/* Delete some values from the auto-display chain.
- Specify the element numbers. */
-
-static void
-undisplay_command (args)
- char *args;
-{
- register char *p = args;
- register char *p1;
- register int num;
- register struct display *d, *d1;
-
- if (args == 0)
- {
- if (query ("Delete all auto-display expressions? "))
- clear_displays ();
- dont_repeat ();
- return;
- }
-
- while (*p)
- {
- p1 = p;
- while (*p1 >= '0' && *p1 <= '9') p1++;
- if (*p1 && *p1 != ' ' && *p1 != '\t')
- error ("Arguments must be display numbers.");
-
- num = atoi (p);
-
- delete_display (num);
-
- p = p1;
- while (*p == ' ' || *p == '\t') p++;
- }
- dont_repeat ();
-}
-
-/* Display a single auto-display.
- Do nothing if the display cannot be printed in the current context,
- or if the display is disabled. */
-
-static void
-do_one_display (d)
- struct display *d;
-{
- int within_current_scope;
-
- if (d->status == disabled)
- return;
-
- if (d->block)
- within_current_scope = contained_in (get_selected_block (), d->block);
- else
- within_current_scope = 1;
- if (!within_current_scope)
- return;
-
- current_display_number = d->number;
-
- printf_filtered ("%d: ", d->number);
- if (d->format.size)
- {
- printf_filtered ("x/");
- if (d->format.count != 1)
- printf_filtered ("%d", d->format.count);
- printf_filtered ("%c", d->format.format);
- if (d->format.format != 'i' && d->format.format != 's')
- printf_filtered ("%c", d->format.size);
- printf_filtered (" ");
- print_expression (d->exp, stdout);
- if (d->format.count != 1)
- printf_filtered ("\n");
- else
- printf_filtered (" ");
- do_examine (d->format,
- (CORE_ADDR) value_as_long (evaluate_expression (d->exp)));
-
- }
- else
- {
- if (d->format.format)
- printf_filtered ("/%c ", d->format.format);
- print_expression (d->exp, stdout);
- printf_filtered (" = ");
- print_formatted (evaluate_expression (d->exp),
- d->format.format, d->format.size);
- printf_filtered ("\n");
- }
-
- fflush (stdout);
- current_display_number = -1;
-}
-
-/* Display all of the values on the auto-display chain which can be
- evaluated in the current scope. */
-
-void
-do_displays ()
-{
- register struct display *d;
-
- for (d = display_chain; d; d = d->next)
- do_one_display (d);
-}
-
-/* Delete the auto-display which we were in the process of displaying.
- This is done when there is an error or a signal. */
-
-void
-disable_display (num)
- int num;
-{
- register struct display *d;
-
- for (d = display_chain; d; d = d->next)
- if (d->number == num)
- {
- d->status = disabled;
- return;
- }
- printf ("No display number %d.\n", num);
-}
-
-void
-disable_current_display ()
-{
- if (current_display_number >= 0)
- {
- disable_display (current_display_number);
- fprintf (stderr, "Disabling display %d to avoid infinite recursion.\n",
- current_display_number);
- }
- current_display_number = -1;
-}
-
-static void
-display_info ()
-{
- register struct display *d;
-
- if (!display_chain)
- printf ("There are no auto-display expressions now.\n");
- else
- printf_filtered ("Auto-display expressions now in effect:\n\
-Num Enb Expression\n");
-
- for (d = display_chain; d; d = d->next)
- {
- printf_filtered ("%d: %c ", d->number, "ny"[(int)d->status]);
- if (d->format.size)
- printf_filtered ("/%d%c%c ", d->format.count, d->format.size,
- d->format.format);
- else if (d->format.format)
- printf_filtered ("/%c ", d->format.format);
- print_expression (d->exp, stdout);
- if (d->block && !contained_in (get_selected_block (), d->block))
- printf_filtered (" (cannot be evaluated in the current context)");
- printf_filtered ("\n");
- fflush (stdout);
- }
-}
-
-void
-enable_display (args)
- char *args;
-{
- register char *p = args;
- register char *p1;
- register int num;
- register struct display *d;
-
- if (p == 0)
- {
- for (d = display_chain; d; d = d->next)
- d->status = enabled;
- }
- else
- while (*p)
- {
- p1 = p;
- while (*p1 >= '0' && *p1 <= '9')
- p1++;
- if (*p1 && *p1 != ' ' && *p1 != '\t')
- error ("Arguments must be display numbers.");
-
- num = atoi (p);
-
- for (d = display_chain; d; d = d->next)
- if (d->number == num)
- {
- d->status = enabled;
- goto win;
- }
- printf ("No display number %d.\n", num);
- win:
- p = p1;
- while (*p == ' ' || *p == '\t')
- p++;
- }
-}
-
-void
-disable_display_command (args, from_tty)
- char *args;
- int from_tty;
-{
- register char *p = args;
- register char *p1;
- register int num;
- register struct display *d;
-
- if (p == 0)
- {
- for (d = display_chain; d; d = d->next)
- d->status = disabled;
- }
- else
- while (*p)
- {
- p1 = p;
- while (*p1 >= '0' && *p1 <= '9')
- p1++;
- if (*p1 && *p1 != ' ' && *p1 != '\t')
- error ("Arguments must be display numbers.");
-
- num = atoi (p);
-
- disable_display (atoi (p));
-
- p = p1;
- while (*p == ' ' || *p == '\t')
- p++;
- }
-}
-
-
-/* Print the value in stack frame FRAME of a variable
- specified by a struct symbol. */
-
-void
-print_variable_value (var, frame, stream)
- struct symbol *var;
- FRAME frame;
- FILE *stream;
-{
- value val = read_var_value (var, frame);
- value_print (val, stream, 0, Val_pretty_default);
-}
-
-static int
-compare_ints (i, j)
- int *i, *j;
-{
- return *i - *j;
-}
-
-/* Print the arguments of a stack frame, given the function FUNC
- running in that frame (as a symbol), the info on the frame,
- and the number of args according to the stack frame (or -1 if unknown). */
-
-static void print_frame_nameless_args ();
-
-void
-print_frame_args (func, fi, num, stream)
- struct symbol *func;
- struct frame_info *fi;
- int num;
- FILE *stream;
-{
- struct block *b;
- int nsyms = 0;
- int first = 1;
- register int i;
- register int last_regparm = 0;
- register struct symbol *lastsym, *sym, *nextsym;
- register value val;
- /* Offset of stack argument that is at the highest offset.
- -1 if we haven't come to a stack argument yet. */
- CORE_ADDR highest_offset = (CORE_ADDR) -1;
- register CORE_ADDR addr = FRAME_ARGS_ADDRESS (fi);
-
- if (func)
- {
- b = SYMBOL_BLOCK_VALUE (func);
- nsyms = BLOCK_NSYMS (b);
- }
-
- for (i = 0; i < nsyms; i++)
- {
- QUIT;
- sym = BLOCK_SYM (b, i);
-
- if (SYMBOL_CLASS (sym) != LOC_REGPARM
- && SYMBOL_CLASS (sym) != LOC_ARG
- && SYMBOL_CLASS (sym) != LOC_REF_ARG)
- continue;
-
- /* Print the next arg. */
- if (SYMBOL_CLASS (sym) == LOC_REGPARM)
- val = value_from_register (SYMBOL_TYPE (sym),
- SYMBOL_VALUE (sym),
- FRAME_INFO_ID (fi));
- else
- {
- int current_offset = SYMBOL_VALUE (sym);
- int arg_size = TYPE_LENGTH (SYMBOL_TYPE (sym));
-
- if (SYMBOL_CLASS (sym) == LOC_REF_ARG)
- val = value_at (SYMBOL_TYPE (sym),
- read_memory_integer (addr + current_offset,
- sizeof (CORE_ADDR)));
- else
- val = value_at (SYMBOL_TYPE (sym), addr + current_offset);
-
- /* Round up address of next arg to multiple of size of int. */
- current_offset
- = (((current_offset + sizeof (int) - 1) / sizeof (int))
- * sizeof (int));
-
- /* If this is the highest offset seen yet, set highest_offset. */
- if (highest_offset == (CORE_ADDR)-1
- || ((current_offset
- + (arg_size - sizeof (int) + 3) / (sizeof (int)))
- > highest_offset))
- highest_offset = current_offset;
- }
-
- if (! first)
- fprintf_filtered (stream, ", ");
- fputs_filtered (SYMBOL_NAME (sym), stream);
- fputs_filtered ("=", stream);
-
-/* Nonzero if a LOC_ARG which is a struct is useless. */
-#if !defined (STRUCT_ARG_SYM_GARBAGE)
-#define STRUCT_ARG_SYM_GARBAGE(gcc_p) 0
-#endif
-
- if (STRUCT_ARG_SYM_GARBAGE (b->gcc_compile_flag)
- && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT
- && SYMBOL_CLASS (sym) == LOC_ARG)
- {
- /* Try looking up that name. SunOS4 puts out a usable
- symbol as a local variable (in addition to the one
- for the arg). */
- struct symbol *sym2 =
- lookup_symbol (SYMBOL_NAME (sym), b, VAR_NAMESPACE, 0);
-
- if (sym2 != NULL)
- val = value_of_variable (sym2);
- else
- {
- fputs_filtered ("?", stream);
- first = 0;
- continue;
- }
- }
-
- value_print (val, stream, 0, Val_no_prettyprint);
- first = 0;
- }
-
- /* Don't print nameless args in situations where we don't know
- enough about the stack to find them. */
- if (num != -1)
- {
- if (highest_offset != (CORE_ADDR) -1
- && num * sizeof (int) + FRAME_ARGS_SKIP > highest_offset)
- print_frame_nameless_args (fi, addr,
- highest_offset + sizeof (int),
- num * sizeof (int) + FRAME_ARGS_SKIP,
- stream);
- else
- print_frame_nameless_args (fi, addr, FRAME_ARGS_SKIP,
- num * sizeof (int) + FRAME_ARGS_SKIP,
- stream);
- }
-}
-
-static void
-print_frame_nameless_args (fi, argsaddr, start, end, stream)
- struct frame_info *fi;
- CORE_ADDR argsaddr;
- int start;
- int end;
- FILE *stream;
-{
- extern void (*default_scalar_print)();
- LONGEST v;
- int p = start;
- char *s = "";
-
- for (p = start; p < end; p += sizeof(int)) {
- QUIT;
-#if defined(NAMELESS_ARG)
- v = NAMELESS_ARG(fi, (p - start) / sizeof(int));
-#else
- v = read_memory_integer (argsaddr + p, sizeof (int));
-#endif
- fprintf_filtered (stream, s);
- s = ", ";
- (*default_scalar_print) (stream, builtin_type_int, v);
- }
-}
-
-static void
-printf_command (arg)
- char *arg;
-{
- register char *f;
- register char *s = arg;
- char *string;
- value *val_args;
- int nargs = 0;
- int allocated_args = 20;
- char *arg_bytes;
-
- val_args = (value *) xmalloc (allocated_args * sizeof (value));
-
- if (s == 0)
- error_no_arg ("format-control string and values to print");
-
- /* Skip white space before format string */
- while (*s == ' ' || *s == '\t') s++;
-
- /* A format string should follow, enveloped in double quotes */
- if (*s++ != '"')
- error ("Bad format string, missing '\"'.");
-
- /* Parse the format-control string and copy it into the string STRING,
- processing some kinds of escape sequence. */
-
- f = string = (char *) alloca (strlen (s) + 1);
- while (*s != '"')
- {
- int c = *s++;
- switch (c)
- {
- case '\0':
- error ("Bad format string, non-terminated '\"'.");
- /* doesn't return */
-
- case '\\':
- switch (c = *s++)
- {
- case '\\':
- *f++ = '\\';
- break;
- case 'n':
- *f++ = '\n';
- break;
- case 't':
- *f++ = '\t';
- break;
- case 'r':
- *f++ = '\r';
- break;
- case '"':
- *f++ = '"';
- break;
- default:
- /* ??? TODO: handle other escape sequences */
- error ("Unrecognized \\ escape character in format string.");
- }
- break;
-
- default:
- *f++ = c;
- }
- }
-
- /* Skip over " and following space and comma. */
- s++;
- *f++ = '\0';
- while (*s == ' ' || *s == '\t') s++;
-
- if (*s != ',' && *s != 0)
- error ("Invalid argument syntax");
-
- if (*s == ',') s++;
- while (*s == ' ' || *s == '\t') s++;
-
- {
- /* Now scan the string for %-specs and see what kinds of args they want.
- argclass[I] classifies the %-specs so we can give vprintf something
- of the right size. */
-
- enum argclass {int_arg, string_arg, double_arg, long_long_arg};
- enum argclass *argclass;
- int nargs_wanted;
- int argindex;
- int lcount;
- int i;
-
- argclass = (enum argclass *) alloca (strlen (s) * sizeof *argclass);
- nargs_wanted = 0;
- f = string;
- while (*f)
- if (*f++ == '%')
- {
- lcount = 0;
- while (index ("0123456789.hlL-+ #", *f))
- {
- if (*f == 'l' || *f == 'L')
- lcount++;
- f++;
- }
- if (*f == 's')
- argclass[nargs_wanted++] = string_arg;
- else if (*f == 'e' || *f == 'f' || *f == 'g')
- argclass[nargs_wanted++] = double_arg;
- else if (lcount > 1)
- argclass[nargs_wanted++] = long_long_arg;
- else if (*f != '%')
- argclass[nargs_wanted++] = int_arg;
- f++;
- }
-
- /* Now, parse all arguments and evaluate them.
- Store the VALUEs in VAL_ARGS. */
-
- while (*s != '\0')
- {
- char *s1;
- if (nargs == allocated_args)
- val_args = (value *) xrealloc (val_args,
- (allocated_args *= 2)
- * sizeof (value));
- s1 = s;
- val_args[nargs] = parse_to_comma_and_eval (&s1);
-
- /* If format string wants a float, unchecked-convert the value to
- floating point of the same size */
-
- if (argclass[nargs] == double_arg)
- {
- if (TYPE_LENGTH (VALUE_TYPE (val_args[nargs])) == sizeof (float))
- VALUE_TYPE (val_args[nargs]) = builtin_type_float;
- if (TYPE_LENGTH (VALUE_TYPE (val_args[nargs])) == sizeof (double))
- VALUE_TYPE (val_args[nargs]) = builtin_type_double;
- }
- nargs++;
- s = s1;
- if (*s == ',')
- s++;
- }
-
- if (nargs != nargs_wanted)
- error ("Wrong number of arguments for specified format-string");
-
- /* Now lay out an argument-list containing the arguments
- as doubles, integers and C pointers. */
-
- arg_bytes = (char *) alloca (sizeof (double) * nargs);
- argindex = 0;
- for (i = 0; i < nargs; i++)
- {
- if (argclass[i] == string_arg)
- {
- char *str;
- int tem, j;
- tem = value_as_long (val_args[i]);
-
- /* This is a %s argument. Find the length of the string. */
- for (j = 0; ; j++)
- {
- char c;
- QUIT;
- read_memory (tem + j, &c, 1);
- if (c == 0)
- break;
- }
-
- /* Copy the string contents into a string inside GDB. */
- str = (char *) alloca (j + 1);
- read_memory (tem, str, j);
- str[j] = 0;
-
- /* Pass address of internal copy as the arg to vprintf. */
- *((int *) &arg_bytes[argindex]) = (int) str;
- argindex += sizeof (int);
- }
- else if (VALUE_TYPE (val_args[i])->code == TYPE_CODE_FLT)
- {
- *((double *) &arg_bytes[argindex]) = value_as_double (val_args[i]);
- argindex += sizeof (double);
- }
- else
-#ifdef LONG_LONG
- if (argclass[i] == long_long_arg)
- {
- *(long long *) &arg_bytes[argindex] = value_as_long (val_args[i]);
- argindex += sizeof (long long);
- }
- else
-#endif
- {
- *((int *) &arg_bytes[argindex]) = value_as_long (val_args[i]);
- argindex += sizeof (int);
- }
- }
- }
- vprintf (string, arg_bytes);
-}
-
-/* Helper function for asdump_command. Finds the bounds of a function
- for a specified section of text. PC is an address within the
- function which you want bounds for; *LOW and *HIGH are set to the
- beginning (inclusive) and end (exclusive) of the function. This
- function returns 1 on success and 0 on failure. */
-
-static int
-containing_function_bounds (pc, low, high)
- CORE_ADDR pc, *low, *high;
-{
- int scan;
-
- if (!find_pc_partial_function (pc, 0, low))
- return 0;
-
- scan = *low;
- do {
- scan++;
- if (!find_pc_partial_function (scan, 0, high))
- return 0;
- } while (*low == *high);
-
- return 1;
-}
-
-/* Dump a specified section of assembly code. With no command line
- arguments, this command will dump the assembly code for the
- function surrounding the pc value in the selected frame. With one
- argument, it will dump the assembly code surrounding that pc value.
- Two arguments are interpeted as bounds within which to dump
- assembly. */
-
-static void
-disassemble_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- CORE_ADDR low, high;
- CORE_ADDR pc;
- char *space_index;
-
- if (!arg)
- {
- if (!selected_frame)
- error ("No frame selected.\n");
-
- pc = get_frame_pc (selected_frame);
- if (!containing_function_bounds (pc, &low, &high))
- error ("No function contains pc specified by selected frame.\n");
- }
- else if (!(space_index = (char *) index (arg, ' ')))
- {
- /* One argument. */
- pc = parse_and_eval_address (arg);
- if (!containing_function_bounds (pc, &low, &high))
- error ("No function contains specified pc.\n");
- }
- else
- {
- /* Two arguments. */
- *space_index = '\0';
- low = parse_and_eval_address (arg);
- high = parse_and_eval_address (space_index + 1);
- }
-
- printf_filtered ("Dump of assembler code ");
- if (!space_index)
- {
- char *name;
- find_pc_partial_function (pc, &name, 0);
- printf_filtered ("for function %s:\n", name);
- }
- else
- printf_filtered ("from 0x%x to 0x%x:\n", low, high);
-
- /* Dump the specified range. */
- for (pc = low; pc < high; )
- {
- QUIT;
- print_address (pc, stdout);
- printf_filtered (":\t");
- pc += print_insn (pc, stdout);
- printf_filtered ("\n");
- }
- printf_filtered ("End of assembler dump.\n");
- fflush (stdout);
-}
-
-
-extern struct cmd_list_element *enablelist, *disablelist, *deletelist;
-extern struct cmd_list_element *cmdlist, *setlist;
-
-void
-_initialize_printcmd ()
-{
- current_display_number = -1;
-
- add_info ("address", address_info,
- "Describe where variable VAR is stored.");
-
- add_com ("x", class_vars, x_command,
- "Examine memory: x/FMT ADDRESS.\n\
-ADDRESS is an expression for the memory address to examine.\n\
-FMT is a repeat count followed by a format letter and a size letter.\n\
-Format letters are o(octal), x(hex), d(decimal), u(unsigned decimal),\n\
- f(float), a(address), i(instruction), c(char) and s(string).\n\
-Size letters are b(byte), h(halfword), w(word), g(giant, 8 bytes).\n\
- g is meaningful only with f, for type double.\n\
-The specified number of objects of the specified size are printed\n\
-according to the format.\n\n\
-Defaults for format and size letters are those previously used.\n\
-Default count is 1. Default address is following last thing printed\n\
-with this command or \"print\".");
-
- add_com ("disassemble", class_vars, disassemble_command,
- "Disassemble a specified section of memory.\n\
-Default is the function surrounding the pc of the selected frame.\n\
-With a single argument, the function surrounding that address is dumped.\n\
-Two arguments are taken as a range of memory to dump.");
-
- add_com ("ptype", class_vars, ptype_command,
- "Print definition of type TYPE.\n\
-Argument may be a type name defined by typedef, or \"struct STRUCTNAME\"\n\
-or \"union UNIONNAME\" or \"enum ENUMNAME\".\n\
-The selected stack frame's lexical context is used to look up the name.");
-
- add_com ("whatis", class_vars, whatis_command,
- "Print data type of expression EXP.");
-
- add_info ("display", display_info,
- "Expressions to display when program stops, with code numbers.");
-
- add_cmd ("undisplay", class_vars, undisplay_command,
- "Cancel some expressions to be displayed when program stops.\n\
-Arguments are the code numbers of the expressions to stop displaying.\n\
-No argument means cancel all automatic-display expressions.\n\
-\"delete display\" has the same effect as this command.\n\
-Do \"info display\" to see current list of code numbers.",
- &cmdlist);
-
- add_com ("display", class_vars, display_command,
- "Print value of expression EXP each time the program stops.\n\
-/FMT may be used before EXP as in the \"print\" command.\n\
-/FMT \"i\" or \"s\" or including a size-letter is allowed,\n\
-as in the \"x\" command, and then EXP is used to get the address to examine\n\
-and examining is done as in the \"x\" command.\n\n\
-With no argument, display all currently requested auto-display expressions.\n\
-Use \"undisplay\" to cancel display requests previously made.");
-
- add_cmd ("display", class_vars, enable_display,
- "Enable some expressions to be displayed when program stops.\n\
-Arguments are the code numbers of the expressions to resume displaying.\n\
-No argument means enable all automatic-display expressions.\n\
-Do \"info display\" to see current list of code numbers.", &enablelist);
-
- add_cmd ("display", class_vars, disable_display_command,
- "Disable some expressions to be displayed when program stops.\n\
-Arguments are the code numbers of the expressions to stop displaying.\n\
-No argument means disable all automatic-display expressions.\n\
-Do \"info display\" to see current list of code numbers.", &disablelist);
-
- add_cmd ("display", class_vars, undisplay_command,
- "Cancel some expressions to be displayed when program stops.\n\
-Arguments are the code numbers of the expressions to stop displaying.\n\
-No argument means cancel all automatic-display expressions.\n\
-Do \"info display\" to see current list of code numbers.", &deletelist);
-
- add_com ("printf", class_vars, printf_command,
- "printf \"printf format string\", arg1, arg2, arg3, ..., argn\n\
-This is useful for formatted output in user-defined commands.");
- add_com ("output", class_vars, output_command,
- "Like \"print\" but don't put in value history and don't print newline.\n\
-This is useful in user-defined commands.");
-
- add_prefix_cmd ("set", class_vars, set_command,
-"Perform an assignment VAR = EXP.\n\
-You must type the \"=\". VAR may be a debugger \"convenience\" variable\n\
-(names starting with $), a register (a few standard names starting with $),\n\
-or an actual variable in the program being debugged. EXP is any expression.\n\
-Use \"set variable\" for variables with names identical to set subcommands.\n\
-\nWith a subcommand, this command modifies parts of the gdb environment",
- &setlist, "set ", 1, &cmdlist);
-
- add_cmd ("variable", class_vars, set_command,
- "Perform an assignment VAR = EXP.\n\
-You must type the \"=\". VAR may be a debugger \"convenience\" variable\n\
-(names starting with $), a register (a few standard names starting with $),\n\
-or an actual variable in the program being debugged. EXP is any expression.\n\
-This may usually be abbreviated to simply \"set\".",
- &setlist);
-
- add_com ("print", class_vars, print_command,
- concat ("Print value of expression EXP.\n\
-Variables accessible are those of the lexical environment of the selected\n\
-stack frame, plus all those whose scope is global or an entire file.\n\
-\n\
-$NUM gets previous value number NUM. $ and $$ are the last two values.\n\
-$$NUM refers to NUM'th value back from the last one.\n\
-Names starting with $ refer to registers (with the values they would have\n\
-if the program were to return to the stack frame now selected, restoring\n\
-all registers saved by frames farther in) or else to debugger\n\
-\"convenience\" variables (any such name not a known register).\n\
-Use assignment expressions to give values to convenience variables.\n",
- "\n\
-\{TYPE}ADREXP refers to a datum of data type TYPE, located at address ADREXP.\n\
-@ is a binary operator for treating consecutive data objects\n\
-anywhere in memory as an array. FOO@NUM gives an array whose first\n\
-element is FOO, whose second element is stored in the space following\n\
-where FOO is stored, etc. FOO must be an expression whose value\n\
-resides in memory.\n",
- "\n\
-EXP may be preceded with /FMT, where FMT is a format letter\n\
-but no count or size letter (see \"x\" command)."));
- add_com_alias ("p", "print", class_vars, 1);
-}
diff --git a/gnu/usr.bin/gdb/readline/ChangeLog b/gnu/usr.bin/gdb/readline/ChangeLog
deleted file mode 100644
index b72a59d..0000000
--- a/gnu/usr.bin/gdb/readline/ChangeLog
+++ /dev/null
@@ -1,98 +0,0 @@
-Thu Feb 8 01:04:00 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu)
-
- * Makefile (the *other* libreadline.a): Uncomment out ranlib line.
-
-Thu Feb 1 17:50:22 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu)
-
- * Makefile (libreadline.a): Uncomment out ranlib line.
-
-Sun Nov 26 16:29:11 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * readline.c (rl_deprep_terminal): Only restore local_mode_flags
- if they had been set.
-
-Thu Oct 19 17:18:40 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * Move vi_doing_insert from vi_mode.c to readline.c
-
- * readline.c: Move compare_strings before its use.
- Remove declarations.
-
- * readline.c: Move defining_kbd_macro above rl_dispatch.
- (rl_dispatch): Remove "extern int defining_kbd_macro".
-
-Mon Oct 16 11:56:03 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * readline.c (rl_set_signals): Remove unnecessary "static int
- rl_signal_handler()".
-
-Sat Sep 30 14:51:56 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
-
- * readline.c (rl_initialize): Change parsing_conditionalized_out
- to static.
- (rl_dispatch): Change defining_kbd_macro to static.
- (rl_newline): Change vi_doing_insert to static.
-
-Fri Sep 8 09:00:45 1989 Brian Fox (bfox at aurel)
-
- * readline.c: rl_prep_terminal (). Only turn on 8th bit
- as meta-bit iff the terminal is not using parity.
-
-Sun Sep 3 08:57:40 1989 Brian Fox (bfox at aurel)
-
- * readline.c: start_insert (). Uses multiple
- insertion call in cases where that makes sense.
-
- rl_insert (). Read type-ahead buffer for additional
- keys that are bound to rl_insert, and insert them
- all at once. Make insertion of single keys given
- with an argument much more efficient.
-
-Tue Aug 8 18:13:57 1989 Brian Fox (bfox at aurel)
-
- * readline.c: Changed handling of EOF. readline () returns
- (char *)EOF or consed string. The EOF character is read from the
- tty, or if the tty doesn't have one, defaults to C-d.
-
- * readline.c: Added support for event driven programs.
- rl_event_hook is the address of a function you want called
- while Readline is waiting for input.
-
- * readline.c: Cleanup time. Functions without type declarations
- do not use return with a value.
-
- * history.c: history_expand () has new variable which is the
- characters to ignore immediately following history_expansion_char.
-
-Sun Jul 16 08:14:00 1989 Brian Fox (bfox at aurel)
-
- * rl_prep_terminal ()
- BSD version turns off C-s, C-q, C-y, C-v.
-
- * readline.c -- rl_prep_terminal ()
- SYSV version hacks readline_echoing_p.
- BSD version turns on passing of the 8th bit for the duration
- of reading the line.
-
-Tue Jul 11 06:25:01 1989 Brian Fox (bfox at aurel)
-
- * readline.c: new variable rl_tilde_expander.
- If non-null, this contains the address of a function to call if
- the standard meaning for expanding a tilde fails. The function is
- called with the text sans tilde (as in "foo"), and returns a
- malloc()'ed string which is the expansion, or a NULL pointer if
- there is no expansion.
-
- * readline.h - new file chardefs.h
- Separates things that only readline.c needs from the standard
- header file publishing interesting things about readline.
-
- * readline.c:
- readline_default_bindings () now looks at terminal chararacters
- and binds those as well.
-
-Wed Jun 28 20:20:51 1989 Brian Fox (bfox at aurel)
-
- * Made readline and history into independent libraries.
-
-
diff --git a/gnu/usr.bin/gdb/readline/Makefile.gnu b/gnu/usr.bin/gdb/readline/Makefile.gnu
deleted file mode 100644
index dc11539..0000000
--- a/gnu/usr.bin/gdb/readline/Makefile.gnu
+++ /dev/null
@@ -1,114 +0,0 @@
-## -*- text -*- ####################################################
-# #
-# Makefile for readline and history libraries. #
-# #
-####################################################################
-
-# Here is a rule for making .o files from .c files that doesn't force
-# the type of the machine (like -sun3) into the flags.
-.c.o:
- $(CC) -c $(CFLAGS) $(LOCAL_INCLUDES) $(CPPFLAGS) $*.c
-
-# Destination installation directory. The libraries are copied to DESTDIR
-# when you do a `make install', and the header files to INCDIR/readline/*.h.
-DESTDIR = /usr/gnu/lib
-INCDIR = /usr/gnu/include
-
-# Define TYPES as -DVOID_SIGHANDLER if your operating system uses
-# a return type of "void" for signal handlers.
-TYPES = -DVOID_SIGHANDLER
-
-# Define SYSV as -DSYSV if you are using a System V operating system.
-#SYSV = -DSYSV
-
-# HP-UX compilation requires the BSD library.
-#LOCAL_LIBS = -lBSD
-
-# Xenix compilation requires -ldir -lx
-#LOCAL_LIBS = -ldir -lx
-
-# Comment this out if you don't think that anyone will ever desire
-# the vi line editing mode and features.
-READLINE_DEFINES = -DVI_MODE
-
-DEBUG_FLAGS = -g
-LDFLAGS = $(DEBUG_FLAGS)
-CFLAGS = $(DEBUG_FLAGS) $(TYPE) $(SYSV) -I.
-
-# A good alternative is gcc -traditional.
-#CC = gcc -traditional
-CC = cc
-RANLIB = /usr/bin/ranlib
-AR = ar
-RM = rm
-CP = cp
-
-LOCAL_INCLUDES = -I../
-
-CSOURCES = readline.c history.c funmap.c keymaps.c vi_mode.c \
- emacs_keymap.c vi_keymap.c keymaps.c
-
-HSOURCES = readline.h chardefs.h history.h keymaps.h
-SOURCES = $(CSOURCES) $(HSOURCES)
-
-DOCUMENTATION = readline.texinfo inc-readline.texinfo \
- history.texinfo inc-history.texinfo
-
-SUPPORT = COPYING Makefile $(DOCUMENTATION) ChangeLog
-
-THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
-
-##########################################################################
-
-all: libreadline.a
-
-libreadline.a: readline.o history.o funmap.o keymaps.o
- $(RM) -f libreadline.a
- $(AR) clq libreadline.a readline.o history.o funmap.o keymaps.o
- if [ -f $(RANLIB) ]; then $(RANLIB) libreadline.a; fi
-
-readline.o: readline.h chardefs.h keymaps.h history.h readline.c vi_mode.c
- $(CC) -c $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
- $(LOCAL_INCLUDES) $*.c
-
-history.o: history.c history.h
- $(CC) -c $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
- $(LOCAL_INCLUDES) $*.c
-
-funmap.o: readline.h
- $(CC) -c $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
- $(LOCAL_INCLUDES) $*.c
-
-keymaps.o: emacs_keymap.c vi_keymap.c keymaps.h chardefs.h keymaps.c
- $(CC) -c $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
- $(LOCAL_INCLUDES) $*.c
-
-libtest: libreadline.a libtest.c
- $(CC) -o libtest $(CFLAGS) $(CPPFLAGS) -L. libtest.c -lreadline -ltermcap
-
-readline: readline.c history.o keymaps.o funmap.o readline.h chardefs.h
- $(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
- $(LOCAL_INCLUDES) -DTEST -o readline readline.c funmap.o \
- keymaps.o history.o -L. -ltermcap
-
-readline.tar: $(THINGS_TO_TAR)
- tar -cf readline.tar $(THINGS_TO_TAR)
-
-readline.tar.Z: readline.tar
- compress -f readline.tar
-
-install: $(DESTDIR)/libreadline.a includes
-
-includes:
- if [ ! -r $(INCDIR)/readline ]; then\
- mkdir $(INCDIR)/readline;\
- chmod a+r $(INCDIR)/readline;\
- fi
- $(CP) readline.h keymaps.h chardefs.h $(INCDIR)/readline/
-clean:
- rm -f *.o *.a *.log *.cp *.tp *.vr *.fn *.aux *.pg *.toc
-
-$(DESTDIR)/libreadline.a: libreadline.a
- -mv $(DESTDIR)/libreadline.a $(DESTDIR)/libreadline.old
- cp libreadline.a $(DESTDIR)/libreadline.a
- $(RANLIB) -t $(DESTDIR)/libreadline.a
diff --git a/gnu/usr.bin/gdb/readline/chardefs.h b/gnu/usr.bin/gdb/readline/chardefs.h
deleted file mode 100644
index 9749ae4..0000000
--- a/gnu/usr.bin/gdb/readline/chardefs.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* chardefs.h -- Character definitions for readline. */
-#ifndef _CHARDEFS_
-
-#ifndef savestring
-#define savestring(x) (char *)strcpy (xmalloc (1 + strlen (x)), (x))
-#endif
-
-#ifndef whitespace
-#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
-#endif
-
-#ifdef CTRL
-#undef CTRL
-#endif
-
-/* Some character stuff. */
-#define control_character_threshold 0x020 /* smaller than this is control */
-#define meta_character_threshold 0x07f /* larger than this is Meta. */
-#define control_character_bit 0x40 /* 0x000000, must be off. */
-#define meta_character_bit 0x080 /* x0000000, must be on. */
-
-#define CTRL(c) ((c) & (~control_character_bit))
-#define META(c) ((c) | meta_character_bit)
-
-#define UNMETA(c) ((c) & (~meta_character_bit))
-#define UNCTRL(c) to_upper(((c)|control_character_bit))
-
-#define lowercase_p(c) (((c) > ('a' - 1) && (c) < ('z' + 1)))
-#define uppercase_p(c) (((c) > ('A' - 1) && (c) < ('Z' + 1)))
-
-#define pure_alphabetic(c) (lowercase_p(c) || uppercase_p(c))
-
-#ifndef to_upper
-#define to_upper(c) (lowercase_p(c) ? ((c) - 32) : (c))
-#define to_lower(c) (uppercase_p(c) ? ((c) + 32) : (c))
-#endif
-
-#define CTRL_P(c) ((c) < control_character_threshold)
-#define META_P(c) ((c) > meta_character_threshold)
-
-#define NEWLINE '\n'
-#define RETURN CTRL('M')
-#define RUBOUT 0x07f
-#define TAB '\t'
-#define ABORT_CHAR CTRL('G')
-#define PAGE CTRL('L')
-#define SPACE 0x020
-#define ESC CTRL('[')
-
-#endif /* _CHARDEFS_ */
diff --git a/gnu/usr.bin/gdb/readline/emacs_keymap.c b/gnu/usr.bin/gdb/readline/emacs_keymap.c
deleted file mode 100644
index 7030e69..0000000
--- a/gnu/usr.bin/gdb/readline/emacs_keymap.c
+++ /dev/null
@@ -1,472 +0,0 @@
-/* emacs_keymap.c -- the keymap for emacs_mode in readline (). */
-
-/* Copyright (C) 1988,1989 Free Software Foundation, Inc.
-
- This file is part of GNU Readline, a library for reading lines
- of text with interactive input and history editing.
-
- Readline 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.
-
- Readline 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 Readline; see the file COPYING. If not, write to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef FILE
-#include <stdio.h>
-#endif /* FILE */
-
-#include "readline.h"
-
-/* An array of function pointers, one for each possible key.
- If the type byte is ISKMAP, then the pointer is the address of
- a keymap. */
-
-KEYMAP_ENTRY_ARRAY emacs_standard_keymap = {
-
- /* Control keys. */
- { ISFUNC, (Function *)0x0 }, /* Control-@ */
- { ISFUNC, rl_beg_of_line }, /* Control-a */
- { ISFUNC, rl_backward }, /* Control-b */
- { ISFUNC, (Function *)0x0 }, /* Control-c */
- { ISFUNC, rl_delete }, /* Control-d */
- { ISFUNC, rl_end_of_line }, /* Control-e */
- { ISFUNC, rl_forward }, /* Control-f */
- { ISFUNC, rl_abort }, /* Control-g */
- { ISFUNC, rl_backward }, /* Control-h */
- { ISFUNC, rl_complete }, /* Control-i */
- { ISFUNC, rl_newline }, /* Control-j */
- { ISFUNC, rl_kill_line }, /* Control-k */
- { ISFUNC, rl_clear_screen }, /* Control-l */
- { ISFUNC, rl_newline }, /* Control-m */
- { ISFUNC, rl_get_next_history }, /* Control-n */
- { ISFUNC, (Function *)0x0 }, /* Control-o */
- { ISFUNC, rl_get_previous_history }, /* Control-p */
- { ISFUNC, rl_quoted_insert }, /* Control-q */
- { ISFUNC, rl_reverse_search_history }, /* Control-r */
- { ISFUNC, rl_forward_search_history }, /* Control-s */
- { ISFUNC, rl_transpose_chars }, /* Control-t */
- { ISFUNC, rl_unix_line_discard }, /* Control-u */
- { ISFUNC, rl_quoted_insert }, /* Control-v */
- { ISFUNC, rl_unix_word_rubout }, /* Control-w */
- { ISKMAP, (Function *)emacs_ctlx_keymap }, /* Control-x */
- { ISFUNC, rl_yank }, /* Control-y */
- { ISFUNC, (Function *)0x0 }, /* Control-z */
- { ISKMAP, (Function *)emacs_meta_keymap }, /* Control-[ */
- { ISFUNC, (Function *)0x0 }, /* Control-\ */
- { ISFUNC, (Function *)0x0 }, /* Control-] */
- { ISFUNC, (Function *)0x0 }, /* Control-^ */
- { ISFUNC, rl_undo_command }, /* Control-_ */
-
- /* The start of printing characters. */
- { ISFUNC, rl_insert }, /* SPACE */
- { ISFUNC, rl_insert }, /* ! */
- { ISFUNC, rl_insert }, /* " */
- { ISFUNC, rl_insert }, /* # */
- { ISFUNC, rl_insert }, /* $ */
- { ISFUNC, rl_insert }, /* % */
- { ISFUNC, rl_insert }, /* & */
- { ISFUNC, rl_insert }, /* ' */
- { ISFUNC, rl_insert }, /* ( */
- { ISFUNC, rl_insert }, /* ) */
- { ISFUNC, rl_insert }, /* * */
- { ISFUNC, rl_insert }, /* + */
- { ISFUNC, rl_insert }, /* , */
- { ISFUNC, rl_insert }, /* - */
- { ISFUNC, rl_insert }, /* . */
- { ISFUNC, rl_insert }, /* / */
-
- /* Regular digits. */
- { ISFUNC, rl_insert }, /* 0 */
- { ISFUNC, rl_insert }, /* 1 */
- { ISFUNC, rl_insert }, /* 2 */
- { ISFUNC, rl_insert }, /* 3 */
- { ISFUNC, rl_insert }, /* 4 */
- { ISFUNC, rl_insert }, /* 5 */
- { ISFUNC, rl_insert }, /* 6 */
- { ISFUNC, rl_insert }, /* 7 */
- { ISFUNC, rl_insert }, /* 8 */
- { ISFUNC, rl_insert }, /* 9 */
-
- /* A little more punctuation. */
- { ISFUNC, rl_insert }, /* : */
- { ISFUNC, rl_insert }, /* ; */
- { ISFUNC, rl_insert }, /* < */
- { ISFUNC, rl_insert }, /* = */
- { ISFUNC, rl_insert }, /* > */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* @ */
-
- /* Uppercase alphabet. */
- { ISFUNC, rl_insert }, /* A */
- { ISFUNC, rl_insert }, /* B */
- { ISFUNC, rl_insert }, /* C */
- { ISFUNC, rl_insert }, /* D */
- { ISFUNC, rl_insert }, /* E */
- { ISFUNC, rl_insert }, /* F */
- { ISFUNC, rl_insert }, /* G */
- { ISFUNC, rl_insert }, /* H */
- { ISFUNC, rl_insert }, /* I */
- { ISFUNC, rl_insert }, /* J */
- { ISFUNC, rl_insert }, /* K */
- { ISFUNC, rl_insert }, /* L */
- { ISFUNC, rl_insert }, /* M */
- { ISFUNC, rl_insert }, /* N */
- { ISFUNC, rl_insert }, /* O */
- { ISFUNC, rl_insert }, /* P */
- { ISFUNC, rl_insert }, /* Q */
- { ISFUNC, rl_insert }, /* R */
- { ISFUNC, rl_insert }, /* S */
- { ISFUNC, rl_insert }, /* T */
- { ISFUNC, rl_insert }, /* U */
- { ISFUNC, rl_insert }, /* V */
- { ISFUNC, rl_insert }, /* W */
- { ISFUNC, rl_insert }, /* X */
- { ISFUNC, rl_insert }, /* Y */
- { ISFUNC, rl_insert }, /* Z */
-
- /* Some more punctuation. */
- { ISFUNC, rl_insert }, /* [ */
- { ISFUNC, rl_insert }, /* \ */
- { ISFUNC, rl_insert }, /* ] */
- { ISFUNC, rl_insert }, /* ^ */
- { ISFUNC, rl_insert }, /* _ */
- { ISFUNC, rl_insert }, /* ` */
-
- /* Lowercase alphabet. */
- { ISFUNC, rl_insert }, /* a */
- { ISFUNC, rl_insert }, /* b */
- { ISFUNC, rl_insert }, /* c */
- { ISFUNC, rl_insert }, /* d */
- { ISFUNC, rl_insert }, /* e */
- { ISFUNC, rl_insert }, /* f */
- { ISFUNC, rl_insert }, /* g */
- { ISFUNC, rl_insert }, /* h */
- { ISFUNC, rl_insert }, /* i */
- { ISFUNC, rl_insert }, /* j */
- { ISFUNC, rl_insert }, /* k */
- { ISFUNC, rl_insert }, /* l */
- { ISFUNC, rl_insert }, /* m */
- { ISFUNC, rl_insert }, /* n */
- { ISFUNC, rl_insert }, /* o */
- { ISFUNC, rl_insert }, /* p */
- { ISFUNC, rl_insert }, /* q */
- { ISFUNC, rl_insert }, /* r */
- { ISFUNC, rl_insert }, /* s */
- { ISFUNC, rl_insert }, /* t */
- { ISFUNC, rl_insert }, /* u */
- { ISFUNC, rl_insert }, /* v */
- { ISFUNC, rl_insert }, /* w */
- { ISFUNC, rl_insert }, /* x */
- { ISFUNC, rl_insert }, /* y */
- { ISFUNC, rl_insert }, /* z */
-
- /* Final punctuation. */
- { ISFUNC, rl_insert }, /* { */
- { ISFUNC, rl_insert }, /* | */
- { ISFUNC, rl_insert }, /* } */
- { ISFUNC, rl_insert }, /* ~ */
- { ISFUNC, rl_rubout } /* RUBOUT */
-};
-
-KEYMAP_ENTRY_ARRAY emacs_meta_keymap = {
-
- /* Meta keys. Just like above, but the high bit is set. */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-@ */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-a */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-b */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-c */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-d */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-e */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-f */
- { ISFUNC, rl_abort }, /* Meta-Control-g */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-h */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-i */
- { ISFUNC, rl_vi_editing_mode }, /* Meta-Control-j */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-k */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-l */
- { ISFUNC, rl_vi_editing_mode }, /* Meta-Control-m */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-n */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-o */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-p */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-q */
- { ISFUNC, rl_revert_line }, /* Meta-Control-r */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-s */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-t */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-u */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-v */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-w */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-x */
- { ISFUNC, rl_yank_nth_arg }, /* Meta-Control-y */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-z */
-
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-[ */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-\ */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-] */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-^ */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-_ */
-
- /* The start of printing characters. */
- { ISFUNC, (Function *)0x0 }, /* Meta-SPACE */
- { ISFUNC, (Function *)0x0 }, /* Meta-! */
- { ISFUNC, (Function *)0x0 }, /* Meta-" */
- { ISFUNC, (Function *)0x0 }, /* Meta-# */
- { ISFUNC, (Function *)0x0 }, /* Meta-$ */
- { ISFUNC, (Function *)0x0 }, /* Meta-% */
- { ISFUNC, (Function *)0x0 }, /* Meta-& */
- { ISFUNC, (Function *)0x0 }, /* Meta-' */
- { ISFUNC, (Function *)0x0 }, /* Meta-( */
- { ISFUNC, (Function *)0x0 }, /* Meta-) */
- { ISFUNC, (Function *)0x0 }, /* Meta-* */
- { ISFUNC, (Function *)0x0 }, /* Meta-+ */
- { ISFUNC, (Function *)0x0 }, /* Meta-, */
- { ISFUNC, rl_digit_argument }, /* Meta-- */
- { ISFUNC, (Function *)0x0 }, /* Meta-. */
- { ISFUNC, (Function *)0x0 }, /* Meta-/ */
-
- /* Regular digits. */
- { ISFUNC, rl_digit_argument }, /* Meta-0 */
- { ISFUNC, rl_digit_argument }, /* Meta-1 */
- { ISFUNC, rl_digit_argument }, /* Meta-2 */
- { ISFUNC, rl_digit_argument }, /* Meta-3 */
- { ISFUNC, rl_digit_argument }, /* Meta-4 */
- { ISFUNC, rl_digit_argument }, /* Meta-5 */
- { ISFUNC, rl_digit_argument }, /* Meta-6 */
- { ISFUNC, rl_digit_argument }, /* Meta-7 */
- { ISFUNC, rl_digit_argument }, /* Meta-8 */
- { ISFUNC, rl_digit_argument }, /* Meta-9 */
-
- /* A little more punctuation. */
- { ISFUNC, (Function *)0x0 }, /* Meta-: */
- { ISFUNC, (Function *)0x0 }, /* Meta-; */
- { ISFUNC, rl_beginning_of_history }, /* Meta-< */
- { ISFUNC, (Function *)0x0 }, /* Meta-= */
- { ISFUNC, rl_end_of_history }, /* Meta-> */
- { ISFUNC, rl_possible_completions }, /* Meta-? */
- { ISFUNC, (Function *)0x0 }, /* Meta-@ */
-
- /* Uppercase alphabet. */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-A */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-B */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-C */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-D */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-E */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-F */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-G */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-H */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-I */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-J */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-K */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-L */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-M */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-N */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-O */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-P */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-Q */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-R */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-S */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-T */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-U */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-V */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-W */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-X */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-Y */
- { ISFUNC, rl_do_lowercase_version }, /* Meta-Z */
-
- /* Some more punctuation. */
- { ISFUNC, (Function *)0x0 }, /* Meta-[ */
- { ISFUNC, (Function *)0x0 }, /* Meta-\ */
- { ISFUNC, (Function *)0x0 }, /* Meta-] */
- { ISFUNC, (Function *)0x0 }, /* Meta-^ */
- { ISFUNC, (Function *)0x0 }, /* Meta-_ */
- { ISFUNC, (Function *)0x0 }, /* Meta-` */
-
- /* Lowercase alphabet. */
- { ISFUNC, (Function *)0x0 }, /* Meta-a */
- { ISFUNC, rl_backward_word }, /* Meta-b */
- { ISFUNC, rl_capitalize_word }, /* Meta-c */
- { ISFUNC, rl_kill_word }, /* Meta-d */
- { ISFUNC, (Function *)0x0 }, /* Meta-e */
- { ISFUNC, rl_forward_word }, /* Meta-f */
- { ISFUNC, (Function *)0x0 }, /* Meta-g */
- { ISFUNC, (Function *)0x0 }, /* Meta-h */
- { ISFUNC, (Function *)0x0 }, /* Meta-i */
- { ISFUNC, (Function *)0x0 }, /* Meta-j */
- { ISFUNC, (Function *)0x0 }, /* Meta-k */
- { ISFUNC, rl_downcase_word }, /* Meta-l */
- { ISFUNC, (Function *)0x0 }, /* Meta-m */
- { ISFUNC, (Function *)0x0 }, /* Meta-n */
- { ISFUNC, (Function *)0x0 }, /* Meta-o */
- { ISFUNC, (Function *)0x0 }, /* Meta-p */
- { ISFUNC, (Function *)0x0 }, /* Meta-q */
- { ISFUNC, rl_revert_line }, /* Meta-r */
- { ISFUNC, (Function *)0x0 }, /* Meta-s */
- { ISFUNC, rl_transpose_words }, /* Meta-t */
- { ISFUNC, rl_upcase_word }, /* Meta-u */
- { ISFUNC, (Function *)0x0 }, /* Meta-v */
- { ISFUNC, (Function *)0x0 }, /* Meta-w */
- { ISFUNC, (Function *)0x0 }, /* Meta-x */
- { ISFUNC, rl_yank_pop }, /* Meta-y */
- { ISFUNC, (Function *)0x0 }, /* Meta-z */
-
- /* Final punctuation. */
- { ISFUNC, (Function *)0x0 }, /* Meta-{ */
- { ISFUNC, (Function *)0x0 }, /* Meta-| */
- { ISFUNC, (Function *)0x0 }, /* Meta-} */
- { ISFUNC, (Function *)0x0 }, /* Meta-~ */
- { ISFUNC, rl_backward_kill_word } /* Meta-rubout */
-};
-
-KEYMAP_ENTRY_ARRAY emacs_ctlx_keymap = {
-
- /* Control keys. */
- { ISFUNC, (Function *)0x0 }, /* Control-@ */
- { ISFUNC, (Function *)0x0 }, /* Control-a */
- { ISFUNC, (Function *)0x0 }, /* Control-b */
- { ISFUNC, (Function *)0x0 }, /* Control-c */
- { ISFUNC, (Function *)0x0 }, /* Control-d */
- { ISFUNC, (Function *)0x0 }, /* Control-e */
- { ISFUNC, (Function *)0x0 }, /* Control-f */
- { ISFUNC, rl_abort }, /* Control-g */
- { ISFUNC, (Function *)0x0 }, /* Control-h */
- { ISFUNC, (Function *)0x0 }, /* Control-i */
- { ISFUNC, (Function *)0x0 }, /* Control-j */
- { ISFUNC, (Function *)0x0 }, /* Control-k */
- { ISFUNC, (Function *)0x0 }, /* Control-l */
- { ISFUNC, (Function *)0x0 }, /* Control-m */
- { ISFUNC, (Function *)0x0 }, /* Control-n */
- { ISFUNC, (Function *)0x0 }, /* Control-o */
- { ISFUNC, (Function *)0x0 }, /* Control-p */
- { ISFUNC, (Function *)0x0 }, /* Control-q */
- { ISFUNC, rl_re_read_init_file }, /* Control-r */
- { ISFUNC, (Function *)0x0 }, /* Control-s */
- { ISFUNC, (Function *)0x0 }, /* Control-t */
- { ISFUNC, rl_undo_command }, /* Control-u */
- { ISFUNC, (Function *)0x0 }, /* Control-v */
- { ISFUNC, (Function *)0x0 }, /* Control-w */
- { ISFUNC, (Function *)0x0 }, /* Control-x */
- { ISFUNC, (Function *)0x0 }, /* Control-y */
- { ISFUNC, (Function *)0x0 }, /* Control-z */
- { ISFUNC, (Function *)0x0 }, /* Control-[ */
- { ISFUNC, (Function *)0x0 }, /* Control-\ */
- { ISFUNC, (Function *)0x0 }, /* Control-] */
- { ISFUNC, (Function *)0x0 }, /* Control-^ */
- { ISFUNC, (Function *)0x0 }, /* Control-_ */
-
- /* The start of printing characters. */
- { ISFUNC, (Function *)0x0 }, /* SPACE */
- { ISFUNC, (Function *)0x0 }, /* ! */
- { ISFUNC, (Function *)0x0 }, /* " */
- { ISFUNC, (Function *)0x0 }, /* # */
- { ISFUNC, (Function *)0x0 }, /* $ */
- { ISFUNC, (Function *)0x0 }, /* % */
- { ISFUNC, (Function *)0x0 }, /* & */
- { ISFUNC, (Function *)0x0 }, /* ' */
- { ISFUNC, rl_start_kbd_macro }, /* ( */
- { ISFUNC, rl_end_kbd_macro }, /* ) */
- { ISFUNC, (Function *)0x0 }, /* * */
- { ISFUNC, (Function *)0x0 }, /* + */
- { ISFUNC, (Function *)0x0 }, /* , */
- { ISFUNC, (Function *)0x0 }, /* - */
- { ISFUNC, (Function *)0x0 }, /* . */
- { ISFUNC, (Function *)0x0 }, /* / */
-
- /* Regular digits. */
- { ISFUNC, (Function *)0x0 }, /* 0 */
- { ISFUNC, (Function *)0x0 }, /* 1 */
- { ISFUNC, (Function *)0x0 }, /* 2 */
- { ISFUNC, (Function *)0x0 }, /* 3 */
- { ISFUNC, (Function *)0x0 }, /* 4 */
- { ISFUNC, (Function *)0x0 }, /* 5 */
- { ISFUNC, (Function *)0x0 }, /* 6 */
- { ISFUNC, (Function *)0x0 }, /* 7 */
- { ISFUNC, (Function *)0x0 }, /* 8 */
- { ISFUNC, (Function *)0x0 }, /* 9 */
-
- /* A little more punctuation. */
- { ISFUNC, (Function *)0x0 }, /* : */
- { ISFUNC, (Function *)0x0 }, /* ; */
- { ISFUNC, (Function *)0x0 }, /* < */
- { ISFUNC, (Function *)0x0 }, /* = */
- { ISFUNC, (Function *)0x0 }, /* > */
- { ISFUNC, (Function *)0x0 }, /* ? */
- { ISFUNC, (Function *)0x0 }, /* @ */
-
- /* Uppercase alphabet. */
- { ISFUNC, rl_do_lowercase_version }, /* A */
- { ISFUNC, rl_do_lowercase_version }, /* B */
- { ISFUNC, rl_do_lowercase_version }, /* C */
- { ISFUNC, rl_do_lowercase_version }, /* D */
- { ISFUNC, rl_do_lowercase_version }, /* E */
- { ISFUNC, rl_do_lowercase_version }, /* F */
- { ISFUNC, rl_do_lowercase_version }, /* G */
- { ISFUNC, rl_do_lowercase_version }, /* H */
- { ISFUNC, rl_do_lowercase_version }, /* I */
- { ISFUNC, rl_do_lowercase_version }, /* J */
- { ISFUNC, rl_do_lowercase_version }, /* K */
- { ISFUNC, rl_do_lowercase_version }, /* L */
- { ISFUNC, rl_do_lowercase_version }, /* M */
- { ISFUNC, rl_do_lowercase_version }, /* N */
- { ISFUNC, rl_do_lowercase_version }, /* O */
- { ISFUNC, rl_do_lowercase_version }, /* P */
- { ISFUNC, rl_do_lowercase_version }, /* Q */
- { ISFUNC, rl_do_lowercase_version }, /* R */
- { ISFUNC, rl_do_lowercase_version }, /* S */
- { ISFUNC, rl_do_lowercase_version }, /* T */
- { ISFUNC, rl_do_lowercase_version }, /* U */
- { ISFUNC, rl_do_lowercase_version }, /* V */
- { ISFUNC, rl_do_lowercase_version }, /* W */
- { ISFUNC, rl_do_lowercase_version }, /* X */
- { ISFUNC, rl_do_lowercase_version }, /* Y */
- { ISFUNC, rl_do_lowercase_version }, /* Z */
-
- /* Some more punctuation. */
- { ISFUNC, (Function *)0x0 }, /* [ */
- { ISFUNC, (Function *)0x0 }, /* \ */
- { ISFUNC, (Function *)0x0 }, /* ] */
- { ISFUNC, (Function *)0x0 }, /* ^ */
- { ISFUNC, (Function *)0x0 }, /* _ */
- { ISFUNC, (Function *)0x0 }, /* ` */
-
- /* Lowercase alphabet. */
- { ISFUNC, (Function *)0x0 }, /* a */
- { ISFUNC, (Function *)0x0 }, /* b */
- { ISFUNC, (Function *)0x0 }, /* c */
- { ISFUNC, (Function *)0x0 }, /* d */
- { ISFUNC, rl_call_last_kbd_macro }, /* e */
- { ISFUNC, (Function *)0x0 }, /* f */
- { ISFUNC, (Function *)0x0 }, /* g */
- { ISFUNC, (Function *)0x0 }, /* h */
- { ISFUNC, (Function *)0x0 }, /* i */
- { ISFUNC, (Function *)0x0 }, /* j */
- { ISFUNC, (Function *)0x0 }, /* k */
- { ISFUNC, (Function *)0x0 }, /* l */
- { ISFUNC, (Function *)0x0 }, /* m */
- { ISFUNC, (Function *)0x0 }, /* n */
- { ISFUNC, (Function *)0x0 }, /* o */
- { ISFUNC, (Function *)0x0 }, /* p */
- { ISFUNC, (Function *)0x0 }, /* q */
- { ISFUNC, rl_re_read_init_file }, /* r */
- { ISFUNC, (Function *)0x0 }, /* s */
- { ISFUNC, (Function *)0x0 }, /* t */
- { ISFUNC, (Function *)0x0 }, /* u */
- { ISFUNC, (Function *)0x0 }, /* v */
- { ISFUNC, (Function *)0x0 }, /* w */
- { ISFUNC, (Function *)0x0 }, /* x */
- { ISFUNC, (Function *)0x0 }, /* y */
- { ISFUNC, (Function *)0x0 }, /* z */
-
- /* Final punctuation. */
- { ISFUNC, (Function *)0x0 }, /* { */
- { ISFUNC, (Function *)0x0 }, /* | */
- { ISFUNC, (Function *)0x0 }, /* } */
- { ISFUNC, (Function *)0x0 }, /* ~ */
- { ISFUNC, rl_backward_kill_line } /* RUBOUT */
-};
diff --git a/gnu/usr.bin/gdb/readline/funmap.c b/gnu/usr.bin/gdb/readline/funmap.c
deleted file mode 100644
index 357e716..0000000
--- a/gnu/usr.bin/gdb/readline/funmap.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/* funmap.c -- attach names to functions. */
-
-/* Copyright (C) 1988,1989 Free Software Foundation, Inc.
-
- This file is part of GNU Readline, a library for reading lines
- of text with interactive input and history editing.
-
- Readline 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.
-
- Readline 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 Readline; see the file COPYING. If not, write to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#define STATIC_MALLOC
-#ifndef STATIC_MALLOC
-extern char *xmalloc (), *xrealloc ();
-#else
-static char *xmalloc (), *xrealloc ();
-#endif
-
-#ifndef FILE
-#include <stdio.h>
-#endif /* FILE */
-
-#include "readline.h"
-
-FUNMAP **funmap = (FUNMAP **)NULL;
-static int funmap_size = 0;
-
-static int just_testing_ar_tmp = 0;
-static int just_testing_ar_tmp_2 = 5;
-int foo_testing_ar;
-
-static int funmap_entry = 0;
-
-static FUNMAP default_funmap[] = {
- { "beginning-of-line", rl_beg_of_line },
- { "backward-char", rl_backward },
- { "delete-char", rl_delete },
- { "end-of-line", rl_end_of_line },
- { "forward-char", rl_forward },
- { "accept-line", rl_newline },
- { "kill-line", rl_kill_line },
- { "clear-screen", rl_clear_screen },
- { "next-history", rl_get_next_history },
- { "previous-history", rl_get_previous_history },
- { "quoted-insert", rl_quoted_insert },
- { "reverse-search-history", rl_reverse_search_history },
- { "forward-search-history", rl_forward_search_history },
- { "transpose-chars", rl_transpose_chars },
- { "unix-line-discard", rl_unix_line_discard },
- { "unix-word-rubout", rl_unix_word_rubout },
- { "yank", rl_yank },
- { "yank-pop", rl_yank_pop },
- { "yank-nth-arg", rl_yank_nth_arg },
- { "backward-delete-char", rl_rubout },
- { "backward-word", rl_backward_word },
- { "kill-word", rl_kill_word },
- { "forward-word", rl_forward_word },
- { "tab-insert", rl_tab_insert },
- { "backward-kill-word", rl_backward_kill_word },
- { "backward-kill-line", rl_backward_kill_line },
- { "transpose-words", rl_transpose_words },
- { "digit-argument", rl_digit_argument },
- { "complete", rl_complete },
- { "possible-completions", rl_possible_completions },
- { "do-lowercase-version", rl_do_lowercase_version },
- { "digit-argument", rl_digit_argument },
- { "universal-argument", rl_universal_argument },
- { "abort", rl_abort },
- { "undo", rl_undo_command },
- { "upcase-word", rl_upcase_word },
- { "downcase-word", rl_downcase_word },
- { "capitalize-word", rl_capitalize_word },
- { "revert-line", rl_revert_line },
- { "beginning-of-history", rl_beginning_of_history },
- { "end-of-history", rl_end_of_history },
- { "self-insert", rl_insert },
- { "start-kbd-macro", rl_start_kbd_macro },
- { "end-kbd-macro", rl_end_kbd_macro },
- { "re-read-init-file", rl_re_read_init_file },
-#ifdef VI_MODE
- { "vi-movement-mode", rl_vi_movement_mode },
- { "vi-insertion-mode", rl_vi_insertion_mode },
- { "vi-arg-digit", rl_vi_arg_digit },
- { "vi-prev-word", rl_vi_prev_word },
- { "vi-next-word", rl_vi_next_word },
- { "vi-char-search", rl_vi_char_search },
- { "vi-editing-mode", rl_vi_editing_mode },
- { "vi-eof-maybe", rl_vi_eof_maybe },
- { "vi-append-mode", rl_vi_append_mode },
- { "vi-put", rl_vi_put },
- { "vi-append-eol", rl_vi_append_eol },
- { "vi-insert-beg", rl_vi_insert_beg },
- { "vi-delete", rl_vi_delete },
- { "vi-comment", rl_vi_comment },
- { "vi-first-print", rl_vi_first_print },
- { "vi-fword", rl_vi_fword },
- { "vi-fWord", rl_vi_fWord },
- { "vi-bword", rl_vi_bword },
- { "vi-bWord", rl_vi_bWord },
- { "vi-eword", rl_vi_eword },
- { "vi-eWord", rl_vi_eWord },
- { "vi-end-word", rl_vi_end_word },
- { "vi-change-case", rl_vi_change_case },
- { "vi-match", rl_vi_match },
- { "vi-bracktype", rl_vi_bracktype },
- { "vi-change-char", rl_vi_change_char },
- { "vi-yank-arg", rl_vi_yank_arg },
- { "vi-search", rl_vi_search },
- { "vi-search-again", rl_vi_search_again },
- { "vi-dosearch", rl_vi_dosearch },
- { "vi-subst", rl_vi_subst },
- { "vi-overstrike", rl_vi_overstrike },
- { "vi-overstrike-delete", rl_vi_overstrike_delete },
- { "vi-replace, ", rl_vi_replace },
- { "vi-column", rl_vi_column },
- { "vi-delete-to", rl_vi_delete_to },
- { "vi-change-to", rl_vi_change_to },
- { "vi-yank-to", rl_vi_yank_to },
- { "vi-complete", rl_vi_complete },
-#endif /* VI_MODE */
-
- {(char *)NULL, (Function *)NULL }
-};
-
-rl_add_funmap_entry (name, function)
- char *name;
- Function *function;
-{
- if (funmap_entry + 2 >= funmap_size)
- if (!funmap)
- funmap = (FUNMAP **)xmalloc ((funmap_size = 80) * sizeof (FUNMAP *));
- else
- funmap =
- (FUNMAP **)xrealloc (funmap, (funmap_size += 80) * sizeof (FUNMAP *));
-
- funmap[funmap_entry] = (FUNMAP *)xmalloc (sizeof (FUNMAP));
- funmap[funmap_entry]->name = name;
- funmap[funmap_entry]->function = function;
-
- funmap[++funmap_entry] = (FUNMAP *)NULL;
-}
-
-static int funmap_initialized = 0;
-
-/* Make the funmap contain all of the default entries. */
-rl_initialize_funmap ()
-{
- register int i;
-
- if (funmap_initialized)
- return;
-
- for (i = 0; default_funmap[i].name; i++)
- rl_add_funmap_entry (default_funmap[i].name, default_funmap[i].function);
-
- funmap_initialized = 1;
-}
-
-/* Things that mean `Control'. */
-char *possible_control_prefixes[] = {
- "Control-", "C-", "CTRL-", (char *)NULL
-};
-
-char *possible_meta_prefixes[] = {
- "Meta", "M-", (char *)NULL
-};
-
-#ifdef STATIC_MALLOC
-
-/* **************************************************************** */
-/* */
-/* xmalloc and xrealloc () */
-/* */
-/* **************************************************************** */
-
-static char *
-xmalloc (bytes)
- int bytes;
-{
- static memory_error_and_abort ();
- char *temp = (char *)malloc (bytes);
-
- if (!temp)
- memory_error_and_abort ();
- return (temp);
-}
-
-static char *
-xrealloc (pointer, bytes)
- char *pointer;
- int bytes;
-{
- static memory_error_and_abort ();
- char *temp = (char *)realloc (pointer, bytes);
-
- if (!temp)
- memory_error_and_abort ();
- return (temp);
-}
-
-static
-memory_error_and_abort ()
-{
- fprintf (stderr, "history: Out of virtual memory!\n");
- abort ();
-}
-#endif /* STATIC_MALLOC */
diff --git a/gnu/usr.bin/gdb/readline/history.c b/gnu/usr.bin/gdb/readline/history.c
deleted file mode 100644
index 7087718..0000000
--- a/gnu/usr.bin/gdb/readline/history.c
+++ /dev/null
@@ -1,1462 +0,0 @@
-/* History.c -- standalone history library */
-
-/* Copyright (C) 1989 Free Software Foundation, Inc.
-
- This file contains the GNU History Library (the Library), a set of
- routines for managing the text of previously typed lines.
-
- The Library 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.
-
- The Library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- The GNU General Public License is often shipped with GNU software, and
- is generally kept in a file called COPYING or LICENSE. If you do not
- have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* The goal is to make the implementation transparent, so that you
- don't have to know what data types are used, just what functions
- you can call. I think I have done that. */
-
-/* Remove these declarations when we have a complete libgnu.a. */
-#define STATIC_MALLOC
-#ifndef STATIC_MALLOC
-extern char *xmalloc (), *xrealloc ();
-#else
-static char *xmalloc (), *xrealloc ();
-#endif
-
-#include <stdio.h>
-
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else
-#if defined (sparc) && defined (sun)
-#include <alloca.h>
-#else
-extern char *alloca ();
-#endif
-#endif
-
-#include "history.h"
-
-#ifndef savestring
-#define savestring(x) (char *)strcpy (xmalloc (1 + strlen (x)), (x))
-#endif
-
-#ifndef whitespace
-#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
-#endif
-
-#ifndef digit
-#define digit(c) ((c) >= '0' && (c) <= '9')
-#endif
-
-#ifndef member
-#define member(c, s) ((c) ? index ((s), (c)) : 0)
-#endif
-
-/* **************************************************************** */
-/* */
-/* History functions */
-/* */
-/* **************************************************************** */
-
-/* An array of HIST_ENTRY. This is where we store the history. */
-static HIST_ENTRY **the_history = (HIST_ENTRY **)NULL;
-
-/* Non-zero means that we have enforced a limit on the amount of
- history that we save. */
-static int history_stifled = 0;
-
-/* If HISTORY_STIFLED is non-zero, then this is the maximum number of
- entries to remember. */
-static int max_input_history;
-
-/* The current location of the interactive history pointer. Just makes
- life easier for outside callers. */
-static int history_offset = 0;
-
-/* The number of strings currently stored in the input_history list. */
-static int history_length = 0;
-
-/* The current number of slots allocated to the input_history. */
-static int history_size = 0;
-
-/* The number of slots to increase the_history by. */
-#define DEFAULT_HISTORY_GROW_SIZE 50
-
-/* The character that represents the start of a history expansion
- request. This is usually `!'. */
-char history_expansion_char = '!';
-
-/* The character that invokes word substitution if found at the start of
- a line. This is usually `^'. */
-char history_subst_char = '^';
-
-/* During tokenization, if this character is seen as the first character
- of a word, then it, and all subsequent characters upto a newline are
- ignored. For a Bourne shell, this should be '#'. Bash special cases
- the interactive comment character to not be a comment delimiter. */
-char history_comment_char = '\0';
-
-/* The list of characters which inhibit the expansion of text if found
- immediately following history_expansion_char. */
-char *history_no_expand_chars = " \t\n\r=";
-
-/* The logical `base' of the history array. It defaults to 1. */
-int history_base = 1;
-
-/* Begin a session in which the history functions might be used. This
- initializes interactive variables. */
-void
-using_history ()
-{
- history_offset = history_length;
-}
-
-/* Place STRING at the end of the history list. The data field
- is set to NULL. */
-void
-add_history (string)
- char *string;
-{
- HIST_ENTRY *temp;
-
- if (history_stifled && (history_length == max_input_history)) {
- register int i;
-
- /* If the history is stifled, and history_length is zero,
- and it equals max_input_history, we don't save items. */
- if (!history_length)
- return;
-
- /* If there is something in the slot, then remove it. */
- if (the_history[0]) {
- free (the_history[0]->line);
- free (the_history[0]);
- }
-
- for (i = 0; i < history_length; i++)
- the_history[i] = the_history[i + 1];
-
- history_base++;
-
- } else {
-
- if (!history_size) {
- the_history =
- (HIST_ENTRY **)xmalloc ((history_size = DEFAULT_HISTORY_GROW_SIZE)
- * sizeof (HIST_ENTRY *));
- history_length = 1;
-
- } else {
- if (history_length == (history_size - 1)) {
- the_history =
- (HIST_ENTRY **)xrealloc (the_history,
- ((history_size += DEFAULT_HISTORY_GROW_SIZE)
- * sizeof (HIST_ENTRY *)));
- }
- history_length++;
- }
- }
-
- temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
- temp->line = savestring (string);
- temp->data = (char *)NULL;
-
- the_history[history_length] = (HIST_ENTRY *)NULL;
- the_history[history_length - 1] = temp;
-}
-
-/* Make the history entry at WHICH have LINE and DATA. This returns
- the old entry so you can dispose of the data. In the case of an
- invalid WHICH, a NULL pointer is returned. */
-HIST_ENTRY *
-replace_history_entry (which, line, data)
- int which;
- char *line;
- char *data;
-{
- HIST_ENTRY *temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
- HIST_ENTRY *old_value;
-
- if (which >= history_length)
- return ((HIST_ENTRY *)NULL);
-
- old_value = the_history[which];
-
- temp->line = savestring (line);
- temp->data = data;
- the_history[which] = temp;
-
- return (old_value);
-}
-
-/* Returns the magic number which says what history element we are
- looking at now. In this implementation, it returns history_offset. */
-int
-where_history ()
-{
- return (history_offset);
-}
-
-/* Search the history for STRING, starting at history_offset.
- If DIRECTION < 0, then the search is through previous entries,
- else through subsequent. If the string is found, then
- current_history () is the history entry, and the value of this function
- is the offset in the line of that history entry that the string was
- found in. Otherwise, nothing is changed, and a -1 is returned. */
-int
-history_search (string, direction)
- char *string;
- int direction;
-{
- register int i = history_offset;
- register int reverse = (direction < 0);
- register char *line;
- register int index;
- int string_len = strlen (string);
-
- /* Take care of trivial cases first. */
-
- if (!history_length || (i == history_length) && !reverse)
- return (-1);
-
- if (reverse && (i == history_length))
- i--;
-
- while (1)
- {
- /* Search each line in the history list for STRING. */
-
- /* At limit for direction? */
- if ((reverse && i < 0) ||
- (!reverse && i == history_length))
- return (-1);
-
- line = the_history[i]->line;
- index = strlen (line);
-
- /* If STRING is longer than line, no match. */
- if (string_len > index)
- goto next_line;
-
- /* Do the actual search. */
- if (reverse)
- {
- index -= string_len;
-
- while (index >= 0)
- {
- if (strncmp (string, line + index, string_len) == 0)
- {
- history_offset = i;
- return (index);
- }
- index--;
- }
- }
- else
- {
- register int limit = (string_len - index) + 1;
- index = 0;
-
- while (index < limit)
- {
- if (strncmp (string, line + index, string_len) == 0)
- {
- history_offset = i;
- return (index);
- }
- index++;
- }
- }
- next_line:
- if (reverse)
- i--;
- else
- i++;
- }
-}
-
-/* Remove history element WHICH from the history. The removed
- element is returned to you so you can free the line, data,
- and containing structure. */
-HIST_ENTRY *
-remove_history (which)
- int which;
-{
- HIST_ENTRY *return_value;
-
- if (which >= history_length || !history_length)
- return_value = (HIST_ENTRY *)NULL;
- else
- {
- register int i;
- return_value = the_history[which];
-
- for (i = which; i < history_length; i++)
- the_history[i] = the_history[i + 1];
-
- history_length--;
- }
- return (return_value);
-}
-
-/* Stifle the history list, remembering only MAX number of lines. */
-void
-stifle_history (max)
- int max;
-{
- if (history_length > max)
- {
- register int i, j;
-
- /* This loses because we cannot free the data. */
- for (i = 0; i < (history_length - max); i++)
- {
- free (the_history[i]->line);
- free (the_history[i]);
- }
- history_base = i;
- for (j = 0, i = history_length - max; j < max; i++, j++)
- the_history[j] = the_history[i];
- the_history[j] = (HIST_ENTRY *)NULL;
- history_length = j;
- }
- history_stifled = 1;
- max_input_history = max;
-}
-
-/* Stop stifling the history. This returns the previous amount the history
- was stifled by. The value is positive if the history was stifled, negative
- if it wasn't. */
-int
-unstifle_history ()
-{
- int result = max_input_history;
- if (history_stifled)
- {
- result = - result;
- history_stifled = 0;
- }
- return (result);
-}
-
-/* Return the string that should be used in the place of this
- filename. This only matters when you don't specify the
- filename to read_history (), or write_history (). */
-static char *
-history_filename (filename)
- char *filename;
-{
- char *return_val = filename ? savestring (filename) : (char *)NULL;
-
- if (!return_val)
- {
- char *home = (char *)getenv ("HOME");
- if (!home) home = ".";
- return_val = (char *)xmalloc (2 + strlen (home) + strlen (".history"));
- strcpy (return_val, home);
- strcat (return_val, "/");
- strcat (return_val, ".history");
- }
- return (return_val);
-}
-
-/* What to use until the line gets too big. */
-#define TYPICAL_LINE_SIZE 2048
-
-/* Add the contents of FILENAME to the history list, a line at a time.
- If FILENAME is NULL, then read from ~/.history. Returns 0 if
- successful, or errno if not. */
-int
-read_history (filename)
- char *filename;
-{
- char *input = history_filename (filename);
- FILE *file = fopen (input, "r");
- char *line = (char *)xmalloc (TYPICAL_LINE_SIZE);
- int line_size = TYPICAL_LINE_SIZE;
- int done = 0;
-
- if (!file)
- {
- extern int errno;
- free (line);
- return (errno);
- }
-
- while (!done)
- {
- int c;
- int i;
-
- i = 0;
- while (!(done = ((c = getc (file)) == EOF)))
- {
- if (c == '\n')
- break;
-
- line [i++] = c;
- if (i == line_size)
- line = (char *)xrealloc (line, line_size += TYPICAL_LINE_SIZE);
- }
- line[i] = '\0';
- if (line[0])
- add_history (line);
- }
- free (line);
- fclose (file);
- return (0);
-}
-
-/* Overwrite FILENAME with the current history. If FILENAME is NULL,
- then write the history list to ~/.history. Values returned
- are as in read_history ().*/
-int
-write_history (filename)
- char *filename;
-{
- extern int errno;
- char *output = history_filename (filename);
- FILE *file = fopen (output, "w");
- register int i;
-
- if (!file) return (errno);
- if (!history_length) return (0);
-
- for (i = 0; i < history_length; i++)
- fprintf (file, "%s\n", the_history[i]->line);
-
- fclose (file);
- return (0);
-}
-
-/* Return the history entry at the current position, as determined by
- history_offset. If there is no entry there, return a NULL pointer. */
-HIST_ENTRY *
-current_history ()
-{
- if ((history_offset == history_length) || !the_history)
- return ((HIST_ENTRY *)NULL);
- else
- return (the_history[history_offset]);
-}
-
-/* Back up history_offset to the previous history entry, and return
- a pointer to that entry. If there is no previous entry then return
- a NULL pointer. */
-HIST_ENTRY *
-previous_history ()
-{
- if (!history_offset)
- return ((HIST_ENTRY *)NULL);
- else
- return (the_history[--history_offset]);
-}
-
-/* Move history_offset forward to the next history entry, and return
- a pointer to that entry. If there is no next entry then return a
- NULL pointer. */
-HIST_ENTRY *
-next_history ()
-{
- if (history_offset == history_length)
- return ((HIST_ENTRY *)NULL);
- else
- return (the_history[++history_offset]);
-}
-
-/* Return the current history array. The caller has to be carefull, since this
- is the actual array of data, and could be bashed or made corrupt easily.
- The array is terminated with a NULL pointer. */
-HIST_ENTRY **
-history_list ()
-{
- return (the_history);
-}
-
-/* Return the history entry which is logically at OFFSET in the history array.
- OFFSET is relative to history_base. */
-HIST_ENTRY *
-history_get (offset)
- int offset;
-{
- int index = offset - history_base;
-
- if (index >= history_length ||
- index < 0 ||
- !the_history)
- return ((HIST_ENTRY *)NULL);
- return (the_history[index]);
-}
-
-/* Search for STRING in the history list. DIR is < 0 for searching
- backwards. POS is an absolute index into the history list at
- which point to begin searching. */
-int
-history_search_pos (string, dir, pos)
- char *string;
- int dir, pos;
-{
- int ret, old = where_history ();
- history_set_pos (pos);
- if (history_search (string, dir) == -1)
- {
- history_set_pos (old);
- return (-1);
- }
- ret = where_history ();
- history_set_pos (old);
- return ret;
-}
-
-/* Make the current history item be the one at POS, an absolute index.
- Returns zero if POS is out of range, else non-zero. */
-int
-history_set_pos (pos)
- int pos;
-{
- if (pos > history_length || pos < 0 || !the_history)
- return (0);
- history_offset = pos;
- return (1);
-}
-
-
-/* **************************************************************** */
-/* */
-/* History Expansion */
-/* */
-/* **************************************************************** */
-
-/* Hairy history expansion on text, not tokens. This is of general
- use, and thus belongs in this library. */
-
-/* The last string searched for in a !?string? search. */
-static char *search_string = (char *)NULL;
-
-/* Return the event specified at TEXT + OFFSET modifying OFFSET to
- point to after the event specifier. Just a pointer to the history
- line is returned; NULL is returned in the event of a bad specifier.
- You pass STRING with *INDEX equal to the history_expansion_char that
- begins this specification.
- DELIMITING_QUOTE is a character that is allowed to end the string
- specification for what to search for in addition to the normal
- characters `:', ` ', `\t', `\n', and sometimes `?'.
- So you might call this function like:
- line = get_history_event ("!echo:p", &index, 0); */
-char *
-get_history_event (string, caller_index, delimiting_quote)
- char *string;
- int *caller_index;
- int delimiting_quote;
-{
- register int i = *caller_index;
- int which, sign = 1;
- HIST_ENTRY *entry;
-
- /* The event can be specified in a number of ways.
-
- !! the previous command
- !n command line N
- !-n current command-line minus N
- !str the most recent command starting with STR
- !?str[?]
- the most recent command containing STR
-
- All values N are determined via HISTORY_BASE. */
-
- if (string[i] != history_expansion_char)
- return ((char *)NULL);
-
- /* Move on to the specification. */
- i++;
-
- /* Handle !! case. */
- if (string[i] == history_expansion_char)
- {
- i++;
- which = history_base + (history_length - 1);
- *caller_index = i;
- goto get_which;
- }
-
- /* Hack case of numeric line specification. */
- read_which:
- if (string[i] == '-')
- {
- sign = -1;
- i++;
- }
-
- if (digit (string[i]))
- {
- int start = i;
-
- /* Get the extent of the digits. */
- for (; digit (string[i]); i++);
-
- /* Get the digit value. */
- sscanf (string + start, "%d", &which);
-
- *caller_index = i;
-
- if (sign < 0)
- which = (history_length + history_base) - which;
-
- get_which:
- if (entry = history_get (which))
- return (entry->line);
-
- return ((char *)NULL);
- }
-
- /* This must be something to search for. If the spec begins with
- a '?', then the string may be anywhere on the line. Otherwise,
- the string must be found at the start of a line. */
- {
- int index;
- char *temp;
- int substring_okay = 0;
-
- if (string[i] == '?')
- {
- substring_okay++;
- i++;
- }
-
- for (index = i; string[i]; i++)
- if (whitespace (string[i]) ||
- string[i] == '\n' ||
- string[i] == ':' ||
- (substring_okay && string[i] == '?') ||
- string[i] == delimiting_quote)
- break;
-
- temp = (char *)alloca (1 + (i - index));
- strncpy (temp, &string[index], (i - index));
- temp[i - index] = '\0';
-
- if (string[i] == '?')
- i++;
-
- *caller_index = i;
-
- search_again:
-
- index = history_search (temp, -1);
-
- if (index < 0)
- search_lost:
- {
- history_offset = history_length;
- return ((char *)NULL);
- }
-
- if (index == 0 || substring_okay ||
- (strncmp (temp, the_history[history_offset]->line,
- strlen (temp)) == 0))
- {
- search_won:
- entry = current_history ();
- history_offset = history_length;
-
- /* If this was a substring search, then remember the string that
- we matched for word substitution. */
- if (substring_okay)
- {
- if (search_string)
- free (search_string);
- search_string = savestring (temp);
- }
-
- return (entry->line);
- }
-
- if (history_offset)
- history_offset--;
- else
- goto search_lost;
-
- goto search_again;
- }
-}
-
-/* Expand the string STRING, placing the result into OUTPUT, a pointer
- to a string. Returns:
-
- 0) If no expansions took place (or, if the only change in
- the text was the de-slashifying of the history expansion
- character)
- 1) If expansions did take place
- -1) If there was an error in expansion.
-
- If an error ocurred in expansion, then OUTPUT contains a descriptive
- error message. */
-int
-history_expand (string, output)
- char *string;
- char **output;
-{
- register int j, l = strlen (string);
- int i, word_spec_error = 0;
- int cc, modified = 0;
- char *word_spec, *event;
- int starting_index, only_printing = 0, substitute_globally = 0;
-
- char *get_history_word_specifier (), *rindex ();
-
- /* The output string, and its length. */
- int len = 0;
- char *result = (char *)NULL;
-
- /* Used in add_string; */
- char *temp, tt[2], tbl[3];
-
- /* Prepare the buffer for printing error messages. */
- result = (char *)xmalloc (len = 255);
-
- result[0] = tt[1] = tbl[2] = '\0';
- tbl[0] = '\\';
- tbl[1] = history_expansion_char;
-
- /* Grovel the string. Only backslash can quote the history escape
- character. We also handle arg specifiers. */
-
- /* Before we grovel forever, see if the history_expansion_char appears
- anywhere within the text. */
-
- /* The quick substitution character is a history expansion all right. That
- is to say, "^this^that^" is equivalent to "!!:s^this^that^", and in fact,
- that is the substitution that we do. */
- if (string[0] == history_subst_char)
- {
- char *format_string = (char *)alloca (10 + strlen (string));
-
- sprintf (format_string, "%c%c:s%s",
- history_expansion_char, history_expansion_char,
- string);
- string = format_string;
- l += 4;
- goto grovel;
- }
-
- /* If not quick substitution, still maybe have to do expansion. */
-
- /* `!' followed by one of the characters in history_no_expand_chars
- is NOT an expansion. */
- for (i = 0; string[i]; i++)
- if (string[i] == history_expansion_char)
- if (!string[i + 1] || member (string[i + 1], history_no_expand_chars))
- continue;
- else
- goto grovel;
-
- free (result);
- *output = savestring (string);
- return (0);
-
- grovel:
-
- for (i = j = 0; i < l; i++)
- {
- int tchar = string[i];
- if (tchar == history_expansion_char)
- tchar = -3;
-
- switch (tchar)
- {
- case '\\':
- if (string[i + 1] == history_expansion_char)
- {
- i++;
- temp = tbl;
- goto do_add;
- }
- else
- goto add_char;
-
- /* case history_expansion_char: */
- case -3:
- starting_index = i + 1;
- cc = string[i + 1];
-
- /* If the history_expansion_char is followed by one of the
- characters in history_no_expand_chars, then it is not a
- candidate for expansion of any kind. */
- if (member (cc, history_no_expand_chars))
- goto add_char;
-
- /* There is something that is listed as a `word specifier' in csh
- documentation which means `the expanded text to this point'.
- That is not a word specifier, it is an event specifier. */
-
- if (cc == '#')
- goto hack_pound_sign;
-
- /* If it is followed by something that starts a word specifier,
- then !! is implied as the event specifier. */
-
- if (member (cc, ":$*%^"))
- {
- char fake_s[2];
- int fake_i = 0;
- i++;
- fake_s[0] = fake_s[1] = history_expansion_char;
- fake_s[2] = '\0';
- event = get_history_event (fake_s, &fake_i);
- }
- else
- {
- int quoted_search_delimiter = 0;
-
- /* If the character before this `!' is a double or single
- quote, then this expansion takes place inside of the
- quoted string. If we have to search for some text ("!foo"),
- allow the delimiter to end the search string. */
- if (i && (string[i - 1] == '\'' || string[i - 1] == '"'))
- quoted_search_delimiter = string[i - 1];
-
- event = get_history_event (string, &i, quoted_search_delimiter);
- }
-
- if (!event)
- event_not_found:
- {
- int l = 1 + (i - starting_index);
-
- temp = (char *)alloca (1 + l);
- strncpy (temp, string + starting_index, l);
- temp[l - 1] = 0;
- sprintf (result, "%s: %s.", temp,
- word_spec_error ? "Bad word specifier" : "Event not found");
- error_exit:
- *output = result;
- return (-1);
- }
-
- /* If a word specifier is found, then do what that requires. */
- starting_index = i;
-
- word_spec = get_history_word_specifier (string, event, &i);
-
- /* There is no such thing as a `malformed word specifier'. However,
- it is possible for a specifier that has no match. In that case,
- we complain. */
- if (word_spec == (char *)-1)
- bad_word_spec:
- {
- word_spec_error++;
- goto event_not_found;
- }
-
- /* If no word specifier, than the thing of interest was the event. */
- if (!word_spec)
- temp = event;
- else
- {
- temp = (char *)alloca (1 + strlen (word_spec));
- strcpy (temp, word_spec);
- free (word_spec);
- }
-
- /* Perhaps there are other modifiers involved. Do what they say. */
-
- hack_specials:
-
- if (string[i] == ':')
- {
- char *tstr;
-
- switch (string[i + 1])
- {
- /* :p means make this the last executed line. So we
- return an error state after adding this line to the
- history. */
- case 'p':
- only_printing++;
- goto next_special;
-
- /* :t discards all but the last part of the pathname. */
- case 't':
- tstr = rindex (temp, '/');
- if (tstr)
- temp = ++tstr;
- goto next_special;
-
- /* :h discards the last part of a pathname. */
- case 'h':
- tstr = rindex (temp, '/');
- if (tstr)
- *tstr = '\0';
- goto next_special;
-
- /* :r discards the suffix. */
- case 'r':
- tstr = rindex (temp, '.');
- if (tstr)
- *tstr = '\0';
- goto next_special;
-
- /* :e discards everything but the suffix. */
- case 'e':
- tstr = rindex (temp, '.');
- if (tstr)
- temp = tstr;
- goto next_special;
-
- /* :s/this/that substitutes `this' for `that'. */
- /* :gs/this/that substitutes `this' for `that' globally. */
- case 'g':
- if (string[i + 2] == 's')
- {
- i++;
- substitute_globally = 1;
- goto substitute;
- }
- else
-
- case 's':
- substitute:
- {
- char *this, *that, *new_event;
- int delimiter = 0;
- int si, l_this, l_that, l_temp = strlen (temp);
-
- if (i + 2 < strlen (string))
- delimiter = string[i + 2];
-
- if (!delimiter)
- break;
-
- i += 3;
-
- /* Get THIS. */
- for (si = i; string[si] && string[si] != delimiter; si++);
- l_this = (si - i);
- this = (char *)alloca (1 + l_this);
- strncpy (this, string + i, l_this);
- this[l_this] = '\0';
-
- i = si;
- if (string[si])
- i++;
-
- /* Get THAT. */
- for (si = i; string[si] && string[si] != delimiter; si++);
- l_that = (si - i);
- that = (char *)alloca (1 + l_that);
- strncpy (that, string + i, l_that);
- that[l_that] = '\0';
-
- i = si;
- if (string[si]) i++;
-
- /* Ignore impossible cases. */
- if (l_this > l_temp)
- goto cant_substitute;
-
- /* Find the first occurrence of THIS in TEMP. */
- si = 0;
- for (; (si + l_this) <= l_temp; si++)
- if (strncmp (temp + si, this, l_this) == 0)
- {
- new_event =
- (char *)alloca (1 + (l_that - l_this) + l_temp);
- strncpy (new_event, temp, si);
- strncpy (new_event + si, that, l_that);
- strncpy (new_event + si + l_that,
- temp + si + l_this,
- l_temp - (si + l_this));
- new_event[(l_that - l_this) + l_temp] = '\0';
- temp = new_event;
-
- if (substitute_globally)
- {
- si += l_that;
- l_temp = strlen (temp);
- substitute_globally++;
- continue;
- }
-
- goto hack_specials;
- }
-
- cant_substitute:
-
- if (substitute_globally > 1)
- {
- substitute_globally = 0;
- goto hack_specials;
- }
-
- goto event_not_found;
- }
-
- /* :# is the line so far. Note that we have to
- alloca () it since RESULT could be realloc ()'ed
- below in add_string. */
- case '#':
- hack_pound_sign:
- if (result)
- {
- temp = (char *)alloca (1 + strlen (result));
- strcpy (temp, result);
- }
- else
- temp = "";
-
- next_special:
- i += 2;
- goto hack_specials;
- }
-
- }
- /* Believe it or not, we have to back the pointer up by one. */
- --i;
- goto add_string;
-
- /* A regular character. Just add it to the output string. */
- default:
- add_char:
- tt[0] = string[i];
- temp = tt;
- goto do_add;
-
- add_string:
- modified++;
-
- do_add:
- j += strlen (temp);
- while (j > len)
- result = (char *)xrealloc (result, (len += 255));
-
- strcpy (result + (j - strlen (temp)), temp);
- }
- }
-
- *output = result;
-
- if (only_printing)
- {
- add_history (result);
- return (-1);
- }
-
- return (modified != 0);
-}
-
-/* Return a consed string which is the word specified in SPEC, and found
- in FROM. NULL is returned if there is no spec. -1 is returned if
- the word specified cannot be found. CALLER_INDEX is the offset in
- SPEC to start looking; it is updated to point to just after the last
- character parsed. */
-char *
-get_history_word_specifier (spec, from, caller_index)
- char *spec, *from;
- int *caller_index;
-{
- register int i = *caller_index;
- int first, last;
- int expecting_word_spec = 0;
- char *history_arg_extract ();
-
- /* The range of words to return doesn't exist yet. */
- first = last = 0;
-
- /* If we found a colon, then this *must* be a word specification. If
- it isn't, then it is an error. */
- if (spec[i] == ':')
- i++, expecting_word_spec++;
-
- /* Handle special cases first. */
-
- /* `%' is the word last searched for. */
- if (spec[i] == '%')
- {
- *caller_index = i + 1;
- if (search_string)
- return (savestring (search_string));
- else
- return (savestring (""));
- }
-
- /* `*' matches all of the arguments, but not the command. */
- if (spec[i] == '*')
- {
- *caller_index = i + 1;
- return (history_arg_extract (1, '$', from));
- }
-
- /* `$' is last arg. */
- if (spec[i] == '$')
- {
- *caller_index = i + 1;
- return (history_arg_extract ('$', '$', from));
- }
-
- /* Try to get FIRST and LAST figured out. */
- if (spec[i] == '-' || spec[i] == '^')
- {
- first = 1;
- goto get_last;
- }
-
- get_first:
- if (digit (spec[i]) && expecting_word_spec)
- {
- sscanf (spec + i, "%d", &first);
- for (; digit (spec[i]); i++);
- }
- else
- return ((char *)NULL);
-
- get_last:
- if (spec[i] == '^')
- {
- i++;
- last = 1;
- goto get_args;
- }
-
- if (spec[i] != '-')
- {
- last = first;
- goto get_args;
- }
-
- i++;
-
- if (digit (spec[i]))
- {
- sscanf (spec + i, "%d", &last);
- for (; digit (spec[i]); i++);
- }
- else
- if (spec[i] == '$')
- {
- i++;
- last = '$';
- }
-
- get_args:
- {
- char *result = (char *)NULL;
-
- *caller_index = i;
-
- if (last >= first)
- result = history_arg_extract (first, last, from);
-
- if (result)
- return (result);
- else
- return ((char *)-1);
- }
-}
-
-/* Extract the args specified, starting at FIRST, and ending at LAST.
- The args are taken from STRING. */
-char *
-history_arg_extract (first, last, string)
- int first, last;
- char *string;
-{
- register int i, len;
- char *result = (char *)NULL;
- int size = 0, offset = 0;
-
- char **history_tokenize (), **list;
-
- if (!(list = history_tokenize (string)))
- return ((char *)NULL);
-
- for (len = 0; list[len]; len++);
-
- if (last == '$')
- last = len - 1;
-
- if (first == '$')
- first = len - 1;
-
- last++;
-
- if (first > len || last > len)
- result = ((char *)NULL);
- else {
- for (i = first; i < last; i++)
- {
- int l = strlen (list[i]);
-
- if (!result)
- result = (char *)xmalloc ((size = (2 + l)));
- else
- result = (char *)xrealloc (result, (size += (2 + l)));
- strcpy (result + offset, list[i]);
- offset += l;
- if (i + 1 < last)
- {
- strcpy (result + offset, " ");
- offset++;
- }
- }
- }
-
- for (i = 0; i < len; i++)
- free (list[i]);
-
- free (list);
-
- return (result);
-}
-
-#define slashify_in_quotes "\\`\"$"
-
-/* Return an array of tokens, much as the shell might. The tokens are
- parsed out of STRING. */
-char **
-history_tokenize (string)
- char *string;
-{
- char **result = (char **)NULL;
- register int i, start, result_index, size;
- int len;
-
- i = result_index = size = 0;
-
- /* Get a token, and stuff it into RESULT. The tokens are split
- exactly where the shell would split them. */
- get_token:
-
- /* Skip leading whitespace. */
- for (; string[i] && whitespace(string[i]); i++);
-
- start = i;
-
- if (!string[i] || string[i] == history_comment_char)
- return (result);
-
- if (member (string[i], "()\n")) {
- i++;
- goto got_token;
- }
-
- if (member (string[i], "<>;&|")) {
- int peek = string[i + 1];
-
- if (peek == string[i]) {
- if (peek == '<') {
- if (string[1 + 2] == '-')
- i++;
- i += 2;
- goto got_token;
- }
-
- if (member (peek, ">:&|")) {
- i += 2;
- goto got_token;
- }
- } else {
- if ((peek == '&' &&
- (string[i] == '>' || string[i] == '<')) ||
- ((peek == '>') &&
- (string[i] == '&'))) {
- i += 2;
- goto got_token;
- }
- }
- i++;
- goto got_token;
- }
-
- /* Get word from string + i; */
- {
- int delimiter = 0;
-
- if (member (string[i], "\"'`"))
- delimiter = string[i++];
-
- for (;string[i]; i++) {
-
- if (string[i] == '\\') {
-
- if (string[i + 1] == '\n') {
- i++;
- continue;
- } else {
- if (delimiter != '\'')
- if ((delimiter != '"') ||
- (member (string[i], slashify_in_quotes))) {
- i++;
- continue;
- }
- }
- }
-
- if (delimiter && string[i] == delimiter) {
- delimiter = 0;
- continue;
- }
-
- if (!delimiter && (member (string[i], " \t\n;&()|<>")))
- goto got_token;
-
- if (!delimiter && member (string[i], "\"'`")) {
- delimiter = string[i];
- continue;
- }
- }
- got_token:
-
- len = i - start;
- if (result_index + 2 >= size) {
- if (!size)
- result = (char **)xmalloc ((size = 10) * (sizeof (char *)));
- else
- result =
- (char **)xrealloc (result, ((size += 10) * (sizeof (char *))));
- }
- result[result_index] = (char *)xmalloc (1 + len);
- strncpy (result[result_index], string + start, len);
- result[result_index][len] = '\0';
- result_index++;
- result[result_index] = (char *)NULL;
- }
- if (string[i])
- goto get_token;
-
- return (result);
-}
-
-#ifdef STATIC_MALLOC
-
-/* **************************************************************** */
-/* */
-/* xmalloc and xrealloc () */
-/* */
-/* **************************************************************** */
-
-static char *
-xmalloc (bytes)
- int bytes;
-{
- static memory_error_and_abort ();
- char *temp = (char *)malloc (bytes);
-
- if (!temp)
- memory_error_and_abort ();
- return (temp);
-}
-
-static char *
-xrealloc (pointer, bytes)
- char *pointer;
- int bytes;
-{
- static memory_error_and_abort ();
- char *temp = (char *)realloc (pointer, bytes);
-
- if (!temp)
- memory_error_and_abort ();
- return (temp);
-}
-
-static
-memory_error_and_abort ()
-{
- fprintf (stderr, "history: Out of virtual memory!\n");
- abort ();
-}
-#endif /* STATIC_MALLOC */
-
-
-/* **************************************************************** */
-/* */
-/* Test Code */
-/* */
-/* **************************************************************** */
-#ifdef TEST
-main ()
-{
- char line[1024], *t;
- int done = 0;
-
- line[0] = 0;
-
- while (!done)
- {
- fprintf (stdout, "history%% ");
- t = gets (line);
-
- if (!t)
- strcpy (line, "quit");
-
- if (line[0])
- {
- char *expansion;
- int result;
-
- using_history ();
-
- result = history_expand (line, &expansion);
- strcpy (line, expansion);
- free (expansion);
- if (result)
- fprintf (stderr, "%s\n", line);
-
- if (result < 0)
- continue;
-
- add_history (line);
- }
-
- if (strcmp (line, "quit") == 0) done = 1;
- if (strcmp (line, "save") == 0) write_history (0);
- if (strcmp (line, "read") == 0) read_history (0);
- if (strcmp (line, "list") == 0)
- {
- register HIST_ENTRY **the_list = history_list ();
- register int i;
-
- if (the_list)
- for (i = 0; the_list[i]; i++)
- fprintf (stdout, "%d: %s\n", i + history_base, the_list[i]->line);
- }
- if (strncmp (line, "delete", strlen ("delete")) == 0)
- {
- int which;
- if ((sscanf (line + strlen ("delete"), "%d", &which)) == 1)
- {
- HIST_ENTRY *entry = remove_history (which);
- if (!entry)
- fprintf (stderr, "No such entry %d\n", which);
- else
- {
- free (entry->line);
- free (entry);
- }
- }
- else
- {
- fprintf (stderr, "non-numeric arg given to `delete'\n");
- }
- }
- }
-}
-
-#endif /* TEST */
-
-/*
-* Local variables:
-* compile-command: "gcc -g -DTEST -o history history.c"
-* end:
-*/
diff --git a/gnu/usr.bin/gdb/readline/history.h b/gnu/usr.bin/gdb/readline/history.h
deleted file mode 100644
index 0bac209..0000000
--- a/gnu/usr.bin/gdb/readline/history.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* History.h -- the names of functions that you can call in history. */
-
-typedef struct _hist_entry {
- char *line;
- char *data;
-} HIST_ENTRY;
-
-/* For convenience only. You set this when interpreting history commands.
- It is the logical offset of the first history element. */
-extern int history_base;
-
-/* Begin a session in which the history functions might be used. This
- just initializes the interactive variables. */
-extern void using_history ();
-
-/* Place STRING at the end of the history list.
- The associated data field (if any) is set to NULL. */
-extern void add_history ();
-
-/* Returns the number which says what history element we are now
- looking at. */
-extern int where_history ();
-
-/* Set the position in the history list to POS. */
-int history_set_pos ();
-
-/* Search for STRING in the history list, starting at POS, an
- absolute index into the list. DIR, if negative, says to search
- backwards from POS, else forwards.
- Returns the absolute index of the history element where STRING
- was found, or -1 otherwise. */
-extern int history_search_pos ();
-
-/* A reasonably useless function, only here for completeness. WHICH
- is the magic number that tells us which element to delete. The
- elements are numbered from 0. */
-extern HIST_ENTRY *remove_history ();
-
-/* Stifle the history list, remembering only MAX number of entries. */
-extern void stifle_history ();
-
-/* Stop stifling the history. This returns the previous amount the
- history was stifled by. The value is positive if the history was
- stifled, negative if it wasn't. */
-extern int unstifle_history ();
-
-/* Add the contents of FILENAME to the history list, a line at a time.
- If FILENAME is NULL, then read from ~/.history. Returns 0 if
- successful, or errno if not. */
-extern int read_history ();
-
-/* Append the current history to FILENAME. If FILENAME is NULL,
- then append the history list to ~/.history. Values returned
- are as in read_history (). */
-extern int write_history ();
-
-
-/* Make the history entry at WHICH have LINE and DATA. This returns
- the old entry so you can dispose of the data. In the case of an
- invalid WHICH, a NULL pointer is returned. */
-extern HIST_ENTRY *replace_history_entry ();
-
-/* Return the history entry at the current position, as determined by
- history_offset. If there is no entry there, return a NULL pointer. */
-HIST_ENTRY *current_history ();
-
-/* Back up history_offset to the previous history entry, and return
- a pointer to that entry. If there is no previous entry, return
- a NULL pointer. */
-extern HIST_ENTRY *previous_history ();
-
-/* Move history_offset forward to the next item in the input_history,
- and return the a pointer to that entry. If there is no next entry,
- return a NULL pointer. */
-extern HIST_ENTRY *next_history ();
-
-/* Return a NULL terminated array of HIST_ENTRY which is the current input
- history. Element 0 of this list is the beginning of time. If there
- is no history, return NULL. */
-extern HIST_ENTRY **history_list ();
-
-/* Search the history for STRING, starting at history_offset.
- If DIRECTION < 0, then the search is through previous entries,
- else through subsequent. If the string is found, then
- current_history () is the history entry, and the value of this function
- is the offset in the line of that history entry that the string was
- found in. Otherwise, nothing is changed, and a -1 is returned. */
-extern int history_search ();
-
-/* Expand the string STRING, placing the result into OUTPUT, a pointer
- to a string. Returns:
-
- 0) If no expansions took place (or, if the only change in
- the text was the de-slashifying of the history expansion
- character)
- 1) If expansions did take place
- -1) If there was an error in expansion.
-
- If an error ocurred in expansion, then OUTPUT contains a descriptive
- error message. */
-extern int history_expand ();
-
-/* Extract a string segment consisting of the FIRST through LAST
- arguments present in STRING. Arguments are broken up as in
- the shell. */
-extern char *history_arg_extract ();
-
-
diff --git a/gnu/usr.bin/gdb/readline/keymaps.c b/gnu/usr.bin/gdb/readline/keymaps.c
deleted file mode 100644
index e0c5e39..0000000
--- a/gnu/usr.bin/gdb/readline/keymaps.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* keymaps.c -- Functions and keymaps for the GNU Readline library. */
-
-/* Copyright (C) 1988,1989 Free Software Foundation, Inc.
-
- This file is part of GNU Readline, a library for reading lines
- of text with interactive input and history editing.
-
- Readline 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.
-
- Readline 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 Readline; see the file COPYING. If not, write to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "keymaps.h"
-#include "emacs_keymap.c"
-
-#ifdef VI_MODE
-#include "vi_keymap.c"
-#endif
-
-/* Remove these declarations when we have a complete libgnu.a. */
-#define STATIC_MALLOC
-#ifndef STATIC_MALLOC
-extern char *xmalloc (), *xrealloc ();
-#else
-static char *xmalloc (), *xrealloc ();
-#endif
-
-/* **************************************************************** */
-/* */
-/* Functions for manipulating Keymaps. */
-/* */
-/* **************************************************************** */
-
-
-/* Return a new, empty keymap.
- Free it with free() when you are done. */
-Keymap
-rl_make_bare_keymap ()
-{
- register int i;
- Keymap keymap = (Keymap)xmalloc (128 * sizeof (KEYMAP_ENTRY));
-
- for (i = 0; i < 128; i++)
- {
- keymap[i].type = ISFUNC;
- keymap[i].function = (Function *)NULL;
- }
-
- for (i = 'A'; i < ('Z' + 1); i++)
- {
- keymap[i].type = ISFUNC;
- keymap[i].function = rl_do_lowercase_version;
- }
-
- return (keymap);
-}
-
-/* Return a new keymap which is a copy of MAP. */
-Keymap
-rl_copy_keymap (map)
- Keymap map;
-{
- register int i;
- Keymap temp = rl_make_bare_keymap ();
-
- for (i = 0; i < 128; i++)
- {
- temp[i].type = map[i].type;
- temp[i].function = map[i].function;
- }
- return (temp);
-}
-
-/* Return a new keymap with the printing characters bound to rl_insert,
- the uppercase Meta characters bound to run their lowercase equivalents,
- and the Meta digits bound to produce numeric arguments. */
-Keymap
-rl_make_keymap ()
-{
- extern rl_insert (), rl_rubout (), rl_do_lowercase_version ();
- extern rl_digit_argument ();
- register int i;
- Keymap newmap;
-
- newmap = rl_make_bare_keymap ();
-
- /* All printing characters are self-inserting. */
- for (i = ' '; i < 126; i++)
- newmap[i].function = rl_insert;
-
- newmap[TAB].function = rl_insert;
- newmap[RUBOUT].function = rl_rubout;
-
- return (newmap);
-}
-
-/* Free the storage associated with MAP. */
-rl_discard_keymap (map)
- Keymap (map);
-{
- int i;
-
- if (!map)
- return;
-
- for (i = 0; i < 128; i++)
- {
- switch (map[i].type)
- {
- case ISFUNC:
- break;
-
- case ISKMAP:
- rl_discard_keymap ((Keymap)map[i].function);
- break;
-
- case ISMACR:
- free ((char *)map[i].function);
- break;
- }
- }
-}
-
-#ifdef STATIC_MALLOC
-
-/* **************************************************************** */
-/* */
-/* xmalloc and xrealloc () */
-/* */
-/* **************************************************************** */
-
-static char *
-xmalloc (bytes)
- int bytes;
-{
- static memory_error_and_abort ();
- char *temp = (char *)malloc (bytes);
-
- if (!temp)
- memory_error_and_abort ();
- return (temp);
-}
-
-static char *
-xrealloc (pointer, bytes)
- char *pointer;
- int bytes;
-{
- static memory_error_and_abort ();
- char *temp = (char *)realloc (pointer, bytes);
-
- if (!temp)
- memory_error_and_abort ();
- return (temp);
-}
-
-static
-memory_error_and_abort ()
-{
- fprintf (stderr, "readline: Out of virtual memory!\n");
- abort ();
-}
-#endif /* STATIC_MALLOC */
diff --git a/gnu/usr.bin/gdb/readline/keymaps.h b/gnu/usr.bin/gdb/readline/keymaps.h
deleted file mode 100644
index 3c577b3..0000000
--- a/gnu/usr.bin/gdb/readline/keymaps.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* keymaps.h -- Manipulation of readline keymaps. */
-
-#ifndef _KEYMAPS_H_
-#define _KEYMAPS_H_
-
-#include <readline/chardefs.h>
-
-#ifndef __FUNCTION_DEF
-typedef int Function ();
-#define __FUNCTION_DEF
-#endif
-
-/* A keymap contains one entry for each key in the ASCII set.
- Each entry consists of a type and a pointer.
- POINTER is the address of a function to run, or the
- address of a keymap to indirect through.
- TYPE says which kind of thing POINTER is. */
-typedef struct _keymap_entry {
- char type;
- Function *function;
-} KEYMAP_ENTRY;
-
-/* I wanted to make the above structure contain a union of:
- union { Function *function; struct _keymap_entry *keymap; } value;
- but this made it impossible for me to create a static array.
- Maybe I need C lessons. */
-
-typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[128];
-typedef KEYMAP_ENTRY *Keymap;
-
-/* The values that TYPE can have in a keymap entry. */
-#define ISFUNC 0
-#define ISKMAP 1
-#define ISMACR 2
-
-extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap;
-extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap;
-
-/* Return a new, empty keymap.
- Free it with free() when you are done. */
-Keymap rl_make_bare_keymap ();
-
-/* Return a new keymap which is a copy of MAP. */
-Keymap rl_copy_keymap ();
-
-/* Return a new keymap with the printing characters bound to rl_insert,
- the lowercase Meta characters bound to run their equivalents, and
- the Meta digits bound to produce numeric arguments. */
-Keymap rl_make_keymap ();
-
-#endif /* _KEYMAPS_H_ */
-
-
diff --git a/gnu/usr.bin/gdb/readline/readline.c b/gnu/usr.bin/gdb/readline/readline.c
deleted file mode 100644
index 3e8f9a3..0000000
--- a/gnu/usr.bin/gdb/readline/readline.c
+++ /dev/null
@@ -1,5557 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)readline.c 6.4 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* readline.c -- a general facility for reading lines of input
- with emacs style editing and completion. */
-
-/* Copyright (C) 1987,1989 Free Software Foundation, Inc.
-
- This file contains the Readline Library (the Library), a set of
- routines for providing Emacs style line input to programs that ask
- for it.
-
- The Library 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.
-
- The Library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- The GNU General Public License is often shipped with GNU software, and
- is generally kept in a file called COPYING or LICENSE. If you do not
- have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Remove these declarations when we have a complete libgnu.a. */
-#define STATIC_MALLOC
-#ifndef STATIC_MALLOC
-extern char *xmalloc (), *xrealloc ();
-#else
-static char *xmalloc (), *xrealloc ();
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/file.h>
-#include <signal.h>
-#include <string.h>
-
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else
-#if defined (sparc) && defined (sun)
-#include <alloca.h>
-#endif
-#endif
-
-#define NEW_TTY_DRIVER
-#if defined (SYSV) || defined (hpux)
-#undef NEW_TTY_DRIVER
-#include <termio.h>
-#else
-#include <sgtty.h>
-#endif
-
-#include <errno.h>
-extern int errno;
-
-#include <setjmp.h>
-
-/* These next are for filename completion. Perhaps this belongs
- in a different place. */
-#include <sys/stat.h>
-
-#include <pwd.h>
-#ifdef SYSV
-struct passwd *getpwuid (), *getpwent ();
-#endif
-
-#define HACK_TERMCAP_MOTION
-
-#ifndef SYSV
-#include <sys/dir.h>
-#else /* SYSV */
-#ifdef hpux
-#include <ndir.h>
-#else
-#include <dirent.h>
-#define direct dirent
-#define d_namlen d_reclen
-#endif /* hpux */
-#endif /* SYSV */
-
-/* Some standard library routines. */
-#include "readline.h"
-#include "history.h"
-
-#ifndef digit
-#define digit(c) ((c) >= '0' && (c) <= '9')
-#endif
-
-#ifndef isletter
-#define isletter(c) (((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z'))
-#endif
-
-#ifndef digit_value
-#define digit_value(c) ((c) - '0')
-#endif
-
-#ifndef member
-char *index ();
-#define member(c, s) ((c) ? index ((s), (c)) : 0)
-#endif
-
-#ifndef isident
-#define isident(c) ((isletter(c) || digit(c) || c == '_'))
-#endif
-
-#ifndef exchange
-#define exchange(x, y) {int temp = x; x = y; y = temp;}
-#endif
-
-static update_line ();
-static void output_character_function ();
-static delete_chars ();
-static start_insert ();
-static end_insert ();
-
-/* This typedef is equivalant to the one for Function; it allows us
- to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */
-typedef void SigHandler ();
-
-#ifdef SIGWINCH
-static void rl_handle_sigwinch ();
-static SigHandler *old_sigwinch = (SigHandler *)NULL;
-#endif
-
-/* If on, then readline handles signals in a way that doesn't screw. */
-/* #define HANDLE_SIGNALS */
-
-#if defined (SYSV)
-#ifdef HANDLE_SIGNALS
-#undef HANDLE_SIGNALS
-#endif
-#endif
-
-/* Stupid comparison routine for qsort () ing strings. */
-static int
-compare_strings (s1, s2)
- char **s1, **s2;
-{
- return (strcmp (*s1, *s2));
-}
-
-
-/* **************************************************************** */
-/* */
-/* Line editing input utility */
-/* */
-/* **************************************************************** */
-
-/* A pointer to the keymap that is currently in use.
- By default, it is the standard emacs keymap. */
-Keymap keymap = emacs_standard_keymap;
-
-#define vi_mode 0
-#define emacs_mode 1
-
-/* The current style of editing. */
-int rl_editing_mode = emacs_mode;
-
-/* Non-zero if the previous command was a kill command. */
-static int last_command_was_kill = 0;
-
-/* The current value of the numeric argument specified by the user. */
-int rl_numeric_arg = 1;
-
-/* Non-zero if an argument was typed. */
-int rl_explicit_arg = 0;
-
-/* Temporary value used while generating the argument. */
-static int arg_sign = 1;
-
-/* Non-zero means we have been called at least once before. */
-static int rl_initialized = 0;
-
-/* If non-zero, this program is running in an EMACS buffer. */
-static char *running_in_emacs = (char *)NULL;
-
-/* The current offset in the current input line. */
-int rl_point;
-
-/* Mark in the current input line. */
-int rl_mark;
-
-/* Length of the current input line. */
-int rl_end;
-
-/* Make this non-zero to return the current input_line. */
-int rl_done;
-
-/* The last function executed by readline. */
-Function *rl_last_func = (Function *)NULL;
-
-/* Top level environment for readline_internal (). */
-static jmp_buf readline_top_level;
-
-/* The streams we interact with. */
-static FILE *in_stream, *out_stream;
-
-/* The names of the streams that we do input and output to. */
-FILE *rl_instream = stdin, *rl_outstream = stdout;
-
-/* Non-zero means echo characters as they are read. */
-int readline_echoing_p = 1;
-
-/* Current prompt. */
-char *rl_prompt;
-
-/* The number of characters read in order to type this complete command. */
-int rl_key_sequence_length = 0;
-
-/* If non-zero, then this is the address of a function to call just
- before readline_internal () prints the first prompt. */
-Function *rl_startup_hook = (Function *)NULL;
-
-/* What we use internally. You should always refer to RL_LINE_BUFFER. */
-static char *the_line;
-
-/* The character that can generate an EOF. Really read from
- the terminal driver... just defaulted here. */
-static int eof_char = CTRL ('D');
-
-/* Non-zero makes this the next keystroke to read. */
-int rl_pending_input = 0;
-
-/* Pointer to a useful terminal name. */
-char *rl_terminal_name = (char *)NULL;
-
-/* Line buffer and maintenence. */
-char *rl_line_buffer = (char *)NULL;
-static int rl_line_buffer_len = 0;
-#define DEFAULT_BUFFER_SIZE 256
-
-
-/* **************************************************************** */
-/* */
-/* Top Level Functions */
-/* */
-/* **************************************************************** */
-
-/* Read a line of input. Prompt with PROMPT. A NULL PROMPT means
- none. A return value of NULL means that EOF was encountered. */
-char *
-readline (prompt)
- char *prompt;
-{
- static rl_prep_terminal (), rl_deprep_terminal ();
- char *readline_internal ();
- char *value;
-
- rl_prompt = prompt;
-
- /* If we are at EOF return a NULL string. */
- if (rl_pending_input == EOF)
- {
- rl_pending_input = 0;
- return ((char *)NULL);
- }
-
- rl_initialize ();
- rl_prep_terminal ();
-
-#ifdef SIGWINCH
- old_sigwinch = (SigHandler *)signal (SIGWINCH, rl_handle_sigwinch);
-#endif
-
-#ifdef HANDLE_SIGNALS
- rl_set_signals ();
-#endif
-
- value = readline_internal ();
- rl_deprep_terminal ();
-
-#ifdef SIGWINCH
- signal (SIGWINCH, old_sigwinch);
-#endif
-
-#ifdef HANDLE_SIGNALS
- rl_clear_signals ();
-#endif
-
- return (value);
-}
-
-/* Read a line of input from the global rl_instream, doing output on
- the global rl_outstream.
- If rl_prompt is non-null, then that is our prompt. */
-char *
-readline_internal ()
-{
- int lastc, c, eof_found;
-
- in_stream = rl_instream; out_stream = rl_outstream;
- lastc = eof_found = 0;
-
- if (rl_startup_hook)
- (*rl_startup_hook) ();
-
- if (!readline_echoing_p)
- {
- if (rl_prompt) {
- fprintf (out_stream, "%s", rl_prompt);
- fflush(out_stream);
- }
- }
- else
- {
- rl_on_new_line ();
- rl_redisplay ();
-#ifdef VI_MODE
- if (rl_editing_mode == vi_mode)
- rl_vi_insertion_mode ();
-#endif /* VI_MODE */
- }
-
- while (!rl_done)
- {
- int lk = last_command_was_kill;
- int code = setjmp (readline_top_level);
-
- if (code)
- rl_redisplay ();
-
- if (!rl_pending_input)
- {
- /* Then initialize the argument and number of keys read. */
- rl_init_argument ();
- rl_key_sequence_length = 0;
- }
-
- c = rl_read_key ();
-
- /* EOF typed to a non-blank line is a <NL>. */
- if (c == EOF && rl_end)
- c = NEWLINE;
-
- /* The character eof_char typed to blank line, and not as the
- previous character is interpreted as EOF. */
- if (((c == eof_char && lastc != c) || c == EOF) && !rl_end)
- {
- eof_found = 1;
- break;
- }
-
- lastc = c;
- rl_dispatch (c, keymap);
-
- /* If there was no change in last_command_was_kill, then no kill
- has taken place. Note that if input is pending we are reading
- a prefix command, so nothing has changed yet. */
- if (!rl_pending_input)
- {
- if (lk == last_command_was_kill)
- last_command_was_kill = 0;
- }
-
-#ifdef VI_MODE
- /* In vi mode, when you exit insert mode, the cursor moves back
- over the previous character. We explicitly check for that here. */
- if (rl_editing_mode == vi_mode && keymap == vi_movement_keymap)
- rl_vi_check ();
-#endif
-
- if (!rl_done)
- rl_redisplay ();
- }
-
- /* Restore the original of this history line, iff the line that we
- are editing was originally in the history, AND the line has changed. */
- {
- HIST_ENTRY *entry = current_history ();
-
- if (entry && rl_undo_list)
- {
- char *temp = savestring (the_line);
- rl_revert_line ();
- entry = replace_history_entry (where_history (), the_line,
- (HIST_ENTRY *)NULL);
- free_history_entry (entry);
-
- strcpy (the_line, temp);
- free (temp);
- }
- }
-
- /* At any rate, it is highly likely that this line has an undo list. Get
- rid of it now. */
- if (rl_undo_list)
- free_undo_list ();
-
- if (eof_found)
- return (char *)NULL;
- else
- return (savestring (the_line));
-}
-
-
-/* Variables for keyboard macros. */
-
-/* The currently executing macro string. If this is non-zero,
- then it is a malloc ()'ed string where input is coming from. */
-static char *executing_macro = (char *)NULL;
-
-/* The offset in the above string to the next character to be read. */
-static int executing_macro_index = 0;
-
-/* Non-zero means to save keys that we dispatch on in a kbd macro. */
-static int defining_kbd_macro = 0;
-
-/* The current macro string being built. Characters get stuffed
- in here by add_macro_char (). */
-static char *current_macro = (char *)NULL;
-
-/* The size of the buffer allocated to current_macro. */
-static int current_macro_size = 0;
-
-/* The index at which characters are being added to current_macro. */
-static int current_macro_index = 0;
-
-/* A structure used to save nested macro strings.
- It is a linked list of string/index for each saved macro. */
-struct saved_macro {
- struct saved_macro *next;
- char *string;
- int index;
-};
-
-/* The list of saved macros. */
-struct saved_macro *macro_list = (struct saved_macro *)NULL;
-
-
-/* **************************************************************** */
-/* */
-/* Signal Handling */
-/* */
-/* **************************************************************** */
-
-#ifdef SIGWINCH
-static void
-rl_handle_sigwinch (sig, code, scp)
- int sig, code;
- struct sigcontext *scp;
-{
- char *term = rl_terminal_name, *getenv ();
-
- if (readline_echoing_p)
- {
- if (!term)
- term = getenv ("TERM");
- if (!term)
- term = "dumb";
- rl_reset_terminal (term);
-#ifdef NEVER
- crlf ();
- rl_forced_update_display ();
-#endif
- }
-
- if (old_sigwinch &&
- old_sigwinch != (SigHandler *)SIG_IGN &&
- old_sigwinch != (SigHandler *)SIG_DFL)
- (*old_sigwinch)(sig, code, scp);
-}
-#endif /* SIGWINCH */
-
-#ifdef HANDLE_SIGNALS
-/* Interrupt handling. */
-static SigHandler *old_int = (SigHandler *)NULL,
- *old_tstp = (SigHandler *)NULL,
- *old_ttou = (SigHandler *)NULL,
- *old_ttin = (SigHandler *)NULL,
- *old_cont = (SigHandler *)NULL;
-
-/* Handle an interrupt character. */
-static void
-rl_signal_handler (sig, code, scp)
- int sig, code;
- struct sigcontext *scp;
-{
- static rl_prep_terminal (), rl_deprep_terminal ();
-
- switch (sig)
- {
- case SIGINT:
- free_undo_list ();
- rl_clear_message ();
- rl_init_argument ();
-#ifdef SIGWINCH
- signal (SIGWINCH, old_sigwinch);
-#endif
-
-#ifdef SIGTSTP
- case SIGTSTP:
- case SIGTTOU:
- case SIGTTIN:
-#endif
-
- rl_clean_up_for_exit ();
- rl_deprep_terminal ();
- rl_clear_signals ();
- rl_pending_input = 0;
-
- kill (getpid (), sig);
- sigsetmask (0);
-
- rl_prep_terminal ();
- rl_set_signals ();
- }
-}
-
-rl_set_signals ()
-{
- old_int = (SigHandler *)signal (SIGINT, rl_signal_handler);
-
- if (old_int == (SigHandler *)SIG_IGN)
- signal (SIGINT, SIG_IGN);
-
-#ifdef SIGTSTP
- old_tstp = (SigHandler *)signal (SIGTSTP, rl_signal_handler);
- if (old_tstp == (SigHandler *)SIG_IGN)
- signal (SIGTSTP, SIG_IGN);
-#endif
-#ifdef SIGTTOU
- old_ttou = (SigHandler *)signal (SIGTTOU, rl_signal_handler);
- old_ttin = (SigHandler *)signal (SIGTTIN, rl_signal_handler);
-#endif
-}
-
-rl_clear_signals ()
-{
- signal (SIGINT, old_int);
-
-#ifdef SIGTSTP
- signal (SIGTSTP, old_tstp);
-#endif
-#ifdef SIGTTOU
- signal (SIGTTOU, old_ttou);
- signal (SIGTTIN, old_ttin);
-#endif
-}
-#endif /* HANDLE_SIGNALS */
-
-
-
-/* **************************************************************** */
-/* */
-/* Character Input Buffering */
-/* */
-/* **************************************************************** */
-
-/* If the terminal was in xoff state when we got to it, then xon_char
- contains the character that is supposed to start it again. */
-static int xon_char, xoff_state;
-static int pop_index = 0, push_index = 0, ibuffer_len = 511;
-static unsigned char ibuffer[512];
-
-/* Non-null means it is a pointer to a function to run while waiting for
- character input. */
-Function *rl_event_hook = (Function *)NULL;
-
-#define any_typein (push_index != pop_index)
-
-/* Add KEY to the buffer of characters to be read. */
-rl_stuff_char (key)
- int key;
-{
- if (key == EOF)
- {
- key = NEWLINE;
- rl_pending_input = EOF;
- }
- ibuffer[push_index++] = key;
- if (push_index >= ibuffer_len)
- push_index = 0;
-}
-
-/* Return the amount of space available in the
- buffer for stuffing characters. */
-int
-ibuffer_space ()
-{
- if (pop_index > push_index)
- return (pop_index - push_index);
- else
- return (ibuffer_len - (push_index - pop_index));
-}
-
-/* Get a key from the buffer of characters to be read.
- Result is KEY if there was a key, or -2 if there wasn't. */
-int
-rl_get_char ()
-{
- int key;
-
- if (push_index == pop_index)
- return (-2);
-
- key = ibuffer[pop_index++];
-
- if (pop_index >= ibuffer_len)
- pop_index = 0;
-
- return (key);
-}
-
-/* Stuff KEY into the *front* of the input buffer.
- Returns non-zero if successful, zero if there is
- no space left in the buffer. */
-int
-rl_unget_char (key)
- int key;
-{
- if (ibuffer_space ())
- {
- pop_index--;
- if (pop_index < 0)
- pop_index = ibuffer_len - 1;
- ibuffer[pop_index] = key;
- return (1);
- }
- return (0);
-}
-
-
-
-static void
-rl_getc (stream)
- FILE *stream;
-{
- int result;
- int nchar;
- int tty = fileno(stream);
- char buf[512]; /* XXX - must be at least as large as ibuffer */
-
- while (1)
- {
- if (ioctl(tty, FIONREAD, &nchar) == -1)
- nchar = sizeof(buf);
- else if (nchar <= 0)
- nchar = 1;
- result = ibuffer_space();
- if (nchar > result)
- nchar = result;
- result = read(tty, buf, nchar);
- if (result > 0)
- {
- register char *cp = buf;
-
- while (--result >= 0)
- rl_stuff_char(*cp++);
- return;
- }
- if (errno != EINTR)
- {
- rl_stuff_char(EOF);
- return;
- }
- }
-}
-
-/* Read a key, including pending input. */
-int
-rl_read_key ()
-{
- int c;
-
- rl_key_sequence_length++;
-
- if (rl_pending_input)
- {
- c = rl_pending_input;
- rl_pending_input = 0;
- }
- else
- {
- static int next_macro_key ();
-
- /* If input is coming from a macro, then use that. */
- if (c = next_macro_key ())
- return (c);
-
- while ((c = rl_get_char()) == -2)
- {
- if (rl_event_hook)
- {
- (*rl_event_hook) ();
- if ((c = rl_get_char()) != -2)
- return (c);
- }
- rl_getc(in_stream);
- }
- }
-#ifdef TIOCSTART
- /* Ugh. But I can't think of a better way. */
- if (xoff_state && c == xon_char)
- {
- ioctl (fileno (in_stream), TIOCSTART, 0);
- xoff_state = 0;
- return rl_read_key ();
- }
-#endif /* TIOCSTART */
- return (c);
-}
-
-/* Do the command associated with KEY in MAP.
- If the associated command is really a keymap, then read
- another key, and dispatch into that map. */
-rl_dispatch (key, map)
- register int key;
- Keymap map;
-{
- if (defining_kbd_macro)
- {
- static add_macro_char ();
-
- add_macro_char (key);
- }
-
- if (key > 127 && key < 256)
- {
- if (map[ESC].type == ISKMAP)
- {
- map = (Keymap)map[ESC].function;
- key -= 128;
- rl_dispatch (key, map);
- }
- else
- ding ();
- return;
- }
-
- switch (map[key].type)
- {
- case ISFUNC:
- {
- Function *func = map[key].function;
-
- if (func != (Function *)NULL)
- {
- /* Special case rl_do_lowercase_version (). */
- if (func == rl_do_lowercase_version)
- {
- rl_dispatch (to_lower (key), map);
- return;
- }
-
- (*map[key].function)(rl_numeric_arg * arg_sign, key);
- }
- else
- {
- ding ();
- return;
- }
- }
- break;
-
- case ISKMAP:
- if (map[key].function != (Function *)NULL)
- {
- int newkey;
-
- rl_key_sequence_length++;
- newkey = rl_read_key ();
- rl_dispatch (newkey, (Keymap)map[key].function);
- }
- else
- {
- ding ();
- return;
- }
- break;
-
- case ISMACR:
- if (map[key].function != (Function *)NULL)
- {
- static with_macro_input ();
- char *macro = savestring ((char *)map[key].function);
-
- with_macro_input (macro);
- return;
- }
- break;
- }
-
- /* If we have input pending, then the last command was a prefix
- command. Don't change the state of rl_last_func. */
- if (!rl_pending_input)
- rl_last_func = map[key].function;
-}
-
-
-/* **************************************************************** */
-/* */
-/* Hacking Keyboard Macros */
-/* */
-/* **************************************************************** */
-
-/* Set up to read subsequent input from STRING.
- STRING is free ()'ed when we are done with it. */
-static
-with_macro_input (string)
- char *string;
-{
- static push_executing_macro ();
-
- push_executing_macro ();
- executing_macro = string;
- executing_macro_index = 0;
-}
-
-/* Return the next character available from a macro, or 0 if
- there are no macro characters. */
-static int
-next_macro_key ()
-{
- if (!executing_macro)
- return (0);
-
- if (!executing_macro[executing_macro_index])
- {
- static pop_executing_macro ();
-
- pop_executing_macro ();
- return (next_macro_key ());
- }
-
- return (executing_macro[executing_macro_index++]);
-}
-
-/* Save the currently executing macro on a stack of saved macros. */
-static
-push_executing_macro ()
-{
- struct saved_macro *saver;
-
- saver = (struct saved_macro *)xmalloc (sizeof (struct saved_macro));
- saver->next = macro_list;
- saver->index = executing_macro_index;
- saver->string = executing_macro;
-
- macro_list = saver;
-}
-
-/* Discard the current macro, replacing it with the one
- on the top of the stack of saved macros. */
-static
-pop_executing_macro ()
-{
- if (executing_macro)
- free (executing_macro);
-
- executing_macro = (char *)NULL;
- executing_macro_index = 0;
-
- if (macro_list)
- {
- struct saved_macro *disposer = macro_list;
- executing_macro = macro_list->string;
- executing_macro_index = macro_list->index;
- macro_list = macro_list->next;
- free (disposer);
- }
-}
-
-/* Add a character to the macro being built. */
-static
-add_macro_char (c)
- int c;
-{
- if (current_macro_index + 1 >= current_macro_size)
- {
- if (!current_macro)
- current_macro = (char *)xmalloc (current_macro_size = 25);
- else
- current_macro =
- (char *)xrealloc (current_macro, current_macro_size += 25);
- }
-
- current_macro[current_macro_index++] = c;
- current_macro[current_macro_index] = '\0';
-}
-
-/* Begin defining a keyboard macro.
- Keystrokes are recorded as they are executed.
- End the definition with rl_end_kbd_macro ().
- If a numeric argument was explicitly typed, then append this
- definition to the end of the existing macro, and start by
- re-executing the existing macro. */
-rl_start_kbd_macro (ignore1, ignore2)
- int ignore1, ignore2;
-{
- if (defining_kbd_macro)
- rl_abort ();
-
- if (rl_explicit_arg)
- {
- if (current_macro)
- with_macro_input (savestring (current_macro));
- }
- else
- current_macro_index = 0;
-
- defining_kbd_macro = 1;
-}
-
-/* Stop defining a keyboard macro.
- A numeric argument says to execute the macro right now,
- that many times, counting the definition as the first time. */
-rl_end_kbd_macro (count, ignore)
- int count, ignore;
-{
- if (!defining_kbd_macro)
- rl_abort ();
-
- current_macro_index -= (rl_key_sequence_length - 1);
- current_macro[current_macro_index] = '\0';
-
- defining_kbd_macro = 0;
-
- rl_call_last_kbd_macro (--count, 0);
-}
-
-/* Execute the most recently defined keyboard macro.
- COUNT says how many times to execute it. */
-rl_call_last_kbd_macro (count, ignore)
- int count, ignore;
-{
- if (!current_macro)
- rl_abort ();
-
- while (count--)
- with_macro_input (savestring (current_macro));
-}
-
-
-/* Non-zero means do not parse any lines other than comments and
- parser directives. */
-static unsigned char parsing_conditionalized_out = 0;
-
-/* **************************************************************** */
-/* */
-/* Initializations */
-/* */
-/* **************************************************************** */
-
-/* Initliaze readline (and terminal if not already). */
-rl_initialize ()
-{
- extern char *rl_display_prompt;
-
- /* If we have never been called before, initialize the
- terminal and data structures. */
- if (!rl_initialized)
- {
- readline_initialize_everything ();
- rl_initialized++;
- }
-
- /* Initalize the current line information. */
- rl_point = rl_end = 0;
- the_line = rl_line_buffer;
- the_line[0] = 0;
-
- /* We aren't done yet. We haven't even gotten started yet! */
- rl_done = 0;
-
- /* Tell the history routines what is going on. */
- start_using_history ();
-
- /* Make the display buffer match the state of the line. */
- {
- extern char *rl_display_prompt;
- extern int forced_display;
-
- rl_on_new_line ();
-
- rl_display_prompt = rl_prompt ? rl_prompt : "";
- forced_display = 1;
- }
-
- /* No such function typed yet. */
- rl_last_func = (Function *)NULL;
-
- /* Parsing of key-bindings begins in an enabled state. */
- {
- parsing_conditionalized_out = 0;
- }
-}
-
-/* Initialize the entire state of the world. */
-readline_initialize_everything ()
-{
- /* Find out if we are running in Emacs. */
- running_in_emacs = (char *)getenv ("EMACS");
-
- /* Allocate data structures. */
- if (!rl_line_buffer)
- rl_line_buffer =
- (char *)xmalloc (rl_line_buffer_len = DEFAULT_BUFFER_SIZE);
-
- /* Initialize the terminal interface. */
- init_terminal_io ((char *)NULL);
-
- /* Bind tty characters to readline functions. */
- readline_default_bindings ();
-
- /* Initialize the function names. */
- rl_initialize_funmap ();
-
- /* Read in the init file. */
- rl_read_init_file ((char *)NULL);
-
- /* If the completion parser's default word break characters haven't
- been set yet, then do so now. */
- {
- extern char *rl_completer_word_break_characters;
- extern char *rl_basic_word_break_characters;
-
- if (rl_completer_word_break_characters == (char *)NULL)
- rl_completer_word_break_characters = rl_basic_word_break_characters;
- }
-}
-
-/* If this system allows us to look at the values of the regular
- input editing characters, then bind them to their readline
- equivalents. */
-readline_default_bindings ()
-{
-#ifdef TIOCGETP
- struct sgttyb ttybuff;
- int tty = fileno (rl_instream);
-
- if (ioctl (tty, TIOCGETP, &ttybuff) != -1)
- {
- int erase = ttybuff.sg_erase, kill = ttybuff.sg_kill;
-
- if (erase != -1 && keymap[erase].type == ISFUNC)
- keymap[erase].function = rl_rubout;
-
- if (kill != -1 && keymap[kill].type == ISFUNC)
- keymap[kill].function = rl_unix_line_discard;
- }
-
-#ifdef TIOCGLTC
- {
- struct ltchars lt;
-
- if (ioctl (tty, TIOCGLTC, &lt) != -1)
- {
- int erase = lt.t_werasc, nextc = lt.t_lnextc;
-
- if (erase != -1 && keymap[erase].type == ISFUNC)
- keymap[erase].function = rl_unix_word_rubout;
-
- if (nextc != -1 && keymap[nextc].type == ISFUNC)
- keymap[nextc].function = rl_quoted_insert;
- }
- }
-#endif /* TIOCGLTC */
-#endif /* TIOCGETP */
-}
-
-
-/* **************************************************************** */
-/* */
-/* Numeric Arguments */
-/* */
-/* **************************************************************** */
-
-/* Handle C-u style numeric args, as well as M--, and M-digits. */
-
-/* Add the current digit to the argument in progress. */
-rl_digit_argument (ignore, key)
- int ignore, key;
-{
- rl_pending_input = key;
- rl_digit_loop ();
-}
-
-/* What to do when you abort reading an argument. */
-rl_discard_argument ()
-{
- ding ();
- rl_clear_message ();
- rl_init_argument ();
-}
-
-/* Create a default argument. */
-rl_init_argument ()
-{
- rl_numeric_arg = arg_sign = 1;
- rl_explicit_arg = 0;
-}
-
-/* C-u, universal argument. Multiply the current argument by 4.
- Read a key. If the key has nothing to do with arguments, then
- dispatch on it. If the key is the abort character then abort. */
-rl_universal_argument ()
-{
- rl_numeric_arg *= 4;
- rl_digit_loop ();
-}
-
-rl_digit_loop ()
-{
- int key, c;
- while (1)
- {
- rl_message ("(arg: %d) ", arg_sign * rl_numeric_arg);
- key = c = rl_read_key ();
-
- if (keymap[c].type == ISFUNC &&
- keymap[c].function == rl_universal_argument)
- {
- rl_numeric_arg *= 4;
- continue;
- }
- c = UNMETA (c);
- if (numeric (c))
- {
- if (rl_explicit_arg)
- rl_numeric_arg = (rl_numeric_arg * 10) + (c - '0');
- else
- rl_numeric_arg = (c - '0');
- rl_explicit_arg = 1;
- }
- else
- {
- if (c == '-' && !rl_explicit_arg)
- {
- rl_numeric_arg = 1;
- arg_sign = -1;
- }
- else
- {
- rl_clear_message ();
- rl_dispatch (key, keymap);
- return;
- }
- }
- }
-}
-
-
-/* **************************************************************** */
-/* */
-/* Display stuff */
-/* */
-/* **************************************************************** */
-
-/* This is the stuff that is hard for me. I never seem to write good
- display routines in C. Let's see how I do this time. */
-
-/* (PWP) Well... Good for a simple line updater, but totally ignores
- the problems of input lines longer than the screen width.
-
- update_line and the code that calls it makes a multiple line,
- automatically wrapping line update. Carefull attention needs
- to be paid to the vertical position variables.
-
- handling of terminals with autowrap on (incl. DEC braindamage)
- could be improved a bit. Right now I just cheat and decrement
- screenwidth by one. */
-
-/* Keep two buffers; one which reflects the current contents of the
- screen, and the other to draw what we think the new contents should
- be. Then compare the buffers, and make whatever changes to the
- screen itself that we should. Finally, make the buffer that we
- just drew into be the one which reflects the current contents of the
- screen, and place the cursor where it belongs.
-
- Commands that want to can fix the display themselves, and then let
- this function know that the display has been fixed by setting the
- RL_DISPLAY_FIXED variable. This is good for efficiency. */
-
-/* Termcap variables: */
-extern char *term_up, *term_dc, *term_cr;
-extern int screenheight, screenwidth, terminal_can_insert;
-
-/* What YOU turn on when you have handled all redisplay yourself. */
-int rl_display_fixed = 0;
-
-/* The visible cursor position. If you print some text, adjust this. */
-int last_c_pos = 0;
-int last_v_pos = 0;
-
-/* The last left edge of text that was displayed. This is used when
- doing horizontal scrolling. It shifts in thirds of a screenwidth. */
-static int last_lmargin = 0;
-
-/* The line display buffers. One is the line currently displayed on
- the screen. The other is the line about to be displayed. */
-static char *visible_line = (char *)NULL;
-static char *invisible_line = (char *)NULL;
-
-/* Number of lines currently on screen minus 1. */
-int vis_botlin = 0;
-
-/* A buffer for `modeline' messages. */
-char msg_buf[128];
-
-/* Non-zero forces the redisplay even if we thought it was unnecessary. */
-int forced_display = 0;
-
-/* The stuff that gets printed out before the actual text of the line.
- This is usually pointing to rl_prompt. */
-char *rl_display_prompt = (char *)NULL;
-
-/* Default and initial buffer size. Can grow. */
-static int line_size = 1024;
-
-/* Non-zero means to always use horizontal scrolling in line display. */
-int horizontal_scroll_mode = 0;
-
-/* I really disagree with this, but my boss (among others) insists that we
- support compilers that don't work. I don't think we are gaining by doing
- so; what is the advantage in producing better code if we can't use it? */
-/* The following two declarations belong inside the
- function block, not here. */
-static void move_cursor_relative ();
-static void output_some_chars ();
-
-/* Basic redisplay algorithm. */
-rl_redisplay ()
-{
- register int in, out, c, linenum;
- register char *line = invisible_line;
- int c_pos = 0;
- int inv_botlin = 0; /* Number of lines in newly drawn buffer. */
-
- extern int readline_echoing_p;
-
- if (!readline_echoing_p)
- return;
-
- if (!rl_display_prompt)
- rl_display_prompt = "";
-
- if (!invisible_line)
- {
- visible_line = (char *)xmalloc (line_size);
- invisible_line = (char *)xmalloc (line_size);
- line = invisible_line;
- for (in = 0; in < line_size; in++)
- {
- visible_line[in] = 0;
- invisible_line[in] = 1;
- }
- rl_on_new_line ();
- }
-
- /* Draw the line into the buffer. */
- c_pos = -1;
-
- /* Mark the line as modified or not. We only do this for history
- lines. */
- out = 0;
- if (current_history () && rl_undo_list)
- {
- line[out++] = '*';
- line[out] = '\0';
- }
-
- /* If someone thought that the redisplay was handled, but the currently
- visible line has a different modification state than the one about
- to become visible, then correct the callers misconception. */
- if (visible_line[0] != invisible_line[0])
- rl_display_fixed = 0;
-
- strncpy (line + out, rl_display_prompt, strlen (rl_display_prompt));
- out += strlen (rl_display_prompt);
- line[out] = '\0';
-
- for (in = 0; in < rl_end; in++)
- {
- c = the_line[in];
-
- if (out + 1 >= line_size)
- {
- line_size *= 2;
- visible_line = (char *)xrealloc (visible_line, line_size);
- invisible_line = (char *)xrealloc (invisible_line, line_size);
- line = invisible_line;
- }
-
- if (in == rl_point)
- c_pos = out;
-
- if (c > 127)
- {
- line[out++] = 'M';
- line[out++] = '-';
- line[out++] = c - 128;
- }
-#define DISPLAY_TABS
-#ifdef DISPLAY_TABS
- else if (c == '\t')
- {
- register int newout = (out | (int)7) + 1;
- while (out < newout)
- line[out++] = ' ';
- }
-#endif
- else if (c < 32)
- {
- line[out++] = 'C';
- line[out++] = '-';
- line[out++] = c + 64;
- }
- else
- line[out++] = c;
- }
- line[out] = '\0';
- if (c_pos < 0)
- c_pos = out;
-
- /* PWP: now is when things get a bit hairy. The visible and invisible
- line buffers are really multiple lines, which would wrap every
- (screenwidth - 1) characters. Go through each in turn, finding
- the changed region and updating it. The line order is top to bottom. */
-
- /* If we can move the cursor up and down, then use multiple lines,
- otherwise, let long lines display in a single terminal line, and
- horizontally scroll it. */
-
- if (!horizontal_scroll_mode && term_up && *term_up)
- {
- int total_screen_chars = (screenwidth * screenheight);
-
- if (!rl_display_fixed || forced_display)
- {
- forced_display = 0;
-
- /* If we have more than a screenful of material to display, then
- only display a screenful. We should display the last screen,
- not the first. I'll fix this in a minute. */
- if (out >= total_screen_chars)
- out = total_screen_chars - 1;
-
- /* Number of screen lines to display. */
- inv_botlin = out / screenwidth;
-
- /* For each line in the buffer, do the updating display. */
- for (linenum = 0; linenum <= inv_botlin; linenum++)
- update_line (linenum > vis_botlin ? ""
- : &visible_line[linenum * screenwidth],
- &invisible_line[linenum * screenwidth],
- linenum);
-
- /* We may have deleted some lines. If so, clear the left over
- blank ones at the bottom out. */
- if (vis_botlin > inv_botlin)
- {
- char *tt;
- for (; linenum <= vis_botlin; linenum++)
- {
- tt = &visible_line[linenum * screenwidth];
- move_vert (linenum);
- move_cursor_relative (0, tt);
- clear_to_eol ((linenum == vis_botlin)?
- strlen (tt) : screenwidth);
- }
- }
- vis_botlin = inv_botlin;
-
- /* Move the cursor where it should be. */
- move_vert (c_pos / screenwidth);
- move_cursor_relative (c_pos % screenwidth,
- &invisible_line[(c_pos / screenwidth) * screenwidth]);
- }
- }
- else /* Do horizontal scrolling. */
- {
- int lmargin;
-
- /* Always at top line. */
- last_v_pos = 0;
-
- /* If the display position of the cursor would be off the edge
- of the screen, start the display of this line at an offset that
- leaves the cursor on the screen. */
- if (c_pos - last_lmargin > screenwidth - 2)
- lmargin = (c_pos / (screenwidth / 3) - 2) * (screenwidth / 3);
- else if (c_pos - last_lmargin < 1)
- lmargin = ((c_pos - 1) / (screenwidth / 3)) * (screenwidth / 3);
- else
- lmargin = last_lmargin;
-
- /* If the first character on the screen isn't the first character
- in the display line, indicate this with a special character. */
- if (lmargin > 0)
- line[lmargin] = '<';
-
- if (lmargin + screenwidth < out)
- line[lmargin + screenwidth - 1] = '>';
-
- if (!rl_display_fixed || forced_display || lmargin != last_lmargin)
- {
- forced_display = 0;
- update_line (&visible_line[last_lmargin],
- &invisible_line[lmargin], 0);
-
- move_cursor_relative (c_pos - lmargin, &invisible_line[lmargin]);
- last_lmargin = lmargin;
- }
- }
- fflush (out_stream);
-
- /* Swap visible and non-visible lines. */
- {
- char *temp = visible_line;
- visible_line = invisible_line;
- invisible_line = temp;
- rl_display_fixed = 0;
- }
-}
-
-/* PWP: update_line() is based on finding the middle difference of each
- line on the screen; vis:
-
- /old first difference
- /beginning of line | /old last same /old EOL
- v v v v
-old: eddie> Oh, my little gruntle-buggy is to me, as lurgid as
-new: eddie> Oh, my little buggy says to me, as lurgid as
- ^ ^ ^ ^
- \beginning of line | \new last same \new end of line
- \new first difference
-
- All are character pointers for the sake of speed. Special cases for
- no differences, as well as for end of line additions must be handeled.
-
- Could be made even smarter, but this works well enough */
-static
-update_line (old, new, current_line)
- register char *old, *new;
- int current_line;
-{
- register char *ofd, *ols, *oe, *nfd, *nls, *ne;
- int lendiff, wsatend;
-
- /* Find first difference. */
- for (ofd = old, nfd = new;
- (ofd - old < screenwidth) && *ofd && (*ofd == *nfd);
- ofd++, nfd++)
- ;
-
- /* Move to the end of the screen line. */
- for (oe = ofd; ((oe - old) < screenwidth) && *oe; oe++);
- for (ne = nfd; ((ne - new) < screenwidth) && *ne; ne++);
-
- /* If no difference, continue to next line. */
- if (ofd == oe && nfd == ne)
- return;
-
- wsatend = 1; /* flag for trailing whitespace */
- ols = oe - 1; /* find last same */
- nls = ne - 1;
- while ((*ols == *nls) && (ols > ofd) && (nls > nfd))
- {
- if (*ols != ' ')
- wsatend = 0;
- ols--;
- nls--;
- }
-
- if (wsatend)
- {
- ols = oe;
- nls = ne;
- }
- else if (*ols != *nls)
- {
- if (*ols) /* don't step past the NUL */
- ols++;
- if (*nls)
- nls++;
- }
-
- move_vert (current_line);
- move_cursor_relative (ofd - old, old);
-
- /* if (len (new) > len (old)) */
- lendiff = (nls - nfd) - (ols - ofd);
-
- /* Insert (diff(len(old),len(new)) ch */
- if (lendiff > 0)
- {
- if (terminal_can_insert)
- {
- extern char *term_IC;
-
- /* Sometimes it is cheaper to print the characters rather than
- use the terminal's capabilities. */
- if ((2 * (ne - nfd)) < lendiff && (!term_IC || !*term_IC))
- {
- output_some_chars (nfd, (ne - nfd));
- last_c_pos += (ne - nfd);
- }
- else
- {
- if (*ols)
- {
- start_insert (lendiff);
- output_some_chars (nfd, lendiff);
- last_c_pos += lendiff;
- end_insert ();
- }
- else
- {
- /* At the end of a line the characters do not have to
- be "inserted". They can just be placed on the screen. */
- output_some_chars (nfd, lendiff);
- last_c_pos += lendiff;
- }
- /* Copy (new) chars to screen from first diff to last match. */
- if (((nls - nfd) - lendiff) > 0)
- {
- output_some_chars (&nfd[lendiff], ((nls - nfd) - lendiff));
- last_c_pos += ((nls - nfd) - lendiff);
- }
- }
- }
- else
- { /* cannot insert chars, write to EOL */
- output_some_chars (nfd, (ne - nfd));
- last_c_pos += (ne - nfd);
- }
- }
- else /* Delete characters from line. */
- {
- /* If possible and inexpensive to use terminal deletion, then do so. */
- if (term_dc && (2 * (ne - nfd)) >= (-lendiff))
- {
- if (lendiff)
- delete_chars (-lendiff); /* delete (diff) characters */
-
- /* Copy (new) chars to screen from first diff to last match */
- if ((nls - nfd) > 0)
- {
- output_some_chars (nfd, (nls - nfd));
- last_c_pos += (nls - nfd);
- }
- }
- /* Otherwise, print over the existing material. */
- else
- {
- output_some_chars (nfd, (ne - nfd));
- last_c_pos += (ne - nfd);
- clear_to_eol ((oe - old) - (ne - new));
- }
- }
-}
-
-/* (PWP) tell the update routines that we have moved onto a
- new (empty) line. */
-rl_on_new_line ()
-{
- if (visible_line)
- visible_line[0] = '\0';
-
- last_c_pos = last_v_pos = 0;
- vis_botlin = last_lmargin = 0;
-}
-
-/* Actually update the display, period. */
-rl_forced_update_display ()
-{
- if (visible_line)
- {
- register char *temp = visible_line;
-
- while (*temp) *temp++ = '\0';
- }
- rl_on_new_line ();
- forced_display++;
- rl_redisplay ();
-}
-
-/* Move the cursor from last_c_pos to NEW, which are buffer indices.
- DATA is the contents of the screen line of interest; i.e., where
- the movement is being done. */
-static void
-move_cursor_relative (new, data)
- int new;
- char *data;
-{
- register int i;
- static void output_character_function ();
-
- /* It may be faster to output a CR, and then move forwards instead
- of moving backwards. */
- if (new + 1 < last_c_pos - new)
- {
- tputs (term_cr, 1, output_character_function);
- last_c_pos = 0;
- }
-
- if (last_c_pos == new) return;
-
- if (last_c_pos < new)
- {
- /* Move the cursor forward. We do it by printing the command
- to move the cursor forward if there is one, else print that
- portion of the output buffer again. Which is cheaper? */
-
- /* The above comment is left here for posterity. It is faster
- to print one character (non-control) than to print a control
- sequence telling the terminal to move forward one character.
- That kind of control is for people who don't know what the
- data is underneath the cursor. */
-#ifdef HACK_TERMCAP_MOTION
- extern char *term_forward_char;
-
- if (term_forward_char)
- for (i = last_c_pos; i < new; i++)
- tputs (term_forward_char, 1, output_character_function);
- else
- for (i = last_c_pos; i < new; i++)
- putc (data[i], out_stream);
-#else
- for (i = last_c_pos; i < new; i++)
- putc (data[i], out_stream);
-#endif /* HACK_TERMCAP_MOTION */
- }
- else
- backspace (last_c_pos - new);
- last_c_pos = new;
-}
-
-/* PWP: move the cursor up or down. */
-move_vert (to)
- int to;
-{
- void output_character_function ();
- register int delta, i;
-
- if (last_v_pos == to) return;
-
- if (to > screenheight)
- return;
-
- if ((delta = to - last_v_pos) > 0)
- {
- for (i = 0; i < delta; i++)
- putc ('\n', out_stream);
- tputs (term_cr, 1, output_character_function);
- last_c_pos = 0; /* because crlf() will do \r\n */
- }
- else
- { /* delta < 0 */
- if (term_up && *term_up)
- for (i = 0; i < -delta; i++)
- tputs (term_up, 1, output_character_function);
- }
- last_v_pos = to; /* now to is here */
-}
-
-/* Physically print C on out_stream. This is for functions which know
- how to optimize the display. */
-rl_show_char (c)
- int c;
-{
- if (c > 127)
- {
- fprintf (out_stream, "M-");
- c -= 128;
- }
-
-#ifdef DISPLAY_TABS
- if (c < 32 && c != '\t')
-#else
- if (c < 32)
-#endif
- {
-
- c += 64;
- }
-
- putc (c, out_stream);
- fflush (out_stream);
-}
-
-#ifdef DISPLAY_TABS
-int
-rl_character_len (c, pos)
- register int c, pos;
-{
- if (c < ' ' || c > 126)
- {
- if (c == '\t')
- return (((pos | (int)7) + 1) - pos);
- else
- return (3);
- }
- else
- return (1);
-}
-#else
-int
-rl_character_len (c)
- int c;
-{
- if (c < ' ' || c > 126)
- return (3);
- else
- return (1);
-}
-#endif /* DISPLAY_TAB */
-
-/* How to print things in the "echo-area". The prompt is treated as a
- mini-modeline. */
-rl_message (string, arg1, arg2)
- char *string;
-{
- sprintf (msg_buf, string, arg1, arg2);
- rl_display_prompt = msg_buf;
- rl_redisplay ();
-}
-
-/* How to clear things from the "echo-area". */
-rl_clear_message ()
-{
- rl_display_prompt = rl_prompt;
- rl_redisplay ();
-}
-
-/* **************************************************************** */
-/* */
-/* Terminal and Termcap */
-/* */
-/* **************************************************************** */
-
-static char *term_buffer = (char *)NULL;
-static char *term_string_buffer = (char *)NULL;
-
-/* Non-zero means this terminal can't really do anything. */
-int dumb_term = 0;
-
-char PC;
-char *BC, *UP;
-
-/* Some strings to control terminal actions. These are output by tputs (). */
-char *term_goto, *term_clreol, *term_cr, *term_clrpag, *term_backspace;
-
-int screenwidth, screenheight;
-
-/* Non-zero if we determine that the terminal can do character insertion. */
-int terminal_can_insert = 0;
-
-/* How to insert characters. */
-char *term_im, *term_ei, *term_ic, *term_ip, *term_IC;
-
-/* How to delete characters. */
-char *term_dc, *term_DC;
-
-#ifdef HACK_TERMCAP_MOTION
-char *term_forward_char;
-#endif /* HACK_TERMCAP_MOTION */
-
-/* How to go up a line. */
-char *term_up;
-
-/* Re-initialize the terminal considering that the TERM/TERMCAP variable
- has changed. */
-rl_reset_terminal (terminal_name)
- char *terminal_name;
-{
- init_terminal_io (terminal_name);
-}
-
-init_terminal_io (terminal_name)
- char *terminal_name;
-{
- char *term = (terminal_name? terminal_name : (char *)getenv ("TERM"));
- char *tgetstr (), *buffer;
-
-
- if (!term_string_buffer)
- term_string_buffer = (char *)xmalloc (2048);
-
- if (!term_buffer)
- term_buffer = (char *)xmalloc (2048);
-
- buffer = term_string_buffer;
-
- term_clrpag = term_cr = term_clreol = (char *)NULL;
-
- if (!term)
- term = "dumb";
-
- if (tgetent (term_buffer, term) < 0)
- {
- dumb_term = 1;
- return;
- }
-
- BC = tgetstr ("pc", &buffer);
- PC = buffer ? *buffer : 0;
-
- term_backspace = tgetstr ("le", &buffer);
-
- term_cr = tgetstr ("cr", &buffer);
- term_clreol = tgetstr ("ce", &buffer);
- term_clrpag = tgetstr ("cl", &buffer);
-
- if (!term_cr)
- term_cr = "\r";
-
-#ifdef HACK_TERMCAP_MOTION
- term_forward_char = tgetstr ("nd", &buffer);
-#endif /* HACK_TERMCAP_MOTION */
-
- screenwidth = tgetnum ("co");
- if (screenwidth <= 0)
- screenwidth = 80;
- screenwidth--; /* PWP: avoid autowrap bugs */
-
- screenheight = tgetnum ("li");
- if (screenheight <= 0)
- screenheight = 24;
-
- term_im = tgetstr ("im", &buffer);
- term_ei = tgetstr ("ei", &buffer);
- term_IC = tgetstr ("IC", &buffer);
- term_ic = tgetstr ("ic", &buffer);
- term_ip = tgetstr ("ip", &buffer);
- term_IC = tgetstr ("IC", &buffer);
-
- /* "An application program can assume that the terminal can do
- character insertion if *any one of* the capabilities `IC',
- `im', `ic' or `ip' is provided." */
-#ifdef notdef
- /* XXX Circumvent broken code. */
- terminal_can_insert = (term_IC || term_im || term_ic || term_ip);
-#endif
-
- term_up = tgetstr ("up", &buffer);
- term_dc = tgetstr ("dc", &buffer);
- term_DC = tgetstr ("DC", &buffer);
-}
-
-/* A function for the use of tputs () */
-static void
-output_character_function (c)
- int c;
-{
- putc (c, out_stream);
-}
-
-/* Write COUNT characters from STRING to the output stream. */
-static void
-output_some_chars (string, count)
- char *string;
- int count;
-{
- fwrite (string, 1, count, out_stream);
-}
-
-
-/* Delete COUNT characters from the display line. */
-static
-delete_chars (count)
- int count;
-{
- if (count > screenwidth)
- return;
-
- if (term_DC && *term_DC)
- {
- char *tgoto (), *buffer;
- buffer = tgoto (term_DC, 0, count);
- tputs (buffer, 1, output_character_function);
- }
- else
- {
- if (term_dc && *term_dc)
- while (count--)
- tputs (term_dc, 1, output_character_function);
- }
-}
-
-/* Prepare to insert by inserting COUNT blank spaces. */
-static
-start_insert (count)
- int count;
-{
- if (term_im && *term_im)
- tputs (term_im, 1, output_character_function);
-
- if (term_IC && *term_IC &&
- (count > 1 || !term_ic || !*term_ic))
- {
- char *tgoto (), *buffer;
- buffer = tgoto (term_IC, 0, count);
- tputs (buffer, 1, output_character_function);
- }
- else
- {
- if (term_ic && *term_ic)
- while (count--)
- tputs (term_ic, 1, output_character_function);
- }
-}
-
-/* We are finished doing our insertion. Send ending string. */
-static
-end_insert ()
-{
- if (term_ei && *term_ei)
- tputs (term_ei, 1, output_character_function);
-}
-
-/* Move the cursor back. */
-backspace (count)
- int count;
-{
- register int i;
-
- if (term_backspace)
- for (i = 0; i < count; i++)
- tputs (term_backspace, 1, output_character_function);
- else
- for (i = 0; i < count; i++)
- putc ('\b', out_stream);
-}
-
-/* Move to the start of the next line. */
-crlf ()
-{
- tputs (term_cr, 1, output_character_function);
- putc ('\n', out_stream);
-}
-
-/* Clear to the end of the line. COUNT is the minimum
- number of character spaces to clear, */
-clear_to_eol (count)
- int count;
-{
- if (term_clreol) {
- tputs (term_clreol, 1, output_character_function);
- } else {
- register int i;
- /* Do one more character space. */
- count++;
- for (i = 0; i < count; i++)
- putc (' ', out_stream);
- backspace (count);
- }
-}
-
-
-/* **************************************************************** */
-/* */
-/* Saving and Restoring the TTY */
-/* */
-/* **************************************************************** */
-
-#ifdef NEW_TTY_DRIVER
-
-/* Standard flags, including ECHO. */
-static int original_tty_flags = 0;
-
-/* Local mode flags, like LPASS8. */
-static int local_mode_flags = 0;
-
-/* Terminal characters. This has C-s and C-q in it. */
-static struct tchars original_tchars;
-
-/* Local special characters. This has the interrupt characters in it. */
-static struct ltchars original_ltchars;
-
-/* We use this to get and set the tty_flags. */
-static struct sgttyb the_ttybuff;
-
-/* Put the terminal in CBREAK mode so that we can detect key presses. */
-static
-rl_prep_terminal ()
-{
- int tty = fileno (rl_instream);
-
- /* We always get the latest tty values. Maybe stty changed them. */
-
- ioctl (tty, TIOCGETP, &the_ttybuff);
- original_tty_flags = the_ttybuff.sg_flags;
-
- readline_echoing_p = (original_tty_flags & ECHO);
-
- /* If this terminal doesn't care how the 8th bit is used,
- then we can use it for the meta-key.
- We check by seeing if BOTH odd and even parity are allowed. */
- if ((the_ttybuff.sg_flags & (ODDP | EVENP)) == (ODDP | EVENP))
- {
-#ifdef PASS8
- the_ttybuff.sg_flags |= PASS8;
-#endif
-
-#if defined (TIOCLGET) && defined (LPASS8)
- {
- int flags;
- ioctl (tty, TIOCLGET, &flags);
- local_mode_flags = flags;
- flags |= LPASS8;
- ioctl (tty, TIOCLSET, &flags);
- }
-#endif
- }
-
-#ifdef TIOCGETC
- {
- struct tchars temp;
-
- ioctl (tty, TIOCGETC, &original_tchars);
- bcopy (&original_tchars, &temp, sizeof (struct tchars));
-
- /* Get rid of C-s and C-q.
- We remember the value of startc (C-q) so that if the terminal is in
- xoff state, the user can xon it by pressing that character. */
- xon_char = temp.t_startc;
- temp.t_stopc = -1;
- temp.t_startc = -1;
-
- /* If there is an XON character, bind it to restart the output. */
- if (xon_char != -1)
- rl_bind_key (xon_char, rl_restart_output);
-
- /* If there is an EOF char, bind eof_char to it. */
- if (temp.t_eofc != -1)
- eof_char = temp.t_eofc;
-
-#ifdef NEVER
- /* Get rid of C-\ and C-c. */
- temp.t_intrc = temp.t_quitc = -1;
-#endif
-
- ioctl (tty, TIOCSETC, &temp);
- }
-#endif /* TIOCGETC */
-
-#ifdef TIOCGLTC
- {
- struct ltchars temp;
-
- ioctl (tty, TIOCGLTC, &original_ltchars);
- bcopy (&original_ltchars, &temp, sizeof (struct ltchars));
-
- /* Make the interrupt keys go away. Just enough to make people happy. */
- temp.t_dsuspc = -1; /* C-y */
- temp.t_lnextc = -1; /* C-v */
-
- ioctl (tty, TIOCSLTC, &temp);
- }
-#endif /* TIOCGLTC */
-
- the_ttybuff.sg_flags &= ~ECHO;
- the_ttybuff.sg_flags |= CBREAK;
- ioctl (tty, TIOCSETN, &the_ttybuff);
-}
-
-/* Restore the terminal to its original state. */
-static
-rl_deprep_terminal ()
-{
- int tty = fileno (rl_instream);
-
-#if defined (TIOCLGET) && defined (LPASS8)
- if ((the_ttybuff.sg_flags & (ODDP | EVENP)) == (ODDP | EVENP))
- ioctl (tty, TIOCLSET, &local_mode_flags);
-#endif
-
-#ifdef TIOCSLTC
- ioctl (tty, TIOCSLTC, &original_ltchars);
-#endif
-
-#ifdef TIOCSETC
- ioctl (tty, TIOCSETC, &original_tchars);
-#endif
-
- the_ttybuff.sg_flags = original_tty_flags;
- ioctl (tty, TIOCSETN, &the_ttybuff);
- readline_echoing_p = 1;
-}
-
-#else /* !defined (NEW_TTY_DRIVER) */
-static struct termio otio;
-
-static
-rl_prep_terminal ()
-{
- int tty = fileno (rl_instream);
- struct termio tio;
-
- ioctl (tty, TCGETA, &tio);
- ioctl (tty, TCGETA, &otio);
-
- readline_echoing_p = (tio.c_lflag & ECHO);
-
- tio.c_lflag &= ~(ICANON|ECHO);
- tio.c_iflag &= ~(IXON|ISTRIP|INPCK);
-
-#ifndef HANDLE_SIGNALS
- tio.c_lflag &= ~ISIG;
-#endif
-
- tio.c_cc[VEOF] = 1; /* really: MIN */
- tio.c_cc[VEOL] = 0; /* really: TIME */
- ioctl (tty, TCSETAW,&tio);
-}
-
-static
-rl_deprep_terminal ()
-{
- int tty = fileno (rl_instream);
- ioctl (tty, TCSETAW, &otio);
-}
-#endif /* NEW_TTY_DRIVER */
-
-
-/* **************************************************************** */
-/* */
-/* Utility Functions */
-/* */
-/* **************************************************************** */
-
-/* Return 0 if C is not a member of the class of characters that belong
- in words, or 1 if it is. */
-
-int allow_pathname_alphabetic_chars = 0;
-char *pathname_alphabetic_chars = "/-_=~.#$";
-
-int
-alphabetic (c)
- int c;
-{
- if (pure_alphabetic (c) || (numeric (c)))
- return (1);
-
- if (allow_pathname_alphabetic_chars)
- return ((int)rindex (pathname_alphabetic_chars, c));
- else
- return (0);
-}
-
-/* Return non-zero if C is a numeric character. */
-int
-numeric (c)
- int c;
-{
- return (c >= '0' && c <= '9');
-}
-
-/* Ring the terminal bell. */
-int
-ding ()
-{
- if (readline_echoing_p)
- {
- fprintf (stderr, "\007");
- fflush (stderr);
- }
- return (-1);
-}
-
-/* How to abort things. */
-rl_abort ()
-{
- ding ();
- rl_clear_message ();
- rl_init_argument ();
- rl_pending_input = 0;
-
- defining_kbd_macro = 0;
- while (executing_macro)
- pop_executing_macro ();
-
- longjmp (readline_top_level, 1);
-}
-
-/* Return a copy of the string between FROM and TO.
- FROM is inclusive, TO is not. */
-char *
-rl_copy (from, to)
- int from, to;
-{
- register int length;
- char *copy;
-
- /* Fix it if the caller is confused. */
- if (from > to) {
- int t = from;
- from = to;
- to = t;
- }
-
- length = to - from;
- copy = (char *)xmalloc (1 + length);
- strncpy (copy, the_line + from, length);
- copy[length] = '\0';
- return (copy);
-}
-
-
-/* **************************************************************** */
-/* */
-/* Insert and Delete */
-/* */
-/* **************************************************************** */
-
-
-/* Insert a string of text into the line at point. This is the only
- way that you should do insertion. rl_insert () calls this
- function. */
-rl_insert_text (string)
- char *string;
-{
- extern int doing_an_undo;
- register int i, l = strlen (string);
- while (rl_end + l >= rl_line_buffer_len)
- {
- rl_line_buffer =
- (char *)xrealloc (rl_line_buffer,
- rl_line_buffer_len += DEFAULT_BUFFER_SIZE);
- the_line = rl_line_buffer;
- }
-
- for (i = rl_end; i >= rl_point; i--)
- the_line[i + l] = the_line[i];
- strncpy (the_line + rl_point, string, l);
-
- /* Remember how to undo this if we aren't undoing something. */
- if (!doing_an_undo)
- {
- /* If possible and desirable, concatenate the undos. */
- if ((strlen (string) == 1) &&
- rl_undo_list &&
- (rl_undo_list->what == UNDO_INSERT) &&
- (rl_undo_list->end == rl_point) &&
- (rl_undo_list->end - rl_undo_list->start < 20))
- rl_undo_list->end++;
- else
- rl_add_undo (UNDO_INSERT, rl_point, rl_point + l, (char *)NULL);
- }
- rl_point += l;
- rl_end += l;
- the_line[rl_end] = '\0';
-}
-
-/* Delete the string between FROM and TO. FROM is
- inclusive, TO is not. */
-rl_delete_text (from, to)
- int from, to;
-{
- extern int doing_an_undo;
- register char *text;
-
- /* Fix it if the caller is confused. */
- if (from > to) {
- int t = from;
- from = to;
- to = t;
- }
- text = rl_copy (from, to);
- strncpy (the_line + from, the_line + to, rl_end - to);
-
- /* Remember how to undo this delete. */
- if (!doing_an_undo)
- rl_add_undo (UNDO_DELETE, from, to, text);
- else
- free (text);
-
- rl_end -= (to - from);
- the_line[rl_end] = '\0';
-}
-
-
-/* **************************************************************** */
-/* */
-/* Readline character functions */
-/* */
-/* **************************************************************** */
-
-/* This is not a gap editor, just a stupid line input routine. No hair
- is involved in writing any of the functions, and none should be. */
-
-/* Note that:
-
- rl_end is the place in the string that we would place '\0';
- i.e., it is always safe to place '\0' there.
-
- rl_point is the place in the string where the cursor is. Sometimes
- this is the same as rl_end.
-
- Any command that is called interactively receives two arguments.
- The first is a count: the numeric arg pased to this command.
- The second is the key which invoked this command.
-*/
-
-
-/* **************************************************************** */
-/* */
-/* Movement Commands */
-/* */
-/* **************************************************************** */
-
-/* Note that if you `optimize' the display for these functions, you cannot
- use said functions in other functions which do not do optimizing display.
- I.e., you will have to update the data base for rl_redisplay, and you
- might as well let rl_redisplay do that job. */
-
-/* Move forward COUNT characters. */
-rl_forward (count)
- int count;
-{
- if (count < 0)
- rl_backward (-count);
- else
- while (count)
- {
-#ifdef VI_MODE
- if (rl_point == (rl_end - (rl_editing_mode == vi_mode)))
-#else
- if (rl_point == rl_end)
-#endif
- {
- ding ();
- return;
- }
- else
- rl_point++;
- --count;
- }
-}
-
-/* Move backward COUNT characters. */
-rl_backward (count)
- int count;
-{
- if (count < 0)
- rl_forward (-count);
- else
- while (count)
- {
- if (!rl_point)
- {
- ding ();
- return;
- }
- else
- --rl_point;
- --count;
- }
-}
-
-/* Move to the beginning of the line. */
-rl_beg_of_line ()
-{
- rl_point = 0;
-}
-
-/* Move to the end of the line. */
-rl_end_of_line ()
-{
- rl_point = rl_end;
-}
-
-/* Move forward a word. We do what Emacs does. */
-rl_forward_word (count)
- int count;
-{
- int c;
-
- if (count < 0)
- {
- rl_backward_word (-count);
- return;
- }
-
- while (count)
- {
- if (rl_point == rl_end)
- return;
-
- /* If we are not in a word, move forward until we are in one.
- Then, move forward until we hit a non-alphabetic character. */
- c = the_line[rl_point];
- if (!alphabetic (c))
- {
- while (++rl_point < rl_end)
- {
- c = the_line[rl_point];
- if (alphabetic (c)) break;
- }
- }
- if (rl_point == rl_end) return;
- while (++rl_point < rl_end)
- {
- c = the_line[rl_point];
- if (!alphabetic (c)) break;
- }
- --count;
- }
-}
-
-/* Move backward a word. We do what Emacs does. */
-rl_backward_word (count)
- int count;
-{
- int c;
-
- if (count < 0)
- {
- rl_forward_word (-count);
- return;
- }
-
- while (count)
- {
- if (!rl_point)
- return;
-
- /* Like rl_forward_word (), except that we look at the characters
- just before point. */
-
- c = the_line[rl_point - 1];
- if (!alphabetic (c))
- {
- while (--rl_point)
- {
- c = the_line[rl_point - 1];
- if (alphabetic (c)) break;
- }
- }
-
- while (rl_point)
- {
- c = the_line[rl_point - 1];
- if (!alphabetic (c))
- break;
- else --rl_point;
- }
- --count;
- }
-}
-
-/* Clear the current line. Numeric argument to C-l does this. */
-rl_refresh_line ()
-{
- int curr_line = last_c_pos / screenwidth;
-
- move_vert(curr_line);
- move_cursor_relative (0, the_line); /* XXX is this right */
- rl_forced_update_display ();
- rl_display_fixed = 1;
-}
-
-/* C-l typed to a line without quoting clears the screen, and then reprints
- the prompt and the current input line. Given a numeric arg, redraw only
- the current line. */
-rl_clear_screen ()
-{
- extern char *term_clrpag;
- static void output_character_function ();
-
- if (rl_explicit_arg)
- {
- rl_refresh_line ();
- return;
- }
-
- if (term_clrpag)
- tputs (term_clrpag, 1, output_character_function);
- else
- crlf ();
-
- rl_forced_update_display ();
- rl_display_fixed = 1;
-}
-
-
-/* **************************************************************** */
-/* */
-/* Text commands */
-/* */
-/* **************************************************************** */
-
-/* Insert the character C at the current location, moving point forward. */
-rl_insert (count, c)
- int count, c;
-{
- register int i;
- char *string;
-
- if (count <= 0)
- return;
-
- /* If we can optimize, then do it. But don't let people crash
- readline because of extra large arguments. */
- if (count > 1 && count < 1024)
- {
- string = (char *)alloca (1 + count);
-
- for (i = 0; i < count; i++)
- string[i] = c;
-
- string[i] = '\0';
- rl_insert_text (string);
- return;
- }
-
- if (count > 1024)
- {
- int descreaser;
-
- string = (char *)alloca (1024 + 1);
-
- for (i = 0; i < 1024; i++)
- string[i] = c;
-
- while (count)
- {
- descreaser = (count > 1024 ? 1024 : count);
- string[descreaser] = '\0';
- rl_insert_text (string);
- count -= descreaser;
- }
- return;
- }
-
- /* We are inserting a single character.
- If there is pending input, then make a string of all of the
- pending characters that are bound to rl_insert, and insert
- them all. */
- if (any_typein)
- {
- int slen, key = 0, t;
-
- i = 0;
- string = (char *)alloca (ibuffer_len + 1);
- string[i++] = c;
-
- while ((key = rl_get_char()) != -2 &&
- (keymap[key].type == ISFUNC &&
- keymap[key].function == rl_insert))
- string[i++] = key;
-
- if (key != -2)
- rl_unget_char (key);
-
- string[i] = '\0';
- rl_insert_text (string);
- return;
- }
- else
- {
- /* Inserting a single character. */
- string = (char *)alloca (2);
-
- string[1] = '\0';
- string[0] = c;
- rl_insert_text (string);
- }
-}
-
-/* Insert the next typed character verbatim. */
-rl_quoted_insert (count)
- int count;
-{
- int c = rl_read_key (in_stream);
- rl_insert (count, c);
-}
-
-/* Insert a tab character. */
-rl_tab_insert (count)
- int count;
-{
- rl_insert (count, '\t');
-}
-
-#ifdef VI_MODE
-/* Non-zero means enter insertion mode. */
-static vi_doing_insert = 0;
-#endif
-
-/* What to do when a NEWLINE is pressed. We accept the whole line.
- KEY is the key that invoked this command. I guess it could have
- meaning in the future. */
-rl_newline (count, key)
- int count, key;
-{
-
- rl_done = 1;
-
-#ifdef VI_MODE
- {
- if (vi_doing_insert)
- {
- rl_end_undo_group ();
- vi_doing_insert = 0;
- }
- }
-#endif /* VI_MODE */
-
- if (readline_echoing_p)
- {
- move_vert (vis_botlin);
- vis_botlin = 0;
- crlf ();
- fflush (out_stream);
- rl_display_fixed++;
- }
-}
-
-rl_clean_up_for_exit ()
-{
- if (readline_echoing_p)
- {
- move_vert (vis_botlin);
- vis_botlin = 0;
- fflush (out_stream);
- rl_restart_output ();
- }
-}
-
-/* What to do for some uppercase characters, like meta characters,
- and some characters appearing in emacs_ctlx_keymap. This function
- is just a stub, you bind keys to it and the code in rl_dispatch ()
- is special cased. */
-rl_do_lowercase_version (ignore1, ignore2)
- int ignore1, ignore2;
-{
-}
-
-/* Rubout the character behind point. */
-rl_rubout (count)
- int count;
-{
- if (count < 0)
- {
- rl_delete (-count);
- return;
- }
-
- if (!rl_point)
- {
- ding ();
- return;
- }
-
- if (count > 1)
- {
- int orig_point = rl_point;
- rl_backward (count);
- rl_kill_text (orig_point, rl_point);
- }
- else
- {
- int c = the_line[--rl_point];
- rl_delete_text (rl_point, rl_point + 1);
-
- if (rl_point == rl_end && alphabetic (c) && last_c_pos)
- {
- backspace (1);
- putc (' ', out_stream);
- backspace (1);
- last_c_pos--;
- rl_display_fixed++;
- }
- }
-}
-
-/* Delete the character under the cursor. Given a numeric argument,
- kill that many characters instead. */
-rl_delete (count, invoking_key)
- int count;
-{
- if (count < 0)
- {
- rl_rubout (-count);
- return;
- }
-
- if (rl_point == rl_end)
- {
- ding ();
- return;
- }
-
-#ifdef VI_MODE
- if ((count > 1) || ((count == 1) && (rl_editing_mode == vi_mode)))
-#else
- if (count > 1)
-#endif
- {
- int orig_point = rl_point;
- while (count && (rl_point < rl_end))
- {
- rl_point++;
- count--;
- }
- rl_kill_text (orig_point, rl_point);
- rl_point = orig_point;
- }
- else
- rl_delete_text (rl_point, rl_point + 1);
-}
-
-
-/* **************************************************************** */
-/* */
-/* Kill commands */
-/* */
-/* **************************************************************** */
-
-/* The next two functions mimic unix line editing behaviour, except they
- save the deleted text on the kill ring. This is safer than not saving
- it, and since we have a ring, nobody should get screwed. */
-
-/* This does what C-w does in Unix. We can't prevent people from
- using behaviour that they expect. */
-rl_unix_word_rubout ()
-{
- if (!rl_point) ding ();
- else {
- int orig_point = rl_point;
- while (rl_point && whitespace (the_line[rl_point - 1]))
- rl_point--;
- while (rl_point && !whitespace (the_line[rl_point - 1]))
- rl_point--;
- rl_kill_text (rl_point, orig_point);
- }
-}
-
-/* Here is C-u doing what Unix does. You don't *have* to use these
- key-bindings. We have a choice of killing the entire line, or
- killing from where we are to the start of the line. We choose the
- latter, because if you are a Unix weenie, then you haven't backspaced
- into the line at all, and if you aren't, then you know what you are
- doing. */
-rl_unix_line_discard ()
-{
- if (!rl_point) ding ();
- else {
- rl_kill_text (rl_point, 0);
- rl_point = 0;
- }
-}
-
-
-
-/* **************************************************************** */
-/* */
-/* Commands For Typos */
-/* */
-/* **************************************************************** */
-
-/* Random and interesting things in here. */
-
-
-/* **************************************************************** */
-/* */
-/* Changing Case */
-/* */
-/* **************************************************************** */
-
-/* The three kinds of things that we know how to do. */
-#define UpCase 1
-#define DownCase 2
-#define CapCase 3
-
-/* Uppercase the word at point. */
-rl_upcase_word (count)
- int count;
-{
- rl_change_case (count, UpCase);
-}
-
-/* Lowercase the word at point. */
-rl_downcase_word (count)
- int count;
-{
- rl_change_case (count, DownCase);
-}
-
-/* Upcase the first letter, downcase the rest. */
-rl_capitalize_word (count)
- int count;
-{
- rl_change_case (count, CapCase);
-}
-
-/* The meaty function.
- Change the case of COUNT words, performing OP on them.
- OP is one of UpCase, DownCase, or CapCase.
- If a negative argument is given, leave point where it started,
- otherwise, leave it where it moves to. */
-rl_change_case (count, op)
- int count, op;
-{
- register int start = rl_point, end;
- int state = 0;
-
- rl_forward_word (count);
- end = rl_point;
-
- if (count < 0)
- {
- int temp = start;
- start = end;
- end = temp;
- }
-
- /* We are going to modify some text, so let's prepare to undo it. */
- rl_modifying (start, end);
-
- for (; start < end; start++)
- {
- switch (op)
- {
- case UpCase:
- the_line[start] = to_upper (the_line[start]);
- break;
-
- case DownCase:
- the_line[start] = to_lower (the_line[start]);
- break;
-
- case CapCase:
- if (state == 0)
- {
- the_line[start] = to_upper (the_line[start]);
- state = 1;
- }
- else
- {
- the_line[start] = to_lower (the_line[start]);
- }
- if (!pure_alphabetic (the_line[start]))
- state = 0;
- break;
-
- default:
- abort ();
- }
- }
- rl_point = end;
-}
-
-/* **************************************************************** */
-/* */
-/* Transposition */
-/* */
-/* **************************************************************** */
-
-/* Transpose the words at point. */
-rl_transpose_words (count)
- int count;
-{
- char *word1, *word2;
- int w1_beg, w1_end, w2_beg, w2_end;
- int orig_point = rl_point;
-
- if (!count) return;
-
- /* Find the two words. */
- rl_forward_word (count);
- w2_end = rl_point;
- rl_backward_word (1);
- w2_beg = rl_point;
- rl_backward_word (count);
- w1_beg = rl_point;
- rl_forward_word (1);
- w1_end = rl_point;
-
- /* Do some check to make sure that there really are two words. */
- if ((w1_beg == w2_beg) || (w2_beg < w1_end))
- {
- ding ();
- rl_point = orig_point;
- return;
- }
-
- /* Get the text of the words. */
- word1 = rl_copy (w1_beg, w1_end);
- word2 = rl_copy (w2_beg, w2_end);
-
- /* We are about to do many insertions and deletions. Remember them
- as one operation. */
- rl_begin_undo_group ();
-
- /* Do the stuff at word2 first, so that we don't have to worry
- about word1 moving. */
- rl_point = w2_beg;
- rl_delete_text (w2_beg, w2_end);
- rl_insert_text (word1);
-
- rl_point = w1_beg;
- rl_delete_text (w1_beg, w1_end);
- rl_insert_text (word2);
-
- /* This is exactly correct since the text before this point has not
- changed in length. */
- rl_point = w2_end;
-
- /* I think that does it. */
- rl_end_undo_group ();
- free (word1); free (word2);
-}
-
-/* Transpose the characters at point. If point is at the end of the line,
- then transpose the characters before point. */
-rl_transpose_chars (count)
- int count;
-{
- if (!count)
- return;
-
- if (!rl_point || rl_end < 2) {
- ding ();
- return;
- }
-
- while (count) {
- if (rl_point == rl_end) {
- int t = the_line[rl_point - 1];
- the_line[rl_point - 1] = the_line[rl_point - 2];
- the_line[rl_point - 2] = t;
- } else {
- int t = the_line[rl_point];
- the_line[rl_point] = the_line[rl_point - 1];
- the_line[rl_point - 1] = t;
- if (count < 0 && rl_point)
- rl_point--;
- else
- rl_point++;
- }
- if (count < 0)
- count++;
- else
- count--;
- }
-}
-
-
-/* **************************************************************** */
-/* */
-/* Bogus Flow Control */
-/* */
-/* **************************************************************** */
-
-rl_restart_output (count, key)
- int count, key;
-{
- int fildes = fileno (stdin);
-#ifdef TIOCSTART
- ioctl (fildes, TIOCSTART, 0);
-#endif /* TIOCSTART */
-}
-
-/* **************************************************************** */
-/* */
-/* Completion matching, from readline's point of view. */
-/* */
-/* **************************************************************** */
-
-/* Pointer to the generator function for completion_matches ().
- NULL means to use filename_entry_function (), the default filename
- completer. */
-Function *rl_completion_entry_function = (Function *)NULL;
-
-/* Pointer to alternative function to create matches.
- Function is called with TEXT, START, and END.
- START and END are indices in RL_LINE_BUFFER saying what the boundaries
- of TEXT are.
- If this function exists and returns NULL then call the value of
- rl_completion_entry_function to try to match, otherwise use the
- array of strings returned. */
-Function *rl_attempted_completion_function = (Function *)NULL;
-
-/* Complete the word at or before point. You have supplied the function
- that does the initial simple matching selection algorithm (see
- completion_matches ()). The default is to do filename completion. */
-rl_complete (ignore, invoking_key)
- int ignore, invoking_key;
-{
- rl_complete_internal (TAB);
- if (running_in_emacs)
- printf ("%s", the_line);
-}
-
-/* List the possible completions. See description of rl_complete (). */
-rl_possible_completions ()
-{
- rl_complete_internal ('?');
-}
-
-/* The user must press "y" or "n". Non-zero return means "y" pressed. */
-get_y_or_n ()
-{
- int c;
- loop:
- c = rl_read_key (in_stream);
- if (c == 'y' || c == 'Y') return (1);
- if (c == 'n' || c == 'N') return (0);
- if (c == ABORT_CHAR) rl_abort ();
- ding (); goto loop;
-}
-
-/* Up to this many items will be displayed in response to a
- possible-completions call. After that, we ask the user if
- she is sure she wants to see them all. */
-int rl_completion_query_items = 100;
-
-/* The basic list of characters that signal a break between words for the
- completer routine. The contents of this variable is what breaks words
- in the shell, i.e. " \t\n\"\\'`@$><=" */
-char *rl_basic_word_break_characters = " \t\n\"\\'`@$><=";
-
-/* The list of characters that signal a break between words for
- rl_complete_internal. The default list is the contents of
- rl_basic_word_break_characters. */
-char *rl_completer_word_break_characters = (char *)NULL;
-
-/* List of characters that are word break characters, but should be left
- in TEXT when it is passed to the completion function. The shell uses
- this to help determine what kind of completing to do. */
-char *rl_special_prefixes = (char *)NULL;
-
-/* If non-zero, then disallow duplicates in the matches. */
-int rl_ignore_completion_duplicates = 1;
-
-/* Non-zero means that the results of the matches are to be treated
- as filenames. This is ALWAYS zero on entry, and can only be changed
- within a completion entry finder function. */
-int rl_filename_completion_desired = 0;
-
-/* Complete the word at or before point.
- WHAT_TO_DO says what to do with the completion.
- `?' means list the possible completions.
- TAB means do standard completion.
- `*' means insert all of the possible completions. */
-rl_complete_internal (what_to_do)
- int what_to_do;
-{
- char *filename_completion_function ();
- char **completion_matches (), **matches;
- Function *our_func;
- int start, end, delimiter = 0;
- char *text;
-
- if (rl_completion_entry_function)
- our_func = rl_completion_entry_function;
- else
- our_func = (int (*)())filename_completion_function;
-
- /* Only the completion entry function can change this. */
- rl_filename_completion_desired = 0;
-
- /* We now look backwards for the start of a filename/variable word. */
- end = rl_point;
- if (rl_point)
- {
- while (--rl_point &&
- !rindex (rl_completer_word_break_characters, the_line[rl_point]));
-
- /* If we are at a word break, then advance past it. */
- if (rindex (rl_completer_word_break_characters, (the_line[rl_point])))
- {
- /* If the character that caused the word break was a quoting
- character, then remember it as the delimiter. */
- if (rindex ("\"'", the_line[rl_point]) && (end - rl_point) > 1)
- delimiter = the_line[rl_point];
-
- /* If the character isn't needed to determine something special
- about what kind of completion to perform, then advance past it. */
-
- if (!rl_special_prefixes ||
- !rindex (rl_special_prefixes, the_line[rl_point]))
- rl_point++;
- }
- }
-
- start = rl_point;
- rl_point = end;
- text = rl_copy (start, end);
-
- /* If the user wants to TRY to complete, but then wants to give
- up and use the default completion function, they set the
- variable rl_attempted_completion_function. */
- if (rl_attempted_completion_function)
- {
- matches =
- (char **)(*rl_attempted_completion_function) (text, start, end);
-
- if (matches)
- goto after_usual_completion;
- }
-
- matches = completion_matches (text, our_func, start, end);
-
- after_usual_completion:
- free (text);
-
- if (!matches)
- ding ();
- else
- {
- register int i;
-
- some_matches:
-
- /* It seems to me that in all the cases we handle we would like
- to ignore duplicate possiblilities. Scan for the text to
- insert being identical to the other completions. */
- if (rl_ignore_completion_duplicates)
- {
- char *lowest_common;
- int j, newlen = 0;
-
- /* Sort the items. */
- /* It is safe to sort this array, because the lowest common
- denominator found in matches[0] will remain in place. */
- for (i = 0; matches[i]; i++);
- qsort (matches, i, sizeof (char *), compare_strings);
-
- /* Remember the lowest common denimator for it may be unique. */
- lowest_common = savestring (matches[0]);
-
- for (i = 0; matches[i + 1]; i++)
- {
- if (strcmp (matches[i], matches[i + 1]) == 0)
- {
- free (matches[i]);
- matches[i] = (char *)-1;
- }
- else
- newlen++;
- }
-
- /* We have marked all the dead slots with (char *)-1.
- Copy all the non-dead entries into a new array. */
- {
- char **temp_array =
- (char **)malloc ((3 + newlen) * sizeof (char *));
-
- for (i = 1, j = 1; matches[i]; i++)
- if (matches[i] != (char *)-1)
- temp_array[j++] = matches[i];
- temp_array[j] = (char *)NULL;
-
- if (matches[0] != (char *)-1)
- free (matches[0]);
- free (matches);
-
- matches = temp_array;
- }
-
- /* Place the lowest common denominator back in [0]. */
- matches[0] = lowest_common;
-
- /* If there is one string left, and it is identical to the
- lowest common denominator, then the LCD is the string to
- insert. */
- if (j == 2 && strcmp (matches[0], matches[1]) == 0)
- {
- free (matches[1]);
- matches[1] = (char *)NULL;
- }
- }
-
- switch (what_to_do)
- {
- case TAB:
- rl_delete_text (start, rl_point);
- rl_point = start;
- rl_insert_text (matches[0]);
-
- /* If there are more matches, ring the bell to indicate.
- If this was the only match, and we are hacking files,
- check the file to see if it was a directory. If so,
- add a '/' to the name. If not, and we are at the end
- of the line, then add a space. */
- if (matches[1])
- {
- ding (); /* There are other matches remaining. */
- }
- else
- {
- char temp_string[2];
-
- temp_string[0] = delimiter ? delimiter : ' ';
- temp_string[1] = '\0';
-
- if (rl_filename_completion_desired)
- {
- struct stat finfo;
- char *tilde_expand ();
- char *filename = tilde_expand (matches[0]);
-
- if ((stat (filename, &finfo) == 0) &&
- ((finfo.st_mode & S_IFMT) == S_IFDIR))
- {
- if (the_line[rl_point] != '/')
- rl_insert_text ("/");
- }
- else
- {
- if (rl_point == rl_end)
- rl_insert_text (temp_string);
- }
- free (filename);
- }
- else
- {
- if (rl_point == rl_end)
- rl_insert_text (temp_string);
- }
- }
- break;
-
- case '*':
- {
- int i = 1;
-
- rl_delete_text (start, rl_point);
- rl_point = start;
- rl_begin_undo_group ();
- if (matches[1])
- {
- while (matches[i])
- {
- rl_insert_text (matches[i++]);
- rl_insert_text (" ");
- }
- }
- else
- {
- rl_insert_text (matches[0]);
- rl_insert_text (" ");
- }
- rl_end_undo_group ();
- }
- break;
-
-
- case '?':
- {
- int len, count, limit, max = 0;
- int j, k, l;
-
- /* Handle simple case first. What if there is only one answer? */
- if (!matches[1])
- {
- char *temp;
-
- if (rl_filename_completion_desired)
- temp = rindex (matches[0], '/');
- else
- temp = (char *)NULL;
-
- if (!temp)
- temp = matches[0];
- else
- temp++;
-
- crlf ();
- fprintf (out_stream, "%s", temp);
- crlf ();
- goto restart;
- }
-
- /* There is more than one answer. Find out how many there are,
- and find out what the maximum printed length of a single entry
- is. */
- for (i = 1; matches[i]; i++)
- {
- char *temp = (char *)NULL;
-
- /* If we are hacking filenames, then only count the characters
- after the last slash in the pathname. */
- if (rl_filename_completion_desired)
- temp = rindex (matches[i], '/');
- else
- temp = (char *)NULL;
-
- if (!temp)
- temp = matches[i];
- else
- temp++;
-
- if (strlen (temp) > max)
- max = strlen (temp);
- }
-
- len = i;
-
- /* If there are many items, then ask the user if she
- really wants to see them all. */
- if (len >= rl_completion_query_items)
- {
- crlf ();
- fprintf (out_stream,
- "There are %d possibilities. Do you really", len);
- crlf ();
- fprintf (out_stream, "wish to see them all? (y or n)");
- fflush (out_stream);
- if (!get_y_or_n ())
- {
- crlf ();
- goto restart;
- }
- }
- /* How many items of MAX length can we fit in the screen window? */
- max += 2;
- limit = screenwidth / max;
- if (limit != 1 && (limit * max == screenwidth))
- limit--;
-
- /* How many iterations of the printing loop? */
- count = (len + (limit - 1)) / limit;
-
- /* Watch out for special case. If LEN is less than LIMIT, then
- just do the inner printing loop. */
- if (len < limit) count = 1;
-
- /* Sort the items if they are not already sorted. */
- if (!rl_ignore_completion_duplicates)
- {
- qsort (matches, len, sizeof (char *), compare_strings);
- }
-
- /* Print the sorted items, up-and-down alphabetically, like
- ls might. */
- crlf ();
-
- for (i = 1; i < count + 1; i++)
- {
- for (j = 0, l = i; j < limit; j++)
- {
- if (l > len || !matches[l])
- {
- break;
- }
- else
- {
- char *temp = (char *)NULL;
-
- if (rl_filename_completion_desired)
- temp = rindex (matches[l], '/');
- else
- temp = (char *)NULL;
-
- if (!temp)
- temp = matches[l];
- else
- temp++;
-
- fprintf (out_stream, "%s", temp);
- for (k = 0; k < max - strlen (temp); k++)
- putc (' ', out_stream);
- }
- l += count;
- }
- crlf ();
- }
- restart:
-
- rl_on_new_line ();
- }
- break;
-
- default:
- abort ();
- }
-
- for (i = 0; matches[i]; i++)
- free (matches[i]);
- free (matches);
- }
-}
-
-/* A completion function for usernames.
- TEXT contains a partial username preceded by a random
- character (usually `~'). */
-char *
-username_completion_function (text, state)
- int state;
- char *text;
-{
- static char *username = (char *)NULL;
- static struct passwd *entry;
- static int namelen;
-
- if (!state)
- {
- if (username)
- free (username);
- username = savestring (&text[1]);
- namelen = strlen (username);
- setpwent ();
- }
-
- while (entry = getpwent ())
- {
- if (strncmp (username, entry->pw_name, namelen) == 0)
- break;
- }
-
- if (!entry)
- {
- endpwent ();
- return ((char *)NULL);
- }
- else
- {
- char *value = (char *)xmalloc (2 + strlen (entry->pw_name));
- *value = *text;
- strcpy (value + 1, entry->pw_name);
- rl_filename_completion_desired = 1;
- return (value);
- }
-}
-
-/* If non-null, this contains the address of a function to call if the
- standard meaning for expanding a tilde fails. The function is called
- with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
- which is the expansion, or a NULL pointer if there is no expansion. */
-Function *rl_tilde_expander = (Function *)NULL;
-
-/* Expand FILENAME if it begins with a tilde. This always returns
- a new string. */
-char *
-tilde_expand (filename)
- char *filename;
-{
- char *dirname = filename ? savestring (filename) : (char *)NULL;
-
- if (dirname && *dirname == '~')
- {
- char *temp_name;
- if (!dirname[1] || dirname[1] == '/')
- {
- /* Prepend $HOME to the rest of the string. */
- char *temp_home = (char *)getenv ("HOME");
-
- temp_name = (char *)alloca (1 + strlen (&dirname[1])
- + (temp_home? strlen (temp_home) : 0));
- temp_name[0] = '\0';
- if (temp_home)
- strcpy (temp_name, temp_home);
- strcat (temp_name, &dirname[1]);
- free (dirname);
- dirname = savestring (temp_name);
- }
- else
- {
- struct passwd *getpwnam (), *user_entry;
- char *username = (char *)alloca (257);
- int i, c;
-
- for (i = 1; c = dirname[i]; i++)
- {
- if (c == '/') break;
- else username[i - 1] = c;
- }
- username[i - 1] = '\0';
-
- if (!(user_entry = getpwnam (username)))
- {
- /* If the calling program has a special syntax for
- expanding tildes, and we couldn't find a standard
- expansion, then let them try. */
- if (rl_tilde_expander)
- {
- char *expansion;
-
- expansion = (char *)(*rl_tilde_expander) (username);
-
- if (expansion)
- {
- temp_name = (char *)alloca (1 + strlen (expansion)
- + strlen (&dirname[i]));
- strcpy (temp_name, expansion);
- strcat (temp_name, &dirname[i]);
- free (expansion);
- goto return_name;
- }
- }
- /*
- * We shouldn't report errors.
- */
- }
- else
- {
- temp_name = (char *)alloca (1 + strlen (user_entry->pw_dir)
- + strlen (&dirname[i]));
- strcpy (temp_name, user_entry->pw_dir);
- strcat (temp_name, &dirname[i]);
- return_name:
- free (dirname);
- dirname = savestring (temp_name);
- }
- }
- }
- return (dirname);
-}
-
-
-/* **************************************************************** */
-/* */
-/* Undo, and Undoing */
-/* */
-/* **************************************************************** */
-
-/* Non-zero tells rl_delete_text and rl_insert_text to not add to
- the undo list. */
-int doing_an_undo = 0;
-
-/* The current undo list for THE_LINE. */
-UNDO_LIST *rl_undo_list = (UNDO_LIST *)NULL;
-
-/* Remember how to undo something. Concatenate some undos if that
- seems right. */
-rl_add_undo (what, start, end, text)
- enum undo_code what;
- int start, end;
- char *text;
-{
- UNDO_LIST *temp = (UNDO_LIST *)xmalloc (sizeof (UNDO_LIST));
- temp->what = what;
- temp->start = start;
- temp->end = end;
- temp->text = text;
- temp->next = rl_undo_list;
- rl_undo_list = temp;
-}
-
-/* Free the existing undo list. */
-free_undo_list ()
-{
- while (rl_undo_list) {
- UNDO_LIST *release = rl_undo_list;
- rl_undo_list = rl_undo_list->next;
-
- if (release->what == UNDO_DELETE)
- free (release->text);
-
- free (release);
- }
-}
-
-/* Undo the next thing in the list. Return 0 if there
- is nothing to undo, or non-zero if there was. */
-int
-rl_do_undo ()
-{
- UNDO_LIST *release;
- int waiting_for_begin = 0;
-
-undo_thing:
- if (!rl_undo_list)
- return (0);
-
- doing_an_undo = 1;
-
- switch (rl_undo_list->what) {
-
- /* Undoing deletes means inserting some text. */
- case UNDO_DELETE:
- rl_point = rl_undo_list->start;
- rl_insert_text (rl_undo_list->text);
- free (rl_undo_list->text);
- break;
-
- /* Undoing inserts means deleting some text. */
- case UNDO_INSERT:
- rl_delete_text (rl_undo_list->start, rl_undo_list->end);
- rl_point = rl_undo_list->start;
- break;
-
- /* Undoing an END means undoing everything 'til we get to
- a BEGIN. */
- case UNDO_END:
- waiting_for_begin++;
- break;
-
- /* Undoing a BEGIN means that we are done with this group. */
- case UNDO_BEGIN:
- if (waiting_for_begin)
- waiting_for_begin--;
- else
- abort ();
- break;
- }
-
- doing_an_undo = 0;
-
- release = rl_undo_list;
- rl_undo_list = rl_undo_list->next;
- free (release);
-
- if (waiting_for_begin)
- goto undo_thing;
-
- return (1);
-}
-
-/* Begin a group. Subsequent undos are undone as an atomic operation. */
-rl_begin_undo_group ()
-{
- rl_add_undo (UNDO_BEGIN, 0, 0, 0);
-}
-
-/* End an undo group started with rl_begin_undo_group (). */
-rl_end_undo_group ()
-{
- rl_add_undo (UNDO_END, 0, 0, 0);
-}
-
-/* Save an undo entry for the text from START to END. */
-rl_modifying (start, end)
- int start, end;
-{
- if (start > end)
- {
- int t = start;
- start = end;
- end = t;
- }
-
- if (start != end)
- {
- char *temp = rl_copy (start, end);
- rl_begin_undo_group ();
- rl_add_undo (UNDO_DELETE, start, end, temp);
- rl_add_undo (UNDO_INSERT, start, end, (char *)NULL);
- rl_end_undo_group ();
- }
-}
-
-/* Revert the current line to its previous state. */
-rl_revert_line ()
-{
- if (!rl_undo_list) ding ();
- else {
- while (rl_undo_list)
- rl_do_undo ();
- }
-}
-
-/* Do some undoing of things that were done. */
-rl_undo_command (count)
-{
- if (count < 0) return; /* Nothing to do. */
-
- while (count)
- {
- if (rl_do_undo ())
- {
- count--;
- }
- else
- {
- ding ();
- break;
- }
- }
-}
-
-/* **************************************************************** */
-/* */
-/* History Utilities */
-/* */
-/* **************************************************************** */
-
-/* We already have a history library, and that is what we use to control
- the history features of readline. However, this is our local interface
- to the history mechanism. */
-
-/* While we are editing the history, this is the saved
- version of the original line. */
-HIST_ENTRY *saved_line_for_history = (HIST_ENTRY *)NULL;
-
-/* Set the history pointer back to the last entry in the history. */
-start_using_history ()
-{
- using_history ();
- if (saved_line_for_history)
- free_history_entry (saved_line_for_history);
-
- saved_line_for_history = (HIST_ENTRY *)NULL;
-}
-
-/* Free the contents (and containing structure) of a HIST_ENTRY. */
-free_history_entry (entry)
- HIST_ENTRY *entry;
-{
- if (!entry) return;
- if (entry->line)
- free (entry->line);
- free (entry);
-}
-
-/* Perhaps put back the current line if it has changed. */
-maybe_replace_line ()
-{
- HIST_ENTRY *temp = current_history ();
-
- /* If the current line has changed, save the changes. */
- if (temp && ((UNDO_LIST *)(temp->data) != rl_undo_list)) {
- temp = replace_history_entry (where_history (), the_line, rl_undo_list);
- free (temp->line);
- free (temp);
- }
-}
-
-/* Put back the saved_line_for_history if there is one. */
-maybe_unsave_line ()
-{
- if (saved_line_for_history) {
- strcpy (the_line, saved_line_for_history->line);
- rl_undo_list = (UNDO_LIST *)saved_line_for_history->data;
- free_history_entry (saved_line_for_history);
- saved_line_for_history = (HIST_ENTRY *)NULL;
- rl_end = rl_point = strlen (the_line);
- } else {
- ding ();
- }
-}
-
-/* Save the current line in saved_line_for_history. */
-maybe_save_line ()
-{
- if (!saved_line_for_history) {
- saved_line_for_history = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
- saved_line_for_history->line = savestring (the_line);
- saved_line_for_history->data = (char *)rl_undo_list;
- }
-}
-
-
-
-/* **************************************************************** */
-/* */
-/* History Commands */
-/* */
-/* **************************************************************** */
-
-/* Meta-< goes to the start of the history. */
-rl_beginning_of_history ()
-{
- rl_get_previous_history (1 + where_history ());
-}
-
-/* Meta-> goes to the end of the history. (The current line). */
-rl_end_of_history ()
-{
- maybe_replace_line ();
- using_history ();
- maybe_unsave_line ();
-}
-
-/* Move down to the next history line. */
-rl_get_next_history (count)
- int count;
-{
- HIST_ENTRY *temp = (HIST_ENTRY *)NULL;
-
- if (count < 0)
- {
- rl_get_previous_history (-count);
- return;
- }
-
- if (!count)
- return;
-
- maybe_replace_line ();
-
- while (count)
- {
- temp = next_history ();
- if (!temp)
- break;
- --count;
- }
-
- if (!temp)
- maybe_unsave_line ();
- else
- {
- strcpy (the_line, temp->line);
- rl_undo_list = (UNDO_LIST *)temp->data;
- rl_end = rl_point = strlen (the_line);
- }
-}
-
-/* Get the previous item out of our interactive history, making it the current
- line. If there is no previous history, just ding. */
-rl_get_previous_history (count)
- int count;
-{
- HIST_ENTRY *old_temp = (HIST_ENTRY *)NULL;
- HIST_ENTRY *temp = (HIST_ENTRY *)NULL;
-
- if (count < 0)
- {
- rl_get_next_history (-count);
- return;
- }
-
- if (!count)
- return;
-
- /* If we don't have a line saved, then save this one. */
- maybe_save_line ();
-
- /* If the current line has changed, save the changes. */
- maybe_replace_line ();
-
- while (count)
- {
- temp = previous_history ();
- if (!temp)
- break;
- else
- old_temp = temp;
- --count;
- }
-
- /* If there was a large argument, and we moved back to the start of the
- history, that is not an error. So use the last value found. */
- if (!temp && old_temp)
- temp = old_temp;
-
- if (!temp)
- ding ();
- else
- {
- strcpy (the_line, temp->line);
- rl_undo_list = (UNDO_LIST *)temp->data;
- rl_end = rl_point = strlen (the_line);
-#ifdef VI_MODE
- if (rl_editing_mode == vi_mode)
- rl_point = 0;
-#endif /* VI_MODE */
- }
-}
-
-/* There is a command in ksh which yanks into this line, the last word
- of the previous line. Here it is. We left it on M-. */
-rl_yank_previous_last_arg (ignore)
- int ignore;
-{
-}
-
-
-
-/* **************************************************************** */
-/* */
-/* I-Search and Searching */
-/* */
-/* **************************************************************** */
-
-/* Search backwards through the history looking for a string which is typed
- interactively. Start with the current line. */
-rl_reverse_search_history (sign, key)
- int sign;
- int key;
-{
- rl_search_history (-sign, key);
-}
-
-/* Search forwards through the history looking for a string which is typed
- interactively. Start with the current line. */
-rl_forward_search_history (sign, key)
- int sign;
- int key;
-{
- rl_search_history (sign, key);
-}
-
-/* Display the current state of the search in the echo-area.
- SEARCH_STRING contains the string that is being searched for,
- DIRECTION is zero for forward, or 1 for reverse,
- WHERE is the history list number of the current line. If it is
- -1, then this line is the starting one. */
-rl_display_search (search_string, reverse_p, where)
- char *search_string;
- int reverse_p, where;
-{
- char *message = (char *)NULL;
-
- message =
- (char *)alloca (1 + (search_string ? strlen (search_string) : 0) + 30);
-
- *message = '\0';
-
-#ifdef NEVER
- if (where != -1)
- sprintf (message, "[%d]", where + history_base);
-#endif
-
- strcat (message, "(");
-
- if (reverse_p)
- strcat (message, "reverse-");
-
- strcat (message, "i-search)`");
-
- if (search_string)
- strcat (message, search_string);
-
- strcat (message, "': ");
- rl_message (message, 0, 0);
- rl_redisplay ();
-}
-
-/* Search through the history looking for an interactively typed string.
- This is analogous to i-search. We start the search in the current line.
- DIRECTION is which direction to search; > 0 means forward, < 0 means
- backwards. */
-rl_search_history (direction, invoking_key)
- int direction;
- int invoking_key;
-{
- /* The string that the user types in to search for. */
- char *search_string = (char *)alloca (128);
-
- /* The current length of SEARCH_STRING. */
- int search_string_index;
-
- /* The list of lines to search through. */
- char **lines;
-
- /* The length of LINES. */
- int hlen;
-
- /* Where we get LINES from. */
- HIST_ENTRY **hlist = history_list ();
-
- int orig_point = rl_point;
- int orig_line = where_history ();
- int last_found_line = orig_line;
- int c, done = 0;
- register int i = 0;
-
-
- /* The line currently being searched. */
- char *sline;
-
- /* Offset in that line. */
- int index;
-
- /* Non-zero if we are doing a reverse search. */
- int reverse = (direction < 0);
-
- /* Create an arrary of pointers to the lines that we want to search. */
-
- maybe_replace_line ();
- if (hlist)
- for (i = 0; hlist[i]; i++);
-
- /* Allocate space for this many lines, +1 for the current input line,
- and remember those lines. */
- lines = (char **)alloca ((1 + (hlen = i)) * sizeof (char *));
- for (i = 0; i < hlen; i++)
- lines[i] = hlist[i]->line;
-
- if (saved_line_for_history)
- lines[i] = saved_line_for_history->line;
- else
- {
- /* So I have to type it in this way instead. */
- lines[i] = (char *)alloca (1 + strlen (the_line));
- strcpy (lines[i], &the_line[0]);
- }
-
- hlen++;
-
- /* The line where we start the search. */
- i = orig_line;
-
- /* Initialize search parameters. */
- *search_string = '\0';
- search_string_index = 0;
-
- rl_display_search (search_string, reverse, -1);
-
- sline = the_line;
- index = rl_point;
-
- while (!done)
- {
- c = rl_read_key (in_stream);
-
- /* Hack C to Do What I Mean. */
- {
- Function *f = (Function *)NULL;
-
- if (keymap[c].type == ISFUNC)
- f = keymap[c].function;
-
- if (f == rl_reverse_search_history)
- c = reverse ? -1 : -2;
- else if (f == rl_forward_search_history)
- c = !reverse ? -1 : -2;
- }
-
- switch (c)
- {
- case ESC:
- done = 1;
- continue;
-
- /* case invoking_key: */
- case -1:
- goto search_again;
-
- /* switch directions */
- case -2:
- direction = -direction;
- reverse = (direction < 0);
-
- goto do_search;
-
- case CTRL ('G'):
- strcpy (the_line, lines[orig_line]);
- rl_point = orig_point;
- rl_end = strlen (the_line);
- rl_clear_message ();
- return;
-
- default:
- if (c < 32 || c > 126)
- {
- rl_execute_next (c);
- done = 1;
- continue;
- }
- else
- {
- search_string[search_string_index++] = c;
- search_string[search_string_index] = '\0';
- goto do_search;
-
- search_again:
-
- if (!search_string_index)
- continue;
- else
- {
- if (reverse)
- --index;
- else
- if (index != strlen (sline))
- ++index;
- else
- ding ();
- }
- do_search:
-
- while (1)
- {
- if (reverse)
- {
- while (index >= 0)
- if (strncmp
- (search_string,
- sline + index,
- search_string_index) == 0)
- goto string_found;
- else
- index--;
- }
- else
- {
- register int limit =
- (strlen (sline) - search_string_index) + 1;
-
- while (index < limit)
- {
- if (strncmp (search_string,
- sline + index,
- search_string_index) == 0)
- goto string_found;
- index++;
- }
- }
-
- next_line:
- i += direction;
-
- /* At limit for direction? */
- if ((reverse && i < 0) ||
- (!reverse && i == hlen))
- goto search_failed;
-
- sline = lines[i];
- if (reverse)
- index = strlen (sline);
- else
- index = 0;
-
- /* If the search string is longer than the current
- line, no match. */
- if (search_string_index > strlen (sline))
- goto next_line;
-
- /* Start actually searching. */
- if (reverse)
- index -= search_string_index;
- }
-
- search_failed:
- /* We cannot find the search string. Ding the bell. */
- ding ();
- i = last_found_line;
- break;
-
- string_found:
- /* We have found the search string. Just display it. But don't
- actually move there in the history list until the user accepts
- the location. */
- strcpy (the_line, lines[i]);
- rl_point = index;
- rl_end = strlen (the_line);
- last_found_line = i;
- rl_display_search (search_string, reverse,
- (i == orig_line) ? -1 : i);
- }
- }
- continue;
- }
- /* The user has won. They found the string that they wanted. Now all
- we have to do is place them there. */
- {
- int now = last_found_line;
-
- /* First put back the original state. */
- strcpy (the_line, lines[orig_line]);
-
- if (now < orig_line)
- rl_get_previous_history (orig_line - now);
- else
- rl_get_next_history (now - orig_line);
-
- rl_point = index;
- rl_clear_message ();
- }
-}
-
-/* Make C be the next command to be executed. */
-rl_execute_next (c)
- int c;
-{
- rl_pending_input = c;
-}
-
-/* **************************************************************** */
-/* */
-/* Killing Mechanism */
-/* */
-/* **************************************************************** */
-
-/* What we assume for a max number of kills. */
-#define DEFAULT_MAX_KILLS 10
-
-/* The real variable to look at to find out when to flush kills. */
-int rl_max_kills = DEFAULT_MAX_KILLS;
-
-/* Where to store killed text. */
-char **rl_kill_ring = (char **)NULL;
-
-/* Where we are in the kill ring. */
-int rl_kill_index = 0;
-
-/* How many slots we have in the kill ring. */
-int rl_kill_ring_length = 0;
-
-/* How to say that you only want to save a certain amount
- of kill material. */
-rl_set_retained_kills (num)
- int num;
-{}
-
-/* The way to kill something. This appends or prepends to the last
- kill, if the last command was a kill command. if FROM is less
- than TO, then the text is appended, otherwise prepended. If the
- last command was not a kill command, then a new slot is made for
- this kill. */
-rl_kill_text (from, to)
- int from, to;
-{
- int slot;
- char *text = rl_copy (from, to);
-
- /* Is there anything to kill? */
- if (from == to) {
- free (text);
- last_command_was_kill++;
- return;
- }
-
- /* Delete the copied text from the line. */
- rl_delete_text (from, to);
-
- /* First, find the slot to work with. */
- if (!last_command_was_kill) {
-
- /* Get a new slot. */
- if (!rl_kill_ring) {
-
- /* If we don't have any defined, then make one. */
- rl_kill_ring =
- (char **)xmalloc (((rl_kill_ring_length = 1) + 1) * sizeof (char *));
- slot = 1;
-
- } else {
-
- /* We have to add a new slot on the end, unless we have exceeded
- the max limit for remembering kills. */
- slot = rl_kill_ring_length;
- if (slot == rl_max_kills) {
- register int i;
- free (rl_kill_ring[0]);
- for (i = 0; i < slot; i++)
- rl_kill_ring[i] = rl_kill_ring[i + 1];
- } else {
- rl_kill_ring =
- (char **)xrealloc (rl_kill_ring,
- ((slot = (rl_kill_ring_length += 1)) + 1)
- * sizeof (char *));
- }
- }
- slot--;
- } else {
- slot = rl_kill_ring_length - 1;
- }
-
- /* If the last command was a kill, prepend or append. */
- if (last_command_was_kill) {
- char *old = rl_kill_ring[slot];
- char *new = (char *)xmalloc (1 + strlen (old) + strlen (text));
-
- if (from < to) {
- strcpy (new, old);
- strcat (new, text);
- } else {
- strcpy (new, text);
- strcat (new, old);
- }
- free (old);
- free (text);
- rl_kill_ring[slot] = new;
- } else {
- rl_kill_ring[slot] = text;
- }
- rl_kill_index = slot;
- last_command_was_kill++;
-}
-
-/* Now REMEMBER! In order to do prepending or appending correctly, kill
- commands always make rl_point's original position be the FROM argument,
- and rl_point's extent be the TO argument. */
-
-
-/* **************************************************************** */
-/* */
-/* Killing Commands */
-/* */
-/* **************************************************************** */
-
-/* Delete the word at point, saving the text in the kill ring. */
-rl_kill_word (count)
- int count;
-{
- int orig_point = rl_point;
-
- if (count < 0)
- rl_backward_kill_word (-count);
- else
- {
- rl_forward_word (count);
-
- if (rl_point != orig_point)
- rl_kill_text (orig_point, rl_point);
-
- rl_point = orig_point;
- }
-}
-
-/* Rubout the word before point, placing it on the kill ring. */
-rl_backward_kill_word (count)
- int count;
-{
- int orig_point = rl_point;
-
- if (count < 0)
- rl_kill_word (-count);
- else
- {
- rl_backward_word (count);
-
- if (rl_point != orig_point)
- rl_kill_text (orig_point, rl_point);
- }
-}
-
-/* Kill from here to the end of the line. If DIRECTION is negative, kill
- back to the line start instead. */
-rl_kill_line (direction)
- int direction;
-{
- int orig_point = rl_point;
-
- if (direction < 0)
- rl_backward_kill_line (1);
- else
- {
- rl_end_of_line ();
- if (orig_point != rl_point)
- rl_kill_text (orig_point, rl_point);
- rl_point = orig_point;
- }
-}
-
-/* Kill backwards to the start of the line. If DIRECTION is negative, kill
- forwards to the line end instead. */
-rl_backward_kill_line (direction)
- int direction;
-{
- int orig_point = rl_point;
-
- if (direction < 0)
- rl_kill_line (1);
- else
- {
- if (!rl_point)
- ding ();
- else
- {
- rl_beg_of_line ();
- rl_kill_text (orig_point, rl_point);
- }
- }
-}
-
-/* Yank back the last killed text. This ignores arguments. */
-rl_yank ()
-{
- if (!rl_kill_ring) rl_abort ();
- rl_insert_text (rl_kill_ring[rl_kill_index]);
-}
-
-/* If the last command was yank, or yank_pop, and the text just
- before point is identical to the current kill item, then
- delete that text from the line, rotate the index down, and
- yank back some other text. */
-rl_yank_pop ()
-{
- int l;
-
- if (((rl_last_func != rl_yank_pop) && (rl_last_func != rl_yank)) ||
- !rl_kill_ring)
- {
- rl_abort ();
- }
-
- l = strlen (rl_kill_ring[rl_kill_index]);
- if (((rl_point - l) >= 0) &&
- (strncmp (the_line + (rl_point - l),
- rl_kill_ring[rl_kill_index], l) == 0))
- {
- rl_delete_text ((rl_point - l), rl_point);
- rl_point -= l;
- rl_kill_index--;
- if (rl_kill_index < 0)
- rl_kill_index = rl_kill_ring_length - 1;
- rl_yank ();
- }
- else
- rl_abort ();
-
-}
-
-/* Yank the COUNTth argument from the previous history line. */
-rl_yank_nth_arg (count, ignore)
- int count;
-{
- register HIST_ENTRY *entry = previous_history ();
- char *arg;
-
- if (entry)
- next_history ();
- else
- {
- ding ();
- return;
- }
-
- arg = history_arg_extract (count, count, entry->line);
- if (!arg || !*arg)
- {
- ding ();
- return;
- }
-
- rl_begin_undo_group ();
- if (rl_point && the_line[rl_point - 1] != ' ')
- rl_insert_text (" ");
- rl_insert_text (arg);
- free (arg);
- rl_end_undo_group ();
-}
-
-/* Vi Mode. */
-#ifdef VI_MODE
-#include "vi_mode.c"
-#endif /* VI_MODE */
-
-/* How to toggle back and forth between editing modes. */
-rl_vi_editing_mode ()
-{
-#ifdef VI_MODE
- rl_editing_mode = vi_mode;
- rl_vi_insertion_mode ();
-#endif /* VI_MODE */
-}
-
-rl_emacs_editing_mode ()
-{
- rl_editing_mode = emacs_mode;
- keymap = emacs_standard_keymap;
-}
-
-
-/* **************************************************************** */
-/* */
-/* Completion */
-/* */
-/* **************************************************************** */
-
-/* Non-zero means that case is not significant in completion. */
-int completion_case_fold = 0;
-
-/* Return an array of (char *) which is a list of completions for TEXT.
- If there are no completions, return a NULL pointer.
- The first entry in the returned array is the substitution for TEXT.
- The remaining entries are the possible completions.
- The array is terminated with a NULL pointer.
-
- ENTRY_FUNCTION is a function of two args, and returns a (char *).
- The first argument is TEXT.
- The second is a state argument; it should be zero on the first call, and
- non-zero on subsequent calls. It returns a NULL pointer to the caller
- when there are no more matches.
- */
-char **
-completion_matches (text, entry_function)
- char *text;
- char *(*entry_function) ();
-{
- /* Number of slots in match_list. */
- int match_list_size;
-
- /* The list of matches. */
- char **match_list =
- (char **)xmalloc (((match_list_size = 10) + 1) * sizeof (char *));
-
- /* Number of matches actually found. */
- int matches = 0;
-
- /* Temporary string binder. */
- char *string;
-
- match_list[1] = (char *)NULL;
-
- while (string = (*entry_function) (text, matches))
- {
- if (matches + 1 == match_list_size)
- match_list =
- (char **)xrealloc (match_list,
- ((match_list_size += 10) + 1) * sizeof (char *));
-
- match_list[++matches] = string;
- match_list[matches + 1] = (char *)NULL;
- }
-
- /* If there were any matches, then look through them finding out the
- lowest common denominator. That then becomes match_list[0]. */
- if (matches)
- {
- register int i = 1;
- int low = 100000; /* Count of max-matched characters. */
-
- /* If only one match, just use that. */
- if (matches == 1)
- {
- match_list[0] = match_list[1];
- match_list[1] = (char *)NULL;
- }
- else
- {
- /* Otherwise, compare each member of the list with
- the next, finding out where they stop matching. */
-
- while (i < matches)
- {
- register int c1, c2, si;
-
- if (completion_case_fold)
- {
- for (si = 0;
- (c1 = to_lower(match_list[i][si])) &&
- (c2 = to_lower(match_list[i + 1][si]));
- si++)
- if (c1 != c2) break;
- }
- else
- {
- for (si = 0;
- (c1 = match_list[i][si]) &&
- (c2 = match_list[i + 1][si]);
- si++)
- if (c1 != c2) break;
- }
-
- if (low > si) low = si;
- i++;
- }
- match_list[0] = (char *)xmalloc (low + 1);
- strncpy (match_list[0], match_list[1], low);
- match_list[0][low] = '\0';
- }
- }
- else /* There were no matches. */
- {
- free (match_list);
- match_list = (char **)NULL;
- }
- return (match_list);
-}
-
-/* Okay, now we write the entry_function for filename completion. In the
- general case. Note that completion in the shell is a little different
- because of all the pathnames that must be followed when looking up the
- completion for a command. */
-char *
-filename_completion_function (text, state)
- int state;
- char *text;
-{
- static DIR *directory;
- static char *filename = (char *)NULL;
- static char *dirname = (char *)NULL;
- static char *users_dirname = (char *)NULL;
- static int filename_len;
-
- struct direct *entry = (struct direct *)NULL;
-
- /* If we don't have any state, then do some initialization. */
- if (!state)
- {
- char *temp;
-
- if (dirname) free (dirname);
- if (filename) free (filename);
- if (users_dirname) free (users_dirname);
-
- filename = savestring (text);
- if (!*text) text = ".";
- dirname = savestring (text);
-
- temp = rindex (dirname, '/');
-
- if (temp)
- {
- strcpy (filename, ++temp);
- *temp = '\0';
- }
- else
- strcpy (dirname, ".");
-
- /* We aren't done yet. We also support the "~user" syntax. */
-
- /* Save the version of the directory that the user typed. */
- users_dirname = savestring (dirname);
- {
- char *tilde_expand (), *temp_dirname = tilde_expand (dirname);
- free (dirname);
- dirname = temp_dirname;
-#ifdef SHELL
- {
- extern int follow_symbolic_links;
- char *make_absolute ();
-
- if (follow_symbolic_links && (strcmp (dirname, ".") != 0))
- {
- temp_dirname = make_absolute (dirname, get_working_directory (""));
-
- if (temp_dirname)
- {
- free (dirname);
- dirname = temp_dirname;
- }
- }
- }
-#endif /* SHELL */
- }
- directory = opendir (dirname);
- filename_len = strlen (filename);
-
- rl_filename_completion_desired = 1;
- }
-
- /* At this point we should entertain the possibility of hacking wildcarded
- filenames, like /usr/man*\/te<TAB>. If the directory name contains
- globbing characters, then build an array of directories to glob on, and
- glob on the first one. */
-
- /* Now that we have some state, we can read the directory. */
-
- while (directory && (entry = readdir (directory)))
- {
- /* Special case for no filename.
- All entries except "." and ".." match. */
- if (!filename_len)
- {
- if ((strcmp (entry->d_name, ".") != 0) &&
- (strcmp (entry->d_name, "..") != 0))
- break;
- }
- else
- {
- /* Otherwise, if these match upto the length of filename, then
- it is a match. */
-#ifdef TMB_SYSV
- if ((strlen (entry->d_name) >= filename_len) &&
- (strncmp (filename, entry->d_name, filename_len) == 0))
-#else
- if ((entry->d_namlen >= filename_len) &&
- (strncmp (filename, entry->d_name, filename_len) == 0))
-#endif /* TMB_SYSV */
- {
- break;
- }
- }
- }
-
- if (!entry)
- {
- if (directory)
- {
- closedir (directory);
- directory = (DIR *)NULL;
- }
- return (char *)NULL;
- }
- else
- {
- char *temp;
-
- if (dirname && (strcmp (dirname, ".") != 0))
- {
-#ifdef TMB_SYSV
- temp = (char *)xmalloc (1 + strlen (users_dirname)
- + strlen (entry->d_name));
-#else
- temp = (char *)xmalloc (1 + strlen (users_dirname)
- + entry->d_namlen);
-#endif /* TMB_SYSV */
- strcpy (temp, users_dirname);
- strcat (temp, entry->d_name);
- }
- else
- {
- temp = (savestring (entry->d_name));
- }
- return (temp);
- }
-}
-
-
-/* **************************************************************** */
-/* */
-/* Binding keys */
-/* */
-/* **************************************************************** */
-
-/* rl_add_defun (char *name, Function *function, int key)
- Add NAME to the list of named functions. Make FUNCTION
- be the function that gets called.
- If KEY is not -1, then bind it. */
-rl_add_defun (name, function, key)
- char *name;
- Function *function;
- int key;
-{
- if (key != -1)
- rl_bind_key (key, function);
- rl_add_funmap_entry (name, function);
-}
-
-/* Bind KEY to FUNCTION. Returns non-zero if KEY is out of range. */
-int
-rl_bind_key (key, function)
- int key;
- Function *function;
-{
- if (key < 0)
- return (key);
-
- if (key > 127 && key < 256)
- {
- if (keymap[ESC].type == ISKMAP)
- {
- Keymap escmap = (Keymap)keymap[ESC].function;
-
- key -= 128;
- escmap[key].type = ISFUNC;
- escmap[key].function = function;
- return (0);
- }
- return (key);
- }
-
- keymap[key].type = ISFUNC;
- keymap[key].function = function;
- return (0);
-}
-
-/* Bind KEY to FUNCTION in MAP. Returns non-zero in case of invalid
- KEY. */
-int
-rl_bind_key_in_map (key, function, map)
- int key;
- Function *function;
- Keymap map;
-{
- int result;
- Keymap oldmap = keymap;
-
- keymap = map;
- result = rl_bind_key (key, function);
- keymap = oldmap;
- return (result);
-}
-
-/* Make KEY do nothing in the currently selected keymap.
- Returns non-zero in case of error. */
-int
-rl_unbind_key (key)
- int key;
-{
- return (rl_bind_key (key, (Function *)NULL));
-}
-
-/* Make KEY do nothing in MAP.
- Returns non-zero in case of error. */
-int
-rl_unbind_key_in_map (key, map)
- int key;
- Keymap map;
-{
- return (rl_bind_key_in_map (key, (Function *)NULL, map));
-}
-
-/* Bind the key sequence represented by the string KEYSEQ to
- FUNCTION. This makes new keymaps as necessary. The initial
- place to do bindings is in MAP. */
-rl_set_key (keyseq, function, map)
- char *keyseq;
- Function *function;
- Keymap map;
-{
- rl_generic_bind (ISFUNC, keyseq, function, map);
-}
-
-/* Bind the key sequence represented by the string KEYSEQ to
- the string of characters MACRO. This makes new keymaps as
- necessary. The initial place to do bindings is in MAP. */
-rl_macro_bind (keyseq, macro, map)
- char *keyseq, *macro;
- Keymap map;
-{
- char *macro_keys = (char *)xmalloc (2 * (strlen (macro)));
- int macro_keys_len;
-
- if (rl_translate_keyseq (macro, macro_keys, &macro_keys_len))
- {
- free (macro_keys);
- return;
- }
- rl_generic_bind (ISMACR, keyseq, macro_keys, map);
-}
-
-/* Bind the key sequence represented by the string KEYSEQ to
- the arbitrary pointer DATA. TYPE says what kind of data is
- pointed to by DATA, right now this can be a function (ISFUNC),
- a macro (ISMACR), or a keymap (ISKMAP). This makes new keymaps
- as necessary. The initial place to do bindings is in MAP. */
-rl_generic_bind (type, keyseq, data, map)
- int type;
- char *keyseq, *data;
- Keymap map;
-{
- char *keys;
- int keys_len;
- register int i;
- int start;
-
- /* If no keys to bind to, exit right away. */
- if (!keyseq || !*keyseq)
- {
- if (type == ISMACR)
- free (data);
- return;
- }
-
- keys = (char *)alloca (1 + (2 * strlen (keyseq)));
-
- /* Translate the ASCII representation of KEYSEQ into an array
- of characters. Stuff the characters into ARRAY, and the
- length of ARRAY into LENGTH. */
- if (rl_translate_keyseq (keyseq, keys, &keys_len))
- return;
-
- /* Handle mapping of the ESC Key in vi mode */
- start = 0;
-#ifdef VI_MODE
- if ((rl_editing_mode == vi_mode) && (keys[0] == ESC))
- {
- start++;
- map = vi_movement_keymap;
- if(keys[1] == ESC)
- {
- extern KEYMAP_ENTRY_ARRAY vi_escape_keymap;
-
- start++;
- map = vi_escape_keymap;
- }
- }
-#endif
-
- /* Bind keys, making new keymaps as necessary. */
- for (i = start; i < keys_len; i++)
- {
- if (i + 1 < keys_len)
- {
- if (map[keys[i]].type != ISKMAP)
- {
- if (map[i].type == ISMACR)
- free ((char *)map[i].function);
-
- map[keys[i]].type = ISKMAP;
- map[keys[i]].function = (Function *)rl_make_bare_keymap ();
- }
- map = (Keymap)map[keys[i]].function;
- }
- else
- {
- if (map[keys[i]].type == ISMACR)
- free ((char *)map[keys[i]].function);
-
- map[keys[i]].function = (Function *)data;
- map[keys[i]].type = type;
- }
- }
-}
-
-/* Translate the ASCII representation of SEQ, stuffing the
- values into ARRAY, an array of characters. LEN gets the
- final length of ARRAY. Return non-zero if there was an
- error parsing SEQ. */
-rl_translate_keyseq (seq, array, len)
- char *seq, *array;
- int *len;
-{
- register int i, c, l = 0;
-
- for (i = 0; c = seq[i]; i++)
- {
- if (c == '\\')
- {
- c = seq[++i];
-
- if (!c)
- break;
-
- if (((c == 'C' || c == 'M') && seq[i + 1] == '-') ||
- (c == 'e'))
- {
- /* Handle special case of backwards define. */
- if (strncmp (&seq[i], "C-\\M-", 5) == 0)
- {
- array[l++] = ESC;
- i += 5;
- array[l++] = CTRL (to_upper (seq[i]));
- if (!seq[i])
- i--;
- continue;
- }
-
- switch (c)
- {
- case 'M':
- i++;
- array[l++] = ESC;
- break;
-
- case 'C':
- i += 2;
- array[l++] = CTRL (to_upper (seq[i]));
- break;
-
- case 'e':
- array[l++] = ESC;
- }
-
- continue;
- }
- }
- array[l++] = c;
- }
-
- array[l] = '\0';
- *len = l;
- return (0);
-}
-
-/* Return a pointer to the function that STRING represents.
- If STRING doesn't have a matching function, then a NULL pointer
- is returned. */
-Function *
-rl_named_function (string)
- char *string;
-{
- register int i;
- static int stricmp ();
-
- for (i = 0; funmap[i]; i++)
- if (stricmp (funmap[i]->name, string) == 0)
- return (funmap[i]->function);
- return ((Function *)NULL);
-}
-
-/* The last key bindings file read. */
-static char *last_readline_init_file = "~/.inputrc";
-
-/* Re-read the current keybindings file. */
-rl_re_read_init_file (count, ignore)
- int count, ignore;
-{
- rl_read_init_file (last_readline_init_file);
-}
-
-/* Do key bindings from a file. If FILENAME is NULL it defaults
- to `~/.inputrc'. If the file existed and could be opened and
- read, 0 is returned, otherwise errno is returned. */
-int
-rl_read_init_file (filename)
- char *filename;
-{
- int line_size, line_index;
- char *line = (char *)xmalloc (line_size = 100);
- char *openname;
- FILE *file;
-
- int c;
-
- /* Default the filename. */
- if (!filename)
- filename = "~/.inputrc";
-
- openname = tilde_expand (filename);
-
- /* Open the file. */
- file = fopen (openname, "r");
- free (openname);
-
- if (!file)
- return (errno);
-
- last_readline_init_file = filename;
-
- /* Loop reading lines from the file. Lines that start with `#' are
- comments, all other lines are commands for readline initialization. */
- while ((c = getc(file)) != EOF)
- {
- /* If comment, flush to EOL. */
- if (c == '#')
- {
- while ((c = getc(file)) != EOF && c != '\n');
- if (c == EOF)
- goto function_exit;
- continue;
- }
-
- /* Otherwise, this is the start of a line. Read the
- line from the file. */
- line_index = 0;
- while (c != EOF && c != '\n')
- {
- line[line_index++] = c;
- if (line_index == line_size)
- line = (char *)xrealloc (line, line_size += 100);
- c = getc (file);
- }
- line[line_index] = '\0';
-
- /* Parse the line. */
- rl_parse_and_bind (line);
- }
-
-function_exit:
-
- free (line);
- /* Close up the file and exit. */
- fclose (file);
- return (0);
-}
-
-
-/* **************************************************************** */
-/* */
-/* Parser Directives */
-/* */
-/* **************************************************************** */
-
-/* Conditionals. */
-
-/* Calling programs set this to have their argv[0]. */
-char *rl_readline_name = "other";
-
-/* Stack of previous values of parsing_conditionalized_out. */
-static unsigned char *if_stack = (unsigned char *)NULL;
-static int if_stack_depth = 0;
-static int if_stack_size = 0;
-
-/* Push parsing_conditionalized_out, and set parser state based on ARGS. */
-parser_if (args)
- char *args;
-{
- register int i;
- static int stricmp ();
-
- /* Push parser state. */
- if (if_stack_depth + 1 >= if_stack_size)
- {
- if (!if_stack)
- if_stack = (unsigned char *)xmalloc (if_stack_size = 20);
- else
- if_stack = (unsigned char *)xrealloc (if_stack, if_stack_size += 20);
- }
- if_stack[if_stack_depth++] = parsing_conditionalized_out;
-
- /* We only check to see if the first word in ARGS is the same as the
- value stored in rl_readline_name. */
-
- /* Isolate first argument. */
- for (i = 0; args[i] && !whitespace (args[i]); i++);
-
- if (args[i])
- args[i++] = '\0';
-
- if (stricmp (args, rl_readline_name) == 0)
- parsing_conditionalized_out = 0;
- else
- parsing_conditionalized_out = 1;
-}
-
-/* Invert the current parser state if there is anything on the stack. */
-parser_else (args)
- char *args;
-{
- if (if_stack_depth)
- parsing_conditionalized_out = !parsing_conditionalized_out;
- else
- {
- /* *** What, no error message? *** */
- }
-}
-
-/* Terminate a conditional, popping the value of
- parsing_conditionalized_out from the stack. */
-parser_endif (args)
- char *args;
-{
- if (if_stack_depth)
- parsing_conditionalized_out = if_stack[--if_stack_depth];
- else
- {
- /* *** What, no error message? *** */
- }
-}
-
-/* Associate textual names with actual functions. */
-static struct {
- char *name;
- Function *function;
-} parser_directives [] = {
- { "if", parser_if },
- { "endif", parser_endif },
- { "else", parser_else },
- { (char *)0x0, (Function *)0x0 }
-};
-
-/* Handle a parser directive. STATEMENT is the line of the directive
- without any leading `$'. */
-static int
-handle_parser_directive (statement)
- char *statement;
-{
- register int i;
- char *directive, *args;
- static int stricmp ();
-
- /* Isolate the actual directive. */
-
- /* Skip whitespace. */
- for (i = 0; whitespace (statement[i]); i++);
-
- directive = &statement[i];
-
- for (; statement[i] && !whitespace (statement[i]); i++);
-
- if (statement[i])
- statement[i++] = '\0';
-
- for (; statement[i] && whitespace (statement[i]); i++);
-
- args = &statement[i];
-
- /* Lookup the command, and act on it. */
- for (i = 0; parser_directives[i].name; i++)
- if (stricmp (directive, parser_directives[i].name) == 0)
- {
- (*parser_directives[i].function) (args);
- return (0);
- }
-
- /* *** Should an error message be output? */
- return (1);
-}
-
-/* Read the binding command from STRING and perform it.
- A key binding command looks like: Keyname: function-name\0,
- a variable binding command looks like: set variable value.
- A new-style keybinding looks like "\C-x\C-x": exchange-point-and-mark. */
-rl_parse_and_bind (string)
- char *string;
-{
- extern char *possible_control_prefixes[], *possible_meta_prefixes[];
- char *funname, *kname;
- static int substring_member_of_array (), stricmp ();
- register int c;
- int key, i;
-
- if (!string || !*string || *string == '#')
- return;
-
- /* If this is a parser directive, act on it. */
- if (*string == '$')
- {
- handle_parser_directive (&string[1]);
- return;
- }
-
- /* If we are supposed to be skipping parsing right now, then do it. */
- if (parsing_conditionalized_out)
- return;
-
- i = 0;
- /* If this keyname is a complex key expression surrounded by quotes,
- advance to after the matching close quote. */
- if (*string == '"')
- {
- for (i = 1; c = string[i]; i++)
- {
- if (c == '"' && string[i - 1] != '\\')
- break;
- }
- }
-
- /* Advance to the colon (:) or whitespace which separates the two objects. */
- for (; (c = string[i]) && c != ':' && c != ' ' && c != '\t'; i++ );
-
- /* Mark the end of the command (or keyname). */
- if (string[i])
- string[i++] = '\0';
-
- /* If this is a command to set a variable, then do that. */
- if (stricmp (string, "set") == 0)
- {
- char *var = string + i;
- char *value;
-
- /* Make VAR point to start of variable name. */
- while (*var && whitespace (*var)) var++;
-
- /* Make value point to start of value string. */
- value = var;
- while (*value && !whitespace (*value)) value++;
- if (*value)
- *value++ = '\0';
- while (*value && whitespace (*value)) value++;
-
- rl_variable_bind (var, value);
- return;
- }
-
- /* Skip any whitespace between keyname and funname. */
- for (; string[i] && whitespace (string[i]); i++);
- funname = &string[i];
-
- /* Now isolate funname.
- For straight function names just look for whitespace, since
- that will signify the end of the string. But this could be a
- macro definition. In that case, the string is quoted, so skip
- to the matching delimiter. */
- if (*funname == '\'' || *funname == '"')
- {
- int delimiter = string[i++];
-
- for (; c = string[i]; i++)
- {
- if (c == delimiter && string[i - 1] != '\\')
- break;
- }
- if (c)
- i++;
- }
-
- /* Advance to the end of the string. */
- for (; string[i] && !whitespace (string[i]); i++);
-
- /* No extra whitespace at the end of the string. */
- string[i] = '\0';
-
- /* If this is a new-style key-binding, then do the binding with
- rl_set_key (). Otherwise, let the older code deal with it. */
- if (*string == '"')
- {
- char *seq = (char *)alloca (1 + strlen (string));
- register int j, k = 0;
-
- for (j = 1; string[j]; j++)
- {
- if (string[j] == '"' && string[j - 1] != '\\')
- break;
-
- seq[k++] = string[j];
- }
- seq[k] = '\0';
-
- /* Binding macro? */
- if (*funname == '\'' || *funname == '"')
- {
- j = strlen (funname);
-
- if (j && funname[j - 1] == *funname)
- funname[j - 1] = '\0';
-
- rl_macro_bind (seq, &funname[1], keymap);
- }
- else
- rl_set_key (seq, rl_named_function (funname), keymap);
-
- return;
- }
-
- /* Get the actual character we want to deal with. */
- kname = rindex (string, '-');
- if (!kname)
- kname = string;
- else
- kname++;
-
- key = glean_key_from_name (kname);
-
- /* Add in control and meta bits. */
- if (substring_member_of_array (string, possible_control_prefixes))
- key = CTRL (to_upper (key));
-
- if (substring_member_of_array (string, possible_meta_prefixes))
- key = META (key);
-
- /* Temporary. Handle old-style keyname with macro-binding. */
- if (*funname == '\'' || *funname == '"')
- {
- char seq[2];
- int fl = strlen (funname);
-
- seq[0] = key; seq[1] = '\0';
- if (fl && funname[fl - 1] == *funname)
- funname[fl - 1] = '\0';
-
- rl_macro_bind (seq, &funname[1], keymap);
- }
- else
- rl_bind_key (key, rl_named_function (funname));
-}
-
-rl_variable_bind (name, value)
- char *name, *value;
-{
- static int strnicmp (), stricmp ();
-
- if (stricmp (name, "editing-mode") == 0)
- {
- if (strnicmp (value, "vi", 2) == 0)
- {
-#ifdef VI_MODE
- keymap = vi_insertion_keymap;
- rl_editing_mode = vi_mode;
-#endif /* VI_MODE */
- }
- else if (strnicmp (value, "emacs", 5) == 0)
- {
- keymap = emacs_standard_keymap;
- rl_editing_mode = emacs_mode;
- }
- }
- else if (stricmp (name, "horizontal-scroll-mode") == 0)
- {
- if (!*value || stricmp (value, "On") == 0)
- horizontal_scroll_mode = 1;
- else
- horizontal_scroll_mode = 0;
- }
-}
-
-/* Return the character which matches NAME.
- For example, `Space' returns ' '. */
-
-typedef struct {
- char *name;
- int value;
-} assoc_list;
-
-assoc_list name_key_alist[] = {
- { "Space", ' ' },
- { "SPC", ' ' },
- { "Rubout", 0x7f },
- { "DEL", 0x7f },
- { "Tab", 0x09 },
- { "Newline", '\n' },
- { "Return", '\r' },
- { "RET", '\r' },
- { "LFD", '\n' },
- { "Escape", '\033' },
- { "ESC", '\033' },
-
- { (char *)0x0, 0 }
-};
-
-int
-glean_key_from_name (name)
- char *name;
-{
- register int i;
- static int stricmp ();
-
- for (i = 0; name_key_alist[i].name; i++)
- if (stricmp (name, name_key_alist[i].name) == 0)
- return (name_key_alist[i].value);
-
- return (*name);
-}
-
-
-/* **************************************************************** */
-/* */
-/* String Utility Functions */
-/* */
-/* **************************************************************** */
-
-/* Return non-zero if any members of ARRAY are a substring in STRING. */
-static int
-substring_member_of_array (string, array)
- char *string, **array;
-{
- static char *strindex ();
-
- while (*array)
- {
- if (strindex (string, *array))
- return (1);
- array++;
- }
- return (0);
-}
-
-/* Whoops, Unix doesn't have strnicmp. */
-
-/* Compare at most COUNT characters from string1 to string2. Case
- doesn't matter. */
-static int
-strnicmp (string1, string2, count)
- char *string1, *string2;
-{
- register char ch1, ch2;
-
- while (count) {
- ch1 = *string1++;
- ch2 = *string2++;
- if (to_upper(ch1) == to_upper(ch2))
- count--;
- else break;
- }
- return (count);
-}
-
-/* strcmp (), but caseless. */
-static int
-stricmp (string1, string2)
- char *string1, *string2;
-{
- register char ch1, ch2;
-
- while (*string1 && *string2) {
- ch1 = *string1++;
- ch2 = *string2++;
- if (to_upper(ch1) != to_upper(ch2))
- return (1);
- }
- return (*string1 | *string2);
-}
-
-/* Determine if s2 occurs in s1. If so, return a pointer to the
- match in s1. The compare is case insensitive. */
-static char *
-strindex (s1, s2)
- register char *s1, *s2;
-{
- register int i, l = strlen (s2);
- register int len = strlen (s1);
-
- for (i = 0; (len - i) >= l; i++)
- if (strnicmp (&s1[i], s2, l) == 0)
- return (s1 + i);
- return ((char *)NULL);
-}
-
-
-#ifdef STATIC_MALLOC
-
-/* **************************************************************** */
-/* */
-/* xmalloc and xrealloc () */
-/* */
-/* **************************************************************** */
-
-static char *
-xmalloc (bytes)
- int bytes;
-{
- static memory_error_and_abort ();
- char *temp = (char *)malloc (bytes);
-
- if (!temp)
- memory_error_and_abort ();
- return (temp);
-}
-
-static char *
-xrealloc (pointer, bytes)
- char *pointer;
- int bytes;
-{
- static memory_error_and_abort ();
- char *temp = (char *)realloc (pointer, bytes);
-
- if (!temp)
- memory_error_and_abort ();
- return (temp);
-}
-
-static
-memory_error_and_abort ()
-{
- fprintf (stderr, "readline: Out of virtual memory!\n");
- abort ();
-}
-#endif /* STATIC_MALLOC */
-
-
-/* **************************************************************** */
-/* */
-/* Testing Readline */
-/* */
-/* **************************************************************** */
-
-#ifdef TEST
-
-main ()
-{
- HIST_ENTRY **history_list ();
- char *temp = (char *)NULL;
- char *prompt = "readline% ";
- int done = 0;
-
- while (!done)
- {
- temp = readline (prompt);
-
- /* Test for EOF. */
- if (!temp)
- exit (1);
-
- /* If there is anything on the line, print it and remember it. */
- if (*temp)
- {
- fprintf (stderr, "%s\r\n", temp);
- add_history (temp);
- }
-
- /* Check for `command' that we handle. */
- if (strcmp (temp, "quit") == 0)
- done = 1;
-
- if (strcmp (temp, "list") == 0) {
- HIST_ENTRY **list = history_list ();
- register int i;
- if (list) {
- for (i = 0; list[i]; i++) {
- fprintf (stderr, "%d: %s\r\n", i, list[i]->line);
- free (list[i]->line);
- }
- free (list);
- }
- }
- free (temp);
- }
-}
-
-#endif /* TEST */
-
-
-/*
- * Local variables:
- * compile-command: "gcc -g -traditional -I. -I.. -DTEST -o readline readline.c keymaps.o funmap.o history.o -ltermcap"
- * end:
- */
diff --git a/gnu/usr.bin/gdb/readline/readline.h b/gnu/usr.bin/gdb/readline/readline.h
deleted file mode 100644
index 7d7fbe7..0000000
--- a/gnu/usr.bin/gdb/readline/readline.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/* Readline.h -- the names of functions callable from within readline. */
-
-#ifndef _READLINE_H_
-#define _READLINE_H_
-
-#include <readline/keymaps.h>
-
-#ifndef __FUNCTION_DEF
-typedef int Function ();
-#define __FUNCTION_DEF
-#endif
-
-/* The functions for manipulating the text of the line within readline.
-Most of these functions are bound to keys by default. */
-extern int
-rl_beg_of_line (), rl_backward (), rl_delete (), rl_end_of_line (),
-rl_forward (), ding (), rl_backward (), rl_newline (), rl_kill_line (),
-rl_clear_screen (), rl_get_next_history (), rl_get_previous_history (),
-rl_quoted_insert (), rl_reverse_search_history (), rl_transpose_chars
-(), rl_unix_line_discard (), rl_quoted_insert (), rl_unix_word_rubout
-(), rl_yank (), rl_rubout (), rl_backward_word (), rl_kill_word (),
-rl_forward_word (), rl_tab_insert (), rl_yank_pop (), rl_yank_nth_arg (),
-rl_backward_kill_word (), rl_backward_kill_line (), rl_transpose_words
-(), rl_complete (), rl_possible_completions (), rl_do_lowercase_version
-(), rl_digit_argument (), rl_universal_argument (), rl_abort (),
-rl_undo_command (), rl_revert_line (), rl_beginning_of_history (),
-rl_end_of_history (), rl_forward_search_history (), rl_insert (),
-rl_upcase_word (), rl_downcase_word (), rl_capitalize_word (),
-rl_restart_output (), rl_re_read_init_file ();
-
-/* These are *both* defined even when VI_MODE is not. */
-extern int rl_vi_editing_mode (), rl_emacs_editing_mode ();
-
-#ifdef VI_MODE
-/* Things for vi mode. */
-extern int rl_vi_movement_mode (), rl_vi_insertion_mode (), rl_vi_arg_digit (),
-rl_vi_prev_word (), rl_vi_next_word (), rl_vi_char_search (),
-rl_vi_eof_maybe (), rl_vi_append_mode (), rl_vi_put (),
-rl_vi_append_eol (), rl_vi_insert_beg (), rl_vi_delete (), rl_vi_comment (),
-rl_vi_first_print (), rl_vi_fword (), rl_vi_fWord (), rl_vi_bword (),
-rl_vi_bWord (), rl_vi_eword (), rl_vi_eWord (), rl_vi_end_word (),
-rl_vi_change_case (), rl_vi_match (), rl_vi_bracktype (), rl_vi_change_char (),
-rl_vi_yank_arg (), rl_vi_search (), rl_vi_search_again (),
-rl_vi_dosearch (), rl_vi_subst (), rl_vi_overstrike (),
-rl_vi_overstrike_delete (), rl_vi_replace(), rl_vi_column (),
-rl_vi_delete_to (), rl_vi_change_to (), rl_vi_yank_to (), rl_vi_complete ();
-#endif /* VI_MODE */
-
-/* Keyboard macro commands. */
-extern int
-rl_start_kbd_macro (), rl_end_kbd_macro (), rl_call_last_kbd_macro ();
-
-/* Maintaining the state of undo. We remember individual deletes and inserts
- on a chain of things to do. */
-
-/* The actions that undo knows how to undo. Notice that UNDO_DELETE means
- to insert some text, and UNDO_INSERT means to delete some text. I.e.,
- the code tells undo what to undo, not how to undo it. */
-enum undo_code { UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END };
-
-/* What an element of THE_UNDO_LIST looks like. */
-typedef struct undo_list {
- struct undo_list *next;
- int start, end; /* Where the change took place. */
- char *text; /* The text to insert, if undoing a delete. */
- enum undo_code what; /* Delete, Insert, Begin, End. */
-} UNDO_LIST;
-
-/* The current undo list for RL_LINE_BUFFER. */
-extern UNDO_LIST *rl_undo_list;
-
-/* The data structure for mapping textual names to code addresses. */
-typedef struct {
- char *name;
- Function *function;
-} FUNMAP;
-
-extern FUNMAP **funmap;
-
-/* **************************************************************** */
-/* */
-/* Well Published Variables */
-/* */
-/* **************************************************************** */
-
-/* The name of the calling program. You should initialize this to
- whatever was in argv[0]. It is used when parsing conditionals. */
-extern char *rl_readline_name;
-
-/* The line buffer that is in use. */
-extern char *rl_line_buffer;
-
-/* The location of point, and end. */
-extern int rl_point, rl_end;
-
-/* The name of the terminal to use. */
-extern char *rl_terminal_name;
-
-/* The input and output streams. */
-extern FILE *rl_instream, *rl_outstream;
-
-/* The basic list of characters that signal a break between words for the
- completer routine. The contents of this variable is what breaks words
- in the shell, i.e. "n\"\\'`@$>". */
-extern char *rl_basic_word_break_characters;
-
-/* The list of characters that signal a break between words for
- rl_complete_internal. The default list is the contents of
- rl_basic_word_break_characters. */
-extern char *rl_completer_word_break_characters;
-
-/* List of characters that are word break characters, but should be left
- in TEXT when it is passed to the completion function. The shell uses
- this to help determine what kind of completing to do. */
-extern char *rl_special_prefixes;
-
-/* Pointer to the generator function for completion_matches ().
- NULL means to use filename_entry_function (), the default filename
- completer. */
-extern Function *rl_completion_entry_function;
-
-/* Pointer to alternative function to create matches.
- Function is called with TEXT, START, and END.
- START and END are indices in RL_LINE_BUFFER saying what the boundaries
- of TEXT are.
- If this function exists and returns NULL then call the value of
- rl_completion_entry_function to try to match, otherwise use the
- array of strings returned. */
-extern Function *rl_attempted_completion_function;
-
-/* If non-null, this contains the address of a function to call if the
- standard meaning for expanding a tilde fails. The function is called
- with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
- which is the expansion, or a NULL pointer if there is no expansion. */
-extern Function *rl_tilde_expander;
-
-/* If non-zero, then this is the address of a function to call just
- before readline_internal () prints the first prompt. */
-extern Function *rl_startup_hook;
-
-/* **************************************************************** */
-/* */
-/* Well Published Functions */
-/* */
-/* **************************************************************** */
-
-/* Read a line of input. Prompt with PROMPT. A NULL PROMPT means none. */
-extern char *readline ();
-
-/* Return an array of strings which are the result of repeatadly calling
- FUNC with TEXT. */
-extern char **completion_matches ();
-
-/* rl_add_defun (char *name, Function *function, int key)
- Add NAME to the list of named functions. Make FUNCTION
- be the function that gets called.
- If KEY is not -1, then bind it. */
-extern int rl_add_defun ();
-
-#endif /* _READLINE_H_ */
-
diff --git a/gnu/usr.bin/gdb/readline/vi_keymap.c b/gnu/usr.bin/gdb/readline/vi_keymap.c
deleted file mode 100644
index 71c7ec8..0000000
--- a/gnu/usr.bin/gdb/readline/vi_keymap.c
+++ /dev/null
@@ -1,484 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- *
- * @(#)vi_keymap.c 6.4 (Berkeley) 5/8/91
- */
-
-/* vi_keymap.c -- the keymap for vi_mode in readline (). */
-
-/* Copyright (C) 1988,1989 Free Software Foundation, Inc.
-
- This file is part of GNU Readline, a library for reading lines
- of text with interactive input and history editing.
-
- Readline 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.
-
- Readline 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 Readline; see the file COPYING. If not, write to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef FILE
-#include <stdio.h>
-#endif /* FILE */
-
-#include "readline.h"
-
-extern KEYMAP_ENTRY_ARRAY vi_escape_keymap;
-
-/* The keymap arrays for handling vi mode. */
-KEYMAP_ENTRY_ARRAY vi_movement_keymap = {
-
- /* The regular control keys come first. */
- { ISFUNC, (Function *)0x0 }, /* Control-@ */
- { ISFUNC, (Function *)0x0 }, /* Control-a */
- { ISFUNC, (Function *)0x0 }, /* Control-b */
- { ISFUNC, (Function *)0x0 }, /* Control-c */
- { ISFUNC, rl_vi_eof_maybe }, /* Control-d */
- { ISFUNC, rl_emacs_editing_mode }, /* Control-e */
- { ISFUNC, (Function *)0x0 }, /* Control-f */
- { ISFUNC, rl_abort }, /* Control-g */
- { ISFUNC, rl_backward }, /* Control-h */
- { ISFUNC, (Function *)0x0 }, /* Control-i */
- { ISFUNC, rl_newline }, /* Control-j */
- { ISFUNC, rl_kill_line }, /* Control-k */
- { ISFUNC, rl_clear_screen }, /* Control-l */
- { ISFUNC, rl_newline }, /* Control-m */
- { ISFUNC, rl_get_next_history }, /* Control-n */
- { ISFUNC, (Function *)0x0 }, /* Control-o */
- { ISFUNC, rl_get_previous_history }, /* Control-p */
- { ISFUNC, rl_quoted_insert }, /* Control-q */
- { ISFUNC, rl_reverse_search_history }, /* Control-r */
- { ISFUNC, rl_forward_search_history }, /* Control-s */
- { ISFUNC, rl_transpose_chars }, /* Control-t */
- { ISFUNC, rl_unix_line_discard }, /* Control-u */
- { ISFUNC, rl_quoted_insert }, /* Control-v */
- { ISFUNC, rl_unix_word_rubout }, /* Control-w */
- { ISFUNC, (Function *)0x0 }, /* Control-x */
- { ISFUNC, rl_yank }, /* Control-y */
- { ISFUNC, (Function *)0x0 }, /* Control-z */
-
- { ISKMAP, (Function *)vi_escape_keymap }, /* Control-[ */
- { ISFUNC, (Function *)0x0 }, /* Control-\ */
- { ISFUNC, (Function *)0x0 }, /* Control-] */
- { ISFUNC, (Function *)0x0 }, /* Control-^ */
- { ISFUNC, rl_undo_command }, /* Control-_ */
-
- /* The start of printing characters. */
- { ISFUNC, rl_forward }, /* SPACE */
- { ISFUNC, (Function *)0x0 }, /* ! */
- { ISFUNC, (Function *)0x0 }, /* " */
- { ISFUNC, rl_vi_comment }, /* # */
- { ISFUNC, rl_end_of_line }, /* $ */
- { ISFUNC, rl_vi_match }, /* % */
- { ISFUNC, (Function *)0x0 }, /* & */
- { ISFUNC, (Function *)0x0 }, /* ' */
- { ISFUNC, (Function *)0x0 }, /* ( */
- { ISFUNC, (Function *)0x0 }, /* ) */
- { ISFUNC, rl_vi_complete }, /* * */
- { ISFUNC, rl_get_previous_history}, /* + */
- { ISFUNC, rl_vi_char_search }, /* , */
- { ISFUNC, rl_get_next_history }, /* - */
- { ISFUNC, (Function *)0x0 }, /* . */
- { ISFUNC, rl_vi_search }, /* / */
-
- /* Regular digits. */
- { ISFUNC, rl_vi_arg_digit }, /* 0 */
- { ISFUNC, rl_vi_arg_digit }, /* 1 */
- { ISFUNC, rl_vi_arg_digit }, /* 2 */
- { ISFUNC, rl_vi_arg_digit }, /* 3 */
- { ISFUNC, rl_vi_arg_digit }, /* 4 */
- { ISFUNC, rl_vi_arg_digit }, /* 5 */
- { ISFUNC, rl_vi_arg_digit }, /* 6 */
- { ISFUNC, rl_vi_arg_digit }, /* 7 */
- { ISFUNC, rl_vi_arg_digit }, /* 8 */
- { ISFUNC, rl_vi_arg_digit }, /* 9 */
-
- /* A little more punctuation. */
- { ISFUNC, (Function *)0x0 }, /* : */
- { ISFUNC, rl_vi_char_search }, /* ; */
- { ISFUNC, (Function *)0x0 }, /* < */
- { ISFUNC, (Function *)0x0 }, /* = */
- { ISFUNC, (Function *)0x0 }, /* > */
- { ISFUNC, rl_vi_search }, /* ? */
- { ISFUNC, (Function *)0x0 }, /* @ */
-
- /* Uppercase alphabet. */
- { ISFUNC, rl_vi_append_eol }, /* A */
- { ISFUNC, rl_vi_prev_word}, /* B */
- { ISFUNC, rl_vi_change_to }, /* C */
- { ISFUNC, rl_vi_delete_to }, /* D */
- { ISFUNC, rl_vi_end_word }, /* E */
- { ISFUNC, rl_vi_char_search }, /* F */
- { ISFUNC, (Function *)0x0 }, /* G */
- { ISFUNC, (Function *)0x0 }, /* H */
- { ISFUNC, rl_vi_insert_beg }, /* I */
- { ISFUNC, (Function *)0x0 }, /* J */
- { ISFUNC, (Function *)0x0 }, /* K */
- { ISFUNC, (Function *)0x0 }, /* L */
- { ISFUNC, (Function *)0x0 }, /* M */
- { ISFUNC, rl_vi_search_again }, /* N */
- { ISFUNC, (Function *)0x0 }, /* O */
- { ISFUNC, rl_vi_put }, /* P */
- { ISFUNC, (Function *)0x0 }, /* Q */
- { ISFUNC, rl_vi_replace }, /* R */
- { ISFUNC, rl_vi_subst }, /* S */
- { ISFUNC, rl_vi_char_search }, /* T */
- { ISFUNC, rl_revert_line }, /* U */
- { ISFUNC, (Function *)0x0 }, /* V */
- { ISFUNC, rl_vi_next_word }, /* W */
- { ISFUNC, rl_rubout }, /* X */
- { ISFUNC, rl_vi_yank_to }, /* Y */
- { ISFUNC, (Function *)0x0 }, /* Z */
-
- /* Some more punctuation. */
- { ISFUNC, (Function *)0x0 }, /* [ */
- { ISFUNC, (Function *)0x0 }, /* \ */
- { ISFUNC, (Function *)0x0 }, /* ] */
- { ISFUNC, rl_vi_first_print }, /* ^ */
- { ISFUNC, rl_vi_yank_arg }, /* _ */
- { ISFUNC, (Function *)0x0 }, /* ` */
-
- /* Lowercase alphabet. */
- { ISFUNC, rl_vi_append_mode }, /* a */
- { ISFUNC, rl_vi_prev_word }, /* b */
- { ISFUNC, rl_vi_change_to }, /* c */
- { ISFUNC, rl_vi_delete_to }, /* d */
- { ISFUNC, rl_vi_end_word }, /* e */
- { ISFUNC, rl_vi_char_search }, /* f */
- { ISFUNC, (Function *)0x0 }, /* g */
- { ISFUNC, rl_backward }, /* h */
- { ISFUNC, rl_vi_insertion_mode }, /* i */
- { ISFUNC, rl_get_next_history }, /* j */
- { ISFUNC, rl_get_previous_history }, /* k */
- { ISFUNC, rl_forward }, /* l */
- { ISFUNC, (Function *)0x0 }, /* m */
- { ISFUNC, rl_vi_search_again }, /* n */
- { ISFUNC, (Function *)0x0 }, /* o */
- { ISFUNC, rl_vi_put }, /* p */
- { ISFUNC, (Function *)0x0 }, /* q */
- { ISFUNC, rl_vi_change_char }, /* r */
- { ISFUNC, rl_vi_subst }, /* s */
- { ISFUNC, rl_vi_char_search }, /* t */
- { ISFUNC, rl_undo_command }, /* u */
- { ISFUNC, (Function *)0x0 }, /* v */
- { ISFUNC, rl_vi_next_word }, /* w */
- { ISFUNC, rl_vi_delete }, /* x */
- { ISFUNC, rl_vi_yank_to }, /* y */
- { ISFUNC, (Function *)0x0 }, /* z */
-
- /* Final punctuation. */
- { ISFUNC, (Function *)0x0 }, /* { */
- { ISFUNC, rl_vi_column }, /* | */
- { ISFUNC, (Function *)0x0 }, /* } */
- { ISFUNC, rl_vi_change_case }, /* ~ */
- { ISFUNC, rl_backward } /* RUBOUT */
-};
-
-
-KEYMAP_ENTRY_ARRAY vi_insertion_keymap = {
-
- /* The regular control keys come first. */
- { ISFUNC, (Function *)0x0 }, /* Control-@ */
- { ISFUNC, rl_insert }, /* Control-a */
- { ISFUNC, rl_insert }, /* Control-b */
- { ISFUNC, rl_insert }, /* Control-c */
- { ISFUNC, rl_vi_eof_maybe }, /* Control-d */
- { ISFUNC, rl_insert }, /* Control-e */
- { ISFUNC, rl_insert }, /* Control-f */
- { ISFUNC, rl_insert }, /* Control-g */
- { ISFUNC, rl_rubout }, /* Control-h */
- { ISFUNC, rl_complete }, /* Control-i */
- { ISFUNC, rl_newline }, /* Control-j */
- { ISFUNC, rl_insert }, /* Control-k */
- { ISFUNC, rl_insert }, /* Control-l */
- { ISFUNC, rl_newline }, /* Control-m */
- { ISFUNC, rl_insert }, /* Control-n */
- { ISFUNC, rl_insert }, /* Control-o */
- { ISFUNC, rl_insert }, /* Control-p */
- { ISFUNC, rl_insert }, /* Control-q */
- { ISFUNC, rl_reverse_search_history }, /* Control-r */
- { ISFUNC, rl_forward_search_history }, /* Control-s */
- { ISFUNC, rl_transpose_chars }, /* Control-t */
- { ISFUNC, rl_unix_line_discard }, /* Control-u */
- { ISFUNC, rl_quoted_insert }, /* Control-v */
- { ISFUNC, rl_unix_word_rubout }, /* Control-w */
- { ISFUNC, rl_insert }, /* Control-x */
- { ISFUNC, rl_yank }, /* Control-y */
- { ISFUNC, rl_insert }, /* Control-z */
-
- { ISFUNC, rl_vi_movement_mode }, /* Control-[ */
- { ISFUNC, rl_insert }, /* Control-\ */
- { ISFUNC, rl_insert }, /* Control-] */
- { ISFUNC, rl_insert }, /* Control-^ */
- { ISFUNC, rl_undo_command }, /* Control-_ */
-
- /* The start of printing characters. */
- { ISFUNC, rl_insert }, /* SPACE */
- { ISFUNC, rl_insert }, /* ! */
- { ISFUNC, rl_insert }, /* " */
- { ISFUNC, rl_insert }, /* # */
- { ISFUNC, rl_insert }, /* $ */
- { ISFUNC, rl_insert }, /* % */
- { ISFUNC, rl_insert }, /* & */
- { ISFUNC, rl_insert }, /* ' */
- { ISFUNC, rl_insert }, /* ( */
- { ISFUNC, rl_insert }, /* ) */
- { ISFUNC, rl_insert }, /* * */
- { ISFUNC, rl_insert }, /* + */
- { ISFUNC, rl_insert }, /* , */
- { ISFUNC, rl_insert }, /* - */
- { ISFUNC, rl_insert }, /* . */
- { ISFUNC, rl_insert }, /* / */
-
- /* Regular digits. */
- { ISFUNC, rl_insert }, /* 0 */
- { ISFUNC, rl_insert }, /* 1 */
- { ISFUNC, rl_insert }, /* 2 */
- { ISFUNC, rl_insert }, /* 3 */
- { ISFUNC, rl_insert }, /* 4 */
- { ISFUNC, rl_insert }, /* 5 */
- { ISFUNC, rl_insert }, /* 6 */
- { ISFUNC, rl_insert }, /* 7 */
- { ISFUNC, rl_insert }, /* 8 */
- { ISFUNC, rl_insert }, /* 9 */
-
- /* A little more punctuation. */
- { ISFUNC, rl_insert }, /* : */
- { ISFUNC, rl_insert }, /* ; */
- { ISFUNC, rl_insert }, /* < */
- { ISFUNC, rl_insert }, /* = */
- { ISFUNC, rl_insert }, /* > */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* @ */
-
- /* Uppercase alphabet. */
- { ISFUNC, rl_insert }, /* A */
- { ISFUNC, rl_insert }, /* B */
- { ISFUNC, rl_insert }, /* C */
- { ISFUNC, rl_insert }, /* D */
- { ISFUNC, rl_insert }, /* E */
- { ISFUNC, rl_insert }, /* F */
- { ISFUNC, rl_insert }, /* G */
- { ISFUNC, rl_insert }, /* H */
- { ISFUNC, rl_insert }, /* I */
- { ISFUNC, rl_insert }, /* J */
- { ISFUNC, rl_insert }, /* K */
- { ISFUNC, rl_insert }, /* L */
- { ISFUNC, rl_insert }, /* M */
- { ISFUNC, rl_insert }, /* N */
- { ISFUNC, rl_insert }, /* O */
- { ISFUNC, rl_insert }, /* P */
- { ISFUNC, rl_insert }, /* Q */
- { ISFUNC, rl_insert }, /* R */
- { ISFUNC, rl_insert }, /* S */
- { ISFUNC, rl_insert }, /* T */
- { ISFUNC, rl_insert }, /* U */
- { ISFUNC, rl_insert }, /* V */
- { ISFUNC, rl_insert }, /* W */
- { ISFUNC, rl_insert }, /* X */
- { ISFUNC, rl_insert }, /* Y */
- { ISFUNC, rl_insert }, /* Z */
-
- /* Some more punctuation. */
- { ISFUNC, rl_insert }, /* [ */
- { ISFUNC, rl_insert }, /* \ */
- { ISFUNC, rl_insert }, /* ] */
- { ISFUNC, rl_insert }, /* ^ */
- { ISFUNC, rl_insert }, /* _ */
- { ISFUNC, rl_insert }, /* ` */
-
- /* Lowercase alphabet. */
- { ISFUNC, rl_insert }, /* a */
- { ISFUNC, rl_insert }, /* b */
- { ISFUNC, rl_insert }, /* c */
- { ISFUNC, rl_insert }, /* d */
- { ISFUNC, rl_insert }, /* e */
- { ISFUNC, rl_insert }, /* f */
- { ISFUNC, rl_insert }, /* g */
- { ISFUNC, rl_insert }, /* h */
- { ISFUNC, rl_insert }, /* i */
- { ISFUNC, rl_insert }, /* j */
- { ISFUNC, rl_insert }, /* k */
- { ISFUNC, rl_insert }, /* l */
- { ISFUNC, rl_insert }, /* m */
- { ISFUNC, rl_insert }, /* n */
- { ISFUNC, rl_insert }, /* o */
- { ISFUNC, rl_insert }, /* p */
- { ISFUNC, rl_insert }, /* q */
- { ISFUNC, rl_insert }, /* r */
- { ISFUNC, rl_insert }, /* s */
- { ISFUNC, rl_insert }, /* t */
- { ISFUNC, rl_insert }, /* u */
- { ISFUNC, rl_insert }, /* v */
- { ISFUNC, rl_insert }, /* w */
- { ISFUNC, rl_insert }, /* x */
- { ISFUNC, rl_insert }, /* y */
- { ISFUNC, rl_insert }, /* z */
-
- /* Final punctuation. */
- { ISFUNC, rl_insert }, /* { */
- { ISFUNC, rl_insert }, /* | */
- { ISFUNC, rl_insert }, /* } */
- { ISFUNC, rl_insert }, /* ~ */
- { ISFUNC, rl_rubout } /* RUBOUT */
-};
-
-KEYMAP_ENTRY_ARRAY vi_escape_keymap = {
-
- /* The regular control keys come first. */
- { ISFUNC, (Function *)0x0 }, /* Control-@ */
- { ISFUNC, (Function *)0x0 }, /* Control-a */
- { ISFUNC, (Function *)0x0 }, /* Control-b */
- { ISFUNC, (Function *)0x0 }, /* Control-c */
- { ISFUNC, (Function *)0x0 }, /* Control-d */
- { ISFUNC, (Function *)0x0 }, /* Control-e */
- { ISFUNC, (Function *)0x0 }, /* Control-f */
- { ISFUNC, (Function *)0x0 }, /* Control-g */
- { ISFUNC, (Function *)0x0 }, /* Control-h */
- { ISFUNC, rl_tab_insert}, /* Control-i */
- { ISFUNC, rl_emacs_editing_mode}, /* Control-j */
- { ISFUNC, rl_kill_line }, /* Control-k */
- { ISFUNC, (Function *)0x0 }, /* Control-l */
- { ISFUNC, rl_emacs_editing_mode}, /* Control-m */
- { ISFUNC, (Function *)0x0 }, /* Control-n */
- { ISFUNC, (Function *)0x0 }, /* Control-o */
- { ISFUNC, (Function *)0x0 }, /* Control-p */
- { ISFUNC, (Function *)0x0 }, /* Control-q */
- { ISFUNC, (Function *)0x0 }, /* Control-r */
- { ISFUNC, (Function *)0x0 }, /* Control-s */
- { ISFUNC, (Function *)0x0 }, /* Control-t */
- { ISFUNC, (Function *)0x0 }, /* Control-u */
- { ISFUNC, (Function *)0x0 }, /* Control-v */
- { ISFUNC, (Function *)0x0 }, /* Control-w */
- { ISFUNC, (Function *)0x0 }, /* Control-x */
- { ISFUNC, (Function *)0x0 }, /* Control-y */
- { ISFUNC, (Function *)0x0 }, /* Control-z */
-
- { ISFUNC, rl_vi_movement_mode }, /* Control-[ */
- { ISFUNC, (Function *)0x0 }, /* Control-\ */
- { ISFUNC, (Function *)0x0 }, /* Control-] */
- { ISFUNC, (Function *)0x0 }, /* Control-^ */
- { ISFUNC, rl_undo_command }, /* Control-_ */
-
- /* The start of printing characters. */
- { ISFUNC, (Function *)0x0 }, /* SPACE */
- { ISFUNC, (Function *)0x0 }, /* ! */
- { ISFUNC, (Function *)0x0 }, /* " */
- { ISFUNC, (Function *)0x0 }, /* # */
- { ISFUNC, (Function *)0x0 }, /* $ */
- { ISFUNC, (Function *)0x0 }, /* % */
- { ISFUNC, (Function *)0x0 }, /* & */
- { ISFUNC, (Function *)0x0 }, /* ' */
- { ISFUNC, (Function *)0x0 }, /* ( */
- { ISFUNC, (Function *)0x0 }, /* ) */
- { ISFUNC, (Function *)0x0 }, /* * */
- { ISFUNC, (Function *)0x0 }, /* + */
- { ISFUNC, (Function *)0x0 }, /* , */
- { ISFUNC, (Function *)0x0 }, /* - */
- { ISFUNC, (Function *)0x0 }, /* . */
- { ISFUNC, (Function *)0x0 }, /* / */
-
- /* Regular digits. */
- { ISFUNC, rl_vi_arg_digit }, /* 0 */
- { ISFUNC, rl_vi_arg_digit }, /* 1 */
- { ISFUNC, rl_vi_arg_digit }, /* 2 */
- { ISFUNC, rl_vi_arg_digit }, /* 3 */
- { ISFUNC, rl_vi_arg_digit }, /* 4 */
- { ISFUNC, rl_vi_arg_digit }, /* 5 */
- { ISFUNC, rl_vi_arg_digit }, /* 6 */
- { ISFUNC, rl_vi_arg_digit }, /* 7 */
- { ISFUNC, rl_vi_arg_digit }, /* 8 */
- { ISFUNC, rl_vi_arg_digit }, /* 9 */
-
- /* A little more punctuation. */
- { ISFUNC, (Function *)0x0 }, /* : */
- { ISFUNC, (Function *)0x0 }, /* ; */
- { ISFUNC, (Function *)0x0 }, /* < */
- { ISFUNC, (Function *)0x0 }, /* = */
- { ISFUNC, (Function *)0x0 }, /* > */
- { ISFUNC, (Function *)0x0 }, /* ? */
- { ISFUNC, (Function *)0x0 }, /* @ */
-
- /* Uppercase alphabet. */
- { ISFUNC, rl_do_lowercase_version }, /* A */
- { ISFUNC, rl_do_lowercase_version }, /* B */
- { ISFUNC, rl_do_lowercase_version }, /* C */
- { ISFUNC, rl_do_lowercase_version }, /* D */
- { ISFUNC, rl_do_lowercase_version }, /* E */
- { ISFUNC, rl_do_lowercase_version }, /* F */
- { ISFUNC, rl_do_lowercase_version }, /* G */
- { ISFUNC, rl_do_lowercase_version }, /* H */
- { ISFUNC, rl_do_lowercase_version }, /* I */
- { ISFUNC, rl_do_lowercase_version }, /* J */
- { ISFUNC, rl_do_lowercase_version }, /* K */
- { ISFUNC, rl_do_lowercase_version }, /* L */
- { ISFUNC, rl_do_lowercase_version }, /* M */
- { ISFUNC, rl_do_lowercase_version }, /* N */
- { ISFUNC, rl_do_lowercase_version }, /* O */
- { ISFUNC, rl_do_lowercase_version }, /* P */
- { ISFUNC, rl_do_lowercase_version }, /* Q */
- { ISFUNC, rl_do_lowercase_version }, /* R */
- { ISFUNC, rl_do_lowercase_version }, /* S */
- { ISFUNC, rl_do_lowercase_version }, /* T */
- { ISFUNC, rl_do_lowercase_version }, /* U */
- { ISFUNC, rl_do_lowercase_version }, /* V */
- { ISFUNC, rl_do_lowercase_version }, /* W */
- { ISFUNC, rl_do_lowercase_version }, /* X */
- { ISFUNC, rl_do_lowercase_version }, /* Y */
- { ISFUNC, rl_do_lowercase_version }, /* Z */
-
- /* Some more punctuation. */
- { ISFUNC, (Function *)0x0 }, /* [ */
- { ISFUNC, (Function *)0x0 }, /* \ */
- { ISFUNC, (Function *)0x0 }, /* ] */
- { ISFUNC, (Function *)0x0 }, /* ^ */
- { ISFUNC, (Function *)0x0 }, /* _ */
- { ISFUNC, (Function *)0x0 }, /* ` */
-
- /* Lowercase alphabet. */
- { ISFUNC, (Function *)0x0 }, /* a */
- { ISFUNC, (Function *)0x0 }, /* b */
- { ISFUNC, (Function *)0x0 }, /* c */
- { ISFUNC, (Function *)0x0 }, /* d */
- { ISFUNC, (Function *)0x0 }, /* e */
- { ISFUNC, (Function *)0x0 }, /* f */
- { ISFUNC, (Function *)0x0 }, /* g */
- { ISFUNC, (Function *)0x0 }, /* h */
- { ISFUNC, (Function *)0x0 }, /* i */
- { ISFUNC, (Function *)0x0 }, /* j */
- { ISFUNC, (Function *)0x0 }, /* k */
- { ISFUNC, (Function *)0x0 }, /* l */
- { ISFUNC, (Function *)0x0 }, /* m */
- { ISFUNC, (Function *)0x0 }, /* n */
- { ISFUNC, (Function *)0x0 }, /* o */
- { ISFUNC, (Function *)0x0 }, /* p */
- { ISFUNC, (Function *)0x0 }, /* q */
- { ISFUNC, (Function *)0x0 }, /* r */
- { ISFUNC, (Function *)0x0 }, /* s */
- { ISFUNC, (Function *)0x0 }, /* t */
- { ISFUNC, (Function *)0x0 }, /* u */
- { ISFUNC, (Function *)0x0 }, /* v */
- { ISFUNC, (Function *)0x0 }, /* w */
- { ISFUNC, (Function *)0x0 }, /* x */
- { ISFUNC, (Function *)0x0 }, /* y */
- { ISFUNC, (Function *)0x0 }, /* z */
-
- /* Final punctuation. */
- { ISFUNC, (Function *)0x0 }, /* { */
- { ISFUNC, (Function *)0x0 }, /* | */
- { ISFUNC, (Function *)0x0 }, /* } */
- { ISFUNC, (Function *)0x0 }, /* ~ */
- { ISFUNC, rl_backward_kill_word } /* RUBOUT */
-};
diff --git a/gnu/usr.bin/gdb/readline/vi_mode.c b/gnu/usr.bin/gdb/readline/vi_mode.c
deleted file mode 100644
index 3a13cc6..0000000
--- a/gnu/usr.bin/gdb/readline/vi_mode.c
+++ /dev/null
@@ -1,875 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- *
- * @(#)vi_mode.c 6.4 (Berkeley) 5/8/91
- */
-
-/* vi_mode.c -- A vi emulation mode for Bash.
- Mostly written by Jeff Sparkes (jeff1@????).
- */
-
-
-/* **************************************************************** */
-/* */
-/* VI Emulation Mode */
-/* */
-/* **************************************************************** */
-
-/* Last string searched for from `/' or `?'. */
-static char *vi_last_search = (char *)NULL;
-static int vi_histpos;
-
-/* *** UNCLEAN *** */
-/* Command keys which do movement for xxx_to commands. */
-static char *vi_motion = " hl^$0ftFt;,%wbeWBE|";
-
-/* Keymap used for vi replace characters. Created dynamically since
- rarely used. */
-static Keymap vi_replace_map = (Keymap)NULL;
-
-/* The number of characters inserted in the last replace operation. */
-static vi_replace_count = 0;
-
-/* Yank the nth arg from the previous line into this line at point. */
-rl_vi_yank_arg (count)
- int count;
-{
- rl_yank_nth_arg (count);
-}
-
-/* Search again for the last thing searched for. */
-rl_vi_search_again (ignore, key)
- int ignore, key;
-{
- switch (key)
- {
- case 'n':
- rl_vi_dosearch (vi_last_search, -1);
- break;
-
- case 'N':
- rl_vi_dosearch (vi_last_search, 1);
- break;
- }
-}
-
-/* Do a vi style search. */
-rl_vi_search (count, key)
- int count, key;
-{
- int dir, c;
- char *p;
-
- switch (key)
- {
- case '?':
- dir = 1;
- break;
-
- case '/':
- dir = -1;
- break;
-
- default:
- ding ();
- return;
- }
-
- vi_histpos = where_history ();
- maybe_save_line ();
-
- /* Reuse the line input buffer to read the search string. */
- the_line[0] = 0;
- rl_end = rl_point = 0;
- p = (char *)alloca (2 + (rl_prompt ? strlen (rl_prompt) : 0));
-
- sprintf (p, "%s%c", rl_prompt ? rl_prompt : "", key);
-
- rl_message (p);
-
- while (c = rl_read_key (in_stream))
- {
- switch (c)
- {
- case CTRL('W'):
- case CTRL('U'):
- case CTRL('H'):
- case RUBOUT:
- rl_dispatch (c, keymap);
- break;
-
- case ESC:
- case RETURN:
- case NEWLINE:
- goto dosearch;
- break;
-
- case CTRL('C'):
- maybe_unsave_line ();
- rl_clear_message ();
- rl_point = 0;
- ding ();
- return;
-
- default:
- rl_insert (1, c);
- break;
- }
- rl_redisplay ();
- }
- dosearch:
- if (vi_last_search)
- free (vi_last_search);
-
- vi_last_search = savestring (the_line);
- rl_vi_dosearch (the_line, dir);
-}
-
-rl_vi_dosearch (string, dir)
- char *string;
- int dir;
-{
- int old, save = vi_histpos;
- HIST_ENTRY *h;
-
- if (string == 0 || *string == 0 || vi_histpos < 0)
- {
- ding ();
- return;
- }
-
- if ((save = history_search_pos (string, dir, vi_histpos + dir)) == -1)
- {
- maybe_unsave_line ();
- rl_clear_message ();
- rl_point = 0;
- ding ();
- return;
- }
-
- vi_histpos = save;
-
- old = where_history ();
- history_set_pos (vi_histpos);
- h = current_history ();
- history_set_pos (old);
-
- strcpy (the_line, h->line);
- rl_undo_list = (UNDO_LIST *)h->data;
- rl_end = strlen (the_line);
- rl_point = 0;
- rl_clear_message ();
-}
-
-/* Completion, from vi's point of view. */
-rl_vi_complete (ignore, key)
- int ignore, key;
-{
- if (!whitespace (the_line[rl_point]))
- {
- rl_vi_end_word (1, 'E');
- rl_point++;
- }
- rl_complete_internal ('*');
- rl_vi_insertion_mode ();
-}
-
-/* Previous word in vi mode. */
-rl_vi_prev_word (count, key)
- int count, key;
-{
- if (count < 0)
- {
- rl_vi_next_word (-count, key);
- return;
- }
-
- if (uppercase_p (key))
- rl_vi_bWord (count);
- else
- rl_vi_bword (count);
-}
-
-/* Next word in vi mode. */
-rl_vi_next_word (count, key)
- int count;
-{
- if (count < 0)
- {
- rl_vi_prev_word (-count, key);
- return;
- }
-
- if (uppercase_p (key))
- rl_vi_fWord (count);
- else
- rl_vi_fword (count);
-}
-
-/* Move to the end of the ?next? word. */
-rl_vi_end_word (count, key)
- int count, key;
-{
- if (count < 0)
- {
- ding ();
- return;
- }
-
- if (uppercase_p (key))
- rl_vi_eWord (count);
- else
- rl_vi_eword (count);
-}
-
-/* Move forward a word the way that 'W' does. */
-rl_vi_fWord (count)
- int count;
-{
- while (count-- && rl_point < (rl_end - 1))
- {
- /* Skip until whitespace. */
- while (!whitespace (the_line[rl_point]) && rl_point < rl_end)
- rl_point++;
-
- /* Now skip whitespace. */
- while (whitespace (the_line[rl_point]) && rl_point < rl_end)
- rl_point++;
- }
-}
-
-rl_vi_bWord (count)
- int count;
-{
- while (count-- && rl_point > 0)
- {
- while (rl_point-- >= 0 && whitespace (the_line[rl_point]));
- while (rl_point >= 0 && !whitespace (the_line[rl_point]))
- rl_point--;
- rl_point++;
- }
-}
-
-rl_vi_eWord (count)
- int count;
-{
- while (count -- && rl_point < (rl_end - 1))
- {
- while (rl_point++ < rl_end && whitespace (the_line[rl_point]));
- while (rl_point++ < rl_end && !whitespace (the_line[rl_point]));
- rl_point--;
- }
-}
-
-rl_vi_fword (count)
- int count;
-{
- while (count -- && rl_point < (rl_end - 1))
- {
- if (isident (the_line[rl_point]))
- {
- while (isident (the_line[rl_point]) && rl_point < rl_end)
- rl_point += 1;
- }
- else if (!whitespace (the_line[rl_point]))
- {
- while (!isident (the_line[rl_point]) &&
- !whitespace (the_line[rl_point]) && rl_point < rl_end)
- rl_point += 1;
- }
-
- while (whitespace (the_line[rl_point]) && rl_point < rl_end)
- rl_point++;
- }
-}
-
-rl_vi_bword (count)
- int count;
-{
- while (count -- && rl_point > 0)
- {
- while (--rl_point > 0 && whitespace (the_line[rl_point]));
- if (rl_point > 0)
- {
- if (isident (the_line[rl_point]))
- while (--rl_point >= 0 && isident (the_line[rl_point]));
- else
- while (--rl_point >= 0 && !isident (the_line[rl_point]) &&
- !whitespace (the_line[rl_point]));
- rl_point++;
- }
- }
-}
-
-rl_vi_eword (count)
- int count;
-{
- while (count -- && rl_point < rl_end - 1)
- {
- while (++rl_point < rl_end && whitespace (the_line[rl_point]));
-
- if (rl_point < rl_end)
- {
- if (isident (the_line[rl_point]))
- while (++rl_point < rl_end && isident (the_line[rl_point]));
- else
- while (++rl_point < rl_end && !isident (the_line[rl_point])
- && !whitespace (the_line[rl_point]));
- rl_point--;
- }
- }
-}
-
-rl_vi_insert_beg ()
-{
- rl_beg_of_line ();
- rl_vi_insertion_mode ();
- return 0;
-}
-
-rl_vi_append_mode ()
-{
- if (rl_point < rl_end)
- rl_point += 1;
- rl_vi_insertion_mode ();
- return 0;
-}
-
-rl_vi_append_eol ()
-{
- rl_end_of_line ();
- rl_vi_append_mode ();
- return 0;
-}
-
-/* What to do in the case of C-d. */
-rl_vi_eof_maybe (count, c)
- int count, c;
-{
- rl_newline (1, '\n');
-}
-
-/* Insertion mode stuff. */
-
-/* Switching from one mode to the other really just involves
- switching keymaps. */
-rl_vi_insertion_mode ()
-{
- keymap = vi_insertion_keymap;
-}
-
-rl_vi_movement_mode ()
-{
- if (rl_point > 0)
- rl_backward (1);
-
- keymap = vi_movement_keymap;
- if (vi_doing_insert)
- {
- rl_end_undo_group ();
- vi_doing_insert = 0;
- }
-}
-
-rl_vi_arg_digit (count, c)
- int count, c;
-{
- if (c == '0' && rl_numeric_arg == 1 && !rl_explicit_arg)
- rl_beg_of_line ();
- else
- rl_digit_argument (count, c);
-}
-
-/* Doesn't take an arg count in vi */
-rl_vi_change_case (ignore1, ignore2)
- int ignore1, ignore2;
-{
- char c = 0;
-
- if (uppercase_p (the_line[rl_point]))
- c = to_lower (the_line[rl_point]);
- else if (lowercase_p (the_line[rl_point]))
- c = to_upper (the_line[rl_point]);
-
- /* Vi is kind of strange here. */
- if (c)
- {
- rl_begin_undo_group ();
- rl_delete (1);
- rl_insert (1, c);
- rl_end_undo_group ();
- rl_vi_check ();
- }
- else
- rl_forward (1);
-}
-
-rl_vi_put (count, key)
- int count, key;
-{
- if (!uppercase_p (key))
- {
- if(rl_point != rl_end)
- rl_point++;
- }
-
- rl_yank ();
- rl_backward (1);
-}
-
-rl_vi_check ()
-{
- if (rl_point && rl_point == rl_end)
- rl_point--;
-}
-
-rl_vi_column (count)
-{
- if (count > rl_end)
- rl_end_of_line ();
- else
- rl_point = count - 1;
-}
-
-int
-rl_vi_domove ()
-{
- int c, save;
-
- rl_mark = rl_point;
- c = rl_read_key (in_stream);
-
- if (!member (c, vi_motion))
- {
- if (digit (c))
- {
- save = rl_numeric_arg;
- rl_digit_loop1 ();
- rl_numeric_arg *= save;
- }
- else
- return (-1);
- }
-
- rl_dispatch (c, keymap);
-
- /* No change in position means the command failed. */
- if (rl_mark == rl_point)
- return (-1);
-
- if ((c == 'w' || c == 'W') && rl_point < rl_end)
- {
- rl_point--;
- while((rl_point > 0) && whitespace (the_line[rl_point]))
- rl_point--;
- rl_point++;
- }
-
- if (rl_mark < rl_point)
- exchange (rl_point, rl_mark);
-
- return (0);
-}
-
-/* A simplified loop for vi. Don't dispatch key at end.
- Don't recognize minus sign? */
-rl_digit_loop1 ()
-{
- int key, c;
-
- while (1)
- {
- rl_message ("(arg: %d) ", arg_sign * rl_numeric_arg);
- key = c = rl_read_key ();
-
- if (keymap[c].type == ISFUNC &&
- keymap[c].function == rl_universal_argument)
- {
- rl_numeric_arg *= 4;
- continue;
- }
- c = UNMETA (c);
- if (numeric (c))
- {
- if (rl_explicit_arg)
- rl_numeric_arg = (rl_numeric_arg * 10) + (c - '0');
- else
- rl_numeric_arg = (c - '0');
- rl_explicit_arg = 1;
- }
- else
- {
- rl_clear_message ();
- rl_stuff_char (key);
- }
- }
-}
-
-rl_vi_delete_to (count, key)
- int count, key;
-{
- if (uppercase_p (key))
- rl_stuff_char ('$');
-
- if (rl_vi_domove ())
- {
- ding ();
- return;
- }
-
- rl_kill_text (rl_point, rl_mark);
-}
-
-rl_vi_change_to (count, key)
- int count, key;
-{
- if (uppercase_p (key))
- rl_stuff_char ('$');
-
- if (rl_vi_domove ())
- {
- ding ();
- return;
- }
-
- rl_begin_undo_group ();
- vi_doing_insert = 1;
- rl_kill_text (rl_point, rl_mark);
- rl_vi_insertion_mode ();
-}
-
-rl_vi_yank_to (count, key)
- int count, key;
-{
- int save = rl_point;
-
- if (uppercase_p (key))
- rl_stuff_char ('$');
-
- if (rl_vi_domove ())
- {
- ding ();
- return;
- }
-
- rl_begin_undo_group ();
- rl_kill_text (rl_point, rl_mark);
- rl_end_undo_group ();
- rl_do_undo ();
- rl_point = save;
-}
-
-rl_vi_delete (count)
-{
- if (rl_point >= rl_end - 1)
- {
- rl_delete (count);
- if (rl_point > 0)
- rl_backward (1);
- }
- else
- rl_delete (count);
-}
-
-/* Turn the current line into a comment in shell history. A ksh function */
-rl_vi_comment ()
-{
- rl_beg_of_line ();
- rl_insert_text (": "); /* # doesn't work in interactive mode */
- rl_redisplay ();
- rl_newline (1, '\010');
-}
-
-rl_vi_first_print ()
-{
- rl_back_to_indent ();
-}
-
-rl_back_to_indent (ignore1, ignore2)
- int ignore1, ignore2;
-{
- rl_beg_of_line ();
- while (rl_point < rl_end && whitespace (the_line[rl_point]))
- rl_point++;
-}
-
-/* NOTE: it is necessary that opposite directions are inverses */
-#define FTO 1 /* forward to */
-#define BTO -1 /* backward to */
-#define FFIND 2 /* forward find */
-#define BFIND -2 /* backward find */
-
-rl_vi_char_search (count, key)
- int count, key;
-{
- static char target;
- static int orig_dir, dir;
- int pos;
-
- if (key == ';' || key == ',')
- dir = (key == ';' ? orig_dir : -orig_dir);
- else
- {
- target = rl_read_key();
-
- switch (key)
- {
- case 't':
- orig_dir = dir = FTO;
- break;
-
- case 'T':
- orig_dir = dir = BTO;
- break;
-
- case 'f':
- orig_dir = dir = FFIND;
- break;
-
- case 'F':
- orig_dir = dir = BFIND;
- break;
- }
- }
-
- pos = rl_point;
-
- if (dir < 0)
- {
- pos--;
- do
- {
- if (the_line[pos] == target)
- {
- if (dir == BTO)
- rl_point = pos + 1;
- else
- rl_point = pos;
- return;
- }
- }
- while (pos--);
-
- if (pos < 0)
- {
- ding ();
- return;
- }
- }
- else
- { /* dir > 0 */
- pos++;
- do
- {
- if (the_line[pos] == target)
- {
- if (dir == FTO)
- rl_point = pos - 1;
- else
- rl_point = pos;
- return;
- }
- }
- while (++pos < rl_end);
-
- if (pos >= (rl_end - 1))
- ding ();
- }
-}
-
-/* Match brackets */
-rl_vi_match ()
-{
- int count = 1, brack, pos;
-
- pos = rl_point;
- if ((brack = rl_vi_bracktype (the_line[rl_point])) == 0)
- {
- while ((brack = rl_vi_bracktype (the_line[rl_point])) == 0 &&
- rl_point < rl_end - 1)
- rl_forward (1);
-
- if (brack <= 0)
- {
- rl_point = pos;
- ding ();
- return;
- }
- }
-
- pos = rl_point;
-
- if (brack < 0)
- {
- while (count)
- {
- if (--pos >= 0)
- {
- int b = rl_vi_bracktype (the_line[pos]);
- if (b == -brack)
- count--;
- else if (b == brack)
- count++;
- }
- else
- {
- ding ();
- return;
- }
- }
- }
- else
- { /* brack > 0 */
- while (count)
- {
- if (++pos < rl_end)
- {
- int b = rl_vi_bracktype (the_line[pos]);
- if (b == -brack)
- count--;
- else if (b == brack)
- count++;
- }
- else
- {
- ding ();
- return;
- }
- }
- }
- rl_point = pos;
-}
-
-int
-rl_vi_bracktype (c)
- int c;
-{
- switch (c)
- {
- case '(': return 1;
- case ')': return -1;
- case '[': return 2;
- case ']': return -2;
- case '{': return 3;
- case '}': return -3;
- default: return 0;
- }
-}
-
-rl_vi_change_char ()
-{
- int c;
-
- c = rl_read_key();
-
- switch (c)
- {
- case '\033':
- case CTRL('C'):
- return;
-
- default:
- rl_begin_undo_group ();
- rl_delete (1);
- rl_insert (1, c);
- rl_end_undo_group ();
- break;
- }
-}
-
-rl_vi_subst (count, key)
- int count, key;
-{
- rl_begin_undo_group ();
- vi_doing_insert = 1;
-
- if (uppercase_p (key))
- {
- rl_beg_of_line ();
- rl_kill_line (1);
- }
- else
- rl_delete (1);
-
- rl_vi_insertion_mode ();
-}
-
-rl_vi_overstrike (count, key)
- int count, key;
-{
- int i;
-
- if (vi_doing_insert == 0)
- {
- vi_doing_insert = 1;
- rl_begin_undo_group ();
- }
-
- for (i = 0; i < count; i++)
- {
- vi_replace_count++;
- rl_begin_undo_group ();
-
- if (rl_point < rl_end)
- {
- rl_delete (1);
- rl_insert (1, key);
- }
- else
- rl_insert (1, key);
-
- rl_end_undo_group ();
- }
-}
-
-rl_vi_overstrike_delete (count)
- int count;
-{
- int i, s;
-
- for (i = 0; i < count; i++)
- {
- if (vi_replace_count == 0)
- {
- ding ();
- break;
- }
- s = rl_point;
-
- if (rl_do_undo ())
- vi_replace_count--;
-
- if (rl_point == s)
- rl_backward (1);
- }
-
- if (vi_replace_count == 0 && vi_doing_insert)
- {
- rl_end_undo_group ();
- rl_do_undo ();
- vi_doing_insert = 0;
- }
-}
-
-rl_vi_replace ()
-{
- int i;
-
- vi_replace_count = 0;
-
- vi_replace_map = rl_make_bare_keymap ();
-
- for (i = ' '; i < 127; i++)
- vi_replace_map[i].function = rl_vi_overstrike;
-
- vi_replace_map[RUBOUT].function = rl_vi_overstrike_delete;
- vi_replace_map[CTRL('H')].function = rl_vi_overstrike_delete;
- vi_replace_map[ESC].function = rl_vi_movement_mode;
- vi_replace_map[RETURN].function = rl_newline;
- vi_replace_map[NEWLINE].function = rl_newline;
- keymap = vi_replace_map;
-}
diff --git a/gnu/usr.bin/gdb/regex.c b/gnu/usr.bin/gdb/regex.c
deleted file mode 100644
index 45c3478..0000000
--- a/gnu/usr.bin/gdb/regex.c
+++ /dev/null
@@ -1,1738 +0,0 @@
-/* Extended regular expression matching and search library.
- Copyright (C) 1985, 1989 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.
-
-
- In other words, you are welcome to use, share and improve this program.
- You are forbidden to forbid anyone else to use, share and improve
- what you give them. Help stamp out software-hoarding! */
-
-
-/* To test, compile with -Dtest.
- This Dtestable feature turns this into a self-contained program
- which reads a pattern, describes how it compiles,
- then reads a string and searches for it. */
-
-#ifdef emacs
-
-/* The `emacs' switch turns on certain special matching commands
- that make sense only in emacs. */
-
-#include "config.h"
-#include "lisp.h"
-#include "buffer.h"
-#include "syntax.h"
-
-#else /* not emacs */
-
-#ifdef USG
-#ifndef BSTRING
-#define bcopy(s,d,n) memcpy((d),(s),(n))
-#define bcmp(s1,s2,n) memcmp((s1),(s2),(n))
-#define bzero(s,n) memset((s),0,(n))
-#endif
-#endif
-
-/* Make alloca work the best possible way. */
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else
-#ifdef sparc
-#include <alloca.h>
-#endif
-#endif
-
-/*
- * Define the syntax stuff, so we can do the \<...\> things.
- */
-
-#ifndef Sword /* must be non-zero in some of the tests below... */
-#define Sword 1
-#endif
-
-#define SYNTAX(c) re_syntax_table[c]
-
-#ifdef SYNTAX_TABLE
-
-char *re_syntax_table;
-
-#else
-
-static char re_syntax_table[256];
-
-static void
-init_syntax_once ()
-{
- register int c;
- static int done = 0;
-
- if (done)
- return;
-
- bzero (re_syntax_table, sizeof re_syntax_table);
-
- for (c = 'a'; c <= 'z'; c++)
- re_syntax_table[c] = Sword;
-
- for (c = 'A'; c <= 'Z'; c++)
- re_syntax_table[c] = Sword;
-
- for (c = '0'; c <= '9'; c++)
- re_syntax_table[c] = Sword;
-
- done = 1;
-}
-
-#endif /* SYNTAX_TABLE */
-#endif /* not emacs */
-
-#include "regex.h"
-
-/* Number of failure points to allocate space for initially,
- when matching. If this number is exceeded, more space is allocated,
- so it is not a hard limit. */
-
-#ifndef NFAILURES
-#define NFAILURES 80
-#endif /* NFAILURES */
-
-/* width of a byte in bits */
-
-#define BYTEWIDTH 8
-
-#ifndef SIGN_EXTEND_CHAR
-#define SIGN_EXTEND_CHAR(x) (x)
-#endif
-
-static int obscure_syntax = 0;
-
-/* Specify the precise syntax of regexp for compilation.
- This provides for compatibility for various utilities
- which historically have different, incompatible syntaxes.
-
- The argument SYNTAX is a bit-mask containing the two bits
- RE_NO_BK_PARENS and RE_NO_BK_VBAR. */
-
-int
-re_set_syntax (syntax)
-{
- int ret;
-
- ret = obscure_syntax;
- obscure_syntax = syntax;
- return ret;
-}
-
-/* re_compile_pattern takes a regular-expression string
- and converts it into a buffer full of byte commands for matching.
-
- PATTERN is the address of the pattern string
- SIZE is the length of it.
- BUFP is a struct re_pattern_buffer * which points to the info
- on where to store the byte commands.
- This structure contains a char * which points to the
- actual space, which should have been obtained with malloc.
- re_compile_pattern may use realloc to grow the buffer space.
-
- The number of bytes of commands can be found out by looking in
- the struct re_pattern_buffer that bufp pointed to,
- after re_compile_pattern returns.
-*/
-
-#define PATPUSH(ch) (*b++ = (char) (ch))
-
-#define PATFETCH(c) \
- {if (p == pend) goto end_of_pattern; \
- c = * (unsigned char *) p++; \
- if (translate) c = translate[c]; }
-
-#define PATFETCH_RAW(c) \
- {if (p == pend) goto end_of_pattern; \
- c = * (unsigned char *) p++; }
-
-#define PATUNFETCH p--
-
-#define EXTEND_BUFFER \
- { char *old_buffer = bufp->buffer; \
- if (bufp->allocated == (1<<16)) goto too_big; \
- bufp->allocated *= 2; \
- if (bufp->allocated > (1<<16)) bufp->allocated = (1<<16); \
- if (!(bufp->buffer = (char *) realloc (bufp->buffer, bufp->allocated))) \
- goto memory_exhausted; \
- c = bufp->buffer - old_buffer; \
- b += c; \
- if (fixup_jump) \
- fixup_jump += c; \
- if (laststart) \
- laststart += c; \
- begalt += c; \
- if (pending_exact) \
- pending_exact += c; \
- }
-
-static int store_jump (), insert_jump ();
-
-char *
-re_compile_pattern (pattern, size, bufp)
- char *pattern;
- int size;
- struct re_pattern_buffer *bufp;
-{
- register char *b = bufp->buffer;
- register char *p = pattern;
- char *pend = pattern + size;
- register unsigned c, c1;
- char *p1;
- unsigned char *translate = (unsigned char *) bufp->translate;
-
- /* address of the count-byte of the most recently inserted "exactn" command.
- This makes it possible to tell whether a new exact-match character
- can be added to that command or requires a new "exactn" command. */
-
- char *pending_exact = 0;
-
- /* address of the place where a forward-jump should go
- to the end of the containing expression.
- Each alternative of an "or", except the last, ends with a forward-jump
- of this sort. */
-
- char *fixup_jump = 0;
-
- /* address of start of the most recently finished expression.
- This tells postfix * where to find the start of its operand. */
-
- char *laststart = 0;
-
- /* In processing a repeat, 1 means zero matches is allowed */
-
- char zero_times_ok;
-
- /* In processing a repeat, 1 means many matches is allowed */
-
- char many_times_ok;
-
- /* address of beginning of regexp, or inside of last \( */
-
- char *begalt = b;
-
- /* Stack of information saved by \( and restored by \).
- Four stack elements are pushed by each \(:
- First, the value of b.
- Second, the value of fixup_jump.
- Third, the value of regnum.
- Fourth, the value of begalt. */
-
- int stackb[40];
- int *stackp = stackb;
- int *stacke = stackb + 40;
- int *stackt;
-
- /* Counts \('s as they are encountered. Remembered for the matching \),
- where it becomes the "register number" to put in the stop_memory command */
-
- int regnum = 1;
-
- bufp->fastmap_accurate = 0;
-
-#ifndef emacs
-#ifndef SYNTAX_TABLE
- /*
- * Initialize the syntax table.
- */
- init_syntax_once();
-#endif
-#endif
-
- if (bufp->allocated == 0)
- {
- bufp->allocated = 28;
- if (bufp->buffer)
- /* EXTEND_BUFFER loses when bufp->allocated is 0 */
- bufp->buffer = (char *) realloc (bufp->buffer, 28);
- else
- /* Caller did not allocate a buffer. Do it for him */
- bufp->buffer = (char *) malloc (28);
- if (!bufp->buffer) goto memory_exhausted;
- begalt = b = bufp->buffer;
- }
-
- while (p != pend)
- {
- if (b - bufp->buffer > bufp->allocated - 10)
- /* Note that EXTEND_BUFFER clobbers c */
- EXTEND_BUFFER;
-
- PATFETCH (c);
-
- switch (c)
- {
- case '$':
- if (obscure_syntax & RE_TIGHT_VBAR)
- {
- if (! (obscure_syntax & RE_CONTEXT_INDEP_OPS) && p != pend)
- goto normal_char;
- /* Make operand of last vbar end before this `$'. */
- if (fixup_jump)
- store_jump (fixup_jump, jump, b);
- fixup_jump = 0;
- PATPUSH (endline);
- break;
- }
-
- /* $ means succeed if at end of line, but only in special contexts.
- If randomly in the middle of a pattern, it is a normal character. */
- if (p == pend || *p == '\n'
- || (obscure_syntax & RE_CONTEXT_INDEP_OPS)
- || (obscure_syntax & RE_NO_BK_PARENS
- ? *p == ')'
- : *p == '\\' && p[1] == ')')
- || (obscure_syntax & RE_NO_BK_VBAR
- ? *p == '|'
- : *p == '\\' && p[1] == '|'))
- {
- PATPUSH (endline);
- break;
- }
- goto normal_char;
-
- case '^':
- /* ^ means succeed if at beg of line, but only if no preceding pattern. */
-
- if (laststart && p[-2] != '\n'
- && ! (obscure_syntax & RE_CONTEXT_INDEP_OPS))
- goto normal_char;
- if (obscure_syntax & RE_TIGHT_VBAR)
- {
- if (p != pattern + 1
- && ! (obscure_syntax & RE_CONTEXT_INDEP_OPS))
- goto normal_char;
- PATPUSH (begline);
- begalt = b;
- }
- else
- PATPUSH (begline);
- break;
-
- case '+':
- case '?':
- if (obscure_syntax & RE_BK_PLUS_QM)
- goto normal_char;
- handle_plus:
- case '*':
- /* If there is no previous pattern, char not special. */
- if (!laststart && ! (obscure_syntax & RE_CONTEXT_INDEP_OPS))
- goto normal_char;
- /* If there is a sequence of repetition chars,
- collapse it down to equivalent to just one. */
- zero_times_ok = 0;
- many_times_ok = 0;
- while (1)
- {
- zero_times_ok |= c != '+';
- many_times_ok |= c != '?';
- if (p == pend)
- break;
- PATFETCH (c);
- if (c == '*')
- ;
- else if (!(obscure_syntax & RE_BK_PLUS_QM)
- && (c == '+' || c == '?'))
- ;
- else if ((obscure_syntax & RE_BK_PLUS_QM)
- && c == '\\')
- {
- int c1;
- PATFETCH (c1);
- if (!(c1 == '+' || c1 == '?'))
- {
- PATUNFETCH;
- PATUNFETCH;
- break;
- }
- c = c1;
- }
- else
- {
- PATUNFETCH;
- break;
- }
- }
-
- /* Star, etc. applied to an empty pattern is equivalent
- to an empty pattern. */
- if (!laststart)
- break;
-
- /* Now we know whether 0 matches is allowed,
- and whether 2 or more matches is allowed. */
- if (many_times_ok)
- {
- /* If more than one repetition is allowed,
- put in a backward jump at the end. */
- store_jump (b, maybe_finalize_jump, laststart - 3);
- b += 3;
- }
- insert_jump (on_failure_jump, laststart, b + 3, b);
- pending_exact = 0;
- b += 3;
- if (!zero_times_ok)
- {
- /* At least one repetition required: insert before the loop
- a skip over the initial on-failure-jump instruction */
- insert_jump (dummy_failure_jump, laststart, laststart + 6, b);
- b += 3;
- }
- break;
-
- case '.':
- laststart = b;
- PATPUSH (anychar);
- break;
-
- case '[':
- while (b - bufp->buffer
- > bufp->allocated - 3 - (1 << BYTEWIDTH) / BYTEWIDTH)
- /* Note that EXTEND_BUFFER clobbers c */
- EXTEND_BUFFER;
-
- laststart = b;
- if (*p == '^')
- PATPUSH (charset_not), p++;
- else
- PATPUSH (charset);
- p1 = p;
-
- PATPUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
- /* Clear the whole map */
- bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH);
- /* Read in characters and ranges, setting map bits */
- while (1)
- {
- PATFETCH (c);
- if (c == ']' && p != p1 + 1) break;
- if (*p == '-' && p[1] != ']')
- {
- PATFETCH (c1);
- PATFETCH (c1);
- while (c <= c1)
- b[c / BYTEWIDTH] |= 1 << (c % BYTEWIDTH), c++;
- }
- else
- {
- b[c / BYTEWIDTH] |= 1 << (c % BYTEWIDTH);
- }
- }
- /* Discard any bitmap bytes that are all 0 at the end of the map.
- Decrement the map-length byte too. */
- while ((int) b[-1] > 0 && b[b[-1] - 1] == 0)
- b[-1]--;
- b += b[-1];
- break;
-
- case '(':
- if (! (obscure_syntax & RE_NO_BK_PARENS))
- goto normal_char;
- else
- goto handle_open;
-
- case ')':
- if (! (obscure_syntax & RE_NO_BK_PARENS))
- goto normal_char;
- else
- goto handle_close;
-
- case '\n':
- if (! (obscure_syntax & RE_NEWLINE_OR))
- goto normal_char;
- else
- goto handle_bar;
-
- case '|':
- if (! (obscure_syntax & RE_NO_BK_VBAR))
- goto normal_char;
- else
- goto handle_bar;
-
- case '\\':
- if (p == pend) goto invalid_pattern;
- PATFETCH_RAW (c);
- switch (c)
- {
- case '(':
- if (obscure_syntax & RE_NO_BK_PARENS)
- goto normal_backsl;
- handle_open:
- if (stackp == stacke) goto nesting_too_deep;
- if (regnum < RE_NREGS)
- {
- PATPUSH (start_memory);
- PATPUSH (regnum);
- }
- *stackp++ = b - bufp->buffer;
- *stackp++ = fixup_jump ? fixup_jump - bufp->buffer + 1 : 0;
- *stackp++ = regnum++;
- *stackp++ = begalt - bufp->buffer;
- fixup_jump = 0;
- laststart = 0;
- begalt = b;
- break;
-
- case ')':
- if (obscure_syntax & RE_NO_BK_PARENS)
- goto normal_backsl;
- handle_close:
- if (stackp == stackb) goto unmatched_close;
- begalt = *--stackp + bufp->buffer;
- if (fixup_jump)
- store_jump (fixup_jump, jump, b);
- if (stackp[-1] < RE_NREGS)
- {
- PATPUSH (stop_memory);
- PATPUSH (stackp[-1]);
- }
- stackp -= 2;
- fixup_jump = 0;
- if (*stackp)
- fixup_jump = *stackp + bufp->buffer - 1;
- laststart = *--stackp + bufp->buffer;
- break;
-
- case '|':
- if (obscure_syntax & RE_NO_BK_VBAR)
- goto normal_backsl;
- handle_bar:
- insert_jump (on_failure_jump, begalt, b + 6, b);
- pending_exact = 0;
- b += 3;
- if (fixup_jump)
- store_jump (fixup_jump, jump, b);
- fixup_jump = b;
- b += 3;
- laststart = 0;
- begalt = b;
- break;
-
-#ifdef emacs
- case '=':
- PATPUSH (at_dot);
- break;
-
- case 's':
- laststart = b;
- PATPUSH (syntaxspec);
- PATFETCH (c);
- PATPUSH (syntax_spec_code[c]);
- break;
-
- case 'S':
- laststart = b;
- PATPUSH (notsyntaxspec);
- PATFETCH (c);
- PATPUSH (syntax_spec_code[c]);
- break;
-#endif /* emacs */
-
- case 'w':
- laststart = b;
- PATPUSH (wordchar);
- break;
-
- case 'W':
- laststart = b;
- PATPUSH (notwordchar);
- break;
-
- case '<':
- PATPUSH (wordbeg);
- break;
-
- case '>':
- PATPUSH (wordend);
- break;
-
- case 'b':
- PATPUSH (wordbound);
- break;
-
- case 'B':
- PATPUSH (notwordbound);
- break;
-
- case '`':
- PATPUSH (begbuf);
- break;
-
- case '\'':
- PATPUSH (endbuf);
- break;
-
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- c1 = c - '0';
- if (c1 >= regnum)
- goto normal_char;
- for (stackt = stackp - 2; stackt > stackb; stackt -= 4)
- if (*stackt == c1)
- goto normal_char;
- laststart = b;
- PATPUSH (duplicate);
- PATPUSH (c1);
- break;
-
- case '+':
- case '?':
- if (obscure_syntax & RE_BK_PLUS_QM)
- goto handle_plus;
-
- default:
- normal_backsl:
- /* You might think it would be useful for \ to mean
- not to translate; but if we don't translate it
- it will never match anything. */
- if (translate) c = translate[c];
- goto normal_char;
- }
- break;
-
- default:
- normal_char:
- if (!pending_exact || pending_exact + *pending_exact + 1 != b
- || *pending_exact == 0177 || *p == '*' || *p == '^'
- || ((obscure_syntax & RE_BK_PLUS_QM)
- ? *p == '\\' && (p[1] == '+' || p[1] == '?')
- : (*p == '+' || *p == '?')))
- {
- laststart = b;
- PATPUSH (exactn);
- pending_exact = b;
- PATPUSH (0);
- }
- PATPUSH (c);
- (*pending_exact)++;
- }
- }
-
- if (fixup_jump)
- store_jump (fixup_jump, jump, b);
-
- if (stackp != stackb) goto unmatched_open;
-
- bufp->used = b - bufp->buffer;
- return 0;
-
- invalid_pattern:
- return "Invalid regular expression";
-
- unmatched_open:
- return "Unmatched \\(";
-
- unmatched_close:
- return "Unmatched \\)";
-
- end_of_pattern:
- return "Premature end of regular expression";
-
- nesting_too_deep:
- return "Nesting too deep";
-
- too_big:
- return "Regular expression too big";
-
- memory_exhausted:
- return "Memory exhausted";
-}
-
-/* Store where `from' points a jump operation to jump to where `to' points.
- `opcode' is the opcode to store. */
-
-static int
-store_jump (from, opcode, to)
- char *from, *to;
- char opcode;
-{
- from[0] = opcode;
- from[1] = (to - (from + 3)) & 0377;
- from[2] = (to - (from + 3)) >> 8;
-}
-
-/* Open up space at char FROM, and insert there a jump to TO.
- CURRENT_END gives te end of the storage no in use,
- so we know how much data to copy up.
- OP is the opcode of the jump to insert.
-
- If you call this function, you must zero out pending_exact. */
-
-static int
-insert_jump (op, from, to, current_end)
- char op;
- char *from, *to, *current_end;
-{
- register char *pto = current_end + 3;
- register char *pfrom = current_end;
- while (pfrom != from)
- *--pto = *--pfrom;
- store_jump (from, op, to);
-}
-
-/* Given a pattern, compute a fastmap from it.
- The fastmap records which of the (1 << BYTEWIDTH) possible characters
- can start a string that matches the pattern.
- This fastmap is used by re_search to skip quickly over totally implausible text.
-
- The caller must supply the address of a (1 << BYTEWIDTH)-byte data area
- as bufp->fastmap.
- The other components of bufp describe the pattern to be used. */
-
-void
-re_compile_fastmap (bufp)
- struct re_pattern_buffer *bufp;
-{
- unsigned char *pattern = (unsigned char *) bufp->buffer;
- int size = bufp->used;
- register char *fastmap = bufp->fastmap;
- register unsigned char *p = pattern;
- register unsigned char *pend = pattern + size;
- register int j, k;
- unsigned char *translate = (unsigned char *) bufp->translate;
-
- unsigned char *stackb[NFAILURES];
- unsigned char **stackp = stackb;
-
- bzero (fastmap, (1 << BYTEWIDTH));
- bufp->fastmap_accurate = 1;
- bufp->can_be_null = 0;
-
- while (p)
- {
- if (p == pend)
- {
- bufp->can_be_null = 1;
- break;
- }
-#ifdef SWITCH_ENUM_BUG
- switch ((int) ((enum regexpcode) *p++))
-#else
- switch ((enum regexpcode) *p++)
-#endif
- {
- case exactn:
- if (translate)
- fastmap[translate[p[1]]] = 1;
- else
- fastmap[p[1]] = 1;
- break;
-
- case begline:
- case before_dot:
- case at_dot:
- case after_dot:
- case begbuf:
- case endbuf:
- case wordbound:
- case notwordbound:
- case wordbeg:
- case wordend:
- continue;
-
- case endline:
- if (translate)
- fastmap[translate['\n']] = 1;
- else
- fastmap['\n'] = 1;
- if (bufp->can_be_null != 1)
- bufp->can_be_null = 2;
- break;
-
- case finalize_jump:
- case maybe_finalize_jump:
- case jump:
- case dummy_failure_jump:
- bufp->can_be_null = 1;
- j = *p++ & 0377;
- j += SIGN_EXTEND_CHAR (*(char *)p) << 8;
- p += j + 1; /* The 1 compensates for missing ++ above */
- if (j > 0)
- continue;
- /* Jump backward reached implies we just went through
- the body of a loop and matched nothing.
- Opcode jumped to should be an on_failure_jump.
- Just treat it like an ordinary jump.
- For a * loop, it has pushed its failure point already;
- if so, discard that as redundant. */
- if ((enum regexpcode) *p != on_failure_jump)
- continue;
- p++;
- j = *p++ & 0377;
- j += SIGN_EXTEND_CHAR (*(char *)p) << 8;
- p += j + 1; /* The 1 compensates for missing ++ above */
- if (stackp != stackb && *stackp == p)
- stackp--;
- continue;
-
- case on_failure_jump:
- j = *p++ & 0377;
- j += SIGN_EXTEND_CHAR (*(char *)p) << 8;
- p++;
- *++stackp = p + j;
- continue;
-
- case start_memory:
- case stop_memory:
- p++;
- continue;
-
- case duplicate:
- bufp->can_be_null = 1;
- fastmap['\n'] = 1;
- case anychar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (j != '\n')
- fastmap[j] = 1;
- if (bufp->can_be_null)
- return;
- /* Don't return; check the alternative paths
- so we can set can_be_null if appropriate. */
- break;
-
- case wordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == Sword)
- fastmap[j] = 1;
- break;
-
- case notwordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != Sword)
- fastmap[j] = 1;
- break;
-
-#ifdef emacs
- case syntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
-
- case notsyntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
-#endif /* emacs */
-
- case charset:
- for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
- {
- if (translate)
- fastmap[translate[j]] = 1;
- else
- fastmap[j] = 1;
- }
- break;
-
- case charset_not:
- /* Chars beyond end of map must be allowed */
- for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
- if (translate)
- fastmap[translate[j]] = 1;
- else
- fastmap[j] = 1;
-
- for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
- {
- if (translate)
- fastmap[translate[j]] = 1;
- else
- fastmap[j] = 1;
- }
- break;
- }
-
- /* Get here means we have successfully found the possible starting characters
- of one path of the pattern. We need not follow this path any farther.
- Instead, look at the next alternative remembered in the stack. */
- if (stackp != stackb)
- p = *stackp--;
- else
- break;
- }
-}
-
-/* Like re_search_2, below, but only one string is specified. */
-
-int
-re_search (pbufp, string, size, startpos, range, regs)
- struct re_pattern_buffer *pbufp;
- char *string;
- int size, startpos, range;
- struct re_registers *regs;
-{
- return re_search_2 (pbufp, 0, 0, string, size, startpos, range, regs, size);
-}
-
-/* Like re_match_2 but tries first a match starting at index STARTPOS,
- then at STARTPOS + 1, and so on.
- RANGE is the number of places to try before giving up.
- If RANGE is negative, the starting positions tried are
- STARTPOS, STARTPOS - 1, etc.
- It is up to the caller to make sure that range is not so large
- as to take the starting position outside of the input strings.
-
-The value returned is the position at which the match was found,
- or -1 if no match was found,
- or -2 if error (such as failure stack overflow). */
-
-int
-re_search_2 (pbufp, string1, size1, string2, size2, startpos, range, regs, mstop)
- struct re_pattern_buffer *pbufp;
- char *string1, *string2;
- int size1, size2;
- int startpos;
- register int range;
- struct re_registers *regs;
- int mstop;
-{
- register char *fastmap = pbufp->fastmap;
- register unsigned char *translate = (unsigned char *) pbufp->translate;
- int total = size1 + size2;
- int val;
-
- /* Update the fastmap now if not correct already */
- if (fastmap && !pbufp->fastmap_accurate)
- re_compile_fastmap (pbufp);
-
- /* Don't waste time in a long search for a pattern
- that says it is anchored. */
- if (pbufp->used > 0 && (enum regexpcode) pbufp->buffer[0] == begbuf
- && range > 0)
- {
- if (startpos > 0)
- return -1;
- else
- range = 1;
- }
-
- while (1)
- {
- /* If a fastmap is supplied, skip quickly over characters
- that cannot possibly be the start of a match.
- Note, however, that if the pattern can possibly match
- the null string, we must test it at each starting point
- so that we take the first null string we get. */
-
- if (fastmap && startpos < total && pbufp->can_be_null != 1)
- {
- if (range > 0)
- {
- register int lim = 0;
- register unsigned char *p;
- int irange = range;
- if (startpos < size1 && startpos + range >= size1)
- lim = range - (size1 - startpos);
-
- p = ((unsigned char *)
- &(startpos >= size1 ? string2 - size1 : string1)[startpos]);
-
- if (translate)
- {
- while (range > lim && !fastmap[translate[*p++]])
- range--;
- }
- else
- {
- while (range > lim && !fastmap[*p++])
- range--;
- }
- startpos += irange - range;
- }
- else
- {
- register unsigned char c;
- if (startpos >= size1)
- c = string2[startpos - size1];
- else
- c = string1[startpos];
- c &= 0xff;
- if (translate ? !fastmap[translate[c]] : !fastmap[c])
- goto advance;
- }
- }
-
- if (range >= 0 && startpos == total
- && fastmap && pbufp->can_be_null == 0)
- return -1;
-
- val = re_match_2 (pbufp, string1, size1, string2, size2, startpos, regs, mstop);
- if (0 <= val)
- {
- if (val == -2)
- return -2;
- return startpos;
- }
-
-#ifdef C_ALLOCA
- alloca (0);
-#endif /* C_ALLOCA */
-
- advance:
- if (!range) break;
- if (range > 0) range--, startpos++; else range++, startpos--;
- }
- return -1;
-}
-
-#ifndef emacs /* emacs never uses this */
-int
-re_match (pbufp, string, size, pos, regs)
- struct re_pattern_buffer *pbufp;
- char *string;
- int size, pos;
- struct re_registers *regs;
-{
- return re_match_2 (pbufp, 0, 0, string, size, pos, regs, size);
-}
-#endif /* emacs */
-
-/* Maximum size of failure stack. Beyond this, overflow is an error. */
-
-int re_max_failures = 2000;
-
-static int bcmp_translate();
-/* Match the pattern described by PBUFP
- against data which is the virtual concatenation of STRING1 and STRING2.
- SIZE1 and SIZE2 are the sizes of the two data strings.
- Start the match at position POS.
- Do not consider matching past the position MSTOP.
-
- If pbufp->fastmap is nonzero, then it had better be up to date.
-
- The reason that the data to match are specified as two components
- which are to be regarded as concatenated
- is so this function can be used directly on the contents of an Emacs buffer.
-
- -1 is returned if there is no match. -2 is returned if there is
- an error (such as match stack overflow). Otherwise the value is the length
- of the substring which was matched. */
-
-int
-re_match_2 (pbufp, string1, size1, string2, size2, pos, regs, mstop)
- struct re_pattern_buffer *pbufp;
- unsigned char *string1, *string2;
- int size1, size2;
- int pos;
- struct re_registers *regs;
- int mstop;
-{
- register unsigned char *p = (unsigned char *) pbufp->buffer;
- register unsigned char *pend = p + pbufp->used;
- /* End of first string */
- unsigned char *end1;
- /* End of second string */
- unsigned char *end2;
- /* Pointer just past last char to consider matching */
- unsigned char *end_match_1, *end_match_2;
- register unsigned char *d, *dend;
- register int mcnt;
- unsigned char *translate = (unsigned char *) pbufp->translate;
-
- /* Failure point stack. Each place that can handle a failure further down the line
- pushes a failure point on this stack. It consists of two char *'s.
- The first one pushed is where to resume scanning the pattern;
- the second pushed is where to resume scanning the strings.
- If the latter is zero, the failure point is a "dummy".
- If a failure happens and the innermost failure point is dormant,
- it discards that failure point and tries the next one. */
-
- unsigned char *initial_stack[2 * NFAILURES];
- unsigned char **stackb = initial_stack;
- unsigned char **stackp = stackb, **stacke = &stackb[2 * NFAILURES];
-
- /* Information on the "contents" of registers.
- These are pointers into the input strings; they record
- just what was matched (on this attempt) by some part of the pattern.
- The start_memory command stores the start of a register's contents
- and the stop_memory command stores the end.
-
- At that point, regstart[regnum] points to the first character in the register,
- regend[regnum] points to the first character beyond the end of the register,
- regstart_seg1[regnum] is true iff regstart[regnum] points into string1,
- and regend_seg1[regnum] is true iff regend[regnum] points into string1. */
-
- unsigned char *regstart[RE_NREGS];
- unsigned char *regend[RE_NREGS];
- unsigned char regstart_seg1[RE_NREGS], regend_seg1[RE_NREGS];
-
- /* Set up pointers to ends of strings.
- Don't allow the second string to be empty unless both are empty. */
- if (!size2)
- {
- string2 = string1;
- size2 = size1;
- string1 = 0;
- size1 = 0;
- }
- end1 = string1 + size1;
- end2 = string2 + size2;
-
- /* Compute where to stop matching, within the two strings */
- if (mstop <= size1)
- {
- end_match_1 = string1 + mstop;
- end_match_2 = string2;
- }
- else
- {
- end_match_1 = end1;
- end_match_2 = string2 + mstop - size1;
- }
-
- /* Initialize \) text positions to -1
- to mark ones that no \( or \) has been seen for. */
-
- for (mcnt = 0; mcnt < sizeof (regend) / sizeof (*regend); mcnt++)
- regend[mcnt] = (unsigned char *) -1;
-
- /* `p' scans through the pattern as `d' scans through the data.
- `dend' is the end of the input string that `d' points within.
- `d' is advanced into the following input string whenever necessary,
- but this happens before fetching;
- therefore, at the beginning of the loop,
- `d' can be pointing at the end of a string,
- but it cannot equal string2. */
-
- if (pos <= size1)
- d = string1 + pos, dend = end_match_1;
- else
- d = string2 + pos - size1, dend = end_match_2;
-
-/* Write PREFETCH; just before fetching a character with *d. */
-#define PREFETCH \
- while (d == dend) \
- { if (dend == end_match_2) goto fail; /* end of string2 => failure */ \
- d = string2; /* end of string1 => advance to string2. */ \
- dend = end_match_2; }
-
- /* This loop loops over pattern commands.
- It exits by returning from the function if match is complete,
- or it drops through if match fails at this starting point in the input data. */
-
- while (1)
- {
- if (p == pend)
- /* End of pattern means we have succeeded! */
- {
- /* If caller wants register contents data back, convert it to indices */
- if (regs)
- {
- regs->start[0] = pos;
- if (dend == end_match_1)
- regs->end[0] = d - string1;
- else
- regs->end[0] = d - string2 + size1;
- for (mcnt = 1; mcnt < RE_NREGS; mcnt++)
- {
- if (regend[mcnt] == (unsigned char *) -1)
- {
- regs->start[mcnt] = -1;
- regs->end[mcnt] = -1;
- continue;
- }
- if (regstart_seg1[mcnt])
- regs->start[mcnt] = regstart[mcnt] - string1;
- else
- regs->start[mcnt] = regstart[mcnt] - string2 + size1;
- if (regend_seg1[mcnt])
- regs->end[mcnt] = regend[mcnt] - string1;
- else
- regs->end[mcnt] = regend[mcnt] - string2 + size1;
- }
- }
- if (dend == end_match_1)
- return (d - string1 - pos);
- else
- return d - string2 + size1 - pos;
- }
-
- /* Otherwise match next pattern command */
-#ifdef SWITCH_ENUM_BUG
- switch ((int) ((enum regexpcode) *p++))
-#else
- switch ((enum regexpcode) *p++)
-#endif
- {
-
- /* \( is represented by a start_memory, \) by a stop_memory.
- Both of those commands contain a "register number" argument.
- The text matched within the \( and \) is recorded under that number.
- Then, \<digit> turns into a `duplicate' command which
- is followed by the numeric value of <digit> as the register number. */
-
- case start_memory:
- regstart[*p] = d;
- regstart_seg1[*p++] = (dend == end_match_1);
- break;
-
- case stop_memory:
- regend[*p] = d;
- regend_seg1[*p++] = (dend == end_match_1);
- break;
-
- case duplicate:
- {
- int regno = *p++; /* Get which register to match against */
- register unsigned char *d2, *dend2;
-
- d2 = regstart[regno];
- dend2 = ((regstart_seg1[regno] == regend_seg1[regno])
- ? regend[regno] : end_match_1);
- while (1)
- {
- /* Advance to next segment in register contents, if necessary */
- while (d2 == dend2)
- {
- if (dend2 == end_match_2) break;
- if (dend2 == regend[regno]) break;
- d2 = string2, dend2 = regend[regno]; /* end of string1 => advance to string2. */
- }
- /* At end of register contents => success */
- if (d2 == dend2) break;
-
- /* Advance to next segment in data being matched, if necessary */
- PREFETCH;
-
- /* mcnt gets # consecutive chars to compare */
- mcnt = dend - d;
- if (mcnt > dend2 - d2)
- mcnt = dend2 - d2;
- /* Compare that many; failure if mismatch, else skip them. */
- if (translate ? bcmp_translate (d, d2, mcnt, translate) : bcmp (d, d2, mcnt))
- goto fail;
- d += mcnt, d2 += mcnt;
- }
- }
- break;
-
- case anychar:
- /* fetch a data character */
- PREFETCH;
- /* Match anything but a newline. */
- if ((translate ? translate[*d++] : *d++) == '\n')
- goto fail;
- break;
-
- case charset:
- case charset_not:
- {
- /* Nonzero for charset_not */
- int not = 0;
- register int c;
- if (*(p - 1) == (unsigned char) charset_not)
- not = 1;
-
- /* fetch a data character */
- PREFETCH;
-
- if (translate)
- c = translate [*d];
- else
- c = *d;
-
- if (c < *p * BYTEWIDTH
- && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
-
- p += 1 + *p;
-
- if (!not) goto fail;
- d++;
- break;
- }
-
- case begline:
- if (d == string1 || d[-1] == '\n')
- break;
- goto fail;
-
- case endline:
- if (d == end2
- || (d == end1 ? (size2 == 0 || *string2 == '\n') : *d == '\n'))
- break;
- goto fail;
-
- /* "or" constructs ("|") are handled by starting each alternative
- with an on_failure_jump that points to the start of the next alternative.
- Each alternative except the last ends with a jump to the joining point.
- (Actually, each jump except for the last one really jumps
- to the following jump, because tensioning the jumps is a hassle.) */
-
- /* The start of a stupid repeat has an on_failure_jump that points
- past the end of the repeat text.
- This makes a failure point so that, on failure to match a repetition,
- matching restarts past as many repetitions have been found
- with no way to fail and look for another one. */
-
- /* A smart repeat is similar but loops back to the on_failure_jump
- so that each repetition makes another failure point. */
-
- case on_failure_jump:
- if (stackp == stacke)
- {
- unsigned char **stackx;
- if (stacke - stackb > re_max_failures * 2)
- return -2;
- stackx = (unsigned char **) alloca (2 * (stacke - stackb)
- * sizeof (char *));
- bcopy (stackb, stackx, (stacke - stackb) * sizeof (char *));
- stackp = stackx + (stackp - stackb);
- stacke = stackx + 2 * (stacke - stackb);
- stackb = stackx;
- }
- mcnt = *p++ & 0377;
- mcnt += SIGN_EXTEND_CHAR (*(char *)p) << 8;
- p++;
- *stackp++ = mcnt + p;
- *stackp++ = d;
- break;
-
- /* The end of a smart repeat has an maybe_finalize_jump back.
- Change it either to a finalize_jump or an ordinary jump. */
-
- case maybe_finalize_jump:
- mcnt = *p++ & 0377;
- mcnt += SIGN_EXTEND_CHAR (*(char *)p) << 8;
- p++;
- {
- register unsigned char *p2 = p;
- /* Compare what follows with the begining of the repeat.
- If we can establish that there is nothing that they would
- both match, we can change to finalize_jump */
- while (p2 != pend
- && (*p2 == (unsigned char) stop_memory
- || *p2 == (unsigned char) start_memory))
- p2++;
- if (p2 == pend)
- p[-3] = (unsigned char) finalize_jump;
- else if (*p2 == (unsigned char) exactn
- || *p2 == (unsigned char) endline)
- {
- register int c = *p2 == (unsigned char) endline ? '\n' : p2[2];
- register unsigned char *p1 = p + mcnt;
- /* p1[0] ... p1[2] are an on_failure_jump.
- Examine what follows that */
- if (p1[3] == (unsigned char) exactn && p1[5] != c)
- p[-3] = (unsigned char) finalize_jump;
- else if (p1[3] == (unsigned char) charset
- || p1[3] == (unsigned char) charset_not)
- {
- int not = p1[3] == (unsigned char) charset_not;
- if (c < p1[4] * BYTEWIDTH
- && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
- /* not is 1 if c would match */
- /* That means it is not safe to finalize */
- if (!not)
- p[-3] = (unsigned char) finalize_jump;
- }
- }
- }
- p -= 2;
- if (p[-1] != (unsigned char) finalize_jump)
- {
- p[-1] = (unsigned char) jump;
- goto nofinalize;
- }
-
- /* The end of a stupid repeat has a finalize-jump
- back to the start, where another failure point will be made
- which will point after all the repetitions found so far. */
-
- case finalize_jump:
- stackp -= 2;
-
- case jump:
- nofinalize:
- mcnt = *p++ & 0377;
- mcnt += SIGN_EXTEND_CHAR (*(char *)p) << 8;
- p += mcnt + 1; /* The 1 compensates for missing ++ above */
- break;
-
- case dummy_failure_jump:
- if (stackp == stacke)
- {
- unsigned char **stackx
- = (unsigned char **) alloca (2 * (stacke - stackb)
- * sizeof (char *));
- bcopy (stackb, stackx, (stacke - stackb) * sizeof (char *));
- stackp = stackx + (stackp - stackb);
- stacke = stackx + 2 * (stacke - stackb);
- stackb = stackx;
- }
- *stackp++ = 0;
- *stackp++ = 0;
- goto nofinalize;
-
- case wordbound:
- if (d == string1 /* Points to first char */
- || d == end2 /* Points to end */
- || (d == end1 && size2 == 0)) /* Points to end */
- break;
- if ((SYNTAX (d[-1]) == Sword)
- != (SYNTAX (d == end1 ? *string2 : *d) == Sword))
- break;
- goto fail;
-
- case notwordbound:
- if (d == string1 /* Points to first char */
- || d == end2 /* Points to end */
- || (d == end1 && size2 == 0)) /* Points to end */
- goto fail;
- if ((SYNTAX (d[-1]) == Sword)
- != (SYNTAX (d == end1 ? *string2 : *d) == Sword))
- goto fail;
- break;
-
- case wordbeg:
- if (d == end2 /* Points to end */
- || (d == end1 && size2 == 0) /* Points to end */
- || SYNTAX (* (d == end1 ? string2 : d)) != Sword) /* Next char not a letter */
- goto fail;
- if (d == string1 /* Points to first char */
- || SYNTAX (d[-1]) != Sword) /* prev char not letter */
- break;
- goto fail;
-
- case wordend:
- if (d == string1 /* Points to first char */
- || SYNTAX (d[-1]) != Sword) /* prev char not letter */
- goto fail;
- if (d == end2 /* Points to end */
- || (d == end1 && size2 == 0) /* Points to end */
- || SYNTAX (d == end1 ? *string2 : *d) != Sword) /* Next char not a letter */
- break;
- goto fail;
-
-#ifdef emacs
- case before_dot:
- if (((d - string2 <= (unsigned) size2)
- ? d - bf_p2 : d - bf_p1)
- <= point)
- goto fail;
- break;
-
- case at_dot:
- if (((d - string2 <= (unsigned) size2)
- ? d - bf_p2 : d - bf_p1)
- == point)
- goto fail;
- break;
-
- case after_dot:
- if (((d - string2 <= (unsigned) size2)
- ? d - bf_p2 : d - bf_p1)
- >= point)
- goto fail;
- break;
-
- case wordchar:
- mcnt = (int) Sword;
- goto matchsyntax;
-
- case syntaxspec:
- mcnt = *p++;
- matchsyntax:
- PREFETCH;
- if (SYNTAX (*d++) != (enum syntaxcode) mcnt) goto fail;
- break;
-
- case notwordchar:
- mcnt = (int) Sword;
- goto matchnotsyntax;
-
- case notsyntaxspec:
- mcnt = *p++;
- matchnotsyntax:
- PREFETCH;
- if (SYNTAX (*d++) == (enum syntaxcode) mcnt) goto fail;
- break;
-#else
- case wordchar:
- PREFETCH;
- if (SYNTAX (*d++) == 0) goto fail;
- break;
-
- case notwordchar:
- PREFETCH;
- if (SYNTAX (*d++) != 0) goto fail;
- break;
-#endif /* not emacs */
-
- case begbuf:
- if (d == string1) /* Note, d cannot equal string2 */
- break; /* unless string1 == string2. */
- goto fail;
-
- case endbuf:
- if (d == end2 || (d == end1 && size2 == 0))
- break;
- goto fail;
-
- case exactn:
- /* Match the next few pattern characters exactly.
- mcnt is how many characters to match. */
- mcnt = *p++;
- if (translate)
- {
- do
- {
- PREFETCH;
- if (translate[*d++] != *p++) goto fail;
- }
- while (--mcnt);
- }
- else
- {
- do
- {
- PREFETCH;
- if (*d++ != *p++) goto fail;
- }
- while (--mcnt);
- }
- break;
- }
- continue; /* Successfully matched one pattern command; keep matching */
-
- /* Jump here if any matching operation fails. */
- fail:
- if (stackp != stackb)
- /* A restart point is known. Restart there and pop it. */
- {
- if (!stackp[-2])
- { /* If innermost failure point is dormant, flush it and keep looking */
- stackp -= 2;
- goto fail;
- }
- d = *--stackp;
- p = *--stackp;
- if (d >= string1 && d <= end1)
- dend = end_match_1;
- }
- else break; /* Matching at this starting point really fails! */
- }
- return -1; /* Failure to match */
-}
-
-static int
-bcmp_translate (s1, s2, len, translate)
- unsigned char *s1, *s2;
- register int len;
- unsigned char *translate;
-{
- register unsigned char *p1 = s1, *p2 = s2;
- while (len)
- {
- if (translate [*p1++] != translate [*p2++]) return 1;
- len--;
- }
- return 0;
-}
-
-/* Entry points compatible with bsd4.2 regex library */
-
-#ifndef emacs
-
-static struct re_pattern_buffer re_comp_buf;
-
-char *
-re_comp (s)
- char *s;
-{
- if (!s)
- {
- if (!re_comp_buf.buffer)
- return "No previous regular expression";
- return 0;
- }
-
- if (!re_comp_buf.buffer)
- {
- if (!(re_comp_buf.buffer = (char *) malloc (200)))
- return "Memory exhausted";
- re_comp_buf.allocated = 200;
- if (!(re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH)))
- return "Memory exhausted";
- }
- return re_compile_pattern (s, strlen (s), &re_comp_buf);
-}
-
-int
-re_exec (s)
- char *s;
-{
- int len = strlen (s);
- return 0 <= re_search (&re_comp_buf, s, len, 0, len, 0);
-}
-
-#endif /* emacs */
-
-#ifdef test
-
-#include <stdio.h>
-
-/* Indexed by a character, gives the upper case equivalent of the character */
-
-static char upcase[0400] =
- { 000, 001, 002, 003, 004, 005, 006, 007,
- 010, 011, 012, 013, 014, 015, 016, 017,
- 020, 021, 022, 023, 024, 025, 026, 027,
- 030, 031, 032, 033, 034, 035, 036, 037,
- 040, 041, 042, 043, 044, 045, 046, 047,
- 050, 051, 052, 053, 054, 055, 056, 057,
- 060, 061, 062, 063, 064, 065, 066, 067,
- 070, 071, 072, 073, 074, 075, 076, 077,
- 0100, 0101, 0102, 0103, 0104, 0105, 0106, 0107,
- 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117,
- 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127,
- 0130, 0131, 0132, 0133, 0134, 0135, 0136, 0137,
- 0140, 0101, 0102, 0103, 0104, 0105, 0106, 0107,
- 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117,
- 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127,
- 0130, 0131, 0132, 0173, 0174, 0175, 0176, 0177,
- 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207,
- 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217,
- 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227,
- 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237,
- 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247,
- 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257,
- 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267,
- 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277,
- 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307,
- 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317,
- 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327,
- 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337,
- 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347,
- 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357,
- 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367,
- 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377
- };
-
-main (argc, argv)
- int argc;
- char **argv;
-{
- char pat[80];
- struct re_pattern_buffer buf;
- int i;
- char c;
- char fastmap[(1 << BYTEWIDTH)];
-
- /* Allow a command argument to specify the style of syntax. */
- if (argc > 1)
- obscure_syntax = atoi (argv[1]);
-
- buf.allocated = 40;
- buf.buffer = (char *) malloc (buf.allocated);
- buf.fastmap = fastmap;
- buf.translate = upcase;
-
- while (1)
- {
- gets (pat);
-
- if (*pat)
- {
- re_compile_pattern (pat, strlen(pat), &buf);
-
- for (i = 0; i < buf.used; i++)
- printchar (buf.buffer[i]);
-
- putchar ('\n');
-
- printf ("%d allocated, %d used.\n", buf.allocated, buf.used);
-
- re_compile_fastmap (&buf);
- printf ("Allowed by fastmap: ");
- for (i = 0; i < (1 << BYTEWIDTH); i++)
- if (fastmap[i]) printchar (i);
- putchar ('\n');
- }
-
- gets (pat); /* Now read the string to match against */
-
- i = re_match (&buf, pat, strlen (pat), 0, 0);
- printf ("Match value %d.\n", i);
- }
-}
-
-#ifdef NOTDEF
-print_buf (bufp)
- struct re_pattern_buffer *bufp;
-{
- int i;
-
- printf ("buf is :\n----------------\n");
- for (i = 0; i < bufp->used; i++)
- printchar (bufp->buffer[i]);
-
- printf ("\n%d allocated, %d used.\n", bufp->allocated, bufp->used);
-
- printf ("Allowed by fastmap: ");
- for (i = 0; i < (1 << BYTEWIDTH); i++)
- if (bufp->fastmap[i])
- printchar (i);
- printf ("\nAllowed by translate: ");
- if (bufp->translate)
- for (i = 0; i < (1 << BYTEWIDTH); i++)
- if (bufp->translate[i])
- printchar (i);
- printf ("\nfastmap is%s accurate\n", bufp->fastmap_accurate ? "" : "n't");
- printf ("can %s be null\n----------", bufp->can_be_null ? "" : "not");
-}
-#endif
-
-printchar (c)
- char c;
-{
- if (c < 041 || c >= 0177)
- {
- putchar ('\\');
- putchar (((c >> 6) & 3) + '0');
- putchar (((c >> 3) & 7) + '0');
- putchar ((c & 7) + '0');
- }
- else
- putchar (c);
-}
-
-error (string)
- char *string;
-{
- puts (string);
- exit (1);
-}
-
-#endif /* test */
diff --git a/gnu/usr.bin/gdb/regex.h b/gnu/usr.bin/gdb/regex.h
deleted file mode 100644
index d0d8a82..0000000
--- a/gnu/usr.bin/gdb/regex.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/* Definitions for data structures callers pass the regex library.
- Copyright (C) 1985, 1989 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.
-
-
- In other words, you are welcome to use, share and improve this program.
- You are forbidden to forbid anyone else to use, share and improve
- what you give them. Help stamp out software-hoarding! */
-
-
-/* Define number of parens for which we record the beginnings and ends.
- This affects how much space the `struct re_registers' type takes up. */
-#ifndef RE_NREGS
-#define RE_NREGS 10
-#endif
-
-/* These bits are used in the obscure_syntax variable to choose among
- alternative regexp syntaxes. */
-
-/* 1 means plain parentheses serve as grouping, and backslash
- parentheses are needed for literal searching.
- 0 means backslash-parentheses are grouping, and plain parentheses
- are for literal searching. */
-#define RE_NO_BK_PARENS 1
-
-/* 1 means plain | serves as the "or"-operator, and \| is a literal.
- 0 means \| serves as the "or"-operator, and | is a literal. */
-#define RE_NO_BK_VBAR 2
-
-/* 0 means plain + or ? serves as an operator, and \+, \? are literals.
- 1 means \+, \? are operators and plain +, ? are literals. */
-#define RE_BK_PLUS_QM 4
-
-/* 1 means | binds tighter than ^ or $.
- 0 means the contrary. */
-#define RE_TIGHT_VBAR 8
-
-/* 1 means treat \n as an _OR operator
- 0 means treat it as a normal character */
-#define RE_NEWLINE_OR 16
-
-/* 0 means that a special characters (such as *, ^, and $) always have
- their special meaning regardless of the surrounding context.
- 1 means that special characters may act as normal characters in some
- contexts. Specifically, this applies to:
- ^ - only special at the beginning, or after ( or |
- $ - only special at the end, or before ) or |
- *, +, ? - only special when not after the beginning, (, or | */
-#define RE_CONTEXT_INDEP_OPS 32
-
-/* Now define combinations of bits for the standard possibilities. */
-#define RE_SYNTAX_AWK (RE_NO_BK_PARENS | RE_NO_BK_VBAR | RE_CONTEXT_INDEP_OPS)
-#define RE_SYNTAX_EGREP (RE_SYNTAX_AWK | RE_NEWLINE_OR)
-#define RE_SYNTAX_GREP (RE_BK_PLUS_QM | RE_NEWLINE_OR)
-#define RE_SYNTAX_EMACS 0
-
-/* This data structure is used to represent a compiled pattern. */
-
-struct re_pattern_buffer
- {
- char *buffer; /* Space holding the compiled pattern commands. */
- int allocated; /* Size of space that buffer points to */
- int used; /* Length of portion of buffer actually occupied */
- char *fastmap; /* Pointer to fastmap, if any, or zero if none. */
- /* re_search uses the fastmap, if there is one,
- to skip quickly over totally implausible characters */
- char *translate; /* Translate table to apply to all characters before comparing.
- Or zero for no translation.
- The translation is applied to a pattern when it is compiled
- and to data when it is matched. */
- char fastmap_accurate;
- /* Set to zero when a new pattern is stored,
- set to one when the fastmap is updated from it. */
- char can_be_null; /* Set to one by compiling fastmap
- if this pattern might match the null string.
- It does not necessarily match the null string
- in that case, but if this is zero, it cannot.
- 2 as value means can match null string
- but at end of range or before a character
- listed in the fastmap. */
- };
-
-/* Structure to store "register" contents data in.
-
- Pass the address of such a structure as an argument to re_match, etc.,
- if you want this information back.
-
- start[i] and end[i] record the string matched by \( ... \) grouping i,
- for i from 1 to RE_NREGS - 1.
- start[0] and end[0] record the entire string matched. */
-
-struct re_registers
- {
- int start[RE_NREGS];
- int end[RE_NREGS];
- };
-
-/* These are the command codes that appear in compiled regular expressions, one per byte.
- Some command codes are followed by argument bytes.
- A command code can specify any interpretation whatever for its arguments.
- Zero-bytes may appear in the compiled regular expression. */
-
-enum regexpcode
- {
- unused,
- exactn, /* followed by one byte giving n, and then by n literal bytes */
- begline, /* fails unless at beginning of line */
- endline, /* fails unless at end of line */
- jump, /* followed by two bytes giving relative address to jump to */
- on_failure_jump, /* followed by two bytes giving relative address of place
- to resume at in case of failure. */
- finalize_jump, /* Throw away latest failure point and then jump to address. */
- maybe_finalize_jump, /* Like jump but finalize if safe to do so.
- This is used to jump back to the beginning
- of a repeat. If the command that follows
- this jump is clearly incompatible with the
- one at the beginning of the repeat, such that
- we can be sure that there is no use backtracking
- out of repetitions already completed,
- then we finalize. */
- dummy_failure_jump, /* jump, and push a dummy failure point.
- This failure point will be thrown away
- if an attempt is made to use it for a failure.
- A + construct makes this before the first repeat. */
- anychar, /* matches any one character */
- charset, /* matches any one char belonging to specified set.
- First following byte is # bitmap bytes.
- Then come bytes for a bit-map saying which chars are in.
- Bits in each byte are ordered low-bit-first.
- A character is in the set if its bit is 1.
- A character too large to have a bit in the map
- is automatically not in the set */
- charset_not, /* similar but match any character that is NOT one of those specified */
- start_memory, /* starts remembering the text that is matched
- and stores it in a memory register.
- followed by one byte containing the register number.
- Register numbers must be in the range 0 through NREGS. */
- stop_memory, /* stops remembering the text that is matched
- and stores it in a memory register.
- followed by one byte containing the register number.
- Register numbers must be in the range 0 through NREGS. */
- duplicate, /* match a duplicate of something remembered.
- Followed by one byte containing the index of the memory register. */
- before_dot, /* Succeeds if before dot */
- at_dot, /* Succeeds if at dot */
- after_dot, /* Succeeds if after dot */
- begbuf, /* Succeeds if at beginning of buffer */
- endbuf, /* Succeeds if at end of buffer */
- wordchar, /* Matches any word-constituent character */
- notwordchar, /* Matches any char that is not a word-constituent */
- wordbeg, /* Succeeds if at word beginning */
- wordend, /* Succeeds if at word end */
- wordbound, /* Succeeds if at a word boundary */
- notwordbound, /* Succeeds if not at a word boundary */
- syntaxspec, /* Matches any character whose syntax is specified.
- followed by a byte which contains a syntax code, Sword or such like */
- notsyntaxspec /* Matches any character whose syntax differs from the specified. */
- };
-
-extern char *re_compile_pattern ();
-/* Is this really advertised? */
-extern void re_compile_fastmap ();
-extern int re_search (), re_search_2 ();
-extern int re_match (), re_match_2 ();
-
-/* 4.2 bsd compatibility (yuck) */
-extern char *re_comp ();
-extern int re_exec ();
-
-#ifdef SYNTAX_TABLE
-extern char *re_syntax_table;
-#endif
diff --git a/gnu/usr.bin/gdb/remote-sl.c b/gnu/usr.bin/gdb/remote-sl.c
deleted file mode 100644
index 4c72197..0000000
--- a/gnu/usr.bin/gdb/remote-sl.c
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * The binary remote protocol is still under development at LBL;
- * the current version can't be released.
- * Sorry, folks...
- */
-int
-sl_open()
-{
- return -1;
-}
diff --git a/gnu/usr.bin/gdb/remote.c b/gnu/usr.bin/gdb/remote.c
deleted file mode 100644
index 59658a8..0000000
--- a/gnu/usr.bin/gdb/remote.c
+++ /dev/null
@@ -1,626 +0,0 @@
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson and Steven McCanne of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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.
- *
- * $Header: /home/cvs/386BSD/src/usr.bin/gdb/remote.c,v 1.1.1.1 1993/06/12 14:52:22 rgrimes Exp $;
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)remote.c 6.5 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-#include "param.h"
-
-#include <stdio.h>
-#include <varargs.h>
-
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/file.h>
-
-#include "defs.h"
-#include "frame.h"
-#include "inferior.h"
-#include "wait.h"
-
-#include "kgdb_proto.h"
-
-static FILE *kiodebug;
-static int icache = 1;
-extern int kernel_debugging;
-
-static int remote_cache_valid;
-static int remote_instub;
-
-static void remote_signal();
-static void remote_debug();
-static void print_msg();
-
-static int remote_mtu;
-static int (*send_msg)();
-static int (*recv_msg)();
-static void (*closelink)();
-
-static u_char *inbuffer;
-static u_char *outbuffer;
-
-/*
- * Statistics.
- */
-static int remote_ierrs;
-static int remote_oerrs;
-static int remote_seqerrs;
-static int remote_spurious;
-
-#define PUTCMD(cmd) m_xchg(cmd, (u_char *)0, 0, (u_char *)0, (int *)0)
-
-/*
- * Send an outbound message to the remote machine and read the reply.
- * Either or both message buffers may be NULL.
- */
-static int
-m_xchg(type, out, outlen, in, inlen)
- int type;
- u_char *out;
- int outlen;
- u_char *in;
- int *inlen;
-{
- register int err, (*send)() = send_msg, (*recv)() = recv_msg;
- int ack;
- static int seqbit = 0;
-
- if (!remote_instub) {
- remote_instub = 1;
- PUTCMD(KGDB_EXEC);
- }
-
- seqbit ^= KGDB_SEQ;
- while (1) {
- err = (*send)(type | seqbit, out, outlen);
- if (err) {
- ++remote_oerrs;
- if (kiodebug)
- remote_debug("send error %d\n", err);
- }
- if (kiodebug)
- print_msg(type | seqbit, out, outlen, 'O');
-
- recv:
- err = (*recv)(&ack, in, inlen);
- if (err) {
- ++remote_ierrs;
- if (kiodebug)
- remote_debug("recv error %d\n", err);
- remote_cache_valid = 0;
- } else if (kiodebug)
- print_msg(ack, in, inlen ? *inlen : 0, 'I');
-
- if (err)
- continue;
-
- if ((ack & KGDB_ACK) == 0 || KGDB_CMD(ack) != KGDB_CMD(type)) {
- ++remote_spurious;
- continue;
- }
- if ((ack & KGDB_SEQ) ^ seqbit) {
- ++remote_seqerrs;
- goto recv;
- }
- return ack;
- }
-}
-
-/*
- * Wait for the specified message type. Discard anything else.
- * (this is used by 'remote-signal' to help us resync with other side.)
- */
-static void
-m_recv(type, in, inlen)
- int type;
- u_char *in;
- int *inlen;
-{
- int reply, err;
-
- while (1) {
- err = (*recv_msg)(&reply, in, inlen);
- if (err) {
- ++remote_ierrs;
- if (kiodebug)
- remote_debug("recv error %d\n", err);
- } else if (kiodebug)
- print_msg(reply, in, inlen ? *inlen : 0, 'I');
-
- if (KGDB_CMD(reply) == type)
- return;
- ++remote_spurious;
- }
-}
-
-/*
- * Send a message. Do not wait for *any* response from the other side.
- * Some other thread of control will pick up the ack that will be generated.
- */
-static void
-m_send(type, buf, len)
- int type;
- u_char *buf;
- int len;
-{
- int err;
-
- if (!remote_instub) {
- remote_instub = 1;
- PUTCMD(KGDB_EXEC);
- }
-
- err = (*send_msg)(type, buf, len);
- if (err) {
- ++remote_ierrs;
- if (kiodebug)
- remote_debug("[send error %d] ", err);
- }
- if (kiodebug)
- print_msg(type, buf, len, 'O');
-}
-
-/*
- * Open a connection to a remote debugger.
- * NAME is the filename used for communication.
- */
-void
-remote_open(name, from_tty)
- char *name;
- int from_tty;
-{
- int bufsize;
-
- remote_debugging = 0;
- if (sl_open(name, &send_msg, &recv_msg, &closelink, &remote_mtu,
- &bufsize))
- return;
- if (from_tty)
- printf("Remote debugging using %s\n", name);
- remote_debugging = 1;
-
- remote_cache_valid = 0;
-
- inbuffer = (u_char *)malloc(bufsize);
- outbuffer = (u_char *)malloc(bufsize);
-
- remote_signal();
-
- remote_ierrs = 0;
- remote_oerrs = 0;
- remote_spurious = 0;
-}
-
-/*
- * Close the open connection to the remote debugger. Use this when you want
- * to detach and do something else with your gdb.
- */
-void
-remote_close(from_tty)
- int from_tty;
-{
- if (!remote_debugging)
- error("remote debugging not enabled");
-
- remote_debugging = 0;
- /*
- * Take remote machine out of debug mode.
- */
- (void)PUTCMD(KGDB_KILL);
- (*closelink)();
- if (from_tty)
- printf("Ending remote debugging\n");
-
- free((char *)inbuffer);
- free((char *)outbuffer);
-}
-
-/*
- * Tell the remote machine to resume.
- */
-int
-remote_resume(step, signal)
- int step, signal;
-{
- if (!step) {
- (void)PUTCMD(KGDB_CONT);
- remote_instub = 0;
- } else {
-#ifdef NO_SINGLE_STEP
- single_step(0);
-#else
- (void)PUTCMD(KGDB_STEP);
-#endif
- }
-}
-
-/*
- * Wait until the remote machine stops, then return, storing status in STATUS
- * just as `wait' would.
- */
-int
-remote_wait(status)
- WAITTYPE *status;
-{
- int len;
-
- WSETEXIT((*status), 0);
- /*
- * When the machine stops, it will send us a KGDB_SIGNAL message,
- * so we wait for one of these.
- */
- m_recv(KGDB_SIGNAL, inbuffer, &len);
- WSETSTOP((*status), inbuffer[0]);
-}
-
-/*
- * Register context as of last remote_fetch_registers().
- */
-static char reg_cache[REGISTER_BYTES];
-
-/*
- * Read the remote registers into the block REGS.
- */
-void
-remote_fetch_registers(regs)
- char *regs;
-{
- int regno, len, rlen, ack;
- u_char *cp, *ep;
-
- regno = -1;
- do {
- outbuffer[0] = regno + 1;
- ack = m_xchg(remote_cache_valid ?
- KGDB_REG_R|KGDB_DELTA : KGDB_REG_R,
- outbuffer, 1, inbuffer, &len);
- cp = inbuffer;
- ep = cp + len;
- while (cp < ep) {
- regno = *cp++;
- rlen = REGISTER_RAW_SIZE(regno);
- bcopy((char *)cp,
- &reg_cache[REGISTER_BYTE(regno)], rlen);
- cp += rlen;
- }
- } while (ack & KGDB_MORE);
-
- remote_cache_valid = 1;
- bcopy(reg_cache, regs, REGISTER_BYTES);
-}
-
-/*
- * Store the remote registers from the contents of the block REGS.
- */
-void
-remote_store_registers(regs)
- char *regs;
-{
- u_char *cp, *ep;
- int regno, off, rlen;
-
- cp = outbuffer;
- ep = cp + remote_mtu;
-
- for (regno = 0; regno < NUM_REGS; ++regno) {
- off = REGISTER_BYTE(regno);
- rlen = REGISTER_RAW_SIZE(regno);
- if (!remote_cache_valid ||
- bcmp(&regs[off], &reg_cache[off], rlen) != 0) {
- if (cp + rlen + 1 >= ep) {
- (void)m_xchg(KGDB_REG_W,
- outbuffer, cp - outbuffer,
- (u_char *)0, (int *)0);
- cp = outbuffer;
- }
- *cp++ = regno;
- bcopy(&regs[off], cp, rlen);
- cp += rlen;
- }
- }
- if (cp != outbuffer)
- (void)m_xchg(KGDB_REG_W, outbuffer, cp - outbuffer,
- (u_char *)0, (int *)0);
- bcopy(regs, reg_cache, REGISTER_BYTES);
-}
-
-/*
- * Store a chunk of memory into the remote host.
- * 'remote_addr' is the address in the remote memory space.
- * 'cp' is the address of the buffer in our space, and 'len' is
- * the number of bytes. Returns an errno status.
- */
-int
-remote_write_inferior_memory(remote_addr, cp, len)
- CORE_ADDR remote_addr;
- u_char *cp;
- int len;
-{
- int cnt;
-
- while (len > 0) {
- cnt = min(len, remote_mtu - 4);
- bcopy((char *)&remote_addr, outbuffer, 4);
- bcopy(cp, outbuffer + 4, cnt);
- (void)m_xchg(KGDB_MEM_W, outbuffer, cnt + 4, inbuffer, &len);
-
- if (inbuffer[0])
- return inbuffer[0];
-
- remote_addr += cnt;
- cp += cnt;
- len -= cnt;
- }
- return 0;
-}
-
-/*
- * Read memory data directly from the remote machine.
- * 'remote_addr' is the address in the remote memory space.
- * 'cp' is the address of the buffer in our space, and 'len' is
- * the number of bytes. Returns an errno status.
- */
-static int
-remote_read_memory(remote_addr, cp, len)
- CORE_ADDR remote_addr;
- u_char *cp;
- int len;
-{
- int cnt, inlen;
-
- while (len > 0) {
- cnt = min(len, remote_mtu - 1);
- outbuffer[0] = cnt;
- bcopy((char *)&remote_addr, (char *)&outbuffer[1], 4);
-
- (void)m_xchg(KGDB_MEM_R, outbuffer, 5, inbuffer, &inlen);
-
- if (inbuffer[0] != 0)
- return inbuffer[0];
-
- if (cnt != inlen - 1)
- /* XXX */
- error("remote_read_memory() request botched");
-
- bcopy((char *)&inbuffer[1], (char *)cp, cnt);
-
- remote_addr += cnt;
- cp += cnt;
- len -= cnt;
- }
- return 0;
-}
-
-int
-remote_read_inferior_memory(remote_addr, cp, len)
- CORE_ADDR remote_addr;
- char *cp;
- int len;
-{
- int stat = 0;
-
- if (icache) {
- extern CORE_ADDR text_start, text_end;
- CORE_ADDR xferend = remote_addr + len;
-
- if (remote_addr < text_end && text_start < xferend) {
- /*
- * at least part of this xfer is in the text
- * space -- xfer the overlap from the exec file.
- */
- if (remote_addr >= text_start && xferend < text_end)
- return (xfer_core_file(remote_addr, cp, len));
- if (remote_addr >= text_start) {
- int i = text_end - remote_addr;
-
- if (stat = xfer_core_file(remote_addr, cp, i))
- return (stat);
- remote_addr += i;
- cp += i;
- len -= i;
- } else if (xferend <= text_end) {
- int i = xferend - text_start;
-
- len = text_start - remote_addr;
- if (stat = xfer_core_file(text_start,
- cp + len, i))
- return (stat);
- }
- }
- }
- return remote_read_memory(remote_addr, cp, len);
-}
-
-/*
- * Signal the remote machine. The remote end might be idle or it might
- * already be in debug mode -- we need to handle both case. Thus, we use
- * the framing character as the wakeup byte, and send a SIGNAL packet.
- * If the remote host is idle, the framing character will wake it up.
- * If it is in the kgdb stub, then we will get a SIGNAL reply.
- */
-static void
-remote_signal()
-{
- if (!remote_debugging)
- printf("Remote debugging not enabled.\n");
- else {
- remote_instub = 0;
- m_send(KGDB_SIGNAL, (u_char *)0, 0);
- }
-}
-
-static void
-remote_signal_command()
-{
- extern int stop_after_attach;
-
- if (!remote_debugging)
- error("Not debugging remote.");
- remote_cache_valid = 0;
- remote_signal();
- restart_remote();
-}
-
-/*
- * Print a message for debugging.
- */
-static void
-print_msg(type, buf, len, dir)
- int type;
- u_char *buf;
- int len;
- int dir;
-{
- int i;
- char *s;
-
- switch (KGDB_CMD(type)) {
- case KGDB_MEM_R: s = "memr"; break;
- case KGDB_MEM_W: s = "memw"; break;
- case KGDB_REG_R: s = "regr"; break;
- case KGDB_REG_W: s = "regw"; break;
- case KGDB_CONT: s = "cont"; break;
- case KGDB_STEP: s = "step"; break;
- case KGDB_KILL: s = "kill"; break;
- case KGDB_SIGNAL: s = "sig "; break;
- case KGDB_EXEC: s = "exec"; break;
- default: s = "unk "; break;
- }
- remote_debug("%c %c%c%c%c %s (%02x): ", dir,
- (type & KGDB_ACK) ? 'A' : '.',
- (type & KGDB_DELTA) ? 'D' : '.',
- (type & KGDB_MORE) ? 'M' : '.',
- (type & KGDB_SEQ) ? '-' : '+',
- s, type);
- if (buf)
- for (i = 0; i < len; ++i)
- remote_debug("%02x", buf[i]);
- remote_debug("\n");
-}
-
-static void
-set_remote_text_refs_command(arg, from_tty)
- char *arg;
- int from_tty;
-{
- icache = !parse_binary_operation("set remote-text-refs", arg);
-}
-
-static void
-remote_debug_command(arg, from_tty)
- char *arg;
- int from_tty;
-{
- char *name;
-
- if (kiodebug != 0 && kiodebug != stderr)
- (void)fclose(kiodebug);
-
- if (arg == 0) {
- kiodebug = 0;
- printf("Remote debugging off.\n");
- return;
- }
- if (arg[0] == '-') {
- kiodebug = stderr;
- name = "stderr";
- } else {
- kiodebug = fopen(arg, "w");
- if (kiodebug == 0) {
- printf("Cannot open '%s'.\n", arg);
- return;
- }
- name = arg;
- }
- printf("Remote debugging output routed to %s.\n", name);
-}
-
-/* ARGSUSED */
-static void
-remote_info(arg, from_tty)
- char *arg;
- int from_tty;
-{
- printf("Using %s for text references.\n",
- icache? "local executable" : "remote");
- printf("Protocol debugging is %s.\n", kiodebug? "on" : "off");
- printf("%d spurious input messages.\n", remote_spurious);
- printf("%d input errors; %d output errors; %d sequence errors.\n",
- remote_ierrs, remote_oerrs, remote_seqerrs);
-}
-
-/* VARARGS */
-static void
-remote_debug(va_alist)
- va_dcl
-{
- register char *cp;
- va_list ap;
-
- va_start(ap);
- cp = va_arg(ap, char *);
- (void)vfprintf(kiodebug, cp, ap);
- va_end(ap);
- fflush(kiodebug);
-}
-
-extern struct cmd_list_element *setlist;
-
-void
-_initialize_remote()
-{
- add_com("remote-signal", class_run, remote_signal_command,
- "If remote debugging, send interrupt signal to remote.");
- add_cmd("remote-text-refs", class_support,
- set_remote_text_refs_command,
-"Enable/disable use of local executable for text segment references.\n\
-If on, all memory read/writes go to remote.\n\
-If off, text segment reads use the local executable.",
- &setlist);
-
- add_com("remote-debug", class_run, remote_debug_command,
-"With a file name argument, enables output of remote protocol debugging\n\
-messages to said file. If file is `-', stderr is used.\n\
-With no argument, remote debugging is disabled.");
-
- add_info("remote", remote_info,
- "Show current settings of remote debugging options.");
-}
-
diff --git a/gnu/usr.bin/gdb/source.c b/gnu/usr.bin/gdb/source.c
deleted file mode 100644
index bb65e1c..0000000
--- a/gnu/usr.bin/gdb/source.c
+++ /dev/null
@@ -1,1166 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)source.c 6.3 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* List lines of source files for GDB, the GNU debugger.
- Copyright (C) 1986, 1987, 1988, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include <string.h>
-#include "defs.h"
-#include "param.h"
-#include "symtab.h"
-
-#ifdef USG
-#include <sys/types.h>
-#include <fcntl.h>
-#endif
-
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-
-/* Path of directories to search for source files.
- Same format as the PATH environment variable's value. */
-
-static char *source_path;
-
-/* Symtab of default file for listing lines of. */
-
-struct symtab *current_source_symtab;
-
-/* Default next line to list. */
-
-int current_source_line;
-
-/* Line number of last line printed. Default for various commands.
- current_source_line is usually, but not always, the same as this. */
-
-static int last_line_listed;
-
-/* First line number listed by last listing command. */
-
-static int first_line_listed;
-
-
-struct symtab *psymtab_to_symtab ();
-
-/* Set the source file default for the "list" command, specifying a
- symtab. Sigh. Behaivior specification: If it is called with a
- non-zero argument, that is the symtab to select. If it is not,
- first lookup "main"; if it exists, use the symtab and line it
- defines. If not, take the last symtab in the symtab_list (if it
- exists) or the last symtab in the psytab_list (if *it* exists). If
- none of this works, report an error. */
-
-void
-select_source_symtab (s)
- register struct symtab *s;
-{
- struct symtabs_and_lines sals;
- struct symtab_and_line sal;
- struct partial_symtab *ps, *cs_pst;
-
- if (s)
- {
- current_source_symtab = s;
- current_source_line = 1;
- return;
- }
-
- /* Make the default place to list be the function `main'
- if one exists. */
- if (lookup_symbol ("main", 0, VAR_NAMESPACE, 0))
- {
- sals = decode_line_spec ("main", 1);
- sal = sals.sals[0];
- free (sals.sals);
- current_source_symtab = sal.symtab;
- current_source_line = max (sal.line - 9, 1);
- return;
- }
-
- /* All right; find the last file in the symtab list (ignoring .h's). */
-
- if (s = symtab_list)
- {
- do
- {
- char *name = s->filename;
- int len = strlen (name);
- if (! (len > 2 && !strcmp (&name[len - 2], ".h")))
- current_source_symtab = s;
- s = s->next;
- }
- while (s);
- current_source_line = 1;
- }
- else if (partial_symtab_list)
- {
- ps = partial_symtab_list;
- while (ps)
- {
- char *name = ps->filename;
- int len = strlen (name);
- if (! (len > 2 && !strcmp (&name[len - 2], ".h")))
- cs_pst = ps;
- ps = ps->next;
- }
- if (cs_pst)
- if (cs_pst->readin)
- fatal ("Internal: select_source_symtab: readin pst found and no symtabs.");
- else
- current_source_symtab = psymtab_to_symtab (cs_pst);
- else
- current_source_symtab = 0;
- current_source_line = 1;
- }
-}
-
-static void
-directories_info ()
-{
- printf ("Source directories searched: %s\n", source_path);
-}
-
-void
-init_source_path ()
-{
- register struct symtab *s;
-
- source_path = savestring (current_directory, strlen (current_directory));
-
- /* Forget what we learned about line positions in source files;
- must check again now since files may be found in
- a different directory now. */
- for (s = symtab_list; s; s = s->next)
- if (s->line_charpos != 0)
- {
- free (s->line_charpos);
- s->line_charpos = 0;
- }
-}
-
-void
-directory_command (dirname, from_tty)
- char *dirname;
- int from_tty;
-{
- char *old = source_path;
-
- dont_repeat ();
-
- if (dirname == 0)
- {
- if (query ("Reinitialize source path to %s? ", current_directory))
- {
- init_source_path ();
- free (old);
- }
- }
- else
- {
- dirname = tilde_expand (dirname);
- make_cleanup (free, dirname);
-
- do
- {
- char *name = dirname;
- register char *p;
- struct stat st;
-
- {
- char *colon = index (name, ':');
- char *space = index (name, ' ');
- char *tab = index (name, '\t');
- if (colon == 0 && space == 0 && tab == 0)
- p = dirname = name + strlen (name);
- else
- {
- p = 0;
- if (colon != 0 && (p == 0 || colon < p))
- p = colon;
- if (space != 0 && (p == 0 || space < p))
- p = space;
- if (tab != 0 && (p == 0 || tab < p))
- p = tab;
- dirname = p + 1;
- while (*dirname == ':' || *dirname == ' ' || *dirname == '\t')
- ++dirname;
- }
- }
-
- if (p[-1] == '/')
- /* Sigh. "foo/" => "foo" */
- --p;
- *p = '\0';
-
- while (p[-1] == '.')
- {
- if (p - name == 1)
- {
- /* "." => getwd (). */
- name = current_directory;
- goto append;
- }
- else if (p[-2] == '/')
- {
- if (p - name == 2)
- {
- /* "/." => "/". */
- *--p = '\0';
- goto append;
- }
- else
- {
- /* "...foo/." => "...foo". */
- p -= 2;
- *p = '\0';
- continue;
- }
- }
- else
- break;
- }
-
- if (*name != '/')
- name = concat (current_directory, "/", name);
- else
- name = savestring (name, p - name);
- make_cleanup (free, name);
-
- if (stat (name, &st) < 0)
- perror_with_name (name);
- if ((st.st_mode & S_IFMT) != S_IFDIR)
- error ("%s is not a directory.", name);
-
- append:
- {
- register unsigned int len = strlen (name);
-
- p = source_path;
- while (1)
- {
- if (!strncmp (p, name, len)
- && (p[len] == '\0' || p[len] == ':'))
- {
- if (from_tty)
- printf ("\"%s\" is already in the source path.\n", name);
- break;
- }
- p = index (p, ':');
- if (p != 0)
- ++p;
- else
- break;
- }
- if (p == 0)
- {
- source_path = concat (old, ":", name);
- free (old);
- old = source_path;
- }
- }
- } while (*dirname != '\0');
- if (from_tty)
- directories_info ();
- }
-}
-
-/* Open a file named STRING, searching path PATH (dir names sep by colons)
- using mode MODE and protection bits PROT in the calls to open.
- If TRY_CWD_FIRST, try to open ./STRING before searching PATH.
- (ie pretend the first element of PATH is ".")
- If FILENAMED_OPENED is non-null, set it to a newly allocated string naming
- the actual file opened (this string will always start with a "/"
-
- If a file is found, return the descriptor.
- Otherwise, return -1, with errno set for the last name we tried to open. */
-
-/* >>>> This should only allow files of certain types,
- >>>> eg executable, non-directory */
-int
-openp (path, try_cwd_first, string, mode, prot, filename_opened)
- char *path;
- int try_cwd_first;
- char *string;
- int mode;
- int prot;
- char **filename_opened;
-{
- register int fd;
- register char *filename;
- register char *p, *p1;
- register int len;
-
- if (!path)
- path = ".";
-
- /* ./foo => foo */
- while (string[0] == '.' && string[1] == '/')
- string += 2;
-
- if (try_cwd_first || string[0] == '/')
- {
- filename = string;
- fd = open (filename, mode, prot);
- if (fd >= 0 || string[0] == '/')
- goto done;
- }
-
- filename = (char *) alloca (strlen (path) + strlen (string) + 2);
- fd = -1;
- for (p = path; p; p = p1 ? p1 + 1 : 0)
- {
- p1 = (char *) index (p, ':');
- if (p1)
- len = p1 - p;
- else
- len = strlen (p);
-
- strncpy (filename, p, len);
- filename[len] = 0;
- strcat (filename, "/");
- strcat (filename, string);
-
- fd = open (filename, mode, prot);
- if (fd >= 0) break;
- }
-
- done:
- if (filename_opened)
- if (fd < 0)
- *filename_opened = (char *) 0;
- else if (filename[0] == '/')
- *filename_opened = savestring (filename, strlen (filename));
- else
- {
- *filename_opened = concat (current_directory, "/", filename);
- }
-
- return fd;
-}
-
-/* Create and initialize the table S->line_charpos that records
- the positions of the lines in the source file, which is assumed
- to be open on descriptor DESC.
- All set S->nlines to the number of such lines. */
-
-static void
-find_source_lines (s, desc)
- struct symtab *s;
- int desc;
-{
- struct stat st;
- register char *data, *p, *end;
- int nlines = 0;
- int lines_allocated = 1000;
- int *line_charpos = (int *) xmalloc (lines_allocated * sizeof (int));
- extern int exec_mtime;
-
- if (fstat (desc, &st) < 0)
- perror_with_name (s->filename);
- if (get_exec_file (0) != 0 && exec_mtime < st.st_mtime)
- printf ("Source file is more recent than executable.\n");
-
- data = (char *) alloca (st.st_size);
- if (myread (desc, data, st.st_size) < 0)
- perror_with_name (s->filename);
- end = data + st.st_size;
- p = data;
- line_charpos[0] = 0;
- nlines = 1;
- while (p != end)
- {
- if (*p++ == '\n'
- /* A newline at the end does not start a new line. */
- && p != end)
- {
- if (nlines == lines_allocated)
- {
- lines_allocated *= 2;
- line_charpos = (int *) xrealloc (line_charpos,
- sizeof (int) * lines_allocated);
- }
- line_charpos[nlines++] = p - data;
- }
- }
- s->nlines = nlines;
- s->line_charpos = (int *) xrealloc (line_charpos, nlines * sizeof (int));
-}
-
-/* Return the character position of a line LINE in symtab S.
- Return 0 if anything is invalid. */
-
-int
-source_line_charpos (s, line)
- struct symtab *s;
- int line;
-{
- if (!s) return 0;
- if (!s->line_charpos || line <= 0) return 0;
- if (line > s->nlines)
- line = s->nlines;
- return s->line_charpos[line - 1];
-}
-
-/* Return the line number of character position POS in symtab S. */
-
-int
-source_charpos_line (s, chr)
- register struct symtab *s;
- register int chr;
-{
- register int line = 0;
- register int *lnp;
-
- if (s == 0 || s->line_charpos == 0) return 0;
- lnp = s->line_charpos;
- /* Files are usually short, so sequential search is Ok */
- while (line < s->nlines && *lnp <= chr)
- {
- line++;
- lnp++;
- }
- if (line >= s->nlines)
- line = s->nlines;
- return line;
-}
-
-/* Get full pathname and line number positions for a symtab.
- Return nonzero if line numbers may have changed.
- Set *FULLNAME to actual name of the file as found by `openp',
- or to 0 if the file is not found. */
-
-int
-get_filename_and_charpos (s, line, fullname)
- struct symtab *s;
- int line;
- char **fullname;
-{
- register int desc, linenums_changed = 0;
-
- desc = openp (source_path, 0, s->filename, O_RDONLY, 0, &s->fullname);
- if (desc < 0)
- {
- if (fullname)
- *fullname = NULL;
- return 0;
- }
- if (fullname)
- *fullname = s->fullname;
- if (s->line_charpos == 0) linenums_changed = 1;
- if (linenums_changed) find_source_lines (s, desc);
- close (desc);
- return linenums_changed;
-}
-
-/* Print text describing the full name of the source file S
- and the line number LINE and its corresponding character position.
- The text starts with two Ctrl-z so that the Emacs-GDB interface
- can easily find it.
-
- MID_STATEMENT is nonzero if the PC is not at the beginning of that line.
-
- Return 1 if successful, 0 if could not find the file. */
-
-int
-identify_source_line (s, line, mid_statement)
- struct symtab *s;
- int line;
- int mid_statement;
-{
- if (s->line_charpos == 0)
- get_filename_and_charpos (s, line, 0);
- if (s->fullname == 0)
- return 0;
- printf ("\032\032%s:%d:%d:%s:0x%x\n", s->fullname,
- line, s->line_charpos[line - 1],
- mid_statement ? "middle" : "beg",
- get_frame_pc (get_current_frame()));
- current_source_line = line;
- first_line_listed = line;
- last_line_listed = line;
- current_source_symtab = s;
- return 1;
-}
-
-/* Print source lines from the file of symtab S,
- starting with line number LINE and stopping before line number STOPLINE. */
-
-void
-print_source_lines (s, line, stopline, noerror)
- struct symtab *s;
- int line, stopline;
- int noerror;
-{
- register int c;
- register int desc;
- register FILE *stream;
- int nlines = stopline - line;
-
- desc = openp (source_path, 0, s->filename, O_RDONLY, 0, &s->fullname);
- if (desc < 0)
- {
- extern int errno;
- if (noerror && line + 1 == stopline)
- {
- /* can't find the file - tell user where we are anyway */
- current_source_symtab = s;
- current_source_line = line;
- first_line_listed = line;
- last_line_listed = line;
- printf_filtered ("%d\t(%s)\n", current_source_line++, s->filename);
- }
- else
- {
- if (! noerror)
- perror_with_name (s->filename);
- print_sys_errmsg (s->filename, errno);
- }
- return;
- }
-
- if (s->line_charpos == 0)
- find_source_lines (s, desc);
-
- if (line < 1 || line > s->nlines)
- {
- close (desc);
- error ("Line number %d out of range; %s has %d lines.",
- line, s->filename, s->nlines);
- }
-
- if (lseek (desc, s->line_charpos[line - 1], 0) < 0)
- {
- close (desc);
- perror_with_name (s->filename);
- }
-
- current_source_symtab = s;
- current_source_line = line;
- first_line_listed = line;
-
- stream = fdopen (desc, "r");
- clearerr (stream);
-
- while (nlines-- > 0)
- {
- c = fgetc (stream);
- if (c == EOF) break;
- last_line_listed = current_source_line;
- printf_filtered ("%d\t", current_source_line++);
- do
- {
- if (c < 040 && c != '\t' && c != '\n')
- printf_filtered ("^%c", c + 0100);
- else if (c == 0177)
- printf_filtered ("^?");
- else
- printf_filtered ("%c", c);
- } while (c != '\n' && (c = fgetc (stream)) >= 0);
- }
-
- fclose (stream);
-}
-
-
-
-/*
- C++
- Print a list of files and line numbers which a user may choose from
- in order to list a function which was specified ambiguously
- (as with `list classname::overloadedfuncname', for example).
- The vector in SALS provides the filenames and line numbers.
- */
-static void
-ambiguous_line_spec (sals)
- struct symtabs_and_lines *sals;
-{
- int i;
-
- for (i = 0; i < sals->nelts; ++i)
- printf("file: \"%s\", line number: %d\n",
- sals->sals[i].symtab->filename, sals->sals[i].line);
-}
-
-
-static void
-file_command(arg, from_tty)
- char *arg;
- int from_tty;
-{
- struct symtabs_and_lines sals;
- struct symtab_and_line sal;
- struct symbol *sym;
- char *arg1;
- int linenum_beg = 0;
- char *p;
-
- if (symtab_list == 0 && partial_symtab_list == 0)
- error ("No symbol table is loaded. Use the \"symbol-file\" command.");
-
- /* Pull in a current source symtab if necessary */
- if (arg == 0 || arg[0] == 0) {
- if (current_source_symtab == 0)
- select_source_symtab(0);
- else
- printf("%s\n", current_source_symtab->filename);
- return;
- }
- arg1 = arg;
- sals = decode_line_1 (&arg1, 0, 0, 0);
-
- if (! sals.nelts)
- return; /* C++ */
-
- if (sals.nelts > 1)
- {
- ambiguous_line_spec (&sals);
- free (sals.sals);
- return;
- }
-
- sal = sals.sals[0];
- free (sals.sals);
-
- /* Record whether the BEG arg is all digits. */
-
- for (p = arg; p != arg1 && *p >= '0' && *p <= '9'; ++p)
- ;
- linenum_beg = (p == arg1);
-
- /* if line was specified by address,
- print exactly which line, and which file.
- In this case, sal.symtab == 0 means address is outside
- of all known source files, not that user failed to give a filename. */
- if (*arg == '*')
- {
- if (sal.symtab == 0)
- error ("No source file for address 0x%x.", sal.pc);
- sym = find_pc_function (sal.pc);
- if (sym)
- printf ("0x%x is in %s (%s, line %d).\n",
- sal.pc, SYMBOL_NAME (sym), sal.symtab->filename, sal.line);
- else
- printf ("0x%x is in %s, line %d.\n",
- sal.pc, sal.symtab->filename, sal.line);
- }
-
- /* If line was not specified by just a line number,
- and it does not imply a symtab, it must be an undebuggable symbol
- which means no source code. */
-
- if (sal.symtab == 0)
- {
- if (! linenum_beg)
- error ("No line number known for %s.", arg);
- else
- error ("No default source file yet. Do \"help list\".");
- }
- else
- {
- current_source_symtab = sal.symtab;
- current_source_line = sal.line;
- first_line_listed = sal.line;
- }
-}
-
-#define PUSH_STACK_SIZE 32
-static struct {
- struct symtab *symtab;
- int line;
-} push_stack[PUSH_STACK_SIZE];
-
-static unsigned int push_stack_ptr;
-
-static void
-push_to_file_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- struct symtab *cursym = current_source_symtab;
- int curline = current_source_line;
- register unsigned int i;
-
- file_command(arg, from_tty);
-
- /* if we got back, command was successful */
- i = push_stack_ptr;
- push_stack[i].symtab = cursym;
- push_stack[i].line = curline;
- push_stack_ptr = (i + 1) & (PUSH_STACK_SIZE - 1);
-}
-
-static void
-pop_file_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- register unsigned int i = push_stack_ptr;
-
- /* if there's something on the stack, pop it & clear the slot. */
- i = (i + (PUSH_STACK_SIZE - 1)) & (PUSH_STACK_SIZE - 1);
- if (push_stack[i].symtab) {
- current_source_symtab = push_stack[i].symtab;
- first_line_listed = current_source_line = push_stack[i].line;
- push_stack[i].symtab = NULL;
- push_stack_ptr = i;
- }
-}
-
-
-static void
-list_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- struct symtabs_and_lines sals, sals_end;
- struct symtab_and_line sal, sal_end;
- struct symbol *sym;
- char *arg1;
- int no_end = 1;
- int dummy_end = 0;
- int dummy_beg = 0;
- int linenum_beg = 0;
- char *p;
-
- if (symtab_list == 0 && partial_symtab_list == 0)
- error ("No symbol table is loaded. Use the \"symbol-file\" command.");
-
- /* Pull in a current source symtab if necessary */
- if (current_source_symtab == 0 &&
- (arg == 0 || arg[0] == '+' || arg[0] == '-'))
- select_source_symtab (0);
-
- /* "l" or "l +" lists next ten lines. */
-
- if (arg == 0 || !strcmp (arg, "+"))
- {
- if (current_source_symtab == 0)
- error ("No default source file yet. Do \"help list\".");
- print_source_lines (current_source_symtab, current_source_line,
- current_source_line + 10, 0);
- return;
- }
-
- /* "l -" lists previous ten lines, the ones before the ten just listed. */
- if (!strcmp (arg, "-"))
- {
- if (current_source_symtab == 0)
- error ("No default source file yet. Do \"help list\".");
- print_source_lines (current_source_symtab,
- max (first_line_listed - 10, 1),
- first_line_listed, 0);
- return;
- }
-
- /* Now if there is only one argument, decode it in SAL
- and set NO_END.
- If there are two arguments, decode them in SAL and SAL_END
- and clear NO_END; however, if one of the arguments is blank,
- set DUMMY_BEG or DUMMY_END to record that fact. */
-
- arg1 = arg;
- if (*arg1 == ',')
- dummy_beg = 1;
- else
- {
- sals = decode_line_1 (&arg1, 0, 0, 0);
-
- if (! sals.nelts) return; /* C++ */
- if (sals.nelts > 1)
- {
- ambiguous_line_spec (&sals);
- free (sals.sals);
- return;
- }
-
- sal = sals.sals[0];
- free (sals.sals);
- }
-
- /* Record whether the BEG arg is all digits. */
-
- for (p = arg; p != arg1 && *p >= '0' && *p <= '9'; p++);
- linenum_beg = (p == arg1);
-
- while (*arg1 == ' ' || *arg1 == '\t')
- arg1++;
- if (*arg1 == ',')
- {
- no_end = 0;
- arg1++;
- while (*arg1 == ' ' || *arg1 == '\t')
- arg1++;
- if (*arg1 == 0)
- dummy_end = 1;
- else
- {
- if (dummy_beg)
- sals_end = decode_line_1 (&arg1, 0, 0, 0);
- else
- sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line);
- if (sals_end.nelts == 0)
- return;
- if (sals_end.nelts > 1)
- {
- ambiguous_line_spec (&sals_end);
- free (sals_end.sals);
- return;
- }
- sal_end = sals_end.sals[0];
- free (sals_end.sals);
- }
- }
-
- if (*arg1)
- error ("Junk at end of line specification.");
-
- if (!no_end && !dummy_beg && !dummy_end
- && sal.symtab != sal_end.symtab)
- error ("Specified start and end are in different files.");
- if (dummy_beg && dummy_end)
- error ("Two empty args do not say what lines to list.");
-
- /* if line was specified by address,
- first print exactly which line, and which file.
- In this case, sal.symtab == 0 means address is outside
- of all known source files, not that user failed to give a filename. */
- if (*arg == '*')
- {
- if (sal.symtab == 0)
- error ("No source file for address 0x%x.", sal.pc);
- sym = find_pc_function (sal.pc);
- if (sym)
- printf ("0x%x is in %s (%s, line %d).\n",
- sal.pc, SYMBOL_NAME (sym), sal.symtab->filename, sal.line);
- else
- printf ("0x%x is in %s, line %d.\n",
- sal.pc, sal.symtab->filename, sal.line);
- }
-
- /* If line was not specified by just a line number,
- and it does not imply a symtab, it must be an undebuggable symbol
- which means no source code. */
-
- if (! linenum_beg && sal.symtab == 0)
- error ("No line number known for %s.", arg);
-
- /* If this command is repeated with RET,
- turn it into the no-arg variant. */
-
- if (from_tty)
- *arg = 0;
-
- if (dummy_beg && sal_end.symtab == 0)
- error ("No default source file yet. Do \"help list\".");
- if (dummy_beg)
- print_source_lines (sal_end.symtab, max (sal_end.line - 9, 1),
- sal_end.line + 1, 0);
- else if (sal.symtab == 0)
- error ("No default source file yet. Do \"help list\".");
- else if (no_end)
- print_source_lines (sal.symtab, max (sal.line - 5, 1), sal.line + 5, 0);
- else
- print_source_lines (sal.symtab, sal.line,
- dummy_end ? sal.line + 10 : sal_end.line + 1,
- 0);
-}
-
-/* Print info on range of pc's in a specified line. */
-
-static void
-line_info (arg, from_tty)
- char *arg;
- int from_tty;
-{
- struct symtabs_and_lines sals;
- struct symtab_and_line sal;
- int start_pc, end_pc;
- int i;
-
- if (arg == 0)
- {
- sal.symtab = current_source_symtab;
- sal.line = last_line_listed;
- sals.nelts = 1;
- sals.sals = (struct symtab_and_line *)
- xmalloc (sizeof (struct symtab_and_line));
- sals.sals[0] = sal;
- }
- else
- {
- sals = decode_line_spec_1 (arg, 0);
-
- /* If this command is repeated with RET,
- turn it into the no-arg variant. */
- if (from_tty)
- *arg = 0;
- }
-
- /* C++ More than one line may have been specified, as when the user
- specifies an overloaded function name. Print info on them all. */
- for (i = 0; i < sals.nelts; i++)
- {
- sal = sals.sals[i];
-
- if (sal.symtab == 0)
- error ("No source file specified.");
-
- if (sal.line > 0
- && find_line_pc_range (sal.symtab, sal.line, &start_pc, &end_pc))
- {
- if (start_pc == end_pc)
- printf ("Line %d of \"%s\" is at pc 0x%x but contains no code.\n",
- sal.line, sal.symtab->filename, start_pc);
- else
- printf ("Line %d of \"%s\" starts at pc 0x%x and ends at 0x%x.\n",
- sal.line, sal.symtab->filename, start_pc, end_pc);
- /* x/i should display this line's code. */
- set_next_address (start_pc);
- /* Repeating "info line" should do the following line. */
- last_line_listed = sal.line + 1;
- }
- else
- printf ("Line number %d is out of range for \"%s\".\n",
- sal.line, sal.symtab->filename);
- }
-}
-
-/* Commands to search the source file for a regexp. */
-
-static void
-forward_search_command (regex, from_tty)
- char *regex;
-{
- register int c;
- register int desc;
- register FILE *stream;
- int line = last_line_listed + 1;
- char *msg;
-
- msg = (char *) re_comp (regex);
- if (msg)
- error (msg);
-
- if (current_source_symtab == 0)
- select_source_symtab (0);
-
- /* Search from last_line_listed+1 in current_source_symtab */
-
- desc = openp (source_path, 0, current_source_symtab->filename,
- O_RDONLY, 0, &current_source_symtab->fullname);
- if (desc < 0)
- perror_with_name (current_source_symtab->filename);
-
- if (current_source_symtab->line_charpos == 0)
- find_source_lines (current_source_symtab, desc);
-
- if (line < 1 || line > current_source_symtab->nlines)
- {
- close (desc);
- error ("Expression not found");
- }
-
- if (lseek (desc, current_source_symtab->line_charpos[line - 1], 0) < 0)
- {
- close (desc);
- perror_with_name (current_source_symtab->filename);
- }
-
- stream = fdopen (desc, "r");
- clearerr (stream);
- while (1) {
- char buf[4096]; /* Should be reasonable??? */
- register char *p = buf;
-
- c = fgetc (stream);
- if (c == EOF)
- break;
- do {
- *p++ = c;
- } while (c != '\n' && (c = fgetc (stream)) >= 0);
-
- /* we now have a source line in buf, null terminate and match */
- *p = 0;
- if (re_exec (buf) > 0)
- {
- /* Match! */
- fclose (stream);
- print_source_lines (current_source_symtab,
- line, line+1, 0);
- current_source_line = max (line - 5, 1);
- return;
- }
- line++;
- }
-
- printf ("Expression not found\n");
- fclose (stream);
-}
-
-static void
-reverse_search_command (regex, from_tty)
- char *regex;
-{
- register int c;
- register int desc;
- register FILE *stream;
- int line = last_line_listed - 1;
- char *msg;
-
- msg = (char *) re_comp (regex);
- if (msg)
- error (msg);
-
- if (current_source_symtab == 0)
- select_source_symtab (0);
-
- /* Search from last_line_listed-1 in current_source_symtab */
-
- desc = openp (source_path, 0, current_source_symtab->filename,
- O_RDONLY, 0, &current_source_symtab->fullname);
- if (desc < 0)
- perror_with_name (current_source_symtab->filename);
-
- if (current_source_symtab->line_charpos == 0)
- find_source_lines (current_source_symtab, desc);
-
- if (line < 1 || line > current_source_symtab->nlines)
- {
- close (desc);
- error ("Expression not found");
- }
-
- if (lseek (desc, current_source_symtab->line_charpos[line - 1], 0) < 0)
- {
- close (desc);
- perror_with_name (current_source_symtab->filename);
- }
-
- stream = fdopen (desc, "r");
- clearerr (stream);
- while (1)
- {
- char buf[4096]; /* Should be reasonable??? */
- register char *p = buf;
-
- c = fgetc (stream);
- if (c == EOF)
- break;
- do {
- *p++ = c;
- } while (c != '\n' && (c = fgetc (stream)) >= 0);
-
- /* We now have a source line in buf; null terminate and match. */
- *p = 0;
- if (re_exec (buf) > 0)
- {
- /* Match! */
- fclose (stream);
- print_source_lines (current_source_symtab,
- line, line+1, 0);
- current_source_line = max (line - 5, 1);
- return;
- }
- line--;
- if (fseek (stream, current_source_symtab->line_charpos[line - 1], 0) < 0)
- {
- fclose (stream);
- perror_with_name (current_source_symtab->filename);
- }
- }
-
- printf ("Expression not found\n");
- fclose (stream);
- return;
-}
-
-void
-_initialize_source ()
-{
- current_source_symtab = 0;
- init_source_path ();
-
- add_com ("directory", class_files, directory_command,
- "Add directory DIR to end of search path for source files.\n\
-With no argument, reset the search path to just the working directory\n\
-and forget cached info on line positions in source files.");
-
- add_info ("directories", directories_info,
- "Current search path for finding source files.");
-
- add_info ("line", line_info,
- "Core addresses of the code for a source line.\n\
-Line can be specified as\n\
- LINENUM, to list around that line in current file,\n\
- FILE:LINENUM, to list around that line in that file,\n\
- FUNCTION, to list around beginning of that function,\n\
- FILE:FUNCTION, to distinguish among like-named static functions.\n\
-Default is to describe the last source line that was listed.\n\n\
-This sets the default address for \"x\" to the line's first instruction\n\
-so that \"x/i\" suffices to start examining the machine code.\n\
-The address is also stored as the value of \"$_\".");
-
- add_com ("forward-search", class_files, forward_search_command,
- "Search for regular expression (see regex(3)) from last line listed.");
- add_com_alias ("search", "forward-search", class_files, 0);
-
- add_com ("reverse-search", class_files, reverse_search_command,
- "Search backward for regular expression (see regex(3)) from last line listed.");
-
- add_com ("list", class_files, list_command,
- "List specified function or line.\n\
-With no argument, lists ten more lines after or around previous listing.\n\
-\"list -\" lists the ten lines before a previous ten-line listing.\n\
-One argument specifies a line, and ten lines are listed around that line.\n\
-Two arguments with comma between specify starting and ending lines to list.\n\
-Lines can be specified in these ways:\n\
- LINENUM, to list around that line in current file,\n\
- FILE:LINENUM, to list around that line in that file,\n\
- FUNCTION, to list around beginning of that function,\n\
- FILE:FUNCTION, to distinguish among like-named static functions.\n\
- *ADDRESS, to list around the line containing that address.\n\
-With two args if one is empty it stands for ten lines away from the other arg.");
- add_com ("file", class_files, file_command,
- "Select current file, function and line for display or list.\n\
-Specification can have the form:\n\
- LINENUM, to select that line in current file,\n\
- FILE:LINENUM, to select that line in that file,\n\
- FUNCTION, to select beginning of that function,\n\
- FILE:FUNCTION, to distinguish among like-named static functions.\n\
- *ADDRESS, to select the line containing that address.");
- add_com ("push-to-file", class_files, push_to_file_command,
- "Like \"file\" command but remembers current file & line on a stack.\n\
-Can later return to current file with \"pop-file\" command.\n\
-Up to 32 file positions can be pushed on stack.");
- add_com ("pop-file", class_files, pop_file_command,
- "Pops back to file position saved by most recent \"push-to-file\".\n\
-If everything has been popped from stack, command does nothing.");
-}
-
diff --git a/gnu/usr.bin/gdb/stab.def b/gnu/usr.bin/gdb/stab.def
deleted file mode 100644
index b81cda4..0000000
--- a/gnu/usr.bin/gdb/stab.def
+++ /dev/null
@@ -1,115 +0,0 @@
-/* Table of DBX symbol codes for the GNU system.
- 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. */
-
-/* Global variable. Only the name is significant.
- To find the address, look in the corresponding external symbol. */
-__define_stab (N_GSYM, 0x20, "GSYM")
-
-/* Function name for BSD Fortran. Only the name is significant.
- To find the address, look in the corresponding external symbol. */
-__define_stab (N_FNAME, 0x22, "FNAME")
-
-/* Function name or text-segment variable for C. Value is its address.
- Desc is supposedly starting line number, but GCC doesn't set it
- and DBX seems not to miss it. */
-__define_stab (N_FUN, 0x24, "FUN")
-
-/* Data-segment variable with internal linkage. Value is its address. */
-__define_stab (N_STSYM, 0x26, "STSYM")
-
-/* BSS-segment variable with internal linkage. Value is its address. */
-__define_stab (N_LCSYM, 0x28, "LCSYM")
-
-/* Name of main routine. Only the name is significant.
- This is not used in C. */
-__define_stab (N_MAIN, 0x2a, "MAIN")
-
-/* Register variable. Value is number of register. */
-__define_stab (N_RSYM, 0x40, "RSYM")
-
-/* Structure or union element. Value is offset in the structure. */
-__define_stab (N_SSYM, 0x60, "SSYM")
-
-/* Parameter variable. Value is offset from argument pointer.
- (On most machines the argument pointer is the same as the frame pointer. */
-__define_stab (N_PSYM, 0xa0, "PSYM")
-
-/* Automatic variable in the stack. Value is offset from frame pointer.
- Also used for type descriptions. */
-__define_stab (N_LSYM, 0x80, "LSYM")
-
-/* Alternate entry point. Value is its address. */
-__define_stab (N_ENTRY, 0xa4, "ENTRY")
-
-/* Name of main source file.
- Value is starting text address of the compilation. */
-__define_stab (N_SO, 0x64, "SO")
-
-/* Name of sub-source file.
- Value is starting text address of the compilation. */
-__define_stab (N_SOL, 0x84, "SOL")
-
-/* Line number in text segment. Desc is the line number;
- value is corresponding address. */
-__define_stab (N_SLINE, 0x44, "SLINE")
-/* Similar, for data segment. */
-__define_stab (N_DSLINE, 0x46, "DSLINE")
-/* Similar, for bss segment. */
-__define_stab (N_BSLINE, 0x48, "BSLINE")
-
-/* Beginning of an include file. Only Sun uses this.
- In an object file, only the name is significant.
- The Sun linker puts data into some of the other fields. */
-__define_stab (N_BINCL, 0x82, "BINCL")
-/* End of an include file. No name.
- These two act as brackets around the file's output.
- In an object file, there is no significant data in this entry.
- The Sun linker puts data into some of the fields. */
-__define_stab (N_EINCL, 0xa2, "EINCL")
-/* Place holder for deleted include file.
- This appears only in output from the Sun linker. */
-__define_stab (N_EXCL, 0xc2, "EXCL")
-
-/* Beginning of lexical block.
- The desc is the nesting level in lexical blocks.
- The value is the address of the start of the text for the block.
- The variables declared inside the block *precede* the N_LBRAC symbol. */
-__define_stab (N_LBRAC, 0xc0, "LBRAC")
-/* End of a lexical block. Desc matches the N_LBRAC's desc.
- The value is the address of the end of the text for the block. */
-__define_stab (N_RBRAC, 0xe0, "RBRAC")
-
-/* Begin named common block. Only the name is significant. */
-__define_stab (N_BCOMM, 0xe2, "BCOMM")
-/* Begin named common block. Only the name is significant
- (and it should match the N_BCOMM). */
-__define_stab (N_ECOMM, 0xe4, "ECOMM")
-/* End common (local name): value is address.
- I'm not sure how this is used. */
-__define_stab (N_ECOML, 0xe8, "ECOML")
-/* Second symbol entry containing a length-value for the preceding entry.
- The value is the length. */
-__define_stab (N_LENG, 0xfe, "LENG")
-
-/* Global symbol in Pascal.
- Supposedly the value is its line number; I'm skeptical. */
-__define_stab (N_PC, 0x30, "PC")
-
-/* Modula-2 compilation unit. Can someone say what info it contains? */
-__define_stab (N_M2C, 0x42, "M2C")
-/* Modula-2 scope information. Can someone say what info it contains? */
-__define_stab (N_SCOPE, 0xc4, "SCOPE")
diff --git a/gnu/usr.bin/gdb/stack.c b/gnu/usr.bin/gdb/stack.c
deleted file mode 100644
index 91218aa..0000000
--- a/gnu/usr.bin/gdb/stack.c
+++ /dev/null
@@ -1,960 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)stack.c 6.3 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* Print and select stack frames for GDB, the GNU debugger.
- Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* modified by rjc Thu Nov 1 16:46:57 1990, fixed return_command so that
- it can return values, it still has problems when running on pmax,
- cannot write register 65 */
-
-#include <stdio.h>
-
-#include "defs.h"
-#include "param.h"
-#include "symtab.h"
-#include "frame.h"
-#include "value.h"
-
-
-/* Thie "selected" stack frame is used by default for local and arg access.
- May be zero, for no selected frame. */
-
-FRAME selected_frame;
-
-/* Level of the selected frame:
- 0 for innermost, 1 for its caller, ...
- or -1 for frame specified by address with no defined level. */
-
-int selected_frame_level;
-
-/* Nonzero means print the full filename and linenumber
- when a frame is printed, and do so in a format programs can parse. */
-
-int frame_file_full_name = 0;
-
-static void select_calling_frame ();
-
-void print_frame_info ();
-
-/* Print a stack frame briefly. FRAME should be the frame id
- and LEVEL should be its level in the stack (or -1 for level not defined).
- This prints the level, the function executing, the arguments,
- and the file name and line number.
- If the pc is not at the beginning of the source line,
- the actual pc is printed at the beginning.
-
- If SOURCE is 1, print the source line as well.
- If SOURCE is -1, print ONLY the source line. */
-
-static void
-print_stack_frame (frame, level, source)
- FRAME frame;
- int level;
- int source;
-{
- struct frame_info *fi;
-
- fi = get_frame_info (frame);
-
- print_frame_info (fi, level, source, 1);
-}
-
-/* Flag which will indicate when the frame has been changed
- by and "up" or "down" command. */
-static int frame_changed;
-
-void
-print_frame_info (fi, level, source, args)
- struct frame_info *fi;
- register int level;
- int source;
- int args;
-{
- struct symtab_and_line sal;
- struct symbol *func;
- register char *funname = 0;
- int numargs;
- struct partial_symtab *pst;
-
- /* Don't give very much information if we haven't readin the
- symbol table yet. */
- pst = find_pc_psymtab (fi->pc);
- if (pst && !pst->readin)
- {
- /* Abbreviated information. */
- char *fname;
-
- if (!find_pc_partial_function (fi->pc, &fname, 0))
- fname = "??";
-
- printf_filtered ("#%-2d ", level);
- printf_filtered ("0x%x in ", fi->pc);
-
- fputs_demangled(fname, stdout, -1);
- fputs_filtered(" (...)\n", stdout);
-
- return;
- }
-
- sal = find_pc_line (fi->pc, fi->next_frame);
- func = find_pc_function (fi->pc);
- if (func)
- {
- /* In certain pathological cases, the symtabs give the wrong
- function (when we are in the first function in a file which
- is compiled without debugging symbols, the previous function
- is compiled with debugging symbols, and the "foo.o" symbol
- that is supposed to tell us where the file with debugging symbols
- ends has been truncated by ar because it is longer than 15
- characters).
-
- So look in the misc_function_vector as well, and if it comes
- up with a larger address for the function use that instead.
- I don't think this can ever cause any problems;
- there shouldn't be any
- misc_function_vector symbols in the middle of a function. */
- int misc_index = find_pc_misc_function (fi->pc);
- if (misc_index >= 0
- && (misc_function_vector[misc_index].address
- > BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
- {
- /* In this case we have no way of knowing the source file
- and line number, so don't print them. */
- sal.symtab = 0;
- /* We also don't know anything about the function besides
- its address and name. */
- func = 0;
- funname = misc_function_vector[misc_index].name;
- }
- else
- funname = SYMBOL_NAME (func);
- }
- else
- {
- register int misc_index = find_pc_misc_function (fi->pc);
- if (misc_index >= 0)
- funname = misc_function_vector[misc_index].name;
- }
-
- if (frame_changed || source >= 0 || !sal.symtab)
- {
- if (level >= 0)
- printf_filtered ("#%-2d ", level);
- else if (frame_changed)
- printf ("#%-2d ", 0);
- if (fi->pc != sal.pc || !sal.symtab)
- printf_filtered ("0x%x in ", fi->pc);
- fputs_demangled(funname ? funname : "??", stdout, -1);
- printf_filtered(" (");
- if (args)
- {
- if (func)
- numargs = -1;
- else
- FRAME_NUM_ARGS (numargs, fi);
-
- print_frame_args (func, fi, numargs, stdout);
- }
- printf_filtered (")");
- if (sal.symtab)
- printf_filtered (" (%s line %d)", sal.symtab->filename, sal.line);
- printf_filtered ("\n");
- }
-
- if ((frame_changed || source != 0) && sal.symtab)
- {
- int done = 0;
- int mid_statement = source < 0 && fi->pc != sal.pc;
- if (frame_file_full_name)
- done = identify_source_line (sal.symtab, sal.line, mid_statement);
- if (!done)
- {
- if (mid_statement)
- printf_filtered ("0x%x\t", fi->pc);
- print_source_lines (sal.symtab, sal.line, sal.line + 1, 1);
- }
- current_source_line = max (sal.line - 5, 1);
- }
- frame_changed = 0;
- if (source != 0)
- set_default_breakpoint (1, fi->pc, sal.symtab, sal.line);
-
- fflush (stdout);
-}
-
-/* Call here to print info on selected frame, after a trap. */
-
-void
-print_sel_frame (just_source)
- int just_source;
-{
- print_stack_frame (selected_frame, -1, just_source ? -1 : 1);
-}
-
-/* Print info on the selected frame, including level number
- but not source. */
-
-void
-print_selected_frame ()
-{
- print_stack_frame (selected_frame, selected_frame_level, 0);
-}
-
-void flush_cached_frames ();
-
-#ifdef FRAME_SPECIFICATION_DYADIC
-extern FRAME setup_arbitrary_frame ();
-#endif
-
-/*
- * Read a frame specification in whatever the appropriate format is.
- */
-static FRAME
-parse_frame_specification (frame_exp)
- char *frame_exp;
-{
- int numargs = 0;
- int arg1, arg2;
-
- if (frame_exp)
- {
- char *addr_string, *p;
- struct cleanup *tmp_cleanup;
- struct frame_info *fci;
-
- while (*frame_exp == ' ') frame_exp++;
- for (p = frame_exp; *p && *p != ' '; p++)
- ;
-
- if (*frame_exp)
- {
- numargs = 1;
- addr_string = savestring(frame_exp, p - frame_exp);
-
- {
- tmp_cleanup = make_cleanup (free, addr_string);
- arg1 = parse_and_eval_address (addr_string);
- do_cleanups (tmp_cleanup);
- }
-
- while (*p == ' ') p++;
-
- if (*p)
- {
- numargs = 2;
- arg2 = parse_and_eval_address (p);
- }
- }
- }
-
- switch (numargs)
- {
- case 0:
- return selected_frame;
- /* NOTREACHED */
- case 1:
- {
- int level = arg1;
- FRAME fid = find_relative_frame (get_current_frame (), &level);
- FRAME tfid;
-
- if (level == 0)
- /* find_relative_frame was successful */
- return fid;
-
- /* If (s)he specifies the frame with an address, he deserves what
- (s)he gets. Still, give the highest one that matches. */
-
- for (fid = get_current_frame ();
- fid && FRAME_FP (fid) != arg1;
- fid = get_prev_frame (fid))
- ;
-
- if (fid)
- while ((tfid = get_prev_frame (fid)) &&
- (FRAME_FP (tfid) == arg1))
- fid = tfid;
-
-#ifdef FRAME_SPECIFICATION_DYADIC
- if (!fid)
- error ("Incorrect number of args in frame specification");
-
- return fid;
-#else
- return create_new_frame (arg1, 0);
-#endif
- }
- /* NOTREACHED */
- case 2:
- /* Must be addresses */
-#ifndef FRAME_SPECIFICATION_DYADIC
- error ("Incorrect number of args in frame specification");
-#else
- return setup_arbitrary_frame (arg1, arg2);
-#endif
- /* NOTREACHED */
- }
- fatal ("Internal: Error in parsing in parse_frame_specification");
- /* NOTREACHED */
-}
-
-/* FRAME_ARGS_ADDRESS_CORRECT is just like FRAME_ARGS_ADDRESS except
- that if it is unsure about the answer, it returns Frame_unknown
- instead of guessing (this happens on the VAX, for example).
-
- On most machines, we never have to guess about the args address,
- so FRAME_ARGS_ADDRESS{,_CORRECT} are the same. */
-#if !defined (FRAME_ARGS_ADDRESS_CORRECT)
-#define FRAME_ARGS_ADDRESS_CORRECT FRAME_ARGS_ADDRESS
-#endif
-
-/* Print verbosely the selected frame or the frame at address ADDR.
- This means absolutely all information in the frame is printed. */
-
-static void
-frame_info (addr_exp)
- char *addr_exp;
-{
- FRAME frame;
- struct frame_info *fi;
- struct frame_saved_regs fsr;
- struct symtab_and_line sal;
- struct symbol *func;
- FRAME calling_frame;
- int i, count;
- char *funname = 0;
-
- if (!(have_inferior_p () || have_core_file_p ()))
- error ("No inferior or core file.");
-
- frame = parse_frame_specification (addr_exp);
- if (!frame)
- error ("Invalid frame specified.");
-
- fi = get_frame_info (frame);
- get_frame_saved_regs (fi, &fsr);
- sal = find_pc_line (fi->pc, fi->next_frame);
- func = get_frame_function (frame);
- if (func)
- funname = SYMBOL_NAME (func);
- else
- {
- register int misc_index = find_pc_misc_function (fi->pc);
- if (misc_index >= 0)
- funname = misc_function_vector[misc_index].name;
- }
- calling_frame = get_prev_frame (frame);
-
- if (!addr_exp && selected_frame_level >= 0)
- printf ("Stack level %d, frame at 0x%x:\n pc = 0x%x",
- selected_frame_level, FRAME_FP(frame), fi->pc);
- else
- printf ("Stack frame at 0x%x:\n pc = 0x%x",
- FRAME_FP(frame), fi->pc);
-
- if (funname)
- printf (" in %s", funname);
- if (sal.symtab)
- printf (" (%s line %d)", sal.symtab->filename, sal.line);
- printf ("; saved pc 0x%x\n", FRAME_SAVED_PC (frame));
- if (calling_frame)
- printf (" called by frame at 0x%x", FRAME_FP (calling_frame));
- if (fi->next_frame && calling_frame)
- printf (",");
- if (fi->next_frame)
- printf (" caller of frame at 0x%x", fi->next_frame);
- if (fi->next_frame || calling_frame)
- printf ("\n");
-
- {
- /* Address of the argument list for this frame, or Frame_unknown. */
- CORE_ADDR arg_list = FRAME_ARGS_ADDRESS_CORRECT (fi);
- /* Number of args for this frame, or -1 if unknown. */
- int numargs;
-
- if (arg_list != Frame_unknown)
- {
- printf (" Arglist at 0x%x,", arg_list);
-
- FRAME_NUM_ARGS (numargs, fi);
- if (numargs < 0)
- printf (" args: ");
- else if (numargs == 0)
- printf (" no args.");
- else if (numargs == 1)
- printf (" 1 arg: ");
- else
- printf (" %d args: ", numargs);
- print_frame_args (func, fi, numargs, stdout);
- printf ("\n");
- }
- }
-
- /* The sp is special; what's returned isn't the save address, but
- actually the value of the previous frame's sp. */
- printf (" Previous frame's sp is 0x%x\n", fsr.regs[SP_REGNUM]);
- count = 0;
- for (i = 0; i < NUM_REGS; i++)
- if (fsr.regs[i] && i != SP_REGNUM)
- {
- if (count % 4 != 0)
- printf (", ");
- else
- {
- if (count == 0)
- printf (" Saved registers:");
- printf ("\n ");
- }
- printf ("%s at 0x%x", reg_names[i], fsr.regs[i]);
- count++;
- }
- if (count)
- printf ("\n");
-}
-
-#if 0
-/* Set a limit on the number of frames printed by default in a
- backtrace. */
-
-static int backtrace_limit;
-
-static void
-set_backtrace_limit_command (count_exp, from_tty)
- char *count_exp;
- int from_tty;
-{
- int count = parse_and_eval_address (count_exp);
-
- if (count < 0)
- error ("Negative argument not meaningful as backtrace limit.");
-
- backtrace_limit = count;
-}
-
-static void
-backtrace_limit_info (arg, from_tty)
- char *arg;
- int from_tty;
-{
- if (arg)
- error ("\"Info backtrace-limit\" takes no arguments.");
-
- printf ("Backtrace limit: %d.\n", backtrace_limit);
-}
-#endif
-
-/* Print briefly all stack frames or just the innermost COUNT frames. */
-
-static void
-backtrace_command (count_exp)
- char *count_exp;
-{
- struct frame_info *fi;
- register int count;
- register FRAME frame;
- register int i;
- register FRAME trailing;
- register int trailing_level;
-
- /* The following code must do two things. First, it must
- set the variable TRAILING to the frame from which we should start
- printing. Second, it must set the variable count to the number
- of frames which we should print, or -1 if all of them. */
- trailing = get_current_frame ();
- trailing_level = 0;
- if (count_exp)
- {
- count = parse_and_eval_address (count_exp);
- if (count < 0)
- {
- FRAME current;
-
- count = -count;
-
- current = trailing;
- while (current && count--)
- current = get_prev_frame (current);
-
- /* Will stop when CURRENT reaches the top of the stack. TRAILING
- will be COUNT below it. */
- while (current)
- {
- trailing = get_prev_frame (trailing);
- current = get_prev_frame (current);
- trailing_level++;
- }
-
- count = -1;
- }
- }
- else
- count = -1;
-
- for (i = 0, frame = trailing;
- frame && count--;
- i++, frame = get_prev_frame (frame))
- {
- QUIT;
- fi = get_frame_info (frame);
- print_frame_info (fi, trailing_level + i, 0, 1);
- }
-
- /* If we've stopped before the end, mention that. */
- if (frame)
- printf_filtered ("(More stack frames follow...)\n");
-}
-
-/* Print the local variables of a block B active in FRAME.
- Return 1 if any variables were printed; 0 otherwise. */
-
-static int
-print_block_frame_locals (b, frame, stream)
- struct block *b;
- register FRAME frame;
- register FILE *stream;
-{
- int nsyms;
- register int i;
- register struct symbol *sym;
- register int values_printed = 0;
-
- nsyms = BLOCK_NSYMS (b);
-
- for (i = 0; i < nsyms; i++)
- {
- sym = BLOCK_SYM (b, i);
- if (SYMBOL_CLASS (sym) == LOC_LOCAL
- || SYMBOL_CLASS (sym) == LOC_REGISTER
- || SYMBOL_CLASS (sym) == LOC_STATIC)
- {
- values_printed = 1;
- fputs_filtered (SYMBOL_NAME (sym), stream);
- fputs_filtered (" = ", stream);
- print_variable_value (sym, frame, stream);
- fprintf_filtered (stream, "\n");
- fflush (stream);
- }
- }
- return values_printed;
-}
-
-/* Print on STREAM all the local variables in frame FRAME,
- including all the blocks active in that frame
- at its current pc.
-
- Returns 1 if the job was done,
- or 0 if nothing was printed because we have no info
- on the function running in FRAME. */
-
-static int
-print_frame_local_vars (frame, stream)
- register FRAME frame;
- register FILE *stream;
-{
- register struct block *block = get_frame_block (frame);
- register int values_printed = 0;
-
- if (block == 0)
- {
- fprintf_filtered (stream, "No symbol table info available.\n");
- fflush (stream);
- return 0;
- }
-
- while (block != 0)
- {
- if (print_block_frame_locals (block, frame, stream))
- values_printed = 1;
- /* After handling the function's top-level block, stop.
- Don't continue to its superblock, the block of
- per-file symbols. */
- if (BLOCK_FUNCTION (block))
- break;
- block = BLOCK_SUPERBLOCK (block);
- }
-
- if (!values_printed)
- {
- fprintf_filtered (stream, "No locals.\n");
- fflush (stream);
- }
-
- return 1;
-}
-
-static void
-locals_info ()
-{
- if (!have_inferior_p () && !have_core_file_p ())
- error ("No inferior or core file.");
-
- print_frame_local_vars (selected_frame, stdout);
-}
-
-static int
-print_frame_arg_vars (frame, stream)
- register FRAME frame;
- register FILE *stream;
-{
- struct symbol *func = get_frame_function (frame);
- register struct block *b;
- int nsyms;
- register int i;
- register struct symbol *sym;
- register int values_printed = 0;
-
- if (func == 0)
- {
- fprintf_filtered (stream, "No symbol table info available.\n");
- fflush (stream);
- return 0;
- }
-
- b = SYMBOL_BLOCK_VALUE (func);
- nsyms = BLOCK_NSYMS (b);
-
- for (i = 0; i < nsyms; i++)
- {
- sym = BLOCK_SYM (b, i);
- if (SYMBOL_CLASS (sym) == LOC_ARG
- || SYMBOL_CLASS (sym) == LOC_REF_ARG
- || SYMBOL_CLASS (sym) == LOC_REGPARM)
- {
- values_printed = 1;
- fputs_filtered (SYMBOL_NAME (sym), stream);
- fputs_filtered (" = ", stream);
- print_variable_value (sym, frame, stream);
- fprintf_filtered (stream, "\n");
- fflush (stream);
- }
- }
-
- if (!values_printed)
- {
- fprintf_filtered (stream, "No arguments.\n");
- fflush (stream);
- }
-
- return 1;
-}
-
-static void
-args_info ()
-{
- if (!have_inferior_p () && !have_core_file_p ())
- error ("No inferior or core file.");
- print_frame_arg_vars (selected_frame, stdout);
-}
-
-/* Select frame FRAME, and note that its stack level is LEVEL.
- LEVEL may be -1 if an actual level number is not known. */
-
-void
-select_frame (frame, level)
- FRAME frame;
- int level;
-{
- selected_frame = frame;
- selected_frame_level = level;
- /* Ensure that symbols for this frame are readin. */
- if (frame)
- find_pc_symtab (get_frame_info (frame)->pc);
-}
-
-/* Store the selected frame and its level into *FRAMEP and *LEVELP. */
-
-void
-record_selected_frame (frameaddrp, levelp)
- FRAME_ADDR *frameaddrp;
- int *levelp;
-{
- *frameaddrp = FRAME_FP (selected_frame);
- *levelp = selected_frame_level;
-}
-
-/* Return the symbol-block in which the selected frame is executing.
- Can return zero under various legitimate circumstances. */
-
-struct block *
-get_selected_block ()
-{
- if (!have_inferior_p () && !have_core_file_p ())
- return 0;
-
- if (!selected_frame)
- return get_current_block ();
- return get_frame_block (selected_frame);
-}
-
-/* Find a frame a certain number of levels away from FRAME.
- LEVEL_OFFSET_PTR points to an int containing the number of levels.
- Positive means go to earlier frames (up); negative, the reverse.
- The int that contains the number of levels is counted toward
- zero as the frames for those levels are found.
- If the top or bottom frame is reached, that frame is returned,
- but the final value of *LEVEL_OFFSET_PTR is nonzero and indicates
- how much farther the original request asked to go. */
-
-FRAME
-find_relative_frame (frame, level_offset_ptr)
- register FRAME frame;
- register int* level_offset_ptr;
-{
- register FRAME prev;
- register FRAME frame1, frame2;
-
- /* Going up is simple: just do get_prev_frame enough times
- or until initial frame is reached. */
- while (*level_offset_ptr > 0)
- {
- prev = get_prev_frame (frame);
- if (prev == 0)
- break;
- (*level_offset_ptr)--;
- frame = prev;
- }
- /* Going down could be done by iterating get_frame_info to
- find the next frame, but that would be quadratic
- since get_frame_info must scan all the way from the current frame.
- The following algorithm is linear. */
- if (*level_offset_ptr < 0)
- {
- /* First put frame1 at innermost frame
- and frame2 N levels up from there. */
- frame1 = get_current_frame ();
- frame2 = frame1;
- while (*level_offset_ptr < 0 && frame2 != frame)
- {
- frame2 = get_prev_frame (frame2);
- (*level_offset_ptr) ++;
- }
- /* Then slide frame1 and frame2 up in synchrony
- and when frame2 reaches our starting point
- frame1 must be N levels down from there. */
- while (frame2 != frame)
- {
- frame1 = get_prev_frame (frame1);
- frame2 = get_prev_frame (frame2);
- }
- return frame1;
- }
- return frame;
-}
-
-/* The "frame" command. With no arg, print selected frame briefly.
- With arg LEVEL_EXP, select the frame at level LEVEL if it is a
- valid level. Otherwise, treat level_exp as an address expression
- and print it. See parse_frame_specification for more info on proper
- frame expressions. */
-
-static void
-frame_command (level_exp, from_tty)
- char *level_exp;
- int from_tty;
-{
- register FRAME frame, frame1;
- unsigned int level = 0;
-
- if (!have_inferior_p () && ! have_core_file_p ())
- error ("No inferior or core file.");
-
- frame = parse_frame_specification (level_exp);
-
- for (frame1 = get_prev_frame (0);
- frame1 && frame1 != frame;
- frame1 = get_prev_frame (frame1))
- level++;
-
- if (!frame1)
- level = 0;
-
- frame_changed = level;
- select_frame (frame, level);
-
- if (!from_tty)
- return;
-
- print_stack_frame (selected_frame, selected_frame_level, 1);
-}
-
-/* Select the frame up one or COUNT stack levels
- from the previously selected frame, and print it briefly. */
-
-static void
-up_command (count_exp)
- char *count_exp;
-{
- register FRAME frame;
- int count = 1, count1;
- if (count_exp)
- count = parse_and_eval_address (count_exp);
- count1 = count;
-
- if (!have_inferior_p () && !have_core_file_p ())
- error ("No inferior or core file.");
-
- frame = find_relative_frame (selected_frame, &count1);
- if (count1 != 0 && count_exp == 0)
- error ("Initial frame selected; you cannot go up.");
- select_frame (frame, selected_frame_level + count - count1);
-
- print_stack_frame (selected_frame, selected_frame_level, 1);
- frame_changed++;
-}
-
-/* Select the frame down one or COUNT stack levels
- from the previously selected frame, and print it briefly. */
-
-static void
-down_command (count_exp)
- char *count_exp;
-{
- register FRAME frame;
- int count = -1, count1;
- if (count_exp)
- count = - parse_and_eval_address (count_exp);
- count1 = count;
-
- frame = find_relative_frame (selected_frame, &count1);
- if (count1 != 0 && count_exp == 0)
- error ("Bottom (i.e., innermost) frame selected; you cannot go down.");
- select_frame (frame, selected_frame_level + count - count1);
-
- print_stack_frame (selected_frame, selected_frame_level, 1);
- frame_changed--;
-}
-
-static void
-return_command (retval_exp, from_tty)
- char *retval_exp;
- int from_tty;
-{
- value return_value;
- struct symbol *thisfun = get_frame_function (selected_frame);
- FRAME_ADDR selected_frame_addr = FRAME_FP (selected_frame);
-
- /* If interactive, require confirmation. */
-
- if (from_tty)
- {
- if (thisfun != 0)
- {
- if (!query ("Make %s return now? ", SYMBOL_NAME (thisfun)))
- error ("Not confirmed.");
- }
- else
- if (!query ("Make selected stack frame return now? "))
- error ("Not confirmed.");
- }
-
- /* Do the real work. Pop until the specified frame is current. We
- use this method because the selected_frame is not valid after
- a POP_FRAME. Note that this will not work if the selected frame
- shares it's fp with another frame. */
-
- while (selected_frame_addr != FRAME_FP (get_current_frame()))
- POP_FRAME;
-
- /* get the return value while still in this frame */
- if (retval_exp)
- return_value = parse_and_eval (retval_exp);
-
- /* Then pop that frame. */
- POP_FRAME;
-
- /* Store the return value if there was one */
-
- if (retval_exp)
- set_return_value (return_value);
-
- /* If interactive, print the frame that is now current. */
-
- if (from_tty)
- frame_command ("0", 1);
-}
-
-extern struct cmd_list_element *setlist;
-
-void
-_initialize_stack ()
-{
-#if 0
- backtrace_limit = 30;
-#endif
-
- add_com ("return", class_stack, return_command,
- "Make selected stack frame return to its caller.\n\
-Control remains in the debugger, but when you continue\n\
-execution will resume in the frame above the one now selected.\n\
-If an argument is given, it is an expression for the value to return.");
-
- add_com ("up", class_stack, up_command,
- "Select and print stack frame that called this one.\n\
-An argument says how many frames up to go.");
-
- add_com ("down", class_stack, down_command,
- "Select and print stack frame called by this one.\n\
-An argument says how many frames down to go.");
- add_com_alias ("do", "down", class_stack, 1);
-
- add_com ("frame", class_stack, frame_command,
- "Select and print a stack frame.\n\
-With no argument, print the selected stack frame. (See also \"info frame\").\n\
-An argument specifies the frame to select.\n\
-It can be a stack frame number or the address of the frame.\n\
-With argument, nothing is printed if input is coming from\n\
-a command file or a user-defined command.");
-
- add_com_alias ("f", "frame", class_stack, 1);
-
- add_com ("backtrace", class_stack, backtrace_command,
- "Print backtrace of all stack frames, or innermost COUNT frames.\n\
-With a negative argument, print outermost -COUNT frames.");
- add_com_alias ("bt", "backtrace", class_stack, 0);
- add_com_alias ("where", "backtrace", class_alias, 0);
- add_info ("stack", backtrace_command,
- "Backtrace of the stack, or innermost COUNT frames.");
- add_info_alias ("s", "stack", 1);
- add_info ("frame", frame_info,
- "All about selected stack frame, or frame at ADDR.");
- add_info_alias ("f", "frame", 1);
- add_info ("locals", locals_info,
- "Local variables of current stack frame.");
- add_info ("args", args_info,
- "Argument variables of current stack frame.");
-
-#if 0
- add_cmd ("backtrace-limit", class_stack, set_backtrace_limit_command,
- "Specify maximum number of frames for \"backtrace\" to print by default.",
- &setlist);
- add_info ("backtrace-limit", backtrace_limit_info,
- "The maximum number of frames for \"backtrace\" to print by default.");
-#endif
-}
-
diff --git a/gnu/usr.bin/gdb/symmisc.c b/gnu/usr.bin/gdb/symmisc.c
deleted file mode 100644
index bb4eb50..0000000
--- a/gnu/usr.bin/gdb/symmisc.c
+++ /dev/null
@@ -1,584 +0,0 @@
-/* Do various things to symbol tables (other than lookup)), for GDB.
- Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-
-#include "defs.h"
-#include "symtab.h"
-
-#include <stdio.h>
-#include <obstack.h>
-
-static void free_symtab ();
-
-
-/* Free all the symtabs that are currently installed,
- and all storage associated with them.
- Leaves us in a consistent state with no symtabs installed. */
-
-void
-free_all_symtabs ()
-{
- register struct symtab *s, *snext;
-
- /* All values will be invalid because their types will be! */
-
- clear_value_history ();
- clear_displays ();
- clear_internalvars ();
- clear_breakpoints ();
- set_default_breakpoint (0, 0, 0, 0);
-
- current_source_symtab = 0;
-
- for (s = symtab_list; s; s = snext)
- {
- snext = s->next;
- free_symtab (s);
- }
- symtab_list = 0;
- obstack_free (symbol_obstack, 0);
- obstack_init (symbol_obstack);
-
- if (misc_function_vector)
- free (misc_function_vector);
- misc_function_count = 0;
- misc_function_vector = 0;
-}
-
-/* Free a struct block <- B and all the symbols defined in that block. */
-
-static void
-free_symtab_block (b)
- struct block *b;
-{
- register int i, n;
- n = BLOCK_NSYMS (b);
- for (i = 0; i < n; i++)
- {
- free (SYMBOL_NAME (BLOCK_SYM (b, i)));
- free (BLOCK_SYM (b, i));
- }
- free (b);
-}
-
-/* Free all the storage associated with the struct symtab <- S.
- Note that some symtabs have contents malloc'ed structure by structure,
- while some have contents that all live inside one big block of memory,
- and some share the contents of another symbol table and so you should
- not free the contents on their behalf (except sometimes the linetable,
- which maybe per symtab even when the rest is not).
- It is s->free_code that says which alternative to use. */
-
-static void
-free_symtab (s)
- register struct symtab *s;
-{
- register int i, n;
- register struct blockvector *bv;
- register struct type *type;
- register struct typevector *tv;
-
- switch (s->free_code)
- {
- case free_nothing:
- /* All the contents are part of a big block of memory
- and some other symtab is in charge of freeing that block.
- Therefore, do nothing. */
- break;
-
- case free_contents:
- /* Here all the contents were malloc'ed structure by structure
- and must be freed that way. */
- /* First free the blocks (and their symbols. */
- bv = BLOCKVECTOR (s);
- n = BLOCKVECTOR_NBLOCKS (bv);
- for (i = 0; i < n; i++)
- free_symtab_block (BLOCKVECTOR_BLOCK (bv, i));
- /* Free the blockvector itself. */
- free (bv);
- /* Free the type vector. */
- tv = TYPEVECTOR (s);
- free (tv);
- /* Also free the linetable. */
-
- case free_linetable:
- /* Everything will be freed either by our `free_ptr'
- or by some other symbatb, except for our linetable.
- Free that now. */
- free (LINETABLE (s));
- break;
- }
-
- /* If there is a single block of memory to free, free it. */
- if (s->free_ptr)
- free (s->free_ptr);
-
- if (s->line_charpos)
- free (s->line_charpos);
- free (s->filename);
- free (s);
-}
-
-/* Convert a raw symbol-segment to a struct symtab,
- and relocate its internal pointers so that it is valid. */
-
-/* This is how to relocate one pointer, given a name for it.
- Works independent of the type of object pointed to. */
-#define RELOCATE(slot) (slot ? (* (char **) &slot += relocation) : 0)
-
-/* This is the inverse of RELOCATE. We use it when storing
- a core address into a slot that has yet to be relocated. */
-#define UNRELOCATE(slot) (slot ? (* (char **) &slot -= relocation) : 0)
-
-/* During the process of relocation, this holds the amount to relocate by
- (the address of the file's symtab data, in core in the debugger). */
-static int relocation;
-
-#define CORE_RELOCATE(slot) \
- ((slot) += (((slot) < data_start) ? text_relocation \
- : ((slot) < bss_start) ? data_relocation : bss_relocation))
-
-#define TEXT_RELOCATE(slot) ((slot) += text_relocation)
-
-/* Relocation amounts for addresses in the program's core image. */
-static int text_relocation, data_relocation, bss_relocation;
-
-/* Boundaries that divide program core addresses into text, data and bss;
- used to determine which relocation amount to use. */
-static int data_start, bss_start;
-
-static void relocate_typevector ();
-static void relocate_blockvector ();
-static void relocate_type ();
-static void relocate_block ();
-static void relocate_symbol ();
-static void relocate_source ();
-
-/* Relocate a file's symseg so that all the pointers are valid C pointers.
- Value is a `struct symtab'; but it is not suitable for direct
- insertion into the `symtab_list' because it describes several files. */
-
-static struct symtab *
-relocate_symtab (root)
- struct symbol_root *root;
-{
- struct symtab *sp = (struct symtab *) xmalloc (sizeof (struct symtab));
- bzero (sp, sizeof (struct symtab));
-
- relocation = (int) root;
- text_relocation = root->textrel;
- data_relocation = root->datarel;
- bss_relocation = root->bssrel;
- data_start = root->databeg;
- bss_start = root->bssbeg;
-
- sp->filename = root->filename;
- sp->ldsymoff = root->ldsymoff;
- sp->language = root->language;
- sp->compilation = root->compilation;
- sp->version = root->version;
- sp->blockvector = root->blockvector;
- sp->typevector = root->typevector;
-
- RELOCATE (TYPEVECTOR (sp));
- RELOCATE (BLOCKVECTOR (sp));
- RELOCATE (sp->version);
- RELOCATE (sp->compilation);
- RELOCATE (sp->filename);
-
- relocate_typevector (TYPEVECTOR (sp));
- relocate_blockvector (BLOCKVECTOR (sp));
-
- return sp;
-}
-
-static void
-relocate_blockvector (blp)
- register struct blockvector *blp;
-{
- register int nblocks = BLOCKVECTOR_NBLOCKS (blp);
- register int i;
- for (i = 0; i < nblocks; i++)
- RELOCATE (BLOCKVECTOR_BLOCK (blp, i));
- for (i = 0; i < nblocks; i++)
- relocate_block (BLOCKVECTOR_BLOCK (blp, i));
-}
-
-static void
-relocate_block (bp)
- register struct block *bp;
-{
- register int nsyms = BLOCK_NSYMS (bp);
- register int i;
-
- TEXT_RELOCATE (BLOCK_START (bp));
- TEXT_RELOCATE (BLOCK_END (bp));
-
- /* These two should not be recursively processed.
- The superblock need not be because all blocks are
- processed from relocate_blockvector.
- The function need not be because it will be processed
- under the block which is its scope. */
- RELOCATE (BLOCK_SUPERBLOCK (bp));
- RELOCATE (BLOCK_FUNCTION (bp));
-
- for (i = 0; i < nsyms; i++)
- RELOCATE (BLOCK_SYM (bp, i));
-
- for (i = 0; i < nsyms; i++)
- relocate_symbol (BLOCK_SYM (bp, i));
-}
-
-static void
-relocate_symbol (sp)
- register struct symbol *sp;
-{
- RELOCATE (SYMBOL_NAME (sp));
- if (SYMBOL_CLASS (sp) == LOC_BLOCK)
- {
- RELOCATE (SYMBOL_BLOCK_VALUE (sp));
- /* We can assume the block that belongs to this symbol
- is not relocated yet, since it comes after
- the block that contains this symbol. */
- BLOCK_FUNCTION (SYMBOL_BLOCK_VALUE (sp)) = sp;
- UNRELOCATE (BLOCK_FUNCTION (SYMBOL_BLOCK_VALUE (sp)));
- }
- else if (SYMBOL_CLASS (sp) == LOC_STATIC)
- CORE_RELOCATE (SYMBOL_VALUE (sp));
- else if (SYMBOL_CLASS (sp) == LOC_LABEL)
- TEXT_RELOCATE (SYMBOL_VALUE (sp));
- RELOCATE (SYMBOL_TYPE (sp));
-}
-
-static void
-relocate_typevector (tv)
- struct typevector *tv;
-{
- register int ntypes = TYPEVECTOR_NTYPES (tv);
- register int i;
-
- for (i = 0; i < ntypes; i++)
- RELOCATE (TYPEVECTOR_TYPE (tv, i));
- for (i = 0; i < ntypes; i++)
- relocate_type (TYPEVECTOR_TYPE (tv, i));
-}
-
-/* We cannot come up with an a priori spanning tree
- for the network of types, since types can be used
- for many symbols and also as components of other types.
- Therefore, we need to be able to mark types that we
- already have relocated (or are already in the middle of relocating)
- as in a garbage collector. */
-
-static void
-relocate_type (tp)
- register struct type *tp;
-{
- register int nfields = TYPE_NFIELDS (tp);
- register int i;
-
- RELOCATE (TYPE_NAME (tp));
- RELOCATE (TYPE_TARGET_TYPE (tp));
- RELOCATE (TYPE_FIELDS (tp));
- RELOCATE (TYPE_POINTER_TYPE (tp));
-
- for (i = 0; i < nfields; i++)
- {
- RELOCATE (TYPE_FIELD_TYPE (tp, i));
- RELOCATE (TYPE_FIELD_NAME (tp, i));
- }
-}
-
-static void
-relocate_sourcevector (svp)
- register struct sourcevector *svp;
-{
- register int nfiles = svp->length;
- register int i;
- for (i = 0; i < nfiles; i++)
- RELOCATE (svp->source[i]);
- for (i = 0; i < nfiles; i++)
- relocate_source (svp->source[i]);
-}
-
-static void
-relocate_source (sp)
- register struct source *sp;
-{
- register int nitems = sp->contents.nitems;
- register int i;
-
- RELOCATE (sp->name);
- for (i = 0; i < nitems; i++)
- TEXT_RELOCATE (sp->contents.item[i].pc);
-}
-
-/* Read symsegs from file named NAME open on DESC,
- make symtabs from them, and return a chain of them.
- These symtabs are not suitable for direct use in `symtab_list'
- because each one describes a single object file, perhaps many source files.
- `symbol_file_command' takes each of these, makes many real symtabs
- from it, and then frees it.
-
- We assume DESC is prepositioned at the end of the string table,
- just before the symsegs if there are any. */
-
-struct symtab *
-read_symsegs (desc, name)
- int desc;
- char *name;
-{
- struct symbol_root root;
- register char *data;
- register struct symtab *sp, *sp1, *chain = 0;
- register int len;
-
- while (1)
- {
- len = myread (desc, &root, sizeof root);
- if (len == 0 || root.format == 0)
- break;
- /* format 1 was ok for the original gdb, but since the size of the
- type structure changed when C++ support was added, it can no
- longer be used. Accept only format 2. */
- if (root.format != 2 ||
- root.length < sizeof root)
- error ("\nInvalid symbol segment format code");
- data = (char *) xmalloc (root.length);
- bcopy (&root, data, sizeof root);
- len = myread (desc, data + sizeof root,
- root.length - sizeof root);
- sp = relocate_symtab (data);
- RELOCATE (((struct symbol_root *)data)->sourcevector);
- relocate_sourcevector (((struct symbol_root *)data)->sourcevector);
- sp->next = chain;
- chain = sp;
- sp->linetable = (struct linetable *) ((struct symbol_root *)data)->sourcevector;
- }
-
- return chain;
-}
-
-static int block_depth ();
-void print_spaces ();
-static void print_symbol ();
-
-void
-print_symtabs (filename)
- char *filename;
-{
- FILE *outfile;
- register struct symtab *s;
- register int i, j;
- int len, line, blen;
- register struct linetable *l;
- struct blockvector *bv;
- register struct block *b;
- int depth;
- struct cleanup *cleanups;
- extern int fclose();
-
- if (filename == 0)
- error_no_arg ("file to write symbol data in");
-
- filename = tilde_expand (filename);
- make_cleanup (free, filename);
-
- outfile = fopen (filename, "w");
- if (outfile == 0)
- perror_with_name (filename);
-
- cleanups = make_cleanup (fclose, outfile);
- immediate_quit++;
-
- for (s = symtab_list; s; s = s->next)
- {
- /* First print the line table. */
- fprintf (outfile, "Symtab for file %s\n\n", s->filename);
- fprintf (outfile, "Line table:\n\n");
- l = LINETABLE (s);
- len = l->nitems;
- for (i = 0; i < len; i++)
- fprintf (outfile, " line %d at %x\n", l->item[i].line,
- l->item[i].pc);
- /* Now print the block info. */
- fprintf (outfile, "\nBlockvector:\n\n");
- bv = BLOCKVECTOR (s);
- len = BLOCKVECTOR_NBLOCKS (bv);
- for (i = 0; i < len; i++)
- {
- b = BLOCKVECTOR_BLOCK (bv, i);
- depth = block_depth (b) * 2;
- print_spaces (depth, outfile);
- fprintf (outfile, "block #%03d (object 0x%x) ", i, b);
- fprintf (outfile, "[0x%x..0x%x]", BLOCK_START (b), BLOCK_END (b));
- if (BLOCK_SUPERBLOCK (b))
- fprintf (outfile, " (under 0x%x)", BLOCK_SUPERBLOCK (b));
- if (BLOCK_FUNCTION (b))
- fprintf (outfile, " %s", SYMBOL_NAME (BLOCK_FUNCTION (b)));
- fputc ('\n', outfile);
- blen = BLOCK_NSYMS (b);
- for (j = 0; j < blen; j++)
- {
- print_symbol (BLOCK_SYM (b, j), depth + 1, outfile);
- }
- }
-
- fprintf (outfile, "\n\n");
- }
-
- immediate_quit--;
- do_cleanups (cleanups);
-}
-
-static void
-print_symbol (symbol, depth, outfile)
- struct symbol *symbol;
- int depth;
- FILE *outfile;
-{
- print_spaces (depth, outfile);
- if (SYMBOL_NAMESPACE (symbol) == LABEL_NAMESPACE)
- {
- fprintf (outfile, "label %s at 0x%x\n", SYMBOL_NAME (symbol),
- SYMBOL_VALUE (symbol));
- return;
- }
- if (SYMBOL_NAMESPACE (symbol) == STRUCT_NAMESPACE)
- {
- if (TYPE_NAME (SYMBOL_TYPE (symbol)))
- {
- type_print_1 (SYMBOL_TYPE (symbol), "", outfile, 1, depth);
- }
- else
- {
- fprintf (outfile, "%s %s = ",
- (TYPE_CODE (SYMBOL_TYPE (symbol)) == TYPE_CODE_ENUM
- ? "enum"
- : (TYPE_CODE (SYMBOL_TYPE (symbol)) == TYPE_CODE_STRUCT
- ? "struct" : "union")),
- SYMBOL_NAME (symbol));
- type_print_1 (SYMBOL_TYPE (symbol), "", outfile, 1, depth);
- }
- fprintf (outfile, ";\n");
- }
- else
- {
- if (SYMBOL_CLASS (symbol) == LOC_TYPEDEF)
- fprintf (outfile, "typedef ");
- if (SYMBOL_TYPE (symbol))
- {
- type_print_1 (SYMBOL_TYPE (symbol), SYMBOL_NAME (symbol),
- outfile, 1, depth);
- fprintf (outfile, "; ");
- }
- else
- fprintf (outfile, "%s ", SYMBOL_NAME (symbol));
-
- switch (SYMBOL_CLASS (symbol))
- {
- case LOC_CONST:
- fprintf (outfile, "const %d (0x%x),",
- SYMBOL_VALUE (symbol), SYMBOL_VALUE (symbol));
- break;
-
- case LOC_CONST_BYTES:
- fprintf (outfile, "const %d hex bytes:",
- TYPE_LENGTH (SYMBOL_TYPE (symbol)));
- {
- int i;
- for (i = 0; i < TYPE_LENGTH (SYMBOL_TYPE (symbol)); i++)
- fprintf (outfile, " %2x", SYMBOL_VALUE_BYTES (symbol) [i]);
- fprintf (outfile, ",");
- }
- break;
-
- case LOC_STATIC:
- fprintf (outfile, "static at 0x%x,", SYMBOL_VALUE (symbol));
- break;
-
- case LOC_REGISTER:
- fprintf (outfile, "register %d,", SYMBOL_VALUE (symbol));
- break;
-
- case LOC_ARG:
- fprintf (outfile, "arg at 0x%x,", SYMBOL_VALUE (symbol));
- break;
-
- case LOC_REF_ARG:
- fprintf (outfile, "reference arg at 0x%x,", SYMBOL_VALUE (symbol));
- break;
-
- case LOC_REGPARM:
- fprintf (outfile, "parameter register %d,", SYMBOL_VALUE (symbol));
- break;
-
- case LOC_LOCAL:
- fprintf (outfile, "local at 0x%x,", SYMBOL_VALUE (symbol));
- break;
-
- case LOC_TYPEDEF:
- break;
-
- case LOC_LABEL:
- fprintf (outfile, "label at 0x%x", SYMBOL_VALUE (symbol));
- break;
-
- case LOC_BLOCK:
- fprintf (outfile, "block (object 0x%x) starting at 0x%x,",
- SYMBOL_VALUE (symbol),
- BLOCK_START (SYMBOL_BLOCK_VALUE (symbol)));
- break;
- }
- }
- fprintf (outfile, "\n");
-}
-
-/* Return the nexting depth of a block within other blocks in its symtab. */
-
-static int
-block_depth (block)
- struct block *block;
-{
- register int i = 0;
- while (block = BLOCK_SUPERBLOCK (block)) i++;
- return i;
-}
-
-/*
- * Free all partial_symtab storage.
- */
-void
-free_all_psymtabs()
-{
- obstack_free (psymbol_obstack, 0);
- obstack_init (psymbol_obstack);
- partial_symtab_list = (struct partial_symtab *) 0;
-}
-
-void
-_initialize_symmisc ()
-{
- symtab_list = (struct symtab *) 0;
- partial_symtab_list = (struct partial_symtab *) 0;
-
- add_com ("printsyms", class_obscure, print_symtabs,
- "Print dump of current symbol definitions to file OUTFILE.");
-}
-
diff --git a/gnu/usr.bin/gdb/symseg.h b/gnu/usr.bin/gdb/symseg.h
deleted file mode 100644
index 6a61a17..0000000
--- a/gnu/usr.bin/gdb/symseg.h
+++ /dev/null
@@ -1,523 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- *
- * @(#)symseg.h 6.3 (Berkeley) 5/8/91
- */
-
-/* GDB symbol table format definitions.
- Copyright (C) 1986, 1989 Free Software Foundation, Inc.
- Hacked by Michael Tiemann (tiemann@mcc.com)
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; 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 */
-
- /* C++ */
- TYPE_CODE_MEMBER, /* Member type */
- TYPE_CODE_METHOD, /* Method type */
- TYPE_CODE_REF, /* C++ Reference types */
-};
-
-/* This appears in a type's flags word for an unsigned integer type. */
-#define TYPE_FLAG_UNSIGNED 1
-/* This appears in a type's flags word
- if it is a (pointer to a|function returning a)* built in scalar type.
- These types are never freed. */
-#define TYPE_FLAG_PERM 4
-/* This appears in a type's flags word if it is a stub type (eg. if
- someone referenced a type that wasn't definined in a source file
- via (struct sir_not_appearing_in_this_film *)). */
-#define TYPE_FLAG_STUB 8
-/* Set when a class has a constructor defined */
-#define TYPE_FLAG_HAS_CONSTRUCTOR 256
-/* Set when a class has a destructor defined */
-#define TYPE_FLAG_HAS_DESTRUCTOR 512
-/* Indicates that this type is a public baseclass of another class,
- i.e. that all its public methods are available in the derived
- class. */
-#define TYPE_FLAG_VIA_PUBLIC 1024
-/* Indicates that this type is a virtual baseclass of another class,
- i.e. that if this class is inherited more than once by another
- class, only one set of member variables will be included. */
-#define TYPE_FLAG_VIA_VIRTUAL 2048
-
-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 or method type, describes the type of the value.
- For a range type, describes the type of the full range.
- 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;
- /* C++: also need a reference type. */
- struct type *reference_type;
- struct type **arg_types;
-
- /* 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;
-
-/* Handling of pointers to members:
- TYPE_MAIN_VARIANT is used for pointer and pointer
- to member types. Normally it the value of the address of its
- containing type. However, for pointers to members, we must be
- able to allocate pointer to member types and look them up
- from some place of reference.
- NEXT_VARIANT is the next element in the chain. */
- struct type *main_variant, *next_variant;
-
- /* 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".
-
- 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;
-
- /* C++ */
- int *private_field_bits;
- int *protected_field_bits;
-
- /* Number of methods described for this type */
- short nfn_fields;
- /* Number of base classes this type derives from. */
- short n_baseclasses;
-
- /* Number of methods described for this type plus all the
- methods that it derives from. */
- int nfn_fields_total;
-
- /* For classes, structures, and unions, a description of each field,
- which consists of an overloaded name, followed by the types of
- arguments that the method expects, and then the name after it
- has been renamed to make it distinct. */
- struct fn_fieldlist
- {
- /* The overloaded name. */
- char *name;
- /* The number of methods with this name. */
- int length;
- /* The list of methods. */
- struct fn_field
- {
-#if 0
- /* The overloaded name */
- char *name;
-#endif
- /* The return value of the method */
- struct type *type;
- /* The argument list */
- struct type **args;
- /* The name after it has been processed */
- char *physname;
- /* If this is a virtual function, the offset into the vtbl-1,
- else 0. */
- int voffset;
- } *fn_fields;
-
- int *private_fn_field_bits;
- int *protected_fn_field_bits;
-
- } *fn_fieldlists;
-
- unsigned char via_protected;
- unsigned char via_public;
-
- /* For types with virtual functions, VPTR_BASETYPE is the base class which
- defined the virtual function table pointer. VPTR_FIELDNO is
- the field number of that pointer in the structure.
-
- For types that are pointer to member types, VPTR_BASETYPE
- ifs the type that this pointer is a member of.
-
- Unused otherwise. */
- struct type *vptr_basetype;
-
- int vptr_fieldno;
-
- /* If this type has a base class, put it here.
- If this type is a pointer type, the chain of member pointer
- types goes here.
- Unused otherwise.
-
- Contrary to all maxims of C style and common sense, the baseclasses
- are indexed from 1 to N_BASECLASSES rather than 0 to N_BASECLASSES-1
- (i.e. BASECLASSES points to one *before* the first element of
- the array). */
- struct type **baseclasses;
-};
-
-/* 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;
- /* A flag indicating whether or not the fucntion corresponding
- to this block was compiled with gcc or not. If there is no
- function corresponding to this block, this meaning of this flag
- is undefined. (In practice it will be 1 if the block was created
- while processing a file compiled with gcc and 0 when not). */
- unsigned char gcc_compile_flag;
- /* 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_REF_ARG, /* Value address is at spec'd position in */
- /* arglist. */
- LOC_REGPARM, /* Value is at spec'd position in register window */
- 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;
-};
-
-struct partial_symbol
-{
- /* Symbol name */
- char *name;
- /* Name space code. */
- enum namespace namespace;
- /* Address class (for info_symbols) */
- enum address_class class;
- /* Associated partial symbol table */
- struct partial_symtab *pst;
- /* Value (only used for static functions currently). Done this
- way so that we can use the struct symbol macros.
- Note that the address of a function is SYMBOL_VALUE (pst)
- in a partial symbol table, but BLOCK_START (SYMBOL_BLOCK_VALUE (st))
- in a symbol table. */
- union
- {
- long value;
- }
- value;
-};
-
-/*
- * Vectors of all partial symbols read in from file; actually declared
- * and used in dbxread.c.
- */
-extern struct psymbol_allocation_list {
- struct partial_symbol *list, *next;
- int size;
-} global_psymbols, static_psymbols;
-
-
-/* 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 */
-};
-
-/* Each item represents a line-->pc (or the reverse) mapping. This is
- somewhat more wasteful of space than one might wish, but since only
- the files which are actually debugged are read in to core, we don't
- waste much space.
-
- Each item used to be an int; either minus a line number, or a
- program counter. If it represents a line number, that is the line
- described by the next program counter value. If it is positive, it
- is the program counter at which the code for the next line starts. */
-
-struct linetable_entry
-{
- int line;
- CORE_ADDR pc;
-};
-
-struct linetable
-{
- int nitems;
- struct linetable_entry item[1];
-};
-
-/* All the information on one source file. */
-
-struct source
-{
- char *name; /* Name of file */
- struct linetable contents;
-};
diff --git a/gnu/usr.bin/gdb/symtab.c b/gnu/usr.bin/gdb/symtab.c
deleted file mode 100644
index 4e4bd8e..0000000
--- a/gnu/usr.bin/gdb/symtab.c
+++ /dev/null
@@ -1,2473 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- *
- * $Header: /a/cvs/386BSD/src/gnu/gdb/symtab.c,v 1.1 1993/06/29 09:47:40 nate Exp $;
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)symtab.c 6.3 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* Symbol table lookup for the GNU debugger, GDB.
- Copyright (C) 1986, 1987, 1988, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include "defs.h"
-#include "param.h"
-#include "symtab.h"
-
-#include <obstack.h>
-#include <assert.h>
-
-char *index ();
-extern char *cplus_demangle ();
-extern struct value * value_of_this ();
-
-/* Allocate an obstack to hold objects that should be freed
- when we load a new symbol table.
- This includes the symbols made by dbxread
- and the types that are not permanent. */
-
-struct obstack obstack1;
-
-struct obstack *symbol_obstack = &obstack1;
-
-/* This obstack will be used for partial_symbol objects. It can
- probably actually be the same as the symbol_obstack above, but I'd
- like to keep them seperate for now. If I want to later, I'll
- replace one with the other. */
-
-struct obstack obstack2;
-
-struct obstack *psymbol_obstack = &obstack2;
-
-/* These variables point to the objects
- representing the predefined C data types. */
-
-struct type *builtin_type_void;
-struct type *builtin_type_char;
-struct type *builtin_type_short;
-struct type *builtin_type_int;
-struct type *builtin_type_long;
-#ifdef LONG_LONG
-struct type *builtin_type_long_long;
-#endif
-struct type *builtin_type_unsigned_char;
-struct type *builtin_type_unsigned_short;
-struct type *builtin_type_unsigned_int;
-struct type *builtin_type_unsigned_long;
-#ifdef LONG_LONG
-struct type *builtin_type_unsigned_long_long;
-#endif
-struct type *builtin_type_float;
-struct type *builtin_type_double;
-
-/* Block in which the most recently searched-for symbol was found.
- Might be better to make this a parameter to lookup_symbol and
- value_of_this. */
-struct block *block_found;
-
-/* Functions */
-static int find_line_common ();
-int lookup_misc_func ();
-struct partial_symtab *lookup_partial_symtab ();
-struct symtab *psymtab_to_symtab ();
-static struct partial_symbol *lookup_partial_symbol ();
-
-/* Check for a symtab of a specific name; first in symtabs, then in
- psymtabs. *If* there is no '/' in the name, a match after a '/'
- in the symtab filename will also work. */
-
-static struct symtab *
-lookup_symtab_1 (name)
- char *name;
-{
- register struct symtab *s;
- register struct partial_symtab *ps;
- register char *slash = index (name, '/');
- register int len = strlen (name);
-
- for (s = symtab_list; s; s = s->next)
- if (!strcmp (name, s->filename))
- return s;
-
- for (ps = partial_symtab_list; ps; ps = ps->next)
- if (!strcmp (name, ps->filename))
- {
- if (ps->readin)
- fatal ("Internal: readin pst found when no symtab found.");
- s = psymtab_to_symtab (ps);
- return s;
- }
-
- if (!slash)
- {
- for (s = symtab_list; s; s = s->next)
- {
- int l = strlen (s->filename);
-
- if (s->filename[l - len -1] == '/'
- && !strcmp (s->filename + l - len, name))
- return s;
- }
-
- for (ps = partial_symtab_list; ps; ps = ps->next)
- {
- int l = strlen (ps->filename);
-
- if (ps->filename[l - len - 1] == '/'
- && !strcmp (ps->filename + l - len, name))
- {
- if (ps->readin)
- fatal ("Internal: readin pst found when no symtab found.");
- s = psymtab_to_symtab (ps);
- return s;
- }
- }
- }
- return 0;
-}
-
-/* Lookup the symbol table of a source file named NAME. Try a couple
- of variations if the first lookup doesn't work. */
-
-struct symtab *
-lookup_symtab (name)
- char *name;
-{
- register struct symtab *s;
- register char *copy;
-
- s = lookup_symtab_1 (name);
- if (s) return s;
-
- /* If name not found as specified, see if adding ".c" helps. */
-
- copy = (char *) alloca (strlen (name) + 3);
- strcpy (copy, name);
- strcat (copy, ".c");
- s = lookup_symtab_1 (copy);
- if (s) return s;
-
- /* We didn't find anything; die. */
- return 0;
-}
-
-/* Lookup the partial symbol table of a source file named NAME. This
- only returns true on an exact match (ie. this semantics are
- different from lookup_symtab. */
-
-struct partial_symtab *
-lookup_partial_symtab (name)
-char *name;
-{
- register struct partial_symtab *s;
- register char *copy;
-
- for (s = partial_symtab_list; s; s = s->next)
- if (!strcmp (name, s->filename))
- return s;
-
- return 0;
-}
-
-/* Lookup a typedef or primitive type named NAME,
- visible in lexical block BLOCK.
- If NOERR is nonzero, return zero if NAME is not suitably defined. */
-
-struct type *
-lookup_typename (name, block, noerr)
- char *name;
- struct block *block;
- int noerr;
-{
- register struct symbol *sym = lookup_symbol (name, block, VAR_NAMESPACE, 0);
- if (sym == 0 || SYMBOL_CLASS (sym) != LOC_TYPEDEF)
- {
- if (!strcmp (name, "int"))
- return builtin_type_int;
- if (!strcmp (name, "long"))
- return builtin_type_long;
- if (!strcmp (name, "short"))
- return builtin_type_short;
- if (!strcmp (name, "char"))
- return builtin_type_char;
- if (!strcmp (name, "float"))
- return builtin_type_float;
- if (!strcmp (name, "double"))
- return builtin_type_double;
- if (!strcmp (name, "void"))
- return builtin_type_void;
-
- if (noerr)
- return 0;
- error ("No type named %s.", name);
- }
- return SYMBOL_TYPE (sym);
-}
-
-struct type *
-lookup_unsigned_typename (name)
- char *name;
-{
- if (!strcmp (name, "int"))
- return builtin_type_unsigned_int;
- if (!strcmp (name, "long"))
- return builtin_type_unsigned_long;
- if (!strcmp (name, "short"))
- return builtin_type_unsigned_short;
- if (!strcmp (name, "char"))
- return builtin_type_unsigned_char;
- error ("No type named unsigned %s.", name);
-}
-
-/* Lookup a structure type named "struct NAME",
- visible in lexical block BLOCK. */
-
-struct type *
-lookup_struct (name, block)
- char *name;
- struct block *block;
-{
- register struct symbol *sym
- = lookup_symbol (name, block, STRUCT_NAMESPACE, 0);
-
- if (sym == 0)
- error ("No struct type named %s.", name);
- if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_STRUCT)
- error ("This context has class, union or enum %s, not a struct.", name);
- return SYMBOL_TYPE (sym);
-}
-
-/* Lookup a union type named "union NAME",
- visible in lexical block BLOCK. */
-
-struct type *
-lookup_union (name, block)
- char *name;
- struct block *block;
-{
- register struct symbol *sym
- = lookup_symbol (name, block, STRUCT_NAMESPACE, 0);
-
- if (sym == 0)
- error ("No union type named %s.", name);
- if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_UNION)
- error ("This context has class, struct or enum %s, not a union.", name);
- return SYMBOL_TYPE (sym);
-}
-
-/* Lookup an enum type named "enum NAME",
- visible in lexical block BLOCK. */
-
-struct type *
-lookup_enum (name, block)
- char *name;
- struct block *block;
-{
- register struct symbol *sym
- = lookup_symbol (name, block, STRUCT_NAMESPACE, 0);
- if (sym == 0)
- error ("No enum type named %s.", name);
- if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_ENUM)
- error ("This context has class, struct or union %s, not an enum.", name);
- return SYMBOL_TYPE (sym);
-}
-
-/* Given a type TYPE, lookup the type of the component of type named
- NAME. */
-
-struct type *
-lookup_struct_elt_type (type, name)
- struct type *type;
- char *name;
-{
- struct type *t;
- int i;
- char *errmsg;
-
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION)
- {
- terminal_ours ();
- fflush (stdout);
- fprintf (stderr, "Type ");
- type_print (type, "", stderr, -1);
- fprintf (stderr, " is not a structure or union type.\n");
- return_to_top_level ();
- }
-
- for (i = TYPE_NFIELDS (type) - 1; i >= 0; i--)
- if (!strcmp (TYPE_FIELD_NAME (type, i), name))
- return TYPE_FIELD_TYPE (type, i);
-
- terminal_ours ();
- fflush (stdout);
- fprintf (stderr, "Type ");
- type_print (type, "", stderr, -1);
- fprintf (stderr, " has no component named %s\n", name);
- return_to_top_level ();
-}
-
-/* Given a type TYPE, return a type of pointers to that type.
- May need to construct such a type if this is the first use.
-
- C++: use TYPE_MAIN_VARIANT and TYPE_CHAIN to keep pointer
- to member types under control. */
-
-struct type *
-lookup_pointer_type (type)
- struct type *type;
-{
- register struct type *ptype = TYPE_POINTER_TYPE (type);
- if (ptype) return TYPE_MAIN_VARIANT (ptype);
-
- /* This is the first time anyone wanted a pointer to a TYPE. */
- if (TYPE_FLAGS (type) & TYPE_FLAG_PERM)
- ptype = (struct type *) xmalloc (sizeof (struct type));
- else
- ptype = (struct type *) obstack_alloc (symbol_obstack,
- sizeof (struct type));
-
- bzero (ptype, sizeof (struct type));
- TYPE_MAIN_VARIANT (ptype) = ptype;
- TYPE_TARGET_TYPE (ptype) = type;
- TYPE_POINTER_TYPE (type) = ptype;
- /* New type is permanent if type pointed to is permanent. */
- if (TYPE_FLAGS (type) & TYPE_FLAG_PERM)
- TYPE_FLAGS (ptype) |= TYPE_FLAG_PERM;
- /* We assume the machine has only one representation for pointers! */
- TYPE_LENGTH (ptype) = sizeof (char *);
- TYPE_CODE (ptype) = TYPE_CODE_PTR;
- return ptype;
-}
-
-struct type *
-lookup_reference_type (type)
- struct type *type;
-{
- register struct type *rtype = TYPE_REFERENCE_TYPE (type);
- if (rtype) return TYPE_MAIN_VARIANT (rtype);
-
- /* This is the first time anyone wanted a pointer to a TYPE. */
- if (TYPE_FLAGS (type) & TYPE_FLAG_PERM)
- rtype = (struct type *) xmalloc (sizeof (struct type));
- else
- rtype = (struct type *) obstack_alloc (symbol_obstack,
- sizeof (struct type));
-
- bzero (rtype, sizeof (struct type));
- TYPE_MAIN_VARIANT (rtype) = rtype;
- TYPE_TARGET_TYPE (rtype) = type;
- TYPE_REFERENCE_TYPE (type) = rtype;
- /* New type is permanent if type pointed to is permanent. */
- if (TYPE_FLAGS (type) & TYPE_FLAG_PERM)
- TYPE_FLAGS (rtype) |= TYPE_FLAG_PERM;
- /* We assume the machine has only one representation for pointers! */
- TYPE_LENGTH (rtype) = sizeof (char *);
- TYPE_CODE (rtype) = TYPE_CODE_REF;
- return rtype;
-}
-
-
-/* Implement direct support for MEMBER_TYPE in GNU C++.
- May need to construct such a type if this is the first use.
- The TYPE is the type of the member. The DOMAIN is the type
- of the aggregate that the member belongs to. */
-
-struct type *
-lookup_member_type (type, domain)
- struct type *type, *domain;
-{
- register struct type *mtype = TYPE_MAIN_VARIANT (type);
- struct type *main_type;
-
- main_type = mtype;
- while (mtype)
- {
- if (TYPE_DOMAIN_TYPE (mtype) == domain)
- return mtype;
- mtype = TYPE_NEXT_VARIANT (mtype);
- }
-
- /* This is the first time anyone wanted this member type. */
- if (TYPE_FLAGS (type) & TYPE_FLAG_PERM)
- mtype = (struct type *) xmalloc (sizeof (struct type));
- else
- mtype = (struct type *) obstack_alloc (symbol_obstack,
- sizeof (struct type));
-
- bzero (mtype, sizeof (struct type));
- if (main_type == 0)
- main_type = mtype;
- else
- {
- TYPE_NEXT_VARIANT (mtype) = TYPE_NEXT_VARIANT (main_type);
- TYPE_NEXT_VARIANT (main_type) = mtype;
- }
- TYPE_MAIN_VARIANT (mtype) = main_type;
- TYPE_TARGET_TYPE (mtype) = type;
- TYPE_DOMAIN_TYPE (mtype) = domain;
- /* New type is permanent if type pointed to is permanent. */
- if (TYPE_FLAGS (type) & TYPE_FLAG_PERM)
- TYPE_FLAGS (mtype) |= TYPE_FLAG_PERM;
-
- /* In practice, this is never used. */
- TYPE_LENGTH (mtype) = 1;
- TYPE_CODE (mtype) = TYPE_CODE_MEMBER;
-
-#if 0
- /* Now splice in the new member pointer type. */
- if (main_type)
- {
- /* This type was not "smashed". */
- TYPE_CHAIN (mtype) = TYPE_CHAIN (main_type);
- TYPE_CHAIN (main_type) = mtype;
- }
-#endif
-
- return mtype;
-}
-
-struct type *
-lookup_method_type (type, domain, args)
- struct type *type, *domain, **args;
-{
- register struct type *mtype = TYPE_MAIN_VARIANT (type);
- struct type *main_type;
-
- main_type = mtype;
- while (mtype)
- {
- if (TYPE_DOMAIN_TYPE (mtype) == domain)
- {
- struct type **t1 = args;
- struct type **t2 = TYPE_ARG_TYPES (mtype);
- if (t2)
- {
- int i;
- for (i = 0; t1[i] != 0 && t1[i]->code != TYPE_CODE_VOID; i++)
- if (t1[i] != t2[i])
- break;
- if (t1[i] == t2[i])
- return mtype;
- }
- }
- mtype = TYPE_NEXT_VARIANT (mtype);
- }
-
- /* This is the first time anyone wanted this member type. */
- if (TYPE_FLAGS (type) & TYPE_FLAG_PERM)
- mtype = (struct type *) xmalloc (sizeof (struct type));
- else
- mtype = (struct type *) obstack_alloc (symbol_obstack,
- sizeof (struct type));
-
- bzero (mtype, sizeof (struct type));
- if (main_type == 0)
- main_type = mtype;
- else
- {
- TYPE_NEXT_VARIANT (mtype) = TYPE_NEXT_VARIANT (main_type);
- TYPE_NEXT_VARIANT (main_type) = mtype;
- }
- TYPE_MAIN_VARIANT (mtype) = main_type;
- TYPE_TARGET_TYPE (mtype) = type;
- TYPE_DOMAIN_TYPE (mtype) = domain;
- TYPE_ARG_TYPES (mtype) = args;
- /* New type is permanent if type pointed to is permanent. */
- if (TYPE_FLAGS (type) & TYPE_FLAG_PERM)
- TYPE_FLAGS (mtype) |= TYPE_FLAG_PERM;
-
- /* In practice, this is never used. */
- TYPE_LENGTH (mtype) = 1;
- TYPE_CODE (mtype) = TYPE_CODE_METHOD;
-
-#if 0
- /* Now splice in the new member pointer type. */
- if (main_type)
- {
- /* This type was not "smashed". */
- TYPE_CHAIN (mtype) = TYPE_CHAIN (main_type);
- TYPE_CHAIN (main_type) = mtype;
- }
-#endif
-
- return mtype;
-}
-
-/* Given a type TYPE, return a type which has offset OFFSET,
- via_virtual VIA_VIRTUAL, and via_public VIA_PUBLIC.
- May need to construct such a type if none exists. */
-struct type *
-lookup_basetype_type (type, offset, via_virtual, via_public)
- struct type *type;
- int offset;
- int via_virtual, via_public;
-{
- register struct type *btype = TYPE_MAIN_VARIANT (type);
- struct type *main_type;
-
- if (offset != 0)
- {
- printf ("Internal error: type offset non-zero in lookup_basetype_type");
- offset = 0;
- }
-
- main_type = btype;
- while (btype)
- {
- if (/* TYPE_OFFSET (btype) == offset
- && */ TYPE_VIA_PUBLIC (btype) == via_public
- && TYPE_VIA_VIRTUAL (btype) == via_virtual)
- return btype;
- btype = TYPE_NEXT_VARIANT (btype);
- }
-
- /* This is the first time anyone wanted this member type. */
- if (TYPE_FLAGS (type) & TYPE_FLAG_PERM)
- btype = (struct type *) xmalloc (sizeof (struct type));
- else
- btype = (struct type *) obstack_alloc (symbol_obstack,
- sizeof (struct type));
-
- if (main_type == 0)
- {
- main_type = btype;
- bzero (btype, sizeof (struct type));
- TYPE_MAIN_VARIANT (btype) = main_type;
- }
- else
- {
- bcopy (main_type, btype, sizeof (struct type));
- TYPE_NEXT_VARIANT (main_type) = btype;
- }
-/* TYPE_OFFSET (btype) = offset; */
- if (via_public)
- TYPE_FLAGS (btype) |= TYPE_FLAG_VIA_PUBLIC;
- if (via_virtual)
- TYPE_FLAGS (btype) |= TYPE_FLAG_VIA_VIRTUAL;
- /* New type is permanent if type pointed to is permanent. */
- if (TYPE_FLAGS (type) & TYPE_FLAG_PERM)
- TYPE_FLAGS (btype) |= TYPE_FLAG_PERM;
-
- /* In practice, this is never used. */
- TYPE_LENGTH (btype) = 1;
- TYPE_CODE (btype) = TYPE_CODE_STRUCT;
-
- return btype;
-}
-
-/* Given a type TYPE, return a type of functions that return that type.
- May need to construct such a type if this is the first use. */
-
-struct type *
-lookup_function_type (type)
- struct type *type;
-{
- register struct type *ptype = TYPE_FUNCTION_TYPE (type);
- if (ptype) return ptype;
-
- /* This is the first time anyone wanted a function returning a TYPE. */
- if (TYPE_FLAGS (type) & TYPE_FLAG_PERM)
- ptype = (struct type *) xmalloc (sizeof (struct type));
- else
- ptype = (struct type *) obstack_alloc (symbol_obstack,
- sizeof (struct type));
-
- bzero (ptype, sizeof (struct type));
- TYPE_TARGET_TYPE (ptype) = type;
- TYPE_FUNCTION_TYPE (type) = ptype;
- /* New type is permanent if type returned is permanent. */
- if (TYPE_FLAGS (type) & TYPE_FLAG_PERM)
- TYPE_FLAGS (ptype) |= TYPE_FLAG_PERM;
- TYPE_LENGTH (ptype) = 1;
- TYPE_CODE (ptype) = TYPE_CODE_FUNC;
- TYPE_NFIELDS (ptype) = 0;
- return ptype;
-}
-
-/* Create an array type. Elements will be of type TYPE, and there will
- be NUM of them.
-
- Eventually this should be extended to take two more arguments which
- specify the bounds of the array and the type of the index.
- It should also be changed to be a "lookup" function, with the
- appropriate data structures added to the type field.
- Then read array type should call here. */
-
-struct type *
-create_array_type (element_type, number)
- struct type *element_type;
- int number;
-{
- struct type *result_type = (struct type *)
- obstack_alloc (symbol_obstack, sizeof (struct type));
-
- bzero (result_type, sizeof (struct type));
-
- TYPE_CODE (result_type) = TYPE_CODE_ARRAY;
- TYPE_TARGET_TYPE (result_type) = element_type;
- TYPE_LENGTH (result_type) = number * TYPE_LENGTH (element_type);
- TYPE_NFIELDS (result_type) = 1;
- TYPE_FIELDS (result_type) =
- (struct field *) obstack_alloc (symbol_obstack, sizeof (struct field));
- TYPE_FIELD_TYPE (result_type, 0) = builtin_type_int;
- TYPE_VPTR_FIELDNO (result_type) = -1;
-
- return result_type;
-}
-
-
-/* Smash TYPE to be a type of pointers to TO_TYPE.
- If TO_TYPE is not permanent and has no pointer-type yet,
- record TYPE as its pointer-type. */
-
-void
-smash_to_pointer_type (type, to_type)
- struct type *type, *to_type;
-{
- int type_permanent = (TYPE_FLAGS (type) & TYPE_FLAG_PERM);
-
- bzero (type, sizeof (struct type));
- TYPE_TARGET_TYPE (type) = to_type;
- /* We assume the machine has only one representation for pointers! */
- TYPE_LENGTH (type) = sizeof (char *);
- TYPE_CODE (type) = TYPE_CODE_PTR;
-
- TYPE_MAIN_VARIANT (type) = type;
-
- if (type_permanent)
- TYPE_FLAGS (type) |= TYPE_FLAG_PERM;
-
- if (TYPE_POINTER_TYPE (to_type) == 0
- && (!(TYPE_FLAGS (to_type) & TYPE_FLAG_PERM)
- || type_permanent))
- {
- TYPE_POINTER_TYPE (to_type) = type;
- }
-}
-
-/* Smash TYPE to be a type of members of DOMAIN with type TO_TYPE. */
-
-void
-smash_to_member_type (type, domain, to_type)
- struct type *type, *domain, *to_type;
-{
- bzero (type, sizeof (struct type));
- TYPE_TARGET_TYPE (type) = to_type;
- TYPE_DOMAIN_TYPE (type) = domain;
-
- /* In practice, this is never needed. */
- TYPE_LENGTH (type) = 1;
- TYPE_CODE (type) = TYPE_CODE_MEMBER;
-
- TYPE_MAIN_VARIANT (type) = lookup_member_type (domain, to_type);
-}
-
-/* Smash TYPE to be a type of method of DOMAIN with type TO_TYPE. */
-
-void
-smash_to_method_type (type, domain, to_type, args)
- struct type *type, *domain, *to_type, **args;
-{
- bzero (type, sizeof (struct type));
- TYPE_TARGET_TYPE (type) = to_type;
- TYPE_DOMAIN_TYPE (type) = domain;
- TYPE_ARG_TYPES (type) = args;
-
- /* In practice, this is never needed. */
- TYPE_LENGTH (type) = 1;
- TYPE_CODE (type) = TYPE_CODE_METHOD;
-
- TYPE_MAIN_VARIANT (type) = lookup_method_type (domain, to_type, args);
-}
-
-/* Smash TYPE to be a type of reference to TO_TYPE.
- If TO_TYPE is not permanent and has no pointer-type yet,
- record TYPE as its pointer-type. */
-
-void
-smash_to_reference_type (type, to_type)
- struct type *type, *to_type;
-{
- int type_permanent = (TYPE_FLAGS (type) & TYPE_FLAG_PERM);
-
- bzero (type, sizeof (struct type));
- TYPE_TARGET_TYPE (type) = to_type;
- /* We assume the machine has only one representation for pointers! */
- TYPE_LENGTH (type) = sizeof (char *);
- TYPE_CODE (type) = TYPE_CODE_REF;
-
- TYPE_MAIN_VARIANT (type) = type;
-
- if (type_permanent)
- TYPE_FLAGS (type) |= TYPE_FLAG_PERM;
-
- if (TYPE_REFERENCE_TYPE (to_type) == 0
- && (!(TYPE_FLAGS (to_type) & TYPE_FLAG_PERM)
- || type_permanent))
- {
- TYPE_REFERENCE_TYPE (to_type) = type;
- }
-}
-
-/* Smash TYPE to be a type of functions returning TO_TYPE.
- If TO_TYPE is not permanent and has no function-type yet,
- record TYPE as its function-type. */
-
-void
-smash_to_function_type (type, to_type)
- struct type *type, *to_type;
-{
- int type_permanent = (TYPE_FLAGS (type) & TYPE_FLAG_PERM);
-
- bzero (type, sizeof (struct type));
- TYPE_TARGET_TYPE (type) = to_type;
- TYPE_LENGTH (type) = 1;
- TYPE_CODE (type) = TYPE_CODE_FUNC;
- TYPE_NFIELDS (type) = 0;
-
- if (type_permanent)
- TYPE_FLAGS (type) |= TYPE_FLAG_PERM;
-
- if (TYPE_FUNCTION_TYPE (to_type) == 0
- && (!(TYPE_FLAGS (to_type) & TYPE_FLAG_PERM)
- || type_permanent))
- {
- TYPE_FUNCTION_TYPE (to_type) = type;
- }
-}
-
-/* Find which partial symtab on the partial_symtab_list contains
- PC. Return 0 if none. */
-
-struct partial_symtab *
-find_pc_psymtab (pc)
- register CORE_ADDR pc;
-{
- register struct partial_symtab *ps;
-
- for (ps = partial_symtab_list; ps; ps = ps->next)
- if (pc >= ps->textlow && pc < ps->texthigh)
- return ps;
-
- return 0;
-}
-
-/* Find which partial symbol within a psymtab contains PC. Return 0
- if none. Check all psymtabs if PSYMTAB is 0. */
-struct partial_symbol *
-find_pc_psymbol (psymtab, pc)
- struct partial_symtab *psymtab;
- CORE_ADDR pc;
-{
- struct partial_symbol *best, *p;
- int best_pc;
-
- if (!psymtab)
- psymtab = find_pc_psymtab (pc);
- if (!psymtab)
- return 0;
-
- best_pc = psymtab->textlow - 1;
-
- for (p = static_psymbols.list + psymtab->statics_offset;
- (p - (static_psymbols.list + psymtab->statics_offset)
- < psymtab->n_static_syms);
- p++)
- if (SYMBOL_NAMESPACE (p) == VAR_NAMESPACE
- && SYMBOL_CLASS (p) == LOC_BLOCK
- && pc >= SYMBOL_VALUE (p)
- && SYMBOL_VALUE (p) > best_pc)
- {
- best_pc = SYMBOL_VALUE (p);
- best = p;
- }
- if (best_pc == psymtab->textlow - 1)
- return 0;
- return best;
-}
-
-
-static struct symbol *lookup_block_symbol ();
-
-/* Find the definition for a specified symbol name NAME
- in namespace NAMESPACE, visible from lexical block BLOCK.
- Returns the struct symbol pointer, or zero if no symbol is found.
- C++: if IS_A_FIELD_OF_THIS is nonzero on entry, check to see if
- NAME is a field of the current implied argument `this'. If so set
- *IS_A_FIELD_OF_THIS to 1, otherwise set it to zero.
- BLOCK_FOUND is set to the block in which NAME is found (in the case of
- a field of `this', value_of_this sets BLOCK_FOUND to the proper value.) */
-
-struct symbol *
-lookup_symbol (name, block, namespace, is_a_field_of_this)
- char *name;
- register struct block *block;
- enum namespace namespace;
- int *is_a_field_of_this;
-{
- register int i, n;
- register struct symbol *sym;
- register struct symtab *s;
- register struct partial_symtab *ps;
- register struct partial_symbol *psym;
- struct blockvector *bv;
-
- /* Search specified block and its superiors. */
-
- while (block != 0)
- {
- sym = lookup_block_symbol (block, name, namespace);
- if (sym)
- {
- block_found = block;
- return sym;
- }
- block = BLOCK_SUPERBLOCK (block);
- }
-
- /* C++: If requested to do so by the caller,
- check to see if NAME is a field of `this'. */
- if (is_a_field_of_this)
- {
- struct value *v = value_of_this (0);
-
- *is_a_field_of_this = 0;
- if (v && check_field (v, name))
- {
- *is_a_field_of_this = 1;
- return 0;
- }
- }
-
- /* Now search all global blocks. Do the symtab's first, then
- check the psymtab's */
-
- for (s = symtab_list; s; s = s->next)
- {
- bv = BLOCKVECTOR (s);
- block = BLOCKVECTOR_BLOCK (bv, 0);
- sym = lookup_block_symbol (block, name, namespace);
- if (sym)
- {
- block_found = block;
- return sym;
- }
- }
-
- /* Check for the possibility of the symbol being a global function
- that is stored on the misc function vector. Eventually, all
- global symbols might be resolved in this way. */
-
- if (namespace == VAR_NAMESPACE)
- {
- int index = lookup_misc_func (name);
-
- if (index == -1)
- { /* Look for a mangled C++ name for NAME. */
- int name_len = strlen (name);
- for (index = misc_function_count; --index >= 0; )
- /* Assume orginal name is prefix of mangled name. */
- if (!strncmp (misc_function_vector[index].name, name, name_len))
- {
- char *demangled =
- cplus_demangle(misc_function_vector[index].name, -1);
- if (demangled != NULL)
- {
- int cond = strcmp (demangled, name);
- free (demangled);
- if (!cond)
- break;
- }
- }
- /* Loop terminates on no match with index == -1. */
- }
-
- if (index != -1)
- {
- ps = find_pc_psymtab (misc_function_vector[index].address);
- if (ps && !ps->readin)
- {
- s = psymtab_to_symtab (ps);
- bv = BLOCKVECTOR (s);
- block = BLOCKVECTOR_BLOCK (bv, 0);
- sym = lookup_block_symbol (block, name, namespace);
- /* sym == 0 if symbol was found in the psymtab but not
- in the symtab.
- Return 0 to use the misc_function definition of "foo_".
-
- This happens for Fortran "foo_" symbols,
- which are "foo" in the symtab.
-
- This can also happen if "asm" is used to make a
- regular symbol but not a debugging symbol, e.g.
- asm(".globl _main");
- asm("_main:");
- */
-
- return sym;
- }
- }
- }
-
- if (psym = lookup_partial_symbol (name, 1, namespace))
- {
- ps = psym->pst;
- s = psymtab_to_symtab(ps);
- bv = BLOCKVECTOR (s);
- block = BLOCKVECTOR_BLOCK (bv, 0);
- sym = lookup_block_symbol (block, name, namespace);
- if (!sym)
- fatal ("Internal: global symbol found in psymtab but not in symtab");
- return sym;
- }
-
- /* Now search all per-file blocks.
- Not strictly correct, but more useful than an error.
- Do the symtabs first, then check the psymtabs */
-
- for (s = symtab_list; s; s = s->next)
- {
- bv = BLOCKVECTOR (s);
- block = BLOCKVECTOR_BLOCK (bv, 1);
- sym = lookup_block_symbol (block, name, namespace);
- if (sym)
- {
- block_found = block;
- return sym;
- }
- }
-
- if (psym = lookup_partial_symbol(name, 0, namespace))
- {
- ps = psym->pst;
- s = psymtab_to_symtab(ps);
- bv = BLOCKVECTOR (s);
- block = BLOCKVECTOR_BLOCK (bv, 1);
- sym = lookup_block_symbol (block, name, namespace);
- if (!sym)
- fatal ("Internal: static symbol found in psymtab but not in symtab");
- return sym;
- }
-
- return 0;
-}
-
-/* Look, in partial_symtab PST, for symbol NAME. Check the global
- symbols if GLOBAL, the static symbols if not */
-
-static struct partial_symbol *
-lookup_partial_symbol (name, global, namespace)
- register char *name;
- register int global;
- register enum namespace namespace;
-{
- register struct partial_symbol *start, *psym;
- register struct partial_symbol *top, *bottom, *center;
- register struct partial_symtab *pst;
- register int length;
-
- if (global)
- {
- start = global_psymbols.list;
- length = global_psymbols.next - start;
- }
- else
- {
- start = static_psymbols.list;
- length = static_psymbols.next - start;
- }
-
- if (!length)
- return (struct partial_symbol *) 0;
-
- /* Binary search. This search is guarranteed to end with center
- pointing at the earliest partial symbol with the correct
- name. At that point *all* partial symbols with that name
- will be checked against the correct namespace. */
- bottom = start;
- top = start + length - 1;
- while (top > bottom)
- {
- center = bottom + (top - bottom) / 2;
-
- assert (center < top);
-
- if (strcmp (SYMBOL_NAME (center), name) >= 0)
- top = center;
- else
- bottom = center + 1;
- }
- assert (top == bottom);
-
- while (strcmp (SYMBOL_NAME (top), name) == 0)
- {
- if (!top->pst->readin && SYMBOL_NAMESPACE (top) == namespace)
- return top;
- top ++;
- }
-
- return (struct partial_symbol *) 0;
-}
-
-/* Look for a symbol in block BLOCK. */
-
-static struct symbol *
-lookup_block_symbol (block, name, namespace)
- register struct block *block;
- char *name;
- enum namespace namespace;
-{
- register int bot, top, inc;
- register struct symbol *sym, *parameter_sym;
-
- top = BLOCK_NSYMS (block);
- bot = 0;
-
- /* If the blocks's symbols were sorted, start with a binary search. */
-
- if (BLOCK_SHOULD_SORT (block))
- {
- /* First, advance BOT to not far before
- the first symbol whose name is NAME. */
-
- while (1)
- {
- inc = (top - bot + 1);
- /* No need to keep binary searching for the last few bits worth. */
- if (inc < 4)
- break;
- inc = (inc >> 1) + bot;
- sym = BLOCK_SYM (block, inc);
- if (SYMBOL_NAME (sym)[0] < name[0])
- bot = inc;
- else if (SYMBOL_NAME (sym)[0] > name[0])
- top = inc;
- else if (strcmp (SYMBOL_NAME (sym), name) < 0)
- bot = inc;
- else
- top = inc;
- }
-
- /* Now scan forward until we run out of symbols,
- find one whose name is greater than NAME,
- or find one we want.
- If there is more than one symbol with the right name and namespace,
- we return the first one. dbxread.c is careful to make sure
- that if one is a register then it comes first. */
-
- top = BLOCK_NSYMS (block);
- while (bot < top)
- {
- sym = BLOCK_SYM (block, bot);
- inc = SYMBOL_NAME (sym)[0] - name[0];
- if (inc == 0)
- inc = strcmp (SYMBOL_NAME (sym), name);
- if (inc == 0 && SYMBOL_NAMESPACE (sym) == namespace)
- return sym;
- if (inc > 0)
- return 0;
- bot++;
- }
- return 0;
- }
-
- /* Here if block isn't sorted.
- This loop is equivalent to the loop above,
- but hacked greatly for speed.
-
- Note that parameter symbols do not always show up last in the
- list; this loop makes sure to take anything else other than
- parameter symbols first; it only uses parameter symbols as a
- last resort. Note that this only takes up extra computation
- time on a match. */
-
- parameter_sym = (struct symbol *) 0;
- top = BLOCK_NSYMS (block);
- inc = name[0];
- while (bot < top)
- {
- sym = BLOCK_SYM (block, bot);
- if (SYMBOL_NAME (sym)[0] == inc
- && !strcmp (SYMBOL_NAME (sym), name)
- && SYMBOL_NAMESPACE (sym) == namespace)
- {
- if (SYMBOL_CLASS (sym) == LOC_ARG
- || SYMBOL_CLASS (sym) == LOC_REF_ARG
- || SYMBOL_CLASS (sym) == LOC_REGPARM)
- parameter_sym = sym;
- else
- return sym;
- }
- bot++;
- }
- return parameter_sym; /* Will be 0 if not found. */
-}
-
-/* Return the symbol for the function which contains a specified
- lexical block, described by a struct block BL. */
-
-struct symbol *
-block_function (bl)
- struct block *bl;
-{
- while (BLOCK_FUNCTION (bl) == 0 && BLOCK_SUPERBLOCK (bl) != 0)
- bl = BLOCK_SUPERBLOCK (bl);
-
- return BLOCK_FUNCTION (bl);
-}
-
-/* Subroutine of find_pc_line */
-
-struct symtab *
-find_pc_symtab (pc)
- register CORE_ADDR pc;
-{
- register struct block *b;
- struct blockvector *bv;
- register struct symtab *s;
- register struct partial_symtab *ps;
-
- /* Search all symtabs for one whose file contains our pc */
-
- for (s = symtab_list; s; s = s->next)
- {
- bv = BLOCKVECTOR (s);
- b = BLOCKVECTOR_BLOCK (bv, 0);
- if (BLOCK_START (b) <= pc
- && BLOCK_END (b) > pc)
- break;
- }
-
- if (!s)
- {
- ps = find_pc_psymtab (pc);
- if (ps && ps->readin)
- fatal ("Internal error: pc in read in psymtab, but not in symtab.");
-
- if (ps)
- s = psymtab_to_symtab (ps);
- }
-
- return s;
-}
-
-/* Find the source file and line number for a given PC value.
- Return a structure containing a symtab pointer, a line number,
- and a pc range for the entire source line.
- The value's .pc field is NOT the specified pc.
- NOTCURRENT nonzero means, if specified pc is on a line boundary,
- use the line that ends there. Otherwise, in that case, the line
- that begins there is used. */
-
-struct symtab_and_line
-find_pc_line (pc, notcurrent)
- CORE_ADDR pc;
- int notcurrent;
-{
- struct symtab *s;
- register struct linetable *l;
- register int len;
- register int i;
- register struct linetable_entry *item;
- struct symtab_and_line value;
- struct blockvector *bv;
-
- /* Info on best line seen so far, and where it starts, and its file. */
-
- int best_line = 0;
- CORE_ADDR best_pc = 0;
- CORE_ADDR best_end = 0;
- struct symtab *best_symtab = 0;
-
- /* Store here the first line number
- of a file which contains the line at the smallest pc after PC.
- If we don't find a line whose range contains PC,
- we will use a line one less than this,
- with a range from the start of that file to the first line's pc. */
- int alt_line = 0;
- CORE_ADDR alt_pc = 0;
- struct symtab *alt_symtab = 0;
-
- /* Info on best line seen in this file. */
-
- int prev_line;
- CORE_ADDR prev_pc;
-
- /* Info on first line of this file. */
-
- int first_line;
- CORE_ADDR first_pc;
-
- /* If this pc is not from the current frame,
- it is the address of the end of a call instruction.
- Quite likely that is the start of the following statement.
- But what we want is the statement containing the instruction.
- Fudge the pc to make sure we get that. */
-
- if (notcurrent) pc -= 1;
-
- s = find_pc_symtab (pc);
- if (s == 0)
- {
- value.symtab = 0;
- value.line = 0;
- value.pc = pc;
- value.end = 0;
- return value;
- }
-
- bv = BLOCKVECTOR (s);
-
- /* Look at all the symtabs that share this blockvector.
- They all have the same apriori range, that we found was right;
- but they have different line tables. */
-
- for (; s && BLOCKVECTOR (s) == bv; s = s->next)
- {
- /* Find the best line in this symtab. */
- l = LINETABLE (s);
- len = l->nitems;
- prev_line = -1;
- first_line = -1;
- for (i = 0; i < len; i++)
- {
- item = &(l->item[i]);
-
- if (first_line < 0)
- {
- first_line = item->line;
- first_pc = item->pc;
- }
- /* Return the last line that did not start after PC. */
- if (pc >= item->pc)
- {
- prev_line = item->line;
- prev_pc = item->pc;
- }
- else
- break;
- }
-
- /* Is this file's best line closer than the best in the other files?
- If so, record this file, and its best line, as best so far. */
- if (prev_line >= 0 && prev_pc > best_pc)
- {
- best_pc = prev_pc;
- best_line = prev_line;
- best_symtab = s;
- if (i < len)
- best_end = item->pc;
- else
- best_end = 0;
- }
- /* Is this file's first line closer than the first lines of other files?
- If so, record this file, and its first line, as best alternate. */
- if (first_line >= 0 && first_pc > pc
- && (alt_pc == 0 || first_pc < alt_pc))
- {
- alt_pc = first_pc;
- alt_line = first_line;
- alt_symtab = s;
- }
- }
- if (best_symtab == 0)
- {
- value.symtab = alt_symtab;
- value.line = alt_line - 1;
- value.pc = BLOCK_END (BLOCKVECTOR_BLOCK (bv, 0));
- value.end = alt_pc;
- }
- else
- {
- value.symtab = best_symtab;
- value.line = best_line;
- value.pc = best_pc;
- value.end = (best_end ? best_end
- : (alt_pc ? alt_pc
- : BLOCK_END (BLOCKVECTOR_BLOCK (bv, 0))));
- }
- return value;
-}
-
-/* Find the PC value for a given source file and line number.
- Returns zero for invalid line number.
- The source file is specified with a struct symtab. */
-
-CORE_ADDR
-find_line_pc (symtab, line)
- struct symtab *symtab;
- int line;
-{
- register struct linetable *l;
- register int index;
- int dummy;
-
- if (symtab == 0)
- return 0;
- l = LINETABLE (symtab);
- index = find_line_common(l, line, &dummy);
- return index ? l->item[index].pc : 0;
-}
-
-/* Find the range of pc values in a line.
- Store the starting pc of the line into *STARTPTR
- and the ending pc (start of next line) into *ENDPTR.
- Returns 1 to indicate success.
- Returns 0 if could not find the specified line. */
-
-int
-find_line_pc_range (symtab, thisline, startptr, endptr)
- struct symtab *symtab;
- int thisline;
- CORE_ADDR *startptr, *endptr;
-{
- register struct linetable *l;
- register int index;
- int exact_match; /* did we get an exact linenumber match */
- register CORE_ADDR prev_pc;
- CORE_ADDR last_pc;
-
- if (symtab == 0)
- return 0;
-
- l = LINETABLE (symtab);
- index = find_line_common (l, thisline, &exact_match);
- if (index)
- {
- *startptr = l->item[index].pc;
- /* If we have not seen an entry for the specified line,
- assume that means the specified line has zero bytes. */
- if (!exact_match || index == l->nitems-1)
- *endptr = *startptr;
- else
- /* Perhaps the following entry is for the following line.
- It's worth a try. */
- if (l->item[index+1].line == thisline + 1)
- *endptr = l->item[index+1].pc;
- else
- *endptr = find_line_pc (symtab, thisline+1);
- return 1;
- }
-
- return 0;
-}
-
-/* Given a line table and a line number, return the index into the line
- table for the pc of the nearest line whose number is >= the specified one.
- Return 0 if none is found. The value is never zero is it is an index.
-
- Set *EXACT_MATCH nonzero if the value returned is an exact match. */
-
-static int
-find_line_common (l, lineno, exact_match)
- register struct linetable *l;
- register int lineno;
- int *exact_match;
-{
- register int i;
- register int len;
-
- /* BEST is the smallest linenumber > LINENO so far seen,
- or 0 if none has been seen so far.
- BEST_INDEX identifies the item for it. */
-
- int best_index = 0;
- int best = 0;
-
- int nextline = -1;
-
- if (lineno <= 0)
- return 0;
-
- len = l->nitems;
- for (i = 0; i < len; i++)
- {
- register struct linetable_entry *item = &(l->item[i]);
-
- if (item->line == lineno)
- {
- *exact_match = 1;
- return i;
- }
-
- if (item->line > lineno && (best == 0 || item->line < best))
- {
- best = item->line;
- best_index = i;
- }
- }
-
- /* If we got here, we didn't get an exact match. */
-
- *exact_match = 0;
- return best_index;
-}
-
-int
-find_pc_line_pc_range (pc, startptr, endptr)
- CORE_ADDR pc;
- CORE_ADDR *startptr, *endptr;
-{
- struct symtab_and_line sal;
- sal = find_pc_line (pc, 0);
- *startptr = sal.pc;
- *endptr = sal.end;
- return sal.symtab != 0;
-}
-
-/* Parse a string that specifies a line number.
- Pass the address of a char * variable; that variable will be
- advanced over the characters actually parsed.
-
- The string can be:
-
- LINENUM -- that line number in current file. PC returned is 0.
- FILE:LINENUM -- that line in that file. PC returned is 0.
- FUNCTION -- line number of openbrace of that function.
- PC returned is the start of the function.
- FILE:FUNCTION -- likewise, but prefer functions in that file.
- *EXPR -- line in which address EXPR appears.
-
- FUNCTION may be an undebuggable function found in misc_function_vector.
-
- If the argument FUNFIRSTLINE is nonzero, we want the first line
- of real code inside a function when a function is specified.
-
- DEFAULT_SYMTAB specifies the file to use if none is specified.
- It defaults to current_source_symtab.
- DEFAULT_LINE specifies the line number to use for relative
- line numbers (that start with signs). Defaults to current_source_line.
-
- Note that it is possible to return zero for the symtab
- if no file is validly specified. Callers must check that.
- Also, the line number returned may be invalid. */
-
-struct symtabs_and_lines
-decode_line_1 (argptr, funfirstline, default_symtab, default_line)
- char **argptr;
- int funfirstline;
- struct symtab *default_symtab;
- int default_line;
-{
- struct symtabs_and_lines decode_line_2 ();
- struct symtabs_and_lines values;
- struct symtab_and_line value;
- register char *p, *p1;
- register struct symtab *s;
- register struct symbol *sym;
- register CORE_ADDR pc;
- register int i;
- char *copy;
- struct symbol *sym_class;
- char *class_name, *method_name, *phys_name;
- int method_counter;
- int i1;
- struct symbol **sym_arr;
- struct type *t, *field;
- char **physnames;
-
- /* Defaults have defaults. */
-
- if (default_symtab == 0)
- {
- default_symtab = current_source_symtab;
- default_line = current_source_line;
- }
-
- /* See if arg is *PC */
-
- if (**argptr == '*')
- {
- (*argptr)++;
- pc = parse_and_eval_address_1 (argptr);
- values.sals = (struct symtab_and_line *)
- malloc (sizeof (struct symtab_and_line));
- values.nelts = 1;
- values.sals[0] = find_pc_line (pc, 0);
- values.sals[0].pc = pc;
- return values;
- }
-
- /* Maybe arg is FILE : LINENUM or FILE : FUNCTION */
-
- s = 0;
-
- for (p = *argptr; *p; p++)
- {
- if (p[0] == ':' || p[0] == ' ' || p[0] == '\t')
- break;
- }
- while (p[0] == ' ' || p[0] == '\t') p++;
-
- if (p[0] == ':')
- {
-
- /* C++ */
- if (p[1] ==':')
- {
- /* Extract the class name. */
- p1 = p;
- while (p != *argptr && p[-1] == ' ') --p;
- copy = (char *) alloca (p - *argptr + 1);
- bcopy (*argptr, copy, p - *argptr);
- copy[p - *argptr] = 0;
-
- /* Discard the class name from the arg. */
- p = p1 + 2;
- while (*p == ' ' || *p == '\t') p++;
- *argptr = p;
-
- sym_class = lookup_symbol (copy, 0, STRUCT_NAMESPACE, 0);
-
- if (sym_class &&
- (TYPE_CODE (SYMBOL_TYPE (sym_class)) == TYPE_CODE_STRUCT
- || TYPE_CODE (SYMBOL_TYPE (sym_class)) == TYPE_CODE_UNION))
- {
- /* Arg token is not digits => try it as a function name
- Find the next token (everything up to end or next whitespace). */
- p = *argptr;
- while (*p && *p != ' ' && *p != '\t' && *p != ',' && *p !=':') p++;
- copy = (char *) alloca (p - *argptr + 1);
- bcopy (*argptr, copy, p - *argptr);
- copy[p - *argptr] = '\0';
-
- /* no line number may be specified */
- while (*p == ' ' || *p == '\t') p++;
- *argptr = p;
-
- sym = 0;
- i1 = 0; /* counter for the symbol array */
- t = SYMBOL_TYPE (sym_class);
- sym_arr = (struct symbol **) alloca(TYPE_NFN_FIELDS_TOTAL (t) * sizeof(struct symbol*));
- physnames = (char **) alloca (TYPE_NFN_FIELDS_TOTAL (t) * sizeof(char*));
-
- if (destructor_name_p (copy, t))
- {
- /* destructors are a special case. */
- struct fn_field *f = TYPE_FN_FIELDLIST1 (t, 0);
- int len = TYPE_FN_FIELDLIST_LENGTH (t, 0) - 1;
- phys_name = TYPE_FN_FIELD_PHYSNAME (f, len);
- physnames[i1] = (char *)alloca (strlen (phys_name) + 1);
- strcpy (physnames[i1], phys_name);
- sym_arr[i1] = lookup_symbol (phys_name, SYMBOL_BLOCK_VALUE (sym_class), VAR_NAMESPACE, 0);
- if (sym_arr[i1]) i1++;
- }
- else while (t)
- {
- class_name = TYPE_NAME (t);
- /* Ignore this class if it doesn't have a name.
- This prevents core dumps, but is just a workaround
- because we might not find the function in
- certain cases, such as
- struct D {virtual int f();}
- struct C : D {virtual int g();}
- (in this case g++ 1.35.1- does not put out a name
- for D as such, it defines type 19 (for example) in
- the same stab as C, and then does a
- .stabs "D:T19" and a .stabs "D:t19".
- Thus
- "break C::f" should not be looking for field f in
- the class named D,
- but just for the field f in the baseclasses of C
- (no matter what their names).
-
- However, I don't know how to replace the code below
- that depends on knowing the name of D. */
- if (class_name)
- {
- /* We just want the class name. In the context
- of C++, stripping off "struct " is always
- sensible. */
- if (strncmp("struct ", class_name, 7) == 0)
- class_name += 7;
- if (strncmp("union ", class_name, 6) == 0)
- class_name += 6;
-
- sym_class = lookup_symbol (class_name, 0, STRUCT_NAMESPACE, 0);
- for (method_counter = TYPE_NFN_FIELDS (SYMBOL_TYPE (sym_class)) - 1;
- method_counter >= 0;
- --method_counter)
- {
- int field_counter;
- struct fn_field *f =
- TYPE_FN_FIELDLIST1 (SYMBOL_TYPE (sym_class), method_counter);
-
- method_name = TYPE_FN_FIELDLIST_NAME (SYMBOL_TYPE (sym_class), method_counter);
- if (!strcmp (copy, method_name))
- /* Find all the fields with that name. */
- for (field_counter = TYPE_FN_FIELDLIST_LENGTH (SYMBOL_TYPE (sym_class), method_counter) - 1;
- field_counter >= 0;
- --field_counter)
- {
- phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter);
- physnames[i1] = (char*) alloca (strlen (phys_name) + 1);
- strcpy (physnames[i1], phys_name);
- sym_arr[i1] = lookup_symbol (phys_name, SYMBOL_BLOCK_VALUE (sym_class), VAR_NAMESPACE, 0);
- if (sym_arr[i1]) i1++;
- }
- }
- }
- if (TYPE_N_BASECLASSES (t))
- t = TYPE_BASECLASS(t, 1);
- else
- break;
- }
-
- if (i1 == 1)
- {
- /* There is exactly one field with that name. */
- sym = sym_arr[0];
-
- if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
- {
- /* Arg is the name of a function */
- pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym)) + FUNCTION_START_OFFSET;
- if (funfirstline)
- SKIP_PROLOGUE (pc);
- values.sals = (struct symtab_and_line *)malloc (sizeof (struct symtab_and_line));
- values.nelts = 1;
- values.sals[0] = find_pc_line (pc, 0);
- values.sals[0].pc = (values.sals[0].end && values.sals[0].pc != pc) ? values.sals[0].end : pc;
- }
- else
- {
- values.nelts = 0;
- }
- return values;
- }
- if (i1 > 0)
- {
- /* There is more than one field with that name
- (overloaded). Ask the user which one to use. */
- return decode_line_2 (argptr, sym_arr, physnames,
- i1, funfirstline);
- }
- else
- error ("that class does not have any method named %s",copy);
- }
- else
- error("no class, struct, or union named %s", copy );
- }
- /* end of C++ */
-
-
- /* Extract the file name. */
- p1 = p;
- while (p != *argptr && p[-1] == ' ') --p;
- copy = (char *) alloca (p - *argptr + 1);
- bcopy (*argptr, copy, p - *argptr);
- copy[p - *argptr] = 0;
-
- /* Find that file's data. */
- s = lookup_symtab (copy);
- if (s == 0)
- {
- if (symtab_list == 0 && partial_symtab_list == 0)
- error ("No symbol table is loaded. Use the \"symbol-file\" command.");
- error ("No source file named %s.", copy);
- }
-
- /* Discard the file name from the arg. */
- p = p1 + 1;
- while (*p == ' ' || *p == '\t') p++;
- *argptr = p;
- }
-
- /* S is specified file's symtab, or 0 if no file specified.
- arg no longer contains the file name. */
-
- /* Check whether arg is all digits (and sign) */
-
- p = *argptr;
- if (*p == '-' || *p == '+') p++;
- while (*p >= '0' && *p <= '9')
- p++;
-
- if (p != *argptr && (*p == 0 || *p == ' ' || *p == '\t' || *p == ','))
- {
- /* We found a token consisting of all digits -- at least one digit. */
- enum sign {none, plus, minus} sign = none;
-
- /* This is where we need to make sure that we have good defaults.
- We must guarrantee that this section of code is never executed
- when we are called with just a function name, since
- select_source_symtab calls us with such an argument */
-
- if (s == 0 && default_symtab == 0)
- {
- if (symtab_list == 0 && partial_symtab_list == 0)
- error ("No symbol table is loaded. Use the \"symbol-file\" command.");
- select_source_symtab (0);
- default_symtab = current_source_symtab;
- default_line = current_source_line;
- }
-
- if (**argptr == '+')
- sign = plus, (*argptr)++;
- else if (**argptr == '-')
- sign = minus, (*argptr)++;
- value.line = atoi (*argptr);
- switch (sign)
- {
- case plus:
- if (p == *argptr)
- value.line = 5;
- if (s == 0)
- value.line = default_line + value.line;
- break;
- case minus:
- if (p == *argptr)
- value.line = 15;
- if (s == 0)
- value.line = default_line - value.line;
- else
- value.line = 1;
- break;
- }
-
- while (*p == ' ' || *p == '\t') p++;
- *argptr = p;
- if (s == 0)
- s = default_symtab;
- value.symtab = s;
- value.pc = 0;
- values.sals = (struct symtab_and_line *)malloc (sizeof (struct symtab_and_line));
- values.sals[0] = value;
- values.nelts = 1;
- return values;
- }
-
- /* Arg token is not digits => try it as a function name
- Find the next token (everything up to end or next whitespace). */
- p = *argptr;
- while (*p && *p != ' ' && *p != '\t' && *p != ',') p++;
- copy = (char *) alloca (p - *argptr + 1);
- bcopy (*argptr, copy, p - *argptr);
- copy[p - *argptr] = 0;
- while (*p == ' ' || *p == '\t') p++;
- *argptr = p;
-
- /* Look up that token as a function.
- If file specified, use that file's per-file block to start with. */
-
- if (s == 0)
- /* use current file as default if none is specified. */
- s = default_symtab;
-
- sym = lookup_symbol (copy, s ? BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), 1) : 0,
- VAR_NAMESPACE, 0);
-
- if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
- {
- /* Arg is the name of a function */
- pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym)) + FUNCTION_START_OFFSET;
- if (funfirstline)
- SKIP_PROLOGUE (pc);
- value = find_pc_line (pc, 0);
-#ifdef PROLOGUE_FIRSTLINE_OVERLAP
- /* Convex: no need to suppress code on first line, if any */
- value.pc = pc;
-#else
- value.pc = (value.end && value.pc != pc) ? value.end : pc;
-#endif
- values.sals = (struct symtab_and_line *)malloc (sizeof (struct symtab_and_line));
- values.sals[0] = value;
- values.nelts = 1;
- return values;
- }
-
- if (sym)
- error ("%s is not a function.", copy);
-
- if (symtab_list == 0 && partial_symtab_list == 0)
- error ("No symbol table is loaded. Use the \"symbol-file\" command.");
-
- if ((i = lookup_misc_func (copy)) >= 0)
- {
- value.symtab = 0;
- value.line = 0;
- value.pc = misc_function_vector[i].address + FUNCTION_START_OFFSET;
- if (funfirstline)
- SKIP_PROLOGUE (value.pc);
- values.sals = (struct symtab_and_line *)malloc (sizeof (struct symtab_and_line));
- values.sals[0] = value;
- values.nelts = 1;
- return values;
- }
-
- error ("Function %s not defined.", copy);
-}
-
-struct symtabs_and_lines
-decode_line_spec (string, funfirstline)
- char *string;
- int funfirstline;
-{
- struct symtabs_and_lines sals;
- if (string == 0)
- error ("Empty line specification.");
- sals = decode_line_1 (&string, funfirstline,
- current_source_symtab, current_source_line);
- if (*string)
- error ("Junk at end of line specification: %s", string);
- return sals;
-}
-
-/* Given a list of NELTS symbols in sym_arr (with corresponding
- mangled names in physnames), return a list of lines to operate on
- (ask user if necessary). */
-struct symtabs_and_lines
-decode_line_2 (argptr, sym_arr, physnames, nelts, funfirstline)
- char **argptr;
- struct symbol *sym_arr[];
- char *physnames[];
- int nelts;
- int funfirstline;
-{
- char *getenv();
- struct symtabs_and_lines values, return_values;
- register CORE_ADDR pc;
- char *args, *arg1, *command_line_input ();
- int i;
- char *prompt;
-
- values.sals = (struct symtab_and_line *) alloca (nelts * sizeof(struct symtab_and_line));
- return_values.sals = (struct symtab_and_line *) malloc (nelts * sizeof(struct symtab_and_line));
-
- i = 0;
- printf("[0] cancel\n[1] all\n");
- while (i < nelts)
- {
- if (sym_arr[i] && SYMBOL_CLASS (sym_arr[i]) == LOC_BLOCK)
- {
- /* Arg is the name of a function */
- pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym_arr[i]))
- + FUNCTION_START_OFFSET;
- if (funfirstline)
- SKIP_PROLOGUE (pc);
- values.sals[i] = find_pc_line (pc, 0);
- values.sals[i].pc = (values.sals[i].end && values.sals[i].pc != pc) ? values.sals[i].end : pc;
- printf("[%d] file:%s; line number:%d\n",
- (i+2), values.sals[i].symtab->filename, values.sals[i].line);
- }
- else printf ("?HERE\n");
- i++;
- }
-
- if ((prompt = getenv ("PS2")) == NULL)
- {
- prompt = ">";
- }
- printf("%s ",prompt);
- fflush(stdout);
-
- args = command_line_input (0, 0);
-
- if (args == 0)
- error_no_arg ("one or more choice numbers");
-
- i = 0;
- while (*args)
- {
- int num;
-
- arg1 = args;
- while (*arg1 >= '0' && *arg1 <= '9') arg1++;
- if (*arg1 && *arg1 != ' ' && *arg1 != '\t')
- error ("Arguments must be choice numbers.");
-
- num = atoi (args);
-
- if (num == 0)
- error ("cancelled");
- else if (num == 1)
- {
- bcopy (values.sals, return_values.sals, (nelts * sizeof(struct symtab_and_line)));
- return_values.nelts = nelts;
- return return_values;
- }
-
- if (num > nelts + 2)
- {
- printf ("No choice number %d.\n", num);
- }
- else
- {
- num -= 2;
- if (values.sals[num].pc)
- {
- return_values.sals[i++] = values.sals[num];
- values.sals[num].pc = 0;
- }
- else
- {
- printf ("duplicate request for %d ignored.\n", num);
- }
- }
-
- args = arg1;
- while (*args == ' ' || *args == '\t') args++;
- }
- return_values.nelts = i;
- return return_values;
-}
-
-/* hash a symbol ("hashpjw" from Aho, Sethi & Ullman, p.436) */
-
-int
-hash_symbol(str)
- register char *str;
-{
- register unsigned int h = 0, g;
- register unsigned char c;
-
- while (c = *(unsigned char *)str++) {
- h = (h << 4) + c;
- if (g = h & 0xf0000000) {
- h = h ^ (g >> 24);
- h = h ^ g;
- }
- }
- return ((int)h);
-}
-
-/* Return the index of misc function named NAME. */
-
-int
-lookup_misc_func (name)
- register char *name;
-{
- register int i = hash_symbol(name) & (MISC_FUNC_HASH_SIZE - 1);
-
- if (misc_function_vector == 0)
- error("No symbol file");
-
- i = misc_function_hash_tab[i];
- while (i >= 0)
- {
- if (strcmp(misc_function_vector[i].name, name) == 0)
- break;
- i = misc_function_vector[i].next;
- }
- return (i);
-}
-
-/*
- * Slave routine for sources_info. Force line breaks at ,'s.
- */
-static void
-output_source_filename (name, next)
-char *name;
-int next;
-{
- static int column = 0;
-
- if (column != 0 && column + strlen (name) >= 70)
- {
- printf_filtered ("\n");
- column = 0;
- }
- else if (column != 0)
- {
- printf_filtered (" ");
- column++;
- }
- printf_filtered ("%s", name);
- column += strlen (name);
- if (next)
- {
- printf_filtered (",");
- column++;
- }
-
- if (!next) column = 0;
-}
-
-static void
-sources_info ()
-{
- register struct symtab *s;
- register struct partial_symtab *ps;
- register int column = 0;
-
- if (symtab_list == 0 && partial_symtab_list == 0)
- {
- printf ("No symbol table is loaded.\n");
- return;
- }
-
- printf_filtered ("Source files for which symbols have been read in:\n\n");
-
- for (s = symtab_list; s; s = s->next)
- output_source_filename (s->filename, s->next);
- printf_filtered ("\n\n");
-
- printf_filtered ("Source files for which symbols will be read in on demand:\n\n");
-
- for (ps = partial_symtab_list; ps; ps = ps->next)
- if (!ps->readin)
- output_source_filename (ps->filename, ps->next);
- printf_filtered ("\n");
-}
-
-/* List all symbols (if REGEXP is 0) or all symbols matching REGEXP.
- If CLASS is zero, list all symbols except functions and type names.
- If CLASS is 1, list only functions.
- If CLASS is 2, list only type names. */
-
-static void sort_block_syms ();
-
-static void
-list_symbols (regexp, class)
- char *regexp;
- int class;
-{
- register struct symtab *s;
- register struct partial_symtab *ps;
- register struct blockvector *bv;
- struct blockvector *prev_bv = 0;
- register struct block *b;
- register int i, j;
- register struct symbol *sym;
- struct partial_symbol *psym, *bound;
- char *val;
- static char *classnames[]
- = {"variable", "function", "type", "method"};
- int print_count = 0;
- int found_in_file = 0;
-
- if (regexp)
- if (val = (char *) re_comp (regexp))
- error ("Invalid regexp: %s", val);
-
- /* Search through the partial_symtab_list *first* for all symbols
- matching the regexp. That way we don't have to reproduce all of
- the machinery below. */
- for (psym = global_psymbols.list, bound = global_psymbols.next; ;
- psym = static_psymbols.list, bound = static_psymbols.next)
- {
- for (; psym < bound; ++psym)
- {
- if (psym->pst->readin)
- continue;
-
- QUIT;
- /* If it would match (logic taken from loop below)
- load the file and go on to the next one */
- if ((regexp == 0 || re_exec (SYMBOL_NAME (psym)))
- && ((class == 0 && SYMBOL_CLASS (psym) != LOC_TYPEDEF
- && SYMBOL_CLASS (psym) != LOC_BLOCK)
- || (class == 1 && SYMBOL_CLASS (psym) == LOC_BLOCK)
- || (class == 2 && SYMBOL_CLASS (psym) == LOC_TYPEDEF)
- || (class == 3 && SYMBOL_CLASS (psym) == LOC_BLOCK)))
- psymtab_to_symtab(psym->pst);
- }
- if (psym == static_psymbols.next)
- break;
- }
-
- /* Printout here so as to get after the "Reading in symbols"
- messages which will be generated above. */
- printf_filtered (regexp
- ? "All %ss matching regular expression \"%s\":\n"
- : "All defined %ss:\n",
- classnames[class],
- regexp);
-
- /* Here, *if* the class is correct (function only, right now), we
- should search through the misc function vector for symbols that
- match and call find_pc_psymtab on them. If find_pc_psymtab returns
- 0, don't worry about it (already read in or no debugging info). */
-
- if (class == 1)
- {
- for (i = 0; i < misc_function_count; i++)
- if (regexp == 0 || re_exec (misc_function_vector[i].name))
- {
- ps = find_pc_psymtab (misc_function_vector[i].address);
- if (ps && !ps->readin)
- psymtab_to_symtab (ps);
- }
- }
-
- for (s = symtab_list; s; s = s->next)
- {
- found_in_file = 0;
- bv = BLOCKVECTOR (s);
- /* Often many files share a blockvector.
- Scan each blockvector only once so that
- we don't get every symbol many times.
- It happens that the first symtab in the list
- for any given blockvector is the main file. */
- if (bv != prev_bv)
- for (i = 0; i < 2; i++)
- {
- b = BLOCKVECTOR_BLOCK (bv, i);
- /* Skip the sort if this block is always sorted. */
- if (!BLOCK_SHOULD_SORT (b))
- sort_block_syms (b);
- for (j = 0; j < BLOCK_NSYMS (b); j++)
- {
- QUIT;
- sym = BLOCK_SYM (b, j);
- if ((regexp == 0 || re_exec (SYMBOL_NAME (sym)))
- && ((class == 0 && SYMBOL_CLASS (sym) != LOC_TYPEDEF
- && SYMBOL_CLASS (sym) != LOC_BLOCK)
- || (class == 1 && SYMBOL_CLASS (sym) == LOC_BLOCK)
- || (class == 2 && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
- || (class == 3 && SYMBOL_CLASS (sym) == LOC_BLOCK)))
- {
- if (!found_in_file)
- {
- printf_filtered ("\nFile %s:\n", s->filename);
- print_count += 2;
- }
- found_in_file = 1;
- if (class != 2 && i == 1)
- printf_filtered ("static ");
- if (class == 2
- && SYMBOL_NAMESPACE (sym) != STRUCT_NAMESPACE)
- printf_filtered ("typedef ");
-
- if (class < 3)
- {
- type_print (SYMBOL_TYPE (sym),
- (SYMBOL_CLASS (sym) == LOC_TYPEDEF
- ? "" : SYMBOL_NAME (sym)),
- stdout, 0);
-
- if (class == 2
- && SYMBOL_NAMESPACE (sym) != STRUCT_NAMESPACE
- && (TYPE_NAME ((SYMBOL_TYPE (sym))) == 0
- || 0 != strcmp (TYPE_NAME ((SYMBOL_TYPE (sym))),
- SYMBOL_NAME (sym))))
- printf_filtered (" %s", SYMBOL_NAME (sym));
-
- printf_filtered (";\n");
- }
- else
- {
-# if 0
- char buf[1024];
- type_print_base (TYPE_FN_FIELD_TYPE(t, i), stdout, 0, 0);
- type_print_varspec_prefix (TYPE_FN_FIELD_TYPE(t, i), stdout, 0);
- sprintf (buf, " %s::", TYPE_NAME (t));
- type_print_method_args (TYPE_FN_FIELD_ARGS (t, i), buf, name, stdout);
-# endif
- }
- }
- }
- }
- prev_bv = bv;
- }
-}
-
-static void
-variables_info (regexp)
- char *regexp;
-{
- list_symbols (regexp, 0);
-}
-
-static void
-functions_info (regexp)
- char *regexp;
-{
- list_symbols (regexp, 1);
-}
-
-static void
-types_info (regexp)
- char *regexp;
-{
- list_symbols (regexp, 2);
-}
-
-#if 0
-/* Tiemann says: "info methods was never implemented." */
-static void
-methods_info (regexp)
- char *regexp;
-{
- list_symbols (regexp, 3);
-}
-#endif /* 0 */
-
-/* Call sort_block_syms to sort alphabetically the symbols of one block. */
-
-static int
-compare_symbols (s1, s2)
- struct symbol **s1, **s2;
-{
- /* Names that are less should come first. */
- register int namediff = strcmp (SYMBOL_NAME (*s1), SYMBOL_NAME (*s2));
- if (namediff != 0) return namediff;
- /* For symbols of the same name, registers should come first. */
- return ((SYMBOL_CLASS (*s2) == LOC_REGISTER)
- - (SYMBOL_CLASS (*s1) == LOC_REGISTER));
-}
-
-static void
-sort_block_syms (b)
- register struct block *b;
-{
- qsort (&BLOCK_SYM (b, 0), BLOCK_NSYMS (b),
- sizeof (struct symbol *), compare_symbols);
-}
-
-/* Initialize the standard C scalar types. */
-
-static
-struct type *
-init_type (code, length, uns, name)
- enum type_code code;
- int length, uns;
- char *name;
-{
- register struct type *type;
-
- type = (struct type *) xmalloc (sizeof (struct type));
- bzero (type, sizeof *type);
- TYPE_MAIN_VARIANT (type) = type;
- TYPE_CODE (type) = code;
- TYPE_LENGTH (type) = length;
- TYPE_FLAGS (type) = uns ? TYPE_FLAG_UNSIGNED : 0;
- TYPE_FLAGS (type) |= TYPE_FLAG_PERM;
- TYPE_NFIELDS (type) = 0;
- TYPE_NAME (type) = name;
-
- /* C++ fancies. */
- TYPE_NFN_FIELDS (type) = 0;
- TYPE_N_BASECLASSES (type) = 0;
- TYPE_BASECLASSES (type) = 0;
- return type;
-}
-
-/* Return Nonzero if block a is lexically nested within block b,
- or if a and b have the same pc range.
- Return zero otherwise. */
-int
-contained_in (a, b)
- struct block *a, *b;
-{
- if (!a || !b)
- return 0;
- return a->startaddr >= b->startaddr && a->endaddr <= b->endaddr;
-}
-
-
-/* Helper routine for make_symbol_completion_list. */
-
-int return_val_size, return_val_index;
-char **return_val;
-
-void
-completion_list_add_symbol (symname)
- char *symname;
-{
- if (return_val_index + 3 > return_val_size)
- return_val =
- (char **)xrealloc (return_val,
- (return_val_size *= 2) * sizeof (char *));
-
- return_val[return_val_index] =
- (char *)xmalloc (1 + strlen (symname));
-
- strcpy (return_val[return_val_index], symname);
-
- return_val[++return_val_index] = (char *)NULL;
-}
-
-/* Return a NULL terminated array of all symbols (regardless of class) which
- begin by matching TEXT. If the answer is no symbols, then the return value
- is an array which contains only a NULL pointer.
-
- Problem: All of the symbols have to be copied because readline
- frees them. I'm not going to worry about this; hopefully there
- won't be that many. */
-
-char **
-make_symbol_completion_list (text)
- char *text;
-{
- register struct symtab *s;
- register struct partial_symtab *ps;
- register struct blockvector *bv;
- struct blockvector *prev_bv = 0;
- register struct block *b, *surrounding_static_block;
- extern struct block *get_selected_block ();
- register int i, j;
- register struct symbol *sym;
- struct partial_symbol *psym;
-
- int text_len = strlen (text);
- return_val_size = 100;
- return_val_index = 0;
- return_val =
- (char **)xmalloc ((1 + return_val_size) *sizeof (char *));
- return_val[0] = (char *)NULL;
-
- /* Look through the partial symtabs for all symbols which begin
- by matching TEXT. Add each one that you find to the list. */
-
- for (ps = partial_symtab_list; ps; ps = ps->next)
- {
- /* If the psymtab's been read in we'll get it when we search
- through the blockvector. */
- if (ps->readin) continue;
-
- for (psym = global_psymbols.list + ps->globals_offset;
- psym < (global_psymbols.list + ps->globals_offset
- + ps->n_global_syms);
- psym++)
- {
- QUIT; /* If interrupted, then quit. */
- if ((strncmp (SYMBOL_NAME (psym), text, text_len) == 0))
- completion_list_add_symbol (SYMBOL_NAME (psym));
- }
-
- for (psym = static_psymbols.list + ps->statics_offset;
- psym < (static_psymbols.list + ps->statics_offset
- + ps->n_static_syms);
- psym++)
- {
- QUIT;
- if ((strncmp (SYMBOL_NAME (psym), text, text_len) == 0))
- completion_list_add_symbol (SYMBOL_NAME (psym));
- }
- }
-
- /* At this point scan through the misc function vector and add each
- symbol you find to the list. Eventually we want to ignore
- anything that isn't a text symbol (everything else will be
- handled by the psymtab code above). */
-
- for (i = 0; i < misc_function_count; i++)
- if (!strncmp (text, misc_function_vector[i].name, text_len))
- completion_list_add_symbol (misc_function_vector[i].name);
-
- /* Search upwards from currently selected frame (so that we can
- complete on local vars. */
- for (b = get_selected_block (); b; b = BLOCK_SUPERBLOCK (b))
- {
- if (!BLOCK_SUPERBLOCK (b))
- surrounding_static_block = b; /* For elmin of dups */
-
- /* Also catch fields of types defined in this places which
- match our text string. Only complete on types visible
- from current context. */
- for (i = 0; i < BLOCK_NSYMS (b); i++)
- {
- register struct symbol *sym = BLOCK_SYM (b, i);
-
- if (!strncmp (SYMBOL_NAME (sym), text, text_len))
- completion_list_add_symbol (SYMBOL_NAME (sym));
-
- if (SYMBOL_CLASS (sym) == LOC_TYPEDEF)
- {
- struct type *t = SYMBOL_TYPE (sym);
- enum type_code c = TYPE_CODE (t);
-
- if (c == TYPE_CODE_UNION || c == TYPE_CODE_STRUCT)
- for (j = 0; j < TYPE_NFIELDS (t); j++)
- if (TYPE_FIELD_NAME (t, j) &&
- !strncmp (TYPE_FIELD_NAME (t, j), text, text_len))
- completion_list_add_symbol (TYPE_FIELD_NAME (t, j));
- }
- }
- }
-
- /* Go through the symtabs and check the externs and statics for
- symbols which match. */
-
- for (s = symtab_list; s; s = s->next)
- {
- struct block *b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), 0);
-
- for (i = 0; i < BLOCK_NSYMS (b); i++)
- if (!strncmp (SYMBOL_NAME (BLOCK_SYM (b, i)), text, text_len))
- completion_list_add_symbol (SYMBOL_NAME (BLOCK_SYM (b, i)));
- }
-
- for (s = symtab_list; s; s = s->next)
- {
- struct block *b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), 1);
-
- /* Don't do this block twice. */
- if (b == surrounding_static_block) continue;
-
- for (i = 0; i < BLOCK_NSYMS (b); i++)
- if (!strncmp (SYMBOL_NAME (BLOCK_SYM (b, i)), text, text_len))
- completion_list_add_symbol (SYMBOL_NAME (BLOCK_SYM (b, i)));
- }
-
- return (return_val);
-}
-
-void
-_initialize_symtab ()
-{
- add_info ("variables", variables_info,
- "All global and static variable names, or those matching REGEXP.");
- add_info ("functions", functions_info,
- "All function names, or those matching REGEXP.");
- add_info ("types", types_info,
- "All types names, or those matching REGEXP.");
-#if 0
- add_info ("methods", methods_info,
- "All method names, or those matching REGEXP::REGEXP.\n\
-If the class qualifier is ommited, it is assumed to be the current scope.\n\
-If the first REGEXP is ommited, then all methods matching the second REGEXP\n\
-are listed.");
-#endif
- add_info ("sources", sources_info,
- "Source files in the program.");
-
- obstack_init (symbol_obstack);
- obstack_init (psymbol_obstack);
-
- builtin_type_void = init_type (TYPE_CODE_VOID, 1, 0, "void");
-
- builtin_type_float = init_type (TYPE_CODE_FLT, sizeof (float), 0, "float");
- builtin_type_double = init_type (TYPE_CODE_FLT, sizeof (double), 0, "double");
-
- builtin_type_char = init_type (TYPE_CODE_INT, sizeof (char), 0, "char");
- builtin_type_short = init_type (TYPE_CODE_INT, sizeof (short), 0, "short");
- builtin_type_long = init_type (TYPE_CODE_INT, sizeof (long), 0, "long");
- builtin_type_int = init_type (TYPE_CODE_INT, sizeof (int), 0, "int");
-
- builtin_type_unsigned_char = init_type (TYPE_CODE_INT, sizeof (char), 1, "unsigned char");
- builtin_type_unsigned_short = init_type (TYPE_CODE_INT, sizeof (short), 1, "unsigned short");
- builtin_type_unsigned_long = init_type (TYPE_CODE_INT, sizeof (long), 1, "unsigned long");
- builtin_type_unsigned_int = init_type (TYPE_CODE_INT, sizeof (int), 1, "unsigned int");
-#ifdef LONG_LONG
- builtin_type_long_long =
- init_type (TYPE_CODE_INT, sizeof (long long), 0, "long long");
- builtin_type_unsigned_long_long =
- init_type (TYPE_CODE_INT, sizeof (long long), 1, "unsigned long long");
-#endif
-}
-
diff --git a/gnu/usr.bin/gdb/symtab.h b/gnu/usr.bin/gdb/symtab.h
deleted file mode 100644
index fefed60..0000000
--- a/gnu/usr.bin/gdb/symtab.h
+++ /dev/null
@@ -1,384 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- *
- * @(#)symtab.h 6.3 (Berkeley) 5/8/91
- */
-
-/* Symbol table definitions for GDB.
- Copyright (C) 1986, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <obstack.h>
-
-/* An obstack to hold objects that should be freed
- when we load a new symbol table.
- This includes the symbols made by dbxread
- and the types that are not permanent. */
-
-extern struct obstack *symbol_obstack;
-extern struct obstack *psymbol_obstack;
-
-/* Some definitions and declarations to go with use of obstacks. */
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-extern char *xmalloc ();
-extern void free ();
-
-/* gdb can know one or several symbol tables at the same time;
- the ultimate intent is to have one for each separately-compiled module.
- Each such symbol table is recorded by a struct symtab, and they
- are all chained together. */
-
-/* In addition, gdb can record any number of miscellaneous undebuggable
- functions' addresses. In a system that appends _ to function names,
- the _'s are removed from the names stored in this table. */
-
-/* Actually, the misc function list is used to store *all* of the
- global symbols (text, data, bss, and abs). It is sometimes used
- to figure out what symtabs to read in. The "type" field appears
- never to be used. */
-
-enum misc_function_type {mf_unknown = 0, mf_text, mf_data, mf_bss, mf_abs};
-
-struct misc_function
-{
- char *name;
- CORE_ADDR address;
- int next; /* index of next in this hash bucket */
- unsigned char type; /* Really enum misc_function_type. */
-};
-
-/* Address and length of the vector recording all misc function names/addresses. */
-
-struct misc_function *misc_function_vector;
-int misc_function_count;
-#define MISC_FUNC_HASH_SIZE (2048)
-int misc_function_hash_tab[MISC_FUNC_HASH_SIZE];
-
-#include "symseg.h"
-
-/* Each source file is represented by a struct symtab. */
-/* These objects are chained through the `next' field. */
-
-struct symtab
- {
- /* Chain of all existing symtabs. */
- struct symtab *next;
- /* List of all symbol scope blocks for this symtab. */
- struct blockvector *blockvector;
- /* Table mapping core addresses to line numbers for this file. */
- struct linetable *linetable;
- /* Vector containing all types defined for this symtab. */
- struct typevector *typevector;
- /* Name of this source file. */
- char *filename;
- /* This component says how to free the data we point to:
- free_contents => do a tree walk and free each object.
- free_nothing => do nothing; some other symtab will free
- the data this one uses.
- free_linetable => free just the linetable. */
- enum free_code {free_nothing, free_contents, free_linetable}
- free_code;
- /* Pointer to one block of storage to be freed, if nonzero. */
- char *free_ptr;
- /* Total number of lines found in source file. */
- int nlines;
- /* Array mapping line number to character position. */
- int *line_charpos;
- /* Language of this source file. */
- enum language language;
- /* String of version information. May be zero. */
- char *version;
- /* String of compilation information. May be zero. */
- char *compilation;
- /* Offset within loader symbol table
- of first local symbol for this file. */
- int ldsymoff;
- /* Full name of file as found by searching the source path.
- 0 if not yet known. */
- char *fullname;
- };
-
-/*
- * Each source file that has not been fully read in is represented by
- * a partial_symtab. This contains the information on where in the
- * executable the debugging symbols for a specific file are, and a
- * list of names of global symbols which are located in this file.
- */
-struct partial_symtab
-{
- /* Chain of all existing partial symtabs. */
- struct partial_symtab *next;
- /* Name of the source file which this partial_symtab defines */
- char *filename;
- /* Offset within loader symbol table of first local symbol for this
- file and length (in bytes) of the section of the symbol table
- devoted to this file's symbols (actually, the section bracketed
- may contain more than just this files symbols
- If ldsymlen is 0, the only reason for this things existence is
- the dependency list below. Nothing else will happen when it is
- read in. */
- int ldsymoff, ldsymlen;
- /* Range of text addresses covered by this file; texthigh is the
- beginning of the next section. */
- int textlow, texthigh;
- /* Non-zero if the symtab corresponding to this psymtab has been
- readin */
- unsigned char readin;
- /* Array of pointers to all of the partial_symtab s which this one
- depends one. Since this array can only be set to previous or
- the current (?) psymtab, this dependency tree is guarranteed not
- to have any loops. */
- struct partial_symtab **dependencies;
- int number_of_dependencies;
- /* Global symbol list. This list will be sorted after readin to
- improve access. Binary search will be the usual method of
- finding a symbol within it. globals_offset is an integer offset
- within ps_globals */
- int globals_offset, n_global_syms;
- /* Static symbol list. This list will *not* be sorted after readin;
- to find a symbol in it, exhaustive search must be used. This is
- reasonable because searches through this list will eventually
- lead to either the read in of a files symbols for real (assumed
- to take a *lot* of time; check) or an error (and we don't care
- how long errors take). */
- int statics_offset, n_static_syms;
-};
-
-/* This is the list of struct symtab's that gdb considers current. */
-
-struct symtab *symtab_list;
-
-/* This is the list of struct partial_symtab's that gdb may need to access */
-
-struct partial_symtab *partial_symtab_list;
-
-/* This symtab variable specifies the current file for printing source lines */
-
-struct symtab *current_source_symtab;
-
-/* This is the next line to print for listing source lines. */
-
-int current_source_line;
-
-#define BLOCKLIST(symtab) (symtab)->blockvector
-#define BLOCKVECTOR(symtab) (symtab)->blockvector
-
-#define TYPEVECTOR(symtab) (symtab)->typevector
-
-#define LINELIST(symtab) (symtab)->linetable
-#define LINETABLE(symtab) (symtab)->linetable
-
-/* Macros normally used to access components of symbol table structures. */
-
-#define BLOCKLIST_NBLOCKS(blocklist) (blocklist)->nblocks
-#define BLOCKLIST_BLOCK(blocklist,n) (blocklist)->block[n]
-#define BLOCKVECTOR_NBLOCKS(blocklist) (blocklist)->nblocks
-#define BLOCKVECTOR_BLOCK(blocklist,n) (blocklist)->block[n]
-
-#define TYPEVECTOR_NTYPES(typelist) (typelist)->length
-#define TYPEVECTOR_TYPE(typelist,n) (typelist)->type[n]
-
-#define BLOCK_START(bl) (bl)->startaddr
-#define BLOCK_END(bl) (bl)->endaddr
-#define BLOCK_NSYMS(bl) (bl)->nsyms
-#define BLOCK_SYM(bl, n) (bl)->sym[n]
-#define BLOCK_FUNCTION(bl) (bl)->function
-#define BLOCK_SUPERBLOCK(bl) (bl)->superblock
-#define BLOCK_GCC_COMPILED(bl) (bl)->gcc_compile_flag
-
-/* Nonzero if symbols of block BL should be sorted alphabetically. */
-#define BLOCK_SHOULD_SORT(bl) ((bl)->nsyms >= 40)
-
-#define SYMBOL_NAME(symbol) (symbol)->name
-#define SYMBOL_NAMESPACE(symbol) (symbol)->namespace
-#define SYMBOL_CLASS(symbol) (symbol)->class
-#define SYMBOL_VALUE(symbol) (symbol)->value.value
-#define SYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes
-#define SYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block
-#define SYMBOL_TYPE(symbol) (symbol)->type
-
-/* Some macros for bitfields. */
-#define B_SET(a,x) (a[x>>5] |= (1 << (x&31)))
-#define B_CLR(a,x) (a[x>>5] &= ~(1 << (x&31)))
-#define B_TST(a,x) (a[x>>5] & (1 << (x&31)))
-
-#define TYPE_NAME(thistype) (thistype)->name
-#define TYPE_TARGET_TYPE(thistype) (thistype)->target_type
-#define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
-#define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
-#define TYPE_FUNCTION_TYPE(thistype) (thistype)->function_type
-#define TYPE_MAIN_VARIANT(thistype) (thistype)->main_variant
-#define TYPE_NEXT_VARIANT(thistype) (thistype)->next_variant
-#define TYPE_LENGTH(thistype) (thistype)->length
-#define TYPE_FLAGS(thistype) (thistype)->flags
-#define TYPE_UNSIGNED(thistype) ((thistype)->flags & TYPE_FLAG_UNSIGNED)
-#define TYPE_CODE(thistype) (thistype)->code
-#define TYPE_NFIELDS(thistype) (thistype)->nfields
-#define TYPE_FIELDS(thistype) (thistype)->fields
-/* C++ */
-#define TYPE_VPTR_BASETYPE(thistype) (thistype)->vptr_basetype
-#define TYPE_DOMAIN_TYPE(thistype) (thistype)->vptr_basetype
-#define TYPE_VPTR_FIELDNO(thistype) (thistype)->vptr_fieldno
-#define TYPE_FN_FIELDS(thistype) (thistype)->fn_fields
-#define TYPE_NFN_FIELDS(thistype) (thistype)->nfn_fields
-#define TYPE_NFN_FIELDS_TOTAL(thistype) (thistype)->nfn_fields_total
-#define TYPE_BASECLASSES(thistype) (thistype)->baseclasses
-#define TYPE_ARG_TYPES(thistype) (thistype)->arg_types
-#define TYPE_BASECLASS(thistype,index) (thistype)->baseclasses[index]
-#define TYPE_N_BASECLASSES(thistype) (thistype)->n_baseclasses
-#define TYPE_VIA_PUBLIC(thistype) ((thistype)->flags & TYPE_FLAG_VIA_PUBLIC)
-#define TYPE_VIA_VIRTUAL(thistype) ((thistype)->flags & TYPE_FLAG_VIA_VIRTUAL)
-
-#define TYPE_FIELD(thistype, n) (thistype)->fields[n]
-#define TYPE_FIELD_TYPE(thistype, n) (thistype)->fields[n].type
-#define TYPE_FIELD_NAME(thistype, n) (thistype)->fields[n].name
-#define TYPE_FIELD_VALUE(thistype, n) (* (int*) &(thistype)->fields[n].type)
-#define TYPE_FIELD_BITPOS(thistype, n) (thistype)->fields[n].bitpos
-#define TYPE_FIELD_BITSIZE(thistype, n) (thistype)->fields[n].bitsize
-#define TYPE_FIELD_PACKED(thistype, n) (thistype)->fields[n].bitsize
-
-#define TYPE_FIELD_PRIVATE_BITS(thistype) (thistype)->private_field_bits
-#define TYPE_FIELD_PROTECTED_BITS(thistype) (thistype)->protected_field_bits
-#define SET_TYPE_FIELD_PRIVATE(thistype, n) B_SET ((thistype)->private_field_bits, (n))
-#define SET_TYPE_FIELD_PROTECTED(thistype, n) B_SET ((thistype)->protected_field_bits, (n))
-#define TYPE_FIELD_PRIVATE(thistype, n) B_TST((thistype)->private_field_bits, (n))
-#define TYPE_FIELD_PROTECTED(thistype, n) B_TST((thistype)->protected_field_bits, (n))
-
-#define TYPE_HAS_DESTRUCTOR(thistype) ((thistype)->flags & TYPE_FLAG_HAS_DESTRUCTOR)
-#define TYPE_HAS_CONSTRUCTOR(thistype) ((thistype)->flags & TYPE_FLAG_HAS_CONSTRUCTOR)
-
-#define TYPE_FIELD_STATIC(thistype, n) ((thistype)->fields[n].bitpos == -1)
-#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) ((char *)(thistype)->fields[n].bitsize)
-
-#define TYPE_FN_FIELDLISTS(thistype) (thistype)->fn_fieldlists
-#define TYPE_FN_FIELDLIST(thistype, n) (thistype)->fn_fieldlists[n]
-#define TYPE_FN_FIELDLIST1(thistype, n) (thistype)->fn_fieldlists[n].fn_fields
-#define TYPE_FN_FIELDLIST_NAME(thistype, n) (thistype)->fn_fieldlists[n].name
-#define TYPE_FN_FIELDLIST_LENGTH(thistype, n) (thistype)->fn_fieldlists[n].length
-
-#define TYPE_FN_FIELD(thistype, n) (thistype)[n]
-#define TYPE_FN_FIELD_NAME(thistype, n) (thistype)[n].name
-#define TYPE_FN_FIELD_TYPE(thistype, n) (thistype)[n].type
-#define TYPE_FN_FIELD_ARGS(thistype, n) (thistype)[n].args
-#define TYPE_FN_FIELD_PHYSNAME(thistype, n) (thistype)[n].physname
-#define TYPE_FN_FIELD_VIRTUAL_P(thistype, n) ((thistype)[n].voffset < 0)
-#define TYPE_FN_FIELD_STATIC_P(thistype, n) ((thistype)[n].voffset > 0)
-#define TYPE_FN_FIELD_VOFFSET(thistype, n) ((thistype)[n].voffset-1)
-
-#define TYPE_FN_PRIVATE_BITS(thistype) (thistype).private_fn_field_bits
-#define TYPE_FN_PROTECTED_BITS(thistype) (thistype).protected_fn_field_bits
-#define SET_TYPE_FN_PRIVATE(thistype, n) B_SET ((thistype).private_fn_field_bits, n)
-#define SET_TYPE_FN_PROTECTED(thistype, n) B_SET ((thistype).protected_fn_field_bits, n)
-#define TYPE_FN_PRIVATE(thistype, n) B_TST ((thistype).private_fn_field_bits, n)
-#define TYPE_FN_PROTECTED(thistype, n) B_TST ((thistype).protected_fn_field_bits, n)
-
-/* Functions that work on the objects described above */
-
-extern struct symtab *lookup_symtab ();
-extern struct symbol *lookup_symbol ();
-extern struct type *lookup_typename ();
-extern struct type *lookup_unsigned_typename ();
-extern struct type *lookup_struct ();
-extern struct type *lookup_union ();
-extern struct type *lookup_enum ();
-extern struct type *lookup_struct_elt_type ();
-extern struct type *lookup_pointer_type ();
-extern struct type *lookup_function_type ();
-extern struct type *lookup_basetype_type ();
-extern struct type *create_array_type ();
-extern struct symbol *block_function ();
-extern struct symbol *find_pc_function ();
-extern int find_pc_partial_function ();
-extern struct partial_symtab *find_pc_psymtab ();
-extern struct symtab *find_pc_symtab ();
-extern struct partial_symbol *find_pc_psymbol ();
-extern int find_pc_misc_function ();
-
-/* C++ stuff. */
-extern struct type *lookup_reference_type ();
-extern struct type *lookup_member_type ();
-extern struct type *lookup_class ();
-/* end of C++ stuff. */
-
-extern struct type *builtin_type_void;
-extern struct type *builtin_type_char;
-extern struct type *builtin_type_short;
-extern struct type *builtin_type_int;
-extern struct type *builtin_type_long;
-extern struct type *builtin_type_unsigned_char;
-extern struct type *builtin_type_unsigned_short;
-extern struct type *builtin_type_unsigned_int;
-extern struct type *builtin_type_unsigned_long;
-extern struct type *builtin_type_float;
-extern struct type *builtin_type_double;
-
-#ifdef LONG_LONG
-extern struct type *builtin_type_long_long;
-extern struct type *builtin_type_unsigned_long_long;
-
-#ifndef BUILTIN_TYPE_LONGEST
-#define BUILTIN_TYPE_LONGEST builtin_type_long_long
-#endif
-
-#ifndef BUILTIN_TYPE_UNSIGNED_LONGEST
-#define BUILTIN_TYPE_UNSIGNED_LONGEST builtin_type_unsigned_long_long
-#endif
-
-#else /* LONG_LONG */
-
-#ifndef BUILTIN_TYPE_LONGEST
-#define BUILTIN_TYPE_LONGEST builtin_type_long
-#endif
-
-#ifndef BUILTIN_TYPE_UNSIGNED_LONGEST
-#define BUILTIN_TYPE_UNSIGNED_LONGEST builtin_type_unsigned_long
-#endif
-
-#endif
-
-struct symtab_and_line
-{
- struct symtab *symtab;
- int line;
- CORE_ADDR pc;
- CORE_ADDR end;
-};
-
-struct symtabs_and_lines
-{
- struct symtab_and_line *sals;
- int nelts;
-};
-
-/* Given a pc value, return line number it is in.
- Second arg nonzero means if pc is on the boundary
- use the previous statement's line number. */
-
-struct symtab_and_line find_pc_line ();
-
-/* Given a string, return the line specified by it.
- For commands like "list" and "breakpoint". */
-
-struct symtabs_and_lines decode_line_spec ();
-struct symtabs_and_lines decode_line_spec_1 ();
-struct symtabs_and_lines decode_line_1 ();
diff --git a/gnu/usr.bin/gdb/utils.c b/gnu/usr.bin/gdb/utils.c
deleted file mode 100644
index b03f2be..0000000
--- a/gnu/usr.bin/gdb/utils.c
+++ /dev/null
@@ -1,1096 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- *
- * $Header: /home/cvs/386BSD/src/usr.bin/gdb/utils.c,v 1.1.1.1 1993/06/12 14:52:20 rgrimes Exp $;
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)utils.c 6.4 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* General utility routines for GDB, the GNU debugger.
- Copyright (C) 1986, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "param.h"
-
-#include <stdio.h>
-#include <ctype.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <sys/param.h>
-#include <pwd.h>
-#include "defs.h"
-#ifdef HAVE_TERMIO
-#include <termio.h>
-#endif
-
-/* If this definition isn't overridden by the header files, assume
- that isatty and fileno exist on this system. */
-#ifndef ISATTY
-#define ISATTY(FP) (isatty (fileno (FP)))
-#endif
-
-extern FILE *instream;
-
-void error ();
-void fatal ();
-
-/* Chain of cleanup actions established with make_cleanup,
- to be executed if an error happens. */
-
-static struct cleanup *cleanup_chain;
-
-/* Nonzero means a quit has been requested. */
-
-int quit_flag;
-
-/* Nonzero means quit immediately if Control-C is typed now,
- rather than waiting until QUIT is executed. */
-
-int immediate_quit;
-
-/* Add a new cleanup to the cleanup_chain,
- and return the previous chain pointer
- to be passed later to do_cleanups or discard_cleanups.
- Args are FUNCTION to clean up with, and ARG to pass to it. */
-
-struct cleanup *
-make_cleanup (function, arg)
- void (*function) ();
- int arg;
-{
- register struct cleanup *new
- = (struct cleanup *) xmalloc (sizeof (struct cleanup));
- register struct cleanup *old_chain = cleanup_chain;
-
- new->next = cleanup_chain;
- new->function = function;
- new->arg = arg;
- cleanup_chain = new;
-
- return old_chain;
-}
-
-/* Discard cleanups and do the actions they describe
- until we get back to the point OLD_CHAIN in the cleanup_chain. */
-
-void
-do_cleanups (old_chain)
- register struct cleanup *old_chain;
-{
- register struct cleanup *ptr;
- while ((ptr = cleanup_chain) != old_chain)
- {
- (*ptr->function) (ptr->arg);
- cleanup_chain = ptr->next;
- free (ptr);
- }
-}
-
-/* Discard cleanups, not doing the actions they describe,
- until we get back to the point OLD_CHAIN in the cleanup_chain. */
-
-void
-discard_cleanups (old_chain)
- register struct cleanup *old_chain;
-{
- register struct cleanup *ptr;
- while ((ptr = cleanup_chain) != old_chain)
- {
- cleanup_chain = ptr->next;
- free (ptr);
- }
-}
-
-/* Set the cleanup_chain to 0, and return the old cleanup chain. */
-struct cleanup *
-save_cleanups ()
-{
- struct cleanup *old_chain = cleanup_chain;
-
- cleanup_chain = 0;
- return old_chain;
-}
-
-/* Restore the cleanup chain from a previously saved chain. */
-void
-restore_cleanups (chain)
- struct cleanup *chain;
-{
- cleanup_chain = chain;
-}
-
-/* This function is useful for cleanups.
- Do
-
- foo = xmalloc (...);
- old_chain = make_cleanup (free_current_contents, &foo);
-
- to arrange to free the object thus allocated. */
-
-void
-free_current_contents (location)
- char **location;
-{
- free (*location);
-}
-
-/* Generally useful subroutines used throughout the program. */
-
-/* Like malloc but get error if no storage available. */
-
-char *
-xmalloc (size)
- long size;
-{
- register char *val = (char *) malloc (size);
- if (!val)
- fatal ("virtual memory exhausted.", 0);
- return val;
-}
-
-/* Like realloc but get error if no storage available. */
-
-char *
-xrealloc (ptr, size)
- char *ptr;
- long size;
-{
- register char *val = (char *) realloc (ptr, size);
- if (!val)
- fatal ("virtual memory exhausted.", 0);
- return val;
-}
-
-/* Print the system error message for errno, and also mention STRING
- as the file name for which the error was encountered.
- Then return to command level. */
-
-void
-perror_with_name (string)
- char *string;
-{
- extern int sys_nerr;
- extern char *sys_errlist[];
- extern int errno;
- char *err;
- char *combined;
-
- if (errno < sys_nerr)
- err = sys_errlist[errno];
- else
- err = "unknown error";
-
- combined = (char *) alloca (strlen (err) + strlen (string) + 3);
- strcpy (combined, string);
- strcat (combined, ": ");
- strcat (combined, err);
-
- error ("%s.", combined);
-}
-
-/* Print the system error message for ERRCODE, and also mention STRING
- as the file name for which the error was encountered. */
-
-void
-print_sys_errmsg (string, errcode)
- char *string;
- int errcode;
-{
- extern int sys_nerr;
- extern char *sys_errlist[];
- char *err;
- char *combined;
-
- if (errcode < sys_nerr)
- err = sys_errlist[errcode];
- else
- err = "unknown error";
-
- combined = (char *) alloca (strlen (err) + strlen (string) + 3);
- strcpy (combined, string);
- strcat (combined, ": ");
- strcat (combined, err);
-
- printf ("%s.\n", combined);
-}
-
-void
-quit ()
-{
-#ifdef HAVE_TERMIO
- ioctl (fileno (stdout), TCFLSH, 1);
-#else /* not HAVE_TERMIO */
- ioctl (fileno (stdout), TIOCFLUSH, 0);
-#endif /* not HAVE_TERMIO */
-#ifdef TIOCGPGRP
- error ("Quit");
-#else
- error ("Quit (expect signal %d when inferior is resumed)", SIGINT);
-#endif /* TIOCGPGRP */
-}
-
-/* Control C comes here */
-
-void
-request_quit ()
-{
- extern int remote_debugging;
-
- quit_flag = 1;
-
-#ifdef USG
- /* Restore the signal handler. */
- signal (SIGINT, request_quit);
-#endif
-
- if (immediate_quit)
- quit();
-}
-
-/* Print an error message and return to command level.
- STRING is the error message, used as a fprintf string,
- and ARG is passed as an argument to it. */
-
-void
-error (string, arg1, arg2, arg3)
- char *string;
- int arg1, arg2, arg3;
-{
- terminal_ours (); /* Should be ok even if no inf. */
- fflush (stdout);
- fprintf (stderr, string, arg1, arg2, arg3);
- fprintf (stderr, "\n");
- return_to_top_level ();
-}
-
-/* Print an error message and exit reporting failure.
- This is for a error that we cannot continue from.
- STRING and ARG are passed to fprintf. */
-
-void
-fatal (string, arg)
- char *string;
- int arg;
-{
- fprintf (stderr, "gdb: ");
- fprintf (stderr, string, arg);
- fprintf (stderr, "\n");
- exit (1);
-}
-
-/* Print an error message and exit, dumping core.
- STRING is a printf-style control string, and ARG is a corresponding
- argument. */
-void
-fatal_dump_core (string, arg)
- char *string;
- int arg;
-{
- /* "internal error" is always correct, since GDB should never dump
- core, no matter what the input. */
- fprintf (stderr, "gdb internal error: ");
- fprintf (stderr, string, arg);
- fprintf (stderr, "\n");
- signal (SIGQUIT, SIG_DFL);
- kill (getpid (), SIGQUIT);
- /* We should never get here, but just in case... */
- exit (1);
-}
-
-/* Make a copy of the string at PTR with SIZE characters
- (and add a null character at the end in the copy).
- Uses malloc to get the space. Returns the address of the copy. */
-
-char *
-savestring (ptr, size)
- char *ptr;
- int size;
-{
- register char *p = (char *) xmalloc (size + 1);
- bcopy (ptr, p, size);
- p[size] = 0;
- return p;
-}
-
-char *
-concat (s1, s2, s3)
- char *s1, *s2, *s3;
-{
- register int len = strlen (s1) + strlen (s2) + strlen (s3) + 1;
- register char *val = (char *) xmalloc (len);
- strcpy (val, s1);
- strcat (val, s2);
- strcat (val, s3);
- return val;
-}
-
-void
-print_spaces (n, file)
- register int n;
- register FILE *file;
-{
- while (n-- > 0)
- fputc (' ', file);
-}
-
-/* Ask user a y-or-n question and return 1 iff answer is yes.
- Takes three args which are given to printf to print the question.
- The first, a control string, should end in "? ".
- It should not say how to answer, because we do that. */
-
-int
-query (ctlstr, arg1, arg2)
- char *ctlstr;
-{
- register int answer;
-
- /* Automatically answer "yes" if input is not from a terminal. */
- if (!input_from_terminal_p ())
- return 1;
-
- while (1)
- {
- printf (ctlstr, arg1, arg2);
- printf ("(y or n) ");
- fflush (stdout);
- answer = fgetc (stdin);
- clearerr (stdin); /* in case of C-d */
- if (answer != '\n')
- while (fgetc (stdin) != '\n') clearerr (stdin);
- if (answer >= 'a')
- answer -= 040;
- if (answer == 'Y')
- return 1;
- if (answer == 'N')
- return 0;
- printf ("Please answer y or n.\n");
- }
-}
-
-/* Parse a C escape sequence. STRING_PTR points to a variable
- containing a pointer to the string to parse. That pointer
- is updated past the characters we use. The value of the
- escape sequence is returned.
-
- A negative value means the sequence \ newline was seen,
- which is supposed to be equivalent to nothing at all.
-
- If \ is followed by a null character, we return a negative
- value and leave the string pointer pointing at the null character.
-
- If \ is followed by 000, we return 0 and leave the string pointer
- after the zeros. A value of 0 does not mean end of string. */
-
-int
-parse_escape (string_ptr)
- char **string_ptr;
-{
- register int c = *(*string_ptr)++;
- switch (c)
- {
- case 'a':
- return '\a';
- case 'b':
- return '\b';
- case 'e':
- return 033;
- case 'f':
- return '\f';
- case 'n':
- return '\n';
- case 'r':
- return '\r';
- case 't':
- return '\t';
- case 'v':
- return '\v';
- case '\n':
- return -2;
- case 0:
- (*string_ptr)--;
- return 0;
- case '^':
- c = *(*string_ptr)++;
- if (c == '\\')
- c = parse_escape (string_ptr);
- if (c == '?')
- return 0177;
- return (c & 0200) | (c & 037);
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- {
- register int i = c - '0';
- register int count = 0;
- while (++count < 3)
- {
- if ((c = *(*string_ptr)++) >= '0' && c <= '7')
- {
- i *= 8;
- i += c - '0';
- }
- else
- {
- (*string_ptr)--;
- break;
- }
- }
- return i;
- }
- default:
- return c;
- }
-}
-
-/* Print the character CH on STREAM as part of the contents
- of a literal string whose delimiter is QUOTER. */
-
-void
-printchar (ch, stream, quoter)
- unsigned char ch;
- FILE *stream;
- int quoter;
-{
- register int c = ch;
- if (c < 040 || c >= 0177)
- switch (c)
- {
- case '\n':
- fputs_filtered ("\\n", stream);
- break;
- case '\b':
- fputs_filtered ("\\b", stream);
- break;
- case '\t':
- fputs_filtered ("\\t", stream);
- break;
- case '\f':
- fputs_filtered ("\\f", stream);
- break;
- case '\r':
- fputs_filtered ("\\r", stream);
- break;
- case '\033':
- fputs_filtered ("\\e", stream);
- break;
- case '\007':
- fputs_filtered ("\\a", stream);
- break;
- default:
- fprintf_filtered (stream, "\\%.3o", (unsigned int) c);
- break;
- }
- else
- {
- if (c == '\\' || c == quoter)
- fputs_filtered ("\\", stream);
- fprintf_filtered (stream, "%c", c);
- }
-}
-
-static int lines_per_page, lines_printed, chars_per_line, chars_printed;
-
-/* Set values of page and line size. */
-static void
-set_screensize_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- char *p = arg;
- char *p1;
- int tolinesize = lines_per_page;
- int tocharsize = chars_per_line;
-
- if (p == 0)
- error_no_arg ("set screensize");
-
- while (*p >= '0' && *p <= '9')
- p++;
-
- if (*p && *p != ' ' && *p != '\t')
- error ("Non-integral argument given to \"set screensize\".");
-
- tolinesize = atoi (arg);
-
- while (*p == ' ' || *p == '\t')
- p++;
-
- if (*p)
- {
- p1 = p;
- while (*p1 >= '0' && *p1 <= '9')
- p1++;
-
- if (*p1)
- error ("Non-integral second argument given to \"set screensize\".");
-
- tocharsize = atoi (p);
- }
-
- lines_per_page = tolinesize;
- chars_per_line = tocharsize;
-}
-
-static void
-instream_cleanup(stream)
- FILE *stream;
-{
- instream = stream;
-}
-
-static void
-prompt_for_continue ()
-{
- if (ISATTY(stdin) && ISATTY(stdout))
- {
- struct cleanup *old_chain = make_cleanup(instream_cleanup, instream);
- char *cp, *gdb_readline();
-
- instream = stdin;
- immediate_quit++;
- if (cp = gdb_readline ("---Type <return> to continue---"))
- free(cp);
- chars_printed = lines_printed = 0;
- immediate_quit--;
- do_cleanups(old_chain);
- }
-}
-
-/* Reinitialize filter; ie. tell it to reset to original values. */
-
-void
-reinitialize_more_filter ()
-{
- lines_printed = 0;
- chars_printed = 0;
-}
-
-static void
-screensize_info (arg, from_tty)
- char *arg;
- int from_tty;
-{
- if (arg)
- error ("\"info screensize\" does not take any arguments.");
-
- if (!lines_per_page)
- printf ("Output more filtering is disabled.\n");
- else
- {
- printf ("Output more filtering is enabled with\n");
- printf ("%d lines per page and %d characters per line.\n",
- lines_per_page, chars_per_line);
- }
-}
-
-/* Like fputs but pause after every screenful.
- Unlike fputs, fputs_filtered does not return a value.
- It is OK for LINEBUFFER to be NULL, in which case just don't print
- anything.
-
- Note that a longjmp to top level may occur in this routine
- (since prompt_for_continue may do so) so this routine should not be
- called when cleanups are not in place. */
-
-void
-fputs_filtered (linebuffer, stream)
- char *linebuffer;
- FILE *stream;
-{
- char *lineptr;
-
- if (linebuffer == 0)
- return;
-
- /* Don't do any filtering if it is disabled. */
- if (stream != stdout || !ISATTY(stdout) || lines_per_page == 0)
- {
- fputs (linebuffer, stream);
- return;
- }
-
- /* Go through and output each character. Show line extension
- when this is necessary; prompt user for new page when this is
- necessary. */
-
- lineptr = linebuffer;
- while (*lineptr)
- {
- /* Possible new page. */
- if (lines_printed >= lines_per_page - 1)
- prompt_for_continue ();
-
- while (*lineptr && *lineptr != '\n')
- {
- /* Print a single line. */
- if (*lineptr == '\t')
- {
- putc ('\t', stream);
- /* Shifting right by 3 produces the number of tab stops
- we have already passed, and then adding one and
- shifting left 3 advances to the next tab stop. */
- chars_printed = ((chars_printed >> 3) + 1) << 3;
- lineptr++;
- }
- else
- {
- putc (*lineptr, stream);
- chars_printed++;
- lineptr++;
- }
-
- if (chars_printed >= chars_per_line)
- {
- chars_printed = 0;
- lines_printed++;
- /* Possible new page. */
- if (lines_printed >= lines_per_page - 1)
- prompt_for_continue ();
- }
- }
-
- if (*lineptr == '\n')
- {
- lines_printed++;
- putc ('\n', stream);
- lineptr++;
- chars_printed = 0;
- }
- }
-}
-
-/* fputs_demangled is a variant of fputs_filtered that
- demangles g++ names.*/
-
-void
-fputs_demangled (linebuffer, stream, arg_mode)
- char *linebuffer;
- FILE *stream;
-{
-#ifdef __STDC__
- extern char *cplus_demangle (const char *, int);
-#else
- extern char *cplus_demangle ();
-#endif
-#define SYMBOL_MAX 1024
-
-#define SYMBOL_CHAR(c) (isascii(c) && (isalnum(c) || (c) == '_' || (c) == '$'))
-
- char buf[SYMBOL_MAX+1];
- char *p;
-
- if (linebuffer == NULL)
- return;
-
- p = linebuffer;
-
- while ( *p != (char) 0 ) {
- int i = 0;
-
- /* collect non-interesting characters into buf */
- while ( *p != (char) 0 && !SYMBOL_CHAR(*p) ) {
- buf[i++] = *p;
- p++;
- }
- if (i > 0) {
- /* output the non-interesting characters without demangling */
- buf[i] = (char) 0;
- fputs_filtered(buf, stream);
- i = 0; /* reset buf */
- }
-
- /* and now the interesting characters */
- while (i < SYMBOL_MAX && *p != (char) 0 && SYMBOL_CHAR(*p) ) {
- buf[i++] = *p;
- p++;
- }
- buf[i] = (char) 0;
- if (i > 0) {
- char * result;
-
- if ( (result = cplus_demangle(buf, arg_mode)) != NULL ) {
- fputs_filtered(result, stream);
- free(result);
- }
- else {
- fputs_filtered(buf, stream);
- }
- }
- }
-}
-
-/* Print ARG1, ARG2, and ARG3 on stdout using format FORMAT. If this
- information is going to put the amount written since the last call
- to INIIALIZE_MORE_FILTER or the last page break over the page size,
- print out a pause message and do a gdb_readline to get the users
- permision to continue.
-
- Unlike fprintf, this function does not return a value.
-
- Note that this routine has a restriction that the length of the
- final output line must be less than 255 characters *or* it must be
- less than twice the size of the format string. This is a very
- arbitrary restriction, but it is an internal restriction, so I'll
- put it in. This means that the %s format specifier is almost
- useless; unless the caller can GUARANTEE that the string is short
- enough, fputs_filtered should be used instead.
-
- Note also that a longjmp to top level may occur in this routine
- (since prompt_for_continue may do so) so this routine should not be
- called when cleanups are not in place. */
-
-void
-fprintf_filtered (stream, format, arg1, arg2, arg3, arg4, arg5, arg6)
- FILE *stream;
- char *format;
- int arg1, arg2, arg3, arg4, arg5, arg6;
-{
- static char *linebuffer = (char *) 0;
- static int line_size;
- int format_length = strlen (format);
- int numchars;
-
- /* Allocated linebuffer for the first time. */
- if (!linebuffer)
- {
- linebuffer = (char *) xmalloc (255);
- line_size = 255;
- }
-
- /* Reallocate buffer to a larger size if this is necessary. */
- if (format_length * 2 > line_size)
- {
- line_size = format_length * 2;
-
- /* You don't have to copy. */
- free (linebuffer);
- linebuffer = (char *) xmalloc (line_size);
- }
-
- /* This won't blow up if the restrictions described above are
- followed. */
- (void) sprintf (linebuffer, format, arg1, arg2, arg3, arg4, arg5, arg6);
-
- fputs_filtered (linebuffer, stream);
-}
-
-void
-printf_filtered (format, arg1, arg2, arg3, arg4, arg5, arg6)
- char *format;
- int arg1, arg2, arg3, arg4, arg5, arg6;
-{
- fprintf_filtered (stdout, format, arg1, arg2, arg3, arg4, arg5, arg6);
-}
-
-/* Print N spaces. */
-void
-print_spaces_filtered (n, stream)
- int n;
- FILE *stream;
-{
- register char *s = (char *) alloca (n + 1);
- register char *t = s;
-
- while (n--)
- *t++ = ' ';
- *t = '\0';
-
- fputs_filtered (s, stream);
-}
-
-
-#ifdef USG
-bcopy (from, to, count)
-char *from, *to;
-{
- memcpy (to, from, count);
-}
-
-bcmp (from, to, count)
-{
- return (memcmp (to, from, count));
-}
-
-bzero (to, count)
-char *to;
-{
- while (count--)
- *to++ = 0;
-}
-
-getwd (buf)
-char *buf;
-{
- getcwd (buf, MAXPATHLEN);
-}
-
-char *
-index (s, c)
- char *s;
-{
- char *strchr ();
- return strchr (s, c);
-}
-
-char *
-rindex (s, c)
- char *s;
-{
- char *strrchr ();
- return strrchr (s, c);
-}
-
-#ifndef USG
-char *sys_siglist[32] = {
- "SIG0",
- "SIGHUP",
- "SIGINT",
- "SIGQUIT",
- "SIGILL",
- "SIGTRAP",
- "SIGIOT",
- "SIGEMT",
- "SIGFPE",
- "SIGKILL",
- "SIGBUS",
- "SIGSEGV",
- "SIGSYS",
- "SIGPIPE",
- "SIGALRM",
- "SIGTERM",
- "SIGUSR1",
- "SIGUSR2",
- "SIGCLD",
- "SIGPWR",
- "SIGWIND",
- "SIGPHONE",
- "SIGPOLL",
-};
-#endif
-
-/* Queue routines */
-
-struct queue {
- struct queue *forw;
- struct queue *back;
-};
-
-insque (item, after)
-struct queue *item;
-struct queue *after;
-{
- item->forw = after->forw;
- after->forw->back = item;
-
- item->back = after;
- after->forw = item;
-}
-
-remque (item)
-struct queue *item;
-{
- item->forw->back = item->back;
- item->back->forw = item->forw;
-}
-#endif /* USG */
-
-#ifdef USG
-/* There is too much variation in Sys V signal numbers and names, so
- we must initialize them at runtime. */
-static char undoc[] = "(undocumented)";
-
-char *sys_siglist[NSIG];
-#endif /* USG */
-
-extern struct cmd_list_element *setlist;
-
-void
-_initialize_utils ()
-{
- int i;
- add_cmd ("screensize", class_support, set_screensize_command,
- "Change gdb's notion of the size of the output screen.\n\
-The first argument is the number of lines on a page.\n\
-The second argument (optional) is the number of characters on a line.",
- &setlist);
- add_info ("screensize", screensize_info,
- "Show gdb's current notion of the size of the output screen.");
-
- /* These defaults will be used if we are unable to get the correct
- values from termcap. */
- lines_per_page = 24;
- chars_per_line = 80;
- /* Initialize the screen height and width from termcap. */
- {
- int termtype = getenv ("TERM");
-
- /* Positive means success, nonpositive means failure. */
- int status;
-
- /* 2048 is large enough for all known terminals, according to the
- GNU termcap manual. */
- char term_buffer[2048];
-
- if (termtype)
- {
- status = tgetent (term_buffer, termtype);
- if (status > 0)
- {
- int val;
-
- val = tgetnum ("li");
- if (val >= 0)
- lines_per_page = val;
- else
- /* The number of lines per page is not mentioned
- in the terminal description. This probably means
- that paging is not useful (e.g. emacs shell window),
- so disable paging. */
- lines_per_page = 0;
-
- val = tgetnum ("co");
- if (val >= 0)
- chars_per_line = val;
- }
- }
- }
-
-#ifdef USG
- /* Initialize signal names. */
- for (i = 0; i < NSIG; i++)
- sys_siglist[i] = undoc;
-
-#ifdef SIGHUP
- sys_siglist[SIGHUP ] = "SIGHUP";
-#endif
-#ifdef SIGINT
- sys_siglist[SIGINT ] = "SIGINT";
-#endif
-#ifdef SIGQUIT
- sys_siglist[SIGQUIT ] = "SIGQUIT";
-#endif
-#ifdef SIGILL
- sys_siglist[SIGILL ] = "SIGILL";
-#endif
-#ifdef SIGTRAP
- sys_siglist[SIGTRAP ] = "SIGTRAP";
-#endif
-#ifdef SIGIOT
- sys_siglist[SIGIOT ] = "SIGIOT";
-#endif
-#ifdef SIGEMT
- sys_siglist[SIGEMT ] = "SIGEMT";
-#endif
-#ifdef SIGFPE
- sys_siglist[SIGFPE ] = "SIGFPE";
-#endif
-#ifdef SIGKILL
- sys_siglist[SIGKILL ] = "SIGKILL";
-#endif
-#ifdef SIGBUS
- sys_siglist[SIGBUS ] = "SIGBUS";
-#endif
-#ifdef SIGSEGV
- sys_siglist[SIGSEGV ] = "SIGSEGV";
-#endif
-#ifdef SIGSYS
- sys_siglist[SIGSYS ] = "SIGSYS";
-#endif
-#ifdef SIGPIPE
- sys_siglist[SIGPIPE ] = "SIGPIPE";
-#endif
-#ifdef SIGALRM
- sys_siglist[SIGALRM ] = "SIGALRM";
-#endif
-#ifdef SIGTERM
- sys_siglist[SIGTERM ] = "SIGTERM";
-#endif
-#ifdef SIGUSR1
- sys_siglist[SIGUSR1 ] = "SIGUSR1";
-#endif
-#ifdef SIGUSR2
- sys_siglist[SIGUSR2 ] = "SIGUSR2";
-#endif
-#ifdef SIGCLD
- sys_siglist[SIGCLD ] = "SIGCLD";
-#endif
-#ifdef SIGCHLD
- sys_siglist[SIGCHLD ] = "SIGCHLD";
-#endif
-#ifdef SIGPWR
- sys_siglist[SIGPWR ] = "SIGPWR";
-#endif
-#ifdef SIGTSTP
- sys_siglist[SIGTSTP ] = "SIGTSTP";
-#endif
-#ifdef SIGTTIN
- sys_siglist[SIGTTIN ] = "SIGTTIN";
-#endif
-#ifdef SIGTTOU
- sys_siglist[SIGTTOU ] = "SIGTTOU";
-#endif
-#ifdef SIGSTOP
- sys_siglist[SIGSTOP ] = "SIGSTOP";
-#endif
-#ifdef SIGXCPU
- sys_siglist[SIGXCPU ] = "SIGXCPU";
-#endif
-#ifdef SIGXFSZ
- sys_siglist[SIGXFSZ ] = "SIGXFSZ";
-#endif
-#ifdef SIGVTALRM
- sys_siglist[SIGVTALRM ] = "SIGVTALRM";
-#endif
-#ifdef SIGPROF
- sys_siglist[SIGPROF ] = "SIGPROF";
-#endif
-#ifdef SIGWINCH
- sys_siglist[SIGWINCH ] = "SIGWINCH";
-#endif
-#ifdef SIGCONT
- sys_siglist[SIGCONT ] = "SIGCONT";
-#endif
-#ifdef SIGURG
- sys_siglist[SIGURG ] = "SIGURG";
-#endif
-#ifdef SIGIO
- sys_siglist[SIGIO ] = "SIGIO";
-#endif
-#ifdef SIGWIND
- sys_siglist[SIGWIND ] = "SIGWIND";
-#endif
-#ifdef SIGPHONE
- sys_siglist[SIGPHONE ] = "SIGPHONE";
-#endif
-#ifdef SIGPOLL
- sys_siglist[SIGPOLL ] = "SIGPOLL";
-#endif
-#endif /* USG */
-}
diff --git a/gnu/usr.bin/gdb/valarith.c b/gnu/usr.bin/gdb/valarith.c
deleted file mode 100644
index 8e76899..0000000
--- a/gnu/usr.bin/gdb/valarith.c
+++ /dev/null
@@ -1,690 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)valarith.c 6.3 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* Perform arithmetic and other operations on values, for GDB.
- Copyright (C) 1986, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "defs.h"
-#include "param.h"
-#include "symtab.h"
-#include "value.h"
-#include "expression.h"
-
-
-value value_x_binop ();
-value value_subscripted_rvalue ();
-
-value
-value_add (arg1, arg2)
- value arg1, arg2;
-{
- register value val, valint, valptr;
- register int len;
-
- COERCE_ARRAY (arg1);
- COERCE_ARRAY (arg2);
-
- if ((TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_PTR
- || TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_PTR)
- &&
- (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_INT
- || TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_INT))
- /* Exactly one argument is a pointer, and one is an integer. */
- {
- if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_PTR)
- {
- valptr = arg1;
- valint = arg2;
- }
- else
- {
- valptr = arg2;
- valint = arg1;
- }
- len = TYPE_LENGTH (TYPE_TARGET_TYPE (VALUE_TYPE (valptr)));
- if (len == 0) len = 1; /* For (void *) */
- val = value_from_long (builtin_type_long,
- value_as_long (valptr)
- + (len * value_as_long (valint)));
- VALUE_TYPE (val) = VALUE_TYPE (valptr);
- return val;
- }
-
- return value_binop (arg1, arg2, BINOP_ADD);
-}
-
-value
-value_sub (arg1, arg2)
- value arg1, arg2;
-{
- register value val;
-
- COERCE_ARRAY (arg1);
- COERCE_ARRAY (arg2);
-
- if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_PTR
- &&
- TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_INT)
- {
- val = value_from_long (builtin_type_long,
- value_as_long (arg1)
- - TYPE_LENGTH (TYPE_TARGET_TYPE (VALUE_TYPE (arg1))) * value_as_long (arg2));
- VALUE_TYPE (val) = VALUE_TYPE (arg1);
- return val;
- }
-
- if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_PTR
- &&
- VALUE_TYPE (arg1) == VALUE_TYPE (arg2))
- {
- val = value_from_long (builtin_type_long,
- (value_as_long (arg1) - value_as_long (arg2))
- / TYPE_LENGTH (TYPE_TARGET_TYPE (VALUE_TYPE (arg1))));
- return val;
- }
-
- return value_binop (arg1, arg2, BINOP_SUB);
-}
-
-/* Return the value of ARRAY[IDX]. */
-
-value
-value_subscript (array, idx)
- value array, idx;
-{
- if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_ARRAY
- && VALUE_LVAL (array) != lval_memory)
- return value_subscripted_rvalue (array, idx);
- else
- return value_ind (value_add (array, idx));
-}
-
-/* Return the value of EXPR[IDX], expr an aggregate rvalue
- (eg, a vector register) */
-
-value
-value_subscripted_rvalue (array, idx)
- value array, idx;
-{
- struct type *elt_type = TYPE_TARGET_TYPE (VALUE_TYPE (array));
- int elt_size = TYPE_LENGTH (elt_type);
- int elt_offs = elt_size * value_as_long (idx);
- value v;
-
- if (elt_offs >= TYPE_LENGTH (VALUE_TYPE (array)))
- error ("no such vector element");
-
- if (TYPE_CODE (elt_type) == TYPE_CODE_FLT)
- {
- if (elt_size == sizeof (float))
- v = value_from_double (elt_type, (double) *(float *)
- (VALUE_CONTENTS (array) + elt_offs));
- else
- v = value_from_double (elt_type, *(double *)
- (VALUE_CONTENTS (array) + elt_offs));
- }
- else
- {
- int offs;
- union {int i; char c;} test;
- test.i = 1;
- if (test.c == 1)
- offs = 0;
- else
- offs = sizeof (LONGEST) - elt_size;
- v = value_from_long (elt_type, *(LONGEST *)
- (VALUE_CONTENTS (array) + elt_offs - offs));
- }
-
- if (VALUE_LVAL (array) == lval_internalvar)
- VALUE_LVAL (v) = lval_internalvar_component;
- else
- VALUE_LVAL (v) = not_lval;
- VALUE_ADDRESS (v) = VALUE_ADDRESS (array);
- VALUE_OFFSET (v) = VALUE_OFFSET (array) + elt_offs;
- VALUE_BITSIZE (v) = elt_size * 8;
- return v;
-}
-
-/* Check to see if either argument is a structure. This is called so
- we know whether to go ahead with the normal binop or look for a
- user defined function instead.
-
- For now, we do not overload the `=' operator. */
-
-int
-binop_user_defined_p (op, arg1, arg2)
- enum exp_opcode op;
- value arg1, arg2;
-{
- if (op == BINOP_ASSIGN)
- return 0;
- return (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_STRUCT
- || TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_STRUCT
- || (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_REF
- && TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg1))) == TYPE_CODE_STRUCT)
- || (TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_REF
- && TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg2))) == TYPE_CODE_STRUCT));
-}
-
-/* Check to see if argument is a structure. This is called so
- we know whether to go ahead with the normal unop or look for a
- user defined function instead.
-
- For now, we do not overload the `&' operator. */
-
-int unop_user_defined_p (op, arg1)
- enum exp_opcode op;
- value arg1;
-{
- if (op == UNOP_ADDR)
- return 0;
- return (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_STRUCT
- || (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_REF
- && TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg1))) == TYPE_CODE_STRUCT));
-}
-
-/* We know either arg1 or arg2 is a structure, so try to find the right
- user defined function. Create an argument vector that calls
- arg1.operator @ (arg1,arg2) and return that value (where '@' is any
- binary operator which is legal for GNU C++). */
-
-value
-value_x_binop (arg1, arg2, op, otherop)
- value arg1, arg2;
- int op, otherop;
-{
- value * argvec;
- char *ptr;
- char tstr[13];
- int static_memfuncp;
-
- COERCE_ENUM (arg1);
- COERCE_ENUM (arg2);
-
- /* now we know that what we have to do is construct our
- arg vector and find the right function to call it with. */
-
- if (TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_STRUCT)
- error ("friend functions not implemented yet");
-
- argvec = (value *) alloca (sizeof (value) * 4);
- argvec[1] = value_addr (arg1);
- argvec[2] = arg2;
- argvec[3] = 0;
-
- /* make the right function name up */
- strcpy(tstr, "operator __");
- ptr = tstr+9;
- switch (op)
- {
- case BINOP_ADD: strcpy(ptr,"+"); break;
- case BINOP_SUB: strcpy(ptr,"-"); break;
- case BINOP_MUL: strcpy(ptr,"*"); break;
- case BINOP_DIV: strcpy(ptr,"/"); break;
- case BINOP_REM: strcpy(ptr,"%"); break;
- case BINOP_LSH: strcpy(ptr,"<<"); break;
- case BINOP_RSH: strcpy(ptr,">>"); break;
- case BINOP_LOGAND: strcpy(ptr,"&"); break;
- case BINOP_LOGIOR: strcpy(ptr,"|"); break;
- case BINOP_LOGXOR: strcpy(ptr,"^"); break;
- case BINOP_AND: strcpy(ptr,"&&"); break;
- case BINOP_OR: strcpy(ptr,"||"); break;
- case BINOP_MIN: strcpy(ptr,"<?"); break;
- case BINOP_MAX: strcpy(ptr,">?"); break;
- case BINOP_ASSIGN: strcpy(ptr,"="); break;
- case BINOP_ASSIGN_MODIFY:
- switch (otherop)
- {
- case BINOP_ADD: strcpy(ptr,"+="); break;
- case BINOP_SUB: strcpy(ptr,"-="); break;
- case BINOP_MUL: strcpy(ptr,"*="); break;
- case BINOP_DIV: strcpy(ptr,"/="); break;
- case BINOP_REM: strcpy(ptr,"%="); break;
- case BINOP_LOGAND: strcpy(ptr,"&="); break;
- case BINOP_LOGIOR: strcpy(ptr,"|="); break;
- case BINOP_LOGXOR: strcpy(ptr,"^="); break;
- default:
- error ("Invalid binary operation specified.");
- }
- break;
- case BINOP_SUBSCRIPT: strcpy(ptr,"[]"); break;
- case BINOP_EQUAL: strcpy(ptr,"=="); break;
- case BINOP_NOTEQUAL: strcpy(ptr,"!="); break;
- case BINOP_LESS: strcpy(ptr,"<"); break;
- case BINOP_GTR: strcpy(ptr,">"); break;
- case BINOP_GEQ: strcpy(ptr,">="); break;
- case BINOP_LEQ: strcpy(ptr,"<="); break;
- default:
- error ("Invalid binary operation specified.");
- }
- argvec[0] = value_struct_elt (arg1, argvec+1, tstr, &static_memfuncp, "structure");
- if (argvec[0])
- {
- if (static_memfuncp)
- {
- argvec[1] = argvec[0];
- argvec++;
- }
- return call_function (argvec[0], 2 - static_memfuncp, argvec + 1);
- }
- error ("member function %s not found", tstr);
-}
-
-/* We know that arg1 is a structure, so try to find a unary user
- defined operator that matches the operator in question.
- Create an argument vector that calls arg1.operator @ (arg1)
- and return that value (where '@' is (almost) any unary operator which
- is legal for GNU C++). */
-
-value
-value_x_unop (arg1, op)
- value arg1;
- int op;
-{
- value * argvec;
- char *ptr;
- char tstr[13];
- int static_memfuncp;
-
- COERCE_ENUM (arg1);
-
- /* now we know that what we have to do is construct our
- arg vector and find the right function to call it with. */
-
- if (TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_STRUCT)
- error ("friend functions not implemented yet");
-
- argvec = (value *) alloca (sizeof (value) * 3);
- argvec[1] = value_addr (arg1);
- argvec[2] = 0;
-
- /* make the right function name up */
- strcpy(tstr,"operator __");
- ptr = tstr+9;
- switch (op)
- {
- case UNOP_PREINCREMENT: strcpy(ptr,"++"); break;
- case UNOP_PREDECREMENT: strcpy(ptr,"++"); break;
- case UNOP_POSTINCREMENT: strcpy(ptr,"++"); break;
- case UNOP_POSTDECREMENT: strcpy(ptr,"++"); break;
- case UNOP_ZEROP: strcpy(ptr,"!"); break;
- case UNOP_LOGNOT: strcpy(ptr,"~"); break;
- case UNOP_NEG: strcpy(ptr,"-"); break;
- default:
- error ("Invalid binary operation specified.");
- }
- argvec[0] = value_struct_elt (arg1, argvec+1, tstr, &static_memfuncp, "structure");
- if (argvec[0])
- {
- if (static_memfuncp)
- {
- argvec[1] = argvec[0];
- argvec++;
- }
- return call_function (argvec[0], 1 - static_memfuncp, argvec + 1);
- }
- error ("member function %s not found", tstr);
-}
-
-/* Perform a binary operation on two integers or two floats.
- Does not support addition and subtraction on pointers;
- use value_add or value_sub if you want to handle those possibilities. */
-
-value
-value_binop (arg1, arg2, op)
- value arg1, arg2;
- int op;
-{
- register value val;
-
- COERCE_ENUM (arg1);
- COERCE_ENUM (arg2);
-
- if ((TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_FLT
- &&
- TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_INT)
- ||
- (TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_FLT
- &&
- TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_INT))
- error ("Argument to arithmetic operation not a number.");
-
- if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_FLT
- ||
- TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_FLT)
- {
- double v1, v2, v;
- v1 = value_as_double (arg1);
- v2 = value_as_double (arg2);
- switch (op)
- {
- case BINOP_ADD:
- v = v1 + v2;
- break;
-
- case BINOP_SUB:
- v = v1 - v2;
- break;
-
- case BINOP_MUL:
- v = v1 * v2;
- break;
-
- case BINOP_DIV:
- v = v1 / v2;
- break;
-
- default:
- error ("Integer-only operation on floating point number.");
- }
-
- val = allocate_value (builtin_type_double);
- *(double *) VALUE_CONTENTS (val) = v;
- }
- else
- /* Integral operations here. */
- {
- /* Should we promote to unsigned longest? */
- if ((TYPE_UNSIGNED (VALUE_TYPE (arg1))
- || TYPE_UNSIGNED (VALUE_TYPE (arg2)))
- && (TYPE_LENGTH (VALUE_TYPE (arg1)) >= sizeof (unsigned LONGEST)
- || TYPE_LENGTH (VALUE_TYPE (arg2)) >= sizeof (unsigned LONGEST)))
- {
- unsigned LONGEST v1, v2, v;
- v1 = (unsigned LONGEST) value_as_long (arg1);
- v2 = (unsigned LONGEST) value_as_long (arg2);
-
- switch (op)
- {
- case BINOP_ADD:
- v = v1 + v2;
- break;
-
- case BINOP_SUB:
- v = v1 - v2;
- break;
-
- case BINOP_MUL:
- v = v1 * v2;
- break;
-
- case BINOP_DIV:
- v = v1 / v2;
- break;
-
- case BINOP_REM:
- v = v1 % v2;
- break;
-
- case BINOP_LSH:
- v = v1 << v2;
- break;
-
- case BINOP_RSH:
- v = v1 >> v2;
- break;
-
- case BINOP_LOGAND:
- v = v1 & v2;
- break;
-
- case BINOP_LOGIOR:
- v = v1 | v2;
- break;
-
- case BINOP_LOGXOR:
- v = v1 ^ v2;
- break;
-
- case BINOP_AND:
- v = v1 && v2;
- break;
-
- case BINOP_OR:
- v = v1 || v2;
- break;
-
- case BINOP_MIN:
- v = v1 < v2 ? v1 : v2;
- break;
-
- case BINOP_MAX:
- v = v1 > v2 ? v1 : v2;
- break;
-
- default:
- error ("Invalid binary operation on numbers.");
- }
-
- val = allocate_value (BUILTIN_TYPE_UNSIGNED_LONGEST);
- *(unsigned LONGEST *) VALUE_CONTENTS (val) = v;
- }
- else
- {
- LONGEST v1, v2, v;
- v1 = value_as_long (arg1);
- v2 = value_as_long (arg2);
-
- switch (op)
- {
- case BINOP_ADD:
- v = v1 + v2;
- break;
-
- case BINOP_SUB:
- v = v1 - v2;
- break;
-
- case BINOP_MUL:
- v = v1 * v2;
- break;
-
- case BINOP_DIV:
- v = v1 / v2;
- break;
-
- case BINOP_REM:
- v = v1 % v2;
- break;
-
- case BINOP_LSH:
- v = v1 << v2;
- break;
-
- case BINOP_RSH:
- v = v1 >> v2;
- break;
-
- case BINOP_LOGAND:
- v = v1 & v2;
- break;
-
- case BINOP_LOGIOR:
- v = v1 | v2;
- break;
-
- case BINOP_LOGXOR:
- v = v1 ^ v2;
- break;
-
- case BINOP_AND:
- v = v1 && v2;
- break;
-
- case BINOP_OR:
- v = v1 || v2;
- break;
-
- case BINOP_MIN:
- v = v1 < v2 ? v1 : v2;
- break;
-
- case BINOP_MAX:
- v = v1 > v2 ? v1 : v2;
- break;
-
- default:
- error ("Invalid binary operation on numbers.");
- }
-
- val = allocate_value (BUILTIN_TYPE_LONGEST);
- *(LONGEST *) VALUE_CONTENTS (val) = v;
- }
- }
-
- return val;
-}
-
-/* Simulate the C operator ! -- return 1 if ARG1 contains zeros. */
-
-int
-value_zerop (arg1)
- value arg1;
-{
- register int len;
- register char *p;
-
- COERCE_ARRAY (arg1);
-
- len = TYPE_LENGTH (VALUE_TYPE (arg1));
- p = VALUE_CONTENTS (arg1);
-
- while (--len >= 0)
- {
- if (*p++)
- break;
- }
-
- return len < 0;
-}
-
-/* Simulate the C operator == by returning a 1
- iff ARG1 and ARG2 have equal contents. */
-
-int
-value_equal (arg1, arg2)
- register value arg1, arg2;
-
-{
- register int len;
- register char *p1, *p2;
- enum type_code code1;
- enum type_code code2;
-
- COERCE_ARRAY (arg1);
- COERCE_ARRAY (arg2);
-
- code1 = TYPE_CODE (VALUE_TYPE (arg1));
- code2 = TYPE_CODE (VALUE_TYPE (arg2));
-
- if (code1 == TYPE_CODE_INT && code2 == TYPE_CODE_INT)
- return value_as_long (arg1) == value_as_long (arg2);
- else if ((code1 == TYPE_CODE_FLT || code1 == TYPE_CODE_INT)
- && (code2 == TYPE_CODE_FLT || code2 == TYPE_CODE_INT))
- return value_as_double (arg1) == value_as_double (arg2);
- else if ((code1 == TYPE_CODE_PTR && code2 == TYPE_CODE_INT)
- || (code2 == TYPE_CODE_PTR && code1 == TYPE_CODE_INT))
- return (char *) value_as_long (arg1) == (char *) value_as_long (arg2);
- else if (code1 == code2
- && ((len = TYPE_LENGTH (VALUE_TYPE (arg1)))
- == TYPE_LENGTH (VALUE_TYPE (arg2))))
- {
- p1 = VALUE_CONTENTS (arg1);
- p2 = VALUE_CONTENTS (arg2);
- while (--len >= 0)
- {
- if (*p1++ != *p2++)
- break;
- }
- return len < 0;
- }
- else
- error ("Invalid type combination in equality test.");
-}
-
-/* Simulate the C operator < by returning 1
- iff ARG1's contents are less than ARG2's. */
-
-int
-value_less (arg1, arg2)
- register value arg1, arg2;
-{
- register enum type_code code1;
- register enum type_code code2;
-
- COERCE_ARRAY (arg1);
- COERCE_ARRAY (arg2);
-
- code1 = TYPE_CODE (VALUE_TYPE (arg1));
- code2 = TYPE_CODE (VALUE_TYPE (arg2));
-
- if (code1 == TYPE_CODE_INT && code2 == TYPE_CODE_INT)
- return value_as_long (arg1) < value_as_long (arg2);
- else if ((code1 == TYPE_CODE_FLT || code1 == TYPE_CODE_INT)
- && (code2 == TYPE_CODE_FLT || code2 == TYPE_CODE_INT))
- return value_as_double (arg1) < value_as_double (arg2);
- else if ((code1 == TYPE_CODE_PTR || code1 == TYPE_CODE_INT)
- && (code2 == TYPE_CODE_PTR || code2 == TYPE_CODE_INT))
- return (char *) value_as_long (arg1) < (char *) value_as_long (arg2);
- else
- error ("Invalid type combination in ordering comparison.");
-}
-
-/* The unary operators - and ~. Both free the argument ARG1. */
-
-value
-value_neg (arg1)
- register value arg1;
-{
- register struct type *type;
-
- COERCE_ENUM (arg1);
-
- type = VALUE_TYPE (arg1);
-
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
- return value_from_double (type, - value_as_double (arg1));
- else if (TYPE_CODE (type) == TYPE_CODE_INT)
- return value_from_long (type, - value_as_long (arg1));
- else
- error ("Argument to negate operation not a number.");
-}
-
-value
-value_lognot (arg1)
- register value arg1;
-{
- COERCE_ENUM (arg1);
-
- if (TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_INT)
- error ("Argument to complement operation not an integer.");
-
- return value_from_long (VALUE_TYPE (arg1), ~ value_as_long (arg1));
-}
-
diff --git a/gnu/usr.bin/gdb/valops.c b/gnu/usr.bin/gdb/valops.c
deleted file mode 100644
index ab5652c..0000000
--- a/gnu/usr.bin/gdb/valops.c
+++ /dev/null
@@ -1,1418 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)valops.c 6.4 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* Perform non-arithmetic operations on values, for GDB.
- Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "stdio.h"
-#include "defs.h"
-#include "param.h"
-#include "symtab.h"
-#include "value.h"
-#include "frame.h"
-#include "inferior.h"
-
-/* Cast value ARG2 to type TYPE and return as a value.
- More general than a C cast: accepts any two types of the same length,
- and if ARG2 is an lvalue it can be cast into anything at all. */
-
-value
-value_cast (type, arg2)
- struct type *type;
- register value arg2;
-{
- register enum type_code code1;
- register enum type_code code2;
- register int scalar;
-
- /* Coerce arrays but not enums. Enums will work as-is
- and coercing them would cause an infinite recursion. */
- if (TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_ENUM)
- COERCE_ARRAY (arg2);
-
- code1 = TYPE_CODE (type);
- code2 = TYPE_CODE (VALUE_TYPE (arg2));
- scalar = (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_FLT
- || code2 == TYPE_CODE_ENUM);
-
- if (code1 == TYPE_CODE_FLT && scalar)
- return value_from_double (type, value_as_double (arg2));
- else if ((code1 == TYPE_CODE_INT || code1 == TYPE_CODE_ENUM)
- && (scalar || code2 == TYPE_CODE_PTR))
- return value_from_long (type, value_as_long (arg2));
- else if (TYPE_LENGTH (type) == TYPE_LENGTH (VALUE_TYPE (arg2)))
- {
- VALUE_TYPE (arg2) = type;
- return arg2;
- }
- else if (VALUE_LVAL (arg2) == lval_memory)
- {
- return value_at (type, VALUE_ADDRESS (arg2) + VALUE_OFFSET (arg2));
- }
- else
- error ("Invalid cast.");
-}
-
-/* Create a value of type TYPE that is zero, and return it. */
-
-value
-value_zero (type, lv)
- struct type *type;
- enum lval_type lv;
-{
- register value val = allocate_value (type);
-
- bzero (VALUE_CONTENTS (val), TYPE_LENGTH (type));
- VALUE_LVAL (val) = lv;
-
- return val;
-}
-
-/* Return the value with a specified type located at specified address. */
-
-value
-value_at (type, addr)
- struct type *type;
- CORE_ADDR addr;
-{
- register value val = allocate_value (type);
- int temp;
-
- temp = read_memory (addr, VALUE_CONTENTS (val), TYPE_LENGTH (type));
- if (temp)
- {
- if (have_inferior_p () && !remote_debugging)
- print_sys_errmsg ("ptrace", temp);
- /* Actually, address between addr and addr + len was out of bounds. */
- error ("Cannot read memory: address 0x%x out of bounds.", addr);
- }
-
- VALUE_LVAL (val) = lval_memory;
- VALUE_ADDRESS (val) = addr;
-
- return val;
-}
-
-/* Store the contents of FROMVAL into the location of TOVAL.
- Return a new value with the location of TOVAL and contents of FROMVAL. */
-
-value
-value_assign (toval, fromval)
- register value toval, fromval;
-{
- register struct type *type = VALUE_TYPE (toval);
- register value val;
- char raw_buffer[MAX_REGISTER_RAW_SIZE];
- char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
- int use_buffer = 0;
-
- extern CORE_ADDR find_saved_register ();
-
- COERCE_ARRAY (fromval);
-
- if (VALUE_LVAL (toval) != lval_internalvar)
- fromval = value_cast (type, fromval);
-
- /* If TOVAL is a special machine register requiring conversion
- of program values to a special raw format,
- convert FROMVAL's contents now, with result in `raw_buffer',
- and set USE_BUFFER to the number of bytes to write. */
-
- if (VALUE_REGNO (toval) >= 0
- && REGISTER_CONVERTIBLE (VALUE_REGNO (toval)))
- {
- int regno = VALUE_REGNO (toval);
- if (VALUE_TYPE (fromval) != REGISTER_VIRTUAL_TYPE (regno))
- fromval = value_cast (REGISTER_VIRTUAL_TYPE (regno), fromval);
- bcopy (VALUE_CONTENTS (fromval), virtual_buffer,
- REGISTER_VIRTUAL_SIZE (regno));
- REGISTER_CONVERT_TO_RAW (regno, virtual_buffer, raw_buffer);
- use_buffer = REGISTER_RAW_SIZE (regno);
- }
-
- switch (VALUE_LVAL (toval))
- {
- case lval_internalvar:
- set_internalvar (VALUE_INTERNALVAR (toval), fromval);
- break;
-
- case lval_internalvar_component:
- set_internalvar_component (VALUE_INTERNALVAR (toval),
- VALUE_OFFSET (toval),
- VALUE_BITPOS (toval),
- VALUE_BITSIZE (toval),
- fromval);
- break;
-
- case lval_memory:
- if (VALUE_BITSIZE (toval))
- {
- int val;
- read_memory (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
- &val, sizeof val);
- modify_field (&val, (int) value_as_long (fromval),
- VALUE_BITPOS (toval), VALUE_BITSIZE (toval));
- write_memory (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
- &val, sizeof val);
- }
- else if (use_buffer)
- write_memory (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
- raw_buffer, use_buffer);
- else
- write_memory (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
- VALUE_CONTENTS (fromval), TYPE_LENGTH (type));
- break;
-
- case lval_register:
- if (VALUE_BITSIZE (toval))
- {
- int val;
-
- read_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
- &val, sizeof val);
- modify_field (&val, (int) value_as_long (fromval),
- VALUE_BITPOS (toval), VALUE_BITSIZE (toval));
- write_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
- &val, sizeof val);
- }
- else if (use_buffer)
- write_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
- raw_buffer, use_buffer);
- else
- write_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
- VALUE_CONTENTS (fromval), TYPE_LENGTH (type));
- break;
-
- case lval_reg_frame_relative:
- {
- /* value is stored in a series of registers in the frame
- specified by the structure. Copy that value out, modify
- it, and copy it back in. */
- int amount_to_copy = (VALUE_BITSIZE (toval) ? 1 : TYPE_LENGTH (type));
- int reg_size = REGISTER_RAW_SIZE (VALUE_FRAME_REGNUM (toval));
- int byte_offset = VALUE_OFFSET (toval) % reg_size;
- int reg_offset = VALUE_OFFSET (toval) / reg_size;
- int amount_copied;
- char *buffer = (char *) alloca (amount_to_copy);
- int regno;
- FRAME frame;
- CORE_ADDR addr;
-
- /* Figure out which frame this is in currently. */
- for (frame = get_current_frame ();
- frame && FRAME_FP (frame) != VALUE_FRAME (toval);
- frame = get_prev_frame (frame))
- ;
-
- if (!frame)
- error ("Value being assigned to is no longer active.");
-
- amount_to_copy += (reg_size - amount_to_copy % reg_size);
-
- /* Copy it out. */
- for ((regno = VALUE_FRAME_REGNUM (toval) + reg_offset,
- amount_copied = 0);
- amount_copied < amount_to_copy;
- amount_copied += reg_size, regno++)
- {
- addr = find_saved_register (frame, regno);
- if (addr == 0)
- read_register_bytes (REGISTER_BYTE (regno),
- buffer + amount_copied,
- reg_size);
- else
- read_memory (addr, buffer + amount_copied, reg_size);
- }
-
- /* Modify what needs to be modified. */
- if (VALUE_BITSIZE (toval))
- modify_field (buffer + byte_offset,
- (int) value_as_long (fromval),
- VALUE_BITPOS (toval), VALUE_BITSIZE (toval));
- else if (use_buffer)
- bcopy (raw_buffer, buffer + byte_offset, use_buffer);
- else
- bcopy (VALUE_CONTENTS (fromval), buffer + byte_offset,
- TYPE_LENGTH (type));
-
- /* Copy it back. */
- for ((regno = VALUE_FRAME_REGNUM (toval) + reg_offset,
- amount_copied = 0);
- amount_copied < amount_to_copy;
- amount_copied += reg_size, regno++)
- {
- addr = find_saved_register (frame, regno);
- if (addr == 0)
- write_register_bytes (REGISTER_BYTE (regno),
- buffer + amount_copied,
- reg_size);
- else
- write_memory (addr, buffer + amount_copied, reg_size);
- }
- }
- break;
-
-
- default:
- error ("Left side of = operation is not an lvalue.");
- }
-
- /* Return a value just like TOVAL except with the contents of FROMVAL
- (except in the case of the type if TOVAL is an internalvar). */
-
- if (VALUE_LVAL (toval) == lval_internalvar
- || VALUE_LVAL (toval) == lval_internalvar_component)
- {
- type = VALUE_TYPE (fromval);
- }
-
- val = allocate_value (type);
- bcopy (toval, val, VALUE_CONTENTS (val) - (char *) val);
- bcopy (VALUE_CONTENTS (fromval), VALUE_CONTENTS (val), TYPE_LENGTH (type));
- VALUE_TYPE (val) = type;
-
- return val;
-}
-
-/* Extend a value VAL to COUNT repetitions of its type. */
-
-value
-value_repeat (arg1, count)
- value arg1;
- int count;
-{
- register value val;
-
- if (VALUE_LVAL (arg1) != lval_memory)
- error ("Only values in memory can be extended with '@'.");
- if (count < 1)
- error ("Invalid number %d of repetitions.", count);
-
- val = allocate_repeat_value (VALUE_TYPE (arg1), count);
-
- read_memory (VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1),
- VALUE_CONTENTS (val),
- TYPE_LENGTH (VALUE_TYPE (val)) * count);
- VALUE_LVAL (val) = lval_memory;
- VALUE_ADDRESS (val) = VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1);
-
- return val;
-}
-
-value
-value_of_variable (var)
- struct symbol *var;
-{
- return read_var_value (var, (FRAME) 0);
-}
-
-/* Given a value which is an array, return a value which is
- a pointer to its first element. */
-
-value
-value_coerce_array (arg1)
- value arg1;
-{
- register struct type *type;
- register value val;
-
- if (VALUE_LVAL (arg1) != lval_memory)
- error ("Attempt to take address of value not located in memory.");
-
- /* Get type of elements. */
- if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_ARRAY)
- type = TYPE_TARGET_TYPE (VALUE_TYPE (arg1));
- else
- /* A phony array made by value_repeat.
- Its type is the type of the elements, not an array type. */
- type = VALUE_TYPE (arg1);
-
- /* Get the type of the result. */
- type = lookup_pointer_type (type);
- val = value_from_long (builtin_type_long,
- (LONGEST) (VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1)));
- VALUE_TYPE (val) = type;
- return val;
-}
-
-/* Return a pointer value for the object for which ARG1 is the contents. */
-
-value
-value_addr (arg1)
- value arg1;
-{
- register struct type *type;
- register value val, arg1_coerced;
-
- /* Taking the address of an array is really a no-op
- once the array is coerced to a pointer to its first element. */
- arg1_coerced = arg1;
- COERCE_ARRAY (arg1_coerced);
- if (arg1 != arg1_coerced)
- return arg1_coerced;
-
- if (VALUE_LVAL (arg1) != lval_memory)
- error ("Attempt to take address of value not located in memory.");
-
- /* Get the type of the result. */
- type = lookup_pointer_type (VALUE_TYPE (arg1));
- val = value_from_long (builtin_type_long,
- (LONGEST) (VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1)));
- VALUE_TYPE (val) = type;
- return val;
-}
-
-/* Given a value of a pointer type, apply the C unary * operator to it. */
-
-value
-value_ind (arg1)
- value arg1;
-{
- /* Must do this before COERCE_ARRAY, otherwise an infinite loop
- will result */
- if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_REF)
- return value_at (TYPE_TARGET_TYPE (VALUE_TYPE (arg1)),
- (CORE_ADDR) value_as_long (arg1));
-
- COERCE_ARRAY (arg1);
-
- if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_MEMBER)
- error ("not implemented: member types in value_ind");
-
- /* Allow * on an integer so we can cast it to whatever we want.
- This returns an int, which seems like the most C-like thing
- to do. "long long" variables are rare enough that
- BUILTIN_TYPE_LONGEST would seem to be a mistake. */
- if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_INT)
- return value_at (builtin_type_int,
- (CORE_ADDR) value_as_long (arg1));
- else if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_PTR)
- return value_at (TYPE_TARGET_TYPE (VALUE_TYPE (arg1)),
- (CORE_ADDR) value_as_long (arg1));
- else if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_REF)
- return value_at (TYPE_TARGET_TYPE (VALUE_TYPE (arg1)),
- (CORE_ADDR) value_as_long (arg1));
- error ("Attempt to take contents of a non-pointer value.");
-}
-
-/* Pushing small parts of stack frames. */
-
-/* Push one word (the size of object that a register holds). */
-
-CORE_ADDR
-push_word (sp, buffer)
- CORE_ADDR sp;
- REGISTER_TYPE buffer;
-{
- register int len = sizeof (REGISTER_TYPE);
-
-#if 1 INNER_THAN 2
- sp -= len;
- write_memory (sp, &buffer, len);
-#else /* stack grows upward */
- write_memory (sp, &buffer, len);
- sp += len;
-#endif /* stack grows upward */
-
- return sp;
-}
-
-/* Push LEN bytes with data at BUFFER. */
-
-CORE_ADDR
-push_bytes (sp, buffer, len)
- CORE_ADDR sp;
- char *buffer;
- int len;
-{
-#if 1 INNER_THAN 2
- sp -= len;
- write_memory (sp, buffer, len);
-#else /* stack grows upward */
- write_memory (sp, buffer, len);
- sp += len;
-#endif /* stack grows upward */
-
- return sp;
-}
-
-/* Push onto the stack the specified value VALUE. */
-
-CORE_ADDR
-value_push (sp, arg)
- register CORE_ADDR sp;
- value arg;
-{
- register int len = TYPE_LENGTH (VALUE_TYPE (arg));
-
-#if 1 INNER_THAN 2
- sp -= len;
- write_memory (sp, VALUE_CONTENTS (arg), len);
-#else /* stack grows upward */
- write_memory (sp, VALUE_CONTENTS (arg), len);
- sp += len;
-#endif /* stack grows upward */
-
- return sp;
-}
-
-/* Perform the standard coercions that are specified
- for arguments to be passed to C functions. */
-
-value
-value_arg_coerce (arg)
- value arg;
-{
- register struct type *type;
-
- COERCE_ENUM (arg);
-
- type = VALUE_TYPE (arg);
-
- if (TYPE_CODE (type) == TYPE_CODE_INT
- && TYPE_LENGTH (type) < sizeof (int))
- return value_cast (builtin_type_int, arg);
-
- if (type == builtin_type_float)
- return value_cast (builtin_type_double, arg);
-
- return arg;
-}
-
-/* Push the value ARG, first coercing it as an argument
- to a C function. */
-
-CORE_ADDR
-value_arg_push (sp, arg)
- register CORE_ADDR sp;
- value arg;
-{
- return value_push (sp, value_arg_coerce (arg));
-}
-
-#ifdef NEW_CALL_FUNCTION
-
-int
-arg_stacklen(nargs, args)
- int nargs;
- value *args;
-{
- int len = 0;
-
- while (--nargs >= 0)
- len += TYPE_LENGTH(VALUE_TYPE(value_arg_coerce(args[nargs])));
-
- return len;
-}
-
-CORE_ADDR
-function_address(function, type)
- value function;
- struct type **type;
-{
- register CORE_ADDR funaddr;
- register struct type *ftype = VALUE_TYPE(function);
- register enum type_code code = TYPE_CODE(ftype);
-
- /*
- * If it's a member function, just look at the function part
- * of it.
- */
-
- /* Determine address to call. */
- if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD) {
- funaddr = VALUE_ADDRESS(function);
- *type = TYPE_TARGET_TYPE(ftype);
- } else if (code == TYPE_CODE_PTR) {
- funaddr = value_as_long(function);
- if (TYPE_CODE(TYPE_TARGET_TYPE(ftype)) == TYPE_CODE_FUNC
- || TYPE_CODE(TYPE_TARGET_TYPE(ftype)) == TYPE_CODE_METHOD)
- *type = TYPE_TARGET_TYPE(TYPE_TARGET_TYPE(ftype));
- else
- *type = builtin_type_int;
- } else if (code == TYPE_CODE_INT) {
- /*
- * Handle the case of functions lacking debugging
- * info. Their values are characters since their
- * addresses are char
- */
- if (TYPE_LENGTH(ftype) == 1)
-
- funaddr = value_as_long(value_addr(function));
- else
- /*
- * Handle integer used as address of a
- * function.
- */
- funaddr = value_as_long(function);
-
- *type = builtin_type_int;
- } else
- error("Invalid data type for function to be called.");
-
- return funaddr;
-}
-
-/* Perform a function call in the inferior.
- ARGS is a vector of values of arguments (NARGS of them).
- FUNCTION is a value, the function to be called.
- Returns a value representing what the function returned.
- May fail to return, if a breakpoint or signal is hit
- during the execution of the function. */
-
-value
-call_function(function, nargs, args)
- value function;
- int nargs;
- value *args;
-{
- register CORE_ADDR sp, pc;
- struct type *value_type;
- struct inferior_status inf_status;
- struct cleanup *old_chain;
- register CORE_ADDR funaddr;
- int struct_return_bytes;
- char retbuf[REGISTER_BYTES];
-
- if (!have_inferior_p())
- error("Cannot invoke functions if the inferior is not running.");
-
- save_inferior_status(&inf_status, 1);
- old_chain = make_cleanup(restore_inferior_status, &inf_status);
-
- sp = read_register(SP_REGNUM);
- funaddr = function_address(function, &value_type);
- /*
- * Are we returning a value using a structure return or a
- * normal value return?
- */
- if (using_struct_return(function, funaddr, value_type))
- struct_return_bytes = TYPE_LENGTH(value_type);
- else
- struct_return_bytes = 0;
- /*
- * Create a call sequence customized for this function and
- * the number of arguments for it.
- */
- pc = setup_dummy(sp, funaddr, nargs, args,
- struct_return_bytes, value_arg_push);
-
- /*
- * Execute the stack dummy stub. The register state will be
- * returned in retbuf. It is restored below.
- */
- run_stack_dummy(pc, retbuf);
-
- /*
- * This will restore the register context that existed before
- * we called the dummy function.
- */
- do_cleanups(old_chain);
-
- return value_being_returned(value_type, retbuf, struct_return_bytes);
-}
-#else
-
-/* Perform a function call in the inferior.
- ARGS is a vector of values of arguments (NARGS of them).
- FUNCTION is a value, the function to be called.
- Returns a value representing what the function returned.
- May fail to return, if a breakpoint or signal is hit
- during the execution of the function. */
-
-value
-call_function (function, nargs, args)
- value function;
- int nargs;
- value *args;
-{
- register CORE_ADDR sp;
- register int i;
- CORE_ADDR start_sp;
- static REGISTER_TYPE dummy[] = CALL_DUMMY;
- REGISTER_TYPE dummy1[sizeof dummy / sizeof (REGISTER_TYPE)];
- CORE_ADDR old_sp;
- struct type *value_type;
- unsigned char struct_return;
- CORE_ADDR struct_addr;
- struct inferior_status inf_status;
- struct cleanup *old_chain;
-
- if (!have_inferior_p ())
- error ("Cannot invoke functions if the inferior is not running.");
-
- save_inferior_status (&inf_status, 1);
- old_chain = make_cleanup (restore_inferior_status, &inf_status);
-
- /* PUSH_DUMMY_FRAME is responsible for saving the inferior registers
- (and POP_FRAME for restoring them). (At least on most machines)
- they are saved on the stack in the inferior. */
- PUSH_DUMMY_FRAME;
-
- old_sp = sp = read_register (SP_REGNUM);
-
-#if 1 INNER_THAN 2 /* Stack grows down */
- sp -= sizeof dummy;
- start_sp = sp;
-#else /* Stack grows up */
- start_sp = sp;
- sp += sizeof dummy;
-#endif
-
- {
- register CORE_ADDR funaddr;
- register struct type *ftype = VALUE_TYPE (function);
- register enum type_code code = TYPE_CODE (ftype);
-
- /* If it's a member function, just look at the function
- part of it. */
-
- /* Determine address to call. */
- if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD)
- {
- funaddr = VALUE_ADDRESS (function);
- value_type = TYPE_TARGET_TYPE (ftype);
- }
- else if (code == TYPE_CODE_PTR)
- {
- funaddr = value_as_long (function);
- if (TYPE_CODE (TYPE_TARGET_TYPE (ftype)) == TYPE_CODE_FUNC
- || TYPE_CODE (TYPE_TARGET_TYPE (ftype)) == TYPE_CODE_METHOD)
- value_type = TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (ftype));
- else
- value_type = builtin_type_int;
- }
- else if (code == TYPE_CODE_INT)
- {
- /* Handle the case of functions lacking debugging info.
- Their values are characters since their addresses are char */
- if (TYPE_LENGTH (ftype) == 1)
- funaddr = value_as_long (value_addr (function));
- else
- /* Handle integer used as address of a function. */
- funaddr = value_as_long (function);
-
- value_type = builtin_type_int;
- }
- else
- error ("Invalid data type for function to be called.");
-
- /* Are we returning a value using a structure return or a normal
- value return? */
-
- struct_return = using_struct_return (function, funaddr, value_type);
-
- /* Create a call sequence customized for this function
- and the number of arguments for it. */
- bcopy (dummy, dummy1, sizeof dummy);
- FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, value_type);
- }
-
-#ifndef CANNOT_EXECUTE_STACK
- write_memory (start_sp, dummy1, sizeof dummy);
-
-#else
- /* Convex Unix prohibits executing in the stack segment. */
- /* Hope there is empty room at the top of the text segment. */
- {
- extern CORE_ADDR text_end;
- static checked = 0;
- if (!checked)
- for (start_sp = text_end - sizeof dummy; start_sp < text_end; ++start_sp)
- if (read_memory_integer (start_sp, 1) != 0)
- error ("text segment full -- no place to put call");
- checked = 1;
- sp = old_sp;
- start_sp = text_end - sizeof dummy;
- write_memory (start_sp, dummy1, sizeof dummy);
- }
-#endif /* CANNOT_EXECUTE_STACK */
-#ifdef STACK_ALIGN
- /* If stack grows down, we must leave a hole at the top. */
- {
- int len = 0;
-
- /* Reserve space for the return structure to be written on the
- stack, if necessary */
-
- if (struct_return)
- len += TYPE_LENGTH (value_type);
-
- for (i = nargs - 1; i >= 0; i--)
- len += TYPE_LENGTH (VALUE_TYPE (value_arg_coerce (args[i])));
-#ifdef CALL_DUMMY_STACK_ADJUST
- len += CALL_DUMMY_STACK_ADJUST;
-#endif
-#if 1 INNER_THAN 2
- sp -= STACK_ALIGN (len) - len;
-#else
- sp += STACK_ALIGN (len) - len;
-#endif
- }
-#endif /* STACK_ALIGN */
-
- /* Reserve space for the return structure to be written on the
- stack, if necessary */
-
- if (struct_return)
- {
-#if 1 INNER_THAN 2
- sp -= TYPE_LENGTH (value_type);
- struct_addr = sp;
-#else
- struct_addr = sp;
- sp += TYPE_LENGTH (value_type);
-#endif
- }
-
- for (i = nargs - 1; i >= 0; i--)
- sp = value_arg_push (sp, args[i]);
-
-#ifdef CALL_DUMMY_STACK_ADJUST
-#if 1 INNER_THAN 2
- sp -= CALL_DUMMY_STACK_ADJUST;
-#else
- sp += CALL_DUMMY_STACK_ADJUST;
-#endif
-#endif /* CALL_DUMMY_STACK_ADJUST */
-
- /* Store the address at which the structure is supposed to be
- written. Note that this (and the code which reserved the space
- above) assumes that gcc was used to compile this function. Since
- it doesn't cost us anything but space and if the function is pcc
- it will ignore this value, we will make that assumption.
-
- Also note that on some machines (like the sparc) pcc uses this
- convention in a slightly twisted way also. */
-
- if (struct_return)
- STORE_STRUCT_RETURN (struct_addr, sp);
-
- /* Write the stack pointer. This is here because the statement above
- might fool with it */
- write_register (SP_REGNUM, sp);
-
- /* Figure out the value returned by the function. */
- {
- char retbuf[REGISTER_BYTES];
-
- /* Execute the stack dummy routine, calling FUNCTION.
- When it is done, discard the empty frame
- after storing the contents of all regs into retbuf. */
- run_stack_dummy (start_sp + CALL_DUMMY_START_OFFSET, retbuf);
-
- do_cleanups (old_chain);
-
- return value_being_returned (value_type, retbuf, struct_return);
- }
-}
-#endif
-
-/* Create a value for a string constant:
- Call the function malloc in the inferior to get space for it,
- then copy the data into that space
- and then return the address with type char *.
- PTR points to the string constant data; LEN is number of characters. */
-
-value
-value_string (ptr, len)
- char *ptr;
- int len;
-{
- register value val;
- register struct symbol *sym;
- value blocklen;
- register char *copy = (char *) alloca (len + 1);
- char *i = ptr;
- register char *o = copy, *ibeg = ptr;
- register int c;
-#ifdef KERNELDEBUG
- extern int kernel_debugging;
-
- if (kernel_debugging)
- error("Can't stuff string constants into kernel (yet).");
-#endif
-
- /* Copy the string into COPY, processing escapes.
- We could not conveniently process them in expread
- because the string there wants to be a substring of the input. */
-
- while (i - ibeg < len)
- {
- c = *i++;
- if (c == '\\')
- {
- c = parse_escape (&i);
- if (c == -1)
- continue;
- }
- *o++ = c;
- }
- *o = 0;
-
- /* Get the length of the string after escapes are processed. */
-
- len = o - copy;
-
- /* Find the address of malloc in the inferior. */
-
- sym = lookup_symbol ("malloc", 0, VAR_NAMESPACE, 0);
- if (sym != 0)
- {
- if (SYMBOL_CLASS (sym) != LOC_BLOCK)
- error ("\"malloc\" exists in this program but is not a function.");
- val = value_of_variable (sym);
- }
- else
- {
- register int i;
- for (i = 0; i < misc_function_count; i++)
- if (!strcmp (misc_function_vector[i].name, "malloc"))
- break;
- if (i < misc_function_count)
- val = value_from_long (builtin_type_long,
- (LONGEST) misc_function_vector[i].address);
- else
- error ("String constants require the program to have a function \"malloc\".");
- }
-
- blocklen = value_from_long (builtin_type_int, (LONGEST) (len + 1));
- val = call_function (val, 1, &blocklen);
- if (value_zerop (val))
- error ("No memory available for string constant.");
- write_memory ((CORE_ADDR) value_as_long (val), copy, len + 1);
- VALUE_TYPE (val) = lookup_pointer_type (builtin_type_char);
- return val;
-}
-
-static int
-type_field_index(t, name)
- register struct type *t;
- register char *name;
-{
- register int i;
-
- for (i = TYPE_NFIELDS(t); --i >= 0;)
- {
- register char *t_field_name = TYPE_FIELD_NAME (t, i);
-
- if (t_field_name && !strcmp (t_field_name, name))
- break;
- }
- return (i);
-}
-
-/* Given ARG1, a value of type (pointer to a)* structure/union,
- extract the component named NAME from the ultimate target structure/union
- and return it as a value with its appropriate type.
- ERR is used in the error message if ARG1's type is wrong.
-
- C++: ARGS is a list of argument types to aid in the selection of
- an appropriate method. Also, handle derived types.
-
- STATIC_MEMFUNCP, if non-NULL, points to a caller-supplied location
- where the truthvalue of whether the function that was resolved was
- a static member function or not.
-
- ERR is an error message to be printed in case the field is not found. */
-
-value
-value_struct_elt (arg1, args, name, static_memfuncp, err)
- register value arg1, *args;
- char *name;
- int *static_memfuncp;
- char *err;
-{
- register struct type *t;
- register int i;
- int found = 0;
-
- struct type *baseclass;
-
- COERCE_ARRAY (arg1);
-
- t = VALUE_TYPE (arg1);
-
- /* Check for the usual case: we have pointer, target type is a struct
- * and `name' is a legal field of the struct. In this case, we can
- * just snarf the value of the field & not waste time while value_ind
- * sucks over the entire struct. */
- if (! args)
- {
- if (TYPE_CODE(t) == TYPE_CODE_PTR
- && (TYPE_CODE((baseclass = TYPE_TARGET_TYPE(t))) == TYPE_CODE_STRUCT
- || TYPE_CODE(baseclass) == TYPE_CODE_UNION)
- && (i = type_field_index(baseclass, name)) >= 0)
- {
- register int offset;
- register struct type *f = TYPE_FIELD_TYPE(baseclass, i);
-
- offset = TYPE_FIELD_BITPOS(baseclass, i) >> 3;
- if (TYPE_FIELD_BITSIZE(baseclass, i) == 0)
- return value_at(f, (CORE_ADDR)(value_as_long(arg1) + offset));
- }
- }
-
- /* Follow pointers until we get to a non-pointer. */
-
- while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_CODE (t) == TYPE_CODE_REF)
- {
- arg1 = value_ind (arg1);
- COERCE_ARRAY (arg1);
- t = VALUE_TYPE (arg1);
- }
-
- if (TYPE_CODE (t) == TYPE_CODE_MEMBER)
- error ("not implemented: member type in value_struct_elt");
-
- if (TYPE_CODE (t) != TYPE_CODE_STRUCT
- && TYPE_CODE (t) != TYPE_CODE_UNION)
- error ("Attempt to extract a component of a value that is not a %s.", err);
-
- baseclass = t;
-
- /* Assume it's not, unless we see that it is. */
- if (static_memfuncp)
- *static_memfuncp =0;
-
- if (!args)
- {
- /* if there are no arguments ...do this... */
-
- /* Try as a variable first, because if we succeed, there
- is less work to be done. */
- while (t)
- {
- i = type_field_index(t, name);
- if (i >= 0)
- return TYPE_FIELD_STATIC (t, i)
- ? value_static_field (t, name, i) : value_field (arg1, i);
-
- if (TYPE_N_BASECLASSES (t) == 0)
- break;
-
- t = TYPE_BASECLASS (t, 1);
- VALUE_TYPE (arg1) = t; /* side effect! */
- }
-
- /* C++: If it was not found as a data field, then try to
- return it as a pointer to a method. */
- t = baseclass;
- VALUE_TYPE (arg1) = t; /* side effect! */
-
- if (destructor_name_p (name, t))
- error ("use `info method' command to print out value of destructor");
-
- while (t)
- {
- for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i)
- {
- if (! strcmp (TYPE_FN_FIELDLIST_NAME (t, i), name))
- {
- error ("use `info method' command to print value of method \"%s\"", name);
- }
- }
-
- if (TYPE_N_BASECLASSES (t) == 0)
- break;
-
- t = TYPE_BASECLASS (t, 1);
- }
-
- error ("There is no field named %s.", name);
- return 0;
- }
-
- if (destructor_name_p (name, t))
- {
- if (!args[1])
- {
- /* destructors are a special case. */
- return (value)value_fn_field (arg1, 0,
- TYPE_FN_FIELDLIST_LENGTH (t, 0));
- }
- else
- {
- error ("destructor should not have any argument");
- }
- }
-
- /* This following loop is for methods with arguments. */
- while (t)
- {
- /* Look up as method first, because that is where we
- expect to find it first. */
- for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; i--)
- {
- struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i);
-
- if (!strcmp (TYPE_FN_FIELDLIST_NAME (t, i), name))
- {
- int j;
- struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i);
-
- found = 1;
- for (j = TYPE_FN_FIELDLIST_LENGTH (t, i) - 1; j >= 0; --j)
- if (!typecmp (TYPE_FN_FIELD_STATIC_P (f, j),
- TYPE_FN_FIELD_ARGS (f, j), args))
- {
- if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
- return (value)value_virtual_fn_field (arg1, f, j, t);
- if (TYPE_FN_FIELD_STATIC_P (f, j) && static_memfuncp)
- *static_memfuncp = 1;
- return (value)value_fn_field (arg1, i, j);
- }
- }
- }
-
- if (TYPE_N_BASECLASSES (t) == 0)
- break;
-
- t = TYPE_BASECLASS (t, 1);
- VALUE_TYPE (arg1) = t; /* side effect! */
- }
-
- if (found)
- {
- error ("Structure method %s not defined for arglist.", name);
- return 0;
- }
- else
- {
- /* See if user tried to invoke data as function */
- t = baseclass;
- while (t)
- {
- i = type_field_index(t, name);
- if (i >= 0)
- return TYPE_FIELD_STATIC (t, i)
- ? value_static_field (t, name, i) : value_field (arg1, i);
-
- if (TYPE_N_BASECLASSES (t) == 0)
- break;
-
- t = TYPE_BASECLASS (t, 1);
- VALUE_TYPE (arg1) = t; /* side effect! */
- }
- error ("Structure has no component named %s.", name);
- }
-}
-
-/* C++: return 1 is NAME is a legitimate name for the destructor
- of type TYPE. If TYPE does not have a destructor, or
- if NAME is inappropriate for TYPE, an error is signaled. */
-int
-destructor_name_p (name, type)
- char *name;
- struct type *type;
-{
- /* destructors are a special case. */
- char *dname = TYPE_NAME (type);
-
- if (name[0] == '~')
- {
- if (! TYPE_HAS_DESTRUCTOR (type))
- error ("type `%s' does not have destructor defined",
- TYPE_NAME (type));
- /* Skip past the "struct " at the front. */
- while (*dname++ != ' ') ;
- if (strcmp (dname, name+1))
- error ("destructor specification error");
- else
- return 1;
- }
- return 0;
-}
-
-/* C++: Given ARG1, a value of type (pointer to a)* structure/union,
- return 1 if the component named NAME from the ultimate
- target structure/union is defined, otherwise, return 0. */
-
-int
-check_field (arg1, name)
- register value arg1;
- char *name;
-{
- register struct type *t;
- register int i;
- int found = 0;
-
- struct type *baseclass;
-
- COERCE_ARRAY (arg1);
-
- t = VALUE_TYPE (arg1);
-
- /* Follow pointers until we get to a non-pointer. */
-
- while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_CODE (t) == TYPE_CODE_REF)
- t = TYPE_TARGET_TYPE (t);
-
- if (TYPE_CODE (t) == TYPE_CODE_MEMBER)
- error ("not implemented: member type in check_field");
-
- if (TYPE_CODE (t) != TYPE_CODE_STRUCT
- && TYPE_CODE (t) != TYPE_CODE_UNION)
- error ("Internal error: `this' is not an aggregate");
-
- baseclass = t;
-
- while (t)
- {
- for (i = TYPE_NFIELDS (t) - 1; i >= 0; i--)
- {
- char *t_field_name = TYPE_FIELD_NAME (t, i);
- if (t_field_name && !strcmp (t_field_name, name))
- goto success;
- }
- if (TYPE_N_BASECLASSES (t) == 0)
- break;
-
- t = TYPE_BASECLASS (t, 1);
- VALUE_TYPE (arg1) = t; /* side effect! */
- }
-
- /* C++: If it was not found as a data field, then try to
- return it as a pointer to a method. */
- t = baseclass;
-
- /* Destructors are a special case. */
- if (destructor_name_p (name, t))
- goto success;
-
- while (t)
- {
- for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i)
- {
- if (!strcmp (TYPE_FN_FIELDLIST_NAME (t, i), name))
- return 1;
- }
-
- if (TYPE_N_BASECLASSES (t) == 0)
- break;
-
- t = TYPE_BASECLASS (t, 1);
- }
- return 0;
-
- success:
- t = VALUE_TYPE (arg1);
- while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_CODE (t) == TYPE_CODE_REF)
- {
- arg1 = value_ind (arg1);
- COERCE_ARRAY (arg1);
- t = VALUE_TYPE (arg1);
- }
-}
-
-/* C++: Given an aggregate type DOMAIN, and a member name NAME,
- return the address of this member as a pointer to member
- type. If INTYPE is non-null, then it will be the type
- of the member we are looking for. This will help us resolve
- pointers to member functions. */
-
-value
-value_struct_elt_for_address (domain, intype, name)
- struct type *domain, *intype;
- char *name;
-{
- register struct type *t = domain;
- register int i;
- int found = 0;
- value v;
-
- struct type *baseclass;
-
- if (TYPE_CODE (t) != TYPE_CODE_STRUCT
- && TYPE_CODE (t) != TYPE_CODE_UNION)
- error ("Internal error: non-aggregate type to value_struct_elt_for_address");
-
- baseclass = t;
-
- while (t)
- {
- for (i = TYPE_NFIELDS (t) - 1; i >= 0; i--)
- {
- char *t_field_name = TYPE_FIELD_NAME (t, i);
- if (t_field_name && !strcmp (t_field_name, name))
- {
- if (TYPE_FIELD_PACKED (t, i))
- error ("pointers to bitfield members not allowed");
-
- v = value_from_long (builtin_type_int,
- (LONGEST) (TYPE_FIELD_BITPOS (t, i) >> 3));
- VALUE_TYPE (v) = lookup_pointer_type (
- lookup_member_type (TYPE_FIELD_TYPE (t, i), baseclass));
- return v;
- }
- }
-
- if (TYPE_N_BASECLASSES (t) == 0)
- break;
-
- t = TYPE_BASECLASS (t, 1);
- }
-
- /* C++: If it was not found as a data field, then try to
- return it as a pointer to a method. */
- t = baseclass;
-
- /* Destructors are a special case. */
- if (destructor_name_p (name, t))
- {
- error ("pointers to destructors not implemented yet");
- }
-
- /* Perform all necessary dereferencing. */
- while (intype && TYPE_CODE (intype) == TYPE_CODE_PTR)
- intype = TYPE_TARGET_TYPE (intype);
-
- while (t)
- {
- for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i)
- {
- if (!strcmp (TYPE_FN_FIELDLIST_NAME (t, i), name))
- {
- int j = TYPE_FN_FIELDLIST_LENGTH (t, i);
- struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i);
-
- if (intype == 0 && j > 1)
- error ("non-unique member `%s' requires type instantiation", name);
- if (intype)
- {
- while (j--)
- if (TYPE_FN_FIELD_TYPE (f, j) == intype)
- break;
- if (j < 0)
- error ("no member function matches that type instantiation");
- }
- else
- j = 0;
-
- if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
- {
- v = value_from_long (builtin_type_long,
- (LONGEST) TYPE_FN_FIELD_VOFFSET (f, j));
- }
- else
- {
- struct symbol *s = lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j),
- 0, VAR_NAMESPACE, 0);
- v = locate_var_value (s, 0);
- }
- VALUE_TYPE (v) = lookup_pointer_type (lookup_member_type (TYPE_FN_FIELD_TYPE (f, j), baseclass));
- return v;
- }
- }
-
- if (TYPE_N_BASECLASSES (t) == 0)
- break;
-
- t = TYPE_BASECLASS (t, 1);
- }
- return 0;
-}
-
-/* Compare two argument lists and return the position in which they differ,
- or zero if equal.
-
- STATICP is nonzero if the T1 argument list came from a
- static member function.
-
- For non-static member functions, we ignore the first argument,
- which is the type of the instance variable. This is because we want
- to handle calls with objects from derived classes. This is not
- entirely correct: we should actually check to make sure that a
- requested operation is type secure, shouldn't we? */
-
-int
-typecmp (staticp, t1, t2)
- int staticp;
- struct type *t1[];
- value t2[];
-{
- int i;
-
- if (staticp && t1 == 0)
- return t2[1] != 0;
- if (t1 == 0)
- return 1;
- if (t1[0]->code == TYPE_CODE_VOID) return 0;
- if (t1[!staticp] == 0) return 0;
- for (i = !staticp; t1[i] && t1[i]->code != TYPE_CODE_VOID; i++)
- {
- if (! t2[i]
- || t1[i]->code != t2[i]->type->code
- || t1[i]->target_type != t2[i]->type->target_type)
- return i+1;
- }
- if (!t1[i]) return 0;
- return t2[i] ? i+1 : 0;
-}
-
-/* C++: return the value of the class instance variable, if one exists.
- Flag COMPLAIN signals an error if the request is made in an
- inappropriate context. */
-value
-value_of_this (complain)
- int complain;
-{
- extern FRAME selected_frame;
- struct symbol *func, *sym;
- char *funname = 0;
- struct block *b;
- int i;
-
- if (selected_frame == 0)
- if (complain)
- error ("no frame selected");
- else return 0;
-
- func = get_frame_function (selected_frame);
- if (func)
- funname = SYMBOL_NAME (func);
- else
- if (complain)
- error ("no `this' in nameless context");
- else return 0;
-
- b = SYMBOL_BLOCK_VALUE (func);
- i = BLOCK_NSYMS (b);
- if (i <= 0)
- if (complain)
- error ("no args, no `this'");
- else return 0;
-
- sym = BLOCK_SYM (b, 0);
- if (strncmp ("$this", SYMBOL_NAME (sym), 5))
- if (complain)
- error ("current stack frame not in method");
- else return 0;
-
- return read_var_value (sym, selected_frame);
-}
diff --git a/gnu/usr.bin/gdb/valprint.c b/gnu/usr.bin/gdb/valprint.c
deleted file mode 100644
index 781eb29..0000000
--- a/gnu/usr.bin/gdb/valprint.c
+++ /dev/null
@@ -1,1430 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)valprint.c 6.5 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* Print values for GNU debugger gdb.
- Copyright (C) 1986, 1988, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include "defs.h"
-#include "param.h"
-#include "symtab.h"
-#include "value.h"
-
-/* GNU software is only expected to run on systems with 32-bit integers. */
-#define UINT_MAX 0xffffffff
-
-/* Maximum number of chars to print for a string pointer value
- or vector contents, or UINT_MAX for no limit. */
-
-static unsigned int print_max;
-
-static void type_print_varspec_suffix ();
-static void type_print_varspec_prefix ();
-static void type_print_base ();
-static void type_print_method_args ();
-
-
-char **unsigned_type_table;
-char **signed_type_table;
-char **float_type_table;
-
-
-/* Print repeat counts if there are more than this
- many repetitions of an element in an array. */
-#define REPEAT_COUNT_THRESHOLD 10
-
-/* Print the character string STRING, printing at most LENGTH characters.
- Printing stops early if the number hits print_max; repeat counts
- are printed as appropriate. Print ellipses at the end if we
- had to stop before printing LENGTH characters, or if FORCE_ELLIPSES. */
-
-void
-print_string (stream, string, length, force_ellipses)
- FILE *stream;
- char *string;
- unsigned int length;
- int force_ellipses;
-{
- register unsigned int i;
- unsigned int things_printed = 0;
- int in_quotes = 0;
- int need_comma = 0;
-
- if (length == 0)
- {
- fputs_filtered ("\"\"", stdout);
- return;
- }
-
- for (i = 0; i < length && things_printed < print_max; ++i)
- {
- /* Position of the character we are examining
- to see whether it is repeated. */
- unsigned int rep1;
- /* Number of repititions we have detected so far. */
- unsigned int reps;
-
- QUIT;
-
- if (need_comma)
- {
- fputs_filtered (", ", stream);
- need_comma = 0;
- }
-
- rep1 = i + 1;
- reps = 1;
- while (rep1 < length && string[rep1] == string[i])
- {
- ++rep1;
- ++reps;
- }
-
- if (reps > REPEAT_COUNT_THRESHOLD)
- {
- if (in_quotes)
- {
- fputs_filtered ("\", ", stream);
- in_quotes = 0;
- }
- fputs_filtered ("'", stream);
- printchar (string[i], stream, '\'');
- fprintf_filtered (stream, "' <repeats %u times>", reps);
- i = rep1 - 1;
- things_printed += REPEAT_COUNT_THRESHOLD;
- need_comma = 1;
- }
- else
- {
- if (!in_quotes)
- {
- fputs_filtered ("\"", stream);
- in_quotes = 1;
- }
- printchar (string[i], stream, '"');
- ++things_printed;
- }
- }
-
- /* Terminate the quotes if necessary. */
- if (in_quotes)
- fputs_filtered ("\"", stream);
-
- if (force_ellipses || i < length)
- fputs_filtered ("...", stream);
-}
-
-/* Print the value VAL in C-ish syntax on stream STREAM.
- FORMAT is a format-letter, or 0 for print in natural format of data type.
- If the object printed is a string pointer, returns
- the number of string bytes printed. */
-
-int
-value_print (val, stream, format, pretty)
- value val;
- FILE *stream;
- char format;
- enum val_prettyprint pretty;
-{
- register unsigned int i, n, typelen;
-
- /* A "repeated" value really contains several values in a row.
- They are made by the @ operator.
- Print such values as if they were arrays. */
-
- if (VALUE_REPEATED (val))
- {
- n = VALUE_REPETITIONS (val);
- typelen = TYPE_LENGTH (VALUE_TYPE (val));
- fprintf_filtered (stream, "{");
- /* Print arrays of characters using string syntax. */
- if (typelen == 1 && TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_INT
- && format == 0)
- print_string (stream, VALUE_CONTENTS (val), n, 0);
- else
- {
- unsigned int things_printed = 0;
-
- for (i = 0; i < n && things_printed < print_max; i++)
- {
- /* Position of the array element we are examining to see
- whether it is repeated. */
- unsigned int rep1;
- /* Number of repititions we have detected so far. */
- unsigned int reps;
-
- if (i != 0)
- fprintf_filtered (stream, ", ");
-
- rep1 = i + 1;
- reps = 1;
- while (rep1 < n
- && !bcmp (VALUE_CONTENTS (val) + typelen * i,
- VALUE_CONTENTS (val) + typelen * rep1, typelen))
- {
- ++reps;
- ++rep1;
- }
-
- if (reps > REPEAT_COUNT_THRESHOLD)
- {
- val_print (VALUE_TYPE (val),
- VALUE_CONTENTS (val) + typelen * i,
- VALUE_ADDRESS (val) + typelen * i,
- stream, format, 1, 0, pretty);
- fprintf (stream, " <repeats %u times>", reps);
- i = rep1 - 1;
- things_printed += REPEAT_COUNT_THRESHOLD;
- }
- else
- {
- val_print (VALUE_TYPE (val),
- VALUE_CONTENTS (val) + typelen * i,
- VALUE_ADDRESS (val) + typelen * i,
- stream, format, 1, 0, pretty);
- things_printed++;
- }
- }
- if (i < n)
- fprintf_filtered (stream, "...");
- }
- fprintf_filtered (stream, "}");
- return n * typelen;
- }
- else
- {
- /* If it is a pointer, indicate what it points to.
-
- Print type also if it is a reference.
-
- C++: if it is a member pointer, we will take care
- of that when we print it. */
- if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_PTR
- || TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_REF)
- {
- fprintf_filtered (stream, "(");
- type_print (VALUE_TYPE (val), "", stream, -1);
- fprintf_filtered (stream, ") ");
-
- /* If this is a function pointer, try to print what
- function it is pointing to by name. */
- if (TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (val)))
- == TYPE_CODE_FUNC)
- {
- print_address (((int *) VALUE_CONTENTS (val))[0], stream);
- /* Return value is irrelevant except for string pointers. */
- return 0;
- }
- }
- return val_print (VALUE_TYPE (val), VALUE_CONTENTS (val),
- VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
- }
-}
-
-static int prettyprint; /* Controls prettyprinting of structures. */
-int unionprint; /* Controls printing of nested unions. */
-static void scalar_print_hack();
-void (*default_scalar_print)() = scalar_print_hack;
-
-/* Print data of type TYPE located at VALADDR (within GDB),
- which came from the inferior at address ADDRESS,
- onto stdio stream STREAM according to FORMAT
- (a letter or 0 for natural format).
-
- If the data are a string pointer, returns the number of
- sting characters printed.
-
- if DEREF_REF is nonzero, then dereference references,
- otherwise just print them like pointers.
-
- The PRETTY parameter controls prettyprinting. */
-
-int
-val_print (type, valaddr, address, stream, format,
- deref_ref, recurse, pretty)
- struct type *type;
- char *valaddr;
- CORE_ADDR address;
- FILE *stream;
- char format;
- int deref_ref;
- int recurse;
- enum val_prettyprint pretty;
-{
- register unsigned int i;
- int len, n_baseclasses;
- struct type *elttype;
- int eltlen;
- LONGEST val;
- unsigned char c;
-
- if (pretty == Val_pretty_default)
- {
- pretty = prettyprint ? Val_prettyprint : Val_no_prettyprint;
- }
-
- QUIT;
-
- if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
- {
- fprintf_filtered (stream, "<Type not defined in this context>");
- fflush (stream);
- return 0;
- }
-
- switch (TYPE_CODE (type))
- {
- case TYPE_CODE_ARRAY:
- if (TYPE_LENGTH (type) >= 0
- && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
- {
- elttype = TYPE_TARGET_TYPE (type);
- eltlen = TYPE_LENGTH (elttype);
- len = TYPE_LENGTH (type) / eltlen;
- fprintf_filtered (stream, "{");
- /* For an array of chars, print with string syntax. */
- if (eltlen == 1 && TYPE_CODE (elttype) == TYPE_CODE_INT
- && format == 0)
- print_string (stream, valaddr, len, 0);
- else
- {
- unsigned int things_printed = 0;
-
- for (i = 0; i < len && things_printed < print_max; i++)
- {
- /* Position of the array element we are examining to see
- whether it is repeated. */
- unsigned int rep1;
- /* Number of repititions we have detected so far. */
- unsigned int reps;
-
- if (i > 0)
- fprintf_filtered (stream, ", ");
-
- rep1 = i + 1;
- reps = 1;
- while (rep1 < len
- && !bcmp (valaddr + i * eltlen,
- valaddr + rep1 * eltlen, eltlen))
- {
- ++reps;
- ++rep1;
- }
-
- if (reps > REPEAT_COUNT_THRESHOLD)
- {
- val_print (elttype, valaddr + i * eltlen,
- 0, stream, format, deref_ref,
- recurse + 1, pretty);
- fprintf_filtered (stream, " <repeats %u times>", reps);
- i = rep1 - 1;
- things_printed += REPEAT_COUNT_THRESHOLD;
- }
- else
- {
- val_print (elttype, valaddr + i * eltlen,
- 0, stream, format, deref_ref,
- recurse + 1, pretty);
- things_printed++;
- }
- }
- if (i < len)
- fprintf_filtered (stream, "...");
- }
- fprintf_filtered (stream, "}");
- break;
- }
- /* Array of unspecified length: treat like pointer to first elt. */
- valaddr = (char *) &address;
-
- case TYPE_CODE_PTR:
- if (format)
- {
- print_scalar_formatted (valaddr, type, format, 0, stream);
- break;
- }
- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD)
- {
- struct type *domain = TYPE_DOMAIN_TYPE (TYPE_TARGET_TYPE (type));
- struct type *target = TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (type));
- struct fn_field *f;
- int j, len2;
- char *kind = "";
-
- val = unpack_long (builtin_type_int, valaddr);
- if (val < 128)
- {
- len = TYPE_NFN_FIELDS (domain);
- for (i = 0; i < len; i++)
- {
- f = TYPE_FN_FIELDLIST1 (domain, i);
- len2 = TYPE_FN_FIELDLIST_LENGTH (domain, i);
-
- for (j = 0; j < len2; j++)
- {
- QUIT;
- if (TYPE_FN_FIELD_VOFFSET (f, j) == val)
- {
- kind = "virtual";
- goto common;
- }
- }
- }
- }
- else
- {
- struct symbol *sym = find_pc_function ((CORE_ADDR) val);
- if (sym == 0)
- error ("invalid pointer to member function");
- len = TYPE_NFN_FIELDS (domain);
- for (i = 0; i < len; i++)
- {
- f = TYPE_FN_FIELDLIST1 (domain, i);
- len2 = TYPE_FN_FIELDLIST_LENGTH (domain, i);
-
- for (j = 0; j < len2; j++)
- {
- QUIT;
- if (!strcmp (SYMBOL_NAME (sym), TYPE_FN_FIELD_PHYSNAME (f, j)))
- goto common;
- }
- }
- }
- common:
- if (i < len)
- {
- fprintf_filtered (stream, "&");
- type_print_varspec_prefix (TYPE_FN_FIELD_TYPE (f, j), stream, 0, 0);
- fprintf (stream, kind);
- if (TYPE_FN_FIELD_PHYSNAME (f, j)[0] == '_'
- && TYPE_FN_FIELD_PHYSNAME (f, j)[1] == '$')
- type_print_method_args
- (TYPE_FN_FIELD_ARGS (f, j) + 1, "~",
- TYPE_FN_FIELDLIST_NAME (domain, i), 0, stream);
- else
- type_print_method_args
- (TYPE_FN_FIELD_ARGS (f, j), "",
- TYPE_FN_FIELDLIST_NAME (domain, i), 0, stream);
- break;
- }
- fprintf_filtered (stream, "(");
- type_print (type, "", stream, -1);
- fprintf_filtered (stream, ") %d", (int) val >> 3);
- }
- else if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_MEMBER)
- {
- struct type *domain = TYPE_DOMAIN_TYPE (TYPE_TARGET_TYPE (type));
- struct type *target = TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (type));
- char *kind = "";
-
- /* VAL is a byte offset into the structure type DOMAIN.
- Find the name of the field for that offset and
- print it. */
- int extra = 0;
- int bits = 0;
- len = TYPE_NFIELDS (domain);
- /* @@ Make VAL into bit offset */
- val = unpack_long (builtin_type_int, valaddr) << 3;
- for (i = 0; i < len; i++)
- {
- int bitpos = TYPE_FIELD_BITPOS (domain, i);
- QUIT;
- if (val == bitpos)
- break;
- if (val < bitpos && i > 0)
- {
- int ptrsize = (TYPE_LENGTH (builtin_type_char) * TYPE_LENGTH (target));
- /* Somehow pointing into a field. */
- i -= 1;
- extra = (val - TYPE_FIELD_BITPOS (domain, i));
- if (extra & 0x3)
- bits = 1;
- else
- extra >>= 3;
- break;
- }
- }
- if (i < len)
- {
- fprintf_filtered (stream, "&");
- type_print_base (domain, stream, 0, 0);
- fprintf_filtered (stream, "::");
- fputs_filtered (TYPE_FIELD_NAME (domain, i), stream);
- if (extra)
- fprintf_filtered (stream, " + %d bytes", extra);
- if (bits)
- fprintf_filtered (stream, " (offset in bits)");
- break;
- }
- fprintf_filtered (stream, "%d", val >> 3);
- }
- else
- {
- fprintf_filtered (stream, "0x%x", * (int *) valaddr);
- /* For a pointer to char or unsigned char,
- also print the string pointed to, unless pointer is null. */
-
- /* For an array of chars, print with string syntax. */
- elttype = TYPE_TARGET_TYPE (type);
- i = 0; /* Number of characters printed. */
- if (TYPE_LENGTH (elttype) == 1
- && TYPE_CODE (elttype) == TYPE_CODE_INT
- && format == 0
- && unpack_long (type, valaddr) != 0
- /* If print_max is UINT_MAX, the alloca below will fail.
- In that case don't try to print the string. */
- && print_max < UINT_MAX)
- {
- fprintf_filtered (stream, " ");
-
- /* Get first character. */
- if (read_memory ( (CORE_ADDR) unpack_long (type, valaddr),
- &c, 1))
- {
- /* First address out of bounds. */
- fprintf_filtered (stream, "<Address 0x%x out of bounds>",
- (* (int *) valaddr));
- break;
- }
- else
- {
- /* A real string. */
- int out_of_bounds = 0;
- char *string = (char *) alloca (print_max);
-
- /* If the loop ends by us hitting print_max characters,
- we need to have elipses at the end. */
- int force_ellipses = 1;
-
- /* This loop only fetches print_max characters, even
- though print_string might want to print more
- (with repeated characters). This is so that
- we don't spend forever fetching if we print
- a long string consisting of the same character
- repeated. */
- while (i < print_max)
- {
- QUIT;
- if (read_memory ((CORE_ADDR) unpack_long (type, valaddr)
- + i, &c, 1))
- {
- out_of_bounds = 1;
- force_ellipses = 0;
- break;
- }
- else if (c == '\0')
- {
- force_ellipses = 0;
- break;
- }
- else
- string[i++] = c;
- }
-
- if (i != 0)
- print_string (stream, string, i, force_ellipses);
- if (out_of_bounds)
- fprintf_filtered (stream,
- " <Address 0x%x out of bounds>",
- (*(int *) valaddr) + i);
- }
-
- fflush (stream);
- }
- /* Return number of characters printed, plus one for the
- terminating null if we have "reached the end". */
- return i + (print_max && i != print_max);
- }
- break;
-
- case TYPE_CODE_MEMBER:
- error ("not implemented: member type in val_print");
- break;
-
- case TYPE_CODE_REF:
- fprintf_filtered (stream, "(0x%x &) = ", * (int *) valaddr);
- /* De-reference the reference. */
- if (deref_ref)
- {
- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_UNDEF)
- {
- value val = value_at (TYPE_TARGET_TYPE (type), * (int *) valaddr);
- val_print (VALUE_TYPE (val), VALUE_CONTENTS (val),
- VALUE_ADDRESS (val), stream, format,
- deref_ref, recurse + 1, pretty);
- }
- else
- fprintf_filtered (stream, "???");
- }
- break;
-
- case TYPE_CODE_UNION:
- if (recurse && !unionprint)
- {
- fprintf_filtered (stream, "{...}");
- break;
- }
- /* Fall through. */
- case TYPE_CODE_STRUCT:
- fprintf_filtered (stream, "{");
- len = TYPE_NFIELDS (type);
- n_baseclasses = TYPE_N_BASECLASSES (type);
- for (i = 1; i <= n_baseclasses; i++)
- {
- fprintf_filtered (stream, "\n");
- if (pretty)
- print_spaces_filtered (2 + 2 * recurse, stream);
- fputs_filtered ("<", stream);
- fputs_filtered (TYPE_NAME (TYPE_BASECLASS (type, i)), stream);
- fputs_filtered ("> = ", stream);
- val_print (TYPE_FIELD_TYPE (type, 0),
- valaddr + TYPE_FIELD_BITPOS (type, i-1) / 8,
- 0, stream, 0, 0, recurse + 1, pretty);
- }
- if (i > 1) {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 + 2 * recurse, stream);
- fputs_filtered ("members of ", stream);
- fputs_filtered (TYPE_NAME (type), stream);
- fputs_filtered (": ", stream);
- }
- if (!len && i == 1)
- fprintf_filtered (stream, "<No data fields>");
- else
- {
- for (i -= 1; i < len; i++)
- {
- if (i > n_baseclasses) fprintf_filtered (stream, ", ");
- if (pretty)
- {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 + 2 * recurse, stream);
- }
- fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
- fputs_filtered (" = ", stream);
- /* check if static field */
- if (TYPE_FIELD_STATIC (type, i))
- {
- value v;
-
- v = value_static_field (type, TYPE_FIELD_NAME (type, i), i);
- val_print (TYPE_FIELD_TYPE (type, i),
- VALUE_CONTENTS (v), 0, stream, format,
- deref_ref, recurse + 1, pretty);
- }
- else if (TYPE_FIELD_PACKED (type, i))
- {
- char *valp = (char *) & val;
- union {int i; char c;} test;
- test.i = 1;
- if (test.c != 1)
- valp += sizeof val - TYPE_LENGTH (TYPE_FIELD_TYPE (type, i));
- val = unpack_field_as_long (type, valaddr, i);
- val_print (TYPE_FIELD_TYPE (type, i), valp, 0,
- stream, format, deref_ref, recurse + 1, pretty);
- }
- else
- {
- val_print (TYPE_FIELD_TYPE (type, i),
- valaddr + TYPE_FIELD_BITPOS (type, i) / 8,
- 0, stream, format, deref_ref,
- recurse + 1, pretty);
- }
- }
- if (pretty)
- {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 * recurse, stream);
- }
- }
- fprintf_filtered (stream, "}");
- break;
-
- case TYPE_CODE_ENUM:
- if (format)
- {
- print_scalar_formatted (valaddr, type, format, 0, stream);
- break;
- }
- len = TYPE_NFIELDS (type);
- val = unpack_long (builtin_type_int, valaddr);
- for (i = 0; i < len; i++)
- {
- QUIT;
- if (val == TYPE_FIELD_BITPOS (type, i))
- break;
- }
- if (i < len)
- fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
- else
- fprintf_filtered (stream, "%d", (int) val);
- break;
-
- case TYPE_CODE_FUNC:
- if (format)
- {
- print_scalar_formatted (valaddr, type, format, 0, stream);
- break;
- }
- fprintf_filtered (stream, "{");
- type_print (type, "", stream, -1);
- fprintf_filtered (stream, "} ");
- fprintf_filtered (stream, "0x%x", address);
- break;
-
- case TYPE_CODE_INT:
- if (format)
- print_scalar_formatted (valaddr, type, format, 0, stream);
- else
- {
- (*default_scalar_print)(stream, type, unpack_long(type, valaddr));
-#ifdef notdef
- if (TYPE_LENGTH (type) == 1)
- {
- fprintf_filtered (stream, " '");
- printchar ((unsigned char) unpack_long (type, valaddr),
- stream, '\'');
- fprintf_filtered (stream, "'");
- }
-#endif
- }
- break;
-
- case TYPE_CODE_FLT:
- if (format)
- print_scalar_formatted (valaddr, type, format, 0, stream);
- else
- print_floating (valaddr, type, stream);
- break;
-
- case TYPE_CODE_VOID:
- fprintf_filtered (stream, "void");
- break;
-
- default:
- error ("Invalid type code in symbol table.");
- }
- fflush (stream);
- return 0;
-}
-
-/* Print a description of a type TYPE
- in the form of a declaration of a variable named VARSTRING.
- Output goes to STREAM (via stdio).
- If SHOW is positive, we show the contents of the outermost level
- of structure even if there is a type name that could be used instead.
- If SHOW is negative, we never show the details of elements' types. */
-
-void
-type_print (type, varstring, stream, show)
- struct type *type;
- char *varstring;
- FILE *stream;
- int show;
-{
- type_print_1 (type, varstring, stream, show, 0);
-}
-
-/* LEVEL is the depth to indent lines by. */
-
-void
-type_print_1 (type, varstring, stream, show, level)
- struct type *type;
- char *varstring;
- FILE *stream;
- int show;
- int level;
-{
- register enum type_code code;
- type_print_base (type, stream, show, level);
- code = TYPE_CODE (type);
- if ((varstring && *varstring)
- ||
- /* Need a space if going to print stars or brackets;
- but not if we will print just a type name. */
- ((show > 0 || TYPE_NAME (type) == 0)
- &&
- (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC
- || code == TYPE_CODE_METHOD
- || code == TYPE_CODE_ARRAY
- || code == TYPE_CODE_MEMBER
- || code == TYPE_CODE_REF)))
- fprintf_filtered (stream, " ");
- type_print_varspec_prefix (type, stream, show, 0);
- fputs_filtered (varstring, stream);
- type_print_varspec_suffix (type, stream, show, 0);
-}
-
-/* Print the method arguments ARGS to the file STREAM. */
-static void
-type_print_method_args (args, prefix, varstring, staticp, stream)
- struct type **args;
- char *prefix, *varstring;
- int staticp;
- FILE *stream;
-{
- int i;
-
- fputs_filtered (" ", stream);
- fputs_filtered (prefix, stream);
- fputs_filtered (varstring, stream);
- fputs_filtered (" (", stream);
- if (args && args[!staticp] && args[!staticp]->code != TYPE_CODE_VOID)
- {
- i = !staticp; /* skip the class variable */
- while (1)
- {
- type_print (args[i++], "", stream, 0);
- if (!args[i])
- {
- fprintf_filtered (stream, " ...");
- break;
- }
- else if (args[i]->code != TYPE_CODE_VOID)
- {
- fprintf_filtered (stream, ", ");
- }
- else break;
- }
- }
- fprintf_filtered (stream, ")");
-}
-
-/* If TYPE is a derived type, then print out derivation
- information. Print out all layers of the type heirarchy
- until we encounter one with multiple inheritance.
- At that point, print out that ply, and return. */
-static void
-type_print_derivation_info (stream, type)
- FILE *stream;
- struct type *type;
-{
- char *name;
- int i, n_baseclasses = TYPE_N_BASECLASSES (type);
- struct type *basetype = 0;
-
- while (type && n_baseclasses == 1)
- {
- basetype = TYPE_BASECLASS (type, 1);
- if (TYPE_NAME (basetype) && (name = TYPE_NAME (basetype)))
- {
- while (*name != ' ') name++;
- fprintf_filtered (stream, ": %s%s ",
- TYPE_VIA_PUBLIC (basetype) ? "public" : "private",
- TYPE_VIA_VIRTUAL (basetype) ? " virtual" : "");
- fputs_filtered (name + 1, stream);
- fputs_filtered (" ", stream);
- }
- n_baseclasses = TYPE_N_BASECLASSES (basetype);
- type = basetype;
- }
-
- if (type)
- {
- if (n_baseclasses != 0)
- fprintf_filtered (stream, ": ");
- for (i = 1; i <= n_baseclasses; i++)
- {
- basetype = TYPE_BASECLASS (type, i);
- if (TYPE_NAME (basetype) && (name = TYPE_NAME (basetype)))
- {
- while (*name != ' ') name++;
- fprintf_filtered (stream, "%s%s ",
- TYPE_VIA_PUBLIC (basetype) ? "public" : "private",
- TYPE_VIA_VIRTUAL (basetype) ? " virtual" : "");
- fputs_filtered (name + 1, stream);
- }
- if (i < n_baseclasses)
- fprintf_filtered (stream, ", ");
- }
- fprintf_filtered (stream, " ");
- }
-}
-
-/* Print any asterisks or open-parentheses needed before the
- variable name (to describe its type).
-
- On outermost call, pass 0 for PASSED_A_PTR.
- On outermost call, SHOW > 0 means should ignore
- any typename for TYPE and show its details.
- SHOW is always zero on recursive calls. */
-
-static void
-type_print_varspec_prefix (type, stream, show, passed_a_ptr)
- struct type *type;
- FILE *stream;
- int show;
- int passed_a_ptr;
-{
- if (type == 0)
- return;
-
- if (TYPE_NAME (type) && show <= 0)
- return;
-
- QUIT;
-
- switch (TYPE_CODE (type))
- {
- case TYPE_CODE_PTR:
- type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
- fprintf_filtered (stream, "*");
- break;
-
- case TYPE_CODE_MEMBER:
- if (passed_a_ptr)
- fprintf_filtered (stream, "(");
- type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0,
- 0);
- fprintf_filtered (stream, " ");
- type_print_base (TYPE_DOMAIN_TYPE (type), stream, 0,
- passed_a_ptr);
- fprintf_filtered (stream, "::");
- break;
-
- case TYPE_CODE_METHOD:
- if (passed_a_ptr)
- fprintf (stream, "(");
- type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0,
- 0);
- fprintf_filtered (stream, " ");
- type_print_base (TYPE_DOMAIN_TYPE (type), stream, 0,
- passed_a_ptr);
- fprintf_filtered (stream, "::");
- break;
-
- case TYPE_CODE_REF:
- type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
- fprintf_filtered (stream, "&");
- break;
-
- case TYPE_CODE_FUNC:
- type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0,
- 0);
- if (passed_a_ptr)
- fprintf_filtered (stream, "(");
- break;
-
- case TYPE_CODE_ARRAY:
- type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0,
- 0);
- if (passed_a_ptr)
- fprintf_filtered (stream, "(");
- }
-}
-
-/* Print any array sizes, function arguments or close parentheses
- needed after the variable name (to describe its type).
- Args work like type_print_varspec_prefix. */
-
-static void
-type_print_varspec_suffix (type, stream, show, passed_a_ptr)
- struct type *type;
- FILE *stream;
- int show;
- int passed_a_ptr;
-{
- if (type == 0)
- return;
-
- if (TYPE_NAME (type) && show <= 0)
- return;
-
- QUIT;
-
- switch (TYPE_CODE (type))
- {
- case TYPE_CODE_ARRAY:
- if (passed_a_ptr)
- fprintf_filtered (stream, ")");
-
- fprintf_filtered (stream, "[");
- if (TYPE_LENGTH (type) >= 0
- && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
- fprintf_filtered (stream, "%d",
- (TYPE_LENGTH (type)
- / TYPE_LENGTH (TYPE_TARGET_TYPE (type))));
- fprintf_filtered (stream, "]");
-
- type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
- 0);
- break;
-
- case TYPE_CODE_MEMBER:
- if (passed_a_ptr)
- fprintf_filtered (stream, ")");
- type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0);
- break;
-
- case TYPE_CODE_METHOD:
- if (passed_a_ptr)
- fprintf_filtered (stream, ")");
- type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0);
- if (passed_a_ptr)
- {
- int i;
- struct type **args = TYPE_ARG_TYPES (type);
-
- fprintf_filtered (stream, "(");
- if (args[1] == 0)
- fprintf_filtered (stream, "...");
- else for (i = 1; args[i] != 0 && args[i]->code != TYPE_CODE_VOID; i++)
- {
- type_print_1 (args[i], "", stream, -1, 0);
- if (args[i+1] == 0)
- fprintf_filtered (stream, "...");
- else if (args[i+1]->code != TYPE_CODE_VOID)
- fprintf_filtered (stream, ",");
- }
- fprintf_filtered (stream, ")");
- }
- break;
-
- case TYPE_CODE_PTR:
- case TYPE_CODE_REF:
- type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1);
- break;
-
- case TYPE_CODE_FUNC:
- type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
- passed_a_ptr);
- if (passed_a_ptr)
- fprintf_filtered (stream, ")");
- fprintf_filtered (stream, "()");
- break;
- }
-}
-
-/* Print the name of the type (or the ultimate pointer target,
- function value or array element), or the description of a
- structure or union.
-
- SHOW nonzero means don't print this type as just its name;
- show its real definition even if it has a name.
- SHOW zero means print just typename or struct tag if there is one
- SHOW negative means abbreviate structure elements.
- SHOW is decremented for printing of structure elements.
-
- LEVEL is the depth to indent by.
- We increase it for some recursive calls. */
-
-static void
-type_print_base (type, stream, show, level)
- struct type *type;
- FILE *stream;
- int show;
- int level;
-{
- char *name;
- register int i;
- register int len;
- register int lastval;
-
- QUIT;
-
- if (type == 0)
- {
- fprintf_filtered (stream, "type unknown");
- return;
- }
-
- if (TYPE_NAME (type) && show <= 0)
- {
- fputs_filtered (TYPE_NAME (type), stream);
- return;
- }
-
- switch (TYPE_CODE (type))
- {
- case TYPE_CODE_ARRAY:
- case TYPE_CODE_PTR:
- case TYPE_CODE_MEMBER:
- case TYPE_CODE_REF:
- case TYPE_CODE_FUNC:
- case TYPE_CODE_METHOD:
- type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
- break;
-
- case TYPE_CODE_STRUCT:
- fprintf_filtered (stream, "struct ");
- goto struct_union;
-
- case TYPE_CODE_UNION:
- fprintf_filtered (stream, "union ");
- struct_union:
- if (TYPE_NAME (type) && (name = TYPE_NAME (type)))
- {
- while (*name != ' ') name++;
- fputs_filtered (name + 1, stream);
- fputs_filtered (" ", stream);
- }
- if (show < 0)
- fprintf_filtered (stream, "{...}");
- else
- {
- int i;
-
- type_print_derivation_info (stream, type);
-
- fprintf_filtered (stream, "{");
- len = TYPE_NFIELDS (type);
- if (len)
- fprintf_filtered (stream, "\n");
- else
- {
- if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
- fprintf_filtered (stream, "<incomplete type>\n");
- else
- fprintf_filtered (stream, "<no data fields>\n");
- }
-
- /* If there is a base class for this type,
- do not print the field that it occupies. */
- for (i = TYPE_N_BASECLASSES (type); i < len; i++)
- {
- QUIT;
- /* Don't print out virtual function table. */
- if (! strncmp (TYPE_FIELD_NAME (type, i),
- "_vptr$", 6))
- continue;
-
- print_spaces_filtered (level + 4, stream);
- if (TYPE_FIELD_STATIC (type, i))
- {
- fprintf_filtered (stream, "static ");
- }
- type_print_1 (TYPE_FIELD_TYPE (type, i),
- TYPE_FIELD_NAME (type, i),
- stream, show - 1, level + 4);
- if (!TYPE_FIELD_STATIC (type, i)
- && TYPE_FIELD_PACKED (type, i))
- {
- /* It is a bitfield. This code does not attempt
- to look at the bitpos and reconstruct filler,
- unnamed fields. This would lead to misleading
- results if the compiler does not put out fields
- for such things (I don't know what it does). */
- fprintf_filtered (stream, " : %d",
- TYPE_FIELD_BITSIZE (type, i));
- }
- fprintf_filtered (stream, ";\n");
- }
-
- /* C++: print out the methods */
- len = TYPE_NFN_FIELDS (type);
- if (len) fprintf_filtered (stream, "\n");
- for (i = 0; i < len; i++)
- {
- struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
- int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
-
- for (j = 0; j < len2; j++)
- {
- QUIT;
- print_spaces_filtered (level + 4, stream);
- if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
- fprintf_filtered (stream, "virtual ");
- else if (TYPE_FN_FIELD_STATIC_P (f, j))
- fprintf_filtered (stream, "static ");
- type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)), "", stream, 0);
- if (TYPE_FN_FIELD_PHYSNAME (f, j)[0] == '_'
- && TYPE_FN_FIELD_PHYSNAME (f, j)[1] == '$')
- type_print_method_args
- (TYPE_FN_FIELD_ARGS (f, j) + 1, "~",
- TYPE_FN_FIELDLIST_NAME (type, i), 0, stream);
- else
- type_print_method_args
- (TYPE_FN_FIELD_ARGS (f, j), "",
- TYPE_FN_FIELDLIST_NAME (type, i),
- TYPE_FN_FIELD_STATIC_P (f, j), stream);
-
- fprintf_filtered (stream, ";\n");
- }
- if (len2) fprintf_filtered (stream, "\n");
- }
-
- print_spaces_filtered (level, stream);
- fprintf_filtered (stream, "}");
- }
- break;
-
- case TYPE_CODE_ENUM:
- fprintf_filtered (stream, "enum ");
- if (TYPE_NAME (type))
- {
- name = TYPE_NAME (type);
- while (*name != ' ') name++;
- fputs_filtered (name + 1, stream);
- fputs_filtered (" ", stream);
- }
- if (show < 0)
- fprintf_filtered (stream, "{...}");
- else
- {
- fprintf_filtered (stream, "{");
- len = TYPE_NFIELDS (type);
- lastval = 0;
- for (i = 0; i < len; i++)
- {
- QUIT;
- if (i) fprintf_filtered (stream, ", ");
- fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
- if (lastval != TYPE_FIELD_BITPOS (type, i))
- {
- fprintf_filtered (stream, " : %d", TYPE_FIELD_BITPOS (type, i));
- lastval = TYPE_FIELD_BITPOS (type, i);
- }
- lastval++;
- }
- fprintf_filtered (stream, "}");
- }
- break;
-
- case TYPE_CODE_INT:
- if (TYPE_UNSIGNED (type))
- name = unsigned_type_table[TYPE_LENGTH (type)];
- else
- name = signed_type_table[TYPE_LENGTH (type)];
- fputs_filtered (name, stream);
- break;
-
- case TYPE_CODE_FLT:
- name = float_type_table[TYPE_LENGTH (type)];
- fputs_filtered (name, stream);
- break;
-
- case TYPE_CODE_VOID:
- fprintf_filtered (stream, "void");
- break;
-
- case 0:
- fprintf_filtered (stream, "struct unknown");
- break;
-
- default:
- error ("Invalid type code in symbol table.");
- }
-}
-
-static void
-scalar_print_decimal(stream, type, val)
- FILE *stream;
- struct type *type;
- LONGEST val;
-{
- fprintf_filtered(stream, TYPE_UNSIGNED(type)? "%lu":"%ld", val);
-}
-
-static void
-scalar_print_hex(stream, type, val)
- FILE *stream;
- struct type *type;
- LONGEST val;
-{
- switch (TYPE_LENGTH(type)) {
- case 1:
- fprintf_filtered (stream, "0x%02lx", val);
- break;
- case 2:
- fprintf_filtered (stream, "0x%04lx", val);
- break;
- case 4:
- fprintf_filtered (stream, "0x%08lx", val);
- break;
- default:
- fprintf_filtered (stream, "0x%lx", val);
- break;
- }
-}
-
-static void
-scalar_print_octal(stream, type, val)
- FILE *stream;
- struct type *type;
- LONGEST val;
-{
- switch (TYPE_LENGTH(type)) {
- case 1:
- fprintf_filtered (stream, "0%03lo", val);
- break;
- case 2:
- fprintf_filtered (stream, "0%06lo", val);
- break;
- case 4:
- fprintf_filtered (stream, "0%012lo", val);
- break;
- default:
- fprintf_filtered (stream, "0%lo", val);
- break;
- }
-}
-
-static void
-scalar_print_hack(stream, type, val)
- FILE *stream;
- struct type *type;
- LONGEST val;
-{
- if (TYPE_UNSIGNED(type))
- scalar_print_hex(stream, type, val);
- else
- scalar_print_decimal(stream, type, val);
-}
-
-static void
-set_maximum_command (arg)
- char *arg;
-{
- if (!arg) error_no_arg ("value for maximum elements to print");
- print_max = parse_and_eval_address (arg);
- if (print_max == 0)
- print_max = UINT_MAX;
-}
-
-static void
-set_base_command(arg)
- char *arg;
-{
- int base;
-
- if (!arg)
- base = 0;
- else
- base = parse_and_eval_address (arg);
- switch (base) {
- default:
- default_scalar_print = scalar_print_hack;
- break;
- case 8:
- default_scalar_print = scalar_print_octal;
- break;
- case 10:
- default_scalar_print = scalar_print_decimal;
- break;
- case 16:
- default_scalar_print = scalar_print_hex;
- break;
- }
-}
-
-static void
-set_prettyprint_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- prettyprint = parse_binary_operation ("set prettyprint", arg);
-}
-
-static void
-set_unionprint_command (arg, from_tty)
- char *arg;
- int from_tty;
-{
- unionprint = parse_binary_operation ("set unionprint", arg);
-}
-
-format_info (arg, from_tty)
- char *arg;
- int from_tty;
-{
- if (arg)
- error ("\"info format\" does not take any arguments.");
- printf ("Prettyprinting of structures is %s.\n",
- prettyprint ? "on" : "off");
- printf ("Printing of unions interior to structures is %s.\n",
- unionprint ? "on" : "off");
- if (print_max == UINT_MAX)
- printf_filtered
- ("There is no maximum number of array elements printed.\n");
- else
- printf_filtered
- ("The maximum number of array elements printed is %d.\n", print_max);
-}
-
-extern struct cmd_list_element *setlist;
-
-void
-_initialize_valprint ()
-{
- add_cmd ("base", class_support, set_base_command,
- "Change default integer print radix to 8, 10 or 16\n\
-No args returns to the ad-hoc default of `16' for unsigned values\n\
-and `10' otherwise.",
- &setlist);
- add_cmd ("array-max", class_vars, set_maximum_command,
- "Set NUMBER as limit on string chars or array elements to print.\n\
-\"set array-max 0\" causes there to be no limit.",
- &setlist);
-
- add_cmd ("prettyprint", class_support, set_prettyprint_command,
- "Turn prettyprinting of structures on and off.",
- &setlist);
- add_alias_cmd ("pp", "prettyprint", class_support, 1, &setlist);
-
- add_cmd ("unionprint", class_support, set_unionprint_command,
- "Turn printing of unions interior to structures on and off.",
- &setlist);
-
- add_info ("format", format_info,
- "Show current settings of data formatting options.");
-
- /* Give people the defaults which they are used to. */
- prettyprint = 0;
- unionprint = 1;
-
- print_max = 200;
-
- unsigned_type_table
- = (char **) xmalloc ((1 + sizeof (unsigned LONGEST)) * sizeof (char *));
- bzero (unsigned_type_table, (1 + sizeof (unsigned LONGEST)));
- unsigned_type_table[sizeof (unsigned char)] = "unsigned char";
- unsigned_type_table[sizeof (unsigned short)] = "unsigned short";
- unsigned_type_table[sizeof (unsigned long)] = "unsigned long";
- unsigned_type_table[sizeof (unsigned int)] = "unsigned int";
-#ifdef LONG_LONG
- unsigned_type_table[sizeof (unsigned long long)] = "unsigned long long";
-#endif
-
- signed_type_table
- = (char **) xmalloc ((1 + sizeof (LONGEST)) * sizeof (char *));
- bzero (signed_type_table, (1 + sizeof (LONGEST)));
- signed_type_table[sizeof (char)] = "char";
- signed_type_table[sizeof (short)] = "short";
- signed_type_table[sizeof (long)] = "long";
- signed_type_table[sizeof (int)] = "int";
-#ifdef LONG_LONG
- signed_type_table[sizeof (long long)] = "long long";
-#endif
-
- float_type_table
- = (char **) xmalloc ((1 + sizeof (double)) * sizeof (char *));
- bzero (float_type_table, (1 + sizeof (double)));
- float_type_table[sizeof (float)] = "float";
- float_type_table[sizeof (double)] = "double";
-}
-
diff --git a/gnu/usr.bin/gdb/value.h b/gnu/usr.bin/gdb/value.h
deleted file mode 100644
index 07dd8e8..0000000
--- a/gnu/usr.bin/gdb/value.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* Definitions for values of C expressions, for GDB.
- Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/*
- * The structure which defines the type of a value. It should never
- * be possible for a program lval value to survive over a call to the inferior
- * (ie to be put into the history list or an internal variable).
- */
-enum lval_type {
- /* Not an lval. */
- not_lval,
- /* In memory. Could be a saved register. */
- lval_memory,
- /* In a register. */
- lval_register,
- /* In a gdb internal variable. */
- lval_internalvar,
- /* Part of a gdb internal variable (structure field). */
- lval_internalvar_component,
- /* In a register series in a frame not the current one, which may have been
- partially saved or saved in different places (otherwise would be
- lval_register or lval_memory). */
- lval_reg_frame_relative,
-};
-
-struct value
- {
- /* Type of value; either not an lval, or one of the various
- different possible kinds of lval. */
- enum lval_type lval;
- /* Location of value (if lval). */
- union
- {
- /* Address in inferior or byte of registers structure. */
- CORE_ADDR address;
- /* Pointer to interrnal variable. */
- struct internalvar *internalvar;
- /* Number of register. Only used with
- lval_reg_frame_relative. */
- int regnum;
- } location;
- /* Describes offset of a value within lval a structure in bytes. */
- int offset;
- /* Only used for bitfields; number of bits contained in them. */
- int bitsize;
- /* Only used for bitfields; position of start of field. */
- int bitpos;
- /* Frame value is relative to. In practice, this address is only
- used if the value is stored in several registers in other than
- the current frame, and these registers have not all been saved
- at the same place in memory. This will be described in the
- lval enum above as "lval_reg_frame_relative". */
- CORE_ADDR frame_addr;
- /* Type of the value. */
- struct type *type;
- /* Values are stored in a chain, so that they can be deleted
- easily over calls to the inferior. Values assigned to internal
- variables or put into the value history are taken off this
- list. */
- struct value *next;
- /* If an lval is forced to repeat, a new value is created with
- these fields set. The new value is not an lval. */
- short repeated;
- short repetitions;
- /* Register number if the value is from a register. Is not kept
- if you take a field of a structure that is stored in a
- register. Shouldn't it be? */
- short regno;
- /* Actual contents of the value. For use of this value; setting
- it uses the stuff above. */
- long contents[1];
- };
-
-typedef struct value *value;
-
-#define VALUE_TYPE(val) (val)->type
-#define VALUE_CONTENTS(val) ((char *) (val)->contents)
-#define VALUE_LVAL(val) (val)->lval
-#define VALUE_ADDRESS(val) (val)->location.address
-#define VALUE_INTERNALVAR(val) (val)->location.internalvar
-#define VALUE_FRAME_REGNUM(val) ((val)->location.regnum)
-#define VALUE_FRAME(val) ((val)->frame_addr)
-#define VALUE_OFFSET(val) (val)->offset
-#define VALUE_BITSIZE(val) (val)->bitsize
-#define VALUE_BITPOS(val) (val)->bitpos
-#define VALUE_NEXT(val) (val)->next
-#define VALUE_REPEATED(val) (val)->repeated
-#define VALUE_REPETITIONS(val) (val)->repetitions
-#define VALUE_REGNO(val) (val)->regno
-
-/* If ARG is an array, convert it to a pointer.
- If ARG is an enum, convert it to an integer.
-
- References are dereferenced. */
-
-#define COERCE_ARRAY(arg) \
-{ if (TYPE_CODE ( VALUE_TYPE (arg)) == TYPE_CODE_REF) \
- arg = value_ind (arg); \
- if (VALUE_REPEATED (arg) \
- || TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ARRAY) \
- arg = value_coerce_array (arg); \
- if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ENUM) \
- arg = value_cast (builtin_type_unsigned_int, arg); \
-}
-
-/* If ARG is an enum, convert it to an integer. */
-
-#define COERCE_ENUM(arg) \
-{ if (TYPE_CODE ( VALUE_TYPE (arg)) == TYPE_CODE_REF) \
- arg = value_ind (arg); \
- if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ENUM) \
- arg = value_cast (builtin_type_unsigned_int, arg); \
-}
-
-/* Internal variables (variables for convenience of use of debugger)
- are recorded as a chain of these structures. */
-
-struct internalvar
-{
- struct internalvar *next;
- char *name;
- value value;
-};
-
-LONGEST value_as_long ();
-double value_as_double ();
-LONGEST unpack_long ();
-double unpack_double ();
-long unpack_field_as_long ();
-value value_from_long ();
-value value_from_double ();
-value value_at ();
-value value_from_register ();
-value value_of_variable ();
-value value_of_register ();
-value read_var_value ();
-value locate_var_value ();
-value allocate_value ();
-value allocate_repeat_value ();
-value value_string ();
-
-value value_binop ();
-value value_add ();
-value value_sub ();
-value value_coerce_array ();
-value value_ind ();
-value value_addr ();
-value value_assign ();
-value value_neg ();
-value value_lognot ();
-value value_struct_elt (), value_struct_elt_for_address ();
-value value_field ();
-value value_cast ();
-value value_zero ();
-value value_repeat ();
-value value_subscript ();
-
-value call_function ();
-value value_being_returned ();
-int using_struct_return ();
-
-value evaluate_expression ();
-value evaluate_type ();
-value parse_and_eval ();
-value parse_to_comma_and_eval ();
-
-value access_value_history ();
-value value_of_internalvar ();
-struct internalvar *lookup_internalvar ();
-
-int value_equal ();
-int value_less ();
-int value_zerop ();
-
-/* C++ */
-value value_of_this ();
-value value_static_field ();
-value value_x_binop ();
-value value_x_unop ();
-int binop_user_defined_p ();
-int unop_user_defined_p ();
-
-void read_register_bytes ();
-void modify_field ();
-void type_print ();
-void type_print_1 ();
-
-/* Possibilities for prettyprint parameters to routines which print
- things. */
-enum val_prettyprint {
- Val_no_prettyprint = 0,
- Val_prettyprint,
- /* Use the default setting which the user has specified. */
- Val_pretty_default
- };
-
diff --git a/gnu/usr.bin/gdb/values.c b/gnu/usr.bin/gdb/values.c
deleted file mode 100644
index 93a2911..0000000
--- a/gnu/usr.bin/gdb/values.c
+++ /dev/null
@@ -1,1059 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)values.c 6.3 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/* Low level packing and unpacking of values for GDB.
- Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include "defs.h"
-#include "param.h"
-#include "symtab.h"
-#include "value.h"
-
-/* The value-history records all the values printed
- by print commands during this session. Each chunk
- records 60 consecutive values. The first chunk on
- the chain records the most recent values.
- The total number of values is in value_history_count. */
-
-#define VALUE_HISTORY_CHUNK 60
-
-struct value_history_chunk
-{
- struct value_history_chunk *next;
- value values[VALUE_HISTORY_CHUNK];
-};
-
-/* Chain of chunks now in use. */
-
-static struct value_history_chunk *value_history_chain;
-
-static int value_history_count; /* Abs number of last entry stored */
-
-
-/* List of all value objects currently allocated
- (except for those released by calls to release_value)
- This is so they can be freed after each command. */
-
-static value all_values;
-
-/* Allocate a value that has the correct length for type TYPE. */
-
-value
-allocate_value (type)
- struct type *type;
-{
- register value val;
-
- /* If the type we want had no definition in the file it first
- * appeared in, it will be marked a `stub'. The real definition
- * probably appeared later so try to find it. */
- if (TYPE_FLAGS(type) & TYPE_FLAG_STUB)
- {
- register char *cp;
- register struct symbol *sym;
- extern char *index();
-
- if (cp = index(TYPE_NAME(type), ' '))
- ++cp;
- else
- cp = TYPE_NAME(type);
-
- sym = lookup_symbol(cp, 0, STRUCT_NAMESPACE, 0);
-
- if (sym && TYPE_CODE(SYMBOL_TYPE(sym)) == TYPE_CODE(type))
- bcopy (SYMBOL_TYPE (sym), type, sizeof (*type));
- }
- val = (value) xmalloc (sizeof (struct value) + TYPE_LENGTH (type));
- VALUE_NEXT (val) = all_values;
- all_values = val;
- VALUE_TYPE (val) = type;
- VALUE_LVAL (val) = not_lval;
- VALUE_ADDRESS (val) = 0;
- VALUE_FRAME (val) = 0;
- VALUE_OFFSET (val) = 0;
- VALUE_BITPOS (val) = 0;
- VALUE_BITSIZE (val) = 0;
- VALUE_REPEATED (val) = 0;
- VALUE_REPETITIONS (val) = 0;
- VALUE_REGNO (val) = -1;
- return val;
-}
-
-/* Allocate a value that has the correct length
- for COUNT repetitions type TYPE. */
-
-value
-allocate_repeat_value (type, count)
- struct type *type;
- int count;
-{
- register value val;
-
- val = (value) xmalloc (sizeof (struct value) + TYPE_LENGTH (type) * count);
- VALUE_NEXT (val) = all_values;
- all_values = val;
- VALUE_TYPE (val) = type;
- VALUE_LVAL (val) = not_lval;
- VALUE_ADDRESS (val) = 0;
- VALUE_FRAME (val) = 0;
- VALUE_OFFSET (val) = 0;
- VALUE_BITPOS (val) = 0;
- VALUE_BITSIZE (val) = 0;
- VALUE_REPEATED (val) = 1;
- VALUE_REPETITIONS (val) = count;
- VALUE_REGNO (val) = -1;
- return val;
-}
-
-/* Free all the values that have been allocated (except for those released).
- Called after each command, successful or not. */
-
-void
-free_all_values ()
-{
- register value val, next;
-
- for (val = all_values; val; val = next)
- {
- next = VALUE_NEXT (val);
- free (val);
- }
-
- all_values = 0;
-}
-
-/* Remove VAL from the chain all_values
- so it will not be freed automatically. */
-
-void
-release_value (val)
- register value val;
-{
- register value v;
-
- if (all_values == val)
- {
- all_values = val->next;
- return;
- }
-
- for (v = all_values; v; v = v->next)
- {
- if (v->next == val)
- {
- v->next = val->next;
- break;
- }
- }
-}
-
-/* Return a copy of the value ARG.
- It contains the same contents, for same memory address,
- but it's a different block of storage. */
-
-static value
-value_copy (arg)
- value arg;
-{
- register value val;
- register struct type *type = VALUE_TYPE (arg);
- if (VALUE_REPEATED (arg))
- val = allocate_repeat_value (type, VALUE_REPETITIONS (arg));
- else
- val = allocate_value (type);
- VALUE_LVAL (val) = VALUE_LVAL (arg);
- VALUE_ADDRESS (val) = VALUE_ADDRESS (arg);
- VALUE_OFFSET (val) = VALUE_OFFSET (arg);
- VALUE_BITPOS (val) = VALUE_BITPOS (arg);
- VALUE_BITSIZE (val) = VALUE_BITSIZE (arg);
- VALUE_REGNO (val) = VALUE_REGNO (arg);
- bcopy (VALUE_CONTENTS (arg), VALUE_CONTENTS (val),
- TYPE_LENGTH (VALUE_TYPE (arg))
- * (VALUE_REPEATED (arg) ? VALUE_REPETITIONS (arg) : 1));
- return val;
-}
-
-/* Access to the value history. */
-
-/* Record a new value in the value history.
- Returns the absolute history index of the entry. */
-
-int
-record_latest_value (val)
- value val;
-{
- int i;
- double foo;
-
- /* Check error now if about to store an invalid float. We return -1
- to the caller, but allow them to continue, e.g. to print it as "Nan". */
- if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_FLT) {
- foo = unpack_double (VALUE_TYPE (val), VALUE_CONTENTS (val), &i);
- if (i) return -1; /* Indicate value not saved in history */
- }
-
- /* Here we treat value_history_count as origin-zero
- and applying to the value being stored now. */
-
- i = value_history_count % VALUE_HISTORY_CHUNK;
- if (i == 0)
- {
- register struct value_history_chunk *new
- = (struct value_history_chunk *)
- xmalloc (sizeof (struct value_history_chunk));
- bzero (new->values, sizeof new->values);
- new->next = value_history_chain;
- value_history_chain = new;
- }
-
- value_history_chain->values[i] = val;
- release_value (val);
-
- /* Now we regard value_history_count as origin-one
- and applying to the value just stored. */
-
- return ++value_history_count;
-}
-
-/* Return a copy of the value in the history with sequence number NUM. */
-
-value
-access_value_history (num)
- int num;
-{
- register struct value_history_chunk *chunk;
- register int i;
- register int absnum = num;
-
- if (absnum <= 0)
- absnum += value_history_count;
-
- if (absnum <= 0)
- {
- if (num == 0)
- error ("The history is empty.");
- else if (num == 1)
- error ("There is only one value in the history.");
- else
- error ("History does not go back to $$%d.", -num);
- }
- if (absnum > value_history_count)
- error ("History has not yet reached $%d.", absnum);
-
- absnum--;
-
- /* Now absnum is always absolute and origin zero. */
-
- chunk = value_history_chain;
- for (i = (value_history_count - 1) / VALUE_HISTORY_CHUNK - absnum / VALUE_HISTORY_CHUNK;
- i > 0; i--)
- chunk = chunk->next;
-
- return value_copy (chunk->values[absnum % VALUE_HISTORY_CHUNK]);
-}
-
-/* Clear the value history entirely.
- Must be done when new symbol tables are loaded,
- because the type pointers become invalid. */
-
-void
-clear_value_history ()
-{
- register struct value_history_chunk *next;
- register int i;
- register value val;
-
- while (value_history_chain)
- {
- for (i = 0; i < VALUE_HISTORY_CHUNK; i++)
- if (val = value_history_chain->values[i])
- free (val);
- next = value_history_chain->next;
- free (value_history_chain);
- value_history_chain = next;
- }
- value_history_count = 0;
-}
-
-static void
-value_history_info (num_exp, from_tty)
- char *num_exp;
- int from_tty;
-{
- register int i;
- register value val;
- static int num = 1;
-
- if (num_exp)
- {
- if (num_exp[0] == '+' && num_exp[1] == '\0')
- /* "info history +" should print from the stored position. */
- ;
- else
- /* "info history <exp>" should print around value number <exp>. */
- num = parse_and_eval_address (num_exp) - 5;
- }
- else
- {
- /* "info history" means print the last 10 values. */
- num = value_history_count - 9;
- }
-
- if (num <= 0)
- num = 1;
-
- for (i = num; i < num + 10 && i <= value_history_count; i++)
- {
- val = access_value_history (i);
- printf_filtered ("$%d = ", i);
- value_print (val, stdout, 0, Val_pretty_default);
- printf_filtered ("\n");
- }
-
- /* The next "info history +" should start after what we just printed. */
- num += 10;
-
- /* Hitting just return after this command should do the same thing as
- "info history +". If num_exp is null, this is unnecessary, since
- "info history +" is not useful after "info history". */
- if (from_tty && num_exp)
- {
- num_exp[0] = '+';
- num_exp[1] = '\0';
- }
-}
-
-/* Internal variables. These are variables within the debugger
- that hold values assigned by debugger commands.
- The user refers to them with a '$' prefix
- that does not appear in the variable names stored internally. */
-
-static struct internalvar *internalvars;
-
-/* Look up an internal variable with name NAME. NAME should not
- normally include a dollar sign.
-
- If the specified internal variable does not exist,
- one is created, with a void value. */
-
-struct internalvar *
-lookup_internalvar (name)
- char *name;
-{
- register struct internalvar *var;
-
- for (var = internalvars; var; var = var->next)
- if (!strcmp (var->name, name))
- return var;
-
- var = (struct internalvar *) xmalloc (sizeof (struct internalvar));
- var->name = concat (name, "", "");
- var->value = allocate_value (builtin_type_void);
- release_value (var->value);
- var->next = internalvars;
- internalvars = var;
- return var;
-}
-
-value
-value_of_internalvar (var)
- struct internalvar *var;
-{
- register value val;
-
-#ifdef IS_TRAPPED_INTERNALVAR
- if (IS_TRAPPED_INTERNALVAR (var->name))
- return VALUE_OF_TRAPPED_INTERNALVAR (var);
-#endif
-
- val = value_copy (var->value);
- VALUE_LVAL (val) = lval_internalvar;
- VALUE_INTERNALVAR (val) = var;
- return val;
-}
-
-void
-set_internalvar_component (var, offset, bitpos, bitsize, newval)
- struct internalvar *var;
- int offset, bitpos, bitsize;
- value newval;
-{
- register char *addr = VALUE_CONTENTS (var->value) + offset;
-
-#ifdef IS_TRAPPED_INTERNALVAR
- if (IS_TRAPPED_INTERNALVAR (var->name))
- SET_TRAPPED_INTERNALVAR (var, newval, bitpos, bitsize, offset);
-#endif
-
- if (bitsize)
- modify_field (addr, (int) value_as_long (newval),
- bitpos, bitsize);
- else
- bcopy (VALUE_CONTENTS (newval), addr,
- TYPE_LENGTH (VALUE_TYPE (newval)));
-}
-
-void
-set_internalvar (var, val)
- struct internalvar *var;
- value val;
-{
-#ifdef IS_TRAPPED_INTERNALVAR
- if (IS_TRAPPED_INTERNALVAR (var->name))
- SET_TRAPPED_INTERNALVAR (var, val, 0, 0, 0);
-#endif
-
- free (var->value);
- var->value = value_copy (val);
- release_value (var->value);
-}
-
-char *
-internalvar_name (var)
- struct internalvar *var;
-{
- return var->name;
-}
-
-/* Free all internalvars. Done when new symtabs are loaded,
- because that makes the values invalid. */
-
-void
-clear_internalvars ()
-{
- register struct internalvar *var;
-
- while (internalvars)
- {
- var = internalvars;
- internalvars = var->next;
- free (var->name);
- free (var->value);
- free (var);
- }
-}
-
-static void
-convenience_info ()
-{
- register struct internalvar *var;
- int varseen = 0;
-
- for (var = internalvars; var; var = var->next)
- {
-#ifdef IS_TRAPPED_INTERNALVAR
- if (IS_TRAPPED_INTERNALVAR (var->name))
- continue;
-#endif
- if (!varseen)
- {
- printf ("Debugger convenience variables:\n\n");
- varseen = 1;
- }
- printf ("$%s: ", var->name);
- value_print (var->value, stdout, 0, Val_pretty_default);
- printf ("\n");
- }
- if (!varseen)
- printf ("No debugger convenience variables now defined.\n\
-Convenience variables have names starting with \"$\";\n\
-use \"set\" as in \"set $foo = 5\" to define them.\n");
-}
-
-/* Extract a value as a C number (either long or double).
- Knows how to convert fixed values to double, or
- floating values to long.
- Does not deallocate the value. */
-
-LONGEST
-value_as_long (val)
- register value val;
-{
- return unpack_long (VALUE_TYPE (val), VALUE_CONTENTS (val));
-}
-
-double
-value_as_double (val)
- register value val;
-{
- double foo;
- int inv;
-
- foo = unpack_double (VALUE_TYPE (val), VALUE_CONTENTS (val), &inv);
- if (inv)
- error ("Invalid floating value found in program.");
- return foo;
-}
-
-/* Unpack raw data (copied from debugee) at VALADDR
- as a long, or as a double, assuming the raw data is described
- by type TYPE. Knows how to convert different sizes of values
- and can convert between fixed and floating point.
-
- C++: It is assumed that the front-end has taken care of
- all matters concerning pointers to members. A pointer
- to member which reaches here is considered to be equivalent
- to an INT (or some size). After all, it is only an offset. */
-
-LONGEST
-unpack_long (type, valaddr)
- struct type *type;
- char *valaddr;
-{
- register enum type_code code = TYPE_CODE (type);
- register int len = TYPE_LENGTH (type);
- register int nosign = TYPE_UNSIGNED (type);
-
- if (code == TYPE_CODE_ENUM)
- code = TYPE_CODE_INT;
- if (code == TYPE_CODE_FLT)
- {
- if (len == sizeof (float))
- return * (float *) valaddr;
-
- if (len == sizeof (double))
- return * (double *) valaddr;
- }
- else if (code == TYPE_CODE_INT && nosign)
- {
- if (len == sizeof (char))
- return * (unsigned char *) valaddr;
-
- if (len == sizeof (short))
- return * (unsigned short *) valaddr;
-
- if (len == sizeof (int))
- return * (unsigned int *) valaddr;
-
- if (len == sizeof (long))
- return * (unsigned long *) valaddr;
-#ifdef LONG_LONG
- if (len == sizeof (long long))
- return * (unsigned long long *) valaddr;
-#endif
- }
- else if (code == TYPE_CODE_INT)
- {
- if (len == sizeof (char))
- return * (char *) valaddr;
-
- if (len == sizeof (short))
- return * (short *) valaddr;
-
- if (len == sizeof (int))
- return * (int *) valaddr;
-
- if (len == sizeof (long))
- return * (long *) valaddr;
-
-#ifdef LONG_LONG
- if (len == sizeof (long long))
- return * (long long *) valaddr;
-#endif
- }
- else if (code == TYPE_CODE_PTR
- || code == TYPE_CODE_REF)
- {
- if (len == sizeof (char *))
- return (CORE_ADDR) * (char **) valaddr;
- }
- else if (code == TYPE_CODE_MEMBER)
- error ("not implemented: member types in unpack_long");
-
- error ("Value not integer or pointer.");
-}
-
-/* Return a double value from the specified type and address.
- INVP points to an int which is set to 0 for valid value,
- 1 for invalid value (bad float format). In either case,
- the returned double is OK to use. */
-
-double
-unpack_double (type, valaddr, invp)
- struct type *type;
- char *valaddr;
- int *invp;
-{
- register enum type_code code = TYPE_CODE (type);
- register int len = TYPE_LENGTH (type);
- register int nosign = TYPE_UNSIGNED (type);
-
- *invp = 0; /* Assume valid. */
- if (code == TYPE_CODE_FLT)
- {
- if (INVALID_FLOAT (valaddr, len))
- {
- *invp = 1;
- return 1.234567891011121314;
- }
-
- if (len == sizeof (float))
- return * (float *) valaddr;
-
- if (len == sizeof (double))
- {
- /* Some machines require doubleword alignment for doubles.
- This code works on them, and on other machines. */
- double temp;
- bcopy ((char *) valaddr, (char *) &temp, sizeof (double));
- return temp;
- }
- }
- else if (code == TYPE_CODE_INT && nosign)
- {
- if (len == sizeof (char))
- return * (unsigned char *) valaddr;
-
- if (len == sizeof (short))
- return * (unsigned short *) valaddr;
-
- if (len == sizeof (int))
- return * (unsigned int *) valaddr;
-
- if (len == sizeof (long))
- return * (unsigned long *) valaddr;
-
-#ifdef LONG_LONG
- if (len == sizeof (long long))
- return * (unsigned long long *) valaddr;
-#endif
- }
- else if (code == TYPE_CODE_INT)
- {
- if (len == sizeof (char))
- return * (char *) valaddr;
-
- if (len == sizeof (short))
- return * (short *) valaddr;
-
- if (len == sizeof (int))
- return * (int *) valaddr;
-
- if (len == sizeof (long))
- return * (long *) valaddr;
-
-#ifdef LONG_LONG
- if (len == sizeof (long long))
- return * (long long *) valaddr;
-#endif
- }
-
- error ("Value not floating number.");
- /* NOTREACHED */
- return (double) 0; /* To silence compiler warning. */
-}
-
-/* Given a value ARG1 of a struct or union type,
- extract and return the value of one of its fields.
- FIELDNO says which field.
-
- For C++, must also be able to return values from static fields */
-
-value
-value_field (arg1, fieldno)
- register value arg1;
- register int fieldno;
-{
- register value v;
- register struct type *type = TYPE_FIELD_TYPE (VALUE_TYPE (arg1), fieldno);
- register int offset;
-
- /* Handle packed fields */
-
- offset = TYPE_FIELD_BITPOS (VALUE_TYPE (arg1), fieldno) / 8;
- if (TYPE_FIELD_BITSIZE (VALUE_TYPE (arg1), fieldno))
- {
- v = value_from_long (type,
- unpack_field_as_long (VALUE_TYPE (arg1),
- VALUE_CONTENTS (arg1),
- fieldno));
- VALUE_BITPOS (v) = TYPE_FIELD_BITPOS (VALUE_TYPE (arg1), fieldno) % 8;
- VALUE_BITSIZE (v) = TYPE_FIELD_BITSIZE (VALUE_TYPE (arg1), fieldno);
- }
- else
- {
- v = allocate_value (type);
- bcopy (VALUE_CONTENTS (arg1) + offset,
- VALUE_CONTENTS (v),
- TYPE_LENGTH (type));
- }
- VALUE_LVAL (v) = VALUE_LVAL (arg1);
- if (VALUE_LVAL (arg1) == lval_internalvar)
- VALUE_LVAL (v) = lval_internalvar_component;
- VALUE_ADDRESS (v) = VALUE_ADDRESS (arg1);
- VALUE_OFFSET (v) = offset + VALUE_OFFSET (arg1);
- return v;
-}
-
-value
-value_fn_field (arg1, fieldno, subfieldno)
- register value arg1;
- register int fieldno;
-{
- register value v;
- struct fn_field *f = TYPE_FN_FIELDLIST1 (VALUE_TYPE (arg1), fieldno);
- register struct type *type = TYPE_FN_FIELD_TYPE (f, subfieldno);
- struct symbol *sym;
-
- sym = lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, subfieldno),
- 0, VAR_NAMESPACE, 0);
- if (! sym) error ("Internal error: could not find physical method named %s",
- TYPE_FN_FIELD_PHYSNAME (f, subfieldno));
-
- v = allocate_value (type);
- VALUE_ADDRESS (v) = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
- VALUE_TYPE (v) = type;
- return v;
-}
-
-/* Return a virtual function as a value.
- ARG1 is the object which provides the virtual function
- table pointer.
- F is the list of member functions which contains the desired virtual
- function.
- J is an index into F which provides the desired virtual function.
- TYPE is the basetype which first provides the virtual function table. */
-value
-value_virtual_fn_field (arg1, f, j, type)
- value arg1;
- struct fn_field *f;
- int j;
- struct type *type;
-{
- /* First, get the virtual function table pointer. That comes
- with a strange type, so cast it to type `pointer to long' (which
- should serve just fine as a function type). Then, index into
- the table, and convert final value to appropriate function type. */
- value vfn, vtbl;
- value vi = value_from_long (builtin_type_int,
- (LONGEST) TYPE_FN_FIELD_VOFFSET (f, j));
- VALUE_TYPE (arg1) = TYPE_VPTR_BASETYPE (type);
-
- /* This type may have been defined before its virtual function table
- was. If so, fill in the virtual function table entry for the
- type now. */
- if (TYPE_VPTR_FIELDNO (type) < 0)
- TYPE_VPTR_FIELDNO (type)
- = fill_in_vptr_fieldno (type);
-
- /* The virtual function table is now an array of structures
- which have the form { int16 offset, delta; void *pfn; }. */
- vtbl = value_ind (value_field (arg1, TYPE_VPTR_FIELDNO (type)));
-
- /* Index into the virtual function table. This is hard-coded because
- looking up a field is not cheap, and it may be important to save
- time, e.g. if the user has set a conditional breakpoint calling
- a virtual function. */
- vfn = value_field (value_subscript (vtbl, vi), 2);
-
- /* Reinstantiate the function pointer with the correct type. */
- VALUE_TYPE (vfn) = lookup_pointer_type (TYPE_FN_FIELD_TYPE (f, j));
- return vfn;
-}
-
-/* The value of a static class member does not depend
- on its instance, only on its type. If FIELDNO >= 0,
- then fieldno is a valid field number and is used directly.
- Otherwise, FIELDNAME is the name of the field we are
- searching for. If it is not a static field name, an
- error is signaled. TYPE is the type in which we look for the
- static field member. */
-value
-value_static_field (type, fieldname, fieldno)
- register struct type *type;
- char *fieldname;
- register int fieldno;
-{
- register value v;
- struct symbol *sym;
-
- if (fieldno < 0)
- {
- register struct type *t = type;
- /* Look for static field. */
- while (t)
- {
- int i;
- for (i = TYPE_NFIELDS (t) - 1; i >= 0; i--)
- if (! strcmp (TYPE_FIELD_NAME (t, i), fieldname))
- {
- if (TYPE_FIELD_STATIC (t, i))
- {
- fieldno = i;
- goto found;
- }
- else
- error ("field `%s' is not static");
- }
- t = TYPE_BASECLASSES (t) ? TYPE_BASECLASS (t, 1) : 0;
- }
-
- t = type;
-
- if (destructor_name_p (fieldname, t))
- error ("use `info method' command to print out value of destructor");
-
- while (t)
- {
- int i, j;
-
- for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; i--)
- {
- if (! strcmp (TYPE_FN_FIELDLIST_NAME (t, i), fieldname))
- {
- error ("use `info method' command to print value of method \"%s\"", fieldname);
- }
- }
- t = TYPE_BASECLASSES (t) ? TYPE_BASECLASS (t, 1) : 0;
- }
- error("there is no field named %s", fieldname);
- }
-
- found:
-
- sym = lookup_symbol (TYPE_FIELD_STATIC_PHYSNAME (type, fieldno),
- 0, VAR_NAMESPACE, 0);
- if (! sym) error ("Internal error: could not find physical static variable named %s", TYPE_FIELD_BITSIZE (type, fieldno));
-
- type = TYPE_FIELD_TYPE (type, fieldno);
- v = value_at (type, (CORE_ADDR)SYMBOL_BLOCK_VALUE (sym));
- return v;
-}
-
-long
-unpack_field_as_long (type, valaddr, fieldno)
- struct type *type;
- char *valaddr;
- int fieldno;
-{
- long val;
- int bitpos = TYPE_FIELD_BITPOS (type, fieldno);
- int bitsize = TYPE_FIELD_BITSIZE (type, fieldno);
-
- bcopy (valaddr + bitpos / 8, &val, sizeof val);
-
- /* Extracting bits depends on endianness of the machine. */
-#ifdef BITS_BIG_ENDIAN
- val = val >> (sizeof val * 8 - bitpos % 8 - bitsize);
-#else
- val = val >> (bitpos % 8);
-#endif
-
- val &= (1 << bitsize) - 1;
- return val;
-}
-
-void
-modify_field (addr, fieldval, bitpos, bitsize)
- char *addr;
- int fieldval;
- int bitpos, bitsize;
-{
- long oword;
-
- /* Reject values too big to fit in the field in question.
- Otherwise adjoining fields may be corrupted. */
- if (fieldval & ~((1<<bitsize)-1))
- error ("Value %d does not fit in %d bits.", fieldval, bitsize);
-
- bcopy (addr, &oword, sizeof oword);
-
- /* Shifting for bit field depends on endianness of the machine. */
-#ifdef BITS_BIG_ENDIAN
- bitpos = sizeof (oword) * 8 - bitpos - bitsize;
-#endif
-
- oword &= ~(((1 << bitsize) - 1) << bitpos);
- oword |= fieldval << bitpos;
- bcopy (&oword, addr, sizeof oword);
-}
-
-/* Convert C numbers into newly allocated values */
-
-value
-value_from_long (type, num)
- struct type *type;
- register LONGEST num;
-{
- register value val = allocate_value (type);
- register enum type_code code = TYPE_CODE (type);
- register int len = TYPE_LENGTH (type);
-
- if (code == TYPE_CODE_INT || code == TYPE_CODE_ENUM)
- {
- if (len == sizeof (char))
- * (char *) VALUE_CONTENTS (val) = num;
- else if (len == sizeof (short))
- * (short *) VALUE_CONTENTS (val) = num;
- else if (len == sizeof (int))
- * (int *) VALUE_CONTENTS (val) = num;
- else if (len == sizeof (long))
- * (long *) VALUE_CONTENTS (val) = num;
-#ifdef LONG_LONG
- else if (len == sizeof (long long))
- * (long long *) VALUE_CONTENTS (val) = num;
-#endif
- else
- error ("Integer type encountered with unexpected data length.");
- }
- else
- error ("Unexpected type encountered for integer constant.");
-
- return val;
-}
-
-value
-value_from_double (type, num)
- struct type *type;
- double num;
-{
- register value val = allocate_value (type);
- register enum type_code code = TYPE_CODE (type);
- register int len = TYPE_LENGTH (type);
-
- if (code == TYPE_CODE_FLT)
- {
- if (len == sizeof (float))
- * (float *) VALUE_CONTENTS (val) = num;
- else if (len == sizeof (double))
- * (double *) VALUE_CONTENTS (val) = num;
- else
- error ("Floating type encountered with unexpected data length.");
- }
- else
- error ("Unexpected type encountered for floating constant.");
-
- return val;
-}
-
-/* Deal with the value that is "about to be returned". */
-
-/* Return the value that a function returning now
- would be returning to its caller, assuming its type is VALTYPE.
- RETBUF is where we look for what ought to be the contents
- of the registers (in raw form). This is because it is often
- desirable to restore old values to those registers
- after saving the contents of interest, and then call
- this function using the saved values.
- struct_return is non-zero when the function in question is
- using the structure return conventions on the machine in question;
- 0 when it is using the value returning conventions (this often
- means returning pointer to where structure is vs. returning value). */
-
-value
-value_being_returned (valtype, retbuf, struct_return)
- register struct type *valtype;
- char retbuf[REGISTER_BYTES];
- int struct_return;
-{
- register value val;
-
- if (struct_return)
- return value_at (valtype, EXTRACT_STRUCT_VALUE_ADDRESS (retbuf));
-
- val = allocate_value (valtype);
- EXTRACT_RETURN_VALUE (valtype, retbuf, VALUE_CONTENTS (val));
-
- return val;
-}
-
-/* Return true if the function specified is using the structure returning
- convention on this machine to return arguments, or 0 if it is using
- the value returning convention. FUNCTION is the value representing
- the function, FUNCADDR is the address of the function, and VALUE_TYPE
- is the type returned by the function */
-
-struct block *block_for_pc ();
-
-int
-using_struct_return (function, funcaddr, value_type)
- value function;
- CORE_ADDR funcaddr;
- struct type *value_type;
-{
- register enum type_code code = TYPE_CODE (value_type);
-
- if (code == TYPE_CODE_STRUCT ||
- code == TYPE_CODE_UNION ||
- code == TYPE_CODE_ARRAY)
- {
- struct block *b = block_for_pc (funcaddr);
-
- if (!(BLOCK_GCC_COMPILED (b) && TYPE_LENGTH (value_type) < 8))
- return 1;
- }
-
- return 0;
-}
-
-/* Store VAL so it will be returned if a function returns now.
- Does not verify that VAL's type matches what the current
- function wants to return. */
-
-void
-set_return_value (val)
- value val;
-{
- register enum type_code code = TYPE_CODE (VALUE_TYPE (val));
- char regbuf[REGISTER_BYTES];
- double dbuf;
- LONGEST lbuf;
-
- if (code == TYPE_CODE_STRUCT
- || code == TYPE_CODE_UNION)
- error ("Specifying a struct or union return value is not supported.");
-
- if (code == TYPE_CODE_FLT)
- {
- dbuf = value_as_double (val);
-
- STORE_RETURN_VALUE (VALUE_TYPE (val), &dbuf);
- }
- else
- {
- lbuf = value_as_long (val);
- STORE_RETURN_VALUE (VALUE_TYPE (val), &lbuf);
- }
-}
-
-void
-_initialize_values ()
-{
- add_info ("convenience", convenience_info,
- "Debugger convenience (\"$foo\") variables.\n\
-These variables are created when you assign them values;\n\
-thus, \"print $foo=1\" gives \"$foo\" the value 1. Values may be any type.\n\n\
-A few convenience variables are given values automatically GDB:\n\
-\"$_\"holds the last address examined with \"x\" or \"info lines\",\n\
-\"$__\" holds the contents of the last address examined with \"x\".");
-
- add_info ("values", value_history_info,
- "Elements of value history (around item number IDX, or last ten).");
- add_info_alias ("history", value_history_info, 0);
-}
diff --git a/gnu/usr.bin/gdb/version.c b/gnu/usr.bin/gdb/version.c
deleted file mode 100644
index 2f3dd85..0000000
--- a/gnu/usr.bin/gdb/version.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Define the current version number of GDB.
- Copyright (C) 1989, Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-GDB 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.
-
-GDB 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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-char *version = "3.5";
diff --git a/gnu/usr.bin/gdb/wait.h b/gnu/usr.bin/gdb/wait.h
deleted file mode 100644
index c431cb6..0000000
--- a/gnu/usr.bin/gdb/wait.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson and Steven McCanne of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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.
- *
- * @(#)wait.h 6.3 (Berkeley) 5/8/91
- */
-
-/* Define how to access the structure that the wait system call stores.
- On many systems, there is a structure defined for this.
- But on vanilla-ish USG systems there is not. */
-
-#ifndef HAVE_WAIT_STRUCT
-
-#define WAITTYPE int
-#define WIFSTOPPED(w) (((w)&0377) == 0177)
-#define WIFSIGNALED(w) (((w)&0377) != 0177 && ((w)&~0377) == 0)
-#define WIFEXITED(w) (((w)&0377) == 0)
-#define WEXITSTATUS(w) ((w) >> 8)
-#define WSTOPSIG(w) ((w) >> 8)
-#define WCOREDUMP(w) (((w)&0200) != 0)
-#define WTERMSIG(w) ((w) & 0177)
-#define WSETEXIT(w, status) ((w) = (status))
-#define WSETSTOP(w,sig) ((w) = (0177 | ((sig) << 8)))
-
-#else
-
-#include <sys/wait.h>
-
-#define WAITTYPE union wait
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(w) (w).w_retcode
-#endif
-#ifndef WSTOPSIG
-#define WSTOPSIG(w) (w).w_stopsig
-#endif
-#ifndef WCOREDUMP
-#define WCOREDUMP(w) (w).w_coredump
-#endif
-#ifndef WTERMSIG
-#define WTERMSIG(w) (w).w_termsig
-#endif
-#ifndef WSETEXIT
-#define WSETEXIT(w, status) ((w).w_status = (status))
-#endif
-#ifndef WSETSTOP
-#define WSETSTOP(w,sig) \
- ((w).w_stopsig = (sig), (w).w_coredump = 0, (w).w_termsig = 0177)
-#endif
-
-#endif
diff --git a/gnu/usr.bin/gdb/xgdb/Makefile b/gnu/usr.bin/gdb/xgdb/Makefile
deleted file mode 100644
index 72c5359..0000000
--- a/gnu/usr.bin/gdb/xgdb/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
-# %W% (Berkeley) %G%
-
-.include "../config/Makefile.$(MACHINE)"
-
-PROG= xgdb
-SRCS= xgdb.c xgdbinit.c
-GDBOBJS+= $(CONFIGSRCS:R:S/$/.o/g) \
- blockframe.o breakpoint.o command.o copying.o core.o \
- cplus-dem.o dbxread.o environ.o eval.o expprint.o \
- expread.o findvar.o infcmd.o inflow.o infrun.o \
- main.o obstack.o printcmd.o regex.o remote.o \
- remote-sl.o source.o stack.o symmisc.o symtab.o \
- utils.o valarith.o valops.o valprint.o values.o \
- version.o \
- funmap.o history.o keymaps.o readline.o
-CFLAGS+= -I.. -I$(.CURDIR)/.. -I$(.CURDIR)/../config \
- -DHAVE_VPRINTF -DVI_MODE -DKERNELDEBUG
-LDFLAGS+= -L/usr/lib/X11
-LDADD+= $(GDBOBJS:S/^/..\//g) -lXaw -lXmu -lXt -lXext -lX11 -ltermcap
-NOMAN= noman
-
-.include "../../Makefile.inc"
-.include <bsd.prog.mk>
-
-#
-# Generate the constructor
-#
-xgdbinit.c: ../init.c xgdb.c
- -(sed -e '/^}$$/d' ../init.c; \
- egrep -h '^_initialize_[^ ]* *\(\)' $(.CURDIR)/xgdb.c; \
- echo ';}') > xgdbinit.c
-
-CLEANFILES+= xgdbinit.c
diff --git a/gnu/usr.bin/gdb/xgdb/xgdb.c b/gnu/usr.bin/gdb/xgdb/xgdb.c
deleted file mode 100644
index a2bd4f6..0000000
--- a/gnu/usr.bin/gdb/xgdb/xgdb.c
+++ /dev/null
@@ -1,700 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- * Modified 1990 by Van Jacobson at Lawrence Berkeley Laboratory.
- *
- * static char rcsid[] = "$Header: /home/cvs/386BSD/src/usr.bin/gdb/xgdb/xgdb.c,v 1.1.1.1 1993/06/12 14:52:36 rgrimes Exp $";
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)xgdb.c 6.3 (Berkeley) 5/8/91";
-#endif /* not lint */
-
-/*
- * Interface from GDB to X windows. Copyright (C) 1987 Free Software
- * Foundation, Inc.
- *
- * GDB is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY. No author or distributor accepts responsibility to anyone for
- * the consequences of using it or for whether it serves any particular
- * purpose or works at all, unless he says so in writing. Refer to the GDB
- * General Public License for full details.
- *
- * Everyone is granted permission to copy, modify and redistribute GDB, but only
- * under the conditions described in the GDB General Public License. A copy
- * of this license is supposed to have been given to you along with GDB so
- * you can know your rights and responsibilities. It should be in a file
- * named COPYING. Among other things, the copyright notice and this notice
- * must be preserved on all copies.
- *
- * In other words, go ahead and share GDB, but don't try to stop anyone else
- * from sharing it farther. Help stamp out software hoarding!
- */
-
-/*
- * Original version was contributed by Derek Beatty, 30 June 87.
- * This version is essentially a re-write of the original by Van
- * Jacobson (van@helios.ee.lbl.gov), Nov, 90.
- */
-
-#include "defs.h"
-#include "param.h"
-#include "symtab.h"
-#include "frame.h"
-
-extern int stop_breakpoint;
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xaw/AsciiSink.h>
-#include <X11/Xaw/AsciiText.h>
-#include <X11/Xaw/Box.h>
-#include <X11/Xaw/Command.h>
-#include <X11/Xaw/Label.h>
-#include <X11/Xaw/Paned.h>
-#include <X11/Xaw/Text.h>
-
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/file.h>
-#include <sys/errno.h>
-
-extern int errno;
-extern char *getenv();
-extern char *malloc();
-extern void bcopy();
-extern int select();
-
-extern int get_filename_and_charpos();
-extern int source_line_charpos();
-extern int source_charpos_line();
-extern void execute_command();
-extern void error_no_arg();
-extern void add_com();
-
-/* The X display where the window appears. */
-
-static char *displayname;
-static Display *display;
-
-static XtAppContext app_context;
-
-/* Windows manipulated by this package. */
-
-static Widget main_widget;
-static Widget containing_widget;
-static Widget source_name_widget;
-static Widget source_text_widget;
-static Widget button_box_widget;
-
-/* Source text display. */
-
-static struct frame_info *last_fi;
-static CORE_ADDR last_pc;
-static struct symtab *last_cur_symtab;
-static int last_cur_line;
-
-static int source_window_line;
-static char *source_window_file;
-static struct symtab *source_window_symtab;
-
-static char version_label[64];
-extern char *version;
-
-/* Forward declarations */
-
-static Widget create_text_widget();
-
-static int
-safe_strcmp(a, b)
- register char *a, *b;
-{
- register int i;
-
- if (a == b)
- return (0);
- if (!a && b)
- return (1);
- if (a && !b)
- return (-1);
- return (strcmp(a, b));
-}
-
-
-/* Display an appropriate piece of source code in the source window. */
-
-void
-xgdb_display_source()
-{
- char *filename = NULL;
- struct symtab_and_line get_selected_frame_sal();
- struct symtab_and_line sal;
- struct frame_info *fi;
-
- /* Do nothing if called before we are initialized */
-
- if (!containing_widget)
- return;
-
- /*
- * Figure out what to display (the appropriate hooks to tell
- * us don't exist so we guess): If there's a current frame
- * and it or its pc changed from the last time we were here,
- * display appropriate source line. Otherwise if the current
- * source symtab or line is different, display that line.
- * Otherwise nothing changed so leave the display alone.
- */
- fi = get_frame_info(selected_frame);
- if (fi && (fi != last_fi || fi->pc != last_pc)) {
- last_fi = fi;
- last_pc = fi->pc;
- sal = find_pc_line(fi->pc, fi->next_frame);
- if (sal.symtab == NULL) { /* XXX */
- sal.symtab = current_source_symtab;
- sal.line = current_source_line;
- }
- current_source_symtab = sal.symtab;
- current_source_line = sal.line;
- } else if (current_source_symtab != last_cur_symtab ||
- current_source_line != last_cur_line) {
- sal.symtab = last_cur_symtab = current_source_symtab;
- sal.line = last_cur_line = current_source_line;
- } else
- return;
- /*
- * Do a path search and get the exact filename of this source file.
- * Also scan it and find its source lines if not already done.
- */
- if (sal.symtab && filename == NULL) {
- if (get_filename_and_charpos(sal.symtab, sal.line, &filename))
- /* line numbers may have changed - force highlight */
- source_window_line = -1;
- }
-
- /*
- * If the source window is wrong, destroy it and make a new one.
- */
- if (safe_strcmp(filename, source_window_file)) {
- Arg args[1];
- Widget src = XawTextGetSource(source_text_widget);
-
- if (filename) {
- XtSetArg(args[0], XtNstring, filename);
- XtSetValues(src, args, XtNumber(args));
- args[0].name = XtNlabel;
- XtSetValues(source_name_widget, args, XtNumber(args));
- } else {
- XtSetArg(args[0], XtNstring, "/dev/null");
- XtSetValues(src, args, XtNumber(args));
- XtSetArg(args[0], XtNlabel, "");
- XtSetValues(source_name_widget, args, XtNumber(args));
- }
- if (source_window_file)
- free(source_window_file);
- source_window_file = filename;
- source_window_line = sal.line + 1; /* force highlight */
- }
- if (sal.symtab && source_window_line != sal.line) {
- /*
- * Update display and cursor positions as necessary.
- * Cursor should be placed on line sal.line.
- */
- XawTextPosition l, r;
-
- source_window_symtab = sal.symtab;
- source_window_line = sal.line;
- l = source_line_charpos(source_window_symtab, sal.line);
- r = source_line_charpos(source_window_symtab, sal.line + 1);
- if (r < l)
- r = l + 1;
- XawTextSetSelection(source_text_widget, l, r);
- XawTextScrollToLine(source_text_widget, l, 10, 3);
- XawTextSetInsertionPoint(source_text_widget, l);
- }
-}
-
-
-/*
- * Handlers for buttons.
- */
-
-static int
-current_lineno()
-{
- XawTextPosition start, finish;
-
- XawTextGetSelectionPos(source_text_widget, &start, &finish);
- if (start >= finish)
- start = XawTextGetInsertionPoint(source_text_widget);
-
- return (source_charpos_line(source_window_symtab, start));
-}
-
-static char *
-append_selection(cp)
- char *cp;
-{
- int len;
- XawTextPosition l, r;
-
- XawTextGetSelectionPos(source_text_widget, &l, &r);
- if ((len = r - l) > 0) {
- Widget src = XawTextGetSource(source_text_widget);
-
- while (len > 0) {
- XawTextBlock tb;
-
- XawTextSourceRead(src, l, &tb, len);
- bcopy(tb.ptr, cp, tb.length);
- cp += tb.length;
- len -= tb.length;
- }
- if (cp[-1] == 0)
- --cp;
- }
- return (cp);
-}
-
-static char *
-append_selection_word(cp)
- register char *cp;
-{
- register int len;
- XawTextPosition l, r;
- XawTextBlock tb;
- register char c;
- register Widget src = XawTextGetSource(source_text_widget);
-
- XawTextGetSelectionPos(source_text_widget, &l, &r);
- if ((len = r - l) <= 0) {
- l = XawTextGetInsertionPoint(source_text_widget);
- len = 128; /* XXX */
-
- /* might have clicked in middle of word -- back up to start */
- for ( ; l > 0; --l) {
- XawTextSourceRead(src, l - 1, &tb, 1);
- c = tb.ptr[0];
- if (! isalnum(c) && c != '_' && c != '$')
- break;
- }
- }
- while (len > 0) {
- char *sp;
- int i;
-
- XawTextSourceRead(src, l, &tb, len);
- for (sp = tb.ptr, i = tb.length; --i >= 0; ) {
- c = *sp++;
- if (!isalnum(c) && c != '_' && c != '$')
- return (cp);
- *cp++ = c;
- }
- len -= tb.length;
- }
- return (cp);
-}
-
-static char *
-append_selection_expr(cp)
- char *cp;
-{
- int len;
- XawTextPosition l, r;
- Widget src = XawTextGetSource(source_text_widget);
- XawTextBlock tb;
- char *sp;
- char c;
-
- XawTextGetSelectionPos(source_text_widget, &l, &r);
- if (r > l)
- return (append_selection(cp));
-
- l = XawTextGetInsertionPoint(source_text_widget);
-
- /* might have clicked in middle of word -- back up to start */
- for ( ; l > 0; --l) {
- XawTextSourceRead(src, l - 1, &tb, 1);
- c = tb.ptr[0];
- if (! isalnum(c) && c != '_' && c != '$')
- break;
- }
-
- len = 128; /* XXX */
- while (len > 0) {
- int i;
- char pstack[64];
- int pcnt = 0;
-
- XawTextSourceRead(src, l, &tb, len);
- for (sp = tb.ptr, i = tb.length; --i >= 0; ) {
- switch (c = *sp++) {
- case '\n':
- case ';':
- return (cp);
- case '=':
- if (cp[-1] != '=')
- return (cp - 1);
- if (len == 128)
- return (cp);
- break;
- case ',':
- if (pcnt <= 0)
- return (cp);
- break;
- case '(':
- pstack[pcnt] = ')';
- if (++pcnt >= sizeof(pstack))
- return (cp);
- break;
- case '[':
- pstack[pcnt] = ']';
- if (++pcnt >= sizeof(pstack))
- return (cp);
- break;
- case ')':
- case ']':
- if (--pcnt < 0 || pstack[pcnt] != c)
- return (cp);
- break;
- }
- *cp++ = c;
- }
- len -= tb.length;
- }
- return (cp);
-}
-
-static int input_avail; /* XXX kluge: do_command sets this when command
- * data from button is avaialble to force top level
- * to break out of its loop. */
-/*
- * Handle a button by running the command COMMAND.
- */
-static void
-do_command(w, command, call_data)
- Widget w;
- register char *command;
- caddr_t call_data;
-{
- char cmd_line[256];
- char buf[256];
- register char *out = cmd_line;
- char *cp;
- register char c;
- extern char *finish_command_input();
-
- while (c = *command++) {
- if (c == '%') {
- switch (*command++) {
- case 's': /* current selection */
- out = append_selection(out);
- break;
- case 'S': /* 1st selected "word" at curor */
- out = append_selection_word(out);
- break;
- case 'e': /* echo cmd before executing */
- break;
- case 'E': /* 1st selected expression at curor */
- out = append_selection_expr(out);
- break;
-
- case 'l': /* current line number */
- (void) sprintf(buf, "%d", current_lineno());
- for (cp = buf; c = *cp++; *out++ = c)
- ;
- break;
- case 'L': /* line we're stopped at */
- (void) sprintf(buf, "%d", source_window_line);
- for (cp = buf; c = *cp++; *out++ = c)
- ;
- break;
- case 'f': /* current file name */
- for (cp = source_window_symtab->filename;
- c = *cp++; *out++ = c)
- ;
- break;
- case 'b': /* break # we're stopped at */
- if (stop_breakpoint <= 0)
- /* if no breakpoint, don't do cmd */
- return;
-
- (void) sprintf(buf, "%d", stop_breakpoint);
- for (cp = buf; c = *cp++; *out++ = c)
- ;
- break;
- }
- } else
- *out++ = c;
- }
- *out = 0;
- reinitialize_more_filter();
- /* have to exit via readline or tty modes stay messed up */
- for (cp = cmd_line; c = *cp++; )
- rl_stuff_char(c);
- rl_stuff_char('\n');
- input_avail = 1;
-}
-
-/*
- * Define and display all the buttons.
- */
-static void
-addbutton(parent, name, function, closure)
- Widget parent;
- char *name;
- void (*function) ();
- caddr_t closure;
-{
- static XtCallbackRec Callback[] = {
- {NULL, (caddr_t) NULL},
- {NULL, (caddr_t) NULL},
- };
- static Arg commandArgs[] = {
- {XtNlabel, (XtArgVal) NULL},
- {XtNcallback, (XtArgVal) Callback},
- };
- Widget w;
- char wname[128];
- register char *cp;
-
- strcpy(wname, name);
- while ((cp = index(wname, '*')) || (cp = index(wname, '.')))
- *cp -= 0x10;
-
- if (w = XtNameToWidget(parent, wname))
- XtDestroyWidget(w);
-
- Callback[0].callback = (XtCallbackProc) function;
- Callback[0].closure = (caddr_t) closure;
- commandArgs[0].value = (XtArgVal) name;
- XtCreateManagedWidget(wname, commandWidgetClass, parent,
- commandArgs, XtNumber(commandArgs));
-}
-
-/*
- * Create the button windows and store them in `buttons'.
- */
-static void
-create_buttons(parent)
- Widget parent;
-{
- addbutton(parent, "quit", do_command, "quit");
-}
-
-static void
-button_command(arg)
- char *arg;
-{
- char *label;
- unsigned int len;
-
- if (! arg)
- error_no_arg("button label and command");
-
- for (len = strlen(arg); len > 0 && isspace(arg[len - 1]); --len)
- ;
- if (len == 0)
- error_no_arg("button label and command");
- arg[len] = 0;
-
- /* make a copy of button label & command for toolkit to use */
- label = malloc(len + 1);
- strcpy(label, arg);
-
- /* find the end of the label */
- if (*label == '"') {
- if ((arg = index(++label, '"')) == 0) {
- printf("button label missing closing quote\n");
- return;
- }
- *arg++ = 0;
- } else if (arg = index(label, ' '))
- *arg++ = 0;
- else
- arg = label;
-
- while (*arg && isspace(*arg))
- ++arg;
-
- addbutton(button_box_widget, label, do_command, arg);
-}
-
-static void
-button_delete_command(arg)
- char *arg;
-{
- unsigned int len;
- Widget w;
- register char *cp;
-
- if (! arg)
- error_no_arg("button name");
-
- for (len = strlen(arg); len > 0 && isspace(arg[len - 1]); --len)
- ;
- if (len == 0)
- error_no_arg("button name");
- arg[len] = 0;
-
- /* find the end of the label */
- if (*arg == '"') {
- if ((cp = index(++arg, '"')) == 0) {
- printf("button label missing closing quote\n");
- return;
- }
- *cp++ = 0;
- }
- while ((cp = index(arg, '*')) || (cp = index(arg, '.')))
- *cp -= 0x10;
-
- if (w = XtNameToWidget(button_box_widget, arg))
- XtDestroyWidget(w);
-}
-
-/*
- * Create a "label window" that just displays the string LABEL.
- */
-static Widget
-create_label(name, label)
- char *name, *label;
-{
- Arg args[1];
- Widget w;
-
- XtSetArg(args[0], XtNlabel, label);
- w = XtCreateManagedWidget(name, labelWidgetClass, containing_widget,
- args, XtNumber(args));
- return (w);
-}
-
-/*
- * Create a subwindow of PARENT that displays and scrolls the contents of
- * file FILENAME.
- */
-static Widget
-create_text_widget(parent, filename)
- Widget parent;
- char *filename;
-{
- static Arg arg[] = {
- {XtNstring, NULL},
- {XtNtype, XawAsciiFile},
- {XtNcursor, None},
- };
- Widget text_widget;
-
- arg[0].value = (XtArgVal)filename;
- text_widget = XtCreateManagedWidget("src", asciiTextWidgetClass,
- parent, arg, XtNumber(arg));
- return (text_widget);
-}
-
-/*
- * Entry point to create the widgets representing our display.
- */
-void
-xgdb_create_window()
-{
- /* initialize toolkit, setup defaults */
-#ifdef notyet
- main_widget = XtAppInitialize(&app_context, "Xgdb", NULL, 0,
- argcptr, argv, NULL, NULL, 0);
-#else
- char *dummy_argv[] = { "xgdb", 0 };
- int dummy_argc = 1;
- main_widget = XtAppInitialize(&app_context, "Xgdb", NULL, 0,
- &dummy_argc, dummy_argv, NULL, NULL, 0);
-#endif
- display = XtDisplay(main_widget);
- containing_widget = XtCreateManagedWidget("frame", panedWidgetClass,
- main_widget, NULL, 0);
-
- sprintf(version_label, "XGDB %s", version);
- button_box_widget = XtCreateManagedWidget("buttons", boxWidgetClass,
- containing_widget, NULL, 0);
- create_buttons(button_box_widget);
- source_name_widget = create_label("srcLabel", "No source file yet.");
- source_text_widget = create_text_widget(containing_widget, "/dev/null");
-
- XtRealizeWidget(main_widget);
- XFlush(display);
-}
-
-/*
- * If we use an X window, the readline input loop is told to call
- * this function before reading a character from stdin.
- */
-/*ARGSUSED*/
-static void
-xgdb_window_hook()
-{
- register int inmask = 1 << fileno(stdin);
- register int xmask = 1 << ConnectionNumber(display);
- register int nfds, pend;
- int input_rfds;
- XEvent ev;
-
- /*
- * Display our current idea of the `interesting' source file then
- * loop, dispatching window events until data is available on
- * stdin. Then return so the input data can be processed.
- */
- input_avail = 0;
- xgdb_display_source();
-
- input_rfds = 0;
- while (input_avail == 0 && (input_rfds & inmask) == 0) {
- pend = XPending(display);
- if (!pend) {
- input_rfds = inmask | xmask;
- nfds = select(32, &input_rfds, 0, 0,
- (struct timeval *)0);
- if (nfds == -1 && errno == EINTR)
- continue;
- }
- if (pend || (input_rfds & xmask)) {
- XNextEvent(display, &ev);
- XtDispatchEvent(&ev);
- }
- }
-}
-
-void
-_initialize_xgdb()
-{
- extern void (*window_hook) ();
- extern int inhibit_windows;
- extern struct cmd_list_element *deletelist;
-
- if (inhibit_windows)
- return;
-
- if (! displayname) {
- displayname = getenv("DISPLAY");
- if (! displayname) {
- fprintf(stderr, "xgdb: no display name\n");
- inhibit_windows = 1;
- return;
- }
- }
- xgdb_create_window();
- window_hook = xgdb_window_hook;
- add_com("button", class_support, button_command,
-"Add command button to xgdb window. First argument is button\n\
-label, second is command associated with button. Command can\n\
-include printf-like escapes:\n\
- %s for current selection,\n\
- %S for first 'word' of current selection,\n\
- %e for current selection or expression at insertion pt,\n\
- %E for current selection or expression at insertion pt,\n\
- %l for current line number,\n\
- %L for line program stopped at,\n\
- %f for current file name,\n\
- %b for current breakpoint number.");
- add_cmd("button", class_support, button_delete_command,
-"Delete a button from the xgdb window.\n\
-Argument is name of button to be deleted.",
- &deletelist);
-}
diff --git a/gnu/usr.bin/grep/regex.c b/gnu/usr.bin/grep/regex.c
deleted file mode 100644
index e8b5882..0000000
--- a/gnu/usr.bin/grep/regex.c
+++ /dev/null
@@ -1,4987 +0,0 @@
-/* Extended regular expression matching and search library,
- version 0.12.
- (Implements POSIX draft P10003.2/D11.2, except for
- internationalization features.)
-
- Copyright (C) 1993 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* AIX requires this to be the first thing in the file. */
-#if defined (_AIX) && !defined (REGEX_MALLOC)
- #pragma alloca
-#endif
-
-#define _GNU_SOURCE
-
-/* We need this for `regex.h', and perhaps for the Emacs include files. */
-#include <sys/types.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-/* The `emacs' switch turns on certain matching commands
- that make sense only in Emacs. */
-#ifdef emacs
-
-#include "lisp.h"
-#include "buffer.h"
-#include "syntax.h"
-
-/* Emacs uses `NULL' as a predicate. */
-#undef NULL
-
-#else /* not emacs */
-
-/* We used to test for `BSTRING' here, but only GCC and Emacs define
- `BSTRING', as far as I know, and neither of them use this code. */
-#if HAVE_STRING_H || STDC_HEADERS
-#include <string.h>
-#ifndef bcmp
-#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
-#endif
-#ifndef bcopy
-#define bcopy(s, d, n) memcpy ((d), (s), (n))
-#endif
-#ifndef bzero
-#define bzero(s, n) memset ((s), 0, (n))
-#endif
-#else
-#include <strings.h>
-#endif
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#else
-char *malloc ();
-char *realloc ();
-#endif
-
-
-/* Define the syntax stuff for \<, \>, etc. */
-
-/* This must be nonzero for the wordchar and notwordchar pattern
- commands in re_match_2. */
-#ifndef Sword
-#define Sword 1
-#endif
-
-#ifdef SYNTAX_TABLE
-
-extern char *re_syntax_table;
-
-#else /* not SYNTAX_TABLE */
-
-/* How many characters in the character set. */
-#define CHAR_SET_SIZE 256
-
-static char re_syntax_table[CHAR_SET_SIZE];
-
-static void
-init_syntax_once ()
-{
- register int c;
- static int done = 0;
-
- if (done)
- return;
-
- bzero (re_syntax_table, sizeof re_syntax_table);
-
- for (c = 'a'; c <= 'z'; c++)
- re_syntax_table[c] = Sword;
-
- for (c = 'A'; c <= 'Z'; c++)
- re_syntax_table[c] = Sword;
-
- for (c = '0'; c <= '9'; c++)
- re_syntax_table[c] = Sword;
-
- re_syntax_table['_'] = Sword;
-
- done = 1;
-}
-
-#endif /* not SYNTAX_TABLE */
-
-#define SYNTAX(c) re_syntax_table[c]
-
-#endif /* not emacs */
-
-/* Get the interface, including the syntax bits. */
-#include "regex.h"
-
-/* isalpha etc. are used for the character classes. */
-#include <ctype.h>
-
-/* Jim Meyering writes:
-
- "... Some ctype macros are valid only for character codes that
- isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
- using /bin/cc or gcc but without giving an ansi option). So, all
- ctype uses should be through macros like ISPRINT... If
- STDC_HEADERS is defined, then autoconf has verified that the ctype
- macros don't need to be guarded with references to isascii. ...
- Defining isascii to 1 should let any compiler worth its salt
- eliminate the && through constant folding." */
-#if ! defined (isascii) || defined (STDC_HEADERS)
-#undef isascii
-#define isascii(c) 1
-#endif
-
-#ifdef isblank
-#define ISBLANK(c) (isascii (c) && isblank (c))
-#else
-#define ISBLANK(c) ((c) == ' ' || (c) == '\t')
-#endif
-#ifdef isgraph
-#define ISGRAPH(c) (isascii (c) && isgraph (c))
-#else
-#define ISGRAPH(c) (isascii (c) && isprint (c) && !isspace (c))
-#endif
-
-#define ISPRINT(c) (isascii (c) && isprint (c))
-#define ISDIGIT(c) (isascii (c) && isdigit (c))
-#define ISALNUM(c) (isascii (c) && isalnum (c))
-#define ISALPHA(c) (isascii (c) && isalpha (c))
-#define ISCNTRL(c) (isascii (c) && iscntrl (c))
-#define ISLOWER(c) (isascii (c) && islower (c))
-#define ISPUNCT(c) (isascii (c) && ispunct (c))
-#define ISSPACE(c) (isascii (c) && isspace (c))
-#define ISUPPER(c) (isascii (c) && isupper (c))
-#define ISXDIGIT(c) (isascii (c) && isxdigit (c))
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* We remove any previous definition of `SIGN_EXTEND_CHAR',
- since ours (we hope) works properly with all combinations of
- machines, compilers, `char' and `unsigned char' argument types.
- (Per Bothner suggested the basic approach.) */
-#undef SIGN_EXTEND_CHAR
-#if __STDC__
-#define SIGN_EXTEND_CHAR(c) ((signed char) (c))
-#else /* not __STDC__ */
-/* As in Harbison and Steele. */
-#define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
-#endif
-
-/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we
- use `alloca' instead of `malloc'. This is because using malloc in
- re_search* or re_match* could cause memory leaks when C-g is used in
- Emacs; also, malloc is slower and causes storage fragmentation. On
- the other hand, malloc is more portable, and easier to debug.
-
- Because we sometimes use alloca, some routines have to be macros,
- not functions -- `alloca'-allocated space disappears at the end of the
- function it is called in. */
-
-#ifdef REGEX_MALLOC
-
-#define REGEX_ALLOCATE malloc
-#define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize)
-
-#else /* not REGEX_MALLOC */
-
-/* Emacs already defines alloca, sometimes. */
-#ifndef alloca
-
-/* Make alloca work the best possible way. */
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else /* not __GNUC__ */
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#else /* not __GNUC__ or HAVE_ALLOCA_H */
-#ifndef _AIX /* Already did AIX, up at the top. */
-char *alloca ();
-#endif /* not _AIX */
-#endif /* not HAVE_ALLOCA_H */
-#endif /* not __GNUC__ */
-
-#endif /* not alloca */
-
-#define REGEX_ALLOCATE alloca
-
-/* Assumes a `char *destination' variable. */
-#define REGEX_REALLOCATE(source, osize, nsize) \
- (destination = (char *) alloca (nsize), \
- bcopy (source, destination, osize), \
- destination)
-
-#endif /* not REGEX_MALLOC */
-
-
-/* True if `size1' is non-NULL and PTR is pointing anywhere inside
- `string1' or just past its end. This works if PTR is NULL, which is
- a good thing. */
-#define FIRST_STRING_P(ptr) \
- (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
-
-/* (Re)Allocate N items of type T using malloc, or fail. */
-#define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t)))
-#define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
-#define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
-
-#define BYTEWIDTH 8 /* In bits. */
-
-#define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
-
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-
-typedef char boolean;
-#define false 0
-#define true 1
-
-/* These are the command codes that appear in compiled regular
- expressions. Some opcodes are followed by argument bytes. A
- command code can specify any interpretation whatsoever for its
- arguments. Zero bytes may appear in the compiled regular expression.
-
- The value of `exactn' is needed in search.c (search_buffer) in Emacs.
- So regex.h defines a symbol `RE_EXACTN_VALUE' to be 1; the value of
- `exactn' we use here must also be 1. */
-
-typedef enum
-{
- no_op = 0,
-
- /* Followed by one byte giving n, then by n literal bytes. */
- exactn = 1,
-
- /* Matches any (more or less) character. */
- anychar,
-
- /* Matches any one char belonging to specified set. First
- following byte is number of bitmap bytes. Then come bytes
- for a bitmap saying which chars are in. Bits in each byte
- are ordered low-bit-first. A character is in the set if its
- bit is 1. A character too large to have a bit in the map is
- automatically not in the set. */
- charset,
-
- /* Same parameters as charset, but match any character that is
- not one of those specified. */
- charset_not,
-
- /* Start remembering the text that is matched, for storing in a
- register. Followed by one byte with the register number, in
- the range 0 to one less than the pattern buffer's re_nsub
- field. Then followed by one byte with the number of groups
- inner to this one. (This last has to be part of the
- start_memory only because we need it in the on_failure_jump
- of re_match_2.) */
- start_memory,
-
- /* Stop remembering the text that is matched and store it in a
- memory register. Followed by one byte with the register
- number, in the range 0 to one less than `re_nsub' in the
- pattern buffer, and one byte with the number of inner groups,
- just like `start_memory'. (We need the number of inner
- groups here because we don't have any easy way of finding the
- corresponding start_memory when we're at a stop_memory.) */
- stop_memory,
-
- /* Match a duplicate of something remembered. Followed by one
- byte containing the register number. */
- duplicate,
-
- /* Fail unless at beginning of line. */
- begline,
-
- /* Fail unless at end of line. */
- endline,
-
- /* Succeeds if at beginning of buffer (if emacs) or at beginning
- of string to be matched (if not). */
- begbuf,
-
- /* Analogously, for end of buffer/string. */
- endbuf,
-
- /* Followed by two byte relative address to which to jump. */
- jump,
-
- /* Same as jump, but marks the end of an alternative. */
- jump_past_alt,
-
- /* Followed by two-byte relative address of place to resume at
- in case of failure. */
- on_failure_jump,
-
- /* Like on_failure_jump, but pushes a placeholder instead of the
- current string position when executed. */
- on_failure_keep_string_jump,
-
- /* Throw away latest failure point and then jump to following
- two-byte relative address. */
- pop_failure_jump,
-
- /* Change to pop_failure_jump if know won't have to backtrack to
- match; otherwise change to jump. This is used to jump
- back to the beginning of a repeat. If what follows this jump
- clearly won't match what the repeat does, such that we can be
- sure that there is no use backtracking out of repetitions
- already matched, then we change it to a pop_failure_jump.
- Followed by two-byte address. */
- maybe_pop_jump,
-
- /* Jump to following two-byte address, and push a dummy failure
- point. This failure point will be thrown away if an attempt
- is made to use it for a failure. A `+' construct makes this
- before the first repeat. Also used as an intermediary kind
- of jump when compiling an alternative. */
- dummy_failure_jump,
-
- /* Push a dummy failure point and continue. Used at the end of
- alternatives. */
- push_dummy_failure,
-
- /* Followed by two-byte relative address and two-byte number n.
- After matching N times, jump to the address upon failure. */
- succeed_n,
-
- /* Followed by two-byte relative address, and two-byte number n.
- Jump to the address N times, then fail. */
- jump_n,
-
- /* Set the following two-byte relative address to the
- subsequent two-byte number. The address *includes* the two
- bytes of number. */
- set_number_at,
-
- wordchar, /* Matches any word-constituent character. */
- notwordchar, /* Matches any char that is not a word-constituent. */
-
- wordbeg, /* Succeeds if at word beginning. */
- wordend, /* Succeeds if at word end. */
-
- wordbound, /* Succeeds if at a word boundary. */
- notwordbound /* Succeeds if not at a word boundary. */
-
-#ifdef emacs
- ,before_dot, /* Succeeds if before point. */
- at_dot, /* Succeeds if at point. */
- after_dot, /* Succeeds if after point. */
-
- /* Matches any character whose syntax is specified. Followed by
- a byte which contains a syntax code, e.g., Sword. */
- syntaxspec,
-
- /* Matches any character whose syntax is not that specified. */
- notsyntaxspec
-#endif /* emacs */
-} re_opcode_t;
-
-/* Common operations on the compiled pattern. */
-
-/* Store NUMBER in two contiguous bytes starting at DESTINATION. */
-
-#define STORE_NUMBER(destination, number) \
- do { \
- (destination)[0] = (number) & 0377; \
- (destination)[1] = (number) >> 8; \
- } while (0)
-
-/* Same as STORE_NUMBER, except increment DESTINATION to
- the byte after where the number is stored. Therefore, DESTINATION
- must be an lvalue. */
-
-#define STORE_NUMBER_AND_INCR(destination, number) \
- do { \
- STORE_NUMBER (destination, number); \
- (destination) += 2; \
- } while (0)
-
-/* Put into DESTINATION a number stored in two contiguous bytes starting
- at SOURCE. */
-
-#define EXTRACT_NUMBER(destination, source) \
- do { \
- (destination) = *(source) & 0377; \
- (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \
- } while (0)
-
-#ifdef DEBUG
-static void
-extract_number (dest, source)
- int *dest;
- unsigned char *source;
-{
- int temp = SIGN_EXTEND_CHAR (*(source + 1));
- *dest = *source & 0377;
- *dest += temp << 8;
-}
-
-#ifndef EXTRACT_MACROS /* To debug the macros. */
-#undef EXTRACT_NUMBER
-#define EXTRACT_NUMBER(dest, src) extract_number (&dest, src)
-#endif /* not EXTRACT_MACROS */
-
-#endif /* DEBUG */
-
-/* Same as EXTRACT_NUMBER, except increment SOURCE to after the number.
- SOURCE must be an lvalue. */
-
-#define EXTRACT_NUMBER_AND_INCR(destination, source) \
- do { \
- EXTRACT_NUMBER (destination, source); \
- (source) += 2; \
- } while (0)
-
-#ifdef DEBUG
-static void
-extract_number_and_incr (destination, source)
- int *destination;
- unsigned char **source;
-{
- extract_number (destination, *source);
- *source += 2;
-}
-
-#ifndef EXTRACT_MACROS
-#undef EXTRACT_NUMBER_AND_INCR
-#define EXTRACT_NUMBER_AND_INCR(dest, src) \
- extract_number_and_incr (&dest, &src)
-#endif /* not EXTRACT_MACROS */
-
-#endif /* DEBUG */
-
-/* If DEBUG is defined, Regex prints many voluminous messages about what
- it is doing (if the variable `debug' is nonzero). If linked with the
- main program in `iregex.c', you can enter patterns and strings
- interactively. And if linked with the main program in `main.c' and
- the other test files, you can run the already-written tests. */
-
-#ifdef DEBUG
-
-/* We use standard I/O for debugging. */
-#include <stdio.h>
-
-/* It is useful to test things that ``must'' be true when debugging. */
-#include <assert.h>
-
-static int debug = 0;
-
-#define DEBUG_STATEMENT(e) e
-#define DEBUG_PRINT1(x) if (debug) printf (x)
-#define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2)
-#define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3)
-#define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4)
-#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \
- if (debug) print_partial_compiled_pattern (s, e)
-#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \
- if (debug) print_double_string (w, s1, sz1, s2, sz2)
-
-
-extern void printchar ();
-
-/* Print the fastmap in human-readable form. */
-
-void
-print_fastmap (fastmap)
- char *fastmap;
-{
- unsigned was_a_range = 0;
- unsigned i = 0;
-
- while (i < (1 << BYTEWIDTH))
- {
- if (fastmap[i++])
- {
- was_a_range = 0;
- printchar (i - 1);
- while (i < (1 << BYTEWIDTH) && fastmap[i])
- {
- was_a_range = 1;
- i++;
- }
- if (was_a_range)
- {
- printf ("-");
- printchar (i - 1);
- }
- }
- }
- putchar ('\n');
-}
-
-
-/* Print a compiled pattern string in human-readable form, starting at
- the START pointer into it and ending just before the pointer END. */
-
-void
-print_partial_compiled_pattern (start, end)
- unsigned char *start;
- unsigned char *end;
-{
- int mcnt, mcnt2;
- unsigned char *p = start;
- unsigned char *pend = end;
-
- if (start == NULL)
- {
- printf ("(null)\n");
- return;
- }
-
- /* Loop over pattern commands. */
- while (p < pend)
- {
- printf ("%d:\t", p - start);
-
- switch ((re_opcode_t) *p++)
- {
- case no_op:
- printf ("/no_op");
- break;
-
- case exactn:
- mcnt = *p++;
- printf ("/exactn/%d", mcnt);
- do
- {
- putchar ('/');
- printchar (*p++);
- }
- while (--mcnt);
- break;
-
- case start_memory:
- mcnt = *p++;
- printf ("/start_memory/%d/%d", mcnt, *p++);
- break;
-
- case stop_memory:
- mcnt = *p++;
- printf ("/stop_memory/%d/%d", mcnt, *p++);
- break;
-
- case duplicate:
- printf ("/duplicate/%d", *p++);
- break;
-
- case anychar:
- printf ("/anychar");
- break;
-
- case charset:
- case charset_not:
- {
- register int c, last = -100;
- register int in_range = 0;
-
- printf ("/charset [%s",
- (re_opcode_t) *(p - 1) == charset_not ? "^" : "");
-
- assert (p + *p < pend);
-
- for (c = 0; c < 256; c++)
- if (c / 8 < *p
- && (p[1 + (c/8)] & (1 << (c % 8))))
- {
- /* Are we starting a range? */
- if (last + 1 == c && ! in_range)
- {
- putchar ('-');
- in_range = 1;
- }
- /* Have we broken a range? */
- else if (last + 1 != c && in_range)
- {
- printchar (last);
- in_range = 0;
- }
-
- if (! in_range)
- printchar (c);
-
- last = c;
- }
-
- if (in_range)
- printchar (last);
-
- putchar (']');
-
- p += 1 + *p;
- }
- break;
-
- case begline:
- printf ("/begline");
- break;
-
- case endline:
- printf ("/endline");
- break;
-
- case on_failure_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/on_failure_jump to %d", p + mcnt - start);
- break;
-
- case on_failure_keep_string_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/on_failure_keep_string_jump to %d", p + mcnt - start);
- break;
-
- case dummy_failure_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/dummy_failure_jump to %d", p + mcnt - start);
- break;
-
- case push_dummy_failure:
- printf ("/push_dummy_failure");
- break;
-
- case maybe_pop_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/maybe_pop_jump to %d", p + mcnt - start);
- break;
-
- case pop_failure_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/pop_failure_jump to %d", p + mcnt - start);
- break;
-
- case jump_past_alt:
- extract_number_and_incr (&mcnt, &p);
- printf ("/jump_past_alt to %d", p + mcnt - start);
- break;
-
- case jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/jump to %d", p + mcnt - start);
- break;
-
- case succeed_n:
- extract_number_and_incr (&mcnt, &p);
- extract_number_and_incr (&mcnt2, &p);
- printf ("/succeed_n to %d, %d times", p + mcnt - start, mcnt2);
- break;
-
- case jump_n:
- extract_number_and_incr (&mcnt, &p);
- extract_number_and_incr (&mcnt2, &p);
- printf ("/jump_n to %d, %d times", p + mcnt - start, mcnt2);
- break;
-
- case set_number_at:
- extract_number_and_incr (&mcnt, &p);
- extract_number_and_incr (&mcnt2, &p);
- printf ("/set_number_at location %d to %d", p + mcnt - start, mcnt2);
- break;
-
- case wordbound:
- printf ("/wordbound");
- break;
-
- case notwordbound:
- printf ("/notwordbound");
- break;
-
- case wordbeg:
- printf ("/wordbeg");
- break;
-
- case wordend:
- printf ("/wordend");
-
-#ifdef emacs
- case before_dot:
- printf ("/before_dot");
- break;
-
- case at_dot:
- printf ("/at_dot");
- break;
-
- case after_dot:
- printf ("/after_dot");
- break;
-
- case syntaxspec:
- printf ("/syntaxspec");
- mcnt = *p++;
- printf ("/%d", mcnt);
- break;
-
- case notsyntaxspec:
- printf ("/notsyntaxspec");
- mcnt = *p++;
- printf ("/%d", mcnt);
- break;
-#endif /* emacs */
-
- case wordchar:
- printf ("/wordchar");
- break;
-
- case notwordchar:
- printf ("/notwordchar");
- break;
-
- case begbuf:
- printf ("/begbuf");
- break;
-
- case endbuf:
- printf ("/endbuf");
- break;
-
- default:
- printf ("?%d", *(p-1));
- }
-
- putchar ('\n');
- }
-
- printf ("%d:\tend of pattern.\n", p - start);
-}
-
-
-void
-print_compiled_pattern (bufp)
- struct re_pattern_buffer *bufp;
-{
- unsigned char *buffer = bufp->buffer;
-
- print_partial_compiled_pattern (buffer, buffer + bufp->used);
- printf ("%d bytes used/%d bytes allocated.\n", bufp->used, bufp->allocated);
-
- if (bufp->fastmap_accurate && bufp->fastmap)
- {
- printf ("fastmap: ");
- print_fastmap (bufp->fastmap);
- }
-
- printf ("re_nsub: %d\t", bufp->re_nsub);
- printf ("regs_alloc: %d\t", bufp->regs_allocated);
- printf ("can_be_null: %d\t", bufp->can_be_null);
- printf ("newline_anchor: %d\n", bufp->newline_anchor);
- printf ("no_sub: %d\t", bufp->no_sub);
- printf ("not_bol: %d\t", bufp->not_bol);
- printf ("not_eol: %d\t", bufp->not_eol);
- printf ("syntax: %d\n", bufp->syntax);
- /* Perhaps we should print the translate table? */
-}
-
-
-void
-print_double_string (where, string1, size1, string2, size2)
- const char *where;
- const char *string1;
- const char *string2;
- int size1;
- int size2;
-{
- unsigned this_char;
-
- if (where == NULL)
- printf ("(null)");
- else
- {
- if (FIRST_STRING_P (where))
- {
- for (this_char = where - string1; this_char < size1; this_char++)
- printchar (string1[this_char]);
-
- where = string2;
- }
-
- for (this_char = where - string2; this_char < size2; this_char++)
- printchar (string2[this_char]);
- }
-}
-
-#else /* not DEBUG */
-
-#undef assert
-#define assert(e)
-
-#define DEBUG_STATEMENT(e)
-#define DEBUG_PRINT1(x)
-#define DEBUG_PRINT2(x1, x2)
-#define DEBUG_PRINT3(x1, x2, x3)
-#define DEBUG_PRINT4(x1, x2, x3, x4)
-#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
-#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)
-
-#endif /* not DEBUG */
-
-/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can
- also be assigned to arbitrarily: each pattern buffer stores its own
- syntax, so it can be changed between regex compilations. */
-reg_syntax_t re_syntax_options = RE_SYNTAX_EMACS;
-
-
-/* Specify the precise syntax of regexps for compilation. This provides
- for compatibility for various utilities which historically have
- different, incompatible syntaxes.
-
- The argument SYNTAX is a bit mask comprised of the various bits
- defined in regex.h. We return the old syntax. */
-
-reg_syntax_t
-re_set_syntax (syntax)
- reg_syntax_t syntax;
-{
- reg_syntax_t ret = re_syntax_options;
-
- re_syntax_options = syntax;
- return ret;
-}
-
-/* This table gives an error message for each of the error codes listed
- in regex.h. Obviously the order here has to be same as there. */
-
-static const char *re_error_msg[] =
- { NULL, /* REG_NOERROR */
- "No match", /* REG_NOMATCH */
- "Invalid regular expression", /* REG_BADPAT */
- "Invalid collation character", /* REG_ECOLLATE */
- "Invalid character class name", /* REG_ECTYPE */
- "Trailing backslash", /* REG_EESCAPE */
- "Invalid back reference", /* REG_ESUBREG */
- "Unmatched [ or [^", /* REG_EBRACK */
- "Unmatched ( or \\(", /* REG_EPAREN */
- "Unmatched \\{", /* REG_EBRACE */
- "Invalid content of \\{\\}", /* REG_BADBR */
- "Invalid range end", /* REG_ERANGE */
- "Memory exhausted", /* REG_ESPACE */
- "Invalid preceding regular expression", /* REG_BADRPT */
- "Premature end of regular expression", /* REG_EEND */
- "Regular expression too big", /* REG_ESIZE */
- "Unmatched ) or \\)", /* REG_ERPAREN */
- };
-
-/* Subroutine declarations and macros for regex_compile. */
-
-static void store_op1 (), store_op2 ();
-static void insert_op1 (), insert_op2 ();
-static boolean at_begline_loc_p (), at_endline_loc_p ();
-static boolean group_in_compile_stack ();
-static reg_errcode_t compile_range ();
-
-/* Fetch the next character in the uncompiled pattern---translating it
- if necessary. Also cast from a signed character in the constant
- string passed to us by the user to an unsigned char that we can use
- as an array index (in, e.g., `translate'). */
-#define PATFETCH(c) \
- do {if (p == pend) return REG_EEND; \
- c = (unsigned char) *p++; \
- if (translate) c = translate[c]; \
- } while (0)
-
-/* Fetch the next character in the uncompiled pattern, with no
- translation. */
-#define PATFETCH_RAW(c) \
- do {if (p == pend) return REG_EEND; \
- c = (unsigned char) *p++; \
- } while (0)
-
-/* Go backwards one character in the pattern. */
-#define PATUNFETCH p--
-
-
-/* If `translate' is non-null, return translate[D], else just D. We
- cast the subscript to translate because some data is declared as
- `char *', to avoid warnings when a string constant is passed. But
- when we use a character as a subscript we must make it unsigned. */
-#define TRANSLATE(d) (translate ? translate[(unsigned char) (d)] : (d))
-
-
-/* Macros for outputting the compiled pattern into `buffer'. */
-
-/* If the buffer isn't allocated when it comes in, use this. */
-#define INIT_BUF_SIZE 32
-
-/* Make sure we have at least N more bytes of space in buffer. */
-#define GET_BUFFER_SPACE(n) \
- while (b - bufp->buffer + (n) > bufp->allocated) \
- EXTEND_BUFFER ()
-
-/* Make sure we have one more byte of buffer space and then add C to it. */
-#define BUF_PUSH(c) \
- do { \
- GET_BUFFER_SPACE (1); \
- *b++ = (unsigned char) (c); \
- } while (0)
-
-
-/* Ensure we have two more bytes of buffer space and then append C1 and C2. */
-#define BUF_PUSH_2(c1, c2) \
- do { \
- GET_BUFFER_SPACE (2); \
- *b++ = (unsigned char) (c1); \
- *b++ = (unsigned char) (c2); \
- } while (0)
-
-
-/* As with BUF_PUSH_2, except for three bytes. */
-#define BUF_PUSH_3(c1, c2, c3) \
- do { \
- GET_BUFFER_SPACE (3); \
- *b++ = (unsigned char) (c1); \
- *b++ = (unsigned char) (c2); \
- *b++ = (unsigned char) (c3); \
- } while (0)
-
-
-/* Store a jump with opcode OP at LOC to location TO. We store a
- relative address offset by the three bytes the jump itself occupies. */
-#define STORE_JUMP(op, loc, to) \
- store_op1 (op, loc, (to) - (loc) - 3)
-
-/* Likewise, for a two-argument jump. */
-#define STORE_JUMP2(op, loc, to, arg) \
- store_op2 (op, loc, (to) - (loc) - 3, arg)
-
-/* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */
-#define INSERT_JUMP(op, loc, to) \
- insert_op1 (op, loc, (to) - (loc) - 3, b)
-
-/* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */
-#define INSERT_JUMP2(op, loc, to, arg) \
- insert_op2 (op, loc, (to) - (loc) - 3, arg, b)
-
-
-/* This is not an arbitrary limit: the arguments which represent offsets
- into the pattern are two bytes long. So if 2^16 bytes turns out to
- be too small, many things would have to change. */
-#define MAX_BUF_SIZE (1L << 16)
-
-
-/* Extend the buffer by twice its current size via realloc and
- reset the pointers that pointed into the old block to point to the
- correct places in the new one. If extending the buffer results in it
- being larger than MAX_BUF_SIZE, then flag memory exhausted. */
-#define EXTEND_BUFFER() \
- do { \
- unsigned char *old_buffer = bufp->buffer; \
- if (bufp->allocated == MAX_BUF_SIZE) \
- return REG_ESIZE; \
- bufp->allocated <<= 1; \
- if (bufp->allocated > MAX_BUF_SIZE) \
- bufp->allocated = MAX_BUF_SIZE; \
- bufp->buffer = (unsigned char *) realloc (bufp->buffer, bufp->allocated);\
- if (bufp->buffer == NULL) \
- return REG_ESPACE; \
- /* If the buffer moved, move all the pointers into it. */ \
- if (old_buffer != bufp->buffer) \
- { \
- b = (b - old_buffer) + bufp->buffer; \
- begalt = (begalt - old_buffer) + bufp->buffer; \
- if (fixup_alt_jump) \
- fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer;\
- if (laststart) \
- laststart = (laststart - old_buffer) + bufp->buffer; \
- if (pending_exact) \
- pending_exact = (pending_exact - old_buffer) + bufp->buffer; \
- } \
- } while (0)
-
-
-/* Since we have one byte reserved for the register number argument to
- {start,stop}_memory, the maximum number of groups we can report
- things about is what fits in that byte. */
-#define MAX_REGNUM 255
-
-/* But patterns can have more than `MAX_REGNUM' registers. We just
- ignore the excess. */
-typedef unsigned regnum_t;
-
-
-/* Macros for the compile stack. */
-
-/* Since offsets can go either forwards or backwards, this type needs to
- be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */
-typedef int pattern_offset_t;
-
-typedef struct
-{
- pattern_offset_t begalt_offset;
- pattern_offset_t fixup_alt_jump;
- pattern_offset_t inner_group_offset;
- pattern_offset_t laststart_offset;
- regnum_t regnum;
-} compile_stack_elt_t;
-
-
-typedef struct
-{
- compile_stack_elt_t *stack;
- unsigned size;
- unsigned avail; /* Offset of next open position. */
-} compile_stack_type;
-
-
-#define INIT_COMPILE_STACK_SIZE 32
-
-#define COMPILE_STACK_EMPTY (compile_stack.avail == 0)
-#define COMPILE_STACK_FULL (compile_stack.avail == compile_stack.size)
-
-/* The next available element. */
-#define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail])
-
-
-/* Set the bit for character C in a list. */
-#define SET_LIST_BIT(c) \
- (b[((unsigned char) (c)) / BYTEWIDTH] \
- |= 1 << (((unsigned char) c) % BYTEWIDTH))
-
-
-/* Get the next unsigned number in the uncompiled pattern. */
-#define GET_UNSIGNED_NUMBER(num) \
- { if (p != pend) \
- { \
- PATFETCH (c); \
- while (ISDIGIT (c)) \
- { \
- if (num < 0) \
- num = 0; \
- num = num * 10 + c - '0'; \
- if (p == pend) \
- break; \
- PATFETCH (c); \
- } \
- } \
- }
-
-#define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */
-
-#define IS_CHAR_CLASS(string) \
- (STREQ (string, "alpha") || STREQ (string, "upper") \
- || STREQ (string, "lower") || STREQ (string, "digit") \
- || STREQ (string, "alnum") || STREQ (string, "xdigit") \
- || STREQ (string, "space") || STREQ (string, "print") \
- || STREQ (string, "punct") || STREQ (string, "graph") \
- || STREQ (string, "cntrl") || STREQ (string, "blank"))
-
-/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
- Returns one of error codes defined in `regex.h', or zero for success.
-
- Assumes the `allocated' (and perhaps `buffer') and `translate'
- fields are set in BUFP on entry.
-
- If it succeeds, results are put in BUFP (if it returns an error, the
- contents of BUFP are undefined):
- `buffer' is the compiled pattern;
- `syntax' is set to SYNTAX;
- `used' is set to the length of the compiled pattern;
- `fastmap_accurate' is zero;
- `re_nsub' is the number of subexpressions in PATTERN;
- `not_bol' and `not_eol' are zero;
-
- The `fastmap' and `newline_anchor' fields are neither
- examined nor set. */
-
-static reg_errcode_t
-regex_compile (pattern, size, syntax, bufp)
- const char *pattern;
- int size;
- reg_syntax_t syntax;
- struct re_pattern_buffer *bufp;
-{
- /* We fetch characters from PATTERN here. Even though PATTERN is
- `char *' (i.e., signed), we declare these variables as unsigned, so
- they can be reliably used as array indices. */
- register unsigned char c, c1;
-
- /* A random tempory spot in PATTERN. */
- const char *p1;
-
- /* Points to the end of the buffer, where we should append. */
- register unsigned char *b;
-
- /* Keeps track of unclosed groups. */
- compile_stack_type compile_stack;
-
- /* Points to the current (ending) position in the pattern. */
- const char *p = pattern;
- const char *pend = pattern + size;
-
- /* How to translate the characters in the pattern. */
- char *translate = bufp->translate;
-
- /* Address of the count-byte of the most recently inserted `exactn'
- command. This makes it possible to tell if a new exact-match
- character can be added to that command or if the character requires
- a new `exactn' command. */
- unsigned char *pending_exact = 0;
-
- /* Address of start of the most recently finished expression.
- This tells, e.g., postfix * where to find the start of its
- operand. Reset at the beginning of groups and alternatives. */
- unsigned char *laststart = 0;
-
- /* Address of beginning of regexp, or inside of last group. */
- unsigned char *begalt;
-
- /* Place in the uncompiled pattern (i.e., the {) to
- which to go back if the interval is invalid. */
- const char *beg_interval;
-
- /* Address of the place where a forward jump should go to the end of
- the containing expression. Each alternative of an `or' -- except the
- last -- ends with a forward jump of this sort. */
- unsigned char *fixup_alt_jump = 0;
-
- /* Counts open-groups as they are encountered. Remembered for the
- matching close-group on the compile stack, so the same register
- number is put in the stop_memory as the start_memory. */
- regnum_t regnum = 0;
-
-#ifdef DEBUG
- DEBUG_PRINT1 ("\nCompiling pattern: ");
- if (debug)
- {
- unsigned debug_count;
-
- for (debug_count = 0; debug_count < size; debug_count++)
- printchar (pattern[debug_count]);
- putchar ('\n');
- }
-#endif /* DEBUG */
-
- /* Initialize the compile stack. */
- compile_stack.stack = TALLOC (INIT_COMPILE_STACK_SIZE, compile_stack_elt_t);
- if (compile_stack.stack == NULL)
- return REG_ESPACE;
-
- compile_stack.size = INIT_COMPILE_STACK_SIZE;
- compile_stack.avail = 0;
-
- /* Initialize the pattern buffer. */
- bufp->syntax = syntax;
- bufp->fastmap_accurate = 0;
- bufp->not_bol = bufp->not_eol = 0;
-
- /* Set `used' to zero, so that if we return an error, the pattern
- printer (for debugging) will think there's no pattern. We reset it
- at the end. */
- bufp->used = 0;
-
- /* Always count groups, whether or not bufp->no_sub is set. */
- bufp->re_nsub = 0;
-
-#if !defined (emacs) && !defined (SYNTAX_TABLE)
- /* Initialize the syntax table. */
- init_syntax_once ();
-#endif
-
- if (bufp->allocated == 0)
- {
- if (bufp->buffer)
- { /* If zero allocated, but buffer is non-null, try to realloc
- enough space. This loses if buffer's address is bogus, but
- that is the user's responsibility. */
- RETALLOC (bufp->buffer, INIT_BUF_SIZE, unsigned char);
- }
- else
- { /* Caller did not allocate a buffer. Do it for them. */
- bufp->buffer = TALLOC (INIT_BUF_SIZE, unsigned char);
- }
- if (!bufp->buffer) return REG_ESPACE;
-
- bufp->allocated = INIT_BUF_SIZE;
- }
-
- begalt = b = bufp->buffer;
-
- /* Loop through the uncompiled pattern until we're at the end. */
- while (p != pend)
- {
- PATFETCH (c);
-
- switch (c)
- {
- case '^':
- {
- if ( /* If at start of pattern, it's an operator. */
- p == pattern + 1
- /* If context independent, it's an operator. */
- || syntax & RE_CONTEXT_INDEP_ANCHORS
- /* Otherwise, depends on what's come before. */
- || at_begline_loc_p (pattern, p, syntax))
- BUF_PUSH (begline);
- else
- goto normal_char;
- }
- break;
-
-
- case '$':
- {
- if ( /* If at end of pattern, it's an operator. */
- p == pend
- /* If context independent, it's an operator. */
- || syntax & RE_CONTEXT_INDEP_ANCHORS
- /* Otherwise, depends on what's next. */
- || at_endline_loc_p (p, pend, syntax))
- BUF_PUSH (endline);
- else
- goto normal_char;
- }
- break;
-
-
- case '+':
- case '?':
- if ((syntax & RE_BK_PLUS_QM)
- || (syntax & RE_LIMITED_OPS))
- goto normal_char;
- handle_plus:
- case '*':
- /* If there is no previous pattern... */
- if (!laststart)
- {
- if (syntax & RE_CONTEXT_INVALID_OPS)
- return REG_BADRPT;
- else if (!(syntax & RE_CONTEXT_INDEP_OPS))
- goto normal_char;
- }
-
- {
- /* Are we optimizing this jump? */
- boolean keep_string_p = false;
-
- /* 1 means zero (many) matches is allowed. */
- char zero_times_ok = 0, many_times_ok = 0;
-
- /* If there is a sequence of repetition chars, collapse it
- down to just one (the right one). We can't combine
- interval operators with these because of, e.g., `a{2}*',
- which should only match an even number of `a's. */
-
- for (;;)
- {
- zero_times_ok |= c != '+';
- many_times_ok |= c != '?';
-
- if (p == pend)
- break;
-
- PATFETCH (c);
-
- if (c == '*'
- || (!(syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?')))
- ;
-
- else if (syntax & RE_BK_PLUS_QM && c == '\\')
- {
- if (p == pend) return REG_EESCAPE;
-
- PATFETCH (c1);
- if (!(c1 == '+' || c1 == '?'))
- {
- PATUNFETCH;
- PATUNFETCH;
- break;
- }
-
- c = c1;
- }
- else
- {
- PATUNFETCH;
- break;
- }
-
- /* If we get here, we found another repeat character. */
- }
-
- /* Star, etc. applied to an empty pattern is equivalent
- to an empty pattern. */
- if (!laststart)
- break;
-
- /* Now we know whether or not zero matches is allowed
- and also whether or not two or more matches is allowed. */
- if (many_times_ok)
- { /* More than one repetition is allowed, so put in at the
- end a backward relative jump from `b' to before the next
- jump we're going to put in below (which jumps from
- laststart to after this jump).
-
- But if we are at the `*' in the exact sequence `.*\n',
- insert an unconditional jump backwards to the .,
- instead of the beginning of the loop. This way we only
- push a failure point once, instead of every time
- through the loop. */
- assert (p - 1 > pattern);
-
- /* Allocate the space for the jump. */
- GET_BUFFER_SPACE (3);
-
- /* We know we are not at the first character of the pattern,
- because laststart was nonzero. And we've already
- incremented `p', by the way, to be the character after
- the `*'. Do we have to do something analogous here
- for null bytes, because of RE_DOT_NOT_NULL? */
- if (TRANSLATE (*(p - 2)) == TRANSLATE ('.')
- && zero_times_ok
- && p < pend && TRANSLATE (*p) == TRANSLATE ('\n')
- && !(syntax & RE_DOT_NEWLINE))
- { /* We have .*\n. */
- STORE_JUMP (jump, b, laststart);
- keep_string_p = true;
- }
- else
- /* Anything else. */
- STORE_JUMP (maybe_pop_jump, b, laststart - 3);
-
- /* We've added more stuff to the buffer. */
- b += 3;
- }
-
- /* On failure, jump from laststart to b + 3, which will be the
- end of the buffer after this jump is inserted. */
- GET_BUFFER_SPACE (3);
- INSERT_JUMP (keep_string_p ? on_failure_keep_string_jump
- : on_failure_jump,
- laststart, b + 3);
- pending_exact = 0;
- b += 3;
-
- if (!zero_times_ok)
- {
- /* At least one repetition is required, so insert a
- `dummy_failure_jump' before the initial
- `on_failure_jump' instruction of the loop. This
- effects a skip over that instruction the first time
- we hit that loop. */
- GET_BUFFER_SPACE (3);
- INSERT_JUMP (dummy_failure_jump, laststart, laststart + 6);
- b += 3;
- }
- }
- break;
-
-
- case '.':
- laststart = b;
- BUF_PUSH (anychar);
- break;
-
-
- case '[':
- {
- boolean had_char_class = false;
-
- if (p == pend) return REG_EBRACK;
-
- /* Ensure that we have enough space to push a charset: the
- opcode, the length count, and the bitset; 34 bytes in all. */
- GET_BUFFER_SPACE (34);
-
- laststart = b;
-
- /* We test `*p == '^' twice, instead of using an if
- statement, so we only need one BUF_PUSH. */
- BUF_PUSH (*p == '^' ? charset_not : charset);
- if (*p == '^')
- p++;
-
- /* Remember the first position in the bracket expression. */
- p1 = p;
-
- /* Push the number of bytes in the bitmap. */
- BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
-
- /* Clear the whole map. */
- bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH);
-
- /* charset_not matches newline according to a syntax bit. */
- if ((re_opcode_t) b[-2] == charset_not
- && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
- SET_LIST_BIT ('\n');
-
- /* Read in characters and ranges, setting map bits. */
- for (;;)
- {
- if (p == pend) return REG_EBRACK;
-
- PATFETCH (c);
-
- /* \ might escape characters inside [...] and [^...]. */
- if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
- {
- if (p == pend) return REG_EESCAPE;
-
- PATFETCH (c1);
- SET_LIST_BIT (c1);
- continue;
- }
-
- /* Could be the end of the bracket expression. If it's
- not (i.e., when the bracket expression is `[]' so
- far), the ']' character bit gets set way below. */
- if (c == ']' && p != p1 + 1)
- break;
-
- /* Look ahead to see if it's a range when the last thing
- was a character class. */
- if (had_char_class && c == '-' && *p != ']')
- return REG_ERANGE;
-
- /* Look ahead to see if it's a range when the last thing
- was a character: if this is a hyphen not at the
- beginning or the end of a list, then it's the range
- operator. */
- if (c == '-'
- && !(p - 2 >= pattern && p[-2] == '[')
- && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^')
- && *p != ']')
- {
- reg_errcode_t ret
- = compile_range (&p, pend, translate, syntax, b);
- if (ret != REG_NOERROR) return ret;
- }
-
- else if (p[0] == '-' && p[1] != ']')
- { /* This handles ranges made up of characters only. */
- reg_errcode_t ret;
-
- /* Move past the `-'. */
- PATFETCH (c1);
-
- ret = compile_range (&p, pend, translate, syntax, b);
- if (ret != REG_NOERROR) return ret;
- }
-
- /* See if we're at the beginning of a possible character
- class. */
-
- else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
- { /* Leave room for the null. */
- char str[CHAR_CLASS_MAX_LENGTH + 1];
-
- PATFETCH (c);
- c1 = 0;
-
- /* If pattern is `[[:'. */
- if (p == pend) return REG_EBRACK;
-
- for (;;)
- {
- PATFETCH (c);
- if (c == ':' || c == ']' || p == pend
- || c1 == CHAR_CLASS_MAX_LENGTH)
- break;
- str[c1++] = c;
- }
- str[c1] = '\0';
-
- /* If isn't a word bracketed by `[:' and:`]':
- undo the ending character, the letters, and leave
- the leading `:' and `[' (but set bits for them). */
- if (c == ':' && *p == ']')
- {
- int ch;
- boolean is_alnum = STREQ (str, "alnum");
- boolean is_alpha = STREQ (str, "alpha");
- boolean is_blank = STREQ (str, "blank");
- boolean is_cntrl = STREQ (str, "cntrl");
- boolean is_digit = STREQ (str, "digit");
- boolean is_graph = STREQ (str, "graph");
- boolean is_lower = STREQ (str, "lower");
- boolean is_print = STREQ (str, "print");
- boolean is_punct = STREQ (str, "punct");
- boolean is_space = STREQ (str, "space");
- boolean is_upper = STREQ (str, "upper");
- boolean is_xdigit = STREQ (str, "xdigit");
-
- if (!IS_CHAR_CLASS (str)) return REG_ECTYPE;
-
- /* Throw away the ] at the end of the character
- class. */
- PATFETCH (c);
-
- if (p == pend) return REG_EBRACK;
-
- for (ch = 0; ch < 1 << BYTEWIDTH; ch++)
- {
- if ( (is_alnum && ISALNUM (ch))
- || (is_alpha && ISALPHA (ch))
- || (is_blank && ISBLANK (ch))
- || (is_cntrl && ISCNTRL (ch))
- || (is_digit && ISDIGIT (ch))
- || (is_graph && ISGRAPH (ch))
- || (is_lower && ISLOWER (ch))
- || (is_print && ISPRINT (ch))
- || (is_punct && ISPUNCT (ch))
- || (is_space && ISSPACE (ch))
- || (is_upper && ISUPPER (ch))
- || (is_xdigit && ISXDIGIT (ch)))
- SET_LIST_BIT (ch);
- }
- had_char_class = true;
- }
- else
- {
- c1++;
- while (c1--)
- PATUNFETCH;
- SET_LIST_BIT ('[');
- SET_LIST_BIT (':');
- had_char_class = false;
- }
- }
- else
- {
- had_char_class = false;
- SET_LIST_BIT (c);
- }
- }
-
- /* Discard any (non)matching list bytes that are all 0 at the
- end of the map. Decrease the map-length byte too. */
- while ((int) b[-1] > 0 && b[b[-1] - 1] == 0)
- b[-1]--;
- b += b[-1];
- }
- break;
-
-
- case '(':
- if (syntax & RE_NO_BK_PARENS)
- goto handle_open;
- else
- goto normal_char;
-
-
- case ')':
- if (syntax & RE_NO_BK_PARENS)
- goto handle_close;
- else
- goto normal_char;
-
-
- case '\n':
- if (syntax & RE_NEWLINE_ALT)
- goto handle_alt;
- else
- goto normal_char;
-
-
- case '|':
- if (syntax & RE_NO_BK_VBAR)
- goto handle_alt;
- else
- goto normal_char;
-
-
- case '{':
- if (syntax & RE_INTERVALS && syntax & RE_NO_BK_BRACES)
- goto handle_interval;
- else
- goto normal_char;
-
-
- case '\\':
- if (p == pend) return REG_EESCAPE;
-
- /* Do not translate the character after the \, so that we can
- distinguish, e.g., \B from \b, even if we normally would
- translate, e.g., B to b. */
- PATFETCH_RAW (c);
-
- switch (c)
- {
- case '(':
- if (syntax & RE_NO_BK_PARENS)
- goto normal_backslash;
-
- handle_open:
- bufp->re_nsub++;
- regnum++;
-
- if (COMPILE_STACK_FULL)
- {
- RETALLOC (compile_stack.stack, compile_stack.size << 1,
- compile_stack_elt_t);
- if (compile_stack.stack == NULL) return REG_ESPACE;
-
- compile_stack.size <<= 1;
- }
-
- /* These are the values to restore when we hit end of this
- group. They are all relative offsets, so that if the
- whole pattern moves because of realloc, they will still
- be valid. */
- COMPILE_STACK_TOP.begalt_offset = begalt - bufp->buffer;
- COMPILE_STACK_TOP.fixup_alt_jump
- = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0;
- COMPILE_STACK_TOP.laststart_offset = b - bufp->buffer;
- COMPILE_STACK_TOP.regnum = regnum;
-
- /* We will eventually replace the 0 with the number of
- groups inner to this one. But do not push a
- start_memory for groups beyond the last one we can
- represent in the compiled pattern. */
- if (regnum <= MAX_REGNUM)
- {
- COMPILE_STACK_TOP.inner_group_offset = b - bufp->buffer + 2;
- BUF_PUSH_3 (start_memory, regnum, 0);
- }
-
- compile_stack.avail++;
-
- fixup_alt_jump = 0;
- laststart = 0;
- begalt = b;
- /* If we've reached MAX_REGNUM groups, then this open
- won't actually generate any code, so we'll have to
- clear pending_exact explicitly. */
- pending_exact = 0;
- break;
-
-
- case ')':
- if (syntax & RE_NO_BK_PARENS) goto normal_backslash;
-
- if (COMPILE_STACK_EMPTY)
- if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
- goto normal_backslash;
- else
- return REG_ERPAREN;
-
- handle_close:
- if (fixup_alt_jump)
- { /* Push a dummy failure point at the end of the
- alternative for a possible future
- `pop_failure_jump' to pop. See comments at
- `push_dummy_failure' in `re_match_2'. */
- BUF_PUSH (push_dummy_failure);
-
- /* We allocated space for this jump when we assigned
- to `fixup_alt_jump', in the `handle_alt' case below. */
- STORE_JUMP (jump_past_alt, fixup_alt_jump, b - 1);
- }
-
- /* See similar code for backslashed left paren above. */
- if (COMPILE_STACK_EMPTY)
- if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
- goto normal_char;
- else
- return REG_ERPAREN;
-
- /* Since we just checked for an empty stack above, this
- ``can't happen''. */
- assert (compile_stack.avail != 0);
- {
- /* We don't just want to restore into `regnum', because
- later groups should continue to be numbered higher,
- as in `(ab)c(de)' -- the second group is #2. */
- regnum_t this_group_regnum;
-
- compile_stack.avail--;
- begalt = bufp->buffer + COMPILE_STACK_TOP.begalt_offset;
- fixup_alt_jump
- = COMPILE_STACK_TOP.fixup_alt_jump
- ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1
- : 0;
- laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset;
- this_group_regnum = COMPILE_STACK_TOP.regnum;
- /* If we've reached MAX_REGNUM groups, then this open
- won't actually generate any code, so we'll have to
- clear pending_exact explicitly. */
- pending_exact = 0;
-
- /* We're at the end of the group, so now we know how many
- groups were inside this one. */
- if (this_group_regnum <= MAX_REGNUM)
- {
- unsigned char *inner_group_loc
- = bufp->buffer + COMPILE_STACK_TOP.inner_group_offset;
-
- *inner_group_loc = regnum - this_group_regnum;
- BUF_PUSH_3 (stop_memory, this_group_regnum,
- regnum - this_group_regnum);
- }
- }
- break;
-
-
- case '|': /* `\|'. */
- if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR)
- goto normal_backslash;
- handle_alt:
- if (syntax & RE_LIMITED_OPS)
- goto normal_char;
-
- /* Insert before the previous alternative a jump which
- jumps to this alternative if the former fails. */
- GET_BUFFER_SPACE (3);
- INSERT_JUMP (on_failure_jump, begalt, b + 6);
- pending_exact = 0;
- b += 3;
-
- /* The alternative before this one has a jump after it
- which gets executed if it gets matched. Adjust that
- jump so it will jump to this alternative's analogous
- jump (put in below, which in turn will jump to the next
- (if any) alternative's such jump, etc.). The last such
- jump jumps to the correct final destination. A picture:
- _____ _____
- | | | |
- | v | v
- a | b | c
-
- If we are at `b', then fixup_alt_jump right now points to a
- three-byte space after `a'. We'll put in the jump, set
- fixup_alt_jump to right after `b', and leave behind three
- bytes which we'll fill in when we get to after `c'. */
-
- if (fixup_alt_jump)
- STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
-
- /* Mark and leave space for a jump after this alternative,
- to be filled in later either by next alternative or
- when know we're at the end of a series of alternatives. */
- fixup_alt_jump = b;
- GET_BUFFER_SPACE (3);
- b += 3;
-
- laststart = 0;
- begalt = b;
- break;
-
-
- case '{':
- /* If \{ is a literal. */
- if (!(syntax & RE_INTERVALS)
- /* If we're at `\{' and it's not the open-interval
- operator. */
- || ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES))
- || (p - 2 == pattern && p == pend))
- goto normal_backslash;
-
- handle_interval:
- {
- /* If got here, then the syntax allows intervals. */
-
- /* At least (most) this many matches must be made. */
- int lower_bound = -1, upper_bound = -1;
-
- beg_interval = p - 1;
-
- if (p == pend)
- {
- if (syntax & RE_NO_BK_BRACES)
- goto unfetch_interval;
- else
- return REG_EBRACE;
- }
-
- GET_UNSIGNED_NUMBER (lower_bound);
-
- if (c == ',')
- {
- GET_UNSIGNED_NUMBER (upper_bound);
- if (upper_bound < 0) upper_bound = RE_DUP_MAX;
- }
- else
- /* Interval such as `{1}' => match exactly once. */
- upper_bound = lower_bound;
-
- if (lower_bound < 0 || upper_bound > RE_DUP_MAX
- || lower_bound > upper_bound)
- {
- if (syntax & RE_NO_BK_BRACES)
- goto unfetch_interval;
- else
- return REG_BADBR;
- }
-
- if (!(syntax & RE_NO_BK_BRACES))
- {
- if (c != '\\') return REG_EBRACE;
-
- PATFETCH (c);
- }
-
- if (c != '}')
- {
- if (syntax & RE_NO_BK_BRACES)
- goto unfetch_interval;
- else
- return REG_BADBR;
- }
-
- /* We just parsed a valid interval. */
-
- /* If it's invalid to have no preceding re. */
- if (!laststart)
- {
- if (syntax & RE_CONTEXT_INVALID_OPS)
- return REG_BADRPT;
- else if (syntax & RE_CONTEXT_INDEP_OPS)
- laststart = b;
- else
- goto unfetch_interval;
- }
-
- /* If the upper bound is zero, don't want to succeed at
- all; jump from `laststart' to `b + 3', which will be
- the end of the buffer after we insert the jump. */
- if (upper_bound == 0)
- {
- GET_BUFFER_SPACE (3);
- INSERT_JUMP (jump, laststart, b + 3);
- b += 3;
- }
-
- /* Otherwise, we have a nontrivial interval. When
- we're all done, the pattern will look like:
- set_number_at <jump count> <upper bound>
- set_number_at <succeed_n count> <lower bound>
- succeed_n <after jump addr> <succed_n count>
- <body of loop>
- jump_n <succeed_n addr> <jump count>
- (The upper bound and `jump_n' are omitted if
- `upper_bound' is 1, though.) */
- else
- { /* If the upper bound is > 1, we need to insert
- more at the end of the loop. */
- unsigned nbytes = 10 + (upper_bound > 1) * 10;
-
- GET_BUFFER_SPACE (nbytes);
-
- /* Initialize lower bound of the `succeed_n', even
- though it will be set during matching by its
- attendant `set_number_at' (inserted next),
- because `re_compile_fastmap' needs to know.
- Jump to the `jump_n' we might insert below. */
- INSERT_JUMP2 (succeed_n, laststart,
- b + 5 + (upper_bound > 1) * 5,
- lower_bound);
- b += 5;
-
- /* Code to initialize the lower bound. Insert
- before the `succeed_n'. The `5' is the last two
- bytes of this `set_number_at', plus 3 bytes of
- the following `succeed_n'. */
- insert_op2 (set_number_at, laststart, 5, lower_bound, b);
- b += 5;
-
- if (upper_bound > 1)
- { /* More than one repetition is allowed, so
- append a backward jump to the `succeed_n'
- that starts this interval.
-
- When we've reached this during matching,
- we'll have matched the interval once, so
- jump back only `upper_bound - 1' times. */
- STORE_JUMP2 (jump_n, b, laststart + 5,
- upper_bound - 1);
- b += 5;
-
- /* The location we want to set is the second
- parameter of the `jump_n'; that is `b-2' as
- an absolute address. `laststart' will be
- the `set_number_at' we're about to insert;
- `laststart+3' the number to set, the source
- for the relative address. But we are
- inserting into the middle of the pattern --
- so everything is getting moved up by 5.
- Conclusion: (b - 2) - (laststart + 3) + 5,
- i.e., b - laststart.
-
- We insert this at the beginning of the loop
- so that if we fail during matching, we'll
- reinitialize the bounds. */
- insert_op2 (set_number_at, laststart, b - laststart,
- upper_bound - 1, b);
- b += 5;
- }
- }
- pending_exact = 0;
- beg_interval = NULL;
- }
- break;
-
- unfetch_interval:
- /* If an invalid interval, match the characters as literals. */
- assert (beg_interval);
- p = beg_interval;
- beg_interval = NULL;
-
- /* normal_char and normal_backslash need `c'. */
- PATFETCH (c);
-
- if (!(syntax & RE_NO_BK_BRACES))
- {
- if (p > pattern && p[-1] == '\\')
- goto normal_backslash;
- }
- goto normal_char;
-
-#ifdef emacs
- /* There is no way to specify the before_dot and after_dot
- operators. rms says this is ok. --karl */
- case '=':
- BUF_PUSH (at_dot);
- break;
-
- case 's':
- laststart = b;
- PATFETCH (c);
- BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]);
- break;
-
- case 'S':
- laststart = b;
- PATFETCH (c);
- BUF_PUSH_2 (notsyntaxspec, syntax_spec_code[c]);
- break;
-#endif /* emacs */
-
-
- case 'w':
- laststart = b;
- BUF_PUSH (wordchar);
- break;
-
-
- case 'W':
- laststart = b;
- BUF_PUSH (notwordchar);
- break;
-
-
- case '<':
- BUF_PUSH (wordbeg);
- break;
-
- case '>':
- BUF_PUSH (wordend);
- break;
-
- case 'b':
- BUF_PUSH (wordbound);
- break;
-
- case 'B':
- BUF_PUSH (notwordbound);
- break;
-
- case '`':
- BUF_PUSH (begbuf);
- break;
-
- case '\'':
- BUF_PUSH (endbuf);
- break;
-
- case '1': case '2': case '3': case '4': case '5':
- case '6': case '7': case '8': case '9':
- if (syntax & RE_NO_BK_REFS)
- goto normal_char;
-
- c1 = c - '0';
-
- if (c1 > regnum)
- return REG_ESUBREG;
-
- /* Can't back reference to a subexpression if inside of it. */
- if (group_in_compile_stack (compile_stack, c1))
- goto normal_char;
-
- laststart = b;
- BUF_PUSH_2 (duplicate, c1);
- break;
-
-
- case '+':
- case '?':
- if (syntax & RE_BK_PLUS_QM)
- goto handle_plus;
- else
- goto normal_backslash;
-
- default:
- normal_backslash:
- /* You might think it would be useful for \ to mean
- not to translate; but if we don't translate it
- it will never match anything. */
- c = TRANSLATE (c);
- goto normal_char;
- }
- break;
-
-
- default:
- /* Expects the character in `c'. */
- normal_char:
- /* If no exactn currently being built. */
- if (!pending_exact
-
- /* If last exactn not at current position. */
- || pending_exact + *pending_exact + 1 != b
-
- /* We have only one byte following the exactn for the count. */
- || *pending_exact == (1 << BYTEWIDTH) - 1
-
- /* If followed by a repetition operator. */
- || *p == '*' || *p == '^'
- || ((syntax & RE_BK_PLUS_QM)
- ? *p == '\\' && (p[1] == '+' || p[1] == '?')
- : (*p == '+' || *p == '?'))
- || ((syntax & RE_INTERVALS)
- && ((syntax & RE_NO_BK_BRACES)
- ? *p == '{'
- : (p[0] == '\\' && p[1] == '{'))))
- {
- /* Start building a new exactn. */
-
- laststart = b;
-
- BUF_PUSH_2 (exactn, 0);
- pending_exact = b - 1;
- }
-
- BUF_PUSH (c);
- (*pending_exact)++;
- break;
- } /* switch (c) */
- } /* while p != pend */
-
-
- /* Through the pattern now. */
-
- if (fixup_alt_jump)
- STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
-
- if (!COMPILE_STACK_EMPTY)
- return REG_EPAREN;
-
- free (compile_stack.stack);
-
- /* We have succeeded; set the length of the buffer. */
- bufp->used = b - bufp->buffer;
-
-#ifdef DEBUG
- if (debug)
- {
- DEBUG_PRINT1 ("\nCompiled pattern: \n");
- print_compiled_pattern (bufp);
- }
-#endif /* DEBUG */
-
- return REG_NOERROR;
-} /* regex_compile */
-
-/* Subroutines for `regex_compile'. */
-
-/* Store OP at LOC followed by two-byte integer parameter ARG. */
-
-static void
-store_op1 (op, loc, arg)
- re_opcode_t op;
- unsigned char *loc;
- int arg;
-{
- *loc = (unsigned char) op;
- STORE_NUMBER (loc + 1, arg);
-}
-
-
-/* Like `store_op1', but for two two-byte parameters ARG1 and ARG2. */
-
-static void
-store_op2 (op, loc, arg1, arg2)
- re_opcode_t op;
- unsigned char *loc;
- int arg1, arg2;
-{
- *loc = (unsigned char) op;
- STORE_NUMBER (loc + 1, arg1);
- STORE_NUMBER (loc + 3, arg2);
-}
-
-
-/* Copy the bytes from LOC to END to open up three bytes of space at LOC
- for OP followed by two-byte integer parameter ARG. */
-
-static void
-insert_op1 (op, loc, arg, end)
- re_opcode_t op;
- unsigned char *loc;
- int arg;
- unsigned char *end;
-{
- register unsigned char *pfrom = end;
- register unsigned char *pto = end + 3;
-
- while (pfrom != loc)
- *--pto = *--pfrom;
-
- store_op1 (op, loc, arg);
-}
-
-
-/* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2. */
-
-static void
-insert_op2 (op, loc, arg1, arg2, end)
- re_opcode_t op;
- unsigned char *loc;
- int arg1, arg2;
- unsigned char *end;
-{
- register unsigned char *pfrom = end;
- register unsigned char *pto = end + 5;
-
- while (pfrom != loc)
- *--pto = *--pfrom;
-
- store_op2 (op, loc, arg1, arg2);
-}
-
-
-/* P points to just after a ^ in PATTERN. Return true if that ^ comes
- after an alternative or a begin-subexpression. We assume there is at
- least one character before the ^. */
-
-static boolean
-at_begline_loc_p (pattern, p, syntax)
- const char *pattern, *p;
- reg_syntax_t syntax;
-{
- const char *prev = p - 2;
- boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\';
-
- return
- /* After a subexpression? */
- (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash))
- /* After an alternative? */
- || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash));
-}
-
-
-/* The dual of at_begline_loc_p. This one is for $. We assume there is
- at least one character after the $, i.e., `P < PEND'. */
-
-static boolean
-at_endline_loc_p (p, pend, syntax)
- const char *p, *pend;
- int syntax;
-{
- const char *next = p;
- boolean next_backslash = *next == '\\';
- const char *next_next = p + 1 < pend ? p + 1 : NULL;
-
- return
- /* Before a subexpression? */
- (syntax & RE_NO_BK_PARENS ? *next == ')'
- : next_backslash && next_next && *next_next == ')')
- /* Before an alternative? */
- || (syntax & RE_NO_BK_VBAR ? *next == '|'
- : next_backslash && next_next && *next_next == '|');
-}
-
-
-/* Returns true if REGNUM is in one of COMPILE_STACK's elements and
- false if it's not. */
-
-static boolean
-group_in_compile_stack (compile_stack, regnum)
- compile_stack_type compile_stack;
- regnum_t regnum;
-{
- int this_element;
-
- for (this_element = compile_stack.avail - 1;
- this_element >= 0;
- this_element--)
- if (compile_stack.stack[this_element].regnum == regnum)
- return true;
-
- return false;
-}
-
-
-/* Read the ending character of a range (in a bracket expression) from the
- uncompiled pattern *P_PTR (which ends at PEND). We assume the
- starting character is in `P[-2]'. (`P[-1]' is the character `-'.)
- Then we set the translation of all bits between the starting and
- ending characters (inclusive) in the compiled pattern B.
-
- Return an error code.
-
- We use these short variable names so we can use the same macros as
- `regex_compile' itself. */
-
-static reg_errcode_t
-compile_range (p_ptr, pend, translate, syntax, b)
- const char **p_ptr, *pend;
- char *translate;
- reg_syntax_t syntax;
- unsigned char *b;
-{
- unsigned this_char;
-
- const char *p = *p_ptr;
- int range_start, range_end;
-
- if (p == pend)
- return REG_ERANGE;
-
- /* Even though the pattern is a signed `char *', we need to fetch
- with unsigned char *'s; if the high bit of the pattern character
- is set, the range endpoints will be negative if we fetch using a
- signed char *.
-
- We also want to fetch the endpoints without translating them; the
- appropriate translation is done in the bit-setting loop below. */
- range_start = ((unsigned char *) p)[-2];
- range_end = ((unsigned char *) p)[0];
-
- /* Have to increment the pointer into the pattern string, so the
- caller isn't still at the ending character. */
- (*p_ptr)++;
-
- /* If the start is after the end, the range is empty. */
- if (range_start > range_end)
- return syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR;
-
- /* Here we see why `this_char' has to be larger than an `unsigned
- char' -- the range is inclusive, so if `range_end' == 0xff
- (assuming 8-bit characters), we would otherwise go into an infinite
- loop, since all characters <= 0xff. */
- for (this_char = range_start; this_char <= range_end; this_char++)
- {
- SET_LIST_BIT (TRANSLATE (this_char));
- }
-
- return REG_NOERROR;
-}
-
-/* Failure stack declarations and macros; both re_compile_fastmap and
- re_match_2 use a failure stack. These have to be macros because of
- REGEX_ALLOCATE. */
-
-
-/* Number of failure points for which to initially allocate space
- when matching. If this number is exceeded, we allocate more
- space, so it is not a hard limit. */
-#ifndef INIT_FAILURE_ALLOC
-#define INIT_FAILURE_ALLOC 5
-#endif
-
-/* Roughly the maximum number of failure points on the stack. Would be
- exactly that if always used MAX_FAILURE_SPACE each time we failed.
- This is a variable only so users of regex can assign to it; we never
- change it ourselves. */
-int re_max_failures = 2000;
-
-typedef const unsigned char *fail_stack_elt_t;
-
-typedef struct
-{
- fail_stack_elt_t *stack;
- unsigned size;
- unsigned avail; /* Offset of next open position. */
-} fail_stack_type;
-
-#define FAIL_STACK_EMPTY() (fail_stack.avail == 0)
-#define FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0)
-#define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size)
-#define FAIL_STACK_TOP() (fail_stack.stack[fail_stack.avail])
-
-
-/* Initialize `fail_stack'. Do `return -2' if the alloc fails. */
-
-#define INIT_FAIL_STACK() \
- do { \
- fail_stack.stack = (fail_stack_elt_t *) \
- REGEX_ALLOCATE (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t)); \
- \
- if (fail_stack.stack == NULL) \
- return -2; \
- \
- fail_stack.size = INIT_FAILURE_ALLOC; \
- fail_stack.avail = 0; \
- } while (0)
-
-
-/* Double the size of FAIL_STACK, up to approximately `re_max_failures' items.
-
- Return 1 if succeeds, and 0 if either ran out of memory
- allocating space for it or it was already too large.
-
- REGEX_REALLOCATE requires `destination' be declared. */
-
-#define DOUBLE_FAIL_STACK(fail_stack) \
- ((fail_stack).size > re_max_failures * MAX_FAILURE_ITEMS \
- ? 0 \
- : ((fail_stack).stack = (fail_stack_elt_t *) \
- REGEX_REALLOCATE ((fail_stack).stack, \
- (fail_stack).size * sizeof (fail_stack_elt_t), \
- ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)), \
- \
- (fail_stack).stack == NULL \
- ? 0 \
- : ((fail_stack).size <<= 1, \
- 1)))
-
-
-/* Push PATTERN_OP on FAIL_STACK.
-
- Return 1 if was able to do so and 0 if ran out of memory allocating
- space to do so. */
-#define PUSH_PATTERN_OP(pattern_op, fail_stack) \
- ((FAIL_STACK_FULL () \
- && !DOUBLE_FAIL_STACK (fail_stack)) \
- ? 0 \
- : ((fail_stack).stack[(fail_stack).avail++] = pattern_op, \
- 1))
-
-/* This pushes an item onto the failure stack. Must be a four-byte
- value. Assumes the variable `fail_stack'. Probably should only
- be called from within `PUSH_FAILURE_POINT'. */
-#define PUSH_FAILURE_ITEM(item) \
- fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item
-
-/* The complement operation. Assumes `fail_stack' is nonempty. */
-#define POP_FAILURE_ITEM() fail_stack.stack[--fail_stack.avail]
-
-/* Used to omit pushing failure point id's when we're not debugging. */
-#ifdef DEBUG
-#define DEBUG_PUSH PUSH_FAILURE_ITEM
-#define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_ITEM ()
-#else
-#define DEBUG_PUSH(item)
-#define DEBUG_POP(item_addr)
-#endif
-
-
-/* Push the information about the state we will need
- if we ever fail back to it.
-
- Requires variables fail_stack, regstart, regend, reg_info, and
- num_regs be declared. DOUBLE_FAIL_STACK requires `destination' be
- declared.
-
- Does `return FAILURE_CODE' if runs out of memory. */
-
-#define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \
- do { \
- char *destination; \
- /* Must be int, so when we don't save any registers, the arithmetic \
- of 0 + -1 isn't done as unsigned. */ \
- int this_reg; \
- \
- DEBUG_STATEMENT (failure_id++); \
- DEBUG_STATEMENT (nfailure_points_pushed++); \
- DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \
- DEBUG_PRINT2 (" Before push, next avail: %d\n", (fail_stack).avail);\
- DEBUG_PRINT2 (" size: %d\n", (fail_stack).size);\
- \
- DEBUG_PRINT2 (" slots needed: %d\n", NUM_FAILURE_ITEMS); \
- DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \
- \
- /* Ensure we have enough space allocated for what we will push. */ \
- while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \
- { \
- if (!DOUBLE_FAIL_STACK (fail_stack)) \
- return failure_code; \
- \
- DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \
- (fail_stack).size); \
- DEBUG_PRINT2 (" slots available: %d\n", REMAINING_AVAIL_SLOTS);\
- } \
- \
- /* Push the info, starting with the registers. */ \
- DEBUG_PRINT1 ("\n"); \
- \
- for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \
- this_reg++) \
- { \
- DEBUG_PRINT2 (" Pushing reg: %d\n", this_reg); \
- DEBUG_STATEMENT (num_regs_pushed++); \
- \
- DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \
- PUSH_FAILURE_ITEM (regstart[this_reg]); \
- \
- DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \
- PUSH_FAILURE_ITEM (regend[this_reg]); \
- \
- DEBUG_PRINT2 (" info: 0x%x\n ", reg_info[this_reg]); \
- DEBUG_PRINT2 (" match_null=%d", \
- REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \
- DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \
- DEBUG_PRINT2 (" matched_something=%d", \
- MATCHED_SOMETHING (reg_info[this_reg])); \
- DEBUG_PRINT2 (" ever_matched=%d", \
- EVER_MATCHED_SOMETHING (reg_info[this_reg])); \
- DEBUG_PRINT1 ("\n"); \
- PUSH_FAILURE_ITEM (reg_info[this_reg].word); \
- } \
- \
- DEBUG_PRINT2 (" Pushing low active reg: %d\n", lowest_active_reg);\
- PUSH_FAILURE_ITEM (lowest_active_reg); \
- \
- DEBUG_PRINT2 (" Pushing high active reg: %d\n", highest_active_reg);\
- PUSH_FAILURE_ITEM (highest_active_reg); \
- \
- DEBUG_PRINT2 (" Pushing pattern 0x%x: ", pattern_place); \
- DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \
- PUSH_FAILURE_ITEM (pattern_place); \
- \
- DEBUG_PRINT2 (" Pushing string 0x%x: `", string_place); \
- DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \
- size2); \
- DEBUG_PRINT1 ("'\n"); \
- PUSH_FAILURE_ITEM (string_place); \
- \
- DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \
- DEBUG_PUSH (failure_id); \
- } while (0)
-
-/* This is the number of items that are pushed and popped on the stack
- for each register. */
-#define NUM_REG_ITEMS 3
-
-/* Individual items aside from the registers. */
-#ifdef DEBUG
-#define NUM_NONREG_ITEMS 5 /* Includes failure point id. */
-#else
-#define NUM_NONREG_ITEMS 4
-#endif
-
-/* We push at most this many items on the stack. */
-#define MAX_FAILURE_ITEMS ((num_regs - 1) * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
-
-/* We actually push this many items. */
-#define NUM_FAILURE_ITEMS \
- ((highest_active_reg - lowest_active_reg + 1) * NUM_REG_ITEMS \
- + NUM_NONREG_ITEMS)
-
-/* How many items can still be added to the stack without overflowing it. */
-#define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail)
-
-
-/* Pops what PUSH_FAIL_STACK pushes.
-
- We restore into the parameters, all of which should be lvalues:
- STR -- the saved data position.
- PAT -- the saved pattern position.
- LOW_REG, HIGH_REG -- the highest and lowest active registers.
- REGSTART, REGEND -- arrays of string positions.
- REG_INFO -- array of information about each subexpression.
-
- Also assumes the variables `fail_stack' and (if debugging), `bufp',
- `pend', `string1', `size1', `string2', and `size2'. */
-
-#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\
-{ \
- DEBUG_STATEMENT (fail_stack_elt_t failure_id;) \
- int this_reg; \
- const unsigned char *string_temp; \
- \
- assert (!FAIL_STACK_EMPTY ()); \
- \
- /* Remove failure points and point to how many regs pushed. */ \
- DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \
- DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \
- DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \
- \
- assert (fail_stack.avail >= NUM_NONREG_ITEMS); \
- \
- DEBUG_POP (&failure_id); \
- DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \
- \
- /* If the saved string location is NULL, it came from an \
- on_failure_keep_string_jump opcode, and we want to throw away the \
- saved NULL, thus retaining our current position in the string. */ \
- string_temp = POP_FAILURE_ITEM (); \
- if (string_temp != NULL) \
- str = (const char *) string_temp; \
- \
- DEBUG_PRINT2 (" Popping string 0x%x: `", str); \
- DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \
- DEBUG_PRINT1 ("'\n"); \
- \
- pat = (unsigned char *) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" Popping pattern 0x%x: ", pat); \
- DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \
- \
- /* Restore register info. */ \
- high_reg = (unsigned) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" Popping high active reg: %d\n", high_reg); \
- \
- low_reg = (unsigned) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \
- \
- for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \
- { \
- DEBUG_PRINT2 (" Popping reg: %d\n", this_reg); \
- \
- reg_info[this_reg].word = POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" info: 0x%x\n", reg_info[this_reg]); \
- \
- regend[this_reg] = (const char *) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \
- \
- regstart[this_reg] = (const char *) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \
- } \
- \
- DEBUG_STATEMENT (nfailure_points_popped++); \
-} /* POP_FAILURE_POINT */
-
-/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in
- BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible
- characters can start a string that matches the pattern. This fastmap
- is used by re_search to skip quickly over impossible starting points.
-
- The caller must supply the address of a (1 << BYTEWIDTH)-byte data
- area as BUFP->fastmap.
-
- We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in
- the pattern buffer.
-
- Returns 0 if we succeed, -2 if an internal error. */
-
-int
-re_compile_fastmap (bufp)
- struct re_pattern_buffer *bufp;
-{
- int j, k;
- fail_stack_type fail_stack;
-#ifndef REGEX_MALLOC
- char *destination;
-#endif
- /* We don't push any register information onto the failure stack. */
- unsigned num_regs = 0;
-
- register char *fastmap = bufp->fastmap;
- unsigned char *pattern = bufp->buffer;
- unsigned long size = bufp->used;
- const unsigned char *p = pattern;
- register unsigned char *pend = pattern + size;
-
- /* Assume that each path through the pattern can be null until
- proven otherwise. We set this false at the bottom of switch
- statement, to which we get only if a particular path doesn't
- match the empty string. */
- boolean path_can_be_null = true;
-
- /* We aren't doing a `succeed_n' to begin with. */
- boolean succeed_n_p = false;
-
- assert (fastmap != NULL && p != NULL);
-
- INIT_FAIL_STACK ();
- bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */
- bufp->fastmap_accurate = 1; /* It will be when we're done. */
- bufp->can_be_null = 0;
-
- while (p != pend || !FAIL_STACK_EMPTY ())
- {
- if (p == pend)
- {
- bufp->can_be_null |= path_can_be_null;
-
- /* Reset for next path. */
- path_can_be_null = true;
-
- p = fail_stack.stack[--fail_stack.avail];
- }
-
- /* We should never be about to go beyond the end of the pattern. */
- assert (p < pend);
-
-#ifdef SWITCH_ENUM_BUG
- switch ((int) ((re_opcode_t) *p++))
-#else
- switch ((re_opcode_t) *p++)
-#endif
- {
-
- /* I guess the idea here is to simply not bother with a fastmap
- if a backreference is used, since it's too hard to figure out
- the fastmap for the corresponding group. Setting
- `can_be_null' stops `re_search_2' from using the fastmap, so
- that is all we do. */
- case duplicate:
- bufp->can_be_null = 1;
- return 0;
-
-
- /* Following are the cases which match a character. These end
- with `break'. */
-
- case exactn:
- fastmap[p[1]] = 1;
- break;
-
-
- case charset:
- for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
- fastmap[j] = 1;
- break;
-
-
- case charset_not:
- /* Chars beyond end of map must be allowed. */
- for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
- fastmap[j] = 1;
-
- for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
- fastmap[j] = 1;
- break;
-
-
- case wordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == Sword)
- fastmap[j] = 1;
- break;
-
-
- case notwordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != Sword)
- fastmap[j] = 1;
- break;
-
-
- case anychar:
- /* `.' matches anything ... */
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- fastmap[j] = 1;
-
- /* ... except perhaps newline. */
- if (!(bufp->syntax & RE_DOT_NEWLINE))
- fastmap['\n'] = 0;
-
- /* Return if we have already set `can_be_null'; if we have,
- then the fastmap is irrelevant. Something's wrong here. */
- else if (bufp->can_be_null)
- return 0;
-
- /* Otherwise, have to check alternative paths. */
- break;
-
-
-#ifdef emacs
- case syntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
-
-
- case notsyntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
-
-
- /* All cases after this match the empty string. These end with
- `continue'. */
-
-
- case before_dot:
- case at_dot:
- case after_dot:
- continue;
-#endif /* not emacs */
-
-
- case no_op:
- case begline:
- case endline:
- case begbuf:
- case endbuf:
- case wordbound:
- case notwordbound:
- case wordbeg:
- case wordend:
- case push_dummy_failure:
- continue;
-
-
- case jump_n:
- case pop_failure_jump:
- case maybe_pop_jump:
- case jump:
- case jump_past_alt:
- case dummy_failure_jump:
- EXTRACT_NUMBER_AND_INCR (j, p);
- p += j;
- if (j > 0)
- continue;
-
- /* Jump backward implies we just went through the body of a
- loop and matched nothing. Opcode jumped to should be
- `on_failure_jump' or `succeed_n'. Just treat it like an
- ordinary jump. For a * loop, it has pushed its failure
- point already; if so, discard that as redundant. */
- if ((re_opcode_t) *p != on_failure_jump
- && (re_opcode_t) *p != succeed_n)
- continue;
-
- p++;
- EXTRACT_NUMBER_AND_INCR (j, p);
- p += j;
-
- /* If what's on the stack is where we are now, pop it. */
- if (!FAIL_STACK_EMPTY ()
- && fail_stack.stack[fail_stack.avail - 1] == p)
- fail_stack.avail--;
-
- continue;
-
-
- case on_failure_jump:
- case on_failure_keep_string_jump:
- handle_on_failure_jump:
- EXTRACT_NUMBER_AND_INCR (j, p);
-
- /* For some patterns, e.g., `(a?)?', `p+j' here points to the
- end of the pattern. We don't want to push such a point,
- since when we restore it above, entering the switch will
- increment `p' past the end of the pattern. We don't need
- to push such a point since we obviously won't find any more
- fastmap entries beyond `pend'. Such a pattern can match
- the null string, though. */
- if (p + j < pend)
- {
- if (!PUSH_PATTERN_OP (p + j, fail_stack))
- return -2;
- }
- else
- bufp->can_be_null = 1;
-
- if (succeed_n_p)
- {
- EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */
- succeed_n_p = false;
- }
-
- continue;
-
-
- case succeed_n:
- /* Get to the number of times to succeed. */
- p += 2;
-
- /* Increment p past the n for when k != 0. */
- EXTRACT_NUMBER_AND_INCR (k, p);
- if (k == 0)
- {
- p -= 4;
- succeed_n_p = true; /* Spaghetti code alert. */
- goto handle_on_failure_jump;
- }
- continue;
-
-
- case set_number_at:
- p += 4;
- continue;
-
-
- case start_memory:
- case stop_memory:
- p += 2;
- continue;
-
-
- default:
- abort (); /* We have listed all the cases. */
- } /* switch *p++ */
-
- /* Getting here means we have found the possible starting
- characters for one path of the pattern -- and that the empty
- string does not match. We need not follow this path further.
- Instead, look at the next alternative (remembered on the
- stack), or quit if no more. The test at the top of the loop
- does these things. */
- path_can_be_null = false;
- p = pend;
- } /* while p */
-
- /* Set `can_be_null' for the last path (also the first path, if the
- pattern is empty). */
- bufp->can_be_null |= path_can_be_null;
- return 0;
-} /* re_compile_fastmap */
-
-/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
- ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use
- this memory for recording register information. STARTS and ENDS
- must be allocated using the malloc library routine, and must each
- be at least NUM_REGS * sizeof (regoff_t) bytes long.
-
- If NUM_REGS == 0, then subsequent matches should allocate their own
- register data.
-
- Unless this function is called, the first search or match using
- PATTERN_BUFFER will allocate its own register data, without
- freeing the old data. */
-
-void
-re_set_registers (bufp, regs, num_regs, starts, ends)
- struct re_pattern_buffer *bufp;
- struct re_registers *regs;
- unsigned num_regs;
- regoff_t *starts, *ends;
-{
- if (num_regs)
- {
- bufp->regs_allocated = REGS_REALLOCATE;
- regs->num_regs = num_regs;
- regs->start = starts;
- regs->end = ends;
- }
- else
- {
- bufp->regs_allocated = REGS_UNALLOCATED;
- regs->num_regs = 0;
- regs->start = regs->end = (regoff_t) 0;
- }
-}
-
-/* Searching routines. */
-
-/* Like re_search_2, below, but only one string is specified, and
- doesn't let you say where to stop matching. */
-
-int
-re_search (bufp, string, size, startpos, range, regs)
- struct re_pattern_buffer *bufp;
- const char *string;
- int size, startpos, range;
- struct re_registers *regs;
-{
- return re_search_2 (bufp, NULL, 0, string, size, startpos, range,
- regs, size);
-}
-
-
-/* Using the compiled pattern in BUFP->buffer, first tries to match the
- virtual concatenation of STRING1 and STRING2, starting first at index
- STARTPOS, then at STARTPOS + 1, and so on.
-
- STRING1 and STRING2 have length SIZE1 and SIZE2, respectively.
-
- RANGE is how far to scan while trying to match. RANGE = 0 means try
- only at STARTPOS; in general, the last start tried is STARTPOS +
- RANGE.
-
- In REGS, return the indices of the virtual concatenation of STRING1
- and STRING2 that matched the entire BUFP->buffer and its contained
- subexpressions.
-
- Do not consider matching one past the index STOP in the virtual
- concatenation of STRING1 and STRING2.
-
- We return either the position in the strings at which the match was
- found, -1 if no match, or -2 if error (such as failure
- stack overflow). */
-
-int
-re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
- struct re_pattern_buffer *bufp;
- const char *string1, *string2;
- int size1, size2;
- int startpos;
- int range;
- struct re_registers *regs;
- int stop;
-{
- int val;
- register char *fastmap = bufp->fastmap;
- register char *translate = bufp->translate;
- int total_size = size1 + size2;
- int endpos = startpos + range;
-
- /* Check for out-of-range STARTPOS. */
- if (startpos < 0 || startpos > total_size)
- return -1;
-
- /* Fix up RANGE if it might eventually take us outside
- the virtual concatenation of STRING1 and STRING2. */
- if (endpos < -1)
- range = -1 - startpos;
- else if (endpos > total_size)
- range = total_size - startpos;
-
- /* If the search isn't to be a backwards one, don't waste time in a
- search for a pattern that must be anchored. */
- if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == begbuf && range > 0)
- {
- if (startpos > 0)
- return -1;
- else
- range = 1;
- }
-
- /* Update the fastmap now if not correct already. */
- if (fastmap && !bufp->fastmap_accurate)
- if (re_compile_fastmap (bufp) == -2)
- return -2;
-
- /* Loop through the string, looking for a place to start matching. */
- for (;;)
- {
- /* If a fastmap is supplied, skip quickly over characters that
- cannot be the start of a match. If the pattern can match the
- null string, however, we don't need to skip characters; we want
- the first null string. */
- if (fastmap && startpos < total_size && !bufp->can_be_null)
- {
- if (range > 0) /* Searching forwards. */
- {
- register const char *d;
- register int lim = 0;
- int irange = range;
-
- if (startpos < size1 && startpos + range >= size1)
- lim = range - (size1 - startpos);
-
- d = (startpos >= size1 ? string2 - size1 : string1) + startpos;
-
- /* Written out as an if-else to avoid testing `translate'
- inside the loop. */
- if (translate)
- while (range > lim
- && !fastmap[(unsigned char)
- translate[(unsigned char) *d++]])
- range--;
- else
- while (range > lim && !fastmap[(unsigned char) *d++])
- range--;
-
- startpos += irange - range;
- }
- else /* Searching backwards. */
- {
- register char c = (size1 == 0 || startpos >= size1
- ? string2[startpos - size1]
- : string1[startpos]);
-
- if (!fastmap[(unsigned char) TRANSLATE (c)])
- goto advance;
- }
- }
-
- /* If can't match the null string, and that's all we have left, fail. */
- if (range >= 0 && startpos == total_size && fastmap
- && !bufp->can_be_null)
- return -1;
-
- val = re_match_2 (bufp, string1, size1, string2, size2,
- startpos, regs, stop);
- if (val >= 0)
- return startpos;
-
- if (val == -2)
- return -2;
-
- advance:
- if (!range)
- break;
- else if (range > 0)
- {
- range--;
- startpos++;
- }
- else
- {
- range++;
- startpos--;
- }
- }
- return -1;
-} /* re_search_2 */
-
-/* Declarations and macros for re_match_2. */
-
-static int bcmp_translate ();
-static boolean alt_match_null_string_p (),
- common_op_match_null_string_p (),
- group_match_null_string_p ();
-
-/* Structure for per-register (a.k.a. per-group) information.
- This must not be longer than one word, because we push this value
- onto the failure stack. Other register information, such as the
- starting and ending positions (which are addresses), and the list of
- inner groups (which is a bits list) are maintained in separate
- variables.
-
- We are making a (strictly speaking) nonportable assumption here: that
- the compiler will pack our bit fields into something that fits into
- the type of `word', i.e., is something that fits into one item on the
- failure stack. */
-typedef union
-{
- fail_stack_elt_t word;
- struct
- {
- /* This field is one if this group can match the empty string,
- zero if not. If not yet determined, `MATCH_NULL_UNSET_VALUE'. */
-#define MATCH_NULL_UNSET_VALUE 3
- unsigned match_null_string_p : 2;
- unsigned is_active : 1;
- unsigned matched_something : 1;
- unsigned ever_matched_something : 1;
- } bits;
-} register_info_type;
-
-#define REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p)
-#define IS_ACTIVE(R) ((R).bits.is_active)
-#define MATCHED_SOMETHING(R) ((R).bits.matched_something)
-#define EVER_MATCHED_SOMETHING(R) ((R).bits.ever_matched_something)
-
-
-/* Call this when have matched a real character; it sets `matched' flags
- for the subexpressions which we are currently inside. Also records
- that those subexprs have matched. */
-#define SET_REGS_MATCHED() \
- do \
- { \
- unsigned r; \
- for (r = lowest_active_reg; r <= highest_active_reg; r++) \
- { \
- MATCHED_SOMETHING (reg_info[r]) \
- = EVER_MATCHED_SOMETHING (reg_info[r]) \
- = 1; \
- } \
- } \
- while (0)
-
-
-/* This converts PTR, a pointer into one of the search strings `string1'
- and `string2' into an offset from the beginning of that string. */
-#define POINTER_TO_OFFSET(ptr) \
- (FIRST_STRING_P (ptr) ? (ptr) - string1 : (ptr) - string2 + size1)
-
-/* Registers are set to a sentinel when they haven't yet matched. */
-#define REG_UNSET_VALUE ((char *) -1)
-#define REG_UNSET(e) ((e) == REG_UNSET_VALUE)
-
-
-/* Macros for dealing with the split strings in re_match_2. */
-
-#define MATCHING_IN_FIRST_STRING (dend == end_match_1)
-
-/* Call before fetching a character with *d. This switches over to
- string2 if necessary. */
-#define PREFETCH() \
- while (d == dend) \
- { \
- /* End of string2 => fail. */ \
- if (dend == end_match_2) \
- goto fail; \
- /* End of string1 => advance to string2. */ \
- d = string2; \
- dend = end_match_2; \
- }
-
-
-/* Test if at very beginning or at very end of the virtual concatenation
- of `string1' and `string2'. If only one string, it's `string2'. */
-#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2)
-#define AT_STRINGS_END(d) ((d) == end2)
-
-
-/* Test if D points to a character which is word-constituent. We have
- two special cases to check for: if past the end of string1, look at
- the first character in string2; and if before the beginning of
- string2, look at the last character in string1. */
-#define WORDCHAR_P(d) \
- (SYNTAX ((d) == end1 ? *string2 \
- : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \
- == Sword)
-
-/* Test if the character before D and the one at D differ with respect
- to being word-constituent. */
-#define AT_WORD_BOUNDARY(d) \
- (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \
- || WORDCHAR_P (d - 1) != WORDCHAR_P (d))
-
-
-/* Free everything we malloc. */
-#ifdef REGEX_MALLOC
-#define FREE_VAR(var) if (var) free (var); var = NULL
-#define FREE_VARIABLES() \
- do { \
- FREE_VAR (fail_stack.stack); \
- FREE_VAR (regstart); \
- FREE_VAR (regend); \
- FREE_VAR (old_regstart); \
- FREE_VAR (old_regend); \
- FREE_VAR (best_regstart); \
- FREE_VAR (best_regend); \
- FREE_VAR (reg_info); \
- FREE_VAR (reg_dummy); \
- FREE_VAR (reg_info_dummy); \
- } while (0)
-#else /* not REGEX_MALLOC */
-/* Some MIPS systems (at least) want this to free alloca'd storage. */
-#define FREE_VARIABLES() alloca (0)
-#endif /* not REGEX_MALLOC */
-
-
-/* These values must meet several constraints. They must not be valid
- register values; since we have a limit of 255 registers (because
- we use only one byte in the pattern for the register number), we can
- use numbers larger than 255. They must differ by 1, because of
- NUM_FAILURE_ITEMS above. And the value for the lowest register must
- be larger than the value for the highest register, so we do not try
- to actually save any registers when none are active. */
-#define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH)
-#define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1)
-
-/* Matching routines. */
-
-#ifndef emacs /* Emacs never uses this. */
-/* re_match is like re_match_2 except it takes only a single string. */
-
-int
-re_match (bufp, string, size, pos, regs)
- struct re_pattern_buffer *bufp;
- const char *string;
- int size, pos;
- struct re_registers *regs;
- {
- return re_match_2 (bufp, NULL, 0, string, size, pos, regs, size);
-}
-#endif /* not emacs */
-
-
-/* re_match_2 matches the compiled pattern in BUFP against the
- the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1
- and SIZE2, respectively). We start matching at POS, and stop
- matching at STOP.
-
- If REGS is non-null and the `no_sub' field of BUFP is nonzero, we
- store offsets for the substring each group matched in REGS. See the
- documentation for exactly how many groups we fill.
-
- We return -1 if no match, -2 if an internal error (such as the
- failure stack overflowing). Otherwise, we return the length of the
- matched substring. */
-
-int
-re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
- struct re_pattern_buffer *bufp;
- const char *string1, *string2;
- int size1, size2;
- int pos;
- struct re_registers *regs;
- int stop;
-{
- /* General temporaries. */
- int mcnt;
- unsigned char *p1;
-
- /* Just past the end of the corresponding string. */
- const char *end1, *end2;
-
- /* Pointers into string1 and string2, just past the last characters in
- each to consider matching. */
- const char *end_match_1, *end_match_2;
-
- /* Where we are in the data, and the end of the current string. */
- const char *d, *dend;
-
- /* Where we are in the pattern, and the end of the pattern. */
- unsigned char *p = bufp->buffer;
- register unsigned char *pend = p + bufp->used;
-
- /* We use this to map every character in the string. */
- char *translate = bufp->translate;
-
- /* Failure point stack. Each place that can handle a failure further
- down the line pushes a failure point on this stack. It consists of
- restart, regend, and reg_info for all registers corresponding to
- the subexpressions we're currently inside, plus the number of such
- registers, and, finally, two char *'s. The first char * is where
- to resume scanning the pattern; the second one is where to resume
- scanning the strings. If the latter is zero, the failure point is
- a ``dummy''; if a failure happens and the failure point is a dummy,
- it gets discarded and the next next one is tried. */
- fail_stack_type fail_stack;
-#ifdef DEBUG
- static unsigned failure_id = 0;
- unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0;
-#endif
-
- /* We fill all the registers internally, independent of what we
- return, for use in backreferences. The number here includes
- an element for register zero. */
- unsigned num_regs = bufp->re_nsub + 1;
-
- /* The currently active registers. */
- unsigned lowest_active_reg = NO_LOWEST_ACTIVE_REG;
- unsigned highest_active_reg = NO_HIGHEST_ACTIVE_REG;
-
- /* Information on the contents of registers. These are pointers into
- the input strings; they record just what was matched (on this
- attempt) by a subexpression part of the pattern, that is, the
- regnum-th regstart pointer points to where in the pattern we began
- matching and the regnum-th regend points to right after where we
- stopped matching the regnum-th subexpression. (The zeroth register
- keeps track of what the whole pattern matches.) */
- const char **regstart, **regend;
-
- /* If a group that's operated upon by a repetition operator fails to
- match anything, then the register for its start will need to be
- restored because it will have been set to wherever in the string we
- are when we last see its open-group operator. Similarly for a
- register's end. */
- const char **old_regstart, **old_regend;
-
- /* The is_active field of reg_info helps us keep track of which (possibly
- nested) subexpressions we are currently in. The matched_something
- field of reg_info[reg_num] helps us tell whether or not we have
- matched any of the pattern so far this time through the reg_num-th
- subexpression. These two fields get reset each time through any
- loop their register is in. */
- register_info_type *reg_info;
-
- /* The following record the register info as found in the above
- variables when we find a match better than any we've seen before.
- This happens as we backtrack through the failure points, which in
- turn happens only if we have not yet matched the entire string. */
- unsigned best_regs_set = false;
- const char **best_regstart, **best_regend;
-
- /* Logically, this is `best_regend[0]'. But we don't want to have to
- allocate space for that if we're not allocating space for anything
- else (see below). Also, we never need info about register 0 for
- any of the other register vectors, and it seems rather a kludge to
- treat `best_regend' differently than the rest. So we keep track of
- the end of the best match so far in a separate variable. We
- initialize this to NULL so that when we backtrack the first time
- and need to test it, it's not garbage. */
- const char *match_end = NULL;
-
- /* Used when we pop values we don't care about. */
- const char **reg_dummy;
- register_info_type *reg_info_dummy;
-
-#ifdef DEBUG
- /* Counts the total number of registers pushed. */
- unsigned num_regs_pushed = 0;
-#endif
-
- DEBUG_PRINT1 ("\n\nEntering re_match_2.\n");
-
- INIT_FAIL_STACK ();
-
- /* Do not bother to initialize all the register variables if there are
- no groups in the pattern, as it takes a fair amount of time. If
- there are groups, we include space for register 0 (the whole
- pattern), even though we never use it, since it simplifies the
- array indexing. We should fix this. */
- if (bufp->re_nsub)
- {
- regstart = REGEX_TALLOC (num_regs, const char *);
- regend = REGEX_TALLOC (num_regs, const char *);
- old_regstart = REGEX_TALLOC (num_regs, const char *);
- old_regend = REGEX_TALLOC (num_regs, const char *);
- best_regstart = REGEX_TALLOC (num_regs, const char *);
- best_regend = REGEX_TALLOC (num_regs, const char *);
- reg_info = REGEX_TALLOC (num_regs, register_info_type);
- reg_dummy = REGEX_TALLOC (num_regs, const char *);
- reg_info_dummy = REGEX_TALLOC (num_regs, register_info_type);
-
- if (!(regstart && regend && old_regstart && old_regend && reg_info
- && best_regstart && best_regend && reg_dummy && reg_info_dummy))
- {
- FREE_VARIABLES ();
- return -2;
- }
- }
-#ifdef REGEX_MALLOC
- else
- {
- /* We must initialize all our variables to NULL, so that
- `FREE_VARIABLES' doesn't try to free them. */
- regstart = regend = old_regstart = old_regend = best_regstart
- = best_regend = reg_dummy = NULL;
- reg_info = reg_info_dummy = (register_info_type *) NULL;
- }
-#endif /* REGEX_MALLOC */
-
- /* The starting position is bogus. */
- if (pos < 0 || pos > size1 + size2)
- {
- FREE_VARIABLES ();
- return -1;
- }
-
- /* Initialize subexpression text positions to -1 to mark ones that no
- start_memory/stop_memory has been seen for. Also initialize the
- register information struct. */
- for (mcnt = 1; mcnt < num_regs; mcnt++)
- {
- regstart[mcnt] = regend[mcnt]
- = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE;
-
- REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE;
- IS_ACTIVE (reg_info[mcnt]) = 0;
- MATCHED_SOMETHING (reg_info[mcnt]) = 0;
- EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0;
- }
-
- /* We move `string1' into `string2' if the latter's empty -- but not if
- `string1' is null. */
- if (size2 == 0 && string1 != NULL)
- {
- string2 = string1;
- size2 = size1;
- string1 = 0;
- size1 = 0;
- }
- end1 = string1 + size1;
- end2 = string2 + size2;
-
- /* Compute where to stop matching, within the two strings. */
- if (stop <= size1)
- {
- end_match_1 = string1 + stop;
- end_match_2 = string2;
- }
- else
- {
- end_match_1 = end1;
- end_match_2 = string2 + stop - size1;
- }
-
- /* `p' scans through the pattern as `d' scans through the data.
- `dend' is the end of the input string that `d' points within. `d'
- is advanced into the following input string whenever necessary, but
- this happens before fetching; therefore, at the beginning of the
- loop, `d' can be pointing at the end of a string, but it cannot
- equal `string2'. */
- if (size1 > 0 && pos <= size1)
- {
- d = string1 + pos;
- dend = end_match_1;
- }
- else
- {
- d = string2 + pos - size1;
- dend = end_match_2;
- }
-
- DEBUG_PRINT1 ("The compiled pattern is: ");
- DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend);
- DEBUG_PRINT1 ("The string to match is: `");
- DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2);
- DEBUG_PRINT1 ("'\n");
-
- /* This loops over pattern commands. It exits by returning from the
- function if the match is complete, or it drops through if the match
- fails at this starting point in the input data. */
- for (;;)
- {
- DEBUG_PRINT2 ("\n0x%x: ", p);
-
- if (p == pend)
- { /* End of pattern means we might have succeeded. */
- DEBUG_PRINT1 ("end of pattern ... ");
-
- /* If we haven't matched the entire string, and we want the
- longest match, try backtracking. */
- if (d != end_match_2)
- {
- DEBUG_PRINT1 ("backtracking.\n");
-
- if (!FAIL_STACK_EMPTY ())
- { /* More failure points to try. */
- boolean same_str_p = (FIRST_STRING_P (match_end)
- == MATCHING_IN_FIRST_STRING);
-
- /* If exceeds best match so far, save it. */
- if (!best_regs_set
- || (same_str_p && d > match_end)
- || (!same_str_p && !MATCHING_IN_FIRST_STRING))
- {
- best_regs_set = true;
- match_end = d;
-
- DEBUG_PRINT1 ("\nSAVING match as best so far.\n");
-
- for (mcnt = 1; mcnt < num_regs; mcnt++)
- {
- best_regstart[mcnt] = regstart[mcnt];
- best_regend[mcnt] = regend[mcnt];
- }
- }
- goto fail;
- }
-
- /* If no failure points, don't restore garbage. */
- else if (best_regs_set)
- {
- restore_best_regs:
- /* Restore best match. It may happen that `dend ==
- end_match_1' while the restored d is in string2.
- For example, the pattern `x.*y.*z' against the
- strings `x-' and `y-z-', if the two strings are
- not consecutive in memory. */
- DEBUG_PRINT1 ("Restoring best registers.\n");
-
- d = match_end;
- dend = ((d >= string1 && d <= end1)
- ? end_match_1 : end_match_2);
-
- for (mcnt = 1; mcnt < num_regs; mcnt++)
- {
- regstart[mcnt] = best_regstart[mcnt];
- regend[mcnt] = best_regend[mcnt];
- }
- }
- } /* d != end_match_2 */
-
- DEBUG_PRINT1 ("Accepting match.\n");
-
- /* If caller wants register contents data back, do it. */
- if (regs && !bufp->no_sub)
- {
- /* Have the register data arrays been allocated? */
- if (bufp->regs_allocated == REGS_UNALLOCATED)
- { /* No. So allocate them with malloc. We need one
- extra element beyond `num_regs' for the `-1' marker
- GNU code uses. */
- regs->num_regs = MAX (RE_NREGS, num_regs + 1);
- regs->start = TALLOC (regs->num_regs, regoff_t);
- regs->end = TALLOC (regs->num_regs, regoff_t);
- if (regs->start == NULL || regs->end == NULL)
- return -2;
- bufp->regs_allocated = REGS_REALLOCATE;
- }
- else if (bufp->regs_allocated == REGS_REALLOCATE)
- { /* Yes. If we need more elements than were already
- allocated, reallocate them. If we need fewer, just
- leave it alone. */
- if (regs->num_regs < num_regs + 1)
- {
- regs->num_regs = num_regs + 1;
- RETALLOC (regs->start, regs->num_regs, regoff_t);
- RETALLOC (regs->end, regs->num_regs, regoff_t);
- if (regs->start == NULL || regs->end == NULL)
- return -2;
- }
- }
- else
- {
- /* These braces fend off a "empty body in an else-statement"
- warning under GCC when assert expands to nothing. */
- assert (bufp->regs_allocated == REGS_FIXED);
- }
-
- /* Convert the pointer data in `regstart' and `regend' to
- indices. Register zero has to be set differently,
- since we haven't kept track of any info for it. */
- if (regs->num_regs > 0)
- {
- regs->start[0] = pos;
- regs->end[0] = (MATCHING_IN_FIRST_STRING ? d - string1
- : d - string2 + size1);
- }
-
- /* Go through the first `min (num_regs, regs->num_regs)'
- registers, since that is all we initialized. */
- for (mcnt = 1; mcnt < MIN (num_regs, regs->num_regs); mcnt++)
- {
- if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt]))
- regs->start[mcnt] = regs->end[mcnt] = -1;
- else
- {
- regs->start[mcnt] = POINTER_TO_OFFSET (regstart[mcnt]);
- regs->end[mcnt] = POINTER_TO_OFFSET (regend[mcnt]);
- }
- }
-
- /* If the regs structure we return has more elements than
- were in the pattern, set the extra elements to -1. If
- we (re)allocated the registers, this is the case,
- because we always allocate enough to have at least one
- -1 at the end. */
- for (mcnt = num_regs; mcnt < regs->num_regs; mcnt++)
- regs->start[mcnt] = regs->end[mcnt] = -1;
- } /* regs && !bufp->no_sub */
-
- FREE_VARIABLES ();
- DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n",
- nfailure_points_pushed, nfailure_points_popped,
- nfailure_points_pushed - nfailure_points_popped);
- DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed);
-
- mcnt = d - pos - (MATCHING_IN_FIRST_STRING
- ? string1
- : string2 - size1);
-
- DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt);
-
- return mcnt;
- }
-
- /* Otherwise match next pattern command. */
-#ifdef SWITCH_ENUM_BUG
- switch ((int) ((re_opcode_t) *p++))
-#else
- switch ((re_opcode_t) *p++)
-#endif
- {
- /* Ignore these. Used to ignore the n of succeed_n's which
- currently have n == 0. */
- case no_op:
- DEBUG_PRINT1 ("EXECUTING no_op.\n");
- break;
-
-
- /* Match the next n pattern characters exactly. The following
- byte in the pattern defines n, and the n bytes after that
- are the characters to match. */
- case exactn:
- mcnt = *p++;
- DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt);
-
- /* This is written out as an if-else so we don't waste time
- testing `translate' inside the loop. */
- if (translate)
- {
- do
- {
- PREFETCH ();
- if (translate[(unsigned char) *d++] != (char) *p++)
- goto fail;
- }
- while (--mcnt);
- }
- else
- {
- do
- {
- PREFETCH ();
- if (*d++ != (char) *p++) goto fail;
- }
- while (--mcnt);
- }
- SET_REGS_MATCHED ();
- break;
-
-
- /* Match any character except possibly a newline or a null. */
- case anychar:
- DEBUG_PRINT1 ("EXECUTING anychar.\n");
-
- PREFETCH ();
-
- if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n')
- || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000'))
- goto fail;
-
- SET_REGS_MATCHED ();
- DEBUG_PRINT2 (" Matched `%d'.\n", *d);
- d++;
- break;
-
-
- case charset:
- case charset_not:
- {
- register unsigned char c;
- boolean not = (re_opcode_t) *(p - 1) == charset_not;
-
- DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : "");
-
- PREFETCH ();
- c = TRANSLATE (*d); /* The character to match. */
-
- /* Cast to `unsigned' instead of `unsigned char' in case the
- bit list is a full 32 bytes long. */
- if (c < (unsigned) (*p * BYTEWIDTH)
- && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
-
- p += 1 + *p;
-
- if (!not) goto fail;
-
- SET_REGS_MATCHED ();
- d++;
- break;
- }
-
-
- /* The beginning of a group is represented by start_memory.
- The arguments are the register number in the next byte, and the
- number of groups inner to this one in the next. The text
- matched within the group is recorded (in the internal
- registers data structure) under the register number. */
- case start_memory:
- DEBUG_PRINT3 ("EXECUTING start_memory %d (%d):\n", *p, p[1]);
-
- /* Find out if this group can match the empty string. */
- p1 = p; /* To send to group_match_null_string_p. */
-
- if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE)
- REG_MATCH_NULL_STRING_P (reg_info[*p])
- = group_match_null_string_p (&p1, pend, reg_info);
-
- /* Save the position in the string where we were the last time
- we were at this open-group operator in case the group is
- operated upon by a repetition operator, e.g., with `(a*)*b'
- against `ab'; then we want to ignore where we are now in
- the string in case this attempt to match fails. */
- old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
- ? REG_UNSET (regstart[*p]) ? d : regstart[*p]
- : regstart[*p];
- DEBUG_PRINT2 (" old_regstart: %d\n",
- POINTER_TO_OFFSET (old_regstart[*p]));
-
- regstart[*p] = d;
- DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p]));
-
- IS_ACTIVE (reg_info[*p]) = 1;
- MATCHED_SOMETHING (reg_info[*p]) = 0;
-
- /* This is the new highest active register. */
- highest_active_reg = *p;
-
- /* If nothing was active before, this is the new lowest active
- register. */
- if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
- lowest_active_reg = *p;
-
- /* Move past the register number and inner group count. */
- p += 2;
- break;
-
-
- /* The stop_memory opcode represents the end of a group. Its
- arguments are the same as start_memory's: the register
- number, and the number of inner groups. */
- case stop_memory:
- DEBUG_PRINT3 ("EXECUTING stop_memory %d (%d):\n", *p, p[1]);
-
- /* We need to save the string position the last time we were at
- this close-group operator in case the group is operated
- upon by a repetition operator, e.g., with `((a*)*(b*)*)*'
- against `aba'; then we want to ignore where we are now in
- the string in case this attempt to match fails. */
- old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
- ? REG_UNSET (regend[*p]) ? d : regend[*p]
- : regend[*p];
- DEBUG_PRINT2 (" old_regend: %d\n",
- POINTER_TO_OFFSET (old_regend[*p]));
-
- regend[*p] = d;
- DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p]));
-
- /* This register isn't active anymore. */
- IS_ACTIVE (reg_info[*p]) = 0;
-
- /* If this was the only register active, nothing is active
- anymore. */
- if (lowest_active_reg == highest_active_reg)
- {
- lowest_active_reg = NO_LOWEST_ACTIVE_REG;
- highest_active_reg = NO_HIGHEST_ACTIVE_REG;
- }
- else
- { /* We must scan for the new highest active register, since
- it isn't necessarily one less than now: consider
- (a(b)c(d(e)f)g). When group 3 ends, after the f), the
- new highest active register is 1. */
- unsigned char r = *p - 1;
- while (r > 0 && !IS_ACTIVE (reg_info[r]))
- r--;
-
- /* If we end up at register zero, that means that we saved
- the registers as the result of an `on_failure_jump', not
- a `start_memory', and we jumped to past the innermost
- `stop_memory'. For example, in ((.)*) we save
- registers 1 and 2 as a result of the *, but when we pop
- back to the second ), we are at the stop_memory 1.
- Thus, nothing is active. */
- if (r == 0)
- {
- lowest_active_reg = NO_LOWEST_ACTIVE_REG;
- highest_active_reg = NO_HIGHEST_ACTIVE_REG;
- }
- else
- highest_active_reg = r;
- }
-
- /* If just failed to match something this time around with a
- group that's operated on by a repetition operator, try to
- force exit from the ``loop'', and restore the register
- information for this group that we had before trying this
- last match. */
- if ((!MATCHED_SOMETHING (reg_info[*p])
- || (re_opcode_t) p[-3] == start_memory)
- && (p + 2) < pend)
- {
- boolean is_a_jump_n = false;
-
- p1 = p + 2;
- mcnt = 0;
- switch ((re_opcode_t) *p1++)
- {
- case jump_n:
- is_a_jump_n = true;
- case pop_failure_jump:
- case maybe_pop_jump:
- case jump:
- case dummy_failure_jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- if (is_a_jump_n)
- p1 += 2;
- break;
-
- default:
- /* do nothing */ ;
- }
- p1 += mcnt;
-
- /* If the next operation is a jump backwards in the pattern
- to an on_failure_jump right before the start_memory
- corresponding to this stop_memory, exit from the loop
- by forcing a failure after pushing on the stack the
- on_failure_jump's jump in the pattern, and d. */
- if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump
- && (re_opcode_t) p1[3] == start_memory && p1[4] == *p)
- {
- /* If this group ever matched anything, then restore
- what its registers were before trying this last
- failed match, e.g., with `(a*)*b' against `ab' for
- regstart[1], and, e.g., with `((a*)*(b*)*)*'
- against `aba' for regend[3].
-
- Also restore the registers for inner groups for,
- e.g., `((a*)(b*))*' against `aba' (register 3 would
- otherwise get trashed). */
-
- if (EVER_MATCHED_SOMETHING (reg_info[*p]))
- {
- unsigned r;
-
- EVER_MATCHED_SOMETHING (reg_info[*p]) = 0;
-
- /* Restore this and inner groups' (if any) registers. */
- for (r = *p; r < *p + *(p + 1); r++)
- {
- regstart[r] = old_regstart[r];
-
- /* xx why this test? */
- if ((int) old_regend[r] >= (int) regstart[r])
- regend[r] = old_regend[r];
- }
- }
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- PUSH_FAILURE_POINT (p1 + mcnt, d, -2);
-
- goto fail;
- }
- }
-
- /* Move past the register number and the inner group count. */
- p += 2;
- break;
-
-
- /* \<digit> has been turned into a `duplicate' command which is
- followed by the numeric value of <digit> as the register number. */
- case duplicate:
- {
- register const char *d2, *dend2;
- int regno = *p++; /* Get which register to match against. */
- DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno);
-
- /* Can't back reference a group which we've never matched. */
- if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno]))
- goto fail;
-
- /* Where in input to try to start matching. */
- d2 = regstart[regno];
-
- /* Where to stop matching; if both the place to start and
- the place to stop matching are in the same string, then
- set to the place to stop, otherwise, for now have to use
- the end of the first string. */
-
- dend2 = ((FIRST_STRING_P (regstart[regno])
- == FIRST_STRING_P (regend[regno]))
- ? regend[regno] : end_match_1);
- for (;;)
- {
- /* If necessary, advance to next segment in register
- contents. */
- while (d2 == dend2)
- {
- if (dend2 == end_match_2) break;
- if (dend2 == regend[regno]) break;
-
- /* End of string1 => advance to string2. */
- d2 = string2;
- dend2 = regend[regno];
- }
- /* At end of register contents => success */
- if (d2 == dend2) break;
-
- /* If necessary, advance to next segment in data. */
- PREFETCH ();
-
- /* How many characters left in this segment to match. */
- mcnt = dend - d;
-
- /* Want how many consecutive characters we can match in
- one shot, so, if necessary, adjust the count. */
- if (mcnt > dend2 - d2)
- mcnt = dend2 - d2;
-
- /* Compare that many; failure if mismatch, else move
- past them. */
- if (translate
- ? bcmp_translate (d, d2, mcnt, translate)
- : bcmp (d, d2, mcnt))
- goto fail;
- d += mcnt, d2 += mcnt;
- }
- }
- break;
-
-
- /* begline matches the empty string at the beginning of the string
- (unless `not_bol' is set in `bufp'), and, if
- `newline_anchor' is set, after newlines. */
- case begline:
- DEBUG_PRINT1 ("EXECUTING begline.\n");
-
- if (AT_STRINGS_BEG (d))
- {
- if (!bufp->not_bol) break;
- }
- else if (d[-1] == '\n' && bufp->newline_anchor)
- {
- break;
- }
- /* In all other cases, we fail. */
- goto fail;
-
-
- /* endline is the dual of begline. */
- case endline:
- DEBUG_PRINT1 ("EXECUTING endline.\n");
-
- if (AT_STRINGS_END (d))
- {
- if (!bufp->not_eol) break;
- }
-
- /* We have to ``prefetch'' the next character. */
- else if ((d == end1 ? *string2 : *d) == '\n'
- && bufp->newline_anchor)
- {
- break;
- }
- goto fail;
-
-
- /* Match at the very beginning of the data. */
- case begbuf:
- DEBUG_PRINT1 ("EXECUTING begbuf.\n");
- if (AT_STRINGS_BEG (d))
- break;
- goto fail;
-
-
- /* Match at the very end of the data. */
- case endbuf:
- DEBUG_PRINT1 ("EXECUTING endbuf.\n");
- if (AT_STRINGS_END (d))
- break;
- goto fail;
-
-
- /* on_failure_keep_string_jump is used to optimize `.*\n'. It
- pushes NULL as the value for the string on the stack. Then
- `pop_failure_point' will keep the current value for the
- string, instead of restoring it. To see why, consider
- matching `foo\nbar' against `.*\n'. The .* matches the foo;
- then the . fails against the \n. But the next thing we want
- to do is match the \n against the \n; if we restored the
- string value, we would be back at the foo.
-
- Because this is used only in specific cases, we don't need to
- check all the things that `on_failure_jump' does, to make
- sure the right things get saved on the stack. Hence we don't
- share its code. The only reason to push anything on the
- stack at all is that otherwise we would have to change
- `anychar's code to do something besides goto fail in this
- case; that seems worse than this. */
- case on_failure_keep_string_jump:
- DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump");
-
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt);
-
- PUSH_FAILURE_POINT (p + mcnt, NULL, -2);
- break;
-
-
- /* Uses of on_failure_jump:
-
- Each alternative starts with an on_failure_jump that points
- to the beginning of the next alternative. Each alternative
- except the last ends with a jump that in effect jumps past
- the rest of the alternatives. (They really jump to the
- ending jump of the following alternative, because tensioning
- these jumps is a hassle.)
-
- Repeats start with an on_failure_jump that points past both
- the repetition text and either the following jump or
- pop_failure_jump back to this on_failure_jump. */
- case on_failure_jump:
- on_failure:
- DEBUG_PRINT1 ("EXECUTING on_failure_jump");
-
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt);
-
- /* If this on_failure_jump comes right before a group (i.e.,
- the original * applied to a group), save the information
- for that group and all inner ones, so that if we fail back
- to this point, the group's information will be correct.
- For example, in \(a*\)*\1, we need the preceding group,
- and in \(\(a*\)b*\)\2, we need the inner group. */
-
- /* We can't use `p' to check ahead because we push
- a failure point to `p + mcnt' after we do this. */
- p1 = p;
-
- /* We need to skip no_op's before we look for the
- start_memory in case this on_failure_jump is happening as
- the result of a completed succeed_n, as in \(a\)\{1,3\}b\1
- against aba. */
- while (p1 < pend && (re_opcode_t) *p1 == no_op)
- p1++;
-
- if (p1 < pend && (re_opcode_t) *p1 == start_memory)
- {
- /* We have a new highest active register now. This will
- get reset at the start_memory we are about to get to,
- but we will have saved all the registers relevant to
- this repetition op, as described above. */
- highest_active_reg = *(p1 + 1) + *(p1 + 2);
- if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
- lowest_active_reg = *(p1 + 1);
- }
-
- DEBUG_PRINT1 (":\n");
- PUSH_FAILURE_POINT (p + mcnt, d, -2);
- break;
-
-
- /* A smart repeat ends with `maybe_pop_jump'.
- We change it to either `pop_failure_jump' or `jump'. */
- case maybe_pop_jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt);
- {
- register unsigned char *p2 = p;
-
- /* Compare the beginning of the repeat with what in the
- pattern follows its end. If we can establish that there
- is nothing that they would both match, i.e., that we
- would have to backtrack because of (as in, e.g., `a*a')
- then we can change to pop_failure_jump, because we'll
- never have to backtrack.
-
- This is not true in the case of alternatives: in
- `(a|ab)*' we do need to backtrack to the `ab' alternative
- (e.g., if the string was `ab'). But instead of trying to
- detect that here, the alternative has put on a dummy
- failure point which is what we will end up popping. */
-
- /* Skip over open/close-group commands. */
- while (p2 + 2 < pend
- && ((re_opcode_t) *p2 == stop_memory
- || (re_opcode_t) *p2 == start_memory))
- p2 += 3; /* Skip over args, too. */
-
- /* If we're at the end of the pattern, we can change. */
- if (p2 == pend)
- {
- /* Consider what happens when matching ":\(.*\)"
- against ":/". I don't really understand this code
- yet. */
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT1
- (" End of pattern: change to `pop_failure_jump'.\n");
- }
-
- else if ((re_opcode_t) *p2 == exactn
- || (bufp->newline_anchor && (re_opcode_t) *p2 == endline))
- {
- register unsigned char c
- = *p2 == (unsigned char) endline ? '\n' : p2[2];
- p1 = p + mcnt;
-
- /* p1[0] ... p1[2] are the `on_failure_jump' corresponding
- to the `maybe_finalize_jump' of this case. Examine what
- follows. */
- if ((re_opcode_t) p1[3] == exactn && p1[5] != c)
- {
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n",
- c, p1[5]);
- }
-
- else if ((re_opcode_t) p1[3] == charset
- || (re_opcode_t) p1[3] == charset_not)
- {
- int not = (re_opcode_t) p1[3] == charset_not;
-
- if (c < (unsigned char) (p1[4] * BYTEWIDTH)
- && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
-
- /* `not' is equal to 1 if c would match, which means
- that we can't change to pop_failure_jump. */
- if (!not)
- {
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
- }
- }
- }
- }
- p -= 2; /* Point at relative address again. */
- if ((re_opcode_t) p[-1] != pop_failure_jump)
- {
- p[-1] = (unsigned char) jump;
- DEBUG_PRINT1 (" Match => jump.\n");
- goto unconditional_jump;
- }
- /* Note fall through. */
-
-
- /* The end of a simple repeat has a pop_failure_jump back to
- its matching on_failure_jump, where the latter will push a
- failure point. The pop_failure_jump takes off failure
- points put on by this pop_failure_jump's matching
- on_failure_jump; we got through the pattern to here from the
- matching on_failure_jump, so didn't fail. */
- case pop_failure_jump:
- {
- /* We need to pass separate storage for the lowest and
- highest registers, even though we don't care about the
- actual values. Otherwise, we will restore only one
- register from the stack, since lowest will == highest in
- `pop_failure_point'. */
- unsigned dummy_low_reg, dummy_high_reg;
- unsigned char *pdummy;
- const char *sdummy;
-
- DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n");
- POP_FAILURE_POINT (sdummy, pdummy,
- dummy_low_reg, dummy_high_reg,
- reg_dummy, reg_dummy, reg_info_dummy);
- }
- /* Note fall through. */
-
-
- /* Unconditionally jump (without popping any failure points). */
- case jump:
- unconditional_jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */
- DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt);
- p += mcnt; /* Do the jump. */
- DEBUG_PRINT2 ("(to 0x%x).\n", p);
- break;
-
-
- /* We need this opcode so we can detect where alternatives end
- in `group_match_null_string_p' et al. */
- case jump_past_alt:
- DEBUG_PRINT1 ("EXECUTING jump_past_alt.\n");
- goto unconditional_jump;
-
-
- /* Normally, the on_failure_jump pushes a failure point, which
- then gets popped at pop_failure_jump. We will end up at
- pop_failure_jump, also, and with a pattern of, say, `a+', we
- are skipping over the on_failure_jump, so we have to push
- something meaningless for pop_failure_jump to pop. */
- case dummy_failure_jump:
- DEBUG_PRINT1 ("EXECUTING dummy_failure_jump.\n");
- /* It doesn't matter what we push for the string here. What
- the code at `fail' tests is the value for the pattern. */
- PUSH_FAILURE_POINT (0, 0, -2);
- goto unconditional_jump;
-
-
- /* At the end of an alternative, we need to push a dummy failure
- point in case we are followed by a `pop_failure_jump', because
- we don't want the failure point for the alternative to be
- popped. For example, matching `(a|ab)*' against `aab'
- requires that we match the `ab' alternative. */
- case push_dummy_failure:
- DEBUG_PRINT1 ("EXECUTING push_dummy_failure.\n");
- /* See comments just above at `dummy_failure_jump' about the
- two zeroes. */
- PUSH_FAILURE_POINT (0, 0, -2);
- break;
-
- /* Have to succeed matching what follows at least n times.
- After that, handle like `on_failure_jump'. */
- case succeed_n:
- EXTRACT_NUMBER (mcnt, p + 2);
- DEBUG_PRINT2 ("EXECUTING succeed_n %d.\n", mcnt);
-
- assert (mcnt >= 0);
- /* Originally, this is how many times we HAVE to succeed. */
- if (mcnt > 0)
- {
- mcnt--;
- p += 2;
- STORE_NUMBER_AND_INCR (p, mcnt);
- DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p, mcnt);
- }
- else if (mcnt == 0)
- {
- DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n", p+2);
- p[2] = (unsigned char) no_op;
- p[3] = (unsigned char) no_op;
- goto on_failure;
- }
- break;
-
- case jump_n:
- EXTRACT_NUMBER (mcnt, p + 2);
- DEBUG_PRINT2 ("EXECUTING jump_n %d.\n", mcnt);
-
- /* Originally, this is how many times we CAN jump. */
- if (mcnt)
- {
- mcnt--;
- STORE_NUMBER (p + 2, mcnt);
- goto unconditional_jump;
- }
- /* If don't have to jump any more, skip over the rest of command. */
- else
- p += 4;
- break;
-
- case set_number_at:
- {
- DEBUG_PRINT1 ("EXECUTING set_number_at.\n");
-
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- p1 = p + mcnt;
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt);
- STORE_NUMBER (p1, mcnt);
- break;
- }
-
- case wordbound:
- DEBUG_PRINT1 ("EXECUTING wordbound.\n");
- if (AT_WORD_BOUNDARY (d))
- break;
- goto fail;
-
- case notwordbound:
- DEBUG_PRINT1 ("EXECUTING notwordbound.\n");
- if (AT_WORD_BOUNDARY (d))
- goto fail;
- break;
-
- case wordbeg:
- DEBUG_PRINT1 ("EXECUTING wordbeg.\n");
- if (WORDCHAR_P (d) && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1)))
- break;
- goto fail;
-
- case wordend:
- DEBUG_PRINT1 ("EXECUTING wordend.\n");
- if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1)
- && (!WORDCHAR_P (d) || AT_STRINGS_END (d)))
- break;
- goto fail;
-
-#ifdef emacs
-#ifdef emacs19
- case before_dot:
- DEBUG_PRINT1 ("EXECUTING before_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) >= point)
- goto fail;
- break;
-
- case at_dot:
- DEBUG_PRINT1 ("EXECUTING at_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) != point)
- goto fail;
- break;
-
- case after_dot:
- DEBUG_PRINT1 ("EXECUTING after_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) <= point)
- goto fail;
- break;
-#else /* not emacs19 */
- case at_dot:
- DEBUG_PRINT1 ("EXECUTING at_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) + 1 != point)
- goto fail;
- break;
-#endif /* not emacs19 */
-
- case syntaxspec:
- DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt);
- mcnt = *p++;
- goto matchsyntax;
-
- case wordchar:
- DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n");
- mcnt = (int) Sword;
- matchsyntax:
- PREFETCH ();
- if (SYNTAX (*d++) != (enum syntaxcode) mcnt)
- goto fail;
- SET_REGS_MATCHED ();
- break;
-
- case notsyntaxspec:
- DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt);
- mcnt = *p++;
- goto matchnotsyntax;
-
- case notwordchar:
- DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n");
- mcnt = (int) Sword;
- matchnotsyntax:
- PREFETCH ();
- if (SYNTAX (*d++) == (enum syntaxcode) mcnt)
- goto fail;
- SET_REGS_MATCHED ();
- break;
-
-#else /* not emacs */
- case wordchar:
- DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n");
- PREFETCH ();
- if (!WORDCHAR_P (d))
- goto fail;
- SET_REGS_MATCHED ();
- d++;
- break;
-
- case notwordchar:
- DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n");
- PREFETCH ();
- if (WORDCHAR_P (d))
- goto fail;
- SET_REGS_MATCHED ();
- d++;
- break;
-#endif /* not emacs */
-
- default:
- abort ();
- }
- continue; /* Successfully executed one pattern command; keep going. */
-
-
- /* We goto here if a matching operation fails. */
- fail:
- if (!FAIL_STACK_EMPTY ())
- { /* A restart point is known. Restore to that state. */
- DEBUG_PRINT1 ("\nFAIL:\n");
- POP_FAILURE_POINT (d, p,
- lowest_active_reg, highest_active_reg,
- regstart, regend, reg_info);
-
- /* If this failure point is a dummy, try the next one. */
- if (!p)
- goto fail;
-
- /* If we failed to the end of the pattern, don't examine *p. */
- assert (p <= pend);
- if (p < pend)
- {
- boolean is_a_jump_n = false;
-
- /* If failed to a backwards jump that's part of a repetition
- loop, need to pop this failure point and use the next one. */
- switch ((re_opcode_t) *p)
- {
- case jump_n:
- is_a_jump_n = true;
- case maybe_pop_jump:
- case pop_failure_jump:
- case jump:
- p1 = p + 1;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- p1 += mcnt;
-
- if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n)
- || (!is_a_jump_n
- && (re_opcode_t) *p1 == on_failure_jump))
- goto fail;
- break;
- default:
- /* do nothing */ ;
- }
- }
-
- if (d >= string1 && d <= end1)
- dend = end_match_1;
- }
- else
- break; /* Matching at this starting point really fails. */
- } /* for (;;) */
-
- if (best_regs_set)
- goto restore_best_regs;
-
- FREE_VARIABLES ();
-
- return -1; /* Failure to match. */
-} /* re_match_2 */
-
-/* Subroutine definitions for re_match_2. */
-
-
-/* We are passed P pointing to a register number after a start_memory.
-
- Return true if the pattern up to the corresponding stop_memory can
- match the empty string, and false otherwise.
-
- If we find the matching stop_memory, sets P to point to one past its number.
- Otherwise, sets P to an undefined byte less than or equal to END.
-
- We don't handle duplicates properly (yet). */
-
-static boolean
-group_match_null_string_p (p, end, reg_info)
- unsigned char **p, *end;
- register_info_type *reg_info;
-{
- int mcnt;
- /* Point to after the args to the start_memory. */
- unsigned char *p1 = *p + 2;
-
- while (p1 < end)
- {
- /* Skip over opcodes that can match nothing, and return true or
- false, as appropriate, when we get to one that can't, or to the
- matching stop_memory. */
-
- switch ((re_opcode_t) *p1)
- {
- /* Could be either a loop or a series of alternatives. */
- case on_failure_jump:
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-
- /* If the next operation is not a jump backwards in the
- pattern. */
-
- if (mcnt >= 0)
- {
- /* Go through the on_failure_jumps of the alternatives,
- seeing if any of the alternatives cannot match nothing.
- The last alternative starts with only a jump,
- whereas the rest start with on_failure_jump and end
- with a jump, e.g., here is the pattern for `a|b|c':
-
- /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6
- /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3
- /exactn/1/c
-
- So, we have to first go through the first (n-1)
- alternatives and then deal with the last one separately. */
-
-
- /* Deal with the first (n-1) alternatives, which start
- with an on_failure_jump (see above) that jumps to right
- past a jump_past_alt. */
-
- while ((re_opcode_t) p1[mcnt-3] == jump_past_alt)
- {
- /* `mcnt' holds how many bytes long the alternative
- is, including the ending `jump_past_alt' and
- its number. */
-
- if (!alt_match_null_string_p (p1, p1 + mcnt - 3,
- reg_info))
- return false;
-
- /* Move to right after this alternative, including the
- jump_past_alt. */
- p1 += mcnt;
-
- /* Break if it's the beginning of an n-th alternative
- that doesn't begin with an on_failure_jump. */
- if ((re_opcode_t) *p1 != on_failure_jump)
- break;
-
- /* Still have to check that it's not an n-th
- alternative that starts with an on_failure_jump. */
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- if ((re_opcode_t) p1[mcnt-3] != jump_past_alt)
- {
- /* Get to the beginning of the n-th alternative. */
- p1 -= 3;
- break;
- }
- }
-
- /* Deal with the last alternative: go back and get number
- of the `jump_past_alt' just before it. `mcnt' contains
- the length of the alternative. */
- EXTRACT_NUMBER (mcnt, p1 - 2);
-
- if (!alt_match_null_string_p (p1, p1 + mcnt, reg_info))
- return false;
-
- p1 += mcnt; /* Get past the n-th alternative. */
- } /* if mcnt > 0 */
- break;
-
-
- case stop_memory:
- assert (p1[1] == **p);
- *p = p1 + 2;
- return true;
-
-
- default:
- if (!common_op_match_null_string_p (&p1, end, reg_info))
- return false;
- }
- } /* while p1 < end */
-
- return false;
-} /* group_match_null_string_p */
-
-
-/* Similar to group_match_null_string_p, but doesn't deal with alternatives:
- It expects P to be the first byte of a single alternative and END one
- byte past the last. The alternative can contain groups. */
-
-static boolean
-alt_match_null_string_p (p, end, reg_info)
- unsigned char *p, *end;
- register_info_type *reg_info;
-{
- int mcnt;
- unsigned char *p1 = p;
-
- while (p1 < end)
- {
- /* Skip over opcodes that can match nothing, and break when we get
- to one that can't. */
-
- switch ((re_opcode_t) *p1)
- {
- /* It's a loop. */
- case on_failure_jump:
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- p1 += mcnt;
- break;
-
- default:
- if (!common_op_match_null_string_p (&p1, end, reg_info))
- return false;
- }
- } /* while p1 < end */
-
- return true;
-} /* alt_match_null_string_p */
-
-
-/* Deals with the ops common to group_match_null_string_p and
- alt_match_null_string_p.
-
- Sets P to one after the op and its arguments, if any. */
-
-static boolean
-common_op_match_null_string_p (p, end, reg_info)
- unsigned char **p, *end;
- register_info_type *reg_info;
-{
- int mcnt;
- boolean ret;
- int reg_no;
- unsigned char *p1 = *p;
-
- switch ((re_opcode_t) *p1++)
- {
- case no_op:
- case begline:
- case endline:
- case begbuf:
- case endbuf:
- case wordbeg:
- case wordend:
- case wordbound:
- case notwordbound:
-#ifdef emacs
- case before_dot:
- case at_dot:
- case after_dot:
-#endif
- break;
-
- case start_memory:
- reg_no = *p1;
- assert (reg_no > 0 && reg_no <= MAX_REGNUM);
- ret = group_match_null_string_p (&p1, end, reg_info);
-
- /* Have to set this here in case we're checking a group which
- contains a group and a back reference to it. */
-
- if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE)
- REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret;
-
- if (!ret)
- return false;
- break;
-
- /* If this is an optimized succeed_n for zero times, make the jump. */
- case jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- if (mcnt >= 0)
- p1 += mcnt;
- else
- return false;
- break;
-
- case succeed_n:
- /* Get to the number of times to succeed. */
- p1 += 2;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-
- if (mcnt == 0)
- {
- p1 -= 4;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- p1 += mcnt;
- }
- else
- return false;
- break;
-
- case duplicate:
- if (!REG_MATCH_NULL_STRING_P (reg_info[*p1]))
- return false;
- break;
-
- case set_number_at:
- p1 += 4;
-
- default:
- /* All other opcodes mean we cannot match the empty string. */
- return false;
- }
-
- *p = p1;
- return true;
-} /* common_op_match_null_string_p */
-
-
-/* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN
- bytes; nonzero otherwise. */
-
-static int
-bcmp_translate (s1, s2, len, translate)
- unsigned char *s1, *s2;
- register int len;
- char *translate;
-{
- register unsigned char *p1 = s1, *p2 = s2;
- while (len)
- {
- if (translate[*p1++] != translate[*p2++]) return 1;
- len--;
- }
- return 0;
-}
-
-/* Entry points for GNU code. */
-
-/* re_compile_pattern is the GNU regular expression compiler: it
- compiles PATTERN (of length SIZE) and puts the result in BUFP.
- Returns 0 if the pattern was valid, otherwise an error string.
-
- Assumes the `allocated' (and perhaps `buffer') and `translate' fields
- are set in BUFP on entry.
-
- We call regex_compile to do the actual compilation. */
-
-const char *
-re_compile_pattern (pattern, length, bufp)
- const char *pattern;
- int length;
- struct re_pattern_buffer *bufp;
-{
- reg_errcode_t ret;
-
- /* GNU code is written to assume at least RE_NREGS registers will be set
- (and at least one extra will be -1). */
- bufp->regs_allocated = REGS_UNALLOCATED;
-
- /* And GNU code determines whether or not to get register information
- by passing null for the REGS argument to re_match, etc., not by
- setting no_sub. */
- bufp->no_sub = 0;
-
- /* Match anchors at newline. */
- bufp->newline_anchor = 1;
-
- ret = regex_compile (pattern, length, re_syntax_options, bufp);
-
- return re_error_msg[(int) ret];
-}
-
-/* Entry points compatible with 4.2 BSD regex library. We don't define
- them if this is an Emacs or POSIX compilation. */
-
-#if !defined (emacs) && !defined (_POSIX_SOURCE)
-
-/* BSD has one and only one pattern buffer. */
-static struct re_pattern_buffer re_comp_buf;
-
-char *
-re_comp (s)
- const char *s;
-{
- reg_errcode_t ret;
-
- if (!s)
- {
- if (!re_comp_buf.buffer)
- return "No previous regular expression";
- return 0;
- }
-
- if (!re_comp_buf.buffer)
- {
- re_comp_buf.buffer = (unsigned char *) malloc (200);
- if (re_comp_buf.buffer == NULL)
- return "Memory exhausted";
- re_comp_buf.allocated = 200;
-
- re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
- if (re_comp_buf.fastmap == NULL)
- return "Memory exhausted";
- }
-
- /* Since `re_exec' always passes NULL for the `regs' argument, we
- don't need to initialize the pattern buffer fields which affect it. */
-
- /* Match anchors at newlines. */
- re_comp_buf.newline_anchor = 1;
-
- ret = regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf);
-
- /* Yes, we're discarding `const' here. */
- return (char *) re_error_msg[(int) ret];
-}
-
-
-int
-re_exec (s)
- const char *s;
-{
- const int len = strlen (s);
- return
- 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0);
-}
-#endif /* not emacs and not _POSIX_SOURCE */
-
-/* POSIX.2 functions. Don't define these for Emacs. */
-
-#ifndef emacs
-
-/* regcomp takes a regular expression as a string and compiles it.
-
- PREG is a regex_t *. We do not expect any fields to be initialized,
- since POSIX says we shouldn't. Thus, we set
-
- `buffer' to the compiled pattern;
- `used' to the length of the compiled pattern;
- `syntax' to RE_SYNTAX_POSIX_EXTENDED if the
- REG_EXTENDED bit in CFLAGS is set; otherwise, to
- RE_SYNTAX_POSIX_BASIC;
- `newline_anchor' to REG_NEWLINE being set in CFLAGS;
- `fastmap' and `fastmap_accurate' to zero;
- `re_nsub' to the number of subexpressions in PATTERN.
-
- PATTERN is the address of the pattern string.
-
- CFLAGS is a series of bits which affect compilation.
-
- If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we
- use POSIX basic syntax.
-
- If REG_NEWLINE is set, then . and [^...] don't match newline.
- Also, regexec will try a match beginning after every newline.
-
- If REG_ICASE is set, then we considers upper- and lowercase
- versions of letters to be equivalent when matching.
-
- If REG_NOSUB is set, then when PREG is passed to regexec, that
- routine will report only success or failure, and nothing about the
- registers.
-
- It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for
- the return codes and their meanings.) */
-
-int
-regcomp (preg, pattern, cflags)
- regex_t *preg;
- const char *pattern;
- int cflags;
-{
- reg_errcode_t ret;
- unsigned syntax
- = (cflags & REG_EXTENDED) ?
- RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC;
-
- /* regex_compile will allocate the space for the compiled pattern. */
- preg->buffer = 0;
- preg->allocated = 0;
- preg->used = 0;
-
- /* Don't bother to use a fastmap when searching. This simplifies the
- REG_NEWLINE case: if we used a fastmap, we'd have to put all the
- characters after newlines into the fastmap. This way, we just try
- every character. */
- preg->fastmap = 0;
-
- if (cflags & REG_ICASE)
- {
- unsigned i;
-
- preg->translate = (char *) malloc (CHAR_SET_SIZE);
- if (preg->translate == NULL)
- return (int) REG_ESPACE;
-
- /* Map uppercase characters to corresponding lowercase ones. */
- for (i = 0; i < CHAR_SET_SIZE; i++)
- preg->translate[i] = ISUPPER (i) ? tolower (i) : i;
- }
- else
- preg->translate = NULL;
-
- /* If REG_NEWLINE is set, newlines are treated differently. */
- if (cflags & REG_NEWLINE)
- { /* REG_NEWLINE implies neither . nor [^...] match newline. */
- syntax &= ~RE_DOT_NEWLINE;
- syntax |= RE_HAT_LISTS_NOT_NEWLINE;
- /* It also changes the matching behavior. */
- preg->newline_anchor = 1;
- }
- else
- preg->newline_anchor = 0;
-
- preg->no_sub = !!(cflags & REG_NOSUB);
-
- /* POSIX says a null character in the pattern terminates it, so we
- can use strlen here in compiling the pattern. */
- ret = regex_compile (pattern, strlen (pattern), syntax, preg);
-
- /* POSIX doesn't distinguish between an unmatched open-group and an
- unmatched close-group: both are REG_EPAREN. */
- if (ret == REG_ERPAREN) ret = REG_EPAREN;
-
- return (int) ret;
-}
-
-
-/* regexec searches for a given pattern, specified by PREG, in the
- string STRING.
-
- If NMATCH is zero or REG_NOSUB was set in the cflags argument to
- `regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at
- least NMATCH elements, and we set them to the offsets of the
- corresponding matched substrings.
-
- EFLAGS specifies `execution flags' which affect matching: if
- REG_NOTBOL is set, then ^ does not match at the beginning of the
- string; if REG_NOTEOL is set, then $ does not match at the end.
-
- We return 0 if we find a match and REG_NOMATCH if not. */
-
-int
-regexec (preg, string, nmatch, pmatch, eflags)
- const regex_t *preg;
- const char *string;
- size_t nmatch;
- regmatch_t pmatch[];
- int eflags;
-{
- int ret;
- struct re_registers regs;
- regex_t private_preg;
- int len = strlen (string);
- boolean want_reg_info = !preg->no_sub && nmatch > 0;
-
- private_preg = *preg;
-
- private_preg.not_bol = !!(eflags & REG_NOTBOL);
- private_preg.not_eol = !!(eflags & REG_NOTEOL);
-
- /* The user has told us exactly how many registers to return
- information about, via `nmatch'. We have to pass that on to the
- matching routines. */
- private_preg.regs_allocated = REGS_FIXED;
-
- if (want_reg_info)
- {
- regs.num_regs = nmatch;
- regs.start = TALLOC (nmatch, regoff_t);
- regs.end = TALLOC (nmatch, regoff_t);
- if (regs.start == NULL || regs.end == NULL)
- return (int) REG_NOMATCH;
- }
-
- /* Perform the searching operation. */
- ret = re_search (&private_preg, string, len,
- /* start: */ 0, /* range: */ len,
- want_reg_info ? &regs : (struct re_registers *) 0);
-
- /* Copy the register information to the POSIX structure. */
- if (want_reg_info)
- {
- if (ret >= 0)
- {
- unsigned r;
-
- for (r = 0; r < nmatch; r++)
- {
- pmatch[r].rm_so = regs.start[r];
- pmatch[r].rm_eo = regs.end[r];
- }
- }
-
- /* If we needed the temporary register info, free the space now. */
- free (regs.start);
- free (regs.end);
- }
-
- /* We want zero return to mean success, unlike `re_search'. */
- return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH;
-}
-
-
-/* Returns a message corresponding to an error code, ERRCODE, returned
- from either regcomp or regexec. We don't use PREG here. */
-
-size_t
-regerror (errcode, preg, errbuf, errbuf_size)
- int errcode;
- const regex_t *preg;
- char *errbuf;
- size_t errbuf_size;
-{
- const char *msg;
- size_t msg_size;
-
- if (errcode < 0
- || errcode >= (sizeof (re_error_msg) / sizeof (re_error_msg[0])))
- /* Only error codes returned by the rest of the code should be passed
- to this routine. If we are given anything else, or if other regex
- code generates an invalid error code, then the program has a bug.
- Dump core so we can fix it. */
- abort ();
-
- msg = re_error_msg[errcode];
-
- /* POSIX doesn't require that we do anything in this case, but why
- not be nice. */
- if (! msg)
- msg = "Success";
-
- msg_size = strlen (msg) + 1; /* Includes the null. */
-
- if (errbuf_size != 0)
- {
- if (msg_size > errbuf_size)
- {
- strncpy (errbuf, msg, errbuf_size - 1);
- errbuf[errbuf_size - 1] = 0;
- }
- else
- strcpy (errbuf, msg);
- }
-
- return msg_size;
-}
-
-
-/* Free dynamically allocated space used by PREG. */
-
-void
-regfree (preg)
- regex_t *preg;
-{
- if (preg->buffer != NULL)
- free (preg->buffer);
- preg->buffer = NULL;
-
- preg->allocated = 0;
- preg->used = 0;
-
- if (preg->fastmap != NULL)
- free (preg->fastmap);
- preg->fastmap = NULL;
- preg->fastmap_accurate = 0;
-
- if (preg->translate != NULL)
- free (preg->translate);
- preg->translate = NULL;
-}
-
-#endif /* not emacs */
-
-/*
-Local variables:
-make-backup-files: t
-version-control: t
-trim-versions-without-asking: nil
-End:
-*/
diff --git a/gnu/usr.bin/grep/regex.h b/gnu/usr.bin/grep/regex.h
deleted file mode 100644
index 408dd21..0000000
--- a/gnu/usr.bin/grep/regex.h
+++ /dev/null
@@ -1,490 +0,0 @@
-/* Definitions for data structures and routines for the regular
- expression library, version 0.12.
-
- Copyright (C) 1985, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef __REGEXP_LIBRARY_H__
-#define __REGEXP_LIBRARY_H__
-
-/* POSIX says that <sys/types.h> must be included (by the caller) before
- <regex.h>. */
-
-#ifdef VMS
-/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
- should be there. */
-#include <stddef.h>
-#endif
-
-
-/* The following bits are used to determine the regexp syntax we
- recognize. The set/not-set meanings are chosen so that Emacs syntax
- remains the value 0. The bits are given in alphabetical order, and
- the definitions shifted by one from the previous bit; thus, when we
- add or remove a bit, only one other definition need change. */
-typedef unsigned reg_syntax_t;
-
-/* If this bit is not set, then \ inside a bracket expression is literal.
- If set, then such a \ quotes the following character. */
-#define RE_BACKSLASH_ESCAPE_IN_LISTS (1)
-
-/* If this bit is not set, then + and ? are operators, and \+ and \? are
- literals.
- If set, then \+ and \? are operators and + and ? are literals. */
-#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
-
-/* If this bit is set, then character classes are supported. They are:
- [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
- [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
- If not set, then character classes are not supported. */
-#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
-
-/* If this bit is set, then ^ and $ are always anchors (outside bracket
- expressions, of course).
- If this bit is not set, then it depends:
- ^ is an anchor if it is at the beginning of a regular
- expression or after an open-group or an alternation operator;
- $ is an anchor if it is at the end of a regular expression, or
- before a close-group or an alternation operator.
-
- This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
- POSIX draft 11.2 says that * etc. in leading positions is undefined.
- We already implemented a previous draft which made those constructs
- invalid, though, so we haven't changed the code back. */
-#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
-
-/* If this bit is set, then special characters are always special
- regardless of where they are in the pattern.
- If this bit is not set, then special characters are special only in
- some contexts; otherwise they are ordinary. Specifically,
- * + ? and intervals are only special when not after the beginning,
- open-group, or alternation operator. */
-#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
-
-/* If this bit is set, then *, +, ?, and { cannot be first in an re or
- immediately after an alternation or begin-group operator. */
-#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
-
-/* If this bit is set, then . matches newline.
- If not set, then it doesn't. */
-#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
-
-/* If this bit is set, then . doesn't match NUL.
- If not set, then it does. */
-#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
-
-/* If this bit is set, nonmatching lists [^...] do not match newline.
- If not set, they do. */
-#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
-
-/* If this bit is set, either \{...\} or {...} defines an
- interval, depending on RE_NO_BK_BRACES.
- If not set, \{, \}, {, and } are literals. */
-#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
-
-/* If this bit is set, +, ? and | aren't recognized as operators.
- If not set, they are. */
-#define RE_LIMITED_OPS (RE_INTERVALS << 1)
-
-/* If this bit is set, newline is an alternation operator.
- If not set, newline is literal. */
-#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
-
-/* If this bit is set, then `{...}' defines an interval, and \{ and \}
- are literals.
- If not set, then `\{...\}' defines an interval. */
-#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
-
-/* If this bit is set, (...) defines a group, and \( and \) are literals.
- If not set, \(...\) defines a group, and ( and ) are literals. */
-#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
-
-/* If this bit is set, then \<digit> matches <digit>.
- If not set, then \<digit> is a back-reference. */
-#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
-
-/* If this bit is set, then | is an alternation operator, and \| is literal.
- If not set, then \| is an alternation operator, and | is literal. */
-#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
-
-/* If this bit is set, then an ending range point collating higher
- than the starting range point, as in [z-a], is invalid.
- If not set, then when ending range point collates higher than the
- starting range point, the range is ignored. */
-#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
-
-/* If this bit is set, then an unmatched ) is ordinary.
- If not set, then an unmatched ) is invalid. */
-#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
-
-/* This global variable defines the particular regexp syntax to use (for
- some interfaces). When a regexp is compiled, the syntax used is
- stored in the pattern buffer, so changing this does not affect
- already-compiled regexps. */
-extern reg_syntax_t re_syntax_options;
-
-/* Define combinations of the above bits for the standard possibilities.
- (The [[[ comments delimit what gets put into the Texinfo file, so
- don't delete them!) */
-/* [[[begin syntaxes]]] */
-#define RE_SYNTAX_EMACS 0
-
-#define RE_SYNTAX_AWK \
- (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS \
- | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
- | RE_UNMATCHED_RIGHT_PAREN_ORD)
-
-#define RE_SYNTAX_POSIX_AWK \
- (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)
-
-#define RE_SYNTAX_GREP \
- (RE_BK_PLUS_QM | RE_CHAR_CLASSES \
- | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
- | RE_NEWLINE_ALT)
-
-#define RE_SYNTAX_EGREP \
- (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
- | RE_NEWLINE_ALT | RE_NO_BK_PARENS \
- | RE_NO_BK_VBAR)
-
-#define RE_SYNTAX_POSIX_EGREP \
- (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)
-
-/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
-#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
-
-#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
-
-/* Syntax bits common to both basic and extended POSIX regex syntax. */
-#define _RE_SYNTAX_POSIX_COMMON \
- (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
- | RE_INTERVALS | RE_NO_EMPTY_RANGES)
-
-#define RE_SYNTAX_POSIX_BASIC \
- (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
-
-/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
- RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
- isn't minimal, since other operators, such as \`, aren't disabled. */
-#define RE_SYNTAX_POSIX_MINIMAL_BASIC \
- (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
-
-#define RE_SYNTAX_POSIX_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_VBAR \
- | RE_UNMATCHED_RIGHT_PAREN_ORD)
-
-/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS
- replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added. */
-#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS \
- | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
-/* [[[end syntaxes]]] */
-
-/* Maximum number of duplicates an interval can allow. Some systems
- (erroneously) define this in other header files, but we want our
- value, so remove any previous define. */
-#ifdef RE_DUP_MAX
-#undef RE_DUP_MAX
-#endif
-#define RE_DUP_MAX ((1 << 15) - 1)
-
-
-/* POSIX `cflags' bits (i.e., information for `regcomp'). */
-
-/* If this bit is set, then use extended regular expression syntax.
- If not set, then use basic regular expression syntax. */
-#define REG_EXTENDED 1
-
-/* If this bit is set, then ignore case when matching.
- If not set, then case is significant. */
-#define REG_ICASE (REG_EXTENDED << 1)
-
-/* If this bit is set, then anchors do not match at newline
- characters in the string.
- If not set, then anchors do match at newlines. */
-#define REG_NEWLINE (REG_ICASE << 1)
-
-/* If this bit is set, then report only success or fail in regexec.
- If not set, then returns differ between not matching and errors. */
-#define REG_NOSUB (REG_NEWLINE << 1)
-
-
-/* POSIX `eflags' bits (i.e., information for regexec). */
-
-/* If this bit is set, then the beginning-of-line operator doesn't match
- the beginning of the string (presumably because it's not the
- beginning of a line).
- If not set, then the beginning-of-line operator does match the
- beginning of the string. */
-#define REG_NOTBOL 1
-
-/* Like REG_NOTBOL, except for the end-of-line. */
-#define REG_NOTEOL (1 << 1)
-
-
-/* If any error codes are removed, changed, or added, update the
- `re_error_msg' table in regex.c. */
-typedef enum
-{
- REG_NOERROR = 0, /* Success. */
- REG_NOMATCH, /* Didn't find a match (for regexec). */
-
- /* POSIX regcomp return error codes. (In the order listed in the
- standard.) */
- REG_BADPAT, /* Invalid pattern. */
- REG_ECOLLATE, /* Not implemented. */
- REG_ECTYPE, /* Invalid character class name. */
- REG_EESCAPE, /* Trailing backslash. */
- REG_ESUBREG, /* Invalid back reference. */
- REG_EBRACK, /* Unmatched left bracket. */
- REG_EPAREN, /* Parenthesis imbalance. */
- REG_EBRACE, /* Unmatched \{. */
- REG_BADBR, /* Invalid contents of \{\}. */
- REG_ERANGE, /* Invalid range end. */
- REG_ESPACE, /* Ran out of memory. */
- REG_BADRPT, /* No preceding re for repetition op. */
-
- /* Error codes we've added. */
- REG_EEND, /* Premature end. */
- REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
- REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
-} reg_errcode_t;
-
-/* This data structure represents a compiled pattern. Before calling
- the pattern compiler, the fields `buffer', `allocated', `fastmap',
- `translate', and `no_sub' can be set. After the pattern has been
- compiled, the `re_nsub' field is available. All other fields are
- private to the regex routines. */
-
-struct re_pattern_buffer
-{
-/* [[[begin pattern_buffer]]] */
- /* Space that holds the compiled pattern. It is declared as
- `unsigned char *' because its elements are
- sometimes used as array indexes. */
- unsigned char *buffer;
-
- /* Number of bytes to which `buffer' points. */
- unsigned long allocated;
-
- /* Number of bytes actually used in `buffer'. */
- unsigned long used;
-
- /* Syntax setting with which the pattern was compiled. */
- reg_syntax_t syntax;
-
- /* Pointer to a fastmap, if any, otherwise zero. re_search uses
- the fastmap, if there is one, to skip over impossible
- starting points for matches. */
- char *fastmap;
-
- /* Either a translate table to apply to all characters before
- comparing them, or zero for no translation. The translation
- is applied to a pattern when it is compiled and to a string
- when it is matched. */
- char *translate;
-
- /* Number of subexpressions found by the compiler. */
- size_t re_nsub;
-
- /* Zero if this pattern cannot match the empty string, one else.
- Well, in truth it's used only in `re_search_2', to see
- whether or not we should use the fastmap, so we don't set
- this absolutely perfectly; see `re_compile_fastmap' (the
- `duplicate' case). */
- unsigned can_be_null : 1;
-
- /* If REGS_UNALLOCATED, allocate space in the `regs' structure
- for `max (RE_NREGS, re_nsub + 1)' groups.
- If REGS_REALLOCATE, reallocate space if necessary.
- If REGS_FIXED, use what's there. */
-#define REGS_UNALLOCATED 0
-#define REGS_REALLOCATE 1
-#define REGS_FIXED 2
- unsigned regs_allocated : 2;
-
- /* Set to zero when `regex_compile' compiles a pattern; set to one
- by `re_compile_fastmap' if it updates the fastmap. */
- unsigned fastmap_accurate : 1;
-
- /* If set, `re_match_2' does not return information about
- subexpressions. */
- unsigned no_sub : 1;
-
- /* If set, a beginning-of-line anchor doesn't match at the
- beginning of the string. */
- unsigned not_bol : 1;
-
- /* Similarly for an end-of-line anchor. */
- unsigned not_eol : 1;
-
- /* If true, an anchor at a newline matches. */
- unsigned newline_anchor : 1;
-
-/* [[[end pattern_buffer]]] */
-};
-
-typedef struct re_pattern_buffer regex_t;
-
-
-/* search.c (search_buffer) in Emacs needs this one opcode value. It is
- defined both in `regex.c' and here. */
-#define RE_EXACTN_VALUE 1
-
-/* Type for byte offsets within the string. POSIX mandates this. */
-typedef int regoff_t;
-
-
-/* This is the structure we store register match data in. See
- regex.texinfo for a full description of what registers match. */
-struct re_registers
-{
- unsigned num_regs;
- regoff_t *start;
- regoff_t *end;
-};
-
-
-/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
- `re_match_2' returns information about at least this many registers
- the first time a `regs' structure is passed. */
-#ifndef RE_NREGS
-#define RE_NREGS 30
-#endif
-
-
-/* POSIX specification for registers. Aside from the different names than
- `re_registers', POSIX uses an array of structures, instead of a
- structure of arrays. */
-typedef struct
-{
- regoff_t rm_so; /* Byte offset from string's start to substring's start. */
- regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
-} regmatch_t;
-
-/* Declarations for routines. */
-
-/* To avoid duplicating every routine declaration -- once with a
- prototype (if we are ANSI), and once without (if we aren't) -- we
- use the following macro to declare argument types. This
- unfortunately clutters up the declarations a bit, but I think it's
- worth it. */
-
-#if __STDC__
-
-#define _RE_ARGS(args) args
-
-#else /* not __STDC__ */
-
-#define _RE_ARGS(args) ()
-
-#endif /* not __STDC__ */
-
-/* Sets the current default syntax to SYNTAX, and return the old syntax.
- You can also simply assign to the `re_syntax_options' variable. */
-extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
-
-/* Compile the regular expression PATTERN, with length LENGTH
- and syntax given by the global `re_syntax_options', into the buffer
- BUFFER. Return NULL if successful, and an error string if not. */
-extern const char *re_compile_pattern
- _RE_ARGS ((const char *pattern, int length,
- struct re_pattern_buffer *buffer));
-
-
-/* Compile a fastmap for the compiled pattern in BUFFER; used to
- accelerate searches. Return 0 if successful and -2 if was an
- internal error. */
-extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
-
-
-/* Search in the string STRING (with length LENGTH) for the pattern
- compiled into BUFFER. Start searching at position START, for RANGE
- characters. Return the starting position of the match, -1 for no
- match, or -2 for an internal error. Also return register
- information in REGS (if REGS and BUFFER->no_sub are nonzero). */
-extern int re_search
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
- int length, int start, int range, struct re_registers *regs));
-
-
-/* Like `re_search', but search in the concatenation of STRING1 and
- STRING2. Also, stop searching at index START + STOP. */
-extern int re_search_2
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
- int length1, const char *string2, int length2,
- int start, int range, struct re_registers *regs, int stop));
-
-
-/* Like `re_search', but return how many characters in STRING the regexp
- in BUFFER matched, starting at position START. */
-extern int re_match
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
- int length, int start, struct re_registers *regs));
-
-
-/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
-extern int re_match_2
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
- int length1, const char *string2, int length2,
- int start, struct re_registers *regs, int stop));
-
-
-/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
- ENDS. Subsequent matches using BUFFER and REGS will use this memory
- for recording register information. STARTS and ENDS must be
- allocated with malloc, and must each be at least `NUM_REGS * sizeof
- (regoff_t)' bytes long.
-
- If NUM_REGS == 0, then subsequent matches should allocate their own
- register data.
-
- Unless this function is called, the first search or match using
- PATTERN_BUFFER will allocate its own register data, without
- freeing the old data. */
-extern void re_set_registers
- _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
- unsigned num_regs, regoff_t *starts, regoff_t *ends));
-
-/* 4.2 bsd compatibility. */
-extern char *re_comp _RE_ARGS ((const char *));
-extern int re_exec _RE_ARGS ((const char *));
-
-/* POSIX compatibility. */
-extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags));
-extern int regexec
- _RE_ARGS ((const regex_t *preg, const char *string, size_t nmatch,
- regmatch_t pmatch[], int eflags));
-extern size_t regerror
- _RE_ARGS ((int errcode, const regex_t *preg, char *errbuf,
- size_t errbuf_size));
-extern void regfree _RE_ARGS ((regex_t *preg));
-
-#endif /* not __REGEXP_LIBRARY_H__ */
-
-/*
-Local variables:
-make-backup-files: t
-version-control: t
-trim-versions-without-asking: nil
-End:
-*/
diff --git a/gnu/usr.bin/gzip/gzexe.in b/gnu/usr.bin/gzip/gzexe.in
deleted file mode 100644
index a28ec3d..0000000
--- a/gnu/usr.bin/gzip/gzexe.in
+++ /dev/null
@@ -1,151 +0,0 @@
-:
-#!/bin/sh
-# gzexe: compressor for Unix executables.
-# Use this only for binaries that you do not use frequently.
-#
-# The compressed version is a shell script which decompresses itself after
-# skipping $skip lines of shell commands. We try invoking the compressed
-# executable with the original name (for programs looking at their name).
-# We also try to retain the original file permissions on the compressed file.
-# For safety reasons, gzexe will not create setuid or setgid shell scripts.
-
-# WARNING: the first line of this file must be either : or #!/bin/sh
-# The : is required for some old versions of csh.
-# On Ultrix, /bin/sh is too buggy, change the first line to: #!/bin/sh5
-
-x=`basename $0`
-if test $# = 0; then
- echo compress executables. original file foo is renamed to foo~
- echo usage: ${x} [-d] files...
- echo " -d decompress the executables"
- exit 1
-fi
-
-tmp=gz$$
-trap "rm -f $tmp; exit 1" 1 2 3 5 10 13 15
-
-decomp=0
-res=0
-test "$x" = "ungzexe" && decomp=1
-if test "x$1" = "x-d"; then
- decomp=1
- shift
-fi
-
-echo hi > zfoo1$$
-echo hi > zfoo2$$
-if test -z "`(${CPMOD-cpmod} zfoo1$$ zfoo2$$) 2>&1`"; then
- cpmod=${CPMOD-cpmod}
-fi
-rm -f zfoo[12]$$
-
-tail=""
-IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:"
-for dir in $PATH; do
- test -z "$dir" && dir=.
- if test -f $dir/tail; then
- tail="$dir/tail"
- break
- fi
-done
-IFS="$saveifs"
-if test -z "$tail"; then
- echo cannot find tail
- exit 1
-fi
-
-for i do
- if test ! -f "$i" ; then
- echo ${x}: $i not a file
- res=1
- continue
- fi
- if test $decomp -eq 0; then
- if sed -e 1d -e 2q "$i" | grep "^skip=[0-9]*$" >/dev/null; then
- echo "${x}: $i is already gzexe'd"
- continue
- fi
- fi
- if ls -l "$i" | grep '^...[sS]' > /dev/null; then
- echo "${x}: $i has setuid permission, unchanged"
- continue
- fi
- if ls -l "$i" | grep '^......[sS]' > /dev/null; then
- echo "${x}: $i has setgid permission, unchanged"
- continue
- fi
- case "`basename $i`" in
- gzip | tail | chmod | ln | sleep | rm)
- echo "${x}: $i would depend on itself"; continue ;;
- esac
- if test -z "$cpmod"; then
- cp -p "$i" $tmp 2>/dev/null || cp "$i" $tmp
- if test -w $tmp 2>/dev/null; then
- writable=1
- else
- writable=0
- chmod u+w $tmp 2>/dev/null
- fi
- fi
- if test $decomp -eq 0; then
- sed 1q $0 > $tmp
- sed "s|^if tail|if $tail|" >> $tmp <<'EOF'
-skip=18
-if tail +$skip $0 | "BINDIR"/gzip -cd > /tmp/gztmp$$; then
- /bin/chmod 700 /tmp/gztmp$$
- prog="`echo $0 | /bin/sed 's|^.*/||`"
- if /bin/ln /tmp/gztmp$$ "/tmp/$prog" 2>/dev/null; then
- trap '/bin/rm -f /tmp/gztmp$$ "/tmp/$prog"; exit $res' 0
- (/bin/sleep 5; /bin/rm -f /tmp/gztmp$$ "/tmp/$prog") 2>/dev/null &
- /tmp/"$prog" ${1+"$@"}; res=$?
- else
- trap '/bin/rm -f /tmp/gztmp$$; exit $res' 0
- (/bin/sleep 5; /bin/rm -f /tmp/gztmp$$) 2>/dev/null &
- /tmp/gztmp$$ ${1+"$@"}; res=$?
- fi
-else
- echo Cannot decompress $0; exit 1
-fi; exit $res
-EOF
- "BINDIR"/gzip -cv9 "$i" >> $tmp || {
- /bin/rm -f $tmp
- echo ${x}: compression not possible for $i, file unchanged.
- res=1
- continue
- }
-
- else
- # decompression
- skip=18
- if sed -e 1d -e 2q "$i" | grep "^skip=[0-9]*$" >/dev/null; then
- eval `sed -e 1d -e 2q "$i"`
- fi
- if tail +$skip "$i" | "BINDIR"/gzip -cd > $tmp; then
- :
- else
- echo ${x}: $i probably not in gzexe format, file unchanged.
- res=1
- continue
- fi
- fi
- rm -f "$i~"
- mv "$i" "$i~" || {
- echo ${x}: cannot backup $i as $i~
- rm -f $tmp
- res=1
- continue
- }
- mv $tmp "$i" || cp -p $tmp "$i" 2>/dev/null || cp $tmp "$i" || {
- echo ${x}: cannot create $i
- rm -f $tmp
- res=1
- continue
- }
- rm -f $tmp
- if test -n "$cpmod"; then
- $cpmod "$i~" "$i" 2>/dev/null
- elif test $writable -eq 0; then
- chmod u-w $i 2>/dev/null
- fi
-done
-exit $res
diff --git a/gnu/usr.bin/ld/TODO b/gnu/usr.bin/ld/TODO
deleted file mode 100644
index d37a245..0000000
--- a/gnu/usr.bin/ld/TODO
+++ /dev/null
@@ -1,4 +0,0 @@
-- Make C++ shared libs work (properly resolve ctor and dtor lists)
-- Make -r and -X work together for PIC .o files.
-
-- Avoid duplicatating shared library specifications in link_objects
diff --git a/gnu/usr.bin/man/catman/catman b/gnu/usr.bin/man/catman/catman
deleted file mode 100644
index a2d16a1..0000000
--- a/gnu/usr.bin/man/catman/catman
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-# usage: sh catman
-# put the section numbers here:
-SECTIONS="1 2 3 4 5 6 7 8"
-MANDIR=/usr/share/man
-
-formatman()
-{
- echo " "$1 "->" $*
- (cd cat$section; rm -f $*)
- nroff -man < man$section/$1 > cat$section/$1
- catfile=$1; shift
- while [ $# -gt 0 ]
- do
- ln cat$section/$catfile cat$section/$1
- shift
- done
-}
-
-cd $MANDIR
-for section in $SECTIONS
-do
- echo formatting section $section ...
-
- IFS=" "
- allfiles=`ls -i1 man$section | sort | awk '{if (inode ~ $1) printf "/" $2;
- else printf " " $2; inode = $1 } END {printf "\n"}'`
- for files in $allfiles
- do
- IFS="/"
- tfiles=`echo $files`
- IFS=" "
- formatman $tfiles
- done
-done
-exit 0
diff --git a/gnu/usr.bin/man/catman/catman.sh b/gnu/usr.bin/man/catman/catman.sh
deleted file mode 100644
index 456cb57..0000000
--- a/gnu/usr.bin/man/catman/catman.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/sh
-# usage: sh catman
-# put the section numbers here:
-SECTIONS="1 2 3 4 5 6 7 8"
-MANDIR=/usr/share/man
-
-formatman()
-{
- suffix=`echo $1 | sed -e 's/.*\\.//'`
- (cd cat$section; rm -f $*)
- if [ ".$suffix" = "%compext%" ]; then
- adds=
- %zcat% man$section/$1 | nroff -man | %compress% > cat$section/$1$adds
- else
- adds=%compext%
- nroff -man < man$section/$1 | %compress% > cat$section/$1$adds
- fi
- echo " "$* "->" $1$adds
- catfile=$1$adds; shift
- while [ $# -gt 0 ]
- do
- ln cat$section/$catfile cat$section/$1$adds
- shift
- done
-}
-
-cd $MANDIR
-for section in $SECTIONS
-do
- echo formatting section $section ...
-
- IFS=" "
- allfiles=`ls -i1 man$section | sort | awk '{if (inode ~ $1) printf "/" $2;
- else printf " " $2; inode = $1 } END {printf "\n"}'`
- for files in $allfiles
- do
- IFS="/"
- tfiles=`echo $files`
- IFS=" "
- formatman $tfiles
- done
-done
-exit 0
diff --git a/gnu/usr.bin/man/makewhatis/makewhatis.sh b/gnu/usr.bin/man/makewhatis/makewhatis.sh
deleted file mode 100644
index 28b871d..0000000
--- a/gnu/usr.bin/man/makewhatis/makewhatis.sh
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/bin/sh
-#
-# makewhatis -- update the whatis database in the man directories.
-#
-# Copyright (c) 1990, 1991, John W. Eaton.
-#
-# You may distribute under the terms of the GNU General Public
-# License as specified in the README file that comes with the man
-# distribution.
-#
-# John W. Eaton
-# jwe@che.utexas.edu
-# Department of Chemical Engineering
-# The University of Texas at Austin
-# Austin, Texas 78712
-
-PATH=/bin:/usr/local/bin:/usr/ucb:/usr/bin
-
-if [ $# = 0 ]
-then
- echo "usage: makewhatis directory [...]"
- exit 1
-fi
-for dir in $*
-do
- cd $dir
- for subdir in man*
- do
- if [ -d $subdir ]
- then
- for f in `find $subdir -type f -print`
- do
- suffix=`echo $f | sed -e 's/.*\\.//'`
- if [ ".$suffix" = "%compext%" ]; then
- output=%zcat%
- else
- output=cat
- fi
- $output $f | \
- sed -n '/^\.TH.*$/p
- /^\.Dt.*$/p
- /^\.S[hH][ ]*NAME/,/^\.S[hH]/p'|\
- sed -e 's/\\[ ]*\-/-/
- s/^.P[Pp].*$//
- s/\\(em//
- s/\\fI//
- s/\\fR//' |\
- awk 'BEGIN {insh = 0; inSh = 0; Nd = 0} {
- if ($1 == ".TH" || $1 == ".Dt")
- sect = $3
- else if (($1 == ".br" && insh == 1)\
- || ($1 == ".SH" && insh == 1)\
- || ($1 == ".Sh" && inSh == 1)) {
- if (i > 0 && nc > 0) {
- for (k= 1; k <= nc; k++) {
- namesect = sprintf("%s (%s)", name[k], sect)
- printf("%s", namesect)
- printf(" - ")
- for (j = 0; j < i-1; j++)
- printf("%s ", desc[j])
- printf("%s\n", desc[i-1])
- }
- }
- count = 0
- i = 0
- nc = 0
- } else if ($1 == ".SH" && insh == 0) {
- insh = 1
- count = 0
- i = 0
- nc = 0
- } else if ($1 == ".Sh" && inSh == 0) {
- inSh = 1
- i = 0
- nc = 0
- } else if (insh == 1) {
- count++
- if (count == 1 && NF > 2) {
- start = 2
- for (k = 1; k <= NF; k++)
- if ($k == "-") {
- start = k + 1
- break
- } else {
- sub(",","",$k)
- if ($k != "")
- name[++nc] = $k
- }
- if (NF >= start)
- for (j = start; j <= NF; j++)
- desc[i++] = $j
- } else {
- for (j = 1; j <= NF; j++)
- desc[i++] = $j
- }
- } else if ($1 == ".Nm" && inSh == 1 && Nd == 0) {
- for (k = 2; k <= NF; k++) {
- sub(",","",$k)
- if ($k != "")
- name[++nc] = $k
- }
- } else if ($1 == ".Nd" && inSh == 1) {
- Nd = 1
- for (j = 2; j <= NF; j++)
- desc[i++] = $j
- } else if (Nd == 1) {
- start = 1
- if ($1 ~ /\..*/)
- start = 2
- for (j = start; j <= NF; j++)
- desc[i++] = $j
- }
- }'
- done
- fi
- done | sort | colrm 80 | uniq > $dir/whatis.db.tmp
- mv $dir/whatis.db.tmp $dir/whatis
-done
-
-exit
diff --git a/gnu/usr.bin/perl/perl/usub/Makefile b/gnu/usr.bin/perl/perl/usub/Makefile
deleted file mode 100644
index 965a98a..0000000
--- a/gnu/usr.bin/perl/perl/usub/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-SRC = ..
-GLOBINCS =
-LOCINCS =
-LIBS = -lcurses -ltermcap `. $(SRC)/config.sh; echo $$libs`
-
-curseperl: $(SRC)/uperl.o usersub.o curses.o
- cc $(SRC)/uperl.o usersub.o curses.o $(LIBS) -o curseperl
-
-usersub.o: usersub.c
- cc -c -I$(SRC) $(GLOBINCS) -DDEBUGGING -g usersub.c
-
-curses.o: curses.c
- cc -c -I$(SRC) $(GLOBINCS) -DDEBUGGING -g curses.c
-
-curses.c: curses.mus
- mus curses.mus >curses.c
diff --git a/gnu/usr.bin/pr/Makefile b/gnu/usr.bin/pr/Makefile
deleted file mode 100644
index d651c20..0000000
--- a/gnu/usr.bin/pr/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-PROG= pr
-SRCS= pr.c getopt.c getopt1.c error.c xmalloc.c version.c
-
-CFLAGS+=-I${.CURDIR} -DDIRENT=1 -DHAVE_LONG_DOUBLE=1 -DHAVE_LONG_DOUBLE=1 \
- -DHAVE_ST_BLKSIZE=1 -DHAVE_VPRINTF=1 -DRETSIGTYPE=void \
- -DSTDC_HEADERS=1 -DDHAVE_STRERROR=1 -DHAVE_FCNTL_H=1 \
- -DHAVE_LIMITS_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRING_H=1 \
- -DHAVE_UNISTD_H=1
-
-
-.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/pr/error.c b/gnu/usr.bin/pr/error.c
deleted file mode 100644
index 41d66fb..0000000
--- a/gnu/usr.bin/pr/error.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* error.c -- error handler for noninteractive utilities
- Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Written by David MacKenzie. */
-
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
-#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
-#include <stdio.h>
-
-#ifdef HAVE_VPRINTF
-
-#if __STDC__
-#include <stdarg.h>
-#define VA_START(args, lastarg) va_start(args, lastarg)
-#else /* !__STDC__ */
-#include <varargs.h>
-#define VA_START(args, lastarg) va_start(args)
-#endif /* !__STDC__ */
-
-#else /* !HAVE_VPRINTF */
-
-#ifdef HAVE_DOPRNT
-#define va_alist args
-#define va_dcl int args;
-#else /* !HAVE_DOPRNT */
-#define va_alist a1, a2, a3, a4, a5, a6, a7, a8
-#define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
-#endif /* !HAVE_DOPRNT */
-
-#endif /* !HAVE_VPRINTF */
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#else /* !STDC_HEADERS */
-void exit ();
-#endif /* !STDC_HEADERS */
-
-extern char *program_name;
-
-#ifndef HAVE_STRERROR
-static char *
-private_strerror (errnum)
- int errnum;
-{
- extern char *sys_errlist[];
- extern int sys_nerr;
-
- if (errnum > 0 && errnum <= sys_nerr)
- return sys_errlist[errnum];
- return "Unknown system error";
-}
-#define strerror private_strerror
-#endif /* !HAVE_STRERROR */
-
-/* Print the program name and error message MESSAGE, which is a printf-style
- format string with optional args.
- If ERRNUM is nonzero, print its corresponding system error message.
- Exit with status STATUS if it is nonzero. */
-/* VARARGS */
-void
-#if defined (HAVE_VPRINTF) && __STDC__
-error (int status, int errnum, char *message, ...)
-#else /* !HAVE_VPRINTF or !__STDC__ */
-error (status, errnum, message, va_alist)
- int status;
- int errnum;
- char *message;
- va_dcl
-#endif /* !HAVE_VPRINTF or !__STDC__ */
-{
-#ifdef HAVE_VPRINTF
- va_list args;
-#endif /* HAVE_VPRINTF */
-
- fprintf (stderr, "%s: ", program_name);
-#ifdef HAVE_VPRINTF
- VA_START (args, message);
- vfprintf (stderr, message, args);
- va_end (args);
-#else /* !HAVE_VPRINTF */
-#ifdef HAVE_DOPRNT
- _doprnt (message, &args, stderr);
-#else /* !HAVE_DOPRNT */
- fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
-#endif /* !HAVE_DOPRNT */
-#endif /* !HAVE_VPRINTF */
- if (errnum)
- fprintf (stderr, ": %s", strerror (errnum));
- putc ('\n', stderr);
- fflush (stderr);
- if (status)
- exit (status);
-}
diff --git a/gnu/usr.bin/pr/getopt.c b/gnu/usr.bin/pr/getopt.c
deleted file mode 100644
index 7a4673b..0000000
--- a/gnu/usr.bin/pr/getopt.c
+++ /dev/null
@@ -1,757 +0,0 @@
-/* Getopt for GNU.
- NOTE: getopt is now part of the C library, so if you don't know what
- "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
- before changing it!
-
- Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
- Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2, or (at your option) any
- later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifdef HAVE_CONFIG_H
-#if defined (emacs) || defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
-#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
-#ifndef __STDC__
-/* This is a separate conditional since some stdc systems
- reject `defined (const)'. */
-#ifndef const
-#define const
-#endif
-#endif
-
-/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. */
-#ifndef _NO_PROTO
-#define _NO_PROTO
-#endif
-
-#include <stdio.h>
-
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself. This code is part of the GNU C
- Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object files,
- it is simpler to just do this in the source for each such file. */
-
-#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
-
-
-/* This needs to come after some library #include
- to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
-/* Don't include stdlib.h for non-GNU C libraries because some of them
- contain conflicting prototypes for getopt. */
-#include <stdlib.h>
-#endif /* GNU C library. */
-
-/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
- long-named option. Because this is not POSIX.2 compliant, it is
- being phased out. */
-/* #define GETOPT_COMPAT */
-
-/* This version of `getopt' appears to the caller like standard Unix `getopt'
- but it behaves differently for the user, since it allows the user
- to intersperse the options with the other arguments.
-
- As `getopt' works, it permutes the elements of ARGV so that,
- when it is done, all the options precede everything else. Thus
- all application programs are extended to handle flexible argument order.
-
- Setting the environment variable POSIXLY_CORRECT disables permutation.
- Then the behavior is completely standard.
-
- GNU application programs can use a third alternative mode in which
- they can distinguish the relative order of options and other arguments. */
-
-#include "getopt.h"
-
-/* For communication from `getopt' to the caller.
- When `getopt' finds an option that takes an argument,
- the argument value is returned here.
- Also, when `ordering' is RETURN_IN_ORDER,
- each non-option ARGV-element is returned here. */
-
-char *optarg = 0;
-
-/* Index in ARGV of the next element to be scanned.
- This is used for communication to and from the caller
- and for communication between successive calls to `getopt'.
-
- On entry to `getopt', zero means this is the first call; initialize.
-
- When `getopt' returns EOF, this is the index of the first of the
- non-option elements that the caller should itself scan.
-
- Otherwise, `optind' communicates from one call to the next
- how much of ARGV has been scanned so far. */
-
-/* XXX 1003.2 says this must be 1 before any call. */
-int optind = 0;
-
-/* The next char to be scanned in the option-element
- in which the last option character we returned was found.
- This allows us to pick up the scan where we left off.
-
- If this is zero, or a null string, it means resume the scan
- by advancing to the next ARGV-element. */
-
-static char *nextchar;
-
-/* Callers store zero here to inhibit the error message
- for unrecognized options. */
-
-int opterr = 1;
-
-/* Set to an option character which was unrecognized.
- This must be initialized on some systems to avoid linking in the
- system's own getopt implementation. */
-
-int optopt = '?';
-
-/* Describe how to deal with options that follow non-option ARGV-elements.
-
- If the caller did not specify anything,
- the default is REQUIRE_ORDER if the environment variable
- POSIXLY_CORRECT is defined, PERMUTE otherwise.
-
- REQUIRE_ORDER means don't recognize them as options;
- stop option processing when the first non-option is seen.
- This is what Unix does.
- This mode of operation is selected by either setting the environment
- variable POSIXLY_CORRECT, or using `+' as the first character
- of the list of option characters.
-
- PERMUTE is the default. We permute the contents of ARGV as we scan,
- so that eventually all the non-options are at the end. This allows options
- to be given in any order, even with programs that were not written to
- expect this.
-
- RETURN_IN_ORDER is an option available to programs that were written
- to expect options and other ARGV-elements in any order and that care about
- the ordering of the two. We describe each non-option ARGV-element
- as if it were the argument of an option with character code 1.
- Using `-' as the first character of the list of option characters
- selects this mode of operation.
-
- The special argument `--' forces an end of option-scanning regardless
- of the value of `ordering'. In the case of RETURN_IN_ORDER, only
- `--' can cause `getopt' to return EOF with `optind' != ARGC. */
-
-static enum
-{
- REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
-} ordering;
-
-#ifdef __GNU_LIBRARY__
-/* We want to avoid inclusion of string.h with non-GNU libraries
- because there are many ways it can cause trouble.
- On some systems, it contains special magic macros that don't work
- in GCC. */
-#include <string.h>
-#define my_index strchr
-#else
-
-/* Avoid depending on library functions or files
- whose names are inconsistent. */
-
-char *getenv ();
-
-static char *
-my_index (str, chr)
- const char *str;
- int chr;
-{
- while (*str)
- {
- if (*str == chr)
- return (char *) str;
- str++;
- }
- return 0;
-}
-
-/* If using GCC, we can safely declare strlen this way.
- If not using GCC, it is ok not to declare it.
- (Supposedly there are some machines where it might get a warning,
- but changing this conditional to __STDC__ is too risky.) */
-#ifdef __GNUC__
-#ifdef IN_GCC
-#include "gstddef.h"
-#else
-#include <stddef.h>
-#endif
-extern size_t strlen (const char *);
-#endif
-
-#endif /* GNU C library. */
-
-/* Handle permutation of arguments. */
-
-/* Describe the part of ARGV that contains non-options that have
- been skipped. `first_nonopt' is the index in ARGV of the first of them;
- `last_nonopt' is the index after the last of them. */
-
-static int first_nonopt;
-static int last_nonopt;
-
-/* Exchange two adjacent subsequences of ARGV.
- One subsequence is elements [first_nonopt,last_nonopt)
- which contains all the non-options that have been skipped so far.
- The other is elements [last_nonopt,optind), which contains all
- the options processed since those non-options were skipped.
-
- `first_nonopt' and `last_nonopt' are relocated so that they describe
- the new indices of the non-options in ARGV after they are moved. */
-
-static void
-exchange (argv)
- char **argv;
-{
- int bottom = first_nonopt;
- int middle = last_nonopt;
- int top = optind;
- char *tem;
-
- /* Exchange the shorter segment with the far end of the longer segment.
- That puts the shorter segment into the right place.
- It leaves the longer segment in the right place overall,
- but it consists of two parts that need to be swapped next. */
-
- while (top > middle && middle > bottom)
- {
- if (top - middle > middle - bottom)
- {
- /* Bottom segment is the short one. */
- int len = middle - bottom;
- register int i;
-
- /* Swap it with the top part of the top segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[top - (middle - bottom) + i];
- argv[top - (middle - bottom) + i] = tem;
- }
- /* Exclude the moved bottom segment from further swapping. */
- top -= len;
- }
- else
- {
- /* Top segment is the short one. */
- int len = top - middle;
- register int i;
-
- /* Swap it with the bottom part of the bottom segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[middle + i];
- argv[middle + i] = tem;
- }
- /* Exclude the moved top segment from further swapping. */
- bottom += len;
- }
- }
-
- /* Update records for the slots the non-options now occupy. */
-
- first_nonopt += (optind - last_nonopt);
- last_nonopt = optind;
-}
-
-/* Scan elements of ARGV (whose length is ARGC) for option characters
- given in OPTSTRING.
-
- If an element of ARGV starts with '-', and is not exactly "-" or "--",
- then it is an option element. The characters of this element
- (aside from the initial '-') are option characters. If `getopt'
- is called repeatedly, it returns successively each of the option characters
- from each of the option elements.
-
- If `getopt' finds another option character, it returns that character,
- updating `optind' and `nextchar' so that the next call to `getopt' can
- resume the scan with the following option character or ARGV-element.
-
- If there are no more option characters, `getopt' returns `EOF'.
- Then `optind' is the index in ARGV of the first ARGV-element
- that is not an option. (The ARGV-elements have been permuted
- so that those that are not options now come last.)
-
- OPTSTRING is a string containing the legitimate option characters.
- If an option character is seen that is not listed in OPTSTRING,
- return '?' after printing an error message. If you set `opterr' to
- zero, the error message is suppressed but we still return '?'.
-
- If a char in OPTSTRING is followed by a colon, that means it wants an arg,
- so the following text in the same ARGV-element, or the text of the following
- ARGV-element, is returned in `optarg'. Two colons mean an option that
- wants an optional arg; if there is text in the current ARGV-element,
- it is returned in `optarg', otherwise `optarg' is set to zero.
-
- If OPTSTRING starts with `-' or `+', it requests different methods of
- handling the non-option ARGV-elements.
- See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
-
- Long-named options begin with `--' instead of `-'.
- Their names may be abbreviated as long as the abbreviation is unique
- or is an exact match for some defined option. If they have an
- argument, it follows the option name in the same ARGV-element, separated
- from the option name by a `=', or else the in next ARGV-element.
- When `getopt' finds a long-named option, it returns 0 if that option's
- `flag' field is nonzero, the value of the option's `val' field
- if the `flag' field is zero.
-
- The elements of ARGV aren't really const, because we permute them.
- But we pretend they're const in the prototype to be compatible
- with other systems.
-
- LONGOPTS is a vector of `struct option' terminated by an
- element containing a name which is zero.
-
- LONGIND returns the index in LONGOPT of the long-named option found.
- It is only valid when a long-named option has been found by the most
- recent call.
-
- If LONG_ONLY is nonzero, '-' as well as '--' can introduce
- long-named options. */
-
-int
-_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
- int argc;
- char *const *argv;
- const char *optstring;
- const struct option *longopts;
- int *longind;
- int long_only;
-{
- int option_index;
-
- optarg = 0;
-
- /* Initialize the internal data when the first call is made.
- Start processing options with ARGV-element 1 (since ARGV-element 0
- is the program name); the sequence of previously skipped
- non-option ARGV-elements is empty. */
-
- if (optind == 0)
- {
- first_nonopt = last_nonopt = optind = 1;
-
- nextchar = NULL;
-
- /* Determine how to handle the ordering of options and nonoptions. */
-
- if (optstring[0] == '-')
- {
- ordering = RETURN_IN_ORDER;
- ++optstring;
- }
- else if (optstring[0] == '+')
- {
- ordering = REQUIRE_ORDER;
- ++optstring;
- }
- else if (getenv ("POSIXLY_CORRECT") != NULL)
- ordering = REQUIRE_ORDER;
- else
- ordering = PERMUTE;
- }
-
- if (nextchar == NULL || *nextchar == '\0')
- {
- if (ordering == PERMUTE)
- {
- /* If we have just processed some options following some non-options,
- exchange them so that the options come first. */
-
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange ((char **) argv);
- else if (last_nonopt != optind)
- first_nonopt = optind;
-
- /* Now skip any additional non-options
- and extend the range of non-options previously skipped. */
-
- while (optind < argc
- && (argv[optind][0] != '-' || argv[optind][1] == '\0')
-#ifdef GETOPT_COMPAT
- && (longopts == NULL
- || argv[optind][0] != '+' || argv[optind][1] == '\0')
-#endif /* GETOPT_COMPAT */
- )
- optind++;
- last_nonopt = optind;
- }
-
- /* Special ARGV-element `--' means premature end of options.
- Skip it like a null option,
- then exchange with previous non-options as if it were an option,
- then skip everything else like a non-option. */
-
- if (optind != argc && !strcmp (argv[optind], "--"))
- {
- optind++;
-
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange ((char **) argv);
- else if (first_nonopt == last_nonopt)
- first_nonopt = optind;
- last_nonopt = argc;
-
- optind = argc;
- }
-
- /* If we have done all the ARGV-elements, stop the scan
- and back over any non-options that we skipped and permuted. */
-
- if (optind == argc)
- {
- /* Set the next-arg-index to point at the non-options
- that we previously skipped, so the caller will digest them. */
- if (first_nonopt != last_nonopt)
- optind = first_nonopt;
- return EOF;
- }
-
- /* If we have come to a non-option and did not permute it,
- either stop the scan or describe it to the caller and pass it by. */
-
- if ((argv[optind][0] != '-' || argv[optind][1] == '\0')
-#ifdef GETOPT_COMPAT
- && (longopts == NULL
- || argv[optind][0] != '+' || argv[optind][1] == '\0')
-#endif /* GETOPT_COMPAT */
- )
- {
- if (ordering == REQUIRE_ORDER)
- return EOF;
- optarg = argv[optind++];
- return 1;
- }
-
- /* We have found another option-ARGV-element.
- Start decoding its characters. */
-
- nextchar = (argv[optind] + 1
- + (longopts != NULL && argv[optind][1] == '-'));
- }
-
- if (longopts != NULL
- && ((argv[optind][0] == '-'
- && (argv[optind][1] == '-' || long_only))
-#ifdef GETOPT_COMPAT
- || argv[optind][0] == '+'
-#endif /* GETOPT_COMPAT */
- ))
- {
- const struct option *p;
- char *s = nextchar;
- int exact = 0;
- int ambig = 0;
- const struct option *pfound = NULL;
- int indfound;
-
- while (*s && *s != '=')
- s++;
-
- /* Test all options for either exact match or abbreviated matches. */
- for (p = longopts, option_index = 0; p->name;
- p++, option_index++)
- if (!strncmp (p->name, nextchar, s - nextchar))
- {
- if (s - nextchar == strlen (p->name))
- {
- /* Exact match found. */
- pfound = p;
- indfound = option_index;
- exact = 1;
- break;
- }
- else if (pfound == NULL)
- {
- /* First nonexact match found. */
- pfound = p;
- indfound = option_index;
- }
- else
- /* Second nonexact match found. */
- ambig = 1;
- }
-
- if (ambig && !exact)
- {
- if (opterr)
- fprintf (stderr, "%s: option `%s' is ambiguous\n",
- argv[0], argv[optind]);
- nextchar += strlen (nextchar);
- optind++;
- return '?';
- }
-
- if (pfound != NULL)
- {
- option_index = indfound;
- optind++;
- if (*s)
- {
- /* Don't test has_arg with >, because some C compilers don't
- allow it to be used on enums. */
- if (pfound->has_arg)
- optarg = s + 1;
- else
- {
- if (opterr)
- {
- if (argv[optind - 1][1] == '-')
- /* --option */
- fprintf (stderr,
- "%s: option `--%s' doesn't allow an argument\n",
- argv[0], pfound->name);
- else
- /* +option or -option */
- fprintf (stderr,
- "%s: option `%c%s' doesn't allow an argument\n",
- argv[0], argv[optind - 1][0], pfound->name);
- }
- nextchar += strlen (nextchar);
- return '?';
- }
- }
- else if (pfound->has_arg == 1)
- {
- if (optind < argc)
- optarg = argv[optind++];
- else
- {
- if (opterr)
- fprintf (stderr, "%s: option `%s' requires an argument\n",
- argv[0], argv[optind - 1]);
- nextchar += strlen (nextchar);
- return optstring[0] == ':' ? ':' : '?';
- }
- }
- nextchar += strlen (nextchar);
- if (longind != NULL)
- *longind = option_index;
- if (pfound->flag)
- {
- *(pfound->flag) = pfound->val;
- return 0;
- }
- return pfound->val;
- }
- /* Can't find it as a long option. If this is not getopt_long_only,
- or the option starts with '--' or is not a valid short
- option, then it's an error.
- Otherwise interpret it as a short option. */
- if (!long_only || argv[optind][1] == '-'
-#ifdef GETOPT_COMPAT
- || argv[optind][0] == '+'
-#endif /* GETOPT_COMPAT */
- || my_index (optstring, *nextchar) == NULL)
- {
- if (opterr)
- {
- if (argv[optind][1] == '-')
- /* --option */
- fprintf (stderr, "%s: unrecognized option `--%s'\n",
- argv[0], nextchar);
- else
- /* +option or -option */
- fprintf (stderr, "%s: unrecognized option `%c%s'\n",
- argv[0], argv[optind][0], nextchar);
- }
- nextchar = (char *) "";
- optind++;
- return '?';
- }
- }
-
- /* Look at and handle the next option-character. */
-
- {
- char c = *nextchar++;
- char *temp = my_index (optstring, c);
-
- /* Increment `optind' when we start to process its last character. */
- if (*nextchar == '\0')
- ++optind;
-
- if (temp == NULL || c == ':')
- {
- if (opterr)
- {
-#if 0
- if (c < 040 || c >= 0177)
- fprintf (stderr, "%s: unrecognized option, character code 0%o\n",
- argv[0], c);
- else
- fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c);
-#else
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c);
-#endif
- }
- optopt = c;
- return '?';
- }
- if (temp[1] == ':')
- {
- if (temp[2] == ':')
- {
- /* This is an option that accepts an argument optionally. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- optind++;
- }
- else
- optarg = 0;
- nextchar = NULL;
- }
- else
- {
- /* This is an option that requires an argument. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- /* If we end this ARGV-element by taking the rest as an arg,
- we must advance to the next element now. */
- optind++;
- }
- else if (optind == argc)
- {
- if (opterr)
- {
-#if 0
- fprintf (stderr, "%s: option `-%c' requires an argument\n",
- argv[0], c);
-#else
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr, "%s: option requires an argument -- %c\n",
- argv[0], c);
-#endif
- }
- optopt = c;
- if (optstring[0] == ':')
- c = ':';
- else
- c = '?';
- }
- else
- /* We already incremented `optind' once;
- increment it again when taking next ARGV-elt as argument. */
- optarg = argv[optind++];
- nextchar = NULL;
- }
- }
- return c;
- }
-}
-
-int
-getopt (argc, argv, optstring)
- int argc;
- char *const *argv;
- const char *optstring;
-{
- return _getopt_internal (argc, argv, optstring,
- (const struct option *) 0,
- (int *) 0,
- 0);
-}
-
-#endif /* _LIBC or not __GNU_LIBRARY__. */
-
-#ifdef TEST
-
-/* Compile with -DTEST to make an executable for use in testing
- the above definition of `getopt'. */
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int c;
- int digit_optind = 0;
-
- while (1)
- {
- int this_option_optind = optind ? optind : 1;
-
- c = getopt (argc, argv, "abc:d:0123456789");
- if (c == EOF)
- break;
-
- switch (c)
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf ("option %c\n", c);
- break;
-
- case 'a':
- printf ("option a\n");
- break;
-
- case 'b':
- printf ("option b\n");
- break;
-
- case 'c':
- printf ("option c with value `%s'\n", optarg);
- break;
-
- case '?':
- break;
-
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
- }
- }
-
- if (optind < argc)
- {
- printf ("non-option ARGV-elements: ");
- while (optind < argc)
- printf ("%s ", argv[optind++]);
- printf ("\n");
- }
-
- exit (0);
-}
-
-#endif /* TEST */
diff --git a/gnu/usr.bin/pr/getopt1.c b/gnu/usr.bin/pr/getopt1.c
deleted file mode 100644
index f784b57..0000000
--- a/gnu/usr.bin/pr/getopt1.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/* getopt_long and getopt_long_only entry points for GNU getopt.
- Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
- Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2, or (at your option) any
- later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifdef HAVE_CONFIG_H
-#if defined (emacs) || defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
-#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
-#include "getopt.h"
-
-#ifndef __STDC__
-/* This is a separate conditional since some stdc systems
- reject `defined (const)'. */
-#ifndef const
-#define const
-#endif
-#endif
-
-#include <stdio.h>
-
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself. This code is part of the GNU C
- Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object files,
- it is simpler to just do this in the source for each such file. */
-
-#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
-
-
-/* This needs to come after some library #include
- to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
-#include <stdlib.h>
-#else
-char *getenv ();
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-int
-getopt_long (argc, argv, options, long_options, opt_index)
- int argc;
- char *const *argv;
- const char *options;
- const struct option *long_options;
- int *opt_index;
-{
- return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
-}
-
-/* Like getopt_long, but '-' as well as '--' can indicate a long option.
- If an option that starts with '-' (not '--') doesn't match a long option,
- but does match a short option, it is parsed as a short option
- instead. */
-
-int
-getopt_long_only (argc, argv, options, long_options, opt_index)
- int argc;
- char *const *argv;
- const char *options;
- const struct option *long_options;
- int *opt_index;
-{
- return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
-}
-
-
-#endif /* _LIBC or not __GNU_LIBRARY__. */
-
-#ifdef TEST
-
-#include <stdio.h>
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int c;
- int digit_optind = 0;
-
- while (1)
- {
- int this_option_optind = optind ? optind : 1;
- int option_index = 0;
- static struct option long_options[] =
- {
- {"add", 1, 0, 0},
- {"append", 0, 0, 0},
- {"delete", 1, 0, 0},
- {"verbose", 0, 0, 0},
- {"create", 0, 0, 0},
- {"file", 1, 0, 0},
- {0, 0, 0, 0}
- };
-
- c = getopt_long (argc, argv, "abc:d:0123456789",
- long_options, &option_index);
- if (c == EOF)
- break;
-
- switch (c)
- {
- case 0:
- printf ("option %s", long_options[option_index].name);
- if (optarg)
- printf (" with arg %s", optarg);
- printf ("\n");
- break;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf ("option %c\n", c);
- break;
-
- case 'a':
- printf ("option a\n");
- break;
-
- case 'b':
- printf ("option b\n");
- break;
-
- case 'c':
- printf ("option c with value `%s'\n", optarg);
- break;
-
- case 'd':
- printf ("option d with value `%s'\n", optarg);
- break;
-
- case '?':
- break;
-
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
- }
- }
-
- if (optind < argc)
- {
- printf ("non-option ARGV-elements: ");
- while (optind < argc)
- printf ("%s ", argv[optind++]);
- printf ("\n");
- }
-
- exit (0);
-}
-
-#endif /* TEST */
diff --git a/gnu/usr.bin/pr/pr.1 b/gnu/usr.bin/pr/pr.1
deleted file mode 100644
index 814f4e1..0000000
--- a/gnu/usr.bin/pr/pr.1
+++ /dev/null
@@ -1,103 +0,0 @@
-.TH PR 1L \" -*- nroff -*-
-.SH NAME
-pr \- convert text files for printing
-.SH SYNOPSIS
-.B pr
-[+PAGE] [\-COLUMN] [\-abcdfFmrtv] [\-e[in-tab-char[in-tab-width]]]
-[\-h header] [\-i[out-tab-char[out-tab-width]]] [\-l page-length]
-[\-n[number-separator[digits]]] [\-o left-margin]
-[\-s[column-separator]] [\-w page-width] [\-\-help] [\-\-version] [file...]
-.SH DESCRIPTION
-This manual page
-documents the GNU version of
-.BR pr .
-.B pr
-prints on the standard output a paginated and optionally multicolumn
-copy of the text files given on the command line, or of the standard
-input if no files are given or when the file name `\-' is encountered.
-Form feeds in the input cause page breaks in the output.
-.SS OPTIONS
-.TP
-.I \+PAGE
-Begin printing with page \fIPAGE\fP.
-.TP
-.I \-COLUMN
-Produce \fICOLUMN\fP-column output and print columns down. The column
-width is automatically decreased as \fICOLUMN\fP increases; unless you
-use the \fI\-w\fP option to increase the page width as well, this
-option might cause some columns to be truncated.
-.TP
-.I \-a
-Print columns across rather than down.
-.TP
-.I \-b
-Balance columns on the last page.
-.TP
-.I \-c
-Print control characters using hat notation (e.g., `^G'); print other
-unprintable characters in octal backslash notation.
-.TP
-.I \-d
-Double space the output.
-.TP
-.I "\-e[in-tab-char[in-tab-width]]"
-Expand tabs to spaces on input. Optional argument \fIin-tab-char\fP
-is the input tab character, default tab. Optional argument
-\fIin-tab-width\fP is the input tab character's width, default 8.
-.TP
-.I "\-F, \-f"
-Use a formfeed instead of newlines to separate output pages.
-.TP
-.I "\-h header"
-Replace the filename in the header with the string \fIheader\fP.
-.TP
-.I "\-\-help"
-Print a usage message and exit with a non-zero status.
-.TP
-.I "\-i[out-tab-char[out-tab-width]]"
-Replace spaces with tabs on output. Optional argument
-\fIout-tab-char\fP is the output tab character, default tab.
-Optional argument \fIout-tab-width\fP is the output tab character's
-width, default 8.
-.TP
-.I "\-l page-length"
-Set the page length to \fIpage-length\fP lines. The default is 66.
-If \fIpage-length\fP is less than 10, the headers and footers are
-omitted, as if the \fI\-t\fP option had been given.
-.TP
-.I \-m
-Print all files in parallel, one in each column.
-.TP
-.I "\-n[number-separator[digits]]"
-Precede each column with a line number; with parallel files, precede
-each line with a line number. Optional argument
-\fInumber-separator\fP is the character to print after each number,
-default tab. Optional argument \fIdigits\fP is the number of digits
-per line number, default 5.
-.TP
-.I "\-o left-margin"
-Offset each line with a margin \fIleft-margin\fP spaces wide. The
-total page width is this offset plus the width set with the \fI\-w\fP
-option.
-.TP
-.I \-r
-Do not print a warning message when an argument file cannot be opened.
-Failure to open a file still makes the exit status nonzero, however.
-.TP
-.I "\-s[column-separator]"
-Separate columns by the single character \fIcolumn-separator\fP,
-default tab, instead of spaces.
-.TP
-.I \-t
-Do not print the 5-line header and the 5-line trailer that are
-normally on each page, and do not fill out the bottoms of pages (with
-blank lines or formfeeds).
-.TP
-.I \-v
-Print unprintable characters in octal backslash notation.
-.TP
-.I "\-\-version"
-Print version information on standard output then exit.
-.TP
-.I "\-w page-width"
-Set the page width to \fIpage-width\fP columns. The default is 72.
diff --git a/gnu/usr.bin/pr/pr.c b/gnu/usr.bin/pr/pr.c
deleted file mode 100644
index 8ecc2c6..0000000
--- a/gnu/usr.bin/pr/pr.c
+++ /dev/null
@@ -1,1920 +0,0 @@
-/* pr -- convert text files for printing.
- Copyright (C) 1988, 1991 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Author: Pete TerMaat. */
-
-/* Things to watch: Sys V screws up on ...
- pr -n -3 -s: /usr/dict/words
- pr -m -o10 -n /usr/dict/words{,,,}
- pr -6 -a -n -o5 /usr/dict/words
-
- Ideas:
-
- Keep a things_to_do list of functions to call when we know we have
- something to print. Cleaner than current series of checks.
-
- Improve the printing of control prefixes.
-
-
- Options:
-
- +PAGE Begin output at page PAGE of the output.
-
- -COLUMN Produce output that is COLUMN columns wide and print
- columns down.
-
- -a Print columns across rather than down. The input
- one
- two
- three
- four
- will be printed as
- one two three
- four
-
- -b Balance columns on the last page.
-
- -c Print unprintable characters as control prefixes.
- Control-g is printed as ^G.
-
- -d Double space the output.
-
- -e[c[k]] Expand tabs to spaces on input. Optional argument C
- is the input tab character. (Default is `\t'.) Optional
- argument K is the input tab character's width. (Default is 8.)
-
- -F
- -f Use formfeeds instead of newlines to separate pages.
-
- -h header Replace the filename in the header with the string HEADER.
-
- -i[c[k]] Replace spaces with tabs on output. Optional argument
- C is the output tab character. (Default is `\t'.) Optional
- argument K is the output tab character's width. (Default
- is 8.)
-
- -l lines Set the page length to LINES. Default is 66.
-
- -m Print files in parallel.
-
- -n[c[k]] Precede each column with a line number.
- (With parallel files, precede each line with a line
- number.) Optional argument C is the character to print
- after each number. (Default `\t'.) Optional argument
- K is the number of digits per line number. (Default 5.)
-
- -o offset Offset each line with a margin OFFSET spaces wide.
- Total page width is the size of this offset plus the
- width set with `-w'.
-
- -r Ignore files that can't be opened.
-
- -s[c] Separate each line with a character. Optional argument C is
- the character to be used. Default is `\t'.
-
- -t Do not print headers or footers.
-
- -v Print unprintable characters as escape sequences.
- Control-G becomes \007.
-
- -w width Set the page width to WIDTH characters. */
-
-
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
-#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
-#include <stdio.h>
-#include <getopt.h>
-#include <sys/types.h>
-#include <time.h>
-#include "system.h"
-#include "version.h"
-
-char *xmalloc ();
-char *xrealloc ();
-void error ();
-
-static int char_to_clump ();
-static int read_line ();
-static int print_page ();
-static int print_stored ();
-static int open_file ();
-static int skip_to_page ();
-static void getoptarg ();
-static void usage ();
-static void print_files ();
-static void init_header ();
-static void init_store_cols ();
-static void store_columns ();
-static void balance ();
-static void store_char ();
-static void pad_down ();
-static void read_rest_of_line ();
-static void print_char ();
-static void cleanup ();
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-
-/* Used with start_position in the struct COLUMN described below.
- If start_position == ANYWHERE, we aren't truncating columns and
- can begin printing a column anywhere. Otherwise we must pad to
- the horizontal position start_position. */
-#define ANYWHERE 0
-
-/* Each column has one of these structures allocated for it.
- If we're only dealing with one file, fp is the same for all
- columns.
-
- The general strategy is to spend time setting up these column
- structures (storing columns if necessary), after which printing
- is a matter of flitting from column to column and calling
- print_func.
-
- Parallel files, single files printing across in multiple
- columns, and single files printing down in multiple columns all
- fit the same printing loop.
-
- print_func Function used to print lines in this column.
- If we're storing this column it will be
- print_stored(), Otherwise it will be read_line().
-
- char_func Function used to process characters in this column.
- If we're storing this column it will be store_char(),
- otherwise it will be print_char().
-
- current_line Index of the current entry in line_vector, which
- contains the index of the first character of the
- current line in buff[].
-
- lines_stored Number of lines in this column which are stored in
- buff.
-
- lines_to_print If we're storing this column, lines_to_print is
- the number of stored_lines which remain to be
- printed. Otherwise it is the number of lines
- we can print without exceeding lines_per_body.
-
- start_position The horizontal position we want to be in before we
- print the first character in this column.
-
- numbered True means precede this column with a line number. */
-
-struct COLUMN
-{
- FILE *fp; /* Input stream for this column. */
- char *name; /* File name. */
- enum
- {
- OPEN,
- ON_HOLD, /* Hit a form feed. */
- CLOSED
- } status; /* Status of the file pointer. */
- int (*print_func) (); /* Func to print lines in this col. */
- void (*char_func) (); /* Func to print/store chars in this col. */
- int current_line; /* Index of current place in line_vector. */
- int lines_stored; /* Number of lines stored in buff. */
- int lines_to_print; /* No. lines stored or space left on page. */
- int start_position; /* Horizontal position of first char. */
- int numbered;
-};
-
-typedef struct COLUMN COLUMN;
-
-#define NULLCOL (COLUMN *)0
-
-/* The name under which this program was invoked. */
-char *program_name;
-
-/* All of the columns to print. */
-static COLUMN *column_vector;
-
-/* When printing a single file in multiple downward columns,
- we store the leftmost columns contiguously in buff.
- To print a line from buff, get the index of the first char
- from line_vector[i], and print up to line_vector[i + 1]. */
-static char *buff;
-
-/* Index of the position in buff where the next character
- will be stored. */
-static int buff_current;
-
-/* The number of characters in buff.
- Used for allocation of buff and to detect overflow of buff. */
-static int buff_allocated;
-
-/* Array of indices into buff.
- Each entry is an index of the first character of a line.
- This is used when storing lines to facilitate shuffling when
- we do column balancing on the last page. */
-static int *line_vector;
-
-/* Array of horizonal positions.
- For each line in line_vector, end_vector[line] is the horizontal
- position we are in after printing that line. We keep track of this
- so that we know how much we need to pad to prepare for the next
- column. */
-static int *end_vector;
-
-/* (-m) True means we're printing multiple files in parallel. */
-static int parallel_files = FALSE;
-
-/* (-[0-9]+) True means we're given an option explicitly specifying
- number of columns. Used to detect when this option is used with -m. */
-static int explicit_columns = FALSE;
-
-/* (-t) True means we're printing headers and footers. */
-static int extremities = TRUE;
-
-/* True means we need to print a header as soon as we know we've got input
- to print after it. */
-static int print_a_header;
-
-/* (-h) True means we're using the standard header rather than a
- customized one specified by the -h flag. */
-static int standard_header = TRUE;
-
-/* (-f) True means use formfeeds instead of newlines to separate pages. */
-static int use_form_feed = FALSE;
-
-/* True means we have read the standard input. */
-static int have_read_stdin = FALSE;
-
-/* True means the -a flag has been given. */
-static int print_across_flag = FALSE;
-
-/* True means we're printing one file in multiple (>1) downward columns. */
-static int storing_columns = TRUE;
-
-/* (-b) True means balance columns on the last page as Sys V does. */
-static int balance_columns = FALSE;
-
-/* (-l) Number of lines on a page, including header and footer lines. */
-static int lines_per_page = 66;
-
-/* Number of lines in the header and footer can be reset to 0 using
- the -t flag. */
-static int lines_per_header = 5;
-static int lines_per_body;
-static int lines_per_footer = 5;
-
-/* (-w) Width in characters of the page. Does not include the width of
- the margin. */
-static int chars_per_line = 72;
-
-/* Number of characters in a column. Based on the gutter and page widths. */
-static int chars_per_column;
-
-/* (-e) True means convert tabs to spaces on input. */
-static int untabify_input = FALSE;
-
-/* (-e) The input tab character. */
-static char input_tab_char = '\t';
-
-/* (-e) Tabstops are at chars_per_tab, 2*chars_per_tab, 3*chars_per_tab, ...
- where the leftmost column is 1. */
-static int chars_per_input_tab = 8;
-
-/* (-i) True means convert spaces to tabs on output. */
-static int tabify_output = FALSE;
-
-/* (-i) The output tab character. */
-static char output_tab_char = '\t';
-
-/* (-i) The width of the output tab. */
-static int chars_per_output_tab = 8;
-
-/* Keeps track of pending white space. When we hit a nonspace
- character after some whitespace, we print whitespace, tabbing
- if necessary to get to output_position + spaces_not_printed. */
-static int spaces_not_printed;
-
-/* Number of spaces between columns (though tabs can be used when possible to
- use up the equivalent amount of space). Not sure if this is worth making
- a flag for. BSD uses 0, Sys V uses 1. Sys V looks better. */
-static int chars_per_gutter = 1;
-
-/* (-o) Number of spaces in the left margin (tabs used when possible). */
-static int chars_per_margin = 0;
-
-/* Position where the next character will fall.
- Leftmost position is 0 + chars_per_margin.
- Rightmost position is chars_per_margin + chars_per_line - 1.
- This is important for converting spaces to tabs on output. */
-static int output_position;
-
-/* Horizontal position relative to the current file.
- (output_position depends on where we are on the page;
- input_position depends on where we are in the file.)
- Important for converting tabs to spaces on input. */
-static int input_position;
-
-/* Count number of failed opens so we can exit with non-zero
- status if there were any. */
-static int failed_opens = 0;
-
-/* The horizontal position we'll be at after printing a tab character
- of width c_ from the position h_. */
-#define pos_after_tab(c_, h_) h_ - h_ % c_ + c_
-
-/* The number of spaces taken up if we print a tab character with width
- c_ from position h_. */
-#define tab_width(c_, h_) - h_ % c_ + c_
-
-/* (-NNN) Number of columns of text to print. */
-static int columns = 1;
-
-/* (+NNN) Page number on which to begin printing. */
-static int first_page_number = 1;
-
-/* Number of files open (not closed, not on hold). */
-static int files_ready_to_read = 0;
-
-/* Current page number. Displayed in header. */
-static int page_number;
-
-/* Current line number. Displayed when -n flag is specified.
-
- When printing files in parallel (-m flag), line numbering is as follows:
- 1 foo goo moo
- 2 hoo too zoo
-
- When printing files across (-a flag), ...
- 1 foo 2 moo 3 goo
- 4 hoo 3 too 6 zoo
-
- Otherwise, line numbering is as follows:
- 1 foo 3 goo 5 too
- 2 moo 4 hoo 6 zoo */
-static int line_number;
-
-/* (-n) True means lines should be preceded by numbers. */
-static int numbered_lines = FALSE;
-
-/* (-n) Character which follows each line number. */
-static char number_separator = '\t';
-
-/* (-n) Width in characters of a line number. */
-static int chars_per_number = 5;
-
-/* Used when widening the first column to accommodate numbers -- only
- needed when printing files in parallel. Includes width of both the
- number and the number_separator. */
-static int number_width;
-
-/* Buffer sprintf uses to format a line number. */
-static char *number_buff;
-
-/* (-v) True means unprintable characters are printed as escape sequences.
- control-g becomes \007. */
-static int use_esc_sequence = FALSE;
-
-/* (-c) True means unprintable characters are printed as control prefixes.
- control-g becomes ^G. */
-static int use_cntrl_prefix = FALSE;
-
-/* (-d) True means output is double spaced. */
-static int double_space = FALSE;
-
-/* Number of files opened initially in init_files. Should be 1
- unless we're printing multiple files in parallel. */
-static int total_files = 0;
-
-/* (-r) True means don't complain if we can't open a file. */
-static int ignore_failed_opens = FALSE;
-
-/* (-s) True means we separate columns with a specified character. */
-static int use_column_separator = FALSE;
-
-/* Character used to separate columns if the the -s flag has been specified. */
-static char column_separator = '\t';
-
-/* Number of separator characters waiting to be printed as soon as we
- know that we have any input remaining to be printed. */
-static int separators_not_printed;
-
-/* Position we need to pad to, as soon as we know that we have input
- remaining to be printed. */
-static int padding_not_printed;
-
-/* True means we should pad the end of the page. Remains false until we
- know we have a page to print. */
-static int pad_vertically;
-
-/* (-h) String of characters used in place of the filename in the header. */
-static char *custom_header;
-
-/* String containing the date, filename or custom header, and "Page ". */
-static char *header;
-
-static int *clump_buff;
-
-/* True means we truncate lines longer than chars_per_column. */
-static int truncate_lines = FALSE;
-
-/* If non-zero, display usage information and exit. */
-static int show_help;
-
-/* If non-zero, print the version on standard output then exit. */
-static int show_version;
-
-static struct option const long_options[] =
-{
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
- {0, 0, 0, 0}
-};
-
-/* Return the number of columns that have either an open file or
- stored lines. */
-
-static int
-cols_ready_to_print ()
-{
- COLUMN *q;
- int i;
- int n;
-
- n = 0;
- for (q = column_vector, i = 0; i < columns; ++q, ++i)
- if (q->status == OPEN ||
- (storing_columns && q->lines_stored > 0 && q->lines_to_print > 0))
- ++n;
- return n;
-}
-
-void
-main (argc, argv)
- int argc;
- char **argv;
-{
- int c;
- int accum = 0;
- int n_files;
- char **file_names;
-
- program_name = argv[0];
-
- n_files = 0;
- file_names = (argc > 1
- ? (char **) xmalloc ((argc - 1) * sizeof (char *))
- : NULL);
-
- while (1)
- {
- c = getopt_long (argc, argv,
- "-0123456789abcde::fFh:i::l:mn::o:rs::tvw:",
- long_options, (int *) 0);
- if (c == 1) /* Non-option argument. */
- {
- char *s;
- s = optarg;
- if (*s == '+')
- {
- ++s;
- if (!ISDIGIT (*s))
- {
- error (0, 0, "`+' requires a numeric argument");
- usage (2);
- }
- /* FIXME: use strtol */
- first_page_number = atoi (s);
- }
- else
- {
- file_names[n_files++] = optarg;
- }
- }
- else
- {
- if (ISDIGIT (c))
- {
- accum = accum * 10 + c - '0';
- continue;
- }
- else
- {
- if (accum > 0)
- {
- columns = accum;
- explicit_columns = TRUE;
- accum = 0;
- }
- }
- }
-
- if (c == 1)
- continue;
-
- if (c == EOF)
- break;
-
- switch (c)
- {
- case 0: /* getopt long option */
- break;
-
- case 'a':
- print_across_flag = TRUE;
- storing_columns = FALSE;
- break;
- case 'b':
- balance_columns = TRUE;
- break;
- case 'c':
- use_cntrl_prefix = TRUE;
- break;
- case 'd':
- double_space = TRUE;
- break;
- case 'e':
- if (optarg)
- getoptarg (optarg, 'e', &input_tab_char,
- &chars_per_input_tab);
- /* Could check tab width > 0. */
- untabify_input = TRUE;
- break;
- case 'f':
- case 'F':
- use_form_feed = TRUE;
- break;
- case 'h':
- custom_header = optarg;
- standard_header = FALSE;
- break;
- case 'i':
- if (optarg)
- getoptarg (optarg, 'i', &output_tab_char,
- &chars_per_output_tab);
- /* Could check tab width > 0. */
- tabify_output = TRUE;
- break;
- case 'l':
- lines_per_page = atoi (optarg);
- break;
- case 'm':
- parallel_files = TRUE;
- storing_columns = FALSE;
- break;
- case 'n':
- numbered_lines = TRUE;
- if (optarg)
- getoptarg (optarg, 'n', &number_separator,
- &chars_per_number);
- break;
- case 'o':
- chars_per_margin = atoi (optarg);
- break;
- case 'r':
- ignore_failed_opens = TRUE;
- break;
- case 's':
- use_column_separator = TRUE;
- if (optarg)
- {
- char *s;
- s = optarg;
- column_separator = *s;
- if (*++s)
- {
- fprintf (stderr, "\
-%s: extra characters in the argument to the `-s' option: `%s'\n",
- program_name, s);
- usage (2);
- }
- }
- break;
- case 't':
- extremities = FALSE;
- break;
- case 'v':
- use_esc_sequence = TRUE;
- break;
- case 'w':
- chars_per_line = atoi (optarg);
- break;
- default:
- usage (2);
- break;
- }
- }
-
- if (show_version)
- {
- printf ("%s\n", version_string);
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
- if (parallel_files && explicit_columns)
- error (1, 0,
- "Cannot specify number of columns when printing in parallel.");
-
- if (parallel_files && print_across_flag)
- error (1, 0,
- "Cannot specify both printing across and printing in parallel.");
-
- for ( ; optind < argc; optind++)
- {
- file_names[n_files++] = argv[optind];
- }
-
- if (n_files == 0)
- {
- /* No file arguments specified; read from standard input. */
- print_files (0, (char **) 0);
- }
- else
- {
- if (parallel_files)
- print_files (n_files, file_names);
- else
- {
- int i;
- for (i=0; i<n_files; i++)
- print_files (1, &file_names[i]);
- }
- }
-
- cleanup ();
-
- if (have_read_stdin && fclose (stdin) == EOF)
- error (1, errno, "standard input");
- if (ferror (stdout) || fclose (stdout) == EOF)
- error (1, errno, "write error");
- if (failed_opens > 0)
- exit(1);
- exit (0);
-}
-
-/* Parse options of the form -scNNN.
-
- Example: -nck, where 'n' is the option, c is the optional number
- separator, and k is the optional width of the field used when printing
- a number. */
-
-static void
-getoptarg (arg, switch_char, character, number)
- char *arg, switch_char, *character;
- int *number;
-{
- if (!ISDIGIT (*arg))
- *character = *arg++;
- if (*arg)
- {
- if (ISDIGIT (*arg))
- *number = atoi (arg);
- else
- {
- fprintf (stderr, "\
-%s: extra characters in the argument to the `-%c' option: `%s'\n",
- program_name, switch_char, arg);
- usage (2);
- }
- }
-}
-
-/* Set parameters related to formatting. */
-
-static void
-init_parameters (number_of_files)
- int number_of_files;
-{
- int chars_used_by_number = 0;
-
- lines_per_body = lines_per_page - lines_per_header - lines_per_footer;
- if (lines_per_body <= 0)
- extremities = FALSE;
- if (extremities == FALSE)
- lines_per_body = lines_per_page;
-
- if (double_space)
- lines_per_body = lines_per_body / 2;
-
- /* If input is stdin, cannot print parallel files. BSD dumps core
- on this. */
- if (number_of_files == 0)
- parallel_files = FALSE;
-
- if (parallel_files)
- columns = number_of_files;
-
- /* Tabification is assumed for multiple columns. */
- if (columns > 1)
- {
- if (!use_column_separator)
- truncate_lines = TRUE;
-
- untabify_input = TRUE;
- tabify_output = TRUE;
- }
- else
- storing_columns = FALSE;
-
- if (numbered_lines)
- {
- if (number_separator == input_tab_char)
- {
- number_width = chars_per_number +
- tab_width (chars_per_input_tab,
- (chars_per_margin + chars_per_number));
- }
- else
- number_width = chars_per_number + 1;
- /* The number is part of the column width unless we are
- printing files in parallel. */
- if (parallel_files)
- chars_used_by_number = number_width;
- }
-
- chars_per_column = (chars_per_line - chars_used_by_number -
- (columns - 1) * chars_per_gutter) / columns;
-
- if (chars_per_column < 1)
- error (1, 0, "page width too narrow");
-
- if (numbered_lines)
- {
- if (number_buff != (char *) 0)
- free (number_buff);
- number_buff = (char *)
- xmalloc (2 * chars_per_number * sizeof (char));
- }
-
- /* Pick the maximum between the tab width and the width of an
- escape sequence. */
- if (clump_buff != (int *) 0)
- free (clump_buff);
- clump_buff = (int *) xmalloc ((chars_per_input_tab > 4
- ? chars_per_input_tab : 4) * sizeof (int));
-}
-
-/* Open the necessary files,
- maintaining a COLUMN structure for each column.
-
- With multiple files, each column p has a different p->fp.
- With single files, each column p has the same p->fp.
- Return 1 if (number_of_files > 0) and no files can be opened,
- 0 otherwise. */
-
-static int
-init_fps (number_of_files, av)
- int number_of_files;
- char **av;
-{
- int i, files_left;
- COLUMN *p;
- FILE *firstfp;
- char *firstname;
-
- total_files = 0;
-
- if (column_vector != NULLCOL)
- free ((char *) column_vector);
- column_vector = (COLUMN *) xmalloc (columns * sizeof (COLUMN));
-
- if (parallel_files)
- {
- files_left = number_of_files;
- for (p = column_vector; files_left--; ++p, ++av)
- {
- if (open_file (*av, p) == 0)
- {
- --p;
- --columns;
- }
- }
- if (columns == 0)
- return 1;
- init_header ("", -1);
- }
- else
- {
- p = column_vector;
- if (number_of_files > 0)
- {
- if (open_file (*av, p) == 0)
- return 1;
- init_header (*av, fileno (p->fp));
- }
- else
- {
- p->name = "standard input";
- p->fp = stdin;
- have_read_stdin = TRUE;
- p->status = OPEN;
- ++total_files;
- init_header ("", -1);
- }
-
- firstname = p->name;
- firstfp = p->fp;
- for (i = columns - 1, ++p; i; --i, ++p)
- {
- p->name = firstname;
- p->fp = firstfp;
- p->status = OPEN;
- }
- }
- files_ready_to_read = total_files;
- return 0;
-}
-
-/* Determine print_func and char_func, the functions
- used by each column for printing and/or storing.
-
- Determine the horizontal position desired when we begin
- printing a column (p->start_position). */
-
-static void
-init_funcs ()
-{
- int i, h, h_next;
- COLUMN *p;
-
- h = chars_per_margin;
-
- if (use_column_separator)
- h_next = ANYWHERE;
- else
- {
- /* When numbering lines of parallel files, we enlarge the
- first column to accomodate the number. Looks better than
- the Sys V approach. */
- if (parallel_files && numbered_lines)
- h_next = h + chars_per_column + number_width;
- else
- h_next = h + chars_per_column;
- }
-
- /* This loop takes care of all but the rightmost column. */
-
- for (p = column_vector, i = 1; i < columns; ++p, ++i)
- {
- if (storing_columns) /* One file, multi columns down. */
- {
- p->char_func = store_char;
- p->print_func = print_stored;
- }
- else
- /* One file, multi columns across; or parallel files. */
- {
- p->char_func = print_char;
- p->print_func = read_line;
- }
-
- /* Number only the first column when printing files in
- parallel. */
- p->numbered = numbered_lines && (!parallel_files || i == 1);
- p->start_position = h;
-
- /* If we're using separators, all start_positions are
- ANYWHERE, except the first column's start_position when
- using a margin. */
-
- if (use_column_separator)
- {
- h = ANYWHERE;
- h_next = ANYWHERE;
- }
- else
- {
- h = h_next + chars_per_gutter;
- h_next = h + chars_per_column;
- }
- }
-
- /* The rightmost column.
-
- Doesn't need to be stored unless we intend to balance
- columns on the last page. */
- if (storing_columns && balance_columns)
- {
- p->char_func = store_char;
- p->print_func = print_stored;
- }
- else
- {
- p->char_func = print_char;
- p->print_func = read_line;
- }
-
- p->numbered = numbered_lines && (!parallel_files || i == 1);
- p->start_position = h;
-}
-
-/* Open a file. Return nonzero if successful, zero if failed. */
-
-static int
-open_file (name, p)
- char *name;
- COLUMN *p;
-{
- if (!strcmp (name, "-"))
- {
- p->name = "standard input";
- p->fp = stdin;
- have_read_stdin = 1;
- }
- else
- {
- p->name = name;
- p->fp = fopen (name, "r");
- }
- if (p->fp == NULL)
- {
- ++failed_opens;
- if (!ignore_failed_opens)
- error (0, errno, "%s", name);
- return 0;
- }
- p->status = OPEN;
- ++total_files;
- return 1;
-}
-
-/* Close the file in P.
-
- If we aren't dealing with multiple files in parallel, we change
- the status of all columns in the column list to reflect the close. */
-
-static void
-close_file (p)
- COLUMN *p;
-{
- COLUMN *q;
- int i;
-
- if (p->status == CLOSED)
- return;
- if (ferror (p->fp))
- error (1, errno, "%s", p->name);
- if (p->fp != stdin && fclose (p->fp) == EOF)
- error (1, errno, "%s", p->name);
-
- if (!parallel_files)
- {
- for (q = column_vector, i = columns; i; ++q, --i)
- {
- q->status = CLOSED;
- if (q->lines_stored == 0)
- {
- q->lines_to_print = 0;
- }
- }
- }
- else
- {
- p->status = CLOSED;
- p->lines_to_print = 0;
- }
-
- --files_ready_to_read;
-}
-
-/* Put a file on hold until we start a new page,
- since we've hit a form feed.
-
- If we aren't dealing with parallel files, we must change the
- status of all columns in the column list. */
-
-static void
-hold_file (p)
- COLUMN *p;
-{
- COLUMN *q;
- int i;
-
- if (!parallel_files)
- for (q = column_vector, i = columns; i; ++q, --i)
- q->status = ON_HOLD;
- else
- p->status = ON_HOLD;
- p->lines_to_print = 0;
- --files_ready_to_read;
-}
-
-/* Undo hold_file -- go through the column list and change any
- ON_HOLD columns to OPEN. Used at the end of each page. */
-
-static void
-reset_status ()
-{
- int i = columns;
- COLUMN *p;
-
- for (p = column_vector; i; --i, ++p)
- if (p->status == ON_HOLD)
- {
- p->status = OPEN;
- files_ready_to_read++;
- }
-}
-
-/* Print a single file, or multiple files in parallel.
-
- Set up the list of columns, opening the necessary files.
- Allocate space for storing columns, if necessary.
- Skip to first_page_number, if user has asked to skip leading pages.
- Determine which functions are appropriate to store/print lines
- in each column.
- Print the file(s). */
-
-static void
-print_files (number_of_files, av)
- int number_of_files;
- char **av;
-{
- init_parameters (number_of_files);
- if (init_fps (number_of_files, av))
- return;
- if (storing_columns)
- init_store_cols ();
-
- if (first_page_number > 1)
- {
- if (!skip_to_page (first_page_number))
- return;
- else
- page_number = first_page_number;
- }
- else
- page_number = 1;
-
- init_funcs ();
-
- line_number = 1;
- while (print_page ())
- ;
-}
-
-/* Generous estimate of number of characters taken up by "Jun 7 00:08 " and
- "Page NNNNN". */
-#define CHARS_FOR_DATE_AND_PAGE 50
-
-/* Initialize header information.
- If DESC is non-negative, it is a file descriptor open to
- FILENAME for reading.
-
- Allocate space for a header string,
- Determine the time, insert file name or user-specified string.
-
- It might be nice to have a "blank headers" option, since
- pr -h "" still prints the date and page number. */
-
-static void
-init_header (filename, desc)
- char *filename;
- int desc;
-{
- int chars_per_header;
- char *f = filename;
- char *t, *middle;
- struct stat st;
-
- if (filename == 0)
- f = "";
-
- /* If parallel files or standard input, use current time. */
- if (desc < 0 || !strcmp (filename, "-") || fstat (desc, &st))
- st.st_mtime = time ((time_t *) 0);
- t = ctime (&st.st_mtime);
-
- t[16] = '\0'; /* Mark end of month and time string. */
- t[24] = '\0'; /* Mark end of year string. */
-
- middle = standard_header ? f : custom_header;
-
- chars_per_header = strlen (middle) + CHARS_FOR_DATE_AND_PAGE + 1;
- if (header != (char *) 0)
- free (header);
- header = (char *) xmalloc (chars_per_header * sizeof (char));
-
- sprintf (header, "%s %s %s Page", &t[4], &t[20], middle);
-}
-
-/* Set things up for printing a page
-
- Scan through the columns ...
- Determine which are ready to print
- (i.e., which have lines stored or open files)
- Set p->lines_to_print appropriately
- (to p->lines_stored if we're storing, or lines_per_body
- if we're reading straight from the file)
- Keep track of this total so we know when to stop printing */
-
-static void
-init_page ()
-{
- int j;
- COLUMN *p;
-
- if (storing_columns)
- {
- store_columns ();
- for (j = columns - 1, p = column_vector; j; --j, ++p)
- {
- p->lines_to_print = p->lines_stored;
- }
-
- /* Last column. */
- if (balance_columns)
- {
- p->lines_to_print = p->lines_stored;
- }
- /* Since we're not balancing columns, we don't need to store
- the rightmost column. Read it straight from the file. */
- else
- {
- if (p->status == OPEN)
- {
- p->lines_to_print = lines_per_body;
- }
- else
- p->lines_to_print = 0;
- }
- }
- else
- for (j = columns, p = column_vector; j; --j, ++p)
- if (p->status == OPEN)
- {
- p->lines_to_print = lines_per_body;
- }
- else
- p->lines_to_print = 0;
-}
-
-/* Print one page.
-
- As long as there are lines left on the page and columns ready to print,
- Scan across the column list
- if the column has stored lines or the file is open
- pad to the appropriate spot
- print the column
- pad the remainder of the page with \n or \f as requested
- reset the status of all files -- any files which where on hold because
- of formfeeds are now put back into the lineup. */
-
-static int
-print_page ()
-{
- int j;
- int lines_left_on_page;
- COLUMN *p;
-
- /* Used as an accumulator (with | operator) of successive values of
- pad_vertically. The trick is to set pad_vertically
- to zero before each run through the inner loop, then after that
- loop, it tells us whether a line was actually printed (whether a
- newline needs to be output -- or two for double spacing). But those
- values have to be accumulated (in pv) so we can invoke pad_down
- properly after the outer loop completes. */
- int pv;
-
- init_page ();
-
- if (cols_ready_to_print () == 0)
- return FALSE;
-
- if (extremities)
- print_a_header = TRUE;
-
- /* Don't pad unless we know a page was printed. */
- pad_vertically = FALSE;
- pv = FALSE;
-
- lines_left_on_page = lines_per_body;
- if (double_space)
- lines_left_on_page *= 2;
-
- while (lines_left_on_page > 0 && cols_ready_to_print () > 0)
- {
- output_position = 0;
- spaces_not_printed = 0;
- separators_not_printed = 0;
- pad_vertically = FALSE;
-
- for (j = 1, p = column_vector; j <= columns; ++j, ++p)
- {
- input_position = 0;
- if (p->lines_to_print > 0)
- {
- padding_not_printed = p->start_position;
-
- if (!(p->print_func) (p))
- read_rest_of_line (p);
- pv |= pad_vertically;
-
- if (use_column_separator)
- ++separators_not_printed;
-
- --p->lines_to_print;
- if (p->lines_to_print <= 0)
- {
- if (cols_ready_to_print () <= 0)
- break;
- }
- }
- }
-
- if (pad_vertically)
- {
- putchar ('\n');
- --lines_left_on_page;
- }
-
- if (double_space && pv && extremities)
- {
- putchar ('\n');
- --lines_left_on_page;
- }
- }
-
- pad_vertically = pv;
-
- if (pad_vertically && extremities)
- pad_down (lines_left_on_page + lines_per_footer);
-
- reset_status (); /* Change ON_HOLD to OPEN. */
-
- return TRUE; /* More pages to go. */
-}
-
-/* Allocate space for storing columns.
-
- This is necessary when printing multiple columns from a single file.
- Lines are stored consecutively in buff, separated by '\0'.
- (We can't use a fixed offset since with the '-s' flag lines aren't
- truncated.)
-
- We maintain a list (line_vector) of pointers to the beginnings
- of lines in buff. We allocate one more than the number of lines
- because the last entry tells us the index of the last character,
- which we need to know in order to print the last line in buff. */
-
-static void
-init_store_cols ()
-{
- int total_lines = lines_per_body * columns;
- int chars_if_truncate = total_lines * (chars_per_column + 1);
-
- if (line_vector != (int *) 0)
- free ((int *) line_vector);
- line_vector = (int *) xmalloc ((total_lines + 1) * sizeof (int *));
-
- if (end_vector != (int *) 0)
- free ((int *) end_vector);
- end_vector = (int *) xmalloc (total_lines * sizeof (int *));
-
- if (buff != (char *) 0)
- free (buff);
- buff_allocated = use_column_separator ? 2 * chars_if_truncate
- : chars_if_truncate; /* Tune this. */
- buff = (char *) xmalloc (buff_allocated * sizeof (char));
-}
-
-/* Store all but the rightmost column.
- (Used when printing a single file in multiple downward columns)
-
- For each column
- set p->current_line to be the index in line_vector of the
- first line in the column
- For each line in the column
- store the line in buff
- add to line_vector the index of the line's first char
- buff_start is the index in buff of the first character in the
- current line. */
-
-static void
-store_columns ()
-{
- int i, j;
- int line = 0;
- int buff_start;
- int last_col; /* The rightmost column which will be saved in buff */
- COLUMN *p;
-
- buff_current = 0;
- buff_start = 0;
-
- if (balance_columns)
- last_col = columns;
- else
- last_col = columns - 1;
-
- for (i = 1, p = column_vector; i <= last_col; ++i, ++p)
- p->lines_stored = 0;
-
- for (i = 1, p = column_vector; i <= last_col && files_ready_to_read;
- ++i, ++p)
- {
- p->current_line = line;
- for (j = lines_per_body; j && files_ready_to_read; --j)
-
- if (p->status == OPEN) /* Redundant. Clean up. */
- {
- input_position = 0;
-
- if (!read_line (p, i))
- read_rest_of_line (p);
-
- if (p->status == OPEN
- || buff_start != buff_current)
- {
- ++p->lines_stored;
- line_vector[line] = buff_start;
- end_vector[line++] = input_position;
- buff_start = buff_current;
- }
- }
- }
-
- /* Keep track of the location of the last char in buff. */
- line_vector[line] = buff_start;
-
- if (balance_columns && p->lines_stored != lines_per_body)
- balance (line);
-}
-
-static void
-balance (total_stored)
- int total_stored;
-{
- COLUMN *p;
- int i, lines;
- int first_line = 0;
-
- for (i = 1, p = column_vector; i <= columns; ++i, ++p)
- {
- lines = total_stored / columns;
- if (i <= total_stored % columns)
- ++lines;
-
- p->lines_stored = lines;
- p->current_line = first_line;
-
- first_line += lines;
- }
-}
-
-/* Store a character in the buffer. */
-
-static void
-store_char (c)
- int c;
-{
- if (buff_current >= buff_allocated)
- {
- /* May be too generous. */
- buff_allocated = 2 * buff_allocated;
- buff = (char *) xrealloc (buff, buff_allocated * sizeof (char));
- }
- buff[buff_current++] = (char) c;
-}
-
-static void
-number (p)
- COLUMN *p;
-{
- int i;
- char *s;
-
- sprintf (number_buff, "%*d", chars_per_number, line_number++);
- s = number_buff;
- for (i = chars_per_number; i > 0; i--)
- (p->char_func) ((int) *s++);
-
- if (number_separator == input_tab_char)
- {
- i = number_width - chars_per_number;
- while (i-- > 0)
- (p->char_func) ((int) ' ');
- }
- else
- (p->char_func) ((int) number_separator);
-
- if (truncate_lines && !parallel_files)
- input_position += number_width;
-}
-
-/* Print (or store) padding until the current horizontal position
- is position. */
-
-static void
-pad_across_to (position)
- int position;
-{
- register int h = output_position;
-
- if (tabify_output)
- spaces_not_printed = position - output_position;
- else
- {
- while (++h <= position)
- putchar (' ');
- output_position = position;
- }
-}
-
-/* Pad to the bottom of the page.
-
- If the user has requested a formfeed, use one.
- Otherwise, use newlines. */
-
-static void
-pad_down (lines)
- int lines;
-{
- register int i;
-
- if (use_form_feed)
- putchar ('\f');
- else
- for (i = lines; i; --i)
- putchar ('\n');
-}
-
-/* Read the rest of the line.
-
- Read from the current column's file until an end of line is
- hit. Used when we've truncated a line and we no longer need
- to print or store its characters. */
-
-static void
-read_rest_of_line (p)
- COLUMN *p;
-{
- register int c;
- FILE *f = p->fp;
-
- while ((c = getc (f)) != '\n')
- {
- if (c == '\f')
- {
- hold_file (p);
- break;
- }
- else if (c == EOF)
- {
- close_file (p);
- break;
- }
- }
-}
-
-/* If we're tabifying output,
-
- When print_char encounters white space it keeps track
- of our desired horizontal position and delays printing
- until this function is called. */
-
-static void
-print_white_space ()
-{
- register int h_new;
- register int h_old = output_position;
- register int goal = h_old + spaces_not_printed;
-
- while (goal - h_old > 1
- && (h_new = pos_after_tab (chars_per_output_tab, h_old)) <= goal)
- {
- putchar (output_tab_char);
- h_old = h_new;
- }
- while (++h_old <= goal)
- putchar (' ');
-
- output_position = goal;
- spaces_not_printed = 0;
-}
-
-/* Print column separators.
-
- We keep a count until we know that we'll be printing a line,
- then print_separators() is called. */
-
-static void
-print_separators ()
-{
- for (; separators_not_printed > 0; --separators_not_printed)
- print_char (column_separator);
-}
-
-/* Print (or store, depending on p->char_func) a clump of N
- characters. */
-
-static void
-print_clump (p, n, clump)
- COLUMN *p;
- int n;
- int *clump;
-{
- while (n--)
- (p->char_func) (*clump++);
-}
-
-/* Print a character.
-
- If we're tabifying, all tabs have been converted to spaces by
- process_char(). Keep a count of consecutive spaces, and when
- a nonspace is encountered, call print_white_space() to print the
- required number of tabs and spaces. */
-
-static void
-print_char (c)
- int c;
-{
- if (tabify_output)
- {
- if (c == ' ')
- {
- ++spaces_not_printed;
- return;
- }
- else if (spaces_not_printed > 0)
- print_white_space ();
-
- /* Nonprintables are assumed to have width 0, except '\b'. */
- if (!ISPRINT (c))
- {
- if (c == '\b')
- --output_position;
- }
- else
- ++output_position;
- }
- putchar (c);
-}
-
-/* Skip to page PAGE before printing. */
-
-static int
-skip_to_page (page)
- int page;
-{
- int n, i, j;
- COLUMN *p;
-
- for (n = 1; n < page; ++n)
- {
- for (i = 1; i <= lines_per_body; ++i)
- {
- for (j = 1, p = column_vector; j <= columns; ++j, ++p)
- read_rest_of_line (p);
- }
- reset_status ();
- }
- return files_ready_to_read > 0;
-}
-
-/* Print a header.
-
- Formfeeds are assumed to use up two lines at the beginning of
- the page. */
-
-static void
-print_header ()
-{
- if (!use_form_feed)
- fprintf (stdout, "\n\n");
-
- output_position = 0;
- pad_across_to (chars_per_margin);
- print_white_space ();
-
- fprintf (stdout, "%s %d\n\n\n", header, page_number++);
-
- print_a_header = FALSE;
- output_position = 0;
-}
-
-/* Print (or store, if p->char_func is store_char()) a line.
-
- Read a character to determine whether we have a line or not.
- (We may hit EOF, \n, or \f)
-
- Once we know we have a line,
- set pad_vertically = TRUE, meaning it's safe
- to pad down at the end of the page, since we do have a page.
- print a header if needed.
- pad across to padding_not_printed if needed.
- print any separators which need to be printed.
- print a line number if it needs to be printed.
-
- Print the clump which corresponds to the first character.
-
- Enter a loop and keep printing until an end of line condition
- exists, or until we exceed chars_per_column.
-
- Return FALSE if we exceed chars_per_column before reading
- an end of line character, TRUE otherwise. */
-
-static int
-read_line (p)
- COLUMN *p;
-{
- register int c, chars;
- int last_input_position;
-
- c = getc (p->fp);
-
- last_input_position = input_position;
- switch (c)
- {
- case '\f':
- hold_file (p);
- return TRUE;
- case EOF:
- close_file (p);
- return TRUE;
- case '\n':
- break;
- default:
- chars = char_to_clump (c);
- }
-
- if (truncate_lines && input_position > chars_per_column)
- {
- input_position = last_input_position;
- return FALSE;
- }
-
- if (p->char_func != store_char)
- {
- pad_vertically = TRUE;
-
- if (print_a_header)
- print_header ();
-
- if (padding_not_printed != ANYWHERE)
- {
- pad_across_to (padding_not_printed);
- padding_not_printed = ANYWHERE;
- }
-
- if (use_column_separator)
- print_separators ();
- }
-
- if (p->numbered)
- number (p);
-
- if (c == '\n')
- return TRUE;
-
- print_clump (p, chars, clump_buff);
-
- for (;;)
- {
- c = getc (p->fp);
-
- switch (c)
- {
- case '\n':
- return TRUE;
- case '\f':
- hold_file (p);
- return TRUE;
- case EOF:
- close_file (p);
- return TRUE;
- }
-
- last_input_position = input_position;
- chars = char_to_clump (c);
- if (truncate_lines && input_position > chars_per_column)
- {
- input_position = last_input_position;
- return FALSE;
- }
-
- print_clump (p, chars, clump_buff);
- }
-}
-
-/* Print a line from buff.
-
- If this function has been called, we know we have something to
- print. Therefore we set pad_vertically to TRUE, print
- a header if necessary, pad across if necessary, and print
- separators if necessary.
-
- Return TRUE, meaning there is no need to call read_rest_of_line. */
-
-static int
-print_stored (p)
- COLUMN *p;
-{
- int line = p->current_line++;
- register char *first = &buff[line_vector[line]];
- register char *last = &buff[line_vector[line + 1]];
-
- pad_vertically = TRUE;
-
- if (print_a_header)
- print_header ();
-
- if (padding_not_printed != ANYWHERE)
- {
- pad_across_to (padding_not_printed);
- padding_not_printed = ANYWHERE;
- }
-
- if (use_column_separator)
- print_separators ();
-
- while (first != last)
- print_char (*first++);
-
- if (spaces_not_printed == 0)
- output_position = p->start_position + end_vector[line];
-
- return TRUE;
-}
-
-/* Convert a character to the proper format and return the number of
- characters in the resulting clump. Increment input_position by
- the width of the clump.
-
- Tabs are converted to clumps of spaces.
- Nonprintable characters may be converted to clumps of escape
- sequences or control prefixes.
-
- Note: the width of a clump is not necessarily equal to the number of
- characters in clump_buff. (e.g, the width of '\b' is -1, while the
- number of characters is 1.) */
-
-static int
-char_to_clump (c)
- int c;
-{
- register int *s = clump_buff;
- register int i;
- char esc_buff[4];
- int width;
- int chars;
-
- if (c == input_tab_char)
- {
- width = tab_width (chars_per_input_tab, input_position);
-
- if (untabify_input)
- {
- for (i = width; i; --i)
- *s++ = ' ';
- chars = width;
- }
- else
- {
- *s = c;
- chars = 1;
- }
-
- }
- else if (!ISPRINT (c))
- {
- if (use_esc_sequence)
- {
- width = 4;
- chars = 4;
- *s++ = '\\';
- sprintf (esc_buff, "%03o", c);
- for (i = 0; i <= 2; ++i)
- *s++ = (int) esc_buff[i];
- }
- else if (use_cntrl_prefix)
- {
- if (c < 0200)
- {
- width = 2;
- chars = 2;
- *s++ = '^';
- *s++ = c ^ 0100;
- }
- else
- {
- width = 4;
- chars = 4;
- *s++ = '\\';
- sprintf (esc_buff, "%03o", c);
- for (i = 0; i <= 2; ++i)
- *s++ = (int) esc_buff[i];
- }
- }
- else if (c == '\b')
- {
- width = -1;
- chars = 1;
- *s = c;
- }
- else
- {
- width = 0;
- chars = 1;
- *s = c;
- }
- }
- else
- {
- width = 1;
- chars = 1;
- *s = c;
- }
-
- input_position += width;
- return chars;
-}
-
-/* We've just printed some files and need to clean up things before
- looking for more options and printing the next batch of files.
-
- Free everything we've xmalloc'ed, except `header'. */
-
-static void
-cleanup ()
-{
- if (number_buff)
- free (number_buff);
- if (clump_buff)
- free (clump_buff);
- if (column_vector)
- free (column_vector);
- if (line_vector)
- free (line_vector);
- if (end_vector)
- free (end_vector);
- if (buff)
- free (buff);
-}
-
-/* Complain, print a usage message, and die. */
-
-static void
-usage (status)
- int status;
-{
- if (status != 0)
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
- else
- {
- printf ("\
-Usage: %s [OPTION]... [FILE]...\n\
-",
- program_name);
- printf ("\
-\n\
- +PAGE begin printing with page PAGE\n\
- -COLUMN produce COLUMN-column output and print columns down\n\
- -F, -f simulate formfeed with newlines on output\n\
- -a print columns across rather than down\n\
- -b balance columns on the last page\n\
- -c use hat notation (^G) and octal backslash notation\n\
- -d double space the output\n\
- -e[CHAR[WIDTH]] expand input CHARs (TABs) to tab WIDTH (8)\n\
- -h HEADER use HEADER instead of filename in page headers\n\
- -i[CHAR[WIDTH]] replace spaces with CHARs (TABs) to tab WIDTH (8)\n\
- -l PAGE_LENGTH set the page length to PAGE_LENGTH (66) lines\n\
- -m print all files in parallel, one in each column\n\
- -n[SEP[DIGITS]] number lines, use DIGITS (5) digits, then SEP (TAB)\n\
- -o MARGIN offset each line with MARGIN spaces (do not affect -w)\n\
- -r inhibit warning when a file cannot be opened\n\
- -s[SEP] separate columns by character SEP (TAB)\n\
- -t inhibit 5-line page headers and trailers\n\
- -v use octal backslash notation\n\
- -w PAGE_WIDTH set page width to PAGE_WIDTH (72) columns\n\
- --help display this help and exit\n\
- --version output version information and exit\n\
-\n\
--t implied by -l N when N < 10. Without -s, columns are separated by\n\
-spaces. With no FILE, or when FILE is -, read standard input.\n\
-");
- }
- exit (status);
-}
diff --git a/gnu/usr.bin/pr/system.h b/gnu/usr.bin/pr/system.h
deleted file mode 100644
index 4aeaaea..0000000
--- a/gnu/usr.bin/pr/system.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/* system-dependent definitions for textutils programs.
- Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Include sys/types.h before this file. */
-
-#include <sys/stat.h>
-
-#ifdef STAT_MACROS_BROKEN
-#ifdef S_ISBLK
-#undef S_ISBLK
-#endif
-#ifdef S_ISCHR
-#undef S_ISCHR
-#endif
-#ifdef S_ISDIR
-#undef S_ISDIR
-#endif
-#ifdef S_ISFIFO
-#undef S_ISFIFO
-#endif
-#ifdef S_ISLNK
-#undef S_ISLNK
-#endif
-#ifdef S_ISMPB
-#undef S_ISMPB
-#endif
-#ifdef S_ISMPC
-#undef S_ISMPC
-#endif
-#ifdef S_ISNWK
-#undef S_ISNWK
-#endif
-#ifdef S_ISREG
-#undef S_ISREG
-#endif
-#ifdef S_ISSOCK
-#undef S_ISSOCK
-#endif
-#endif /* STAT_MACROS_BROKEN. */
-
-#ifndef S_ISREG /* Doesn't have POSIX.1 stat stuff. */
-#define mode_t unsigned short
-#endif
-#if !defined(S_ISBLK) && defined(S_IFBLK)
-#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
-#endif
-#if !defined(S_ISCHR) && defined(S_IFCHR)
-#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
-#endif
-#if !defined(S_ISDIR) && defined(S_IFDIR)
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif
-#if !defined(S_ISREG) && defined(S_IFREG)
-#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-#endif
-#if !defined(S_ISFIFO) && defined(S_IFIFO)
-#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
-#endif
-#if !defined(S_ISLNK) && defined(S_IFLNK)
-#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
-#endif
-#if !defined(S_ISSOCK) && defined(S_IFSOCK)
-#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
-#endif
-#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
-#define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
-#define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
-#endif
-#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
-#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
-#endif
-#if !defined(HAVE_MKFIFO)
-#define mkfifo(path, mode) (mknod ((path), (mode) | S_IFIFO, 0))
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifndef _POSIX_VERSION
-off_t lseek ();
-#endif
-
-#if defined(HAVE_STRING_H) || defined(STDC_HEADERS)
-#if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
-#include <memory.h>
-#endif
-#include <string.h>
-#ifndef index
-#define index strchr
-#endif
-#ifndef rindex
-#define rindex strrchr
-#endif
-/* Don't define bcopy; we need one that can handle overlaps. */
-#ifndef bzero
-#define bzero(s, n) memset ((s), 0, (n))
-#endif
-#ifndef bcmp
-#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
-#endif
-#else
-#include <strings.h>
-char *memchr ();
-#endif
-
-#include <errno.h>
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#else
-char *getenv ();
-extern int errno;
-#endif
-
-#if defined(HAVE_FCNTL_H) || defined(_POSIX_VERSION)
-#include <fcntl.h>
-#else
-#include <sys/file.h>
-#endif
-
-#if !defined(SEEK_SET)
-#define SEEK_SET 0
-#define SEEK_CUR 1
-#define SEEK_END 2
-#endif
-
-#ifndef _POSIX_SOURCE
-#include <sys/param.h>
-#endif
-
-/* Get or fake the disk device blocksize.
- Usually defined by sys/param.h (if at all). */
-#if !defined(DEV_BSIZE) && defined(BSIZE)
-#define DEV_BSIZE BSIZE
-#endif
-#if !defined(DEV_BSIZE) && defined(BBSIZE) /* SGI */
-#define DEV_BSIZE BBSIZE
-#endif
-#ifndef DEV_BSIZE
-#define DEV_BSIZE 4096
-#endif
-
-/* Extract or fake data from a `struct stat'.
- ST_BLKSIZE: Optimal I/O blocksize for the file, in bytes. */
-#ifndef HAVE_ST_BLKSIZE
-# define ST_BLKSIZE(statbuf) DEV_BSIZE
-#else /* HAVE_ST_BLKSIZE */
-/* Some systems, like Sequents, return st_blksize of 0 on pipes. */
-# define ST_BLKSIZE(statbuf) ((statbuf).st_blksize > 0 \
- ? (statbuf).st_blksize : DEV_BSIZE)
-#endif /* HAVE_ST_BLKSIZE */
-
-#ifndef S_ISLNK
-#define lstat stat
-#endif
-
-#ifndef RETSIGTYPE
-#define RETSIGTYPE void
-#endif
-
-#include <ctype.h>
-
-#ifndef isascii
-#define isascii(c) 1
-#endif
-
-#ifdef isblank
-#define ISBLANK(c) (isascii (c) && isblank (c))
-#else
-#define ISBLANK(c) ((c) == ' ' || (c) == '\t')
-#endif
-#ifdef isgraph
-#define ISGRAPH(c) (isascii (c) && isgraph (c))
-#else
-#define ISGRAPH(c) (isascii (c) && isprint (c) && !isspace (c))
-#endif
-
-#define ISPRINT(c) (isascii (c) && isprint (c))
-#define ISDIGIT(c) (isascii (c) && isdigit (c))
-#define ISALNUM(c) (isascii (c) && isalnum (c))
-#define ISALPHA(c) (isascii (c) && isalpha (c))
-#define ISCNTRL(c) (isascii (c) && iscntrl (c))
-#define ISLOWER(c) (isascii (c) && islower (c))
-#define ISPUNCT(c) (isascii (c) && ispunct (c))
-#define ISSPACE(c) (isascii (c) && isspace (c))
-#define ISUPPER(c) (isascii (c) && isupper (c))
-#define ISXDIGIT(c) (isascii (c) && isxdigit (c))
diff --git a/gnu/usr.bin/pr/version.c b/gnu/usr.bin/pr/version.c
deleted file mode 100644
index 64c62b19..0000000
--- a/gnu/usr.bin/pr/version.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
-#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
-#include "version.h"
-const char *version_string = "GNU textutils 1.9";
diff --git a/gnu/usr.bin/pr/xmalloc.c b/gnu/usr.bin/pr/xmalloc.c
deleted file mode 100644
index 58a81b5..0000000
--- a/gnu/usr.bin/pr/xmalloc.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* xmalloc.c -- malloc with out of memory checking
- Copyright (C) 1990, 1991, 1993 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
-#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
-#if __STDC__
-#define VOID void
-#else
-#define VOID char
-#endif
-
-#include <sys/types.h>
-
-#if STDC_HEADERS
-#include <stdlib.h>
-#else
-VOID *malloc ();
-VOID *realloc ();
-void free ();
-#endif
-
-#if __STDC__ && defined (HAVE_VPRINTF)
-void error (int, int, char const *, ...);
-#else
-void error ();
-#endif
-
-/* Allocate N bytes of memory dynamically, with error checking. */
-
-VOID *
-xmalloc (n)
- size_t n;
-{
- VOID *p;
-
- p = malloc (n);
- if (p == 0)
- /* Must exit with 2 for `cmp'. */
- error (2, 0, "virtual memory exhausted");
- return p;
-}
-
-/* Change the size of an allocated block of memory P to N bytes,
- with error checking.
- If P is NULL, run xmalloc.
- If N is 0, run free and return NULL. */
-
-VOID *
-xrealloc (p, n)
- VOID *p;
- size_t n;
-{
- if (p == 0)
- return xmalloc (n);
- if (n == 0)
- {
- free (p);
- return 0;
- }
- p = realloc (p, n);
- if (p == 0)
- /* Must exit with 2 for `cmp'. */
- error (2, 0, "virtual memory exhausted");
- return p;
-}
diff --git a/gnu/usr.bin/ptx/regex.h b/gnu/usr.bin/ptx/regex.h
deleted file mode 100644
index a495005..0000000
--- a/gnu/usr.bin/ptx/regex.h
+++ /dev/null
@@ -1,490 +0,0 @@
-/* Definitions for data structures and routines for the regular
- expression library, version 0.12.
-
- Copyright (C) 1985, 89, 90, 91, 92, 1993 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef __REGEXP_LIBRARY_H__
-#define __REGEXP_LIBRARY_H__
-
-/* POSIX says that <sys/types.h> must be included (by the caller) before
- <regex.h>. */
-
-#ifdef VMS
-/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
- should be there. */
-#include <stddef.h>
-#endif
-
-
-/* The following bits are used to determine the regexp syntax we
- recognize. The set/not-set meanings are chosen so that Emacs syntax
- remains the value 0. The bits are given in alphabetical order, and
- the definitions shifted by one from the previous bit; thus, when we
- add or remove a bit, only one other definition need change. */
-typedef unsigned reg_syntax_t;
-
-/* If this bit is not set, then \ inside a bracket expression is literal.
- If set, then such a \ quotes the following character. */
-#define RE_BACKSLASH_ESCAPE_IN_LISTS (1)
-
-/* If this bit is not set, then + and ? are operators, and \+ and \? are
- literals.
- If set, then \+ and \? are operators and + and ? are literals. */
-#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
-
-/* If this bit is set, then character classes are supported. They are:
- [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
- [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
- If not set, then character classes are not supported. */
-#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
-
-/* If this bit is set, then ^ and $ are always anchors (outside bracket
- expressions, of course).
- If this bit is not set, then it depends:
- ^ is an anchor if it is at the beginning of a regular
- expression or after an open-group or an alternation operator;
- $ is an anchor if it is at the end of a regular expression, or
- before a close-group or an alternation operator.
-
- This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
- POSIX draft 11.2 says that * etc. in leading positions is undefined.
- We already implemented a previous draft which made those constructs
- invalid, though, so we haven't changed the code back. */
-#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
-
-/* If this bit is set, then special characters are always special
- regardless of where they are in the pattern.
- If this bit is not set, then special characters are special only in
- some contexts; otherwise they are ordinary. Specifically,
- * + ? and intervals are only special when not after the beginning,
- open-group, or alternation operator. */
-#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
-
-/* If this bit is set, then *, +, ?, and { cannot be first in an re or
- immediately after an alternation or begin-group operator. */
-#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
-
-/* If this bit is set, then . matches newline.
- If not set, then it doesn't. */
-#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
-
-/* If this bit is set, then . doesn't match NUL.
- If not set, then it does. */
-#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
-
-/* If this bit is set, nonmatching lists [^...] do not match newline.
- If not set, they do. */
-#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
-
-/* If this bit is set, either \{...\} or {...} defines an
- interval, depending on RE_NO_BK_BRACES.
- If not set, \{, \}, {, and } are literals. */
-#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
-
-/* If this bit is set, +, ? and | aren't recognized as operators.
- If not set, they are. */
-#define RE_LIMITED_OPS (RE_INTERVALS << 1)
-
-/* If this bit is set, newline is an alternation operator.
- If not set, newline is literal. */
-#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
-
-/* If this bit is set, then `{...}' defines an interval, and \{ and \}
- are literals.
- If not set, then `\{...\}' defines an interval. */
-#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
-
-/* If this bit is set, (...) defines a group, and \( and \) are literals.
- If not set, \(...\) defines a group, and ( and ) are literals. */
-#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
-
-/* If this bit is set, then \<digit> matches <digit>.
- If not set, then \<digit> is a back-reference. */
-#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
-
-/* If this bit is set, then | is an alternation operator, and \| is literal.
- If not set, then \| is an alternation operator, and | is literal. */
-#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
-
-/* If this bit is set, then an ending range point collating higher
- than the starting range point, as in [z-a], is invalid.
- If not set, then when ending range point collates higher than the
- starting range point, the range is ignored. */
-#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
-
-/* If this bit is set, then an unmatched ) is ordinary.
- If not set, then an unmatched ) is invalid. */
-#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
-
-/* This global variable defines the particular regexp syntax to use (for
- some interfaces). When a regexp is compiled, the syntax used is
- stored in the pattern buffer, so changing this does not affect
- already-compiled regexps. */
-extern reg_syntax_t re_syntax_options;
-
-/* Define combinations of the above bits for the standard possibilities.
- (The [[[ comments delimit what gets put into the Texinfo file, so
- don't delete them!) */
-/* [[[begin syntaxes]]] */
-#define RE_SYNTAX_EMACS 0
-
-#define RE_SYNTAX_AWK \
- (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS \
- | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
- | RE_UNMATCHED_RIGHT_PAREN_ORD)
-
-#define RE_SYNTAX_POSIX_AWK \
- (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)
-
-#define RE_SYNTAX_GREP \
- (RE_BK_PLUS_QM | RE_CHAR_CLASSES \
- | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
- | RE_NEWLINE_ALT)
-
-#define RE_SYNTAX_EGREP \
- (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
- | RE_NEWLINE_ALT | RE_NO_BK_PARENS \
- | RE_NO_BK_VBAR)
-
-#define RE_SYNTAX_POSIX_EGREP \
- (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)
-
-/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
-#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
-
-#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
-
-/* Syntax bits common to both basic and extended POSIX regex syntax. */
-#define _RE_SYNTAX_POSIX_COMMON \
- (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
- | RE_INTERVALS | RE_NO_EMPTY_RANGES)
-
-#define RE_SYNTAX_POSIX_BASIC \
- (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
-
-/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
- RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
- isn't minimal, since other operators, such as \`, aren't disabled. */
-#define RE_SYNTAX_POSIX_MINIMAL_BASIC \
- (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
-
-#define RE_SYNTAX_POSIX_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_VBAR \
- | RE_UNMATCHED_RIGHT_PAREN_ORD)
-
-/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS
- replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added. */
-#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS \
- | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
-/* [[[end syntaxes]]] */
-
-/* Maximum number of duplicates an interval can allow. Some systems
- (erroneously) define this in other header files, but we want our
- value, so remove any previous define. */
-#ifdef RE_DUP_MAX
-#undef RE_DUP_MAX
-#endif
-#define RE_DUP_MAX ((1 << 15) - 1)
-
-
-/* POSIX `cflags' bits (i.e., information for `regcomp'). */
-
-/* If this bit is set, then use extended regular expression syntax.
- If not set, then use basic regular expression syntax. */
-#define REG_EXTENDED 1
-
-/* If this bit is set, then ignore case when matching.
- If not set, then case is significant. */
-#define REG_ICASE (REG_EXTENDED << 1)
-
-/* If this bit is set, then anchors do not match at newline
- characters in the string.
- If not set, then anchors do match at newlines. */
-#define REG_NEWLINE (REG_ICASE << 1)
-
-/* If this bit is set, then report only success or fail in regexec.
- If not set, then returns differ between not matching and errors. */
-#define REG_NOSUB (REG_NEWLINE << 1)
-
-
-/* POSIX `eflags' bits (i.e., information for regexec). */
-
-/* If this bit is set, then the beginning-of-line operator doesn't match
- the beginning of the string (presumably because it's not the
- beginning of a line).
- If not set, then the beginning-of-line operator does match the
- beginning of the string. */
-#define REG_NOTBOL 1
-
-/* Like REG_NOTBOL, except for the end-of-line. */
-#define REG_NOTEOL (1 << 1)
-
-
-/* If any error codes are removed, changed, or added, update the
- `re_error_msg' table in regex.c. */
-typedef enum
-{
- REG_NOERROR = 0, /* Success. */
- REG_NOMATCH, /* Didn't find a match (for regexec). */
-
- /* POSIX regcomp return error codes. (In the order listed in the
- standard.) */
- REG_BADPAT, /* Invalid pattern. */
- REG_ECOLLATE, /* Not implemented. */
- REG_ECTYPE, /* Invalid character class name. */
- REG_EESCAPE, /* Trailing backslash. */
- REG_ESUBREG, /* Invalid back reference. */
- REG_EBRACK, /* Unmatched left bracket. */
- REG_EPAREN, /* Parenthesis imbalance. */
- REG_EBRACE, /* Unmatched \{. */
- REG_BADBR, /* Invalid contents of \{\}. */
- REG_ERANGE, /* Invalid range end. */
- REG_ESPACE, /* Ran out of memory. */
- REG_BADRPT, /* No preceding re for repetition op. */
-
- /* Error codes we've added. */
- REG_EEND, /* Premature end. */
- REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
- REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
-} reg_errcode_t;
-
-/* This data structure represents a compiled pattern. Before calling
- the pattern compiler, the fields `buffer', `allocated', `fastmap',
- `translate', and `no_sub' can be set. After the pattern has been
- compiled, the `re_nsub' field is available. All other fields are
- private to the regex routines. */
-
-struct re_pattern_buffer
-{
-/* [[[begin pattern_buffer]]] */
- /* Space that holds the compiled pattern. It is declared as
- `unsigned char *' because its elements are
- sometimes used as array indexes. */
- unsigned char *buffer;
-
- /* Number of bytes to which `buffer' points. */
- unsigned long allocated;
-
- /* Number of bytes actually used in `buffer'. */
- unsigned long used;
-
- /* Syntax setting with which the pattern was compiled. */
- reg_syntax_t syntax;
-
- /* Pointer to a fastmap, if any, otherwise zero. re_search uses
- the fastmap, if there is one, to skip over impossible
- starting points for matches. */
- char *fastmap;
-
- /* Either a translate table to apply to all characters before
- comparing them, or zero for no translation. The translation
- is applied to a pattern when it is compiled and to a string
- when it is matched. */
- char *translate;
-
- /* Number of subexpressions found by the compiler. */
- size_t re_nsub;
-
- /* Zero if this pattern cannot match the empty string, one else.
- Well, in truth it's used only in `re_search_2', to see
- whether or not we should use the fastmap, so we don't set
- this absolutely perfectly; see `re_compile_fastmap' (the
- `duplicate' case). */
- unsigned can_be_null : 1;
-
- /* If REGS_UNALLOCATED, allocate space in the `regs' structure
- for `max (RE_NREGS, re_nsub + 1)' groups.
- If REGS_REALLOCATE, reallocate space if necessary.
- If REGS_FIXED, use what's there. */
-#define REGS_UNALLOCATED 0
-#define REGS_REALLOCATE 1
-#define REGS_FIXED 2
- unsigned regs_allocated : 2;
-
- /* Set to zero when `regex_compile' compiles a pattern; set to one
- by `re_compile_fastmap' if it updates the fastmap. */
- unsigned fastmap_accurate : 1;
-
- /* If set, `re_match_2' does not return information about
- subexpressions. */
- unsigned no_sub : 1;
-
- /* If set, a beginning-of-line anchor doesn't match at the
- beginning of the string. */
- unsigned not_bol : 1;
-
- /* Similarly for an end-of-line anchor. */
- unsigned not_eol : 1;
-
- /* If true, an anchor at a newline matches. */
- unsigned newline_anchor : 1;
-
-/* [[[end pattern_buffer]]] */
-};
-
-typedef struct re_pattern_buffer regex_t;
-
-
-/* search.c (search_buffer) in Emacs needs this one opcode value. It is
- defined both in `regex.c' and here. */
-#define RE_EXACTN_VALUE 1
-
-/* Type for byte offsets within the string. POSIX mandates this. */
-typedef int regoff_t;
-
-
-/* This is the structure we store register match data in. See
- regex.texinfo for a full description of what registers match. */
-struct re_registers
-{
- unsigned num_regs;
- regoff_t *start;
- regoff_t *end;
-};
-
-
-/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
- `re_match_2' returns information about at least this many registers
- the first time a `regs' structure is passed. */
-#ifndef RE_NREGS
-#define RE_NREGS 30
-#endif
-
-
-/* POSIX specification for registers. Aside from the different names than
- `re_registers', POSIX uses an array of structures, instead of a
- structure of arrays. */
-typedef struct
-{
- regoff_t rm_so; /* Byte offset from string's start to substring's start. */
- regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
-} regmatch_t;
-
-/* Declarations for routines. */
-
-/* To avoid duplicating every routine declaration -- once with a
- prototype (if we are ANSI), and once without (if we aren't) -- we
- use the following macro to declare argument types. This
- unfortunately clutters up the declarations a bit, but I think it's
- worth it. */
-
-#if __STDC__
-
-#define _RE_ARGS(args) args
-
-#else /* not __STDC__ */
-
-#define _RE_ARGS(args) ()
-
-#endif /* not __STDC__ */
-
-/* Sets the current default syntax to SYNTAX, and return the old syntax.
- You can also simply assign to the `re_syntax_options' variable. */
-extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
-
-/* Compile the regular expression PATTERN, with length LENGTH
- and syntax given by the global `re_syntax_options', into the buffer
- BUFFER. Return NULL if successful, and an error string if not. */
-extern const char *re_compile_pattern
- _RE_ARGS ((const char *pattern, int length,
- struct re_pattern_buffer *buffer));
-
-
-/* Compile a fastmap for the compiled pattern in BUFFER; used to
- accelerate searches. Return 0 if successful and -2 if was an
- internal error. */
-extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
-
-
-/* Search in the string STRING (with length LENGTH) for the pattern
- compiled into BUFFER. Start searching at position START, for RANGE
- characters. Return the starting position of the match, -1 for no
- match, or -2 for an internal error. Also return register
- information in REGS (if REGS and BUFFER->no_sub are nonzero). */
-extern int re_search
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
- int length, int start, int range, struct re_registers *regs));
-
-
-/* Like `re_search', but search in the concatenation of STRING1 and
- STRING2. Also, stop searching at index START + STOP. */
-extern int re_search_2
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
- int length1, const char *string2, int length2,
- int start, int range, struct re_registers *regs, int stop));
-
-
-/* Like `re_search', but return how many characters in STRING the regexp
- in BUFFER matched, starting at position START. */
-extern int re_match
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
- int length, int start, struct re_registers *regs));
-
-
-/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
-extern int re_match_2
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
- int length1, const char *string2, int length2,
- int start, struct re_registers *regs, int stop));
-
-
-/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
- ENDS. Subsequent matches using BUFFER and REGS will use this memory
- for recording register information. STARTS and ENDS must be
- allocated with malloc, and must each be at least `NUM_REGS * sizeof
- (regoff_t)' bytes long.
-
- If NUM_REGS == 0, then subsequent matches should allocate their own
- register data.
-
- Unless this function is called, the first search or match using
- PATTERN_BUFFER will allocate its own register data, without
- freeing the old data. */
-extern void re_set_registers
- _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
- unsigned num_regs, regoff_t *starts, regoff_t *ends));
-
-/* 4.2 bsd compatibility. */
-extern char *re_comp _RE_ARGS ((const char *));
-extern int re_exec _RE_ARGS ((const char *));
-
-/* POSIX compatibility. */
-extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags));
-extern int regexec
- _RE_ARGS ((const regex_t *preg, const char *string, size_t nmatch,
- regmatch_t pmatch[], int eflags));
-extern size_t regerror
- _RE_ARGS ((int errcode, const regex_t *preg, char *errbuf,
- size_t errbuf_size));
-extern void regfree _RE_ARGS ((regex_t *preg));
-
-#endif /* not __REGEXP_LIBRARY_H__ */
-
-/*
-Local variables:
-make-backup-files: t
-version-control: t
-trim-versions-without-asking: nil
-End:
-*/
diff --git a/gnu/usr.bin/send-pr/send-pr.info b/gnu/usr.bin/send-pr/send-pr.info
deleted file mode 100644
index 4e98715..0000000
--- a/gnu/usr.bin/send-pr/send-pr.info
+++ /dev/null
@@ -1,1604 +0,0 @@
-This is Info file send-pr.info, produced by Makeinfo-1.55 from the
-input file ./send-pr.texi.
-
-START-INFO-DIR-ENTRY
-* send-pr:: Reporting problems--using send-pr
-END-INFO-DIR-ENTRY
-
- Copyright (C) 1993 Free Software Foundation, Inc.
-
- Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of
-this manual under the conditions for verbatim copying, provided also
-that the entire resulting derived work is distributed under the terms
-of a permission notice identical to this one.
-
- Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions.
-
-
-File: send-pr.info, Node: Top, Next: send-pr in detail, Prev: (DIR), Up: (DIR)
-
-Overview
-********
-
- This manual documents `send-pr', version 3.2, which uses electronic
-mail to submit support questions and problem reports to a central
-Support Site. No body of work is perfect, and support organizations
-understand this; `send-pr' is designed to allow users who have problems
-to submit reports of these problems to sites responsible for supporting
-the products in question, in a defined form which can be read by an
-electronically managed database.
-
- `send-pr' is part of a suite of programs known collectively as
-GNATS, the GNU Problem Report Management System. GNATS consists of
-several programs which, used in concert, formulate and partially
-administer a database of "Problem Reports", or "PRs", at a central
-Support Site. A PR goes through several states in its lifetime; GNATS
-tracks the PR and all information associated with it through each state
-and finally acts as an archive for PRs which have been "closed".
-
- Because `send-pr' exists as a shell (`/bin/sh') script and as an
-Elisp file for use with GNU Emacs, it can be used from any machine on
-your network which can run a shell script and/or Emacs.
-
- In general, you can use any editor and mailer to submit valid Problem
-Reports, as long as the format required by GNATS is preserved.
-`send-pr' automates the process, however, and ensures that certain
-fields necessary for automatic processing are present. `send-pr' is
-strongly recommended for all initial problem-oriented correspondence
-with your Support Site. The organization you submit Problem Reports to
-supplies an address to which further information can be sent; the person
-responsible for the category of the problem you report contacts you
-directly.
-
-* Menu:
-
-* send-pr in detail:: Details about send-pr and GNATS
-* Invoking send-pr:: Editing and sending PRs
-* An Example:: A working example
-* Installing send-pr:: Installing send-pr on your system
-* Index::
-
-
-File: send-pr.info, Node: send-pr in detail, Next: Invoking send-pr, Prev: Top, Up: Top
-
-Details about send-pr and GNATS
-*******************************
-
- A "Problem Report" is a message that describes a problem you are
-having with a body of work. `send-pr' organizes this message into a
-form which can be understood and automatically processed by GNATS, the
-GNU Problem Report Management System. A Problem Report is organized
-into "fields" which contain data describing you, your organization, and
-the problem you are announcing (*note Problem Report format: Fields.).
-Problem Reports go through several defined states in their lifetimes,
-from "open" to "closed" (*note States of Problem Reports: States.).
-
-* Menu:
-
-* States:: States of Problem Reports
-* Fields:: Problem Report format
-
-
-File: send-pr.info, Node: States, Next: Fields, Up: send-pr in detail
-
-States of Problem Reports
-=========================
-
- Each PR goes through a defined series of states between origination
-and closure. The originator of a PR receives notification
-automatically of any state changes.
-
-"open"
- The initial state of a Problem Report. This means the PR has been
- filed and the responsible person(s) notified.
-
-"analyzed"
- The responsible person has analyzed the problem. The analysis
- should contain a preliminary evaluation of the problem and an
- estimate of the amount of time and resources necessary to solve
- the problem. It should also suggest possible workarounds.
-
-"feedback"
- The problem has been solved, and the originator has been given a
- patch or other fix. The PR remains in this state until the
- originator acknowledges that the solution works.
-
-"closed"
- A Problem Report is closed ("the bug stops here") only when any
- changes have been integrated, documented, and tested, and the
- submitter has confirmed the solution.
-
-"suspended"
- Work on the problem has been postponed. This happens if a timely
- solution is not possible or is not cost-effective at the present
- time. The PR continues to exist, though a solution is not being
- actively sought. If the problem cannot be solved at all, it
- should be closed rather than suspended.
-
-
-File: send-pr.info, Node: Fields, Prev: States, Up: send-pr in detail
-
-Problem Report format
-=====================
-
- The format of a PR is designed to reflect the nature of GNATS as a
-database. Information is arranged into "fields", and kept in
-individual records (Problem Reports).
-
- Problem Report fields are denoted by a keyword which begins with `>'
-and ends with `:', as in `>Confidential:'. Fields belong to one of
-three data types:
-
-ENUMERATED
- One of a specific set of values, which vary according to the
- field. The value for each keyword must be on the same line as the
- keyword. These values are not configurable (yet).
-
- For each ENUMERATED keyword, the possible choices are listed in the
- `send-pr' template as a comment. The following fields are
- ENUMERATED format; see the descriptions of fields below for
- explanations of each field in detail:
-
- >Confidential: >Severity: >Priority:
- >Class: >State: >Number:
-
-TEXT
- One single line of text which must begin and end on the same line
- (i.e., before a newline) as the keyword. See the descriptions of
- fields below for explanations of each field in detail. The
- following fields are TEXT format:
-
- >Submitter-Id: >Originator: >Synopsis:
- >Category: >Release: >Responsible:
- >Arrival-Date:
-
-MULTITEXT
- Text of any length may occur in this field. MULTITEXT may span
- multiple lines and may also include blank lines. A MULTITEXT field
- ends only when another keyword appears. See the descriptions of
- fields below for explanations of each field in detail.
-
- The following fields are MULTITEXT format:
-
- >Organization: >Environment: >Description:
- >How-To-Repeat: >Fix: >Audit-Trail:
- >Unformatted:
-
- A Problem Report contains two different types of fields: "Mail
-Header" fields, which are used by the mail handler for delivery, and
-"Problem Report" fields, which contain information relevant to the
-Problem Report and its submitter. A Problem Report is essentially a
-specially formatted electronic mail message.
-
- The following is an example Problem Report. Mail headers are at the
-top, followed by GNATS fields, which begin with `>' and end with `:'.
-The `Subject:' line in the mail header and the `>Synopsis:' field are
-usually duplicates of each other.
-
- Message-Id: MESSAGE-ID
- Date: DATE
- From: ADDRESS
- Reply-To: ADDRESS
- To: BUG-ADDRESS
- Subject: SUBJECT
-
- >Number: GNATS-ID
- >Category: CATEGORY
- >Synopsis: SYNOPSIS
- >Confidential: yes *or* no
- >Severity: critical, serious, *or* non-critical
- >Priority: high, medium *or* low
- >Responsible: RESPONSIBLE
- >State: open, analyzed, suspended, feedback, *or* closed
- >Class: sw-bug, doc-bug, change-request, support,
- *or* duplicate
- >Submitter-Id: SUBMITTER-ID
- >Arrival-Date: DATE
- >Originator: NAME
- >Organization: ORGANIZATION
- >Release: RELEASE
- >Environment:
- ENVIRONMENT
- >Description:
- DESCRIPTION
- >How-To-Repeat:
- HOW-TO-REPEAT
- >Fix:
- FIX
- >Audit-Trail:
- APPENDED-MESSAGES...
- State-Changed-From-To: FROM-TO
- State-Changed-When: DATE
- State-Changed-Why:
- REASON
- Responsible-Changed-From-To: FROM-TO
- Responsible-Changed-When: DATE
- Responsible-Changed-Why:
- REASON
- >Unformatted:
- MISCELLANEOUS
-
-* Menu:
-
-* Mail header fields::
-* Problem Report fields::
-
-
-File: send-pr.info, Node: Mail header fields, Next: Problem Report fields, Up: Fields
-
-Mail header fields
-------------------
-
- A Problem Report may contain any mail header field described in the
-Internet standard RFC-822. However, only the fields which identify the
-sender and the subject are required by `send-pr':
-
-`To:'
- The preconfigured mail address for the Support Site where the PR
- is to be sent, automatically supplied by `send-pr'.
-
-`Subject:'
- A terse description of the problem. This field normally contains
- the same information as the `>Synopsis:' field.
-
-`From:'
- Usually supplied automatically by the originator's mailer; should
- contain the originator's electronic mail address.
-
-`Reply-To:'
- A return address to which electronic replies can be sent; in most
- cases, the same address as the `From:' field.
-
-
-File: send-pr.info, Node: Problem Report fields, Prev: Mail header fields, Up: Fields
-
-Problem Report fields
----------------------
-
-Field descriptions
-------------------
-
- The following fields are present whenever a PR is submitted via the
-program `send-pr'. GNATS adds additional fields when the PR arrives at
-the Support Site; explanations of these follow this list.
-
-`>Submitter-Id:'
- (TEXT) A unique identification code assigned by the Support Site.
- It is used to identify all Problem Reports coming from a particular
- site. (Submitters without a value for this field can invoke
- `send-pr' with the `--request-id' option to apply for one from the
- support organization. Problem Reports from those not affiliated
- with the support organization should use the default value of `net'
- for this field.)
-
-`>Originator:'
- (TEXT) Originator's real name. The default is the value of the
- originator's environment variable `NAME'.
-
-`>Organization:'
- (MULTITEXT) The originator's organization. The default value is
- set with the variable `DEFAULT_ORGANIZATION' in the `send-pr'
- shell script.
-
-`>Confidential:'
- (ENUMERATED) Use of this field depends on the originator's
- relationship with the support organization; contractual agreements
- often have provisions for preserving confidentiality. Conversely,
- a lack of a contract often means that any data provided will not
- be considered confidential. Submitters should be advised to
- contact the support organization directly if this is an issue.
-
- If the originator's relationship to the support organization
- provides for confidentiality, then if the value of this field is
- `yes' the support organization treats the PR as confidential; any
- code samples provided are not made publicly available (e.g., in
- regression test suites). The default value is `yes'.
-
-`>Synopsis:'
- (TEXT) One-line summary of the problem. `send-pr' copies this
- information to the `Subject:' line when you submit a Problem
- Report.
-
-`>Severity:'
- (ENUMERATED) The severity of the problem. Accepted values include:
-
- `critical'
- The product, component or concept is completely
- non-operational or some essential functionality is missing.
- No workaround is known.
-
- `serious'
- The product, component or concept is not working properly or
- significant functionality is missing. Problems that would
- otherwise be considered `critical' are rated `serious' when a
- workaround is known.
-
- `non-critical'
- The product, component or concept is working in general, but
- lacks features, has irritating behavior, does something
- wrong, or doesn't match its documentation. The default value
- is `serious'.
-
-`>Priority:'
- (ENUMERATED) How soon the originator requires a solution. Accepted
- values include:
-
- `high'
- A solution is needed as soon as possible.
-
- `medium'
- The problem should be solved in the next release.
-
- `low'
- The problem should be solved in a future release.
-
- The default value is `medium'.
-
-`>Category:'
- (TEXT) The name of the product, component or concept where the
- problem lies. The values for this field are defined by the Support
- Site.
-
-`>Class:'
- (ENUMERATED) The class of a problem can be one of the following:
-
- `sw-bug'
- A general product problem. (`sw' stands for "software".)
-
- `doc-bug'
- A problem with the documentation.
-
- `change-request'
- A request for a change in behavior, etc.
-
- `support'
- A support problem or question.
-
- `duplicate (PR-NUMBER)'
- Duplicate PR. PR-NUMBER should be the number of the original
- PR.
-
- The default is `sw-bug'.
-
-`>Release:'
- (TEXT) Release or version number of the product, component or
- concept.
-
-`>Environment:'
- (MULTITEXT) Description of the environment where the problem
- occured: machine architecture, operating system, host and target
- types, libraries, pathnames, etc.
-
-`>Description:'
- (MULTITEXT) Precise description of the problem.
-
-`>How-To-Repeat:'
- (MULTITEXT) Example code, input, or activities to reproduce the
- problem. The support organization uses example code both to
- reproduce the problem and to test whether the problem is fixed.
- Include all preconditions, inputs, outputs, conditions after the
- problem, and symptoms. Any additional important information
- should be included. Include all the details that would be
- necessary for someone else to recreate the problem reported,
- however obvious. Sometimes seemingly arbitrary or obvious
- information can point the way toward a solution. See also *Note
- Helpful hints: Helpful hints.
-
-`>Fix:'
- (MULTITEXT) A description of a solution to the problem, or a patch
- which solves the problem. (This field is most often filled in at
- the Support Site; we provide it to the submitter in case she has
- solved the problem.)
-
-GNATS adds the following fields when the PR arrives at the Support Site:
-
-`>Number:'
- (ENUMERATED) The incremental identification number for this PR.
-
- The `>Number:' field is often paired with the `>Category:' field as
-
- CATEGORY/NUMBER
-
- in subsequent email messages. This is for historical reasons, as
- well as because Problem Reports are stored in subdirectories which
- are named by category.
-
-`>State:'
- (ENUMERATED) The current state of the PR. Accepted values are:
-
- `open'
- The PR has been filed and the responsible person notified.
-
- `analyzed'
- The responsible person has analyzed the problem.
-
- `feedback'
- The problem has been solved, and the originator has been
- given a patch or other fix.
-
- `closed'
- The changes have been integrated, documented, and tested, and
- the originator has confirmed that the solution works.
-
- `suspended'
- Work on the problem has been postponed.
-
- The initial state of a PR is `open'. *Note States of Problem
- Reports: States.
-
-`>Responsible:'
- (TEXT) The person responsible for this category.
-
-`>Arrival-Date:'
- (TEXT) The time that this PR was received by GNATS. The date is
- provided automatically by GNATS.
-
-`>Audit-Trail:'
- (MULTITEXT) Tracks related electronic mail as well as changes in
- the `>State:' and `>Responsible:' fields with the sub-fields:
-
- `State-Changed-<From>-<To>: OLDSTATE>-<NEWSTATE'
- The old and new `>State:' field values.
-
- `Responsible-Changed-<From>-<To>: OLDRESP>-<NEWRESP'
- The old and new `>Responsible:' field values.
-
- `State-Changed-By: NAME'
- `Responsible-Changed-By: NAME'
- The name of the maintainer who effected the change.
-
- `State-Changed-When: TIMESTAMP'
- `Responsible-Changed-When: TIMESTAMP'
- The time the change was made.
-
- `State-Changed-Why: REASON...'
- `Responsible-Changed-Why: REASON...'
- The reason for the change.
-
- The `>Audit-Trail:' field also contains any mail messages received
- by GNATS related to this PR, in the order received.
-
-`>Unformatted:'
- (MULTITEXT) Any random text found outside the fields in the
- original Problem Report.
-
-
-File: send-pr.info, Node: Invoking send-pr, Next: An Example, Prev: send-pr in detail, Up: Top
-
-Editing and sending PRs
-***********************
-
- You can invoke `send-pr' from a shell prompt or from within GNU
-Emacs using `M-x send-pr'.
-
-* Menu:
-
-* using send-pr:: Creating new Problem Reports
-* send-pr in Emacs:: Using send-pr from within Emacs
-* send-pr from the shell:: Invoking send-pr from the shell
-* Helpful hints::
-
-
-File: send-pr.info, Node: using send-pr, Next: send-pr in Emacs, Up: Invoking send-pr
-
-Creating new Problem Reports
-============================
-
- Invoking `send-pr' presents a PR "template" with a number of fields
-already filled in. Complete the template as thoroughly as possible to
-make a useful bug report. Submit only one bug with each PR.
-
- A template consists of three sections:
-
-"Comments"
- The top several lines of a blank template consist of a series of
- comments that provide some basic instructions for completing the
- Problem Report, as well as a list of valid entries for the
- `>Category:' field. These comments are all preceded by the string
- `SEND-PR:' and are erased automatically when the PR is submitted.
- The instructional comments within `<' and `>' are also removed.
- (Only these comments are removed; lines you provide that happen to
- have those characters in them, such as examples of shell-level
- redirection, are not affected.)
-
-"Mail Header"
- `send-pr' creates a standard mail header. `send-pr' completes all
- fields except the `Subject:' line with default values. (*Note
- Problem Report format: Fields.)
-
-"GNATS fields"
- These are the informational fields that GNATS uses to route your
- Problem Report to the responsible party for further action. They
- should be filled out as completely as possible. (*Note Problem
- Report format: Fields. Also see *Note Helpful hints: Helpful
- hints.)
-
-For examples of a Problem Report template and complete Problem Report,
-see *Note An Example::.
-
- The default template contains your preconfigured `>Submitter-Id:'.
-`send-pr' attempts to determine values for the `>Originator:' and
-`>Organization:' fields (*note Problem Report format: Fields.).
-`send-pr' also attempts to find out some information about your system
-and architecture, and places this information in the `>Environment:'
-field if it finds any.
-
- You may submit problem reports to different Support Sites from the
-default site by specifying the alternate site when you invoke
-`send-pr'. Each `site' has its own list of categories for which it
-accepts Problem Reports. (*Note Setting a default SITE: default site.)
-
- `send-pr' also provides the mail header section of the template with
-default values in the `To:', `From:', and `Reply-To:' fields. The
-`Subject:' field is empty.
-
- The template begins with a comment section:
-
- SEND-PR: -*- send-pr -*-
- SEND-PR: Lines starting with `SEND-PR' will be removed
- SEND-PR: automatically as well as all comments (the text
- SEND-PR: below enclosed in `<' and `>').
- SEND-PR:
- SEND-PR: Please consult the document `Reporting Problems
- SEND-PR: Using send-pr' if you are not sure how to fill out
- SEND-PR: a problem report.
- SEND-PR:
- SEND-PR: Choose from the following categories:
-
-and also contains a list of valid `>Category:' values for the Support
-Site to whom you are submitting this Problem Report. One (and only
-one) of these values should be placed in the `>Category:' field. A
-complete sample bug report, from template to completed PR, is shown in
-*Note An Example::. For a complete list of valid categories, type
-`send-pr -L' at your prompt. *Note Valid Categories: Valid Categories,
-for a sample list of categories, .
-
- The mail header is just below the comment section. Fill out the
-`Subject:' field, if it is not already completed using the value of
-`>Synopsis:'. The other mail header fields contain default values.
-
- To: SUPPORT-SITE
- Subject: *complete this field*
- From: YOUR-LOGIN@YOUR-SITE
- Reply-To: YOUR-LOGIN@YOUR-SITE
- X-send-pr-version: send-pr 3.2
-
-where SUPPORT-SITE is an alias for the Support Site you wish to submit
-this PR to.
-
- The rest of the template contains GNATS fields. Each field is
-either automatically completed with valid information (such as your
-`>Submitter-Id:') or contains a one-line instruction specifying the
-information that field requires in order to be correct. For example,
-the `>Confidential:' field expects a value of `yes' or `no', and the
-answer must fit on one line; similarly, the `>Synopsis:' field expects
-a short synopsis of the problem, which must also fit on one line. Fill
-out the fields as completely as possible. *Note Helpful hints: Helpful
-hints, for suggestions as to what kinds of information to include.
-
- In this example, words in *italics* are filled in with
-pre-configured information:
-
- >Submitter-Id: *your submitter-id*
- >Originator: *your name here*
- >Organization:
- *your organization*
- >Confidential:<[ yes | no ] (one line)>
- >Synopsis: <synopsis of the problem (one line)>
- >Severity: <[non-critical | serious | critical](one line)>
- >Priority: <[ low | medium | high ] (one line)>
- >Category: <name of the product (one line)>
- >Class: <[sw-bug | doc-bug | change-request | support]>
- >Release: <release number or tag (one line)>
- >Environment:
- <machine, os, target, libraries (multiple lines)>
-
- >Description:
- <precise description of the problem (multiple lines)>
- >How-To-Repeat:
- <code/input/activities to reproduce (multiple lines)>
- >Fix:
- <how to correct or work around the problem, if known
- (multiple lines)>
-
- When you finish editing the Problem Report, `send-pr' mails it to
-the address named in the `To:' field in the mail header. `send-pr'
-checks that the complete form contains a valid `>Category:'.
-
- Your copy of `send-pr' should have already been customized on
-installation to reflect your `>Submitter-Id:'. (*Note Installing
-`send-pr' on your system: Installing send-pr.) If you don't know your
-`>Submitter-Id:', you can request it using `send-pr --request-id'. If
-your organization is not affiliated with the site you send Problem
-Reports to, a good generic `>Submitter-Id:' to use is `net'.
-
- If your PR has an invalid value in one of the ENUMERATED fields
-(*note Problem Report format: Fields.), `send-pr' places the PR in a
-temporary file named `/tmp/pbadNNNN' on your machine. NNNN is the
-process identification number given to your current `send-pr' session.
-If you are running `send-pr' from the shell, you are prompted as to
-whether or not you wish to try editing the same Problem Report again.
-If you are running `send-pr' from Emacs, the Problem Report is placed
-in the buffer `*send-pr-error*'; you can edit this file and then submit
-it with
-
- M-x gnats-submit-pr
-
- Any further mail concerning this Problem Report should be
-carbon-copied to the GNATS mailing address as well, with the category
-and identification number in the `Subject:' line of the message.
-
- Subject: Re: PR CATEGORY/GNATS-ID: ORIGINAL MESSAGE SUBJECT
-
-Messages which arrive with `Subject:' lines of this form are
-automatically appended to the Problem Report in the `>Audit-Trail:'
-field in the order received.
-
-
-File: send-pr.info, Node: send-pr in Emacs, Next: send-pr from the shell, Prev: using send-pr, Up: Invoking send-pr
-
-Using `send-pr' from within Emacs
-=================================
-
- You can use an interactive `send-pr' interface from within GNU Emacs
-to fill out your Problem Report. We recommend that you familiarize
-yourself with Emacs before using this feature (*note Introduction:
-(emacs)Introduction.).
-
- Call `send-pr' with `M-x send-pr'.(1) `send-pr' responds with a
-Problem Report template preconfigured for the Support Site from which
-you received `send-pr'. (If you use `send-pr' locally, the default
-Support Site is probably your local site.)
-
- You may also submit problem reports to different Support Sites from
-the default site. To use this feature, invoke `send-pr' with
-
- C-u M-x send-pr
-
- `send-pr' prompts you for the name of a SITE. SITE is an alias on
-your local machine which points to an alternate Support Site.
-
- `send-pr' displays the template and prompts you in the minibuffer
-with the line:
- >Category: other
-
-Delete the default value `other' *in the minibuffer* and replace it
-with the keyword corresponding to your problem (the list of valid
-categories is in the topmost section of the PR template). For example,
-if the problem you wish to report has to do with the GNU C compiler,
-and your support organization accepts bugs submitted for this program
-under the category `gcc', delete `other' and then type `gcc[RET]'.
-`send-pr' replaces the line
-
- >Category: <name of the product (one line)>
-
-in the template with
-
- >Category: gcc
-
-and moves on to another field.
-
- `send-pr' provides name completion in the minibuffer. For instance,
-you can also type `gc[TAB]', and `send-pr' attempts to complete the
-entry for you. Typing `g[TAB]' may not have the same effect if several
-possible entries begin with `g'. In that case `send-pr' cannot
-complete the entry because it cannot determine whether you mean `gcc'
-or, for example, `gdb', if both of those are possible categories.
-`send-pr' continues to prompt you for a valid entry until you enter one.
-
- `send-pr' prompts you interactively to enter each field for which
-there is a range of specific choices. If you attempt to enter a value
-which is not in the range of acceptable entries, `send-pr' responds
-with `[No match]' and allows you to change the entry until it contains
-an acceptable value. This avoids unusable information (at least in
-these fields) and also avoids typographical errors which could cause
-problems later.
-
- `send-pr' prompts you for the following fields:
-
- >Category:
- >Confidential: (*default*: no)
- >Severity: (*default*: serious)
- >Priority: (*default*: medium)
- >Class: (*default*: sw-bug)
- >Release:
- >Synopsis: (*this value is copied to `Subject:'*)
-
-After you complete these fields, `send-pr' places the cursor in the
-`>Description:' field and displays the message
-
- To send the problem report use: C-c C-c
-
-in the minibuffer. At this point, edit the file in the main buffer to
-reflect your specific problem, putting relevant information in the
-proper fields. *Note An Example::, for a sample Problem Report.
-
- `send-pr' provides a few key bindings to make moving around in a
-template buffer more simple:
-
-`C-c C-f'
-`M-x change-field'
- Changes the field under the cursor. `edit-pr' prompts you for a
- new value.
-
-`M-C-b'
-`M-x gnats-backward-field'
- Moves the cursor to the beginning of the value of the current
- field.
-
-`M-C-f'
-`M-x gnats-forward-field'
- Moves the cursor to the end of the value of the current field.
-
-`M-p'
-`M-x gnats-previous-field'
- Moves the cursor back one field to the beginning of the value of
- the previous field.
-
-`M-n'
-`M-x gnats-next-field'
- Moves the cursor forward one field to the beginning of the value
- of the next field.
-
- `send-pr' takes over again when you type `C-c C-c' to send the
-message. `send-pr' reports any errors in a separate buffer, which
-remains in existence until you send the PR properly (or, of course,
-until you explicitly kill the buffer).
-
- For detailed instructions on using Emacs, see *Note Introduction:
-(emacs)Introduction.
-
- ---------- Footnotes ----------
-
- (1) If typing `M-x send-pr' doesn't work, see your system
-administrator for help loading `send-pr' into Emacs.
-
-
-File: send-pr.info, Node: send-pr from the shell, Next: Helpful hints, Prev: send-pr in Emacs, Up: Invoking send-pr
-
-Invoking `send-pr' from the shell
-=================================
-
- send-pr [ SITE ]
- [ -f PROBLEM-REPORT | --file PROBLEM-REPORT ]
- [ -t MAIL-ADDRESS | --to MAIL-ADDRESS ]
- [ --request-id ]
- [ -L | --list ] [ -P | --print ]
- [ -V | --version] [ -h | --help ]
-
- SITE is an alias on your local machine which points to an address
-used by a Support Site. If this argument is not present, the default
-SITE is usually the site which you received `send-pr' from, or your
-local site if you use GNATS locally. (*Note Setting a default SITE:
-default site.)
-
- Invoking `send-pr' with no options calls the editor named in your
-environment variable `EDITOR' on a default PR template. If the
-environment variable `PR_FORM' is set, its value is used as a file name
-which contains a valid template. If `PR_FORM' points to a missing or
-unreadable file, or if the file is empty, `send-pr' generates an error
-message and opens the editor on a default template.
-
-`-f PROBLEM-REPORT'
-`--file PROBLEM-REPORT'
- Specifies a file, PROBLEM-REPORT, where a completed Problem Report
- already exists. `send-pr' sends the contents of the file without
- invoking an editor. If PROBLEM-REPORT is `-', `send-pr' reads
- from standard input.
-
-`-t MAIL-ADDRESS'
-`--to MAIL-ADDRESS'
- Sends the PR to MAIL-ADDRESS. The default is preset when `send-pr'
- is configured. *This option is not recommended*; instead, use the
- argument SITE on the command line.
-
-`--request-id'
- Sends a request for a `>Submitter-Id:' to the Support Site.
-
-`-L'
-`--list'
- Prints the list of valid `>Category:' values on standard output.
- No mail is sent.
-
-`-P'
-`--print'
- Displays the PR template. If the variable `PR_FORM' is set in your
- environment, the file it specifies is printed. If `PR_FORM' is not
- set, `send-pr' prints the standard blank form. If the file
- specified by `PR_FORM' doesn't exist, `send-pr' displays an error
- message. No mail is sent.
-
-`-V'
-`--version'
- Displays the `send-pr' version number and a usage summary. No mail
- is sent.
-
-`-h'
-`--help'
- Displays a usage summary for `send-pr'. No mail is sent.
-
-
-File: send-pr.info, Node: Helpful hints, Prev: send-pr from the shell, Up: Invoking send-pr
-
-Helpful hints
-=============
-
- There is no orthodox standard for submitting effective bug reports,
-though you might do well to consult the section on submitting bugs for
-GNU `gcc' in *Note Reporting Bugs: (gcc)Bugs, by Richard Stallman.
-This section contains instructions on what kinds of information to
-include and what kinds of mistakes to avoid.
-
- In general, common sense (assuming such an animal exists) dictates
-the kind of information that would be most helpful in tracking down and
-resolving problems in software.
- * Include anything *you* would want to know if you were looking at
- the report from the other end. There's no need to include every
- minute detail about your environment, although anything that might
- be different from someone else's environment should be included
- (your path, for instance).
-
- * Narratives are often useful, given a certain degree of restraint.
- If a person responsible for a bug can see that A was executed, and
- then B and then C, knowing that sequence of events might trigger
- the realization of an intermediate step that was missing, or an
- extra step that might have changed the environment enough to cause
- a visible problem. Again, restraint is always in order ("I set
- the build running, went to get a cup of coffee (Columbian, cream
- but no sugar), talked to Sheila on the phone, and then THIS
- happened...") but be sure to include anything relevant.
-
- * Richard Stallman writes, "The fundamental principle of reporting
- bugs usefully is this: *report all the facts*. If you are not sure
- whether to state a fact or leave it out, state it!" This holds
- true across all problem reporting systems, for computer software
- or social injustice or motorcycle maintenance. It is especially
- important in the software field due to the major differences
- seemingly insignificant changes can make (a changed variable, a
- missing semicolon, etc.).
-
- * Submit only *one* problem with each Problem Report. If you have
- multiple problems, use multiple PRs. This aids in tracking each
- problem and also in analyzing the problems associated with a given
- program.
-
- * It never hurts to do a little research to find out if the bug
- you've found has already been reported. Most software releases
- contain lists of known bugs in the Release Notes which come with
- the software; see your system administrator if you don't have a
- copy of these.
-
- * The more closely a PR adheres to the standard format, the less
- interaction is required by a database administrator to route the
- information to the proper place. Keep in mind that anything that
- requires human interaction also requires time that might be better
- spent in actually fixing the problem. It is therefore in
- everyone's best interest that the information contained in a PR be
- as correct as possible (in both format and content) at the time of
- submission.
-
-
-File: send-pr.info, Node: An Example, Next: Installing send-pr, Prev: Invoking send-pr, Up: Top
-
-An Example
-**********
-
- Cygnus Support in Mountain View, CA, uses GNATS and `send-pr'
-extensively for their support activities. As a support company, Cygnus
-finds problem tracking to be a crucial part of everyday business.
-Cygnus supports the GNU compiling tools (including GNATS and `send-pr')
-over several many platforms
-
- With each shipment of the Cygnus Support Developer's Kit, customers
-receive the latest version of `send-pr', which contains an up-to-date
-listing of valid categories (values for the `>Category:' field). Using
-these tools, Cygnus' customers can communicate their problems to Cygnus
-effectively and receive automatic confirmation of receipt as well as
-notification of changes in the status of their reported problems. Much
-of Cygnus' support mechanism relies on electronic mail.
-
- As an example, let's pretend we're a customer of Cygnus Support, and
-that we're having a problem compiling some of our software using the
-GNU C compiler, which Cygnus supports.
-
- Assume that we're getting an error in our `bifrabulator' program
-wherein the `prestidigitation' routines don't match with the
-`whatsitsname'. We've made sure we're following the rules of the
-program and checked the Release Notes from Cygnus and found that the bug
-isn't already known. In other words, we're pretty sure we've found a
-bug.
-
- Our first step is to call `send-pr'. It really doesn't matter
-whether we use `send-pr' from the shell or from within Emacs. Indeed,
-if we use Emacs as a primary editor, calling `send-pr' from the shell
-is likely to start `send-pr' in an Emacs buffer anyway. So, since our
-company, *Imaginary Software, Ltd.*, uses GNU software extensively,
-we're pretty familiar with Emacs, so from within Emacs we type
- M-x send-pr
-
-and we're greeted with the following screen:
-
- SEND-PR: -*- text -*-
- SEND-PR: Lines starting with `SEND-PR' will be removed
- SEND-PR: automatically as well as all comments (the text
- SEND-PR: below enclosed in `<' and `>').
- SEND-PR: Please consult the manual if you are not sure
- SEND-PR: how to fill out a problem report.
- SEND-PR:
- SEND-PR: Choose from the following categories:
- SEND-PR:
- SEND-PR: bfd binutils bison
- SEND-PR: byacc clib config cvs diff
- SEND-PR: doc emacs flex g++ gas
- SEND-PR: gcc gdb glob gprof grep
- SEND-PR: info ispell kerberos ld libg++
- SEND-PR: libiberty make makeinfo mas newlib
- SEND-PR: other patch rcs readline send-pr
- SEND-PR: test texindex texinfo texinfo.tex
- SEND-PR: bifrabulator <---*note: this one is fake*
- SEND-PR:
- To: cygnus-bugs@cygnus.com
- Subject:
- From: jeffrey@imaginary.com
- Reply-To: jeffrey@imaginary.com
- X-send-pr-version: send-pr 3.2
-
- >Submitter-Id: imaginary
- >Originator: Jeffrey Osier
- >Organization:
- Imaginary Software, Ltd.
- >Confidential: <[ yes | no ] (one line)>
- >Synopsis: <synopsis of the problem (one line)>
- >Severity: <[ non-critical | serious | critical ] (one line)>
- >Priority: <[ low | medium | high ] (one line)>
- >Category: <name of the product (one line)>
- >Class: <[sw-bug|doc-bug|change-request|support](oneline)>
- >Release: <release number or tag (one line)>
- >Environment:
- <machine, os, target, libraries (multiple lines)>
- System: SunOS imaginary.com 4.1.1 1 sun4
- Architecture: sun4
-
- >Description:
- <precise description of the problem (multiple lines)>
- >How-To-Repeat:
- <code/input/activities to reproduce (multiple lines)>
- >Fix:
- -----Emacs: *send-pr* (send-pr Fill)----All------------------
- >Category: other[]
-
- We know from past experience that we need to set certain information
-into each field, so we compile all the information we know about our
-problem. We have some sample code which we know should work, even
-though it doesn't, so we'll include that. Below is the completed PR;
-we send this using `C-c C-c'. (The comments have been truncated).
-
- SEND-PR: Lines starting with `SEND-PR' will be removed
- SEND-PR: automatically as well as all comments (the text
- SEND-PR: ...
- SEND-PR:
- To: cygnus-bugs@cygnus.com
- Subject: bifrabulator routines don't match
- From: jeffrey@imaginary.com
- Reply-To: jeffrey@imaginary.com
- X-send-pr-version: send-pr 3.2
-
- >Submitter-Id: imaginary
- >Originator: Jeffrey Osier
- >Organization:
- Imaginary Software, Ltd.
- >Confidential: no
- >Synopsis: bifrabulator routines don't match
- >Severity: serious
- >Priority: medium
- >Category: bifrabulator
- >Class: sw-bug
- >Release: progressive-930101
- >Environment:
- System: SunOS imaginary.com 4.1.1 1 sun4
- Architecture: sun4 (SPARC)
-
- >Description:
- the following code I fed into the bifrabulator came back
- with a strange error. apparently, the prestidigitation
- routine doesn't match with the whatsitsname in all cases.
-
- >How-To-Repeat:
- call the bifrabulator on the following code.
- *code sample...*
-
- >Fix:
- -----Emacs: *send-pr* (send-pr Fill)----All------------------
- To send the problem report use: C-c C-c
-
- We type `C-c C-c', and off it goes. Now, we depend on Cygnus
-Support to figure out the answer to our problem.
-
- Soon afterward, we get the following message from Cygnus:
-
- From: gnats (GNATS management)
- Sender: gnats-admin
- Reply-To: hacker@cygnus.com
- To: jeffrey@imaginary.com
- Subject: Re: bifrabulator/1425: routines don't match
-
- Thank you very much for your problem report.
- It has the internal identification: g++/1425.
- The individual assigned to look at your bug is: hacker
- (F.B. Hacker)
-
- Category: bifrabulator
- Responsible: hacker
- Synopsis: bifrabulator routines don't match
- Arrival-Date: Sat Feb 30 03:12:55 1993
-
-This is our receipt that the bug has been accepted and forwarded to the
-responsible party.
-
-A while later, we get the analysis:
-
- To: jeffrey@imaginary.com
- From: hacker@cygnus.com
- Subject: Re: bifrabulator/1425: routines don't match
- Reply-To: hacker@cygnus.com
-
- Got your message, Jeff. It seems that the bifrabulator was
- confusing the prestidigitation routines with the realitychecker
- when lexically parsing the whatsitsname.
-
- I'm working on robustisizing the bifrabulator now.
-
- How about lunch next week?
- --
- F.B. Hacker
- Cygnus Support, Mountain View, CA 415 903 1400
- #include <std-disclaimer.h>
-
-About the same time, we get another message from Cygnus.
-
- From: hacker@cygnus.com
- To: jeffrey@imaginary.com
- Subject: Re: bifrabulator/1425: doesn't match prestidig
- Reply-To: hacker@cygnus.com
-
-
- `F.B. Hacker' changed the state to `analyzed'.
-
- State-Changed-From-To: open-analyzed
- State-Changed-By: hacker
- State-Changed-When: Fri Feb 31 1993 08:59:16 1993
- State-Changed-Why:
- figured out the problem, working on a patch this afternoon
- --
- F.B. Hacker
- Cygnus Support, Mountain View, CA 415 903 1400
- #include <std-disclaimer.h>
-
-The bug has now been analyzed, and Cygnus is working on a solution.
-
-Sometime later, we get more mail from F.B.:
-
- To: jeffrey@imaginary.com
- From: hacker@cygnus.com
- Subject: Re: bifrabulator/1425: routines don't match
- Reply-To: hacker@cygnus.com
-
- There's a patch now that you can ftp over and check out.
-
- Hey, that joke you sent me was great! The one about the
- strings walking into a bar... my boss laughed for an hour!
- --
- F.B. Hacker
- Cygnus Support, Mountain View, CA 415 903 1400
- #include <std-disclaimer.h>
-
- From: hacker@cygnus.com
- To: jeffrey@imaginary.com
- Subject: Re: bifrabulator/1425: doesn't match prestidig
- Reply-To: hacker@cygnus.com
-
-
- `F.B. Hacker' changed the state to `feedback'.
-
- State-Changed-From-To: analyzed-feedback
- State-Changed-By: hacker
- State-Changed-When: Fri Feb 31 1993 23:43:16 1993
- State-Changed-Why:
- got the patch finished, notified Jeff at Imaginary Software
- --
- F.B. Hacker
- Cygnus Support, Mountain View, CA 415 903 1400
- #include <std-disclaimer.h>
-
-The bug has gone into "feedback" status now, until we get the patch,
-install it and test it. When everything tests well, we can mail F.B.
-back and tell him the bug's been fixed, and he can change the state of
-the PR from "feedback" to "closed".
-
- Following is a list of valid `>Category:' entries that are supported
-by Cygnus.
-
-* Menu:
-
-* Valid Categories::
-
-
-File: send-pr.info, Node: Valid Categories, Up: An Example
-
-Valid Categories
-================
-
-`bfd'
- GNU binary file descriptor library.
-
-`bifrabulator'
- This one doesn't actually exist.
-
-`binutils'
- GNU utilities for binary files (`ar', `nm', `size'...).
-
-`bison'
- GNU parser generator.
-
-`byacc'
- Free parser generator.
-
-`config'
- Cygnus Support Software configuration and installation.
-
-`cvs'
- Concurrent Version System.
-
-`diff'
- GNU `diff' program.
-
-`doc'
- Documentation and manuals.
-
-`emacs'
- GNU Emacs editor and related functions.
-
-`flex'
- GNU lexical analyzer.
-
-`g++'
- GNU C++ compiler.
-
-`gas'
- GNU assembler.
-
-`gcc'
- GNU C compiler.
-
-`gdb'
- GNU source code debugger.
-
-`glob'
- The filename globbing functions.
-
-`gprof'
- GNU profiler.
-
-`grep'
- GNU `grep' program.
-
-`info'
- GNU `info' hypertext reader.
-
-`ispell'
- GNU spelling checker.
-
-`kerberos'
- Kerberos authentication system.
-
-`ld'
- GNU linker.
-
-`libc'
- Cygnus Support C Support Library.
-
-`libg++'
- GNU C++ class library.
-
-`libiberty'
- GNU `libiberty' library.
-
-`libm'
- Cygnus Support C Math Library.
-
-`make'
- GNU `make' program.
-
-`makeinfo'
- GNU utility to build Info files from Texinfo documents.
-
-`mas'
- GNU Motorola syntax assembler.
-
-`newlib'
- Cygnus Support C Support and Math Libraries.
-
-`patch'
- GNU bug patch program.
-
-`gnats'
- GNU Problem Report Management System.
-
-`rcs'
- Revision Control System.
-
-`readline'
- GNU `readline' library.
-
-`send-pr'
- GNU Problem Report submitting program.
-
-`test'
- Category to use when testing `send-pr'.
-
-`texindex'
- GNU documentation indexing utility.
-
-`texinfo'
- GNU documentation macros.
-
-`other'
- Anything which is not covered by the above categories.
-
-
-File: send-pr.info, Node: Installing send-pr, Next: Index, Prev: An Example, Up: Top
-
-Installing `send-pr' on your system
-***********************************
-
- If you receive `send-pr' as part of a larger software distribution,
-it probably gets installed when the full distribution is installed. If
-you are using GNATS at your site as well, you must decide where
-`send-pr' sends Problem Reports by default; see *Note Setting a default
-SITE: default site.
-
-* Menu:
-
-* installation:: installing `send-pr' by itself
-* default site:: setting a default site
-
-
-File: send-pr.info, Node: installation, Next: default site, Up: Installing send-pr
-
-Installing `send-pr' by itself
-==============================
-
- Install `send-pr' by following these steps (you may need `root'
-access in order to change the `aliases' file and to install `send-pr'):
-
- * Unpack the distribution into a directory which we refer to as
- SRCDIR.
-
- * Edit the file `Makefile' to reflect local conventions.
- Specifically, you should edit the variable `prefix' to alter the
- installation location. The default is `/usr/local'. All files are
- installed under `prefix' (see below).
-
- * *Run*
- make all install [ info ] [ install-info ] [ clean ]
-
- The targets mean the following:
-
- `all'
- Builds `send-pr' and `install-sid'
-
- `install'
- Installs the following:
-
- `install-sid'
- `send-pr'
- into `PREFIX/bin'
-
- `send-pr.1'
- into `PREFIX/man/man1'
-
- `SITE'
- the list of valid CATEGORIES for the Support Site from
- which you received `send-pr', installed as
- `PREFIX/lib/gnats/SITE'
-
- `send-pr.el'
- into `PREFIX/lib/emacs/lisp'(1)
-
- `info (*optional*)'
- Builds `send-pr.info' from `send-pr.texi'
- (`send-pr.info' is included with this distribution)
-
- `install-info (*optional*)'
- Installs `send-pr.info' into `PREFIX/info'
-
- `clean (*optional*)'
- Removes all intermediary build files that can be rebuilt from
- source code
-
- * Run
-
- install-sid YOUR-SID
-
- where YOUR-SID is the identification code you received with
- `send-pr'. `send-pr' automatically inserts this value into the
- template field `>Submitter-Id:'. If you've downloaded `send-pr'
- from the Net, use `net' for this value.
-
- * Place the following line in `PREFIX/lib/emacs/lisp/default.el', or
- instruct your users to place the following line in their `.emacs'
- files:
-
- (autoload 'send-pr "send-pr" "Submit a Problem Report." t)
-
- * Create a mail alias for the Support Site from which you received
- `send-pr', and for every site with which you wish to use `send-pr'
- to communicate. Each alias must have a suffix of `-gnats'. The
- Support Site(s) will provide the correct addresses where these
- aliases should point. For instance, edit your mail aliases file
- to contain something like:
-
- # support sites; for use with send-pr
- cygnus-gnats: bugs@cygnus.com # Cygnus Support
- bumblebee-gnats: bumblebugs@bumblebee.com # Bumblebee Inc.
- mycompany-gnats: bugs@my.company.com (*if you use GNATS locally*)
-
- `send-pr' automatically searches for these aliases when you type
-
- send-pr cygnus
- send-pr bumblebee
- send-pr SITE...
-
- `send-pr' also uses SITE to determine the categories of problems
- accepted by the site in question by looking in
-
- PREFIX/lib/gnats/SITE
-
- ---------- Footnotes ----------
-
- (1) If your main Emacs lisp repository is in a different directory
-from this, substitute that directory for `PREFIX/lib/emacs/lisp'.
-
-
-File: send-pr.info, Node: default site, Prev: installation, Up: Installing send-pr
-
-Setting a default SITE
-======================
-
- `send-pr' is capable of sending Problem Reports to any number of
-Support Sites, using mail aliases which have `-gnats' appended them.
-`send-pr' automatically appends the suffix, so that when you type
-
- send-pr SITE
-
-the Problem Report goes to the address noted in the `aliases' file as
-`SITE-gnats'. You can do this in the Emacs version of `send-pr' by
-invoking the program with
-
- C-u M-x send-pr
-
-You are prompted for SITE.
-
- SITE is also used to error-check the `>Category:' field, as a
-precaution against sending mistaken information (and against sending
-information to the wrong site).
-
- You may also simply type
-
- send-pr
-
-from the shell (or `M-x send-pr' in Emacs), and the Problem Report you
-generate will be sent to the SITE, which is usually the site from which
-you received your distribution of `send-pr'. If you use GNATS at your
-own organization, the default is usually your local address for
-reporting problems.
-
- To change this, simply edit the file `Makefile' before installing
-and change the line
-
- GNATS_SITE = SITE
-
-to reflect the site where you wish to send PRs by default.
-
-
-File: send-pr.info, Node: Index, Prev: Installing send-pr, Up: Top
-
-Index
-*****
-
-* Menu:
-
-* >Arrival-Date:: Problem Report fields.
-* >Audit-Trail:: Problem Report fields.
-* >Category:: Problem Report fields.
-* >Class:: Problem Report fields.
-* >Confidential:: Problem Report fields.
-* >Description:: Problem Report fields.
-* >Environment:: Problem Report fields.
-* >Fix:: Problem Report fields.
-* >How-To-Repeat:: Problem Report fields.
-* >Number:: Problem Report fields.
-* >Organization:: Problem Report fields.
-* >Originator:: Problem Report fields.
-* >Priority:: Problem Report fields.
-* >Release:: Problem Report fields.
-* >Responsible:: Problem Report fields.
-* >Severity:: Problem Report fields.
-* >State:: Problem Report fields.
-* >Submitter-Id:: using send-pr.
-* >Submitter-Id:: Problem Report fields.
-* >Synopsis:: Problem Report fields.
-* >Unformatted:: Problem Report fields.
-* Arrival-Date field: Problem Report fields.
-* Audit-Trail field: Problem Report fields.
-* bifrabulator: An Example.
-* Category field: Problem Report fields.
-* Class field: Problem Report fields.
-* Confidential field: Problem Report fields.
-* Description field: Problem Report fields.
-* Environment field: Problem Report fields.
-* Fix field: Problem Report fields.
-* From: header: Mail header fields.
-* How-To-Repeat field: Problem Report fields.
-* Number field: Problem Report fields.
-* Organization field: Problem Report fields.
-* Originator field: Problem Report fields.
-* Priority field: Problem Report fields.
-* Release field: Problem Report fields.
-* Reply-To: header: Mail header fields.
-* Responsible-Changed-<From>-<To>: in >Audit-Trail:: Problem Report fields.
-* Responsible-Changed-By: in >Audit-Trail:: Problem Report fields.
-* Responsible-Changed-When: in >Audit-Trail:: Problem Report fields.
-* Responsible-Changed-Why: in >Audit-Trail:: Problem Report fields.
-* Responsible field: Problem Report fields.
-* send-pr fields: using send-pr.
-* send-pr within Emacs: send-pr in Emacs.
-* Severity field: Problem Report fields.
-* State-Changed-<From>-<To>: in >Audit-Trail:: Problem Report fields.
-* State-Changed-By: in >Audit-Trail:: Problem Report fields.
-* State-Changed-When: in >Audit-Trail:: Problem Report fields.
-* State-Changed-Why: in >Audit-Trail:: Problem Report fields.
-* State field: Problem Report fields.
-* Subject: header: Mail header fields.
-* Submitter-Id field: Problem Report fields.
-* Submitter-Id field: using send-pr.
-* Synopsis field: Problem Report fields.
-* To: header: Mail header fields.
-* Unformatted field: Problem Report fields.
-* *analyzed* state: States.
-* *change-request* class: Problem Report fields.
-* *closed* state: States.
-* *critical* severity problems: Problem Report fields.
-* *doc-bug* class: Problem Report fields.
-* *duplicate* class: Problem Report fields.
-* *Enumerated* data types: Fields.
-* *feedback* state: States.
-* *high* priority problems: Problem Report fields.
-* *low* priority problems: Problem Report fields.
-* *medium* priority problems: Problem Report fields.
-* *MultiText* data types: Fields.
-* *non-critical* severity problems: Problem Report fields.
-* *open* state: States.
-* *serious* severity problems: Problem Report fields.
-* *support* class: Problem Report fields.
-* *suspended* state: States.
-* *sw-bug* class: Problem Report fields.
-* *Text* data types: Fields.
-* an example: An Example.
-* appending PRs: using send-pr.
-* appending PRs: Problem Report fields.
-* automatic notification: States.
-* bad Problem Reports: using send-pr.
-* blank PR template: An Example.
-* command line options: send-pr from the shell.
-* comment section in the PR template: using send-pr.
-* completed Problem Report: An Example.
-* completion in Emacs: send-pr in Emacs.
-* confidentiality in PRs: Problem Report fields.
-* Cygnus Support: An Example.
-* database similarities: Fields.
-* default SITE: default site.
-* default PR template: An Example.
-* details about send-pr: send-pr in detail.
-* editing and sending PRs: Invoking send-pr.
-* effective problem reporting: Helpful hints.
-* Emacs: send-pr in Emacs.
-* errors: using send-pr.
-* example of a completed PR: An Example.
-* example of a default template: An Example.
-* example of a list of valid categories: Valid Categories.
-* example of a state change: An Example.
-* example PR: An Example.
-* example Problem Report: Fields.
-* field format: Problem Report fields.
-* fields: Fields.
-* fields - list: Problem Report fields.
-* final state ("closed"): States.
-* foreword to send-pr: Top.
-* format: Fields.
-* generating new PRs: Invoking send-pr.
-* GNATS: Top.
-* GNATS database fields: Problem Report fields.
-* GNATS fields - list: Problem Report fields.
-* GNU software support: An Example.
-* helpful hints: Helpful hints.
-* Imaginary Software, Ltd.: An Example.
-* information to submit: Helpful hints.
-* initial state ("open"): States.
-* installation: Installing send-pr.
-* installation procedure: installation.
-* interactive interface: send-pr in Emacs.
-* Internet standard RFC-822: Mail header fields.
-* introduction to send-pr: Top.
-* invalid Problem Reports: using send-pr.
-* invoking send-pr from Emacs: send-pr in Emacs.
-* invoking send-pr from the shell: send-pr from the shell.
-* invoking send-pr: Invoking send-pr.
-* kinds of helpful information: Helpful hints.
-* life-cycle of a Problem Report: States.
-* listing valid categories: send-pr from the shell.
-* mail header fields: Mail header fields.
-* mail header section: using send-pr.
-* name completion in Emacs: send-pr in Emacs.
-* other mail: using send-pr.
-* other mail: Problem Report fields.
-* overview to send-pr: Top.
-* PR confidentiality: Problem Report fields.
-* Problem Report data types: Fields.
-* Problem Report format: Fields.
-* Problem Report states: States.
-* Problem Report template: Fields.
-* Problem Reports: send-pr in detail.
-* related mail: Problem Report fields.
-* related mail: using send-pr.
-* Report all the facts!: Helpful hints.
-* sample Problem Report: Fields.
-* saving related mail: Problem Report fields.
-* saving related mail: using send-pr.
-* sending PRs: Invoking send-pr.
-* setting a default SITE: default site.
-* shell invocation: send-pr from the shell.
-* state change example: An Example.
-* state--"analyzed": States.
-* state--"closed": States.
-* state--"feedback": States.
-* state--"open": States.
-* state--"suspended": States.
-* states of Problem Reports: States.
-* subsequent mail: Problem Report fields.
-* subsequent mail: using send-pr.
-* template: using send-pr.
-* template comment section: using send-pr.
-* using send-pr from within Emacs: send-pr in Emacs.
-* Using and Porting GNU CC: Helpful hints.
-* using send-pr: Invoking send-pr.
-* valid categories: Valid Categories.
-
-
-
-Tag Table:
-Node: Top827
-Node: send-pr in detail2851
-Node: States3690
-Node: Fields5122
-Node: Mail header fields8791
-Node: Problem Report fields9656
-Node: Invoking send-pr17045
-Node: using send-pr17502
-Node: send-pr in Emacs24509
-Node: send-pr from the shell28914
-Node: Helpful hints31261
-Node: An Example34366
-Node: Valid Categories43466
-Node: Installing send-pr45285
-Node: installation45852
-Node: default site49077
-Node: Index50334
-
-End Tag Table
diff --git a/gnu/usr.bin/send-pr/send-pr.texi b/gnu/usr.bin/send-pr/send-pr.texi
deleted file mode 100644
index b9edd9c..0000000
--- a/gnu/usr.bin/send-pr/send-pr.texi
+++ /dev/null
@@ -1,657 +0,0 @@
-\input texinfo @c -*-texinfo-*-
-@setfilename send-pr.info
-@settitle Reporting Problems Using send-pr
-
-@setchapternewpage odd
-
-@include version.texi
-@set SENDPR
-
-@ifinfo
-@format
-START-INFO-DIR-ENTRY
-* send-pr:: Reporting problems--using send-pr
-END-INFO-DIR-ENTRY
-@end format
-@end ifinfo
-
-@ifinfo
-Copyright @copyright{} 1993 Free Software Foundation, Inc.
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-
-@ignore
-Permission is granted to process this file through TeX and print the
-results, provided the printed document carries a copying permission
-notice identical to this one except for the removal of this paragraph
-(this paragraph not being relevant to the printed manual).
-
-@end ignore
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided also that
-the entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions.
-@end ifinfo
-
-@titlepage
-@finalout
-@title Reporting Problems
-@subtitle Using @code{send-pr}, version @value{VERSION}
-@subtitle October 1993
-@author Jeffrey M. Osier
-@author Cygnus Support
-@page
-
-@vskip 0pt plus 1filll
-
-Copyright @copyright{} 1993 Free Software Foundation, Inc.
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided also that
-the entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions.
-
-@end titlepage
-
-@c ---------------------------------------------------------------
-@node Top
-@top Overview
-@cindex foreword to @code{send-pr}
-@cindex overview to @code{send-pr}
-@cindex introduction to @code{send-pr}
-
-This manual documents @code{send-pr},
-@ifinfo
-version @value{VERSION},
-@end ifinfo
-which uses electronic mail to submit support questions and problem
-reports to a central Support Site. No body of work is perfect, and
-support organizations understand this; @code{send-pr} is designed to
-allow users who have problems to submit reports of these problems to
-sites responsible for supporting the products in question, in a defined
-form which can be read by an electronically managed database.
-
-@cindex GNATS
-@code{send-pr} is part of a suite of programs known collectively as
-@sc{gnats}, the @sc{gnu} Problem Report Management System. @sc{gnats}
-consists of several programs which, used in concert, formulate and
-partially administer a database of @dfn{Problem Reports}, or @dfn{PRs},
-at a central Support Site. A PR goes through several states in its
-lifetime; @sc{gnats} tracks the PR and all information associated with it
-through each state and finally acts as an archive for PRs which have
-been @dfn{closed}.
-
-Because @code{send-pr} exists as a shell (@file{/bin/sh}) script and as
-an Elisp file for use with @sc{gnu} Emacs, it can be used from any
-machine on your network which can run a shell script and/or Emacs.
-
-In general, you can use any editor and mailer to submit valid Problem
-Reports, as long as the format required by @sc{gnats} is preserved.
-@code{send-pr} automates the process, however, and ensures that certain
-fields necessary for automatic processing are present. @code{send-pr}
-is strongly recommended for all initial problem-oriented correspondence
-with your Support Site. The organization you submit Problem Reports to
-supplies an address to which further information can be sent; the person
-responsible for the category of the problem you report contacts you
-directly.
-
-@menu
-* send-pr in detail:: Details about send-pr and GNATS
-* Invoking send-pr:: Editing and sending PRs
-* An Example:: A working example
-* Installing send-pr:: Installing send-pr on your system
-* Index::
-@end menu
-
-@node send-pr in detail
-@chapter Details about send-pr and GNATS
-
-@cindex details about @code{send-pr}
-@cindex Problem Reports
-A @dfn{Problem Report} is a message that describes a problem you are
-having with a body of work. @code{send-pr} organizes this message into
-a form which can be understood and automatically processed by @sc{gnats},
-the @sc{gnu} Problem Report Management System. A Problem Report is
-organized into @dfn{fields} which contain data describing you, your
-organization, and the problem you are announcing (@pxref{Fields,,Problem
-Report format}). Problem Reports go through several defined states in
-their lifetimes, from @dfn{open} to @dfn{closed} (@pxref{States,,States
-of Problem Reports}).
-
-@menu
-* States:: States of Problem Reports
-* Fields:: Problem Report format
-@end menu
-
-@include states.texi
-
-@include fields.texi
-
-@node Invoking send-pr
-@chapter Editing and sending PRs
-@cindex editing and sending PRs
-@cindex sending PRs
-@cindex invoking send-pr
-@cindex using send-pr
-@cindex generating new PRs
-
-@include s-usage.texi
-
-@node An Example
-@chapter An Example
-@cindex an example
-@cindex example PR
-@cindex Cygnus Support
-@cindex GNU software support
-
-Cygnus Support in Mountain View, CA, uses @sc{gnats} and @code{send-pr}
-extensively for their support activities. As a support company, Cygnus
-finds problem tracking to be a crucial part of everyday business.
-Cygnus supports the @sc{gnu} compiling tools (including @sc{gnats} and
-@code{send-pr}) over several many platforms
-
-With each shipment of the Cygnus Support Developer's Kit, customers
-receive the latest version of @code{send-pr}, which contains an
-up-to-date listing of valid categories (values for the @code{>Category:}
-field). Using these tools, Cygnus' customers can communicate their
-problems to Cygnus effectively and receive automatic confirmation of
-receipt as well as notification of changes in the status of their
-reported problems. Much of Cygnus' support mechanism relies on
-electronic mail.
-
-As an example, let's pretend we're a customer of Cygnus Support, and
-that we're having a problem compiling some of our software using the
-@sc{gnu} C compiler, which Cygnus supports.
-
-Assume that we're getting an error in our @code{bifrabulator} program
-wherein the @samp{prestidigitation} routines don't match with the
-@samp{whatsitsname}. We've made sure we're following the rules of the
-program and checked the Release Notes from Cygnus and found that the bug
-isn't already known. In other words, we're pretty sure we've found a
-bug.
-
-@cindex Imaginary Software, Ltd.
-Our first step is to call @code{send-pr}. It really doesn't matter
-whether we use @code{send-pr} from the shell or from within Emacs.
-Indeed, if we use Emacs as a primary editor, calling @code{send-pr} from
-the shell is likely to start @code{send-pr} in an Emacs buffer anyway.
-So, since our company, @emph{Imaginary Software, Ltd.}, uses @sc{gnu}
-software extensively, we're pretty familiar with Emacs, so from within
-Emacs we type
-@smallexample
-M-x send-pr
-@end smallexample
-@noindent
-and we're greeted with the following screen:
-
-@cindex default PR template
-@cindex example of a default template
-@cindex blank PR template
-@cindex @code{bifrabulator}
-@cartouche
-@smallexample
-SEND-PR: -*- text -*-
-SEND-PR: Lines starting with `SEND-PR' will be removed
-SEND-PR: automatically as well as all comments (the text
-SEND-PR: below enclosed in `<' and `>').
-SEND-PR: Please consult the manual if you are not sure
-SEND-PR: how to fill out a problem report.
-SEND-PR:
-SEND-PR: Choose from the following categories:
-SEND-PR:
-SEND-PR: bfd binutils bison
-SEND-PR: byacc clib config cvs diff
-SEND-PR: doc emacs flex g++ gas
-SEND-PR: gcc gdb glob gprof grep
-SEND-PR: info ispell kerberos ld libg++
-SEND-PR: libiberty make makeinfo mas newlib
-SEND-PR: other patch rcs readline send-pr
-SEND-PR: test texindex texinfo texinfo.tex
-SEND-PR: bifrabulator <---@emph{note: this one is fake}
-SEND-PR:
-To: cygnus-bugs@@cygnus.com
-Subject:
-From: jeffrey@@imaginary.com
-Reply-To: jeffrey@@imaginary.com
-X-send-pr-version: send-pr @value{VERSION}
-
->Submitter-Id: imaginary
->Originator: Jeffrey Osier
->Organization:
-Imaginary Software, Ltd.
->Confidential: <[ yes | no ] (one line)>
->Synopsis: <synopsis of the problem (one line)>
->Severity: <[ non-critical | serious | critical ] (one line)>
->Priority: <[ low | medium | high ] (one line)>
->Category: <name of the product (one line)>
->Class: <[sw-bug|doc-bug|change-request|support](oneline)>
->Release: <release number or tag (one line)>
->Environment:
- <machine, os, target, libraries (multiple lines)>
-System: SunOS imaginary.com 4.1.1 1 sun4
-Architecture: sun4
-
->Description:
- <precise description of the problem (multiple lines)>
->How-To-Repeat:
- <code/input/activities to reproduce (multiple lines)>
->Fix:
-@iftex
-@hrule
-@end iftex
------Emacs: *send-pr* (send-pr Fill)----All------------------
-@iftex
-@hrule
-@end iftex
->Category: other[]
-@end smallexample
-@end cartouche
-@page
-We know from past experience that we need to set certain information into
-each field, so we compile all the information we know about our problem.
-We have some sample code which we know should work, even though it
-doesn't, so we'll include that. Below is the completed PR; we send this
-using @kbd{C-c C-c}. (The comments have been truncated).
-
-@cindex completed Problem Report
-@cindex example of a completed PR
-@cartouche
-@smallexample
-SEND-PR: Lines starting with `SEND-PR' will be removed
-SEND-PR: automatically as well as all comments (the text
-SEND-PR: @dots{}
-SEND-PR:
-To: cygnus-bugs@@cygnus.com
-Subject: bifrabulator routines don't match
-From: jeffrey@@imaginary.com
-Reply-To: jeffrey@@imaginary.com
-X-send-pr-version: send-pr @value{VERSION}
-
->Submitter-Id: imaginary
->Originator: Jeffrey Osier
->Organization:
-Imaginary Software, Ltd.
->Confidential: no
->Synopsis: bifrabulator routines don't match
->Severity: serious
->Priority: medium
->Category: bifrabulator
->Class: sw-bug
->Release: progressive-930101
->Environment:
-System: SunOS imaginary.com 4.1.1 1 sun4
-Architecture: sun4 (SPARC)
-
->Description:
- the following code I fed into the bifrabulator came back
- with a strange error. apparently, the prestidigitation
- routine doesn't match with the whatsitsname in all cases.
-
->How-To-Repeat:
- call the bifrabulator on the following code.
- @emph{code sample@dots{}}
-
->Fix:
-@iftex
-@hrule
-@end iftex
------Emacs: *send-pr* (send-pr Fill)----All------------------
-@iftex
-@hrule
-@end iftex
-To send the problem report use: C-c C-c
-@end smallexample
-@end cartouche
-
-We type @kbd{C-c C-c}, and off it goes. Now, we depend on Cygnus
-Support to figure out the answer to our problem.
-
-Soon afterward, we get the following message from Cygnus:
-
-@smallexample
-@group
-From: gnats (GNATS management)
-Sender: gnats-admin
-Reply-To: hacker@@cygnus.com
-To: jeffrey@@imaginary.com
-Subject: Re: bifrabulator/1425: routines don't match
-
-Thank you very much for your problem report.
-It has the internal identification: g++/1425.
-The individual assigned to look at your bug is: hacker
-(F.B. Hacker)
-
-Category: bifrabulator
-Responsible: hacker
-Synopsis: bifrabulator routines don't match
-Arrival-Date: Sat Feb 30 03:12:55 1993
-@end group
-@end smallexample
-
-@noindent
-This is our receipt that the bug has been accepted and forwarded to the
-responsible party.
-
-@noindent
-A while later, we get the analysis:
-
-@smallexample
-@group
-To: jeffrey@@imaginary.com
-From: hacker@@cygnus.com
-Subject: Re: bifrabulator/1425: routines don't match
-Reply-To: hacker@@cygnus.com
-
-Got your message, Jeff. It seems that the bifrabulator was
-confusing the prestidigitation routines with the realitychecker
-when lexically parsing the whatsitsname.
-
-I'm working on robustisizing the bifrabulator now.
-
-How about lunch next week?
---
-F.B. Hacker
-Cygnus Support, Mountain View, CA 415 903 1400
-#include <std-disclaimer.h>
-@end group
-@end smallexample
-
-@noindent
-About the same time, we get another message from Cygnus.
-
-@cindex state change example
-@cindex example of a state change
-@smallexample
-@group
-From: hacker@@cygnus.com
-To: jeffrey@@imaginary.com
-Subject: Re: bifrabulator/1425: doesn't match prestidig
-Reply-To: hacker@@cygnus.com
-
-
- `F.B. Hacker' changed the state to `analyzed'.
-
-State-Changed-From-To: open-analyzed
-State-Changed-By: hacker
-State-Changed-When: Fri Feb 31 1993 08:59:16 1993
-State-Changed-Why:
- figured out the problem, working on a patch this afternoon
---
-F.B. Hacker
-Cygnus Support, Mountain View, CA 415 903 1400
-#include <std-disclaimer.h>
-@end group
-@end smallexample
-
-@noindent
-The bug has now been analyzed, and Cygnus is working on a solution.
-
-@noindent
-Sometime later, we get more mail from F.B.:
-
-@smallexample
-@group
-To: jeffrey@@imaginary.com
-From: hacker@@cygnus.com
-Subject: Re: bifrabulator/1425: routines don't match
-Reply-To: hacker@@cygnus.com
-
-There's a patch now that you can ftp over and check out.
-
-Hey, that joke you sent me was great! The one about the
-strings walking into a bar... my boss laughed for an hour!
---
-F.B. Hacker
-Cygnus Support, Mountain View, CA 415 903 1400
-#include <std-disclaimer.h>
-@end group
-@end smallexample
-@sp 2
-@smallexample
-@group
-From: hacker@@cygnus.com
-To: jeffrey@@imaginary.com
-Subject: Re: bifrabulator/1425: doesn't match prestidig
-Reply-To: hacker@@cygnus.com
-
-
- `F.B. Hacker' changed the state to `feedback'.
-
-State-Changed-From-To: analyzed-feedback
-State-Changed-By: hacker
-State-Changed-When: Fri Feb 31 1993 23:43:16 1993
-State-Changed-Why:
- got the patch finished, notified Jeff at Imaginary Software
---
-F.B. Hacker
-Cygnus Support, Mountain View, CA 415 903 1400
-#include <std-disclaimer.h>
-@end group
-@end smallexample
-
-@noindent
-The bug has gone into @dfn{feedback} status now, until we get the patch,
-install it and test it. When everything tests well, we can mail F.B.
-back and tell him the bug's been fixed, and he can change the state of
-the PR from @dfn{feedback} to @dfn{closed}.
-
-Following is a list of valid @samp{>Category:} entries that are
-supported by Cygnus.
-
-@menu
-* Valid Categories::
-@end menu
-
-@c FIXME - is this list up to date?
-@include categ.texi
-
-@node Installing send-pr
-@appendix Installing @code{send-pr} on your system
-@cindex installation
-
-If you receive @code{send-pr} as part of a larger software distribution,
-it probably gets installed when the full distribution is installed. If
-you are using @sc{gnats} at your site as well, you must decide where
-@code{send-pr} sends Problem Reports by default; see @ref{default site,,
-Setting a default @var{site}}.
-
-@menu
-* installation:: installing `send-pr' by itself
-* default site:: setting a default site
-@end menu
-
-@node installation
-@section Installing @code{send-pr} by itself
-@cindex installation procedure
-
-Install @code{send-pr} by following these steps (you may need
-@code{root} access in order to change the @file{aliases} file and to
-install @code{send-pr}):
-
-@itemize @bullet
-@item
-Unpack the distribution into a directory which we refer to as
-@var{srcdir}.
-
-@item
-Edit the file @file{Makefile} to reflect local conventions.
-Specifically, you should edit the variable @samp{prefix} to alter the
-installation location. The default is @file{/usr/local}. All files are
-installed under @samp{prefix} (see below).
-
-@item @emph{Run}
-@smallexample
-make all install [ info ] [ install-info ] [ clean ]
-@end smallexample
-
-@noindent
-The targets mean the following:
-
-@table @code
-@item all
-Builds @code{send-pr} and @code{install-sid}
-
-@item install
-Installs the following:
-
-@table @code
-@item install-sid
-@itemx send-pr
-into @file{@var{prefix}/bin}
-
-@item send-pr.1
-into @file{@var{prefix}/man/man1}
-
-@item @var{site}
-the list of valid @var{categories} for the Support Site from which you
-received @code{send-pr}, installed as
-@w{@file{@var{prefix}/lib/gnats/@var{site}}}
-
-@item send-pr.el
-into @w{@file{@var{prefix}/lib/emacs/lisp}}@footnote{If your main Emacs
-lisp repository is in a different directory from this, substitute that
-directory for @w{@file{@var{prefix}/lib/emacs/lisp}}.}
-@end table
-
-@item info (@emph{optional})
-Builds @file{send-pr.info} from @file{send-pr.texi}@*
-@c FIXME - is this still true?
-(@file{send-pr.info} is included with this distribution)
-
-@item install-info (@emph{optional})
-Installs @file{send-pr.info} into @w{@file{@var{prefix}/info}}
-
-@item clean (@emph{optional})
-Removes all intermediary build files that can be rebuilt from source
-code
-@end table
-
-@item
-Run
-
-@smallexample
-install-sid @var{your-sid}
-@end smallexample
-
-@noindent
-where @var{your-sid} is the identification code you received with
-@w{@code{send-pr}}. @code{send-pr} automatically inserts this value
-into the template field @samp{>Submitter-Id:}. If you've downloaded
-@code{send-pr} from the Net, use @samp{net} for this value.
-
-@item
-Place the following line in
-@w{@file{@var{prefix}/lib/emacs/lisp/default.el}}, or instruct your
-users to place the following line in their @file{.emacs} files:
-
-@smallexample
-(autoload 'send-pr "send-pr" "Submit a Problem Report." t)
-@end smallexample
-
-@item
-Create a mail alias for the Support Site from which you received
-@code{send-pr}, and for every site with which you wish to use
-@code{send-pr} to communicate. Each alias must have a suffix of
-@samp{-gnats}. The Support Site(s) will provide the correct addresses
-where these aliases should point. For instance, edit your mail aliases
-file to contain something like:
-
-@smallexample
-# support sites; for use with send-pr
-cygnus-gnats: bugs@@cygnus.com # Cygnus Support
-bumblebee-gnats: bumblebugs@@bumblebee.com # Bumblebee Inc.
-mycompany-gnats: bugs@@my.company.com (@emph{if you use @sc{gnats} locally})
-@end smallexample
-
-@code{send-pr} automatically searches for these aliases when you type
-
-@smallexample
-send-pr cygnus
-send-pr bumblebee
-send-pr @var{site}@dots{}
-@end smallexample
-
-@noindent
-@code{send-pr} also uses @var{site} to determine the categories of
-problems accepted by the site in question by looking in
-
-@smallexample
-@var{prefix}/lib/gnats/@var{site}
-@end smallexample
-
-@end itemize
-
-@node default site
-@section Setting a default @var{site}
-@cindex default @var{site}
-@cindex setting a default @var{site}
-
-@code{send-pr} is capable of sending Problem Reports to any number of
-Support Sites, using mail aliases which have @samp{-gnats} appended them.
-@code{send-pr} automatically appends the suffix, so that when you type
-
-@smallexample
-send-pr @var{site}
-@end smallexample
-
-@noindent
-the Problem Report goes to the address noted in the @file{aliases} file
-as @w{@samp{@var{site}-gnats}}. You can do this in the Emacs version of
-@code{send-pr} by invoking the program with
-
-@smallexample
-C-u M-x send-pr
-@end smallexample
-
-@noindent
-You are prompted for @var{site}.
-
-@var{site} is also used to error-check the @samp{>Category:} field, as a
-precaution against sending mistaken information (and against sending
-information to the wrong site).
-
-You may also simply type
-
-@smallexample
-send-pr
-@end smallexample
-
-@noindent
-from the shell (or @w{@samp{M-x send-pr}} in Emacs), and the Problem
-Report you generate will be sent to the @var{site}, which is usually the
-site from which you received your distribution of @w{@code{send-pr}}.
-If you use @sc{gnats} at your own organization, the default is usually
-your local address for reporting problems.
-
-To change this, simply edit the file @file{Makefile} before installing
-and change the line
-
-@smallexample
-GNATS_SITE = @var{site}
-@end smallexample
-
-@noindent
-to reflect the site where you wish to send PRs by default.
-
-@c ---------------------------------------------------------------
-@node Index
-@unnumbered Index
-
-@printindex cp
-
-@c ---------------------------------------------------------------
-@contents
-@bye
diff --git a/gnu/usr.bin/tar/regex.c b/gnu/usr.bin/tar/regex.c
deleted file mode 100644
index febdb71..0000000
--- a/gnu/usr.bin/tar/regex.c
+++ /dev/null
@@ -1,4923 +0,0 @@
-/* Extended regular expression matching and search library,
- version 0.11.
- (Implements POSIX draft P10003.2/D11.2, except for
- internationalization features.)
-
- Copyright (C) 1993 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* AIX requires this to be the first thing in the file. */
-#if defined (_AIX) && !defined (REGEX_MALLOC)
- #pragma alloca
-#endif
-
-#define _GNU_SOURCE
-
-/* We need this for `regex.h', and perhaps for the Emacs include files. */
-#include <sys/types.h>
-#include <ctype.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-/* The `emacs' switch turns on certain matching commands
- that make sense only in Emacs. */
-#ifdef emacs
-
-#include "lisp.h"
-#include "buffer.h"
-#include "syntax.h"
-
-/* Emacs uses `NULL' as a predicate. */
-#undef NULL
-
-#else /* not emacs */
-
-/* We used to test for `BSTRING' here, but only GCC and Emacs define
- `BSTRING', as far as I know, and neither of them use this code. */
-#if HAVE_STRING_H || STDC_HEADERS
-#include <string.h>
-#ifndef bcmp
-#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
-#endif
-#ifndef bcopy
-#define bcopy(s, d, n) memcpy ((d), (s), (n))
-#endif
-#ifndef bzero
-#define bzero(s, n) memset ((s), 0, (n))
-#endif
-#else
-#include <strings.h>
-#endif
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#else
-char *malloc ();
-char *realloc ();
-#endif
-
-
-/* Define the syntax stuff for \<, \>, etc. */
-
-/* This must be nonzero for the wordchar and notwordchar pattern
- commands in re_match_2. */
-#ifndef Sword
-#define Sword 1
-#endif
-
-#ifdef SYNTAX_TABLE
-
-extern char *re_syntax_table;
-
-#else /* not SYNTAX_TABLE */
-
-/* How many characters in the character set. */
-#define CHAR_SET_SIZE 256
-
-static char re_syntax_table[CHAR_SET_SIZE];
-
-static void
-init_syntax_once ()
-{
- register int c;
- static int done = 0;
-
- if (done)
- return;
-
- bzero (re_syntax_table, sizeof re_syntax_table);
-
- for (c = 0; c < CHAR_SET_SIZE; c++)
- if (isalnum(c))
- re_syntax_table[c] = Sword;
-
- re_syntax_table['_'] = Sword;
-
- done = 1;
-}
-
-#endif /* not SYNTAX_TABLE */
-
-#define SYNTAX(c) re_syntax_table[c]
-
-#endif /* not emacs */
-
-/* Get the interface, including the syntax bits. */
-#include "regex.h"
-
-/* isalpha etc. are used for the character classes. */
-
-#ifdef isblank
-#define ISBLANK(c) isblank (c)
-#else
-#define ISBLANK(c) ((c) == ' ' || (c) == '\t')
-#endif
-#ifdef isgraph
-#define ISGRAPH(c) isgraph (c)
-#else
-#define ISGRAPH(c) (isprint (c) && !isspace (c))
-#endif
-
-#define ISPRINT(c) isprint (c)
-#define ISDIGIT(c) isdigit (c)
-#define ISALNUM(c) isalnum (c)
-#define ISALPHA(c) isalpha (c)
-#define ISCNTRL(c) iscntrl (c)
-#define ISLOWER(c) islower (c)
-#define ISPUNCT(c) ispunct (c)
-#define ISSPACE(c) isspace (c)
-#define ISUPPER(c) isupper (c)
-#define ISXDIGIT(c) isxdigit (c)
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* We remove any previous definition of `SIGN_EXTEND_CHAR',
- since ours (we hope) works properly with all combinations of
- machines, compilers, `char' and `unsigned char' argument types.
- (Per Bothner suggested the basic approach.) */
-#undef SIGN_EXTEND_CHAR
-#if __STDC__
-#define SIGN_EXTEND_CHAR(c) ((signed char) (c))
-#else /* not __STDC__ */
-/* As in Harbison and Steele. */
-#define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
-#endif
-
-/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we
- use `alloca' instead of `malloc'. This is because using malloc in
- re_search* or re_match* could cause memory leaks when C-g is used in
- Emacs; also, malloc is slower and causes storage fragmentation. On
- the other hand, malloc is more portable, and easier to debug.
-
- Because we sometimes use alloca, some routines have to be macros,
- not functions -- `alloca'-allocated space disappears at the end of the
- function it is called in. */
-
-#ifdef REGEX_MALLOC
-
-#define REGEX_ALLOCATE malloc
-#define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize)
-
-#else /* not REGEX_MALLOC */
-
-/* Emacs already defines alloca, sometimes. */
-#ifndef alloca
-
-/* Make alloca work the best possible way. */
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else /* not __GNUC__ */
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#else /* not __GNUC__ or HAVE_ALLOCA_H */
-#ifndef _AIX /* Already did AIX, up at the top. */
-char *alloca ();
-#endif /* not _AIX */
-#endif /* not HAVE_ALLOCA_H */
-#endif /* not __GNUC__ */
-
-#endif /* not alloca */
-
-#define REGEX_ALLOCATE alloca
-
-/* Assumes a `char *destination' variable. */
-#define REGEX_REALLOCATE(source, osize, nsize) \
- (destination = (char *) alloca (nsize), \
- bcopy (source, destination, osize), \
- destination)
-
-#endif /* not REGEX_MALLOC */
-
-
-/* True if `size1' is non-NULL and PTR is pointing anywhere inside
- `string1' or just past its end. This works if PTR is NULL, which is
- a good thing. */
-#define FIRST_STRING_P(ptr) \
- (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
-
-/* (Re)Allocate N items of type T using malloc, or fail. */
-#define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t)))
-#define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
-#define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
-
-#define BYTEWIDTH 8 /* In bits. */
-
-#define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
-
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-
-typedef char boolean;
-#define false 0
-#define true 1
-
-/* These are the command codes that appear in compiled regular
- expressions. Some opcodes are followed by argument bytes. A
- command code can specify any interpretation whatsoever for its
- arguments. Zero bytes may appear in the compiled regular expression.
-
- The value of `exactn' is needed in search.c (search_buffer) in Emacs.
- So regex.h defines a symbol `RE_EXACTN_VALUE' to be 1; the value of
- `exactn' we use here must also be 1. */
-
-typedef enum
-{
- no_op = 0,
-
- /* Followed by one byte giving n, then by n literal bytes. */
- exactn = 1,
-
- /* Matches any (more or less) character. */
- anychar,
-
- /* Matches any one char belonging to specified set. First
- following byte is number of bitmap bytes. Then come bytes
- for a bitmap saying which chars are in. Bits in each byte
- are ordered low-bit-first. A character is in the set if its
- bit is 1. A character too large to have a bit in the map is
- automatically not in the set. */
- charset,
-
- /* Same parameters as charset, but match any character that is
- not one of those specified. */
- charset_not,
-
- /* Start remembering the text that is matched, for storing in a
- register. Followed by one byte with the register number, in
- the range 0 to one less than the pattern buffer's re_nsub
- field. Then followed by one byte with the number of groups
- inner to this one. (This last has to be part of the
- start_memory only because we need it in the on_failure_jump
- of re_match_2.) */
- start_memory,
-
- /* Stop remembering the text that is matched and store it in a
- memory register. Followed by one byte with the register
- number, in the range 0 to one less than `re_nsub' in the
- pattern buffer, and one byte with the number of inner groups,
- just like `start_memory'. (We need the number of inner
- groups here because we don't have any easy way of finding the
- corresponding start_memory when we're at a stop_memory.) */
- stop_memory,
-
- /* Match a duplicate of something remembered. Followed by one
- byte containing the register number. */
- duplicate,
-
- /* Fail unless at beginning of line. */
- begline,
-
- /* Fail unless at end of line. */
- endline,
-
- /* Succeeds if at beginning of buffer (if emacs) or at beginning
- of string to be matched (if not). */
- begbuf,
-
- /* Analogously, for end of buffer/string. */
- endbuf,
-
- /* Followed by two byte relative address to which to jump. */
- jump,
-
- /* Same as jump, but marks the end of an alternative. */
- jump_past_alt,
-
- /* Followed by two-byte relative address of place to resume at
- in case of failure. */
- on_failure_jump,
-
- /* Like on_failure_jump, but pushes a placeholder instead of the
- current string position when executed. */
- on_failure_keep_string_jump,
-
- /* Throw away latest failure point and then jump to following
- two-byte relative address. */
- pop_failure_jump,
-
- /* Change to pop_failure_jump if know won't have to backtrack to
- match; otherwise change to jump. This is used to jump
- back to the beginning of a repeat. If what follows this jump
- clearly won't match what the repeat does, such that we can be
- sure that there is no use backtracking out of repetitions
- already matched, then we change it to a pop_failure_jump.
- Followed by two-byte address. */
- maybe_pop_jump,
-
- /* Jump to following two-byte address, and push a dummy failure
- point. This failure point will be thrown away if an attempt
- is made to use it for a failure. A `+' construct makes this
- before the first repeat. Also used as an intermediary kind
- of jump when compiling an alternative. */
- dummy_failure_jump,
-
- /* Push a dummy failure point and continue. Used at the end of
- alternatives. */
- push_dummy_failure,
-
- /* Followed by two-byte relative address and two-byte number n.
- After matching N times, jump to the address upon failure. */
- succeed_n,
-
- /* Followed by two-byte relative address, and two-byte number n.
- Jump to the address N times, then fail. */
- jump_n,
-
- /* Set the following two-byte relative address to the
- subsequent two-byte number. The address *includes* the two
- bytes of number. */
- set_number_at,
-
- wordchar, /* Matches any word-constituent character. */
- notwordchar, /* Matches any char that is not a word-constituent. */
-
- wordbeg, /* Succeeds if at word beginning. */
- wordend, /* Succeeds if at word end. */
-
- wordbound, /* Succeeds if at a word boundary. */
- notwordbound /* Succeeds if not at a word boundary. */
-
-#ifdef emacs
- ,before_dot, /* Succeeds if before point. */
- at_dot, /* Succeeds if at point. */
- after_dot, /* Succeeds if after point. */
-
- /* Matches any character whose syntax is specified. Followed by
- a byte which contains a syntax code, e.g., Sword. */
- syntaxspec,
-
- /* Matches any character whose syntax is not that specified. */
- notsyntaxspec
-#endif /* emacs */
-} re_opcode_t;
-
-/* Common operations on the compiled pattern. */
-
-/* Store NUMBER in two contiguous bytes starting at DESTINATION. */
-
-#define STORE_NUMBER(destination, number) \
- do { \
- (destination)[0] = (number) & 0377; \
- (destination)[1] = (number) >> 8; \
- } while (0)
-
-/* Same as STORE_NUMBER, except increment DESTINATION to
- the byte after where the number is stored. Therefore, DESTINATION
- must be an lvalue. */
-
-#define STORE_NUMBER_AND_INCR(destination, number) \
- do { \
- STORE_NUMBER (destination, number); \
- (destination) += 2; \
- } while (0)
-
-/* Put into DESTINATION a number stored in two contiguous bytes starting
- at SOURCE. */
-
-#define EXTRACT_NUMBER(destination, source) \
- do { \
- (destination) = *(source) & 0377; \
- (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \
- } while (0)
-
-#ifdef DEBUG
-static void
-extract_number (dest, source)
- int *dest;
- unsigned char *source;
-{
- int temp = SIGN_EXTEND_CHAR (*(source + 1));
- *dest = *source & 0377;
- *dest += temp << 8;
-}
-
-#ifndef EXTRACT_MACROS /* To debug the macros. */
-#undef EXTRACT_NUMBER
-#define EXTRACT_NUMBER(dest, src) extract_number (&dest, src)
-#endif /* not EXTRACT_MACROS */
-
-#endif /* DEBUG */
-
-/* Same as EXTRACT_NUMBER, except increment SOURCE to after the number.
- SOURCE must be an lvalue. */
-
-#define EXTRACT_NUMBER_AND_INCR(destination, source) \
- do { \
- EXTRACT_NUMBER (destination, source); \
- (source) += 2; \
- } while (0)
-
-#ifdef DEBUG
-static void
-extract_number_and_incr (destination, source)
- int *destination;
- unsigned char **source;
-{
- extract_number (destination, *source);
- *source += 2;
-}
-
-#ifndef EXTRACT_MACROS
-#undef EXTRACT_NUMBER_AND_INCR
-#define EXTRACT_NUMBER_AND_INCR(dest, src) \
- extract_number_and_incr (&dest, &src)
-#endif /* not EXTRACT_MACROS */
-
-#endif /* DEBUG */
-
-/* If DEBUG is defined, Regex prints many voluminous messages about what
- it is doing (if the variable `debug' is nonzero). If linked with the
- main program in `iregex.c', you can enter patterns and strings
- interactively. And if linked with the main program in `main.c' and
- the other test files, you can run the already-written tests. */
-
-#ifdef DEBUG
-
-/* We use standard I/O for debugging. */
-#include <stdio.h>
-
-/* It is useful to test things that ``must'' be true when debugging. */
-#include <assert.h>
-
-static int debug = 0;
-
-#define DEBUG_STATEMENT(e) e
-#define DEBUG_PRINT1(x) if (debug) printf (x)
-#define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2)
-#define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3)
-#define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4)
-#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \
- if (debug) print_partial_compiled_pattern (s, e)
-#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \
- if (debug) print_double_string (w, s1, sz1, s2, sz2)
-
-
-extern void printchar ();
-
-/* Print the fastmap in human-readable form. */
-
-void
-print_fastmap (fastmap)
- char *fastmap;
-{
- unsigned was_a_range = 0;
- unsigned i = 0;
-
- while (i < (1 << BYTEWIDTH))
- {
- if (fastmap[i++])
- {
- was_a_range = 0;
- printchar (i - 1);
- while (i < (1 << BYTEWIDTH) && fastmap[i])
- {
- was_a_range = 1;
- i++;
- }
- if (was_a_range)
- {
- printf ("-");
- printchar (i - 1);
- }
- }
- }
- putchar ('\n');
-}
-
-
-/* Print a compiled pattern string in human-readable form, starting at
- the START pointer into it and ending just before the pointer END. */
-
-void
-print_partial_compiled_pattern (start, end)
- unsigned char *start;
- unsigned char *end;
-{
- int mcnt, mcnt2;
- unsigned char *p = start;
- unsigned char *pend = end;
-
- if (start == NULL)
- {
- printf ("(null)\n");
- return;
- }
-
- /* Loop over pattern commands. */
- while (p < pend)
- {
- switch ((re_opcode_t) *p++)
- {
- case no_op:
- printf ("/no_op");
- break;
-
- case exactn:
- mcnt = *p++;
- printf ("/exactn/%d", mcnt);
- do
- {
- putchar ('/');
- printchar (*p++);
- }
- while (--mcnt);
- break;
-
- case start_memory:
- mcnt = *p++;
- printf ("/start_memory/%d/%d", mcnt, *p++);
- break;
-
- case stop_memory:
- mcnt = *p++;
- printf ("/stop_memory/%d/%d", mcnt, *p++);
- break;
-
- case duplicate:
- printf ("/duplicate/%d", *p++);
- break;
-
- case anychar:
- printf ("/anychar");
- break;
-
- case charset:
- case charset_not:
- {
- register int c;
-
- printf ("/charset%s",
- (re_opcode_t) *(p - 1) == charset_not ? "_not" : "");
-
- assert (p + *p < pend);
-
- for (c = 0; c < *p; c++)
- {
- unsigned bit;
- unsigned char map_byte = p[1 + c];
-
- putchar ('/');
-
- for (bit = 0; bit < BYTEWIDTH; bit++)
- if (map_byte & (1 << bit))
- printchar (c * BYTEWIDTH + bit);
- }
- p += 1 + *p;
- break;
- }
-
- case begline:
- printf ("/begline");
- break;
-
- case endline:
- printf ("/endline");
- break;
-
- case on_failure_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/on_failure_jump/0/%d", mcnt);
- break;
-
- case on_failure_keep_string_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/on_failure_keep_string_jump/0/%d", mcnt);
- break;
-
- case dummy_failure_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/dummy_failure_jump/0/%d", mcnt);
- break;
-
- case push_dummy_failure:
- printf ("/push_dummy_failure");
- break;
-
- case maybe_pop_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/maybe_pop_jump/0/%d", mcnt);
- break;
-
- case pop_failure_jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/pop_failure_jump/0/%d", mcnt);
- break;
-
- case jump_past_alt:
- extract_number_and_incr (&mcnt, &p);
- printf ("/jump_past_alt/0/%d", mcnt);
- break;
-
- case jump:
- extract_number_and_incr (&mcnt, &p);
- printf ("/jump/0/%d", mcnt);
- break;
-
- case succeed_n:
- extract_number_and_incr (&mcnt, &p);
- extract_number_and_incr (&mcnt2, &p);
- printf ("/succeed_n/0/%d/0/%d", mcnt, mcnt2);
- break;
-
- case jump_n:
- extract_number_and_incr (&mcnt, &p);
- extract_number_and_incr (&mcnt2, &p);
- printf ("/jump_n/0/%d/0/%d", mcnt, mcnt2);
- break;
-
- case set_number_at:
- extract_number_and_incr (&mcnt, &p);
- extract_number_and_incr (&mcnt2, &p);
- printf ("/set_number_at/0/%d/0/%d", mcnt, mcnt2);
- break;
-
- case wordbound:
- printf ("/wordbound");
- break;
-
- case notwordbound:
- printf ("/notwordbound");
- break;
-
- case wordbeg:
- printf ("/wordbeg");
- break;
-
- case wordend:
- printf ("/wordend");
-
-#ifdef emacs
- case before_dot:
- printf ("/before_dot");
- break;
-
- case at_dot:
- printf ("/at_dot");
- break;
-
- case after_dot:
- printf ("/after_dot");
- break;
-
- case syntaxspec:
- printf ("/syntaxspec");
- mcnt = *p++;
- printf ("/%d", mcnt);
- break;
-
- case notsyntaxspec:
- printf ("/notsyntaxspec");
- mcnt = *p++;
- printf ("/%d", mcnt);
- break;
-#endif /* emacs */
-
- case wordchar:
- printf ("/wordchar");
- break;
-
- case notwordchar:
- printf ("/notwordchar");
- break;
-
- case begbuf:
- printf ("/begbuf");
- break;
-
- case endbuf:
- printf ("/endbuf");
- break;
-
- default:
- printf ("?%d", *(p-1));
- }
- }
- printf ("/\n");
-}
-
-
-void
-print_compiled_pattern (bufp)
- struct re_pattern_buffer *bufp;
-{
- unsigned char *buffer = bufp->buffer;
-
- print_partial_compiled_pattern (buffer, buffer + bufp->used);
- printf ("%d bytes used/%d bytes allocated.\n", bufp->used, bufp->allocated);
-
- if (bufp->fastmap_accurate && bufp->fastmap)
- {
- printf ("fastmap: ");
- print_fastmap (bufp->fastmap);
- }
-
- printf ("re_nsub: %d\t", bufp->re_nsub);
- printf ("regs_alloc: %d\t", bufp->regs_allocated);
- printf ("can_be_null: %d\t", bufp->can_be_null);
- printf ("newline_anchor: %d\n", bufp->newline_anchor);
- printf ("no_sub: %d\t", bufp->no_sub);
- printf ("not_bol: %d\t", bufp->not_bol);
- printf ("not_eol: %d\t", bufp->not_eol);
- printf ("syntax: %d\n", bufp->syntax);
- /* Perhaps we should print the translate table? */
-}
-
-
-void
-print_double_string (where, string1, size1, string2, size2)
- const char *where;
- const char *string1;
- const char *string2;
- int size1;
- int size2;
-{
- unsigned this_char;
-
- if (where == NULL)
- printf ("(null)");
- else
- {
- if (FIRST_STRING_P (where))
- {
- for (this_char = where - string1; this_char < size1; this_char++)
- printchar (string1[this_char]);
-
- where = string2;
- }
-
- for (this_char = where - string2; this_char < size2; this_char++)
- printchar (string2[this_char]);
- }
-}
-
-#else /* not DEBUG */
-
-#undef assert
-#define assert(e)
-
-#define DEBUG_STATEMENT(e)
-#define DEBUG_PRINT1(x)
-#define DEBUG_PRINT2(x1, x2)
-#define DEBUG_PRINT3(x1, x2, x3)
-#define DEBUG_PRINT4(x1, x2, x3, x4)
-#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
-#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)
-
-#endif /* not DEBUG */
-
-/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can
- also be assigned to arbitrarily: each pattern buffer stores its own
- syntax, so it can be changed between regex compilations. */
-reg_syntax_t re_syntax_options = RE_SYNTAX_EMACS;
-
-
-/* Specify the precise syntax of regexps for compilation. This provides
- for compatibility for various utilities which historically have
- different, incompatible syntaxes.
-
- The argument SYNTAX is a bit mask comprised of the various bits
- defined in regex.h. We return the old syntax. */
-
-reg_syntax_t
-re_set_syntax (syntax)
- reg_syntax_t syntax;
-{
- reg_syntax_t ret = re_syntax_options;
-
- re_syntax_options = syntax;
- return ret;
-}
-
-/* This table gives an error message for each of the error codes listed
- in regex.h. Obviously the order here has to be same as there. */
-
-static const char *re_error_msg[] =
- { NULL, /* REG_NOERROR */
- "No match", /* REG_NOMATCH */
- "Invalid regular expression", /* REG_BADPAT */
- "Invalid collation character", /* REG_ECOLLATE */
- "Invalid character class name", /* REG_ECTYPE */
- "Trailing backslash", /* REG_EESCAPE */
- "Invalid back reference", /* REG_ESUBREG */
- "Unmatched [ or [^", /* REG_EBRACK */
- "Unmatched ( or \\(", /* REG_EPAREN */
- "Unmatched \\{", /* REG_EBRACE */
- "Invalid content of \\{\\}", /* REG_BADBR */
- "Invalid range end", /* REG_ERANGE */
- "Memory exhausted", /* REG_ESPACE */
- "Invalid preceding regular expression", /* REG_BADRPT */
- "Premature end of regular expression", /* REG_EEND */
- "Regular expression too big", /* REG_ESIZE */
- "Unmatched ) or \\)", /* REG_ERPAREN */
- };
-
-/* Subroutine declarations and macros for regex_compile. */
-
-static void store_op1 (), store_op2 ();
-static void insert_op1 (), insert_op2 ();
-static boolean at_begline_loc_p (), at_endline_loc_p ();
-static boolean group_in_compile_stack ();
-static reg_errcode_t compile_range ();
-
-/* Fetch the next character in the uncompiled pattern---translating it
- if necessary. Also cast from a signed character in the constant
- string passed to us by the user to an unsigned char that we can use
- as an array index (in, e.g., `translate'). */
-#define PATFETCH(c) \
- do {if (p == pend) return REG_EEND; \
- c = (unsigned char) *p++; \
- if (translate) c = translate[c]; \
- } while (0)
-
-/* Fetch the next character in the uncompiled pattern, with no
- translation. */
-#define PATFETCH_RAW(c) \
- do {if (p == pend) return REG_EEND; \
- c = (unsigned char) *p++; \
- } while (0)
-
-/* Go backwards one character in the pattern. */
-#define PATUNFETCH p--
-
-
-/* If `translate' is non-null, return translate[D], else just D. We
- cast the subscript to translate because some data is declared as
- `char *', to avoid warnings when a string constant is passed. But
- when we use a character as a subscript we must make it unsigned. */
-#define TRANSLATE(d) (translate ? translate[(unsigned char) (d)] : (d))
-
-
-/* Macros for outputting the compiled pattern into `buffer'. */
-
-/* If the buffer isn't allocated when it comes in, use this. */
-#define INIT_BUF_SIZE 32
-
-/* Make sure we have at least N more bytes of space in buffer. */
-#define GET_BUFFER_SPACE(n) \
- while (b - bufp->buffer + (n) > bufp->allocated) \
- EXTEND_BUFFER ()
-
-/* Make sure we have one more byte of buffer space and then add C to it. */
-#define BUF_PUSH(c) \
- do { \
- GET_BUFFER_SPACE (1); \
- *b++ = (unsigned char) (c); \
- } while (0)
-
-
-/* Ensure we have two more bytes of buffer space and then append C1 and C2. */
-#define BUF_PUSH_2(c1, c2) \
- do { \
- GET_BUFFER_SPACE (2); \
- *b++ = (unsigned char) (c1); \
- *b++ = (unsigned char) (c2); \
- } while (0)
-
-
-/* As with BUF_PUSH_2, except for three bytes. */
-#define BUF_PUSH_3(c1, c2, c3) \
- do { \
- GET_BUFFER_SPACE (3); \
- *b++ = (unsigned char) (c1); \
- *b++ = (unsigned char) (c2); \
- *b++ = (unsigned char) (c3); \
- } while (0)
-
-
-/* Store a jump with opcode OP at LOC to location TO. We store a
- relative address offset by the three bytes the jump itself occupies. */
-#define STORE_JUMP(op, loc, to) \
- store_op1 (op, loc, (to) - (loc) - 3)
-
-/* Likewise, for a two-argument jump. */
-#define STORE_JUMP2(op, loc, to, arg) \
- store_op2 (op, loc, (to) - (loc) - 3, arg)
-
-/* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */
-#define INSERT_JUMP(op, loc, to) \
- insert_op1 (op, loc, (to) - (loc) - 3, b)
-
-/* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */
-#define INSERT_JUMP2(op, loc, to, arg) \
- insert_op2 (op, loc, (to) - (loc) - 3, arg, b)
-
-
-/* This is not an arbitrary limit: the arguments which represent offsets
- into the pattern are two bytes long. So if 2^16 bytes turns out to
- be too small, many things would have to change. */
-#define MAX_BUF_SIZE (1L << 16)
-
-
-/* Extend the buffer by twice its current size via realloc and
- reset the pointers that pointed into the old block to point to the
- correct places in the new one. If extending the buffer results in it
- being larger than MAX_BUF_SIZE, then flag memory exhausted. */
-#define EXTEND_BUFFER() \
- do { \
- unsigned char *old_buffer = bufp->buffer; \
- if (bufp->allocated == MAX_BUF_SIZE) \
- return REG_ESIZE; \
- bufp->allocated <<= 1; \
- if (bufp->allocated > MAX_BUF_SIZE) \
- bufp->allocated = MAX_BUF_SIZE; \
- bufp->buffer = (unsigned char *) realloc (bufp->buffer, bufp->allocated);\
- if (bufp->buffer == NULL) \
- return REG_ESPACE; \
- /* If the buffer moved, move all the pointers into it. */ \
- if (old_buffer != bufp->buffer) \
- { \
- b = (b - old_buffer) + bufp->buffer; \
- begalt = (begalt - old_buffer) + bufp->buffer; \
- if (fixup_alt_jump) \
- fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer;\
- if (laststart) \
- laststart = (laststart - old_buffer) + bufp->buffer; \
- if (pending_exact) \
- pending_exact = (pending_exact - old_buffer) + bufp->buffer; \
- } \
- } while (0)
-
-
-/* Since we have one byte reserved for the register number argument to
- {start,stop}_memory, the maximum number of groups we can report
- things about is what fits in that byte. */
-#define MAX_REGNUM 255
-
-/* But patterns can have more than `MAX_REGNUM' registers. We just
- ignore the excess. */
-typedef unsigned regnum_t;
-
-
-/* Macros for the compile stack. */
-
-/* Since offsets can go either forwards or backwards, this type needs to
- be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */
-typedef int pattern_offset_t;
-
-typedef struct
-{
- pattern_offset_t begalt_offset;
- pattern_offset_t fixup_alt_jump;
- pattern_offset_t inner_group_offset;
- pattern_offset_t laststart_offset;
- regnum_t regnum;
-} compile_stack_elt_t;
-
-
-typedef struct
-{
- compile_stack_elt_t *stack;
- unsigned size;
- unsigned avail; /* Offset of next open position. */
-} compile_stack_type;
-
-
-#define INIT_COMPILE_STACK_SIZE 32
-
-#define COMPILE_STACK_EMPTY (compile_stack.avail == 0)
-#define COMPILE_STACK_FULL (compile_stack.avail == compile_stack.size)
-
-/* The next available element. */
-#define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail])
-
-
-/* Set the bit for character C in a list. */
-#define SET_LIST_BIT(c) \
- (b[((unsigned char) (c)) / BYTEWIDTH] \
- |= 1 << (((unsigned char) c) % BYTEWIDTH))
-
-
-/* Get the next unsigned number in the uncompiled pattern. */
-#define GET_UNSIGNED_NUMBER(num) \
- { if (p != pend) \
- { \
- PATFETCH (c); \
- while (ISDIGIT (c)) \
- { \
- if (num < 0) \
- num = 0; \
- num = num * 10 + c - '0'; \
- if (p == pend) \
- break; \
- PATFETCH (c); \
- } \
- } \
- }
-
-#define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */
-
-#define IS_CHAR_CLASS(string) \
- (STREQ (string, "alpha") || STREQ (string, "upper") \
- || STREQ (string, "lower") || STREQ (string, "digit") \
- || STREQ (string, "alnum") || STREQ (string, "xdigit") \
- || STREQ (string, "space") || STREQ (string, "print") \
- || STREQ (string, "punct") || STREQ (string, "graph") \
- || STREQ (string, "cntrl") || STREQ (string, "blank"))
-
-/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
- Returns one of error codes defined in `regex.h', or zero for success.
-
- Assumes the `allocated' (and perhaps `buffer') and `translate'
- fields are set in BUFP on entry.
-
- If it succeeds, results are put in BUFP (if it returns an error, the
- contents of BUFP are undefined):
- `buffer' is the compiled pattern;
- `syntax' is set to SYNTAX;
- `used' is set to the length of the compiled pattern;
- `fastmap_accurate' is zero;
- `re_nsub' is the number of subexpressions in PATTERN;
- `not_bol' and `not_eol' are zero;
-
- The `fastmap' and `newline_anchor' fields are neither
- examined nor set. */
-
-static reg_errcode_t
-regex_compile (pattern, size, syntax, bufp)
- const char *pattern;
- int size;
- reg_syntax_t syntax;
- struct re_pattern_buffer *bufp;
-{
- /* We fetch characters from PATTERN here. Even though PATTERN is
- `char *' (i.e., signed), we declare these variables as unsigned, so
- they can be reliably used as array indices. */
- register unsigned char c, c1;
-
- /* A random tempory spot in PATTERN. */
- const char *p1;
-
- /* Points to the end of the buffer, where we should append. */
- register unsigned char *b;
-
- /* Keeps track of unclosed groups. */
- compile_stack_type compile_stack;
-
- /* Points to the current (ending) position in the pattern. */
- const char *p = pattern;
- const char *pend = pattern + size;
-
- /* How to translate the characters in the pattern. */
- char *translate = bufp->translate;
-
- /* Address of the count-byte of the most recently inserted `exactn'
- command. This makes it possible to tell if a new exact-match
- character can be added to that command or if the character requires
- a new `exactn' command. */
- unsigned char *pending_exact = 0;
-
- /* Address of start of the most recently finished expression.
- This tells, e.g., postfix * where to find the start of its
- operand. Reset at the beginning of groups and alternatives. */
- unsigned char *laststart = 0;
-
- /* Address of beginning of regexp, or inside of last group. */
- unsigned char *begalt;
-
- /* Place in the uncompiled pattern (i.e., the {) to
- which to go back if the interval is invalid. */
- const char *beg_interval;
-
- /* Address of the place where a forward jump should go to the end of
- the containing expression. Each alternative of an `or' -- except the
- last -- ends with a forward jump of this sort. */
- unsigned char *fixup_alt_jump = 0;
-
- /* Counts open-groups as they are encountered. Remembered for the
- matching close-group on the compile stack, so the same register
- number is put in the stop_memory as the start_memory. */
- regnum_t regnum = 0;
-
-#ifdef DEBUG
- DEBUG_PRINT1 ("\nCompiling pattern: ");
- if (debug)
- {
- unsigned debug_count;
-
- for (debug_count = 0; debug_count < size; debug_count++)
- printchar (pattern[debug_count]);
- putchar ('\n');
- }
-#endif /* DEBUG */
-
- /* Initialize the compile stack. */
- compile_stack.stack = TALLOC (INIT_COMPILE_STACK_SIZE, compile_stack_elt_t);
- if (compile_stack.stack == NULL)
- return REG_ESPACE;
-
- compile_stack.size = INIT_COMPILE_STACK_SIZE;
- compile_stack.avail = 0;
-
- /* Initialize the pattern buffer. */
- bufp->syntax = syntax;
- bufp->fastmap_accurate = 0;
- bufp->not_bol = bufp->not_eol = 0;
-
- /* Set `used' to zero, so that if we return an error, the pattern
- printer (for debugging) will think there's no pattern. We reset it
- at the end. */
- bufp->used = 0;
-
- /* Always count groups, whether or not bufp->no_sub is set. */
- bufp->re_nsub = 0;
-
-#if !defined (emacs) && !defined (SYNTAX_TABLE)
- /* Initialize the syntax table. */
- init_syntax_once ();
-#endif
-
- if (bufp->allocated == 0)
- {
- if (bufp->buffer)
- { /* If zero allocated, but buffer is non-null, try to realloc
- enough space. This loses if buffer's address is bogus, but
- that is the user's responsibility. */
- RETALLOC (bufp->buffer, INIT_BUF_SIZE, unsigned char);
- }
- else
- { /* Caller did not allocate a buffer. Do it for them. */
- bufp->buffer = TALLOC (INIT_BUF_SIZE, unsigned char);
- }
- if (!bufp->buffer) return REG_ESPACE;
-
- bufp->allocated = INIT_BUF_SIZE;
- }
-
- begalt = b = bufp->buffer;
-
- /* Loop through the uncompiled pattern until we're at the end. */
- while (p != pend)
- {
- PATFETCH (c);
-
- switch (c)
- {
- case '^':
- {
- if ( /* If at start of pattern, it's an operator. */
- p == pattern + 1
- /* If context independent, it's an operator. */
- || syntax & RE_CONTEXT_INDEP_ANCHORS
- /* Otherwise, depends on what's come before. */
- || at_begline_loc_p (pattern, p, syntax))
- BUF_PUSH (begline);
- else
- goto normal_char;
- }
- break;
-
-
- case '$':
- {
- if ( /* If at end of pattern, it's an operator. */
- p == pend
- /* If context independent, it's an operator. */
- || syntax & RE_CONTEXT_INDEP_ANCHORS
- /* Otherwise, depends on what's next. */
- || at_endline_loc_p (p, pend, syntax))
- BUF_PUSH (endline);
- else
- goto normal_char;
- }
- break;
-
-
- case '+':
- case '?':
- if ((syntax & RE_BK_PLUS_QM)
- || (syntax & RE_LIMITED_OPS))
- goto normal_char;
- handle_plus:
- case '*':
- /* If there is no previous pattern... */
- if (!laststart)
- {
- if (syntax & RE_CONTEXT_INVALID_OPS)
- return REG_BADRPT;
- else if (!(syntax & RE_CONTEXT_INDEP_OPS))
- goto normal_char;
- }
-
- {
- /* Are we optimizing this jump? */
- boolean keep_string_p = false;
-
- /* 1 means zero (many) matches is allowed. */
- char zero_times_ok = 0, many_times_ok = 0;
-
- /* If there is a sequence of repetition chars, collapse it
- down to just one (the right one). We can't combine
- interval operators with these because of, e.g., `a{2}*',
- which should only match an even number of `a's. */
-
- for (;;)
- {
- zero_times_ok |= c != '+';
- many_times_ok |= c != '?';
-
- if (p == pend)
- break;
-
- PATFETCH (c);
-
- if (c == '*'
- || (!(syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?')))
- ;
-
- else if (syntax & RE_BK_PLUS_QM && c == '\\')
- {
- if (p == pend) return REG_EESCAPE;
-
- PATFETCH (c1);
- if (!(c1 == '+' || c1 == '?'))
- {
- PATUNFETCH;
- PATUNFETCH;
- break;
- }
-
- c = c1;
- }
- else
- {
- PATUNFETCH;
- break;
- }
-
- /* If we get here, we found another repeat character. */
- }
-
- /* Star, etc. applied to an empty pattern is equivalent
- to an empty pattern. */
- if (!laststart)
- break;
-
- /* Now we know whether or not zero matches is allowed
- and also whether or not two or more matches is allowed. */
- if (many_times_ok)
- { /* More than one repetition is allowed, so put in at the
- end a backward relative jump from `b' to before the next
- jump we're going to put in below (which jumps from
- laststart to after this jump).
-
- But if we are at the `*' in the exact sequence `.*\n',
- insert an unconditional jump backwards to the .,
- instead of the beginning of the loop. This way we only
- push a failure point once, instead of every time
- through the loop. */
- assert (p - 1 > pattern);
-
- /* Allocate the space for the jump. */
- GET_BUFFER_SPACE (3);
-
- /* We know we are not at the first character of the pattern,
- because laststart was nonzero. And we've already
- incremented `p', by the way, to be the character after
- the `*'. Do we have to do something analogous here
- for null bytes, because of RE_DOT_NOT_NULL? */
- if (TRANSLATE (*(p - 2)) == TRANSLATE ('.')
- && p < pend && TRANSLATE (*p) == TRANSLATE ('\n')
- && !(syntax & RE_DOT_NEWLINE))
- { /* We have .*\n. */
- STORE_JUMP (jump, b, laststart);
- keep_string_p = true;
- }
- else
- /* Anything else. */
- STORE_JUMP (maybe_pop_jump, b, laststart - 3);
-
- /* We've added more stuff to the buffer. */
- b += 3;
- }
-
- /* On failure, jump from laststart to b + 3, which will be the
- end of the buffer after this jump is inserted. */
- GET_BUFFER_SPACE (3);
- INSERT_JUMP (keep_string_p ? on_failure_keep_string_jump
- : on_failure_jump,
- laststart, b + 3);
- pending_exact = 0;
- b += 3;
-
- if (!zero_times_ok)
- {
- /* At least one repetition is required, so insert a
- `dummy_failure_jump' before the initial
- `on_failure_jump' instruction of the loop. This
- effects a skip over that instruction the first time
- we hit that loop. */
- GET_BUFFER_SPACE (3);
- INSERT_JUMP (dummy_failure_jump, laststart, laststart + 6);
- b += 3;
- }
- }
- break;
-
-
- case '.':
- laststart = b;
- BUF_PUSH (anychar);
- break;
-
-
- case '[':
- {
- boolean had_char_class = false;
-
- if (p == pend) return REG_EBRACK;
-
- /* Ensure that we have enough space to push a charset: the
- opcode, the length count, and the bitset; 34 bytes in all. */
- GET_BUFFER_SPACE (34);
-
- laststart = b;
-
- /* We test `*p == '^' twice, instead of using an if
- statement, so we only need one BUF_PUSH. */
- BUF_PUSH (*p == '^' ? charset_not : charset);
- if (*p == '^')
- p++;
-
- /* Remember the first position in the bracket expression. */
- p1 = p;
-
- /* Push the number of bytes in the bitmap. */
- BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
-
- /* Clear the whole map. */
- bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH);
-
- /* charset_not matches newline according to a syntax bit. */
- if ((re_opcode_t) b[-2] == charset_not
- && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
- SET_LIST_BIT ('\n');
-
- /* Read in characters and ranges, setting map bits. */
- for (;;)
- {
- if (p == pend) return REG_EBRACK;
-
- PATFETCH (c);
-
- /* \ might escape characters inside [...] and [^...]. */
- if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
- {
- if (p == pend) return REG_EESCAPE;
-
- PATFETCH (c1);
- SET_LIST_BIT (c1);
- continue;
- }
-
- /* Could be the end of the bracket expression. If it's
- not (i.e., when the bracket expression is `[]' so
- far), the ']' character bit gets set way below. */
- if (c == ']' && p != p1 + 1)
- break;
-
- /* Look ahead to see if it's a range when the last thing
- was a character class. */
- if (had_char_class && c == '-' && *p != ']')
- return REG_ERANGE;
-
- /* Look ahead to see if it's a range when the last thing
- was a character: if this is a hyphen not at the
- beginning or the end of a list, then it's the range
- operator. */
- if (c == '-'
- && !(p - 2 >= pattern && p[-2] == '[')
- && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^')
- && *p != ']')
- {
- reg_errcode_t ret
- = compile_range (&p, pend, translate, syntax, b);
- if (ret != REG_NOERROR) return ret;
- }
-
- else if (p[0] == '-' && p[1] != ']')
- { /* This handles ranges made up of characters only. */
- reg_errcode_t ret;
-
- /* Move past the `-'. */
- PATFETCH (c1);
-
- ret = compile_range (&p, pend, translate, syntax, b);
- if (ret != REG_NOERROR) return ret;
- }
-
- /* See if we're at the beginning of a possible character
- class. */
-
- else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
- { /* Leave room for the null. */
- char str[CHAR_CLASS_MAX_LENGTH + 1];
-
- PATFETCH (c);
- c1 = 0;
-
- /* If pattern is `[[:'. */
- if (p == pend) return REG_EBRACK;
-
- for (;;)
- {
- PATFETCH (c);
- if (c == ':' || c == ']' || p == pend
- || c1 == CHAR_CLASS_MAX_LENGTH)
- break;
- str[c1++] = c;
- }
- str[c1] = '\0';
-
- /* If isn't a word bracketed by `[:' and:`]':
- undo the ending character, the letters, and leave
- the leading `:' and `[' (but set bits for them). */
- if (c == ':' && *p == ']')
- {
- int ch;
- boolean is_alnum = STREQ (str, "alnum");
- boolean is_alpha = STREQ (str, "alpha");
- boolean is_blank = STREQ (str, "blank");
- boolean is_cntrl = STREQ (str, "cntrl");
- boolean is_digit = STREQ (str, "digit");
- boolean is_graph = STREQ (str, "graph");
- boolean is_lower = STREQ (str, "lower");
- boolean is_print = STREQ (str, "print");
- boolean is_punct = STREQ (str, "punct");
- boolean is_space = STREQ (str, "space");
- boolean is_upper = STREQ (str, "upper");
- boolean is_xdigit = STREQ (str, "xdigit");
-
- if (!IS_CHAR_CLASS (str)) return REG_ECTYPE;
-
- /* Throw away the ] at the end of the character
- class. */
- PATFETCH (c);
-
- if (p == pend) return REG_EBRACK;
-
- for (ch = 0; ch < 1 << BYTEWIDTH; ch++)
- {
- if ( (is_alnum && ISALNUM (ch))
- || (is_alpha && ISALPHA (ch))
- || (is_blank && ISBLANK (ch))
- || (is_cntrl && ISCNTRL (ch))
- || (is_digit && ISDIGIT (ch))
- || (is_graph && ISGRAPH (ch))
- || (is_lower && ISLOWER (ch))
- || (is_print && ISPRINT (ch))
- || (is_punct && ISPUNCT (ch))
- || (is_space && ISSPACE (ch))
- || (is_upper && ISUPPER (ch))
- || (is_xdigit && ISXDIGIT (ch)))
- SET_LIST_BIT (ch);
- }
- had_char_class = true;
- }
- else
- {
- c1++;
- while (c1--)
- PATUNFETCH;
- SET_LIST_BIT ('[');
- SET_LIST_BIT (':');
- had_char_class = false;
- }
- }
- else
- {
- had_char_class = false;
- SET_LIST_BIT (c);
- }
- }
-
- /* Discard any (non)matching list bytes that are all 0 at the
- end of the map. Decrease the map-length byte too. */
- while ((int) b[-1] > 0 && b[b[-1] - 1] == 0)
- b[-1]--;
- b += b[-1];
- }
- break;
-
-
- case '(':
- if (syntax & RE_NO_BK_PARENS)
- goto handle_open;
- else
- goto normal_char;
-
-
- case ')':
- if (syntax & RE_NO_BK_PARENS)
- goto handle_close;
- else
- goto normal_char;
-
-
- case '\n':
- if (syntax & RE_NEWLINE_ALT)
- goto handle_alt;
- else
- goto normal_char;
-
-
- case '|':
- if (syntax & RE_NO_BK_VBAR)
- goto handle_alt;
- else
- goto normal_char;
-
-
- case '{':
- if (syntax & RE_INTERVALS && syntax & RE_NO_BK_BRACES)
- goto handle_interval;
- else
- goto normal_char;
-
-
- case '\\':
- if (p == pend) return REG_EESCAPE;
-
- /* Do not translate the character after the \, so that we can
- distinguish, e.g., \B from \b, even if we normally would
- translate, e.g., B to b. */
- PATFETCH_RAW (c);
-
- switch (c)
- {
- case '(':
- if (syntax & RE_NO_BK_PARENS)
- goto normal_backslash;
-
- handle_open:
- bufp->re_nsub++;
- regnum++;
-
- if (COMPILE_STACK_FULL)
- {
- RETALLOC (compile_stack.stack, compile_stack.size << 1,
- compile_stack_elt_t);
- if (compile_stack.stack == NULL) return REG_ESPACE;
-
- compile_stack.size <<= 1;
- }
-
- /* These are the values to restore when we hit end of this
- group. They are all relative offsets, so that if the
- whole pattern moves because of realloc, they will still
- be valid. */
- COMPILE_STACK_TOP.begalt_offset = begalt - bufp->buffer;
- COMPILE_STACK_TOP.fixup_alt_jump
- = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0;
- COMPILE_STACK_TOP.laststart_offset = b - bufp->buffer;
- COMPILE_STACK_TOP.regnum = regnum;
-
- /* We will eventually replace the 0 with the number of
- groups inner to this one. But do not push a
- start_memory for groups beyond the last one we can
- represent in the compiled pattern. */
- if (regnum <= MAX_REGNUM)
- {
- COMPILE_STACK_TOP.inner_group_offset = b - bufp->buffer + 2;
- BUF_PUSH_3 (start_memory, regnum, 0);
- }
-
- compile_stack.avail++;
-
- fixup_alt_jump = 0;
- laststart = 0;
- begalt = b;
- break;
-
-
- case ')':
- if (syntax & RE_NO_BK_PARENS) goto normal_backslash;
-
- if (COMPILE_STACK_EMPTY)
- if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
- goto normal_backslash;
- else
- return REG_ERPAREN;
-
- handle_close:
- if (fixup_alt_jump)
- { /* Push a dummy failure point at the end of the
- alternative for a possible future
- `pop_failure_jump' to pop. See comments at
- `push_dummy_failure' in `re_match_2'. */
- BUF_PUSH (push_dummy_failure);
-
- /* We allocated space for this jump when we assigned
- to `fixup_alt_jump', in the `handle_alt' case below. */
- STORE_JUMP (jump_past_alt, fixup_alt_jump, b - 1);
- }
-
- /* See similar code for backslashed left paren above. */
- if (COMPILE_STACK_EMPTY)
- if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
- goto normal_char;
- else
- return REG_ERPAREN;
-
- /* Since we just checked for an empty stack above, this
- ``can't happen''. */
- assert (compile_stack.avail != 0);
- {
- /* We don't just want to restore into `regnum', because
- later groups should continue to be numbered higher,
- as in `(ab)c(de)' -- the second group is #2. */
- regnum_t this_group_regnum;
-
- compile_stack.avail--;
- begalt = bufp->buffer + COMPILE_STACK_TOP.begalt_offset;
- fixup_alt_jump
- = COMPILE_STACK_TOP.fixup_alt_jump
- ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1
- : 0;
- laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset;
- this_group_regnum = COMPILE_STACK_TOP.regnum;
-
- /* We're at the end of the group, so now we know how many
- groups were inside this one. */
- if (this_group_regnum <= MAX_REGNUM)
- {
- unsigned char *inner_group_loc
- = bufp->buffer + COMPILE_STACK_TOP.inner_group_offset;
-
- *inner_group_loc = regnum - this_group_regnum;
- BUF_PUSH_3 (stop_memory, this_group_regnum,
- regnum - this_group_regnum);
- }
- }
- break;
-
-
- case '|': /* `\|'. */
- if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR)
- goto normal_backslash;
- handle_alt:
- if (syntax & RE_LIMITED_OPS)
- goto normal_char;
-
- /* Insert before the previous alternative a jump which
- jumps to this alternative if the former fails. */
- GET_BUFFER_SPACE (3);
- INSERT_JUMP (on_failure_jump, begalt, b + 6);
- pending_exact = 0;
- b += 3;
-
- /* The alternative before this one has a jump after it
- which gets executed if it gets matched. Adjust that
- jump so it will jump to this alternative's analogous
- jump (put in below, which in turn will jump to the next
- (if any) alternative's such jump, etc.). The last such
- jump jumps to the correct final destination. A picture:
- _____ _____
- | | | |
- | v | v
- a | b | c
-
- If we are at `b', then fixup_alt_jump right now points to a
- three-byte space after `a'. We'll put in the jump, set
- fixup_alt_jump to right after `b', and leave behind three
- bytes which we'll fill in when we get to after `c'. */
-
- if (fixup_alt_jump)
- STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
-
- /* Mark and leave space for a jump after this alternative,
- to be filled in later either by next alternative or
- when know we're at the end of a series of alternatives. */
- fixup_alt_jump = b;
- GET_BUFFER_SPACE (3);
- b += 3;
-
- laststart = 0;
- begalt = b;
- break;
-
-
- case '{':
- /* If \{ is a literal. */
- if (!(syntax & RE_INTERVALS)
- /* If we're at `\{' and it's not the open-interval
- operator. */
- || ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES))
- || (p - 2 == pattern && p == pend))
- goto normal_backslash;
-
- handle_interval:
- {
- /* If got here, then the syntax allows intervals. */
-
- /* At least (most) this many matches must be made. */
- int lower_bound = -1, upper_bound = -1;
-
- beg_interval = p - 1;
-
- if (p == pend)
- {
- if (syntax & RE_NO_BK_BRACES)
- goto unfetch_interval;
- else
- return REG_EBRACE;
- }
-
- GET_UNSIGNED_NUMBER (lower_bound);
-
- if (c == ',')
- {
- GET_UNSIGNED_NUMBER (upper_bound);
- if (upper_bound < 0) upper_bound = RE_DUP_MAX;
- }
- else
- /* Interval such as `{1}' => match exactly once. */
- upper_bound = lower_bound;
-
- if (lower_bound < 0 || upper_bound > RE_DUP_MAX
- || lower_bound > upper_bound)
- {
- if (syntax & RE_NO_BK_BRACES)
- goto unfetch_interval;
- else
- return REG_BADBR;
- }
-
- if (!(syntax & RE_NO_BK_BRACES))
- {
- if (c != '\\') return REG_EBRACE;
-
- PATFETCH (c);
- }
-
- if (c != '}')
- {
- if (syntax & RE_NO_BK_BRACES)
- goto unfetch_interval;
- else
- return REG_BADBR;
- }
-
- /* We just parsed a valid interval. */
-
- /* If it's invalid to have no preceding re. */
- if (!laststart)
- {
- if (syntax & RE_CONTEXT_INVALID_OPS)
- return REG_BADRPT;
- else if (syntax & RE_CONTEXT_INDEP_OPS)
- laststart = b;
- else
- goto unfetch_interval;
- }
-
- /* If the upper bound is zero, don't want to succeed at
- all; jump from `laststart' to `b + 3', which will be
- the end of the buffer after we insert the jump. */
- if (upper_bound == 0)
- {
- GET_BUFFER_SPACE (3);
- INSERT_JUMP (jump, laststart, b + 3);
- b += 3;
- }
-
- /* Otherwise, we have a nontrivial interval. When
- we're all done, the pattern will look like:
- set_number_at <jump count> <upper bound>
- set_number_at <succeed_n count> <lower bound>
- succeed_n <after jump addr> <succed_n count>
- <body of loop>
- jump_n <succeed_n addr> <jump count>
- (The upper bound and `jump_n' are omitted if
- `upper_bound' is 1, though.) */
- else
- { /* If the upper bound is > 1, we need to insert
- more at the end of the loop. */
- unsigned nbytes = 10 + (upper_bound > 1) * 10;
-
- GET_BUFFER_SPACE (nbytes);
-
- /* Initialize lower bound of the `succeed_n', even
- though it will be set during matching by its
- attendant `set_number_at' (inserted next),
- because `re_compile_fastmap' needs to know.
- Jump to the `jump_n' we might insert below. */
- INSERT_JUMP2 (succeed_n, laststart,
- b + 5 + (upper_bound > 1) * 5,
- lower_bound);
- b += 5;
-
- /* Code to initialize the lower bound. Insert
- before the `succeed_n'. The `5' is the last two
- bytes of this `set_number_at', plus 3 bytes of
- the following `succeed_n'. */
- insert_op2 (set_number_at, laststart, 5, lower_bound, b);
- b += 5;
-
- if (upper_bound > 1)
- { /* More than one repetition is allowed, so
- append a backward jump to the `succeed_n'
- that starts this interval.
-
- When we've reached this during matching,
- we'll have matched the interval once, so
- jump back only `upper_bound - 1' times. */
- STORE_JUMP2 (jump_n, b, laststart + 5,
- upper_bound - 1);
- b += 5;
-
- /* The location we want to set is the second
- parameter of the `jump_n'; that is `b-2' as
- an absolute address. `laststart' will be
- the `set_number_at' we're about to insert;
- `laststart+3' the number to set, the source
- for the relative address. But we are
- inserting into the middle of the pattern --
- so everything is getting moved up by 5.
- Conclusion: (b - 2) - (laststart + 3) + 5,
- i.e., b - laststart.
-
- We insert this at the beginning of the loop
- so that if we fail during matching, we'll
- reinitialize the bounds. */
- insert_op2 (set_number_at, laststart, b - laststart,
- upper_bound - 1, b);
- b += 5;
- }
- }
- pending_exact = 0;
- beg_interval = NULL;
- }
- break;
-
- unfetch_interval:
- /* If an invalid interval, match the characters as literals. */
- assert (beg_interval);
- p = beg_interval;
- beg_interval = NULL;
-
- /* normal_char and normal_backslash need `c'. */
- PATFETCH (c);
-
- if (!(syntax & RE_NO_BK_BRACES))
- {
- if (p > pattern && p[-1] == '\\')
- goto normal_backslash;
- }
- goto normal_char;
-
-#ifdef emacs
- /* There is no way to specify the before_dot and after_dot
- operators. rms says this is ok. --karl */
- case '=':
- BUF_PUSH (at_dot);
- break;
-
- case 's':
- laststart = b;
- PATFETCH (c);
- BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]);
- break;
-
- case 'S':
- laststart = b;
- PATFETCH (c);
- BUF_PUSH_2 (notsyntaxspec, syntax_spec_code[c]);
- break;
-#endif /* emacs */
-
-
- case 'w':
- laststart = b;
- BUF_PUSH (wordchar);
- break;
-
-
- case 'W':
- laststart = b;
- BUF_PUSH (notwordchar);
- break;
-
-
- case '<':
- BUF_PUSH (wordbeg);
- break;
-
- case '>':
- BUF_PUSH (wordend);
- break;
-
- case 'b':
- BUF_PUSH (wordbound);
- break;
-
- case 'B':
- BUF_PUSH (notwordbound);
- break;
-
- case '`':
- BUF_PUSH (begbuf);
- break;
-
- case '\'':
- BUF_PUSH (endbuf);
- break;
-
- case '1': case '2': case '3': case '4': case '5':
- case '6': case '7': case '8': case '9':
- if (syntax & RE_NO_BK_REFS)
- goto normal_char;
-
- c1 = c - '0';
-
- if (c1 > regnum)
- return REG_ESUBREG;
-
- /* Can't back reference to a subexpression if inside of it. */
- if (group_in_compile_stack (compile_stack, c1))
- goto normal_char;
-
- laststart = b;
- BUF_PUSH_2 (duplicate, c1);
- break;
-
-
- case '+':
- case '?':
- if (syntax & RE_BK_PLUS_QM)
- goto handle_plus;
- else
- goto normal_backslash;
-
- default:
- normal_backslash:
- /* You might think it would be useful for \ to mean
- not to translate; but if we don't translate it
- it will never match anything. */
- c = TRANSLATE (c);
- goto normal_char;
- }
- break;
-
-
- default:
- /* Expects the character in `c'. */
- normal_char:
- /* If no exactn currently being built. */
- if (!pending_exact
-
- /* If last exactn not at current position. */
- || pending_exact + *pending_exact + 1 != b
-
- /* We have only one byte following the exactn for the count. */
- || *pending_exact == (1 << BYTEWIDTH) - 1
-
- /* If followed by a repetition operator. */
- || *p == '*' || *p == '^'
- || ((syntax & RE_BK_PLUS_QM)
- ? *p == '\\' && (p[1] == '+' || p[1] == '?')
- : (*p == '+' || *p == '?'))
- || ((syntax & RE_INTERVALS)
- && ((syntax & RE_NO_BK_BRACES)
- ? *p == '{'
- : (p[0] == '\\' && p[1] == '{'))))
- {
- /* Start building a new exactn. */
-
- laststart = b;
-
- BUF_PUSH_2 (exactn, 0);
- pending_exact = b - 1;
- }
-
- BUF_PUSH (c);
- (*pending_exact)++;
- break;
- } /* switch (c) */
- } /* while p != pend */
-
-
- /* Through the pattern now. */
-
- if (fixup_alt_jump)
- STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
-
- if (!COMPILE_STACK_EMPTY)
- return REG_EPAREN;
-
- free (compile_stack.stack);
-
- /* We have succeeded; set the length of the buffer. */
- bufp->used = b - bufp->buffer;
-
-#ifdef DEBUG
- if (debug)
- {
- DEBUG_PRINT1 ("\nCompiled pattern: ");
- print_compiled_pattern (bufp);
- }
-#endif /* DEBUG */
-
- return REG_NOERROR;
-} /* regex_compile */
-
-/* Subroutines for `regex_compile'. */
-
-/* Store OP at LOC followed by two-byte integer parameter ARG. */
-
-static void
-store_op1 (op, loc, arg)
- re_opcode_t op;
- unsigned char *loc;
- int arg;
-{
- *loc = (unsigned char) op;
- STORE_NUMBER (loc + 1, arg);
-}
-
-
-/* Like `store_op1', but for two two-byte parameters ARG1 and ARG2. */
-
-static void
-store_op2 (op, loc, arg1, arg2)
- re_opcode_t op;
- unsigned char *loc;
- int arg1, arg2;
-{
- *loc = (unsigned char) op;
- STORE_NUMBER (loc + 1, arg1);
- STORE_NUMBER (loc + 3, arg2);
-}
-
-
-/* Copy the bytes from LOC to END to open up three bytes of space at LOC
- for OP followed by two-byte integer parameter ARG. */
-
-static void
-insert_op1 (op, loc, arg, end)
- re_opcode_t op;
- unsigned char *loc;
- int arg;
- unsigned char *end;
-{
- register unsigned char *pfrom = end;
- register unsigned char *pto = end + 3;
-
- while (pfrom != loc)
- *--pto = *--pfrom;
-
- store_op1 (op, loc, arg);
-}
-
-
-/* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2. */
-
-static void
-insert_op2 (op, loc, arg1, arg2, end)
- re_opcode_t op;
- unsigned char *loc;
- int arg1, arg2;
- unsigned char *end;
-{
- register unsigned char *pfrom = end;
- register unsigned char *pto = end + 5;
-
- while (pfrom != loc)
- *--pto = *--pfrom;
-
- store_op2 (op, loc, arg1, arg2);
-}
-
-
-/* P points to just after a ^ in PATTERN. Return true if that ^ comes
- after an alternative or a begin-subexpression. We assume there is at
- least one character before the ^. */
-
-static boolean
-at_begline_loc_p (pattern, p, syntax)
- const char *pattern, *p;
- reg_syntax_t syntax;
-{
- const char *prev = p - 2;
- boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\';
-
- return
- /* After a subexpression? */
- (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash))
- /* After an alternative? */
- || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash));
-}
-
-
-/* The dual of at_begline_loc_p. This one is for $. We assume there is
- at least one character after the $, i.e., `P < PEND'. */
-
-static boolean
-at_endline_loc_p (p, pend, syntax)
- const char *p, *pend;
- int syntax;
-{
- const char *next = p;
- boolean next_backslash = *next == '\\';
- const char *next_next = p + 1 < pend ? p + 1 : NULL;
-
- return
- /* Before a subexpression? */
- (syntax & RE_NO_BK_PARENS ? *next == ')'
- : next_backslash && next_next && *next_next == ')')
- /* Before an alternative? */
- || (syntax & RE_NO_BK_VBAR ? *next == '|'
- : next_backslash && next_next && *next_next == '|');
-}
-
-
-/* Returns true if REGNUM is in one of COMPILE_STACK's elements and
- false if it's not. */
-
-static boolean
-group_in_compile_stack (compile_stack, regnum)
- compile_stack_type compile_stack;
- regnum_t regnum;
-{
- int this_element;
-
- for (this_element = compile_stack.avail - 1;
- this_element >= 0;
- this_element--)
- if (compile_stack.stack[this_element].regnum == regnum)
- return true;
-
- return false;
-}
-
-
-/* Read the ending character of a range (in a bracket expression) from the
- uncompiled pattern *P_PTR (which ends at PEND). We assume the
- starting character is in `P[-2]'. (`P[-1]' is the character `-'.)
- Then we set the translation of all bits between the starting and
- ending characters (inclusive) in the compiled pattern B.
-
- Return an error code.
-
- We use these short variable names so we can use the same macros as
- `regex_compile' itself. */
-
-static reg_errcode_t
-compile_range (p_ptr, pend, translate, syntax, b)
- const char **p_ptr, *pend;
- char *translate;
- reg_syntax_t syntax;
- unsigned char *b;
-{
- unsigned this_char;
-
- const char *p = *p_ptr;
- int range_start, range_end;
-
- if (p == pend)
- return REG_ERANGE;
-
- /* Even though the pattern is a signed `char *', we need to fetch
- with unsigned char *'s; if the high bit of the pattern character
- is set, the range endpoints will be negative if we fetch using a
- signed char *.
-
- We also want to fetch the endpoints without translating them; the
- appropriate translation is done in the bit-setting loop below. */
- range_start = ((unsigned char *) p)[-2];
- range_end = ((unsigned char *) p)[0];
-
- /* Have to increment the pointer into the pattern string, so the
- caller isn't still at the ending character. */
- (*p_ptr)++;
-
- /* If the start is after the end, the range is empty. */
- if (range_start > range_end)
- return syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR;
-
- /* Here we see why `this_char' has to be larger than an `unsigned
- char' -- the range is inclusive, so if `range_end' == 0xff
- (assuming 8-bit characters), we would otherwise go into an infinite
- loop, since all characters <= 0xff. */
- for (this_char = range_start; this_char <= range_end; this_char++)
- {
- SET_LIST_BIT (TRANSLATE (this_char));
- }
-
- return REG_NOERROR;
-}
-
-/* Failure stack declarations and macros; both re_compile_fastmap and
- re_match_2 use a failure stack. These have to be macros because of
- REGEX_ALLOCATE. */
-
-
-/* Number of failure points for which to initially allocate space
- when matching. If this number is exceeded, we allocate more
- space, so it is not a hard limit. */
-#ifndef INIT_FAILURE_ALLOC
-#define INIT_FAILURE_ALLOC 5
-#endif
-
-/* Roughly the maximum number of failure points on the stack. Would be
- exactly that if always used MAX_FAILURE_SPACE each time we failed.
- This is a variable only so users of regex can assign to it; we never
- change it ourselves. */
-int re_max_failures = 2000;
-
-typedef const unsigned char *fail_stack_elt_t;
-
-typedef struct
-{
- fail_stack_elt_t *stack;
- unsigned size;
- unsigned avail; /* Offset of next open position. */
-} fail_stack_type;
-
-#define FAIL_STACK_EMPTY() (fail_stack.avail == 0)
-#define FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0)
-#define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size)
-#define FAIL_STACK_TOP() (fail_stack.stack[fail_stack.avail])
-
-
-/* Initialize `fail_stack'. Do `return -2' if the alloc fails. */
-
-#define INIT_FAIL_STACK() \
- do { \
- fail_stack.stack = (fail_stack_elt_t *) \
- REGEX_ALLOCATE (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t)); \
- \
- if (fail_stack.stack == NULL) \
- return -2; \
- \
- fail_stack.size = INIT_FAILURE_ALLOC; \
- fail_stack.avail = 0; \
- } while (0)
-
-
-/* Double the size of FAIL_STACK, up to approximately `re_max_failures' items.
-
- Return 1 if succeeds, and 0 if either ran out of memory
- allocating space for it or it was already too large.
-
- REGEX_REALLOCATE requires `destination' be declared. */
-
-#define DOUBLE_FAIL_STACK(fail_stack) \
- ((fail_stack).size > re_max_failures * MAX_FAILURE_ITEMS \
- ? 0 \
- : ((fail_stack).stack = (fail_stack_elt_t *) \
- REGEX_REALLOCATE ((fail_stack).stack, \
- (fail_stack).size * sizeof (fail_stack_elt_t), \
- ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)), \
- \
- (fail_stack).stack == NULL \
- ? 0 \
- : ((fail_stack).size <<= 1, \
- 1)))
-
-
-/* Push PATTERN_OP on FAIL_STACK.
-
- Return 1 if was able to do so and 0 if ran out of memory allocating
- space to do so. */
-#define PUSH_PATTERN_OP(pattern_op, fail_stack) \
- ((FAIL_STACK_FULL () \
- && !DOUBLE_FAIL_STACK (fail_stack)) \
- ? 0 \
- : ((fail_stack).stack[(fail_stack).avail++] = pattern_op, \
- 1))
-
-/* This pushes an item onto the failure stack. Must be a four-byte
- value. Assumes the variable `fail_stack'. Probably should only
- be called from within `PUSH_FAILURE_POINT'. */
-#define PUSH_FAILURE_ITEM(item) \
- fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item
-
-/* The complement operation. Assumes `fail_stack' is nonempty. */
-#define POP_FAILURE_ITEM() fail_stack.stack[--fail_stack.avail]
-
-/* Used to omit pushing failure point id's when we're not debugging. */
-#ifdef DEBUG
-#define DEBUG_PUSH PUSH_FAILURE_ITEM
-#define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_ITEM ()
-#else
-#define DEBUG_PUSH(item)
-#define DEBUG_POP(item_addr)
-#endif
-
-
-/* Push the information about the state we will need
- if we ever fail back to it.
-
- Requires variables fail_stack, regstart, regend, reg_info, and
- num_regs be declared. DOUBLE_FAIL_STACK requires `destination' be
- declared.
-
- Does `return FAILURE_CODE' if runs out of memory. */
-
-#define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \
- do { \
- char *destination; \
- /* Must be int, so when we don't save any registers, the arithmetic \
- of 0 + -1 isn't done as unsigned. */ \
- int this_reg; \
- \
- DEBUG_STATEMENT (failure_id++); \
- DEBUG_STATEMENT (nfailure_points_pushed++); \
- DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \
- DEBUG_PRINT2 (" Before push, next avail: %d\n", (fail_stack).avail);\
- DEBUG_PRINT2 (" size: %d\n", (fail_stack).size);\
- \
- DEBUG_PRINT2 (" slots needed: %d\n", NUM_FAILURE_ITEMS); \
- DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \
- \
- /* Ensure we have enough space allocated for what we will push. */ \
- while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \
- { \
- if (!DOUBLE_FAIL_STACK (fail_stack)) \
- return failure_code; \
- \
- DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \
- (fail_stack).size); \
- DEBUG_PRINT2 (" slots available: %d\n", REMAINING_AVAIL_SLOTS);\
- } \
- \
- /* Push the info, starting with the registers. */ \
- DEBUG_PRINT1 ("\n"); \
- \
- for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \
- this_reg++) \
- { \
- DEBUG_PRINT2 (" Pushing reg: %d\n", this_reg); \
- DEBUG_STATEMENT (num_regs_pushed++); \
- \
- DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \
- PUSH_FAILURE_ITEM (regstart[this_reg]); \
- \
- DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \
- PUSH_FAILURE_ITEM (regend[this_reg]); \
- \
- DEBUG_PRINT2 (" info: 0x%x\n ", reg_info[this_reg]); \
- DEBUG_PRINT2 (" match_null=%d", \
- REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \
- DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \
- DEBUG_PRINT2 (" matched_something=%d", \
- MATCHED_SOMETHING (reg_info[this_reg])); \
- DEBUG_PRINT2 (" ever_matched=%d", \
- EVER_MATCHED_SOMETHING (reg_info[this_reg])); \
- DEBUG_PRINT1 ("\n"); \
- PUSH_FAILURE_ITEM (reg_info[this_reg].word); \
- } \
- \
- DEBUG_PRINT2 (" Pushing low active reg: %d\n", lowest_active_reg);\
- PUSH_FAILURE_ITEM (lowest_active_reg); \
- \
- DEBUG_PRINT2 (" Pushing high active reg: %d\n", highest_active_reg);\
- PUSH_FAILURE_ITEM (highest_active_reg); \
- \
- DEBUG_PRINT2 (" Pushing pattern 0x%x: ", pattern_place); \
- DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \
- PUSH_FAILURE_ITEM (pattern_place); \
- \
- DEBUG_PRINT2 (" Pushing string 0x%x: `", string_place); \
- DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \
- size2); \
- DEBUG_PRINT1 ("'\n"); \
- PUSH_FAILURE_ITEM (string_place); \
- \
- DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \
- DEBUG_PUSH (failure_id); \
- } while (0)
-
-/* This is the number of items that are pushed and popped on the stack
- for each register. */
-#define NUM_REG_ITEMS 3
-
-/* Individual items aside from the registers. */
-#ifdef DEBUG
-#define NUM_NONREG_ITEMS 5 /* Includes failure point id. */
-#else
-#define NUM_NONREG_ITEMS 4
-#endif
-
-/* We push at most this many items on the stack. */
-#define MAX_FAILURE_ITEMS ((num_regs - 1) * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
-
-/* We actually push this many items. */
-#define NUM_FAILURE_ITEMS \
- ((highest_active_reg - lowest_active_reg + 1) * NUM_REG_ITEMS \
- + NUM_NONREG_ITEMS)
-
-/* How many items can still be added to the stack without overflowing it. */
-#define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail)
-
-
-/* Pops what PUSH_FAIL_STACK pushes.
-
- We restore into the parameters, all of which should be lvalues:
- STR -- the saved data position.
- PAT -- the saved pattern position.
- LOW_REG, HIGH_REG -- the highest and lowest active registers.
- REGSTART, REGEND -- arrays of string positions.
- REG_INFO -- array of information about each subexpression.
-
- Also assumes the variables `fail_stack' and (if debugging), `bufp',
- `pend', `string1', `size1', `string2', and `size2'. */
-
-#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\
-{ \
- DEBUG_STATEMENT (fail_stack_elt_t failure_id;) \
- int this_reg; \
- const unsigned char *string_temp; \
- \
- assert (!FAIL_STACK_EMPTY ()); \
- \
- /* Remove failure points and point to how many regs pushed. */ \
- DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \
- DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \
- DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \
- \
- assert (fail_stack.avail >= NUM_NONREG_ITEMS); \
- \
- DEBUG_POP (&failure_id); \
- DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \
- \
- /* If the saved string location is NULL, it came from an \
- on_failure_keep_string_jump opcode, and we want to throw away the \
- saved NULL, thus retaining our current position in the string. */ \
- string_temp = POP_FAILURE_ITEM (); \
- if (string_temp != NULL) \
- str = (const char *) string_temp; \
- \
- DEBUG_PRINT2 (" Popping string 0x%x: `", str); \
- DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \
- DEBUG_PRINT1 ("'\n"); \
- \
- pat = (unsigned char *) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" Popping pattern 0x%x: ", pat); \
- DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \
- \
- /* Restore register info. */ \
- high_reg = (unsigned) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" Popping high active reg: %d\n", high_reg); \
- \
- low_reg = (unsigned) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \
- \
- for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \
- { \
- DEBUG_PRINT2 (" Popping reg: %d\n", this_reg); \
- \
- reg_info[this_reg].word = POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" info: 0x%x\n", reg_info[this_reg]); \
- \
- regend[this_reg] = (const char *) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \
- \
- regstart[this_reg] = (const char *) POP_FAILURE_ITEM (); \
- DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \
- } \
- \
- DEBUG_STATEMENT (nfailure_points_popped++); \
-} /* POP_FAILURE_POINT */
-
-/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in
- BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible
- characters can start a string that matches the pattern. This fastmap
- is used by re_search to skip quickly over impossible starting points.
-
- The caller must supply the address of a (1 << BYTEWIDTH)-byte data
- area as BUFP->fastmap.
-
- We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in
- the pattern buffer.
-
- Returns 0 if we succeed, -2 if an internal error. */
-
-int
-re_compile_fastmap (bufp)
- struct re_pattern_buffer *bufp;
-{
- int j, k;
- fail_stack_type fail_stack;
-#ifndef REGEX_MALLOC
- char *destination;
-#endif
- /* We don't push any register information onto the failure stack. */
- unsigned num_regs = 0;
-
- register char *fastmap = bufp->fastmap;
- unsigned char *pattern = bufp->buffer;
- unsigned long size = bufp->used;
- const unsigned char *p = pattern;
- register unsigned char *pend = pattern + size;
-
- /* Assume that each path through the pattern can be null until
- proven otherwise. We set this false at the bottom of switch
- statement, to which we get only if a particular path doesn't
- match the empty string. */
- boolean path_can_be_null = true;
-
- /* We aren't doing a `succeed_n' to begin with. */
- boolean succeed_n_p = false;
-
- assert (fastmap != NULL && p != NULL);
-
- INIT_FAIL_STACK ();
- bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */
- bufp->fastmap_accurate = 1; /* It will be when we're done. */
- bufp->can_be_null = 0;
-
- while (p != pend || !FAIL_STACK_EMPTY ())
- {
- if (p == pend)
- {
- bufp->can_be_null |= path_can_be_null;
-
- /* Reset for next path. */
- path_can_be_null = true;
-
- p = fail_stack.stack[--fail_stack.avail];
- }
-
- /* We should never be about to go beyond the end of the pattern. */
- assert (p < pend);
-
-#ifdef SWITCH_ENUM_BUG
- switch ((int) ((re_opcode_t) *p++))
-#else
- switch ((re_opcode_t) *p++)
-#endif
- {
-
- /* I guess the idea here is to simply not bother with a fastmap
- if a backreference is used, since it's too hard to figure out
- the fastmap for the corresponding group. Setting
- `can_be_null' stops `re_search_2' from using the fastmap, so
- that is all we do. */
- case duplicate:
- bufp->can_be_null = 1;
- return 0;
-
-
- /* Following are the cases which match a character. These end
- with `break'. */
-
- case exactn:
- fastmap[p[1]] = 1;
- break;
-
-
- case charset:
- for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
- fastmap[j] = 1;
- break;
-
-
- case charset_not:
- /* Chars beyond end of map must be allowed. */
- for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
- fastmap[j] = 1;
-
- for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
- if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
- fastmap[j] = 1;
- break;
-
-
- case wordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == Sword)
- fastmap[j] = 1;
- break;
-
-
- case notwordchar:
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != Sword)
- fastmap[j] = 1;
- break;
-
-
- case anychar:
- /* `.' matches anything ... */
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- fastmap[j] = 1;
-
- /* ... except perhaps newline. */
- if (!(bufp->syntax & RE_DOT_NEWLINE))
- fastmap['\n'] = 0;
-
- /* Return if we have already set `can_be_null'; if we have,
- then the fastmap is irrelevant. Something's wrong here. */
- else if (bufp->can_be_null)
- return 0;
-
- /* Otherwise, have to check alternative paths. */
- break;
-
-
-#ifdef emacs
- case syntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) == (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
-
-
- case notsyntaxspec:
- k = *p++;
- for (j = 0; j < (1 << BYTEWIDTH); j++)
- if (SYNTAX (j) != (enum syntaxcode) k)
- fastmap[j] = 1;
- break;
-
-
- /* All cases after this match the empty string. These end with
- `continue'. */
-
-
- case before_dot:
- case at_dot:
- case after_dot:
- continue;
-#endif /* not emacs */
-
-
- case no_op:
- case begline:
- case endline:
- case begbuf:
- case endbuf:
- case wordbound:
- case notwordbound:
- case wordbeg:
- case wordend:
- case push_dummy_failure:
- continue;
-
-
- case jump_n:
- case pop_failure_jump:
- case maybe_pop_jump:
- case jump:
- case jump_past_alt:
- case dummy_failure_jump:
- EXTRACT_NUMBER_AND_INCR (j, p);
- p += j;
- if (j > 0)
- continue;
-
- /* Jump backward implies we just went through the body of a
- loop and matched nothing. Opcode jumped to should be
- `on_failure_jump' or `succeed_n'. Just treat it like an
- ordinary jump. For a * loop, it has pushed its failure
- point already; if so, discard that as redundant. */
- if ((re_opcode_t) *p != on_failure_jump
- && (re_opcode_t) *p != succeed_n)
- continue;
-
- p++;
- EXTRACT_NUMBER_AND_INCR (j, p);
- p += j;
-
- /* If what's on the stack is where we are now, pop it. */
- if (!FAIL_STACK_EMPTY ()
- && fail_stack.stack[fail_stack.avail - 1] == p)
- fail_stack.avail--;
-
- continue;
-
-
- case on_failure_jump:
- case on_failure_keep_string_jump:
- handle_on_failure_jump:
- EXTRACT_NUMBER_AND_INCR (j, p);
-
- /* For some patterns, e.g., `(a?)?', `p+j' here points to the
- end of the pattern. We don't want to push such a point,
- since when we restore it above, entering the switch will
- increment `p' past the end of the pattern. We don't need
- to push such a point since we obviously won't find any more
- fastmap entries beyond `pend'. Such a pattern can match
- the null string, though. */
- if (p + j < pend)
- {
- if (!PUSH_PATTERN_OP (p + j, fail_stack))
- return -2;
- }
- else
- bufp->can_be_null = 1;
-
- if (succeed_n_p)
- {
- EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */
- succeed_n_p = false;
- }
-
- continue;
-
-
- case succeed_n:
- /* Get to the number of times to succeed. */
- p += 2;
-
- /* Increment p past the n for when k != 0. */
- EXTRACT_NUMBER_AND_INCR (k, p);
- if (k == 0)
- {
- p -= 4;
- succeed_n_p = true; /* Spaghetti code alert. */
- goto handle_on_failure_jump;
- }
- continue;
-
-
- case set_number_at:
- p += 4;
- continue;
-
-
- case start_memory:
- case stop_memory:
- p += 2;
- continue;
-
-
- default:
- abort (); /* We have listed all the cases. */
- } /* switch *p++ */
-
- /* Getting here means we have found the possible starting
- characters for one path of the pattern -- and that the empty
- string does not match. We need not follow this path further.
- Instead, look at the next alternative (remembered on the
- stack), or quit if no more. The test at the top of the loop
- does these things. */
- path_can_be_null = false;
- p = pend;
- } /* while p */
-
- /* Set `can_be_null' for the last path (also the first path, if the
- pattern is empty). */
- bufp->can_be_null |= path_can_be_null;
- return 0;
-} /* re_compile_fastmap */
-
-/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
- ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use
- this memory for recording register information. STARTS and ENDS
- must be allocated using the malloc library routine, and must each
- be at least NUM_REGS * sizeof (regoff_t) bytes long.
-
- If NUM_REGS == 0, then subsequent matches should allocate their own
- register data.
-
- Unless this function is called, the first search or match using
- PATTERN_BUFFER will allocate its own register data, without
- freeing the old data. */
-
-void
-re_set_registers (bufp, regs, num_regs, starts, ends)
- struct re_pattern_buffer *bufp;
- struct re_registers *regs;
- unsigned num_regs;
- regoff_t *starts, *ends;
-{
- if (num_regs)
- {
- bufp->regs_allocated = REGS_REALLOCATE;
- regs->num_regs = num_regs;
- regs->start = starts;
- regs->end = ends;
- }
- else
- {
- bufp->regs_allocated = REGS_UNALLOCATED;
- regs->num_regs = 0;
- regs->start = regs->end = (regoff_t) 0;
- }
-}
-
-/* Searching routines. */
-
-/* Like re_search_2, below, but only one string is specified, and
- doesn't let you say where to stop matching. */
-
-int
-re_search (bufp, string, size, startpos, range, regs)
- struct re_pattern_buffer *bufp;
- const char *string;
- int size, startpos, range;
- struct re_registers *regs;
-{
- return re_search_2 (bufp, NULL, 0, string, size, startpos, range,
- regs, size);
-}
-
-
-/* Using the compiled pattern in BUFP->buffer, first tries to match the
- virtual concatenation of STRING1 and STRING2, starting first at index
- STARTPOS, then at STARTPOS + 1, and so on.
-
- STRING1 and STRING2 have length SIZE1 and SIZE2, respectively.
-
- RANGE is how far to scan while trying to match. RANGE = 0 means try
- only at STARTPOS; in general, the last start tried is STARTPOS +
- RANGE.
-
- In REGS, return the indices of the virtual concatenation of STRING1
- and STRING2 that matched the entire BUFP->buffer and its contained
- subexpressions.
-
- Do not consider matching one past the index STOP in the virtual
- concatenation of STRING1 and STRING2.
-
- We return either the position in the strings at which the match was
- found, -1 if no match, or -2 if error (such as failure
- stack overflow). */
-
-int
-re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
- struct re_pattern_buffer *bufp;
- const char *string1, *string2;
- int size1, size2;
- int startpos;
- int range;
- struct re_registers *regs;
- int stop;
-{
- int val;
- register char *fastmap = bufp->fastmap;
- register char *translate = bufp->translate;
- int total_size = size1 + size2;
- int endpos = startpos + range;
-
- /* Check for out-of-range STARTPOS. */
- if (startpos < 0 || startpos > total_size)
- return -1;
-
- /* Fix up RANGE if it might eventually take us outside
- the virtual concatenation of STRING1 and STRING2. */
- if (endpos < -1)
- range = -1 - startpos;
- else if (endpos > total_size)
- range = total_size - startpos;
-
- /* If the search isn't to be a backwards one, don't waste time in a
- search for a pattern that must be anchored. */
- if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == begbuf && range > 0)
- {
- if (startpos > 0)
- return -1;
- else
- range = 1;
- }
-
- /* Update the fastmap now if not correct already. */
- if (fastmap && !bufp->fastmap_accurate)
- if (re_compile_fastmap (bufp) == -2)
- return -2;
-
- /* Loop through the string, looking for a place to start matching. */
- for (;;)
- {
- /* If a fastmap is supplied, skip quickly over characters that
- cannot be the start of a match. If the pattern can match the
- null string, however, we don't need to skip characters; we want
- the first null string. */
- if (fastmap && startpos < total_size && !bufp->can_be_null)
- {
- if (range > 0) /* Searching forwards. */
- {
- register const char *d;
- register int lim = 0;
- int irange = range;
-
- if (startpos < size1 && startpos + range >= size1)
- lim = range - (size1 - startpos);
-
- d = (startpos >= size1 ? string2 - size1 : string1) + startpos;
-
- /* Written out as an if-else to avoid testing `translate'
- inside the loop. */
- if (translate)
- while (range > lim
- && !fastmap[(unsigned char)
- translate[(unsigned char) *d++]])
- range--;
- else
- while (range > lim && !fastmap[(unsigned char) *d++])
- range--;
-
- startpos += irange - range;
- }
- else /* Searching backwards. */
- {
- register char c = (size1 == 0 || startpos >= size1
- ? string2[startpos - size1]
- : string1[startpos]);
-
- if (!fastmap[(unsigned char) TRANSLATE (c)])
- goto advance;
- }
- }
-
- /* If can't match the null string, and that's all we have left, fail. */
- if (range >= 0 && startpos == total_size && fastmap
- && !bufp->can_be_null)
- return -1;
-
- val = re_match_2 (bufp, string1, size1, string2, size2,
- startpos, regs, stop);
- if (val >= 0)
- return startpos;
-
- if (val == -2)
- return -2;
-
- advance:
- if (!range)
- break;
- else if (range > 0)
- {
- range--;
- startpos++;
- }
- else
- {
- range++;
- startpos--;
- }
- }
- return -1;
-} /* re_search_2 */
-
-/* Declarations and macros for re_match_2. */
-
-static int bcmp_translate ();
-static boolean alt_match_null_string_p (),
- common_op_match_null_string_p (),
- group_match_null_string_p ();
-
-/* Structure for per-register (a.k.a. per-group) information.
- This must not be longer than one word, because we push this value
- onto the failure stack. Other register information, such as the
- starting and ending positions (which are addresses), and the list of
- inner groups (which is a bits list) are maintained in separate
- variables.
-
- We are making a (strictly speaking) nonportable assumption here: that
- the compiler will pack our bit fields into something that fits into
- the type of `word', i.e., is something that fits into one item on the
- failure stack. */
-typedef union
-{
- fail_stack_elt_t word;
- struct
- {
- /* This field is one if this group can match the empty string,
- zero if not. If not yet determined, `MATCH_NULL_UNSET_VALUE'. */
-#define MATCH_NULL_UNSET_VALUE 3
- unsigned match_null_string_p : 2;
- unsigned is_active : 1;
- unsigned matched_something : 1;
- unsigned ever_matched_something : 1;
- } bits;
-} register_info_type;
-
-#define REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p)
-#define IS_ACTIVE(R) ((R).bits.is_active)
-#define MATCHED_SOMETHING(R) ((R).bits.matched_something)
-#define EVER_MATCHED_SOMETHING(R) ((R).bits.ever_matched_something)
-
-
-/* Call this when have matched a real character; it sets `matched' flags
- for the subexpressions which we are currently inside. Also records
- that those subexprs have matched. */
-#define SET_REGS_MATCHED() \
- do \
- { \
- unsigned r; \
- for (r = lowest_active_reg; r <= highest_active_reg; r++) \
- { \
- MATCHED_SOMETHING (reg_info[r]) \
- = EVER_MATCHED_SOMETHING (reg_info[r]) \
- = 1; \
- } \
- } \
- while (0)
-
-
-/* This converts PTR, a pointer into one of the search strings `string1'
- and `string2' into an offset from the beginning of that string. */
-#define POINTER_TO_OFFSET(ptr) \
- (FIRST_STRING_P (ptr) ? (ptr) - string1 : (ptr) - string2 + size1)
-
-/* Registers are set to a sentinel when they haven't yet matched. */
-#define REG_UNSET_VALUE ((char *) -1)
-#define REG_UNSET(e) ((e) == REG_UNSET_VALUE)
-
-
-/* Macros for dealing with the split strings in re_match_2. */
-
-#define MATCHING_IN_FIRST_STRING (dend == end_match_1)
-
-/* Call before fetching a character with *d. This switches over to
- string2 if necessary. */
-#define PREFETCH() \
- while (d == dend) \
- { \
- /* End of string2 => fail. */ \
- if (dend == end_match_2) \
- goto fail; \
- /* End of string1 => advance to string2. */ \
- d = string2; \
- dend = end_match_2; \
- }
-
-
-/* Test if at very beginning or at very end of the virtual concatenation
- of `string1' and `string2'. If only one string, it's `string2'. */
-#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2)
-#define AT_STRINGS_END(d) ((d) == end2)
-
-
-/* Test if D points to a character which is word-constituent. We have
- two special cases to check for: if past the end of string1, look at
- the first character in string2; and if before the beginning of
- string2, look at the last character in string1. */
-#define WORDCHAR_P(d) \
- (SYNTAX ((d) == end1 ? *string2 \
- : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \
- == Sword)
-
-/* Test if the character before D and the one at D differ with respect
- to being word-constituent. */
-#define AT_WORD_BOUNDARY(d) \
- (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \
- || WORDCHAR_P (d - 1) != WORDCHAR_P (d))
-
-
-/* Free everything we malloc. */
-#ifdef REGEX_MALLOC
-#define FREE_VAR(var) if (var) free (var); var = NULL
-#define FREE_VARIABLES() \
- do { \
- FREE_VAR (fail_stack.stack); \
- FREE_VAR (regstart); \
- FREE_VAR (regend); \
- FREE_VAR (old_regstart); \
- FREE_VAR (old_regend); \
- FREE_VAR (best_regstart); \
- FREE_VAR (best_regend); \
- FREE_VAR (reg_info); \
- FREE_VAR (reg_dummy); \
- FREE_VAR (reg_info_dummy); \
- } while (0)
-#else /* not REGEX_MALLOC */
-/* Some MIPS systems (at least) want this to free alloca'd storage. */
-#define FREE_VARIABLES() alloca (0)
-#endif /* not REGEX_MALLOC */
-
-
-/* These values must meet several constraints. They must not be valid
- register values; since we have a limit of 255 registers (because
- we use only one byte in the pattern for the register number), we can
- use numbers larger than 255. They must differ by 1, because of
- NUM_FAILURE_ITEMS above. And the value for the lowest register must
- be larger than the value for the highest register, so we do not try
- to actually save any registers when none are active. */
-#define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH)
-#define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1)
-
-/* Matching routines. */
-
-#ifndef emacs /* Emacs never uses this. */
-/* re_match is like re_match_2 except it takes only a single string. */
-
-int
-re_match (bufp, string, size, pos, regs)
- struct re_pattern_buffer *bufp;
- const char *string;
- int size, pos;
- struct re_registers *regs;
- {
- return re_match_2 (bufp, NULL, 0, string, size, pos, regs, size);
-}
-#endif /* not emacs */
-
-
-/* re_match_2 matches the compiled pattern in BUFP against the
- the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1
- and SIZE2, respectively). We start matching at POS, and stop
- matching at STOP.
-
- If REGS is non-null and the `no_sub' field of BUFP is nonzero, we
- store offsets for the substring each group matched in REGS. See the
- documentation for exactly how many groups we fill.
-
- We return -1 if no match, -2 if an internal error (such as the
- failure stack overflowing). Otherwise, we return the length of the
- matched substring. */
-
-int
-re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
- struct re_pattern_buffer *bufp;
- const char *string1, *string2;
- int size1, size2;
- int pos;
- struct re_registers *regs;
- int stop;
-{
- /* General temporaries. */
- int mcnt;
- unsigned char *p1;
-
- /* Just past the end of the corresponding string. */
- const char *end1, *end2;
-
- /* Pointers into string1 and string2, just past the last characters in
- each to consider matching. */
- const char *end_match_1, *end_match_2;
-
- /* Where we are in the data, and the end of the current string. */
- const char *d, *dend;
-
- /* Where we are in the pattern, and the end of the pattern. */
- unsigned char *p = bufp->buffer;
- register unsigned char *pend = p + bufp->used;
-
- /* We use this to map every character in the string. */
- char *translate = bufp->translate;
-
- /* Failure point stack. Each place that can handle a failure further
- down the line pushes a failure point on this stack. It consists of
- restart, regend, and reg_info for all registers corresponding to
- the subexpressions we're currently inside, plus the number of such
- registers, and, finally, two char *'s. The first char * is where
- to resume scanning the pattern; the second one is where to resume
- scanning the strings. If the latter is zero, the failure point is
- a ``dummy''; if a failure happens and the failure point is a dummy,
- it gets discarded and the next next one is tried. */
- fail_stack_type fail_stack;
-#ifdef DEBUG
- static unsigned failure_id = 0;
- unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0;
-#endif
-
- /* We fill all the registers internally, independent of what we
- return, for use in backreferences. The number here includes
- an element for register zero. */
- unsigned num_regs = bufp->re_nsub + 1;
-
- /* The currently active registers. */
- unsigned lowest_active_reg = NO_LOWEST_ACTIVE_REG;
- unsigned highest_active_reg = NO_HIGHEST_ACTIVE_REG;
-
- /* Information on the contents of registers. These are pointers into
- the input strings; they record just what was matched (on this
- attempt) by a subexpression part of the pattern, that is, the
- regnum-th regstart pointer points to where in the pattern we began
- matching and the regnum-th regend points to right after where we
- stopped matching the regnum-th subexpression. (The zeroth register
- keeps track of what the whole pattern matches.) */
- const char **regstart, **regend;
-
- /* If a group that's operated upon by a repetition operator fails to
- match anything, then the register for its start will need to be
- restored because it will have been set to wherever in the string we
- are when we last see its open-group operator. Similarly for a
- register's end. */
- const char **old_regstart, **old_regend;
-
- /* The is_active field of reg_info helps us keep track of which (possibly
- nested) subexpressions we are currently in. The matched_something
- field of reg_info[reg_num] helps us tell whether or not we have
- matched any of the pattern so far this time through the reg_num-th
- subexpression. These two fields get reset each time through any
- loop their register is in. */
- register_info_type *reg_info;
-
- /* The following record the register info as found in the above
- variables when we find a match better than any we've seen before.
- This happens as we backtrack through the failure points, which in
- turn happens only if we have not yet matched the entire string. */
- unsigned best_regs_set = false;
- const char **best_regstart, **best_regend;
-
- /* Logically, this is `best_regend[0]'. But we don't want to have to
- allocate space for that if we're not allocating space for anything
- else (see below). Also, we never need info about register 0 for
- any of the other register vectors, and it seems rather a kludge to
- treat `best_regend' differently than the rest. So we keep track of
- the end of the best match so far in a separate variable. We
- initialize this to NULL so that when we backtrack the first time
- and need to test it, it's not garbage. */
- const char *match_end = NULL;
-
- /* Used when we pop values we don't care about. */
- const char **reg_dummy;
- register_info_type *reg_info_dummy;
-
-#ifdef DEBUG
- /* Counts the total number of registers pushed. */
- unsigned num_regs_pushed = 0;
-#endif
-
- DEBUG_PRINT1 ("\n\nEntering re_match_2.\n");
-
- INIT_FAIL_STACK ();
-
- /* Do not bother to initialize all the register variables if there are
- no groups in the pattern, as it takes a fair amount of time. If
- there are groups, we include space for register 0 (the whole
- pattern), even though we never use it, since it simplifies the
- array indexing. We should fix this. */
- if (bufp->re_nsub)
- {
- regstart = REGEX_TALLOC (num_regs, const char *);
- regend = REGEX_TALLOC (num_regs, const char *);
- old_regstart = REGEX_TALLOC (num_regs, const char *);
- old_regend = REGEX_TALLOC (num_regs, const char *);
- best_regstart = REGEX_TALLOC (num_regs, const char *);
- best_regend = REGEX_TALLOC (num_regs, const char *);
- reg_info = REGEX_TALLOC (num_regs, register_info_type);
- reg_dummy = REGEX_TALLOC (num_regs, const char *);
- reg_info_dummy = REGEX_TALLOC (num_regs, register_info_type);
-
- if (!(regstart && regend && old_regstart && old_regend && reg_info
- && best_regstart && best_regend && reg_dummy && reg_info_dummy))
- {
- FREE_VARIABLES ();
- return -2;
- }
- }
-#ifdef REGEX_MALLOC
- else
- {
- /* We must initialize all our variables to NULL, so that
- `FREE_VARIABLES' doesn't try to free them. */
- regstart = regend = old_regstart = old_regend = best_regstart
- = best_regend = reg_dummy = NULL;
- reg_info = reg_info_dummy = (register_info_type *) NULL;
- }
-#endif /* REGEX_MALLOC */
-
- /* The starting position is bogus. */
- if (pos < 0 || pos > size1 + size2)
- {
- FREE_VARIABLES ();
- return -1;
- }
-
- /* Initialize subexpression text positions to -1 to mark ones that no
- start_memory/stop_memory has been seen for. Also initialize the
- register information struct. */
- for (mcnt = 1; mcnt < num_regs; mcnt++)
- {
- regstart[mcnt] = regend[mcnt]
- = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE;
-
- REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE;
- IS_ACTIVE (reg_info[mcnt]) = 0;
- MATCHED_SOMETHING (reg_info[mcnt]) = 0;
- EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0;
- }
-
- /* We move `string1' into `string2' if the latter's empty -- but not if
- `string1' is null. */
- if (size2 == 0 && string1 != NULL)
- {
- string2 = string1;
- size2 = size1;
- string1 = 0;
- size1 = 0;
- }
- end1 = string1 + size1;
- end2 = string2 + size2;
-
- /* Compute where to stop matching, within the two strings. */
- if (stop <= size1)
- {
- end_match_1 = string1 + stop;
- end_match_2 = string2;
- }
- else
- {
- end_match_1 = end1;
- end_match_2 = string2 + stop - size1;
- }
-
- /* `p' scans through the pattern as `d' scans through the data.
- `dend' is the end of the input string that `d' points within. `d'
- is advanced into the following input string whenever necessary, but
- this happens before fetching; therefore, at the beginning of the
- loop, `d' can be pointing at the end of a string, but it cannot
- equal `string2'. */
- if (size1 > 0 && pos <= size1)
- {
- d = string1 + pos;
- dend = end_match_1;
- }
- else
- {
- d = string2 + pos - size1;
- dend = end_match_2;
- }
-
- DEBUG_PRINT1 ("The compiled pattern is: ");
- DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend);
- DEBUG_PRINT1 ("The string to match is: `");
- DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2);
- DEBUG_PRINT1 ("'\n");
-
- /* This loops over pattern commands. It exits by returning from the
- function if the match is complete, or it drops through if the match
- fails at this starting point in the input data. */
- for (;;)
- {
- DEBUG_PRINT2 ("\n0x%x: ", p);
-
- if (p == pend)
- { /* End of pattern means we might have succeeded. */
- DEBUG_PRINT1 ("end of pattern ... ");
-
- /* If we haven't matched the entire string, and we want the
- longest match, try backtracking. */
- if (d != end_match_2)
- {
- DEBUG_PRINT1 ("backtracking.\n");
-
- if (!FAIL_STACK_EMPTY ())
- { /* More failure points to try. */
- boolean same_str_p = (FIRST_STRING_P (match_end)
- == MATCHING_IN_FIRST_STRING);
-
- /* If exceeds best match so far, save it. */
- if (!best_regs_set
- || (same_str_p && d > match_end)
- || (!same_str_p && !MATCHING_IN_FIRST_STRING))
- {
- best_regs_set = true;
- match_end = d;
-
- DEBUG_PRINT1 ("\nSAVING match as best so far.\n");
-
- for (mcnt = 1; mcnt < num_regs; mcnt++)
- {
- best_regstart[mcnt] = regstart[mcnt];
- best_regend[mcnt] = regend[mcnt];
- }
- }
- goto fail;
- }
-
- /* If no failure points, don't restore garbage. */
- else if (best_regs_set)
- {
- restore_best_regs:
- /* Restore best match. It may happen that `dend ==
- end_match_1' while the restored d is in string2.
- For example, the pattern `x.*y.*z' against the
- strings `x-' and `y-z-', if the two strings are
- not consecutive in memory. */
- DEBUG_PRINT1 ("Restoring best registers.\n");
-
- d = match_end;
- dend = ((d >= string1 && d <= end1)
- ? end_match_1 : end_match_2);
-
- for (mcnt = 1; mcnt < num_regs; mcnt++)
- {
- regstart[mcnt] = best_regstart[mcnt];
- regend[mcnt] = best_regend[mcnt];
- }
- }
- } /* d != end_match_2 */
-
- DEBUG_PRINT1 ("Accepting match.\n");
-
- /* If caller wants register contents data back, do it. */
- if (regs && !bufp->no_sub)
- {
- /* Have the register data arrays been allocated? */
- if (bufp->regs_allocated == REGS_UNALLOCATED)
- { /* No. So allocate them with malloc. We need one
- extra element beyond `num_regs' for the `-1' marker
- GNU code uses. */
- regs->num_regs = MAX (RE_NREGS, num_regs + 1);
- regs->start = TALLOC (regs->num_regs, regoff_t);
- regs->end = TALLOC (regs->num_regs, regoff_t);
- if (regs->start == NULL || regs->end == NULL)
- return -2;
- bufp->regs_allocated = REGS_REALLOCATE;
- }
- else if (bufp->regs_allocated == REGS_REALLOCATE)
- { /* Yes. If we need more elements than were already
- allocated, reallocate them. If we need fewer, just
- leave it alone. */
- if (regs->num_regs < num_regs + 1)
- {
- regs->num_regs = num_regs + 1;
- RETALLOC (regs->start, regs->num_regs, regoff_t);
- RETALLOC (regs->end, regs->num_regs, regoff_t);
- if (regs->start == NULL || regs->end == NULL)
- return -2;
- }
- }
- else
- assert (bufp->regs_allocated == REGS_FIXED);
-
- /* Convert the pointer data in `regstart' and `regend' to
- indices. Register zero has to be set differently,
- since we haven't kept track of any info for it. */
- if (regs->num_regs > 0)
- {
- regs->start[0] = pos;
- regs->end[0] = (MATCHING_IN_FIRST_STRING ? d - string1
- : d - string2 + size1);
- }
-
- /* Go through the first `min (num_regs, regs->num_regs)'
- registers, since that is all we initialized. */
- for (mcnt = 1; mcnt < MIN (num_regs, regs->num_regs); mcnt++)
- {
- if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt]))
- regs->start[mcnt] = regs->end[mcnt] = -1;
- else
- {
- regs->start[mcnt] = POINTER_TO_OFFSET (regstart[mcnt]);
- regs->end[mcnt] = POINTER_TO_OFFSET (regend[mcnt]);
- }
- }
-
- /* If the regs structure we return has more elements than
- were in the pattern, set the extra elements to -1. If
- we (re)allocated the registers, this is the case,
- because we always allocate enough to have at least one
- -1 at the end. */
- for (mcnt = num_regs; mcnt < regs->num_regs; mcnt++)
- regs->start[mcnt] = regs->end[mcnt] = -1;
- } /* regs && !bufp->no_sub */
-
- FREE_VARIABLES ();
- DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n",
- nfailure_points_pushed, nfailure_points_popped,
- nfailure_points_pushed - nfailure_points_popped);
- DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed);
-
- mcnt = d - pos - (MATCHING_IN_FIRST_STRING
- ? string1
- : string2 - size1);
-
- DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt);
-
- return mcnt;
- }
-
- /* Otherwise match next pattern command. */
-#ifdef SWITCH_ENUM_BUG
- switch ((int) ((re_opcode_t) *p++))
-#else
- switch ((re_opcode_t) *p++)
-#endif
- {
- /* Ignore these. Used to ignore the n of succeed_n's which
- currently have n == 0. */
- case no_op:
- DEBUG_PRINT1 ("EXECUTING no_op.\n");
- break;
-
-
- /* Match the next n pattern characters exactly. The following
- byte in the pattern defines n, and the n bytes after that
- are the characters to match. */
- case exactn:
- mcnt = *p++;
- DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt);
-
- /* This is written out as an if-else so we don't waste time
- testing `translate' inside the loop. */
- if (translate)
- {
- do
- {
- PREFETCH ();
- if (translate[(unsigned char) *d++] != (char) *p++)
- goto fail;
- }
- while (--mcnt);
- }
- else
- {
- do
- {
- PREFETCH ();
- if (*d++ != (char) *p++) goto fail;
- }
- while (--mcnt);
- }
- SET_REGS_MATCHED ();
- break;
-
-
- /* Match any character except possibly a newline or a null. */
- case anychar:
- DEBUG_PRINT1 ("EXECUTING anychar.\n");
-
- PREFETCH ();
-
- if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n')
- || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000'))
- goto fail;
-
- SET_REGS_MATCHED ();
- DEBUG_PRINT2 (" Matched `%d'.\n", *d);
- d++;
- break;
-
-
- case charset:
- case charset_not:
- {
- register unsigned char c;
- boolean not = (re_opcode_t) *(p - 1) == charset_not;
-
- DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : "");
-
- PREFETCH ();
- c = TRANSLATE (*d); /* The character to match. */
-
- /* Cast to `unsigned' instead of `unsigned char' in case the
- bit list is a full 32 bytes long. */
- if (c < (unsigned) (*p * BYTEWIDTH)
- && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
-
- p += 1 + *p;
-
- if (!not) goto fail;
-
- SET_REGS_MATCHED ();
- d++;
- break;
- }
-
-
- /* The beginning of a group is represented by start_memory.
- The arguments are the register number in the next byte, and the
- number of groups inner to this one in the next. The text
- matched within the group is recorded (in the internal
- registers data structure) under the register number. */
- case start_memory:
- DEBUG_PRINT3 ("EXECUTING start_memory %d (%d):\n", *p, p[1]);
-
- /* Find out if this group can match the empty string. */
- p1 = p; /* To send to group_match_null_string_p. */
-
- if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE)
- REG_MATCH_NULL_STRING_P (reg_info[*p])
- = group_match_null_string_p (&p1, pend, reg_info);
-
- /* Save the position in the string where we were the last time
- we were at this open-group operator in case the group is
- operated upon by a repetition operator, e.g., with `(a*)*b'
- against `ab'; then we want to ignore where we are now in
- the string in case this attempt to match fails. */
- old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
- ? REG_UNSET (regstart[*p]) ? d : regstart[*p]
- : regstart[*p];
- DEBUG_PRINT2 (" old_regstart: %d\n",
- POINTER_TO_OFFSET (old_regstart[*p]));
-
- regstart[*p] = d;
- DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p]));
-
- IS_ACTIVE (reg_info[*p]) = 1;
- MATCHED_SOMETHING (reg_info[*p]) = 0;
-
- /* This is the new highest active register. */
- highest_active_reg = *p;
-
- /* If nothing was active before, this is the new lowest active
- register. */
- if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
- lowest_active_reg = *p;
-
- /* Move past the register number and inner group count. */
- p += 2;
- break;
-
-
- /* The stop_memory opcode represents the end of a group. Its
- arguments are the same as start_memory's: the register
- number, and the number of inner groups. */
- case stop_memory:
- DEBUG_PRINT3 ("EXECUTING stop_memory %d (%d):\n", *p, p[1]);
-
- /* We need to save the string position the last time we were at
- this close-group operator in case the group is operated
- upon by a repetition operator, e.g., with `((a*)*(b*)*)*'
- against `aba'; then we want to ignore where we are now in
- the string in case this attempt to match fails. */
- old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
- ? REG_UNSET (regend[*p]) ? d : regend[*p]
- : regend[*p];
- DEBUG_PRINT2 (" old_regend: %d\n",
- POINTER_TO_OFFSET (old_regend[*p]));
-
- regend[*p] = d;
- DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p]));
-
- /* This register isn't active anymore. */
- IS_ACTIVE (reg_info[*p]) = 0;
-
- /* If this was the only register active, nothing is active
- anymore. */
- if (lowest_active_reg == highest_active_reg)
- {
- lowest_active_reg = NO_LOWEST_ACTIVE_REG;
- highest_active_reg = NO_HIGHEST_ACTIVE_REG;
- }
- else
- { /* We must scan for the new highest active register, since
- it isn't necessarily one less than now: consider
- (a(b)c(d(e)f)g). When group 3 ends, after the f), the
- new highest active register is 1. */
- unsigned char r = *p - 1;
- while (r > 0 && !IS_ACTIVE (reg_info[r]))
- r--;
-
- /* If we end up at register zero, that means that we saved
- the registers as the result of an `on_failure_jump', not
- a `start_memory', and we jumped to past the innermost
- `stop_memory'. For example, in ((.)*) we save
- registers 1 and 2 as a result of the *, but when we pop
- back to the second ), we are at the stop_memory 1.
- Thus, nothing is active. */
- if (r == 0)
- {
- lowest_active_reg = NO_LOWEST_ACTIVE_REG;
- highest_active_reg = NO_HIGHEST_ACTIVE_REG;
- }
- else
- highest_active_reg = r;
- }
-
- /* If just failed to match something this time around with a
- group that's operated on by a repetition operator, try to
- force exit from the ``loop'', and restore the register
- information for this group that we had before trying this
- last match. */
- if ((!MATCHED_SOMETHING (reg_info[*p])
- || (re_opcode_t) p[-3] == start_memory)
- && (p + 2) < pend)
- {
- boolean is_a_jump_n = false;
-
- p1 = p + 2;
- mcnt = 0;
- switch ((re_opcode_t) *p1++)
- {
- case jump_n:
- is_a_jump_n = true;
- case pop_failure_jump:
- case maybe_pop_jump:
- case jump:
- case dummy_failure_jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- if (is_a_jump_n)
- p1 += 2;
- break;
-
- default:
- /* do nothing */ ;
- }
- p1 += mcnt;
-
- /* If the next operation is a jump backwards in the pattern
- to an on_failure_jump right before the start_memory
- corresponding to this stop_memory, exit from the loop
- by forcing a failure after pushing on the stack the
- on_failure_jump's jump in the pattern, and d. */
- if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump
- && (re_opcode_t) p1[3] == start_memory && p1[4] == *p)
- {
- /* If this group ever matched anything, then restore
- what its registers were before trying this last
- failed match, e.g., with `(a*)*b' against `ab' for
- regstart[1], and, e.g., with `((a*)*(b*)*)*'
- against `aba' for regend[3].
-
- Also restore the registers for inner groups for,
- e.g., `((a*)(b*))*' against `aba' (register 3 would
- otherwise get trashed). */
-
- if (EVER_MATCHED_SOMETHING (reg_info[*p]))
- {
- unsigned r;
-
- EVER_MATCHED_SOMETHING (reg_info[*p]) = 0;
-
- /* Restore this and inner groups' (if any) registers. */
- for (r = *p; r < *p + *(p + 1); r++)
- {
- regstart[r] = old_regstart[r];
-
- /* xx why this test? */
- if ((int) old_regend[r] >= (int) regstart[r])
- regend[r] = old_regend[r];
- }
- }
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- PUSH_FAILURE_POINT (p1 + mcnt, d, -2);
-
- goto fail;
- }
- }
-
- /* Move past the register number and the inner group count. */
- p += 2;
- break;
-
-
- /* \<digit> has been turned into a `duplicate' command which is
- followed by the numeric value of <digit> as the register number. */
- case duplicate:
- {
- register const char *d2, *dend2;
- int regno = *p++; /* Get which register to match against. */
- DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno);
-
- /* Can't back reference a group which we've never matched. */
- if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno]))
- goto fail;
-
- /* Where in input to try to start matching. */
- d2 = regstart[regno];
-
- /* Where to stop matching; if both the place to start and
- the place to stop matching are in the same string, then
- set to the place to stop, otherwise, for now have to use
- the end of the first string. */
-
- dend2 = ((FIRST_STRING_P (regstart[regno])
- == FIRST_STRING_P (regend[regno]))
- ? regend[regno] : end_match_1);
- for (;;)
- {
- /* If necessary, advance to next segment in register
- contents. */
- while (d2 == dend2)
- {
- if (dend2 == end_match_2) break;
- if (dend2 == regend[regno]) break;
-
- /* End of string1 => advance to string2. */
- d2 = string2;
- dend2 = regend[regno];
- }
- /* At end of register contents => success */
- if (d2 == dend2) break;
-
- /* If necessary, advance to next segment in data. */
- PREFETCH ();
-
- /* How many characters left in this segment to match. */
- mcnt = dend - d;
-
- /* Want how many consecutive characters we can match in
- one shot, so, if necessary, adjust the count. */
- if (mcnt > dend2 - d2)
- mcnt = dend2 - d2;
-
- /* Compare that many; failure if mismatch, else move
- past them. */
- if (translate
- ? bcmp_translate (d, d2, mcnt, translate)
- : bcmp (d, d2, mcnt))
- goto fail;
- d += mcnt, d2 += mcnt;
- }
- }
- break;
-
-
- /* begline matches the empty string at the beginning of the string
- (unless `not_bol' is set in `bufp'), and, if
- `newline_anchor' is set, after newlines. */
- case begline:
- DEBUG_PRINT1 ("EXECUTING begline.\n");
-
- if (AT_STRINGS_BEG (d))
- {
- if (!bufp->not_bol) break;
- }
- else if (d[-1] == '\n' && bufp->newline_anchor)
- {
- break;
- }
- /* In all other cases, we fail. */
- goto fail;
-
-
- /* endline is the dual of begline. */
- case endline:
- DEBUG_PRINT1 ("EXECUTING endline.\n");
-
- if (AT_STRINGS_END (d))
- {
- if (!bufp->not_eol) break;
- }
-
- /* We have to ``prefetch'' the next character. */
- else if ((d == end1 ? *string2 : *d) == '\n'
- && bufp->newline_anchor)
- {
- break;
- }
- goto fail;
-
-
- /* Match at the very beginning of the data. */
- case begbuf:
- DEBUG_PRINT1 ("EXECUTING begbuf.\n");
- if (AT_STRINGS_BEG (d))
- break;
- goto fail;
-
-
- /* Match at the very end of the data. */
- case endbuf:
- DEBUG_PRINT1 ("EXECUTING endbuf.\n");
- if (AT_STRINGS_END (d))
- break;
- goto fail;
-
-
- /* on_failure_keep_string_jump is used to optimize `.*\n'. It
- pushes NULL as the value for the string on the stack. Then
- `pop_failure_point' will keep the current value for the
- string, instead of restoring it. To see why, consider
- matching `foo\nbar' against `.*\n'. The .* matches the foo;
- then the . fails against the \n. But the next thing we want
- to do is match the \n against the \n; if we restored the
- string value, we would be back at the foo.
-
- Because this is used only in specific cases, we don't need to
- check all the things that `on_failure_jump' does, to make
- sure the right things get saved on the stack. Hence we don't
- share its code. The only reason to push anything on the
- stack at all is that otherwise we would have to change
- `anychar's code to do something besides goto fail in this
- case; that seems worse than this. */
- case on_failure_keep_string_jump:
- DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump");
-
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt);
-
- PUSH_FAILURE_POINT (p + mcnt, NULL, -2);
- break;
-
-
- /* Uses of on_failure_jump:
-
- Each alternative starts with an on_failure_jump that points
- to the beginning of the next alternative. Each alternative
- except the last ends with a jump that in effect jumps past
- the rest of the alternatives. (They really jump to the
- ending jump of the following alternative, because tensioning
- these jumps is a hassle.)
-
- Repeats start with an on_failure_jump that points past both
- the repetition text and either the following jump or
- pop_failure_jump back to this on_failure_jump. */
- case on_failure_jump:
- on_failure:
- DEBUG_PRINT1 ("EXECUTING on_failure_jump");
-
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt);
-
- /* If this on_failure_jump comes right before a group (i.e.,
- the original * applied to a group), save the information
- for that group and all inner ones, so that if we fail back
- to this point, the group's information will be correct.
- For example, in \(a*\)*\1, we need the preceding group,
- and in \(\(a*\)b*\)\2, we need the inner group. */
-
- /* We can't use `p' to check ahead because we push
- a failure point to `p + mcnt' after we do this. */
- p1 = p;
-
- /* We need to skip no_op's before we look for the
- start_memory in case this on_failure_jump is happening as
- the result of a completed succeed_n, as in \(a\)\{1,3\}b\1
- against aba. */
- while (p1 < pend && (re_opcode_t) *p1 == no_op)
- p1++;
-
- if (p1 < pend && (re_opcode_t) *p1 == start_memory)
- {
- /* We have a new highest active register now. This will
- get reset at the start_memory we are about to get to,
- but we will have saved all the registers relevant to
- this repetition op, as described above. */
- highest_active_reg = *(p1 + 1) + *(p1 + 2);
- if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
- lowest_active_reg = *(p1 + 1);
- }
-
- DEBUG_PRINT1 (":\n");
- PUSH_FAILURE_POINT (p + mcnt, d, -2);
- break;
-
-
- /* A smart repeat ends with `maybe_pop_jump'.
- We change it to either `pop_failure_jump' or `jump'. */
- case maybe_pop_jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt);
- {
- register unsigned char *p2 = p;
-
- /* Compare the beginning of the repeat with what in the
- pattern follows its end. If we can establish that there
- is nothing that they would both match, i.e., that we
- would have to backtrack because of (as in, e.g., `a*a')
- then we can change to pop_failure_jump, because we'll
- never have to backtrack.
-
- This is not true in the case of alternatives: in
- `(a|ab)*' we do need to backtrack to the `ab' alternative
- (e.g., if the string was `ab'). But instead of trying to
- detect that here, the alternative has put on a dummy
- failure point which is what we will end up popping. */
-
- /* Skip over open/close-group commands. */
- while (p2 + 2 < pend
- && ((re_opcode_t) *p2 == stop_memory
- || (re_opcode_t) *p2 == start_memory))
- p2 += 3; /* Skip over args, too. */
-
- /* If we're at the end of the pattern, we can change. */
- if (p2 == pend)
- {
- /* Consider what happens when matching ":\(.*\)"
- against ":/". I don't really understand this code
- yet. */
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT1
- (" End of pattern: change to `pop_failure_jump'.\n");
- }
-
- else if ((re_opcode_t) *p2 == exactn
- || (bufp->newline_anchor && (re_opcode_t) *p2 == endline))
- {
- register unsigned char c
- = *p2 == (unsigned char) endline ? '\n' : p2[2];
- p1 = p + mcnt;
-
- /* p1[0] ... p1[2] are the `on_failure_jump' corresponding
- to the `maybe_finalize_jump' of this case. Examine what
- follows. */
- if ((re_opcode_t) p1[3] == exactn && p1[5] != c)
- {
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n",
- c, p1[5]);
- }
-
- else if ((re_opcode_t) p1[3] == charset
- || (re_opcode_t) p1[3] == charset_not)
- {
- int not = (re_opcode_t) p1[3] == charset_not;
-
- if (c < (unsigned char) (p1[4] * BYTEWIDTH)
- && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
-
- /* `not' is equal to 1 if c would match, which means
- that we can't change to pop_failure_jump. */
- if (!not)
- {
- p[-3] = (unsigned char) pop_failure_jump;
- DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
- }
- }
- }
- }
- p -= 2; /* Point at relative address again. */
- if ((re_opcode_t) p[-1] != pop_failure_jump)
- {
- p[-1] = (unsigned char) jump;
- DEBUG_PRINT1 (" Match => jump.\n");
- goto unconditional_jump;
- }
- /* Note fall through. */
-
-
- /* The end of a simple repeat has a pop_failure_jump back to
- its matching on_failure_jump, where the latter will push a
- failure point. The pop_failure_jump takes off failure
- points put on by this pop_failure_jump's matching
- on_failure_jump; we got through the pattern to here from the
- matching on_failure_jump, so didn't fail. */
- case pop_failure_jump:
- {
- /* We need to pass separate storage for the lowest and
- highest registers, even though we don't care about the
- actual values. Otherwise, we will restore only one
- register from the stack, since lowest will == highest in
- `pop_failure_point'. */
- unsigned dummy_low_reg, dummy_high_reg;
- unsigned char *pdummy;
- const char *sdummy;
-
- DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n");
- POP_FAILURE_POINT (sdummy, pdummy,
- dummy_low_reg, dummy_high_reg,
- reg_dummy, reg_dummy, reg_info_dummy);
- }
- /* Note fall through. */
-
-
- /* Unconditionally jump (without popping any failure points). */
- case jump:
- unconditional_jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */
- DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt);
- p += mcnt; /* Do the jump. */
- DEBUG_PRINT2 ("(to 0x%x).\n", p);
- break;
-
-
- /* We need this opcode so we can detect where alternatives end
- in `group_match_null_string_p' et al. */
- case jump_past_alt:
- DEBUG_PRINT1 ("EXECUTING jump_past_alt.\n");
- goto unconditional_jump;
-
-
- /* Normally, the on_failure_jump pushes a failure point, which
- then gets popped at pop_failure_jump. We will end up at
- pop_failure_jump, also, and with a pattern of, say, `a+', we
- are skipping over the on_failure_jump, so we have to push
- something meaningless for pop_failure_jump to pop. */
- case dummy_failure_jump:
- DEBUG_PRINT1 ("EXECUTING dummy_failure_jump.\n");
- /* It doesn't matter what we push for the string here. What
- the code at `fail' tests is the value for the pattern. */
- PUSH_FAILURE_POINT (0, 0, -2);
- goto unconditional_jump;
-
-
- /* At the end of an alternative, we need to push a dummy failure
- point in case we are followed by a `pop_failure_jump', because
- we don't want the failure point for the alternative to be
- popped. For example, matching `(a|ab)*' against `aab'
- requires that we match the `ab' alternative. */
- case push_dummy_failure:
- DEBUG_PRINT1 ("EXECUTING push_dummy_failure.\n");
- /* See comments just above at `dummy_failure_jump' about the
- two zeroes. */
- PUSH_FAILURE_POINT (0, 0, -2);
- break;
-
- /* Have to succeed matching what follows at least n times.
- After that, handle like `on_failure_jump'. */
- case succeed_n:
- EXTRACT_NUMBER (mcnt, p + 2);
- DEBUG_PRINT2 ("EXECUTING succeed_n %d.\n", mcnt);
-
- assert (mcnt >= 0);
- /* Originally, this is how many times we HAVE to succeed. */
- if (mcnt > 0)
- {
- mcnt--;
- p += 2;
- STORE_NUMBER_AND_INCR (p, mcnt);
- DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p, mcnt);
- }
- else if (mcnt == 0)
- {
- DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n", p+2);
- p[2] = (unsigned char) no_op;
- p[3] = (unsigned char) no_op;
- goto on_failure;
- }
- break;
-
- case jump_n:
- EXTRACT_NUMBER (mcnt, p + 2);
- DEBUG_PRINT2 ("EXECUTING jump_n %d.\n", mcnt);
-
- /* Originally, this is how many times we CAN jump. */
- if (mcnt)
- {
- mcnt--;
- STORE_NUMBER (p + 2, mcnt);
- goto unconditional_jump;
- }
- /* If don't have to jump any more, skip over the rest of command. */
- else
- p += 4;
- break;
-
- case set_number_at:
- {
- DEBUG_PRINT1 ("EXECUTING set_number_at.\n");
-
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- p1 = p + mcnt;
- EXTRACT_NUMBER_AND_INCR (mcnt, p);
- DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt);
- STORE_NUMBER (p1, mcnt);
- break;
- }
-
- case wordbound:
- DEBUG_PRINT1 ("EXECUTING wordbound.\n");
- if (AT_WORD_BOUNDARY (d))
- break;
- goto fail;
-
- case notwordbound:
- DEBUG_PRINT1 ("EXECUTING notwordbound.\n");
- if (AT_WORD_BOUNDARY (d))
- goto fail;
- break;
-
- case wordbeg:
- DEBUG_PRINT1 ("EXECUTING wordbeg.\n");
- if (WORDCHAR_P (d) && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1)))
- break;
- goto fail;
-
- case wordend:
- DEBUG_PRINT1 ("EXECUTING wordend.\n");
- if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1)
- && (!WORDCHAR_P (d) || AT_STRINGS_END (d)))
- break;
- goto fail;
-
-#ifdef emacs
-#ifdef emacs19
- case before_dot:
- DEBUG_PRINT1 ("EXECUTING before_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) >= point)
- goto fail;
- break;
-
- case at_dot:
- DEBUG_PRINT1 ("EXECUTING at_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) != point)
- goto fail;
- break;
-
- case after_dot:
- DEBUG_PRINT1 ("EXECUTING after_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) <= point)
- goto fail;
- break;
-#else /* not emacs19 */
- case at_dot:
- DEBUG_PRINT1 ("EXECUTING at_dot.\n");
- if (PTR_CHAR_POS ((unsigned char *) d) + 1 != point)
- goto fail;
- break;
-#endif /* not emacs19 */
-
- case syntaxspec:
- DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt);
- mcnt = *p++;
- goto matchsyntax;
-
- case wordchar:
- DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n");
- mcnt = (int) Sword;
- matchsyntax:
- PREFETCH ();
- if (SYNTAX (*d++) != (enum syntaxcode) mcnt)
- goto fail;
- SET_REGS_MATCHED ();
- break;
-
- case notsyntaxspec:
- DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt);
- mcnt = *p++;
- goto matchnotsyntax;
-
- case notwordchar:
- DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n");
- mcnt = (int) Sword;
- matchnotsyntax:
- PREFETCH ();
- if (SYNTAX (*d++) == (enum syntaxcode) mcnt)
- goto fail;
- SET_REGS_MATCHED ();
- break;
-
-#else /* not emacs */
- case wordchar:
- DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n");
- PREFETCH ();
- if (!WORDCHAR_P (d))
- goto fail;
- SET_REGS_MATCHED ();
- d++;
- break;
-
- case notwordchar:
- DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n");
- PREFETCH ();
- if (WORDCHAR_P (d))
- goto fail;
- SET_REGS_MATCHED ();
- d++;
- break;
-#endif /* not emacs */
-
- default:
- abort ();
- }
- continue; /* Successfully executed one pattern command; keep going. */
-
-
- /* We goto here if a matching operation fails. */
- fail:
- if (!FAIL_STACK_EMPTY ())
- { /* A restart point is known. Restore to that state. */
- DEBUG_PRINT1 ("\nFAIL:\n");
- POP_FAILURE_POINT (d, p,
- lowest_active_reg, highest_active_reg,
- regstart, regend, reg_info);
-
- /* If this failure point is a dummy, try the next one. */
- if (!p)
- goto fail;
-
- /* If we failed to the end of the pattern, don't examine *p. */
- assert (p <= pend);
- if (p < pend)
- {
- boolean is_a_jump_n = false;
-
- /* If failed to a backwards jump that's part of a repetition
- loop, need to pop this failure point and use the next one. */
- switch ((re_opcode_t) *p)
- {
- case jump_n:
- is_a_jump_n = true;
- case maybe_pop_jump:
- case pop_failure_jump:
- case jump:
- p1 = p + 1;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- p1 += mcnt;
-
- if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n)
- || (!is_a_jump_n
- && (re_opcode_t) *p1 == on_failure_jump))
- goto fail;
- break;
- default:
- /* do nothing */ ;
- }
- }
-
- if (d >= string1 && d <= end1)
- dend = end_match_1;
- }
- else
- break; /* Matching at this starting point really fails. */
- } /* for (;;) */
-
- if (best_regs_set)
- goto restore_best_regs;
-
- FREE_VARIABLES ();
-
- return -1; /* Failure to match. */
-} /* re_match_2 */
-
-/* Subroutine definitions for re_match_2. */
-
-
-/* We are passed P pointing to a register number after a start_memory.
-
- Return true if the pattern up to the corresponding stop_memory can
- match the empty string, and false otherwise.
-
- If we find the matching stop_memory, sets P to point to one past its number.
- Otherwise, sets P to an undefined byte less than or equal to END.
-
- We don't handle duplicates properly (yet). */
-
-static boolean
-group_match_null_string_p (p, end, reg_info)
- unsigned char **p, *end;
- register_info_type *reg_info;
-{
- int mcnt;
- /* Point to after the args to the start_memory. */
- unsigned char *p1 = *p + 2;
-
- while (p1 < end)
- {
- /* Skip over opcodes that can match nothing, and return true or
- false, as appropriate, when we get to one that can't, or to the
- matching stop_memory. */
-
- switch ((re_opcode_t) *p1)
- {
- /* Could be either a loop or a series of alternatives. */
- case on_failure_jump:
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-
- /* If the next operation is not a jump backwards in the
- pattern. */
-
- if (mcnt >= 0)
- {
- /* Go through the on_failure_jumps of the alternatives,
- seeing if any of the alternatives cannot match nothing.
- The last alternative starts with only a jump,
- whereas the rest start with on_failure_jump and end
- with a jump, e.g., here is the pattern for `a|b|c':
-
- /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6
- /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3
- /exactn/1/c
-
- So, we have to first go through the first (n-1)
- alternatives and then deal with the last one separately. */
-
-
- /* Deal with the first (n-1) alternatives, which start
- with an on_failure_jump (see above) that jumps to right
- past a jump_past_alt. */
-
- while ((re_opcode_t) p1[mcnt-3] == jump_past_alt)
- {
- /* `mcnt' holds how many bytes long the alternative
- is, including the ending `jump_past_alt' and
- its number. */
-
- if (!alt_match_null_string_p (p1, p1 + mcnt - 3,
- reg_info))
- return false;
-
- /* Move to right after this alternative, including the
- jump_past_alt. */
- p1 += mcnt;
-
- /* Break if it's the beginning of an n-th alternative
- that doesn't begin with an on_failure_jump. */
- if ((re_opcode_t) *p1 != on_failure_jump)
- break;
-
- /* Still have to check that it's not an n-th
- alternative that starts with an on_failure_jump. */
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- if ((re_opcode_t) p1[mcnt-3] != jump_past_alt)
- {
- /* Get to the beginning of the n-th alternative. */
- p1 -= 3;
- break;
- }
- }
-
- /* Deal with the last alternative: go back and get number
- of the `jump_past_alt' just before it. `mcnt' contains
- the length of the alternative. */
- EXTRACT_NUMBER (mcnt, p1 - 2);
-
- if (!alt_match_null_string_p (p1, p1 + mcnt, reg_info))
- return false;
-
- p1 += mcnt; /* Get past the n-th alternative. */
- } /* if mcnt > 0 */
- break;
-
-
- case stop_memory:
- assert (p1[1] == **p);
- *p = p1 + 2;
- return true;
-
-
- default:
- if (!common_op_match_null_string_p (&p1, end, reg_info))
- return false;
- }
- } /* while p1 < end */
-
- return false;
-} /* group_match_null_string_p */
-
-
-/* Similar to group_match_null_string_p, but doesn't deal with alternatives:
- It expects P to be the first byte of a single alternative and END one
- byte past the last. The alternative can contain groups. */
-
-static boolean
-alt_match_null_string_p (p, end, reg_info)
- unsigned char *p, *end;
- register_info_type *reg_info;
-{
- int mcnt;
- unsigned char *p1 = p;
-
- while (p1 < end)
- {
- /* Skip over opcodes that can match nothing, and break when we get
- to one that can't. */
-
- switch ((re_opcode_t) *p1)
- {
- /* It's a loop. */
- case on_failure_jump:
- p1++;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- p1 += mcnt;
- break;
-
- default:
- if (!common_op_match_null_string_p (&p1, end, reg_info))
- return false;
- }
- } /* while p1 < end */
-
- return true;
-} /* alt_match_null_string_p */
-
-
-/* Deals with the ops common to group_match_null_string_p and
- alt_match_null_string_p.
-
- Sets P to one after the op and its arguments, if any. */
-
-static boolean
-common_op_match_null_string_p (p, end, reg_info)
- unsigned char **p, *end;
- register_info_type *reg_info;
-{
- int mcnt;
- boolean ret;
- int reg_no;
- unsigned char *p1 = *p;
-
- switch ((re_opcode_t) *p1++)
- {
- case no_op:
- case begline:
- case endline:
- case begbuf:
- case endbuf:
- case wordbeg:
- case wordend:
- case wordbound:
- case notwordbound:
-#ifdef emacs
- case before_dot:
- case at_dot:
- case after_dot:
-#endif
- break;
-
- case start_memory:
- reg_no = *p1;
- assert (reg_no > 0 && reg_no <= MAX_REGNUM);
- ret = group_match_null_string_p (&p1, end, reg_info);
-
- /* Have to set this here in case we're checking a group which
- contains a group and a back reference to it. */
-
- if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE)
- REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret;
-
- if (!ret)
- return false;
- break;
-
- /* If this is an optimized succeed_n for zero times, make the jump. */
- case jump:
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- if (mcnt >= 0)
- p1 += mcnt;
- else
- return false;
- break;
-
- case succeed_n:
- /* Get to the number of times to succeed. */
- p1 += 2;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-
- if (mcnt == 0)
- {
- p1 -= 4;
- EXTRACT_NUMBER_AND_INCR (mcnt, p1);
- p1 += mcnt;
- }
- else
- return false;
- break;
-
- case duplicate:
- if (!REG_MATCH_NULL_STRING_P (reg_info[*p1]))
- return false;
- break;
-
- case set_number_at:
- p1 += 4;
-
- default:
- /* All other opcodes mean we cannot match the empty string. */
- return false;
- }
-
- *p = p1;
- return true;
-} /* common_op_match_null_string_p */
-
-
-/* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN
- bytes; nonzero otherwise. */
-
-static int
-bcmp_translate (s1, s2, len, translate)
- unsigned char *s1, *s2;
- register int len;
- char *translate;
-{
- register unsigned char *p1 = s1, *p2 = s2;
- while (len)
- {
- if (translate[*p1++] != translate[*p2++]) return 1;
- len--;
- }
- return 0;
-}
-
-/* Entry points for GNU code. */
-
-/* re_compile_pattern is the GNU regular expression compiler: it
- compiles PATTERN (of length SIZE) and puts the result in BUFP.
- Returns 0 if the pattern was valid, otherwise an error string.
-
- Assumes the `allocated' (and perhaps `buffer') and `translate' fields
- are set in BUFP on entry.
-
- We call regex_compile to do the actual compilation. */
-
-const char *
-re_compile_pattern (pattern, length, bufp)
- const char *pattern;
- int length;
- struct re_pattern_buffer *bufp;
-{
- reg_errcode_t ret;
-
- /* GNU code is written to assume at least RE_NREGS registers will be set
- (and at least one extra will be -1). */
- bufp->regs_allocated = REGS_UNALLOCATED;
-
- /* And GNU code determines whether or not to get register information
- by passing null for the REGS argument to re_match, etc., not by
- setting no_sub. */
- bufp->no_sub = 0;
-
- /* Match anchors at newline. */
- bufp->newline_anchor = 1;
-
- ret = regex_compile (pattern, length, re_syntax_options, bufp);
-
- return re_error_msg[(int) ret];
-}
-
-/* Entry points compatible with 4.2 BSD regex library. We don't define
- them if this is an Emacs or POSIX compilation. */
-
-#if !defined (emacs) && !defined (_POSIX_SOURCE)
-
-/* BSD has one and only one pattern buffer. */
-static struct re_pattern_buffer re_comp_buf;
-
-char *
-re_comp (s)
- const char *s;
-{
- reg_errcode_t ret;
-
- if (!s)
- {
- if (!re_comp_buf.buffer)
- return "No previous regular expression";
- return 0;
- }
-
- if (!re_comp_buf.buffer)
- {
- re_comp_buf.buffer = (unsigned char *) malloc (200);
- if (re_comp_buf.buffer == NULL)
- return "Memory exhausted";
- re_comp_buf.allocated = 200;
-
- re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
- if (re_comp_buf.fastmap == NULL)
- return "Memory exhausted";
- }
-
- /* Since `re_exec' always passes NULL for the `regs' argument, we
- don't need to initialize the pattern buffer fields which affect it. */
-
- /* Match anchors at newlines. */
- re_comp_buf.newline_anchor = 1;
-
- ret = regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf);
-
- /* Yes, we're discarding `const' here. */
- return (char *) re_error_msg[(int) ret];
-}
-
-
-int
-re_exec (s)
- const char *s;
-{
- const int len = strlen (s);
- return
- 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0);
-}
-#endif /* not emacs and not _POSIX_SOURCE */
-
-/* POSIX.2 functions. Don't define these for Emacs. */
-
-#ifndef emacs
-
-/* regcomp takes a regular expression as a string and compiles it.
-
- PREG is a regex_t *. We do not expect any fields to be initialized,
- since POSIX says we shouldn't. Thus, we set
-
- `buffer' to the compiled pattern;
- `used' to the length of the compiled pattern;
- `syntax' to RE_SYNTAX_POSIX_EXTENDED if the
- REG_EXTENDED bit in CFLAGS is set; otherwise, to
- RE_SYNTAX_POSIX_BASIC;
- `newline_anchor' to REG_NEWLINE being set in CFLAGS;
- `fastmap' and `fastmap_accurate' to zero;
- `re_nsub' to the number of subexpressions in PATTERN.
-
- PATTERN is the address of the pattern string.
-
- CFLAGS is a series of bits which affect compilation.
-
- If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we
- use POSIX basic syntax.
-
- If REG_NEWLINE is set, then . and [^...] don't match newline.
- Also, regexec will try a match beginning after every newline.
-
- If REG_ICASE is set, then we considers upper- and lowercase
- versions of letters to be equivalent when matching.
-
- If REG_NOSUB is set, then when PREG is passed to regexec, that
- routine will report only success or failure, and nothing about the
- registers.
-
- It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for
- the return codes and their meanings.) */
-
-int
-regcomp (preg, pattern, cflags)
- regex_t *preg;
- const char *pattern;
- int cflags;
-{
- reg_errcode_t ret;
- unsigned syntax
- = (cflags & REG_EXTENDED) ?
- RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC;
-
- /* regex_compile will allocate the space for the compiled pattern. */
- preg->buffer = 0;
- preg->allocated = 0;
-
- /* Don't bother to use a fastmap when searching. This simplifies the
- REG_NEWLINE case: if we used a fastmap, we'd have to put all the
- characters after newlines into the fastmap. This way, we just try
- every character. */
- preg->fastmap = 0;
-
- if (cflags & REG_ICASE)
- {
- unsigned i;
-
- preg->translate = (char *) malloc (CHAR_SET_SIZE);
- if (preg->translate == NULL)
- return (int) REG_ESPACE;
-
- /* Map uppercase characters to corresponding lowercase ones. */
- for (i = 0; i < CHAR_SET_SIZE; i++)
- preg->translate[i] = ISUPPER (i) ? tolower (i) : i;
- }
- else
- preg->translate = NULL;
-
- /* If REG_NEWLINE is set, newlines are treated differently. */
- if (cflags & REG_NEWLINE)
- { /* REG_NEWLINE implies neither . nor [^...] match newline. */
- syntax &= ~RE_DOT_NEWLINE;
- syntax |= RE_HAT_LISTS_NOT_NEWLINE;
- /* It also changes the matching behavior. */
- preg->newline_anchor = 1;
- }
- else
- preg->newline_anchor = 0;
-
- preg->no_sub = !!(cflags & REG_NOSUB);
-
- /* POSIX says a null character in the pattern terminates it, so we
- can use strlen here in compiling the pattern. */
- ret = regex_compile (pattern, strlen (pattern), syntax, preg);
-
- /* POSIX doesn't distinguish between an unmatched open-group and an
- unmatched close-group: both are REG_EPAREN. */
- if (ret == REG_ERPAREN) ret = REG_EPAREN;
-
- return (int) ret;
-}
-
-
-/* regexec searches for a given pattern, specified by PREG, in the
- string STRING.
-
- If NMATCH is zero or REG_NOSUB was set in the cflags argument to
- `regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at
- least NMATCH elements, and we set them to the offsets of the
- corresponding matched substrings.
-
- EFLAGS specifies `execution flags' which affect matching: if
- REG_NOTBOL is set, then ^ does not match at the beginning of the
- string; if REG_NOTEOL is set, then $ does not match at the end.
-
- We return 0 if we find a match and REG_NOMATCH if not. */
-
-int
-regexec (preg, string, nmatch, pmatch, eflags)
- const regex_t *preg;
- const char *string;
- size_t nmatch;
- regmatch_t pmatch[];
- int eflags;
-{
- int ret;
- struct re_registers regs;
- regex_t private_preg;
- int len = strlen (string);
- boolean want_reg_info = !preg->no_sub && nmatch > 0;
-
- private_preg = *preg;
-
- private_preg.not_bol = !!(eflags & REG_NOTBOL);
- private_preg.not_eol = !!(eflags & REG_NOTEOL);
-
- /* The user has told us exactly how many registers to return
- information about, via `nmatch'. We have to pass that on to the
- matching routines. */
- private_preg.regs_allocated = REGS_FIXED;
-
- if (want_reg_info)
- {
- regs.num_regs = nmatch;
- regs.start = TALLOC (nmatch, regoff_t);
- regs.end = TALLOC (nmatch, regoff_t);
- if (regs.start == NULL || regs.end == NULL)
- return (int) REG_NOMATCH;
- }
-
- /* Perform the searching operation. */
- ret = re_search (&private_preg, string, len,
- /* start: */ 0, /* range: */ len,
- want_reg_info ? &regs : (struct re_registers *) 0);
-
- /* Copy the register information to the POSIX structure. */
- if (want_reg_info)
- {
- if (ret >= 0)
- {
- unsigned r;
-
- for (r = 0; r < nmatch; r++)
- {
- pmatch[r].rm_so = regs.start[r];
- pmatch[r].rm_eo = regs.end[r];
- }
- }
-
- /* If we needed the temporary register info, free the space now. */
- free (regs.start);
- free (regs.end);
- }
-
- /* We want zero return to mean success, unlike `re_search'. */
- return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH;
-}
-
-
-/* Returns a message corresponding to an error code, ERRCODE, returned
- from either regcomp or regexec. We don't use PREG here. */
-
-size_t
-regerror (errcode, preg, errbuf, errbuf_size)
- int errcode;
- const regex_t *preg;
- char *errbuf;
- size_t errbuf_size;
-{
- const char *msg;
- size_t msg_size;
-
- if (errcode < 0
- || errcode >= (sizeof (re_error_msg) / sizeof (re_error_msg[0])))
- /* Only error codes returned by the rest of the code should be passed
- to this routine. If we are given anything else, or if other regex
- code generates an invalid error code, then the program has a bug.
- Dump core so we can fix it. */
- abort ();
-
- msg_size = strlen (msg) + 1; /* Includes the null. */
-
- if (errbuf_size != 0)
- {
- if (msg_size > errbuf_size)
- {
- strncpy (errbuf, msg, errbuf_size - 1);
- errbuf[errbuf_size - 1] = 0;
- }
- else
- strcpy (errbuf, msg);
- }
-
- return msg_size;
-}
-
-
-/* Free dynamically allocated space used by PREG. */
-
-void
-regfree (preg)
- regex_t *preg;
-{
- if (preg->buffer != NULL)
- free (preg->buffer);
- preg->buffer = NULL;
-
- preg->allocated = 0;
- preg->used = 0;
-
- if (preg->fastmap != NULL)
- free (preg->fastmap);
- preg->fastmap = NULL;
- preg->fastmap_accurate = 0;
-
- if (preg->translate != NULL)
- free (preg->translate);
- preg->translate = NULL;
-}
-
-#endif /* not emacs */
-
-/*
-Local variables:
-make-backup-files: t
-version-control: t
-trim-versions-without-asking: nil
-End:
-*/
diff --git a/gnu/usr.bin/yppush/yp.h b/gnu/usr.bin/yppush/yp.h
deleted file mode 100644
index da300d4..0000000
--- a/gnu/usr.bin/yppush/yp.h
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * $Id$
- */
-
-#define YPMAXRECORD 1024
-#define YPMAXDOMAIN 64
-#define YPMAXMAP 64
-#define 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,
-};
-typedef enum ypstat ypstat;
-bool_t __xdr_ypstat();
-
-
-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 enum ypxfrstat ypxfrstat;
-bool_t __xdr_ypxfrstat();
-
-
-typedef char *domainname;
-bool_t xdr_domainname();
-
-
-typedef char *mapname;
-bool_t xdr_mapname();
-
-
-typedef char *peername;
-bool_t xdr_peername();
-
-
-typedef struct {
- u_int keydat_len;
- char *keydat_val;
-} keydat;
-bool_t xdr_keydat();
-
-
-typedef struct {
- u_int valdat_len;
- char *valdat_val;
-} valdat;
-bool_t xdr_valdat();
-
-
-struct ypmap_parms {
- domainname domain;
- mapname map;
- u_int ordernum;
- peername peer;
-};
-typedef struct ypmap_parms ypmap_parms;
-bool_t __xdr_ypmap_parms();
-
-
-struct ypreq_key {
- domainname domain;
- mapname map;
- keydat key;
-};
-typedef struct ypreq_key ypreq_key;
-bool_t __xdr_ypreq_key();
-
-
-struct ypreq_nokey {
- domainname domain;
- mapname map;
-};
-typedef struct ypreq_nokey ypreq_nokey;
-bool_t __xdr_ypreq_nokey();
-
-
-struct ypreq_xfr {
- ypmap_parms map_parms;
- u_int transid;
- u_int prog;
- u_int port;
-};
-typedef struct ypreq_xfr ypreq_xfr;
-bool_t __xdr_ypreq_xfr();
-
-
-struct ypresp_val {
- ypstat stat;
- valdat val;
-};
-typedef struct ypresp_val ypresp_val;
-bool_t __xdr_ypresp_val();
-
-
-struct ypresp_key_val {
- ypstat stat;
- keydat key;
- valdat val;
-};
-typedef struct ypresp_key_val ypresp_key_val;
-bool_t __xdr_ypresp_key_val();
-
-
-struct ypresp_master {
- ypstat stat;
- peername peer;
-};
-typedef struct ypresp_master ypresp_master;
-bool_t __xdr_ypresp_master();
-
-
-struct ypresp_order {
- ypstat stat;
- u_int ordernum;
-};
-typedef struct ypresp_order ypresp_order;
-bool_t __xdr_ypresp_order();
-
-
-struct ypresp_all {
- bool_t more;
- union {
- ypresp_key_val val;
- } ypresp_all_u;
-};
-typedef struct ypresp_all ypresp_all;
-bool_t __xdr_ypresp_all();
-
-
-struct ypresp_xfr {
- u_int transid;
- ypxfrstat xfrstat;
-};
-typedef struct ypresp_xfr ypresp_xfr;
-bool_t __xdr_ypresp_xfr();
-
-
-struct ypmaplist {
- mapname map;
- struct ypmaplist *next;
-};
-typedef struct ypmaplist ypmaplist;
-bool_t __xdr_ypmaplist();
-
-
-struct ypresp_maplist {
- ypstat stat;
- ypmaplist *maps;
-};
-typedef struct ypresp_maplist ypresp_maplist;
-bool_t __xdr_ypresp_maplist();
-
-
-enum yppush_status {
- YPPUSH_SUCC = 1,
- YPPUSH_AGE = 2,
- YPPUSH_NOMAP = -1,
- YPPUSH_NODOM = -2,
- YPPUSH_RSRC = -3,
- YPPUSH_RPC = -4,
- YPPUSH_MADDR = -5,
- YPPUSH_YPERR = -6,
- YPPUSH_BADARGS = -7,
- YPPUSH_DBM = -8,
- YPPUSH_FILE = -9,
- YPPUSH_SKEW = -10,
- YPPUSH_CLEAR = -11,
- YPPUSH_FORCE = -12,
- YPPUSH_XFRERR = -13,
- YPPUSH_REFUSED = -14,
-};
-typedef enum yppush_status yppush_status;
-bool_t __xdr_yppush_status();
-
-
-struct yppushresp_xfr {
- u_int transid;
- yppush_status status;
-};
-typedef struct yppushresp_xfr yppushresp_xfr;
-bool_t __xdr_yppushresp_xfr();
-
-
-enum ypbind_resptype {
- YPBIND_SUCC_VAL = 1,
- YPBIND_FAIL_VAL = 2,
-};
-typedef enum ypbind_resptype ypbind_resptype;
-bool_t __xdr_ypbind_resptype();
-
-
-struct ypbind_binding {
- char ypbind_binding_addr[4];
- char ypbind_binding_port[2];
-};
-typedef struct ypbind_binding ypbind_binding;
-bool_t __xdr_ypbind_binding();
-
-
-struct ypbind_resp {
- ypbind_resptype ypbind_status;
- union {
- u_int ypbind_error;
- ypbind_binding ypbind_bindinfo;
- } ypbind_resp_u;
-};
-typedef struct ypbind_resp ypbind_resp;
-bool_t __xdr_ypbind_resp();
-
-#define YPBIND_ERR_ERR 1
-#define YPBIND_ERR_NOSERV 2
-#define YPBIND_ERR_RESC 3
-
-struct ypbind_setdom {
- domainname ypsetdom_domain;
- ypbind_binding ypsetdom_binding;
- u_int ypsetdom_vers;
-};
-typedef struct ypbind_setdom ypbind_setdom;
-bool_t __xdr_ypbind_setdom();
-
-
-#define YPPROG ((u_long)100004)
-#define YPVERS ((u_long)2)
-#define YPPROC_NULL ((u_long)0)
-extern void *ypproc_null_2();
-#define YPPROC_DOMAIN ((u_long)1)
-extern bool_t *ypproc_domain_2();
-#define YPPROC_DOMAIN_NONACK ((u_long)2)
-extern bool_t *ypproc_domain_nonack_2();
-#define YPPROC_MATCH ((u_long)3)
-extern ypresp_val *ypproc_match_2();
-#define YPPROC_FIRST ((u_long)4)
-extern ypresp_key_val *ypproc_first_2();
-#define YPPROC_NEXT ((u_long)5)
-extern ypresp_key_val *ypproc_next_2();
-#define YPPROC_XFR ((u_long)6)
-extern ypresp_xfr *ypproc_xfr_2();
-#define YPPROC_CLEAR ((u_long)7)
-extern void *ypproc_clear_2();
-#define YPPROC_ALL ((u_long)8)
-extern ypresp_all *ypproc_all_2();
-#define YPPROC_MASTER ((u_long)9)
-extern ypresp_master *ypproc_master_2();
-#define YPPROC_ORDER ((u_long)10)
-extern ypresp_order *ypproc_order_2();
-#define YPPROC_MAPLIST ((u_long)11)
-extern ypresp_maplist *ypproc_maplist_2();
-
-
-#define YPPUSH_XFRRESPPROG ((u_long)0x40000000)
-#define YPPUSH_XFRRESPVERS ((u_long)1)
-#define YPPUSHPROC_NULL ((u_long)0)
-extern void *yppushproc_null_1();
-#define YPPUSHPROC_XFRRESP ((u_long)1)
-extern yppushresp_xfr *yppushproc_xfrresp_1();
-
-
-#define YPBINDPROG ((u_long)100007)
-#define YPBINDVERS ((u_long)2)
-#define YPBINDPROC_NULL ((u_long)0)
-extern void *ypbindproc_null_2();
-#define YPBINDPROC_DOMAIN ((u_long)1)
-extern ypbind_resp *ypbindproc_domain_2();
-#define YPBINDPROC_SETDOM ((u_long)2)
-extern void *ypbindproc_setdom_2();
-
diff --git a/gnu/usr.bin/yppush/yp_clnt.c b/gnu/usr.bin/yppush/yp_clnt.c
deleted file mode 100644
index 32d9007..0000000
--- a/gnu/usr.bin/yppush/yp_clnt.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- YPS-0.2, NIS-Server for Linux
- Copyright (C) 1994 Tobias Reber
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Modified for use with FreeBSD 2.x by Bill Paul (wpaul@ctr.columbia.edu)
-
- $Id$
-*/
-
-/*
- * $Author: root $
- * $Log: yp_clnt.c,v $
- * Revision 0.16 1994/01/02 22:48:22 root
- * Added strict prototypes
- *
- * Revision 0.15 1994/01/02 20:09:39 root
- * Added GPL notice
- *
- * Revision 0.14 1993/12/19 12:42:32 root
- * *** empty log message ***
- *
- * Revision 0.13 1993/06/12 09:39:30 root
- * Align with include-4.4
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <rpc/rpc.h>
-#include <sys/time.h>
-#include "yp.h"
-
-#ifdef DEBUG
-#define PRINTF(x) printf x
-#else
-#define PRINTF(x)
-#endif
-
-static struct timeval TIMEOUT = { 25, 0 };
-
-void *
-ypproc_null_2( int *argp, CLIENT *clnt)
-{
- static char res;
-
- bzero(&res, sizeof(res));
- if (clnt_call(clnt, YPPROC_NULL, xdr_void, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
- return (NULL);
- }
- return ((void *)&res);
-}
-
-
-bool_t *
-ypproc_domain_2( domainname *argp, CLIENT *clnt)
-{
- static bool_t res;
-
- bzero(&res, sizeof(res));
- if (clnt_call(clnt, YPPROC_DOMAIN, xdr_domainname, argp, xdr_bool, &res, TIMEOUT) != RPC_SUCCESS) {
- return (NULL);
- }
- return (&res);
-}
-
-
-bool_t *
-ypproc_domain_nonack_2( domainname *argp, CLIENT *clnt)
-{
- static bool_t res;
-
- bzero(&res, sizeof(res));
- if (clnt_call(clnt, YPPROC_DOMAIN_NONACK, xdr_domainname, argp, xdr_bool, &res, TIMEOUT) != RPC_SUCCESS) {
- return (NULL);
- }
- return (&res);
-}
-
-
-ypresp_val *
-ypproc_match_2( ypreq_key *argp, CLIENT *clnt)
-{
- static ypresp_val res;
-
- bzero(&res, sizeof(res));
- if (clnt_call(clnt, YPPROC_MATCH, __xdr_ypreq_key, argp, __xdr_ypresp_val, &res, TIMEOUT) != RPC_SUCCESS) {
- return (NULL);
- }
- return (&res);
-}
-
-
-ypresp_key_val *
-ypproc_first_2( ypreq_key *argp, CLIENT *clnt)
-{
- static ypresp_key_val res;
-
- bzero(&res, sizeof(res));
- if (clnt_call(clnt, YPPROC_FIRST, __xdr_ypreq_key, argp, __xdr_ypresp_key_val, &res, TIMEOUT) != RPC_SUCCESS) {
- return (NULL);
- }
- return (&res);
-}
-
-
-ypresp_key_val *
-ypproc_next_2( ypreq_key *argp, CLIENT *clnt)
-{
- static ypresp_key_val res;
-
- bzero(&res, sizeof(res));
- if (clnt_call(clnt, YPPROC_NEXT, __xdr_ypreq_key, argp, __xdr_ypresp_key_val, &res, TIMEOUT) != RPC_SUCCESS) {
- return (NULL);
- }
- return (&res);
-}
-
-
-ypresp_xfr *
-ypproc_xfr_2( ypreq_xfr *argp, CLIENT *clnt)
-{
- static ypresp_xfr res;
-
- bzero(&res, sizeof(res));
- if (clnt_call(clnt, YPPROC_XFR, __xdr_ypreq_xfr, argp, __xdr_ypresp_xfr, &res, TIMEOUT) != RPC_SUCCESS) {
- return (NULL);
- }
- return (&res);
-}
-
-
-void *
-ypproc_clear_2( int *argp, CLIENT *clnt)
-{
- static char res;
-
- bzero(&res, sizeof(res));
- if (clnt_call(clnt, YPPROC_CLEAR, xdr_void, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
- return (NULL);
- }
- return ((void *)&res);
-}
-
-
-ypresp_all *
-ypproc_all_2( ypreq_nokey *argp, CLIENT *clnt)
-{
- static ypresp_all res;
-
- bzero(&res, sizeof(res));
- if (clnt_call(clnt, YPPROC_ALL, __xdr_ypreq_nokey, argp, __xdr_ypresp_all, &res, TIMEOUT) != RPC_SUCCESS) {
- PRINTF(("ypproc_all_2 retuning NULL\n"));
- return (NULL);
- }
- PRINTF(("ypproc_all_2 retuning non-NULL\n"));
- return (&res);
-}
-
-
-ypresp_master *
-ypproc_master_2( ypreq_nokey *argp, CLIENT *clnt)
-{
- static ypresp_master res;
-
- bzero(&res, sizeof(res));
- if (clnt_call(clnt, YPPROC_MASTER, __xdr_ypreq_nokey, argp, __xdr_ypresp_master, &res, TIMEOUT) != RPC_SUCCESS) {
- return (NULL);
- }
- return (&res);
-}
-
-
-ypresp_order *
-ypproc_order_2( ypreq_nokey *argp, CLIENT *clnt)
-{
- static ypresp_order res;
- PRINTF (("ypproc_order_2()\n"));
-
- bzero(&res, sizeof(res));
- if (clnt_call(clnt, YPPROC_ORDER, __xdr_ypreq_nokey, argp, __xdr_ypresp_order, &res, TIMEOUT) != RPC_SUCCESS) {
- PRINTF (("ypproc_order_2()\n"));
- return (NULL);
- }
- PRINTF (("ypproc_order_2()\n"));
- return (&res);
-}
-
-
-ypresp_maplist *
-ypproc_maplist_2( domainname *argp, CLIENT *clnt)
-{
- static ypresp_maplist res;
-
- bzero(&res, sizeof(res));
- if (clnt_call(clnt, YPPROC_MAPLIST, xdr_domainname, argp, __xdr_ypresp_maplist, &res, TIMEOUT) != RPC_SUCCESS) {
- return (NULL);
- }
- return (&res);
-}
-
diff --git a/gnu/usr.bin/yppush/yp_xdr.c b/gnu/usr.bin/yppush/yp_xdr.c
deleted file mode 100644
index 5afc8d9c..0000000
--- a/gnu/usr.bin/yppush/yp_xdr.c
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- YPS-0.2, NIS-Server for Linux
- Copyright (C) 1994 Tobias Reber
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Modified for use with FreeBSD 2.x by Bill Paul (wpaul@ctr.columbia.edu)
-
- $Id$
-*/
-
-/*
- * $Author: root $
- * $Log: yp_xdr.c,v $
- * Revision 0.20 1994/01/02 22:48:22 root
- * Added strict prototypes
- *
- * Revision 0.19 1994/01/02 20:09:39 root
- * Added GPL notice
- *
- * Revision 0.18 1994/01/02 18:06:13 root
- * Fixed another bug in __xdr_ypresp_all
- *
- * Revision 0.17 1993/12/30 22:34:57 root
- * *** empty log message ***
- *
- * Revision 0.16 1993/12/29 00:37:37 root
- * Fixed a bug in __xdr_ypresp_key_val
- *
- * Revision 0.15 1993/06/16 22:54:12 dok235
- * Fix a bug in ypresp_key_val
- *
- * Revision 0.14 1993/06/12 09:39:30 root
- * Align with include-4.4
- *
- * Revision 0.13 1993/06/11 21:45:00 root
- * Regenned from yp.x, that came with include-4.4
- *
- */
-
-/*
- * Please do not edit this file.
- * It was generated using rpcgen.
- */
-
-#include <rpc/rpc.h>
-#include <rpcsvc/yp.h>
-
-#ifdef DEBUG
-#define PRINTF(x) printf x
-#define PRLINENO printf(__FILE__ "(%d): ", __LINE__)
-#else
-#define PRINTF(x)
-#define PRLINENO
-#endif
-
-struct {
- union {
- int (*encoder)(char *, int, char **, int *, char **, int *);
- int (*decoder)(int, char *, int, char *, int, char *);
- } foreach;
- char *data;
-} *__xdr_ypall_callback;
-
-bool_t
-__xdr_ypstat(XDR *xdrs, ypstat *objp)
-{
-
- if (!xdr_enum(xdrs, (enum_t *)objp)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_ypxfrstat(XDR *xdrs, ypxfrstat *objp)
-{
-
- if (!xdr_enum(xdrs, (enum_t *)objp)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_domainname(XDR *xdrs, domainname *objp)
-{
-
- if (!xdr_string(xdrs, objp, YPMAXDOMAIN)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_mapname(XDR *xdrs, mapname *objp)
-{
-
- if (!xdr_string(xdrs, objp, YPMAXMAP)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_peername(XDR *xdrs, peername *objp)
-{
-
- if (!xdr_string(xdrs, objp, YPMAXPEER)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-xdr_keydat(XDR *xdrs, keydat *objp)
-{
-
- if (!xdr_bytes(xdrs, (char **)&objp->keydat_val, (u_int *)&objp->keydat_len, YPMAXRECORD)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-xdr_valdat(XDR *xdrs, valdat *objp)
-{
-
- if (!xdr_bytes(xdrs, (char **)&objp->valdat_val, (u_int *)&objp->valdat_len, YPMAXRECORD)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_ypmap_parms(XDR *xdrs, ypmap_parms *objp)
-{
-
- if (!__xdr_domainname(xdrs, &objp->domain)) {
- return (FALSE);
- }
- if (!__xdr_mapname(xdrs, &objp->map)) {
- return (FALSE);
- }
- if (!xdr_u_int(xdrs, &objp->ordernum)) {
- return (FALSE);
- }
- if (!__xdr_peername(xdrs, &objp->peer)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_ypreq_key(XDR *xdrs, ypreq_key *objp)
-{
-
- if (!__xdr_domainname(xdrs, &objp->domain)) {
- return (FALSE);
- }
- if (!__xdr_mapname(xdrs, &objp->map)) {
- return (FALSE);
- }
- if (!xdr_keydat(xdrs, &objp->key)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_ypreq_nokey(XDR *xdrs, ypreq_nokey *objp)
-{
-
- if (!__xdr_domainname(xdrs, &objp->domain)) {
- return (FALSE);
- }
- if (!__xdr_mapname(xdrs, &objp->map)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_ypreq_xfr(XDR *xdrs, ypreq_xfr *objp)
-{
-
- if (!__xdr_ypmap_parms(xdrs, &objp->map_parms)) {
- return (FALSE);
- }
- if (!xdr_u_int(xdrs, &objp->transid)) {
- return (FALSE);
- }
- if (!xdr_u_int(xdrs, &objp->prog)) {
- return (FALSE);
- }
- if (!xdr_u_int(xdrs, &objp->port)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_ypresp_val(XDR *xdrs, ypresp_val *objp)
-{
-
- if (!__xdr_ypstat(xdrs, &objp->stat)) {
- return (FALSE);
- }
- if (!xdr_valdat(xdrs, &objp->val)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_ypresp_key_val(XDR *xdrs, ypresp_key_val *objp)
-{
-
- if (!__xdr_ypstat(xdrs, &objp->stat)) {
- return (FALSE);
- }
- if (!xdr_valdat(xdrs, &objp->val)) {
- return (FALSE);
- }
- if (!xdr_keydat(xdrs, &objp->key)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_ypresp_master(XDR *xdrs, ypresp_master *objp)
-{
-
- if (!__xdr_ypstat(xdrs, &objp->stat)) {
- return (FALSE);
- }
- if (!__xdr_peername(xdrs, &objp->peer)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_ypresp_order(XDR *xdrs, ypresp_order *objp)
-{
-
- if (!__xdr_ypstat(xdrs, &objp->stat)) {
- return (FALSE);
- }
- if (!xdr_u_int(xdrs, &objp->ordernum)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_ypresp_all(XDR *xdrs, ypresp_all *objp)
-{
- int CallAgain = 0;
- PRLINENO;
- if (xdrs->x_op == XDR_DECODE) {
- while(1) {
-#if 1
- int s=objp->ypresp_all_u.val.stat;
- bzero((char *)objp, sizeof (*objp));
- objp->ypresp_all_u.val.stat=s;
-#endif
- if (!xdr_bool(xdrs, &objp->more)) {
- return (FALSE);
- }
- switch (objp->more) {
- case TRUE:
- if (!__xdr_ypresp_key_val(xdrs, &objp->ypresp_all_u.val)) {
- return (FALSE);
- }
- if (CallAgain==0) {
- CallAgain=(*(__xdr_ypall_callback->foreach.decoder))(
- objp->ypresp_all_u.val.stat,
- objp->ypresp_all_u.val.key.keydat_val,
- objp->ypresp_all_u.val.key.keydat_len,
- objp->ypresp_all_u.val.val.valdat_val,
- objp->ypresp_all_u.val.val.valdat_len,
- __xdr_ypall_callback->data);
- }
- break;
- case FALSE:
- return TRUE;
- }
-#if 0
- xdrs->x_op=XDR_FREE;
- if (!__xdr_ypresp_all(xdrs, objp)) {
- return FALSE;
- }
- xdrs->x_op=XDR_DECODE;
-#else
- xdr_free(__xdr_ypresp_all, (char *)objp);
-#endif
- }
- } else if (xdrs->x_op == XDR_ENCODE) {
- while(1) {
- if (!xdr_bool(xdrs, &(objp->more))) {
- return (FALSE);
- }
- if (!__xdr_ypresp_key_val(xdrs, &objp->ypresp_all_u.val)) {
- printf("__xdr_ypresp_key_val failed\n");
- return (FALSE);
- }
- if (objp->ypresp_all_u.val.stat!=YP_TRUE) {
- objp->more=FALSE;
- if (!xdr_bool(xdrs, &(objp->more))) {
- return (FALSE);
- }
- return(TRUE);
- }
- objp->ypresp_all_u.val.stat =
- (enum ypstat)(*(__xdr_ypall_callback->foreach.encoder))(
- objp->ypresp_all_u.val.key.keydat_val,
- objp->ypresp_all_u.val.key.keydat_len,
- &(objp->ypresp_all_u.val.key.keydat_val),
- &(objp->ypresp_all_u.val.key.keydat_len),
- &(objp->ypresp_all_u.val.val.valdat_val),
- &(objp->ypresp_all_u.val.val.valdat_len));
- }
- } else {
-#if 0
- bool_t more=objp->more;
- if (more==TRUE) {
- if (!xdr_bool(xdrs, &objp->more)) {
- return FALSE;
- }
- if (!__xdr_ypresp_key_val(xdrs, &objp->ypresp_all_u.val)) {
- return (FALSE);
- }
- }
-#endif
-
- return(TRUE);
- }
-}
-
-bool_t
-__xdr_ypresp_xfr(XDR *xdrs, ypresp_xfr *objp)
-{
-
- if (!xdr_u_int(xdrs, &objp->transid)) {
- return (FALSE);
- }
- if (!__xdr_ypxfrstat(xdrs, &objp->xfrstat)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_ypmaplist(XDR *xdrs, ypmaplist *objp)
-{
-
- if (!__xdr_mapname(xdrs, &objp->map)) {
- return (FALSE);
- }
- if (!xdr_pointer(xdrs, (char **)&objp->next, sizeof(ypmaplist), (xdrproc_t)__xdr_ypmaplist)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_ypresp_maplist(XDR *xdrs, ypresp_maplist *objp)
-{
-
- if (!__xdr_ypstat(xdrs, &objp->stat)) {
- return (FALSE);
- }
- if (!xdr_pointer(xdrs, (char **)&objp->maps, sizeof(ypmaplist), (xdrproc_t)__xdr_ypmaplist)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_yppush_status(XDR *xdrs, yppush_status *objp)
-{
-
- if (!xdr_enum(xdrs, (enum_t *)objp)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_yppushresp_xfr(XDR *xdrs, yppushresp_xfr *objp)
-{
-
- if (!xdr_u_int(xdrs, &objp->transid)) {
- return (FALSE);
- }
- if (!__xdr_yppush_status(xdrs, &objp->status)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_ypbind_resptype(XDR *xdrs, ypbind_resptype *objp)
-{
-
- if (!xdr_enum(xdrs, (enum_t *)objp)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_ypbind_binding(XDR *xdrs, ypbind_binding *objp)
-{
-
- if (!xdr_opaque(xdrs, objp->ypbind_binding_addr, 4)) {
- return (FALSE);
- }
- if (!xdr_opaque(xdrs, objp->ypbind_binding_port, 2)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_ypbind_resp(XDR *xdrs, ypbind_resp *objp)
-{
-
- if (!__xdr_ypbind_resptype(xdrs, &objp->ypbind_status)) {
- return (FALSE);
- }
- switch (objp->ypbind_status) {
- case YPBIND_FAIL_VAL:
- if (!xdr_u_int(xdrs, &objp->ypbind_resp_u.ypbind_error)) {
- return (FALSE);
- }
- break;
- case YPBIND_SUCC_VAL:
- if (!__xdr_ypbind_binding(xdrs, &objp->ypbind_resp_u.ypbind_bindinfo)) {
- return (FALSE);
- }
- break;
- default:
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-__xdr_ypbind_setdom(XDR *xdrs, ypbind_setdom *objp)
-{
-
- if (!__xdr_domainname(xdrs, &objp->ypsetdom_domain)) {
- return (FALSE);
- }
- if (!__xdr_ypbind_binding(xdrs, &objp->ypsetdom_binding)) {
- return (FALSE);
- }
- if (!xdr_u_int(xdrs, &objp->ypsetdom_vers)) {
- return (FALSE);
- }
- return (TRUE);
-}
diff --git a/gnu/usr.bin/yppush/ypclnt.c b/gnu/usr.bin/yppush/ypclnt.c
deleted file mode 100644
index 0088754..0000000
--- a/gnu/usr.bin/yppush/ypclnt.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- YPS-0.2, NIS-Server for Linux
- Copyright (C) 1994 Tobias Reber
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Modified for use with FreeBSd 2.x by Bill Paul (wpaul@ctr.columbia.edu)
-
- $Id$
-*/
-
-/*
- * $Author: root $
- * $Log: ypclnt.c,v $
- * Revision 2.0 1994/01/06 16:58:48 root
- * Version 2.0
- *
- * Revision 0.17 1994/01/02 22:48:22 root
- * Added strict prototypes
- *
- * Revision 0.16 1994/01/02 20:09:39 root
- * Added GPL notice
- *
- * Revision 0.15 1993/12/30 22:34:57 root
- * *** empty log message ***
- *
- * Revision 0.14 1993/12/19 12:42:32 root
- * *** empty log message ***
- *
- * Revision 0.13 1993/06/12 09:39:30 root
- * Align with include-4.4
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <rpc/rpc.h>
-#include <rpc/pmap_clnt.h>
-#include <rpcsvc/yp.h>
-/*
- * ypclnt.h does not have a definition for struct dom_binding,
- * although it is used there. It is defined in yp_prot.h, but
- * we cannot use it here.
- */
-struct dom_binding {
- void * m;
-};
-#include <rpcsvc/ypclnt.h>
-
-#if 0
-#define SOCKSERVER 0x7f000001
-#endif
-
-static struct sockaddr_in ServerAddress;
-static CLIENT *UdpClient=NULL, *TcpClient=NULL;
-
-void
-_yp_unbind(char *DomainName)
-{
- if (UdpClient) clnt_destroy(UdpClient);
- UdpClient=NULL;
- if (TcpClient) clnt_destroy(TcpClient);
- TcpClient=NULL;
-}
-
-int
-_yp_bind(struct sockaddr_in *ServerAddress, char *DomainName)
-{
- struct sockaddr_in UdpServerAddress, TcpServerAddress;
- int UdpSockp, TcpSockp;
- static struct timeval Wait = { 5, 0 };
-
- if (UdpClient || TcpClient) yp_unbind(DomainName);
-
- bcopy(ServerAddress, &UdpServerAddress, sizeof(*ServerAddress));
- UdpServerAddress.sin_port=0;
- UdpSockp=(RPC_ANYSOCK);
- bcopy(ServerAddress, &TcpServerAddress, sizeof(*ServerAddress));
- TcpServerAddress.sin_port=0;
- TcpSockp=(RPC_ANYSOCK);
- if ((UdpClient=clntudp_create(&UdpServerAddress, YPPROG, YPVERS,
- Wait, &UdpSockp))==NULL) {
- clnt_pcreateerror("UdpClient");
- return(YPERR_RPC);
- }
- if ((TcpClient=clnttcp_create(&TcpServerAddress, YPPROG, YPVERS,
- &TcpSockp, 0, 0))==NULL) {
- clnt_pcreateerror("TcpClient");
- return(YPERR_RPC);
- }
- return(0);
-
-}
-
-
-int
-_yp_clear(char *DomainName)
-{
- void *resp;
- int Status;
-
- do {
- if (UdpClient==NULL)
- if ((Status=yp_bind(DomainName))) return(Status);
- if ((resp=ypproc_clear_2(NULL, UdpClient))==NULL) {
- clnt_perror(UdpClient, "_yp_clear");
- _yp_unbind(DomainName);
- }
- } while(resp==NULL);
- return 0;
-}
diff --git a/gnu/usr.bin/yppush/yppush_s.c b/gnu/usr.bin/yppush/yppush_s.c
deleted file mode 100644
index 89cc8e8..0000000
--- a/gnu/usr.bin/yppush/yppush_s.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- YPS-0.2, NIS-Server for Linux
- Copyright (C) 1994 Tobias Reber
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Modified for use with FreeBSD 2.x by Bill Paul (wpaul@ctr.columbia.edu)
-
- $Id$
-*/
-/*
- * $Author: root $
- * $Log: yppush_s.c,v $
- * Revision 1.3 1994/01/02 21:59:08 root
- * Strict prototypes
- *
- * Revision 1.2 1994/01/02 20:10:08 root
- * Added GPL notice
- *
- * Revision 1.1 1994/01/02 18:04:08 root
- * Initial revision
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <rpc/rpc.h>
-
-enum yppush_status {
- YPPUSH_SUCC = 1,
- YPPUSH_AGE = 2,
- YPPUSH_NOMAP = -1,
- YPPUSH_NODOM = -2,
- YPPUSH_RSRC = -3,
- YPPUSH_RPC = -4,
- YPPUSH_MADDR = -5,
- YPPUSH_YPERR = -6,
- YPPUSH_BADARGS = -7,
- YPPUSH_DBM = -8,
- YPPUSH_FILE = -9,
- YPPUSH_SKEW = -10,
- YPPUSH_CLEAR = -11,
- YPPUSH_FORCE = -12,
- YPPUSH_XFRERR = -13,
- YPPUSH_REFUSED = -14,
-};
-typedef enum yppush_status yppush_status;
-bool_t __xdr_yppush_status(XDR *, void *);
-
-static inline char *
-yppush_err_string(enum yppush_status y) {
- switch(y) {
- case YPPUSH_SUCC: return "Success";
- case YPPUSH_AGE: return "Master's version not newer";
- case YPPUSH_NOMAP: return "Can't find server for map";
- case YPPUSH_NODOM: return "Domain not supported";
- case YPPUSH_RSRC: return "Local resource alloc failure";
- case YPPUSH_RPC: return "RPC failure talking to server";
- case YPPUSH_MADDR: return "Can't get master address";
- case YPPUSH_YPERR: return "YP server/map db error";
- case YPPUSH_BADARGS: return "Request arguments bad";
- case YPPUSH_DBM: return "Local dbm operation failed";
- case YPPUSH_FILE: return "Local file I/O operation failed";
- case YPPUSH_SKEW: return "Map version skew during transfer";
- case YPPUSH_CLEAR: return "Can't send \"Clear\" req to local ypserv";
- case YPPUSH_FORCE: return "No local order number in map use -f flag.";
- case YPPUSH_XFRERR: return "ypxfr error";
- case YPPUSH_REFUSED: return "Transfer request refused by ypserv";
- }
-}
-
-struct yppushresp_xfr {
- u_int transid;
- yppush_status status;
-};
-typedef struct yppushresp_xfr yppushresp_xfr;
-bool_t __xdr_yppushresp_xfr(XDR *, void *);
-
-
-#define YPPUSH_XFRRESPPROG ((u_long)0x40000000)
-#define YPPUSH_XFRRESPVERS ((u_long)1)
-
-#define YPPUSHPROC_NULL ((u_long)0)
-static inline void *
-yppushproc_null_1(void * req, struct svc_req * rqstp) {
- static int resp;
- return &resp;
-}
-
-#define YPPUSHPROC_XFRRESP ((u_long)1)
-static inline void *
-yppushproc_xfrresp_1(yppushresp_xfr *req, struct svc_req * rqstp) {
- static int resp;
-
- if (req->status!=YPPUSH_SUCC)
- fprintf(stderr, "YPPUSH: %s\n", yppush_err_string(req->status));
- return &resp;
-}
-
-void
-yppush_xfrrespprog_1( struct svc_req *rqstp, SVCXPRT *transp)
-{
- union {
- int fill;
- } argument;
- char *result;
- bool_t (*xdr_argument)(XDR *, void *), (*xdr_result)(XDR *, void *);
- char *(*local)( void *, struct svc_req *);
-
- switch (rqstp->rq_proc) {
- case YPPUSHPROC_NULL:
- xdr_argument = (bool_t (*)(XDR *, void *))xdr_void;
- xdr_result = (bool_t (*)(XDR *, void *))xdr_void;
- local = (char *(*)( void *, struct svc_req *)) yppushproc_null_1;
- break;
-
- case YPPUSHPROC_XFRRESP:
- xdr_argument = __xdr_yppushresp_xfr;
- xdr_result = (bool_t (*)(XDR *, void *))xdr_void;
- local = (char *(*)( void *, struct svc_req *)) yppushproc_xfrresp_1;
- break;
-
- default:
- svcerr_noproc(transp);
- exit(1);
- }
- bzero((char *)&argument, sizeof(argument));
- if (!svc_getargs(transp, xdr_argument, &argument)) {
- svcerr_decode(transp);
- exit(1);
- }
- result = (*local)(&argument, rqstp);
- if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
- svcerr_systemerr(transp);
- }
- if (!svc_freeargs(transp, xdr_argument, &argument)) {
- (void)fprintf(stderr, "unable to free arguments\n");
- exit(1);
- if (rqstp->rq_proc!=YPPUSHPROC_NULL)
- exit(0);
- }
- exit(0);
-}
diff --git a/gnu/usr.sbin/yppasswdd/yppasswd_xdr.c b/gnu/usr.sbin/yppasswdd/yppasswd_xdr.c
deleted file mode 100644
index 30b55c2..0000000
--- a/gnu/usr.sbin/yppasswdd/yppasswd_xdr.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * yppasswdd
- * Copyright 1994 Olaf Kirch, <okir@monad.swb.de>
- *
- * This program is covered by the GNU General Public License, version 2.
- * It is provided in the hope that it is useful. However, the author
- * disclaims ALL WARRANTIES, expressed or implied. See the GPL for details.
- *
- * This file was generated automatically by rpcgen from yppasswd.x, and
- * editied manually.
- */
-
-#include <rpc/rpc.h>
-#include "yppasswd.h"
-
-
-bool_t
-xdr_xpasswd(XDR *xdrs, xpasswd *objp)
-{
- if (!xdr_string(xdrs, &objp->pw_name, ~0)) {
- return (FALSE);
- }
- if (!xdr_string(xdrs, &objp->pw_passwd, ~0)) {
- return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->pw_uid)) {
- return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->pw_gid)) {
- return (FALSE);
- }
- if (!xdr_string(xdrs, &objp->pw_gecos, ~0)) {
- return (FALSE);
- }
- if (!xdr_string(xdrs, &objp->pw_dir, ~0)) {
- return (FALSE);
- }
- if (!xdr_string(xdrs, &objp->pw_shell, ~0)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-
-bool_t
-xdr_yppasswd(XDR *xdrs, yppasswd *objp)
-{
- if (!xdr_string(xdrs, &objp->oldpass, ~0)) {
- return (FALSE);
- }
- if (!xdr_xpasswd(xdrs, &objp->newpw)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-
diff --git a/gnu/usr.sbin/ypserv/Makefile b/gnu/usr.sbin/ypserv/Makefile
deleted file mode 100644
index edc8ac0..0000000
--- a/gnu/usr.sbin/ypserv/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# $Id: Makefile,v 1.7 1995/07/12 16:28:10 wpaul Exp $
-# From: @(#)Makefile 8.3 (Berkeley) 4/2/94
-
-PROG= ypserv
-SRCS= dnslookup.c svc_run.c yp_svc.c yp_xdr.c server.c
-
-CFLAGS+=-Wall -DTCP_WRAPPER=0 -DTCPW_FACILITY=LOG_AUTH
-CFLAGS+=-DMAX_CHILDREN=20 -DINSTDIR='"/usr/libexec"'
-
-MAN8= ypserv.8
-
-afterinstall:
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \
- ${.CURDIR}/Makefile.yp \
- ${DESTDIR}/var/yp/Makefile
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
- ${.CURDIR}/mknetid \
- ${DESTDIR}/usr/libexec/mknetid
-
-.include <bsd.prog.mk>
diff --git a/gnu/usr.sbin/ypserv/Makefile.yp b/gnu/usr.sbin/ypserv/Makefile.yp
deleted file mode 100644
index b697070..0000000
--- a/gnu/usr.sbin/ypserv/Makefile.yp
+++ /dev/null
@@ -1,394 +0,0 @@
-#
-# Makefile for the NIS databases
-#
-# $Id: Makefile.yp,v 1.12 1995/10/26 18:00:35 wpaul Exp $
-#
-# This Makefile should only be run on the NIS master server of a domain.
-# All updated maps will be pushed to all NIS slave servers listed in the
-# /var/yp/ypservers file. Please make sure that the hostnames of all
-# NIS servers in your domain are listed in /var/yp/ypservers.
-#
-# This Makefile can be modified to support more NIS maps if desired.
-#
-
-# If this machine is an NIS master, comment out this next line so
-# that changes to the NIS maps can be propagated to the slave servers.
-# (By default we assume that we are only serving a small domain with
-# only one server.)
-#
-NOPUSH = "True"
-
-# If you want to use a FreeBSD NIS server to serve non-FreeBSD clients
-# (i.e. clients who expect the password field in the passwd maps to be
-# valid) then uncomment this line. This will cause $YPDIR/passwd to
-# be generated with valid password fields. This is insecure: FreeBSD
-# normally only serves the master.passwd maps (which have real encrypted
-# passwords in them) to the superuser on other FreeBSD machines, but
-# non-FreeBSD clients (e.g. SunOS, Solaris (without NIS+), IRIX, HP-UX,
-# etc...) will only work properly in 'unsecure' mode.
-#
-#UNSECURE = "True"
-
-# These are commands which this Makefile needs to properly rebuild the
-# NIS databases. Don't change these unless you have a good reason. Also
-# be sure not to place an @ in front of /usr/bin/awk: it isn't necessary
-# and it'll break everything in sight.
-#
-AWK = /usr/bin/awk
-RM = @/bin/rm -f
-RCAT = /bin/cat
-CAT = @$(RCAT)
-
-DBLOAD = /usr/sbin/yp_mkdb -m `hostname`
-MKNETID = /usr/libexec/mknetid
-YPPUSH = /usr/bin/yppush
-DOMAIN = `/bin/domainname`
-REVNETGROUP = /usr/libexec/revnetgroup
-
-YPSRCDIR = /etc
-YPDIR = /var/yp
-YPMAPDIR = $(YPDIR)/$(DOMAIN)
-
-# These are the files from which the NIS databases are built. You may edit
-# these to taste in the event that you wish to keep your NIS source files
-# seperate from your NIS server's actual configuration files. Note that the
-# NIS passwd and master.passwd files are stored in /var/yp: the server's
-# real password database is not used by default. However, you may use
-# the real /etc/passwd and /etc/master.passwd files by:
-#
-#
-# - invoking yppasswdd without the -m option (yppasswdd will use
-# /etc/master.passwd if no alternate master.passwd file is specified
-# and do a 'pwd_mkdb' as needed).
-# - Specifying the location of the master.passwd file using the
-# MASTER_PASSWD variable, i.e.:
-#
-# # make MASTER_PASSWD=/path/to/some/other/master.passwd
-#
-# - (optionally): editing this Makefile to change the default location.
-#
-# To add a user, edit $(YPDIR)/master.passwd and type 'make'. The raw
-# passwd file will be generated from the master.passwd file automagically.
-#
-ETHERS = $(YPSRCDIR)/ethers # ethernet addresses (for rarpd)
-BOOTPARAMS= $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd)
-HOSTS = $(YPSRCDIR)/hosts
-NETWORKS = $(YPSRCDIR)/networks
-PROTOCOLS = $(YPSRCDIR)/protocols
-RPC = $(YPSRCDIR)/rpc
-SERVICES = $(YPSRCDIR)/services
-GROUP = $(YPSRCDIR)/group
-NETGROUP = $(YPSRCDIR)/netgroup
-PASSWD = $(YPDIR)/passwd
-.if !defined(MASTER_PASSWD)
-MASTER = $(YPDIR)/master.passwd
-.else
-MASTER = $(MASTER_PASSWD)
-.endif
-YPSERVERS = $(YPDIR)/ypservers # List of all NIS servers for a domain
-PUBLICKEY = $(YPSRCDIR)/publickey
-
-target:
- @if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \
- cd $(DOMAIN) ; echo "NIS Map update started on `date`" ; \
- make -f ../Makefile all; echo "NIS Map update completed."
-
-# If you don't want some of these maps built, feel free to comment
-# them out from this list.
-# Note that we don't build the ethers or boorparams maps by default
-# since /etc/ethers and /etc/bootparams are not likely to be present
-# on all systems.
-#
-
-all: master.passwd passwd hosts group networks protocols \
- rpc services servers netid # publickey netgroup ethers bootparam
-
-ethers: ethers.byname ethers.byaddr
-bootparam: bootparams
-hosts: hosts.byname hosts.byaddr
-networks: networks.byaddr networks.byname
-protocols: protocols.bynumber protocols.byname
-rpc: rpc.byname rpc.bynumber
-services: services.byname
-passwd: passwd.byname passwd.byuid
-group: group.byname group.bygid
-netgrp: netgroup
-netid: netid.byname
-servers: ypservers
-publickey: publickey.byname
-
-master.passwd: master.passwd.byname master.passwd.byuid
-
-
-ypservers: $(YPSERVERS)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(YPSERVERS) | \
- $(AWK) '{ if ($$1 != "" && $$1 != "#") print $$0"\t"$$0 }' $^ \
- | $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-ethers.byname: $(ETHERS)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(ETHERS) | \
- $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
- print $$2"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \
- -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) -i $(ETHERS) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-
-ethers.byaddr: $(ETHERS)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(ETHERS) | \
- $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
- print $$1"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \
- -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-
-bootparams: $(BOOTPARAMS)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(BOOTPARAMS) | \
- $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
- print $$0 }' $^ | $(DBLOAD) -i $(BOOTPARAMS) \
- -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-
-netgroup: $(NETGROUP) netgroup.byhost netgroup.byuser
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(NETGROUP) | \
- $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
- print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \
- -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
- @$(MAKE) -f ../Makefile netid
-
-
-netgroup.byhost: $(NETGROUP)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(NETGROUP) | $(REVNETGROUP) -h -f $(NETGROUP) | \
- $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
- print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \
- -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-
-netgroup.byuser: $(NETGROUP)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(NETGROUP) | $(REVNETGROUP) -u -f $(NETGROUP) | \
- $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
- print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \
- -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-
-hosts.byname: $(HOSTS)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(HOSTS) | \
- $(AWK) '/^[0-9]/ { for (n=2; n<=NF && $$n !~ "#"; n++) \
- print $$n"\t"$$0 }' $^ | $(DBLOAD) -i $(HOSTS) \
- -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
- @$(MAKE) -f ../Makefile netid
-
-hosts.byaddr: $(HOSTS)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(HOSTS) | \
- $(AWK) '$$1 !~ "#" { print $$1"\t"$$0 }' $^ \
- | $(DBLOAD) -i $(HOSTS) -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
- @$(MAKE) -f ../Makefile netid
-
-
-networks.byname: $(NETWORKS)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(NETWORKS) | \
- $(AWK) \
- '$$1 !~ "#" { print $$1"\t"$$0; \
- for (n=3; n<=NF && $$n !~ "#"; n++) \
- print $$n"\t"$$0 \
- }' $^ | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-
-networks.byaddr: $(NETWORKS)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(NETWORKS) | \
- $(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \
- | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-
-protocols.byname: $(PROTOCOLS)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(PROTOCOLS) | \
- $(AWK) \
- '$$1 !~ "#" { print $$1"\t"$$0; \
- for (n=3; n<=NF && $$n !~ "#"; n++) \
- print $$n"\t"$$0 \
- }' $^ | $(DBLOAD) -i $(PROTOCOLS) \
- -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-
-protocols.bynumber: $(PROTOCOLS)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(PROTOCOLS) | \
- $(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \
- | $(DBLOAD) -i $(PROTOCOLS) -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-
-rpc.byname: $(RPC)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(RPC) | \
- $(AWK) \
- '$$1 !~ "#" { print $$1"\t"$$0; \
- for (n=3; n<=NF && $$n !~ "#"; n++) \
- print $$n"\t"$$0 \
- }' $^ | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-
-rpc.bynumber: $(RPC)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(RPC) | \
- $(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \
- | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-
-services.byname: $(SERVICES)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(SERVICES) | \
- $(AWK) \
- '$$1 !~ "#" { if (index($$2,"udp")) { printf("%s/udp",$$1) } \
- else { printf("%s/tcp",$$1) }; print "\t"$$0 \
- }' $^ | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-
-publickey.byname: $(PUBLICKEY)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(PUBLICKEY) | \
- $(AWK) '$$1 !~ "#" { print $$1"\t"$$2 }' $^ \
- | $(DBLOAD) -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-
-$(PASSWD): $(MASTER)
- @echo "Creating new $@ file from $(MASTER)..."
- $(RM) $@
- @if [ ! $(UNSECURE) ]; then \
- $(RCAT) $(MASTER) | \
- $(AWK) -F: '{if ($$1 != "+") \
- print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \
- > $(PASSWD) ; \
- else $(RCAT) $(MASTER) | \
- $(AWK) -F: '{if ($$1 != "+") \
- print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \
- > $(PASSWD) ; fi
-
-
-passwd.byname: $(PASSWD)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(PASSWD) | \
- $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
- | $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-passwd.byuid: $(PASSWD)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(PASSWD) | \
- $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
- | $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
- @$(MAKE) -f ../Makefile netid
-
-
-group.byname: $(GROUP)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(GROUP) | \
- $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
- | $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-
-group.bygid: $(GROUP)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(GROUP) | \
- $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
- | $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
- @$(MAKE) -f ../Makefile netid
-
-
-netid.byname: $(GROUP) $(PASSWD)
- @echo "Updating $@..."
- $(RM) $@
- @$(MKNETID) $(PASSWD) $(GROUP) `basename \`pwd\`` \
- | $(DBLOAD) -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-
-master.passwd.byname: $(MASTER)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(MASTER) | \
- $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
- | $(DBLOAD) -i $(MASTER) -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
-
-
-master.passwd.byuid: $(MASTER)
- @echo "Updating $@..."
- $(RM) $@
- $(CAT) $(MASTER) | \
- $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
- | $(DBLOAD) -i $(MASTER) -o $(YPMAPDIR)/$@ - $@
- @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
- @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
diff --git a/gnu/usr.sbin/ypserv/dnslookup.c b/gnu/usr.sbin/ypserv/dnslookup.c
deleted file mode 100644
index 9d10ecf..0000000
--- a/gnu/usr.sbin/ypserv/dnslookup.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 1995 Bill Paul (wpaul@ctr.columbia.edu)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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 Bill Paul.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Id: dnslookup.c,v 1.1 1995/01/31 08:58:52 wpaul Exp $
- */
-
-/*
-** Do standard and reverse DNS lookups using the resolver library.
-** Take care of all the dirty work here so the main program only has to
-** pass us a pointer to an array of characters.
-**
-** We have to use direct resolver calls here otherwise the YP server
-** could end up looping by calling itself over and over again until
-** it disappeared up its own belly button.
-*/
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-
-extern struct hostent *_gethostbydnsname();
-extern struct hostent *_gethostbydnsaddr();
-
-char *parse(hp)
-struct hostent *hp;
-{
-char *result;
-int len,i;
-struct in_addr addr;
-
- len = 16 + strlen(hp->h_name);
- for (i = 0; hp->h_aliases[i]; i++)
- len += strlen(hp->h_aliases[i]) + 1;
-
- result = (char *)malloc(len + 1);
- bzero(result, len+1);
-
- bcopy(hp->h_addr, &addr, sizeof(struct in_addr));
- strcat(result, (char *)inet_ntoa(addr));
- strcat(result, " ");
- strcat(result, hp->h_name);
-
- for (i = 0; hp->h_aliases[i]; i++)
- {
- strcat(result, " ");
- strcat(result, hp->h_aliases[i]);
- }
-
- return (result);
-}
-
-char *dnsname(address)
-char *address;
-{
-struct hostent *hp;
-
- if (strchr(address, '@'))
- return (NULL);
- if ((hp = (struct hostent *)_gethostbydnsname(address)) == NULL)
- return (NULL);
-
- return(parse(hp));
-}
-
-char *dnsaddr(address)
-char *address;
-{
-struct hostent *hp;
-struct in_addr addr;
-
- if (strchr(address, '@'))
- return (NULL);
- if (!inet_aton(address, &addr))
- return (NULL);
- if ((hp = (struct hostent *)_gethostbydnsaddr(&addr,
- sizeof(unsigned long), AF_INET)) == NULL)
- return (NULL);
-
- return(parse(hp));
-}
diff --git a/gnu/usr.sbin/ypserv/mknetid b/gnu/usr.sbin/ypserv/mknetid
deleted file mode 100644
index 6619b5d..0000000
--- a/gnu/usr.sbin/ypserv/mknetid
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-#
-# Produce netid.byname map file
-#
-# Written by O.Kirch, 1994.
-#
-PASSWD=$1
-GROUP=$2
-DOMAIN=$3
-
-tempsed=/tmp/pass.$$
-
- # First, get all login/uid info from passwd file
- grep -v '^+:' $PASSWD |
- awk -F: '{ printf "s/^%s:/%s/\n", $1, $3; }' >$tempsed
- # next one is a giant pipe:
- grep -v '^+:' $GROUP |
- grep -v ':[ ]*$' |
- sed 's/^[^:]*:[^:]*:\([0-9]*\):\(.*\)/\1,\2/' |
- awk -F, '{ for (n=2; n<=NF; n++)
- if ($n != "") print $n":\t"$1;
- }' |
- sed -f $tempsed | sort | grep -v ':' |
- awk 'BEGIN { uid=-1; }
- { if (uid == $1) {
- groups=groups","$2;
- } else {
- if (uid != -1)
- print uid":"groups;
- uid=$1; groups=$2;
- }
- }
- END { if (uid != -1) printf("%s:%s\n", uid, groups); }' |
- sed "s/\(.*\):/unix.\1@$DOMAIN &/"
- rm -f $tempsed
- exit 0
diff --git a/gnu/usr.sbin/ypserv/server.c b/gnu/usr.sbin/ypserv/server.c
deleted file mode 100644
index 205a846..0000000
--- a/gnu/usr.sbin/ypserv/server.c
+++ /dev/null
@@ -1,1384 +0,0 @@
-/*
-** server.c YP server routines.
-**
-** Copyright (c) 1993 Signum Support AB, Sweden
-**
-** This file is part of the NYS YP Server.
-**
-** The NYS YP Server is free software; you can redistribute it and/or
-** modify it under the terms of the GNU General Public License as
-** published by the Free Software Foundation; either version 2 of the
-** License, or (at your option) any later version.
-**
-** The NYS YP Server 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 the NYS YP Server; see the file COPYING. If
-** not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-** Cambridge, MA 02139, USA.
-**
-** Author: Peter Eriksson <pen@signum.se>
-** Ported to FreeBSD and hacked all to pieces
-** by Bill Paul <wpaul@ctr.columbia.edu>
-**
-** $Id: server.c,v 1.11 1995/07/15 23:27:47 wpaul Exp $
-**
-*/
-
-#include "system.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <string.h>
-#include <limits.h>
-#include <db.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <rpc/rpc.h>
-#include "yp.h"
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <syslog.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <signal.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-
-#if __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#define PERM_SECURE (S_IRUSR|S_IWUSR)
-HASHINFO openinfo = {
- 4096, /* bsize */
- 32, /* ffactor */
- 256, /* nelem */
- 2048 * 1024, /* cachesize */
- NULL, /* hash */
- 0, /* lorder */
-};
-
-#if TCP_WRAPPER
-#include "tcpd.h"
-int allow_severity=LOG_INFO;
-int deny_severity=LOG_WARNING;
-#endif
-
-void verr __P((const char *, _BSD_VA_LIST_));
-void Perror __P((const char *, ...));
-
-extern char *dnsname();
-extern char *dnsaddr();
-extern char *_gethostbydnsaddr();
-
-extern char *progname;
-extern int errno;
-
-int debug_flag = 0;
-int dns_flag = 0;
-int children = 0;
-int forked = 0;
-
-void verr(fmt, ap)
- const char *fmt;
- _BSD_VA_LIST_ ap;
-
-{
- if (debug_flag)
- vfprintf(stderr, fmt, ap);
- else
- vsyslog(LOG_NOTICE, fmt, ap);
-}
-
-void
-#ifdef __STDC__
-Perror(const char *fmt, ...)
-#else
-Perror(fmt, va_list)
- const char *fmt;
- va_dcl
-#endif
-{
- va_list ap;
-#ifdef __STDC__
- va_start(ap, fmt);
-#else
- va_start(ap);
-#endif
- verr(fmt,ap);
- va_end(ap);
-}
-
-
-/*
-** Return 1 if request comes from an authorized host
-**
-** XXX This function should implement the "securenets" functionality
-*/
-static int is_valid_host(struct sockaddr_in *sin)
-{
-#if TCP_WRAPPER
- extern int hosts_ctl(char *, char *, char *, char *);
- int status;
- static long oldaddr=0; /* so we dont log multiple times */
- static int oldstatus=-1;
- char *h=NULL;
-
-#ifdef TRYRESOLVE
- struct hostent *hp;
-
- hp = _gethostbydnsaddr((char *) &sin->sin_addr.s_addr,
- sizeof (sin->sin_addr.s_addr), AF_INET);
-
- h = (hp && hp->h_name) ? hp->h_name : NULL;
-#endif
-
-#ifndef FROM_UNKNOWN
-#define FROM_UNKNOWN STRING_UNKNOWN
-#endif
-
- status = hosts_ctl(progname,
- h?h:FROM_UNKNOWN,
- inet_ntoa(sin->sin_addr),
- "");
-
- if (!status && (sin->sin_addr.s_addr != oldaddr || status != oldstatus)) {
- syslog(status?allow_severity:deny_severity,
- "%sconnect from %s\n",status?"":"refused ",
- h?h:inet_ntoa(sin->sin_addr));
- oldaddr=sin->sin_addr.s_addr;
- oldstatus=status;
- }
- return status;
-#else
- return 1;
-#endif
-}
-
-
-void *ypproc_null_2_svc(void *dummy,
- struct svc_req *rqstp)
-{
- static int foo;
- struct sockaddr_in *rqhost;
-
-
- rqhost = svc_getcaller(rqstp->rq_xprt);
- if (!is_valid_host(rqhost))
- return NULL;
-
- if (debug_flag)
- Perror("ypproc_null() [From: %s:%d]\n",
- inet_ntoa(rqhost->sin_addr),
- ntohs(rqhost->sin_port));
-
- return (void *) &foo;
-}
-
-
-/*
-** Return 1 if the name is a valid domain name served by us, else 0.
-*/
-static int is_valid_domain(const char *domain)
-{
- struct stat sbuf;
-
-
- if (domain == NULL ||
- strcmp(domain, "binding") == 0 ||
- strcmp(domain, "..") == 0 ||
- strcmp(domain, ".") == 0 ||
- strchr(domain, '/'))
- return 0;
-
- if (stat(domain, &sbuf) < 0 || !S_ISDIR(sbuf.st_mode))
- return 0;
-
- return 1;
-}
-
-
-
-bool_t *ypproc_domain_2_svc(domainname *name,
- struct svc_req *rqstp)
-{
- static bool_t result;
- struct sockaddr_in *rqhost;
-
-
- rqhost = svc_getcaller(rqstp->rq_xprt);
-
- if (debug_flag)
- Perror("ypproc_domain(\"%s\") [From: %s:%d]\n",
- *name,
- inet_ntoa(rqhost->sin_addr),
- ntohs(rqhost->sin_port));
-
- if (!is_valid_host(rqhost))
- {
- if (debug_flag)
- Perror("\t-> Ignored (not a valid source host)\n");
-
- return NULL;
- }
-
- if (is_valid_domain(*name))
- result = TRUE;
- else
- result = FALSE;
-
- if (debug_flag)
- Perror("\t-> %s.\n",
- (result == TRUE ? "Ok" : "Not served by us"));
-
- return &result;
-}
-
-
-bool_t *ypproc_domain_nonack_2_svc(domainname *name,
- struct svc_req *rqstp)
-{
- static bool_t result;
- struct sockaddr_in *rqhost;
-
-
- rqhost = svc_getcaller(rqstp->rq_xprt);
-
- if (debug_flag)
- Perror("ypproc_domain_nonack(\"%s\") [From: %s:%d]\n",
- *name,
- inet_ntoa(rqhost->sin_addr),
- ntohs(rqhost->sin_port));
-
- if (!is_valid_host(rqhost))
- {
- if (debug_flag)
- Perror("\t-> Ignored (not a valid source host)\n");
-
- return NULL;
- }
-
- if (!is_valid_domain(*name))
- {
- if (debug_flag)
- Perror("\t-> Ignored (not a valid domain)\n");
-
- /* Bail out and don't return any RPC value */
- return NULL;
- }
-
- if (debug_flag)
- Perror("\t-> OK.\n");
-
- result = TRUE;
- return &result;
-}
-
-
-/*
-** Open a DB database
-*/
-static DB *open_database(const char *domain,
- const char *map)
-{
- DB *dbp;
- char buf[1025];
-
-
- if (map[0] == '.' || strchr(map, '/'))
- return 0;
-
- sprintf (buf, "%s/%s", domain, map);
-
- dbp = dbopen(buf,O_RDONLY|O_EXCL, PERM_SECURE, DB_HASH, &openinfo);
-
- if (debug_flag > 1 && dbp == NULL)
- Perror("dbopen(%s): %s", map, strerror(errno));
-
- return dbp;
-}
-
-
-#define F_ALL 0x01
-#define F_NEXT 0x02
-#define F_YPALL 0x08
-
-/*
-** Get a record from a DB database.
-** This looks ugly because it emulates the behavior of the original
-** GDBM-based routines. Blech.
-*/
-int read_database(DB *dbp,
- const DBT *ikey,
- DBT *okey,
- DBT *dval,
- int flags)
-{
- int first_flag = 0;
- DBT nkey, ckey, dummyval;
-
-
- if (ikey == NULL || ikey->data == NULL)
- {
- (dbp->seq)(dbp,&ckey,&dummyval,R_FIRST);
- first_flag = 1;
- }
- else
- {
- if ((flags & F_NEXT))
- {
- /*
- ** This crap would be unnecessary if R_CURSOR actually worked.
- */
- if (flags < F_YPALL)
- {
- (dbp->seq)(dbp,&ckey,&dummyval,R_FIRST);
- while(strncmp((char *)ikey->data,ckey.data,(int)ikey->size) ||
- ikey->size != ckey.size)
- (dbp->seq)(dbp,&ckey,&dummyval,R_NEXT);
- }
- if ((dbp->seq)(dbp,&ckey,&dummyval,R_NEXT))
- ckey.data = NULL;
-#ifdef GNU_YPSERV_ARTIFACT
- free(dummyval.data);
-#endif
- }
- else
- ckey = *ikey;
- }
-
- if (ckey.data == NULL)
- {
- return (flags & F_NEXT) ? YP_NOMORE : YP_NOKEY;
- }
-
- while (1)
- {
- if ((dbp->get)(dbp,&ckey,dval,0))
- {
-#ifdef GNU_YPSERV_ARTIFACT
- /* Free key, unless it comes from the caller! */
- if (ikey == NULL || ckey.data != ikey->data)
- free(ckey.data);
-#endif
- if (ikey && ikey->data != NULL)
- {
- return YP_NOKEY;
- }
- else
- if (first_flag)
- return YP_BADDB;
- else
- return YP_FALSE;
- }
-
- if ((flags & F_ALL) || strncmp(ckey.data, "YP_", 3) != 0)
- {
- if (okey)
- *okey = ckey;
-#ifdef GNU_YPSERV_ARTIFACT
- else if (ikey == NULL || ikey->data != ckey.data)
- free(ckey.data);
-#endif
- return YP_TRUE;
- }
-
- /* Free old value */
-#ifdef GNU_YPSERV_ARTIFACT
- free(dval->data);
-#endif
- if ((dbp->seq)(dbp,&nkey,&dummyval,R_NEXT))
- nkey.data = NULL;
-#ifdef GNU_YPSERV_ARTIFACT
- free(dummyval.data);
-
- /* Free old key, unless it comes from the caller! */
- if (ikey == NULL || ckey.data != ikey->data)
- free(ckey.data);
-#endif
- if (ckey.data == NULL || nkey.data == NULL)
- return YP_NOMORE;
-
- ckey = nkey;
- }
-}
-
-
-/*
-** Get the DateTimeModified value for a certain map database
-*/
-static unsigned long get_dtm(const char *domain,
- const char *map)
-{
- struct stat sbuf;
- char buf[1025];
-
-
- strcpy(buf, domain);
- strcat(buf, "/");
- strcat(buf, map);
-
- if (stat(buf, &sbuf) < 0)
- return 0;
- else
- return (unsigned long) sbuf.st_mtime;
-}
-
-
-/*
-** YP function "MATCH" implementation
-*/
-ypresp_val *ypproc_match_2_svc(ypreq_key *key,
- struct svc_req *rqstp)
-{
- static ypresp_val result;
- struct sockaddr_in *rqhost;
-
-
- rqhost = svc_getcaller(rqstp->rq_xprt);
-
- if (debug_flag)
- {
- Perror("ypproc_match(): [From: %s:%d]\n",
- inet_ntoa(rqhost->sin_addr),
- ntohs(rqhost->sin_port));
-
- Perror("\t\tdomainname = \"%s\"\n",
- key->domain);
- Perror("\t\tmapname = \"%s\"\n",
- key->map);
- Perror("\t\tkeydat = \"%.*s\"\n",
- (int) key->key.keydat_len,
- key->key.keydat_val);
- }
-
- if (!is_valid_host(rqhost))
- {
- if (debug_flag)
- Perror("\t-> Ignored (not a valid source host)\n");
-
- return NULL;
- }
-
- /*
- ** If this request deals with master.passwd.* and it didn't
- ** originate on a privileged port (< 1024), return a YP_YPERR.
- ** This is our half-assed way of preventing non-root users
- ** on NIS clients from getting at the real password map. Bah.
- */
-
- if (strstr(key->map, "master.passwd") != NULL &&
- ntohs(rqhost->sin_port) > 1023)
- {
- result.stat = YP_YPERR;
- return &result;
- }
-
- result.val.valdat_len = 0;
- if (result.val.valdat_val)
- {
-#ifdef GNU_YPSERV_ARTIFACT
- /*
- * In general, if you malloc() data in an RPC service
- * routine, you have to free() it the next time that
- * routine is called since the XDR routines won't free
- * it for you. However, in this case, we don't have to
- * do that because the DB routines do garbage collection
- * for us.
- */
- free(result.val.valdat_val);
-#endif
- result.val.valdat_val = NULL;
- }
-
- if (key->domain[0] == '\0' || key->map[0] == '\0')
- result.stat = YP_BADARGS;
- else if (!is_valid_domain(key->domain))
- result.stat = YP_NODOM;
- else
- {
- DBT rdat, qdat;
-
- DB *dbp = open_database(key->domain, key->map);
- if (dbp == NULL)
- result.stat = YP_NOMAP;
- else
- {
- qdat.size = key->key.keydat_len;
- qdat.data = key->key.keydat_val;
-
- result.stat = read_database(dbp, &qdat, NULL, &rdat, F_ALL);
-
- if (result.stat == YP_TRUE)
- {
- result.val.valdat_len = rdat.size;
- result.val.valdat_val = rdat.data;
- }
-
- (void)(dbp->close)(dbp);
- }
- }
-
- if (debug_flag)
- {
- if (result.stat == YP_TRUE)
- Perror("\t-> Value = \"%.*s\"\n",
- (int) result.val.valdat_len,
- result.val.valdat_val);
- else
- Perror("\t-> Error #%d\n", result.stat);
- }
-
-
- /*
- ** Do the jive thing if we didn't find the host in the YP map
- ** and we have enabled the magic DNS lookup stuff.
- **
- ** DNS lookups are handled in a subprocess so that the server
- ** doesn't block while waiting for requests to complete.
- */
- if (result.stat != YP_TRUE && strstr(key->map, "hosts") && dns_flag)
- {
- char *cp = NULL;
-
- if (children < MAX_CHILDREN && fork())
- {
- children++;
- return NULL;
- }
- else
- forked++;
-
- key->key.keydat_val[key->key.keydat_len] = '\0';
-
- if (debug_flag)
- Perror("Doing DNS lookup of %s\n", key->key.keydat_val);
-
- if (strcmp(key->map, "hosts.byname") == 0)
- cp = dnsname(key->key.keydat_val);
- else if (strcmp(key->map, "hosts.byaddr") == 0)
- cp = dnsaddr(key->key.keydat_val);
-
- if (cp)
- {
-
- if (debug_flag)
- Perror("\t-> OK (%s)\n", cp);
-
- result.val.valdat_len = strlen(cp);
- result.val.valdat_val = cp;
- result.stat = YP_TRUE;
- }
- else
- {
- if (debug_flag)
- {
- Perror("\t-> Not Found\n");
- Perror("DNS lookup: %s",strerror(errno));
- }
-
- result.stat = YP_NOKEY;
- }
- }
-
- return &result;
-}
-
-
-
-ypresp_key_val *ypproc_first_2_svc(ypreq_nokey *key,
- struct svc_req *rqstp)
-{
- static ypresp_key_val result;
- struct sockaddr_in *rqhost;
-
-
- rqhost = svc_getcaller(rqstp->rq_xprt);
-
- if (debug_flag)
- {
- Perror("ypproc_first(): [From: %s:%d]\n",
- inet_ntoa(rqhost->sin_addr),
- ntohs(rqhost->sin_port));
-
- Perror("\tdomainname = \"%s\"\n", key->domain);
- Perror("\tmapname = \"%s\"\n", key->map);
-#if 0
- Perror("\tkeydat = \"%.*s\"\n",
- (int) key->key.keydat_len,
- key->key.keydat_val);
-#endif
- }
-
- if (!is_valid_host(rqhost))
- {
- if (debug_flag)
- Perror("\t-> Ignored (not a valid source host)\n");
-
- return NULL;
- }
-
- /*
- ** If this request deals with master.passwd.* and it didn't
- ** originate on a privileged port (< 1024), return a YP_YPERR.
- ** This is our half-assed way of preventing non-root users
- ** on NIS clients from getting at the real password map. Bah.
- */
-
- if (strstr(key->map, "master.passwd") != NULL &&
- ntohs(rqhost->sin_port) > 1023)
- {
- result.stat = YP_YPERR;
- return &result;
- }
-
- result.key.keydat_len = 0;
- if (result.key.keydat_val)
- {
-#ifdef GNU_YPSERV_ARTIFACT
- free(result.key.keydat_val);
-#endif
- result.key.keydat_val = NULL;
- }
-
- result.val.valdat_len = 0;
- if (result.val.valdat_val)
- {
-#ifdef GNU_YPSERV_ARTIFACT
- free(result.val.valdat_val);
-#endif
- result.val.valdat_val = NULL;
- }
-
- if (key->map[0] == '\0' || key->domain[0] == '\0')
- result.stat = YP_BADARGS;
- else if (!is_valid_domain(key->domain))
- result.stat = YP_NODOM;
- else
- {
- DBT dkey, dval;
-
- DB *dbp = open_database(key->domain, key->map);
- if (dbp == NULL)
- result.stat = YP_NOMAP;
- else
- {
- result.stat = read_database(dbp, NULL, &dkey, &dval, 0);
-
- if (result.stat == YP_TRUE)
- {
- result.key.keydat_len = dkey.size;
- result.key.keydat_val = dkey.data;
-
- result.val.valdat_len = dval.size;
- result.val.valdat_val = dval.data;
- }
-
- (void)(dbp->close)(dbp);
- }
- }
-
- if (debug_flag)
- {
- if (result.stat == YP_TRUE)
- Perror("\t-> Key = \"%.*s\", Value = \"%.*s\"\n",
- (int) result.key.keydat_len,
- result.key.keydat_val,
- (int) result.val.valdat_len,
- result.val.valdat_val);
-
- else
- Perror("\t-> Error #%d\n", result.stat);
- }
-
- return &result;
-}
-
-
-ypresp_key_val *ypproc_next_2_svc(ypreq_key *key,
- struct svc_req *rqstp)
-{
- static ypresp_key_val result;
- struct sockaddr_in *rqhost;
-
-
- rqhost = svc_getcaller(rqstp->rq_xprt);
-
- if (debug_flag)
- {
- Perror("ypproc_next(): [From: %s:%d]\n",
- inet_ntoa(rqhost->sin_addr),
- ntohs(rqhost->sin_port));
-
- Perror("\tdomainname = \"%s\"\n", key->domain);
- Perror("\tmapname = \"%s\"\n", key->map);
- Perror("\tkeydat = \"%.*s\"\n",
- (int) key->key.keydat_len,
- key->key.keydat_val);
- }
-
- if (!is_valid_host(rqhost))
- {
- if (debug_flag)
- Perror("\t-> Ignored (not a valid source host)\n");
-
- return NULL;
- }
-
- /*
- ** If this request deals with master.passwd.* and it didn't
- ** originate on a privileged port (< 1024), return a YP_YPERR.
- ** This is our half-assed way of preventing non-root users
- ** on NIS clients from getting at the real password map. Bah.
- */
-
- if (strstr(key->map, "master.passwd") != NULL &&
- ntohs(rqhost->sin_port) > 1023)
- {
- result.stat = YP_YPERR;
- return &result;
- }
-
- result.key.keydat_len = 0;
- if (result.key.keydat_val)
- {
-#ifdef GNU_YPSERV_ARTIFACT
- free(result.key.keydat_val);
-#endif
- result.key.keydat_val = NULL;
- }
-
- result.val.valdat_len = 0;
- if (result.val.valdat_val)
- {
-#ifdef GNU_YPSERV_ARTIFACT
- free(result.val.valdat_val);
-#endif
- result.val.valdat_val = NULL;
- }
-
- if (key->map[0] == '\0' || key->domain[0] == '\0')
- result.stat = YP_BADARGS;
- else if (!is_valid_domain(key->domain))
- result.stat = YP_NODOM;
- else
- {
- DBT dkey, dval, okey;
-
-
- DB *dbp = open_database(key->domain, key->map);
- if (dbp == NULL)
- result.stat = YP_NOMAP;
- else
- {
- dkey.size = key->key.keydat_len;
- dkey.data = key->key.keydat_val;
-
- result.stat = read_database(dbp, &dkey, &okey, &dval, F_NEXT);
-
- if (result.stat == YP_TRUE)
- {
- result.key.keydat_len = okey.size;
- result.key.keydat_val = okey.data;
-
- result.val.valdat_len = dval.size;
- result.val.valdat_val = dval.data;
- }
- (void)(dbp->close)(dbp);
- }
- }
-
- if (debug_flag)
- {
- if (result.stat == YP_TRUE)
- Perror("\t-> Key = \"%.*s\", Value = \"%.*s\"\n",
- (int) result.key.keydat_len,
- result.key.keydat_val,
- (int) result.val.valdat_len,
- result.val.valdat_val);
- else
- Perror("\t-> Error #%d\n", result.stat);
- }
-
- return &result;
-}
-
-
-
-static void print_ypmap_parms(const struct ypmap_parms *pp)
-{
- Perror("\t\tdomain = \"%s\"\n", pp->domain);
- Perror("\t\tmap = \"%s\"\n", pp->map);
- Perror("\t\tordernum = %u\n", pp->ordernum);
- Perror("\t\tpeer = \"%s\"\n", pp->peer);
-}
-
-
-/*
-** Clean up after child processes signal their termination.
-*/
-void reapchild(sig)
-int sig;
-{
- int st;
-
- while (wait3(&st, WNOHANG, NULL) > 0)
- children--;
-}
-
-/*
-** Stole the ypxfr implementation from the yps package.
-*/
-ypresp_xfr *ypproc_xfr_2_svc(ypreq_xfr *xfr,
- struct svc_req *rqstp)
-{
- static ypresp_xfr result;
- struct sockaddr_in *rqhost;
- char ypxfr_command[MAXPATHLEN];
-
- rqhost = svc_getcaller(rqstp->rq_xprt);
-
- if (debug_flag)
- {
- Perror("ypproc_xfr_2_svc(): [From: %s:%d]\n\tmap_parms:\n",
- inet_ntoa(rqhost->sin_addr),
- ntohs(rqhost->sin_port));
-
- print_ypmap_parms(&xfr->map_parms);
- Perror("\t\ttransid = %u\n", xfr->transid);
- Perror("\t\tprog = %u\n", xfr->prog);
- Perror("\t\tport = %u\n", xfr->port);
- }
-
- if (!is_valid_host(rqhost))
- {
- if (debug_flag)
- Perror("\t-> Ignored (not a valid source host)\n");
-
- return NULL;
- }
-
- /*
- ** If this request originates on a non-privileged port (< 1024),
- ** refuse it. We really only need to guard the master.passwd.*
- ** maps, but what the hell.
- ** This is our half-assed way of preventing non-root users
- ** on NIS clients from getting at the real password map. Bah.
- */
-
- if (ntohs(rqhost->sin_port) > 1023)
- {
- result.xfrstat = YPXFR_REFUSED;
- return &result;
- }
-
- switch(fork())
- {
- case 0:
- {
- char g[11], t[11], p[11];
-
- sprintf (ypxfr_command, "%s/ypxfr", INSTDIR);
- sprintf (t, "%u", xfr->transid);
- sprintf (g, "%u", xfr->prog);
- sprintf (p, "%u", xfr->port);
- execl(ypxfr_command, "ypxfr", "-d", xfr->map_parms.domain, "-h",
- xfr->map_parms.peer, "-f", "-C", t, g,
- inet_ntoa(rqhost->sin_addr), p, xfr->map_parms.map, NULL);
- Perror("ypxfr execl(): %s",strerror(errno));
- exit(0);
- }
- case -1:
- Perror("fork(): %s",strerror(errno));
- result.xfrstat = YPXFR_XFRERR;
- default:
- {
- result.xfrstat = YPXFR_SUCC;
- break;
- }
- }
-
- result.transid = xfr->transid;
- return &result;
-}
-
-
-void *ypproc_clear_2_svc(void *dummy,
- struct svc_req *rqstp)
-{
- static int foo;
- struct sockaddr_in *rqhost;
-
-
- rqhost = svc_getcaller(rqstp->rq_xprt);
-
- if (debug_flag)
- Perror("ypproc_clear_2_svc() [From: %s:%d]\n",
- inet_ntoa(rqhost->sin_addr),
- ntohs(rqhost->sin_port));
-
- if (!is_valid_host(rqhost))
- {
- if (debug_flag)
- Perror("\t-> Ignored (not a valid source host)\n");
-
- return NULL;
- }
-
- return (void *) &foo;
-}
-
-
-static int ypall_close(void *data)
-{
- DB *locptr;
-
- if (debug_flag && data == NULL)
- {
- Perror("ypall_close() called with NULL pointer.\n");
- return 0;
- }
-
- locptr = (DB *)data;
- (void)(locptr->close)(locptr);
- return 0;
-}
-
-
-static int ypall_encode(ypresp_key_val *val,
- void *data)
-{
- DBT dkey, dval, okey;
-
- dkey.data = val->key.keydat_val;
- dkey.size = val->key.keydat_len;
-
- val->stat = read_database((DB *) data, &dkey, &okey, &dval, F_NEXT | F_YPALL);
-
- if (val->stat == YP_TRUE)
- {
- val->key.keydat_val = okey.data;
- val->key.keydat_len = okey.size;
-
- val->val.valdat_val = dval.data;
- val->val.valdat_len = dval.size;
- }
-
-
- return val->stat;
-}
-
-
-ypresp_all *ypproc_all_2_svc(ypreq_nokey *nokey,
- struct svc_req *rqstp)
-{
- static ypresp_all result;
- extern __xdr_ypall_cb_t __xdr_ypall_cb;
- struct sockaddr_in *rqhost;
-
-
- rqhost = svc_getcaller(rqstp->rq_xprt);
-
- if (debug_flag)
- {
- Perror("ypproc_all_2_svc(): [From: %s:%d]\n",
- inet_ntoa(rqhost->sin_addr),
- ntohs(rqhost->sin_port));
-
- Perror("\t\tdomain = \"%s\"\n", nokey->domain);
- Perror("\t\tmap = \"%s\"\n", nokey->map);
- }
-
- if (!is_valid_host(rqhost))
- {
- if (debug_flag)
- Perror("\t-> Ignored (not a valid source host)\n");
-
- return NULL;
- }
-
- if (children < MAX_CHILDREN && fork())
- {
- children++;
- return NULL;
- }
- else
- forked++;
-
- __xdr_ypall_cb.u.encode = NULL;
- __xdr_ypall_cb.u.close = NULL;
- __xdr_ypall_cb.data = NULL;
-
- result.more = TRUE;
-
- /*
- ** If this request deals with master.passwd.* and it didn't
- ** originate on a privileged port (< 1024), return a YP_YPERR.
- ** This is our half-assed way of preventing non-root users
- ** on NIS clients from getting at the real password map. Bah.
- */
-
- if (strstr(nokey->map, "master.passwd") != NULL &&
- ntohs(rqhost->sin_port) > 1023)
- {
- result.ypresp_all_u.val.stat = YP_YPERR;
- return &result;
- }
-
- if (nokey->map[0] == '\0' || nokey->domain[0] == '\0')
- result.ypresp_all_u.val.stat = YP_BADARGS;
- else if (!is_valid_domain(nokey->domain))
- result.ypresp_all_u.val.stat = YP_NODOM;
- else
- {
- DBT dkey, dval;
-
- DB *dbp = open_database(nokey->domain, nokey->map);
- if (dbp == NULL)
- result.ypresp_all_u.val.stat = YP_NOMAP;
- else
- {
- result.ypresp_all_u.val.stat = read_database(dbp,
- NULL,
- &dkey,
- &dval,
- 0);
-
- if (result.ypresp_all_u.val.stat == YP_TRUE)
- {
- result.ypresp_all_u.val.key.keydat_len = dkey.size;
- result.ypresp_all_u.val.key.keydat_val = dkey.data;
-
- result.ypresp_all_u.val.val.valdat_len = dval.size;
- result.ypresp_all_u.val.val.valdat_val = dval.data;
-
- __xdr_ypall_cb.u.encode = ypall_encode;
- __xdr_ypall_cb.u.close = ypall_close;
- __xdr_ypall_cb.data = (void *) dbp;
-
- return &result;
- }
-
- (void)(dbp->close)(dbp);
- }
- }
-
- return &result;
-}
-
-
-ypresp_master *ypproc_master_2_svc(ypreq_nokey *nokey,
- struct svc_req *rqstp)
-{
- static ypresp_master result;
- struct sockaddr_in *rqhost;
-
-
- rqhost = svc_getcaller(rqstp->rq_xprt);
-
- if (debug_flag)
- {
- Perror("ypproc_master_2_svc(): [From: %s:%d]\n",
- inet_ntoa(rqhost->sin_addr),
- ntohs(rqhost->sin_port));
-
- Perror("\t\tdomain = \"%s\"\n", nokey->domain);
- Perror("\t\tmap = \"%s\"\n", nokey->map);
- }
-
- if (!is_valid_host(rqhost))
- {
- if (debug_flag)
- Perror("\t-> Ignored (not a valid source host)\n");
-
- return NULL;
- }
-
- /*
- ** If this request deals with master.passwd.* and it didn't
- ** originate on a privileged port (< 1024), return a YP_YPERR.
- ** This is our half-assed way of preventing non-root users
- ** on NIS clients from getting at the real password map. Bah.
- */
-
- if (strstr(nokey->map, "master.passwd") != NULL &&
- ntohs(rqhost->sin_port) > 1023)
- {
- result.stat = YP_YPERR;
- return &result;
- }
-
- if (result.peer)
- {
-#ifdef GNU_YPSERV_ARTIFACT
- free(result.peer);
-#endif
- result.peer = NULL;
- }
-
- if (nokey->domain[0] == '\0')
- result.stat = YP_BADARGS;
- else if (!is_valid_domain(nokey->domain))
- result.stat = YP_NODOM;
- else
- {
- DB *dbp = open_database(nokey->domain, nokey->map);
- if (dbp == NULL)
- result.stat = YP_NOMAP;
- else
- {
- DBT key, val;
-
- key.size = sizeof("YP_MASTER_NAME")-1;
- key.data = "YP_MASTER_NAME";
-
- if ((dbp->get)(dbp,&key,&val,0))
- {
- /* No YP_MASTER_NAME record in map? Assume we are Master */
- static char hostbuf[1025];
-
- gethostname((char *)&hostbuf, sizeof(hostbuf)-1);
- Perror("Hostname: [%s]",hostbuf);
- result.peer = strdup(hostbuf);
- }
- else
- {
- *(((char *)val.data)+val.size) = '\0';
- result.peer = val.data;
- }
-
- result.stat = YP_TRUE;
- (void)(dbp->close)(dbp);
- }
- }
-
- if (result.peer == NULL)
- result.peer = strdup("");
-
- if (debug_flag)
- Perror("\t-> Peer = \"%s\"\n", result.peer);
-
- return &result;
-}
-
-
-ypresp_order *ypproc_order_2_svc(ypreq_nokey *nokey,
- struct svc_req *rqstp)
-{
- static ypresp_order result;
- struct sockaddr_in *rqhost;
-
-
- rqhost = svc_getcaller(rqstp->rq_xprt);
-
- if (debug_flag)
- {
- Perror("ypproc_order_2_svc(): [From: %s:%d]\n",
- inet_ntoa(rqhost->sin_addr),
- ntohs(rqhost->sin_port));
-
- Perror("\t\tdomain = \"%s\"\n", nokey->domain);
- Perror("\t\tmap = \"%s\"\n", nokey->map);
- }
-
- if (!is_valid_host(rqhost))
- {
- if (debug_flag)
- Perror("\t-> Ignored (not a valid source host)\n");
-
- return NULL;
- }
-
- /*
- ** If this request deals with master.passwd.* and it didn't
- ** originate on a privileged port (< 1024), return a YP_YPERR.
- ** This is our half-assed way of preventing non-root users
- ** on NIS clients from getting at the real password map. Bah.
- */
-
- if (strstr(nokey->map, "master.passwd") != NULL &&
- ntohs(rqhost->sin_port) > 1023)
- {
- result.stat = YP_YPERR;
- return &result;
- }
-
- result.ordernum = 0;
-
- if (nokey->domain[0] == '\0')
- result.stat = YP_BADARGS;
- else if (!is_valid_domain(nokey->domain))
- result.stat = YP_NODOM;
- else
- {
- DB *dbp = open_database(nokey->domain, nokey->map);
- if (dbp == NULL)
- result.stat = YP_NOMAP;
- else
- {
- DBT key, val;
-
- key.size = sizeof("YP_LAST_MODIFIED")-1;
- key.data = "YP_LAST_MODIFIED";
-
- if ((dbp->get)(dbp,&key,&val,0))
- {
- /* No YP_LAST_MODIFIED record in map? Use DTM timestamp.. */
- result.ordernum = get_dtm(nokey->domain, nokey->map);
- }
- else
- {
- result.ordernum = atoi(val.data);
-#ifdef GNU_YPSERV_ARTIFACT
- free(val.data);
-#endif
- }
-
- result.stat = YP_TRUE;
- (void)(dbp->close)(dbp);
- }
- }
-
- if (debug_flag)
- Perror("-> Order # %d\n", result.ordernum);
-
- return &result;
-}
-
-
-static void free_maplist(ypmaplist *mlp)
-{
- ypmaplist *next;
-
- while (mlp != NULL)
- {
- next = mlp->next;
- free(mlp->map);
- free(mlp);
- mlp = next;
- }
-}
-
-static int add_maplist(ypmaplist **mlhp,
- char *map)
-{
- ypmaplist *mlp;
-
- if (!strncmp(map, ".", strlen(map)) || !strncmp(map, "..", strlen(map)))
- return 0;
-
- mlp = malloc(sizeof(*mlp));
- if (mlp == NULL)
- return -1;
-
- mlp->map = strdup(map);
- if (mlp->map == NULL)
- {
- free(mlp);
- return -1;
- }
-
- mlp->next = *mlhp;
- *mlhp = mlp;
-
- return 0;
-}
-
-
-ypresp_maplist *ypproc_maplist_2_svc(domainname *name,
- struct svc_req *rqstp)
-{
- static ypresp_maplist result;
- struct sockaddr_in *rqhost;
-
-
- rqhost = svc_getcaller(rqstp->rq_xprt);
-
- if (debug_flag)
- {
- Perror("ypproc_maplist_2_svc(): [From: %s:%d]\n",
- inet_ntoa(rqhost->sin_addr),
- ntohs(rqhost->sin_port));
-
- Perror("\t\tdomain = \"%s\"\n", *name);
- }
-
- if (!is_valid_host(rqhost))
- {
- if (debug_flag)
- Perror("\t-> Ignored (not a valid source host)\n");
-
- return NULL;
- }
-
- if (result.maps)
- free_maplist(result.maps);
-
- result.maps = NULL;
-
- if ((*name)[0] == '\0')
- result.stat = YP_BADARGS;
- else if (!is_valid_domain(*name))
- result.stat = YP_NODOM;
- else
- {
- DIR *dp;
- char dirname[MAXPATHLEN];
-
- sprintf(dirname,"./%s",*name);
- dp = opendir(dirname);
- if (dp == NULL)
- {
- if (debug_flag)
- {
- Perror("%s: opendir: %s", progname,strerror(errno));
- }
-
- result.stat = YP_BADDB;
- }
- else
- {
- struct dirent *dep;
-
- while ((dep = readdir(dp)) != NULL)
- if (add_maplist(&result.maps, dep->d_name) < 0)
- {
- result.stat = YP_YPERR;
- break;
- }
- closedir(dp);
- result.stat = YP_TRUE;
- }
- }
-
- if (debug_flag)
- {
- if (result.stat == YP_TRUE)
- {
- ypmaplist *p;
-
- p = result.maps;
- Perror("-> ");
- while (p->next)
- {
- Perror("%s,", p->map);
- p = p->next;
- }
- putc('\n', stderr);
- }
- else
- Perror("\t-> Error #%d\n", result.stat);
- }
-
- return &result;
-}
diff --git a/gnu/usr.sbin/ypserv/svc_run.c b/gnu/usr.sbin/ypserv/svc_run.c
deleted file mode 100644
index 6f4a52c..0000000
--- a/gnu/usr.sbin/ypserv/svc_run.c
+++ /dev/null
@@ -1,85 +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
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-/*static char *sccsid = "from: @(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro";*/
-/*static char *sccsid = "from: @(#)svc_run.c 2.1 88/07/29 4.0 RPCSRC";*/
-static char *rcsid = "$Id: svc_run.c,v 1.2 1995/05/30 05:41:35 rgrimes Exp $";
-#endif
-
-/*
- * This is the rpc server side idle loop
- * Wait for input, call server program.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <rpc/rpc.h>
-#include <sys/errno.h>
-
-extern int _rpc_dtablesize __P((void));
-
-void
-my_svc_run()
-{
-#ifdef FD_SETSIZE
- fd_set readfds;
-#else
- int readfds;
-#endif /* def FD_SETSIZE */
- extern int errno;
- extern int forked;
- int pid;
-
- /* Establish the identity of the parent ypserv process. */
- pid = getpid();
-
- for (;;) {
-#ifdef FD_SETSIZE
- readfds = svc_fdset;
-#else
- readfds = svc_fds;
-#endif /* def FD_SETSIZE */
- switch (select(_rpc_dtablesize(), &readfds, NULL, NULL,
- (struct timeval *)0)) {
- case -1:
- if (errno == EINTR) {
- continue;
- }
- perror("svc_run: - select failed");
- return;
- case 0:
- continue;
- default:
- svc_getreqset(&readfds);
- if (forked && pid != getpid())
- exit(0);
- }
- }
-}
diff --git a/gnu/usr.sbin/ypserv/system.h b/gnu/usr.sbin/ypserv/system.h
deleted file mode 100644
index 838430a..0000000
--- a/gnu/usr.sbin/ypserv/system.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * $Id$
- */
-
-#if (defined(__sun__) || defined(sun)) && !defined(__svr4__)
-
-/* Stupid SunOS 4 doesn't have prototypes in the header files */
-
-/* Some includes just to make the compiler be quiet */
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-
-extern int fprintf(FILE *fp, const char *format, ...);
-extern int _flsbuf(unsigned char c, FILE *fp);
-extern int puts(const char *str);
-extern int printf(const char *format, ...);
-
-extern int chdir(const char *path);
-extern int gethostname(char *buf, int bufsize);
-extern int atoi(const char *str);
-extern int perror(const char *str);
-
-extern int socket (int af, int type, int protocol);
-extern int bind (int s, struct sockaddr *name, int namelen);
-extern int chdir (const char *path);
-
-#endif
-
-
-#if (defined(__sun__) || defined(sun)) && defined(__svr4__)
-
-extern char *strdup(const char *str);
-
-#define NEED_GETHOSTNAME
-#define NEED_SVCSOC_H
-
-#endif
-
-
-#if defined(hpux) || defined(__hpux__)
-
-/* HP is really... Ah well. */
-
-#define _INCLUDE_HPUX_SOURCE
-#define _INCLUDE_XOPEN_SOURCE
-#define _INCLUDE_POSIX_SOURCE
-#define _INCLUDE_AES_SOURCE
-
-extern void svcerr_systemerr();
-#endif
-
-
-#if defined(linux) || defined(__linux__)
-
-/* Need this because some header files doesn't check for __linux__ */
-#if !defined(linux)
-#define linux linux
-#endif
-
-/* Needed for non-ANSI prototypes */
-#define _SVID_SOURCE
-
-/* Needed for gethostname() */
-#define _BSD_SOURCE
-
-#endif
diff --git a/gnu/usr.sbin/ypserv/yp.h b/gnu/usr.sbin/ypserv/yp.h
deleted file mode 100644
index 5a3b33a..0000000
--- a/gnu/usr.sbin/ypserv/yp.h
+++ /dev/null
@@ -1,611 +0,0 @@
-/*
- * And thus spoke RPCGEN:
- * Please do not edit this file.
- * It was generated using rpcgen.
- *
- * And thus replied Lpd@NannyMUD:
- * Who cares? :-) /Peter Eriksson <pen@signum.se>
- *
- *
- * Modification history:
- * 940716 pen@signum.se Change "ypreq_key" to "ypreq_nokey" for FIRST.
- *
- * $Id: yp.h,v 1.1 1995/01/31 08:58:55 wpaul Exp $
- */
-
-#ifndef _YP_H_RPCGEN
-#define _YP_H_RPCGEN
-
-#include <rpc/rpc.h>
-#ifdef NEED_SVCSOC_H
-#include <rpc/svc_soc.h>
-#endif
-
-#define YPMAXRECORD 1024
-#define YPMAXDOMAIN 64
-#define YPMAXMAP 64
-#define 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
-};
-typedef enum ypstat ypstat;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypstat(XDR *, ypstat*);
-#elif __STDC__
-extern bool_t __xdr_ypstat(XDR *, ypstat*);
-#else /* Old Style C */
-bool_t __xdr_ypstat();
-#endif /* Old Style C */
-
-
-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 enum ypxfrstat ypxfrstat;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypxfrstat(XDR *, ypxfrstat*);
-#elif __STDC__
-extern bool_t __xdr_ypxfrstat(XDR *, ypxfrstat*);
-#else /* Old Style C */
-bool_t __xdr_ypxfrstat();
-#endif /* Old Style C */
-
-
-typedef char *domainname;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_domainname(XDR *, domainname*);
-#elif __STDC__
-extern bool_t __xdr_domainname(XDR *, domainname*);
-#else /* Old Style C */
-bool_t __xdr_domainname();
-#endif /* Old Style C */
-
-
-typedef char *mapname;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_mapname(XDR *, mapname*);
-#elif __STDC__
-extern bool_t __xdr_mapname(XDR *, mapname*);
-#else /* Old Style C */
-bool_t __xdr_mapname();
-#endif /* Old Style C */
-
-
-typedef char *peername;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_peername(XDR *, peername*);
-#elif __STDC__
-extern bool_t __xdr_peername(XDR *, peername*);
-#else /* Old Style C */
-bool_t __xdr_peername();
-#endif /* Old Style C */
-
-
-typedef struct {
- u_int keydat_len;
- char *keydat_val;
-} keydat;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_keydat(XDR *, keydat*);
-#elif __STDC__
-extern bool_t __xdr_keydat(XDR *, keydat*);
-#else /* Old Style C */
-bool_t __xdr_keydat();
-#endif /* Old Style C */
-
-
-typedef struct {
- u_int valdat_len;
- char *valdat_val;
-} valdat;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_valdat(XDR *, valdat*);
-#elif __STDC__
-extern bool_t __xdr_valdat(XDR *, valdat*);
-#else /* Old Style C */
-bool_t __xdr_valdat();
-#endif /* Old Style C */
-
-
-struct ypmap_parms {
- domainname domain;
- mapname map;
- u_int ordernum;
- peername peer;
-};
-typedef struct ypmap_parms ypmap_parms;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypmap_parms(XDR *, ypmap_parms*);
-#elif __STDC__
-extern bool_t __xdr_ypmap_parms(XDR *, ypmap_parms*);
-#else /* Old Style C */
-bool_t __xdr_ypmap_parms();
-#endif /* Old Style C */
-
-
-struct ypreq_key {
- domainname domain;
- mapname map;
- keydat key;
-};
-typedef struct ypreq_key ypreq_key;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypreq_key(XDR *, ypreq_key*);
-#elif __STDC__
-extern bool_t __xdr_ypreq_key(XDR *, ypreq_key*);
-#else /* Old Style C */
-bool_t __xdr_ypreq_key();
-#endif /* Old Style C */
-
-
-struct ypreq_nokey {
- domainname domain;
- mapname map;
-};
-typedef struct ypreq_nokey ypreq_nokey;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypreq_nokey(XDR *, ypreq_nokey*);
-#elif __STDC__
-extern bool_t __xdr_ypreq_nokey(XDR *, ypreq_nokey*);
-#else /* Old Style C */
-bool_t __xdr_ypreq_nokey();
-#endif /* Old Style C */
-
-
-struct ypreq_xfr {
- ypmap_parms map_parms;
- u_int transid;
- u_int prog;
- u_int port;
-};
-typedef struct ypreq_xfr ypreq_xfr;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypreq_xfr(XDR *, ypreq_xfr*);
-#elif __STDC__
-extern bool_t __xdr_ypreq_xfr(XDR *, ypreq_xfr*);
-#else /* Old Style C */
-bool_t __xdr_ypreq_xfr();
-#endif /* Old Style C */
-
-
-struct ypresp_val {
- ypstat stat;
- valdat val;
-};
-typedef struct ypresp_val ypresp_val;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypresp_val(XDR *, ypresp_val*);
-#elif __STDC__
-extern bool_t __xdr_ypresp_val(XDR *, ypresp_val*);
-#else /* Old Style C */
-bool_t __xdr_ypresp_val();
-#endif /* Old Style C */
-
-
-struct ypresp_key_val {
- ypstat stat;
- keydat key;
- valdat val;
-};
-typedef struct ypresp_key_val ypresp_key_val;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypresp_key_val(XDR *, ypresp_key_val*);
-#elif __STDC__
-extern bool_t __xdr_ypresp_key_val(XDR *, ypresp_key_val*);
-#else /* Old Style C */
-bool_t __xdr_ypresp_key_val();
-#endif /* Old Style C */
-
-
-struct ypresp_master {
- ypstat stat;
- peername peer;
-};
-typedef struct ypresp_master ypresp_master;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypresp_master(XDR *, ypresp_master*);
-#elif __STDC__
-extern bool_t __xdr_ypresp_master(XDR *, ypresp_master*);
-#else /* Old Style C */
-bool_t __xdr_ypresp_master();
-#endif /* Old Style C */
-
-
-struct ypresp_order {
- ypstat stat;
- u_int ordernum;
-};
-typedef struct ypresp_order ypresp_order;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypresp_order(XDR *, ypresp_order*);
-#elif __STDC__
-extern bool_t __xdr_ypresp_order(XDR *, ypresp_order*);
-#else /* Old Style C */
-bool_t __xdr_ypresp_order();
-#endif /* Old Style C */
-
-
-typedef struct
-{
- struct
- {
- int (*encode)(ypresp_key_val *val, void *data);
- int (*close)(void *data);
- } u;
- void *data;
-} __xdr_ypall_cb_t;
-
-
-struct ypresp_all {
- bool_t more;
- union {
- ypresp_key_val val;
- } ypresp_all_u;
-};
-typedef struct ypresp_all ypresp_all;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypresp_all(XDR *, ypresp_all*);
-#elif __STDC__
-extern bool_t __xdr_ypresp_all(XDR *, ypresp_all*);
-#else /* Old Style C */
-bool_t __xdr_ypresp_all();
-#endif /* Old Style C */
-
-
-struct ypresp_xfr {
- u_int transid;
- ypxfrstat xfrstat;
-};
-typedef struct ypresp_xfr ypresp_xfr;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypresp_xfr(XDR *, ypresp_xfr*);
-#elif __STDC__
-extern bool_t __xdr_ypresp_xfr(XDR *, ypresp_xfr*);
-#else /* Old Style C */
-bool_t __xdr_ypresp_xfr();
-#endif /* Old Style C */
-
-
-struct ypmaplist {
- mapname map;
- struct ypmaplist *next;
-};
-typedef struct ypmaplist ypmaplist;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypmaplist(XDR *, ypmaplist*);
-#elif __STDC__
-extern bool_t __xdr_ypmaplist(XDR *, ypmaplist*);
-#else /* Old Style C */
-bool_t __xdr_ypmaplist();
-#endif /* Old Style C */
-
-
-struct ypresp_maplist {
- ypstat stat;
- ypmaplist *maps;
-};
-typedef struct ypresp_maplist ypresp_maplist;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypresp_maplist(XDR *, ypresp_maplist*);
-#elif __STDC__
-extern bool_t __xdr_ypresp_maplist(XDR *, ypresp_maplist*);
-#else /* Old Style C */
-bool_t __xdr_ypresp_maplist();
-#endif /* Old Style C */
-
-
-enum yppush_status {
- YPPUSH_SUCC = 1,
- YPPUSH_AGE = 2,
- YPPUSH_NOMAP = -1,
- YPPUSH_NODOM = -2,
- YPPUSH_RSRC = -3,
- YPPUSH_RPC = -4,
- YPPUSH_MADDR = -5,
- YPPUSH_YPERR = -6,
- YPPUSH_BADARGS = -7,
- YPPUSH_DBM = -8,
- YPPUSH_FILE = -9,
- YPPUSH_SKEW = -10,
- YPPUSH_CLEAR = -11,
- YPPUSH_FORCE = -12,
- YPPUSH_XFRERR = -13,
- YPPUSH_REFUSED = -14
-};
-typedef enum yppush_status yppush_status;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_yppush_status(XDR *, yppush_status*);
-#elif __STDC__
-extern bool_t __xdr_yppush_status(XDR *, yppush_status*);
-#else /* Old Style C */
-bool_t __xdr_yppush_status();
-#endif /* Old Style C */
-
-
-struct yppushresp_xfr {
- u_int transid;
- yppush_status status;
-};
-typedef struct yppushresp_xfr yppushresp_xfr;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_yppushresp_xfr(XDR *, yppushresp_xfr*);
-#elif __STDC__
-extern bool_t __xdr_yppushresp_xfr(XDR *, yppushresp_xfr*);
-#else /* Old Style C */
-bool_t __xdr_yppushresp_xfr();
-#endif /* Old Style C */
-
-
-enum ypbind_resptype {
- YPBIND_SUCC_VAL = 1,
- YPBIND_FAIL_VAL = 2
-};
-typedef enum ypbind_resptype ypbind_resptype;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypbind_resptype(XDR *, ypbind_resptype*);
-#elif __STDC__
-extern bool_t __xdr_ypbind_resptype(XDR *, ypbind_resptype*);
-#else /* Old Style C */
-bool_t __xdr_ypbind_resptype();
-#endif /* Old Style C */
-
-
-struct ypbind_binding {
- char ypbind_binding_addr[4];
- char ypbind_binding_port[2];
-};
-typedef struct ypbind_binding ypbind_binding;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypbind_binding(XDR *, ypbind_binding*);
-#elif __STDC__
-extern bool_t __xdr_ypbind_binding(XDR *, ypbind_binding*);
-#else /* Old Style C */
-bool_t __xdr_ypbind_binding();
-#endif /* Old Style C */
-
-
-struct ypbind_resp {
- ypbind_resptype ypbind_status;
- union {
- u_int ypbind_error;
- ypbind_binding ypbind_bindinfo;
- } ypbind_resp_u;
-};
-typedef struct ypbind_resp ypbind_resp;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypbind_resp(XDR *, ypbind_resp*);
-#elif __STDC__
-extern bool_t __xdr_ypbind_resp(XDR *, ypbind_resp*);
-#else /* Old Style C */
-bool_t __xdr_ypbind_resp();
-#endif /* Old Style C */
-
-#define YPBIND_ERR_ERR 1
-#define YPBIND_ERR_NOSERV 2
-#define YPBIND_ERR_RESC 3
-
-struct ypbind_setdom {
- domainname ypsetdom_domain;
- ypbind_binding ypsetdom_binding;
- u_int ypsetdom_vers;
-};
-typedef struct ypbind_setdom ypbind_setdom;
-#ifdef __cplusplus
-extern "C" bool_t __xdr_ypbind_setdom(XDR *, ypbind_setdom*);
-#elif __STDC__
-extern bool_t __xdr_ypbind_setdom(XDR *, ypbind_setdom*);
-#else /* Old Style C */
-bool_t __xdr_ypbind_setdom();
-#endif /* Old Style C */
-
-
-#define YPPROG ((u_long)100004)
-#define YPVERS ((u_long)2)
-
-#ifdef __cplusplus
-#define YPPROC_NULL ((u_long)0)
-extern "C" void * ypproc_null_2(void *, CLIENT *);
-extern "C" void * ypproc_null_2_svc(void *, struct svc_req *);
-#define YPPROC_DOMAIN ((u_long)1)
-extern "C" bool_t * ypproc_domain_2(domainname *, CLIENT *);
-extern "C" bool_t * ypproc_domain_2_svc(domainname *, struct svc_req *);
-#define YPPROC_DOMAIN_NONACK ((u_long)2)
-extern "C" bool_t * ypproc_domain_nonack_2(domainname *, CLIENT *);
-extern "C" bool_t * ypproc_domain_nonack_2_svc(domainname *, struct svc_req *);
-#define YPPROC_MATCH ((u_long)3)
-extern "C" ypresp_val * ypproc_match_2(ypreq_key *, CLIENT *);
-extern "C" ypresp_val * ypproc_match_2_svc(ypreq_key *, struct svc_req *);
-#define YPPROC_FIRST ((u_long)4)
-extern "C" ypresp_key_val * ypproc_first_2(ypreq_nokey *, CLIENT *);
-extern "C" ypresp_key_val * ypproc_first_2_svc(ypreq_nokey *, struct svc_req *);
-#define YPPROC_NEXT ((u_long)5)
-extern "C" ypresp_key_val * ypproc_next_2(ypreq_key *, CLIENT *);
-extern "C" ypresp_key_val * ypproc_next_2_svc(ypreq_key *, struct svc_req *);
-#define YPPROC_XFR ((u_long)6)
-extern "C" ypresp_xfr * ypproc_xfr_2(ypreq_xfr *, CLIENT *);
-extern "C" ypresp_xfr * ypproc_xfr_2_svc(ypreq_xfr *, struct svc_req *);
-#define YPPROC_CLEAR ((u_long)7)
-extern "C" void * ypproc_clear_2(void *, CLIENT *);
-extern "C" void * ypproc_clear_2_svc(void *, struct svc_req *);
-#define YPPROC_ALL ((u_long)8)
-extern "C" ypresp_all * ypproc_all_2(ypreq_nokey *, CLIENT *);
-extern "C" ypresp_all * ypproc_all_2_svc(ypreq_nokey *, struct svc_req *);
-#define YPPROC_MASTER ((u_long)9)
-extern "C" ypresp_master * ypproc_master_2(ypreq_nokey *, CLIENT *);
-extern "C" ypresp_master * ypproc_master_2_svc(ypreq_nokey *, struct svc_req *);
-#define YPPROC_ORDER ((u_long)10)
-extern "C" ypresp_order * ypproc_order_2(ypreq_nokey *, CLIENT *);
-extern "C" ypresp_order * ypproc_order_2_svc(ypreq_nokey *, struct svc_req *);
-#define YPPROC_MAPLIST ((u_long)11)
-extern "C" ypresp_maplist * ypproc_maplist_2(domainname *, CLIENT *);
-extern "C" ypresp_maplist * ypproc_maplist_2_svc(domainname *, struct svc_req *);
-
-#elif __STDC__
-#define YPPROC_NULL ((u_long)0)
-extern void * ypproc_null_2(void *, CLIENT *);
-extern void * ypproc_null_2_svc(void *, struct svc_req *);
-#define YPPROC_DOMAIN ((u_long)1)
-extern bool_t * ypproc_domain_2(domainname *, CLIENT *);
-extern bool_t * ypproc_domain_2_svc(domainname *, struct svc_req *);
-#define YPPROC_DOMAIN_NONACK ((u_long)2)
-extern bool_t * ypproc_domain_nonack_2(domainname *, CLIENT *);
-extern bool_t * ypproc_domain_nonack_2_svc(domainname *, struct svc_req *);
-#define YPPROC_MATCH ((u_long)3)
-extern ypresp_val * ypproc_match_2(ypreq_key *, CLIENT *);
-extern ypresp_val * ypproc_match_2_svc(ypreq_key *, struct svc_req *);
-#define YPPROC_FIRST ((u_long)4)
-extern ypresp_key_val * ypproc_first_2(ypreq_nokey *, CLIENT *);
-extern ypresp_key_val * ypproc_first_2_svc(ypreq_nokey *, struct svc_req *);
-#define YPPROC_NEXT ((u_long)5)
-extern ypresp_key_val * ypproc_next_2(ypreq_key *, CLIENT *);
-extern ypresp_key_val * ypproc_next_2_svc(ypreq_key *, struct svc_req *);
-#define YPPROC_XFR ((u_long)6)
-extern ypresp_xfr * ypproc_xfr_2(ypreq_xfr *, CLIENT *);
-extern ypresp_xfr * ypproc_xfr_2_svc(ypreq_xfr *, struct svc_req *);
-#define YPPROC_CLEAR ((u_long)7)
-extern void * ypproc_clear_2(void *, CLIENT *);
-extern void * ypproc_clear_2_svc(void *, struct svc_req *);
-#define YPPROC_ALL ((u_long)8)
-extern ypresp_all * ypproc_all_2(ypreq_nokey *, CLIENT *);
-extern ypresp_all * ypproc_all_2_svc(ypreq_nokey *, struct svc_req *);
-#define YPPROC_MASTER ((u_long)9)
-extern ypresp_master * ypproc_master_2(ypreq_nokey *, CLIENT *);
-extern ypresp_master * ypproc_master_2_svc(ypreq_nokey *, struct svc_req *);
-#define YPPROC_ORDER ((u_long)10)
-extern ypresp_order * ypproc_order_2(ypreq_nokey *, CLIENT *);
-extern ypresp_order * ypproc_order_2_svc(ypreq_nokey *, struct svc_req *);
-#define YPPROC_MAPLIST ((u_long)11)
-extern ypresp_maplist * ypproc_maplist_2(domainname *, CLIENT *);
-extern ypresp_maplist * ypproc_maplist_2_svc(domainname *, struct svc_req *);
-
-#else /* Old Style C */
-#define YPPROC_NULL ((u_long)0)
-extern void * ypproc_null_2();
-extern void * ypproc_null_2_svc();
-#define YPPROC_DOMAIN ((u_long)1)
-extern bool_t * ypproc_domain_2();
-extern bool_t * ypproc_domain_2_svc();
-#define YPPROC_DOMAIN_NONACK ((u_long)2)
-extern bool_t * ypproc_domain_nonack_2();
-extern bool_t * ypproc_domain_nonack_2_svc();
-#define YPPROC_MATCH ((u_long)3)
-extern ypresp_val * ypproc_match_2();
-extern ypresp_val * ypproc_match_2_svc();
-#define YPPROC_FIRST ((u_long)4)
-extern ypresp_key_val * ypproc_first_2();
-extern ypresp_key_val * ypproc_first_2_svc();
-#define YPPROC_NEXT ((u_long)5)
-extern ypresp_key_val * ypproc_next_2();
-extern ypresp_key_val * ypproc_next_2_svc();
-#define YPPROC_XFR ((u_long)6)
-extern ypresp_xfr * ypproc_xfr_2();
-extern ypresp_xfr * ypproc_xfr_2_svc();
-#define YPPROC_CLEAR ((u_long)7)
-extern void * ypproc_clear_2();
-extern void * ypproc_clear_2_svc();
-#define YPPROC_ALL ((u_long)8)
-extern ypresp_all * ypproc_all_2();
-extern ypresp_all * ypproc_all_2_svc();
-#define YPPROC_MASTER ((u_long)9)
-extern ypresp_master * ypproc_master_2();
-extern ypresp_master * ypproc_master_2_svc();
-#define YPPROC_ORDER ((u_long)10)
-extern ypresp_order * ypproc_order_2();
-extern ypresp_order * ypproc_order_2_svc();
-#define YPPROC_MAPLIST ((u_long)11)
-extern ypresp_maplist * ypproc_maplist_2();
-extern ypresp_maplist * ypproc_maplist_2_svc();
-#endif /* Old Style C */
-
-#define YPPUSH_XFRRESPPROG ((u_long)0x40000000)
-#define YPPUSH_XFRRESPVERS ((u_long)1)
-
-#ifdef __cplusplus
-#define YPPUSHPROC_NULL ((u_long)0)
-extern "C" void * yppushproc_null_1(void *, CLIENT *);
-extern "C" void * yppushproc_null_1_svc(void *, struct svc_req *);
-#define YPPUSHPROC_XFRRESP ((u_long)1)
-extern "C" yppushresp_xfr * yppushproc_xfrresp_1(void *, CLIENT *);
-extern "C" yppushresp_xfr * yppushproc_xfrresp_1_svc(void *, struct svc_req *);
-
-#elif __STDC__
-#define YPPUSHPROC_NULL ((u_long)0)
-extern void * yppushproc_null_1(void *, CLIENT *);
-extern void * yppushproc_null_1_svc(void *, struct svc_req *);
-#define YPPUSHPROC_XFRRESP ((u_long)1)
-extern yppushresp_xfr * yppushproc_xfrresp_1(void *, CLIENT *);
-extern yppushresp_xfr * yppushproc_xfrresp_1_svc(void *, struct svc_req *);
-
-#else /* Old Style C */
-#define YPPUSHPROC_NULL ((u_long)0)
-extern void * yppushproc_null_1();
-extern void * yppushproc_null_1_svc();
-#define YPPUSHPROC_XFRRESP ((u_long)1)
-extern yppushresp_xfr * yppushproc_xfrresp_1();
-extern yppushresp_xfr * yppushproc_xfrresp_1_svc();
-#endif /* Old Style C */
-
-#define YPBINDPROG ((u_long)100007)
-#define YPBINDVERS ((u_long)2)
-
-#ifdef __cplusplus
-#define YPBINDPROC_NULL ((u_long)0)
-extern "C" void * ypbindproc_null_2(void *, CLIENT *);
-extern "C" void * ypbindproc_null_2_svc(void *, struct svc_req *);
-#define YPBINDPROC_DOMAIN ((u_long)1)
-extern "C" ypbind_resp * ypbindproc_domain_2(domainname *, CLIENT *);
-extern "C" ypbind_resp * ypbindproc_domain_2_svc(domainname *, struct svc_req *);
-#define YPBINDPROC_SETDOM ((u_long)2)
-extern "C" void * ypbindproc_setdom_2(ypbind_setdom *, CLIENT *);
-extern "C" void * ypbindproc_setdom_2_svc(ypbind_setdom *, struct svc_req *);
-
-#elif __STDC__
-#define YPBINDPROC_NULL ((u_long)0)
-extern void * ypbindproc_null_2(void *, CLIENT *);
-extern void * ypbindproc_null_2_svc(void *, struct svc_req *);
-#define YPBINDPROC_DOMAIN ((u_long)1)
-extern ypbind_resp * ypbindproc_domain_2(domainname *, CLIENT *);
-extern ypbind_resp * ypbindproc_domain_2_svc(domainname *, struct svc_req *);
-#define YPBINDPROC_SETDOM ((u_long)2)
-extern void * ypbindproc_setdom_2(ypbind_setdom *, CLIENT *);
-extern void * ypbindproc_setdom_2_svc(ypbind_setdom *, struct svc_req *);
-
-#else /* Old Style C */
-#define YPBINDPROC_NULL ((u_long)0)
-extern void * ypbindproc_null_2();
-extern void * ypbindproc_null_2_svc();
-#define YPBINDPROC_DOMAIN ((u_long)1)
-extern ypbind_resp * ypbindproc_domain_2();
-extern ypbind_resp * ypbindproc_domain_2_svc();
-#define YPBINDPROC_SETDOM ((u_long)2)
-extern void * ypbindproc_setdom_2();
-extern void * ypbindproc_setdom_2_svc();
-#endif /* Old Style C */
-
-#endif /* !_YP_H_RPCGEN */
diff --git a/gnu/usr.sbin/ypserv/yp_svc.c b/gnu/usr.sbin/ypserv/yp_svc.c
deleted file mode 100644
index 739a0e3..0000000
--- a/gnu/usr.sbin/ypserv/yp_svc.c
+++ /dev/null
@@ -1,430 +0,0 @@
-/*
- * And thus spoke RPCGEN:
- * Please do not edit this file.
- * It was generated using rpcgen.
- *
- * And thus replied Lpd@NannyMUD:
- * Who cares? :-) /Peter Eriksson <pen@signum.se>
- *
- * $Id: yp_svc.c,v 1.5 1995/07/08 21:42:59 ats Exp $
- */
-
-#include "system.h"
-
-#include "yp.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <rpc/pmap_clnt.h>
-#include <string.h>
-#include <memory.h>
-#include <unistd.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <syslog.h>
-#include <errno.h>
-#include <paths.h>
-#include <signal.h>
-
-extern int errno;
-extern void Perror __P((char *, ...));
-extern void my_svc_run __P((void));
-extern void reapchild __P((int));
-
-#ifdef __STDC__
-#define SIG_PF void(*)(int)
-#endif
-
-static void
-ypprog_2(struct svc_req *rqstp, register SVCXPRT *transp)
-{
- union {
- domainname ypproc_domain_2_arg;
- domainname ypproc_domain_nonack_2_arg;
- ypreq_key ypproc_match_2_arg;
- ypreq_key ypproc_first_2_arg;
- ypreq_key ypproc_next_2_arg;
- ypreq_xfr ypproc_xfr_2_arg;
- ypreq_nokey ypproc_all_2_arg;
- ypreq_nokey ypproc_master_2_arg;
- ypreq_nokey ypproc_order_2_arg;
- domainname ypproc_maplist_2_arg;
- } argument;
- char *result;
- xdrproc_t __xdr_argument, __xdr_result;
- char *(*local)(char *, struct svc_req *);
-
- switch (rqstp->rq_proc) {
- case YPPROC_NULL:
- __xdr_argument = (xdrproc_t) xdr_void;
- __xdr_result = (xdrproc_t) xdr_void;
- local = (char *(*)(char *, struct svc_req *)) ypproc_null_2_svc;
- break;
-
- case YPPROC_DOMAIN:
- __xdr_argument = (xdrproc_t) __xdr_domainname;
- __xdr_result = (xdrproc_t) xdr_bool;
- local = (char *(*)(char *, struct svc_req *)) ypproc_domain_2_svc;
- break;
-
- case YPPROC_DOMAIN_NONACK:
- __xdr_argument = (xdrproc_t) __xdr_domainname;
- __xdr_result = (xdrproc_t) xdr_bool;
- local = (char *(*)(char *, struct svc_req *)) ypproc_domain_nonack_2_svc;
- break;
-
- case YPPROC_MATCH:
- __xdr_argument = (xdrproc_t) __xdr_ypreq_key;
- __xdr_result = (xdrproc_t) __xdr_ypresp_val;
- local = (char *(*)(char *, struct svc_req *)) ypproc_match_2_svc;
- break;
-
- case YPPROC_FIRST:
-#if 0 /* Bug in Sun's yp.x RPC prototype file */
- __xdr_argument = (xdrproc_t) __xdr_ypreq_key;
-#else
- __xdr_argument = (xdrproc_t) __xdr_ypreq_nokey;
-#endif
- __xdr_result = (xdrproc_t) __xdr_ypresp_key_val;
- local = (char *(*)(char *, struct svc_req *)) ypproc_first_2_svc;
- break;
-
- case YPPROC_NEXT:
- __xdr_argument = (xdrproc_t) __xdr_ypreq_key;
- __xdr_result = (xdrproc_t) __xdr_ypresp_key_val;
- local = (char *(*)(char *, struct svc_req *)) ypproc_next_2_svc;
- break;
-
- case YPPROC_XFR:
- __xdr_argument = (xdrproc_t) __xdr_ypreq_xfr;
- __xdr_result = (xdrproc_t) __xdr_ypresp_xfr;
- local = (char *(*)(char *, struct svc_req *)) ypproc_xfr_2_svc;
- break;
-
- case YPPROC_CLEAR:
- __xdr_argument = (xdrproc_t) xdr_void;
- __xdr_result = (xdrproc_t) xdr_void;
- local = (char *(*)(char *, struct svc_req *)) ypproc_clear_2_svc;
- break;
-
- case YPPROC_ALL:
- __xdr_argument = (xdrproc_t) __xdr_ypreq_nokey;
- __xdr_result = (xdrproc_t) __xdr_ypresp_all;
- local = (char *(*)(char *, struct svc_req *)) ypproc_all_2_svc;
- break;
-
- case YPPROC_MASTER:
- __xdr_argument = (xdrproc_t) __xdr_ypreq_nokey;
- __xdr_result = (xdrproc_t) __xdr_ypresp_master;
- local = (char *(*)(char *, struct svc_req *)) ypproc_master_2_svc;
- break;
-
- case YPPROC_ORDER:
- __xdr_argument = (xdrproc_t) __xdr_ypreq_nokey;
- __xdr_result = (xdrproc_t) __xdr_ypresp_order;
- local = (char *(*)(char *, struct svc_req *)) ypproc_order_2_svc;
- break;
-
- case YPPROC_MAPLIST:
- __xdr_argument = (xdrproc_t) __xdr_domainname;
- __xdr_result = (xdrproc_t) __xdr_ypresp_maplist;
- local = (char *(*)(char *, struct svc_req *)) ypproc_maplist_2_svc;
- break;
-
- default:
- svcerr_noproc(transp);
- return;
- }
- (void) memset((char *)&argument, 0, sizeof (argument));
- if (!svc_getargs(transp, __xdr_argument, (caddr_t) &argument)) {
- svcerr_decode(transp);
- return;
- }
- result = (*local)((char *)&argument, rqstp);
- if (result != NULL && !svc_sendreply(transp, __xdr_result, result)) {
- svcerr_systemerr(transp);
- }
- if (!svc_freeargs(transp, __xdr_argument, (caddr_t) &argument)) {
- fprintf(stderr, "unable to free arguments");
- exit(1);
- }
- return;
-}
-
-#if 0
-static void
-yppush_xfrrespprog_1(struct svc_req *rqstp, register SVCXPRT *transp)
-{
- union {
- int fill;
- } argument;
- char *result;
- xdrproc_t __xdr_argument, __xdr_result;
- char *(*local)(char *, struct svc_req *);
-
- switch (rqstp->rq_proc) {
- case YPPUSHPROC_NULL:
- __xdr_argument = (xdrproc_t) xdr_void;
- __xdr_result = (xdrproc_t) xdr_void;
- local = (char *(*)(char *, struct svc_req *)) yppushproc_null_1_svc;
- break;
-
- case YPPUSHPROC_XFRRESP:
- __xdr_argument = (xdrproc_t) xdr_void;
- __xdr_result = (xdrproc_t) __xdr_yppushresp_xfr;
- local = (char *(*)(char *, struct svc_req *)) yppushproc_xfrresp_1_svc;
- break;
-
- default:
- svcerr_noproc(transp);
- return;
- }
- (void) memset((char *)&argument, 0, sizeof (argument));
- if (!svc_getargs(transp, __xdr_argument, (caddr_t) &argument)) {
- svcerr_decode(transp);
- return;
- }
- result = (*local)((char *)&argument, rqstp);
- if (result != NULL && !svc_sendreply(transp, __xdr_result, result)) {
- svcerr_systemerr(transp);
- }
- if (!svc_freeargs(transp, __xdr_argument, (caddr_t) &argument)) {
- fprintf(stderr, "unable to free arguments");
- exit(1);
- }
- return;
-}
-
-static void
-ypbindprog_2(struct svc_req *rqstp, register SVCXPRT *transp)
-{
- union {
- domainname ypbindproc_domain_2_arg;
- ypbind_setdom ypbindproc_setdom_2_arg;
- } argument;
- char *result;
- xdrproc_t __xdr_argument, __xdr_result;
- char *(*local)(char *, struct svc_req *);
-
- switch (rqstp->rq_proc) {
- case YPBINDPROC_NULL:
- __xdr_argument = (xdrproc_t) xdr_void;
- __xdr_result = (xdrproc_t) xdr_void;
- local = (char *(*)(char *, struct svc_req *)) ypbindproc_null_2_svc;
- break;
-
- case YPBINDPROC_DOMAIN:
- __xdr_argument = (xdrproc_t) __xdr_domainname;
- __xdr_result = (xdrproc_t) __xdr_ypbind_resp;
- local = (char *(*)(char *, struct svc_req *)) ypbindproc_domain_2_svc;
- break;
-
- case YPBINDPROC_SETDOM:
- __xdr_argument = (xdrproc_t) __xdr_ypbind_setdom;
- __xdr_result = (xdrproc_t) xdr_void;
- local = (char *(*)(char *, struct svc_req *)) ypbindproc_setdom_2_svc;
- break;
-
- default:
- svcerr_noproc(transp);
- return;
- }
- (void) memset((char *)&argument, 0, sizeof (argument));
- if (!svc_getargs(transp, __xdr_argument, (caddr_t) &argument)) {
- svcerr_decode(transp);
- return;
- }
- result = (*local)((char *)&argument, rqstp);
- if (result != NULL && !svc_sendreply(transp, __xdr_result, result)) {
- svcerr_systemerr(transp);
- }
- if (!svc_freeargs(transp, __xdr_argument, (caddr_t) &argument)) {
- fprintf(stderr, "unable to free arguments");
- exit(1);
- }
- return;
-}
-#endif
-
-extern int debug_flag;
-extern int dns_flag;
-
-#ifndef _PATH_YP
-#define _PATH_YP "/var/yp"
-#endif
-char *path_ypdb = _PATH_YP;
-
-char *progname;
-
-
-int main(int argc, char **argv)
-{
- register SVCXPRT *transp;
- int i;
- int my_port = -1;
- int my_socket;
- struct sockaddr_in socket_address;
- int result;
- int sunos_4_kludge = 0;
- struct sigaction sa;
-
- progname = strrchr (argv[0], '/');
- if (progname == (char *) NULL)
- progname = argv[0];
- else
- progname++;
-
- openlog(progname, LOG_PID, TCPW_FACILITY);
-
- for (i = 1; i < argc && argv[i][0] == '-'; i++)
- {
- if (strcmp(argv[i], "-debug") == 0 || strcmp(argv[i], "-d") == 0)
- debug_flag = 1;
- else if (strcmp(argv[i], "-dns") == 0 || strcmp(argv[i], "-b") == 0)
- dns_flag = 1;
- else if ((argv[i][1] == 'p') && (argv[i][2] >= '0') && (argv[i][2] <= '9'))
- my_port = atoi(argv[i] + 2);
- else if (strcmp(argv[i], "-k") == 0)
- sunos_4_kludge = 1;
- else
- {
- fprintf(stderr, "%s: Unknown command line switch: %s\n",
- progname,
- argv[i]);
- exit(1);
- }
- }
-
- if (!debug_flag)
- if(daemon(0,0))
- {
- perror("daemon()");
- exit (1);
- }
-
- if (debug_flag)
- Perror("[Welcome to the NYS YP Server, version 0.13]\n");
-
- if (i < argc)
- {
- path_ypdb = argv[i];
- if (debug_flag)
- Perror("Using database directory: %s\n", path_ypdb);
- }
-
- /* Change current directory to database location */
- if (chdir(path_ypdb) < 0)
- {
- Perror("%s: chdir: %", argv[0], strerror(errno));
- exit(1);
- }
-
- /*
- * Ignore SIGPIPEs. They can hurt us if someone does a ypcat
- * and then hits CTRL-C before it terminates.
- */
- sigaction(SIGPIPE, NULL, &sa);
- sa.sa_handler = SIG_IGN;
- sa.sa_flags |= SA_RESTART;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGPIPE, &sa, NULL);
- sigaction(SIGCHLD, NULL, &sa);
- sa.sa_flags |= SA_RESTART;
- sa.sa_handler = reapchild;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGCHLD, &sa, NULL);
-
- (void) pmap_unset(YPPROG, YPVERS);
- if (sunos_4_kludge)
- (void) pmap_unset(YPPROG, 1);
-
- if (my_port >= 0)
- {
- my_socket = socket (AF_INET, SOCK_DGRAM, 0);
- if (my_socket < 0)
- {
- Perror("%s: can not create UDP: %s",
- progname, strerror(errno));
- exit (1);
- }
-
- socket_address.sin_family = AF_INET;
- socket_address.sin_addr.s_addr = htonl (INADDR_ANY);
- socket_address.sin_port = htons (my_port);
-
- result = bind (my_socket, (struct sockaddr *) &socket_address,
- sizeof (socket_address));
- if (result < 0)
- {
- Perror("%s: can not create UDP: %s",
- progname, strerror(errno));
- exit (1);
- }
- }
- else
- my_socket = RPC_ANYSOCK;
-
- transp = svcudp_create(my_socket);
- if (transp == NULL) {
- Perror("cannot create udp service.");
- exit(1);
- }
- if (!svc_register(transp, YPPROG, YPVERS, ypprog_2, IPPROTO_UDP)) {
- Perror("unable to register (YPPROG, YPVERS, udp).");
- exit(1);
- }
-
- if (sunos_4_kludge) {
- /*
- ** This is just to make us reply to YP version 1 calls which SunOS 4's
- ** ypbind seems to insist on finding. If someone _really_ tries to
- ** use this the they will probably be bitten - _hard_, since I haven't
- ** got the faintest idea on how the XDR calls for YP version 1 should
- ** look like. The Domain_NoNack call seems to be compatible though :-)
- */
- if (!svc_register(transp, YPPROG, 1, ypprog_2, IPPROTO_UDP)) {
- fprintf(stderr, "unable to register (YPPROG, 1, udp).");
- exit(1);
- }
- }
-
- if (my_port >= 0)
- {
- my_socket = socket (AF_INET, SOCK_STREAM, 0);
- if (my_socket < 0)
- {
- Perror("%s: can not create TCP: %s",
- progname, strerror(errno));
- exit (1);
- }
-
- socket_address.sin_family = AF_INET;
- socket_address.sin_addr.s_addr = htonl (INADDR_ANY);
- socket_address.sin_port = htons (my_port);
-
- result = bind (my_socket, (struct sockaddr *) &socket_address,
- sizeof (socket_address));
- if (result < 0)
- {
- Perror("%s: can not create TCP: %s",
- progname, strerror(errno));
- exit (1);
- }
- }
- else
- my_socket = RPC_ANYSOCK;
-
- transp = svctcp_create(my_socket, 0, 0);
- if (transp == NULL) {
- Perror("%s: cannot create tcp service\n", progname);
- exit(1);
- }
- if (!svc_register(transp, YPPROG, YPVERS, ypprog_2, IPPROTO_TCP)) {
- Perror("%s: unable to register (YPPROG, YPVERS, tcp)\n", progname);
- exit(1);
- }
-
- my_svc_run();
- Perror("svc_run returned");
- exit(1);
- /* NOTREACHED */
-}
diff --git a/gnu/usr.sbin/ypserv/yp_xdr.c b/gnu/usr.sbin/ypserv/yp_xdr.c
deleted file mode 100644
index 9e88645..0000000
--- a/gnu/usr.sbin/ypserv/yp_xdr.c
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * And thus spoke RPCGEN:
- * Please do not edit this file.
- * It was generated using rpcgen.
- *
- * And thus replied Lpd@NannyMUD:
- * Who cares? :-) /Peter Eriksson <pen@signum.se>
- *
- *
- * Modification history:
- * 940616 pen@signum.se Major cleanups.
- * 940713 pen@signum.se Added SunOS 4 prototypes.
- *
- * $Id: yp_xdr.c,v 1.1 1995/01/31 08:58:57 wpaul Exp $
- */
-
-#include "system.h"
-
-
-#include "yp.h"
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-__xdr_ypall_cb_t __xdr_ypall_cb;
-
-bool_t
-__xdr_ypstat(XDR *xdrs, ypstat *objp)
-{
- if (!xdr_enum(xdrs, (enum_t *)objp))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_ypxfrstat(XDR *xdrs, ypxfrstat *objp)
-{
- if (!xdr_enum(xdrs, (enum_t *)objp))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_domainname(XDR *xdrs, domainname *objp)
-{
- if (!xdr_string(xdrs, objp, YPMAXDOMAIN))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_mapname(XDR *xdrs, mapname *objp)
-{
- if (!xdr_string(xdrs, objp, YPMAXMAP))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_peername(XDR *xdrs, peername *objp)
-{
- if (!xdr_string(xdrs, objp, YPMAXPEER))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_keydat(XDR *xdrs, keydat *objp)
-{
- if (!xdr_bytes(xdrs, (char **)&objp->keydat_val,
- (u_int *)&objp->keydat_len, YPMAXRECORD))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_valdat(XDR *xdrs, valdat *objp)
-{
- if (!xdr_bytes(xdrs, (char **)&objp->valdat_val,
- (u_int *)&objp->valdat_len, YPMAXRECORD))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_ypmap_parms(XDR *xdrs, ypmap_parms *objp)
-{
- if (!__xdr_domainname(xdrs, &objp->domain))
- return FALSE;
-
- if (!__xdr_mapname(xdrs, &objp->map))
- return FALSE;
-
- if (!xdr_u_int(xdrs, &objp->ordernum))
- return FALSE;
-
- if (!__xdr_peername(xdrs, &objp->peer))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_ypreq_key(XDR *xdrs, ypreq_key *objp)
-{
- if (!__xdr_domainname(xdrs, &objp->domain))
- return FALSE;
-
- if (!__xdr_mapname(xdrs, &objp->map))
- return FALSE;
-
- if (!__xdr_keydat(xdrs, &objp->key))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_ypreq_nokey(XDR *xdrs, ypreq_nokey *objp)
-{
- if (!__xdr_domainname(xdrs, &objp->domain))
- return FALSE;
-
- if (!__xdr_mapname(xdrs, &objp->map))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_ypreq_xfr(XDR *xdrs, ypreq_xfr *objp)
-{
- if (!__xdr_ypmap_parms(xdrs, &objp->map_parms))
- return FALSE;
-
- if (!xdr_u_int(xdrs, &objp->transid))
- return FALSE;
-
- if (!xdr_u_int(xdrs, &objp->prog))
- return FALSE;
-
- if (!xdr_u_int(xdrs, &objp->port))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_ypresp_val(XDR *xdrs, ypresp_val *objp)
-{
- if (!__xdr_ypstat(xdrs, &objp->stat))
- return FALSE;
-
- if (!__xdr_valdat(xdrs, &objp->val))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_ypresp_key_val(XDR *xdrs, ypresp_key_val *objp)
-{
- if (!__xdr_ypstat(xdrs, &objp->stat))
- return FALSE;
-
-#if 0 /* The Sun-supplied yp.x RPC input file have these in the wrong order */
- if (!__xdr_keydat(xdrs, &objp->key))
- return FALSE;
-
- if (!__xdr_valdat(xdrs, &objp->val))
- return FALSE;
-#else
- if (!__xdr_valdat(xdrs, &objp->val))
- return FALSE;
-
- if (!__xdr_keydat(xdrs, &objp->key))
- return FALSE;
-#endif
- return TRUE;
-}
-
-bool_t
-__xdr_ypresp_master(XDR *xdrs, ypresp_master *objp)
-{
- if (!__xdr_ypstat(xdrs, &objp->stat))
- return FALSE;
-
- if (!__xdr_peername(xdrs, &objp->peer))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_ypresp_order(XDR *xdrs, ypresp_order *objp)
-{
- if (!__xdr_ypstat(xdrs, &objp->stat))
- return FALSE;
-
- if (!xdr_u_int(xdrs, &objp->ordernum))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_ypresp_all(XDR *xdrs, ypresp_all *objp)
-{
- if (xdrs->x_op == XDR_ENCODE)
- {
- while (1)
- {
- if (!xdr_bool(xdrs, &objp->more))
- {
- if (__xdr_ypall_cb.u.close != NULL)
- (*(__xdr_ypall_cb.u.close))(__xdr_ypall_cb.data);
-
- __xdr_ypall_cb.data = NULL;
-
- return FALSE;
- }
-
- if (!__xdr_ypresp_key_val(xdrs, &objp->ypresp_all_u.val))
- {
- if (__xdr_ypall_cb.u.close != NULL)
- (*(__xdr_ypall_cb.u.close))(__xdr_ypall_cb.data);
-
- __xdr_ypall_cb.data = NULL;
-
- return FALSE;
- }
-
- if (objp->ypresp_all_u.val.stat != YP_TRUE)
- {
- objp->more = FALSE;
-
- if (__xdr_ypall_cb.u.close != NULL)
- (*(__xdr_ypall_cb.u.close))(__xdr_ypall_cb.data);
-
- __xdr_ypall_cb.data = NULL;
-
- if (!xdr_bool(xdrs, &objp->more))
- return FALSE;
-
- return TRUE;
- }
-
- if ((*__xdr_ypall_cb.u.encode)(&objp->ypresp_all_u.val,
- __xdr_ypall_cb.data) == YP_NOKEY)
- objp->more = FALSE;
- }
- }
-
-#ifdef NOTYET /* This code isn't needed in the server */
- else if (xdrs->x_op == XDR_DECODE)
- {
- int more = 0;
-
-
- while (1)
- {
- if (!xdr_bool(xdrs, &objp->more))
- return FALSE;
-
- switch (objp->more)
- {
- case TRUE:
- if (!__xdr_ypresp_key_val(xdrs, &objp->ypresp_all_u.val))
- return FALSE;
-
- if (more == 0)
- more = (*__xdr_ypall_callback->foreach.decoder)
- (&objp->ypresp_all_u.val, __xdr_ypall_callback->data);
- break;
-
- case FALSE:
- return TRUE;
-
- default:
- return FALSE;
- }
- }
- return FALSE;
- }
-#endif
-
- return TRUE;
-}
-
-bool_t
-__xdr_ypresp_xfr(XDR *xdrs, ypresp_xfr *objp)
-{
- if (!xdr_u_int(xdrs, &objp->transid))
- return FALSE;
-
- if (!__xdr_ypxfrstat(xdrs, &objp->xfrstat))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_ypmaplist(XDR *xdrs, ypmaplist *objp)
-{
- if (!__xdr_mapname(xdrs, &objp->map))
- return FALSE;
-
- if (!xdr_pointer(xdrs, (char **)&objp->next, sizeof(ypmaplist),
- (xdrproc_t)__xdr_ypmaplist))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_ypresp_maplist(XDR *xdrs, ypresp_maplist *objp)
-{
- if (!__xdr_ypstat(xdrs, &objp->stat))
- return FALSE;
-
- if (!xdr_pointer(xdrs, (char **)&objp->maps, sizeof(ypmaplist),
- (xdrproc_t)__xdr_ypmaplist))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_yppush_status(XDR *xdrs, yppush_status *objp)
-{
- if (!xdr_enum(xdrs, (enum_t *)objp))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_yppushresp_xfr(XDR *xdrs, yppushresp_xfr *objp)
-{
- if (!xdr_u_int(xdrs, &objp->transid))
- return FALSE;
-
- if (!__xdr_yppush_status(xdrs, &objp->status))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_ypbind_resptype(XDR *xdrs, ypbind_resptype *objp)
-{
- if (!xdr_enum(xdrs, (enum_t *)objp))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_ypbind_binding(XDR *xdrs, ypbind_binding *objp)
-{
- if (!xdr_opaque(xdrs, objp->ypbind_binding_addr, 4))
- return FALSE;
-
- if (!xdr_opaque(xdrs, objp->ypbind_binding_port, 2))
- return FALSE;
-
- return TRUE;
-}
-
-bool_t
-__xdr_ypbind_resp(XDR *xdrs, ypbind_resp *objp)
-{
- if (!__xdr_ypbind_resptype(xdrs, &objp->ypbind_status))
- return FALSE;
-
- switch (objp->ypbind_status)
- {
- case YPBIND_FAIL_VAL:
- if (!xdr_u_int(xdrs, &objp->ypbind_resp_u.ypbind_error))
- return FALSE;
- break;
-
- case YPBIND_SUCC_VAL:
- if (!__xdr_ypbind_binding(xdrs, &objp->ypbind_resp_u.ypbind_bindinfo))
- return FALSE;
- break;
-
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-bool_t
-__xdr_ypbind_setdom(XDR *xdrs, ypbind_setdom *objp)
-{
- if (!__xdr_domainname(xdrs, &objp->ypsetdom_domain))
- return FALSE;
-
- if (!__xdr_ypbind_binding(xdrs, &objp->ypsetdom_binding))
- return FALSE;
-
- if (!xdr_u_int(xdrs, &objp->ypsetdom_vers))
- return FALSE;
-
- return TRUE;
-}
diff --git a/gnu/usr.sbin/ypserv/ypserv.8 b/gnu/usr.sbin/ypserv/ypserv.8
deleted file mode 100644
index 43ac853..0000000
--- a/gnu/usr.sbin/ypserv/ypserv.8
+++ /dev/null
@@ -1,293 +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.
-.\"
-.\" $Id: ypserv.8,v 1.2 1995/02/07 05:04:51 wpaul Exp $
-.\"
-.Dd February 4, 1995
-.Dt YPSERV 8
-.Os
-.Sh NAME
-.Nm ypserv
-.Nd "NIS database server"
-.Sh SYNOPSIS
-.Nm ypserv
-.Op Fl dns
-.Op Fl debug
-.Op Fl k
-.Op Fl p Ar port
-.Sh DESCRIPTION
-.Nm NIS
-is an RPC-based service designed to allow a number of UNIX-based
-machines to share a common set of configuration files. Rather than
-requiring a system administrator to update several copies of files
-such as
-.Pa /etc/hosts ,
-.Pa /etc/passwd
-and
-.Pa /etc/group ,
-which tend to require frequent changes in most environments, NIS
-allows groups of computers to share one set of data which can be
-updated from a single location.
-.Pp
-.Nm ypserv
-is the server that distributes NIS databases
-to client systems within an NIS
-.Nm domain.
-Each client in an NIS domain must have its domainname set to
-one of the domains served by
-.Nm ypserv
-using the
-.Xr domainname 1
-command. The clients must also run
-.Xr ypbind 8
-in order to attach to a particular server, since it is possible to
-have serveral servers within a single NIS domain.
-.Pp
-The databases distributed by
-.Nm ypserv
-are stored in
-.Pa /var/yp/[domainname]
-where
-.Pa domainname
-is the name of the domain being served. There can be several
-such directories with different domainnames, and
-.Nm ypserv
-can handle them all.
-.Pp
-The databases, or
-.Pa maps
-as they are often called,
-are created by
-.Nm /var/yp/Makefile
-using several system files as source. The database files are in
-.Xr db 3
-format to help speed retrieval when there are many records involved.
-In FreeBSD, the
-maps are always readable and writable only by root for security
-reasons. Technically this is only necessary for the password
-maps, but since the data in the other maps can be found in
-other world-readable files anyway, it doesn't hurt and it's considered
-good general practice.
-.Pp
-.Nm ypserv
-is started by
-.Nm /etc/rc
-if it has been enabled in
-.Nm /etc/sysconfig.
-.Sh SPECIAL FEATURES
-There are some problems associated with distributing FreeBSD's password
-database via NIS: FreeBSD normally only stores encrypted passwords
-in
-.Pa /etc/master.passwd ,
-which is readable and writable only by root. By turning this file
-into an NIS map, this security feature would be completely defeated.
-.Pp
-To make up for this, the FreeBSD version of
-.Nm ypserv
-handles the
-.Pa master.passwd.byname
-and
-.Pa master.basswd.byuid
-maps in a special way. When the server receives a request to access
-either of these two maps, it will check the TCP port from which the
-request originated and return an error if the port number is greater
-than 1023. Since only the superuser is allowed to bind to TCP ports
-with values less than 1024, the server can use this test to determine
-whether or not the access request came from a privileged user.
-Any requests made by non-privileged users are therefore rejected.
-.Pp
-Furthermore, the
-.Xr getpwent 3
-routines in FreeBSD's standard C libarary will only attempt to retrieve
-data from the
-.Pa master.passwd.byname
-and
-.Pa master.passwd.byuid
-maps for the superuser: if a normal user calls any of these functions,
-the standard
-.Pa passwd.byname
-and
-.Pa passwd.byuid
-maps will be accessed instead. The latter two maps are constructed by
-.Nm /var/yp/Makefile
-by parsing the
-.Pa master.passwd
-file and stripping out the password fields, and are therefore
-safe to pass on to unprivileged users. In this way, the shadow password
-aspect of the protected
-.Pa master.passwd
-database is maintained through NIS.
-.Pp
-.Sh NOTES
-.Ss Limitations
-There are two problems inherent with password shadowing in NIS
-that users should
-be aware of:
-.Bl -enum -offset indent
-.It
-The 'TCP port less than 1024' test is trivial to defeat for users with
-unrestricted access to machines on your network (even those machines
-which do not run UNIX-based operating systems).
-.It
-If you plan to use a FreeBSD system to serve non-FreeBSD clients that
-have no support for password shadowing (which is most of them), you
-will have to disable the password shadowing entirely by uncommenting the
-.Nm UNSECURE=True
-entry in
-.Nm /var/yp/Makefile .
-This will cause the standard
-.Pa passwd.byname
-and
-.Pa passwd.byuid
-maps to be generated with valid encrypted password fields, which is
-neccesary in order for non-FreeBSD clients to perform user
-authentication through NIS.
-.El
-.Pp
-.Ss Security
-.Nm ypserv
-has support for Wietse Venema's
-.Pa tcpwrapper
-package built in, though it is not compiled in by default since
-the
-.Pa tcpwrapper
-package is not distributed with FreeBSD. However, if you have
-.Nm libwrap.a
-and
-.Nm tcpd.h ,
-you can easily recompile
-.Nm ypserv
-with them, thereby enabling its 'securenets' features: you can
-configure
-.Nm ypserv
-to only handle resquests from machines listed
-in the
-.Pa tcpwrapper
-configuration files, which would help limit vulnerability to the
-first limitation listed above.
-.Pp
-.Ss NIS servers that are also NIS clients
-Care must be taken when running
-.Nm ypserv
-in a multi-server domain where the server machines are also
-NIS clients. It is generally a good idea to force the servers to
-bind to themselves rather than allowing them to broadcast bind
-requests and possibly become bound to each other: strange failure
-modes can result if one server goes down and
-others are dependent upon on it. (Eventually all the clients will
-time out and attempt to bind to other servers, but the delay
-involved can be considerable and the failure mode is still present
-since the servers might bind to each other all over again).
-.Pp
-Refer to the
-.Xr ypbind 8
-man page for details on how to force it to bind to a particular
-server.
-.Sh OPTIONS
-The following options are supported by
-.Nm ypserv :
-.Bl -tag -width flag
-.It Fl dns
-This option affects the way
-.Nm ypserv
-handles yp_match requests for the
-.Pa hosts.byname
-and
-.Pa hosts.byaddress
-maps. By default, if
-.Nm ypserv
-can't find an entry for a given host in its hosts maps, it will
-return an error and perform no further processing. With the
-.Fl dns
-flag,
-.Nm ypserv
-will go one step further: rather than giving up immediately, it
-will try to resolve the hostname or address using a DNS query.
-If the query is successful,
-.Nm ypserv
-will construct a fake database record and return it to the client,
-thereby making it seem as though the client's yp_match request
-succeeded.
-.Pp
-This functionality is provided for compatiblity with SunOS 4.1.x,
-which has brain-damaged resolver functions in its standard C
-library that depend on NIS for hostname and address resolution.
-FreeBSD's resolver can be configured to do DNS
-queries directly, therefore it is not necessary to enable this
-option when serving only FreeBSD NIS clients.
-.It Fl debug
-Run the server in debugging mode: the server does not background
-itself and prints copious debugging output to stderr for
-each
-request that it revceives.
-.It Fl k
-This flag is provided for compatibility with SunOS 4. The
-.Xr ypbind 8
-command in SunOS 4 apparently expects to obtain a response from an
-NIS v1 server. Starting
-.Xr ypserv 8
-with the
-.Fl k
-flag causes it to register itself as an NIS v1 server and
-respond to DOMAIN_NONACK requests. Note carefully: this is merely a
-kludge (hence the 'k') to pacify SunOS 4's
-.Xr ypbind 8
-command: attempts to make the server actually handle NIS v1 queries
-will undoubtedly fail quite miserably.
-.It Fl p Ar port
-Normally,
-.Nm ypserv
-will bind itself to a randomly chosen TCP port when it is first
-started. This option can be used to force the server to bind to
-a particular port instead.
-.El
-.Sh FILES
-.Bl -tag -width Pa -compact
-.It Pa /var/yp/[domainname]/[maps]
-The NIS maps.
-.It Pa /etc/host.conf
-Resolver configuration file.
-.El
-.Sh SEE ALSO
-.Xr ypbind 8 ,
-.Xr yppasswdd 8 ,
-.Xr yppush 8 ,
-.Xr ypxfr 8 ,
-.Xr ypcat 1 ,
-.Xr yp 8 ,
-.Xr db 3
-.Sh LICENSE
-This program is covered by the GNU Public License version 2.
-.Sh AUTHOR
-Peter Eriksson <pem@signum.se> (original version)
-.br
-Bill Paul <wpaul@ctr.columbia.edu> (port to FreeBSD and various
-changes)
diff --git a/include/skey.h b/include/skey.h
deleted file mode 100644
index 030e46c..0000000
--- a/include/skey.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef _SKEY_H_
-#define _SKEY_H_
-
-#include <sys/cdefs.h>
-
-/* Server-side data structure for reading keys file during login */
-struct skey {
- FILE *keyfile;
- char buf[256];
- char *logname;
- int n;
- char *seed;
- char *val;
- long recstart; /*needed so reread of buffer is efficient*/
-
-
-};
-
-/* Client-side structure for scanning data stream for challenge */
-struct mc {
- char buf[256];
- int skip;
- int cnt;
-};
-
-void f __P((char *x));
-int keycrunch __P((char *result,char *seed,char *passwd));
-char *btoe __P((char *engout,char *c));
-char *put8 __P((char *out,char *s));
-int etob __P((char *out,char *e));
-void rip __P((char *buf));
-int skeychallenge __P((struct skey *mp,char *name, char *challenge));
-int skeylookup __P((struct skey *mp,char *name));
-int skeyverify __P((struct skey *mp,char *response));
-
-#endif /* _SKEY_H_ */
diff --git a/lib/csu/i386/gmon.c b/lib/csu/i386/gmon.c
deleted file mode 100644
index 4ca8333..0000000
--- a/lib/csu/i386/gmon.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/*-
- * Copyright (c) 1991 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[] = "from: @(#)gmon.c 5.3 (Berkeley) 5/22/91";*/
-static char rcsid[] = "$Id: gmon.c,v 1.2 1993/08/01 18:44:18 mycroft Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-
-#include <unistd.h>
-
-#ifdef DEBUG
-#include <stdio.h>
-#endif
-
-#include "gmon.h"
-
-extern mcount() asm ("mcount");
-extern char *minbrk asm ("minbrk");
-
- /*
- * froms is actually a bunch of unsigned shorts indexing tos
- */
-static int profiling = 3;
-static unsigned short *froms;
-static struct tostruct *tos = 0;
-static long tolimit = 0;
-static char *s_lowpc = 0;
-static char *s_highpc = 0;
-static unsigned long s_textsize = 0;
-
-static int ssiz;
-static char *sbuf;
-static int s_scale;
- /* see profil(2) where this is describe (incorrectly) */
-#define SCALE_1_TO_1 0x10000L
-
-#define MSG "No space for profiling buffer(s)\n"
-
-monstartup(lowpc, highpc)
- char *lowpc;
- char *highpc;
-{
- int monsize;
- char *buffer;
- register int o;
-
- /*
- * round lowpc and highpc to multiples of the density we're using
- * so the rest of the scaling (here and in gprof) stays in ints.
- */
- lowpc = (char *)
- ROUNDDOWN((unsigned)lowpc, HISTFRACTION*sizeof(HISTCOUNTER));
- s_lowpc = lowpc;
- highpc = (char *)
- ROUNDUP((unsigned)highpc, HISTFRACTION*sizeof(HISTCOUNTER));
- s_highpc = highpc;
- s_textsize = highpc - lowpc;
- monsize = (s_textsize / HISTFRACTION) + sizeof(struct phdr);
- buffer = sbrk( monsize );
- if ( buffer == (char *) -1 ) {
- write( 2 , MSG , sizeof(MSG) );
- return;
- }
- froms = (unsigned short *) sbrk( s_textsize / HASHFRACTION );
- if ( froms == (unsigned short *) -1 ) {
- write( 2 , MSG , sizeof(MSG) );
- froms = 0;
- return;
- }
- tolimit = s_textsize * ARCDENSITY / 100;
- if ( tolimit < MINARCS ) {
- tolimit = MINARCS;
- } else if ( tolimit > 65534 ) {
- tolimit = 65534;
- }
- tos = (struct tostruct *) sbrk( tolimit * sizeof( struct tostruct ) );
- if ( tos == (struct tostruct *) -1 ) {
- write( 2 , MSG , sizeof(MSG) );
- froms = 0;
- tos = 0;
- return;
- }
- minbrk = sbrk(0);
- tos[0].link = 0;
- sbuf = buffer;
- ssiz = monsize;
- ( (struct phdr *) buffer ) -> lpc = lowpc;
- ( (struct phdr *) buffer ) -> hpc = highpc;
- ( (struct phdr *) buffer ) -> ncnt = ssiz;
- monsize -= sizeof(struct phdr);
- if ( monsize <= 0 )
- return;
- o = highpc - lowpc;
- if( monsize < o )
-#ifndef hp300
- s_scale = ( (float) monsize / o ) * SCALE_1_TO_1;
-#else /* avoid floating point */
- {
- int quot = o / monsize;
-
- if (quot >= 0x10000)
- s_scale = 1;
- else if (quot >= 0x100)
- s_scale = 0x10000 / quot;
- else if (o >= 0x800000)
- s_scale = 0x1000000 / (o / (monsize >> 8));
- else
- s_scale = 0x1000000 / ((o << 8) / monsize);
- }
-#endif
- else
- s_scale = SCALE_1_TO_1;
- moncontrol(1);
-}
-
-_mcleanup()
-{
- int fd;
- int fromindex;
- int endfrom;
- char *frompc;
- int toindex;
- struct rawarc rawarc;
-
- moncontrol(0);
- fd = creat( "gmon.out" , 0666 );
- if ( fd < 0 ) {
- perror( "mcount: gmon.out" );
- return;
- }
-# ifdef DEBUG
- fprintf( stderr , "[mcleanup] sbuf 0x%x ssiz %d\n" , sbuf , ssiz );
-# endif DEBUG
- write( fd , sbuf , ssiz );
- endfrom = s_textsize / (HASHFRACTION * sizeof(*froms));
- for ( fromindex = 0 ; fromindex < endfrom ; fromindex++ ) {
- if ( froms[fromindex] == 0 ) {
- continue;
- }
- frompc = s_lowpc + (fromindex * HASHFRACTION * sizeof(*froms));
- for (toindex=froms[fromindex]; toindex!=0; toindex=tos[toindex].link) {
-# ifdef DEBUG
- fprintf( stderr ,
- "[mcleanup] frompc 0x%x selfpc 0x%x count %d\n" ,
- frompc , tos[toindex].selfpc , tos[toindex].count );
-# endif DEBUG
- rawarc.raw_frompc = (unsigned long) frompc;
- rawarc.raw_selfpc = (unsigned long) tos[toindex].selfpc;
- rawarc.raw_count = tos[toindex].count;
- write( fd , &rawarc , sizeof rawarc );
- }
- }
- close( fd );
-}
-
-mcount()
-{
- register char *selfpc;
- register unsigned short *frompcindex;
- register struct tostruct *top;
- register struct tostruct *prevtop;
- register long toindex;
-
- /*
- * find the return address for mcount,
- * and the return address for mcount's caller.
- */
- asm(".text"); /* make sure we're in text space */
- /*
- * selfpc = pc pushed by mcount call
- */
- asm("movl 4(%%ebp),%0" : "=r" (selfpc));
- /*
- * frompcindex = pc pushed by jsr into self.
- * In GCC the caller's stack frame has already been built so we
- * have to chase a6 to find caller's raddr.
- */
- asm("movl (%%ebp),%0" : "=r" (frompcindex));
- frompcindex = ((unsigned short **)frompcindex)[1];
- /*
- * check that we are profiling
- * and that we aren't recursively invoked.
- */
- if (profiling) {
- goto out;
- }
- profiling++;
- /*
- * check that frompcindex is a reasonable pc value.
- * for example: signal catchers get called from the stack,
- * not from text space. too bad.
- */
- frompcindex = (unsigned short *)((long)frompcindex - (long)s_lowpc);
- if ((unsigned long)frompcindex > s_textsize) {
- goto done;
- }
- frompcindex =
- &froms[((long)frompcindex) / (HASHFRACTION * sizeof(*froms))];
- toindex = *frompcindex;
- if (toindex == 0) {
- /*
- * first time traversing this arc
- */
- toindex = ++tos[0].link;
- if (toindex >= tolimit) {
- goto overflow;
- }
- *frompcindex = toindex;
- top = &tos[toindex];
- top->selfpc = selfpc;
- top->count = 1;
- top->link = 0;
- goto done;
- }
- top = &tos[toindex];
- if (top->selfpc == selfpc) {
- /*
- * arc at front of chain; usual case.
- */
- top->count++;
- goto done;
- }
- /*
- * have to go looking down chain for it.
- * top points to what we are looking at,
- * prevtop points to previous top.
- * we know it is not at the head of the chain.
- */
- for (; /* goto done */; ) {
- if (top->link == 0) {
- /*
- * top is end of the chain and none of the chain
- * had top->selfpc == selfpc.
- * so we allocate a new tostruct
- * and link it to the head of the chain.
- */
- toindex = ++tos[0].link;
- if (toindex >= tolimit) {
- goto overflow;
- }
- top = &tos[toindex];
- top->selfpc = selfpc;
- top->count = 1;
- top->link = *frompcindex;
- *frompcindex = toindex;
- goto done;
- }
- /*
- * otherwise, check the next arc on the chain.
- */
- prevtop = top;
- top = &tos[top->link];
- if (top->selfpc == selfpc) {
- /*
- * there it is.
- * increment its count
- * move it to the head of the chain.
- */
- top->count++;
- toindex = prevtop->link;
- prevtop->link = top->link;
- top->link = *frompcindex;
- *frompcindex = toindex;
- goto done;
- }
-
- }
-done:
- profiling--;
- /* and fall through */
-out:
- return; /* normal return restores saved registers */
-
-overflow:
- profiling++; /* halt further profiling */
-# define TOLIMIT "mcount: tos overflow\n"
- write(2, TOLIMIT, sizeof(TOLIMIT));
- goto out;
-}
-
-/*
- * Control profiling
- * profiling is what mcount checks to see if
- * all the data structures are ready.
- */
-moncontrol(mode)
- int mode;
-{
- if (mode) {
- /* start */
- profil(sbuf + sizeof(struct phdr), ssiz - sizeof(struct phdr),
- (int)s_lowpc, s_scale);
- profiling = 0;
- } else {
- /* stop */
- profil((char *)0, 0, 0, 0);
- profiling = 3;
- }
-}
diff --git a/lib/csu/i386/gmon.h b/lib/csu/i386/gmon.h
deleted file mode 100644
index e400602..0000000
--- a/lib/csu/i386/gmon.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)gmon.h 5.2 (Berkeley) 5/6/91
- * $Id: gmon.h,v 1.2 1993/08/01 18:44:21 mycroft Exp $
- */
-
-struct phdr {
- char *lpc;
- char *hpc;
- int ncnt;
-};
-
- /*
- * histogram counters are unsigned shorts (according to the kernel).
- */
-#define HISTCOUNTER unsigned short
-
- /*
- * fraction of text space to allocate for histogram counters
- * here, 1/2
- */
-#define HISTFRACTION 2
-
- /*
- * Fraction of text space to allocate for from hash buckets.
- * The value of HASHFRACTION is based on the minimum number of bytes
- * of separation between two subroutine call points in the object code.
- * Given MIN_SUBR_SEPARATION bytes of separation the value of
- * HASHFRACTION is calculated as:
- *
- * HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1);
- *
- * For the VAX, the shortest two call sequence is:
- *
- * calls $0,(r0)
- * calls $0,(r0)
- *
- * which is separated by only three bytes, thus HASHFRACTION is
- * calculated as:
- *
- * HASHFRACTION = 3 / (2 * 2 - 1) = 1
- *
- * Note that the division above rounds down, thus if MIN_SUBR_FRACTION
- * is less than three, this algorithm will not work!
- */
-#define HASHFRACTION 1
-
- /*
- * percent of text space to allocate for tostructs
- * with a minimum.
- */
-#define ARCDENSITY 2
-#define MINARCS 50
-
-struct tostruct {
- char *selfpc;
- long count;
- unsigned short link;
-};
-
- /*
- * a raw arc,
- * with pointers to the calling site and the called site
- * and a count.
- */
-struct rawarc {
- unsigned long raw_frompc;
- unsigned long raw_selfpc;
- long raw_count;
-};
-
- /*
- * general rounding functions.
- */
-#define ROUNDDOWN(x,y) (((x)/(y))*(y))
-#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y))
diff --git a/lib/libc/i386/gen/divsi3.S b/lib/libc/i386/gen/divsi3.S
deleted file mode 100644
index 3b09580..0000000
--- a/lib/libc/i386/gen/divsi3.S
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Id$
- */
-
-#if defined(LIBC_RCS) && !defined(lint)
- .text
- .asciz "$Id$"
-#endif /* LIBC_RCS and not lint */
-
- .globl ___divsi3
- .type ___divsi3,@function
-___divsi3:
- movl 4(%esp),%eax
- cltd
- idivl 8(%esp)
- ret
diff --git a/lib/libc/i386/gen/fixdfsi.S b/lib/libc/i386/gen/fixdfsi.S
deleted file mode 100644
index 398506c..0000000
--- a/lib/libc/i386/gen/fixdfsi.S
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * $Id$
- */
-
- .file "__fixdfsi.s"
-.text
- .align 2
-.globl ___fixdfsi
-.type ___fixdfsi,@function
-___fixdfsi:
- pushl %ebp
- movl %esp,%ebp
- subl $12,%esp
- fstcw -4(%ebp)
- movw -4(%ebp),%ax
- orw $0x0c00,%ax
- movw %ax,-2(%ebp)
- fldcw -2(%ebp)
- fldl 8(%ebp)
- fistpl -12(%ebp)
- fldcw -4(%ebp)
- movl -12(%ebp),%eax
- leave
- ret
diff --git a/lib/libc/i386/gen/fixunsdfsi.S b/lib/libc/i386/gen/fixunsdfsi.S
deleted file mode 100644
index eb576ba..0000000
--- a/lib/libc/i386/gen/fixunsdfsi.S
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)fixunsdfsi.s 5.1 12/17/90
- * $Id: fixunsdfsi.S,v 1.2 1994/12/27 13:37:38 bde Exp $
- */
-
-#if defined(LIBC_RCS) && !defined(lint)
- .text
- .asciz "$Id: fixunsdfsi.S,v 1.2 1994/12/27 13:37:38 bde Exp $"
-#endif /* LIBC_RCS and not lint */
-
-#include "DEFS.h"
-
-ENTRY(__fixunsdfsi)
- fldl 4(%esp)
- fnstcw 4(%esp)
- movl 4(%esp),%eax
- orb $(3 << 2),%ah # change rounding mode bitfield to 3 (chop)
- movl %eax,8(%esp)
- fldcw 8(%esp)
- subl $8,%esp
- fistpq (%esp) # convert to 64 bit integer
- popl %eax
- popl %edx # discard top 32 bits
- fldcw 4(%esp)
- ret
-
-/*
- * XXX - we are sloppy about overflow, the same as gcc-2. Values too big
- * for a 64-bit (signed) integer cause an overflow trap or are silently
- * converted to 0 if the overflow trap is masked. The remaining values
- * too big for a 32-bit (unsigned) integer are silently truncated to 32
- * bits. Negative values are converted like negative ints (no overflow)
- * if they fit in 32 bits.
- */
diff --git a/lib/libc/i386/gen/udivsi3.S b/lib/libc/i386/gen/udivsi3.S
deleted file mode 100644
index 55a326b..0000000
--- a/lib/libc/i386/gen/udivsi3.S
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Id$
- */
-
-#if defined(LIBC_RCS) && !defined(lint)
- .text
- .asciz "$Id$"
-#endif /* LIBC_RCS and not lint */
-
- .globl ___udivsi3
- .type ___udivsi3,@function
-___udivsi3:
- movl 4(%esp),%eax
- xorl %edx,%edx
- divl 8(%esp)
- ret
diff --git a/lib/libc/locale/common_rune.h b/lib/libc/locale/common_rune.h
deleted file mode 100644
index 9dcd5f3..0000000
--- a/lib/libc/locale/common_rune.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#define PathLocale _PathLocale
-
-extern _RuneLocale *_Read_RuneMagi __P((FILE *));
diff --git a/lib/libc/locale/common_setlocale.c b/lib/libc/locale/common_setlocale.c
deleted file mode 100644
index 2dd549f..0000000
--- a/lib/libc/locale/common_setlocale.c
+++ /dev/null
@@ -1,64 +0,0 @@
-#include <locale.h>
-#include <string.h>
-
-/*
- * Category names for getenv()
- */
-char *_categories[_LC_LAST] = {
- "LC_ALL",
- "LC_COLLATE",
- "LC_CTYPE",
- "LC_MONETARY",
- "LC_NUMERIC",
- "LC_TIME",
-};
-
-/*
- * Current locales for each category
- */
-char _current_categories[_LC_LAST][32] = {
- "C",
- "C",
- "C",
- "C",
- "C",
- "C",
-};
-
-/*
- * The locales we are going to try and load
- */
-char _new_categories[_LC_LAST][32];
-
-char _current_locale_string[_LC_LAST * 33];
-
-char *
-_currentlocale()
-{
- int i, len;
-
- (void)strcpy(_current_locale_string, _current_categories[1]);
-
- for (i = 2; i < _LC_LAST; ++i)
- if (strcmp(_current_categories[1], _current_categories[i])) {
- len = strlen(_current_categories[1]) + 1 +
- strlen(_current_categories[2]) + 1 +
- strlen(_current_categories[3]) + 1 +
- strlen(_current_categories[4]) + 1 +
- strlen(_current_categories[5]) + 1;
- if (len > sizeof(_current_locale_string))
- return NULL;
- (void) strcpy(_current_locale_string, _current_categories[1]);
- (void) strcat(_current_locale_string, "/");
- (void) strcat(_current_locale_string, _current_categories[2]);
- (void) strcat(_current_locale_string, "/");
- (void) strcat(_current_locale_string, _current_categories[3]);
- (void) strcat(_current_locale_string, "/");
- (void) strcat(_current_locale_string, _current_categories[4]);
- (void) strcat(_current_locale_string, "/");
- (void) strcat(_current_locale_string, _current_categories[5]);
- break;
- }
- return (_current_locale_string);
-}
-
diff --git a/lib/libc/locale/common_setlocale.h b/lib/libc/locale/common_setlocale.h
deleted file mode 100644
index 24b4f31..0000000
--- a/lib/libc/locale/common_setlocale.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#define categories _categories
-extern char *_categories[_LC_LAST];
-
-#define current_categories _current_categories
-extern char _current_categories[_LC_LAST][32];
-
-#define new_categories _new_categories
-extern char _new_categories[_LC_LAST][32];
-
-#define current_locale_string _current_locale_string
-extern char _current_locale_string[_LC_LAST * 33];
-
-#define currentlocale _currentlocale
-extern char *_currentlocale __P((void));
diff --git a/lib/libc/locale/read_runemagi.c b/lib/libc/locale/read_runemagi.c
deleted file mode 100644
index 2d63992..0000000
--- a/lib/libc/locale/read_runemagi.c
+++ /dev/null
@@ -1,133 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <rune.h>
-#include <stdlib.h>
-
-_RuneLocale *
-_Read_RuneMagi(fp)
- FILE *fp;
-{
- char *data;
- void *lastp;
- _RuneLocale *rl;
- _RuneEntry *rr;
- struct stat sb;
- int x;
-
- if (fstat(fileno(fp), &sb) < 0)
- return(0);
-
- if (sb.st_size < sizeof(_RuneLocale))
- return(0);
-
- if ((data = malloc(sb.st_size)) == NULL)
- return(0);
-
- rewind(fp); /* Someone might have read the magic number once already */
-
- if (fread(data, sb.st_size, 1, fp) != 1) {
- free(data);
- return(0);
- }
-
- rl = (_RuneLocale *)data;
- lastp = data + sb.st_size;
-
- rl->variable = rl + 1;
-
- if (memcmp(rl->magic, _RUNE_MAGIC_1, sizeof(rl->magic))) {
- free(data);
- return(0);
- }
-
- rl->invalid_rune = ntohl(rl->invalid_rune);
- rl->variable_len = ntohl(rl->variable_len);
- rl->runetype_ext.nranges = ntohl(rl->runetype_ext.nranges);
- rl->maplower_ext.nranges = ntohl(rl->maplower_ext.nranges);
- rl->mapupper_ext.nranges = ntohl(rl->mapupper_ext.nranges);
-
- for (x = 0; x < _CACHED_RUNES; ++x) {
- rl->runetype[x] = ntohl(rl->runetype[x]);
- rl->maplower[x] = ntohl(rl->maplower[x]);
- rl->mapupper[x] = ntohl(rl->mapupper[x]);
- }
-
- rl->runetype_ext.ranges = (_RuneEntry *)rl->variable;
- rl->variable = rl->runetype_ext.ranges + rl->runetype_ext.nranges;
- if (rl->variable > lastp) {
- free(data);
- return(0);
- }
-
- rl->maplower_ext.ranges = (_RuneEntry *)rl->variable;
- rl->variable = rl->maplower_ext.ranges + rl->maplower_ext.nranges;
- if (rl->variable > lastp) {
- free(data);
- return(0);
- }
-
- rl->mapupper_ext.ranges = (_RuneEntry *)rl->variable;
- rl->variable = rl->mapupper_ext.ranges + rl->mapupper_ext.nranges;
- if (rl->variable > lastp) {
- free(data);
- return(0);
- }
-
- for (x = 0; x < rl->runetype_ext.nranges; ++x) {
- rr = rl->runetype_ext.ranges;
-
- rr[x].min = ntohl(rr[x].min);
- rr[x].max = ntohl(rr[x].max);
- if ((rr[x].map = ntohl(rr[x].map)) == 0) {
- int len = rr[x].max - rr[x].min + 1;
- rr[x].types = rl->variable;
- rl->variable = rr[x].types + len;
- if (rl->variable > lastp) {
- free(data);
- return(0);
- }
- while (len-- > 0)
- rr[x].types[len] = ntohl(rr[x].types[len]);
- } else
- rr[x].types = 0;
- }
-
- for (x = 0; x < rl->maplower_ext.nranges; ++x) {
- rr = rl->maplower_ext.ranges;
-
- rr[x].min = ntohl(rr[x].min);
- rr[x].max = ntohl(rr[x].max);
- rr[x].map = ntohl(rr[x].map);
- }
-
- for (x = 0; x < rl->mapupper_ext.nranges; ++x) {
- rr = rl->mapupper_ext.ranges;
-
- rr[x].min = ntohl(rr[x].min);
- rr[x].max = ntohl(rr[x].max);
- rr[x].map = ntohl(rr[x].map);
- }
- if (((char *)rl->variable) + rl->variable_len > (char *)lastp) {
- free(data);
- return(0);
- }
-
- /*
- * Go out and zero pointers that should be zero.
- */
- if (!rl->variable_len)
- rl->variable = 0;
-
- if (!rl->runetype_ext.nranges)
- rl->runetype_ext.ranges = 0;
-
- if (!rl->maplower_ext.nranges)
- rl->maplower_ext.ranges = 0;
-
- if (!rl->mapupper_ext.nranges)
- rl->mapupper_ext.ranges = 0;
-
- return(rl);
-}
-
diff --git a/lib/libc/locale/startup_setlocale.c b/lib/libc/locale/startup_setlocale.c
deleted file mode 100644
index 01a6770..0000000
--- a/lib/libc/locale/startup_setlocale.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/* It is reduced version for use in crt0.c (only 8 bit locales) */
-
-#include <limits.h>
-#include <locale.h>
-#include <rune.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include "common_setlocale.h"
-#include "common_rune.h"
-
-char *_PathLocale;
-
-extern int _none_init __P((_RuneLocale *));
-static char *loadlocale __P((int));
-static int startup_setrunelocale __P((char *));
-
-void
-_startup_setlocale(category, locale)
- int category;
- const char *locale;
-{
- int found, i, len;
- char *env, *r;
-
- if (!PathLocale && !(PathLocale = getenv("PATH_LOCALE")))
- PathLocale = _PATH_LOCALE;
-
- if (category < 0 || category >= _LC_LAST)
- return;
-
- if (!locale) {
- if (!category)
- (void) currentlocale();
- return;
- }
-
- /*
- * Default to the current locale for everything.
- */
- for (i = 1; i < _LC_LAST; ++i)
- (void)strcpy(new_categories[i], current_categories[i]);
-
- /*
- * Now go fill up new_categories from the locale argument
- */
- if (!*locale) {
- env = getenv(categories[category]);
-
- if (!env)
- env = getenv(categories[0]);
-
- if (!env)
- env = getenv("LANG");
-
- if (!env)
- env = "C";
-
- (void) strncpy(new_categories[category], env, 31);
- new_categories[category][31] = 0;
- if (!category) {
- for (i = 1; i < _LC_LAST; ++i) {
- if (!(env = getenv(categories[i])))
- env = new_categories[0];
- (void)strncpy(new_categories[i], env, 31);
- new_categories[i][31] = 0;
- }
- }
- } else if (category) {
- (void)strncpy(new_categories[category], locale, 31);
- new_categories[category][31] = 0;
- } else {
- if ((r = strchr(locale, '/')) == 0) {
- for (i = 1; i < _LC_LAST; ++i) {
- (void)strncpy(new_categories[i], locale, 31);
- new_categories[i][31] = 0;
- }
- } else {
- for (i = 1; r[1] == '/'; ++r);
- if (!r[1])
- return; /* Hmm, just slashes... */
- do {
- len = r - locale > 31 ? 31 : r - locale;
- (void)strncpy(new_categories[i++], locale, len);
- new_categories[i++][len] = 0;
- locale = r;
- while (*locale == '/')
- ++locale;
- while (*++r && *r != '/');
- } while (*locale);
- while (i < _LC_LAST)
- (void)strcpy(new_categories[i],
- new_categories[i-1]);
- }
- }
-
- if (category) {
- (void) loadlocale(category);
- return;
- }
-
- found = 0;
- for (i = 1; i < _LC_LAST; ++i)
- if (loadlocale(i) != NULL)
- found = 1;
- if (found)
- (void) currentlocale();
-}
-
-static char *
-loadlocale(category)
- int category;
-{
- if (strcmp(new_categories[category],
- current_categories[category]) == 0)
- return (current_categories[category]);
-
- if (category == LC_CTYPE) {
- if (startup_setrunelocale(new_categories[LC_CTYPE]))
- return (NULL);
- (void)strcpy(current_categories[LC_CTYPE],
- new_categories[LC_CTYPE]);
- return (current_categories[LC_CTYPE]);
- }
-
- if (category == LC_COLLATE) {
- if (__collate_load_tables(new_categories[LC_COLLATE]) < 0)
- return (NULL);
- (void)strcpy(current_categories[LC_COLLATE],
- new_categories[LC_COLLATE]);
- return (current_categories[LC_COLLATE]);
- }
-
- if (category == LC_TIME) {
- if (__time_load_locale(new_categories[LC_TIME]) < 0)
- return (NULL);
- (void)strcpy(current_categories[LC_TIME],
- new_categories[LC_TIME]);
- return (current_categories[LC_TIME]);
- }
-
- if (!strcmp(new_categories[category], "C") ||
- !strcmp(new_categories[category], "POSIX")) {
-
- /*
- * Some day this will need to reset the locale to the default
- * C locale. Since we have no way to change them as of yet,
- * there is no need to reset them.
- */
- (void)strcpy(current_categories[category],
- new_categories[category]);
- return (current_categories[category]);
- }
-
- return NULL;
-}
-
-static int
-startup_setrunelocale(encoding)
- char *encoding;
-{
- FILE *fp;
- char name[PATH_MAX];
- _RuneLocale *rl;
-
- if (!encoding)
- return(EFAULT);
-
- /*
- * The "C" and "POSIX" locale are always here.
- */
- if (!strcmp(encoding, "C") || !strcmp(encoding, "POSIX")) {
- _CurrentRuneLocale = &_DefaultRuneLocale;
- return(0);
- }
-
- (void) strcpy(name, PathLocale);
- (void) strcat(name, "/");
- (void) strcat(name, encoding);
- (void) strcat(name, "/LC_CTYPE");
-
- if ((fp = fopen(name, "r")) == NULL)
- return(ENOENT);
-
- if ((rl = _Read_RuneMagi(fp)) == 0) {
- fclose(fp);
- return(EFTYPE);
- }
- fclose(fp);
-
- if (!rl->encoding[0])
- return(EINVAL);
- else if (!strcmp(rl->encoding, "NONE"))
- return(_none_init(rl));
- else
- return(EINVAL);
-}
-
diff --git a/lib/libforms/Makefile.orig b/lib/libforms/Makefile.orig
deleted file mode 100644
index 7ed0abf..0000000
--- a/lib/libforms/Makefile.orig
+++ /dev/null
@@ -1,12 +0,0 @@
-LIB = forms
-
-SRCS = forms.c
-
-CFLAGS += -I. -I${.CURDIR} -Wall -g
-
-beforeinstall:
- @(cd ${.CURDIR}; cmp -s forms.h ${DESTDIR}/usr/include/forms.h || \
- install -c -o ${BINOWN} -g ${BINGRP} -m 444 forms.h \
- ${DESTDIR}/usr/include/forms.h;)
-
-.include <bsd.lib.mk>
diff --git a/lib/libforms/examples/test.c b/lib/libforms/examples/test.c
deleted file mode 100644
index d587354..0000000
--- a/lib/libforms/examples/test.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 1995 Paul Richards.
- *
- * All rights reserved.
- *
- * This software may be used, modified, copied, distributed, and
- * sold, in both source and binary form provided that the above
- * copyright and these terms are retained, verbatim, as the first
- * lines of this file. Under no circumstances is the author
- * responsible for the proper functioning of this software, nor does
- * the author assume any responsibility for damages incurred with
- * its use.
- */
-
-#include <stdio.h>
-#include "../forms.h"
-
-main()
-{
-
- int res;
-
- char *string0 = "A simple demo of the current forms widgets";
- char *string1 = "Hey, I can flash boldly";
- char *string2 = "This is an input field with default:";
- char *string4 = "This is a labelled input field:";
- char *string6 = "Some options to choose from: ";
-
- char *options7[] = {"Choose", "one", "of", "these"};
-
- struct text_field field0 = {string0};
- struct text_field field1 = {string1};
- struct text_field field2 = {string2};
- struct input_field field3 = {0,"Default entry",0};
- struct text_field field4 = {string4};
- struct input_field field5 = {1,"A place filler",0};
- struct text_field field6 = {string6};
- struct menu_field field7 = {sizeof &options7, 0, options7};
- struct action_field field8 = {"EXIT",&exit_form};
- struct action_field field9 = {"CANCEL",&cancel_form};
-
- struct field field[] = {
- {F_TEXT, 0, 15, 80, 80, A_BOLD,
- 0, 0, 0, 0, 0, (struct text_field *)&field0},
- {F_TEXT, 3, 23, 25, 15, A_BLINK|A_BOLD,
- 0, 0, 0, 0, 0, &field1},
- {F_TEXT, 7, 2, 40, 40, F_DEFATTR,
- 0, 0, 0, 0, 0, &field2},
- {F_INPUT, 7, 45, 15, 30, F_DEFATTR,
- 5, -1, 5, -1, -1, (struct text_field *)&field3},
- {F_TEXT, 11, 2, 40, 40, F_DEFATTR,
- 0, 0, 0, 0, 0, &field4},
- {F_INPUT, 11, 45, 15, 30, F_DEFATTR,
- 7, 3, 7, -1, -1, (struct text_field *)&field5},
- {F_TEXT, 15, 2, 40, 40, F_DEFATTR,
- 0, 0, 0, 0, 0, (struct text_field *)&field6},
- {F_MENU, 15, 45, 10, 10, F_DEFATTR,
- 8, 5, 8, -1, -1, (struct text_field *)&field7},
- {F_ACTION, 20, 20, 6, 6, (A_BOLD|A_REVERSE),
- 0, 7, -1, -1, 9, (struct text_field *)&field8},
- {F_ACTION, 20, 43, 6, 6, (A_BOLD|A_REVERSE),
- 3, 3, 3, 7, 3, (struct text_field *)&field9},
- {F_END, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
- };
-
- struct form form = {0, 3, field, 24, 80, 0, 0, 0};
- form.field = field;
-
- initscr();
-
- initfrm(&form);
- if (!form.window) {
- fprintf(stderr, "\nUnable to initialize forms library.\n");
- endwin();
- exit(1);
- }
- keypad(form.window, TRUE);
- while (!(res = update_form(&form)));
-
-
- wclear(form.window);
- wrefresh(form.window);
-
- if (res == F_DONE) {
- printf("You're entries were:\n\n");
- printf("%s\n",field[3].field.input->input);
- printf("%s\n",field[5].field.input->input);
- printf("%s\n",field[7].field.menu->options[field[7].field.menu->selected]);
- } else if (res == F_CANCEL)
- printf("You cancelled the form\n");
-
- endfrm(&form);
- endwin();
-}
diff --git a/lib/libforms/examples/tform.c b/lib/libforms/examples/tform.c
deleted file mode 100644
index 48f4d48..0000000
--- a/lib/libforms/examples/tform.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <ncurses.h>
-#include <dialog.h>
-#include <forms.h>
-
-extern struct form *form;
-
-void
-main()
-{
- printf("Testing forms code\n");
-
- if (init_forms("example.frm") == -1)
- exit(1);
-
- edit_form(form);
-}
diff --git a/lib/libforms/fields.c b/lib/libforms/fields.c
deleted file mode 100644
index ce4187d..0000000
--- a/lib/libforms/fields.c
+++ /dev/null
@@ -1,678 +0,0 @@
-/*-
- * Copyright (c) 1995
- * Paul Richards. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce 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 Paul Richards.
- * 4. The name Paul Richards may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PAUL RICHARDS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL PAUL RICHARDS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <strhash.h>
-#include <ctype.h>
-#include <err.h>
-#include <ncurses.h>
-#include <forms.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "internal.h"
-
-extern hash_table *global_bindings;
-
-struct attr_cmd {
- char *name;
- int attr;
-};
-
-static struct attr_cmd attr_cmds[] = {
- { "standout", 0x00010000},
- { "underline", 0x00020000},
- { "reverse", 0x00040000},
- { "blink", 0x00080000},
- { "bold", 0x00200000 }
-};
-
-int done=0;
-
-int
-init_field(char *key, void *data, void *arg)
-{
- struct Tuple *tuple = (struct Tuple *)data;
- struct Tuple *def_tuple;
- struct Field *def, *field;
- int i;
- int len, lim;
- int strwidth;
-
- field = (struct Field *)tuple->addr;
-
- /* Field definitions are global, at least for now */
- def_tuple = form_get_tuple(global_bindings, field->defname, FT_FIELD_DEF);
- if (!def_tuple) {
- warnx("Field definition not found -- skipping field");
- return (-1);
- }
-
- def = (struct Field *)def_tuple->addr;
- field->height = def->height;
- field->width = def->width;
- field->attr = def->attr;
- field->selattr = def->selattr;
- field->type = def->type;
- switch (field->type) {
- case FF_INPUT:
- field->field.input = malloc(sizeof (struct InputField));
- if (!field->field.input) {
- warnx("Couldn't allocate memory for input field");
- return (-1);
- }
- field->field.input->limit = def->field.input->limit;
-
- /* Force height to one regardless, at least for now :-) */
- field->height = 1;
- if (!field->width && !field->field.input->limit) {
- field->width = calc_string_width(def->field.input->label);
- field->field.input->limit = field->width;
- } else if (!field->width)
- field->width = field->field.input->limit;
- else if (!field->field.input->limit)
- field->field.input->limit = field->width;
- if (field->field.input->limit < field->width)
- field->width = field->field.input->limit;
-
- strwidth = strlen(def->field.input->label);
- field->field.input->input = malloc(strwidth + 1);
- if (!field->field.input->input) {
- warnx("Couldn't allocate memory for input field text");
- return (-1);
- }
- field->field.input->label = malloc(strwidth + 1);
- if (!field->field.input->label) {
- warnx("Couldn't allocate memory for input field label");
- return (-1);
- }
- strncpy(field->field.input->label,
- def->field.input->label,
- strwidth + 1);
- field->field.input->lbl_flag = def->field.input->lbl_flag;
-
- /*
- * If it's a label then clear the input string
- * otherwise copy the default there.
- */
- if (field->field.input->lbl_flag)
- field->field.input->input[0] = '\0';
- else if (field->field.input->label) {
- strncpy(field->field.input->input,
- field->field.input->label,
- strwidth + 1);
- field->field.input->input[strwidth] = 0;
- }
- break;
- case FF_TEXT:
- field->field.text = malloc(sizeof (struct TextField));
- if (!field->field.text) {
- warnx("Couldn't allocate memory for text field");
- return (FS_ERROR);
- }
- strwidth = strlen(def->field.text->text);
- if (!field->width)
- field->width = calc_string_width(def->field.text->text);
- field->field.text->text = malloc(strwidth + 1);
- if (!field->field.text->text) {
- warnx("Couldn't allocate memory for text field text");
- return (FS_ERROR);
- } else
- strncpy(field->field.text->text,
- def->field.text->text,
- strwidth + 1);
- if (!field->height)
- calc_field_height(field, field->field.text->text);
- break;
- case FF_MENU:
- field->field.menu = malloc(sizeof (struct MenuField));
- if (!field->field.menu) {
- warnx("Couldn't allocate memory for menu field");
- return (FS_ERROR);
- }
- field->field.menu->no_options = 0;
- field->height = 1;
- lim = 0;
- for (i=0; i < def->field.menu->no_options; i++) {
- field->field.menu->no_options =
- add_menu_option(field->field.menu,
- def->field.menu->options[i]);
- if (!field->field.menu->no_options) {
- warnx("Couldn't add menu option");
- return (FS_ERROR);
- }
- len = calc_string_width(def->field.menu->options[i]);
- if (len > lim)
- lim = len;
- }
- if (!field->width)
- field->width = lim;
- break;
- case FF_ACTION:
- field->field.action = malloc(sizeof (struct ActionField));
- if (!field->field.action) {
- warnx("Couldn't allocate memory for action field");
- return (FS_ERROR);
- }
- if (!field->width)
- field->width = calc_string_width(def->field.action->text);
- strwidth = strlen(def->field.action->text);
- field->field.action->text = malloc(strwidth + 1);
- if (!field->field.action->text) {
- warnx("Couldn't allocate memory for text field text");
- return (FS_ERROR);
- } else
- strncpy(field->field.action->text,
- def->field.action->text,
- strwidth + 1);
- if (!field->height)
- calc_field_height(field, field->field.action->text);
- field->field.action->fn = def->field.action->fn;
- break;
- default:
- break;
- }
- return (1);
-}
-
-void
-display_field(WINDOW *window, struct Field *field)
-{
- wattrset(window, field->attr);
- wmove(window, field->y, field->x);
- switch (field->type) {
- case FF_TEXT:
- display_text(window, field);
- break;
- case FF_MENU:
- display_menu(window, field);
- break;
- case FF_INPUT:
- display_input(window, field);
- break;
- case FF_ACTION:
- display_action(window, field);
- break;
- case FF_UNKNOWN:
- default:
- break;
- }
- wattrset(window, 0);
- wrefresh(window);
-}
-
-void
-display_text(WINDOW *window, struct Field *field)
-{
-
- if (print_string(window, field->y, field->x, field->height,
- field->width, field->field.text->text) == ERR)
- print_status("Illegal scroll in print_string");
-}
-
-void
-display_input(WINDOW *window, struct Field *field)
-{
- if (field->field.input->lbl_flag) {
- if (print_string(window, field->y, field->x, field->height,
- field->width, field->field.input->label) == ERR)
- print_status("Illegal scroll in print_string");
- } else
- if (print_string(window, field->y, field->x, field->height,
- field->width, field->field.input->input) == ERR)
- print_status("Illegal scroll in print_string");
-}
-
-void
-display_menu(WINDOW *window, struct Field *field)
-{
- if (print_string(window, field->y, field->x,
- field->height, field->width,
- field->field.menu->options[field->field.menu->selected]) == ERR)
- print_status("Illegal scroll in print_string");
-}
-
-void
-display_action(WINDOW *window, struct Field *field)
-{
- if (print_string(window, field->y, field->x, field->height,
- field->width,
- field->field.action->text) == ERR)
- print_status("Illegal scroll in print_string");
-}
-
-int
-do_action(struct Form *form)
-{
- struct Field *field = form->current_field;
- struct Tuple *tuple;
- int ch;
- void (* fn)();
-
- display_action(form->window, field);
- wmove(form->window, field->y, field->x);
-
- for (;;) {
-
- ch = wgetch(form->window);
-
- if (ch == FK_ACCEPT) {
- tuple = form_get_tuple(form->bindings, field->field.action->fn, FT_FUNC);
- if (!tuple) {
- print_status("No function bound to action");
- beep();
- continue;
- } else {
- fn = tuple->addr;
- (*fn)(form);
- return (FS_OK);
- }
- } else
- ch = do_key_bind(form, ch);
-
- if (ch == FS_OK)
- return (FS_OK);
- else if (ch == FS_ERROR)
- continue;
- }
-}
-
-int
-do_menu(struct Form *form)
-{
- struct Field *field = form->current_field;
- int ch;
-
-
- for (;;) {
-
- display_menu(form->window, field);
- wmove(form->window, field->y, field->x);
-
- ch = wgetch(form->window);
-
- switch (ch) {
- case ' ':
- print_status("");
- field->field.menu->selected++;
- if (field->field.menu->selected >= field->field.menu->no_options)
- field->field.menu->selected = 0;
- ch = FS_OK;
- break;
- default:
- ch = do_key_bind(form, ch);
- break;
- }
-
- if (ch == FS_OK)
- return (FS_OK);
- else if (ch == FS_ERROR) {
- beep();
- continue;
- } else {
- print_status("Hit the space bar to toggle through options");
- beep();
- continue;
- }
- }
-}
-
-int
-do_field(struct Form *form)
-{
- struct Tuple *tuple;
- struct Field *field = form->current_field;
- void (* fn)();
- int status;
-
- /* Do field entry tasks */
- if (field->enter) {
- tuple = form_get_tuple(form->bindings, field->enter, FT_FUNC);
-
- if (tuple) {
- fn = tuple->addr;
- (*fn)(form);
- }
- }
-
- switch (field->type) {
- case FF_TEXT:
- status = FS_OK;
- display_text(form->window, field);
- break;
- case FF_INPUT:
- status = do_input(form);
- break;
- case FF_MENU:
- status = do_menu(form);
- break;
- case FF_ACTION:
- status = do_action(form);
- break;
- default:
- status = FF_UNKNOWN;
- beep();
- print_status("Unknown field type");
- form->current_field = form->prev_field;
- break;
- }
-
- /* Do field leave tasks */
- if (field->leave) {
- tuple = form_get_tuple(form->bindings, field->leave, FT_FUNC);
-
- if (tuple) {
- fn = tuple->addr;
- (*fn)(form);
- }
- }
-
- return (status);
-}
-
-int
-parse_attr(WINDOW *window, char *string)
-{
- int inc = 0;
- struct attr_cmd *attr;
-
- if (*(string) == '\\')
- return (1);
-
- while (!isspace(*(string + inc))) {
- inc++;
- }
-
- for (attr = attr_cmds; attr->name; attr++) {
- if (strncmp(attr->name, string, inc))
- continue;
- else {
- wattron(window, attr->attr);
- break;
- }
- }
-
- /* Skip trailing space after the attribute string */
- while (isspace(*(string + inc)))
- inc++;
-
- return (inc);
-}
-
-int
-print_string(WINDOW *window, int y, int x,
- int height, int fwidth, char *string)
-{
- int len, skip;
- int width;
-
- if (!string)
- len = -1;
-
- len = strlen(string);
-
- if (wmove(window, y, x) == ERR)
- return (ERR);
- while (height--) {
- width = fwidth;
- while (width--) {
- if (len-- > 0) {
- if (*string == '\\') {
- string++;
- len--;
- skip = parse_attr(window, string);
- len -= skip;
- string += skip;
- }
- if (waddch(window, *string++) == ERR)
- return (ERR);
- } else if (waddch(window, ' ') == ERR)
- return (ERR);
- }
- if (wmove(window, ++y, x) == ERR)
- return (ERR);
- }
- return (OK);
-}
-
-void
-print_status(char *msg)
-{
- if (wmove(stdscr, LINES-1, 0) == ERR) {
- endwin();
- exit(1);
- }
-
- wclrtoeol(stdscr);
-
- wstandout(stdscr);
- if (wprintw(stdscr, "%s",
- msg) == ERR) {
- endwin();
- exit(1);
- }
- wstandend(stdscr);
- wrefresh(stdscr);
-}
-
-
-int
-do_input(struct Form *form)
-{
- struct Field *field = form->current_field;
- int len;
- int disp_off=0, abspos=0, cursor = 0;
- unsigned int ch;
-
-#define DISPOFF ((len < field->width) ? 0 : len - field->width)
-#define CURSPOS ((len < field->width) ? len : field->width)
-
- len = strlen(field->field.input->input);
- display_input(form->window, field);
-
- cursor = CURSPOS;
- abspos = cursor;
-
- for (;;) {
-
- wmove(form->window, field->y, field->x+cursor);
- wrefresh(form->window);
-
- ch = wgetch(form->window);
- ch = do_key_bind(form, ch);
-
- /*
- * If there was a valid motion command then we've
- * moved to a new field so just return. If the motion
- * command was invalid then just go around and get another
- * keystroke. Otherwise, it was not a motion command.
- */
-
- if (ch == FS_OK)
- return (FS_OK);
- else if (ch == FS_ERROR)
- continue;
-
- print_status("");
-
- if (field->field.input->lbl_flag) {
- field->field.input->lbl_flag = 0;
- }
- if ((ch == FK_CHOME) || (ch == '')) {
- disp_off = 0;
- cursor = 0;
- abspos = 0;
- } else if ((ch == FK_CEND) || (ch == '')) {
- disp_off = DISPOFF;
- abspos = len;
- cursor = CURSPOS;
- } else if (ch == FK_CDEL) {
- if (!(len-abspos))
- beep();
- else {
- bcopy(field->field.input->input+abspos+1,
- field->field.input->input+abspos,
- len - abspos);
- --len;
- }
- } else if ((ch == FK_CLEFT) || (ch == FK_CBS) || (ch == '')) {
- if (!abspos)
- beep();
- else {
- if (ch == FK_CBS) {
- bcopy(field->field.input->input+abspos,
- field->field.input->input+abspos-1,
- len-abspos+1);
- --len;
- }
- --abspos;
- --cursor;
- if ((disp_off) && (cursor < 0)) {
- --disp_off;
- ++cursor;
- }
- }
- } else if ((ch == FK_CRIGHT) || (ch == '')) {
- if (abspos == len)
- beep();
- else {
- ++abspos;
- if (++cursor >= field->width) {
- ++disp_off;
- --cursor;
- }
- }
- } else if ((isprint(ch)) && (len < field->field.input->limit)){
- bcopy(field->field.input->input+abspos,
- field->field.input->input+abspos+1, len-abspos+1);
- field->field.input->input[abspos++] = ch;
- len++;
- if (++cursor > field->width) {
- ++disp_off;
- --cursor;
- }
- } else
- beep();
- print_string(form->window, field->y, field->x, field->height,
- field->width, field->field.input->input+disp_off);
- }
-}
-
-/*
- * Calculate length of printable part of the string,
- * stripping out the attribute modifiers.
- */
-
-int
-calc_string_width(char *string)
-{
- int len, width=0;
-
- if (!string)
- return (0);
-
- len = strlen(string);
-
- while (len) {
- if (*string != '\\') {
- width++;
- len--;
- string++;
- continue;
- } else {
- string++;
- len--;
- if (*string == '\\') {
- string++;
- width++;
- len--;
- continue;
- } else {
- while (!isspace(*string)) {
- string++;
- len--;
- }
- while (isspace(*string)) {
- string ++;
- len--;
- }
- }
- }
- }
-
- return (width);
-}
-
-/* Calculate a default height for a field */
-
-void
-calc_field_height(struct Field *field, char *string)
-{
-
- int len;
-
- len = calc_string_width(string);
-
- if (!field->width) {
- /*
- * This is a failsafe, this routine shouldn't be called
- * with a width of 0, the width should be determined
- * first.
- */
- field->height = 1;
- return;
- }
-
- if (len < field->width) {
- field->height = 1;
- return;
- } else
- field->height = len / field->width;
-
- if ((field->height*field->width) < len)
- field->height++;
-
- return;
-}
-
-void
-exit_form(struct Form *form)
-{
- form->status = FS_EXIT;
-}
-
-void
-cancel_form(struct Form *form)
-{
- form->status = FS_CANCEL;
-}
diff --git a/lib/libforms/forms.c.orig b/lib/libforms/forms.c.orig
deleted file mode 100644
index 6787d8e..0000000
--- a/lib/libforms/forms.c.orig
+++ /dev/null
@@ -1,502 +0,0 @@
-/*-
- * Copyright (c) 1995
- * Paul Richards. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce 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 Paul Richards.
- * 4. The name Paul Richards may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PAUL RICHARDS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL PAUL RICHARDS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <forms.h>
-#include <ncurses.h>
-
-#include "internal.h"
-
-unsigned int f_keymap[] = {
- KEY_UP, /* F_UP */
- KEY_DOWN, /* F_DOWN */
- 9, /* F_RIGHT */
- 8, /* F_LEFT */
- 10, /* F_NEXT */
- KEY_LEFT, /* F_CLEFT */
- KEY_RIGHT, /* F_CRIGHT */
- KEY_HOME, /* F_CHOME */
- KEY_END, /* F_CEND */
- 263, /* F_CBS */
- 330, /* F_CDEL */
- 10 /* F_ACCEPT */
-};
-
-int done=0;
-
-int
-initfrm(struct form *form)
-{
-
- struct field *field = &form->field[0];
- int i;
-
- if (has_colors()) {
- start_color();
- if (form->color_table)
- for (i=0; form->color_table[i].f != -1; i++) {
- init_pair(i+1, form->color_table[i].f, form->color_table[i].b);
- }
- }
- cbreak();
- noecho();
-
- if (!form->height)
- form->height = LINES;
- if (!form->width)
- form->width = COLS;
-
- form->window = newwin(form->height, form->width, form->y, form->x);
- if (!form->window) {
- print_status("Couldn't open window, closing form");
- return (ERR);
- }
- form->no_fields = 0;
-
- keypad(form->window, TRUE);
-
-
- while (field->type != F_END) {
- if (field->type == F_INPUT) {
- field->field.input->input = malloc(field->field.input->limit);
- if (!field->field.input->input){
- print_status("Couldn't allocate memory, closing form");
- endfrm(form);
- return (ERR);
- }
- /*
- * If it's a label then clear the input string
- * otherwise copy the default string to the input string.
- */
- if (field->field.input->lbl_flag)
- field->field.input->input[0] = '\0';
- else if (field->field.input->label) {
- strncpy(field->field.input->input,
- field->field.input->label,
- field->field.input->limit);
- field->field.input->input[field->field.input->limit] = 0;
- }
- } else if ((field->type != F_TEXT) && (field->type != F_MENU) &&
- (field->type != F_ACTION)) {
- print_status("Unknown field type, closing form");
- endfrm(form);
- return (ERR);
- }
- form->no_fields++;
- field = &form->field[form->no_fields];
- }
- form->current_field = form->start_field;
- show_form(form);
- return (OK);
-}
-
-void
-endfrm(struct form *form)
-{
-
- struct field *field = &form->field[0];
- int i;
-
- delwin(form->window);
-
- for (i=0; i < form->no_fields; i++) {
- if (field->type == F_INPUT)
- free(field->field.input->input);
- field = &form->field[i];
- }
-}
-
-int
-update_form(struct form *form)
-{
- show_form(form);
-
- if (form->current_field == -1)
- return (F_CANCEL);
-
- wattrset(form->window, form->field[form->current_field].selattr);
- switch (form->field[form->current_field].type) {
- case F_MENU:
- field_menu(form);
- break;
- case F_INPUT:
- field_input(form);
- break;
- case F_ACTION:
- field_action(form);
- break;
- case F_TEXT:
- default:
- print_status("Error, current field is invalid");
- return (F_CANCEL);
- }
- wattrset(form->window, 0);
-
- return (done);
-}
-
-static void
-show_form(struct form *form)
-{
- int i;
- int y, x;
-
- wattrset(form->window, form->attr);
- for (y = 0; y < form->height; y++)
- for (x = 0; x < form->width; x++)
- mvwaddch(form->window, y, x, ' ');
-
- for (i=0; i < form->no_fields; i++) {
- wattrset(form->window, form->field[i].attr);
- wmove(form->window, form->field[i].y, form->field[i].x);
- switch (form->field[i].type) {
- case F_TEXT:
- disp_text(form, i);
- break;
- case F_MENU:
- disp_menu(form, i);
- break;
- case F_INPUT:
- disp_input(form,i);
- break;
- case F_ACTION:
- disp_action(form,i);
- break;
- case F_END:
- default:
- break;
- }
- }
- wattrset(form->window, 0);
- wrefresh(form->window);
-}
-
-static void
-disp_text(struct form *form, int index)
-{
-
- struct field *field = &form->field[index];
-
- if (print_string(form->window, field->y, field->x, field->height,
- field->width, field->field.text->text) == ERR)
- print_status("Illegal scroll in print_string");
-}
-
-static void
-disp_input(struct form *form, int index)
-{
-
- struct field *field = &form->field[index];
-
- if (field->field.input->lbl_flag) {
- if (print_string(form->window, field->y, field->x, field->height,
- field->width, field->field.input->label) == ERR)
- print_status("Illegal scroll in print_string");
- } else
- if (print_string(form->window, field->y, field->x, field->height,
- field->width, field->field.input->input) == ERR)
- print_status("Illegal scroll in print_string");
-}
-
-static void
-disp_menu(struct form *form, int index)
-{
- struct field *field = &form->field[index];
-
- if (print_string(form->window, field->y, field->x, field->height,
- field->width,
- field->field.menu->options[field->field.menu->selected]) == ERR)
- print_status("Illegal scroll in print_string");
-}
-
-static void
-disp_action(struct form *form, int index)
-{
- struct field *field = &form->field[index];
-
- if (print_string(form->window, field->y, field->x, field->height,
- field->width,
- field->field.action->text) == ERR)
- print_status("Illegal scroll in print_string");
-}
-
-static void
-field_action(struct form *form)
-{
-
- struct field *field = &form->field[form->current_field];
- int ch;
-
- for (;;) {
- disp_action(form, form->current_field);
- wmove(form->window, field->y, field->x);
- ch = wgetch(form->window);
- if (ch == F_ACCEPT) {
- (*field->field.action->fn)();
- return;
- } else if (!next_field(form, ch))
- beep();
- else
- return;
- }
-}
-
-static void
-field_menu(struct form *form)
-{
- struct field *field = &form->field[form->current_field];
- int ch;
-
- for (;;) {
- disp_menu(form, form->current_field);
- wmove(form->window, field->y, field->x);
- switch (ch = wgetch(form->window)) {
- case ' ':
- print_status("");
- field->field.menu->selected++;
- if (field->field.menu->selected >= field->field.menu->no_options)
- field->field.menu->selected = 0;
- break;
- default:
- if (!next_field(form, ch)) {
- print_status("Hit the space bar to toggle through options");
- beep();
- } else
- return;
- }
- }
-}
-
-static int
-next_field(struct form *form, int ch)
-{
-
- struct field *field = &form->field[form->current_field];
-
- if (ch == F_UP) {
- if (field->up == -1) {
- print_status("Can't go up from here");
- return (0);
- } else
- form->current_field = field->up;
- } else if (ch == F_DOWN) {
- if (field->down == -1) {
- print_status("Can't go down from here");
- return (0);
- } else
- form->current_field = field->down;
- } else if (ch == F_NEXT) {
- if (field->next == -1) {
- print_status("Can't go to next from here");
- return (0);
- } else
- form->current_field = field->next;
- } else if (ch == F_RIGHT) {
- if (field->right == -1) {
- print_status("Can't go right from here");
- return (0);
- } else
- form->current_field = field->right;
- } else if (ch == F_LEFT) {
- if (field->left == -1) {
- print_status("Can't go left from here");
- return (0);
- } else
- form->current_field = field->left;
- } else
- return (0);
-
- print_status("");
- return (1);
-}
-
-static int
-print_string(WINDOW *window, int y, int x,
- int height, int fwidth, char *string)
-{
- int len;
- int width;
-
- if (!string)
- len = -1;
-
- len = strlen(string);
-
- if (wmove(window, y, x) == ERR)
- return (ERR);
- while (height--) {
- width = fwidth;
- while (width--) {
- if (len-- > 0) {
- if (waddch(window, *string++) == ERR)
- return (ERR);
- } else
- if (waddch(window, ' ') == ERR)
- return (ERR);
- }
- if (wmove(window, ++y, x) == ERR)
- return (ERR);
-
- }
- return (OK);
-}
-
-void
-print_status(char *msg)
-{
- if (wmove(stdscr, LINES-1, 0) == ERR) {
- endwin();
- exit(1);
- }
-
- wclrtoeol(stdscr);
-
- wstandout(stdscr);
- if (wprintw(stdscr, "%s",
- msg) == ERR) {
- endwin();
- exit(1);
- }
- wstandend(stdscr);
- wrefresh(stdscr);
-}
-
-
-void
-field_input(struct form *form)
-{
- struct field *field = &form->field[form->current_field];
- int len;
- int ch;
- int disp_off=0, abspos=0, cursor = 0;
-
-#define DISPOFF ((len < field->width) ? 0 : len - field->width)
-#define CURSPOS ((len < field->width) ? len : field->width)
-
- len = strlen(field->field.input->input);
- disp_input(form, form->current_field);
-
- cursor = CURSPOS;
- abspos = cursor;
-
- for(;;) {
-
- wmove(form->window, field->y, field->x+cursor);
- wrefresh(form->window);
-
- ch = wgetch(form->window);
- if (next_field(form, ch)) {
- print_string(form->window, field->y, field->x,
- field->height, field->width,
- field->field.input->input+DISPOFF);
- return;
- }
- if (field->field.input->lbl_flag) {
- field->field.input->lbl_flag = 0;
- }
- if ((ch == F_CHOME) || (ch == '')) {
- disp_off = 0;
- cursor = 0;
- abspos = 0;
- } else if ((ch == F_CEND) || (ch == '')) {
- disp_off = DISPOFF;
- abspos = len;
- cursor = CURSPOS;
- } else if (ch == F_CDEL) {
- if (!(len-abspos))
- beep();
- else {
- bcopy(field->field.input->input+abspos+1,
- field->field.input->input+abspos,
- len - abspos);
- --len;
- }
- } else if ((ch == F_CLEFT) || (ch == F_CBS) || (ch == '')) {
- if (!abspos)
- beep();
- else {
- if (ch == F_CBS) {
- bcopy(field->field.input->input+abspos,
- field->field.input->input+abspos-1,
- len-abspos+1);
- --len;
- }
- --abspos;
- --cursor;
- if ((disp_off) && (cursor < 0)) {
- --disp_off;
- ++cursor;
- }
- }
- } else if ((ch == F_CRIGHT) || (ch == '')) {
- if (abspos == len)
- beep();
- else {
- ++abspos;
- if (++cursor == field->width) {
- ++disp_off;
- --cursor;
- }
- }
- } else if ((isprint(ch)) && (len < field->field.input->limit)){
- bcopy(field->field.input->input+abspos,
- field->field.input->input+abspos+1, len-abspos+1);
- field->field.input->input[abspos++] = ch;
- len++;
- if (++cursor > field->width) {
- ++disp_off;
- --cursor;
- }
- } else {
- beep();
- }
- print_string(form->window, field->y, field->x, field->height,
- field->width, field->field.input->input+disp_off);
- }
- /* Not Reached */
-}
-
-void
-exit_form(void)
-{
- done = F_DONE;
-}
-
-void
-cancel_form(void)
-{
- done = F_CANCEL;
-}
diff --git a/lib/libforms/forms.h.orig b/lib/libforms/forms.h.orig
deleted file mode 100644
index 36031be..0000000
--- a/lib/libforms/forms.h.orig
+++ /dev/null
@@ -1,126 +0,0 @@
-/*-
- * Copyright (c) 1995
- * Paul Richards. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce 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 Paul Richards.
- * 4. The name Paul Richards may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PAUL RICHARDS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL PAUL RICHARDS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <ncurses.h>
-
-#define F_END 0
-#define F_TEXT 1
-#define F_ACTION 2
-#define F_INPUT 3
-#define F_MENU 4
-
-#define F_DEFATTR 0
-#define F_SELATTR A_REVERSE
-
-#define F_DONE 1
-#define F_CANCEL -1
-
-struct col_pair {
- int f;
- int b;
-};
-
-struct form {
- int no_fields;
- int start_field;
- int current_field;
- struct field *field;
- int height;
- int width;
- int y;
- int x;
- int attr;
- struct col_pair *color_table;
- WINDOW *window;
-};
-
-struct text_field {
- char *text;
-};
-
-struct action_field {
- char *text;
- void (* fn)();
-};
-
-struct input_field {
- int lbl_flag;
- char *label;
- char *input;
- int limit;
-};
-
-struct menu_field {
- int no_options;
- int selected;
- char **options;
-};
-
-struct help_link {
-};
-
-struct field {
- int type;
- int y;
- int x;
- int height;
- int width;
- int attr;
- int selattr;
- int next;
- int up;
- int down;
- int left;
- int right;
- union {
- struct text_field *text;
- struct action_field *action;
- struct input_field *input;
- struct menu_field *menu;
- }field;
- /*
- struct help_link help;
- */
-};
-
-/* Externally visible keymap table for user-definable keymaps */
-extern unsigned int keymap[];
-
-/* Externally visible function declarations */
-int update_form(struct form *);
-int initfrm(struct form *);
-void endfrm(struct form *);
-void exit_form(void);
-void cancel_form(void);
-void print_status(char *);
diff --git a/lib/libforms/internal.h.orig b/lib/libforms/internal.h.orig
deleted file mode 100644
index 6895de2..0000000
--- a/lib/libforms/internal.h.orig
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 1995 Paul Richards.
- *
- * All rights reserved.
- *
- * This software may be used, modified, copied, distributed, and
- * sold, in both source and binary form provided that the above
- * copyright and these terms are retained, verbatim, as the first
- * lines of this file. Under no circumstances is the author
- * responsible for the proper functioning of this software, nor does
- * the author assume any responsibility for damages incurred with
- * its use.
- */
-
-#define F_UP f_keymap[0]
-#define F_DOWN f_keymap[1]
-#define F_RIGHT f_keymap[2]
-#define F_LEFT f_keymap[3]
-#define F_NEXT f_keymap[4]
-#define F_CLEFT f_keymap[5]
-#define F_CRIGHT f_keymap[6]
-#define F_CHOME f_keymap[7]
-#define F_CEND f_keymap[8]
-#define F_CBS f_keymap[9]
-#define F_CDEL f_keymap[10]
-#define F_ACCEPT f_keymap[11]
-
-/* Private function declarations */
-static void show_form(struct form *);
-static void disp_text(struct form *, int);
-static void disp_menu(struct form *, int);
-static void disp_action(struct form *, int);
-static void disp_input(struct form *, int);
-static void field_menu(struct form *);
-static void field_input(struct form *);
-static void field_action(struct form *);
-static int print_string(WINDOW *, int, int, int, int, char *);
-static int next_field(struct form *form, int);
diff --git a/lib/libforms/lex.c b/lib/libforms/lex.c
deleted file mode 100644
index 0ce735f..0000000
--- a/lib/libforms/lex.c
+++ /dev/null
@@ -1,1606 +0,0 @@
-/* A lexical scanner generated by flex */
-
-/* Scanner skeleton version:
- * $Header: /home/ncvs/src/usr.bin/lex/skel.c,v 1.1.1.1 1994/08/24 13:10:31 csgr Exp $
- */
-
-#define FLEX_SCANNER
-
-#include <stdio.h>
-
-
-/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
-#ifdef c_plusplus
-#ifndef __cplusplus
-#define __cplusplus
-#endif
-#endif
-
-
-#ifdef __cplusplus
-
-#include <stdlib.h>
-#include <unistd.h>
-
-/* Use prototypes in function declarations. */
-#define YY_USE_PROTOS
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else /* ! __cplusplus */
-
-#ifdef __STDC__
-
-#define YY_USE_PROTOS
-#define YY_USE_CONST
-
-#endif /* __STDC__ */
-#endif /* ! __cplusplus */
-
-
-#ifdef __TURBOC__
-#define YY_USE_CONST
-#endif
-
-
-#ifndef YY_USE_CONST
-#ifndef const
-#define const
-#endif
-#endif
-
-
-#ifdef YY_USE_PROTOS
-#define YY_PROTO(proto) proto
-#else
-#define YY_PROTO(proto) ()
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index. If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* Enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yy_start = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state.
- */
-#define YY_START ((yy_start - 1) / 2)
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". Now included
- * only for backward compatibility with previous versions of flex.
- */
-#define YY_NEW_FILE yyrestart( yyin )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#define YY_BUF_SIZE 16384
-
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-
-extern int yyleng;
-extern FILE *yyin, *yyout;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- extern int yywrap YY_PROTO(( void ));
-#ifdef __cplusplus
- }
-#endif
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
-/* The funky do-while in the following #define is used to turn the definition
- * int a single C statement (which needs a semi-colon terminator). This
- * avoids problems with code like:
- *
- * if ( condition_holds )
- * yyless( 5 );
- * else
- * do_something_else();
- *
- * Prior to using the do-while the compiler would get upset at the
- * "else" because it interpreted the "if" statement as being all
- * done when it reached the ';' after the yyless() call.
- */
-
-/* Return all but the first 'n' matched characters back to the input stream. */
-
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- *yy_cp = yy_hold_char; \
- yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
-
-#define unput(c) yyunput( c, yytext_ptr )
-
-
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- int yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
- };
-
-static YY_BUFFER_STATE yy_current_buffer = 0;
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- */
-#define YY_CURRENT_BUFFER yy_current_buffer
-
-
-/* yy_hold_char holds the character lost when yytext is formed. */
-static char yy_hold_char;
-
-static int yy_n_chars; /* number of characters read into yy_ch_buf */
-
-
-int yyleng;
-
-/* Points to current character in buffer. */
-static char *yy_c_buf_p = (char *) 0;
-static int yy_init = 1; /* whether we need to initialize */
-static int yy_start = 0; /* start state number */
-
-/* Flag which is used to allow yywrap()'s to do buffer switches
- * instead of setting up a fresh yyin. A bit of a hack ...
- */
-static int yy_did_buffer_switch_on_eof;
-
-static void yyunput YY_PROTO(( int c, char *buf_ptr ));
-void yyrestart YY_PROTO(( FILE *input_file ));
-void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
-void yy_load_buffer_state YY_PROTO(( void ));
-YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
-void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
-void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
-
-static int yy_start_stack_ptr = 0;
-static int yy_start_stack_depth = 0;
-static int *yy_start_stack = 0;
-static void yy_push_state YY_PROTO(( int new_state ));
-static void yy_pop_state YY_PROTO(( void ));
-static int yy_top_state YY_PROTO(( void ));
-
-static void *yy_flex_alloc YY_PROTO(( unsigned int ));
-static void *yy_flex_realloc YY_PROTO(( void *, unsigned int ));
-static void yy_flex_free YY_PROTO(( void * ));
-
-#define yy_new_buffer yy_create_buffer
-
-#define INITIAL 0
-typedef unsigned char YY_CHAR;
-typedef int yy_state_type;
-FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
-extern char *yytext;
-#define yytext_ptr yytext
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy YY_PROTO(( char *, const char *, int ));
-#endif
-
-#ifdef __cplusplus
-static int yyinput YY_PROTO(( void ));
-#else
-static int input YY_PROTO(( void ));
-#endif
-
-static yy_state_type yy_get_previous_state YY_PROTO(( void ));
-static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
-static int yy_get_next_buffer YY_PROTO(( void ));
-static void yy_fatal_error YY_PROTO(( const char msg[] ));
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
- yytext_ptr = yy_bp; \
- yytext_ptr -= yy_more_len; \
- yyleng = yy_cp - yytext_ptr; \
- yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
- yy_c_buf_p = yy_cp;
-
-#define YY_END_OF_BUFFER 46
-static const short int yy_accept[188] =
- { 0,
- 44, 44, 46, 45, 44, 42, 41, 43, 36, 39,
- 18, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 37, 38, 44, 41, 43, 39, 40, 40,
- 40, 40, 16, 15, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 31, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 6, 40, 40, 40, 40, 40, 40, 40, 40, 14,
-
- 40, 40, 40, 9, 40, 11, 40, 32, 40, 40,
- 40, 40, 40, 33, 40, 40, 35, 40, 13, 40,
- 40, 40, 21, 40, 40, 40, 40, 40, 40, 40,
- 5, 40, 40, 40, 40, 7, 40, 40, 24, 26,
- 40, 40, 34, 40, 20, 12, 19, 40, 3, 40,
- 29, 40, 40, 40, 40, 40, 17, 40, 40, 40,
- 40, 8, 4, 40, 40, 40, 25, 40, 40, 10,
- 28, 40, 40, 40, 40, 30, 40, 27, 40, 40,
- 40, 23, 22, 1, 40, 2, 0
- } ;
-
-static const int yy_ec[256] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 1, 2, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 1, 4, 5, 1, 1, 6, 1, 6,
- 6, 1, 1, 7, 1, 1, 1, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 1, 1, 1,
- 9, 1, 1, 1, 10, 10, 11, 10, 10, 12,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 1, 1, 1, 1, 10, 1, 13, 14, 15, 16,
-
- 17, 18, 19, 20, 21, 10, 22, 23, 24, 25,
- 26, 27, 10, 28, 29, 30, 31, 10, 32, 33,
- 34, 10, 35, 6, 36, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
- } ;
-
-static const int yy_meta[37] =
- { 0,
- 1, 1, 2, 3, 1, 4, 1, 4, 1, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 1, 1
- } ;
-
-static const short int yy_base[191] =
- { 0,
- 0, 0, 195, 196, 192, 196, 0, 0, 196, 185,
- 196, 0, 166, 165, 22, 167, 12, 22, 158, 160,
- 23, 28, 174, 169, 158, 171, 26, 25, 166, 155,
- 33, 164, 196, 196, 178, 0, 0, 171, 0, 155,
- 149, 146, 0, 145, 37, 151, 160, 154, 139, 145,
- 152, 147, 148, 152, 147, 140, 144, 129, 131, 139,
- 143, 139, 134, 143, 122, 0, 133, 137, 129, 125,
- 126, 128, 120, 132, 129, 119, 119, 130, 117, 126,
- 123, 120, 118, 120, 106, 114, 117, 103, 111, 103,
- 0, 110, 112, 100, 97, 96, 95, 101, 28, 0,
-
- 97, 101, 99, 0, 29, 0, 89, 0, 89, 93,
- 97, 93, 92, 0, 84, 88, 0, 86, 0, 81,
- 95, 79, 0, 91, 87, 80, 76, 76, 78, 88,
- 0, 71, 72, 76, 77, 0, 67, 75, 0, 0,
- 65, 69, 0, 63, 0, 0, 0, 60, 0, 62,
- 0, 59, 76, 58, 57, 60, 0, 66, 71, 54,
- 65, 0, 0, 51, 66, 66, 0, 53, 57, 0,
- 0, 58, 54, 44, 52, 0, 35, 0, 35, 46,
- 39, 0, 0, 0, 44, 0, 196, 68, 72, 54
- } ;
-
-static const short int yy_def[191] =
- { 0,
- 187, 1, 187, 187, 187, 187, 188, 189, 187, 187,
- 187, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 190, 190, 187, 187, 187, 188, 189, 187, 190, 190,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
-
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 190, 190, 190, 190, 190, 190, 0, 187, 187, 187
- } ;
-
-static const short int yy_nxt[233] =
- { 0,
- 4, 5, 6, 7, 8, 4, 9, 10, 11, 12,
- 13, 14, 15, 16, 17, 18, 12, 19, 20, 21,
- 12, 12, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 12, 32, 33, 34, 42, 46, 48, 52,
- 54, 63, 61, 53, 55, 47, 62, 49, 56, 74,
- 43, 44, 67, 68, 64, 127, 132, 39, 128, 133,
- 186, 185, 184, 183, 182, 181, 180, 75, 36, 36,
- 179, 36, 37, 178, 37, 37, 177, 176, 175, 174,
- 173, 172, 171, 170, 169, 168, 167, 166, 165, 164,
- 163, 162, 161, 160, 159, 158, 157, 156, 155, 154,
-
- 153, 152, 151, 150, 149, 148, 147, 146, 145, 144,
- 143, 142, 141, 140, 139, 138, 137, 136, 135, 134,
- 131, 130, 129, 126, 125, 124, 123, 122, 121, 120,
- 119, 118, 117, 116, 115, 114, 113, 112, 111, 110,
- 109, 108, 107, 106, 105, 104, 103, 102, 101, 100,
- 99, 98, 97, 96, 95, 94, 93, 92, 91, 90,
- 89, 88, 87, 86, 85, 84, 83, 82, 81, 80,
- 79, 78, 77, 76, 73, 72, 71, 70, 38, 35,
- 69, 66, 65, 60, 59, 58, 57, 51, 50, 45,
- 41, 40, 38, 35, 187, 3, 187, 187, 187, 187,
-
- 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
- 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
- 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
- 187, 187
- } ;
-
-static const short int yy_chk[233] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 15, 17, 18, 21,
- 22, 28, 27, 21, 22, 17, 27, 18, 22, 45,
- 15, 15, 31, 31, 28, 99, 105, 190, 99, 105,
- 185, 181, 180, 179, 177, 175, 174, 45, 188, 188,
- 173, 188, 189, 172, 189, 189, 169, 168, 166, 165,
- 164, 161, 160, 159, 158, 156, 155, 154, 153, 152,
- 150, 148, 144, 142, 141, 138, 137, 135, 134, 133,
-
- 132, 130, 129, 128, 127, 126, 125, 124, 122, 121,
- 120, 118, 116, 115, 113, 112, 111, 110, 109, 107,
- 103, 102, 101, 98, 97, 96, 95, 94, 93, 92,
- 90, 89, 88, 87, 86, 85, 84, 83, 82, 81,
- 80, 79, 78, 77, 76, 75, 74, 73, 72, 71,
- 70, 69, 68, 67, 65, 64, 63, 62, 61, 60,
- 59, 58, 57, 56, 55, 54, 53, 52, 51, 50,
- 49, 48, 47, 46, 44, 42, 41, 40, 38, 35,
- 32, 30, 29, 26, 25, 24, 23, 20, 19, 16,
- 14, 13, 10, 5, 3, 187, 187, 187, 187, 187,
-
- 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
- 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
- 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
- 187, 187
- } ;
-
-static yy_state_type yy_last_accepting_state;
-static char *yy_last_accepting_cpos;
-
-/* The intent behind this definition is that it'll catch
- * any uses of REJECT which flex missed.
- */
-#define REJECT reject_used_but_not_detected
-static int yy_more_flag = 0;
-static int yy_more_len = 0;
-#define yymore() (yy_more_flag = 1)
-#define YY_MORE_ADJ yy_more_len
-char *yytext;
-# line 1 "lex.l"
-# line 2 "lex.l"
-/*-
- * Copyright (c) 1995
- * Paul Richards. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce 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 Paul Richards.
- * 4. The name Paul Richards may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PAUL RICHARDS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL PAUL RICHARDS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-#include <unistd.h>
-
-#include "y.tab.h"
-extern int lineno;
-extern int charno;
-extern int off;
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifdef YY_MALLOC_DECL
-YY_MALLOC_DECL
-#else
-#if __STDC__
-#ifndef __cplusplus
-#include <stdlib.h>
-#endif
-#else
-/* Just try to get by without declaring the routines. This will fail
- * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
- * or sizeof(void*) != sizeof(int).
- */
-#endif
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#define YY_READ_BUF_SIZE 8192
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-
-#ifndef ECHO
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
-#endif
-
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
- if ( yy_current_buffer->yy_is_interactive ) \
- { \
- int c = getc( yyin ); \
- result = c == EOF ? 0 : 1; \
- buf[0] = (char) c; \
- } \
- else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
- && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" );
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
-#endif
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL int yylex YY_PROTO(( void ))
-#endif
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK break;
-#endif
-
-YY_DECL
- {
- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
-
-# line 43 "lex.l"
-
-
- if ( yy_init )
- {
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
-
- if ( ! yy_start )
- yy_start = 1; /* first start state */
-
- if ( ! yyin )
- yyin = stdin;
-
- if ( ! yyout )
- yyout = stdout;
-
- if ( yy_current_buffer )
- yy_init_buffer( yy_current_buffer, yyin );
- else
- yy_current_buffer =
- yy_create_buffer( yyin, YY_BUF_SIZE );
-
- yy_load_buffer_state();
-
- yy_init = 0;
- }
-
- while ( 1 ) /* loops until end-of-file is reached */
- {
- yy_more_len = 0;
- if ( yy_more_flag )
- {
- yy_more_len = yyleng;
- yy_more_flag = 0;
- }
- yy_cp = yy_c_buf_p;
-
- /* Support of yytext. */
- *yy_cp = yy_hold_char;
-
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
-
- yy_current_state = yy_start;
-yy_match:
- do
- {
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
- if ( yy_accept[yy_current_state] )
- {
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 188 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- ++yy_cp;
- }
- while ( yy_base[yy_current_state] != 196 );
-
-yy_find_action:
- yy_act = yy_accept[yy_current_state];
-
- YY_DO_BEFORE_ACTION;
-
-
-do_action: /* This label is used only to access EOF actions. */
-
-
- switch ( yy_act )
- { /* beginning of action switch */
- case 0: /* must back up */
- /* undo the effects of YY_DO_BEFORE_ACTION */
- *yy_cp = yy_hold_char;
- yy_cp = yy_last_accepting_cpos;
- yy_current_state = yy_last_accepting_state;
- goto yy_find_action;
-
-case 1:
-YY_USER_ACTION
-# line 44 "lex.l"
-{ return COLORTABLE; }
- YY_BREAK
-case 2:
-YY_USER_ACTION
-# line 45 "lex.l"
-{ return COLORTABLE; }
- YY_BREAK
-case 3:
-YY_USER_ACTION
-# line 46 "lex.l"
-{ return COLOR; }
- YY_BREAK
-case 4:
-YY_USER_ACTION
-# line 47 "lex.l"
-{ return COLOR; }
- YY_BREAK
-case 5:
-YY_USER_ACTION
-# line 48 "lex.l"
-{ return BLACK; }
- YY_BREAK
-case 6:
-YY_USER_ACTION
-# line 49 "lex.l"
-{ return RED; }
- YY_BREAK
-case 7:
-YY_USER_ACTION
-# line 50 "lex.l"
-{ return GREEN; }
- YY_BREAK
-case 8:
-YY_USER_ACTION
-# line 51 "lex.l"
-{ return YELLOW; }
- YY_BREAK
-case 9:
-YY_USER_ACTION
-# line 52 "lex.l"
-{ return BLUE; }
- YY_BREAK
-case 10:
-YY_USER_ACTION
-# line 53 "lex.l"
-{ return MAGENTA; }
- YY_BREAK
-case 11:
-YY_USER_ACTION
-# line 54 "lex.l"
-{ return CYAN; }
- YY_BREAK
-case 12:
-YY_USER_ACTION
-# line 55 "lex.l"
-{ return WHITE; }
- YY_BREAK
-case 13:
-YY_USER_ACTION
-# line 56 "lex.l"
-{ return PAIR; }
- YY_BREAK
-case 14:
-YY_USER_ACTION
-# line 57 "lex.l"
-{ return FORM; }
- YY_BREAK
-case 15:
-YY_USER_ACTION
-# line 58 "lex.l"
-{ return AT; }
- YY_BREAK
-case 16:
-YY_USER_ACTION
-# line 59 "lex.l"
-{ return AS; }
- YY_BREAK
-case 17:
-YY_USER_ACTION
-# line 60 "lex.l"
-{ return HEIGHT; }
- YY_BREAK
-case 18:
-YY_USER_ACTION
-# line 61 "lex.l"
-{ return EQUALS; }
- YY_BREAK
-case 19:
-YY_USER_ACTION
-# line 62 "lex.l"
-{ return WIDTH; }
- YY_BREAK
-case 20:
-YY_USER_ACTION
-# line 63 "lex.l"
-{ return STARTFIELD; }
- YY_BREAK
-case 21:
-YY_USER_ACTION
-# line 64 "lex.l"
-{ return TEXT; }
- YY_BREAK
-case 22:
-YY_USER_ACTION
-# line 65 "lex.l"
-{ return ATTR; }
- YY_BREAK
-case 23:
-YY_USER_ACTION
-# line 66 "lex.l"
-{ return SELATTR; }
- YY_BREAK
-case 24:
-YY_USER_ACTION
-# line 67 "lex.l"
-{ return LABEL; }
- YY_BREAK
-case 25:
-YY_USER_ACTION
-# line 68 "lex.l"
-{ return DEFAULT; }
- YY_BREAK
-case 26:
-YY_USER_ACTION
-# line 69 "lex.l"
-{ return LIMIT; }
- YY_BREAK
-case 27:
-YY_USER_ACTION
-# line 70 "lex.l"
-{ return SELECTED; }
- YY_BREAK
-case 28:
-YY_USER_ACTION
-# line 71 "lex.l"
-{ return OPTIONS; }
- YY_BREAK
-case 29:
-YY_USER_ACTION
-# line 72 "lex.l"
-{ return ACTION; }
- YY_BREAK
-case 30:
-YY_USER_ACTION
-# line 73 "lex.l"
-{ return FUNC; }
- YY_BREAK
-case 31:
-YY_USER_ACTION
-# line 74 "lex.l"
-{ return UP; }
- YY_BREAK
-case 32:
-YY_USER_ACTION
-# line 75 "lex.l"
-{ return DOWN; }
- YY_BREAK
-case 33:
-YY_USER_ACTION
-# line 76 "lex.l"
-{ return LEFT; }
- YY_BREAK
-case 34:
-YY_USER_ACTION
-# line 77 "lex.l"
-{ return RIGHT; }
- YY_BREAK
-case 35:
-YY_USER_ACTION
-# line 78 "lex.l"
-{ return NEXT; }
- YY_BREAK
-case 36:
-YY_USER_ACTION
-# line 79 "lex.l"
-{ return COMMA; }
- YY_BREAK
-case 37:
-YY_USER_ACTION
-# line 80 "lex.l"
-{ return LBRACE; }
- YY_BREAK
-case 38:
-YY_USER_ACTION
-# line 81 "lex.l"
-{ return RBRACE; }
- YY_BREAK
-case 39:
-YY_USER_ACTION
-# line 82 "lex.l"
-{ yylval.ival = atoi(yytext); return NUMBER; }
- YY_BREAK
-case 40:
-YY_USER_ACTION
-# line 83 "lex.l"
-{ yylval.sval = yytext; return NAME; }
- YY_BREAK
-case 41:
-YY_USER_ACTION
-# line 84 "lex.l"
-{
- if (yytext[yyleng-1] == '\\') {
- yymore();
- } else {
- input();
- yylval.sval = yytext+1;
- return STRING;
- }
- }
- YY_BREAK
-case 42:
-YY_USER_ACTION
-# line 93 "lex.l"
-{ lineno++; }
- YY_BREAK
-case 43:
-YY_USER_ACTION
-# line 94 "lex.l"
-{ /* Ignored (comment) */; }
- YY_BREAK
-case 44:
-YY_USER_ACTION
-# line 95 "lex.l"
-{ /* Ignored (white space) */; }
- YY_BREAK
-case 45:
-YY_USER_ACTION
-# line 96 "lex.l"
-ECHO;
- YY_BREAK
-case YY_STATE_EOF(INITIAL):
- yyterminate();
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = yy_cp - yytext_ptr - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yy_hold_char;
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * yylex(). If so, then we have to assure
- * consistency between yy_current_buffer and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- yy_n_chars = yy_current_buffer->yy_n_chars;
- yy_current_buffer->yy_input_file = yyin;
- yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state();
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state );
-
- yy_bp = yytext_ptr + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
- yy_cp = yy_c_buf_p;
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer() )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yy_did_buffer_switch_on_eof = 0;
-
- if ( yywrap() )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p =
- yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state();
-
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- yy_c_buf_p =
- &yy_current_buffer->yy_ch_buf[yy_n_chars];
-
- yy_current_state = yy_get_previous_state();
-
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
- } /* end of yylex */
-
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
- */
-
-static int yy_get_next_buffer()
- {
- register char *dest = yy_current_buffer->yy_ch_buf;
- register char *source = yytext_ptr - 1; /* copy prev. char, too */
- register int number_to_move, i;
- int ret_val;
-
- if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( yy_current_buffer->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
- {
- /* We matched a singled characater, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = yy_c_buf_p - yytext_ptr;
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- yy_n_chars = 0;
-
- else
- {
- int num_to_read =
- yy_current_buffer->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-#ifdef YY_USES_REJECT
- YY_FATAL_ERROR(
-"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
-#else
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = yy_current_buffer;
-
- int yy_c_buf_p_offset = yy_c_buf_p - b->yy_ch_buf;
-
- b->yy_buf_size *= 2;
- b->yy_ch_buf = (char *)
- yy_flex_realloc( (void *) b->yy_ch_buf,
- b->yy_buf_size );
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = yy_current_buffer->yy_buf_size -
- number_to_move - 1;
-#endif
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
- yy_n_chars, num_to_read );
- }
-
- if ( yy_n_chars == 0 )
- {
- if ( number_to_move - YY_MORE_ADJ == 1 )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- yyrestart( yyin );
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- yy_current_buffer->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- yy_n_chars += number_to_move;
- yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
-
- /* yytext begins at the second character in yy_ch_buf; the first
- * character is the one which preceded it before reading in the latest
- * buffer; it needs to be kept around in case it's a newline, so
- * yy_get_previous_state() will have with '^' rules active.
- */
-
- yytext_ptr = &yy_current_buffer->yy_ch_buf[1];
-
- return ret_val;
- }
-
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-static yy_state_type yy_get_previous_state()
- {
- register yy_state_type yy_current_state;
- register char *yy_cp;
-
- yy_current_state = yy_start;
-
- for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
- {
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
- if ( yy_accept[yy_current_state] )
- {
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 188 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- }
-
- return yy_current_state;
- }
-
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
-
-#ifdef YY_USE_PROTOS
-static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
-#else
-static yy_state_type yy_try_NUL_trans( yy_current_state )
-yy_state_type yy_current_state;
-#endif
- {
- register int yy_is_jam;
- register char *yy_cp = yy_c_buf_p;
-
- register YY_CHAR yy_c = 1;
- if ( yy_accept[yy_current_state] )
- {
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 188 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 187);
-
- return yy_is_jam ? 0 : yy_current_state;
- }
-
-
-#ifdef YY_USE_PROTOS
-static void yyunput( int c, register char *yy_bp )
-#else
-static void yyunput( c, yy_bp )
-int c;
-register char *yy_bp;
-#endif
- {
- register char *yy_cp = yy_c_buf_p;
-
- /* undo effects of setting up yytext */
- *yy_cp = yy_hold_char;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- { /* need to shift things up to make room */
- /* +2 for EOB chars. */
- register int number_to_move = yy_n_chars + 2;
- register char *dest = &yy_current_buffer->yy_ch_buf[
- yy_current_buffer->yy_buf_size + 2];
- register char *source =
- &yy_current_buffer->yy_ch_buf[number_to_move];
-
- while ( source > yy_current_buffer->yy_ch_buf )
- *--dest = *--source;
-
- yy_cp += dest - source;
- yy_bp += dest - source;
- yy_n_chars = yy_current_buffer->yy_buf_size;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- YY_FATAL_ERROR( "flex scanner push-back overflow" );
- }
-
- if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
- yy_cp[-2] = '\n';
-
- *--yy_cp = (char) c;
-
-
- /* Note: the formal parameter *must* be called "yy_bp" for this
- * macro to now work correctly.
- */
- YY_DO_BEFORE_ACTION; /* set up yytext again */
- }
-
-
-#ifdef __cplusplus
-static int yyinput()
-#else
-static int input()
-#endif
- {
- int c;
-
- *yy_c_buf_p = yy_hold_char;
-
- if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
- /* This was really a NUL. */
- *yy_c_buf_p = '\0';
-
- else
- { /* need more input */
- yytext_ptr = yy_c_buf_p;
- ++yy_c_buf_p;
-
- switch ( yy_get_next_buffer() )
- {
- case EOB_ACT_END_OF_FILE:
- {
- if ( yywrap() )
- {
- yy_c_buf_p =
- yytext_ptr + YY_MORE_ADJ;
- return EOF;
- }
-
- YY_NEW_FILE;
-#ifdef __cplusplus
- return yyinput();
-#else
- return input();
-#endif
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
- break;
-
- case EOB_ACT_LAST_MATCH:
-#ifdef __cplusplus
- YY_FATAL_ERROR(
- "unexpected last match in yyinput()" );
-#else
- YY_FATAL_ERROR(
- "unexpected last match in input()" );
-#endif
- }
- }
- }
-
- c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
- *yy_c_buf_p = '\0'; /* preserve yytext */
- yy_hold_char = *++yy_c_buf_p;
-
- return c;
- }
-
-
-#ifdef YY_USE_PROTOS
-void yyrestart( FILE *input_file )
-#else
-void yyrestart( input_file )
-FILE *input_file;
-#endif
- {
- if ( ! yy_current_buffer )
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
-
- yy_init_buffer( yy_current_buffer, input_file );
- yy_load_buffer_state();
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
-#else
-void yy_switch_to_buffer( new_buffer )
-YY_BUFFER_STATE new_buffer;
-#endif
- {
- if ( yy_current_buffer == new_buffer )
- return;
-
- if ( yy_current_buffer )
- {
- /* Flush out information for old buffer. */
- *yy_c_buf_p = yy_hold_char;
- yy_current_buffer->yy_buf_pos = yy_c_buf_p;
- yy_current_buffer->yy_n_chars = yy_n_chars;
- }
-
- yy_current_buffer = new_buffer;
- yy_load_buffer_state();
-
- /* We don't actually know whether we did this switch during
- * EOF (yywrap()) processing, but the only time this flag
- * is looked at is after yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yy_did_buffer_switch_on_eof = 1;
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_load_buffer_state( void )
-#else
-void yy_load_buffer_state()
-#endif
- {
- yy_n_chars = yy_current_buffer->yy_n_chars;
- yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
- yyin = yy_current_buffer->yy_input_file;
- yy_hold_char = *yy_c_buf_p;
- }
-
-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
-#else
-YY_BUFFER_STATE yy_create_buffer( file, size )
-FILE *file;
-int size;
-#endif
- {
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
-
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_buf_size = size;
-
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- yy_init_buffer( b, file );
-
- return b;
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_delete_buffer( YY_BUFFER_STATE b )
-#else
-void yy_delete_buffer( b )
-YY_BUFFER_STATE b;
-#endif
- {
- if ( b == yy_current_buffer )
- yy_current_buffer = (YY_BUFFER_STATE) 0;
-
- yy_flex_free( (void *) b->yy_ch_buf );
- yy_flex_free( (void *) b );
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
-#else
-void yy_init_buffer( b, file )
-YY_BUFFER_STATE b;
-FILE *file;
-#endif
- {
- b->yy_input_file = file;
-
- /* We put in the '\n' and start reading from [1] so that an
- * initial match-at-newline will be true.
- */
-
- b->yy_ch_buf[0] = '\n';
- b->yy_n_chars = 1;
-
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
-
- b->yy_buf_pos = &b->yy_ch_buf[1];
-
- b->yy_is_interactive = file ? isatty( fileno(file) ) : 0;
-
- b->yy_fill_buffer = 1;
-
- b->yy_buffer_status = YY_BUFFER_NEW;
- }
-
-
-#ifdef YY_USE_PROTOS
-static void yy_push_state( int new_state )
-#else
-static void yy_push_state( new_state )
-int new_state;
-#endif
- {
- if ( yy_start_stack_ptr >= yy_start_stack_depth )
- {
- int new_size;
-
- yy_start_stack_depth += YY_START_STACK_INCR;
- new_size = yy_start_stack_depth * sizeof( int );
-
- if ( ! yy_start_stack )
- yy_start_stack = (int *) yy_flex_alloc( new_size );
-
- else
- yy_start_stack = (int *) yy_flex_realloc(
- (void *) yy_start_stack, new_size );
-
- if ( ! yy_start_stack )
- YY_FATAL_ERROR(
- "out of memory expanding start-condition stack" );
- }
-
- yy_start_stack[yy_start_stack_ptr++] = YY_START;
-
- BEGIN(new_state);
- }
-
-
-static void yy_pop_state()
- {
- if ( --yy_start_stack_ptr < 0 )
- YY_FATAL_ERROR( "start-condition stack underflow" );
-
- BEGIN(yy_start_stack[yy_start_stack_ptr]);
- }
-
-
-static int yy_top_state()
- {
- return yy_start_stack[yy_start_stack_ptr - 1];
- }
-
-
-#ifdef YY_USE_PROTOS
-static void yy_fatal_error( const char msg[] )
-#else
-static void yy_fatal_error( msg )
-char msg[];
-#endif
- {
- (void) fprintf( stderr, "%s\n", msg );
- exit( 1 );
- }
-
-
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- yytext[yyleng] = yy_hold_char; \
- yy_c_buf_p = yytext + n - YY_MORE_ADJ; \
- yy_hold_char = *yy_c_buf_p; \
- *yy_c_buf_p = '\0'; \
- yyleng = n; \
- } \
- while ( 0 )
-
-
-/* Internal utility routines. */
-
-#ifndef yytext_ptr
-#ifdef YY_USE_PROTOS
-static void yy_flex_strncpy( char *s1, const char *s2, int n )
-#else
-static void yy_flex_strncpy( s1, s2, n )
-char *s1;
-const char *s2;
-int n;
-#endif
- {
- register int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
- }
-#endif
-
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_alloc( unsigned int size )
-#else
-static void *yy_flex_alloc( size )
-unsigned int size;
-#endif
- {
- return (void *) malloc( size );
- }
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_realloc( void *ptr, unsigned int size )
-#else
-static void *yy_flex_realloc( ptr, size )
-void *ptr;
-unsigned int size;
-#endif
- {
- return (void *) realloc( ptr, size );
- }
-
-#ifdef YY_USE_PROTOS
-static void yy_flex_free( void *ptr )
-#else
-static void yy_flex_free( ptr )
-void *ptr;
-#endif
- {
- free( ptr );
- }
-# line 96 "lex.l"
diff --git a/lib/libforms/menu.c b/lib/libforms/menu.c
deleted file mode 100644
index b234549..0000000
--- a/lib/libforms/menu.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 1995
- * Paul Richards. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce 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 Paul Richards.
- * 4. The name Paul Richards may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PAUL RICHARDS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL PAUL RICHARDS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <strhash.h>
-#include <forms.h>
-#include <stdlib.h>
-#include <string.h>
-
-int
-add_menu_option(struct MenuField *menu, char *option)
-{
- char **tmp;
- int len;
-
- tmp = (char **)realloc(menu->options, (menu->no_options + 1) * sizeof(char**));
- if (!tmp)
- return (0);
- else
- menu->options = tmp;
-
- len = strlen(option) + 1;
- menu->options[menu->no_options] = (char *)malloc(len);
- if (!menu->options[menu->no_options])
- return (0);
- strncpy(menu->options[menu->no_options], option, len);
-
- return (++menu->no_options);
-}
diff --git a/lib/libforms/parser.c b/lib/libforms/parser.c
deleted file mode 100644
index c5ca0aa..0000000
--- a/lib/libforms/parser.c
+++ /dev/null
@@ -1,1022 +0,0 @@
-#ifndef lint
-static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define yyclearin (yychar=(-1))
-#define yyerrok (yyerrflag=0)
-#define YYRECOVERING (yyerrflag!=0)
-#define YYPREFIX "yy"
-#line 2 "parser.y"
-/*-
- * Copyright (c) 1995
- * Paul Richards. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce 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 Paul Richards.
- * 4. The name Paul Richards may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PAUL RICHARDS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL PAUL RICHARDS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <forms.h>
-#include <err.h>
-
-#include "internal.h"
-
-char *cpstr(char *);
-
-extern int yyleng;
-int lineno = 1;
-int charno = 1;
-int off;
-
-char *fieldname;
-char *defname;
-char *formname;
-char *startname;
-char *colortable;
-int formattr;
-char *text;
-char *label;
-char *function;
-char *up, *down, *left, *right, *next;
-int height, width;
-int y, x;
-int width;
-int limit;
-int attr;
-int selattr;
-int type;
-int lbl_flag;
-int selected, no_options=0;
-
-extern FILE *outf;
-
-struct MenuList {
- char *option;
- struct MenuList *next;
-};
-
-struct MenuList *cur_menu;
-struct MenuList *menu_list;
-struct MenuList *menu;
-
-struct pair_node {
- char *foreground;
- char *background;
- struct pair_node *next;
-};
-struct pair_node *pair_list;
-struct pair_node *cur_pair;
-struct pair_node *pair;
-
-struct color_table {
- char *tablename;
- struct pair_node *pairs;
- struct color_table *next;
-};
-
-struct color_table *color_table;
-struct color_table *cur_table;
-struct color_table *color_tables;
-
-struct Form *form;
-struct Field *field_inst_list;
-struct Field *field;
-struct Field *cur_field;
-#line 106 "parser.y"
-typedef union {
- int ival;
- char *sval;
-} YYSTYPE;
-#line 120 "y.tab.c"
-#define FORM 257
-#define COLORTABLE 258
-#define COLOR 259
-#define BLACK 260
-#define RED 261
-#define GREEN 262
-#define YELLOW 263
-#define BLUE 264
-#define MAGENTA 265
-#define CYAN 266
-#define WHITE 267
-#define PAIR 268
-#define NAME 269
-#define STRING 270
-#define AT 271
-#define AS 272
-#define HEIGHT 273
-#define EQUALS 274
-#define NUMBER 275
-#define WIDTH 276
-#define STARTFIELD 277
-#define COMMA 278
-#define LBRACE 279
-#define RBRACE 280
-#define TEXT 281
-#define ATTR 282
-#define SELATTR 283
-#define DEFAULT 284
-#define LABEL 285
-#define LIMIT 286
-#define SELECTED 287
-#define OPTIONS 288
-#define ACTION 289
-#define FUNC 290
-#define LINK 291
-#define UP 292
-#define DOWN 293
-#define LEFT 294
-#define RIGHT 295
-#define NEXT 296
-#define DEF 297
-#define YYERRCODE 256
-short yylhs[] = { -1,
- 0, 0, 0, 0, 5, 4, 6, 6, 8, 7,
- 1, 1, 1, 1, 1, 1, 1, 1, 9, 11,
- 3, 12, 15, 15, 16, 16, 17, 17, 18, 18,
- 21, 23, 19, 25, 2, 20, 26, 20, 20, 24,
- 22, 22, 30, 30, 30, 30, 30, 29, 29, 29,
- 29, 31, 32, 35, 35, 36, 36, 33, 37, 37,
- 38, 34, 13, 13, 14, 14, 27, 27, 28, 28,
- 10,
-};
-short yylen[] = { 2,
- 0, 2, 2, 2, 0, 6, 0, 2, 0, 6,
- 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 9, 6, 0, 3, 0, 3, 0, 3, 0, 2,
- 0, 0, 7, 0, 3, 0, 0, 4, 1, 7,
- 0, 3, 3, 3, 3, 3, 3, 1, 1, 1,
- 1, 3, 1, 4, 4, 0, 3, 6, 1, 3,
- 1, 6, 0, 3, 0, 3, 0, 3, 0, 3,
- 3,
-};
-short yydefred[] = { 1,
- 0, 0, 0, 34, 2, 3, 4, 19, 5, 0,
- 0, 0, 0, 35, 0, 7, 0, 0, 0, 20,
- 0, 0, 0, 0, 0, 0, 0, 6, 8, 64,
- 0, 0, 0, 71, 0, 0, 66, 0, 0, 0,
- 0, 0, 11, 12, 13, 14, 15, 16, 17, 18,
- 9, 68, 0, 0, 0, 0, 0, 0, 0, 48,
- 49, 50, 51, 53, 21, 0, 0, 70, 0, 0,
- 0, 0, 0, 40, 0, 0, 0, 52, 0, 0,
- 0, 0, 0, 0, 0, 10, 0, 55, 54, 0,
- 0, 24, 0, 0, 29, 0, 0, 0, 26, 0,
- 0, 57, 61, 0, 59, 62, 28, 31, 30, 0,
- 0, 60, 0, 0, 39, 37, 0, 0, 32, 38,
- 41, 0, 0, 0, 0, 0, 0, 0, 42, 0,
- 0, 0, 0, 0, 43, 44, 45, 46, 47,
-};
-short yydgoto[] = { 1,
- 51, 5, 6, 7, 12, 21, 29, 67, 11, 20,
- 26, 41, 18, 24, 76, 85, 95, 101, 109, 114,
- 111, 122, 121, 14, 10, 118, 33, 40, 59, 129,
- 60, 61, 62, 63, 64, 88, 104, 105,
-};
-short yysindex[] = { 0,
- -252, -261, -240, 0, 0, 0, 0, 0, 0, -248,
- -234, -237, -225, 0, -236, 0, -219, -214, -212, 0,
- -259, -216, -205, -196, -204, -192, -186, 0, 0, 0,
- -185, -183, -194, 0, -225, -187, 0, -182, -180, -224,
- -188, -214, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, -179, -177, -176, -175, -174, -173, -178, 0,
- 0, 0, 0, 0, 0, -172, -171, 0, -167, -166,
- -164, -165, -162, 0, -163, -149, -187, 0, -191, -191,
- -170, -169, -157, -161, -168, 0, -159, 0, 0, -158,
- -155, 0, -152, -154, 0, -153, -147, -145, 0, -150,
- -143, 0, 0, -151, 0, 0, 0, 0, 0, -147,
- -148, 0, -263, -142, 0, 0, -236, -146, 0, 0,
- 0, -141, -211, -144, -139, -138, -136, -135, 0, -137,
- -129, -128, -127, -126, 0, 0, 0, 0, 0,
-};
-short yyrindex[] = { 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, -249, 0, 0, 0, 0, -238, 0, 0,
- 0, 0, 0, -231, 0, 0, 0, 0, 0, 0,
- 0, 0, -217, 0, -258, 0, 0, 0, 0, 0,
- 0, -257, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, -254, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, -266, 0, 0, -134, -134,
- 0, 0, 0, 0, -267, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- -133, 0, 0, -132, 0, 0, 0, 0, 0, 0,
- -122, 0, -249, 0, 0, 0, 0, 0, 0, 0,
- 0, -239, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-};
-short yygindex[] = { 0,
- 51, 0, 0, 0, 0, 0, 0, 0, 0, 16,
- 0, 0, 109, 103, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 39, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 71, 0, 42,
-};
-#define YYTABLESIZE 152
-short yytable[] = { 63,
- 65, 27, 25, 23, 2, 116, 3, 8, 27, 17,
- 63, 65, 27, 25, 23, 25, 4, 63, 63, 65,
- 28, 63, 65, 63, 65, 23, 63, 23, 9, 33,
- 13, 63, 63, 63, 63, 63, 15, 63, 19, 63,
- 33, 16, 65, 65, 65, 65, 65, 17, 65, 67,
- 65, 67, 67, 67, 22, 67, 54, 67, 30, 55,
- 56, 23, 57, 69, 58, 25, 69, 69, 31, 69,
- 34, 69, 43, 44, 45, 46, 47, 48, 49, 50,
- 124, 125, 126, 127, 128, 32, 35, 36, 39, 37,
- 38, 65, 52, 53, 87, 68, 69, 70, 71, 72,
- 73, 74, 78, 79, 75, 80, 77, 82, 84, 81,
- 83, 92, 93, 94, 96, 97, 99, 90, 98, 100,
- 91, 102, 103, 106, 107, 108, 110, 86, 117, 130,
- 113, 135, 119, 120, 131, 132, 123, 133, 134, 136,
- 137, 138, 139, 42, 66, 56, 22, 58, 36, 115,
- 89, 112,
-};
-short yycheck[] = { 258,
- 258, 269, 269, 258, 257, 269, 259, 269, 268, 273,
- 269, 269, 280, 280, 269, 282, 269, 276, 277, 277,
- 280, 280, 280, 282, 282, 280, 276, 282, 269, 269,
- 279, 281, 282, 283, 284, 285, 271, 287, 275, 289,
- 280, 279, 281, 282, 283, 284, 285, 273, 287, 281,
- 289, 283, 284, 285, 274, 287, 281, 289, 275, 284,
- 285, 276, 287, 281, 289, 278, 284, 285, 274, 287,
- 275, 289, 260, 261, 262, 263, 264, 265, 266, 267,
- 292, 293, 294, 295, 296, 282, 279, 274, 283, 275,
- 274, 280, 275, 274, 286, 275, 274, 274, 274, 274,
- 274, 280, 270, 270, 277, 270, 278, 270, 258, 275,
- 274, 269, 274, 282, 274, 274, 269, 288, 274, 274,
- 290, 275, 270, 269, 275, 269, 278, 77, 271, 274,
- 279, 269, 117, 280, 274, 274, 278, 274, 274, 269,
- 269, 269, 269, 35, 42, 280, 280, 280, 271, 111,
- 80, 110,
-};
-#define YYFINAL 1
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 297
-#if YYDEBUG
-char *yyname[] = {
-"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"FORM","COLORTABLE","COLOR",
-"BLACK","RED","GREEN","YELLOW","BLUE","MAGENTA","CYAN","WHITE","PAIR","NAME",
-"STRING","AT","AS","HEIGHT","EQUALS","NUMBER","WIDTH","STARTFIELD","COMMA",
-"LBRACE","RBRACE","TEXT","ATTR","SELATTR","DEFAULT","LABEL","LIMIT","SELECTED",
-"OPTIONS","ACTION","FUNC","LINK","UP","DOWN","LEFT","RIGHT","NEXT","DEF",
-};
-char *yyrule[] = {
-"$accept : spec",
-"spec :",
-"spec : spec fields",
-"spec : spec forms",
-"spec : spec colours",
-"$$1 :",
-"colours : COLOR NAME $$1 LBRACE color_pairs RBRACE",
-"color_pairs :",
-"color_pairs : color_pairs pair",
-"$$2 :",
-"pair : PAIR EQUALS a_color $$2 COMMA a_color",
-"a_color : BLACK",
-"a_color : RED",
-"a_color : GREEN",
-"a_color : YELLOW",
-"a_color : BLUE",
-"a_color : MAGENTA",
-"a_color : CYAN",
-"a_color : WHITE",
-"$$3 :",
-"$$4 :",
-"forms : FORM NAME $$3 AT coord $$4 LBRACE formspec RBRACE",
-"formspec : height width startfield colortable formattr fieldlocs",
-"startfield :",
-"startfield : STARTFIELD EQUALS NAME",
-"colortable :",
-"colortable : COLORTABLE EQUALS NAME",
-"formattr :",
-"formattr : ATTR EQUALS NUMBER",
-"fieldlocs :",
-"fieldlocs : fieldlocs field_at",
-"$$5 :",
-"$$6 :",
-"field_at : NAME $$5 field_def AT coord $$6 links",
-"$$7 :",
-"fields : NAME $$7 field_spec",
-"field_def :",
-"$$8 :",
-"field_def : LBRACE NAME $$8 RBRACE",
-"field_def : field_spec",
-"field_spec : LBRACE height width attr selattr type RBRACE",
-"links :",
-"links : links COMMA conns",
-"conns : UP EQUALS NAME",
-"conns : DOWN EQUALS NAME",
-"conns : LEFT EQUALS NAME",
-"conns : RIGHT EQUALS NAME",
-"conns : NEXT EQUALS NAME",
-"type : textfield",
-"type : inputfield",
-"type : menufield",
-"type : actionfield",
-"textfield : TEXT EQUALS STRING",
-"inputfield : inputspec",
-"inputspec : LABEL EQUALS STRING limit",
-"inputspec : DEFAULT EQUALS STRING limit",
-"limit :",
-"limit : LIMIT EQUALS NUMBER",
-"menufield : SELECTED EQUALS NUMBER OPTIONS EQUALS menuoptions",
-"menuoptions : menuoption",
-"menuoptions : menuoptions COMMA menuoption",
-"menuoption : STRING",
-"actionfield : ACTION EQUALS STRING FUNC EQUALS NAME",
-"height :",
-"height : HEIGHT EQUALS NUMBER",
-"width :",
-"width : WIDTH EQUALS NUMBER",
-"attr :",
-"attr : ATTR EQUALS NUMBER",
-"selattr :",
-"selattr : SELATTR EQUALS NUMBER",
-"coord : NUMBER COMMA NUMBER",
-};
-#endif
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 500
-#define YYMAXDEPTH 500
-#endif
-#endif
-int yydebug;
-int yynerrs;
-int yyerrflag;
-int yychar;
-short *yyssp;
-YYSTYPE *yyvsp;
-YYSTYPE yyval;
-YYSTYPE yylval;
-short yyss[YYSTACKSIZE];
-YYSTYPE yyvs[YYSTACKSIZE];
-#define yystacksize YYSTACKSIZE
-#line 434 "parser.y"
-
-void
-yyerror (char *error)
-{
- fprintf(stderr, "%s at line %d\n",error, lineno);
- exit(1);
-}
-
-char *
-cpstr(char *ostr)
-{
- char *nstr;
-
- nstr = malloc(strlen(ostr)+1);
- if (!nstr) {
- fprintf(stderr, "Couldn't allocate memory for string\n");
- exit(1);
- }
- strcpy(nstr, ostr);
- return (nstr);
-}
-
-/* Calculate a default height for a field */
-
-void
-calc_field_height(struct Field *field, char *string)
-{
-
- int len;
-
- len = strlen(string);
-
- if (!field->width) {
- /*
- * This is a failsafe, this routine shouldn't be called
- * with a width of 0, the width should be determined
- * first.
- */
- field->height = 1;
- return;
- }
-
- if (len < field->width) {
- field->height = 1;
- return;
- } else
- field->height = len / field->width;
-
- if ((field->height*field->width) < len)
- field->height++;
-
- return;
-}
-
-void
-define_field(char *defname)
-{
- struct Field *field;
- struct MenuList *menu_options;
- int no_options;
-
- field = malloc(sizeof (struct Field));
- if (!field) {
- fprintf(stderr,"Failed to allocate memory for form field\n");
- exit(1);
- }
- field->defname = defname;
- field->type = type;
- field->height = height;
- field->width = width;
- field->attr = attr;
- field->selattr = selattr;
- switch (type) {
- case FF_TEXT:
- field->field.text = malloc(sizeof (struct TextField));
- if (!field->field.text) {
- fprintf(stderr,
- "Failed to allocate memory for text field\n");
- exit (1);
- }
- field->field.text->text = text;
- break;
- case FF_INPUT:
- field->field.input = malloc(sizeof (struct InputField));
- if (!field->field.input) {
- fprintf(stderr,
- "Failed to allocate memory for input field\n");
- exit (1);
- }
- field->field.input->lbl_flag = lbl_flag;
- field->field.input->label = label;
- field->field.input->limit = limit;
- break;
- case FF_MENU:
- printf("field type %s = %d\n", defname,field->type);
- field->field.menu = malloc(sizeof (struct MenuField));
- if (!field->field.menu) {
- fprintf(stderr,
- "Failed to allocate memory for menu field\n");
- exit (1);
- }
- field->field.menu->selected = selected;
- menu_options = menu_list;
- field->field.menu->no_options = 0;
- field->field.menu->options = 0;
- for (; menu_options; menu_options = menu_options->next) {
- no_options = add_menu_option(field->field.menu,
- menu_options->option);
- if (!no_options)
- err(1, "Couldn't add menu option");
- }
- field->field.menu->no_options = no_options;
- cur_menu = 0;
- break;
- case FF_ACTION:
- field->field.action = malloc(sizeof (struct ActionField));
- if (!field->field.action) {
- fprintf(stderr,
- "Failed to allocate memory for action field\n");
- exit (1);
- }
- field->field.action->text = text;
- field->field.action->fn = (void *) function;
- break;
- default:
- break;
- }
- form_bind_tuple(defname, FT_FIELD_DEF, field);
- width=0;
- height = 0;
- attr=0;
- selattr=0;
- limit=0;
-}
-#line 531 "y.tab.c"
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-int
-yyparse()
-{
- register int yym, yyn, yystate;
-#if YYDEBUG
- register char *yys;
- extern char *getenv();
-
- if (yys = getenv("YYDEBUG"))
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = (-1);
-
- yyssp = yyss;
- yyvsp = yyvs;
- *yyssp = yystate = 0;
-
-yyloop:
- if (yyn = yydefred[yystate]) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = yylex()) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
- yychar = (-1);
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-#ifdef lint
- goto yynewerror;
-#endif
-yynewerror:
- yyerror("syntax error");
-#ifdef lint
- goto yyerrlab;
-#endif
-yyerrlab:
- ++yynerrs;
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
-#endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yyssp);
-#endif
- if (yyssp <= yyss) goto yyabort;
- --yyssp;
- --yyvsp;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = (-1);
- goto yyloop;
- }
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- yyval = yyvsp[1-yym];
- switch (yyn)
- {
-case 5:
-#line 166 "parser.y"
-{
- color_table = malloc(sizeof (struct color_table));
- if (!color_table) {
- fprintf(stderr, "Couldn't allocate memory for a color table\n");
- exit (1);
- }
- color_table->tablename = cpstr(yyvsp[0].sval);
- }
-break;
-case 6:
-#line 175 "parser.y"
-{
- color_table->pairs = pair_list;
- cur_pair = 0;
- form_bind_tuple(color_table->tablename, FT_COLTAB, color_table);
- }
-break;
-case 9:
-#line 187 "parser.y"
-{
- pair = malloc(sizeof (struct pair_node));
- if (!pair) {
- fprintf(stderr, "Couldn't allocate memory for a color pair\n");
- exit(1);
- }
- pair->foreground = cpstr(yyvsp[0].sval);
- }
-break;
-case 10:
-#line 196 "parser.y"
-{
- pair->background = cpstr(yyvsp[0].sval);
- if (!cur_pair) {
- pair_list = pair;
- cur_pair = pair;
- } else {
- cur_pair->next = pair;
- cur_pair = pair;
- }
- }
-break;
-case 11:
-#line 209 "parser.y"
-{ yyval.sval = "COLOR_BLACK"; }
-break;
-case 12:
-#line 211 "parser.y"
-{ yyval.sval = "COLOR_RED"; }
-break;
-case 13:
-#line 213 "parser.y"
-{ yyval.sval = "COLOR_GREEN"; }
-break;
-case 14:
-#line 215 "parser.y"
-{ yyval.sval = "COLOR_YELLOW"; }
-break;
-case 15:
-#line 217 "parser.y"
-{ yyval.sval = "COLOR_BLUE"; }
-break;
-case 16:
-#line 219 "parser.y"
-{ yyval.sval = "COLOR_MAGENTA"; }
-break;
-case 17:
-#line 221 "parser.y"
-{ yyval.sval = "COLOR_CYAN"; }
-break;
-case 18:
-#line 223 "parser.y"
-{ yyval.sval = "COLOR_WHITE"; }
-break;
-case 19:
-#line 227 "parser.y"
-{ formname = cpstr(yyvsp[0].sval); }
-break;
-case 20:
-#line 229 "parser.y"
-{
- form = malloc(sizeof (struct Form));
- if (!form) {
- fprintf(stderr,"Failed to allocate memory for form\n");
- exit(1);
- }
- form->y = y;
- form->x = x;
- }
-break;
-case 21:
-#line 239 "parser.y"
-{
- form->startfield = startname;
- form->colortable = colortable;
- form->height = height;
- form->width = width;
- form->attr = formattr;
- form->fieldlist = field_inst_list;
- field_inst_list = 0;
- form_bind_tuple(formname, FT_FORM, form);
- }
-break;
-case 23:
-#line 255 "parser.y"
-{ startname = 0;
- printf("Warning: No start field specified for form %s\n", formname);
- }
-break;
-case 24:
-#line 259 "parser.y"
-{ startname = cpstr(yyvsp[0].sval); }
-break;
-case 25:
-#line 263 "parser.y"
-{ colortable = 0; }
-break;
-case 26:
-#line 265 "parser.y"
-{ colortable = cpstr(yyvsp[0].sval); }
-break;
-case 27:
-#line 269 "parser.y"
-{ formattr = 0; }
-break;
-case 28:
-#line 271 "parser.y"
-{ formattr = yyvsp[0].ival; }
-break;
-case 31:
-#line 279 "parser.y"
-{ fieldname = cpstr(yyvsp[0].sval); }
-break;
-case 32:
-#line 281 "parser.y"
-{
- field = malloc(sizeof (struct Field));
- if (!field) {
- fprintf(stderr,"Failed to allocate memory for form field\n");
- exit(1);
- }
- if (!defname)
- field->defname = fieldname;
- else
- field->defname = defname;
- field->y = y;
- field->x = x;
- }
-break;
-case 33:
-#line 295 "parser.y"
-{
- field->fup = up;
- field->fdown = down;
- field->fleft = left;
- field->fright = right;
- field->fnext = next;
- if (!field_inst_list)
- field_inst_list = field;
- up = 0;
- down = 0;
- left = 0;
- right = 0;
- next = 0;
- if (!cur_field)
- cur_field = field;
- else {
- cur_field->next = field;
- cur_field = field;
- }
- form_bind_tuple(fieldname, FT_FIELD_INST, field);
- }
-break;
-case 34:
-#line 319 "parser.y"
-{ defname = cpstr(yyvsp[0].sval); }
-break;
-case 35:
-#line 321 "parser.y"
-{ define_field(defname); }
-break;
-case 36:
-#line 325 "parser.y"
-{ defname = 0; }
-break;
-case 37:
-#line 327 "parser.y"
-{ defname = cpstr(yyvsp[0].sval); }
-break;
-case 39:
-#line 330 "parser.y"
-{ defname = fieldname; define_field(defname); }
-break;
-case 43:
-#line 341 "parser.y"
-{ up = cpstr(yyvsp[0].sval); }
-break;
-case 44:
-#line 343 "parser.y"
-{ down = cpstr(yyvsp[0].sval); }
-break;
-case 45:
-#line 345 "parser.y"
-{ left = cpstr(yyvsp[0].sval); }
-break;
-case 46:
-#line 347 "parser.y"
-{ right = cpstr(yyvsp[0].sval); }
-break;
-case 47:
-#line 349 "parser.y"
-{ next = cpstr(yyvsp[0].sval); }
-break;
-case 52:
-#line 359 "parser.y"
-{ type = FF_TEXT; text = cpstr(yyvsp[0].sval); }
-break;
-case 53:
-#line 363 "parser.y"
-{ type = FF_INPUT; }
-break;
-case 54:
-#line 367 "parser.y"
-{ lbl_flag = 1; label = cpstr(yyvsp[-1].sval); }
-break;
-case 55:
-#line 369 "parser.y"
-{ lbl_flag = 0; label = cpstr(yyvsp[-1].sval); }
-break;
-case 57:
-#line 374 "parser.y"
-{ limit = yyvsp[0].ival; }
-break;
-case 58:
-#line 377 "parser.y"
-{ type = FF_MENU; selected = yyvsp[-3].ival; }
-break;
-case 61:
-#line 385 "parser.y"
-{
- menu = malloc(sizeof(struct MenuList));
- if (!menu) {
- err(1, "Couldn't allocate memory for menu option\n");
- }
- menu->option = cpstr(yyvsp[0].sval);
- if (!cur_menu) {
- menu_list = menu;
- cur_menu = menu;
- } else {
- cur_menu->next = menu;
- cur_menu = menu;
- }
- }
-break;
-case 62:
-#line 402 "parser.y"
-{ type = FF_ACTION; text = cpstr(yyvsp[-3].sval); function = cpstr(yyvsp[0].sval); }
-break;
-case 63:
-#line 406 "parser.y"
-{ height = 0; }
-break;
-case 64:
-#line 408 "parser.y"
-{ height = yyvsp[0].ival; }
-break;
-case 65:
-#line 412 "parser.y"
-{ width = 0; }
-break;
-case 66:
-#line 414 "parser.y"
-{ width = yyvsp[0].ival; }
-break;
-case 67:
-#line 418 "parser.y"
-{ attr = 0; }
-break;
-case 68:
-#line 420 "parser.y"
-{ attr = yyvsp[0].ival; }
-break;
-case 69:
-#line 424 "parser.y"
-{ selattr = 0; }
-break;
-case 70:
-#line 426 "parser.y"
-{ selattr = yyvsp[0].ival; }
-break;
-case 71:
-#line 430 "parser.y"
-{ y = yyvsp[-2].ival; x = yyvsp[0].ival; }
-break;
-#line 967 "y.tab.c"
- }
- yyssp -= yym;
- yystate = *yyssp;
- yyvsp -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yyssp = YYFINAL;
- *++yyvsp = yyval;
- if (yychar < 0)
- {
- if ((yychar = yylex()) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yyssp, yystate);
-#endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate;
- *++yyvsp = yyval;
- goto yyloop;
-yyoverflow:
- yyerror("yacc stack overflow");
-yyabort:
- return (1);
-yyaccept:
- return (0);
-}
diff --git a/lib/libforms/y.tab.h b/lib/libforms/y.tab.h
deleted file mode 100644
index f3d9afa..0000000
--- a/lib/libforms/y.tab.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#define FORM 257
-#define COLORTABLE 258
-#define COLOR 259
-#define BLACK 260
-#define RED 261
-#define GREEN 262
-#define YELLOW 263
-#define BLUE 264
-#define MAGENTA 265
-#define CYAN 266
-#define WHITE 267
-#define PAIR 268
-#define NAME 269
-#define STRING 270
-#define AT 271
-#define AS 272
-#define HEIGHT 273
-#define EQUALS 274
-#define NUMBER 275
-#define WIDTH 276
-#define STARTFIELD 277
-#define COMMA 278
-#define LBRACE 279
-#define RBRACE 280
-#define TEXT 281
-#define ATTR 282
-#define SELATTR 283
-#define DEFAULT 284
-#define LABEL 285
-#define LIMIT 286
-#define SELECTED 287
-#define OPTIONS 288
-#define ACTION 289
-#define FUNC 290
-#define LINK 291
-#define UP 292
-#define DOWN 293
-#define LEFT 294
-#define RIGHT 295
-#define NEXT 296
-#define DEF 297
-typedef union {
- int ival;
- char *sval;
-} YYSTYPE;
-extern YYSTYPE yylval;
diff --git a/lib/libforms/yacc.y b/lib/libforms/yacc.y
deleted file mode 100644
index 2bc953e..0000000
--- a/lib/libforms/yacc.y
+++ /dev/null
@@ -1,149 +0,0 @@
-%{
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ncurses.h>
-#include <forms.h>
-
-extern struct form *form;
-
-struct field *cur_field;
-int id,next, up, down, left, right;
-%}
-
-%start file
-
-%union {
- int ival;
- char *sval;
-}
-
-%token <sval> STRING
-%token <ival> NUMBER
-%token <ival> INPUT
-%token <ival> TEXT
-%token <ival> FORM
-
-%type <sval> String
-
-%%
-
-file : /* Empty */
- | file form
- | file fields
- | error
- ;
-
-form : FORM NUMBER NUMBER NUMBER NUMBER
- {
- form = (struct form *) malloc(sizeof(struct form));
- if (!form)
- return(-1);
- form->x = $2;
- form->y = $3;
- form->height = $4;
- form->width = $5;
- form->fields = 0;
- }
- ;
-
-fields : input
- | text
- ;
-
-input : INPUT NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER String NUMBER NUMBER NUMBER NUMBER String
- {
- if (alloc_field() == -1)
- return(-1);
- cur_field->field_id = $2;
- /*
- * These will hold addresses but store
- * the field id's in them temporarily
- */
- cur_field->next = (struct field *) $3;
- cur_field->up = (struct field *) $4;
- cur_field->down = (struct field *) $5;
- cur_field->left = (struct field *) $6;
- cur_field->right = (struct field *) $7;
- cur_field->type = FORM_FTYPE_INPUT;
- cur_field->entry.input.y_prompt = $8;
- cur_field->entry.input.x_prompt = $9;
- cur_field->entry.input.prompt_width = $10;
- cur_field->entry.input.prompt_attr = FORM_DEFAULT_ATTR;
- cur_field->entry.input.prompt = (char *) malloc($10+1);
- if (!cur_field->entry.input.prompt)
- return(-1);
- strncpy(cur_field->entry.input.prompt, $11, $10);
- cur_field->entry.input.prompt[$10] = 0;
- cur_field->entry.input.y_field = $12;
- cur_field->entry.input.x_field = $13;
- cur_field->entry.input.field_width = $14;
- cur_field->entry.input.max_field_width = $15;
- cur_field->entry.input.field = (char *) malloc(strlen($16));
- cur_field->entry.input.field_attr = FORM_DEFAULT_ATTR;
- if (!cur_field->entry.input.field)
- return(-1);
- strcpy(cur_field->entry.input.field, $16);
- }
- ;
-
-text : TEXT NUMBER NUMBER String
- {
- if (alloc_field() == -1)
- return(-1);
- cur_field->field_id = 0;
- cur_field->type = FORM_FTYPE_TEXT;
- cur_field->entry.text.y = $2;
- cur_field->entry.text.x = $3;
- cur_field->entry.text.attr = FORM_DEFAULT_ATTR;
- cur_field->entry.text.text = (char *) malloc(strlen($4));
- if (!cur_field->entry.text.text)
- return (-1);
- strcpy(cur_field->entry.text.text, $4);
- }
- ;
-
-String : STRING
- {
- char *t, *old, *new;
-
- t = strdup($1);
- free($1);
- /*
- * Deal with any escaped characters,
- * only works for " and \ really.
- */
- for (old=t, new=t; *old; old++, new++) {
- if (*old == '\\')
- old++;
- *new = *old;
- }
- *new = '\0';
- $$ = t;
- }
-
-%%
-void
-yyerror(char *s)
-{
- printf("%s\n", s);
- exit(1);
-}
-
-int
-alloc_field()
-{
- if (!form->fields) {
- form->fields = (struct field *) malloc(sizeof(struct field));
- if (!form->fields)
- return(-1);
- cur_field = form->fields;
- } else {
- cur_field->link = (struct field *) malloc(sizeof(struct field));
- if (!cur_field->link)
- return(-1);
- cur_field = cur_field->link;
- }
-
- return(0);
-}
diff --git a/lib/libftp/FtpAbort.c b/lib/libftp/FtpAbort.c
deleted file mode 100644
index 80943e5..0000000
--- a/lib/libftp/FtpAbort.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-#include <unistd.h>
-
-int
-FtpAbort(FTP *ftp)
-{
- fd_set fds;
- char msgc=IAC;
- String msg;
-
- FD_ZERO(&fds);
- FD_SET(fileno(FTPCMD(ftp)),&fds);
-
- FtpPutc(ftp, FTPCMD(ftp), IAC);
- FtpPutc(ftp, FTPCMD(ftp), IP);
-
- if ( send ( fileno(FTPCMD(ftp)), &msgc , 1 ,MSG_OOB) != 1 )
- return EXIT(ftp,QUIT);
-
- FtpPutc(ftp, FTPCMD(ftp), DM);
-
- FtpSendMessage(ftp,"ABOR");
-
- while (select ( getdtablesize(), &fds, 0,0, &(ftp->timeout) )>0)
- {
- FtpGetMessage(ftp,msg);
- if (FtpGood(FtpNumber(msg),225,226,EOF)) break;
- }
- return 0;
-}
-
-
-
diff --git a/lib/libftp/FtpArchie.c b/lib/libftp/FtpArchie.c
deleted file mode 100644
index 22a05e1..0000000
--- a/lib/libftp/FtpArchie.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-
-#define C2I(n) ((int)((n)-'0'))
-
-int FtpArchie ( char *what, ARCHIE *result, int len)
-{
- FILE *archie;
- String cmd,tmp;
- int i;
-
- bzero(result,sizeof(result[0])*len);
-
- sprintf(cmd,"archie -l -m %d %s",len,what);
-
- if ((archie = popen(cmd,"r"))==NULL)
- return 0;
-
- for(i=0;i<len;i++)
- {
- char *p, *pp;
-
- if (fgets(tmp,sizeof (tmp), archie)==NULL)
- break;
-
-
- result[i].createtime.tm_year = C2I (tmp[2 ])*10 - 70 + C2I(tmp[3]);
- result[i].createtime.tm_mday = C2I (tmp[4 ])*10 + C2I(tmp[5]);
- result[i].createtime.tm_hour = C2I (tmp[6 ])*10 + C2I(tmp[7]);
- result[i].createtime.tm_min = C2I (tmp[8 ])*10 + C2I(tmp[9]);
- result[i].createtime.tm_sec = C2I (tmp[10])*10 + C2I(tmp[11]);
-
- for(p=tmp; *p!=' '; p++);
- for(; *p==' '; p++);
-
- result[i].size = atoi(p);
-
- for(; *p!=' '; p++);
- for(; *p==' '; p++);
-
- for (pp=result[i].host;*p!=' ';p++,pp++) *pp=*p;
- *pp=0;
- for(; *p==' '; p++);
- for (pp=result[i].file;*p!='\n';p++,pp++) *pp=*p;
- *pp=0;
-
- }
-
- return i;
-}
diff --git a/lib/libftp/FtpBye.c b/lib/libftp/FtpBye.c
deleted file mode 100644
index 7094843..0000000
--- a/lib/libftp/FtpBye.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-#include <signal.h>
-
-STATUS FtpBye(FTP *ftp)
-{
- FtpAssert(ftp,FtpCommand(ftp,"QUIT",221,EOF));
-
- fclose(FTPCMD(ftp));
- free(ftp);
- return 0;
-}
-
-STATUS FtpQuickBye(FTP *ftp)
-{
- if (ftp == NULL) return 0;
-
- if (FTPDATA(ftp)!=NULL)
- {
- shutdown(fileno(FTPDATA(ftp)),2);
- fclose(FTPDATA(ftp));
- }
-
- if (FTPCMD(ftp)!=NULL)
- {
- shutdown(fileno(FTPCMD(ftp)),2);
- fclose(FTPCMD(ftp));
- }
- free(ftp);
- return 0;
-}
-
diff --git a/lib/libftp/FtpClose.c b/lib/libftp/FtpClose.c
deleted file mode 100644
index a14658e..0000000
--- a/lib/libftp/FtpClose.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-*/
-
-#include "FtpLibrary.h"
-
-STATUS FtpClose(FTP *ftp)
-{
- int i;
- String S1;
-
- fflush(FTPDATA(ftp));
- shutdown(fileno(FTPDATA(ftp)),2);
- fclose(FTPDATA(ftp));
-
- FtpAssert(ftp,i=FtpGetMessage(ftp,S1));
- if ( i != 226 )
- return EXIT(ftp,-i);
- return EXIT(ftp,i);
-}
diff --git a/lib/libftp/FtpCommand.c b/lib/libftp/FtpCommand.c
deleted file mode 100644
index 25fd460..0000000
--- a/lib/libftp/FtpCommand.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-#include <varargs.h>
-
-STATUS FtpCommand(va_alist)
- va_dcl
-{
- FTP *con;
- char *command, *param;
- int Answer[MAX_ANSWERS];
- va_list args;
- String S1;
- int i,counter=0;
-
- va_start(args);
-
- con = va_arg(args,FTP *);
- command = va_arg(args,char *);
- param = va_arg(args, char *);
-
- while ( 1 )
- {
- if (counter == MAX_ANSWERS)
- return EXIT(con,QUIT);
- Answer[counter] = va_arg(args,int);
- if (Answer[counter] == EOF ) break;
- counter++;
- }
-
- va_end(args);
-
-
- sprintf(S1,command,param);
-
- if ( FtpSendMessage(con,S1) == QUIT )
- return EXIT(con,QUIT);
-
- if ( (i=FtpGetMessage(con,S1)) == QUIT )
- return EXIT(con,QUIT);
-
- if ( ! FtpGood1 ( i , Answer ))
- return EXIT(con,-i);
-
- return EXIT(con,i);
-}
-
-
-
diff --git a/lib/libftp/FtpConnect.c b/lib/libftp/FtpConnect.c
deleted file mode 100644
index 4de95ab..0000000
--- a/lib/libftp/FtpConnect.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-#include <unistd.h>
-
-STATUS FtpConnect(FTP **con,char * hostname)
-{
- struct sockaddr_in unit;
- register struct hostent *host;
- register int new_socket;
- String S1;
- STATUS x;
-
- *con = FtpCreateObject();
-
- if ((host=FtpGetHost(hostname))==NULL)
- return EXIT((*con),QUIT);
-
- strcpy((*con) -> title,host -> h_name); /* Default title for FtpLog */
-
- unit.sin_family = host -> h_addrtype; /* AF_INET */
-
- bcopy(host-> h_addr_list[0],(char *)&unit.sin_addr,host->h_length);
- if ( ( new_socket = socket ( unit.sin_family , SOCK_STREAM , 0)) < 0)
- return EXIT((*con),QUIT);
-
- unit.sin_port = htons((*con)->port);
-
- while ( connect ( new_socket , (struct sockaddr *)&unit , sizeof unit ) < 0 )
- {
- host -> h_addr_list ++;
- if (host -> h_addr_list[0]==NULL) {
- close(new_socket);
- return EXIT((*con),QUIT);
- }
- bcopy(host -> h_addr_list[0],(char *)&unit,host->h_length);
- close(new_socket);
- if ( ( new_socket = socket ( unit.sin_family , SOCK_STREAM , 0)) < 0)
- {
- close(new_socket);
- return EXIT((*con),QUIT);
- }
- }
-
- FTPCMD(*con) = fdopen(new_socket,"r+");
-
- if ( (x=FtpGetMessage(*con,S1)) == QUIT )
- return EXIT((*con),QUIT);
- if ( ! FtpGood(x,120,220,EOF))
- {
- close(new_socket);
- return EXIT((*con),-x);
- }
- if ( (*con)->mode != 'A' ) FtpType(*con,(*con)->mode);
-
- return EXIT((*con),x);
-}
-
-
-
diff --git a/lib/libftp/FtpCopy.c b/lib/libftp/FtpCopy.c
deleted file mode 100644
index db582d2..0000000
--- a/lib/libftp/FtpCopy.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-
-STATUS FtpCopy (FTP * ftp1 , FTP * ftp2 ,char *in , char * out)
-{
- int size;
- char buffer[FTPBUFSIZ];
-
- if (!*out) out=in;
-
- if ( FtpTestFlag(ftp1,FTP_REST) && FtpTestFlag(ftp2,FTP_REST)
- && (size=FtpSize(ftp1,in))>0
- && FtpCommand(ftp1,"REST 0",0,0,EOF)==350 && FtpCommand(ftp2,"REST 0",0,0,EOF)==350 )
- ftp1->seek=ftp2->seek=size;
- else
- ftp1->seek=ftp2->seek=0;
-
- FtpAssert(ftp1,FtpData(ftp1,"RETR %s",in,"r"));
- FtpAssert(ftp2,FtpData(ftp2,"STOR %s",out,"w"));
-
- while ((size=FtpReadBlock(ftp1,buffer,FTPBUFSIZ))>0)
- {
- if (FtpWriteBlock(ftp2,buffer,size)!=size)
- return EXIT(ftp2,QUIT);
- }
-
- FtpAssert(ftp1,FtpClose(ftp1));
- FtpAssert(ftp2,FtpClose(ftp2));
- return 0;
-}
-
-
-
-
-
-
-
diff --git a/lib/libftp/FtpData.c b/lib/libftp/FtpData.c
deleted file mode 100644
index 066671f..0000000
--- a/lib/libftp/FtpData.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-#include <unistd.h>
-
-STATUS FtpData(FTP * con,char * command , char * file ,char * mode)
-{
- struct sockaddr_in data,from;
- register struct hostent *host;
- String hostname;
- int NewSocket,Accepted_Socket,len=sizeof(data),one=1,fromlen=sizeof(from),
- i = 0;
- char *a,*b;
-
- FREE(data);
- FREE(from);
-
- if ( gethostname( hostname , sizeof hostname ) == -1 )
- return EXIT(con,QUIT);
-
- if ((host=(struct hostent *)gethostbyname(hostname))==0)
- return EXIT(con,QUIT);
-
- data.sin_family = host -> h_addrtype;
-
- bcopy(host-> h_addr_list[0],(char *)&data.sin_addr,host->h_length);
-
- if ((NewSocket = socket ( AF_INET , SOCK_STREAM , 0 ))<0)
- return EXIT(con,QUIT);
-
- if ( setsockopt ( NewSocket , SOL_SOCKET , SO_REUSEADDR ,
- (char *)&one , sizeof(one) ) < 0 )
- {
- close(NewSocket);
- return EXIT ( con,QUIT );
- }
-
- data.sin_port = 0 ;
-
- if ( bind ( NewSocket , (struct sockaddr *)&data , sizeof data ) < 0 )
- return EXIT(con,QUIT);
-
- if ( getsockname ( NewSocket , (struct sockaddr *)&data , &len ) < 0 )
- return EXIT(con,QUIT);
-
- if ( listen ( NewSocket , 1 ) < 0 )
- return EXIT(con,QUIT);
-
- a = ( char * ) & data.sin_addr;
- b = ( char * ) & data.sin_port;
-
- FtpAssert(con,FtpPort(con,CUT(a[0]),CUT(a[1]),CUT(a[2]),
- CUT(a[3]),CUT(b[0]),CUT(b[1])));
-
- if ( con -> seek != 0)
- {
- if ((i = FtpCommand ( con, "REST %d" , con -> seek , 0, EOF)) != 350 )
- return -i;
- }
-
- FtpAssert(con, FtpCommand ( con , command , file ,
- 200, 120 , 150 , 125 , 250 , EOF ));
-
- if (( Accepted_Socket = accept (NewSocket , (struct sockaddr *)&from , &fromlen )) < 0)
- {
- close(NewSocket);
- return EXIT(con,QUIT);
- }
-
- close(NewSocket);
-
- FTPDATA(con) = fdopen(Accepted_Socket, "r+");
-
- return i;
-}
-
-
-
-
-
diff --git a/lib/libftp/FtpDebug.c b/lib/libftp/FtpDebug.c
deleted file mode 100644
index d2b5af9..0000000
--- a/lib/libftp/FtpDebug.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-
-void FtpDebug(FTP *ftp)
-{
- STATUS FtpDebugDebug(),
- FtpDebugError(),
- FtpDebugIO();
-
- FtpSetDebugHandler(ftp,FtpDebugDebug);
- FtpSetErrorHandler(ftp,FtpDebugError);
- FtpSetIOHandler(ftp,FtpDebugIO);
-}
-
-STATUS FtpDebugDebug(FTP *ftp,int n, char * Message)
-{
- String tmp;
-
-
- strcpy(tmp,Message);
-
- if (strncmp(tmp,"PASS ",5)==0)
- {
- char *p=tmp+5;
- while ( *p != '\0') *p++='*';
- };
-
- FtpLog(ftp->title,tmp);
- return 1;
-}
-
-STATUS FtpDebugError(FTP *ftp,int n, char * Message)
-{
-
- FtpLog("FtpDebugError","");
- FtpLog(ftp->title,Message);
- if ( ! FtpTestFlag(ftp,FTP_NOEXIT))
- exit(1);
- return 0;
-}
-
-STATUS FtpDebugIO(FTP *ftp,int n, char * Message)
-{
- FtpLog("FtpDebugIO","");
- FtpLog(ftp->title,Message);
- if ( ! FtpTestFlag(ftp,FTP_NOEXIT))
- exit(1);
- return 0;
-}
-
-STATUS FtpLog(char *name,char *str)
-{
- time_t t=time((time_t *)0);
- struct tm *lt=localtime(&t);
- fprintf(stderr,"%02d:%02d:%02d %s %s\n",lt->tm_hour,
- lt->tm_min,lt->tm_sec,name,str);
- fflush(stderr);
- return 0;
-}
-
-int
-FtpHash(FTP *ftp, unsigned long chars)
-{
-
- if (chars==0) return ftp->counter=0;
- ftp->counter+=chars;
- fprintf(stdout,"%10u bytes transfered\r",(unsigned int)ftp->counter);
- fflush(stdout);
- return ftp->counter;
-}
-
-
-STATUS FtpBadReply550(char *s)
-{
- if(
- (strstr(s,"unreachable")!=NULL) ||
- (strstr(s,"Broken pipe")!=NULL)
- )
- return 0;
- return 1;
-}
diff --git a/lib/libftp/FtpFilenameChecker.c b/lib/libftp/FtpFilenameChecker.c
deleted file mode 100644
index 99946eb..0000000
--- a/lib/libftp/FtpFilenameChecker.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-*/
-
-#include "FtpLibrary.h"
-
-static char * simplename(char *s)
-{
- char *p;
-
- if ( (p=(char *)strrchr(s,'/')) == NULL )
- return s;
- return p+1;
-}
-
-
-
-
-STATUS FtpFilenameChecker(char ** in, char ** out)
-{
- struct stat st;
-
- if ( (stat(*out,&st) == 0) && S_ISDIR(st.st_mode))
- {
- char * sfn = simplename(*in);
- char * new = (char *) malloc ( strlen(*out)+ strlen(sfn) + 2 );
-
- strcpy(new,*out);
- strcat(new,"/");
- strcat(new,sfn);
- *out=new;
- return 0;
- };
- return 0;
-}
-
-
diff --git a/lib/libftp/FtpFull.c b/lib/libftp/FtpFull.c
deleted file mode 100644
index 51c87dc..0000000
--- a/lib/libftp/FtpFull.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-#include <unistd.h>
-#include <pwd.h>
-
-static FTP *ftp_table[256];
-
-FILE * FtpFullOpen(char * file , char * mode )
-{
- FTP *ftp;
- FILE *tmp;
- String Host,User,Passwd,RemoteFile;
- STATUS i;
-
- if ( ! FtpFullSyntax (file,Host,User,Passwd,RemoteFile))
- {
- tmp=fopen(file,mode);
- if (tmp==NULL) return tmp;
- ftp_table[(int)fileno(tmp)] = NULL;
- return tmp;
- }
- if ( FtpError(i=FtpLogin(&ftp,Host,User,Passwd,NULL)))
- return NULL;
-
- if (mode[1]=='b') FtpBinary(ftp);
-
- switch(mode[0])
- {
- case 'r':
- if (FtpError(FtpOpenRead(ftp,RemoteFile)))
- return NULL;
- ftp_table[fileno(FTPDATA(ftp))] = ftp;
- return FTPDATA(ftp);
- case 'w':
- if (FtpError(FtpOpenWrite(ftp,RemoteFile)))
- return NULL;
- ftp_table[fileno(FTPDATA(ftp))] = ftp;
- return FTPDATA(ftp);
- case 'a':
- if (FtpError(FtpOpenAppend(ftp,RemoteFile)))
- return NULL;
- ftp_table[fileno(FTPDATA(ftp))] = ftp;
- return FTPDATA(ftp);
- }
- /* Error Mode */
- return NULL;
-}
-
-STATUS FtpFullClose(FILE *f)
-{
- FTP *ftp=ftp_table[(int)fileno(f)];
- if (ftp == NULL)
- return fclose(f);
- FtpClose(ftp);
- return FtpQuickBye(ftp);
-}
-
-
-/* Format of ftp's file [user[/passord]@]hostname:filename_with_path */
-
-STATUS FtpFullSyntax ( String source ,
- String host ,
- String user ,
- String passwd ,
- String file)
-
-{
- char *in,*out;
- String tmp;
-
- host[0] = user[0] = passwd[0] = file[0] = '\0';
-
- for ( in=source, out = user;
- *in !='\0' && *in != '/' && *in!='@' && *in!=':' ;
- *out++ = *in++);
- *out = '\0';
-
- if ( *in == '\0' ) return 0;
-
- if ( *in == ':' )
- {
- strcpy(host,user);
- strcpy(user,"anonymous");
- gethostname(tmp, sizeof tmp);
- sprintf(passwd,"%s@%s",
- getpwuid(getuid())->pw_name,gethostbyname(tmp)->h_name);
- goto file;
- }
-
- if ( *in == '/' )
- {
- for ( in++, out = passwd;
- *in !='\0' && *in!='@' ;
- *out++ = *in++);
- *out = '\0';
- if ( *in == '\0' ) return 0;
- }
- else
- {
- gethostname(tmp, sizeof tmp);
- sprintf(passwd,"%s@%s",
- getpwuid(getuid())->pw_name,gethostbyname(tmp)->h_name);
- }
-
-
- for ( in++, out = host;
- *in !='\0' && *in!=':' ;
- *out++ = *in++);
- *out = '\0';
-
- if ( *in == '\0' ) return 0;
-
-file:
-
- for ( in++, out = file;
- *in !='\0';
- *out++ = *in++);
- *out = '\0';
-
- return 1;
-}
-
-
-
-
-
-
-
-
diff --git a/lib/libftp/FtpGetHost.c b/lib/libftp/FtpGetHost.c
deleted file mode 100644
index 7171ba3..0000000
--- a/lib/libftp/FtpGetHost.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-#include <arpa/inet.h>
-
-
-struct hostent *FtpGetHost(char *host)
-{
-
- static struct in_addr addr;
- static struct hostent _host;
- static char *point[2];
- static char *alias[1];
-
- bzero(&_host,sizeof _host);
- if ( (addr.s_addr=inet_addr(host)) != -1 )
- {
- _host.h_addr_list = point;
- _host.h_addr_list[0] = (char *) &addr;
- _host.h_addr_list[1] = (char *) 0;
- alias[0]=NULL;
- _host.h_aliases=alias;
- _host.h_name=host;
- _host.h_length=sizeof(unsigned long);
- _host.h_addrtype=AF_INET;
- return &_host;
- }
-
- return gethostbyname(host);
-}
-
-
diff --git a/lib/libftp/FtpGood.c b/lib/libftp/FtpGood.c
deleted file mode 100644
index 20af4e0..0000000
--- a/lib/libftp/FtpGood.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-#include <varargs.h>
-
-STATUS FtpGood(va_alist)
- va_dcl
-{
- va_list args;
- int Number;
- int Answer[MAX_ANSWERS];
- int counter=0;
-
- va_start(args);
-
- Number = va_arg(args,int);
-
- while ( 1 )
- {
- if (counter == MAX_ANSWERS)
- return 0;
- Answer[counter] = va_arg(args,int);
- if (Answer[counter] == EOF ) break;
- counter++;
- }
-
- va_end(args);
-
- return FtpGood1(Number,Answer);
-}
-
-
-STATUS FtpGood1(int Number , int *Answer)
-{
- while (1)
- {
- if ( *Answer == Number) return 1;
- if ( *Answer == 0) return 1;
- if ( *Answer == EOF ) return 0;
- Answer++;
- }
-}
-
diff --git a/lib/libftp/FtpIO.c b/lib/libftp/FtpIO.c
deleted file mode 100644
index b7f6af5..0000000
--- a/lib/libftp/FtpIO.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/* Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the exist
-ing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-#include <unistd.h>
-
-int FtpRead(FTP *con)
-{
- int c;
-
- if ( con -> mode == 'I' )
- return FtpGetc(con,FTPDATA(con));
-
- if ( con->ch != EOF )
- {
- c=con->ch;
- con->ch=EOF;
- return c;
- }
-
- c=FtpGetc(con,FTPDATA(con));
-
- if ( c == Ctrl('M') )
- {
- c = FtpGetc(con,FTPDATA(con));
-
- if ( c == Ctrl('J') )
- return '\n';
- con->ch = c;
- return Ctrl('M');
- }
- return c;
-}
-
-int FtpWrite(FTP *ftp,char c)
-{
-
- if ( ftp -> mode == 'I' || c != '\n' )
- return FtpPutc(ftp,FTPDATA(ftp),c);
-
- FtpPutc(ftp,FTPDATA(ftp),Ctrl('M'));
- return FtpPutc(ftp,FTPDATA(ftp),Ctrl('J'));
-}
-
-
-int FtpGetc(FTP *ftp,FILE *fp)
-{
- fd_set fds;
- char c;
-
- FD_ZERO(&fds);
- FD_SET(fileno(fp),&fds);
-
- if (select(getdtablesize(), &fds, 0, 0, &(ftp->timeout))<1)
- return EXIT(ftp,QUIT);
-
- if (read(fileno(fp),&c,1)<1)
- return EOF;
-
- if (ftp->hash!=NULL) (*ftp->hash)(ftp,1);
-
- return (int)c;
-}
-
-
-STATUS FtpPutc(FTP *ftp,FILE *fp,char c)
-{
- fd_set fds;
-
- FD_ZERO(&fds);
- FD_SET(fileno(fp),&fds);
-
- if (select(getdtablesize(), 0, &fds, 0, &(ftp->timeout))<1)
- return EXIT(ftp,QUIT);
-
- if (write(fileno(fp),&c,1)!=1)
- return EXIT(ftp,QUIT);
-
- if (ftp->hash!=NULL) (*ftp->hash)(ftp,1);
- return 0;
-}
-
-
-STATUS FtpReadBlock(FTP *ftp, char *buffer, int size)
-{
- fd_set fds;
- register int rsize;
-
- FD_ZERO(&fds);
- FD_SET(fileno(FTPDATA(ftp)),&fds);
-
- if (select(getdtablesize(), &fds,0, 0, &(ftp->timeout))<1)
- return EXIT(ftp,QUIT);
-
-
- if ((rsize=read(fileno(FTPDATA(ftp)),buffer,size))<0)
- return EXIT(ftp,QUIT);
-
- if (ftp->hash!=NULL && rsize!=0) (*ftp->hash)(ftp,rsize);
-
- if (ftp->mode == 'A')
- {
- char buffer2[size];
- register int i,ii;
-
- for (i=0,ii=0;i<rsize;i++,ii++)
- if (buffer[i]==Ctrl('M')&&buffer[i+1]==Ctrl('J'))
- buffer2[ii]='\n',i++;
- else
- buffer2[ii]=buffer[i];
-
- rsize=ii;
- bcopy(buffer2,buffer,rsize);
- }
- return rsize;
-}
-
-
-STATUS FtpWriteBlock(FTP *ftp, char *buffer, int size)
-{
- fd_set fds;
- register int wsize;
- char buffer2[size*2];
-
- FD_ZERO(&fds);
- FD_SET(fileno(FTPDATA(ftp)),&fds);
-
- if (select(getdtablesize(), 0, &fds, 0, &(ftp->timeout))<1)
- return EXIT(ftp,QUIT);
-
-
- if (ftp->mode=='A')
- {
- register int i,ii;
-
- for(i=0,ii=0;i<size;i++,ii++)
- if (buffer[i]=='\n')
- buffer2[ii++]=Ctrl('M'),buffer2[ii]=Ctrl('J');
- else
- buffer2[ii]=buffer[i];
- buffer=buffer2;
- size=ii;
- }
-
- if ((wsize=write(fileno(FTPDATA(ftp)),buffer,size))!=size)
- return EXIT(ftp,QUIT);
-
- if ( ftp->hash!=NULL && wsize!=0 ) (*ftp->hash)(ftp,wsize);
-
- return wsize;
-}
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lib/libftp/FtpInit.c b/lib/libftp/FtpInit.c
deleted file mode 100644
index 4e43c8c..0000000
--- a/lib/libftp/FtpInit.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-
-FTP FtpInit = {
- NULL, /*sock*/
- NULL, /*data*/
- 'A', /*mode*/
- 0, /*errno*/
- 0, /*ch*/
- NULL,NULL,NULL, NULL, /*funcs*/
- 0, /*seek*/
- 0, /*flags*/
- {120,0}, /*timeout 2 min*/
- 21, /*Port*/
- "johndoe", /* Title */
- 0, /*Counter*/
-};
-
-FTP *FtpCreateObject()
-{
- FTP *new = (FTP *) malloc (sizeof(FTP));
-
- bcopy(&FtpInit,new,sizeof(FTP));
-
- return new;
-}
-
-
diff --git a/lib/libftp/FtpLibrary.h b/lib/libftp/FtpLibrary.h
deleted file mode 100644
index 754e5a1..0000000
--- a/lib/libftp/FtpLibrary.h
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-*/
-
-
-#ifndef __FTPLIBRARY_H
-#define __FTPLIBRARY_H
-
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/timeb.h>
-#include <sys/socket.h>
-#include <arpa/ftp.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <arpa/telnet.h>
-#include <sys/stat.h>
-
-
-#ifndef __FreeBSD__
-extern char *sys_errlist[];
-extern int errno;
-#else
-#include <errno.h>
-#endif
-
-
- /* Standard Macros & Definitions */
-
-
-
-#define EXIT(con,e) \
- ( con -> errno = e, \
- ((e==QUIT||e==LQUIT)&&(con->IO != NULL))?(*(con->IO))(con,e,sys_errlist[errno]):0,\
- ((con->error != NULL) && (e < 0) )?(*(con->error))(con,e,FtpMessage(e)):0,\
- e)
-
-
-#define MAX_ANSWERS 10 /* Number of known goodest answers for reqest */
-#define NFDS 64
-#define FTPBUFSIZ BUFSIZ
-#define LQUIT (-6)
-#define QUIT (-5) /* Few time ago QUIT character been
- equivalence to zero, changed for clear
- conflicts with reading functions */
-#define Ctrl(x) ((x) - '@')
-#define FREE(x) memset ( &(x) , '\0' , sizeof (x) )
-#define CUT(x) ((x)&0xff)
-#define FtpError(x) ((x)<0)
-#define FtpAssert(ftp,x) if (FtpError(x)) return EXIT((ftp),(ftp)->errno);
-
-typedef int STATUS;
-typedef char String[256];
-
-#ifdef __GNUC__
-#define INLINE inline
-#else
-#define INLINE
-#endif
-
-
-
- /* Common Information Structure */
-
-typedef struct/* All structure initialize from edited struct FtpInit */
-{
- FILE *sock; /* Command stream to server */
-
-#define FTPDATA(x) ((x)->data)
-#define FTPCMD(x) ((x)->sock)
-
-
- FILE *data; /* Data stream to server */
- char mode; /* Binary, Ascii, ......... */
- int errno; /* Last error code */
- int ch; /* Help character for ascii streams */
-
- STATUS (*error)();
- STATUS (*debug)();
- STATUS (*IO)();
- STATUS (*hash)(); /* Call with reading/writing next "int" characters
- from stream */
- int seek; /*
- Warning! If server not supported REST-command,
- then seek variable automaticaly turn to zero
- */
- int flags; /* FTP_REST,
- FTP_NOEXIT */
- struct timeval timeout;
- /* How long must be waiting next character
- from server */
- int port;
- String title; /* Using for FtpLog, FtpConnect lets hostname */
- unsigned long counter;
- /* Using by FtpHash */
-} FTP;
-
-typedef struct
-{
- struct tm createtime;
- unsigned long size;
- String host;
- String file;
-} ARCHIE;
-
-
-enum {FTP_REST=1,FTP_NOEXIT=2};
-enum {no,yes};
-enum {off,on};
-enum {false,true};
-
-extern FTP FtpInit;
-
-/* Options defines */
-
-#define FtpSetFlag(ftp,flag) ((ftp)->flags|=(flag))
-#define FtpClearFlag(ftp,flag) ((ftp)->flags &= (~(flag)) )
-#define FtpTestFlag(ftp,flag) ((ftp)->flags&(flag)==flag)
-#define FtpSetTimeout(ftp,tim) \
- ((ftp)->timeout.tv_sec=tim,(ftp)->timeout.tv_usec=0)
-#define FtpSetPort(ftp,prt) ((ftp)->port=(prt))
-
-/* Connect & disconnect */
-
-STATUS FtpConnect(FTP **con,char *hostname);
-#define FtpUser(ftp,user) FtpCommand(ftp,"USER %s",user,230,331,332,EOF)
-#define FtpPassword(ftp,pas) FtpCommand(ftp,"PASS %s",pas,230,332,EOF)
-#define FtpAccount(ftp,acc) FtpCommand(ftp,"ACCT %s",acc,230,EOF)
-STATUS FtpLogin(FTP **con,char *host ,char *user,char *pass,char *acct);
-STATUS FtpBye (FTP * con);
-STATUS FtpQuickBye (FTP * con);
-STATUS FtpAbort(FTP *ftp);
-
-/* Set type of transfer */
-
-STATUS FtpType(FTP *ftp,char type);
-#define FtpAscii(ftp) FtpType(ftp,'A')
-#define FtpBinary(ftp) FtpType(ftp,'I')
-
-
-/* Send/Receive and handling Procedure(s) */
-
-STATUS FtpCopy(FTP *ftp1, FTP *ftp2, char *in, char *out);
-STATUS FtpPassiveTransfer(FTP *ftp1, FTP *ftp2, char *in, char *out);
-
-STATUS FtpRetr(FTP *con, char *command,char *inp,char *out);
-#define FtpGet(ftp,in,out) FtpRetr(ftp,"RETR %s",in,out)
-#define FtpDirectory(ftp,pat,out) FtpRetr(ftp,"LIST %s",pat,out)
-#define FtpDir(ftp,out) FtpRetr(ftp,"LIST","",out)
-
-STATUS FtpStor(FTP *con ,char*command ,char *inp,char *out);
-#define FtpPut(ftp,in,out) FtpStor(ftp,"STOR %s",in,out)
-
-STATUS FtpData( FTP * con , char * command , char * param , char *mode);
-STATUS FtpPort ( FTP *con ,int ,int ,int ,int ,int ,int );
-#define FtpOpenRead(ftp,file) FtpData(ftp,"RETR %s",file,"r")
-#define FtpOpenWrite(ftp,file) FtpData(ftp,"STOR %s",file,"w")
-#define FtpOpenAppend(ftp,file) FtpData(ftp,"APPE %s",file,"r")
-STATUS FtpOpenDir( FTP * con , char * files );
-STATUS FtpClose ( FTP *);
-
-STATUS FtpReadBlock(FTP *ftp, char *buffer, int size);
-STATUS FtpWriteBlock(FTP *ftp, char *buffer, int size);
-
-/* Command for hand transfer */
-
-STATUS FtpRead ( FTP * con);
-STATUS FtpWrite ( FTP * con , char c);
-int FtpGetc ( FTP * ftp, FILE *fp );
-STATUS FtpPutc (FTP *ftp, FILE *fp, char c);
-
-/* Manipulation commands for remote server */
-
-STATUS FtpCommand ();
-#define FtpChdir(ftp,dir) FtpCommand(ftp,"CWD %s",dir,200,250,EOF)
-#define FtpMkdir(ftp,dir) FtpCommand(ftp,"MKD %s",dir,200,257,EOF)
-#define FtpRm(ftp,dir) FtpCommand(ftp,"DELE %s",dir,200,250,EOF)
-char *FtpPwd(FTP *con);
-int FtpSize(FTP *con,char *filename);
-STATUS FtpMove ( FTP *con,char * old,char *new);
-
-/* Procedures for dialog with remote server */
-
-STATUS FtpInitMessageList();
-STATUS FtpSendMessage( FTP * con , char * Message );
-int FtpGetMessage( FTP * con , char * Message);
-char *FtpMessage(int Number);
-int FtpNumber ( char * Message );
-
-
-/* Debug */
-
-#define FtpSetErrorHandler(con,f) (con)->error = f
-#define FtpSetDebugHandler(con,f) (con)->debug = f
-#define FtpSetIOHandler(con,f) (con)->IO =f
-#define FtpSetHashHandler(con,f) (con)->hash =f
-#define FtplibDebug(t) FtpDebug(&FtpInit)
-
-STATUS FtpDebugDebug ( FTP *con, int errno, char * Message);
-STATUS FtpDebugError ( FTP *con, int errno, char * Message);
-STATUS FtpDebugIO ( FTP *con, int errno, char * Message);
-STATUS FtpLog(char *progtitle, char *msg);
-STATUS FtpHash ( FTP *con, unsigned long number_of_bytes );
-void FtpDebug ( FTP * con );
-STATUS FtpBadReply550 (char *message);
-
-
-/* Other Procedures */
-
-FTP *FtpCreateObject();
-FILE *FtpFullOpen(char * file,char * mode );
-STATUS FtpFullSyntax(String,String,String,String,String);
-FILE *Ftpfopen(char *filename,char *mode);
-STATUS Ftpfclose(FILE *);
-STATUS FtpFullClose(FILE *);
-STATUS FtpGood ();
-STATUS FtpGood1 (int, int *);
-struct hostent *FtpGetHost(char *host);
-STATUS FtpFilenameChecher(char *input, char *output);
-STATUS FtpLink(FTP *,FTP *);
-int FtpArchie(char *what, ARCHIE *, int number);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-/* Additional definitions */
-
-#ifdef _AIX
-int accept (int, struct sockaddr_in*, int*);
-char *bcopy (char*, char*, size_t);
-int bind (int, const void*, int);
-int connect (int, struct sockaddr_in*, int);
-int gethostname (char*, size_t);
-int getsockname (int, struct sockaddr_in*, int*);
-int getpeername (int, struct sockaddr_in*, int*);
-int getsockopt (int, int, int, void*, int*);
-int listen(int, int);
-int setsockopt (int, int, int, void*, int);
-int socket (int, int, int);
-void free (void*);
-void *malloc (size_t);
-#endif
-
-
-
-
-#endif /* __FTPLIBRARYH_ */
-
-
-
diff --git a/lib/libftp/FtpLogin.c b/lib/libftp/FtpLogin.c
deleted file mode 100644
index e066d55..0000000
--- a/lib/libftp/FtpLogin.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-
-STATUS FtpLogin ( FTP ** con, char * host , char * user ,
- char * password , char * account)
-{
-
- FtpAssert((*con),FtpConnect(con,host));
- FtpAssert((*con),FtpUser((*con),user));
- if (((*con)->errno)==230 )
- return ((*con)->errno);
- if (((*con)->errno)==332)
- {
- if ( account == NULL )
- return EXIT(((*con)),(*con)->errno);
- FtpAssert((*con),FtpAccount( (*con) , account ));
- if ( ((*con)->errno)==230 )
- return (*con)->errno;
- }
- return FtpPassword((*con),password);
-}
diff --git a/lib/libftp/FtpMessage.c b/lib/libftp/FtpMessage.c
deleted file mode 100644
index 8009d05..0000000
--- a/lib/libftp/FtpMessage.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-#include <ctype.h>
-
-static char * FtpMessageList[1000];
-
-INLINE static char *___gets(char *s, int maxchars, FTP *ftp)
-{
- char *p=s;
- int c;
-
- while (1)
- {
- if ((c = FtpGetc(ftp,FTPCMD(ftp))) == EOF)
- return NULL;
-
- if ( c == '\n' && *(p-1) == '\r' )
- {
- p--;
- *p='\0';
- return s;
- }
-
- if ( (p-s) > maxchars ) return NULL;
-
- *p++=(char)c;
- }
-}
-
-
-
-
-int FtpGetMessage(FTP *con , char * Message )
-{
- int n;
- char tmp[1024];
-
- while(1)
- {
- if (___gets(tmp,sizeof tmp,con)==NULL)
- return EXIT(con,QUIT);
- if (isdigit(tmp[0]) &&
- isdigit(tmp[1]) &&
- isdigit(tmp[2]) &&
- tmp[3]!='-') break;
- if ( con -> debug != NULL )
- (*con->debug)(con,0,tmp);
- }
-
- strcpy(Message,tmp);
- FtpInitMessageList();
- FtpMessageList[n=FtpNumber(Message)] =
- ( char * ) malloc ( strlen(Message) + 1);
- strcpy(FtpMessageList[n] , Message );
- if ( con -> debug != NULL )
- (*con->debug)(con,n,Message);
-
- return n;
-}
-
-STATUS FtpSendMessage(FTP *ftp,char * Message )
-{
- char *msg=Message;
-
- while (*Message)
- FtpAssert(ftp,FtpPutc(ftp,FTPCMD(ftp),*Message++));
-
- FtpAssert(ftp,FtpPutc(ftp,FTPCMD(ftp),'\015'));
- FtpAssert(ftp,FtpPutc(ftp,FTPCMD(ftp),'\012'));
-
- if ( ftp -> debug != NULL )
- (*ftp->debug)(ftp,0,msg);
- return 1;
-}
-
-char *FtpMessage(int number)
-{
- extern int sys_nerr,errno;
-#ifndef __FreeBSD__
- extern char *sys_errlist[];
-#endif
-
- FtpInitMessageList();
- if ( number == 0 )
- return (char *)sys_errlist[errno];
- return (FtpMessageList[abs(number)]==NULL)?
- "":FtpMessageList[abs(number)];
-}
-
-
-STATUS FtpInitMessageList()
-{
- int i;
- static u = 0;
-
- if ( u )
- return 1;
-
- u = 1;
-
- for (i=0;i<1000;i++)
- FtpMessageList[i]=NULL;
-
- return 1;
-}
-
-int FtpNumber(char *Message)
-{
- return (Message[0] - '0') * 100 +
- (Message[1] - '0') * 10 +
- (Message[2] - '0') ;
-}
-
-
-
-
-
diff --git a/lib/libftp/FtpMove.c b/lib/libftp/FtpMove.c
deleted file mode 100644
index 8037b6b..0000000
--- a/lib/libftp/FtpMove.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-
-STATUS FtpMove(FTP *con,char * oldname , char * newname )
-{
- STATUS i;
-
- if ((i=FtpCommand(con,"RNFR %s",oldname,200,350,EOF)) > 1 )
- return FtpCommand(con,"RNTO %s",newname,200,250,EOF);
- else
- return i;
-}
diff --git a/lib/libftp/FtpNumber.c b/lib/libftp/FtpNumber.c
deleted file mode 100644
index a6d7114..0000000
--- a/lib/libftp/FtpNumber.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-
-int FtpNumber(char *Message)
-{
- return (Message[0] - '0') * 100 +
- (Message[1] - '0') * 10 +
- (Message[2] - '0') ;
-}
diff --git a/lib/libftp/FtpOpenDir.c b/lib/libftp/FtpOpenDir.c
deleted file mode 100644
index 3f2bcf1..0000000
--- a/lib/libftp/FtpOpenDir.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-
-STATUS FtpOpenDir(FTP * con,char * file)
-{
- String command;
-
- if ( file == NULL || *file == '\0' )
- strcpy(command,"NLST");
- else
- sprintf(command,"NLST %s",file);
-
- return FtpCommand(con,command,"",120,150,200,EOF);
-}
diff --git a/lib/libftp/FtpPasv.c b/lib/libftp/FtpPasv.c
deleted file mode 100644
index 3dd52fe..0000000
--- a/lib/libftp/FtpPasv.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the exist
-ing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-#include <unistd.h>
-#include <ctype.h>
-
-char * FtpPasv (FTP *ftp)
-{
- char *msg;
- static String PORT;
- char *p=PORT;
-
- if FtpError(FtpCommand(ftp,"PASV","",227,EOF))
- return "";
-
- msg = FtpMessage (227);
-
- msg+=3;
-
- while (!isdigit(*msg++));
- msg--;
-
- while (isdigit(*msg)||*msg==',') *p++=*msg++;
- *p=0;
-
- return PORT;
-}
-
-
-STATUS FtpLink(FTP *ftp1, FTP *ftp2)
-{
-
- String PORT;
-
- strcpy(PORT,FtpPasv(ftp1));
-
- FtpCommand(ftp2,"PORT %s",PORT,200,EOF);
- return 0;
-}
-
-STATUS FtpPassiveTransfer(FTP *ftp1, FTP *ftp2, char *f1, char *f2)
-{
- String tmp;
- fd_set fds;
-
- FtpAssert(ftp1,FtpLink(ftp1,ftp2));
-
-
- if (!*f2) f2=f1;
-
- FtpAssert(ftp2,FtpCommand(ftp2,"STOR %s",f2, 200, 120 , 150 , 125 , 250 , EOF ));
- FtpAssert(ftp1,FtpCommand(ftp1,"RETR %s",f1, 200, 120 , 150 , 125 , 250 , EOF ));
-
- FD_ZERO(&fds);
-
- FD_SET(fileno(FTPCMD(ftp1)),&fds);
- FD_SET(fileno(FTPCMD(ftp2)),&fds);
-
- if (select(getdtablesize(),&fds,0,0,0)<0)
- {
- if (ftp1->error!=NULL)
- return (*(ftp1->error))(ftp1,QUIT,sys_errlist[errno]);
- if (ftp2->error!=NULL)
- return (*(ftp2->error))(ftp1,QUIT,sys_errlist[errno]);
- return QUIT;
- }
-
- if (FD_ISSET(fileno(FTPCMD(ftp1)),&fds))
- {
- FtpGetMessage(ftp1,tmp);
- FtpLog(ftp1->title,tmp);
- FtpGetMessage(ftp2,tmp);
- FtpLog(ftp2->title,tmp);
- }
- else
- {
- FtpGetMessage(ftp2,tmp);
- FtpLog(ftp2->title,tmp);
- FtpGetMessage(ftp1,tmp);
- FtpLog(ftp1->title,tmp);
- }
- return 0;
-}
-
-
-
-
-
diff --git a/lib/libftp/FtpPort.c b/lib/libftp/FtpPort.c
deleted file mode 100644
index eb15ac0..0000000
--- a/lib/libftp/FtpPort.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-
-STATUS FtpPort(FTP *con,int a,int b,int c,int d,int e,int f)
-{
- String cmd;
- int i;
-
- sprintf(cmd,"PORT %d,%d,%d,%d,%d,%d",a,b,c,d,e,f);
- if ( FtpSendMessage(con,cmd) == QUIT)
- return QUIT;
- if ( (i=FtpGetMessage(con,cmd)) == QUIT)
- return QUIT;
-
- if ( ! FtpGood ( i , 200 , EOF ))
- return EXIT(con,-i);
-
- return EXIT(con,i);
-}
diff --git a/lib/libftp/FtpPwd.c b/lib/libftp/FtpPwd.c
deleted file mode 100644
index 59c792d..0000000
--- a/lib/libftp/FtpPwd.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-
-char * FtpPwd(FTP * con)
-{
- String tmp;
- static String tmp1;
- int i;
-
- if ( FtpSendMessage(con,"PWD") == QUIT )
- return (char *) EXIT(con,QUIT);
- if ( (i=FtpGetMessage(con,tmp)) == QUIT )
- return (char *) EXIT(con,QUIT);
-
- if ( i != 257 )
- return (char *) EXIT(con,-i);
-
- sscanf(tmp,"%*[^\"]%*c%[^\"]%*s",tmp1);
- con -> errno = i;
- return tmp1;
-}
diff --git a/lib/libftp/FtpRetr.c b/lib/libftp/FtpRetr.c
deleted file mode 100644
index ced19b8..0000000
--- a/lib/libftp/FtpRetr.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-#include <unistd.h>
-
-extern STATUS FtpFilenameChecker(char ** in, char ** out);
-
-STATUS FtpRetr (FTP * con , char * command ,
- char *in , char * out)
-{
- FILE *o;
- struct stat st;
- char buffer[FTPBUFSIZ];
- register int size;
-
- FtpFilenameChecker(&in,&out);
-
- if ( FtpTestFlag(con,FTP_REST) && stat(out,&st)==0)
- {
- con -> seek = st.st_size;
- if ((o=Ftpfopen(out,"a+"))==NULL)
- return EXIT(con,LQUIT);
- }
- else
- {
- con -> seek = 0;
- if ((o=Ftpfopen(out,"w+"))==NULL)
- return EXIT(con,LQUIT);
- }
-
-
- if ( FtpError(FtpData(con,command,in,"r")))
- {
-
- if (con->seek==0) return EXIT(con,con->errno);
-
- con -> seek = 0;
- fclose(o);
-
- if ( FtpError(FtpData(con,command,in,"r")) )
- {
- return EXIT(con,con->errno);
- }
-
- if ((o=Ftpfopen(out,"w+"))==NULL)
- return EXIT(con,LQUIT);
- }
-
-
- fseek(o,con->seek,0);
-
- while((size=FtpReadBlock(con,buffer,FTPBUFSIZ))>0)
- {
- if (write(fileno(o),buffer,size)!=size)
- return EXIT(con,LQUIT);
- }
-
- Ftpfclose(o);
- return FtpClose(con);
-}
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lib/libftp/FtpSize.c b/lib/libftp/FtpSize.c
deleted file mode 100644
index 581e186..0000000
--- a/lib/libftp/FtpSize.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-
-int FtpSize(FTP * con, char *filename)
-{
- String tmp;
- int i,size;
-
- strcpy(tmp,"SIZE ");
- strcat(tmp,filename);
-
- if ( FtpSendMessage(con,tmp) == QUIT )
- return EXIT(con,QUIT);
- if ( (i=FtpGetMessage(con,tmp)) == QUIT )
- return EXIT(con,QUIT);
-
- if ( i != 213 )
- return con -> errno = (-i);
-
- sscanf(tmp,"%*d %d",&size);
- return size;
-}
diff --git a/lib/libftp/FtpStor.c b/lib/libftp/FtpStor.c
deleted file mode 100644
index 9cd0e4e..0000000
--- a/lib/libftp/FtpStor.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-#include <unistd.h>
-
-STATUS FtpStor (FTP * con , char * command ,
- char *in , char * out)
-{
- FILE *i;
- char buffer[FTPBUFSIZ];
- int size;
-
- con->seek=0;
-
- if ( (i=Ftpfopen(in,"rb")) == NULL )
- return EXIT(con,LQUIT);
-
- if ( FtpTestFlag(con,FTP_REST) &&
- (con->seek=FtpSize(con,out))<0 )
- con->seek=0;
-
-
- if ( FtpError(FtpData(con,command,out,"w")))
- {
- if (con->seek==0) return EXIT(con,con->errno);
-
- con -> seek =0;
- if ( FtpError(FtpData(con,command,out,"w")) )
- return EXIT(con,con->errno);
- }
-
- if (con->seek) fseek(i,con->seek,0);
-
- while ( (size=read ( fileno(i) , buffer, FTPBUFSIZ ))>0)
- FtpWriteBlock(con,buffer,size);
-
- Ftpfclose(i);
- return FtpClose(con);
-}
-
-
-
-
-
-
-
diff --git a/lib/libftp/FtpSyscalls.c b/lib/libftp/FtpSyscalls.c
deleted file mode 100644
index 67fa4ca..0000000
--- a/lib/libftp/FtpSyscalls.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-#include <unistd.h>
-#include <errno.h>
-
-#define DEF(syscal,name) int name(void *a, void *b, void *c) \
-{\
- register int status;\
- while (((status=syscal(a,b,c))==-1) && (errno==EINTR));\
- return status;\
-}
-
-DEF(open,nointr_open)
-DEF(close,nointr_close)
-DEF(select,nointr_select)
-DEF(read,nointr_read)
-DEF(write,nointr_write)
-DEF(dup,nointr_dup)
-DEF(wait,nointr_wait)
-DEF(connect,nointr_connect)
-DEF(listen,nointr_listen)
-DEF(accept,nointr_accept)
diff --git a/lib/libftp/FtpType.c b/lib/libftp/FtpType.c
deleted file mode 100644
index ae0d0ea..0000000
--- a/lib/libftp/FtpType.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include "FtpLibrary.h"
-
-STATUS FtpType(FTP *ftp, char type)
-{
- STATUS p;
-
- if ((p=FtpCommand(ftp,"TYPE %c",type,200,EOF))>0)
- ftp->mode=(int)type;
- return p;
-}
-
-
diff --git a/lib/libftp/Ftpfopen.c b/lib/libftp/Ftpfopen.c
deleted file mode 100644
index 9b89bb3..0000000
--- a/lib/libftp/Ftpfopen.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-#include <FtpLibrary.h>
-
-#define NFSD 256
-
-static int fds_types[NFDS];
-static int init=0;
-
-enum {T_EMPTY=0,T_FILE,T_STREAM,T_PIPE,T_FULL};
-
-FILE *Ftpfopen(char *filename,char *mode)
-{
- FILE *fp;
-
- if (!init)
- {
- bzero(fds_types,NFDS*sizeof(fds_types[0]));
- init=1;
- }
-
- if (!strcmp(filename,"*STDIN*") || (!strcmp(filename,"-") && (mode[0]=='r')) )
- {
- fds_types[fileno(stdin)]=T_STREAM;
- return stdin;
- }
-
- if (!strcmp(filename,"*STDOUT*") || (!strcmp(filename,"-") && (mode[0]=='w')))
- {
- fds_types[fileno(stdout)]=T_STREAM;
- return stdout;
- }
-
- if (strcmp(filename,"*STDERR*")==0)
- {
- fds_types[fileno(stderr)]=T_STREAM;
- return stderr;
- }
-
-
-
- if (*filename=='|')
- {
- fp=popen(filename+1,mode);
- if (fp==NULL) return fp;
- fds_types[fileno(fp)]=T_PIPE;
- return fp;
- }
-
- fp=FtpFullOpen(filename,mode);
- if (fp==NULL) return fp;
- fds_types[fileno(fp)]=T_FILE;
- return fp;
-
-}
-
-int Ftpfclose(FILE *fp)
-{
-
- if (!init)
- {
- bzero(fds_types,NFDS*sizeof(fds_types[0]));
- init=1;
- }
-
- switch (fds_types[fileno(fp)])
- {
-
- case T_FILE:
-
- return FtpFullClose(fp);
-
- case T_STREAM:
-
- return fflush(fp);
-
- case T_PIPE:
-
- return pclose(fp);
-
- default:
-
- return -1;
- }
-
-}
diff --git a/lib/libftp/Makefile b/lib/libftp/Makefile
deleted file mode 100644
index ebb6b5b..0000000
--- a/lib/libftp/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-LIB= ftp
-CFLAGS+= -I${.CURDIR} -Wall
-
-SRCS= FtpAbort.c FtpFull.c FtpPasv.c \
- FtpArchie.c FtpGetHost.c FtpPort.c \
- FtpBye.c FtpGood.c FtpPwd.c \
- FtpClose.c FtpIO.c FtpRetr.c \
- FtpCommand.c FtpInit.c FtpSize.c \
- FtpConnect.c FtpLogin.c FtpStor.c \
- FtpCopy.c FtpMessage.c \
- FtpData.c FtpMove.c FtpType.c \
- FtpDebug.c Ftpfopen.c \
- FtpFilenameChecker.c FtpOpenDir.c
-
-beforeinstall:
- -cd ${.CURDIR}; cmp -s FtpLibrary.h ${DESTDIR}/usr/include/FtpLibrary.h || \
- install -c -o ${BINOWN} -g ${BINGRP} -m 444 FtpLibrary.h \
- ${DESTDIR}/usr/include
-
-.include <bsd.lib.mk>
diff --git a/lib/libftp/doc/example.c b/lib/libftp/doc/example.c
deleted file mode 100644
index 0606592..0000000
--- a/lib/libftp/doc/example.c
+++ /dev/null
@@ -1,51 +0,0 @@
-
-/* Include standard libftp's header */
-
-#include <FtpLibrary.h>
-
-
-
-main(int argc, char *argv[])
-{
-
- FILE *input,*output;
- int c;
-
-
- if (argc<3)
- exit(fprintf(stderr,"Usage: %s input-file output-file\n",argv[0]));
-
- FtplibDebug(yes);
-
- if ((input=Ftpfopen(argv[1],"r"))==NULL)
- {
- perror(argv[1]);
- exit(1);
- }
-
- if ((output=Ftpfopen(argv[2],"w"))==NULL)
- {
- perror(argv[2]);
- exit(1);
- }
-
- while ( (c=getc(input)) != EOF && (putc(c,output)!=EOF) );
-
- if (ferror(input))
- {
- perror(argv[1]);
- exit(1);
- }
-
- if (ferror(output))
- {
- perror(argv[1]);
- exit(1);
- }
-
- Ftpfclose(input);
- Ftpfclose(output);
-
- exit(0);
-
-}
diff --git a/lib/libftp/utils/Makefile b/lib/libftp/utils/Makefile
deleted file mode 100644
index bae516b..0000000
--- a/lib/libftp/utils/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# A rather bogus Makefile, but one intended to be used by hand anyway..
-#
-
-CFLAGS = -I${.CURDIR} -I${.CURDIR}/.. -DREADLINE
-LDADD+= -L${.CURDIR}
-DPADD+= libetc.a
-
-.if exists(${.CURDIR}/../obj)
-LDADD+= -L${.CURDIR}/../obj
-DPADD+= ${.CURDIR}/../obj/libftp.a
-.else
-LDADD+= -L${.CURDIR}/..
-DPADD+= ${.CURDIR}/../libftp.a
-.endif
-
-all: ftptry mirror uftp
-
-ftptry: ftptry.o
- $(CC) $(CFLAGS) -o ftptry ftptry.o ${LDADD} -lftp
-
-uftp: uftp.o uftpcmd.o libetc.a
- $(CC) $(CFLAGS) -o uftp uftp.o uftpcmd.o ${LDADD} -lftp -letc
-
-mirror: mirror.o
- $(CC) $(CFLAGS) -o mirror mirror.o ${LDADD} -lftp
-
-clean:
- rm -f ftptry mirror uftp *~ *.o *.a
-
-LIBOBJS= readline.o glob.o
-libetc.a: $(LIBOBJS)
- ar qc libetc.a $(LIBOBJS)
- ranlib libetc.a
diff --git a/lib/libftp/utils/cdefs.h b/lib/libftp/utils/cdefs.h
deleted file mode 100644
index aede2ec..0000000
--- a/lib/libftp/utils/cdefs.h
+++ /dev/null
@@ -1,111 +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
- * Berkeley Software Design, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)cdefs.h 8.7 (Berkeley) 1/21/94
- */
-
-#ifndef _CDEFS_H_
-#define _CDEFS_H_
-
-#if defined(__cplusplus)
-#define __BEGIN_DECLS extern "C" {
-#define __END_DECLS };
-#else
-#define __BEGIN_DECLS
-#define __END_DECLS
-#endif
-
-#if (defined(__STDC__) || defined(__cplusplus))
-#define __const const /* define reserved names to standard */
-#define __signed signed
-#define __volatile volatile
-#if defined(__cplusplus)
-#define __inline inline /* convert to C++ keyword */
-#else
-#ifndef __GNUC__
-#define __inline /* delete GCC keyword */
-#endif /* !__GNUC__ */
-#endif /* !__cplusplus */
-
-#else /* !(__STDC__ || __cplusplus) */
-#define __P(protos) () /* traditional C preprocessor */
-#define __CONCAT(x,y) x/**/y
-#define __STRING(x) "x"
-
-#ifndef __GNUC__
-#define __const /* delete pseudo-ANSI C keywords */
-#define __inline
-#define __signed
-#define __volatile
-/*
- * In non-ANSI C environments, new programs will want ANSI-only C keywords
- * deleted from the program and old programs will want them left alone.
- * When using a compiler other than gcc, programs using the ANSI C keywords
- * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
- * When using "gcc -traditional", we assume that this is the intent; if
- * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
- */
-#ifndef NO_ANSI_KEYWORDS
-#define const /* delete ANSI C keywords */
-#define inline
-#define signed
-#define volatile
-#endif
-#endif /* !__GNUC__ */
-#endif /* !(__STDC__ || __cplusplus) */
-
-/*
- * GCC1 and some versions of GCC2 declare dead (non-returning) and
- * pure (no side effects) functions using "volatile" and "const";
- * unfortunately, these then cause warnings under "-ansi -pedantic".
- * GCC2 uses a new, peculiar __attribute__((attrs)) style. All of
- * these work for GNU C++ (modulo a slight glitch in the C++ grammar
- * in the distribution version of 2.5.5).
- */
-#if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5
-#define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-#define __dead __volatile
-#define __pure __const
-#endif
-#endif
-
-/* Delete pseudo-keywords wherever they are not available or needed. */
-#ifndef __dead
-#define __dead
-#define __pure
-#endif
-
-#endif /* !_CDEFS_H_ */
diff --git a/lib/libftp/utils/ftptry.c b/lib/libftp/utils/ftptry.c
deleted file mode 100644
index 7dfb130..0000000
--- a/lib/libftp/utils/ftptry.c
+++ /dev/null
@@ -1,633 +0,0 @@
-/*
-Library for ftpd clients.(libftp)
- Copyright by Oleg Orel
- All rights reserved.
-
-This library is desined for free, non-commercial software creation.
-It is changeable and can be improved. The author would greatly appreciate
-any advises, new components and patches of the existing programs.
-Commercial usage is also possible with participation of it's author.
-
-
-
-*/
-
-char intro[]="\
- Ftptry - try transfer via FTP.\n\
- Copyright by Oleg Orel is Reserved.\n\
-\n\
-This program is writen using \"libftp\".The main orientation for this\n\
-program is FTPing via bad-working network. Many network links are\n\
-down-up switched and networks are broaken, so the problem of\n\
-transfering large files exists. The main method, used by this\n\
-software is repetition until successfull transfer. There are some\n\
-keys for setting repetition and timeout intervals, modes of transfer\n\
-(binary and ascii), types of transfer (get,put,directory). All options\n\
-will be described in usage, if the program is started without them.\n\
-\n\
- The libftp you may transfer from host lpuds.oea.ihep.su via ftp-anonymous.\n\
- All question are sent to author via e-mail (orel@oea.ihep.su)\n\
- ";
-
-#include <FtpLibrary.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <signal.h>
-#include <setjmp.h>
-#include <string.h>
-
-#ifdef __GNUC__
-#define INLINE inline
-#else
-#define inline
-#endif
-
-#define FTPTRY "FTPTRY" /* The name of enviroment
- variable with default options*/
-#define log(x) FtpLog("ftptry",x)
-#define DEBUG(x) (debug?log(x):0)
-#define USERNAME (getenv("USER")==NULL?getenv("LOGNAME"):getenv("USER"))
-#define DEFAULT_TIMEOUT 600
-
-
-enum __type__ {ascii=1,binary};
-enum __mode__ {get=1,put,dir,multiget};
-enum __logmode__ {lm_tty,lm_file,lm_mail};
-enum __rcode__ {OK_, BREAK_, CANCEL_};
-
-char *gethost();
-char *date();
-int my_abort();
-int my_IO();
-int my_debug();
-void done(),leave(),sighup();
-
-char
- *machine ="localhost",
- *user="anonymous",
- *password,
- *localfile=NULL,
- *progname="ftptry";
-
-jmp_buf stack,trap;
-int counter=0;
-String tmp;
-FTP *ftp;
-int type=ascii;
-int sleeptime=600;
-int debug=false;
-int mode=get;
-int logmode=lm_tty;
-char *logfile=NULL;
-FILE *LIST=NULL;
-extern int errno;
-extern char *optarg;
-extern int optind, opterr;
-String PASSWORD;
-
-
-/* Setup enviroment */
-
-main(int argc,char **argv)
-{
- FILE *out,*in;
- int i;
-
- if (setjmp(trap)!=0)
- exit(1);
-
- signal(SIGHUP,sighup);
- signal(SIGTRAP,done);
- signal(SIGINT,done);
- signal(SIGQUIT,done);
-
- sprintf(password=PASSWORD,"%s@%s",
- USERNAME,
- gethost());
-
- progname=argv[0];
-
- FtpDebug(&FtpInit);
- FtpSetErrorHandler(&FtpInit,my_abort);
- FtpSetIOHandler(&FtpInit,my_IO);
- FtpSetFlag(&FtpInit,FTP_REST);
- FtpSetTimeout(&FtpInit,DEFAULT_TIMEOUT);
-
- setoptions();
- optind=1;
- options(argc,argv);
- if ( argc<2 ) usage();
-
- switch(logmode)
- {
-
- case lm_file:
-
- if (fork()) quit("Deattaching.....");
- close(0);close(1);close(2);
-
- if (logfile==NULL)
- {
- sprintf(tmp,"/tmp/ftptry-%s.XXXXXX",USERNAME);
- mktemp(tmp);
- }
- else
- strcpy(tmp,logfile);
-
- open(tmp,O_TRUNC|O_CREAT|O_WRONLY,0600);
- dup(0);
- dup(0);
- break;
-
- case lm_mail:
-
-
-
- if (fork()) quit("Deattaching.....");
-
- close(0);close(1);close(2);
- if (popen("/usr/lib/sendmail -t","w")==NULL)
- perror("sendmail"),
- quit("");
-
- dup(0);
- dup(0);
-
- printf("From: %s@%s\n",USERNAME,gethost());
- printf("To: %s@%s\n",USERNAME,gethost());
- printf("Subject: ftptry session log\n\n");
-
- fflush(stdout);
-
- break;
- }
-
-
- signal(SIGHUP,sighup);
- if (isatty(fileno(stdout))) FtpSetHashHandler(&FtpInit,FtpHash);
- loop(argc,argv,optind);
- exit(0);
-}
-
-
-
-INLINE noargs(int argc, char **argv, int optind)
-{
- int i;
-
- for (i=optind;i<argc;i++)
- if (argv[i]!=NULL) return 0;
- return 1;
-}
-
-
-
-/* Main loop */
-
-loop(int argc, char **argv, int optind /* First args as filename */ )
-{
- int i,rcode;
- String tmp;
- String machine;
- String filename;
- String localfilename;
- char *p1;
-
- for(i=optind;;(i==argc-1)?i=optind,
- sprintf(tmp,"Sleeping %d secs",sleeptime),log(tmp),sleep(sleeptime):
- i++)
- {
- if (noargs(argc,argv,optind))
- quit("Nothing doing");
-
- if (strchr(argv[i],':')==NULL)
- {
- if (find_archie(argv[i],machine,filename,localfilename)==0)
- argv[i]=NULL;
- }
- else
- {
- sscanf(argv[i],"%[^:]:%s",machine,filename);
- if ((p1=strrchr(filename,'/'))!=NULL)
- strcpy(localfilename,p1+1);
- else
- strcpy(localfilename,filename);
- }
- if (localfile == NULL ) localfile=localfilename;
- if ((rcode=transfer(machine, filename, localfile))==OK_)
- DEBUG("Transfer complete"),
- exit(0);
- if (rcode==CANCEL_ && strchr(argv[i],':')!=NULL)
- argv[i]=NULL;
- }
-}
-
-transfer(char *machine, char *file, char *localfile)
-{
- int r;
- String tmp;
-
- if ((r=setjmp(stack))!=0)
- return r;
-
- sprintf(tmp,"Start transfer, machine is %s, remote file is %s, local file is %s",
- machine, file, localfile);
- DEBUG(tmp);
-
- FtpLogin(&ftp,machine,user,password,NULL);
-
- if (type==binary)
- FtpBinary(ftp);
-
- switch (mode)
- {
-
- case get:
-
- FtpRetr(ftp,"RETR %s",file,localfile);
- break;
-
- case put:
-
- FtpStor(ftp,"STOR %s",localfile,file);
- break;
-
- case dir:
-
- FtpRetr(ftp,"LIST %s",file,localfile);
- break;
-
- case multiget:
- domultiget(file);
- break;
-
- }
-
- FtpBye(ftp);
-
- DEBUG("Transfer complete");
- return OK_;
-}
-
-
-void leave(int code)
-{
- FtpQuickBye(ftp);
- DEBUG("Leaving transfering");
- longjmp(stack,code);
-}
-
-void sighup()
-{
- leave(BREAK_);
-}
-
-
-quit(char *s)
-{
- log(s);
- longjmp(trap,1);
-}
-
-
-my_IO(FTP *ftp, int n, char *s )
-{
-
- DEBUG(s);
- leave(BREAK_);
-}
-
-my_abort(FTP *ftp, int n, char *s )
-{
-
- log(s);
- /* No access or not found, exclude network or host unreachable */;
- if (abs(n) == 550 && FtpBadReply550(s))
- leave(CANCEL_);
- leave(BREAK_);
-}
-
-
-domultiget(char *file)
-{
- String list,localname,tmp_name;
- char *p1;
-
- sprintf(list,"/tmp/ftptry-%s-multiget.XXXXXX",USERNAME);
- mktemp(list);
-
- FtpRetr(ftp,"NLST %s",file,list);
-
- if ((LIST=fopen(list,"r"))==NULL) quit((char *)sys_errlist[errno]);
-
- while ( fgets (tmp, sizeof tmp, LIST) != NULL )
- {
- tmp[strlen(tmp)-1]=0;
- if ((p1=strrchr(tmp,'/'))!=NULL)
- strcpy(localname,p1+1);
- else
- strcpy(localname,tmp);
-
- DEBUG(localname);
- FtpGet(ftp,tmp,localname);
- }
-
- fclose(LIST);
- LIST=NULL;
- return;
-}
-
-usage()
-{
- fprintf(stderr,"\
-Usage: %s [optins] [host:file]\n\
- (default host \"localhost\",\n\
- default file \"README\" or \".\" in directory mode)\n\
-\n\
-Valid options:\n\
-\n\
- -u user default anonymous\n\
- -p password default %s\n\
- -P inquire password from your terminal\n\
- -l local_file use only if remote and local file differ\n\
- -c direct output to stdout(like cat)\n\
- -r reverse mode, i.e. send file to remote host\n\
- -d directory mode, remote file is patern or \"ls\" options\n\
- default output is stdout.\n\
- -G multiget mode, file is patern for \"ls\" command\n\
- again at next try.\n\
- -b binary transfer mode\n\
- -s seconds Retry interval, default 10 minutes\n\
- -t seconds Timeout, default 10 minutes\n\
- -D Turn on debugging mode\n\
- -B Run in background and direct output to\n\
- /tmp/ftptry-%s.XXXXXX\n\
- -o file Run in background and direct output\n\
- to file\n\
- -m Send output to orel via e-mail\n\
- -I Print short introduction\n\
-\n\
-Example:\n\
- %s -Dbs 300 garbo.uwasa.fi:ls-lR.Z\n\
- Retrive file ls-lR.Z from garbo.uwasa.fi in binary mode\n\
- trying to reestablish connection every 5 minutes\n\
- on failure. Print debugging information.\n\
-\n\
- You can set default options to %s enviroment variable\n\
-",progname,password,USERNAME,progname,FTPTRY);
- exit(-1);
-}
-
-
-char *gethost()
-{
- static String tmp;
- String tmp2;
-
- gethostname(tmp2,sizeof tmp2);
-
- strcpy(tmp,FtpGetHost(tmp2)->h_name);
- return tmp;
-}
-
-
-void done(sig)
-{
- String x;
-
- signal(sig,done);
- sprintf(x,"interputed by signal %d",sig);
- log(x);
- longjmp(trap,1);
-}
-
-
-options(int argc,char **argv)
-{
- char c;
-
- while((c=getopt(argc,argv,"GOIBDru:p:Pdbs:o:l:t:cm"))!=EOF)
- {
- switch(c)
- {
-
- case 'G':
- mode=multiget;
- break;
-
- case 'c':
-
- if (localfile==NULL) localfile="*STDOUT*";
- break;
-
- case 'I':
- fprintf(stderr,intro);
- exit(0);
-
- case 'r':
-
- mode=put;
- break;
-
- case 'd':
-
- mode=dir;
- if (localfile==NULL) localfile="*STDOUT*";
- break;
-
- case 't':
-
- FtpSetTimeout(&FtpInit,atoi(optarg));
- break;
-
- case 'l':
-
- localfile=optarg;
- break;
-
- case 'D':
-
- debug=true;
- break;
-
- case 'u':
-
- user=optarg;
- break;
-
- case 'p':
-
- password=optarg;
- break;
-
- case 'P':
-
- password=(char *)getpass("Password:");
- break;
-
- case 'b':
-
- type=binary;
- break;
-
- case 's':
-
- sleeptime=atoi(optarg);
- break;
-
- case 'o':
-
- logmode=lm_file;
- logfile=optarg;
- break;
-
- case 'm':
-
- logmode=lm_mail;
- break;
-
- case 'B':
-
- logmode=lm_file;
- logfile=NULL;
- break;
-
- default:
-
- usage();
-
- }
- }
-}
-
-
-setoptions()
-{
- String x;
- char *p,*sp;
- int argc;
- char *argv[100];
-
-
-
-
- if ((p=(char *)getenv(FTPTRY))!=NULL && *p!=0)
- strcpy(x,p);
- else
- return;
-
-
-
- for (argv[0]="",p=x,sp=x,argc=1; *p!=0 ; p++)
- {
- if (*p==' ')
- {
- *p=0;
- argv[argc++] = sp;
- sp = p+1;
- }
- }
-
- argv[argc++]=sp;
-
- options(argc,argv);
-}
-
-
-INLINE unsigned long maxsize(String *result, int hops)
-{
- unsigned long maxsiz=0,cursiz=0;
- int i;
-
- for (i=0;i<hops;i++)
- {
- sscanf(result[i],"%*[^ ] %u %*s",&cursiz);
- if (cursiz>maxsiz)maxsiz=cursiz;
- }
- return maxsiz;
-}
-
-
-find_archie(char *what,char *machine, char *filename, char *localfilename)
-{
-
-#define MAXHOPS 15
-
- static String result[MAXHOPS];
- static int last=0;
- static int size=0;
- static int first=0;
- int rnd;
- static int init=0;
- static String oldwhat={'\0'};
- char *p1;
- int i;
-
- if (!init || strcmp(oldwhat,what)!=0 || last==0)
- {
- String cmd;
- FILE *archie;
-
- for (i=0;i<MAXHOPS;i++) result[i][0]=0;
- sprintf(cmd,"archie -l -m %d %s",MAXHOPS,what);
- DEBUG(cmd);
-
- if ((archie = popen(cmd,"r"))==NULL)
- quit("Archie can't execute");
-
- for(i=0;i<MAXHOPS;i++)
- {
- if (fgets(result[i],sizeof (result[i]), archie)==NULL)
- break;
- result[i][strlen(result[i])-1]=0;
- DEBUG(result[i]);
- }
-
-
- last=i;
-
- if ( last==0 )
- {
- DEBUG("archie not found need file");
- return(0);
- }
-
-
- init=1;
- first=0;
- strcpy(oldwhat,what);
- size=maxsize(result,MAXHOPS);
- }
-
- if (first >= last-1) first=0;
- for ( i=first; i<last; i++)
- if ( atoi ( strchr(result[i],' ') + 1 ) == size)
- {
- first=i+1;
- break;
- }
-
- DEBUG("Archie select is ... (see next line)");
- DEBUG(result[i]);
-
- if (sscanf ( result[i] , "%*[^ ] %*[^ ] %[^ ] %s", machine, filename )!=2)
- {
- DEBUG("Bad archie output format");
- last=0;
- return(0);
- }
-
-
- if ( (p1=strrchr(filename,'/'))!= NULL)
- strcpy(localfilename,p1+1);
- else
- strcpy(localfilename,filename);
-
- return(1);
-}
-
-
-
-
-
-
diff --git a/lib/libftp/utils/glob.c b/lib/libftp/utils/glob.c
deleted file mode 100644
index efaeaa6..0000000
--- a/lib/libftp/utils/glob.c
+++ /dev/null
@@ -1,850 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Guido van Rossum.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93";
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * glob(3) -- a superset of the one defined in POSIX 1003.2.
- *
- * The [!...] convention to negate a range is supported (SysV, Posix, ksh).
- *
- * Optional extra services, controlled by flags not defined by POSIX:
- *
- * GLOB_QUOTE:
- * Escaping convention: \ inhibits any special meaning the following
- * character might have (except \ at end of string is retained).
- * GLOB_MAGCHAR:
- * Set in gl_flags if pattern contained a globbing character.
- * GLOB_NOMAGIC:
- * Same as GLOB_NOCHECK, but it will only append pattern if it did
- * not contain any magic characters. [Used in csh style globbing]
- * GLOB_ALTDIRFUNC:
- * Use alternately specified directory access functions.
- * GLOB_TILDE:
- * expand ~user/foo to the /home/dir/of/user/foo
- * GLOB_BRACE:
- * expand {1,2}{a,b} to 1a 1b 2a 2b
- * gl_matchc:
- * Number of matches in the current invocation of glob.
- */
-
-#include <sys/param.h>
-#include <sys/stat.h>
-
-#include <ctype.h>
-#include <dirent.h>
-#include <errno.h>
-#include <glob.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#define DOLLAR '$'
-#define DOT '.'
-#define EOS '\0'
-#define LBRACKET '['
-#define NOT '!'
-#define QUESTION '?'
-#define QUOTE '\\'
-#define RANGE '-'
-#define RBRACKET ']'
-#define SEP '/'
-#define STAR '*'
-#define TILDE '~'
-#define UNDERSCORE '_'
-#define LBRACE '{'
-#define RBRACE '}'
-#define SLASH '/'
-#define COMMA ','
-
-#ifndef DEBUG
-
-#define M_QUOTE 0x8000
-#define M_PROTECT 0x4000
-#define M_MASK 0xffff
-#define M_ASCII 0x00ff
-
-typedef u_short Char;
-
-#else
-
-#define M_QUOTE 0x80
-#define M_PROTECT 0x40
-#define M_MASK 0xff
-#define M_ASCII 0x7f
-
-typedef char Char;
-
-#endif
-
-
-#define CHAR(c) ((Char)((c)&M_ASCII))
-#define META(c) ((Char)((c)|M_QUOTE))
-#define M_ALL META('*')
-#define M_END META(']')
-#define M_NOT META('!')
-#define M_ONE META('?')
-#define M_RNG META('-')
-#define M_SET META('[')
-#define ismeta(c) (((c)&M_QUOTE) != 0)
-
-
-static int compare __P((const void *, const void *));
-static void g_Ctoc __P((const Char *, char *));
-static int g_lstat __P((Char *, struct stat *, glob_t *));
-static DIR *g_opendir __P((Char *, glob_t *));
-static Char *g_strchr __P((Char *, int));
-#ifdef notdef
-static Char *g_strcat __P((Char *, const Char *));
-#endif
-static int g_stat __P((Char *, struct stat *, glob_t *));
-static int glob0 __P((const Char *, glob_t *));
-static int glob1 __P((Char *, glob_t *));
-static int glob2 __P((Char *, Char *, Char *, glob_t *));
-static int glob3 __P((Char *, Char *, Char *, Char *, glob_t *));
-static int globextend __P((const Char *, glob_t *));
-static const Char * globtilde __P((const Char *, Char *, glob_t *));
-static int globexp1 __P((const Char *, glob_t *));
-static int globexp2 __P((const Char *, const Char *, glob_t *, int *));
-static int match __P((Char *, Char *, Char *));
-#ifdef DEBUG
-static void qprintf __P((const char *, Char *));
-#endif
-
-int
-glob(pattern, flags, errfunc, pglob)
- const char *pattern;
- int flags, (*errfunc) __P((const char *, int));
- glob_t *pglob;
-{
- const u_char *patnext;
- int c;
- Char *bufnext, *bufend, patbuf[MAXPATHLEN+1];
-
- patnext = (u_char *) pattern;
- if (!(flags & GLOB_APPEND)) {
- pglob->gl_pathc = 0;
- pglob->gl_pathv = NULL;
- if (!(flags & GLOB_DOOFFS))
- pglob->gl_offs = 0;
- }
- pglob->gl_flags = flags & ~GLOB_MAGCHAR;
- pglob->gl_errfunc = errfunc;
- pglob->gl_matchc = 0;
-
- bufnext = patbuf;
- bufend = bufnext + MAXPATHLEN;
- if (flags & GLOB_QUOTE) {
- /* Protect the quoted characters. */
- while (bufnext < bufend && (c = *patnext++) != EOS)
- if (c == QUOTE) {
- if ((c = *patnext++) == EOS) {
- c = QUOTE;
- --patnext;
- }
- *bufnext++ = c | M_PROTECT;
- }
- else
- *bufnext++ = c;
- }
- else
- while (bufnext < bufend && (c = *patnext++) != EOS)
- *bufnext++ = c;
- *bufnext = EOS;
-
- if (flags & GLOB_BRACE)
- return globexp1(patbuf, pglob);
- else
- return glob0(patbuf, pglob);
-}
-
-/*
- * Expand recursively a glob {} pattern. When there is no more expansion
- * invoke the standard globbing routine to glob the rest of the magic
- * characters
- */
-static int globexp1(pattern, pglob)
- const Char *pattern;
- glob_t *pglob;
-{
- const Char* ptr = pattern;
- int rv;
-
- /* Protect a single {}, for find(1), like csh */
- if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS)
- return glob0(pattern, pglob);
-
- while ((ptr = (const Char *) g_strchr((Char *) ptr, LBRACE)) != NULL)
- if (!globexp2(ptr, pattern, pglob, &rv))
- return rv;
-
- return glob0(pattern, pglob);
-}
-
-
-/*
- * Recursive brace globbing helper. Tries to expand a single brace.
- * If it succeeds then it invokes globexp1 with the new pattern.
- * If it fails then it tries to glob the rest of the pattern and returns.
- */
-static int globexp2(ptr, pattern, pglob, rv)
- const Char *ptr, *pattern;
- glob_t *pglob;
- int *rv;
-{
- int i;
- Char *lm, *ls;
- const Char *pe, *pm, *pl;
- Char patbuf[MAXPATHLEN + 1];
-
- /* copy part up to the brace */
- for (lm = patbuf, pm = pattern; pm != ptr; *lm++ = *pm++)
- continue;
- ls = lm;
-
- /* Find the balanced brace */
- for (i = 0, pe = ++ptr; *pe; pe++)
- if (*pe == LBRACKET) {
- /* Ignore everything between [] */
- for (pm = pe++; *pe != RBRACKET && *pe != EOS; pe++)
- continue;
- if (*pe == EOS) {
- /*
- * We could not find a matching RBRACKET.
- * Ignore and just look for RBRACE
- */
- pe = pm;
- }
- }
- else if (*pe == LBRACE)
- i++;
- else if (*pe == RBRACE) {
- if (i == 0)
- break;
- i--;
- }
-
- /* Non matching braces; just glob the pattern */
- if (i != 0 || *pe == EOS) {
- *rv = glob0(patbuf, pglob);
- return 0;
- }
-
- for (i = 0, pl = pm = ptr; pm <= pe; pm++)
- switch (*pm) {
- case LBRACKET:
- /* Ignore everything between [] */
- for (pl = pm++; *pm != RBRACKET && *pm != EOS; pm++)
- continue;
- if (*pm == EOS) {
- /*
- * We could not find a matching RBRACKET.
- * Ignore and just look for RBRACE
- */
- pm = pl;
- }
- break;
-
- case LBRACE:
- i++;
- break;
-
- case RBRACE:
- if (i) {
- i--;
- break;
- }
- /* FALLTHROUGH */
- case COMMA:
- if (i && *pm == COMMA)
- break;
- else {
- /* Append the current string */
- for (lm = ls; (pl < pm); *lm++ = *pl++)
- continue;
- /*
- * Append the rest of the pattern after the
- * closing brace
- */
- for (pl = pe + 1; (*lm++ = *pl++) != EOS;)
- continue;
-
- /* Expand the current pattern */
-#ifdef DEBUG
- qprintf("globexp2:", patbuf);
-#endif
- *rv = globexp1(patbuf, pglob);
-
- /* move after the comma, to the next string */
- pl = pm + 1;
- }
- break;
-
- default:
- break;
- }
- *rv = 0;
- return 0;
-}
-
-
-
-/*
- * expand tilde from the passwd file.
- */
-static const Char *
-globtilde(pattern, patbuf, pglob)
- const Char *pattern;
- Char *patbuf;
- glob_t *pglob;
-{
- struct passwd *pwd;
- char *h;
- const Char *p;
- Char *b;
-
- if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
- return pattern;
-
- /* Copy up to the end of the string or / */
- for (p = pattern + 1, h = (char *) patbuf; *p && *p != SLASH;
- *h++ = *p++)
- continue;
-
- *h = EOS;
-
- if (((char *) patbuf)[0] == EOS) {
- /*
- * handle a plain ~ or ~/ by expanding $HOME
- * first and then trying the password file
- */
- if ((h = getenv("HOME")) == NULL) {
- if ((pwd = getpwuid(getuid())) == NULL)
- return pattern;
- else
- h = pwd->pw_dir;
- }
- }
- else {
- /*
- * Expand a ~user
- */
- if ((pwd = getpwnam((char*) patbuf)) == NULL)
- return pattern;
- else
- h = pwd->pw_dir;
- }
-
- /* Copy the home directory */
- for (b = patbuf; *h; *b++ = *h++)
- continue;
-
- /* Append the rest of the pattern */
- while ((*b++ = *p++) != EOS)
- continue;
-
- return patbuf;
-}
-
-
-/*
- * The main glob() routine: compiles the pattern (optionally processing
- * quotes), calls glob1() to do the real pattern matching, and finally
- * sorts the list (unless unsorted operation is requested). Returns 0
- * if things went well, nonzero if errors occurred. It is not an error
- * to find no matches.
- */
-static int
-glob0(pattern, pglob)
- const Char *pattern;
- glob_t *pglob;
-{
- const Char *qpatnext;
- int c, err, oldpathc;
- Char *bufnext, patbuf[MAXPATHLEN+1];
-
- qpatnext = globtilde(pattern, patbuf, pglob);
- oldpathc = pglob->gl_pathc;
- bufnext = patbuf;
-
- /* We don't need to check for buffer overflow any more. */
- while ((c = *qpatnext++) != EOS) {
- switch (c) {
- case LBRACKET:
- c = *qpatnext;
- if (c == NOT)
- ++qpatnext;
- if (*qpatnext == EOS ||
- g_strchr((Char *) qpatnext+1, RBRACKET) == NULL) {
- *bufnext++ = LBRACKET;
- if (c == NOT)
- --qpatnext;
- break;
- }
- *bufnext++ = M_SET;
- if (c == NOT)
- *bufnext++ = M_NOT;
- c = *qpatnext++;
- do {
- *bufnext++ = CHAR(c);
- if (*qpatnext == RANGE &&
- (c = qpatnext[1]) != RBRACKET) {
- *bufnext++ = M_RNG;
- *bufnext++ = CHAR(c);
- qpatnext += 2;
- }
- } while ((c = *qpatnext++) != RBRACKET);
- pglob->gl_flags |= GLOB_MAGCHAR;
- *bufnext++ = M_END;
- break;
- case QUESTION:
- pglob->gl_flags |= GLOB_MAGCHAR;
- *bufnext++ = M_ONE;
- break;
- case STAR:
- pglob->gl_flags |= GLOB_MAGCHAR;
- /* collapse adjacent stars to one,
- * to avoid exponential behavior
- */
- if (bufnext == patbuf || bufnext[-1] != M_ALL)
- *bufnext++ = M_ALL;
- break;
- default:
- *bufnext++ = CHAR(c);
- break;
- }
- }
- *bufnext = EOS;
-#ifdef DEBUG
- qprintf("glob0:", patbuf);
-#endif
-
- if ((err = glob1(patbuf, pglob)) != 0)
- return(err);
-
- /*
- * If there was no match we are going to append the pattern
- * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified
- * and the pattern did not contain any magic characters
- * GLOB_NOMAGIC is there just for compatibility with csh.
- */
- if (pglob->gl_pathc == oldpathc &&
- ((pglob->gl_flags & GLOB_NOCHECK) ||
- ((pglob->gl_flags & GLOB_NOMAGIC) &&
- !(pglob->gl_flags & GLOB_MAGCHAR))))
- return(globextend(pattern, pglob));
- else if (!(pglob->gl_flags & GLOB_NOSORT))
- qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc,
- pglob->gl_pathc - oldpathc, sizeof(char *), compare);
- return(0);
-}
-
-static int
-compare(p, q)
- const void *p, *q;
-{
- return(strcmp(*(char **)p, *(char **)q));
-}
-
-static int
-glob1(pattern, pglob)
- Char *pattern;
- glob_t *pglob;
-{
- Char pathbuf[MAXPATHLEN+1];
-
- /* A null pathname is invalid -- POSIX 1003.1 sect. 2.4. */
- if (*pattern == EOS)
- return(0);
- return(glob2(pathbuf, pathbuf, pattern, pglob));
-}
-
-/*
- * The functions glob2 and glob3 are mutually recursive; there is one level
- * of recursion for each segment in the pattern that contains one or more
- * meta characters.
- */
-static int
-glob2(pathbuf, pathend, pattern, pglob)
- Char *pathbuf, *pathend, *pattern;
- glob_t *pglob;
-{
- struct stat sb;
- Char *p, *q;
- int anymeta;
-
- /*
- * Loop over pattern segments until end of pattern or until
- * segment with meta character found.
- */
- for (anymeta = 0;;) {
- if (*pattern == EOS) { /* End of pattern? */
- *pathend = EOS;
- if (g_lstat(pathbuf, &sb, pglob))
- return(0);
-
- if (((pglob->gl_flags & GLOB_MARK) &&
- pathend[-1] != SEP) && (S_ISDIR(sb.st_mode)
-#ifdef S_ISLNK
- || (S_ISLNK(sb.st_mode) &&
-#else
- || ( (sb.st_mode&S_IFLNK) &&
-#endif
- (g_stat(pathbuf, &sb, pglob) == 0) &&
- S_ISDIR(sb.st_mode)))) {
- *pathend++ = SEP;
- *pathend = EOS;
- }
- ++pglob->gl_matchc;
- return(globextend(pathbuf, pglob));
- }
-
- /* Find end of next segment, copy tentatively to pathend. */
- q = pathend;
- p = pattern;
- while (*p != EOS && *p != SEP) {
- if (ismeta(*p))
- anymeta = 1;
- *q++ = *p++;
- }
-
- if (!anymeta) { /* No expansion, do next segment. */
- pathend = q;
- pattern = p;
- while (*pattern == SEP)
- *pathend++ = *pattern++;
- } else /* Need expansion, recurse. */
- return(glob3(pathbuf, pathend, pattern, p, pglob));
- }
- /* NOTREACHED */
-}
-
-static int
-glob3(pathbuf, pathend, pattern, restpattern, pglob)
- Char *pathbuf, *pathend, *pattern, *restpattern;
- glob_t *pglob;
-{
- register struct dirent *dp;
- DIR *dirp;
- int err;
- char buf[MAXPATHLEN];
-
- /*
- * The readdirfunc declaration can't be prototyped, because it is
- * assigned, below, to two functions which are prototyped in glob.h
- * and dirent.h as taking pointers to differently typed opaque
- * structures.
- */
- struct dirent *(*readdirfunc)();
-
- *pathend = EOS;
- errno = 0;
-
- if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
- /* TODO: don't call for ENOENT or ENOTDIR? */
- if (pglob->gl_errfunc) {
- g_Ctoc(pathbuf, buf);
- if (pglob->gl_errfunc(buf, errno) ||
- pglob->gl_flags & GLOB_ERR)
- return (GLOB_ABEND);
- }
- return(0);
- }
-
- err = 0;
-
- /* Search directory for matching names. */
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- readdirfunc = pglob->gl_readdir;
- else
- readdirfunc = readdir;
- while ((dp = (*readdirfunc)(dirp))) {
- register u_char *sc;
- register Char *dc;
-
- /* Initial DOT must be matched literally. */
- if (dp->d_name[0] == DOT && *pattern != DOT)
- continue;
- for (sc = (u_char *) dp->d_name, dc = pathend;
- (*dc++ = *sc++) != EOS;)
- continue;
- if (!match(pathend, pattern, restpattern)) {
- *pathend = EOS;
- continue;
- }
- err = glob2(pathbuf, --dc, restpattern, pglob);
- if (err)
- break;
- }
-
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- (*pglob->gl_closedir)(dirp);
- else
- closedir(dirp);
- return(err);
-}
-
-
-/*
- * Extend the gl_pathv member of a glob_t structure to accomodate a new item,
- * add the new item, and update gl_pathc.
- *
- * This assumes the BSD realloc, which only copies the block when its size
- * crosses a power-of-two boundary; for v7 realloc, this would cause quadratic
- * behavior.
- *
- * Return 0 if new item added, error code if memory couldn't be allocated.
- *
- * Invariant of the glob_t structure:
- * Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and
- * gl_pathv points to (gl_offs + gl_pathc + 1) items.
- */
-static int
-globextend(path, pglob)
- const Char *path;
- glob_t *pglob;
-{
- register char **pathv;
- register int i;
- u_int newsize;
- char *copy;
- const Char *p;
-
- newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
- pathv = pglob->gl_pathv ?
- realloc((char *)pglob->gl_pathv, newsize) :
- malloc(newsize);
- if (pathv == NULL)
- return(GLOB_NOSPACE);
-
- if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
- /* first time around -- clear initial gl_offs items */
- pathv += pglob->gl_offs;
- for (i = pglob->gl_offs; --i >= 0; )
- *--pathv = NULL;
- }
- pglob->gl_pathv = pathv;
-
- for (p = path; *p++;)
- continue;
- if ((copy = malloc(p - path)) != NULL) {
- g_Ctoc(path, copy);
- pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
- }
- pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
- return(copy == NULL ? GLOB_NOSPACE : 0);
-}
-
-
-/*
- * pattern matching function for filenames. Each occurrence of the *
- * pattern causes a recursion level.
- */
-static int
-match(name, pat, patend)
- register Char *name, *pat, *patend;
-{
- int ok, negate_range;
- Char c, k;
-
- while (pat < patend) {
- c = *pat++;
- switch (c & M_MASK) {
- case M_ALL:
- if (pat == patend)
- return(1);
- do
- if (match(name, pat, patend))
- return(1);
- while (*name++ != EOS);
- return(0);
- case M_ONE:
- if (*name++ == EOS)
- return(0);
- break;
- case M_SET:
- ok = 0;
- if ((k = *name++) == EOS)
- return(0);
- if ((negate_range = ((*pat & M_MASK) == M_NOT)) != EOS)
- ++pat;
- while (((c = *pat++) & M_MASK) != M_END)
- if ((*pat & M_MASK) == M_RNG) {
- if (c <= k && k <= pat[1])
- ok = 1;
- pat += 2;
- } else if (c == k)
- ok = 1;
- if (ok == negate_range)
- return(0);
- break;
- default:
- if (*name++ != c)
- return(0);
- break;
- }
- }
- return(*name == EOS);
-}
-
-/* Free allocated data belonging to a glob_t structure. */
-void
-globfree(pglob)
- glob_t *pglob;
-{
- register int i;
- register char **pp;
-
- if (pglob->gl_pathv != NULL) {
- pp = pglob->gl_pathv + pglob->gl_offs;
- for (i = pglob->gl_pathc; i--; ++pp)
- if (*pp)
- free(*pp);
- free(pglob->gl_pathv);
- }
-}
-
-static DIR *
-g_opendir(str, pglob)
- register Char *str;
- glob_t *pglob;
-{
- char buf[MAXPATHLEN];
-
- if (!*str)
- strcpy(buf, ".");
- else
- g_Ctoc(str, buf);
-
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- return((*pglob->gl_opendir)(buf));
-
- return(opendir(buf));
-}
-
-static int
-g_lstat(fn, sb, pglob)
- register Char *fn;
- struct stat *sb;
- glob_t *pglob;
-{
- char buf[MAXPATHLEN];
-
- g_Ctoc(fn, buf);
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- return((*pglob->gl_lstat)(buf, sb));
- return(lstat(buf, sb));
-}
-
-static int
-g_stat(fn, sb, pglob)
- register Char *fn;
- struct stat *sb;
- glob_t *pglob;
-{
- char buf[MAXPATHLEN];
-
- g_Ctoc(fn, buf);
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- return((*pglob->gl_stat)(buf, sb));
- return(stat(buf, sb));
-}
-
-static Char *
-g_strchr(str, ch)
- Char *str;
- int ch;
-{
- do {
- if (*str == ch)
- return (str);
- } while (*str++);
- return (NULL);
-}
-
-#ifdef notdef
-static Char *
-g_strcat(dst, src)
- Char *dst;
- const Char* src;
-{
- Char *sdst = dst;
-
- while (*dst++)
- continue;
- --dst;
- while((*dst++ = *src++) != EOS)
- continue;
-
- return (sdst);
-}
-#endif
-
-static void
-g_Ctoc(str, buf)
- register const Char *str;
- char *buf;
-{
- register char *dc;
-
- for (dc = buf; (*dc++ = *str++) != EOS;)
- continue;
-}
-
-#ifdef DEBUG
-static void
-qprintf(str, s)
- const char *str;
- register Char *s;
-{
- register Char *p;
-
- (void)printf("%s:\n", str);
- for (p = s; *p; p++)
- (void)printf("%c", CHAR(*p));
- (void)printf("\n");
- for (p = s; *p; p++)
- (void)printf("%c", *p & M_PROTECT ? '"' : ' ');
- (void)printf("\n");
- for (p = s; *p; p++)
- (void)printf("%c", ismeta(*p) ? '_' : ' ');
- (void)printf("\n");
-}
-#endif
diff --git a/lib/libftp/utils/glob.h b/lib/libftp/utils/glob.h
deleted file mode 100644
index b0432b7..0000000
--- a/lib/libftp/utils/glob.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Guido van Rossum.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- *
- * @(#)glob.h 8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _GLOB_H_
-#define _GLOB_H_
-
-
-#include <cdefs.h>
-
-struct stat;
-typedef struct {
- int gl_pathc; /* Count of total paths so far. */
- int gl_matchc; /* Count of paths matching pattern. */
- int gl_offs; /* Reserved at beginning of gl_pathv. */
- int gl_flags; /* Copy of flags parameter to glob. */
- char **gl_pathv; /* List of paths matching pattern. */
- /* Copy of errfunc parameter to glob. */
- int (*gl_errfunc) __P((const char *, int));
-
- /*
- * Alternate filesystem access methods for glob; replacement
- * versions of closedir(3), readdir(3), opendir(3), stat(2)
- * and lstat(2).
- */
- void (*gl_closedir) __P((void *));
- struct dirent *(*gl_readdir) __P((void *));
- void *(*gl_opendir) __P((const char *));
- int (*gl_lstat) __P((const char *, struct stat *));
- int (*gl_stat) __P((const char *, struct stat *));
-} glob_t;
-
-#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
-#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */
-#define GLOB_ERR 0x0004 /* Return on error. */
-#define GLOB_MARK 0x0008 /* Append / to matching directories. */
-#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */
-#define GLOB_NOSORT 0x0020 /* Don't sort. */
-
-#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
-#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
-#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
-#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */
-#define GLOB_QUOTE 0x0400 /* Quote special chars with \. */
-#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
-
-#define GLOB_NOSPACE (-1) /* Malloc call failed. */
-#define GLOB_ABEND (-2) /* Unignored error. */
-
-__BEGIN_DECLS
-int glob __P((const char *, int, int (*)(const char *, int), glob_t *));
-void globfree __P((glob_t *));
-__END_DECLS
-
-#endif /* !_GLOB_H_ */
diff --git a/lib/libftp/utils/mirror.c b/lib/libftp/utils/mirror.c
deleted file mode 100644
index a0d329c..0000000
--- a/lib/libftp/utils/mirror.c
+++ /dev/null
@@ -1,92 +0,0 @@
-
-/* Mirror directrory structure to another host */
-
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/dir.h>
-#include <sys/stat.h>
-#include <syslog.h>
-#include <FtpLibrary.h>
-
-/* Usage: mirror <local_dir> <host> <user> <passwd> <remote_dir> */
-FTP *ftp;
-
-main(int a,char **b)
-{
-
-#define LOCAL_DIR b[1]
-#define HOST b[2]
-#define USER b[3]
-#define PASSWD b[4]
-#define REMOTE_DIR b[5]
-
- if ( a < 5 )
- quit("Usage: mirror <local_dir> <host> <user> <passwd> <remote_dir>");
-
-
- FtplibDebug(yes);
- FtpLogin(&ftp,HOST,USER,PASSWD,NULL);
- FtpChdir(ftp,REMOTE_DIR);
- FtpBinary(ftp);
- doit(LOCAL_DIR);
- exit(0);
-}
-
-doit(char *dirname)
-{
- DIR *dp;
- struct direct *de;
- char n[256],fn[256];
- struct stat st;
-
-
- if ( (dp=opendir(dirname)) == NULL )
- {
- log(dirname);
- return;
- }
-
- while ( (de = readdir(dp)) != NULL )
- {
- if ( de -> d_name[0] == '.' )
- continue;
-
- sprintf(fn,"%s/%s",dirname,de->d_name);
-
- if ( stat(fn,&st) != 0 ) {
- log(fn);
- continue;
- }
-
- if ( S_ISDIR (st.st_mode) )
- {
- FtpCommand(ftp,"MKD %s",fn,0,EOF); /* Ignore errors (0,EOF) */
- doit(fn);
- continue;
- }
-
- if ( st.st_size != FtpSize(ftp,fn))
-
- FtpPut(ftp,fn,fn);
- }
-
- closedir(dp);
-
-}
-
-
-
-quit(char *s)
-{
- log(s);
- exit(1);
-}
-
-log(char *s)
-{
- perror(s);
-}
-
-
-
diff --git a/lib/libftp/utils/readline.c b/lib/libftp/utils/readline.c
deleted file mode 100644
index e019bc1..0000000
--- a/lib/libftp/utils/readline.c
+++ /dev/null
@@ -1,961 +0,0 @@
-#ifndef lint
-static char *RCSid = "$Id: readline.c,v 1.1.1.1 1995/04/25 15:05:09 jkh Exp $";
-#endif
-
-
-/* GNUPLOT - readline.c */
-/*
- * Copyright (C) 1986 - 1993 Thomas Williams, Colin Kelley
- *
- * Permission to use, copy, and distribute this software and its
- * documentation for any purpose with or 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.
- *
- * Permission to modify the software is granted, but not the right to
- * distribute the modified code. Modifications are to be distributed
- * as patches to released version.
- *
- * This software is provided "as is" without express or implied warranty.
- *
- *
- * AUTHORS
- *
- * Original Software:
- * Tom Tkacik
- *
- * Msdos port and some enhancements:
- * Gershon Elber and many others.
- *
- * There is a mailing list for gnuplot users. Note, however, that the
- * newsgroup
- * comp.graphics.gnuplot
- * is identical to the mailing list (they
- * both carry the same set of messages). We prefer that you read the
- * messages through that newsgroup, to subscribing to the mailing list.
- * (If you can read that newsgroup, and are already on the mailing list,
- * please send a message info-gnuplot-request@dartmouth.edu, asking to be
- * removed from the mailing list.)
- *
- * The address for mailing to list members is
- * info-gnuplot@dartmouth.edu
- * and for mailing administrative requests is
- * info-gnuplot-request@dartmouth.edu
- * The mailing list for bug reports is
- * bug-gnuplot@dartmouth.edu
- * The list of those interested in beta-test versions is
- * info-gnuplot-beta@dartmouth.edu
- */
-
-#ifdef READLINE
-#ifdef ATARI
-#include "plot.h"
-#endif
-#ifdef _WINDOWS
-#define _Windows
-#endif
-
-/* a small portable version of GNU's readline */
-/* this is not the BASH or GNU EMACS version of READLINE due to Copyleft
- restrictions */
-/* do not need any terminal capabilities except backspace, */
-/* and space overwrites a character */
-
-/* NANO-EMACS line editing facility */
-/* printable characters print as themselves (insert not overwrite) */
-/* ^A moves to the beginning of the line */
-/* ^B moves back a single character */
-/* ^E moves to the end of the line */
-/* ^F moves forward a single character */
-/* ^K kills from current position to the end of line */
-/* ^P moves back through history */
-/* ^N moves forward through history */
-/* ^H and DEL delete the previous character */
-/* ^D deletes the current character, or EOF if line is empty */
-/* ^L/^R redraw line in case it gets trashed */
-/* ^U kills the entire line */
-/* ^W kills last word */
-/* LF and CR return the entire line regardless of the cursor postition */
-/* EOF with an empty line returns (char *)NULL */
-
-/* all other characters are ignored */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <signal.h>
-
-#if !defined(MSDOS) && !defined(ATARI) && !defined(_Windows) && !defined(DOS386)
-
-/*
- * Set up structures using the proper include file
- */
-#if defined(_IBMR2) || defined(alliant)
-#define SGTTY
-#endif
-
-/* submitted by Francois.Dagorn@cicb.fr */
-#ifdef SGTTY
-#include <sgtty.h>
-static struct sgttyb orig_termio, rl_termio;
-/* define terminal control characters */
-static struct tchars s_tchars;
-#define VERASE 0
-#define VEOF 1
-#define VKILL 2
-#ifdef TIOCGLTC /* available only with the 'new' line discipline */
-static struct ltchars s_ltchars;
-#define VWERASE 3
-#define VREPRINT 4
-#define VSUSP 5
-#endif /* TIOCGLTC */
-#define NCCS 6
-
-#else /* SGTTY */
-
-/* SIGTSTP defines job control */
-/* if there is job control then we need termios.h instead of termio.h */
-/* (Are there any systems with job control that use termio.h? I hope not.) */
-#ifdef SIGTSTP
-#define TERMIOS
-#include <termios.h>
-/* Added by Robert Eckardt, RobertE@beta.TP2.Ruhr-Uni-Bochum.de */
-#ifdef ISC22
-#ifndef ONOCR /* taken from sys/termio.h */
-#define ONOCR 0000020 /* true at least for ISC 2.2 */
-#endif
-#ifndef IUCLC
-#define IUCLC 0001000
-#endif
-#endif /* ISC22 */
-
-static struct termios orig_termio, rl_termio;
-#else
-#include <termio.h>
-static struct termio orig_termio, rl_termio;
-/* termio defines NCC instead of NCCS */
-#define NCCS NCC
-#endif /* SIGTSTP */
-#endif /* SGTTY */
-
-/* ULTRIX defines VRPRNT instead of VREPRINT */
-#ifdef VRPRNT
-#define VREPRINT VRPRNT
-#endif
-
-/* define characters to use with our input character handler */
-static char term_chars[NCCS];
-
-static int term_set = 0; /* =1 if rl_termio set */
-
-#define special_getc() ansi_getc()
-static char ansi_getc();
-
-#else /* !MSDOS && !ATARI && !_Windows */
-
-#ifdef _Windows
-#include <windows.h>
-#include "win/wtext.h"
-#include "win/wgnuplib.h"
-extern TW textwin;
-#define TEXTUSER 0xf1
-#define TEXTGNUPLOT 0xf0
-#define special_getc() msdos_getch()
-static char msdos_getch();
-#endif
-
-#if defined(MSDOS) || defined(DOS386)
-/* MSDOS specific stuff */
-#ifdef DJGPP
-#include <pc.h>
-#endif
-#ifdef __EMX__
-#include <conio.h>
-#endif
-#define special_getc() msdos_getch()
-static char msdos_getch();
-#endif /* MSDOS */
-
-#ifdef ATARI
-#include <stdlib.h>
-#ifdef __PUREC__
-#include <tos.h>
-#else
-#include <osbind.h>
-#endif
-#define special_getc() tos_getch()
-static char tos_getch();
-#endif
-
-#endif /* !MSDOS && !ATARI && !_Windows */
-
-#if !defined(ATARI)
-/* is it <string.h> or <strings.h>? just declare what we need */
-extern int strlen();
-extern char *strcpy();
-#endif
-#define alloc malloc
-extern char *alloc(); /* we'll use the safe malloc from misc.c */
-
-#define MAXBUF 1024
-#define BACKSPACE 0x08 /* ^H */
-#define SPACE ' '
-
-struct hist {
- char *line;
- struct hist *prev;
- struct hist *next;
-};
-
-static struct hist *history = NULL; /* no history yet */
-static struct hist *cur_entry = NULL;
-
-static char cur_line[MAXBUF]; /* current contents of the line */
-static int cur_pos = 0; /* current position of the cursor */
-static int max_pos = 0; /* maximum character position */
-
-
-void add_history();
-static void fix_line();
-static void redraw_line();
-static void clear_line();
-static void clear_eoline();
-static void copy_line();
-static void set_termio();
-void reset_termio();
-
-/* user_putc and user_puts should be used in the place of
- * fputc(ch,stderr) and fputs(str,stderr) for all output
- * of user typed characters. This allows MS-Windows to
- * display user input in a different color. */
-int
-user_putc(ch)
-int ch;
-{
- int rv;
-#ifdef _Windows
- TextAttr(&textwin,TEXTUSER);
-#endif
- rv = fputc(ch, stderr);
-#ifdef _Windows
- TextAttr(&textwin,TEXTGNUPLOT);
-#endif
- return rv;
-}
-
-int
-user_puts(str)
-char *str;
-{
- int rv;
-#ifdef _Windows
- TextAttr(&textwin,TEXTUSER);
-#endif
- rv = fputs(str, stderr);
-#ifdef _Windows
- TextAttr(&textwin,TEXTGNUPLOT);
-#endif
- return rv;
-}
-
-/* This function provides a centralized non-destructive backspace capability */
-/* M. Castro */
-
-backspace()
-{
- user_putc(BACKSPACE);
-}
-
-char *
-readline(prompt)
-char *prompt;
-{
-
- unsigned char cur_char;
- char *new_line;
- /* unsigned char *new_line; */
-
- /* set the termio so we can do our own input processing */
- set_termio();
-
- /* print the prompt */
- fputs(prompt, stderr);
- cur_line[0] = '\0';
- cur_pos = 0;
- max_pos = 0;
- cur_entry = NULL;
-
- /* get characters */
- for(;;) {
- cur_char = special_getc();
-#ifdef OS2
- /* for emx: remap scan codes for cursor keys */
- if( cur_char == 0 ) {
- cur_char = getc(stdin);
- switch( cur_char){
- case 75: /* left, map to ^B */
- cur_char=2;
- break ;
- case 77: /* right, map to ^F */
- cur_char=6;
- break ;
- case 115: /* ctrl left */
- case 71: /* home, map to ^A */
- cur_char=1;
- break ;
- case 116: /* ctrl right */
- case 79: /* end, map to ^E */
- cur_char=5;
- break ;
- case 72: /* up, map to ^P */
- cur_char=16;
- break ;
- case 80: /* down, map to ^N */
- cur_char=14;
- break ;
- case 83: /* delete, map to ^D */
- cur_char=4;
- break ;
- default: /* ignore */
- cur_char=0;
- continue ;
- }
- }
-#endif /*OS2*/
- if((isprint(cur_char)
-#if defined(ATARI) || defined(_Windows) || defined(MSDOS) || defined(DOS386)
- /* this should be used for all 8bit ASCII machines, I guess */
- || ((unsigned char)cur_char > 0x7f)
-#endif
- )&& max_pos<MAXBUF-1) {
- int i;
- for(i=max_pos; i>cur_pos; i--) {
- cur_line[i] = cur_line[i-1];
- }
- user_putc(cur_char);
- cur_line[cur_pos] = cur_char;
- cur_pos += 1;
- max_pos += 1;
- if (cur_pos < max_pos)
- fix_line();
- cur_line[max_pos] = '\0';
-
- /* else interpret unix terminal driver characters */
-#ifdef VERASE
- } else if(cur_char == term_chars[VERASE] ){ /* DEL? */
- if(cur_pos > 0) {
- int i;
- cur_pos -= 1;
- backspace();
- for(i=cur_pos; i<max_pos; i++)
- cur_line[i] = cur_line[i+1];
- max_pos -= 1;
- fix_line();
- }
-#endif /* VERASE */
-#ifdef VEOF
- } else if(cur_char == term_chars[VEOF] ){ /* ^D? */
- if(max_pos == 0) {
- reset_termio();
- return((char *)NULL);
- }
- if((cur_pos < max_pos)&&(cur_char == 004)) { /* ^D */
- int i;
- for(i=cur_pos; i<max_pos; i++)
- cur_line[i] = cur_line[i+1];
- max_pos -= 1;
- fix_line();
- }
-#endif /* VEOF */
-#ifdef VKILL
- } else if(cur_char == term_chars[VKILL] ){ /* ^U? */
- clear_line(prompt);
-#endif /* VKILL */
-#ifdef VWERASE
- } else if(cur_char == term_chars[VWERASE] ){ /* ^W? */
- while((cur_pos > 0) &&
- (cur_line[cur_pos-1] == SPACE)) {
- cur_pos -= 1;
- backspace();
- }
- while((cur_pos > 0) &&
- (cur_line[cur_pos-1] != SPACE)) {
- cur_pos -= 1;
- backspace();
- }
- clear_eoline();
- max_pos = cur_pos;
-#endif /* VWERASE */
-#ifdef VREPRINT
- } else if(cur_char == term_chars[VREPRINT] ){ /* ^R? */
- putc('\n',stderr); /* go to a fresh line */
- redraw_line(prompt);
-#endif /* VREPRINT */
-#ifdef VSUSP
- } else if(cur_char == term_chars[VSUSP]) {
- reset_termio();
- kill(0, SIGTSTP);
-
- /* process stops here */
-
- set_termio();
- /* print the prompt */
- redraw_line(prompt);
-#endif /* VSUSP */
- } else {
- /* do normal editing commands */
- /* some of these are also done above */
- int i;
- switch(cur_char) {
- case EOF:
- reset_termio();
- return((char *)NULL);
- case 001: /* ^A */
- while(cur_pos > 0) {
- cur_pos -= 1;
- backspace();
- }
- break;
- case 002: /* ^B */
- if(cur_pos > 0) {
- cur_pos -= 1;
- backspace();
- }
- break;
- case 005: /* ^E */
- while(cur_pos < max_pos) {
- user_putc(cur_line[cur_pos]);
- cur_pos += 1;
- }
- break;
- case 006: /* ^F */
- if(cur_pos < max_pos) {
- user_putc(cur_line[cur_pos]);
- cur_pos += 1;
- }
- break;
- case 013: /* ^K */
- clear_eoline();
- max_pos = cur_pos;
- break;
- case 020: /* ^P */
- if(history != NULL) {
- if(cur_entry == NULL) {
- cur_entry = history;
- clear_line(prompt);
- copy_line(cur_entry->line);
- } else if(cur_entry->prev != NULL) {
- cur_entry = cur_entry->prev;
- clear_line(prompt);
- copy_line(cur_entry->line);
- }
- }
- break;
- case 016: /* ^N */
- if(cur_entry != NULL) {
- cur_entry = cur_entry->next;
- clear_line(prompt);
- if(cur_entry != NULL)
- copy_line(cur_entry->line);
- else
- cur_pos = max_pos = 0;
- }
- break;
- case 014: /* ^L */
- case 022: /* ^R */
- putc('\n',stderr); /* go to a fresh line */
- redraw_line(prompt);
- break;
- case 0177: /* DEL */
- case 010: /* ^H */
- if(cur_pos > 0) {
- cur_pos -= 1;
- backspace();
- for(i=cur_pos; i<max_pos; i++)
- cur_line[i] = cur_line[i+1];
- max_pos -= 1;
- fix_line();
- }
- break;
- case 004: /* ^D */
- if(max_pos == 0) {
- reset_termio();
- return((char *)NULL);
- }
- if(cur_pos < max_pos) {
- for(i=cur_pos; i<max_pos; i++)
- cur_line[i] = cur_line[i+1];
- max_pos -= 1;
- fix_line();
- }
- break;
- case 025: /* ^U */
- clear_line(prompt);
- break;
- case 027: /* ^W */
- while((cur_pos > 0) &&
- (cur_line[cur_pos-1] == SPACE)) {
- cur_pos -= 1;
- backspace();
- }
- while((cur_pos > 0) &&
- (cur_line[cur_pos-1] != SPACE)) {
- cur_pos -= 1;
- backspace();
- }
- clear_eoline();
- max_pos = cur_pos;
- break;
- case '\n': /* ^J */
- case '\r': /* ^M */
- cur_line[max_pos+1] = '\0';
- putc('\n', stderr);
- new_line = (char *)alloc((unsigned long) (strlen(cur_line)+1), "history");
- strcpy(new_line,cur_line);
- reset_termio();
- return(new_line);
- default:
- break;
- }
- }
- }
-}
-
-/* fix up the line from cur_pos to max_pos */
-/* do not need any terminal capabilities except backspace, */
-/* and space overwrites a character */
-static void
-fix_line()
-{
- int i;
-
- /* write tail of string */
- for(i=cur_pos; i<max_pos; i++)
- user_putc(cur_line[i]);
-
- /* write a space at the end of the line in case we deleted one */
- user_putc(SPACE);
-
- /* backup to original position */
- for(i=max_pos+1; i>cur_pos; i--)
- backspace();
-
-}
-
-/* redraw the entire line, putting the cursor where it belongs */
-static void
-redraw_line(prompt)
-char *prompt;
-{
- int i;
-
- fputs(prompt, stderr);
- user_puts(cur_line);
-
- /* put the cursor where it belongs */
- for(i=max_pos; i>cur_pos; i--)
- backspace();
-}
-
-/* clear cur_line and the screen line */
-static void
-clear_line(prompt)
-char *prompt;
-{
- int i;
- for(i=0; i<max_pos; i++)
- cur_line[i] = '\0';
-
- for(i=cur_pos; i>0; i--)
- backspace();
-
- for(i=0; i<max_pos; i++)
- putc(SPACE, stderr);
-
- putc('\r', stderr);
- fputs(prompt, stderr);
-
- cur_pos = 0;
- max_pos = 0;
-}
-
-/* clear to end of line and the screen end of line */
-static void
-clear_eoline(prompt)
-char *prompt;
-{
- int i;
- for(i=cur_pos; i<max_pos; i++)
- cur_line[i] = '\0';
-
- for(i=cur_pos; i<max_pos; i++)
- putc(SPACE, stderr);
- for(i=cur_pos; i<max_pos; i++)
- backspace();
-}
-
-/* copy line to cur_line, draw it and set cur_pos and max_pos */
-static void
-copy_line(line)
-char *line;
-{
- strcpy(cur_line, line);
- user_puts(cur_line);
- cur_pos = max_pos = strlen(cur_line);
-}
-
-/* add line to the history */
-void
-add_history(line)
-char *line;
-{
- struct hist *entry;
- entry = (struct hist *)alloc((unsigned long)sizeof(struct hist),"history");
- entry->line = alloc((unsigned long)(strlen(line)+1),"history");
- strcpy(entry->line, line);
-
- entry->prev = history;
- entry->next = NULL;
- if(history != NULL) {
- history->next = entry;
- }
- history = entry;
-}
-
-
-/* Convert ANSI arrow keys to control characters */
-static char
-ansi_getc()
-{
- char c = getc(stdin);
- if (c == 033) {
- c = getc(stdin); /* check for CSI */
- if (c == '[') {
- c = getc(stdin); /* get command character */
- switch (c) {
- case 'D': /* left arrow key */
- c = 002;
- break;
- case 'C': /* right arrow key */
- c = 006;
- break;
- case 'A': /* up arrow key */
- c = 020;
- break;
- case 'B': /* down arrow key */
- c = 016;
- break;
- }
- }
- }
- return c;
-}
-
-#if defined(MSDOS) || defined(_Windows) || defined(DOS386)
-
-/* Convert Arrow keystrokes to Control characters: */
-static char
-msdos_getch()
-{
-#ifdef DJGPP
- char c;
- int ch = getkey();
- c = (ch & 0xff00) ? 0 : ch & 0xff;
-#else
- char c = getch();
-#endif
-
- if (c == 0) {
-#ifdef DJGPP
- c = ch & 0xff;
-#else
- c = getch(); /* Get the extended code. */
-#endif
- switch (c) {
- case 75: /* Left Arrow. */
- c = 002;
- break;
- case 77: /* Right Arrow. */
- c = 006;
- break;
- case 72: /* Up Arrow. */
- c = 020;
- break;
- case 80: /* Down Arrow. */
- c = 016;
- break;
- case 115: /* Ctl Left Arrow. */
- case 71: /* Home */
- c = 001;
- break;
- case 116: /* Ctl Right Arrow. */
- case 79: /* End */
- c = 005;
- break;
- case 83: /* Delete */
- c = 004;
- break;
- default:
- c = 0;
- break;
- }
- }
- else if (c == 033) { /* ESC */
- c = 025;
- }
-
-
- return c;
-}
-
-#endif /* MSDOS */
-
-#ifdef ATARI
-
-/* Convert Arrow keystrokes to Control characters: TOS version */
-
-/* the volatile could be necessary to keep gcc from reordering
- the two Super calls
-*/
-#define CONTERM ((/*volatile*/ char *)0x484L)
-
-static void
-remove_conterm()
-{
- void *ssp=(void*)Super(0L);
- *CONTERM &= ~0x8;
- Super(ssp);
-}
-
-static char
-tos_getch()
-{
- long rawkey;
- char c;
- int scan_code;
- void *ssp;
- static int init = 1;
- static int in_help = 0;
-
- if (in_help) {
- switch(in_help) {
- case 1:
- case 5: in_help++; return 'e';
- case 2:
- case 6: in_help++; return 'l';
- case 3:
- case 7: in_help++; return 'p';
- case 4: in_help = 0; return 0x0d;
- case 8: in_help = 0; return ' ';
- }
- }
-
- if (init) {
- ssp = (void*)Super(0L);
- if( !(*CONTERM & 0x8) ) {
- *CONTERM |= 0x8;
- } else {
- init=0;
- }
- (void)Super(ssp);
- if( init ) {
- atexit(remove_conterm);
- init = 0;
- }
- }
-
- (void)Cursconf(1, 0); /* cursor on */
- rawkey = Cnecin();
- c = (char)rawkey;
- scan_code= ((int)(rawkey>>16)) & 0xff; /* get the scancode */
- if( rawkey&0x07000000 ) scan_code |= 0x80; /* shift or control */
-
- switch (scan_code) {
- case 0x62: /* HELP */
- if (max_pos==0) {
- in_help = 1;
- return 'h';
- } else {
- return 0;
- }
- case 0xe2: /* shift HELP */
- if (max_pos==0) {
- in_help = 5;
- return 'h';
- } else {
- return 0;
- }
- case 0x48: /* Up Arrow */
- return 0x10; /* ^P */
- case 0x50: /* Down Arrow */
- return 0x0e; /* ^N */
- case 0x4b: /* Left Arrow */
- return 0x02; /* ^B */
- case 0x4d: /* Right Arrow */
- return 0x06; /* ^F */
- case 0xcb: /* Shift Left Arrow */
- case 0xf3: /* Ctrl Left Arrow (TOS-bug ?) */
- case 0x47: /* Home */
- return 0x01; /* ^A */
- case 0xcd: /* Shift Right Arrow */
- case 0xf4: /* Ctrl Right Arrow (TOS-bug ?) */
- case 0xc7: /* Shift Home */
- case 0xf7: /* Crtl Home */
- return 0x05; /* ^E */
- case 0x61: /* Undo - redraw line */
- return 0x0c; /* ^L */
- default:
- if (c == 0x1b) return 0x15; /* ESC becomes ^U */
- if (c == 0x7f) return 0x04; /* Del becomes ^D */
- break;
- }
-
- return c;
-}
-
-#endif /* ATARI */
-
- /* set termio so we can do our own input processing */
-static void
-set_termio()
-{
-#if !defined(MSDOS) && !defined(ATARI) && !defined(_Windows) && !defined(DOS386)
-/* set termio so we can do our own input processing */
-/* and save the old terminal modes so we can reset them later */
- if(term_set == 0) {
- /*
- * Get terminal modes.
- */
-#ifdef SGTTY
- ioctl(0, TIOCGETP, &orig_termio);
-#else /* SGTTY */
-#ifdef TERMIOS
-#ifdef TCGETS
- ioctl(0, TCGETS, &orig_termio);
-#else
- tcgetattr(0, &orig_termio);
-#endif /* TCGETS */
-#else
- ioctl(0, TCGETA, &orig_termio);
-#endif /* TERMIOS */
-#endif /* SGTTY */
-
- /*
- * Save terminal modes
- */
- rl_termio = orig_termio;
-
- /*
- * Set the modes to the way we want them
- * and save our input special characters
- */
-#ifdef SGTTY
- rl_termio.sg_flags |= CBREAK;
- rl_termio.sg_flags &= ~(ECHO|XTABS);
- ioctl(0, TIOCSETN, &rl_termio);
-
- ioctl(0, TIOCGETC, &s_tchars);
- term_chars[VERASE] = orig_termio.sg_erase;
- term_chars[VEOF] = s_tchars.t_eofc;
- term_chars[VKILL] = orig_termio.sg_kill;
-#ifdef TIOCGLTC
- ioctl(0, TIOCGLTC, &s_ltchars);
- term_chars[VWERASE] = s_ltchars.t_werasc;
- term_chars[VREPRINT] = s_ltchars.t_rprntc;
- term_chars[VSUSP] = s_ltchars.t_suspc;
-
- /* disable suspending process on ^Z */
- s_ltchars.t_suspc = 0;
- ioctl(0, TIOCSLTC, &s_ltchars);
-#endif /* TIOCGLTC */
-#else /* SGTTY */
-#ifdef IUCLC
- rl_termio.c_iflag &= ~(BRKINT|PARMRK|INPCK|IUCLC|IXON|IXOFF);
-#else
- rl_termio.c_iflag &= ~(BRKINT|PARMRK|INPCK|IXON|IXOFF);
-#endif
- rl_termio.c_iflag |= (IGNBRK|IGNPAR);
-
- /* rl_termio.c_oflag &= ~(ONOCR); Costas Sphocleous Irvine,CA */
-
- rl_termio.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|NOFLSH);
-#ifdef OS2
- /* for emx: remove default terminal processing */
- rl_termio.c_lflag &= ~(IDEFAULT);
-#endif /* OS2 */
- rl_termio.c_lflag |= (ISIG);
- rl_termio.c_cc[VMIN] = 1;
- rl_termio.c_cc[VTIME] = 0;
-
-#ifndef VWERASE
-#define VWERASE 3
-#endif
- term_chars[VERASE] = orig_termio.c_cc[VERASE];
- term_chars[VEOF] = orig_termio.c_cc[VEOF];
- term_chars[VKILL] = orig_termio.c_cc[VKILL];
-#ifdef TERMIOS
- term_chars[VWERASE] = orig_termio.c_cc[VWERASE];
-#ifdef VREPRINT
- term_chars[VREPRINT] = orig_termio.c_cc[VREPRINT];
-#else
-#ifdef VRPRNT
- term_chars[VRPRNT] = orig_termio.c_cc[VRPRNT];
-#endif
-#endif
- term_chars[VSUSP] = orig_termio.c_cc[VSUSP];
-
- /* disable suspending process on ^Z */
- rl_termio.c_cc[VSUSP] = 0;
-#endif /* TERMIOS */
-#endif /* SGTTY */
-
- /*
- * Set the new terminal modes.
- */
-#ifdef SGTTY
- ioctl(0, TIOCSLTC, &s_ltchars);
-#else
-#ifdef TERMIOS
-#ifdef TCSETSW
- ioctl(0, TCSETSW, &rl_termio);
-#else
- tcsetattr(0, TCSADRAIN, &rl_termio);
-#endif /* TCSETSW */
-#else
- ioctl(0, TCSETAW, &rl_termio);
-#endif /* TERMIOS */
-#endif /* SGTTY */
- term_set = 1;
- }
-#endif /* !MSDOS && !ATARI && !defined(_Windows) */
-}
-
-void
-reset_termio()
-{
-#if !defined(MSDOS) && !defined(ATARI) && !defined(_Windows) && !defined(DOS386)
-/* reset saved terminal modes */
- if(term_set == 1) {
-#ifdef SGTTY
- ioctl(0, TIOCSETN, &orig_termio);
-#ifdef TIOCGLTC
- /* enable suspending process on ^Z */
- s_ltchars.t_suspc = term_chars[VSUSP];
- ioctl(0, TIOCSLTC, &s_ltchars);
-#endif /* TIOCGLTC */
-#else /* SGTTY */
-#ifdef TERMIOS
-#ifdef TCSETSW
- ioctl(0, TCSETSW, &orig_termio);
-#else
- tcsetattr(0, TCSADRAIN, &orig_termio);
-#endif /* TCSETSW */
-#else
- ioctl(0, TCSETAW, &orig_termio);
-#endif /* TERMIOS */
-#endif /* SGTTY */
- term_set = 0;
- }
-#endif /* !MSDOS && !ATARI && !_Windows */
-}
-#endif /* READLINE */
diff --git a/lib/libftp/utils/uftp.c b/lib/libftp/utils/uftp.c
deleted file mode 100644
index 4c8961f..0000000
--- a/lib/libftp/utils/uftp.c
+++ /dev/null
@@ -1,824 +0,0 @@
-/* File Transfer Protocol Toolkit based on libftp */
-
-#include "uftp.h"
-#include <varargs.h>
-
-
-FTP *ftp[NFRAMES];
-LINKINFO iftp[NFRAMES];
-int frame=0;
-
-
-int status;
-jmp_buf start;
-int lastcmd=0;
-int glassmode=0;
-int trymode=1;
-int restmode=1;
-int hashmode=0;
-int sleeptime=30;
-time_t noopinterval=0;
-time_t nooptimeout=1;
-time_t prevtime=0;
-
-String cmd;
-String prompt="%T %u@%H:%d> ";
-String defaultuser;
-
-ALIAS *firstalias=NULL;
-
-/* if main have any arguments, interprets each it as command with args */
-
-
-main(int argc, char **argv)
-
-{
- register int i;
- register char *p1;
- FILE *fp;
- String tmp;
-
- if (setjmp(start)!=0)
- goto main_loop;
-
- setsignals();
-
-
-
- FtpSetErrorHandler(&FtpInit,my_error);
- FtpSetIOHandler(&FtpInit,my_error);
-
- strcpy(defaultuser,getpwuid(getuid())->pw_name);
-
-
- memset(ftp,0,sizeof(FTP*)*NFRAMES);
- memset(iftp,0,sizeof(LINKINFO)*NFRAMES);
-
-
-
- batch(SYSTEMRC);
-
- if (access(getrcname(),F_OK))
- {
- FILE *out=fdopen(open(getrcname(),O_WRONLY|O_CREAT|O_TRUNC,0700),"w");
-
- printf("Create default rc-file \"%s\"\n",getrcname());
-
- if (out==NULL)
- perror(getrcname());
-
- else
- {
-
- fprintf(out,"set timeout 120\nset hash\nset debug\nset bin\n");
- fprintf(out,"set prompt \"%%T %%u@%%h:%%d\\> \"\n");
- fprintf(out,"alias a alias\na ed ! emacs\nalias tn ! telnet\n");
-
- fclose(out);
- }
- }
-
-
- batch(getrcname());
- batch(getaliasrcname());
-
-
- for (i=1, tmp[0]=0; i< argc; i++)
- {
- strcat(tmp,argv[i]);
- if (i+1!=argc) strcat(tmp," ");
- }
-
- if (tmp[0]!=0)
- {
- String new;
-
-/*
- if (!strcmp(defaultuser,"ftp") || !strcmp(defaultuser,"anonymous"))
- strcpy(new,"ftp ");
- else
-*/
- strcpy(new,"open ");
-
- if (ifalias(tmp))
- execute (tmp);
- else
- strcat(new,tmp),
- execute(new);
- }
-
-
-main_loop:
-
- setsignals();
-
- while (1)
- {
-
- setjmp(start);
- if (lastcmd) exit(0);
-
-
- if (isatty(fileno(stdin)))
- p1=readline(getprompt());
- else
- p1=gets(cmd);
-
- if (p1==NULL)
- {
- putchar('\n');
- exit(0);
- }
-
- strcpy(cmd,p1);
-
- if (cmd[0]) add_history(cmd);
- execute(cmd);
- }
-}
-
-INLINE char *findspace(char *str)
-{
- while ( !isspace(*str) && *str != '\0' ) str++;
- return str;
-}
-
-
-
-char *word(char *str, int n)
-{
- String new;
- register char *p1, *p2;
- register int i;
-
- strcpy(new,str);
-
- p1=new;
-
- while (isspace(*p1)) p1++;
-
- if (n>1 )
- for (i=0;i<n-1;i++) /* Skip n-1 words */
- {
- if ((*p1=='"')||(*p1=='\''))
- {
- p1=strchr(p1+1,*p1);
- if (p1==NULL) return "";
- p1++;
- while ( isspace(*p1) ) p1++;
- continue;
- }
- p1=findspace(p1);
- if ( *p1=='\0' ) return "";
- p1++;
- while ( isspace(*p1) ) p1++;
- }
-
- if ((*p1=='"')|(*p1=='\''))
- {
- p2=strchr(p1+1,*p1);
- if (p2==NULL) return p1+1;
- *p2=0;
- return p1+1;
- }
-
- if ((p2=findspace(p1)) != NULL )
- {
- *p2=0;
- return p1;
- }
- return "";
-}
-
-
-/* Exacute few command separated by ';' . The character ' must use for mark complex
- works*/
-
-execute (char *cmd)
-{
- String w1,w2,w3,w4,w5,w6;
- String newcmd;
- char *p;
-
- if (!*cmd || *cmd=='#' ) return;
-
- for ( p=newcmd ; *cmd; cmd++)
- {
- if ( *cmd == '\'' )
- {
- *p++=*cmd++;
- while ( *cmd != '\'' && *cmd != 0 ) *p++=*cmd++;
- if ( *cmd == 0 )
- return puts("Unbalanced \', please corrected!\n");
- *p++=*cmd;
- continue;
- }
-
- if ( *cmd == ';' )
- {
- *p=0;
- execute(newcmd);
- p=newcmd;
- continue;
- }
- *p++=*cmd;
- }
-
-
- *p=0;
- cmd=newcmd;
-
- if ( *cmd=='\\' )
- cmd++;
- else
- {
- String new;
- strcpy(new,"\\");
- strcat(new,expandalias(cmd));
- return execute(new);
- }
-
- if ( *cmd == '!' )
- {
- int pid,_pid;
- int status;
-
- if (!(pid=fork()))
- {
- execlp((getenv("SHELL")==NULL)?"/bin/sh":(char *)getenv("SHELL"),
- "shell","-c",cmd+1,NULL);
- }
-
- while(1)
- {
- _pid=wait(&status);
- if (_pid==pid)
- return;
- }
- }
-
-
- redir(cmd);
-
- if (cmd[strlen(cmd)-1]=='&')
- {
- String tmp;
-
- cmd[strlen(cmd)-1]=0;
-
- strcpy(tmp,"bg ");
- strcat(tmp,cmd);
-
- strcpy(cmd,tmp);
- }
-
- strcpy(w1,word(cmd,1));
- strcpy(w2,word(cmd,2));
- strcpy(w3,word(cmd,3));
- strcpy(w4,word(cmd,4));
- strcpy(w5,word(cmd,5));
- strcpy(w6,word(cmd,6));
-
- return executev(w1,w2,w3,w4,w5,w6);
-}
-
-executev(ARGS)
-{
- CMDS *xcmd=&cmds[0];
- String tmp;
-
- if (isdigit(*w1))
- return
- atoi(w1)<NFRAMES?frame=atoi(w1):0,
- executev(w2,w3,w4,w5,w6,"");
-
- while ( xcmd -> cmd != NULL )
- {
- if ( !strcmp(xcmd->cmd,w1) && (xcmd -> func != NULL) )
- {
- int status;
-
- if ( xcmd -> need && LINK == NULL)
- return puts("Need connection to server");
- iftp[frame].lock=1; unsetsignals();
- status = (*xcmd->func)(w1,w2,w3,w4,w5,w6);
- iftp[frame].lock=0; setsignals();
- redirback();
- return status;
- }
- xcmd++;
- }
-
-
- if (LINK!=NULL && glassmode)
- return FtpCommand(LINK,cmd,"",0,EOF);
-
- printf("%s: unknown command\n",w1);
- fflush(stdout);
- return -1;
-}
-
-
-void intr(int sig)
-{
- printf("Interupted by signal %d\n",sig);
- if (LINK!=NULL) FtpSetHashHandler(LINK,NULL);
- setsignals();
- reset_termio(); /* From readline */
- prevtime = time((time_t *)0);
- longjmp(start,1);
-}
-
-newframe(int connecteble)
-{
- register int i;
-
- if (connecteble)
- for (i=0; i<NFRAMES; i++) if (ftp[i]!=NULL) return frame=i;
- for (i=0; i<NFRAMES; i++) if (ftp[i]==NULL) return frame=i;
- return -1;
-}
-
-STATUS my_error(FTP *ftp, int code, char *msg)
-{
-
- if (code==LQUIT||(ftp==NULL)) log(msg);
- else
- FtpLog(ftp->title,msg);
-
- if ( abs(code) == 530 && (strstr(msg,"anonymous")!=NULL))
- {
- Ftp_reopen();
- longjmp(start,1);
- }
- longjmp(start,1);
-}
-
-char *getrcname()
-{
- static String rcpath;
- struct passwd *pwd=getpwuid(getuid());
-
- sprintf(rcpath,"%s/.uftprc",pwd->pw_dir);
- return rcpath;
-}
-
-char *getaliasrcname()
-{
- static String rcpath;
- struct passwd *pwd=getpwuid(getuid());
-
- sprintf(rcpath,"%s/.uftp_aliases",pwd->pw_dir);
- return rcpath;
-}
-
-char *makestr(va_alist)
- va_dcl
-{
- char *p1;
- va_list args;
- String new={0};
-
- va_start(args);
-
- while(1)
- {
- p1=va_arg(args,char *);
- if (p1==NULL) break;
- if (*p1!=0)
- {
- if (new[0]!=0) strcat(new," ");
- strcat(new,p1);
- }
- }
- va_end(args);
- return new;
-}
-
-
-#define ADD(str,chr) (*str++=chr,*str=0)
-
-INLINE ADDSTR(char **str, char *str1)
-{
- while (*str1) *(*str)++=*str1++;
-}
-
-char *expandalias(char *str)
-{
- ALIAS *a=firstalias;
- String new={0},w1={0};
- char *p,*p1=new,*args;
- int dollar=0;
-
- strcpy(w1,word(str,1));
-
- if ( (p=strchr(str,' '))!=NULL )
- args=p+1;
- else
- args="";
-
- while (a)
- {
- if (!strcmp(a->name,w1))
- break;
- a=a->next;
- }
-
- if (!a)
- return str;
-
- for ( p=a->str; *p; p++)
- {
- if ( *p != '$' )
- {
- ADD(p1,*p);
- continue;
- }
-
- dollar=1;
- p++;
-
- if (isdigit(*p))
- {
- ADDSTR(&p1,word(str,(*p)-'0'+1));
- continue;
- }
-
- switch (*p)
- {
-
- case '\0':
- case '$': ADD(p1,'$');continue;
- case '*': ADDSTR(&p1,args);continue;
- default: ADD(p1,'$');ADD(p1,*p);continue;
- }
- }
-
- if (!dollar)
- {
- ADD(p1,' ');
- ADDSTR(&p1,args);
- }
-
- *p=0;
-
- return new;
-}
-
-ifalias(char *cmd)
-{
- String what;
- ALIAS *a=firstalias;
-
-
- strcpy(what,word(cmd,1));
-
- while ( a!=NULL)
- {
- if (!strcmp(a->name,what))
- return 1;
- a=a->next;
- }
- return 0;
-}
-
-
-
-char *getprompt()
-{
-
- static String _prompt;
- String tmp;
- char *s;
-
- _prompt[0]=0;
-
- for(s=prompt;*s;s++)
- switch (*s)
- {
- case '%':
- switch (*++s)
- {
-
- case 'H':
- strcat(_prompt,iftp[frame].host);
- break;
-
- case 'h':
- strcpy(tmp,iftp[frame].host);
- if (strchr(tmp,'.')!=NULL) *(char *)strchr(tmp,'.')=0;
- strcat(_prompt,tmp);
- break;
-
- case 'M':
- gethostname(tmp, sizeof tmp);
- strcat(_prompt,gethostbyname(tmp)->h_name);
- break;
-
- case 'm':
- gethostname(tmp, sizeof tmp);
- strcpy(tmp,gethostbyname(tmp)->h_name);
- if (strchr(tmp,'.')!=NULL) *(char *)strchr(tmp,'.')=0;
- strcat(_prompt,tmp);
- break;
-
- case 'u':
- strcat(_prompt,iftp[frame].user);
- break;
-
- case 'd':
- strcat(_prompt,iftp[frame].pwd);
- break;
-
- case 'D':
- strcat(_prompt,(char *)getcwd(tmp,sizeof(tmp)));
- break;
-
- case 'f':
- sprintf(tmp,"%d",frame);
- strcat(_prompt,tmp);
- break;
-
- case 'p':
- sprintf(tmp,"%d",(LINK==NULL)?0:LINK->port);
- strcat(_prompt,tmp);
- break;
-
- case 't':
-
- sprintf(tmp,"%d",(LINK==NULL)?0:LINK->timeout.tv_sec);
- strcat(_prompt,tmp);
- break;
-
-
- case 'T':
-
- {
- time_t t=time((time_t *)0);
- struct tm *lt=localtime(&t);
- sprintf(tmp,"%02d:%02d:%02d",lt->tm_hour,
- lt->tm_min,lt->tm_sec);
- strcat(_prompt,tmp);
- }
- break;
-
- case 'P':
-
- sprintf(tmp,"%d",getpid());
- strcat(_prompt,tmp);
- break;
-
- default:
- sprintf(tmp,"%%%c",*s);
- strcat(_prompt,tmp);
- break;
- }
- break;
-
- case '^':
-
- ++s;
- if (isalpha(*s))
- {
- sprintf(tmp,"%c",toupper(*s)-'A'+1);
- strcat(_prompt,tmp);
- }
- break;
-
- default:
-
- sprintf(tmp,"%c",*s);
- strcat(_prompt,tmp);
- break;
- }
- return _prompt;
-}
-
-
-void noop()
-{
- int i;
- time_t curtime,save;
- STATUS (*func1)(),(*func2)(),(*func3)();
-
-
- if (noopinterval==0) return;
-
- curtime = time((time_t *)0);
-
- signal(SIGALRM,noop);
-
- if (prevtime==0)
- {
- prevtime=curtime;
- alarm(noopinterval);
- return;
- }
-
- if (curtime-prevtime < noopinterval)
- {
- alarm(prevtime+noopinterval-curtime);
- return;
- }
-
- printf("Waiting...");fflush(stdout);
-
- for (i=0;i<NFRAMES;i++)
- {
- if ( ftp[i]==NULL || FTPCMD(ftp[i]) == NULL || iftp[i].lock )
- continue;
-
- func1=ftp[i]->debug; ftp[i]->debug=NULL;
- func2=ftp[i]->error; ftp[i]->error=NULL;
- func3=ftp[i]->IO; ftp[i]->IO=NULL;
- save = ftp[i]->timeout.tv_sec;
- ftp[i]->timeout.tv_sec = nooptimeout;
-
- FtpCommand(ftp[i],"NOOP","",0,EOF);
-
- ftp[i]->timeout.tv_sec = save;
- ftp[i]->debug=func1;
- ftp[i]->error=func1;
- ftp[i]->IO=func1;
-
- }
-
- alarm(noopinterval);
- prevtime=curtime;
-
- for (i=0;i<10;i++) putchar(8),putchar(' '),putchar(8);
- fflush(stdout);
-}
-
-
-setsignals()
-{
- signal(SIGINT,intr);
- signal(SIGQUIT,intr);
- noop();
-}
-
-unsetsignals()
-{
- signal(SIGALRM,SIG_IGN);
- alarm(0);
-}
-
-
-int myhash(FTP *ftp,unsigned int chars)
-{
-
- if (hashmode)
- {
- if (chars==0) return ftp -> counter=0;
- ftp -> counter += chars;
- fprintf(stdout,"%10u bytes transfered\r",ftp -> counter);
- fflush(stdout);
- }
-
- if (!lastcmd)
- {
- noop();
- alarm(0);
- }
-}
-
-
-
-char *makefilename(char *f1, char *f2)
-{
- char *p;
-
- if (*f2!=0)
- return f2;
-
- if ( (p=strrchr(f1,'/'))!=NULL)
- return p+1;
- return f1;
-}
-
-redir(char *cmdline)
-{
- char *p=cmdline;
- String result;
- char *r=result;
-
- for ( ; *p ; p++ , r++ )
- {
- if ( *p == '\\' )
- {
- *r = * ++ p ;
- continue;
- }
-
- if ( *p == '>' || *p == '<' )
- {
- String filename;
- char *q=filename;
- char c=*p;
-
- for (p++;isspace(*p)&&*p!=0;p++);
- if (*p=='"')
- {
- for (p++; *p!='"' && *p!=0 ; p++,q++) *q=*p;
- if (*p!='"') p++;
- }
- else
- for (; !isspace(*p) && *p!=0 ; p++,q++) *q=*p;
-
- *q=0;
-
- if ( c == '>' )
- output(filename);
- else
- input(filename);
- }
- *r=*p;
- }
- *r=0;
- strcpy(cmdline,result);
-}
-
-int itty=-1,otty=-1;
-FILE *is=NULL,*os=NULL;
-
-
-input(char *filename)
-{
-
- if ((is=Ftpfopen(filename,"r"))==NULL)
- {
- perror(filename);
- return;
- }
-
- fflush(stdin);
- itty=dup(0);
- close(0);
- dup2(fileno(is),0);
-
-}
-
-output(char *filename)
-{
-
- if ((os=Ftpfopen(filename,"w"))==NULL)
- {
- perror(filename);
- return;
- }
-
- fflush(stdout);
- otty=dup(1);
- close(1);
- dup2(fileno(os),1);
-}
-
-redirback()
-{
-
- if (itty!=-1)
- {
- fflush(stdin);
- close(0);
- Ftpfclose(is);
- dup2(itty,0);
- is=NULL;
- itty=-1;
- }
-
- if (otty!=-1)
- {
- fflush(stdout);
- close(1);
- Ftpfclose(os);
- dup2(otty,1);
- os=NULL;
- otty=-1;
- }
-}
-
-
-batch(char *filename)
-{
- FILE *fp;
- String tmp;
-
- if ((fp=fopen(filename,"r"))!=NULL)
- {
-
- while ( fgets(tmp, sizeof tmp, fp) != NULL)
- {
- tmp[strlen(tmp)-1]=0;
- execute(tmp);
- if (tmp[0]) add_history(tmp);
- }
- fclose(fp);
- }
-}
-
-
-
-
-
-
diff --git a/lib/libftp/utils/uftpcmd.c b/lib/libftp/utils/uftpcmd.c
deleted file mode 100644
index 2eb3cb2..0000000
--- a/lib/libftp/utils/uftpcmd.c
+++ /dev/null
@@ -1,1202 +0,0 @@
-#include "uftp.h"
-
-String tmp;
-
-jmp_buf connectstack;
-
-
-
-Ftp_connect_hook(FTP *ftp,int code, char *msg)
-{
- FtpLog(ftp->title,msg);
- longjmp(connectstack,1);
-
-}
-
-
-Ftp_connect(ARGS)
-{
- STATUS (*func1)(),(*func2)();
-
- if (*w2==0) w2=readline("Host:");
-
- if (FtpGetHost(w2)==NULL && FtpInit.IO != NULL)
- {
- char *msg;
- extern int h_errno;
-
- switch(h_errno)
- {
- case HOST_NOT_FOUND: msg = "Host unknown"; break;
- case TRY_AGAIN: msg = "Hostname lookup failure";break;
- default: msg = "gethostbyname failure";
- }
- return (*FtpInit.IO)(LINK,QUIT,msg);
- }
-
- newframe(0);
-
- func1 = FtpInit.error;
- func2 = FtpInit.IO;
-
- if (trymode)
- {
- FtpSetErrorHandler(&FtpInit,Ftp_connect_hook);
- FtpSetIOHandler(&FtpInit,Ftp_connect_hook);
- setjmp(connectstack);
- }
-
- FtpConnect(&LINK,w2);
- strcpy(iftp[frame].host,FtpGetHost(w2)->h_name);
-
- FtpSetErrorHandler(LINK,func1);
- FtpSetErrorHandler(&FtpInit,func1);
- FtpSetIOHandler(LINK,func2);
- FtpSetIOHandler(&FtpInit,func2);
-
- return;
-}
-
-Ftp_user(ARGS)
-{
-
- if (*w2==0)
- {
- sprintf(tmp,"login (default %s):",defaultuser);
- w2=readline(tmp);
- if (*w2==0)
- w2=defaultuser;
- }
- strcpy(iftp[frame].user,w2);
- strcpy(iftp[frame].pass,w3);
- if (FtpUser(LINK,w2)==331) Ftp_pass("",w3,"","","","");
-}
-
-Ftp_pass(ARGS)
-{
- if (*w2==0)
- {
- String pass;
- String host;
-
- gethostname(host, sizeof host);
- strcpy(host,FtpGetHost(host)->h_name);
- sprintf(pass,"%s@%s",getpwuid(getuid())->pw_name,host);
- sprintf(tmp,"Password (default %s):",pass);
- w2=getpass(tmp);
- if (*w2==0) w2=pass;
- }
-
- strcpy(iftp[frame].pass,w2);
- FtpPassword(LINK,w2);
- strcpy(iftp[frame].pwd,FtpPwd(LINK));
-}
-
-Ftp_open(ARGS)
-{
- register char *p1;
- STATUS (*err)();
-
- Ftp_connect("",w2,"","","","");
- Ftp_user("",w3,w4,"","","" );
- if (ifalias("autologin")) execute("autologin");
- if (*w5)
- Ftp_cd("cd",w5,"","","","");
-}
-
-Ftp_reopen(ARGS)
-{
- String host,user,pass,pwd;
-
- strcpy(host,iftp[frame].host);
- strcpy(user,iftp[frame].user);
- strcpy(pass,iftp[frame].pass);
- strcpy(pwd,iftp[frame].pwd);
-
- Ftp_close("","","","","","");
- Ftp_open("",host,user,pass,pwd,"");
-}
-
-Ftp_ftp(ARGS)
-{
- String pass;
- String host;
-
- gethostname(host, sizeof host);
- strcpy(host,FtpGetHost(host)->h_name);
- sprintf(pass,"%s@%s",getpwuid(getuid())->pw_name,host);
-
- Ftp_open("",w2,"anonymous",pass,w3,"");
- return;
-}
-
-Ftp_quit(ARGS)
-{
- exit(0);
-}
-
-Ftp_mput_handler()
-{
- log("File(s) or directory not found");
- longjmp(start,1);
-}
-
-
-Ftp_lcd(ARGS)
-{
- glob_t gl;
-
- bzero(&gl,sizeof gl);
-
- glob(w2,GLOB_BRACE|GLOB_TILDE|GLOB_QUOTE,
- Ftp_mput_handler, &gl);
-
-
- if (gl.gl_matchc<1 || chdir(*gl.gl_pathv))
- perror(w2);
-
- printf("Local directory is \"%s\"\n",getwd(tmp));
-}
-
-Ftp_dir(ARGS)
-{
- char *cmd1;
- String cmd;
- char mode=LINK->mode;
-
- if ( !strcmp(w1,"dir") )
- cmd1="LIST";
- else
- cmd1="NLST";
-
- strcpy(cmd,makestr(cmd1,w2,w3,w4,w5,w6,NULL));
-
- if ( LINK->mode != 'A' ) FtpAscii(LINK);
- FtpRetr(LINK,cmd,"","-");
- if ( LINK->mode != mode ) FtpType(LINK,mode);
-
-}
-
-Ftp_close(ARGS)
-{
- register int i;
-
- if (isdigit(*w2))
- {
- i=atoi(w2);
- }
- else
- {
- i=frame;
- }
-
- FtpQuickBye(ftp[i]);
-
- iftp[i].host[0]=0;
- iftp[i].pwd[0]=0;
- ftp[i]=NULL;
- newframe(1);
-}
-
-
-INLINE SetLogicalVar(char arg, int * var, char *msg)
-{
- switch(arg)
- {
-
- case 'y':
-
- *var=1;
- break;
-
- case 'n':
-
- *var=0;
- break;
-
- default:
-
- (*var)?(*var=0):(*var=1);
- break;
- }
- return printf("%s %s\n",msg,(*var)?"enable":"disable");
-}
-
-
-Ftp_set(ARGS)
-{
- if (!strcmp("frame",w2))
- return atoi(w3)<NFRAMES?frame=atoi(w3):0;
-
- if (!strcmp("timeout",w2))
- {
- FtpSetTimeout(&FtpInit,atoi(w3));
- if (LINK!=0)
- FtpSetTimeout(LINK,atoi(w3));
- return;
- }
-
- if (!strcmp("sleep",w2))
- {
- sleeptime=atoi(w3);
- return;
- }
-
- if (!strcmp("debug",w2))
- {
- if ( *w3=='y' || *w3==0)
- {
- if (LINK!=NULL) FtpSetDebugHandler(LINK,FtpDebugDebug);
- FtpSetDebugHandler(&FtpInit,FtpDebugDebug);
- return puts("Debuging on for current and next session");
- }
- if ( *w3 == 'n')
- {
- if (LINK!=NULL) FtpSetDebugHandler(LINK,NULL);
- FtpSetDebugHandler(&FtpInit,NULL);
- return puts("Debuging off for current and next session");
- }
- }
-
- if (!strcmp("bin",w2))
- {
- if ( *w3=='y' || *w3==0)
- {
- FtpInit.mode='I';
- return puts("Binary mode enable");
- }
- if ( *w3 == 'n')
- {
- FtpInit.mode='A';
- return puts("Binary mode disable");
- }
- }
-
- if (!strcmp("try",w2))
- return SetLogicalVar(*w3,&trymode,"Try mode");
- if (!strcmp("hash",w2))
- return SetLogicalVar(*w3,&hashmode,"Hash mode");
- if (!strcmp("glass",w2))
- return SetLogicalVar(*w3,&glassmode,"Glass mode");
- if (!strcmp("rest",w2)||!strcmp(w2,"restore"))
- return SetLogicalVar(*w3,&restmode,"Restore mode");
-
- if (!strcmp("prompt",w2))
- {
- strcpy(prompt,w3);
- return;
- }
-
- if (!strcmp("port",w2))
- {
- if ( isdigit(*w3))
- return FtpSetPort(&FtpInit,atoi(w3));
- puts("Port must be number");
- fflush(stdout);
- return;
- }
-
- if (!strcmp("noopinterval",w2)||!strcmp("noop",w2))
- {
- if ( isdigit(*w3))
- return noopinterval=(time_t)atoi(w3);
- puts("Time must be number");
- fflush(stdout);
- return;
- }
-
- if (!strcmp("nooptimeout",w2))
- {
- if ( isdigit(*w3))
- return nooptimeout=(time_t)atoi(w3);
- puts("Time must be number");
- fflush(stdout);
- return;
- }
-
-
-
- if (!strcmp("user",w2)||!strcmp("login",w2))
- {
- strcpy(defaultuser,w3);
- return;
- }
-
- if (!strcmp("",w2))
- {
-
- printf("frime %d\n",frame);
- printf("timeout %d secs\n",FtpInit.timeout.tv_sec);
- printf("sleep time %d secs\n",sleeptime);
- printf("debug %s\n",(FtpInit.debug!=NULL)?"enable":"disable");
- printf("glass mode %s\n",glassmode?"enable":"disable");
- printf("try mode %s\n",trymode?"enable":"disable");
- printf("hash mode %s\n",hashmode?"enable":"disable");
- printf("restore mode %s\n",restmode?"enable":"disable");
- printf("automatic binary mode %s\n",(FtpInit.mode=='I')?"enable":"disable");
- printf("prompt \"%s\"\n",prompt);
- printf("port %d\n",FtpInit.port);
- printf("noop interval %d\n",noopinterval);
- printf("noop timeout %d\n",nooptimeout);
- printf("Default login name \"%s\"\n",defaultuser);
- fflush(stdout);
- return;
- }
- return puts("arg 2 unknown");
-
-}
-
-jmp_buf getstack;
-
-Ftp_get_hook(FTP *con,int code, char *msg)
-{
-
- if ( abs(code)==550 && FtpBadReply550(msg) )
- {
- FtpLog(con->title,msg);
- log("Transfer cancel");
- longjmp(getstack,2);
- }
-
- if ( code == LQUIT )
- {
- log(msg);
- log("Transfer leave after I/O error with local file");
- longjmp(getstack,2);
- }
-
-
-
- FtpLog(con->title,msg);
- FtpQuickBye(LINK);
- LINK=NULL;
-
- log("sleeping......");
- sleep(sleeptime);
- log("try again...");
-
- longjmp(getstack,1);
-
-}
-
-void Ftp_get_intr(int sig)
-{
- signal(SIGINT,intr);
- log("Transfer interupt");
- Ftp_abort();
- longjmp(getstack,3);
-}
-
-Ftp_get(ARGS)
-{
- FTP OldInit;
- int back=0;
- int code;
- int status=0;
-
- OldInit=FtpInit;
-
- if (strstr(w1,"put")!=NULL) back=1;
-
-
- if (restmode || ((*w1=='r')&&(*(w1+1)=='e')) )
- FtpSetFlag(LINK,FTP_REST);
- else
- FtpClearFlag(LINK,FTP_REST);
-
-
-
- if (trymode)
- {
- FtpSetErrorHandler(LINK,Ftp_get_hook);
- FtpSetIOHandler(LINK,Ftp_get_hook);
- FtpInit=*LINK;
- FTPCMD(&FtpInit)=FTPCMD(&OldInit);
- FTPDATA(&FtpInit)=FTPDATA(&OldInit);
- }
-
- signal(SIGINT,Ftp_get_intr);
- FtpSetHashHandler(LINK,NULL);
-
-
- if ((status=setjmp(getstack))==2||status==3)
- goto done;
-
- if ((LINK==NULL)||(LINK->sock==FtpInit.sock))
- {
- FtpLogin(&LINK,iftp[frame].host,iftp[frame].user,
- iftp[frame].pass,NULL);
- FtpChdir(LINK,iftp[frame].pwd);
- }
-
- if (hashmode && isatty(fileno(stdout)))
- FtpSetHashHandler(LINK,myhash);
- else
- FtpSetHashHandler(LINK,NULL);
-
- myhash(LINK,0);
-
- if (!back)
- FtpGet(LINK,w2,makefilename(w2,w3));
- else
- FtpPut(LINK,w2,makefilename(w2,w3));
-
-
- log("Transfer compliete");
-
-
-done:
-
-
- FtpSetHashHandler(LINK,NULL);
- FtpSetErrorHandler(LINK,my_error);
- FtpSetIOHandler(LINK,my_error);
- FtpClearFlag(LINK,FTP_REST);
- FtpInit=OldInit;
-}
-
-Ftp_mget(ARGS)
-{
- FILE *list;
- char mode=LINK->mode;
-
- sprintf(tmp,"/tmp/uftplist-%s.XXXXXX",getpwuid(getuid())->pw_name);
- mktemp(tmp);
-
- if ( LINK->mode != 'A' ) FtpAscii(LINK);
-
- if (*w2==0)
- FtpRetr(LINK,"NLST","",tmp);
- else
- FtpRetr(LINK,"NLST %s",w2,tmp);
-
- if ( LINK->mode != mode ) FtpType(LINK,mode);
-
- if ((list=fopen(tmp,"r"))==NULL)
- return FtpLog(tmp,sys_errlist[errno]);
-
- while ( fgets(tmp,sizeof tmp,list)!=NULL)
- {
- tmp[strlen(tmp)-1]=0;
- Ftp_get("get",tmp,w3,"","","");
- }
-
- fclose(list);
-}
-
-Ftp_mput(ARGS)
-{
- glob_t gl;
-
- glob(w2,GLOB_BRACE|GLOB_TILDE|GLOB_QUOTE,
- Ftp_mput_handler, &gl);
-
- while(gl.gl_matchc--)
- {
- Ftp_get("put",*gl.gl_pathv,"","","","");
- gl.gl_pathv++;
- }
-}
-
-
-Ftp_bget(ARGS)
-{
-
- String fn,lfn;
- char *p;
-
- newframe(0);
-
- if (!FtpFullSyntax(w2,iftp[frame].host,iftp[frame].user,
- iftp[frame].pass,fn))
- return puts("Filename syntax error");
-
- strcpy(iftp[frame].pwd,"/");
-
- if ((p=strrchr(fn,'/'))!=NULL)
- strcpy(lfn,p+1);
- else
- strcpy(lfn,fn);
-
- FtpQuickBye(LINK);
- LINK=FtpCreateObject();
- LINK->sock=NULL;
-
- Ftp_get("get",fn,(*w3==0)?lfn:w3,"","","");
-}
-
-Ftp_bput(ARGS)
-{
-
- String fn,lfn;
- char *p;
-
- if (!FtpFullSyntax((*w3==0)?w2:w3,iftp[frame].host,iftp[frame].user,
- iftp[frame].pass,fn))
- return puts("Filename syntax error");
-
- strcpy(iftp[frame].pwd,"/");
-
- if ((p=strrchr(fn,'/'))!=NULL)
- strcpy(lfn,p+1);
- else
- strcpy(lfn,fn);
-
- FtpQuickBye(LINK);
- LINK=FtpCreateObject();
- LINK->sock=NULL;
-
- Ftp_get("put",(*w3==0)?lfn:w2,fn,"","","");
-}
-
-Ftp_copy(ARGS)
-{
- char *p;
- int in,out;
-
- if ( !*w2 || !*w3 ) return puts("Must pass two args");
-
- if ((p=strchr(w2,'!'))!=NULL)
- {
- *p=0;
- in=atoi(w2);
- w2=p+1;
- }
- else
- in=frame;
-
- if ((p=strchr(w3,'!'))!=NULL)
- {
- *p=0;
- out=atoi(w3);
- w3=p+1;
- }
- else
- in=frame;
-
- if (in==out) return puts("Files must been from different frames");
-
- FtpCopy(ftp[in],ftp[out],w2,w3);
-}
-
-Ftp_ccopy(ARGS)
-{
- char *p;
- int in,out;
-
- if ( !*w2 || !*w3 ) return puts("Must pass two args");
-
- if ((p=strchr(w2,'!'))!=NULL)
- {
- *p=0;
- in=atoi(w2);
- w2=p+1;
- }
- else
- in=frame;
-
- if ((p=strchr(w3,'!'))!=NULL)
- {
- *p=0;
- out=atoi(w3);
- w3=p+1;
- }
- else
- in=frame;
-
- if (in==out) return puts("Files must been from different frames");
-
- FtpPassiveTransfer(ftp[in],ftp[out],w2,w3);
-}
-
-Ftp_bin(ARGS)
-{
- FtpBinary(LINK);
-}
-
-Ftp_ascii(ARGS)
-{
- FtpAscii(LINK);
-}
-
-Ftp_cd(ARGS)
-{
- FtpChdir(LINK,w2);
- strcpy(iftp[frame].pwd,FtpPwd(LINK));
- if (ifalias("autocd")) execute("autocd");
-}
-
-
-Ftp_dup(ARGS)
-{
- LINKINFO oldinfo;
- FTP oldftp;
-
- oldinfo=iftp[frame];
- oldftp=*LINK;
-
- newframe(0);
- puts("Make alternative connection...");
- Ftp_open("",oldinfo.host,oldinfo.user,oldinfo.pass,"","");
- if (strcmp(oldinfo.pwd,iftp[frame].pwd))
- Ftp_cd("",oldinfo.pwd,"","","","");
- if (LINK->mode!=oldftp.mode)
- FtpType(LINK,oldftp.mode);
- LINK -> timeout = oldftp.timeout;
- LINK -> flags = oldftp.flags;
- FtpSetDebugHandler(LINK,oldftp.debug);
- FtpSetErrorHandler(LINK,oldftp.error);
- FtpSetIOHandler(LINK,oldftp.IO);
- FtpSetHashHandler(LINK,oldftp.hash);
-}
-
-
-
-Ftp_bg(ARGS)
-{
- if (fork())
- {
-
- log("Backgrounding...");
- return;
- }
- else
- {
- int i=frame;
-
- lastcmd=1;
-
- /* Ignoring keypad */
-
- alarm (0);
- signal(SIGALRM,SIG_IGN);
- signal(SIGURG,SIG_IGN);
- signal(SIGPIPE,SIG_IGN);
- signal(SIGTSTP,SIG_IGN);
- signal(SIGINT,SIG_IGN);
- signal(SIGQUIT,SIG_IGN);
- signal(SIGCHLD,SIG_IGN);
- signal(SIGIO,SIG_IGN);
-
- /* Droping output */
-
-
- sprintf(tmp,"/tmp/uftp-%s.XXXXXX",getpwuid(getuid())->pw_name);
- mktemp(tmp);
- close(0);close(1);close(2);
- open(tmp,O_RDWR|O_TRUNC|O_CREAT,0600);
- dup(0);dup(0);
-
- if (LINK!=NULL)
- {
- Ftp_dup("","","","","","");
- free(ftp[i]);
- ftp[i]=NULL;
- }
-
- return executev(w2,w3,w4,w5,w6,"");
- }
-}
-
-
-Ftp_list()
-{
- register int i;
-
-#define _FMT "%-5s %-15s %-10s %-25s %-7s %-4s\n"
-#define FMT "%-5d %-15s %-10s %-25s %-7d %-4d\n"
-
- printf(_FMT,"Frame","Host name","User's name","Working directory","Timeout","Port");
-
- for ( i = 0 ; i < NFRAMES ; i++ )
- if (ftp[i]!=NULL)
- printf(FMT,i,iftp[i].host,iftp[i].user,iftp[i].pwd,
- ftp[i]->timeout.tv_sec,ftp[i]->port);
- fflush(stdout);
- return;
-}
-
-Ftp_abort(ARGS)
-{
- time_t save;
-
- if (LINK!=NULL)
- {
- save = LINK ->timeout.tv_sec;
- LINK->timeout.tv_sec = nooptimeout;
- FtpAbort(LINK);
- LINK->timeout.tv_sec = save;
- }
-}
-
-Ftp_type(ARGS)
-{
- FtpGet(LINK,w2,"*STDOUT*");
-}
-
-
-Ftp_page(ARGS)
-{
- register char *pager;
- String out={'|',0};
-
- if ((pager=(char *)getenv("PAGER"))==NULL)
- pager="more";
-
- strcat(out,pager);
- FtpGet(LINK,w2,out);
-}
-
-
-Ftp_mkdir(ARGS)
-{
- FtpMkdir(LINK,w2);
-}
-
-Ftp_rm(ARGS)
-{
- FILE *list;
-
- sprintf(tmp,"/tmp/uftplist-%s.XXXXXX",getpwuid(getuid())->pw_name);
- mktemp(tmp);
-
- if (*w2==0)
- {
- log("Filename specification must present");
- return;
- }
-
- FtpRetr(LINK,"NLST %s",w2,tmp);
-
- if ((list=fopen(tmp,"r"))==NULL)
- return FtpLog(tmp,sys_errlist[errno]);
-
- while ( fgets(tmp,sizeof tmp,list)!=NULL)
- {
- tmp[strlen(tmp)-1]=0;
- FtpCommand(LINK,"DELE %s",tmp,0,EOF);
- }
-
- fclose(list);
-}
-
-
-
-
-Ftp_move(ARGS)
-{
- FtpMove(LINK,w2,w3);
-}
-
-Ftp_help(ARGS)
-{
- register int i,ii;
-
- if ( !*w2 )
- {
- puts("Warrning!!!! \nPlease read general information using command \"help etc\"\n\n");
-
- for ( i = 0 ;1; i++)
- {
- for ( ii = 0 ; ii < 5 ; ii++)
- {
- if (cmds[ii+i*5].cmd==NULL) return putchar('\n');
- printf("%-16s",cmds[ii+i*5].cmd);
- }
- putchar ('\n');
- }
- }
-
-
- for ( i = 0 ; 1; i++)
- {
-
- if (cmds[i].cmd==NULL) return puts("Command not found");
- if (!strcmp(cmds[i].cmd,w2))
- break;
- }
-
- puts(cmds[i].help);
-
-}
-
-Ftp_quote(ARGS)
-{
- String new;
-
- new[0]=0;
-
- if (*w2!=0) strcpy(new,w2);
- if (*w3!=0) strcat(new," "),strcat(new,w3);
- if (*w4!=0) strcat(new," "),strcat(new,w4);
- if (*w5!=0) strcat(new," "),strcat(new,w5);
- if (*w6!=0) strcat(new," "),strcat(new,w6);
-
- FtpCommand(LINK,new,"",0,EOF);
-}
-
-Ftp_alias(ARGS)
-{
- ALIAS *a=firstalias;
-
-
- if ( *w2==0 )
- {
- while (a!=NULL)
- {
- printf("%s=%s\n",a->name,a->str);
- a=a->next;
- }
- return;
- }
-
-
- while (1)
- {
-
- if ( a == NULL )
- {
- firstalias = a = (ALIAS *) malloc(sizeof(ALIAS));
- memset(a,0,sizeof(ALIAS));
- a -> next = NULL;
- break;
- }
-
- if (!strcmp(a->name,w2))
- break;
-
- if ( a->next == NULL)
- {
- a -> next = (ALIAS *) malloc(sizeof(ALIAS));
- a = a->next;
- memset(a,0,sizeof(ALIAS));
- a -> next = NULL;
- break;
- }
- a=a->next;
- }
-
- strcpy(a -> name,w2);
- strcpy(a -> str,makestr(w3,w4,w5,w6,NULL));
-}
-
-Ftp_mkalias(ARGS)
-{
- String new;
-
- if (!*w2) return puts("Arg must present\n");
-
- sprintf(new,"open \"%s\" \"%s\" \"%s\" \"%s\"",
- iftp[frame].host,iftp[frame].user,
- iftp[frame].pass,iftp[frame].pwd);
-
- Ftp_alias("alias",w2,new,"","","");
-}
-
-Ftp_unalias(ARGS)
-{
- ALIAS *cur,*prev;
-
- cur=prev=firstalias;
-
- while ( cur != NULL )
- {
- if (!strcmp(cur->name,w2))
- {
- if ( cur == firstalias )
- {
- firstalias = cur->next;
- free(cur);
- return;
- }
- prev -> next = cur -> next;
- free(cur);
- }
- prev=cur;
- cur=cur->next;
- }
-}
-
-
-Ftp_save(ARGS)
-{
- ALIAS *a=firstalias;
- String fn;
- FILE *out;
-
- if ((out=fopen (getaliasrcname(),"w"))==NULL)
- {
- perror(getaliasrcname());
- return;
- }
-
- while (a!=NULL)
- {
- fprintf(out,"alias %s '%s'\n",a->name,a->str);
- a=a->next;
- }
- fclose(out);
- chmod ( getaliasrcname(), 0600);
- puts("Aliases saved");
-}
-
-#define ARCHIE_MAX_TARGETS 20
-
-Ftp_acd(ARGS)
-{
- static int targets=0;
- static String what={0};
- static ARCHIE result[ARCHIE_MAX_TARGETS];
-
- int i, selected_target;
- String tmp;
- char *p;
-
-
- if ( (what[0] == 0 || strcmp(w2,what) != 0) && *w2!=0 )
- {
- if ((targets=FtpArchie(w2,result,ARCHIE_MAX_TARGETS))<1)
- return puts("Archie failure or target not found");
- strcpy(what,w2);
- }
-
- for (i=0;i<targets;i++)
- printf("%2d %s:%s\n",i,result[i].host,result[i].file);
-
- if (strcmp(w1,"archie")==0)
- return;
-
-
- p = readline("Your selection? ");
- if (p==NULL) return;
-
- selected_target = atoi(p);
-
- if ( result[selected_target].file[strlen(result[selected_target].file)-1]
- == '/' )
- {
- Ftp_ftp("ftp",result[selected_target].host,result[selected_target].file,
- "","","");
- return;
- }
- else
- {
- sprintf(tmp,"%s:%s",
- result[selected_target].host,result[selected_target].file);
- Ftp_bget("bget",tmp,"","","","");
- }
-}
-
-
-CMDS cmds[]={
-
- "connect", Ftp_connect, 0,
- "connect <hostname> - make new ftp connection",
-
- "open", Ftp_open, 0,
- "open <hostname> <user> <pass> <directory> - login to server",
-
- "reopen", Ftp_reopen, 1,
- "Open again connection with existing frame information",
-
- "ftp", Ftp_ftp, 0,
- "ftp <hostname> - anonymously login to server",
-
- "close", Ftp_close, 1,
- "Close connection",
-
- "quit", Ftp_quit, 0,
- "Exit from uftp",
-
- "set", Ftp_set, 0,
-"Set variables: (Without args print current settings)\n\
- frame <number> - select another session(frame)\n\
- timeout <secs> - Set network timeout\n\
- nooptimeout <secs>- Set network timeout with clearing timeout\n\
- noop <secs> - Set time interval for sending NOOP operator\n\
- to server for erased delay\n\
- sleep <secs> - Set pause beetween transfer attempt\n\
- debug <y|n> - Set debuging ftp's protocol (Default no)\n\
- try <y|n> - Set retransfer mode with broken network (Default yes)\n\
- hash <y|n> - Set hashing transfer (Default no)\n\
- restore <y|n> - Set retransfer mode (reget/reput) (Default yes!!!!)\n\
- bin <y|n> - Set automatic turn on binary mode (Default no) \n\
- glass <y|n> - Set glass mode (bad commands interprets as commands for FTPD)\n\
- prompt <string> - Set prompt (See help prompt)\n\
- port <number> - Set ftpd's port for next sessions\n\
- user <name> - Set default user name (default you name)",
-
- "prompt", NULL, 0,
- "\
-prompt is a string, which may be contains %<char>
-or ^<char> combitanion, which have next interprets:
-
-%H, %h - full and short remote host names
-%M, %m - full and short local host names
-%u - remote user's name
-%d - remote current directory
-%D - local current directory
-%f - number of current frame
-%p - the ftp's port number
-%t - timeout
-%T - current time
-%P - uftp process id
-%% - character %
-^<char>- control character
-%^ - character ^
-",
-
- "list", Ftp_list, 0,
-"List session's information",
-
- "user", Ftp_user, 1,
-"user <user> - send user's name",
-
- "pass", Ftp_pass, 1,
-"pass <pass> - send user's password",
-
- "bin", Ftp_bin, 1,
-"Set binary mode for current frame",
-
- "ascii", Ftp_ascii, 1,
-"Set ASCII mode for current frame",
-
- "cd", Ftp_cd, 1,
-"cd <directory> - change current remote directory ",
-
- "acd", Ftp_acd, 0,
-"acd <file_or_directory> - search pointed directory using archie, and setup connection to it",
-
- "lcd", Ftp_lcd, 0,
-"Change local directory",
-
- "abort", Ftp_abort, 1,
-"abort last operation",
-
- "mkdir", Ftp_mkdir, 1,
-"mkdir <dirname> - create new directory",
-
- "rm", Ftp_rm, 1,
-"rm <filename_spec> - remove file(s)",
-
- "mv", Ftp_move, 1,
-"mv <old> <new> - rename file",
-
- "dir", Ftp_dir, 1,
-"dir <argslist> ... - print list of files",
-
- "ls", Ftp_dir, 1,
-"ls <arglist> ... - print short list of files",
-
- "get", Ftp_get, 1,
-"get <remote_file> [<local_file>] - receive file from server",
-
- "mget", Ftp_mget, 1,
-"mget <remote_file(s)> [<local_directory>] - receive file(s) from server",
-
- "reget", Ftp_get, 1,
-"reget <remote_file> <local_file> - receive file restarting at end of local file",
-
- "aget", Ftp_acd, 0,
-"aget <file> - search pointed file using archie, and retrive it",
-
- "put", Ftp_get, 1,
-"put <local_file> [<remote_file>] - send server to file",
-
- "mput", Ftp_mput, 1,
-"mput <local_file(s)> - send file(s) from server",
-
- "reput", Ftp_get, 1,
-"reput <local_file> [<remote_file>] - send file restarting at end of remote file",
-
- "bget", Ftp_bget, 0,
-"bget <libftp_file> [<localfile>] - full session procedure (See \"help etc\")",
-
- "bput", Ftp_bput, 0,
-"bput [<localfile>] <libftp_file> - full session procedure (See \"help etc\")",
-
- "copy", Ftp_copy, 1,
-"copy [<frame>!]file [<frame>!]file - copy file via client cache",
-
- "ccopy", Ftp_ccopy, 1,
-"ccopy [<frame>!]file [<frame>!]file - copy file directly beetween servers",
-
- "cat", Ftp_type, 1,
-"cat <file> - print body of remote file to screen",
-
- "page", Ftp_page, 1,
-"page <file> - print body of remote file to screen via pager",
-
- "bg", Ftp_bg, 0,
-"bg <any_command> - run command(s) backgroundly (output redirect to file),\n\
-You can also add &-char to back of line without \"bg\"",
-
- "archie", Ftp_acd, 0,
-"Find file using archie service and display to screen",
-
- "dup", Ftp_dup, 1,
-"Make new analogous frame",
-
- "quote", Ftp_quote, 1,
-"quote <some_string> - send command directly to server",
-
- "help", Ftp_help, 0,
-"help <command> - print list of commands or command description",
-
- "alias", Ftp_alias, 0,
-"\
-alias aliasname <list> .... - make new alias, use $X for taking \n\
- X's argument from command string, and $* for taking\n\
- all arguments. If $<anything> on alias not present,\n\
- the arguments appending to end of command string",
-
- "unalias", Ftp_unalias, 0,
-"unalias <aliasname> - remove alias",
-
- "mkalias", Ftp_mkalias, 0,
-"make alias for create this frame, use savealias for saving it to file",
-
- "savealias", Ftp_save, 0,
- "Save aliases to file",
-
- "etc", NULL, 0,
- "\
-1. In any command you may use constructions <file and >file for\n\
- redirect input output.\n\
-\n\
-2. All local files files interprets as libftp file(s), \n\
- this support next specification:\n\
-\n\
- |string - interprets string as shell command, which must be\n\
- execute and input or output take from/to it.\n\
- \n\
- hostname:filename - interprets as file, witch must be take \n\
- using ftp protocol with anonymously access\n\
- \n\
- user@hostname:filename - interprets as file accesses via ftp\n\
- with password yourname@your_host.your_domain\n\
-\n\
- user/pass@hostname:filename - also ftp file.\n\
-\n\
- *STDIN*, *STDOUT*, *STDERR* - opened streams.\n\
-\n\
- anything - local file name.\n\
-\n\
-3. Command started with '!' passed to shell.\n
-\n\
-4. If string beetween two \" or \', its interprets as one word.\n\
-\n\
-5. Any string may be devide to few commands using ';'.",
-
-
-
- NULL
-
-};
-
-
-
-
-
-
-
diff --git a/lib/libncurses/TESTS/bs.c b/lib/libncurses/TESTS/bs.c
deleted file mode 100644
index 3785fcd..0000000
--- a/lib/libncurses/TESTS/bs.c
+++ /dev/null
@@ -1,1252 +0,0 @@
-/*
- * bs.c - original author: Bruce Holloway
- * salvo option by: Chuck A DeGaul
- * with improved user interface, autoconfiguration and code cleanup
- * by Eric S. Raymond <esr@snark.thyrsus.com>
- * v1.2 with color support and minor portability fixes, November 1990
- * v2.0 featuring strict ANSI/POSIX conformance, November 1993.
- */
-
-#include <ncurses.h>
-#include <signal.h>
-#include <ctype.h>
-#include <assert.h>
-
-#ifndef A_UNDERLINE /* BSD curses */
-#define beep() write(1,"\007",1);
-#define cbreak crmode
-#define saveterm savetty
-#define resetterm resetty
-#define nocbreak nocrmode
-#define strchr index
-#endif /* !A_UNDERLINE */
-
-#ifdef isxdigit /* aha, must be an AT&T system... */
-#define srand(n) srand48(n)
-#define rand() lrand48()
-extern long lrand48();
-extern void srand48();
-#define bzero(s, n) (void)memset((char *)(s), '\0', n)
-extern char *memset();
-/*
- * Try this if ungetch() fails to resolve.
- *
- * #define ungetch ungetc
- */
-#endif /* isxdigit */
-
-extern unsigned sleep();
-extern char *strchr(), *strcpy();
-extern long time();
-extern void exit();
-
-static bool checkplace();
-
-/*
- * Constants for tuning the random-fire algorithm. It prefers moves that
- * diagonal-stripe the board with a stripe separation of srchstep. If
- * no such preferred moves are found, srchstep is decremented.
- */
-#define BEGINSTEP 3 /* initial value of srchstep */
-
-/* miscellaneous constants */
-#define SHIPTYPES 5
-#define OTHER (1-turn)
-#define PLAYER 0
-#define COMPUTER 1
-#define MARK_HIT 'H'
-#define MARK_MISS 'o'
-#define CTRLC '\003' /* used as terminate command */
-#define FF '\014' /* used as redraw command */
-
-/* coordinate handling */
-#define BWIDTH 10
-#define BDEPTH 10
-
-/* display symbols */
-#define SHOWHIT '*'
-#define SHOWSPLASH ' '
-#define IS_SHIP(c) isupper(c)
-
-/* how to position us on player board */
-#define PYBASE 3
-#define PXBASE 3
-#define PY(y) (PYBASE + (y))
-#define PX(x) (PXBASE + (x)*3)
-#define pgoto(y, x) (void)move(PY(y), PX(x))
-
-/* how to position us on cpu board */
-#define CYBASE 3
-#define CXBASE 48
-#define CY(y) (CYBASE + (y))
-#define CX(x) (CXBASE + (x)*3)
-#define cgoto(y, x) (void)move(CY(y), CX(x))
-
-#define ONBOARD(x, y) (x >= 0 && x < BWIDTH && y >= 0 && y < BDEPTH)
-
-/* other board locations */
-#define COLWIDTH 80
-#define PROMPTLINE 21 /* prompt line */
-#define SYBASE CYBASE + BDEPTH + 3 /* move key diagram */
-#define SXBASE 63
-#define MYBASE SYBASE - 1 /* diagram caption */
-#define MXBASE 64
-#define HYBASE SYBASE - 1 /* help area */
-#define HXBASE 0
-
-/* this will need to be changed if BWIDTH changes */
-static char numbers[] = " 0 1 2 3 4 5 6 7 8 9";
-
-static char carrier[] = "Aircraft Carrier";
-static char battle[] = "Battleship";
-static char sub[] = "Submarine";
-static char destroy[] = "Destroyer";
-static char ptboat[] = "PT Boat";
-
-static char name[40];
-static char dftname[] = "stranger";
-
-/* direction constants */
-#define E 0
-#define SE 1
-#define S 2
-#define SW 3
-#define W 4
-#define NW 5
-#define N 6
-#define NE 7
-static int xincr[8] = {1, 1, 0, -1, -1, -1, 0, 1};
-static int yincr[8] = {0, 1, 1, 1, 0, -1, -1, -1};
-
-/* current ship position and direction */
-static int curx = (BWIDTH / 2);
-static int cury = (BDEPTH / 2);
-
-typedef struct
-{
- char *name; /* name of the ship type */
- unsigned hits; /* how many times has this ship been hit? */
- char symbol; /* symbol for game purposes */
- char length; /* length of ship */
- char x, y; /* coordinates of ship start point */
- char dir; /* direction of `bow' */
- bool placed; /* has it been placed on the board? */
-}
-ship_t;
-
-ship_t plyship[SHIPTYPES] =
-{
- { carrier, 0, 'A', 5},
- { battle, 0, 'B', 4},
- { destroy, 0, 'D', 3},
- { sub, 0, 'S', 3},
- { ptboat, 0, 'P', 2},
-};
-
-ship_t cpuship[SHIPTYPES] =
-{
- { carrier, 0, 'A', 5},
- { battle, 0, 'B', 4},
- { destroy, 0, 'D', 3},
- { sub, 0, 'S', 3},
- { ptboat, 0, 'P', 2},
-};
-
-/* "Hits" board, and main board. */
-static char hits[2][BWIDTH][BDEPTH], board[2][BWIDTH][BDEPTH];
-
-static int turn; /* 0=player, 1=computer */
-static int plywon=0, cpuwon=0; /* How many games has each won? */
-
-static int salvo, blitz, closepack;
-
-#define PR (void)addstr
-
-static void uninitgame(sig)
-/* end the game, either normally or due to signal */
-int sig;
-{
- clear();
- (void)refresh();
- (void)resetterm();
- (void)echo();
- (void)endwin();
- exit(0);
-}
-
-static void announceopts()
-/* announce which game options are enabled */
-{
- if (salvo || blitz || closepack)
- {
- (void) printw("Playing optional game (");
- if (salvo)
- (void) printw("salvo, ");
- else
- (void) printw("nosalvo, ");
- if (blitz)
- (void) printw("blitz ");
- else
- (void) printw("noblitz, ");
- if (closepack)
- (void) printw("closepack)");
- else
- (void) printw("noclosepack)");
- }
- else
- (void) printw(
- "Playing standard game (noblitz, nosalvo, noclosepack)");
-}
-
-static void intro()
-{
- extern char *getlogin();
- char *tmpname;
-
- srand(time(0L)+getpid()); /* Kick the random number generator */
-
- (void) signal(SIGINT,uninitgame);
- (void) signal(SIGINT,uninitgame);
- (void) signal(SIGIOT,uninitgame); /* for assert(3) */
- if(signal(SIGQUIT,SIG_IGN) != SIG_IGN)
- (void)signal(SIGQUIT,uninitgame);
-
- if(tmpname = getlogin())
- {
- (void)strcpy(name,tmpname);
- name[0] = toupper(name[0]);
- }
- else
- (void)strcpy(name,dftname);
-
- (void)initscr();
-#ifdef KEY_MIN
- keypad(stdscr, TRUE);
-#endif /* KEY_MIN */
- (void)saveterm();
- (void)nonl();
- (void)cbreak();
- (void)noecho();
-
-#ifdef PENGUIN
- (void)clear();
- (void)mvaddstr(4,29,"Welcome to Battleship!");
- (void)move(8,0);
- PR(" \\\n");
- PR(" \\ \\ \\\n");
- PR(" \\ \\ \\ \\ \\_____________\n");
- PR(" \\ \\ \\_____________ \\ \\/ |\n");
- PR(" \\ \\/ \\ \\/ |\n");
- PR(" \\/ \\_____/ |__\n");
- PR(" ________________/ |\n");
- PR(" \\ S.S. Penguin |\n");
- PR(" \\ /\n");
- PR(" \\___________________________________________________/\n");
-
- (void) mvaddstr(22,27,"Hit any key to continue..."); (void)refresh();
- (void) getch();
-#endif /* PENGUIN */
-
-#ifdef A_COLOR
- start_color();
-
- init_pair(COLOR_BLACK, COLOR_BLACK, COLOR_BLACK);
- init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK);
- init_pair(COLOR_RED, COLOR_RED, COLOR_BLACK);
- init_pair(COLOR_CYAN, COLOR_CYAN, COLOR_BLACK);
- init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK);
- init_pair(COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
- init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_BLACK);
- init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK);
-#endif /* A_COLOR */
-
-}
-
-/* VARARGS1 */
-static void prompt(n, f, s)
-/* print a message at the prompt line */
-int n;
-char *f, *s;
-{
- (void) move(PROMPTLINE + n, 0);
- (void) clrtoeol();
- (void) printw(f, s);
- (void) refresh();
-}
-
-static void error(s)
-char *s;
-{
- (void) move(PROMPTLINE + 2, 0);
- (void) clrtoeol();
- if (s)
- {
- (void) addstr(s);
- (void) beep();
- }
-}
-
-static void placeship(b, ss, vis)
-int b;
-ship_t *ss;
-int vis;
-{
- int l;
-
- for(l = 0; l < ss->length; ++l)
- {
- int newx = ss->x + l * xincr[ss->dir];
- int newy = ss->y + l * yincr[ss->dir];
-
- board[b][newx][newy] = ss->symbol;
- if (vis)
- {
- pgoto(newy, newx);
- (void) addch((chtype)ss->symbol);
- }
- }
- ss->hits = 0;
-}
-
-static int rnd(n)
-int n;
-{
- return(((rand() & 0x7FFF) % n));
-}
-
-static void randomplace(b, ss)
-/* generate a valid random ship placement into px,py */
-int b;
-ship_t *ss;
-{
- register int bwidth = BWIDTH - ss->length;
- register int bdepth = BDEPTH - ss->length;
-
- do {
- ss->y = rnd(bdepth);
- ss->x = rnd(bwidth);
- ss->dir = rnd(2) ? E : S;
- } while
- (!checkplace(b, ss, FALSE));
-}
-
-static void initgame()
-{
- int i, j, unplaced;
- ship_t *ss;
-
- (void) clear();
- (void) mvaddstr(0,35,"BATTLESHIPS");
- (void) move(PROMPTLINE + 2, 0);
- announceopts();
-
- bzero(board, sizeof(char) * BWIDTH * BDEPTH * 2);
- bzero(hits, sizeof(char) * BWIDTH * BDEPTH * 2);
- for (i = 0; i < SHIPTYPES; i++)
- {
- ss = cpuship + i;
- ss->x = ss->y = ss->dir = ss->hits = ss->placed = 0;
- ss = plyship + i;
- ss->x = ss->y = ss->dir = ss->hits = ss->placed = 0;
- }
-
- /* draw empty boards */
- (void) mvaddstr(PYBASE - 2, PXBASE + 5, "Main Board");
- (void) mvaddstr(PYBASE - 1, PXBASE - 3,numbers);
- for(i=0; i < BDEPTH; ++i)
- {
- (void) mvaddch(PYBASE + i, PXBASE - 3, i + 'A');
-#ifdef A_COLOR
- if (has_colors())
- attron(COLOR_PAIR(COLOR_BLUE));
-#endif /* A_COLOR */
- (void) addch(' ');
- for (j = 0; j < BWIDTH; j++)
- (void) addstr(" . ");
-#ifdef A_COLOR
- attrset(0);
-#endif /* A_COLOR */
- (void) addch(' ');
- (void) addch(i + 'A');
- }
- (void) mvaddstr(PYBASE + BDEPTH, PXBASE - 3,numbers);
- (void) mvaddstr(CYBASE - 2, CXBASE + 7,"Hit/Miss Board");
- (void) mvaddstr(CYBASE - 1, CXBASE - 3, numbers);
- for(i=0; i < BDEPTH; ++i)
- {
- (void) mvaddch(CYBASE + i, CXBASE - 3, i + 'A');
-#ifdef A_COLOR
- if (has_colors())
- attron(COLOR_PAIR(COLOR_BLUE));
-#endif /* A_COLOR */
- (void) addch(' ');
- for (j = 0; j < BWIDTH; j++)
- (void) addstr(" . ");
-#ifdef A_COLOR
- attrset(0);
-#endif /* A_COLOR */
- (void) addch(' ');
- (void) addch(i + 'A');
- }
-
- (void) mvaddstr(CYBASE + BDEPTH,CXBASE - 3,numbers);
-
- (void) mvprintw(HYBASE, HXBASE,
- "To position your ships: move the cursor to a spot, then");
- (void) mvprintw(HYBASE+1,HXBASE,
- "type the first letter of a ship type to select it, then");
- (void) mvprintw(HYBASE+2,HXBASE,
- "type a direction ([hjkl] or [4862]), indicating how the");
- (void) mvprintw(HYBASE+3,HXBASE,
- "ship should be pointed. You may also type a ship letter");
- (void) mvprintw(HYBASE+4,HXBASE,
- "followed by `r' to position it randomly, or type `R' to");
- (void) mvprintw(HYBASE+5,HXBASE,
- "place all remaining ships randomly.");
-
- (void) mvaddstr(MYBASE, MXBASE, "Aiming keys:");
- (void) mvaddstr(SYBASE, SXBASE, "y k u 7 8 9");
- (void) mvaddstr(SYBASE+1, SXBASE, " \\|/ \\|/ ");
- (void) mvaddstr(SYBASE+2, SXBASE, "h-+-l 4-+-6");
- (void) mvaddstr(SYBASE+3, SXBASE, " /|\\ /|\\ ");
- (void) mvaddstr(SYBASE+4, SXBASE, "b j n 1 2 3");
-
- /* have the computer place ships */
- for(ss = cpuship; ss < cpuship + SHIPTYPES; ss++)
- {
- randomplace(COMPUTER, ss);
- placeship(COMPUTER, ss, FALSE);
- }
-
- ss = (ship_t *)NULL;
- do {
- extern char *strchr();
- static char getcoord();
- char c, docked[SHIPTYPES + 2], *cp = docked;
-
- /* figure which ships still wait to be placed */
- *cp++ = 'R';
- for (i = 0; i < SHIPTYPES; i++)
- if (!plyship[i].placed)
- *cp++ = plyship[i].symbol;
- *cp = '\0';
-
- /* get a command letter */
- prompt(1, "Type one of [%s] to pick a ship.", docked+1);
- do {
- c = getcoord(PLAYER);
- } while
- (!strchr(docked, c));
-
- if (c == 'R')
- (void) ungetch('R');
- else
- {
- /* map that into the corresponding symbol */
- for (ss = plyship; ss < plyship + SHIPTYPES; ss++)
- if (ss->symbol == c)
- break;
-
- prompt(1, "Type one of [hjklrR] to place your %s.", ss->name);
- pgoto(cury, curx);
- }
-
- do {
- c = getch();
- } while
- (!strchr("hjklrR", c) || c == FF);
-
- if (c == FF)
- {
- (void)clearok(stdscr, TRUE);
- (void)refresh();
- }
- else if (c == 'r')
- {
- prompt(1, "Random-placing your %s", ss->name);
- randomplace(PLAYER, ss);
- placeship(PLAYER, ss, TRUE);
- error((char *)NULL);
- ss->placed = TRUE;
- }
- else if (c == 'R')
- {
- prompt(1, "Placing the rest of your fleet at random...");
- for (ss = plyship; ss < plyship + SHIPTYPES; ss++)
- if (!ss->placed)
- {
- randomplace(PLAYER, ss);
- placeship(PLAYER, ss, TRUE);
- ss->placed = TRUE;
- }
- error((char *)NULL);
- }
- else if (strchr("hjkl8462", c))
- {
- ss->x = curx;
- ss->y = cury;
-
- switch(c)
- {
- case 'k': case '8': ss->dir = N; break;
- case 'j': case '2': ss->dir = S; break;
- case 'h': case '4': ss->dir = W; break;
- case 'l': case '6': ss->dir = E; break;
- }
-
- if (checkplace(PLAYER, ss, TRUE))
- {
- placeship(PLAYER, ss, TRUE);
- error((char *)NULL);
- ss->placed = TRUE;
- }
- }
-
- for (unplaced = i = 0; i < SHIPTYPES; i++)
- unplaced += !plyship[i].placed;
- } while
- (unplaced);
-
- turn = rnd(2);
-
- (void) mvprintw(HYBASE, HXBASE,
- "To fire, move the cursor to your chosen aiming point ");
- (void) mvprintw(HYBASE+1, HXBASE,
- "and strike any key other than a motion key. ");
- (void) mvprintw(HYBASE+2, HXBASE,
- " ");
- (void) mvprintw(HYBASE+3, HXBASE,
- " ");
- (void) mvprintw(HYBASE+4, HXBASE,
- " ");
- (void) mvprintw(HYBASE+5, HXBASE,
- " ");
-
- (void) prompt(0, "Press any key to start...");
- (void) getch();
-}
-
-static int getcoord(atcpu)
-int atcpu;
-{
- int ny, nx, c;
-
- if (atcpu)
- cgoto(cury,curx);
- else
- pgoto(cury, curx);
- (void)refresh();
- for (;;)
- {
- if (atcpu)
- {
- (void) mvprintw(CYBASE + BDEPTH+1, CXBASE+11, "(%d, %c)", curx, 'A'+cury);
- cgoto(cury, curx);
- }
- else
- {
- (void) mvprintw(PYBASE + BDEPTH+1, PXBASE+11, "(%d, %c)", curx, 'A'+cury);
- pgoto(cury, curx);
- }
-
- switch(c = getch())
- {
- case 'k': case '8':
-#ifdef KEY_MIN
- case KEY_UP:
-#endif /* KEY_MIN */
- ny = cury+BDEPTH-1; nx = curx;
- break;
- case 'j': case '2':
-#ifdef KEY_MIN
- case KEY_DOWN:
-#endif /* KEY_MIN */
- ny = cury+1; nx = curx;
- break;
- case 'h': case '4':
-#ifdef KEY_MIN
- case KEY_LEFT:
-#endif /* KEY_MIN */
- ny = cury; nx = curx+BWIDTH-1;
- break;
- case 'l': case '6':
-#ifdef KEY_MIN
- case KEY_RIGHT:
-#endif /* KEY_MIN */
- ny = cury; nx = curx+1;
- break;
- case 'y': case '7':
-#ifdef KEY_MIN
- case KEY_A1:
-#endif /* KEY_MIN */
- ny = cury+BDEPTH-1; nx = curx+BWIDTH-1;
- break;
- case 'b': case '1':
-#ifdef KEY_MIN
- case KEY_C1:
-#endif /* KEY_MIN */
- ny = cury+1; nx = curx+BWIDTH-1;
- break;
- case 'u': case '9':
-#ifdef KEY_MIN
- case KEY_A3:
-#endif /* KEY_MIN */
- ny = cury+BDEPTH-1; nx = curx+1;
- break;
- case 'n': case '3':
-#ifdef KEY_MIN
- case KEY_C3:
-#endif /* KEY_MIN */
- ny = cury+1; nx = curx+1;
- break;
- case FF:
- nx = curx; ny = cury;
- (void)clearok(stdscr, TRUE);
- (void)refresh();
- break;
- default:
- if (atcpu)
- (void) mvaddstr(CYBASE + BDEPTH + 1, CXBASE + 11, " ");
- else
- (void) mvaddstr(PYBASE + BDEPTH + 1, PXBASE + 11, " ");
- return(c);
- }
-
- curx = nx % BWIDTH;
- cury = ny % BDEPTH;
- }
-}
-
-static int collidecheck(b, y, x)
-/* is this location on the selected zboard adjacent to a ship? */
-int b;
-int y, x;
-{
- int collide;
-
- /* anything on the square */
- if (collide = IS_SHIP(board[b][x][y]))
- return(collide);
-
- /* anything on the neighbors */
- if (!closepack)
- {
- int i;
-
- for (i = 0; i < 8; i++)
- {
- int xend, yend;
-
- yend = y + yincr[i];
- xend = x + xincr[i];
- if (ONBOARD(xend, yend))
- collide += IS_SHIP(board[b][xend][yend]);
- }
- }
- return(collide);
-}
-
-static bool checkplace(b, ss, vis)
-int b;
-ship_t *ss;
-int vis;
-{
- int l, xend, yend;
-
- /* first, check for board edges */
- xend = ss->x + ss->length * xincr[ss->dir];
- yend = ss->y + ss->length * yincr[ss->dir];
- if (!ONBOARD(xend, yend))
- {
- if (vis)
- switch(rnd(3))
- {
- case 0:
- error("Ship is hanging from the edge of the world");
- break;
- case 1:
- error("Try fitting it on the board");
- break;
- case 2:
- error("Figure I won't find it if you put it there?");
- break;
- }
- return(0);
- }
-
- for(l = 0; l < ss->length; ++l)
- {
- if(collidecheck(b, ss->y+l*yincr[ss->dir], ss->x+l*xincr[ss->dir]))
- {
- if (vis)
- switch(rnd(3))
- {
- case 0:
- error("There's already a ship there");
- break;
- case 1:
- error("Collision alert! Aaaaaagh!");
- break;
- case 2:
- error("Er, Admiral, what about the other ship?");
- break;
- }
- return(FALSE);
- }
- }
- return(TRUE);
-}
-
-static int awinna()
-{
- int i, j;
- ship_t *ss;
-
- for(i=0; i<2; ++i)
- {
- ss = (i) ? cpuship : plyship;
- for(j=0; j < SHIPTYPES; ++j, ++ss)
- if(ss->length > ss->hits)
- break;
- if (j == SHIPTYPES)
- return(OTHER);
- }
- return(-1);
-}
-
-static ship_t *hitship(x, y)
-/* register a hit on the targeted ship */
-int x, y;
-{
- ship_t *sb, *ss;
- char sym;
- int oldx, oldy;
-
- getyx(stdscr, oldy, oldx);
- sb = (turn) ? plyship : cpuship;
- if(!(sym = board[OTHER][x][y]))
- return((ship_t *)NULL);
- for(ss = sb; ss < sb + SHIPTYPES; ++ss)
- if(ss->symbol == sym)
- {
- if (++ss->hits < ss->length) /* still afloat? */
- return((ship_t *)NULL);
- else /* sunk! */
- {
- int i, j;
-
- if (!closepack)
- for (j = -1; j <= 1; j++)
- {
- int bx = ss->x + j * xincr[(ss->dir + 2) % 8];
- int by = ss->y + j * yincr[(ss->dir + 2) % 8];
-
- for (i = -1; i <= ss->length; ++i)
- {
- int x, y;
-
- x = bx + i * xincr[ss->dir];
- y = by + i * yincr[ss->dir];
- if (ONBOARD(x, y))
- {
- hits[turn][x][y] = MARK_MISS;
- if (turn % 2 == PLAYER)
- {
- cgoto(y, x);
-#ifdef A_COLOR
- if (has_colors())
- attron(COLOR_PAIR(COLOR_GREEN));
-#endif /* A_COLOR */
- (void)addch(MARK_MISS);
-#ifdef A_COLOR
- attrset(0);
-#endif /* A_COLOR */
- }
- }
- }
- }
-
- for (i = 0; i < ss->length; ++i)
- {
- int x = ss->x + i * xincr[ss->dir];
- int y = ss->y + i * yincr[ss->dir];
-
- hits[turn][x][y] = ss->symbol;
- if (turn % 2 == PLAYER)
- {
- cgoto(y, x);
- (void) addch(ss->symbol);
- }
- }
-
- (void) move(oldy, oldx);
- return(ss);
- }
- }
- (void) move(oldy, oldx);
- return((ship_t *)NULL);
-}
-
-static int plyturn()
-{
- ship_t *ss;
- bool hit;
- char *m;
-
- prompt(1, "Where do you want to shoot? ");
- for (;;)
- {
- (void) getcoord(COMPUTER);
- if (hits[PLAYER][curx][cury])
- {
- prompt(1, "You shelled this spot already! Try again.");
- beep();
- }
- else
- break;
- }
- hit = IS_SHIP(board[COMPUTER][curx][cury]);
- hits[PLAYER][curx][cury] = hit ? MARK_HIT : MARK_MISS;
- cgoto(cury, curx);
-#ifdef A_COLOR
- if (has_colors())
- if (hit)
- attron(COLOR_PAIR(COLOR_RED));
- else
- attron(COLOR_PAIR(COLOR_GREEN));
-#endif /* A_COLOR */
- (void) addch((chtype)hits[PLAYER][curx][cury]);
-#ifdef A_COLOR
- attrset(0);
-#endif /* A_COLOR */
-
- prompt(1, "You %s.", hit ? "scored a hit" : "missed");
- if(hit && (ss = hitship(curx, cury)))
- {
- switch(rnd(5))
- {
- case 0:
- m = " You sank my %s!";
- break;
- case 1:
- m = " I have this sinking feeling about my %s....";
- break;
- case 2:
- m = " My %s has gone to Davy Jones's locker!";
- break;
- case 3:
- m = " Glub, glub -- my %s is headed for the bottom!";
- break;
- case 4:
- m = " You'll pick up survivors from my my %s, I hope...!";
- break;
- }
- (void)printw(m, ss->name);
- (void)beep();
- return(awinna() == -1);
- }
- return(hit);
-}
-
-static int sgetc(s)
-char *s;
-{
- char *s1;
- int ch;
-
- (void)refresh();
- for(;;)
- {
- ch = getch();
- if (islower(ch))
- ch = toupper(ch);
- if (ch == CTRLC)
- uninitgame();
- for (s1=s; *s1 && ch != *s1; ++s1)
- continue;
- if (*s1)
- {
- (void) addch((chtype)ch);
- (void)refresh();
- return(ch);
- }
- }
-}
-
-
-static void randomfire(px, py)
-/* random-fire routine -- implements simple diagonal-striping strategy */
-int *px, *py;
-{
- static int turncount = 0;
- static int srchstep = BEGINSTEP;
- static int huntoffs; /* Offset on search strategy */
- int ypossible[BWIDTH * BDEPTH], xpossible[BWIDTH * BDEPTH], nposs;
- int ypreferred[BWIDTH * BDEPTH], xpreferred[BWIDTH * BDEPTH], npref;
- int x, y, i;
-
- if (turncount++ == 0)
- huntoffs = rnd(srchstep);
-
- /* first, list all possible moves */
- nposs = npref = 0;
- for (x = 0; x < BWIDTH; x++)
- for (y = 0; y < BDEPTH; y++)
- if (!hits[COMPUTER][x][y])
- {
- xpossible[nposs] = x;
- ypossible[nposs] = y;
- nposs++;
- if (((x+huntoffs) % srchstep) != (y % srchstep))
- {
- xpreferred[npref] = x;
- ypreferred[npref] = y;
- npref++;
- }
- }
-
- if (npref)
- {
- i = rnd(npref);
-
- *px = xpreferred[i];
- *py = ypreferred[i];
- }
- else if (nposs)
- {
- i = rnd(nposs);
-
- *px = xpossible[i];
- *py = ypossible[i];
-
- if (srchstep > 1)
- --srchstep;
- }
- else
- {
- error("No moves possible?? Help!");
- exit(1);
- /*NOTREACHED*/
- }
-}
-
-#define S_MISS 0
-#define S_HIT 1
-#define S_SUNK -1
-
-static bool cpufire(x, y)
-/* fire away at given location */
-int x, y;
-{
- bool hit, sunk;
- ship_t *ss;
-
- hits[COMPUTER][x][y] = (hit = (board[PLAYER][x][y])) ? MARK_HIT : MARK_MISS;
- (void) mvprintw(PROMPTLINE, 0,
- "I shoot at %c%d. I %s!", y + 'A', x, hit ? "hit" : "miss");
- if (sunk = (hit && (ss = hitship(x, y))))
- (void) printw(" I've sunk your %s", ss->name);
- (void)clrtoeol();
-
- pgoto(y, x);
-#ifdef A_COLOR
- if (has_colors())
- if (hit)
- attron(COLOR_PAIR(COLOR_RED));
- else
- attron(COLOR_PAIR(COLOR_GREEN));
-#endif /* A_COLOR */
- (void)addch((chtype)(hit ? SHOWHIT : SHOWSPLASH));
-#ifdef A_COLOR
- attrset(0);
-#endif /* A_COLOR */
-
- return(hit ? (sunk ? S_SUNK : S_HIT) : S_MISS);
-}
-
-/*
- * This code implements a fairly irregular FSM, so please forgive the rampant
- * unstructuredness below. The five labels are states which need to be held
- * between computer turns.
- */
-static bool cputurn()
-{
-#define POSSIBLE(x, y) (ONBOARD(x, y) && !hits[COMPUTER][x][y])
-#define RANDOM_FIRE 0
-#define RANDOM_HIT 1
-#define HUNT_DIRECT 2
-#define FIRST_PASS 3
-#define REVERSE_JUMP 4
-#define SECOND_PASS 5
- static int next = RANDOM_FIRE;
- static bool used[4];
- static ship_t ts;
- int navail, x, y, d, n, hit = S_MISS;
-
- switch(next)
- {
- case RANDOM_FIRE: /* last shot was random and missed */
- refire:
- randomfire(&x, &y);
- if (!(hit = cpufire(x, y)))
- next = RANDOM_FIRE;
- else
- {
- ts.x = x; ts.y = y;
- ts.hits = 1;
- next = (hit == S_SUNK) ? RANDOM_FIRE : RANDOM_HIT;
- }
- break;
-
- case RANDOM_HIT: /* last shot was random and hit */
- used[E/2] = used[S/2] = used[W/2] = used[N/2] = FALSE;
- /* FALLTHROUGH */
-
- case HUNT_DIRECT: /* last shot hit, we're looking for ship's long axis */
- for (d = navail = 0; d < 4; d++)
- {
- x = ts.x + xincr[d*2]; y = ts.y + yincr[d*2];
- if (!used[d] && POSSIBLE(x, y))
- navail++;
- else
- used[d] = TRUE;
- }
- if (navail == 0) /* no valid places for shots adjacent... */
- goto refire; /* ...so we must random-fire */
- else
- {
- for (d = 0, n = rnd(navail) + 1; n; n--)
- while (used[d])
- d++;
-
- assert(d <= 4);
-
- used[d] = FALSE;
- x = ts.x + xincr[d*2];
- y = ts.y + yincr[d*2];
-
- assert(POSSIBLE(x, y));
-
- if (!(hit = cpufire(x, y)))
- next = HUNT_DIRECT;
- else
- {
- ts.x = x; ts.y = y; ts.dir = d*2; ts.hits++;
- next = (hit == S_SUNK) ? RANDOM_FIRE : FIRST_PASS;
- }
- }
- break;
-
- case FIRST_PASS: /* we have a start and a direction now */
- x = ts.x + xincr[ts.dir];
- y = ts.y + yincr[ts.dir];
- if (POSSIBLE(x, y) && (hit = cpufire(x, y)))
- {
- ts.x = x; ts.y = y; ts.hits++;
- next = (hit == S_SUNK) ? RANDOM_FIRE : FIRST_PASS;
- }
- else
- next = REVERSE_JUMP;
- break;
-
- case REVERSE_JUMP: /* nail down the ship's other end */
- d = ts.dir + 4;
- x = ts.x + ts.hits * xincr[d];
- y = ts.y + ts.hits * yincr[d];
- if (POSSIBLE(x, y) && (hit = cpufire(x, y)))
- {
- ts.x = x; ts.y = y; ts.dir = d; ts.hits++;
- next = (hit == S_SUNK) ? RANDOM_FIRE : SECOND_PASS;
- }
- else
- next = RANDOM_FIRE;
- break;
-
- case SECOND_PASS: /* kill squares not caught on first pass */
- x = ts.x + xincr[ts.dir];
- y = ts.y + yincr[ts.dir];
- if (POSSIBLE(x, y) && (hit = cpufire(x, y)))
- {
- ts.x = x; ts.y = y; ts.hits++;
- next = (hit == S_SUNK) ? RANDOM_FIRE: SECOND_PASS;
- break;
- }
- else
- next = RANDOM_FIRE;
- break;
- }
-
- /* check for continuation and/or winner */
- if (salvo)
- {
- (void)refresh();
- (void)sleep(1);
- }
- if (awinna() != -1)
- return(FALSE);
-
-#ifdef DEBUG
- (void) mvprintw(PROMPTLINE + 2, 0,
- "New state %d, x=%d, y=%d, d=%d",
- next, x, y, d);
-#endif /* DEBUG */
- return(hit);
-}
-
-playagain()
-{
- int j;
- ship_t *ss;
-
- for (ss = cpuship; ss < cpuship + SHIPTYPES; ss++)
- for(j = 0; j < ss->length; j++)
- {
- cgoto(ss->y + j * yincr[ss->dir], ss->x + j * xincr[ss->dir]);
- (void)addch((chtype)ss->symbol);
- }
-
- if(awinna())
- ++cpuwon;
- else
- ++plywon;
- j = 18 + strlen(name);
- if(plywon >= 10)
- ++j;
- if(cpuwon >= 10)
- ++j;
- (void) mvprintw(1,(COLWIDTH-j)/2,
- "%s: %d Computer: %d",name,plywon,cpuwon);
-
- prompt(2, (awinna()) ? "Want to be humiliated again, %s [yn]? "
- : "Going to give me a chance for revenge, %s [yn]? ",name);
- return(sgetc("YN") == 'Y');
-}
-
-static void do_options(c,op)
-int c;
-char *op[];
-{
- register int i;
-
- if (c > 1)
- {
- for (i=1; i<c; i++)
- {
- switch(op[i][0])
- {
- default:
- case '?':
- (void) fprintf(stderr, "Usage: battle [-s | -b] [-c]\n");
- (void) fprintf(stderr, "\tWhere the options are:\n");
- (void) fprintf(stderr, "\t-s : play a salvo game\n");
- (void) fprintf(stderr, "\t-b : play a blitz game\n");
- (void) fprintf(stderr, "\t-c : ships may be adjacent\n");
- exit(1);
- break;
- case '-':
- switch(op[i][1])
- {
- case 'b':
- blitz = 1;
- if (salvo == 1)
- {
- (void) fprintf(stderr,
- "Bad Arg: -b and -s are mutually exclusive\n");
- exit(1);
- }
- break;
- case 's':
- salvo = 1;
- if (blitz == 1)
- {
- (void) fprintf(stderr,
- "Bad Arg: -s and -b are mutually exclusive\n");
- exit(1);
- }
- break;
- case 'c':
- closepack = 1;
- break;
- default:
- (void) fprintf(stderr,
- "Bad arg: type \"%s ?\" for usage message\n", op[0]);
- exit(1);
- }
- }
- }
- }
-}
-
-static int scount(who)
-int who;
-{
- register int i, shots;
- register ship_t *sp;
-
- if (who)
- sp = cpuship; /* count cpu shots */
- else
- sp = plyship; /* count player shots */
-
- for (i=0, shots = 0; i < SHIPTYPES; i++, sp++)
- {
- if (sp->hits >= sp->length)
- continue; /* dead ship */
- else
- shots++;
- }
- return(shots);
-}
-
-main(argc, argv)
-int argc;
-char *argv[];
-{
- do_options(argc, argv);
-
- intro();
- do {
- initgame();
- while(awinna() == -1)
- {
- if (!blitz)
- {
- if (!salvo)
- {
- if(turn)
- (void) cputurn();
- else
- (void) plyturn();
- }
- else
- {
- register int i;
-
- i = scount(turn);
- while (i--)
- {
- if (turn)
- {
- if (cputurn() && awinna() != -1)
- i = 0;
- }
- else
- {
- if (plyturn() && awinna() != -1)
- i = 0;
- }
- }
- }
- }
- else
- while(turn ? cputurn() : plyturn())
- continue;
- turn = OTHER;
- }
- } while
- (playagain());
- uninitgame();
- /*NOTREACHED*/
-}
-
-/* bs.c ends here */
diff --git a/lib/libncurses/TESTS/gdc.c b/lib/libncurses/TESTS/gdc.c
deleted file mode 100644
index 84bd651..0000000
--- a/lib/libncurses/TESTS/gdc.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Grand digital clock for curses compatible terminals
- * Usage: gdc [-s] [n] -- run for n seconds (default infinity)
- * Flags: -s: scroll
- *
- * modified 10-18-89 for curses (jrl)
- * 10-18-89 added signal handling
- */
-
-#include <time.h>
-#include <signal.h>
-#include <ncurses.h>
-#include <stdlib.h>
-#ifndef NONPOSIX
-#include <unistd.h>
-#endif
-
-#define YBASE 10
-#define XBASE 10
-#define XLENGTH 54
-#define YDEPTH 5
-
-/* it won't be */
-long now; /* yeah! */
-struct tm *tm;
-
-short disp[11] = {
- 075557, 011111, 071747, 071717, 055711,
- 074717, 074757, 071111, 075757, 075717, 002020
-};
-long old[6], next[6], new[6], mask;
-char scrol;
-
-int sigtermed=0;
-
-int hascolor = 0;
-
-void set(int, int);
-void standt(int);
-void movto(int, int);
-
-void sighndl(signo)
-int signo;
-{
- signal(signo, sighndl);
- sigtermed=signo;
-}
-
-int
-main(argc, argv)
-int argc;
-char **argv;
-{
-long t, a;
-int i, j, s, k;
-int n = 0;
-
- signal(SIGINT,sighndl);
- signal(SIGTERM,sighndl);
- signal(SIGKILL,sighndl);
-
- initscr();
- cbreak();
- noecho();
-
- hascolor = has_colors();
-
- if(hascolor) {
- start_color();
- init_pair(1, COLOR_BLACK, COLOR_RED);
- init_pair(2, COLOR_RED, COLOR_BLACK);
- init_pair(3, COLOR_WHITE, COLOR_BLACK);
- attrset(COLOR_PAIR(2));
- }
-
- clear();
- refresh();
- while(--argc > 0) {
- if(**++argv == '-')
- scrol = 1;
- else
- n = atoi(*argv);
- }
-
- if(hascolor) {
- attrset(COLOR_PAIR(3));
-
- mvaddch(YBASE - 1, XBASE - 1, ACS_ULCORNER);
- hline(ACS_HLINE, XLENGTH);
- mvaddch(YBASE - 1, XBASE + XLENGTH, ACS_URCORNER);
-
- mvaddch(YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER);
- hline(ACS_HLINE, XLENGTH);
- mvaddch(YBASE + YDEPTH, XBASE + XLENGTH, ACS_LRCORNER);
-
- move(YBASE, XBASE - 1);
- vline(ACS_VLINE, YDEPTH);
-
- move(YBASE, XBASE + XLENGTH);
- vline(ACS_VLINE, YDEPTH);
-
- attrset(COLOR_PAIR(2));
- }
- do {
- mask = 0;
- time(&now);
- tm = localtime(&now);
- set(tm->tm_sec%10, 0);
- set(tm->tm_sec/10, 4);
- set(tm->tm_min%10, 10);
- set(tm->tm_min/10, 14);
- set(tm->tm_hour%10, 20);
- set(tm->tm_hour/10, 24);
- set(10, 7);
- set(10, 17);
- for(k=0; k<6; k++) {
- if(scrol) {
- for(i=0; i<5; i++)
- new[i] = (new[i]&~mask) | (new[i+1]&mask);
- new[5] = (new[5]&~mask) | (next[k]&mask);
- } else
- new[k] = (new[k]&~mask) | (next[k]&mask);
- next[k] = 0;
- for(s=1; s>=0; s--) {
- standt(s);
- for(i=0; i<6; i++) {
- if((a = (new[i]^old[i])&(s ? new : old)[i]) != 0) {
- for(j=0,t=1<<26; t; t>>=1,j++) {
- if(a&t) {
- if(!(a&(t<<1))) {
- movto(YBASE + i, XBASE + 2*j);
- }
- addstr(" ");
- }
- }
- }
- if(!s) {
- old[i] = new[i];
- }
- }
- if(!s) {
- refresh();
- }
- }
- }
- movto(6, 0);
- refresh();
- sleep(1);
- if (sigtermed) {
- standend();
- clear();
- refresh();
- endwin();
- fprintf(stderr, "gdc terminated by signal %d\n", sigtermed);
- exit(1);
- }
- } while(--n);
- standend();
- clear();
- refresh();
- endwin();
- return(0);
-}
-
-void
-set(int t, int n)
-{
-int i, m;
-
- m = 7<<n;
- for(i=0; i<5; i++) {
- next[i] |= ((disp[t]>>(4-i)*3)&07)<<n;
- mask |= (next[i]^old[i])&m;
- }
- if(mask&m)
- mask |= m;
-}
-
-void
-standt(int on)
-{
- if (on) {
- if(hascolor) {
- attron(COLOR_PAIR(1));
- } else {
- attron(A_STANDOUT);
- }
- } else {
- if(hascolor) {
- attron(COLOR_PAIR(2));
- } else {
- attroff(A_STANDOUT);
- }
- }
-}
-
-void
-movto(int line, int col)
-{
- move(line, col);
-}
-
diff --git a/lib/libncurses/lib_deleteln.c b/lib/libncurses/lib_deleteln.c
deleted file mode 100644
index 054b99f..0000000
--- a/lib/libncurses/lib_deleteln.c
+++ /dev/null
@@ -1,49 +0,0 @@
-
-/* This work is copyrighted. See COPYRIGHT.OLD & COPYRIGHT.NEW for *
-* details. If they are missing then this copy is in violation of *
-* the copyright conditions. */
-
-/*
-** lib_deleteln.c
-**
-** The routine wdeleteln().
-**
-*/
-
-#include "curses.priv.h"
-#include <nterm.h>
-
-int wdeleteln(WINDOW *win)
-{
-chtype *end, *temp;
-int y, touched = 0;
-
- T(("wdeleteln(%x) called", win));
-
- temp = win->_line[win->_cury];
-
- if (win->_idlok && (delete_line != NULL)) {
- wrefresh(win);
- putp(delete_line);
- touched = 1;
- }
-
- for (y = win->_cury; y < win->_regbottom; y++) {
- win->_line[y] = win->_line[y+1];
-
- if (!touched) {
- win->_firstchar[y] = 0;
- win->_lastchar[y] = win->_maxx;
- }
- }
-
- win->_line[win->_regbottom] = temp;
- if (!touched) {
- win->_firstchar[win->_regbottom] = 0;
- win->_lastchar[win->_regbottom] = win->_maxx;
- }
-
- for (end = &(temp[win->_maxx]); temp <= end; )
- *temp++ = ' ';
- return OK;
-}
diff --git a/lib/libncurses/lib_insertln.c b/lib/libncurses/lib_insertln.c
deleted file mode 100644
index 4a39ce0..0000000
--- a/lib/libncurses/lib_insertln.c
+++ /dev/null
@@ -1,50 +0,0 @@
-
-/* This work is copyrighted. See COPYRIGHT.OLD & COPYRIGHT.NEW for *
-* details. If they are missing then this copy is in violation of *
-* the copyright conditions. */
-
-/*
-** lib_insertln.c
-**
-** The routine winsertln().
-**
-*/
-
-#include "curses.priv.h"
-#include <nterm.h>
-
-int winsertln(WINDOW *win)
-{
-chtype *temp, *end;
-int y, touched = 0;
-
- T(("winsertln(%x) called", win));
-
- temp = win->_line[win->_regbottom];
-
- if (win->_idlok && (insert_line != NULL)) {
- wrefresh(win);
- putp(insert_line);
- touched = 1;
- }
-
- if (!touched) {
- win->_firstchar[win->_cury] = 0;
- win->_lastchar[win->_cury] = win->_maxx;
- }
-
- for (y = win->_regbottom; y > win->_cury; y--) {
- win->_line[y] = win->_line[y-1];
-
- if (!touched) {
- win->_firstchar[y] = 0;
- win->_lastchar[y] = win->_maxx;
- }
- }
-
- win->_line[win->_cury] = temp;
-
- for (end = &temp[win->_maxx]; temp <= end; temp++)
- *temp = ' ';
- return OK;
-}
diff --git a/lib/libncurses/ncurses.h b/lib/libncurses/ncurses.h
deleted file mode 100644
index d9f615a..0000000
--- a/lib/libncurses/ncurses.h
+++ /dev/null
@@ -1,497 +0,0 @@
-
-/* This work is copyrighted. See COPYRIGHT.OLD & COPYRIGHT.NEW for *
-* details. If they are missing then this copy is in violation of *
-* the copyright conditions. */
-
-#ifndef __NCURSES_H
-#define __NCURSES_H
-#define CURSES 1
-#define CURSES_H 1
-
-#include <stdio.h>
-#include <stdarg.h>
-#ifndef NOTERMIOS
-#include <termios.h>
-#else
-#include <sgtty.h>
-#include <sys/ioctl.h>
-#endif
-#include <unctrl.h>
-
-#define bool char
-
-typedef unsigned long chtype;
-
-/* attributes */
-#define A_ATTRIBUTES 0xffffff00
-#define A_NORMAL 0x00000000
-#define A_STANDOUT 0x00010000
-#define A_UNDERLINE 0x00020000
-#define A_REVERSE 0x00040000
-#define A_BLINK 0x00080000
-#define A_DIM 0x00100000
-#define A_BOLD 0x00200000
-#define A_ALTCHARSET 0x00400000
-#define A_INVIS 0x00800000
-#define A_PROTECT 0x01000000
-#define A_CHARTEXT 0x000000ff
-#define A_COLOR 0x0000ff00
-#define COLOR_PAIR(n) (n << 8)
-#define PAIR_NUMBER(a) ((a & A_COLOR) >> 8)
-
-/* colors */
-extern int COLORS;
-extern int COLOR_PAIRS;
-extern unsigned char color_pairs[];
-
-#define COLOR_BLACK 0
-#define COLOR_RED 1
-#define COLOR_GREEN 2
-#define COLOR_YELLOW 3
-#define COLOR_BLUE 4
-#define COLOR_MAGENTA 5
-#define COLOR_CYAN 6
-#define COLOR_WHITE 7
-
-/* line graphics */
-
-extern chtype acs_map[];
-
-
-#define ACS_ULCORNER (acs_map['l'])
-#define ACS_LLCORNER (acs_map['m'])
-#define ACS_URCORNER (acs_map['k'])
-#define ACS_LRCORNER (acs_map['j'])
-#define ACS_RTEE (acs_map['u'])
-#define ACS_LTEE (acs_map['t'])
-#define ACS_BTEE (acs_map['v'])
-#define ACS_TTEE (acs_map['w'])
-#define ACS_HLINE (acs_map['q'])
-#define ACS_VLINE (acs_map['x'])
-#define ACS_PLUS (acs_map['n'])
-#define ACS_S1 (acs_map['o']) /* scan line 1 */
-#define ACS_S9 (acs_map['s']) /* scan line 9 */
-#define ACS_DIAMOND (acs_map['`']) /* diamond */
-#define ACS_CKBOARD (acs_map['a']) /* checker board (stipple) */
-#define ACS_DEGREE (acs_map['f']) /* degree symbol */
-#define ACS_PLMINUS (acs_map['g']) /* plus/minus */
-#define ACS_BULLET (acs_map['~']) /* bullet */
-#define ACS_LARROW (acs_map[',']) /* arrow pointing left */
-#define ACS_RARROW (acs_map['+']) /* arrow pointing right */
-#define ACS_DARROW (acs_map['.']) /* arrow pointing down */
-#define ACS_UARROW (acs_map['-']) /* arrow pointing up */
-#define ACS_BOARD (acs_map['h']) /* board of squares */
-#define ACS_LANTERN (acs_map['I']) /* lantern symbol */
-#define ACS_BLOCK (acs_map['0']) /* solid square block */
-
-#ifndef TRUE
-# define TRUE (1)
-# define FALSE (0)
-#endif
-
-#define ERR (-1)
-#define OK (0)
-
-#define _SUBWIN 0x01
-#define _ENDLINE 0x02
-#define _FULLWIN 0x04
-#define _SCROLLWIN 0x08
-#define _ISPAD 0x10
-#define _HASMOVED 0x20
-
-#define _NOCHANGE -1
-
-typedef struct screen SCREEN;
-typedef struct _win_st WINDOW;
-
-struct _win_st {
- short _cury, _curx; /* current cursor position */
- short _maxy, _maxx; /* maximum values of x and y NOT the screen dimensions */
- short _begy, _begx;
- short _flags;
- chtype _attrs;
- chtype _bkgd;
-
- /* The following should be consolidated into one bitset */
- bool _notimeout;
- bool _use_idc;
- bool _clear;
- bool _leave;
- bool _scroll;
- bool _idlok;
- bool _immed;
- bool _sync;
- bool _use_keypad; /* 0=no, 1=yes */
- bool _use_meta; /* T=use the meta key */
-
- int _delay; /* 0 = nodelay
- <0 = blocking
- >0 = delay */
- chtype **_line;
- short *_firstchar; /* First changed character in the line */
- short *_lastchar; /* Last changed character in the line */
- short _regtop; /* Top and bottom of scrolling region */
- short _regbottom;
- int _parx;
- int _pary;
- WINDOW *_parent; /* parent if a sub-window */
-};
-
-extern WINDOW *stdscr, *curscr, *newscr;
-
-extern int LINES, COLS;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern char ttytype[]; /* needed for backward compatibility */
-
-extern int tigetflag(char *);
-extern int tigetnum(char *);
-extern char *tigetstr(char *);
-
-/* Debugging : use with libdcurses.a */
-
-extern void _init_trace(void);
-extern void _tracef(char *, ...);
-extern char *_traceattr(int mode);
-extern void traceon(void);
-extern void traceoff(void);
-
-/* function prototypes */
-
-extern int baudrate(void);
-extern int beep(void);
-extern int cbreak(void);
-extern int clearok(WINDOW *,int);
-extern int copywin(WINDOW *,WINDOW *,int,int,int,int,int,int,int);
-extern int crmode(void);
-extern int curs_set(int);
-extern int def_prog_mode(void);
-extern int def_shell_mode(void);
-extern int delwin(WINDOW *);
-extern WINDOW *derwin(WINDOW *,int,int,int,int);
-extern int doupdate(void);
-extern int echo(void);
-extern int endwin(void);
-extern char erasechar(void);
-extern int flash(void);
-extern int flushinp(void);
-extern int idlok(WINDOW *,int);
-extern int is_linetouched(WINDOW *,int);
-extern int is_wintouched(WINDOW *);
-extern WINDOW *initscr(void);
-extern int isendwin(void);
-extern char *keyname(int);
-extern int keypad(WINDOW *,int);
-extern char killchar(void);
-extern int leaveok(WINDOW *,int);
-extern char *longname(void);
-extern int meta(WINDOW *,int);
-extern int mvcur(int,int,int,int);
-extern int mvprintw(int,int,char *,...);
-extern int mvscanw(int,int,char *,...);
-extern int mvwin(WINDOW *,int,int);
-extern int mvwprintw(WINDOW *,int,int,char *,...);
-extern int mvwscanw(WINDOW *,int,int,char *,...);
-extern WINDOW *newpad(int,int);
-extern SCREEN *newterm(char *,FILE *,FILE *);
-extern WINDOW *newwin(int,int,int,int);
-extern int nl(void);
-extern int nocbreak(void);
-extern int nocrmode(void);
-extern int nodelay(WINDOW *,int);
-extern int noecho(void);
-extern int nonl(void);
-extern int noraw(void);
-extern int overlay(WINDOW *,WINDOW *);
-extern int overwrite(WINDOW *,WINDOW *);
-extern int pnoutrefresh(WINDOW *,int,int,int,int,int,int);
-extern int prefresh(WINDOW *,int,int,int,int,int,int);
-extern int printw(char *,...);
-extern int putp(char *);
-extern int raw(void);
-extern int reset_prog_mode(void);
-extern int reset_shell_mode(void);
-extern int resetty(void);
-extern int ripoffline(int line, int (*init)(WINDOW *, int));
-extern int savetty(void);
-extern int scanw(char *,...);
-extern int scrollok(WINDOW *,int);
-extern SCREEN *set_term(SCREEN *);
-extern int setupterm(char *,int,int *);
-extern WINDOW *subwin(WINDOW *,int,int,int,int);
-extern char *tgoto(char *,int,int);
-extern int timeout(int);
-extern char *tparm(char *, ...);
-extern int tputs(char *,int,int (*)(char));
-extern int ungetch(int);
-extern int vidattr(chtype);
-extern int vidputs(chtype,int (*)(char));
-extern int vwscanw(WINDOW *,char *,va_list);
-extern int vwprintw(WINDOW *,char *,va_list);
-extern int waddch(WINDOW *,chtype);
-extern int waddchnstr(WINDOW *,chtype *,int);
-extern int waddnstr(WINDOW *,char *,int);
-extern int wattron(WINDOW *,chtype);
-extern int wborder(WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);
-extern int wclear(WINDOW *);
-extern int wclrtobot(WINDOW *);
-extern int wclrtoeol(WINDOW *);
-extern int wdelch(WINDOW *);
-extern int werase(WINDOW *);
-extern int wgetch(WINDOW *);
-extern int wgetnstr(WINDOW *,char *,int maxlen);
-extern int whline(WINDOW *,chtype,int);
-extern int winsch(WINDOW *,chtype);
-extern int winsdel(WINDOW *,int);
-extern int winsnstr(WINDOW *,char *,int);
-extern int wmove(WINDOW *,int,int);
-extern int wnoutrefresh(WINDOW *);
-extern int wprintw(WINDOW *,char *,...);
-extern int redrawln(WINDOW *,int,int);
-extern int wrefresh(WINDOW *);
-extern int wscanw(WINDOW *,char *,...);
-extern int wscrl(WINDOW *,int);
-extern int wsetscrreg(WINDOW *,int,int);
-extern int wtimeout(WINDOW *,int);
-extern int wtouchln(WINDOW *,int,int,int);
-extern int wvline(WINDOW *,chtype,int);
-
-extern bool can_change_color(void);
-extern int color_content(short,short *,short *, short *);
-extern int has_colors(void);
-extern int init_color(short,short,short,short);
-extern int init_pair(short,short,short);
-extern int pair_content(short,short*,short*);
-extern int start_color(void);
-
-extern int slk_init(int);
-extern int slk_set(int,char *,int);
-extern int slk_refresh(void);
-extern int slk_noutrefresh(void);
-extern char *slk_label(int);
-extern int slk_clear(void);
-extern int slk_restore(void);
-extern int slk_touch(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-/*
- * pseudo functions
- */
-#define wgetstr(w, s) wgetnstr(w, s, -1)
-
-#define napms(x) usleep(1000*x)
-#define setterm(term) setupterm(term, 1, (int *)0)
-
-#define fixterm() reset_prog_mode()
-#define resetterm() reset_shell_mode()
-#define saveterm() def_prog_mode()
-#define crmode() cbreak()
-#define nocrmode() nocbreak()
-#define gettmode()
-
-#define getyx(win,y,x) (y = (win)->_cury, x = (win)->_curx)
-#define getbegyx(win,y,x) (y = (win)->_begy, x = (win)->_begx)
-#define getmaxyx(win,y,x) (y = (win)->_maxy + 1, x = (win)->_maxx + 1)
-#define getsyx(y,x) getyx(stdscr, y, x)
-#define setsyx(y,x) (stdscr->_cury = y, stdscr->_curx = x)
-
-/* It seems older SYSV curses define these */
-#define getattrs(win) (win->_attrs)
-#define getmaxx(win) ((win)->_maxx + 1)
-#define getmaxy(win) ((win)->_maxy + 1)
-
-#define winch(win) ((win)->_line[(win)->_cury][(win)->_curx])
-#define wstandout(win) (wattrset(win,A_STANDOUT))
-#define wstandend(win) (wattrset(win,A_NORMAL))
-#define wattroff(win,at) ((win)->_attrs &= ~(at))
-#define wattrset(win,at) ((win)->_attrs = (at))
-
-#define subpad(p,l,c,y,x) derwin(p,l,c,y,x)
-#define scroll(win) wscrl(win,1)
-
-#define touchwin(win) wtouchln((win), 0, (win)->_maxy + 1, 1)
-#define touchline(win, s, c) wtouchln((win), s, c, 1)
-#define untouchwin(win) wtouchln((win), 0, (win)->_maxy + 1, 0)
-
-#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0)
-#define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
-#define hline(ch, n) whline(stdscr, ch, n)
-#define vline(ch, n) wvline(stdscr, ch, n)
-
-#define winsstr(w, s) winsnstr(w, s, 0)
-#define winsertln(w) winsdel(w, 1)
-#define wdeleteln(w) winsdel(w, -1)
-
-#define redrawwin(w) redrawln(w, 0, w->_maxy+1)
-
-/*
- * psuedo functions for standard screen
- */
-
-#define inch() winch(stdscr)
-#define standout() wstandout(stdscr)
-#define standend() wstandend(stdscr)
-#define attron(at) wattron(stdscr,at)
-#define attroff(at) wattroff(stdscr,at)
-#define attrset(at) wattrset(stdscr,at)
-#define addch(ch) waddch(stdscr,ch)
-#define getch() wgetch(stdscr)
-#define addstr(str) waddnstr(stdscr,str,-1)
-#define getstr(str) wgetstr(stdscr,str)
-#define move(y, x) wmove(stdscr,y,x)
-#define clear() wclear(stdscr)
-#define erase() werase(stdscr)
-#define clrtobot() wclrtobot(stdscr)
-#define clrtoeol() wclrtoeol(stdscr)
-#define insertln() winsertln(stdscr)
-#define deleteln() wdeleteln(stdscr)
-#define refresh() wrefresh(stdscr)
-#define insch(c) winsch(stdscr,c)
-#define delch() wdelch(stdscr)
-#define setscrreg(t,b) wsetscrreg(stdscr,t,b)
-#define scrl(n) wscrl(stdscr,n)
-#define timeout(delay) wtimeout(stdscr, delay)
-#define waddstr(win,str) waddnstr(win,str,-1)
-#define waddchstr(win,str) waddchnstr(win,str,-1)
-#define addchstr(str) waddchstr(stdscr, str)
-#define addchnstr(str, n) waddchnstr(stdscr, str, n)
-#define insdel(n) winsdel(stdscr, n)
-#define insstr(s) winsstr(stdscr, s)
-#define insnstr(s, n) winsnstr(stdscr, s, n)
-
-/*
- * mv functions
-*/
-
-#define mvwaddch(win,y,x,ch) (wmove(win,y,x) == ERR ? ERR : waddch(win,ch))
-#define mvwgetch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wgetch(win))
-#define mvwaddchnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n))
-#define mvwaddchstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1))
-#define mvwaddnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n))
-#define mvwaddstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1))
-#define mvwgetstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : wgetstr(win,str))
-#define mvwinch(win,y,x) (wmove(win,y,x) == ERR ? ERR : winch(win))
-#define mvwdelch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wdelch(win))
-#define mvwinsch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winsch(win,c))
-#define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch)
-#define mvgetch(y,x) mvwgetch(stdscr,y,x)
-#define mvaddnstr(y,x,str,n) mvwaddnstr(stdscr,y,x,str,n)
-#define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str)
-#define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str)
-#define mvinch(y,x) mvwinch(stdscr,y,x)
-#define mvdelch(y,x) mvwdelch(stdscr,y,x)
-#define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c)
-#define mvwinsstr(w, y, x, s) (wmove(w,y,x) == ERR ? ERR : winsstr(w,s))
-#define mvwinsnstr(w, y, x, s, n) (wmove(w,y,x) == ERR ? ERR : winsnstr(w,s,n))
-#define mvinsstr(y,x,s) mvwinsstr(stdscr,y,x,s)
-#define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,y,x,s,n)
-
-/* Funny "characters" enabled for various special function keys for input */
-/* Whether such a key exists depend if its definition is in the terminfo entry */
-
-#define KEY_MIN 0401 /* Minimum curses key */
-#define KEY_BREAK 0401 /* break key (unreliable) */
-#define KEY_DOWN 0402 /* The four arrow keys ... */
-#define KEY_UP 0403
-#define KEY_LEFT 0404
-#define KEY_RIGHT 0405 /* ... */
-#define KEY_HOME 0406 /* Home key (upward+left arrow) */
-#define KEY_BACKSPACE 0407 /* backspace (unreliable) */
-#define KEY_F0 0410 /* Function keys. Space for 64 */
-#define KEY_F(n) (KEY_F0+(n)) /* keys is reserved. */
-#define KEY_DL 0510 /* Delete line */
-#define KEY_IL 0511 /* Insert line */
-#define KEY_DC 0512 /* Delete character */
-#define KEY_IC 0513 /* Insert char or enter insert mode */
-#define KEY_EIC 0514 /* Exit insert char mode */
-#define KEY_CLEAR 0515 /* Clear screen */
-#define KEY_EOS 0516 /* Clear to end of screen */
-#define KEY_EOL 0517 /* Clear to end of line */
-#define KEY_SF 0520 /* Scroll 1 line forward */
-#define KEY_SR 0521 /* Scroll 1 line backwards (reverse) */
-#define KEY_NPAGE 0522 /* Next page */
-#define KEY_PPAGE 0523 /* Previous page */
-#define KEY_STAB 0524 /* Set tab */
-#define KEY_CTAB 0525 /* Clear tab */
-#define KEY_CATAB 0526 /* Clear all tabs */
-#define KEY_ENTER 0527 /* Enter or send (unreliable) */
-#define KEY_SRESET 0530 /* soft (partial) reset (unreliable) */
-#define KEY_RESET 0531 /* reset or hard reset (unreliable) */
-#define KEY_PRINT 0532 /* print or copy */
-#define KEY_LL 0533 /* home down or bottom (lower left) */
-
-/* The keypad is arranged like this: */
-/* a1 up a3 */
-/* left b2 right */
-/* c1 down c3 */
-
-#define KEY_A1 0534 /* Upper left of keypad */
-#define KEY_A3 0535 /* Upper right of keypad */
-#define KEY_B2 0536 /* Center of keypad */
-#define KEY_C1 0537 /* Lower left of keypad */
-#define KEY_C3 0540 /* Lower right of keypad */
-#define KEY_BTAB 0541 /* Back tab key */
-#define KEY_BEG 0542 /* beg(inning) key */
-#define KEY_CANCEL 0543 /* cancel key */
-#define KEY_CLOSE 0544 /* close key */
-#define KEY_COMMAND 0545 /* cmd (command) key */
-#define KEY_COPY 0546 /* copy key */
-#define KEY_CREATE 0547 /* create key */
-#define KEY_END 0550 /* end key */
-#define KEY_EXIT 0551 /* exit key */
-#define KEY_FIND 0552 /* find key */
-#define KEY_HELP 0553 /* help key */
-#define KEY_MARK 0554 /* mark key */
-#define KEY_MESSAGE 0555 /* message key */
-#define KEY_MOVE 0556 /* move key */
-#define KEY_NEXT 0557 /* next object key */
-#define KEY_OPEN 0560 /* open key */
-#define KEY_OPTIONS 0561 /* options key */
-#define KEY_PREVIOUS 0562 /* previous object key */
-#define KEY_REDO 0563 /* redo key */
-#define KEY_REFERENCE 0564 /* ref(erence) key */
-#define KEY_REFRESH 0565 /* refresh key */
-#define KEY_REPLACE 0566 /* replace key */
-#define KEY_RESTART 0567 /* restart key */
-#define KEY_RESUME 0570 /* resume key */
-#define KEY_SAVE 0571 /* save key */
-#define KEY_SBEG 0572 /* shifted beginning key */
-#define KEY_SCANCEL 0573 /* shifted cancel key */
-#define KEY_SCOMMAND 0574 /* shifted command key */
-#define KEY_SCOPY 0575 /* shifted copy key */
-#define KEY_SCREATE 0576 /* shifted create key */
-#define KEY_SDC 0577 /* shifted delete char key */
-#define KEY_SDL 0600 /* shifted delete line key */
-#define KEY_SELECT 0601 /* select key */
-#define KEY_SEND 0602 /* shifted end key */
-#define KEY_SEOL 0603 /* shifted clear line key */
-#define KEY_SEXIT 0604 /* shifted exit key */
-#define KEY_SFIND 0605 /* shifted find key */
-#define KEY_SHELP 0606 /* shifted help key */
-#define KEY_SHOME 0607 /* shifted home key */
-#define KEY_SIC 0610 /* shifted input key */
-#define KEY_SLEFT 0611 /* shifted left arrow key */
-#define KEY_SMESSAGE 0612 /* shifted message key */
-#define KEY_SMOVE 0613 /* shifted move key */
-#define KEY_SNEXT 0614 /* shifted next key */
-#define KEY_SOPTIONS 0615 /* shifted options key */
-#define KEY_SPREVIOUS 0616 /* shifted prev key */
-#define KEY_SPRINT 0617 /* shifted print key */
-#define KEY_SREDO 0620 /* shifted redo key */
-#define KEY_SREPLACE 0621 /* shifted replace key */
-#define KEY_SRIGHT 0622 /* shifted right arrow */
-#define KEY_SRSUME 0623 /* shifted resume key */
-#define KEY_SSAVE 0624 /* shifted save key */
-#define KEY_SSUSPEND 0625 /* shifted suspend key */
-#define KEY_SUNDO 0626 /* shifted undo key */
-#define KEY_SUSPEND 0627 /* suspend key */
-#define KEY_UNDO 0630 /* undo key */
-#define KEY_MAX 0777 /* Maximum curses key */
-
-#endif
diff --git a/lib/libncurses/termcap.h b/lib/libncurses/termcap.h
deleted file mode 100644
index 68fa7e5..0000000
--- a/lib/libncurses/termcap.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef _TERMCAP_H
-#define _TERMCAP_H 1
-
-#ifdef __FreeBSD__
-#include <sys/cdefs.h>
-#else
-#ifndef __P
-#if defined(__STDC__) || defined(__cplusplus)
-#define __P(protos) protos
-#else
-#define __P(protos) () /* traditional C preprocessor */
-#endif
-#endif
-#ifndef __BEGIN_DECLS
-#ifdef __cplusplus
-#define __BEGIN_DECLS extern "C" {
-#define __END_DECLS };
-#else
-#define __BEGIN_DECLS
-#define __END_DECLS
-#endif
-#endif
-#endif
-
-__BEGIN_DECLS
-
-#ifndef __FreeBSD__
-#include <sys/types.h>
-#endif
-
-extern char PC;
-extern char *UP;
-extern char *BC;
-#ifdef __FreeBSD__
-extern short ospeed;
-#else
-extern speed_t ospeed;
-#endif
-
-extern int tgetent __P((char *, const char *));
-extern int tgetflag __P((const char *));
-extern int tgetnum __P((const char *));
-extern char *tgetstr __P((const char *, char **));
-
-extern int tputs __P((const char *, int, int (*)(int)));
-
-extern char *tgoto __P((const char *, int, int));
-extern char *tparam __P((const char *, char *, int, ...));
-
-__END_DECLS
-
-#endif /* _TERMCAP_H */
diff --git a/lib/librpc/Makefile.inc b/lib/librpc/Makefile.inc
deleted file mode 100644
index 15759b5..0000000
--- a/lib/librpc/Makefile.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-# Temporarily force creation of librpc.so.2.0.
-#
-.include "${.CURDIR}/../../Makefile.inc"
diff --git a/lib/librpc/rpc/Makefile b/lib/librpc/rpc/Makefile
deleted file mode 100644
index 55ee25a..0000000
--- a/lib/librpc/rpc/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-# @(#)Makefile 5.12 (Berkeley) 7/15/92
-
-LIB= rpc
-CFLAGS+=-I${.CURDIR}/..
-SRCS= 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_mem.c \
- xdr_rec.c xdr_reference.c xdr_stdio.c
-
-UNSUPPORTED= xdr_float.c
-
-all: librpc.a
-
-.include <bsd.lib.mk>
diff --git a/lib/libskey/authfile.c b/lib/libskey/authfile.c
deleted file mode 100644
index ae7b0ac..0000000
--- a/lib/libskey/authfile.c
+++ /dev/null
@@ -1,177 +0,0 @@
- /* Portions taken from the skey distribution on Oct 21 1993 */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <string.h>
-#include <netdb.h>
-#include <arpa/inet.h>
-#include <stdio.h>
-#include <pwd.h>
-#include <syslog.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <skey.h>
-
-#if (MAXHOSTNAMELEN < 64) /* AIX weirdness */
-#undef MAXHOSTNAMELEN
-#endif
-
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 255
-#endif
-
-#include "pathnames.h"
-
-static int isaddr();
-static int rdnets();
-
-#define MAXADDR 16 /* how many addresses can a machine
- * have? */
-
- /*
- * Turn host into an IP address and then look it up in the authorization
- * database to determine if ordinary password logins are OK
- */
-int authfile(host)
-char *host;
-{
- char *addr[MAXADDR];
- char **ap;
- long n;
- struct hostent *hp;
- char **lp;
- struct hostent *xp;
- int addr_length;
-
- if (strlen(host) == 0) {
- /* Local login, okay */
- return 1;
- }
- if (isaddr(host)) {
- return rdnets(inet_addr(host));
- } else {
-
- /*
- * Stash away a copy of the host address list because it will be
- * clobbered by other gethostbyXXX() calls.
- */
-
- hp = gethostbyname(host);
- if (hp == NULL) {
- syslog(LOG_ERR, "unknown host: %s", host);
- return 0;
- }
- if (hp->h_addrtype != AF_INET) {
- syslog(LOG_ERR, "unknown network family: %d", hp->h_addrtype);
- return 0;
- }
- for (lp = hp->h_addr_list, ap = addr; ap < addr + MAXADDR; lp++, ap++) {
- if (*lp == NULL) {
- *ap = 0;
- break;
- } else {
- if ((*ap = malloc(hp->h_length)) == 0) {
- syslog(LOG_ERR, "out of memory");
- return 0;
- }
- memcpy(*ap, *lp, hp->h_length);
- }
- }
- addr_length = hp->h_length;
-
- /*
- * See if any of the addresses matches a pattern in the control file.
- * Report and skip the address if it does not belong to the remote
- * host. Assume localhost == localhost.domain.
- */
-
-#define NEQ(x,y) (strcasecmp((x),(y)) != 0)
-
- while (ap-- > addr) {
- memcpy((char *) &n, *ap, addr_length);
- if (rdnets(n)) {
- if ((hp = gethostbyaddr(*ap, addr_length, AF_INET)) == 0
- || (NEQ(host, hp->h_name) && NEQ(host, "localhost"))) {
- syslog(LOG_ERR, "IP address %s not registered for host %s",
- inet_ntoa(*(struct in_addr *) * ap), host);
- continue;
- }
- return 1;
- }
- }
- return 0;
- }
-}
-static int rdnets(host)
-unsigned long host;
-{
- FILE *fp;
- char buf[128],
- *cp;
- long pattern,
- mask;
- char *strtok();
- int permit_it = 0;
-
- /*
- * If auth file not found, be backwards compatible with standard login
- * and allow hard coded passwords in from anywhere. Some may consider
- * this a security hole, but backwards compatibility is more desirable
- * than others. If you don't like it, change the return value to be zero.
- */
- if ((fp = fopen(_PATH_SKEYACCESS, "r")) == NULL)
- return 1;
-
- while (fgets(buf, sizeof(buf), fp), !feof(fp)) {
- if (buf[0] == '#')
- continue; /* Comment */
- cp = strtok(buf, " \t");
- if (cp == NULL)
- continue;
- /* two choices permit or deny */
- if (strncasecmp(cp, "permit", 4) == 0) {
- permit_it = 1;
- } else {
- if (strncasecmp(cp, "deny", 4) == 0) {
- permit_it = 0;
- } else {
- continue; /* ignore this it is not
- * permit/deny */
- }
- }
- cp = strtok(NULL, " \t");
- if (cp == NULL)
- continue; /* Invalid line */
- pattern = inet_addr(cp);
- cp = strtok(NULL, " \t");
- if (cp == NULL)
- continue; /* Invalid line */
- mask = inet_addr(cp);
- if ((host & mask) == pattern) {
- fclose(fp);
- return permit_it;
- }
- }
- fclose(fp);
- return 0;
-}
-
- /*
- * Return TRUE if string appears to be an IP address in dotted decimal;
- * return FALSE otherwise (i.e., if string is a domain name)
- */
-static int isaddr(s)
-register char *s;
-{
- char c;
-
- if (s == NULL)
- return 1; /* Can't happen */
-
- while ((c = *s++) != '\0') {
- if (c != '[' && c != ']' && !isdigit(c) && c != '.')
- return 0;
- }
- return 1;
-}
diff --git a/lib/libskey/md4.c b/lib/libskey/md4.c
deleted file mode 100644
index 495f444..0000000
--- a/lib/libskey/md4.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * md4.c -- Implementation of MD4 Message Digest Algorithm
- * Updated: 2/16/90 by Ronald L. Rivest
- *
- * Portability nits fixed and reformatted - 2/12/91 Phil Karn
- *
- * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- * rights reserved.
- *
- * License to copy and use this software is granted provided that it
- * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
- * Algorithm" in all material mentioning or referencing this software
- * or this function.
- *
- * License is also granted to make and use derivative works provided
- * that such works are identified as "derived from the RSA Data
- * Security, Inc. MD5 Message-Digest Algorithm" in all material
- * mentioning or referencing the derived work.
- *
- * RSA Data Security, Inc. makes no representations concerning either
- * the merchantability of this software or the suitability of this
- * software for any particular purpose. It is provided "as is"
- * without express or implied warranty of any kind.
- *
- * These notices must be retained in any copies of any part of this
- * documentation and/or software.
- */
-
-/*
- * To use MD4:
- * -- Include md4.h in your program
- * -- Declare an MDstruct MD to hold the state of the digest computation.
- * -- Initialize MD using MDbegin(&MD)
- * -- For each full block (64 bytes) X you wish to process, call
- * MDupdate(&MD,X,512)
- * (512 is the number of bits in a full block.)
- * -- For the last block (less than 64 bytes) you wish to process,
- * MDupdate(&MD,X,n)
- * where n is the number of bits in the partial block. A partial
- * block terminates the computation, so every MD computation should
- * terminate by processing a partial block, even if it has n = 0.
- * -- The message digest is available in MD.buffer[0] ... MD.buffer[3].
- * (Least-significant byte of each word should be output first.)
- * -- You can print out the digest using MDprint(&MD)
- */
-
-/* Implementation notes:
- * This implementation assumes that longs are 32-bit quantities.
- * If the machine stores the least-significant byte of an long in the
- * least-addressed byte (eg., VAX and 8086), then LOWBYTEFIRST should be
- * set to TRUE. Otherwise (eg., SUNS), LOWBYTEFIRST should be set to
- * FALSE. Note that on machines with LOWBYTEFIRST FALSE the routine
- * MDupdate modifies has a side-effect on its input array (the order of bytes
- * in each word are reversed). If this is undesired a call to MDreverse(X) can
- * reverse the bytes of X back into order after each call to MDupdate.
- */
-#define TRUE 1
-#define FALSE 0
-
-#if (defined(__MSDOS__) || defined(MPU8086) || defined(MPU8080) \
- || defined(vax) || defined (MIPSEL))
-#define LOWBYTEFIRST TRUE /* Low order bytes are first in memory */
-#else /* Almost all other machines are big-endian */
-#define LOWBYTEFIRST FALSE
-#endif
-
-
-/* Compile-time includes */
-#include <stdio.h>
-#include "md4.h"
-
-/* Compile-time declarations of MD4 ``magic constants'' */
-#define I0 0x67452301 /* Initial values for MD buffer */
-#define I1 0xefcdab89
-#define I2 0x98badcfe
-#define I3 0x10325476
-#define C2 013240474631 /* round 2 constant = sqrt(2) in octal */
-#define C3 015666365641 /* round 3 constant = sqrt(3) in octal */
-/* C2 and C3 are from Knuth, The Art of Programming, Volume 2
- * (Seminumerical Algorithms), Second Edition (1981), Addison-Wesley.
- * Table 2, page 660.
- */
-#define fs1 3 /* round 1 shift amounts */
-#define fs2 7
-#define fs3 11
-#define fs4 19
-#define gs1 3 /* round 2 shift amounts */
-#define gs2 5
-#define gs3 9
-#define gs4 13
-#define hs1 3 /* round 3 shift amounts */
-#define hs2 9
-#define hs3 11
-#define hs4 15
-
-
-/* Compile-time macro declarations for MD4.
- * Note: The ``rot'' operator uses the variable ``tmp''.
- * It assumes tmp is declared as unsigned long, so that the >>
- * operator will shift in zeros rather than extending the sign bit.
- */
-#define f(X,Y,Z) ((X&Y) | ((~X)&Z))
-#define g(X,Y,Z) ((X&Y) | (X&Z) | (Y&Z))
-#define h(X,Y,Z) (X^Y^Z)
-#define rot(X,S) (tmp=X,(tmp<<S) | (tmp>>(32-S)))
-#define ff(A,B,C,D,i,s) A = rot((A + f(B,C,D) + X[i]),s)
-#define gg(A,B,C,D,i,s) A = rot((A + g(B,C,D) + X[i] + C2),s)
-#define hh(A,B,C,D,i,s) A = rot((A + h(B,C,D) + X[i] + C3),s)
-
-void MDreverse __P((unsigned long *X));
-
-/* MDprint(MDp)
- * Print message digest buffer MDp as 32 hexadecimal digits.
- * Order is from low-order byte of buffer[0] to high-order byte of buffer[3].
- * Each byte is printed with high-order hexadecimal digit first.
- * This is a user-callable routine.
- */
-void
-MDprint(MDp)
-MDptr MDp;
-{
- int i,j;
-
- for(i=0;i<4;i++)
- for(j=0;j<32;j=j+8)
- printf("%02lx",(MDp->buffer[i]>>j) & 0xFF);
-}
-
-/* MDbegin(MDp)
- * Initialize message digest buffer MDp.
- * This is a user-callable routine.
- */
-void
-MDbegin(MDp)
-MDptr MDp;
-{
- int i;
-
- MDp->buffer[0] = I0;
- MDp->buffer[1] = I1;
- MDp->buffer[2] = I2;
- MDp->buffer[3] = I3;
- for(i=0;i<8;i++)
- MDp->count[i] = 0;
- MDp->done = 0;
-}
-
-/* MDreverse(X)
- * Reverse the byte-ordering of every long in X.
- * Assumes X is an array of 16 longs.
- * The macro revx reverses the byte-ordering of the next word of X.
- */
-#define revx { t = (*X << 16) | (*X >> 16); \
- *X++ = ((t & 0xFF00FF00) >> 8) | ((t & 0x00FF00FF) << 8); }
-void
-MDreverse(X)
-unsigned long *X;
-{
- register unsigned long t;
-
- revx;
- revx;
- revx;
- revx;
- revx;
- revx;
- revx;
- revx;
- revx;
- revx;
- revx;
- revx;
- revx;
- revx;
- revx;
- revx;
-}
-
-/* MDblock(MDp,X)
- * Update message digest buffer MDp->buffer using 16-word data block X.
- * Assumes all 16 words of X are full of data.
- * Does not update MDp->count.
- * This routine is not user-callable.
- */
-static void
-MDblock(MDp,X)
-MDptr MDp;
-unsigned long *X;
-{
- register unsigned long tmp, A, B, C, D;
-
-#if LOWBYTEFIRST == FALSE
- MDreverse(X);
-#endif
- A = MDp->buffer[0];
- B = MDp->buffer[1];
- C = MDp->buffer[2];
- D = MDp->buffer[3];
- /* Update the message digest buffer */
- ff(A,B,C,D,0,fs1); /* Round 1 */
- ff(D,A,B,C,1,fs2);
- ff(C,D,A,B,2,fs3);
- ff(B,C,D,A,3,fs4);
- ff(A,B,C,D,4,fs1);
- ff(D,A,B,C,5,fs2);
- ff(C,D,A,B,6,fs3);
- ff(B,C,D,A,7,fs4);
- ff(A,B,C,D,8,fs1);
- ff(D,A,B,C,9,fs2);
- ff(C,D,A,B,10,fs3);
- ff(B,C,D,A,11,fs4);
- ff(A,B,C,D,12,fs1);
- ff(D,A,B,C,13,fs2);
- ff(C,D,A,B,14,fs3);
- ff(B,C,D,A,15,fs4);
- gg(A,B,C,D,0,gs1); /* Round 2 */
- gg(D,A,B,C,4,gs2);
- gg(C,D,A,B,8,gs3);
- gg(B,C,D,A,12,gs4);
- gg(A,B,C,D,1,gs1);
- gg(D,A,B,C,5,gs2);
- gg(C,D,A,B,9,gs3);
- gg(B,C,D,A,13,gs4);
- gg(A,B,C,D,2,gs1);
- gg(D,A,B,C,6,gs2);
- gg(C,D,A,B,10,gs3);
- gg(B,C,D,A,14,gs4);
- gg(A,B,C,D,3,gs1);
- gg(D,A,B,C,7,gs2);
- gg(C,D,A,B,11,gs3);
- gg(B,C,D,A,15,gs4);
- hh(A,B,C,D,0,hs1); /* Round 3 */
- hh(D,A,B,C,8,hs2);
- hh(C,D,A,B,4,hs3);
- hh(B,C,D,A,12,hs4);
- hh(A,B,C,D,2,hs1);
- hh(D,A,B,C,10,hs2);
- hh(C,D,A,B,6,hs3);
- hh(B,C,D,A,14,hs4);
- hh(A,B,C,D,1,hs1);
- hh(D,A,B,C,9,hs2);
- hh(C,D,A,B,5,hs3);
- hh(B,C,D,A,13,hs4);
- hh(A,B,C,D,3,hs1);
- hh(D,A,B,C,11,hs2);
- hh(C,D,A,B,7,hs3);
- hh(B,C,D,A,15,hs4);
- MDp->buffer[0] += A;
- MDp->buffer[1] += B;
- MDp->buffer[2] += C;
- MDp->buffer[3] += D;
-}
-
-/* MDupdate(MDp,X,count)
- * Input: MDp -- an MDptr
- * X -- a pointer to an array of unsigned characters.
- * count -- the number of bits of X to use.
- * (if not a multiple of 8, uses high bits of last byte.)
- * Update MDp using the number of bits of X given by count.
- * This is the basic input routine for an MD4 user.
- * The routine completes the MD computation when count < 512, so
- * every MD computation should end with one call to MDupdate with a
- * count less than 512. A call with count 0 will be ignored if the
- * MD has already been terminated (done != 0), so an extra call with count
- * 0 can be given as a ``courtesy close'' to force termination if desired.
- */
-void
-MDupdate(MDp,X,count)
-MDptr MDp;
-unsigned char *X;
-unsigned int count;
-{
- int i,bit,byte,mask;
- unsigned long tmp;
- unsigned char XX[64];
- unsigned char *p;
-
- /* return with no error if this is a courtesy close with count
- * zero and MDp->done is true.
- */
- if(count == 0 && MDp->done)
- return;
- /* check to see if MD is already done and report error */
- if(MDp->done){
- printf("\nError: MDupdate MD already done.");
- return;
- }
- /* Add count to MDp->count */
- tmp = count;
- p = MDp->count;
- while(tmp){
- tmp += *p;
- *p++ = tmp;
- tmp = tmp >> 8;
- }
- /* Process data */
- if(count == 512){
- /* Full block of data to handle */
- MDblock(MDp,(unsigned long *)X);
- } else if(count > 512){
- /* Check for count too large */
- printf("\nError: MDupdate called with illegal count value %ld.",count);
- return;
- } else {
- /* partial block -- must be last block so finish up
- * Find out how many bytes and residual bits there are
- */
- byte = count >> 3;
- bit = count & 7;
- /* Copy X into XX since we need to modify it */
- for(i=0;i<=byte;i++)
- XX[i] = X[i];
- for(i=byte+1;i<64;i++)
- XX[i] = 0;
- /* Add padding '1' bit and low-order zeros in last byte */
- mask = 1 << (7 - bit);
- XX[byte] = (XX[byte] | mask) & ~( mask - 1);
- /* If room for bit count, finish up with this block */
- if(byte <= 55){
- for(i=0;i<8;i++)
- XX[56+i] = MDp->count[i];
- MDblock(MDp,(unsigned long *)XX);
- } else {
- /* need to do two blocks to finish up */
- MDblock(MDp,(unsigned long *)XX);
- for(i=0;i<56;i++)
- XX[i] = 0;
- for(i=0;i<8;i++)
- XX[56+i] = MDp->count[i];
- MDblock(MDp,(unsigned long *)XX);
- }
- /* Set flag saying we're done with MD computation */
- MDp->done = 1;
- }
-}
-/* End of md4.c */
diff --git a/lib/libskey/md4.h b/lib/libskey/md4.h
deleted file mode 100644
index c0d3419..0000000
--- a/lib/libskey/md4.h
+++ /dev/null
@@ -1,47 +0,0 @@
-
-#include <sys/cdefs.h>
-
-/*
- *
- * md4.h -- Header file for implementation of MD4 Message Digest Algorithm
- * Updated: 2/13/90 by Ronald L. Rivest
- * (C) 1990 RSA Data Security, Inc.
- * Reformatted and de-linted - 2/12/91 Phil Karn
- */
-
-/* MDstruct is the data structure for a message digest computation. */
-typedef struct {
- unsigned long buffer[4];/* Holds 4-word result of MD computation */
- unsigned char count[8]; /* Number of bits processed so far */
- unsigned int done; /* Nonzero means MD computation finished */
-} MDstruct, *MDptr;
-
-/* MDbegin(MD)
- * Input: MD -- an MDptr
- * Initialize the MDstruct prepatory to doing a message digest computation.
- */
-extern void MDbegin __P((MDptr MDp));
-
-/* MDupdate(MD,X,count)
- * Input: MD -- an MDptr
- * X -- a pointer to an array of unsigned characters.
- * count -- the number of bits of X to use (an unsigned int).
- * Updates MD using the first ``count'' bits of X.
- * The array pointed to by X is not modified.
- * If count is not a multiple of 8, MDupdate uses high bits of last byte.
- * This is the basic input routine for a user.
- * The routine terminates the MD computation when count < 512, so
- * every MD computation should end with one call to MDupdate with a
- * count less than 512. Zero is OK for a count.
- */
-extern void MDupdate __P((MDptr MDp,unsigned char *X,unsigned int count));
-
-/* MDprint(MD)
- * Input: MD -- an MDptr
- * Prints message digest buffer MD as 32 hexadecimal digits.
- * Order is from low-order byte of buffer[0] to high-order byte of buffer[3].
- * Each byte is printed with high-order hexadecimal digit first.
- */
-extern void MDprint __P((MDptr MDp));
-
-/* End of md4.h */
diff --git a/lib/libterm/Makefile b/lib/libterm/Makefile
deleted file mode 100644
index 319899f..0000000
--- a/lib/libterm/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/4/93
-
-LIB= termcap
-CFLAGS+=-DCM_N -DCM_GT -DCM_B -DCM_D
-SRCS= termcap.c tgoto.c tputs.c
-
-MAN3= termcap.3
-MLINKS= termcap.3 tgetent.3 termcap.3 tgetflag.3 termcap.3 tgetnum.3 \
- termcap.3 tgetstr.3 termcap.3 tgoto.3 termcap.3 tputs.3
-LINKS= ${LIBDIR}/libtermcap.a ${LIBDIR}/libtermlib.a
-.if !defined(NOPROFILE)
-LINKS+= ${LIBDIR}/libtermcap_p.a ${LIBDIR}/libtermlib_p.a
-.endif
-
-.include <bsd.lib.mk>
diff --git a/lib/rpcsvc/Makefile b/lib/rpcsvc/Makefile
deleted file mode 100644
index 291b091..0000000
--- a/lib/rpcsvc/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-# from: @(#)Makefile 5.10 (Berkeley) 6/24/90
-# $Id: Makefile,v 1.6 1994/02/07 09:07:48 rgrimes Exp $
-
-.PATH: ${DESTDIR}/usr/include/rpcsvc
-
-LIB= rpcsvc
-
-RPCSRCS= klm_prot.x mount.x nfs_prot.x nlm_prot.x rex.x rnusers.x \
- rquota.x rstat.x rwall.x sm_inter.x spray.x yppasswd.x
-
-RPCCOM = rpcgen
-
-INCDIRS= -I/usr/include/rpcsvc
-CFLAGS+= ${INCDIRS}
-
-SRCS= ${RPCSRCS:R:S/$/_xdr.c/g}
-
-CLEANFILES+= ${SRCS} ${RPCSRCS}
-
-NOMAN= noman
-
-.include <bsd.lib.mk>
-
-.SUFFIXES: .x _xdr.c
-
-.x_xdr.c:
- @echo generating $@...
- @PWD=`pwd` ; cd ${.CURDIR} ; if cmp -s ${.IMPSRC} ${*F}.x > /dev/null; then :; else cp -f ${.IMPSRC} $$PWD/${*F}.x ; fi
- @${RPCCOM} -c ${*F}.x -o ${.TARGET}
-
-OBJS+= ${RPCSRCS:R:S/$/_xdr.o/g}
diff --git a/libexec/atrun/atrun.8 b/libexec/atrun/atrun.8
deleted file mode 100644
index ed6e359..0000000
--- a/libexec/atrun/atrun.8
+++ /dev/null
@@ -1,77 +0,0 @@
-.\"
-.\" Copyright (c) 1993 Christopher G. Demetriou
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by Christopher G. Demetriou.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\" derived from this software withough specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.\" $Id: atrun.8,v 1.1 1994/01/05 01:02:58 nate Exp $
-.\"
-.Dd December 5, 1993
-.Dt ATRUN 8
-.Os FreeBSD 1.1
-.Sh NAME
-.Nm atrun
-.Nd run jobs queued for later execution
-.\"
-.Sh SYOPSIS
-.Nm atrun
-.Sh DESCRIPTION
-The
-.Nm atrun
-utility runs commands queued by
-.Xr at 1 .
-It is usually invoked by
-.Xr crond 8
-every ten minutes.
-.Sh FILES
-.Bl -tag -width /var/at/lockfile -compact
-.It Pa /var/at/jobs
-Directory containing job files
-.It Pa /var/at/spool
-Directory containing output spool files
-.It Pa /var/at/lockfile
-Job-creation lock file.
-.El
-.Sh SEE ALSO
-.Xr crond 8 ,
-.Xr at 1
-.Sh AUTHOR
-.Bl -tag
-Thomas Koenig, ig25@rz.uni-karlsruhe.de
-.El
-.Sh BUGS
-The functionality of
-.Nm atrun
-should arguaby be merged into
-.Xr crond 8 .
-.Sh CAVEATS
-Since the default configuration causes
-.Nm atrun
-to be invoked every ten minutes,
-commands queued by
-.Xr at 1
-may end up being executed up to nine minutes
-later than would be otherwise expected.
diff --git a/libexec/atrun/atrun.h b/libexec/atrun/atrun.h
deleted file mode 100644
index be0588a..0000000
--- a/libexec/atrun/atrun.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 1993 Christopher G. Demetriou
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christopher G. Demetriou.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software withough specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id: atrun.h,v 1.1 1993/12/05 11:36:45 cgd Exp $
- */
-
-#define ATRUN_MAXLOAD 1.5
diff --git a/libexec/bugfiler/Makefile b/libexec/bugfiler/Makefile
deleted file mode 100644
index fb77633..0000000
--- a/libexec/bugfiler/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/4/93
-
-PROG= bugfiler
-CFLAGS+=-I${.CURDIR}
-SRCS= bugfiler.c error.c gethead.c process.c redist.c reply.c
-BINOWN= root
-BINMODE=4555
-MAN1= sendbug.1
-MAN8= bugfiler.8
-
-beforeinstall:
- install -c -o bin -g ${BINGRP} -m 555 \
- ${.CURDIR}/sendbug.sh ${DESTDIR}/usr/bin/sendbug
- install -c -o bin -g ${BINGRP} -m 444 ${.CURDIR}/bugformat \
- ${DESTDIR}/usr/share/misc
-
-.include <bsd.prog.mk>
diff --git a/libexec/getty/fbtab_stuff.c b/libexec/getty/fbtab_stuff.c
deleted file mode 100644
index 2ae5394..0000000
--- a/libexec/getty/fbtab_stuff.c
+++ /dev/null
@@ -1,93 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <syslog.h>
-#include <string.h>
-#include <errno.h>
-#include <dirent.h>
-
-#include "pathnames.h"
-
-#define WSPACE " \t\n"
-
-void reset_fbtab __P((char *tty));
-void reset_protect __P((char *table, char *path, int mask));
-
-/*
- * reset_fbtab - reset ownership to root/wheel and apply protections
- * specified in /etc/fbtab or logindevperm
- */
-
-void
-reset_fbtab(tty)
-char *tty;
-{
- FILE *fp;
- char buf[BUFSIZ];
- char *devname;
- char *cp;
- int prot;
- char *table;
-
- if ((fp = fopen(table = _PATH_FBTAB, "r")) == 0
- && (fp = fopen(table = _PATH_LOGINDEVPERM, "r")) == 0)
- return;
-
- while (fgets(buf, sizeof(buf), fp)) {
- if (cp = strchr(buf, '#'))
- *cp = 0; /* strip comment */
- if ((cp = devname = strtok(buf, WSPACE)) == 0)
- continue; /* empty or comment */
- if (strncmp(devname, "/dev/", 5) != 0
- || (cp = strtok((char *) 0, WSPACE)) == 0
- || *cp != '0'
- || sscanf(cp, "%o", &prot) == 0
- || prot == 0
- || (prot & 0777) != prot
- || (cp = strtok((char *) 0, WSPACE)) == 0) {
- syslog(LOG_ERR, "%s: bad entry: %s", table, cp ? cp : "(null)");
- continue;
- }
- if (strcmp(devname, tty) == 0) {
- for (cp = strtok(cp, ":"); cp; cp = strtok((char *) 0, ":")) {
- reset_protect(table, cp, prot);
- }
- }
- }
- fclose(fp);
-}
-
-/* reset_protect - protect one device entry */
-
-void
-reset_protect(table, path, mask)
-char *table;
-char *path;
-int mask;
-{
- char buf[BUFSIZ];
- int pathlen = strlen(path);
- struct dirent *ent;
- DIR *dir;
-
- if (strcmp("/*", path + pathlen - 2) != 0) {
- if (chmod(path, mask) && errno != ENOENT)
- syslog(LOG_ERR, "%s: chmod(%s): %m", table, path);
- if (chown(path, 0, 0) && errno != ENOENT)
- syslog(LOG_ERR, "%s: chown(%s): %m", table, path);
- } else {
- strcpy(buf, path);
- buf[pathlen - 1] = 0;
- if ((dir = opendir(buf)) == 0) {
- syslog(LOG_ERR, "%s: opendir(%s): %m", table, path);
- } else {
- while ((ent = readdir(dir)) != 0) {
- if (strcmp(ent->d_name, ".") != 0
- && strcmp(ent->d_name, "..") != 0) {
- strcpy(buf + pathlen - 1, ent->d_name);
- reset_protect(table, buf, mask);
- }
- }
- closedir(dir);
- }
- }
-}
diff --git a/libexec/kpasswdd/Makefile b/libexec/kpasswdd/Makefile
deleted file mode 100644
index edb9482..0000000
--- a/libexec/kpasswdd/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/4/93
-#
-# We do still make this one conditional on kerberos, in case
-# the libraries do not exist
-
-.if exists(${DESTDIR}/usr/lib/libkrb.a) && (defined(MAKE_KERBEROS) \
- || defined(MAKE_EBONES))
-
-PROG= kpasswdd
-SRCS= kpasswdd.c
-CFLAGS+=-DCRYPT -DKERBEROS -I${.CURDIR}/../../usr.bin/passwd
-DPADD= ${LIBKDB} ${LIBKRB} ${LIBDES}
-LDADD= -lkdb -lkrb -ldes
-.PATH: ${.CURDIR}/../../usr.bin/rlogin
-MAN8= kpasswdd.8
-DISTRIBUTION= krb
-
-.endif
-
-.include <bsd.prog.mk>
diff --git a/lkm/socksys/Makefile b/lkm/socksys/Makefile
deleted file mode 100644
index de8b44c..0000000
--- a/lkm/socksys/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# $Id$
-
-.PATH: ${.CURDIR}/../../sys/i386/ibcs2
-KMOD= socksys_mod
-SRCS= socksys.c ibcs2_socksys.c
-NOMAN=
-CFLAGS+= -DLKM -I. -DCOMPAT_IBCS2
-
-.include <bsd.kmod.mk>
diff --git a/lkm/socksys/socksys.c b/lkm/socksys/socksys.c
deleted file mode 100644
index 59d9aa2..0000000
--- a/lkm/socksys/socksys.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*-
- * Copyright (c) 1994 Søren Schmidt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer
- * in this position and unchanged.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software withough specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id: socksys.c,v 1.2 1995/01/24 04:22:19 bde Exp $
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/exec.h>
-#include <sys/conf.h>
-#include <sys/sysent.h>
-#include <sys/lkm.h>
-#include <sys/errno.h>
-
-int sockopen();
-int sockclose();
-int sockioctl();
-
-struct cdevsw dev_socksys = {
- (d_open_t *)sockopen, (d_close_t *)sockclose,
- (d_rdwr_t *)enodev, (d_rdwr_t *)enodev,
- (d_ioctl_t *)sockioctl, (d_stop_t *)enodev,
- (d_reset_t *)nullop, NULL,
- (d_select_t *)seltrue, (d_mmap_t *)enodev,
- NULL
-};
-
-MOD_DEV("socksys_mod", LM_DT_CHAR, -1, (void *)&dev_socksys)
-
-socksys_load(struct lkm_table *lkmtp, int cmd)
-{
- uprintf("socksys driver installed\n");
- return 0;
-}
-
-socksys_unload(struct lkm_table *lkmtp, int cmd)
-{
- uprintf("socksys driver removed\n");
- return 0;
-}
-
-socksys_init(struct lkm_table *lkmtp, int cmd, int ver)
-{
- DISPATCH(lkmtp, cmd, ver, socksys_load, socksys_unload, nosys);
-}
diff --git a/release/scripts/adduser.sh b/release/scripts/adduser.sh
deleted file mode 100755
index 3e7d92c..0000000
--- a/release/scripts/adduser.sh
+++ /dev/null
@@ -1,183 +0,0 @@
-#!/stand/sh
-#
-# Written: November 6th, 1994
-# Copyright (C) 1994 by Michael Reifenberger
-#
-# Permission to copy or use this software for any purpose is granted
-# provided that this message stay intact, and at this location (e.g. no
-# putting your name on top after doing something trivial like reindenting
-# it, just to make it look like you wrote it!).
-
-########################
-# First set some globals
-startuid=1000;
-startgid=1000;
-gname=guest
-uname=guest
-shell="/bin/csh"
-needgentry="NO"
-
-. /stand/scripts/miscfuncs.sh
-
-#########################
-# Some Functions we need.
-#
-###########################
-# Show the User all options
-usage() {
-message "
-adduser -h Prints help
-adduser -i For interactively adding users
-
-Command line options:
-adduser [-u UserName][-g GroupName][-s Shell]"
- exit 1
-}
-##########################
-# Get the next free UserID
-getuid() {
-local xx=$startuid;
-uid=$startuid;
-for i in `cut -f 3 -d : /etc/master.passwd | cut -c 2- | sort -n`; do
- if [ $i -lt $xx ]; then
- elif [ $i -eq $xx ]; then xx=`expr $xx + 1`
- else uid=$xx; return 0
- fi
-done
-}
-#######################################################
-# Get the next free GroupID or the GroupID of GroupName
-getgid() {
-local xx=$startgid;
-gid=$startgid;
-needgentry="YES"
-if grep -q \^$gname: /etc/group; then
- gid=`grep \^$gname: /etc/group | cut -f 3 -d:`
- needgentry="NO"
-else
- for i in `cut -f 3 -d : /etc/group | cut -c 2- | sort -n`; do
- if [ $i -lt $xx ]; then
- elif [ $i -eq $xx ]; then xx=`expr $xx + 1`
- else gid=$xx; return 0
- fi
- done
-fi
-}
-##########################################
-# Ask the User interactively what he wants
-interact() {
-dialog --title "Add New User Name" --clear \
---inputbox "Please specify a login name for the user:\n\
-Hit [return] for a default of <$uname>" -1 -1 2> /tmp/i.$$
-ret=$?
-case $ret in
- 0)
- if [ x`cat /tmp/i.$$` != x ]; then
- uname=`cat /tmp/i.$$`; fi;;
- 1|255)
- exit 1;;
-esac
-if grep -q \^$uname: /etc/master.passwd; then
- error "Username $uname already exists."
- exit 1
-fi
-dialog --title "Group Name" --clear \
---inputbox "Which group should $uname belong to?\n\
-Hit [return] for default of <$gname>" -1 -1 2> /tmp/i.$$
-ret=$?
-case $ret in
- 0)
- if [ x`cat /tmp/i.$$` != x ]; then
- gname=`cat /tmp/i.$$`; fi;;
- 1|255)
- exit 1;;
-esac
-dialog --title "Login Shell" --clear \
---inputbox "Please specify which login shell\n<$uname> should use\n\
-Hit [return] for default of <$shell>" -1 -1 2> /tmp/i.$$
-ret=$?
-case $ret in
- 0)
- if [ x`cat /tmp/i.$$` != x ]; then
- shell=`cat /tmp/i.$$`; fi;;
- 1|255)
- exit 1;;
-esac
-##############
-# Remove junk
-rm -f /tmp/i.$$
-}
-
-#########
-# START #
-#########
-
-###################################
-# Parse the commandline for options
-set -- `getopt hiu:g:s: $*`
-if [ $? != 0 ]; then
- usage
-fi
-for i; do
- case "$i"
- in
- -h)
- usage; shift;;
- -i)
- interact; shift; iflag=yes; break;;
- -u)
- uname=$2; shift; shift;;
- -g)
- gname=$2; shift; shift;;
- -s)
- shell=$2; shift; shift;;
- --)
- shift; break;;
-# *)
-# usage; shift;;
- esac
-done
-#####################
-# This is no Edituser
-if grep -q \^$uname: /etc/master.passwd; then
- error "This user already exists in the master password file.\n
-Use 'chpass' to edit an existing user rather than adduser.."
- exit 1;
-fi
-
-###############
-# Get Free ID's
-getuid;
-getgid;
-###################
-# Only if necessary
-if [ $needgentry = "YES" ]; then
- echo "$gname:*:$gid:$uname" >> /etc/group
-fi
-################
-# Make /home BTW
-mkdir -p -m755 /home/$uname
-if [ ! -d /home/$uname ]; then
- error "Could not create /home/$uname"
- exit 1
-else
- for xx in /usr/share/skel/*; do
- cp $xx /home/$uname/.`basename $xx | cut -f 2 -d .`
- done
-fi
-#####################
-# Make the User happy
-if [ ! -x $shell ]; then
- message "There is no <$shell> shell, using /bin/sh instead.\n
- If you wish, you can change this choice later with 'chpass'"
- shell="/bin/csh"
-elif ! grep -q $shell /etc/shells; then
- echo $shell >> /etc/shells
- echo "<$shell> added to /etc/shells"
-fi
-echo "$uname:*:$uid:$gid::0:0:User &:/home/$uname:$shell" >> /etc/master.passwd
-pwd_mkdb /etc/master.passwd
-chown -R $uname.$gname /home/$uname
-chmod -R 644 /home/$uname
-chmod 755 /home/$uname
-passwd $uname
diff --git a/release/scripts/bininst.sh b/release/scripts/bininst.sh
deleted file mode 100755
index daf6b72..0000000
--- a/release/scripts/bininst.sh
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/stand/sh
-#
-# bininst - perform the last stage of installation by somehow getting
-# a bindist onto the user's disk and unpacking it. The name bininst
-# is actually something of a misnomer, since this utility will install
-# more than just the bindist set.
-#
-# Written: November 11th, 1994
-# Copyright (C) 1994 by Jordan K. Hubbard
-#
-# Permission to copy or use this software for any purpose is granted
-# provided that this message stay intact, and at this location (e.g. no
-# putting your name on top after doing something trivial like reindenting
-# it, just to make it look like you wrote it!).
-#
-# $Id: bininst.sh,v 1.8 1995/02/02 23:39:44 jkh Exp $
-
-# Grab the miscellaneous functions.
-. /stand/scripts/miscfuncs.sh
-
-# Grab the installation routines
-. /stand/scripts/instdist.sh
-
-# Grab the network setup routines
-. /stand/scripts/netinst.sh
-
-# Grab the setup script
-. /stand/scripts/setup.sh
-
-# Deal with trigger-happy users.
-trap interrupt 1 2 15
-
-# set initial defaults
-set_defaults()
-{
- network_set_defaults
- media_set_defaults
- mkdir -p ${TMP}
- cp /stand/etc/* /etc
-}
-
-# Print welcome banner.
-welcome()
-{
-}
-
-goodbye()
-{
- dialog --title "Auf Wiedersehen!" --msgbox \
-"Don't forget that the login name \"root\" has no password.
-If you didn't create any users with adduser, you can at least log in
-as this user. Also be aware that root is the _superuser_, which means
-that you can easily wipe out your system with it if you're not careful!
-
-Further information may be obtained by sending mail to
-questions@freebsd.org (though please read the docs first,
-we get LOTS of questions! :-) or browsing through our
-WEB site: http://www.freebsd.org/
-
-If you encounter a bug and can send/receive Internet email, please
-use the \`send-pr\' command to submit a report - this will ensure
-that the bug is noted and tracked to some sort of resolution.
-
-Enjoy FreeBSD 2.0!
-
- The FreeBSD Project Team" -1 -1
-}
-
-welcome
-set_defaults
-
-if media_select_distribution; then
- if media_chose_method; then
- for xx in ${MEDIA_DISTRIBUTIONS}; do
- MEDIA_DISTRIBUTION=`eval echo \`echo $xx\``
- media_install_set
- done
- fi
- final_configuration
- goodbye
-fi
-
-echo; echo "Spawning shell. Exit shell to continue with new system."
-echo "Progress <installation completed>" > /dev/ttyv1
-/stand/sh
-exit 20
diff --git a/release/scripts/extract_DES.sh b/release/scripts/extract_DES.sh
deleted file mode 100644
index a41c472..0000000
--- a/release/scripts/extract_DES.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-# $Id: extract_secure.sh,v 1.7 1995/04/20 06:49:09 phk Exp $
-set -e
-PATH=/stand:$PATH
-DDIR=/
-
-DIST=DES
-# You can't write over the running init
-if [ -f /sbin/init ]; then mv /sbin/init /sbin/init.insecure; fi
-
-cat ${DIST}.?? | gzip -c -d | ( cd $DDIR; cpio -H tar -imdu )
-
-DDIR=/usr/src
-for DIST in sebones sDES ; do
- if [ -f ${DIST}.aa ]; then
- echo "Extracting ${DIST} sources"
- cat ${DIST}.?? | gzip -c -d | ( cd $DDIR; cpio -H tar -imdu )
- fi
-done
diff --git a/release/scripts/extract_bin.sh b/release/scripts/extract_bin.sh
deleted file mode 100644
index d6e7664..0000000
--- a/release/scripts/extract_bin.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-# $Id: extract_bin.sh,v 1.5 1995/04/09 03:44:03 jkh Exp $
-set -e
-PATH=/stand:$PATH
-DDIR=/
-
-
-# Temporary kludge for pathological bindist.
-if [ -f $DDIR/etc/sysconfig ]; then
- mv $DDIR/etc/sysconfig $DDIR/etc/sysconfig.save
-fi
-cat bin.?? | gzip -c -d | ( cd $DDIR; cpio -H tar -imdu )
-if [ -f $DDIR/etc/sysconfig.save ]; then
- mv $DDIR/etc/sysconfig.save $DDIR/etc/sysconfig
-fi
-
-# Save some space in the tarballs by not sending these bloated files...
-cd /usr/share/misc
-for i in termcap vgrindefs
-do
- echo "running cap_mkdb $i"
- /usr/bin/cap_mkdb $i
- /usr/sbin/chown bin.bin $i.db
- /bin/chmod 444 $i.db
-done
-
-chmod 1777 /tmp
diff --git a/release/scripts/extract_compat1x.sh b/release/scripts/extract_compat1x.sh
deleted file mode 100644
index a6af74d..0000000
--- a/release/scripts/extract_compat1x.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-# $Id: extract_compat1x.sh,v 1.1 1995/01/14 07:41:40 jkh Exp $
-set -e
-PATH=/stand:$PATH
-DDIR=/
-
-DIST=compat1x_tgz
-echo "Extracting ${DIST}"
-cat ${DIST}.?? | gzip -c -d | ( cd $DDIR; cpio -H tar -imdu )
diff --git a/release/scripts/extract_des.sh b/release/scripts/extract_des.sh
deleted file mode 100644
index 3eed9d7..0000000
--- a/release/scripts/extract_des.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-# $Id: extract_des.sh,v 1.1 1995/05/09 22:58:42 jkh Exp $
-set -e
-PATH=/stand:$PATH
-DDIR=/
-
-DIST=des
-# You can't write over the running init
-if [ -f /sbin/init ]; then mv /sbin/init /sbin/init.insecure; fi
-
-cat ${DIST}.?? | gzip -c -d | ( cd $DDIR; cpio -H tar -imdu )
-
-DDIR=/usr/src
-for DIST in sebones sdes ; do
- if [ -f ${DIST}.aa ]; then
- echo "Extracting ${DIST} sources"
- cat ${DIST}.?? | gzip -c -d | ( cd $DDIR; cpio -H tar -imdu )
- fi
-done
diff --git a/release/scripts/extract_dict.sh b/release/scripts/extract_dict.sh
deleted file mode 100644
index 74f9259..0000000
--- a/release/scripts/extract_dict.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-# $Id: extract_dict.sh,v 1.1 1995/01/14 07:41:41 jkh Exp $
-set -e
-PATH=/stand:$PATH
-DDIR=/
-
-DIST=dict
-echo "Extracting ${DIST}"
-cat ${DIST}.?? | gzip -c -d | ( cd $DDIR; cpio -H tar -imdu )
diff --git a/release/scripts/extract_games.sh b/release/scripts/extract_games.sh
deleted file mode 100644
index abcc8cf..0000000
--- a/release/scripts/extract_games.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-# $Id: extract_games.sh,v 1.2 1995/01/28 09:07:43 jkh Exp $
-set -e
-PATH=/stand:$PATH
-DDIR=/
-
-DIST=games
-echo "Extracting ${DIST} - ignore any errors from cpio"
-cat ${DIST}.?? | gzip -c -d | ( cd $DDIR; cpio -H tar -imdu )
diff --git a/release/scripts/extract_info.sh b/release/scripts/extract_info.sh
deleted file mode 100644
index f35ed05..0000000
--- a/release/scripts/extract_info.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-# $Id: extract_info.sh,v 1.1 1995/01/14 07:41:42 jkh Exp $
-set -e
-PATH=/stand:$PATH
-DDIR=/
-
-DIST=info
-echo "Extracting ${DIST}"
-cat ${DIST}.?? | gzip -c -d | ( cd $DDIR; cpio -H tar -imdu )
diff --git a/release/scripts/extract_manpages.sh b/release/scripts/extract_manpages.sh
deleted file mode 100644
index 46c046e..0000000
--- a/release/scripts/extract_manpages.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-# $Id: extract_manpages.sh,v 1.1 1995/01/14 07:41:43 jkh Exp $
-set -e
-PATH=/stand:$PATH
-DDIR=/
-
-DIST=manpages
-echo "Extracting ${DIST}"
-cat ${DIST}.?? | gzip -c -d | ( cd $DDIR; cpio -H tar -imdu )
diff --git a/release/scripts/extract_proflibs.sh b/release/scripts/extract_proflibs.sh
deleted file mode 100644
index f9ebf39..0000000
--- a/release/scripts/extract_proflibs.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-# $Id: extract_proflibs.sh,v 1.2 1995/01/28 09:11:36 jkh Exp $
-set -e
-PATH=/stand:$PATH
-DDIR=/
-
-DIST=proflibs
-echo "Extracting ${DIST} - ignore any errors from cpio"
-cat ${DIST}.?? | gzip -c -d | ( cd $DDIR; cpio -H tar -imdu )
diff --git a/release/scripts/extract_secure.sh b/release/scripts/extract_secure.sh
deleted file mode 100644
index 7a1eaff..0000000
--- a/release/scripts/extract_secure.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-# $Id: extract_secure.sh,v 1.6 1995/04/07 01:20:26 phk Exp $
-set -e
-PATH=/stand:$PATH
-DDIR=/
-
-DIST=secure
-# You can't write over the running init
-if [ -f /sbin/init ]; then mv /sbin/init /sbin/init.insecure; fi
-
-cat ${DIST}.?? | gzip -c -d | ( cd $DDIR; cpio -H tar -imdu )
-
-DDIR=/usr/src
-for DIST in sebones ssecure ; do
- if [ -f ${DIST}.aa ]; then
- echo "Extracting ${DIST} sources"
- cat ${DIST}.?? | gzip -c -d | ( cd $DDIR; cpio -H tar -imdu )
- fi
-done
diff --git a/release/scripts/extract_src.sh b/release/scripts/extract_src.sh
deleted file mode 100644
index 9e7f903..0000000
--- a/release/scripts/extract_src.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-# $Id: extract_src.sh,v 1.12 1995/03/28 08:01:47 phk Exp $
-PATH=/stand:$PATH
-DDIR=/usr/src
-
-mkdir -p $DDIR
-
-for T in s*.aa ; do
- DIST=`basename $T .aa`
- if [ -f ${DIST}.aa ]; then
- echo "Extracting ${DIST} sources"
- cat ${DIST}.?? |
- gzip -c -d | ( cd $DDIR; cpio -H tar -imdu )
- fi
-done
-rm -f /sys
-ln -fs /usr/src/sys /sys
diff --git a/release/scripts/extract_xf86311.sh b/release/scripts/extract_xf86311.sh
deleted file mode 100755
index 982c145..0000000
--- a/release/scripts/extract_xf86311.sh
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/stand/sh
-#
-# xf86311 - extract XFree86 3.1.1 onto a FreeBSD 2.1 system.
-#
-# Written: February 2nd, 1995
-# Copyright (C) 1995 by Jordan K. Hubbard
-#
-# Permission to copy or use this software for any purpose is granted
-# under the terms and conditions stated by the XFree86 Project, Inc.
-# copyright, which should also be in the file COPYRIGHT in this distribution.
-#
-# $Id: extract_xf86311.sh,v 1.8 1995/02/16 12:30:31 jkh Exp $
-
-PATH=/usr/X11R6/bin:/usr/X386/bin:.:$PATH
-
-X11PREFIX=/usr/X11R6
-XRELEASE="XFree86 3.1.1"
-
-# Handle the return value from a dialog, doing some pre-processing
-# so that each client doesn't have to.
-handle_rval()
-{
- case $1 in
- 0)
- return 0
- ;;
- 255)
- PS1="subshell# " /stand/sh
- ;;
- *)
- return 1
- ;;
- esac
-}
-
-do_selected_install()
-{
- for xx in ${SELECTIONS}; do
- DIST=`eval echo \`echo $xx\``
- dialog --infobox "Installing ${XRELEASE} component: ${DIST}" -1 -1
- tar --unlink -zxpf ${DIST}.tgz -C /usr
- done
-}
-
-do_configure()
-{
- if [ -f ${X11PREFIX}/bin/xf86config ]; then
- dialog --clear
- ${X11PREFIX}/bin/xf86config
- dialog --clear
- else
- dialog --msgbox "You must first install the X311bin component" -1 -1
- fi
-}
-
-do_select_menu()
-{
-dialog --title "Please select components from ${XRELEASE}" --checklist \
-"Please check off each desired component of ${XRELEASE} for subsequent\n\
-unpacking on your system. Most people will typically need only one\n\
-server, and the most reasonable choices have already been set for you by\n\
-default. When everything looks good, select OK to continue.\n\n\
-Server notation: 4 bit = 16 color, 8 bit = 256 color,\n\
-16 bit = 64k colors, 24 bit = true color." \
--1 -1 8 \
-"X311bin" "client applications and shared libs" ON \
-"X311fnts" "the misc and 75 dpi fonts" ON \
-"X311lib" "data files needed at runtime" ON \
-"X311xicf" "xinit runtime configuration file" ON \
-"X311xdcf" "xdm runtime configuration file" ON \
-"X3118514" "IBM 8514 and true compatibles - 8 bit" OFF \
-"X311AGX" "AGX boards - 8 bit" OFF \
-"X311Ma64" "ATI Mach64 boards - 8/16 bit" OFF \
-"X311Ma32" "ATI Mach32 boards - 8/16 bit" OFF \
-"X311Ma8" "ATI Mach8 boards - 8bit" OFF \
-"X311Mono" "VGA, Super-VGA, Hercules, and others - mono" OFF \
-"X311P9K" "Weitek P9000 boards (Diamond Viper) - 8/16/24 bit" OFF \
-"X311S3" "S3 boards: #9GXE, ActixGE32, SPEA Mercury - 8/16/24 bit" OFF \
-"X311SVGA" "Super-VGA cards - 8 bit" ON \
-"X311VG16" "VGA and Super-VGA cards - 4 bit" ON \
-"X311W32" "ET4000/W32, /W32i and /W32p cards - 8 bit" OFF \
-"X311nest" "A nested server running as a client." OFF \
-"X311doc" "READMEs and ${XRELEASE} specific man pages" ON \
-"X311man" "man pages except ${XRELEASE} specific ones in docs" OFF \
-"X311f100" "100dpi fonts" OFF \
-"X311fscl" "Speedo and Type1 fonts" OFF \
-"X311fnon" "Japanese, Chinese and other non-english fonts" OFF \
-"X311fsrv" "the font server and its man page" OFF \
-"X311prog" "config, lib*.a and *.h files needed only for compiling" OFF \
-"X311link" "X server reconfiguration kit" OFF \
-"X311pex" "PEX fonts and shared libs needed by PEX apps" OFF \
-"X311lbx" "low bandwidth X proxy server and libraries." OFF \
- 2> ${TMP}/X-selections.$$
- RETVAL=$?
- SELECTIONS=`cat ${TMP}/X-selections.$$`
- return ${RETVAL}
-}
-
-INSTALLING=yes
-while [ "${INSTALLING}" = "yes" ]; do
-dialog --title "${XRELEASE} Installation" --menu \
-"Welcome to the ${XRELEASE} installation menu for FreeBSD 2.x\n\n \
-Please chose one of the following options. It is also\n\
-recommended that choices be followed in order on this menu," \
--1 -1 7 \
- "COPYRIGHT" "Read the XFree86 Project, Inc.'s copyright notice" \
- "README" "General README file on ${XRELEASE} - recommended" \
- "FreeBSD" "General information specific to FreeBSD" \
- "Install" "Install selected components of ${XRELEASE}" \
- "Configure" "Configure XFree86 server for your card/monitor" \
- "startx" "Try to run startx and bring things up all the way" \
- "Exit" "Exit the installation." \
- 2> ${TMP}/menu.tmp.$$
- RETVAL=$?
- ANSWER=`cat ${TMP}/menu.tmp.$$`
- rm -f ${TMP}/menu.tmp.$$
- if ! handle_rval ${RETVAL}; then continue; fi
- case ${ANSWER} in
- COPYRIGHT) dialog --title "COPYRIGHT NOTICE" --textbox COPYRIGHT 20 78 ;;
- README) dialog --title "${XRELEASE} README" --textbox README 20 78 ;;
- FreeBSD) dialog --title "XFree86 and FreeBSD" --textbox README.FreeBSD 20 78 ;;
- Install) if do_select_menu; then do_selected_install; fi ;;
- Configure) do_configure ;;
- startx)
- if [ -x ${X11PREFIX}/bin/startx ]; then
- dialog --clear
- ${X11PREFIX}/bin/startx
- echo -n "[press return to continue] "
- read junk
- else
- dialog --title "Error" --msgbox "You must first install ${XRELEASE}." -1 -1
- fi
- ;;
- Exit) INSTALLING=no ;;
- esac
-done
diff --git a/release/scripts/instdist.sh b/release/scripts/instdist.sh
deleted file mode 100644
index 969a690..0000000
--- a/release/scripts/instdist.sh
+++ /dev/null
@@ -1,565 +0,0 @@
-#!/stand/sh
-#
-# instdist - Install a distribution from some sort of media.
-#
-# Written: November 11th, 1994
-# Copyright (C) 1994 by Jordan K. Hubbard
-#
-# Permission to copy or use this software for any purpose is granted
-# provided that this message stay intact, and at this location (e.g. no
-# putting your name on top after doing something trivial like reindenting
-# it, just to make it look like you wrote it!).
-#
-# $Id: instdist.sh,v 1.18 1995/04/09 09:01:56 jkh Exp $
-
-if [ "${_INSTINST_SH_LOADED_}" = "yes" ]; then
- return 0
-else
- _INSTINST_SH_LOADED_=yes
-fi
-
-# Grab the miscellaneous functions.
-. /stand/scripts/miscfuncs.sh
-
-# Set the initial state for media installation.
-media_set_defaults()
-{
- MEDIA_TYPE=""
- MEDIA_DEVICE=""
- MEDIA_DISTRIBUTIONS=""
- DISTRIB_SUBDIR=""
- TMPDIR=""
- FTP_PATH=""
- NFS_PATH=""
-}
-
-# Set the installation media to undefined.
-media_reset()
-{
- MEDIA_DEVICE=""
- MEDIA_TYPE=""
- MEDIA_DISTRIBUTIONS=""
- FTP_PATH=""
- NFS_PATH=""
- NFS_OPTIONS=""
-}
-
-# Set the location of our temporary unpacking directory.
-media_set_tmpdir()
-{
- if [ "X${TMPDIR}" != "X" ]; then
- return
- fi
-
- TITLE="Choose temporary directory"
- TMPDIR="/usr/tmp"
- DEFAULT_VALUE="${TMPDIR}"
- if ! input \
-"Please specify the name of a directory containing enough free
-space to hold the temporary files for this distribution. At
-minimum, a binary distribution will require around 21MB of
-temporary space. At maximum, a src distribution may take 30MB
-or more. If the directory you specify does not exist, it will
-be created for you. If you do not have enough free space to
-hold both the packed and unpacked distribution files, consider
-using the NFS or CDROM installation methods as they require no
-temporary storage."; then return 1; fi
- TMPDIR=${ANSWER}
- mkdir -p ${TMPDIR}
- return 0
-}
-
-media_cd_tmpdir()
-{
- if ! cd ${TMPDIR} > /dev/ttyv1 2>&1; then
- error "No such file or directory for ${TMPDIR}, sorry! Please fix this and try again."
- return 1
- fi
-}
-
-media_rm_tmpdir()
-{
- cd /
- if [ -d ${TMPDIR}/${MEDIA_DISTRIBUTION} ]; then
- _TARGET=${TMPDIR}/${MEDIA_DISTRIBUTION}
- else
- _TARGET=${TMPDIR}/
- fi
- if [ "X${NO_ASK_REMOVE}" != "X" ]; then
- rm -rf ${_TARGET} > /dev/null 2>&1
- return
- fi
- if dialog --title "Delete contents?" --yesno \
- "Do you wish to delete ${_TARGET}?" -1 -1; then
- rm -rf ${_TARGET} > /dev/null 2>&1
- if dialog --title "Future Confirmation?" --yesno \
- "Do you wish to suppress this dialog in the future?" -1 -1;
- then
- NO_ASK_REMOVE=yes
- fi
- fi
-}
-
-media_select_ftp_site()
-{
- dialog --title "Please specify an ftp site" --menu \
-"FreeBSD is distributed from a number of sites on the Internet.\n\
-Please select the site closest to you or \"other\" if you'd like\n\
-to specify another choice. Also note that not all sites carry\n\
-every possible distribution! Distributions other than the basic\n\
-binary set are only guaranteed to be available from the Primary site.\n\
-If the first site selected doesn't respond, try one of the alternates.\n\n\
-Please use arrow keys to scroll through all items." \
--1 -1 7 \
- "Primary" "ftp.freebsd.org" \
- "Secondary" "freefall.cdrom.com" \
- "Australia" "ftp.physics.usyd.edu.au" \
- "Finland" "nic.funet.fi" \
- "France" "ftp.ibp.fr" \
- "Germany" "ftp.uni-duisburg.de" \
- "Israel" "orgchem.weizmann.ac.il" \
- "Japan" "ftp.sra.co.jp" \
- "Japan-2" "ftp.mei.co.jp" \
- "Japan-3" "ftp.waseda.ac.jp" \
- "Japan-4" "ftp.pu-toyama.ac.jp" \
- "Japan-5" "ftpsv1.u-aizu.ac.jp" \
- "Japan-6" "tutserver.tutcc.tut.ac.jp" \
- "Japan-7" "ftp.ee.uec.ac.jp" \
- "Korea" "ftp.cau.ac.kr" \
- "Netherlands" "ftp.nl.net" \
- "Russia" "ftp.kiae.su" \
- "Sweden" "ftp.luth.se" \
- "Taiwan" "netbsd.csie.nctu.edu.tw" \
- "Thailand" "ftp.nectec.or.th" \
- "UK" "ftp.demon.co.uk" \
- "UK-2" "src.doc.ic.ac.uk" \
- "UK-3" "unix.hensa.ac.uk" \
- "USA" "ref.tfs.com" \
- "USA-2" "ftp.dataplex.net" \
- "USA-3" "kryten.atinc.com" \
- "USA-4" "ftp.neosoft.com" \
- "other" "None of the above. I want to specify my own." \
- 2> ${TMP}/menu.tmp.$$
- RETVAL=$?
- ANSWER=`cat ${TMP}/menu.tmp.$$`
- rm -f ${TMP}/menu.tmp.$$
- if ! handle_rval ${RETVAL}; then return 1; fi
- case ${ANSWER} in
- Primary) FTP_PATH="ftp://ftp.freebsd.org/pub/FreeBSD/${DISTNAME}" ;;
- Secondary) FTP_PATH="ftp://freefall.cdrom.com/pub/FreeBSD/${DISTNAME}" ;;
- Australia) FTP_PATH="ftp://ftp.physics.usyd.edu.au/FreeBSD/${DISTNAME}" ;;
- Finland) FTP_PATH="ftp://nic.funet.fi/pub/unix/FreeBSD/${DISTNAME}" ;;
- France) FTP_PATH="ftp://ftp.ibp.fr/pub/FreeBSD/${DISTNAME}" ;;
- Germany) FTP_PATH="ftp://ftp.uni-duisburg.de/pub/unix/FreeBSD/${DISTNAME}" ;;
- Israel) FTP_PATH="ftp://orgchem.weizmann.ac.il/pub/FreeBSD-${DISTNAME}" ;;
- Japan) FTP_PATH="ftp://ftp.sra.co.jp/pub/os/FreeBSD/distribution/${DISTNAME}" ;;
- Japan-2) FTP_PATH="ftp://ftp.mei.co.jp/free/PC-UNIX/FreeBSD/${DISTNAME}" ;;
- Japan-3) FTP_PATH="ftp://ftp.waseda.ac.jp/pub/FreeBSD/${DISTNAME}" ;;
- Japan-4) FTP_PATH="ftp://ftp.pu-toyama.ac.jp/pub/FreeBSD/${DISTNAME}" ;;
- Japan-5) FTP_PATH="ftp://ftpsv1.u-aizu.ac.jp/pub/os/FreeBSD/${DISTNAME}" ;;
- Japan-6) FTP_PATH="ftp://tutserver.tutcc.tut.ac.jp/FreeBSD/FreeBSD-${DISTNAME}" ;;
- Japan-7) FTP_PATH="ftp://ftp.ee.uec.ac.jp/pub/os/FreeBSD.other/FreeBSD-${DISTNAME}" ;;
- Korea) FTP_PATH="ftp://ftp.cau.ac.kr/pub/FreeBSD/${DISTNAME}" ;;
- Netherlands) FTP_PATH="ftp://ftp.nl.net/pub/os/FreeBSD/${DISTNAME}" ;;
- Russia) FTP_PATH="ftp://ftp.kiae.su/FreeBSD/${DISTNAME}" ;;
- Sweden) FTP_PATH="ftp://ftp.luth.se/pub/FreeBSD/${DISTNAME}" ;;
- Taiwan) FTP_PATH="ftp://netbsd.csie.nctu.edu.tw/pub/FreeBSD/${DISTNAME}" ;;
- Thailand) FTP_PATH="ftp://ftp.nectec.or.th/pub/FreeBSD/${DISTNAME}" ;;
- UK) FTP_PATH="ftp://ftp.demon.co.uk/pub/BSD/FreeBSD/${DISTNAME}" ;;
- UK-2) FTP_PATH="ftp://src.doc.ic.ac.uk/packages/unix/FreeBSD/${DISTNAME}" ;;
- UK-3) FTP_PATH="ftp://unix.hensa.ac.uk/pub/walnut.creek/FreeBSD/${DISTNAME}" ;;
- USA) FTP_PATH="ftp://ref.tfs.com/pub/FreeBSD/${DISTNAME}" ;;
- USA-2) FTP_PATH="ftp://ftp.dataplex.net/pub/FreeBSD/${DISTNAME}" ;;
- USA-3) FTP_PATH="ftp://kryten.atinc.com/pub/FreeBSD/${DISTNAME}" ;;
- USA-4) FTP_PATH="ftp://ftp.neosoft.com/systems/FreeBSD/${DISTNAME}" ;;
- other)
- TITLE="FTP Installation Information"
- DEFAULT_VALUE="${FTP_PATH}"
- if ! input \
-"Please specify the machine and parent directory location of the
-distribution you wish to load. This should be either a \"URL style\"
-specification (e.g. ftp://ftp.freeBSD.org/pub/FreeBSD/) or simply
-the name of a host to connect to. If only a host name is specified,
-the installation assumes that you will properly connect and \"mget\"
-the files yourself."; then return 1; fi
- FTP_PATH=${ANSWER}
- ;;
- esac
-}
-
-media_extract_dist()
-{
- if [ -f do_cksum.sh ]; then
- message "Verifying checksums for ${MEDIA_DISTRIBUTION} distribution. Please wait!"
- if sh ./do_cksum.sh; then
- if [ -f extract.sh ]; then
- message "Extracting ${MEDIA_DISTRIBUTION} distribution. Please wait!"
- if [ -f ./is_interactive ]; then
- sh ./extract.sh
- else
- sh ./extract.sh < /dev/ttyv1 > /dev/ttyv1 2>&1
- fi
- dialog --title "Extraction Complete" --infobox "${MEDIA_DISTRIBUTION} is done" -1 -1
- else
- error "No installation script found!"
- fi
- else
- error "Checksum error(s) found. Please check media!"
- fi
- else
- error "Improper ${MEDIA_DISTRIBUTION} distribution. No checksum script!"
- media_reset
- fi
-}
-
-media_install_set()
-{
- # check to see if we already have it
- if [ -f ${TMPDIR}/${MEDIA_DISTRIBUTION}/extract.sh ]; then
- cd ${TMPDIR}/${MEDIA_DISTRIBUTION}
- media_extract_dist
- media_rm_tmpdir
- return
- fi
- case ${MEDIA_TYPE} in
- cdrom|nfs|ufs|doshd)
- if ! cd ${MEDIA_DEVICE}/${MEDIA_DISTRIBUTION} > /dev/ttyv1 2>&1; then
- error "Unable to cd to ${MEDIA_DEVICE}/${MEDIA_DISTRIBUTION} directory."
- media_reset
- else
- media_extract_dist
- fi
- return
- ;;
-
- tape)
- if ! media_set_tmpdir; then return; fi
- if ! media_cd_tmpdir; then return; fi
- if dialog --title "Please mount tape for ${MEDIA_DEVICE}." \
- --yesno "Please enter the next tape and select\n<Yes> to continue or <No> if finished" -1 -1; then
- message "Loading distribution from ${MEDIA_DEVICE}.\nUse ALT-F2 to see output, ALT-F1 to return."
- if [ "${MEDIA_DEVICE}" = "ftape" ]; then
- progress "${FT_CMD} | ${TAR_CMD} ${TAR_FLAGS} -"
- ${FT_CMD} | ${TAR_CMD} ${TAR_FLAGS} - > /dev/ttyv1 2>&1
- else
- progress "${TAR_CMD} ${TAR_FLAGS} ${MEDIA_DEVICE}"
- ${TAR_CMD} ${TAR_FLAGS} ${MEDIA_DEVICE} > /dev/ttyv1 2>&1
- fi
- fi
- if [ -d ${MEDIA_DISTRIBUTION} ]; then cd ${MEDIA_DISTRIBUTION}; fi
- media_extract_dist
- media_rm_tmpdir
- ;;
-
- dosfd)
- if ! media_set_tmpdir; then return; fi
- if ! media_cd_tmpdir; then return; fi
- COPYING="yes"
- progress "Preparing to extract from DOS floppies"
- while [ "${COPYING}" = "yes" ]; do
- progress "Asking for DOS diskette"
- if dialog --title "Insert distribution diskette" \
- --yesno "Please enter the next diskette and select\n<Yes> to continue or <No> if finished" -1 -1; then
- umount ${MNT} > /dev/null 2>&1
- if ! mount_msdos -o ro ${MEDIA_DEVICE} ${MNT}; then
- error "Unable to mount floppy! Please correct."
- else
- message "Loading distribution from ${MEDIA_DEVICE}.\nUse ALT-F2 to see output, ALT-F1 to return."
- ( ${TAR_CMD} -cf - -C ${MNT} . | ${TAR_CMD} -xvf - ) >/dev/ttyv1 2>&1
- umount ${MNT}
- fi
- else
- COPYING="no"
- fi
- done
- media_extract_dist
- media_rm_tmpdir
- return
- ;;
-
- ftp)
- if ! media_set_tmpdir; then return; fi
- if ! media_cd_tmpdir; then return; fi
- if ! echo ${MEDIA_DEVICE} | grep -q -v 'ftp://'; then
- message "Fetching ${MEDIA_DISTRIBUTION} distribution over ftp.\nUse ALT-F2 to see output, ALT-F1 to return."
- mkdir -p ${MEDIA_DISTRIBUTION}
- cd ${MEDIA_DISTRIBUTION}
- if ! ncftp ${MEDIA_DEVICE}/${MEDIA_DISTRIBUTION}/* < /dev/null > /dev/ttyv1 2>&1; then
- error "Couldn't fetch ${MEDIA_DISTRIBUTION} distribution from\n${MEDIA_DEVICE}!"
- else
- media_extract_dist
- fi
- else
- dialog --clear
- echo "Using manual ftp. Please download the ${MEDIA_DISTRIBUTION} distribution now."
- echo "To avoid this kind of manual labor in the future, try to fetch by URL!"
- SHELL=/stand/sh ftp ${MEDIA_DEVICE}
- dialog --clear
- media_extract_dist
- fi
- media_rm_tmpdir
- return
- ;;
- esac
-}
-
-media_select_distribution()
-{
- MEDIA_DISTRIBUTIONS=""
- while [ "${MEDIA_DISTRIBUTIONS}" = "" ]; do
-
- dialog --title "${DISTNAME}: Choose distributions" \
- --checklist \
-"FreeBSD is separated into a number of distributions for ease of\n\
-installation. Please select the distributions you wish to load, any\n\
-distributions already marked being MANDATORY - please do not\n\
-unselect them! Please also note that DES (encryption) code is NOT\n\
-FOR EXPORT from the U.S. Please don't endanger U.S. ftp sites by\n\
-getting it illegally, thanks! When finished, select <OK>." \
--1 -1 10 \
- "bin" "Binary base files (mandatory - ${BINSIZE})" ON \
- "games" "Games and other frivolities (${GAMESIZE})" OFF \
- "info" "GNU info files (${INFOSIZE})" OFF \
- "manpages" "Manual pages (${MANSIZE})" OFF \
- "proflibs" "Profiled libraries (${PROFSIZE})" OFF \
- "dict" "Spelling checker dictionary files (${DICTSIZE})" OFF \
- "src" "Sources for all but DES (${SRCSIZE})" OFF \
- "secure" "DES code (and sources) (${SECRSIZE})" OFF \
- "compat1x" "FreeBSD 1.x binary compatability (${COMPATSIZE})" OFF \
- "XFree86-3.1.1" "The XFree86 3.1.1 distribution (${X11SIZE})" OFF \
- 2> ${TMP}/menu.tmp.$$
- RETVAL=$?
- MEDIA_DISTRIBUTIONS=`cat ${TMP}/menu.tmp.$$`
- rm -f ${TMP}/menu.tmp.$$
- if ! handle_rval ${RETVAL}; then return 1; fi
- done
-}
-
-media_get_possible_subdir()
-{
- if [ -f ${MNT}/${MEDIA_DISTRIBUTION}/extract.sh ]; then return; fi
- DEFAULT_VALUE="${DISTRIB_SUBDIR}"
- TITLE="Distribution Subdirectory"
- if input \
-"If the distributions are in a subdirectory of the mount point,
-please enter it here (no leading slash - it should be relative
-to the mount point). The directory you enter should be the
-*parent* directory of any distribution subdirectories."; then
- if [ "${ANSWER}" != "" ]; then
- MEDIA_DEVICE=${MEDIA_DEVICE}/${ANSWER}
- DISTRIB_SUBDIR=${ANSWER}
- fi
- else
- return 1
- fi
-}
-
-# Get values into $MEDIA_TYPE and $MEDIA_DEVICE. Call network initialization
-# if necessary.
-media_chose_method()
-{
- while [ "${MEDIA_DEVICE}" = "" ]; do
-
- dialog --title "Installation From" \
---menu \
-"Before installing a distribution, you need to chose and/or configure\n\
-a method of installation. Please pick from one of the following options.\n\
-If none of the listed options works for you, then your best bet may be to\n\
-simply press ESC twice to get a subshell and proceed manually on your own.\n\
-If you are already finished with the installation process, select cancel\n\
-to proceed." -1 -1 7 \
- "?Kern" "Please show me the kernel boot messages again!" \
- "Tape" "Load distribution from tape" \
- "CDROM" "Load distribution from CDROM" \
- "DOS" "Load from DOS (floppies or hard disk partition)" \
- "FTP" "Load distribution over FTP" \
- "UFS" "Load distribution from an existing UFS partition" \
- "NFS" "Load distribution over NFS" 2> ${TMP}/menu.tmp.$$
- RETVAL=$?
- CHOICE=`cat ${TMP}/menu.tmp.$$`
- rm -f ${TMP}/menu.tmp.$$
- if ! handle_rval ${RETVAL}; then return 1; fi
-
- case ${CHOICE} in
- ?Kern)
- if dmesg > ${TMP}/dmesg.out; then
- dialog --title "Kernel boot message output" \
- --textbox ${TMP}/dmesg.out 22 76
- else
- error "Couldn't get dmesg information! :-("
- fi
- ;;
-
- Tape)
- dialog --title "Choose Tape Type" --menu \
-"Which type of tape drive do you have attached to your \n\
-system? FreeBSD supports the following types:\n" -1 -1 3 \
- "SCSI" "SCSI tape drive attached to supported SCSI controller" \
- "QIC-02" "QIC-02 tape drive (Colorado Jumbo, etc)" \
- "floppy" "Floppy tape drive (QIC-40/QIC-80)" 2> ${TMP}/menu.tmp.$$
- RETVAL=$?
- CHOICE=`cat ${TMP}/menu.tmp.$$`
- rm -f ${TMP}/menu.tmp.$$
- if ! handle_rval ${RETVAL}; then continue; fi
- MEDIA_TYPE=tape;
- case ${CHOICE} in
- SCSI)
- DEFAULT_VALUE="/dev/rst0"
- TITLE="SCSI Tape Device"
- if input \
-"If you only have one tape drive, simply press return - the
-default value should be correct. Otherwise, enter the
-correct value and press return."; then
- MEDIA_DEVICE=${ANSWER}
- fi
- ;;
-
- QIC-02)
- DEFAULT_VALUE="/dev/rwt0"
- TITLE="QIC-02 Tape Device"
- if input \
-"If you only have one tape drive, simply press return - the
-default value should be correct. Otherwise, enter the
-correct value and press return."; then
- MEDIA_DEVICE=${ANSWER}
- fi
- ;;
-
- floppy)
- MEDIA_DEVICE=ftape
- ;;
- esac
- ;;
-
- CDROM)
- dialog --title "Choose CDROM Type" --menu \
-"Which type of CDROM drive do you have attached to your \n\
-system? FreeBSD supports the following types:\n" -1 -1 4 \
- "SCSI" "SCSI CDROM drive attached to supported SCSI controller" \
- "Sony" "Sony CDU33 or compatible CDROM drive" \
- "SB" "Sound Blaster CDROM (Matsushita/Panasonic)" \
- "Mitsumi" "Mitsumi CDROM (non-IDE) drive" \
- 2> ${TMP}/menu.tmp.$$
- RETVAL=$?
- CHOICE=`cat ${TMP}/menu.tmp.$$`
- rm -f ${TMP}/menu.tmp.$$
- if ! handle_rval ${RETVAL}; then continue; fi
- MEDIA_TYPE=cdrom;
- case ${CHOICE} in
- SCSI)
- MEDIA_DEVICE=/dev/cd0a
- ;;
-
- Sony)
- MEDIA_DEVICE=/dev/scd0a
- ;;
-
- SB)
- MEDIA_DEVICE=/dev/matcd0a
- ;;
-
- Mitsumi)
- MEDIA_DEVICE=/dev/mcd0a
- ;;
- esac
- umount ${MNT} > /dev/null 2>&1
- if ! mount_cd9660 ${MEDIA_DEVICE} ${MNT} > /dev/ttyv1 2>&1; then
- error "Unable to mount ${MEDIA_DEVICE} on ${MNT}"
- MEDIA_DEVICE=""
- else
- MEDIA_DEVICE=${MNT}
- media_get_possible_subdir
- return 0
- fi
- ;;
-
- DOS)
- DEFAULT_VALUE="/dev/fd0"
- if input \
-"Please specify the device pointing at your DOS partition or
-floppy media. For a hard disk, this might be something like
-/dev/wd0h or /dev/sd0h (as identified in the disklabel editor).
-For the "A" floppy drive, it's /dev/fd0, for the "B" floppy
-drive it's /dev/fd1\n"; then
- MEDIA_DEVICE=${ANSWER}
- if echo ${MEDIA_DEVICE} | grep -q -v fd; then
- umount ${MNT} > /dev/null 2>&1
- if ! mount_msdos ${MEDIA_DEVICE} ${MNT} > /dev/ttyv1 2>&1; then
- error "Unable to mount ${MEDIA_DEVICE}"
- MEDIA_DEVICE=""
- else
- MEDIA_TYPE=doshd
- MEDIA_DEVICE=${MNT}
- media_get_possible_subdir
- return 0
- fi
- else
- MEDIA_TYPE=dosfd
- return 0
- fi
- fi
- ;;
-
- FTP)
- if ! network_setup; then continue; fi
- if media_select_ftp_site; then
- MEDIA_TYPE=ftp
- MEDIA_DEVICE=${FTP_PATH}
- return 0
- fi
- ;;
-
- NFS)
- if ! network_setup; then continue; fi
- TITLE="NFS Installation Information"
- DEFAULT_VALUE="${NFS_PATH}"
- if ! input \
-"Please specify a machine and directory mount point for the
-distribution you wish to load. This must be in machine:dir
-format (e.g. zooey:/a/FreeBSD/${DISTNAME}). The remote
-directory *must* be be exported to your machine (or globally)
-for this to work!\n"; then continue; fi
- NFS_PATH=${ANSWER}
-
- DEFAULT_VALUE="${NFS_OPTIONS}"
- if input \
-"Do you wish to specify any options to NFS? If you're installing
-from a Sun 4.1.x system, you may wish to specify \`-P' to send
-NFS requests over a privileged port (use this if you get nasty
-\`\`credential too weak'' errors from the server). When using a slow
-ethernet card or network link, \`-r 1024 -w 1024' may also prove helpful.
-Options, if any, should be separated by spaces."; then
- if [ "${ANSWER}" != "" ]; then
- NFS_OPTIONS="${ANSWER}"
- fi
- fi
- MEDIA_TYPE=nfs
- umount ${MNT} > /dev/null 2>&1
- if ! mount_nfs ${NFS_OPTIONS} ${NFS_PATH} ${MNT} > /dev/ttyv1 2>&1; then
- error "Unable to mount ${NFS_PATH}"
- else
- message "${NFS_PATH} mounted successfully"
- MEDIA_DEVICE=${MNT}
- media_get_possible_subdir
- return 0
- fi
- ;;
-
- UFS)
- dialog --title "User Intervention Requested" --msgbox "
-Please mount the filesystem you wish to use somewhere convenient and
-exit the shell when you're through. I'll ask you for the location
-of the distribution's parent directory when we come back." -1 -1
- dialog --clear
- /stand/sh
- TITLE="Please enter directory"
- DEFAULT_VALUE="${MNT}"
- if input "Ok, now give me the full pathname of the parent directorys for the distribution(s)."; then
- MEDIA_TYPE=ufs
- MEDIA_DEVICE=${ANSWER}
- return 0
- fi
- ;;
- esac
- done
-}
diff --git a/release/scripts/miscfuncs.sh b/release/scripts/miscfuncs.sh
deleted file mode 100644
index 4db3220..0000000
--- a/release/scripts/miscfuncs.sh
+++ /dev/null
@@ -1,141 +0,0 @@
-#!/stand/sh
-#
-# miscfuncs - miscellaneous functions for the other distribution scripts.
-#
-# Written: November 15th, 1994
-# Copyright (C) 1994 by Jordan K. Hubbard
-#
-# Permission to copy or use this software for any purpose is granted
-# provided that this message stay intact, and at this location (e.g. no
-# putting your name on top after doing something trivial like reindenting
-# it, just to make it look like you wrote it!).
-#
-# $Id: miscfuncs.sh,v 1.7 1995/02/10 01:12:38 jkh Exp $
-
-if [ "${_MISCFUNCS_SH_LOADED_}" = "yes" ]; then
- return 0
-else
- _MISCFUNCS_SH_LOADED_=yes
-fi
-
-PATH=/usr/bin:/usr/sbin:/bin:/sbin:/stand
-export PATH
-
-# Edited by src/release/Makefile
-DISTNAME="FOOBAR"
-
-# Express or Custom install?
-INSTALL_TYPE=""
-
-# Flagrant guesses for now. These need to be hand-edited or, much better yet,
-# automatically done as part of the release process. When that's the case,
-# the hardwired constants will be replaced with tokens that get sed'd for
-# the real sizes.
-#
-BINSIZE="52MB"
-GAMESIZE="12MB"
-MANSIZE="8MB"
-INFOSIZE="4MB"
-PROFSIZE="4MB"
-DICTSIZE="6MB"
-SRCSIZE="112MB"
-SECRSIZE="2MB"
-COMPATSIZE="5MB"
-X11SIZE="50MB"
-
-# Paths
-ETC="/etc"
-MNT="/mnt"
-HOME=/; export HOME
-TMP=/tmp
-
-# Commands and flags
-FT_CMD="ft"
-TAR_CMD="tar"
-TAR_FLAGS="--unlink -xvf"
-IFCONFIG_CMD="ifconfig"
-ROUTE_CMD="route"
-ROUTE_FLAGS="add default"
-HOSTNAME_CMD="hostname"
-SLATTACH_CMD="slattach"
-SLATTACH_FLAGS="-l -a -s"
-PPPD_CMD="pppd"
-PPPD_FLAGS="crtscts defaultroute -ip -mn netmask $netmask"
-
-interrupt()
-{
- dialog --clear --title "User Interrupt Requested" \
- --msgbox "\n ** Aborting the installation ** \n" -1 -1
- exit 0;
-}
-
-# Handle the return value from a dialog, doing some pre-processing
-# so that each client doesn't have to.
-handle_rval()
-{
- case $1 in
- 0)
- return 0
- ;;
- 255)
- PS1="subshell# " /stand/sh
- ;;
- *)
- return 1
- ;;
- esac
-}
-
-# stick a progress message out on the other vty
-progress()
-{
- echo "Progress <$*>" > /dev/ttyv1
-}
-
-# A simple user-confirmation dialog.
-confirm()
-{
- dialog --title "User Confirmation" --msgbox "$*" -1 -1
-}
-
-# A simple message box dialog.
-message()
-{
- progress $*
- dialog --title "Progress" --infobox "$*" -1 -1
-}
-
-# A simple error dialog.
-error()
-{
- echo "ERROR <$*>" > /dev/ttyv1
- dialog --title "Error!" --msgbox "$*" -1 -1
-}
-
-# Something isn't supported yet! :-(
-not_supported()
-{
- echo "<Feature not supported>" > /dev/ttyv1
- dialog --title "Sorry!" --msgbox \
-"This feature is not supported in the current version of the
-installation tools. Barring some sort of fatal accident, we do
-expect it to be in a later release. Please press RETURN to go on." -1 -1
-}
-
-# Get a string from the user
-input()
-{
- TITLE=${TITLE-"User Input Required"}
- dialog --title "${TITLE}" \
- --inputbox "$*" -1 -1 "${DEFAULT_VALUE}" 2> ${TMP}/inputbox.tmp.$$
- if ! handle_rval $?; then rm -f ${TMP}/inputbox.tmp.$$; return 1; fi
- ANSWER=`cat ${TMP}/inputbox.tmp.$$`
- rm -f ${TMP}/inputbox.tmp.$$
-}
-
-# Ask a networking question
-network_dialog()
-{
- TITLE="Network Configuration"
- if ! input "$*"; then return 1; fi
-}
diff --git a/release/scripts/mkchecksums.sh b/release/scripts/mkchecksums.sh
deleted file mode 100644
index 92ba52c..0000000
--- a/release/scripts/mkchecksums.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-#
-# mkchecksums.sh - generate interactive checksum-checking script.
-# Author: Jordan Hubbard
-#
-# This script generates a cksum.sh script from a set of tarballs
-# and should not be run by anyone but the release coordinator (there
-# wouldn't be much point).
-#
-# $Id: mkchecksums.sh,v 1.1 1995/01/14 07:41:50 jkh Exp $
-#
-
-# Remove any previous attempts.
-rm -rf CKSUMS do_cksum.sh
-
-# First generate the CKSUMS file for the benefit of those who wish to
-# use it in some other way. If we find out that folks aren't even using
-# it, we should consider eliminating it at some point. The interactive
-# stuff makes it somewhat superfluous.
-cksum * > CKSUMS
-
-# Now generate a script for actually verifying the checksums.
-awk 'BEGIN {print "rval=0"} { printf("if [ -f %s ]; then if [ \"\`cksum %s%s%s\`\" != \"%s %s %s\" ]; then dialog --title \"Checksum Error\" --msgbox \"Checksum error detected on %s!\" -1 -1; rval=1; fi; fi\n", $3, "\047", $3, "\047", $1, $2, $3, $3);} END {print "exit $rval"}' < CKSUMS > do_cksum.sh
-chmod +x do_cksum.sh
diff --git a/release/scripts/mkxf86extract.sh b/release/scripts/mkxf86extract.sh
deleted file mode 100644
index af3550f..0000000
--- a/release/scripts/mkxf86extract.sh
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/bin/sh
-#
-# mkextract - generate extract.sh
-# Jordan Hubbard
-#
-# This script generates the extract.sh script from the current tarballs
-# and should not be run by anyone but the release coordinator (there wouldn't
-# be much point).
-#
-# Jordan
-
-BASEDIR=/usr/X11R6
-TARGETS=XFree86-3.1*
-echo -n "Creating extract.sh.."
-cat > extract.sh << DO_THE_FUNKY_CHICKEN
-#!/bin/sh
-#
-# Don't edit me - I'm auto-generated by mkextract.sh!
-#
-if [ ! -f /usr/bin/tar ]; then
- dialog --title "Error!" --msgbox "You must install the bindist before this distribution!" -1 -1
- exit 0
-fi
-
-dialog --title "XFree86 3.1 Installation" \
- --msgbox "Welcome to the XFree86 3.1 installation! You'll be asked
-a series of annoying yes/no questions for each component of the
-XFree86 distribution you wish to install. If you're not sure
-whether or not you need some component, simply answer yes and
-delete it later if it turns out you don't need it. This is
-a little rough, yes, but I'm working on it!
-
-Comments on the XFree86 distribution to David Dawes
-<dawes@FreeBSD.org>
-
-Comments on this install to Jordan Hubbard
-<jkh@FreeBSD.org>
-
-Thanks!" -1 -1
-dialog --title "Read This First" --textbox README.FreeBSD 22 76
-DO_THE_FUNKY_CHICKEN
-
-for i in $TARGETS; do
- abbrevname=`echo $i | sed -e 's/XFree86-3.1-//' -e 's/.tar.gz//'`
- echo "if [ "${INSTALL_TYPE}" != "Express" ]; then if dialog --title \"Install Request\" --yesno \"Do you wish to install the ${abbrevname} distribution?\" -1 -1; then dialog --title \"Progress\" --infobox \"Installing $i\" -1 -1; tar --unlink -xzf $i -C /usr; fi; fi" >> extract.sh
-done
-
-cat >> extract.sh << OH_YEAH_BABY_GET_DOWN
-dialog --title "Finished!" \
- --infobox "
-You're now done with the installation of XFree86 3.1.
-Now would probably be a very good time to look in ${BASEDIR}/lib/X11/doc
-for further information on what to do next. XFree86 3.1 is now
-installed in the ${BASEDIR} directory, unlike
-earlier releases. For backwards compatibility, you might consider
-a symlink to /usr/X386." -1 -1
-OH_YEAH_BABY_GET_DOWN
-
-chmod 755 extract.sh
-touch -f .is_interactive
-echo " Done."
diff --git a/release/scripts/netinst.sh b/release/scripts/netinst.sh
deleted file mode 100644
index 2a6b445..0000000
--- a/release/scripts/netinst.sh
+++ /dev/null
@@ -1,210 +0,0 @@
-#!/stand/sh
-#
-# netinst.sh - configure the user's network.
-#
-# Written: November 11th, 1994
-# Copyright (C) 1994 by Jordan K. Hubbard
-#
-# Permission to copy or use this software for any purpose is granted
-# provided that this message stay intact, and at this location (e.g. no
-# putting your name on top after doing something trivial like reindenting
-# it, just to make it look like you wrote it!).
-#
-# $Id: netinst.sh,v 1.8 1995/04/08 09:43:54 phk Exp $
-
-if [ "${_NETINST_SH_LOADED_}" = "yes" ]; then
- return 0
-else
- _NETINST_SH_LOADED_=yes
-fi
-
-# Grab the miscellaneous functions.
-. /stand/scripts/miscfuncs.sh
-
-network_set_defaults()
-{
- HOSTNAME=""
- DOMAIN=""
- NETMASK="0xffffff00"
- IPADDR="127.0.0.1"
- IFCONFIG_FLAGS=""
- REMOTE_HOSTIP=""
- REMOTE_IPADDR=""
- INTERFACE=""
- SERIAL_INTERFACE="/dev/cuaa0"
- SERIAL_SPEED="38400"
-}
-
-network_basic_setup()
-{
- HOSTNAME=""
- while [ "${HOSTNAME}" = "" ]; do
- DEFAULT_VALUE=""
- if ! network_dialog "What is the fully qualified name of this host?"; then return 1; fi
- if [ "${ANSWER}" = "" ]; then
- error "You must select a host name!"
- continue
- else
- HOSTNAME=${ANSWER}
- fi
- done
- sed -e "s/hostname=.\*\$/hostname=${HOSTNAME}/" < /etc/sysconfig \
- > /etc/sysconfig.new && mv /etc/sysconfig.new /etc/sysconfig
- ${HOSTNAME_CMD} ${HOSTNAME}
-
- DEFAULT_VALUE=`echo ${HOSTNAME} | sed -e 's/[^.]*\.//'`
- if network_dialog "What is the domain name of this host (Internet, not YP/NIS)?"; then
- DOMAIN=${ANSWER}
- fi
-
- DEFAULT_VALUE=${IPADDR}
- if ! network_dialog "What is the IP address of this host?"; then return 1; fi
- IPADDR=${ANSWER}
- echo "${IPADDR} ${HOSTNAME} `echo ${HOSTNAME} | sed -e 's/\.${DOMAIN}//'`" >> ${ETC}/hosts
-}
-
-network_setup_ether()
-{
- dialog --title "Ethernet Interface Name" --menu \
- "Please select the type of ethernet interface you have:\n" -1 -1 11 \
- "ed0" "WD80x3, SMC, Novell NE[21]000 or 3C503 generic NIC" \
- "ed1" "Same as above, but at a different address" \
- "eg0" "3Com 3c505 (Etherlink/+)" \
- "ep0" "3COM 3C509" \
- "de0" "DEC PCI ethernet adapter (or compatible)" \
- "ie0" "AT&T StarLan and EN100 family" \
- "is0" "Isolan 4141-0 or Isolink 4110" \
- "ix0" "Intel EtherExpress" \
- "le0" "DEC Etherworks ethernet adapter" \
- "lnc0" "Ether 32V board (VL ethernet card)" \
- "ze0" "PCMCIA IBM or National card" \
- "zp0" "3Com 3c589 PCMCIA card" \
- 2> ${TMP}/menu.tmp.$$
-
- RETVAL=$?
- INTERFACE=`cat ${TMP}/menu.tmp.$$`
- rm -f ${TMP}/menu.tmp.$$
- if ! handle_rval ${RETVAL}; then return 1; fi
-}
-
-network_setup_remote()
-{
- DEFAULT_VALUE="${REMOTE_IPADDR}"
- if ! network_dialog "What is the IP number for the remote host?"; then
- return 1
- fi
- REMOTE_IPADDR=${ANSWER}
-}
-
-network_setup_serial()
-{
- network_setup_remote
- INTERFACE=$1
-
- DEFAULT_VALUE=${SERIAL_INTERFACE}
- if ! network_dialog "What serial port do you wish to use?"; then
- return 1
- fi
- SERIAL_INTERFACE=${ANSWER}
-
- DEFAULT_VALUE=${SERIAL_SPEED}
- if ! network_dialog "What speed is the serial connection?"; then
- return 1
- fi
- SERIAL_SPEED=${ANSWER}
-
- if dialog --title "Dial" --yesno \
- "Do you need to dial the phone or otherwise talk to the modem?" \
- -1 -1; then
- confirm \
-"You may now dialog with your modem and set up the connection.
-Be sure to disable DTR sensitivity (usually with AT&D0) or the
-modem may hang up when you exit 'cu'. Use ~. to exit cu and
-continue."
- dialog --clear
- # Grottyness to deal with a weird crunch bug.
- if [ ! -f /stand/cu ]; then ln /stand/tip /stand/cu; fi
- /stand/cu -l ${SERIAL_INTERFACE} -s ${SERIAL_SPEED}
- dialog --clear
- fi
-}
-
-network_setup_plip()
-{
- network_setup_remote
- INTERFACE=lp0
-}
-
-network_setup()
-{
- DONE=0
- while [ "${INTERFACE}" = "" ]; do
- dialog --title "Set up network interface" --menu \
- "Please select the type of network connection you have:\n" \
- -1 -1 3 \
- "Ether" "A supported ethernet card" \
- "SLIP" "A point-to-point SLIP (Serial Line IP) connection" \
- "PLIP" "A Parallel-Line IP setup (with standard laplink cable)" \
- 2> ${TMP}/menu.tmp.$$
-
- RETVAL=$?
- CHOICE=`cat ${TMP}/menu.tmp.$$`
- rm -f ${TMP}/menu.tmp.$$
- if ! handle_rval ${RETVAL}; then return 1; fi
- case ${CHOICE} in
- Ether) if ! network_setup_ether; then continue; fi ;;
- SLIP) if ! network_setup_serial sl0; then continue; fi ;;
- PLIP) if ! network_setup_plip; then continue; fi ;;
- esac
- if [ "${INTERFACE}" = "" ]; then continue; fi
-
- network_basic_setup
-
- DEFAULT_VALUE="${NETMASK}"
- if network_dialog "Please specify the netmask"; then
- if [ "${ANSWER}" != "" ]; then
- NETMASK=${ANSWER}
- fi
- fi
-
- DEFAULT_VALUE=""
- if network_dialog "Any extra flags to ${IFCONFIG_CMD}, put them here"; then
- IFCONFIG_FLAGS=${ANSWER}
- fi
- echo "Progress <${IFCONFIG_CMD} ${INTERFACE} ${IPADDR} ${REMOTE_IPADDR} netmask ${NETMASK} ${IFCONFIG_FLAGS}>" >/dev/ttyv1
- if ! ${IFCONFIG_CMD} ${INTERFACE} ${IPADDR} ${REMOTE_IPADDR} netmask ${NETMASK} ${IFCONFIG_FLAGS} > /dev/ttyv1 2>&1 ; then
- error "Unable to configure interface ${INTERFACE}"
- IPADDR=""
- INTERFACE=""
- continue
- fi
- if [ "${INTERFACE}" = "sl0" ]; then
- DEFAULT_VALUE=${SLATTACH_FLAGS}
- if network_dialog "Set extra flags to ${SLATTACH_CMD}?"; then
- SLATTACH_FLAGS=${ANSWER}
- fi
- ${SLATTACH_CMD} ${SLATTACH_FLAGS} ${SERIAL_SPEED} ${SERIAL_INTERFACE}
- progress ${SLATTACH_CMD} ${SLATTACH_FLAGS} ${SERIAL_SPEED} ${SERIAL_INTERFACE}
- fi
- echo "${IPADDR} ${REMOTE_IPADDR} netmask ${NETMASK} ${IFCONFIG_FLAGS}" > ${ETC}/hostname.${INTERFACE}
- DEFAULT_VALUE=""
- if network_dialog "If you have a default gateway, enter its IP address"; then
- if [ "${ANSWER}" != "" ]; then
- GATEWAY=${ANSWER}
- ${ROUTE_CMD} ${ROUTE_FLAGS} ${GATEWAY} > /dev/ttyv1 2>&1
- progress ${ROUTE_CMD} ${ROUTE_FLAGS} ${GATEWAY}
- echo ${GATEWAY} > ${ETC}/defaultrouter
- fi
- fi
-
- DEFAULT_VALUE=""
- if network_dialog "If you have a name server, enter its IP address"; then
- if [ "${ANSWER}" != "" ]; then
- NAMESERVER=${ANSWER}
- echo "domain ${DOMAIN}" > ${ETC}/resolv.conf
- echo "nameserver ${NAMESERVER}" >> ${ETC}/resolv.conf
- fi
- fi
- done
- return 0
-}
diff --git a/release/scripts/setup.sh b/release/scripts/setup.sh
deleted file mode 100644
index 81fe02a..0000000
--- a/release/scripts/setup.sh
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/stand/sh
-#
-# Written: November 11th, 1994
-# Copyright (C) 1994 by Jordan K. Hubbard
-#
-# Permission to copy or use this software for any purpose is granted
-# provided that this message stay intact, and at this location (e.g. no
-# putting your name on top after doing something trivial like reindenting
-# it, just to make it look like you wrote it!).
-#
-# $Id: setup.sh,v 1.5 1995/02/03 00:42:27 jkh Exp $
-
-# Grab the miscellaneous functions.
-. /stand/scripts/miscfuncs.sh
-
-final_configuration()
-{
- DONE="no"
- while [ "${DONE}" = "no" ]; do
- dialog --title "Configuration Menu" --menu \
-"Configure your system for basic single user, network or\n\
-development workstation usage. Please select one of the\n\
-following options. When you are finished setting up your\n\
-system, select \"done\". To invoke this configuration tool\n\
-again, type \`/stand/scripts/setup.sh\'." -1 -1 5 \
-"tzsetup" "Configure your system's time zone" \
-"network" "Configure basic networking parameters" \
-"user" "Add a user name for yourself to the system" \
-"guest" "Add a default user \"guest\"" \
-"packages" "Install additional optional software on your system." \
-"ports" "Enable use of the ports collection from CD or fileserver." \
-"done" "Exit from setup." 2> ${TMP}/menu.tmp.$$
- RETVAL=$?
- CHOICE=`cat ${TMP}/menu.tmp.$$`
- rm -f ${TMP}/menu.tmp.$$
- if ! handle_rval ${RETVAL}; then exit 0; fi
-
- case ${CHOICE} in
- tzsetup)
- dialog --clear
- sh /stand/tzsetup
- dialog --clear
- ;;
-
- network)
- INTERFACE=""
- network_setup
- ;;
-
- user)
- sh /stand/scripts/adduser.sh -i
- ;;
-
- guest)
- sh /stand/scripts/adduser.sh
- ;;
-
- done)
- DONE="yes"
- ;;
-
- *)
- not_supported
- esac
- done
-}
diff --git a/release/sysinstall/help/da_DK.ISO8859-1/README b/release/sysinstall/help/da_DK.ISO8859-1/README
deleted file mode 100644
index 42b16ae..0000000
--- a/release/sysinstall/help/da_DK.ISO8859-1/README
+++ /dev/null
@@ -1,98 +0,0 @@
- -------------------------------------------
- FreeBSD 2.0.5 --- RELEASE Versionen , ,
- ------------------------------------------- /( )`
- \ \___ / |
-Velkommen til 2.0.5 releasen af FreeBSD. 2.0.5 er /- _ `-/ '
-en mellem release af FreeBSD, der udfylder det (/\/ \ \ /\
-tidsmæssigt store hul mellem 2.0R (fra november / / | ` \
-'94) og 2.1R, som kommer i slutningen af juli O O ) / |
-'95. FreeBSD 2.0.5 indeholder mange væsentlige `-^--'`< '
-forbedringer i forhold til 2.0R. 2.0.5 er (_.) _ ) /
-væsentligt mere stabil, indeholder adskillige `.___/` /
-nye ting, og har et væsentligt forbedret `-----' /
-installationsprogram. Release noterne <----. __ / __ \
-indeholder flere detaljer om nyhederne <----|====O)))==) \) /====
-i FreeBSD 2.0.5! <----' `--' `.__,' \
- | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-Hvad er FreeBSD? FreeBSD er et operativsystem baseret på 4.4 BSD Lite,
-og kører på Intel, Cyrix eller NexGen "x86" baseret PC hardware. FreeBSD
-understøtter en bred vifte af PC udstyr og PC konfigurationer. Det kan
-bruges til alt fra softwareudvikling til at udbyde Internet opkobling.
-Den travleste maskine på nettet - ftp.cdrom.com - er en FreeBSD maskine.
-
-Denne release af FreeBSD indeholder alt, hvad du behøver for at lave et
-sådant system, samt fuld kildetekst til det hele. Med kildeteksten
-installeret kan du bogstaveligt talt rekompilere hele systemet fra bunden
-med een komando. Dette er ideelt for studerende, forskere samt folk, der
-blot ønsker at se, hvordan det hele hænger sammen.
-
-En stor samling tredje parts software (kaldet "the ports collection")
-medfølger ligeledes, således at det er enkelt for dig at få og installere
-alle dine favorit UNIX programmer sammen med FreeBSD. Over 270 programmer
-fra editorer over programmeringssprog til grafikprogrammer gør FreeBSD til
-et stærkt og altomfattende system, der ligger på linje med mange store
-workstations med hensyn til brugbarhed og styrke.
-
-
-Hvis du ønsker mere dokumentation til systemet, vil vi anbefale, at du
-køber 4.4BSD dokumentationen ("the 4.4BSD Document Set") fra O'Reilly
-Associates og USENIX Association (ISBN 1-56592-082-1). Vi har ingen
-forbindelse til O'Reilly, vi er blot tilfredse kunder!
-
-Det vil være en god ide at læse hardware guiden *før* du fortsætter med
-installationen. At konfigurere en PC til at køre andet end DOS/Windows
-(som egentlig ikke stiller nogen særlige krav til den underliggende
-hardware), er i praksis væsentligt sværere end det ser ud til, og hvis du
-mener at forstå PCere, så har du tydeligvis ikke anvendt dem længe nok :-)
-Denne guide vil give dig nogle tips til at konfigurere din hardware, og
-hvilke symptomer du skal holde øje med i tilfælde af problemer. Guiden
-er tilgængelig i dokumentations menuen på FreeBSD boot disketten.
-
-BEMÆRK: Selvom gruppen bag FreeBSD har gjort sit bedste for at forhindre
-datatab, så er der stadig en reel mulighed for at DU KOMMER TIL AT SLETTE
-HELE DIN HARDDISK under installationen. Lad være med at fortsætte til den
-endelige FreeBSD installations-menu medmindre at du har lavet en sikkerheds-
-kopi af alle vigtige data (det er også en god ide at check-læse sikkerheds-
-kopien). Dette er ikke for sjov, vi er dybt seriøse på dette punkt.
-
-Tekniske kommentarer til denne release sendes (på engelsk!) til:
-
- hackers@FreeBSD.org
-
-
-Fejl-rapporter bør sendes ved hjælp af `send-pr' kommandoen, hvis du fik
-installeret systemet. Ellers sendes de (ligeledes på engelsk) til:
-
- bugs@FreeBSD.org
-
-Husk at gøre opmærksom på HVILKEN VERSION af FreeBSD du kører i alle fejl-
-rapporter.
-
-Generelle spørgsmål kan (på engelsk) sendes til:
-
- questions@FreeBSD.org
-
-Vær venligst tålmodig, hvis dine spørgsmål ikke bliver besvaret umiddelbart.
-Dette er en specielt travl tid for os, og alle vores (frivillige) resourcer
-bliver udnyttet til grænsen. Alle fejl-rapporter, der bliver sendt med
-send-pr kommandoen, bliver logget og holdt øje med i vores fejl database,
-og du vil blive holdt informeret om alle ændringer af status for fejlen
-gennem hele fejlens levetid. Det samme gælder for ønsker om forbedringer.
-
-Vores WEB adresse - http://www.freebsd.org - er ligeledes et godt sted at
-kigge efter opdateret information, og giver flere faciliteter for avanceret
-dokumentation. Du kan benytte BSDI versionen af Netscape til at køre World
-Wide Web direkte fra FreeBSD.
-
-Du kan også kigge i /usr/share/FAQ og /usr/share/doc efter yderligere
-information om systemet.
-
-
-Tak for at du tog dig tid til at læse alt dette. Vi håber oprigtigt at
-du får glæde af denne release af FreeBSD!
diff --git a/release/sysinstall/help/da_DK.ISO8859-1/configure.hlp b/release/sysinstall/help/da_DK.ISO8859-1/configure.hlp
deleted file mode 100644
index b698b6d..0000000
--- a/release/sysinstall/help/da_DK.ISO8859-1/configure.hlp
+++ /dev/null
@@ -1,16 +0,0 @@
-Denne menu lader dig foretage små ændringer af konfigurationen,
-efter at systemet er installeret. Som et minimum bør du sætte
-password'et for system operatøren og systemets tidszone.
-
-For at installere ekstra software såsom bash, emacs, pascal etc.
-bør du kigge i Packages objektet i denne menu. Bemærk at for
-nærværende er dette kun reelt nyttigt, hvis du har en CD-ROM eller
-en eksisterende pakke samling et sted i dit filsystem, hvor pakke
-administrator programmet kan se den. Automatisk overførsel af
-pakker via FTP er endnu ikke supporteret.
-
-Hvis du ønsker at bruge pakke installations programmet efter at
-du har forladt system installationen, så hedder kommandoen
-``pkg_manage''. Hvis du vil sætte tidszonen - tast ``tzsetup''.
-Se ``/etc/sysconfig'' filen for mere information om den generelle
-system konfiguration.
diff --git a/release/sysinstall/help/da_DK.ISO8859-1/language.hlp b/release/sysinstall/help/da_DK.ISO8859-1/language.hlp
deleted file mode 100644
index e7464c6..0000000
--- a/release/sysinstall/help/da_DK.ISO8859-1/language.hlp
+++ /dev/null
@@ -1,13 +0,0 @@
-Benyt denne menu til at vælge dit foretrukne sprog. For nærværende
-vil dette kun sætte default sproget, for de forskellige hjælpefiler
-der vises.
-
-I senere udgaver vil dette også ændre opsætningen/udlægningen af
-tastaturet, skærm karakter-sæt, NLS opsætning (sysinstall vil selv
-benytte tekst kataloger, således at alle menuer er på det ønskede sprog)
-og implementere andre I18N funktioner for at imødekomme diverse standarder.
-
-Indtil disse forbedringer er lavet, vil du sikkert finde, at det er lettere
-at ændre /etc/sysconfig filen i hånden, når systemet er fuldt installeret.
-Der er kommentarer i filen, som beskriver præsis, hvad der skal ændres, samt
-eksempler på enkelte eksisterende ikke engelske opsætninger.
diff --git a/release/sysinstall/help/da_DK.ISO8859-1/usage.hlp b/release/sysinstall/help/da_DK.ISO8859-1/usage.hlp
deleted file mode 100644
index fd242f1..0000000
--- a/release/sysinstall/help/da_DK.ISO8859-1/usage.hlp
+++ /dev/null
@@ -1,56 +0,0 @@
-BRUG AF DETTE SYSTEM
-====================
-
-TAST FUNKTION
----- --------
-PIL OP Flyt til foregående objekt (eller op, i et tekstfelt).
-PIL NED Flyt til næste objekt (eller ned, i et tekstfelt).
-TAB Flyt til næste objekt eller gruppe.
-HØJRE PIL Flyt til næste objekt eller gruppe (det samme som TAB).
-SHIFT-TAB Flyt til foregående objekt eller gruppe.
-VENSTRE PIL Flyt til foregående objekt eller gruppe (det samme som
- SHIFT-TAB).
-RETUR Vælg objekt.
-PAGE UP Gå en side op, i et tekstfelt.
-PAGE DOWN Gå en side ned, i et tekstfelt.
-MELLEMRUM I en "radio" eller flervalgs menu, skift status for det
- nuværende objekt.
-F1 Hjælp (i skærme, der har denne funktionalitet).
-
-Hvis du også ser små "^(-)" eller "v(+)" symboler i kanten af en menu, betyder
-det, at der er flere linjer ovenover eller nedenunder de nuværende, som ikke
-vises (fordi der ikke er nok plads på skærmen). Ved hjælp af pil-op og pil-ned
-kan menuen rulles op og ned. Når et af symbolerne forsvinder, betyder det at
-du er i toppen (eller bunden) af menuen.
-
-I tekstfelter vil mængden af tekst over den nuværende position blive vist som
-en procentdel i det nedre højre hjørne. 100% betyder at du er i bunden af
-feltet.
-
-Valg af OK i en menu vil vælge/bekræfte det som menuen omhandler.
-Valg af Cancel vil afbryde en operation, og generelt returnere dig til den
-foregående menu.
-
-
-SPECIAL-FUNKTIONER
-==================
-
-Det er muligt at vælge et objekt i en menu ved at taste den første karakter
-af navnet (hvis unikt). Disse "accelerator" karakterer vil være specielt
-fremhævet i objekt navnet.
-
-Konsol driveren indeholder en buffer, der gør det muligt at bladre tilbage
-og se information, der er rullet op over toppen af skærmen. For at aktivere
-denne funktion, tryk på "Scroll Lock" tasten og brug piletasterne eller
-Page Up/Page Down tasterne til at bladre gennem den gemte tekst. Funktionen
-forlades ved igen at trykke på "Scroll Lock" tasten. Denne funktion er mest
-brugbar i forbindelse med sub-shells og andre specialfunktioner, der ikke
-bruger menuer.
-
-Når systemet er fuldt installeret og kører i "multi-user" tilstand, vil du
-bemærke, at du har flere "virtuelle konsoller", der kan benyttes til at have
-flere aktive sessioner samtidigt. Brug ALT-F<n> til at skifte mellem dem
-(hvor `F<n>' er den funktionstast, der svarer til den skærm, som du ønsker
-at se). Systemet er standard installeret med 3 virtuelle konsoller. Du kan
-lave flere ved at editere /etc/ttys filen når systemet er oppe (maximum er
-12).
diff --git a/release/sysinstall/help/da_DK.ISO_8859-1/README b/release/sysinstall/help/da_DK.ISO_8859-1/README
deleted file mode 100644
index 42b16ae..0000000
--- a/release/sysinstall/help/da_DK.ISO_8859-1/README
+++ /dev/null
@@ -1,98 +0,0 @@
- -------------------------------------------
- FreeBSD 2.0.5 --- RELEASE Versionen , ,
- ------------------------------------------- /( )`
- \ \___ / |
-Velkommen til 2.0.5 releasen af FreeBSD. 2.0.5 er /- _ `-/ '
-en mellem release af FreeBSD, der udfylder det (/\/ \ \ /\
-tidsmæssigt store hul mellem 2.0R (fra november / / | ` \
-'94) og 2.1R, som kommer i slutningen af juli O O ) / |
-'95. FreeBSD 2.0.5 indeholder mange væsentlige `-^--'`< '
-forbedringer i forhold til 2.0R. 2.0.5 er (_.) _ ) /
-væsentligt mere stabil, indeholder adskillige `.___/` /
-nye ting, og har et væsentligt forbedret `-----' /
-installationsprogram. Release noterne <----. __ / __ \
-indeholder flere detaljer om nyhederne <----|====O)))==) \) /====
-i FreeBSD 2.0.5! <----' `--' `.__,' \
- | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-Hvad er FreeBSD? FreeBSD er et operativsystem baseret på 4.4 BSD Lite,
-og kører på Intel, Cyrix eller NexGen "x86" baseret PC hardware. FreeBSD
-understøtter en bred vifte af PC udstyr og PC konfigurationer. Det kan
-bruges til alt fra softwareudvikling til at udbyde Internet opkobling.
-Den travleste maskine på nettet - ftp.cdrom.com - er en FreeBSD maskine.
-
-Denne release af FreeBSD indeholder alt, hvad du behøver for at lave et
-sådant system, samt fuld kildetekst til det hele. Med kildeteksten
-installeret kan du bogstaveligt talt rekompilere hele systemet fra bunden
-med een komando. Dette er ideelt for studerende, forskere samt folk, der
-blot ønsker at se, hvordan det hele hænger sammen.
-
-En stor samling tredje parts software (kaldet "the ports collection")
-medfølger ligeledes, således at det er enkelt for dig at få og installere
-alle dine favorit UNIX programmer sammen med FreeBSD. Over 270 programmer
-fra editorer over programmeringssprog til grafikprogrammer gør FreeBSD til
-et stærkt og altomfattende system, der ligger på linje med mange store
-workstations med hensyn til brugbarhed og styrke.
-
-
-Hvis du ønsker mere dokumentation til systemet, vil vi anbefale, at du
-køber 4.4BSD dokumentationen ("the 4.4BSD Document Set") fra O'Reilly
-Associates og USENIX Association (ISBN 1-56592-082-1). Vi har ingen
-forbindelse til O'Reilly, vi er blot tilfredse kunder!
-
-Det vil være en god ide at læse hardware guiden *før* du fortsætter med
-installationen. At konfigurere en PC til at køre andet end DOS/Windows
-(som egentlig ikke stiller nogen særlige krav til den underliggende
-hardware), er i praksis væsentligt sværere end det ser ud til, og hvis du
-mener at forstå PCere, så har du tydeligvis ikke anvendt dem længe nok :-)
-Denne guide vil give dig nogle tips til at konfigurere din hardware, og
-hvilke symptomer du skal holde øje med i tilfælde af problemer. Guiden
-er tilgængelig i dokumentations menuen på FreeBSD boot disketten.
-
-BEMÆRK: Selvom gruppen bag FreeBSD har gjort sit bedste for at forhindre
-datatab, så er der stadig en reel mulighed for at DU KOMMER TIL AT SLETTE
-HELE DIN HARDDISK under installationen. Lad være med at fortsætte til den
-endelige FreeBSD installations-menu medmindre at du har lavet en sikkerheds-
-kopi af alle vigtige data (det er også en god ide at check-læse sikkerheds-
-kopien). Dette er ikke for sjov, vi er dybt seriøse på dette punkt.
-
-Tekniske kommentarer til denne release sendes (på engelsk!) til:
-
- hackers@FreeBSD.org
-
-
-Fejl-rapporter bør sendes ved hjælp af `send-pr' kommandoen, hvis du fik
-installeret systemet. Ellers sendes de (ligeledes på engelsk) til:
-
- bugs@FreeBSD.org
-
-Husk at gøre opmærksom på HVILKEN VERSION af FreeBSD du kører i alle fejl-
-rapporter.
-
-Generelle spørgsmål kan (på engelsk) sendes til:
-
- questions@FreeBSD.org
-
-Vær venligst tålmodig, hvis dine spørgsmål ikke bliver besvaret umiddelbart.
-Dette er en specielt travl tid for os, og alle vores (frivillige) resourcer
-bliver udnyttet til grænsen. Alle fejl-rapporter, der bliver sendt med
-send-pr kommandoen, bliver logget og holdt øje med i vores fejl database,
-og du vil blive holdt informeret om alle ændringer af status for fejlen
-gennem hele fejlens levetid. Det samme gælder for ønsker om forbedringer.
-
-Vores WEB adresse - http://www.freebsd.org - er ligeledes et godt sted at
-kigge efter opdateret information, og giver flere faciliteter for avanceret
-dokumentation. Du kan benytte BSDI versionen af Netscape til at køre World
-Wide Web direkte fra FreeBSD.
-
-Du kan også kigge i /usr/share/FAQ og /usr/share/doc efter yderligere
-information om systemet.
-
-
-Tak for at du tog dig tid til at læse alt dette. Vi håber oprigtigt at
-du får glæde af denne release af FreeBSD!
diff --git a/release/sysinstall/help/da_DK.ISO_8859-1/configure.hlp b/release/sysinstall/help/da_DK.ISO_8859-1/configure.hlp
deleted file mode 100644
index b698b6d..0000000
--- a/release/sysinstall/help/da_DK.ISO_8859-1/configure.hlp
+++ /dev/null
@@ -1,16 +0,0 @@
-Denne menu lader dig foretage små ændringer af konfigurationen,
-efter at systemet er installeret. Som et minimum bør du sætte
-password'et for system operatøren og systemets tidszone.
-
-For at installere ekstra software såsom bash, emacs, pascal etc.
-bør du kigge i Packages objektet i denne menu. Bemærk at for
-nærværende er dette kun reelt nyttigt, hvis du har en CD-ROM eller
-en eksisterende pakke samling et sted i dit filsystem, hvor pakke
-administrator programmet kan se den. Automatisk overførsel af
-pakker via FTP er endnu ikke supporteret.
-
-Hvis du ønsker at bruge pakke installations programmet efter at
-du har forladt system installationen, så hedder kommandoen
-``pkg_manage''. Hvis du vil sætte tidszonen - tast ``tzsetup''.
-Se ``/etc/sysconfig'' filen for mere information om den generelle
-system konfiguration.
diff --git a/release/sysinstall/help/da_DK.ISO_8859-1/language.hlp b/release/sysinstall/help/da_DK.ISO_8859-1/language.hlp
deleted file mode 100644
index e7464c6..0000000
--- a/release/sysinstall/help/da_DK.ISO_8859-1/language.hlp
+++ /dev/null
@@ -1,13 +0,0 @@
-Benyt denne menu til at vælge dit foretrukne sprog. For nærværende
-vil dette kun sætte default sproget, for de forskellige hjælpefiler
-der vises.
-
-I senere udgaver vil dette også ændre opsætningen/udlægningen af
-tastaturet, skærm karakter-sæt, NLS opsætning (sysinstall vil selv
-benytte tekst kataloger, således at alle menuer er på det ønskede sprog)
-og implementere andre I18N funktioner for at imødekomme diverse standarder.
-
-Indtil disse forbedringer er lavet, vil du sikkert finde, at det er lettere
-at ændre /etc/sysconfig filen i hånden, når systemet er fuldt installeret.
-Der er kommentarer i filen, som beskriver præsis, hvad der skal ændres, samt
-eksempler på enkelte eksisterende ikke engelske opsætninger.
diff --git a/release/sysinstall/help/da_DK.ISO_8859-1/usage.hlp b/release/sysinstall/help/da_DK.ISO_8859-1/usage.hlp
deleted file mode 100644
index fd242f1..0000000
--- a/release/sysinstall/help/da_DK.ISO_8859-1/usage.hlp
+++ /dev/null
@@ -1,56 +0,0 @@
-BRUG AF DETTE SYSTEM
-====================
-
-TAST FUNKTION
----- --------
-PIL OP Flyt til foregående objekt (eller op, i et tekstfelt).
-PIL NED Flyt til næste objekt (eller ned, i et tekstfelt).
-TAB Flyt til næste objekt eller gruppe.
-HØJRE PIL Flyt til næste objekt eller gruppe (det samme som TAB).
-SHIFT-TAB Flyt til foregående objekt eller gruppe.
-VENSTRE PIL Flyt til foregående objekt eller gruppe (det samme som
- SHIFT-TAB).
-RETUR Vælg objekt.
-PAGE UP Gå en side op, i et tekstfelt.
-PAGE DOWN Gå en side ned, i et tekstfelt.
-MELLEMRUM I en "radio" eller flervalgs menu, skift status for det
- nuværende objekt.
-F1 Hjælp (i skærme, der har denne funktionalitet).
-
-Hvis du også ser små "^(-)" eller "v(+)" symboler i kanten af en menu, betyder
-det, at der er flere linjer ovenover eller nedenunder de nuværende, som ikke
-vises (fordi der ikke er nok plads på skærmen). Ved hjælp af pil-op og pil-ned
-kan menuen rulles op og ned. Når et af symbolerne forsvinder, betyder det at
-du er i toppen (eller bunden) af menuen.
-
-I tekstfelter vil mængden af tekst over den nuværende position blive vist som
-en procentdel i det nedre højre hjørne. 100% betyder at du er i bunden af
-feltet.
-
-Valg af OK i en menu vil vælge/bekræfte det som menuen omhandler.
-Valg af Cancel vil afbryde en operation, og generelt returnere dig til den
-foregående menu.
-
-
-SPECIAL-FUNKTIONER
-==================
-
-Det er muligt at vælge et objekt i en menu ved at taste den første karakter
-af navnet (hvis unikt). Disse "accelerator" karakterer vil være specielt
-fremhævet i objekt navnet.
-
-Konsol driveren indeholder en buffer, der gør det muligt at bladre tilbage
-og se information, der er rullet op over toppen af skærmen. For at aktivere
-denne funktion, tryk på "Scroll Lock" tasten og brug piletasterne eller
-Page Up/Page Down tasterne til at bladre gennem den gemte tekst. Funktionen
-forlades ved igen at trykke på "Scroll Lock" tasten. Denne funktion er mest
-brugbar i forbindelse med sub-shells og andre specialfunktioner, der ikke
-bruger menuer.
-
-Når systemet er fuldt installeret og kører i "multi-user" tilstand, vil du
-bemærke, at du har flere "virtuelle konsoller", der kan benyttes til at have
-flere aktive sessioner samtidigt. Brug ALT-F<n> til at skifte mellem dem
-(hvor `F<n>' er den funktionstast, der svarer til den skærm, som du ønsker
-at se). Systemet er standard installeret med 3 virtuelle konsoller. Du kan
-lave flere ved at editere /etc/ttys filen når systemet er oppe (maximum er
-12).
diff --git a/release/sysinstall/help/de_DE.ISO8859-1/README b/release/sysinstall/help/de_DE.ISO8859-1/README
deleted file mode 100644
index 8ce9c18..0000000
--- a/release/sysinstall/help/de_DE.ISO8859-1/README
+++ /dev/null
@@ -1,106 +0,0 @@
-
- -----------------------------------------
- FreeBSD 2.0.5 --- RELEASE Version , ,
- ----------------------------------------- /( )`
- \ \___ / |
-Willkommen zum Release 2.0.5 von FreeBSD, einem /- _ `-/ '
-Zwischen-Release von FreeBSD, das eine eine Lücke (/\/ \ \ /\
-füllt zwischen 2.0R (das im Nov. 94 erschien) und / / | ` \
-2.1R, das Ende Juli '95 erscheinen wird, die oft O O ) / |
-beklagt wurde. FreeBSD 2.0.5 enthält wesentliche `-^--'`< '
-Verbesserungen gegenüber 2.0R, deren wichtigste (_.) _ ) /
-eine erhöhte Systemstabilität (wesentlich besser), `.___/` /
-Dutzende neuer Features und ein stark `-----' /
-verbessertes Installationsprogramm <----. __ / __ \
-sind. Die Release Notes enthalten <----|====O)))==) \) /====
-weitere Details bzgl. der Neuheiten <----' `--' `.__,' \
-in FreeBSD 2.0.5. | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-
-Was ist FreeBSD? FreeBSD ist ein 4.4BSD-Lite-basiertes Betriebssystem für
-Intel, AMD, Cyrix oder NexGen "x86"-PC-Hardware. Es arbeitet mit einer
-großen Anzahl von PC-Peripherie und -Konfigurationen zusammen. Es kann für
-die Software-Entwicklung bis hin zum Anbieten von Internet-Diensten
-eingesetzt werden; der meist genutzte Rechner im Internet, ftp.cdrom.com,
-ist ein FreeBSD-Rechner.
-
-Dieses FreeBSD-Release enthält alles, was man zur Nutzung eines solchen
-Systems braucht; zusätzlich erhält man den kompletten Quellcode. Wenn man
-den Quellcode installiert hat, kann man das ganze Betriebssystem von Grund
-auf mit einem einzigen Befehl übersetzen; dies eignet es in idealer Weise
-für Studenten, Forscher oder einfach Leute, die sehen wollen, wie alles
-funktioniert.
-
-Es gibt ebenfalls eine große Anzahl portierter Dritt-Software (die "ports
-collection"), um die Verfügbarkeit und die Installation traditioneller
-Lieblings-UNIX-Utilities für FreeBSD zu erleichtern. Über 270 Portierun-
-gen, von Editoren über Programmiersprachen bis zu Grafikanwendungen, machen
-FreeBSD zu einem mächtigen und umfassenden Betriebssystem, das keinen
-Vergleich zu dem großer Workstations scheut.
-
-Als weitere Dokumentation zu diesem System empfehlen wir die 4.4BSD-
-Dokumentation von O'Reilly Associates und der USENIX Association, ISBN
-1-56592-082-1. Wir haben nichts mit O'Reilly zu tun, außer daß wir
-zufriedene Kunden sind!
-
-Wir empfehlen, die HARDWARE-ANLEITUNG *vor* jeglicher Fortführung der
-Installation zu lesen. PC-Hardware für irgend etwas anderes als DOS/
-Windows (das keine großen Anforderungen an die Hardware stellt) zu
-konfigurieren, ist schwieriger, als es zunächst aussieht. Und wenn man
-glaubt, PCs zu verstehen, dann hat man diese nur noch nicht lange genug
-benutzt. :) Diese Anleitung gibt einige Tips zur Hardwarekonfiguration und
-sagt, auf welche Symptome man bei Schwierigkeiten achten muß. Die Anlei-
-tung ist im Dokumentations-Menü der FreeBSD-Bootfloppy verfügbar.
-
-VORBEHALT: Obwohl FreeBSD alles versucht, vorhandene Daten gegen versehent-
-lichen Verlust zu schützen, ist es mit dieser Installation mehr als nur
-möglich, DIE GESAMTE FESTPLATTE ZU LÖSCHEN! Bitte nicht mit der endgül-
-tigen Installation von FreeBSD fortfahren, ohne zuerst alle wichtigen Daten
-angemessen gesichert zu haben! Wir empfehlen es eindringlichst!
-
-Technische Kommentare zu diesem Release sollten an:
-
- hackers@FreeBSD.org
-
-gesandt werden (wenn möglich, in englisch).
-
-Fehlermeldungen sollten bei erfolgreicher Installation mittels des
-`send-pr'-Kommandos, ansonsten an:
-
- bugs@FreeBSD.org
-
-gesandt werden.
-
-Bitte in jeder Fehlermeldung die genutzte FreeBSD-VERSION nennen!
-
-Allgemeine Fragen sollten an:
-
- questions@FreeBSD.org
-
-gesandt werden.
-
-Wir bitten um Geduld, wenn die Fragen nicht sofort beantwortet werden -
-dieses sind besonders arbeitsintensive Zeiten für uns, und unsere Resourcen
-(auf freiwilliger Basis) sind oft bis an die Grenzen ausgereizt! Mittels
-send-pr verschickte Fehlermeldungen werden registriert und in unserer
-Datenbank verfolgt. Über Statusänderungen wird über die gesamte Lebensdauer
-des Fehlers (oder der Forderung nach einem Feature) informiert.
-
-Unsere WEB Site, http://www.freebsd.org, ist ebenfalls eine gute Quelle
-für neue Informationen und enthält einige weitere, fortführende Infor-
-mationen. Man kann die BSDI-Version von Netscape zum Browsen (Blättern)
-im World Wide Web direkt aus FreeBSD heraus nutzen.
-
-Wir empfehlen auch in /usr/share/FAQ und /usr/share/doc zu weiteren
-Informationen zum System nachzuschauen.
-
-Wir danken für die Aufmerksamkeit und hoffen, daß dieses Release von
-FreeBSD viel Freude bereitet.
-
- Jordan Hubbard,
- für das FreeBSD Projekt
diff --git a/release/sysinstall/help/de_DE.ISO8859-1/RELNOTES b/release/sysinstall/help/de_DE.ISO8859-1/RELNOTES
deleted file mode 100644
index c3d2aa6..0000000
--- a/release/sysinstall/help/de_DE.ISO8859-1/RELNOTES
+++ /dev/null
@@ -1,766 +0,0 @@
- RELEASE NOTES
- FreeBSD
- Release 2.0.5
-
-1. Technischer Überblick
-------------------------
-
-FreeBSD ist eine im Quellcode frei verfügbare Version eines 4.4-Lite-
-basierten Betriebssystems für PC's auf der Basis von Intel-i386/i486/
-Pentium-Prozessoren (oder kompatiblen). Es basiert hauptsächlich auf
-Software der Computer-Gruppe (CSRG) der Universität Kalifornien Berkeley
-mit einigen Erweiterungen aus den Systemen NetBSD, 386BSD und von der
-Free Software Foundation.
-
-Seit der Freigabe unserer Version FreeBSD 2.0 vor etwa 8 Monaten hat sich
-die Leistungsfähigkeit, der Funktionsumfang und die Stabilität von
-FreeBSD dramatisch verbessert. Die umfangreichste Änderung ist das neu
-gefaßte System der virtuellen Speicherverwaltung (VM) mit einem vereinig-
-ten VM/Dateipuffer, wodurch sich nicht nur die Leistungsfähigkeit verbes-
-sert, sondern auch der Mindestspeicherbedarf von FreeBSD reduziert werden
-konnte, so daß auch Konfigurationen mit nur 4 MB Hauptspeicher wieder
-akzeptabel werden können. Unter den weiteren Verbesserungen befinden
-sich volle Unterstützung für NIS sowohl auf Client- als auch Serverseite,
-,,Transaction TCP'', PPP mit automatischer Leitungswahl bei Bedarf, ein
-verbessertes SCSI-Subsystem, anfängliche ISDN-Unterstützung, Treiber für
-FDDI- und "Fast Ethernet"-Adapter (100 MBit/s), verbesserter Unter-
-stützung der Adaptec 2940-SCSI-Adapter (sowohl WIDE- als auch
-Normal-SCSI) sowie viele hunderte Bugfixes.
-
-Zuzüglich zur Basis-Distribution bietet FreeBSD nun eine neue Sammlung
-portierter Software an mit etwa 270 häufig gewünschten Programmen. Die
-Liste der ,,Ports'' reicht dabei von HTTP-(WWW-)Servern, Spielen, Pro-
-grammiersprachen, Editoren und so gut wie allem, was dazwischenliegt.
-Die komplette Port-Sammlung benötigt nun nur noch 10 MB Speicherplatz, da
-alle Ports als ,,Deltas'' gegenüber ihren originalen Quellen ausgedrückt
-werden. Das macht es uns einfacher, die Ports auf dem Laufenden zu
-halten, und es reduziert gegenüber der Ports-Sammlung aus Version 1.0
-drastisch den Speicherbedarf. Um einen Port zu übersetzen, wechselt man
-einfach ins Verzeichnis des gewünschten Ports, tippt ,,make'' ein, und
-läßt das System den Rest vornehmen. Es wird dabei automatisch die komp-
-lette Original-Quelle von der CDROM oder einem lokalen FTP-Server geholt,
-so daß man lediglich hinreichend Plattenplatz benötigt, um die gewünsch-
-ten Ports zu übersetzen. (Fast) jeder Port wird auch als vorübersetztes
-,,Package'' zur Verfügung gestellt, das man mit einem einfachen Kommando
-(pkg_add) installieren kann, wenn man nicht von der originalen Quelle
-übersetzen möchte. All dies ist in der Datei
- /usr/share/FAQ/Text/ports.FAQ
-genauer beschrieben.
-
-Seit unserer ersten Version FreeBSD 1.0 vor etwa zwei Jahren hat sich
-FreeBSD fast vollständig geändert. Eine neue Portierung wurde vorge-
-nommen, ausgehend vom 4.4-Lite-Code der Universität Berkeley, womit der
-rechtliche Status des Systems einwandfrei geworden ist, einschließlich
-einer ,Absegnung' durch Novell (dem neuen Eigentümer der USL und des
-Warenzeichens UNIX). Die 4.4-Portierung brachte gleichzeitig eine Menge
-neuer Eigenschaften, Dateisysteme und verbesserte Treiber. Mit der
-geklärten Rechtslage haben wir nun allen Grund zur Hoffnung, daß wir ohne
-künftige juristische Querelen auch weiterhin ein Betriebssystem von guter
-Qualität regelmäßig herausgeben können.
-
-FreeBSD 2.0.5 representiert die zweijährige Arbeit eines internationalen
-Entwicklerteams, das viele tausend Mann-Stunden eingebracht hat. Wir
-hoffen sehr, daß es Anklang findet!
-
-Eine Reihe weiterer Dokumente, die während der Installation und im Betrieb
-von FreeBSD hilfreich sein können, befindet sich im Verzeichnis ,,FAQ'',
-entweder in einem installierten System unter /usr/share/FAQ, oder aber in
-der obersten Ebene der CDROM- oder FTP-Distribution, in der ebendiese Datei
-zu finden ist. Ein Überblick der im FAQ-Verzeichnis enthaltenen Dokumen-
-tation befindet sich in der Datei FAQ/Text/ROADMAP.
-
-Eine Liste all derjenigen, die zum Projekt beigetragen haben, verbunden
-mit einer allgemeinen Beschreibung des Projektes selbst, befindet sich in
-der Datei ,,CONTRIB.FreeBSD'' in der Binär-Distribution.
-
-Die Datei ,,REGISTER.FreeBSD'' enthält eine Beschreibung, wie man sich
-beim "Free BSD user counter" registrieren läßt. Dieser Zähler ist für
-ALLE freien BSD-Derivate, nicht nur FreeBSD, und wir legen jedem die
-Anmeldung dort nahe.
-
-Die Kerndistribution von FreeBSD enthält keinen DES-Code, weil dies ihren
-Export außerhalb der USA verhindern würde. Es existiert ein Zusatzpaket,
-das nur in den USA verwendet werden darf und die Programme zusammenfaßt,
-die normalerweise DES benutzen. Alle anderen zusätzlich angebotenen
-Pakete können von jedermann genutzt werden. Eine freie und (aus Sicht
-von außerhalb der USA) exportierbare Distribution für Nicht-US-Benutzer
-existiert aber auch. Sie ist in der FreeBSD-FAQ beschrieben.
-
-Soweit jedoch die Paßwortsicherheit alles ist, was gewünscht wird, und
-kein Bedarf besteht, die verschlüsselten Paßwörter zwischen verschiedenen
-Architekturen (Sun's, DEC-Maschinen usw.) auszutauschen, ist das von
-FreeBSD benutzte, auf einer MD5-Verschlüsselung aufsetzende Sicherheits-
-system völlig ausreichend! Wir sind der Meinung, daß unser standard-
-mäßiges Sicherheitsmodell mehr als ein Ausgleich für DES ist, und das,
-ohne daß wir uns mit ärgerlichen Exportbeschränkungen herumschlagen
-müßten. Es ist einen Versuch wert, für alle außerhalb (oder sogar auch
-innerhalb) der USA! (Anm.: MD5 implementiert keine Verschlüsselung im
-Sinne der amerikanischen Exportbestimmungen, sondern kann ausschließ-
-lich zur Zugangskontrolle verwendet werden. Damit fällt es nicht unter
-die Exportbeschränkungen der USA. -- Jörg)
-
-
-1.1 Was ist neu in 2.0.5?
--------------------------
-
-Die folgenden Funktionen wurden im Zeitraum zwischen der Freigabe von
-Version 2.0 und dieser Version 2.0.5 entweder hinzugefügt oder grundle-
-gend verbessert. Um eine bessere Kommunikation zu ermöglichen, ist die
-Person (oder die Personen), die für die jeweilige Verbesserung verant-
-wortlich ist, aufgelistet. Jegliche Fragen bezüglich der neuen Funkiona-
-lität sollte zuerst an denjenigen gerichtet werden.
-
-
-KERNEL:
-
-Vereinigter VM/Dateipuffer-Cache
---------------------------------
-Der Entwurf eines vereinten VM/Dateipuffer-Caches verbessert die gesamte
-Leistungsfähigkeit des Systems erheblich und erlaubt eine Reihe optimier-
-ter Speicherbelegungsstrategien, die vorher unmöglich waren.
-
-Verantwortlich: David Greenman (davidg@FreeBSD.org) and
- John Dyson (dyson@implode.root.com)
-
-
-Optimierter Hash-Algorithmus für Netzwerk-Protokollsteuerblöcke (PCB's)
------------------------------------------------------------------------
-Für Systeme mit einer großen Anzahl aktiver TCP-Verbindungen (z. B.
-WEB- und FTP-Server) wird dadurch die Suche für ein ankommendes Paket
-nach der dazugehörigen Verbindung erheblich beschleunigt.
-
-Verantwortlich: David Greenman (davidg@FreeBSD.org)
-
-
-Optimierung des Dateinamen-Caches
----------------------------------
-Der Namens-Cache faßt nunmehr alle gleichen Namen im gleichen Speicher-
-block zusammen, so daß z. B. alle ,,..''-Einträge im gleichen Block
-landen. Die Version für das Elternverzeichnis wurde einbezogen, um
-den Hash durcheinanderzubringen, und die Cache-Verwaltung wurde ver-
-bessert, da gerade an diesem Teil gearbeitet wurde.
-
-Verantwortlich: Poul-Henning Kamp (phk@FreeBSD.org)
- David Greenman (davidg@FreeBSD.org)
-
-
-Weniger einschränkende Konfigurierung von Swap-Bereichen
---------------------------------------------------------
-Die Notwendigkeit, die Namen der Swap-Geräte in den Kernel zu kompilie-
-ren, wurde beseitigt. ,swapon' akzeptiert numehr jedes Block-Gerät bis
-zur Maximalzahl der in den Kernel konfigurierten Swap-Geräte.
-
-Verantwortlich: Poul-Henning Kamp (phk@FreeBSD.org)
- David Greenman (davidg@FreeBSD.org)
-
-
-,,Vorverdrahtete'' SCSI-Geräte
-------------------------------
-FreeBSD-Versionen vor 2.0.5 haben die Gerätenummernzuweisung für SCSI-
-Geräte ausschließlich dynamisch vorgenommen in der Reihenfolge, wie die
-Geräte gefunden wurden, so daß infolge Fehlfunktion eines SCSI-Gerätes
-sich möglicherweise die Gerätenummer ändern konnte. Dieses hatte zur
-Folge, daß selbst die Zuordnung der Dateisysteme auf den noch funktio-
-nierenden Geräten nicht mehr möglich war und die Dateisysteme nicht
-gemountet werden konnten. Durch ,,Vorverdrahtung'' ist es jetzt möglich,
-statisch die Zuordnung zwischen Gerätenummern (und damit Gerätenamen) und
-SCSI-Geräten vorzunehmen, wobei die SCSI-ID und die Nummer des SCSI-
-Busses als Basis dienen. Diese Zuordnung wird in der Konfigurations-
-datei des Kernels vorgenommen und ist sowohl in der Manual-Seite scsi(4)
-als auch in der LINT-Beispielkonfiguration dokumentiert.
-
-Verantwortlich: Peter Dufault (dufault@hda.com)
-Betroffene Dateien: sys/scsi/* usr.sbin/config/*
-
-
-Unterstützung für ,,Slices''
-----------------------------
-FreeBSD unterstützt nunmehr die Abstraktion von ,,Slices'' (globalen
-Platten-Partitionen), so daß die Zusammenarbeit mit Partitionen anderer
-Betriebssysteme verbessert wird. Damit ist es FreeBSD möglich, vor-
-handene DOS-Partitionen (ohne weitere Vorkehrungen) mitzunutzen.
-
-Verantwortlich: Bruce Evans (bde@FreeBSD.org)
-Betroffene Dateien: sys/disklabel.h sys/diskslice.h sys/dkbad.h
- kern/subr_diskslice.c kern/subr_dkbad.c
- i386/isa/diskslice_machdep.c
- i386/isa/wd.c scsi/sd.c dev/vn/vn.c
-
-
-Unterstützung für Version 6.0 des OnTrack Disk-Managers
--------------------------------------------------------
-Es wurde die Möglichkeit geschaffen, Platten zu nutzen, die durch den
-OnTrack Disk-Manager verwaltet werden. Das fdisk-Programm jedoch weiß
-darüber noch nichts, so daß alle Änderungen entweder im Installations-
-programm der Bootdiskette (boot.flp) oder aber im OnTrack Disk-Manager
-aus DOS heraus vorgenommen werden müssen.
-
-Verantwortlich: Poul-Henning Kamp (phk@FreeBSD.org)
-
-
-Bad144 ist wieder da und funktioniert
--------------------------------------
-Bad144 funktioniert wieder. Die Semantik jedoch hat sich gegenüber
-früher geringfügig geändert. Die Fehlerstellen werden nunmehr relativ
-zur ,,Slice'' gezählt und nicht mehr absolut bezüglich der ganzen
-Platte.
-
-Verantwortlich: Bruce Evans (bde@FreeBSD.org)
- Poul-Henning Kamp (phk@FreeBSD.org)
-
-
-UNTERSTÜTZUNG NEUER GERÄTE:
-
- SCSI- und CDROM-Geräte
-
-Matsushita/Panasonic (Creative) CD-ROM-Treiber
-----------------------------------------------
-Die Laufwerke Matsushita/Panasonic CR-562 und CR-563 werden nunmehr
-unterstützt, wenn sie an einen SoundBlaster- oder 100% kompatiblen
-Hostadapter angeschlossen sind. Bis zu vier Hostadapter sind möglich, so
-daß maximal 16 CD-ROM-Laufwerke angeschlossen werden können. Die
-Audio-Funktionen sind ebenfalls unterstützt einschließlich des ,,Karoke
-variable speed playback''.
-
-Verantwortlich: Frank Durda IV bsdmail@nemesis.lonestar.org
-Betroffene Dateien: isa/matcd
-
-
-Adaptec 2742/2842/2940 SCSI-Treiber
------------------------------------
-Der originale Treiber für 274X-/284X-Adapter wurde gegenüber der Version
-2.0 beträchtlich geändert. Nunmehr gibt es auch volle Unterstützung der
-2940-Serie sowie der ,,Wide-SCSI''-Modelle dieser Karten. Der Bug in der
-Bus-Arbitrierung (sowie viele weitere) wurde beseitigt, der Treiberprob-
-leme mit schnellen SCSI-Geräten verursacht hat. Es existiert sogar eine
-experimentelle Unterstützung für ,,tagged queuing'' (Kernel-Option
-,,AHC_TAGENABLE''). Weiterhin hat John Aycock den Code für den Sequen-
-cer nunmehr mit einem ,,Berkeley''-Copyright freigegeben, so daß die
-Restriktionen der GPL nicht mehr auf den Treiber zutreffen.
-
-Verantwortlich: Justin Gibbs (gibbs@FreeBSD.org)
-Betroffene Dateien: isa/aic7770.c pci/aic7870.c i386/scsi/*
- sys/dev/aic7xxx/*
-
-
-NCR5380/NCR53400 SCSI ("ProAudio Spectrum") Treiber
----------------------------------------------------
-Verantwortlich: Core-Team
-Eingereicht von: Serge Vakulenko (vak@cronyx.ru)
-Betroffene Dateien: isa/ncr5380.c
-
-
-Sony CDROM-Treiber
-------------------
-Verantwortlich: Core-Team
-Eingereicht von: Mikael Hybsch (micke@dynas.se)
-Betroffene Dateien: isa/scd.c
-
-
- Serielle Geräte
-
-Treiber für SDL Communications Riscom/8 Serial Board
-----------------------------------------------------
-Verantwortlich: Andrey Chernov (ache@FreeBSD.org)
-Betroffene Dateien: isa/rc.c isa/rcreg.h
-
-
-Treiber für Cyclades Cyclom-y Serial Board
-------------------------------------------
-Verantwortlich: Bruce Evans (bde@FreeBSD.org)
-Eingereicht von: Andrew Werple (andrew@werple.apana.org.au) and
- Heikki Suonsivu (hsu@cs.hut.fi)
-Entnommen aus: NetBSD
-Betroffene Dateien: isa/cy.c
-
-
-Serieller Treiber Cronyx/Sigma sync/async-Geräte
-------------------------------------------------
-Verantwortlich: Core-Team
-Eingereicht von: Serge Vakulenko
-Betroffene Dateien: isa/cronyx.c
-
-
-
- Netzwerk
-
-Plattenloses Booten
--------------------
-Das plattenlose Booten wurde in Version 2.0.5 stark verbessert. Das
-Boot-Programm befindet sich in src/sys/i386/boot/netboot und kann sowohl
-von MSDOS aus gestartet als auch in einen EPROM gebrannt werden. Lokales
-Swappen ist ebenfalls möglich. Gegenwärtig werden Ethernet-Karten von
-WD, SMC, 3Com und Novell unterstützt.
-
-
-Treiber für DEC DC21140 ,,Fast Ethernet''-Adapter
--------------------------------------------------
-Dieser Treiber unterstützt die zahlreichen Netzwerkadapter auf Basis
-des DEC DC21140-Chipsatzes einschließlich der 100 MBit/s DEC-500-XA und
-SMC 9332.
-
-Verantwortlich: Core-Team
-Eingereicht von: Matt Thomas (thomas@lkg.dec.com)
-Betroffene Dateien: pci/if_de.c pci/dc21040.h
-
-Treiber für DEC FDDI (DEFPA/DEFEA)
-----------------------------------
-Verantwortlich: Core-Team
-Eingereicht von: Matt Thomas (thomas@lkg.dec.com)
-Betroffene Dateien: pci/if_pdq.c pci/pdq.c pci/pdq_os.h pci/pdqreg.h
-
-
-Treiber für 3Com 3c505 (Etherlink/+) Karten
--------------------------------------------
-Verantwortlich: Core-Team
-Eingereicht von: Dean Huxley (dean@fsa.ca)
-Entnommen aus: NetBSD
-Betroffene Dateien: isa/if_eg.c
-
-
-Treiber für die Fujitsu-MB86960A-Netzwerkkarten-Familie
--------------------------------------------------------
-Verantwortlich: Core-Team
-Eingereicht von: M.S. (seki@sysrap.cs.fujitsu.co.jp)
-Betroffene Dateien: isa/if_fe.c
-
-
-Treiber für Intel EtherExpress
-------------------------------
-Verantwortlich: Rodney W. Grimes (rgrimes@FreeBSD.org)
-Betroffene Dateien: isa/if_ix.c isa/if_ixreg.h
-
-
-Treiber für 3Com 3c589
-----------------------
-Verantwortlich: Core-Team
-Eingereicht von: "HOSOKAWA Tatsumi" (hosokawa@mt.cs.keio.ac.jp),
- Seiji Murata (seiji@mt.cs.keio.ac.jp) and
- Noriyuki Takahashi (hor@aecl.ntt.jp)
-Betroffene Dateien: isa/if_zp.c
-
-
-Treiber für IBM-Kreditkarten
-----------------------------
-Verantwortlich: Core-Team
-Eingereicht von: "HOSOKAWA Tatsumi" (hosokawa@mt.cs.keio.ac.jp)
-Betroffene Dateien: isa/pcic.c isa/pcic.h
-
-
-Treiber für EDSS1- und 1TR6-ISDN-Interface
-------------------------------------------
-Verantwortlich: Core-Team
-Eingereicht von: Dietmar Friede (dfriede@drnhh.neuhaus.de) and
- Juergen Krause (jkr@saarlink.de)
-Betroffene Dateien: gnu/isdn/*
-
-
- Diverse Treiber
-
-Treiber für Joystick
---------------------
-Verantwortlich: Jean-Marc Zucconi (jmz@FreeBSD.org)
-Betroffene Dateien: isa/joy.c
-
-
-Treiber für National Instruments "LabPC"
-----------------------------------------
-Verantwortlich: Peter Dufault (dufault@hda.com)
-Betroffene Dateien: isa/labpc.c
-
-
-Treiber für WD7000
-------------------
-Verantwortlich: Olof Johansson (offe@ludd.luth.se)
-
-
-Pcvt-Console-Treiber
---------------------
-Verantwortlich: Jörg Wunsch (joerg@FreeBSD.org)
-Eingereicht von: Hellmuth Michaelis (hm@altona.hamburg.com)
-Betroffene Dateien: isa/pcvt/* usr.sbin/pcvt/*
-
-
-BSD-audio Emulator für den VAT-Treiber
---------------------------------------
-Verantwortlich: Amancio Hasty (ahasty@FreeBSD.org) and
- Paul Traina (pst@FreeBSD.org)
-Betroffene Dateien: isa/sound/vat_audio.c isa/sound/vat_audioio.h
-
-
-Treiber für National Instruments AT-GPIB and AT-GPIB/TNT GPIB
--------------------------------------------------------------
-Verantwortlich: Core-Team
-Eingereicht von: Fred Cawthorne (fcawth@delphi.umd.edu)
-Betroffene Dateien: isa/gpib.c isa/gpib.h isa/gpibreg.h
-
-
-Treiber für Genius GS-4500 Handscanner
---------------------------------------
-Verantwortlich: Core-Team
-Eingereicht von: Gunther Schadow (gusw@fub46.zedat.fu-berlin.de)
-Betroffene Dateien: isa/gsc.c isa/gscreg.h
-
-
-CORTEX-I Frame Grabber
-----------------------
-Verantwortlich: Core-Team
-Eingereicht von: Paul S. LaFollette, Jr.
-Betroffene Dateien: isa/ctx.c isa/ctxreg.h
-
-
-Video Spigot video capture card
--------------------------------
-Verantwortlich: Jim Lowe
-
-
-
-1.2 Experimentelle Funktionalität
----------------------------------
-
-Von den Dateisystemen unionfs und LFS ist bekannt, daß sie in Version
-2.0.5 stark mangelhaft sind. Das ist teilweise alten Bugs geschuldet, zu
-deren Beseitigung wir noch keine Zeit gefunden haben, sowie der noch
-ausstehenden Umstellung auf das neue VM-System. Wir hoffen, daß wir
-diese Probleme ein einer späteren Version von FreeBSD beseitigen können.
-
-FreeBSD kann nunmehr Binaries laufen lassen, die dem iBCS2-Standard ge-
-nügen. (SCO UNIX 3.2.2 & 3.2.4 und ISC 2.2 COFF-Format sind gegenwärtig
-unterstützt.) Der iBCS2-Emulator befindet sich noch in seinen Anfängen,
-aber er funktioniert. Wir haben noch keine erschöpfenden Tests vornehmen
-können (mangels kommerzieller Applikationen), aber beinahe alle Binaries
-für SCO 3.2.2 laufen, so z. B. ein altes INFORMIX-2.10 für SCO. Zur
-Vervollständigung dieses Projektes sind weitere Tests nötig. Es sind
-weiterhin Arbeiten im Gange, um ELF- und XOUT-Programme starten zu kön-
-nen. Der Großteil der ,,system call wrapper'' für SVR4 ist bereits ge-
-schrieben.
-
-FreeBSD implementiert mittlerweile auch genügend Linux-Kompatibilität,
-um DOOM laufen zu lassen! Für eine vollständige Dokumentation, wie
-dies einzurichten ist, kann man im Verzeichnis ,,xperimnt'' (auf dem
-lokalen FTP-Server oder der CDROM) nachsehen.
-
-Verantwortlich: Søren Schmidt (sos) & Sean Eric Fagan (sef)
-Betroffene Dateien: sys/i386/ibcs2/* sowie diverse Kernelmodifikationen
-=======
-
-
-2. Unterstützte Konfigurationen
--------------------------------
-
-FreeBSD läuft derzeit auf einer großen Vielfalt von ISA-, VLB-, EISA- und
-PCI-Bus-basierten PC's, beginnend beim 386sx bis hin zu Maschinen der
-Pentium-Klasse (obwohl der 386sx nicht zu empfehlen ist). Es gibt Unter-
-stützung für allgemeine IDE- oder ESDI-Laufwerke, verschiedene SCSI-
-Controller, Netzwerk- und serielle Karten.
-
-Nachfolgend eine Liste aller Platten-Controller und Ethernet-Karten, von
-denen gegenwärtig bekannt ist, daß sie mit FreeBSD zusammenarbeiten.
-Andere Konfigurationen können ebenfalls funktionieren, wir haben ledig-
-lich darüber noch nichts erfahren.
-
-
-2.1. Platten-Controller
-
-WD1003 (beliebige MFM/RLL)
-WD1007 (beliebige IDE/ESDI)
-WD7000
-IDE
-ATA
-
-Adaptec 152x Serie ISA SCSI-Controller
-Adaptec 154x Serie ISA SCSI-Controller
-Adaptec 174x Serie EISA SCSI-Controller, Standard und ,,Enhanced'' Mode.
-Adaptec 274X/284X/2940 (Narrow/Wide/Twin) Serie ISA/EISA/PCI SCSI-Controller
-Adaptec AIC-6260- und AIC-6360-basierte Karten, einschließlich AHA-152x
-und SoundBlaster SCSI-Karten.
-
-** Anmerkung: Von den Soundblaster-Karten kann nicht gebootet werden, da
-sie kein BIOS besitzen, was Voraussetzung wäre, um das Boot-Gerät in das
-System-BIOS abzubilden. Sie sind jedoch ohne weiteres benutzbar für
-externe Bandlaufwerke, CDROM's usw. Gleiches trifft auf AIC-6x60-
-basierte Karten ohne Boot-ROM zu. Manche dieser Karten besitzen jedoch
-einen Boot-ROM, was man allgemein an irgendeiner Mitteilung beim System-
-start nach dem Einschalten oder einem Reset erkennen kann. Im Zweifels-
-falle sollte man die Systemdokumentation konsultieren.
-
-[Hinweis: Buslogic nannte sich früher ,,Bustec'']
-Buslogic 545S & 545c
-Buslogic 445S/445c VLB SCSI-Controller
-Buslogic 742A, 747S, 747c EISA SCSI-Controller.
-Buslogic 946c PCI SCSI-Controller
-Buslogic 956c PCI SCSI-Controller
-
-NCR 53C810 und 53C825 PCI SCSI-Controller.
-NCR5380/NCR53400 ("ProAudio Spectrum") SCSI-Controller.
-
-DTC 3290 EISA SCSI-Controller in 1542 Emulations-Mode.
-
-UltraStor 14F, 24F und 34F SCSI-Controller.
-
-Seagate ST01/02 SCSI-Controller.
-
-Future Domain 8xx/950 Serie SCSI-Controller.
-
-Für alle unterstützten SCSI-Controller wird volle Unterstützung für alle
-SCSI-I- und SCSI-II-Peripherie gewährt, einschließlich Platten, Bandlauf-
-werke (auch DAT) und CD-ROM-Laufwerke.
-
-Folgende CD-ROM-Systeme sind derzeit unterstützt:
-
-(cd) SCSI (auch ProAudio Spectrum und SoundBlaster SCSI)
-(mcd) Mitsumi Interface-Karte
-(matcd) Matsushita/Panasonic (Creative) Interface-Karte
-(scd) Sony Interface-Karte
-
-Hinweis: CD-Laufwerke mit IDE-Interface sind derzeit noch nicht unter-
-stützt.
-
-Einige Controller sind hinsichtlich ihrer Kommunikation mit mehr als 16
-MB Hauptspeicher eingeschränkt, da der ISA-Bus nur 24 Bit Adreßraum
-besitzt und folglich nur 16 MB adressieren kann. Dies trifft selbst auf
-einige EISA-Adapter zu (die an sich 32 Bit Adreßraum haben), wenn sie auf
-ISA-Emulation geschaltet werden, weil sie dies dann in *jeder* Hinsicht
-tun. Diese Probleme treten nicht mit IDE-Adaptern auf (da sie kein DMA
-vornehmen), echten EISA-Controllern (wie UltraStor, Adaptec 1742A oder
-Adaptec 2742) sowie den meisten VLB-(Local-Bus)-Controllern. Sowie es
-notwendig wird, belegt das System ,,bounce buffer'', um mit den Adaptern
-zu kommunizieren, so daß es dennoch möglich ist, mehr als 16 MB Haupt-
-speicher problemlos zu nutzen.
-
-
-2.2 Ethernet-Karten
-
-SMC Elite 16 WD8013 Ethernet-Interfaces, sowie die meisten anderen
-WD8003E-, WD8003EBT-, WD8003W-, WD8013W-, WD8003S-, WD8003SBT- and
-WD8013EBT-basierten Clones. SMC Elite Ultra wird ebenfalls unterstützt.
-
-DEC EtherWORKS III NICs (DE203, DE204, and DE205)
-DEC EtherWORKS II NICs (DE200, DE201, DE202, and DE422)
-DEC DC21140 based NICs (SMC???? DE???)
-DEC FDDI (DEFPA/DEFEA) NICs
-
-Fujitsu MB86960A Familie
-
-Intel EtherExpress
-
-Isolan AT 4141-0 (16 bit)
-Isolink 4110 (8 bit)
-
-Novell NE1000, NE2000, und NE2100 Ethernet-Interface.
-
-3Com 3C501 Karten
-
-3Com 3C503 Etherlink II
-
-3Com 3c505 Etherlink/+
-
-3Com 3C507 Etherlink 16/TP
-
-3Com 3C509, 3C579, 3C589 (PCMCIA) Etherlink III
-
-Toshiba Ethernet-Karten
-
-PCMCIA Ethernet-Karten von IBM und National Semiconductor werden
-ebenfalls unterstützt.
-
-
-2.3. Verschiedenes
-
-AST 4-Port serielle Karten unter Nutzung von ,,shared interrupt''.
-
-ARNET 8-Port serielle Karten unter Nutzung von ,,shared interrupt''.
-
-BOCA ATIO66 6-Port serielle Karten unter Nutzung von ,,shared interrupt''.
-
-Cyclades Cyclom-y Serial Board.
-
-STB 4-Port serielle Karten unter Nutzung von ,,shared interrupt''.
-
-Mitsumi (alle Modelle) CDROM-Interface und -Laufwerk.
-
-SDL Communications Riscom/8 Serial Board.
-
-Soundblaster SCSI und ProAudio Spectrum SCSI CDROM-Interface und -Laufwerk.
-
-Matsushita/Panasonic (Creative SoundBlaster) CDROM-Interface und -Laufwerk.
-
-Adlib, SoundBlaster, SoundBlaster Pro, ProAudioSpectrum, Gravis UltraSound
-und Roland MPU-401 Sound-Karten.
-
-FreeBSD unterstützt derzeit KEINE IBM-Microchannel (MCA) Bussysteme,
-jedoch ist die Unterstützung nahe an der Fertigstellung. Einzelheiten
-werden gepostet sowie sich die Situation entwickelt.
-
-
-3. Wie kann man FreeBSD bekommen?
----------------------------------
-
-FreeBSD kann man in einer Vielzahl von Möglichkeiten erhalten:
-
-1. FTP/Mail
-
-FreeBSD selbst oder all seine wahlfreien Pakete können per ftp von
-,ftp.freebsd.org' bezogen werden -- der offiziellen Vertriebsstelle von
-FreeBSD.
-
-Server, die diese Site spiegeln, sind in der Datei MIRROR.SITES aufge-
-listtet. Es wird darum gebeten, die Distribution von der netzwerkmäßig
-nächstgelegenen Site zu beziehen.
-
-Für diejenigen ohne direkten Internetzugang, aber mit der Möglichkeit,
-eMail zu empfangen, steht der Weg über ,ftpmail@decwrl.dec.com' offen.
-Einfach das Schlüsselwort ,,help'' als Mail dorthin schicken, und man
-bekommt eine genaue Information, wie man Dateien von ,ftp.freebsd.org'
-beziehen kann. Achtung: diese Variante führt zum Versenden einiger *zehn
-Megabyte* über Mail und sollte daher wirklich nur als allerletzte
-Möglichkeit in Betracht gezogen werden!
-
-
-2. CDROM
-
-FreeBSD 2.0.5 kann man auf CDROM bestellen bei:
-
- Walnut Creek CDROM
- 4041 Pike Lane, Suite D
- Concord CA 94520
- +1-510-674-0783, +1-510-674-0821 (Fax)
-
-Oder über Internet bei orders@cdrom.com oder http://www.cdrom.com.
-Der aktuelle Katalog kann mittels FTP bezogen werden als
- ftp://ftp.cdrom.com/cdrom/catalog.
-
-Die CDROM kostet US-$ 39.95. Der Versand kostet (pro Bestellung, nicht
-pro CD) US-$ 10.00. Visa, Mastercard und American Express werden in
-Zahlung genommen.
-
-Die CD's können bei Nichtgefallen bedingungslos zurückgegeben werden.
-
-
-Berichten von Bugs, Verbesserungsvorschläge, Einreichen von Code
-----------------------------------------------------------------
-
-Jegliche Fehlerberichte und Beiträge von Code sind herzlich willkommen.
-Fehler sollten in jedem Falle gemeldet werden (nach Möglichkeit mit einem
-,Fix').
-
-Die wünschenswerte Methode zum Einsenden eines Problemberichtes von einer
-Maschine mit Internet-Mailzugang ist die Nutzung des Programmes send-pr.
-Diese Berichte werden sorgfältig von unserem Bugfile-Programm regi-
-striert, und es wird alles getan, so schnell wie möglich darauf zu
-antworten.
-
-Ist es aus irgendeinem Grunde nicht möglich, das Programm ,,send-pr''
-zu nutzen, so können Fehlerberichte auch direkt an
-
- bugs@FreeBSD.org
-
-gesandt werden. Außerdem steht die Liste
-
- questions@FreeBSD.org
-
-für allgemeine Fragen zur Verfügung.
-
-(Bitte, wenn möglich, an diese Listen in englischer Sprache schreiben.)
-
-Selbstverständlich sind wir, da all unsere Arbeit auf der Basis von Frei-
-willigkeit geschieht, jederzeit über zusätzliche Helfer erfreut -- es
-gibt jetzt schon mehr zu tun, als wir jemals zu tun in der Lage sein
-werden! Technische Diskussionsbeiträge oder Hilfsangebote können an
-
- hackers@FreeBSD.org
-
-gesandt werden. Diese Listen verursachen in der Regel ein beträcht-
-liches Mailaufkommen. Für diejenigen, die einen langsamen oder teuren
-Mailanschluß haben und nur an den Ankündigungen wichtiger Ereignisse
-interessiert sind, mag daher
-
- announce@FreeBSD.org
-
-interessant sein.
-
-
-All diesen Gruppen mit Ausnahme von freebsd-bugs kann jeder Interessierte
-jederzeit beitreten. Eine Mail an ,,MajorDomo@FreeBSD.org'' geschickt,
-mit lediglich dem Schlüsselwort ,,help'' auf einer eigenen Zeile in der
-Nachricht, wird mit der Information über die vorhandenen Listen und
-Teilnahmemöglichkeiten beantwortet. Neben den hier genannten Listen
-existieren noch weitere, die auf bestimmte Interessengruppen ausgerichtet
-sind, so daß die Anfrage durchaus lohnt!
-
-
-6. Würdigungen
---------------
-
-FreeBSD verkörpert die Arbeit vieler Dutzender, wenn nicht Hunderte,
-Einzelner aus der ganzen Welt, die hart gearbeitet haben, um diese
-Version fertigzustellen. Es wäre sehr schwierig oder schier unmöglich,
-jeden aufzuzählen, der in irgendeiner Form zu FreeBSD beigetragen hat.
-Nichtsdestotrotz soll der Versuch unternommen werden (natürlich in
-alphabetischer Reihenfolge). Sollte ein Name fehlen, so ist dieses
-ausschließlich ein Versehen.
-
-
-Die Computer Systems Research Group (CSRG), U.C. Berkeley.
-
-Bill Jolitz, für seine ersten Arbeiten am 386BSD.
-
-Das FreeBSD-Core-Team
-(in alphabetischer Reihenfolge der Vornamen):
-
- Andreas Schulz <ats@FreeBSD.org>
- Andrey A. Chernov <ache@FreeBSD.org>
- Bruce Evans <bde@FreeBSD.org>
- David Greenman <davidg@FreeBSD.org>
- Garrett A. Wollman <wollman@FreeBSD.org>
- Gary Palmer <gpalmer@FreeBSD.org>
- Geoff Rehmet <csgr@FreeBSD.org>
- Jack Vogel <jackv@FreeBSD.org>
- John Dyson <dyson@FreeBSD.org>
- Jordan K. Hubbard <jkh@FreeBSD.org>
- Justin Gibbs <gibbs@FreeBSD.org>
- Paul Richards <paul@FreeBSD.org>
- Poul-Henning Kamp <phk@FreeBSD.org>
- Rich Murphey <rich@FreeBSD.org>
- Rodney W. Grimes <rgrimes@FreeBSD.org>
- Satoshi Asami <asami@FreeBSD.org>
- Søren Schmidt <sos@FreeBSD.org>
-
-Besondere Erwähnung verdienen:
-
- Walnut Creek CDROM, ohne deren Hilfe und ständige Unterstützung
- diese Ausgabe nie möglich geworden wäre.
-
- Dermot McDonnell für seine Bereitstellung eines Toshiba XM3401B
- CDROM-Laufwerkes.
-
- Weitere Helfer und Beta-Tester von FreeBSD:
-
- J.T. Conklin Julian Elischer
- Frank Durda IV Peter Dufault
- Sean Eric Fagan Jeffrey Hsu
- Terry Lambert L Jonas Olsson
- Chris Provenzano Dave Rivers
- Guido van Rooij Steven Wallace
- Atsushi Murai Scott Mace
- Nate Williams
-
- sowie alle an der Montana State University für ihre anfängliche
- Unterstützung.
-
-
-Jordan möchte weiterhin besonders Poul-Henning Kamp und Gary Palmer
-danken, die ihm beide in vielstündiger Arbeit geholfen haben, das neue
-Installationssystem zusammenzustellen. Poul, kürzlich stolzer Vater
-geworden, hat es trotz seines enormen Zeitdrucks immer noch geschafft,
-eine beträchtliche Menge an Arbeit in das Projekt zu investieren. Diese
-Version wäre ohne ihn nicht geworden! Dank Euch Beiden!
-
-Weiterhing geht Dank an all diejenigen, die mitgeholfen haben, besonders
-auch an alle Nichtgenannten. Wir hoffen, daß diese Ausgabe von FreeBSD
-allgemeinen Anklang findet!
-
- Das FreeBSD Core-Team
-
-$Id: RELNOTES,v 1.2 1995/06/07 05:51:03 jkh Exp $
-=======================================================================
diff --git a/release/sysinstall/help/de_DE.ISO8859-1/configure.hlp b/release/sysinstall/help/de_DE.ISO8859-1/configure.hlp
deleted file mode 100644
index 468c1b5..0000000
--- a/release/sysinstall/help/de_DE.ISO8859-1/configure.hlp
+++ /dev/null
@@ -1,18 +0,0 @@
-Mit diesem Menü kann man das System nach der Installation ein wenig
-konfigurieren. Es sollten wenigstens das Paßwort für den System-
-verwalter gesetzt sowie die Zeitzone eingestellt werden.
-
-Für zusätzliche ,,Rosinen'' wie bash, emacs, pascal usw. ist es wohl
-immer notwendig, einen Blick auf den Menüpunkt ,,Packages'' zu werfen.
-Dies ist gegenwärtig nur sinnvoll, wenn man entweder von einer CDROM
-installiert oder aber die Package-Sammlung irgendwo in der Datei-
-systemhierarchie bereits vorhanden ist, so daß die Package-Verwaltung
-darauf zugreifen kann. Eine automatische Übertragung der Packages
-mittels FTP ist derzeit noch nicht vorgesehen.
-
-Soll das Installationsprogramm für die Packages nach Beenden der
-Systeminstallation nochmals aufgerufen werden, der Kommandoname
-dafür ist ,,pkg_manage''. Das Einstellen der Zeitzone geschieht
-mit dem Kommando ,,tzsetup''. Weitere Informationen bezüglich der
-allgemeinen Systemkonfiguration befinden sich in der Datei
-,,/etc/sysconfig''.
diff --git a/release/sysinstall/help/de_DE.ISO8859-1/drives.hlp b/release/sysinstall/help/de_DE.ISO8859-1/drives.hlp
deleted file mode 100644
index 41681f0..0000000
--- a/release/sysinstall/help/de_DE.ISO8859-1/drives.hlp
+++ /dev/null
@@ -1,29 +0,0 @@
-Sowie die ernsthafte Absicht besteht, wirklich irgendetwas von FreeBSD
-auf einem Laufwerk zu instellieren, sollte man sich UNBEDINGT VERSICHERN,
-daß die vom Partition-Editor berichtete Geometrie (siehe Installations-
-Menü) auch die richtige für die Kombination aus Laufwerk und Controller
-ist!
-
-IDE-Laufwerke ,,lernen'' oftmals ihre Geometrie über das Setup des BIOS,
-oder (für größere Laufwerke), ihre Geometrie wird entweder vom IDE-
-Controller oder aber einem speziellen Werkzeug, das zur Bootzeit geladen
-wird, wie dem OnTrack Systems Disk- Manager, uminterpretiert (,,remap-
-ped''). In solchen Fällen ist das Erkennen der richtigen Geometrie noch
-schwerer, da man nicht einfach auf dem Laufwerk oder im BIOS-Setup
-nachsehen kann. Dann ist es das Beste, ein DOS zu booten (von der
-Festplatte, nicht von einer Diskette!) und mittels des im tools/-Ver-
-zeichnis auf der FreeBSD-CDROM oder auf einem FTP-Server bereitgestellten
-Programmes ,,pfdisk'' die Geometrie zu vergleichen. Dieses Programm
-berichtet die Geometrie, wie DOS sie sieht, die allgemein als die
-richtige angenommen werden kann.
-
-Falls gar keine DOS-Partition gewünscht wird, kann es sich dennoch als
-sinnvoll erweisen, eine solche (sehr kleine) vorerst einzurichten, um
-sich über die Laufwerksgeometrie zu informieren. Sie kann dann später
-wieder gelöscht werden.
-
-Es ist aber tatsächlich gar nicht so schlecht (ob man's glaubt oder
-nicht), eine bootfähige DOS-Partition auf der Platte zu haben: falls die
-Maschine später instabil wird oder einfach ,,spinnt'', so kann man von da
-aus bequem eines der kommerziell erhältlichen System-Diagnose-Programme
-laufen lassen.
diff --git a/release/sysinstall/help/de_DE.ISO8859-1/install.hlp b/release/sysinstall/help/de_DE.ISO8859-1/install.hlp
deleted file mode 100644
index 420eb95..0000000
--- a/release/sysinstall/help/de_DE.ISO8859-1/install.hlp
+++ /dev/null
@@ -1,450 +0,0 @@
- INSTALLATIONSANLEITUNG FÜR FreeBSD 2.0.5
-
-Diese Beschreibung dokumentiert die Installation von FreeBSD 2.0.5 auf der
-Maschine. Vor dem Beginn ist es ratsam, die Hardware-Anleitung zu studie-
-ren, um sich über die hardware-spezifischen Installationshinweise zu in-
-formieren (Konfiguration der Hardware, worauf man achten sollte usw.).
-
-
-Inhalt:
-=======
-
-1.0 Fragen und Antworten für DOS-Benutzer
- 1.1 Wie schaffe ich Platz für FreeBSD?
- 1.2 Kann ich von FreeBSD aus komprimierte DOS-Dateisysteme nutzen?
- 1.3 Kann ich erweiterte DOS-Partitions nutzen?
- 1.4 Kann ich DOS-Programme unter FreeBSD laufen lassen?
-
-2.0 Vorbereitung der Installation
- 2.1 Vor dem Installieren von CDROM
- 2.2 Vor dem Installieren von Diskette
- 2.3 Vor dem Installieren von einer DOS-Partition
- 2.4 Vor dem Installieren von einem QIC- oder SCSI-Bandlaufwerk
- 2.5 Vor dem Installieren über Netz
- 2.5.1 Vorbereiten einer NFS-Installation
- 2.5.2 Vorbereiten einer FTP-Installation
-
-3.0 Installieren von FreeBSD
-
-
-
-1.0 Fragen und Antworten für DOS-Benutzer
-=== =====================================
-
-1.1 Hilfe! Kein Platz mehr! Muß ich nun erst alles löschen?
-
-Wenn auf der Maschine bereits ein DOS installiert ist und nun nur noch
-wenig oder gar kein freier Platz mehr für eine FreeBSD-Installation bleibt,
-so muß man nicht gleich alle Hoffnung aufgeben! Das Hilfsprogramm FIPS,
-das sich im Unterverzeichnis tools/ auf der FreeBSD-CDROM oder auf den
-verschiedenen FreeBSD-FTP-Servern befindet, kann sich hier als sehr nütz-
-lich erweisen.
-
-FIPS erlaubt die Aufteilung einer bestehenden DOS-Partition in zwei Teile,
-wobei der ursprüngliche Inhalt der Originalpartition erhalten bleibt und
-das zweite Stück zum Installieren von FreeBSD verfügbar wird. Man defrag-
-mentiert die Partition zuerst mittels des Programmes ,,DEFRAG'' von DOS 6
-oder mittels der Norton Disk Tools und läßt anschließend FIPS laufen. Das
-Programm erfragt dann den Rest der benötigten Informationen. Danach kann
-man neu booten und FreeBSD in der freigewordenen ,Slice' installieren. Im
-Menüpunkt ,,Distributions'' kann man eine Abschätzung vornehmen, wieviel
-freien Platz man für die gewünschte Installation etwa benötigt.
-
-
-1.2 Kann ich von FreeBSD aus komprimierte DOS-Dateisysteme nehmen?
-
-Nein. Wenn man ein Programm wie Stacker (TM) oder DoubleSpace (TM) be-
-nutzt, so kann FreeBSD nur den Bereich des (DOS-)Dateisystems nutzen, der
-nicht komprimiert worden ist. Der Rest erscheint dann als eine einzige
-große Datei (die Stacker- oder DoubleSpace-Datei). DIESE DATEI UNTER
-KEINEN UMSTÄNDEN LÖSCHEN! Das würde man nachher bereuen!
-
-
-1.3 Kann ich erweiterte DOS-Partitions nehmen?
-
-Diese Möglichkeit bietet FreeBSD 2.0.5 noch nicht, aber sie ist für Version
-2.1 vorgesehen. Die Grundlagen dafür sind bereits geschaffen, es ist nur
-noch 1 % an Restarbeit nötig.
-
-
-1.4 Kann ich DOS-Programme unter FreeBSD laufen lassen?
-
-Noch nicht. Wir hätten das gern irgendwann, aber bisher hat sich noch
-niemand gefunden, der die Arbeit machen würde. Die voranschreitenden
-Arbeiten mit dem Linux-DOSEMU-Programm bringen uns aber näher ans Ziel.
-Diejenigen, die sich an der Arbeit beteiligen möchten, können sich mittels
-einer Mail an hackers@freebsd.org gern melden!
-
-Es gibt jedoch in der ,,Ports collection'' ein nettes Programm namens
-,,pcemu''. Es emuliert einen 8088 sowie ausreichend BIOS-Dienste, um
-DOS-Programme im Textmode laufen zu lassen. Es benötigt ein X-Window-
-System zum Arbeiten.
-
-
-
-2.0 Vorbereitung der Installation
-=== =============================
-
-2.1 Vor dem Installieren von CDROM:
-
-Wenn es sich bei dem CDROM-Laufwerk um eins handelt, was nicht unterstützt
-wird (z. B. ein IDE-CDROM-Laufwerk), dann bitte bei Punkt 2.3 (,,Vor dem
-Installieren von einer DOS-Partition'') weiterlesen.
-
-Es bedarf keiner großen Vorbereitungen, um von einer der FreeBSD-CDROMs von
-Walnut Creek zu installieren. (Andere CDROM-Distributionen können genauso
-einfach zu nutzen zu sein, aber da wir keinerlei Einfluß auf deren Gestal-
-tung haben, können wir darüber nichts aussagen.) Man kann entweder mittels
-des von Walnut Creek gelieferten Scriptes ,,install.bat'' direkt die CDROM
-booten, oder aber man fertigt sich mittels ,,makeflp.bat'' eine Boot-Dis-
-kette an.
-
-Der allereinfachste Weg (von DOS aus) ist, einfach ,,go'' einzutippen. Es
-erscheint ein kleines DOS-Menü, das einen durch die verfügbaren Möglich-
-keiten geleitet.
-
-Will man die Bootdiskette von einem Unix-System aus erstellen, so führt
-vielleicht ein Kommando wie ,,dd if=floppies/boot.flp of=/dev/rfd0'' oder
-aber ,,dd if=floppies/boot.flp of=/dev/floppy'' zum Ziel, abhängig von der
-verwendeten Hardware und dem Betriebssystem.
-
-Sowie man von DOS oder einer Diskette aus gebootet hat, kann man sich im
-Menüpunkt ,,Media menu'' des Installationsprogrammes die CDROM als Medium
-aussuchen und die komplette Distribution davon laden. Es werden keine
-weiteren Medien benötigt.
-
-Nachdem das System installiert ist und man von der Festplatte neu gebootet
-hat, müßte die CD im Verzeichnis /cdrom gemountet sein. Das Hilfsprogramm
-,lndir', das zusammen mit der XFree86-Distribution kommt, kann hier sehr
-nützlich sein: man kann damit einen Baum von symbolischen Links aufbauen,
-der das nicht beschreibbare Medium CDROM auf der Festplatte spiegelt. Als
-kleines Beispiel:
-
- mkdir /usr/ports
- lndir /cdrom/ports /usr/ports
-
-Danach kann man dann ,,cd /usr/ports; make'' eintippen, alle Quellen werden
-von der CD gelesen, aber alle Zwischendateien werden unterhalb /usr/ports
-angelegt, das sich zweckmäßig auf einem besser beschreibbaren Medium befin-
-den sollte! :-)
-
-WICHTIGER HINWEIS: Vor Beginn der Installation unbedingt davon überzeugen,
-daß die CDROM im Laufwerk ist, so daß sie beim Test gefunden wird! Dies
-ist auch nötig, wenn man gern die CDROM automatisch während der Installa-
-tion in die Standard-Konfiguration aufgenommen haben möchte (unabhängig
-davon, ob die Installation selbst von CDROM erfolgt). Dies wird sich in
-Version 2.1 ändern, aber gegenwärtig ist dies eine einfache Methode um
-festzustellen, daß die CDROM tatsächlich zugreifbar ist.
-
-Schließlich ist es ein Leichtes, wenn man es anderen ermöglichen will,
-FreeBSD direkt von der CDROM in der eigenen Maschine mittels FTP installie-
-ren zu lassen. Es ist lediglich nach Vollenden der Installation nötig,
-folgende Zeile in die Datei /etc/master.passwd aufzunehmen (bitte mit dem
-Kommando ,,vipw''):
-
- ftp:*:99:99::0:0:FTP:/cdrom:/nonexistent
-
-Mehr ist nicht nötig. Alle anderen können nun in ihrem Installationsmenü
-,,FTP'' als Medium auswählen und als Servernamen (über den Menüpunkt
-,,Other'') eintragen: ftp://<Adresse dieser Maschine>!
-
-
-2.2 Vor dem Installieren von Diskette
-
-Wenn man von Disketten installieren will, weil z. B. die Hardware nicht
-anders unterstützt wird oder aber für diejenigen, die schwierige Wege
-mögen, so muß man zuerst einige Installationsdisketten vorbereiten.
-
-Die erste Diskette, die man (außer der Bootdiskette) benötigt, ist die
-,,floppies/root.flp''. Sie ist insofern etwas Besonderes, daß es sich
-nicht um eine Diskette mit DOS-Dateisystem handelt, sondern um ein Abbild
-(,image') binärer Daten (genauer gesagt, um ein mit ,gzip' komprimiertes
-cpio-Archiv). Man kann dieses Abbild entweder unter DOS mittels des
-Programmes ,,rawrite.exe'' auf die Diskette bringen, oder unter Unix mit
-dem ,,dd''-Kommando (siehe Bemerkungen in Punkt 2.1 für die Datei
-,,floppies/boot.flp''). Nachdem diese Diskette fertig ist, kann es mit den
-Distributions-Disketten weitergehen.
-
-Man benötigt mindestens so viele 1.44-MB- oder 1.2-MB-Disketten, wie nötig
-sind, um die Dateien im Verzeichnis ,bin' (Binärdistribution) aufzunehmen.
-DIESE Disketten *müssen* DOS-formatiert sein, entweder mit dem Kommando
-,,FORMAT'' in DOS oder dem Dateimanager in Microsoft Windows (TM). Man
-sollte vorformatierten Disketten nicht trauen und sie sicherheitshalber
-nochmals selbst formatieren!
-
-In der Vergangenheit wurden wiederholt Probleme mit mangelhaft formatier-
-ten Datenträgern berichtet, daher hier nochmals obiger Hinweis!
-
-Nach dem Formatieren der Disketten müssen nun die Dateien darauf über-
-tragen werden. Die Distributions-Dateien sind in Stücke zerlegt, von denen
-5 auf eine gewöhnliche 1.44-MB-Diskette passen. Man packt einfach alle
-vorhandenen Dateien auf die Disketten, so viele, wie auf jede draufpassen,
-bis das Ende erreicht ist. Jede Distribution muß dabei in einem eigenen
-Untervezeichnis auf den Disketten abgelegt werden, also z. B.:
-a:\bin\bin.aa, a:\bin\bin.ab, ...
-
-Sowie im Installationsprogramm der Menüpunkt zur Medienauswahl erreicht
-wird, wählt man ,,Floppy'' aus - der Rest wird dann abgefragt.
-
-
-2.3 Vor dem Installieren von einer DOS-Partition
-
-In Vorbereitung der Installation von einer DOS-Partition kopiert man
-einfach alle Dateien der Distribution(en) in ein Verzeichnis, das
-,,FREEBSD'' heißen soll. Um also eine Minimalinstallation von FreeBSD
-vorzunehmen, wobei man die Dateien von der CDROM auf die DOS-Partition
-kopiert:
-
- C> MD C:\FREEBSD
- C> XCOPY /S E:\DISTS\BIN C:\FREEBSD
- C> XCOPY /S E:\FLOPPIES C:\FREEBSD
-
-...in der Annahme, daß auf ,C:' der nötige freie Platz ist und die CDROM
-,E:' genannt wird. Es ist wesentlich, daß auch das Verzeichnis FLOPPIES
-mit kopiert wird, da die Datei ,root.flp' daraus während einer Installation
-von einer DOS-Partition automatisch entnommen wird.
-
-Man kann all die gewünschten ,DISTS' unterhalb ,C:\FREEBSD' plazieren - die
-,BIN'-Distribution ist lediglich das notwendige Minimum.
-
-
-2.4 Vor dem Installieren von einem QIC- oder SCSI-Bandlaufwerk
-
-Die Installation von einem Bandlaufwerk ist wohl die einfachste Variante,
-wenn man keine Online-FTP-Installation oder Installation von CDROM vorneh-
-men kann. Das Installationsprogramm erwartet die Distributions-Dateien
-einfach im tar-Format auf dem Band. Nachdem man also alle interessierenden
-Dateien geholt hat, kann man das Band einfach mit folgenden Kommandos er-
-stellen:
-
- cd /freebsd/distdir
- tar cvf /dev/rwt0 (or /dev/rst0) dist1 .. dist2
-
-Das Verzeichnis ,floppies/' muß als eine der ,dist's in obigem Beispiel mit
-angegeben worden sein, da das Installationsprogram vom Band die Datei
-,floppies/root.flp' lesen muß.
-
-Während der Installation muß es auch gewährleistet sein, daß man genügend
-Platz in einem Zwischenverzeichnis besitzt (der Name dafür wird abgefragt),
-um den KOMPLETTEN Inhalt des erzeugten Installationsbandes dort ablegen zu
-können. Da sich Bänder nicht wahlfrei zugreifen lassen, benötigt man
-vorübergehend die gleiche Menge an Plattenplatz zusätzlich, die auch auf
-das Band geschrieben worden ist!
-
-WICHTIGER HINWEIS: Zu Beginn der Installation muß sich das Band bereits im
-Laufwerk befinden, *bevor* man die Bootdiskette startet. Damit wird
-sichergestellt, daß der Test während der Installation das Band auch
-wirklich erkennt.
-
-
-2.5 Vor dem Installieren über Netz
-
-Netzwerkinstallationen kann man über drei verschiedene Kommunikations-
-medien vornehmen:
-
- Serieller port: SLIP oder PPP
- Parallelport: PLIP (mittels ,Laplink'-Kabel)
- Ethernet: mittels Standard-Ethernet-Adapter (einschließlich
- einiger PCMCIA-Adapter).
-
-SLIP-Unterstützung ist eher primitiv und auf festverdrahtete Verbindungen
-beschränkt (beispielsweise ein serielles Kabel zwischen einem Laptop und
-einem anderen Computer). Die Festverdrahtung ist nötig, da die Installa-
-tion über SLIP derzeit keien Möglichkeiten zum Aufbau einer Wählverbindung
-anbietet; letzteres kann man aber mittels PPP machen, das man ohnehin
-soweit möglich dem SLIP vorziehen sollte.
-
-Bei Benutzung eines Modems ist PPP sicherlich die einzige Chance. Man
-sollte sich rechtzeitig die Informationen des Internet-Dienstanbieters
-bereitlegen, da sie früh innerhalb des Installationsprozesses abge-
-fragt werden. Minimal wird die IP-Adresse des Dienstanbieters sowie
-die eigene benötigt (die aber auch freigelassen werden kann, so daß
-PPP sie mit der Gegenseite aushandelt). Auch ist Kenntnis der ver-
-schiedenen ,,AT''-Kommandos des benutzten Modems nötig, da das Wähl-
-programm für PPP keine Kenntnisse über Modems besitzt.
-
-Falls eine Festverbindung zu einer anderen FreeBSD-Maschine (mit Ver-
-sion 2.0R oder höher) benutzt wird, so kann man auch die Variante mit
-einem ,,Laplink''-Kabel über den Parallelport in Betracht ziehen. Die
-typische Datenrate über einen Parallelport ist um einiges größer als
-das, was sich über serielle Leitungen erzielen läßt; Geschwindigkeiten
-um die 50 KB/s sind nicht ungewöhnlich.
-
-Schließlich ist für eine schnellstmögliche Installation ein Ethernet-
-Adapter natürlich eine gute Variante! FreeBSD unterstützt die meisten
-gängigen Ethernet-Karten, wobei sich im Hardware-Wegweiser (im Menü-
-punkt ,,documentation'' auf der Bootdiskette) eine Tabelle der nötigen
-Einstellungen findet. Bei Nutzung eines der unterstützten PCMCIA-
-Adapter muß sichergestellt sein, daß sie _vor_ dem Einschalten des
-Laptops eingesteckt sind! Leider unterstützt FreeBSD gegenwärtig
-keinen Austausch von PCMCIA-Karten im Betrieb.
-
-Natürlich benötigt man auch noch die IP-Adresse im Netzwerk, die
-,,Netzwerkmaske'' für das gewählte Netzwerk, sowie den Maschinennamen.
-Der lokale Systemverwalter oder Netzwerkverantwortliche kann über
-diese Angaben informieren. Für den Zugriff auf andere Hosts über
-Namen anstatt unhandlicher IP-Adressen ist auch noch die Adresse eines
-Name-Servers und ggf. eines Gateways vonnöten (bei PPP in der Regel
-der Internet-Dienstanbieter). All diese Angaben sollten man _vor_
-Beginn der Installation vom zuständigen System- oder Netzwerkverwalter
-einholen.
-
-Sowie man auf irgendeine Weise eine Netzwerkanbindung aufgebaut hat, kann
-man die Installation über NFS oder FTP fortsetzen.
-
-
-2.5.1 Vorbereiten einer NFS-Installation
-
- Eine Installation über NFS ist recht einfach: man kopiert die
- gewünschten FreeBSD-Distributions-Dateien irgendwo auf einen
- Server und gibt deren Standort in der NFS-Medienauswahl an.
-
- Falls dieser Server nur Zugriffe über einen ,,privilegierten''
- Port erlaubt (wie allgemein bein Sun-Workstations üblich), so
- muß man die entsprechende Option im ,,Options''-Menü setzen,
- bevor man weitermacht.
-
- Falls man nur eine schlechte Ethernet-Karte besitzt, die sehr
- langsam arbeitet, so sollte man ebenfalls die entsprechende
- Option einschalten.
-
- Damit eine NFS-Installation funktioniert, muß der Server das
- Mounten von Unterverzeichnissen erlauben; hat man also beispiels-
- weise die Distribution von FreeBSD 2.0.5 im Verzeichnis
- ziggy:/usr/archive/stuff/FreeBSD untergebracht, so muß der Server
- das direkte Mounten von /usr/archive/stuff/FreeBSD erlauben, nicht
- nur /usr oder /usr/archive/stuff.
-
- In FreeBSD's /etc/export-Datei wird dies mittels der Option
- ``-alldirs'' gesteuert. Andere NFS-Server haben dafür andere
- Konventionen. Wenn man während der Installation Meldungen vom
- Server bekommt, die ,,Permission denied'' heißen, so ist dies
- wahrscheinlich das Problem!
-
-
-2.5.2 Vorbereiten einer FTP-Installation
-
- Eine Installation über FTP kann man von jedem Server vornehmen, der
- eine einigermaßen aktuelle Kopie der FreeBSD-Version 2.0.5 gespie-
- gelt hält. Das Menü ,,FTP sites'' enthält eine gute Auswahl von
- FTP-Servern aus der ganzen Welt.
-
- Wenn man von einem anderen Server installieren will, der nicht
- aufgeführt ist, oder Probleme mit der Konfiguration des Name-
- Servers hat, so kann man durch Auswahl des Menüpunktes ,,Other'' in
- diesem Menü auch seine eigene URL eingeben. Da eine URL auch eine
- numerische IP-Adresse enthalten kann, kann man bei Fehlen eines
- Name-Servers also auch eingeben:
-
- ftp://192.216.222.4/pub/FreeBSD/2.0.5-RELEASE
-
- Wenn man mittels FTP in einer Umgebung installiert, die hinter
- einem ,,Firewall'' gelegen ist, so sollte man ,,Passive mode'' FTP
- benutzen (was bereits standardmäßig eingestellt ist). Falls man
- aus irgendeinem Grunde auf einen Server angewiesen ist, der keinen
- Passiv-Modus unterstützt, kann man im ,,Options''-Menü stattdessen
- Aktiv-Modus auswählen.
-
-
-3.0 Installieren von FreeBSD
---- ------------------------
-
-Nachdem man die entsprechenden Vorbereitungen getroffen hat, sollte die
-Installation von FreeBSD ohne Schwierigkeiten vor sich gehen.
-
-Falls dies doch nicht zutrifft, so hat man vielleicht einen wichtigen
-Hinweis bei der Vorbereitung der Installationsmedien verpaßt (siehe
-Abschnit 2.X) und sollte nochmals dort nachlesen? Im Falle von Hardware-
-problemen (oder wenn FreeBSD gar nicht erst bootet) kann die Hardware-
-Anleitung auf der Boot-Diskette Hinweise zur Problembeseitigung geben.
-
-Die FreeBSD-Bootdiskette enthält alle benötigte Online-Dokumentation, damit
-man sich in der Installation zurechtfindet. Falls dies nicht der Fall ist,
-so hätten wir gern gewußt, an welcher Stelle die Probleme auftauchen! Es
-ist das Ziel von FreeBSD's Installationsprogramm (sysinstall), ausreichend
-selbstdokumentierend zu sein, um langwierige ,,Schritt für Schritt''-
-Anleitungen hinfällig werden zu lassen. Wir werden sicher noch ein wenig
-brauchen, bis dieses Ziel erreicht ist -- aber es ist das Ziel!
-
-Unterdessen mag die folgende ,,typische Bootreihenfolge'' ganz nützlich
-sein:
-
-o Die Diskette booten. Nach einer Folge von Boot-Schritten, die je nach
- der Hardware zwischen 30 Sekunden und 3 Minuten dauern kann, sollte das
- Anfangsmenü erscheinen. Wenn die Diskette gar nicht bootet oder das
- System während des Bootens hängenbleibt, sollte man den Abschnitt mit
- ,,Fragen und Antworten'' in der Hardware-Anleitung hinsichtlich möglicher
- Ursachen konsultieren.
-
-o Taste F1 drücken. Es folgen einige grundlegende Hinweise über die
- Nutzung des Menüsystems. Alle diejenigen, die dieses Menüsystem noch
- nicht zuvor genutzt haben, sollten sich das BITTE sorgfältig durchlesen!
-
-o Für diejenigen, die Englisch nicht als Muttersprache sprechen, sei die
- Auswahl einer anderen Sprache im Menüpunkt ,,Language'' empfohlen (was ja
- ganz offensichtlich geschehen ist :). Ein Teil der Dokumentation wird
- dann in der gewählten Sprache anstatt in Englisch angeboten.
-
-o Auswahl der Sonderwünsche im Menüpunkt ,,Options''.
-
-o ,,Proceed'' anwählen, um mit dem Istallationsmenü fortzusetzen.
-
-Das Installationsmenü:
-
-o Man kann in diesem Menü alles vornehmen, ohne am bestehenden System
- irgendetwas zu ändern, solange man nicht ,,Commit'' auswählt; erst damit
- werden alle angeforderten Änderungen auch tatsächlich ausgeführt.
-
- Wenn an irgendeiner Stelle Probleme auftauchen, so bringt die Taste F1
- normalerweise die richtigen Hinweise für das Bild, in dem man sich gerade
- befindet.
-
- o Der erste Schritt ist normalerweise ,Partition', bei dem man
- die von FreeBSD zu nutzenden Plattenlaufwerke auswählen kann.
-
- o Danach kann man mit dem ,Label'-Editor den für FreeBSD vorge-
- sehenen Platz aufteilen oder aber eine nicht-FreeBSD-Partition
- (z. B. DOS) ins System einbinden.
-
- o Danach wählt man im ,Media'-Menü das gewünschte Installations-
- medium. Sowie alle benötigten Informationen für die Installation
- beisammen sind, beendet sich dieses Menü selbst; andernfalls
- werden weitere Fragen gestellt (abhängig vom Medium).
-
- o Schließlich bestätigt man mit dem ,Commit'-Menüpunkt auf einmal
- alle ausgewählten Aktionen (ohne diese Bestätigung wurde noch
- nichts auf die Festplatte geschrieben). Es werden alle Infor-
- mationen über neue oder geänderte Partitions geschrieben, die
- Dateisysteme angelegt oder zerstörungsfrei neu markiert (abhängig
- von der ,,newfs''-Markierung im Label-Editor) und schließlich
- alle gewünschten Distributions ausgepackt.
-
- o Über das ,Configure'-Menü kann man die FreeBSD-Installation
- weiter konfigurieren. Man kann hier menügesteuert die einzelnen
- Vorgabewerte für Systemparameter einstellen. Einige Punkte, wie
- z. B. die Netzwerkparameter, sind besonders wesentlich, wenn man
- von CDROM/Band/Diskette installiert hat und daher den Netzwerk-
- zugang noch nicht konfiguriert hat (sofern vorhanden). Wenn man
- hier bereits das Netzwerk richtig konfiguriert, so hat man schon
- beim ersten Neustart von der Festplatte einen funktionierenden
- Zugriff zum Netz.
-
- o Mittels ,Exit' gelangt man wieder zum Hauptmenü.
-
-
-An dieser Stelle hat man seine Arbeit mit dem sysinstall-Programm beendet.
-Man kann schließlich ,Quit' anwählen. Wurde sysinstall als Erstinstalla-
-tionsprogramm benutzt (bevor das System also eingerichtet war), so erfolgt
-an dieser Stelle ein Neustart. Hatte man einen Boot-Manager ausgewählt, so
-erscheint dann ein kleines Boot-Menü mit den Zeichen ,,F?'' als Eingabe-
-aufforderung. Nachdem man die entsprechende Funktionstaste für FreeBSD
-gedrückt hat (wird angezeigt), sollte FreeBSD von der Festplatte aus ge-
-startet werden.
-
-Falls dies aus irgendeinem Grunde nicht klappt, sei wiederum auf den
-Abschnitt ,,Fragen und Antworten'' in der Hardware-Anleitung verwiesen!
-
- Jordan (für die Anleitung)
- Jörg (für die deutsche Übersetzung)
-
----- Ende der Installations-Anleitung ---
diff --git a/release/sysinstall/help/de_DE.ISO8859-1/language.hlp b/release/sysinstall/help/de_DE.ISO8859-1/language.hlp
deleted file mode 100644
index cd7a834..0000000
--- a/release/sysinstall/help/de_DE.ISO8859-1/language.hlp
+++ /dev/null
@@ -1,17 +0,0 @@
-In diesem Menü kann man die Vorzugssprache einstellen. Vorerst wird
-damit nur die Sprache ausgewählt, in der die diversen Hilfedateien
-angezeigt werden.
-
-In späteren Versionen werden davon auch das Tastaturlayout, der Bild-
-schirmzeichensatz und verschiedene NLS-Einstellungen betroffen sein
-(sysinstall selbst wird dann auch ,,message catalogs'' benutzen, so
-daß alle Menüs automatisch in der richtigen Sprache erscheinen). Auch
-sind weitere Internationalisierungsmaßnahmen vorgesehen, so daß die
-entsprechenden Standards eingehalten werden.
-
-Solange diese Verbesserungen noch nicht vorgenommen sind, mag es
-einfacher erscheinen, die Datei ,,/etc/sysconfig'' mit der Hand zu
-editieren, sobald das System erstmals vollständig installiert ist.
-Diese Datei enthält eine Anzahl (allerdings englischer) Kommentare,
-die die jeweiligen Änderungen beschreiben, sowie auch einige Beispiele
-nicht-englischer Voreinstellungen.
diff --git a/release/sysinstall/help/de_DE.ISO8859-1/media.hlp b/release/sysinstall/help/de_DE.ISO8859-1/media.hlp
deleted file mode 100644
index a591468..0000000
--- a/release/sysinstall/help/de_DE.ISO8859-1/media.hlp
+++ /dev/null
@@ -1,30 +0,0 @@
-Von den folgenden Medien kann man installieren:
-
- CDROM - eines der folgenden Laufwerke ist nötig:
-
- Sony CDU 31/33A
- Matushita/Panasonic "Sound Blaster" CDROM.
- Mitsumi FX-001{A-D} (alte nicht-IDE Laufwerke).
- SCSI - Jedes beliebige Standard-SCSI-CDROM-Laufwerk, das
- an einen unterstützten Controller angeschlossen ist
- (siehe auch Hardware-Wegweiser).
-
- DOS - eine primäre DOS-Partition, auf die die notwendigen
- FreeBSD-Distribution-Dataien kopiert worden sind (also
- z. B. (C:\FREEBSD\).
-
- FS - setzt ein existierendes FreeBSD-System voraus, in dem
- die Dateien der neuen Distribution abgelegt worden sind.
-
- Diskette - Entnahme der Distributions-Dateien von einer oder
- mehreren DOS-formatierten Disketten.
-
- FTP - Entnahme der Distributions-Dateien von einem anonymen
- FTP-Server (eine Liste wird angeboten).
-
- NFS - Einlesen der Distributions-Dateien über einen irgendwo
- gelegenen NFS-Server (dessen Zugriffsrechte dies natür-
- lich erlauben müssen!)
-
- Tape - Einlesen der Distributions-Dateien in ein Zwischenver-
- zeichnis und Auspacken von dort.
diff --git a/release/sysinstall/help/de_DE.ISO8859-1/network_device.hlp b/release/sysinstall/help/de_DE.ISO8859-1/network_device.hlp
deleted file mode 100644
index 1d4e498..0000000
--- a/release/sysinstall/help/de_DE.ISO8859-1/network_device.hlp
+++ /dev/null
@@ -1,56 +0,0 @@
-Eine Netzwerkinstallation kann über eine von drei verschiedenen Arten
-von Verbindungen vorgenommen werden:
-
- Serielle Ports: SLIP / PPP
- Parallelport: PLIP (benötigt ein ,,Laplink''-Kabel)
- Ethernet: von einem Standard-Ethernet-Controller (ein-
- schließlich einiger PCMCIA-Controller)
-
-Unterstützung für SLIP ist eher primitiv und auf festverdrahtete Ver-
-bindungen beschränkt, wie z. B. eine serielle Leitung zwischen einem
-Laptop und einem anderen PC. Es existiert gegenwärtig keine Möglich-
-keit, eine Wählverbindung über ein Modem herzustellen. Dies kann je-
-doch mittels des PPP-Programmes vorgenommen werden, was soweit möglich
-stets dem SLIP vorgezogen werden sollte. Bei der Auswahl eines
-seriellen Ports wird später die Möglichkeit geboten, die Parameter für
-das slattach-Kommando anzugeben. Es wird davon ausgegangen, daß in
-diesem Moment entweder slattach oder ein anderes geeignetes Kommando
-auf der Gegenseite der Verbindung gestartet worden ist, um die Verbin-
-dung aufzubauen. FreeBSD wird dann über diesen Anschluß installiert,
-wobei die Geschwindigkeit bis zu 115.2 kBaud betragen kann (was die
-empfehlenswerte Geschwindigkeit für eine festverdrahtete Leitung ist).
-
-Bei Benutzung eines Modems ist PPP sicherlich die einzige Chance. Man
-sollte sich rechtzeitig die Informationen des Internet-Dienstanbieters
-bereitlegen, da sie früh innerhalb des Installationsprozesses abge-
-fragt werden. Minimal wird die IP-Adresse des Dienstanbieters sowie
-die eigene benötigt (die aber auch freigelassen werden kann, so daß
-PPP sie mit der Gegenseite aushandelt). Auch ist Kenntnis der ver-
-schiedenen ,,AT''-Kommandos des benutzten Modems nötig, da das Wähl-
-programm für PPP keine Kenntnisse über Modems besitzt.
-
-Falls eine Festverbindung zu einer anderen FreeBSD-Maschine (mit Ver-
-sion 2.0R oder höher) benutzt wird, so kann man auch die Variante mit
-einem ,,Laplink''-Kabel über den Parallelport in Betracht ziehen. Die
-typische Datenrate über einen Parallelport ist um einiges größer als
-das, was sich über serielle Leitungen erzielen läßt; Geschwindigkeiten
-um die 50 KB/s sind nicht ungewöhnlich.
-
-Schließlich ist für eine schnellstmögliche Installation ein Ethernet-
-Adapter natürlich eine gute Variante! FreeBSD unterstützt die meisten
-gängigen Ethernet-Karten, wobei sich im Hardware-Wegweiser (im Menü-
-punkt ,,documentation'' auf der Bootdiskette) eine Tabelle der nötigen
-Einstellungen findet. Bei Nutzung eines der unterstützten PCMCIA-
-Adapter muß sichergestellt sein, daß sie _vor_ dem Einschalten des
-Laptops eingesteckt sind! Leider unterstützt FreeBSD gegenwärtig
-keinen Austausch von PCMCIA-Karten im Betrieb.
-
-Natürlich benötigt man auch noch die IP-Adresse im Netzwerk, die
-,,Netzwerkmaske'' für das gewählte Netzwerk, sowie den Maschinennamen.
-Der lokale Systemverwalter oder Netzwerkverantwortliche kann über
-diese Angaben informieren. Für den Zugriff auf andere Hosts über
-Namen anstatt unhandlicher IP-Adressen ist auch noch die Adresse eines
-Name-Servers und ggf. eines Gateways vonnöten (bei PPP in der Regel
-der Internet-Dienstanbieter). All diese Angaben sollten man _vor_
-Beginn der Installation vom zuständigen System- oder Netzwerkverwalter
-einholen.
diff --git a/release/sysinstall/help/de_DE.ISO8859-1/partition.hlp b/release/sysinstall/help/de_DE.ISO8859-1/partition.hlp
deleted file mode 100644
index 90041c0..0000000
--- a/release/sysinstall/help/de_DE.ISO8859-1/partition.hlp
+++ /dev/null
@@ -1,85 +0,0 @@
-Dies ist der DiskLabel-Editor von FreeBSD.
-
-Für Neulinge in dieser Installation ist es zuerst wichtig, FreeBSD's neues
-Prinzip der ,,Slices'' zu verstehen, das auf die Plattenspeicher angewandt
-wird. Es ist nicht sehr schwer. Ein ,,vollständig angegebener Slice-
-Name'', d. h. der Name der Gerätedatei, die unterhalb von /dev angespro-
-chen wird, um mit dem Gerät zu kommunizieren, läßt sich wahlweise in
-3 Teile zerlegen:
-
- Das erste ist der Name der Platte. In der Annahme, daß ein
- System zwei SCSI-Platten haben möge, wären das ,sd0' und
- ,sd1'.
-
- Das nächste ist die ,,Slice''- (oder ,,primäre Partition''-)
- Nummer. Wenn sd0 also z. B. zwei solche Partitions hat, eine
- für FreeBSD und eine für DOS, so ergibt das sd0s1 und sd0s2.
- Ist dann weiterhin sd1 völlig für FreeBSD reserviert, so hat
- sie nur die Slice sd1s1.
-
- Wenn dann weiterhin eine Slice vom FreeBSD-Typ ist, so besitzt
- diese eine Reihe (verwirrenderweise auch so genannter) ,,Par-
- titions''. Diese FreeBSD-Partitions bilden die Grundlage für
- die verschiedenen Dateisysteme oder den Swap-Bereich. Für die
- genannte hypothetische Maschine könnte das Layout für sd0 etwa
- so aussehen:
-
- Name Mountpunkt
- ---- ----------
- sd0s1a /
- sd0s1b <Swap-Bereich>
- sd0s1e /usr
-
- Aus historischen Gründen existiert auch noch ein Kurzschluß,
- eine ,,Kompatibilitäts-Slice'', mit der man einfacher auf die
- erste FreeBSD-Slice einer Platte zugreifen kann. Damit
- arbeiten auch die Programme, die mit dem Slice-Schema noch
- nicht zurechtkommen, wie gehabt. Die Kompatibilitäts-Slice
- für genannte Platte würde dann so aussehen:
-
- Name Mountpoint
- ---- ----------
- sd0a /
- sd0b <Swap-Bereich>
- sd0e /usr
-
- Die Zuordnung der Kompatibilitäts-Slice zur ersten gefundenen
- FreeBSD-Slice (in diesem Falle sd0s1) erfolgt automatisch. Es
- kann mehrere FreeBSD-Slices auf einer Platte geben, aber nur
- die erste wird als Kompatibilitäts-Slice zugeordnet!
-
- Möglicherweise wird die Kompatibilitäts-Slice später elimi-
- niert, aber gegenwärtig ist sie noch aus folgenden Gründen
- nötig:
-
- 1. Wie bereits erwähnt, kennen einige Programme noch
- nicht das Slice-Prinzip und benötigen noch Zeit,
- bis sie überarbeitet worden sind.
-
- 2. Im Moment sind die Bootblöcke von FreeBSD noch
- nicht in der Lage, von irgendeinem Root-Dateisystem
- außer dem in der Kompatibilitäts-Slice zu booten.
- Daher wird die Root also immer auf ,,sd0a'' er-
- scheinen (bezogen auf das Beispiel), auch wenn sie
- sich eigentlich auf sd0s1a befindet und ansonsten
- über den vollen Slice-Namen angesprochen wird.
-
-Sowie man diese Prinzipien verstanden hat, ist die Benutzung des Disk-
-label-Editors eigentlich einfach. Entweder, man teilt die FreeBSD-
-Slices, wie sie oben auf dem Bildschirm angezeigt werden, in kleinere
-Stücke auf (in der Mitte des Schirmes zu sehen) und plaziert dann
-später FreeBSD-Dateisysteme darauf, oder aber man mountet existierende
-Slices/Partitions in die Dateisystemhierarchie; dieser Editor erlaubt
-beides. Da eine DOS-Partition aus FreeBSD-Sicht auch nur eine weitere
-Slice ist, kann man sie mit diesem Editor auch ganz einfach in die
-Dateisystemhierarchie eingliedern. Für FreeBSD-Partitions kann man
-auch noch den ,,newfs''-Status umschalten, so daß die Partitions ent-
-weder von Grund auf neu-/wiedererzeugt werden oder aber einfach nur
-überprüft und gemountet (wobei ihr Inhalt erhalten bleibt).
-
-Wenn man fertig ist, beendet man den Editor mit ,,Q''.
-
-Es werden keinerlei Änderungen auf die Platte geschrieben, solange man
-nicht mittels ,,(C)ommit'' aus dem Installationsmenü alles bestätigt
-hat! Der Disklabel-Editor (und der ,,FDISK Partition''-Editor) ar-
-beiten mit einer Art Kopie der Disklabels.
diff --git a/release/sysinstall/help/de_DE.ISO8859-1/slice.hlp b/release/sysinstall/help/de_DE.ISO8859-1/slice.hlp
deleted file mode 100644
index c2c92e2..0000000
--- a/release/sysinstall/help/de_DE.ISO8859-1/slice.hlp
+++ /dev/null
@@ -1,28 +0,0 @@
-Dies ist der Editor für die primären Partitions (oder ,,Slices'').
-
-Unten werden die möglichen Kommandos angezeigt, ober der Inhalt des Master
-Boot Records. Man kann mit den Pfeiltasten nach oben und unten fahren und
-mittels ,,(C)reate'' eine neue Partition anlegen, wenn sich der ,Balken'
-über einer Partition befindet, deren Status als ,,unused'' markiert ist.
-
-Hier die Zeichenerklärung für das Feld ,,flags'':
-
- '=' -- Partition ist ordnungsgemäß ausgerichtet.
- '>' -- Die Partition endet nicht unterhalb von Zylinder 1024.
- 'R' -- Ist markiert, das Root-Dateisystem zu enthalten.
- 'B' -- Partition benutzt Fehlersektorenbehandlung nach Bad144.
- 'C' -- Dies ist die FreeBSD-2.0-Kompatibilitätspartition.
- 'A' -- Die Partition ist als ,aktiv' (bootfähig) markiert.
-
-Bei der Auswahl einer Partition für Bad144-Behandlung wird diese vor
-Erzeugung der Dateisystem auf fehlerhafte Stellen untersucht.
-
-Wenn keine Partition als ,aktiv' markiert ist, so muß man entweder einen
-Boot-Manager installieren (dies wird später im Installationsprozeß ange-
-boten) oder aber eine als ,aktiv' markieren, bevor man dieses Menü wieder
-verläßt.
-
-Es werden keinerlei Änderungen auf die Platte geschrieben, solange man
-nicht mittels ,,(C)ommit'' aus dem Installationsmenü alles bestätigt hat!
-Der ,,FDISK Partition''-Editor (und der Disklabel-Editor) arbeiten mit
-einer Art Kopie der Disklabels.
diff --git a/release/sysinstall/help/de_DE.ISO8859-1/tcp.hlp b/release/sysinstall/help/de_DE.ISO8859-1/tcp.hlp
deleted file mode 100644
index d2a3b27..0000000
--- a/release/sysinstall/help/de_DE.ISO8859-1/tcp.hlp
+++ /dev/null
@@ -1,32 +0,0 @@
-In diesem Menü kann man sowohl die allgemeinen Netzwerkparameter ein-
-stellen (Hostname, Domainname, DNS-Server usw.) als auch die Parameter für
-ein bestimmtes Interface (das vom zuvor angezeigten Menü ausgewählt worden
-ist).
-
-Man kann zwischen den Feldern mittels der Tasten TAB, Rückwärts-TAB (Shift+
-TAB) und RETURN hin- und herspringen. Mittels DELETE oder BACKSPACE kann
-man ein Feld editieren. Mittels ^A (control-A) gelangt man an den Anfang
-einer Zeile, mittels ^E (control-E) ans Ende. ^F (control-F) geht ein
-Zeichen nach vorn, ^B (control-B) eins nach hinten; ^D (control-D) löscht
-das Zeichen unter dem Cursor, und ^K (control-K) löscht alles bis zum Zei-
-lenende. Im Prinzip handelt es sich um die wesentlichsten Emacs-Editier-
-kommandos.
-
-Das Feld ,,Extra options to ifconfig'' ist ein wenig besonders (oder auch:
-ein Hack :-).
-
-Damit kann man beispielsweise die Gegenseite einer SLIP- oder PLIP-Ver-
-bindung angeben (einfach die numerische IP-Adresse eingeben), oder aber
-einen bestimmten Steckverbinder einer Ethernetkarte auswählen, falls
-mehrere zur Auswahl sind (z. B. AUI, 10BaseT [twisted pair], 10Base2 [BNC]
-usw.). Die folgenden Steckverbinder werden akzeptiert:
-
- link0 - AUI * höchste Wertigkeit
- link1 - BNC
- link2 - UTP * niedrigste Wertigkeit
-
-Man kann also eins der Worte ,,link0'', ,,link1'' oder ,,link2'' in das
-,,Extra options''-Feld eintragen.
-
-Am Ende einfach ,,OK'' anwählen.
-
diff --git a/release/sysinstall/help/de_DE.ISO8859-1/usage.hlp b/release/sysinstall/help/de_DE.ISO8859-1/usage.hlp
deleted file mode 100644
index a8beada..0000000
--- a/release/sysinstall/help/de_DE.ISO8859-1/usage.hlp
+++ /dev/null
@@ -1,57 +0,0 @@
-BENUTZUNG DES SYSTEMS
-=====================
-
-TASTE WIRKUNG
------ -------
-PFEIL NACH OBEN Zum vorherigen Feld (oder eine Zeile nach oben im Text).
-PFEIL NACH UNTEN Zum nächsten Feld (oder eine Zeile nach unten im Text).
-TAB Zum nächsten Feld oder zur nächsten Gruppe.
-PFEIL NACH RECHTS Zum nächsten Feld oder zur nächsten Gruppe (wie TAB).
-SHIFT-TAB Zum vorherigen Feld oder zur vorherigen Gruppe.
-PFEIL NACH LINKS Zum vorherigen Feld oder zur vorherigen Gruppe (wie SH-TAB).
-RETURN Menüpunkt auswählen.
-BILD NACH OBEN Innerhalb von Textkästen: eine Seite zurück.
-BILD NACH UNTEN Innerhalb von Textkästen: eine Seite vor.
-LEERTASTE In Menüs mit mehreren Auswahlmöglichkeiten: umschalten.
-F1 Hilfe (sofern unterstützt).
-
-Wenn an den Seiten eines Menüs kleine "^(-)"- oder "v(+)"-Symbole zu
-sehen sind, so bedeutet das, daß weitere Menüpunkte ober- oder unter-
-halb des aktuellen Punktes existieren, die (infolge fehlenden Platzes
-auf dem Bildschirm) gerade nicht dargestellt werden können. Mittels
-der Pfeiltasten (nach oben oder unten) kann man das Menü rollen las-
-sen. Sowie eins der Symbole verschwindet heißt das, daß man ganz oben
-oder unten im Menü ist.
-
-In Textkästen wird die Stelle, an der man sich befindet, als Prozent-
-zahl in der rechten unteren Ecke angezeigt. 100 % bedeuten, daß man
-sich am Ende befindet.
-
-Die Auswahl von ,,OK'' in einem Menü bewirkt die durch dieses Menü
-ausgelöste Handlung. Die Auswahl von ,,Cancel'' bewirkt einen Abbruch
-und die Rückkehr zum vorherigen Menü.
-
-BESONDERE EIGENSCHAFTEN
-=======================
-
-Menüpunkte können auch durch Eintippen des ersten Zeichens ihres
-Namens ausgewählt werden, sofern dies eindeutig ist. In diesem Falle
-werden die entsprechenden Zeichen hervorgehoben.
-
-Der Bildschirmtreiber enthält auch einen Puffer, mit dem man sich die
-Sachen ansehen kann, die bereits herausgerollt worden sind. Um diese
-Funktion zu nutzen, muß man die ,,ScrollLock''-Taste (,,Rollen V'')
-drücken und danach die Pfeiltasten oder die Bild-auf/ab-Tasten.
-Dieser Modus wird durch nochmaliges Drücken der ,,ScrollLock''-Taste
-wieder verlassen. Diese Möglichkeit ist vor allem nützlich für
-Subshells oder andere ,,Expertenmodi'', die keine Menüs nutzen.
-
-Sowie das System vollständig installiert ist und im Multi-User-Modus
-läuft, werden mehrere ,,virtuelle Terminals'' aktiviert, auf denen man
-parallel mehrere aktive Sessions bedienen kann. Mittels ALT-F<n> kann
-zwischen diesen umgeschaltet werden, wobei ,,F<n>'' die Funktionstaste
-(F-Taste) ist, die der Nummer des gewünschten Bildschirms entspricht.
-Das System kommt vorkonfiguriert mit 3 virtuellen Terminals. Wenn
-mehr davon gewünscht werden, so kann dies nach dem Hochfahren des
-Systems geschehen, indem man sie in der Datei /etc/ttys freischaltet.
-Die maximale Anzahl ist 12.
diff --git a/release/sysinstall/help/de_DE.ISO_8859-1/README b/release/sysinstall/help/de_DE.ISO_8859-1/README
deleted file mode 100644
index 8ce9c18..0000000
--- a/release/sysinstall/help/de_DE.ISO_8859-1/README
+++ /dev/null
@@ -1,106 +0,0 @@
-
- -----------------------------------------
- FreeBSD 2.0.5 --- RELEASE Version , ,
- ----------------------------------------- /( )`
- \ \___ / |
-Willkommen zum Release 2.0.5 von FreeBSD, einem /- _ `-/ '
-Zwischen-Release von FreeBSD, das eine eine Lücke (/\/ \ \ /\
-füllt zwischen 2.0R (das im Nov. 94 erschien) und / / | ` \
-2.1R, das Ende Juli '95 erscheinen wird, die oft O O ) / |
-beklagt wurde. FreeBSD 2.0.5 enthält wesentliche `-^--'`< '
-Verbesserungen gegenüber 2.0R, deren wichtigste (_.) _ ) /
-eine erhöhte Systemstabilität (wesentlich besser), `.___/` /
-Dutzende neuer Features und ein stark `-----' /
-verbessertes Installationsprogramm <----. __ / __ \
-sind. Die Release Notes enthalten <----|====O)))==) \) /====
-weitere Details bzgl. der Neuheiten <----' `--' `.__,' \
-in FreeBSD 2.0.5. | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-
-Was ist FreeBSD? FreeBSD ist ein 4.4BSD-Lite-basiertes Betriebssystem für
-Intel, AMD, Cyrix oder NexGen "x86"-PC-Hardware. Es arbeitet mit einer
-großen Anzahl von PC-Peripherie und -Konfigurationen zusammen. Es kann für
-die Software-Entwicklung bis hin zum Anbieten von Internet-Diensten
-eingesetzt werden; der meist genutzte Rechner im Internet, ftp.cdrom.com,
-ist ein FreeBSD-Rechner.
-
-Dieses FreeBSD-Release enthält alles, was man zur Nutzung eines solchen
-Systems braucht; zusätzlich erhält man den kompletten Quellcode. Wenn man
-den Quellcode installiert hat, kann man das ganze Betriebssystem von Grund
-auf mit einem einzigen Befehl übersetzen; dies eignet es in idealer Weise
-für Studenten, Forscher oder einfach Leute, die sehen wollen, wie alles
-funktioniert.
-
-Es gibt ebenfalls eine große Anzahl portierter Dritt-Software (die "ports
-collection"), um die Verfügbarkeit und die Installation traditioneller
-Lieblings-UNIX-Utilities für FreeBSD zu erleichtern. Über 270 Portierun-
-gen, von Editoren über Programmiersprachen bis zu Grafikanwendungen, machen
-FreeBSD zu einem mächtigen und umfassenden Betriebssystem, das keinen
-Vergleich zu dem großer Workstations scheut.
-
-Als weitere Dokumentation zu diesem System empfehlen wir die 4.4BSD-
-Dokumentation von O'Reilly Associates und der USENIX Association, ISBN
-1-56592-082-1. Wir haben nichts mit O'Reilly zu tun, außer daß wir
-zufriedene Kunden sind!
-
-Wir empfehlen, die HARDWARE-ANLEITUNG *vor* jeglicher Fortführung der
-Installation zu lesen. PC-Hardware für irgend etwas anderes als DOS/
-Windows (das keine großen Anforderungen an die Hardware stellt) zu
-konfigurieren, ist schwieriger, als es zunächst aussieht. Und wenn man
-glaubt, PCs zu verstehen, dann hat man diese nur noch nicht lange genug
-benutzt. :) Diese Anleitung gibt einige Tips zur Hardwarekonfiguration und
-sagt, auf welche Symptome man bei Schwierigkeiten achten muß. Die Anlei-
-tung ist im Dokumentations-Menü der FreeBSD-Bootfloppy verfügbar.
-
-VORBEHALT: Obwohl FreeBSD alles versucht, vorhandene Daten gegen versehent-
-lichen Verlust zu schützen, ist es mit dieser Installation mehr als nur
-möglich, DIE GESAMTE FESTPLATTE ZU LÖSCHEN! Bitte nicht mit der endgül-
-tigen Installation von FreeBSD fortfahren, ohne zuerst alle wichtigen Daten
-angemessen gesichert zu haben! Wir empfehlen es eindringlichst!
-
-Technische Kommentare zu diesem Release sollten an:
-
- hackers@FreeBSD.org
-
-gesandt werden (wenn möglich, in englisch).
-
-Fehlermeldungen sollten bei erfolgreicher Installation mittels des
-`send-pr'-Kommandos, ansonsten an:
-
- bugs@FreeBSD.org
-
-gesandt werden.
-
-Bitte in jeder Fehlermeldung die genutzte FreeBSD-VERSION nennen!
-
-Allgemeine Fragen sollten an:
-
- questions@FreeBSD.org
-
-gesandt werden.
-
-Wir bitten um Geduld, wenn die Fragen nicht sofort beantwortet werden -
-dieses sind besonders arbeitsintensive Zeiten für uns, und unsere Resourcen
-(auf freiwilliger Basis) sind oft bis an die Grenzen ausgereizt! Mittels
-send-pr verschickte Fehlermeldungen werden registriert und in unserer
-Datenbank verfolgt. Über Statusänderungen wird über die gesamte Lebensdauer
-des Fehlers (oder der Forderung nach einem Feature) informiert.
-
-Unsere WEB Site, http://www.freebsd.org, ist ebenfalls eine gute Quelle
-für neue Informationen und enthält einige weitere, fortführende Infor-
-mationen. Man kann die BSDI-Version von Netscape zum Browsen (Blättern)
-im World Wide Web direkt aus FreeBSD heraus nutzen.
-
-Wir empfehlen auch in /usr/share/FAQ und /usr/share/doc zu weiteren
-Informationen zum System nachzuschauen.
-
-Wir danken für die Aufmerksamkeit und hoffen, daß dieses Release von
-FreeBSD viel Freude bereitet.
-
- Jordan Hubbard,
- für das FreeBSD Projekt
diff --git a/release/sysinstall/help/de_DE.ISO_8859-1/RELNOTES b/release/sysinstall/help/de_DE.ISO_8859-1/RELNOTES
deleted file mode 100644
index c3d2aa6..0000000
--- a/release/sysinstall/help/de_DE.ISO_8859-1/RELNOTES
+++ /dev/null
@@ -1,766 +0,0 @@
- RELEASE NOTES
- FreeBSD
- Release 2.0.5
-
-1. Technischer Überblick
-------------------------
-
-FreeBSD ist eine im Quellcode frei verfügbare Version eines 4.4-Lite-
-basierten Betriebssystems für PC's auf der Basis von Intel-i386/i486/
-Pentium-Prozessoren (oder kompatiblen). Es basiert hauptsächlich auf
-Software der Computer-Gruppe (CSRG) der Universität Kalifornien Berkeley
-mit einigen Erweiterungen aus den Systemen NetBSD, 386BSD und von der
-Free Software Foundation.
-
-Seit der Freigabe unserer Version FreeBSD 2.0 vor etwa 8 Monaten hat sich
-die Leistungsfähigkeit, der Funktionsumfang und die Stabilität von
-FreeBSD dramatisch verbessert. Die umfangreichste Änderung ist das neu
-gefaßte System der virtuellen Speicherverwaltung (VM) mit einem vereinig-
-ten VM/Dateipuffer, wodurch sich nicht nur die Leistungsfähigkeit verbes-
-sert, sondern auch der Mindestspeicherbedarf von FreeBSD reduziert werden
-konnte, so daß auch Konfigurationen mit nur 4 MB Hauptspeicher wieder
-akzeptabel werden können. Unter den weiteren Verbesserungen befinden
-sich volle Unterstützung für NIS sowohl auf Client- als auch Serverseite,
-,,Transaction TCP'', PPP mit automatischer Leitungswahl bei Bedarf, ein
-verbessertes SCSI-Subsystem, anfängliche ISDN-Unterstützung, Treiber für
-FDDI- und "Fast Ethernet"-Adapter (100 MBit/s), verbesserter Unter-
-stützung der Adaptec 2940-SCSI-Adapter (sowohl WIDE- als auch
-Normal-SCSI) sowie viele hunderte Bugfixes.
-
-Zuzüglich zur Basis-Distribution bietet FreeBSD nun eine neue Sammlung
-portierter Software an mit etwa 270 häufig gewünschten Programmen. Die
-Liste der ,,Ports'' reicht dabei von HTTP-(WWW-)Servern, Spielen, Pro-
-grammiersprachen, Editoren und so gut wie allem, was dazwischenliegt.
-Die komplette Port-Sammlung benötigt nun nur noch 10 MB Speicherplatz, da
-alle Ports als ,,Deltas'' gegenüber ihren originalen Quellen ausgedrückt
-werden. Das macht es uns einfacher, die Ports auf dem Laufenden zu
-halten, und es reduziert gegenüber der Ports-Sammlung aus Version 1.0
-drastisch den Speicherbedarf. Um einen Port zu übersetzen, wechselt man
-einfach ins Verzeichnis des gewünschten Ports, tippt ,,make'' ein, und
-läßt das System den Rest vornehmen. Es wird dabei automatisch die komp-
-lette Original-Quelle von der CDROM oder einem lokalen FTP-Server geholt,
-so daß man lediglich hinreichend Plattenplatz benötigt, um die gewünsch-
-ten Ports zu übersetzen. (Fast) jeder Port wird auch als vorübersetztes
-,,Package'' zur Verfügung gestellt, das man mit einem einfachen Kommando
-(pkg_add) installieren kann, wenn man nicht von der originalen Quelle
-übersetzen möchte. All dies ist in der Datei
- /usr/share/FAQ/Text/ports.FAQ
-genauer beschrieben.
-
-Seit unserer ersten Version FreeBSD 1.0 vor etwa zwei Jahren hat sich
-FreeBSD fast vollständig geändert. Eine neue Portierung wurde vorge-
-nommen, ausgehend vom 4.4-Lite-Code der Universität Berkeley, womit der
-rechtliche Status des Systems einwandfrei geworden ist, einschließlich
-einer ,Absegnung' durch Novell (dem neuen Eigentümer der USL und des
-Warenzeichens UNIX). Die 4.4-Portierung brachte gleichzeitig eine Menge
-neuer Eigenschaften, Dateisysteme und verbesserte Treiber. Mit der
-geklärten Rechtslage haben wir nun allen Grund zur Hoffnung, daß wir ohne
-künftige juristische Querelen auch weiterhin ein Betriebssystem von guter
-Qualität regelmäßig herausgeben können.
-
-FreeBSD 2.0.5 representiert die zweijährige Arbeit eines internationalen
-Entwicklerteams, das viele tausend Mann-Stunden eingebracht hat. Wir
-hoffen sehr, daß es Anklang findet!
-
-Eine Reihe weiterer Dokumente, die während der Installation und im Betrieb
-von FreeBSD hilfreich sein können, befindet sich im Verzeichnis ,,FAQ'',
-entweder in einem installierten System unter /usr/share/FAQ, oder aber in
-der obersten Ebene der CDROM- oder FTP-Distribution, in der ebendiese Datei
-zu finden ist. Ein Überblick der im FAQ-Verzeichnis enthaltenen Dokumen-
-tation befindet sich in der Datei FAQ/Text/ROADMAP.
-
-Eine Liste all derjenigen, die zum Projekt beigetragen haben, verbunden
-mit einer allgemeinen Beschreibung des Projektes selbst, befindet sich in
-der Datei ,,CONTRIB.FreeBSD'' in der Binär-Distribution.
-
-Die Datei ,,REGISTER.FreeBSD'' enthält eine Beschreibung, wie man sich
-beim "Free BSD user counter" registrieren läßt. Dieser Zähler ist für
-ALLE freien BSD-Derivate, nicht nur FreeBSD, und wir legen jedem die
-Anmeldung dort nahe.
-
-Die Kerndistribution von FreeBSD enthält keinen DES-Code, weil dies ihren
-Export außerhalb der USA verhindern würde. Es existiert ein Zusatzpaket,
-das nur in den USA verwendet werden darf und die Programme zusammenfaßt,
-die normalerweise DES benutzen. Alle anderen zusätzlich angebotenen
-Pakete können von jedermann genutzt werden. Eine freie und (aus Sicht
-von außerhalb der USA) exportierbare Distribution für Nicht-US-Benutzer
-existiert aber auch. Sie ist in der FreeBSD-FAQ beschrieben.
-
-Soweit jedoch die Paßwortsicherheit alles ist, was gewünscht wird, und
-kein Bedarf besteht, die verschlüsselten Paßwörter zwischen verschiedenen
-Architekturen (Sun's, DEC-Maschinen usw.) auszutauschen, ist das von
-FreeBSD benutzte, auf einer MD5-Verschlüsselung aufsetzende Sicherheits-
-system völlig ausreichend! Wir sind der Meinung, daß unser standard-
-mäßiges Sicherheitsmodell mehr als ein Ausgleich für DES ist, und das,
-ohne daß wir uns mit ärgerlichen Exportbeschränkungen herumschlagen
-müßten. Es ist einen Versuch wert, für alle außerhalb (oder sogar auch
-innerhalb) der USA! (Anm.: MD5 implementiert keine Verschlüsselung im
-Sinne der amerikanischen Exportbestimmungen, sondern kann ausschließ-
-lich zur Zugangskontrolle verwendet werden. Damit fällt es nicht unter
-die Exportbeschränkungen der USA. -- Jörg)
-
-
-1.1 Was ist neu in 2.0.5?
--------------------------
-
-Die folgenden Funktionen wurden im Zeitraum zwischen der Freigabe von
-Version 2.0 und dieser Version 2.0.5 entweder hinzugefügt oder grundle-
-gend verbessert. Um eine bessere Kommunikation zu ermöglichen, ist die
-Person (oder die Personen), die für die jeweilige Verbesserung verant-
-wortlich ist, aufgelistet. Jegliche Fragen bezüglich der neuen Funkiona-
-lität sollte zuerst an denjenigen gerichtet werden.
-
-
-KERNEL:
-
-Vereinigter VM/Dateipuffer-Cache
---------------------------------
-Der Entwurf eines vereinten VM/Dateipuffer-Caches verbessert die gesamte
-Leistungsfähigkeit des Systems erheblich und erlaubt eine Reihe optimier-
-ter Speicherbelegungsstrategien, die vorher unmöglich waren.
-
-Verantwortlich: David Greenman (davidg@FreeBSD.org) and
- John Dyson (dyson@implode.root.com)
-
-
-Optimierter Hash-Algorithmus für Netzwerk-Protokollsteuerblöcke (PCB's)
------------------------------------------------------------------------
-Für Systeme mit einer großen Anzahl aktiver TCP-Verbindungen (z. B.
-WEB- und FTP-Server) wird dadurch die Suche für ein ankommendes Paket
-nach der dazugehörigen Verbindung erheblich beschleunigt.
-
-Verantwortlich: David Greenman (davidg@FreeBSD.org)
-
-
-Optimierung des Dateinamen-Caches
----------------------------------
-Der Namens-Cache faßt nunmehr alle gleichen Namen im gleichen Speicher-
-block zusammen, so daß z. B. alle ,,..''-Einträge im gleichen Block
-landen. Die Version für das Elternverzeichnis wurde einbezogen, um
-den Hash durcheinanderzubringen, und die Cache-Verwaltung wurde ver-
-bessert, da gerade an diesem Teil gearbeitet wurde.
-
-Verantwortlich: Poul-Henning Kamp (phk@FreeBSD.org)
- David Greenman (davidg@FreeBSD.org)
-
-
-Weniger einschränkende Konfigurierung von Swap-Bereichen
---------------------------------------------------------
-Die Notwendigkeit, die Namen der Swap-Geräte in den Kernel zu kompilie-
-ren, wurde beseitigt. ,swapon' akzeptiert numehr jedes Block-Gerät bis
-zur Maximalzahl der in den Kernel konfigurierten Swap-Geräte.
-
-Verantwortlich: Poul-Henning Kamp (phk@FreeBSD.org)
- David Greenman (davidg@FreeBSD.org)
-
-
-,,Vorverdrahtete'' SCSI-Geräte
-------------------------------
-FreeBSD-Versionen vor 2.0.5 haben die Gerätenummernzuweisung für SCSI-
-Geräte ausschließlich dynamisch vorgenommen in der Reihenfolge, wie die
-Geräte gefunden wurden, so daß infolge Fehlfunktion eines SCSI-Gerätes
-sich möglicherweise die Gerätenummer ändern konnte. Dieses hatte zur
-Folge, daß selbst die Zuordnung der Dateisysteme auf den noch funktio-
-nierenden Geräten nicht mehr möglich war und die Dateisysteme nicht
-gemountet werden konnten. Durch ,,Vorverdrahtung'' ist es jetzt möglich,
-statisch die Zuordnung zwischen Gerätenummern (und damit Gerätenamen) und
-SCSI-Geräten vorzunehmen, wobei die SCSI-ID und die Nummer des SCSI-
-Busses als Basis dienen. Diese Zuordnung wird in der Konfigurations-
-datei des Kernels vorgenommen und ist sowohl in der Manual-Seite scsi(4)
-als auch in der LINT-Beispielkonfiguration dokumentiert.
-
-Verantwortlich: Peter Dufault (dufault@hda.com)
-Betroffene Dateien: sys/scsi/* usr.sbin/config/*
-
-
-Unterstützung für ,,Slices''
-----------------------------
-FreeBSD unterstützt nunmehr die Abstraktion von ,,Slices'' (globalen
-Platten-Partitionen), so daß die Zusammenarbeit mit Partitionen anderer
-Betriebssysteme verbessert wird. Damit ist es FreeBSD möglich, vor-
-handene DOS-Partitionen (ohne weitere Vorkehrungen) mitzunutzen.
-
-Verantwortlich: Bruce Evans (bde@FreeBSD.org)
-Betroffene Dateien: sys/disklabel.h sys/diskslice.h sys/dkbad.h
- kern/subr_diskslice.c kern/subr_dkbad.c
- i386/isa/diskslice_machdep.c
- i386/isa/wd.c scsi/sd.c dev/vn/vn.c
-
-
-Unterstützung für Version 6.0 des OnTrack Disk-Managers
--------------------------------------------------------
-Es wurde die Möglichkeit geschaffen, Platten zu nutzen, die durch den
-OnTrack Disk-Manager verwaltet werden. Das fdisk-Programm jedoch weiß
-darüber noch nichts, so daß alle Änderungen entweder im Installations-
-programm der Bootdiskette (boot.flp) oder aber im OnTrack Disk-Manager
-aus DOS heraus vorgenommen werden müssen.
-
-Verantwortlich: Poul-Henning Kamp (phk@FreeBSD.org)
-
-
-Bad144 ist wieder da und funktioniert
--------------------------------------
-Bad144 funktioniert wieder. Die Semantik jedoch hat sich gegenüber
-früher geringfügig geändert. Die Fehlerstellen werden nunmehr relativ
-zur ,,Slice'' gezählt und nicht mehr absolut bezüglich der ganzen
-Platte.
-
-Verantwortlich: Bruce Evans (bde@FreeBSD.org)
- Poul-Henning Kamp (phk@FreeBSD.org)
-
-
-UNTERSTÜTZUNG NEUER GERÄTE:
-
- SCSI- und CDROM-Geräte
-
-Matsushita/Panasonic (Creative) CD-ROM-Treiber
-----------------------------------------------
-Die Laufwerke Matsushita/Panasonic CR-562 und CR-563 werden nunmehr
-unterstützt, wenn sie an einen SoundBlaster- oder 100% kompatiblen
-Hostadapter angeschlossen sind. Bis zu vier Hostadapter sind möglich, so
-daß maximal 16 CD-ROM-Laufwerke angeschlossen werden können. Die
-Audio-Funktionen sind ebenfalls unterstützt einschließlich des ,,Karoke
-variable speed playback''.
-
-Verantwortlich: Frank Durda IV bsdmail@nemesis.lonestar.org
-Betroffene Dateien: isa/matcd
-
-
-Adaptec 2742/2842/2940 SCSI-Treiber
------------------------------------
-Der originale Treiber für 274X-/284X-Adapter wurde gegenüber der Version
-2.0 beträchtlich geändert. Nunmehr gibt es auch volle Unterstützung der
-2940-Serie sowie der ,,Wide-SCSI''-Modelle dieser Karten. Der Bug in der
-Bus-Arbitrierung (sowie viele weitere) wurde beseitigt, der Treiberprob-
-leme mit schnellen SCSI-Geräten verursacht hat. Es existiert sogar eine
-experimentelle Unterstützung für ,,tagged queuing'' (Kernel-Option
-,,AHC_TAGENABLE''). Weiterhin hat John Aycock den Code für den Sequen-
-cer nunmehr mit einem ,,Berkeley''-Copyright freigegeben, so daß die
-Restriktionen der GPL nicht mehr auf den Treiber zutreffen.
-
-Verantwortlich: Justin Gibbs (gibbs@FreeBSD.org)
-Betroffene Dateien: isa/aic7770.c pci/aic7870.c i386/scsi/*
- sys/dev/aic7xxx/*
-
-
-NCR5380/NCR53400 SCSI ("ProAudio Spectrum") Treiber
----------------------------------------------------
-Verantwortlich: Core-Team
-Eingereicht von: Serge Vakulenko (vak@cronyx.ru)
-Betroffene Dateien: isa/ncr5380.c
-
-
-Sony CDROM-Treiber
-------------------
-Verantwortlich: Core-Team
-Eingereicht von: Mikael Hybsch (micke@dynas.se)
-Betroffene Dateien: isa/scd.c
-
-
- Serielle Geräte
-
-Treiber für SDL Communications Riscom/8 Serial Board
-----------------------------------------------------
-Verantwortlich: Andrey Chernov (ache@FreeBSD.org)
-Betroffene Dateien: isa/rc.c isa/rcreg.h
-
-
-Treiber für Cyclades Cyclom-y Serial Board
-------------------------------------------
-Verantwortlich: Bruce Evans (bde@FreeBSD.org)
-Eingereicht von: Andrew Werple (andrew@werple.apana.org.au) and
- Heikki Suonsivu (hsu@cs.hut.fi)
-Entnommen aus: NetBSD
-Betroffene Dateien: isa/cy.c
-
-
-Serieller Treiber Cronyx/Sigma sync/async-Geräte
-------------------------------------------------
-Verantwortlich: Core-Team
-Eingereicht von: Serge Vakulenko
-Betroffene Dateien: isa/cronyx.c
-
-
-
- Netzwerk
-
-Plattenloses Booten
--------------------
-Das plattenlose Booten wurde in Version 2.0.5 stark verbessert. Das
-Boot-Programm befindet sich in src/sys/i386/boot/netboot und kann sowohl
-von MSDOS aus gestartet als auch in einen EPROM gebrannt werden. Lokales
-Swappen ist ebenfalls möglich. Gegenwärtig werden Ethernet-Karten von
-WD, SMC, 3Com und Novell unterstützt.
-
-
-Treiber für DEC DC21140 ,,Fast Ethernet''-Adapter
--------------------------------------------------
-Dieser Treiber unterstützt die zahlreichen Netzwerkadapter auf Basis
-des DEC DC21140-Chipsatzes einschließlich der 100 MBit/s DEC-500-XA und
-SMC 9332.
-
-Verantwortlich: Core-Team
-Eingereicht von: Matt Thomas (thomas@lkg.dec.com)
-Betroffene Dateien: pci/if_de.c pci/dc21040.h
-
-Treiber für DEC FDDI (DEFPA/DEFEA)
-----------------------------------
-Verantwortlich: Core-Team
-Eingereicht von: Matt Thomas (thomas@lkg.dec.com)
-Betroffene Dateien: pci/if_pdq.c pci/pdq.c pci/pdq_os.h pci/pdqreg.h
-
-
-Treiber für 3Com 3c505 (Etherlink/+) Karten
--------------------------------------------
-Verantwortlich: Core-Team
-Eingereicht von: Dean Huxley (dean@fsa.ca)
-Entnommen aus: NetBSD
-Betroffene Dateien: isa/if_eg.c
-
-
-Treiber für die Fujitsu-MB86960A-Netzwerkkarten-Familie
--------------------------------------------------------
-Verantwortlich: Core-Team
-Eingereicht von: M.S. (seki@sysrap.cs.fujitsu.co.jp)
-Betroffene Dateien: isa/if_fe.c
-
-
-Treiber für Intel EtherExpress
-------------------------------
-Verantwortlich: Rodney W. Grimes (rgrimes@FreeBSD.org)
-Betroffene Dateien: isa/if_ix.c isa/if_ixreg.h
-
-
-Treiber für 3Com 3c589
-----------------------
-Verantwortlich: Core-Team
-Eingereicht von: "HOSOKAWA Tatsumi" (hosokawa@mt.cs.keio.ac.jp),
- Seiji Murata (seiji@mt.cs.keio.ac.jp) and
- Noriyuki Takahashi (hor@aecl.ntt.jp)
-Betroffene Dateien: isa/if_zp.c
-
-
-Treiber für IBM-Kreditkarten
-----------------------------
-Verantwortlich: Core-Team
-Eingereicht von: "HOSOKAWA Tatsumi" (hosokawa@mt.cs.keio.ac.jp)
-Betroffene Dateien: isa/pcic.c isa/pcic.h
-
-
-Treiber für EDSS1- und 1TR6-ISDN-Interface
-------------------------------------------
-Verantwortlich: Core-Team
-Eingereicht von: Dietmar Friede (dfriede@drnhh.neuhaus.de) and
- Juergen Krause (jkr@saarlink.de)
-Betroffene Dateien: gnu/isdn/*
-
-
- Diverse Treiber
-
-Treiber für Joystick
---------------------
-Verantwortlich: Jean-Marc Zucconi (jmz@FreeBSD.org)
-Betroffene Dateien: isa/joy.c
-
-
-Treiber für National Instruments "LabPC"
-----------------------------------------
-Verantwortlich: Peter Dufault (dufault@hda.com)
-Betroffene Dateien: isa/labpc.c
-
-
-Treiber für WD7000
-------------------
-Verantwortlich: Olof Johansson (offe@ludd.luth.se)
-
-
-Pcvt-Console-Treiber
---------------------
-Verantwortlich: Jörg Wunsch (joerg@FreeBSD.org)
-Eingereicht von: Hellmuth Michaelis (hm@altona.hamburg.com)
-Betroffene Dateien: isa/pcvt/* usr.sbin/pcvt/*
-
-
-BSD-audio Emulator für den VAT-Treiber
---------------------------------------
-Verantwortlich: Amancio Hasty (ahasty@FreeBSD.org) and
- Paul Traina (pst@FreeBSD.org)
-Betroffene Dateien: isa/sound/vat_audio.c isa/sound/vat_audioio.h
-
-
-Treiber für National Instruments AT-GPIB and AT-GPIB/TNT GPIB
--------------------------------------------------------------
-Verantwortlich: Core-Team
-Eingereicht von: Fred Cawthorne (fcawth@delphi.umd.edu)
-Betroffene Dateien: isa/gpib.c isa/gpib.h isa/gpibreg.h
-
-
-Treiber für Genius GS-4500 Handscanner
---------------------------------------
-Verantwortlich: Core-Team
-Eingereicht von: Gunther Schadow (gusw@fub46.zedat.fu-berlin.de)
-Betroffene Dateien: isa/gsc.c isa/gscreg.h
-
-
-CORTEX-I Frame Grabber
-----------------------
-Verantwortlich: Core-Team
-Eingereicht von: Paul S. LaFollette, Jr.
-Betroffene Dateien: isa/ctx.c isa/ctxreg.h
-
-
-Video Spigot video capture card
--------------------------------
-Verantwortlich: Jim Lowe
-
-
-
-1.2 Experimentelle Funktionalität
----------------------------------
-
-Von den Dateisystemen unionfs und LFS ist bekannt, daß sie in Version
-2.0.5 stark mangelhaft sind. Das ist teilweise alten Bugs geschuldet, zu
-deren Beseitigung wir noch keine Zeit gefunden haben, sowie der noch
-ausstehenden Umstellung auf das neue VM-System. Wir hoffen, daß wir
-diese Probleme ein einer späteren Version von FreeBSD beseitigen können.
-
-FreeBSD kann nunmehr Binaries laufen lassen, die dem iBCS2-Standard ge-
-nügen. (SCO UNIX 3.2.2 & 3.2.4 und ISC 2.2 COFF-Format sind gegenwärtig
-unterstützt.) Der iBCS2-Emulator befindet sich noch in seinen Anfängen,
-aber er funktioniert. Wir haben noch keine erschöpfenden Tests vornehmen
-können (mangels kommerzieller Applikationen), aber beinahe alle Binaries
-für SCO 3.2.2 laufen, so z. B. ein altes INFORMIX-2.10 für SCO. Zur
-Vervollständigung dieses Projektes sind weitere Tests nötig. Es sind
-weiterhin Arbeiten im Gange, um ELF- und XOUT-Programme starten zu kön-
-nen. Der Großteil der ,,system call wrapper'' für SVR4 ist bereits ge-
-schrieben.
-
-FreeBSD implementiert mittlerweile auch genügend Linux-Kompatibilität,
-um DOOM laufen zu lassen! Für eine vollständige Dokumentation, wie
-dies einzurichten ist, kann man im Verzeichnis ,,xperimnt'' (auf dem
-lokalen FTP-Server oder der CDROM) nachsehen.
-
-Verantwortlich: Søren Schmidt (sos) & Sean Eric Fagan (sef)
-Betroffene Dateien: sys/i386/ibcs2/* sowie diverse Kernelmodifikationen
-=======
-
-
-2. Unterstützte Konfigurationen
--------------------------------
-
-FreeBSD läuft derzeit auf einer großen Vielfalt von ISA-, VLB-, EISA- und
-PCI-Bus-basierten PC's, beginnend beim 386sx bis hin zu Maschinen der
-Pentium-Klasse (obwohl der 386sx nicht zu empfehlen ist). Es gibt Unter-
-stützung für allgemeine IDE- oder ESDI-Laufwerke, verschiedene SCSI-
-Controller, Netzwerk- und serielle Karten.
-
-Nachfolgend eine Liste aller Platten-Controller und Ethernet-Karten, von
-denen gegenwärtig bekannt ist, daß sie mit FreeBSD zusammenarbeiten.
-Andere Konfigurationen können ebenfalls funktionieren, wir haben ledig-
-lich darüber noch nichts erfahren.
-
-
-2.1. Platten-Controller
-
-WD1003 (beliebige MFM/RLL)
-WD1007 (beliebige IDE/ESDI)
-WD7000
-IDE
-ATA
-
-Adaptec 152x Serie ISA SCSI-Controller
-Adaptec 154x Serie ISA SCSI-Controller
-Adaptec 174x Serie EISA SCSI-Controller, Standard und ,,Enhanced'' Mode.
-Adaptec 274X/284X/2940 (Narrow/Wide/Twin) Serie ISA/EISA/PCI SCSI-Controller
-Adaptec AIC-6260- und AIC-6360-basierte Karten, einschließlich AHA-152x
-und SoundBlaster SCSI-Karten.
-
-** Anmerkung: Von den Soundblaster-Karten kann nicht gebootet werden, da
-sie kein BIOS besitzen, was Voraussetzung wäre, um das Boot-Gerät in das
-System-BIOS abzubilden. Sie sind jedoch ohne weiteres benutzbar für
-externe Bandlaufwerke, CDROM's usw. Gleiches trifft auf AIC-6x60-
-basierte Karten ohne Boot-ROM zu. Manche dieser Karten besitzen jedoch
-einen Boot-ROM, was man allgemein an irgendeiner Mitteilung beim System-
-start nach dem Einschalten oder einem Reset erkennen kann. Im Zweifels-
-falle sollte man die Systemdokumentation konsultieren.
-
-[Hinweis: Buslogic nannte sich früher ,,Bustec'']
-Buslogic 545S & 545c
-Buslogic 445S/445c VLB SCSI-Controller
-Buslogic 742A, 747S, 747c EISA SCSI-Controller.
-Buslogic 946c PCI SCSI-Controller
-Buslogic 956c PCI SCSI-Controller
-
-NCR 53C810 und 53C825 PCI SCSI-Controller.
-NCR5380/NCR53400 ("ProAudio Spectrum") SCSI-Controller.
-
-DTC 3290 EISA SCSI-Controller in 1542 Emulations-Mode.
-
-UltraStor 14F, 24F und 34F SCSI-Controller.
-
-Seagate ST01/02 SCSI-Controller.
-
-Future Domain 8xx/950 Serie SCSI-Controller.
-
-Für alle unterstützten SCSI-Controller wird volle Unterstützung für alle
-SCSI-I- und SCSI-II-Peripherie gewährt, einschließlich Platten, Bandlauf-
-werke (auch DAT) und CD-ROM-Laufwerke.
-
-Folgende CD-ROM-Systeme sind derzeit unterstützt:
-
-(cd) SCSI (auch ProAudio Spectrum und SoundBlaster SCSI)
-(mcd) Mitsumi Interface-Karte
-(matcd) Matsushita/Panasonic (Creative) Interface-Karte
-(scd) Sony Interface-Karte
-
-Hinweis: CD-Laufwerke mit IDE-Interface sind derzeit noch nicht unter-
-stützt.
-
-Einige Controller sind hinsichtlich ihrer Kommunikation mit mehr als 16
-MB Hauptspeicher eingeschränkt, da der ISA-Bus nur 24 Bit Adreßraum
-besitzt und folglich nur 16 MB adressieren kann. Dies trifft selbst auf
-einige EISA-Adapter zu (die an sich 32 Bit Adreßraum haben), wenn sie auf
-ISA-Emulation geschaltet werden, weil sie dies dann in *jeder* Hinsicht
-tun. Diese Probleme treten nicht mit IDE-Adaptern auf (da sie kein DMA
-vornehmen), echten EISA-Controllern (wie UltraStor, Adaptec 1742A oder
-Adaptec 2742) sowie den meisten VLB-(Local-Bus)-Controllern. Sowie es
-notwendig wird, belegt das System ,,bounce buffer'', um mit den Adaptern
-zu kommunizieren, so daß es dennoch möglich ist, mehr als 16 MB Haupt-
-speicher problemlos zu nutzen.
-
-
-2.2 Ethernet-Karten
-
-SMC Elite 16 WD8013 Ethernet-Interfaces, sowie die meisten anderen
-WD8003E-, WD8003EBT-, WD8003W-, WD8013W-, WD8003S-, WD8003SBT- and
-WD8013EBT-basierten Clones. SMC Elite Ultra wird ebenfalls unterstützt.
-
-DEC EtherWORKS III NICs (DE203, DE204, and DE205)
-DEC EtherWORKS II NICs (DE200, DE201, DE202, and DE422)
-DEC DC21140 based NICs (SMC???? DE???)
-DEC FDDI (DEFPA/DEFEA) NICs
-
-Fujitsu MB86960A Familie
-
-Intel EtherExpress
-
-Isolan AT 4141-0 (16 bit)
-Isolink 4110 (8 bit)
-
-Novell NE1000, NE2000, und NE2100 Ethernet-Interface.
-
-3Com 3C501 Karten
-
-3Com 3C503 Etherlink II
-
-3Com 3c505 Etherlink/+
-
-3Com 3C507 Etherlink 16/TP
-
-3Com 3C509, 3C579, 3C589 (PCMCIA) Etherlink III
-
-Toshiba Ethernet-Karten
-
-PCMCIA Ethernet-Karten von IBM und National Semiconductor werden
-ebenfalls unterstützt.
-
-
-2.3. Verschiedenes
-
-AST 4-Port serielle Karten unter Nutzung von ,,shared interrupt''.
-
-ARNET 8-Port serielle Karten unter Nutzung von ,,shared interrupt''.
-
-BOCA ATIO66 6-Port serielle Karten unter Nutzung von ,,shared interrupt''.
-
-Cyclades Cyclom-y Serial Board.
-
-STB 4-Port serielle Karten unter Nutzung von ,,shared interrupt''.
-
-Mitsumi (alle Modelle) CDROM-Interface und -Laufwerk.
-
-SDL Communications Riscom/8 Serial Board.
-
-Soundblaster SCSI und ProAudio Spectrum SCSI CDROM-Interface und -Laufwerk.
-
-Matsushita/Panasonic (Creative SoundBlaster) CDROM-Interface und -Laufwerk.
-
-Adlib, SoundBlaster, SoundBlaster Pro, ProAudioSpectrum, Gravis UltraSound
-und Roland MPU-401 Sound-Karten.
-
-FreeBSD unterstützt derzeit KEINE IBM-Microchannel (MCA) Bussysteme,
-jedoch ist die Unterstützung nahe an der Fertigstellung. Einzelheiten
-werden gepostet sowie sich die Situation entwickelt.
-
-
-3. Wie kann man FreeBSD bekommen?
----------------------------------
-
-FreeBSD kann man in einer Vielzahl von Möglichkeiten erhalten:
-
-1. FTP/Mail
-
-FreeBSD selbst oder all seine wahlfreien Pakete können per ftp von
-,ftp.freebsd.org' bezogen werden -- der offiziellen Vertriebsstelle von
-FreeBSD.
-
-Server, die diese Site spiegeln, sind in der Datei MIRROR.SITES aufge-
-listtet. Es wird darum gebeten, die Distribution von der netzwerkmäßig
-nächstgelegenen Site zu beziehen.
-
-Für diejenigen ohne direkten Internetzugang, aber mit der Möglichkeit,
-eMail zu empfangen, steht der Weg über ,ftpmail@decwrl.dec.com' offen.
-Einfach das Schlüsselwort ,,help'' als Mail dorthin schicken, und man
-bekommt eine genaue Information, wie man Dateien von ,ftp.freebsd.org'
-beziehen kann. Achtung: diese Variante führt zum Versenden einiger *zehn
-Megabyte* über Mail und sollte daher wirklich nur als allerletzte
-Möglichkeit in Betracht gezogen werden!
-
-
-2. CDROM
-
-FreeBSD 2.0.5 kann man auf CDROM bestellen bei:
-
- Walnut Creek CDROM
- 4041 Pike Lane, Suite D
- Concord CA 94520
- +1-510-674-0783, +1-510-674-0821 (Fax)
-
-Oder über Internet bei orders@cdrom.com oder http://www.cdrom.com.
-Der aktuelle Katalog kann mittels FTP bezogen werden als
- ftp://ftp.cdrom.com/cdrom/catalog.
-
-Die CDROM kostet US-$ 39.95. Der Versand kostet (pro Bestellung, nicht
-pro CD) US-$ 10.00. Visa, Mastercard und American Express werden in
-Zahlung genommen.
-
-Die CD's können bei Nichtgefallen bedingungslos zurückgegeben werden.
-
-
-Berichten von Bugs, Verbesserungsvorschläge, Einreichen von Code
-----------------------------------------------------------------
-
-Jegliche Fehlerberichte und Beiträge von Code sind herzlich willkommen.
-Fehler sollten in jedem Falle gemeldet werden (nach Möglichkeit mit einem
-,Fix').
-
-Die wünschenswerte Methode zum Einsenden eines Problemberichtes von einer
-Maschine mit Internet-Mailzugang ist die Nutzung des Programmes send-pr.
-Diese Berichte werden sorgfältig von unserem Bugfile-Programm regi-
-striert, und es wird alles getan, so schnell wie möglich darauf zu
-antworten.
-
-Ist es aus irgendeinem Grunde nicht möglich, das Programm ,,send-pr''
-zu nutzen, so können Fehlerberichte auch direkt an
-
- bugs@FreeBSD.org
-
-gesandt werden. Außerdem steht die Liste
-
- questions@FreeBSD.org
-
-für allgemeine Fragen zur Verfügung.
-
-(Bitte, wenn möglich, an diese Listen in englischer Sprache schreiben.)
-
-Selbstverständlich sind wir, da all unsere Arbeit auf der Basis von Frei-
-willigkeit geschieht, jederzeit über zusätzliche Helfer erfreut -- es
-gibt jetzt schon mehr zu tun, als wir jemals zu tun in der Lage sein
-werden! Technische Diskussionsbeiträge oder Hilfsangebote können an
-
- hackers@FreeBSD.org
-
-gesandt werden. Diese Listen verursachen in der Regel ein beträcht-
-liches Mailaufkommen. Für diejenigen, die einen langsamen oder teuren
-Mailanschluß haben und nur an den Ankündigungen wichtiger Ereignisse
-interessiert sind, mag daher
-
- announce@FreeBSD.org
-
-interessant sein.
-
-
-All diesen Gruppen mit Ausnahme von freebsd-bugs kann jeder Interessierte
-jederzeit beitreten. Eine Mail an ,,MajorDomo@FreeBSD.org'' geschickt,
-mit lediglich dem Schlüsselwort ,,help'' auf einer eigenen Zeile in der
-Nachricht, wird mit der Information über die vorhandenen Listen und
-Teilnahmemöglichkeiten beantwortet. Neben den hier genannten Listen
-existieren noch weitere, die auf bestimmte Interessengruppen ausgerichtet
-sind, so daß die Anfrage durchaus lohnt!
-
-
-6. Würdigungen
---------------
-
-FreeBSD verkörpert die Arbeit vieler Dutzender, wenn nicht Hunderte,
-Einzelner aus der ganzen Welt, die hart gearbeitet haben, um diese
-Version fertigzustellen. Es wäre sehr schwierig oder schier unmöglich,
-jeden aufzuzählen, der in irgendeiner Form zu FreeBSD beigetragen hat.
-Nichtsdestotrotz soll der Versuch unternommen werden (natürlich in
-alphabetischer Reihenfolge). Sollte ein Name fehlen, so ist dieses
-ausschließlich ein Versehen.
-
-
-Die Computer Systems Research Group (CSRG), U.C. Berkeley.
-
-Bill Jolitz, für seine ersten Arbeiten am 386BSD.
-
-Das FreeBSD-Core-Team
-(in alphabetischer Reihenfolge der Vornamen):
-
- Andreas Schulz <ats@FreeBSD.org>
- Andrey A. Chernov <ache@FreeBSD.org>
- Bruce Evans <bde@FreeBSD.org>
- David Greenman <davidg@FreeBSD.org>
- Garrett A. Wollman <wollman@FreeBSD.org>
- Gary Palmer <gpalmer@FreeBSD.org>
- Geoff Rehmet <csgr@FreeBSD.org>
- Jack Vogel <jackv@FreeBSD.org>
- John Dyson <dyson@FreeBSD.org>
- Jordan K. Hubbard <jkh@FreeBSD.org>
- Justin Gibbs <gibbs@FreeBSD.org>
- Paul Richards <paul@FreeBSD.org>
- Poul-Henning Kamp <phk@FreeBSD.org>
- Rich Murphey <rich@FreeBSD.org>
- Rodney W. Grimes <rgrimes@FreeBSD.org>
- Satoshi Asami <asami@FreeBSD.org>
- Søren Schmidt <sos@FreeBSD.org>
-
-Besondere Erwähnung verdienen:
-
- Walnut Creek CDROM, ohne deren Hilfe und ständige Unterstützung
- diese Ausgabe nie möglich geworden wäre.
-
- Dermot McDonnell für seine Bereitstellung eines Toshiba XM3401B
- CDROM-Laufwerkes.
-
- Weitere Helfer und Beta-Tester von FreeBSD:
-
- J.T. Conklin Julian Elischer
- Frank Durda IV Peter Dufault
- Sean Eric Fagan Jeffrey Hsu
- Terry Lambert L Jonas Olsson
- Chris Provenzano Dave Rivers
- Guido van Rooij Steven Wallace
- Atsushi Murai Scott Mace
- Nate Williams
-
- sowie alle an der Montana State University für ihre anfängliche
- Unterstützung.
-
-
-Jordan möchte weiterhin besonders Poul-Henning Kamp und Gary Palmer
-danken, die ihm beide in vielstündiger Arbeit geholfen haben, das neue
-Installationssystem zusammenzustellen. Poul, kürzlich stolzer Vater
-geworden, hat es trotz seines enormen Zeitdrucks immer noch geschafft,
-eine beträchtliche Menge an Arbeit in das Projekt zu investieren. Diese
-Version wäre ohne ihn nicht geworden! Dank Euch Beiden!
-
-Weiterhing geht Dank an all diejenigen, die mitgeholfen haben, besonders
-auch an alle Nichtgenannten. Wir hoffen, daß diese Ausgabe von FreeBSD
-allgemeinen Anklang findet!
-
- Das FreeBSD Core-Team
-
-$Id: RELNOTES,v 1.2 1995/06/07 05:51:03 jkh Exp $
-=======================================================================
diff --git a/release/sysinstall/help/de_DE.ISO_8859-1/configure.hlp b/release/sysinstall/help/de_DE.ISO_8859-1/configure.hlp
deleted file mode 100644
index 468c1b5..0000000
--- a/release/sysinstall/help/de_DE.ISO_8859-1/configure.hlp
+++ /dev/null
@@ -1,18 +0,0 @@
-Mit diesem Menü kann man das System nach der Installation ein wenig
-konfigurieren. Es sollten wenigstens das Paßwort für den System-
-verwalter gesetzt sowie die Zeitzone eingestellt werden.
-
-Für zusätzliche ,,Rosinen'' wie bash, emacs, pascal usw. ist es wohl
-immer notwendig, einen Blick auf den Menüpunkt ,,Packages'' zu werfen.
-Dies ist gegenwärtig nur sinnvoll, wenn man entweder von einer CDROM
-installiert oder aber die Package-Sammlung irgendwo in der Datei-
-systemhierarchie bereits vorhanden ist, so daß die Package-Verwaltung
-darauf zugreifen kann. Eine automatische Übertragung der Packages
-mittels FTP ist derzeit noch nicht vorgesehen.
-
-Soll das Installationsprogramm für die Packages nach Beenden der
-Systeminstallation nochmals aufgerufen werden, der Kommandoname
-dafür ist ,,pkg_manage''. Das Einstellen der Zeitzone geschieht
-mit dem Kommando ,,tzsetup''. Weitere Informationen bezüglich der
-allgemeinen Systemkonfiguration befinden sich in der Datei
-,,/etc/sysconfig''.
diff --git a/release/sysinstall/help/de_DE.ISO_8859-1/drives.hlp b/release/sysinstall/help/de_DE.ISO_8859-1/drives.hlp
deleted file mode 100644
index 41681f0..0000000
--- a/release/sysinstall/help/de_DE.ISO_8859-1/drives.hlp
+++ /dev/null
@@ -1,29 +0,0 @@
-Sowie die ernsthafte Absicht besteht, wirklich irgendetwas von FreeBSD
-auf einem Laufwerk zu instellieren, sollte man sich UNBEDINGT VERSICHERN,
-daß die vom Partition-Editor berichtete Geometrie (siehe Installations-
-Menü) auch die richtige für die Kombination aus Laufwerk und Controller
-ist!
-
-IDE-Laufwerke ,,lernen'' oftmals ihre Geometrie über das Setup des BIOS,
-oder (für größere Laufwerke), ihre Geometrie wird entweder vom IDE-
-Controller oder aber einem speziellen Werkzeug, das zur Bootzeit geladen
-wird, wie dem OnTrack Systems Disk- Manager, uminterpretiert (,,remap-
-ped''). In solchen Fällen ist das Erkennen der richtigen Geometrie noch
-schwerer, da man nicht einfach auf dem Laufwerk oder im BIOS-Setup
-nachsehen kann. Dann ist es das Beste, ein DOS zu booten (von der
-Festplatte, nicht von einer Diskette!) und mittels des im tools/-Ver-
-zeichnis auf der FreeBSD-CDROM oder auf einem FTP-Server bereitgestellten
-Programmes ,,pfdisk'' die Geometrie zu vergleichen. Dieses Programm
-berichtet die Geometrie, wie DOS sie sieht, die allgemein als die
-richtige angenommen werden kann.
-
-Falls gar keine DOS-Partition gewünscht wird, kann es sich dennoch als
-sinnvoll erweisen, eine solche (sehr kleine) vorerst einzurichten, um
-sich über die Laufwerksgeometrie zu informieren. Sie kann dann später
-wieder gelöscht werden.
-
-Es ist aber tatsächlich gar nicht so schlecht (ob man's glaubt oder
-nicht), eine bootfähige DOS-Partition auf der Platte zu haben: falls die
-Maschine später instabil wird oder einfach ,,spinnt'', so kann man von da
-aus bequem eines der kommerziell erhältlichen System-Diagnose-Programme
-laufen lassen.
diff --git a/release/sysinstall/help/de_DE.ISO_8859-1/install.hlp b/release/sysinstall/help/de_DE.ISO_8859-1/install.hlp
deleted file mode 100644
index 420eb95..0000000
--- a/release/sysinstall/help/de_DE.ISO_8859-1/install.hlp
+++ /dev/null
@@ -1,450 +0,0 @@
- INSTALLATIONSANLEITUNG FÜR FreeBSD 2.0.5
-
-Diese Beschreibung dokumentiert die Installation von FreeBSD 2.0.5 auf der
-Maschine. Vor dem Beginn ist es ratsam, die Hardware-Anleitung zu studie-
-ren, um sich über die hardware-spezifischen Installationshinweise zu in-
-formieren (Konfiguration der Hardware, worauf man achten sollte usw.).
-
-
-Inhalt:
-=======
-
-1.0 Fragen und Antworten für DOS-Benutzer
- 1.1 Wie schaffe ich Platz für FreeBSD?
- 1.2 Kann ich von FreeBSD aus komprimierte DOS-Dateisysteme nutzen?
- 1.3 Kann ich erweiterte DOS-Partitions nutzen?
- 1.4 Kann ich DOS-Programme unter FreeBSD laufen lassen?
-
-2.0 Vorbereitung der Installation
- 2.1 Vor dem Installieren von CDROM
- 2.2 Vor dem Installieren von Diskette
- 2.3 Vor dem Installieren von einer DOS-Partition
- 2.4 Vor dem Installieren von einem QIC- oder SCSI-Bandlaufwerk
- 2.5 Vor dem Installieren über Netz
- 2.5.1 Vorbereiten einer NFS-Installation
- 2.5.2 Vorbereiten einer FTP-Installation
-
-3.0 Installieren von FreeBSD
-
-
-
-1.0 Fragen und Antworten für DOS-Benutzer
-=== =====================================
-
-1.1 Hilfe! Kein Platz mehr! Muß ich nun erst alles löschen?
-
-Wenn auf der Maschine bereits ein DOS installiert ist und nun nur noch
-wenig oder gar kein freier Platz mehr für eine FreeBSD-Installation bleibt,
-so muß man nicht gleich alle Hoffnung aufgeben! Das Hilfsprogramm FIPS,
-das sich im Unterverzeichnis tools/ auf der FreeBSD-CDROM oder auf den
-verschiedenen FreeBSD-FTP-Servern befindet, kann sich hier als sehr nütz-
-lich erweisen.
-
-FIPS erlaubt die Aufteilung einer bestehenden DOS-Partition in zwei Teile,
-wobei der ursprüngliche Inhalt der Originalpartition erhalten bleibt und
-das zweite Stück zum Installieren von FreeBSD verfügbar wird. Man defrag-
-mentiert die Partition zuerst mittels des Programmes ,,DEFRAG'' von DOS 6
-oder mittels der Norton Disk Tools und läßt anschließend FIPS laufen. Das
-Programm erfragt dann den Rest der benötigten Informationen. Danach kann
-man neu booten und FreeBSD in der freigewordenen ,Slice' installieren. Im
-Menüpunkt ,,Distributions'' kann man eine Abschätzung vornehmen, wieviel
-freien Platz man für die gewünschte Installation etwa benötigt.
-
-
-1.2 Kann ich von FreeBSD aus komprimierte DOS-Dateisysteme nehmen?
-
-Nein. Wenn man ein Programm wie Stacker (TM) oder DoubleSpace (TM) be-
-nutzt, so kann FreeBSD nur den Bereich des (DOS-)Dateisystems nutzen, der
-nicht komprimiert worden ist. Der Rest erscheint dann als eine einzige
-große Datei (die Stacker- oder DoubleSpace-Datei). DIESE DATEI UNTER
-KEINEN UMSTÄNDEN LÖSCHEN! Das würde man nachher bereuen!
-
-
-1.3 Kann ich erweiterte DOS-Partitions nehmen?
-
-Diese Möglichkeit bietet FreeBSD 2.0.5 noch nicht, aber sie ist für Version
-2.1 vorgesehen. Die Grundlagen dafür sind bereits geschaffen, es ist nur
-noch 1 % an Restarbeit nötig.
-
-
-1.4 Kann ich DOS-Programme unter FreeBSD laufen lassen?
-
-Noch nicht. Wir hätten das gern irgendwann, aber bisher hat sich noch
-niemand gefunden, der die Arbeit machen würde. Die voranschreitenden
-Arbeiten mit dem Linux-DOSEMU-Programm bringen uns aber näher ans Ziel.
-Diejenigen, die sich an der Arbeit beteiligen möchten, können sich mittels
-einer Mail an hackers@freebsd.org gern melden!
-
-Es gibt jedoch in der ,,Ports collection'' ein nettes Programm namens
-,,pcemu''. Es emuliert einen 8088 sowie ausreichend BIOS-Dienste, um
-DOS-Programme im Textmode laufen zu lassen. Es benötigt ein X-Window-
-System zum Arbeiten.
-
-
-
-2.0 Vorbereitung der Installation
-=== =============================
-
-2.1 Vor dem Installieren von CDROM:
-
-Wenn es sich bei dem CDROM-Laufwerk um eins handelt, was nicht unterstützt
-wird (z. B. ein IDE-CDROM-Laufwerk), dann bitte bei Punkt 2.3 (,,Vor dem
-Installieren von einer DOS-Partition'') weiterlesen.
-
-Es bedarf keiner großen Vorbereitungen, um von einer der FreeBSD-CDROMs von
-Walnut Creek zu installieren. (Andere CDROM-Distributionen können genauso
-einfach zu nutzen zu sein, aber da wir keinerlei Einfluß auf deren Gestal-
-tung haben, können wir darüber nichts aussagen.) Man kann entweder mittels
-des von Walnut Creek gelieferten Scriptes ,,install.bat'' direkt die CDROM
-booten, oder aber man fertigt sich mittels ,,makeflp.bat'' eine Boot-Dis-
-kette an.
-
-Der allereinfachste Weg (von DOS aus) ist, einfach ,,go'' einzutippen. Es
-erscheint ein kleines DOS-Menü, das einen durch die verfügbaren Möglich-
-keiten geleitet.
-
-Will man die Bootdiskette von einem Unix-System aus erstellen, so führt
-vielleicht ein Kommando wie ,,dd if=floppies/boot.flp of=/dev/rfd0'' oder
-aber ,,dd if=floppies/boot.flp of=/dev/floppy'' zum Ziel, abhängig von der
-verwendeten Hardware und dem Betriebssystem.
-
-Sowie man von DOS oder einer Diskette aus gebootet hat, kann man sich im
-Menüpunkt ,,Media menu'' des Installationsprogrammes die CDROM als Medium
-aussuchen und die komplette Distribution davon laden. Es werden keine
-weiteren Medien benötigt.
-
-Nachdem das System installiert ist und man von der Festplatte neu gebootet
-hat, müßte die CD im Verzeichnis /cdrom gemountet sein. Das Hilfsprogramm
-,lndir', das zusammen mit der XFree86-Distribution kommt, kann hier sehr
-nützlich sein: man kann damit einen Baum von symbolischen Links aufbauen,
-der das nicht beschreibbare Medium CDROM auf der Festplatte spiegelt. Als
-kleines Beispiel:
-
- mkdir /usr/ports
- lndir /cdrom/ports /usr/ports
-
-Danach kann man dann ,,cd /usr/ports; make'' eintippen, alle Quellen werden
-von der CD gelesen, aber alle Zwischendateien werden unterhalb /usr/ports
-angelegt, das sich zweckmäßig auf einem besser beschreibbaren Medium befin-
-den sollte! :-)
-
-WICHTIGER HINWEIS: Vor Beginn der Installation unbedingt davon überzeugen,
-daß die CDROM im Laufwerk ist, so daß sie beim Test gefunden wird! Dies
-ist auch nötig, wenn man gern die CDROM automatisch während der Installa-
-tion in die Standard-Konfiguration aufgenommen haben möchte (unabhängig
-davon, ob die Installation selbst von CDROM erfolgt). Dies wird sich in
-Version 2.1 ändern, aber gegenwärtig ist dies eine einfache Methode um
-festzustellen, daß die CDROM tatsächlich zugreifbar ist.
-
-Schließlich ist es ein Leichtes, wenn man es anderen ermöglichen will,
-FreeBSD direkt von der CDROM in der eigenen Maschine mittels FTP installie-
-ren zu lassen. Es ist lediglich nach Vollenden der Installation nötig,
-folgende Zeile in die Datei /etc/master.passwd aufzunehmen (bitte mit dem
-Kommando ,,vipw''):
-
- ftp:*:99:99::0:0:FTP:/cdrom:/nonexistent
-
-Mehr ist nicht nötig. Alle anderen können nun in ihrem Installationsmenü
-,,FTP'' als Medium auswählen und als Servernamen (über den Menüpunkt
-,,Other'') eintragen: ftp://<Adresse dieser Maschine>!
-
-
-2.2 Vor dem Installieren von Diskette
-
-Wenn man von Disketten installieren will, weil z. B. die Hardware nicht
-anders unterstützt wird oder aber für diejenigen, die schwierige Wege
-mögen, so muß man zuerst einige Installationsdisketten vorbereiten.
-
-Die erste Diskette, die man (außer der Bootdiskette) benötigt, ist die
-,,floppies/root.flp''. Sie ist insofern etwas Besonderes, daß es sich
-nicht um eine Diskette mit DOS-Dateisystem handelt, sondern um ein Abbild
-(,image') binärer Daten (genauer gesagt, um ein mit ,gzip' komprimiertes
-cpio-Archiv). Man kann dieses Abbild entweder unter DOS mittels des
-Programmes ,,rawrite.exe'' auf die Diskette bringen, oder unter Unix mit
-dem ,,dd''-Kommando (siehe Bemerkungen in Punkt 2.1 für die Datei
-,,floppies/boot.flp''). Nachdem diese Diskette fertig ist, kann es mit den
-Distributions-Disketten weitergehen.
-
-Man benötigt mindestens so viele 1.44-MB- oder 1.2-MB-Disketten, wie nötig
-sind, um die Dateien im Verzeichnis ,bin' (Binärdistribution) aufzunehmen.
-DIESE Disketten *müssen* DOS-formatiert sein, entweder mit dem Kommando
-,,FORMAT'' in DOS oder dem Dateimanager in Microsoft Windows (TM). Man
-sollte vorformatierten Disketten nicht trauen und sie sicherheitshalber
-nochmals selbst formatieren!
-
-In der Vergangenheit wurden wiederholt Probleme mit mangelhaft formatier-
-ten Datenträgern berichtet, daher hier nochmals obiger Hinweis!
-
-Nach dem Formatieren der Disketten müssen nun die Dateien darauf über-
-tragen werden. Die Distributions-Dateien sind in Stücke zerlegt, von denen
-5 auf eine gewöhnliche 1.44-MB-Diskette passen. Man packt einfach alle
-vorhandenen Dateien auf die Disketten, so viele, wie auf jede draufpassen,
-bis das Ende erreicht ist. Jede Distribution muß dabei in einem eigenen
-Untervezeichnis auf den Disketten abgelegt werden, also z. B.:
-a:\bin\bin.aa, a:\bin\bin.ab, ...
-
-Sowie im Installationsprogramm der Menüpunkt zur Medienauswahl erreicht
-wird, wählt man ,,Floppy'' aus - der Rest wird dann abgefragt.
-
-
-2.3 Vor dem Installieren von einer DOS-Partition
-
-In Vorbereitung der Installation von einer DOS-Partition kopiert man
-einfach alle Dateien der Distribution(en) in ein Verzeichnis, das
-,,FREEBSD'' heißen soll. Um also eine Minimalinstallation von FreeBSD
-vorzunehmen, wobei man die Dateien von der CDROM auf die DOS-Partition
-kopiert:
-
- C> MD C:\FREEBSD
- C> XCOPY /S E:\DISTS\BIN C:\FREEBSD
- C> XCOPY /S E:\FLOPPIES C:\FREEBSD
-
-...in der Annahme, daß auf ,C:' der nötige freie Platz ist und die CDROM
-,E:' genannt wird. Es ist wesentlich, daß auch das Verzeichnis FLOPPIES
-mit kopiert wird, da die Datei ,root.flp' daraus während einer Installation
-von einer DOS-Partition automatisch entnommen wird.
-
-Man kann all die gewünschten ,DISTS' unterhalb ,C:\FREEBSD' plazieren - die
-,BIN'-Distribution ist lediglich das notwendige Minimum.
-
-
-2.4 Vor dem Installieren von einem QIC- oder SCSI-Bandlaufwerk
-
-Die Installation von einem Bandlaufwerk ist wohl die einfachste Variante,
-wenn man keine Online-FTP-Installation oder Installation von CDROM vorneh-
-men kann. Das Installationsprogramm erwartet die Distributions-Dateien
-einfach im tar-Format auf dem Band. Nachdem man also alle interessierenden
-Dateien geholt hat, kann man das Band einfach mit folgenden Kommandos er-
-stellen:
-
- cd /freebsd/distdir
- tar cvf /dev/rwt0 (or /dev/rst0) dist1 .. dist2
-
-Das Verzeichnis ,floppies/' muß als eine der ,dist's in obigem Beispiel mit
-angegeben worden sein, da das Installationsprogram vom Band die Datei
-,floppies/root.flp' lesen muß.
-
-Während der Installation muß es auch gewährleistet sein, daß man genügend
-Platz in einem Zwischenverzeichnis besitzt (der Name dafür wird abgefragt),
-um den KOMPLETTEN Inhalt des erzeugten Installationsbandes dort ablegen zu
-können. Da sich Bänder nicht wahlfrei zugreifen lassen, benötigt man
-vorübergehend die gleiche Menge an Plattenplatz zusätzlich, die auch auf
-das Band geschrieben worden ist!
-
-WICHTIGER HINWEIS: Zu Beginn der Installation muß sich das Band bereits im
-Laufwerk befinden, *bevor* man die Bootdiskette startet. Damit wird
-sichergestellt, daß der Test während der Installation das Band auch
-wirklich erkennt.
-
-
-2.5 Vor dem Installieren über Netz
-
-Netzwerkinstallationen kann man über drei verschiedene Kommunikations-
-medien vornehmen:
-
- Serieller port: SLIP oder PPP
- Parallelport: PLIP (mittels ,Laplink'-Kabel)
- Ethernet: mittels Standard-Ethernet-Adapter (einschließlich
- einiger PCMCIA-Adapter).
-
-SLIP-Unterstützung ist eher primitiv und auf festverdrahtete Verbindungen
-beschränkt (beispielsweise ein serielles Kabel zwischen einem Laptop und
-einem anderen Computer). Die Festverdrahtung ist nötig, da die Installa-
-tion über SLIP derzeit keien Möglichkeiten zum Aufbau einer Wählverbindung
-anbietet; letzteres kann man aber mittels PPP machen, das man ohnehin
-soweit möglich dem SLIP vorziehen sollte.
-
-Bei Benutzung eines Modems ist PPP sicherlich die einzige Chance. Man
-sollte sich rechtzeitig die Informationen des Internet-Dienstanbieters
-bereitlegen, da sie früh innerhalb des Installationsprozesses abge-
-fragt werden. Minimal wird die IP-Adresse des Dienstanbieters sowie
-die eigene benötigt (die aber auch freigelassen werden kann, so daß
-PPP sie mit der Gegenseite aushandelt). Auch ist Kenntnis der ver-
-schiedenen ,,AT''-Kommandos des benutzten Modems nötig, da das Wähl-
-programm für PPP keine Kenntnisse über Modems besitzt.
-
-Falls eine Festverbindung zu einer anderen FreeBSD-Maschine (mit Ver-
-sion 2.0R oder höher) benutzt wird, so kann man auch die Variante mit
-einem ,,Laplink''-Kabel über den Parallelport in Betracht ziehen. Die
-typische Datenrate über einen Parallelport ist um einiges größer als
-das, was sich über serielle Leitungen erzielen läßt; Geschwindigkeiten
-um die 50 KB/s sind nicht ungewöhnlich.
-
-Schließlich ist für eine schnellstmögliche Installation ein Ethernet-
-Adapter natürlich eine gute Variante! FreeBSD unterstützt die meisten
-gängigen Ethernet-Karten, wobei sich im Hardware-Wegweiser (im Menü-
-punkt ,,documentation'' auf der Bootdiskette) eine Tabelle der nötigen
-Einstellungen findet. Bei Nutzung eines der unterstützten PCMCIA-
-Adapter muß sichergestellt sein, daß sie _vor_ dem Einschalten des
-Laptops eingesteckt sind! Leider unterstützt FreeBSD gegenwärtig
-keinen Austausch von PCMCIA-Karten im Betrieb.
-
-Natürlich benötigt man auch noch die IP-Adresse im Netzwerk, die
-,,Netzwerkmaske'' für das gewählte Netzwerk, sowie den Maschinennamen.
-Der lokale Systemverwalter oder Netzwerkverantwortliche kann über
-diese Angaben informieren. Für den Zugriff auf andere Hosts über
-Namen anstatt unhandlicher IP-Adressen ist auch noch die Adresse eines
-Name-Servers und ggf. eines Gateways vonnöten (bei PPP in der Regel
-der Internet-Dienstanbieter). All diese Angaben sollten man _vor_
-Beginn der Installation vom zuständigen System- oder Netzwerkverwalter
-einholen.
-
-Sowie man auf irgendeine Weise eine Netzwerkanbindung aufgebaut hat, kann
-man die Installation über NFS oder FTP fortsetzen.
-
-
-2.5.1 Vorbereiten einer NFS-Installation
-
- Eine Installation über NFS ist recht einfach: man kopiert die
- gewünschten FreeBSD-Distributions-Dateien irgendwo auf einen
- Server und gibt deren Standort in der NFS-Medienauswahl an.
-
- Falls dieser Server nur Zugriffe über einen ,,privilegierten''
- Port erlaubt (wie allgemein bein Sun-Workstations üblich), so
- muß man die entsprechende Option im ,,Options''-Menü setzen,
- bevor man weitermacht.
-
- Falls man nur eine schlechte Ethernet-Karte besitzt, die sehr
- langsam arbeitet, so sollte man ebenfalls die entsprechende
- Option einschalten.
-
- Damit eine NFS-Installation funktioniert, muß der Server das
- Mounten von Unterverzeichnissen erlauben; hat man also beispiels-
- weise die Distribution von FreeBSD 2.0.5 im Verzeichnis
- ziggy:/usr/archive/stuff/FreeBSD untergebracht, so muß der Server
- das direkte Mounten von /usr/archive/stuff/FreeBSD erlauben, nicht
- nur /usr oder /usr/archive/stuff.
-
- In FreeBSD's /etc/export-Datei wird dies mittels der Option
- ``-alldirs'' gesteuert. Andere NFS-Server haben dafür andere
- Konventionen. Wenn man während der Installation Meldungen vom
- Server bekommt, die ,,Permission denied'' heißen, so ist dies
- wahrscheinlich das Problem!
-
-
-2.5.2 Vorbereiten einer FTP-Installation
-
- Eine Installation über FTP kann man von jedem Server vornehmen, der
- eine einigermaßen aktuelle Kopie der FreeBSD-Version 2.0.5 gespie-
- gelt hält. Das Menü ,,FTP sites'' enthält eine gute Auswahl von
- FTP-Servern aus der ganzen Welt.
-
- Wenn man von einem anderen Server installieren will, der nicht
- aufgeführt ist, oder Probleme mit der Konfiguration des Name-
- Servers hat, so kann man durch Auswahl des Menüpunktes ,,Other'' in
- diesem Menü auch seine eigene URL eingeben. Da eine URL auch eine
- numerische IP-Adresse enthalten kann, kann man bei Fehlen eines
- Name-Servers also auch eingeben:
-
- ftp://192.216.222.4/pub/FreeBSD/2.0.5-RELEASE
-
- Wenn man mittels FTP in einer Umgebung installiert, die hinter
- einem ,,Firewall'' gelegen ist, so sollte man ,,Passive mode'' FTP
- benutzen (was bereits standardmäßig eingestellt ist). Falls man
- aus irgendeinem Grunde auf einen Server angewiesen ist, der keinen
- Passiv-Modus unterstützt, kann man im ,,Options''-Menü stattdessen
- Aktiv-Modus auswählen.
-
-
-3.0 Installieren von FreeBSD
---- ------------------------
-
-Nachdem man die entsprechenden Vorbereitungen getroffen hat, sollte die
-Installation von FreeBSD ohne Schwierigkeiten vor sich gehen.
-
-Falls dies doch nicht zutrifft, so hat man vielleicht einen wichtigen
-Hinweis bei der Vorbereitung der Installationsmedien verpaßt (siehe
-Abschnit 2.X) und sollte nochmals dort nachlesen? Im Falle von Hardware-
-problemen (oder wenn FreeBSD gar nicht erst bootet) kann die Hardware-
-Anleitung auf der Boot-Diskette Hinweise zur Problembeseitigung geben.
-
-Die FreeBSD-Bootdiskette enthält alle benötigte Online-Dokumentation, damit
-man sich in der Installation zurechtfindet. Falls dies nicht der Fall ist,
-so hätten wir gern gewußt, an welcher Stelle die Probleme auftauchen! Es
-ist das Ziel von FreeBSD's Installationsprogramm (sysinstall), ausreichend
-selbstdokumentierend zu sein, um langwierige ,,Schritt für Schritt''-
-Anleitungen hinfällig werden zu lassen. Wir werden sicher noch ein wenig
-brauchen, bis dieses Ziel erreicht ist -- aber es ist das Ziel!
-
-Unterdessen mag die folgende ,,typische Bootreihenfolge'' ganz nützlich
-sein:
-
-o Die Diskette booten. Nach einer Folge von Boot-Schritten, die je nach
- der Hardware zwischen 30 Sekunden und 3 Minuten dauern kann, sollte das
- Anfangsmenü erscheinen. Wenn die Diskette gar nicht bootet oder das
- System während des Bootens hängenbleibt, sollte man den Abschnitt mit
- ,,Fragen und Antworten'' in der Hardware-Anleitung hinsichtlich möglicher
- Ursachen konsultieren.
-
-o Taste F1 drücken. Es folgen einige grundlegende Hinweise über die
- Nutzung des Menüsystems. Alle diejenigen, die dieses Menüsystem noch
- nicht zuvor genutzt haben, sollten sich das BITTE sorgfältig durchlesen!
-
-o Für diejenigen, die Englisch nicht als Muttersprache sprechen, sei die
- Auswahl einer anderen Sprache im Menüpunkt ,,Language'' empfohlen (was ja
- ganz offensichtlich geschehen ist :). Ein Teil der Dokumentation wird
- dann in der gewählten Sprache anstatt in Englisch angeboten.
-
-o Auswahl der Sonderwünsche im Menüpunkt ,,Options''.
-
-o ,,Proceed'' anwählen, um mit dem Istallationsmenü fortzusetzen.
-
-Das Installationsmenü:
-
-o Man kann in diesem Menü alles vornehmen, ohne am bestehenden System
- irgendetwas zu ändern, solange man nicht ,,Commit'' auswählt; erst damit
- werden alle angeforderten Änderungen auch tatsächlich ausgeführt.
-
- Wenn an irgendeiner Stelle Probleme auftauchen, so bringt die Taste F1
- normalerweise die richtigen Hinweise für das Bild, in dem man sich gerade
- befindet.
-
- o Der erste Schritt ist normalerweise ,Partition', bei dem man
- die von FreeBSD zu nutzenden Plattenlaufwerke auswählen kann.
-
- o Danach kann man mit dem ,Label'-Editor den für FreeBSD vorge-
- sehenen Platz aufteilen oder aber eine nicht-FreeBSD-Partition
- (z. B. DOS) ins System einbinden.
-
- o Danach wählt man im ,Media'-Menü das gewünschte Installations-
- medium. Sowie alle benötigten Informationen für die Installation
- beisammen sind, beendet sich dieses Menü selbst; andernfalls
- werden weitere Fragen gestellt (abhängig vom Medium).
-
- o Schließlich bestätigt man mit dem ,Commit'-Menüpunkt auf einmal
- alle ausgewählten Aktionen (ohne diese Bestätigung wurde noch
- nichts auf die Festplatte geschrieben). Es werden alle Infor-
- mationen über neue oder geänderte Partitions geschrieben, die
- Dateisysteme angelegt oder zerstörungsfrei neu markiert (abhängig
- von der ,,newfs''-Markierung im Label-Editor) und schließlich
- alle gewünschten Distributions ausgepackt.
-
- o Über das ,Configure'-Menü kann man die FreeBSD-Installation
- weiter konfigurieren. Man kann hier menügesteuert die einzelnen
- Vorgabewerte für Systemparameter einstellen. Einige Punkte, wie
- z. B. die Netzwerkparameter, sind besonders wesentlich, wenn man
- von CDROM/Band/Diskette installiert hat und daher den Netzwerk-
- zugang noch nicht konfiguriert hat (sofern vorhanden). Wenn man
- hier bereits das Netzwerk richtig konfiguriert, so hat man schon
- beim ersten Neustart von der Festplatte einen funktionierenden
- Zugriff zum Netz.
-
- o Mittels ,Exit' gelangt man wieder zum Hauptmenü.
-
-
-An dieser Stelle hat man seine Arbeit mit dem sysinstall-Programm beendet.
-Man kann schließlich ,Quit' anwählen. Wurde sysinstall als Erstinstalla-
-tionsprogramm benutzt (bevor das System also eingerichtet war), so erfolgt
-an dieser Stelle ein Neustart. Hatte man einen Boot-Manager ausgewählt, so
-erscheint dann ein kleines Boot-Menü mit den Zeichen ,,F?'' als Eingabe-
-aufforderung. Nachdem man die entsprechende Funktionstaste für FreeBSD
-gedrückt hat (wird angezeigt), sollte FreeBSD von der Festplatte aus ge-
-startet werden.
-
-Falls dies aus irgendeinem Grunde nicht klappt, sei wiederum auf den
-Abschnitt ,,Fragen und Antworten'' in der Hardware-Anleitung verwiesen!
-
- Jordan (für die Anleitung)
- Jörg (für die deutsche Übersetzung)
-
----- Ende der Installations-Anleitung ---
diff --git a/release/sysinstall/help/de_DE.ISO_8859-1/language.hlp b/release/sysinstall/help/de_DE.ISO_8859-1/language.hlp
deleted file mode 100644
index cd7a834..0000000
--- a/release/sysinstall/help/de_DE.ISO_8859-1/language.hlp
+++ /dev/null
@@ -1,17 +0,0 @@
-In diesem Menü kann man die Vorzugssprache einstellen. Vorerst wird
-damit nur die Sprache ausgewählt, in der die diversen Hilfedateien
-angezeigt werden.
-
-In späteren Versionen werden davon auch das Tastaturlayout, der Bild-
-schirmzeichensatz und verschiedene NLS-Einstellungen betroffen sein
-(sysinstall selbst wird dann auch ,,message catalogs'' benutzen, so
-daß alle Menüs automatisch in der richtigen Sprache erscheinen). Auch
-sind weitere Internationalisierungsmaßnahmen vorgesehen, so daß die
-entsprechenden Standards eingehalten werden.
-
-Solange diese Verbesserungen noch nicht vorgenommen sind, mag es
-einfacher erscheinen, die Datei ,,/etc/sysconfig'' mit der Hand zu
-editieren, sobald das System erstmals vollständig installiert ist.
-Diese Datei enthält eine Anzahl (allerdings englischer) Kommentare,
-die die jeweiligen Änderungen beschreiben, sowie auch einige Beispiele
-nicht-englischer Voreinstellungen.
diff --git a/release/sysinstall/help/de_DE.ISO_8859-1/media.hlp b/release/sysinstall/help/de_DE.ISO_8859-1/media.hlp
deleted file mode 100644
index a591468..0000000
--- a/release/sysinstall/help/de_DE.ISO_8859-1/media.hlp
+++ /dev/null
@@ -1,30 +0,0 @@
-Von den folgenden Medien kann man installieren:
-
- CDROM - eines der folgenden Laufwerke ist nötig:
-
- Sony CDU 31/33A
- Matushita/Panasonic "Sound Blaster" CDROM.
- Mitsumi FX-001{A-D} (alte nicht-IDE Laufwerke).
- SCSI - Jedes beliebige Standard-SCSI-CDROM-Laufwerk, das
- an einen unterstützten Controller angeschlossen ist
- (siehe auch Hardware-Wegweiser).
-
- DOS - eine primäre DOS-Partition, auf die die notwendigen
- FreeBSD-Distribution-Dataien kopiert worden sind (also
- z. B. (C:\FREEBSD\).
-
- FS - setzt ein existierendes FreeBSD-System voraus, in dem
- die Dateien der neuen Distribution abgelegt worden sind.
-
- Diskette - Entnahme der Distributions-Dateien von einer oder
- mehreren DOS-formatierten Disketten.
-
- FTP - Entnahme der Distributions-Dateien von einem anonymen
- FTP-Server (eine Liste wird angeboten).
-
- NFS - Einlesen der Distributions-Dateien über einen irgendwo
- gelegenen NFS-Server (dessen Zugriffsrechte dies natür-
- lich erlauben müssen!)
-
- Tape - Einlesen der Distributions-Dateien in ein Zwischenver-
- zeichnis und Auspacken von dort.
diff --git a/release/sysinstall/help/de_DE.ISO_8859-1/network_device.hlp b/release/sysinstall/help/de_DE.ISO_8859-1/network_device.hlp
deleted file mode 100644
index 1d4e498..0000000
--- a/release/sysinstall/help/de_DE.ISO_8859-1/network_device.hlp
+++ /dev/null
@@ -1,56 +0,0 @@
-Eine Netzwerkinstallation kann über eine von drei verschiedenen Arten
-von Verbindungen vorgenommen werden:
-
- Serielle Ports: SLIP / PPP
- Parallelport: PLIP (benötigt ein ,,Laplink''-Kabel)
- Ethernet: von einem Standard-Ethernet-Controller (ein-
- schließlich einiger PCMCIA-Controller)
-
-Unterstützung für SLIP ist eher primitiv und auf festverdrahtete Ver-
-bindungen beschränkt, wie z. B. eine serielle Leitung zwischen einem
-Laptop und einem anderen PC. Es existiert gegenwärtig keine Möglich-
-keit, eine Wählverbindung über ein Modem herzustellen. Dies kann je-
-doch mittels des PPP-Programmes vorgenommen werden, was soweit möglich
-stets dem SLIP vorgezogen werden sollte. Bei der Auswahl eines
-seriellen Ports wird später die Möglichkeit geboten, die Parameter für
-das slattach-Kommando anzugeben. Es wird davon ausgegangen, daß in
-diesem Moment entweder slattach oder ein anderes geeignetes Kommando
-auf der Gegenseite der Verbindung gestartet worden ist, um die Verbin-
-dung aufzubauen. FreeBSD wird dann über diesen Anschluß installiert,
-wobei die Geschwindigkeit bis zu 115.2 kBaud betragen kann (was die
-empfehlenswerte Geschwindigkeit für eine festverdrahtete Leitung ist).
-
-Bei Benutzung eines Modems ist PPP sicherlich die einzige Chance. Man
-sollte sich rechtzeitig die Informationen des Internet-Dienstanbieters
-bereitlegen, da sie früh innerhalb des Installationsprozesses abge-
-fragt werden. Minimal wird die IP-Adresse des Dienstanbieters sowie
-die eigene benötigt (die aber auch freigelassen werden kann, so daß
-PPP sie mit der Gegenseite aushandelt). Auch ist Kenntnis der ver-
-schiedenen ,,AT''-Kommandos des benutzten Modems nötig, da das Wähl-
-programm für PPP keine Kenntnisse über Modems besitzt.
-
-Falls eine Festverbindung zu einer anderen FreeBSD-Maschine (mit Ver-
-sion 2.0R oder höher) benutzt wird, so kann man auch die Variante mit
-einem ,,Laplink''-Kabel über den Parallelport in Betracht ziehen. Die
-typische Datenrate über einen Parallelport ist um einiges größer als
-das, was sich über serielle Leitungen erzielen läßt; Geschwindigkeiten
-um die 50 KB/s sind nicht ungewöhnlich.
-
-Schließlich ist für eine schnellstmögliche Installation ein Ethernet-
-Adapter natürlich eine gute Variante! FreeBSD unterstützt die meisten
-gängigen Ethernet-Karten, wobei sich im Hardware-Wegweiser (im Menü-
-punkt ,,documentation'' auf der Bootdiskette) eine Tabelle der nötigen
-Einstellungen findet. Bei Nutzung eines der unterstützten PCMCIA-
-Adapter muß sichergestellt sein, daß sie _vor_ dem Einschalten des
-Laptops eingesteckt sind! Leider unterstützt FreeBSD gegenwärtig
-keinen Austausch von PCMCIA-Karten im Betrieb.
-
-Natürlich benötigt man auch noch die IP-Adresse im Netzwerk, die
-,,Netzwerkmaske'' für das gewählte Netzwerk, sowie den Maschinennamen.
-Der lokale Systemverwalter oder Netzwerkverantwortliche kann über
-diese Angaben informieren. Für den Zugriff auf andere Hosts über
-Namen anstatt unhandlicher IP-Adressen ist auch noch die Adresse eines
-Name-Servers und ggf. eines Gateways vonnöten (bei PPP in der Regel
-der Internet-Dienstanbieter). All diese Angaben sollten man _vor_
-Beginn der Installation vom zuständigen System- oder Netzwerkverwalter
-einholen.
diff --git a/release/sysinstall/help/de_DE.ISO_8859-1/partition.hlp b/release/sysinstall/help/de_DE.ISO_8859-1/partition.hlp
deleted file mode 100644
index 90041c0..0000000
--- a/release/sysinstall/help/de_DE.ISO_8859-1/partition.hlp
+++ /dev/null
@@ -1,85 +0,0 @@
-Dies ist der DiskLabel-Editor von FreeBSD.
-
-Für Neulinge in dieser Installation ist es zuerst wichtig, FreeBSD's neues
-Prinzip der ,,Slices'' zu verstehen, das auf die Plattenspeicher angewandt
-wird. Es ist nicht sehr schwer. Ein ,,vollständig angegebener Slice-
-Name'', d. h. der Name der Gerätedatei, die unterhalb von /dev angespro-
-chen wird, um mit dem Gerät zu kommunizieren, läßt sich wahlweise in
-3 Teile zerlegen:
-
- Das erste ist der Name der Platte. In der Annahme, daß ein
- System zwei SCSI-Platten haben möge, wären das ,sd0' und
- ,sd1'.
-
- Das nächste ist die ,,Slice''- (oder ,,primäre Partition''-)
- Nummer. Wenn sd0 also z. B. zwei solche Partitions hat, eine
- für FreeBSD und eine für DOS, so ergibt das sd0s1 und sd0s2.
- Ist dann weiterhin sd1 völlig für FreeBSD reserviert, so hat
- sie nur die Slice sd1s1.
-
- Wenn dann weiterhin eine Slice vom FreeBSD-Typ ist, so besitzt
- diese eine Reihe (verwirrenderweise auch so genannter) ,,Par-
- titions''. Diese FreeBSD-Partitions bilden die Grundlage für
- die verschiedenen Dateisysteme oder den Swap-Bereich. Für die
- genannte hypothetische Maschine könnte das Layout für sd0 etwa
- so aussehen:
-
- Name Mountpunkt
- ---- ----------
- sd0s1a /
- sd0s1b <Swap-Bereich>
- sd0s1e /usr
-
- Aus historischen Gründen existiert auch noch ein Kurzschluß,
- eine ,,Kompatibilitäts-Slice'', mit der man einfacher auf die
- erste FreeBSD-Slice einer Platte zugreifen kann. Damit
- arbeiten auch die Programme, die mit dem Slice-Schema noch
- nicht zurechtkommen, wie gehabt. Die Kompatibilitäts-Slice
- für genannte Platte würde dann so aussehen:
-
- Name Mountpoint
- ---- ----------
- sd0a /
- sd0b <Swap-Bereich>
- sd0e /usr
-
- Die Zuordnung der Kompatibilitäts-Slice zur ersten gefundenen
- FreeBSD-Slice (in diesem Falle sd0s1) erfolgt automatisch. Es
- kann mehrere FreeBSD-Slices auf einer Platte geben, aber nur
- die erste wird als Kompatibilitäts-Slice zugeordnet!
-
- Möglicherweise wird die Kompatibilitäts-Slice später elimi-
- niert, aber gegenwärtig ist sie noch aus folgenden Gründen
- nötig:
-
- 1. Wie bereits erwähnt, kennen einige Programme noch
- nicht das Slice-Prinzip und benötigen noch Zeit,
- bis sie überarbeitet worden sind.
-
- 2. Im Moment sind die Bootblöcke von FreeBSD noch
- nicht in der Lage, von irgendeinem Root-Dateisystem
- außer dem in der Kompatibilitäts-Slice zu booten.
- Daher wird die Root also immer auf ,,sd0a'' er-
- scheinen (bezogen auf das Beispiel), auch wenn sie
- sich eigentlich auf sd0s1a befindet und ansonsten
- über den vollen Slice-Namen angesprochen wird.
-
-Sowie man diese Prinzipien verstanden hat, ist die Benutzung des Disk-
-label-Editors eigentlich einfach. Entweder, man teilt die FreeBSD-
-Slices, wie sie oben auf dem Bildschirm angezeigt werden, in kleinere
-Stücke auf (in der Mitte des Schirmes zu sehen) und plaziert dann
-später FreeBSD-Dateisysteme darauf, oder aber man mountet existierende
-Slices/Partitions in die Dateisystemhierarchie; dieser Editor erlaubt
-beides. Da eine DOS-Partition aus FreeBSD-Sicht auch nur eine weitere
-Slice ist, kann man sie mit diesem Editor auch ganz einfach in die
-Dateisystemhierarchie eingliedern. Für FreeBSD-Partitions kann man
-auch noch den ,,newfs''-Status umschalten, so daß die Partitions ent-
-weder von Grund auf neu-/wiedererzeugt werden oder aber einfach nur
-überprüft und gemountet (wobei ihr Inhalt erhalten bleibt).
-
-Wenn man fertig ist, beendet man den Editor mit ,,Q''.
-
-Es werden keinerlei Änderungen auf die Platte geschrieben, solange man
-nicht mittels ,,(C)ommit'' aus dem Installationsmenü alles bestätigt
-hat! Der Disklabel-Editor (und der ,,FDISK Partition''-Editor) ar-
-beiten mit einer Art Kopie der Disklabels.
diff --git a/release/sysinstall/help/de_DE.ISO_8859-1/slice.hlp b/release/sysinstall/help/de_DE.ISO_8859-1/slice.hlp
deleted file mode 100644
index c2c92e2..0000000
--- a/release/sysinstall/help/de_DE.ISO_8859-1/slice.hlp
+++ /dev/null
@@ -1,28 +0,0 @@
-Dies ist der Editor für die primären Partitions (oder ,,Slices'').
-
-Unten werden die möglichen Kommandos angezeigt, ober der Inhalt des Master
-Boot Records. Man kann mit den Pfeiltasten nach oben und unten fahren und
-mittels ,,(C)reate'' eine neue Partition anlegen, wenn sich der ,Balken'
-über einer Partition befindet, deren Status als ,,unused'' markiert ist.
-
-Hier die Zeichenerklärung für das Feld ,,flags'':
-
- '=' -- Partition ist ordnungsgemäß ausgerichtet.
- '>' -- Die Partition endet nicht unterhalb von Zylinder 1024.
- 'R' -- Ist markiert, das Root-Dateisystem zu enthalten.
- 'B' -- Partition benutzt Fehlersektorenbehandlung nach Bad144.
- 'C' -- Dies ist die FreeBSD-2.0-Kompatibilitätspartition.
- 'A' -- Die Partition ist als ,aktiv' (bootfähig) markiert.
-
-Bei der Auswahl einer Partition für Bad144-Behandlung wird diese vor
-Erzeugung der Dateisystem auf fehlerhafte Stellen untersucht.
-
-Wenn keine Partition als ,aktiv' markiert ist, so muß man entweder einen
-Boot-Manager installieren (dies wird später im Installationsprozeß ange-
-boten) oder aber eine als ,aktiv' markieren, bevor man dieses Menü wieder
-verläßt.
-
-Es werden keinerlei Änderungen auf die Platte geschrieben, solange man
-nicht mittels ,,(C)ommit'' aus dem Installationsmenü alles bestätigt hat!
-Der ,,FDISK Partition''-Editor (und der Disklabel-Editor) arbeiten mit
-einer Art Kopie der Disklabels.
diff --git a/release/sysinstall/help/de_DE.ISO_8859-1/tcp.hlp b/release/sysinstall/help/de_DE.ISO_8859-1/tcp.hlp
deleted file mode 100644
index d2a3b27..0000000
--- a/release/sysinstall/help/de_DE.ISO_8859-1/tcp.hlp
+++ /dev/null
@@ -1,32 +0,0 @@
-In diesem Menü kann man sowohl die allgemeinen Netzwerkparameter ein-
-stellen (Hostname, Domainname, DNS-Server usw.) als auch die Parameter für
-ein bestimmtes Interface (das vom zuvor angezeigten Menü ausgewählt worden
-ist).
-
-Man kann zwischen den Feldern mittels der Tasten TAB, Rückwärts-TAB (Shift+
-TAB) und RETURN hin- und herspringen. Mittels DELETE oder BACKSPACE kann
-man ein Feld editieren. Mittels ^A (control-A) gelangt man an den Anfang
-einer Zeile, mittels ^E (control-E) ans Ende. ^F (control-F) geht ein
-Zeichen nach vorn, ^B (control-B) eins nach hinten; ^D (control-D) löscht
-das Zeichen unter dem Cursor, und ^K (control-K) löscht alles bis zum Zei-
-lenende. Im Prinzip handelt es sich um die wesentlichsten Emacs-Editier-
-kommandos.
-
-Das Feld ,,Extra options to ifconfig'' ist ein wenig besonders (oder auch:
-ein Hack :-).
-
-Damit kann man beispielsweise die Gegenseite einer SLIP- oder PLIP-Ver-
-bindung angeben (einfach die numerische IP-Adresse eingeben), oder aber
-einen bestimmten Steckverbinder einer Ethernetkarte auswählen, falls
-mehrere zur Auswahl sind (z. B. AUI, 10BaseT [twisted pair], 10Base2 [BNC]
-usw.). Die folgenden Steckverbinder werden akzeptiert:
-
- link0 - AUI * höchste Wertigkeit
- link1 - BNC
- link2 - UTP * niedrigste Wertigkeit
-
-Man kann also eins der Worte ,,link0'', ,,link1'' oder ,,link2'' in das
-,,Extra options''-Feld eintragen.
-
-Am Ende einfach ,,OK'' anwählen.
-
diff --git a/release/sysinstall/help/de_DE.ISO_8859-1/usage.hlp b/release/sysinstall/help/de_DE.ISO_8859-1/usage.hlp
deleted file mode 100644
index a8beada..0000000
--- a/release/sysinstall/help/de_DE.ISO_8859-1/usage.hlp
+++ /dev/null
@@ -1,57 +0,0 @@
-BENUTZUNG DES SYSTEMS
-=====================
-
-TASTE WIRKUNG
------ -------
-PFEIL NACH OBEN Zum vorherigen Feld (oder eine Zeile nach oben im Text).
-PFEIL NACH UNTEN Zum nächsten Feld (oder eine Zeile nach unten im Text).
-TAB Zum nächsten Feld oder zur nächsten Gruppe.
-PFEIL NACH RECHTS Zum nächsten Feld oder zur nächsten Gruppe (wie TAB).
-SHIFT-TAB Zum vorherigen Feld oder zur vorherigen Gruppe.
-PFEIL NACH LINKS Zum vorherigen Feld oder zur vorherigen Gruppe (wie SH-TAB).
-RETURN Menüpunkt auswählen.
-BILD NACH OBEN Innerhalb von Textkästen: eine Seite zurück.
-BILD NACH UNTEN Innerhalb von Textkästen: eine Seite vor.
-LEERTASTE In Menüs mit mehreren Auswahlmöglichkeiten: umschalten.
-F1 Hilfe (sofern unterstützt).
-
-Wenn an den Seiten eines Menüs kleine "^(-)"- oder "v(+)"-Symbole zu
-sehen sind, so bedeutet das, daß weitere Menüpunkte ober- oder unter-
-halb des aktuellen Punktes existieren, die (infolge fehlenden Platzes
-auf dem Bildschirm) gerade nicht dargestellt werden können. Mittels
-der Pfeiltasten (nach oben oder unten) kann man das Menü rollen las-
-sen. Sowie eins der Symbole verschwindet heißt das, daß man ganz oben
-oder unten im Menü ist.
-
-In Textkästen wird die Stelle, an der man sich befindet, als Prozent-
-zahl in der rechten unteren Ecke angezeigt. 100 % bedeuten, daß man
-sich am Ende befindet.
-
-Die Auswahl von ,,OK'' in einem Menü bewirkt die durch dieses Menü
-ausgelöste Handlung. Die Auswahl von ,,Cancel'' bewirkt einen Abbruch
-und die Rückkehr zum vorherigen Menü.
-
-BESONDERE EIGENSCHAFTEN
-=======================
-
-Menüpunkte können auch durch Eintippen des ersten Zeichens ihres
-Namens ausgewählt werden, sofern dies eindeutig ist. In diesem Falle
-werden die entsprechenden Zeichen hervorgehoben.
-
-Der Bildschirmtreiber enthält auch einen Puffer, mit dem man sich die
-Sachen ansehen kann, die bereits herausgerollt worden sind. Um diese
-Funktion zu nutzen, muß man die ,,ScrollLock''-Taste (,,Rollen V'')
-drücken und danach die Pfeiltasten oder die Bild-auf/ab-Tasten.
-Dieser Modus wird durch nochmaliges Drücken der ,,ScrollLock''-Taste
-wieder verlassen. Diese Möglichkeit ist vor allem nützlich für
-Subshells oder andere ,,Expertenmodi'', die keine Menüs nutzen.
-
-Sowie das System vollständig installiert ist und im Multi-User-Modus
-läuft, werden mehrere ,,virtuelle Terminals'' aktiviert, auf denen man
-parallel mehrere aktive Sessions bedienen kann. Mittels ALT-F<n> kann
-zwischen diesen umgeschaltet werden, wobei ,,F<n>'' die Funktionstaste
-(F-Taste) ist, die der Nummer des gewünschten Bildschirms entspricht.
-Das System kommt vorkonfiguriert mit 3 virtuellen Terminals. Wenn
-mehr davon gewünscht werden, so kann dies nach dem Hochfahren des
-Systems geschehen, indem man sie in der Datei /etc/ttys freischaltet.
-Die maximale Anzahl ist 12.
diff --git a/release/sysinstall/help/en_US.ISO8859-1/README b/release/sysinstall/help/en_US.ISO8859-1/README
deleted file mode 100644
index c166e26..0000000
--- a/release/sysinstall/help/en_US.ISO8859-1/README
+++ /dev/null
@@ -1,104 +0,0 @@
- -----------------------------------------
- FreeBSD 2.0.5 --- RELEASE Version , ,
- ----------------------------------------- /( )`
- \ \___ / |
-Welcome to the 2.0.5 release of FreeBSD! 2.0.5 is /- _ `-/ '
-an interim release of FreeBSD, filling a critical (/\/ \ \ /\
-gap during the period between 2.0R (which was / / | ` \
-released in Nov 94) and 2.1R, which will be O O ) / |
-released in late July of '95. FreeBSD 2.0.5 `-^--'`< '
-contains many substantial improvements from 2.0R, (_.) _ ) /
-not least of which is greater stability (by `.___/` /
-a considerable margin), dozens of new `-----' /
-features and a greatly enhanced <----. __ / __ \
-installation program. See the release <----|====O)))==) \) /====
-notes for more details on what's new in <----' `--' `.__,' \
-FreeBSD 2.0.5! | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-What is FreeBSD? FreeBSD is an operating system based on 4.4 BSD Lite
-for Intel, AMD, Cyrix or NexGen "x86" based PC hardware. It works
-with a very wide variety of PC peripherals and configurations and can
-be used for everything from software development to Internet Service
-Provision; the busiest site on the Internet, ftp.cdrom.com, is a
-FreeBSD machine!
-
-This release of FreeBSD contains everything you need to run such a
-system, plus full source code for everything. With the source
-distribution installed you can literally recompile the entire system
-from scratch with one command, making it ideal for students,
-researchers or folks who simply want to see how it all works.
-
-A large collection of 3rd party ported software (the "ports
-collection") is also provided to make it easier for you to obtain and
-install all your favorite traditional UNIX utilities for FreeBSD.
-Over 270 ports, from editors to programming languages to graphical
-applications, make FreeBSD a powerful and comprehensive operating
-environment that rivals that of many large workstations for general utility
-and power.
-
-
-For more documentation on this system, it is recommended that you
-purchase the 4.4BSD Document Set from O'Reilly Associates and the
-USENIX Association, ISBN 1-56592-082-1. We have no connection with
-O'Reilly, we're just satisfied customers!
-
-You may also wish to read the HARDWARE GUIDE *before* proceeding any
-further with the installation. Configuring PC hardware for anything
-other than DOS/Windows (which don't actually make very significant
-demands on the hardware) is actually quite a bit harder than it looks,
-and if you think you understand PCs then you clearly haven't been
-using them for long enough! :) This guide will give you some tips on
-how to configure your hardware and what symptoms to watch for in case
-of trouble. This guide is available in the Documentation menu of the
-FreeBSD boot floppy.
-
-DISCLAIMER: While FreeBSD does its best to safeguard against accidental
-loss of data, it's still more than possible to WIPE OUT YOUR ENTIRE DISK
-with this installation! Please do not proceed to the final FreeBSD
-installation menu unless you've adequately backed up any important
-data first! We really mean it!
-
-Technical comments on this release should be sent (in English!) to:
-
- hackers@FreeBSD.org
-
-
-Bug reports should be sent using the `send-pr' command, if you were
-able to get the system installed, otherwise to:
-
- bugs@FreeBSD.org
-
-Please be sure to indicate WHICH VERSION of FreeBSD you're running in
-any bug reports!
-
-
-General questions should be sent to:
-
- questions@FreeBSD.org
-
-Please have patience if your questions are not answered right away -
-this is an especially busy time for us, and our volunteer resources
-are often strained to the limit! Bug reports submitted with the
-send-pr command are logged and tracked in our bugs database, and
-you'll be kept informed of any changes in status during the life of
-the bug (or feature request).
-
-Our WEB site, http://www.freebsd.org, is also a very good source for
-updated information and provides a number of advanced documentation
-facilities. You may use the BSDI version of Netscape for browsing the
-World Wide Web directly from FreeBSD.
-
-You may also wish to look in /usr/share/FAQ and /usr/share/doc for
-further information on the system.
-
-
-Thanks for reading all of this, and we sincerely hope you enjoy this
-release of FreeBSD!
-
- Jordan Hubbard,
- for The FreeBSD Project
diff --git a/release/sysinstall/help/en_US.ISO8859-1/RELNOTES b/release/sysinstall/help/en_US.ISO8859-1/RELNOTES
deleted file mode 100644
index 9d6284f..0000000
--- a/release/sysinstall/help/en_US.ISO8859-1/RELNOTES
+++ /dev/null
@@ -1,747 +0,0 @@
- RELEASE NOTES
- FreeBSD
- Release 2.0.5
-
-1. Technical overview
----------------------
-
-FreeBSD is a freely available, full source 4.4 BSD Lite based release
-for Intel i386/i486/Pentium (or compatible) based PC's. It is based
-primarily on software from U.C. Berkeley's CSRG group, with some
-enhancements from NetBSD, 386BSD, and the Free Software Foundation.
-
-Since our release of FreeBSD 2.0 some 8 months ago, the performance,
-feature set, and stability of FreeBSD has improved dramatically. The
-largest change is a revamped VM system with a merged VM/file buffer
-cache that not only increases performance, but reduces FreeBSD's
-memory footprint, making a 4MB configuration a more acceptable
-minimum. Other enhancements include full NIS client and server
-support, transaction TCP support, dial-on-demand PPP, an improved SCSI
-subsystem, early ISDN support, support for FDDI and Fast Ethernet
-(100Mbit) adapters, improved support for the Adaptec 2940 (WIDE and
-narrow) and many hundreds of bug fixes.
-
-We've also taken the comments and suggestions of many of our users to
-heart and have attempted to provide what we hope is a more sane and
-easily understood installation process. Your feedback on this
-(constantly evolving) process is especially welcome!
-
-In addition to the base distributions, FreeBSD offers a new ported
-software collection with some 270 commonly sought-after programs. The
-list of ports ranges from http (WWW) servers, to games, languages,
-editors and almost everything in between. The entire ports collection
-requires only 10MB of storage, all ports being expressed as "deltas"
-to their original sources. This makes it much easier for us to update
-ports, and greatly reduces the disk space demands made by the older
-1.0 ports collection. To compile a port, you simply change to the
-directory of the program you wish to install, type make and let the
-system do the rest. The full original distribution for each port you
-build is retrieved dynamically off of CDROM or a local ftp site, so
-you need only enough disk space to build the ports you want. (Almost)
-every port is also provided as a pre-compiled "package" which can be
-installed with a simple command (pkg_add) by those who do not wish to
-compile their own ports from source. See the file:
- /usr/share/FAQ/Text/ports.FAQ
-for a more complete description of the ports collection.
-
-
-Since our first release of FreeBSD 1.0 nearly two years ago, FreeBSD
-has changed almost entirely. A new port from the Berkeley 4.4 code
-base was done, which brought the legal status of the system out of the
-shadows with the blessing of Novell (the new owners of USL and UNIX). The
-port to 4.4 has also brought in a host of new features, filesystems
-and enhanced driver support. With our new unencumbered code base, we
-have every reason to hope that we'll be able to release quality
-operating systems without further legal encumbrance for some time to
-come!
-
-FreeBSD 2.0.5 represents the culmination of 2 years of work and many
-thousands of man hours put in by an international development team.
-We hope you enjoy it!
-
-A number of additional documents which you may find very helpful in
-the process of installing and using FreeBSD may also be found in
-the "FAQ" directory, either under /usr/share/FAQ on an installed
-system or at the top level of the CDROM or FTP distribution from
-where you're reading this file. Please consult FAQ/Text/ROADMAP
-for a brief description of the resources provided by the FAQ directory.
-
-For a list of contributors and a general project description, please see
-the file "CONTRIB.FreeBSD" which should be bundled with your binary
-distribution.
-
-Also see the "REGISTER.FreeBSD" file for information on registering
-with the "Free BSD user counter". This counter is for ALL freely
-available variants of BSD, not just FreeBSD, and we urge you to register
-yourself with it.
-
-The core of FreeBSD does not contain DES code which would inhibit its
-being exported outside the United States. There is an add-on package
-to the core distribution, for use only in the United States, that
-contains the programs that normally use DES. The auxiliary packages
-provided separately can be used by anyone. A freely (from outside the
-U.S.) exportable European distribution of DES for our non-U.S. users also
-exists and is described in the FreeBSD FAQ.
-
-If password security for FreeBSD is all you need, and you have no
-requirement for copying encrypted passwords from different hosts
-(Suns, DEC machines, etc) into FreeBSD password entries, then
-FreeBSD's MD5 based security may be all you require! We feel that our
-default security model is more than a match for DES, and without any
-messy export issues to deal with. If you're outside (or even inside)
-the U.S., give it a try!
-
-
-1.1 What's new in 2.0.5?
-------------------------
-
-The following features were added or substantially improved between
-the release of 2.0 and this 2.0.5 release. In order to facilitate
-better communication, the person, or persons, responsible for each
-enhancement is noted. Any questions regarding the new functionality
-should be directed to them first.
-
-KERNEL:
-
-Merged VM-File Buffer Cache
----------------------------
-A merged VM/buffer cache design greatly enhances overall system
-performance and makes it possible to do a number of more optimal
-memory allocation strategies that were not possible before.
-
-Owner: David Greenman (davidg@FreeBSD.org) and
- John Dyson (dyson@implode.root.com)
-
-
-Network PCB hash optimization
------------------------------
-For systems with a great number of active TCP connections (WEB and ftp
-servers, for example), this greatly speeds up the lookup time required
-to match an incoming packet up to its associated connection.
-
-Owner: David Greenman (davidg@FreeBSD.org)
-
-
-Name cache optimization
------------------------
-The name-cache would cache all files of the same name to the same bucket,
-which would put for instance all ".." entries in the same bucket. We added
-the parent directory version to frustrate the hash, and improved the
-management of the cache in various other ways while we were at it.
-
-Owner: Poul-Henning Kamp (phk@FreeBSD.org)
- David Greenman (davidg@FreeBSD.org)
-
-
-Less restrictive swap-spaces
-----------------------------
-The need to compile the names of the swap devices into the kernel has been
-removed. Now swapon will accept any block devices, up to the maximum
-number of swap devices configured in the kernel.
-
-Owner: Poul-Henning Kamp (phk@FreeBSD.org)
- David Greenman (davidg@FreeBSD.org)
-
-
-Hard Wired SCSI Devices
------------------------
-Prior to 2.0.5, FreeBSD performed dynamic assignment of unit numbers
-to SCSI devices as they were probed, allowing a SCSI device failure to
-possibly change unit number assignment and prevent filesystems on
-still functioning disks from mounting. Hard wiring allows static
-allocation of unit numbers (and hence device names) to scsi devices
-based on SCSI ID and bus. SCSI configuration occurs in the kernel
-config file. Samples of the configuration syntax can be found in the
-scsi(4) man page or the LINT kernel config file.
-
-Owner: Peter Dufault (dufault@hda.com)
-Sources involved: sys/scsi/* usr.sbin/config/*
-
-
-Slice Support
--------------
-FreeBSD now supports a "slice" abstraction which makes it more
-completely interoperable with other operating system partitions. This
-support will allow FreeBSD to inhabit DOS extended partitions.
-
-Owner: Bruce Evans (bde@FreeBSD.org)
-Sources involved: sys/disklabel.h sys/diskslice.h sys/dkbad.h
- kern/subr_diskslice.c kern/subr_dkbad.c
- i386/isa/diskslice_machdep.c
- i386/isa/wd.c scsi/sd.c dev/vn/vn.c
-
-
-Support for Ontrack Disk Manager Version 6.0
---------------------------------------------
-Support has been added for disks which use Ontrack Disk Manager. The
-fdisk program does NOT know about it however, so make all changes
-using the install program on the boot.flp or the Ontrack Disk Manager
-tool under DOS.
-
-Owner: Poul-Henning Kamp (phk@FreeBSD.org)
-
-
-Bad144 is back and working
---------------------------
-Bad144 works again, though the semantics are slightly different than
-before in that the bad-spots are kept relative to the slice rather
-than absolute on the disk.
-
-Owner: Bruce Evans (bde@FreeBSD.org)
- Poul-Henning Kamp (phk@FreeBSD.org)
-
-
-NEW DEVICE SUPPORT:
-
- SCSI and CDROM Devices
-
-Matsushita/Panasonic (Creative) CD-ROM driver
----------------------------------------------
-The Matsushita/Panasonic CR-562 and CR-563 drives are now supported
-when connected to a Sound Blaster or 100% compatible host adapter. Up
-to four host adapters are supported for a total of 16 CD-ROM drives.
-The audio functions are supported, along with access to the raw (2352 byte)
-data frames of any compact disc. Audio discs may be played using Karoke
-variable speed functions.
-
-Owner: Frank Durda IV bsdmail@nemesis.lonestar.org
-Sources involved: isa/matcd
-
-
-Adaptec 2742/2842/2940 SCSI driver
-----------------------------------
-The original 274x/284x driver has evolved considerably since the 2.0
-release. We now offer full support for the 2940 series as well as the
-Wide models of these cards. The arbitration bug (as well as many
-others) that caused the driver problems with fast devices has been
-corrected and there is even experimental tagged queuing support
-(kernel option "AHC_TAGENABLE"). John Aycock has also released the
-sequencer code under a "Berkeley style" copyright making the driver
-entirely clean of the GPL.
-
-Owner: Justin Gibbs (gibbs@FreeBSD.org)
-Sources involved: isa/aic7770.c pci/aic7870.c i386/scsi/*
- sys/dev/aic7xxx/*
-
-
-NCR5380/NCR53400 SCSI ("ProAudio Spectrum") driver
---------------------------------------------------
-Owner: core
-Submitted by: Serge Vakulenko (vak@cronyx.ru)
-Sources involved: isa/ncr5380.c
-
-
-Sony CDROM driver
------------------
-Owner: core
-Submitted by: Mikael Hybsch (micke@dynas.se)
-Sources involved: isa/scd.c
-
-
- Serial Devices
-
-SDL Communications Riscom/8 Serial Board Driver
------------------------------------------------
-Owner: Andrey Chernov (ache@FreeBSD.org)
-Sources involved: isa/rc.c isa/rcreg.h
-
-
-Cyclades Cyclom-y Serial Board Driver
--------------------------------------
-Owner: Bruce Evans (bde@FreeBSD.org)
-Submitted by: Andrew Werple (andrew@werple.apana.org.au) and
- Heikki Suonsivu (hsu@cs.hut.fi)
-Obtained from: NetBSD
-Sources involved: isa/cy.c
-
-
-Cronyx/Sigma sync/async serial driver
--------------------------------------
-Owner: core
-Submitted by: Serge Vakulenko
-Sources involved: isa/cronyx.c
-
-
-
- Networking
-
-Diskless booting
-----------------
-Diskless booting in 2.0.5 is much improved. The boot-program is in
-src/sys/i386/boot/netboot, and can be run from an MSDOS system or
-burned into an EPROM. Local swapping is also possible. WD, SMC, 3COM
-and Novell ethernet cards are currently supported.
-
-
-DEC DC21140 Fast Ethernet driver
---------------------------------
-This driver supports any of the numerous NICs using the DC21140 chipset
-including the 100Mb DEC DE-500-XA and SMC 9332.
-
-Owner: core
-Submitted by: Matt Thomas (thomas@lkg.dec.com)
-Sources involved: pci/if_de.c pci/dc21040.h
-
-
-DEC FDDI (DEFPA/DEFEA) driver
------------------------------
-Owner: core
-Submitted by: Matt Thomas (thomas@lkg.dec.com)
-Sources involved: pci/if_pdq.c pci/pdq.c pci/pdq_os.h pci/pdqreg.h
-
-
-3Com 3c505 (Etherlink/+) NIC driver
------------------------------------
-Owner: core
-Submitted by: Dean Huxley (dean@fsa.ca)
-Obtained from: NetBSD
-Sources involved: isa/if_eg.c
-
-
-Fujitsu MB86960A family of NICs driver
--------------------------------------
-Owner: core
-Submitted by: M.S. (seki@sysrap.cs.fujitsu.co.jp)
-Sources involved: isa/if_fe.c
-
-
-Intel EtherExpress driver
--------------------------
-Owner: Rodney W. Grimes (rgrimes@FreeBSD.org)
-Sources involved: isa/if_ix.c isa/if_ixreg.h
-
-
-3Com 3c589 driver
------------------
-Owner: core
-Submitted by: "HOSOKAWA Tatsumi" (hosokawa@mt.cs.keio.ac.jp),
- Seiji Murata (seiji@mt.cs.keio.ac.jp) and
- Noriyuki Takahashi (hor@aecl.ntt.jp)
-Sources involved: isa/if_zp.c
-
-
-IBM Credit Card Adapter driver
-------------------------------
-Owner: core
-Submitted by: "HOSOKAWA Tatsumi" (hosokawa@mt.cs.keio.ac.jp),
-Sources involved: isa/pcic.c isa/pcic.h
-
-
-EDSS1 and 1TR6 ISDN interface driver
-------------------------------------
-Owner: core
-Submitted by: Dietmar Friede (dfriede@drnhh.neuhaus.de) and
- Juergen Krause (jkr@saarlink.de)
-Sources involved: gnu/isdn/*
-
-
- Miscellaneous Drivers
-
-Joystick driver
----------------
-Owner: Jean-Marc Zucconi (jmz@FreeBSD.org)
-Sources involved: isa/joy.c
-
-
-National Instruments "LabPC" driver
------------------------------------
-Owner: Peter Dufault (dufault@hda.com)
-Sources involved: isa/labpc.c
-
-
-WD7000 driver
--------------
-Owner: Olof Johansson (offe@ludd.luth.se)
-
-
-Pcvt Console driver
--------------------
-Owner: Joerg Wunsch (joerg@FreeBSD.org)
-Submitted by: Hellmuth Michaelis (hm@altona.hamburg.com)
-Sources involved: isa/pcvt/* usr.sbin/pcvt/*
-
-
-BSD-audio emulator for VAT driver
----------------------------------
-Owner: Amancio Hasty (ahasty@FreeBSD.org) and
- Paul Traina (pst@FreeBSD.org)
-Sources involved: isa/sound/vat_audio.c isa/sound/vat_audioio.h
-
-
-National Instruments AT-GPIB and AT-GPIB/TNT GPIB driver
---------------------------------------------------------
-Owner: core
-Submitted by: Fred Cawthorne (fcawth@delphi.umd.edu)
-Sources involved: isa/gpib.c isa/gpib.h isa/gpibreg.h
-
-
-Genius GS-4500 hand scanner driver
-----------------------------------
-Owner: core
-Submitted by: Gunther Schadow (gusw@fub46.zedat.fu-berlin.de)
-Sources involved: isa/gsc.c isa/gscreg.h
-
-
-CORTEX-I Frame Grabber
-----------------------
-Owner: core
-Submitted by: Paul S. LaFollette, Jr.
-Sources involved: isa/ctx.c isa/ctxreg.h
-
-
-Video Spigot video capture card
--------------------------------
-Owner: Jim Lowe
-
-
-
-1.2 Experimental features
--------------------------
-
-The unionfs and LFS file systems are known to be severely broken in
-2.0.5. This is in part due to old bugs that we haven't had time to
-resolve yet and the need to update these file systems to deal with the
-new VM system. We hope to address these issues in a later release of
-FreeBSD.
-
-FreeBSD now supports running iBCS2 compatible binaries (currently SCO
-UNIX 3.2.2 & 3.2.4 and ISC 2.2 COFF format are supported). The iBCS2
-emulator is in its early stages, but it is functional, we haven't been
-able to do exhaustive testing (lack of commercial apps), but almost
-all of SCO's 3.2.2 binaries are working, so is an old INFORMIX-2.10
-for SCO. Further testing is nessesary to complete this project. There
-is also work under way for ELF & XOUT loaders, and most of the svr4
-syscall wrappers have been written.
-
-FreeBSD also implements enough of its Linux compatibility that we
-can now run Linux DOOM! See the ``xperimnt'' directory (on your local
-FTP server or CDROM) for full docs on how to set this up.
-
-Owner: Soren Schmidt (sos) & Sean Eric Fagan (sef)
-Sources involved: sys/i386/ibcs2/* + misc kernel changes.
-
-
-2. Supported Configurations
----------------------------
-
-FreeBSD currently runs on a wide variety of ISA, VLB, EISA and PCI bus
-based PC's, ranging from 386sx to Pentium class machines (though the
-386sx is not recommended). Support for generic IDE or ESDI drive
-configurations, various SCSI controller, network and serial cards is
-also provided.
-
-Following is a list of all disk controllers and ethernet cards currently
-known to work with FreeBSD. Other configurations may very well work, and
-we have simply not received any indication of this.
-
-
-2.1. Disk Controllers
----------------------
-
-WD1003 (any generic MFM/RLL)
-WD1007 (any generic IDE/ESDI)
-IDE
-ATA
-
-Adaptec 152x series ISA SCSI controllers
-Adaptec 154x series ISA SCSI controllers
-Adaptec 174x series EISA SCSI controller in standard and enhanced mode.
-Adaptec 274X/284X/2940 (Narrow/Wide/Twin) series ISA/EISA/PCI SCSI controllers
-Adaptec AIC-6260 and AIC-6360 based boards, which includes
-the AHA-152x and SoundBlaster SCSI cards.
-
-** Note: You cannot boot from the SoundBlaster cards as they have no
- on-board BIOS, which is necessary for mapping the boot device into the
- system BIOS I/O vectors. They're perfectly usable for external tapes,
- CDROMs, etc, however. The same goes for any other AIC-6x60 based card
- without a boot ROM. Some systems DO have a boot ROM, which is generally
- indicated by some sort of message when the system is first powered up
- or reset. Check your system/board documentation for more details.
-
-[Note that Buslogic was formerly known as "Bustec"]
-Buslogic 545S & 545c
-Buslogic 445S/445c VLB SCSI controller
-Buslogic 742A, 747S, 747c EISA SCSI controller.
-Buslogic 946c PCI SCSI controller
-Buslogic 956c PCI SCSI controller
-
-NCR 53C810 and 53C825 PCI SCSI controller.
-NCR5380/NCR53400 ("ProAudio Spectrum") SCSI controller.
-
-DTC 3290 EISA SCSI controller in 1542 emulation mode.
-
-UltraStor 14F, 24F and 34F SCSI controllers.
-
-Seagate ST01/02 SCSI controllers.
-
-Future Domain 8xx/950 series SCSI controllers.
-
-WD7000 SCSI controller.
-
-With all supported SCSI controllers, full support is provided for
-SCSI-I & SCSI-II peripherals, including Disks, tape drives (including
-DAT) and CD ROM drives.
-
-The following CD-ROM type systems are supported at this time:
-(cd) SCSI (also includes ProAudio Spectrum and SoundBlaster SCSI)
-(mcd) Mitsumi proprietary interface
-(matcd) Matsushita/Panasonic (Creative) proprietary interface
-(scd) Sony proprietary interface
-
-Note: CD-Drives with IDE interfaces are not supported at this time.
-
-Some controllers have limitations with the way they deal with >16MB of
-memory, due to the fact that the ISA bus only has a DMA address space
-of 24 bits. If you do your arithmetic, you'll see that this makes it
-impossible to do direct DMA to any address >16MB. This limitation is
-even true of some EISA controllers (which are normally 32 bit) when
-they're configured to emulate an ISA card, which they then do in *all*
-respects. This problem is avoided entirely by IDE controllers (which
-do not use DMA), true EISA controllers (like the UltraStor, Adaptec
-1742A or Adaptec 2742) and most VLB (local bus) controllers. In the
-cases where it's necessary, the system will use "bounce buffers" to
-talk to the controller so that you can still use more than 16Mb of
-memory without difficulty.
-
-
-2.2. Ethernet cards
--------------------
-
-Allied-Telesis AT1700 and RE2000 cards
-SMC Elite 16 WD8013 ethernet interface, and most other WD8003E,
-WD8003EBT, WD8003W, WD8013W, WD8003S, WD8003SBT and WD8013EBT
-based clones. SMC Elite Ultra is also supported.
-
-DEC EtherWORKS III NICs (DE203, DE204, and DE205)
-DEC EtherWORKS II NICs (DE200, DE201, DE202, and DE422)
-DEC DC21140 based NICs (SMC???? DE???)
-DEC FDDI (DEFPA/DEFEA) NICs
-
-Fujitsu FMV-181 and FMV-182
-
-Intel EtherExpress
-
-Isolan AT 4141-0 (16 bit)
-Isolink 4110 (8 bit)
-
-Novell NE1000, NE2000, and NE2100 ethernet interface.
-
-3Com 3C501 cards
-
-3Com 3C503 Etherlink II
-
-3Com 3c505 Etherlink/+
-
-3Com 3C507 Etherlink 16/TP
-
-3Com 3C509, 3C579, 3C589 (PCMCIA) Etherlink III
-
-Toshiba ethernet cards
-
-PCMCIA ethernet cards from IBM and National Semiconductor are also
-supported.
-
-
-2.3. Misc
----------
-
-AST 4 port serial card using shared IRQ.
-
-ARNET 8 port serial card using shared IRQ.
-
-BOCA ATIO66 6 port serial card using shared IRQ.
-
-Cyclades Cyclom-y Serial Board.
-
-STB 4 port card using shared IRQ.
-
-Mitsumi (all models) CDROM interface and drive.
-
-SDL Communications Riscom/8 Serial Board.
-
-SoundBlaster SCSI and ProAudio Spectrum SCSI CDROM interface and drive.
-
-Matsushita/Panasonic (Creative SoundBlaster) CDROM interface and drive.
-
-Adlib, SoundBlaster, SoundBlaster Pro, ProAudioSpectrum, Gravis UltraSound
-and Roland MPU-401 sound cards.
-
-FreeBSD currently does NOT support IBM's microchannel (MCA) bus, but
-support is apparently close to materializing. Details will be posted
-as the situation develops.
-
-
-3. Obtaining FreeBSD
---------------------
-
-You may obtain FreeBSD in a variety of ways:
-
-1. FTP/Mail
-
-You can ftp FreeBSD and any or all of its optional packages from
-`ftp.freebsd.org' - the official FreeBSD release site.
-
-For other locations that mirror the FreeBSD software see the file
-MIRROR.SITES. Please ftp the distribution from the nearest site
-to you netwise.
-
-If you do not have access to the internet and electronic mail is your
-only recourse, then you may still fetch the files by sending mail to
-`ftpmail@decwrl.dec.com' - putting the keyword "help" in your message
-to get more information on how to fetch files from ftp.freebsd.org.
-Note: This approach will end up sending many *tens of megabytes*
-through the mail, and should only be employed as an absolute LAST
-resort!
-
-
-2. CDROM
-
-FreeBSD 2.0.5 may be ordered on CDROM from:
-
- Walnut Creek CDROM
- 4041 Pike Lane, Suite D
- Concord CA 94520
- 1-800-786-9907, +1-510-674-0783, +1-510-674-0821 (fax)
-
-Or via the internet from orders@cdrom.com or http://www.cdrom.com.
-Their current catalog can be obtained via ftp as:
- ftp://ftp.cdrom.com/cdrom/catalog.
-
-Cost per CD is $39.95, or $24.95 with a FreeBSD subscription. With
-a subscription, you will automatically receive updates as they
-are released. Your credit card will be billed when each disk is shipped
-and you may cancel your subscription at any time without further obligation.
-
-Walnut Creek CDROM also sells a full line of FreeBSD related merchandise such
-as T-shirts ($14.95, available in "child", Large and XL sizes), coffee mugs
-($9.95), tattoos ($0.25 each) and posters ($3.00).
-
-Shipping (per order not per disc) is $5 in the US, Canada or
-Mexico and $9.00 overseas. They accept Visa, Mastercard, Discover,
-American Express or checks in U.S. Dollars and ship COD within the
-United States. California residents please add 8.25% sales tax.
-
-Should you be dissatisfied for any reason, the CD comes with an
-unconditional return policy.
-
-
-Reporting problems, making suggestions, submitting code
--------------------------------------------------------
-
-Your suggestions, bug reports and contributions of code are always
-valued - please do not hesitate to report any problems you may find
-(preferably with a fix attached if you can!).
-
-The preferred method to submit bug reports from a machine with
-internet mail connectivity is to use the send-pr command. Bug reports
-will be dutifully filed by our faithful bugfiler program and you can
-be sure that we'll do our best to respond to all reported bugs as soon
-as possible.
-
-If, for some reason, you are unable to use the send-pr command to
-submit a bug report, you can try to send it to:
-
- bugs@FreeBSD.org
-
-
-Otherwise, for any questions or suggestions, please send mail to:
-
- questions@FreeBSD.org
-
-Additionally, being a volunteer effort, we are always happy to have
-extra hands willing to help - there are already far more enhancements
-to be done than we can ever manage to do by ourselves! To contact us
-on technical matters, or with offers of help, you may send mail to:
-
- hackers@FreeBSD.org
-
-Since these mailing lists can experience significant amounts of
-traffic, if you have slow or expensive mail access and you are
-only interested in keeping up with significant FreeBSD events, you may
-find it preferable to subscribe to:
-
- announce@FreeBSD.org
-
-
-All but the freebsd-bugs groups can be freely joined by anyone wishing
-to do so. Send mail to MajorDomo@FreeBSD.org and include the keyword
-`help' on a line by itself somewhere in the body of the message. This
-will give you more information on joining the various lists, accessing
-archives, etc. There are a number of mailing lists targeted at
-special interest groups not mentioned here, so send mail to majordomo
-and ask about them!
-
-
-6. Acknowledgements
--------------------
-
-FreeBSD represents the cumulative work of many dozens, if not
-hundreds, of individuals from around the world who have worked very
-hard to bring you this release. It would be very difficult, if not
-impossible, to enumerate everyone who's contributed to FreeBSD, but
-nonetheless we shall try (in alphabetical order, of course). If your
-name is not mentioned, please be assured that its omission is entirely
-accidental.
-
-
-The Computer Systems Research Group (CSRG), U.C. Berkeley.
-
-Bill Jolitz, for his initial work with 386BSD.
-
-The FreeBSD Core Team
-(in alphabetical order by first name):
-
- Andreas Schulz <ats@FreeBSD.org>
- Andrey A. Chernov <ache@FreeBSD.org>
- Bruce Evans <bde@FreeBSD.org>
- David Greenman <davidg@FreeBSD.org>
- Garrett A. Wollman <wollman@FreeBSD.org>
- Gary Palmer <gpalmer@FreeBSD.org>
- Geoff Rehmet <csgr@FreeBSD.org>
- Jack Vogel <jackv@FreeBSD.org>
- John Dyson <dyson@FreeBSD.org>
- Jordan K. Hubbard <jkh@FreeBSD.org>
- Justin Gibbs <gibbs@FreeBSD.org>
- Paul Richards <paul@FreeBSD.org>
- Poul-Henning Kamp <phk@FreeBSD.org>
- Rich Murphey <rich@FreeBSD.org>
- Rodney W. Grimes <rgrimes@FreeBSD.org>
- Satoshi Asami <asami@FreeBSD.org>
- Søren Schmidt <sos@FreeBSD.org>
-
-Special mention to:
-
- Walnut Creek CDROM, without whose help (and continuing support)
- this release would never have been possible.
-
- Dermot McDonnell for his donation of a Toshiba XM3401B CDROM
- drive.
-
- Additional FreeBSD helpers and beta testers:
-
- J.T. Conklin Julian Elischer
- Frank Durda IV Peter Dufault
- Sean Eric Fagan Jeffrey Hsu
- Terry Lambert L Jonas Olsson
- Chris Provenzano Dave Rivers
- Guido van Rooij Steven Wallace
- Atsushi Murai Scott Mace
- Nate Williams
-
- And everyone at Montana State University for their initial support.
-
-
-Jordan would also like to give special thanks to Poul-Henning Kamp and
-Gary Palmer, both of whom put in long hours helping him to construct
-the new installation utility. Poul, being a proud new father, was
-especially pressed for time and yet somehow managed to put in
-a significant amount of effort anyway. This release could not have
-happened without him! Thank you both!
-
-Thanks also to everyone else who helped, especially those not
-mentioned, and we sincerely hope you enjoy this release of FreeBSD!
-
-
- The FreeBSD Core Team
-
-$Id: RELNOTES,v 1.9 1995/06/10 02:40:11 jkh Exp $
diff --git a/release/sysinstall/help/en_US.ISO8859-1/XF86.hlp b/release/sysinstall/help/en_US.ISO8859-1/XF86.hlp
deleted file mode 100644
index c789eaa..0000000
--- a/release/sysinstall/help/en_US.ISO8859-1/XF86.hlp
+++ /dev/null
@@ -1,500 +0,0 @@
-README for XFree86 3.1.1u1 on FreeBSD 2.0.5
-Rich Murphey, David Dawes
-20 January 1995
-
-1. What and Where is XFree86?
-------------------------------
-
-XFree86 is a port of X11R6 that supports several versions of Intel-
-based Unix. It is derived from X386 1.2, which was the X server
-distributed with X11R5. This release consists of many new features
-and performance improvements as well as many bug fixes. The release
-is available as source patches against the X Consortium X11R6 code, as
-well as binary distributions for many architectures.
-
-See the Copyright Notice (COPYRIGHT.html).
-
-The sources for XFree86 are available as part of the FreeBSD 2.0.5
-distribution, or by anonymous ftp from:
-
-ftp.XFree86.org:/pub/XFree86/current
-(ftp://ftp.XFree86.org/pub/XFree86/current)
-
-
-Binaries for XFree86 on FreeBSD are also available as part of
-2.0.5 or from:
-
-ftp.XFree86.org:/pub/XFree86/current/binaries/FreeBSD-2.0
-(ftp://ftp.XFree86.org/pub/XFree86/current/binaries/FreeBSD-2.0)
-
-XFree86.cdrom.com:/pub/XFree86/current/binaries/FreeBSD-2.0
-(ftp://XFree86.cdrom.com/pub/XFree86/current/binaries/FreeBSD-2.0)
-
-Send email to Rich-Murphey@Rice.edu or XFree86@XFree86.org if you have
-comments or suggestions about this file and we'll revise it.
-
-
-2. Installing the Binaries
----------------------------
-
-In the FreeBSD 2.0.5 distribution, XFree86 comes in 3 major sections:
-"basic" distributions, fonts and servers. At the minimum, you will
-need the binaries and libraries from the basic distribution, the
-"misc" fonts collection and at least one server. The smallest usable
-distribution is around 9MB.
-
-If you can't decide what to pick and you have 52Mb of disk
-space, it's safe to unpack everything.
-
-What follows is a description of the various distribution files
-comprising XFree86. If you are installing this as part of FreeBSD
-2.0.5 then there's no need to use these files directly: You may
-simply check the desired components off the installation menus
-provided for that purpose. If you're installing this manually,
-then the following information should prove useful:
-
- Required (6.7Mb):
-
- X311bin.tgz
- all the executable X client applications and shared libs
-
- X311fnts.tgz
- the misc and 75 dpi fonts
-
- X311lib.tgz
- data files needed at runtime
-
-
- Required unless you have already customized your configuration
- files:
-
- X311xicf.tgz
- customizable xinit runtime configuration file
-
- X311xdcf.tgz
- customizable xdm runtime configuration file
-
- Choose at least one server ( 2.3Mb):
-
- X3118514.tgz
- 8-bit color for IBM 8514 and true compatibles.
-
- X311AGX.tgz
- 8-bit color for AGX boards.
-
- X311Mch3.tgz
- 8 and 16-bit color for ATI Mach32 boards.
-
- X311Mch8.tgz
- 8-bit color for ATI Mach8 boards.
-
- X311Mono.tgz
- 1-bit monochrome for VGA, Super-VGA, Hercules, and others.
-
- X311P9K.tgz
- 8, 16, and 24-bit color for Weitek P9000 boards (Diamond
- Viper).
-
- X311S3.tgz
- 8, 16 and 24-bit color for S3 boards (#9 GXE, Actix GE32,
- SPEA Mercury, STB Pegasus)
-
- X311SVGA.tgz
- 8-bit color for Super-VGA cards.
-
- X311VG16.tgz
- 4-bit color for VGA and Super-VGA cards
-
- X311W32.tgz
- 8-bit Color for ET4000/W32, /W32i and /W32p cards.
-
- X311nest.tgz
- A nested server running as a client window on another
- display.
-
- Optional:
-
- X311doc.tgz
- (.5Mb) READMEs and XFree86 specific man pages
-
- X311man.tgz
- (1.7Mb) man pages except XFree86 specific ones in etc archive
-
- X311f100.tgz
- (1.8Mb) 100dpi fonts
-
- X311fscl.tgz
- (1.6Mb) Speedo and Type1 fonts
-
- X311fnon.tgz
- (3.3Mb) Japanese, Chinese and other non-English fonts
-
- X311fsrv.tgz
- (.3Mb) the font server and it's man page
-
- X311prog.tgz
- (3.9Mb) config, lib*.a and *.h files needed only for
- compiling
-
- X311link.tgz
- (7.8Mb) X server reconfiguration kit
-
- X311pex.tgz
- (.5Mb) PEX fonts and shared libs needed by PEX applications.
-
- X311lbx.tgz
- (.2Mb) low bandwidth X proxy server and libraries.
-
-Note that there is no longer a separate xdm archive. FreeBSD 2.0
-and later handles this in shared libraries now, so that the xdm
-binary does not itself contain des and there is no more need for
-us to provide separate tar balls.
-
-
-2.1. Full Install:
--------------------
-
-[ Note: Unless you're installing XFree86 3.1.1u1 manually, that is
- to say not as part of the FreeBSD 2.0.5 installation, you may skip
- to section 2.3 ]
-
- 1. You must be logged in as root to unpack the archives because
- several executables are set-user-id. Otherwise the server may
- abort if you unpack it as an ordinary user. You must also use a
- ``umask'' value of 022 because the X server requires special
- permissions.
-
- % su
- # umask 022
-
-
- 2. If you have 52Mb free in the /usr partition ``cd /usr'' and skip
- to no. 3. Otherwise, create a directory on another partition
- and sym link it into /usr:
-
- # cd /usr/local
- # mkdir X11R6
- # ln -s /usr/local/X11R6 /usr/X11R6
-
-
- 3. Unpack everything:
-
- If you are using sh (as root usually does):
-
- # for i in X311*.tgz; do
- # tar -xzf $i
- # done
-
-
- Else, if you are using csh:
-
- % foreach i (X311*.tgz)
- % tar -xzf $i
- % end
-
-
- 4. Create a symbolic link ``X'' that points to the server that
- matches your video card. The XF86_* man pages list which vga
- chip sets are supported by each server. For example, if you
- have an ET4000 based card you will use the XF86_SVGA server:
-
- # cd /usr/X11R6/bin; rm X; ln -s XF86_SVGA X
-
-
-2.2. Minimal Install:
-----------------------
-
-First do numbers 1 and 2 above. Then unpack the required archives:
-
- # for i in bin fnts lib xicf; do
- # tar -xzf X311$i.tgz
- # done
-
-
-Then unpack a server archive corresponding to your vga card. The
-server man pages, X11R6/man/man1/XF86_*, list the vga chip sets
-supported by each server. For example, if you have an ET4000 based
-card you will use the XF86_SVGA server:
-
- # tar -xzf X311SVGA.tgz
- # cd /usr/X11R6/bin; rm X; ln -s XF86_SVGA X
-
-
-2.3. After either Full or Minimal Install above:
--------------------------------------------------
-
-Add /usr/X11R6/bin to the default path for sh in /etc/profile and for
-csh in /etc/csh.login if they are not already there:
-
- # echo 'set path = ($path /usr/X11R6/bin)' >>/etc/csh.login
- # echo 'PATH=$PATH:/usr/X11R6/bin' >>/etc/profile
-
-
-Or make sure all who use X put /usr/X11R6/bin in their shell's
-``path'' variable.
-
-Next either reboot or invoke ldconfig as root to put the shared
-libraries in ld.so's cache:
-
- # ldconfig /usr/lib /usr/local/lib /usr/X11R6/lib
-
-
-If you had already configured X11R6/lib/X11/xinit/xinitrc or
-X11R6/lib/X11/xdm/* omit the xinit-config or xdm-config archive or
-unpack it separately and merge in your customizations.
-
-The fscl and f100 archives are optional and can be omitted if you are
-short on space. The optional link archive allows you to reconfigure
-and customize a X server binary. The optional prog archive is needed
-only for writing or compiling X applications. The optional pex
-archive contains pex clients and libraries for building 3D graphics
-applications.
-
- NOTE: You don't need to uncompress the font files, but if
- you uncompress them anyway you must run mkfontdir in the
- corresponding font directory; otherwise your server will
- abort with the message ``could not open default font
- 'fixed'''.
-
-
-3. Installing The Display Manager (xdm)
-----------------------------------------
-
-The display manager makes your PC look like an X terminal. That is,
-it presents you with a login screen that runs under X.
-
-The easiest way to automatically start the display manager on boot is
-to add a line in /etc/ttys to start it on one of the unoccupied
-virtual terminals:
-
- ttyv4 "/usr/X11R6/bin/xdm -nodaemon" xterm on secure
-
-You should also make sure that /usr/X11R6/bin/X is a symbolic link to
-the Xserver that matches your video card or edit the file Xservers in
-/usr/X11R6/lib/X11/xdm to specify the pathname of the X server.
-
-The change to /etc/ttys won't take effect until you either reboot or
-``kill -HUP 1'' to force initd to reread /etc/ttys. You can also test
-the display manager manually by loging in as root on the console and
-typing ``xdm -nodaemon''.
-
-
-4. Configuring X for Your Hardware
------------------------------------
-
-The XF86Config file tells the X server what kind of monitor, video
-card and mouse you have. You must create it to tell the server what
-specific hardware you have.
-
-XFree86 3.1 uses a new configuration file format. Consult the
-XF86Config man page and the general INSTALL (INSTALL.html) file for
-instructions.
-
-If you have a Xconfig file for XFree86 2.x, use reconfig to translate
-part of it into the new format:
-
- # reconfig <Xconfig >XF86Config
-
-and complete the rest according to the XF86Config man page and the
-XF86Config.sample file as a template.
-
-In order to protect your hardware from damage, the server no longer
-will read XF86Config files from a user's home directory, but requires
-that it be in /etc/XF86Config, /usr/X11R6/lib/X11/XF86Config.hostname
-or /usr/X11R6/lib/X11/XF86Config.
-
-You'll need info on your hardware:
-
- o Your mouse type, baud rate and it's /dev entry.
-
- o The video card's chipset (e.g. ET4000, S3, etc).
-
- o Your monitor's sync frequencies.
-
-The easiest way to find which device your mouse is plugged into is to
-use ``cat'' or ``kermit'' to look at the output of the mouse. Connect
-to it and just make sure that it generates output when the mouse is
-moved or clicked:
-
- % cat < /dev/cuaa0
-
-If you can't find the right mouse device then use ``dmesg|grep sio''
-to get a list of devices that were detected upon booting:
-
- % dmesg|grep sio
- sio0 at 0x3f8-0x3ff irq 4 on isa
-
-Then double check the /dev entries corresponding to these devices.
-Use the script /dev/MAKEDEV to create entries if they don't already
-exist:
-
- % cd /dev
- % sh MAKEDEV cuaa0
-
-If you plan to fine tune the screen size or position on your monitor
-you'll need the specs for sync frequencies from your monitor's manual.
-
-
-5. Running X
--------------
-
-8mb of memory is a recommended minimum for running X. The server,
-window manager, display manager and an xterm take about 8Mb of virtual
-memory themselves. Even if their resident set size is smaller, on a
-8Mb system that leaves very space for other applications such as gcc
-that expect a few meg free. The R6 X servers may work with 4Mb of
-memory, but in practice compilation while running X can take 5 or 10
-times as long due to constant paging.
-
-The easiest way for new users to start X windows is to type ``startx
->& startx.log''. Error messages are lost unless you redirect them
-because the server takes over the screen.
-
-To get out of X windows, type: ``exit'' in the console xterm. You can
-customize your X by creating .xinitrc, .xserverrc, and .twmrc files in
-your home directory as described in the xinit and startx man pages.
-
-
-6. Rebuilding Kernels for X
-----------------------------
-
-The GENERIC FreeBSD 2.0 kernel supports XFree86 without any
-modifications required. You do not need to make any changes to the
-GENERIC kernel or any kernel configuration which is a superset.
-
-For a general description of BSD kernel configuration get
-smm.02.config.ps.Z
-(ftp://gatekeeper.dec.com/pub/BSD/manuals/smm.02.config.ps.Z). It is
-a ready-to-print postscript copy of the kernel configuration chapter
-from the system maintainers manual.
-
-If you do decide to reduce your kernel configuration file, do not
-remove the two lines below (in /sys/arch/i386/conf). They are both
-required for X support:
-
- options XSERVER #Xserver
- options UCONSOLE #X Console support
-
-The generic FreeBSD 2.0 kernel is configured by default with the
-syscons driver. To configure your kernel similarly it should have a
-line like this in /usr/src/sys/i386/conf/GENERIC:
-
- device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
-
-The maximum number of virtual consoles can be set using the MAXCONS
-option:
-
- options "MAXCONS=4" #4 virtual consoles
-
-
-Otherwise, the default without a line like this is 12. You must have
-more VTs than gettys as described in the end of section 3, and 4 is a
-reasonable minimum.
-
-The server supports several console drivers: pccons, syscons and pcvt.
-The syscons driver is the default in FreeBSD 1.1.5 and higher. They
-are detected at runtime and no configuration of the server itself is
-required.
-
-The pcvt console driver is bundled into FreeBSD and may be enabled
-by changing the `sc0' line in your kernel configuration file to
-`vt0'. See /sys/i386/conf/LINT for more details.
-
-The XFree86 servers include support for the MIT-SHM extension. The
-GENERIC kernel does not support this, so if you want to make use of
-this, you will need a kernel configured with SYSV shared memory
-support. To do this, add the following line to your kernel config
-file:
-
- options SYSVSHM # System V shared memory
- options SYSVSEM # System V semaphores
- options SYSVMSG # System V message queues
-
-
-If you are using a SoundBlaster 16 on IRQ 2 (9), then you need a patch
-for sb16_dsp.c. Otherwise a kernel configured with the SoundBlaster
-driver will claim interrupt 9 doesn't exist and X server will lock up.
-
-S3 cards and serial port COM 4 cannot be installed together on a
-system because the I/O port addresses overlap.
-
-
-7. Rebuilding XFree86
-----------------------
-
-The server link kit allows you to build an X server using a minimum
-amount of disk space. Just unpack it, make the appropriate changes to
-site.def, type ``./mkmf' and ``make'' to link the server. See
-README.LinkKit (LinkKit.html) for more info.
-
-The source tree takes about 114Mb before compiling and an additional
-100Mb after ``make World''. You should configure the distribution by
-editing xf86site.def and site.def in xc/config/cf before compiling.
-By default, the config files are set up to build shared libraries. If
-you are running a version of FreeBSD that doesn't include shared
-library support, add the following line to site.def:
-
- #define BuildBsdSharedLibs NO
-
-If your system doesn't have support or SYSV shared memory (for
-example, if you don't have the <sys/shm.h> header), you should disable
-the MIT-SHM extension by adding the following line to site.def:
-
- #define HasShm NO
-
-To compile the sources on FreeBSD 1.1 and later, type:
-
- make World
-
-
-8. Building Other X Clients
-----------------------------
-
-The easiest way to build a new client (X application) is to use xmkmf
-if an Imakefile is included with it. Type ``xmkmf -a'' to create the
-Makefiles, then type ``make''. Whenever you install additional man
-pages you should update whatis.db by running ``makewhatis
-/usr/X11R6/man''.
-
-Note: Starting with XFree86 2.1 and FreeBSD 1.1, the symbol __386BSD__
-no longer gets defined either by the compiler or via the X config
-files for FreeBSD systems. When porting clients to BSD systems, make
-use of the symbol BSD for code which is truly BSD-specific. The value
-of the symbol can be used to distinguish different BSD releases. For
-example, code specific to the Net-2 and later releases can use:
-
- #if (BSD >= 199103)
-
-To ensure that this symbol is correctly defined, include <sys/param.h>
-in the source that requires it. Note that the symbol CSRG_BASED is
-defined for *BSD systems in XFree86 3.1.1 and later. This should be
-used to protect the inclusion of <sys/param.h>.
-
-For code that really is specific to a particular i386 BSD port, use
-__FreeBSD__ for FreeBSD, __NetBSD__ for NetBSD, __386BSD__ for 386BSD,
-and __bsdi__ for BSD/386.
-
-
-9. Thanks
-----------
-
-Many thanks to:
-
- o Pace Willison for providing initial *BSD support.
-
- o Amancio Hasty for 386BSD kernel and S3 chipset support.
-
- o David Greenman, Nate Williams, Jordan Hubbard for FreeBSD kernel
- support.
-
- o Rod Grimes, Jordan Hubbard and Jack Velte for the use of Walnut
- Creek Cdrom's hardware.
-
- o Orest Zborowski, Simon Cooper and Dirk Hohndel for ideas from
- the Linux distribution.
-
-$XConsortium: FreeBSD.sgml,v 1.3 95/01/23 15:34:41 kaleb Exp $
-Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/FreeBSD.sgml,v 3.10 1995/01/28 16:01:28 dawes Exp $
-
-
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/READ.FreeBSD,v 3.12 1995/01/28 16:19:37 dawes Exp $
diff --git a/release/sysinstall/help/en_US.ISO8859-1/configure.hlp b/release/sysinstall/help/en_US.ISO8859-1/configure.hlp
deleted file mode 100644
index 2d14031..0000000
--- a/release/sysinstall/help/en_US.ISO8859-1/configure.hlp
+++ /dev/null
@@ -1,14 +0,0 @@
-This menu allows you to configure your system after the installation process
-is complete. At the minimum, you should probably set the system manager's
-password and the system time zone.
-
-For extra goodies like bash, emacs, pascal, etc., you should look at the
-Packages item in this menu. Currently, the Packages option is only useful
-if you have a CDROM or an existing packages collection somewhere in the
-file system hierarchy where the package management tool can locate it.
-The automatic transfer of packages via FTP is not yet supported!
-
-If you wish to re-invoke the package installation tool after leaving
-the system installation, the command is ``pkg_manage''. For setting
-the timezone, type ``tzsetup''. For more information on the general
-system configuration, see the ``/etc/sysconfig'' file.
diff --git a/release/sysinstall/help/en_US.ISO8859-1/distributions.hlp b/release/sysinstall/help/en_US.ISO8859-1/distributions.hlp
deleted file mode 100644
index b81efbf..0000000
--- a/release/sysinstall/help/en_US.ISO8859-1/distributions.hlp
+++ /dev/null
@@ -1,88 +0,0 @@
-An ``X-'' prefixed before a distribution set means that the XFree86
-3.1.1u1 base distribution, libraries, manual pages, SVGA server and a
-set of default fonts will be selected in addition to the set itself.
-
-If you select such a set, you will also be presented with a set of
-menus for customizing the selections to your desired X Window System
-setup.
-
-N.B. All references in this document to `complete source' mean the
-complete source tree minus any legally encumbered cryptography code.
-
-The current "canned" installations are as follows:
-
-Developer: Base ("bin") distribution, man pages, dictionary
- files, profiling libraries and the complete source tree.
-
-
-Kern-Developer: As above, but with only kernel sources instead of
- the complete source tree.
-
-
-User: The base distribution, man pages, dictionary files and
- the FreeBSD 1.x and 2.0 compatibility sets.
-
-
-Minimal: Only the base distribution.
-
-
-Everything: The base distribution, man pages, dictionary files,
- profiling libraries, the FreeBSD 1.x and the FreeBSD 2.0
- compatibility libraries, the complete source tree,
- games and your choice of XFree86 distribution components.
- N.B. Still no cryptocraphy source code!
-
-
-Custom: Allows you to modify or create your distribution set on
- a piece-by-piece basis.
-
-
-Reset: Clear all currently selected distributions.
-
-
----
-
-When using Custom, most of the sub-distribution choices are fairly
-obvious, though two possible exceptions may be the "commerce" and
-"xperimnt" distributions:
-
- * The "commerce" directory, as its name implies, is devoted to
- commercial offerings. This includes commercial products released
- under special arrangement, limited functionality demos, shareware
- products (you like it, you buy it), etc.
-
- At the time of this writing, there are unfortunately not enough
- commercial offerings to justify a fully split distribution set,
- so each product is available both as a subdirectory and as part
- of one large archive file. If you select "commerce" from the
- distributions submenus then you'll get the big file containing
- the entire collection copied to your hard disk. Don't do this
- unless you've got at least 10MB to devote to it!
-
-
- * The "xperimnt" directory contains, not surprisingly, experimental
- offerings. Unfinished (or work-in-progress) features, special
- purpose drivers and packages, strange proof-of-concept stuff,
- it's a mixed bag! Select this item on a distribution menu and
- you'll get the whole collection (between 10 and 30MB).
-
-
- If you're installing from CDROM then all of the commercial and
- "experimental" offerings are also easily available in their
- individual subdirectories and can be copied to hard disk at
- any time.
-
-
-You may also notice that certain distributions, like "des" and "krb",
-are marked "NOT FOR EXPORT!" This is because it's illegal to
-export them from the United States (or any other country which
-considers encryption technology to be on its restricted export
-list). Since breaking this law only gets the _originating_ site
-(US!) in trouble, please do not load these distributions from U.S.
-servers!
-
-A number of "foreign" servers do exist for the benefit of
-non-U.S. sites, one of which is "skeleton.mikom.csir.co.za".
-
-Please get all such export restricted software from there
-if you are outside the U.S., thanks!
diff --git a/release/sysinstall/help/en_US.ISO8859-1/drives.hlp b/release/sysinstall/help/en_US.ISO8859-1/drives.hlp
deleted file mode 100644
index d924f8d..0000000
--- a/release/sysinstall/help/en_US.ISO8859-1/drives.hlp
+++ /dev/null
@@ -1,28 +0,0 @@
-If you are going to actually install some portion of FreeBSD on a
-drive then PLEASE BE VERY CERTAIN that the Geometry reported in the
-Partition Editor (see Installation Menu) is the correct one for your
-drive and controller combination!
-
-IDE drives often have a certain geometry set during the PC BIOS setup,
-or (in the case of larger IDE drives) have their geometry "remapped"
-by either the IDE controller or a special boot-sector translation
-utility such as that by OnTrack Systems. In these cases, knowing
-the correct geometry gets even more complicated as it's not something
-you can easily tell by looking at the drive or the PC BIOS setup. The
-best way of verifying that your geometry is being correctly calculated
-in such situations is to boot DOS (from the hard disk, not a floppy!)
-and run the ``pfdisk'' utility provided in the tools/ subdirectory of the
-FreeBSD CDROM or FTP site. It will report the geometry that DOS sees,
-which is generally the correct one.
-
-If you have no DOS partition sharing the disk at all, then you may find that
-you have better luck with Geometry detection if you create a very small
-DOS partition first, before installing FreeBSD. Once FreeBSD is installed
-you can always delete it again if you need the space.
-
-It's actually not a bad idea (believe it or not) to have a small bootable
-DOS partition on your FreeBSD machine anyway: Should the machine become
-unstable or exhibit strange behavior at some point in the future (which
-is not uncommon behavior for PC hardware!) you can then at least use
-DOS for installing and running one of the commercially available system
-diagnostic utilities.
diff --git a/release/sysinstall/help/en_US.ISO8859-1/hardware.hlp b/release/sysinstall/help/en_US.ISO8859-1/hardware.hlp
deleted file mode 100644
index fba5633..0000000
--- a/release/sysinstall/help/en_US.ISO8859-1/hardware.hlp
+++ /dev/null
@@ -1,384 +0,0 @@
-Hardware Documentation Guide: $Id: hardware.hlp,v 1.11 1995/06/09 13:29:19 jkh Exp $
-
-Table of Contents
------------------
-
-0. Document Conventions
-1. Using UserConfig to change FreeBSD kernel settings
-2. Default Configuration (GENERIC kernel)
-3. LINT - other possible configurations.
-4. Known Hardware Problems.
-
-=========================================================================
-
-0. Document Conventions
--- --------------------
-
-We have `underlined' text which represents user input with `-'
-symbols throughout this document to differentiate it from
-the machine output.
-
-1. Using UserConfig to change FreeBSD kernel settings
--- --------------------------------------------------
-
-The UserConfig utility allows you to override various settings of
-the FreeBSD kernel before the system has booted. This allows you to
-make minor adjustments to the various drivers in the system without
-necessarily having to recompile the kernel.
-
-UserConfig is activated by specifying the `-c' flag at the initial
-boot prompt. For example:
-
- >> FreeBSD BOOT @ 0x10000: 640/7168 k of memory
- Use hd(1,a)/kernel to boot sd0 when wd0 is also installed.
- Usage: [[wd(0,a)]/kernel][-abcCdhrsv]
- Use ? for file list or press Enter for defaults
-
- Boot: -c
- --
-
-This command causes the system to boot the default kernel ("/kernel") and
-the UserConfig utility to be started once the kernel is loaded into memory.
-
-The `-c' flag follows any of the other parameters you may need to provide
-for the system to boot properly. For example, to boot off the second of
-two SCSI drives installed and run UserConfig, you would type:
-
- Boot: sd(1,a)/kernel -c
- -----------------
-
-As always, the kernel will report some information on your processor
-and how much memory your system has. Then UserConfig will be invoked
-and you will see the prompt:
-
- config>
-
-To see the list of commands that UserConfig accepts, you may type '?' and
-press [ENTER]. The help message looks something like this:
-
-Command Description
-------- -----------
-attach <devname> Return results of device attach
-ls List currently configured devices
-port <devname> <addr> Set device port (i/o address)
-irq <devname> <number> Set device irq
-drq <devname> <number> Set device drq (DMA Request)
-iomem <devname> <addr> Set device maddr (memory address)
-iosize <devname> <size> Set device memory size
-flags <devname> <mask> Set device flags
-enable <devname> Enable device
-probe <devname> Return results of device probe
-disable <devname> Disable device (will not be probed)
-quit Exit this configuration utility
-help This message
-
-
-You may alter nearly all of the default settings present in the FreeBSD
-generic kernel. This includes reassigning IRQs, disabling troublesome
-devices (or drivers that conflict with the hardware your system has),
-setting special device flags, etc.
-
-The most common use of UserConfig is to adjust or disable a driver
-which is causing trouble. The "ls" command displays the current
-settings for all the drivers present in the booted kernel, and
-once you have located an entry of interest you may use the displayed
-device name to change its settings or even disable the driver completely.
-
-For example, to change the memory address of network adapter 'ed0' to
-the address 0xd4000, you would type
-
- config> iomem ed0 0xd4000
- -----------------
-
-To entirely disable a device driver you are not using, use the
-"disable" command. In this example, you would disable device
-`ie0' by typing:
-
- config> disable ie0
- -----------
-
-You can use the "ls" command to verify your changes and correct
-any other problems before continuing the boot process.
-
-Once you are happy with a given configuration you may type: "quit"
-
-This will cause the kernel to boot with the new settings you
-have chosen.
-
-Once you have a fully installed system (e.g. the `bin' distribution
-has been successfully extracted), any changes you make in UserConfig
-are permanently stored in the `/kernel' file on the root filesystem.
-This action is performed by the `dset' utility, which will ensure that
-these settings remain in effect until you replace the kernel with
-a new one. If you do not want your changes to be permanently
-stored like this, remove `dset' from the /etc/rc file before you
-make any changes.
-
-If you accidentally change a setting for a device that you did not mean
-to change, the safest thing to do is to reset the computer and start
-over. Do not allow the boot to proceed (e.g. do not type "quit") with
-bad settings as these may be permanently stored by dset and
-leave your system in a state where it will no longer run properly.
-
-We suggest as a general rule that you disable any drivers that are not
-used by your particular hardware configuration. There are known problems
-with certain device drivers (see section 4.0) that can cause conflicts
-with other devices if they're also not disabled. You should move or
-disable any device that resides at the same port or IRQ as a device
-you actually have!
-
-You can also remove drivers that are not needed by building yourself a
-custom kernel that contains only the device drivers which your system
-really needs (see section 6.0 of the FreeBSD.FAQ). If your system has
-sufficient free disk space to store and compile the kernel sources,
-this is the option we most highly recommend.
-
-
-
-2. Default (GENERIC) Configuration
--- -------------------------------
-
-The following table contains a list of all of the devices that are present
-in the GENERIC kernel, which is the kernel (the operating system) that was
-placed on your computer during the FreeBSD installation process.
-(A compressed version of the GENERIC kernel is also used on the
-installation floppy diskettes.)
-
-The table describes the various parameters used by the driver to communicate
-with the hardware in your system. There are four parameters in the
-table, but not all are used by each device. They are:
-
- Port the starting I/O port used by the device, shown in hexadecimal.
-
- IOMem the lowest (or starting) memory address used by the device,
- also shown in hexadecimal.
-
- IRQ the interrupt the device uses to alert the driver to an event,
- given in decimal.
-
- DRQ the DMA (direct memory access) channel the device uses to move
- data to and from main memory, also given in decimal.
-
-If an entry in the table has `n/a' for the value, it means that the
-parameter does not apply to that device. A value of `dyn' means that the
-correct value should be determined automatically by the kernel when the
-system boots.
-
-
-FreeBSD GENERIC kernel:
-
- Port IRQ DRQ IOMem Description
- ---- --- --- ----- ---------------------------------
-fdc0 3f0 6 2 n/a Floppy disk controller
-wdc0 1f0 14 n/a n/a IDE/MFM/RLL disk controller
-wdc1 170 15 n/a n/a IDE/MFM/RLL disk controller
-
-ncr0 n/a n/a n/a n/a NCR PCI SCSI controller
-ahc0 n/a n/a n/a n/a Adaptec 294x PCI SCSI controller
-bt0 330 dyn dyn dyn Buslogic SCSI controller
-uha0 330 dyn 6 dyn Ultrastore 14f
-ahc1 dyn dyn dyn dyn Adaptec 274x/284x SCSI controller
-ahb0 dyn dyn dyn dyn Adaptec 174x SCSI controller
-aha0 330 dyn 5 dyn Adaptec 154x SCSI controller
-aic0 340 11 dyn dyn Adaptec 152x/AIC-6360 SCSI
- controller
-nca0 1f88 10 dyn dyn ProAudioSpectrum cards
-nca1 350 5 dyn dyn ProAudioSpectrum cards
-sea0 dyn 5 dyn c8000 Seagate ST01/02 8 bit controller
-
-wt0 300 5 1 dyn Wangtek and Archive QIC-02/QIC-36
-
-mcd0 300 10 n/a n/a Mitsumi CD-ROM
-mcd1 340 11 n/a n/a Mitsumi CD-ROM
-
-matcd0 dyn n/a n/a n/a Matsushita/Panasonic CD-ROM
-
-scd0 230 n/a n/a n/a Sony CD-ROM
-
-sio0 3f8 4 n/a n/a Serial Port 0 (COM1)
-sio1 2f8 3 n/a n/a Serial Port 1 (COM2)
-sio2 3e8 5 n/a n/a Serial Port 2 (COM3)
-sio3 2e8 9 n/a n/a Serial Port 3 (COM4)
-
-lpt0 dyn 7 n/a n/a Printer Port 0
-lpt1 dyn dyn n/a n/a Printer Port 1
-lpt2 dyn dyn n/a n/a Printer Port 2
-
-de0 DEC DC21x40 PCI based cards
- (including 21140 100bT cards)
-ed0 280 5 dyn d8000 WD & SMC 80xx; Novell NE1000 &
- NE2000; 3Com 3C503
-ed1 300 5 dyn d8000 Same as ed0
-eg0 310 5 dyn dyn 3Com 3C505
-ep0 300 10 dyn dyn 3Com 3C509
-ie0 360 7 dyn d0000 AT&T StarLAN 10 and EN100;
- 3Com 3C507; NI5210
-ix0 300 10 dyn d0000 Intel EtherExpress cards
-le0 300 5 dyn d0000 Digital Equipment EtherWorks
- 2 and EtherWorks 3
-lnc0 280 10 n/a dyn Lance/PCnet cards
- (Isolan, Novell NE2100, NE32-VL)
-lnc1 300 10 n/a dyn See lnc0
-ze0 300 5 dyn d8000 IBM/National Semiconductor
- PCMCIA Ethernet Controller
-zp0 300 10 dyn d8000 3Com PCMCIA Etherlink III
- Ethernet Controller
---- End of table ---
-
-
-If the hardware in your computer is not set to the same settings as
-those shown in this table and the item is not marked 'dyn', you will
-have to either reconfigure your hardware, or use UserConfig ('-c' boot
-option) to reconfigure the kernel to match the way your hardware is
-currently set (see section 1.0).
-
-If the settings do not match, the kernel may be unable to locate
-or reliably access the devices in your system.
-
-
-
-3. LINT - other possible configurations
--- ------------------------------------
-
-The following drivers are not in the GENERIC kernel but remain
-available to those who do not mind compiling a custom kernel (see
-section 6 of FreeBSD.FAQ). The LINT configuration file
-(/sys/i386/conf/LINT) also contains prototype entries for just about
-every device supported by FreeBSD and is a good general reference.
-
-The device names and a short description of each are listed below. The port
-numbers, etc, are not meaningful here since you will need to compile a
-custom kernel to gain access to these devices anyway and can thus
-adjust the addresses to match the hardware in your computer in the process.
-The LINT file contains prototype entries for all of the below which you
-can easily cut-and-paste into your own file (or simply copy LINT and edit
-it to taste):
-
-apm: Laptop Advanced Power Management (experimental)
-ctx: Cortex-I frame grabber
-cx: Cronyx/Sigma multiport sync/async
-cy: Cyclades high-speed serial driver
-el: 3Com 3C501
-fe: Fujitsu MB86960A/MB86965A Ethernet cards
-fea: DEV DEFEA EISA FDDI adater
-fpa: DEC DEFPA PCI FDDI adapter
-gp: National Instruments AT-GPIB and AT-GPIB/TNT board
-gsc: Genius GS-4500 hand scanner
-gus: Gravis Ultrasound - Ultrasound, Ultrasound 16, Ultrasound MAX
-gusmax: Gravis Ultrasound MAX (currently broken)
-gusxvi: Gravis Ultrasound 16-bit PCM
-joy: Joystick
-labpc: National Instrument's Lab-PC and Lab-PC+
-mpu: Roland MPU-401 stand-alone card
-mse: Logitech & ATI InPort bus mouse ports
-mss: Microsoft Sound System
-nic: Dr Neuhaus NICCY 3008, 3009 & 5000 ISDN cards
-opl: Yamaha OPL-2 and OPL-3 FM - SB, SB Pro, SB 16, ProAudioSpectrum
-pas: ProAudioSpectrum PCM and MIDI
-pca: PCM audio ("/dev/audio") through your PC speaker
-psm: PS/2 mouse port
-rc: RISCom/8 multiport card
-sb: SoundBlaster PCM - SoundBlaster, SB Pro, SB16, ProAudioSpectrum
-sbmidi: SoundBlaster 16 MIDI interface
-sbxvi: SoundBlaster 16
-spigot: Create Labs Video Spigot video-acquisition board
-uart: Stand-alone 6850 UART for MIDI
-wds: Western Digital WD7000 IDE
-
---- end of list ---
-
-
-4. Known Hardware Problems, Q & A:
--- -------------------------------
-
-Q: mcd0 keeps thinking that it has found a device and this stops my Intel
- EtherExpress card from working.
-
-A: Use the UserConfig utility (see section 1.0) and disable the probing of
- the mcd0 and mcd1 devices. Generally speaking, you should only leave
- the devices that you will be using enabled in your kernel.
-
-
-Q: The system finds my ed network card, but I keep getting device
- timeout errors.
-
-A: Your card is probably on a different IRQ from what is specified in the
- kernel configuration. The ed driver will no longer use the `soft'
- configuration by default (values entered using EZSETUP in DOS), but it
- will use the software configuration if you specify `?' in the IRQ field
- of your kernel config file. The reason for the change is because the
- ed driver used to read and try to use the soft configuration information
- even when the card was jumpered to use a hard configuration, and this
- caused problems.
-
- Either move the jumper on the card to a hard configuration setting
- (altering the kernel settings if necessary), or specify the IRQ as
- `-1' in UserConfig or `?' in your kernel config file. This will
- tell the kernel to use the soft configuration.
-
- Another possibility is that your card is at IRQ 9, which is shared
- by IRQ 2 and frequently a cause of problems (especially when you
- have a VGA card using 2! :). You should not use IRQ 2 or 9 if at
- all possible.
-
-
-Q: I go to boot from the hard disk for the first time after installing
- FreeBSD, but the Boot Manager prompt just prints `F?' at the boot menu
- each time but the boot won't go any further.
-
-A: The hard disk geometry was set incorrectly in the Partition editor when
- you installed FreeBSD. Go back into the partition editor and specify
- the actual geometry of your hard disk. You must reinstall FreeBSD
- again from the beginning with the correct geometry.
-
- If you are failing entirely in figuring out the correct geometry for
- your machine, here's a tip: Install a small DOS partition at the
- beginning of the disk and install FreeBSD after that. The install
- program will see the DOS partition and try to infer the correct
- geometry from it, which usually works.
-
-
-Q: I have a Matsushita/Panasonic CD-ROM drive but it isn't recognized
- by the system, even if I use UserConfig to change the Port address to
- 630, which is what my card uses.
-
-A: Not all of the companies that sell the Matsushita/Panasonic CR-562
- and CR-563 drives use the same I/O ports and interface that the
- matcd driver in FreeBSD expects. The only adapters that are supported
- at this time are those that are 100% compatible with the Creative
- Labs (SoundBlaster) host interface. See matcd.4 documentation for a
- list of host adapters that are known to work.
-
-
-Q: I'm trying to install from a tape drive but all I get is something like:
- st0(aha0:1:0) NOT READY csi 40,0,0,0
- on the screen. Help!
-
-A: There's a limitation in the current sysinstall that the tape MUST
- be in the drive while sysinstall is started or it won't be detected.
- Try again with the tape in the drive the whole time.
-
-
-Q: I've installed FreeBSD onto my system, but it hangs when booting from
- the hard drive with the message: ``Changing root to /dev/sd0a''.
-
-A: This problem may occur in a system with a 3com 3c509 ethernet adaptor.
- The ep0 device driver appears to be sensitive to probes for other
- devices that also use address 0x300. Boot your FreeBSD system by power
- cycling the machine (turn off and on). At the ``Boot:'' prompt specify
- the ``-c''. This will invoke UserConfig (see Section 1. above). Use
- the ``disable'' command to disable the device probes for all devices
- at address 0x300 except the ep0 driver. On exit, your machine should
- successfully boot FreeBSD.
-
-
-Q: My system hangs during boot, right after the "fd0: [my floppy drive]"
- line.
-
-A: This is not actually a hang, simply a very LONG "wdc0" probe that
- often takes a long time to complete on certain systems (where there
- usually _isn't_ a WD controller). Be patient, your system will boot!
- To eliminate the problem, boot with the -c flag and eliminate the wdc0
- device, or compile a custom kernel.
-
-[ Please add more hardware tips to this Q&A section! ]
diff --git a/release/sysinstall/help/en_US.ISO8859-1/install.hlp b/release/sysinstall/help/en_US.ISO8859-1/install.hlp
deleted file mode 100644
index 945c81b..0000000
--- a/release/sysinstall/help/en_US.ISO8859-1/install.hlp
+++ /dev/null
@@ -1,447 +0,0 @@
- INSTALLATION GUIDE FOR FreeBSD 2.0.5
-
-This manual documents the process of installing FreeBSD on your
-machine. Please also see the Hardware Guide for hardware-specific
-installation instructions (how to configure your hardware, what sorts
-of things to watch out for, etc) before starting a new installation.
-
-
-Table of Contents:
-==================
-
-1.0 DOS User's Q&A section.
- 1.1 How do I make space for FreeBSD?
- 1.2 Can I use compressed DOS filesystems from FreeBSD?
- 1.3 Can I use DOS extended partitions?
- 1.4 Can I run DOS executables under FreeBSD?
-
-2.0 Preparing for the installation.
- 2.1 Before installing from CDROM
- 2.2 Before installing from Floppy
- 2.3 Before installing from a DOS partition
- 2.4 Before installing from QIC/SCSI tape
- 2.5 Before installing over a network
- 2.5.1 Preparing for NFS Installation
- 2.5.2 Preparing for FTP Installation
-
-3.0 Installing FreeBSD.
-
-
-
-1.0 DOS user's Question and Answer section
-=== ======================================
-
-1.1 Help! I have no space! Do I need to delete everything first?
-
-If your machine is already running DOS and has little or no free space
-available for FreeBSD's installation, all is not lost! You may find
-the "FIPS" utility, provided in the tools/ subdirectory on the FreeBSD
-CDROM or on the various FreeBSD ftp sites, to be quite useful.
-
-FIPS allows you to split an existing DOS partition into two pieces,
-preserving the original partition and allowing you to install onto the
-second free piece. You first "defrag" your DOS partition, using the
-DOS 6.xx "DEFRAG" utility or the Norton Disk tools, then run FIPS. It
-will prompt you for the rest of the information it needs. Afterwards,
-you can reboot and install FreeBSD on the new free slice. See the
-Distributions menu for an estimation of how much free space you'll
-need for the kind of installation you want.
-
-
-1.2 Can I use compressed DOS filesystems from FreeBSD?
-
-No. If you are using a utility such as Stacker(tm) or DoubleSpace(tm),
-FreeBSD will only be able to use whatever portion of the filesystem
-you leave uncompressed. The rest of the filesystem will show up as
-one large file (the stacked/dblspaced file!). DO NOT REMOVE THAT
-FILE! You will probably regret it greatly!
-
-It is probably better to create another uncompressed DOS primary
-partition and use this for communications between DOS and FreeBSD.
-
-
-1.3 Can I mount my DOS extended partitions?
-
-This feature isn't in FreeBSD 2.0.5 but should be in 2.1. We've laid
-all the groundwork for making this happen, now we just need to do the
-last 1% of the work involved.
-
-
-1.4 Can I run DOS binaries under FreeBSD?
-
-Not yet! We'd like to add support for this someday, but are still
-lacking anyone to actually do the work. Ongoing work with Linux's
-DOSEMU utility may bring this much closer to being a reality sometime
-soon. Send mail to hackers@freebsd.org if you're interested in
-joining this effort!
-
-However, there is a neat utility called "pcemu" in the ports collection
-which emulates an 8088 and enough BIOS services to run DOS text mode
-applications. It requires the X Window System (provided as
-XFree86 3.1.1u1).
-
-
-
-2.0 Preparing for the installation
-=== ==============================
-
-2.1 Before installing from CDROM:
-
-If your CDROM is of an unsupported type, such as an IDE CDROM, then
-please skip to section 2.3: Before installing from a DOS partition.
-
-There is not a lot of preparatory work that needs to be done to
-successfully install from one of Walnut Creek's FreeBSD CDROMs (other
-CDROM distributions may work as well, we simply cannot say as we
-have no hand or say in their creation). You can either boot into the
-CD installation directly from DOS using Walnut Creek's supplied
-``install.bat'' batch file or you can make a boot floppy with
-the ``makeflp.bat'' command.
-
-For the easiest interface of all (from DOS), type "go". This
-will bring up a DOS menu utility that leads you through all
-the available options.
-
-If you're creating the boot floppy from a UNIX machine, you may find
-that ``dd if=floppies/boot.flp of=/dev/rfd0'' or
-``dd if=floppies/boot.flp of=/dev/floppy'' works well, depending on
-your hardware and operating system environment.
-
-Once you've booted from DOS or floppy, you should then be able to select
-CDROM as the media type in the Media menu and load the entire
-distribution from CDROM. No other types of installation media should
-be required.
-
-After your system is fully installed and you have rebooted from the
-hard disk, you should find the CD mounted on the directory /cdrom. A
-utility called `lndir' comes with the XFree86 distribution which you
-may also find useful: It allows you to create "link tree" directories
-to things on Read-Only media like CDROM. One example might be
-something like this:
-
- mkdir /usr/ports
- lndir /cdrom/ports /usr/ports
-
-Which would allow you to then "cd /usr/ports; make" and get all the
-sources from the CD, but yet create all the intermediate files in
-/usr/ports, which is presumably on a more writable media! :-)
-
-SPECIAL NOTE: Before invoking the installation, be sure that the
-CDROM is in the drive so that the "probe" can find it!
-This is also true if you wish the CDROM to be added to the default
-system configuration automatically during the install (whether or
-not you actually use it as the installation media). This will be
-fixed for 2.1, but for now this simple work-around will ensure that
-your CDROM is detected properly.
-
-Finally, if you would like people to be able to FTP install
-FreeBSD directly from the CDROM in your machine, you'll find
-it quite easy. After the machine is fully installed, you simply
-need to add the following line to the password file (using
-the vipw command):
-
- ftp:*:99:99::0:0:FTP:/cdrom:/nonexistent
-
-No further work is necessary. The other installers will now be able
-to chose a Media type of FTP and type in: ftp://<your machine>
-after picking "Other" in the ftp sites menu!
-
-
-2.2 Before installing from Floppy:
-
-If you must install from floppy disks, either due to unsupported
-hardware or just because you enjoy doing things the hard way, you must
-first prepare some floppies for the install.
-
-The first floppy you'll need is ``floppies/root.flp'', which is
-somewhat special in that it's not a DOS filesystem floppy at all, but
-rather an "image" floppy (it's actually a gzip'd cpio file). You can
-use the rawrite.exe program to do this under DOS, or ``dd'' to do it
-on a UNIX Workstation (see notes in section 2.1 concerning the
-``floppies/boot.flp'' image). Once this floppy is made, go on
-to make the distribution set floppies:
-
-You will need, at minimum, as many 1.44MB or 1.2MB floppies as it takes
-to hold all files in the bin (binary distribution) directory. THESE
-floppies *must* be formatted using MS-DOS, using the FORMAT command in
-MS-DOS or the File Manager format command in Microsoft Windows(tm).
-Don't trust Factory Preformatted floppies! Format them again yourself,
-just to make sure!
-
-Many problems reported by our users in the past have resulted from the
-use of improperly formatted media, so we simply take special care to
-mention it here!
-
-After you've DOS formatted the floppies, you'll need to copy the files
-onto them. The distribution files are split into chunks conveniently
-sized so that 5 of them will fit on a conventional 1.44MB floppy. Go
-through all your floppies, packing as many files as will fit on each
-one, until you've got all the distributions you want packed up in this
-fashion. Each distribution should go into a subdirectory on the
-floppy, e.g.: a:\bin\bin.aa, a:\bin\bin.ab, ...
-
-Once you come to the Media screen of the install, select
-"Floppy" and you'll be prompted for the rest.
-
-
-2.3 Before installing from a DOS partition:
-
-To prepare for installation from an MS-DOS partition you should
-simply copy the files from the distribution into a directory called
-"FREEBSD". For example, to do a minimal installation of FreeBSD from
-DOS using files copied from the CDROM, you might do something like
-this:
-
- C> MD C:\FREEBSD
- C> XCOPY /S E:\DISTS\BIN C:\FREEBSD
- C> XCOPY /S E:\FLOPPIES C:\FREEBSD
-
-Asssuming that `C:' was where you had free space and `E:' was where
-your CD was mounted. Note that you need the FLOPPIES directory
-because the `root.flp' image is automatically looked for there when
-you're doing a DOS installation.
-
-For as many `DISTS' as you wish to install from DOS (and you have free
-space for), install each one under `C:\FREEBSD' - the BIN dist is only
-the minimal requirement.
-
-
-2.4 Before installing from QIC/SCSI Tape:
-
-Installing from tape is probably the easiest method, short of an
-on-line install using FTP or a CDROM install. The installation program
-expects the files to be simply tar'ed onto the tape, so after getting
-all of the files for distribution you're interested in, simply tar
-them onto the tape with a command like:
-
- cd /freebsd/distdir
- tar cvf /dev/rwt0 (or /dev/rst0) dist1 .. dist2
-
-Make sure that the `floppies/' directory is one of the "dists" given
-above, since the installation will look for `floppies/root.flp' on
-the tape.
-
-When you go to do the installation, you should also make sure that you
-leave enough room in some temporary directory (which you'll be allowed
-to choose) to accommodate the FULL contents of the tape you've
-created. Due to the non-random access nature of tapes, this method of
-installation requires quite a bit of temporary storage! You should
-expect to require as much temporary storage as you have stuff written
-on tape.
-
-SPECIAL NOTE: When going to do the installation, the tape must be in
-the drive *before* booting from the boot floppy. The installation
-"probe" may otherwise fail to find it.
-
-
-2.5 Before installing over a network:
-
-You can do network installations over 3 types of communications links:
-
- Serial port: SLIP / PPP
- Parallel port: PLIP (laplink cable)
- Ethernet: A standard ethernet controller (includes some PCMCIA).
-
-SLIP support is rather primitive, and limited primarily to hard-wired
-links, such as a serial cable running between a laptop computer and
-another computer. The link should be hard-wired as the SLIP
-installation doesn't currently offer a dialing capability; that
-facility is provided with the PPP utility, which should be used in
-preference to SLIP whenever possible.
-
-If you're using a modem, then PPP is almost certainly your only
-choice. Make sure that you have your service provider's information
-handy as you'll need to know it fairly soon in the installation
-process. You will need to know, at the minimum, your service
-provider's IP address and possibly your own (though you can also leave
-it blank and allow PPP to negotiate it with your ISP). You also need
-to know how to use the various "AT commands" to dial the ISP with your
-particular modem as the PPP dialer provides only a very simple
-terminal emulator.
-
-If a hard-wired connection to another FreeBSD (2.0R or later) machine
-is available, you might also consider installing over a "laplink"
-parallel port cable. The data rate over the parallel port is much
-higher than what is typically possible over a serial line (up to
-50k/sec), thus resulting in a quicker installation.
-
-Finally, for the fastest possible network installation, an ethernet
-adaptor is always a good choice! FreeBSD supports most common PC
-ethernet cards, a table of supported cards (and their required
-settings) is provided as part of the FreeBSD Hardware Guide - see the
-Documentation menu on the boot floppy. If you are using one of the
-supported PCMCIA ethernet cards, also be sure that it's plugged in
-_before_ the laptop is powered on! FreeBSD does not, unfortunately,
-currently support "hot insertion" of PCMCIA cards.
-
-You will also need to know your IP address on the network, the
-"netmask" value for your address class, and the name of your machine.
-Your system administrator can tell you which values to use for your
-particular network setup. If you will be referring to other hosts by
-name rather than IP address, you'll also need a name server and
-possibly the address of a gateway (if you're using PPP, it's your
-provider's IP address) to use in talking to it. If you do not know
-the answers to all or most of these questions, then you should
-really probably talk to your system administrator _first_ before
-trying this type of installation!
-
-Once you have a network link of some sort working, the installation
-can continue over NFS or FTP.
-
-2.5.1 Preparing for NFS installation:
-
- NFS installation is fairly straight-forward: Simply copy the
- FreeBSD distribution files you want onto a server somewhere
- and then point the NFS media selection at it.
-
- If this server supports only "privileged port" access (as is
- generally the default for Sun workstations), you will need to set
- this option in the Options menu before installation can proceed.
-
- If you have a poor quality ethernet card which suffers from very
- slow transfer rates, you may also wish to toggle the appropriate
- Options flag.
-
- In order for NFS installation to work, the server must support
- "subdir mounts"; e.g., if your FreeBSD 2.0.5 distribution directory
- lives on: ziggy:/usr/archive/stuff/FreeBSD
- Then ziggy will have to allow the direct mounting of
- /usr/archive/stuff/FreeBSD, not just /usr or /usr/archive/stuff.
-
- In FreeBSD's /etc/exports file, this is controlled by the
- ``-alldirs'' option. Other NFS servers may have different
- conventions. If you are getting `Permission Denied' messages
- from the server then it's likely that you don't have this
- enabled properly!
-
-
-2.5.2 Preparing for FTP Installation
-
- FTP installation may be done from any mirror site containing a
- reasonably up-to-date version of FreeBSD 2.0.5. A full menu of
- reasonable choices from almost anywhere in the world is provided
- by the FTP site menu.
-
- If you are installing from some other FTP site not listed in this
- menu, or you are having troubles getting your name server configured
- properly, you can also specify your own URL by selecting the ``Other''
- choice in that menu. A URL can also be a direct IP address, so
- the following would work in the absence of a name server:
-
- ftp://192.216.222.4/pub/FreeBSD/2.0.5-RELEASE
-
- [Substitute "ALPHA" for "RELEASE" during the ALPHA test period!]
-
- If you are installing through a firewall then you should probably
- select ``Passive mode'' ftp, which is the default. If you are
- talking to a server which does not support passive mode for some
- reason, see the Options menu to select Active mode transfers.
-
-
-3. Installing FreeBSD
--- ------------------
-
-Once you've taken note of the appropriate preinstallation steps, you
-should be able to install FreeBSD without any further trouble.
-
-Should this not be true, then you may wish to go back and re-read the
-relevant preparation section (section 2.x) for the installation media
-type you're trying to use - perhaps there's a helpful hint there that
-you missed the first time? If you're having hardware trouble, or
-FreeBSD refuses to boot at all, read the Hardware Guide provided on
-the boot floppy for a list of possible solutions.
-
-The FreeBSD boot floppy contains all the on-line documentation you
-should need to be able to navigate through an installation and if it
-doesn't then I'd like to know what you found most confusing! It is
-the objective of the FreeBSD installation program (sysinstall) to be
-self-documenting enough that painful "step-by-step" guides are no
-longer necessary. It may take us a little while to reach that
-objective, but that's the objective!
-
-Meanwhile, you may also find the following "typical installation sequence"
-to be helpful:
-
-o Boot the boot floppy. After a boot sequence which can take
- anywhere from from 30 seconds to 3 minutes, depending on your
- hardware, you should be presented with a menu of initial
- choices. If the floppy doesn't boot at all, or the boot
- hangs at some stage, go read the Q&A section of the Hardware
- Guide for possible causes.
-
-o Press F1. You should see some basic usage instructions on
- the menu system and general navigation. If you haven't used this
- menu system before then PLEASE read this thoroughly!
-
-o If English is not your native language, you may wish to proceed
- directly to the Language option and set your preferred language.
- This will bring up some of the documentation in that language
- instead of english.
-
-o Select the Options item and set any special preferences you
- may have.
-
-o Select Proceed, bringing you to the Installation Menu.
-
-Installation Menu:
-
-o You can do anything you like in this menu without altering
- your system _except_ for "Commit", which will perform any
- requests to alter your system you may have made.
-
- If you're confused at any point, the F1 key usually pulls
- up the right information for the screen you're in.
-
- o The first step is generally `Partition', which allows
- you to chose how your drives will be used for FreeBSD.
-
- o Next, with the `Label' editor, you can specify how the space
- in any allocated FreeBSD partitions should be used by FreeBSD,
- or where to mount a non-FreeBSD partition (such as DOS).
-
- o Next, the `Distributions' menu allows you to specify which
- parts of FreeBSD you wish to load. A good choice is
- "User" for a small system or "Developer" for someone
- wanting a bit more out of FreeBSD. If none of the existing
- collections sound applicable, select Custom.
-
- o Next, the `Media' menu allows you to specify what kind of
- media you wish to install from. If a desired media choice is
- found and configured automatically then this menu will simply
- return, otherwise you'll be asked for additional details on
- the media device type.
-
- o Finally, the Commit command will actually perform all the
- actions at once (nothing has been written to your disk
- so far, nor will it until you give the final confirmation).
- All new or changed partition information will be written
- out, file systems will be created and/or non-destructively
- labelled (depending on how you set their newfs flags in the
- Label editor) and all selected distributions will be
- extracted.
-
- o The Configure menu choice allows you to furthur configure your
- FreeBSD installation by giving you menu-driven access to
- various system defaults. Some items, like networking, may
- be especially important if you did a CDROM/Tape/Floppy
- installation and have not yet configured your network
- interfaces (assuming you have some). Properly configuring
- your network here will allow FreeBSD to come up on the network
- when you first reboot from the hard disk.
-
- o Exit returns you to the top menu.
-
-
- At this point, you're generally done with the sysinstall utility and
-can select the final `Quit'. If you're running it as an installer
-(e.g., before the system is all the way up) then the system will now
-reboot. If you selected the boot manager option, you will see a small
-boot menu with an `F?' prompt. Press the function key for BSD (it
-will be shown) and you should boot up into FreeBSD off the hard disk.
-
- If this fails to happen for some reason, see the Q & A section
-of the Hardware Guide for possible clues!
-
- Jordan
-
----- End of Installation Guide ---
diff --git a/release/sysinstall/help/en_US.ISO8859-1/language.hlp b/release/sysinstall/help/en_US.ISO8859-1/language.hlp
deleted file mode 100644
index 23f176b..0000000
--- a/release/sysinstall/help/en_US.ISO8859-1/language.hlp
+++ /dev/null
@@ -1,14 +0,0 @@
-Use this menu to select your preferred language. For now, this only
-sets the default language in which various help files are displayed.
-
-In later releases this will also change the keyboard layout, screen
-map, NLS settings (sysinstall itself will also use message catalogs so
-that all menus are in the appropriate language) and implement other
-I18N features to meet various standards.
-
-Until these improvements are made, you may find it easier to simply
-edit the /etc/sysconfig file yourself once the system is fully
-installed. There are a number of comments in that file that detail
-just what should be changed, as well as a few examples of existing
-non-english setups.
-
diff --git a/release/sysinstall/help/en_US.ISO8859-1/media.hlp b/release/sysinstall/help/en_US.ISO8859-1/media.hlp
deleted file mode 100644
index 8b081bc..0000000
--- a/release/sysinstall/help/en_US.ISO8859-1/media.hlp
+++ /dev/null
@@ -1,29 +0,0 @@
-You can install from the following types of media:
-
- CDROM - requires one of the following supported CDROM drives:
-
- Sony CDU 31/33A
- Matushita/Panasonic "Sound Blaster" CDROM.
- Mitsumi FX-001{A-D} (older non-IDE drives).
- SCSI - Any standard SCSI CDROM drive hooked to
- a supported controller (see Hardware Guide).
-
- DOS - A DOS primary partition with the required FreeBSD
- distribution files copied onto it (e.g. C:\FREEBSD\)
-
- FS - Assuming a disk or partition with an existing
- FreeBSD file system and distribution set on it,
- get the distribution files from there.
-
- Floppy - Get distribution files from one or more DOS formatted
- floppies.
-
- FTP - Get the distribution files from an anonymous ftp server
- (you will be presented with a list).
-
- NFS - Get the distribution files from an NFS server somewhere
- (make sure that permissions on the server allow this!)
-
- Tape - Extract distribution files from tape into a temporary
- directory and install from there.
-
diff --git a/release/sysinstall/help/en_US.ISO8859-1/network_device.hlp b/release/sysinstall/help/en_US.ISO8859-1/network_device.hlp
deleted file mode 100644
index 95c42ae..0000000
--- a/release/sysinstall/help/en_US.ISO8859-1/network_device.hlp
+++ /dev/null
@@ -1,54 +0,0 @@
-You can do network installations over 3 types of communications links:
-
- Serial port: SLIP / PPP
- Parallel port: PLIP (laplink cable)
- Ethernet: A standard ethernet controller (includes some PCMCIA).
-
-SLIP support is rather primitive and limited primarily to hard-wired
-links, such as a serial cable running between a laptop computer and
-another PC. The link must be hard-wired as the SLIP installation
-doesn't currently offer a dialing capability; that facility is provided
-with the PPP utility, which should be used in preference to SLIP
-whenever possible. When you choose a serial port device, you'll
-be given the option later to edit the slattach command before it's
-run on the serial line. It is expected that you'll run slattach
-(or some equivalent) on the other end of the link at this time and
-bring up the line. FreeBSD will then install itself over the link
-at speeds of up to 115.2K/baud (the recommended speed for a hardwired
-cable).
-
-If you're using a modem then PPP is almost certainly your only
-choice. Make sure that you have your service provider's information
-handy as you'll need to know it fairly early in the installation
-process. You will need to know, at the minimum, your service
-provider's IP address and possibly your own (though you can also leave
-it blank and allow PPP to negotiate it with your ISP). You will also
-need to know how to use the various "AT commands" to dial the ISP with
-your particular brand of modem as the PPP dialer provides only a very
-simple terminal emulator and has no "modem capabilities database".
-
-If a hard-wired connection to another FreeBSD (2.0R or later) machine
-is available, you might also consider installing over a "laplink"
-parallel port cable. The data rate over the parallel port is much
-higher than what is typically possible over a serial line with
-speeds of up to 50k/sec.
-
-Finally, for the fastest possible network installation, an ethernet
-adaptor is always a good choice! FreeBSD supports most common PC
-ethernet cards, a table of which is provided in the FreeBSD
-Hardware Guide (see the Documentation menu on the boot floppy).
-If you are using one of the supported PCMCIA ethernet cards, also be
-sure that it's plugged in _before_ the laptop is powered on! FreeBSD
-does not, unfortunately, currently support "hot insertion" of PCMCIA
-cards.
-
-You will also need to know your IP address on the network, the "netmask"
-value for your address class, and the name of your machine.
-Your system administrator can tell you which values to use for your
-particular network setup. If you will be referring to other hosts by
-name rather than IP address, you'll also need a name server and
-possibly the address of a gateway (if you're using PPP, it's your
-provider's IP address) to use in talking to it. If you do not know
-the answers to all or most of these questions, then you should
-really probably talk to your system administrator _first_ before
-trying this type of installation!
diff --git a/release/sysinstall/help/en_US.ISO8859-1/options.hlp b/release/sysinstall/help/en_US.ISO8859-1/options.hlp
deleted file mode 100644
index c30180c..0000000
--- a/release/sysinstall/help/en_US.ISO8859-1/options.hlp
+++ /dev/null
@@ -1,95 +0,0 @@
-The following options may be set from this screen:
-
-NFS Secure: NFS server talks only on a secure port
-
- This is most commonly used when talking to Sun workstations, which
- will not talk NFS over "non priviledged" ports.
-
-
-NFS Slow: User is using a slow PC or ethernet card
-
- Use this option if you have a slow PC (386) or an ethernet card
- with poor performance being "fed" by NFS on a higher-performance
- workstation. This will throttle the workstation back to prevent
- the PC from becoming swamped with data.
-
-
-FTP Abort: On transfer failure, abort
-
- This is pretty self-explanatory. If you're transfering from a
- host that drops the connection or cannot provide a file, abort
- the installation of that piece.
-
-
-FTP Reselect: On transfer failure, ask for another host
-
- This is more useful to someone doing an interactive installation.
- If the current host stops working, ask for a new ftp server to
- resume the installation from. The install will attempt to pick
- up from where it left off on the other server, if at all possible.
-
-
-FTP Active: Use "active mode" for standard FTP
-
- For all FTP transfers, use "Active" mode. This will not work
- through firewalls, but will often work with older ftp servers
- that do not support passive mode. If your connection hangs
- with passive mode (the default), try active!
-
-
-FTP Passive: Use "passive mode" for firewalled FTP
-
- For all FTP transfers, use "Passive" mode. This allows the user
- to pass through firewalls that do not allow incoming connections
- on random port addresses.
-
- NOTE: ACTIVE AND PASSIVE MODES ARE NOT THE SAME AS A `PROXY'
- CONNECTION, WHERE A PROXY FTP SERVER IS LISTENING ON A DIFFERENT
- PORT!
-
- In such situations, you should specify the URL as something like:
-
- ftp://foo.bar.com:1234/pub/FreeBSD
-
- Where "1234" is the port number of the proxy ftp server.
-
-
-Debugging: Turn on the extra debugging flag
-
- This turns on a lot of extra noise over on the second screen
- (ALT-F2 to see it, ALT-F1 to switch back). If your installation
- should fail for any reason, PLEASE turn this flag on when
- attempting to reproduce the problem. It will provide a lot of
- extra debugging at the failure point and may be very helpful to
- the developers in tracking such problems down!
-
-
-Yes To All: Assume "Yes" answers to all non-critical dialogs
-
- This flag should be used with caution. It will essentially
- decide NOT to ask the user about any "boundry" conditions that
- might not constitute actual errors but may be warnings indicative
- of other problems.
-
-
-FTP userpass: Specify username and password instead of anonymous.
-
- By default, the installation attempts to log in as the
- anonymous user. If you wish to log in as someone else,
- specify the username and password with this option.
-
-
-Clear: Clear All Option Flags
-
- Reset all option flags back to their default values.
-
-----
-
-Some of these items, like "FTP Active" or "FTP Passive", are actually
-mutually-exclusive even though you can turn all of them on or off at
-once. This is a limitation of the menuing system, and is compensated
-for by checks that ensure that the various flags are not in conflict.
-If you re-enter the Options menu again after leaving it, you'll see
-the settings it's actually using after checking for any possible
-conflicts.
-
diff --git a/release/sysinstall/help/en_US.ISO8859-1/partition.hlp b/release/sysinstall/help/en_US.ISO8859-1/partition.hlp
deleted file mode 100644
index fd16a45..0000000
--- a/release/sysinstall/help/en_US.ISO8859-1/partition.hlp
+++ /dev/null
@@ -1,77 +0,0 @@
-This is the FreeBSD DiskLabel Editor.
-
-If you're new to this installation, then you should first understand
-how FreeBSD 2.0.5's new "slices" paradigm for looking at disk storage
-works. It's not very hard to understand. A "fully qualified slice name",
-that is the name of the file we open in /dev to talk to the slice,
-is optionally broken into 3 parts:
-
- First you have the disk name. Assume we have two SCSI
- drives in our system, which gives us `sd0' and `sd1'.
-
- Next you have the "Slice" (or "FDISK Partition") number,
- as seen in the Partition Editor. Assume that our sd0 contains
- two slices, a FreeBSD slice and a DOS slice. This gives us
- sd0s1 and sd0s2. Let's also say that sd1 is completely devoted
- to FreeBSD, so we have only one slice there: sd1s1.
-
- Next, if a slice is a FreeBSD slice, you have a number of
- (confusingly named) "partitions" you can put inside of it.
- These FreeBSD partitions are where various filesystems or swap
- areas live, and using our hypothetical two-SCSI-disk machine
- again, we might have something like the following layout on sd0:
-
- Name Mountpoint
- ---- ----------
- sd0s1a /
- sd0s1b <swap space>
- sd0s1e /usr
-
- Because of historical convention, there is also a short-cut,
- or "compatibility slice", that is maintained for easy access
- to the first FreeBSD slice on a disk for those programs which
- still don't know how to deal with the new slice scheme.
- The compatibility slice names for our filesystem above would
- look like:
-
- Name Mountpoint
- ---- ----------
- sd0a /
- sd0b <swap space>
- sd0e /usr
-
- FreeBSD automatically maps the compatibility slice to the first
- FreeBSD slice it finds (in this case, sd0s1). You may have multiple
- FreeBSD slices on a drive, but only the first one may be the
- compatibility slice!
-
- The compatibility slice will eventually be phased out, but
- it is still important right now for several reasons:
-
- 1. Some programs, as mentioned before, still don't work
- with the slice paradigm and need time to catch up.
-
- 2. The FreeBSD boot blocks are unable to look for
- a root file system in anything but a compatibility
- slice right now. This means that our root will always
- show up on "sd0a" in the above scenario, even though
- it really lives over on sd0s1a and would otherwise be
- referred to by its full slice name.
-
-Once you understand all this, then the label editor becomes fairly
-simple. You're either carving up the FreeBSD slices displayed at the
-top of the screen into smaller pieces (displayed in the middle of the
-screen) and then putting FreeBSD file systems on them, Or you're just
-mounting existing partitions/slices into your filesystem hierarchy;
-this editor lets you do both. Since a DOS partition is also just
-another slice as far as FreeBSD is concerned, you can mount one into
-in your filesystem hierarchy just as easily with this editor. For
-FreeBSD partitions you can also toggle the "newfs" state so that
-the partitions are either (re)created from scratch or simply checked
-and mounted (the contents are preserved).
-
-When you're done, type `Q' to exit.
-
-No actual changes will be made to the disk until you (C)ommit from the
-Install menu! You're working with what is essentially a copy of
-the disk label(s), both here and in the FDISK Partition Editor.
diff --git a/release/sysinstall/help/en_US.ISO8859-1/slice.hlp b/release/sysinstall/help/en_US.ISO8859-1/slice.hlp
deleted file mode 100644
index e055ca4..0000000
--- a/release/sysinstall/help/en_US.ISO8859-1/slice.hlp
+++ /dev/null
@@ -1,28 +0,0 @@
-This is the Main Partition (or ``Slice'') Editor.
-
-Possible commands are printed at the bottom, and the Master Boot Record
-contents are at the top. You can move up and down with the arrow keys
-and can (C)reate a new partition whenever the "bar" is over a partition
-whose type is set to "unused".
-
-The flags field has the following legend:
-
- '=' -- Partition is properly aligned.
- '>' -- The partition doesn't end before cylinder 1024
- 'R' -- Has been marked as containing the root (/) filesystem
- 'B' -- Partition employs BAD144 bad-spot handling
- 'C' -- This is the FreeBSD 2.0-compatibility partition (default)
- 'A' -- This partition is marked active.
-
-If you select a partition for Bad144 handling, it will be scanned
-for bad blocks before any new filesystems are made on it.
-
-If no partition is marked Active, you will need to either install
-a Boot Manager (the option for which will be presented later in the
-installation) or set one Active before leaving this screen.
-
-To leave this screen, type `Q'.
-
-No actual changes will be made to the disk until you (C)ommit from the
-Install menu! You're working with what is essentially a copy of
-the disk label(s), both here and in the Label Editor.
diff --git a/release/sysinstall/help/en_US.ISO8859-1/tcp.hlp b/release/sysinstall/help/en_US.ISO8859-1/tcp.hlp
deleted file mode 100644
index 3ab5d7c..0000000
--- a/release/sysinstall/help/en_US.ISO8859-1/tcp.hlp
+++ /dev/null
@@ -1,27 +0,0 @@
-This screen allows you to set up your general network parameters
-(hostname, domain name, DNS server, etc) as well as the settings for a
-given interface (which was selected from the menu before this screen).
-
-You can move through the fields with the TAB, BACK-TAB and RETURN
-keys. To edit a field, use DELETE or BACKSPACE. You may also use ^A
-(control-A) to go to the beginning of the line, ^E (control-E) to go
-to the end, ^F (control-F) to go forward a character, ^B (control-B)
-to go backward one character, ^D (control-D) to delete the character
-under the cursor and ^K (control-K) to delete to the end of the line.
-Basically, the standard EMACS motion sequences.
-
-The ``Extra options to ifconfig'' is kind of special (read: a hack :-).
-
-You can use it for specifying the foreign side of a PLIP or SLIP line
-(simply type the foreign address in) as well as selecting a given
-"link" on an ethernet card that has more than one (e.g. AUI, 10BT,
-10B2, etc). The following links are recognised:
-
- link0 - AUI * highest precedence
- link1 - BNC
- link2 - UTP * lowest precedence
-
-That is to say that you can enter one of "link0", "link1" or "link2"
-into the `Extra options' field to select a different link.
-
-When you're done with this form, select OK.
diff --git a/release/sysinstall/help/en_US.ISO8859-1/usage.hlp b/release/sysinstall/help/en_US.ISO8859-1/usage.hlp
deleted file mode 100644
index b01a94b..0000000
--- a/release/sysinstall/help/en_US.ISO8859-1/usage.hlp
+++ /dev/null
@@ -1,54 +0,0 @@
-HOW TO USE THIS SYSTEM
-======================
-
-KEY ACTION
---- ------
-UP ARROW Move to previous item (or up, in a text field).
-DOWN ARROW Move to next item (or down, in a text field).
-TAB Move to next item or group.
-RIGHT ARROW Move to next item or group (same as TAB).
-SHIFT-TAB Move to previous item or group.
-LEFT ARROW Move to previous item or group (same as SHIFT-TAB).
-RETURN Select item.
-PAGE UP In text boxes, scrolls up one page.
-PAGE DOWN In text boxes, scrolls down one page.
-SPACE In "radio" or multiple choice menus, toggle the current item.
-F1 Help (in screens that provide it).
-
-If you also see small "^(-)" or "v(+)" symbols at the edges of a menu,
-it means that there are more items above or below the current one that
-aren't being shown (due to insufficient screen space). Using the
-up/down arrow keys will cause the menu to scroll. When a symbol
-disappears, it means you are at the top (or bottom) of the menu.
-
-In text fields, the amount of text above the current point will be
-displayed as a percentage in the lower right corner. 100% means
-you're at the bottom of the field.
-
-Selecting OK in a menu will confirm whatever action it's controlling.
-Selecting Cancel will cancel the operation and generally return you to
-the previous menu.
-
-
-SPECIAL FEATURES:
-=================
-
-It is also possible to select a menu item by typing the first
-character of its name, if unique. Such "accelerator" characters will
-be specially highlighted in the item name.
-
-The console driver also contains a scroll-back buffer for reviewing
-things that may have scrolled off the screen. To use scroll-back,
-press the "Scroll Lock" key on your keyboard and use the arrow or
-Page Up/Page Down keys to move through the saved text. To leave
-scroll-back mode, press the Scroll Lock key again. This feature
-is most useful for dealing with sub-shells or other "wizard modes"
-that don't use menus.
-
-Once the system is fully installed and running "multi-user", you will
-also find that you have multiple "virtual consoles" and can use them to
-have several active sessions at once. Use ALT-F<n> to switch between
-them, where `F<n>' is the function key corresponding to the screen you
-wish to see. By default, the system comes with 3 virtual consoles enabled.
-You can create more by editing the /etc/ttys file, once the system is up,
-for a maximum of 12.
diff --git a/release/sysinstall/help/en_US.ISO_8859-1/README b/release/sysinstall/help/en_US.ISO_8859-1/README
deleted file mode 100644
index c166e26..0000000
--- a/release/sysinstall/help/en_US.ISO_8859-1/README
+++ /dev/null
@@ -1,104 +0,0 @@
- -----------------------------------------
- FreeBSD 2.0.5 --- RELEASE Version , ,
- ----------------------------------------- /( )`
- \ \___ / |
-Welcome to the 2.0.5 release of FreeBSD! 2.0.5 is /- _ `-/ '
-an interim release of FreeBSD, filling a critical (/\/ \ \ /\
-gap during the period between 2.0R (which was / / | ` \
-released in Nov 94) and 2.1R, which will be O O ) / |
-released in late July of '95. FreeBSD 2.0.5 `-^--'`< '
-contains many substantial improvements from 2.0R, (_.) _ ) /
-not least of which is greater stability (by `.___/` /
-a considerable margin), dozens of new `-----' /
-features and a greatly enhanced <----. __ / __ \
-installation program. See the release <----|====O)))==) \) /====
-notes for more details on what's new in <----' `--' `.__,' \
-FreeBSD 2.0.5! | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-What is FreeBSD? FreeBSD is an operating system based on 4.4 BSD Lite
-for Intel, AMD, Cyrix or NexGen "x86" based PC hardware. It works
-with a very wide variety of PC peripherals and configurations and can
-be used for everything from software development to Internet Service
-Provision; the busiest site on the Internet, ftp.cdrom.com, is a
-FreeBSD machine!
-
-This release of FreeBSD contains everything you need to run such a
-system, plus full source code for everything. With the source
-distribution installed you can literally recompile the entire system
-from scratch with one command, making it ideal for students,
-researchers or folks who simply want to see how it all works.
-
-A large collection of 3rd party ported software (the "ports
-collection") is also provided to make it easier for you to obtain and
-install all your favorite traditional UNIX utilities for FreeBSD.
-Over 270 ports, from editors to programming languages to graphical
-applications, make FreeBSD a powerful and comprehensive operating
-environment that rivals that of many large workstations for general utility
-and power.
-
-
-For more documentation on this system, it is recommended that you
-purchase the 4.4BSD Document Set from O'Reilly Associates and the
-USENIX Association, ISBN 1-56592-082-1. We have no connection with
-O'Reilly, we're just satisfied customers!
-
-You may also wish to read the HARDWARE GUIDE *before* proceeding any
-further with the installation. Configuring PC hardware for anything
-other than DOS/Windows (which don't actually make very significant
-demands on the hardware) is actually quite a bit harder than it looks,
-and if you think you understand PCs then you clearly haven't been
-using them for long enough! :) This guide will give you some tips on
-how to configure your hardware and what symptoms to watch for in case
-of trouble. This guide is available in the Documentation menu of the
-FreeBSD boot floppy.
-
-DISCLAIMER: While FreeBSD does its best to safeguard against accidental
-loss of data, it's still more than possible to WIPE OUT YOUR ENTIRE DISK
-with this installation! Please do not proceed to the final FreeBSD
-installation menu unless you've adequately backed up any important
-data first! We really mean it!
-
-Technical comments on this release should be sent (in English!) to:
-
- hackers@FreeBSD.org
-
-
-Bug reports should be sent using the `send-pr' command, if you were
-able to get the system installed, otherwise to:
-
- bugs@FreeBSD.org
-
-Please be sure to indicate WHICH VERSION of FreeBSD you're running in
-any bug reports!
-
-
-General questions should be sent to:
-
- questions@FreeBSD.org
-
-Please have patience if your questions are not answered right away -
-this is an especially busy time for us, and our volunteer resources
-are often strained to the limit! Bug reports submitted with the
-send-pr command are logged and tracked in our bugs database, and
-you'll be kept informed of any changes in status during the life of
-the bug (or feature request).
-
-Our WEB site, http://www.freebsd.org, is also a very good source for
-updated information and provides a number of advanced documentation
-facilities. You may use the BSDI version of Netscape for browsing the
-World Wide Web directly from FreeBSD.
-
-You may also wish to look in /usr/share/FAQ and /usr/share/doc for
-further information on the system.
-
-
-Thanks for reading all of this, and we sincerely hope you enjoy this
-release of FreeBSD!
-
- Jordan Hubbard,
- for The FreeBSD Project
diff --git a/release/sysinstall/help/en_US.ISO_8859-1/RELNOTES b/release/sysinstall/help/en_US.ISO_8859-1/RELNOTES
deleted file mode 100644
index 9d6284f..0000000
--- a/release/sysinstall/help/en_US.ISO_8859-1/RELNOTES
+++ /dev/null
@@ -1,747 +0,0 @@
- RELEASE NOTES
- FreeBSD
- Release 2.0.5
-
-1. Technical overview
----------------------
-
-FreeBSD is a freely available, full source 4.4 BSD Lite based release
-for Intel i386/i486/Pentium (or compatible) based PC's. It is based
-primarily on software from U.C. Berkeley's CSRG group, with some
-enhancements from NetBSD, 386BSD, and the Free Software Foundation.
-
-Since our release of FreeBSD 2.0 some 8 months ago, the performance,
-feature set, and stability of FreeBSD has improved dramatically. The
-largest change is a revamped VM system with a merged VM/file buffer
-cache that not only increases performance, but reduces FreeBSD's
-memory footprint, making a 4MB configuration a more acceptable
-minimum. Other enhancements include full NIS client and server
-support, transaction TCP support, dial-on-demand PPP, an improved SCSI
-subsystem, early ISDN support, support for FDDI and Fast Ethernet
-(100Mbit) adapters, improved support for the Adaptec 2940 (WIDE and
-narrow) and many hundreds of bug fixes.
-
-We've also taken the comments and suggestions of many of our users to
-heart and have attempted to provide what we hope is a more sane and
-easily understood installation process. Your feedback on this
-(constantly evolving) process is especially welcome!
-
-In addition to the base distributions, FreeBSD offers a new ported
-software collection with some 270 commonly sought-after programs. The
-list of ports ranges from http (WWW) servers, to games, languages,
-editors and almost everything in between. The entire ports collection
-requires only 10MB of storage, all ports being expressed as "deltas"
-to their original sources. This makes it much easier for us to update
-ports, and greatly reduces the disk space demands made by the older
-1.0 ports collection. To compile a port, you simply change to the
-directory of the program you wish to install, type make and let the
-system do the rest. The full original distribution for each port you
-build is retrieved dynamically off of CDROM or a local ftp site, so
-you need only enough disk space to build the ports you want. (Almost)
-every port is also provided as a pre-compiled "package" which can be
-installed with a simple command (pkg_add) by those who do not wish to
-compile their own ports from source. See the file:
- /usr/share/FAQ/Text/ports.FAQ
-for a more complete description of the ports collection.
-
-
-Since our first release of FreeBSD 1.0 nearly two years ago, FreeBSD
-has changed almost entirely. A new port from the Berkeley 4.4 code
-base was done, which brought the legal status of the system out of the
-shadows with the blessing of Novell (the new owners of USL and UNIX). The
-port to 4.4 has also brought in a host of new features, filesystems
-and enhanced driver support. With our new unencumbered code base, we
-have every reason to hope that we'll be able to release quality
-operating systems without further legal encumbrance for some time to
-come!
-
-FreeBSD 2.0.5 represents the culmination of 2 years of work and many
-thousands of man hours put in by an international development team.
-We hope you enjoy it!
-
-A number of additional documents which you may find very helpful in
-the process of installing and using FreeBSD may also be found in
-the "FAQ" directory, either under /usr/share/FAQ on an installed
-system or at the top level of the CDROM or FTP distribution from
-where you're reading this file. Please consult FAQ/Text/ROADMAP
-for a brief description of the resources provided by the FAQ directory.
-
-For a list of contributors and a general project description, please see
-the file "CONTRIB.FreeBSD" which should be bundled with your binary
-distribution.
-
-Also see the "REGISTER.FreeBSD" file for information on registering
-with the "Free BSD user counter". This counter is for ALL freely
-available variants of BSD, not just FreeBSD, and we urge you to register
-yourself with it.
-
-The core of FreeBSD does not contain DES code which would inhibit its
-being exported outside the United States. There is an add-on package
-to the core distribution, for use only in the United States, that
-contains the programs that normally use DES. The auxiliary packages
-provided separately can be used by anyone. A freely (from outside the
-U.S.) exportable European distribution of DES for our non-U.S. users also
-exists and is described in the FreeBSD FAQ.
-
-If password security for FreeBSD is all you need, and you have no
-requirement for copying encrypted passwords from different hosts
-(Suns, DEC machines, etc) into FreeBSD password entries, then
-FreeBSD's MD5 based security may be all you require! We feel that our
-default security model is more than a match for DES, and without any
-messy export issues to deal with. If you're outside (or even inside)
-the U.S., give it a try!
-
-
-1.1 What's new in 2.0.5?
-------------------------
-
-The following features were added or substantially improved between
-the release of 2.0 and this 2.0.5 release. In order to facilitate
-better communication, the person, or persons, responsible for each
-enhancement is noted. Any questions regarding the new functionality
-should be directed to them first.
-
-KERNEL:
-
-Merged VM-File Buffer Cache
----------------------------
-A merged VM/buffer cache design greatly enhances overall system
-performance and makes it possible to do a number of more optimal
-memory allocation strategies that were not possible before.
-
-Owner: David Greenman (davidg@FreeBSD.org) and
- John Dyson (dyson@implode.root.com)
-
-
-Network PCB hash optimization
------------------------------
-For systems with a great number of active TCP connections (WEB and ftp
-servers, for example), this greatly speeds up the lookup time required
-to match an incoming packet up to its associated connection.
-
-Owner: David Greenman (davidg@FreeBSD.org)
-
-
-Name cache optimization
------------------------
-The name-cache would cache all files of the same name to the same bucket,
-which would put for instance all ".." entries in the same bucket. We added
-the parent directory version to frustrate the hash, and improved the
-management of the cache in various other ways while we were at it.
-
-Owner: Poul-Henning Kamp (phk@FreeBSD.org)
- David Greenman (davidg@FreeBSD.org)
-
-
-Less restrictive swap-spaces
-----------------------------
-The need to compile the names of the swap devices into the kernel has been
-removed. Now swapon will accept any block devices, up to the maximum
-number of swap devices configured in the kernel.
-
-Owner: Poul-Henning Kamp (phk@FreeBSD.org)
- David Greenman (davidg@FreeBSD.org)
-
-
-Hard Wired SCSI Devices
------------------------
-Prior to 2.0.5, FreeBSD performed dynamic assignment of unit numbers
-to SCSI devices as they were probed, allowing a SCSI device failure to
-possibly change unit number assignment and prevent filesystems on
-still functioning disks from mounting. Hard wiring allows static
-allocation of unit numbers (and hence device names) to scsi devices
-based on SCSI ID and bus. SCSI configuration occurs in the kernel
-config file. Samples of the configuration syntax can be found in the
-scsi(4) man page or the LINT kernel config file.
-
-Owner: Peter Dufault (dufault@hda.com)
-Sources involved: sys/scsi/* usr.sbin/config/*
-
-
-Slice Support
--------------
-FreeBSD now supports a "slice" abstraction which makes it more
-completely interoperable with other operating system partitions. This
-support will allow FreeBSD to inhabit DOS extended partitions.
-
-Owner: Bruce Evans (bde@FreeBSD.org)
-Sources involved: sys/disklabel.h sys/diskslice.h sys/dkbad.h
- kern/subr_diskslice.c kern/subr_dkbad.c
- i386/isa/diskslice_machdep.c
- i386/isa/wd.c scsi/sd.c dev/vn/vn.c
-
-
-Support for Ontrack Disk Manager Version 6.0
---------------------------------------------
-Support has been added for disks which use Ontrack Disk Manager. The
-fdisk program does NOT know about it however, so make all changes
-using the install program on the boot.flp or the Ontrack Disk Manager
-tool under DOS.
-
-Owner: Poul-Henning Kamp (phk@FreeBSD.org)
-
-
-Bad144 is back and working
---------------------------
-Bad144 works again, though the semantics are slightly different than
-before in that the bad-spots are kept relative to the slice rather
-than absolute on the disk.
-
-Owner: Bruce Evans (bde@FreeBSD.org)
- Poul-Henning Kamp (phk@FreeBSD.org)
-
-
-NEW DEVICE SUPPORT:
-
- SCSI and CDROM Devices
-
-Matsushita/Panasonic (Creative) CD-ROM driver
----------------------------------------------
-The Matsushita/Panasonic CR-562 and CR-563 drives are now supported
-when connected to a Sound Blaster or 100% compatible host adapter. Up
-to four host adapters are supported for a total of 16 CD-ROM drives.
-The audio functions are supported, along with access to the raw (2352 byte)
-data frames of any compact disc. Audio discs may be played using Karoke
-variable speed functions.
-
-Owner: Frank Durda IV bsdmail@nemesis.lonestar.org
-Sources involved: isa/matcd
-
-
-Adaptec 2742/2842/2940 SCSI driver
-----------------------------------
-The original 274x/284x driver has evolved considerably since the 2.0
-release. We now offer full support for the 2940 series as well as the
-Wide models of these cards. The arbitration bug (as well as many
-others) that caused the driver problems with fast devices has been
-corrected and there is even experimental tagged queuing support
-(kernel option "AHC_TAGENABLE"). John Aycock has also released the
-sequencer code under a "Berkeley style" copyright making the driver
-entirely clean of the GPL.
-
-Owner: Justin Gibbs (gibbs@FreeBSD.org)
-Sources involved: isa/aic7770.c pci/aic7870.c i386/scsi/*
- sys/dev/aic7xxx/*
-
-
-NCR5380/NCR53400 SCSI ("ProAudio Spectrum") driver
---------------------------------------------------
-Owner: core
-Submitted by: Serge Vakulenko (vak@cronyx.ru)
-Sources involved: isa/ncr5380.c
-
-
-Sony CDROM driver
------------------
-Owner: core
-Submitted by: Mikael Hybsch (micke@dynas.se)
-Sources involved: isa/scd.c
-
-
- Serial Devices
-
-SDL Communications Riscom/8 Serial Board Driver
------------------------------------------------
-Owner: Andrey Chernov (ache@FreeBSD.org)
-Sources involved: isa/rc.c isa/rcreg.h
-
-
-Cyclades Cyclom-y Serial Board Driver
--------------------------------------
-Owner: Bruce Evans (bde@FreeBSD.org)
-Submitted by: Andrew Werple (andrew@werple.apana.org.au) and
- Heikki Suonsivu (hsu@cs.hut.fi)
-Obtained from: NetBSD
-Sources involved: isa/cy.c
-
-
-Cronyx/Sigma sync/async serial driver
--------------------------------------
-Owner: core
-Submitted by: Serge Vakulenko
-Sources involved: isa/cronyx.c
-
-
-
- Networking
-
-Diskless booting
-----------------
-Diskless booting in 2.0.5 is much improved. The boot-program is in
-src/sys/i386/boot/netboot, and can be run from an MSDOS system or
-burned into an EPROM. Local swapping is also possible. WD, SMC, 3COM
-and Novell ethernet cards are currently supported.
-
-
-DEC DC21140 Fast Ethernet driver
---------------------------------
-This driver supports any of the numerous NICs using the DC21140 chipset
-including the 100Mb DEC DE-500-XA and SMC 9332.
-
-Owner: core
-Submitted by: Matt Thomas (thomas@lkg.dec.com)
-Sources involved: pci/if_de.c pci/dc21040.h
-
-
-DEC FDDI (DEFPA/DEFEA) driver
------------------------------
-Owner: core
-Submitted by: Matt Thomas (thomas@lkg.dec.com)
-Sources involved: pci/if_pdq.c pci/pdq.c pci/pdq_os.h pci/pdqreg.h
-
-
-3Com 3c505 (Etherlink/+) NIC driver
------------------------------------
-Owner: core
-Submitted by: Dean Huxley (dean@fsa.ca)
-Obtained from: NetBSD
-Sources involved: isa/if_eg.c
-
-
-Fujitsu MB86960A family of NICs driver
--------------------------------------
-Owner: core
-Submitted by: M.S. (seki@sysrap.cs.fujitsu.co.jp)
-Sources involved: isa/if_fe.c
-
-
-Intel EtherExpress driver
--------------------------
-Owner: Rodney W. Grimes (rgrimes@FreeBSD.org)
-Sources involved: isa/if_ix.c isa/if_ixreg.h
-
-
-3Com 3c589 driver
------------------
-Owner: core
-Submitted by: "HOSOKAWA Tatsumi" (hosokawa@mt.cs.keio.ac.jp),
- Seiji Murata (seiji@mt.cs.keio.ac.jp) and
- Noriyuki Takahashi (hor@aecl.ntt.jp)
-Sources involved: isa/if_zp.c
-
-
-IBM Credit Card Adapter driver
-------------------------------
-Owner: core
-Submitted by: "HOSOKAWA Tatsumi" (hosokawa@mt.cs.keio.ac.jp),
-Sources involved: isa/pcic.c isa/pcic.h
-
-
-EDSS1 and 1TR6 ISDN interface driver
-------------------------------------
-Owner: core
-Submitted by: Dietmar Friede (dfriede@drnhh.neuhaus.de) and
- Juergen Krause (jkr@saarlink.de)
-Sources involved: gnu/isdn/*
-
-
- Miscellaneous Drivers
-
-Joystick driver
----------------
-Owner: Jean-Marc Zucconi (jmz@FreeBSD.org)
-Sources involved: isa/joy.c
-
-
-National Instruments "LabPC" driver
------------------------------------
-Owner: Peter Dufault (dufault@hda.com)
-Sources involved: isa/labpc.c
-
-
-WD7000 driver
--------------
-Owner: Olof Johansson (offe@ludd.luth.se)
-
-
-Pcvt Console driver
--------------------
-Owner: Joerg Wunsch (joerg@FreeBSD.org)
-Submitted by: Hellmuth Michaelis (hm@altona.hamburg.com)
-Sources involved: isa/pcvt/* usr.sbin/pcvt/*
-
-
-BSD-audio emulator for VAT driver
----------------------------------
-Owner: Amancio Hasty (ahasty@FreeBSD.org) and
- Paul Traina (pst@FreeBSD.org)
-Sources involved: isa/sound/vat_audio.c isa/sound/vat_audioio.h
-
-
-National Instruments AT-GPIB and AT-GPIB/TNT GPIB driver
---------------------------------------------------------
-Owner: core
-Submitted by: Fred Cawthorne (fcawth@delphi.umd.edu)
-Sources involved: isa/gpib.c isa/gpib.h isa/gpibreg.h
-
-
-Genius GS-4500 hand scanner driver
-----------------------------------
-Owner: core
-Submitted by: Gunther Schadow (gusw@fub46.zedat.fu-berlin.de)
-Sources involved: isa/gsc.c isa/gscreg.h
-
-
-CORTEX-I Frame Grabber
-----------------------
-Owner: core
-Submitted by: Paul S. LaFollette, Jr.
-Sources involved: isa/ctx.c isa/ctxreg.h
-
-
-Video Spigot video capture card
--------------------------------
-Owner: Jim Lowe
-
-
-
-1.2 Experimental features
--------------------------
-
-The unionfs and LFS file systems are known to be severely broken in
-2.0.5. This is in part due to old bugs that we haven't had time to
-resolve yet and the need to update these file systems to deal with the
-new VM system. We hope to address these issues in a later release of
-FreeBSD.
-
-FreeBSD now supports running iBCS2 compatible binaries (currently SCO
-UNIX 3.2.2 & 3.2.4 and ISC 2.2 COFF format are supported). The iBCS2
-emulator is in its early stages, but it is functional, we haven't been
-able to do exhaustive testing (lack of commercial apps), but almost
-all of SCO's 3.2.2 binaries are working, so is an old INFORMIX-2.10
-for SCO. Further testing is nessesary to complete this project. There
-is also work under way for ELF & XOUT loaders, and most of the svr4
-syscall wrappers have been written.
-
-FreeBSD also implements enough of its Linux compatibility that we
-can now run Linux DOOM! See the ``xperimnt'' directory (on your local
-FTP server or CDROM) for full docs on how to set this up.
-
-Owner: Soren Schmidt (sos) & Sean Eric Fagan (sef)
-Sources involved: sys/i386/ibcs2/* + misc kernel changes.
-
-
-2. Supported Configurations
----------------------------
-
-FreeBSD currently runs on a wide variety of ISA, VLB, EISA and PCI bus
-based PC's, ranging from 386sx to Pentium class machines (though the
-386sx is not recommended). Support for generic IDE or ESDI drive
-configurations, various SCSI controller, network and serial cards is
-also provided.
-
-Following is a list of all disk controllers and ethernet cards currently
-known to work with FreeBSD. Other configurations may very well work, and
-we have simply not received any indication of this.
-
-
-2.1. Disk Controllers
----------------------
-
-WD1003 (any generic MFM/RLL)
-WD1007 (any generic IDE/ESDI)
-IDE
-ATA
-
-Adaptec 152x series ISA SCSI controllers
-Adaptec 154x series ISA SCSI controllers
-Adaptec 174x series EISA SCSI controller in standard and enhanced mode.
-Adaptec 274X/284X/2940 (Narrow/Wide/Twin) series ISA/EISA/PCI SCSI controllers
-Adaptec AIC-6260 and AIC-6360 based boards, which includes
-the AHA-152x and SoundBlaster SCSI cards.
-
-** Note: You cannot boot from the SoundBlaster cards as they have no
- on-board BIOS, which is necessary for mapping the boot device into the
- system BIOS I/O vectors. They're perfectly usable for external tapes,
- CDROMs, etc, however. The same goes for any other AIC-6x60 based card
- without a boot ROM. Some systems DO have a boot ROM, which is generally
- indicated by some sort of message when the system is first powered up
- or reset. Check your system/board documentation for more details.
-
-[Note that Buslogic was formerly known as "Bustec"]
-Buslogic 545S & 545c
-Buslogic 445S/445c VLB SCSI controller
-Buslogic 742A, 747S, 747c EISA SCSI controller.
-Buslogic 946c PCI SCSI controller
-Buslogic 956c PCI SCSI controller
-
-NCR 53C810 and 53C825 PCI SCSI controller.
-NCR5380/NCR53400 ("ProAudio Spectrum") SCSI controller.
-
-DTC 3290 EISA SCSI controller in 1542 emulation mode.
-
-UltraStor 14F, 24F and 34F SCSI controllers.
-
-Seagate ST01/02 SCSI controllers.
-
-Future Domain 8xx/950 series SCSI controllers.
-
-WD7000 SCSI controller.
-
-With all supported SCSI controllers, full support is provided for
-SCSI-I & SCSI-II peripherals, including Disks, tape drives (including
-DAT) and CD ROM drives.
-
-The following CD-ROM type systems are supported at this time:
-(cd) SCSI (also includes ProAudio Spectrum and SoundBlaster SCSI)
-(mcd) Mitsumi proprietary interface
-(matcd) Matsushita/Panasonic (Creative) proprietary interface
-(scd) Sony proprietary interface
-
-Note: CD-Drives with IDE interfaces are not supported at this time.
-
-Some controllers have limitations with the way they deal with >16MB of
-memory, due to the fact that the ISA bus only has a DMA address space
-of 24 bits. If you do your arithmetic, you'll see that this makes it
-impossible to do direct DMA to any address >16MB. This limitation is
-even true of some EISA controllers (which are normally 32 bit) when
-they're configured to emulate an ISA card, which they then do in *all*
-respects. This problem is avoided entirely by IDE controllers (which
-do not use DMA), true EISA controllers (like the UltraStor, Adaptec
-1742A or Adaptec 2742) and most VLB (local bus) controllers. In the
-cases where it's necessary, the system will use "bounce buffers" to
-talk to the controller so that you can still use more than 16Mb of
-memory without difficulty.
-
-
-2.2. Ethernet cards
--------------------
-
-Allied-Telesis AT1700 and RE2000 cards
-SMC Elite 16 WD8013 ethernet interface, and most other WD8003E,
-WD8003EBT, WD8003W, WD8013W, WD8003S, WD8003SBT and WD8013EBT
-based clones. SMC Elite Ultra is also supported.
-
-DEC EtherWORKS III NICs (DE203, DE204, and DE205)
-DEC EtherWORKS II NICs (DE200, DE201, DE202, and DE422)
-DEC DC21140 based NICs (SMC???? DE???)
-DEC FDDI (DEFPA/DEFEA) NICs
-
-Fujitsu FMV-181 and FMV-182
-
-Intel EtherExpress
-
-Isolan AT 4141-0 (16 bit)
-Isolink 4110 (8 bit)
-
-Novell NE1000, NE2000, and NE2100 ethernet interface.
-
-3Com 3C501 cards
-
-3Com 3C503 Etherlink II
-
-3Com 3c505 Etherlink/+
-
-3Com 3C507 Etherlink 16/TP
-
-3Com 3C509, 3C579, 3C589 (PCMCIA) Etherlink III
-
-Toshiba ethernet cards
-
-PCMCIA ethernet cards from IBM and National Semiconductor are also
-supported.
-
-
-2.3. Misc
----------
-
-AST 4 port serial card using shared IRQ.
-
-ARNET 8 port serial card using shared IRQ.
-
-BOCA ATIO66 6 port serial card using shared IRQ.
-
-Cyclades Cyclom-y Serial Board.
-
-STB 4 port card using shared IRQ.
-
-Mitsumi (all models) CDROM interface and drive.
-
-SDL Communications Riscom/8 Serial Board.
-
-SoundBlaster SCSI and ProAudio Spectrum SCSI CDROM interface and drive.
-
-Matsushita/Panasonic (Creative SoundBlaster) CDROM interface and drive.
-
-Adlib, SoundBlaster, SoundBlaster Pro, ProAudioSpectrum, Gravis UltraSound
-and Roland MPU-401 sound cards.
-
-FreeBSD currently does NOT support IBM's microchannel (MCA) bus, but
-support is apparently close to materializing. Details will be posted
-as the situation develops.
-
-
-3. Obtaining FreeBSD
---------------------
-
-You may obtain FreeBSD in a variety of ways:
-
-1. FTP/Mail
-
-You can ftp FreeBSD and any or all of its optional packages from
-`ftp.freebsd.org' - the official FreeBSD release site.
-
-For other locations that mirror the FreeBSD software see the file
-MIRROR.SITES. Please ftp the distribution from the nearest site
-to you netwise.
-
-If you do not have access to the internet and electronic mail is your
-only recourse, then you may still fetch the files by sending mail to
-`ftpmail@decwrl.dec.com' - putting the keyword "help" in your message
-to get more information on how to fetch files from ftp.freebsd.org.
-Note: This approach will end up sending many *tens of megabytes*
-through the mail, and should only be employed as an absolute LAST
-resort!
-
-
-2. CDROM
-
-FreeBSD 2.0.5 may be ordered on CDROM from:
-
- Walnut Creek CDROM
- 4041 Pike Lane, Suite D
- Concord CA 94520
- 1-800-786-9907, +1-510-674-0783, +1-510-674-0821 (fax)
-
-Or via the internet from orders@cdrom.com or http://www.cdrom.com.
-Their current catalog can be obtained via ftp as:
- ftp://ftp.cdrom.com/cdrom/catalog.
-
-Cost per CD is $39.95, or $24.95 with a FreeBSD subscription. With
-a subscription, you will automatically receive updates as they
-are released. Your credit card will be billed when each disk is shipped
-and you may cancel your subscription at any time without further obligation.
-
-Walnut Creek CDROM also sells a full line of FreeBSD related merchandise such
-as T-shirts ($14.95, available in "child", Large and XL sizes), coffee mugs
-($9.95), tattoos ($0.25 each) and posters ($3.00).
-
-Shipping (per order not per disc) is $5 in the US, Canada or
-Mexico and $9.00 overseas. They accept Visa, Mastercard, Discover,
-American Express or checks in U.S. Dollars and ship COD within the
-United States. California residents please add 8.25% sales tax.
-
-Should you be dissatisfied for any reason, the CD comes with an
-unconditional return policy.
-
-
-Reporting problems, making suggestions, submitting code
--------------------------------------------------------
-
-Your suggestions, bug reports and contributions of code are always
-valued - please do not hesitate to report any problems you may find
-(preferably with a fix attached if you can!).
-
-The preferred method to submit bug reports from a machine with
-internet mail connectivity is to use the send-pr command. Bug reports
-will be dutifully filed by our faithful bugfiler program and you can
-be sure that we'll do our best to respond to all reported bugs as soon
-as possible.
-
-If, for some reason, you are unable to use the send-pr command to
-submit a bug report, you can try to send it to:
-
- bugs@FreeBSD.org
-
-
-Otherwise, for any questions or suggestions, please send mail to:
-
- questions@FreeBSD.org
-
-Additionally, being a volunteer effort, we are always happy to have
-extra hands willing to help - there are already far more enhancements
-to be done than we can ever manage to do by ourselves! To contact us
-on technical matters, or with offers of help, you may send mail to:
-
- hackers@FreeBSD.org
-
-Since these mailing lists can experience significant amounts of
-traffic, if you have slow or expensive mail access and you are
-only interested in keeping up with significant FreeBSD events, you may
-find it preferable to subscribe to:
-
- announce@FreeBSD.org
-
-
-All but the freebsd-bugs groups can be freely joined by anyone wishing
-to do so. Send mail to MajorDomo@FreeBSD.org and include the keyword
-`help' on a line by itself somewhere in the body of the message. This
-will give you more information on joining the various lists, accessing
-archives, etc. There are a number of mailing lists targeted at
-special interest groups not mentioned here, so send mail to majordomo
-and ask about them!
-
-
-6. Acknowledgements
--------------------
-
-FreeBSD represents the cumulative work of many dozens, if not
-hundreds, of individuals from around the world who have worked very
-hard to bring you this release. It would be very difficult, if not
-impossible, to enumerate everyone who's contributed to FreeBSD, but
-nonetheless we shall try (in alphabetical order, of course). If your
-name is not mentioned, please be assured that its omission is entirely
-accidental.
-
-
-The Computer Systems Research Group (CSRG), U.C. Berkeley.
-
-Bill Jolitz, for his initial work with 386BSD.
-
-The FreeBSD Core Team
-(in alphabetical order by first name):
-
- Andreas Schulz <ats@FreeBSD.org>
- Andrey A. Chernov <ache@FreeBSD.org>
- Bruce Evans <bde@FreeBSD.org>
- David Greenman <davidg@FreeBSD.org>
- Garrett A. Wollman <wollman@FreeBSD.org>
- Gary Palmer <gpalmer@FreeBSD.org>
- Geoff Rehmet <csgr@FreeBSD.org>
- Jack Vogel <jackv@FreeBSD.org>
- John Dyson <dyson@FreeBSD.org>
- Jordan K. Hubbard <jkh@FreeBSD.org>
- Justin Gibbs <gibbs@FreeBSD.org>
- Paul Richards <paul@FreeBSD.org>
- Poul-Henning Kamp <phk@FreeBSD.org>
- Rich Murphey <rich@FreeBSD.org>
- Rodney W. Grimes <rgrimes@FreeBSD.org>
- Satoshi Asami <asami@FreeBSD.org>
- Søren Schmidt <sos@FreeBSD.org>
-
-Special mention to:
-
- Walnut Creek CDROM, without whose help (and continuing support)
- this release would never have been possible.
-
- Dermot McDonnell for his donation of a Toshiba XM3401B CDROM
- drive.
-
- Additional FreeBSD helpers and beta testers:
-
- J.T. Conklin Julian Elischer
- Frank Durda IV Peter Dufault
- Sean Eric Fagan Jeffrey Hsu
- Terry Lambert L Jonas Olsson
- Chris Provenzano Dave Rivers
- Guido van Rooij Steven Wallace
- Atsushi Murai Scott Mace
- Nate Williams
-
- And everyone at Montana State University for their initial support.
-
-
-Jordan would also like to give special thanks to Poul-Henning Kamp and
-Gary Palmer, both of whom put in long hours helping him to construct
-the new installation utility. Poul, being a proud new father, was
-especially pressed for time and yet somehow managed to put in
-a significant amount of effort anyway. This release could not have
-happened without him! Thank you both!
-
-Thanks also to everyone else who helped, especially those not
-mentioned, and we sincerely hope you enjoy this release of FreeBSD!
-
-
- The FreeBSD Core Team
-
-$Id: RELNOTES,v 1.9 1995/06/10 02:40:11 jkh Exp $
diff --git a/release/sysinstall/help/en_US.ISO_8859-1/XF86.hlp b/release/sysinstall/help/en_US.ISO_8859-1/XF86.hlp
deleted file mode 100644
index c789eaa..0000000
--- a/release/sysinstall/help/en_US.ISO_8859-1/XF86.hlp
+++ /dev/null
@@ -1,500 +0,0 @@
-README for XFree86 3.1.1u1 on FreeBSD 2.0.5
-Rich Murphey, David Dawes
-20 January 1995
-
-1. What and Where is XFree86?
-------------------------------
-
-XFree86 is a port of X11R6 that supports several versions of Intel-
-based Unix. It is derived from X386 1.2, which was the X server
-distributed with X11R5. This release consists of many new features
-and performance improvements as well as many bug fixes. The release
-is available as source patches against the X Consortium X11R6 code, as
-well as binary distributions for many architectures.
-
-See the Copyright Notice (COPYRIGHT.html).
-
-The sources for XFree86 are available as part of the FreeBSD 2.0.5
-distribution, or by anonymous ftp from:
-
-ftp.XFree86.org:/pub/XFree86/current
-(ftp://ftp.XFree86.org/pub/XFree86/current)
-
-
-Binaries for XFree86 on FreeBSD are also available as part of
-2.0.5 or from:
-
-ftp.XFree86.org:/pub/XFree86/current/binaries/FreeBSD-2.0
-(ftp://ftp.XFree86.org/pub/XFree86/current/binaries/FreeBSD-2.0)
-
-XFree86.cdrom.com:/pub/XFree86/current/binaries/FreeBSD-2.0
-(ftp://XFree86.cdrom.com/pub/XFree86/current/binaries/FreeBSD-2.0)
-
-Send email to Rich-Murphey@Rice.edu or XFree86@XFree86.org if you have
-comments or suggestions about this file and we'll revise it.
-
-
-2. Installing the Binaries
----------------------------
-
-In the FreeBSD 2.0.5 distribution, XFree86 comes in 3 major sections:
-"basic" distributions, fonts and servers. At the minimum, you will
-need the binaries and libraries from the basic distribution, the
-"misc" fonts collection and at least one server. The smallest usable
-distribution is around 9MB.
-
-If you can't decide what to pick and you have 52Mb of disk
-space, it's safe to unpack everything.
-
-What follows is a description of the various distribution files
-comprising XFree86. If you are installing this as part of FreeBSD
-2.0.5 then there's no need to use these files directly: You may
-simply check the desired components off the installation menus
-provided for that purpose. If you're installing this manually,
-then the following information should prove useful:
-
- Required (6.7Mb):
-
- X311bin.tgz
- all the executable X client applications and shared libs
-
- X311fnts.tgz
- the misc and 75 dpi fonts
-
- X311lib.tgz
- data files needed at runtime
-
-
- Required unless you have already customized your configuration
- files:
-
- X311xicf.tgz
- customizable xinit runtime configuration file
-
- X311xdcf.tgz
- customizable xdm runtime configuration file
-
- Choose at least one server ( 2.3Mb):
-
- X3118514.tgz
- 8-bit color for IBM 8514 and true compatibles.
-
- X311AGX.tgz
- 8-bit color for AGX boards.
-
- X311Mch3.tgz
- 8 and 16-bit color for ATI Mach32 boards.
-
- X311Mch8.tgz
- 8-bit color for ATI Mach8 boards.
-
- X311Mono.tgz
- 1-bit monochrome for VGA, Super-VGA, Hercules, and others.
-
- X311P9K.tgz
- 8, 16, and 24-bit color for Weitek P9000 boards (Diamond
- Viper).
-
- X311S3.tgz
- 8, 16 and 24-bit color for S3 boards (#9 GXE, Actix GE32,
- SPEA Mercury, STB Pegasus)
-
- X311SVGA.tgz
- 8-bit color for Super-VGA cards.
-
- X311VG16.tgz
- 4-bit color for VGA and Super-VGA cards
-
- X311W32.tgz
- 8-bit Color for ET4000/W32, /W32i and /W32p cards.
-
- X311nest.tgz
- A nested server running as a client window on another
- display.
-
- Optional:
-
- X311doc.tgz
- (.5Mb) READMEs and XFree86 specific man pages
-
- X311man.tgz
- (1.7Mb) man pages except XFree86 specific ones in etc archive
-
- X311f100.tgz
- (1.8Mb) 100dpi fonts
-
- X311fscl.tgz
- (1.6Mb) Speedo and Type1 fonts
-
- X311fnon.tgz
- (3.3Mb) Japanese, Chinese and other non-English fonts
-
- X311fsrv.tgz
- (.3Mb) the font server and it's man page
-
- X311prog.tgz
- (3.9Mb) config, lib*.a and *.h files needed only for
- compiling
-
- X311link.tgz
- (7.8Mb) X server reconfiguration kit
-
- X311pex.tgz
- (.5Mb) PEX fonts and shared libs needed by PEX applications.
-
- X311lbx.tgz
- (.2Mb) low bandwidth X proxy server and libraries.
-
-Note that there is no longer a separate xdm archive. FreeBSD 2.0
-and later handles this in shared libraries now, so that the xdm
-binary does not itself contain des and there is no more need for
-us to provide separate tar balls.
-
-
-2.1. Full Install:
--------------------
-
-[ Note: Unless you're installing XFree86 3.1.1u1 manually, that is
- to say not as part of the FreeBSD 2.0.5 installation, you may skip
- to section 2.3 ]
-
- 1. You must be logged in as root to unpack the archives because
- several executables are set-user-id. Otherwise the server may
- abort if you unpack it as an ordinary user. You must also use a
- ``umask'' value of 022 because the X server requires special
- permissions.
-
- % su
- # umask 022
-
-
- 2. If you have 52Mb free in the /usr partition ``cd /usr'' and skip
- to no. 3. Otherwise, create a directory on another partition
- and sym link it into /usr:
-
- # cd /usr/local
- # mkdir X11R6
- # ln -s /usr/local/X11R6 /usr/X11R6
-
-
- 3. Unpack everything:
-
- If you are using sh (as root usually does):
-
- # for i in X311*.tgz; do
- # tar -xzf $i
- # done
-
-
- Else, if you are using csh:
-
- % foreach i (X311*.tgz)
- % tar -xzf $i
- % end
-
-
- 4. Create a symbolic link ``X'' that points to the server that
- matches your video card. The XF86_* man pages list which vga
- chip sets are supported by each server. For example, if you
- have an ET4000 based card you will use the XF86_SVGA server:
-
- # cd /usr/X11R6/bin; rm X; ln -s XF86_SVGA X
-
-
-2.2. Minimal Install:
-----------------------
-
-First do numbers 1 and 2 above. Then unpack the required archives:
-
- # for i in bin fnts lib xicf; do
- # tar -xzf X311$i.tgz
- # done
-
-
-Then unpack a server archive corresponding to your vga card. The
-server man pages, X11R6/man/man1/XF86_*, list the vga chip sets
-supported by each server. For example, if you have an ET4000 based
-card you will use the XF86_SVGA server:
-
- # tar -xzf X311SVGA.tgz
- # cd /usr/X11R6/bin; rm X; ln -s XF86_SVGA X
-
-
-2.3. After either Full or Minimal Install above:
--------------------------------------------------
-
-Add /usr/X11R6/bin to the default path for sh in /etc/profile and for
-csh in /etc/csh.login if they are not already there:
-
- # echo 'set path = ($path /usr/X11R6/bin)' >>/etc/csh.login
- # echo 'PATH=$PATH:/usr/X11R6/bin' >>/etc/profile
-
-
-Or make sure all who use X put /usr/X11R6/bin in their shell's
-``path'' variable.
-
-Next either reboot or invoke ldconfig as root to put the shared
-libraries in ld.so's cache:
-
- # ldconfig /usr/lib /usr/local/lib /usr/X11R6/lib
-
-
-If you had already configured X11R6/lib/X11/xinit/xinitrc or
-X11R6/lib/X11/xdm/* omit the xinit-config or xdm-config archive or
-unpack it separately and merge in your customizations.
-
-The fscl and f100 archives are optional and can be omitted if you are
-short on space. The optional link archive allows you to reconfigure
-and customize a X server binary. The optional prog archive is needed
-only for writing or compiling X applications. The optional pex
-archive contains pex clients and libraries for building 3D graphics
-applications.
-
- NOTE: You don't need to uncompress the font files, but if
- you uncompress them anyway you must run mkfontdir in the
- corresponding font directory; otherwise your server will
- abort with the message ``could not open default font
- 'fixed'''.
-
-
-3. Installing The Display Manager (xdm)
-----------------------------------------
-
-The display manager makes your PC look like an X terminal. That is,
-it presents you with a login screen that runs under X.
-
-The easiest way to automatically start the display manager on boot is
-to add a line in /etc/ttys to start it on one of the unoccupied
-virtual terminals:
-
- ttyv4 "/usr/X11R6/bin/xdm -nodaemon" xterm on secure
-
-You should also make sure that /usr/X11R6/bin/X is a symbolic link to
-the Xserver that matches your video card or edit the file Xservers in
-/usr/X11R6/lib/X11/xdm to specify the pathname of the X server.
-
-The change to /etc/ttys won't take effect until you either reboot or
-``kill -HUP 1'' to force initd to reread /etc/ttys. You can also test
-the display manager manually by loging in as root on the console and
-typing ``xdm -nodaemon''.
-
-
-4. Configuring X for Your Hardware
------------------------------------
-
-The XF86Config file tells the X server what kind of monitor, video
-card and mouse you have. You must create it to tell the server what
-specific hardware you have.
-
-XFree86 3.1 uses a new configuration file format. Consult the
-XF86Config man page and the general INSTALL (INSTALL.html) file for
-instructions.
-
-If you have a Xconfig file for XFree86 2.x, use reconfig to translate
-part of it into the new format:
-
- # reconfig <Xconfig >XF86Config
-
-and complete the rest according to the XF86Config man page and the
-XF86Config.sample file as a template.
-
-In order to protect your hardware from damage, the server no longer
-will read XF86Config files from a user's home directory, but requires
-that it be in /etc/XF86Config, /usr/X11R6/lib/X11/XF86Config.hostname
-or /usr/X11R6/lib/X11/XF86Config.
-
-You'll need info on your hardware:
-
- o Your mouse type, baud rate and it's /dev entry.
-
- o The video card's chipset (e.g. ET4000, S3, etc).
-
- o Your monitor's sync frequencies.
-
-The easiest way to find which device your mouse is plugged into is to
-use ``cat'' or ``kermit'' to look at the output of the mouse. Connect
-to it and just make sure that it generates output when the mouse is
-moved or clicked:
-
- % cat < /dev/cuaa0
-
-If you can't find the right mouse device then use ``dmesg|grep sio''
-to get a list of devices that were detected upon booting:
-
- % dmesg|grep sio
- sio0 at 0x3f8-0x3ff irq 4 on isa
-
-Then double check the /dev entries corresponding to these devices.
-Use the script /dev/MAKEDEV to create entries if they don't already
-exist:
-
- % cd /dev
- % sh MAKEDEV cuaa0
-
-If you plan to fine tune the screen size or position on your monitor
-you'll need the specs for sync frequencies from your monitor's manual.
-
-
-5. Running X
--------------
-
-8mb of memory is a recommended minimum for running X. The server,
-window manager, display manager and an xterm take about 8Mb of virtual
-memory themselves. Even if their resident set size is smaller, on a
-8Mb system that leaves very space for other applications such as gcc
-that expect a few meg free. The R6 X servers may work with 4Mb of
-memory, but in practice compilation while running X can take 5 or 10
-times as long due to constant paging.
-
-The easiest way for new users to start X windows is to type ``startx
->& startx.log''. Error messages are lost unless you redirect them
-because the server takes over the screen.
-
-To get out of X windows, type: ``exit'' in the console xterm. You can
-customize your X by creating .xinitrc, .xserverrc, and .twmrc files in
-your home directory as described in the xinit and startx man pages.
-
-
-6. Rebuilding Kernels for X
-----------------------------
-
-The GENERIC FreeBSD 2.0 kernel supports XFree86 without any
-modifications required. You do not need to make any changes to the
-GENERIC kernel or any kernel configuration which is a superset.
-
-For a general description of BSD kernel configuration get
-smm.02.config.ps.Z
-(ftp://gatekeeper.dec.com/pub/BSD/manuals/smm.02.config.ps.Z). It is
-a ready-to-print postscript copy of the kernel configuration chapter
-from the system maintainers manual.
-
-If you do decide to reduce your kernel configuration file, do not
-remove the two lines below (in /sys/arch/i386/conf). They are both
-required for X support:
-
- options XSERVER #Xserver
- options UCONSOLE #X Console support
-
-The generic FreeBSD 2.0 kernel is configured by default with the
-syscons driver. To configure your kernel similarly it should have a
-line like this in /usr/src/sys/i386/conf/GENERIC:
-
- device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
-
-The maximum number of virtual consoles can be set using the MAXCONS
-option:
-
- options "MAXCONS=4" #4 virtual consoles
-
-
-Otherwise, the default without a line like this is 12. You must have
-more VTs than gettys as described in the end of section 3, and 4 is a
-reasonable minimum.
-
-The server supports several console drivers: pccons, syscons and pcvt.
-The syscons driver is the default in FreeBSD 1.1.5 and higher. They
-are detected at runtime and no configuration of the server itself is
-required.
-
-The pcvt console driver is bundled into FreeBSD and may be enabled
-by changing the `sc0' line in your kernel configuration file to
-`vt0'. See /sys/i386/conf/LINT for more details.
-
-The XFree86 servers include support for the MIT-SHM extension. The
-GENERIC kernel does not support this, so if you want to make use of
-this, you will need a kernel configured with SYSV shared memory
-support. To do this, add the following line to your kernel config
-file:
-
- options SYSVSHM # System V shared memory
- options SYSVSEM # System V semaphores
- options SYSVMSG # System V message queues
-
-
-If you are using a SoundBlaster 16 on IRQ 2 (9), then you need a patch
-for sb16_dsp.c. Otherwise a kernel configured with the SoundBlaster
-driver will claim interrupt 9 doesn't exist and X server will lock up.
-
-S3 cards and serial port COM 4 cannot be installed together on a
-system because the I/O port addresses overlap.
-
-
-7. Rebuilding XFree86
-----------------------
-
-The server link kit allows you to build an X server using a minimum
-amount of disk space. Just unpack it, make the appropriate changes to
-site.def, type ``./mkmf' and ``make'' to link the server. See
-README.LinkKit (LinkKit.html) for more info.
-
-The source tree takes about 114Mb before compiling and an additional
-100Mb after ``make World''. You should configure the distribution by
-editing xf86site.def and site.def in xc/config/cf before compiling.
-By default, the config files are set up to build shared libraries. If
-you are running a version of FreeBSD that doesn't include shared
-library support, add the following line to site.def:
-
- #define BuildBsdSharedLibs NO
-
-If your system doesn't have support or SYSV shared memory (for
-example, if you don't have the <sys/shm.h> header), you should disable
-the MIT-SHM extension by adding the following line to site.def:
-
- #define HasShm NO
-
-To compile the sources on FreeBSD 1.1 and later, type:
-
- make World
-
-
-8. Building Other X Clients
-----------------------------
-
-The easiest way to build a new client (X application) is to use xmkmf
-if an Imakefile is included with it. Type ``xmkmf -a'' to create the
-Makefiles, then type ``make''. Whenever you install additional man
-pages you should update whatis.db by running ``makewhatis
-/usr/X11R6/man''.
-
-Note: Starting with XFree86 2.1 and FreeBSD 1.1, the symbol __386BSD__
-no longer gets defined either by the compiler or via the X config
-files for FreeBSD systems. When porting clients to BSD systems, make
-use of the symbol BSD for code which is truly BSD-specific. The value
-of the symbol can be used to distinguish different BSD releases. For
-example, code specific to the Net-2 and later releases can use:
-
- #if (BSD >= 199103)
-
-To ensure that this symbol is correctly defined, include <sys/param.h>
-in the source that requires it. Note that the symbol CSRG_BASED is
-defined for *BSD systems in XFree86 3.1.1 and later. This should be
-used to protect the inclusion of <sys/param.h>.
-
-For code that really is specific to a particular i386 BSD port, use
-__FreeBSD__ for FreeBSD, __NetBSD__ for NetBSD, __386BSD__ for 386BSD,
-and __bsdi__ for BSD/386.
-
-
-9. Thanks
-----------
-
-Many thanks to:
-
- o Pace Willison for providing initial *BSD support.
-
- o Amancio Hasty for 386BSD kernel and S3 chipset support.
-
- o David Greenman, Nate Williams, Jordan Hubbard for FreeBSD kernel
- support.
-
- o Rod Grimes, Jordan Hubbard and Jack Velte for the use of Walnut
- Creek Cdrom's hardware.
-
- o Orest Zborowski, Simon Cooper and Dirk Hohndel for ideas from
- the Linux distribution.
-
-$XConsortium: FreeBSD.sgml,v 1.3 95/01/23 15:34:41 kaleb Exp $
-Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/FreeBSD.sgml,v 3.10 1995/01/28 16:01:28 dawes Exp $
-
-
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/READ.FreeBSD,v 3.12 1995/01/28 16:19:37 dawes Exp $
diff --git a/release/sysinstall/help/en_US.ISO_8859-1/configure.hlp b/release/sysinstall/help/en_US.ISO_8859-1/configure.hlp
deleted file mode 100644
index 2d14031..0000000
--- a/release/sysinstall/help/en_US.ISO_8859-1/configure.hlp
+++ /dev/null
@@ -1,14 +0,0 @@
-This menu allows you to configure your system after the installation process
-is complete. At the minimum, you should probably set the system manager's
-password and the system time zone.
-
-For extra goodies like bash, emacs, pascal, etc., you should look at the
-Packages item in this menu. Currently, the Packages option is only useful
-if you have a CDROM or an existing packages collection somewhere in the
-file system hierarchy where the package management tool can locate it.
-The automatic transfer of packages via FTP is not yet supported!
-
-If you wish to re-invoke the package installation tool after leaving
-the system installation, the command is ``pkg_manage''. For setting
-the timezone, type ``tzsetup''. For more information on the general
-system configuration, see the ``/etc/sysconfig'' file.
diff --git a/release/sysinstall/help/en_US.ISO_8859-1/distributions.hlp b/release/sysinstall/help/en_US.ISO_8859-1/distributions.hlp
deleted file mode 100644
index b81efbf..0000000
--- a/release/sysinstall/help/en_US.ISO_8859-1/distributions.hlp
+++ /dev/null
@@ -1,88 +0,0 @@
-An ``X-'' prefixed before a distribution set means that the XFree86
-3.1.1u1 base distribution, libraries, manual pages, SVGA server and a
-set of default fonts will be selected in addition to the set itself.
-
-If you select such a set, you will also be presented with a set of
-menus for customizing the selections to your desired X Window System
-setup.
-
-N.B. All references in this document to `complete source' mean the
-complete source tree minus any legally encumbered cryptography code.
-
-The current "canned" installations are as follows:
-
-Developer: Base ("bin") distribution, man pages, dictionary
- files, profiling libraries and the complete source tree.
-
-
-Kern-Developer: As above, but with only kernel sources instead of
- the complete source tree.
-
-
-User: The base distribution, man pages, dictionary files and
- the FreeBSD 1.x and 2.0 compatibility sets.
-
-
-Minimal: Only the base distribution.
-
-
-Everything: The base distribution, man pages, dictionary files,
- profiling libraries, the FreeBSD 1.x and the FreeBSD 2.0
- compatibility libraries, the complete source tree,
- games and your choice of XFree86 distribution components.
- N.B. Still no cryptocraphy source code!
-
-
-Custom: Allows you to modify or create your distribution set on
- a piece-by-piece basis.
-
-
-Reset: Clear all currently selected distributions.
-
-
----
-
-When using Custom, most of the sub-distribution choices are fairly
-obvious, though two possible exceptions may be the "commerce" and
-"xperimnt" distributions:
-
- * The "commerce" directory, as its name implies, is devoted to
- commercial offerings. This includes commercial products released
- under special arrangement, limited functionality demos, shareware
- products (you like it, you buy it), etc.
-
- At the time of this writing, there are unfortunately not enough
- commercial offerings to justify a fully split distribution set,
- so each product is available both as a subdirectory and as part
- of one large archive file. If you select "commerce" from the
- distributions submenus then you'll get the big file containing
- the entire collection copied to your hard disk. Don't do this
- unless you've got at least 10MB to devote to it!
-
-
- * The "xperimnt" directory contains, not surprisingly, experimental
- offerings. Unfinished (or work-in-progress) features, special
- purpose drivers and packages, strange proof-of-concept stuff,
- it's a mixed bag! Select this item on a distribution menu and
- you'll get the whole collection (between 10 and 30MB).
-
-
- If you're installing from CDROM then all of the commercial and
- "experimental" offerings are also easily available in their
- individual subdirectories and can be copied to hard disk at
- any time.
-
-
-You may also notice that certain distributions, like "des" and "krb",
-are marked "NOT FOR EXPORT!" This is because it's illegal to
-export them from the United States (or any other country which
-considers encryption technology to be on its restricted export
-list). Since breaking this law only gets the _originating_ site
-(US!) in trouble, please do not load these distributions from U.S.
-servers!
-
-A number of "foreign" servers do exist for the benefit of
-non-U.S. sites, one of which is "skeleton.mikom.csir.co.za".
-
-Please get all such export restricted software from there
-if you are outside the U.S., thanks!
diff --git a/release/sysinstall/help/en_US.ISO_8859-1/drives.hlp b/release/sysinstall/help/en_US.ISO_8859-1/drives.hlp
deleted file mode 100644
index d924f8d..0000000
--- a/release/sysinstall/help/en_US.ISO_8859-1/drives.hlp
+++ /dev/null
@@ -1,28 +0,0 @@
-If you are going to actually install some portion of FreeBSD on a
-drive then PLEASE BE VERY CERTAIN that the Geometry reported in the
-Partition Editor (see Installation Menu) is the correct one for your
-drive and controller combination!
-
-IDE drives often have a certain geometry set during the PC BIOS setup,
-or (in the case of larger IDE drives) have their geometry "remapped"
-by either the IDE controller or a special boot-sector translation
-utility such as that by OnTrack Systems. In these cases, knowing
-the correct geometry gets even more complicated as it's not something
-you can easily tell by looking at the drive or the PC BIOS setup. The
-best way of verifying that your geometry is being correctly calculated
-in such situations is to boot DOS (from the hard disk, not a floppy!)
-and run the ``pfdisk'' utility provided in the tools/ subdirectory of the
-FreeBSD CDROM or FTP site. It will report the geometry that DOS sees,
-which is generally the correct one.
-
-If you have no DOS partition sharing the disk at all, then you may find that
-you have better luck with Geometry detection if you create a very small
-DOS partition first, before installing FreeBSD. Once FreeBSD is installed
-you can always delete it again if you need the space.
-
-It's actually not a bad idea (believe it or not) to have a small bootable
-DOS partition on your FreeBSD machine anyway: Should the machine become
-unstable or exhibit strange behavior at some point in the future (which
-is not uncommon behavior for PC hardware!) you can then at least use
-DOS for installing and running one of the commercially available system
-diagnostic utilities.
diff --git a/release/sysinstall/help/en_US.ISO_8859-1/hardware.hlp b/release/sysinstall/help/en_US.ISO_8859-1/hardware.hlp
deleted file mode 100644
index fba5633..0000000
--- a/release/sysinstall/help/en_US.ISO_8859-1/hardware.hlp
+++ /dev/null
@@ -1,384 +0,0 @@
-Hardware Documentation Guide: $Id: hardware.hlp,v 1.11 1995/06/09 13:29:19 jkh Exp $
-
-Table of Contents
------------------
-
-0. Document Conventions
-1. Using UserConfig to change FreeBSD kernel settings
-2. Default Configuration (GENERIC kernel)
-3. LINT - other possible configurations.
-4. Known Hardware Problems.
-
-=========================================================================
-
-0. Document Conventions
--- --------------------
-
-We have `underlined' text which represents user input with `-'
-symbols throughout this document to differentiate it from
-the machine output.
-
-1. Using UserConfig to change FreeBSD kernel settings
--- --------------------------------------------------
-
-The UserConfig utility allows you to override various settings of
-the FreeBSD kernel before the system has booted. This allows you to
-make minor adjustments to the various drivers in the system without
-necessarily having to recompile the kernel.
-
-UserConfig is activated by specifying the `-c' flag at the initial
-boot prompt. For example:
-
- >> FreeBSD BOOT @ 0x10000: 640/7168 k of memory
- Use hd(1,a)/kernel to boot sd0 when wd0 is also installed.
- Usage: [[wd(0,a)]/kernel][-abcCdhrsv]
- Use ? for file list or press Enter for defaults
-
- Boot: -c
- --
-
-This command causes the system to boot the default kernel ("/kernel") and
-the UserConfig utility to be started once the kernel is loaded into memory.
-
-The `-c' flag follows any of the other parameters you may need to provide
-for the system to boot properly. For example, to boot off the second of
-two SCSI drives installed and run UserConfig, you would type:
-
- Boot: sd(1,a)/kernel -c
- -----------------
-
-As always, the kernel will report some information on your processor
-and how much memory your system has. Then UserConfig will be invoked
-and you will see the prompt:
-
- config>
-
-To see the list of commands that UserConfig accepts, you may type '?' and
-press [ENTER]. The help message looks something like this:
-
-Command Description
-------- -----------
-attach <devname> Return results of device attach
-ls List currently configured devices
-port <devname> <addr> Set device port (i/o address)
-irq <devname> <number> Set device irq
-drq <devname> <number> Set device drq (DMA Request)
-iomem <devname> <addr> Set device maddr (memory address)
-iosize <devname> <size> Set device memory size
-flags <devname> <mask> Set device flags
-enable <devname> Enable device
-probe <devname> Return results of device probe
-disable <devname> Disable device (will not be probed)
-quit Exit this configuration utility
-help This message
-
-
-You may alter nearly all of the default settings present in the FreeBSD
-generic kernel. This includes reassigning IRQs, disabling troublesome
-devices (or drivers that conflict with the hardware your system has),
-setting special device flags, etc.
-
-The most common use of UserConfig is to adjust or disable a driver
-which is causing trouble. The "ls" command displays the current
-settings for all the drivers present in the booted kernel, and
-once you have located an entry of interest you may use the displayed
-device name to change its settings or even disable the driver completely.
-
-For example, to change the memory address of network adapter 'ed0' to
-the address 0xd4000, you would type
-
- config> iomem ed0 0xd4000
- -----------------
-
-To entirely disable a device driver you are not using, use the
-"disable" command. In this example, you would disable device
-`ie0' by typing:
-
- config> disable ie0
- -----------
-
-You can use the "ls" command to verify your changes and correct
-any other problems before continuing the boot process.
-
-Once you are happy with a given configuration you may type: "quit"
-
-This will cause the kernel to boot with the new settings you
-have chosen.
-
-Once you have a fully installed system (e.g. the `bin' distribution
-has been successfully extracted), any changes you make in UserConfig
-are permanently stored in the `/kernel' file on the root filesystem.
-This action is performed by the `dset' utility, which will ensure that
-these settings remain in effect until you replace the kernel with
-a new one. If you do not want your changes to be permanently
-stored like this, remove `dset' from the /etc/rc file before you
-make any changes.
-
-If you accidentally change a setting for a device that you did not mean
-to change, the safest thing to do is to reset the computer and start
-over. Do not allow the boot to proceed (e.g. do not type "quit") with
-bad settings as these may be permanently stored by dset and
-leave your system in a state where it will no longer run properly.
-
-We suggest as a general rule that you disable any drivers that are not
-used by your particular hardware configuration. There are known problems
-with certain device drivers (see section 4.0) that can cause conflicts
-with other devices if they're also not disabled. You should move or
-disable any device that resides at the same port or IRQ as a device
-you actually have!
-
-You can also remove drivers that are not needed by building yourself a
-custom kernel that contains only the device drivers which your system
-really needs (see section 6.0 of the FreeBSD.FAQ). If your system has
-sufficient free disk space to store and compile the kernel sources,
-this is the option we most highly recommend.
-
-
-
-2. Default (GENERIC) Configuration
--- -------------------------------
-
-The following table contains a list of all of the devices that are present
-in the GENERIC kernel, which is the kernel (the operating system) that was
-placed on your computer during the FreeBSD installation process.
-(A compressed version of the GENERIC kernel is also used on the
-installation floppy diskettes.)
-
-The table describes the various parameters used by the driver to communicate
-with the hardware in your system. There are four parameters in the
-table, but not all are used by each device. They are:
-
- Port the starting I/O port used by the device, shown in hexadecimal.
-
- IOMem the lowest (or starting) memory address used by the device,
- also shown in hexadecimal.
-
- IRQ the interrupt the device uses to alert the driver to an event,
- given in decimal.
-
- DRQ the DMA (direct memory access) channel the device uses to move
- data to and from main memory, also given in decimal.
-
-If an entry in the table has `n/a' for the value, it means that the
-parameter does not apply to that device. A value of `dyn' means that the
-correct value should be determined automatically by the kernel when the
-system boots.
-
-
-FreeBSD GENERIC kernel:
-
- Port IRQ DRQ IOMem Description
- ---- --- --- ----- ---------------------------------
-fdc0 3f0 6 2 n/a Floppy disk controller
-wdc0 1f0 14 n/a n/a IDE/MFM/RLL disk controller
-wdc1 170 15 n/a n/a IDE/MFM/RLL disk controller
-
-ncr0 n/a n/a n/a n/a NCR PCI SCSI controller
-ahc0 n/a n/a n/a n/a Adaptec 294x PCI SCSI controller
-bt0 330 dyn dyn dyn Buslogic SCSI controller
-uha0 330 dyn 6 dyn Ultrastore 14f
-ahc1 dyn dyn dyn dyn Adaptec 274x/284x SCSI controller
-ahb0 dyn dyn dyn dyn Adaptec 174x SCSI controller
-aha0 330 dyn 5 dyn Adaptec 154x SCSI controller
-aic0 340 11 dyn dyn Adaptec 152x/AIC-6360 SCSI
- controller
-nca0 1f88 10 dyn dyn ProAudioSpectrum cards
-nca1 350 5 dyn dyn ProAudioSpectrum cards
-sea0 dyn 5 dyn c8000 Seagate ST01/02 8 bit controller
-
-wt0 300 5 1 dyn Wangtek and Archive QIC-02/QIC-36
-
-mcd0 300 10 n/a n/a Mitsumi CD-ROM
-mcd1 340 11 n/a n/a Mitsumi CD-ROM
-
-matcd0 dyn n/a n/a n/a Matsushita/Panasonic CD-ROM
-
-scd0 230 n/a n/a n/a Sony CD-ROM
-
-sio0 3f8 4 n/a n/a Serial Port 0 (COM1)
-sio1 2f8 3 n/a n/a Serial Port 1 (COM2)
-sio2 3e8 5 n/a n/a Serial Port 2 (COM3)
-sio3 2e8 9 n/a n/a Serial Port 3 (COM4)
-
-lpt0 dyn 7 n/a n/a Printer Port 0
-lpt1 dyn dyn n/a n/a Printer Port 1
-lpt2 dyn dyn n/a n/a Printer Port 2
-
-de0 DEC DC21x40 PCI based cards
- (including 21140 100bT cards)
-ed0 280 5 dyn d8000 WD & SMC 80xx; Novell NE1000 &
- NE2000; 3Com 3C503
-ed1 300 5 dyn d8000 Same as ed0
-eg0 310 5 dyn dyn 3Com 3C505
-ep0 300 10 dyn dyn 3Com 3C509
-ie0 360 7 dyn d0000 AT&T StarLAN 10 and EN100;
- 3Com 3C507; NI5210
-ix0 300 10 dyn d0000 Intel EtherExpress cards
-le0 300 5 dyn d0000 Digital Equipment EtherWorks
- 2 and EtherWorks 3
-lnc0 280 10 n/a dyn Lance/PCnet cards
- (Isolan, Novell NE2100, NE32-VL)
-lnc1 300 10 n/a dyn See lnc0
-ze0 300 5 dyn d8000 IBM/National Semiconductor
- PCMCIA Ethernet Controller
-zp0 300 10 dyn d8000 3Com PCMCIA Etherlink III
- Ethernet Controller
---- End of table ---
-
-
-If the hardware in your computer is not set to the same settings as
-those shown in this table and the item is not marked 'dyn', you will
-have to either reconfigure your hardware, or use UserConfig ('-c' boot
-option) to reconfigure the kernel to match the way your hardware is
-currently set (see section 1.0).
-
-If the settings do not match, the kernel may be unable to locate
-or reliably access the devices in your system.
-
-
-
-3. LINT - other possible configurations
--- ------------------------------------
-
-The following drivers are not in the GENERIC kernel but remain
-available to those who do not mind compiling a custom kernel (see
-section 6 of FreeBSD.FAQ). The LINT configuration file
-(/sys/i386/conf/LINT) also contains prototype entries for just about
-every device supported by FreeBSD and is a good general reference.
-
-The device names and a short description of each are listed below. The port
-numbers, etc, are not meaningful here since you will need to compile a
-custom kernel to gain access to these devices anyway and can thus
-adjust the addresses to match the hardware in your computer in the process.
-The LINT file contains prototype entries for all of the below which you
-can easily cut-and-paste into your own file (or simply copy LINT and edit
-it to taste):
-
-apm: Laptop Advanced Power Management (experimental)
-ctx: Cortex-I frame grabber
-cx: Cronyx/Sigma multiport sync/async
-cy: Cyclades high-speed serial driver
-el: 3Com 3C501
-fe: Fujitsu MB86960A/MB86965A Ethernet cards
-fea: DEV DEFEA EISA FDDI adater
-fpa: DEC DEFPA PCI FDDI adapter
-gp: National Instruments AT-GPIB and AT-GPIB/TNT board
-gsc: Genius GS-4500 hand scanner
-gus: Gravis Ultrasound - Ultrasound, Ultrasound 16, Ultrasound MAX
-gusmax: Gravis Ultrasound MAX (currently broken)
-gusxvi: Gravis Ultrasound 16-bit PCM
-joy: Joystick
-labpc: National Instrument's Lab-PC and Lab-PC+
-mpu: Roland MPU-401 stand-alone card
-mse: Logitech & ATI InPort bus mouse ports
-mss: Microsoft Sound System
-nic: Dr Neuhaus NICCY 3008, 3009 & 5000 ISDN cards
-opl: Yamaha OPL-2 and OPL-3 FM - SB, SB Pro, SB 16, ProAudioSpectrum
-pas: ProAudioSpectrum PCM and MIDI
-pca: PCM audio ("/dev/audio") through your PC speaker
-psm: PS/2 mouse port
-rc: RISCom/8 multiport card
-sb: SoundBlaster PCM - SoundBlaster, SB Pro, SB16, ProAudioSpectrum
-sbmidi: SoundBlaster 16 MIDI interface
-sbxvi: SoundBlaster 16
-spigot: Create Labs Video Spigot video-acquisition board
-uart: Stand-alone 6850 UART for MIDI
-wds: Western Digital WD7000 IDE
-
---- end of list ---
-
-
-4. Known Hardware Problems, Q & A:
--- -------------------------------
-
-Q: mcd0 keeps thinking that it has found a device and this stops my Intel
- EtherExpress card from working.
-
-A: Use the UserConfig utility (see section 1.0) and disable the probing of
- the mcd0 and mcd1 devices. Generally speaking, you should only leave
- the devices that you will be using enabled in your kernel.
-
-
-Q: The system finds my ed network card, but I keep getting device
- timeout errors.
-
-A: Your card is probably on a different IRQ from what is specified in the
- kernel configuration. The ed driver will no longer use the `soft'
- configuration by default (values entered using EZSETUP in DOS), but it
- will use the software configuration if you specify `?' in the IRQ field
- of your kernel config file. The reason for the change is because the
- ed driver used to read and try to use the soft configuration information
- even when the card was jumpered to use a hard configuration, and this
- caused problems.
-
- Either move the jumper on the card to a hard configuration setting
- (altering the kernel settings if necessary), or specify the IRQ as
- `-1' in UserConfig or `?' in your kernel config file. This will
- tell the kernel to use the soft configuration.
-
- Another possibility is that your card is at IRQ 9, which is shared
- by IRQ 2 and frequently a cause of problems (especially when you
- have a VGA card using 2! :). You should not use IRQ 2 or 9 if at
- all possible.
-
-
-Q: I go to boot from the hard disk for the first time after installing
- FreeBSD, but the Boot Manager prompt just prints `F?' at the boot menu
- each time but the boot won't go any further.
-
-A: The hard disk geometry was set incorrectly in the Partition editor when
- you installed FreeBSD. Go back into the partition editor and specify
- the actual geometry of your hard disk. You must reinstall FreeBSD
- again from the beginning with the correct geometry.
-
- If you are failing entirely in figuring out the correct geometry for
- your machine, here's a tip: Install a small DOS partition at the
- beginning of the disk and install FreeBSD after that. The install
- program will see the DOS partition and try to infer the correct
- geometry from it, which usually works.
-
-
-Q: I have a Matsushita/Panasonic CD-ROM drive but it isn't recognized
- by the system, even if I use UserConfig to change the Port address to
- 630, which is what my card uses.
-
-A: Not all of the companies that sell the Matsushita/Panasonic CR-562
- and CR-563 drives use the same I/O ports and interface that the
- matcd driver in FreeBSD expects. The only adapters that are supported
- at this time are those that are 100% compatible with the Creative
- Labs (SoundBlaster) host interface. See matcd.4 documentation for a
- list of host adapters that are known to work.
-
-
-Q: I'm trying to install from a tape drive but all I get is something like:
- st0(aha0:1:0) NOT READY csi 40,0,0,0
- on the screen. Help!
-
-A: There's a limitation in the current sysinstall that the tape MUST
- be in the drive while sysinstall is started or it won't be detected.
- Try again with the tape in the drive the whole time.
-
-
-Q: I've installed FreeBSD onto my system, but it hangs when booting from
- the hard drive with the message: ``Changing root to /dev/sd0a''.
-
-A: This problem may occur in a system with a 3com 3c509 ethernet adaptor.
- The ep0 device driver appears to be sensitive to probes for other
- devices that also use address 0x300. Boot your FreeBSD system by power
- cycling the machine (turn off and on). At the ``Boot:'' prompt specify
- the ``-c''. This will invoke UserConfig (see Section 1. above). Use
- the ``disable'' command to disable the device probes for all devices
- at address 0x300 except the ep0 driver. On exit, your machine should
- successfully boot FreeBSD.
-
-
-Q: My system hangs during boot, right after the "fd0: [my floppy drive]"
- line.
-
-A: This is not actually a hang, simply a very LONG "wdc0" probe that
- often takes a long time to complete on certain systems (where there
- usually _isn't_ a WD controller). Be patient, your system will boot!
- To eliminate the problem, boot with the -c flag and eliminate the wdc0
- device, or compile a custom kernel.
-
-[ Please add more hardware tips to this Q&A section! ]
diff --git a/release/sysinstall/help/en_US.ISO_8859-1/install.hlp b/release/sysinstall/help/en_US.ISO_8859-1/install.hlp
deleted file mode 100644
index 945c81b..0000000
--- a/release/sysinstall/help/en_US.ISO_8859-1/install.hlp
+++ /dev/null
@@ -1,447 +0,0 @@
- INSTALLATION GUIDE FOR FreeBSD 2.0.5
-
-This manual documents the process of installing FreeBSD on your
-machine. Please also see the Hardware Guide for hardware-specific
-installation instructions (how to configure your hardware, what sorts
-of things to watch out for, etc) before starting a new installation.
-
-
-Table of Contents:
-==================
-
-1.0 DOS User's Q&A section.
- 1.1 How do I make space for FreeBSD?
- 1.2 Can I use compressed DOS filesystems from FreeBSD?
- 1.3 Can I use DOS extended partitions?
- 1.4 Can I run DOS executables under FreeBSD?
-
-2.0 Preparing for the installation.
- 2.1 Before installing from CDROM
- 2.2 Before installing from Floppy
- 2.3 Before installing from a DOS partition
- 2.4 Before installing from QIC/SCSI tape
- 2.5 Before installing over a network
- 2.5.1 Preparing for NFS Installation
- 2.5.2 Preparing for FTP Installation
-
-3.0 Installing FreeBSD.
-
-
-
-1.0 DOS user's Question and Answer section
-=== ======================================
-
-1.1 Help! I have no space! Do I need to delete everything first?
-
-If your machine is already running DOS and has little or no free space
-available for FreeBSD's installation, all is not lost! You may find
-the "FIPS" utility, provided in the tools/ subdirectory on the FreeBSD
-CDROM or on the various FreeBSD ftp sites, to be quite useful.
-
-FIPS allows you to split an existing DOS partition into two pieces,
-preserving the original partition and allowing you to install onto the
-second free piece. You first "defrag" your DOS partition, using the
-DOS 6.xx "DEFRAG" utility or the Norton Disk tools, then run FIPS. It
-will prompt you for the rest of the information it needs. Afterwards,
-you can reboot and install FreeBSD on the new free slice. See the
-Distributions menu for an estimation of how much free space you'll
-need for the kind of installation you want.
-
-
-1.2 Can I use compressed DOS filesystems from FreeBSD?
-
-No. If you are using a utility such as Stacker(tm) or DoubleSpace(tm),
-FreeBSD will only be able to use whatever portion of the filesystem
-you leave uncompressed. The rest of the filesystem will show up as
-one large file (the stacked/dblspaced file!). DO NOT REMOVE THAT
-FILE! You will probably regret it greatly!
-
-It is probably better to create another uncompressed DOS primary
-partition and use this for communications between DOS and FreeBSD.
-
-
-1.3 Can I mount my DOS extended partitions?
-
-This feature isn't in FreeBSD 2.0.5 but should be in 2.1. We've laid
-all the groundwork for making this happen, now we just need to do the
-last 1% of the work involved.
-
-
-1.4 Can I run DOS binaries under FreeBSD?
-
-Not yet! We'd like to add support for this someday, but are still
-lacking anyone to actually do the work. Ongoing work with Linux's
-DOSEMU utility may bring this much closer to being a reality sometime
-soon. Send mail to hackers@freebsd.org if you're interested in
-joining this effort!
-
-However, there is a neat utility called "pcemu" in the ports collection
-which emulates an 8088 and enough BIOS services to run DOS text mode
-applications. It requires the X Window System (provided as
-XFree86 3.1.1u1).
-
-
-
-2.0 Preparing for the installation
-=== ==============================
-
-2.1 Before installing from CDROM:
-
-If your CDROM is of an unsupported type, such as an IDE CDROM, then
-please skip to section 2.3: Before installing from a DOS partition.
-
-There is not a lot of preparatory work that needs to be done to
-successfully install from one of Walnut Creek's FreeBSD CDROMs (other
-CDROM distributions may work as well, we simply cannot say as we
-have no hand or say in their creation). You can either boot into the
-CD installation directly from DOS using Walnut Creek's supplied
-``install.bat'' batch file or you can make a boot floppy with
-the ``makeflp.bat'' command.
-
-For the easiest interface of all (from DOS), type "go". This
-will bring up a DOS menu utility that leads you through all
-the available options.
-
-If you're creating the boot floppy from a UNIX machine, you may find
-that ``dd if=floppies/boot.flp of=/dev/rfd0'' or
-``dd if=floppies/boot.flp of=/dev/floppy'' works well, depending on
-your hardware and operating system environment.
-
-Once you've booted from DOS or floppy, you should then be able to select
-CDROM as the media type in the Media menu and load the entire
-distribution from CDROM. No other types of installation media should
-be required.
-
-After your system is fully installed and you have rebooted from the
-hard disk, you should find the CD mounted on the directory /cdrom. A
-utility called `lndir' comes with the XFree86 distribution which you
-may also find useful: It allows you to create "link tree" directories
-to things on Read-Only media like CDROM. One example might be
-something like this:
-
- mkdir /usr/ports
- lndir /cdrom/ports /usr/ports
-
-Which would allow you to then "cd /usr/ports; make" and get all the
-sources from the CD, but yet create all the intermediate files in
-/usr/ports, which is presumably on a more writable media! :-)
-
-SPECIAL NOTE: Before invoking the installation, be sure that the
-CDROM is in the drive so that the "probe" can find it!
-This is also true if you wish the CDROM to be added to the default
-system configuration automatically during the install (whether or
-not you actually use it as the installation media). This will be
-fixed for 2.1, but for now this simple work-around will ensure that
-your CDROM is detected properly.
-
-Finally, if you would like people to be able to FTP install
-FreeBSD directly from the CDROM in your machine, you'll find
-it quite easy. After the machine is fully installed, you simply
-need to add the following line to the password file (using
-the vipw command):
-
- ftp:*:99:99::0:0:FTP:/cdrom:/nonexistent
-
-No further work is necessary. The other installers will now be able
-to chose a Media type of FTP and type in: ftp://<your machine>
-after picking "Other" in the ftp sites menu!
-
-
-2.2 Before installing from Floppy:
-
-If you must install from floppy disks, either due to unsupported
-hardware or just because you enjoy doing things the hard way, you must
-first prepare some floppies for the install.
-
-The first floppy you'll need is ``floppies/root.flp'', which is
-somewhat special in that it's not a DOS filesystem floppy at all, but
-rather an "image" floppy (it's actually a gzip'd cpio file). You can
-use the rawrite.exe program to do this under DOS, or ``dd'' to do it
-on a UNIX Workstation (see notes in section 2.1 concerning the
-``floppies/boot.flp'' image). Once this floppy is made, go on
-to make the distribution set floppies:
-
-You will need, at minimum, as many 1.44MB or 1.2MB floppies as it takes
-to hold all files in the bin (binary distribution) directory. THESE
-floppies *must* be formatted using MS-DOS, using the FORMAT command in
-MS-DOS or the File Manager format command in Microsoft Windows(tm).
-Don't trust Factory Preformatted floppies! Format them again yourself,
-just to make sure!
-
-Many problems reported by our users in the past have resulted from the
-use of improperly formatted media, so we simply take special care to
-mention it here!
-
-After you've DOS formatted the floppies, you'll need to copy the files
-onto them. The distribution files are split into chunks conveniently
-sized so that 5 of them will fit on a conventional 1.44MB floppy. Go
-through all your floppies, packing as many files as will fit on each
-one, until you've got all the distributions you want packed up in this
-fashion. Each distribution should go into a subdirectory on the
-floppy, e.g.: a:\bin\bin.aa, a:\bin\bin.ab, ...
-
-Once you come to the Media screen of the install, select
-"Floppy" and you'll be prompted for the rest.
-
-
-2.3 Before installing from a DOS partition:
-
-To prepare for installation from an MS-DOS partition you should
-simply copy the files from the distribution into a directory called
-"FREEBSD". For example, to do a minimal installation of FreeBSD from
-DOS using files copied from the CDROM, you might do something like
-this:
-
- C> MD C:\FREEBSD
- C> XCOPY /S E:\DISTS\BIN C:\FREEBSD
- C> XCOPY /S E:\FLOPPIES C:\FREEBSD
-
-Asssuming that `C:' was where you had free space and `E:' was where
-your CD was mounted. Note that you need the FLOPPIES directory
-because the `root.flp' image is automatically looked for there when
-you're doing a DOS installation.
-
-For as many `DISTS' as you wish to install from DOS (and you have free
-space for), install each one under `C:\FREEBSD' - the BIN dist is only
-the minimal requirement.
-
-
-2.4 Before installing from QIC/SCSI Tape:
-
-Installing from tape is probably the easiest method, short of an
-on-line install using FTP or a CDROM install. The installation program
-expects the files to be simply tar'ed onto the tape, so after getting
-all of the files for distribution you're interested in, simply tar
-them onto the tape with a command like:
-
- cd /freebsd/distdir
- tar cvf /dev/rwt0 (or /dev/rst0) dist1 .. dist2
-
-Make sure that the `floppies/' directory is one of the "dists" given
-above, since the installation will look for `floppies/root.flp' on
-the tape.
-
-When you go to do the installation, you should also make sure that you
-leave enough room in some temporary directory (which you'll be allowed
-to choose) to accommodate the FULL contents of the tape you've
-created. Due to the non-random access nature of tapes, this method of
-installation requires quite a bit of temporary storage! You should
-expect to require as much temporary storage as you have stuff written
-on tape.
-
-SPECIAL NOTE: When going to do the installation, the tape must be in
-the drive *before* booting from the boot floppy. The installation
-"probe" may otherwise fail to find it.
-
-
-2.5 Before installing over a network:
-
-You can do network installations over 3 types of communications links:
-
- Serial port: SLIP / PPP
- Parallel port: PLIP (laplink cable)
- Ethernet: A standard ethernet controller (includes some PCMCIA).
-
-SLIP support is rather primitive, and limited primarily to hard-wired
-links, such as a serial cable running between a laptop computer and
-another computer. The link should be hard-wired as the SLIP
-installation doesn't currently offer a dialing capability; that
-facility is provided with the PPP utility, which should be used in
-preference to SLIP whenever possible.
-
-If you're using a modem, then PPP is almost certainly your only
-choice. Make sure that you have your service provider's information
-handy as you'll need to know it fairly soon in the installation
-process. You will need to know, at the minimum, your service
-provider's IP address and possibly your own (though you can also leave
-it blank and allow PPP to negotiate it with your ISP). You also need
-to know how to use the various "AT commands" to dial the ISP with your
-particular modem as the PPP dialer provides only a very simple
-terminal emulator.
-
-If a hard-wired connection to another FreeBSD (2.0R or later) machine
-is available, you might also consider installing over a "laplink"
-parallel port cable. The data rate over the parallel port is much
-higher than what is typically possible over a serial line (up to
-50k/sec), thus resulting in a quicker installation.
-
-Finally, for the fastest possible network installation, an ethernet
-adaptor is always a good choice! FreeBSD supports most common PC
-ethernet cards, a table of supported cards (and their required
-settings) is provided as part of the FreeBSD Hardware Guide - see the
-Documentation menu on the boot floppy. If you are using one of the
-supported PCMCIA ethernet cards, also be sure that it's plugged in
-_before_ the laptop is powered on! FreeBSD does not, unfortunately,
-currently support "hot insertion" of PCMCIA cards.
-
-You will also need to know your IP address on the network, the
-"netmask" value for your address class, and the name of your machine.
-Your system administrator can tell you which values to use for your
-particular network setup. If you will be referring to other hosts by
-name rather than IP address, you'll also need a name server and
-possibly the address of a gateway (if you're using PPP, it's your
-provider's IP address) to use in talking to it. If you do not know
-the answers to all or most of these questions, then you should
-really probably talk to your system administrator _first_ before
-trying this type of installation!
-
-Once you have a network link of some sort working, the installation
-can continue over NFS or FTP.
-
-2.5.1 Preparing for NFS installation:
-
- NFS installation is fairly straight-forward: Simply copy the
- FreeBSD distribution files you want onto a server somewhere
- and then point the NFS media selection at it.
-
- If this server supports only "privileged port" access (as is
- generally the default for Sun workstations), you will need to set
- this option in the Options menu before installation can proceed.
-
- If you have a poor quality ethernet card which suffers from very
- slow transfer rates, you may also wish to toggle the appropriate
- Options flag.
-
- In order for NFS installation to work, the server must support
- "subdir mounts"; e.g., if your FreeBSD 2.0.5 distribution directory
- lives on: ziggy:/usr/archive/stuff/FreeBSD
- Then ziggy will have to allow the direct mounting of
- /usr/archive/stuff/FreeBSD, not just /usr or /usr/archive/stuff.
-
- In FreeBSD's /etc/exports file, this is controlled by the
- ``-alldirs'' option. Other NFS servers may have different
- conventions. If you are getting `Permission Denied' messages
- from the server then it's likely that you don't have this
- enabled properly!
-
-
-2.5.2 Preparing for FTP Installation
-
- FTP installation may be done from any mirror site containing a
- reasonably up-to-date version of FreeBSD 2.0.5. A full menu of
- reasonable choices from almost anywhere in the world is provided
- by the FTP site menu.
-
- If you are installing from some other FTP site not listed in this
- menu, or you are having troubles getting your name server configured
- properly, you can also specify your own URL by selecting the ``Other''
- choice in that menu. A URL can also be a direct IP address, so
- the following would work in the absence of a name server:
-
- ftp://192.216.222.4/pub/FreeBSD/2.0.5-RELEASE
-
- [Substitute "ALPHA" for "RELEASE" during the ALPHA test period!]
-
- If you are installing through a firewall then you should probably
- select ``Passive mode'' ftp, which is the default. If you are
- talking to a server which does not support passive mode for some
- reason, see the Options menu to select Active mode transfers.
-
-
-3. Installing FreeBSD
--- ------------------
-
-Once you've taken note of the appropriate preinstallation steps, you
-should be able to install FreeBSD without any further trouble.
-
-Should this not be true, then you may wish to go back and re-read the
-relevant preparation section (section 2.x) for the installation media
-type you're trying to use - perhaps there's a helpful hint there that
-you missed the first time? If you're having hardware trouble, or
-FreeBSD refuses to boot at all, read the Hardware Guide provided on
-the boot floppy for a list of possible solutions.
-
-The FreeBSD boot floppy contains all the on-line documentation you
-should need to be able to navigate through an installation and if it
-doesn't then I'd like to know what you found most confusing! It is
-the objective of the FreeBSD installation program (sysinstall) to be
-self-documenting enough that painful "step-by-step" guides are no
-longer necessary. It may take us a little while to reach that
-objective, but that's the objective!
-
-Meanwhile, you may also find the following "typical installation sequence"
-to be helpful:
-
-o Boot the boot floppy. After a boot sequence which can take
- anywhere from from 30 seconds to 3 minutes, depending on your
- hardware, you should be presented with a menu of initial
- choices. If the floppy doesn't boot at all, or the boot
- hangs at some stage, go read the Q&A section of the Hardware
- Guide for possible causes.
-
-o Press F1. You should see some basic usage instructions on
- the menu system and general navigation. If you haven't used this
- menu system before then PLEASE read this thoroughly!
-
-o If English is not your native language, you may wish to proceed
- directly to the Language option and set your preferred language.
- This will bring up some of the documentation in that language
- instead of english.
-
-o Select the Options item and set any special preferences you
- may have.
-
-o Select Proceed, bringing you to the Installation Menu.
-
-Installation Menu:
-
-o You can do anything you like in this menu without altering
- your system _except_ for "Commit", which will perform any
- requests to alter your system you may have made.
-
- If you're confused at any point, the F1 key usually pulls
- up the right information for the screen you're in.
-
- o The first step is generally `Partition', which allows
- you to chose how your drives will be used for FreeBSD.
-
- o Next, with the `Label' editor, you can specify how the space
- in any allocated FreeBSD partitions should be used by FreeBSD,
- or where to mount a non-FreeBSD partition (such as DOS).
-
- o Next, the `Distributions' menu allows you to specify which
- parts of FreeBSD you wish to load. A good choice is
- "User" for a small system or "Developer" for someone
- wanting a bit more out of FreeBSD. If none of the existing
- collections sound applicable, select Custom.
-
- o Next, the `Media' menu allows you to specify what kind of
- media you wish to install from. If a desired media choice is
- found and configured automatically then this menu will simply
- return, otherwise you'll be asked for additional details on
- the media device type.
-
- o Finally, the Commit command will actually perform all the
- actions at once (nothing has been written to your disk
- so far, nor will it until you give the final confirmation).
- All new or changed partition information will be written
- out, file systems will be created and/or non-destructively
- labelled (depending on how you set their newfs flags in the
- Label editor) and all selected distributions will be
- extracted.
-
- o The Configure menu choice allows you to furthur configure your
- FreeBSD installation by giving you menu-driven access to
- various system defaults. Some items, like networking, may
- be especially important if you did a CDROM/Tape/Floppy
- installation and have not yet configured your network
- interfaces (assuming you have some). Properly configuring
- your network here will allow FreeBSD to come up on the network
- when you first reboot from the hard disk.
-
- o Exit returns you to the top menu.
-
-
- At this point, you're generally done with the sysinstall utility and
-can select the final `Quit'. If you're running it as an installer
-(e.g., before the system is all the way up) then the system will now
-reboot. If you selected the boot manager option, you will see a small
-boot menu with an `F?' prompt. Press the function key for BSD (it
-will be shown) and you should boot up into FreeBSD off the hard disk.
-
- If this fails to happen for some reason, see the Q & A section
-of the Hardware Guide for possible clues!
-
- Jordan
-
----- End of Installation Guide ---
diff --git a/release/sysinstall/help/en_US.ISO_8859-1/language.hlp b/release/sysinstall/help/en_US.ISO_8859-1/language.hlp
deleted file mode 100644
index 23f176b..0000000
--- a/release/sysinstall/help/en_US.ISO_8859-1/language.hlp
+++ /dev/null
@@ -1,14 +0,0 @@
-Use this menu to select your preferred language. For now, this only
-sets the default language in which various help files are displayed.
-
-In later releases this will also change the keyboard layout, screen
-map, NLS settings (sysinstall itself will also use message catalogs so
-that all menus are in the appropriate language) and implement other
-I18N features to meet various standards.
-
-Until these improvements are made, you may find it easier to simply
-edit the /etc/sysconfig file yourself once the system is fully
-installed. There are a number of comments in that file that detail
-just what should be changed, as well as a few examples of existing
-non-english setups.
-
diff --git a/release/sysinstall/help/en_US.ISO_8859-1/media.hlp b/release/sysinstall/help/en_US.ISO_8859-1/media.hlp
deleted file mode 100644
index 8b081bc..0000000
--- a/release/sysinstall/help/en_US.ISO_8859-1/media.hlp
+++ /dev/null
@@ -1,29 +0,0 @@
-You can install from the following types of media:
-
- CDROM - requires one of the following supported CDROM drives:
-
- Sony CDU 31/33A
- Matushita/Panasonic "Sound Blaster" CDROM.
- Mitsumi FX-001{A-D} (older non-IDE drives).
- SCSI - Any standard SCSI CDROM drive hooked to
- a supported controller (see Hardware Guide).
-
- DOS - A DOS primary partition with the required FreeBSD
- distribution files copied onto it (e.g. C:\FREEBSD\)
-
- FS - Assuming a disk or partition with an existing
- FreeBSD file system and distribution set on it,
- get the distribution files from there.
-
- Floppy - Get distribution files from one or more DOS formatted
- floppies.
-
- FTP - Get the distribution files from an anonymous ftp server
- (you will be presented with a list).
-
- NFS - Get the distribution files from an NFS server somewhere
- (make sure that permissions on the server allow this!)
-
- Tape - Extract distribution files from tape into a temporary
- directory and install from there.
-
diff --git a/release/sysinstall/help/en_US.ISO_8859-1/network_device.hlp b/release/sysinstall/help/en_US.ISO_8859-1/network_device.hlp
deleted file mode 100644
index 95c42ae..0000000
--- a/release/sysinstall/help/en_US.ISO_8859-1/network_device.hlp
+++ /dev/null
@@ -1,54 +0,0 @@
-You can do network installations over 3 types of communications links:
-
- Serial port: SLIP / PPP
- Parallel port: PLIP (laplink cable)
- Ethernet: A standard ethernet controller (includes some PCMCIA).
-
-SLIP support is rather primitive and limited primarily to hard-wired
-links, such as a serial cable running between a laptop computer and
-another PC. The link must be hard-wired as the SLIP installation
-doesn't currently offer a dialing capability; that facility is provided
-with the PPP utility, which should be used in preference to SLIP
-whenever possible. When you choose a serial port device, you'll
-be given the option later to edit the slattach command before it's
-run on the serial line. It is expected that you'll run slattach
-(or some equivalent) on the other end of the link at this time and
-bring up the line. FreeBSD will then install itself over the link
-at speeds of up to 115.2K/baud (the recommended speed for a hardwired
-cable).
-
-If you're using a modem then PPP is almost certainly your only
-choice. Make sure that you have your service provider's information
-handy as you'll need to know it fairly early in the installation
-process. You will need to know, at the minimum, your service
-provider's IP address and possibly your own (though you can also leave
-it blank and allow PPP to negotiate it with your ISP). You will also
-need to know how to use the various "AT commands" to dial the ISP with
-your particular brand of modem as the PPP dialer provides only a very
-simple terminal emulator and has no "modem capabilities database".
-
-If a hard-wired connection to another FreeBSD (2.0R or later) machine
-is available, you might also consider installing over a "laplink"
-parallel port cable. The data rate over the parallel port is much
-higher than what is typically possible over a serial line with
-speeds of up to 50k/sec.
-
-Finally, for the fastest possible network installation, an ethernet
-adaptor is always a good choice! FreeBSD supports most common PC
-ethernet cards, a table of which is provided in the FreeBSD
-Hardware Guide (see the Documentation menu on the boot floppy).
-If you are using one of the supported PCMCIA ethernet cards, also be
-sure that it's plugged in _before_ the laptop is powered on! FreeBSD
-does not, unfortunately, currently support "hot insertion" of PCMCIA
-cards.
-
-You will also need to know your IP address on the network, the "netmask"
-value for your address class, and the name of your machine.
-Your system administrator can tell you which values to use for your
-particular network setup. If you will be referring to other hosts by
-name rather than IP address, you'll also need a name server and
-possibly the address of a gateway (if you're using PPP, it's your
-provider's IP address) to use in talking to it. If you do not know
-the answers to all or most of these questions, then you should
-really probably talk to your system administrator _first_ before
-trying this type of installation!
diff --git a/release/sysinstall/help/en_US.ISO_8859-1/options.hlp b/release/sysinstall/help/en_US.ISO_8859-1/options.hlp
deleted file mode 100644
index c30180c..0000000
--- a/release/sysinstall/help/en_US.ISO_8859-1/options.hlp
+++ /dev/null
@@ -1,95 +0,0 @@
-The following options may be set from this screen:
-
-NFS Secure: NFS server talks only on a secure port
-
- This is most commonly used when talking to Sun workstations, which
- will not talk NFS over "non priviledged" ports.
-
-
-NFS Slow: User is using a slow PC or ethernet card
-
- Use this option if you have a slow PC (386) or an ethernet card
- with poor performance being "fed" by NFS on a higher-performance
- workstation. This will throttle the workstation back to prevent
- the PC from becoming swamped with data.
-
-
-FTP Abort: On transfer failure, abort
-
- This is pretty self-explanatory. If you're transfering from a
- host that drops the connection or cannot provide a file, abort
- the installation of that piece.
-
-
-FTP Reselect: On transfer failure, ask for another host
-
- This is more useful to someone doing an interactive installation.
- If the current host stops working, ask for a new ftp server to
- resume the installation from. The install will attempt to pick
- up from where it left off on the other server, if at all possible.
-
-
-FTP Active: Use "active mode" for standard FTP
-
- For all FTP transfers, use "Active" mode. This will not work
- through firewalls, but will often work with older ftp servers
- that do not support passive mode. If your connection hangs
- with passive mode (the default), try active!
-
-
-FTP Passive: Use "passive mode" for firewalled FTP
-
- For all FTP transfers, use "Passive" mode. This allows the user
- to pass through firewalls that do not allow incoming connections
- on random port addresses.
-
- NOTE: ACTIVE AND PASSIVE MODES ARE NOT THE SAME AS A `PROXY'
- CONNECTION, WHERE A PROXY FTP SERVER IS LISTENING ON A DIFFERENT
- PORT!
-
- In such situations, you should specify the URL as something like:
-
- ftp://foo.bar.com:1234/pub/FreeBSD
-
- Where "1234" is the port number of the proxy ftp server.
-
-
-Debugging: Turn on the extra debugging flag
-
- This turns on a lot of extra noise over on the second screen
- (ALT-F2 to see it, ALT-F1 to switch back). If your installation
- should fail for any reason, PLEASE turn this flag on when
- attempting to reproduce the problem. It will provide a lot of
- extra debugging at the failure point and may be very helpful to
- the developers in tracking such problems down!
-
-
-Yes To All: Assume "Yes" answers to all non-critical dialogs
-
- This flag should be used with caution. It will essentially
- decide NOT to ask the user about any "boundry" conditions that
- might not constitute actual errors but may be warnings indicative
- of other problems.
-
-
-FTP userpass: Specify username and password instead of anonymous.
-
- By default, the installation attempts to log in as the
- anonymous user. If you wish to log in as someone else,
- specify the username and password with this option.
-
-
-Clear: Clear All Option Flags
-
- Reset all option flags back to their default values.
-
-----
-
-Some of these items, like "FTP Active" or "FTP Passive", are actually
-mutually-exclusive even though you can turn all of them on or off at
-once. This is a limitation of the menuing system, and is compensated
-for by checks that ensure that the various flags are not in conflict.
-If you re-enter the Options menu again after leaving it, you'll see
-the settings it's actually using after checking for any possible
-conflicts.
-
diff --git a/release/sysinstall/help/en_US.ISO_8859-1/partition.hlp b/release/sysinstall/help/en_US.ISO_8859-1/partition.hlp
deleted file mode 100644
index fd16a45..0000000
--- a/release/sysinstall/help/en_US.ISO_8859-1/partition.hlp
+++ /dev/null
@@ -1,77 +0,0 @@
-This is the FreeBSD DiskLabel Editor.
-
-If you're new to this installation, then you should first understand
-how FreeBSD 2.0.5's new "slices" paradigm for looking at disk storage
-works. It's not very hard to understand. A "fully qualified slice name",
-that is the name of the file we open in /dev to talk to the slice,
-is optionally broken into 3 parts:
-
- First you have the disk name. Assume we have two SCSI
- drives in our system, which gives us `sd0' and `sd1'.
-
- Next you have the "Slice" (or "FDISK Partition") number,
- as seen in the Partition Editor. Assume that our sd0 contains
- two slices, a FreeBSD slice and a DOS slice. This gives us
- sd0s1 and sd0s2. Let's also say that sd1 is completely devoted
- to FreeBSD, so we have only one slice there: sd1s1.
-
- Next, if a slice is a FreeBSD slice, you have a number of
- (confusingly named) "partitions" you can put inside of it.
- These FreeBSD partitions are where various filesystems or swap
- areas live, and using our hypothetical two-SCSI-disk machine
- again, we might have something like the following layout on sd0:
-
- Name Mountpoint
- ---- ----------
- sd0s1a /
- sd0s1b <swap space>
- sd0s1e /usr
-
- Because of historical convention, there is also a short-cut,
- or "compatibility slice", that is maintained for easy access
- to the first FreeBSD slice on a disk for those programs which
- still don't know how to deal with the new slice scheme.
- The compatibility slice names for our filesystem above would
- look like:
-
- Name Mountpoint
- ---- ----------
- sd0a /
- sd0b <swap space>
- sd0e /usr
-
- FreeBSD automatically maps the compatibility slice to the first
- FreeBSD slice it finds (in this case, sd0s1). You may have multiple
- FreeBSD slices on a drive, but only the first one may be the
- compatibility slice!
-
- The compatibility slice will eventually be phased out, but
- it is still important right now for several reasons:
-
- 1. Some programs, as mentioned before, still don't work
- with the slice paradigm and need time to catch up.
-
- 2. The FreeBSD boot blocks are unable to look for
- a root file system in anything but a compatibility
- slice right now. This means that our root will always
- show up on "sd0a" in the above scenario, even though
- it really lives over on sd0s1a and would otherwise be
- referred to by its full slice name.
-
-Once you understand all this, then the label editor becomes fairly
-simple. You're either carving up the FreeBSD slices displayed at the
-top of the screen into smaller pieces (displayed in the middle of the
-screen) and then putting FreeBSD file systems on them, Or you're just
-mounting existing partitions/slices into your filesystem hierarchy;
-this editor lets you do both. Since a DOS partition is also just
-another slice as far as FreeBSD is concerned, you can mount one into
-in your filesystem hierarchy just as easily with this editor. For
-FreeBSD partitions you can also toggle the "newfs" state so that
-the partitions are either (re)created from scratch or simply checked
-and mounted (the contents are preserved).
-
-When you're done, type `Q' to exit.
-
-No actual changes will be made to the disk until you (C)ommit from the
-Install menu! You're working with what is essentially a copy of
-the disk label(s), both here and in the FDISK Partition Editor.
diff --git a/release/sysinstall/help/en_US.ISO_8859-1/slice.hlp b/release/sysinstall/help/en_US.ISO_8859-1/slice.hlp
deleted file mode 100644
index e055ca4..0000000
--- a/release/sysinstall/help/en_US.ISO_8859-1/slice.hlp
+++ /dev/null
@@ -1,28 +0,0 @@
-This is the Main Partition (or ``Slice'') Editor.
-
-Possible commands are printed at the bottom, and the Master Boot Record
-contents are at the top. You can move up and down with the arrow keys
-and can (C)reate a new partition whenever the "bar" is over a partition
-whose type is set to "unused".
-
-The flags field has the following legend:
-
- '=' -- Partition is properly aligned.
- '>' -- The partition doesn't end before cylinder 1024
- 'R' -- Has been marked as containing the root (/) filesystem
- 'B' -- Partition employs BAD144 bad-spot handling
- 'C' -- This is the FreeBSD 2.0-compatibility partition (default)
- 'A' -- This partition is marked active.
-
-If you select a partition for Bad144 handling, it will be scanned
-for bad blocks before any new filesystems are made on it.
-
-If no partition is marked Active, you will need to either install
-a Boot Manager (the option for which will be presented later in the
-installation) or set one Active before leaving this screen.
-
-To leave this screen, type `Q'.
-
-No actual changes will be made to the disk until you (C)ommit from the
-Install menu! You're working with what is essentially a copy of
-the disk label(s), both here and in the Label Editor.
diff --git a/release/sysinstall/help/en_US.ISO_8859-1/tcp.hlp b/release/sysinstall/help/en_US.ISO_8859-1/tcp.hlp
deleted file mode 100644
index 3ab5d7c..0000000
--- a/release/sysinstall/help/en_US.ISO_8859-1/tcp.hlp
+++ /dev/null
@@ -1,27 +0,0 @@
-This screen allows you to set up your general network parameters
-(hostname, domain name, DNS server, etc) as well as the settings for a
-given interface (which was selected from the menu before this screen).
-
-You can move through the fields with the TAB, BACK-TAB and RETURN
-keys. To edit a field, use DELETE or BACKSPACE. You may also use ^A
-(control-A) to go to the beginning of the line, ^E (control-E) to go
-to the end, ^F (control-F) to go forward a character, ^B (control-B)
-to go backward one character, ^D (control-D) to delete the character
-under the cursor and ^K (control-K) to delete to the end of the line.
-Basically, the standard EMACS motion sequences.
-
-The ``Extra options to ifconfig'' is kind of special (read: a hack :-).
-
-You can use it for specifying the foreign side of a PLIP or SLIP line
-(simply type the foreign address in) as well as selecting a given
-"link" on an ethernet card that has more than one (e.g. AUI, 10BT,
-10B2, etc). The following links are recognised:
-
- link0 - AUI * highest precedence
- link1 - BNC
- link2 - UTP * lowest precedence
-
-That is to say that you can enter one of "link0", "link1" or "link2"
-into the `Extra options' field to select a different link.
-
-When you're done with this form, select OK.
diff --git a/release/sysinstall/help/en_US.ISO_8859-1/usage.hlp b/release/sysinstall/help/en_US.ISO_8859-1/usage.hlp
deleted file mode 100644
index b01a94b..0000000
--- a/release/sysinstall/help/en_US.ISO_8859-1/usage.hlp
+++ /dev/null
@@ -1,54 +0,0 @@
-HOW TO USE THIS SYSTEM
-======================
-
-KEY ACTION
---- ------
-UP ARROW Move to previous item (or up, in a text field).
-DOWN ARROW Move to next item (or down, in a text field).
-TAB Move to next item or group.
-RIGHT ARROW Move to next item or group (same as TAB).
-SHIFT-TAB Move to previous item or group.
-LEFT ARROW Move to previous item or group (same as SHIFT-TAB).
-RETURN Select item.
-PAGE UP In text boxes, scrolls up one page.
-PAGE DOWN In text boxes, scrolls down one page.
-SPACE In "radio" or multiple choice menus, toggle the current item.
-F1 Help (in screens that provide it).
-
-If you also see small "^(-)" or "v(+)" symbols at the edges of a menu,
-it means that there are more items above or below the current one that
-aren't being shown (due to insufficient screen space). Using the
-up/down arrow keys will cause the menu to scroll. When a symbol
-disappears, it means you are at the top (or bottom) of the menu.
-
-In text fields, the amount of text above the current point will be
-displayed as a percentage in the lower right corner. 100% means
-you're at the bottom of the field.
-
-Selecting OK in a menu will confirm whatever action it's controlling.
-Selecting Cancel will cancel the operation and generally return you to
-the previous menu.
-
-
-SPECIAL FEATURES:
-=================
-
-It is also possible to select a menu item by typing the first
-character of its name, if unique. Such "accelerator" characters will
-be specially highlighted in the item name.
-
-The console driver also contains a scroll-back buffer for reviewing
-things that may have scrolled off the screen. To use scroll-back,
-press the "Scroll Lock" key on your keyboard and use the arrow or
-Page Up/Page Down keys to move through the saved text. To leave
-scroll-back mode, press the Scroll Lock key again. This feature
-is most useful for dealing with sub-shells or other "wizard modes"
-that don't use menus.
-
-Once the system is fully installed and running "multi-user", you will
-also find that you have multiple "virtual consoles" and can use them to
-have several active sessions at once. Use ALT-F<n> to switch between
-them, where `F<n>' is the function key corresponding to the screen you
-wish to see. By default, the system comes with 3 virtual consoles enabled.
-You can create more by editing the /etc/ttys file, once the system is up,
-for a maximum of 12.
diff --git a/release/sysinstall/help/es_ES.ISO8859-1/README b/release/sysinstall/help/es_ES.ISO8859-1/README
deleted file mode 100644
index 27020bf..0000000
--- a/release/sysinstall/help/es_ES.ISO8859-1/README
+++ /dev/null
@@ -1,108 +0,0 @@
- ------------------------------------------
- FreeBSD 2.0.5 --- Versión DEFINITIVA , ,
- ------------------------------------------ /( )`
- \ \___ / |
-¡Bienvenido a la versión 2.0.5 de FreeBSD! 2.0.5 es /- _ `-/ '
-una versión intermedia de FreeBSD que rellena el (/\/ \ \ /\
-hueco existente entre 2.0R (publicada en Noviembre / / | ` \
-de 1994) y 2.1R, que se publicará a finales de O O ) / |
-Julio de 1995. FreeBSD 2.0.5 contiene gran `-^--'`< '
-cantidad de mejoras significativas respecto de (_.) _ ) /
-2.0R, entre las que destacan una mayor estabilidad `.___/` /
-(por un considerable margen), docenas de `-----' /
-características nuevas y un programa <----. __ / __ \
-de instalación muy mejorado. Vea las <----|====O)))==) \) /====
-notas a la versión para más detalles <----' `--' `.__,' \
-sobre las novedades de FreeBSD 2.0.5. | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-¿Qué es FreeBSD? FreeBSD es un sistema operativo basado en 4.4 BSD Lite
-para hardware PC basado en "x86" de Intel, AMD, Cyrix o NexGen. Funciona
-con un abanico muy amplio de periféricos y configuraciones de PC y se
-puede utilizar para todo tipo de actividades, desde el desarrollo de
-software hasta la provisión de servicios de Internet; ¡el lugar más
-concurrido de la Internet, ftp.cdrom.com, es una máquina con FreeBSD!
-
-Esta versión de FreeBSD contiene todo lo que necesita para montar
-un sistema así, además del código fuente completo. Con la distribución
-de las fuentes instalada, puede recompilar literalmente el sistema
-entero desde cero con un solo comando, lo que lo hace ideal para
-estudiantes, investigadores o quienes simplemente deseen ver cómo
-funciona todo.
-
-También se proporciona una gran recopilación de software de terceros
-adaptado (la "colección de adaptaciones") para facilitarle la
-obtención e instalación de todas sus utilidades tradicionales de UNIX
-favoritas bajo FreeBSD. Son más de 270 adaptaciones, que abarcan desde
-editores hasta lenguajes de programación o aplicaciones gráficas, lo
-cual hace de FreeBSD un potente y completo entorno de trabajo, capaz de
-rivalizar en utilización general y potencia con el de muchas estaciones
-de trabajo grandes.
-
-
-Para obtener más documentación sobre este sistema, se recomienda que
-adquiera el juego de publicaciones sobre 4.4BSD de O'Reilly Associates
-y la asociación USENIX, ISBN 1-56592-082-1. No tenemos ninguna conexión
-con O'Reilly, ¡simplemente somos consumidores satisfechos!
-
-Quizá también desee leer la GUIA DEL HARDWARE *antes* de avanzar más
-con la instalación. La configuración del hardware del PC para algo que
-no sea DOS/Windows (los cuales en realidad no exigen demasiado al
-hardware) es realmente un poco más complicada de lo que parece, y si
-cree que comprende los PC, está claro que aún no los ha utilizado
-durante el tiempo suficiente. :) Esta guía le proporcionará algunos
-consejos sobre cómo configurar el hardware, así como los síntomas que hay
-que buscar en caso de problema. Esta guía está disponible en el menú
-Documentación del disquete de arranque de FreeBSD.
-
-ADVERTENCIA: Aunque FreeBSD hace todo lo posible para prevenir la pérdida
-accidental de datos, ¡sigue siendo más que posible BORRAR EL DISCO ENTERO
-con esta instalación! Por favor, ¡no pase al menú final de la instalación
-de FreeBSD hasta haber realizado primero una copia de seguridad adecuada
-de todos los datos importantes! ¡Lo decimos en serio!
-
-Los comentarios técnicos sobre esta versión deben enviarse (en inglés) a:
-
- hackers@FreeBSD.org
-
-
-Los informes sobre errores deben enviarse mediante el comando 'send-pr',
-si fue posible instalar el sistema, o en otro caso a:
-
- bugs@FreeBSD.org
-
-Por favor, asegúrese de indicar QUE VERSION de FreeBSD utiliza en todos
-los informes sobre errores.
-
-
-Las preguntas generales deben enviarse a:
-
- questions@FreeBSD.org
-
-Por favor sea paciente si no se responde a sus preguntas de inmediato,
-pues este es un momento especialmente atareado para nosotros y nuestros
-recursos voluntarios a menudo están copados hasta el límite. Los informes
-sobre errores enviados con el comando send-pr se registran y se siguen en
-nuestra base de datos de errores y se le mantendrá informado sobre todos
-los cambios en su estado durante la vida del error (o de la petición de
-nuevas características).
-
-Nuestro nodo del WEB, http://www.freebsd.org, también es una fuente muy
-buena de información actualizada y proporciona una serie de facilidades
-avanzadas de documentación. Puede utilizar la versión de Netscape para
-BSDI para ojear el World Wide Web directamente desde FreeBSD.
-
-Puede que también desee inspeccionar /usr/share/FAQ y /usr/share/doc para
-más información sobre el sistema.
-
-
-Gracias por leer todo esto; ¡esperamos sinceramente que disfrute esta
-versión de FreeBSD!
-
- Jordan Hubbard,
- para El Proyecto FreeBSD
-
diff --git a/release/sysinstall/help/es_ES.ISO8859-1/configure.hlp b/release/sysinstall/help/es_ES.ISO8859-1/configure.hlp
deleted file mode 100644
index 608c691..0000000
--- a/release/sysinstall/help/es_ES.ISO8859-1/configure.hlp
+++ /dev/null
@@ -1,18 +0,0 @@
-Este menú le permite configurar un poco el sistema después de
-haberlo instalado. Como mínimo, probablemente deberá establecer
-la contraseña del administrador del sistema y el huso horario
-del sistema.
-
-Para otras cosas extra como bash, emacs, pascal, etc. es muy
-probable que también tenga que activar la opción Packages (Paquetes)
-de este menú. Observe que actualmente esto sólo tiene alguna utilidad
-si dispone de un CDROM o de una colección existente de paquetes en
-algún lugar de la jerarquía del sistema de ficheros a donde pueda
-acceder la herramienta de gestión de paquetes. La transferencia
-automática de paquetes por FTP aún no está soportada.
-
-Si desea volver a invocar la herramienta de instalación de paquetes
-después de salir de la instalación del sistema, el comando es
-``pkg_manage''. Para establecer el huso horario, escriba ``tzsetup''.
-Para más información sobre la configuración general del sistema, vea
-el fichero ``/etc/sysconfig''.
diff --git a/release/sysinstall/help/es_ES.ISO8859-1/language.hlp b/release/sysinstall/help/es_ES.ISO8859-1/language.hlp
deleted file mode 100644
index a76895b..0000000
--- a/release/sysinstall/help/es_ES.ISO8859-1/language.hlp
+++ /dev/null
@@ -1,15 +0,0 @@
-Utilice este menú para seleccionar el idioma deseado. Por el momento,
-esto únicamente sirve para establecer el idioma por defecto con que
-se visualizan diversos ficheros de ayuda.
-
-En versiones posteriores también cambiará la disposición del teclado,
-el mapa de pantalla, los ajustes de NLS (el propio sysinstall usará
-catálogos de mensajes, de forma que todos los menús estén en el
-idioma adecuado) e implementará otras características I18N para
-ajustarse a diversos estándares.
-
-Hasta que se efectúen dichas mejoras, puede que encuentre más sencillo
-editar por su cuenta el fichero /etc/sysconfig una vez que el sistema
-esté totalmente instalado. Hay un buen número de comentarios en ese
-fichero que detallan lo que debería cambiarse, así como unos pocos
-ejemplos de configuraciones no inglesas.
diff --git a/release/sysinstall/help/es_ES.ISO8859-1/usage.hlp b/release/sysinstall/help/es_ES.ISO8859-1/usage.hlp
deleted file mode 100644
index 762c358..0000000
--- a/release/sysinstall/help/es_ES.ISO8859-1/usage.hlp
+++ /dev/null
@@ -1,57 +0,0 @@
-COMO USAR ESTE SISTEMA
-======================
-
-TECLA ACCIO'N
------ -------
-FLECHA ARRIBA Ir al elemento anterior (o superior, en un campo de texto).
-FLECHA ABAJO Ir al elemento siguiente (o inferior, en un campo de texto).
-TAB Ir al siguiente elemento o grupo.
-FLECHA DERECHA Ir al siguiente elemento o grupo (Ide'ntico a TAB).
-MAYUSCULAS-TAB Ir al elemento anterior o grupo.
-FLECHA IZQ. Ir al elemento anterior o grupo (Ide'ntico a MAYUSCULAS-TAB).
-RETORNO Seleccionar el elemento.
-PAGINA ARRIBA Regresa una pa'gina, en a'reas de texto.
-PAGINA ABAJO Presenta la siguiente pa'gina, en areas de texto.
-ESPACIO En menus de opcio'n mu'ltiple (radio), cambia el elemento actual
-F1 Ayuda (en pantallas que la tengan disponible).
-
-En caso de que vea pequen~os si'mbolos "^(-)" o "v(+)" al margen de un menu',
-significa que hay ma's elementos arriba o abajo del elemento actual, los
-cuales no se presentan actualmente (debido a falta de espacio en la pantalla).
-El menu' se puede recorrer haciendo uso de las flechas arriba/abajo. Cuando
-el si'mbolo desaparezca, significa que ha llegado al inicio (o final) del
-menu'.
-
-En campos de texto, la cantidad de texto arriba de su posicio'n en el mensaje
-sera' mostrada como un porcentaje en la esquina inferior izquierda. 100%
-significa que esta' al final del campo.
-
-Al seleccionar OK en un menu', confirmara' cualquier accio'n que e'ste
-controle. El seleccionar Cancel interrumpira' la operacio'n, y generalmente
-le regresara' al menu' anterior.
-
-
-CARACTERI'STICAS ESPECIALES:
-============================
-
-Es posible tambie'n seleccionar un elemento del menu' oprimiendo el primer
-caracter de su nombre, si e'ste es u'nico. Dichos caracteres "aceleradores"
-estara'n remarcados especialmente en el nombre del elemento.
-
-El manejador de la consola tambie'n contiene una memoria de retorno, que le
-permitira' regresar y revisar cosas que ya hayan salido de la pantalla.
-Para usar el retorno, oprima la tecla "Bloqueo Despliegue" en su teclado,
-y use las flechas o las teclas "Pa'gina anterior/Pa'gina siguiente" para
-moverse a trave's del texto grabado. Para abandonar el modo de retorno,
-oprima la tecla "Bloqueo Despliegue" nuevamente. Esta caracteri'stica es
-muy u'til cuando se trabaja con sub-inte'rpretes de comandos, y otros
-modos para usuarios avanzados o "magos" que no usan menu'es.
-
-Una vez que el sistema este' completamente instalado y funcionando en modo
-"multi-usuario", encontrara' que tiene varias "consolas virtuales" y puede
-utilizarlas para tener varias sesiones activas al mismo tiempo. Use la
-combinacio'n ALT-F<n> para cambiar la sesio'n activa, 'F<n>' es la tecla
-de funcio'n que corresponde a la pantalla que desee ver. El sistema viene
-normalmente con 3 consolas virtuales habilitadas. Puede crear ma's editando
-el archivo /etc/ttys una vez que el sistema este instalado, hasta un ma'ximo
-de 12.
diff --git a/release/sysinstall/help/es_ES.ISO_8859-1/README b/release/sysinstall/help/es_ES.ISO_8859-1/README
deleted file mode 100644
index 27020bf..0000000
--- a/release/sysinstall/help/es_ES.ISO_8859-1/README
+++ /dev/null
@@ -1,108 +0,0 @@
- ------------------------------------------
- FreeBSD 2.0.5 --- Versión DEFINITIVA , ,
- ------------------------------------------ /( )`
- \ \___ / |
-¡Bienvenido a la versión 2.0.5 de FreeBSD! 2.0.5 es /- _ `-/ '
-una versión intermedia de FreeBSD que rellena el (/\/ \ \ /\
-hueco existente entre 2.0R (publicada en Noviembre / / | ` \
-de 1994) y 2.1R, que se publicará a finales de O O ) / |
-Julio de 1995. FreeBSD 2.0.5 contiene gran `-^--'`< '
-cantidad de mejoras significativas respecto de (_.) _ ) /
-2.0R, entre las que destacan una mayor estabilidad `.___/` /
-(por un considerable margen), docenas de `-----' /
-características nuevas y un programa <----. __ / __ \
-de instalación muy mejorado. Vea las <----|====O)))==) \) /====
-notas a la versión para más detalles <----' `--' `.__,' \
-sobre las novedades de FreeBSD 2.0.5. | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-¿Qué es FreeBSD? FreeBSD es un sistema operativo basado en 4.4 BSD Lite
-para hardware PC basado en "x86" de Intel, AMD, Cyrix o NexGen. Funciona
-con un abanico muy amplio de periféricos y configuraciones de PC y se
-puede utilizar para todo tipo de actividades, desde el desarrollo de
-software hasta la provisión de servicios de Internet; ¡el lugar más
-concurrido de la Internet, ftp.cdrom.com, es una máquina con FreeBSD!
-
-Esta versión de FreeBSD contiene todo lo que necesita para montar
-un sistema así, además del código fuente completo. Con la distribución
-de las fuentes instalada, puede recompilar literalmente el sistema
-entero desde cero con un solo comando, lo que lo hace ideal para
-estudiantes, investigadores o quienes simplemente deseen ver cómo
-funciona todo.
-
-También se proporciona una gran recopilación de software de terceros
-adaptado (la "colección de adaptaciones") para facilitarle la
-obtención e instalación de todas sus utilidades tradicionales de UNIX
-favoritas bajo FreeBSD. Son más de 270 adaptaciones, que abarcan desde
-editores hasta lenguajes de programación o aplicaciones gráficas, lo
-cual hace de FreeBSD un potente y completo entorno de trabajo, capaz de
-rivalizar en utilización general y potencia con el de muchas estaciones
-de trabajo grandes.
-
-
-Para obtener más documentación sobre este sistema, se recomienda que
-adquiera el juego de publicaciones sobre 4.4BSD de O'Reilly Associates
-y la asociación USENIX, ISBN 1-56592-082-1. No tenemos ninguna conexión
-con O'Reilly, ¡simplemente somos consumidores satisfechos!
-
-Quizá también desee leer la GUIA DEL HARDWARE *antes* de avanzar más
-con la instalación. La configuración del hardware del PC para algo que
-no sea DOS/Windows (los cuales en realidad no exigen demasiado al
-hardware) es realmente un poco más complicada de lo que parece, y si
-cree que comprende los PC, está claro que aún no los ha utilizado
-durante el tiempo suficiente. :) Esta guía le proporcionará algunos
-consejos sobre cómo configurar el hardware, así como los síntomas que hay
-que buscar en caso de problema. Esta guía está disponible en el menú
-Documentación del disquete de arranque de FreeBSD.
-
-ADVERTENCIA: Aunque FreeBSD hace todo lo posible para prevenir la pérdida
-accidental de datos, ¡sigue siendo más que posible BORRAR EL DISCO ENTERO
-con esta instalación! Por favor, ¡no pase al menú final de la instalación
-de FreeBSD hasta haber realizado primero una copia de seguridad adecuada
-de todos los datos importantes! ¡Lo decimos en serio!
-
-Los comentarios técnicos sobre esta versión deben enviarse (en inglés) a:
-
- hackers@FreeBSD.org
-
-
-Los informes sobre errores deben enviarse mediante el comando 'send-pr',
-si fue posible instalar el sistema, o en otro caso a:
-
- bugs@FreeBSD.org
-
-Por favor, asegúrese de indicar QUE VERSION de FreeBSD utiliza en todos
-los informes sobre errores.
-
-
-Las preguntas generales deben enviarse a:
-
- questions@FreeBSD.org
-
-Por favor sea paciente si no se responde a sus preguntas de inmediato,
-pues este es un momento especialmente atareado para nosotros y nuestros
-recursos voluntarios a menudo están copados hasta el límite. Los informes
-sobre errores enviados con el comando send-pr se registran y se siguen en
-nuestra base de datos de errores y se le mantendrá informado sobre todos
-los cambios en su estado durante la vida del error (o de la petición de
-nuevas características).
-
-Nuestro nodo del WEB, http://www.freebsd.org, también es una fuente muy
-buena de información actualizada y proporciona una serie de facilidades
-avanzadas de documentación. Puede utilizar la versión de Netscape para
-BSDI para ojear el World Wide Web directamente desde FreeBSD.
-
-Puede que también desee inspeccionar /usr/share/FAQ y /usr/share/doc para
-más información sobre el sistema.
-
-
-Gracias por leer todo esto; ¡esperamos sinceramente que disfrute esta
-versión de FreeBSD!
-
- Jordan Hubbard,
- para El Proyecto FreeBSD
-
diff --git a/release/sysinstall/help/es_ES.ISO_8859-1/configure.hlp b/release/sysinstall/help/es_ES.ISO_8859-1/configure.hlp
deleted file mode 100644
index 608c691..0000000
--- a/release/sysinstall/help/es_ES.ISO_8859-1/configure.hlp
+++ /dev/null
@@ -1,18 +0,0 @@
-Este menú le permite configurar un poco el sistema después de
-haberlo instalado. Como mínimo, probablemente deberá establecer
-la contraseña del administrador del sistema y el huso horario
-del sistema.
-
-Para otras cosas extra como bash, emacs, pascal, etc. es muy
-probable que también tenga que activar la opción Packages (Paquetes)
-de este menú. Observe que actualmente esto sólo tiene alguna utilidad
-si dispone de un CDROM o de una colección existente de paquetes en
-algún lugar de la jerarquía del sistema de ficheros a donde pueda
-acceder la herramienta de gestión de paquetes. La transferencia
-automática de paquetes por FTP aún no está soportada.
-
-Si desea volver a invocar la herramienta de instalación de paquetes
-después de salir de la instalación del sistema, el comando es
-``pkg_manage''. Para establecer el huso horario, escriba ``tzsetup''.
-Para más información sobre la configuración general del sistema, vea
-el fichero ``/etc/sysconfig''.
diff --git a/release/sysinstall/help/es_ES.ISO_8859-1/language.hlp b/release/sysinstall/help/es_ES.ISO_8859-1/language.hlp
deleted file mode 100644
index a76895b..0000000
--- a/release/sysinstall/help/es_ES.ISO_8859-1/language.hlp
+++ /dev/null
@@ -1,15 +0,0 @@
-Utilice este menú para seleccionar el idioma deseado. Por el momento,
-esto únicamente sirve para establecer el idioma por defecto con que
-se visualizan diversos ficheros de ayuda.
-
-En versiones posteriores también cambiará la disposición del teclado,
-el mapa de pantalla, los ajustes de NLS (el propio sysinstall usará
-catálogos de mensajes, de forma que todos los menús estén en el
-idioma adecuado) e implementará otras características I18N para
-ajustarse a diversos estándares.
-
-Hasta que se efectúen dichas mejoras, puede que encuentre más sencillo
-editar por su cuenta el fichero /etc/sysconfig una vez que el sistema
-esté totalmente instalado. Hay un buen número de comentarios en ese
-fichero que detallan lo que debería cambiarse, así como unos pocos
-ejemplos de configuraciones no inglesas.
diff --git a/release/sysinstall/help/es_ES.ISO_8859-1/usage.hlp b/release/sysinstall/help/es_ES.ISO_8859-1/usage.hlp
deleted file mode 100644
index 762c358..0000000
--- a/release/sysinstall/help/es_ES.ISO_8859-1/usage.hlp
+++ /dev/null
@@ -1,57 +0,0 @@
-COMO USAR ESTE SISTEMA
-======================
-
-TECLA ACCIO'N
------ -------
-FLECHA ARRIBA Ir al elemento anterior (o superior, en un campo de texto).
-FLECHA ABAJO Ir al elemento siguiente (o inferior, en un campo de texto).
-TAB Ir al siguiente elemento o grupo.
-FLECHA DERECHA Ir al siguiente elemento o grupo (Ide'ntico a TAB).
-MAYUSCULAS-TAB Ir al elemento anterior o grupo.
-FLECHA IZQ. Ir al elemento anterior o grupo (Ide'ntico a MAYUSCULAS-TAB).
-RETORNO Seleccionar el elemento.
-PAGINA ARRIBA Regresa una pa'gina, en a'reas de texto.
-PAGINA ABAJO Presenta la siguiente pa'gina, en areas de texto.
-ESPACIO En menus de opcio'n mu'ltiple (radio), cambia el elemento actual
-F1 Ayuda (en pantallas que la tengan disponible).
-
-En caso de que vea pequen~os si'mbolos "^(-)" o "v(+)" al margen de un menu',
-significa que hay ma's elementos arriba o abajo del elemento actual, los
-cuales no se presentan actualmente (debido a falta de espacio en la pantalla).
-El menu' se puede recorrer haciendo uso de las flechas arriba/abajo. Cuando
-el si'mbolo desaparezca, significa que ha llegado al inicio (o final) del
-menu'.
-
-En campos de texto, la cantidad de texto arriba de su posicio'n en el mensaje
-sera' mostrada como un porcentaje en la esquina inferior izquierda. 100%
-significa que esta' al final del campo.
-
-Al seleccionar OK en un menu', confirmara' cualquier accio'n que e'ste
-controle. El seleccionar Cancel interrumpira' la operacio'n, y generalmente
-le regresara' al menu' anterior.
-
-
-CARACTERI'STICAS ESPECIALES:
-============================
-
-Es posible tambie'n seleccionar un elemento del menu' oprimiendo el primer
-caracter de su nombre, si e'ste es u'nico. Dichos caracteres "aceleradores"
-estara'n remarcados especialmente en el nombre del elemento.
-
-El manejador de la consola tambie'n contiene una memoria de retorno, que le
-permitira' regresar y revisar cosas que ya hayan salido de la pantalla.
-Para usar el retorno, oprima la tecla "Bloqueo Despliegue" en su teclado,
-y use las flechas o las teclas "Pa'gina anterior/Pa'gina siguiente" para
-moverse a trave's del texto grabado. Para abandonar el modo de retorno,
-oprima la tecla "Bloqueo Despliegue" nuevamente. Esta caracteri'stica es
-muy u'til cuando se trabaja con sub-inte'rpretes de comandos, y otros
-modos para usuarios avanzados o "magos" que no usan menu'es.
-
-Una vez que el sistema este' completamente instalado y funcionando en modo
-"multi-usuario", encontrara' que tiene varias "consolas virtuales" y puede
-utilizarlas para tener varias sesiones activas al mismo tiempo. Use la
-combinacio'n ALT-F<n> para cambiar la sesio'n activa, 'F<n>' es la tecla
-de funcio'n que corresponde a la pantalla que desee ver. El sistema viene
-normalmente con 3 consolas virtuales habilitadas. Puede crear ma's editando
-el archivo /etc/ttys una vez que el sistema este instalado, hasta un ma'ximo
-de 12.
diff --git a/release/sysinstall/help/fr_FR.ISO8859-1/README b/release/sysinstall/help/fr_FR.ISO8859-1/README
deleted file mode 100644
index 13ef060..0000000
--- a/release/sysinstall/help/fr_FR.ISO8859-1/README
+++ /dev/null
@@ -1,104 +0,0 @@
- -----------------------------------------
- FreeBSD version 2.0.5 , ,
- ----------------------------------------- /( )`
- \ \___ / |
- /- _ `-/ '
-Bienvenue dans FreeBSD, version 2.0.5 ! C'est une (/\/ \ \ /\
-version intermédiaire après une longue période / / | ` \
-nécessaire depuis la version 2.0 de Novembre 94 O O ) / |
-et en attendant la version 2.1 prévue pour fin `-^--'`< '
-Juillet 95. FreeBSD 2.0.5 constitue une nette (_.) _ ) /
-amélioration depuis la version 2.0 : un effort `.___/` /
-considérable du point de vue de la stabilité ainsi `-----' /
-que des nouveautés par douzaines. Pour <----. __ / __ \
-obtenir plus de détails concernant ces <----|====O)))==) \) /====
-nouveautés, consultez le fichier <----' `--' `.__,' \
-RELNOTES | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-FreeBSD est un système d'exploitation basé sur 4.4 BSD Lite, pour les
-PC munis de processeurs de type "x86" d'Intel, AMD, Cyrix ou NexGen.
-FreeBSD supporte une très large quantité de périphériques et de
-configurations. Il est utilisé pour de multiples tâches, allant du
-développement logiciel jusqu'à l'accès aux services d'Internet. Le
-site le plus utilisé sur Internet, ftp.cdrom.com, est une machine
-FreeBSD !
-
-Cette version de FreeBSD contient tout ce dont vous pouvez avoir
-besoin pour implanter ce système sur votre machine. Les sources de
-tous les programmes étant fournis, vous pouvez recompiler à loisir la
-distribution complète en une unique commande. C'est idéal pour les
-étudiants, les chercheurs et tous ceux qui sont simplement curieux de
-voir comment est conçu un tel système.
-
-Une importante collection de logiciels supportés (les « ports ») est
-aussi fournie pour vous aider à obtenir et à installer sur FreeBSD,
-les logiciels traditionnels du domaine UNIX. Plus de 270 ports sont
-ainsi disponibles, des éditeurs de texte aux langages de programmation,
-en passant par les applications graphiques... Tout cela contribue à
-faire autour de FreeBSD, un environnement puissant et accessible,
-capable de rivaliser avec beaucoup de stations de travail.
-
-En complément, il est recommandé d'acquérir les ouvrages relatifs à
-4.4BSD, chez « O'Reilly Associates » et « USENIX Association »,
-ISBN 1-56592-082-1. Nous n'avons pas d'intérêts dans la vente de ces
-ouvrages, nous sommes simplement des lecteurs satisfaits.
-
-Il est conseillé de lire le guide des configurations matérielles avant
-d'aller plus loin dans l'installation. La configuration d'un PC pour
-d'autres systèmes que DOS/Windows (qui n'est pas très exigeant sur ce
-point) est certainement un peu plus difficile qu'il n'y paraît, et si
-vous pensez maîtriser la situation, c'est sans doute que vous n'avez
-pas utilisé un PC depuis quelque temps. :) Ce guide donne les
-renseignements indiquant comment configurer votre machine et quels
-symptômes rechercher en cas de problème. Ce guide est disponible par
-le menu Documentation de la disquette de démarrage de FreeBSD.
-
-MISE EN GARDE : Malgré toutes les précautions, FreeBSD ne peut
-garantir contre une perte accidentelle des données. Il se peut que
-cette procédure d'installation efface complètement le contenu de votre
-disque dur. Il est donc fortement conseillé de faire une sauvegarde de
-votre disque avant de continuer cette installation.
-
-Les commentaires techniques à propos de cette version peuvent être
-adressés à :
-
- hackers@FreeBSD.org (en anglais)
-
-Les rapports de dysfonctionnement « bug reports » peuvent être
-notifiés par la commande « send-pr » dès que votre système est
-installé. Dans le cas contraire, ils peuvent être adressés à :
-
- bugs@FreeBSD.org (en anglais)
-
-N'oubliez par de joindre à votre requête, le numéro de la version de
-FreeBSD concernée.
-
-Les questions d'ordre général sont à diriger vers :
-
- questions@FreeBSD.org (en anglais)
-
-Ne soyez pas impatient si vos questions ne trouvent pas réponse dans
-la minute, car c'est beaucoup d'investissement que d'y répondre et il
-n'est pas rare que toute notre bonne volonté ne suffise pas. Les
-problèmes soumis par le biais de la commande « send-pr » sont
-automatiquement répertoriés dans une base de données. Vous resterez
-informés de toute évolution concernant votre demande.
-
-Notre site WEB est http://www.freebsd.org. C'est aussi une bonne
-source pour obtenir les dernières informations en date. Ce site
-propose de nombreuses facilités de documentation. La version de
-Netscape compilée pour BSDI peut être utilisée pour découvrir le
-« World Wide Web » directement à partir de FreeBSD.
-
-Pour de plus amples détails, consultez les fichiers contenus dans les
-répertoires /usr/share/FAQ et /usr/share/doc.
-
-Merci de votre attention, nous espérons sincèrement que cette version
-de FreeBSD vous donnera entière satisfaction.
-
- Jordan Hubbard,
- pour le projet FreeBSD
diff --git a/release/sysinstall/help/fr_FR.ISO8859-1/configure.hlp b/release/sysinstall/help/fr_FR.ISO8859-1/configure.hlp
deleted file mode 100644
index 4f3ed97..0000000
--- a/release/sysinstall/help/fr_FR.ISO8859-1/configure.hlp
+++ /dev/null
@@ -1,16 +0,0 @@
-Ce menu permet de configurer votre système dès la fin de son
-installation. Le minimum conseillé est d'ajouter un mot de passe pour
-l'administrateur du système, et d'indiquer le fuseau horaire de votre
-localisation.
-
-Pour installer des utilitaires supplémentaires, tels que bash, emacs,
-pascal, etc., vous pouvez utiliser l'entrée « Packages » dans ce
-menu. L'obtention automatique de ces outils via FTP n'étant pas encore
-disponible, une installation à partir du disque ou du CDROM est
-nécessaire.
-
-Une installation ultérieure de ces outils sera toujours possible, à
-l'aide de la commande « pkg_manage ». Un ajustement de l'heure peut
-aussi être effectué grâce à « tzsetup ». Enfin, pour modifier la
-configuration générale de votre système, reportez vous au contenu du
-fichier /etc/sysconfig.
diff --git a/release/sysinstall/help/fr_FR.ISO8859-1/language.hlp b/release/sysinstall/help/fr_FR.ISO8859-1/language.hlp
deleted file mode 100644
index f4a99ea..0000000
--- a/release/sysinstall/help/fr_FR.ISO8859-1/language.hlp
+++ /dev/null
@@ -1,13 +0,0 @@
-Ce menu permet de choisir parmi plusieurs, le langage que vous
-préférez. Pour l'instant cela n'est utilisé que dans certains fichiers
-d'aide.
-
-Les versions suivantes permettront d'adapter le clavier, les codes
-écran, la configuration NLS (le programme « sysinstall » utilisera
-alors des menus en conséquence), et d'autres caractéristiques suivant
-votre choix.
-
-En attendant, la méthode la plus simple consiste à éditer le fichier
-/etc/sysconfig dès la fin de l'installation. Les nombreux commentaires
-de ce fichier indiquent comment obtenir une configuration personnelle
-et proposent quelques exemples.
diff --git a/release/sysinstall/help/fr_FR.ISO8859-1/usage.hlp b/release/sysinstall/help/fr_FR.ISO8859-1/usage.hlp
deleted file mode 100644
index dd1d41a..0000000
--- a/release/sysinstall/help/fr_FR.ISO8859-1/usage.hlp
+++ /dev/null
@@ -1,54 +0,0 @@
-COMMENT UTILISER CE SYSTÈME DE MENUS
-====================================
-
-TOUCHE ACTION
------- ------
-FLÈCHE HAUT Aller sur la rubrique précédente (ou remonter, dans du texte).
-FLÈCHE BAS Aller sur la rubrique suivante (ou descendre, dans du texte).
-TAB Aller sur la rubrique ou le groupe suivant.
-FLÈCHE DROITE Aller sur la rubrique suivante. (même chose que TAB).
-MAJ-TAB Aller sur la rubrique ou le groupe précédent.
-FLÈCHE GAUCHE Aller sur la rubrique précédente. (même chose que MAJ-TAB).
-ENTRÉE Sélectionne la rubrique.
-PAGE PRÉC. Remonte d'une page, dans les boîtes de texte.
-PAGE SUIV. Descend d'une page, dans les boîtes de texte.
-ESPACE Sélectionne/désélectionne l'élément (menus à choix multiples).
-F1 Aide (pour les écrans qui en proposent).
-
-De même, des symboles du genre "^(-)" ou "v(+)" sur les côtés d'un menu,
-indiquent d'autres rubriques non affichées (par manque de place) plus haut ou
-plus bas (respectivement). Les flèches haut ou bas feront défiler le menu et
-feront apparaître les autres rubriques. Le symbole disparaît dès que le début
-(ou la fin) du menu est atteint.
-
-Dans les boîtes de texte, le pourcentage de texte déjà affiché est indiqué
-dans le coin inférieur droit. 100% veut dire qu'il n'y a plus rien à afficher.
-
-Sélectionner OK dans un menu pour confirmer votre choix.
-Sélectionner Cancel pour annuler l'opération et revenir au menu précédent.
-
-
-PARTICULARITÉS.
-===============
-
-On peut aussi choisir une rubrique dans un menu en tapant la première lettre
-de son nom, si il n'y pas d'ambiguïté. Ces lettres "accélératrices"
-apparaîtront en sur-brillance dans le nom de la rubrique.
-
-Il est aussi possible de remonter et revoir du texte qui a déjà défilé. Pour
-cela, appuyez sur la touche "arrêt défil" ("Scroll Lock" en anglais) puis
-utilisez la flèche-haut ou les touches Page Préc./Page Suiv. pour faire
-défiler le texte. Pour quitter ce mode, appuyez à nouveau sur la touche
-"arrêt défil.". Cette particularité est utile lorsque l'on est dans un
-sous-shell ou dans un mode qui ne présente pas de menu.
-
-Dès que le système est complètement installé et fonctionne en mode
-"multi-utilisateurs", il est possible d'utiliser des "écrans virtuels"
-et d'avoir une session dans chacun d'eux. Il suffit d'utiliser
-la combinaison de touches ALT-F<n> pour passer de l'un à l'autre :
-ALT-F1 pour aller sur la session "1", ALT-F2 pour la session "2", etc.
-3 écrans virtuels sont disponibles par défaut mais il est possible d'en
-ajouter d'autres en éditant le fichier /etc/ttys (la limite supérieure est
-fixée à 12)
-Les utilisateurs de X11 pourront noter que ces écrans sont toujours
-disponibles depuis X mais par les combinaisons CTRL-ALT-F<n>.
diff --git a/release/sysinstall/help/fr_FR.ISO_8859-1/README b/release/sysinstall/help/fr_FR.ISO_8859-1/README
deleted file mode 100644
index 13ef060..0000000
--- a/release/sysinstall/help/fr_FR.ISO_8859-1/README
+++ /dev/null
@@ -1,104 +0,0 @@
- -----------------------------------------
- FreeBSD version 2.0.5 , ,
- ----------------------------------------- /( )`
- \ \___ / |
- /- _ `-/ '
-Bienvenue dans FreeBSD, version 2.0.5 ! C'est une (/\/ \ \ /\
-version intermédiaire après une longue période / / | ` \
-nécessaire depuis la version 2.0 de Novembre 94 O O ) / |
-et en attendant la version 2.1 prévue pour fin `-^--'`< '
-Juillet 95. FreeBSD 2.0.5 constitue une nette (_.) _ ) /
-amélioration depuis la version 2.0 : un effort `.___/` /
-considérable du point de vue de la stabilité ainsi `-----' /
-que des nouveautés par douzaines. Pour <----. __ / __ \
-obtenir plus de détails concernant ces <----|====O)))==) \) /====
-nouveautés, consultez le fichier <----' `--' `.__,' \
-RELNOTES | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-FreeBSD est un système d'exploitation basé sur 4.4 BSD Lite, pour les
-PC munis de processeurs de type "x86" d'Intel, AMD, Cyrix ou NexGen.
-FreeBSD supporte une très large quantité de périphériques et de
-configurations. Il est utilisé pour de multiples tâches, allant du
-développement logiciel jusqu'à l'accès aux services d'Internet. Le
-site le plus utilisé sur Internet, ftp.cdrom.com, est une machine
-FreeBSD !
-
-Cette version de FreeBSD contient tout ce dont vous pouvez avoir
-besoin pour implanter ce système sur votre machine. Les sources de
-tous les programmes étant fournis, vous pouvez recompiler à loisir la
-distribution complète en une unique commande. C'est idéal pour les
-étudiants, les chercheurs et tous ceux qui sont simplement curieux de
-voir comment est conçu un tel système.
-
-Une importante collection de logiciels supportés (les « ports ») est
-aussi fournie pour vous aider à obtenir et à installer sur FreeBSD,
-les logiciels traditionnels du domaine UNIX. Plus de 270 ports sont
-ainsi disponibles, des éditeurs de texte aux langages de programmation,
-en passant par les applications graphiques... Tout cela contribue à
-faire autour de FreeBSD, un environnement puissant et accessible,
-capable de rivaliser avec beaucoup de stations de travail.
-
-En complément, il est recommandé d'acquérir les ouvrages relatifs à
-4.4BSD, chez « O'Reilly Associates » et « USENIX Association »,
-ISBN 1-56592-082-1. Nous n'avons pas d'intérêts dans la vente de ces
-ouvrages, nous sommes simplement des lecteurs satisfaits.
-
-Il est conseillé de lire le guide des configurations matérielles avant
-d'aller plus loin dans l'installation. La configuration d'un PC pour
-d'autres systèmes que DOS/Windows (qui n'est pas très exigeant sur ce
-point) est certainement un peu plus difficile qu'il n'y paraît, et si
-vous pensez maîtriser la situation, c'est sans doute que vous n'avez
-pas utilisé un PC depuis quelque temps. :) Ce guide donne les
-renseignements indiquant comment configurer votre machine et quels
-symptômes rechercher en cas de problème. Ce guide est disponible par
-le menu Documentation de la disquette de démarrage de FreeBSD.
-
-MISE EN GARDE : Malgré toutes les précautions, FreeBSD ne peut
-garantir contre une perte accidentelle des données. Il se peut que
-cette procédure d'installation efface complètement le contenu de votre
-disque dur. Il est donc fortement conseillé de faire une sauvegarde de
-votre disque avant de continuer cette installation.
-
-Les commentaires techniques à propos de cette version peuvent être
-adressés à :
-
- hackers@FreeBSD.org (en anglais)
-
-Les rapports de dysfonctionnement « bug reports » peuvent être
-notifiés par la commande « send-pr » dès que votre système est
-installé. Dans le cas contraire, ils peuvent être adressés à :
-
- bugs@FreeBSD.org (en anglais)
-
-N'oubliez par de joindre à votre requête, le numéro de la version de
-FreeBSD concernée.
-
-Les questions d'ordre général sont à diriger vers :
-
- questions@FreeBSD.org (en anglais)
-
-Ne soyez pas impatient si vos questions ne trouvent pas réponse dans
-la minute, car c'est beaucoup d'investissement que d'y répondre et il
-n'est pas rare que toute notre bonne volonté ne suffise pas. Les
-problèmes soumis par le biais de la commande « send-pr » sont
-automatiquement répertoriés dans une base de données. Vous resterez
-informés de toute évolution concernant votre demande.
-
-Notre site WEB est http://www.freebsd.org. C'est aussi une bonne
-source pour obtenir les dernières informations en date. Ce site
-propose de nombreuses facilités de documentation. La version de
-Netscape compilée pour BSDI peut être utilisée pour découvrir le
-« World Wide Web » directement à partir de FreeBSD.
-
-Pour de plus amples détails, consultez les fichiers contenus dans les
-répertoires /usr/share/FAQ et /usr/share/doc.
-
-Merci de votre attention, nous espérons sincèrement que cette version
-de FreeBSD vous donnera entière satisfaction.
-
- Jordan Hubbard,
- pour le projet FreeBSD
diff --git a/release/sysinstall/help/fr_FR.ISO_8859-1/configure.hlp b/release/sysinstall/help/fr_FR.ISO_8859-1/configure.hlp
deleted file mode 100644
index 4f3ed97..0000000
--- a/release/sysinstall/help/fr_FR.ISO_8859-1/configure.hlp
+++ /dev/null
@@ -1,16 +0,0 @@
-Ce menu permet de configurer votre système dès la fin de son
-installation. Le minimum conseillé est d'ajouter un mot de passe pour
-l'administrateur du système, et d'indiquer le fuseau horaire de votre
-localisation.
-
-Pour installer des utilitaires supplémentaires, tels que bash, emacs,
-pascal, etc., vous pouvez utiliser l'entrée « Packages » dans ce
-menu. L'obtention automatique de ces outils via FTP n'étant pas encore
-disponible, une installation à partir du disque ou du CDROM est
-nécessaire.
-
-Une installation ultérieure de ces outils sera toujours possible, à
-l'aide de la commande « pkg_manage ». Un ajustement de l'heure peut
-aussi être effectué grâce à « tzsetup ». Enfin, pour modifier la
-configuration générale de votre système, reportez vous au contenu du
-fichier /etc/sysconfig.
diff --git a/release/sysinstall/help/fr_FR.ISO_8859-1/language.hlp b/release/sysinstall/help/fr_FR.ISO_8859-1/language.hlp
deleted file mode 100644
index f4a99ea..0000000
--- a/release/sysinstall/help/fr_FR.ISO_8859-1/language.hlp
+++ /dev/null
@@ -1,13 +0,0 @@
-Ce menu permet de choisir parmi plusieurs, le langage que vous
-préférez. Pour l'instant cela n'est utilisé que dans certains fichiers
-d'aide.
-
-Les versions suivantes permettront d'adapter le clavier, les codes
-écran, la configuration NLS (le programme « sysinstall » utilisera
-alors des menus en conséquence), et d'autres caractéristiques suivant
-votre choix.
-
-En attendant, la méthode la plus simple consiste à éditer le fichier
-/etc/sysconfig dès la fin de l'installation. Les nombreux commentaires
-de ce fichier indiquent comment obtenir une configuration personnelle
-et proposent quelques exemples.
diff --git a/release/sysinstall/help/fr_FR.ISO_8859-1/usage.hlp b/release/sysinstall/help/fr_FR.ISO_8859-1/usage.hlp
deleted file mode 100644
index dd1d41a..0000000
--- a/release/sysinstall/help/fr_FR.ISO_8859-1/usage.hlp
+++ /dev/null
@@ -1,54 +0,0 @@
-COMMENT UTILISER CE SYSTÈME DE MENUS
-====================================
-
-TOUCHE ACTION
------- ------
-FLÈCHE HAUT Aller sur la rubrique précédente (ou remonter, dans du texte).
-FLÈCHE BAS Aller sur la rubrique suivante (ou descendre, dans du texte).
-TAB Aller sur la rubrique ou le groupe suivant.
-FLÈCHE DROITE Aller sur la rubrique suivante. (même chose que TAB).
-MAJ-TAB Aller sur la rubrique ou le groupe précédent.
-FLÈCHE GAUCHE Aller sur la rubrique précédente. (même chose que MAJ-TAB).
-ENTRÉE Sélectionne la rubrique.
-PAGE PRÉC. Remonte d'une page, dans les boîtes de texte.
-PAGE SUIV. Descend d'une page, dans les boîtes de texte.
-ESPACE Sélectionne/désélectionne l'élément (menus à choix multiples).
-F1 Aide (pour les écrans qui en proposent).
-
-De même, des symboles du genre "^(-)" ou "v(+)" sur les côtés d'un menu,
-indiquent d'autres rubriques non affichées (par manque de place) plus haut ou
-plus bas (respectivement). Les flèches haut ou bas feront défiler le menu et
-feront apparaître les autres rubriques. Le symbole disparaît dès que le début
-(ou la fin) du menu est atteint.
-
-Dans les boîtes de texte, le pourcentage de texte déjà affiché est indiqué
-dans le coin inférieur droit. 100% veut dire qu'il n'y a plus rien à afficher.
-
-Sélectionner OK dans un menu pour confirmer votre choix.
-Sélectionner Cancel pour annuler l'opération et revenir au menu précédent.
-
-
-PARTICULARITÉS.
-===============
-
-On peut aussi choisir une rubrique dans un menu en tapant la première lettre
-de son nom, si il n'y pas d'ambiguïté. Ces lettres "accélératrices"
-apparaîtront en sur-brillance dans le nom de la rubrique.
-
-Il est aussi possible de remonter et revoir du texte qui a déjà défilé. Pour
-cela, appuyez sur la touche "arrêt défil" ("Scroll Lock" en anglais) puis
-utilisez la flèche-haut ou les touches Page Préc./Page Suiv. pour faire
-défiler le texte. Pour quitter ce mode, appuyez à nouveau sur la touche
-"arrêt défil.". Cette particularité est utile lorsque l'on est dans un
-sous-shell ou dans un mode qui ne présente pas de menu.
-
-Dès que le système est complètement installé et fonctionne en mode
-"multi-utilisateurs", il est possible d'utiliser des "écrans virtuels"
-et d'avoir une session dans chacun d'eux. Il suffit d'utiliser
-la combinaison de touches ALT-F<n> pour passer de l'un à l'autre :
-ALT-F1 pour aller sur la session "1", ALT-F2 pour la session "2", etc.
-3 écrans virtuels sont disponibles par défaut mais il est possible d'en
-ajouter d'autres en éditant le fichier /etc/ttys (la limite supérieure est
-fixée à 12)
-Les utilisateurs de X11 pourront noter que ces écrans sont toujours
-disponibles depuis X mais par les combinaisons CTRL-ALT-F<n>.
diff --git a/release/sysinstall/help/it_IT.ISO8859-1/README b/release/sysinstall/help/it_IT.ISO8859-1/README
deleted file mode 100644
index cd6f64b..0000000
--- a/release/sysinstall/help/it_IT.ISO8859-1/README
+++ /dev/null
@@ -1,107 +0,0 @@
- -----------------------------------------
- FreeBSD 2.0.5 --- RELEASE Version , ,
- ----------------------------------------- /( )`
- \ \___ / |
-Benvenuti alla release 2.0.5 di FreeBSD! 2.0.5 e` /- _ `-/ '
-una release completa di FreeBSD che riempie il lungo (/\/ \ \ /\
-intervallo tra la 2.0R (introdotta a Nov.94) e la / / | ` \
-2.1R (che uscira` a fine luglio '95). FreeBSD 2.0.5 O O ) / |
-contiene molti importanti miglioramenti rispetto `-^--'`< '
-alla versione 2.0R, non ultimo una stabilita` molto (_.) _ ) /
-maggiore, decine di nuove opzioni e un programma `.___/` /
-di installazione molto migliorato. `-----' /
-Maggiori dettagli su cosa c'e' di <----. __ / __ \
-nuovo in FreeBSD 2.0.5 sono nelle <----|====O)))==) \) /====
-release notes. <----' `--' `.__,' \
- | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-Cos'e` FreeBSD ? E` un sistema operativo basato su 4.4 BSD Lite
-per PC basati su hardware Intel, AMD, Cyrix o NexGen "x86". Supporta
-moltissime periferiche e configurazioni hardware e puo` essere
-usato per applicazioni che vanno dallo sviluppo di software alla
-fornitura di servizi Internet. Il nodo piu` gettonato della Internet,
-ftp.cdrom.com, e` una macchina FreeBSD!
-
-Questa versione di FreeBSD contiene tutto quello che serve per far
-funzionare il sistema, e inoltre i sorgenti completi del sistema
-e di ogni applicazione. Installando la distribuzione dei sorgenti
-sarete in grado di ricompilare l'intero sistema operativo da zero
-con un solo comando: questa e` una caratteristica ideale per
-studenti, ricercatori o altri interessati a vedere come funziona
-il tutto.
-
-E` anche disponibile (la "ports collection") un gran numero di
-pacchetti software forniti da terze parti e portati su FreeBSD,
-per semplificarvi il compito di cercare e installare tutte le
-utilities tradizionali di Unix su FreeBSD. Ci sono oltre 270
-applicazioni, che comprendono editor, linguaggi di programmazione,
-applicazioni grafiche, e rendono FreeBSD un ambiente operativo
-potente e completo che rivaleggia, per potenza e utilita`, quello
-di molte workstation di grosse dimensioni.
-
-Maggiori informazioni e documentazione sul sistema si possono
-trovare sul "4.4BSD Document Set", della O'Reilly Associates e
-USENIX Association, ISBN 1-56592-082-1. Non abbiamo nessuna
-connessione con la O'Reilly, siamo solo acquirenti soddisfatti!
-
-Si consiglia la lettura della HARDWARE GUIDE *prima* di procedere
-con l'installazione. La configurazione dell'hardware di un PC per
-applicazioni che non siano DOS/Windows (queste di fatto sfruttano
-ben poco l'hardware) e` piu` difficile di quanto sembri, e se
-pensate di conoscere i PC e` semplicemente perche' non li avete
-usati abbastanza a lungo! :) Questa guida vi fornira` qualche
-suggerimento su come configurare il vostro hardware e a quali
-sintomi fare attenzione in caso di problemi. La guida e` disponibile
-nel menu "Documentazione" del disco di boot di FreeBSD.
-
-ATTENZIONE: FreeBSD fa il possibile per salvaguardarvi da perdite
-accidentali di dati, ma l'imprevisto e` sempre in agguato, ed e`
-sempre possibile che IL VOSTRO DISCO POSSA ESSERE COMPLETAMENTE
-CANCELLATO durante l'installazione. Quindi, per vostra sicurezza,
-non procedete con l'installazione se non avete prima fatto una
-copia di informazioni importanti che si trovano sullo stesso! Uomo
-avvisato, mezzo salvato!
-
-Commenti e osservazioni tecniche su questa release possono essere
-inviate (in inglese!) a
-
- hackers@FreeBSD.org
-
-Segnalazioni di bachi (bug) possono essere inviate col comando
-`send-pr' (se siete riusciti a installare il sistema), o altrimenti
-per email a:
-
- bugs@FreeBSD.org
-
-Per favore indicate esattamente a QUALE VERSIONE di FreeBSD si
-riferisce il problema a cui fate riferimento.
-
-Domande di tipo generale si possono inviare a:
-
- questions@FreeBSD.org
-
-Pazientate se le vostre domande non ricevono risposta immediata -
-questo e` un periodo di grande impegno per noi, e il tempo dei
-nostri volontari e` spesso tirato al limite! Le indicazioni di bug
-inviate col comando send-pr sono registrate e gestite dal nostro
-database per la gestione dei bug, e sarete quindi informati di
-eventuali cambiamenti nel loro stato.
-
-Il nostro sito WEB, http://www.freebsd.org, e` una buona sorgente
-di informazioni aggiornate e fornisce un buon numero di informazioni
-avanzate. Su FreeBSD potete usare la versione per BSDI di Netscape
-per navigare su World Wide Web.
-
-Potete anche cercare in /usr/share/FAQ e /usr/share/doc per ulteriori
-informazioni sul sistema.
-
-Grazie per essere arrivati fino a questo punto. Speriamo che questa
-versione di FreeBSD vi soddisfi!
-
- Jordan Hubbard,
- per il "FreeBSD Project"
diff --git a/release/sysinstall/help/it_IT.ISO8859-1/configure.hlp b/release/sysinstall/help/it_IT.ISO8859-1/configure.hlp
deleted file mode 100644
index d144cf1..0000000
--- a/release/sysinstall/help/it_IT.ISO8859-1/configure.hlp
+++ /dev/null
@@ -1,16 +0,0 @@
-Questo menu vi permette di scegliere la configurazione iniziale
-del sistema dopo l'installazione. Come minimo, andrebbero definite
-la password del system manager e il fuso orario locale.
-
-Per applicazioni addizionali quali bash, emacs, pascal ecc. fate
-riferimento alla voce "Packages" in questo menu. Si noti che questa
-voce e` utile solo se avete a disposizione il CDROM o la collezione
-dei sorgenti delle applicazioni da qualche parte nel file system.
-Il trasferimento automatico, via FTP, dei sorgenti non e` ancora
-supportato.
-
-Se volete invocare nuovamente il software di installazione delle
-applicazioni dopo aver finito l'installazione, dovete usare il
-comando ``pkg_manage''. Per scegliere il fuso orario, battere
-``tzsetup''. Per ulteriori informazioni sulla configurazione generale
-del sistema, guardare il file ``/etc/sysconfig''.
diff --git a/release/sysinstall/help/it_IT.ISO8859-1/language.hlp b/release/sysinstall/help/it_IT.ISO8859-1/language.hlp
deleted file mode 100644
index 2bc2a0e..0000000
--- a/release/sysinstall/help/it_IT.ISO8859-1/language.hlp
+++ /dev/null
@@ -1,15 +0,0 @@
-
-Usate questo menu per scegliere il vostro linguaggio preferito. Al
-momento, questa selezione influenza solo il linguaggio nel quale
-sono mostrati i files di help.
-
-In future release, questa selezione cambiera` anche il layout della
-tastiera, la tabella dei caratteri, le funzioni di supporto ai
-linguaggi nazionali, e altre funzioni I18N che fanno parte dei vari
-standard.
-
-Fino a quando tutte queste funzionalita` non saranno attive, e`
-probabilmente piu` semplice editare a mano il file /etc/sysconfig
-una volta che il sistema e` installato completamente. Nel file ci
-sono diversi commenti che spiegano cosa dovrebbe essere cambiato,
-e anche alcuni esempi di settaggi per lingue diverse dall'inglese.
diff --git a/release/sysinstall/help/it_IT.ISO8859-1/usage.hlp b/release/sysinstall/help/it_IT.ISO8859-1/usage.hlp
deleted file mode 100644
index bc4fd38..0000000
--- a/release/sysinstall/help/it_IT.ISO8859-1/usage.hlp
+++ /dev/null
@@ -1,56 +0,0 @@
-COME USARE QUESTO SISTEMA
-=========================
-
-TASTO AZIONE
------ ------
-FRECCIA IN ALTO voce precedente (o linea in alto, in un'area di testo)
-FRECCIA IN BASSO voce successiva (o linea in basso, in un'area di testo)
-TAB voce o gruppo successivo
-FRECCIA A DESTRA voce o gruppo successivo (come TAB)
-SHIFT-TAB voce o gruppo precedente
-FRECCIA A SINISTRA voce o gruppo precedente (come SHIFT-TAB)
-RETURN selezione voce corrente
-PAGINA SU nelle aree di testo, va alla pagina precedente
-PAGINA GIU nelle aree di testo, va alla pagina successiva
-SPAZIO cambia stato alla voce corrente (menu "radio")
-F1 aiuto (nelle schermate che lo prevedono).
-
-I simboli "^(-)" or "v(+)" ai lati del menu indicano che ci sono
-altre voci oltre a quella corrente che non sono visualizzate per
-carenza di spazio sullo schermo. Le frecce in alto/basso provocano
-lo scroll del menu. Quando uno di questi simboli scompare, si e`
-raggiunto l'inizio o la fine del menu.
-
-Nei campi di tipo testo, la percentuale rimanente del testo e`
-mostrata nell'angolo in masso a destra. 100% significa che si e`
-posizionati alla fine del campo.
-
-Selezionando OK in un menu si conferma l'azione che esso controlla.
-Selezionando Cancel si cancella l'operazione e di solito si ritorna
-al menu precedente.
-
-
-FUNZIONI SPECIALI
-=================
-
-E` possibile selezionare una voce di un menu anche battendo il
-primo carattere del suo nome, se unico. Questi caratteri "acceleratori"
-saranno evidenziati nel nome del menu.
-
-Il driver della console contiene anche un buffer che permette di
-rivedere cose che sono scomparse dallo schermo a causa dello scroll.
-Per usare questa funzione (scroll-back), premere il tasto
-"Scroll Lock" sulla tastiera e usare i tasti "Pagina Su"/"Pagina Giu" per
-muoversi attraverso il testo salvato. Per tornare al funzionamento
-normale, premere nuovamente il tasto "Scroll Lock". Questa funzione
-e` utile soprattutto all'interno di sotto-shell o altre funzioni
-speciali che non usano i menu.
-
-Quando il sistema e` installato e completamente funzionante in
-modo multiutente, e` possibile usare le "console virtuali" per
-avere diverse sessioni contemporanee. I tasti ALT-F<n> possono
-essere usati per commutare tra le finestre disponibili, dove F<n>
-e` il tasto funzione corrispondente allo schermo desiderato. La
-configurazione di default prevede 3 console abilitate, ma se ne
-possono creare altre -- fino a 12 -- modificando il file /etc/ttys
-quando il sistema e` in modo multiutente.
diff --git a/release/sysinstall/help/it_IT.ISO_8859-1/README b/release/sysinstall/help/it_IT.ISO_8859-1/README
deleted file mode 100644
index cd6f64b..0000000
--- a/release/sysinstall/help/it_IT.ISO_8859-1/README
+++ /dev/null
@@ -1,107 +0,0 @@
- -----------------------------------------
- FreeBSD 2.0.5 --- RELEASE Version , ,
- ----------------------------------------- /( )`
- \ \___ / |
-Benvenuti alla release 2.0.5 di FreeBSD! 2.0.5 e` /- _ `-/ '
-una release completa di FreeBSD che riempie il lungo (/\/ \ \ /\
-intervallo tra la 2.0R (introdotta a Nov.94) e la / / | ` \
-2.1R (che uscira` a fine luglio '95). FreeBSD 2.0.5 O O ) / |
-contiene molti importanti miglioramenti rispetto `-^--'`< '
-alla versione 2.0R, non ultimo una stabilita` molto (_.) _ ) /
-maggiore, decine di nuove opzioni e un programma `.___/` /
-di installazione molto migliorato. `-----' /
-Maggiori dettagli su cosa c'e' di <----. __ / __ \
-nuovo in FreeBSD 2.0.5 sono nelle <----|====O)))==) \) /====
-release notes. <----' `--' `.__,' \
- | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-Cos'e` FreeBSD ? E` un sistema operativo basato su 4.4 BSD Lite
-per PC basati su hardware Intel, AMD, Cyrix o NexGen "x86". Supporta
-moltissime periferiche e configurazioni hardware e puo` essere
-usato per applicazioni che vanno dallo sviluppo di software alla
-fornitura di servizi Internet. Il nodo piu` gettonato della Internet,
-ftp.cdrom.com, e` una macchina FreeBSD!
-
-Questa versione di FreeBSD contiene tutto quello che serve per far
-funzionare il sistema, e inoltre i sorgenti completi del sistema
-e di ogni applicazione. Installando la distribuzione dei sorgenti
-sarete in grado di ricompilare l'intero sistema operativo da zero
-con un solo comando: questa e` una caratteristica ideale per
-studenti, ricercatori o altri interessati a vedere come funziona
-il tutto.
-
-E` anche disponibile (la "ports collection") un gran numero di
-pacchetti software forniti da terze parti e portati su FreeBSD,
-per semplificarvi il compito di cercare e installare tutte le
-utilities tradizionali di Unix su FreeBSD. Ci sono oltre 270
-applicazioni, che comprendono editor, linguaggi di programmazione,
-applicazioni grafiche, e rendono FreeBSD un ambiente operativo
-potente e completo che rivaleggia, per potenza e utilita`, quello
-di molte workstation di grosse dimensioni.
-
-Maggiori informazioni e documentazione sul sistema si possono
-trovare sul "4.4BSD Document Set", della O'Reilly Associates e
-USENIX Association, ISBN 1-56592-082-1. Non abbiamo nessuna
-connessione con la O'Reilly, siamo solo acquirenti soddisfatti!
-
-Si consiglia la lettura della HARDWARE GUIDE *prima* di procedere
-con l'installazione. La configurazione dell'hardware di un PC per
-applicazioni che non siano DOS/Windows (queste di fatto sfruttano
-ben poco l'hardware) e` piu` difficile di quanto sembri, e se
-pensate di conoscere i PC e` semplicemente perche' non li avete
-usati abbastanza a lungo! :) Questa guida vi fornira` qualche
-suggerimento su come configurare il vostro hardware e a quali
-sintomi fare attenzione in caso di problemi. La guida e` disponibile
-nel menu "Documentazione" del disco di boot di FreeBSD.
-
-ATTENZIONE: FreeBSD fa il possibile per salvaguardarvi da perdite
-accidentali di dati, ma l'imprevisto e` sempre in agguato, ed e`
-sempre possibile che IL VOSTRO DISCO POSSA ESSERE COMPLETAMENTE
-CANCELLATO durante l'installazione. Quindi, per vostra sicurezza,
-non procedete con l'installazione se non avete prima fatto una
-copia di informazioni importanti che si trovano sullo stesso! Uomo
-avvisato, mezzo salvato!
-
-Commenti e osservazioni tecniche su questa release possono essere
-inviate (in inglese!) a
-
- hackers@FreeBSD.org
-
-Segnalazioni di bachi (bug) possono essere inviate col comando
-`send-pr' (se siete riusciti a installare il sistema), o altrimenti
-per email a:
-
- bugs@FreeBSD.org
-
-Per favore indicate esattamente a QUALE VERSIONE di FreeBSD si
-riferisce il problema a cui fate riferimento.
-
-Domande di tipo generale si possono inviare a:
-
- questions@FreeBSD.org
-
-Pazientate se le vostre domande non ricevono risposta immediata -
-questo e` un periodo di grande impegno per noi, e il tempo dei
-nostri volontari e` spesso tirato al limite! Le indicazioni di bug
-inviate col comando send-pr sono registrate e gestite dal nostro
-database per la gestione dei bug, e sarete quindi informati di
-eventuali cambiamenti nel loro stato.
-
-Il nostro sito WEB, http://www.freebsd.org, e` una buona sorgente
-di informazioni aggiornate e fornisce un buon numero di informazioni
-avanzate. Su FreeBSD potete usare la versione per BSDI di Netscape
-per navigare su World Wide Web.
-
-Potete anche cercare in /usr/share/FAQ e /usr/share/doc per ulteriori
-informazioni sul sistema.
-
-Grazie per essere arrivati fino a questo punto. Speriamo che questa
-versione di FreeBSD vi soddisfi!
-
- Jordan Hubbard,
- per il "FreeBSD Project"
diff --git a/release/sysinstall/help/it_IT.ISO_8859-1/configure.hlp b/release/sysinstall/help/it_IT.ISO_8859-1/configure.hlp
deleted file mode 100644
index d144cf1..0000000
--- a/release/sysinstall/help/it_IT.ISO_8859-1/configure.hlp
+++ /dev/null
@@ -1,16 +0,0 @@
-Questo menu vi permette di scegliere la configurazione iniziale
-del sistema dopo l'installazione. Come minimo, andrebbero definite
-la password del system manager e il fuso orario locale.
-
-Per applicazioni addizionali quali bash, emacs, pascal ecc. fate
-riferimento alla voce "Packages" in questo menu. Si noti che questa
-voce e` utile solo se avete a disposizione il CDROM o la collezione
-dei sorgenti delle applicazioni da qualche parte nel file system.
-Il trasferimento automatico, via FTP, dei sorgenti non e` ancora
-supportato.
-
-Se volete invocare nuovamente il software di installazione delle
-applicazioni dopo aver finito l'installazione, dovete usare il
-comando ``pkg_manage''. Per scegliere il fuso orario, battere
-``tzsetup''. Per ulteriori informazioni sulla configurazione generale
-del sistema, guardare il file ``/etc/sysconfig''.
diff --git a/release/sysinstall/help/it_IT.ISO_8859-1/language.hlp b/release/sysinstall/help/it_IT.ISO_8859-1/language.hlp
deleted file mode 100644
index 2bc2a0e..0000000
--- a/release/sysinstall/help/it_IT.ISO_8859-1/language.hlp
+++ /dev/null
@@ -1,15 +0,0 @@
-
-Usate questo menu per scegliere il vostro linguaggio preferito. Al
-momento, questa selezione influenza solo il linguaggio nel quale
-sono mostrati i files di help.
-
-In future release, questa selezione cambiera` anche il layout della
-tastiera, la tabella dei caratteri, le funzioni di supporto ai
-linguaggi nazionali, e altre funzioni I18N che fanno parte dei vari
-standard.
-
-Fino a quando tutte queste funzionalita` non saranno attive, e`
-probabilmente piu` semplice editare a mano il file /etc/sysconfig
-una volta che il sistema e` installato completamente. Nel file ci
-sono diversi commenti che spiegano cosa dovrebbe essere cambiato,
-e anche alcuni esempi di settaggi per lingue diverse dall'inglese.
diff --git a/release/sysinstall/help/it_IT.ISO_8859-1/usage.hlp b/release/sysinstall/help/it_IT.ISO_8859-1/usage.hlp
deleted file mode 100644
index bc4fd38..0000000
--- a/release/sysinstall/help/it_IT.ISO_8859-1/usage.hlp
+++ /dev/null
@@ -1,56 +0,0 @@
-COME USARE QUESTO SISTEMA
-=========================
-
-TASTO AZIONE
------ ------
-FRECCIA IN ALTO voce precedente (o linea in alto, in un'area di testo)
-FRECCIA IN BASSO voce successiva (o linea in basso, in un'area di testo)
-TAB voce o gruppo successivo
-FRECCIA A DESTRA voce o gruppo successivo (come TAB)
-SHIFT-TAB voce o gruppo precedente
-FRECCIA A SINISTRA voce o gruppo precedente (come SHIFT-TAB)
-RETURN selezione voce corrente
-PAGINA SU nelle aree di testo, va alla pagina precedente
-PAGINA GIU nelle aree di testo, va alla pagina successiva
-SPAZIO cambia stato alla voce corrente (menu "radio")
-F1 aiuto (nelle schermate che lo prevedono).
-
-I simboli "^(-)" or "v(+)" ai lati del menu indicano che ci sono
-altre voci oltre a quella corrente che non sono visualizzate per
-carenza di spazio sullo schermo. Le frecce in alto/basso provocano
-lo scroll del menu. Quando uno di questi simboli scompare, si e`
-raggiunto l'inizio o la fine del menu.
-
-Nei campi di tipo testo, la percentuale rimanente del testo e`
-mostrata nell'angolo in masso a destra. 100% significa che si e`
-posizionati alla fine del campo.
-
-Selezionando OK in un menu si conferma l'azione che esso controlla.
-Selezionando Cancel si cancella l'operazione e di solito si ritorna
-al menu precedente.
-
-
-FUNZIONI SPECIALI
-=================
-
-E` possibile selezionare una voce di un menu anche battendo il
-primo carattere del suo nome, se unico. Questi caratteri "acceleratori"
-saranno evidenziati nel nome del menu.
-
-Il driver della console contiene anche un buffer che permette di
-rivedere cose che sono scomparse dallo schermo a causa dello scroll.
-Per usare questa funzione (scroll-back), premere il tasto
-"Scroll Lock" sulla tastiera e usare i tasti "Pagina Su"/"Pagina Giu" per
-muoversi attraverso il testo salvato. Per tornare al funzionamento
-normale, premere nuovamente il tasto "Scroll Lock". Questa funzione
-e` utile soprattutto all'interno di sotto-shell o altre funzioni
-speciali che non usano i menu.
-
-Quando il sistema e` installato e completamente funzionante in
-modo multiutente, e` possibile usare le "console virtuali" per
-avere diverse sessioni contemporanee. I tasti ALT-F<n> possono
-essere usati per commutare tra le finestre disponibili, dove F<n>
-e` il tasto funzione corrispondente allo schermo desiderato. La
-configurazione di default prevede 3 console abilitate, ma se ne
-possono creare altre -- fino a 12 -- modificando il file /etc/ttys
-quando il sistema e` in modo multiutente.
diff --git a/release/sysinstall/help/ja_JP.JIS/README b/release/sysinstall/help/ja_JP.JIS/README
deleted file mode 100644
index fd43dd3..0000000
--- a/release/sysinstall/help/ja_JP.JIS/README
+++ /dev/null
@@ -1,97 +0,0 @@
- -----------------------------------------
- FreeBSD 2.0.5 --- RELEASE Version , ,
- ----------------------------------------- /( )`
- \ \___ / |
-$B$h$&$3$=(B FreeBSD $B$N(B 2.0.5 $B%j%j!<%9$X(B! 2.0R ($B$3$l$O(B /- _ `-/ '
-94 $BG/(B 11 $B7n$K%j%j!<%9$5$l$^$7$?(B) $B$H!"(B95 $BG/(B 7 $B7n=*$j(B (/\/ \ \ /\
-$B$4$m%j%j!<%9$5$l$kM=Dj$N(B 2.1R $B$H$N4V$rKd$a$k$?$a$K(B / / | ` \
-$BI,MW$H$5$l$?$?$a!"(B2.0.5 $B$O;CDjE*$K%j%j!<%9$5$l$^$7(B O O ) / |
-$B$?!#(BFreeBSD 2.0.5 $B$O(B 2.0R $B$+$iB?$/$N=EMW$J2~NI$,9T(B `-^--'`< '
-$B$o$l$^$7$?!#$H$F$b0BDj$7$F$$$k(B ($B$+$J$j$NM>M5$r;}$C(B (_.) _ ) /
-$B$F(B) $B$@$1$G$O$J$/!"$?$/$5$s$N?7$7$$FCD'$d$H$F$b3HD%(B `.___/` /
-$B$5$l$?%$%s%9%H!<%k%W%m%0%i%`$b$"$j$^$9!#(B `-----' /
-FreeBSD 2.0.5 $B$G?7$7$/$J$C$?ItJ,$K$D$$$F(B <----. __ / __ \
-$B$h$j>\$7$/$O!"%j%j!<%9%N!<%D$rFI$s$G$/$@(B <----|====O)))==) \) /====
-$B$5$$(B! <----' `--' `.__,' \
- | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-FreeBSD $B$C$F2?(B? FreeBSD $B$O(B 4.4 BSD Lite $B$r85$K$7!"(BIntel$B!"(BAMD$B!"(BCyrix$B!"(B
-NexGen $B$J$I$N!V(Bx86$B!W%Y!<%9$N(B PC $B$GF0:n$9$k%*%Z%l!<%F%#%s%0%7%9%F%`$G$9!#(B
-$BMM!9$J(B PC $BMQ<~JU5!4o$d9=@.$GF0:n$7!"%=%U%H%&%'%"3+H/$+$i(B Internet $B%5!<(B
-$B%S%9Ds6!$^$G$"$i$f$k$3$H$K;HMQ$G$-$^$9!#(BInternet $B>e$N>&6HE*%5%$%H$G$"(B
-$B$k(B ftp.cdrom.com $B$O(B FreeBSD $B%^%7%s$G$9(B!
-
-FreeBSD $B$N$3$N%j%j!<%9$G$O!"$3$&$$$C$?%7%9%F%`$r<B9T$9$k$?$a$KI,MW$JJ*(B
-$BA4$F$,!"40A4$J%=!<%9%3!<%IIU$G4^$^$l$F$$$^$9!#%=!<%9%G%#%9%H%j%S%e!<%7%g(B
-$B%s$r%$%s%9%H!<%k$9$l$P!"0l$D$N%3%^%s%I$G!"J8;zDL$jA4$F$N%7%9%F%`$r%3%s(B
-$B%Q%$%k$7D>$9$3$H$,$G$-$^$9!#$3$l$O!"3X@8!"8&5f<T!"$b$7$/$O$I$&$d$C$FF0(B
-$B:n$7$F$$$k$+$rCN$j$?$$?M$?$A$K$H$C$F$OM}A[E*$G$9!#(B
-
-$BEAE}E*$J(B UNIX $B%f!<%F%#%j%F%#!<$r<j$KF~$l!"(BFreeBSD $B$K%$%s%9%H!<%k$7$d$9(B
-$B$$$h$&$K!"%5!<%I%Q!<%F%#!<$N0\?"$7$?%=%U%H%&%(%"$,$?$/$5$s=8$a$F$"$j$^(B
-$B$9(B ("ports collection")$B!#(BEMACS $B%(%G%#%?$+$i(B lisp $B=hM}7O$^$G$NA4$F$r4^(B
-$B$`(B 270 $B0J>e$N(B ports $B$K$h$C$F!"(BFreeBSD $B$O0lHLE*$J<BMQ@-$dG=NO$G$OB??t$N(B
-$B%o!<%/%9%F!<%7%g%s$KI$E($9$k!"6/NO$GJq3gE*$J%*%Z%l!<%F%#%s%0%7%9%F%`$H(B
-$B$J$C$F$$$^$9!#(B
-
-
-$B$3$N%7%9%F%`$N$h$jB?$/$NJ8=q$K$D$$$F$O!"(BO'Reilly Associates and the
-USENIX Associations $B$N(B 4.4BSD Document Set (ISBM 1-56592-082-1) $B$r9XF~(B
-$B$7$F$/$@$5$$!#;dC#$O(B O'Reilly $B$H$O2?$N4X78$b$"$j$^$;$s!#;dC#$O$?$@8\5R(B
-$B$H$7$FK~B-$7$F$$$k$@$1$G$9!#(B
-
-$B%$%s%9%H!<%k$r9T$&A0$K!"(BHARDWARE GUIDE $B$rFI$_$?$/$J$k$+$b$7$l$^$;$s!#(B
-PC $B$r(B DOS/Windows ($B$3$l$i$O$"$^$j%O!<%I%&%'%"$rMW5a$7$^$;$s(B) $B0J30$N$?(B
-$B$a$K@_Dj$9$k$N$O$o$j$HFq$7$$$3$H$G$9!#$b$7!"(BPC $B$N$3$H$OM}2r$7$F$$$k$H(B
-$B;W$C$F$$$k$H$7$?$i!"$^$@==J,D9$/;H$C$F$J$$$C$F$3$H$G$9(B! :) $B$3$N%,%$%I(B
-$B$K$O!"$I$s$J$U$&$K%O!<%I%&%'%"$r@_Dj$9$l$P$$$$$N$+!"%H%i%V%k$N>l9g$O$I(B
-$B$s$JC{8u$r4Q;!$9$l$P$$$$$N$+$K$D$$$F$NHk7m$,$"$j$^$9!#$3$N%,%$%I$O!"(B
-FreeBSD $B%V!<%H%U%m%C%T!<$N(B Documentation $B%a%K%e!<$K$"$j$^$9!#(B
-
-$BH]G'@<L@J8(B: FreeBSD $B$O;v8N$G%G!<%?$,$J$/$J$k$3$H$N$J$$$h$&!"%Y%9%H$r?T(B
-$B$/$7$F$$$^$9$,!"%$%s%9%H!<%kCf$K%G%#%9%/A4BN$r>C$7$F$7$^$&2DG=@-$O0MA3(B
-$B$H$7$FB8:_$7$^$9(B! $B:G=i$K=EMW$J%G!<%?$N%P%C%/%"%C%W$r$-$A$s$H$H$C$F$J$$(B
-$B$J$i!":G8e$N(B FreeBSD $B%$%s%9%H!<%k%a%K%e!<$O<B9T$7$J$$$G$/$@$5$$(B! $B$A$c(B
-$B$s$H8@$$$^$7$?$h(B!
-
-$B$3$N%j%j!<%9$K4X$9$k5;=QE*$J%3%a%s%H$O0J2<$KAw$C$F$/$@$5$$(B:
-
- hackers@FreeBSD.org
-
-
-$B%P%0%l%]!<%H$O!"%7%9%F%`$r%$%s%9%H!<%k$G$-$?$J$i!V(Bsend-pr$B!W%3%^%s%I$r(B
-$B;H$C$FAw$C$F$/$@$5$$!#$=$&$G$J$$$J$i!"0J2<$KAw$C$F$/$@$5$$(B:
-
- bugs@FreeBSD.org
-
-$B%P%0%l%]!<%H$G$O!"$I$N%P!<%8%g%s$N(B FreeBSD $B$r;H$C$F$$$k$N$+$rL@5-$9$k(B
-$B$h$&5$$r$D$1$F$/$@$5$$!#(B
-
-
-$B0lHLE*$J<ALd$O0J2<$KAw$C$F$/$@$5$$(B:
-
- questions@FreeBSD.org
-
-$B<ALd$KBP$9$k2sEz$,$9$0$KF@$i$l$J$/$F$b$,$^$s$7$F$/$@$5$$(B $B!=(B $B8=:_$O;dC#(B
-$B$K$H$C$F$H$F$bK;$7$$;~$G$9$7!"%\%i%s%F%#%"C#$b8B3&$^$G$,$s$P$C$F$$$^$9(B!
-send-pr $B%3%^%s%I$GDs=P$5$l$?%P%0%l%]!<%H$O%P%0%G!<%?%Y!<%9$K5-O?$5$l!"(B
-$BDI@W$5$l$^$9!#$=$7$F!"$=$N%P%0(B ($B$^$?$O;EMM$K4X$9$kMW5a(B) $B$,B8:_$9$k4V$O(B
-$B$"$i$f$k>uBV$NJQ99$,$"$J$?$KDLCN$5$l$^$9!#(B
-
-$B;dC#$N(B WEB $B%5%$%H$G$"$k(B http://www.freebsd.org $B$b!"99?7$5$l$?>pJs$N$h(B
-$B$$>pJs85$G$9$7!"$?$/$5$s$N9bEY$JJ8=q$,MQ0U$5$l$F$$$^$9!#(BBSDI $BMQ$N(B
-Netscape $B$r;HMQ$9$k$H!"(BWorld Wide Web $B$rD>@\(B FreeBSD $B$+$i1\Mw$G$-$^$9!#(B
-
-/usr/share/FAQ $B$d(B /usr/share/doc $B$K$O!"$5$i$K>pJs$,$"$j$^$9!#(B
-
-
-$BFI$s$G$/$@$5$C$F$"$j$,$H$&!#$I$&$>$3$N%j%j!<%9$N(B FreeBSD $B$r$*$?$N$7$_(B
-$B$/$@$5$$(B!
-
- Jordan Hubbard,
- for The FreeBSD Project
diff --git a/release/sysinstall/help/ja_JP.JIS/configure.hlp b/release/sysinstall/help/ja_JP.JIS/configure.hlp
deleted file mode 100644
index 3860fb9..0000000
--- a/release/sysinstall/help/ja_JP.JIS/configure.hlp
+++ /dev/null
@@ -1,13 +0,0 @@
-$B$3$N%a%K%e!<$G$O!"%$%s%9%H!<%k8e$K%7%9%F%`$N@_Dj$r$7$^$9!#>/$J$/$H$b!"(B
-$B%7%9%F%`4IM}<T$H%7%9%F%`$N%?%$%`%>!<%s$N@_Dj$O$7$F$/$@$5$$!#(B
-
-bash$B!"(Bemacs$B!"(Bpascal $B$J$I$N!"$5$i$J$kL%NOE*$JJ*$K$D$$$F$O!"$3$N%a%K%e!<(B
-$B$N(B Package $B$N9`L\$r8+$F$/$@$5$$!#8=:_$N$H$3$m!"(BCD-ROM $B$r;}$C$F$$$k$+!"(B
-$B%U%!%$%k%7%9%F%`>e$K%Q%C%1!<%8%3%l%/%7%g%s$r;}$C$F$$$k>l9g$N$_!"K\Ev$K(B
-$BJXMx$G$"$k$H$$$&$3$H$r3P$($F$*$$$F$/$@$5$$!#%Q%C%1!<%8$r<+F0E*$K(B FTP
-$B$GE>Aw$7$F$/$k5!G=$O$^$@$"$j$^$;$s!#(B
-
-$B%7%9%F%`$N%$%s%9%H!<%k$,=*$C$?8e$G!"%Q%C%1!<%8$r%$%s%9%H!<%k$9$k%D!<%k(B
-$B$rF0$+$9$K$O!"!V(Bpkg_manage$B!W$H$$$&%3%^%s%I$r;HMQ$7$^$9!#%?%$%`%>!<%s$r(B
-$B;XDj$9$k$K$O!V(Btzsetup$B!W$HF~NO$7$F$/$@$5$$!#$3$l0J>e$N0lHLE*$J%7%9%F%`(B
-$B$N@_Dj$K4X$9$k>pJs$K$D$$$F$O!"!V(B/etc/sysconfig$B!W%U%!%$%k$r8+$F$/$@$5$$!#(B
diff --git a/release/sysinstall/help/ja_JP.JIS/language.hlp b/release/sysinstall/help/ja_JP.JIS/language.hlp
deleted file mode 100644
index 9871dbb..0000000
--- a/release/sysinstall/help/ja_JP.JIS/language.hlp
+++ /dev/null
@@ -1,12 +0,0 @@
-$B9%$_$N8@8l$rA*Br$9$k$K$O!"$3$N%a%K%e!<$r;HMQ$7$F$/$@$5$$!#8=:_$N$H$3$m!"(B
-$BMM!9$J%X%k%W$G;HMQ$5$l$k%G%U%)%k%H$N8@8l$r@_Dj$9$k$@$1$G$9!#(B
-
-$B>-Mh$N%j%j!<%9$G$O!"$3$N%a%K%e!<$K$h$C$F%-!<%\!<%I%l%$%"%&%H!"%9%/%j!<(B
-$B%s%^%C%W!"(BNLS $B$N@_Dj(B (sysinstall $B<+BN$bA4$F$N%a%K%e!<$rE,@Z$J8@8l$GI=(B
-$B<($9$k$N$K!"%a%C%;!<%8%+%?%m%0$r;HMQ$9$k$h$&$K$J$j$^$9(B)$B!"$=$7$FMM!9$J(B
-$BI8=`$KE,9g$5$;$k$?$a$N$=$NB>$N9q:]2=5!G=$rJQ99$7$^$9!#(B
-
-$B$3$l$i$N2~NI$,9T$o$l$k$^$G$O!"%7%9%F%`$,A4$F%$%s%9%H!<%k$5$l$?8e$G(B
-/etc/sysconfig $B$rJT=8$9$k$N$,4JC1$G$7$g$&!#$3$N%U%!%$%k$K$O!"JQ99$9$k(B
-$B$Y$-ItJ,$K$D$$$F$N$?$/$5$s$N%3%a%s%H$d!"1Q8l0J30$N8@8l$N@_Dj$K4X$9$k$$(B
-$B$/$D$+$NNc$,$"$j$^$9!#(B
diff --git a/release/sysinstall/help/ja_JP.JIS/usage.hlp b/release/sysinstall/help/ja_JP.JIS/usage.hlp
deleted file mode 100644
index a3b6871..0000000
--- a/release/sysinstall/help/ja_JP.JIS/usage.hlp
+++ /dev/null
@@ -1,50 +0,0 @@
-$B$3$N%7%9%F%`$N;H$$J}(B
-====================
-
-$B%-!<(B $B%"%/%7%g%s(B
----- ----------
-UP ARROW $BA0$N9`L\(B ($B%F%-%9%H%U%#!<%k%I$G$O>e(B) $B$K0\F0$7$^$9!#(B
-DOWN ARROW $B<!$N9`L\(B ($B%F%-%9%H%U%#!<%k%I$G$O2<(B) $B$K0\F0$7$^$9!#(B
-TAB $B<!$N9`L\$^$?$O%0%k!<%W$K0\F0$7$^$9!#(B
-RIGHT ARROW $B<!$N9`L\$^$?$O%0%k!<%W$K0\F0$7$^$9!#(B(TAB $B$HF1$8(B)
-SHIFT-TAB $BA0$N9`L\$^$?$O%0%k!<%W$K0\F0$7$^$9!#(B
-LEFT ARROW $BA0$N9`L\$^$?$O%0%k!<%W$K0\F0$7$^$9!#(B(SHIFT-TAB $B$HF1$8(B)
-RETURN $B9`L\$rA*Br$7$^$9!#(B
-PAGE UP $B%F%-%9%H%\%C%/%9$G!"A0$N%Z!<%8$KLa$j$^$9!#(B
-PAGE DOWN $B%F%-%9%H%\%C%/%9$G!"<!$N%Z!<%8$K?J$_$^$9!#(B
-SPACE $B!V%i%8%*%\%?%s!W$dJ#?t$NA*Br;h$,$"$k%a%K%e!<$G!"8=:_$N(B
- $B9`L\$r%H%0%k$7$^$9!#(B
-F1 ($BB8:_$9$k2hLL$G$O(B) $B%X%k%W$rI=<($7$^$9!#(B
-
-$B%a%K%e!<$NC<$K!V(B^(-)$B!W$+!V(Bv(+)$B!W$H$$$&5-9f$,$"$k>l9g$O!"(B($B2hLL$N%9%Z!<(B
-$B%9$,IT==J,$J$?$a(B) $BI=<($7$-$l$J$$9`L\$,B8:_$7$^$9(B $B!#>e2<%+!<%=%k%-!<$r(B
-$B;HMQ$7$F%a%K%e!<$r%9%/%m!<%k$5$;$F$/$@$5$$!#$I$A$i$+$N5-9f$,>C$($?;~$O!"(B
-$B%a%K%e!<$N@hF,(B ($B$^$?$O:G8e(B) $B$G$9!#(B
-
-$B%F%-%9%H%U%#!<%k%I$G$O!"8=:_$N%F%-%9%H$N0LCV$,1&2<$K%Q!<%;%s%HI=<($5$l(B
-$B$^$9!#%U%#!<%k%I$N:G8e$G$O(B 100% $B$HI=<($5$l$^$9!#(B
-
-OK $B$rA*Br$9$k$H!"8=:_$NF0:n$r3NG'$9$k$3$H$K$J$j$^$9!#(BCancel $B$rA*Br$9$k(B
-$B$H!"8=:_$NA`:n$r%-%c%s%;%k$7!"0JA0$N%a%K%e!<$KLa$j$^$9!#(B
-
-
-$BFCJL$J5!G=(B:
-===========
-
-$B%a%K%e!<$N9`L\$rA*Br$9$k$N$K!":G=i$NJ8;z$rF~NO$9$k$3$H$b$G$-$^$9(B ($B0l0U(B
-$B$KDj$^$k>l9g(B)$B!#$3$N$h$&$J!V%"%/%;%i%l!<%?!WJ8;z$O%O%$%i%$%H$GI=<($5$l(B
-$B$^$9!#(B
-
-$B%3%s%=!<%k%I%i%$%P$O!"%9%/%m!<%k$7$F9T$C$?2hLL$r$b$&0lEYI=<($9$k$?$a$N(B
-$B%9%/%m!<%k%P%C%/%P%C%U%!$r;}$C$F$$$^$9!#%9%/%m!<%k%P%C%/$9$k$K$O!"(B
-$B!V(BScroll Lock$B!W%-!<$r2!$7$F$+$i%+!<%=%k%-!<$d!V(BPage Up$B!W!V(BPage Down$B!W(B
-$B%-!<$r;HMQ$7$^$9!#%9%/%m!<%k%P%C%/%b!<%I$+$iH4$1$k$K$O!":FEY!V(BScroll
-Lock$B!W%-!<$r2!$7$^$9!#$3$N5!G=$O%5%V%7%'%k$d$=$NB>$N!V%&%$%6!<%I%b!<%I!W(B
-$B$J$I!"%a%K%e!<$r;HMQ$7$J$$>l9g$KJXMx$G$9!#(B
-
-$B%7%9%F%`$N%$%s%9%H!<%k$,=*N;$7!"!V%^%k%A%f!<%6!<!W$GF0:n$7$F$$$k;~$O!"(B
-$BF1;~$K$$$/$D$+$N%;%C%7%g%s$r07$($k!V2>A[%3%s%=!<%k!W$r;HMQ$9$k$3$H$,$G(B
-$B$-$^$9!#%3%s%=!<%k$r@ZBX$($k$K$O!"(BALT-F<n> $B$r;HMQ$7$F$/$@$5$$!#!V(BF<n>$B!W(B
-$B$O8+$?$$2hLL$KBP1~$9$k%U%!%s%/%7%g%s%-!<$G$9!#I8=`$G$O(B 3 $B$D$N2>A[%3%s(B
-$B%=!<%k$,;HMQ$G$-$^$9$,!"%U%!%$%k(B /etc/ttys $B$rJT=8$9$k$3$H$G:GBg(B 12 $B8D(B
-$B$^$GA}$d$9$3$H$,$G$-$^$9!#(B
diff --git a/release/sysinstall/help/ja_JP.ROMAJI/README b/release/sysinstall/help/ja_JP.ROMAJI/README
deleted file mode 100644
index 53b4357..0000000
--- a/release/sysinstall/help/ja_JP.ROMAJI/README
+++ /dev/null
@@ -1,105 +0,0 @@
- -----------------------------------------
- FreeBSD 2.0.5 --- RELEASE Version , ,
- ----------------------------------------- /( )`
- \ \___ / |
-youkoso FreeBSD no 2.0.5 release he! 2.0R (koreha /- _ `-/ '
-94 nen 11 gatsu ni release saremashita) to, 95 nen (/\/ \ \ /\
-7 gatsu owari goro release sareru yotei no 2.1R to / / | ` \
-no aida wo umeru tameni hitsuyou to saretatame, O O ) / |
-2.0.5 ha zantei teki ni release saremashita. `-^--'`< '
-FreeBSD 2.0.5 ha 2.0R kara ooku no juuyou na (_.) _ ) /
-kairyou ga okonawaremashita. totemo antei shiteiru `.___/` /
-(kanari no yoyuu wo motte) dakedenaku, `-----' /
-takusan no atarashii tokuchou ya totemo <----. __ / __ \
-kakuchou sareta install program mo <----|====O)))==) \) /====
-arimasu. FreeBSD 2.0.5 de atarashiku <----' `--' `.__,' \
-natta bubun ni tsuite yori kuwashikuha, | |
-release notes wo yonde kudasai! \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-FreeBSD tte nani? FreeBSD ha 4.4 BSD Lite wo motoni shi, Intel, AMD,
-Cyrix, NexGen nadono "x86" base no PC de dousasuru operating system
-desu. samazama na PC you shuuhen kiki ya kousei de dousa si, software
-kaihatsu kara Internet service teikyou made arayurukotoni shiyou
-dekimasu. Internet jou no shougyou teki site de aru ftp.cdrom.com ha
-FreeBSD machine desu!
-
-FreeBSD no kono release deha, kouitta system wo jikkou suru tameni
-hitsuyouna mono subete ga, kanzen na source code tsuki de fukumarete
-imasu. source distribution wo install sureba, hitotsu no command de,
-moji doori subeteno system wo compile shinaosu kotoga dekimasu.
-koreha, gakusei, kenkyuusya, moshikuha douyatte dousa shiteirukawo
-shiritai hitotachini totteha risoutekidesu.
-
-dentou teki na UNIX utility wo teniire, FreeBSD ni install shiyasui
-youni, third party no ishoku shita software ga takusan atumete arimasu
-("ports collection"). EMACS editor kara lisp shorikei madeno subetewo
-fukumu 270 ijou no ports ni yotte, FreeBSD ha ippantekina jitsuyousei
-ya nouryokudeha, tasuu no workstation ni hitteki suru, kyouryoku de
-houkatsuteki na operating system to natte imasu.
-
-
-kono system no yori ookuno bunsyo ni tsuiteha, O'Reilly Associates and
-the USENIX Associations no 4.4BSD Document Set (ISBN 1-56592-082-1) wo
-kounyuu shitekudasai. watashitachi ha O'Reilly toha nan'no kankei mo
-arimasen. watashitachi ha tada kokyaku toshite manzoku shiteiru
-dakedesu.
-
-install wo okonau maeni, HARDWARE GUIDE wo yomitaku narukamo
-shiremasen. PC wo DOS/Windows (koreraha amari hardware wo youkyuu
-shimasen) igai no tameni settei surunoha warito muzukashii kotodesu.
-moshi, PC no kotoha rikai shiteiru to omotteiru toshitara, mada juubun
-nagaku tsukattenai tte kotodesu! :) kono guide niha, dn'na fuuni
-hardware wo settei surebaiinoka, trouble no baai ha don'na choukou wo
-kansatsu sureba iinoka ni tsuiteno hiketsuga arimasu. kono guide ha,
-FreeBSD boot floppy no Documentation menu ni arimasu.
-
-HININ SEIMEN BUN: FreeBSD ha jiko de data ga nakunaru kotono naiyou,
-best wo tsukushite imasuga, install chuu ni disk zentai wo
-keshiteshimau kanousei ha izentoshite sonzai shimasu! saisho ni
-juuyou na data no backup wo kichinto totte inainara, saigono FreeBSD
-install menu ha jikkou shinaide kudasai! chanto iimashita yo!
-
-kono release ni kansuru gijutsuteki na commento ha ika ni okutte
-kudasai:
-
- hackers@FreeBSD.org
-
-
-bug report ha, system wo install dekitanara `send-pr' command wo
-tsukatte okutte kudasai. soude nai nara, ika ni okutte kudasai:
-
- bugs@FreeBSD.org
-
-bug report deha, dono version no FreeBSD wo tsukatte irunokawo meiki
-suruyou ki wo tsukete kudasai.
-
-
-ippan teki na shitsumon ha ika ni okutte kudasai:
-
- questions@FreeBSD.org
-
-shitsumon ni taisuru kaitou ga suguni erarenakutemo gaman shite
-kudasai - genzai ha watashi tachi ni tottemo isogashii toki desushi,
-volunteer tachi mo genkai made ganbatte imasu! send-pr command de
-teishutsu sareta bug report ha bug database ni kirokusare, tsuiseki
-saremasu. soshite, sono bug (mataha shiyou ni kansuru youkyuu) ga
-sonzai suru aidaha arayuru joutai no henkou ga anatani tsuuchi
-saremasu.
-
-watashi tachi no WEB site de aru http://www.freebsd.org mo, koushin
-sareta jouhou no yoi jouhougen desusi, takusan no koudo na bunsyo ga
-youi sarete imasu. BSDI you no Netscape wo shiyou suruto, World Wide
-Web wo chokusetsu FreeBSD kara etsuran dekimasu.
-
-/usr/share/FAQ ya /usr/share/doc niha, sarani jouhou ga arimasu.
-
-
-yonde kudasatte arigatou. douzo kono release no FreeBSD wo otanoshimi
-kudasai!
-
- Jordan Hubbard,
- for The FreeBSD Project
diff --git a/release/sysinstall/help/ja_JP.ROMAJI/configure.hlp b/release/sysinstall/help/ja_JP.ROMAJI/configure.hlp
deleted file mode 100644
index c152796..0000000
--- a/release/sysinstall/help/ja_JP.ROMAJI/configure.hlp
+++ /dev/null
@@ -1,16 +0,0 @@
-kono menu deha, install go ni system no settei wo shimasu.
-sukunakutomo, system kanrisha to system no time zone no settei ha
-shite kudasai.
-
-bash, emacs, pascal nadono, saranaru miryokuteki na mono ni tsuiteha,
-kono menu no Package no koumoku wo mite kudasai. genzai no tokoro,
-CD-ROM wo motteiruka, file system jou ni package collection wo
-motteiru baai nomi, hontouni benridearu toiukotowo oboete oite
-kduasai. package wo jidouteki ni FTP de tensou shitekuru kinou ha
-mada arimasen.
-
-system no install ga owatta atode, package wo install suru tool wo
-ugokasu niha, ``pkg_manage'' toiu command wo shiyou shimasu. time
-zone wo shitei suruniha ``tzsetup'' to nyuuryoku shitekudasai. kore
-ijou no ippanteki na system no settei ni kansuru jouhou ni tsuiteha,
-``/etc/sysconfig'' file wo mite kudasai.
diff --git a/release/sysinstall/help/ja_JP.ROMAJI/language.hlp b/release/sysinstall/help/ja_JP.ROMAJI/language.hlp
deleted file mode 100644
index a167099..0000000
--- a/release/sysinstall/help/ja_JP.ROMAJI/language.hlp
+++ /dev/null
@@ -1,14 +0,0 @@
-konomi no gengo wo sentaku suruniha, kono menu wo shiyou shite
-kduasai. genzai no tokoro, samazama na help de shiyou sareru default
-no gengo wo settei surudakedesu.
-
-shourai no release deha, kono menu ni yotte keyboard layout, screen
-map, NLS no settei (sysinstall jitai mo subete no menu wo tekisetsu na
-gengo de hyouji surunoni, message catalog wo shiyou suruyouni
-narimasu), soshite samazamana hyoujun ni tekigou saseru tameno
-sonohokano kokusaika kinou wo henkou shimasu.
-
-korerano kairyou ga okonawareru madeha, system ga subete install
-sareta atode /etc/sysconfig wo henshuu surunoga kantan deshou. kono
-file niha, henkou surubeki bubun ni tsuiteno takusan no comment ya,
-eigo igai no gengo no settei ni kansuru ikutsukano reiga arimasu.
diff --git a/release/sysinstall/help/ja_JP.ROMAJI/usage.hlp b/release/sysinstall/help/ja_JP.ROMAJI/usage.hlp
deleted file mode 100644
index df58c20..0000000
--- a/release/sysinstall/help/ja_JP.ROMAJI/usage.hlp
+++ /dev/null
@@ -1,52 +0,0 @@
-KONO SYSTEM NO TSUKAIKATA
-=========================
-
-KEY ACTION
---- ------
-UP ARROW mae no koumoku (text field deha ue) ni idou shimasu.
-DOWN ARROW tsugi no koumoku (text field deha shita) ni idou shimasu.
-TAB tsugi no koumoku mataha group ni idou shimasu.
-RIGHT ARROW tsugi no koumoku mataha group ni idou shimasu (TAB to onaji).
-SHIFT-TAB mae no koumoku mataha group ni idou shimasu.
-LEFT ARROW mae no koumoku mataha group ni idou shimasu. (SHIFT-TAB to
- onaji).
-RETURN koumoku wo sentaku shimasu.
-PAGE UP text box de, mae no page ni modorimasu.
-PAGE DOWN text box de, tsugi no page ni susumimasu.
-SPACE "radio button" ya fukusuu no sentakushi ga aru menu de,
- genzai no koumoku wo toggle shimasu.
-F1 (sonzai suru gamen deha) help wo hyouji shimasu.
-
-menu no hashi ni "^(-)" ka "v(+)" to iu kigou ga aru baai ha, (gamen no
-space ga fujuubun na tame) hyouji shikirenai koumoku ga sonzai shimasu.
-jou-ge cursor key wo shiyou shite menu wo scroll sasete kudasai.
-dochirakano kigou ga kieta toki ha, menu no sentou (mataha saigo) desu.
-
-text field deha, genzai no text no ichi ga migi-shita ni percent
-hyouji saremasu. field no saigo deha 100% to hyouji saremasu.
-
-OK wo sentaku suruto, genzai no dousa wo kakunin surukotoni narimasu.
-Cancel wo sentaku suruto, genzai no sousa wo cancel shi, izen no menu ni
-modorimasu.
-
-
-TOKUBETU NA KINOU:
-==================
-
-menu no koumoku wo sentaku surunoni, saisho no moji wo nyuuryoku
-surukotomo dekimasu (ichi-i ni sadamaru baai). konoyouna "accellerator"
-moji ha highlight de hyouji saremasu.
-
-console driver ha, scroll shiteitta gamen wo mouichido hyouji surutameno
-scroll-back buffer wo motteimasu. scroll-back surutameniha, "Scroll
-Lock" key wo oshitekara cursor key ya "Page Up" "Page Down" key wo
-shiyou shimasu. kono kinou ha sub-shell ya sonohokano "wizard mode"
-nado, menu wo shiyou shinai baai ni benridesu.
-
-system no install ga shuuryou shi, "multi-user" de dousa shiteiru
-tokiha, douji ni ikutsukano session wo atsukaeru "kasou console" wo
-shiyou surukotoga dekimasu. console wo kirikaeruniha, ALT-F<n> wo
-shiyou shitekudasai. 'F<n>' ha mitai gamen ni taiousuru function key
-desu. hyoujun deha 3tsuno kasou console ga shiyou dekimasuga, file
-/etc/ttys wo henshuu surukotode saidai 12ko made fuyasukotoga
-dekimasu.
diff --git a/release/sysinstall/help/nl_NL.ISO8859-1/README b/release/sysinstall/help/nl_NL.ISO8859-1/README
deleted file mode 100644
index 35c2c90..0000000
--- a/release/sysinstall/help/nl_NL.ISO8859-1/README
+++ /dev/null
@@ -1,106 +0,0 @@
-
- -----------------------------------------
- FreeBSD 2.0.5 --- RELEASE Versie , ,
- ----------------------------------------- /( )`
- \ \___ / |
-Welkom bij de 2.0.5 release van FreeBSD! 2.0.5 is /- _ `-/ '
-een interim release, die de leemte moet vullen die (/\/ \ \ /\
-onstaan is sinds de laatste release van FreeBSD, / / | ` \
-versie 2.0 in Nov 94, tot de release van FreeBSD, O O ) / |
-2.1, verwacht eind juli 95. FreeBSD 2.0.5 bevat `-^--'`< '
-veel substantiële verbeteringen ten opzichte van (_.) _ ) /
-2.0R, niet in de laatste plaats de aanzienlijk `.___/` /
-verbeterde stabiliteit, vele nieuwe `-----' /
-features en een sterk verbeterd <----. __ / __ \
-installatie programma. Zie ook de <----|====O)))==) \) /====
-'release notes' voor meer details m.b.t. <----' `--' `.__,' \
-tot wat nieuw is in FreeBSD 2.0.5 | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-Wat is FreeBSD? FreeBSD is een operating systeem, gebaseerd op
-4.4 BSD Lite for Intel, AMD, Cyrix of NexGen "x86" gebaseerde PC
-hardware. Het werkt met een uitgebreide keuze aan PC randapparatuur
-en configuraties en kan gebruikt worden voor de meest uiteenlopende
-activiteiten, van programma ontwikkeling tot Internet Service
-Voorziening; de drukste machine op het Internet, ftp.cdrom.com,
-is een FreeBSD machine.
-
-Deze release van FreeBSD bevat alles wat u nodig heeft om zo'n
-systeem te draaien, met de volledige broncode voor elk onderdeel
-van het systeem. Als de broncode distributie geïnstalleerd is
-kunt u letterlijk, met één kommando het volledige systeem
-opnieuw compileren. Hierdoor is het ideaal voor studenten,
-researchers of voor iedereen die gewoon wil zien hoe het allemaal
-werkt.
-
-Een grote verzameling extra software, overgezet op FreeBSD (de
-"ports" verzameling) wordt ook beschikbaar gesteld, om het
-makkelijker te maken om al uw favoriete traditionele UNIX
-utilities te installeren.
-Meer dan 270 "ports", die software omvatten van tekstverwerkers
-tot programmeertalen, maken van FreeBSD een krachtige
-en veelomvattende operating omgeving die kan concureren met die
-van veel grote werkstations op het gebied van algemene inzet-
-baarheid en verwerkingskracht.
-
-Om meer documentatie over dit systeem te verkrijgen, is het aan-
-bevolen om de '4.4BSD Document Set' te kopen van O'Reilly Associates
-en de USENIX Association, ISBN 1-56592-082-1. We hebben niets
-met O'Reilly te maken, maar zijn slechts tevreden klanten!
-
-Voordat u verder gaat met de installatie is het aan te bevelen
-*eerst* de 'HARDWARE GUIDE' te lezen. PC hardware configuren voor
-iets anders dan DOS/Windows (die de hardware niet zo erg belasten)
-is wat moeilijker dan het lijkt, en als u denkt dat u PC's begrijpt
-dan heeft u ze duidelijk nog niet lang genoeg gebruikt :)
-De 'HARDWARE GUIDE' geeft u wat tips om uw hardware te configureren
-en op welke symptomen te letten als er problemen zijn. Deze gids is
-aanwezig in het Documentatie menu van de FreeBSD start-diskette.
-
-Ofschoon FreeBSD zijn uiterste best doet om te hoeden voor
-gegevensverlies, is het nog steeds meer dan mogelijk om AL UW
-GEGEVENS OP UW HARDDISK KWIJT TE RAKEN met deze installatie. Ga
-niet verder met installatiemenu voordat er van alle belangrijke
-gegevens een backup is gemaakt!
-
-Technisch commentaar op deze release moet gestuurd worden naar:
-
- hackers@FreeBSD.org
-
-Meldingen van gevonden fouten in FreeBSD moeten gestuurd worden
-met het 'send-pr' kommando als u er in geslaagd bent om het
-systeem te installeren, anders naar:
-
- bugs@FreeBSD.org
-
-Vermeld duidelijk om WELKE VERSIE van FreeBSD het gaat in berichten
-over fouten.
-
-Algemene vragen kunnen gestuurd worden naar:
-
- questions@FreeBSD.org
-
-Heb een beetje geduld als uw vraag niet meteen beantwoord wordt -
-we hebben het erg druk op het moment, en ons vrijwilligers werk
-belast ons vaak tot aan de limiet. Foutmeldingen die verstuurd zijn
-m.b.v. 'send-pr' worden opgeslagen en bijgehouden in onze
-'bug'-database. U wordt geïnformeerd over de veranderingen in de
-status van de fout (of vraag naar een feature) tijdens de levensduur
-ervan.
-
-Onze WEB server, http://www.freebsd.org, is een goede bron voor
-nieuwe of bijgewerkte informatie en biedt ook een aantal geavan-
-ceerde documentatie faciliteiten. U kunt de BSDI versie van
-Netscape gebruiken om over het 'World Wide Web' te 'surfen'.
-
-Zie ook /usr/share/FAQ en /usr/share/doc voor informatie over
-het systeem.
-
-Bedankt voor het lezen en we hopen dat deze release van FreeBSD
-u goed bevalt.
-
- Jordan Hubbard,
- voor het FreeBSD project
diff --git a/release/sysinstall/help/nl_NL.ISO8859-1/configure.hlp b/release/sysinstall/help/nl_NL.ISO8859-1/configure.hlp
deleted file mode 100644
index 91c39f5..0000000
--- a/release/sysinstall/help/nl_NL.ISO8859-1/configure.hlp
+++ /dev/null
@@ -1,16 +0,0 @@
-Dit menu stelt u in staat om uw systeem tot op zekere hoogte
-te configureren na de installatie. In ieder geval kunt u hiermee
-het wachtwoord van de systeembeheerder en de tijdzone instellen.
-
-Voor extra programmatuur zoals bash, emacs, pascal, etc. is het
-aan te raden naar het 'Packages' item te kijken in dit menu. Op
-het moment is het helaas alleen bruikbaar als u een CDROM heeft of
-ergens op uw harddisk packages heeft staan waar het package
-installatie programma erbij kan. Automatische overdracht van
-packages via FTP wordt nog niet ondersteund.
-
-Als u na de installatie het packages installatie programma opnieuw
-wilt gebruiken kunt u dit oproepen door het kommando 'pkg_manage'.
-Om de tijdzone te veranderen kunt u 'tzsetup' gebruiken. Voor
-meer informatie over algemene systeem configuratie zie het bestand
-'/etc/sysconfig'.
diff --git a/release/sysinstall/help/nl_NL.ISO8859-1/language.hlp b/release/sysinstall/help/nl_NL.ISO8859-1/language.hlp
deleted file mode 100644
index 48fac09..0000000
--- a/release/sysinstall/help/nl_NL.ISO8859-1/language.hlp
+++ /dev/null
@@ -1,15 +0,0 @@
-Met dit menu kunt u een andere taal selecteren. Op het moment worden
-alleen de help bestanden in de gekozen taal weergegeven.
-
-In een volgende release zal ook de toetsenbord layout, scherm
-aansturing, NLS instellingen ('sysinstall' zelf zal ook 'message
-catalogs' gebruiken zodat alle menu's in de gekozen taal worden
-weergegeven) veranderd worden en andere I18N instellingen om
-aan diverse standaarden te voldoen.
-
-Totdat deze verbeteringen zijn doorgevoerd kunt u het beste deze
-veranderingen zelf aan te brengen door het bestand '/etc/sysconfig'
-te bewerken nadat het systeem is geïnstalleerd. Er is commentaar
-in het bestand aanwezig dat aangeeft wat er verander moet worden.
-Er zijn ook wat voorbeelden van niet-Engelse configuraties.
-
diff --git a/release/sysinstall/help/nl_NL.ISO8859-1/usage.hlp b/release/sysinstall/help/nl_NL.ISO8859-1/usage.hlp
deleted file mode 100644
index 50a2808..0000000
--- a/release/sysinstall/help/nl_NL.ISO8859-1/usage.hlp
+++ /dev/null
@@ -1,56 +0,0 @@
-GEBRUIKSINSTRUCTIES VOOR DIT SYSTEEM
-====================================
-
-TOETS AKTIE
-===== =====
-PIJL OMHOOG Ga naar het vorige item (of omhoog in een tekst veld)
-PIJL OMLAAG Ga naar het volgende item (of omlaag, in een tekst veld)
-TAB Ga naar het volgende item of groep
-PIJL RECHTS Ga naar het volgende item of groep (hetzelfde als TAB)
-SHIFT-TAB Ga naar het vorige item of groep
-PIJL LINKS Ga naar het vorige item of groep (hetzelfde als SHIFT-TAB)
-RETURN Selecteer item
-PAGE UP Ga een pagina omhoog in tekst vensters
-PAGE DOWN Ga een pagina omlaag in tekst vensters
-SPATIEBALK Selecteer/deselecteer het huidige item in "radio" of
- multiple choice menus.
-F1 Help (indien het huidige scherm er in voorziet)
-
-Als er meer menu-items zijn dan getoond kunnen worden, verschijnen er
-symbolen om aan te geven of dit aan de bovenkant is: "^(-)" of aan de
-onderkant "v(+)". Gebruik de PIJL OMHOOG/OMLAAG toetsen om te bladeren.
-Als een van de symbolen verdwijnt dan ben je aan de onderkant
-(of bovenkant) van het menu.
-
-In tekst vensters wordt de hoeveelheid tekst die nog getoond moet
-worden als een percentage weergegeven in de rechter onderhoek. 100%
-betekent dat je het einde van de tekst hebt bereikt.
-
-Selektie van <OK> in een menu bevestigt de aktie die erdoor gekontro-
-leerd wordt. Selektie van <Cancel> annuleert de aktie en zal je over
-het algemeen terugbrengen in het vorige menu.
-
-SPECIALE MOGELIJKHEDEN
-======================
-
-Het is ook mogelijk om een menu item te selekteren door de eerste
-letter (of cijfer) van de naam te typen, als deze uniek is. Deze
-letters (of cijfers) zijn vetgedrukt (of in een andere kleur weer-
-gegeven) om ze te onderscheiden.
-
-Het is ook mogelijk om terug te bladeren als er regels aan de
-bovenkant van het scherm zijn gerold. Deze 'terug-blader-modus'
-kan geaktiveerd worden door op de "Scroll Lock" toets te drukken.
-Nu kun je m.b.v. PIJL OMHOOG/OMLAAG of Page Up/Page Down door de
-bewaarde regels bladeren. Druk nogmaals op "Scroll Lock" om deze
-modus te beëindigen. Deze mogelijkheid is erg handig als je in een
-sub-shell zit of andere expert-modes gebruikt die geen menus
-hebben.
-
-Na installatie, en als het systeem in "multi-user" mode draait, kun
-je gebruik maken van "virtuele consoles" om meerdere aktieve
-sessies tegelijk te kunnen gebruiken. Gebruik ALT-F<n> om tussen de
-verschillende sessies te wisselen, 'F<n>' is de funktietoets die
-overeenkomt met de sessie die je wilt zien. Standaard is het
-systeem geconfigureerd voor 4 virtuele consoles. Bewerk /etc/ttys
-om meer virtuele consoles te configureren. Het maximum aantal is 12.
diff --git a/release/sysinstall/help/nl_NL.ISO_8859-1/README b/release/sysinstall/help/nl_NL.ISO_8859-1/README
deleted file mode 100644
index 35c2c90..0000000
--- a/release/sysinstall/help/nl_NL.ISO_8859-1/README
+++ /dev/null
@@ -1,106 +0,0 @@
-
- -----------------------------------------
- FreeBSD 2.0.5 --- RELEASE Versie , ,
- ----------------------------------------- /( )`
- \ \___ / |
-Welkom bij de 2.0.5 release van FreeBSD! 2.0.5 is /- _ `-/ '
-een interim release, die de leemte moet vullen die (/\/ \ \ /\
-onstaan is sinds de laatste release van FreeBSD, / / | ` \
-versie 2.0 in Nov 94, tot de release van FreeBSD, O O ) / |
-2.1, verwacht eind juli 95. FreeBSD 2.0.5 bevat `-^--'`< '
-veel substantiële verbeteringen ten opzichte van (_.) _ ) /
-2.0R, niet in de laatste plaats de aanzienlijk `.___/` /
-verbeterde stabiliteit, vele nieuwe `-----' /
-features en een sterk verbeterd <----. __ / __ \
-installatie programma. Zie ook de <----|====O)))==) \) /====
-'release notes' voor meer details m.b.t. <----' `--' `.__,' \
-tot wat nieuw is in FreeBSD 2.0.5 | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-Wat is FreeBSD? FreeBSD is een operating systeem, gebaseerd op
-4.4 BSD Lite for Intel, AMD, Cyrix of NexGen "x86" gebaseerde PC
-hardware. Het werkt met een uitgebreide keuze aan PC randapparatuur
-en configuraties en kan gebruikt worden voor de meest uiteenlopende
-activiteiten, van programma ontwikkeling tot Internet Service
-Voorziening; de drukste machine op het Internet, ftp.cdrom.com,
-is een FreeBSD machine.
-
-Deze release van FreeBSD bevat alles wat u nodig heeft om zo'n
-systeem te draaien, met de volledige broncode voor elk onderdeel
-van het systeem. Als de broncode distributie geïnstalleerd is
-kunt u letterlijk, met één kommando het volledige systeem
-opnieuw compileren. Hierdoor is het ideaal voor studenten,
-researchers of voor iedereen die gewoon wil zien hoe het allemaal
-werkt.
-
-Een grote verzameling extra software, overgezet op FreeBSD (de
-"ports" verzameling) wordt ook beschikbaar gesteld, om het
-makkelijker te maken om al uw favoriete traditionele UNIX
-utilities te installeren.
-Meer dan 270 "ports", die software omvatten van tekstverwerkers
-tot programmeertalen, maken van FreeBSD een krachtige
-en veelomvattende operating omgeving die kan concureren met die
-van veel grote werkstations op het gebied van algemene inzet-
-baarheid en verwerkingskracht.
-
-Om meer documentatie over dit systeem te verkrijgen, is het aan-
-bevolen om de '4.4BSD Document Set' te kopen van O'Reilly Associates
-en de USENIX Association, ISBN 1-56592-082-1. We hebben niets
-met O'Reilly te maken, maar zijn slechts tevreden klanten!
-
-Voordat u verder gaat met de installatie is het aan te bevelen
-*eerst* de 'HARDWARE GUIDE' te lezen. PC hardware configuren voor
-iets anders dan DOS/Windows (die de hardware niet zo erg belasten)
-is wat moeilijker dan het lijkt, en als u denkt dat u PC's begrijpt
-dan heeft u ze duidelijk nog niet lang genoeg gebruikt :)
-De 'HARDWARE GUIDE' geeft u wat tips om uw hardware te configureren
-en op welke symptomen te letten als er problemen zijn. Deze gids is
-aanwezig in het Documentatie menu van de FreeBSD start-diskette.
-
-Ofschoon FreeBSD zijn uiterste best doet om te hoeden voor
-gegevensverlies, is het nog steeds meer dan mogelijk om AL UW
-GEGEVENS OP UW HARDDISK KWIJT TE RAKEN met deze installatie. Ga
-niet verder met installatiemenu voordat er van alle belangrijke
-gegevens een backup is gemaakt!
-
-Technisch commentaar op deze release moet gestuurd worden naar:
-
- hackers@FreeBSD.org
-
-Meldingen van gevonden fouten in FreeBSD moeten gestuurd worden
-met het 'send-pr' kommando als u er in geslaagd bent om het
-systeem te installeren, anders naar:
-
- bugs@FreeBSD.org
-
-Vermeld duidelijk om WELKE VERSIE van FreeBSD het gaat in berichten
-over fouten.
-
-Algemene vragen kunnen gestuurd worden naar:
-
- questions@FreeBSD.org
-
-Heb een beetje geduld als uw vraag niet meteen beantwoord wordt -
-we hebben het erg druk op het moment, en ons vrijwilligers werk
-belast ons vaak tot aan de limiet. Foutmeldingen die verstuurd zijn
-m.b.v. 'send-pr' worden opgeslagen en bijgehouden in onze
-'bug'-database. U wordt geïnformeerd over de veranderingen in de
-status van de fout (of vraag naar een feature) tijdens de levensduur
-ervan.
-
-Onze WEB server, http://www.freebsd.org, is een goede bron voor
-nieuwe of bijgewerkte informatie en biedt ook een aantal geavan-
-ceerde documentatie faciliteiten. U kunt de BSDI versie van
-Netscape gebruiken om over het 'World Wide Web' te 'surfen'.
-
-Zie ook /usr/share/FAQ en /usr/share/doc voor informatie over
-het systeem.
-
-Bedankt voor het lezen en we hopen dat deze release van FreeBSD
-u goed bevalt.
-
- Jordan Hubbard,
- voor het FreeBSD project
diff --git a/release/sysinstall/help/nl_NL.ISO_8859-1/configure.hlp b/release/sysinstall/help/nl_NL.ISO_8859-1/configure.hlp
deleted file mode 100644
index 91c39f5..0000000
--- a/release/sysinstall/help/nl_NL.ISO_8859-1/configure.hlp
+++ /dev/null
@@ -1,16 +0,0 @@
-Dit menu stelt u in staat om uw systeem tot op zekere hoogte
-te configureren na de installatie. In ieder geval kunt u hiermee
-het wachtwoord van de systeembeheerder en de tijdzone instellen.
-
-Voor extra programmatuur zoals bash, emacs, pascal, etc. is het
-aan te raden naar het 'Packages' item te kijken in dit menu. Op
-het moment is het helaas alleen bruikbaar als u een CDROM heeft of
-ergens op uw harddisk packages heeft staan waar het package
-installatie programma erbij kan. Automatische overdracht van
-packages via FTP wordt nog niet ondersteund.
-
-Als u na de installatie het packages installatie programma opnieuw
-wilt gebruiken kunt u dit oproepen door het kommando 'pkg_manage'.
-Om de tijdzone te veranderen kunt u 'tzsetup' gebruiken. Voor
-meer informatie over algemene systeem configuratie zie het bestand
-'/etc/sysconfig'.
diff --git a/release/sysinstall/help/nl_NL.ISO_8859-1/language.hlp b/release/sysinstall/help/nl_NL.ISO_8859-1/language.hlp
deleted file mode 100644
index 48fac09..0000000
--- a/release/sysinstall/help/nl_NL.ISO_8859-1/language.hlp
+++ /dev/null
@@ -1,15 +0,0 @@
-Met dit menu kunt u een andere taal selecteren. Op het moment worden
-alleen de help bestanden in de gekozen taal weergegeven.
-
-In een volgende release zal ook de toetsenbord layout, scherm
-aansturing, NLS instellingen ('sysinstall' zelf zal ook 'message
-catalogs' gebruiken zodat alle menu's in de gekozen taal worden
-weergegeven) veranderd worden en andere I18N instellingen om
-aan diverse standaarden te voldoen.
-
-Totdat deze verbeteringen zijn doorgevoerd kunt u het beste deze
-veranderingen zelf aan te brengen door het bestand '/etc/sysconfig'
-te bewerken nadat het systeem is geïnstalleerd. Er is commentaar
-in het bestand aanwezig dat aangeeft wat er verander moet worden.
-Er zijn ook wat voorbeelden van niet-Engelse configuraties.
-
diff --git a/release/sysinstall/help/nl_NL.ISO_8859-1/usage.hlp b/release/sysinstall/help/nl_NL.ISO_8859-1/usage.hlp
deleted file mode 100644
index 50a2808..0000000
--- a/release/sysinstall/help/nl_NL.ISO_8859-1/usage.hlp
+++ /dev/null
@@ -1,56 +0,0 @@
-GEBRUIKSINSTRUCTIES VOOR DIT SYSTEEM
-====================================
-
-TOETS AKTIE
-===== =====
-PIJL OMHOOG Ga naar het vorige item (of omhoog in een tekst veld)
-PIJL OMLAAG Ga naar het volgende item (of omlaag, in een tekst veld)
-TAB Ga naar het volgende item of groep
-PIJL RECHTS Ga naar het volgende item of groep (hetzelfde als TAB)
-SHIFT-TAB Ga naar het vorige item of groep
-PIJL LINKS Ga naar het vorige item of groep (hetzelfde als SHIFT-TAB)
-RETURN Selecteer item
-PAGE UP Ga een pagina omhoog in tekst vensters
-PAGE DOWN Ga een pagina omlaag in tekst vensters
-SPATIEBALK Selecteer/deselecteer het huidige item in "radio" of
- multiple choice menus.
-F1 Help (indien het huidige scherm er in voorziet)
-
-Als er meer menu-items zijn dan getoond kunnen worden, verschijnen er
-symbolen om aan te geven of dit aan de bovenkant is: "^(-)" of aan de
-onderkant "v(+)". Gebruik de PIJL OMHOOG/OMLAAG toetsen om te bladeren.
-Als een van de symbolen verdwijnt dan ben je aan de onderkant
-(of bovenkant) van het menu.
-
-In tekst vensters wordt de hoeveelheid tekst die nog getoond moet
-worden als een percentage weergegeven in de rechter onderhoek. 100%
-betekent dat je het einde van de tekst hebt bereikt.
-
-Selektie van <OK> in een menu bevestigt de aktie die erdoor gekontro-
-leerd wordt. Selektie van <Cancel> annuleert de aktie en zal je over
-het algemeen terugbrengen in het vorige menu.
-
-SPECIALE MOGELIJKHEDEN
-======================
-
-Het is ook mogelijk om een menu item te selekteren door de eerste
-letter (of cijfer) van de naam te typen, als deze uniek is. Deze
-letters (of cijfers) zijn vetgedrukt (of in een andere kleur weer-
-gegeven) om ze te onderscheiden.
-
-Het is ook mogelijk om terug te bladeren als er regels aan de
-bovenkant van het scherm zijn gerold. Deze 'terug-blader-modus'
-kan geaktiveerd worden door op de "Scroll Lock" toets te drukken.
-Nu kun je m.b.v. PIJL OMHOOG/OMLAAG of Page Up/Page Down door de
-bewaarde regels bladeren. Druk nogmaals op "Scroll Lock" om deze
-modus te beëindigen. Deze mogelijkheid is erg handig als je in een
-sub-shell zit of andere expert-modes gebruikt die geen menus
-hebben.
-
-Na installatie, en als het systeem in "multi-user" mode draait, kun
-je gebruik maken van "virtuele consoles" om meerdere aktieve
-sessies tegelijk te kunnen gebruiken. Gebruik ALT-F<n> om tussen de
-verschillende sessies te wisselen, 'F<n>' is de funktietoets die
-overeenkomt met de sessie die je wilt zien. Standaard is het
-systeem geconfigureerd voor 4 virtuele consoles. Bewerk /etc/ttys
-om meer virtuele consoles te configureren. Het maximum aantal is 12.
diff --git a/release/sysinstall/help/no_NO.ISO8859-1/README b/release/sysinstall/help/no_NO.ISO8859-1/README
deleted file mode 100644
index d3d2989..0000000
--- a/release/sysinstall/help/no_NO.ISO8859-1/README
+++ /dev/null
@@ -1,107 +0,0 @@
- -----------------------------------------
- FreeBSD 2.0.5 --- UTGITT Version , ,
- ----------------------------------------- /( )`
- \ \___ / |
-Velkommen til 2.0.5 versjonen av FreeBSD! 2.0.5 er /- _ `-/ '
-en midlertidig utgave av FreeBSD som er ment til (/\/ \ \ /\
-å fylle gapet mellom 2.0R (som var / / | ` \
-utgitt i Nov 94) og 2.1R, som kommer til O O ) / |
-å bli utgitt sent i Juli d.å.. FreeBSD 2.0.5 `-^--'`< '
-inneholder mange vesentlige forbedringer til 2.0R, (_.) _ ) /
-ikke minst av dem er større stabilitet (med `.___/` /
-en betraktelig margin), dusinvis av nye `-----' /
-momenter og et mye forbedret installasjons<----. __ / __ \
-program. Se utgivelse-notatene for mere <----|====O)))==) \) /====
-detaljer om hva som er nytt i <----' `--' `.__,' \
-FreeBSD 2.0.5! | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-Hva er FreeBSD? FreeBSD er et operativ system basert på 4.4 BSD Lite
-for Intel, AMD, Cyrix or NexGen "x86" basert PC maskinvare. Det fungerer
-med et veldig stor utvalg av PC ytre-enheter og konfigurasjoner og kan
-bli brukt til alt fra programvare utvikling til Internet Service
-Provision; den travleste plassen på Internetet, ftp.cdrom.com, er en
-FreeBSD maskin!
-
-Denne utgaven av FreeBSD inneholder alt du trenger for å drive et slikt
-system, pluss full kilde-kode til hele systemet. Med kilde-koden
-installert kan du om-kompilere hele systemet fra grunnen opp med
-en kommando, noe som gjøer systemet ideelt for studenter,
-forskere eller folk som bare vil se hvordan det hele virker.
-
-En stor samling av program som har blitt flyttet over av andre ("flytte
-samlingen") er også tilbrakt for å gjøre det enklere for deg
-å få tak i og installere dine yndlings program for UNIX.
-Over 270 program har blitt flyttet over til FreeBSD, fra
-redigerings-program til programmerings språk til grafiske applikasjoner,
-noe som gjør FreeBSD et kraftig og omfattende operativ miljø som
-er på likhet med mange store arbeidsmaskiner når det gjelder generell
-anvendelse og styrke.
-
-
-For mere dokumentasjon om dette systemet, anbefaler vi at du
-kjøper 4.4BSD Dokumentasjons settet fra O'Reilly Associates og
-USENIX Foreningen, ISBN 1-56592-082-1. Vi har ingen forbindelse med
-O'Reilly, vi er bare tilfredstilte kunder!
-
-Det er å anbefale at du også leser MASKINVARE GUIDEN *før*
-du fortsetter videre med installasjonen. Oppsett av PC
-maskinvare for alt annet enn DOS/Windows ( som ikke akkurat belaster
-maskinvaren ) er faktisk en hel del vanskeligere enn det ser ut til. Dersom
-du tror at du forstår deg på PCer, så har du tydeligvis ikke
-brukt dem lenge nok! :) Denne rettledningen vil gi deg noen tips om hvordan
-å sette opp maskinvaren og hva slags symptomer å se etter om du
-skulle få vanskeligheter. Denne rettledningen er tilgjengelig fra
-Dokumentasjons menyen på FreeBSD oppstartings-disketten.
-
-FRALEGGELSE: Selv om FreeBSD gjør sitt beste til å beskytte mot
-tilfeldig tap av data er det fremdeles mulig å slette ut hele disken
-i forbindelse med denne installasjonen. Vær så vennlig ikke å
-fortsette til den siste FreeBSD installasjons menyen uten at du har
-et sikkerhetskopi av alle viktige data først! Dette mener vi på
-alvor!
-
-Tekniske kommentarer om denne utgaven bør sendes (på Engelsk!) til:
-
- hackers@FreeBSD.org
-
-
-Programfeil-rapporter bør sendes med å bruke `send-pr' kommandoen,
-dersom du var i stand til å installere systemet, ellers til:
-
- bugs@FreeBSD.org
-
-Vær sikker på å indikere HVILKEN VERSJON av FreeBSD du kjrøer
-i enhver programfeil rapport!
-
-
-Generelle spørsmål bør sendes til:
-
- questions@FreeBSD.org
-
-Vær så snill å ha tålmodighet dersom du ikke får svar
-med en gang - dette er en spesielt travel tid for oss, og våre
-frivillige resurser er ofte strekt til grensen! Programfeil rapporter
-som har blitt lagt fram med 'send-pr' kommandoen er ajourført og
-etterfulgt i vår programfeil database, og du kommer til å bli
-informert om enhver status-forandring så lenge programfeilen (eller
-moment etterspørsel) eksisterer.
-
-Vår WEB plass, http://www.freebsd.org, er også en veldig god kilde for
-oppdatert informasjon og tilbyr flere avanserte dokumenterings hjelpemidler.
-Du kan bruke BSDI versonen av Netscape for å surfe World Wide Web
-direkte fra FreeBSD.
-
-Du kan også se i /usr/share/FAQ og /usr/share/doc for videre informasjon
-om systemet.
-
-
-Takk for at du tok deg tid til å lese alt dette, og vi håper
-oppriktig at du vil nyte denne utgaven av FreeBSD!
-
- Jordan Hubbard,
- for FreeBSD Prosjektet
diff --git a/release/sysinstall/help/no_NO.ISO8859-1/configure.hlp b/release/sysinstall/help/no_NO.ISO8859-1/configure.hlp
deleted file mode 100644
index 6a02435..0000000
--- a/release/sysinstall/help/no_NO.ISO8859-1/configure.hlp
+++ /dev/null
@@ -1,16 +0,0 @@
-Denne menyen lar deg konfigurere systemet ditt etter at det er
-installert. Du burde ihvertfall sette passordet til system-bestyreren og
-tidssonen for systemet.
-
-For ekstra godbiter som bash, emacs, pascal, osv. bør du ta en titt
-på Packages valget i denne menyen. Merk at dette valget, så langt,
-bare virker ordentlig dersom du har en CDROM eller en eksisterende
-pakke samling en eller annen plass i fil-hierarkiet hvor pakke-bestyrer
-programmet kan finne det. Automatisk overføring av pakkene via FTP
-er ikke mulig ennå!
-
-Dersom du ønsker å pøkalle pakke installasjons programmet på
-nytt etter at du har forlatt system-installasjons-programmet, bruk
-kommandoen ''pkg_manage''. For å sette tidssonen, skriv ''tzsetup''.
-For mere informasjon om konfigurasjonen av systemet, se i /etc/sysconfig
-filen.
diff --git a/release/sysinstall/help/no_NO.ISO8859-1/language.hlp b/release/sysinstall/help/no_NO.ISO8859-1/language.hlp
deleted file mode 100644
index efdd21f..0000000
--- a/release/sysinstall/help/no_NO.ISO8859-1/language.hlp
+++ /dev/null
@@ -1,13 +0,0 @@
-Bruk denne menyen til å velge språket du foretrekker. Dette setter
-bare språket som blir brukt når hjelpefilene er vist fram.
-
-I framtidige utgaver vil dette også forandre tastaturet, skjerm kartet,
-NLS oppsettet ( sysinstall vil også bruke beskjed kataloger slik at
-alle menyene blir vist frem i språket du valgte) og utføre andre
-I18N momenter for å følge forskjellige normer.
-
-Inntil disse forbedringene er utført, vil du kanskje finne det
-enklest å redigere /etc/sysconfig filen selv etter systemet er
-ferdig installert. Det er mange merknader i den filen som beskriver
-hva som må forandres, og ett par eksempler på eksisterende
-språk oppsett.
diff --git a/release/sysinstall/help/no_NO.ISO8859-1/usage.hlp b/release/sysinstall/help/no_NO.ISO8859-1/usage.hlp
deleted file mode 100644
index 01c3d1d..0000000
--- a/release/sysinstall/help/no_NO.ISO8859-1/usage.hlp
+++ /dev/null
@@ -1,56 +0,0 @@
-HVORDAN Å BRUKE SYSTEMET
-=========================
-
-TAST FUNKSJON
----- --------
-PIL OPP Flytte til forrige dataelement (eller opp, i et tekstfelt).
-PIL NED Flytte til neste dataelement (eller ned, i et tekstfelt).
-TAB Flytte til neste dataelement eller gruppe.
-HØYRE PIL Flytte til neste dataelement eller gruppe (samme som TAB).
-SKIFT-TAB Flytte til forrige dataelement eller gruppe.
-VENSTRE PIL Flytte til forrige dataelement eller gruppe (samme
- som SKIFT-TAB).
-RETUR Velge dataelement.
-SIDE OPP I tekstbokser, ruller opp en side.
-SIDE NED I tekstbokser, ruller ned en side.
-MELLOMROM I "radio" eller flervalgs menyer, markere inneværende
- dataelement.
-F1 Hjelp (i de skjermene som støtter dette).
-
-Dersom du også ser små "^(-)" eller "v(+)" symboler på kantene av
-en meny, betyr det at det er flere dataelementer ovenfor eller nedenfor
-det aktive elementet som ikke blir fremvist (p.g.a. mangel på skjermplass).
-Pil Opp/Ned-tastene ruller menyen. Når ett av disse symbolene forsvinner,
-betyr det at du er på toppen (eller bunnen) av menyen.
-
-I et tekstfelt vil prosenten av igjenomgått tekst bli vist i nedre høyre
-hjørne av feltet. 100% betyr at du er på bunnen av feltet.
-
-Valg av OK i en meny, bekrefter den funksjonen som menyen kontrollerer.
-Valg av Cancel vil avbryte operasjonen og generelt sett returnere til
-forrige meny.
-
-
-SPESIELLE MOMENTER:
-===================
-
-Det er også mulig å velge et meny element ved å trykke på første
-bokstaven av navnet, dersom den er unik. Slike "akselerasjonsbokstaver"
-vil være spesielt markert i elementnavnet.
-
-Konsolldriveren har en innebygget rulle-tilbake buffer some en kan bruke
-til å inspisere ting som har rullet ut av skjermen. For å bruke
-rulle-tilbake funksjonen, trykk på "Scroll Lock" tasten på tastaturet.
-Piltastene og Side Opp/Ned tastene kan nå brukes til å gå
-igjennom den lagrede teksten. For å forlate rulle-tilbake modusen,
-trykk på "Scroll Lock" tasten igjen. Dette momentet er best egnet for å
-håndtere underordnede-skjell og andre "vidundermoduser" som ikke bruker
-menyer.
-
-Når systemet er ferdig installert og kjører i fler-bruker modus, vil
-du også finne at du har mange "virtuelle konsoller" til rådighet og
-kan bruke dem til å ha flere aktive sesjoner på en gang. Bruk ALT-F<n>
-til å velge mellom dem, hvor 'F<n>' er funksjons-tasten som korresponderer
-med den skjermen du ønsker å se. Systemet, som det blir installert, har
-normalt 3 virtuelle konsoller. Du kan lage flere med å redigere /etc/ttys
-filen, etter systemet har kommet opp, opptil et maksimum av 12.
diff --git a/release/sysinstall/help/no_NO.ISO_8859-1/README b/release/sysinstall/help/no_NO.ISO_8859-1/README
deleted file mode 100644
index d3d2989..0000000
--- a/release/sysinstall/help/no_NO.ISO_8859-1/README
+++ /dev/null
@@ -1,107 +0,0 @@
- -----------------------------------------
- FreeBSD 2.0.5 --- UTGITT Version , ,
- ----------------------------------------- /( )`
- \ \___ / |
-Velkommen til 2.0.5 versjonen av FreeBSD! 2.0.5 er /- _ `-/ '
-en midlertidig utgave av FreeBSD som er ment til (/\/ \ \ /\
-å fylle gapet mellom 2.0R (som var / / | ` \
-utgitt i Nov 94) og 2.1R, som kommer til O O ) / |
-å bli utgitt sent i Juli d.å.. FreeBSD 2.0.5 `-^--'`< '
-inneholder mange vesentlige forbedringer til 2.0R, (_.) _ ) /
-ikke minst av dem er større stabilitet (med `.___/` /
-en betraktelig margin), dusinvis av nye `-----' /
-momenter og et mye forbedret installasjons<----. __ / __ \
-program. Se utgivelse-notatene for mere <----|====O)))==) \) /====
-detaljer om hva som er nytt i <----' `--' `.__,' \
-FreeBSD 2.0.5! | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-Hva er FreeBSD? FreeBSD er et operativ system basert på 4.4 BSD Lite
-for Intel, AMD, Cyrix or NexGen "x86" basert PC maskinvare. Det fungerer
-med et veldig stor utvalg av PC ytre-enheter og konfigurasjoner og kan
-bli brukt til alt fra programvare utvikling til Internet Service
-Provision; den travleste plassen på Internetet, ftp.cdrom.com, er en
-FreeBSD maskin!
-
-Denne utgaven av FreeBSD inneholder alt du trenger for å drive et slikt
-system, pluss full kilde-kode til hele systemet. Med kilde-koden
-installert kan du om-kompilere hele systemet fra grunnen opp med
-en kommando, noe som gjøer systemet ideelt for studenter,
-forskere eller folk som bare vil se hvordan det hele virker.
-
-En stor samling av program som har blitt flyttet over av andre ("flytte
-samlingen") er også tilbrakt for å gjøre det enklere for deg
-å få tak i og installere dine yndlings program for UNIX.
-Over 270 program har blitt flyttet over til FreeBSD, fra
-redigerings-program til programmerings språk til grafiske applikasjoner,
-noe som gjør FreeBSD et kraftig og omfattende operativ miljø som
-er på likhet med mange store arbeidsmaskiner når det gjelder generell
-anvendelse og styrke.
-
-
-For mere dokumentasjon om dette systemet, anbefaler vi at du
-kjøper 4.4BSD Dokumentasjons settet fra O'Reilly Associates og
-USENIX Foreningen, ISBN 1-56592-082-1. Vi har ingen forbindelse med
-O'Reilly, vi er bare tilfredstilte kunder!
-
-Det er å anbefale at du også leser MASKINVARE GUIDEN *før*
-du fortsetter videre med installasjonen. Oppsett av PC
-maskinvare for alt annet enn DOS/Windows ( som ikke akkurat belaster
-maskinvaren ) er faktisk en hel del vanskeligere enn det ser ut til. Dersom
-du tror at du forstår deg på PCer, så har du tydeligvis ikke
-brukt dem lenge nok! :) Denne rettledningen vil gi deg noen tips om hvordan
-å sette opp maskinvaren og hva slags symptomer å se etter om du
-skulle få vanskeligheter. Denne rettledningen er tilgjengelig fra
-Dokumentasjons menyen på FreeBSD oppstartings-disketten.
-
-FRALEGGELSE: Selv om FreeBSD gjør sitt beste til å beskytte mot
-tilfeldig tap av data er det fremdeles mulig å slette ut hele disken
-i forbindelse med denne installasjonen. Vær så vennlig ikke å
-fortsette til den siste FreeBSD installasjons menyen uten at du har
-et sikkerhetskopi av alle viktige data først! Dette mener vi på
-alvor!
-
-Tekniske kommentarer om denne utgaven bør sendes (på Engelsk!) til:
-
- hackers@FreeBSD.org
-
-
-Programfeil-rapporter bør sendes med å bruke `send-pr' kommandoen,
-dersom du var i stand til å installere systemet, ellers til:
-
- bugs@FreeBSD.org
-
-Vær sikker på å indikere HVILKEN VERSJON av FreeBSD du kjrøer
-i enhver programfeil rapport!
-
-
-Generelle spørsmål bør sendes til:
-
- questions@FreeBSD.org
-
-Vær så snill å ha tålmodighet dersom du ikke får svar
-med en gang - dette er en spesielt travel tid for oss, og våre
-frivillige resurser er ofte strekt til grensen! Programfeil rapporter
-som har blitt lagt fram med 'send-pr' kommandoen er ajourført og
-etterfulgt i vår programfeil database, og du kommer til å bli
-informert om enhver status-forandring så lenge programfeilen (eller
-moment etterspørsel) eksisterer.
-
-Vår WEB plass, http://www.freebsd.org, er også en veldig god kilde for
-oppdatert informasjon og tilbyr flere avanserte dokumenterings hjelpemidler.
-Du kan bruke BSDI versonen av Netscape for å surfe World Wide Web
-direkte fra FreeBSD.
-
-Du kan også se i /usr/share/FAQ og /usr/share/doc for videre informasjon
-om systemet.
-
-
-Takk for at du tok deg tid til å lese alt dette, og vi håper
-oppriktig at du vil nyte denne utgaven av FreeBSD!
-
- Jordan Hubbard,
- for FreeBSD Prosjektet
diff --git a/release/sysinstall/help/no_NO.ISO_8859-1/configure.hlp b/release/sysinstall/help/no_NO.ISO_8859-1/configure.hlp
deleted file mode 100644
index 6a02435..0000000
--- a/release/sysinstall/help/no_NO.ISO_8859-1/configure.hlp
+++ /dev/null
@@ -1,16 +0,0 @@
-Denne menyen lar deg konfigurere systemet ditt etter at det er
-installert. Du burde ihvertfall sette passordet til system-bestyreren og
-tidssonen for systemet.
-
-For ekstra godbiter som bash, emacs, pascal, osv. bør du ta en titt
-på Packages valget i denne menyen. Merk at dette valget, så langt,
-bare virker ordentlig dersom du har en CDROM eller en eksisterende
-pakke samling en eller annen plass i fil-hierarkiet hvor pakke-bestyrer
-programmet kan finne det. Automatisk overføring av pakkene via FTP
-er ikke mulig ennå!
-
-Dersom du ønsker å pøkalle pakke installasjons programmet på
-nytt etter at du har forlatt system-installasjons-programmet, bruk
-kommandoen ''pkg_manage''. For å sette tidssonen, skriv ''tzsetup''.
-For mere informasjon om konfigurasjonen av systemet, se i /etc/sysconfig
-filen.
diff --git a/release/sysinstall/help/no_NO.ISO_8859-1/language.hlp b/release/sysinstall/help/no_NO.ISO_8859-1/language.hlp
deleted file mode 100644
index efdd21f..0000000
--- a/release/sysinstall/help/no_NO.ISO_8859-1/language.hlp
+++ /dev/null
@@ -1,13 +0,0 @@
-Bruk denne menyen til å velge språket du foretrekker. Dette setter
-bare språket som blir brukt når hjelpefilene er vist fram.
-
-I framtidige utgaver vil dette også forandre tastaturet, skjerm kartet,
-NLS oppsettet ( sysinstall vil også bruke beskjed kataloger slik at
-alle menyene blir vist frem i språket du valgte) og utføre andre
-I18N momenter for å følge forskjellige normer.
-
-Inntil disse forbedringene er utført, vil du kanskje finne det
-enklest å redigere /etc/sysconfig filen selv etter systemet er
-ferdig installert. Det er mange merknader i den filen som beskriver
-hva som må forandres, og ett par eksempler på eksisterende
-språk oppsett.
diff --git a/release/sysinstall/help/no_NO.ISO_8859-1/usage.hlp b/release/sysinstall/help/no_NO.ISO_8859-1/usage.hlp
deleted file mode 100644
index 01c3d1d..0000000
--- a/release/sysinstall/help/no_NO.ISO_8859-1/usage.hlp
+++ /dev/null
@@ -1,56 +0,0 @@
-HVORDAN Å BRUKE SYSTEMET
-=========================
-
-TAST FUNKSJON
----- --------
-PIL OPP Flytte til forrige dataelement (eller opp, i et tekstfelt).
-PIL NED Flytte til neste dataelement (eller ned, i et tekstfelt).
-TAB Flytte til neste dataelement eller gruppe.
-HØYRE PIL Flytte til neste dataelement eller gruppe (samme som TAB).
-SKIFT-TAB Flytte til forrige dataelement eller gruppe.
-VENSTRE PIL Flytte til forrige dataelement eller gruppe (samme
- som SKIFT-TAB).
-RETUR Velge dataelement.
-SIDE OPP I tekstbokser, ruller opp en side.
-SIDE NED I tekstbokser, ruller ned en side.
-MELLOMROM I "radio" eller flervalgs menyer, markere inneværende
- dataelement.
-F1 Hjelp (i de skjermene som støtter dette).
-
-Dersom du også ser små "^(-)" eller "v(+)" symboler på kantene av
-en meny, betyr det at det er flere dataelementer ovenfor eller nedenfor
-det aktive elementet som ikke blir fremvist (p.g.a. mangel på skjermplass).
-Pil Opp/Ned-tastene ruller menyen. Når ett av disse symbolene forsvinner,
-betyr det at du er på toppen (eller bunnen) av menyen.
-
-I et tekstfelt vil prosenten av igjenomgått tekst bli vist i nedre høyre
-hjørne av feltet. 100% betyr at du er på bunnen av feltet.
-
-Valg av OK i en meny, bekrefter den funksjonen som menyen kontrollerer.
-Valg av Cancel vil avbryte operasjonen og generelt sett returnere til
-forrige meny.
-
-
-SPESIELLE MOMENTER:
-===================
-
-Det er også mulig å velge et meny element ved å trykke på første
-bokstaven av navnet, dersom den er unik. Slike "akselerasjonsbokstaver"
-vil være spesielt markert i elementnavnet.
-
-Konsolldriveren har en innebygget rulle-tilbake buffer some en kan bruke
-til å inspisere ting som har rullet ut av skjermen. For å bruke
-rulle-tilbake funksjonen, trykk på "Scroll Lock" tasten på tastaturet.
-Piltastene og Side Opp/Ned tastene kan nå brukes til å gå
-igjennom den lagrede teksten. For å forlate rulle-tilbake modusen,
-trykk på "Scroll Lock" tasten igjen. Dette momentet er best egnet for å
-håndtere underordnede-skjell og andre "vidundermoduser" som ikke bruker
-menyer.
-
-Når systemet er ferdig installert og kjører i fler-bruker modus, vil
-du også finne at du har mange "virtuelle konsoller" til rådighet og
-kan bruke dem til å ha flere aktive sesjoner på en gang. Bruk ALT-F<n>
-til å velge mellom dem, hvor 'F<n>' er funksjons-tasten som korresponderer
-med den skjermen du ønsker å se. Systemet, som det blir installert, har
-normalt 3 virtuelle konsoller. Du kan lage flere med å redigere /etc/ttys
-filen, etter systemet har kommet opp, opptil et maksimum av 12.
diff --git a/release/sysinstall/help/ru_SU.KOI8-R/README b/release/sysinstall/help/ru_SU.KOI8-R/README
deleted file mode 100644
index 53d888f..0000000
--- a/release/sysinstall/help/ru_SU.KOI8-R/README
+++ /dev/null
@@ -1,109 +0,0 @@
- -----------------------------------------
- FreeBSD 2.0.5 --- RELEASE Version , ,
- ----------------------------------------- /( )`
- \ \___ / |
-äÏÂÒÏ ÐÏÖÁÌÏ×ÁÔØ × ÒÅÌÉÚ 2.0.5 FreeBSD! 2.0.5 - /- _ `-/ '
-ÜÔÏ ÐÒÏÍÅÖÕÔÏÞÎÁÑ ×ÅÒÓÉÑ FreeBSD, ÚÁÐÏÌÎÑÀÝÁÑ (/\/ \ \ /\
-ÎÅÏÂÈÏÄÉÍÙÊ ÐÒÏÍÅÖÕÔÏË ÍÁÖÄÕ ÒÅÌÉÚÁÍÉ 2.0 (ÂÙÌ / / | ` \
-×ÙÐÕÝÅÎ × ÎÏÑÂÒÅ 1994) É 2.1, ËÏÔÏÒÙÊ ÂÕÄÅÔ O O ) / |
-×ÙÐÕÝÅÎ × ËÏÎÃÅ ÉÀÌÑ 95-ÇÏ. FreeBSD 2.0.5 `-^--'`< '
-ÓÏÄÅÒÖÉÔ ÍÎÏÖÅÓÔ×Ï ÚÎÁÞÉÔÅÌØÎÙÈ ÕÓÏ×ÅÒÛÅÎÓÔ×Ï×ÁÎÉÊ, (_.) _ ) /
-ÎÅ ÐÏÓÌÅÄÎÅÅ ÉÚ ËÏÔÏÒÙÈ - Õ×ÅÌÉÞÅÎÎÁÑ ÓÔÁÂÉÌØÎÏÓÔØ `.___/` /
-(ÕÖÅ × ÐÒÉÅÍÌÅÍÙÈ ÐÒÅÄÅÌÁÈ), ÄÅÓÑÔËÉ ÎÏ×ÙÈ `-----' /
-×ÏÚÍÏÖÎÏÓÔÅÊ, ÚÎÁÞÉÔÅÌØÎÏ ÕÌÕÞÛÅÎÎÁÑ <----. __ / __ \
-ÐÒÏÇÒÁÍÍÁ ÕÓÔÁÎÏ×ËÉ. ÷ ÐÏÄÒÏÂÎÏÓÔÑÈ <----|====O)))==) \) /====
-ÎÏ×ÙÅ ×ÏÚÍÏÖÎÏÓÔÉ FreeBSD 2.0.5 <----' `--' `.__,' \
-ÏÐÉÓÁÎÙ × ÏÐÉÓÁÎÉÉ ÒÅÌÉÚÁ! | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-þÔÏ ÔÁËÏÅ FreeBSD? FreeBSD - ÜÔÏ ÏÐÅÒÁÃÉÏÎÎÁÑ ÓÉÓÔÅÍÁ, ÏÓÎÏ×ÁÎÎÁÑ ÎÁ
-4.4 BSD Lite, ÐÒÅÄÎÁÚÎÁÞÅÎÎÁÑ ÄÌÑ ÐÅÒÓÏÎÁÌØÎÙÈ ËÏÍÐØÀÔÅÒÏ×, ÏÓÎÏ×ÁÎÎÙÈ
-ÎÁ ÐÒÏÃÅÓÓÏÒÁÈ "x86" ÆÉÒÍ Intel, AMD, Cyrix ÉÌÉ NexGen. ïÎÁ ÐÏÄÄÅÒÖÉ×ÁÅÔ
-ÍÎÏÖÅÓÔ×Ï ÒÁÚÌÉÞÎÙÈ ÐÅÒÉÆÅÒÉÊÎÙÈ ÕÓÔÒÏÊÓÔ× É ËÏÎÆÉÇÕÒÁÃÉÊ ðë É ÍÏÖÅÔ ÂÙÔØ
-ÉÓÐÏÌØÚÏ×ÁÎÁ ÄÌÑ ÞÅÇÏ ÕÇÏÄÎÏ ÎÁÞÉÎÁÑ ÏÔ ÒÁÚÒÁÂÏÔËÉ ÐÒÏÇÒÁÍÍ É
-ÚÁËÁÎÞÉ×ÁÑ ÐÒÅÄÏÓÔÁ×ÌÅÎÉÅÍ ÓÅÒ×ÉÓÁ ÞÅÒÅÚ ÓÅÔØ Internet; ÓÁÍÙÊ
-ÚÁÇÒÕÖÅÎÎÙÊ ÓÅÒ×ÅÒ × Internet, ftp.cdrom.com ÒÁÂÏÔÁÅÔ ÐÏÄ FreeBSD!
-
-÷ ÜÔÏÊ ×ÅÒÓÉÉ FreeBSD ÅÓÔØ ×ÓÅ, ÞÔÏ ×ÁÍ ÎÁÄÏ ÄÌÑ ÒÁÂÏÔÙ ÔÁËÏÊ
-ÓÉÓÔÅÍÙ, ÐÌÀÓ ÉÓÈÏÄÎÙÅ ÔÅËÓÔÙ ÄÌÑ ×ÓÅÇÏ ÜÔÏÇÏ. åÓÌÉ Õ ×ÁÓ ÕÓÔÁÎÏ×ÌÅÎÙ
-ÉÓÈÏÄÎÙÅ ÔÅËÓÔÙ, ÔÏ ×Ù ÍÏÖÅÔÅ ÚÁÎÏ×Ï ÓËÏÍÐÉÌÉÒÏ×ÁÔØ ×ÓÀ ÓÉÓÔÅÍÕ
-Ó ÎÕÌÑ ÂÕË×ÁÌØÎÏ ÏÄÎÏÊ ËÏÍÁÎÄÏÊ, ÞÔÏ ÄÅÌÁÅÔ ÅÅ ÉÄÅÁÌØÎÏÊ ÄÌÑ
-ÓÔÕÄÅÎÔÏ×, ÉÓÓÌÅÄÏ×ÁÔÅÌÅÊ, ÉÌÉ ÌÀÄÅÊ, ËÏÔÏÒÙÅ ÐÒÏÓÔÏ ÈÏÔÑÔ ÐÏÓÍÏÔÒÅÔØ,
-ÞÔÏ Õ ÎÅÅ ×ÎÕÔÒÉ.
-
-ëÒÏÍÅ ÔÏÇÏ, ÉÍÅÅÔÓÑ ÂÏÌØÛÁÑ ËÏÌÌÅËÃÉÑ ÎÅÚÁ×ÉÓÉÍÏ ÒÁÚÒÁÂÏÔÁÎÎÏÇÏ
-ÐÒÏÇÒÁÍÍÎÏÇÏ ÏÂÅÓÐÅÞÅÎÉÑ, ÐÅÒÅÎÅÓÅÎÎÏÇÏ ÐÏÄ FreeBSD ("ports
-collection"), ÏÂÌÅÇÞÁÀÝÁÑ ÄÌÑ ×ÁÓ ÄÏÂÙ×ÁÎÉÅ É ÕÓÔÁÎÏ×ËÕ ×ÁÛÉÈ
-ÌÀÂÉÍÙÈ ÔÒÁÄÉÃÉÏÎÎÙÈ ÕÔÉÌÉÔ UNIX ÄÌÑ FreeBSD. ïÎÁ ÓÏÓÔÏÉÔ ÉÚ ÂÏÌÅÅ 270
-ÐÁËÅÔÏ×, ÏÔ ÔÅËÓÔÏ×ÙÈ ÒÅÄÁËÔÏÒÏ× É ÑÚÙËÏ× ÐÒÏÇÒÁÍÍÉÒÏ×ÁÎÉÑ ÄÏ ÇÒÁÆÉÞÅÓËÉÈ
-ÐÁËÅÔÏ×, É ÄÅÌÁÅÔ FreeBSD ÍÏÝÎÏÊ É ×ÓÅÏÈ×ÁÔÙ×ÁÀÝÅÊ ÓÉÓÔÅÍÏÊ, ËÏÔÏÒÁÑ
-ÍÏÖÅÔ ÐÏÓÏÒÅ×ÎÏ×ÁÔØÓÑ Ó ÏÐÅÒÁÃÉÏÎÎÙÍÉ ÓÉÓÔÅÍÁÍÉ ÍÏÝÎÙÈ ÒÁÂÏÞÉÈ ÓÔÁÎÃÉÊ
-× ÍÏÝÎÏÓÔÉ É ÐÒÅÄÏÓÔÁ×ÌÑÅÍÏÍ ÓÅÒ×ÉÓÅ.
-
-þÔÏÂÙ ÐÏÌÕÞÉÔØ ÂÏÌÅÅ ÐÏÌÎÕÀ ÄÏËÕÍÅÎÔÁÃÉÀ ÎÁ ÓÉÓÔÅÍÕ, ÍÙ ÓÏ×ÅÔÕÅÍ ×ÁÍ
-ÐÒÉÏÂÒÅÓÔÉ ÎÁÂÏÒ ËÎÉÇ ÐÏ BSD 4.4 ÏÔ ÉÚÄÁÔÅÌØÓÔ×Á O'Reilly Associates É
-ÁÓÓÏÃÉÁÃÉÉ USENIX, ISBN 1-56592-082-1. íÙ ÎÅ Ó×ÑÚÁÎÙ Ó O'Reilly, ÍÙ
-ÌÉÛØ ÕÄÏ×ÌÅÔ×ÏÒÅÎÎÙÅ ÐÏËÕÐÁÔÅÌÉ! (÷ òÏÓÓÉÉ ËÎÉÇÉ O'Reilly ÐÒÏÄÁÅÔ,
-ÎÁÐÒÉÍÅÒ, ÆÉÒÍÁ SWD × óÁÎËÔ-ðÅÔÅÒÂÕÒÇÅ - ÐÒÉÍ.ÐÅÒ. - Ñ Ó ÎÉÍÉ ÎÅ
-Ó×ÑÚÁÎ, ÐÒÏÓÔÏ Ñ ÚÎÁÀ, ÇÄÅ ÂÙÌÉ ËÕÐÌÅÎÙ ËÎÉÇÉ, ËÏÔÏÒÙÅ Ñ ÞÉÔÁÌ)
-
-ðÅÒÅÄ ÔÅÍ, ËÁË ÐÒÏÄÏÌÖÉÔØ ÕÓÔÁÎÏ×ËÕ, ×Ù ÍÏÖÅÔÅ ÐÏÞÉÔÁÔØ "òÕËÏ×ÏÄÓÔ×Ï
-ÐÏ ÁÐÐÁÒÁÔÕÒÅ" (HARDWARE GUIDE). ëÏÎÆÉÇÕÒÉÒÏ×ÁÎÉÅ ÁÐÐÁÒÁÔÕÒÙ ðë ÄÌÑ
-ÞÅÇÏ ÕÇÏÄÎÏ ËÒÏÍÅ DOS/Windows (ËÏÔÏÒÙÅ ÎÁ ÓÁÍÏÍ ÄÅÌÅ ÉÓÐÏÌØÚÕÀÔ ÎÅ ×ÓÅ
-×ÏÚÍÏÖÎÏÓÔÉ ÁÐÐÁÒÁÔÕÒÙ) ×ÓÅÇÄÁ ÏËÁÚÙ×ÁÅÔÓÑ ÎÅÓËÏÌØËÏ ÓÌÏÖÎÅÅ, ÞÅÍ ÍÏÖÅÔ
-ÐÏËÁÚÁÔØÓÑ ÎÁ ÐÅÒ×ÙÊ ×ÚÇÌÑÄ, É ÅÓÌÉ ×Ù ÄÕÍÁÅÔÅ, ÞÔÏ ÐÏÎÉÍÁÅÔÅ ðë, ÔÏ
-ÜÔÏ ÚÎÁÞÉÔ ÌÉÛØ ÔÏ, ÞÔÏ ×Ù ÒÁÂÏÔÁÅÔÅ Ó ÎÉÍ ÎÅÄÏÓÔÁÔÏÞÎÏ ÄÏÌÇÏ! :) üÔÏ
-ÒÕËÏ×ÏÄÓÔ×Ï ÄÁÓÔ ×ÁÍ ÎÅËÏÔÏÒÙÅ ÎÁÍÅÔËÉ ÎÁÓÞÅÔ ËÏÎÆÉÇÕÒÉÒÏ×ÁÎÉÑ
-ÁÐÐÁÒÁÔÕÒÙ É ÓÉÍÐÔÏÍÏ×, ÚÁ ËÏÔÏÒÙÍÉ ÎÕÖÎÏ ÓÌÅÄÉÔØ ÐÒÉ ×ÏÚÎÉËÎÏ×ÅÎÉÉ
-ÐÒÏÂÌÅÍ. ïÎÏ ÄÏÓÔÕÐÎÏ ÞÅÒÅÚ ÍÅÎÀ "Documentation" ÎÁ ÚÁÇÒÕÚÏÞÎÏÊ ÄÉÓËÅÔÅ
-FreeBSD.
-
-ðòåäïóôåòåöåîéå: èÏÔÑ FreeBSD ÄÅÌÁÅÔ ×ÓÅ ÏÔ ÎÅÅ ÚÁ×ÉÓÑÝÅÅ, ÞÔÏÂÙ
-ÐÒÅÄÏÔ×ÒÁÔÉÔØ ÓÌÕÞÁÊÎÕÀ ÐÏÔÅÒÀ ÄÁÎÎÙÈ, ×ÓÅ ÒÁ×ÎÏ ×ÐÏÌÎÅ ×ÅÒÏÑÔÎÏ, ÞÔÏ
-÷åóø ÷áû äéóë âõäåô óôåòô ×Ï ×ÒÅÍÑ ÜÔÏÊ ÅÅ ÕÓÔÁÎÏ×ËÉ! ðÏÖÁÌÕÊÓÔÁ, ÎÅ
-ÐÒÏÄÏÌÖÁÊÔÅ ÕÓÔÁÎÏ×ËÕ, ÐÏËÁ ×Ù ÎÅ ÓÄÅÌÁÅÔÅ ÁÒÈÉ×ÎÕÀ ËÏÐÉÀ ×ÓÅÊ ×ÁÛÅÊ
-×ÁÖÎÏÊ ÉÎÆÏÒÍÁÃÉÉ! íÙ ÎÅ ÛÕÔÉÍ!
-
-ôÅÈÎÉÞÅÓËÉÅ ËÏÍÍÅÎÔÁÒÉÉ ÐÒÏ ÜÔÕ ×ÅÒÓÉÀ ÐÏÓÙÌÁÊÔÅ ÐÏ ÁÄÒÅÓÕ (ÎÁ
-ÁÎÇÌÉÊÓËÏÍ ÑÚÙËÅ):
-
- hackers@FreeBSD.org
-
-óÏÏÂÝÅÎÉÑ ÏÂ ÏÛÉÂËÁÈ ÓÌÅÄÕÅÔ ÐÏÓÙÌÁÔØ Ó ÐÏÍÏÝØÀ ÐÒÏÇÒÁÍÍÙ `send-pr',
-ÅÓÌÉ ×ÁÍ ÕÄÁÌÏÓØ ÕÓÔÁÎÏ×ÉÔØ ÓÉÓÔÅÍÕ, ÉÎÁÞÅ ÐÏ ÁÄÒÅÓÕ (É ÔÏ É ÄÒÕÇÏÅ ÎÁ
-ÁÎÇÌÉÊÓËÏÍ ÑÚÙËÅ):
-
- bugs@FreeBSD.org
-
-ðÏÖÁÌÕÊÓÔÁ, × ÌÀÂÏÍ ×ÁÛÅÍ ÓÏÏÂÝÅÎÉÉ Ï ÏÛÉÂËÁÈ ÕËÁÚÙ×ÁÊÔÅ, × ëáëïê
-÷åòóéé FreeBSD ×Ù ÉÈ ÏÂÎÁÒÕÖÉÌÉ!
-
-÷ÏÐÒÏÓÙ ÏÂÝÅÇÏ ÈÁÒÁËÔÅÒÁ ÎÁÄÏ ÐÏÓÙÌÁÔØ ÐÏ ÁÄÒÅÓÕ (ÔÏÖÅ ÎÁ ÁÎÇÌÉÊÓËÏÍ):
-
- questions@FreeBSD.org
-
-ðÏÖÁÌÕÊÓÔÁ, ÐÒÏÑ×ÉÔÅ ÐÏÎÉÍÁÎÉÅ, ÅÓÌÉ ×ÁÛÉ ×ÏÐÒÏÓÙ ÏÓÔÁÎÕÔÓÑ ÂÅÚ
-ÏÔ×ÅÔÁ - ÓÅÊÞÁÓ ÄÌÑ ÎÁÓ ÏÞÅÎØ ÚÁÎÑÔÏÅ ×ÒÅÍÑ, É ÒÅÓÕÒÓÙ ÎÁÛÉÈ
-ÄÏÂÒÏ×ÏÌØÃÅ× ÞÁÓÔÏ ÂÙ×ÁÀÔ ÐÏÌÎÏÓÔØÀ ÉÓÞÅÒÐÁÎÙ. óÏÏÂÝÅÎÉÑ Ï ÏÛÉÂËÁÈ,
-ÐÏÓÌÁÎÎÙÅ ËÏÍÁÎÄÏÊ send-pr ÚÁÐÉÓÙ×ÁÀÔÓÑ É ÏÔÓÌÅÖÉ×ÁÀÔÓÑ × ÎÁÛÅÊ ÂÁÚÅ
-ÄÁÎÎÙÈ ÓÏÏÂÝÅÎÉÊ Ï ÏÛÉÂËÁÈ, É ÍÙ ÂÕÄÅÍ ×ÁÓ ÉÎÆÏÒÍÉÒÏ×ÁÔØ ÏÂÏ ×ÓÅÈ
-ÉÚÍÅÎÅÎÉÑÈ × ÔÅËÕÝÅÍ ÓÏÓÔÏÑÎÉÉ ÄÅÌ ÐÏ ÉÓÐÒÁ×ÌÅÎÉÀ ÏÛÉÂËÉ (ÉÌÉ ÐÏ
-ÄÏÂÁ×ÌÅÎÉÀ ÚÁÐÒÏÛÅÎÎÙÈ ×ÁÍÉ ×ÏÚÍÏÖÎÏÓÔÅÊ).
-
-åÝÅ ÏÄÉÎ ÏÞÅÎØ ÈÏÒÏÛÉÊ ÉÓÔÏÞÎÉË ÏÂÎÏ×ÌÅÎÎÏÊ ÉÎÆÏÒÍÁÃÉÉ - ÜÔÏ
-ÎÁÛ ÓÅÒ×ÅÒ WWW, http:://www.freebsd.org, ËÏÔÏÒÙÊ ËÒÏÍÅ ÔÏÇÏ ÓÏÄÅÒÖÉÔ
-ÄÏÐÏÌÎÉÔÅÌØÎÕÀ ÄÏËÕÍÅÎÔÁÃÉÀ. äÌÑ ÄÏÓÔÕÐÁ Ë WWW ÐÒÑÍÏ ÉÚ FreeBSD ×Ù
-ÍÏÖÅÔÅ ÉÓÐÏÌØÚÏ×ÁÔØ ×ÅÒÓÉÀ Netscape ÏÔ BSDI.
-
-äÁÌØÎÅÊÛÁÑ ÉÎÆÏÒÍÁÃÉÑ Ï ÓÉÓÔÅÍÅ ÓÏÄÅÒÖÉÔÓÑ × ËÁÔÁÌÏÇÁÈ /usr/share/FAQ
-(ÞÁÓÔÙÅ ×ÏÐÒÏÓÙ É ÏÔ×ÅÔÙ) É /usr/share/DOC (ÄÏËÕÍÅÎÔÁÃÉÑ).
-
-óÐÁÓÉÂÏ ×ÁÍ ÚÁ ÔÏ, ÞÔÏ ×Ù ×ÓÅ ÜÔÏ ÐÒÏÞÌÉ, É ÍÙ ÏÞÅÎØ ÎÁÄÅÅÍÓÑ, ÞÔÏ
-ÒÁÂÏÔÁ Ó ÜÔÏÊ ×ÅÒÓÉÅÊ FreeBSD ÄÏÓÔÁ×ÉÔ ×ÁÍ ÕÄÏ×ÏÌØÓÔ×ÉÅ!
-
- Jordan Hubbard,
- ÏÔ ÉÍÅÎÉ ÐÒÏÅËÔÁ FreeBSD
diff --git a/release/sysinstall/help/ru_SU.KOI8-R/configure.hlp b/release/sysinstall/help/ru_SU.KOI8-R/configure.hlp
deleted file mode 100644
index 06e2aac..0000000
--- a/release/sysinstall/help/ru_SU.KOI8-R/configure.hlp
+++ /dev/null
@@ -1,16 +0,0 @@
-üÔÏ ÍÅÎÀ ÐÏÚ×ÏÌÑÅÔ ×ÁÍ ÓËÏÎÆÉÇÕÒÉÒÏ×ÁÔØ ÓÉÓÔÅÍÕ ×ÓËÏÒÅ ÐÏÓÌÅ ÅÅ
-ÕÓÔÁÎÏ×ËÉ. ëÁË ÍÉÎÉÍÕÍ, ×Ù ×ÅÒÏÑÔÎÏ ÄÏÌÖÎÙ ÂÕÄÅÔÅ ÕÓÔÁÎÏ×ÉÔØ ÐÁÒÏÌØ
-ÓÉÓÔÅÍÎÏÇÏ ÁÄÍÉÎÉÓÔÒÁÔÏÒÁ É ×ÁÛÕ ×ÒÅÍÅÎÎÕÀ ÚÏÎÕ.
-
-äÏÐÏÌÎÉÔÅÌØÎÙÅ ÐÁËÅÔÙ, ÔÁËÉÅ ËÁË bash, emacs, pascal É Ô.Ä. ×ÁÍ ÓËÏÒÅÅ
-×ÓÅÇÏ ÎÁÄÏ ÂÕÄÅÔ ÐÏÉÓËÁÔØ × ÁÌØÔÅÒÎÁÔÉ×Å "Packages" ÜÔÏÇÏ ÍÅÎÀ.
-ðÒÁ×ÄÁ, ÓÅÊÞÁÓ ÏÔ ÜÔÏÇÏ ÎÁÞÉÎÁÎÉÑ ÂÕÄÅÔ ÐÏÌØÚÁ ÔÏÌØËÏ × ÔÏÍ ÓÌÕÞÁÅ,
-ÅÓÌÉ Õ ×ÁÓ ÅÓÔØ CD-ROM ÉÌÉ ÇÏÔÏ×ÁÑ ËÏÌÌÅËÃÉÑ ÐÁËÅÔÏ× ÌÅÖÉÔ ÇÄÅ-ÔÏ ×
-ÆÁÊÌÏ×ÏÊ ÓÉÓÔÅÍÅ, ÔÁË ÞÔÏ ÕÔÉÌÉÔÁ ÕÐÒÁ×ÌÅÎÉÑ ÐÁËÅÔÁÍÉ ÓÍÏÖÅÔ ÉÈ ÎÁÊÔÉ.
-á×ÔÏÍÁÔÉÞÅÓËÏÅ ×ÙËÁÞÉ×ÁÎÉÅ ÐÁËÅÔÏ× ÞÅÒÅÚ FTP ÅÝÅ ÎÅ ÐÏÄÄÅÒÖÁÎÏ.
-
-åÓÌÉ ×Ù ÚÁÈÏÔÉÔÅ ÚÁÐÕÓÔÉÔØ ÕÔÉÌÉÔÕ ÕÓÔÁÎÏ×ËÉ ÐÁËÅÔÏ× ÐÏÓÌÅ ÔÏÇÏ, ËÁË
-ÚÁ×ÅÒÛÉÔÅ ÕÓÔÁÎÏ×ËÕ ÓÉÓÔÅÍÙ, ÔÏ ÚÎÁÊÔÅ, ÞÔÏ ÏÎÁ ÎÁÚÙ×ÁÅÔÓÑ
-``pkg_manage''. äÌÑ ÎÁÓÔÒÏÊËÉ ×ÒÅÍÅÎÎÏÊ ÚÏÎÙ ÚÁÐÕÓÔÉÔÅ ``tzsetup''. ÷
-ÆÁÊÌÅ ``/etc/sysconfig'' ×Ù ÓÍÏÖÅÔÅ ÎÁÊÔÉ ÄÏÐÏÌÎÉÔÅÌØÎÕÀ ÉÎÆÏÒÍÁÃÉÀ ÐÏ
-ÏÂÝÅÊ ËÏÎÆÉÇÕÒÁÃÉÉ ÓÉÓÔÅÍÙ.
diff --git a/release/sysinstall/help/ru_SU.KOI8-R/language.hlp b/release/sysinstall/help/ru_SU.KOI8-R/language.hlp
deleted file mode 100644
index a6d2e21..0000000
--- a/release/sysinstall/help/ru_SU.KOI8-R/language.hlp
+++ /dev/null
@@ -1,15 +0,0 @@
-ó ÐÏÍÏÝØÀ ÜÔÏÇÏ ÍÅÎÀ ×Ù ÍÏÖÅÔÅ ×ÙÂÒÁÔØ ×ÁÛ ÌÀÂÉÍÙÊ ÑÚÙË. ðÒÁ×ÄÁ, ÐÏËÁ ÞÔÏ ÜÔÏ
-ÐÏ×ÌÉÑÅÔ ÔÏÌØËÏ ÎÁ ÔÏ, ÎÁ ËÁËÏÍ ÑÚÙËÅ ×Ù ÐÏÌÕÞÉÔÅ ÜËÒÁÎÙ ÐÏÍÏÝÉ.
-
-÷ ÂÕÄÕÝÉÈ ×ÅÒÓÉÑÈ ÏÎÏ ÐÏÚ×ÏÌÉÔ ×ÁÍ ÎÁÓÔÒÏÉÔØ É ÒÁÓËÌÁÄËÕ ËÌÁ×ÉÁÔÕÒÙ,
-ÜËÒÁÎÎÙÅ ÛÒÉÆÔÙ É ÕÓÔÁÎÏ×ËÉ NLS (National Language Supplement -
-ðÏÄÄÅÒÖËÁ îÁÃÉÏÎÁÌØÎÙÈ ñÚÙËÏ×) (ÓÁÍ sysinstall ÂÕÄÅÔ ÉÓÐÏÌØÚÏ×ÁÔØ
-ÒÁÚÌÉÞÎÙÅ ËÁÔÁÌÏÇÉ ÓÏÏÂÝÅÎÉÊ, ÔÁË ÞÔÏ ÍÅÎÀ ÔÏÖÅ ÂÕÄÕÔ ÎÁ ÒÁÚÌÉÞÎÙÈ
-ÑÚÙËÁÈ) É ÒÅÁÌÉÚÏ×ÁÔØ ÄÒÕÇÉÅ ×ÏÚÍÏÖÎÏÓÔÉ ÉÎÔÅÒÎÁÃÉÏÎÁÌÉÚÁÃÉÉ,
-ÕÄÏ×ÌÅÔ×ÏÒÑÀÝÉÅ ÒÁÚÌÉÞÎÙÍ ÓÔÁÎÄÁÒÔÁÍ.
-
-á ÐÏËÁ ÜÔÉ ÕÓÏ×ÅÒÛÅÎÓÔ×Ï×ÁÎÉÑ ÎÅ ÓÄÅÌÁÎÙ, ÄÌÑ ×ÁÓ ÍÏÖÅÔ ÏËÁÚÁÔØÓÑ
-ÐÒÏÝÅ ×ÒÕÞÎÕÀ ÏÔÒÅÄÁËÔÉÒÏ×ÁÔØ ÆÁÊÌ /etc/sysconfig ÐÏÓÌÅ ÔÏÇÏ, ËÁË
-ÓÉÓÔÅÍÁ ÂÕÄÅÔ ÕÓÔÁÎÏ×ÌÅÎÁ. üÔÏÔ ÆÁÊÌ ÓÏÄÅÒÖÉÔ ÒÑÄ ËÏÍÍÅÎÔÁÒÉÅ× Ï ÔÏÍ,
-ÞÔÏ ÉÍÅÎÎÏ ÎÁÄÏ ÍÅÎÑÔØ, Á ÔÁËÖÅ ÎÅÓËÏÌØËÏ ÐÒÉÍÅÒÏ× ÓÕÝÅÓÔ×ÕÀÝÉÈ
-ÎÅ-ÁÎÇÌÉÊÓËÉÈ ÎÁÓÔÒÏÅË.
diff --git a/release/sysinstall/help/ru_SU.KOI8-R/usage.hlp b/release/sysinstall/help/ru_SU.KOI8-R/usage.hlp
deleted file mode 100644
index 1b6399b..0000000
--- a/release/sysinstall/help/ru_SU.KOI8-R/usage.hlp
+++ /dev/null
@@ -1,60 +0,0 @@
-ëáë ðïìøúï÷áôøóñ üôïê óéóôåíïê
-==============================
-
-ëìá÷éûá äåêóô÷éå
-------- --------
-óôòåìëá ÷÷åòè ðÅÒÅÊÔÉ Ë ÐÒÅÄÙÄÕÝÅÊ ÁÌØÔÅÒÎÁÔÉ×Å (ÉÌÉ ××ÅÒÈ × ÔÅËÓÔÅ).
-óôòåìëá ÷îéú ðÅÒÅÊÔÉ Ë ÓÌÅÄÕÀÝÅÊ ÁÌØÔÅÒÎÁÔÉ×Å (ÉÌÉ ×ÎÉÚ × ÔÅËÓÔÅ).
-TAB ðÅÒÅÊÔÉ Ë ÓÌÅÄÕÀÝÅÊ ÁÌØÔÅÒÎÁÔÉ×Å ÉÌÉ ÇÒÕÐÐÅ.
-óôòåìëá ÷ðòá÷ï ðÅÒÅÊÔÉ Ë ÓÌÅÄÕÀÝÅÊ ÁÌØÔÅÒÎÁÔÉ×Å ÉÌÉ ÇÒÕÐÐÅ (ËÁË É TAB).
-SHIFT-TAB ðÅÒÅÊÔÉ Ë ÐÒÅÄÙÄÕÝÅÊ ÁÌØÔÅÒÎÁÔÉ×Å ÉÌÉ ÇÒÕÐÐÅ.
-óôòåìëá ÷ìå÷ï ðÅÒÅÊÔÉ Ë ÐÒÅÄÙÄÕÝÅÊ ÁÌØÔÅÒÎÁÔÉ×Å ÉÌÉ ÇÒÕÐÐÅ (ËÁË É SHIFT-TAB).
-RETURN ÷ÙÂÒÁÔØ [ÜÔÕ ËÌÁ×ÉÛÕ ÔÁËÖÅ ÏÂÏÚÎÁÞÁÀÔ Enter].
-ESC úÁÐÕÓÔÉÔØ shell ÄÌÑ ÄÉÁÇÎÏÓÔÉÞÅÓËÉÈ ÃÅÌÅÊ. ðÒÉ ×ÙÈÏÄÅ
- ÉÚ ÛÅÌÌÁ ×Ù ×ÅÒÎÅÔÅÓØ Ë ÔÏÍÕ ÖÅ ÍÅÓÔÕ.
-PG UP ÷ ÔÅËÓÔÅ ÐÅÒÅÌÉÓÔÙ×ÁÅÔ ÎÁ ÓÔÒÁÎÉÃÕ ××ÅÒÈ.
-PG DN ÷ ÔÅËÓÔÅ ÐÅÒÅÌÉÓÔÙ×ÁÅÔ ÎÁ ÓÔÒÁÎÉÃÕ ×ÎÉÚ.
-ðòïâåì ÷ "ÒÁÄÉÏ"-ÍÅÎÀ (ÇÄÅ ÍÏÖÎÏ ×ÙÂÒÁÔØ ÓÒÁÚÕ ÎÅÓËÏÌØËÏ
- ÁÌØÔÅÒÎÁÔÉ×) ÐÏÍÅÞÁÅÔ ÉÌÉ ÓÎÉÍÁÅÔ ÐÏÍÅÔËÕ ×ÙÂÏÒÁ Ó
- ÔÅËÕÝÅÊ ÁÌØÔÅÒÎÁÔÉ×Ù.
-F1 ðÏÍÏÝØ (× ÜËÒÁÎÁÈ, ÇÄÅ ÏÎÁ ÐÒÅÄÕÓÍÏÔÒÅÎÁ).
-
-åÓÌÉ ×Ù ×ÉÄÉÔÅ × ÕÇÏÌËÁÈ ÍÅÎÀ ÓÉÍ×ÏÌÙ "^(-)" ÉÌÉ "v(+)", ÔÏ ÜÔÏ ÏÚÎÁÞÁÅÔ,
-ÞÔÏ ÓÏÏÔ×ÅÔÓÔ×ÅÎÎÏ ×ÙÛÅ ÉÌÉ ÎÉÖÅ ÔÅËÕÝÅÊ ÁÌØÔÅÒÎÁÔÉ×Ù ÅÓÔØ ÅÝÅ
-ÁÌØÔÅÒÎÁÔÉ×Ù, ËÏÔÏÒÙÅ ÎÅ ÐÏËÁÚÁÎÙ, ÐÏÔÏÍÕ ÞÔÏ ÎÅ È×ÁÔÉÌÏ ÍÅÓÔÁ ÎÁ ÜËÒÁÎÅ.
-ëÌÁ×ÉÛÉ ÓÏ ÓÔÒÅÌËÁÍÉ ××ÅÒÈ/×ÎÉÚ ÐÒÏËÒÕÔÑÔ ÔÁËÏÅ ÍÅÎÀ ÎÁ ÜËÒÁÎÅ. ëÏÇÄÁ
-ÓÉÍ×ÏÌ ÉÓÞÅÚÁÅÔ, ÔÏ ÜÔÏ ÚÎÁÞÉÔ, ÞÔÏ ×Ù × ÓÁÍÏÍ ×ÅÒÈÕ (ÉÌÉ ÎÉÚÕ) ÍÅÎÀ.
-
-÷ ÔÅËÓÔÏ×ÙÈ ÐÏÌÑÈ ËÏÌÉÞÅÓÔ×Ï ÏÓÔÁ×ÛÅÇÏÓÑ ÔÅËÓÔÁ × ÐÒÏÃÅÎÔÁÈ ÐÏËÁÚÙ×ÁÅÔÓÑ ×
-ÐÒÁ×ÏÍ ÎÉÖÎÅÍ ÕÇÌÕ. 100% ÏÚÎÁÞÁÅÔ, ÞÔÏ ×Ù ÎÁÈÏÄÉÔÅÓØ × ÓÁÍÏÍ ÎÉÚÕ ÐÏÌÑ.
-
-÷ÙÂÏÒ OK × ÍÅÎÀ ÏÚÎÁÞÁÅÔ ÐÏÄÔ×ÅÒÖÄÅÎÉÅ ÄÅÊÓÔ×ÉÑ, ËÏÔÏÒÏÅ ×Ù ÚÁÐÒÏÓÉÌÉ.
-÷ÙÂÏÒ ÁÌØÔÅÒÎÁÔÉ×Ù Cancel ÏÔÍÅÎÉÔ ÚÁÐÒÏÛÅÎÎÕÀ ÏÐÅÒÁÃÉÀ É × ÏÂÝÅÍ ÓÌÕÞÁÅ
-×ÅÒÎÅÔ ×ÁÓ × ÐÒÅÄÙÄÕÝÅÅ ÍÅÎÀ.
-
-
-äïðïìîéôåìøîùå ÷ïúíïöîïóôé:
-===========================
-
-áÌØÔÅÒÎÁÔÉ×Ù ÍÅÎÀ ÍÏÖÎÏ ÔÁËÖÅ ×ÙÂÉÒÁÔØ ÎÁÖÁÔÉÅÍ ÉÈ ÐÅÒ×ÏÊ ÂÕË×Ù (ÅÓÌÉ ÏÎÁ
-ÕÎÉËÁÌØÎÁ). ôÁËÉÅ ÓÉÍ×ÏÌÙ-"ÕÓËÏÒÉÔÅÌÉ" (ÉÌÉ "ÁËÓÅÌÅÒÁÔÏÒÙ") ×ÙÄÅÌÑÀÔÓÑ ÄÒÕÇÉÍ
-Ã×ÅÔÏÍ × ÎÁÚ×ÁÎÉÉ ÁÌØÔÅÒÎÁÔÉ×Ù.
-
-÷ ÄÒÁÊ×ÅÒÅ ËÏÎÓÏÌÉ ÔÁËÖÅ ÅÓÔØ ×ÏÚÍÏÖÎÏÓÔØ ÐÒÏËÒÕÔÉÔØ ÎÁÚÁÄ ÉÎÆÏÒÍÁÃÉÀ,
-ËÏÔÏÒÁÑ ÕÖÅ "ÕÅÈÁÌÁ" Ó ÜËÒÁÎÁ (ÐÒÏËÒÕÔÉÌÁÓØ ××ÅÒÈ). äÌÑ ÜÔÏÇÏ ÎÁÖÍÉÔÅ
-"Scroll Lock" (É ÐÏÔÏÍ ÏÔÐÕÓÔÉÔÅ) É Ó ÐÏÍÏÝØÀ ÓÔÒÅÌÏË É ËÌÁ×ÉÛ PgUp/PgDn ×Ù
-ÓÍÏÖÅÔÅ Ä×ÉÇÁÔØ ÓÏÈÒÁÎÅÎÎÙÊ ÔÅËÓÔ (ÏÄÎÁËÏ, ÐÏÍÎÉÔÅ, ÞÔÏ ÂÕÆÅÒ ÎÅ
-ÂÅÓËÏÎÅÞÅÎ). þÔÏÂÙ ×ÅÒÎÕÔØÓÑ × ÎÏÒÍÁÌØÎÙÊ ÒÅÖÉÍ, ÓÎÏ×Á ÎÁÖÍÉÔÅ "Scroll
-Lock". üÔÁ ×ÏÚÍÏÖÎÏÓÔØ ÏÓÏÂÅÎÎÏ ÐÏÌÅÚÎÁ ÐÒÉ ÒÁÂÏÔÅ × ÛÅÌÌÅ ÉÌÉ ÄÒÕÇÉÈ
-"ÒÅÖÉÍÁÈ ÄÌÑ ÚÎÁÔÏËÏ×", ËÏÔÏÒÙÅ ÎÅ ÉÓÐÏÌØÚÕÀÔ ÍÅÎÀ.
-
-ëÁË ÔÏÌØËÏ ÓÉÓÔÅÍÁ ÂÕÄÅÔ ÐÏÌÎÏÓÔØÀ ÕÓÔÁÎÏ×ÌÅÎÁ É ÚÁÐÕÝÅÎÁ ×
-"ÍÎÏÇÏÐÏÌØÚÏ×ÁÔÅÌØÓËÏÍ ÒÅÖÉÍÅ", ×Ù ÐÏÌÕÞÉÔÅ ÎÅÓËÏÌØËÏ "×ÉÒÔÕÁÌØÎÙÈ
-ËÏÎÓÏÌÅÊ", ËÏÔÏÒÙÅ ×Ù ÓÍÏÖÅÔÅ ÉÓÐÏÌØÚÏ×ÁÔØ ÄÌÑ ×ÅÄÅÎÉÑ ÎÅÓËÏÌØËÉÈ ÓÅÁÎÓÏ×
-ÒÁÂÏÔÙ ÏÄÎÏ×ÒÅÍÅÎÎÏ. üËÒÁÎÙ ÐÅÒÅËÌÀÞÁÀÔÓÑ Ó ÐÏÍÏÝØÀ ËÌÁ×ÉÛ ALT-F<n>, ÇÄÅ
-`F<n>' - ÜÔÏ ÆÕËÎÃÉÏÎÁÌØÎÁÑ ËÌÁ×ÉÛÁ Ó ÎÏÍÅÒÏÍ, ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÉÍ ÎÏÍÅÒÕ
-ÜËÒÁÎÁ, ËÏÔÏÒÙÊ ×Ù ÈÏÔÉÔÅ Õ×ÉÄÅÔØ. ðÏ ÕÍÏÌÞÁÎÉÀ ÓÉÓÔÅÍÁ ÐÏÓÔÁ×ÌÑÅÔÓÑ Ó 4
-×ÉÒÔÕÁÌØÎÙÍÉ ËÏÎÓÏÌÑÍÉ. ÷Ù ÍÏÖÅÔÅ Õ×ÅÌÉÞÉÔØ ÉÈ ÞÉÓÌÏ, ÏÔÒÅÄÁËÔÉÒÏ×Á× ÆÁÊÌ
-/etc/ttys ÐÏÓÌÅ ÔÏÇÏ ËÁË ÓÉÓÔÅÍÁ ÂÕÄÅÔ ÕÓÔÁÎÏ×ÌÅÎÁ, ÍÁËÓÉÍÁÌØÎÏÅ ÞÉÓÌÏ
-ÒÁ×ÎÏ 12. îÅ Õ×ÌÅËÁÊÔÅÓØ ÂÏÌØÛÉÍ ÞÉÓÌÏÍ ËÏÎÓÏÌÅÊ, ÅÓÌÉ ÎÁ ×ÁÛÅÊ ÍÁÛÉÎÅ ÍÁÌÏ
-ÐÁÍÑÔÉ. ðÏÄÈÏÄÑÝÉÍ ÞÉÓÌÏÍ ÄÌÑ 4 ÍÅÇÁÂÁÊÔ ÂÕÄÅÔ 4 ËÏÎÓÏÌÉ (ÉÌÉ ÄÁÖÅ ÍÅÎØÛÅ).
diff --git a/release/sysinstall/help/sv_SE.ISO8859-1/README b/release/sysinstall/help/sv_SE.ISO8859-1/README
deleted file mode 100644
index c6761e8..0000000
--- a/release/sysinstall/help/sv_SE.ISO8859-1/README
+++ /dev/null
@@ -1,114 +0,0 @@
-
- -----------------------------------------
- FreeBSD 2.0.5 --- RELEASE Version , ,
- ----------------------------------------- /( )`
- \ \___ / |
-Välkommen till FreeBSD version 2.0.5! Denna version /- _ `-/ '
-är en fyllnadsrelease av FreeBSD som täcker upp det (/\/ \ \ /\
-tomrum som bildats mellan 2.0R (som släpptes i / / | ` \
-November '94) och 2.1R, som kommer att släppas O O ) / |
-i slutet av Juli '95. FreeBSD 2.0.5 innehåller `-^--'`< '
-många betydande förbättringar gentemot 2.0R, (_.) _ ) /
-bland annat mycket bättre stabilitet, ett `.___/` /
-dussintal nya finesser och ett förbättrat `-----' /
-installationsprogram. Läs de "release <----. __ / __ \
-notes" som finns för fler detaljer om <----|====O)))==) \) /====
-vad som är nytt i 2.0.5! <----' `--' `.__,' \
- | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-Vad är FreeBSD? FreeBSD är ett operativsystem för Intel, AMD, Cyrix och
-NexGen "x86"-baserad PC-hårdvara. FreeBSD är baserat på 4.4 BSD Lite.
-Det fungerar med en stor mängd olika tillbehör och konfigurationer och
-kan användas för allt från mjukvaruutveckling till att tillhandahålla
-Internet-tjänster; det mest använda systemet på Internet, ftp.cdrom.com, är
-en FreeBSD-maskin!
-
-Denna version av FreeBSD innehåller allt du behöver för att köra ett
-sådant system. Fullständig källkod till allting ingår också.
-Med källkodsdistributionen installerad kan du bokstavligt talat kompilera
-om hela systemet från början med ett enda kommando. Detta gör FreeBSD
-perfekt för studenter, forskare och de som helt enkelt vill undersöka
-hur saker fungerar.
-
-
-En stor samling av programvara anpassad till FreeBSD av olika personer
-("the ports collection") följer också med. Mer än 270 programpaket
-innehållande allt från editorer till programspråk och grafikverktyg,
-detta underlättar för dig att installera alla dina favoritprogram
-under unix för FreeBSD. Detta gör FreeBSD till ett kraftfullt och
-innehållsrikt operativsystem som utmanar det som många större arbets-
-stationer har när det gäller kraftfullhet och allmän användbarhet.
-
-
-För mer information om detta system rekommenderas du att beställa
-"4.4BSD Document Set" från O'Reilly Associates och USENIX Association,
-ISBN 1-56592-082-1. Vi har inget samarbete med O'Reilly, vi är bara
-nöjda kunder!
-
-
-Du kan också vilja läsa den hårdvaruguide som finns *innan* du fortsätter
-installationen. Att konfigurera PC-hårdvara för någonting annat än DOS/Windows
-(som egentligen inte ställer så höga krav på hårdvaran) är faktiskt svårare
-än det ser ut att vara. Om du tror du förstår dig på PC:ar har du uppenbarligen
-inte använt dem tillräckligt länge! :) Guiden ger dig en del tips om hur du
-skall konfigurera din hårdvara och de symptom du skall vara uppmärksam på
-om du får problem. Den finns tillgänglig under menyn "Documentation" som
-finns på FreeBSD-startdisketten.
-
-
-OBSERVERA: FreeBSD gör sitt bästa för att du inte skall förlora någon
-information, men det är möjligt att RADERA HELA HÅRDDISKEN med denna
-installation! Fortsätt inte till sista FreeBSD-installationsmenyn om du
-inte har någon säkerhetskopia på all din väsentliga information! Vi menar
-det verkligen!
-
-
-Tekniska kommentarer om denna version sänds (på engelska!) till:
-
-
- hackers@FreeBSD.org
-
-
-Felrapporter bör sändas med hjälp av kommandot 'send-pr' om du lyckats
-installera systemet, i annat fall till:
-
- bugs@FreeBSD.org
-
-Var noga med att uppge VILKEN VERSION av FreeBSD du kör i alla felrapporter!
-
-
-Allmänna frågor bör sändas till:
-
- questions@FreeBSD.org
-
-
-Var tålmodig om dina frågor inte besvaras omgående - detta är en hektisk
-tid för oss, och våra frivilliga tillgångar är ofta belastade till
-bristningsgränsen! Felrapporter som skickas med kommandot send-pr
-loggas och registreras i vår feldatabas, och du hålls informerad om alla
-förändringar som sker under felets livstid (eller, om du kommer med
-förslag på förbättringar, hur dessa utvecklas).
-
-
-Vår WEB-server, http://www.freebsd.org, är en bra källa för uppdaterad
-information och tillhandahåller ett antal advancerade dokumentations-
-finesser. Du kan använda den version av Netscape som finns för BSDI för
-att orientera dig runt i World Wide Web direkt under FreeBSD.
-
-
-Du kan även vilja ta en titt i /usr/share/FAQ och /usr/share/doc för mer
-information om systemet.
-
-
-Tack för att du tog dig tid för att läsa detta, och vi hoppas verkligen att
-du uppskattar denna release av FreeBSD!
-
-
-
- Jordan Hubbard,
- för The FreeBSD Project
diff --git a/release/sysinstall/help/sv_SE.ISO8859-1/configure.hlp b/release/sysinstall/help/sv_SE.ISO8859-1/configure.hlp
deleted file mode 100644
index ee64008..0000000
--- a/release/sysinstall/help/sv_SE.ISO8859-1/configure.hlp
+++ /dev/null
@@ -1,15 +0,0 @@
-I denna meny konfigurerar du systemet efter installationen. Du bör
-åtminstone sätta ett lösenord för root och ändra till rätt tidszon.
-
-För extra tillval såsom bash, emacs, pascal med flera vill du nog titta på
-valet "Packages" i denna meny. Observera att detta val ännu så länge endast
-ger något om du har ett CDROM eller samlingen av programpaket någonstans
-på hårddisken där packages-hanteraren kan hitta den. Automatisk hämtning av
-packages via FTP stöds ännu så länge inte!
-
-
-Om du vill starta package-installeraren efter systeminstallationen
-kan du använda kommandot ``pkg_manage''. För att ändra tidszon
-använder du kommandot ``tzsetup''.
-För mer information om systemkonfiguration hänvisas du till filen
-``/etc/sysconfig''.
diff --git a/release/sysinstall/help/sv_SE.ISO8859-1/language.hlp b/release/sysinstall/help/sv_SE.ISO8859-1/language.hlp
deleted file mode 100644
index 3cadc5f..0000000
--- a/release/sysinstall/help/sv_SE.ISO8859-1/language.hlp
+++ /dev/null
@@ -1,14 +0,0 @@
-Använd denna meny för att välja språk. För närvarande ändrar detta
-endast det språk som används i hjälptexterna.
-
-I senare versioner kommer detta även att ändra tangentbordslayouten,
-skärmens teckenuppsättning, NLS-inställningarna (själva sysinstall
-kommer att använda meddelandekataloger så att alla menyer blir
-i det språk du valt) och ändra andra I18N-finesser för att uppfylla
-olika konventioner.
-
-
-Innan dessa förbättringar är gjorda kanske du föredrar att ändra i
-filen /etc/sysconfig för hand när systemet är installerat.
-I filen finns det gott om kommentarer som beskriver vad du skall ändra,
-inklusive några exempel på icke-engelska inställningar.
diff --git a/release/sysinstall/help/sv_SE.ISO8859-1/usage.hlp b/release/sysinstall/help/sv_SE.ISO8859-1/usage.hlp
deleted file mode 100644
index 1f544b9..0000000
--- a/release/sysinstall/help/sv_SE.ISO8859-1/usage.hlp
+++ /dev/null
@@ -1,49 +0,0 @@
-HUR DU ANVÄNDER DETTA SYSTEM
-============================
-
-TANGENT FUNKTION
-------- --------
-PIL UPPÅT Flytta till föregående rad (eller uppåt i ett textfält).
-PIL NEDÅT Flytta till nästa rad (eller nedåt i ett textfält).
-TAB Flytta till nästa fält.
-PIL HÖGER Flytta till nästa fält (samma som TAB).
-SHIFT-TAB Flytta till föregående fält.
-PIL VÄNSTER Flytta till föregående fält (samma som SHIFT-TAB).
-RETURN Markera rad eller utför handling.
-PAGE UP Flyttar upp texten en sida i textfält.
-PAGE DOWN Flyttar ner texten en sida i textfält.
-MELLANSLAG Markera/avmarkera gällande val i flervalsmenyer.
-F1 Hjälp (på de skärmbilder som tillhandahåller det).
-
-Om du ser symbolerna "^(-)" eller "v(+)" vid kanten av en meny, betyder
-det att det finns fler val ovanför eller under de val du just ser, som inte
-visas (på grund av de inte ryms på skärmen). Med hjälp av pil uppåt eller nedåt
-kan du rulla fram dessa val. När en symbol försvinner innebär det att du
-befinner dig längst upp eller ner på en meny.
-
-I ett textfält visas storleken av den återstående texten procentuellt
-i det nedre högra hörnet. 100% innebär att du är vid slutet av texten.
-
-Välj "OK" för att bekräfta menyvalen.
-"Avbryt" för dig normalt tillbaka till föregående meny.
-
-
-ADVANCERADE FUNKTIONER:
-=======================
-
-Det är möjligt att flytta till ett val genom att skriva dess första tecken
-om detta är unikt. Sådana snabbval är markerade i texten.
-
-Skärmdrivrutinen innehåller ett minne för text som har rullat förbi
-på skärmen. För att återse trycker du på "Scroll Lock"-tangenten och
-använder piltangenterna och Page Up/Page Down för att förflytta dig i
-texten. För att sluta återse trycker du på "Scroll Lock"-tangenten igen.
-Denna funktion är till störst nytta när du använder en kommandotolk
-eller någon annat "expertläge".
-
-När systemet är färdiginstallerat och igång kommer du att kunna byta
-mellan flera "virtuella skärmar". På så sätt kan du ha flera sessioner
-öppna samtidigt. Använd ALT-F<n> för att byta mellan dem.
-Från början finns det fyra sessioner att byta mellan. När systemet till
-slut är uppe kan du ändra det genom att editera filen /etc/ttys.
-Maximalt antal virtuella skärmar är 12.
diff --git a/release/sysinstall/help/sv_SE.ISO_8859-1/README b/release/sysinstall/help/sv_SE.ISO_8859-1/README
deleted file mode 100644
index c6761e8..0000000
--- a/release/sysinstall/help/sv_SE.ISO_8859-1/README
+++ /dev/null
@@ -1,114 +0,0 @@
-
- -----------------------------------------
- FreeBSD 2.0.5 --- RELEASE Version , ,
- ----------------------------------------- /( )`
- \ \___ / |
-Välkommen till FreeBSD version 2.0.5! Denna version /- _ `-/ '
-är en fyllnadsrelease av FreeBSD som täcker upp det (/\/ \ \ /\
-tomrum som bildats mellan 2.0R (som släpptes i / / | ` \
-November '94) och 2.1R, som kommer att släppas O O ) / |
-i slutet av Juli '95. FreeBSD 2.0.5 innehåller `-^--'`< '
-många betydande förbättringar gentemot 2.0R, (_.) _ ) /
-bland annat mycket bättre stabilitet, ett `.___/` /
-dussintal nya finesser och ett förbättrat `-----' /
-installationsprogram. Läs de "release <----. __ / __ \
-notes" som finns för fler detaljer om <----|====O)))==) \) /====
-vad som är nytt i 2.0.5! <----' `--' `.__,' \
- | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-Vad är FreeBSD? FreeBSD är ett operativsystem för Intel, AMD, Cyrix och
-NexGen "x86"-baserad PC-hårdvara. FreeBSD är baserat på 4.4 BSD Lite.
-Det fungerar med en stor mängd olika tillbehör och konfigurationer och
-kan användas för allt från mjukvaruutveckling till att tillhandahålla
-Internet-tjänster; det mest använda systemet på Internet, ftp.cdrom.com, är
-en FreeBSD-maskin!
-
-Denna version av FreeBSD innehåller allt du behöver för att köra ett
-sådant system. Fullständig källkod till allting ingår också.
-Med källkodsdistributionen installerad kan du bokstavligt talat kompilera
-om hela systemet från början med ett enda kommando. Detta gör FreeBSD
-perfekt för studenter, forskare och de som helt enkelt vill undersöka
-hur saker fungerar.
-
-
-En stor samling av programvara anpassad till FreeBSD av olika personer
-("the ports collection") följer också med. Mer än 270 programpaket
-innehållande allt från editorer till programspråk och grafikverktyg,
-detta underlättar för dig att installera alla dina favoritprogram
-under unix för FreeBSD. Detta gör FreeBSD till ett kraftfullt och
-innehållsrikt operativsystem som utmanar det som många större arbets-
-stationer har när det gäller kraftfullhet och allmän användbarhet.
-
-
-För mer information om detta system rekommenderas du att beställa
-"4.4BSD Document Set" från O'Reilly Associates och USENIX Association,
-ISBN 1-56592-082-1. Vi har inget samarbete med O'Reilly, vi är bara
-nöjda kunder!
-
-
-Du kan också vilja läsa den hårdvaruguide som finns *innan* du fortsätter
-installationen. Att konfigurera PC-hårdvara för någonting annat än DOS/Windows
-(som egentligen inte ställer så höga krav på hårdvaran) är faktiskt svårare
-än det ser ut att vara. Om du tror du förstår dig på PC:ar har du uppenbarligen
-inte använt dem tillräckligt länge! :) Guiden ger dig en del tips om hur du
-skall konfigurera din hårdvara och de symptom du skall vara uppmärksam på
-om du får problem. Den finns tillgänglig under menyn "Documentation" som
-finns på FreeBSD-startdisketten.
-
-
-OBSERVERA: FreeBSD gör sitt bästa för att du inte skall förlora någon
-information, men det är möjligt att RADERA HELA HÅRDDISKEN med denna
-installation! Fortsätt inte till sista FreeBSD-installationsmenyn om du
-inte har någon säkerhetskopia på all din väsentliga information! Vi menar
-det verkligen!
-
-
-Tekniska kommentarer om denna version sänds (på engelska!) till:
-
-
- hackers@FreeBSD.org
-
-
-Felrapporter bör sändas med hjälp av kommandot 'send-pr' om du lyckats
-installera systemet, i annat fall till:
-
- bugs@FreeBSD.org
-
-Var noga med att uppge VILKEN VERSION av FreeBSD du kör i alla felrapporter!
-
-
-Allmänna frågor bör sändas till:
-
- questions@FreeBSD.org
-
-
-Var tålmodig om dina frågor inte besvaras omgående - detta är en hektisk
-tid för oss, och våra frivilliga tillgångar är ofta belastade till
-bristningsgränsen! Felrapporter som skickas med kommandot send-pr
-loggas och registreras i vår feldatabas, och du hålls informerad om alla
-förändringar som sker under felets livstid (eller, om du kommer med
-förslag på förbättringar, hur dessa utvecklas).
-
-
-Vår WEB-server, http://www.freebsd.org, är en bra källa för uppdaterad
-information och tillhandahåller ett antal advancerade dokumentations-
-finesser. Du kan använda den version av Netscape som finns för BSDI för
-att orientera dig runt i World Wide Web direkt under FreeBSD.
-
-
-Du kan även vilja ta en titt i /usr/share/FAQ och /usr/share/doc för mer
-information om systemet.
-
-
-Tack för att du tog dig tid för att läsa detta, och vi hoppas verkligen att
-du uppskattar denna release av FreeBSD!
-
-
-
- Jordan Hubbard,
- för The FreeBSD Project
diff --git a/release/sysinstall/help/sv_SE.ISO_8859-1/configure.hlp b/release/sysinstall/help/sv_SE.ISO_8859-1/configure.hlp
deleted file mode 100644
index ee64008..0000000
--- a/release/sysinstall/help/sv_SE.ISO_8859-1/configure.hlp
+++ /dev/null
@@ -1,15 +0,0 @@
-I denna meny konfigurerar du systemet efter installationen. Du bör
-åtminstone sätta ett lösenord för root och ändra till rätt tidszon.
-
-För extra tillval såsom bash, emacs, pascal med flera vill du nog titta på
-valet "Packages" i denna meny. Observera att detta val ännu så länge endast
-ger något om du har ett CDROM eller samlingen av programpaket någonstans
-på hårddisken där packages-hanteraren kan hitta den. Automatisk hämtning av
-packages via FTP stöds ännu så länge inte!
-
-
-Om du vill starta package-installeraren efter systeminstallationen
-kan du använda kommandot ``pkg_manage''. För att ändra tidszon
-använder du kommandot ``tzsetup''.
-För mer information om systemkonfiguration hänvisas du till filen
-``/etc/sysconfig''.
diff --git a/release/sysinstall/help/sv_SE.ISO_8859-1/language.hlp b/release/sysinstall/help/sv_SE.ISO_8859-1/language.hlp
deleted file mode 100644
index 3cadc5f..0000000
--- a/release/sysinstall/help/sv_SE.ISO_8859-1/language.hlp
+++ /dev/null
@@ -1,14 +0,0 @@
-Använd denna meny för att välja språk. För närvarande ändrar detta
-endast det språk som används i hjälptexterna.
-
-I senare versioner kommer detta även att ändra tangentbordslayouten,
-skärmens teckenuppsättning, NLS-inställningarna (själva sysinstall
-kommer att använda meddelandekataloger så att alla menyer blir
-i det språk du valt) och ändra andra I18N-finesser för att uppfylla
-olika konventioner.
-
-
-Innan dessa förbättringar är gjorda kanske du föredrar att ändra i
-filen /etc/sysconfig för hand när systemet är installerat.
-I filen finns det gott om kommentarer som beskriver vad du skall ändra,
-inklusive några exempel på icke-engelska inställningar.
diff --git a/release/sysinstall/help/sv_SE.ISO_8859-1/usage.hlp b/release/sysinstall/help/sv_SE.ISO_8859-1/usage.hlp
deleted file mode 100644
index 1f544b9..0000000
--- a/release/sysinstall/help/sv_SE.ISO_8859-1/usage.hlp
+++ /dev/null
@@ -1,49 +0,0 @@
-HUR DU ANVÄNDER DETTA SYSTEM
-============================
-
-TANGENT FUNKTION
-------- --------
-PIL UPPÅT Flytta till föregående rad (eller uppåt i ett textfält).
-PIL NEDÅT Flytta till nästa rad (eller nedåt i ett textfält).
-TAB Flytta till nästa fält.
-PIL HÖGER Flytta till nästa fält (samma som TAB).
-SHIFT-TAB Flytta till föregående fält.
-PIL VÄNSTER Flytta till föregående fält (samma som SHIFT-TAB).
-RETURN Markera rad eller utför handling.
-PAGE UP Flyttar upp texten en sida i textfält.
-PAGE DOWN Flyttar ner texten en sida i textfält.
-MELLANSLAG Markera/avmarkera gällande val i flervalsmenyer.
-F1 Hjälp (på de skärmbilder som tillhandahåller det).
-
-Om du ser symbolerna "^(-)" eller "v(+)" vid kanten av en meny, betyder
-det att det finns fler val ovanför eller under de val du just ser, som inte
-visas (på grund av de inte ryms på skärmen). Med hjälp av pil uppåt eller nedåt
-kan du rulla fram dessa val. När en symbol försvinner innebär det att du
-befinner dig längst upp eller ner på en meny.
-
-I ett textfält visas storleken av den återstående texten procentuellt
-i det nedre högra hörnet. 100% innebär att du är vid slutet av texten.
-
-Välj "OK" för att bekräfta menyvalen.
-"Avbryt" för dig normalt tillbaka till föregående meny.
-
-
-ADVANCERADE FUNKTIONER:
-=======================
-
-Det är möjligt att flytta till ett val genom att skriva dess första tecken
-om detta är unikt. Sådana snabbval är markerade i texten.
-
-Skärmdrivrutinen innehåller ett minne för text som har rullat förbi
-på skärmen. För att återse trycker du på "Scroll Lock"-tangenten och
-använder piltangenterna och Page Up/Page Down för att förflytta dig i
-texten. För att sluta återse trycker du på "Scroll Lock"-tangenten igen.
-Denna funktion är till störst nytta när du använder en kommandotolk
-eller någon annat "expertläge".
-
-När systemet är färdiginstallerat och igång kommer du att kunna byta
-mellan flera "virtuella skärmar". På så sätt kan du ha flera sessioner
-öppna samtidigt. Använd ALT-F<n> för att byta mellan dem.
-Från början finns det fyra sessioner att byta mellan. När systemet till
-slut är uppe kan du ändra det genom att editera filen /etc/ttys.
-Maximalt antal virtuella skärmar är 12.
diff --git a/sbin/bsdlabel/disklabel.5.5 b/sbin/bsdlabel/disklabel.5.5
deleted file mode 100644
index fb6f6cd..0000000
--- a/sbin/bsdlabel/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/Makefile b/sbin/fastboot/Makefile
deleted file mode 100644
index 1bd7949..0000000
--- a/sbin/fastboot/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/5/93
-
-MAN8= fastboot.8
-MLINKS= fastboot.8 fasthalt.8
-
-beforeinstall:
- install -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
- ${.CURDIR}/fastboot.sh ${DESTDIR}${BINDIR}/fastboot
- install -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
- ${.CURDIR}/fasthalt.sh ${DESTDIR}${BINDIR}/fasthalt
-
-.include <bsd.prog.mk>
diff --git a/sbin/fastboot/fastboot.sh b/sbin/fastboot/fastboot.sh
deleted file mode 100644
index 6d36f4e..0000000
--- a/sbin/fastboot/fastboot.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh -
-#
-# 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.
-#
-# @(#)fastboot.sh 8.1 (Berkeley) 6/5/93
-#
-
-cp /dev/null /fastboot
-exec /sbin/reboot $*
diff --git a/sbin/fastboot/fasthalt.sh b/sbin/fastboot/fasthalt.sh
deleted file mode 100644
index fce66e1..0000000
--- a/sbin/fastboot/fasthalt.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh -
-#
-# 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.
-#
-# @(#)fasthalt.sh 8.1 (Berkeley) 6/5/93
-#
-
-cp /dev/null /fastboot
-exec /sbin/halt $*
diff --git a/sbin/ft/Makefile b/sbin/ft/Makefile
deleted file mode 100644
index 6166c08..0000000
--- a/sbin/ft/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id: Makefile,v 1.2 1994/02/07 08:40:16 rgrimes Exp $
-
-PROG= ft
-MAN8= ft.8
-SRCS= ft.c ftecc.c
-COPTS= -O2 -finline-functions -funroll-loops -fexpensive-optimizations
-
-.include <bsd.prog.mk>
diff --git a/sbin/ft/ft.8 b/sbin/ft/ft.8
deleted file mode 100644
index 962001e..0000000
--- a/sbin/ft/ft.8
+++ /dev/null
@@ -1,86 +0,0 @@
-.\" Copyright (c) 1980, 1989, 1991 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.
-.\"
-.\" @(#)ft.8
-.\"
-.Dd February 7, 1994
-.Dt FT 8
-.Os BSD 4
-.Sh NAME
-.Nm ft
-.Nd QIC 40/80 floppy tape drive controller
-.Sh SYNOPSIS
-.Nm ft
-.Op Fl f Ar tape
-.Op Ar description
-.Sh DESCRIPTION
-The
-.Nm ft
-command allows multi-volume dump, extract, and view of tape labels, for
-any pre-formatted QIC-40/80 tapes. It is totally system dependent,
-and has nothing to do with the QIC standards.
-.Pp
-.Nm ft
-is used primarily as a filter for tape i/o.
-For example, to save and compress the /usr directory to tape:
-.Bd -literal -offset indent
-% tar cvzf - /usr | ft "/usr save"
-.Ed
-.Pp
-To extract /usr from tape:
-.Bd -literal -offset indent
-% ft | tar xvzf -
-.Ed
-.\" .Sh SEE ALSO
-.\" .Xr qtar 1
-.Sh BUGS
-Formatting/Verifying is in the works. You will need to use your
-existing backup program to do this for the time being.
-.Sh NOTES
-The floppy tape driver supports tape drives such as the Colorado
-Jumbo, Mountain Summit Express, some Archive/Conner models, and
-probably many others. These tape drives attach between your floppy
-disk controller card and your existing floppy disks' ribbon cable.
-This driver does not currently support attachments via a proprietary
-tape controller card or by the parallel port.
-.Pp
-QIC-40/80 drives are more CPU intensive than a SCSI drive. This is
-really only a factor if your machine is networked or has multiple concurrent
-users. For personal use (i.e. your typical home Unix user), response time
-is perfectly acceptable. The tape drives cannot detect write errors.
-Instead, they make up for it by using CRC's, error correction, and bad
-spot mapping. Formatting time is extremely long because of this. The
-drive makes a first pass over the entire tape writing out sectors. It
-then makes a second pass at a slower rate than usual (for sensitivity)
-to detect bad spots on the tape. Typically it takes an hour to format
-a single QIC-80 (120Mb uncompressed) tape.
-.Sh AUTHOR
-Steve Gerakines <steve2@genesis.nred.ma.us>
diff --git a/sbin/ft/ft.c b/sbin/ft/ft.c
deleted file mode 100644
index 49aadd3..0000000
--- a/sbin/ft/ft.c
+++ /dev/null
@@ -1,517 +0,0 @@
-/*
- * Copyright (c) 1993, 1994 Steve Gerakines
- *
- * This is freely redistributable software. You may do anything you
- * wish with it, so long as the above notice stays intact.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * ft.c - simple floppy tape filter
- *
- * 06/07/94 v1.0 ++sg
- * Added support for tape retension. Added retries for ecc failures.
- * Moved to release.
- *
- * 01/28/94 v0.3b (Jim Babb)
- * Fixed bug when all sectors in a segment are marked bad.
- *
- * 10/30/93 v0.3
- * Minor revisions. Seems pretty stable.
- *
- * 09/02/93 v0.2 pl01
- * Initial revision.
- *
- * usage: ft [ -f tape ] [ description ]
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-#include <time.h>
-#include <sys/ftape.h>
-
-#define DEFQIC "/dev/rft0"
-
-char buff[QCV_SEGSIZE]; /* scratch buffer */
-char hbuff[QCV_SEGSIZE]; /* header buffer */
-QIC_Header *hptr = (QIC_Header *)hbuff; /* header structure */
-int hsn = -1; /* segment number of header */
-int dhsn = -1; /* segment number of duplicate header */
-int tfd; /* tape file descriptor */
-QIC_Geom geo; /* tape geometry */
-int tvno = 1; /* tape volume number */
-int tvlast; /* TRUE if last volume in set */
-long tvsize = 0; /* tape volume size in bytes */
-long tvtime = NULL; /* tape change time */
-char *tvnote = ""; /* tape note */
-int doretension = 0; /* TRUE if we should retension tape */
-
-/* Lookup the badmap for a given track and segment. */
-#define BADMAP(t,s) hptr->qh_badmap[(t)*geo.g_segtrk+(s)]
-
-/* Retrieve values from a character array. */
-#define UL_VAL(s,p) (*((ULONG *)&(s)[p]))
-#define US_VAL(s,p) (*((USHORT *)&(s)[p]))
-
-#define equal(s1,s2) (strcmp(s1, s2) == 0)
-
-
-/*
- * Print tape usage and then leave.
- */
-void
-usage(void)
-{
- fprintf(stderr, "usage: ft [ -r ] [ -f device ] [ \"description\" ]\n");
- exit(1);
-}
-
-
-/*
- * Check status of tape drive
- */
-int
-check_stat(int fd, int wr)
-{
- int r, s;
- int sawit = 0;
-
- /* get tape status */
- if (ioctl(fd, QIOSTATUS, &s) < 0) {
- fprintf(stderr, "could not get drive status\n");
- return(1);
- }
-
- /* wait for the tape drive to become ready */
- while ((s & QS_READY) == 0) {
- if (!sawit) {
- fprintf(stderr, "waiting for drive to become ready...\n");
- sawit = 1;
- }
- sleep(2);
- if (ioctl(fd, QIOSTATUS, &s) < 0) {
- fprintf(stderr, "could not get drive status\n");
- return(1);
- }
- }
-
- if ((s & QS_FMTOK) == 0) {
- fprintf(stderr, "tape is not formatted\n");
- return(2);
- }
-
- if (wr && (s & QS_RDONLY) != 0) {
- fprintf(stderr, "tape is write protected\n");
- return(3);
- }
-
- return(0);
-}
-
-
-/*
- * Convert time_t value to QIC time value.
- */
-ULONG
-qtimeval(time_t t)
-{
- struct tm *tp;
- ULONG r;
-
- tp = localtime(&t);
- r = 2678400 * tp->tm_mon +
- 86400 *(tp->tm_mday-1) +
- 3600 * tp->tm_hour +
- 60 * tp->tm_min +
- tp->tm_sec;
- r |= (tp->tm_year - 70) << 25;
- return(r);
-}
-
-
-/*
- * Return tm struct from QIC date format.
- */
-struct tm *
-qtime(UCHAR *qt)
-{
- ULONG *vp = (ULONG *)qt;
- struct tm t;
- ULONG v;
- time_t tv;
-
- v = *vp;
- t.tm_year = ((v >> 25) & 0x7f)+70; v &= 0x1ffffff;
- t.tm_mon = v / 2678400; v %= 2678400;
- t.tm_mday = v / 86400 + 1; v %= 86400;
- t.tm_hour = v / 3600; v %= 3600;
- t.tm_min = v / 60; v %= 60;
- t.tm_sec = v;
- t.tm_wday = 0; /* XXX - let mktime do the real work */
- t.tm_yday = 0;
- t.tm_isdst = 0;
- t.tm_gmtoff = 0;
- t.tm_zone = NULL;
- tv = mktime(&t);
- return(localtime(&tv));
-}
-
-
-/*
- * Return a string, zero terminated.
- */
-char *qstr(char *str, int nchar)
-{
- static char tstr[256];
- strncpy(tstr, str, nchar);
- tstr[nchar] = '\0';
- return(tstr);
-}
-
-
-/*
- * Read header from tape
- */
-int
-get_header(int fd)
-{
- int r, sn, bytes;
- QIC_Segment s;
- int gothdr = 0;
-
- if (ioctl(fd, QIOGEOM, &geo) < 0) {
- fprintf(stderr, "couldn't determine tape geometry\n");
- return(1);
- }
-
- /* Get the header and duplicate */
- for (sn = 0; sn < 16; sn++) {
- s.sg_trk = 0;
- s.sg_seg = sn;
- s.sg_badmap = 0;
- s.sg_data = (UCHAR *)&buff[0];
- ioctl(fd, QIOREAD, &s);
- r = check_parity(s.sg_data, 0, s.sg_crcmap);
- if (s.sg_data[0] == 0x55 && s.sg_data[1] == 0xaa &&
- s.sg_data[2] == 0x55 && s.sg_data[3] == 0xaa) {
- if (hsn >= 0) {
- dhsn = sn;
- if (!r && !gothdr) {
- fprintf(stderr, "using secondary header\n");
- bcopy(s.sg_data, hbuff, QCV_SEGSIZE);
- gothdr = 1;
- }
- break;
- }
- hsn = sn;
- if (!r) {
- bcopy(s.sg_data, hbuff, QCV_SEGSIZE);
- gothdr = 1;
- } else {
- fprintf(stderr, "too many errors in primary header\n");
- }
- }
- }
-
- if (!gothdr) {
- fprintf(stderr, "couldn't read header segment\n");
- ioctl(fd, QIOREWIND);
- return(1);
- }
-
- return(0);
-}
-
-
-/*
- * Open /dev/tty and ask for next volume.
- */
-ask_vol(int vn)
-{
- FILE *inp;
- int fd;
- char c;
-
- if ((fd = open("/dev/tty", 2)) < 0) {
- fprintf(stderr, "argh!! can't open /dev/tty\n");
- exit(1);
- }
-
- fprintf(stderr, "Insert ftfilt volume %02d and press enter:", vn);
- read(fd, &c, 1);
- close(fd);
-}
-
-
-/*
- * Return the name of the tape only.
- */
-void
-do_getname(void)
-{
- if (check_stat(tfd, 0)) exit(1);
- if (get_header(tfd)) exit(1);
- fprintf(stderr, "\"%s\" - %s",
- qstr(hptr->qh_tname,44), asctime(qtime(hptr->qh_chgdate)));
-}
-
-
-/*
- * Extract data from tape to stdout.
- */
-void
-do_read(void)
-{
- int sno, vno, sbytes, r, eccfails;
- long curpos;
- char *hname;
- QIC_Segment s;
-
- /* Process multiple volumes if necessary */
- vno = 1;
- for (;;) {
- if (check_stat(tfd, 0)) {
- ask_vol(vno);
- continue;
- }
-
- if (doretension) {
- ioctl(tfd, QIOBOT);
- ioctl(tfd, QIOEOT);
- ioctl(tfd, QIOBOT);
- }
-
- if (get_header(tfd)) {
- ask_vol(vno);
- continue;
- }
-
- /* extract volume and header info from label */
- hname = hptr->qh_tname;
- hname[43] = '\0';
- tvno = atoi(&hname[11]);
- tvlast = (hname[10] == '*') ? 1 : 0;
- tvsize = atoi(&hname[14]);
- tvnote = &hname[25];
- if (vno != tvno || strncmp(hname, "ftfilt", 6) != 0) {
- fprintf(stderr, "Incorrect volume inserted. This tape is:\n");
- fprintf(stderr,"\"%s\" - %s\n", hname,
- asctime(qtime(hptr->qh_chgdate)));
- ask_vol(vno);
- continue;
- }
-
- /* Process this volume */
- curpos = 0;
- eccfails = 0;
- sno = hptr->qh_first;
- while (tvsize > 0) {
- s.sg_trk = sno / geo.g_segtrk;
- s.sg_seg = sno % geo.g_segtrk;
- s.sg_badmap = BADMAP(s.sg_trk,s.sg_seg);
- sbytes = sect_bytes(s.sg_badmap) - QCV_ECCSIZE;
- s.sg_data = (UCHAR *)&buff[0];
- if (sbytes <= 0) {
- sno++;
- continue;
- }
- if (ioctl(tfd, QIOREAD, &s) < 0) perror("QIOREAD");
-
- if (check_parity(s.sg_data, s.sg_badmap, s.sg_crcmap)) {
- if (++eccfails <= 5) {
- fprintf(stderr,
- "ft: retry %d at segment %d byte %ld\n",
- eccfails, sno, curpos);
- continue;
- } else
- fprintf(stderr,
- "ft: *** ecc failure in segment %d at byte %ld\n",
- sno, curpos);
- }
- if (tvsize < sbytes) sbytes = tvsize;
- write(1, s.sg_data, sbytes);
- tvsize -= sbytes;
- curpos += sbytes;
- sno++;
- eccfails = 0;
- }
- if (tvlast) break;
- ioctl(tfd, QIOREWIND);
- ask_vol(++vno);
- }
-}
-
-
-/*
- * Dump data from stdin to tape.
- */
-void
-do_write(void)
-{
- int sno, vno, amt, sbytes;
- int c, maxseg, r;
- ULONG qnow;
- QIC_Segment s;
- char tmpstr[80];
-
- qnow = qtimeval(time(NULL));
- vno = 1;
-
- for (;;) {
- if (check_stat(tfd, 1)) {
- ask_vol(vno);
- continue;
- }
-
- if (doretension) {
- ioctl(tfd, QIOBOT);
- ioctl(tfd, QIOEOT);
- ioctl(tfd, QIOBOT);
- }
-
- if (get_header(tfd)) {
- ask_vol(vno);
- continue;
- }
-
- maxseg = geo.g_segtrk * geo.g_trktape - 1;
- sno = hptr->qh_first;
- tvno = vno;
- tvsize = 0;
- tvlast = 0;
-
- /* Process until end of volume or end of data */
- for (sno = hptr->qh_first; sno < maxseg && tvlast == 0; ++sno) {
- /* Prepare to load the next segment */
- s.sg_trk = sno / geo.g_segtrk;
- s.sg_seg = sno % geo.g_segtrk;
- s.sg_badmap = BADMAP(s.sg_trk,s.sg_seg);
- sbytes = sect_bytes(s.sg_badmap) - QCV_ECCSIZE;
- s.sg_data = (UCHAR *)&buff[0];
-
- /* Ugh. Loop to get the full amt. */
- for (amt = 0; amt < sbytes; amt += r) {
- r = read(0, &s.sg_data[amt], sbytes - amt);
- if (r <= 0) {
- tvlast = 1;
- break;
- }
- }
-
- /* skip the segment if *all* sectors are flagged as bad */
- if (amt) {
- if (amt < sbytes)
- bzero(&s.sg_data[amt], sbytes - amt);
- r = set_parity(s.sg_data, s.sg_badmap);
- if (r) fprintf(stderr, "** warning: ecc problem !!\n");
- if (ioctl(tfd, QIOWRITE, &s) < 0) {
- perror("QIOWRITE");
- exit(1);
- }
- tvsize += amt;
- }
- }
-
- /* Build new header info */
- /* ftfilt vol*xx yyyyyyyyyy note56789012345678 */
- /* 01234567890123456789012345678901234567890123 */
-
- sprintf(tmpstr, "ftfilt vol%s%02d %010d %s",
- (tvlast) ? "*" : " ", tvno, tvsize, tvnote);
- strncpy(hptr->qh_tname, tmpstr, 44);
- UL_VAL(hptr->qh_chgdate,0) = qnow;
-
- /* Update the header for this volume */
- if (hsn >= 0) {
- s.sg_trk = hsn / geo.g_segtrk;
- s.sg_seg = hsn % geo.g_segtrk;
- s.sg_badmap = 0;
- s.sg_data = (UCHAR *)hbuff;
- r = set_parity(s.sg_data, s.sg_badmap);
- if (r) fprintf(stderr, "** warning: header ecc problem !!\n");
- if (ioctl(tfd, QIOWRITE, &s) < 0) {
- perror("QIOWRITE");
- exit(1);
- }
- }
- if (dhsn >= 0) {
- s.sg_trk = dhsn / geo.g_segtrk;
- s.sg_seg = dhsn % geo.g_segtrk;
- s.sg_badmap = 0;
- s.sg_data = (UCHAR *)hbuff;
- r = set_parity(s.sg_data, s.sg_badmap);
- if (r) fprintf(stderr, "** warning: duphdr ecc problem !!\n");
- if (ioctl(tfd, QIOWRITE, &s) < 0) {
- perror("QIOWRITE");
- exit(1);
- }
- }
- ioctl(tfd, QIOREWIND);
- if (tvlast) break;
- ask_vol(++vno);
- }
-}
-
-
-/*
- * Entry.
- */
-void
-main(int argc, char *argv[])
-{
- int r, s, i;
- char *tape, *getenv();
-
-
- /* Get device from environment, command line will override. */
- if ((tape = getenv("TAPE")) == NULL) tape = DEFQIC;
-
- /* Process args. */
- for (i = 1; i < argc; i++) {
- if (argv[i][0] != '-') break;
- switch (argv[i][1]) {
- case 'f':
- case 't':
- if (i == (argc - 1)) usage();
- tape = argv[++i];
- break;
- case 'r':
- doretension = 1;
- break;
- default:
- usage();
- }
- }
- if (i < (argc - 1)) usage();
- if (i < argc) {
- tvnote = argv[i];
- if (strlen(tvnote) > 18) argv[i][18] = '\0';
- }
-
- /* Open the tape device */
- if ((tfd = open(tape, 2)) < 0) {
- perror(tape);
- exit(1);
- }
-
- if (!isatty(0))
- do_write();
- else if (!isatty(1))
- do_read();
- else
- do_getname();
-
- close(tfd);
- exit(0);
-}
diff --git a/sbin/ft/ftecc.c b/sbin/ft/ftecc.c
deleted file mode 100644
index fbba10f..0000000
--- a/sbin/ft/ftecc.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/*
- * Copyright (c) 1994 Steve Gerakines
- *
- * This is freely redistributable software. You may do anything you
- * wish with it, so long as the above notice stays intact.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * ftecc.c - QIC-40/80 Reed-Solomon error correction
- * 05/30/94 v1.0 ++sg
- * Did some minor optimization. The multiply by 0xc0 was a dog so it
- * was replaced with a table lookup. Fixed a couple of places where
- * bad sectors could go unnoticed. Moved to release.
- *
- * 03/22/94 v0.4
- * Major re-write. It can handle everything required by QIC now.
- *
- * 09/14/93 v0.2 pl01
- * Modified slightly to fit with my driver. Based entirely upon David
- * L. Brown's package.
- */
-#include <sys/ftape.h>
-
-/* Inverse matrix */
-struct inv_mat {
- UCHAR log_denom; /* Log of the denominator */
- UCHAR zs[3][3]; /* The matrix */
-};
-
-
-/*
- * Powers of x, modulo 255.
- */
-static UCHAR alpha_power[] = {
- 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
- 0x87, 0x89, 0x95, 0xad, 0xdd, 0x3d, 0x7a, 0xf4,
- 0x6f, 0xde, 0x3b, 0x76, 0xec, 0x5f, 0xbe, 0xfb,
- 0x71, 0xe2, 0x43, 0x86, 0x8b, 0x91, 0xa5, 0xcd,
- 0x1d, 0x3a, 0x74, 0xe8, 0x57, 0xae, 0xdb, 0x31,
- 0x62, 0xc4, 0x0f, 0x1e, 0x3c, 0x78, 0xf0, 0x67,
- 0xce, 0x1b, 0x36, 0x6c, 0xd8, 0x37, 0x6e, 0xdc,
- 0x3f, 0x7e, 0xfc, 0x7f, 0xfe, 0x7b, 0xf6, 0x6b,
- 0xd6, 0x2b, 0x56, 0xac, 0xdf, 0x39, 0x72, 0xe4,
- 0x4f, 0x9e, 0xbb, 0xf1, 0x65, 0xca, 0x13, 0x26,
- 0x4c, 0x98, 0xb7, 0xe9, 0x55, 0xaa, 0xd3, 0x21,
- 0x42, 0x84, 0x8f, 0x99, 0xb5, 0xed, 0x5d, 0xba,
- 0xf3, 0x61, 0xc2, 0x03, 0x06, 0x0c, 0x18, 0x30,
- 0x60, 0xc0, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0,
- 0x47, 0x8e, 0x9b, 0xb1, 0xe5, 0x4d, 0x9a, 0xb3,
- 0xe1, 0x45, 0x8a, 0x93, 0xa1, 0xc5, 0x0d, 0x1a,
- 0x34, 0x68, 0xd0, 0x27, 0x4e, 0x9c, 0xbf, 0xf9,
- 0x75, 0xea, 0x53, 0xa6, 0xcb, 0x11, 0x22, 0x44,
- 0x88, 0x97, 0xa9, 0xd5, 0x2d, 0x5a, 0xb4, 0xef,
- 0x59, 0xb2, 0xe3, 0x41, 0x82, 0x83, 0x81, 0x85,
- 0x8d, 0x9d, 0xbd, 0xfd, 0x7d, 0xfa, 0x73, 0xe6,
- 0x4b, 0x96, 0xab, 0xd1, 0x25, 0x4a, 0x94, 0xaf,
- 0xd9, 0x35, 0x6a, 0xd4, 0x2f, 0x5e, 0xbc, 0xff,
- 0x79, 0xf2, 0x63, 0xc6, 0x0b, 0x16, 0x2c, 0x58,
- 0xb0, 0xe7, 0x49, 0x92, 0xa3, 0xc1, 0x05, 0x0a,
- 0x14, 0x28, 0x50, 0xa0, 0xc7, 0x09, 0x12, 0x24,
- 0x48, 0x90, 0xa7, 0xc9, 0x15, 0x2a, 0x54, 0xa8,
- 0xd7, 0x29, 0x52, 0xa4, 0xcf, 0x19, 0x32, 0x64,
- 0xc8, 0x17, 0x2e, 0x5c, 0xb8, 0xf7, 0x69, 0xd2,
- 0x23, 0x46, 0x8c, 0x9f, 0xb9, 0xf5, 0x6d, 0xda,
- 0x33, 0x66, 0xcc, 0x1f, 0x3e, 0x7c, 0xf8, 0x77,
- 0xee, 0x5b, 0xb6, 0xeb, 0x51, 0xa2, 0xc3, 0x01
-};
-
-
-/*
- * Log table, modulo 255 + 1.
- */
-static UCHAR alpha_log[] = {
- 0xff, 0x00, 0x01, 0x63, 0x02, 0xc6, 0x64, 0x6a,
- 0x03, 0xcd, 0xc7, 0xbc, 0x65, 0x7e, 0x6b, 0x2a,
- 0x04, 0x8d, 0xce, 0x4e, 0xc8, 0xd4, 0xbd, 0xe1,
- 0x66, 0xdd, 0x7f, 0x31, 0x6c, 0x20, 0x2b, 0xf3,
- 0x05, 0x57, 0x8e, 0xe8, 0xcf, 0xac, 0x4f, 0x83,
- 0xc9, 0xd9, 0xd5, 0x41, 0xbe, 0x94, 0xe2, 0xb4,
- 0x67, 0x27, 0xde, 0xf0, 0x80, 0xb1, 0x32, 0x35,
- 0x6d, 0x45, 0x21, 0x12, 0x2c, 0x0d, 0xf4, 0x38,
- 0x06, 0x9b, 0x58, 0x1a, 0x8f, 0x79, 0xe9, 0x70,
- 0xd0, 0xc2, 0xad, 0xa8, 0x50, 0x75, 0x84, 0x48,
- 0xca, 0xfc, 0xda, 0x8a, 0xd6, 0x54, 0x42, 0x24,
- 0xbf, 0x98, 0x95, 0xf9, 0xe3, 0x5e, 0xb5, 0x15,
- 0x68, 0x61, 0x28, 0xba, 0xdf, 0x4c, 0xf1, 0x2f,
- 0x81, 0xe6, 0xb2, 0x3f, 0x33, 0xee, 0x36, 0x10,
- 0x6e, 0x18, 0x46, 0xa6, 0x22, 0x88, 0x13, 0xf7,
- 0x2d, 0xb8, 0x0e, 0x3d, 0xf5, 0xa4, 0x39, 0x3b,
- 0x07, 0x9e, 0x9c, 0x9d, 0x59, 0x9f, 0x1b, 0x08,
- 0x90, 0x09, 0x7a, 0x1c, 0xea, 0xa0, 0x71, 0x5a,
- 0xd1, 0x1d, 0xc3, 0x7b, 0xae, 0x0a, 0xa9, 0x91,
- 0x51, 0x5b, 0x76, 0x72, 0x85, 0xa1, 0x49, 0xeb,
- 0xcb, 0x7c, 0xfd, 0xc4, 0xdb, 0x1e, 0x8b, 0xd2,
- 0xd7, 0x92, 0x55, 0xaa, 0x43, 0x0b, 0x25, 0xaf,
- 0xc0, 0x73, 0x99, 0x77, 0x96, 0x5c, 0xfa, 0x52,
- 0xe4, 0xec, 0x5f, 0x4a, 0xb6, 0xa2, 0x16, 0x86,
- 0x69, 0xc5, 0x62, 0xfe, 0x29, 0x7d, 0xbb, 0xcc,
- 0xe0, 0xd3, 0x4d, 0x8c, 0xf2, 0x1f, 0x30, 0xdc,
- 0x82, 0xab, 0xe7, 0x56, 0xb3, 0x93, 0x40, 0xd8,
- 0x34, 0xb0, 0xef, 0x26, 0x37, 0x0c, 0x11, 0x44,
- 0x6f, 0x78, 0x19, 0x9a, 0x47, 0x74, 0xa7, 0xc1,
- 0x23, 0x53, 0x89, 0xfb, 0x14, 0x5d, 0xf8, 0x97,
- 0x2e, 0x4b, 0xb9, 0x60, 0x0f, 0xed, 0x3e, 0xe5,
- 0xf6, 0x87, 0xa5, 0x17, 0x3a, 0xa3, 0x3c, 0xb7
-};
-
-
-/*
- * Multiplication table for 0xc0.
- */
-static UCHAR mult_c0[] = {
- 0x00, 0xc0, 0x07, 0xc7, 0x0e, 0xce, 0x09, 0xc9,
- 0x1c, 0xdc, 0x1b, 0xdb, 0x12, 0xd2, 0x15, 0xd5,
- 0x38, 0xf8, 0x3f, 0xff, 0x36, 0xf6, 0x31, 0xf1,
- 0x24, 0xe4, 0x23, 0xe3, 0x2a, 0xea, 0x2d, 0xed,
- 0x70, 0xb0, 0x77, 0xb7, 0x7e, 0xbe, 0x79, 0xb9,
- 0x6c, 0xac, 0x6b, 0xab, 0x62, 0xa2, 0x65, 0xa5,
- 0x48, 0x88, 0x4f, 0x8f, 0x46, 0x86, 0x41, 0x81,
- 0x54, 0x94, 0x53, 0x93, 0x5a, 0x9a, 0x5d, 0x9d,
- 0xe0, 0x20, 0xe7, 0x27, 0xee, 0x2e, 0xe9, 0x29,
- 0xfc, 0x3c, 0xfb, 0x3b, 0xf2, 0x32, 0xf5, 0x35,
- 0xd8, 0x18, 0xdf, 0x1f, 0xd6, 0x16, 0xd1, 0x11,
- 0xc4, 0x04, 0xc3, 0x03, 0xca, 0x0a, 0xcd, 0x0d,
- 0x90, 0x50, 0x97, 0x57, 0x9e, 0x5e, 0x99, 0x59,
- 0x8c, 0x4c, 0x8b, 0x4b, 0x82, 0x42, 0x85, 0x45,
- 0xa8, 0x68, 0xaf, 0x6f, 0xa6, 0x66, 0xa1, 0x61,
- 0xb4, 0x74, 0xb3, 0x73, 0xba, 0x7a, 0xbd, 0x7d,
- 0x47, 0x87, 0x40, 0x80, 0x49, 0x89, 0x4e, 0x8e,
- 0x5b, 0x9b, 0x5c, 0x9c, 0x55, 0x95, 0x52, 0x92,
- 0x7f, 0xbf, 0x78, 0xb8, 0x71, 0xb1, 0x76, 0xb6,
- 0x63, 0xa3, 0x64, 0xa4, 0x6d, 0xad, 0x6a, 0xaa,
- 0x37, 0xf7, 0x30, 0xf0, 0x39, 0xf9, 0x3e, 0xfe,
- 0x2b, 0xeb, 0x2c, 0xec, 0x25, 0xe5, 0x22, 0xe2,
- 0x0f, 0xcf, 0x08, 0xc8, 0x01, 0xc1, 0x06, 0xc6,
- 0x13, 0xd3, 0x14, 0xd4, 0x1d, 0xdd, 0x1a, 0xda,
- 0xa7, 0x67, 0xa0, 0x60, 0xa9, 0x69, 0xae, 0x6e,
- 0xbb, 0x7b, 0xbc, 0x7c, 0xb5, 0x75, 0xb2, 0x72,
- 0x9f, 0x5f, 0x98, 0x58, 0x91, 0x51, 0x96, 0x56,
- 0x83, 0x43, 0x84, 0x44, 0x8d, 0x4d, 0x8a, 0x4a,
- 0xd7, 0x17, 0xd0, 0x10, 0xd9, 0x19, 0xde, 0x1e,
- 0xcb, 0x0b, 0xcc, 0x0c, 0xc5, 0x05, 0xc2, 0x02,
- 0xef, 0x2f, 0xe8, 0x28, 0xe1, 0x21, 0xe6, 0x26,
- 0xf3, 0x33, 0xf4, 0x34, 0xfd, 0x3d, 0xfa, 0x3a
-};
-
-
-/*
- * Return number of sectors available in a segment.
- */
-int
-sect_count(ULONG badmap)
-{
- int i, amt;
-
- for (amt = QCV_BLKSEG, i = 0; i < QCV_BLKSEG; i++)
- if (badmap & (1 << i)) amt--;
- return(amt);
-}
-
-
-/*
- * Return number of bytes available in a segment.
- */
-int
-sect_bytes(ULONG badmap)
-{
- int i, amt;
-
- for (amt = QCV_SEGSIZE, i = 0; i < QCV_BLKSEG; i++)
- if (badmap & (1 << i)) amt -= QCV_BLKSIZE;
- return(amt);
-}
-
-
-/*
- * Multiply two numbers in the field.
- */
-static inline UCHAR
-multiply(UCHAR a, UCHAR b)
-{
- int tmp;
-
- if (!a || !b) return(0);
- tmp = alpha_log[a] + alpha_log[b];
- if (tmp > 254) tmp -= 255;
- return(alpha_power[tmp]);
-}
-
-
-/*
- * Multiply by an exponent.
- */
-static inline UCHAR
-multiply_out(UCHAR a, int b)
-{
- int tmp;
-
- if (!a) return(0);
- tmp = alpha_log[a] + b;
- if (tmp > 254) tmp -= 255;
- return(alpha_power[tmp]);
-}
-
-
-/*
- * Divide two numbers.
- */
-static inline UCHAR
-divide(UCHAR a, UCHAR b)
-{
- int tmp;
-
- if (!a || !b) return(0);
- tmp = alpha_log[a] - alpha_log[b];
- if (tmp < 0) tmp += 255;
- return (alpha_power[tmp]);
-}
-
-
-/*
- * Divide using exponent.
- */
-static inline UCHAR
-divide_out(UCHAR a, UCHAR b)
-{
- int tmp;
-
- if (!a) return 0;
- tmp = alpha_log[a] - b;
- if (tmp < 0) tmp += 255;
- return (alpha_power[tmp]);
-}
-
-
-/*
- * This returns the value z^{a-b}.
- */
-static inline UCHAR
-z_of_ab(UCHAR a, UCHAR b)
-{
- int tmp = a - b;
-
- if (tmp < 0) tmp += 255;
- return(alpha_power[tmp]);
-}
-
-
-/*
- * Calculate the inverse matrix for two or three errors. Returns 0
- * if there is no inverse or 1 if successful.
- */
-static inline int
-calculate_inverse(int nerrs, int *pblk, struct inv_mat *inv)
-{
- /* First some variables to remember some of the results. */
- UCHAR z20, z10, z21, z12, z01, z02;
- UCHAR i0, i1, i2;
- UCHAR iv0, iv1, iv2;
-
- if (nerrs < 2) return(1);
- if (nerrs > 3) return(0);
-
- i0 = pblk[0]; i1 = pblk[1]; i2 = pblk[2];
- if (nerrs == 2) {
- /* 2 errs */
- z01 = alpha_power[255 - i0];
- z02 = alpha_power[255 - i1];
- inv->log_denom = (z01 ^ z02);
- if (!inv->log_denom) return(0);
- inv->log_denom = 255 - alpha_log[inv->log_denom];
-
- inv->zs[0][0] = multiply_out( 1, inv->log_denom);
- inv->zs[0][1] = multiply_out(z02, inv->log_denom);
- inv->zs[1][0] = multiply_out( 1, inv->log_denom);
- inv->zs[1][1] = multiply_out(z01, inv->log_denom);
- } else {
- /* 3 errs */
- z20 = z_of_ab (i2, i0);
- z10 = z_of_ab (i1, i0);
- z21 = z_of_ab (i2, i1);
- z12 = z_of_ab (i1, i2);
- z01 = z_of_ab (i0, i1);
- z02 = z_of_ab (i0, i2);
- inv->log_denom = (z20 ^ z10 ^ z21 ^ z12 ^ z01 ^ z02);
- if (!inv->log_denom) return(0);
- inv->log_denom = 255 - alpha_log[inv->log_denom];
-
- iv0 = alpha_power[255 - i0];
- iv1 = alpha_power[255 - i1];
- iv2 = alpha_power[255 - i2];
- i0 = alpha_power[i0];
- i1 = alpha_power[i1];
- i2 = alpha_power[i2];
- inv->zs[0][0] = multiply_out(i1 ^ i2, inv->log_denom);
- inv->zs[0][1] = multiply_out(z21 ^ z12, inv->log_denom);
- inv->zs[0][2] = multiply_out(iv1 ^ iv2, inv->log_denom);
- inv->zs[1][0] = multiply_out(i0 ^ i2, inv->log_denom);
- inv->zs[1][1] = multiply_out(z20 ^ z02, inv->log_denom);
- inv->zs[1][2] = multiply_out(iv0 ^ iv2, inv->log_denom);
- inv->zs[2][0] = multiply_out(i0 ^ i1, inv->log_denom);
- inv->zs[2][1] = multiply_out(z10 ^ z01, inv->log_denom);
- inv->zs[2][2] = multiply_out(iv0 ^ iv1, inv->log_denom);
- }
- return(1);
-}
-
-
-/*
- * Determine the error magnitudes for a given matrix and syndromes.
- */
-static inline void
-determine(int nerrs, struct inv_mat *inv, UCHAR *ss, UCHAR *es)
-{
- UCHAR tmp;
- int i, j;
-
- for (i = 0; i < nerrs; i++) {
- es[i] = 0;
- for (j = 0; j < nerrs; j++)
- es[i] ^= multiply(ss[j], inv->zs[i][j]);
- }
-}
-
-
-/*
- * Compute the 3 syndrome values.
- */
-static inline int
-compute_syndromes(UCHAR *data, int nblks, int col, UCHAR *ss)
-{
- UCHAR r0, r1, r2, t1, t2;
- UCHAR *rptr;
-
- rptr = data + col;
- data += nblks << 10;
- r0 = r1 = r2 = 0;
- while (rptr < data) {
- t1 = *rptr ^ r0;
- t2 = mult_c0[t1];
- r0 = t2 ^ r1;
- r1 = t2 ^ r2;
- r2 = t1;
- rptr += QCV_BLKSIZE;
- }
- if (r0 || r1 || r2) {
- ss[0] = divide_out(r0 ^ divide_out(r1 ^ divide_out(r2, 1), 1), nblks);
- ss[1] = r0 ^ r1 ^ r2;
- ss[2] = multiply_out(r0 ^ multiply_out(r1 ^ multiply_out(r2, 1), 1), nblks);
- return(0);
- }
- return(1);
-}
-
-
-/*
- * Calculate the parity bytes for a segment, returns 0 on success (always).
- */
-int
-set_parity (UCHAR *data, ULONG badmap)
-{
- UCHAR r0, r1, r2, t1, t2;
- UCHAR *rptr;
- int max, row, col;
-
- max = sect_count(badmap) - 3;
- col = QCV_BLKSIZE;
- while (col--) {
- rptr = data;
- r0 = r1 = r2 = 0;
- row = max;
- while (row--) {
- t1 = *rptr ^ r0;
- t2 = mult_c0[t1];
- r0 = t2 ^ r1;
- r1 = t2 ^ r2;
- r2 = t1;
- rptr += QCV_BLKSIZE;
- }
- *rptr = r0; rptr += QCV_BLKSIZE;
- *rptr = r1; rptr += QCV_BLKSIZE;
- *rptr = r2;
- data++;
- }
- return(0);
-}
-
-
-/*
- * Check and correct errors in a block. Returns 0 on success,
- * 1 if failed.
- */
-int
-check_parity(UCHAR *data, ULONG badmap, ULONG crcmap)
-{
- int crcerrs, eblk[3];
- int col, row;
- int i, j, nblks;
- UCHAR ss[3], es[3];
- int i1, i2, saverrs;
- struct inv_mat inv;
-
- nblks = sect_count(badmap);
-
- /* Count the number of CRC errors and note their locations. */
- crcerrs = 0;
- if (crcmap) {
- for (i = 0; i < nblks; i++) {
- if (crcmap & (1 << i)) {
- if (crcerrs == 3) return(1);
- eblk[crcerrs++] = i;
- }
- }
- }
-
- /* Calculate the inverse matrix */
- if (!calculate_inverse(crcerrs, eblk, &inv)) return(1);
-
- /* Scan each column for problems and attempt to correct. */
- for (col = 0; col < QCV_BLKSIZE; col++) {
- if (compute_syndromes(data, nblks, col, ss)) continue;
- es[0] = es[1] = es[2] = 0;
-
- /* Analyze the error situation. */
- switch (crcerrs) {
- case 0: /* 0 errors >0 failures */
- if (!ss[0]) return(1);
- eblk[crcerrs] = alpha_log[divide(ss[1], ss[0])];
- if (eblk[crcerrs] >= nblks) return(1);
- es[0] = ss[1];
- if (++crcerrs > 3) return(1);
- break;
-
- case 1: /* 1 error (+ possible failures) */
- i1 = ss[2] ^ multiply_out(ss[1], eblk[0]);
- i2 = ss[1] ^ multiply_out(ss[0], eblk[0]);
- if (!i1 && !i2) { /* only 1 error */
- inv.zs[0][0] = alpha_power[eblk[0]];
- inv.log_denom = 0;
- } else if (!i1 || !i2) { /* too many errors */
- return(1);
- } else { /* add failure */
- eblk[crcerrs] = alpha_log[divide(i1, i2)];
- if (eblk[crcerrs] >= nblks) return(1);
- if (++crcerrs > 3) return(1);
- if (!calculate_inverse(crcerrs, eblk, &inv)) return(1);
- }
- determine(crcerrs, &inv, ss, es);
- break;
-
- case 2: /* 2 errors */
- case 3: /* 3 errors */
- determine(crcerrs, &inv, ss, es);
- break;
-
- default:
- return(1);
- }
-
- /* Make corrections. */
- for (i = 0; i < crcerrs; i++) {
- data[(eblk[i] << 10) | col] ^= es[i];
- ss[0] ^= divide_out(es[i], eblk[i]);
- ss[1] ^= es[i];
- ss[2] ^= multiply_out(es[i], eblk[i]);
- }
- if (ss[0] || ss[1] || ss[2]) return(1);
- }
- return(0);
-}
diff --git a/sbin/ip_mroute_mod/Makefile b/sbin/ip_mroute_mod/Makefile
deleted file mode 100644
index 7e78283..0000000
--- a/sbin/ip_mroute_mod/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# $Id$
-
-.PATH: ${.CURDIR}/../../sys/netinet
-KMOD= ip_mroute_mod
-SRCS= ip_mroute.c
-NOMAN=
-CFLAGS+= -DMROUTE_LKM -DMROUTING
-
-.include <bsd.kmod.mk>
diff --git a/sbin/ipfw/ipfirewall.4 b/sbin/ipfw/ipfirewall.4
deleted file mode 100644
index f11cbd54..0000000
--- a/sbin/ipfw/ipfirewall.4
+++ /dev/null
@@ -1,206 +0,0 @@
-.Dd November 16, 1994
-.Dt IPFW(4)/IPACCT 4
-.Os
-.Sh NAME
-
- ipfirewall,ipfw - IP packets filter.
- ipaccounting,ipacct - IP packets/traffic accounting.
-
-.Sh SYNOPSIS
-#include <netinet/ip_fw.h>
-
-setsockopt(raw_socket,IPPROTO_IP,<ipfw/ipacct option>,
- <struct ip|struct ipfw>,<size>)
-
-Ipfw options:
- IP_FW_ADD_BLK - add entry to blocking chain.
- IP_FW_ADD_FWD - add entry to forwarding chain.
- IP_FW_CHK_BLK - check ip packet against blocking chain.
- IP_FW_CHK_FWD - check ip packet against forwarding chain.
- IP_FW_DEL_BLK - delete entry from blocking chain.
- IP_FW_DEL_FWD - delete entry from forwarding chain.
- IP_FW_FLUSH - flush all blocking & forwarding chain entries.
- IP_FW_POLICY - define default ipfw policy.
-
-Ipacct options:
- IP_ACCT_ADD - add entry to accounting chain.
- IP_ACCT_DEL - delete entry from accounting chain.
- IP_ACCT_FLUSH - flush all accounting chain entries.
- IP_ACCT_ZERO - zero all accounting chain entries.
-
-Ipfw/ipacct entry structure:
- #define IP_FW_MAX_PORTS 10
-
-struct ip_fw {
- struct ip_fw *next;
- struct in_addr src, dst;
- struct in_addr src_mask, dst_mask;
- u_short flags;
- u_short n_src_p, n_dst_p;
- u_short ports[IP_FW_MAX_PORTS];
- u_long p_cnt,b_cnt;
-}
-
-Flags values for "flags" field:
- IP_FW_F_ALL - The entry should match all IP packets.
- IP_FW_F_TCP - The entry should match TCP packets.
- IP_FW_F_UDP - The entry should match UDP packets.
- IP_FW_F_ICMP - The entry should match ICMP packets.
- IP_FW_F_KIND - Mask value to separate protocol kind.
- IP_FW_F_ACCEPT - This entry is accepting ( see below )
- IP_FW_F_SRNG - Source ports are range ( see below )
- IP_FW_F_DRNG - Destination ports are range ( see below )
- IP_FW_F_PRN - Print this entry ( see below )
- IP_FW_F_BIDIR - This acct entry is bidirectional ( see below )
- IP_FW_F_MASK - Mask to match all valid flag bits.
-
-Kernel symbols to kvm_nlist():
- struct ip_fw *ip_fw_blk_chain - chain of forwarding entries.
- struct ip_fw *ip_fw_fwd_chain - chain of blocking entries.
- int ip_fw_policy - default policy.
- struct ip_fw *ip_acct_chain - chain of accounting entries.
-
-Options in the kernel configuration file:
- IPFIREWALL - enable ipfirewall.
- IPFIREWALL_VERBOSE - enable firewall output ( see below )
- DEBUG_IPFIREWALL - enable extensive debugging output.
- IPACCT - enable ipaccounting.
-
-.Sh DESCRIPTION
-Ipfirewall (later ipfw) is a system facility,which allows filtering
-of incoming and/or forwarding packets on the protocol+source/destination
-adress/ports base.
-Ipaccounting (later ipacct) is a system facility,which allows counting
-of incoming,outgoing and forwarding traffic by packet/byte count.
-
-Basic idea is that every packet checked against number of entries
-in several chains.There are 3 chains:
- Blocking - this chain defines whenever packet should be accepted
- ever for local delivery or for forwarding.
- Forwarding - this chain defines whenever packet should be accepted
- for forwarding only.
- Accounting - this chain defines types of packets , which should be
- counted.
-
-Entries added to chains by means of setsockopt() call on RAW IP socket.
-Options to add/remove specific entries or to flush all entries described
-above. Value passed to setsockopt() is a value of struct ip_fw for
-entry. If entry added , it checked by such rules that when we start
-searching chain for matching entry the first matching is the best match,
-[ or at least one of them :^) ].
- That means:
- * First in chain entries with specific protocol and small ranges
- of src/dst adresses and ports.
- * Later going entries with wider ranges of ports and adresses.
- * Later entries matching every port for some adress range.
- * Later universal entries matching any protocol.
-
-While deleting entry , every entry which equal to that passed to
-setsockopt() will be removed.
-Flush removes all entries.
-
-Every entry have several fields,by which packets matched:
- struct ip_fw *next - next entry in chain.(Set internally)
-
- struct in_addr src - source adress to be matched.
- struct in_addr src_mask - source adress mask.
- To match whole networks/subnets or adress groups
- mask bits should be zeroed here and also
- in src_mask field. Valuable bits should be set
- in src_mask field.
- struct in_addr dst - destination adress to be matched.
- struct in_addr dst_mask - destination adress mask.
-
- u_short flags - flags field.See exact description of flags meaning
- in description later.
-
- u_short n_src_p - number of source ports in "ports" array.
- u_short n_dst_p - number of destination ports in "ports" array.
- u_short ports[] - ports array.Overall length currently defined
- to reasonable maximum - 10,and could be changed.
- The packet's src port can ever match one of
- ports[0] ... ports[--n_src_p] numbers,or if
- flag IP_FW_F_SRNG set take port[0] as bottom
- range value and ports[1] as top one.n_src_p should
- be set to 2 then.If n_src_p equal to 0 , every port
- match. The same rules apply to packet's dst port,
- except that it matched against ports[n_src_p] ...
- ... ports[n_src_p+n_dst_p--],or if IP_FW_F_DRNG set,
- range is ports[n_src_p] to ports[n_srcp++].
-
- u_long p_cnt - packets count for ipacct entries.
- u_long b_cnt - bytes count for ipacct entries.
-
-Packet matching proceeds in following way:
-
-a) If packet entry protocol set to ALL, see c).
-
-b) If entry protocol set to TCP/UDP/ICMP and packet protocol
- different - no match,if packet protocol and entry protocol
- same - continue.
-
-c) If source addres pattern does not equal to packets sources adress
- masked with src_mask , or destination pattern not equal to packets
- destination adress masked with dst_mask - no match.
- If they does and protocol set to ALL/ICMP - got match.
- If they does and protocol set to TCP/UDP - continue.
-
-d) If src port doesn't match or dst port doesn't match - all
- packet don't match. If they does - got match.
-
-In ipfw packet matched consequently against every chain entry.
-Search continues untill first matching entry found.If IP_FW_F_ACCEPT
-flag set - packet accepted.If it is not set - packet denied.
-If no matching entry found , all unmatched packets ever accepted or
-denied depending on global polici value. It can be set with
-IP_FW_POLICY raw socket option. Deny value is 0, other values
-(default 1) is accept.
-
-Entries can be added with IP_FW_F_PRN flag set.If kernel compiled
-with IPFIREWALL_VERBOSE option,packets matching this entries will
-be printed by kernel printf's.
-
-If some chain is empty,every packet accepted by this chain no
-matter what default policy is.
-
-To check whenever or not packet denied by some chain , checking
-options to setsockopt() can be issued. Then the argument is
-a buffer representing ip packet,thus it has to be
-struct ip + struct tcphdr .
-Then setsockopt() return value 0 on accept or another on deny.
-
-Ipaccounting entries added the same way as ipfw ones.Packet checked
-against all entries in chain and values of p_cnt and b_cnt in matching
-entries rised.p_cnt rises by 1 and b_cnt by ip_len value of ip packet.
-Thus all traffic size counted including IP headers.
-
-If IP_FW_F_BIDIR flag is set in accounting entry,packets counted are
-those which match entry in standart way along with packets which match
-entry while their source and destination addr/port pairs swapped.
-
-Zero option allows all accounting to be cleared.
-
-.Sh DIAGNOSTICS
-
-[EINVAL] The IP option field was improperly formed; an option
- field was shorter than the minimum value or longer than
- the option buffer provided.An structural error in
- ip_fw structure occured (n_src_p+n_dst_p too big,
- ports set for ALL/ICMP protocols etc.)
-
-.Sh SEE ALSO
-
-ip(4), setsockopt(2), kvm_nlist(3), kvm_read(3)
-
-.Sh BUGS
- Ipfw/ipacct facilities are new and , although serious bugs has
-been tracked,some less important ones expected.
- This man page also uncomplete bad styled.
-
-.Sh HISTORY
- Ipfw facility has been intitially written as package to BSDI
-by Daniel Boulet <danny@BouletFermat.ab.ca>.
- It has been havily modified and ported to FreeBSD 2.0
-by Ugen J.S.Antsilevich <ugen@NetVision.net.il>
- Ipacct facility written for FreeBSD 2.0
-by Ugen J.S.Antsilevich <ugen@NetVision.net.il>
diff --git a/sbin/ipfw/ipfw.1 b/sbin/ipfw/ipfw.1
deleted file mode 100644
index 720b259..0000000
--- a/sbin/ipfw/ipfw.1
+++ /dev/null
@@ -1,527 +0,0 @@
-.\"
-.\" ipfw - a utility for manipulating the configuration of an IP firewall.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" @(#)ipfw.1
-.\"
-.TH ipfw 1 "October 27, 1994" "" "FreeBSD"
-
-.SH NAME
-ipfw - a utility for manipulating the configuration of an IP firewall.
-.SH SYNOPSIS
-.na
-.B ipfw
-.RB [options]
-.SH DESCRIPTION
-The
-.B ipfw
-command is used to configure an active IP firewall, setting masks on just
-what sites are allowed to connect through it, which packets are rejected,
-etc.
-.SH OPTIONS
-The command-line syntax of this command is rather involved, and rather than
-spend a lot of time that I just don't have at the moment creating a
-.B real
-man page, with properly formatted sections and all, I'm just going to loosely
-format the README I got. This really needs an nroff expert to go through
-it with a chainsaw and do a
-.N REAL
-job of formatting it! This all looks rather horrible at present, and
-I would actually almost recommend that you simply read the man page text
-directly, rather than trying to format it. Sorry, but I do NOT speak
-nroff, nor do I ever wish to learn how! :-) [-jkh].
-.PP
-For a sample kernel configuration file that will enable the right kernel
-features necessary for firewalling, see
-.I /sys/i386/conf/IPFIREWALL
-.
-.PP
-.B WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!!
-.PP
-This utility can be used to put your machine into very dysfunctional state,
-so if you want to test it then you should first make sure to read this man page
-all the way through, and don't run it anywhere from the system console!
-Using
-.I ipfw
-incorrectly is a really good way to kick yourself off your own machine
-if you're logged in over a network! Also make sure to never set this
-utility to be setuid root! It's a blatant security hole that way.
-Instead, run it as root or from "/etc/rc.local" as part of the boot process.
-It's also a good idea to use the checkb or checkf command options (see below)
-to pass some test packets through the firewalls that you've defined before
-going "live".
-.PP
-You may find it useful to create a file in which the first line is
-.I firewall flush
-to flush any existing firewalls before defining the explicit firewalls
-that you wish to use. This will ensure that you're always working from a
-known state.
-.PP
-The syntax for the
-.BI ipfirewall
-command option is rather complex and yet simple at the same time (if you know
-what I mean). There are seven sub-commands, and probably the easiest way to
-get into this is to give you a roughly BNF style grammar for the command
-(curly brackets are used for precedence, alternatives are separated by |,
-optional things are enclosed in square brackets, white space is required if
-it appears below and must not appear if there isn't any between the tokens
-below (i.e. no white space around periods, colons or slashes, whitespace
-required between all other tokens)):
-.PP
-.nf
- command ::= ipfirewall <list> | <flush> | <check> | <add> | <del>
- <list> ::= list
- <flush> ::= flush
- <check> ::= { checkb[locking] | checkf[orwarding] } <chkparms>
- <add> ::= { addb[locking] | addf[orwarding] } <add-del-parms>
- <del> ::= { delb[locking] | delf[orwarding] } <add-del-parms>
- <chkparms> ::= <protocol> from <ipaddr> <port> to <ipaddr> <port>
- <protocol> ::= tcp | udp
- <ipaddr> ::= <int>.<int>.<int>.<int> | <hostname>
- <hostname> ::= a host name from /etc/hosts
- <port> ::= <int> | <service>
- <service> ::= a service from /etc/services
- <int> ::= a non-negative integer
- <add-del-parms> ::= { accept | deny } { <universal_firewall> | <protocol_firewall> }
- <universal_firewall> ::= all from <masked_ipaddr> to <masked_ipaddr>
- <masked_ipaddr> ::= { <ipaddr>/<bits> } | { <ipaddr>:<ipaddr> } | <ipaddr>
- <bits> ::= integer in the range 0 to 32 inclusive
- <protocol_firewall> ::= <protocol> from <end_firewall> to <end_firewall>
- <end_firewall> ::= <masked_ipaddr> <port_list>
- <port_list> ::= [ <port>:<port> ] <sub_port_list>
- <sub_port_list> ::= <port> [ <sub_port_list> ]
-.fi
-.PP
-Although I think that the above grammar is complete, it isn't exactly what
-one would call easy to comprehend! Here's the basic idea along with what
-each of the forms mean:
-.PP
-The
-.I ipfirewall list
-command prints a list of the firewalls on both the
-forwarding and blocking chain in some more or less comprehensible format.
-.PP
-The
-.I ipfirewall flush
-command empties the two firewall chains.
-.PP
-The
-.I ipfirewall addblocking
-and
-.I ipfirewall addforwarding
-commands take a firewall description and add the firewall to the appropriate
-firewall chain. Note that you'll probably need to add some descriptions more
-then once, which will naturally take more then one entry in memory. It does
-not lead to significant degradation of performance, so don't worry about it.
-.PP
-The
-.I ipfirewall delblocking
-and
-.I ipfirewall delforwarding
-commands take a firewall description and delete the firewall from the
-appropriate firewall chain. The description must exactly match that given
-to an earlier add command. One delete command removes ALL matching entries
-from firewall chains.
-.PP
-There are two basic kinds of firewall descriptions. Universal firewall
-descriptions match all IP packets between specified pairs of hosts.
-Universal firewalls only check IP addresses (e.g. they match any combination
-of protocol and port numbers). Protocol-specific firewalls match either
-TCP/IP or UDP/IP packets between specified pairs of hosts. In addition
-to host descriptions, protocol-specific firewalls optionally take a
-description of which port numbers to match.
-.PP
-A host description consists of an IP address and a mask. The IP address
-is specified as either a domain name or in the familiar
-nn.nn.nn.nn format. The mask indicates how much of the IP address
-should be looked at when vetting packets. There are two ways to
-specify the mask. The first way is to suffix the IP address in the
-firewall with a slash and an integer in the range 0 through 32 inclusive.
-This integer is taken to be the number of high order bits of the IP
-address which are to be checked (for example, 192.153.211.0/24 checks
-the top 24 bits of the IP address, 192.153.211.17/32 checks all the
-bits and 0.0.0.0/0 checks none of the bits (i.e. all IP addresses are
-matched by this example)). The second way to specify a mask is to
-suffix the IP address with a colon followed by another IP address.
-This second address is the mask. Specifications equivalent to the
-above three examples using this syntax would be
-.PP
-.nf
-192.153.211.0:255.255.255.0
-192.153.211.17:255.255.255.255
-0.0.0.0:0.0.0.0
-.fi
-.PP
-The first form is taken from the syntax accepted by a Telebit NetBlazer.
-The second form is more along the lines of how a netmask is specified
-in /etc/netmasks. Finally, if no mask is specified then a mask of all
-1's is supplied (i.e. no mask is equivalent to /32 or :255.255.255.255).
-.PP
-The optional description of port numbers to mask can take three forms.
-The simplest form is to omit the list in which case all port numbers
-match. The next form is to specify a list of port numbers (either as
-positive integers or service names from /etc/services). The final form
-is actually a special case of the second form in which the first pair
-of port numbers is separated by a colon instead of white space. This
-pair specifies a range of port numbers (i.e. x:y specifies that all
-ports between x and y inclusive should match). A port description
-matches a particular port number if any of the following is true:
-.nf
- - the port description is null
-
- - the first pair of port numbers is a range and the port number
- is in the range (inclusive)
-
- - the port number is equal to any of the port numbers in the list
-.fi
-.PP
-There is a limit of a total of 10 port numbers in the source and
-destination port lists. This limit is arbitrary and easy to increase.
-It is determined by the value of the IP_FIREWALL_MAX_PORTS #define
-variable in ip_firewall.h. Each increase of 1 for this value adds two
-bytes to the size of each firewall. Since the size of a firewall is only
-slightly over 30 bytes right now, this limit of 10 could probably
-be increased by quite a bit before it became a concern. I've been
-thinking of increasing it to 20 which would be longer than any
-reasonable firewall would need and would only consume 20 more bytes
-per firewall. The counter argument to any increase is that it is
-always possible to construct an equivalent set of two or more firewalls
-that behaves like a single firewall with a really long port list.
-.PP
-This probably all sounds hopelessly complicated. It is actually not
-all that tricky (I'm just not very good at explaining it yet). A few
-examples will probably help a lot now:
-.PP
-Block all IP packets originating from the host hackers-den:
-.PP
-.nf
- ipfirewall addb deny all from hackers-den to 0.0.0.0/0
-.fi
-.PP
-Block all telnet packets to our telnet server from anywhere:
-.PP
-.nf
- ipfirewall addb deny tcp from 0.0.0.0/0 to mymachine/32 telnet
-.fi
-.PP
-Don't forward telnet, rlogin and rsh packets onto our local
-class C network:
-.PP
-.nf
- ipfirewall addf deny tcp from 0.0.0.0/0 to ournetwork/24 telnet login shell
-.fi
-.PP
-Don't let anyone on the local machine or any machine inside
-our local network ftp access to games.com:
-.PP
-.nf
- ipfirewall addb deny tcp from games.com ftp to 0.0.0.0/0
-.fi
-.PP
-This last one might look a little strange. It doesn't prevent
-anyone from sending packets to the games.com ftp server. What it
-does do is block any packets that the games.com ftp server sends
-back!
-.PP
-The
-.I ipfirewall checkblocking
-and
-.I ipfirewall checkforwarding
-commands take a description of an IP packet and check to see if the blocking
-or forwarding chain of firewalls respectively accept or reject the packet.
-It is used to make sure that the firewalls that you've defined work as
-expected. The basic syntax is probably best understood by looking at
-a couple of examples:
-.PP
-.nf
- ipfirewall checkb from bsdi.com 3001 to mymachine telnet
-.fi
-.PP
-checks to see if the blocking firewall will block a telnet packet from
-a telnet session originating on bsdi.com to the host mymachine will be
-blocked or not. Note that someone connecting to our telnet server
-could be using practically any port number. To be really sure, the
-firewall used to prevent access should be as simple as possible and/or
-you should try a variety of port numbers in addition to the rather
-arbitrarily chosen port of 3001.
-.PP
-One final note on the check* ,add* and del* command syntax. The noise word
-"to" exists in the syntax so that I can detect the end of a list of
-port numbers in the from description. Since I needed a noise word to
-detect this case, I added the noise word "from" in front of the from
-case for consistency.
-.PP
-Finally, have a look at the file
-.I "/usr/share/misc/ipfw.samp.filters"
-. It is the set of filters that I run at home [Danny].
-.PP
-Also check
-.I "/usr/share/misc/ipfw.samp.scripts"
-For examples of individual access restrictions.
-We [NetVision] use those for our dial-in PPP/SLIP users to allow some of them
-to access our internal networks, while disallowing others.
-This way we open access for the user's IP when he enters the system and shut it
-down when he leaves. All such changes may be applyed at any time,
-and so entries added and deleted from firewall while the system is
-is working have no other side effects [Ugen].
-
-.SH "TECHNICAL DETAILS"
-A bit of a description of how the firewalls are applied (i.e. what happens in
-the kernel) may be instructive to the advanced firewall-builder:
-.PP
-When an IP packet is received, the ipintr() routine in ip_input.c is
-called. This routine does a bit of basic error checking. If it
-detects any errors in the packet it generally drops the packet on
-the floor. The idea behind the ipfirewall facility is to treat packets
-that we don't want to accept as bad packets (i.e. drop them on the
-floor). The ipfirewall facility intercedes in the normal processing
-at two points. Just after the basic sanity checks are done, we pass
-any packets not targeted at the loopback network (127.0.0.0/8) to the
-firewall checker along with the chain of blocking firewalls.If the firewall
-checker tells us to block the packet then we branch to the "bad:" label
-in ipintr() which is where all bad packets are dropped on the floor.
-Otherwise, we allow normal processing of the packet to continue. The
-exact point at which we intercede was chosen to be after the basic
-sanity checking and before the option processing is done. We want to
-be after the basic sanity checking so that we don't have to be able
-to handle complete garbage. We want to be before the option processing
-because option processing is done in separate rather complex routine.
-Why bother doing this special processing if we might be dropping the
-packet?
-.PP
-The second point at which we intercede is when a packet is about to be
-forwarded to another host. All such packets are passed to the ip_forward
-routine. The ipfirewall code is at the very top of this routine. If
-the packet isn't targetted at the loopback interface (is it possible
-that it could be when we reach this point? I doubt it but safety first)
-then pass the packet to the firewall checker along with the forwarding
-firewall chain. If the firewall checker indicates that the packet should
-not be forwarded then we drop in (using code copied from a few lines
-further into the routine which drops broadcast packets which are not
-to be forwarded).
-.PP
-There are a couple of consequences of this approach:
-.PP
-1) Packets which are blocked are never forwarded (something to keep
-in mind when designing firewalls).
-.PP
-2) Packets targeted at the loopback interface (127.0.0.0/8) are never
-blocked. Blocking packets to the loopback interface seems pointless
-and potentially quite confusing. It also makes a possibly common
-case very cheap.
-.PP
-3) The sender of a packet which is blocked receives no indication that
-the packet was dropped. The Telebit NetBlazer can be configured to
-silently drop a blocked packet or to send back a "you can't get there
-from here" packet to the sender. Implementing the later would have
-been more work (possibly quite a bit more, I don't really know). Also,
-I don't see any reason to give a potential hacker any more information
-than necessary. Dropping the packet into the bit bucket seems like
-the best way to keep a hacker guessing. [Danny]
-.PP
-(I am working on this feature, it would be made optional and
-configurable by some ICMP_UNREACH_ON_DROP option, or such [Ugen]).
-.PP
-The firewall checker takes two parameters. The first parameter is a pointer
-to the packet in question. The second parameter is a pointer to the
-appropriate firewall chain. At the present time, the firewall checker passes
-these parameters to a second routine which is the real firewall checker.
-If the real checker says NO then an appropriate message is printed
-onto the console. This is useful for debugging purposes. Whether or
-not it remains in the long term depends on whether it is considered useful
-for logging purposes (I'm a little reluctant to leave it in since it
-provides a hacker with a way to commit a "denial of service" offense
-against you by filling up your /var/log/messages file's file system
-with error messages. There are ways of preventing this but ... [Danny]).
-In default configuration now no information about dropped packets
-printed.You may, however, define it as i do by adding
-.I options IPFIREWALL_VERBOSE
-to your kernel configuration file. Very useful thingy! [Ugen]
-
-.PP
-A return value of 0 from this routine (or the real firewall checker)
-indicates that the packet is to be dropped. A value of 1 indicates
-that the packet is to be accepted. In the early testing stages you
-might want to make the top level firewall checker always return 1 even
-if the real checker returns 0 just in case the real firewall checker
-screws up (or your firewalls aren't as well designed as they should be).
-In fact, this might be a useful optional feature (providing a way to
-leave a door unlocked doesn't seem all that wise but it has to be
-balanced against the inconvenience to legitimate users who might get
-screwed up by poorly designed firewalls).
-
-.PP
-The real firewall returns 1 (accept the packet) if the chain is empty. If
-efficiency is a concern (which it is in this code), this check should
-be done in ip_input.c before calling the firewall checker.
-
-.PP
-Assuming that there is a firewall chain to scan through, the real firewall
-checker picks up the src and dst IP addresses from the IP packet. It
-then goes through the firewall chain looking for the first firewall that
-matches the packet. Once a matching firewall has been found, a value of
-1 is returned if the firewall is an accept firewall and a value of 0 is
-returned otherwise.
-.PP
-The following processing is done for each firewall on the chain:
-.PP
-1) check the src and dst IP addresses. If they don't match then
-there isn't any point in looking any further at this firewall.
-This check is done by anding the packet's IP addresses the
-with appropriate masks and comparing the results to the
-appropriate addresses in the firewall. Note that the mask is
-NOT applied to the address in the firewall. If it has any 1
-bits that are 0 bits in the mask then the firewall will never
-match (this will be checked in ipfirewall soon). If the addresses
-match then we continue with the next step.
-.PP
-2) If the firewall is a universal firewall then we've got a match.
-Return either 0 or 1 as appropriate. Otherwise, continue with
-the next step.
-.PP
-3) Examine the IP protocol from the packet. If we havn't had to
-look at it before then we get it and set a local variable to
-IP_FIREWALL_TCP for TCP/IP packets, IP_FIREWALL_UDP for UDP/IP
-packets, IP_FIREWALL_ICMP for ICMP packets, and IP_FIREWALL_UNIVERSAL
-for all other packet types. Also, if the packet is a TCP/IP or
-a UDP/IP packet, save the source and destination port numbers
-at this point (taking advantage of the fact that the port numbers
-are stored in the same place in either a TCP/IP or a UDP/IP
-packet header). If the packet is neither a TCP/IP or a UDP/IP
-packet then this firewall won't match it (on to the next firewall).
-If this packet's protocol doesn't match this firewall's protocol
-(which can't be universal or we wouldn't be here) then on to
-the next firewall. Otherwise, continue with the next step.
-.PP
-4) We're checking either a TCP/IP or a UDP/IP packet. If the
-firewall's source port list is empty or the packet's source
-port matches something in the source port list AND if the firewall's
-destination port list is empty or the packet's destination
-port matches something in the destination port list then
-we've got a match (return 0 or 1 as appropriate). Otherwise,
-on to the next firewall.
-.PP
-As indicated above, if no packet on the chain matches the packet then
-it is accepted if the first firewall was a deny firewall and it is rejected
-if the first firewall was an accept packet. This is equivalent to the
-default behaviour of a Telebit NetBlazer. They provide a way to override
-this behaviour. I'm not convinced that it is necessary (I'm open to
-suggestions).
-.PP
-That's about it for the firewall checker. The
-.I ipfw
-program communicates with the kernel part of the firewall facility by making
-setsockopt calls on RAW IP sockets. Only root is allowed to open a RAW IP
-socket. This ensures that only root uses
-.I ipfw to manipulate the firewall facility.
-Also, somewhere in the kernel source or on a man page, I read that the
-RAW IP setsockopt calls are intended for manipulating the IP protocol layer
-as opposed to manipulating any particular instance of a socket. This seems
-like a reasonable description of what the firewall setsockopt command
-codes do.
-.PP
-There are seven setsockopt command codes defined by the firewall facility
-(in netinet/in.h). They are:
-.PP
-.nf
- IP_FLUSH_FIREWALLS flush (i.e. free) both firewall chains.
-
- IP_ADD_FORWARDING_FIREWALL add firewall pointed at by optval parm to
- the end of the forwarding firewall chain.
-
- IP_ADD_BLOCKING_FIREWALL add firewall pointed at by optval parm to
- the end of the blocking firewall chain.
-
- IP_DEL_FORWARDING_FIREWALL delete firewall pointed at by optval parm
- from the forwarding firewall chain.
-
- IP_DEL_BLOCKING_FIREWALL delete firewall pointed at by optval parm
- from the blocking firewall chain.
-
- IP_CHECK_FORWARDING_FIREWALL pass the IP packet do the firewall checker
- along with the forwarding firewall chain.
- Return 0 if packet was accepted, -1 (with
- errno set to EACCES) if it wasn't.
-
- IP_CHECK_BLOCKING_FIREWALL pass the IP packet do the firewall checker
- along with the blocking firewall chain.
- Return 0 if packet was accepted, -1 (with
- errno set to EACCES) if it wasn't.
-
- The IP_ADD_* and IP_DEL_* command codes do a fair bit of validity checking.
- It is quite unlikely that a garbage firewall could get past them that
- would cause major problems in the firewall checker. It IS possible for
- a garbage packet to get past the checks which causes major grief because
- it either blocks or accepts packets according to unusual rules (the rules
- will conform to the ones described above but will probably come as quite
- a surprise).
-
- The IP_CHECK_* command codes expect the optval parameter to point
- to a struct ip immediately followed by a header appropriate to the protocol
- value described in the ip_p field of the ip header. The exact requirements
- are as follows:
-
- - The length of the optval parameter must be at least
-
- sizeof(struct ip) + 2 * sizeof(u_short)
-
- since this is the amount of memory that might be referenced by
- the firewall checker.
-
- - The ip_hl field of the ip structure must be equal to
-
- sizeof(struct ip) / sizeof(int)
-
- since this value indicates that the tcp/udp/??? header immediately
- follows the ip header (appropriate for the purposes that this
- interface is intended for).
-
- Failure to follow these rules (for either the IP_ADD_*,IP_DEL_* or the
- IP_CHECK_*_FIREWALL commands) will result in a return value of -1 with
- errno set to EINVAL (for now, it will also result in an appropriate
- message on the console).
-
- To read current configuration of firewalls,the kvm_read() function used.
- Symbols,which you have to find are :
- struct ip_firewall * ip_firewall_blocking_chain ;
- struct ip_firewall * ip_firewall_forwarding_chain ;
- Both are pointers to the linked list of firewall entries.
- Of course, you must at least be a member of group kmem to read kernel
- symbols.
-.fi
-.PP
-There are a couple of additional details that are worth reading about in
-the ip_firewall.h file. Other than that, let the authors know how you do!
-If you have any problems, you may call Danny Boulet at home (403 449-1835)
-or send e-mail to <danny@BouletFermat.ab.ca>. If you call, please keep in
-mind that Danny lives in the Canadian Mountain timezone (GMT-0600).
-.PP
-You may also reach some commercial users of this package (and also those
-responsible for porting it to FreeBSD and adding several additional
-commands), at 972-4-550-330, or via email at <ugen@NetVision.net.il>.
-If you call, remember that Ugen lives in the Israel timezone, which is GMT+02.
-
-.SH FILES
-/usr/share/misc/ipfw.samp.filters
-/usr/share/misc/ipfw.samp.scripts
-.SH "BUGS"
-You can very easily hose your machine utterly if you don't know what you're
-doing. Dieses Befehl ist nur fuer Experten!
-.SH "SEE ALSO"
-.BR reboot (1) ,
-.PP
-.BR /sys/i386/conf/IPFIREWALL
-.SH AUTHORS
-Daniel Boulet <danny@BouletFermat.ab.ca>
-.PP
-Ugen J.S.Antsilevich <ugen@NetVision.net.il>
-.PP
-Jordan K. Hubbard <jkh@FreeBSD.org> [Crimes committed in this manpage]
diff --git a/sbin/slattach/uucplock.c b/sbin/slattach/uucplock.c
deleted file mode 100644
index fb0f7c0..0000000
--- a/sbin/slattach/uucplock.c
+++ /dev/null
@@ -1,143 +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 sccsid[] = "@(#)uucplock.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/dir.h>
-#include <errno.h>
-#include <syslog.h>
-#include <unistd.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#define _PATH_LOCKDIRNAME "/var/spool/lock/LCK..%s"
-
-/* Forward declarations */
-static int put_pid (int fd, pid_t pid);
-static pid_t get_pid (int fd);
-
-/*
- * uucp style locking routines
- * return: 0 - success
- * -1 - failure
- */
-
-int uu_lock (char *ttyname)
-{
- int fd;
- pid_t pid;
- char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN];
-
- (void)sprintf(tbuf, _PATH_LOCKDIRNAME, ttyname);
- fd = open(tbuf, O_RDWR|O_CREAT|O_EXCL, 0660);
- if (fd < 0) {
- /*
- * file is already locked
- * check to see if the process holding the lock still exists
- */
- fd = open(tbuf, O_RDWR, 0);
- if (fd < 0) {
- syslog(LOG_ERR, "lock open: %m");
- return(-1);
- }
- if ((pid = get_pid (fd)) == -1) {
- syslog(LOG_ERR, "lock read: %m");
- (void)close(fd);
- return(-1);
- }
-
- if (kill(pid, 0) == 0 || errno != ESRCH) {
- (void)close(fd); /* process is still running */
- return(-1);
- }
- /*
- * The process that locked the file isn't running, so
- * we'll lock it ourselves
- */
- if (lseek(fd, 0L, L_SET) < 0) {
- syslog(LOG_ERR, "lock lseek: %m");
- (void)close(fd);
- return(-1);
- }
- /* fall out and finish the locking process */
- }
- pid = getpid();
- if (!put_pid (fd, pid)) {
- syslog(LOG_ERR, "lock write: %m");
- (void)close(fd);
- (void)unlink(tbuf);
- return(-1);
- }
- (void)close(fd);
- return(0);
-}
-
-int uu_unlock (char *ttyname)
-{
- char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN];
-
- (void)sprintf(tbuf, _PATH_LOCKDIRNAME, ttyname);
- return(unlink(tbuf));
-}
-
-static int put_pid (int fd, pid_t pid)
-{
- char buf [32];
- int len;
-
- len = sprintf (buf, "%10ld\n", pid);
- return write (fd, buf, len) == len;
-}
-
-static pid_t get_pid (int fd)
-{
- int bytes_read;
- char buf [32];
- pid_t pid;
-
- bytes_read = read (fd, buf, sizeof (buf) - 1);
- if (bytes_read > 0) {
- buf [bytes_read] = '\0';
- pid = strtol (buf, (char **) NULL, 10);
- }
- else
- pid = -1;
- return pid;
-}
-
-/* end of uucplock.c */
diff --git a/sbin/startslip/example/sldown.sh b/sbin/startslip/example/sldown.sh
deleted file mode 100755
index 1f342a4..0000000
--- a/sbin/startslip/example/sldown.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-/sbin/ifconfig $1 $2
-/sbin/route delete default
diff --git a/sbin/startslip/example/slip.sh b/sbin/startslip/example/slip.sh
deleted file mode 100755
index c2a1275..0000000
--- a/sbin/startslip/example/slip.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-startslip -b 57600 -U ./slup.sh -D ./sldown.sh \
- -s atd<phone1> -s atd<phone2> -s atd<phone3> \
- -h -t 60 -w 2 /dev/cuaa1 <login> <password>
diff --git a/sbin/startslip/example/slup.sh b/sbin/startslip/example/slup.sh
deleted file mode 100755
index df83c0c..0000000
--- a/sbin/startslip/example/slup.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-myname=<my.ip.address>
-gateway=<gateway.ip.address>
-netmask=255.255.255.248
-tune="link0 -link2" # links means force compression
-
-/sbin/ifconfig $1 $2 $tune
-/sbin/ifconfig $1 inet $myname $gateway netmask $netmask
-/sbin/route add default $gateway
diff --git a/sbin/sysinstall/Makefile b/sbin/sysinstall/Makefile
deleted file mode 100644
index d141faa..0000000
--- a/sbin/sysinstall/Makefile
+++ /dev/null
@@ -1,51 +0,0 @@
-PROG = sysinstall
-MANEXT = 1
-NOMAN= yet
-CLEANFILES= makedevs.c rtermcap
-
-.PATH: ${.CURDIR}/../disklabel
-
-SRCS = exec.c dkcksum.c label.c main.c mbr.c \
- stage0.c stage1.c stage2.c stage3.c stage5.c \
- termcap.c utils.c makedevs.c ourcurses.c
-
-CFLAGS += -Wall -g -static
-LDADD = -ldialog -lncurses -lmytinfo
-DPADD = ${LIBDIALOG} ${LIBNCURSES} ${LIBMYTINFO}
-
-.if exists(${.CURDIR}/../../sys/i386/boot/biosboot/obj)
-BOOTS=${.CURDIR}/../../sys/i386/boot/biosboot/obj
-.else
-BOOTS=${.CURDIR}/../../sys/i386/boot/biosboot
-.endif
-
-makedevs.c: dev2c.sh Makefile rtermcap
- mkdir -p dev
- cp ${.CURDIR}/../../etc/etc.i386/MAKEDEV dev
- ( cd dev; sh ./MAKEDEV all )
- sh ${.CURDIR}/dev2c.sh dev > makedevs.tmp
- rm -rf dev
- uudecode < ${.CURDIR}/bteasy17.uu
- file2c 'const unsigned char boot0[] = {' '};' \
- < bteasy17 >> makedevs.tmp
- rm -rf bteasy17
- file2c 'const unsigned char boot1[] = {' '};' \
- < ${BOOTS}/boot1 >> makedevs.tmp
- file2c 'const unsigned char boot2[] = {' '};' \
- < ${BOOTS}/boot2 >> makedevs.tmp
- ./rtermcap cons25 | \
- file2c 'const char termcap_cons25[] = {' ',0};' \
- >> makedevs.tmp
- ./rtermcap cons25-m | \
- file2c 'const char termcap_cons25_m[] = {' ',0};' \
- >> makedevs.tmp
- ./rtermcap vt100 | \
- file2c 'const char termcap_vt100[] = {' ',0};' \
- >> makedevs.tmp
- mv makedevs.tmp makedevs.c
-
-rtermcap: ${.CURDIR}/rtermcap.c
- ${CC} -o rtermcap ${.CURDIR}/rtermcap.c -ltermcap
-
-.include <bsd.prog.mk>
-
diff --git a/sbin/sysinstall/bootarea.c b/sbin/sysinstall/bootarea.c
deleted file mode 100644
index 917b65e..0000000
--- a/sbin/sysinstall/bootarea.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 1994, Paul Richards.
- *
- * All rights reserved.
- *
- * This software may be used, modified, copied, distributed, and
- * sold, in both source and binary form provided that the above
- * copyright and these terms are retained, verbatim, as the first
- * lines of this file. Under no circumstances is the author
- * responsible for the proper functioning of this software, nor does
- * the author assume any responsibility for damages incurred with
- * its use.
- */
-
-#include <sys/types.h>
-#include <sys/errno.h>
-#include <sys/disklabel.h>
-#include <sys/ioctl.h>
-#include <sys/fcntl.h>
-#include <sys/uio.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <dialog.h>
-
-#include "mbr.h"
-#include "sysinstall.h"
-
-extern char *bootblocks;
-extern struct mbr *mbr;
-
-int
-write_bootblocks(int fd, struct disklabel *lbl)
-{
- off_t of = lbl->d_partitions[OURPART].p_offset;
-
- Debug("Seeking to byte %ld ", of * lbl->d_secsize);
- if (lseek(fd, (of * lbl->d_secsize), SEEK_SET) < 0) {
- Fatal("Couldn't seek to start of partition\n");
- }
-
- enable_label(fd);
-
- if (write(fd, bootblocks, lbl->d_bbsize) != lbl->d_bbsize) {
- Fatal("Failed to write bootblocks (%p,%d) %d %s\n",
- bootblocks, lbl->d_bbsize,
- errno, strerror(errno)
- );
- }
-
- disable_label(fd);
-
- return(0);
-}
-
-int
-build_bootblocks(int dfd,struct disklabel *label,struct dos_partition *dospart)
-{
- int fd;
- off_t of = label->d_partitions[OURPART].p_offset;
-
- Debug("Loading boot code from %s", boot1);
-
- fd = open(boot1, O_RDONLY);
- if (fd < 0)
- Fatal("Couldn't open boot file %s\n", boot1);
-
- if (read(fd, bootblocks, MBRSIZE) < 0)
- Fatal("Couldn't read from boot file %s\n", boot1);
-
- if (close(fd) == -1)
- Fatal("Couldn't close boot file %s\n", boot1);
-
- Debug("Loading boot code from %s", boot2);
-
- fd = open(boot2, O_RDONLY);
- if (fd < 0)
- Fatal("Couldn't open boot file %s", boot2);
-
- if (read(fd, &bootblocks[MBRSIZE], (int)(label->d_bbsize - MBRSIZE)) < 0)
- Fatal("Couldn't read from boot file %s\n", boot2);
-
- if (close(fd) == -1)
- Fatal("Couldn't close boot file %s", boot2);
-
- bcopy(dospart, &bootblocks[DOSPARTOFF],
- sizeof(struct dos_partition) * NDOSPART);
-
- label->d_checksum = 0;
- label->d_checksum = dkcksum(label);
- bcopy(label, &bootblocks[(LABELSECTOR * label->d_secsize) + LABELOFFSET],
- sizeof *label);
-
- Debug("Seeking to byte %ld ", of * label->d_secsize);
-
- if (lseek(dfd, (of * label->d_secsize), SEEK_SET) < 0) {
- Fatal("Couldn't seek to start of partition\n");
- }
-
- enable_label(dfd);
-
- if (write(dfd, bootblocks, label->d_bbsize) != label->d_bbsize) {
- Fatal("Failed to write bootblocks (%p,%d) %d %s\n",
- bootblocks, label->d_bbsize,
- errno, strerror(errno)
- );
- }
-
- disable_label(dfd);
-
- return(0);
-}
diff --git a/sbin/sysinstall/bootarea.h b/sbin/sysinstall/bootarea.h
deleted file mode 100644
index 3c17eb9..0000000
--- a/sbin/sysinstall/bootarea.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 1994, Paul Richards.
- *
- * All rights reserved.
- *
- * This software may be used, modified, copied, distributed, and
- * sold, in both source and binary form provided that the above
- * copyright and these terms are retained, verbatim, as the first
- * lines of this file. Under no circumstances is the author
- * responsible for the proper functioning of this software, nor does
- * the author assume any responsibility for damages incurred with
- * its use.
- */
-
-#define BOOT1 "/stand/sdboot"
-#define BOOT2 "/stand/bootsd"
-
-/* XXX -- calculate these, this is nasty */
-#define DEFFSIZE 1024
-#define DEFFRAG 8
-
-int Mb_to_cylbdry(int, struct disklabel *);
-void default_disklabel(struct disklabel *, int, int);
-int disk_size(struct disklabel *);
diff --git a/sbin/sysinstall/bteasy17.uu b/sbin/sysinstall/bteasy17.uu
deleted file mode 100644
index 2cc05b2..0000000
--- a/sbin/sysinstall/bteasy17.uu
+++ /dev/null
@@ -1,15 +0,0 @@
-begin 664 bteasy17
-M,\".P([8CM"\`'S\B_2_``:Y``'RI>I@!@``B]58HD@'/#5T'+00]N0%K@26
-M]D0$_W0^Q@2`Z-H`BG0!BTP"ZPCHSP"Y`0`RT;L`?+@!`LT3<AZ!O_X!5:IU
-M%NH`?```@/J!=`*R@(OJ0H#RLX@6.@>_O@>Y!`#&!BT',3+VB"V*100\`'0C
-M/`5T'_[&OBH'Z'$`OD@'1D:+'`K_=`4R?01U\XVW<@?H6@"#QQ#^!BT'XLN`
-M/G4$`G0+OCL'"O9U"LT8ZZR^*@?H.0#H-@`RY,T:B]J#PV"T`<T6M`!U"\T:
-M.]-R\J!(!^L*S1:*Q#P<=/,$]CPQ<M8\-7?24+XH![L;!E/\K%`D?[0.S1!8
-MJ(!T\L-6N`$#NP`&N0$`,O;-$U[&!D@'/\,-B@T*1C`@+B`N("Z@9&ES:R`Q
-M#0H*1&5F875L=#H@1C^@``$`!``&`P<'"@IC#F0.912`%($9@AZ3)*4GGRMU
-M+U(OVS)`-_(]`&1O\TA01M-/<[)5;FGX3F]V96SL36EN:?A,:6YU^$%M;V5B
-MX4)3Q$)31.E00TG80U#-5F5N:?A$;W-S9>,_OP``````````````````````
-M````````````````````````````````````````````````````````````
-1````````````````````5:H`
-`
-end
diff --git a/sbin/sysinstall/dev2c.sh b/sbin/sysinstall/dev2c.sh
deleted file mode 100644
index d395810..0000000
--- a/sbin/sysinstall/dev2c.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-:
-#
-# ----------------------------------------------------------------------------
-# "THE BEER-WARE LICENSE" (Revision 42):
-# <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
-# can do whatever you want with this stuff. If we meet some day, and you think
-# this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
-# ----------------------------------------------------------------------------
-#
-# $Id: stage3.c,v 1.4 1994/10/21 02:14:52 phk Exp $
-#
-# During installation, we suffer badly of we have to run MAKEDEV. MAKEDEV
-# need sh, ln, chown, mknod, awk, rm, test and probably emacs too when
-# we come down to it. So instead this script will make a C-procedure which
-# makes all the B & C nodes of a specified directory.
-#
-# Poul-Henning
-
-(cd $1; ls -li ) | sed 's/,//' | awk '
-BEGIN {
- while (getline < "/etc/passwd") {
- split($0,a,":")
- uid[a[1]] = a[3]
- }
- while (getline < "/etc/group") {
- split($0,a,":")
- gid[a[1]] = a[3]
- }
- printf("/*\n");
- printf(" * This file is generated from the contents of /dev\n");
- printf(" */\n");
- printf("#define CHK(foo) {i = foo;}\n");
- printf("#include <unistd.h>\n");
- printf("#include <sys/types.h>\n");
- printf("#include <sys/stat.h>\n");
- printf("int makedevs()\n{\n\tint i=0;\n");
- }
- {
- printf ("/* %s */\n",$0)
- $4 = uid[$4]
- $5 = gid[$5]
- if (substr($2,1,1) == "b") {
- k="S_IFBLK"
- } else if (substr($2,1,1) == "c") {
- k="S_IFCHR"
- } else if (substr($2,1,1) == "d") {
- next
- } else if (substr($2,1,1) == "-") {
- next
- } else {
- next
- }
- m = 0;
- if (substr($2,2,1) == "r") m += 400;
- if (substr($2,3,1) == "w") m += 200;
- if (substr($2,4,1) == "x") m += 100;
- if (substr($2,5,1) == "r") m += 40;
- if (substr($2,6,1) == "w") m += 20;
- if (substr($2,7,1) == "x") m += 10;
- if (substr($2,8,1) == "r") m += 4;
- if (substr($2,9,1) == "w") m += 2;
- if (substr($2,10,1) == "x") m += 1;
-
- if (a[$1] != 0) {
- printf ("\tCHK(link(\"%s\",\"%s\"));\n", \
- a[$1],$11)
- } else {
- printf ("\tCHK(mknod(\"%s\",%s,makedev(%d,%d)));\n", \
- $11, k, $6, $7)
- printf ("\tCHK(chmod(\"%s\",0%d));\n", \
- $11, m)
- printf ("\tCHK(chown(\"%s\",%d,%d));\n", \
- $11, $4,$5)
- a[$1] = $11
- }
- }
-END {
- printf("\treturn i;\n}\n");
- }
-'
diff --git a/sbin/sysinstall/disk.h b/sbin/sysinstall/disk.h
deleted file mode 100644
index 622dc0c..0000000
--- a/sbin/sysinstall/disk.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 1994, Paul Richards.
- *
- * All rights reserved.
- *
- * This software may be used, modified, copied, distributed, and
- * sold, in both source and binary form provided that the above
- * copyright and these terms are retained, verbatim, as the first
- * lines of this file. Under no circumstances is the author
- * responsible for the proper functioning of this software, nor does
- * the author assume any responsibility for damages incurred with
- * its use.
- */
-
-#define MBRSIZE 512
-#define MBR_MAGIC 0xAA55
-#define ACTIVE 0x80
-
-/* XXX -- calculate these, this is nasty */
-#define DEFFSIZE 1024
-#define DEFFRAG 8
-
-/* bootarea.c */
-int write_bootblocks(int);
-int enable_label(int);
-int disable_label(int);
-/* label.c */
-char *diskname(int);
-
-struct mbr
-{
- unsigned char padding[2];
- unsigned char bootcode[DOSPARTOFF];
- struct dos_partition dospart[4];
- unsigned short magic;
-};
-
-struct disk {
- struct disklabel lbl;
- struct mbr mbr;
- struct devconf *devconf;
- int selected;
- int inst_part;
- struct fstab mounts[MAXPARTITIONS];
-};
-
-extern struct disk disk_list[];
-
-struct part_type
-{
- unsigned char type;
- char *name;
-};
-
-#define PARTITION_TYPES \
-{ \
- {0x00, "Unused"} \
- ,{0x01, "Primary DOS with 12 bit FAT"} \
- ,{0x02, "XENIX / filesystem"} \
- ,{0x03, "XENIX /usr filesystem"} \
- ,{0x04, "Primary DOS with 16 bit FAT"} \
- ,{0x05, "Extended DOS"} \
- ,{0x06, "Primary 'big' DOS (> 32MB)"} \
- ,{0x07, "OS/2 HPFS, QNX or Advanced UNIX"} \
- ,{0x08, "AIX filesystem"} \
- ,{0x09, "AIX boot partition or Coherent"} \
- ,{0x0A, "OS/2 Boot Manager or OPUS"} \
- ,{0x10, "OPUS"} \
- ,{0x40, "VENIX 286"} \
- ,{0x50, "DM"} \
- ,{0x51, "DM"} \
- ,{0x52, "CP/M or Microport SysV/AT"} \
- ,{0x56, "GB"} \
- ,{0x61, "Speed"} \
- ,{0x63, "ISC UNIX, other System V/386, GNU HURD or Mach"} \
- ,{0x64, "Novell Netware 2.xx"} \
- ,{0x65, "Novell Netware 3.xx"} \
- ,{0x75, "PCIX"} \
- ,{0x80, "Minix 1.1 ... 1.4a"} \
- ,{0x81, "Minix 1.4b ... 1.5.10"} \
- ,{0x82, "Linux"} \
- ,{0x93, "Amoeba filesystem"} \
- ,{0x94, "Amoeba bad block table"} \
- ,{0xA5, "FreeBSD/NetBSD/386BSD"} \
- ,{0xA7, "NEXTSTEP"} \
- ,{0xB7, "BSDI BSD/386 filesystem"} \
- ,{0xB8, "BSDI BSD/386 swap"} \
- ,{0xDB, "Concurrent CPM or C.DOS or CTOS"} \
- ,{0xE1, "Speed"} \
- ,{0xE3, "Speed"} \
- ,{0xE4, "Speed"} \
- ,{0xF1, "Speed"} \
- ,{0xF2, "DOS 3.3+ Secondary"} \
- ,{0xF4, "Speed"} \
- ,{0xFF, "BBT (Bad Blocks Table)"} \
-};
diff --git a/sbin/sysinstall/editor.c b/sbin/sysinstall/editor.c
deleted file mode 100644
index f4933bd..0000000
--- a/sbin/sysinstall/editor.c
+++ /dev/null
@@ -1,118 +0,0 @@
-#include <string.h>
-#include <ncurses.h>
-#include <dialog.h>
-
-#include "editor.h"
-
-int
-disp_fields(WINDOW *window, struct field field[], int no_fields)
-{
- int i, j;
- int len;
-
- for (i=0; i < no_fields; i++) {
- wmove(window, field[i].y, field[i].x);
- switch (field[i].type) {
- case F_TITLE:
- case F_EDIT:
- if (field[i].type == F_TITLE)
- wattrset(window, title_attr);
- else
- wattrset(window, dialog_attr);
- len=strlen(field[i].field);
- for (j=0; j < field[i].width; j++)
- if (j < len)
- waddch(window, field[i].field[j]);
- else
- waddch(window, ' ');
- break;
- case F_BUTTON:
- print_button(window, field[i].field,
- field[i].y,
- field[i].x,
- FALSE);
- break;
- }
- }
- wrefresh(window);
- return (0);
-}
-
-int
-change_field(struct field field, int key)
-{
- int next;
-
- switch(key) {
- case KEY_UP:
- next = field.up;
- break;
- case KEY_DOWN:
- next = field.down;
- break;
- case '\t':
- next = field.right;
- break;
- case KEY_BTAB:
- next = field.left;
- break;
- case '\n':
- case '\r':
- next = field.right;
- break;
- default:
- next = -1;
- break;
- }
- return (next);
-}
-
-int
-button_press(WINDOW *window, struct field field)
-{
- int key;
-
- print_button(window, field.field,
- field.y,
- field.x,
- TRUE);
- key = wgetch(window);
-
- switch (key) {
- case '\n':
- case '\r':
- return (0);
- case KEY_UP:
- case KEY_DOWN:
- case KEY_BTAB:
- case '\t':
- default:
- return (key);
- }
-}
-
-int
-toggle_press(WINDOW *window, struct field field)
-{
- int key;
-
- key = wgetch(window);
-
- switch (key) {
- case ' ':
- field.spare++;
- if (!field.misc[field.spare])
- field.spare = 0;
- sprintf(field.field, "%s", field.misc[field.spare]);
- return (key);
- break;
- case '\n':
- case '\r':
- case KEY_UP:
- case KEY_DOWN:
- case KEY_BTAB:
- case '\t':
- default:
- return (key);
- }
-}
diff --git a/sbin/sysinstall/editor.h b/sbin/sysinstall/editor.h
deleted file mode 100644
index 2783cc8..0000000
--- a/sbin/sysinstall/editor.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#define ESC 27
-#define TAB 9
-
-struct field {
- int y;
- int x;
- int width;
- int maxlen;
- int next;
- int up;
- int down;
- int left;
- int right;
- char field[80];
- int type;
- int spare;
- char *misc;
-};
-
-#define F_EDIT 0
-#define F_TITLE 1
-#define F_BUTTON 2
-#define F_TOGGLE 3
-
-int disp_fields(WINDOW *, struct field *, int);
-int change_field(struct field, int);
-int edit_line(WINDOW *, int, int, char *, int, int);
diff --git a/sbin/sysinstall/exec.c b/sbin/sysinstall/exec.c
deleted file mode 100644
index 379f41d..0000000
--- a/sbin/sysinstall/exec.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- *
- * $Id: exec.c,v 1.8.2.1 1994/11/21 03:11:59 phk Exp $
- *
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <string.h>
-#include <dialog.h>
-#include <errno.h>
-#include <fcntl.h>
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/reboot.h>
-
-#include "sysinstall.h"
-
-int
-exec(int magic, char *cmd, char *args, ...)
-{
- int pid, w, status;
- char *argv[EXEC_MAXARG];
- int arg = 0;
- va_list ap;
- struct stat dummy;
-
- if (stat(cmd, &dummy) == -1) {
- Fatal("Executable %s does not exist", cmd);
- }
-
- va_start(ap, args);
- argv[arg++] = (char *)args;
- do {
- if (arg >= EXEC_MAXARG)
- Fatal("Too many arguments");
- } while ((argv[arg++] = va_arg(ap, char *)));
- va_end(ap);
-
- if ((pid = fork()) == 0) {
- switch (magic) {
- case 0:
- close(0); dup(debug_fd);
- close(1); dup(debug_fd);
- close(2); dup(debug_fd);
- close(debug_fd);
- break;
- case 1:
- close(2); dup(debug_fd);
- close(debug_fd);
- break;
- case 2:
- case 3:
- close(debug_fd);
- break;
- case 4:
- close(0) ; open("/stand/sysinstall",O_RDONLY);
- close(1) ; open("/mnt/stand/sysinstall",
- O_WRONLY|O_CREAT|O_TRUNC,0755);
- default:
- break;
- }
- execv(cmd, argv);
- exit(1);
- }
-
- while ((w = wait(&status)) != pid && w != -1)
- ;
- if ((status >> 8) == 20 && magic == 3) /* special case for bininst */
- reboot(RB_AUTOBOOT);
- if (w == -1)
- Fatal("Child process %s terminated abnormally\n", cmd);
- return(status);
-}
diff --git a/sbin/sysinstall/label.c b/sbin/sysinstall/label.c
deleted file mode 100644
index fd0b76e..0000000
--- a/sbin/sysinstall/label.c
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * $Id: label.c,v 1.31 1994/12/27 23:26:51 jkh Exp $
- */
-
-#include <stdlib.h>
-#include <limits.h>
-#define DKTYPENAMES
-#include <sys/param.h>
-#include <ufs/ffs/fs.h>
-#include <sys/types.h>
-#include <string.h>
-#include <sys/disklabel.h>
-#include <ufs/ffs/fs.h>
-
-#include <string.h>
-#include <dialog.h>
-#include "sysinstall.h"
-
-static int
-AskWhichPartition(char *prompt)
-{
- char buf[10];
- int i;
- *buf = 0;
- i = AskEm(stdscr, prompt, buf, 2);
- if (i != '\n' && i != '\r') return -1;
- if (!strchr("abefghABEFGH",*buf)) return -1;
- return tolower(*buf) - 'a';
-}
-
-void
-DiskLabel()
-{
- int i, j, done = 0, diskno, k;
- char buf[128],*p;
- struct disklabel *lbl, olbl;
- struct dos_partition dp[NDOSPART];
-
- u_long cyl, hd, sec, tsec;
- u_long l1, l2, l3, l4;
- char *yip = NULL;
- u_long allocated_space, ourpart_size, ourpart_offset;
-
- *buf = 0;
- i = AskEm(stdscr, "Enter number of disk to Disklabel> ", buf, 3);
- Debug("%d", i);
- if (i != '\n' && i != '\r') return;
- diskno = atoi(buf);
- if (!(diskno >= 0 && diskno < MAX_NO_DISKS && Dname[diskno])) {
- return;
- }
- olbl = *Dlbl[diskno];
- lbl = &olbl;
- cyl = lbl->d_ncylinders;
- hd = lbl->d_ntracks;
- sec = lbl->d_nsectors;
- tsec = lbl->d_secperunit;
- for (i = lbl->d_npartitions; i < MAXPARTITIONS; i++) {
- lbl->d_partitions[i].p_offset = 0;
- lbl->d_partitions[i].p_size = 0;
- lbl->d_partitions[i].p_fstype = 0;
- }
- lbl->d_npartitions = MAXPARTITIONS;
-
- if(Dname[diskno][0] == 's' && Dname[diskno][1] == 'd')
- lbl->d_type = DTYPE_SCSI;
- else
- lbl->d_type = DTYPE_ST506;
-
- while(!done) {
- clear(); standend();
- if (yip) {
- standout();
- mvprintw(24, 0, yip);
- standend();
- beep();
- yip = NULL;
- }
- j = 0;
- mvprintw(j++, 0, "%s -- Diskspace editor -- DISKLABEL", TITLE);
- j++;
-
- allocated_space = 0;
- ourpart_size = lbl->d_partitions[OURPART].p_size;
- ourpart_offset = lbl->d_partitions[OURPART].p_offset;
-
- mvprintw(j++, 0, "Part Start End Blocks MB Type Action Mountpoint");
- for (i = 0; i < MAXPARTITIONS; i++) {
- refresh();
- mvprintw(j++, 0, "%c ", 'a'+i);
- printw(" %8u %8u %8u %5u ",
- lbl->d_partitions[i].p_offset,
- lbl->d_partitions[i].p_offset+
- (lbl->d_partitions[i].p_size ?
- lbl->d_partitions[i].p_size-1 : 0),
- lbl->d_partitions[i].p_size,
- (lbl->d_partitions[i].p_size + 1024)/2048);
-
- k = lbl->d_partitions[i].p_fstype;
- if (k > FSMAXTYPES)
- printw("%04x ", k);
- else
- printw("%-7.7s ", fstypenames[k]);
-
- if(!MP[diskno][i])
- printw(" ");
- else if(!strcmp(Ftype[MP[diskno][i]],"swap"))
- printw("swap ");
- else if(Faction[MP[diskno][i]])
- printw("newfs ");
- else
- printw("mount ");
- if (i == OURPART)
- printw("<Entire FreeBSD slice>");
- else if (i == RAWPART)
- printw("<Entire Disk>");
- else {
- if (Fmount[MP[diskno][i]])
- printw(Fmount[MP[diskno][i]]);
- if ((lbl->d_partitions[i].p_offset >= ourpart_offset) &&
- ((lbl->d_partitions[i].p_offset +
- lbl->d_partitions[i].p_size) <=
- (ourpart_offset + ourpart_size)))
- allocated_space += lbl->d_partitions[i].p_size;
- }
- }
- mvprintw(17, 0, "Total size: %8lu blocks %5luMb",
- ourpart_size, (ourpart_size + 1024)/2048);
- mvprintw(18, 0, "Space allocated: %8lu blocks %5luMb",
- allocated_space, (allocated_space + 1024)/2048);
- mvprintw(20, 0, "Commands available: ");
- if (memcmp(lbl, Dlbl[diskno], sizeof *lbl)) {
- standout();
- printw("Use (W)rite to save changes to disk");
- standend();
- }
- mvprintw(21, 0, "(H)elp (T)utorial (E)dit (A)ssign (D)elete (R)eread (W)rite (Q)uit");
- mvprintw(22, 0, "(P)reserve (S)lice");
- mvprintw(23, 0, "Enter Command> ");
- i=getch();
- switch(i) {
- case 'h': case 'H': case '?':
- clear();
- mvprintw(0, 0,
-"%s -- Diskspace editor -- DISKLABEL -- Command Help
-
-Basic commands:
-
-(H)elp - This screen
-(T)utorial - More detailed information on MBRs, disklabels, etc.
-(E)dit - Edit an existing disklabel entry
-(A)ssign - Assign a filesystem (or swap) to a partition
-(D)elete - Delete an existing disklabel entry
-(R)eread - Re-read disklabel from disk, discarding any changes
-(W)rite - Write updated disklabel information to disk
-(P)reserve - Don't newfs the filesystem (preserve old contents)
-(S)lice - Import foreign slice from MBR (for example, DOS)
-(Q)uit - Exit from the disklabel editor
-
-Press any key to return to Disklabel editor...
-", TITLE);
- getch();
- break;
- case 't': case 'T':
- ShowFile(HELPME_FILE,"Help file for disklayout");
- break;
- case 'd': case 'D':
- j = AskWhichPartition("Delete which partition> ");
- if (j < 0) {
- yip = "Invalid partition";
- break;
- }
- CleanMount(diskno, j);
- lbl->d_partitions[j].p_fstype = FS_UNUSED;
- lbl->d_partitions[j].p_size = 0;
- lbl->d_partitions[j].p_offset = 0;
- break;
-
- case 'p': case 'P':
- j = AskWhichPartition("Preserve which partition> ");
- if (j < 0) {
- yip = "Invalid partition";
- break;
- }
- if (!MP[diskno][j]) {
- yip = "Unmounted partitions are preserved by default";
- break;
- }
- if (lbl->d_partitions[j].p_fstype == FS_SWAP) {
- yip = "swap partitions cannot be preserved.";
- break;
- }
- if (lbl->d_partitions[j].p_fstype != FS_BSDFFS) {
- yip = "All non-ufs partitions are preserved by default.";
- break;
- }
- if (!fixit && !strcmp(Fmount[MP[diskno][j]],"/")) {
- yip = "/ cannot be preserved.";
- break;
- }
- if (!fixit && !strcmp(Fmount[MP[diskno][j]],"/usr")) {
- yip = "/usr cannot be preserved.";
- break;
- }
- if (!fixit && !strcmp(Fmount[MP[diskno][j]],"/var")) {
- yip = "/var cannot be preserved.";
- break;
- }
- Faction[MP[diskno][j]] = 1 - Faction[MP[diskno][j]];
- break;
-
- case 's': case 'S':
- read_dospart(Dfd[diskno],&dp[0]);
- *buf = 0;
- j = AskEm(stdscr,"Import which fdisk slice> ",buf,4);
- if(j != '\n' && j != '\r')
- break;
- i = strtoul(buf,0,0);
- if (i < 1 || i > 4) {
- yip = "Invalid slice, must be '1' to '4'";
- break;
- }
- if (!dp[i-1].dp_size) {
- yip = "empty slice cannot be imported";
- break;
- }
- j = AskWhichPartition("Import on which partition> ");
- if (j < 0) {
- yip = "Invalid partition";
- break;
- }
- CleanMount(diskno, j);
- lbl->d_partitions[j].p_offset = dp[i-1].dp_start;
- lbl->d_partitions[j].p_size = dp[i-1].dp_size;
- switch (dp[i-1].dp_typ) {
- case 0x01:
- case 0x04:
- case 0x06:
- lbl->d_partitions[j].p_fstype=FS_MSDOS;
- break;
- default:
- lbl->d_partitions[j].p_fstype=FS_OTHER;
- break;
- }
- break;
-
- case 'e': case 'E':
- j = AskWhichPartition("Change size of which partition> ");
- if (j < 0) {
- yip = "Invalid partition";
- break;
- }
- if (lbl->d_partitions[j].p_fstype != FS_BSDFFS &&
- lbl->d_partitions[j].p_fstype != FS_UNUSED &&
- lbl->d_partitions[j].p_fstype != FS_SWAP) {
- yip = "Invalid partition type";
- break;
- }
- if (lbl->d_partitions[OURPART].p_size == 0) {
- yip = "No FreeBSD partition defined?";
- break;
- }
- l1=lbl->d_partitions[OURPART].p_offset;
- l2=lbl->d_partitions[OURPART].p_offset +
- lbl->d_partitions[OURPART].p_size;
- for (i = 0; i < MAXPARTITIONS; i++) {
- if (i == OURPART) continue;
- if (i == RAWPART) continue;
- if (i == j) continue;
- if (lbl->d_partitions[i].p_size == 0) continue;
- if (lbl->d_partitions[i].p_offset >= l2) continue;
- if ((lbl->d_partitions[i].p_offset+
- lbl->d_partitions[i].p_size) <= l1) continue;
- l3 = lbl->d_partitions[i].p_offset - l1;
- l4 = l2 - (lbl->d_partitions[i].p_offset+
- lbl->d_partitions[i].p_size);
- if (l3 > 0 && l3 >= l4)
- l2 = l1+l3;
- else if (l4 > 0 && l4 > l3)
- l1 = l2-l4;
- else
- l2 = l1;
- }
- if (!(l2 - l1)) {
- yip = "Sizes unchanged - couldn't find room";
- break;
- }
- sprintf(buf, "%lu", (l2-l1+1024L)/2048L);
- i = AskEm(stdscr, "Size of partition in MB> ", buf, 10);
- l3= strtol(buf, 0, 0) * 2048L;
- if (!l3) {
- yip = "Invalid size given";
- break;
- }
- if (l3 > l2 - l1)
- l3 = l2 - l1;
- lbl->d_partitions[j].p_size = l3;
- lbl->d_partitions[j].p_offset = l1;
- if (j == 1)
- lbl->d_partitions[j].p_fstype = FS_SWAP;
- else
- lbl->d_partitions[j].p_fstype = FS_BSDFFS;
- break;
-
- case 'r': case 'R':
- olbl = *Dlbl[diskno];
- /* XXX be more selective here */
- for (i = 0; i < MAXPARTITIONS; i++)
- CleanMount(diskno, i);
- break;
-
- case 'a': case 'A':
- j = AskWhichPartition("Assign which partition> ");
- if (j < 0) {
- yip = "Invalid partition";
- break;
- }
- k = lbl->d_partitions[j].p_fstype;
- if (k != FS_BSDFFS && k != FS_MSDOS && k != FS_SWAP) {
- yip = "Invalid partition type";
- break;
- }
- if (!lbl->d_partitions[j].p_size) {
- yip = "Zero partition size";
- break;
- }
- if (k == FS_SWAP)
- strcpy(buf, "swap");
- else if (Fmount[MP[diskno][j]])
- strcpy(buf, Fmount[MP[diskno][j]]);
- else
- *buf = 0;
- if (k != FS_SWAP) {
- i = AskEm(stdscr, "Directory mountpoint> ", buf, 28);
- if (i != '\n' && i != '\r')
- break;
- p = buf + strlen(buf) - 1;
-
- while (isspace(*p) && p >= buf)
- *p-- = '\0';
- if (*buf && *buf != '/') {
- yip = "Mountpoint must start with a '/'";
- break;
- }
- }
- CleanMount(diskno, j);
- if (!*buf)
- break;
- p = SetMount(diskno,j,buf);
- yip = p;
- break;
-
- case 'w': case 'W':
- *Dlbl[diskno] = *lbl;
- Dlbl[diskno]->d_magic = DISKMAGIC;
- Dlbl[diskno]->d_magic2 = DISKMAGIC;
- Dlbl[diskno]->d_checksum = 0;
- Dlbl[diskno]->d_checksum = dkcksum(Dlbl[diskno]);
- *lbl = *Dlbl[diskno];
- enable_label(Dfd[diskno]);
- if (ioctl(Dfd[diskno], DIOCSDINFO, Dlbl[diskno]) == -1)
- Fatal("Couldn't set label: %s", strerror(errno));
- if (ioctl(Dfd[diskno], DIOCWDINFO, Dlbl[diskno]) == -1)
- Fatal("Couldn't write label: %s", strerror(errno));
- disable_label(Dfd[diskno]);
- yip = "Label written successfully.";
- break;
-
- case 'q': case 'Q':
- if (!memcmp(lbl, Dlbl[diskno], sizeof *lbl))
- return;
- /* XXX be more selective here */
- for (i = 0; i < MAXPARTITIONS; i++)
- CleanMount(diskno, i);
- return;
- break;
- }
- }
-}
diff --git a/sbin/sysinstall/label.h b/sbin/sysinstall/label.h
deleted file mode 100644
index 7af153e..0000000
--- a/sbin/sysinstall/label.h
+++ /dev/null
@@ -1,52 +0,0 @@
-struct field label_field[] = {
- { 6, 02, 10, 10, -1, -1, -1, -1, -1, "wd0a", F_TITLE, 0, 0},
- { 6, 16, 4, 4, -1, 48, 6, 49, 2, "YES", F_EDIT, 0, 0},
- { 6, 27, 7, 7, -1, 48, 7, 1, 3, "MSDOS", F_EDIT, 0, 0},
- { 6, 39, 5, 5, -1, 49, 8, 2, 4, "1000", F_EDIT, 0, 0},
- { 6, 47, 30, 79, -1, 49, 9, 3, 6, "/an/example/mountpoint", F_EDIT, 0, 0},
- { 8, 02, 4, 4, -1, -1, -1, -1, -1, "wd0b", F_TITLE, 0, 0},
- { 8, 16, 4, 4, -1, 1, 11, 4, 7, "YES", F_EDIT, 0, 0},
- { 8, 27, 7, 7, -1, 2, 12, 6, 8, "MSDOS", F_EDIT, 0, 0},
- { 8, 39, 5, 5, -1, 3, 13, 7, 9, "1000", F_EDIT, 0, 0},
- { 8, 47, 30, 79, -1, 4, 14, 8, 11, "/an/example/mountpoint", F_EDIT, 0, 0},
- {10, 02, 10, 10, -1, -1, -1, -1, -1, "wd0c", F_TITLE, 0, 0},
- {10, 16, 4, 4, -1, 6, 16, 9, 12, "YES", F_EDIT, 0, 0},
- {10, 27, 7, 7, -1, 7, 17, 11, 13, "MSDOS", F_EDIT, 0, 0},
- {10, 39, 5, 5, -1, 8, 18, 12, 14, "1000", F_EDIT, 0, 0},
- {10, 47, 30, 79, -1, 9, 19, 13, 16, "/an/example/mountpoint", F_EDIT, 0, 0},
- {12, 02, 10, 10, -1, -1, -1, -1, -1, "wd0d", F_TITLE, 0, 0},
- {12, 16, 4, 4, -1, 11, 21, 14, 17, "YES", F_EDIT, 0, 0},
- {12, 27, 7, 7, -1, 12, 22, 16, 18, "MSDOS", F_EDIT, 0, 0},
- {12, 39, 5, 5, -1, 13, 23, 17, 19, "1000", F_EDIT, 0, 0},
- {12, 47, 30, 79, -1, 14, 24, 18, 21, "/an/example/mountpoint", F_EDIT, 0, 0},
- {14, 02, 10, 10, -1, -1, -1, -1, -1, "wd0e", F_TITLE, 0, 0},
- {14, 16, 4, 4, -1, 16, 26, 19, 22, "YES", F_EDIT, 0, 0},
- {14, 27, 7, 7, -1, 17, 27, 21, 23, "MSDOS", F_EDIT, 0, 0},
- {14, 39, 5, 5, -1, 18, 28, 22, 24, "1000", F_EDIT, 0, 0},
- {14, 47, 30, 79, -1, 19, 29, 23, 26, "/an/example/mountpoint", F_EDIT, 0, 0},
- {16, 02, 10, 10, -1, -1, -1, -1, -1, "wd0f", F_TITLE, 0, 0},
- {16, 16, 4, 4, -1, 21, 31, 24, 27, "YES", F_EDIT, 0, 0},
- {16, 27, 7, 7, -1, 22, 32, 26, 28, "MSDOS", F_EDIT, 0, 0},
- {16, 39, 5, 5, -1, 23, 33, 27, 29, "1000", F_EDIT, 0, 0},
- {16, 47, 30, 79, -1, 24, 34, 28, 31, "/an/example/mountpoint", F_EDIT, 0, 0},
- {18, 02, 10, 10, -1, -1, -1, -1, -1, "wd0g", F_TITLE, 0, 0},
- {18, 16, 4, 4, -1, 26, 36, 29, 32, "YES", F_EDIT, 0, 0},
- {18, 27, 7, 7, -1, 27, 37, 31, 33, "MSDOS", F_EDIT, 0, 0},
- {18, 39, 5, 5, -1, 28, 38, 32, 34, "1000", F_EDIT, 0, 0},
- {18, 47, 30, 79, -1, 29, 39, 33, 36, "/an/example/mountpoint", F_EDIT, 0, 0},
- {20, 02, 10, 10, -1, -1, -1, -1, -1, "wd0h", F_TITLE, 0, 0},
- {20, 16, 4, 4, -1, 31, 48, 34, 37, "YES", F_EDIT, 0, 0},
- {20, 27, 7, 7, -1, 32, 48, 36, 38, "MSDOS", F_EDIT, 0, 0},
- {20, 39, 5, 5, -1, 33, 49, 37, 39, "1000", F_EDIT, 0, 0},
- {20, 47, 30, 79, 1, 34, 49, 38, 48, "/an/example/mountpoint", F_EDIT, 0, 0},
- { 0, 27, 17, 17, -1, -1, -1, -1, -1, "Disk label editor", F_TITLE, 0, 0},
- { 4, 2, 11, 11, -1, -1, -1, -1, -1, "Partition", F_TITLE, 0, 0},
- { 4, 14, 8, 8, -1, -1, -1, -1, -1, "Preserve", F_TITLE, 0, 0},
- { 4, 25, 10, 10, -1, -1, -1, -1, -1, "Filesystem", F_TITLE, 0, 0},
- { 4, 39, 5, 5, -1, -1, -1, -1, -1, "Size", F_TITLE, 0, 0},
- { 4, 47, 10, 10, -1, -1, -1, -1, -1, "Mountpoint", F_TITLE, 0, 0},
- { 2, 02, 11, 11, -1, -1, -1, -1, -1, "Free space:", F_EDIT, 0, 0},
- { 2, 15, 6, 6, -1, -1, -1, -1, -1, "000000", F_TITLE, 0, 0},
- {22, 20, 2, 2, -1, 36, 1, 39, 49, "OK", F_BUTTON, 0, 0},
- {22, 45, 2, 2, -1, 38, 3, 48, 1, "Cancel", F_BUTTON, 0, 0}
-};
diff --git a/sbin/sysinstall/main.c b/sbin/sysinstall/main.c
deleted file mode 100644
index d1db0e1..0000000
--- a/sbin/sysinstall/main.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- *
- * $Id: main.c,v 1.20 1995/01/30 03:19:52 phk Exp $
- *
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <signal.h>
-
-#include <dialog.h>
-
-#include <sys/ioctl.h>
-#include <sys/reboot.h>
-
-#define EXTERN /* only in main.c */
-
-#include "sysinstall.h"
-
-void
-handle_intr(int sig)
-{
- dialog_clear_norefresh();
- dialog_msgbox("User Interrupt",
- "User interrupted. Aborting the installation",
- -1, -1, 1);
- ExitSysinstall();
-}
-
-int
-main(int argc, char **argv)
-{
- signal(SIGINT, SIG_IGN);
-
- /* Are we running as init? */
- cpio_fd = -1;
- if (getpid() == 1) {
- setsid();
- if (argc > 1 && strchr(argv[1],'C')) {
- /* Kernel told us that we are on a CDROM root */
- close(0); open("/bootcd/dev/console",O_RDWR);
- close(1); dup(0);
- close(2); dup(0);
- cpio_fd = open("/floppies/cpio.flp",O_RDONLY);
- on_cdrom++;
- chroot("/bootcd");
- } else {
- close(0); open("/dev/console",O_RDWR);
- close(1); dup(0);
- close(2); dup(0);
- }
- printf("sysinstall running as init\n\r");
- ioctl(0,TIOCSCTTY,(char *)NULL);
- setlogin("root");
- setbuf(stdin,0);
- setbuf(stdout,0);
- setbuf(stderr,0);
- }
- if (set_termcap() == -1) {
- Fatal("Can't find terminal entry\n");
- }
- /* XXX too early to use fatal ! */
-
- /* XXX - libdialog has particularly bad return value checking */
- init_dialog();
- /* If we haven't crashed I guess dialog is running ! */
- dialog_active = 1;
-
- signal(SIGINT, handle_intr);
-
- if (getpid() != 1) {
- stage0();
- stage1();
- end_dialog();
- dialog_active=0;
- } else if (!access("/this_is_boot_flp",R_OK)) {
- while(1) {
- stage0();
- if(!stage1())
- break;
- }
- stage2();
- end_dialog();
- dialog_active=0;
- reboot(RB_AUTOBOOT);
- } else {
- stage3();
- stage5();
- }
- return 0;
-}
diff --git a/sbin/sysinstall/mbr.c b/sbin/sysinstall/mbr.c
deleted file mode 100644
index 03a85a7..0000000
--- a/sbin/sysinstall/mbr.c
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * Copyright (c) 1994, Paul Richards.
- *
- * All rights reserved.
- *
- * This software may be used, modified, copied, distributed, and
- * sold, in both source and binary form provided that the above
- * copyright and these terms are retained, verbatim, as the first
- * lines of this file. Under no circumstances is the author
- * responsible for the proper functioning of this software, nor does
- * the author assume any responsibility for damages incurred with
- * its use.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <dialog.h>
-#include <fcntl.h>
-
-#include <sys/types.h>
-#include <sys/disklabel.h>
-#include <sys/uio.h>
-
-#include "mbr.h"
-#include "sysinstall.h"
-
-extern struct mbr *mbr;
-extern int inst_part;
-extern int whole_disk;
-
-struct part_type part_types[] = PARTITION_TYPES
-
-char *
-part_type(int type)
-{
- int num_types = (sizeof(part_types)/sizeof(struct part_type));
- int next_type = 0;
- struct part_type *ptr = part_types;
-
- while (next_type < num_types) {
- if(ptr->type == type)
- return(ptr->name);
- ptr++;
- next_type++;
- }
- return("Unknown");
-}
-
-void
-read_dospart(int fd, struct dos_partition *dp)
-{
- u_char buf[512];
- if (lseek(fd, 0, SEEK_SET) == -1)
- AskAbort("Couldn't seek for master boot record read\n");
- if (read(fd, buf, 512) != 512) {
- AskAbort("Failed to read master boot record\n");
- }
- memcpy(dp, buf+DOSPARTOFF, sizeof(*dp)*NDOSPART);
-}
-
-void
-write_dospart(int fd, struct dos_partition *dp)
-{
- u_char buf[512];
-
- if (lseek(fd, 0, SEEK_SET) == -1)
- AskAbort("Couldn't seek for master boot record read\n");
- if (read(fd, buf, 512) != 512) {
- AskAbort("Failed to read master boot record\n");
- }
- memcpy(buf+DOSPARTOFF, dp, sizeof(*dp)*NDOSPART);
- buf[510] = 0x55;
- buf[511] = 0xaa;
- if (lseek(fd, 0, SEEK_SET) == -1)
- AskAbort("Couldn't seek for master boot record write\n");
- enable_label(fd);
- if (write(fd, buf, 512) != 512)
- AskAbort("Failed to write master boot record\n");
- disable_label(fd);
-}
-
-void
-write_bootcode(int fd)
-{
- u_char buf[512];
-
- if (lseek(fd, 0, SEEK_SET) == -1)
- AskAbort("Couldn't seek for master boot record read\n");
- if (read(fd, buf, 512) != 512) {
- AskAbort("Failed to read master boot record\n");
- }
- memcpy(buf, boot0, DOSPARTOFF);
- buf[510] = 0x55;
- buf[511] = 0xaa;
- if (lseek(fd, 0, SEEK_SET) == -1)
- AskAbort("Couldn't seek for master boot record write\n");
- enable_label(fd);
- if (write(fd, buf, 512) != 512)
- AskAbort("Failed to write master boot record\n");
- disable_label(fd);
-}
-
-int
-WriteBootblock(int dfd,struct disklabel *label,struct dos_partition *dospart)
-{
- off_t of = label->d_partitions[OURPART].p_offset;
- u_char bootblocks[BBSIZE];
-
- memcpy(bootblocks, boot1, MBRSIZE);
-
- memcpy(&bootblocks[MBRSIZE], boot2, (int)(label->d_bbsize - MBRSIZE));
-
- bcopy(dospart, &bootblocks[DOSPARTOFF],
- sizeof(struct dos_partition) * NDOSPART);
-
- label->d_checksum = 0;
- label->d_checksum = dkcksum(label);
- bcopy(label, &bootblocks[(LABELSECTOR * label->d_secsize) + LABELOFFSET],
- sizeof *label);
-
- Debug("Seeking to byte %ld ", of * label->d_secsize);
-
- if (lseek(dfd, (of * label->d_secsize), SEEK_SET) < 0) {
- Fatal("Couldn't seek to start of partition\n");
- }
-
- enable_label(dfd);
-
- if (write(dfd, bootblocks, label->d_bbsize) != label->d_bbsize) {
- Fatal("Failed to write bootblocks (%p,%d) %d %s\n",
- bootblocks, label->d_bbsize,
- errno, strerror(errno)
- );
- }
-
- disable_label(dfd);
-
- return(0);
-}
-
-static int
-FillIn(struct dos_partition *dp, int sec, int hd)
-{
- u_long l2,l3=0,sect,c,s,h;
-
- sect = dp->dp_start;
- l2 = sect / (sec*hd);
- sect -= l2*sec*hd;
- if(l2>1023) l2 = 1023;
- c = (l2 & 0xff);
- s = (l2 >> 2) & 0xc0;
- l2 = sect / sec;
- h = l2;
- sect -= l2*sec;
- s |= (sect+1) & 0x3f;
-#define NIC(a,b) if (a != b) {a = b; l3++;}
- NIC(dp->dp_ssect, s);
- NIC(dp->dp_scyl, c);
- NIC(dp->dp_shd, h);
-
- sect = dp->dp_start + dp->dp_size-1;
- l2 = sect / (sec*hd);
- sect -= l2*sec*hd;
- if(l2>1023) l2 = 1023;
- c = (l2 & 0xff);
- s = (l2 >> 2) & 0xc0;
- l2 = sect / sec;
- h = l2;
- sect -= l2*sec;
- s |= (sect+1) & 0x3f;
- NIC(dp->dp_esect, s);
- NIC(dp->dp_ecyl, c);
- NIC(dp->dp_ehd, h);
-#undef NIC
- return l2;
-}
-
-void
-Fdisk()
-{
- int i, j, done=0, diskno, flag;
- char buf[128];
- struct dos_partition dp[NDOSPART];
- struct disklabel *lbl;
- u_long cyl, hd, sec, tsec;
- u_long l, l1, l2, l3, l4;
- int changed = 0;
- char *grumble = NULL;
-
- *buf = 0;
- i = AskEm(stdscr, "Enter number of disk to Fdisk> ", buf, 2);
- printf("%d", i);
- if(i != '\n' && i != '\r') return;
- diskno = atoi(buf);
- if(!(diskno >= 0 && diskno < MAX_NO_DISKS && Dname[diskno])) return;
- lbl = Dlbl[diskno];
- lbl->d_bbsize = 8192;
- hd = lbl->d_ntracks;
- sec = lbl->d_nsectors;
- tsec = Dlbl[diskno]->d_partitions[RAWPART].p_size;
- cyl = tsec/(hd*sec);
- read_dospart(Dfd[diskno], dp);
- while(!done) {
- clear(); standend();
- j = 0;
- mvprintw(j++, 0, "%s -- Diskspace editor -- FDISK", TITLE);
- j++;
- mvprintw(j++, 0,
- "Disk: %s Geometry: %lu Cyl * %lu Hd * %lu Sect",
- Dname[diskno], cyl, hd, sec);
- printw(" = %luMb = %lu Sect", (tsec+1024)/2048, tsec);
- j++;
- for(i=0;i<NDOSPART;i++, j+=4) {
- mvprintw(j, 0, "%d ", i+1);
-#if 0
- printw("[%02x %02x %02x %02x %02x %02x %02x %02x %08lx %08lx]\n",
- dp[i].dp_flag, dp[i].dp_shd, dp[i].dp_ssect, dp[i].dp_scyl,
- dp[i].dp_typ, dp[i].dp_ehd, dp[i].dp_esect, dp[i].dp_ecyl,
- dp[i].dp_start, dp[i].dp_size);
-#endif
- if(!dp[i].dp_size) {
- printw("Unused");
- continue;
- }
- printw("Boot?=%s", dp[i].dp_flag == 0x80 ? "Yes" : "No ");
- printw(" Type=%s\n", part_type(dp[i].dp_typ));
- printw(" Phys=(c%d/h%d/s%d..c%d/h%d/s%d)",
- DPCYL(dp[i].dp_scyl, dp[i].dp_ssect), dp[i].dp_shd,
- DPSECT(dp[i].dp_ssect),
- DPCYL(dp[i].dp_ecyl, dp[i].dp_esect), dp[i].dp_ehd,
- DPSECT(dp[i].dp_esect));
- printw(" Sector=(%lu..%lu)\n",
- dp[i].dp_start, dp[i].dp_size + dp[i].dp_start-1);
- printw(" Size=%lu MB, %lu Cylinders", (dp[i].dp_size+1024L)/2048L,
- dp[i].dp_size/lbl->d_secpercyl);
- l = dp[i].dp_size%lbl->d_secpercyl;
- if(l) {
- printw(" + %lu Tracks", l/lbl->d_nsectors);
- l = l % lbl->d_nsectors;
- if(l) {
- printw(" + %lu Sectors", l);
- }
- }
- }
- mvprintw(20, 0, "Commands available: ");
- mvprintw(21, 0, "(H)elp (T)utorial (D)elete (E)dit (R)eread (W)rite MBR (Q)uit");
- mvprintw(22, 0, "(U)se entire disk for FreeBSD (G)eometry use (B)oot manager");
- if (grumble) {
- standout();
- mvprintw(24, 0, grumble);
- standend();
- grumble = NULL;
- } else if (changed) {
- standout();
- mvprintw(24, 0, "Use (W)rite to save changes to disk");
- standend();
- }
- mvprintw(23, 0, "Enter Command> ");
- i=getch();
- switch(i) {
-
- case 'h': case 'H':
- clear();
- mvprintw(0, 0,
-"%s -- Diskspace editor -- FDISK -- Command Help
-
-Basic commands:
-
-(H)elp - This screen
-(T)utorial - A more detailed discussion of MBR's, disklabels, etc.
-(D)elete - Delete an existing partition
-(E)dit - Edit an existing partition
-(R)eread - Read fdisk information from disk again, abandoning changes
-(W)rite MBR - Write modified fdisk information to disk
-(Q)uit - Exit the FDISK editor
-
-Advanced commands:
-
-(U)se entire disk for FreeBSD - Assign ALL disk space on current drive
-(G)eometry - Edit the default disk geometry settings
-Write (B)oot manager - Install multi-OS bootmanager.
-
-
-Press any key to return to FDISK editor...
-", TITLE);
- getch();
- break;
- case 't': case 'T':
- ShowFile(HELPME_FILE,"Help file for disklayout");
- break;
-
- case 'r': case 'R':
- read_dospart(Dfd[diskno], dp);
- changed=0;
- break;
-
- case 'b': case 'B':
- grumble = 0;
- for(i=0;i<NDOSPART;i++) {
- if(dp[i].dp_start == 0 && dp[i].dp_typ== MBR_PTYPE_FreeBSD) {
- grumble = "Boot manager not needed.";
- break;
- }
- }
- if (!grumble)
- write_bootcode(Dfd[diskno]);
- grumble = "Wrote boot manager";
- break;
-
- case 'e': case 'E':
- *buf = 0;
- i = AskEm(stdscr, "Edit which Slice> ", buf, 2);
- if(i != '\n' && i != '\r') break;
- l = strtol(buf, 0, 0);
- if(l < 1 || l > NDOSPART) break;
- l1=sec; l2=tsec;
- for(i=0;i<NDOSPART;i++) {
- if((i+1) == l) continue;
- if(!dp[i].dp_size) continue;
- if(dp[i].dp_start > l2) continue;
- if((dp[i].dp_start + dp[i].dp_size) <= l1) continue;
- if(dp[i].dp_start > l1)
- l3 = dp[i].dp_start - l1;
- else
- l3 = 0;
- if(l2 > (dp[i].dp_start + dp[i].dp_size))
- l4 = l2 - (dp[i].dp_start + dp[i].dp_size);
- else
- l4 = 0;
- if(l3 >= l4)
- l2 = dp[i].dp_start;
- else
- l1 = dp[i].dp_start + dp[i].dp_size;
- }
- sprintf(buf, "%lu", (l2-l1+1024L)/2048L);
- i = AskEm(stdscr, "Size of slice in MB> ", buf, 10);
- l3=strtol(buf, 0, 0) * 2048L;
- if(!l3) break;
- if(l3 > l2-l1)
- l3 = l2-l1;
- if((l1+l3) % lbl->d_secpercyl) { /* Special for cyl==0 */
- l3 += lbl->d_secpercyl - ((l1+l3) % lbl->d_secpercyl);
- }
- if(l3+l1 > tsec)
- l3 = tsec - l1;
- changed=1;
- dp[l-1].dp_start=l1;
- dp[l-1].dp_size=l3;
- FillIn(&dp[l-1],sec,hd);
-
- l4 = dp[l-1].dp_typ;
- if(!l4) l4 = MBR_PTYPE_FreeBSD;
- sprintf(buf, "0x%lx", l4);
- i = AskEm(stdscr, "Type of slice (0xa5=FreeBSD)> ", buf, 5);
- l3 = strtol(buf, 0, 0);
- if(l3 == MBR_PTYPE_FreeBSD) {
- for(i=0;i<NDOSPART;i++)
- if(i != (l-1) && dp[i].dp_typ== MBR_PTYPE_FreeBSD)
- memset(&dp[i], 0, sizeof dp[i]);
- sprintf(buf, "0x80");
- } else {
- sprintf(buf, "0");
- }
- dp[l-1].dp_typ=l3;
- i = AskEm(stdscr, "Bootflag (0x80 for YES)> ", buf, 5);
- dp[l-1].dp_flag=strtol(buf, 0, 0);
- if(dp[l-1].dp_flag)
- for(i=0;i<NDOSPART;i++)
- if(i != (l-1))
- dp[i].dp_flag = 0;
- break;
-
- case 'u': case 'U':
- memset(&dp[0], 0, sizeof dp);
- changed=1;
-
- dp[0].dp_start = 0;
- dp[0].dp_size = tsec;
- FillIn(&dp[0],sec,hd);
-
- dp[0].dp_typ = MBR_PTYPE_FreeBSD;
- dp[0].dp_flag = 0x80;
- break;
-
- case 'g': case 'G':
- sprintf(buf,"%lu",sec);
- i = AskEm(stdscr, "Number of Sectors> ",buf,7);
- l2 = strtoul(buf,0,0);
- if(l2 != sec)
- changed++;
- sec=l2;
- sprintf(buf,"%lu",hd);
- i = AskEm(stdscr, "Number of Heads> ",buf,7);
- l2 = strtoul(buf,0,0);
- if(l2 != hd)
- changed++;
- hd=l2;
- cyl = tsec/(hd*sec);
- sprintf(buf,"%lu",cyl);
- i = AskEm(stdscr, "Number of Cylinders> ",buf,7);
- l2 = strtoul(buf,0,0);
- if(l2 != cyl)
- changed++;
- cyl=l2;
-
- for (l=0;l<NDOSPART;l++) {
- if (!dp[l].dp_typ || !dp[l].dp_size)
- continue;
- changed += FillIn(&dp[l], sec, hd);
- }
-
- break;
-
- case 'd': case 'D':
- *buf = 0;
- i = AskEm(stdscr, "Delete which Slice> ", buf, 2);
- if(i != '\n' && i != '\r') break;
- l = strtol(buf, 0, 0);
- if(l < 1 || l > NDOSPART) break;
- memset(&dp[l-1], 0, sizeof dp[l-1]);
- changed=1;
- break;
-
- case 'w': case 'W':
- write_dospart(Dfd[diskno], dp);
- Dlbl[diskno]->d_partitions[OURPART].p_offset = 0;
- Dlbl[diskno]->d_partitions[OURPART].p_size = 0;
- for(i=0;i<NDOSPART;i++) {
- if(dp[i].dp_typ == MBR_PTYPE_FreeBSD) {
- Dlbl[diskno]->d_partitions[OURPART].p_offset =
- dp[i].dp_start;
- Dlbl[diskno]->d_partitions[OURPART].p_size =
- dp[i].dp_size;
- goto wok;
- }
- }
- grumble = "No FreeBSD slice, cannot write.";
- break;
-
- wok:
- Dlbl[diskno]->d_ntracks = hd;
- Dlbl[diskno]->d_nsectors = sec;
- Dlbl[diskno]->d_ncylinders = cyl;
- Dlbl[diskno]->d_secpercyl = hd*sec;
- Dlbl[diskno]->d_magic = DISKMAGIC;
- Dlbl[diskno]->d_magic2 = DISKMAGIC;
- Dlbl[diskno]->d_checksum = 0;
- Dlbl[diskno]->d_checksum = dkcksum(Dlbl[diskno]);
- flag=1;
- enable_label(Dfd[diskno]);
- if(ioctl(Dfd[diskno], DIOCSDINFO, Dlbl[diskno]) == -1)
- AskAbort("Couldn't set label: %s", strerror(errno));
- if(ioctl(Dfd[diskno], DIOCWDINFO, Dlbl[diskno]) == -1)
- AskAbort("Couldn't write label: %s", strerror(errno));
- flag=0;
- disable_label(Dfd[diskno]);
- changed=0;
-
- if (Dlbl[diskno]->d_partitions[OURPART].p_size) {
- WriteBootblock(Dfd[diskno], lbl, dp);
- grumble = "Wrote MBR and disklabel to disk";
- } else {
- grumble = "Wrote MBR to disk";
- }
-
- break;
-
- case 'q': case 'Q':
- return;
- break;
- default:
- beep();
- break;
- }
- }
-}
-
diff --git a/sbin/sysinstall/mbr.h b/sbin/sysinstall/mbr.h
deleted file mode 100644
index 9c7d190..0000000
--- a/sbin/sysinstall/mbr.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 1994, Paul Richards.
- *
- * All rights reserved.
- *
- * This software may be used, modified, copied, distributed, and
- * sold, in both source and binary form provided that the above
- * copyright and these terms are retained, verbatim, as the first
- * lines of this file. Under no circumstances is the author
- * responsible for the proper functioning of this software, nor does
- * the author assume any responsibility for damages incurred with
- * its use.
- */
-
-#define MBRSIZE 512
-#define MBR_MAGIC 0xAA55
-#define ACTIVE 0x80
-
-struct mbr
-{
- unsigned char bootcode[DOSPARTOFF];
- struct dos_partition dospart[4];
- unsigned short magic;
-};
-
-struct part_type
-{
- unsigned char type;
- char *name;
-};
-
-#define PARTITION_TYPES \
-{ \
- {0x00, "Unused"} \
- ,{0x01, "Primary DOS with 12 bit FAT"} \
- ,{0x02, "XENIX / filesystem"} \
- ,{0x03, "XENIX /usr filesystem"} \
- ,{0x04, "Primary DOS with 16 bit FAT"} \
- ,{0x05, "Extended DOS"} \
- ,{0x06, "Primary 'big' DOS (> 32MB)"} \
- ,{0x07, "OS/2 HPFS, QNX or Advanced UNIX"} \
- ,{0x08, "AIX filesystem"} \
- ,{0x09, "AIX boot partition or Coherent"} \
- ,{0x0A, "OS/2 Boot Manager or OPUS"} \
- ,{0x10, "OPUS"} \
- ,{0x40, "VENIX 286"} \
- ,{0x50, "DM"} \
- ,{0x51, "DM"} \
- ,{0x52, "CP/M or Microport SysV/AT"} \
- ,{0x56, "GB"} \
- ,{0x61, "Speed"} \
- ,{0x63, "ISC UNIX, other System V/386, GNU HURD or Mach"} \
- ,{0x64, "Novell Netware 2.xx"} \
- ,{0x65, "Novell Netware 3.xx"} \
- ,{0x75, "PCIX"} \
- ,{0x80, "Minix 1.1 ... 1.4a"} \
- ,{0x81, "Minix 1.4b ... 1.5.10"} \
- ,{0x82, "Linux swap"} \
- ,{0x83, "Linux filesystem"} \
- ,{0x93, "Amoeba filesystem"} \
- ,{0x94, "Amoeba bad block table"} \
- ,{0xA5, "FreeBSD/NetBSD/386BSD"} \
- ,{0xA7, "NEXTSTEP"} \
- ,{0xB7, "BSDI BSD/386 filesystem"} \
- ,{0xB8, "BSDI BSD/386 swap"} \
- ,{0xDB, "Concurrent CPM or C.DOS or CTOS"} \
- ,{0xE1, "Speed"} \
- ,{0xE3, "Speed"} \
- ,{0xE4, "Speed"} \
- ,{0xF1, "Speed"} \
- ,{0xF2, "DOS 3.3+ Secondary"} \
- ,{0xF4, "Speed"} \
- ,{0xFF, "BBT (Bad Blocks Table)"} \
-};
-
-extern char *part_type(int);
-extern int write_mbr(int, struct mbr *);
-extern int read_mbr(int, struct mbr *);
-extern void show_mbr(struct mbr *);
-extern int clear_mbr(struct mbr *, char *);
-extern void edit_mbr(struct mbr *, struct disklabel *);
-extern int build_mbr(struct mbr *, char *, struct disklabel *);
diff --git a/sbin/sysinstall/ourcurses.c b/sbin/sysinstall/ourcurses.c
deleted file mode 100644
index 4ee3dec..0000000
--- a/sbin/sysinstall/ourcurses.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Stopgap, until Paul does the right thing */
-#define ESC 27
-#define TAB 9
-
-#include <stdlib.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <string.h>
-
-#include <string.h>
-#include <dialog.h>
-#include "sysinstall.h"
-
-int
-AskEm(WINDOW *w,char *prompt, char *answer, int len)
-{
- int x,y;
- mvwprintw(w,23,0,prompt);
- getyx(w,y,x);
- wclrtoeol(w);
- return line_edit(w,y,x,len,len+1,item_selected_attr,1,answer);
-}
-
-void
-ShowFile(char *filename, char *header)
-{
- char buf[256];
- if (access(filename, R_OK)) {
- sprintf(buf, "The %s file is not provided on the 1.2MB floppy image.", filename);
- dialog_msgbox("Sorry!", buf, -1, -1, 1);
- dialog_clear_norefresh();
- return;
- }
- dialog_clear_norefresh();
- dialog_textbox(header, filename, LINES, COLS);
- dialog_clear_norefresh();
-}
-
diff --git a/sbin/sysinstall/rtermcap.c b/sbin/sysinstall/rtermcap.c
deleted file mode 100644
index 3f18e8b..0000000
--- a/sbin/sysinstall/rtermcap.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <stdio.h>
-#include <termcap.h>
-
-int
-main(int argc, char **argv)
-{
- char buf[4096];
- int i;
-
- i = tgetent(buf, argv[1]);
-
- printf("%s",buf);
- return 0;
-}
diff --git a/sbin/sysinstall/stage0.c b/sbin/sysinstall/stage0.c
deleted file mode 100644
index 8c5a367..0000000
--- a/sbin/sysinstall/stage0.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 1994, Jordan Hubbard, Paul Richards and Poul-Henning Kamp.
- *
- * All rights reserved.
- *
- * This software may be used, modified, copied, distributed, and
- * sold, in both source and binary form provided that the above
- * copyright and these terms are retained, verbatim, as the first
- * lines of this file. Under no circumstances is the author
- * responsible for the proper functioning of this software, nor does
- * the author assume any responsibility for damages incurred with
- * its use.
- *
- * [Note: This file bears almost no resemblance to what was here in an
- * earlier incarnation].
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/reboot.h>
-#include <dialog.h>
-
-#include "sysinstall.h"
-
-static unsigned char *welcome[] = {
- "1. README",
- "READ THIS FIRST.",
- "2. Release Notes",
- "Read the 2.0 Release Notes (recommended).",
- "3. Troubleshooting",
- "Read this in case of trouble.",
- "4. Partitions and MBRs",
- "Verbose description of how these work.",
- "5. COPYRIGHT",
- "Read FreeBSD Copyright Information.",
- "6. Install",
- "Proceed with full installation.",
- "7. Fixit",
- "Repair existing installation (fixit mode).",
- "8. Quit",
- "Don't do anything, just reboot.",
-};
-
-void
-stage0()
-{
-evil_goto:
- if (dialog_menu("Welcome to FreeBSD!",
- "Use ALT-F2 and ALT-F1 to toggle between debugging\ninformation screen (ALT-F2) or this dialog screen (ALT-F1)\n\nPlease select one of the following options:", -1, -1, 8, 8, welcome, selection, NULL, NULL))
- ExitSysinstall();
-
- switch (atoi(selection)) {
- case 1: /* View the README */
- ShowFile(README_FILE, "Read Me First");
- goto evil_goto;
- break;
-
- case 2: /* View the release notes */
- ShowFile(RELNOTES_FILE, "Release Notes");
- goto evil_goto;
- break;
-
- case 3: /* View the troubleshooting file */
- ShowFile(TROUBLE_FILE, "Troubleshooting");
- goto evil_goto;
- break;
-
- case 4: /* View DISK FAQ */
- ShowFile(HELPME_FILE, "DISK FAQ");
- goto evil_goto;
- break;
-
- case 5: /* View copyrights */
- ShowFile(COPYRIGHT_FILE, "COPYRIGHT");
- goto evil_goto;
- break;
-
- case 6: /* Proceed (do nothing special, really) */
- fixit = 0;
- break;
-
- case 7:
- dialog_clear();
- dialog_update();
- dialog_msgbox("WARNING!",
-"The usual install procedure will be invoked, but with most of the
-sanity checks disabled. The suggested course of action is to:
- 1. Go to (F)disk and do a (W)rite, and possibly a (B)oot too
- if your MBR has been wiped.
- 2. Go into (D)isklabel and identify your root (/) and swap
- partitions.
- 3. Select (P)roceed to reboot and load the cpio floppy.
- 4. You will now be in the stand-alone shell, where you may
- conduct further repairs with the tools you'll find in
- /stand.
- 5. Good luck... You'll probably need it.", -1, -1, 1);
- fixit = 1;
- break;
-
- case 8:
- /* Be neat.. */
- ExitSysinstall();
- break; /* hope not! :) */
- }
-}
diff --git a/sbin/sysinstall/stage1.c b/sbin/sysinstall/stage1.c
deleted file mode 100644
index ade697b..0000000
--- a/sbin/sysinstall/stage1.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
-#define DEBUG
- * Copyright (c) 1994, Paul Richards.
- *
- * All rights reserved.
- *
- * This software may be used, modified, copied, distributed, and
- * sold, in both source and binary form provided that the above
- * copyright and these terms are retained, verbatim, as the first
- * lines of this file. Under no circumstances is the author
- * responsible for the proper functioning of this software, nor does
- * the author assume any responsibility for damages incurred with
- * its use.
- */
-
-#include <dialog.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdarg.h>
-
-#include <sys/types.h>
-#include <sys/errno.h>
-#include <sys/disklabel.h>
-#include <sys/ioctl.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-
-#include "sysinstall.h"
-
-char * device_list[] = {"wd","sd",0};
-
-void
-query_disks()
-{
- int i,j;
- char disk[15];
- char diskname[5];
- struct stat st;
- struct disklabel dl;
- int fd;
-
- for(i = 0; i < MAX_NO_DISKS; i++)
- if(Dname[i]) {
- close(Dfd[i]); Dfd[i] = 0;
- free(Dlbl[i]); Dlbl[i] = 0;
- free(Dname[i]); Dname[i] = 0;
- }
-
- Ndisk = 0;
-
- for (j = 0; device_list[j]; j++) {
- for (i = 0; i < 10; i++) {
- sprintf(diskname, "%s%d", device_list[j], i);
- sprintf(disk, "/dev/r%sd", diskname);
- if (stat(disk, &st) || !(st.st_mode & S_IFCHR))
- continue;
- if ((fd = open(disk, O_RDWR)) == -1)
- continue;
- if (ioctl(fd, DIOCGDINFO, &dl) == -1) {
- close(fd);
- continue;
- }
- Dlbl[Ndisk] = Malloc(sizeof dl);
- memcpy(Dlbl[Ndisk], &dl, sizeof dl);
- Dname[Ndisk] = StrAlloc(diskname);
- Dfd[Ndisk] = fd;
- Ndisk++;
- if(Ndisk == MAX_NO_DISKS)
- return;
- }
- }
-}
-
-int
-stage1()
-{
- int i,j;
- int ret=1;
- int ready = 0;
- int foundroot=0,foundusr=0,foundswap=0;
- char *complaint=0;
-
- query_disks();
-
- while (!ready) {
- clear(); standend();
- j = 2;
- if (fixit) {
- mvprintw(j++, 50, "|Suggested course of action:");
- mvprintw(j++, 50, "|");
- mvprintw(j++, 50, "|(F)disk, (W)rite");
- mvprintw(j++, 50, "|possibly (F)disk, (B)oot");
- mvprintw(j++, 50, "|(D)isklabel, (A)ssign <root>");
- mvprintw(j++, 50, "|(A)ssign swap");
- mvprintw(j++, 50, "|(P)roceed");
- mvprintw(j++, 50, "|Reboot");
- mvprintw(j++, 50, "|Load cpio floppy");
- mvprintw(j++, 50, "|Choose stand-alone shell");
- mvprintw(j++, 50, "|");
- mvprintw(j++, 50, "|Your old kernel, /etc/fstab");
- mvprintw(j++, 50, "|and /sbin/init files are");
- mvprintw(j++, 50, "|renamed since they will be");
- mvprintw(j++, 50, "|replaced from this floppy.");
- } else {
- mvprintw(j++, 50, "|You should now assign some");
- mvprintw(j++, 50, "|space to root, swap, and");
- mvprintw(j++, 50, "|(optionally) /usr partitions");
- mvprintw(j++, 50, "|Root (/) should be a minimum");
- mvprintw(j++, 50, "|of 18MB with a 30MB /usr");
- mvprintw(j++, 50, "|or 50MB without a /usr.");
- mvprintw(j++, 50, "|Swap space should be a");
- mvprintw(j++, 50, "|minimum of 12MB or RAM * 2");
- mvprintw(j++, 50, "|Be sure to also (A)ssign a");
- mvprintw(j++, 50, "|mount point to each one or");
- mvprintw(j++, 50, "|it will NOT be enabled.");
- mvprintw(j++, 50, "|");
- mvprintw(j++, 50, "|We suggest that you invoke");
- mvprintw(j++, 50, "|(F)disk, (W)rite bootcode");
- mvprintw(j++, 50, "|then (D)isklabel your disk.");
- mvprintw(j++, 50, "|If installing on a drive");
- mvprintw(j++, 50, "|other than 0, also read the");
- mvprintw(j++, 50, "|TROUBLESHOOTING doc first");
- }
-
- j = 0;
- mvprintw(j++, 0, "%s -- Diskspace editor", TITLE);
- j++;
- mvprintw(j++, 0, "Disks Total FreeBSD ");
- j++;
- for(i = 0; i < MAX_NO_DISKS && Dname[i]; i++) {
- mvprintw(j++, 0, "%2d: %-6s %5lu MB %5lu MB",
- i,
- Dname[i],
- PartMb(Dlbl[i],RAWPART),
- PartMb(Dlbl[i],OURPART));
- }
- j++;
- mvprintw(j++, 0, "Filesystems Type Size Action Mountpoint");
- j++;
- for(i = 0; i < MAX_NO_FS; i++) {
- if(!Fname[i])
- continue;
- if(!strcmp(Ftype[i],"swap")) {
- mvprintw(j++, 0, "%2d: %-5s %-5s %5lu MB %-6s %-s",
- i, Fname[i], Ftype[i], Fsize[i], "swap", Fmount[i]);
- } else {
- mvprintw(j++, 0, "%2d: %-5s %-5s %5lu MB %-6s %-s",
- i, Fname[i], Ftype[i], Fsize[i],
- Faction[i] ? "newfs" : "mount", Fmount[i]);
- }
- }
-
- mvprintw(20, 0, "Commands available:");
- mvprintw(21, 0, "(H)elp (T)utorial (F)disk (D)isklabel (P)roceed (Q)uit");
- if(complaint) {
- standout();
- mvprintw(22, 0, complaint);
- standend();
- complaint = 0;
- }
- mvprintw(23, 0, "Enter Command> ");
- i = getch();
- switch(i) {
- case 'h': case 'H':
- clear();
- mvprintw(0, 0,
-"%s -- Diskspace editor -- Command Help
-
-(T)utorial - Read a more detailed tutorial on how disklabels, MBRs,
- etc. work.
-(P)roceed - Proceed with system installation.
-(Q)uit - Don't install anything.
-(F)disk - Enter the FDISK (MBR) editor.
-(D)isklabel - Enter the disklabel editor.
-
-Press any key to return to Diskspace editor...", TITLE);
- getch();
- break;
- case 't': case 'T':
- ShowFile(HELPME_FILE,"Help file for disklayout");
- break;
- case 'p': case 'P':
- foundroot=0,foundusr=0,foundswap=0;
- for (i = 1; Fmount[i]; i++) {
- if(!strcmp(Fmount[i],"/")) foundroot=i;
- if(!strcmp(Fmount[i],"swap")) foundswap=i;
- if(!strcmp(Fmount[i],"/usr")) foundusr=i;
- }
- if (!foundroot) {
- complaint = "Please assign mountpoint for '/'";
- break;
- }
- if (!foundswap) {
- complaint = "Please assign mountpoint for swap";
- break;
- }
- if (!fixit && !foundusr && Fsize[foundroot] < 60) {
- complaint = "Please assign mountpoint for /usr";
- break;
- }
- if (dialog_yesno("Last Chance!",
- "Are you sure you want to proceed with the installation?\nLast chance before wiping your hard disk!", -1, -1))
- break;
- ret = 0;
- goto leave;
- case 'q': case 'Q':
- ret = 1;
- goto leave;
- case 'f': case 'F':
- Fdisk();
- query_disks();
- break;
- case 'd': case 'D':
- DiskLabel();
- break;
- default:
- beep();
- }
- }
-leave:
- clear();
- for (i = 0; Dname[i]; i++)
- close(Dfd[i]);
- return ret;
-}
-
diff --git a/sbin/sysinstall/stage2.c b/sbin/sysinstall/stage2.c
deleted file mode 100644
index 7d02845..0000000
--- a/sbin/sysinstall/stage2.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- *
- * $Id: stage2.c,v 1.26 1995/03/15 06:16:10 phk Exp $
- *
- */
-
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <fcntl.h>
-#include <dialog.h>
-#include <errno.h>
-
-#include <sys/stat.h>
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/wait.h>
-
-#include "sysinstall.h"
-
-void
-stage2()
-{
- char *p, *q;
- char pbuf[90];
- char dbuf[90];
- FILE *f1;
- int i, j, k;
- int ffd, pfd[2];
- int zpid, cpid;
-
- memset(Fsize, 0, sizeof Fsize);
-
- /* Sort in mountpoint order */
- for (i = 1; Fname[i]; i++)
- Fsize[i] = i;
- Fsize[i] = 0;
-
- for (j = 1; j;)
- for (j = 0, i = 1; Fsize[i+1]; i++) {
- if (strcmp(Fmount[Fsize[i]], Fmount[Fsize[i+1]]) > 0) {
- j = Fsize[i];
- Fsize[i] = Fsize[i+1];
- Fsize[i + 1] = j;
- }
- }
-
- for (j = 1; Fsize[j]; j++) {
- if (strcmp(Ftype[Fsize[j]], "ufs"))
- continue;
- p = Fname[Fsize[j]];
- strcpy(pbuf, "/dev/r");
- strcat(pbuf, p);
- if (!Faction[Fsize[j]]) {
- TellEm("fsck -y /dev/r%s",p);
- i = exec(0, "/stand/fsck", "/stand/fsck", "-y", pbuf, 0);
- if (i)
- Fatal("Exec(/stand/fsck) failed, code=%d.",i);
- } else {
- TellEm("newfs /dev/r%s",p);
- i = exec(0, "/stand/newfs", "/stand/newfs", "-n", "1", pbuf, 0);
- if (i)
- Fatal("Exec(/stand/newfs) failed, code=%d.",i);
- }
- }
-
- for (j = 1; Fsize[j]; j++) {
- if (!strcmp(Ftype[Fsize[j]], "swap"))
- continue;
- strcpy(dbuf, "/mnt");
- p = Fname[Fsize[j]];
- q = Fmount[Fsize[j]];
- if (strcmp(q, "/"))
- strcat(dbuf, q);
- if (!strcmp(Ftype[Fsize[j]], "ufs")) {
- MountUfs(p, dbuf, 1, 0);
- continue;
- } else {
- Mkdir(dbuf, FALSE);
- }
- }
-
- Mkdir("/mnt/etc", TRUE);
- Mkdir("/mnt/dev", TRUE);
- Mkdir("/mnt/mnt", TRUE);
- Mkdir("/mnt/stand", TRUE);
-
- TellEm("unzipping /stand/sysinstall onto hard disk");
- exec(4, "/stand/gzip", "zcat", 0 );
- Link("/mnt/stand/sysinstall","/mnt/stand/cpio");
- Link("/mnt/stand/sysinstall","/mnt/stand/bad144");
- Link("/mnt/stand/sysinstall","/mnt/stand/gunzip");
- Link("/mnt/stand/sysinstall","/mnt/stand/gzip");
- Link("/mnt/stand/sysinstall","/mnt/stand/zcat");
- Link("/mnt/stand/sysinstall","/mnt/stand/newfs");
- Link("/mnt/stand/sysinstall","/mnt/stand/fsck");
- Link("/mnt/stand/sysinstall","/mnt/stand/dialog");
-
- if (fixit) {
- for (i=0;i<100;i++) {
- sprintf(pbuf,"/mnt/etc/fstab.before.fixit.%d",i);
- if (access(pbuf,R_OK)) {
- rename("/mnt/etc/fstab",pbuf);
- break;
- }
- }
- for (i=0;i<100;i++) {
- sprintf(pbuf,"/mnt/kernel.before.fixit.%d",i);
- if (access(pbuf,R_OK)) {
- rename("/mnt/kernel",pbuf);
- break;
- }
- }
- for (i=0;i<100;i++) {
- sprintf(pbuf,"/mnt/sbin/init.before.fixit.%d",i);
- if (access(pbuf,R_OK)) {
- rename("/mnt/sbin/init",pbuf);
- break;
- }
- }
- }
-
- TellEm("make /dev entries");
- chdir("/mnt/dev");
- makedevs();
- chdir("/");
-
- TellEm("Making /mnt/etc/fstab");
- f1 = fopen("/mnt/etc/fstab","w");
- if (!f1)
- Fatal("Couldn't open /mnt/etc/fstab for writing.");
-
- TellEm("Writing filesystems");
- chdir("/mnt");
- for (j = 1; Fsize[j]; j++) {
- if (!strcmp(Ftype[Fsize[j]],"swap"))
- fprintf(f1, "/dev/%s\t\tnone\tswap sw 0 0\n", Fname[Fsize[j]]);
- else {
- fprintf(f1, "/dev/%s\t\t%s\t%s rw 1 1\n",
- Fname[Fsize[j]], Fmount[Fsize[j]], Ftype[Fsize[j]]);
- Mkdir(Fmount[Fsize[j]], FALSE);
- }
- }
- chdir("/");
- TellEm("Writing procfs");
- fprintf(f1,"proc\t\t\t/proc\tprocfs rw 0 0\n");
- fclose(f1);
-
- j = fork();
- if (!j) {
- chroot("/mnt");
- chdir("/");
- ffd = cpio_fd;
- retry:
- while (ffd < 0) {
- dialog_msgbox(TITLE,
- "Insert CPIO floppy in floppy drive 0", -1, -1, 1);
- ffd = open("/dev/rfd0",O_RDONLY);
- if (ffd > 0)
- break;
- Debug("problems opening /dev/rfd0: %d",errno);
- }
- dialog_clear_norefresh();
- TellEm("gunzip < /dev/fd0 | cpio -idum");
- pipe(pfd);
- zpid = fork();
- if (!zpid) {
- close(0); dup(ffd); close(ffd);
- close(1); dup(pfd[1]); close(pfd[1]);
- close(pfd[0]);
- i = exec (1,"/stand/gunzip","/stand/gunzip", 0);
- exit(i);
- }
- cpid = fork();
- if (!cpid) {
- close(0); dup(pfd[0]); close(pfd[0]);
- close(ffd);
- close(pfd[1]);
- close(1); open("/dev/null",O_WRONLY);
- i = exec (1,"/stand/cpio","/stand/cpio","-iduvm", 0);
- exit(i);
- }
- close(pfd[0]);
- close(pfd[1]);
- close(ffd);
- i = wait(&j);
- if (i < 0 || j)
- Fatal("Pid %d, status %d, cpio=%d, gunzip=%d.\nerror:%s",
- i, j, cpid, zpid, strerror(errno));
- i = wait(&j);
- if (i < 0 || j)
- Fatal("Pid %d, status %d, cpio=%d, gunzip=%d.\nerror:%s",
- i, j, cpid, zpid, strerror(errno));
-
- /* bininst.sh MUST be the last file on the floppy */
- if (access("/OK", R_OK) == -1) {
- AskAbort("CPIO floppy was bad! Please check media for defects and retry.");
- ffd = -1;
- goto retry;
- }
- unlink("/OK");
- exit (0);
- }
- i = wait(&k);
- Debug("chroot'er: %d %d %d",i,j,k);
-
-
- sync();
- TellEm("Unmount disks");
- for (j = 1; Fsize[j]; j++)
- continue;
-
- for (j--; j > 0; j--) {
- if (!strcmp(Ftype[Fsize[j]],"swap"))
- continue;
- strcpy(dbuf,"/mnt");
- if (strcmp(Fmount[Fsize[j]],"/"))
- strcat(dbuf, Fmount[Fsize[j]]);
- TellEm("unmount %s", dbuf);
- /* Don't do error-check, we reboot anyway... */
- unmount(dbuf, 0);
- }
- dialog_msgbox(TITLE,"Remove the floppy from the drive\n and hit return to reboot from the hard disk", -1, -1, 1);
- dialog_clear();
-}
diff --git a/sbin/sysinstall/stage3.c b/sbin/sysinstall/stage3.c
deleted file mode 100644
index c08cccb..0000000
--- a/sbin/sysinstall/stage3.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- *
- * $Id: stage3.c,v 1.9.2.1 1994/11/21 03:12:18 phk Exp $
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <dialog.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fstab.h>
-
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-
-#include "sysinstall.h"
-
-void
-stage3()
-{
- char pbuf[90],*p;
- int mountflags;
- struct fstab *fs;
-
- /*
- * Mount things in /etc/fstab we like.
- */
-
- mountflags = MNT_UPDATE;
- while((fs = getfsent()) != NULL) {
- p = fs->fs_spec;
- if (*p++ != '/') continue;
- if (*p++ != 'd') continue;
- if (*p++ != 'e') continue;
- if (*p++ != 'v') continue;
- if (*p++ != '/') continue;
-
- if (!strcmp(fs->fs_type, "sw")) {
- if (swapon(fs->fs_spec) == -1)
- AskAbort("Unable to swap to %s - are you sure it's right?",
- fs->fs_spec);
- continue;
- }
-
- if (strcmp(fs->fs_vfstype, "ufs")) continue;
-
- if (!strcmp(fs->fs_type, "ro"))
- mountflags |= MNT_RDONLY;
- else if (!strcmp(fs->fs_type, "rw"))
- ;
- else
- continue;
- strcpy(pbuf, "/dev/r");
- strcat(pbuf,p);
- TellEm("fsck -y %s",pbuf);
- if (exec(0, "/stand/fsck",
- "/stand/fsck", "-y", pbuf, 0) == -1)
- Fatal("exec(fsck) failed");
-
- MountUfs(p, fs->fs_file, 0, mountflags);
- mountflags = 0;
- }
- endfsent();
-}
diff --git a/sbin/sysinstall/stage4.c b/sbin/sysinstall/stage4.c
deleted file mode 100644
index 4f127ac..0000000
--- a/sbin/sysinstall/stage4.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- *
- * $Id: stage4.c,v 1.12 1995/01/28 01:13:28 jkh Exp $
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <dialog.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "sysinstall.h"
-
-void
-stage4() { /* Obsolete */ }
diff --git a/sbin/sysinstall/stage5.c b/sbin/sysinstall/stage5.c
deleted file mode 100644
index 218233a..0000000
--- a/sbin/sysinstall/stage5.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- *
- * $Id: stage5.c,v 1.17 1994/12/27 23:26:57 jkh Exp $
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <dialog.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-
-#include "sysinstall.h"
-
-static unsigned char msg[] = "
-You are now done with the initial phase of the installation that
-gets FreeBSD onto your hard disk. At this point, we need to go on
-to use FTP, NFS, Tape, CD or DOS floppies to get a bindist onto your
-system so that it's actually usable. Select Yes to proceed with this
-phase, or No to simply drop into a shell.";
-
-void
-stage5()
-{
- int exec_sh = 1;
-
- setenv("PATH","/stand",1);
- for(;;) {
- exec_sh = dialog_yesno("End of initial installation",
- msg, -1, -1);
- end_dialog();
- dialog_active=0;
- if (exec_sh)
- exec (2, "/stand/sh", "/stand/-sh", 0);
- else
- exec (3, "/stand/scripts/bininst.sh",
- "/stand/scripts/-bininst.sh", 0);
- dialog_active=1;
- }
-}
diff --git a/sbin/sysinstall/sysinstall.c b/sbin/sysinstall/sysinstall.c
deleted file mode 100644
index 1d90daa..0000000
--- a/sbin/sysinstall/sysinstall.c
+++ /dev/null
@@ -1,835 +0,0 @@
-/*
-#define DEBUG
- * Copyright (c) 1994, Paul Richards.
- *
- * All rights reserved.
- *
- * This software may be used, modified, copied, distributed, and
- * sold, in both source and binary form provided that the above
- * copyright and these terms are retained, verbatim, as the first
- * lines of this file. Under no circumstances is the author
- * responsible for the proper functioning of this software, nor does
- * the author assume any responsibility for damages incurred with
- * its use.
- */
-
-#include <dialog.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdarg.h>
-
-#include <sys/types.h>
-#include <sys/errno.h>
-#include <sys/disklabel.h>
-#include <sys/ioctl.h>
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/reboot.h>
-#include <sys/stat.h>
-#include <sys/utsname.h>
-#include <sys/wait.h>
-#include <ufs/ffs/fs.h>
-#include <machine/console.h>
-
-#include "mbr.h"
-#include "bootarea.h"
-#include "sysinstall.h"
-
-struct disklabel *avail_disklabels;
-int *avail_fds;
-unsigned char **options;
-unsigned char **avail_disknames;
-unsigned char *scratch;
-unsigned char *errmsg;
-unsigned char *bootblocks;
-struct mbr *mbr;
-struct utsname utsname;
-unsigned char *title = utsname.sysname;
-
-struct sysinstall *sysinstall;
-struct sysinstall *sequence;
-
-int no_disks = 0;
-int inst_disk = 0;
-int inst_part = 0;
-int custom_install;
-int dialog_active = 0;
-
-void exit_sysinstall();
-void abort_installation(char *);
-void exit_prompt();
-void fatal(char *);
-extern char *part_type(int);
-extern int disk_size(int);
-
-/* To make the binary as small as possible these should be malloc'd */
-char selection[30];
-
-void
-abort_installation(char *prompt)
-{
- strcpy(scratch, prompt);
- strcat(scratch,"\n\n Do you wish to abort the installation ?");
- if (!dialog_yesno("Abort installation ?",scratch,10,75))
- exit_prompt();
- dialog_clear();
-}
-
-void
-exit_prompt()
-{
- sprintf(scratch,"Are you sure you want to exit sysinstall?");
- if (!dialog_yesno("Exit sysinstall", scratch, 10, 75))
- exit_sysinstall();
- dialog_clear();
-}
-
-int
-alloc_memory()
-{
- int i;
-
- scratch = (char *)calloc(SCRATCHSIZE, sizeof(char));
- if (!scratch)
- return(-1);
-
- errmsg = (char *)calloc(ERRMSGSIZE, sizeof(char));
- if (!errmsg)
- return(-1);
-
- avail_disklabels =
- (struct disklabel *)calloc(MAX_NO_DISKS, sizeof(struct disklabel));
- if (!avail_disklabels)
- return(-1);
-
- avail_fds = (int *) calloc(MAX_NO_DISKS, sizeof(int));
- if (!avail_fds)
- return(-1);
-
- avail_disknames = (unsigned char **) calloc(MAX_NO_DISKS, sizeof(char *));
- if (!avail_disknames)
- return(-1);
- for (i = 0; i < MAX_NO_DISKS; i++) {
- avail_disknames[i] = (char *)calloc(15, sizeof(char));
- if (!avail_disknames[i])
- return(-1);
- }
-
- options = (unsigned char **)calloc(MAX_NO_DISKS, sizeof(char *));
- if (!options)
- return(-1);
- for (i = 0; i < MAX_NO_DISKS; i++) {
- options[i] = (char *)calloc(100, sizeof(char));
- if (!options[i])
- return(-1);
- }
-
- mbr = (struct mbr *)malloc(sizeof(struct mbr));
- if (!mbr)
- return(-1);
-
- bootblocks = (char *)malloc(BBSIZE);
- if (!bootblocks)
- return(-1);
-
- sysinstall = (struct sysinstall *)malloc(sizeof(struct sysinstall));
- if (!sysinstall)
- return(-1);
-
- sequence = (struct sysinstall *)malloc(sizeof(struct sysinstall));
- if (!sequence)
- return(-1);
- return(0);
-}
-
-void
-free_memory()
-{
- int i;
-
- free(scratch);
- free(errmsg);
- free(avail_disklabels);
- free(avail_fds);
-
- for (i = 0; i < MAX_NO_DISKS; i++)
- free(avail_disknames[i]);
- free(avail_disknames);
-
- for (i = 0; i < MAX_NO_DISKS; i++)
- free(options[i]);
- free(options);
-
- free(mbr);
- free(bootblocks);
- free(sysinstall);
- free(sequence);
-}
-
-void
-exit_sysinstall()
-{
- if (getpid() == 1) {
- if (reboot(RB_AUTOBOOT) == -1)
- if (dialog_active)
- while (1)
- dialog_msgbox("Exit sysinstall",
- "Reboot failed -- hit reset",
- 10, 75, 20);
- else {
- fprintf(stderr, "Reboot failed -- hit reset");
- while (1);
- }
- } else {
- free_memory();
- if (dialog_active)
- end_dialog();
- exit(0);
- }
-}
-
-void
-fatal(char *errmsg)
-{
- if (dialog_active)
- dialog_msgbox("Fatal Error -- Aborting installation",
- errmsg, 10, 75, 20);
- else
- fprintf(stderr, "Fatal Error -- Aborting installation:\n%s\n", errmsg);
- exit_sysinstall();
-}
-
-void
-query_disks()
-{
- int i;
- char disk[15];
- char diskname[5];
- struct stat st;
- int fd;
-
- no_disks = 0;
- for (i = 0; i < 10; i++) {
- sprintf(diskname,"wd%d",i);
- sprintf(disk,"/dev/r%sd",diskname);
- if ((stat(disk, &st) == 0) && (st.st_mode & S_IFCHR))
- if ((fd = open(disk, O_RDWR)) != -1) {
- avail_fds[no_disks] = fd;
- bcopy(diskname, avail_disknames[no_disks], strlen(diskname));
- if (ioctl(fd, DIOCGDINFO, &avail_disklabels[no_disks++]) == -1)
- no_disks--;
- }
- }
-
- for (i=0;i<10;i++) {
- sprintf(diskname,"sd%d",i);
- sprintf(disk,"/dev/r%sd",diskname);
- if ((stat(disk, &st) == 0) && (st.st_mode & S_IFCHR))
- if ((fd = open(disk, O_RDWR)) != -1) {
- avail_fds[no_disks] = fd;
- bcopy(diskname, avail_disknames[no_disks], strlen(diskname));
- if (ioctl(fd, DIOCGDINFO, &avail_disklabels[no_disks++]) == -1)
- no_disks--;
- }
- }
-}
-
-int
-select_disk()
-{
- int i;
- int valid;
-
- do {
- valid = 1;
- sprintf(scratch,"There are %d disks available for installation: ",no_disks);
-
- for (i=0;i<no_disks;i++) {
- sprintf(options[(i*2)], "%d",i+1);
- sprintf(options[(i*2)+1], "%s, (%dMb) -> %s",avail_disklabels[i].d_typename,disk_size(i),avail_disknames[i]);
- }
-
- if (dialog_menu("FreeBSD Installation", scratch, 10, 75, 5, no_disks, options, selection)) {
- sprintf(scratch,"You did not select a valid disk");
- abort_installation(scratch);
- valid = 0;
- }
- dialog_clear();
- } while (!valid);
- return(atoi(selection) - 1);
-}
-
-int
-select_partition(int disk)
-{
- int valid;
- int i;
- int choice;
-
- do {
- valid = 1;
-
- sprintf(scratch,"Select one of the following areas to install to:");
- sprintf(options[0], "%d", 0);
- sprintf(options[1], "%s, (%dMb)", "Install to entire disk",
- disk_size(disk));
- for (i=0; i < NDOSPART; i++) {
- sprintf(options[(i*2)+2], "%d",i+1);
- sprintf(options[(i*2)+3], "%s, (%ldMb)",
- part_type(mbr->dospart[i].dp_typ),
- mbr->dospart[i].dp_size * 512 / (1024 * 1024));
- }
- if (dialog_menu(title,
- scratch, 10, 75, 5, 5, options, selection)) {
- sprintf(scratch,"You did not select a valid partition");
- abort_installation(scratch);
- valid = 0;
- }
- dialog_clear();
- choice = atoi(selection);
- if (!choice)
- if (dialog_yesno(title, "Installing to the whole disk will erase all its present data.\n\nAre you sure you want to do this?", 10, 75))
- valid = 0;
- dialog_clear();
- } while (!valid);
-
- return(atoi(selection) - 1);
-}
-
-int
-exec(char *cmd, char *args, ...)
-{
- int pid, w, status;
- char **argv = NULL;
- int arg = 0;
- int no_args = 0;
- va_list ap;
- struct stat dummy;
-
- if (stat(cmd, &dummy) == -1) {
- sprintf(errmsg, "Executable %s does not exist\n", cmd);
- return(-1);
- }
-
- va_start(ap, args);
- do {
- if (arg == no_args) {
- no_args += 10;
- if (!(argv = realloc(argv, no_args * sizeof(char *)))) {
- sprintf(errmsg, "Failed to allocate memory during exec of %s\n", cmd);
- return(-1);
- }
- if (arg == 0)
- argv[arg++] = (char *)args;
- }
- } while ((argv[arg++] = va_arg(ap, char *)));
- va_end(ap);
-
- if ((pid = fork()) == 0) {
- execv(cmd, argv);
- exit(1);
- }
-
- while ((w = wait(&status)) != pid && w != -1)
- ;
-
- free(argv);
- if (w == -1) {
- sprintf(errmsg, "Child process %s terminated abnormally\n", cmd);
- return(-1);
- }
-
- return(0);
-}
-
-int
-set_termcap()
-{
- char *term;
-
- term = getenv("TERM");
- if (term == NULL) {
- int color_display;
-
- if (setenv("TERMCAP", "/etc/termcap.small", 1) < 0)
- return -1;
- if (ioctl(STDERR_FILENO, GIO_COLOR, &color_display) < 0) {
- char buf[64];
- int len;
-
- /* serial console */
- fprintf(stderr, "Enter your terminal type (must be present in /etc/termcap.small): ");
- if (fgets(buf, sizeof(buf), stdin) == NULL)
- return -1;
- len = strlen(buf);
- if (len > 0 && buf[len-1] == '\n')
- buf[len-1] = '\0';
- if (setenv("TERM", buf, 1) < 0)
- return -1;
- } else if (color_display) {
-
- /* color console */
- if (setenv("TERM", "cons25", 1) < 0)
- return -1;
- } else {
-
- /* mono console */
- if (setenv("TERM", "cons25-m", 1) < 0)
- return -1;
- }
- }
- return 0;
-}
-
-int
-read_status(char *file, struct sysinstall *sysinstall)
-{
- FILE *fd;
-
- if (!(fd = fopen(file, "r"))) {
- sprintf(errmsg, "Couldn't open status file %s for reading\n", file);
- return(-1);
- }
- if (fscanf(fd, "Root device: %s\n", sysinstall->root_dev) == -1) {
- sprintf(errmsg, "Failed to read root device from file %s\n", file);
- return(-1);
- }
- if (fscanf(fd, "Installation media: %s\n", sysinstall->media) == -1) {
- sprintf(errmsg, "Failed to read installation media from file %s\n", file);
- return(-1);
- }
- if (fscanf(fd, "Installation status: %d\n", &sysinstall->status) == -1) {
- sprintf(errmsg, "Status file %s has invalid format\n", file);
- return(-1);
- }
- if (fscanf(fd, "Sequence name: %s\n", sysinstall->seq_name) == -1) {
- sprintf(errmsg, "Failed to read sequence name from file %s\n", file);
- return(-1);
- }
- if (fscanf(fd, "Sequence number: %d of %d\n",
- &sysinstall->seq_no, &sysinstall->seq_size) == -1) {
- sprintf(errmsg, "Failed to read sequence information from file %s\n", file);
- return(-1);
- }
- if (fscanf(fd, "Archive: %s\n", sysinstall->archive) == -1) {
- sprintf(errmsg, "Failed to read archive name from file %s\n", file);
- return(-1);
- }
- if (fclose(fd) != 0) {
- sprintf(errmsg, "Couldn't close file %s after reading status\n", file);
- return(-1);
- }
- return(0);
-}
-
-int
-write_status(char *file, struct sysinstall *sysinstall)
-{
- FILE *fd;
-
- if (!(fd = fopen(file, "w"))) {
- sprintf(errmsg, "Couldn't open status file %s for writing\n", file);
- return(-1);
- }
- if (fprintf(fd, "Root device: %s\n", sysinstall->root_dev) == -1) {
- sprintf(errmsg, "Failed to write root device to file %s\n", file);
- return(-1);
- }
- if (fprintf(fd, "Installation media: %s\n", sysinstall->media) == -1) {
- sprintf(errmsg, "Failed to write installation media to file %s\n", file);
- return(-1);
- }
- if (fprintf(fd, "Installation status: %d\n", sysinstall->status) == -1) {
- sprintf(errmsg, "Failed to write status information to file %s\n", file);
- return(-1);
- }
- if (fprintf(fd, "Sequence name: %s\n", sysinstall->seq_name) == -1) {
- sprintf(errmsg, "Failed to write sequence name to file %s\n", file);
- return(-1);
- }
- if (fprintf(fd, "Sequence number: %d of %d\n",
- sysinstall->seq_no, sysinstall->seq_size) == -1) {
- sprintf(errmsg, "Failed to write sequence information to file %s\n", file);
- return(-1);
- }
- if (fprintf(fd, "Archive: %s\n", sysinstall->archive) == -1) {
- sprintf(errmsg, "Failed to write archive name to file %s\n", file);
- return(-1);
- }
- if (fclose(fd) != 0) {
- sprintf(errmsg, "Couldn't close status file %s after status update\n", file);
- return(-1);
- }
- return(0);
-}
-
-int
-load_floppy(char *device, int seq_no)
-{
- struct ufs_args ufsargs;
-
- ufsargs.fspec = device;
- if (mount(MOUNT_UFS,"/mnt", 0, (caddr_t) &ufsargs) == -1) {
- sprintf(errmsg, "Failed to mount floppy %s: %s\n",scratch, strerror(errno));
- return(-1);
- }
-
- strcpy(scratch, "/mnt/");
- strcat(scratch, STATUSFILE);
- if (read_status(scratch, sequence) == -1) {
- if (unmount("/mnt", 0) == -1) {
- strcat(errmsg, "Error unmounting floppy: ");
- strcat(errmsg, strerror(errno));
- fatal(errmsg);
- }
- return(-1);
- }
-
- if ((bcmp(sequence->seq_name, sysinstall->seq_name,
- sizeof(sequence->seq_name)) != 0) || (sequence->seq_no != seq_no)) {
- sprintf(errmsg, "Mounted floppy is not the one expected\n");
- if (unmount("/mnt", 0) == -1) {
- strcat(errmsg, "Error unmounting floppy: ");
- strcat(errmsg, strerror(errno));
- fatal(errmsg);
- }
- return(-1);
- }
-
- return(0);
-}
-
-void
-stage1()
-{
- int i;
- int ok = 0;
- int ready = 0;
- struct ufs_args ufsargs;
-
- while (!ready) {
- ready = 1;
-
- query_disks();
- inst_disk = select_disk();
-
-#ifdef DEBUG
- read_mbr(avail_fds[inst_disk], mbr);
- show_mbr(mbr);
-#endif
-
- if (read_mbr(avail_fds[inst_disk], mbr) == -1) {
- sprintf(scratch, "The following error occured will trying to read the master boot record:\n\n%s\n\nIn order to install FreeBSD a new master boot record will have to be written which will mean all current data on the hard disk will be lost.", errmsg);
- ok = 0;
- while (!ok) {
- abort_installation(scratch);
- if (!dialog_yesno(title, "Are you sure you wish to proceed?",
- 10, 75)) {
- dialog_clear();
- clear_mbr(mbr);
- ok = 1;
- }
- }
- }
-
- if (custom_install)
- if (!dialog_yesno(title, "Do you wish to edit the DOS partition table?",
- 10, 75)) {
- dialog_clear();
- edit_mbr(mbr, &avail_disklabels[inst_disk]);
- }
-
- inst_part = select_partition(inst_disk);
-
- ok = 0;
- while (!ok) {
- if (build_mbr(mbr, &avail_disklabels[inst_disk]))
- ok = 1;
- else {
- sprintf(scratch, "The DOS partition table is inconsistent.\n\n%s\n\nDo you wish to edit it by hand?", errmsg);
- if (!dialog_yesno(title, scratch, 10, 75)) {
- edit_mbr(mbr, &avail_disklabels[inst_disk]);
- dialog_clear();
- } else {
- abort_installation("");
- ok = 1;
- ready = 0;
- }
- }
- }
-
- default_disklabel(&avail_disklabels[inst_disk],
- mbr->dospart[inst_part].dp_size,
- mbr->dospart[inst_part].dp_start);
- build_bootblocks(&avail_disklabels[inst_disk]);
-
- if (ready) {
- if (dialog_yesno(title, "We are now ready to format the hard disk for FreeBSD.\n\nSome or all of the disk will be overwritten during this process.\n\nAre you sure you wish to proceed ?", 10, 75)) {
- abort_installation("");
- ready = 0;
- }
- dialog_clear();
- }
- }
-
- /* Write master boot record and bootblocks */
- write_mbr(avail_fds[inst_disk], mbr);
- write_bootblocks(avail_fds[inst_disk],
- mbr->dospart[inst_part].dp_start,
- avail_disklabels[inst_disk].d_bbsize);
-
-#ifdef DEBUG
- read_mbr(avail_fds[inst_disk], mbr);
- show_mbr(mbr);
-#endif
-
- /* close all the open disks */
- for (i=0; i < no_disks; i++)
- if (close(avail_fds[i]) == -1) {
- sprintf(errmsg, "Error on closing file descriptors: %s\n",
- strerror(errno));
- fatal(errmsg);
- }
-
- /* newfs the root partition */
- strcpy(scratch, avail_disknames[inst_disk]);
- strcat(scratch, "a");
- if (exec("/sbin/newfs","/sbin/newfs", scratch, 0) == -1)
- fatal(errmsg);
-
- /* newfs the /usr partition */
- strcpy(scratch, avail_disknames[inst_disk]);
- strcat(scratch, "e");
- if (exec("/sbin/newfs", "/sbin/newfs", scratch, 0) == -1)
- fatal(errmsg);
-
- strcpy(scratch, "/dev/");
- strcat(scratch, avail_disknames[inst_disk]);
- strcat(scratch, "a");
- ufsargs.fspec = scratch;
- if (mount(MOUNT_UFS,"/mnt", 0, (caddr_t) &ufsargs) == -1) {
- sprintf(errmsg, "Error mounting %s: %s\n",scratch, strerror(errno));
- fatal(errmsg);
- }
-
- if (mkdir("/mnt/usr",S_IRWXU) == -1) {
- sprintf(errmsg, "Couldn't create directory /mnt/usr: %s\n",
- strerror(errno));
- fatal(errmsg);
- }
-
- if (mkdir("/mnt/mnt",S_IRWXU) == -1) {
- sprintf(errmsg, "Couldn't create directory /mnt/mnt: %s\n",
- strerror(errno));
- fatal(errmsg);
- }
-
- strcpy(scratch, "/dev/");
- strcat(scratch, avail_disknames[inst_disk]);
- strcat(scratch, "e");
- ufsargs.fspec = scratch;
- if (mount(MOUNT_UFS,"/mnt/usr", 0, (caddr_t) &ufsargs) == -1) {
- sprintf(errmsg, "Error mounting %s: %s\n",scratch, strerror(errno));
- fatal(errmsg);
- }
-
- if (exec("/bin/cp","/bin/cp","/kernel","/mnt", 0) == -1) {
- sprintf(errmsg, "Couldn't copy /kernel to /mnt: %s\n",strerror(errno));
- fatal(errmsg);
- }
- if (exec("/bin/cp","/bin/cp","/sysinstall","/mnt", 0) == -1) {
- sprintf(errmsg, "Couldn't copy /sysinstall to /mnt: %s\n",
- strerror(errno));
- fatal(errmsg);
- }
- if (exec("/bin/cp","/bin/cp","-R","/etc","/mnt", 0) == -1) {
- sprintf(errmsg, "Couldn't copy /etc to /mnt: %s\n",strerror(errno));
- fatal(errmsg);
- }
- if (exec("/bin/cp","/bin/cp","-R","/sbin","/mnt", 0) == -1) {
- sprintf(errmsg, "Couldn't copy /sbin to /mnt: %s\n",strerror(errno));
- fatal(errmsg);
- }
- if (exec("/bin/cp","/bin/cp","-R","/bin","/mnt", 0) == -1) {
- sprintf(errmsg, "Couldn't copy /bin to /mnt: %s\n",strerror(errno));
- fatal(errmsg);
- }
- if (exec("/bin/cp","/bin/cp","-R","/dev","/mnt", 0) == -1) {
- sprintf(errmsg, "Couldn't copy /dev to /mnt: %s\n",strerror(errno));
- fatal(errmsg);
- }
- if (exec("/bin/cp","/bin/cp","-R","/usr","/mnt", 0) == -1) {
- sprintf(errmsg, "Couldn't copy /usr to /mnt: %s\n",strerror(errno));
- fatal(errmsg);
- }
-
- sysinstall->status = DISK_READY;
- bcopy(avail_disknames[inst_disk], sysinstall->root_dev,
- strlen(avail_disknames[inst_disk]));
- sprintf(scratch, "/mnt/etc/%s", STATUSFILE);
- if (write_status(scratch, sysinstall) == -1)
- fatal(errmsg);
-
- if (unmount("/mnt/usr", 0) == -1) {
- sprintf(errmsg, "Error unmounting /mnt/usr: %s\n", strerror(errno));
- fatal(errmsg);
- }
-
- if (unmount("/mnt", 0) == -1) {
- sprintf(errmsg, "Error unmounting /mnt: %s\n", strerror(errno));
- fatal(errmsg);
- }
-}
-
-void
-stage2()
-{
- int i;
- struct ufs_args ufsargs;
-
- ufsargs.fspec = sysinstall->root_dev;
- if (mount(MOUNT_UFS,"/", 0, (caddr_t) &ufsargs) == -1) {
- sprintf(errmsg, "Failed to mount root read/write: %s\n%s", strerror(errno), ufsargs.fspec);
- fatal(errmsg);
- }
-
- sprintf(scratch, "Insert floppy %d in drive\n", sysinstall->seq_no + 1);
- dialog_msgbox("Stage 2 installation", scratch, 10, 75, 1);
- i = load_floppy(sysinstall->media, sysinstall->seq_no + 1);
- while (i == -1) {
- dialog_msgbox("Stage 2 installation",errmsg, 10, 75, 1);
- sprintf(scratch, "Please insert installation floppy %d in the boot drive", sysinstall->seq_no + 1);
- dialog_msgbox("Stage 2 installation",scratch, 10, 75, 1);
- i = load_floppy(sysinstall->media, sysinstall->seq_no + 1);
- };
- if (exec("/bin/cp","/bin/cp","/mnt/pax","/bin", 0) == -1) {
- sprintf(errmsg, "Couldn't copy /mnt/pax to /bin %s\n",strerror(errno));
- fatal(errmsg);
- }
- if (exec("/bin/pax", "/bin/pax", "-r", "-f", sequence->archive, 0) == -1) {
- sprintf(errmsg, "Failed to extract from archive file %s\n", sequence->archive);
- fatal(errmsg);
- }
-
- sysinstall->status = INSTALLED_BASE;
- sprintf(scratch, "/etc/%s", STATUSFILE);
- if (write_status(scratch, sysinstall) == -1)
- fatal(errmsg);
-
- if (unmount("/mnt", 0) == -1) {
- strcat(errmsg, "Error unmounting floppy: ");
- strcat(errmsg, strerror(errno));
- fatal(errmsg);
- }
-}
-
-/*
- * This is the overall plan: (phk's version)
- *
- * If (pid == 1)
- * reopen stdin, stdout, stderr, and do various other magic.
- *
- * If (file exists /this_is_boot.flp)
- * stage0:
- * present /COPYRIGHT
- * present /README
- * stage1:
- * Ask about diskallocation and do the fdisk/disklabel stunt.
- * stage2:
- * Do newfs, mount and copy over a minimal world.
- * make /mnt/etc/fstab. Install ourself as /mnt/sbin/init
- * Else
- * stage3:
- * Read cpio.flp and fiddle around with the bits a bit.
- * stage4:
- * Read bin-tarballs:
- * Using ftp
- * Using NFS (?)
- * Using floppy
- * Using tape
- * Using shell-prompt
- * stage5:
- * Extract bin-tarballs
- * stage6:
- * Ask various questions and collect answers into system-config
- * files.
- * stage7:
- * execl("/sbin/init");
- */
-
-void
-main(int argc, char **argv)
-{
- int i;
-
- /* phk's main */
- if (argc > 1 && !strcmp(argv[1],"phk")) {
- return Xmain(argc,argv);
- }
-
- /* paul's main */
- /* Are we running as init? */
- if (getpid() == 1) {
- close(0); open("/dev/console", O_RDWR);
- close(1); dup(0);
- close(2); dup(0);
- i = 1;
- ioctl(0,TIOCSPGRP,&i);
- setlogin("root");
- }
-
- if (set_termcap() == -1)
- fatal("Can't find terminal entry\n");
-
- if (alloc_memory() == -1)
- fatal("Couldn't allocate memory\n");
-
-#if 0 /* Later. Our kernels don't say the right thing at present anyway */
- if (uname(&utsname) == -1) {
- /* Fake uname entry */
- bcopy("FreeBSD", utsname.sysname, strlen("FreeBSD"));
- }
-#else
- bcopy(TITLE, utsname.sysname, strlen(TITLE));
-#endif
-
- /* XXX - libdialog has particularly bad return value checking */
- init_dialog();
- /* If we haven't crashed I guess dialog is running ! */
- dialog_active = 1;
-
- strcpy(scratch, "/etc/");
- strcat(scratch, STATUSFILE);
- if (read_status(scratch, sysinstall) == -1) {
- fatal(errmsg);
- }
-
- switch(sysinstall->status) {
- case NOT_INSTALLED:
- stage1();
- dialog_msgbox("Stage 1 complete",
- "Remove all floppy disks from the drives and hit return to reboot from the hard disk",
- 10, 75, 1);
- if (reboot(RB_AUTOBOOT) == -1)
- fatal("Reboot failed");
- break;
-
- case DISK_READY:
- dialog_msgbox("Stage 2 install", "Hi!", 10, 75, 1);
- stage2();
- dialog_msgbox("Stage 2 complete",
- "Well, this is as far as it goes so far :-)\n",
- 10, 75, 1);
- break;
-
- case INSTALLED_BASE:
- break;
-
- default:
- fatal("Unknown installation status");
- }
- exit_sysinstall();
-}
diff --git a/sbin/sysinstall/sysinstall.h b/sbin/sysinstall/sysinstall.h
deleted file mode 100644
index e127123..0000000
--- a/sbin/sysinstall/sysinstall.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 1994, Paul Richards.
- *
- * All rights reserved.
- *
- * This software may be used, modified, copied, distributed, and
- * sold, in both source and binary form provided that the above
- * copyright and these terms are retained, verbatim, as the first
- * lines of this file. Under no circumstances is the author
- * responsible for the proper functioning of this software, nor does
- * the author assume any responsibility for damages incurred with
- * its use.
- */
-
-#define TITLE "FreeBSD 2.0-950418-SNAP Install"
-
-#define MAX_NO_DISKS 10
-#define MAX_NO_FS 30
-#define MAXFS MAX_NO_FS
-
-#define BBSIZE 8192 /* Actually in ufs/ffs/fs.h I think */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <ncurses.h>
-#include <string.h>
-#include <errno.h>
-#include <dialog.h>
-#include <ctype.h>
-
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/dkbad.h>
-#include <sys/disklabel.h>
-
-#define SCRATCHSIZE 1024
-#define ERRMSGSIZE 256
-#define DEFROOTSIZE 18
-#define DEFSWAPSIZE 16
-#define DEFUSRSIZE 80
-#define DEFFSIZE 1024
-#define DEFFRAG 8
-
-#define BOOT_MAGIC 0xAA55
-#define ACTIVE 0x80
-
-#define COPYRIGHT_FILE "/COPYRIGHT"
-#define README_FILE "/README"
-#define HELPME_FILE "/DISKSPACE.FAQ"
-#define TROUBLE_FILE "/TROUBLESHOOTING"
-#define RELNOTES_FILE "/RELNOTES.FreeBSD"
-
-#ifndef EXTERN
-# define EXTERN extern
-#endif
-
-extern unsigned char boot0[];
-extern unsigned char boot1[];
-extern unsigned char boot2[];
-
-/* All this "disk" stuff */
-EXTERN int Ndisk;
-EXTERN struct disklabel *Dlbl[MAX_NO_DISKS];
-EXTERN char *Dname[MAX_NO_DISKS];
-EXTERN int Dfd[MAX_NO_DISKS];
-
-EXTERN int MP[MAX_NO_DISKS][MAXPARTITIONS];
-
-/* All this "filesystem" stuff */
-EXTERN int Nfs;
-EXTERN char *Fname[MAX_NO_FS+1];
-EXTERN char *Fmount[MAX_NO_FS+1];
-EXTERN char *Ftype[MAX_NO_FS+1];
-EXTERN int Faction[MAX_NO_FS+1];
-EXTERN u_long Fsize[MAX_NO_FS+1];
-
-EXTERN int dialog_active;
-EXTERN char selection[];
-EXTERN int debug_fd;
-EXTERN int dialog_active;
-EXTERN int fixit;
-
-EXTERN int on_serial;
-EXTERN int on_cdrom;
-EXTERN int cpio_fd;
-
-extern int no_disks;
-extern int inst_disk;
-extern unsigned char *scratch;
-extern unsigned char *errmsg;
-extern u_short dkcksum(struct disklabel *);
-
-/* utils.c */
-void Abort __P((void));
-void ExitSysinstall __P((void));
-void TellEm __P((char *fmt, ...));
-void Debug __P((char *fmt, ...));
-void stage0 __P((void));
-void *Malloc __P((size_t size));
-char *StrAlloc __P((char *str));
-void Fatal __P((char *fmt, ...));
-void AskAbort __P((char *fmt, ...));
-void MountUfs __P((char *device, char *mountpoint, int do_mkdir,int flags));
-void Mkdir __P((char *path, int die));
-void Link __P((char *from, char *to));
-void CopyFile __P((char *p1, char *p2));
-u_long PartMb(struct disklabel *lbl,int part);
-char * SetMount __P((int disk, int part, char *path));
-void CleanMount __P((int disk, int part));
-void enable_label __P((int fd));
-void disable_label __P((int fd));
-
-/* exec.c */
-int exec __P((int magic, char *cmd, char *args, ...));
-#define EXEC_MAXARG 100
-
-/* stage0.c */
-void stage0 __P((void));
-
-/* stage1.c */
-int stage1 __P((void));
-
-/* stage2.c */
-void stage2 __P((void));
-
-/* stage3.c */
-void stage3 __P((void));
-
-/* stage5.c */
-void stage5 __P((void));
-
-/* termcap.c */
-int set_termcap __P((void));
-
-/* makedevs.c */
-int makedevs __P((void));
-
-/* ourcurses.c */
-int AskEm __P((WINDOW *w,char *prompt, char *answer, int len));
-void ShowFile __P((char *filename, char *header));
-
-/* mbr.c */
-int build_bootblocks __P((int dfd,struct disklabel *label,struct dos_partition *dospart));
-void Fdisk __P((void));
-void read_dospart __P((int, struct dos_partition *));
-
-/* label.c */
-void DiskLabel __P((void));
diff --git a/sbin/sysinstall/termcap.c b/sbin/sysinstall/termcap.c
deleted file mode 100644
index bd1e086..0000000
--- a/sbin/sysinstall/termcap.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 1994, Paul Richards.
- *
- * All rights reserved.
- *
- * This software may be used, modified, copied, distributed, and sold, in both
- * source and binary form provided that the above copyright and these terms
- * are retained, verbatim, as the first lines of this file. Under no
- * circumstances is the author responsible for the proper functioning of this
- * software, nor does the author assume any responsibility for damages
- * incurred with its use.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <fcntl.h>
-#include <machine/console.h>
-
-#include "sysinstall.h"
-
-int
-set_termcap()
-{
- char *term;
- extern const char termcap_vt100[];
- extern const char termcap_cons25[];
- extern const char termcap_cons25_m[];
-
- term = getenv("TERM");
- if (term == NULL) {
- int color_display;
-
- if (ioctl(STDERR_FILENO, GIO_COLOR, &color_display) < 0) {
- if (setenv("TERM", "vt100", 1) < 0)
- return -1;
- if (setenv("TERMCAP", termcap_vt100, 1) < 0)
- return -1;
- debug_fd = dup(1);
- on_serial++;
- } else if (color_display) {
- if (setenv("TERM", "cons25", 1) < 0)
- return -1;
- if (setenv("TERMCAP", termcap_cons25, 1) < 0)
- return -1;
- debug_fd = open("/dev/ttyv1",O_WRONLY);
- } else {
- if (setenv("TERM", "cons25-m", 1) < 0)
- return -1;
- if (setenv("TERMCAP", termcap_cons25_m, 1) < 0)
- return -1;
- debug_fd = open("/dev/ttyv1",O_WRONLY);
- }
- } else {
- debug_fd = open("sysinstall.debug",
- O_WRONLY|O_CREAT|O_TRUNC,0644);
- }
- return 0;
-}
diff --git a/sbin/sysinstall/utils.c b/sbin/sysinstall/utils.c
deleted file mode 100644
index 243b191..0000000
--- a/sbin/sysinstall/utils.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- *
- * $Id: utils.c,v 1.35 1995/01/14 10:31:29 jkh Exp $
- *
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <string.h>
-#include <dialog.h>
-#include <errno.h>
-
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/reboot.h>
-#include <sys/dkbad.h>
-#include <sys/disklabel.h>
-
-#include "sysinstall.h"
-
-void
-strip_trailing_newlines(char *p)
-{
- int len = strlen(p);
- while (len > 0 && p[len-1] == '\n')
- p[--len] = '\0';
-}
-
-void
-Debug(char *fmt, ...)
-{
- char *p;
- va_list ap;
- p = Malloc(2048);
- va_start(ap,fmt);
- vsnprintf(p, 2048, fmt, ap);
- va_end(ap);
- write(debug_fd,"Debug <",7);
- write(debug_fd,p,strlen(p));
- write(debug_fd,">\n\r",3);
- free(p);
-}
-
-void
-TellEm(char *fmt, ...)
-{
- char *p;
- va_list ap;
- p = Malloc(2048);
- va_start(ap,fmt);
- vsnprintf(p, 2048, fmt, ap);
- va_end(ap);
- strip_trailing_newlines(p);
- write(debug_fd,"Progress <",10);
- write(debug_fd,p,strlen(p));
- write(debug_fd,">\n\r",3);
- if(!on_serial) {
- dialog_clear_norefresh();
- dialog_msgbox("Progress", p, -1, -1, 0);
- }
- free(p);
-}
-
-void
-Fatal(char *fmt, ...)
-{
- char *p;
- va_list ap;
- p = Malloc(2048);
- va_start(ap,fmt);
- vsnprintf(p, 2048, fmt, ap);
- va_end(ap);
- strip_trailing_newlines(p);
- if (dialog_active && !on_serial)
- dialog_msgbox("Fatal", p, -1, -1, 1);
- else
- fprintf(stderr, "Fatal -- %s\n", p);
- free(p);
- ExitSysinstall();
-}
-
-void
-AskAbort(char *fmt, ...)
-{
- char *p;
- va_list ap;
-
- p = Malloc(2048);
- va_start(ap,fmt);
- vsnprintf(p, 2048, fmt, ap);
- va_end(ap);
- strcat(p, "\n\nDo you wish to abort the installation?");
- if (!dialog_yesno("Abort", p, -1, -1)) {
- dialog_clear_norefresh();
- Abort();
- }
- dialog_clear();
- free(p);
-}
-
-void
-Abort()
-{
- if (dialog_yesno("Exit sysinstall","\n\nAre you sure you want to quit?",
- -1, -1)) {
- dialog_clear();
- return;
- }
- ExitSysinstall();
-}
-
-void
-ExitSysinstall()
-{
- if (dialog_active) {
- clear();
- dialog_update();
- }
- if (getpid() == 1) {
- if (reboot(RB_AUTOBOOT) == -1)
- if (dialog_active) {
- clear();
- dialog_msgbox(TITLE, "\n\nCan't reboot machine -- hit reset button",
- -1,-1,0);
- } else
- fprintf(stderr, "Can't reboot the machine -- hit the reset button");
- while(1);
- } else {
- if (dialog_active) {
- end_dialog();
- dialog_active = 0;
- }
- exit(0);
- }
-}
-
-void *
-Malloc(size_t size)
-{
- void *p = malloc(size);
- if (!p) {
- exit(7); /* XXX longjmp bad */
- }
- return p;
-}
-
-char *
-StrAlloc(char *str)
-{
- char *p;
-
- p = (char *)Malloc(strlen(str) + 1);
- strcpy(p,str);
- return p;
-}
-
-void
-MountUfs(char *device, char *mountpoint, int do_mkdir, int flags)
-{
- struct ufs_args ufsargs;
- char dbuf[90];
-
- memset(&ufsargs,0,sizeof ufsargs);
-
- if(do_mkdir && access(mountpoint,R_OK)) {
- Mkdir(mountpoint, TRUE);
- }
-
- strcpy(dbuf,"/dev/");
- strcat(dbuf,device);
-
- TellEm("mount %s %s",dbuf,mountpoint);
- ufsargs.fspec = dbuf;
- if (mount(MOUNT_UFS, mountpoint, flags, (caddr_t) &ufsargs) == -1) {
- Fatal("Error mounting %s on %s : %s\n",
- dbuf, mountpoint, strerror(errno));
- }
-}
-
-void
-Mkdir(char *ipath, int die)
-{
- struct stat sb;
- int final=0;
- char *p,*path=StrAlloc(ipath);
-
- Debug("mkdir(%s)",path);
- p = path;
- if (p[0] == '/') /* Skip leading '/'. */
- ++p;
- for (;!final; ++p) {
- if (p[0] == '\0' || (p[0] == '/' && p[1] == '\0'))
- final++;
- else if (p[0] != '/')
- continue;
- *p = '\0';
- if (stat(path, &sb)) {
- if (errno != ENOENT && die)
- Fatal("Couldn't stat directory %s: %s\n",
- path,strerror(errno));
- Debug("mkdir(%s..)",path);
- if (mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO) < 0 &&
- die)
- Fatal("Couldn't create directory %s: %s\n",
- path,strerror(errno));
- }
- *p = '/';
- }
- free(path);
- return;
-}
-
-void
-Link(char *from, char *to)
-{
- TellEm("ln %s %s", from, to);
- if(fixit)
- unlink(to);
- if (link(from, to) == -1)
- Fatal("Couldn't create link: %s -> %s\n", from, to);
-}
-
-void
-CopyFile(char *p1, char *p2)
-{
- char buf[BUFSIZ];
- int fd1,fd2;
- int i;
- struct stat st;
-
- TellEm("Copy %s to %s",p1,p2);
- fd1 = open(p1,O_RDONLY);
- if (fd1 < 0) Fatal("Couldn't open %s: %s\n",p1,strerror(errno));
- fd2 = open(p2,O_TRUNC|O_CREAT|O_WRONLY,0200);
- if (fd2 < 0) Fatal("Couldn't open %s: %s\n",p2,strerror(errno));
- for(;;) {
- i = read(fd1,buf,sizeof buf);
- if (i > 0)
- if (i != write(fd2,buf,i)) {
- Fatal("Write errror on %s: %s\n",
- p2,strerror(errno));
- }
- if (i != sizeof buf)
- break;
- }
- fstat(fd1,&st);
- fchmod(fd2,st.st_mode & 07777);
- fchown(fd2,st.st_uid,st.st_gid);
- close(fd1);
- close(fd2);
-}
-
-u_long
-PartMb(struct disklabel *lbl,int part)
-{
- u_long l;
- l = 1024*1024/lbl->d_secsize;
- return (lbl->d_partitions[part].p_size + l/2)/l;
-}
-
-void
-CleanMount(int disk, int part)
-{
- int i = MP[disk][part];
- Faction[i] = 0;
- if (Fmount[i]) {
- free(Fmount[i]);
- Fmount[i] = 0;
- }
- if (Fname[i]) {
- free(Fname[i]);
- Fname[i] = 0;
- }
- if (Ftype[i]) {
- free(Ftype[i]);
- Ftype[i] = 0;
- }
- MP[disk][part] = 0;
-}
-
-char *
-SetMount(int disk, int part, char *path)
-{
- int k;
- char buf[80];
-
- CleanMount(disk,part);
- for (k = 1; k < MAX_NO_FS; k++)
- if (!Fmount[k])
- break;
-
- if (k >= MAX_NO_FS)
- return "Maximum number of filesystems exceeded";
-
- Fmount[k] = StrAlloc(path);
- sprintf(buf, "%s%c", Dname[disk], part + 'a');
- Fname[k] = StrAlloc(buf);
- switch (Dlbl[disk]->d_partitions[part].p_fstype) {
- case FS_BSDFFS:
- Ftype[k] = StrAlloc("ufs");
- if(!fixit)
- Faction[k] = 1;
- break;
- case FS_MSDOS:
- Ftype[k] = StrAlloc("msdos");
- Faction[k] = 0;
- break;
- case FS_SWAP:
- Ftype[k] = StrAlloc("swap");
- Faction[k] = 1;
- break;
- default:
- CleanMount(disk,part);
- return "Unknown filesystem-type";
- }
- Fsize[k] = (Dlbl[disk]->d_partitions[part].p_size+1024)/2048;
-
- MP[disk][part] = k;
- return NULL;
-}
-
-void
-enable_label(int fd)
-{
- int flag = 1;
- if (ioctl(fd, DIOCWLABEL, &flag) < 0)
- Fatal("ioctl(DIOCWLABEL,1) failed: %s",strerror(errno));
-}
-
-void
-disable_label(int fd)
-{
- int flag = 0;
- if (ioctl(fd, DIOCWLABEL, &flag) < 0)
- Fatal("ioctl(DIOCWLABEL,0) failed: %s",strerror(errno));
-}
-
diff --git a/secure/bin/Makefile b/secure/bin/Makefile
deleted file mode 100644
index 7af79b3..0000000
--- a/secure/bin/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# From: @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $Id: Makefile,v 1.2 1994/09/18 21:25:26 wollman Exp $
-
-SUBDIR= ed
-
-.include <bsd.subdir.mk>
diff --git a/secure/bin/Makefile.inc b/secure/bin/Makefile.inc
deleted file mode 100644
index 98638a3..0000000
--- a/secure/bin/Makefile.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-# @(#)Makefile.inc 8.1 (Berkeley) 5/31/93
-
-BINDIR?= /bin
-NOSHARED?= YES
-.include "${.CURDIR}/../../Makefile.inc"
diff --git a/secure/bin/ed/Makefile b/secure/bin/ed/Makefile
deleted file mode 100644
index bd04941..0000000
--- a/secure/bin/ed/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# $Id: Makefile,v 1.2 1994/11/21 02:58:43 phk Exp $
-
-PROG= ed
-SRCS= buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c
-.PATH: ${.CURDIR}/../../../bin/ed
-LINKS= ${BINDIR}/ed ${BINDIR}/red
-NOMAN= true
-
-CFLAGS+=-DDES
-LDADD+= -L${CRYPTOBJDIR} -ldescrypt
-DPADD+= ${CRYPTOBJDIR}/libdescrypt.a
-
-.include <bsd.prog.mk>
diff --git a/secure/libexec/Makefile b/secure/libexec/Makefile
deleted file mode 100644
index 9bd4d2e..0000000
--- a/secure/libexec/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# From: @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $Id: Makefile,v 1.2 1995/07/25 14:03:35 mark Exp $
-
-SUBDIR= telnetd
-
-.include <bsd.subdir.mk>
diff --git a/secure/sbin/Makefile b/secure/sbin/Makefile
deleted file mode 100644
index 32ef1f1..0000000
--- a/secure/sbin/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# $Id: Makefile,v 1.1 1994/09/07 07:16:49 pst Exp $
-
-SUBDIR= init
-
-.include <bsd.subdir.mk>
-
diff --git a/secure/sbin/Makefile.inc b/secure/sbin/Makefile.inc
deleted file mode 100644
index d8e8fa0..0000000
--- a/secure/sbin/Makefile.inc
+++ /dev/null
@@ -1,6 +0,0 @@
-# $Id: Makefile.inc,v 1.1 1994/09/07 07:16:50 pst Exp $
-
-BINDIR= /sbin
-
-NOSHARED?= YES
-.include "${.CURDIR}/../../Makefile.inc"
diff --git a/secure/sbin/init/Makefile b/secure/sbin/init/Makefile
deleted file mode 100644
index 48147c5..0000000
--- a/secure/sbin/init/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 7/19/93
-
-PROG= init
-NOMAN= true
-DPADD= ../../lib/libcrypt/libdescrypt.a ${LIBUTIL}
-LDADD= -L../../lib/libcrypt -lutil -ldescrypt
-.PATH: ${.CURDIR}/../../../sbin/init
-BINMODE=500
-INSTALLFLAGS=-fschg
-CFLAGS+=-DDEBUGSHELL -DSECURE
-
-.include <bsd.prog.mk>
diff --git a/share/FAQ/CONTRIB.FreeBSD b/share/FAQ/CONTRIB.FreeBSD
deleted file mode 100644
index 6b77670..0000000
--- a/share/FAQ/CONTRIB.FreeBSD
+++ /dev/null
@@ -1,245 +0,0 @@
- FreeBSD 2.0
- Contributor List
-
-
-
-Derived Software Contributors:
-
-This software was originally derived from William F. Jolitz's 386BSD
-release 0.1, though almost none of the original 386BSD specific code
-remains. This software has been essentially reimplemented from the
-4.4 BSD Lite release provided by the Computer Science Research Group
-(CSRG) at the University of California, Berkeley and associated academic
-contributors.
-
-There are also portions of NetBSD that have been integrated into FreeBSD
-as well, and we would therefore like to thank all the contributors
-to NetBSD for their work. Despite some occasionally rocky moments in
-relations between the two groups, we both want essentially the same
-thing: More BSD based operating systems on people's computers! We
-wish the NetBSD group every success in their endevors.
-
-
-Hardware Contributors:
-
-A special thank-you to Walnut Creek CDROM for providing the Pentium P5-90
-and 486/DX2-66 EISA/VL systems that are being used for our development work,
-to say nothing of the network access and other donations of hardware
-resources. It would have been impossible to do this release without
-their support.
-
-TRW Financial Systems, Inc. provided 130 PCs, three 68 GB fileservers,
-twelve ethernets, two routers and an ATM switch for debugging the diskless
-code. They also keep a couple of FreeBSD hackers alive and busy. Thanks!
-
-Thanks also to Dermot McDonnell for his donation of a Toshiba XM3401B CDROM
-drive. It's been most useful!
-
-
-The FreeBSD Core Team [also the Board of Directors for The FreeBSD Project]
-(in alphabetical order):
-
- Andreas Schulz <ats@FreeBSD.org>
- Andrey A. Chernov <ache@FreeBSD.org>
- Bruce Evans <bde@FreeBSD.org>
- David Greenman <davidg@FreeBSD.org>
- Garrett A. Wollman <wollman@FreeBSD.org>
- Gary Palmer <gpalmer@FreeBSD.org>
- Geoff Rehmet <csgr@FreeBSD.org>
- Jack Vogel <jackv@FreeBSD.org>
- John Dyson <dyson@FreeBSD.org>
- Jordan K. Hubbard <jkh@FreeBSD.org>
- Justin Gibbs <gibbs@FreeBSD.org>
- Nate Williams <nate@FreeBSD.org>
- Paul Richards <paul@FreeBSD.org>
- Poul-Henning Kamp <phk@FreeBSD.org>
- Rich Murphey <rich@FreeBSD.org>
- Rodney W. Grimes <rgrimes@FreeBSD.org>
- Søren Schmidt <sos@FreeBSD.org>
-
-
-Officers, The FreeBSD Project:
-
- President: Jordan K. Hubbard <jkh@FreeBSD.org>
- Principle Architect: David Greenman <davidg@FreeBSD.org>
-
-
-Directors, The FreeBSD Project:
-
- Documentation: John Fieber <jfieber@FreeBSD.org>
- Internationalization: Andrey A. Chernov <ache@FreeBSD.org>
- Networking: Garrett A. Wollman <wollman@FreeBSD.org>
- Postmaster: Jonathan M. Bresler <jmb@FreeBSD.org>
- Release Coordinator: Poul-Henning Kamp <phk@FreeBSD.org>
- System Administration: Gary Palmer <gpalmer@FreeBSD.org>
- WEBMASTERS: John Fieber <jfieber@FreeBSD.org> and
- James L. Robinson <jlrobin@FreeBSD.org>
- XFree86 Project, Inc: (Liaison) Rich Murphey <rich@FreeBSD.org>
-
-
-Additional FreeBSD Contributors
-(in alphabetical order by first name, just to be different):
-
-Adam Glass <glass@postgres.berkeley.edu>
-Andreas Klemm <andreas@knobel.GUN.de>
-Andrew Herbert <andrew@werple.apana.org.au>
-Andrew Moore <alm@FreeBSD.org>
-Atsushi Murai <amurai@spec.co.jp>
-Bill Paul <wpaul@FreeBSD.org>
-Bob Wilcox <bob@obiwan.uucp>
-Bruce Evans <bde@kralizec.zeta.org.au>
-Charles Hannum <mycroft@ai.mit.edu>
-Chris G. Demetriou <cgd@postgres.berkeley.edu>
-Christian Gusenbauer <cg@fimp01.fim.uni-linz.ac.at>
-Chris Torek <torek@ee.lbl.gov>
-Christoph Robitschko <chmr@edvz.tu-graz.ac.at>
-Curt Mayer <curt@toad.com>
-Dave Burgess <burgess@hrd769.brooks.af.mil>
-Dave Rivers <rivers@ponds.uucp>
-David Dawes <dawes@physics.su.OZ.AU>
-Frank Maclachlan <fpm@crash.cts.com>
-Gary A. Browning <gab10@griffcd.amdahl.com>
-Gary Clark II <gclarkii@radon.gbdata.com>
-Gary Jennejohn <gj%pcs.dec.com@inet-gw-1.pa.dec.com>
-Gene Stark <stark@cs.sunysb.edu>
-Guido van Rooij <guido@gvr.win.tue.nl>
-Havard Eidnes <Havard.Eidnes@runit.sintef.no>
-Holger Veit <Holger.Veit@gmd.de>
-Ishii Masahiro, R. Kym Horsell
-J.T. Conklin <jtc@winsey.com>
-James Clark <jjc@jclark.com>
-James da Silva <jds@cs.umd.edu> et al
-Jim Wilson <wilson@moria.cygnus.com>
-Jörg Wunsch <joerg_wunsch@uriah.heep.sax.de>
-Julian Elischer <julian@dialix.oz.au>
-Julian Stacey <stacey@guug.de> <fallback: <julian@meepmeep.pcs.com>>
-Keith Bostic <bostic@toe.CS.Berkeley.EDU>
-Keith Moore <?>
-L Jonas Olsson <ljo@po.cwru.edu>
-Marc Frajola <marc@escargot.rain.com>
-Mark Murray <mark@grondar.za>
-Mark Tinguely <tinguely@plains.nodak.edu> <tinguely@hookie.cs.ndsu.NoDak.edu>
-Martin Birgmeier
-Matt Thomas <thomas@lkg.dec.com>
-Ollivier Robert <roberto@FreeBSD.org>
-Paul Kranenburg <pk@cs.few.eur.nl>
-Paul Mackerras <paulus@cs.anu.edu.au>
-Paul Traina <pst@cisco.com>
-Poul-Henning Kamp <phk@login.dkuug.dk>
-Chris Provenzano <proven@athena.mit.edu>
-Rob Shady <rls@id.net>
-Sascha Wildner <swildner@channelz.GUN.de>
-Satoshi Asami <asami@FreeBSD.org>
-Scott Mace <smace@FreeBSD.org>
-Sean Eric Fagan <sef@kithrup.com>
-Serge V. Vakulenko <vak@zebub.msk.su>
-Stefan Esser <se@MI.Uni-Koeln.DE>
-Stephen McKay <syssgm@devetir.qld.gov.au>
-Steven Wallace <swallace@ece.uci.edu>
-Søren Schmidt <sos@login.dkuug.dk>
-Tatsumi Hosokawa <hosokawa@mt.cs.keio.ac.jp>
-Terry Lee <terry@uivlsi.csl.uiuc.edu>
-Theo Deraadt <deraadt@fsa.ca>
-Ugen J.S.Antsilevich <ugen@NetVision.net.il>
-Wolfgang Stanglmeier <wolf@kintaro.cologne.de>
-Wolfram Schneider <wosch@cs.tu-berlin.de>
-Yuval Yarom <yval@cs.huji.ac.il>
-Yves Fonk <yves@cpcoup5.tn.tudelft.nl>
-
-
-386BSD Patch kit patch contributors (in alphabetical order):
-
-Adam Glass <glass@postgres.berkeley.edu>
-Adrian Hall <adrian@ibmpcug.co.uk>
-Andrey A. Chernov <ache@astral.msk.su>
-Andrew Herbert <andrew@werple.apana.org.au>
-Andrew Moore <alm@netcom.com>
-Andy Valencia <ajv@csd.mot.com> <jtk@netcom.com>
-Arne Henrik Juul <arnej@Lise.Unit.NO>
-Bakul Shah <bvs@bitblocks.com>
-Barry Lustig <barry@ictv.com>
-Bob Wilcox <bob@obiwan.uucp>
-Branko Lankester
-Brett Lymn <blymn@mulga.awadi.com.AU>
-Bruce Evans <bde@kralizec.zeta.org.au>
-Charles Hannum <mycroft@ai.mit.edu>
-Chris G. Demetriou <cgd@postgres.berkeley.edu>
-Chris Torek <torek@ee.lbl.gov>
-Christoph Robitschko <chmr@edvz.tu-graz.ac.at>
-Daniel Poirot <poirot@aio.jsc.nasa.gov>
-Dave Burgess <burgess@hrd769.brooks.af.mil>
-Dave Rivers <rivers@ponds.uucp>
-David Dawes <dawes@physics.su.OZ.AU>
-David Greenman <davidg@Root.COM>
-Eric J. Haug <ejh@slustl.slu.edu>
-Felix Gaehtgens <felix@escape.vsse.in-berlin.de>
-Frank Maclachlan <fpm@crash.cts.com>
-Gary A. Browning <gab10@griffcd.amdahl.com>
-Geoff Rehmet <csgr@alpha.ru.ac.za>
-Goran Hammarback <goran@astro.uu.se>
-Guido van Rooij <guido@gvr.win.tue.nl>
-Guy Harris <guy@auspex.com>
-Havard Eidnes <Havard.Eidnes@runit.sintef.no>
-Herb Peyerl <hpeyerl@novatel.cuc.ab.ca
-Holger Veit <Holger.Veit@gmd.de>
-Ishii Masahiro, R. Kym Horsell
-J.T. Conklin <jtc@winsey.com>
-Jagane D Sundar < jagane@netcom.com >
-James Clark <jjc@jclark.com>
-James Jegers <jimj@miller.cs.uwm.edu>
-James W. Dolter
-James da Silva <jds@cs.umd.edu> et al
-Jay Fenlason <hack@datacube.com>
-Jim Wilson <wilson@moria.cygnus.com>
-Joerg Lohse <lohse@tech7.informatik.uni-hamburg.de>
-Jörg Wunsch <joerg_wunsch@uriah.heep.sax.de>
-John Dyson - <formerly dyson@ref.tfs.com>
-John Woods <jfw@eddie.mit.edu>
-Jordan K. Hubbard <jkh@whisker.hubbard.ie>
-Julian Elischer <julian@dialix.oz.au>
-Julian Stacey <stacey@guug.de> <fallback: <julian@meepmeep.pcs.com>>
-Karl Lehenbauer <karl@NeoSoft.com> <karl@one.neosoft.com>
-Keith Bostic <bostic@toe.CS.Berkeley.EDU>
-Ken Hughes
-Kent Talarico <kent@shipwreck.tsoft.net>
-Kevin Lahey <kml%rokkaku.UUCP@mathcs.emory.edu> <kml@mosquito.cis.ufl.edu>
-Marc Frajola <marc@escargot.rain.com>
-Mark Tinguely <tinguely@plains.nodak.edu> <tinguely@hookie.cs.ndsu.NoDak.edu>
-Martin Renters <martin@innovus.com>
-Michael Galassi <nerd@percival.rain.com>
-Mike Durkin <mdurkin@tsoft.sf-bay.org>
-Nate Williams <nate@bsd.coe.montana.edu>
-Nick Handel <nhandel@NeoSoft.com> <nick@madhouse.neosoft.com>
-Pace Willisson <pace@blitz.com>
-Paul Kranenburg <pk@cs.few.eur.nl>
-Paul Mackerras <paulus@cs.anu.edu.au>
-Paul Popelka <paulp@uts.amdahl.com>
-Peter da Silva <peter@NeoSoft.com>
-Phil Sutherland <philsuth@mycroft.dialix.oz.au>
-Poul-Henning Kamp <phk@login.dkuug.dk>
-Ralf Friedl <friedl@informatik.uni-kl.de>
-Rich Murphey <rich@lamprey.utmb.edu>
-Rick Macklem <root@snowhite.cis.uoguelph.ca>
-Robert D. Thrush <rd@phoenix.aii.com>
-Rodney W. Grimes <rgrimes@cdrom.com>
-Rog Egge <?>
-Sascha Wildner <swildner@channelz.GUN.de>
-Scott Burris <scott@pita.cns.ucla.edu>
-Scott Reynolds <scott@clmqt.marquette.mi.us>
-Sean Eric Fagan <sef@kithrup.com>
-Simon J Gerraty <sjg@melb.bull.oz.au> <sjg@zen.void.oz.au>
-Stephen McKay <syssgm@devetir.qld.gov.au>
-Terry Lambert <terry@icarus.weber.edu>
-Terry Lee <terry@uivlsi.csl.uiuc.edu>
-Warren Toomey <wkt@csadfa.cs.adfa.oz.au>
-Wiljo Heinen <wiljo@freeside.ki.open.de>
-William Jolitz <withheld>
-Wolfgang Solfrank <ws@tools.de>
-Wolfgang Stanglmeier <wolf@dentaro.GUN.de>
-Yuval Yarom <yval@cs.huji.ac.il>
-
-Last, but not least, the release engineer would like to thank:
- His Wife, for chocolate chip cookies, and some other things.
- The DGB project @ TFS, for patience and tolerance.
-
-$Id: CONTRIB.FreeBSD,v 1.24 1995/03/16 22:01:57 phk Exp $
diff --git a/share/FAQ/DISKSPACE.FAQ b/share/FAQ/DISKSPACE.FAQ
deleted file mode 100644
index 14bd082..0000000
--- a/share/FAQ/DISKSPACE.FAQ
+++ /dev/null
@@ -1,265 +0,0 @@
- How to assign disk space to FreeBSD.
-
-1.0 Getting started.
----------------------
-
-After a general introduction, you will find some explanation on what you
-need to do to assign space to FreeBSD on your disk(s). This is done
-through the "sysinstall" program, which lives on the inital boot floppy.
-Those already expert with PCs may wish to skip ahead to section 1.2, the
-rest of you may (or may not) enjoy the brief history lesson.
-
-
-1.1 The ins and outs of allocating disk storage on your PC.
-------------------------------------------------------------
-
-Modern hard disk drives are now getting big enough that people don't want
-to allocate all of one to just one operating system anymore, especially
-given the increasing size of disk drives (the latest 9.0 Gbyte models
-holding the equivalent of some six thousand 1.44MB floppies!) and the
-virtual explosion of operating system options available for the PC. To
-solve this problem, IBM came up with a scheme for "slicing" the disks
-into more manageable chunks, or partitions. It works, but only just.
-To better understand why, first a brief bit of history:
-
-MS-DOS, when hard disk support was unceremoniously grafted on back in the
-late eighties, didn't have such "slices". What it had was a way to install
-Xenix and MS-DOS on the same disk (Remember when Microsoft were in the UNIX
-business?).
-
-In the first sector on the disk was a piece of "primary boot code" and a
-table with four entries. Each of those entries pointed at an arbitrary
-slice of the disk, with one of them was marked "active". The machine would
-boot by reading the first sector containing the boot code into RAM and then
-jumping to it. The job of this small piece of boot code was to look at
-the 4 entry table and decide which OS was to be booted by looking
-for the "active" flag. It would go and load the first sector of that slice
-of the disk into RAM and then and jump to it in turn. This bit of boot
-code was called the "secondary boot", and could be specific to a given
-operating system. The primary boot code and 4-entry table is known
-as the Master Boot Record, or MBR, and is very important to the proper
-operation of your PC! We will discuss the MBR in more detail later.
-
-It was later realized, with the hindsight that IBM is famous for, that disks
-could be bigger than the 32Mb that the early DOS FAT-12 file system could
-handle, so they added a kludge: They had two MSDOS slices, a "Primary" and
-a "Secondary". The primary could still only be 32Mb, but the Secondary had
-no size limit. And the trick was that the secondary had ANOTHER "table
-entry" so that now suddenly up to 5 slices could be available to MS-DOS.
-The Secondary boot record was later made recursive, thus effectively
-avoiding any fixed limit. Of course, they were still stuck with a maximum
-of 26 slices given the use of "drive letters" in DOS. They also reserved
-only 10 bits for cylinder addressing, limiting DOS to being able to address
-a maximum of 1024 cylinders (and cause of the dreaded "cylinder translation"
-kludges, the misconfiguration of which many users have seen as the notorious
-"Missing Operating System" message). Yes, truly DOS was and is an utterly
-terrible operating system, which of course explains its amazing degree of
-success. Anyway, this all brings us up to today, which is where FreeBSD
-comes in:
-
-
-1.2 What FreeBSD does
-----------------------
-FreeBSD has, like any other UNIX-like operating system, the concept of
-"partitions." Partitions are used to implement its own "slicing"
-abstraction, and although there is no real difference between a slice and a
-partition as such, we use the two words to distinguish between these two
-different levels of slicing.
-
-The result is that we have a two-tier structure on the disk:
-
-+-----------+
-| MBR-table |
-+-----------+ +---------+
-| Slice 1 | -----> | MSDOS |
-+-----------+ +---------+
-| Slice 2 |
-+-----------+ +-------------------+
-| Slice 3 | -----> | FreeBSD-disklabel |
-+-----------+ +-------------------+ +-----------------+
-| Slice 4 | | Partition A | -----> | Root-filesystem |
-+-----------+ +-------------------+ +-----------------+
- | Partition B | ---
- +-------------------+ \ +----------------+
- | Partition C | --> | swap-partition |
- +-------------------+ +----------------+
- | ... |
-
-
-Here are the rules that FreeBSD plays by:
-
-A: FreeBSD always has an MBR slice with type 0xa5 (each of the 4 slices can
- also have a unique integer identifier so you can tell your DOS slices
- from your FreeBSD slices from your Linux slices, etc). This means that
- there should always be an MBR record, even in the case where FreeBSD
- occupies the entire disk.
-B: The FreeBSD slice contains the FreeBSD disklabel in the second sector
- (remember, the first sector contains the secondary boot code for FreeBSD,
- which is what prints that FreeBSD prompt at you when you first boot
- FreeBSD from a floppy or hard disk).
-C: The 'C' partition in the FreeBSD disklabel corresponds to the entire
- FreeBSD slice.
-D: The 'D' partition corresponds to the entire physical disk.
-E: Should a disk not have a FreeBSD slice (because there simply is no
- FreeBSD on it anywhere), then the MBR slices are mapped into partitions
- 'E' to 'H' of an artificially created FreeBSD disklabel. This is useful
- for getting at DOS-only disks.
-
-Therefore, to get FreeBSD onto your disk, you need to do the following:
-
- Step FreeBSD utility
- ------------------------------------------------------------ ---------------
- 1. Make an MBR slice for FreeBSD (FDISK)
- 2. Partition the diskspace in the MBR slice into partitions (DISKLABEL)
- 3. Assign mountpoints to the partitions. (DISKLABEL)
-
-
-
-2. The sysinstall utility
---------------------------
-
-The sysinstall utility is the program you first see when you boot
-FreeBSD's install floppy. It is responsible for partitioning your
-disk, creating an MBR slice for FreeBSD, setting up the disklabel
-within that slice and creating filesystems for each FreeBSD partition
-you create within that slice. It is composed of a number of screens.
-These are described below.
-
-
-2.1 The main screen
---------------------
-The main screen shows you the current status, It shows you which disks
-FreeBSD has found, how big they are and how much of it is assigned to
-FreeBSD in a FreeBSD MBR slice. It also shows the partitions which have
-had a mountpoint assigned to them (not necessarily FreeBSD partitions;
-FreeBSD is perfectly capable of mounting DOS disks directly).
-
-(H)elp -- shows you this file.
-
-(F)disk -- enters the Fdisk editor, where you can change the MBR record.
- This is what you want to use to assign some part of the disk to FreeBSD.
-
-(D)isklabel -- enters the Disklabel editor, here you can change how the
- FreeBSD slice is partitioned for FreeBSD.
-
-(P)rocede -- will continue the installation process.
-
-(Q)uit -- Go back to the entry screen.
-
-
-2.2 FDISK - how to make an MBR slice
--------------------------------------
-There are some rules to follow here since altering your MBR is a potential
-minefield. There is really no way for the sysinstall program to genuinely
-know that you have a valid MBR, so you have to be extra careful in what
-you edit. Failure to do this properly can and will destroy your other
-operating system entries!
-
-Even if you don't plan to have MSDOS on a disk, make an MSDOS slice
-using the MSDOS's FDISK.COM program. The reason for this is that if you
-do it that way, you are 100% sure that FreeBSD will use the same number
-of heads, sectors and cylinders as MSDOS would use. If you really don't
-plan to have MSDOS on the disk, just (D)elete the slice in the FreeBSD's
-(F)disk editor.
-
-From the main screen press 'F' to enter the MBR editor. You have five
-commands available:
-
-(H)elp -- Shows you this file.
-
-(D)elete -- Deletes a slice entirely.
-
-(E)dit -- Allows you to edit a slice. It will ask how many megabytes
- you want to assign to the slice, and will suggest the maximum possible
- as a default. It might say zero, even though there is disk space
- available, in which case you will probably need to delete and recreate the
- other partitions to get it to see where the free space is.
- It will then ask you what type to give the slice, for which the default is
- 0xa5 (a FreeBSD slice). You can enter any other number here too, which
- can be useful as a placeholder for some other OS you plan to install
- later. Finally, it will ask you about the "boot flag". 0x80 means "boot
- from this" slice by default, and anything else means "don't".
-
- If you specified a FreeBSD slice, any existing slices with the 0xa5
- type will be reset to 0x00 "unused". FreeBSD only supports one slice
- per disk for FreeBSD.
-
-(R)eread -- This is your "undo" function. It will read the data of the
- disk again, disposing of any changes you may have made.
-
-(W)rite -- When you are satisfied with the data, this function will write
- the new MBR to the disk.
-
-(Q)uit -- Go back to the main screen.
-
-
-2.3 Disklabel - How to divide up the FreeBSD slice.
-----------------------------------------------------
-
-The disklabel screen provides the following commands:
-
-(H)elp -- Shows you this file.
-
-(S)ize -- Resizes a partition for you, it will suggest as a default the
- maximum amount of diskspace it can find. This algorithm isn't too smart
- and may say zero, even though there is diskspace available. If it
- does, delete and resize the other partitions.
-
-(A)ssign -- Here you assign where the filesystem in a partition is to
- be mounted. `b' partitions will always be made into "swap" partitions.
-
-(D)elete -- Delete a partition.
-
-(R)eread -- The undo function. It will reread the current disklabel from
- the kernel.
-
-(W)rite -- This will write the disklabel to the disk. You must always write
- before you quit, otherwise your changes will be lost.
-
-(Q)uit -- Exit back to the main screen.
-
-
-2.4. Hints on partition sizing
--------------------------------
-
-While it's impossible to say how much space you're going to want to
-make your various partitions without knowing more about your intended
-applicatins, here are some good rules of thumb to follow:
-
-1. Root (/) should be at least 18MB, and probably no more than 50MB unless
- you have some special reason for making your root partition really
- large. Remember that the root filesystem is only supposed to contain
- vital system files and little else.
-
-2. Swap should be at least 2*memory. That is to say if you have 8MB of
- memory, then you probably want 16MB of swap. Even more swap space
- certainly doesn't hurt, if you can afford to allocate it, and you should
- also think ahead a little to any planned memory upgrades you may have
- in mind since increasing this later can be very painful!
-
- If you're going to run the X Window System (XFree86), you should also
- consider having a *minimum* of 16MB of swap, since X tends to really
- use it up.
-
-3. /usr can take up the rest of your disk, though some people like to create
- extra partitions for user home directories and the like. Be sure to make
- your /usr big enough to contain the system software (about 50MB) and
- perhaps some of your own, unless you're going to use symbolic links to
- point things like /usr/local (or /usr/src) somewhere else.
-
-
-Here are some suggested filesystem names and sizes, just for reference:
-
-Mountpoint Filesystem size
--------------------------------
-/var 10Mb
-/usr 50Mb
-/ 16Mb
-
-/usr/src 120Mb If you want to have the sources online
-/usr/obj 100Mb If you want to compile all of them at one time
-
-/usr/X11R6 50Mb If you load the entire XFree86 binary kit.
-
-
-$Id: DISKSPACE.FAQ,v 1.6 1994/11/18 10:32:43 jkh Exp $
diff --git a/share/FAQ/Diskless.FAQ b/share/FAQ/Diskless.FAQ
deleted file mode 100644
index 84af09c..0000000
--- a/share/FAQ/Diskless.FAQ
+++ /dev/null
@@ -1,130 +0,0 @@
-Setting up a Diskless FreeBSD system
-====================================
-
-netboot.com/netboot.rom allow you to boot your FreeBSD machine over the
-network and run FreeBSD without having a disk on your client. Under 2.0
-it is now possible to have local swap. Swapping over NFS is also still
-supported.
-
-The list of supported Ethernet cards:
-
- Western Digital/SMC 8003, 8013, 8216 and compatibles
- NE1000/NE2000 and compatibles (requires recompile)
-
-
-Setup Instructions
-------------------
-
- - Find a machine that will be your server. This machine will require
- enough disk space to hold the FreeBSD 2.0 binaries and have bootp, tftp
- and NFS services available.
-
- tested machines:
-
- HP9000/8xx running HP-UX 9.04 or later (pre 9.04 doesn't work)
- Sun/Solaries 2.3. (you may need to get bootp)
-
-
- - Set up a bootp server to provide the client with IP, gateway, netmask
-
- sample entry:
-
- diskless:\
- :ht=ether:\
- :ha=0000c01f848a:\
- :sm=255.255.255.0:\
- :hn:\
- :ds=192.1.2.3:\
- :ip=192.1.2.4:\
- :gw=192.1.2.5:\
- :vm=rfc1048:
-
- - Set up a TFTP server (on same machine as bootp server) to provide
- booting information to client. The name of this file is cfg.X.X.X.X
- (or /tftpboot/cfg.X.X.X.X, it will try both) where X.X.X.X is the
- IP address of the client. The contents of this file can be any valid
- netboot commands. Under 2.0, netboot has the following commands:
-
- help - print help list
- ip <X.X.X.X> - print/set client's IP address
- server <X.X.X.X> - print/set bootp/tftp server address
- netmask <X.X.X.X> - print/set netmask
- hostname <name> - print/set hostname
- kernel <name> - print/set kernel name
- rootfs <ip:/fs> - print/set rootfilesystem
- swapfs <ip:/fs> - print/set swapfilesystem
- swapsize <size> - set diskless swapsize in Kbytes
- diskboot - boot from disk
- autoboot - continue boot process
-
- A typical completely diskless cfg file might contain:
-
- rootfs 192.1.2.3:/rootfs/myclient
- swapfs 192.1.2.3:/swapfs
- swapsize 20000
- hostname myclient.mydomain
-
- A cfg file for a machine with local swap might contain:
-
- rootfs 192.1.2.3:/rootfs/myclient
- hostname myclient.mydomain
-
- - Ensure that your NFS server has exported the root (and swap if applicable)
- filesystems to your client, and that the client has root access to these
- filesystems
-
- A typical /etc/exports file might look like:
-
- (FreeBSD)
-
- /rootfs/myclient -maproot=0:0 myclient.mydomain
- /swapfs -maproot=0:0 myclient.mydomain
-
-
- (HP-UX)
-
- /rootfs/myclient -root=myclient.mydomain
- /swapfs -root=myclient.mydomain
-
-
- - If you are swapping over NFS (completely diskless configuration) create a
- swap file for your client using touch. If your 'swapfs' command
- has the argument /swapfs as in the example above, the swapfile for myclient
- will be called /swapfs/swap.X.X.X.X where X.X.X.X is the client's IP addr.
-
- eg: # touch /swapfs/swap.192.1.2.4
-
- - Unpack the root filesystem in the directory the client will use for its
- root filesystem (/rootfs/myclient in the example above).
-
- *** On HP-UX systems: The server should be running HP-UX 9.04 or
- later for HP9000/800 series machines. Prior versions don't allow
- the creation of device files over NFS.
-
- *** When extracting /dev in /rootfs/myclient, beware that some systems
- (HPUX) will not create device files that FreeBSD is happy with.
- You may have to go to single user mode on the first bootup
- (press control-c during the bootup phase), cd /dev and do a
- "sh ./MAKEDEV all" from the client to fix this.
-
- - Run netboot.com on the client or make an EPROM from the netboot.rom file
-
-
-Using Shared / and /usr filesystems
------------------------------------
-At present there isn't an officially sanctioned way of doing this, although
-I have been using a shared /usr filesystem and individual / filesystems for
-each client. If anyone has any suggestions on how to do this cleanly, please
-let me and/or the core group know.
-
-
-
-Compiling netboot for specific setups
--------------------------------------
-
-Netboot can be compiled to support NE1000/2000 cards by changing the
-configuration in /sys/i386/boot/netboot/Makefile. See the comments
-at the top of this file.
-
-
-Martin Renters martin@innovus.com
diff --git a/share/FAQ/FreeBSD-1.1.FAQ b/share/FAQ/FreeBSD-1.1.FAQ
deleted file mode 100644
index 13a078e..0000000
--- a/share/FAQ/FreeBSD-1.1.FAQ
+++ /dev/null
@@ -1,987 +0,0 @@
-
- FreeBSD
- Frequently Asked Questions
- For Versions 1.1 and below
-
-Please mail all suggestions and additions to <FreeBSD-FAQ@FreeBSD.ORG>
-
-
-Revision: $Id: FreeBSD-1.1.FAQ,v 1.4 1994/10/10 10:46:14 gclarkii Exp $
-
-All entries are assumed to be relevant to both FreeBSD 1.1 and FreeBSD 1.1.5,
-unless otherwise noted.
-
-
-Table of Contents
------------------
-
-0 Preface
-1 Installation
-2 Hardware Compatibility
-3 Commercial applications
-4 User Applications
-5 Miscellaneous Questions
-6 Kernel Configuration
-7 System Administration
-8 Networking
-9 Serial Communications
-
-
-
-0 Preface
----------
-
-Welcome to the FreeBSD 1.1 FAQ! This document tries to answer some of
-the most frequently asked questions about FreeBSD 1.1 (or later,
-unless specifically indicated). If there's something you're having
-trouble with and you just don't see it here, then please send mail to:
-
- <questions@FreeBSD.ORG>
-
-
-Some of the instructions here will also refer to auxiliary utilities
-in the /usr/src/share/FAQ directory. CDROM purchasers and net folks
-who've grabbed the FreeBSD current `srcdist' will have these files. If
-you don't have the source distribution, then you can either grab the
-whole thing from:
-
- ftp.FreeBSD.ORG:pub/FreeBSD/FreeBSD-current/src
-
-0.1: What is FreeBSD?
-
-FreeBSD is a UN*X type operating system based on William Jolitz's port
-of U.C. Berkeley's Networking Release 2 to the i386, 386BSD. It is no
-longer correct to say that FreeBSD is only 386BSD with the patchkit
-applied! There have been many additions and bug fixes made throughout
-the entire system, some of the highlights of which are:
-
- More robust and extensive PC device support
- System V-style IPC, messaging and semaphores
- Shared Libraries
- Much improved virtual memory code
- Better console driver support
- Network booting (diskless) support
- /proc filesystem
- Yellow Pages support
- `LDT' support for WINE (primitive but developing Windows emulation)
- Too many additional utilities and applications to mention
-
-
-0.2: My friends told me that FreeBSD was illegal and I shouldn't use it.
- Is this really true?
-
-FreeBSD versions up to and including 1.1 have included code from
-Berkeley's Net/2 distribution. UNIX Systems Laboratories (now Novell)
-sued Berkeley claiming that Net/2 included some code that belonged to
-USL. In February of 1994, USL and Berkeley announced a settlement in
-which neither side admitted to doing anything wrong, but UCB agreed to
-stop distributing the disputed software.
-
-Since Berkeley will no longer defend this code, we have been requested
-to stop distributing it, and will be integrating all the improvements
-we have made in the VM system and i386-specific code into Berkeley's
-4.4-Lite distribution; the result will form the basis of FreeBSD 2.0.
-We expect the integration to take place over a period of three to six
-months, during which time we will have to stop work on 1.1 and
-concentrate all our efforts on the merge, and we expect to make more
-information available on the status of the merge effort as the situation
-progresses.
-
-However, to answer the question, "No. FreeBSD is not illegal." We
-have been allowed by USL to distribute 1.1 as the last Net/2 derived
-version, after which we have committed to move to 4.4 as previously
-stated.
-
-We expect to make more information available on the status of the
-merge effort as the situation progresses.
-
-0.3: What are the FreeBSD mailing lists, and how can I get on them?
-
-The following mailing lists are provided for FreeBSD users and
-developers. For more information, send to
-<majordomo@FreeBSD.ORG> and include a single line saying
-``help'' in the body of your message.
-
-announce: For announcements about or on FreeBSD.
-hackers: Useful for persons wishing to work on the internals.
-questions: General questions on FreeBSD.
-bugs: Where bugs should be sent.
-commit: This list carries the commit messages for freefall. Useful
- for tracking ongoing work.
-SCSI: Mailing list for SCSI developers.
-current: This list is for persons wishing to run FreeBSD-current
- and carries announcements and discussions on current.
-ports: Discussion of "/usr/ports"
-hardware: Types of hardware FreeBSD runs on
-security: Security issues
-platforms: Porting to non-Intel platforms
-
-Please see also the FreeBSD mailing list FAQ in:
-
- /usr/src/share/FAQ/FreeBSD.mailing-list.FAQ
-
-0.4: What are the various FreeBSD news groups?
-
-While there are no groups currently dedicated to FreeBSD, you may find
-the following groups useful.
-
-comp.os.386bsd.announce: For announcements
-comp.os.386bsd.apps: For applications
-comp.os.386bsd.questions: For questions
-comp.os.386bsd.development: For working on the internals
-comp.os.386bsd.bugs: About bugs
-comp.os.386bsd.misc: For items that don't fit anywhere else
-
-NOTE: These groups cover all the *BSDs (FreeBSD, NetBSD, 386BSD).
-
-
-
-1 Installation
---------------
-
-1.1: I just installed my system and rebooted. Now I can't find the
- extract or configure programs, where did they go?
-
-These two commands are just shell functions defined in /.profile. To
-get these back, boot FreeBSD with a `-s' at the boot prompt.
-
-
-1.2: I want to install FreeBSD onto a SCSI disk that has more than
- 1024 cylinders. How do I do it?
-
-This depends. If you don't have DOS (or another operating system) on
-the system, you can just keep the drive in native mode and simply make
-sure that your root partition is below 1024 so the BIOS can boot the
-kernel from it. It you also have DOS/some other OS on the drive then
-your best bet is to find out what parameters that it thinks you have
-before installing FreeBSD. When FreeBSD's installation procedure
-prompts you for these values, you should then enter them rather than
-simply going with the defaults.
-
-There is a freely available utility distributed with FreeBSD called
-`pfdisk' (located in the tools/ subdirectory) which can be used for
-this purpose.
-
-
-1.3: When I boot FreeBSD it says ``Missing Operating System''.
-
-See question 1.2. This is classically a case of FreeBSD and DOS or
-some other OS conflicting over their ideas of disk geometry. You will
-have to reinstall FreeBSD, but obeying the instructions given above
-will almost always get you going.
-
-
-1.4: I have an IDE drive with lots of bad blocks on it and FreeBSD doesn't
- seem to install properly.
-
-FreeBSD's bad block (bad144) handling is still not 100% (to put it
-charitably) and it must unfortunately be said that if you've got an
-IDE or ESDI drive with lots of bad blocks, then FreeBSD is probably
-not for you! That said, it does work on thousands of IDE based
-systems, so you'd do well to try it first before simply giving up.
-
-IDE drives are *supposed* to come with built-in bad-block remapping;
-if you have documentation for your drive, you may want to see if this
-feature has been disabled on your drive. However, ESDI, RLL, and
-ST-506 drives normally do not do this.
-
-<1.1.5>
-FreeBSD-current has better bad block handling due to improvments made
-to the wd driver.
-
-1.5: I have 32MB of memory, should I expect any special problems?
-
-If you have an IDE controller, no. Likewise, if you have a full EISA
-system with EISA disk controller or a working local bus controller
-(read further) you'll have no problems. If you have an ISA system, or
-an EISA system with an ISA disk controller then you will most
-certainly have problems with the upper 16MB of memory due to the ISA
-24 bit DMA limitation (which ISA cards in EISA systems will also
-exhibit). If you have a local bus disk controller, then you should be
-OK, UNLESS it's a Buslogic Bt445S with a revision less than `D' (BIOS
-3.36 or earlier).
-
-<1.1.5>
-1.1.5 has bounce-buffer support that make all of the above scenarios work
-with a full 32MB of memory or more. You are therefore advised to simply pull
-16MB of memory out, install, and then see about upgrading to FreeBSD 1.1.5
-so that you can put it back.
-
-
-1.6: Do I need to install the complete sources?
-
-In general, no. However, we would strongly recommend that you
-install, at a minimum, the `base' source kit, which includes several
-of the files mentioned here, and the `sys' (kernel) source kit, which
-includes sources for the kernel. There is nothing in the system which
-requires the presence of the sources to operate, however, except for
-the kernel-configuration program config(8). With the exception of the
-kernel sources, our build structure is set up so that you can
-read-only mount the sources from elsewhere via NFS and still be able
-to make new binaries. (Because of the kernel-source restriction, we
-recommend that you not mount this on /usr/src directly, but rather in
-some other location with appropriate symbolic links to duplicate the
-top-level structure of the source tree.)
-
-Having the sources on-line and knowing how to build a system with them
-will make it much easier for you to upgrade to future releases of
-FreeBSD.
-
-1.7: DES encryption software can not be exported from the United
- States. If I live outside the US, how can I encrypt passwords?
-
-Since the DES encryption algorithm, which is used by passwd(1) and
-friends to encrypt passwords cannot legally be exported from the US,
-non-US users should not download this software from US FTP sites.
-
-There is however a replacement libcrypt available, based on sources
-written in Australia by David Burren. This code is now available on
-some non-US FreeBSD mirror sites. Sources for the unencumbered
-libcrypt, and binaries of the programs which use it, can be obtained
-from the following FTP sites:
-
- South Africa: braae.ru.ac.za:/pub/FreeBSD/securedist/
- owl.und.ac.za (currently uncertain)
- Iceland: ftp.veda.is:/pub/crypt/FreeBSD/
-
-The non-US securedist can be used as a direct replacement for the
-encumbered US securedist. This securedist package is installed the
-same way as the US package (see installation notes for details). If
-you are going to install DES encryption, you should do so as soon as
-possible, before installing other software.
-
-Non-US users should please not download any encryption software from
-the USA. This can get the maintainers of the sites from which the
-software is downloaded into severe legal difficulties.
-
-A non-US distribution of Kerberos is also being developed, and current
-versions can generally be obtained by anonymous FTP from
-braae.ru.ac.za.
-
-There is also a mailing list for the discussion of non-US encryption
-software. For more information, send an email message with a single
-line saying ``help'' in the body of your message to
-<majordomo@braae.ru.ac.za>.
-
-1.8 HELP! My keyboard locked up during the install!
-
-Some keyboard controllers are not a friend to FreeBSD. Among these are
-those on certain models of Gateway, IBM and AST machines. The most frequent
-symptom encountered in such cases is that the keyboard refuses to respond
-to input when at the `kcopy>' prompt in the second phase of bootstrapping
-FreeBSD. Fortunately, there is a work-around that may get you all the
-way home. Reset the machine and boot the kcopy floppy again, but this
-time, as the kernel is booting, tap periodically on the num-lock key
-until the kcopy prompt appears. Your keyboard should respond properly.
-
-Once your system is on the hard disk the problem generally goes away.
-Some folks for whom the problem persists even after this stage find
-relief in switching to the SYSCONS console driver (see /sys/i386/conf/SYSCONS),
-which is in any case far more featureful than pccons and a recommended
-upgrade.
-
-
-
-2 Hardware compatibility
-------------------------
-
-2.1: What kind of hard drives does FreeBSD run on?
-
-FreeBSD supports ST-506 (sometimes called ``MFM''), RLL, and ESDI
-drives, which are usually connected to WD-1002, WD-1003, or WD-1006
-controllers (although clones should also work). FreeBSD also supports
-IDE and SCSI hard drives.
-
-2.2: What SCSI controllers are supported?
-
-FreeBSD supports the following SCSI controllers:
-
-Adaptec AH-1542 Series <ISA>
- AH-1742 Series <EISA>
-Buslogic BT-445 Series <VLB> (but see section 1.5)
- BT-545 Series <ISA>
- BT-742 Series <EISA>
- BT-747 Series <EISA>
-Future Domain TMC-8XX/950 Series <ISA> (1.1.5 ONLY)
-Seagate ST-01/02 Series <ISA> (1.1.5 ONLY)
-UltraStor UH-14f Series <ISA>
- UH-34f Series <EISA/VLB>
-
-There is supposed to be a UltraStor 24f driver floating around, but
-we're not sure where (could someone please point us at it?).
-
-2.3: What CD-ROM drives are supported by FreeBSD?
-
-Any SCSI drive connected to a supported controller. Mitsumi
-LU002(8bit), LU005(16bit) and FX001D(16bit 2x Speed).
-
-FreeBSD does NOT support drives connected to a Sound Blaster or
-non-SCSI SONY or Panasonic drives. A general rule of thumb when
-selecting a CDROM drive for FreeBSD use is to buy a very standard SCSI
-model; they cost more, but deliver very solid performance in return.
-Do not be fooled by very cheap drives that, in turn, deliver VERY LOW
-performance! As always, you get what you pay for.
-
-The Mitsumi driver is known to be extremely slow compared to SCSI
-drives.
-
-
-2.4: What multi-port serial cards are supported by FreeBSD?
-
-AST/4 and BOCA 4/8/16 port cards. Some unnamed clone cards have also
-been known to work, especially those that claim to be AST compatible.
-Check the sio(4) man page to get more information on configuring such
-cards.
-
-
-2.5: Does FreeBSD support the AHA-2742 SCSI adapter from Adaptec?
-
-No, FreeBSD does not. This is due to Adaptec's unwillingness to
-supply programming information under other than non-disclosure. This
-is unfortunate, but there's nothing we can do about it.
-
-
-2.6: I have a Mumbleco bus mouse. Is it supported and if so, how do I set
- it up for XFree86?
-
-FreeBSD supports the Logitech and ATI Inport bus mice. You need to
-add the following line to the kernel config file and recompile for the
-Logitech and ATI mice:
-
- device mse0 at isa? port 0x23c tty irq6 vector mseintr
-
-
-2.7: I have a PS/2 mouse (`keyboard' mouse) [Alternatively: I have a
- laptop with a track-ball mouse]. How do I use it?
-
-<1.1.5>: The PS/2 mouse is part of the system. See the psm0 driver
-description in /sys/doc/options.doc.
-
-
-2.8: What types of tape drives are supported under FreeBSD?
-
-FreeBSD supports SCSI, QIC-02 and QIC-40/80 (Floppy based) tape
-drives. This includes 8-mm (aka Exabyte) and DAT drives.
-
-
-2.9: What sound cards are supported by FreeBSD?
-
-FreeBSD supports the SoundBlaster, SoundBlaster Pro, Pro Audio
-Spectrum 16, AdLib and Gravis UltraSound sound cards. There is also
-limited support for MPU-401 and compatible MIDI cards. The
-SoundBlaster 16 and SoundBlaster 16 ASP cards are not yet supported.
-NOTE: This is only for sound! This driver does not support CD-ROMs,
-SCSI or joysticks on these cards.
-
-
-2.10: What network cards does FreeBSD support?
-
-There is support for the following cards:
-
-`ed' driver:
- NE2000 and 1000
- WD/SMC 8003, 8013 and Elite Ultra (8216)
- 3Com 3c503
- And clones of the above
-
-`ie' driver:
- AT&T EN100/StarLAN 10
-
-`is' driver:
- Isolan AT 4141-0
- Isolink 4110
-
-`ep' driver:
- 3com 3c509 (*)
-
-
-(*)The `ep' driver is known to have some problems; see the
-/usr/src/KNOWNBUGS file for more details.
-
-
-2.11: I have a 386/486sx/486SLC machine without a math co-processor.
- Will this cause me any problems?
-
-Generally no, but there are circumstances where you will take a hit,
-either in performance or accuracy of the math emulation code (see
-section 4.1). In particular, drawing arcs in X will be VERY slow. It
-is highly recommended that you lay out the $50 or so for a math
-co-processor; it's well worth it. NOTE: Some math co-processors are
-better than others. It pains us to say it, but nobody ever got fired
-for buying Intel. Unless you're sure it works with FreeBSD, beware of
-clones.
-
-2.12: I am about to buy a new machine to run FreeBSD on and
- want an idea of what other people are running. Is there list
- of other systems anywhere?
-
-Yes. Please look at the file FAQ/Systems-1.1.FAQ. This file
-is a listing of hardware that people are running in their machines.
-Please note, this is a raw listing of equipment that other users
-have sent in.
-
-
-
-3 Commercial Applications
--------------------------
-
-Note: This section is still very sparse, though we're hoping, of
-course, that companies will add to it! :) The FreeBSD group has no
-financial interest in any of the companies listed here but simply
-lists them as a public service (and feels that commercial interest in
-FreeBSD can have very positive effects on FreeBSD's long-term
-viability). We encourage commercial software vendors to send their
-entries here for inclusion.
-
-
-3.1: Where can I get Motif for FreeBSD?
-
-Sequoia International provides commercial quality Motif 1.2.3
-development kits for FreeBSD 1.1 (with full shared library support)
-under the product name of `SWiM'. Due to licensing restrictions from
-the OSF, and the fact that Sequoia needs to make a living, these are
-NOT FREE, but nonetheless quite reasonably priced in comparison to
-many other commercial Motif distributions. Send electronic mail to
-<info@seq.com> for further information.
-
-3.2: What about other commercial quality development systems for FreeBSD?
-
-ParcPlace Systems, Inc., who currently provides their excellent
-`Object Interface & Object Builder' GUI development environment free
-of charge to Linux users, is considering the the FreeBSD platform and
-will make their intentions known fairly shortly.
-
-
-
-4 User Applications
--------------------
-
-4.1: I want to run X, how do I go about it?
-
-First, get the XFree86 distribution of X11R5 from XFree86.cdrom.com.
-The version you want for FreeBSD 1.1 and later is XFree86 2.1. Follow
-the instructions for installation carefully. You may then wish to read
-the documentation for the ConfigXF86 tool, which assists you in
-configuring XFree86 for your particular graphics card/mouse/etc.
-
-
-4.1: I've been trying to run ghostscript on a 386 (or 486sx) with no
- math co-processor and I keep getting errors. What's up?
-
-<1.1.5>: For 1.1.5 you may add the following to your kernel config file and
-it will be compiled in.
-options GPL_MATH_EMULATE
-
-NOTE: You will need to remove the MATH_EMULATE option when you do this.
-
-
-4.2: If I want something like seyon, term, Kermit, emacs or any one of
- hundreds of popular freeware utilities, is there a good place to
- search through first?
-
-Yes, the FreeBSD `ports collection' was put together for just that
-purpose. It contains some of the most often requested languages,
-editors, mail and news reading programs, network software and many
-many megabytes of other types of useful goodies. CDROM people will
-probably have the ports collection already in /usr/ports, other folks
-can get at the latest snapshot of the entire collection in:
-
- ftp.FreeBSD.ORG:pub/FreeBSD/FreeBSD-current/ports
-
-Note that this FTP server permits getting entire directories as one
-(optionally gzipped or compressed) tar file. Read the FTP welcome
-banner carefully for details.
-
-
-4.3: I want all this neat software, but I haven't got the space or
- CPU power to compile it all myself. Is there any way of getting
- binaries?
-
-Yes. We support the concept of a `package', which is essentially a
-gzipped binary distribution with a little extra intelligence embedded
-in it for doing any custom installation work required. Packages can
-also be installed or deinstalled again easily without having to know
-the gory details. CDROM people will have a packages/ directory on
-their CD, others can get the currently available packages from:
-
- ftp.FreeBSD.ORG:pub/FreeBSD/packages-1.1
-
-Note that all ports may not be available as packages, and that new
-packages are constantly being added. It is always a good idea to
-check periodically to see which packages are available. A README file
-in the packages directory provides more details on the care and
-feeding of the package software, so no explicit details will be given
-here.
-
-4.4: I'm trying to get Perl to work properly, but I keep getting
- errors about dbm failures when I test it. How can I fix this?
-
-The problem here is that the tests are written for an older version of
-the dbm code. There is nothing wrong with perl and the errors can
-be ignored.
-
-4.5: I've been trying to get GCC 2.6.0 running on my system and it
- keeps bombing. What can I do about?
-
-Due to problems with 2.6.0 and the advent of FreeBSD 2.0, we do not
-support GCC 2.6.0 and suggest that you wait for 2.0.
-
-
-
-5 Miscellaneous Questions
-----------------
-
-5.1: I've heard of something called FreeBSD-current. How do I run it, and
- where can I get more information?
-
-Read the file /usr/src/share/FAQ/FreeBSD.current.policy,
-it will tell you all you need to know.
-
-
-5.2: What is this thing called `sup', and how do I use it?
-
-SUP stands for Software Update Protocol, and was developed by CMU for
-keeping their development trees in sync. We use it to keep remote
-sites in sync with our central development sources.
-
-To use it, you need to have direct internet connectivity (not just
-mail or news). First, pick up the sup_bin.tgz package from:
-
- ftp.FreeBSD.ORG:pub/FreeBSD/packages-1.1
-
-Second, read the file /usr/src/share/FAQ/FreeBSD.sup.faq.
-
-This file describes how to setup sup on your machine. You may also
-want to look at /usr/src/contrib/FAQ/FreeBSD.*.supfile,
-which are a set of supfiles for supping from FreeBSD.ORG
-
-
-5.3: How do I create customized installation disks that I can give
- out to other people at my site?
-
-The entire process of creating installation disks and source and
-binary archives is automated by various targets in
-/usr/src/etc/Makefile. The information there should be enough to get
-you started.
-
-5.4: How do I re-build my system without clobbering the existing
- installed binaries?
-
-If you define the environment variable DESTDIR while running `make
-world' or `make install', the newly-created binaries will be deposited
-in a directory tree identical to the installed one, rooted at
-${DESTDIR}. Some random combination of shared libraries modifications
-and program rebuilds can cause this to fail in `make world', however.
-
-
-5.5: When my system booted, it told me that ``(bus speed defaulted)''.
- What does that mean?
-
-The Adaptec 1542 SCSI host adapters allow the user to configure their
-bus access speed in software. Previous versions of the 1542 driver tried
-to determine the fastest usable speed and set the adapter to that. We
-found that this breaks some users' systems, so you now have to define
-the ``TUNE_1542''' kernel configuration option in order to have this
-take place. Using it on those systems where it works may make your
-disks run faster, but on those systems where it doesn't, your data could
-be corrupted.
-
-5.6: I would like to track changes to current and do not have net access.
- Is there any way besides downloading the whole tree?
-
-Yes, Poul-Henning has set up a source tracking list. Please email
-majordomo@ref.tfs.com with a body of "get ctm-src-cur README" for
-futher information.
-
-5.7: How do I split up large binary files into smaller 240k files
- like the distribution does?
-
-Newer BSD based systems have a "-b" option to split that allows them to
-split files on arbitary byte bondaries.
-
-Here is an example from /usr/src/Makefile.
-bin-tarball:
- (cd ${DISTDIR}; \
- tar cf - . \
- gzip --no-name -9 -c | \
- split -b 240640 - \
- ${RELEASEDIR}/tarballs/bindist/bin_tgz.)
-
-5.8: I'm running Syscons and every morning my console locks up. What
- is going on here?
-
-This sounds like the "kill -1 syslogd" problem. Make sure that the
-following is correct on your system.
-1. The attributes of the following nodes are correct.
-/dev/console
-crw------- 1 root 0, 0 May 23 15:32 /dev/console
-/dev/ttyv0
-crw------- 1 root 12, 0 May 23 15:32 /dev/ttyv0
-The part you are concerned with are the major and minor device numbers.
-
-2. Make sure that getty is running on ttyv0 and NOT console.
-
-3. If /dev/vga exists that it is a symlink to /dev/ttyv0.
-
-5.9: I've had a couple of system panics and would like to be able
- browse the system dumps. The normal kernel is stripped and
- I don't want to run a bloated kernel. What can I do?
-
-Please retrieve the file FAQ/FreeBSD.kdebug.FAQ. This
-file covers the instructions for looking at system dumps.
-
-5.10: I've got a Buslogic BT-946c with an Intel motherboard and
- right after the kernel probes, my system hangs. How do I
- fix it?
-
-Two things here.
-1. Some intel motherboards have fixed PCI INT pins and you will have
- to match the BT-946c's INT to match the motherboards.
-2. FreeBSD 1.1.5.1 expects the INT on a non-standard pin and you
- will have to also match this one.
-
-
-6 Kernel Configuration
-----------------------
-
-6.1: When I compile a kernel with multi-port serial code, it tells me
- that only the first port is probed and the rest skipped due to
- interrupt conflicts. How do I fix this?
-
-The problem here is that FreeBSD has code built-in to keep the kernel
-from getting trashed due to hardware or software conflicts. The way
-to fix this is to leave out the IRQ settings on other ports besides
-the first. Here is a example:
-
-#
-# Multiport high-speed serial line - 16550 UARTS
-#
-device sio2 at isa? port 0x2a0 tty irq 5 flags 0x501 vector siointr
-device sio3 at isa? port 0x2a8 tty flags 0x501 vector siointr
-device sio4 at isa? port 0x2b0 tty flags 0x501 vector siointr
-device sio5 at isa? port 0x2b8 tty flags 0x501 vector siointr
-
-
-6.2: FreeBSD is supposed to come with support for QIC-40/80 drives but
- when I look, I can't find it.
-
-You need to uncomment the following line in the generic config file
-(or add it to your config file) and recompile.
-
-controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr
-disk fd0 at fdc0 drive 0
-disk fd1 at fdc0 drive 1
-#tape ft0 at fdc0 drive 2
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-You will have a device called /dev/ft0, which you can write to through
-a special program to manage it called `ft' - see the man page on ft for
-further details. Versions previous to -current also had some trouble dealing
-wiht bad tape media; if you have trouble where ft seems to go back and forth
-over the same spot, try grabbing the latest version of ft from /usr/src/sbin/ft
-in current and try that.
-
-
-6.3: Does FreeBSD support IPC primitives like those in System V?
-
-Yes, FreeBSD supports System V-style IPC. This includes shared
-memory, messages and semaphores. You need to add the following lines
-to your kernel config to enable them.
-
-options SYSVSHM
-options "SHMMAXPGS=64" # 256Kb of sharable memory
-options SYSVSEM # enable for semaphores
-options SYSVMSG # enable for messaging
-
-Recompile and install.
-
-
-6.4: Are there any utilities that make configuring a kernel easier?
-
-Well, yes and no. Look in /sys/i386/doc/options.doc (/sys/doc on post
-1.1 systems) for a list of kernel options you can set, and what they
-do. For a friendlier front-end to the process, see
-/usr/src/contrib/configit
-
-
-6.5: Will FreeBSD ever support other architectures?
-
-Several different groups have expressed interest in working on
-multi-architecture support for FreeBSD. If you are interested in
-doing so, please contact the developers at
-<hackers@FreeBSD.ORG> for more information on our
-strategy for porting.
-
-
-6.6: I just wrote a device driver for a Foobar Systems, Inc.
- Integrated Adaptive Gronkulator card. How do I get the
- appropriate major numbers assigned?
-
-This depends on whether or not you plan on making the driver publicly
-available. If you do, then please send us a copy of the driver source
-code, plus the appropriate modifications to files.i386, a sample
-configuration file entry, and the appropriate MAKEDEV code to create
-any special files your device uses. If you do not, or are unable to
-because of licensing restrictions, then character major number 32 and
-block major number 8 have been reserved specifically for this purpose;
-please use them. In any case, we'd appreciate hearing about your
-driver on <hackers@FreeBSD.ORG>.
-
-6.7: I'm wanting to switch console drivers to Syscons. I changed my
- kernel config file to run Syscons, but when I reboot the system
- locks up! How do I fix it?
-
-There are four things that need to be done to properly install syscons
-on a system.
-1. Add the following line to your kernel config file while deleting the
- line for pccons.
-device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
-(Note the changed vector 'scintr'. It is a common error to change the
-device name but NOT the vector.
-
-2. Add the following option to your config file.
-options "NCONS=6" # Change to reflect the number of consoles
-
-3. Modify /etc/ttys to enable gettys on ttyv0 - ttyv??. Here is an
-example line.
-ttyv0 "/usr/libexec/getty Pc" Pc3 on secure
-Please make sure that you have disabled the getty on /dev/console.
-
-4. Create the device nodes in /dev. This is done useing the MAKEDEV
-script located in that directory. Here is a command line that will create
-6 virtual consoles.
-MAKEDEV vty6
-If /dev/vga exists, it should now be a symlink to /dev/ttyv0.
-
-NOTE: If you are going to be running X, you will need an unused vty that
- has no getty running on it.
-
-
-
-7 System Administration
------------------------
-
-7.1: How do I add a user easily? I read the man page and am more confused
- than ever! [Alternatively: I didn't read the man page, I never read
- man pages! :-) ]
-
-Look at Gary Clark's Perl package ``AddIt'', which may be found in
-/usr/src/contrib/adduser. This is a first attempt at solving the
-problem and may be replaced with a more complex but capable solution
-later.
-
-
-7.2: I'm trying to use my printer and keep running into problems. I tried
- looking at /etc/printcap, but it's close to useless. Any ideas?
-
-Yes, you can pick up Andreas Klemm's apsfilter package from:
-
-ftp.germany.eu.net:pub/comp/i386/Linux/Local.EUnet/People/akl/apsfilter-1.11.gz
-
-This is a complete package for printing text, PS and DVI files. It
-requires ghostscript and dvips.
-
-If you are looking for a simple printcap just for PS and text files,
-try picking up the printcap01 sources in:
-
- /usr/src/contrib/FAQ/code/printcap01
-
-NOTE: We're looking for printcap entries for all printers. If you
-have one, or a filter for one, please send it or mail us a pointer to
-<FreeBSD-FAQ@FreeBSD.ORG>. Thanks!
-
-7.3: Help! I've lost my root password! How do I log in now?
- Alternatively: I botched something bad in my root partition
- that keeps me from booting, how do I fix it!?
-
-Follow these steps:
-
-1. First off, you need to boot the system single-user: Do this by rebooting
-or resetting the machine, and when you come to the very first boot prompt
-(the one you probably generally just hit `return' at or wait for it to
-time-out) type:
-
- 386bsd -s
-
-This will send the `-s' flag to init(1) telling it to not bring you up all
-the way into multi-user mode. The system should come up single-user and
-present you with a simple `#' prompt.
-
-2. Now is probably a good time to type `fsck' and make sure your filesystems
-are alright. If problems on your root filesystem are found and fixed, I would
-recommend hitting the reset switch again and going back to step 1. Your
-filesystems should all check fine the second time.
-
-3. At this point, your root filesystem is mounted *read only* for safety.
-If the problems you must fix are not on the root fs then I recommend that
-you simply leave it this way and fix the other problems. If you need to
-write to the root fs (fixing passwords requires this, for one thing) and
-you're using SCSI for your root fs then type:
-
- mount -u /dev/sd0a /
-
-If you're using IDE/ESDI for your rootfs, then instead type:
-
- mount -u /dev/wd0a /
-
-This will remount your root filesystem read/write and allow you to make
-your changes. Once you have done so, I recommend another reboot. -Jordan
-
-
-8 Networking
-------------
-
-8.1: Where can I get information booting FreeBSD `diskless', that is
- booting and running a FreeBSD box from a server rather than having
- a local disk?
-
-Please read /sys/i386/netboot/netboot.doc.
-
-
-8.2: I've heard that you can use a FreeBSD box as a dedicated network
- router - is there any easy support for this?
-
-Internet standards and good engineering practice prohibit us from
-providing packet forwarding by default in FreeBSD. You can enable
-this support by adding `options GATEWAY' to your kernel configuration
-file and recompiling. In most cases, you will also need to run a
-routing process to tell other systems on your network about your
-router; FreeBSD comes with the standard BSD routing daemon routed(8),
-or for more complex situations you may want to try GateD (available by
-FTP from gated.Cornell.edu). FreeBSD is supported as of 3_5Alpha7.
-
-It is our duty to warn you that, even when FreeBSD is configured in
-this way, it does not completely comply with the Internet standard
-requirements for routers; however, it comes close enough for ordinary
-usage.
-
-There is a standard `router floppy' that you can boot on a FreeBSD
-machine to configure it as a network router. Please look in:
-
- freefall.cdrom.com:pub/incoming/freertr
-
-and follow the instructions.
-
-
-8.3: Does FreeBSD support SLIP and PPP?
-
-Yes. See the man pages for slattach(8) and/or pppd(8) if you're using
-FreeBSD to connect to another site. If you're using FreeBSD as a
-server for other machines, look at the man page for sliplogin(8).
-You may also want to take a look at the slip FAQ in:
- FAQ/FreeBSD.slip.dialup.faq
-
-8.4: How do I set up NTP?
-
-NTP configuration is so complex and widely variable from site to site
-that it would be impossible to make a blanket statement here. Your
-best bet is to ask whoever's in charge of NTP at your site or network
-provider; chances are that they are running a similar version of NTP
-to the one that we provide, and they can probably provide you with the
-right configuration files to get things going.
-
-If you can't find anyone in charge, you should examine the files in
-/usr/src/contrib/xntpd/doc and see if they help any. If not, you
-could ask on the comp.protocols.time.ntp newsgroup, or the
-<ntp@ni.umd.edu> mailing-list.
-
-8.5: How do I get my network set up? I don't see how to make my
- /dev/ed0 device!
-
-In the Berkeley networking framework, network interfaces are only
-directly accessible by kernel code. Please see the /etc/netstart file
-and the manual pages for the various network programs mentioned there
-for more information. If this leaves you totally confused, then you
-should pick up a book describing network administration on another
-BSD-related operating system; with few significant exceptions,
-administering networking on FreeBSD is basically the same as on SunOS
-4.0 or Ultrix.
-
-8.6: How do I get my 3C503 to use the other network port?
-
-Use `ifconfig ed0' to see whether the ALTPHYS flag is set, and then
-use either `ifconfig ed0 altphys' if it was off, or `ifconfig ed0
--altphys' if it was on.
-
-8.7: I'm having problems with NFS to/from FreeBSD and my Wuffotronics
- Workstation / generic NFS appliance, where should I look first?
-
-Certain PC network cards are better than others (to put it mildly) and
-can sometimes cause problems with network intensive applications like
-NFS. See /usr/src/share/FAQ/NFS.FAQ for more information on this
-topic.
-
-8.8: I want to enable IP multicast support on my FreeBSD box, how do I do it?
- [Alternatively: What the heck IS multicasting and what applications
- make use of it?]
-
-First off, to you'll need to rebuild a kernel with multicast support in it.
-This requires that you have the sources to at least the kernel and the config
-utility. See /usr/src/sys/i386/conf/LINT for its comments on multicast; you'll
-need to set the MROUTING and MULTICAST options as shown there.
-
-Further reading/exploration for those interested in multicast:
-
-Product Description Where
---------------- ----------------------- ---------------------------------------
-faq.txt Mbone FAQ ftp.isi.edu:/mbone/faq.txt
-imm/immserv IMage Multicast ftp.hawaii.edu:/paccom/imm.src.tar.Z
- for jpg/gif images.
-nv Network Video. ftp.parc.xerox.com:
- /pub/net-reseach/exp/nv3.3alpha.tar.Z
-vat LBL Visual Audio Tool. ftp.ee.lbl.gov:
- /conferencing/vat/i386-vat.tar.Z
-wb LBL White Board. ftp.ee.lbl.gov:
- /conferencing/wb/i386-wb.tar.Z
-mmcc MultiMedia Conference ftp.isi.edu:
- Control program /confctrl/mmcc/mmcc-intel.tar.Z
-rtpqual Tools for testing the ftp.psc.edu:/pub/net_tools/rtpqual.c
- quality of RTP packets.
-vat_nv_record Recording tools for vat ftp.sics.se:archive/vat_nv_record.tar.Z
- and nv.
-
-[Many thanks to Jim Lowe for providing multicast support for FreeBSD, and this
-information]
-
-
-9 Serial Communications
------------------------
-
-9.1: When I do a set line in Kermit it locks up, what's the problem?
-
-The problem here is that FreeBSD thinks it's talking to a incoming
-modem connection, and is waiting for carrier to come up on it before
-completing the open. To disable modem control, do an:
-
- stty -f /dev/ttyXX clocal
-
-(Where `ttyXX' is the tty port you're using). If you use a given port
-only for outgoing connections, you may wish to put this command in
-your /etc/rc.local to avoid having to do it every time you reboot your
-system.
-
-
-NOTE: Anyone wishing to submit a FAQ entry on how to get tip and cu working
- would have it much appreciated! We all use Kermit over here! :-)
-
------------------------------------------------------------------------------
-If you see a problem with this FAQ, or wish to submit an entry, please
-mail us at <FreeBSD-FAQ@FreeBSD.ORG>. We appreciate your
-feedback, and cannot make this a better FAQ without your help!
-
-
- FreeBSD Core Team
-
------------------------------------------------------------------------------
-
-ACKNOWLEDGMENTS:
-
-Gary Clark II - Our head FreeBSD FAQ maintenance man
-Jordan Hubbard - Janitorial services (I don't do windows)
-Garrett Wollman - Networking and formatting
-Robert Oliver, Jr. - Ideas and dumb questions (That made me think)
-Ollivier Robert - Invaluable feedback and contributions
-The FreeBSD Team - Kvetching, moaning, submitting data
-
-And to any others we've forgotten, apologies and heartfelt thanks!
-
diff --git a/share/FAQ/FreeBSD-1.X/FreeBSD-1.1.FAQ b/share/FAQ/FreeBSD-1.X/FreeBSD-1.1.FAQ
deleted file mode 100644
index bdaf736..0000000
--- a/share/FAQ/FreeBSD-1.X/FreeBSD-1.1.FAQ
+++ /dev/null
@@ -1,987 +0,0 @@
-
- FreeBSD
- Frequently Asked Questions
- For Versions 1.1 and below
-
-Please mail all suggestions and additions to <FreeBSD-FAQ@FreeBSD.ORG>
-
-
-Revision: $Id: FreeBSD-1.1.FAQ,v 1.5 1994/11/23 10:21:59 gclarkii Exp $
-
-All entries are assumed to be relevant to both FreeBSD 1.1 and FreeBSD 1.1.5,
-unless otherwise noted.
-
-
-Table of Contents
------------------
-
-0 Preface
-1 Installation
-2 Hardware Compatibility
-3 Commercial applications
-4 User Applications
-5 Miscellaneous Questions
-6 Kernel Configuration
-7 System Administration
-8 Networking
-9 Serial Communications
-
-
-
-0 Preface
----------
-
-Welcome to the FreeBSD 1.1 FAQ! This document tries to answer some of
-the most frequently asked questions about FreeBSD 1.1 (or later,
-unless specifically indicated). If there's something you're having
-trouble with and you just don't see it here, then please send mail to:
-
- <questions@FreeBSD.ORG>
-
-
-Some of the instructions here will also refer to auxiliary utilities
-in the /usr/src/share/FAQ directory. CDROM purchasers and net folks
-who've grabbed the FreeBSD current `srcdist' will have these files. If
-you don't have the source distribution, then you can either grab the
-whole thing from:
-
- ftp.FreeBSD.ORG:pub/FreeBSD/FreeBSD-current/src
-
-0.1: What is FreeBSD?
-
-FreeBSD is a UN*X type operating system based on William Jolitz's port
-of U.C. Berkeley's Networking Release 2 to the i386, 386BSD. It is no
-longer correct to say that FreeBSD is only 386BSD with the patchkit
-applied! There have been many additions and bug fixes made throughout
-the entire system, some of the highlights of which are:
-
- More robust and extensive PC device support
- System V-style IPC, messaging and semaphores
- Shared Libraries
- Much improved virtual memory code
- Better console driver support
- Network booting (diskless) support
- /proc filesystem
- Yellow Pages support
- `LDT' support for WINE (primitive but developing Windows emulation)
- Too many additional utilities and applications to mention
-
-
-0.2: My friends told me that FreeBSD was illegal and I shouldn't use it.
- Is this really true?
-
-FreeBSD versions up to and including 1.1 have included code from
-Berkeley's Net/2 distribution. UNIX Systems Laboratories (now Novell)
-sued Berkeley claiming that Net/2 included some code that belonged to
-USL. In February of 1994, USL and Berkeley announced a settlement in
-which neither side admitted to doing anything wrong, but UCB agreed to
-stop distributing the disputed software.
-
-Since Berkeley will no longer defend this code, we have been requested
-to stop distributing it, and will be integrating all the improvements
-we have made in the VM system and i386-specific code into Berkeley's
-4.4-Lite distribution; the result will form the basis of FreeBSD 2.0.
-We expect the integration to take place over a period of three to six
-months, during which time we will have to stop work on 1.1 and
-concentrate all our efforts on the merge, and we expect to make more
-information available on the status of the merge effort as the situation
-progresses.
-
-However, to answer the question, "No. FreeBSD is not illegal." We
-have been allowed by USL to distribute 1.1 as the last Net/2 derived
-version, after which we have committed to move to 4.4 as previously
-stated.
-
-We expect to make more information available on the status of the
-merge effort as the situation progresses.
-
-0.3: What are the FreeBSD mailing lists, and how can I get on them?
-
-The following mailing lists are provided for FreeBSD users and
-developers. For more information, send to
-<majordomo@FreeBSD.ORG> and include a single line saying
-``help'' in the body of your message.
-
-announce: For announcements about or on FreeBSD.
-hackers: Useful for persons wishing to work on the internals.
-questions: General questions on FreeBSD.
-bugs: Where bugs should be sent.
-commit: This list carries the commit messages for freefall. Useful
- for tracking ongoing work.
-SCSI: Mailing list for SCSI developers.
-current: This list is for persons wishing to run FreeBSD-current
- and carries announcements and discussions on current.
-ports: Discussion of "/usr/ports"
-hardware: Types of hardware FreeBSD runs on
-security: Security issues
-platforms: Porting to non-Intel platforms
-
-Please see also the FreeBSD mailing list FAQ in:
-
- /usr/src/share/FAQ/FreeBSD.mailing-list.FAQ
-
-0.4: What are the various FreeBSD news groups?
-
-While there are no groups currently dedicated to FreeBSD, you may find
-the following groups useful.
-
-comp.os.386bsd.announce: For announcements
-comp.os.386bsd.apps: For applications
-comp.os.386bsd.questions: For questions
-comp.os.386bsd.development: For working on the internals
-comp.os.386bsd.bugs: About bugs
-comp.os.386bsd.misc: For items that don't fit anywhere else
-
-NOTE: These groups cover all the *BSDs (FreeBSD, NetBSD, 386BSD).
-
-
-
-1 Installation
---------------
-
-1.1: I just installed my system and rebooted. Now I can't find the
- extract or configure programs, where did they go?
-
-These two commands are just shell functions defined in /.profile. To
-get these back, boot FreeBSD with a `-s' at the boot prompt.
-
-
-1.2: I want to install FreeBSD onto a SCSI disk that has more than
- 1024 cylinders. How do I do it?
-
-This depends. If you don't have DOS (or another operating system) on
-the system, you can just keep the drive in native mode and simply make
-sure that your root partition is below 1024 so the BIOS can boot the
-kernel from it. It you also have DOS/some other OS on the drive then
-your best bet is to find out what parameters that it thinks you have
-before installing FreeBSD. When FreeBSD's installation procedure
-prompts you for these values, you should then enter them rather than
-simply going with the defaults.
-
-There is a freely available utility distributed with FreeBSD called
-`pfdisk' (located in the tools/ subdirectory) which can be used for
-this purpose.
-
-
-1.3: When I boot FreeBSD it says ``Missing Operating System''.
-
-See question 1.2. This is classically a case of FreeBSD and DOS or
-some other OS conflicting over their ideas of disk geometry. You will
-have to reinstall FreeBSD, but obeying the instructions given above
-will almost always get you going.
-
-
-1.4: I have an IDE drive with lots of bad blocks on it and FreeBSD doesn't
- seem to install properly.
-
-FreeBSD's bad block (bad144) handling is still not 100% (to put it
-charitably) and it must unfortunately be said that if you've got an
-IDE or ESDI drive with lots of bad blocks, then FreeBSD is probably
-not for you! That said, it does work on thousands of IDE based
-systems, so you'd do well to try it first before simply giving up.
-
-IDE drives are *supposed* to come with built-in bad-block remapping;
-if you have documentation for your drive, you may want to see if this
-feature has been disabled on your drive. However, ESDI, RLL, and
-ST-506 drives normally do not do this.
-
-<1.1.5>
-FreeBSD-current has better bad block handling due to improvments made
-to the wd driver.
-
-1.5: I have 32MB of memory, should I expect any special problems?
-
-If you have an IDE controller, no. Likewise, if you have a full EISA
-system with EISA disk controller or a working local bus controller
-(read further) you'll have no problems. If you have an ISA system, or
-an EISA system with an ISA disk controller then you will most
-certainly have problems with the upper 16MB of memory due to the ISA
-24 bit DMA limitation (which ISA cards in EISA systems will also
-exhibit). If you have a local bus disk controller, then you should be
-OK, UNLESS it's a Buslogic Bt445S with a revision less than `D' (BIOS
-3.36 or earlier).
-
-<1.1.5>
-1.1.5 has bounce-buffer support that make all of the above scenarios work
-with a full 32MB of memory or more. You are therefore advised to simply pull
-16MB of memory out, install, and then see about upgrading to FreeBSD 1.1.5
-so that you can put it back.
-
-
-1.6: Do I need to install the complete sources?
-
-In general, no. However, we would strongly recommend that you
-install, at a minimum, the `base' source kit, which includes several
-of the files mentioned here, and the `sys' (kernel) source kit, which
-includes sources for the kernel. There is nothing in the system which
-requires the presence of the sources to operate, however, except for
-the kernel-configuration program config(8). With the exception of the
-kernel sources, our build structure is set up so that you can
-read-only mount the sources from elsewhere via NFS and still be able
-to make new binaries. (Because of the kernel-source restriction, we
-recommend that you not mount this on /usr/src directly, but rather in
-some other location with appropriate symbolic links to duplicate the
-top-level structure of the source tree.)
-
-Having the sources on-line and knowing how to build a system with them
-will make it much easier for you to upgrade to future releases of
-FreeBSD.
-
-1.7: DES encryption software can not be exported from the United
- States. If I live outside the US, how can I encrypt passwords?
-
-Since the DES encryption algorithm, which is used by passwd(1) and
-friends to encrypt passwords cannot legally be exported from the US,
-non-US users should not download this software from US FTP sites.
-
-There is however a replacement libcrypt available, based on sources
-written in Australia by David Burren. This code is now available on
-some non-US FreeBSD mirror sites. Sources for the unencumbered
-libcrypt, and binaries of the programs which use it, can be obtained
-from the following FTP sites:
-
- South Africa: braae.ru.ac.za:/pub/FreeBSD/securedist/
- owl.und.ac.za (currently uncertain)
- Iceland: ftp.veda.is:/pub/crypt/FreeBSD/
-
-The non-US securedist can be used as a direct replacement for the
-encumbered US securedist. This securedist package is installed the
-same way as the US package (see installation notes for details). If
-you are going to install DES encryption, you should do so as soon as
-possible, before installing other software.
-
-Non-US users should please not download any encryption software from
-the USA. This can get the maintainers of the sites from which the
-software is downloaded into severe legal difficulties.
-
-A non-US distribution of Kerberos is also being developed, and current
-versions can generally be obtained by anonymous FTP from
-braae.ru.ac.za.
-
-There is also a mailing list for the discussion of non-US encryption
-software. For more information, send an email message with a single
-line saying ``help'' in the body of your message to
-<majordomo@braae.ru.ac.za>.
-
-1.8 HELP! My keyboard locked up during the install!
-
-Some keyboard controllers are not a friend to FreeBSD. Among these are
-those on certain models of Gateway, IBM and AST machines. The most frequent
-symptom encountered in such cases is that the keyboard refuses to respond
-to input when at the `kcopy>' prompt in the second phase of bootstrapping
-FreeBSD. Fortunately, there is a work-around that may get you all the
-way home. Reset the machine and boot the kcopy floppy again, but this
-time, as the kernel is booting, tap periodically on the num-lock key
-until the kcopy prompt appears. Your keyboard should respond properly.
-
-Once your system is on the hard disk the problem generally goes away.
-Some folks for whom the problem persists even after this stage find
-relief in switching to the SYSCONS console driver (see /sys/i386/conf/SYSCONS),
-which is in any case far more featureful than pccons and a recommended
-upgrade.
-
-
-
-2 Hardware compatibility
-------------------------
-
-2.1: What kind of hard drives does FreeBSD run on?
-
-FreeBSD supports ST-506 (sometimes called ``MFM''), RLL, and ESDI
-drives, which are usually connected to WD-1002, WD-1003, or WD-1006
-controllers (although clones should also work). FreeBSD also supports
-IDE and SCSI hard drives.
-
-2.2: What SCSI controllers are supported?
-
-FreeBSD supports the following SCSI controllers:
-
-Adaptec AH-1542 Series <ISA>
- AH-1742 Series <EISA>
-Buslogic BT-445 Series <VLB> (but see section 1.5)
- BT-545 Series <ISA>
- BT-742 Series <EISA>
- BT-747 Series <EISA>
-Future Domain TMC-8XX/950 Series <ISA> (1.1.5 ONLY)
-Seagate ST-01/02 Series <ISA> (1.1.5 ONLY)
-UltraStor UH-14f Series <ISA>
- UH-34f Series <EISA/VLB>
-
-There is supposed to be a UltraStor 24f driver floating around, but
-we're not sure where (could someone please point us at it?).
-
-2.3: What CD-ROM drives are supported by FreeBSD?
-
-Any SCSI drive connected to a supported controller. Mitsumi
-LU002(8bit), LU005(16bit) and FX001D(16bit 2x Speed).
-
-FreeBSD does NOT support drives connected to a Sound Blaster or
-non-SCSI SONY or Panasonic drives. A general rule of thumb when
-selecting a CDROM drive for FreeBSD use is to buy a very standard SCSI
-model; they cost more, but deliver very solid performance in return.
-Do not be fooled by very cheap drives that, in turn, deliver VERY LOW
-performance! As always, you get what you pay for.
-
-The Mitsumi driver is known to be extremely slow compared to SCSI
-drives.
-
-
-2.4: What multi-port serial cards are supported by FreeBSD?
-
-AST/4 and BOCA 4/8/16 port cards. Some unnamed clone cards have also
-been known to work, especially those that claim to be AST compatible.
-Check the sio(4) man page to get more information on configuring such
-cards.
-
-
-2.5: Does FreeBSD support the AHA-2742 SCSI adapter from Adaptec?
-
-No, FreeBSD does not. This is due to Adaptec's unwillingness to
-supply programming information under other than non-disclosure. This
-is unfortunate, but there's nothing we can do about it.
-
-
-2.6: I have a Mumbleco bus mouse. Is it supported and if so, how do I set
- it up for XFree86?
-
-FreeBSD supports the Logitech and ATI Inport bus mice. You need to
-add the following line to the kernel config file and recompile for the
-Logitech and ATI mice:
-
- device mse0 at isa? port 0x23c tty irq6 vector mseintr
-
-
-2.7: I have a PS/2 mouse (`keyboard' mouse) [Alternatively: I have a
- laptop with a track-ball mouse]. How do I use it?
-
-<1.1.5>: The PS/2 mouse is part of the system. See the psm0 driver
-description in /sys/doc/options.doc.
-
-
-2.8: What types of tape drives are supported under FreeBSD?
-
-FreeBSD supports SCSI, QIC-02 and QIC-40/80 (Floppy based) tape
-drives. This includes 8-mm (aka Exabyte) and DAT drives.
-
-
-2.9: What sound cards are supported by FreeBSD?
-
-FreeBSD supports the SoundBlaster, SoundBlaster Pro, Pro Audio
-Spectrum 16, AdLib and Gravis UltraSound sound cards. There is also
-limited support for MPU-401 and compatible MIDI cards. The
-SoundBlaster 16 and SoundBlaster 16 ASP cards are not yet supported.
-NOTE: This is only for sound! This driver does not support CD-ROMs,
-SCSI or joysticks on these cards.
-
-
-2.10: What network cards does FreeBSD support?
-
-There is support for the following cards:
-
-`ed' driver:
- NE2000 and 1000
- WD/SMC 8003, 8013 and Elite Ultra (8216)
- 3Com 3c503
- And clones of the above
-
-`ie' driver:
- AT&T EN100/StarLAN 10
-
-`is' driver:
- Isolan AT 4141-0
- Isolink 4110
-
-`ep' driver:
- 3com 3c509 (*)
-
-
-(*)The `ep' driver is known to have some problems; see the
-/usr/src/KNOWNBUGS file for more details.
-
-
-2.11: I have a 386/486sx/486SLC machine without a math co-processor.
- Will this cause me any problems?
-
-Generally no, but there are circumstances where you will take a hit,
-either in performance or accuracy of the math emulation code (see
-section 4.1). In particular, drawing arcs in X will be VERY slow. It
-is highly recommended that you lay out the $50 or so for a math
-co-processor; it's well worth it. NOTE: Some math co-processors are
-better than others. It pains us to say it, but nobody ever got fired
-for buying Intel. Unless you're sure it works with FreeBSD, beware of
-clones.
-
-2.12: I am about to buy a new machine to run FreeBSD on and
- want an idea of what other people are running. Is there list
- of other systems anywhere?
-
-Yes. Please look at the file FAQ/Systems-1.1.FAQ. This file
-is a listing of hardware that people are running in their machines.
-Please note, this is a raw listing of equipment that other users
-have sent in.
-
-
-
-3 Commercial Applications
--------------------------
-
-Note: This section is still very sparse, though we're hoping, of
-course, that companies will add to it! :) The FreeBSD group has no
-financial interest in any of the companies listed here but simply
-lists them as a public service (and feels that commercial interest in
-FreeBSD can have very positive effects on FreeBSD's long-term
-viability). We encourage commercial software vendors to send their
-entries here for inclusion.
-
-
-3.1: Where can I get Motif for FreeBSD?
-
-Sequoia International provides commercial quality Motif 1.2.3
-development kits for FreeBSD 1.1 (with full shared library support)
-under the product name of `SWiM'. Due to licensing restrictions from
-the OSF, and the fact that Sequoia needs to make a living, these are
-NOT FREE, but nonetheless quite reasonably priced in comparison to
-many other commercial Motif distributions. Send electronic mail to
-<info@seq.com> for further information.
-
-3.2: What about other commercial quality development systems for FreeBSD?
-
-ParcPlace Systems, Inc., who currently provides their excellent
-`Object Interface & Object Builder' GUI development environment free
-of charge to Linux users, is considering the the FreeBSD platform and
-will make their intentions known fairly shortly.
-
-
-
-4 User Applications
--------------------
-
-4.1: I want to run X, how do I go about it?
-
-First, get the XFree86 distribution of X11R5 from XFree86.cdrom.com.
-The version you want for FreeBSD 1.1 and later is XFree86 2.1. Follow
-the instructions for installation carefully. You may then wish to read
-the documentation for the ConfigXF86 tool, which assists you in
-configuring XFree86 for your particular graphics card/mouse/etc.
-
-
-4.1: I've been trying to run ghostscript on a 386 (or 486sx) with no
- math co-processor and I keep getting errors. What's up?
-
-<1.1.5>: For 1.1.5 you may add the following to your kernel config file and
-it will be compiled in.
-options GPL_MATH_EMULATE
-
-NOTE: You will need to remove the MATH_EMULATE option when you do this.
-
-
-4.2: If I want something like seyon, term, Kermit, emacs or any one of
- hundreds of popular freeware utilities, is there a good place to
- search through first?
-
-Yes, the FreeBSD `ports collection' was put together for just that
-purpose. It contains some of the most often requested languages,
-editors, mail and news reading programs, network software and many
-many megabytes of other types of useful goodies. CDROM people will
-probably have the ports collection already in /usr/ports, other folks
-can get at the latest snapshot of the entire collection in:
-
- ftp.FreeBSD.ORG:pub/FreeBSD/FreeBSD-current/ports
-
-Note that this FTP server permits getting entire directories as one
-(optionally gzipped or compressed) tar file. Read the FTP welcome
-banner carefully for details.
-
-
-4.3: I want all this neat software, but I haven't got the space or
- CPU power to compile it all myself. Is there any way of getting
- binaries?
-
-Yes. We support the concept of a `package', which is essentially a
-gzipped binary distribution with a little extra intelligence embedded
-in it for doing any custom installation work required. Packages can
-also be installed or deinstalled again easily without having to know
-the gory details. CDROM people will have a packages/ directory on
-their CD, others can get the currently available packages from:
-
- ftp.FreeBSD.ORG:pub/FreeBSD/packages-1.1
-
-Note that all ports may not be available as packages, and that new
-packages are constantly being added. It is always a good idea to
-check periodically to see which packages are available. A README file
-in the packages directory provides more details on the care and
-feeding of the package software, so no explicit details will be given
-here.
-
-4.4: I'm trying to get Perl to work properly, but I keep getting
- errors about dbm failures when I test it. How can I fix this?
-
-The problem here is that the tests are written for an older version of
-the dbm code. There is nothing wrong with perl and the errors can
-be ignored.
-
-4.5: I've been trying to get GCC 2.6.0 running on my system and it
- keeps bombing. What can I do about?
-
-Due to problems with 2.6.0 and the advent of FreeBSD 2.0, we do not
-support GCC 2.6.0 and suggest that you wait for 2.0.
-
-
-
-5 Miscellaneous Questions
-----------------
-
-5.1: I've heard of something called FreeBSD-current. How do I run it, and
- where can I get more information?
-
-Read the file /usr/src/share/FAQ/FreeBSD.current.policy,
-it will tell you all you need to know.
-
-
-5.2: What is this thing called `sup', and how do I use it?
-
-SUP stands for Software Update Protocol, and was developed by CMU for
-keeping their development trees in sync. We use it to keep remote
-sites in sync with our central development sources.
-
-To use it, you need to have direct internet connectivity (not just
-mail or news). First, pick up the sup_bin.tgz package from:
-
- ftp.FreeBSD.ORG:pub/FreeBSD/packages-1.1
-
-Second, read the file /usr/src/share/FAQ/FreeBSD.sup.faq.
-
-This file describes how to setup sup on your machine. You may also
-want to look at /usr/src/contrib/FAQ/FreeBSD.*.supfile,
-which are a set of supfiles for supping from FreeBSD.ORG
-
-
-5.3: How do I create customized installation disks that I can give
- out to other people at my site?
-
-The entire process of creating installation disks and source and
-binary archives is automated by various targets in
-/usr/src/etc/Makefile. The information there should be enough to get
-you started.
-
-5.4: How do I re-build my system without clobbering the existing
- installed binaries?
-
-If you define the environment variable DESTDIR while running `make
-world' or `make install', the newly-created binaries will be deposited
-in a directory tree identical to the installed one, rooted at
-${DESTDIR}. Some random combination of shared libraries modifications
-and program rebuilds can cause this to fail in `make world', however.
-
-
-5.5: When my system booted, it told me that ``(bus speed defaulted)''.
- What does that mean?
-
-The Adaptec 1542 SCSI host adapters allow the user to configure their
-bus access speed in software. Previous versions of the 1542 driver tried
-to determine the fastest usable speed and set the adapter to that. We
-found that this breaks some users' systems, so you now have to define
-the ``TUNE_1542''' kernel configuration option in order to have this
-take place. Using it on those systems where it works may make your
-disks run faster, but on those systems where it doesn't, your data could
-be corrupted.
-
-5.6: I would like to track changes to current and do not have net access.
- Is there any way besides downloading the whole tree?
-
-Yes, Poul-Henning has set up a source tracking list. Please email
-majordomo@ref.tfs.com with a body of "get ctm-src-cur README" for
-futher information.
-
-5.7: How do I split up large binary files into smaller 240k files
- like the distribution does?
-
-Newer BSD based systems have a "-b" option to split that allows them to
-split files on arbitary byte bondaries.
-
-Here is an example from /usr/src/Makefile.
-bin-tarball:
- (cd ${DISTDIR}; \
- tar cf - . \
- gzip --no-name -9 -c | \
- split -b 240640 - \
- ${RELEASEDIR}/tarballs/bindist/bin_tgz.)
-
-5.8: I'm running Syscons and every morning my console locks up. What
- is going on here?
-
-This sounds like the "kill -1 syslogd" problem. Make sure that the
-following is correct on your system.
-1. The attributes of the following nodes are correct.
-/dev/console
-crw------- 1 root 0, 0 May 23 15:32 /dev/console
-/dev/ttyv0
-crw------- 1 root 12, 0 May 23 15:32 /dev/ttyv0
-The part you are concerned with are the major and minor device numbers.
-
-2. Make sure that getty is running on ttyv0 and NOT console.
-
-3. If /dev/vga exists that it is a symlink to /dev/ttyv0.
-
-5.9: I've had a couple of system panics and would like to be able
- browse the system dumps. The normal kernel is stripped and
- I don't want to run a bloated kernel. What can I do?
-
-Please retrieve the file FAQ/FreeBSD.kdebug.FAQ. This
-file covers the instructions for looking at system dumps.
-
-5.10: I've got a Buslogic BT-946c with an Intel motherboard and
- right after the kernel probes, my system hangs. How do I
- fix it?
-
-Two things here.
-1. Some intel motherboards have fixed PCI INT pins and you will have
- to match the BT-946c's INT to match the motherboards.
-2. FreeBSD 1.1.5.1 expects the INT on a non-standard pin and you
- will have to also match this one.
-
-
-6 Kernel Configuration
-----------------------
-
-6.1: When I compile a kernel with multi-port serial code, it tells me
- that only the first port is probed and the rest skipped due to
- interrupt conflicts. How do I fix this?
-
-The problem here is that FreeBSD has code built-in to keep the kernel
-from getting trashed due to hardware or software conflicts. The way
-to fix this is to leave out the IRQ settings on other ports besides
-the first. Here is a example:
-
-#
-# Multiport high-speed serial line - 16550 UARTS
-#
-device sio2 at isa? port 0x2a0 tty irq 5 flags 0x501 vector siointr
-device sio3 at isa? port 0x2a8 tty flags 0x501 vector siointr
-device sio4 at isa? port 0x2b0 tty flags 0x501 vector siointr
-device sio5 at isa? port 0x2b8 tty flags 0x501 vector siointr
-
-
-6.2: FreeBSD is supposed to come with support for QIC-40/80 drives but
- when I look, I can't find it.
-
-You need to uncomment the following line in the generic config file
-(or add it to your config file) and recompile.
-
-controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr
-disk fd0 at fdc0 drive 0
-disk fd1 at fdc0 drive 1
-#tape ft0 at fdc0 drive 2
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-You will have a device called /dev/ft0, which you can write to through
-a special program to manage it called `ft' - see the man page on ft for
-further details. Versions previous to -current also had some trouble dealing
-wiht bad tape media; if you have trouble where ft seems to go back and forth
-over the same spot, try grabbing the latest version of ft from /usr/src/sbin/ft
-in current and try that.
-
-
-6.3: Does FreeBSD support IPC primitives like those in System V?
-
-Yes, FreeBSD supports System V-style IPC. This includes shared
-memory, messages and semaphores. You need to add the following lines
-to your kernel config to enable them.
-
-options SYSVSHM
-options "SHMMAXPGS=64" # 256Kb of sharable memory
-options SYSVSEM # enable for semaphores
-options SYSVMSG # enable for messaging
-
-Recompile and install.
-
-
-6.4: Are there any utilities that make configuring a kernel easier?
-
-Well, yes and no. Look in /sys/i386/doc/options.doc (/sys/doc on post
-1.1 systems) for a list of kernel options you can set, and what they
-do. For a friendlier front-end to the process, see
-/usr/src/contrib/configit
-
-
-6.5: Will FreeBSD ever support other architectures?
-
-Several different groups have expressed interest in working on
-multi-architecture support for FreeBSD. If you are interested in
-doing so, please contact the developers at
-<hackers@FreeBSD.ORG> for more information on our
-strategy for porting.
-
-
-6.6: I just wrote a device driver for a Foobar Systems, Inc.
- Integrated Adaptive Gronkulator card. How do I get the
- appropriate major numbers assigned?
-
-This depends on whether or not you plan on making the driver publicly
-available. If you do, then please send us a copy of the driver source
-code, plus the appropriate modifications to files.i386, a sample
-configuration file entry, and the appropriate MAKEDEV code to create
-any special files your device uses. If you do not, or are unable to
-because of licensing restrictions, then character major number 32 and
-block major number 8 have been reserved specifically for this purpose;
-please use them. In any case, we'd appreciate hearing about your
-driver on <hackers@FreeBSD.ORG>.
-
-6.7: I'm wanting to switch console drivers to Syscons. I changed my
- kernel config file to run Syscons, but when I reboot the system
- locks up! How do I fix it?
-
-There are four things that need to be done to properly install syscons
-on a system.
-1. Add the following line to your kernel config file while deleting the
- line for pccons.
-device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
-(Note the changed vector 'scintr'. It is a common error to change the
-device name but NOT the vector.
-
-2. Add the following option to your config file.
-options "NCONS=6" # Change to reflect the number of consoles
-
-3. Modify /etc/ttys to enable gettys on ttyv0 - ttyv??. Here is an
-example line.
-ttyv0 "/usr/libexec/getty Pc" Pc3 on secure
-Please make sure that you have disabled the getty on /dev/console.
-
-4. Create the device nodes in /dev. This is done useing the MAKEDEV
-script located in that directory. Here is a command line that will create
-6 virtual consoles.
-MAKEDEV vty6
-If /dev/vga exists, it should now be a symlink to /dev/ttyv0.
-
-NOTE: If you are going to be running X, you will need an unused vty that
- has no getty running on it.
-
-
-
-7 System Administration
------------------------
-
-7.1: How do I add a user easily? I read the man page and am more confused
- than ever! [Alternatively: I didn't read the man page, I never read
- man pages! :-) ]
-
-Look at Gary Clark's Perl package ``AddIt'', which may be found in
-/usr/src/contrib/adduser. This is a first attempt at solving the
-problem and may be replaced with a more complex but capable solution
-later.
-
-
-7.2: I'm trying to use my printer and keep running into problems. I tried
- looking at /etc/printcap, but it's close to useless. Any ideas?
-
-Yes, you can pick up Andreas Klemm's apsfilter package from:
-
-ftp.germany.eu.net:pub/comp/i386/Linux/Local.EUnet/People/akl/apsfilter-1.11.gz
-
-This is a complete package for printing text, PS and DVI files. It
-requires ghostscript and dvips.
-
-If you are looking for a simple printcap just for PS and text files,
-try picking up the printcap01 sources in:
-
- /usr/src/contrib/FAQ/code/printcap01
-
-NOTE: We're looking for printcap entries for all printers. If you
-have one, or a filter for one, please send it or mail us a pointer to
-<FreeBSD-FAQ@FreeBSD.ORG>. Thanks!
-
-7.3: Help! I've lost my root password! How do I log in now?
- Alternatively: I botched something bad in my root partition
- that keeps me from booting, how do I fix it!?
-
-Follow these steps:
-
-1. First off, you need to boot the system single-user: Do this by rebooting
-or resetting the machine, and when you come to the very first boot prompt
-(the one you probably generally just hit `return' at or wait for it to
-time-out) type:
-
- 386bsd -s
-
-This will send the `-s' flag to init(1) telling it to not bring you up all
-the way into multi-user mode. The system should come up single-user and
-present you with a simple `#' prompt.
-
-2. Now is probably a good time to type `fsck' and make sure your filesystems
-are alright. If problems on your root filesystem are found and fixed, I would
-recommend hitting the reset switch again and going back to step 1. Your
-filesystems should all check fine the second time.
-
-3. At this point, your root filesystem is mounted *read only* for safety.
-If the problems you must fix are not on the root fs then I recommend that
-you simply leave it this way and fix the other problems. If you need to
-write to the root fs (fixing passwords requires this, for one thing) and
-you're using SCSI for your root fs then type:
-
- mount -u /dev/sd0a /
-
-If you're using IDE/ESDI for your rootfs, then instead type:
-
- mount -u /dev/wd0a /
-
-This will remount your root filesystem read/write and allow you to make
-your changes. Once you have done so, I recommend another reboot. -Jordan
-
-
-8 Networking
-------------
-
-8.1: Where can I get information booting FreeBSD `diskless', that is
- booting and running a FreeBSD box from a server rather than having
- a local disk?
-
-Please read /sys/i386/netboot/netboot.doc.
-
-
-8.2: I've heard that you can use a FreeBSD box as a dedicated network
- router - is there any easy support for this?
-
-Internet standards and good engineering practice prohibit us from
-providing packet forwarding by default in FreeBSD. You can enable
-this support by adding `options GATEWAY' to your kernel configuration
-file and recompiling. In most cases, you will also need to run a
-routing process to tell other systems on your network about your
-router; FreeBSD comes with the standard BSD routing daemon routed(8),
-or for more complex situations you may want to try GateD (available by
-FTP from gated.Cornell.edu). FreeBSD is supported as of 3_5Alpha7.
-
-It is our duty to warn you that, even when FreeBSD is configured in
-this way, it does not completely comply with the Internet standard
-requirements for routers; however, it comes close enough for ordinary
-usage.
-
-There is a standard `router floppy' that you can boot on a FreeBSD
-machine to configure it as a network router. Please look in:
-
- freefall.cdrom.com:pub/incoming/freertr
-
-and follow the instructions.
-
-
-8.3: Does FreeBSD support SLIP and PPP?
-
-Yes. See the man pages for slattach(8) and/or pppd(8) if you're using
-FreeBSD to connect to another site. If you're using FreeBSD as a
-server for other machines, look at the man page for sliplogin(8).
-You may also want to take a look at the slip FAQ in:
- FAQ/FreeBSD.slip.dialup.faq
-
-8.4: How do I set up NTP?
-
-NTP configuration is so complex and widely variable from site to site
-that it would be impossible to make a blanket statement here. Your
-best bet is to ask whoever's in charge of NTP at your site or network
-provider; chances are that they are running a similar version of NTP
-to the one that we provide, and they can probably provide you with the
-right configuration files to get things going.
-
-If you can't find anyone in charge, you should examine the files in
-/usr/src/contrib/xntpd/doc and see if they help any. If not, you
-could ask on the comp.protocols.time.ntp newsgroup, or the
-<ntp@ni.umd.edu> mailing-list.
-
-8.5: How do I get my network set up? I don't see how to make my
- /dev/ed0 device!
-
-In the Berkeley networking framework, network interfaces are only
-directly accessible by kernel code. Please see the /etc/netstart file
-and the manual pages for the various network programs mentioned there
-for more information. If this leaves you totally confused, then you
-should pick up a book describing network administration on another
-BSD-related operating system; with few significant exceptions,
-administering networking on FreeBSD is basically the same as on SunOS
-4.0 or Ultrix.
-
-8.6: How do I get my 3C503 to use the other network port?
-
-Use `ifconfig ed0' to see whether the ALTPHYS flag is set, and then
-use either `ifconfig ed0 altphys' if it was off, or `ifconfig ed0
--altphys' if it was on.
-
-8.7: I'm having problems with NFS to/from FreeBSD and my Wuffotronics
- Workstation / generic NFS appliance, where should I look first?
-
-Certain PC network cards are better than others (to put it mildly) and
-can sometimes cause problems with network intensive applications like
-NFS. See /usr/src/share/FAQ/NFS.FAQ for more information on this
-topic.
-
-8.8: I want to enable IP multicast support on my FreeBSD box, how do I do it?
- [Alternatively: What the heck IS multicasting and what applications
- make use of it?]
-
-First off, to you'll need to rebuild a kernel with multicast support in it.
-This requires that you have the sources to at least the kernel and the config
-utility. See /usr/src/sys/i386/conf/LINT for its comments on multicast; you'll
-need to set the MROUTING and MULTICAST options as shown there.
-
-Further reading/exploration for those interested in multicast:
-
-Product Description Where
---------------- ----------------------- ---------------------------------------
-faq.txt Mbone FAQ ftp.isi.edu:/mbone/faq.txt
-imm/immserv IMage Multicast ftp.hawaii.edu:/paccom/imm.src.tar.Z
- for jpg/gif images.
-nv Network Video. ftp.parc.xerox.com:
- /pub/net-reseach/exp/nv3.3alpha.tar.Z
-vat LBL Visual Audio Tool. ftp.ee.lbl.gov:
- /conferencing/vat/i386-vat.tar.Z
-wb LBL White Board. ftp.ee.lbl.gov:
- /conferencing/wb/i386-wb.tar.Z
-mmcc MultiMedia Conference ftp.isi.edu:
- Control program /confctrl/mmcc/mmcc-intel.tar.Z
-rtpqual Tools for testing the ftp.psc.edu:/pub/net_tools/rtpqual.c
- quality of RTP packets.
-vat_nv_record Recording tools for vat ftp.sics.se:archive/vat_nv_record.tar.Z
- and nv.
-
-[Many thanks to Jim Lowe for providing multicast support for FreeBSD, and this
-information]
-
-
-9 Serial Communications
------------------------
-
-9.1: When I do a set line in Kermit it locks up, what's the problem?
-
-The problem here is that FreeBSD thinks it's talking to a incoming
-modem connection, and is waiting for carrier to come up on it before
-completing the open. To disable modem control, do an:
-
- stty -f /dev/ttyXX clocal
-
-(Where `ttyXX' is the tty port you're using). If you use a given port
-only for outgoing connections, you may wish to put this command in
-your /etc/rc.local to avoid having to do it every time you reboot your
-system.
-
-
-NOTE: Anyone wishing to submit a FAQ entry on how to get tip and cu working
- would have it much appreciated! We all use Kermit over here! :-)
-
------------------------------------------------------------------------------
-If you see a problem with this FAQ, or wish to submit an entry, please
-mail us at <FreeBSD-FAQ@FreeBSD.ORG>. We appreciate your
-feedback, and cannot make this a better FAQ without your help!
-
-
- FreeBSD Core Team
-
------------------------------------------------------------------------------
-
-ACKNOWLEDGMENTS:
-
-Gary Clark II - Our head FreeBSD FAQ maintenance man
-Jordan Hubbard - Janitorial services (I don't do windows)
-Garrett Wollman - Networking and formatting
-Robert Oliver, Jr. - Ideas and dumb questions (That made me think)
-Ollivier Robert - Invaluable feedback and contributions
-The FreeBSD Team - Kvetching, moaning, submitting data
-
-And to any others we've forgotten, apologies and heartfelt thanks!
-
diff --git a/share/FAQ/FreeBSD-1.X/Systems-1.1.FAQ b/share/FAQ/FreeBSD-1.X/Systems-1.1.FAQ
deleted file mode 100644
index 29b2c06..0000000
--- a/share/FAQ/FreeBSD-1.X/Systems-1.1.FAQ
+++ /dev/null
@@ -1,266 +0,0 @@
- Systems FAQ
- For FreeBSD
- Last Modified: $Id: Systems-1.1.FAQ,v 1.1 1994/09/16 18:24:40 gclarkii Exp $
-
-This FAQ is a list of systems that people have sent to the FAQ maintnance
-person for inclusion. If you have a system you would like to be included
-please send it to FreeBSD-FAQ@freefall.cdrom.com.
-
-Disclaimer: This document is composed of systems that people have sent to
-the FAQ maintnance person. It is the not to be taken as an endorsement
-for any system or manufacture.
-
-
-1.
-
-386DX/20 real AMI, ISA
-Oak SVGA (no X)
-8MB
-Adaptec 1542B, WD1007V ESDI
-Wren VI and Miniscribe 660MB 20Mbit/sec ESDI
-WD 8013EBT
-
-2.
-
-486DX/25 clone, AMI BIOS, ISA
-Orchid PCIII gas plasma (yes, VGA16)
-8MB
-Adaptec 1542B
-Micropolis 1684 SCSI
-SMC 8013EEWC
-
-3.
-
- ??? OPTI chipset AMI BIOS 486/50 ISA
-ISA ET4000 w/ X11 (not so slow)
-16 Mb - 48 Mb swap
-ISA aha1542 B
-ISA no-name IDE w/ floppies
-FUJITSU M2623S-512 405MB set to SCSI2
-SEAGATE ST3283N 237MB SCSI2
-SANYO CRD-400I SCSI2 cdromcdrom
-
-4.
-
-Lipizzan LDO-1 486DX-33 motherboard
-Orchid ProIIs (1M) video
-8 MB memory
-Generic 2S/1P/2FD/IDE controller:
-Maxtor 7213 AT
-WDC AC2420H
-PAS-16 + Sony CDU31A CD drive (Fusion 16 package).
- *** The CD drive does not currently work with FreeBSD.
-
-5.
-
-Asus VL/ISA-486SV2 (ISA-VLB as you can see)
-Orchid Fahrenheit 1280+ VLB (yes)
-20MB
-Some no-name IDE VLB controller
-Conner CP30504 (I think....the 540MB IDE one)
-Zoltrix 14.4/14.4 Fax/Modem on tty01
-Intel 486DX2/66 CPU + fan
-Conner CP30104 (120MB....for DOS)
-
-6.
-
-AIR 486El (running with AMD486/40)
-ATI Graphics Ultra Pro running XFree862.1
-16M
-Adaptec 1742
-Micropolis 2217
-Wangtec 6130FS DAT drive (Some problems)
-
-7.
-
-Compudyne 486 DX2/66
-ATI Local Bus GUP w/ 2megs
-16 Megs Memory
-504 IDE Hard Drive
-Colorado 250 meg QIC-80 tape drive
-
-8.
-
-American Megatrends Enterprise III, 486DX2-66
-ATI VLB Mach 32 (with X)
-16 meg
-Adaptec 1742 EISA SCSI with floppy
-Toshiba 5030 SCSI-II
-Toshiba 5157 SCSI-II
-SMC Elite16T ISA Ethernet (ISA)
-
-9.
-
-American Megatrends Enterprise III, 486DX
-ATI VLB Mach 32 (with X)
-32 meg
-Adaptec 1742 EISA SCSI with floppy
-Maxtor P0-12S SCSI
-Digital DSP5200S SCSI-II
-Pro Audio Spectrum 16
-Wonder Board, 4 serial (16550), 3 parallel, each on a different interrupt
-
-10.
-
-NoName 486DX/33, Intel Chipset, EISA-Bus
-ATI Graphics Ultra Pro EISA,
-17" Nanao (Eizo) F550-i Monitor
-Running the Mach32 X-Server XFree86-2.1.1 with fonts created from source.
-16 MB RAM (planning to add another 8 MB).
-AHA1742A
-Conner CP3100
-Fujitsu 520 MB
-Archive 525MB streamer tape.
-Gravis UltraSound - works for mod-files.
-
-11.
-
-ASUS SP3 PCI Board with i486 DX/2 66 MHz
-ISA ET4000 (I already tested a S3 805 PCI card successfully)
-Adaptec 1542B
-Toshiba XM3301TA CD-Rom
-CDC Harddisk, 572 MB (I don't know the exact specs)
-
-12.
-
-Mylex MAE486/33 EISA Motherboard
-16MB memory
-Actix GE32+ S3 801 gfx
-Adaptec 1742A controller
-Seagate ST3160 drive
-Seagate ST5120 drive
-Archive Viper 150MB tape
-Roland SCC-1 sound card
-Gravis Ultrasound card
-Longshine SMC/Novell compatable ethernet card
-
-13.
-
-Model: DECpc LPv 466d2
-Config: Local (Motherboard) S3 801 gfx, IDE controller, PS/2 mouse, 12MB memory
-
-14.
-
-
-??? 486/DX266 EISA/VLB Motherboard
-16MB memory
-#9 GXE L12 VLB 3MB graphics card
-Bt445S VLB disk controller
-DEC DSP3105S drive
-MAXSTOR P-17S drive
-Tandberg 525MB tape drive
-Toshiba XM3301 CDROM
-Soundblaster 2.0
-Longshine SMC/Novell compatable ethernet card
-
-15.
-
-M407 PC chips with 33Mhz 486.
-Had to disable external cache due to DMA problems. Board uses write-through
-cache unless a second chip is added to allow write-back.write-back.
-Orchid ProDesigner II (yes)
-16Mb
-IDE
-Maxtor 7213 AT and Maxtor 7120 AT
-2 BICC Isolans (Lance based cards)
-
-16.
-
-Gigabyte EISA/VLB motherboard with SIS chipset, AMI bios, 32 MB ram
-Adaptec 1742 SCSI 2 controller with floppy controller enabled
-Spea/V7 Mirage - S3/805 based localbus graphics card with 1 MB d-ram
-no name wd8013 compatible ethernet card
-Gravis Ultrasound card with 1 MB ram
-2 Fujitsu 400 MB and 1 Seagate 500 MB SCSI 2 harddisks
-5 1/4 + 3 1/2 inch floppy drives
-Tandberg TDC3600 60 MB + Tandberg TDC3800 525 MB Streamer (these don't work
-quite properly yet)
-
-17.
-
-i486DX33, 16 Mb RAM, 256 Kb external cache, VLB board
-no-name IDE/floppy controller
-Western Digital Caviar 2340 (325 Mb)
-Kalok KL-343 (40 Mb)
-Chips & Technologies 451 SuperVGA card (800x600, 16 colours, 256Kb)
-
-18.
-
-no name EISA i486DX/33 board, 16 MB RAM
-Adaptec AHA-1540*A* (not knowing if the current -current might cause
- problems, my kernel is from end of march)
-Maxtor MXT-1240S, 1.2Gig very fast SCSI disk
-Seagate ST-1144A, just to boot off the beast (also has a messdos partition yet)
-Archive Viper 150 tape; has a firmware braindeadness when appending files,
- works very well otherwise
-ELSA Winner 1000 ISA/EISA, 1MB VRAM, S3 86C928 (unfortunately, D-step chip)
-Nokia 447-B 17in monitor, running ~ 1100x800 resolution, very nice
-true `Mouse Systems' optical mouse, fine thing!
-sometimes a Toshiba XM-3301 CDROM, rather old, but solid & reliable
-
-19.
-
-older south-east Asia made notebook, i386SX/16, 5 MB RAM (where the 384 k hole
- can be re-mapped, so all the 5 MB are useable)
-Seagate ST-9145AG, 120 MB 2.5in IDE disk, very low power consumption, but
- rather slow transfer rate, only about 350 K/s, so paging is a mess
-640x480 LCD, ~ 16 gray tones distinguishable, Cirrus Logic CL-GD610/620
- chipset; runs generic VGA-Mono and VGA-16 XFree86[tm] servers; needs
- some hacks in rc.local to give full contrast when running with the
- pcvt display driver (due to their different default attribute handling)
-
-
-20.
-
-Data General Dasher 386sx/16, 8 MB RAM
-Adaptec AHA-1542B
-Seagate ST-3655N, 525 MB SCSI disk
-Conner CP-3044, 40 MB IDE disk
-has been working with a Western Digital WD-1007V ESDI controller (on
- secondary wdc address), and a Micropolis 1664-7 330 MB ESDI disk -
- but this beast was terribly slow, loud (& unreliable) and therefore
- had to go
-ET-3000 based 512 K VGA, slow (wrt. XFree86), but reliable
-3Com 3C503 Ethernet adaptor, suffers from the `do not nfs mount with
- too large packets' problem, but works well otherwise
-`Mouse Systems' optical mouse
-Toshiba XM-3301 CDROM
-already ran with a Micropolis 1664-3 330 MB SCSI disk (same drive as
- above, but different interface)
-already ran with an IBM 2Gig SCSI disk (don't remember the type)
-
-
-21.
-
-Mylex MNA 486/33 EISA Motherboard
-16Mb of Memory
-1.2 GB Toshiba 538 SCSI disk
-400Mb IBM SCSI disk
-150/250Mb Tandberg SCSI tape drive
-Toshiba 3401 SCSI CD-ROM
-Tseng 4000 Video Controller
-Logitech Bus Mouse
-Mediavision Pro Audio Stereo Sound Card
-Adaptech 1742A SCSI controller
-WD8013EBT Ethernet Card
-
-22.
-
-386DX-40 w/Cyrix math co-processor
-ET-4000 running X
-16MB
-IDE
-540MB Western Digital
-WD8003EP
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/share/FAQ/FreeBSD.FAQ b/share/FAQ/FreeBSD.FAQ
deleted file mode 100644
index d5804b0..0000000
--- a/share/FAQ/FreeBSD.FAQ
+++ /dev/null
@@ -1,1304 +0,0 @@
-
- FreeBSD
- Frequently Asked Questions
- For Version 2.0
-
-Please mail all suggestions and additions to <FAQ@FreeBSD.ORG>
-
-
-Revision: $Id: FreeBSD.FAQ,v 1.23 1995/03/11 16:48:17 roberto Exp $
-
-All entries are assumed to be relevant to FreeBSD 2.0.
-Any entries with a <XXX> are under construction.
-
-
-Table of Contents
------------------
-
-0 Preface
-1 Installation
-2 Hardware Compatibility
-3 Commercial applications
-4 User Applications
-5 Miscellaneous Questions
-6 Kernel Configuration
-7 System Administration
-8 Networking
-9 Serial Communications
-
-
-
-0 Preface
----------
-
-Welcome to the FreeBSD 2.0 FAQ! This document tries to answer some of
-the most frequently asked questions about FreeBSD 2.0.
-If there's something you're having trouble with and you do not see it
-here, please send email to:
-
- <questions@FreeBSD.ORG>
-
-
-Some of the instructions here will also refer to auxiliary utilities
-in the /usr/src/share/FAQ directory. CDROM purchasers and net folks
-who've grabbed the FreeBSD 2.0 `srcdist' will have these files. If
-you don't have the source distribution, then you can either grab the
-whole thing from:
-
- ftp://ftp.FreeBSD.ORG/pub/FreeBSD/FreeBSD-current
-
-Or you can grab only those files you're interested in straight out of
-the FreeBSD-current distribution in:
-
- ftp://ftp.FreeBSD.ORG/pub/FreeBSD/FreeBSD-current/src
-
-0.1: What is FreeBSD?
-
-FreeBSD 2.0 is a UN*X type operating system based on U.C. Berkeley's
-4.4BSD-lite release for the i386 platform. It is also based indirectly
-on William Jolitz's port of U.C. Berkeley's Net/2 to the i386, 386BSD.
-There have been many additions and bug fixes made throughout
-the entire system, some of the highlights of which are:
-
- More robust and extensive PC device support
- System V-style IPC, messaging and semaphores
- Shared Libraries
- Much improved virtual memory code
- Better console driver support
- Network booting (diskless) support
- Yellow Pages support
- Full support of the PCI bus
- Loadable kernel modules
- Too many additional utilities and applications to mention
-
-<2.X-Current>
- Serial Console Support
- Merged VM/Buffer Cache
- On demand PPP
- Sync PPP
- Improved SCSI support
-
-
-0.2: What are the FreeBSD mailing lists, and how can I get on them?
-
-The following mailing lists are provided for FreeBSD users and
-developers. For more information, send to
-<majordomo@FreeBSD.ORG> and include a single line saying
-``help'' in the body of your message.
-
-announce: For announcements about or on FreeBSD.
-hackers: Useful for persons wishing to work on the internals.
-questions: General questions on FreeBSD.
-bugs: Where bugs should be sent.
-SCSI: Mailing list for SCSI developers.
-current: This list is for persons wishing to run FreeBSD-current
- and carries announcements and discussions on current.
-security: For issues dealing with system security.
-platforms: Deals with ports to non-Intel platforms
-ports: Discussion of /usr/ports/???
-fs: Discussion of FreeBSD Filesystems
-hardware: Discussion on hardware requirements for FreeBSD.
-
-The FreeBSD-commit list has been broken up into groups dealing with different
-areas of interest. Please see the FreeBSD mailing list FAQ in:
-
- /usr/src/share/FAQ/mailing-list.FAQ
-
-
-0.3: What are the various FreeBSD news groups?
-
-While there are no groups currently dedicated to FreeBSD, you may find
-the following groups useful.
-
-comp.os.386bsd.announce: For announcements
-comp.os.386bsd.apps: For applications
-comp.os.386bsd.questions: For questions
-comp.os.386bsd.development: For working on the internals
-comp.os.386bsd.bugs: About bugs
-comp.os.386bsd.misc: For items that don't fit anywhere else
-
-NOTE: These groups cover all the *BSDs (FreeBSD, NetBSD, 386BSD).
-
-comp.os.bsd: General BSD topics, maybe of intrest
-
-NOTE: As of the date of this writing, there is has been a break up of
-newsgroups into groups for each OS. These groups can be found under
-``comp.unix.bsd''.
-
-
-1 Installation
---------------
-
-1.1: I want to install FreeBSD onto a SCSI disk that has more than
- 1024 cylinders. How do I do it?
-
-This depends. If you don't have DOS (or another operating system) on
-the system, you can just keep the drive in native mode and simply make
-sure that your root partition is below 1024 so the BIOS can boot the
-kernel from it. It you also have DOS/some other OS on the drive then
-your best bet is to find out what parameters that it thinks you have
-before installing FreeBSD. When FreeBSD's installation procedure
-prompts you for these values, you should then enter them rather than
-simply going with the defaults.
-
-There is a freely available utility distributed with FreeBSD called
-`pfdisk' (located in the tools/dos-tools subdirectory) which can be used for
-this purpose.
-
-
-1.2: When I boot FreeBSD it says ``Missing Operating System''.
-
-See question 1.2. This is classically a case of FreeBSD and DOS or
-some other OS conflicting over their ideas of disk geometry. You will
-have to reinstall FreeBSD, but obeying the instructions given above
-will almost always get you going.
-
-1.3: When I install the boot manager and try to boot FreeBSD for the
- first time, it just comes back with the boot manager prompt again.
-
-This is another symptom of the problem described in 1.2. Your
-BIOS geometry and FreeBSD geometry settings do not agree! If your
-controller or BIOS supports cylinder translation (often marked
-as ">1GB drive support"), try toggling its setting and reinstalling
-FreeBSD.
-
-1.4: I have an IDE drive with lots of bad blocks on it and FreeBSD doesn't
- seem to install properly.
-
-FreeBSD's bad block (bad144) handling is still not 100% (to put it
-charitably) and it must unfortunately be said that if you've got an
-IDE or ESDI drive with lots of bad blocks, then FreeBSD is probably
-not for you! That said, it does work on thousands of IDE based
-systems, so you'd do well to try it first before simply giving up.
-
-IDE drives are *supposed* to come with built-in bad-block remapping;
-if you have documentation for your drive, you may want to see if this
-feature has been disabled on your drive. However, ESDI, RLL, and
-ST-506 drives normally do not do this.
-
-1.5: I have 32MB of memory, should I expect any special problems?
-
-No. FreeBSD 2.0 comes with bounce buffers which allows your bus
-mastering controller access to greater than 16MB.
-
-1.6: Do I need to install the complete sources?
-
-In general, no. However, we would strongly recommend that you
-install, at a minimum, the `base' source kit, which includes several
-of the files mentioned here, and the `sys' (kernel) source kit, which
-includes sources for the kernel. There is nothing in the system which
-requires the presence of the sources to operate, however, except for
-the kernel-configuration program config(8). With the exception of the
-kernel sources, our build structure is set up so that you can
-read-only mount the sources from elsewhere via NFS and still be able
-to make new binaries. (Because of the kernel-source restriction, we
-recommend that you not mount this on /usr/src directly, but rather in
-some other location with appropriate symbolic links to duplicate the
-top-level structure of the source tree.)
-
-Having the sources on-line and knowing how to build a system with them
-will make it much easier for you to upgrade to future releases of
-FreeBSD.
-
-1.7: DES encryption software can not be exported from the United
- States. If I live outside the US, how can I encrypt passwords?
-
-If it is not absolutely imperative that you use DES style encryption,
-you can use FreeBSD's default encryption for even _better_ security,
-and with no export restrictions. FreeBSD 2.0's password default
-scrambler is now MD5 based, and is more CPU-intensive to crack
-with an automated password cracker than DES.
-
-Since the DES encryption algorithm cannot legally be exported from the US,
-non-US users should not download this software (as part of the secrdist)
-from US FTP sites.
-
-There is however a replacement libcrypt available, based on sources
-written in Australia by David Burren. This code is now available on
-some non-US FreeBSD mirror sites. Sources for the unencumbered
-libcrypt, and binaries of the programs which use it, can be obtained
-from the following FTP sites:
-
- South Africa: braae.ru.ac.za:/pub/FreeBSD/securedist/
- owl.und.ac.za (currently uncertain)
- Iceland: ftp.veda.is:/pub/crypt/FreeBSD/
-
-The non-US securedist can be used as a direct replacement for the
-encumbered US securedist. This securedist package is installed the
-same way as the US package (see installation notes for details). If
-you are going to install DES encryption, you should do so as soon as
-possible, before installing other software.
-
-Non-US users should please not download any encryption software from
-the USA. This can get the maintainers of the sites from which the
-software is downloaded into severe legal difficulties.
-
-A non-US distribution of Kerberos is also being developed, and current
-versions can generally be obtained by anonymous FTP from
-braae.ru.ac.za.
-
-There is a mailing list for the discussion of non-US encryption
-software. For more information, send an email message with a single
-line saying ``help'' in the body of your message to
-<majordomo@braae.ru.ac.za>.
-
-
-
-2 Hardware compatibility
-------------------------
-
-2.1: What kind of hard drives does FreeBSD run on?
-
-FreeBSD supports ST-506 (sometimes called ``MFM''), RLL, and ESDI
-drives, which are usually connected to WD-1002, WD-1003, or WD-1006
-controllers (although clones should also work).
-
-FreeBSD also supports IDE and SCSI hard drives.
-
-2.2: What SCSI controllers are supported?
-
-FreeBSD supports the following SCSI controllers:
-
-Adaptec AH-154x Series <ISA>
- AH-174x Series <EISA>
- AH-152x Series <ISA>
- Sound Blaster SCSI (AH-152x compat) <ISA>
- AH-2742/2842 Series <ISA/EISA>
- AH-2820/2822/2825 Series <VLB>
-Buslogic BT-445 Series <VLB> (but see section 1.5)
- BT-545 Series <ISA>
- BT-742 Series <EISA>
- BT-747 Series <EISA>
- BT-964 Series <PCI>
-Future Domain TMC-950 Series <ISA>
-PCI Generic NCR 53C810 based controllers <PCI>
-ProAudioSpectrum Zilog 5380 based controllers <ISA>
-Seagate ST-01/02 Series <ISA>
-UltraStor UH-14f Series <ISA>
- UH-34f Series <EISA/VLB>
-
-<2.X-Current Only>
-Western Digital WD7000 <ISA> <No scatter/gather>
-Adaptec AH-294x and aic7870 MB controllers <PCI>
-ProAudioSpectrum Trantor 130 based controllers <ISA>
-
-2.3: What CD-ROM drives are supported by FreeBSD?
-
-Any SCSI drive connected to a supported controller.
-Mitsumi LU002(8bit), LU005(16bit) and FX001D(16bit 2x Speed).
-
-<2.X-Current>
-Sound Blaster Non-SCSI CD-ROM
-
-FreeBSD does not support any of the ``IDE'' CD-ROM interfaces.
-All non-SCSI cards are known to be extremely slow compared to SCSI
-drives.
-
-2.4: What multi-port serial cards are supported by FreeBSD?
-
-AST/4
-BOCA 4/8/16 port cards.
-
-<2.X-Current>
-Cyclades 8/16 port <Alpha>
-
-Some unnamed clone cards have also been known to work,, especially those
-that claim to be AST compatible.
-Check the sio(4) man page to get more information on configuring such
-cards.
-
-
-2.5: Does FreeBSD support the AHA-2742/2842 SCSI adapters from Adaptec?
-
-Yes, though portions of the sources are currently GPL'd (that is to say,
-distributed under the GNU Public License), so be aware of the fact should
-you wish to distribute kernel binaries compiled with it - you MUST also
-provide the sources to the driver with the kernel image to stay legal
-with the GPL! This is easily enough done by simply including the contents
-of /usr/src/sys/gnu/{aic7770,misc} on whatever media you distribute the
-kernel.
-
-We are working to get the GPL restriction removed, but for now you should
-at least be aware of it.
-
-
-2.6: I have a Mumbleco bus mouse. Is it supported and if so, how do I set
- it up for XFree86?
-
-FreeBSD supports the Logitech and ATI Inport bus mice. You need to
-add the following line to the kernel config file and recompile for the
-Logitech and ATI mice:
-
- device mse0 at isa? port 0x23c tty irq6 vector mseintr
-
-
-2.7: I have a PS/2 mouse (`keyboard' mouse) [Alternatively: I have a
- laptop with a track-ball mouse]. How do I use it?
-
-
-
-2.8: What types of tape drives are supported under FreeBSD?
-
-FreeBSD supports SCSI, QIC-02 and QIC-40/80 (Floppy based) tape
-drives. This includes 8-mm (aka Exabyte) and DAT drives.
-
-
-2.9: What sound cards are supported by FreeBSD?
-
-FreeBSD supports the SoundBlaster, SoundBlaster Pro, Pro Audio
-Spectrum 16, AdLib and Gravis UltraSound sound cards. There is also
-limited support for MPU-401 and compatible MIDI cards. The
-SoundBlaster 16 and SoundBlaster 16 ASP cards are not yet supported.
-NOTE: This is only for sound! This driver does not support CD-ROMs,
-SCSI or joysticks on these cards.
-
-
-2.10: What network cards does FreeBSD support?
-
-There is support for the following cards:
-
-`ed' driver:
- NE2000 and 1000
- WD/SMC 8003, 8013 and Elite Ultra (8216)
- 3Com 3c503
- And clones of the above
-
-`de' driver:
- DEC and compatible PCI controllers.
-
-`le' driver:
- DEC LANCE ethernet based controllers.
-
-`ie' driver:
- AT&T EN100/StarLAN 10
- 3Com 3c507
-
-`is' driver:
- Isolan AT 4141-0
- Isolink 4110
-
-`ep' driver:
- 3com 3c509 (*)
-
-`el' driver:
- 3com 3c501 (*)
-
-`ze' driver:
- IBM PCMCIA credit card adapter
-
-`lnc' driver:
- Unknown Lance based (*)
-
-<2.X-Current>
-
-`cx' driver
- Cronyx/Sigma multiport Sync/Async (Cisco and PPP framing)
-
-`zp' driver
- 3Com PCMCIA Etherlink III
-
-Note: Drivers marked with (*) are known to have problems.
-
-Note: We also support TCP/IP over parallel lines. At this point we are
- incompatiable with other versions, but we hope to correct this in
- the near future.
-
-2.11: I have a 386/486sx/486SLC machine without a math co-processor.
- Will this cause me any problems?
-
-Generally no, but there are circumstances where you will take a hit,
-either in performance or accuracy of the math emulation code (see
-section 4.1). In particular, drawing arcs in X will be VERY slow. It
-is highly recommended that you lay out the $50 or so for a math
-co-processor; it's well worth it. NOTE: Some math co-processors are
-better than others. It pains us to say it, but nobody ever got fired
-for buying Intel. Unless you're sure it works with FreeBSD, beware of
-clones.
-
-2.12: What other devices does 2.X support?
-
-Here is a listing of drivers that do not fit into any of the above areas.
-
-b004.c Driver for B004 compatiable Transputer boards
-ctx.c Driver for CORTEX-I Frame grabber
-gpib.c Driver for National Instruments AT-GPIB and AT-GPIB/TNT boards
-pcaudio.c Driver for PC speakers to allow the playing of audio files
-tw.c Driver for the X-10 POWERHOUSE
-
-<2.X-Current>
-spigot.c Driver for the Creative Labs Video Spigot
-gsc.c Driver for the Genuis GS-4500 Hand scanner
-joy.c Driver for a joystick
-
-2.13: I am about to buy a new machine to run FreeBSD on and
- want an idea of what other people are running. Is there list
- of other systems anywhere?
-
-Yes. Please look at the file Systems.FAQ. This file
-is a listing of hardware that people are running in their machines.
-Please note, this is a raw listing of equipment that other users
-have sent in, and does not constitute any kind of endorsement by the
-FreeBSD Project.
-
-2.14: I have a lap-top with power management. Can FreeBSD take advantage
- of this?
-
-Yes it can on certain machines. Please look in the LINT kernel config
-file under APM.
-
-
-
-3 Commercial Applications
--------------------------
-
-Note: This section is still very sparse, though we're hoping, of
-course, that companies will add to it! :) The FreeBSD group has no
-financial interest in any of the companies listed here but simply
-lists them as a public service (and feels that commercial interest in
-FreeBSD can have very positive effects on FreeBSD's long-term
-viability). We encourage commercial software vendors to send their
-entries here for inclusion.
-
-
-3.1: Where can I get Motif for FreeBSD?
-
-You can purchase Motif 1.2.3 for FreeBSD (SWiM) from the ACC Bookstore,
-P.O. Box 3364, Westport CT. 06880. 1-800-546-7274 or FAX: 1-203-454-2582
-
-This software works flawlessly for for FreeBSD 1.1.5 but has shown
-one problem with 2.0 in that the "uil" program core dumps. This is
-apparently because of the way uil is installed, and it's quite possible
-that ACC will have a fixed version by the time you read this. No
-other compatibility problems with the programs or libraries have been
-found, and ACC can hardly be blamed for failing to work perfectly with
-a brand-new release they haven't even seen yet! :)
-
-
-3.2: Are there any commercial X servers for some of the high-end
- graphics cards like the Matrox or #9 I-128, or offering 8/16/24
- bit deep pallettes?
-
-Yes, X Inside Incorporated sells their Accelerated-X product for
-FreeBSD and other Intel based systems.
-
-This high performance X Server offers easy configuration, support
-for multiple concurrent video boards and is distributed in binary
-form only.
-
-Price is $99.50 (promotional price for Linux/FreeBSD version) for
-the 1.1 version, which is available now.
-
-This product is for FreeBSD 1.1 and runs under 2.0 with the FreeBSD 1.1
-compatibility libs (`compat1xdist').
-
-More info: URL http://www.xinside.com/
- or URL ftp://ftp.xinside.com/accelx/1.1/prodinfo.txt
- or email info@xinside.com
- or phone +1(303)384-9999
-
-
-3.3: Any other applications I might be interested in?
-
-RenderMorphics, Ltd. sells a high-speed 3D rendering package for
-FreeBSD called "Reality Lab" (tm). Send email to info@render.com
-or call: +44(0)71-251-4411 / FAX: +44(0)71-251-0939
-
-This package is also for FreeBSD 1.1.5 but has been tested and shown
-to run under FreeBSD 2.0 with the compat1xdist installed.
-
-Thanks must be extended to all of these companies for showing enough faith
-in FreeBSD to port their products to it. While we get no direct benefit
-from the sales of these products, the indirect benefits of FreeBSD
-proving itself to be a successful platform for such commercial interests
-will be immense! We wish these companies every measure of success, and
-can only hope that others are encouraged to follow suit.
-
-
-4 User Applications
--------------------
-
-4.1: I want to run X, how do I go about it?
-
-First, get the XFree86 distribution of X11R6 from XFree86.cdrom.com.
-The version you want for FreeBSD 2.X and later is XFree86 3.1.1. Follow
-the instructions for installation carefully. You may then wish to read
-the documentation for the ConfigXF86 tool, which assists you in
-configuring XFree86 for your particular graphics card/mouse/etc.
-
-You may also wish to investigate the Xaccel server, which is available
-at a very reasonable price. See section 3.2 for more details.
-
-4.2: I've been trying to run ghostscript on a 386 (or 486sx) with no
- math co-processor and I keep getting errors. What's up?
-
-You will need to add the alternate math emulator to your kernel, you do this
-by adding the following to your kernel config file and it will be compiled in.
-
-options GPL_MATH_EMULATE
-
-NOTE: You will need to remove the MATH_EMULATE option when you do this.
-
-
-4.2: I want all this neat software, but I haven't got the space or
- CPU power to compile it all myself. Is there any way of getting
- binaries?
-
-Yes. We support the concept of a `package', which is essentially a
-gzipped binary distribution with a little extra intelligence embedded
-in it for doing any custom installation work required. Packages can
-also be installed or deinstalled again easily without having to know
-the gory details. CDROM people will have a packages/ directory on
-their CD, others can get the currently available packages from:
-
- ftp://ftp.FreeBSD.ORG/pub/FreeBSD/packages
-
-Note that all ports may not be available as packages, and that new
-packages are constantly being added. It is always a good idea to
-check periodically to see which packages are available. A README file
-in the packages directory provides more details on the care and
-feeding of the package software, so no explicit details will be given
-here.
-
-
-
-
-5 Miscellaneous Questions
-----------------
-
-5.1: I've heard of something called FreeBSD-current. How do I run it, and
- where can I get more information?
-
-Read the file /usr/src/share/FAQ/current-policy.FAQ,
-it will tell you all you need to know.
-
-
-5.2: What is this thing called `sup', and how do I use it?
-
-SUP stands for Software Update Protocol, and was developed by CMU for
-keeping their development trees in sync. We use it to keep remote
-sites in sync with our central development sources.
-
-Unless you have direct internet connectivity, and don't care too much
-about the cost/duration of the sessions, you shouldn't use sup. For
-those "low/expensive-bandwidth" applications, we have developed CTM,
-see 5.6 for more about that.
-
-To use it, you need to have direct internet connectivity (not just
-mail or news). First, pick up the sup.tgz package from:
-
- ftp://ftp.FreeBSD.ORG/pub/FreeBSD/packages/sup.tgz
-
-Second, read the file /usr/src/share/FAQ/sup.FAQ.
-
-This file describes how to setup sup on your machine. You may also
-want to look at /usr/src/share/FAQ/extras/*.supfile, or you may grab updated
-supfiles from:
-
- ftp://ftp.FreeBSD.ORG//pub/FreeBSD/FAQ/extras
-
-which are a set of supfiles for supping from FreeBSD.ORG.
-
-
-5.3: How do I create customized installation disks that I can give
- out to other people at my site?
-
-The entire process of creating installation disks and source and
-binary archives is automated by various targets in
-/usr/src/etc/Makefile. The information there should be enough to get
-you started.
-
-5.4: How do I re-build my system without clobbering the existing
- installed binaries?
-
-If you define the environment variable DESTDIR while running `make
-world' or `make install', the newly-created binaries will be deposited
-in a directory tree identical to the installed one, rooted at
-${DESTDIR}. Some random combination of shared libraries modifications
-and program rebuilds can cause this to fail in `make world', however.
-
-
-5.5: When my system booted, it told me that ``(bus speed defaulted)''.
- What does that mean?
-
-The Adaptec 1542 SCSI host adapters allow the user to configure their
-bus access speed in software. Previous versions of the 1542 driver tried
-to determine the fastest usable speed and set the adapter to that. We
-found that this breaks some users' systems, so you now have to define
-the ``TUNE_1542''' kernel configuration option in order to have this
-take place. Using it on those systems where it works may make your
-disks run faster, but on those systems where it doesn't, your data could
-be corrupted.
-
-5.6: I would like to track changes to current and do not have net access.
- Is there any way besides downloading the whole tree?
-
-Yes, you can use the CTM facility. Check out the ctm.FAQ file or
- ftp://freefall.cdrom.com/pub/CTM/README
-for more information.
-
-5.7: How do I split up large binary files into smaller 240k files
- like the distribution does?
-
-Newer BSD based systems have a "-b" option to split that allows them to
-split files on arbitary byte bondaries.
-
-Here is an example from /usr/src/Makefile.
-bin-tarball:
- (cd ${DISTDIR}; \
- tar cf - . \
- gzip --no-name -9 -c | \
- split -b 240640 - \
- ${RELEASEDIR}/tarballs/bindist/bin_tgz.)
-
-
-<XXX> 5.8: I've had a couple of system panics and would like to be able
- browse the system dumps. The normal kernel is stripped and
- I don't want to run a bloated kernel. What can I do?
-
-5.9: I just got a Perl application and it's bombing looking for
- *.ph. Where is it?
-
-There was a minor SNAFU in the 2.0-R bindist and they got left out.
-If you have the source, you just have to do a "make install" from
-/usr/src/gnu/usr.bin/perl/lib and everything will be fine. Or you
-may ftp to phoenix-gw.gbdata.com and grab them from ~/pub/perl/libs.tar.gz.
-
-5.10: I've got this neato kernel extension I just know everyone will
- will want. How do I get it included into the distribution?
-
-Please take a look at the FAQ for submiting code to FreeBSD at:
-
- ftp://ftp.FreeBSD.ORG/pub/FreeBSD/FAQ/submitters.FAQ
-
-And thanks for the thought.
-
-
-6 Kernel Configuration
-----------------------
-
-6.0: Ok, so how DO I compile my own kernel, anyway?
-
-Before you can compile a kernel, you need either the complete srcdist
-or, at the minimum, the kerndist loaded on your system. This provides
-the necessary sources for building the kernel, as we have a policy of
-NOT shipping our kernels in linkable object form as most commercial
-UNIX vendors do. Shipping the source takes a bit more space, but it also
-means that you can refer to the actual kernel sources in case of difficulty
-or to further your understanding of what's *actually* happening.
-
-Anyway, to answer the question, once you have the kerndist or srcdist
-loaded, do this:
-
- 6.0.1: cd /usr/src/sys/i386/conf
- 6.0.2: cp GENERIC MYKERNEL
- 6.0.3: vi MYKERNEL
- 6.0.4: config MYKERNEL
- 6.0.5: cd ../../compile/MYKERNEL
- 6.0.6: make all
- 6.0.7: make install
- 6.0.8: reboot
-
-Step 6.0.2 may not be necessary if you already have a kernel configuration
-file from a previous release of FreeBSD 2.x. - simply bring your old one
-over and check it carefully for any drivers that may have changed boot
-syntax or been rendered obsolete.
-
-A good kernel config file to look into is LINT, which contains entries for
-*all* possible kernel options and documents them fairly well. The GENERIC
-kernel config file is used to build the initial release you probably loaded
-(unless you upgraded in-place) and contains entries for the most common
-configurations. It's a pretty good place to start from.
-
-If you don't need to make any changes to GENERIC, you can also skip step
-6.0.3, where you customize the kernel for your configuration. Step 6.0.7
-should only be undertaken if step 6.0.6 succeeds. This will copy
-the new kernel image to /kernel and BACK UP YOUR OLD ONE IN /kernel.old!
-It's very important to remember this in case the new kernel fails to work
-for some reason - you can still select /kernel.old at the boot prompt to
-boot the old one. When you reboot, the new kernel will boot by default.
-
-If the compile in 6.0.6 falls over for some reason, then it's recommended
-that you start from step 6.0.4 but substitute GENERIC for MYKERNEL. If you
-can generate a GENERIC kernel, then it's likely something in your special
-configuration file that's bad (or you've uncovered a bug!). If the build
-of the GENERIC kernel does NOT succeed, then it's very likely that your
-sources are somehow corrupted.
-
-Finally, if you need to see your original boot messages again to compile
-a new kernel that's better tailored to your hardware, try the `dmesg' command.
-It should print out all the boot-time messages printed by your old kernel,
-some of which may be quite helpful in configuring the new one.
-
-
-6.1: When I compile a kernel with multi-port serial code, it tells me
- that only the first port is probed and the rest skipped due to
- interrupt conflicts. How do I fix this?
-
-The problem here is that FreeBSD has code built-in to keep the kernel
-from getting trashed due to hardware or software conflicts. The way
-to fix this is to leave out the IRQ settings on other ports besides
-the first. Here is a example:
-
-#
-# Multiport high-speed serial line - 16550 UARTS
-#
-device sio2 at isa? port 0x2a0 tty irq 5 flags 0x501 vector siointr
-device sio3 at isa? port 0x2a8 tty flags 0x501 vector siointr
-device sio4 at isa? port 0x2b0 tty flags 0x501 vector siointr
-device sio5 at isa? port 0x2b8 tty flags 0x501 vector siointr
-
-
-6.2: FreeBSD is supposed to come with support for QIC-40/80 drives but
- when I look, I can't find it.
-
-You need to uncomment the following line in the generic config file
-(or add it to your config file) and recompile.
-
-controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr
-disk fd0 at fdc0 drive 0
-disk fd1 at fdc0 drive 1
-#tape ft0 at fdc0 drive 2
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-You will have a device called /dev/ft0, which you can write to through
-a special program to manage it called `ft' - see the man page on ft for
-further details. Versions previous to -current also had some trouble dealing
-wiht bad tape media; if you have trouble where ft seems to go back and forth
-over the same spot, try grabbing the latest version of ft from /usr/src/sbin/ft
-in current and try that.
-
-
-6.3: Does FreeBSD support IPC primitives like those in System V?
-
-Yes, FreeBSD supports System V-style IPC. This includes shared
-memory, messages and semaphores. You need to add the following lines
-to your kernel config to enable them.
-
-options SYSVSHM
-options "SHMMAXPGS=64" # 256Kb of sharable memory
-options SYSVSEM # enable for semaphores
-options SYSVMSG # enable for messaging
-
-Recompile and install.
-
-
-6.4: Will FreeBSD ever support other architectures?
-
-Several different groups have expressed interest in working on
-multi-architecture support for FreeBSD. If you are interested in
-doing so, please contact the developers at
-<FreeBSD-hackers@FreeBSD.ORG> for more information on our
-strategy for porting.
-
-
-6.5: I just wrote a device driver for a Foobar Systems, Inc.
- Integrated Adaptive Gronkulator card. How do I get the
- appropriate major numbers assigned?
-
-This depends on whether or not you plan on making the driver publicly
-available. If you do, then please send us a copy of the driver source
-code, plus the appropriate modifications to files.i386, a sample
-configuration file entry, and the appropriate MAKEDEV code to create
-any special files your device uses. If you do not, or are unable to
-because of licensing restrictions, then character major number 32 and
-block major number 8 have been reserved specifically for this purpose;
-please use them. In any case, we'd appreciate hearing about your
-driver on <FreeBSD-hackers@FreeBSD.ORG>.
-
-
-
-7 System Administration
------------------------
-
-7.1: How do I add a user easily? I read the man page and am more confused
- than ever! [Alternatively: I didn't read the man page, I never read
- man pages! :-) ]
-
-Use the adduser command.
-
-
-<XXX> 7.2: I'm trying to use my printer and keep running into problems. I tried
- looking at /etc/printcap, but it's close to useless. Any ideas?
-
-
-
-8 Networking
-------------
-
-
-8.2: I've heard that you can use a FreeBSD box as a dedicated network
- router - is there any easy support for this?
-
-Internet standards and good engineering practice prohibit us from
-providing packet forwarding by default in FreeBSD. You can enable
-this support by adding `options GATEWAY' to your kernel configuration
-file and recompiling. In most cases, you will also need to run a
-routing process to tell other systems on your network about your
-router; FreeBSD comes with the standard BSD routing daemon routed(8),
-or for more complex situations you may want to try GateD (available by
-FTP from gated.Cornell.edu) which supports FreeBSD as of 3_5Alpha7.
-
-It is our duty to warn you that, even when FreeBSD is configured in
-this way, it does not completely comply with the Internet standard
-requirements for routers; however, it comes close enough for ordinary
-usage.
-
-
-8.3: Does FreeBSD support SLIP and PPP?
-
-Yes. See the man pages for slattach(8) and/or pppd(8) if you're using
-FreeBSD to connect to another site. If you're using FreeBSD as a
-server for other machines, look at the man page for sliplogin(8).
-You may also want to take a look at the slip FAQ in:
- /usr/src/share/FAQ/Slip.FAQ
-
-8.4: How do I get my network set up? I don't see how to make my
- /dev/ed0 device!
-
-In the Berkeley networking framework, network interfaces are only
-directly accessible by kernel code. Please see the /etc/netstart file
-and the manual pages for the various network programs mentioned there
-for more information. If this leaves you totally confused, then you
-should pick up a book describing network administration on another
-BSD-related operating system; with few significant exceptions,
-administering networking on FreeBSD is basically the same as on SunOS
-4.0 or Ultrix.
-
-8.5: How do I get my 3C503 to use the other network port?
-
-Use `ifconfig ed0' to see whether the ALTPHYS flag is set, and then
-use either `ifconfig ed0 altphys' if it was off, or `ifconfig ed0
--altphys' if it was on.
-
-8.6: I'm having problems with NFS to/from FreeBSD and my Wuffotronics
- Workstation / generic NFS appliance, where should I look first?
-
-Certain PC network cards are better than others (to put it mildly) and
-can sometimes cause problems with network intensive applications like
-NFS. See /usr/src/share/FAQ/NFS.FAQ for more information on this
-topic.
-
-8.8: I want to enable IP multicast support on my FreeBSD box, how do I do it?
- [Alternatively: What the heck IS multicasting and what applications
- make use of it?]
-
-Multicast host operations are fully supported in FreeBSD 2.0 by default.
-If you want your box to run as a multicast router, you will need to load
-the ip_mroute_mod loadable kernel module and run mrouted.
-
-For more information:
-
-Product Description Where
---------------- ----------------------- ---------------------------------------
-faq.txt Mbone FAQ ftp.isi.edu:/mbone/faq.txt
-imm/immserv IMage Multicast ftp.hawaii.edu:/paccom/imm.src.tar.Z
- for jpg/gif images.
-nv Network Video. ftp.parc.xerox.com:
- /pub/net-reseach/exp/nv3.3alpha.tar.Z
-vat LBL Visual Audio Tool. ftp.ee.lbl.gov:
- /conferencing/vat/i386-vat.tar.Z
-wb LBL White Board. ftp.ee.lbl.gov:
- /conferencing/wb/i386-wb.tar.Z
-mmcc MultiMedia Conference ftp.isi.edu:
- Control program /confctrl/mmcc/mmcc-intel.tar.Z
-rtpqual Tools for testing the ftp.psc.edu:/pub/net_tools/rtpqual.c
- quality of RTP packets.
-vat_nv_record Recording tools for vat ftp.sics.se:archive/vat_nv_record.tar.Z
- and nv.
-
-
-
-9 Serial Communications
------------------------
-
-This section answers common questions about serial communications with
-FreeBSD.
-
-9.1: How do I tell if FreeBSD found my serial ports or modem cards?
-
-As the FreeBSD kernel boots, it will probe for the serial ports in
-your system for which the kernel was configured. You can either watch
-your system closely for the messages it prints or run the command
-
- dmesg | grep sio
-
-after your system's up and running.
-
-Here's some example output from the above command:
-
- sio0 at 0x3f8-0x3ff irq 4 on isa
- sio0: type 16550A
- sio1 at 0x2f8-0x2ff irq 3 on isa
- sio1: type 16550A
-
-This shows two serial ports. The first is on irq 4, is using port
-address 0x3f8, and has a 16550A-type UART chip. The second uses the
-same kind of chip but is on irq 3 and is at port address 0x2f8.
-Internal modem cards are treated just like serial ports---except that
-they always have a modem ``attached'' to the port.
-
-The GENERIC kernel includes support for two serial ports using the
-same irq and port address settings in the above example. If these
-settings aren't right for your system, or if you've added modem cards
-or have more serial ports than your kernel is configured for, just
-reconfigure your kernel. See section 7 of the FAQ for more details.
-
-9.2: How do I access the serial ports once FreeBSD is running?
-
-The third serial port, sio2 (known as COM3 in DOS), is on /dev/tty02
-for directly-connected devices, on /dev/cuaa2 for dial-out devices,
-and on /dev/ttyd2 for dial-in devices. What's the difference between
-these three classes of devices?
-
-You use ttyXX for directly-connected or hardwired devices, like
-printers or terminals.
-
-In place of ttyXX, you can use the pair of devices cuaaX and ttydX.
-You use ttydX for dial-ins. The ttydX device acts like the ttyXX
-device, but it also uses the modem control lines. When opening
-/dev/ttydX in blocking mode, a process will wait for the corresponding
-cuaaX device to become inactive, and then wait for the carrier detect
-line to go active. When you open the cuaaX device, it makes sure the
-serial port isn't already in use by the ttydX device. If the port's
-available, it ``steals'' it from the ttydX device. Also, the cuaaX
-device doesn't care about carrier detect. With this scheme and an
-auto-answer modem, you can have remote users log in and you can still
-dialout with the same modem and the system will take care of all the
-conflicts.
-
-9.3: How do I configure the kernel for my multiport serial card?
-
-Again, the section on kernel configuration provides information about
-configuring your kernel. For a multiport serial card, place an sio
-line for each serial port on the card in the kernel configuration
-file. But place the irq and vector specifiers on only one of the
-entries. All of the ports on the card should share one irq. For
-consistency, use the last serial port to specify the irq. Also,
-specify the COM_MULTIPORT option.
-
-The following example is for an AST 4-port serial card on irq 7:
-
- options "COM_MULTIPORT"
- device sio4 at isa? port 0x2a0 tty flags 0x781
- device sio5 at isa? port 0x2a8 tty flags 0x781
- device sio6 at isa? port 0x2b0 tty flags 0x781
- device sio7 at isa? port 0x2b8 tty flags 0x781 irq 7 vector siointr
-
-The flags indicate that the master port has minor number 7 (0x700),
-diagnostics enabled during probe (0x080), and all the ports share an
-irq (0x001).
-
-9.4: I have two multiport serial cards that can share irqs. Can
- FreeBSD handle this?
-
-Not yet. You'll have to use a different irq for each card.
-
-9.5: What's the difference between tty01, ttyi01, and ttyl01? Or,
- how can I set the default serial parameters for a port?
-
-The ttyXX (or cuaaX or ttydX) device is the regular device you'll want
-to open for your applications. When a process opens the device, it'll
-have a default set of terminal I/O settings. You can see these
-settings with the command
-
- stty -a -f /dev/tty01
-
-When you change the settings to this device, the settings are in
-effect until the device is closed. When it's reopened, it goes back
-to the default set. To make changes to the default set, you can open
-and adjust the settings of the ``initial state'' device. For example,
-to turn on CLOCAL mode, 8 bits, and XON/XOFF flow control by default
-for tty05, do:
-
- stty -f /dev/ttyi05 clocal cs8 ixon ixoff
-
-A good place to do this is in /etc/rc.serial. Now, an application
-will have these settings by default when it opens tty05. It can still
-change these settings to its liking, though.
-
-You can also prevent certain settings from being changed by an
-application by making adjustments to the ``lock state'' device. For
-example, to lock the speed of tty05 to 57600 bps, do
-
- stty -f /dev/ttyl05 57600
-
-Now, an application that opens tty05 and tries to change the speed of
-the port will be stuck with 57600 bps.
-
-Naturally, you should make the initial state and lock state devices
-writable only by root. The MAKEDEV script does NOT do this when it
-creates the device entries.
-
-9.6: How can I enable dialup logins on my modem?
-
-So you want to become an Internet service provider, eh? First, you'll
-need one or more modems that can autoanswer. Your modem will need to
-assert carrier-detect when it detects a carrier and not assert it all
-the time. It will need to hang up the phone and reset itself when the
-data terminal ready (DTR) line goes from on to off. It should
-probably use RTS/CTS flow control or no local flow control at all.
-Finally, it must use a constant speed between the computer and itself,
-but (to be nice to your callers) it should negotiate a speed between
-itself and the remote modem.
-
-For many Hayes command-set--compatible modems, this command will
-make these settings and store them in nonvolatile memory:
-
- AT &C1 &D3 &K3 &Q6 S0=1 &W
-
-See 9.10 below for information on how to make these settings without
-resorting to an MS-DOS terminal program.
-
-Next, make an entry in /etc/ttys for the modem. This file lists all
-the ports on which the operating system will await logins. Add a line
-that looks something like this:
-
- ttyd1 "/usr/libexec/getty std.57600" dialup on insecure
-
-This line indicates that the second serial port (/dev/ttyd1) has a
-modem connected running at 57600 bps and no parity (std.57600, which
-comes from the file /etc/gettytab). The terminal type for this port
-is ``dialup.'' The port is ``on'' and is ``insecure''---meaning root
-logins on the port aren't allowed. For dialin ports like this one,
-use the ttydX entry.
-
-It's common practice to use ``dialup'' as the terminal type. Many
-users set up in their .profile or .login files a prompt for the actual
-terminal type if the starting type is dialup. The example shows the
-port as insecure. To become root on this port, you have to login as a
-regular user, then ``su'' to root. If you use ``secure'' then root
-can login in directly.
-
-After making modifications to /etc/ttys, you need to send a hangup or
-HUP signal to the init process:
-
- kill -1 1
-
-This forces the init process to reread /etc/ttys. The init process
-will then start getty processes on all ``on'' ports. You can find out
-if logins are available for your port by typing
-
- ps -ax | grep '[t]tyd1'
-
-You should see something like:
-
- 747 ?? I 0:00.04 /usr/libexec/getty std.57600 ttyd1
-
-9.7: How can I make my spare computer a dumb terminal connected to my
- FreeBSD box?
-
-If you're using another computer as a terminal into your FreeBSD
-system, get a null modem cable to go between the two serial ports. If
-you're using an actual terminal, see its accompanying instructions.
-
-Then, modify /etc/ttys, like above. For example, if you're hooking up
-a WYSE-50 terminal to the fifth serial port, use an entry like this:
-
- tty04 "/usr/libexec/getty std.38400" wyse50 on secure
-
-This example shows that the port on /dev/tty04 has a wyse50 terminal
-connected at 38400 bps with no parity (std.38400 from /etc/gettytab)
-and root logins are allowed (secure). For directly-connected
-terminals, use the ttyXX entry.
-
-9.8: Why can't I run tip or cu?
-
-On your system, the programs tip and cu are probably executable only
-by uucp and group dialer. You can use the group dialer to control who
-has access to your modem or remote systems. Just add yourself to
-group dialer.
-
-Alternatively, you can let everyone on your system run tip and cu by
-typing:
-
- chmod 4511 /usr/bin/tip
-
-You don't have to run this command for cu, since cu is just a hard
-link to tip.
-
-9.9: My stock Hayes modem isn't supported---what should I do?
-
-Actually, the man page for tip is out of date. There is a generic
-Hayes dialer already built in. Just use ``at=hayes'' in your
-/etc/remote file.
-
-The Hayes driver isn't smart enough to recognize some of the advanced
-features of newer modems---messages like BUSY, NO DIALTONE, or CONNECT
-115200 will just confuse it. You should turn those messages off when
-you use tip (using ATX0&W).
-
-Also, the dial timeout for tip is 60 seconds. Your modem should use
-something less, or else tip will think there's a communication
-problem. Try ATS7=45&W.
-
-9.10: How am I expected to enter these AT commands without
- resorting to some DOS-based terminal program?
-
-Make what's called a ``direct'' entry in your /etc/remote file. For
-example, if your modem's hooked up to the first serial port,
-/dev/cuaa0, then put in the following line:
-
- cuaa0:dv=/dev/cuaa0:br#19200:pa=none
-
-Use the highest bps rate your modem supports in the br capability.
-Then, type ``tip cuaa0'' and you'll be connected to your modem.
-
-If there is no /dev/cuaa0 on your system, do this:
-
- cd /dev
- MAKEDEV cuaa0
-
-9.11: Why doesn't the @ sign for the phone number capability work?
-
-The @ sign in the pn capability tells tip to look in /etc/phones for a
-phone number. But the @ sign is also a special character in
-capability files like /etc/remote. Escape it with a backslash:
-``pn=\@''.
-
-9.12: How can I dial a phone number on the command line?
-
-Put what's called a ``generic'' entry in your /etc/remote file. For
-example:
-
- tip115200|Dial any phone number at 115200 bps:\
- :dv=/dev/cuaa0:br#115200:at=hayes:pa=none:du:
- tip57600|Dial any phone number at 57600 bps:\
- :dv=/dev/cuaa0:br#57600:at=hayes:pa=none:du:
-
-Then you can things like ``tip -115200 5551234''. If you prefer cu
-over tip, use a generic cu entry:
-
- cu115200|Use cu to dial any number at 115200bps:\
- :dv=/dev/cuaa1:br#57600:at=hayes:pa=none:du:
-
-and type ``cu 5551234 -s 115200''.
-
-9.13: Great---but how can I do that without having to specify the bps
- rate on the command line?
-
-Put in an entry for tip1200 or cu1200, but go ahead and use whatever
-bps rate is appropriate with the br capability. tip thinks a good
-default is 1200 bps which is why it looks for a ``tip1200'' entry.
-You don't have to use 1200 bps, though.
-
-9.14: I want separate entries for various hosts I access through a
- terminal server, but I don't want to type ``CONNECT <host>''
- each time once I'm connected. Can tip do that for me?
-
-Yes. Use the cm capability. For example, these entries in
-/etc/remote:
-
- pain|pain.deep13.com|Forrester's machine:\
- :cm=CONNECT pain\n:tc=deep13:
- muffin|muffin.deep13.com|Frank's machine:\
- :cm=CONNECT muffin\n:tc=deep13:
- deep13:Gizmonics Institute terminal server:\
- :dv=/dev/cuaa2:br#38400:at=hayes:du:pa=none:pn=5551234:
-
-will let you type ``tip pain'' or ``tip muffin'' to connect to the
-hosts pain or muffin; and ``tip deep13'' to get to the terminal
-server.
-
-9.15: My university has 42 billion students but only 4 modem lines.
- Can tip automatically try each line?
-
-Sure. Make an entry for your university in /etc/remote and use \@ for
-the pn capability:
-
- big-university:\
- :pn=\@:tc=dialout
- dialout:\
- :dv=/dev/cuaa3:br#9600:at=courier:du:pa=none:
-
-Then, list the phone numbers for the university in /etc/phones:
-
- big-university 5551111
- big-university 5551112
- big-university 5551113
- big-university 5551114
-
-tip will try each one in the listed order, then give up. If you want
-to keep retrying, run tip in a while loop.
-
-9.16: How come I have to hit CTRL+P twice to send CTRL+P once?
-
-CTRL+P is the default ``force'' character, used to tell tip that the
-next character is literal data. You can set the force character to
-any other character with the ~s escape, which means ``set a
-variable.''
-
-Type ``~sforce=<single-char>'' followed by a newline. <single-char>
-is any single character. If you leave out <single-char>, then the
-force character is the nul character, which you can get by typing
-CTRL+2 or CTRL+SPACE. A pretty good value for <single-char> is
-SHIFT+CTRL+6, which I've seen only used on some terminal servers.
-
-You can have the force character be whatever you want by specifying
-the following in your $HOME/.tiprc file:
-
- force=<single-char>
-
-9.17: Suddenly everything I type is all UPPER CASE. What gives?
-
-You must've pressed CTRL+A, tip's ``raise character,'' specially
-designed for people with broken caps-lock keys. Use ~s as above and
-set the variable ``raisechar'' to something reasonable. In fact, you
-can set it to the same as the force character, if you never expect to
-use either of these features.
-
-Here's a sample .tiprc file perfect for Emacs users who need to type
-CTRL+2 and CTRL+A a lot:
-
- force=^^
- raisechar=^^
-
-The ^^ is SHIFT+CTRL+6.
-
-9.18: How can I do file transfers with tip?
-
-If you're talking to another UNIX system, you can send and receive
-files with ~p (put) and ~t (take). These commands run ``cat'' and
-``echo'' on the remote system to accept and send files. The syntax
-is:
-
- ~p <local-file> [<remote-file>]
- ~t <remote-file> [<local-file>]
-
-There's no error checking, so you probably should use another
-protocol, like zmodem.
-
-9.19: Okay, how can I run zmodem with tip?
-
-To receive files, start the sending program on the remote end. Then,
-type ``~C rz'' to begin receiving them locally.
-
-To send files, start the receiving program on the remote end. Then,
-type ``~C sz <files>'' to send them to the remote system.
-
-
-
-NOTE: Anyone wishing to submit a FAQ entry on how to get tip and cu working
- would have it much appreciated! We all use Kermit over here! :-)
-
------------------------------------------------------------------------------
-If you see a problem with this FAQ, or wish to submit an entry, please
-mail us at <FreeBSD-FAQ@FreeBSD.ORG>. We appreciate your
-feedback, and cannot make this a better FAQ without your help!
-
-
- FreeBSD Core Team
-
------------------------------------------------------------------------------
-
-ACKNOWLEDGMENTS:
-
-Ollivier Robert - FreeBSD FAQ maintenance man
-Gary Clark II - Ex-FreeBSD FAQ maintenance man
-Jordan Hubbard - Janitorial services (I don't do windows)
-Garrett Wollman - Networking and formatting
-Robert Oliver, Jr. - Ideas and dumb questions (That made me think)
-Jim Lowe - Multicast information
-The FreeBSD Team - Kvetching, moaning, submitting data
-
-And to any others we've forgotten, apologies and heartfelt thanks!
-
diff --git a/share/FAQ/HW.TROUBLE b/share/FAQ/HW.TROUBLE
deleted file mode 100644
index ced53f4..0000000
--- a/share/FAQ/HW.TROUBLE
+++ /dev/null
@@ -1,58 +0,0 @@
-$Id: HW.TROUBLE,v 1.2 1995/02/22 03:49:46 phk Exp $
-
-This file lists hardware, which doesn't do what it should do.
-
-Due to the nature of FreeBSD, we do not have the resources to test all
-possible kinds of hardware. We do however every now and then find, buy
-or hear about hardware which doesn't work with FreeBSD or in general.
-
-This is that list.
-
-To be added to this list, a piece of hardware has to:
- A: not do what it claims.
-or
- B: not do what common sense would expect it to.
-
-Only if performance claims are wildly of the mark will it be listed here.
-
-All entries must have a date and a mail-address associated with them, to
-reflect when and by whom they were added.
-For multifunctional devices, please indicate if other parts of the device
-work OK, or are untested.
-For mutual incompabilities, list both devices.
-For SCSI and IDE-devices, list the string seen on boot of FreeBSD, if
-possible, and trade name.
-Infer format from other entries, Keep sorted by first line.
-
-Thankyou.
-
----
-Controller, Data Technology DTC2280, "PC/AT Super I/O Card"
-IDE interface can be set to secondary address, but doesn't work there. Suspect
-Interrupt isn't moved along. Works fine on primary address. Other parts of
-card not tested.
-19940828 phk@freefall.cdrom.com
----
-IDE-disk, <WDC AC2540H>, "Western Digital Caviar 2540"
-IDE-disk, <Maxtor 7345 AT>, "Maxtor 7345"
-Cannot coexist on the same IDE-controller.
-Jumpers not exhaustively experimented with, as neither of the companies
-make sufficient information available. Disk works fine when alone on
-IDE-controller.
-19940828 phk@freefall.cdrom.com
----
-IDE-disk, <AC31000> "Western Digital Caviar 31000"
-IDE-disk, <ST3550A> "Seagate ST3550A"
-Western Digital AC31000 (Caviar 31000) 1080 meg IDE drive will not
-co-exist with a Seagate ST3550A.
-The Seagate as master causes a constant drive light and system lockup,
-The WD will work fine alone or as master, but the Seagate is inaccessable
-if configured as slave in this config.
-19950221 jbryant@server.iadfw.net
-
-On Packard Bell computers with a BIOS Reference ID of less than 25, Packard
-Bell will replace the BIOS at no charge. I waited, I got the bios, popped
-the case, popped the chip, put in the new, and plugged in the drives. It
-works. WD as master, seagate as slave.
-19950228 jbryant@server.iadfw.net
----
diff --git a/share/FAQ/MIRROR.SITES b/share/FAQ/MIRROR.SITES
deleted file mode 100644
index 15b9b53..0000000
--- a/share/FAQ/MIRROR.SITES
+++ /dev/null
@@ -1,107 +0,0 @@
- Mirror Sites
- For FreeBSD 2.0 and later
-
-$Id: MIRROR.SITES,v 1.24 1995/02/15 07:07:18 jkh Exp $
-
-The latest versions of FreeBSD (2.0 or later) are being mirrored at the
-following locations:
-
-Country Site and Maintainer
-======= =========================================================
-Australia ftp://ftp.physics.usyd.edu.au/FreeBSD
- <dawes@xfree86.org>
-
-Finland ftp://nic.funet.fi/pub/unix/FreeBSD
- <ftp@nic.funet.fi>
-
-France ftp://ftp.ibp.fr/pub/FreeBSD
- <Remy.Card@ibp.fr>
-
-Germany ftp://ftp.fb9dv.uni-duisburg.de/pub/unix/FreeBSD
- <ftp@ftp.fb9dv.uni-duisburg.de>
-
-Hong Kong ftp://ftp.hk.super.net/pub/FreeBSD
- <ftp-admin@HK.Super.NET>
-
-Korea ftp://ftp.cau.ac.kr/pub/FreeBSD
- <ftpadm@ftp.cau.ac.kr>
-
-Netherlands ftp://ftp.nl.net/pub/os/FreeBSD
- <archive@nl.net>
-
-Russia ftp://ftp.kiae.su/FreeBSD
- <ftp@ftp.kiae.su>
-
-Sweden ftp://ftp.luth.se/pub/FreeBSD
- <ragge@ludd.luth.se>
-
-Taiwan ftp://netbsd.csie.nctu.edu.tw/pub/FreeBSD
- <ftp@netbsd.csie.nctu.edu.tw>
-
-Thailand ftp://ftp.nectec.or.th/pub/FreeBSD
- <ftpadmin@ftp.nectec.or.th>
-
-USA ftp://gatekeeper.dec.com/pub/BSD/FreeBSD
- <hubbard@gatekeeper.dec.com>
-
-USA ftp://ftp.cybernetics.net/pub/FreeBSD
- <michael@Cybernetics.NET>
-
-USA ftp://ftp.neosoft.com/systems/FreeBSD
- <smace@NeoSoft.COM>
-
-USA ftp://kryten.atinc.com/pub/FreeBSD
- <jmb@kryten.atinc.com>
-
-USA ftp://ftp.dataplex.net/pub/FreeBSD
- <rkw@dataplex.net>
-
-Japan ftp://tutserver.tutcc.tut.ac.jp/FreeBSD
- Ashida Hiroyuki <assie@bpel.tutics.tut.ac.jp>
-
-Japan ftp://ftp.sra.co.jp/pub/os/FreeBSD
- <ftp-admin@sra.co.jp>
-
-Japan ftp://ftp.ee.uec.ac.jp/pub/os/FreeBSD.other
- <ftp-admin@ftp.ee.uec.ac.jp>
-
-Japan ftp://ftp.mei.co.jp/free/PC-UNIX/FreeBSD
- TANIGUCHI Syuuhei <tanig@isl.mei.co.jp>
-
-Japan ftp://ftp.waseda.ac.jp/pub/FreeBSD
- <ftp-admin@waseda.ac.jp>
-
-Japan ftp://ftp.pu-toyama.ac.jp/pub/FreeBSD
- Yoshihiko USUI <usui@pu-toyama.ac.jp>
-
-Japan ftp://ftpsv1.u-aizu.ac.jp/pub/os/FreeBSD
- <ftp-admin@u-aizu.ac.jp>
-
-UK ftp://src.doc.ic.ac.uk/packages/unix/FreeBSD
- <wizards@doc.ic.ac.uk>
-
-UK ftp://unix.hensa.ac.uk/pub/walnut.creek/FreeBSD
- <archive-admin@unix.hensa.ac.uk>
-
-UK ftp://ftp.demon.co.uk/pub/BSD/FreeBSD
- <uploads@demon.net>
-
----
-
-The latest versions of export-restricted code for FreeBSD (2.0C or later)
-(eBones and secure) are being made available at the following locations.
-
-If you are outside the U.S. or Canada, please get secure (DES) and
-eBones (Kerberos) from one of the following foreign distribution sites:
-
-Country Site and Maintainer
-======= ========================================================
-South Africa ftp://skeleton.mikom.csir.co.za/pub/FreeBSD
- Mark Murray <mark@grondar.za>
-
-South Africa ftp://storm.sea.uct.ac.za/pub/FreeBSD
- Shaun Courtney <ftp@storm.sea.uct.ac.za>
-
-Brazil ftp://ftp.iqm.unicamp.br/pub/FreeBSD
- Pedro A M Vazquez <vazquez@iqm.unicamp.br>
-
diff --git a/share/FAQ/Makefile b/share/FAQ/Makefile
deleted file mode 100644
index 033633b..0000000
--- a/share/FAQ/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-# $Id: Makefile,v 1.1 1994/11/08 03:58:48 phk Exp $
-#
-# Doing a make install builds /usr/share/examples
-
-DDIR= ${DESTDIR}/usr/share/FAQ
-NOOBJ= noobj
-
-# Define SHARED to indicate whether you want symbolic links to the system
-# source (``symlinks''), or a separate copy (``copies''); (latter useful
-# in environments where it's not possible to keep /sys publicly readable)
-SHARED?= copies
-
-all clean cleandir depend lint tags:
-
-beforeinstall: ${SHARED}
-
-copies:
- @${ECHO} installing ${DDIR}
- rm -rf ${DDIR}
- mkdir ${DDIR}
- find . -print | grep -v /CVS | grep -v Makefile | cpio -dumpv ${DDIR}
-
-symlinks:
- @${ECHO} installing symlink to ${DDIR}
- rm -rf ${DDIR}; \
- ln -s ${.CURDIR} ${DDIR}; \
-
-.include <bsd.prog.mk>
diff --git a/share/FAQ/NEW_FOR_2_0 b/share/FAQ/NEW_FOR_2_0
deleted file mode 100644
index 331d840..0000000
--- a/share/FAQ/NEW_FOR_2_0
+++ /dev/null
@@ -1,8 +0,0 @@
-; This file describes new features, conventions or newly introduced "gotchas"
-; that a user coming from a 1.x environment should know about.
-;
-; This actual file can be a simple dumping ground for this information
-; until such time as we want to fold it into the release notes, or we
-; can try to tart it up around release time and simply refer to it in
-; various places. I personally prefer the former option, though it's
-; not a religious issue. -jkh
diff --git a/share/FAQ/NFS.FAQ b/share/FAQ/NFS.FAQ
deleted file mode 100644
index e6f7af8..0000000
--- a/share/FAQ/NFS.FAQ
+++ /dev/null
@@ -1,77 +0,0 @@
-FreeBSD and NFS [for a FAQ]
-
-Certain Ethernet adapters for ISA PC systems have limitations which
-can lead to serious network problems, particularly with NFS. This
-difficulty is not specific to FreeBSD, but FreeBSD systems are affected
-by it.
-
-The problem nearly always occurs when (FreeBSD) PC systems are networked
-with high-performance workstations, such as those made by Silicon Graphics,
-Inc., and Sun Microsystems, Inc. The NFS mount will work fine, and some
-operations may succeed, but suddenly the server will seem to become
-unresponsive to the client, even though requests to and from other systems
-continue to be processed. This happens to the client system, whether the
-client is the FreeBSD system or the workstation. On many systems, there is
-no way to shut down the client gracefully once this problem has manifested
-itself. The only solution is often to reset the client, because the NFS
-situation cannot be resolved.
-
-Though the "correct" solution is to get a higher performance and capacity
-Ethernet adapter for the FreeBSD system, there is a simple workaround that
-will allow satisfactory operation. If the FreeBSD system is the SERVER,
-include the option "wsize=1024" on the mount from the client. If the
-FreeBSD system is the CLIENT, then mount the NFS file system with the
-option "rsize=1024". These options may be specified using the fourth
-field of the fstab entry on the client for automatic mounts, or by using
-the "-o" parameter of the mount command for manual mounts.
-
-In the following examples, "fastws" is the host (interface) name of a
-high-performance workstation, and "freebox" is the host (interface) name of
-a FreeBSD system with a lower-performance Ethernet adapter. Also,
-"/sharedfs" will be the exported NFS filesystem (see "man exports"), and
-"/project" will be the mount point on the client for the exported file
-system. In all cases, note that additional options, such as "hard" or
-"soft" and "bg" may be desireable in your application.
-
-Examples for the FreeBSD system ("freebox") as the client:
- in /etc/fstab on freebox:
-fastws:/sharedfs /project nfs rw,rsize=1024 0 0
- as a manual mount command on freebox:
-mount -t nfs -o rsize=1024 fastws:/sharedfs /project
-
-Examples for the FreeBSD system as the server:
- in /etc/fstab on fastws:
-freebox:/sharedfs /project nfs rw,wsize=1024 0 0
- as a manual mount command on fastws:
-mount -t nfs -o wsize=1024 freebox:/sharedfs /project
-
-Nearly any 16-bit Ethernet adapter will allow operation without the above
-restrictions on the read or write size.
-
-For anyone who cares, here is what happens when the failure occurs, which
-also explains why it is unrecoverable. NFS typically works with a "block"
-size of 8k (though it may do fragments of smaller sizes). Since the maximum
-Ethernet packet is around 1500 bytes, the NFS "block" gets split into
-multiple Ethernet packets, even though it is still a single unit to the
-upper-level code, and must be received, assembled, and ACKNOWLEDGED as a
-unit. The high-performance workstations can pump out the packets which
-comprise the NFS unit one right after the other, just as close together as
-the standard allows. On the smaller, lower capacity cards, the later
-packets overrun the earlier packets of the same unit before they can be
-transferred to the host and the unit as a whole cannot be reconstructed or
-acknowledged. As a result, the workstation will time out and try again,
-but it will try again with the entire 8K unit, and the process will be
-repeated, ad infinitum.
-
-By keeping the unit size below the Ethernet packet size limitation, we
-ensure that any complete Ethernet packet received can be acknowledged
-individually, avoiding the deadlock situation.
-
-Overruns may still occur when a high-performance workstations is slamming
-data out to a PC system, but with the better cards, such overruns are
-not guarranteed on NFS "units". When an overrun occurs, the units affected
-will be retransmitted, and there will be a fair chance that they will be
-received, assembled, and acknowledged.
---
- John Lind, Starfire Consulting Services
-E-mail: john@starfire.MN.ORG USnail: PO Box 17247, Mpls MN 55417
diff --git a/share/FAQ/PORTS.FAQ b/share/FAQ/PORTS.FAQ
deleted file mode 100644
index 2e04fd0..0000000
--- a/share/FAQ/PORTS.FAQ
+++ /dev/null
@@ -1,211 +0,0 @@
- The FreeBSD Ports FAQ file
-
-Revision: $Id: PORTS.FAQ,v 1.1 1995/01/04 00:43:35 jkh Exp $
-
-The ports system is kinda new, so there haven't been too many FAQ's to
-date, but hopefully this document will pre-empt (some|most) of them!!
-The ports system is constantly changing, but hopefully this document
-will be kept reasonably up to date (and you never know, it might even
-make sense!).
-
- - Gary Palmer
- & jkh
-
-1) What is a port?
-
- Unfortunately, there are more variations of UN*X than most people
-know of, and hence not all software for UN*X available on the Internet
-will work on all versions of UN*X (in fact, I can guarantee it!).
-Hence, some software needs modifications to work under some UN*Xs. The
-process of making those modifications is known as ``porting'' and the
-result known as a ``port'' (not to be confused with the sockets on the
-back of your computer!).
-
-
-2) What is the FreeBSD Ports Collection?
-
- People who (allegedly) know what they are doing have automated the
-process of ``porting'' software to FreeBSD, and the result is the
-Ports Collection. The general idea is that a combination of various
-programming tools available in the base FreeBSD installation will
-allow you to fetch the port from a FreeBSD mirror site, type ``make''
-and get the fully working program.
-
- The ports collection itself normally doesn't have any of the
-original source code necessary for the compilation in the tree, just
-those shell scripts, Makefiles and source code ``diffs'' that are
-necessary to compile the program under FreeBSD. This is meant to keep
-the entire system down to a manageable size, and the current system
-has over 100 ports in the master source tree, and yet a compressed tar
-file of that tree is about 2 megabytes (all the source code needed is
-over 100Mb's!).
-
-
-3) How does the system compile with no source code?
-
- A ports' Makefile automatically looks in a central location on
-your system (usually /usr/ports/distfiles, though this value can be
-customized) for the associated set of original distribution files that
-have been ``ported''. These are generally provided at various places
-on the Internet, though if you have a CDROM distribution of FreeBSD
-then you've already got them available on your CD for ease of use.
-See section 3.1 if you have such a CD distribution, otherwise skip to
-section 3.2.
-
-3.1 Compiling ports from CD
-
- Type something profound here.
-
-3.2 Compiling ports using an Internet connection
-
- The ports collection can also use an auto-fetch system to keep
-your ports collection source tree up to date, updating the central
-``distfiles'' version for you the next time you compile the port.
-
- Of course, this always assumes you have a permanent network link,
-or don't mind heavy usage of your telephone. If you don't want heavy
-network usage when you compile your ports tree, you can pre-fetch the
-necessary tarballs beforehand and put them into /usr/ports/distfiles
-(or wherever DISTDIR points) by hand. A good way to see what files a
-port is going to need is to cd to that port's directory and do a
-``make -n fetch'' to see what it does.
-
- You can also chose to get the source files either from the master
-FTP site as defined in the relevant Makefile (in the MASTER_SITES
-line), or some FreeBSD mirror site also carrying a set of distfiles,
-as does the master FTP site on ftp.FreeBSD.org (aka ftp.cdrom.com) in
-the directory /pub/FreeBSD/ports/distfiles. Note that the files in
-that directory are not guarenteed to be kept up to date - this is a
-volunteer project! We can't make any guarantees about the mirror
-sites either - they are obviously under independant control and don't
-even have to mirror the distfiles directory.
-
- If you have a non-permanant link, you can fetch all the distfiles by
-going to the top of the tree and typing ``make fetch''.
-
-
-4) It doesn't work?!
-
-Oh. You can do one of four (4) things :
-
-a) Fix it yourself. Technical details can be found in the GUIDELINES file,
- available from URL ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/GUIDELINES
-
-b) Gripe. This is done by e-mail *ONLY*! The people at Walnut Creek are
- in no way responsible for the functionality (or lack thereof) of the
- FreeBSD system as a whole, and especially the ports system, which
- is mainly contributed by 3rd parties. (If you don't believe me, check
- the catalogue, especially the line saying "We cannot offer tech-support
- on this product")
-
- The e-mail address is Ports@FreeBSD.org. Please include details of
- the port, where you got both the port source & distfile(s) from, and
- what the error was.
-
- Note: At time of writing, lang/Sather doesn't seem to work on Pentium
- machines due to the Intel Curse (aka the Floating Point Division Bug).
- Please don't tell us about this - gripe to Intel instead - it's their
- bug!
-
-c) Forget it. This is the easiest for most - very few of the programs in
- ports can be classed as `essential'!
-
-d) Grab the pre-compiled package from a ftp server. The ``master'' package
- collection is in:
- ftp://ftp.FreeBSD.org/pub/FreeBSD/packages/
-
- though check your local mirror first, please!
-
- These are more likely to work (on the whole) than trying to compile from
- source, and a lot faster!
-
-
-5) I've ported a program and I want to make a port out of it. What now?
-
- See the file GUIDELINES, in:
- ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/GUIDELINES
-
- This contains details of the procedure and structure involved.
-
-
-6) I've got a good port, what now?
-
- Upload the fixed version to freefall.cdrom.com /pub/incoming or
-ftp.FreeBSD.org /pub/FreeBSD/incoming and send e-mail to
-ports@FreeBSD.org with the filename and details. Someone on the
-all-volunteer `ports committee' will (hopefully) look it over and
-commit it to the ports collection if they like the looks of it.
-
-
-7) Things go funny during the fetch stage of compilation!
-
- We know. Please don't blame us. There is a program called `ncftp'
-which is used instead of the normal ftp as it can do so-called
-``background'' or ``batch'' transfers, ideal for this situation.
-Unfortunately it can do strange things, and has crashed at least one
-machine (during circumstances stranger than most, I'll admit, but it
-was still responsible). Hopefully a future release of ncftp will fix
-these problems (it is not maintained by the main FreeBSD team, but a
-third party, who is I believe aware of its shortcomings)
-
-
-8) I want to leave the compile going overnight, but some ports don't
- like this.
-
- There is a way around this. Before starting the compilation, type:
- setenv BATCH yes # (if you use csh/tcsh) or
- BATCH=yes # (for sh/bash)
-
- This should miss out ports which need user interaction. Unfortunately,
-ncftp doesn't know about this trick, and can often screw up and ask
-stupid questions in unattended batch mode. See (7).
-
- To compile those ports left out by doing the above, using a
-different login shell (or unsetting the above BATCH variable), set the
-INTERACTIVE variable instead (you can use the same statements as above
-except replace ``BATCH'' with ``INTERACTIVE'') and re-run make. This
-should now compile only those ports which will definitely ask for user
-interaction.
-
-
-9) The ports collection is weak. What can I do to help?
-
- First read the bsd.port.mk file (which may be found in
-/usr/share/mk/) and the associated bsd.port.subdir.mk file. A lot of
-the weirdness can be explained properly in there (most of the current
-weirdness is due to the lack of assumptions about anything, which is
-necessary due to the generic nature of these files). Also check that
-you have an up-to-date copy, as the file can change from minute to
-minute. A reasonably up-to-date copy can be found in:
-
- ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/share/mk/bsd.port*
-
- If you find that you still need to go in there and alter things,
-by all means do so, and then send the diffs to ports@FreeBSD.org if
-you'd like them to be a part of the default distribution. Please also
-remember that any changes must respect backwards-compatability with
-any and all older Makefiles, unless you want a real nightmare of
-/usr/ports munging ahead of you! Large scale changes will generally
-not be warmly welcomed unless all the existing makefiles work without
-alteration. Sorry!
-
-
-10) This FAQ is weak. What can I do?
-
- Send changes to ports@FreeBSD.org. Changes are most welcome!
-This FAQ is also very green and should be considered no more than
-a `good start' for now. Authors? You can come out of hiding any
-time now! :-)
-
-
-11) How do I get more information on all the ports?
-
- One good method is to cd to the top of the ports tree (say /usr/ports)
-and type something like:
-
- make describe | sed -e '/===/D' -e 's;/usr/ports/;;' | expand -40
-
-The ``make describe'' will try to extract the one-line description from
-each port, and the ``sed'' will delete the extraneous output. ``expand''
-just makes it a little more readable (sort of - you may want to season
-the output of this more to taste).
diff --git a/share/FAQ/PPP.doc b/share/FAQ/PPP.doc
deleted file mode 100755
index 26133eb..0000000
--- a/share/FAQ/PPP.doc
+++ /dev/null
@@ -1,368 +0,0 @@
-
- Info about setting up pppd daemon on FreeBSD-2.0
-
-Before you start setting up PPP on your machine make
-sure that pppd is located in /usr/sbin and directory /etc/ppp
-exists.
-
-pppd can work in two modes:
-
-i) as a "client" , i.e. you want to connect your machine to outside
-world via PPP serial connection or modem line.
-
-ii) as a "server" , i.e. your machine is located on the network and
-used to connect other computers using PPP.
-
-In both cases you will need to set up an options file ( /etc/ppp/options
-or ~/.ppprc if you have more then one user on your machine that uses
-PPP ).
-
-You also will need some modem/serial software ( preferably kermit )
-so you can dial and establish connection with remote host.
-
-1) Working as a PPP client
-
-I used the following options to connect to CISCO terminal server PPP
-line.
-
-----/etc/ppp/options-------
-crtscts # enable hardware flow control
-modem # modem control line
-noipdefault # remote PPP server must supply your IP address.
- # if the remote host doesn't send your IP during IPCP
- # negotiation , remove this option
-passive # wait for LCP packets
-domain ppp.foo.com # put your domain name here
-
-:<remote_ip> # put the IP of remote PPP host here
- # it will be used to route packets via PPP link
- # if you didn't specified the noipdefault option
- # change this line to <local_ip>:<remote_ip>
-
-defaultroute # put this if you want that PPP server will be your
- # default router
--------------------------
-
-To connect:
-i) Dial to the remote host using kermit ( or other modem program )
-enter your user name and password ( or whatever is needed to enable PPP
-ont the remote host )
-
-ii) Exit kermit. ( without hanging up the line )
-
-iii) enter:
-/usr/src/usr.sbin/pppd.new/pppd /dev/tty01 19200
-( put the appropriate speed and device name )
-
-Now your computer is connected with PPP. If the connection fails for some
-reasons you can add the "debug" option to the /etc/ppp/options file
-and check messages on the console to track the problem
-
-Following script will make all 3 stages automatically:
------/etc/ppp/pppup--------
-#!/bin/sh
-ps ax |grep pppd |grep -v grep
-pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing pppd, PID=' ${pid}
- kill ${pid}
-fi
-ps ax |grep kermit |grep -v grep
-pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing kermit, PID=' ${pid}
- kill -9 ${pid}
-fi
-
-ifconfig ppp0 down
-ifconfig ppp0 delete
-
-kermit -y /etc/ppp/kermit.dial
-pppd /dev/tty01 19200
------------------------------
-
-/etc/ppp/kermit.dial is kermit script that dials and makes all
-necessary authorization on the remote host.
-( Example of such script is attached to the end of this document )
-
-Use the follwing script to disconnect the PPP line:
------/etc/ppp/pppdown--------
-#!/bin/sh
-pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'`
-if [ X${pid} != "X" ] ; then
- echo 'killing pppd, PID=' ${pid}
- kill -TERM ${pid}
-fi
-
-ps ax |grep kermit |grep -v grep
-pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing kermit, PID=' ${pid}
- kill -9 ${pid}
-fi
-
-/sbin/ifconfig ppp0 down
-/sbin/ifconfig ppp0 delete
-kermit -y /etc/ppp/kermit.hup
-/etc/ppp/ppptest
-------------------------------
-
-Check if PPP is still running:
-
------/etc/ppp/ppptest---------
-#!/bin/sh
-pid=`ps ax| grep pppd |grep -v grep|awk '{print $1;}'`
-if [ X${pid} != "X" ] ; then
- echo 'pppd running: PID=' ${pid-NONE}
-else
- echo 'No pppd running.'
-fi
-set -x
-netstat -n -I ppp0
-ifconfig ppp0
------------------------------
-
-Hangs up modem line:
-
------/etc/ppp/kermit.hup-----
-set line /dev/tty01 ; put your modem device here
-set speed 19200
-set file type binary
-set file names literal
-set win 8
-set rec pack 1024
-set send pack 1024
-set block 3
-set term bytesize 8
-set command bytesize 8
-set flow none
-
-pau 1
-out +++
-inp 5 OK
-out ATH0\13
-echo \13
-exit
-----------------------------
-
-2) Working as a PPP server
-
-------/etc/ppp/options------
-crtscts # Hardware flow control
-netmask 255.255.255.0 # netmask ( not required )
-192.114.208.20:192.114.208.165 # ip's of local and remote hosts
- # local ip must be different from one
- # you assigned to the ethernet ( or other )
- # interface on your machine.
- # remote IP is ip address that will be
- # assigned to the remote machine
-domain ppp.foo.com # your domain
-passive # wait for LCP
-modem # modem line
-----------------------------
-
-Following script will enable ppp server on your machine
-
------/etc/ppp/pppserv-------
-#!/bin/sh
-ps ax |grep pppd |grep -v grep
-pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing pppd, PID=' ${pid}
- kill ${pid}
-fi
-ps ax |grep kermit |grep -v grep
-pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing kermit, PID=' ${pid}
- kill -9 ${pid}
-fi
-
-# reset ppp interface
-ifconfig ppp0 down
-ifconfig ppp0 delete
-
-# enable autoanswer mode
-kermit -y /etc/ppp/kermit.ans
-
-# run ppp
-pppd /dev/tty01 19200
-----------------------------
-
-Use this script to stop ppp server:
-
------/etc/ppp/pppservdown---
-#!/bin/sh
-ps ax |grep pppd |grep -v grep
-pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing pppd, PID=' ${pid}
- kill ${pid}
-fi
-ps ax |grep kermit |grep -v grep
-pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing kermit, PID=' ${pid}
- kill -9 ${pid}
-fi
-ifconfig ppp0 down
-ifconfig ppp0 delete
-
-kermit -y /etc/ppp/kermit.noans
-----------------------------
-
-Following kermit script will enable/disable autoanswer mode
-on your modem:
-
------/etc/ppp/kermit.ans----
-set line /dev/tty01
-set speed 19200
-set file type binary
-set file names literal
-set win 8
-set rec pack 1024
-set send pack 1024
-set block 3
-set term bytesize 8
-set command bytesize 8
-set flow none
-
-pau 1
-out +++
-inp 5 OK
-out ATH0\13
-inp 5 OK
-echo \13
-out ATS0=1\13 ; change this to out ATS0=0\13 if you want to disable
- ; autoanswer mod
-inp 5 OK
-echo \13
-exit
------------------------------
-
-This script is used for dialing and authorizing on remote host.
-You will need to customize it for your needs.
-Put your login and password in this script , also you'll need
-to change input statement depending on responces from your modem
-and remote host.
-
------/etc/ppp/kermit.dial----
-
-;
-; put the com line attached to the modem here:
-;
-set line /dev/tty01
-;
-; put the modem speed here:
-;
-set speed 19200
-set file type binary ; full 8 bit file xfer
-set file names literal
-set win 8
-set rec pack 1024
-set send pack 1024
-set block 3
-set term bytesize 8
-set command bytesize 8
-set flow none
-set modem hayes
-set dial hangup off
-set carrier auto ; Then SET CARRIER if necessary,
-set dial display on ; Then SET DIAL if necessary,
-set input echo on
-set input timeout proceed
-set input case ignore
-def \%x 0 ; login prompt counter
-goto slhup
-
-:slcmd ; put the modem in command mode
-echo Put the modem in command mode.
-clear ; Clear unread characters from input buffer
-pause 1
-output +++ ; hayes escape sequence
-input 1 OK\13\10 ; wait for OK
-if success goto slhup
-output \13
-pause 1
-output at\13
-input 1 OK\13\10
-if fail goto slcmd ; if modem doesn't answer OK, try again
-
-:slhup ; hang up the phone
-clear ; Clear unread characters from input buffer
-pause 1
-echo Hanging up the phone.
-output ath0\13 ; hayes command for on hook
-input 2 OK\13\10
-if fail goto slcmd ; if no OK answer, put modem in command mode
-
-:sldial ; dial the number
-pause 1
-echo Dialing.
-output atdt9,550311\13\10 ; put phone number here
-assign \%x 0 ; zero the time counter
-
-:look
-clear ; Clear unread characters from input buffer
-increment \%x ; Count the seconds
-input 1 {CONNECT }
-if success goto sllogin
-reinput 1 {NO CARRIER\13\10}
-if success goto sldial
-reinput 1 {NO DIALTONE\13\10}
-if success goto slnodial
-reinput 1 {\255}
-if success goto slhup
-reinput 1 {\127}
-if success goto slhup
-if < \%x 60 goto look
-else goto slhup
-
-:sllogin ; login
-assign \%x 0 ; zero the time counter
-pause 1
-echo Looking for login prompt.
-
-:slloop
-increment \%x ; Count the seconds
-clear ; Clear unread characters from input buffer
-output \13
-;
-; put your expected login prompt here:
-;
-input 1 {Username: }
-if success goto sluid
-reinput 1 {\255}
-if success goto slhup
-reinput 1 {\127}
-if success goto slhup
-if < \%x 10 goto slloop ; try 10 times to get a login prompt
-else goto slhup ; hang up and start again if 10 failures
-
-:sluid
-;
-; put your userid here:
-;
-output ppp-login\13
-input 1 {Password: }
-;
-; put your password here:
-;
-output ppp-password\13
-input 1 {Entering SLIP mode.}
-echo
-quit
-
-:slnodial
-echo \7No dialtone. Check the telephone line!\7
-exit 1
-
-; local variables:
-; mode: csh
-; comment-start: "; "
-; comment-start-skip: "; "
-; end:
-------------------------
-
-###################################################################
-Gennady B. Sorokopud ( gena@NetVision.net.il ) 24/10/94 12:00
diff --git a/share/FAQ/README b/share/FAQ/README
deleted file mode 100644
index bf326c0..0000000
--- a/share/FAQ/README
+++ /dev/null
@@ -1,55 +0,0 @@
-This directory contains frequently asked questions, short user guides,
-tutorials and other miscellaneous information that may be of help
-to the beginning (or even advanced) FreeBSD user. Any submissions
-to this directory should be sent to:
-
- FreeBSD-FAQ@FreeBSD.ORG
-
-For inclusion with the next release. Your contributions are not only
-welcome, but often save new users from uncountable headaches! If you've
-written something you think may help new users, please - by all means
-send it to us!
-
-Thanks!
-
- The FreeBSD Project
-
-----
-ROADMAP:
-
-File Description
-===============================================================================
-FreeBSD.FAQ The overall FreeBSD FAQ - posted regularly to
- USENET.
-
-FreeBSD-1.1.FAQ FreeBSD FAQ for versions 1.1.5.1 and below.
-
-HW.TROUBLE User feedback on finicky or broken hardware.
-
-MIRROR.SITES A list of all sites mirroring FreeBSD 2.x.
-
-NFS.FAQ Tips for users using NFS between FreeBSD
- and workstation hardware.
-
-Systems.FAQ Systems and configurations on which FreeBSD
- is "known" to work.
-
-Systems-1.1.FAQ Systems for 1.1.5.1 and below
-
-current-policy.FAQ What you should know about running
- FreeBSD-current.
-
-kernel-debug.FAQ How to debug kernels for 1.1.5.1 and below.
-
-mailing-list.FAQ All about the FreeBSD mailing lists.
-
-ports-supfile A sample supfile for the FreeBSD ports
- collection.
-
-slip-dialup How to configure SLIP.
-
-standard-supfile A sample supfile for the FreeBSD source tree.
-
-sup.FAQ All about sup in general.
-
-
diff --git a/share/FAQ/README-2.0 b/share/FAQ/README-2.0
deleted file mode 100644
index c9d81f9..0000000
--- a/share/FAQ/README-2.0
+++ /dev/null
@@ -1,75 +0,0 @@
-Use PageUp, PageDown or Arrow keys to navigate this screen.
-
- -----------------------------------------
- FreeBSD 2.0 --- RELEASE Version , ,
- ----------------------------------------- /( )`
- \ \___ / |
-Welcome to the first public release of FreeBSD 2.0 /- _ `-/ '
-first public snapshot of our new 4.4BSD Lite based (/\/ \ \ /\
-operating system environment. Our installation / / | ` \
-procedure has been completely revamped, and should O O ) / |
-now be much easier for both the novice and `-^--'`< '
-experienced user alike. We've also gone to some (_.) _ ) /
-care to make the process of installing the `.___/` /
-subsequent bindist and other miscellaneous `-----' /
-distributions considerably more seamless <----. __ / __ \
-as well as offering a greater variety <----|====O)))==) \) /====
-of installation methods and options. <----' `--' `.__,' \
- | |
-We hope you'll find this new process as enjoyable \ / /\
-to use as it was to write! (No, really, it ______( (_ / \______/
-was! :-) ,' ,-----' |
- `--{__________)
-Disclaimer: Please note that despite numerous
-safeguards, it's still more than possible to WIPE OUT YOUR ENTIRE DISK
-with this installation! Please do not proceed unless you've
-adequately backed up any important data first! We really mean it!
-
-If any errors occur during this installation, you can see them
-by toggling over to the alternate screen. Type ALT-F2 to switch
-to the debugging screen and ALT-F1 to switch back to the install screen.
-The debugging output on the second screen may be very valuable to us in
-understanding your bug report, so please be sure to take note of it when
-reporting any failures in the installation! Thanks!
-
-You may also wish to read the TROUBLESHOOTING document in _advance_
-and perhaps save yourself from making those sorts of errors in
-the first place! :-)
-
-Menus and scrolling output windows may be traversed with the arrow,
-PageUp/PageDown and TAB keys. To suspend the installation at any point,
-hit ESC twice. If you've ever dealt with a DOS installation before, then
-you'll probably know how to deal with this.
-
-For a more complete description of what's new in this release, please
-see the release notes.
-
-For more documentation on this system, it is recommended that you purchase
-the 4.4BSD Document Set from O'Reilly Associates and the USENIX Association.
-ISBN 1-56592-082-1 We have no connection with O'Reilly, we're just
-satisfied customers!
-
-Have fun, and please let us know of any problems you encounter with
-this release!
-
-Comments should be sent to:
-
- hackers@FreeBSD.org
-
-Bug reports should be sent using the `send-pr' utility, if you
-were able to get the system installed, otherwise to:
-
- bugs@FreeBSD.org
-
-And general questions to:
-
- questions@FreeBSD.org
-
-
-Please have patience if your questions are not answered right away -
-this is an especially busy time for us, and our volunteer resources
-are often strained to the limit (if not somewhat past!).
-
-Thanks!
-
- The FreeBSD Project
diff --git a/share/FAQ/REGISTER.FreeBSD b/share/FAQ/REGISTER.FreeBSD
deleted file mode 100644
index 92ae0ae..0000000
--- a/share/FAQ/REGISTER.FreeBSD
+++ /dev/null
@@ -1,85 +0,0 @@
-In the absence of any other mechanism for counting the number of users
-of FreeBSD, we like to kindly suggest that you take a few minutes to please
-register with the counter set up by <Harald.T.Alvestrand@uninett.no>.
-
-The justification for such "registration" is twofold: First, we really would
-like to know more about the size and demographics of our user-base in order
-to better support its needs. Second, it's a sad fact of life that many
-people rely on counters and statistics (even when highly dubious) rather
-than on actual experience when chosing an operating system, and the best we
-can hope to do in such circumstances is to at least try to provide some
-indication of how popular we are (or are not). This is not how we recommend
-that people go about chosing an operating system, but the necessity of
-such "marketing" remains an undeniable fact.
-
-The FreeBSD team does not necessarily feel that Harald's counter represents
-the best approach to such statistics gathering, and its accuracy can only
-be as good as people's willingness to register with it (and may not reflect
-the actual OS population at any single point in time), but in the total absence
-of any other mechanism for providing such useful statistics, it's certainly a
-start and we thank Harald for his efforts in providing this service.
-It's a community service, and of potential benefit to everyone (all *BSD
-users), so let's see if we can't make it work!
-
-Included below is the standard blurb from the counter.
-
-Thanks in advance,
-
- The FreeBSD team.
-
-
-How to get registered
-=====================
-
-In brief:
-
- [To register a running installation of FreeBSD]
- Send E-mail to bsd-counter@uninett.no with the SUBJECT line
-
- "I use FreeBSD at <place>"
-
-Introduction
-============
-The intention of this counting project is to count all users of UNIXes
-that are:
-
- - BSD-derived
- - Freely available
-
-The variants NetBSD, 386BSD and FreeBSD are currently distinguished.
-
-(NOTE: Linux is NOT BSD-derived. If you use that, send mail to
-linux-counter@uninett.no instead!!!)
-
-The information is *not* used for any purpose but statistics, and unless
-you request it, information about single persons are *never* made public.
-(A list of users who have requested publication is available from the
-FTP file ftp://aun.uninett.no/pub/misc/386bsd/persons)
-
-How to register
-===============
-Send E-mail to bsd-counter@uninett.no
-
-The subject should be
-
- I use FreeBSD|NetBSD|386BSD at <place>
-
-Where FreeBSD, NetBSD or 386BSD is the particular variant you're using
-and "place" can be school, work or home, or a combination of these.
-
-You will get back a letter with 3 things:
-
- - An acknowledgement
- - A form that you can fill out and send in with more information
- about yourself, your machine, and your 386bsd-using friends
- - A report giving the current status of the counter
-
-You can update your "vote" at any time, by sending an E-mail message
-from the same account. Duplicates will be weeded out.
-
-The current report, available by anonymous FTP to aun.uninett.no,
-directory pub/misc/386bsd-counter, file "short", is given below.
-
-For all questions, contact Harald.T.Alvestrand@uninett.no!
-
-$Id: REGISTER.FreeBSD,v 1.1 1994/11/18 12:03:29 jkh Exp $
diff --git a/share/FAQ/RELNOTES.FreeBSD b/share/FAQ/RELNOTES.FreeBSD
deleted file mode 100644
index 4d56492..0000000
--- a/share/FAQ/RELNOTES.FreeBSD
+++ /dev/null
@@ -1,624 +0,0 @@
- RELEASE NOTES
- FreeBSD
- Release 2.0
-
-1. Technical overview
----------------------
-
-FreeBSD is a freely available, full source 4.4 BSD Lite based release
-for Intel i386/i486/Pentium (or compatible) based PC's. It is based
-primarily on software from U.C. Berkeley's CSRG group, with some
-enhancements from NetBSD, 386BSD, and the Free Software Foundation.
-
-Since our first release of FreeBSD 1.0 some 18 months ago, FreeBSD
-has changed almost entirely. A new port from the Berkeley 4.4 code
-base was done, which brought the legal status of the system out of the
-shadows with the blessing of Novell (new owners of USL and UNIX). The
-port to 4.4 has also brought in a host of new features, filesystems
-and enhanced driver support. With our new unencumbered code base, we
-have every reason to hope that we'll be able to release quality
-operating systems without further legal encumbrance for some time to
-come!
-
-FreeBSD 2.0 represents the culmination of almost 2 years of work and
-many thousands of man hours put in by an international development team.
-We hope you enjoy it!
-
-Many packages have also been upgraded or added, such as XFree86 3.1,
-xview 3.2, elm, nntp, mh, InterViews and dozens of other miscellaneous
-utilities have been ported and are now available as add-ons. See the
-ports collection (or the package collection) for a complete summary.
-
-For a list of contributors and a general project description, please see
-the file "CONTRIB.FreeBSD" which should be bundled with your binary
-distribution.
-
-Also see the "REGISTER.FreeBSD" file for information on registering
-with the "Free BSD user counter". This counter is for ALL freely
-available variants of BSD, not just FreeBSD, and we urge you to register
-yourself with it.
-
-The core of FreeBSD does not contain DES code which would inhibit its
-being exported outside the United States. There is an add-on package
-to the core distribution, for use only in the United States, that
-contains the programs that normally use DES. The auxilliary packages
-provided separately can be used by anyone. A freely (from outside the
-U.S.) exportable European distribution of DES for our non U.S. users also
-exists and is described in the FreeBSD FAQ.
-
-If password security for FreeBSD is all you need, and you have no
-requirement for copying encrypted passwords from different hosts (Suns,
-DEC machines, etc) into FreeBSD password entries, then FreeBSD's MD5
-based security may be all you require! We feel that our default security
-model is more than a match for DES, and without any messy export issues
-to deal with. If you're outside (or even inside) the U.S., give it a try!
-
-
-1.1 What's new in 2.0?
-----------------------
-
-4.4 Lite
---------
-As previously stated, this release is based entirely on CSRG's
-latest (and last) BSD release - 4.4 Lite. This features a number
-of improvements over 4.2BSD (Net/2), not least of which are:
-
-o Legal approval of Novell & U.C. Berkeley. After the settlement
- of the longstanding lawsuit between USL/UCB/Novell/BSDI, all
- parties were (strongly) encouraged to move to 4.4 Lite in order
- to avoid future legal entanglements. The fact that we've now done
- so should make this release much more attractive to potential
- commercial users.
-
-o Many new filesystem types, such as stackable filesystems, union
- filesystems, "portals", kernfs, a simple log-structured filesystem, a
- new version of NFS (NQNFS), etc. While some of these new filesystems
- are also rather unpolished and will require significant additional
- work to be truly robust, they're a good start.
-
-o 64bit offsets, allowing filesystems of up to 2^63 bytes in size.
-
-o Further work towards full POSIX compliance.
-
-IP multicast support
---------------------
-The IP multicast support has been upgraded from the woefully ancient
-1.x code in 4.4-Lite to the most current and up-to-date 3.3 release
-from Steve D. and Ajit. The non-forwarding code is known to work (for
-some limited test cases). The multicast forwarder and user-mode
-multicast routing process are known to compile, but have not been
-significantly tested (hopefully this will happen before 2.0 release).
-
-Owner: wollman
-Sources involved: sys/netinet, usr.sbin/mrouted
-
-Loadable Kernel Modules
------------------------
-David Greenman incorporated NetBSD's port of Terry Lambert's loadable
-kernel module support. Garrett Wollman wrote the support for loadable
-file systems, and Søren Schmidt did the same for loadable execution
-classes.
-
-Owner: core
-Sources involved: sys/kern, sbin/modload, sbin/modunload,
- usr.bin/modstat
-
-
-Loadable filesystems
---------------------
-Most filesystems are now dynamically loadable on demand, with the
-exception of the UFS family (FFS, LFS, and MFS). With the exception
-of NFS, all such filesystems can be unloaded when all references are
-unmounted. To support this functionality, the getvfsbyname(3)
-family of functions has been added to the C library and the lsvfs(1)
-command provides the same information at the shell level. Be aware of
-the following current restrictions:
-
- - /usr/bin may not reside on a dynamically loaded filesystem.
- - There must be a writable /tmp directory available
- before filesystems are loaded (moving / to the top of your
- /etc/fstab file will accomplish this).
- - Some of the more esoteric filesystems simply don't work when loaded
- dynamically (though they often don't work "static", either.)
-
-Owner: wollman
-Sources involved: sys/*fs, lkm/*fs, usr.bin/lsvfs, lib/libc/gen
-
-
-S/Key
------
-Since version 1.1.5, FreeBSD has supported the S/Key one time password
-scheme. The version used is derived from the logdaemon package of Wietse
-Venema.
-Some of the features new in 2.0 are:
- - New access control table format to impose the use of S/Keys
- based on: hostname, ip address, port, username, group id.
- - S/Key support can be disabled by not having the access control
- table.
-The second item explains the absence of skey.access in the installed /etc.
-To enable S/Key support, create a file skey.access in /etc and fill it
-according to your needs. See also skey.access(5) and the example in
-/usr/share/examples/etc/skey.access.
-
-Owner: pst, guido
-Sources involved: lib/libskey, usr.bin/key* (plus patches to others)
-
-
-TCP/IP over parallel (printer) port
------------------------------------
-You can now run TCP/IP over a standard LapLink(tm) cable, if both ends
-have an interrupt-driven printerport. The interface is named "lp0"
-where '0' is the same as the lpt# unit number. This is not compatible
-with PLIP. If you run NFS, try setting MTU to 9180, otherwise leave
-it at 1500 unless you have a good reason to change it. Speed varies
-with the CPU-type, with up to 70 kbyte/sec having been seen and 50
-kbyte/sec being the norm.
-
-Owner: phk
-Sources involved: isa/lpt.c
-
-
-ProAudioSpectrum SCSI driver
-----------------------------
-If you have a PAS board with a CD-ROM, and the MS-DOS driver is called
-TSLCDR.SYS, then the "pas" driver should work on your card. You can
-attach disks, cdroms and tapes, but due to the nature of the hardware
-involved, the transfer rate is limited to < 690 kbyte/sec. For CD-ROM
-use, this is generally more than enough.
-
-Owner: phk
-Sources involved: isa/pas.c
-
-
-Adaptec 2742/2842 SCSI driver
------------------------------
-Despite the non-cooperation of Adaptec in providing technical
-information, we now have a driver for the AHA-274x and AHA-284x
-series SCSI controller family. This driver uses the GPL'd
-Linux sequencer code, so until we find an alternative, this
-will be part of the kernel that requires source code to be
-distributed with it at all times. This shouldn't be a problem
-for any of FreeBSD's current users.
-
-Owner: gibbs
-Sources involved: isa/aic7770.c sys/gnu/misc/*
-
-
-Gzip'd binaries
-----------------
-We have an experimental implementation for direct execution of gzip'ed
-binaries in this release. When enabled, it allows you to simply gzip
-your binaries, remove the '.gz' extension and make the file
-executable. There is a big speed and memory consumption penalty for
-doing this, but for laptop users it may be worthwhile. The maximum
-savings are generally around 10 Mb of disk space.
-
-Owner: phk
-Sources involved: kern/imgact_gzip.c kern/inflate.c
-
-
-Diskless booting
-----------------
-
-Diskless booting in 2.0 is much improved since 1.1.5. The
-boot-program is in src/sys/i386/boot/netboot, and can be run from an
-MSDOS system or burned into an EPROM. Local swapping is also
-possible. WD, SMC, 3COM and Novell ethernet cards are currently
-supported.
-
-Owner: Martin Renters & phk
-Sources involved: i386/boot/netboot, sys/nfs/nfs_vfsops.h
-
-
-Device configuration database
------------------------------
-The kernel now keeps better track of which device drivers are active and
-where the devices are attached; this information is made available to
-user programs via the new sysctl(3) management interface. Current
-applications include lsdev(8), which lists the currently configured
-devices. In the future, we expect to use this code to automatically
-generate a configuration file for you at installation time.
-
-Owner: wollman
-Sources involved: sys/i386, sys/scsi, sys/kern/kern_devconf.c,
- sys/sys/devconf.h, usr.sbin/lsdev
-
-
-Kernel management interface
----------------------------
-With 4.4-Lite, we now have a better management interface for the endless
-series of kernel variables and parameters which were previously manipulated
-by reading and writing /dev/kmem. Many programs have been rewritten to
-use this interface, although many old-style programs still remain. Some
-variables which were never accessible before are now available through
-the sysctl(1) program. In addition to the standard 4.4BSD MIB variables,
-we have added support for YP/NIS domains (kern.domainname), controlling
-the update daemon (kern.update), retrieving the OS release date
-(kern.osreldate), determining the name of the booted kernel (kern.bootfile),
-and checking for hardware floating-point support (hw.floatingpoint).
-We have also added support to make management queries of devices and
-filesystems.
-
-Owner: core
-Sources involved: sys, usr.bin/sysctl
-
-
-iBCS2 support
--------------
-FreeBSD now supports running iBCS2 compatible binaries (currently
-SCO UNIX 3.2.2 & 3.2.4 and ISC 2.2 COFF format are supported).
-The iBCS2 emulator is in its early stages, but it is functional, we
-haven't been able to do exhaustive testing (lack of commercial apps),
-but almost all of SCO's 3.2.2 binaries are working, so is an old
-INFORMIX-2.10 for SCO. Further testing is nessesary to complete this
-project. There is also work under way for ELF & XOUT loaders, and
-most of the svr4 syscall wrappers have been written.
-
-Owner: Soren Schmidt (sos) & Sean Eric Fagan (sef)
-Sources involved: sys/i386/ibcs2/* + misc kernel changes.
-
-
-2. Supported Configurations
----------------------------
-
-FreeBSD currently runs on a wide variety of ISA, VLB, EISA and PCI bus
-based PC's, ranging from 386sx to Pentium class machines (though the
-386sx is not recommended). Support for generic IDE or ESDI drive
-configurations, various SCSI controller, network and serial cards is
-also provided.
-
-Following is a list of all currently known disk controllers and
-ethernet cards known to work with FreeBSD. Other configurations may
-very well work, and we have simply not received any indication of
-this.
-
-
-2.1. Disk Controllers
-
-WD1003 (any generic MFM/RLL)
-WD1007 (any generic IDE/ESDI)
-[Note: the new Extended IDE controllers in newer PC's work, although no
-extended features are used.]
-
-Adaptec 152x series ISA SCSI controllers
-Adaptec 154x series ISA SCSI controllers
-Adaptec 174x series EISA SCSI controller in standard and enhanced mode.
-Adaptec 2742/2842 series ISA/EISA SCSI controllers
-Adaptec AIC-6260 and AIC-6360 based boards, which includes
-the AHA-152x and SoundBlaster SCSI cards.
-
-** Note: You cannot boot from the Soundblaster cards
-as they have no on-board BIOS, which is necessary for mapping
-the boot device into the system BIOS I/O vectors.
-They're perfectly usable for external tapes, CDROMs, etc,
-however. The same goes for any other AIC-6x60 based card
-without a boot ROM. Some systems DO have a boot ROM, which
-is generally indicated by some sort of message when the system
-is first powered up or reset. Check your system/board documentation
-for more details.
-
-[Note that Buslogic was formerly known as "Bustec"]
-Buslogic 545S & 545c
-Buslogic 445S/445c VLB SCSI controller
-Buslogic 742A, 747S, 747c EISA SCSI controller.
-Buslogic 946c PCI SCSI controller
-
-NCR 53C810 and 53C825 PCI SCSI controller.
-
-DTC 3290 EISA SCSI controller in 1542 emulation mode.
-
-UltraStor 14F, 24F and 34F SCSI controllers.
-
-Seagate ST01/02 SCSI controllers.
-
-Future Domain 8xx/950 series SCSI controllers.
-
-With all supported SCSI controllers, full support is provided for
-SCSI-I & SCSI-II peripherals, including Disks, tape drives (including
-DAT) and CD ROM drives. Note: This and the mcd driver (Mitsumi CDROM
-interface card) are the only way a CD ROM drive may be currently
-attached to a FreeBSD system; we do not support SoundBlaster
-(non-SCSI) CDROM interface, or other "non-SCSI" adapters. The
-ProAudio Spectrum SCSI and SoundBlaster SCSI controllers are
-supported.
-
-Some controllers have limitations with the way they deal with >16MB of
-memory, due to the fact that the ISA bus only has a DMA address space of
-24 bits. If you do your arithmetic, you'll see that this makes it
-impossible to do direct DMA to any address >16MB. This limitation is
-even true of some EISA controllers (which are normally 32 bit) when
-they're configured to emulate an ISA card, which they then do in *all*
-respects. This problem is avoided entirely by IDE controllers (which do
-not use DMA), true EISA controllers (like the UltraStor or Adaptec
-1742A) and most VLB (local bus) controllers. In the cases where it's
-necessary, the system will use "bounce buffers" to talk to the
-controller so that you can still use more than 16Mb of memory without
-difficulty.
-
-
-2.2. Ethernet cards
-
-SMC Elite 16 WD8013 ethernet interface, and most other WD8003E,
-WD8003EBT, WD8003W, WD8013W, WD8003S, WD8003SBT and WD8013EBT
-based clones. SMC Elite Ultra is also supported.
-
-DEC EtherWORKS III NICs (DE203, DE204, and DE205)
-DEC EtherWORKS II NICs (DE200, DE201, DE202, and DE422)
-
-Isolan AT 4141-0 (16 bit)
-Isolink 4110 (8 bit)
-
-Novell NE1000, NE2000, and NE2100 ethernet interface.
-
-3Com 3C501 cards
-
-3Com 3C503 Etherlink II
-
-3Com 3C507 Etherlink 16/TP
-
-3Com 3C509 and 3C579 Etherlink III
-
-Toshiba ethernet cards
-
-PCMCIA ethernet cards from IBM and National Semiconductor are also
-supported.
-
-2.3. Misc
-
-AST 4 port serial card using shared IRQ.
-
-ARNET 8 port serial card using shared IRQ.
-
-BOCA ATIO66 6 port serial card using shared IRQ.
-
-STB 4 port card using shared IRQ.
-
-Mitsumi (all models) CDROM interface and drive.
-
-Soundblaster SCSI and ProAudio Spectrum SCSI CDROM interface and drive.
-
-Adlib, Soundblaster, Soundblaster Pro, ProAudioSpectrum, Gravis UltraSound
-and Roland MPU-401 sound cards.
-
-FreeBSD currently does NOT support IBM's microchannel (MCA) bus, but
-support is apparently close to materializing. Details will be posted
-as the situation develops.
-
-
-3. Obtaining FreeBSD.
----------------------
-
-You may obtain FreeBSD in a variety of ways:
-
-1. FTP/Mail
-
-You can ftp FreeBSD and any or all of its optional packages from
-`freebsd.cdrom.com' - the offical FreeBSD release site.
-
-For other locations that mirror the FreeBSD software see the file
-MIRROR.SITES. Please ftp the distribution from the nearest site
-to you netwise.
-
-If you do not have access to the internet and electronic mail is your
-only recourse, then you may still fetch the files by sending mail to
-`ftpmail@decwrl.dec.com' - putting the keyword "help" in your message
-to get more information on how to fetch files from freebsd.cdrom.com.
-Note: This approach will end up sending many *tens of megabytes*
-through the mail, and should only be employed as an absolute LAST
-resort!
-
-
-2. CDROM
-
-FreeBSD 2.0 may be ordered on CDROM from:
-
- Walnut Creek CDROM
- 4041 Pike Lane, Suite D
- Concord CA 94520
- 1-800-786-9907, +1-510-674-0783, +1-510-674-0821 (fax)
-
-Or via the internet from orders@cdrom.com. Their current catalog can
-be obtained via ftp as ftp.cdrom.com:/cdrom/catalog.
-
-Cost is $39.95. Shipping (per order not per disc) is $5 in the US, Canada,
-or Mexico and $10.00 overseas. They accept Visa, Mastercard, American
-Express, and ship COD to the United States. California residents please
-add 8.25% sales tax.
-
-Should you be dissatisfied for any reason, the CD comes with an
-unconditional return policy.
-
-Note that Walnut Creek CDROM does NOT provide technical support for FreeBSD,
-you need to contact the FreeBSD team for that. Please see section 5 for
-more information.
-
-
-4. Preparing for the installation.
-----------------------------------
-
-1. Floppy Installation
-
-If you must install from floppy disks, either due to space contraints
-on your hard disk or just because you enjoy doing things the hard
-way, you must first prepare some floppies for the install.
-
-You will need either 10 1.44MB floppies or 12 1.2MB floppies to
-store just the bindist (binary distribution). These *must* be
-formatted using MS-DOS, using either the FORMAT command in MS-DOS
-or the File Manager in Microsoft Windows to prepare the floppies
-(though factory preformatted floppies will also well well, provided
-that they haven't been previously used for something else).
-
-After you've formatted the floppy disks, you'll need to copy the
-files onto them. There are 56 total files for the bindist itself,
-plus three small files (CKSUMS, do_cksum.sh, and extract.sh) for
-the install program to use. ALL of these files must be copies onto
-the floppies. Each of the bindist files are named "bindist.??",
-where the "??" is replaced by the letter sequence aa through cd.
-Copy these files onto the floppies, placing the three small install
-files onto the final floppy. The order in which you copy the files
-to floppy is not important, but it makes labelling the disks easier
-if you go in some sort of alphabetical order.
-
-After you've done this, the floppy disks are ready for the install
-program to use.
-
-Later on, after you get the binary distribution installed and everything
-is going great, the same instructions will apply for the other
-distributions, such as the manpages distribution or the XFree86 distribution.
-The number of floppies required will, of course, change for bigger or
-smaller distributions.
-
-
-2. Hard Disk Installation
-
-To prepare for installation from an MS-DOS partition, you should simply
-copy the files from the distribution into a directory with the same
-name as the distribution. For example, if you are preparing to
-install the bindist set, then make a directory on your C: drive named
-C:\BINDIST and copy the files there. This will allow the installation
-program to find the files automatically.
-
-
-3. QIC/SCSI Tape Installation.
-
-Installing from tape is probably the easiest method, short of an
-on-line install using ftp or installing from a CDROM. The installation
-program expects the files to be simply tar'red onto the tape, so after
-getting all of the files for distribution you're interested in, simply
-tar them onto the tape with something like:
-
- cd <where the *.?? files are>
- tar cvf /dev/rwt0 (or /dev/rst0) .
-
-from a directory with just the distribution files in it. Make sure
-that you remember to put CKSUMS, do_cksum.sh, and extract.sh files
-in this directory as well!
-
-If you wish to install multiple *dist releases from one tape, do the
-following:
-
-1. cd to the parent directory of the distributions and put them on tape
- like so:
- tar cvf /dev/rwt0 (or /dev/rst0) bindist srcdist ...
-
-2. Install the first distribution on the tape using the tape installation
- method as normal. Afterwards, *do not* erase the contents of the temporary
- directory. Get a shell with ESC-ESC and cd to the temporary directory
- yourself. For each additional *dist you want to load, cd to its
- subdirectory and type `sh ./extract.sh'.
-
-
-5. Reporting problems, making suggestions, submitting code.
------------------------------------------------------------
-
-Your suggestions, bug reports and contributions of code are always
-valued - please do not hesitate to report any problems you may find
-(preferably with a fix attached if you can!).
-
-The preferred method to submit bug reports from a machine with internet
-mail connectivity is to use the send-pr command. Bug reports will be
-dutifully filed by our faithful bugfiler program and you can be sure
-that we'll do our best to respond to all reported bugs as soon as
-possible.
-
-If, for some reason, you are unable to use the send-pr command to
-submit a bug report, you can try to send it to:
-
- bugs@FreeBSD.org
-
-
-Otherwise, for any questions or suggestions, please send mail to:
-
- questions@FreeBSD.org
-
-Additionally, being a volunteer effort, we are always happy to have
-extra hands willing to help - there are already far more enhancements
-to be done than we can ever manage to do by ourselves! To contact us
-on technical matters, or with offers of help, you may send mail to:
-
- hackers@FreeBSD.org
-
-Since these mailing lists can experience significant amounts of
-traffic, if you've got slow or expensive mail access and you're
-only interested in keeping up with significant FreeBSD events, you may
-find it preferable to subscribe to:
-
- announce@FreeBSD.org
-
-
-All but the FreeBSD-bugs groups can be freely joined by anyone wishing
-to do so. Send mail to MajorDomo@FreeBSD.org and include the keyword
-`help' on a line by itself somewhere in the body of the message. This
-will give you more information on joining the various lists, accessing
-archives, etc. There are a number of mailing lists targeted at
-special interest groups not mentioned here, so send mail to majordomo
-and ask about them!
-
-
-6. Acknowledgements
--------------------
-
-FreeBSD represents the cumulative work of many dozens, if not
-hundreds, of individuals from around the world who have worked very
-hard to bring you this release. It would be very difficult, if not
-impossible, to enumerate everyone who's contributed to FreeBSD, but
-nonetheless we shall try (in alphabetical order, of course). If your
-name is not mentioned, please be assured that its omission is entirely
-accidental.
-
-
-The Computer Systems Research Group (CSRG), U.C. Berkeley.
-
-Bill Jolitz, for his extensive work with 386BSD.
-
-The FreeBSD "core" team:
-
- Andrey A. Chernov
- John Dyson
- Bruce Evans
- David Greenman
- Rodney W. Grimes
- Jordan K. Hubbard
- Poul-Henning Kamp
- Rich Murphey
- Gary Palmer
- Geoff Rehmet
- Paul Richards
- Soren Schmidt
- Andreas Schulz
- Jack Vogel
- Garrett A. Wollman
-
-
-Special mention to:
-
- Robert Bruce and Jack Velte of Walnut Creek CDROM, without
- whose help (and continuing support) this release would never
- have been possible.
-
- Dermot McDonnell for his donation of a Toshiba XM3401B CDROM
- drive.
-
- The NetBSD group for their frequent assistance and commentary.
-
- Additional FreeBSD helpers and beta testers:
-
- J.T. Conklin Julian Elischer
- Sean Eric Fagan Jeffrey Hsu
- Terry Lambert L Jonas Olsson
- Chris Provenzano Dave Rivers
- Guido van Rooij Steven Wallace
- Atsushi Murai Scott Mace
- Andrew Moore Nate Williams
-
- And everyone at Montana State University for their initial support.
-
-
-Thanks to everyone, especially those not mentioned, and we sincerely
-hope you enjoy this release of FreeBSD!
-
-
- The FreeBSD Core Team
-
-$Id: RELNOTES.FreeBSD,v 1.22 1995/01/27 23:15:31 jkh Exp $
diff --git a/share/FAQ/Slip.FAQ b/share/FAQ/Slip.FAQ
deleted file mode 100644
index 1135c1f..0000000
--- a/share/FAQ/Slip.FAQ
+++ /dev/null
@@ -1,190 +0,0 @@
-***********************************************************************
-*** How to Set Up SLIP on FreeBSD ***
-***********************************************************************
-
-Updated for 1.1.5(.1) support by Satoshi Asami, 8/6/94.
-
-The following is I (asami) set up my FreeBSD machine for SLIP on a
-static host network. For dynamic hostname assignments (i.e., your
-address changes each time you dial up), you probably need to do
-something much fancier.
-
-This is just "what I did, and it worked for me". I'm sharing this
-just for your reference, I'm no expert in SLIP nor networking so your
-mileage may vary.
-
-Note: for 1.1 systems (not 1.1.5), you need to use /dev/tty01 instead
-of /dev/cua01. substitute all the occurences of "cua" in this document
-with "tty".
-
-Note: the default 1.1.5(.1) system only comes with cua/ttyd pairs for
-the last two ports (2 and 3), so if your modem is at sio0/sio1
-(COM1/COM2), you need to make the devices. Try "cd /dev; sh MAKEDEV
-cua01" to make the new special files for sio1 (ditto for sio0). This
-will delete tty01, but you shouldn't need it anymore...or you can make
-a symbolic link /dev/tty01 -> ttyd1 if you don't want to hunt down all
-occurences of tty01 in your setup files.
-
-I actually have a symbolic link /dev/modem -> cua01 (and /dev/mouse ->
-ttyd0). I use only the modem/mouse names in my configuration files.
-This helped a lot when I switched from 1.1 to 1.1.5.1 (tty01 => cua01)
-and when I had to move my modem temporarily to sio2 to enable the
-RS-232C port on the serial card. It can become quite cumbersome when
-you need to fix a bunch of files in /etc and .kermrc's all over the
-system!
-
-First, make sure you have
-
-pseudo-device sl 2
-
-in your kernel's config file. It is included in the GENERIC, GENERICAH
-and GENERICBT kernels, so this won't be a problem unless you deleted it.
-
-Things you have to do only once:
-
-(1) Add your home machine, the gateway and nameservers to your
- /etc/hosts file. Mine looks like this:
-
-127.0.0.1 localhost loghost
-136.152.64.181 silvia.HIP.Berkeley.EDU silvia.HIP silvia
-
-136.152.64.1 inr-3.Berkeley.EDU inr-3 slip-gateway
-128.32.136.9 ns1.Berkeley.edu ns1
-128.32.136.12 ns2.Berkeley.edu ns2
-
- By the way, silvia is the name of the car that I had when I was
- back in Japan (it's called 2?0SX here in U.S.).
-
-(2) Make sure you have "hosts" before "bind" in your /etc/host.conf.
- Otherwise, funny things may happen.
-
-(3) Edit the /etc/netstart and add this to the end of the file:
-
-# set up slip
-gateway=slip-gateway
-ifconfig sl0 inet $hostname $gateway netmask 0xffffff00
-route add default $gateway
-
- Note that because of the "slip-gateway" entry in /etc/hosts, there
- is no local dependency in the netstart file. Also, you might want
- to un-comment the "route add $hostname localhost" line.
-
-(3') Make a file /etc/resolv.conf which contains:
-
-domain HIP.Berkeley.EDU
-nameserver 128.32.136.9
-nameserver 128.32.136.12
-
- As you can see, these set up the nameserver hosts. Of course, the
- actual addresses depend on your environment.
-
-(4) Set the password for root and toor (and any other accounts that
- doesn't have a password). Use passwd, don't edit the passwd or
- passwd.master files!
-
-(5) Edit /etc/myname and reboot the machine.
-
-How to set up the connection:
-
-(6) Dial up, type "slip" at the prompt, enter your machine name and
- password. The things you need to enter depends on your
- environment. I use kermit, with a script like this:
-
-# kermit setup
-set modem hayes
-set line /dev/cua01
-set speed 57600
-set parity none
-set flow rts/cts
-set terminal bytesize 8
-set file type binary
-# The next macro will dial up and login
-define slip dial 643-9600, input 10 =>, if failure stop, -
-output slip\x0d, input 10 Username:, if failure stop, -
-output silvia\x0d, input 10 Password:, if failure stop, -
-output ***\x0d, echo \x0aCONNECTED\x0a
-
- (of course, you have to change the hostname and password to fit
- yours). Then you can just type "slip" from the kermit prompt to
- get connected.
-
- Note: leaving your password in plain text anywhere in the
- filesystem is generally a BAD idea. Do it at your own risk. I'm
- just too lazy.
-
- Note: If you have an 1.1 machine, and kermit doesn't give you a
- prompt, try "stty -f /dev/tty01 clocal". I put this in
- /etc/rc.local so that it works the first time I boot the machine.
- This doesn't apply to 1.1.5(.1) systems, as cua0? are already
- configured for dialouts.
-
-(7) Leave the kermit there (you can suspend it by "z") and as root,
- type
-
-slattach -h -c -s 57600 /dev/cua01
-
- if you are able to "ping" hosts on campus, you are connected!
-
- If it doesn't work, you might want to try "-a" instead of "-c".
-
-(8) Happy slipping!
-
-How to shutdown the connection:
-
-(9) Type "ps gx" (as root) to find out the PID of slattach, and use
- "kill -INT" to kill it.
-
- Then go back to kermit ("fg" if you suspended it) and exit from it
- ("q").
-
- The slattach man page says you have to use "ifconfig sl0 down" to
- mark the interface down, but this doesn't seem to make any
- difference for me. ("ifconfig sl0" reports the same thing.)
-
- Some times, your modem might refuse to drop the carrier (mine
- often does). In that case, simply start kermit and quit it again.
- It usually goes out on the second try.
-
- When you want to connect again, go back to (6). You may have to
- watch out for clocal mode. If "stty -f /dev/tty01" doesn't tell
- you it's clocal, you need to re-set it before kermitting. Again,
- this is only for 1.1 machines.
-
-TROUBLESHOOTING:
-
-If it doesn't work, feel free to ask me. The things that people
-tripped over so far:
-
-* Not using "-c" or "-a" in slattach (I have no idea why this can be
- fatal, but adding this flag solved the problem for at least one
- person)
-
-* Using "s10" instead of "sl0" (might be hard to see the difference on
- some fonts :)
-
-Try "ifconfig sl0" to see your interface status. I get:
-
-silvia# ifconfig sl0
-sl0: flags=10<POINTOPOINT>
- inet 136.152.64.181 --> 136.152.64.1 netmask ffffff00
-
-Also, "netstat -r" will give the routing table, in case you get the
-"no route to host" messages from ping. Mine looks like:
-
-silvia# netstat -r
-Routing tables
-Destination Gateway Flags Refs Use IfaceMTU Rtt
-Netmasks:
-(root node)
-(root node)
-
-Route Tree for Protocol Family inet:
-(root node) =>
-default inr-3.Berkeley.EDU UG 8 224515 sl0 - -
-localhost.Berkel localhost.Berkeley UH 5 42127 lo0 - 0.438
-inr-3.Berkeley.E silvia.HIP.Berkele UH 1 0 sl0 - -
-silvia.HIP.Berke localhost.Berkeley UGH 34 47641234 lo0 - 0.438
-(root node)
-
-(this is after transferring a bunch of files, your numbers should be
-smaller).
diff --git a/share/FAQ/Systems-1.1.FAQ b/share/FAQ/Systems-1.1.FAQ
deleted file mode 100644
index ff3b1c8..0000000
--- a/share/FAQ/Systems-1.1.FAQ
+++ /dev/null
@@ -1,266 +0,0 @@
- Systems FAQ
- For FreeBSD
- Last Modified: $Id: Systems.FAQ,v 1.1 1994/09/11 10:56:04 jkh Exp $
-
-This FAQ is a list of systems that people have sent to the FAQ maintnance
-person for inclusion. If you have a system you would like to be included
-please send it to FreeBSD-FAQ@freefall.cdrom.com.
-
-Disclaimer: This document is composed of systems that people have sent to
-the FAQ maintnance person. It is the not to be taken as an endorsement
-for any system or manufacture.
-
-
-1.
-
-386DX/20 real AMI, ISA
-Oak SVGA (no X)
-8MB
-Adaptec 1542B, WD1007V ESDI
-Wren VI and Miniscribe 660MB 20Mbit/sec ESDI
-WD 8013EBT
-
-2.
-
-486DX/25 clone, AMI BIOS, ISA
-Orchid PCIII gas plasma (yes, VGA16)
-8MB
-Adaptec 1542B
-Micropolis 1684 SCSI
-SMC 8013EEWC
-
-3.
-
- ??? OPTI chipset AMI BIOS 486/50 ISA
-ISA ET4000 w/ X11 (not so slow)
-16 Mb - 48 Mb swap
-ISA aha1542 B
-ISA no-name IDE w/ floppies
-FUJITSU M2623S-512 405MB set to SCSI2
-SEAGATE ST3283N 237MB SCSI2
-SANYO CRD-400I SCSI2 cdromcdrom
-
-4.
-
-Lipizzan LDO-1 486DX-33 motherboard
-Orchid ProIIs (1M) video
-8 MB memory
-Generic 2S/1P/2FD/IDE controller:
-Maxtor 7213 AT
-WDC AC2420H
-PAS-16 + Sony CDU31A CD drive (Fusion 16 package).
- *** The CD drive does not currently work with FreeBSD.
-
-5.
-
-Asus VL/ISA-486SV2 (ISA-VLB as you can see)
-Orchid Fahrenheit 1280+ VLB (yes)
-20MB
-Some no-name IDE VLB controller
-Conner CP30504 (I think....the 540MB IDE one)
-Zoltrix 14.4/14.4 Fax/Modem on tty01
-Intel 486DX2/66 CPU + fan
-Conner CP30104 (120MB....for DOS)
-
-6.
-
-AIR 486El (running with AMD486/40)
-ATI Graphics Ultra Pro running XFree862.1
-16M
-Adaptec 1742
-Micropolis 2217
-Wangtec 6130FS DAT drive (Some problems)
-
-7.
-
-Compudyne 486 DX2/66
-ATI Local Bus GUP w/ 2megs
-16 Megs Memory
-504 IDE Hard Drive
-Colorado 250 meg QIC-80 tape drive
-
-8.
-
-American Megatrends Enterprise III, 486DX2-66
-ATI VLB Mach 32 (with X)
-16 meg
-Adaptec 1742 EISA SCSI with floppy
-Toshiba 5030 SCSI-II
-Toshiba 5157 SCSI-II
-SMC Elite16T ISA Ethernet (ISA)
-
-9.
-
-American Megatrends Enterprise III, 486DX
-ATI VLB Mach 32 (with X)
-32 meg
-Adaptec 1742 EISA SCSI with floppy
-Maxtor P0-12S SCSI
-Digital DSP5200S SCSI-II
-Pro Audio Spectrum 16
-Wonder Board, 4 serial (16550), 3 parallel, each on a different interrupt
-
-10.
-
-NoName 486DX/33, Intel Chipset, EISA-Bus
-ATI Graphics Ultra Pro EISA,
-17" Nanao (Eizo) F550-i Monitor
-Running the Mach32 X-Server XFree86-2.1.1 with fonts created from source.
-16 MB RAM (planning to add another 8 MB).
-AHA1742A
-Conner CP3100
-Fujitsu 520 MB
-Archive 525MB streamer tape.
-Gravis UltraSound - works for mod-files.
-
-11.
-
-ASUS SP3 PCI Board with i486 DX/2 66 MHz
-ISA ET4000 (I already tested a S3 805 PCI card successfully)
-Adaptec 1542B
-Toshiba XM3301TA CD-Rom
-CDC Harddisk, 572 MB (I don't know the exact specs)
-
-12.
-
-Mylex MAE486/33 EISA Motherboard
-16MB memory
-Actix GE32+ S3 801 gfx
-Adaptec 1742A controller
-Seagate ST3160 drive
-Seagate ST5120 drive
-Archive Viper 150MB tape
-Roland SCC-1 sound card
-Gravis Ultrasound card
-Longshine SMC/Novell compatable ethernet card
-
-13.
-
-Model: DECpc LPv 466d2
-Config: Local (Motherboard) S3 801 gfx, IDE controller, PS/2 mouse, 12MB memory
-
-14.
-
-
-??? 486/DX266 EISA/VLB Motherboard
-16MB memory
-#9 GXE L12 VLB 3MB graphics card
-Bt445S VLB disk controller
-DEC DSP3105S drive
-MAXSTOR P-17S drive
-Tandberg 525MB tape drive
-Toshiba XM3301 CDROM
-Soundblaster 2.0
-Longshine SMC/Novell compatable ethernet card
-
-15.
-
-M407 PC chips with 33Mhz 486.
-Had to disable external cache due to DMA problems. Board uses write-through
-cache unless a second chip is added to allow write-back.write-back.
-Orchid ProDesigner II (yes)
-16Mb
-IDE
-Maxtor 7213 AT and Maxtor 7120 AT
-2 BICC Isolans (Lance based cards)
-
-16.
-
-Gigabyte EISA/VLB motherboard with SIS chipset, AMI bios, 32 MB ram
-Adaptec 1742 SCSI 2 controller with floppy controller enabled
-Spea/V7 Mirage - S3/805 based localbus graphics card with 1 MB d-ram
-no name wd8013 compatible ethernet card
-Gravis Ultrasound card with 1 MB ram
-2 Fujitsu 400 MB and 1 Seagate 500 MB SCSI 2 harddisks
-5 1/4 + 3 1/2 inch floppy drives
-Tandberg TDC3600 60 MB + Tandberg TDC3800 525 MB Streamer (these don't work
-quite properly yet)
-
-17.
-
-i486DX33, 16 Mb RAM, 256 Kb external cache, VLB board
-no-name IDE/floppy controller
-Western Digital Caviar 2340 (325 Mb)
-Kalok KL-343 (40 Mb)
-Chips & Technologies 451 SuperVGA card (800x600, 16 colours, 256Kb)
-
-18.
-
-no name EISA i486DX/33 board, 16 MB RAM
-Adaptec AHA-1540*A* (not knowing if the current -current might cause
- problems, my kernel is from end of march)
-Maxtor MXT-1240S, 1.2Gig very fast SCSI disk
-Seagate ST-1144A, just to boot off the beast (also has a messdos partition yet)
-Archive Viper 150 tape; has a firmware braindeadness when appending files,
- works very well otherwise
-ELSA Winner 1000 ISA/EISA, 1MB VRAM, S3 86C928 (unfortunately, D-step chip)
-Nokia 447-B 17in monitor, running ~ 1100x800 resolution, very nice
-true `Mouse Systems' optical mouse, fine thing!
-sometimes a Toshiba XM-3301 CDROM, rather old, but solid & reliable
-
-19.
-
-older south-east Asia made notebook, i386SX/16, 5 MB RAM (where the 384 k hole
- can be re-mapped, so all the 5 MB are useable)
-Seagate ST-9145AG, 120 MB 2.5in IDE disk, very low power consumption, but
- rather slow transfer rate, only about 350 K/s, so paging is a mess
-640x480 LCD, ~ 16 gray tones distinguishable, Cirrus Logic CL-GD610/620
- chipset; runs generic VGA-Mono and VGA-16 XFree86[tm] servers; needs
- some hacks in rc.local to give full contrast when running with the
- pcvt display driver (due to their different default attribute handling)
-
-
-20.
-
-Data General Dasher 386sx/16, 8 MB RAM
-Adaptec AHA-1542B
-Seagate ST-3655N, 525 MB SCSI disk
-Conner CP-3044, 40 MB IDE disk
-has been working with a Western Digital WD-1007V ESDI controller (on
- secondary wdc address), and a Micropolis 1664-7 330 MB ESDI disk -
- but this beast was terribly slow, loud (& unreliable) and therefore
- had to go
-ET-3000 based 512 K VGA, slow (wrt. XFree86), but reliable
-3Com 3C503 Ethernet adaptor, suffers from the `do not nfs mount with
- too large packets' problem, but works well otherwise
-`Mouse Systems' optical mouse
-Toshiba XM-3301 CDROM
-already ran with a Micropolis 1664-3 330 MB SCSI disk (same drive as
- above, but different interface)
-already ran with an IBM 2Gig SCSI disk (don't remember the type)
-
-
-21.
-
-Mylex MNA 486/33 EISA Motherboard
-16Mb of Memory
-1.2 GB Toshiba 538 SCSI disk
-400Mb IBM SCSI disk
-150/250Mb Tandberg SCSI tape drive
-Toshiba 3401 SCSI CD-ROM
-Tseng 4000 Video Controller
-Logitech Bus Mouse
-Mediavision Pro Audio Stereo Sound Card
-Adaptech 1742A SCSI controller
-WD8013EBT Ethernet Card
-
-22.
-
-386DX-40 w/Cyrix math co-processor
-ET-4000 running X
-16MB
-IDE
-540MB Western Digital
-WD8003EP
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/share/FAQ/Systems.FAQ b/share/FAQ/Systems.FAQ
deleted file mode 100644
index ad1715e..0000000
--- a/share/FAQ/Systems.FAQ
+++ /dev/null
@@ -1,59 +0,0 @@
-
- Systems FAQ
- for FreeBSD 2.0
-
-This FAQ lists systems (and componets) known to work with FreeBSD 2.0. None
-of these lists should be seen as a recomandation for a manufacture.
-
-Revision: $Id: Systems.FAQ,v 1.5 1994/09/16 18:51:50 gclarkii Exp $
-
-
-i386:
-
-
-Motherboard: Magitronics 386DX-40
-CPU: i386DX-40
-Busses: ISA and VLB (VLB not tested)
-Ram: 20 Megs
-Video: Generic 1MB Tseng 4000 (ISA)
-Disks:
- 2 - Segate ST1126 (SCSI)
- 1 - Seagate ST1480 (SCSI)
- 1 - Toshiba MK-234FC-C (IDE)
-Controllers:
- Generic IDE
- Adaptec AH-1542CF
-
-Motherboard: Magitronics 386SX-40
-CPU: i386SX-40
-Busses: ISA
-Ram: 4 Megs
-Video: Monochrome
-Disks:
- 1-Seagate ST1126 (SCSI)
-Controllers:
- Future Domain 850
-Notes: Slow but useable
-
-i486:
-
-Motherboard: Gateway 2000 Handbook 486 HB486DX2-40
-CPU: i486SL DX2/40
-BUS(S): PCMCIA, one type II
-Video Card: Monochrome VGA.
-Are you running X on this?: no, havn't really tried.
-Types of Disks (manufacture and bus): 130Mb builtin. <Areal A130 U>
-If you wish to be credited: Poul-Henning Kamp phk@freefall.cdrom.com
-
-NOTES:
-This is a 3 pound portable. Runs perfect. Suspend works great. Has one
-serial and one parallel/floppy port, which can drive either a floppy or
-a parallel port, but not at the same time. Builtin "EZ" mouse-thinge.
-Highly recommended for people on the road.
-
-
-Credits:
- FreeBSD Core Team
- Gary Clark II
- Poul-Henning Kamp
-
diff --git a/share/FAQ/TROUBLESHOOTING b/share/FAQ/TROUBLESHOOTING
deleted file mode 100644
index d1cb25f..0000000
--- a/share/FAQ/TROUBLESHOOTING
+++ /dev/null
@@ -1,185 +0,0 @@
-Troubleshooting Tips - or "These are the times that try men's souls"
---------------------------------------------------------------------
-
-The following tips and tricks may help you turn a failing (or failed)
-installation attempt into a success. Please read them carefully.
-
----
-
-Symptom: Hardware conflict or misconfiguration.
- Device not being found when it should be.
-
-Problem: A device is conflicting with another, or its settings
- don't match the kernel's expected IRQ or address.
-
-Explanation: While most device drivers in FreeBSD are now smart
- enough to match themselves to your hardware settings
- dynamically, there are a few that still require fairly
- rigid configuration parameters to be compiled in (and
- matched by the hardware) before they'll work. We're
- working hard to eliminate as many of these last
- hold-outs as we can, but it's not always as easy as
- it looks.
-
-Solution: There are several possible solutions. The first,
- and easiest, is to boot the kernel with the -c flag.
- When you see the initial boot prompt (from floppy or
- hard disk), type:
-
- /kernel -c
-
- This will boot just past the memory sizing code and
- then drop into a dynamic kernel configuration utility.
- Type `?' at the prompt to see a list of commands. You
- can use this utility to reset the IRQ, memory address,
- IO address or a number of other device configuration
- parameters. You can also disable a device entirely
- if it's causing problems for other devices you'd much
- rather have work. Note that this only affects the
- kernel being booted temporarily, it does not "write out"
- the information to the kernel so that these settings
- are permanantly altered (this would be actually rather
- hard). If you reboot, you'll have to make the same
- changes again. The goal of the -c utility is to get
- you up far enough to be able to download the appropriate
- sources and configure and rebuild a kernel more specific
- to your needs.
-
- Another solution is, obviously, to remove the offending
- hardware or simply strip the system down to the bare
- essentials until the problem (hopefully) goes away.
- Once you're up, you can do the same thing mentioned
- above - compile a kernel more suited to your hardware,
- or incrementally try to figure out what it was about
- your original hardware configuration that didn't work.
-
----
-Symptom: My floppy-tape drive isn't probed.
-
-Problem: Last-minute problems with this driver caused it to be disabled
- by default.
-
-Solution: Boot with -c (described above) and set the flags value of
- fdc0 to 1. This will re-enable the floppy tape driver.
- Sorry, but it was causing problems for people without floppy
- tape drives!
----
-
-Symptom: When I boot for the first time, it still looks for /386bsd!
-
-Problem: You still have the old FreeBSD 1.x boot blocks on your
- boot partition.
-
-Solution: You should re-enter the installation process, invoke
- the (F)disk editor and chose the (W)rite option. This
- won't hurt an existing installation and will make sure
- that the new boot blocks get written to the drive.
- If you're installing for the first time, don't forget
- to (W)rite out your new boot blocks! :-)
-
----
-
-Symptom: I want to boot FreeBSD off the second drive. It doesn't!
-
-Problem: FreeBSD will actually install just fine on a drive other
- than 0 (the first drive), and the boot manager will even
- allow you to select it, but the boot blocks rather
- pathologically assume 0. This should be fixed in 2.1.
-
-Solution: Easy - follow these steps:
-
- 1. Select the first (0) drive from the (F)disk editor
- and write out the boot manager with the (B) option.
- This will enable the boot manager that allows you to
- actually boot off the other drive.
-
- 2. Exit the fdisk editor for the first drive and and
- re-enter it again for the drive you wish to install
- on. Set up a partition on this drive, or select
- (A)ll for the entire drive.
-
- 3. Enter the disklabel editor and allocate space on
- your second drive as normal. Proceed with the
- installation.
-
- 4. Once you've installed on the disk and are going to
- reboot from the hard disk, enter the following at
- the boot prompt:
-
- wd(1,a)/kernel
-
- [ If you're using a SCSI drive, substitute
- `sd' for `wd' above ]
-
- This will ensure that you really boot from the second
- drive. If you've actually installed on a drive other
- than 1 (the 3rd or 4th drive?), substitute that number
- in for the above. You will need to enter this EVERY
- time you reboot from the hard disk. If you're feeling
- brave and have a srcdist + the requisite experience,
- you can hack the boot blocks in:
-
- /usr/src/sys/i386/boot/biosboot
-
- So that this drive you're booting from is hard-coded.
- Recompile the boot blocks and reinstall them on your
- drive with `disklabel -B ...' You can then have the
- default Do The Right Thing.
----
-
-Symptom: Newfs crashes, requesting that blocksize be 32K
-
-Problem: You have your disk controller configured to translate
- to a some really large cylinder size because you're using
- a drive with lots of cylinders.
-
-Solution: Turn such translation OFF in your controller's BIOS
- setup if you can. If you must share the disk with other
- Operating Systems, then this may not be possible and
- you may simply be unable to install FreeBSD until we have
- support for large translated geometries, sorry!
- [ Hopefully in 2.1 ].
-
----
-
-Symptom: FreeBSD won't boot off the hard disk
-
-Problem: Root partition does not start and end below cylinder 1024.
-
-Solution: See solution for newfs crashes, or move your root
- partition. This limitation holds true for ANY operating
- system you wish to boot from your hard drive.
-
----
-
-Symptom: FreeBSD still won't boot off the hard disk
-
-Problem: No boot code is installed in sector 1.
-
-Solution: Chose the Write MBR (B)oot code in the FDISK editor and
- write out the boot manager so that you have a chance to
- select operating systems.
-
- [ ** NOTE: If you are using the entire disk for FreeBSD, or
- you have a Connor drive that does cylinder translation
- from the MBR boot code, do NOT chose this option! ** ].
-
----
-Summary: Nope, FreeBSD's still not booting from the hard disk.
-
-Cause: BIOS disk geometry different from that used when
- installing FreeBSD.
-
-Solution: With IDE drives, pay careful attention to the geometry
- information that FreeBSD prints out when it's first
- booting off the floppy. Use this geometry in your BIOS
- setup or use the BIOS geometry when you install FreeBSD.
- Either way, they have to match.
-
- With SCSI drives, the values they report is most often
- bogus and cannot be used. In this situation, the SCSI
- controller is performing geometry translation and
- it's probably wise to assume a default of 64 heads,
- 32 sectors and 1MB/cylinder. Use these values when
- you install FreeBSD. See above comments concerning
- newfs failures for more info.
diff --git a/share/FAQ/Text/CONTRIB.FreeBSD b/share/FAQ/Text/CONTRIB.FreeBSD
deleted file mode 100644
index 16e46b5..0000000
--- a/share/FAQ/Text/CONTRIB.FreeBSD
+++ /dev/null
@@ -1,278 +0,0 @@
- FreeBSD 2.0.5
- Contributor List
-
-
-
-Derived Software Contributors:
-
-This software was originally derived from William F. Jolitz's 386BSD
-release 0.1, though almost none of the original 386BSD specific code
-remains. This software has been essentially reimplemented from the
-4.4 BSD Lite release provided by the Computer Science Research Group
-(CSRG) at the University of California, Berkeley and associated academic
-contributors.
-
-There are also portions of NetBSD that have been integrated into FreeBSD
-as well, and we would therefore like to thank all the contributors
-to NetBSD for their work. Despite some occasionally rocky moments in
-relations between the two groups, we both want essentially the same
-thing: More BSD based operating systems on people's computers! We
-wish the NetBSD group every success in their endevors.
-
-
-Hardware Contributors:
-
-A special thank-you to Walnut Creek CDROM for providing the Pentium P5-90
-and 486/DX2-66 EISA/VL systems that are being used for our development work,
-to say nothing of the network access and other donations of hardware
-resources. It would have been impossible to do this release without
-their support.
-
-TRW Financial Systems, Inc. provided 130 PCs, three 68 GB fileservers,
-twelve ethernets, two routers and an ATM switch for debugging the diskless
-code. They also keep a couple of FreeBSD hackers alive and busy. Thanks!
-
-Thanks also to Dermot McDonnell for his donation of a Toshiba XM3401B CDROM
-drive. It's been most useful!
-
-Thanks to Chuck Robey (chuckr@eng.umd.edu) who's been contributing his
-floppy tape streamer for experimental work.
-
-
-The FreeBSD Core Team
-(in alphabetical order):
-
- Andrey A. Chernov <ache@FreeBSD.org>
- Bruce Evans <bde@FreeBSD.org>
- David Greenman <davidg@FreeBSD.org>
- Garrett A. Wollman <wollman@FreeBSD.org>
- Gary Palmer <gpalmer@FreeBSD.org>
- Jörg Wunsch <joerg@FreeBSD.org>
- John Dyson <dyson@FreeBSD.org>
- Jordan K. Hubbard <jkh@FreeBSD.org>
- Justin Gibbs <gibbs@FreeBSD.org>
- Poul-Henning Kamp <phk@FreeBSD.org>
- Rich Murphey <rich@FreeBSD.org>
- Rodney W. Grimes <rgrimes@FreeBSD.org>
- Satoshi Asami <asami@FreeBSD.org>
- Søren Schmidt <sos@FreeBSD.org>
-
-
-Who's Responsible For What:
-
- President: Jordan K. Hubbard <jkh@FreeBSD.org>
- Principle Architect: David Greenman <davidg@FreeBSD.org>
- Documentation: John Fieber <jfieber@FreeBSD.org>
- Internationalization: Andrey A. Chernov <ache@FreeBSD.org>
- Networking: Garrett A. Wollman <wollman@FreeBSD.org>
- Postmaster: Jonathan M. Bresler <jmb@FreeBSD.org>
- Public Relations: Jordan Hubbard <jkh@FreeBSD.org>
- Release Coordinator: Jordan Hubbard <jkh@FreeBSD.org>
- System Administration: Gary Palmer <gpalmer@FreeBSD.org>
- WEBMASTERS: John Fieber <jfieber@FreeBSD.org> and
- James L. Robinson <jlrobin@FreeBSD.org>
- XFree86 Project, Inc. Liason: Rich Murphey <rich@FreeBSD.org>
-
-
-Additional FreeBSD Contributors
-(in alphabetical order by first name, just to be different):
-
-Adam David <adam@veda.is>
-Adam Glass <glass@postgres.berkeley.edu>
-Akito Fujita <fujita@zoo.ncl.omron.co.jp>
-Andras Olah <olah@cs.utwente.nl>
-Andreas Klemm <andreas@knobel.GUN.de>
-Andrew Herbert <andrew@werple.apana.org.au>
-Andrew Moore <alm@FreeBSD.org>
-Anthony Yee-Hang Chan <yeehang@netcom.com>
-Atsushi Murai <amurai@spec.co.jp>
-Bill Fenner <fenner@parc.xerox.com>
-Bill Paul <wpaul@FreeBSD.org>
-Bob Wilcox <bob@obiwan.uucp>
-Brian Tao <taob@gate.sinica.edu.tw>
-Charles Hannum <mycroft@ai.mit.edu>
-Chris G. Demetriou <cgd@postgres.berkeley.edu>
-Chris Provenzano <proven@athena.mit.edu>
-Chris Stenton <jacs@gnome.co.uk>
-Chris Torek <torek@ee.lbl.gov>
-Christian Gusenbauer <cg@fimp01.fim.uni-linz.ac.at>
-Christoph Robitschko <chmr@edvz.tu-graz.ac.at>
-Chuck Robey <chuckr@Glue.umd.edu>
-Cornelis van der Laan <nils@guru.ims.uni-stuttgart.de>
-Craig Struble <cstruble@vt.edu>
-Curt Mayer <curt@toad.com>
-Danny J. Zerkel <dzerkel@feephi.phofarm.com>
-Dave Burgess <burgess@hrd769.brooks.af.mil>
-Dave Chapeskie <dchapes@zeus.leitch.com>
-Dave Rivers <rivers@ponds.uucp>
-David Dawes <dawes@physics.su.OZ.AU>
-Dean Huxley <dean@fsa.ca>
-Don Whiteside <dwhite@anshar.shadow.net>
-Eric L. Hernes <erich@lodgenet.com>
-Frank Durda IV <bsdmail@nemesis.lonestar.org>
-Frank Maclachlan <fpm@crash.cts.com>
-Frank Nobis <fn@trinity.radio-do.de>
-Gary A. Browning <gab10@griffcd.amdahl.com>
-Gary Clark II <gclarkii@radon.gbdata.com>
-Gary Jennejohn <gj%pcs.dec.com@inet-gw-1.pa.dec.com>
-Gene Stark <stark@cs.sunysb.edu>
-Guido van Rooij <guido@gvr.win.tue.nl>
-Havard Eidnes <Havard.Eidnes@runit.sintef.no>
-Holger Veit <Holger.Veit@gmd.de>
-Ishii Masahiro, R. Kym Horsell
-J.T. Conklin <jtc@winsey.com>
-James Clark <jjc@jclark.com>
-James da Silva <jds@cs.umd.edu> et al
-Janusz Kokot <janek@gaja.ipan.lublin.pl>
-Javier Martin Rueda <jmrueda@diatel.upm.es>
-Jim Wilson <wilson@moria.cygnus.com>
-Josh MacDonald <jmacd@uclink.berkeley.edu>
-Jörg Wunsch <joerg_wunsch@uriah.heep.sax.de>
-Julian Elischer <julian@dialix.oz.au>
-Julian Stacey <stacey@guug.de> <fallback: <julian@meepmeep.pcs.com>>
-Keith Bostic <bostic@toe.CS.Berkeley.EDU>
-Keith Moore <?>
-Kirk McKusick <mckusick@mckusick.com>
-L Jonas Olsson <ljo@po.cwru.edu>
-Lars Fredriksen <fredriks@mcs.com>
-Lucas James <Lucas.James@ldjpc.apana.org.au>
-Marc Frajola <marc@dev.com>
-Marc Ramirez <mrami@mramirez.sy.yale.edu
-Mark Murray <mark@grondar.za>
-Mark Tinguely <tinguely@plains.nodak.edu> <tinguely@hookie.cs.ndsu.NoDak.edu>
-Marc van Kempen <wmbfmk@urc.tue.nl>
-Martin Birgmeier
-Martin Renters <martin@innovus.com>
-Matt Thomas <thomas@lkg.dec.com>
-Michael Smith <msmith@atrad.adelaide.edu.au>
-Nate Williams <nate@FreeBSD.org>
-NIIMI Satoshi <sa2c@and.or.jp>
-Nobuhiro Yasutomi <nobu@@psrc.isac.co.jp>
-Nobuyuki Koganemaru <kogane@kces.koganemaru.co.jp>
-Ollivier Robert <roberto@FreeBSD.org>
-Paul Kranenburg <pk@cs.few.eur.nl>
-Paul Mackerras <paulus@cs.anu.edu.au>
-Paul Traina <pst@cisco.com>
-Paul Richards <paul@FreeBSD.org>
-Peter Dufault <dufault@hda.com>
-Peter Wemm <peter@haywire.DIALix.COM>
-Philippe Charnier <charnier@lirmm.fr>
-Rob Shady <rls@id.net>
-Rob Snow <rsnow@txdirect.net>
-Richard Stallman <rms@gnu.ai.mit.edu>
-Sascha Wildner <swildner@channelz.GUN.de>
-Scott Mace <smace@FreeBSD.org>
-Sean Eric Fagan <sef@kithrup.com>
-Serge V. Vakulenko <vak@zebub.msk.su>
-Stefan Esser <se@MI.Uni-Koeln.DE>
-Stephen McKay <syssgm@devetir.qld.gov.au>
-Steve Gerakines <steve2@genesis.tiac.net>
-Steven Wallace <swallace@ece.uci.edu>
-Tatsumi Hosokawa <hosokawa@mt.cs.keio.ac.jp>
-Terry Lee <terry@uivlsi.csl.uiuc.edu>
-Theo Deraadt <deraadt@fsa.ca>
-Thomas Gellekum <thomas@ghpc8.ihf.rwth-aachen.de>
-Tom Samplonius <tom@misery.sdf.com>
-Torbjorn Granlund <tege@matematik.su.se>
-Torsten Blum <torstenb@FreeBSD.ORG>
-Ugen J.S.Antsilevich <ugen@NetVision.net.il>
-Werner Griessl <werner@btp1da.phy.uni-bayreuth.de>
-Wolfgang Stanglmeier <wolf@kintaro.cologne.de>
-Wolfram Schneider <wosch@cs.tu-berlin.de>
-Yuval Yarom <yval@cs.huji.ac.il>
-Yves Fonk <yves@cpcoup5.tn.tudelft.nl>
-
-
-386BSD Patch kit patch contributors (in alphabetical order):
-
-Adam Glass <glass@postgres.berkeley.edu>
-Adrian Hall <adrian@ibmpcug.co.uk>
-Andrey A. Chernov <ache@astral.msk.su>
-Andrew Herbert <andrew@werple.apana.org.au>
-Andrew Moore <alm@netcom.com>
-Andy Valencia <ajv@csd.mot.com> <jtk@netcom.com>
-Arne Henrik Juul <arnej@Lise.Unit.NO>
-Bakul Shah <bvs@bitblocks.com>
-Barry Lustig <barry@ictv.com>
-Bob Wilcox <bob@obiwan.uucp>
-Branko Lankester
-Brett Lymn <blymn@mulga.awadi.com.AU>
-Charles Hannum <mycroft@ai.mit.edu>
-Chris G. Demetriou <cgd@postgres.berkeley.edu>
-Chris Torek <torek@ee.lbl.gov>
-Christoph Robitschko <chmr@edvz.tu-graz.ac.at>
-Daniel Poirot <poirot@aio.jsc.nasa.gov>
-Dave Burgess <burgess@hrd769.brooks.af.mil>
-Dave Rivers <rivers@ponds.uucp>
-David Dawes <dawes@physics.su.OZ.AU>
-David Greenman <davidg@Root.COM>
-Eric J. Haug <ejh@slustl.slu.edu>
-Felix Gaehtgens <felix@escape.vsse.in-berlin.de>
-Frank Maclachlan <fpm@crash.cts.com>
-Gary A. Browning <gab10@griffcd.amdahl.com>
-Geoff Rehmet <csgr@alpha.ru.ac.za>
-Goran Hammarback <goran@astro.uu.se>
-Guido van Rooij <guido@gvr.win.tue.nl>
-Guy Harris <guy@auspex.com>
-Havard Eidnes <Havard.Eidnes@runit.sintef.no>
-Herb Peyerl <hpeyerl@novatel.cuc.ab.ca
-Holger Veit <Holger.Veit@gmd.de>
-Ishii Masahiro, R. Kym Horsell
-J.T. Conklin <jtc@winsey.com>
-Jagane D Sundar < jagane@netcom.com >
-James Clark <jjc@jclark.com>
-James Jegers <jimj@miller.cs.uwm.edu>
-James W. Dolter
-James da Silva <jds@cs.umd.edu> et al
-Jay Fenlason <hack@datacube.com>
-Jim Wilson <wilson@moria.cygnus.com>
-Joerg Lohse <lohse@tech7.informatik.uni-hamburg.de>
-Jörg Wunsch <joerg_wunsch@uriah.heep.sax.de>
-John Dyson - <formerly dyson@ref.tfs.com>
-John Woods <jfw@eddie.mit.edu>
-Jordan K. Hubbard <jkh@whisker.hubbard.ie>
-Julian Elischer <julian@dialix.oz.au>
-Julian Stacey <stacey@guug.de> <fallback: <julian@meepmeep.pcs.com>>
-Karl Lehenbauer <karl@NeoSoft.com> <karl@one.neosoft.com>
-Keith Bostic <bostic@toe.CS.Berkeley.EDU>
-Ken Hughes
-Kent Talarico <kent@shipwreck.tsoft.net>
-Kevin Lahey <kml%rokkaku.UUCP@mathcs.emory.edu> <kml@mosquito.cis.ufl.edu>
-Marc Frajola <marc@dev.com>
-Mark Tinguely <tinguely@plains.nodak.edu> <tinguely@hookie.cs.ndsu.NoDak.edu>
-Martin Renters <martin@innovus.com>
-Michael Galassi <nerd@percival.rain.com>
-Mike Durkin <mdurkin@tsoft.sf-bay.org>
-Nate Williams <nate@bsd.coe.montana.edu>
-Nick Handel <nhandel@NeoSoft.com> <nick@madhouse.neosoft.com>
-Pace Willisson <pace@blitz.com>
-Paul Kranenburg <pk@cs.few.eur.nl>
-Paul Mackerras <paulus@cs.anu.edu.au>
-Paul Popelka <paulp@uts.amdahl.com>
-Peter da Silva <peter@NeoSoft.com>
-Phil Sutherland <philsuth@mycroft.dialix.oz.au>
-Ralf Friedl <friedl@informatik.uni-kl.de>
-Rick Macklem <root@snowhite.cis.uoguelph.ca>
-Robert D. Thrush <rd@phoenix.aii.com>
-Rodney W. Grimes <rgrimes@cdrom.com>
-Rog Egge <?>
-Sascha Wildner <swildner@channelz.GUN.de>
-Scott Burris <scott@pita.cns.ucla.edu>
-Scott Reynolds <scott@clmqt.marquette.mi.us>
-Sean Eric Fagan <sef@kithrup.com>
-Simon J Gerraty <sjg@melb.bull.oz.au> <sjg@zen.void.oz.au>
-Stephen McKay <syssgm@devetir.qld.gov.au>
-Terry Lambert <terry@icarus.weber.edu>
-Terry Lee <terry@uivlsi.csl.uiuc.edu>
-Warren Toomey <wkt@csadfa.cs.adfa.oz.au>
-Wiljo Heinen <wiljo@freeside.ki.open.de>
-William Jolitz <withheld>
-Wolfgang Solfrank <ws@tools.de>
-Wolfgang Stanglmeier <wolf@dentaro.GUN.de>
-Yuval Yarom <yval@cs.huji.ac.il>
-
-Last, but not least, the release engineer would like to thank:
- His Wife, for chocolate chip cookies, and some other things.
- The DGB project @ TFS, for patience and tolerance.
-
-$Id: CONTRIB.FreeBSD,v 1.23 1995/08/31 15:17:02 jkh Exp $
diff --git a/share/FAQ/Text/ESDI.FAQ b/share/FAQ/Text/ESDI.FAQ
deleted file mode 100644
index 8d86924..0000000
--- a/share/FAQ/Text/ESDI.FAQ
+++ /dev/null
@@ -1,187 +0,0 @@
- FreeBSD
- Using "Mature Technology" (MFM, ESDI) hard drives
-
-First, please read and make sure that you understand the "diskspace" FAQ.
-
-The term "partition" has become overloaded when referring to an area of a
-hard disk drive. I will use "slice" in this document to refer to an area
-which is a "partition" to DOS FDISK. This usage is consistent with most of
-current FreeBSD. I will use the word "partition" to refer to an area de-
-fined by a FreeBSD disklabel, of which there is one per FreeBSD slice. The
-FreeBSD partitions may contain filesystems, swap space, or be available as
-raw disk devices to applications.
-
-This document covers the steps you will need to perform before starting the
-FreeBSD installation and which are specific to these types of disk drives.
-
-1 Disk layout planning
-2 Disk installation (may already be done)
-3 Low-level formatting (may or may not be required)
-
-If your drive is installed and formatted properly, careful planning is all
-that you need to do.
-
-During the installation, there is only one special step that is required.
-This is also one place where the FreeBSD taxonomic convention breaks down
--- the assignment of slices is called "Partitioning" in the FreeBSD proce-
-dures at the time of this writing. During that step, when you assign the
-FDISK slices, be sure to specify that the bad144 lists should be created
-(the "B" command).
-
-1 Disk layout planning
-----------------------
-
-To be able to make the right decisions regarding the setup of slices for
-FreeBSD, you need to understand that the initial boot stages for FreeBSD
-rely on the ROM BIOS, but that the ROM BIOS is not used in any way once the
-FreeBSD kernel is loaded. After the kernel is loaded, it uses its own
-driver instead of the BIOS to access the disk.
-
-These older disks do not do automatic bad block management. Some con-
-trollers seem to do so, but this is a feature of the ROM BIOS on that con-
-troller, and therefore is not available once FreeBSD is running. Other
-controllers use a different method of bad sector handling (slipping), but
-this feature can also induce translations in the sectoring which will pre-
-vent successful installation. Do not use automatic sector mapping or sec-
-tor slipping, even if it is supported on the controller, for the same rea-
-sons that you cannot use a translated disk geometry.
-
-To be able to use these drives, the driver has to be able to substitute
-good sectors for the bad ones. The FreeBSD filesystems assume "perfect"
-disks, so the bad sector handling is done in the driver. The way this is
-done is that a few copies of the list of bad sectors is kept at the end of
-the slice. When a slice is opened, this list is read and kept in the driv-
-er. On every access to the drive, the list is consulted to see if a sub-
-stitute sector, also from the end of the slice, must be used rather than
-the sector that the filesystem or application is actually asking for. This
-list is called the bad144 list, which name comes from a Digital Equipment
-Corporation standard for keeping this information.
-
-There are three reasons that you would be required to use more than one
-FreeBSD slice on your disk, and all of them are more probable the larger
-your drive is.
-
-1) The FreeBSD portion of your drive will extend beyond cylinder 1023.
-2) The FreeBSD portion of your drive has (or is likely to have) more than
- 126 bad sectors.
-3) You need more than 7 filesystems for FreeBSD.
-
-It is not sufficient to make sure that the entire boot filesystem is inside
-of cylinder 1024, unless it just so happens that that filesystem occupies a
-flawless part of the disk. To be able to read the bad144 list during the
-boot process (via the ROM BIOS), the end of the slice must be within the
-first 1024 cylinders. There are also some boot managers, e.g. the OS/2
-boot manager, that require a bootable slice to be entirely below cylinder
-1024.
-
-The bad144 data format only allows for 126 sectors to be mapped. If your
-drive is large, it could easily have more than this many over its entire
-size. I have a 320 Mb drive which is unusually error-filled, but still
-within acceptable tolerances, and it has this problem (but it also has more
-than 1024 cylinders, so I'd have had to split it, anyway).
-
-The FreeBSD disk label has room for 8 partitions. It is not recommended
-that filesystems be placed on partitions b or c, even on non-booted slices,
-so that leaves 6 partitions within each slice which may contain filesys-
-tems. Older versions of FreeBSD did not support filesystems on partition d
-either, but the slice-handling capability has eliminated that restriction.
-It may be best to avoid using partition d if you can for compatibility pur-
-poses. The installation procedures skip from a to e for this reason.
-
-2 Disk installation
--------------------
-
-Physical installation is outside the scope of this document. Consult the
-documentation provided by your computer, controller, and disk drive ven-
-dor(s).
-
-3 Low-level formatting
-----------------------
-
-If you are starting from scratch, you may need to low-level format your
-drive(s). If you have been using your drive with the intended controller
-for DOS or some other system, and will not be changing the physical orien-
-tation of the drive, then you can skip this step. If the drive is new, if
-you are changing the physical orientation of the drive, or it has been used
-with a different controller, you may need to do the low-level format. Be
-aware that some drives have jumpers on them to help compensate for changes
-in physical orientation (horizontal, right side, or left side), but it is
-highly recommended that, if you are changing the physical orientation of
-the drive, you redo the low-level format. The "sag" of the disk head arma-
-ture and other effects of gravity are quite significant at the sizes of the
-bits and tracks on these drives. The greater the capacity of your drive,
-the more critical this becomes. With 10-40Mb MFM drives, you may get away
-with it. Beyond that, you are definitely rolling dice.
-
-The MFM drive format is standard, and a drive formatted on one manufacturer
-and model of controller should work just fine on another, but ESDI drive
-formats vary between manufacturers and sometimes even between models. A
-new ESDI drive (yes, they can still be found new in the box, years old), or
-one that has been in use on a different controller or in a different physi-
-cal orientation will definitely require reformatting.
-
-As the ESDI specification developed, the ability to put the error map in-
-formation (Manufacturer's Defect List, or MDL) on the drive was added.
-Since it was not known how the drive would be formatted, or even what the
-size of the data part of the sectors would be, each bad spot is expressed
-as bytes from the index and length of the bad area in bits. This informa-
-tion is recorded in a few different cylinders on each track and contains
-only information pertinent to the corresponding head. The most universal
-place for this information is in the last cylinder. Later ESDI drives sup-
-port a "phantom" cylinder at 0xfff (4095) where this information is kept --
-the actual location of this cylinder is beyond the "last" cylinder reported
-for data use. If your drive does not support cylinder 0xfff, or if your
-controller doesn't know how to use it, and if you wish to preserve the man-
-ufacturer's defect list, do not format the last cylinder of your drive.
-The format of the MDL is such that regular data operations will not work on
-a track containing that information.
-
-As a further caveat, it as been observed that some controllers hang if the
-MDL area is accessed for data use, while others simply report an error and
-go on with life. You will want to be careful to not include the MDL area
-in any FreeBSD slice, but you will want to be especially careful in case
-your controller is one of those that hangs if you miss.
-
-Now that you have decided how much of the drive to format, you can proceed
-with the actual format process. How this is done varies widely from con-
-troller to controller. For most of them, you need to jump into a special
-location in the controller ROM using the DOS DEBUG program. For a few,
-special software is provided on diskette for the controller. Because these
-procedures and the ways to initiate them vary so much, it is outside of the
-scope of this document to describe them. Consult the manufacturer's docu-
-mentation for this procedure.
-
-Many of the controllers have the ability to read and use the MDL. Even
-though you cannot use the controller's bad block mapping capability, which
-is supported through the BIOS, it may be beneficial to allow the controller
-to use this information during the format process. When the drive was
-tested at the factory, it was tested at the operating margins, not just op-
-timal conditions. Therefore, there may be entries in the MDL that would be
-missed by a run-of-the-mill data scan. If the controller is permitted to
-use the MDL during formatting, many of them will format the sector with a
-special flag set in the sector preamble to guarantee that that sector will
-show up as bad on a read. This is, in fact, the mechanism that some con-
-trollers use to handle bad sector mapping, though FreeBSD does not use the
-same mechanism. We can take advantage of this feature as a 'round about
-way to get the MDL represented in the bad144 list. Having the sectors
-which contain a bad spot formatted as bad will make certain that you don't
-use a sector where some data patterns may fail even though the initial scan
-passed that sector as OK. Even if the sector doesn't produce hard errors,
-it may cause soft (correctable) errors and time-consuming retries.
-
-Finally, FreeBSD
-----------------
-
-Having made your careful plans and preparations, you are ready to use
-FreeBSD on your MFM or ESDI disk drive. Don't forget to request bad block
-scanning during the "Partition" slice assignment, and you should be on your
-way to satisfying computing. Be prepared to allow time for the bad block
-scan to take place. Depending on a variety of system parameters, such as
-CPU speed, controller type, disk rotational and seek speeds, and so forth,
-this process will take anywhere from several minutes to hours. If you for-
-get to do the scan, it is likely that the installation will fail trying to
-make the filesystems, and if it should make the filesystems, it will surely
-fail when you start using them.
-
- John Lind, Starfire Consulting Services
-E-mail: john@starfire.MN.ORG USnail: PO Box 17247, Mpls MN 55417
diff --git a/share/FAQ/Text/FreeBSD.FAQ b/share/FAQ/Text/FreeBSD.FAQ
deleted file mode 100644
index a4d6301..0000000
--- a/share/FAQ/Text/FreeBSD.FAQ
+++ /dev/null
@@ -1,1307 +0,0 @@
-
- FreeBSD
- Frequently Asked Questions
- For Version 2.0
-
-Please mail all suggestions and additions to <FAQ@FreeBSD.ORG>
-
-
-Revision: $Id: FreeBSD.FAQ,v 1.4 1995/04/09 07:02:03 jkh Exp $
-
-All entries are assumed to be relevant to FreeBSD 2.0.
-Any entries with a <XXX> are under construction.
-
-
-Table of Contents
------------------
-
-0 Preface
-1 Installation
-2 Hardware Compatibility
-3 Commercial applications
-4 User Applications
-5 Miscellaneous Questions
-6 Kernel Configuration
-7 System Administration
-8 Networking
-9 Serial Communications
-
-
-
-0 Preface
----------
-
-Welcome to the FreeBSD 2.0 FAQ! This document tries to answer some of
-the most frequently asked questions about FreeBSD 2.0.
-If there's something you're having trouble with and you do not see it
-here, please send email to:
-
- <questions@FreeBSD.ORG>
-
-
-Some of the instructions here will also refer to auxiliary utilities
-in the /usr/src/share/FAQ directory. CDROM purchasers and net folks
-who've grabbed the FreeBSD 2.0 `srcdist' will have these files. If
-you don't have the source distribution, then you can either grab the
-whole thing from:
-
- ftp://ftp.FreeBSD.ORG/pub/FreeBSD/FreeBSD-current
-
-Or you can grab only those files you're interested in straight out of
-the FreeBSD-current distribution in:
-
- ftp://ftp.FreeBSD.ORG/pub/FreeBSD/FreeBSD-current/src
-
-0.1: What is FreeBSD?
-
-FreeBSD 2.0 is a UN*X type operating system based on U.C. Berkeley's
-4.4BSD-lite release for the i386 platform. It is also based indirectly
-on William Jolitz's port of U.C. Berkeley's Net/2 to the i386, 386BSD.
-There have been many additions and bug fixes made throughout
-the entire system, some of the highlights of which are:
-
- More robust and extensive PC device support
- System V-style IPC, messaging and semaphores
- Shared Libraries
- Much improved virtual memory code
- Better console driver support
- Network booting (diskless) support
- Yellow Pages support
- Full support of the PCI bus
- Loadable kernel modules
- Too many additional utilities and applications to mention
-
-<2.X-Current>
- Serial Console Support
- Merged VM/Buffer Cache
- On demand PPP
- Sync PPP
- Improved SCSI support
-
-
-0.2: What are the FreeBSD mailing lists, and how can I get on them?
-
-The following mailing lists are provided for FreeBSD users and
-developers. For more information, send to
-<majordomo@FreeBSD.ORG> and include a single line saying
-``help'' in the body of your message.
-
-announce: For announcements concerning FreeBSD. Low traffic. Subscribe!
-hackers: Useful for persons wishing to work on the internals.
-questions: General questions on FreeBSD - questioners and question-answerers
- please!
-bugs: Where bug reports should be sent.
-SCSI: Mailing list for SCSI developers.
-current: This list is for persons wishing to run FreeBSD-current
- and carries announcements and discussions on current. This list
- is *mandatory* if you run -current!
-security: Information on issues dealing with system security.
-platforms: Deals with ports to non-Intel platforms
-ports: Discussion of /usr/ports/???
-fs: Discussion of FreeBSD Filesystems
-hardware: Discussion on hardware requirements for FreeBSD.
-
-The FreeBSD-commit list has been broken up into groups dealing with different
-areas of interest. Please see the FreeBSD mailing list FAQ in:
-
- /usr/share/FAQ/mailing-list.FAQ
-
-
-0.3: What are the various FreeBSD news groups?
-
-There are two newsgroups currently dedicated to FreeBSD:
-
-comp.unix.bsd.freebsd.announce: For announcements
-comp.unix.bsd.freebsd.misc: General discussion
-
-
-The following newsgroups may also be of interest to general BSD
-enthusiasts:
-
-comp.unix.bsd: General BSD topics
-comp.os.386bsd.*: Ongoing, active FreeBSD discussions
- (probably only for a short time longer).
-
-
-
-1 Installation
---------------
-
-1.1: I want to install FreeBSD onto a SCSI disk that has more than
- 1024 cylinders. How do I do it?
-
-This depends. If you don't have DOS (or another operating system) on
-the system, you can just keep the drive in native mode and simply make
-sure that your root partition is below 1024 so the BIOS can boot the
-kernel from it. It you also have DOS/some other OS on the drive then
-your best bet is to find out what parameters that it thinks you have
-before installing FreeBSD. When FreeBSD's installation procedure
-prompts you for these values, you should then enter them rather than
-simply going with the defaults.
-
-There is a freely available utility distributed with FreeBSD called
-`pfdisk' (located in the tools/dos-tools subdirectory) which can be used for
-this purpose.
-
-
-1.2: When I boot FreeBSD it says ``Missing Operating System''.
-
-See question 1.2. This is classically a case of FreeBSD and DOS or
-some other OS conflicting over their ideas of disk geometry. You will
-have to reinstall FreeBSD, but obeying the instructions given above
-will almost always get you going.
-
-1.3: When I install the boot manager and try to boot FreeBSD for the
- first time, it just comes back with the boot manager prompt again.
-
-This is another symptom of the problem described in 1.2. Your
-BIOS geometry and FreeBSD geometry settings do not agree! If your
-controller or BIOS supports cylinder translation (often marked
-as ">1GB drive support"), try toggling its setting and reinstalling
-FreeBSD.
-
-1.4: I have an IDE drive with lots of bad blocks on it and FreeBSD doesn't
- seem to install properly.
-
-FreeBSD's bad block (bad144) handling is still not 100% (to put it
-charitably) and it must unfortunately be said that if you've got an
-IDE or ESDI drive with lots of bad blocks, then FreeBSD is probably
-not for you! That said, it does work on thousands of IDE based
-systems, so you'd do well to try it first before simply giving up.
-
-IDE drives are *supposed* to come with built-in bad-block remapping;
-if you have documentation for your drive, you may want to see if this
-feature has been disabled on your drive. However, ESDI, RLL, and
-ST-506 drives normally do not do this.
-
-1.5: I have 32MB of memory, should I expect any special problems?
-
-No. FreeBSD 2.0 comes with bounce buffers which allows your bus
-mastering controller access to greater than 16MB.
-
-1.6: Do I need to install the complete sources?
-
-In general, no. However, we would strongly recommend that you
-install, at a minimum, the `base' source kit, which includes several
-of the files mentioned here, and the `sys' (kernel) source kit, which
-includes sources for the kernel. There is nothing in the system which
-requires the presence of the sources to operate, however, except for
-the kernel-configuration program config(8). With the exception of the
-kernel sources, our build structure is set up so that you can
-read-only mount the sources from elsewhere via NFS and still be able
-to make new binaries. (Because of the kernel-source restriction, we
-recommend that you not mount this on /usr/src directly, but rather in
-some other location with appropriate symbolic links to duplicate the
-top-level structure of the source tree.)
-
-Having the sources on-line and knowing how to build a system with them
-will make it much easier for you to upgrade to future releases of
-FreeBSD.
-
-1.7: DES encryption software can not be exported from the United
- States. If I live outside the US, how can I encrypt passwords?
-
-If it is not absolutely imperative that you use DES style encryption,
-you can use FreeBSD's default encryption for even _better_ security,
-and with no export restrictions. FreeBSD 2.0's password default
-scrambler is now MD5 based, and is more CPU-intensive to crack
-with an automated password cracker than DES.
-
-Since the DES encryption algorithm cannot legally be exported from the US,
-non-US users should not download this software (as part of the secrdist)
-from US FTP sites.
-
-There is however a replacement libcrypt available, based on sources
-written in Australia by David Burren. This code is now available on
-some non-US FreeBSD mirror sites. Sources for the unencumbered
-libcrypt, and binaries of the programs which use it, can be obtained
-from the following FTP sites:
-
- South Africa: braae.ru.ac.za:/pub/FreeBSD/securedist/
- owl.und.ac.za (currently uncertain)
- Iceland: ftp.veda.is:/pub/crypt/FreeBSD/
-
-The non-US securedist can be used as a direct replacement for the
-encumbered US securedist. This securedist package is installed the
-same way as the US package (see installation notes for details). If
-you are going to install DES encryption, you should do so as soon as
-possible, before installing other software.
-
-Non-US users should please not download any encryption software from
-the USA. This can get the maintainers of the sites from which the
-software is downloaded into severe legal difficulties.
-
-A non-US distribution of Kerberos is also being developed, and current
-versions can generally be obtained by anonymous FTP from
-braae.ru.ac.za.
-
-There is a mailing list for the discussion of non-US encryption
-software. For more information, send an email message with a single
-line saying ``help'' in the body of your message to
-<majordomo@braae.ru.ac.za>.
-
-
-
-2 Hardware compatibility
-------------------------
-
-2.1: What kind of hard drives does FreeBSD run on?
-
-FreeBSD supports ST-506 (sometimes called ``MFM''), RLL, and ESDI
-drives, which are usually connected to WD-1002, WD-1003, or WD-1006
-controllers (although clones should also work).
-
-FreeBSD also supports IDE and SCSI hard drives.
-
-2.2: What SCSI controllers are supported?
-
-FreeBSD supports the following SCSI controllers:
-
-Adaptec AH-154x Series <ISA>
- AH-174x Series <EISA>
- AH-152x Series <ISA>
- Sound Blaster SCSI (AH-152x compat) <ISA>
- AH-2742/2842 Series <ISA/EISA>
- AH-2820/2822/2825 Series <VLB>
-Buslogic BT-445 Series <VLB> (but see section 1.5)
- BT-545 Series <ISA>
- BT-742 Series <EISA>
- BT-747 Series <EISA>
- BT-964 Series <PCI>
-Future Domain TMC-950 Series <ISA>
-PCI Generic NCR 53C810 based controllers <PCI>
-ProAudioSpectrum Zilog 5380 based controllers <ISA>
-Seagate ST-01/02 Series <ISA>
-UltraStor UH-14f Series <ISA>
- UH-24f Series <EISA>
- UH-34f Series <VLB>
-
-<2.X-Current Only>
-Western Digital WD7000 <ISA> <No scatter/gather>
-Adaptec AH-294x and aic7870 MB controllers <PCI>
-ProAudioSpectrum Trantor 130 based controllers <ISA>
-
-2.3: What CD-ROM drives are supported by FreeBSD?
-
-Any SCSI drive connected to a supported controller.
-Mitsumi LU002(8bit), LU005(16bit) and FX001D(16bit 2x Speed).
-
-<2.X-Current>
-Sound Blaster Non-SCSI CD-ROM
-
-FreeBSD does not support any of the ``IDE'' CD-ROM interfaces.
-All non-SCSI cards are known to be extremely slow compared to SCSI
-drives.
-
-2.4: What multi-port serial cards are supported by FreeBSD?
-
-AST/4
-ARNET/8
-BOCA 4/8/16 port cards.
-RISCom/8
-
-<2.X-Current>
-Cyclades 8/16 port <Alpha>
-
-Some unnamed clone cards have also been known to work,, especially those
-that claim to be AST compatible.
-Check the sio(4) man page to get more information on configuring such
-cards.
-
-
-2.5: Does FreeBSD support the AHA-2742/2842 SCSI adapters from Adaptec?
-
-Yes, though portions of the sources are currently GPL'd (that is to say,
-distributed under the GNU Public License), so be aware of the fact should
-you wish to distribute kernel binaries compiled with it - you MUST also
-provide the sources to the driver with the kernel image to stay legal
-with the GPL! This is easily enough done by simply including the contents
-of /usr/src/sys/gnu/{aic7770,misc} on whatever media you distribute the
-kernel.
-
-We are working to get the GPL restriction removed, but for now you should
-at least be aware of it.
-
-
-2.6: I have a Mumbleco bus mouse. Is it supported and if so, how do I set
- it up for XFree86?
-
-FreeBSD supports the Logitech and ATI Inport bus mice. You need to
-add the following line to the kernel config file and recompile for the
-Logitech and ATI mice:
-
- device mse0 at isa? port 0x23c tty irq6 vector mseintr
-
-
-2.7: I have a PS/2 mouse (`keyboard' mouse) [Alternatively: I have a
- laptop with a track-ball mouse]. How do I use it?
-
-
-
-2.8: What types of tape drives are supported under FreeBSD?
-
-FreeBSD supports SCSI, QIC-02 and QIC-40/80 (Floppy based) tape
-drives. This includes 8-mm (aka Exabyte) and DAT drives.
-
-
-2.9: What sound cards are supported by FreeBSD?
-
-FreeBSD supports the SoundBlaster, SoundBlaster Pro, Pro Audio
-Spectrum 16, AdLib and Gravis UltraSound sound cards. There is also
-limited support for MPU-401 and compatible MIDI cards. The
-SoundBlaster 16 and SoundBlaster 16 ASP cards are not yet supported.
-NOTE: This is only for sound! This driver does not support CD-ROMs,
-SCSI or joysticks on these cards.
-
-
-2.10: What network cards does FreeBSD support?
-
-There is support for the following cards:
-
-`ed' driver:
- NE2000 and 1000
- WD/SMC 8003, 8013 and Elite Ultra (8216)
- 3Com 3c503
- And clones of the above
-
-`de' driver:
- DEC and compatible PCI controllers.
-
-`le' driver:
- DEC LANCE ethernet based controllers.
-
-`ie' driver:
- AT&T EN100/StarLAN 10
- 3Com 3c507
-
-`is' driver:
- Isolan AT 4141-0
- Isolink 4110
-
-`ep' driver:
- 3com 3c509 (*)
-
-`el' driver:
- 3com 3c501 (*)
-
-`ze' driver:
- IBM PCMCIA credit card adapter
-
-`lnc' driver:
- Unknown Lance based (*)
-
-<2.X-Current>
-
-`cx' driver
- Cronyx/Sigma multiport Sync/Async (Cisco and PPP framing)
-
-`zp' driver
- 3Com PCMCIA Etherlink III
-
-Note: Drivers marked with (*) are known to have problems.
-
-Note: We also support TCP/IP over parallel lines. At this point we are
- incompatiable with other versions, but we hope to correct this in
- the near future.
-
-2.11: I have a 386/486sx/486SLC machine without a math co-processor.
- Will this cause me any problems?
-
-Generally no, but there are circumstances where you will take a hit,
-either in performance or accuracy of the math emulation code (see
-section 4.1). In particular, drawing arcs in X will be VERY slow. It
-is highly recommended that you lay out the $50 or so for a math
-co-processor; it's well worth it. NOTE: Some math co-processors are
-better than others. It pains us to say it, but nobody ever got fired
-for buying Intel. Unless you're sure it works with FreeBSD, beware of
-clones.
-
-2.12: What other devices does 2.X support?
-
-Here is a listing of drivers that do not fit into any of the above areas.
-
-b004.c Driver for B004 compatiable Transputer boards
-ctx.c Driver for CORTEX-I Frame grabber
-gpib.c Driver for National Instruments AT-GPIB and AT-GPIB/TNT boards
-pcaudio.c Driver for PC speakers to allow the playing of audio files
-tw.c Driver for the X-10 POWERHOUSE
-
-<2.X-Current>
-spigot.c Driver for the Creative Labs Video Spigot
-gsc.c Driver for the Genuis GS-4500 Hand scanner
-joy.c Driver for a joystick
-
-2.13: I am about to buy a new machine to run FreeBSD on and
- want an idea of what other people are running. Is there list
- of other systems anywhere?
-
-Yes. Please look at the file Systems.FAQ. This file
-is a listing of hardware that people are running in their machines.
-Please note, this is a raw listing of equipment that other users
-have sent in, and does not constitute any kind of endorsement by the
-FreeBSD Project.
-
-2.14: I have a lap-top with power management. Can FreeBSD take advantage
- of this?
-
-Yes it can on certain machines. Please look in the LINT kernel config
-file under APM.
-
-
-
-3 Commercial Applications
--------------------------
-
-Note: This section is still very sparse, though we're hoping, of
-course, that companies will add to it! :) The FreeBSD group has no
-financial interest in any of the companies listed here but simply
-lists them as a public service (and feels that commercial interest in
-FreeBSD can have very positive effects on FreeBSD's long-term
-viability). We encourage commercial software vendors to send their
-entries here for inclusion.
-
-
-3.1: Where can I get Motif for FreeBSD?
-
-You can purchase Motif 1.2.3 for FreeBSD (SWiM) from the ACC Bookstore,
-P.O. Box 3364, Westport CT. 06880. 1-800-546-7274 or FAX: 1-203-454-2582
-
-This software works flawlessly for for FreeBSD 1.1.5 but has shown
-one problem with 2.0 in that the "uil" program core dumps. This is
-apparently because of the way uil is installed, and it's quite possible
-that ACC will have a fixed version by the time you read this. No
-other compatibility problems with the programs or libraries have been
-found, and ACC can hardly be blamed for failing to work perfectly with
-a brand-new release they haven't even seen yet! :)
-
-
-3.2: Are there any commercial X servers for some of the high-end
- graphics cards like the Matrox or #9 I-128, or offering 8/16/24
- bit deep pallettes?
-
-Yes, X Inside Incorporated sells their Accelerated-X product for
-FreeBSD and other Intel based systems.
-
-This high performance X Server offers easy configuration, support
-for multiple concurrent video boards and is distributed in binary
-form only.
-
-Price is $99.50 (promotional price for Linux/FreeBSD version) for
-the 1.1 version, which is available now.
-
-This product is for FreeBSD 1.1 and runs under 2.0 with the FreeBSD 1.1
-compatibility libs (`compat1xdist').
-
-More info: URL http://www.xinside.com/
- or URL ftp://ftp.xinside.com/accelx/1.1/prodinfo.txt
- or email info@xinside.com
- or phone +1(303)384-9999
-
-
-3.3: Any other applications I might be interested in?
-
-RenderMorphics, Ltd. sells a high-speed 3D rendering package for
-FreeBSD called "Reality Lab" (tm). Send email to info@render.com
-or call: +44(0)71-251-4411 / FAX: +44(0)71-251-0939
-
-This package is also for FreeBSD 1.1.5 but has been tested and shown
-to run under FreeBSD 2.0 with the compat1xdist installed.
-
-Thanks must be extended to all of these companies for showing enough faith
-in FreeBSD to port their products to it. While we get no direct benefit
-from the sales of these products, the indirect benefits of FreeBSD
-proving itself to be a successful platform for such commercial interests
-will be immense! We wish these companies every measure of success, and
-can only hope that others are encouraged to follow suit.
-
-
-4 User Applications
--------------------
-
-4.1: I want to run X, how do I go about it?
-
-First, get the XFree86 distribution of X11R6 from XFree86.cdrom.com.
-The version you want for FreeBSD 2.X and later is XFree86 3.1.1. Follow
-the instructions for installation carefully. You may then wish to read
-the documentation for the ConfigXF86 tool, which assists you in
-configuring XFree86 for your particular graphics card/mouse/etc.
-
-You may also wish to investigate the Xaccel server, which is available
-at a very reasonable price. See section 3.2 for more details.
-
-4.2: I've been trying to run ghostscript on a 386 (or 486sx) with no
- math co-processor and I keep getting errors. What's up?
-
-You will need to add the alternate math emulator to your kernel, you do this
-by adding the following to your kernel config file and it will be compiled in.
-
-options GPL_MATH_EMULATE
-
-NOTE: You will need to remove the MATH_EMULATE option when you do this.
-
-
-4.2: I want all this neat software, but I haven't got the space or
- CPU power to compile it all myself. Is there any way of getting
- binaries?
-
-Yes. We support the concept of a `package', which is essentially a
-gzipped binary distribution with a little extra intelligence embedded
-in it for doing any custom installation work required. Packages can
-also be installed or deinstalled again easily without having to know
-the gory details. CDROM people will have a packages/ directory on
-their CD, others can get the currently available packages from:
-
- ftp://ftp.FreeBSD.ORG/pub/FreeBSD/packages
-
-Note that all ports may not be available as packages, and that new
-packages are constantly being added. It is always a good idea to
-check periodically to see which packages are available. A README file
-in the packages directory provides more details on the care and
-feeding of the package software, so no explicit details will be given
-here.
-
-
-
-
-5 Miscellaneous Questions
-----------------
-
-5.1: I've heard of something called FreeBSD-current. How do I run it, and
- where can I get more information?
-
-Read the file /usr/src/share/FAQ/current-policy.FAQ,
-it will tell you all you need to know.
-
-
-5.2: What is this thing called `sup', and how do I use it?
-
-SUP stands for Software Update Protocol, and was developed by CMU for
-keeping their development trees in sync. We use it to keep remote
-sites in sync with our central development sources.
-
-Unless you have direct internet connectivity, and don't care too much
-about the cost/duration of the sessions, you shouldn't use sup. For
-those "low/expensive-bandwidth" applications, we have developed CTM,
-see 5.6 for more about that.
-
-To use it, you need to have direct internet connectivity (not just
-mail or news). First, pick up the sup.tgz package from:
-
- ftp://ftp.FreeBSD.ORG/pub/FreeBSD/packages/sup.tgz
-
-Second, read the file /usr/src/share/FAQ/sup.FAQ.
-
-This file describes how to setup sup on your machine. You may also
-want to look at /usr/src/share/FAQ/extras/*.supfile, or you may grab updated
-supfiles from:
-
- ftp://ftp.FreeBSD.ORG//pub/FreeBSD/FAQ/extras
-
-which are a set of supfiles for supping from FreeBSD.ORG.
-
-
-5.3: How do I create customized installation disks that I can give
- out to other people at my site?
-
-The entire process of creating installation disks and source and
-binary archives is automated by various targets in
-/usr/src/etc/Makefile. The information there should be enough to get
-you started.
-
-5.4: How do I re-build my system without clobbering the existing
- installed binaries?
-
-If you define the environment variable DESTDIR while running `make
-world' or `make install', the newly-created binaries will be deposited
-in a directory tree identical to the installed one, rooted at
-${DESTDIR}. Some random combination of shared libraries modifications
-and program rebuilds can cause this to fail in `make world', however.
-
-
-5.5: When my system booted, it told me that ``(bus speed defaulted)''.
- What does that mean?
-
-The Adaptec 1542 SCSI host adapters allow the user to configure their
-bus access speed in software. Previous versions of the 1542 driver tried
-to determine the fastest usable speed and set the adapter to that. We
-found that this breaks some users' systems, so you now have to define
-the ``TUNE_1542''' kernel configuration option in order to have this
-take place. Using it on those systems where it works may make your
-disks run faster, but on those systems where it doesn't, your data could
-be corrupted.
-
-5.6: I would like to track changes to current and do not have net access.
- Is there any way besides downloading the whole tree?
-
-Yes, you can use the CTM facility. Check out the ctm.FAQ file or
- ftp://freefall.cdrom.com/pub/CTM/README
-for more information.
-
-5.7: How do I split up large binary files into smaller 240k files
- like the distribution does?
-
-Newer BSD based systems have a "-b" option to split that allows them to
-split files on arbitary byte bondaries.
-
-Here is an example from /usr/src/Makefile.
-bin-tarball:
- (cd ${DISTDIR}; \
- tar cf - . \
- gzip --no-name -9 -c | \
- split -b 240640 - \
- ${RELEASEDIR}/tarballs/bindist/bin_tgz.)
-
-
-<XXX> 5.8: I've had a couple of system panics and would like to be able
- browse the system dumps. The normal kernel is stripped and
- I don't want to run a bloated kernel. What can I do?
-
-5.9: I just got a Perl application and it's bombing looking for
- *.ph. Where is it?
-
-There was a minor SNAFU in the 2.0-R bindist and they got left out.
-If you have the source, you just have to do a "make install" from
-/usr/src/gnu/usr.bin/perl/lib and everything will be fine. Or you
-may ftp to phoenix-gw.gbdata.com and grab them from ~/pub/perl/libs.tar.gz.
-
-5.10: I've got this neato kernel extension I just know everyone will
- will want. How do I get it included into the distribution?
-
-Please take a look at the FAQ for submiting code to FreeBSD at:
-
- ftp://ftp.FreeBSD.ORG/pub/FreeBSD/FAQ/submitters.FAQ
-
-And thanks for the thought.
-
-
-6 Kernel Configuration
-----------------------
-
-6.0: Ok, so how DO I compile my own kernel, anyway?
-
-Before you can compile a kernel, you need either the complete srcdist
-or, at the minimum, the kerndist loaded on your system. This provides
-the necessary sources for building the kernel, as we have a policy of
-NOT shipping our kernels in linkable object form as most commercial
-UNIX vendors do. Shipping the source takes a bit more space, but it also
-means that you can refer to the actual kernel sources in case of difficulty
-or to further your understanding of what's *actually* happening.
-
-Anyway, to answer the question, once you have the kerndist or srcdist
-loaded, do this:
-
- 6.0.1: cd /usr/src/sys/i386/conf
- 6.0.2: cp GENERIC MYKERNEL
- 6.0.3: vi MYKERNEL
- 6.0.4: config MYKERNEL
- 6.0.5: cd ../../compile/MYKERNEL
- 6.0.6: make all
- 6.0.7: make install
- 6.0.8: reboot
-
-Step 6.0.2 may not be necessary if you already have a kernel configuration
-file from a previous release of FreeBSD 2.x. - simply bring your old one
-over and check it carefully for any drivers that may have changed boot
-syntax or been rendered obsolete.
-
-A good kernel config file to look into is LINT, which contains entries for
-*all* possible kernel options and documents them fairly well. The GENERIC
-kernel config file is used to build the initial release you probably loaded
-(unless you upgraded in-place) and contains entries for the most common
-configurations. It's a pretty good place to start from.
-
-If you don't need to make any changes to GENERIC, you can also skip step
-6.0.3, where you customize the kernel for your configuration. Step 6.0.7
-should only be undertaken if step 6.0.6 succeeds. This will copy
-the new kernel image to /kernel and BACK UP YOUR OLD ONE IN /kernel.old!
-It's very important to remember this in case the new kernel fails to work
-for some reason - you can still select /kernel.old at the boot prompt to
-boot the old one. When you reboot, the new kernel will boot by default.
-
-If the compile in 6.0.6 falls over for some reason, then it's recommended
-that you start from step 6.0.4 but substitute GENERIC for MYKERNEL. If you
-can generate a GENERIC kernel, then it's likely something in your special
-configuration file that's bad (or you've uncovered a bug!). If the build
-of the GENERIC kernel does NOT succeed, then it's very likely that your
-sources are somehow corrupted.
-
-Finally, if you need to see your original boot messages again to compile
-a new kernel that's better tailored to your hardware, try the `dmesg' command.
-It should print out all the boot-time messages printed by your old kernel,
-some of which may be quite helpful in configuring the new one.
-
-
-6.1: When I compile a kernel with multi-port serial code, it tells me
- that only the first port is probed and the rest skipped due to
- interrupt conflicts. How do I fix this?
-
-The problem here is that FreeBSD has code built-in to keep the kernel
-from getting trashed due to hardware or software conflicts. The way
-to fix this is to leave out the IRQ settings on other ports besides
-the first. Here is a example:
-
-#
-# Multiport high-speed serial line - 16550 UARTS
-#
-device sio2 at isa? port 0x2a0 tty irq 5 flags 0x501 vector siointr
-device sio3 at isa? port 0x2a8 tty flags 0x501 vector siointr
-device sio4 at isa? port 0x2b0 tty flags 0x501 vector siointr
-device sio5 at isa? port 0x2b8 tty flags 0x501 vector siointr
-
-
-6.2: FreeBSD is supposed to come with support for QIC-40/80 drives but
- when I look, I can't find it.
-
-You need to uncomment the following line in the generic config file
-(or add it to your config file), make the change to the fdc0 line shown,
-and recompile.
-
-controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr flags 0x1
- ^^^^^^^^^
-disk fd0 at fdc0 drive 0
-disk fd1 at fdc0 drive 1
-#tape ft0 at fdc0 drive 2
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-You will have a device called /dev/ft0, which you can write to through
-a special program to manage it called `ft' - see the man page on ft for
-further details. Versions previous to -current also had some trouble dealing
-wiht bad tape media; if you have trouble where ft seems to go back and forth
-over the same spot, try grabbing the latest version of ft from /usr/src/sbin/ft
-in current and try that.
-
-
-6.3: Does FreeBSD support IPC primitives like those in System V?
-
-Yes, FreeBSD supports System V-style IPC. This includes shared
-memory, messages and semaphores. You need to add the following lines
-to your kernel config to enable them.
-
-options SYSVSHM
-options "SHMMAXPGS=64" # 256Kb of sharable memory
-options SYSVSEM # enable for semaphores
-options SYSVMSG # enable for messaging
-
-Recompile and install.
-
-
-6.4: Will FreeBSD ever support other architectures?
-
-Several different groups have expressed interest in working on
-multi-architecture support for FreeBSD. If you are interested in
-doing so, please contact the developers at
-<FreeBSD-hackers@FreeBSD.ORG> for more information on our
-strategy for porting.
-
-
-6.5: I just wrote a device driver for a Foobar Systems, Inc.
- Integrated Adaptive Gronkulator card. How do I get the
- appropriate major numbers assigned?
-
-This depends on whether or not you plan on making the driver publicly
-available. If you do, then please send us a copy of the driver source
-code, plus the appropriate modifications to files.i386, a sample
-configuration file entry, and the appropriate MAKEDEV code to create
-any special files your device uses. If you do not, or are unable to
-because of licensing restrictions, then character major number 32 and
-block major number 8 have been reserved specifically for this purpose;
-please use them. In any case, we'd appreciate hearing about your
-driver on <FreeBSD-hackers@FreeBSD.ORG>.
-
-
-
-7 System Administration
------------------------
-
-7.1: How do I add a user easily? I read the man page and am more confused
- than ever! [Alternatively: I didn't read the man page, I never read
- man pages! :-) ]
-
-Use the adduser command.
-
-
-<XXX> 7.2: I'm trying to use my printer and keep running into problems. I tried
- looking at /etc/printcap, but it's close to useless. Any ideas?
-
-
-
-8 Networking
-------------
-
-
-8.2: I've heard that you can use a FreeBSD box as a dedicated network
- router - is there any easy support for this?
-
-Internet standards and good engineering practice prohibit us from
-providing packet forwarding by default in FreeBSD. You can enable
-this support by adding `options GATEWAY' to your kernel configuration
-file and recompiling. In most cases, you will also need to run a
-routing process to tell other systems on your network about your
-router; FreeBSD comes with the standard BSD routing daemon routed(8),
-or for more complex situations you may want to try GateD (available by
-FTP from gated.Cornell.edu) which supports FreeBSD as of 3_5Alpha7.
-
-It is our duty to warn you that, even when FreeBSD is configured in
-this way, it does not completely comply with the Internet standard
-requirements for routers; however, it comes close enough for ordinary
-usage.
-
-
-8.3: Does FreeBSD support SLIP and PPP?
-
-Yes. See the man pages for slattach(8) and/or pppd(8) if you're using
-FreeBSD to connect to another site. If you're using FreeBSD as a
-server for other machines, look at the man page for sliplogin(8).
-You may also want to take a look at the slip FAQ in:
- /usr/src/share/FAQ/Slip.FAQ
-
-8.4: How do I get my network set up? I don't see how to make my
- /dev/ed0 device!
-
-In the Berkeley networking framework, network interfaces are only
-directly accessible by kernel code. Please see the /etc/netstart file
-and the manual pages for the various network programs mentioned there
-for more information. If this leaves you totally confused, then you
-should pick up a book describing network administration on another
-BSD-related operating system; with few significant exceptions,
-administering networking on FreeBSD is basically the same as on SunOS
-4.0 or Ultrix.
-
-8.5: How do I get my 3C503 to use the other network port?
-
-Use `ifconfig ed0' to see whether the ALTPHYS flag is set, and then
-use either `ifconfig ed0 altphys' if it was off, or `ifconfig ed0
--altphys' if it was on.
-
-8.6: I'm having problems with NFS to/from FreeBSD and my Wuffotronics
- Workstation / generic NFS appliance, where should I look first?
-
-Certain PC network cards are better than others (to put it mildly) and
-can sometimes cause problems with network intensive applications like
-NFS. See /usr/src/share/FAQ/NFS.FAQ for more information on this
-topic.
-
-8.8: I want to enable IP multicast support on my FreeBSD box, how do I do it?
- [Alternatively: What the heck IS multicasting and what applications
- make use of it?]
-
-Multicast host operations are fully supported in FreeBSD 2.0 by default.
-If you want your box to run as a multicast router, you will need to load
-the ip_mroute_mod loadable kernel module and run mrouted.
-
-For more information:
-
-Product Description Where
---------------- ----------------------- ---------------------------------------
-faq.txt Mbone FAQ ftp.isi.edu:/mbone/faq.txt
-imm/immserv IMage Multicast ftp.hawaii.edu:/paccom/imm.src.tar.Z
- for jpg/gif images.
-nv Network Video. ftp.parc.xerox.com:
- /pub/net-reseach/exp/nv3.3alpha.tar.Z
-vat LBL Visual Audio Tool. ftp.ee.lbl.gov:
- /conferencing/vat/i386-vat.tar.Z
-wb LBL White Board. ftp.ee.lbl.gov:
- /conferencing/wb/i386-wb.tar.Z
-mmcc MultiMedia Conference ftp.isi.edu:
- Control program /confctrl/mmcc/mmcc-intel.tar.Z
-rtpqual Tools for testing the ftp.psc.edu:/pub/net_tools/rtpqual.c
- quality of RTP packets.
-vat_nv_record Recording tools for vat ftp.sics.se:archive/vat_nv_record.tar.Z
- and nv.
-
-
-
-9 Serial Communications
------------------------
-
-This section answers common questions about serial communications with
-FreeBSD.
-
-9.1: How do I tell if FreeBSD found my serial ports or modem cards?
-
-As the FreeBSD kernel boots, it will probe for the serial ports in
-your system for which the kernel was configured. You can either watch
-your system closely for the messages it prints or run the command
-
- dmesg | grep sio
-
-after your system's up and running.
-
-Here's some example output from the above command:
-
- sio0 at 0x3f8-0x3ff irq 4 on isa
- sio0: type 16550A
- sio1 at 0x2f8-0x2ff irq 3 on isa
- sio1: type 16550A
-
-This shows two serial ports. The first is on irq 4, is using port
-address 0x3f8, and has a 16550A-type UART chip. The second uses the
-same kind of chip but is on irq 3 and is at port address 0x2f8.
-Internal modem cards are treated just like serial ports---except that
-they always have a modem ``attached'' to the port.
-
-The GENERIC kernel includes support for two serial ports using the
-same irq and port address settings in the above example. If these
-settings aren't right for your system, or if you've added modem cards
-or have more serial ports than your kernel is configured for, just
-reconfigure your kernel. See section 7 of the FAQ for more details.
-
-9.2: How do I access the serial ports once FreeBSD is running?
-
-The third serial port, sio2 (known as COM3 in DOS), is on /dev/tty02
-for directly-connected devices, on /dev/cuaa2 for dial-out devices,
-and on /dev/ttyd2 for dial-in devices. What's the difference between
-these three classes of devices?
-
-You use ttyXX for directly-connected or hardwired devices, like
-printers or terminals.
-
-In place of ttyXX, you can use the pair of devices cuaaX and ttydX.
-You use ttydX for dial-ins. The ttydX device acts like the ttyXX
-device, but it also uses the modem control lines. When opening
-/dev/ttydX in blocking mode, a process will wait for the corresponding
-cuaaX device to become inactive, and then wait for the carrier detect
-line to go active. When you open the cuaaX device, it makes sure the
-serial port isn't already in use by the ttydX device. If the port's
-available, it ``steals'' it from the ttydX device. Also, the cuaaX
-device doesn't care about carrier detect. With this scheme and an
-auto-answer modem, you can have remote users log in and you can still
-dialout with the same modem and the system will take care of all the
-conflicts.
-
-9.3: How do I configure the kernel for my multiport serial card?
-
-Again, the section on kernel configuration provides information about
-configuring your kernel. For a multiport serial card, place an sio
-line for each serial port on the card in the kernel configuration
-file. But place the irq and vector specifiers on only one of the
-entries. All of the ports on the card should share one irq. For
-consistency, use the last serial port to specify the irq. Also,
-specify the COM_MULTIPORT option.
-
-The following example is for an AST 4-port serial card on irq 7:
-
- options "COM_MULTIPORT"
- device sio4 at isa? port 0x2a0 tty flags 0x781
- device sio5 at isa? port 0x2a8 tty flags 0x781
- device sio6 at isa? port 0x2b0 tty flags 0x781
- device sio7 at isa? port 0x2b8 tty flags 0x781 irq 7 vector siointr
-
-The flags indicate that the master port has minor number 7 (0x700),
-diagnostics enabled during probe (0x080), and all the ports share an
-irq (0x001).
-
-9.4: I have two multiport serial cards that can share irqs. Can
- FreeBSD handle this?
-
-Not yet. You'll have to use a different irq for each card.
-
-9.5: What's the difference between tty01, ttyi01, and ttyl01? Or,
- how can I set the default serial parameters for a port?
-
-The ttyXX (or cuaaX or ttydX) device is the regular device you'll want
-to open for your applications. When a process opens the device, it'll
-have a default set of terminal I/O settings. You can see these
-settings with the command
-
- stty -a -f /dev/tty01
-
-When you change the settings to this device, the settings are in
-effect until the device is closed. When it's reopened, it goes back
-to the default set. To make changes to the default set, you can open
-and adjust the settings of the ``initial state'' device. For example,
-to turn on CLOCAL mode, 8 bits, and XON/XOFF flow control by default
-for tty05, do:
-
- stty -f /dev/ttyi05 clocal cs8 ixon ixoff
-
-A good place to do this is in /etc/rc.serial. Now, an application
-will have these settings by default when it opens tty05. It can still
-change these settings to its liking, though.
-
-You can also prevent certain settings from being changed by an
-application by making adjustments to the ``lock state'' device. For
-example, to lock the speed of tty05 to 57600 bps, do
-
- stty -f /dev/ttyl05 57600
-
-Now, an application that opens tty05 and tries to change the speed of
-the port will be stuck with 57600 bps.
-
-Naturally, you should make the initial state and lock state devices
-writable only by root. The MAKEDEV script does NOT do this when it
-creates the device entries.
-
-9.6: How can I enable dialup logins on my modem?
-
-So you want to become an Internet service provider, eh? First, you'll
-need one or more modems that can autoanswer. Your modem will need to
-assert carrier-detect when it detects a carrier and not assert it all
-the time. It will need to hang up the phone and reset itself when the
-data terminal ready (DTR) line goes from on to off. It should
-probably use RTS/CTS flow control or no local flow control at all.
-Finally, it must use a constant speed between the computer and itself,
-but (to be nice to your callers) it should negotiate a speed between
-itself and the remote modem.
-
-For many Hayes command-set--compatible modems, this command will
-make these settings and store them in nonvolatile memory:
-
- AT &C1 &D3 &K3 &Q6 S0=1 &W
-
-See 9.10 below for information on how to make these settings without
-resorting to an MS-DOS terminal program.
-
-Next, make an entry in /etc/ttys for the modem. This file lists all
-the ports on which the operating system will await logins. Add a line
-that looks something like this:
-
- ttyd1 "/usr/libexec/getty std.57600" dialup on insecure
-
-This line indicates that the second serial port (/dev/ttyd1) has a
-modem connected running at 57600 bps and no parity (std.57600, which
-comes from the file /etc/gettytab). The terminal type for this port
-is ``dialup.'' The port is ``on'' and is ``insecure''---meaning root
-logins on the port aren't allowed. For dialin ports like this one,
-use the ttydX entry.
-
-It's common practice to use ``dialup'' as the terminal type. Many
-users set up in their .profile or .login files a prompt for the actual
-terminal type if the starting type is dialup. The example shows the
-port as insecure. To become root on this port, you have to login as a
-regular user, then ``su'' to root. If you use ``secure'' then root
-can login in directly.
-
-After making modifications to /etc/ttys, you need to send a hangup or
-HUP signal to the init process:
-
- kill -1 1
-
-This forces the init process to reread /etc/ttys. The init process
-will then start getty processes on all ``on'' ports. You can find out
-if logins are available for your port by typing
-
- ps -ax | grep '[t]tyd1'
-
-You should see something like:
-
- 747 ?? I 0:00.04 /usr/libexec/getty std.57600 ttyd1
-
-9.7: How can I make my spare computer a dumb terminal connected to my
- FreeBSD box?
-
-If you're using another computer as a terminal into your FreeBSD
-system, get a null modem cable to go between the two serial ports. If
-you're using an actual terminal, see its accompanying instructions.
-
-Then, modify /etc/ttys, like above. For example, if you're hooking up
-a WYSE-50 terminal to the fifth serial port, use an entry like this:
-
- tty04 "/usr/libexec/getty std.38400" wyse50 on secure
-
-This example shows that the port on /dev/tty04 has a wyse50 terminal
-connected at 38400 bps with no parity (std.38400 from /etc/gettytab)
-and root logins are allowed (secure). For directly-connected
-terminals, use the ttyXX entry.
-
-9.8: Why can't I run tip or cu?
-
-On your system, the programs tip and cu are probably executable only
-by uucp and group dialer. You can use the group dialer to control who
-has access to your modem or remote systems. Just add yourself to
-group dialer.
-
-Alternatively, you can let everyone on your system run tip and cu by
-typing:
-
- chmod 4511 /usr/bin/tip
-
-You don't have to run this command for cu, since cu is just a hard
-link to tip.
-
-9.9: My stock Hayes modem isn't supported---what should I do?
-
-Actually, the man page for tip is out of date. There is a generic
-Hayes dialer already built in. Just use ``at=hayes'' in your
-/etc/remote file.
-
-The Hayes driver isn't smart enough to recognize some of the advanced
-features of newer modems---messages like BUSY, NO DIALTONE, or CONNECT
-115200 will just confuse it. You should turn those messages off when
-you use tip (using ATX0&W).
-
-Also, the dial timeout for tip is 60 seconds. Your modem should use
-something less, or else tip will think there's a communication
-problem. Try ATS7=45&W.
-
-9.10: How am I expected to enter these AT commands without
- resorting to some DOS-based terminal program?
-
-Make what's called a ``direct'' entry in your /etc/remote file. For
-example, if your modem's hooked up to the first serial port,
-/dev/cuaa0, then put in the following line:
-
- cuaa0:dv=/dev/cuaa0:br#19200:pa=none
-
-Use the highest bps rate your modem supports in the br capability.
-Then, type ``tip cuaa0'' and you'll be connected to your modem.
-
-If there is no /dev/cuaa0 on your system, do this:
-
- cd /dev
- MAKEDEV cuaa0
-
-9.11: Why doesn't the @ sign for the phone number capability work?
-
-The @ sign in the pn capability tells tip to look in /etc/phones for a
-phone number. But the @ sign is also a special character in
-capability files like /etc/remote. Escape it with a backslash:
-``pn=\@''.
-
-9.12: How can I dial a phone number on the command line?
-
-Put what's called a ``generic'' entry in your /etc/remote file. For
-example:
-
- tip115200|Dial any phone number at 115200 bps:\
- :dv=/dev/cuaa0:br#115200:at=hayes:pa=none:du:
- tip57600|Dial any phone number at 57600 bps:\
- :dv=/dev/cuaa0:br#57600:at=hayes:pa=none:du:
-
-Then you can things like ``tip -115200 5551234''. If you prefer cu
-over tip, use a generic cu entry:
-
- cu115200|Use cu to dial any number at 115200bps:\
- :dv=/dev/cuaa1:br#57600:at=hayes:pa=none:du:
-
-and type ``cu 5551234 -s 115200''.
-
-9.13: Great---but how can I do that without having to specify the bps
- rate on the command line?
-
-Put in an entry for tip1200 or cu1200, but go ahead and use whatever
-bps rate is appropriate with the br capability. tip thinks a good
-default is 1200 bps which is why it looks for a ``tip1200'' entry.
-You don't have to use 1200 bps, though.
-
-9.14: I want separate entries for various hosts I access through a
- terminal server, but I don't want to type ``CONNECT <host>''
- each time once I'm connected. Can tip do that for me?
-
-Yes. Use the cm capability. For example, these entries in
-/etc/remote:
-
- pain|pain.deep13.com|Forrester's machine:\
- :cm=CONNECT pain\n:tc=deep13:
- muffin|muffin.deep13.com|Frank's machine:\
- :cm=CONNECT muffin\n:tc=deep13:
- deep13:Gizmonics Institute terminal server:\
- :dv=/dev/cuaa2:br#38400:at=hayes:du:pa=none:pn=5551234:
-
-will let you type ``tip pain'' or ``tip muffin'' to connect to the
-hosts pain or muffin; and ``tip deep13'' to get to the terminal
-server.
-
-9.15: My university has 42 billion students but only 4 modem lines.
- Can tip automatically try each line?
-
-Sure. Make an entry for your university in /etc/remote and use \@ for
-the pn capability:
-
- big-university:\
- :pn=\@:tc=dialout
- dialout:\
- :dv=/dev/cuaa3:br#9600:at=courier:du:pa=none:
-
-Then, list the phone numbers for the university in /etc/phones:
-
- big-university 5551111
- big-university 5551112
- big-university 5551113
- big-university 5551114
-
-tip will try each one in the listed order, then give up. If you want
-to keep retrying, run tip in a while loop.
-
-9.16: How come I have to hit CTRL+P twice to send CTRL+P once?
-
-CTRL+P is the default ``force'' character, used to tell tip that the
-next character is literal data. You can set the force character to
-any other character with the ~s escape, which means ``set a
-variable.''
-
-Type ``~sforce=<single-char>'' followed by a newline. <single-char>
-is any single character. If you leave out <single-char>, then the
-force character is the nul character, which you can get by typing
-CTRL+2 or CTRL+SPACE. A pretty good value for <single-char> is
-SHIFT+CTRL+6, which I've seen only used on some terminal servers.
-
-You can have the force character be whatever you want by specifying
-the following in your $HOME/.tiprc file:
-
- force=<single-char>
-
-9.17: Suddenly everything I type is all UPPER CASE. What gives?
-
-You must've pressed CTRL+A, tip's ``raise character,'' specially
-designed for people with broken caps-lock keys. Use ~s as above and
-set the variable ``raisechar'' to something reasonable. In fact, you
-can set it to the same as the force character, if you never expect to
-use either of these features.
-
-Here's a sample .tiprc file perfect for Emacs users who need to type
-CTRL+2 and CTRL+A a lot:
-
- force=^^
- raisechar=^^
-
-The ^^ is SHIFT+CTRL+6.
-
-9.18: How can I do file transfers with tip?
-
-If you're talking to another UNIX system, you can send and receive
-files with ~p (put) and ~t (take). These commands run ``cat'' and
-``echo'' on the remote system to accept and send files. The syntax
-is:
-
- ~p <local-file> [<remote-file>]
- ~t <remote-file> [<local-file>]
-
-There's no error checking, so you probably should use another
-protocol, like zmodem.
-
-9.19: Okay, how can I run zmodem with tip?
-
-To receive files, start the sending program on the remote end. Then,
-type ``~C rz'' to begin receiving them locally.
-
-To send files, start the receiving program on the remote end. Then,
-type ``~C sz <files>'' to send them to the remote system.
-
-
-
-NOTE: Anyone wishing to submit a FAQ entry on how to get tip and cu working
- would have it much appreciated! We all use Kermit over here! :-)
-
------------------------------------------------------------------------------
-If you see a problem with this FAQ, or wish to submit an entry, please
-mail us at <FreeBSD-FAQ@FreeBSD.ORG>. We appreciate your
-feedback, and cannot make this a better FAQ without your help!
-
-
- FreeBSD Core Team
-
------------------------------------------------------------------------------
-
-ACKNOWLEDGMENTS:
-
-Ollivier Robert - FreeBSD FAQ maintenance man
-Gary Clark II - Ex-FreeBSD FAQ maintenance man
-Jordan Hubbard - Janitorial services (I don't do windows)
-Garrett Wollman - Networking and formatting
-Robert Oliver, Jr. - Ideas and dumb questions (That made me think)
-Jim Lowe - Multicast information
-The FreeBSD Team - Kvetching, moaning, submitting data
-
-And to any others we've forgotten, apologies and heartfelt thanks!
-
diff --git a/share/FAQ/Text/HW.TROUBLE b/share/FAQ/Text/HW.TROUBLE
deleted file mode 100644
index 86e3e42..0000000
--- a/share/FAQ/Text/HW.TROUBLE
+++ /dev/null
@@ -1,58 +0,0 @@
-$Id: HW.TROUBLE,v 1.3 1995/03/01 06:43:12 phk Exp $
-
-This file lists hardware, which doesn't do what it should do.
-
-Due to the nature of FreeBSD, we do not have the resources to test all
-possible kinds of hardware. We do however every now and then find, buy
-or hear about hardware which doesn't work with FreeBSD or in general.
-
-This is that list.
-
-To be added to this list, a piece of hardware has to:
- A: not do what it claims.
-or
- B: not do what common sense would expect it to.
-
-Only if performance claims are wildly of the mark will it be listed here.
-
-All entries must have a date and a mail-address associated with them, to
-reflect when and by whom they were added.
-For multifunctional devices, please indicate if other parts of the device
-work OK, or are untested.
-For mutual incompabilities, list both devices.
-For SCSI and IDE-devices, list the string seen on boot of FreeBSD, if
-possible, and trade name.
-Infer format from other entries, Keep sorted by first line.
-
-Thankyou.
-
----
-Controller, Data Technology DTC2280, "PC/AT Super I/O Card"
-IDE interface can be set to secondary address, but doesn't work there. Suspect
-Interrupt isn't moved along. Works fine on primary address. Other parts of
-card not tested.
-19940828 phk@freefall.cdrom.com
----
-IDE-disk, <WDC AC2540H>, "Western Digital Caviar 2540"
-IDE-disk, <Maxtor 7345 AT>, "Maxtor 7345"
-Cannot coexist on the same IDE-controller.
-Jumpers not exhaustively experimented with, as neither of the companies
-make sufficient information available. Disk works fine when alone on
-IDE-controller.
-19940828 phk@freefall.cdrom.com
----
-IDE-disk, <AC31000> "Western Digital Caviar 31000"
-IDE-disk, <ST3550A> "Seagate ST3550A"
-Western Digital AC31000 (Caviar 31000) 1080 meg IDE drive will not
-co-exist with a Seagate ST3550A.
-The Seagate as master causes a constant drive light and system lockup,
-The WD will work fine alone or as master, but the Seagate is inaccessable
-if configured as slave in this config.
-19950221 jbryant@server.iadfw.net
-
-On Packard Bell computers with a BIOS Reference ID of less than 25, Packard
-Bell will replace the BIOS at no charge. I waited, I got the bios, popped
-the case, popped the chip, put in the new, and plugged in the drives. It
-works. WD as master, seagate as slave.
-19950228 jbryant@server.iadfw.net
----
diff --git a/share/FAQ/Text/MIRROR.SITES b/share/FAQ/Text/MIRROR.SITES
deleted file mode 100644
index 96ed2ec..0000000
--- a/share/FAQ/Text/MIRROR.SITES
+++ /dev/null
@@ -1,145 +0,0 @@
- Mirror Sites
- For FreeBSD 2.0 and later
-
-$Id: MIRROR.SITES,v 1.16 1995/08/05 02:04:18 jkh Exp $
-
-The latest versions of FreeBSD (2.0 or later) are being mirrored at the
-following locations:
-
-Country Site and Maintainer
-======= =========================================================
-Australia ftp://ftp.physics.usyd.edu.au/FreeBSD
- <dawes@xfree86.org>
-
-Australia ftp://minnie.cs.adfa.oz.au/FreeBSD
- <wkt@dolphin.cs.adfa.oz.au>
-
-Canada ftp://ftp.synapse.net/contrib/FreeBSD
- <evanc@synapse.net>
-
-Finland ftp://nic.funet.fi/pub/unix/FreeBSD
- <count@nic.funet.fi>
-
-France ftp://ftp.ibp.fr/pub/FreeBSD
- <Remy.Card@ibp.fr>
-
-Germany ftp://ftp.fb9dv.uni-duisburg.de/pub/unix/FreeBSD
- <ftp@ftp.fb9dv.uni-duisburg.de>
-
-Germany ftp://gil.physik.rwth-aachen.de/pub/FreeBSD
- <kuku@gil.physik.rwth-aachen.de>
-
-Germany ftp://ftp.uni-paderborn.de/freebsd
- <ftp@uni-paderborn.de>
-
-Germany ftp://ftp.leo.org/pub/comp/os/bsd/FreeBSD
- <bsd@leo.org>
-
-Germany ftp://ftp.tu-dresden.de/pub/soft/unix/bsd/FreeBSD
- <pdsowner@rcs1.urz.tu-dresden.de>
-
-Ireland ftp://ftp.internet-eireann.ie/pub/FreeBSD
- <ftpadmin@internet-eireann.ie>
-
-Israel ftp://orgchem.weizmann.ac.il/pub/FreeBSD
- <serg@klara.weizmann.ac.il>
-
-Hong Kong ftp://ftp.hk.super.net/pub/FreeBSD
- <ftp-admin@HK.Super.NET>
-
-Korea ftp://ftp.cau.ac.kr/pub/FreeBSD
- <ftpadm@ftp.cau.ac.kr>
-
-Netherlands ftp://ftp.nl.net/pub/os/FreeBSD
- <archive@nl.net>
-
-Russia ftp://ftp.kiae.su/FreeBSD
- <ftp@ftp.kiae.su>
-
-Sweden ftp://ftp.luth.se/pub/FreeBSD
- <ragge@ludd.luth.se>
-
-Taiwan ftp://NCTUCCCA.edu.tw/Operating-Systems/FreeBSD
- <freebsd@NCTUCCCA.edu.tw>
-
-Taiwan ftp://netbsd.csie.nctu.edu.tw/pub/FreeBSD
- <ftp@netbsd.csie.nctu.edu.tw>
-
-Thailand ftp://ftp.nectec.or.th/pub/FreeBSD
- <ftpadmin@ftp.nectec.or.th>
-
-USA ftp://gatekeeper.dec.com/pub/BSD/FreeBSD
- <hubbard@gatekeeper.dec.com>
-
-USA ftp://ftp.cybernetics.net/pub/FreeBSD
- <michael@Cybernetics.NET>
-
-USA ftp://ftp.neosoft.com/systems/FreeBSD
- <smace@NeoSoft.COM>
-
-USA ftp://kryten.atinc.com/pub/FreeBSD
- <jmb@kryten.atinc.com>
-
-USA ftp://ftp.dataplex.net/pub/FreeBSD
- <rkw@dataplex.net>
-
-USA ftp://ftp.cps.cmich.edu/pub/ftp.freebsd.org
- <ftpadmin@cps.cmich.edu>
-
-USA ftp://ftp.cslab.vt.edu/pub/FreeBSD
- <ftp@ftp.cslab.vt.edu>
-
-Japan ftp://ftp.tokyonet.ad.jp/pub/FreeBSD
- <ftpadmin@TokyoNet.AD.JP>
-
-Japan ftp://ftp.tut.ac.jp/FreeBSD
- Ashida Hiroyuki <ashida@ftp.tut.ac.jp>
-
-Japan ftp://ftp.sra.co.jp/pub/os/FreeBSD
- <ftp-admin@sra.co.jp>
-
-Japan ftp://ftp.ee.uec.ac.jp/pub/os/mirror/ftp.freebsd.org
- <ftp-admin@ftp.ee.uec.ac.jp>
-
-Japan ftp://ftp.mei.co.jp/free/PC-UNIX/FreeBSD
- TANIGUCHI Syuuhei <tanig@isl.mei.co.jp>
-
-Japan ftp://ftp.waseda.ac.jp/pub/FreeBSD
- <ftp-admin@waseda.ac.jp>
-
-Japan ftp://ftp.pu-toyama.ac.jp/pub/FreeBSD
- Yoshihiko USUI <usui@pu-toyama.ac.jp>
-
-Japan ftp://ftpsv1.u-aizu.ac.jp/pub/os/FreeBSD
- <ftp-admin@u-aizu.ac.jp>
-
-UK ftp://src.doc.ic.ac.uk/packages/unix/FreeBSD
- <wizards@doc.ic.ac.uk>
-
-UK ftp://unix.hensa.ac.uk/pub/walnut.creek/FreeBSD
- <archive-admin@unix.hensa.ac.uk>
-
-UK ftp://ftp.demon.co.uk/pub/BSD/FreeBSD
- <uploads@demon.net>
-
----
-
-The latest versions of export-restricted code for FreeBSD (2.0C or later)
-(eBones and secure) are being made available at the following locations.
-
-If you are outside the U.S. or Canada, please get secure (DES) and
-eBones (Kerberos) from one of the following foreign distribution sites:
-
-Country Site and Maintainer
-======= ========================================================
-South Africa ftp://skeleton.mikom.csir.co.za/pub/FreeBSD
- Mark Murray <mark@grondar.za>
-
-South Africa ftp://storm.sea.uct.ac.za/pub/FreeBSD
- Shaun Courtney <ftp@storm.sea.uct.ac.za>
-
-Brazil ftp://ftp.iqm.unicamp.br/pub/FreeBSD
- Pedro A M Vazquez <vazquez@iqm.unicamp.br>
-
-Finland ftp://nic.funet.fi/pub/unix/FreeBSD/eurocrypt
- <count@nic.funet.fi>
diff --git a/share/FAQ/Text/README b/share/FAQ/Text/README
deleted file mode 100644
index 2e7293b..0000000
--- a/share/FAQ/Text/README
+++ /dev/null
@@ -1,104 +0,0 @@
- -----------------------------------------
- FreeBSD 2.0.5 --- RELEASE Version , ,
- ----------------------------------------- /( )`
- \ \___ / |
-Welcome to the 2.0.5 release of FreeBSD! 2.0.5 is /- _ `-/ '
-an interim release of FreeBSD, filling a much needed (/\/ \ \ /\
-gap during the period between 2.0R (which was / / | ` \
-released in Nov 94) and 2.1R, which will be O O ) / |
-released in late July of '95. FreeBSD 2.0.5 `-^--'`< '
-contains many substantial improvements from 2.0R, (_.) _ ) /
-not least of which is greater stability (by `.___/` /
-a considerable margin), dozens of new `-----' /
-features and a greatly enhanced <----. __ / __ \
-installation program. See the release <----|====O)))==) \) /====
-notes for more details on what's new in <----' `--' `.__,' \
-FreeBSD 2.0.5! | |
- \ / /\
- ______( (_ / \______/
- ,' ,-----' |
- `--{__________)
-
-
-What is FreeBSD? FreeBSD is an operating system based on 4.4 BSD Lite
-for Intel, AMD, Cyrix or NexGen "x86" based PC hardware. It works
-with a very wide variety of PC peripherals and configurations and can
-be used for everything from software development to Internet Service
-Provision; the busiest site on the Internet, ftp.cdrom.com, is a
-FreeBSD machine!
-
-This release of FreeBSD contains everything you need to run such a
-system, plus full source code for everything. With the source
-distribution installed you can literally recompile the entire system
-from scratch with one command, making it ideal for students,
-researchers or folks who simply want to see how it all works.
-
-A large collection of 3rd party ported software (the "ports
-collection") is also provided to make it easier for you to obtain and
-install all your favorite traditional UNIX utilities for FreeBSD.
-Over 270 ports, comprising everything from the EMACS editor to the
-lisp language, make FreeBSD a powerful and comprehensive operating
-system that rivals that of many large workstations for general utility
-and power.
-
-
-For more documentation on this system, it is recommended that you
-purchase the 4.4BSD Document Set from O'Reilly Associates and the
-USENIX Association, ISBN 1-56592-082-1. We have no connection with
-O'Reilly, we're just satisfied customers!
-
-You may also wish to read the HARDWARE GUIDE *before* proceeding any
-further with the installation. Configuring PC hardware for anything
-other than DOS/Windows (which don't actually make very significant
-demands on the hardware) is actually quite a bit harder than it looks,
-and if you think you understand PCs then you clearly haven't been
-using them for long enough! :) This guide will give you some tips on
-how to configure your hardware and what symptoms to watch for in case
-of trouble. This guide is available in the Documentation menu of the
-FreeBSD boot floppy.
-
-DISCLAIMER: While FreeBSD does its best to safeguard against accidental
-loss of data, it's still more than possible to WIPE OUT YOUR ENTIRE DISK
-with this installation! Please do not proceed to the final FreeBSD
-installation menu unless you've adequately backed up any important
-data first! We really mean it!
-
-Technical comments on this release should be sent to:
-
- hackers@FreeBSD.org
-
-
-Bug reports should be sent using the `send-pr' command, if you were
-able to get the system installed, otherwise to:
-
- bugs@FreeBSD.org
-
-Please be sure to indicate WHICH VERSION of FreeBSD you're running in
-any bug reports!
-
-
-General questions should be sent to:
-
- questions@FreeBSD.org
-
-Please have patience if your questions are not answered right away -
-this is an especially busy time for us, and our volunteer resources
-are often strained to the limit! Bug reports submitted with the
-send-pr command are logged and tracked in our bugs database, and
-you'll be kept informed of any changes in status during the life of
-the bug (or feature request).
-
-Our WEB site, http://www.freebsd.org, is also a very good source for
-updated information and provides a number of advanced documentation
-facilities. You may use the BSDI version of Netscape for browsing the
-World Wide Web directly from FreeBSD.
-
-You may also wish to look in /usr/share/FAQ and /usr/share/doc for
-further information on the system.
-
-
-Thanks for reading all of this, and we sincerely hope you enjoy this
-release of FreeBSD!
-
- Jordan Hubbard,
- for The FreeBSD Project
diff --git a/share/FAQ/Text/REGISTER.FreeBSD b/share/FAQ/Text/REGISTER.FreeBSD
deleted file mode 100644
index 8501628..0000000
--- a/share/FAQ/Text/REGISTER.FreeBSD
+++ /dev/null
@@ -1,85 +0,0 @@
-In the absence of any other mechanism for counting the number of users
-of FreeBSD, we like to kindly suggest that you take a few minutes to please
-register with the counter set up by <Harald.T.Alvestrand@uninett.no>.
-
-The justification for such "registration" is twofold: First, we really would
-like to know more about the size and demographics of our user-base in order
-to better support its needs. Second, it's a sad fact of life that many
-people rely on counters and statistics (even when highly dubious) rather
-than on actual experience when chosing an operating system, and the best we
-can hope to do in such circumstances is to at least try to provide some
-indication of how popular we are (or are not). This is not how we recommend
-that people go about chosing an operating system, but the necessity of
-such "marketing" remains an undeniable fact.
-
-The FreeBSD team does not necessarily feel that Harald's counter represents
-the best approach to such statistics gathering, and its accuracy can only
-be as good as people's willingness to register with it (and may not reflect
-the actual OS population at any single point in time), but in the total absence
-of any other mechanism for providing such useful statistics, it's certainly a
-start and we thank Harald for his efforts in providing this service.
-It's a community service, and of potential benefit to everyone (all *BSD
-users), so let's see if we can't make it work!
-
-Included below is the standard blurb from the counter.
-
-Thanks in advance,
-
- The FreeBSD team.
-
-
-How to get registered
-=====================
-
-In brief:
-
- [To register a running installation of FreeBSD]
- Send E-mail to bsd-counter@uninett.no with the SUBJECT line
-
- "I use FreeBSD at <place>"
-
-Introduction
-============
-The intention of this counting project is to count all users of UNIXes
-that are:
-
- - BSD-derived
- - Freely available
-
-The variants NetBSD, 386BSD and FreeBSD are currently distinguished.
-
-(NOTE: Linux is NOT BSD-derived. If you use that, send mail to
-linux-counter@uninett.no instead!!!)
-
-The information is *not* used for any purpose but statistics, and unless
-you request it, information about single persons are *never* made public.
-(A list of users who have requested publication is available from the
-FTP file ftp://aun.uninett.no/pub/misc/386bsd/persons)
-
-How to register
-===============
-Send E-mail to bsd-counter@uninett.no
-
-The subject should be
-
- I use FreeBSD|NetBSD|386BSD at <place>
-
-Where FreeBSD, NetBSD or 386BSD is the particular variant you're using
-and "place" can be school, work or home, or a combination of these.
-
-You will get back a letter with 3 things:
-
- - An acknowledgement
- - A form that you can fill out and send in with more information
- about yourself, your machine, and your 386bsd-using friends
- - A report giving the current status of the counter
-
-You can update your "vote" at any time, by sending an E-mail message
-from the same account. Duplicates will be weeded out.
-
-The current report, available by anonymous FTP to aun.uninett.no,
-directory pub/misc/386bsd-counter, file "short", is given below.
-
-For all questions, contact Harald.T.Alvestrand@uninett.no!
-
-$Id: REGISTER.FreeBSD,v 1.2 1994/12/01 13:24:20 jkh Exp $
diff --git a/share/FAQ/Text/RELNOTES.FreeBSD b/share/FAQ/Text/RELNOTES.FreeBSD
deleted file mode 100644
index 9b6c5c6..0000000
--- a/share/FAQ/Text/RELNOTES.FreeBSD
+++ /dev/null
@@ -1,723 +0,0 @@
- RELEASE NOTES
- FreeBSD
- Release 2.0.5
-
-1. Technical overview
----------------------
-
-FreeBSD is a freely available, full source 4.4 BSD Lite based release
-for Intel i386/i486/Pentium (or compatible) based PC's. It is based
-primarily on software from U.C. Berkeley's CSRG group, with some
-enhancements from NetBSD, 386BSD, and the Free Software Foundation.
-
-Since our release of FreeBSD 2.0 some 8 months ago, the performance,
-feature set, and stability of FreeBSD has improved dramatically. The
-largest change is a revamped VM system with a merged VM/file buffer
-cache that not only increases performance, but reduces FreeBSD's
-memory footprint, making a 4MB configuration a more acceptible
-minimum. Other enhancements include full NIS client and server
-support, transaction TCP support, dial-on-demand PPP, an improved SCSI
-subsystem, early ISDN support, support for FDDI and Fast Ethernet
-(100Mbit) adapters, improved support for the Adaptec 2940 (WIDE and
-narrow) and many hundreds of bug fixes.
-
-We've also taken the comments and suggestions of many of our users to
-heart and have attempted to provide what we hope is a more sane and
-easily understood installation process. Your feedback on this
-(constantly evolving) process is especially welcome!
-
-In addition to the base distributions, FreeBSD offers a new ported
-software collection with some 270 commonly sought-after programs. The
-list of ports ranges from http (WWW) servers, to games, languages,
-editors and almost everything in between. The entire ports collection
-requires only 10MB of storage, all ports being expressed as "deltas"
-to their original sources. This makes it much easier for us to update
-ports, and greatly reduces the disk space demands made by the older
-1.0 ports collection. To compile a port, you simply change to the
-directory of the program you wish to install, type make and let the
-system do the rest. The full original distribution for each port you
-build is retrieved dynamically off of CDROM or a local ftp site, so
-you need only enough disk space to build the ports you want. Each
-port is also provided as a pre-compiled "package" which can be
-installed with a simple command (pkg_add) by those who do not wish to
-compile their own ports from source. See the file:
- /usr/share/FAQ/Text/ports.FAQ
-for a more complete description of the ports collection.
-
-
-Since our first release of FreeBSD 1.0 nearly two years ago, FreeBSD
-has changed almost entirely. A new port from the Berkeley 4.4 code
-base was done, which brought the legal status of the system out of the
-shadows with the blessing of Novell (the new owners of USL and UNIX). The
-port to 4.4 has also brought in a host of new features, filesystems
-and enhanced driver support. With our new unencumbered code base, we
-have every reason to hope that we'll be able to release quality
-operating systems without further legal encumbrance for some time to
-come!
-
-FreeBSD 2.0.5 represents the culmination of 2 years of work and many
-thousands of man hours put in by an international development team.
-We hope you enjoy it!
-
-For a list of contributors and a general project description, please see
-the file "CONTRIB.FreeBSD" which should be bundled with your binary
-distribution.
-
-Also see the "REGISTER.FreeBSD" file for information on registering
-with the "Free BSD user counter". This counter is for ALL freely
-available variants of BSD, not just FreeBSD, and we urge you to register
-yourself with it.
-
-The core of FreeBSD does not contain DES code which would inhibit its
-being exported outside the United States. There is an add-on package
-to the core distribution, for use only in the United States, that
-contains the programs that normally use DES. The auxiliary packages
-provided separately can be used by anyone. A freely (from outside the
-U.S.) exportable European distribution of DES for our non-U.S. users also
-exists and is described in the FreeBSD FAQ.
-
-If password security for FreeBSD is all you need, and you have no
-requirement for copying encrypted passwords from different hosts
-(Suns, DEC machines, etc) into FreeBSD password entries, then
-FreeBSD's MD5 based security may be all you require! We feel that our
-default security model is more than a match for DES, and without any
-messy export issues to deal with. If you're outside (or even inside)
-the U.S., give it a try!
-
-
-1.1 What's new in 2.0.5?
-----------------------
-
-The following features were added or substantially improved between
-the release of 2.0 and this 2.0.5 release. In order to facilitate
-better communication, the person, or persons, responsible for each
-enhancement is noted. Any questions regarding the new functionality
-should be directed to them first.
-
-KERNEL:
-
-Merged VM-File Buffer Cache
----------------------------
-A merged VM/buffer cache design greatly enhances overall system
-performance and makes it possible to do a number of more optimal
-memory allocation strategies that were not possible before.
-
-Owner: David Greenman (davidg@FreeBSD.org) and
- John Dyson (dyson@implode.root.com)
-
-
-Network PCB hash optimization
------------------------------
-For systems with a great number of active TCP connections (WEB and ftp
-servers, for example), this greatly speeds up the lookup time required
-to match an incoming packet up to its associated connection.
-
-Owner: David Greenman (davidg@FreeBSD.org)
-
-
-Name cache optimization
------------------------
-The name-cache would cache all files of the same name to the same bucket,
-which would put for instance all ".." entries in the same bucket. We added
-the parent directory version to frustrate the hash, and improved the
-management of the cache in various other ways while we were at it.
-
-Owner: Poul-Henning Kamp (phk@FreeBSD.org)
- David GreenMan (davidg@FreeBSD.org)
-
-
-Less restrictive swap-spaces
-----------------------------
-The need to compile the names of the swap devices into the kernel has been
-removed. Now swapon will accept any block devices, up to the maximum
-number of swap devices configured in the kernel.
-
-Owner: Poul-Henning Kamp (phk@FreeBSD.org)
- David GreenMan (davidg@FreeBSD.org)
-
-
-Hard Wired SCSI Devices
------------------------
-Prior to 2.0.5, FreeBSD performed dynamic assignment of unit numbers
-to SCSI devices as they were probed, allowing a SCSI device failure to
-possibly change unit number assignment and prevent filesystems on
-still functioning disks from mounting. Hard wiring allows static
-allocation of unit numbers (and hence device names) to scsi devices
-based on SCSI ID and bus. SCSI configuration occurs in the kernel
-config file. Samples of the configuration syntax can be found in the
-scsi(4) man page or the LINT kernel config file.
-
-Owner: Peter Dufault (dufault@hda.com)
-Sources involved: sys/scsi/* usr.sbin/config/*
-
-
-Slice Support
--------------
-FreeBSD now supports a "slice" abstraction which makes it more
-completely interoperable with other operating system partitions. This
-support will allow FreeBSD to inhabit DOS extended partitions.
-
-Owner: Bruce Evans (bde@FreeBSD.org)
-Sources involved: sys/disklabel.h sys/diskslice.h sys/dkbad.h
- kern/subr_diskslice.c kern/subr_dkbad.c
- i386/isa/diskslice_machdep.c
- i386/isa/wd.c scsi/sd.c dev/vn/vn.c
-
-
-Support for Ontrack Disk Manager Version 6.0
---------------------------------------------
-Support has been added for disks which use Ontrack Disk Manager. The
-fdisk program does NOT know about it however, so make all changes
-using the install program on the boot.flp or the Ontrack Disk Manager
-tool under DOS.
-
-Owner: Poul-Henning Kamp (phk@FreeBSD.org)
-
-
-Bad144 is back and working
---------------------------
-Bad144 works again, though the semantics are slightly different than
-before in that the bad-spots are kept relative to the slice rather
-than absolute on the disk.
-
-Owner: Bruce Evans (bde@FreeBSD.org)
- Poul-Henning Kamp (phk@FreeBSD.org)
-
-
-NEW DEVICE SUPPORT:
-
- SCSI and CDROM Devices
-
-Matsushita/Panasonic (Creative) CD-ROM driver
----------------------------------------------
-The Matsushita/Panasonic CR-562 and CR-563 drives are now supported
-when connected to a Sound Blaster or 100% compatible host adapter. Up
-to four host adapters are supported for a total of 16 CD-ROM drives.
-The audio functions are supported with the Karoke variable speed
-playback.
-
-Owner: Frank Durda IV bsdmail@nemesis.lonestar.org
-Sources involved: isa/matcd
-
-
-Adaptec 2742/2842/2940 SCSI driver
------------------------------
-The original 274x/284x driver has evolved considerably since the 2.0
-release. We now offer full support for the 2940 series as well as the
-Wide models of these cards. The arbitration bug (as well as many
-others) that caused the driver problems with fast devices has been
-corrected and there is even experimental tagged queuing support
-(kernel option "AHC_TAGENABLE"). John Aycock has also released the
-sequencer code under a "Berkeley style" copyright making the driver
-entirely clean of the GPL.
-
-Owner: Justin Gibbs (gibbs@FreeBSD.org)
-Sources involved: isa/aic7770.c pci/aic7870.c i386/scsi/*
- sys/dev/aic7xxx/*
-
-
-NCR5380/NCR53400 SCSI ("ProAudio Spectrum") driver
---------------------------------------------------
-Owner: core
-Submitted by: Serge Vakulenko (vak@cronyx.ru)
-Sources involved: isa/ncr5380.c
-
-
-Sony CDROM driver
------------------
-Owner: core
-Submitted by: Mikael Hybsch (micke@dynas.se)
-Sources involved: isa/scd.c
-
-
- Serial Devices
-
-SDL Communications Riscom/8 Serial Board Driver
------------------------------------------------
-Owner: Andrey Chernov (ache@FreeBSD.org)
-Sources involved: isa/rc.c isa/rcreg.h
-
-
-Cyclades Cyclom-y Serial Board Driver
--------------------------------------
-Owner: Bruce Evans (bde@FreeBSD.org)
-Submitted by: Andrew Werple (andrew@werple.apana.org.au) and
- Heikki Suonsivu (hsu@cs.hut.fi)
-Obtained from: NetBSD
-Sources involved: isa/cy.c
-
-
-Cronyx/Sigma sync/async serial driver
--------------------------------------
-Owner: core
-Submitted by: Serge Vakulenko
-Sources involved: isa/cronyx.c
-
-
-
- Networking
-
-Diskless booting
-----------------
-Diskless booting in 2.0.5 is much improved. The boot-program is in
-src/sys/i386/boot/netboot, and can be run from an MSDOS system or
-burned into an EPROM. Local swapping is also possible. WD, SMC, 3COM
-and Novell ethernet cards are currently supported.
-
-
-DEC DC21140 Fast Ethernet driver
---------------------------------
-This driver supports any of the numerous NICs using the DC21140 chipset
-including the 100Mb DEC DE-500-XA and SMC 9332.
-
-Owner: core
-Submitted by: Matt Thomas (thomas@lkg.dec.com)
-Sources involved: pci/if_de.c pci/dc21040.h
-
-
-DEC FDDI (DEFPA/DEFEA) driver
------------------------------
-Owner: core
-Submitted by: Matt Thomas (thomas@lkg.dec.com)
-Sources involved: pci/if_pdq.c pci/pdq.c pci/pdq_os.h pci/pdqreg.h
-
-
-3Com 3c505 (Etherlink/+) NIC driver
------------------------------------
-Owner: core
-Submitted by: Dean Huxley (dean@fsa.ca)
-Obtained from: NetBSD
-Sources involved: isa/if_eg.c
-
-
-Fujitsu MB86960A family of NICs driver
--------------------------------------
-Owner: core
-Submitted by: M.S. (seki@sysrap.cs.fujitsu.co.jp)
-Sources involved: isa/if_fe.c
-
-
-Intel EtherExpress driver
--------------------------
-Owner: Rodney W. Grimes (rgrimes@FreeBSD.org)
-Sources involved: isa/if_ix.c isa/if_ixreg.h
-
-
-3Com 3c589 driver
------------------
-Owner: core
-Submitted by: "HOSOKAWA Tatsumi" (hosokawa@mt.cs.keio.ac.jp),
- Seiji Murata (seiji@mt.cs.keio.ac.jp) and
- Noriyuki Takahashi (hor@aecl.ntt.jp)
-Sources involved: isa/if_zp.c
-
-
-IBM Credit Card Adapter driver
-------------------------------
-Owner: core
-Submitted by: "HOSOKAWA Tatsumi" (hosokawa@mt.cs.keio.ac.jp),
-Sources involved: isa/pcic.c isa/pcic.h
-
-
-EDSS1 and 1TR6 ISDN interface driver
-------------------------------------
-Owner: core
-Submitted by: Dietmar Friede (dfriede@drnhh.neuhaus.de) and
- Juergen Krause (jkr@saarlink.de)
-Sources involved: gnu/isdn/*
-
-
- Miscellaneous Drivers
-
-Joystick driver
----------------
-Owner: Jean-Marc Zucconi (jmz@FreeBSD.org)
-Sources involved: isa/joy.c
-
-
-National Instruments "LabPC" driver
------------------------------------
-Owner: Peter Dufault (dufault@hda.com)
-Sources involved: isa/labpc.c
-
-
-WD7000 driver
--------------
-Owner: Olof Johansson (offe@ludd.luth.se)
-
-
-Pcvt Console driver
--------------------
-Owner: Joerg Wunsch (joerg@FreeBSD.org)
-Submitted by: Hellmuth Michaelis (hm@altona.hamburg.com)
-Sources involved: isa/pcvt/*
-
-
-BSD-audio emulator for VAT driver
----------------------------------
-Owner: Amancio Hasty (ahasty@FreeBSD.org) and
- Paul Traina (pst@FreeBSD.org)
-Sources involved: isa/sound/vat_audio.c isa/sound/vat_audioio.h
-
-
-National Instruments AT-GPIB and AT-GPIB/TNT GPIB driver
---------------------------------------------------------
-Owner: core
-Submitted by: Fred Cawthorne (fcawth@delphi.umd.edu)
-Sources involved: isa/gpib.c isa/gpib.h isa/gpibreg.h
-
-
-Genius GS-4500 hand scanner driver
-----------------------------------
-Owner: core
-Submitted by: Gunther Schadow (gusw@fub46.zedat.fu-berlin.de)
-Sources involved: isa/gsc.c isa/gscreg.h
-
-
-CORTEX-I Frame Grabber
-----------------------
-Owner: core
-Submitted by: Paul S. LaFollette, Jr. (
-Sources involved: isa/ctx.c isa/ctxreg.h
-
-
-Video Spigot video capture card
--------------------------------
-Owner: Jim Lowe
-
-
-
-1.2 Experimental features
----------------------------------------------
-
-The unionfs and LFS file systems are known to be severely broken in
-2.0.5. This is in part due to old bugs that we haven't had time to
-resolve yet and the need to update these file systems to deal with the
-new VM system. We hope to address these issues in a later release of
-FreeBSD.
-
-FreeBSD now supports running iBCS2 compatible binaries (currently SCO
-UNIX 3.2.2 & 3.2.4 and ISC 2.2 COFF format are supported). The iBCS2
-emulator is in its early stages, but it is functional, we haven't been
-able to do exhaustive testing (lack of commercial apps), but almost
-all of SCO's 3.2.2 binaries are working, so is an old INFORMIX-2.10
-for SCO. Further testing is nessesary to complete this project. There
-is also work under way for ELF & XOUT loaders, and most of the svr4
-syscall wrappers have been written.
-
-Owner: Soren Schmidt (sos) & Sean Eric Fagan (sef)
-Sources involved: sys/i386/ibcs2/* + misc kernel changes.
-=======
-
-
-2. Supported Configurations
----------------------------
-
-FreeBSD currently runs on a wide variety of ISA, VLB, EISA and PCI bus
-based PC's, ranging from 386sx to Pentium class machines (though the
-386sx is not recommended). Support for generic IDE or ESDI drive
-configurations, various SCSI controller, network and serial cards is
-also provided.
-
-Following is a list of all disk controllers and ethernet cards currently
-known to work with FreeBSD. Other configurations may very well work, and
-we have simply not received any indication of this.
-
-
-2.1. Disk Controllers
-
-WD1003 (any generic MFM/RLL)
-WD1007 (any generic IDE/ESDI)
-WD7000
-IDE
-ATA
-
-Adaptec 152x series ISA SCSI controllers
-Adaptec 154x series ISA SCSI controllers
-Adaptec 174x series EISA SCSI controller in standard and enhanced mode.
-Adaptec 274X/284X/2940 (Narrow/Wide/Twin) series ISA/EISA/PCI SCSI controllers
-Adaptec AIC-6260 and AIC-6360 based boards, which includes
-the AHA-152x and SoundBlaster SCSI cards.
-
-** Note: You cannot boot from the SoundBlaster cards
-as they have no on-board BIOS, which is necessary for mapping
-the boot device into the system BIOS I/O vectors.
-They're perfectly usable for external tapes, CDROMs, etc,
-however. The same goes for any other AIC-6x60 based card
-without a boot ROM. Some systems DO have a boot ROM, which
-is generally indicated by some sort of message when the system
-is first powered up or reset. Check your system/board documentation
-for more details.
-
-[Note that Buslogic was formerly known as "Bustec"]
-Buslogic 545S & 545c
-Buslogic 445S/445c VLB SCSI controller
-Buslogic 742A, 747S, 747c EISA SCSI controller.
-Buslogic 946c PCI SCSI controller
-Buslogic 956c PCI SCSI controller
-
-NCR 53C810 and 53C825 PCI SCSI controller.
-NCR5380/NCR53400 ("ProAudio Spectrum") SCSI controller.
-
-DTC 3290 EISA SCSI controller in 1542 emulation mode.
-
-UltraStor 14F, 24F and 34F SCSI controllers.
-
-Seagate ST01/02 SCSI controllers.
-
-Future Domain 8xx/950 series SCSI controllers.
-
-With all supported SCSI controllers, full support is provided for
-SCSI-I & SCSI-II peripherals, including Disks, tape drives (including
-DAT) and CD ROM drives.
-The following CD-ROM type systems are supported at this time:
-(cd) SCSI (also includes ProAudio Spectrum and SoundBlaster SCSI)
-(mcd) Mitsumi proprietary interface
-(matcd) Matsushita/Panasonic (Creative) proprietary interface
-(scd) Sony proprietary interface
-
-Note: CD-Drives with IDE interfaces are not supported at this time.
-
-Some controllers have limitations with the way they deal with >16MB of
-memory, due to the fact that the ISA bus only has a DMA address space
-of 24 bits. If you do your arithmetic, you'll see that this makes it
-impossible to do direct DMA to any address >16MB. This limitation is
-even true of some EISA controllers (which are normally 32 bit) when
-they're configured to emulate an ISA card, which they then do in *all*
-respects. This problem is avoided entirely by IDE controllers (which
-do not use DMA), true EISA controllers (like the UltraStor, Adaptec
-1742A or Adaptec 2742) and most VLB (local bus) controllers. In the
-cases where it's necessary, the system will use "bounce buffers" to
-talk to the controller so that you can still use more than 16Mb of
-memory without difficulty.
-
-
-2.2. Ethernet cards
-
-SMC Elite 16 WD8013 ethernet interface, and most other WD8003E,
-WD8003EBT, WD8003W, WD8013W, WD8003S, WD8003SBT and WD8013EBT
-based clones. SMC Elite Ultra is also supported.
-
-DEC EtherWORKS III NICs (DE203, DE204, and DE205)
-DEC EtherWORKS II NICs (DE200, DE201, DE202, and DE422)
-DEC DC21140 based NICs (SMC???? DE???)
-DEC FDDI (DEFPA/DEFEA) NICs
-
-Fujitsu MB86960A family of NICs
-
-Intel EtherExpress
-
-Isolan AT 4141-0 (16 bit)
-Isolink 4110 (8 bit)
-
-Novell NE1000, NE2000, and NE2100 ethernet interface.
-
-3Com 3C501 cards
-
-3Com 3C503 Etherlink II
-
-3Com 3c505 Etherlink/+
-
-3Com 3C507 Etherlink 16/TP
-
-3Com 3C509, 3C579, 3C589 (PCMCIA) Etherlink III
-
-Toshiba ethernet cards
-
-PCMCIA ethernet cards from IBM and National Semiconductor are also
-supported.
-
-
-2.3. Misc
-
-AST 4 port serial card using shared IRQ.
-
-ARNET 8 port serial card using shared IRQ.
-
-BOCA ATIO66 6 port serial card using shared IRQ.
-
-Cyclades Cyclom-y Serial Board.
-
-STB 4 port card using shared IRQ.
-
-Mitsumi (all models) CDROM interface and drive.
-
-SDL Communications Riscom/8 Serial Board.
-
-Soundblaster SCSI and ProAudio Spectrum SCSI CDROM interface and drive.
-
-Matsushita/Panasonic (Creative SoundBlaster) CDROM interface and drive.
-
-Adlib, SoundBlaster, SoundBlaster Pro, ProAudioSpectrum, Gravis UltraSound
-and Roland MPU-401 sound cards.
-
-FreeBSD currently does NOT support IBM's microchannel (MCA) bus, but
-support is apparently close to materializing. Details will be posted
-as the situation develops.
-
-
-3. Obtaining FreeBSD.
----------------------
-
-You may obtain FreeBSD in a variety of ways:
-
-1. FTP/Mail
-
-You can ftp FreeBSD and any or all of its optional packages from
-`ftp.freebsd.org' - the offical FreeBSD release site.
-
-For other locations that mirror the FreeBSD software see the file
-MIRROR.SITES. Please ftp the distribution from the nearest site
-to you netwise.
-
-If you do not have access to the internet and electronic mail is your
-only recourse, then you may still fetch the files by sending mail to
-`ftpmail@decwrl.dec.com' - putting the keyword "help" in your message
-to get more information on how to fetch files from freebsd.cdrom.com.
-Note: This approach will end up sending many *tens of megabytes*
-through the mail, and should only be employed as an absolute LAST
-resort!
-
-
-2. CDROM
-
-FreeBSD 2.0.5 may be ordered on CDROM from:
-
- Walnut Creek CDROM
- 4041 Pike Lane, Suite D
- Concord CA 94520
- 1-800-786-9907, +1-510-674-0783, +1-510-674-0821 (fax)
-
-Or via the internet from orders@cdrom.com or http://www.cdrom.com.
-Their current catalog can be obtained via ftp as:
- ftp://ftp.cdrom.com/cdrom/catalog.
-
-Cost is $39.95. Shipping (per order not per disc) is $5 in the US,
-Canada, or Mexico and $10.00 overseas. They accept Visa, Mastercard,
-American Express, and ship COD within the United States. California
-residents please add 8.25% sales tax.
-
-Should you be dissatisfied for any reason, the CD comes with an
-unconditional return policy.
-
-
-Reporting problems, making suggestions, submitting code.
------------------------------------------------------------
-
-Your suggestions, bug reports and contributions of code are always
-valued - please do not hesitate to report any problems you may find
-(preferably with a fix attached if you can!).
-
-The preferred method to submit bug reports from a machine with
-internet mail connectivity is to use the send-pr command. Bug reports
-will be dutifully filed by our faithful bugfiler program and you can
-be sure that we'll do our best to respond to all reported bugs as soon
-as possible.
-
-If, for some reason, you are unable to use the send-pr command to
-submit a bug report, you can try to send it to:
-
- bugs@FreeBSD.org
-
-
-Otherwise, for any questions or suggestions, please send mail to:
-
- questions@FreeBSD.org
-
-Additionally, being a volunteer effort, we are always happy to have
-extra hands willing to help - there are already far more enhancements
-to be done than we can ever manage to do by ourselves! To contact us
-on technical matters, or with offers of help, you may send mail to:
-
- hackers@FreeBSD.org
-
-Since these mailing lists can experience significant amounts of
-traffic, if you have slow or expensive mail access and you are
-only interested in keeping up with significant FreeBSD events, you may
-find it preferable to subscribe to:
-
- announce@FreeBSD.org
-
-
-All but the freebsd-bugs groups can be freely joined by anyone wishing
-to do so. Send mail to MajorDomo@FreeBSD.org and include the keyword
-`help' on a line by itself somewhere in the body of the message. This
-will give you more information on joining the various lists, accessing
-archives, etc. There are a number of mailing lists targeted at
-special interest groups not mentioned here, so send mail to majordomo
-and ask about them!
-
-
-6. Acknowledgements
--------------------
-
-FreeBSD represents the cumulative work of many dozens, if not
-hundreds, of individuals from around the world who have worked very
-hard to bring you this release. It would be very difficult, if not
-impossible, to enumerate everyone who's contributed to FreeBSD, but
-nonetheless we shall try (in alphabetical order, of course). If your
-name is not mentioned, please be assured that its omission is entirely
-accidental.
-
-
-The Computer Systems Research Group (CSRG), U.C. Berkeley.
-
-Bill Jolitz, for his initial work with 386BSD.
-
-The FreeBSD Core Team
-(in alphabetical order by first name):
-
- Andreas Schulz <ats@FreeBSD.org>
- Andrey A. Chernov <ache@FreeBSD.org>
- Bruce Evans <bde@FreeBSD.org>
- David Greenman <davidg@FreeBSD.org>
- Garrett A. Wollman <wollman@FreeBSD.org>
- Gary Palmer <gpalmer@FreeBSD.org>
- Geoff Rehmet <csgr@FreeBSD.org>
- Jack Vogel <jackv@FreeBSD.org>
- John Dyson <dyson@FreeBSD.org>
- Jordan K. Hubbard <jkh@FreeBSD.org>
- Justin Gibbs <gibbs@FreeBSD.org>
- Paul Richards <paul@FreeBSD.org>
- Poul-Henning Kamp <phk@FreeBSD.org>
- Rich Murphey <rich@FreeBSD.org>
- Rodney W. Grimes <rgrimes@FreeBSD.org>
- Satoshi Asami <asami@FreeBSD.org>
- Søren Schmidt <sos@FreeBSD.org>
-
-Special mention to:
-
- Walnut Creek CDROM, without whose help (and continuing support)
- this release would never have been possible.
-
- Dermot McDonnell for his donation of a Toshiba XM3401B CDROM
- drive.
-
- Additional FreeBSD helpers and beta testers:
-
- J.T. Conklin Julian Elischer
- Frank Durda IV Peter Dufault
- Sean Eric Fagan Jeffrey Hsu
- Terry Lambert L Jonas Olsson
- Chris Provenzano Dave Rivers
- Guido van Rooij Steven Wallace
- Atsushi Murai Scott Mace
- Nate Williams
-
- And everyone at Montana State University for their initial support.
-
-
-Jordan would also like to give special mention to Poul-Henning Kamp
-and Gary Palmer, both of whom put in long hours helping him to
-construct the new installation utility. Poul, being a proud new
-father, was especially pressed for time yet somehow managed to put in
-significant amount of effort anyway and this release could not have
-happened without him. Thank you both!
-
-Thanks also to everyone else who helped, especially those not
-mentioned, and we sincerely hope you enjoy this release of FreeBSD!
-
-
- The FreeBSD Core Team
-
-$Id: RELNOTES.FreeBSD,v 1.6 1995/05/28 18:56:01 phk Exp $
diff --git a/share/FAQ/Text/ROADMAP b/share/FAQ/Text/ROADMAP
deleted file mode 100644
index 9561691..0000000
--- a/share/FAQ/Text/ROADMAP
+++ /dev/null
@@ -1,58 +0,0 @@
-This directory contains frequently asked questions, short user guides,
-tutorials and other miscellaneous information that may be of help
-to the beginning (or even advanced) FreeBSD user. Any submissions
-to this directory should be sent to:
-
- FreeBSD-FAQ@FreeBSD.ORG
-
-For inclusion with the next release. Your contributions are not only
-welcome, but often save new users from uncountable headaches! If you've
-written something you think may help new users, please - by all means
-send it to us!
-
-Thanks!
-
- The FreeBSD Project
-
-----
-ROADMAP:
-
-File Description
-===============================================================================
-ESDI.FAQ All about installing FreeBSD on older
- ESDI/MFM drives.
-
-FreeBSD.FAQ The overall FreeBSD FAQ - posted regularly to
- USENET.
-
-FreeBSD-1.1.FAQ FreeBSD FAQ for versions 1.1.5.1 and below.
-
-HW.TROUBLE User feedback on finicky or broken hardware.
-
-MIRROR.SITES A list of all sites mirroring FreeBSD 2.x.
-
-NFS.FAQ Tips for users using NFS between FreeBSD
- and workstation hardware.
-
-Systems.FAQ Systems and configurations on which FreeBSD
- is "known" to work.
-
-Systems-1.1.FAQ Systems for 1.1.5.1 and below
-
-current-policy.FAQ What you should know about running
- FreeBSD-current.
-
-kernel-debug.FAQ How to debug kernels for 1.1.5.1 and below.
-
-mailing-list.FAQ All about the FreeBSD mailing lists.
-
-ports-supfile A sample supfile for the FreeBSD ports
- collection.
-
-slip-dialup How to configure SLIP.
-
-standard-supfile A sample supfile for the FreeBSD source tree.
-
-sup.FAQ All about sup in general.
-
-
diff --git a/share/FAQ/Text/TROUBLESHOOTING b/share/FAQ/Text/TROUBLESHOOTING
deleted file mode 100644
index d1cb25f..0000000
--- a/share/FAQ/Text/TROUBLESHOOTING
+++ /dev/null
@@ -1,185 +0,0 @@
-Troubleshooting Tips - or "These are the times that try men's souls"
---------------------------------------------------------------------
-
-The following tips and tricks may help you turn a failing (or failed)
-installation attempt into a success. Please read them carefully.
-
----
-
-Symptom: Hardware conflict or misconfiguration.
- Device not being found when it should be.
-
-Problem: A device is conflicting with another, or its settings
- don't match the kernel's expected IRQ or address.
-
-Explanation: While most device drivers in FreeBSD are now smart
- enough to match themselves to your hardware settings
- dynamically, there are a few that still require fairly
- rigid configuration parameters to be compiled in (and
- matched by the hardware) before they'll work. We're
- working hard to eliminate as many of these last
- hold-outs as we can, but it's not always as easy as
- it looks.
-
-Solution: There are several possible solutions. The first,
- and easiest, is to boot the kernel with the -c flag.
- When you see the initial boot prompt (from floppy or
- hard disk), type:
-
- /kernel -c
-
- This will boot just past the memory sizing code and
- then drop into a dynamic kernel configuration utility.
- Type `?' at the prompt to see a list of commands. You
- can use this utility to reset the IRQ, memory address,
- IO address or a number of other device configuration
- parameters. You can also disable a device entirely
- if it's causing problems for other devices you'd much
- rather have work. Note that this only affects the
- kernel being booted temporarily, it does not "write out"
- the information to the kernel so that these settings
- are permanantly altered (this would be actually rather
- hard). If you reboot, you'll have to make the same
- changes again. The goal of the -c utility is to get
- you up far enough to be able to download the appropriate
- sources and configure and rebuild a kernel more specific
- to your needs.
-
- Another solution is, obviously, to remove the offending
- hardware or simply strip the system down to the bare
- essentials until the problem (hopefully) goes away.
- Once you're up, you can do the same thing mentioned
- above - compile a kernel more suited to your hardware,
- or incrementally try to figure out what it was about
- your original hardware configuration that didn't work.
-
----
-Symptom: My floppy-tape drive isn't probed.
-
-Problem: Last-minute problems with this driver caused it to be disabled
- by default.
-
-Solution: Boot with -c (described above) and set the flags value of
- fdc0 to 1. This will re-enable the floppy tape driver.
- Sorry, but it was causing problems for people without floppy
- tape drives!
----
-
-Symptom: When I boot for the first time, it still looks for /386bsd!
-
-Problem: You still have the old FreeBSD 1.x boot blocks on your
- boot partition.
-
-Solution: You should re-enter the installation process, invoke
- the (F)disk editor and chose the (W)rite option. This
- won't hurt an existing installation and will make sure
- that the new boot blocks get written to the drive.
- If you're installing for the first time, don't forget
- to (W)rite out your new boot blocks! :-)
-
----
-
-Symptom: I want to boot FreeBSD off the second drive. It doesn't!
-
-Problem: FreeBSD will actually install just fine on a drive other
- than 0 (the first drive), and the boot manager will even
- allow you to select it, but the boot blocks rather
- pathologically assume 0. This should be fixed in 2.1.
-
-Solution: Easy - follow these steps:
-
- 1. Select the first (0) drive from the (F)disk editor
- and write out the boot manager with the (B) option.
- This will enable the boot manager that allows you to
- actually boot off the other drive.
-
- 2. Exit the fdisk editor for the first drive and and
- re-enter it again for the drive you wish to install
- on. Set up a partition on this drive, or select
- (A)ll for the entire drive.
-
- 3. Enter the disklabel editor and allocate space on
- your second drive as normal. Proceed with the
- installation.
-
- 4. Once you've installed on the disk and are going to
- reboot from the hard disk, enter the following at
- the boot prompt:
-
- wd(1,a)/kernel
-
- [ If you're using a SCSI drive, substitute
- `sd' for `wd' above ]
-
- This will ensure that you really boot from the second
- drive. If you've actually installed on a drive other
- than 1 (the 3rd or 4th drive?), substitute that number
- in for the above. You will need to enter this EVERY
- time you reboot from the hard disk. If you're feeling
- brave and have a srcdist + the requisite experience,
- you can hack the boot blocks in:
-
- /usr/src/sys/i386/boot/biosboot
-
- So that this drive you're booting from is hard-coded.
- Recompile the boot blocks and reinstall them on your
- drive with `disklabel -B ...' You can then have the
- default Do The Right Thing.
----
-
-Symptom: Newfs crashes, requesting that blocksize be 32K
-
-Problem: You have your disk controller configured to translate
- to a some really large cylinder size because you're using
- a drive with lots of cylinders.
-
-Solution: Turn such translation OFF in your controller's BIOS
- setup if you can. If you must share the disk with other
- Operating Systems, then this may not be possible and
- you may simply be unable to install FreeBSD until we have
- support for large translated geometries, sorry!
- [ Hopefully in 2.1 ].
-
----
-
-Symptom: FreeBSD won't boot off the hard disk
-
-Problem: Root partition does not start and end below cylinder 1024.
-
-Solution: See solution for newfs crashes, or move your root
- partition. This limitation holds true for ANY operating
- system you wish to boot from your hard drive.
-
----
-
-Symptom: FreeBSD still won't boot off the hard disk
-
-Problem: No boot code is installed in sector 1.
-
-Solution: Chose the Write MBR (B)oot code in the FDISK editor and
- write out the boot manager so that you have a chance to
- select operating systems.
-
- [ ** NOTE: If you are using the entire disk for FreeBSD, or
- you have a Connor drive that does cylinder translation
- from the MBR boot code, do NOT chose this option! ** ].
-
----
-Summary: Nope, FreeBSD's still not booting from the hard disk.
-
-Cause: BIOS disk geometry different from that used when
- installing FreeBSD.
-
-Solution: With IDE drives, pay careful attention to the geometry
- information that FreeBSD prints out when it's first
- booting off the floppy. Use this geometry in your BIOS
- setup or use the BIOS geometry when you install FreeBSD.
- Either way, they have to match.
-
- With SCSI drives, the values they report is most often
- bogus and cannot be used. In this situation, the SCSI
- controller is performing geometry translation and
- it's probably wise to assume a default of 64 heads,
- 32 sectors and 1MB/cylinder. Use these values when
- you install FreeBSD. See above comments concerning
- newfs failures for more info.
diff --git a/share/FAQ/Text/UUCP_Internals.FAQ b/share/FAQ/Text/UUCP_Internals.FAQ
deleted file mode 100644
index 5a0702b..0000000
--- a/share/FAQ/Text/UUCP_Internals.FAQ
+++ /dev/null
@@ -1,1603 +0,0 @@
-Path: bloom-beacon.mit.edu!cambridge-news.cygnus.com!comton.airs.com!ian
-From: ian@airs.com (Ian Lance Taylor)
-Newsgroups: comp.mail.uucp,comp.answers,news.answers
-Subject: UUCP Internals Frequently Asked Questions
-Keywords: UUCP, protocol, FAQ
-Message-ID: <uucp-internals_787915801@airs.com>
-Date: 20 Dec 94 09:30:02 GMT
-Expires: 31 Jan 95 09:30:01 GMT
-Reply-To: ian@airs.com (Ian Lance Taylor)
-Followup-To: comp.mail.uucp
-Organization: Infinity Development, Waltham, MA
-Lines: 1587
-Approved: news-answers-request@MIT.Edu
-Supersedes: <uucp-internals_785496601@airs.com>
-Xref: bloom-beacon.mit.edu comp.mail.uucp:5270 comp.answers:9043 news.answers:31575
-
-Archive-name: uucp-internals
-Version: $Revision: 1.1 $
-Last-modified: $Date: 1995/01/04 01:53:38 $
-
- This article was written by Ian Lance Taylor <ian@airs.com> and I may
- even update it periodically. Please send me mail about suggestions
- or inaccuracies.
-
- This article describes how the various UUCP protocols work, and
- discusses some other internal UUCP issues. It does not describe how
- to configure UUCP, nor how to solve UUCP connection problems, nor how
- to deal with UUCP mail. I do not know of any FAQ postings on these
- topics. There are some documents on the net describing UUCP
- configuration, but I can not keep an up to date list here; try using
- archie.
-
- If you haven't read the news.announce.newusers articles, read them.
-
- This article is in digest format. Some newsreaders will be able to
- break it apart into separate articles. Please don't ask me how to do
- this, though.
-
- This article answers the following questions. If one of these
- questions is posted to comp.mail.uucp, please send mail to the poster
- referring her or him to this FAQ. There is no reason to post a
- followup, as most of us know the answer already.
-
-Sources
-What does "alarm" mean in debugging output?
-What are UUCP grades?
-What is the format of a UUCP lock file?
-What is the format of a UUCP X.* file?
-What is the UUCP protocol?
-What is the 'g' protocol?
-What is the 'f' protocol?
-What is the 't' protocol?
-What is the 'e' protocol?
-What is the 'G' protocol?
-What is the 'i' protocol?
-What is the 'j' protocol?
-What is the 'x' protocol?
-What is the 'y' protocol?
-What is the 'd' protocol?
-What is the 'h' protocol?
-What is the 'v' protocol?
-Thanks
-
-----------------------------------------------------------------------
-
-From: Sources
-Subject: Sources
-
-"Unix-to-Unix Copy Program," said PDP-1. "You will never find a more
-wretched hive of bugs and flamers. We must be cautious."
- --DECWars
-
-I took a lot of the information from Jamie E. Hanrahan's paper in the
-Fall 1990 DECUS Symposium, and from Managing UUCP and Usenet by Tim
-O'Reilly and Grace Todino (with contributions by several other
-people). The latter includes most of the former, and is published by
- O'Reilly & Associates, Inc.
- 103 Morris Street, Suite A
- Sebastopol, CA 95472
-It is currently in its tenth edition. The ISBN number is
-0-937175-93-5.
-
-Some information is originally due to a Usenet article by Chuck
-Wegrzyn. The information on execution files comes partially from
-Peter Honeyman. The information on the 'g' protocol comes partially
-from a paper by G.L. Chesson of Bell Laboratories, partially from
-Jamie E. Hanrahan's paper, and partially from source code by John
-Gilmore. The information on the 'f' protocol comes from the source
-code by Piet Berteema. The information on the 't' protocol comes from
-the source code by Rick Adams. The information on the 'e' protocol
-comes from a Usenet article by Matthias Urlichs. The information on
-the 'd' protocol comes from Jonathan Clark, who also supplied
-information about QFT. The FSUUCP information comes straight from
-Christopher J. Ambler; it applies to version 1.4 and up.
-
-Although there are few books about UUCP, there are many about networks
-and protocols in general. I recommend two non-technical books which
-describe the sorts of things that are available on the network: ``The
-Whole Internet,'' by Ed Krol, and ``Zen and the Art of the Internet,''
-by Brendan P. Kehoe. Good technical discussions of networking issues
-can be found in ``Internetworking with TCP/IP,'' by Douglas E. Comer
-and David L. Stevens and in ``Design and Validation of Computer
-Protocols'' by Gerard J. Holzmann.
-
-------------------------------
-
-From: alarm
-Subject: What does "alarm" mean in debugging output?
-
-The debugging output of many versions of UUCP (but not Taylor UUCP)
-will include messages like
- alarm 1
-or
- pkcget: alarm 1
-
-This message means that the UUCP package has timed out while waiting
-for some sort of response from the remote system. This normally
-indicates some sort of connection problem. For example, the modems
-might have lost their connection, or perhaps one of the modems will
-not transmit the XON and XOFF characters, or perhaps one side or the
-other is dropping characters. It can also mean that the packages
-disagree about some aspect of the UUCP protocol, although this is less
-common.
-
-Using the information in the rest of this posting, you should be able
-to figure out what type of data your UUCP was expecting to receive.
-This may give some indication as to exactly what the problem is. It
-is difficult to be more specific, since there are many possiblities.
-
-------------------------------
-
-From: UUCP-grades
-Subject: What are UUCP grades?
-
-Modern UUCP packages support grades for each command. The grades
-generally range from 'A' (the highest) to 'Z' followed by 'a' to 'z'.
-Some UUCP packages also support '0' to '9' before 'A'. Some UUCP
-packages may permit any ASCII character as a grade.
-
-On Unix, these grades are encoded in the name of the command file. A
-command file name generally has the form
- C.nnnngssss
-where nnnn is the remote system name for which the command is queued,
-g is a single character grade, and ssss is a four character sequence
-number. For example, a command file created for the system ``airs''
-at grade 'Z' might be named
- C.airsZ2551
-
-The remote system name will be truncated to seven characters, to
-ensure that the command file name will fit in the 14 character file
-name limit of the traditional Unix file system. UUCP packages which
-have no other means of distinguishing which command files are intended
-for which systems thus require all systems they connect to to have
-names that are unique in the first seven characters. Some UUCP
-packages use a variant of this format which truncates the system name
-to six characters. HDB and Taylor UUCP use a different spool
-directory format, which allows up to fourteen characters to be used
-for each system name.
-
-The sequence number in the command file name may be a decimal integer,
-or it may be a hexadecimal integer, or it may contain any alphanumeric
-character. Different UUCP packages are different.
-
-FSUUCP (a DOS based UUCP and news package) uses up to 8 characters for
-file names in the spool (this is a DOS file name limitation; actually,
-with the extension, 11 characters are available, but FSUUCP reserves
-that for future use). FSUUCP defaults mail to grade D, and news to
-grade N, except that when the grade of incoming mail can be
-determined, that grade is preserved if the mail is forwarded to
-another system. Mail and news are currently the only 2 types of
-transfers supported. The default grades may be changed by editing
-the MAIL.RC file for mail, or the FSUUCP.CFG file for news.
-
-UUPC/extended for DOS, OS/2 and Windows NT handles mail at grade 'C',
-news at grade 'd', and file transfers at grade 'n'. The UUPC/extended
-UUCP and RMAIL commands accept grades to override the default, the
-others do not.
-
-I do not know how command grades are handled in other non-Unix UUCP
-packages.
-
-Modern UUCP packages allow you to restrict file transfer by grade
-depending on the time of day. Typically this is done with a line in
-the Systems (or L.sys) file like this:
- airs Any/Z,Any2305-0855 ...
-This allows grades 'Z' and above to be transferred at any time. Lower
-grades may only be transferred at night. I believe that this grade
-restriction applies to local commands as well as to remote commands,
-but I am not sure. It may only apply if the UUCP package places the
-call, not if it is called by the remote system.
-
-Taylor UUCP can use the ``timegrade'' and ``call-timegrade'' commands
-to achieve the same effect (and supports the above format when reading
-Systems or L.sys).
-
-UUPC/extended provides the symmetricgrades option to announce the
-current grade in effect when calling the remote system.
-
-This sort of grade restriction is most useful if you know what grades
-are being used at the remote site. The default grades used depend on
-the UUCP package. Generally uucp and uux have different defaults. A
-particular grade can be specified with the -g option to uucp or uux.
-For example, to request execution of rnews on airs with grade 'd', you
-might use something like
- uux -gd - airs!rnews <article
-
-Uunet queues up mail at grade 'C', but increases the grade based on
-the size. News is queued at grade 'd', and file transfers at grade
-'n'. The example above would allow mail (below some large size) to be
-received at any time, but would only permit news to be transferred at
-night.
-
-------------------------------
-
-From: UUCP-lock-file
-Subject: What is the format of a UUCP lock file?
-
-This discussion applies only to Unix. I have no idea how UUCP locks
-ports on other systems.
-
-UUCP creates files to lock serial ports and systems. On most if not
-all systems these same lock files are also used by cu to coordinate
-access to serial ports. On some systems getty also uses these lock
-files, often under the name uugetty.
-
-The lock file normally contains the process ID of the locking process.
-This makes it easy to determine whether a lock is still valid. The
-algorithm is to create a temporary file and then link it to the name
-that must be locked. If the link fails because a file with that name
-already exists, the existing file is read to get the process ID. If
-the process still exists, the lock attempt fails. Otherwise the lock
-file is deleted and the locking algorithm is retried.
-
-Older UUCP packages put the lock files in the main UUCP spool
-directory, /usr/spool/uucp. HDB UUCP generally puts the lock files in
-a directory of their own, usually /usr/spool/locks or /etc/locks.
-
-The original UUCP lock file format encodes the process ID as a four
-byte binary number. The order of the bytes is host-dependent. HDB
-UUCP stores the process ID as a ten byte ASCII decimal number, with a
-trailing newline. For example, if process 1570 holds a lock file, it
-would contain the eleven characters space, space, space, space, space,
-space, one, five, seven, zero, newline. Some versions of UUCP add a
-second line indicating which program created the lock (uucp, cu, or
-getty/uugetty). I have also seen a third type of UUCP lock file which
-does not contain the process ID at all.
-
-The name of the lock file is traditionally "LCK.." followed by the
-base name of the device. For example, to lock /dev/ttyd0 the file
-LCK..ttyd0 would be created. On SCO Unix, the lock file name is
-always forced to lower case even if the device name has upper case
-letters.
-
-System V Release 4 UUCP names the lock file using the major and minor
-device numbers rather than the device name. The file is named
-LK.XXX.YYY.ZZZ, where XXX, YYY and ZZZ are all three digit decimal
-numbers. XXX is the major device number of the device holding the
-directory holding the device file (e.g., /dev). YYY is the major
-device number of the device file itself. ZZZ is the minor device
-number of the device file itself. If s holds the result of passing
-the device to the stat system call (e.g., stat ("/dev/ttyd0", &s)),
-the following line of C code will print out the corresponding lock
-file name:
- printf ("LK.%03d.%03d.%03d", major (s.st_dev),
- major (s.st_rdev), minor (s.st_rdev));
-The advantage of this system is that even if there are several links
-to the same device, they will all use the same lock file name.
-
-------------------------------
-
-From: X-file
-Subject: What is the format of a UUCP X.* file?
-
-UUCP X.* files control program execution. They are created by uux.
-They are transferred between computers just like any other file. The
-uuxqt daemon reads them to figure out how to execute the job requested
-by uux.
-
-An X.* file is simply a text file. The first character of each line
-is a command, and the remainder of the line supplies arguments. The
-following commands are defined:
- C command
- This gives the command to execute, including the program and
- all arguments. For example,
- C rmail ian@airs.com
- U user system
- This names the user who requested the command, and the system
- from which the request came.
- I standard-input
- This names the file from which standard input is taken. If no
- standard input file is given, the standard input will probably
- be attached to /dev/null. If the standard input file is not
- from the system on which the execution is to occur, it will
- also appear in an F command.
- O standard-output [ system ]
- This names the standard output file. The optional second
- argument names the system to which the file should be sent.
- If there is no second argument, the file should be created on
- the executing system.
- F required-file [ filename-to-use ]
- The F command can appear multiple times. Each F command names
- a file which must exist before the execution can proceed.
- This will usually be a file which is transferred from the
- system on which uux was executed, but it can also be a file
- from the local system or some other system. If the file is
- not from the local system, then the command will usually name
- a file in the spool directory. If the optional second
- argument appears, then the file should be copied to the
- execution directory under that name. This is necessary for
- any file other than the standard input file. If the standard
- input file is not from the local system, it will appear in
- both an F command and an I command.
- R requestor-address
- This is the address to which mail about the job should be
- sent. It is relative to the system named in the U command.
- If the R command does not appear, then mail is sent to the
- user named in the U command.
- Z
- This command takes no arguments. It means that a mail message
- should be sent if the command failed. This is the default
- behaviour for most modern UUCP packages, and for them the Z
- command does not actually do anything.
- N
- This command takes no arguments. It means that no mail
- message should be sent, even if the command failed.
- n
- This command takes no arguments. It means that a mail message
- should be sent if the command succeeded. Normally a message
- is sent only if the command failed.
- B
- This command takes no arguments. It means that the standard
- input should be returned with any error message. This can be
- useful in cases where the input would otherwise be lost.
- e
- This command takes no arguments. It means that the command
- should be processed with /bin/sh. For some packages this is
- the default anyhow. Most packages will refuse to execute
- complex commands or commands containing wildcards, because of
- the security holes this opens.
- E
- This command takes no arguments. It means that the command
- should be processed with the execve system call. For some
- packages this is the default anyhow.
- M status-file
- This command means that instead of mailing a message, the
- message should be copied to the named file on the system named
- by the U command.
- # comment
- This command is ignored, as is any other unrecognized command.
-
-Here is an example. Given the following command executed on system
-test1
- uux - test2!cat - test2!~ian/bar !qux '>~/gorp'
-(this is only an example, as most UUCP systems will not permit the cat
-command to be executed) Taylor UUCP will produce the following X.
-file:
- U ian test1
- F D.test1N003r qux
- O /usr/spool/uucppublic test1
- F D.test1N003s
- I D.test1N003s
- C cat - ~ian/bar qux
-The standard input will be read into a file and then transferred to
-the file D.test1N003s on system test2, and the file qux will be
-transferred to D.test1N003r on system test2. When the command is
-executed, the latter file will be copied to the execution directory
-under the name qux. Note that since the file ~ian/bar is already on
-the execution system, no action need be taken for it. The standard
-output will be collected in a file, then copied to the directory
-/usr/spool/uucppublic on the system test1.
-
-------------------------------
-
-From: UUCP-protocol
-Subject: What is the UUCP protocol?
-
-The UUCP protocol is a conversation between two UUCP packages. A UUCP
-conversation consists of three parts: an initial handshake, a series
-of file transfer requests, and a final handshake.
-
-Before the initial handshake, the caller will usually have logged in
-the called machine and somehow started the UUCP package there. On
-Unix this is normally done by setting the shell of the login name used
-to /usr/lib/uucp/uucico.
-
-All messages in the initial handshake begin with a ^P (a byte with the
-octal value \020) and end with a null byte (\000). A few systems end
-these messages with a line feed character (\012) instead of a null
-byte; the examples below assume a null byte is being used.
-
-Some options below are supported by QFT, which stands for Queued File
-Transfer, and is (or was) an internal Bell Labs version of UUCP.
-
-Taylor UUCP size negotiation was introduced by Taylor UUCP, and is
-also supported by DOS based FSUUCP and Amiga based wUUCP and
-UUCP-1.17.
-
-The initial handshake goes as follows. It is begun by the called
-machine.
-
-called: \020Shere=hostname\000
- The hostname is the UUCP name of the called machine. Older UUCP
- packages do not output it, and simply send \020Shere\000.
-
-caller: \020Shostname options\000
- The hostname is the UUCP name of the calling machine. The
- following options may appear (or there may be none):
- -QSEQ
- Report sequence number for this conversation. The
- sequence number is stored at both sites, and incremented
- after each call. If there is a sequence number mismatch,
- something has gone wrong (somebody may have broken
- security by pretending to be one of the machines) and the
- call is denied. If the sequence number changes on one of
- the machines, perhaps because of an attempted breakin or
- because a disk backup was restored, the sequence numbers
- on the two machines must be reconciled manually. This is
- not supported by FSUUCP.
- -xLEVEL
- Requests the called system to set its debugging level to
- the specified value. This is not supported by all
- systems.
- -pGRADE
- -vgrade=GRADE
- Requests the called system to only transfer files of the
- specified grade or higher. This is not supported by all
- systems. Some systems support -p, some support -vgrade=.
- -R
- Indicates that the calling UUCP understands how to restart
- failed file transmissions. Supported only by System V
- Release 4 UUCP and QFT.
- -ULIMIT
- Reports the ulimit value of the calling UUCP. The limit
- is specified as a base 16 number in C notation (e.g.,
- -U0x1000000). This number is the number of 512 byte
- blocks in the largest file which the calling UUCP can
- create. The called UUCP may not transfer a file larger
- than this. Supported only by System V Release 4 UUCP, QFT
- and FSUUCP. FSUUCP reports the lesser of the
- available disk space on the spool directory drive and the
- ulimit variable in FSUUCP.CFG.
- -N
- Indicates that the calling UUCP understands the Taylor
- UUCP size negotiation extension. Not supported by
- traditional UUCP packages.
-
-called: \020ROK\000
- There are actually several possible responses.
- ROK
- The calling UUCP is acceptable, and the handshake proceeds
- to the protocol negotiation. Some options may also
- appear; see below.
- ROKN
- The calling UUCP is acceptable, it specified -N, and the
- called UUCP also understands the Taylor UUCP size limiting
- extensions.
- RLCK
- The called UUCP already has a lock for the calling UUCP,
- which normally indicates the two machines are already
- communicating.
- RCB
- The called UUCP will call back. This may be used to avoid
- impostors (but only one machine out of each pair should
- call back, or no conversation will ever begin).
- RBADSEQ
- The call sequence number is wrong (see the -Q discussion
- above).
- RLOGIN
- The calling UUCP is using the wrong login name.
- RYou are unknown to me
- The calling UUCP is not known to the called UUCP, and the
- called UUCP does not permit connections from unknown
- systems. Some versions of UUCP just drop the line rather
- than sending this message.
-
- If the response is ROK, the following options are supported by
- System V Release 4 UUCP and QFT.
- -R
- The called UUCP knows how to restart failed file
- transmissions.
- -ULIMIT
- Reports the ulimit value of the called UUCP. The limit is
- specified as a base 16 number in C notation. This number
- is the number of 512 byte blocks in the largest file which
- the called UUCP can create. The calling UUCP may not send
- a file larger than this. Also supported by FSUUCP.
- -xLEVEL
- I'm not sure just what this means. It may request the
- calling UUCP to set its debugging level to the specified
- value.
- If the response is not ROK (or ROKN) both sides hang up the phone,
- abandoning the call.
-
-called: \020Pprotocols\000
- Note that the called UUCP outputs two strings in a row. The
- protocols string is a list of UUCP protocols supported by the
- caller. Each UUCP protocol has a single character name. These
- protocols are discussed in more detail later in this document.
- For example, the called UUCP might send \020Pgf\000.
-
-caller: \020Uprotocol\000
- The calling UUCP selects which protocol to use out of the
- protocols offered by the called UUCP. If there are no mutually
- supported protocols, the calling UUCP sends \020UN\000 and both
- sides hang up the phone. Otherwise the calling UUCP sends
- something like \020Ug\000.
-
-Most UUCP packages will consider each locally supported protocol in
-turn and select the first one supported by the called UUCP. With some
-versions of HDB UUCP, this can be modified by giving a list of
-protocols after the device name in the Devices file or the Systems
-file. For example, to select the 'e' protocol in Systems,
- airs Any ACU,e ...
-or in Devices,
- ACU,e ttyXX ...
-Taylor UUCP provides the ``protocol'' command which may be used either
-for a system or a port.
-
-After the protocol has been selected and the initial handshake has been
-completed, both sides turn on the selected protocol. For some
-protocols (notably 'g') a further handshake is done at this point.
-
-Each protocol supports a method for sending a command to the remote
-system. This method is used to transmit a series of commands between
-the two UUCP packages. At all times, one package is the master and
-the other is the slave. Initially, the calling UUCP is the master.
-
-If a protocol error occurs during the exchange of commands, both sides
-move immediately to the final handshake.
-
-The master will send one of four commands: S, R, X or H.
-
-Any file name referred to below is either an absolute pathname
-beginning with "/", a public directory pathname beginning with "~/", a
-pathname relative to a user's home directory beginning with "~USER/",
-or a spool directory file name. File names in the spool directory are
-not pathnames, but instead are converted to pathnames within the spool
-directory by UUCP. They always begin with "C." (for a command file
-created by uucp or uux), "D." (for a data file created by uucp, uux or
-by an execution, or received from another system for an execution), or
-"X." (for an execution file created by uux or received from another
-system).
-
-master: S FROM TO USER -OPTIONS TEMP MODE NOTIFY SIZE
- The S and the - are literal characters. This is a request by the
- master to send a file to the slave.
- FROM
- The name of the file to send. If the C option does not
- appear in OPTIONS, the master will actually open and send
- this file. Otherwise the file has been copied to the
- spool directory, where it is named TEMP. The slave
- ignores this field unless TO is a directory, in which case
- the basename of FROM will be used as the file name. If
- FROM is a spool directory filename, it must be a data file
- created for or by an execution, and must begin with "D.".
- TO
- The name to give the file on the slave. If this field
- names a directory the file is placed within that directory
- with the basename of FROM. A name ending in `/' is taken
- to be a directory even if one does not already exist with
- that name. If TO begins with `X.', an execution file will
- be created on the slave. Otherwise, if TO begins with
- `D.' it names a data file to be used by some execution
- file. Otherwise, TO should not be in the spool directory.
- USER
- The name of the user who requested the transfer.
- OPTIONS
- A list of options to control the transfer. The following
- options are defined (all options are single characters):
- C
- The file has been copied to the spool directory
- (the master should use TEMP rather than FROM).
- c
- The file has not been copied to the spool
- directory (this is the default).
- d
- The slave should create directories as necessary
- (this is the default).
- f
- The slave should not create directories if
- necessary, but should fail the transfer instead.
- m
- The master should send mail to USER when the
- transfer is complete (not supported by FSUUCP).
- n
- The slave should send mail to NOTIFY when the
- transfer is complete (not supported by FSUUCP).
- TEMP
- If the C option appears in OPTIONS, this names the file to
- be sent. Otherwise if FROM is in the spool directory,
- TEMP is the same as FROM. Otherwise TEMP may be a dummy
- string, such as "D.0". After the transfer has been
- succesfully completed, the master will delete the file
- TEMP.
- MODE
- This is an octal number giving the mode of the file on
- MASTER. If the file is not in the spool directory, the
- slave will always create it with mode 0666, except that if
- (MODE & 0111) is not zero (the file is executable), the
- slave will create the file with mode 0777. If the file is
- in the spool directory, some UUCP packages will use the
- algorithm above and some will always create the file with
- mode 0600. This field is not used by FSUUCP, since it is
- meaningless on DOS.
- NOTIFY
- This field may not be present, and in any case is only
- meaningful if the n option appears in OPTIONS. If the n
- option appears, then when the transfer is successfully
- completed, the slave will send mail to NOTIFY, which must
- be a legal mailing address on the slave. If a SIZE field
- will appear but the n option does not appear, NOTIFY will
- always be present, typically as the string "dummy" or
- simply a pair of double quotes.
- SIZE
- This field is only present when doing Taylor UUCP or SVR4
- UUCP size negotiation, It is the size of the file in
- bytes. Taylor UUCP version 1.03 sends the size as a
- decimal integer, while versions 1.04 and up, and all other
- UUCP packages that support size negotiation, send the size
- in base 16 with a leading 0x.
-
- The slave then responds with an S command response.
- SY START
- The slave is willing to accept the file, and file transfer
- begins. The START field will only be present when using
- file restart. It specifies the byte offset into the file
- at which to start sending. If this is a new file, START
- will be 0x0.
- SN2
- The slave denies permission to transfer the file. This
- can mean that the destination directory may not be
- accessed, or that no requests are permitted. It implies
- that the file transfer will never succeed.
- SN4
- The slave is unable to create the necessary temporary
- file. This implies that the file transfer might succeed
- later.
- SN6
- This is only used by Taylor UUCP size negotiation. It
- means that the slave considers the file too large to
- transfer at the moment, but it may be possible to transfer
- it at some other time.
- SN7
- This is only used by Taylor UUCP size negotiation. It
- means that the slave considers the file too large to ever
- transfer.
- SN8
- This is only used by Taylor UUCP. It means that the file
- was already received in a previous conversation. This can
- happen if the receive acknowledgement was lost after it
- was sent by the receiver but before it was received by the
- sender.
- SN9
- This is only used by Taylor UUCP (versions 1.05 and up)
- and FSUUCP (versions 1.5 and up). It means that the
- remote system was unable to open another channel (see the
- discussion of the 'i' protocol for more information about
- channels). This implies that the file transfer might
- succeed later.
- SN10
- This is reportedly used by SVR4 UUCP to mean that the file
- size is too large.
-
- If the slave responds with SY, a file transfer begins. When the
- file transfer is complete, the slave sends a C command response.
- CY
- The file transfer was successful.
- CYM
- The file transfer was successful, and the slave wishes to
- become the master; the master should send an H command,
- described below.
- CN5
- The temporary file could not be moved into the final
- location. This implies that the file transfer will never
- succeed.
-
- After the C command response has been received (in the SY case) or
- immediately (in an SN case) the master will send another command.
-
-master: R FROM TO USER -OPTIONS SIZE
- The R and the - are literal characters. This is a request by the
- master to receive a file from the slave. I do not know how SVR4
- UUCP or QFT implement file transfer restart in this case.
- FROM
- This is the name of the file on the slave which the master
- wishes to receive. It must not be in the spool directory,
- and it may not contain any wildcards.
- TO
- This is the name of the file to create on the master. I
- do not believe that it can be a directory. It may only be
- in the spool directory if this file is being requested to
- support an execution either on the master or on some
- system other than the slave.
- USER
- The name of the user who requested the transfer.
- OPTIONS
- A list of options to control the transfer. The following
- options are defined (all options are single characters):
- d
- The master should create directories as necessary
- (this is the default).
- f
- The master should not create directories if
- necessary, but should fail the transfer instead.
- m
- The master should send mail to USER when the
- transfer is complete.
- SIZE
- This only appears if Taylor UUCP size negotiation is being
- used. It specifies the largest file which the master is
- prepared to accept (when using SVR4 UUCP or QFT, this was
- specified in the -U option during the initial handshake).
-
- The slave then responds with an R command response. FSUUCP does
- not support R requests, and always responds with RN2.
- RY MODE [ SIZE ]
- The slave is willing to send the file, and file transfer
- begins. MODE is the octal mode of the file on the slave.
- The master treats this just as the slave does the MODE
- argument in the send command, q.v. I am told that SVR4
- UUCP sends a trailing SIZE argument. For some versions of
- BSD UUCP, the MODE argument may have a trailing M
- character (e.g., RY 0666M). This means that the slave
- wishes to become the master.
- RN2
- The slave is not willing to send the file, either because
- it is not permitted or because the file does not exist.
- This implies that the file request will never succeed.
- RN6
- This is only used by Taylor UUCP size negotiation. It
- means that the file is too large to send, either because
- of the size limit specifies by the master or because the
- slave considers it too large. The file transfer might
- succeed later, or it might not (this will be cleared up in
- a later release of Taylor UUCP).
- RN9
- This is only used by Taylor UUCP (versions 1.05 and up)
- and FSUUCP (versions 1.5 and up). It means that the
- remote system was unable to open another channel (see the
- discussion of the 'i' protocol for more information about
- channels). This implies that the file transfer might
- succeed later.
-
- If the slave responds with RY, a file transfer begins. When the
- file transfer is complete, the master sends a C command. The
- slave pretty much ignores this, although it may log it.
- CY
- The file transfer was successful.
- CN5
- The temporary file could not be moved into the final
- location.
-
- After the C command response has been sent (in the RY case) or
- immediately (in an RN case) the master will send another command.
-
-master: X FROM TO USER -OPTIONS
- The X and the - are literal characters. This is a request by the
- master to, in essence, execute uucp on the slave. The slave
- should execute "uucp FROM TO".
- FROM
- This is the name of the file or files on the slave which
- the master wishes to transfer. Any wildcards are expanded
- on the slave. If the master is requesting that the files
- be transferred to itself, the request would normally
- contain wildcard characters, since otherwise an `R'
- command would suffice. The master can also use this
- command to request that the slave transfer files to a
- third system.
- TO
- This is the name of the file or directory to which the
- files should be transferred. This will normally use a
- UUCP name. For example, if the master wishes to receive
- the files itself, it would use "master!path".
- USER
- The name of the user who requested the transfer.
- OPTIONS
- A list of options to control the transfer. It is not
- clear which, if any, options are supported by most UUCP
- packages.
-
- The slave then responds with an X command response. FSUUCP does
- not support X requests, and always responds with XN.
- XY
- The request was accepted, and the appropriate file
- transfer commands have been queued up for later
- processing.
- XN
- The request was denied. No particular reason is given.
-
- In either case, the master will then send another command.
-
-master: H
- This is used by the master to hang up the connection. The slave
- will respond with an H command response.
- HY
- The slave agrees to hang up the connection. In this case
- the master sends another HY command. In some UUCP
- packages the slave will then send a third HY command. At
- this point the protocol is shut down, and the final
- handshake is begun.
- HN
- The slave does not agree to hang up. In this case the
- master and the slave exchange roles. The next command
- will be sent by the former slave, which is the new master.
- The roles may be reversed several times during a single
- connection.
-
-After the protocol has been shut down, the final handshake is
-performed. This handshake has no real purpose, and some UUCP packages
-simply drop the connection rather than do it (in fact, some will drop
-the connection immediately after both sides agree to hangup, without
-even closing down the protocol).
-
-caller: \020OOOOOO\000
-called: \020OOOOOOO\000
-
-That is, the calling UUCP sends six O's and the called UUCP replies
-with seven O's. Some UUCP packages always send six O's.
-
-------------------------------
-
-From: UUCP-g
-Subject: What is the 'g' protocol?
-
-The 'g' protocol is a packet based flow controlled error correcting
-protocol that requires an eight bit clear connection. It is the
-original UUCP protocol, and is supported by all UUCP implementations.
-Many implementations of it are only able to support small window and
-packet sizes, specifically a window size of 3 and a packet size of 64
-bytes, but the protocol itself can support up to a window size of 7
-and a packet size of 4096 bytes. Complaints about the inefficiency of
-the 'g' protocol generally refer to specific implementations, rather
-than to the correctly implemented protocol.
-
-The 'g' protocol was originally designed for general packet drivers,
-and thus contains some features that are not used by UUCP, including
-an alternate data channel and the ability to renegotiate packet and
-window sizes during the communication session.
-
-The 'g' protocol is spoofed by many Telebit modems. When spoofing is
-in effect, each Telebit modem uses the 'g' protocol to communicate
-with the attached computer, but the data between the modems is sent
-using a Telebit proprietary error correcting protocol. This allows
-for very high throughput over the Telebit connection, which, because
-it is half-duplex, would not normally be able to handle the 'g'
-protocol very well at all. When a Telebit is spoofing the 'g'
-protocol, it forces the packet size to be 64 bytes and the window size
-to be 3.
-
-This discussion of the 'g' protocol explains how it works, but does
-not discuss useful error handling techniques. Some discussion of this
-can be found in Jamie E. Hanrahan's paper, cited above.
-
-All 'g' protocol communication is done with packets. Each packet
-begins with a six byte header. Control packets consist only of the
-header. Data packets contain additional data.
-
-The header is as follows:
-
- \020
- Every packet begins with a ^P.
- k (1 <= k <= 9)
- The k value is always 9 for a control packet. For a data
- packet, the k value indicates how much data follows the six
- byte header. The amount of data is 2 ** (k + 4), where **
- indicates exponentiation. Thus a k value of 1 means 32 data
- bytes and a k value of 8 means 4096 data bytes. The k value
- for a data packet must be between 1 and 8 inclusive.
- checksum low byte
- checksum high byte
- The checksum value is described below.
- control byte
- The control byte indicates the type of packet, and is
- described below.
- xor byte
- This byte is the xor of k, the checksum low byte, the checksum
- high byte and the control byte (i.e., the second, third,
- fourth and fifth header bytes). It is used to ensure that the
- header data is valid.
-
-The control byte in the header is composed of three bit fields,
-referred to here as TT (two bits), XXX (three bits) and YYY (three
-bits). The control is TTXXXYYY, or (TT << 6) + (XXX << 3) + YYY.
-
-The TT field takes on the following values:
- 0
- This is a control packet. In this case the k byte in the
- header must be 9. The XXX field indicates the type of control
- packet; these types are described below.
- 1
- This is an alternate data channel packet. This is not used by
- UUCP.
- 2
- This is a data packet, and the entire contents of the attached
- data field (whose length is given by the k byte in the header)
- are valid. The XXX and YYY fields are described below.
- 3
- This is a short data packet. Let the length of the data field
- (as given by the k byte in the header) be L. Let the first
- byte in the data field be B1. If B1 is less than 128 (if the
- most significant bit of B1 is 0), then there are L - B1 valid
- bytes of data in the data field, beginning with the second
- byte. If B1 >= 128, let B2 be the second byte in the data
- field. Then there are L - ((B1 & 0x7f) + (B2 << 7)) valid
- bytes of data in the data field, beginning with the third
- byte. In all cases L bytes of data are sent (and all data
- bytes participate in the checksum calculation) but some of the
- trailing bytes may be dropped by the receiver. The XXX and
- YYY fields are described below.
-
-In a data packet (short or not) the XXX field gives the sequence
-number of the packet. Thus sequence numbers can range from 0 to 7,
-inclusive. The YYY field gives the sequence number of the last
-correctly received packet.
-
-Each communication direction uses a window which indicates how many
-unacknowledged packets may be transmitted before waiting for an
-acknowledgement. The window may range from 1 to 7, and may be
-different in each direction. For example, if the window is 3 and the
-last packet acknowledged was packet number 6, packet numbers 7, 0 and
-1 may be sent but the sender must wait for an acknowledgement before
-sending packet number 2. This acknowledgement could come as the YYY
-field of a data packet or as the YYY field of a RJ or RR control
-packet (described below).
-
-Each packet must be transmitted in order (the sender may not skip
-sequence numbers). Each packet must be acknowledged, and each packet
-must be acknowledged in order.
-
-In a control packet, the XXX field takes on the following values:
- 1 CLOSE
- The connection should be closed immediately. This is
- typically sent when one side has seen too many errors and
- wants to give up. It is also sent when shutting down the
- protocol. If an unexpected CLOSE packet is received, a CLOSE
- packet should be sent in reply and the 'g' protocol should
- halt, causing UUCP to enter the final handshake.
- 2 RJ or NAK
- The last packet was not received correctly. The YYY field
- contains the sequence number of the last correctly received
- packet.
- 3 SRJ
- Selective reject. The YYY field contains the sequence number
- of a packet that was not received correctly, and should be
- retransmitted. This is not used by UUCP, and most
- implementations will not recognize it.
- 4 RR or ACK
- Packet acknowledgement. The YYY field contains the sequence
- number of the last correctly received packet.
- 5 INITC
- Third initialization packet. The YYY field contains the
- maximum window size to use.
- 6 INITB
- Second initialization packet. The YYY field contains the
- packet size to use. It requests a size of 2 ** (YYY + 5).
- Note that this is not the same coding used for the k byte in
- the packet header (it is 1 less). Most UUCP implementations
- that request a packet size larger than 64 bytes can handle any
- packet size up to that specified.
- 7 INITA
- First initialization packet. The YYY field contains the
- maximum window size to use.
-
-The checksum of a control packet is simply 0xaaaa - the control byte.
-
-The checksum of a data packet is 0xaaaa - (CHECK ^ the control byte),
-where ^ denotes exclusive or, and CHECK is the result of the following
-routine as run on the contents of the data field (every byte in the
-data field participates in the checksum, even for a short data
-packet). Below is the routine used by Taylor UUCP; it is a slightly
-modified version of a routine which John Gilmore patched from G.L.
-Chesson's original paper. The z argument points to the data and the c
-argument indicates how much data there is.
-
-int
-igchecksum (z, c)
- register const char *z;
- register int c;
-{
- register unsigned int ichk1, ichk2;
-
- ichk1 = 0xffff;
- ichk2 = 0;
-
- do
- {
- register unsigned int b;
-
- /* Rotate ichk1 left. */
- if ((ichk1 & 0x8000) == 0)
- ichk1 <<= 1;
- else
- {
- ichk1 <<= 1;
- ++ichk1;
- }
-
- /* Add the next character to ichk1. */
- b = *z++ & 0xff;
- ichk1 += b;
-
- /* Add ichk1 xor the character position in the buffer counting from
- the back to ichk2. */
- ichk2 += ichk1 ^ c;
-
- /* If the character was zero, or adding it to ichk1 caused an
- overflow, xor ichk2 to ichk1. */
- if (b == 0 || (ichk1 & 0xffff) < b)
- ichk1 ^= ichk2;
- }
- while (--c > 0);
-
- return ichk1 & 0xffff;
-}
-
-When the 'g' protocol is started, the calling UUCP sends an INITA
-control packet with the window size it wishes the called UUCP to use.
-The called UUCP responds with an INITA packet with the window size it
-wishes the calling UUCP to use. Pairs of INITB and INITC packets are
-then similarly exchanged. When these exchanges are completed, the
-protocol is considered to have been started.
-
-Note that the window and packet sizes are not a negotiation. Each
-system announces the window and packet size which the other system
-should use. It is possible that different window and packet sizes
-will be used in each direction. The protocol works this way on the
-theory that each system knows how much data it can accept without
-getting overrun. Therefore, each system tells the other how much data
-to send before waiting for an acknowledgement.
-
-When a UUCP package transmits a command, it sends one or more data
-packets. All the data packets will normally be complete, although
-some UUCP packages may send the last one as a short packet. The
-command string is sent with a trailing null byte, to let the receiving
-package know when the command is finished. Some UUCP packages require
-the last byte of the last packet sent to be null, even if the command
-ends earlier in the packet. Some packages may require all the
-trailing bytes in the last packet to be null, but I have not confirmed
-this.
-
-When a UUCP package sends a file, it will send a sequence of data
-packets. The end of the file is signalled by a short data packet
-containing zero valid bytes (it will normally be preceeded by a short
-data packet containing the last few bytes in the file).
-
-Note that the sequence numbers cover the entire communication session,
-including both command and file data.
-
-When the protocol is shut down, each UUCP package sends a CLOSE
-control packet.
-
-------------------------------
-
-From: UUCP-f
-Subject: What is the 'f' protocol?
-
-The 'f' protocol is a seven bit protocol which checksums an entire
-file at a time. It only uses the characters between \040 and \176
-(ASCII space and ~) inclusive as well as the carriage return
-character. It can be very efficient for transferring text only data,
-but it is very inefficient at transferring eight bit data (such as
-compressed news). It is not flow controlled, and the checksum is
-fairly insecure over large files, so using it over a serial connection
-requires handshaking (XON/XOFF can be used) and error correcting
-modems. Some people think it should not be used even under those
-circumstances.
-
-I believe the 'f' protocol originated in BSD versions of UUCP. It was
-originally intended for transmission over X.25 PAD links.
-
-The 'f' protocol has no startup or finish protocol. However, both
-sides typically sleep for a couple of seconds before starting up,
-because they switch the terminal into XON/XOFF mode and want to allow
-the changes to settle before beginning transmission.
-
-When a UUCP package transmits a command, it simply sends a string
-terminated by a carriage return.
-
-When a UUCP package transmits a file, each byte b of the file is
-translated according to the following table:
-
- 0 <= b <= 037: 0172, b + 0100 (0100 to 0137)
- 040 <= b <= 0171: b ( 040 to 0171)
- 0172 <= b <= 0177: 0173, b - 0100 ( 072 to 077)
- 0200 <= b <= 0237: 0174, b - 0100 (0100 to 0137)
- 0240 <= b <= 0371: 0175, b - 0200 ( 040 to 0171)
- 0372 <= b <= 0377: 0176, b - 0300 ( 072 to 077)
-
-That is, a byte between \040 and \171 inclusive is transmitted as is,
-and all other bytes are prefixed and modified as shown.
-
-When all the file data is sent, a seven byte sequence is sent: two
-bytes of \176 followed by four ASCII bytes of the checksum as printed
-in base 16 followed by a carriage return. For example, if the
-checksum was 0x1234, this would be sent: "\176\1761234\r".
-
-The checksum is initialized to 0xffff. For each byte that is sent it
-is modified as follows (where b is the byte before it has been
-transformed as described above):
-
- /* Rotate the checksum left. */
- if ((ichk & 0x8000) == 0)
- ichk <<= 1;
- else
- {
- ichk <<= 1;
- ++ichk;
- }
-
- /* Add the next byte into the checksum. */
- ichk += b;
-
-When the receiving UUCP sees the checksum, it compares it against its
-own calculated checksum and replies with a single character followed
-by a carriage return.
- G
- The file was received correctly.
- R
- The checksum did not match, and the file should be resent from
- the beginning.
- Q
- The checksum did not match, but too many retries have occurred
- and the communication session should be abandoned.
-
-The sending UUCP checks the returned character and acts accordingly.
-
-------------------------------
-
-From: UUCP-t
-Subject: What is the 't' protocol?
-
-The 't' protocol is intended for use on links which provide reliable
-end-to-end connections, such as TCP. It does no error checking or
-flow control, and requires an eight bit clear channel.
-
-I believe the 't' protocol originated in BSD versions of UUCP.
-
-When a UUCP package transmits a command, it first gets the length of
-the command string, C. It then sends ((C / 512) + 1) * 512 bytes (the
-smallest multiple of 512 which can hold C bytes plus a null byte)
-consisting of the command string itself followed by trailing null
-bytes.
-
-When a UUCP package sends a file, it sends it in blocks. Each block
-contains at most 1024 bytes of data. Each block consists of four
-bytes containing the amount of data in binary (most significant byte
-first, the same format as used by the Unix function htonl) followed by
-that amount of data. The end of the file is signalled by a block
-containing zero bytes of data.
-
-------------------------------
-
-From: UUCP-e
-Subject: What is the 'e' protocol?
-
-The 'e' protocol is similar to the 't' protocol. It does no flow
-control or error checking and is intended for use over networks
-providing reliable end-to-end connections, such as TCP.
-
-The 'e' protocol originated in versions of HDB UUCP.
-
-When a UUCP package transmits a command, it simply sends the command
-as an ASCII string terminated by a null byte.
-
-When a UUCP package transmits a file, it sends the complete size of
-the file as an ASCII decimal number. The ASCII string is padded out
-to 20 bytes with null bytes (i.e. if the file is 1000 bytes long, it
-sends "1000\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"). It then sends the
-entire file.
-
-------------------------------
-
-From: UUCP-G
-Subject: What is the 'G' protocol?
-
-The 'G' protocol is used by SVR4 UUCP. It is identical to the 'g'
-protocol, except that it is possible to modify the window and packet
-sizes. The SVR4 implementation of the 'g' protocol reportedly is
-fixed at a packet size of 64 and a window size of 7. Supposedly SVR4
-chose to implement a new protocol using a new letter to avoid any
-potential incompatibilities when using different packet or window
-sizes.
-
-Most implementations of the 'g' protocol that accept packets larger
-than 64 bytes will also accept packets smaller than whatever they
-requested in the INITB packet. The SVR4 'G' implementation is an
-exception; it will only accept packets of precisely the size it
-requests in the INITB packet.
-
-------------------------------
-
-From: UUCP-i
-Subject: What is the 'i' protocol?
-
-The 'i' protocol was written by Ian Lance Taylor (who also wrote this
-FAQ). It is used by Taylor UUCP version 1.04.
-
-It is a sliding window packet protocol, like the 'g' protocol, but it
-supports bidirectional transfers (i.e., file transfers in both
-directions simultaneously). It requires an eight bit clear
-connection. Several ideas for the protocol were taken from the paper
-``A High-Throughput Message Transport System'' by P. Lauder. I don't
-know where the paper was published, but the author's e-mail address is
-piers@cs.su.oz.au. The 'i' protocol does not adopt his main idea,
-which is to dispense with windows entirely. This is because some
-links still do require flow control and, more importantly, because
-using windows sets a limit to the amount of data which the protocol
-must be able to resend upon request. To reduce the costs of window
-acknowledgements, the protocol uses a large window and only requires
-an ack at the halfway point.
-
-Each packet starts with a six byte header, optionally followed by data
-bytes with a four byte checksum. There are currently five defined
-packet types (DATA, SYNC, ACK, NAK, SPOS, CLOSE) which are described
-below. Although any packet type may include data, any data provided
-with an ACK, NAK or CLOSE packet is ignored.
-
-Every DATA, SPOS and CLOSE packet has a sequence number. The sequence
-numbers are independent for each side. The first packet sent by each
-side is always number 1. Each packet is numbered one greater than the
-previous packet, modulo 32.
-
-Every packet has a local channel number and a remote channel number.
-For all packets at least one channel number is zero. When a UUCP
-command is sent to the remote system, it is assigned a non-zero local
-channel number. All packets associated with that UUCP command sent by
-the local system are given the selected local channel number. All
-associated packets sent by the remote system are given the selected
-number as the remote channel number. This permits each UUCP command
-to be uniquely identified by the channel number on the originating
-system, and therefore each UUCP package can associate all file data
-and UUCP command responses with the appropriate command. This is a
-requirement for bidirectional UUCP transfers.
-
-The protocol maintains a single global file position, which starts at
-0. For each incoming packet, any associated data is considered to
-occur at the current file position, and the file position is
-incremented by the amount of data contained. The exception is a
-packet of type SPOS, which is used to change the file position.
-The reason for keeping track of the file position is described below.
-
-The header is as follows:
-
- \007
- Every packet begins with ^G.
- (PACKET << 3) + LOCCHAN
- The five bit packet number combined with the three bit local
- channel number. DATA, SPOS and CLOSE packets use the packet
- sequence number for the PACKET field. NAK packet types use
- the PACKET field for the sequence number to be resent. ACK
- and SYNC do not use the PACKET field, and generally leave it
- set to 0. Packets which are not associated with a UUCP
- command from the local system use a local channel number of 0.
- (ACK << 3) + REMCHAN
- The five bit packet acknowledgement combined with the three
- bit remote channel number. The packet acknowledgement is the
- number of the last packet successfully received; it is used by
- all packet types. Packets which are not sent in response to a
- UUCP command from the remote system use a remote channel
- number of 0.
- (TYPE << 5) + (CALLER << 4) + LEN1
- The three bit packet type combined with the one bit packet
- direction combined with the upper four bits of the data
- length. The packet direction bit is always 1 for packets sent
- by the calling UUCP, and 0 for packets sent by the called
- UUCP. This prevents confusion caused by echoed packets.
- LEN2
- The lower eight bits of the data length. The twelve bits of
- data length permit packets ranging in size from 0 to 4095
- bytes.
- CHECK
- The exclusive or of the second through fifth bytes of the
- header. This provides an additional check that the header is
- valid.
-
-If the data length is non-zero, the packet is immediately followed by
-the specified number of data bytes. The data bytes are followed by a
-four byte CRC 32 checksum, with the most significant byte first. The
-CRC is calculated over the contents of the data field.
-
-The defined packet types are as follows:
-
- 0 (DATA)
- This is a plain data packet.
- 1 (SYNC)
- SYNC packets are exchanged when the protocol is initialized,
- and are described further below. SYNC packets do not carry
- sequence numbers (that is, the PACKET field is ignored).
- 2 (ACK)
- This is an acknowledgement packet. Since DATA packets also
- carry packet acknowledgements, ACK packets are only used when
- one side has no data to send. ACK packets do not carry
- sequence numbers.
- 3 (NAK)
- This is a negative acknowledgement. This is sent when a
- packet is received incorrectly, and means that the packet
- number appearing in the PACKET field must be resent. NAK
- packets do not carry sequence numbers (the PACKET field is
- already used).
- 4 (SPOS)
- This packet changes the file position. The packet contains
- four bytes of data holding the file position, most significant
- byte first. The next packet received will be considered to be
- at the named file position.
- 5 (CLOSE)
- When the protocol is shut down, each side sends a CLOSE
- packet. This packet does have a sequence number, which could
- be used to ensure that all packets were correctly received
- (this is not needed by UUCP, however, which uses the higher
- level H command with an HY response).
-
-When the protocol starts up, both systems send a SYNC packet. The
-SYNC packet includes at least three bytes of data. The first two
-bytes are the maximum packet size the remote system should send, most
-significant byte first. The third byte is the window size the remote
-system should use. The remote system may send packets of any size up
-to the maximum. If there is a fourth byte, it is the number of
-channels the remote system may use (this must be between 1 and 7,
-inclusive). Additional data bytes may be defined in the future.
-
-The window size is the number of packets that may be sent before a
-packet is acknowledged. There is no requirement that every packet be
-acknowledged; any acknowledgement is considered to acknowledge all
-packets through the number given. In the current implementation, if
-one side has no data to send, it sends an ACK when half the window is
-received.
-
-Note that the NAK packet corresponds to the unused 'g' protocol SRJ
-packet type, rather than to the RJ packet type. When a NAK is
-received, only the named packet should be resent, not any subsequent
-packets.
-
-Note that if both sides have data to send, but a packet is lost, it is
-perfectly reasonable for one side to continue sending packets, all of
-which will acknowledge the last packet correctly received, while the
-system whose packet was lost will be unable to send a new packet
-because the send window will be full. In this circumstance, neither
-side will time out and one side of the communication will be
-effectively shut down for a while. Therefore, any system with
-outstanding unacknowledged packets should arrange to time out and
-resend a packet even if data is being received.
-
-Commands are sent as a sequence of data packets with a non-zero local
-channel number. The last data packet for a command includes a
-trailing null byte (normally a command will fit in a single data
-packet). Files are sent as a sequence of data packets ending with one
-of length zero.
-
-The channel numbers permit a more efficient implementation of the UUCP
-file send command. Rather than send the command and then wait for the
-SY response before sending the file, the file data is sent beginning
-immediately after the S command is sent. If an SN response is
-received, the file send is aborted, and a final data packet of length
-zero is sent to indicate that the channel number may be reused. If an
-SY reponse with a file position indicator is received, the file send
-adjusts to the file position; this is why the protocol maintains a
-global file position.
-
-Note that the use of channel numbers means that each UUCP system may
-send commands and file data simultaneously. Moreover, each UUCP
-system may send multiple files at the same time, using the channel
-number to disambiguate the data. Sending a file before receiving an
-acknowledgement for the previous file helps to eliminate the round
-trip delays inherent in other UUCP protocols.
-
-------------------------------
-
-From: UUCP-j
-Subject: What is the 'j' protocol?
-
-The 'j' protocol is a variant of the 'i' protocol. It was also
-written by Ian Lance Taylor, and first appeared in Taylor UUCP version
-1.04.
-
-The 'j' protocol is a version of the 'i' protocol designed for
-communication links which intercept a few characters, such as XON or
-XOFF. It is not efficient to use it on a link which intercepts many
-characters, such as a seven bit link. The 'j' protocol performs no
-error correction or detection; that is presumed to be the
-responsibility of the 'i' protocol.
-
-When the 'j' protocol starts up, each system sends a printable ASCII
-string indicating which characters it wants to avoid using. The
-string begins with the ASCII character '^' (octal 136) and ends with
-the ASCII character '~' (octal 176). After sending this string, each
-system looks for the corresponding string from the remote system. The
-strings are composed of escape sequences: \ooo, where o is an octal
-digit. For example, sending the string ^\021\023~ means that the
-ASCII XON and XOFF characters should be avoided. The union of the
-characters described in both strings (the string which is sent and the
-string which is received) is the set of characters which must be
-avoided in this conversation. Avoiding a printable ASCII character
-(octal 040 to octal 176, inclusive) is not permitted.
-
-After the exchange of characters to avoid, the normal 'i' protocol
-start up is done, and the rest of the conversation uses the normal 'i'
-protocol. However, each 'i' protocol packet is wrapped to become a
-'j' protocol packet.
-
-Each 'j' protocol packet consists of a seven byte header, followed by
-data bytes, followed by index bytes, followed by a one byte trailer.
-The packet header looks like this:
-
- ^
- Every packet begins with the ASCII character '^', octal 136.
- HIGH
- LOW
- These two characters give the total number of bytes in the
- packet. Both HIGH and LOW are printable ASCII characters.
- The length of the packet is (HIGH - 040) * 0100 + (LOW - 040),
- where 040 <= HIGH < 0177 and 040 <= LOW < 0140. This permits
- a length of 6079 bytes, but there is a further restriction on
- packet size described below.
- =
- The ASCII character '=', octal 075.
- DATA-HIGH
- DATA-LOW
- These two characters give the total number of data bytes in
- the packet. The encoding is as described for HIGH and LOW.
- The number of data bytes is the size of the 'i' protocol
- packet wrapped inside this 'j' protocol packet.
- @
- The ASCII character '@', octal 100.
-
-The header is followed by the number of data bytes given in DATA-HIGH
-and DATA-LOW. These data bytes are the 'i' protocol packet which is
-being wrapped in the 'j' protocol packet. However, each character in
-the 'i' protocol packet which the 'j' protocol must avoid is
-transformed into a printable ASCII character (recall that avoiding a
-printable ASCII character is not permitted). Two index bytes are used
-for each character which must be transformed.
-
-The index bytes immediately follow the data bytes. The index bytes
-are created in pairs. Each pair of index bytes encodes the location
-of a character in the 'i' protocol packet which was transformed to
-become a printable ASCII character. Each pair of index bytes also
-encodes the precise transformation which was performed.
-
-When the sender finds a character which must be avoided, it will
-transform it using one or two operations. If the character is 0200 or
-greater, it will subtract 0200. If the resulting character is less
-than 020, or is equal to 0177, it will xor by 020. The result is
-a printable ASCII character.
-
-The zero based byte index of the character within the 'i' protocol
-packet is determined. This index is turned into a two byte printable
-ASCII index, INDEX-HIGH and INDEX-LOW, such that the index is
-(INDEX-HIGH - 040) * 040 + (INDEX-LOW - 040). INDEX-LOW is restricted
-such that 040 <= INDEX-LOW < 0100. INDEX-HIGH is not permitted to be
-0176, so 040 <= INDEX-HIGH < 0176. INDEX-LOW is then modified to
-encode the transformation:
-
- If the character transformation only had to subtract 0200, then
- INDEX-LOW is used as is.
-
- If the character transformation only had to xor by 020, then 040
- is added to INDEX-LOW.
-
- If both operations had to be performed, then 0100 is added to
- INDEX-LOW. However, if the value of INDEX-LOW were initially 077,
- then adding 0100 would result in 0177, which is not a printable
- ASCII character. For that special case, INDEX-HIGH is set to
- 0176, and INDEX-LOW is set to the original value of INDEX-HIGH.
-
-The receiver decodes the index bytes as follows (this is the reverse
-of the operations performed by the sender, presented here for
-additional clarity):
-
- The first byte in the index is INDEX-HIGH, and the second is
- INDEX-LOW.
-
- If 040 <= INDEX-HIGH < 0176, the index refers to the data byte at
- position (INDEX-HIGH - 040) * 040 + INDEX-LOW % 040.
-
- If 040 <= INDEX-LOW < 0100, then 0200 must be added to indexed
- byte.
-
- If 0100 <= INDEX-LOW < 0140, then 020 must be xor'ed to the
- indexed byte.
-
- If 0140 <= INDEX-LOW < 0177, then 0200 must be added to the
- indexed byte, and 020 must be xor'ed to the indexed byte.
-
- If INDEX-HIGH == 0176, the index refers to the data byte at
- position (INDEX-LOW - 040) * 040 + 037. 0200 must be added to the
- indexed byte, and 020 must be xor'ed to the indexed byte.
-
-This means the largest 'i' protocol packet which may be wrapped inside
-a 'j' protocol packet is (0175 - 040) * 040 + (077 - 040) == 3007
-bytes.
-
-The final character in a 'j' protocol packet, following the index
-bytes, is the ASCII character '~' (octal 176).
-
-The motivation behind using an indexing scheme, rather than escape
-characters, is to avoid data movement. The sender may simply add a
-header and a trailer to the 'i' protocol packet. Once the receiver
-has loaded the 'j' protocol packet, it may scan the index bytes,
-transforming the data bytes, and then pass the data bytes directly on
-to the 'i' protocol routine.
-
-------------------------------
-
-From: UUCP-x
-Subject: What is the 'x' protocol?
-
-The 'x' protocol is used in Europe (and probably elsewhere) with
-machines that contain an builtin X.25 card and can send eight bit data
-transparently across X.25 circuits, without interference from the X.28
-or X.29 layers. The protocol sends packets of 512 bytes, and relies
-on a write of zero bytes being read as zero bytes without stopping
-communication. It first appeared in the original System V UUCP
-implementation.
-
-------------------------------
-
-From: UUCP-y
-Subject: What is the 'y' protocol?
-
-The 'y' protocol was developed by Jorge Cwik for use in FX UUCICO, a
-PC uucico program. It is designed for communication lines which
-handle error correction and flow control. It is a streaming protocol,
-like the 'f' protocol. It requires an eight bit clean connection. It
-performs error detection, but not error correction; when an error is
-detected, the line is dropped. I do not know the implementation
-details.
-
-------------------------------
-
-From: UUCP-d
-Subject: What is the 'd' protocol?
-
-This is apparently used for DataKit muxhost (not RS-232) connections.
-No file size is sent. When a file has been completely transferred, a
-write of zero bytes is done; this must be read as zero bytes on the
-other end.
-
-------------------------------
-
-From: UUCP-h
-Subject: What is the 'h' protocol?
-
-This is apparently used in some places with HST modems. It does no
-error checking, and is not that different from the 't' protocol. I
-don't know the details.
-
-------------------------------
-
-From: UUCP-v
-Subject: What is the 'v' protocol?
-
-The 'v' protocol is used by UUPC/extended, a PC UUCP program. It is
-simply a version of the 'g' protocol which supports packets of any
-size, and also supports sending packets of different sizes during the
-same conversation. There are many 'g' protocol implementations which
-support both, but there are also many which do not. Using 'v' ensures
-that everything is supported.
-
-------------------------------
-
-From: Thanks
-Subject: Thanks
-
-Besides the papers and information acknowledged at the top of this
-article, the following people have contributed help, advice,
-suggestions and information:
- Earle Ake 513-429-6500 <ake@Dayton.SAIC.COM>
- cambler@nike.calpoly.edu (Christopher J. Ambler)
- jhc@iscp.bellcore.com (Jonathan Clark)
- jorge@laser.satlink.net (Jorge Cwik)
- celit!billd@UCSD.EDU (Bill Davidson)
- "Drew Derbyshire" <ahd@kew.com>
- erik@pdnfido.fidonet.org
- Matthew Farwell <dylan@ibmpcug.co.uk>
- dgilbert@gamiga.guelphnet.dweomer.org (David Gilbert)
- kherron@ms.uky.edu (Kenneth Herron)
- Mike Ipatow <mip@fido.itc.e-burg.su>
- Romain Kang <romain@pyramid.com>
- "Jonathan I. Kamens" <jik@GZA.COM>
- "David J. MacKenzie" <djm@eng.umd.edu>
- jum@helios.de (Jens-Uwe Mager)
- peter@xpoint.ruessel.sub.org (Peter Mandrella)
- david nugent <david@csource.oz.au>
- Stephen.Page@prg.oxford.ac.uk
- joey@tessi.UUCP (Joey Pruett)
- James Revell <revell@uunet.uu.net>
- Larry Rosenman <ler@lerami.lerctr.org>
- Rich Salz <rsalz@bbn.com>
- evesg@etlrips.etl.go.jp (Gjoen Stein)
- kls@ditka.Chicago.COM (Karl Swartz)
- Dima Volodin <dvv@hq.demos.su>
- jon@console.ais.org (Jon Zeeff)
- Eric Ziegast <ziegast@uunet.uu.net>
-
-------------------------------
-
-End of UUCP Internals Frequently Asked Questions
-******************************
---
-Ian Taylor | ian@airs.com | First to identify quote wins free e-mail message:
-``You don't have to sleep. That's just something *they* tell you to keep
- *control* over you. Nobody has to sleep; you're *taught* to sleep when
- you're a kid. If you're really determined, you can get over it.''
diff --git a/share/FAQ/Text/ctm.FAQ b/share/FAQ/Text/ctm.FAQ
deleted file mode 100644
index 9dc0d05..0000000
--- a/share/FAQ/Text/ctm.FAQ
+++ /dev/null
@@ -1,191 +0,0 @@
-# ----------------------------------------------------------------------------
-# "THE BEER-WARE LICENSE" (Revision 42):
-# <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
-# can do whatever you want with this stuff. If we meet some day, and you think
-# this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
-# ----------------------------------------------------------------------------
-#
-# $Id: ctm.FAQ,v 1.6 1995/03/16 22:03:09 phk Exp $
-#
-
- Obtaining FreeBSD-current sources using CTM.
- ============================================
-
-CTM is a method for keeping a remote directory tree in sync with a
-central one. It has been developed for usage with FreeBSD's source
-trees, though other people may find it useful for other purposes as
-time goes by. Little, if any, documentation currently exists at this
-time on the process of creating deltas so talk to phk@FreeBSD.org for
-more information should you wish to use CTM for other things.
-
-
-Why should I use CTM ?
-----------------------
-CTM will give you a local copy of the "FreeBSD-current" sources. If
-you are an active developer on FreeBSD, but have lousy or non-existent
-TCP/IP connectivity, CTM was made for you. You will need to transfer
-up to four deltas per day (or you can have them arrive in email
-automatically), the sizes for which are always kept as small as
-possible. This is typically less than 5K, with the occasional (one in
-ten) being 10-50K and every now and then a biggie of 100K+ or more
-coming around.
-
-You will also need to make yourself aware of the various caveats in
-running "current" sources, and for this it is recommended that you
-refer to the relevant FAQ: /usr/share/FAQ/current-policy.FAQ
-
-
-What do I need to use CTM?
---------------------------
-
-You will need two things: The "ctm" program and the initial deltas to
-feed it (to get up to "current" levels).
-
-The ctm program is in the FreeBSD-current tree from version 2.0.0 and
-forward (/usr/src/usr.sbin/ctm). If you are running an older version
-of FreeBSD, you can fetch the current ctm sources directly from:
-
- ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.sbin/ctm/
-
-The "deltas" you feed ctm can be had two ways, ftp or email. If you
-have general ftp access to the Internet, then the following ftp sites
-support access to CTM:
-
- ftp://freefall.cdrom.com/pub/CTM
-
-Ftp the the relevant directory and fetch the README file, starting
-from there.
-
-If you only have access to electronic mail or are otherwise blocked
-from using ftp, then you may wish to receive your deltas via email:
-
-Send email to majordomo@freebsd.org to subscribe to the list
-"ctm-src-cur" (if you do not know how to subscribe yourself using
-majordomo, send a message first containing the word `help' - it will
-send you back usage instructions).
-
-When you begin receiving your CTM updates in the mail, you may use the
-ctm_rmail program to unpack and apply them with. You can actually use
-the ctm_rmail program directly from a entry in /etc/aliases if you
-want. Check the "ctm_rmail" man page for more details.
-
-NOTE:
------
-
-No matter what method you use to get the CTM deltas, you should subscribe
-to the ctm-announce@freebsd.org mailing list. In the future this will be
-the only place where announcements about the operation of the CTM system
-will be posted. Send an email to majordomo@freebsd.org with a single
-line of "subscribe ctm-announce" to get added to the list.
-
-
-Starting off with CTM for the first time:
------------------------------------------
-
-Before you can start using CTM deltas, you will need to get a special
-"base" delta that provides a starting point for all deltas produced
-subsequently to it.
-
-You can recognize a base delta by the 'A' appended to the number
-(src-cur.0341A.gz for instance). As a rule a base delta is produced
-every 100 deltas, the next one will be src-cur.0400A.gz.
-By the way, they are large! 25 to 30 Megabytes of gzip'ed data is
-common for a base delta.
-
-If you do have the 2.0-RELEASE srcdist, you can instead retreive the
-src-cur.0372R20.gz file, it's only 4Mb and it will take you to current
-from the 2.0-RELEASE sources.
-
-Once you've picked a base delta to start from, you will also need all
-deltas with higher numbers following it.
-
-
-Using CTM in your daily life:
------------------------------
-
-To apply the deltas, simply say
-
- cd /where/ever/you/want/the/stuff
- ctm -v -v /where/you/store/your/deltas/src-cur.*
-
-CTM understands deltas which have been put through gzip, so you don't
-need to gunzip them first, this saves diskspace.
-
-Unless it feels very secure about the entire process, ctm will not
-touch your tree. To check out a delta you can also use the "-c" flag
-and CTM won't actually touch your tree, but only check the integrity
-of the delta, and see if it would apply cleanly to the tree.
-
-There are other options to ctm as well, look in the sources.
-
-I would also be very happy if somebody could help with the "user
-interface" portions, as I have realized that I can't make up my mind
-on what options should do what, how and when...
-
-That's really all there is to it. Everytime you get a new delta, you
-run it through ctm.
-
-Don't remove the deltas, if they are hard to download again. You just
-might want to keep them around in case something bad happens. Even if
-you only have floppy disks, consider using "fdwrite" to make a copy.
-
-
-Plans:
-------
-
-Tons of them:
-
- - Make local modifications to the tree possible. One way to do it
- could be this:
- When CTM wants to edit the file "foo/bar.c", it would first check
- for the existense of "foo/bar.c#ctm" If this file exists, the
- delta is applied to it instead. This way the foo/bar.c file can
- be edited to suit local needs.
- - Make a "restore file(s)" option to ctm, something like:
- ctm -r src/sys/i386/wd.c /here/are/my/deltas/src-cur.*
- would restore wd.c to the current status from the files.
- - Clean up the options to ctm, they became confusing and
- counter intuitive.
-
-The bad news is that I am very busy, so any help in doing this will be
-most welcome. And don't forget to tell me what you want also...
-
-
-Misc. stuff:
-------------
-
-All the "DES infected" (e.g. export controlled) source is not included.
-You will get the "international" version only. If sufficient interest
-appears, we will set up a "sec-cur" sequence too.
-
-If you are a frequent or valuable contributor to FreeBSD, I will be
-willing to arrange special services, one option is delivery via ftp or
-rcp to a machine closer to you. You need to have earned this, since
-it takes time to do, but I'll be all the more happy to do it for you
-then.
-
-There is a sequence of deltas for the ports collection too, but interest
-has not been all that high yet. Tell me if you want an email list for
-that too and we'll consider setting it up.
-
-If you have commit priviledges or are similary authorized by the
-FreeBSD core team, you can also get access to the CVS repository tree
-by the same means. Contact me (phk@FreeBSD.org) for details.
-
-
-Thanks!
--------
-
-Bruce Evans, for his pointed pen and invaluable comments.
-Soren Schmidt, for patience.
-Stephen McKay, wrote ctm_[rs]mail, much appreciated.
-Jordan Hubbard, for being so stubborn that I had to make it better.
-All the users, I hope you like it...
-
-Comments ?
-----------
-
-email phk@FreeBSD.org
-
-
-Poul-Henning
diff --git a/share/FAQ/Text/current-policy.FAQ b/share/FAQ/Text/current-policy.FAQ
deleted file mode 100644
index dd61dbd..0000000
--- a/share/FAQ/Text/current-policy.FAQ
+++ /dev/null
@@ -1,170 +0,0 @@
- THE FREEBSD CURRENT POLICY
-
-Last updated: $Date: 1995/02/27 08:25:50 $
-
-This document attempts to explain the rationale behind FreeBSD-current,
-what you should expect should you decide to run it, and states some
-prerequisites for making sure the process goes as smoothly as possible.
-
-
-1. What is FreeBSD-current?
-
-FreeBSD-current is, quite literally, nothing more than a daily snapshot of
-the working sources for FreeBSD. These include work in progress, experimental
-changes, and transitional mechanisms that may or may not be present in
-the next official release of the software. While many of us compile
-almost daily from FreeBSD-current sources, there are periods of time when
-the sources are literally uncompilable. These problems are generally resolved
-as expeditiously as possible, but whether or not FreeBSD-current sources bring
-disaster or greatly desired functionality can literally be a matter of which
-part of any given 24 hour period you grabbed them in! Please read on..
-
-Under certain circumstances we will sometimes make binaries for parts of
-FreeBSD-current available, but only because we're interested in getting
-something tested, not because we're in the business of providing binary
-releases of current. If we don't offer, please don't ask! It takes far
-too much time to do this as a general task.
-
-
-2. Who needs FreeBSD-current?
-
-FreeBSD-current is made generally available for 3 primary interest groups:
-
- 1. Members of the FreeBSD group who are actively working on one
- part or another of the source tree and for whom keeping `current'
- is an absolute requirement.
-
- 2. Members of the FreeBSD group who are active ALPHA/BETA testers
- and willing to spend time working through problems in order to
- ensure that FreeBSD-current remains as sane as possible. These
- are also people who wish to make topical suggestions on changes
- and the general direction of FreeBSD.
-
- 3. Peripheral members of the FreeBSD (or some other) group who merely
- wish to keep an eye on things and use the current sources for
- reference purposes (e.g. for *reading*, not running). These
- people also make the occasional comment or contribute code.
-
-
-3. What is FreeBSD-current _NOT_?
-
- 1. A fast-track to getting pre-release bits because there's something
- you heard was pretty cool in there and you want to be the first on
- your block to have it.
-
- 2. A quick way of getting bug fixes.
-
- 3. In any way "officially supported" by us.
-
- We do our best to help people genuinely in one of the 3
- "legitimate" FreeBSD-current catagories, but we simply DO NOT
- HAVE THE TIME to help every person who jumps into FreeBSD-current
- with more enthusiasm than knowledge of how to deal with
- experimental system software. This is not because we're mean and
- nasty people who don't like helping people out (we wouldn't even be
- doing FreeBSD if we were), it's literally because we can't answer
- 400 messages a day AND actually work on FreeBSD! I'm sure if
- given the choice between having us answer lots of questions or
- continue to improve FreeBSD, most of you would vote for us
- improving it (and so would we! :-).
-
-
-4. Ok. I still think I "qualify" for FreeBSD-current, so what do I do?
-
- 1. Join the freebsd-hackers and freebsd-commit mailing lists.
- This is not just a good idea, it's ESSENTIAL. If you aren't on
- freebsd-hackers, you won't read the comments that people are
- making about the current state of the system and thus will end
- up stumbling over a lot of problems that others have already
- found and solved. Even more importantly, you will miss out on
- potentially critical information (e.g. "Yo, Everybody! Before you
- rebuild /usr/src, you MUST rebuild the kernel or your system
- will crash horribly!").
-
- The freebsd-commit list will allow you to see the commit log
- entry for each change as its made. This can also contain
- important information, and will let you know what parts of the
- system are being actively changed.
-
- To join these lists, send mail to `majordomo@FreeBSD.ORG'
- and say:
-
- subscribe freebsd-hackers
- subscribe freebsd-commit
-
- In the body of your message. Optionally, you can also say `help'
- and MajorDomo will send you full help on how to subscribe and
- unsubscribe to the various other mailing lists we support.
-
- 2. Grab the sources from ftp.FreeBSD.ORG. You can do this in
- three ways:
-
- 1. Using the CTM facility. Read the ctm.FAQ file for more
- information. Unless you have a good TCP/IP connection at
- a flat rate, this is the way to do it.
-
- 2. Use the CMU `sup' program (Software Update Protocol).
- This is the second most recommended method, since it allows
- you to grab the entire collection once and then only what's
- changed from then on. Many people run sup from cron
- and keep their sources up-to-date automatically.
-
- The problem is that sup does not use the bandwidth efficient,
- unless the round-trip is very fast. If the cost of connection
- or the duration of the session is a concern, use CTM.
-
- To get a binary of the sup program for FreeBSD, as well
- as the documentation and some sample configuration files,
- look in:
-
- FreeBSD.ORG:~ftp/pub/sup
-
- 3. Use ftp. The source tree for FreeBSD-current is always
- "exported" on:
-
- ftp.FreeBSD.ORG:~ftp/pub/FreeBSD/FreeBSD-current
-
- We use `wu-ftpd' which allows compressed/tar'd grabbing
- of whole trees. e.g. you see:
-
- usr.bin/lex
-
- You can do:
-
- ftp> cd usr.bin
- ftp> get lex.tar.Z
-
- And it will get the whole directory for you as a compressed
- tar file.
-
- 3. If you're grabbing the sources to run, and not just look at,
- then grab ALL of current, not just selected portions. The
- reason for this is that various parts of the source depend on
- updates elsewhere and trying to compile just a subset is almost
- guaranteed to get you into trouble.
-
- 4. Before compiling current, read the Makefile in /usr/src
- carefully. You'll see one-time targets like `bootstrapld'
- which *MUST* be run as part of the upgrading process. Reading
- freebsd-hackers will keep you up-to-date on other bootstrapping
- procedures that sometimes become necessary as we move towards
- the next release.
-
- 5. Be active! If you're running FreeBSD-current, we want to know
- what you have to say about it, especially if you have suggestions
- for enhancements or bug fixes. Suggestions with accompanying code
- are received most enthusiastically! :-)
-
-
-Thank you for taking the time to read this all the way through. We're
-always very keen to remain "open" and share the fruits of our labor
-with the widest possible audience, but sharing development sources has
-always had certain pitfalls associated with it (which is why most
-commercial organizations won't even consider it) and I want to make
-sure that people at least come into this with their eyes open, and
-don't make the leap unless they're good at working without a net!
-
- Jordan
-
-
-
diff --git a/share/FAQ/Text/diskspace.FAQ b/share/FAQ/Text/diskspace.FAQ
deleted file mode 100644
index b696f1c..0000000
--- a/share/FAQ/Text/diskspace.FAQ
+++ /dev/null
@@ -1,267 +0,0 @@
- How to assign disk space to FreeBSD.
-
-$Id: diskspace.FAQ,v 1.2 1995/01/03 15:54:02 gclarkii Exp $
-
-1.0 Getting started.
----------------------
-
-After a general introduction, you will find some explanation on what you
-need to do to assign space to FreeBSD on your disk(s). This is done
-through the "sysinstall" program, which lives on the inital boot floppy.
-Those already expert with PCs may wish to skip ahead to section 1.2, the
-rest of you may (or may not) enjoy the brief history lesson.
-
-
-1.1 The ins and outs of allocating disk storage on your PC.
-------------------------------------------------------------
-
-Modern hard disk drives are now getting big enough that people don't want
-to allocate all of one to just one operating system anymore, especially
-given the increasing size of disk drives (the latest 9.0 Gbyte models
-holding the equivalent of some six thousand 1.44MB floppies!) and the
-virtual explosion of operating system options available for the PC. To
-solve this problem, IBM came up with a scheme for "slicing" the disks
-into more manageable chunks, or partitions. It works, but only just.
-To better understand why, first a brief bit of history:
-
-MS-DOS, when hard disk support was unceremoniously grafted on back in the
-late eighties, didn't have such "slices". What it had was a way to install
-Xenix and MS-DOS on the same disk (Remember when Microsoft were in the UNIX
-business?).
-
-In the first sector on the disk was a piece of "primary boot code" and a
-table with four entries. Each of those entries pointed at an arbitrary
-slice of the disk, with one of them was marked "active". The machine would
-boot by reading the first sector containing the boot code into RAM and then
-jumping to it. The job of this small piece of boot code was to look at
-the 4 entry table and decide which OS was to be booted by looking
-for the "active" flag. It would go and load the first sector of that slice
-of the disk into RAM and then and jump to it in turn. This bit of boot
-code was called the "secondary boot", and could be specific to a given
-operating system. The primary boot code and 4-entry table is known
-as the Master Boot Record, or MBR, and is very important to the proper
-operation of your PC! We will discuss the MBR in more detail later.
-
-It was later realized, with the hindsight that IBM is famous for, that disks
-could be bigger than the 32Mb that the early DOS FAT-12 file system could
-handle, so they added a kludge: They had two MSDOS slices, a "Primary" and
-a "Secondary". The primary could still only be 32Mb, but the Secondary had
-no size limit. And the trick was that the secondary had ANOTHER "table
-entry" so that now suddenly up to 5 slices could be available to MS-DOS.
-The Secondary boot record was later made recursive, thus effectively
-avoiding any fixed limit. Of course, they were still stuck with a maximum
-of 26 slices given the use of "drive letters" in DOS. They also reserved
-only 10 bits for cylinder addressing, limiting DOS to being able to address
-a maximum of 1024 cylinders (and cause of the dreaded "cylinder translation"
-kludges, the misconfiguration of which many users have seen as the notorious
-"Missing Operating System" message). Yes, truly DOS was and is an utterly
-terrible operating system, which of course explains its amazing degree of
-success. Anyway, this all brings us up to today, which is where FreeBSD
-comes in:
-
-
-1.2 What FreeBSD does
-----------------------
-FreeBSD has, like any other UNIX-like operating system, the concept of
-"partitions." Partitions are used to implement its own "slicing"
-abstraction, and although there is no real difference between a slice and a
-partition as such, we use the two words to distinguish between these two
-different levels of slicing.
-
-The result is that we have a two-tier structure on the disk:
-
-+-----------+
-| MBR-table |
-+-----------+ +---------+
-| Slice 1 | -----> | MSDOS |
-+-----------+ +---------+
-| Slice 2 |
-+-----------+ +-------------------+
-| Slice 3 | -----> | FreeBSD-disklabel |
-+-----------+ +-------------------+ +-----------------+
-| Slice 4 | | Partition A | -----> | Root-filesystem |
-+-----------+ +-------------------+ +-----------------+
- | Partition B | ---
- +-------------------+ \ +----------------+
- | Partition C | --> | swap-partition |
- +-------------------+ +----------------+
- | ... |
-
-
-Here are the rules that FreeBSD plays by:
-
-A: FreeBSD always has an MBR slice with type 0xa5 (each of the 4 slices can
- also have a unique integer identifier so you can tell your DOS slices
- from your FreeBSD slices from your Linux slices, etc). This means that
- there should always be an MBR record, even in the case where FreeBSD
- occupies the entire disk.
-B: The FreeBSD slice contains the FreeBSD disklabel in the second sector
- (remember, the first sector contains the secondary boot code for FreeBSD,
- which is what prints that FreeBSD prompt at you when you first boot
- FreeBSD from a floppy or hard disk).
-C: The 'C' partition in the FreeBSD disklabel corresponds to the entire
- FreeBSD slice.
-D: The 'D' partition corresponds to the entire physical disk.
-E: Should a disk not have a FreeBSD slice (because there simply is no
- FreeBSD on it anywhere), then the MBR slices are mapped into partitions
- 'E' to 'H' of an artificially created FreeBSD disklabel. This is useful
- for getting at DOS-only disks.
-
-Therefore, to get FreeBSD onto your disk, you need to do the following:
-
- Step FreeBSD utility
- ------------------------------------------------------------ ---------------
- 1. Make an MBR slice for FreeBSD (FDISK)
- 2. Partition the diskspace in the MBR slice into partitions (DISKLABEL)
- 3. Assign mountpoints to the partitions. (DISKLABEL)
-
-
-
-2. The sysinstall utility
---------------------------
-
-The sysinstall utility is the program you first see when you boot
-FreeBSD's install floppy. It is responsible for partitioning your
-disk, creating an MBR slice for FreeBSD, setting up the disklabel
-within that slice and creating filesystems for each FreeBSD partition
-you create within that slice. It is composed of a number of screens.
-These are described below.
-
-
-2.1 The main screen
---------------------
-The main screen shows you the current status, It shows you which disks
-FreeBSD has found, how big they are and how much of it is assigned to
-FreeBSD in a FreeBSD MBR slice. It also shows the partitions which have
-had a mountpoint assigned to them (not necessarily FreeBSD partitions;
-FreeBSD is perfectly capable of mounting DOS disks directly).
-
-(H)elp -- shows you this file.
-
-(F)disk -- enters the Fdisk editor, where you can change the MBR record.
- This is what you want to use to assign some part of the disk to FreeBSD.
-
-(D)isklabel -- enters the Disklabel editor, here you can change how the
- FreeBSD slice is partitioned for FreeBSD.
-
-(P)rocede -- will continue the installation process.
-
-(Q)uit -- Go back to the entry screen.
-
-
-2.2 FDISK - how to make an MBR slice
--------------------------------------
-There are some rules to follow here since altering your MBR is a potential
-minefield. There is really no way for the sysinstall program to genuinely
-know that you have a valid MBR, so you have to be extra careful in what
-you edit. Failure to do this properly can and will destroy your other
-operating system entries!
-
-Even if you don't plan to have MSDOS on a disk, make an MSDOS slice
-using the MSDOS's FDISK.COM program. The reason for this is that if you
-do it that way, you are 100% sure that FreeBSD will use the same number
-of heads, sectors and cylinders as MSDOS would use. If you really don't
-plan to have MSDOS on the disk, just (D)elete the slice in the FreeBSD's
-(F)disk editor.
-
-From the main screen press 'F' to enter the MBR editor. You have five
-commands available:
-
-(H)elp -- Shows you this file.
-
-(D)elete -- Deletes a slice entirely.
-
-(E)dit -- Allows you to edit a slice. It will ask how many megabytes
- you want to assign to the slice, and will suggest the maximum possible
- as a default. It might say zero, even though there is disk space
- available, in which case you will probably need to delete and recreate the
- other partitions to get it to see where the free space is.
- It will then ask you what type to give the slice, for which the default is
- 0xa5 (a FreeBSD slice). You can enter any other number here too, which
- can be useful as a placeholder for some other OS you plan to install
- later. Finally, it will ask you about the "boot flag". 0x80 means "boot
- from this" slice by default, and anything else means "don't".
-
- If you specified a FreeBSD slice, any existing slices with the 0xa5
- type will be reset to 0x00 "unused". FreeBSD only supports one slice
- per disk for FreeBSD.
-
-(R)eread -- This is your "undo" function. It will read the data of the
- disk again, disposing of any changes you may have made.
-
-(W)rite -- When you are satisfied with the data, this function will write
- the new MBR to the disk.
-
-(Q)uit -- Go back to the main screen.
-
-
-2.3 Disklabel - How to divide up the FreeBSD slice.
-----------------------------------------------------
-
-The disklabel screen provides the following commands:
-
-(H)elp -- Shows you this file.
-
-(S)ize -- Resizes a partition for you, it will suggest as a default the
- maximum amount of diskspace it can find. This algorithm isn't too smart
- and may say zero, even though there is diskspace available. If it
- does, delete and resize the other partitions.
-
-(A)ssign -- Here you assign where the filesystem in a partition is to
- be mounted. `b' partitions will always be made into "swap" partitions.
-
-(D)elete -- Delete a partition.
-
-(R)eread -- The undo function. It will reread the current disklabel from
- the kernel.
-
-(W)rite -- This will write the disklabel to the disk. You must always write
- before you quit, otherwise your changes will be lost.
-
-(Q)uit -- Exit back to the main screen.
-
-
-2.4. Hints on partition sizing
--------------------------------
-
-While it's impossible to say how much space you're going to want to
-make your various partitions without knowing more about your intended
-applicatins, here are some good rules of thumb to follow:
-
-1. Root (/) should be at least 18MB, and probably no more than 50MB unless
- you have some special reason for making your root partition really
- large. Remember that the root filesystem is only supposed to contain
- vital system files and little else.
-
-2. Swap should be at least 2*memory. That is to say if you have 8MB of
- memory, then you probably want 16MB of swap. Even more swap space
- certainly doesn't hurt, if you can afford to allocate it, and you should
- also think ahead a little to any planned memory upgrades you may have
- in mind since increasing this later can be very painful!
-
- If you're going to run the X Window System (XFree86), you should also
- consider having a *minimum* of 16MB of swap, since X tends to really
- use it up.
-
-3. /usr can take up the rest of your disk, though some people like to create
- extra partitions for user home directories and the like. Be sure to make
- your /usr big enough to contain the system software (about 50MB) and
- perhaps some of your own, unless you're going to use symbolic links to
- point things like /usr/local (or /usr/src) somewhere else.
-
-
-Here are some suggested filesystem names and sizes, just for reference:
-
-Mountpoint Filesystem size
--------------------------------
-/var 10Mb
-/usr 50Mb
-/ 16Mb
-
-/usr/src 120Mb If you want to have the sources online
-/usr/obj 100Mb If you want to compile all of them at one time
-
-/usr/X11R6 50Mb If you load the entire XFree86 binary kit.
-
-
-$Id: diskspace.FAQ,v 1.2 1995/01/03 15:54:02 gclarkii Exp $
diff --git a/share/FAQ/Text/kernel-debug.FAQ b/share/FAQ/Text/kernel-debug.FAQ
deleted file mode 100644
index 304bcd3..0000000
--- a/share/FAQ/Text/kernel-debug.FAQ
+++ /dev/null
@@ -1,417 +0,0 @@
-# Hello emacs, this is -*- indented-text -*-
-
- Kernel debugging FAQ for FreeBSD
-
-$Id: kernel-debug.FAQ,v 1.3 1995/07/30 12:53:39 joerg Exp $
-
-
-*** Debugging a kernel crash dump with kgdb ***
-
- [In the following, the term ``kgdb'' refers to gdb run in `kernel
- debug mode'. This can be accomplished by either starting the gdb
- with the option ``-k'', or by linking and starting it under the
- name ``kgdb''. This is not being done by default, however.]
-
- Here are some instructions for getting kernel debugging working on a
- crash dump, it assumes that you have enough swap space for a crash
- dump. If you happen to have multiple swap partitions with the first
- one being too small to keep the dump, you can configure your kernel
- to use an alternate dump device (in the ``config kernel'' line), or
- you can tell this using the dumpon(8) command. Dumps to non-swap
- devices (e.g. tapes) are currently not supported.
-
- Config your kernel using config -g
-
- Either, use the dumpon(8) command to tell the kernel where to dump
- to (note that this will have to be done after configuring the
- partition in question as swap space via swapon(8)). This is
- normally arranged via sysconfig and /etc/rc. Alternatively, you can
- hard-code the dump device via the `dump' clause in the `config' line
- of your kernel config file.
-
- When the kernel's been built make a copy of it, say kernel.debug,
- and then run strip -x on the original. Install the original as
- normal. You may also install the unstripped kernel, but symtab
- lookup time for some programs might drastically increase, and since
- the whole kernel is loaded entirely at boot time and cannot be
- swapped out later, you're going to waste several megabytes of
- physical RAM.
-
- If you are testing a new kernel (e.g. by typing the new kernel's
- name at the boot prompt), but need to boot a different one in order
- to get your system up & running again, do boot it only into single
- user state (the -s flag at the boot prompt), and then perform the
- following steps:
-
- fsck -p
- mount -a -t ufs # so your file system for /var/crash is writable
- savecore -N /kernel.panicked /var/crash
- exit # ...to multi-user
-
- This instructs savecore to use another kernel for symbol name
- extraction; it would default to the currently running kernel
- otherwise.
-
- Now, after a crash dump, go to /sys/compile/WHATEVER and run
- kgdb. From kgdb do:
-
- symbol-file kernel.debug
- exec-file /var/crash/system.0
- core-file /var/crash/ram.0
-
- and voila, you can debug the crash dump using the kernel sources
- just like you can for any other program.
-
- If your kernel panicked due to a trap (perhaps the most common case
- for getting a core dump), the following trick might help you. Examine
- the stack (`where') and look for the stack frame in the function
- trap(). Go `up' to that frame, and then type:
-
- frame frame->tf_ebp frame->tf_eip
-
- This will tell kgdb to go to the stack frame explicitly named by a
- frame pointer and instruction pointer, which is the location where
- the trap occured. There are still some bugs in kgdb (you can go
- `up' from there, but not `down'; the stack trace will still remain
- as it was before going to here), but generally this method will lead
- you much closer to the failing piece of code.
-
- Here's a script log of a kgdb session illustrating the above. Long
- lines have been folded to improve readability, and the lines are
- numbered for reference. Despite of this, it's a real-world error
- trace taken during the development of the pcvt console driver.
-
- 1:Script started on Fri Dec 30 23:15:22 1994
- 2:uriah # cd /sys/compile/URIAH
- 3:uriah # kgdb kernel /var/crash/vmcore.1
- 4:Reading symbol data from /usr/src/sys/compile/URIAH/kernel...done.
- 5:IdlePTD 1f3000
- 6:panic: because you said to!
- 7:current pcb at 1e3f70
- 8:Reading in symbols for ../../i386/i386/machdep.c...done.
- 9:(kgdb) where
- 10:#0 boot (arghowto=256) (../../i386/i386/machdep.c line 767)
- 11:#1 0xf0115159 in panic ()
- 12:#2 0xf01955bd in diediedie () (../../i386/i386/machdep.c line 698)
- 13:#3 0xf010185e in db_fncall ()
- 14:#4 0xf0101586 in db_command (-266509132, -266509516, -267381073)
- 15:#5 0xf0101711 in db_command_loop ()
- 16:#6 0xf01040a0 in db_trap ()
- 17:#7 0xf0192976 in kdb_trap (12, 0, -272630436, -266743723)
- 18:#8 0xf019d2eb in trap_fatal (...)
- 19:#9 0xf019ce60 in trap_pfault (...)
- 20:#10 0xf019cb2f in trap (...)
- 21:#11 0xf01932a1 in exception:calltrap ()
- 22:#12 0xf0191503 in cnopen (...)
- 23:#13 0xf0132c34 in spec_open ()
- 24:#14 0xf012d014 in vn_open ()
- 25:#15 0xf012a183 in open ()
- 26:#16 0xf019d4eb in syscall (...)
- 27:(kgdb) up 10
- 28:Reading in symbols for ../../i386/i386/trap.c...done.
- 29:#10 0xf019cb2f in trap (frame={tf_es = -260440048, tf_ds = 16, tf_\
- 30:edi = 3072, tf_esi = -266445372, tf_ebp = -272630356, tf_isp = -27\
- 31:2630396, tf_ebx = -266427884, tf_edx = 12, tf_ecx = -266427884, tf\
- 32:_eax = 64772224, tf_trapno = 12, tf_err = -272695296, tf_eip = -26\
- 33:6672343, tf_cs = -266469368, tf_eflags = 66066, tf_esp = 3072, tf_\
- 34:ss = -266427884}) (../../i386/i386/trap.c line 283)
- 35:283 (void) trap_pfault(&frame, FALSE);
- 36:(kgdb) frame frame->tf_ebp frame->tf_eip
- 37:Reading in symbols for ../../i386/isa/pcvt/pcvt_drv.c...done.
- 38:#0 0xf01ae729 in pcopen (dev=3072, flag=3, mode=8192, p=(struct p\
- 39:roc *) 0xf07c0c00) (../../i386/isa/pcvt/pcvt_drv.c line 403)
- 40:403 return ((*linesw[tp->t_line].l_open)(dev, tp));
- 41:(kgdb) list
- 42:398
- 43:399 tp->t_state |= TS_CARR_ON;
- 44:400 tp->t_cflag |= CLOCAL; /* cannot be a modem (:-) */
- 45:401
- 46:402 #if PCVT_NETBSD || (PCVT_FREEBSD >= 200)
- 47:403 return ((*linesw[tp->t_line].l_open)(dev, tp));
- 48:404 #else
- 49:405 return ((*linesw[tp->t_line].l_open)(dev, tp, flag));
- 50:406 #endif /* PCVT_NETBSD || (PCVT_FREEBSD >= 200) */
- 51:407 }
- 52:(kgdb) print tp
- 53:Reading in symbols for ../../i386/i386/cons.c...done.
- 54:$1 = (struct tty *) 0x1bae
- 55:(kgdb) print tp->t_line
- 56:$2 = 1767990816
- 57:(kgdb) up
- 58:#1 0xf0191503 in cnopen (dev=0x00000000, flag=3, mode=8192, p=(st\
- 59:ruct proc *) 0xf07c0c00) (../../i386/i386/cons.c line 126)
- 60: return ((*cdevsw[major(dev)].d_open)(dev, flag, mode, p));
- 61:(kgdb) up
- 62:#2 0xf0132c34 in spec_open ()
- 63:(kgdb) up
- 64:#3 0xf012d014 in vn_open ()
- 65:(kgdb) up
- 66:#4 0xf012a183 in open ()
- 67:(kgdb) up
- 68:#5 0xf019d4eb in syscall (frame={tf_es = 39, tf_ds = 39, tf_edi =\
- 69: 2158592, tf_esi = 0, tf_ebp = -272638436, tf_isp = -272629788, tf\
- 70:_ebx = 7086, tf_edx = 1, tf_ecx = 0, tf_eax = 5, tf_trapno = 582, \
- 71:tf_err = 582, tf_eip = 75749, tf_cs = 31, tf_eflags = 582, tf_esp \
- 72:= -272638456, tf_ss = 39}) (../../i386/i386/trap.c line 673)
- 73:673 error = (*callp->sy_call)(p, args, rval);
- 74:(kgdb) up
- 75:Initial frame selected; you cannot go up.
- 76:(kgdb) quit
- 77:uriah # exit
- 78:exit
- 79:
- 80:Script done on Fri Dec 30 23:18:04 1994
-
- Comments to the above script:
-
- line 6: this is a dump taken from within DDB (see below), hence the
- panic comment ``because you said to!'', and a rather long
- stack trace; the initial reason for going into DDB has been
- a page fault trap though
-
- line 20: the location of function ``trap()'' in the stack trace
-
- line 36: force usage of a new stack frame, kgdb responds and displays
- the source line where the trap happened; from looking at the
- code, there's a high probability that either the pointer
- access for ``tp'' was messed up, or the array access was
- out of bounds
-
- line 52: the pointer looks suspicious, but happens to be a valid
- address...
-
- line 56: ... but obviously points to garbage, so we have found our
- error, sigh! [For those uncommon with that particular piece
- of code: tp->t_line refers to the line discipline of the
- console device here, which must be a rather small integer
- number.]
-
-
-
-*** Post-mortem analysis of a dump ***
-
- What to do if a kernel dumped core but you didn't expect it, and it's
- therefore not compiled using config -g?
-
- Not everything is lost here. Don't panic. :-)
-
- Of course, you still need to enable crash dumps at all. See above
- on the options you've got to do this. (This is for safety reasons
- in the default kernels, to avoid them trying to dump e.g. during
- system installation where there's no FreeBSD partition at all and
- valuable data on the disk could be destroyed.)
-
- Go to your kernel compile directory, and edit the line containing
- COPTFLAGS?=-O. Add the `-g' option there (but DON'T change anything
- on the level of optimization). If you do already know roughly the
- probable location of the failing piece of code (e.g., the `pcvt'
- driver in the example above), remove all the object files for this
- code. Rebuild the kernel. Due to the time stamp change on the
- Makefile, there will be some other object files rebuild, e.g.
- trap.o. With a bit of luck, the added -g option won't change
- anything for the generated code, so you'll finally get a new kernel
- with similiar code to the faulting one but some debugging symbols.
- You should at least verify the old and new sizes with the `size'
- command; if they mismatch, you probably need to give up here.
-
- Go and examine the dump as described above. The debugging symbols
- might be incomplete for some places (as can be seen in the stack trace
- in the example above: some functions are displayed without line
- numbers and argument lists). If you need more debugging symbols,
- remove the appropriate object files and repeat the kgdb session until
- you know enough.
-
- All this is not guaranteed to work, but most likely will do it fine.
-
-
-
-*** On-line kernel debugging using DDB ***
-
- While kgdb as an offline debugger provides a very high level of user
- interface (e.g. it can lookup source files, display C structures
- etc.), there are some things it cannot do. The most important ones
- being breakpointing and single-stepping kernel code.
-
- If you need to do low-level debugging on your kernel, there's an on-
- line debugger available called DDB. It allows to set breakpoints,
- single-step kernel functions, examine and change kernel variables
- etc. It can however not access kernel source files, and it does
- only have access to the global and static symbols, but not to the
- full debug information (including type and line number information)
- like kgdb.
-
- To configure your kernel to include DDB, add the option line
-
- options DDB
-
- to your config file, and rebuild.
-
- (Note that if you have an older version of the boot blocks, your
- debugger symbols might not be loaded at all. Update the boot
- blocks, the recent ones do load the DDB symbols automagically.)
-
- Once your DDB kernel is running, there are several ways to enter
- DDB. The first (and most early) way is to set the boot flag `-d'
- (right at the boot prompt). The kernel will start up in debug mode
- and enter DDB prior to any device probing. Hence you are able to
- even debug the device probe/attach functions.
-
- The second scenario is a hot-key on the keyboard, usually Ctrl-Alt-
- ESC. (For syscons, this can be remapped, and some of the
- distributed maps do this, so watch out.) There's an option
- available for a COMCONSOLE kernel (``options BREAK_TO_DEBUGGER'')
- that allows the use of a serial line BREAK on the console line to
- enter DDB.
-
- The third way is that any panic condition will branch to DDB if the
- kernel is configured to use it. (Thus it is not wise to configure a
- kernel with DDB for a machine running unattended.)
-
-
- The DDB commands roughly resemble some gdb commands. The first you
- probably need is to set a breakpoint:
-
- b function-name
- b address
-
- Numbers are taken hexadecimal by default, but to make them distinct
- from symbol names, hex numbers starting with the letters `a' - `f'
- need to be preceded with `0x' (for other numbers, this is optional).
- Simple expressions are allowed, e.g. ``function-name + 0x103''.
-
- To continue the operation of an interrupted kernel, simply type
-
- c
-
- To get a stack trace, use
-
- trace
-
- Note that when entering DDB via a hot-key, the kernel is currently
- servicing an interrupt, so the stack trace might be not of much use
- for you.
-
- If you want to remove a breakpoint, use
-
- del
- del address-expression
-
- The first form will be accepted immediately after a breakpoint hit,
- and deletes the current breakpoint. The second form can remove any
- breakpoint, but you need to specify the exact address, as it can be
- obtained from
-
- show b
-
- To single-step the kernel, try
-
- s
-
- This will step into functions, but you can make DDB trace them until
- the matching return statement is reached by
-
- n
-
- NOTE: this is different from gdb's ``next'' statement, it's like
- gdb's ``finish''.
-
- To examine data from memory, use e.g.
-
- x/wx 0xf0133fe0,40
- x/hd db_symtab_space
- x/bc termbuf,10
- x/s stringbuf
-
- for word/halfword/byte access, and hexadecimal/decimal/character/
- string display. The number after the comma is the object count.
- To display the next 0x10 items, simply use
-
- x ,10
-
- Similiarly, use
-
- x/ia foofunc,10
-
- to disassemble the first 0x10 instructions of foofunc, and display
- them along with their offset from the beginning of foofunc.
-
- To modify the memory, use the write command:
-
- w/b termbuf 0xa 0xb 0
- w/w 0xf0010030 0 0
-
- The command modifier (b/h/w) specifies the size of the data to be
- writtten, the first following expression is the address to write to,
- the remainder is interpreted as data to write to successive memory
- locations.
-
- If you need to know the current registers, use
-
- show reg
-
- Alternatively, you can display a single register value by e.g.
-
- print $eax
-
- and modify it by
-
- set $eax new-value
-
-
- Should you need to call some kernel functions from DDB, simply
- say
-
- call func(arg1, arg2, ...)
-
- The return value will be printed.
-
- For a ps-style summary of all running processes, use
-
- ps
-
-
-
- Well, you've now examined why your kernel failed, and you wish to
- reboot. Remember that, depending on the severity of previous
- malfunctioning, not all parts of the kernel might still be working
- as expected. Perform one of the following actions to shut down and
- reboot your system:
-
-
- call diediedie()
-
- (must usually be followed by another ``c[ontinue]'' statement),
- will cause your kernel to dump core and reboot, so you can later
- analyze the core on a higher level with kgdb.
-
- There's now an alias for this: ``panic''.
-
-
- call boot(0)
-
- might be a good way to cleanly shut down the running system, sync()
- all disks, and finally reboot. As long as the disk and file system
- interfaces of the kernel are not damaged, this might be a good way
- for an almost clean shutdown.
-
-
- call cpu_reset()
-
- ...is the final way out of the desaster, almost similiar to hitting
- the Big Red Button.
-
-
-
-*** What to do if i want to debug a console driver? ***
-
- Since you need a console driver to run DDB on, things are more
- complicated if the console driver itself is flakey. You might
- remember the ``options COMCONSOLE'' line, and hook up a standard
- terminal onto your first serial port. DDB works on any configured
- console driver, of course it also works on a COMCONSOLE.
-
-
-
- Paul Richards, FreeBSD core team member. (paul@FreeBSD.org)
- J"org Wunsch (joerg@FreeBSD.org)
-
diff --git a/share/FAQ/Text/kernel-memory.FAQ b/share/FAQ/Text/kernel-memory.FAQ
deleted file mode 100644
index 79ab09a..0000000
--- a/share/FAQ/Text/kernel-memory.FAQ
+++ /dev/null
@@ -1,72 +0,0 @@
-~From: J Wunsch <j@uriah.heep.sax.de>
-~Message-Id: <199504160843.KAA16160@uriah.heep.sax.de>
-~Subject: Memory usage (Was Re: Memory init pattern)
-~To: freebsd-hackers@FreeBSD.org (FreeBSD hackers)
-~Date: Sun, 16 Apr 1995 10:43:29 +0200 (MET DST)
-
-[Audience extended to -hackers, since it's a general topic.]
-
-As Frank Durda IV wrote:
->
-> By the way, I have seen no description of how FreeBSD uses PC memory, ie
-> what 0-640K gets used for, does the kernel load there or higher,
-> is the kernel relocated, etc. Is there a paper on this?
-
-Since i've just digged through the boot code, i can tell you what's
-going there. :) [Someone going to collect this sort of messages
-and making a kernel hackers manual?]
-
-The boot sector will be loaded at 0:0x7c00, and relocates itself
-immediately to 0x7c0:0. (This is nothing magic, just an adjustment
-for the %cs selector, done by an ljmp.)
-
-It then loads the first 15 sectors at 0x10000 (segment BOOTSEG in the
-biosboot Makefile), and sets up the stack to work below 0x1fff0.
-After this, it jumps to the entry of boot2 within that code. I.e., it
-jumps over itself and the (dummy) partition table, and it's going to
-adjust the %cs selector -- we are still in 16-bit mode there.
-
-boot2 asks for the boot file, and examines the a.out header. It masks
-the file entry point (usually 0xf0100000) by 0x00ffffff, and loads the
-file there. Hence the usual load point is 1 MB (0x00100000). During
-load, the boot code toggles back and forth between real and protected
-mode, to use the BIOS in real mode.
-
-The boot code itself uses segment selectors 0x18 and 0x20 for %cs and
-%ds/%es in protected mode, and 0x28 to jump back into real mode. The
-kernel is finally started with %cs 0x08 and %ds/%es/%ss 0x10, which
-refer to dummy descriptors covering the whole address space.
-
-The kernel will be started at its load point. Since it's been linked
-for another (high) address, it will have to execute PIC until the page
-table and page directory stuff is setup properly, at which point
-paging will be enabled and the kernel finally runs at the address
-where it has been linked to.
-
-[... -- no longer valid]
-
-The later memory usage (once paging is enabled) could better be
-explained by the VM folks.
-
---
-cheers, J"org
-
-joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/
-Never trust an operating system you don't have sources for. ;-)
-
-~Message-Id: <199504160955.CAA00143@corbin.Root.COM>
-~To: freebsd-hackers@FreeBSD.org (FreeBSD hackers)
-~Subject: Re: Memory usage (Was Re: Memory init pattern)
-~From: David Greenman <davidg@Root.COM>
-~Date: Sun, 16 Apr 1995 02:55:50 -0700
-
-...
- The physical pages immediately following the kernel BSS contain proc0's page
-directory, page tables, and upages. Some time later when the VM system is
-initialized, the physical memory between 0x1000-0x9ffff and the physical memory
-after the kernel (text+data+bss+proc0 stuff+other misc) is made available in
-the form of general VM pages and added to the global free page list.
- Does this answer the question?
-
--DG
-
diff --git a/share/FAQ/Text/mailing-list.FAQ b/share/FAQ/Text/mailing-list.FAQ
deleted file mode 100644
index 881890f..0000000
--- a/share/FAQ/Text/mailing-list.FAQ
+++ /dev/null
@@ -1,105 +0,0 @@
- THE FREEBSD MAILING LIST FAQ
-
-$Id: mailing-list.FAQ,v 1.5 1995/01/03 15:54:04 gclarkii Exp $
-
---
-Though many of the FreeBSD development members read USENET, we cannot
-always guarantee that we'll get to your questions in a timely fashion
-(or at all) if you post them only to one of the comp.os.386bsd.*
-groups. By addressing your questions to the appropriate mailing list
-you will reach both us and a concentrated FreeBSD audience, invariably
-assuring a better (or at least faster) response.
-
-The following is a summary of the mailing lists:
-
-List Purpose
------------------------------------------------------------------------------
-freebsd-admim Administrative issues (limited)
-freebsd-arch Architecture and design discussions (limited)
-freebsd-bugs Bug reports
-freebsd-hackers Technical discussions and suggestions
-freebsd-questions User questions
-freebsd-announce Important events / milestones
-freebsd-current Discussions about the use of FreeBSD-current
-freebsd-commit Commit messages to source repository
-freebsd-core FreeBSD core team (limited)
-freebsd-security Security issues
-freebsd-fs Filesystems
-freebsd-ports Discussion of "ports"
-freebsd-platforms Porting to Non-Intel platforms
-freebsd-hardware General discussion of FreeBSD hardware
-freebsd-install Installation issues (limited)
-
------------------------------------------------------------------------------
-
-The following lists are for people seeing the log messages for source changes
-in specific areas:
-
-List name Source area Area Description (source for)
------------------------------------------------------------------------------
-cvs-CVSROOT /usr/src/[A-Z]* Top level /usr/src file changes
-cvs-all /usr/src All changes to the tree (superset)
-cvs-bin /usr/src/bin System binaries
-cvs-etc /usr/src/etc System files
-cvs-games /usr/src/games Games
-cvs-gnu /usr/src/gnu GPL'd utilities
-cvs-include /usr/src/include Include files
-cvs-kerberosIV /usr/src/kerberosIV Kerberos encryption code
-cvs-lib /usr/src/lib System libraries
-cvs-libexec /usr/src/libexec System binaries
-cvs-sbin /usr/src/sbin System binaries
-cvs-share /usr/src/share System shared files
-cvs-sys /usr/src/sys Kernel
-cvs-usrbin /usr/src/usr.bin Use binaries
-cvs-usrsbin /usr/src/usr.sbin System binaries
-cvs-ports /usr/ports Ported software
------------------------------------------------------------------------------
-
-Even though the lists freebsd-core, freebsd-admin, freebsd-install and
-freebsd-arch are closed, anyone is free to send suggestions and comments
-to them. All other lists are open.
-
-All mailing lists live on `FreeBSD.ORG', so to post to a list you
-simply mail to `<listname>@FreeBSD.ORG'. It will then be redistributed
-to mailing list members throughout the world.
-
-To subscribe to a list, send mail to:
-
- majordomo@FreeBSD.ORG
-
-And include the keyword
-
- subscribe <listname> [<optional address>]
-
-In the body of your message. For example, to subscribe yourself to
-freebsd-hackers, you'd do:
-
- % mail majordomo@FreeBSD.ORG
- subscribe freebsd-hackers
- ^D
-
-If you want to subscribe yourself under a different name, or submit a
-subscription request for a local mailing list (note: this is more efficient
-if you have several interested parties at one site, and highly appreciated by
-us!), you would do something like:
-
- % mail majordomo@FreeBSD.ORG
- subscribe freebsd-hackers local-hackers@somesite.com
- ^D
-
-Finally, it is also possible to unsubscribe yourself from a list, get a
-list of other list members or see the list of mailing lists again by
-sending other types of control messages to majordomo. For a complete
-list of available commands, do this:
-
- % mail majordomo@FreeBSD.ORG
- help
- ^D
-
-Finally, it is suggested that you only join the freebsd-hackers or
-freebsd-questions mailing lists if you're also willing to see upwards
-of 100 messages a day (peak)! If you're only interested in the "high points",
-then it's suggested that you join freebsd-announce, which will contain
-only infrequent traffic.
-
- Thank you!
diff --git a/share/FAQ/Text/nfs.FAQ b/share/FAQ/Text/nfs.FAQ
deleted file mode 100644
index 88c5fc5..0000000
--- a/share/FAQ/Text/nfs.FAQ
+++ /dev/null
@@ -1,79 +0,0 @@
-FreeBSD and NFS [for a FAQ]
-
-$Id: nfs.FAQ,v 1.2 1995/01/03 15:54:05 gclarkii Exp $
-
-Certain Ethernet adapters for ISA PC systems have limitations which
-can lead to serious network problems, particularly with NFS. This
-difficulty is not specific to FreeBSD, but FreeBSD systems are affected
-by it.
-
-The problem nearly always occurs when (FreeBSD) PC systems are networked
-with high-performance workstations, such as those made by Silicon Graphics,
-Inc., and Sun Microsystems, Inc. The NFS mount will work fine, and some
-operations may succeed, but suddenly the server will seem to become
-unresponsive to the client, even though requests to and from other systems
-continue to be processed. This happens to the client system, whether the
-client is the FreeBSD system or the workstation. On many systems, there is
-no way to shut down the client gracefully once this problem has manifested
-itself. The only solution is often to reset the client, because the NFS
-situation cannot be resolved.
-
-Though the "correct" solution is to get a higher performance and capacity
-Ethernet adapter for the FreeBSD system, there is a simple workaround that
-will allow satisfactory operation. If the FreeBSD system is the SERVER,
-include the option "wsize=1024" on the mount from the client. If the
-FreeBSD system is the CLIENT, then mount the NFS file system with the
-option "rsize=1024". These options may be specified using the fourth
-field of the fstab entry on the client for automatic mounts, or by using
-the "-o" parameter of the mount command for manual mounts.
-
-In the following examples, "fastws" is the host (interface) name of a
-high-performance workstation, and "freebox" is the host (interface) name of
-a FreeBSD system with a lower-performance Ethernet adapter. Also,
-"/sharedfs" will be the exported NFS filesystem (see "man exports"), and
-"/project" will be the mount point on the client for the exported file
-system. In all cases, note that additional options, such as "hard" or
-"soft" and "bg" may be desireable in your application.
-
-Examples for the FreeBSD system ("freebox") as the client:
- in /etc/fstab on freebox:
-fastws:/sharedfs /project nfs rw,rsize=1024 0 0
- as a manual mount command on freebox:
-mount -t nfs -o rsize=1024 fastws:/sharedfs /project
-
-Examples for the FreeBSD system as the server:
- in /etc/fstab on fastws:
-freebox:/sharedfs /project nfs rw,wsize=1024 0 0
- as a manual mount command on fastws:
-mount -t nfs -o wsize=1024 freebox:/sharedfs /project
-
-Nearly any 16-bit Ethernet adapter will allow operation without the above
-restrictions on the read or write size.
-
-For anyone who cares, here is what happens when the failure occurs, which
-also explains why it is unrecoverable. NFS typically works with a "block"
-size of 8k (though it may do fragments of smaller sizes). Since the maximum
-Ethernet packet is around 1500 bytes, the NFS "block" gets split into
-multiple Ethernet packets, even though it is still a single unit to the
-upper-level code, and must be received, assembled, and ACKNOWLEDGED as a
-unit. The high-performance workstations can pump out the packets which
-comprise the NFS unit one right after the other, just as close together as
-the standard allows. On the smaller, lower capacity cards, the later
-packets overrun the earlier packets of the same unit before they can be
-transferred to the host and the unit as a whole cannot be reconstructed or
-acknowledged. As a result, the workstation will time out and try again,
-but it will try again with the entire 8K unit, and the process will be
-repeated, ad infinitum.
-
-By keeping the unit size below the Ethernet packet size limitation, we
-ensure that any complete Ethernet packet received can be acknowledged
-individually, avoiding the deadlock situation.
-
-Overruns may still occur when a high-performance workstations is slamming
-data out to a PC system, but with the better cards, such overruns are
-not guarranteed on NFS "units". When an overrun occurs, the units affected
-will be retransmitted, and there will be a fair chance that they will be
-received, assembled, and acknowledged.
---
- John Lind, Starfire Consulting Services
-E-mail: john@starfire.MN.ORG USnail: PO Box 17247, Mpls MN 55417
diff --git a/share/FAQ/Text/ports.FAQ b/share/FAQ/Text/ports.FAQ
deleted file mode 100644
index 2a447ad..0000000
--- a/share/FAQ/Text/ports.FAQ
+++ /dev/null
@@ -1,246 +0,0 @@
- The FreeBSD Ports FAQ file
-
-Revision: $Id: ports.FAQ,v 1.2 1995/01/06 19:24:13 gpalmer Exp $
-
-The ports system is kinda new, so there haven't been too many FAQ's to
-date, but hopefully this document will pre-empt (some|most) of them!!
-The ports system is constantly changing, but hopefully this document
-will be kept reasonably up to date (and you never know, it might even
-make sense!).
-
- - Gary Palmer
- & jkh
-
-1) What is a port?
-
- Unfortunately, there are more variations of UN*X than most people
-know of, and hence not all software for UN*X available on the Internet
-will work on all versions of UN*X (in fact, I can guarantee it!).
-Hence, some software needs modifications to work under some UN*Xs. The
-process of making those modifications is known as ``porting'' and the
-result known as a ``port'' (not to be confused with the sockets on the
-back of your computer!).
-
-
-2) What is the FreeBSD Ports Collection?
-
- People who (allegedly) know what they are doing have automated the
-process of ``porting'' software to FreeBSD, and the result is the
-Ports Collection. The general idea is that a combination of various
-programming tools available in the base FreeBSD installation will
-allow you to fetch the port from a FreeBSD mirror site, type ``make''
-and get the fully working program.
-
- The ports collection itself normally doesn't have any of the
-original source code necessary for the compilation in the tree, just
-those shell scripts, Makefiles and source code ``diffs'' that are
-necessary to compile the program under FreeBSD. This is meant to keep
-the entire system down to a manageable size, and the current system
-has over 100 ports in the master source tree, and yet a compressed tar
-file of that tree is about 2 megabytes (all the source code needed is
-over 100Mb's!).
-
-
-3) How does the system compile with no source code?
-
- A ports' Makefile automatically looks in a central location on
-your system (usually /usr/ports/distfiles, though this value can be
-customized) for the associated set of original distribution files that
-have been ``ported''. These are generally provided at various places
-on the Internet, though if you have a CDROM distribution of FreeBSD
-then you've already got them available on your CD for ease of use.
-See section 3.1 if you have such a CD distribution, otherwise skip to
-section 3.2.
-
-3.1 Compiling ports from CD
-
- Type something profound here.
-
-3.2 Compiling ports using an Internet connection
-
- The ports collection can also use an auto-fetch system to keep
-your ports collection source tree up to date, updating the central
-``distfiles'' version for you the next time you compile the port.
-
- Of course, this always assumes you have a permanent network link,
-or don't mind heavy usage of your telephone. If you don't want heavy
-network usage when you compile your ports tree, you can pre-fetch the
-necessary tarballs beforehand and put them into /usr/ports/distfiles
-(or wherever DISTDIR points) by hand. A good way to see what files a
-port is going to need is to cd to that port's directory and do a
-``make -n fetch'' to see what it does.
-
- You can also chose to get the source files either from the master
-FTP site as defined in the relevant Makefile (in the MASTER_SITES
-line), or some FreeBSD mirror site also carrying a set of distfiles,
-as does the master FTP site on ftp.FreeBSD.org (aka ftp.cdrom.com) in
-the directory /pub/FreeBSD/ports/distfiles. Note that the files in
-that directory are not guarenteed to be kept up to date - this is a
-volunteer project! We can't make any guarantees about the mirror
-sites either - they are obviously under independant control and don't
-even have to mirror the distfiles directory.
-
- If you have a non-permanant link, you can fetch all the distfiles by
-going to the top of the tree and typing ``make fetch''.
-
-
-4) It doesn't work?!
-
-Oh. You can do one of four (4) things :
-
-a) Fix it yourself. Technical details can be found in the GUIDELINES file,
- available from URL ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/GUIDELINES
-
-b) Gripe. This is done by e-mail *ONLY*! The people at Walnut Creek are
- in no way responsible for the functionality (or lack thereof) of the
- FreeBSD system as a whole, and especially the ports system, which
- is mainly contributed by 3rd parties. (If you don't believe me, check
- the catalogue, especially the line saying "We cannot offer tech-support
- on this product")
-
- The e-mail address is Ports@FreeBSD.org. Please include details of
- the port, where you got both the port source & distfile(s) from, and
- what the error was.
-
- Note: At time of writing, lang/Sather doesn't seem to work on Pentium
- machines due to the Intel Curse (aka the Floating Point Division Bug).
- Please don't tell us about this - gripe to Intel instead - it's their
- bug!
-
-c) Forget it. This is the easiest for most - very few of the programs in
- ports can be classed as `essential'!
-
-d) Grab the pre-compiled package from a ftp server. The ``master'' package
- collection is in:
- ftp://ftp.FreeBSD.org/pub/FreeBSD/packages/
-
- though check your local mirror first, please!
-
- These are more likely to work (on the whole) than trying to compile from
- source, and a lot faster!
-
-
-5) I've ported a program and I want to make a port out of it. What now?
-
- See the file GUIDELINES, in:
- ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/GUIDELINES
-
- This contains details of the procedure and structure involved.
-
-
-6) I've got a good port, what now?
-
- Upload the fixed version to freefall.cdrom.com /pub/incoming or
-ftp.FreeBSD.org /pub/FreeBSD/incoming and send e-mail to
-ports@FreeBSD.org with the filename and details. Someone on the
-all-volunteer `ports committee' will (hopefully) look it over and
-commit it to the ports collection if they like the looks of it.
-
-
-7) Things go funny during the fetch stage of compilation!
-
- We know. Please don't blame us. There is a program called `ncftp'
-which is used instead of the normal ftp as it can do so-called
-``background'' or ``batch'' transfers, ideal for this situation.
-Unfortunately it can do strange things, and has crashed at least one
-machine (during circumstances stranger than most, I'll admit, but it
-was still responsible). Hopefully a future release of ncftp will fix
-these problems (it is not maintained by the main FreeBSD team, but a
-third party, who is I believe aware of its shortcomings)
-
-
-8) I want to leave the compile going overnight, but some ports don't
- like this.
-
- There is a way around this. Before starting the compilation, type:
- setenv BATCH yes # (if you use csh/tcsh) or
- BATCH=yes # (for sh/bash)
-
- This should miss out ports which need user interaction. Unfortunately,
-ncftp doesn't know about this trick, and can often screw up and ask
-stupid questions in unattended batch mode. See (7).
-
- To compile those ports left out by doing the above, using a
-different login shell (or unsetting the above BATCH variable), set the
-INTERACTIVE variable instead (you can use the same statements as above
-except replace ``BATCH'' with ``INTERACTIVE'') and re-run make. This
-should now compile only those ports which will definitely ask for user
-interaction.
-
-
-9) The ports collection is weak. What can I do to help?
-
- First read the bsd.port.mk file (which may be found in
-/usr/share/mk/) and the associated bsd.port.subdir.mk file. A lot of
-the weirdness can be explained properly in there (most of the current
-weirdness is due to the lack of assumptions about anything, which is
-necessary due to the generic nature of these files). Also check that
-you have an up-to-date copy, as the file can change from minute to
-minute. A reasonably up-to-date copy can be found in:
-
- ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/share/mk/bsd.port*
-
- If you find that you still need to go in there and alter things,
-by all means do so, and then send the diffs to ports@FreeBSD.org if
-you'd like them to be a part of the default distribution. Please also
-remember that any changes must respect backwards-compatability with
-any and all older Makefiles, unless you want a real nightmare of
-/usr/ports munging ahead of you! Large scale changes will generally
-not be warmly welcomed unless all the existing makefiles work without
-alteration. Sorry!
-
-
-10) This FAQ is weak. What can I do?
-
- Send changes to ports@FreeBSD.org. Changes are most welcome!
-This FAQ is also very green and should be considered no more than
-a `good start' for now. Authors? You can come out of hiding any
-time now! :-)
-
-
-11) How do I get more information on all the ports?
-
- One good method is to cd to the top of the ports tree (say /usr/ports)
-and type something like:
-
- make describe | sed -e '/===/D' -e 's;/usr/ports/;;' | expand -40
-
-The ``make describe'' will try to extract the one-line description from
-each port, and the ``sed'' will delete the extraneous output. ``expand''
-just makes it a little more readable (sort of - you may want to season
-the output of this more to taste).
-
-
-12) I've heard of a new checksum system. What is this for?
-
- For various reasons, when using FTP over the Internet to obtain the
-source code, you may not always end up with the same copy of the code
-that the origional porter worked from, and this can lead to problems.
-So a simple checksumming system has been employed to try and highlight
-problems in this area.
-
- To check the entire system, go to the top of the ports tree
-(defaults to /usr/ports) and type
-
- make checksum
-
-This will give a report on the validity of the files you have FTP'd. If some
-are missing, the system will attempt to retrieve them before running the
-checksum routine. The same technique can be applied to a single port.
-
- The system will complain if there is no pre-computed checksum available
-for that port. Not all ports currently have checksums, but this should be
-cured soon.
-
- Some older versions of the system don't recognise the ``checksum''
-target. In that case, try the command
-
- make check-md5
-
-(``check-md5'' was the pre-cursor to the ``checksum'' target). If neither
-work, get the latest copies of bsd.port.mk and bsd.port.subdir.mk from
-
- ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/share/mk/bsd.port*
-
-and install them in /usr/share/mk. This will get you the latest version
-of the ports system.
diff --git a/share/FAQ/Text/ppp.FAQ b/share/FAQ/Text/ppp.FAQ
deleted file mode 100644
index 46cc8bc..0000000
--- a/share/FAQ/Text/ppp.FAQ
+++ /dev/null
@@ -1,369 +0,0 @@
- Info about setting up pppd daemon on FreeBSD-2.0
-
-$Id: ppp.FAQ,v 1.2 1995/01/03 15:54:05 gclarkii Exp $
-
-Before you start setting up PPP on your machine make
-sure that pppd is located in /usr/sbin and directory /etc/ppp
-exists.
-
-pppd can work in two modes:
-
-i) as a "client" , i.e. you want to connect your machine to outside
-world via PPP serial connection or modem line.
-
-ii) as a "server" , i.e. your machine is located on the network and
-used to connect other computers using PPP.
-
-In both cases you will need to set up an options file ( /etc/ppp/options
-or ~/.ppprc if you have more then one user on your machine that uses
-PPP ).
-
-You also will need some modem/serial software ( preferably kermit )
-so you can dial and establish connection with remote host.
-
-1) Working as a PPP client
-
-I used the following options to connect to CISCO terminal server PPP
-line.
-
-----/etc/ppp/options-------
-crtscts # enable hardware flow control
-modem # modem control line
-noipdefault # remote PPP server must supply your IP address.
- # if the remote host doesn't send your IP during IPCP
- # negotiation , remove this option
-passive # wait for LCP packets
-domain ppp.foo.com # put your domain name here
-
-:<remote_ip> # put the IP of remote PPP host here
- # it will be used to route packets via PPP link
- # if you didn't specified the noipdefault option
- # change this line to <local_ip>:<remote_ip>
-
-defaultroute # put this if you want that PPP server will be your
- # default router
--------------------------
-
-To connect:
-i) Dial to the remote host using kermit ( or other modem program )
-enter your user name and password ( or whatever is needed to enable PPP
-ont the remote host )
-
-ii) Exit kermit. ( without hanging up the line )
-
-iii) enter:
-/usr/src/usr.sbin/pppd.new/pppd /dev/tty01 19200
-( put the appropriate speed and device name )
-
-Now your computer is connected with PPP. If the connection fails for some
-reasons you can add the "debug" option to the /etc/ppp/options file
-and check messages on the console to track the problem
-
-Following script will make all 3 stages automatically:
------/etc/ppp/pppup--------
-#!/bin/sh
-ps ax |grep pppd |grep -v grep
-pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing pppd, PID=' ${pid}
- kill ${pid}
-fi
-ps ax |grep kermit |grep -v grep
-pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing kermit, PID=' ${pid}
- kill -9 ${pid}
-fi
-
-ifconfig ppp0 down
-ifconfig ppp0 delete
-
-kermit -y /etc/ppp/kermit.dial
-pppd /dev/tty01 19200
------------------------------
-
-/etc/ppp/kermit.dial is kermit script that dials and makes all
-necessary authorization on the remote host.
-( Example of such script is attached to the end of this document )
-
-Use the follwing script to disconnect the PPP line:
------/etc/ppp/pppdown--------
-#!/bin/sh
-pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'`
-if [ X${pid} != "X" ] ; then
- echo 'killing pppd, PID=' ${pid}
- kill -TERM ${pid}
-fi
-
-ps ax |grep kermit |grep -v grep
-pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing kermit, PID=' ${pid}
- kill -9 ${pid}
-fi
-
-/sbin/ifconfig ppp0 down
-/sbin/ifconfig ppp0 delete
-kermit -y /etc/ppp/kermit.hup
-/etc/ppp/ppptest
-------------------------------
-
-Check if PPP is still running:
-
------/etc/ppp/ppptest---------
-#!/bin/sh
-pid=`ps ax| grep pppd |grep -v grep|awk '{print $1;}'`
-if [ X${pid} != "X" ] ; then
- echo 'pppd running: PID=' ${pid-NONE}
-else
- echo 'No pppd running.'
-fi
-set -x
-netstat -n -I ppp0
-ifconfig ppp0
------------------------------
-
-Hangs up modem line:
-
------/etc/ppp/kermit.hup-----
-set line /dev/tty01 ; put your modem device here
-set speed 19200
-set file type binary
-set file names literal
-set win 8
-set rec pack 1024
-set send pack 1024
-set block 3
-set term bytesize 8
-set command bytesize 8
-set flow none
-
-pau 1
-out +++
-inp 5 OK
-out ATH0\13
-echo \13
-exit
-----------------------------
-
-2) Working as a PPP server
-
-------/etc/ppp/options------
-crtscts # Hardware flow control
-netmask 255.255.255.0 # netmask ( not required )
-192.114.208.20:192.114.208.165 # ip's of local and remote hosts
- # local ip must be different from one
- # you assigned to the ethernet ( or other )
- # interface on your machine.
- # remote IP is ip address that will be
- # assigned to the remote machine
-domain ppp.foo.com # your domain
-passive # wait for LCP
-modem # modem line
-----------------------------
-
-Following script will enable ppp server on your machine
-
------/etc/ppp/pppserv-------
-#!/bin/sh
-ps ax |grep pppd |grep -v grep
-pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing pppd, PID=' ${pid}
- kill ${pid}
-fi
-ps ax |grep kermit |grep -v grep
-pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing kermit, PID=' ${pid}
- kill -9 ${pid}
-fi
-
-# reset ppp interface
-ifconfig ppp0 down
-ifconfig ppp0 delete
-
-# enable autoanswer mode
-kermit -y /etc/ppp/kermit.ans
-
-# run ppp
-pppd /dev/tty01 19200
-----------------------------
-
-Use this script to stop ppp server:
-
------/etc/ppp/pppservdown---
-#!/bin/sh
-ps ax |grep pppd |grep -v grep
-pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing pppd, PID=' ${pid}
- kill ${pid}
-fi
-ps ax |grep kermit |grep -v grep
-pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing kermit, PID=' ${pid}
- kill -9 ${pid}
-fi
-ifconfig ppp0 down
-ifconfig ppp0 delete
-
-kermit -y /etc/ppp/kermit.noans
-----------------------------
-
-Following kermit script will enable/disable autoanswer mode
-on your modem:
-
------/etc/ppp/kermit.ans----
-set line /dev/tty01
-set speed 19200
-set file type binary
-set file names literal
-set win 8
-set rec pack 1024
-set send pack 1024
-set block 3
-set term bytesize 8
-set command bytesize 8
-set flow none
-
-pau 1
-out +++
-inp 5 OK
-out ATH0\13
-inp 5 OK
-echo \13
-out ATS0=1\13 ; change this to out ATS0=0\13 if you want to disable
- ; autoanswer mod
-inp 5 OK
-echo \13
-exit
------------------------------
-
-This script is used for dialing and authorizing on remote host.
-You will need to customize it for your needs.
-Put your login and password in this script , also you'll need
-to change input statement depending on responces from your modem
-and remote host.
-
------/etc/ppp/kermit.dial----
-
-;
-; put the com line attached to the modem here:
-;
-set line /dev/tty01
-;
-; put the modem speed here:
-;
-set speed 19200
-set file type binary ; full 8 bit file xfer
-set file names literal
-set win 8
-set rec pack 1024
-set send pack 1024
-set block 3
-set term bytesize 8
-set command bytesize 8
-set flow none
-set modem hayes
-set dial hangup off
-set carrier auto ; Then SET CARRIER if necessary,
-set dial display on ; Then SET DIAL if necessary,
-set input echo on
-set input timeout proceed
-set input case ignore
-def \%x 0 ; login prompt counter
-goto slhup
-
-:slcmd ; put the modem in command mode
-echo Put the modem in command mode.
-clear ; Clear unread characters from input buffer
-pause 1
-output +++ ; hayes escape sequence
-input 1 OK\13\10 ; wait for OK
-if success goto slhup
-output \13
-pause 1
-output at\13
-input 1 OK\13\10
-if fail goto slcmd ; if modem doesn't answer OK, try again
-
-:slhup ; hang up the phone
-clear ; Clear unread characters from input buffer
-pause 1
-echo Hanging up the phone.
-output ath0\13 ; hayes command for on hook
-input 2 OK\13\10
-if fail goto slcmd ; if no OK answer, put modem in command mode
-
-:sldial ; dial the number
-pause 1
-echo Dialing.
-output atdt9,550311\13\10 ; put phone number here
-assign \%x 0 ; zero the time counter
-
-:look
-clear ; Clear unread characters from input buffer
-increment \%x ; Count the seconds
-input 1 {CONNECT }
-if success goto sllogin
-reinput 1 {NO CARRIER\13\10}
-if success goto sldial
-reinput 1 {NO DIALTONE\13\10}
-if success goto slnodial
-reinput 1 {\255}
-if success goto slhup
-reinput 1 {\127}
-if success goto slhup
-if < \%x 60 goto look
-else goto slhup
-
-:sllogin ; login
-assign \%x 0 ; zero the time counter
-pause 1
-echo Looking for login prompt.
-
-:slloop
-increment \%x ; Count the seconds
-clear ; Clear unread characters from input buffer
-output \13
-;
-; put your expected login prompt here:
-;
-input 1 {Username: }
-if success goto sluid
-reinput 1 {\255}
-if success goto slhup
-reinput 1 {\127}
-if success goto slhup
-if < \%x 10 goto slloop ; try 10 times to get a login prompt
-else goto slhup ; hang up and start again if 10 failures
-
-:sluid
-;
-; put your userid here:
-;
-output ppp-login\13
-input 1 {Password: }
-;
-; put your password here:
-;
-output ppp-password\13
-input 1 {Entering SLIP mode.}
-echo
-quit
-
-:slnodial
-echo \7No dialtone. Check the telephone line!\7
-exit 1
-
-; local variables:
-; mode: csh
-; comment-start: "; "
-; comment-start-skip: "; "
-; end:
-------------------------
-
-###################################################################
-Gennady B. Sorokopud ( gena@NetVision.net.il ) 24/10/94 12:00
diff --git a/share/FAQ/Text/slip.FAQ b/share/FAQ/Text/slip.FAQ
deleted file mode 100644
index 4baf38c..0000000
--- a/share/FAQ/Text/slip.FAQ
+++ /dev/null
@@ -1,192 +0,0 @@
-***********************************************************************
-*** How to Set Up SLIP on FreeBSD ***
-***********************************************************************
-
-$Id: slip.FAQ,v 1.2 1995/01/03 15:54:06 gclarkii Exp $
-
-Updated for 1.1.5(.1) support by Satoshi Asami, 8/6/94.
-
-The following is I (asami) set up my FreeBSD machine for SLIP on a
-static host network. For dynamic hostname assignments (i.e., your
-address changes each time you dial up), you probably need to do
-something much fancier.
-
-This is just "what I did, and it worked for me". I'm sharing this
-just for your reference, I'm no expert in SLIP nor networking so your
-mileage may vary.
-
-Note: for 1.1 systems (not 1.1.5), you need to use /dev/tty01 instead
-of /dev/cua01. substitute all the occurences of "cua" in this document
-with "tty".
-
-Note: the default 1.1.5(.1) system only comes with cua/ttyd pairs for
-the last two ports (2 and 3), so if your modem is at sio0/sio1
-(COM1/COM2), you need to make the devices. Try "cd /dev; sh MAKEDEV
-cua01" to make the new special files for sio1 (ditto for sio0). This
-will delete tty01, but you shouldn't need it anymore...or you can make
-a symbolic link /dev/tty01 -> ttyd1 if you don't want to hunt down all
-occurences of tty01 in your setup files.
-
-I actually have a symbolic link /dev/modem -> cua01 (and /dev/mouse ->
-ttyd0). I use only the modem/mouse names in my configuration files.
-This helped a lot when I switched from 1.1 to 1.1.5.1 (tty01 => cua01)
-and when I had to move my modem temporarily to sio2 to enable the
-RS-232C port on the serial card. It can become quite cumbersome when
-you need to fix a bunch of files in /etc and .kermrc's all over the
-system!
-
-First, make sure you have
-
-pseudo-device sl 2
-
-in your kernel's config file. It is included in the GENERIC, GENERICAH
-and GENERICBT kernels, so this won't be a problem unless you deleted it.
-
-Things you have to do only once:
-
-(1) Add your home machine, the gateway and nameservers to your
- /etc/hosts file. Mine looks like this:
-
-127.0.0.1 localhost loghost
-136.152.64.181 silvia.HIP.Berkeley.EDU silvia.HIP silvia
-
-136.152.64.1 inr-3.Berkeley.EDU inr-3 slip-gateway
-128.32.136.9 ns1.Berkeley.edu ns1
-128.32.136.12 ns2.Berkeley.edu ns2
-
- By the way, silvia is the name of the car that I had when I was
- back in Japan (it's called 2?0SX here in U.S.).
-
-(2) Make sure you have "hosts" before "bind" in your /etc/host.conf.
- Otherwise, funny things may happen.
-
-(3) Edit the /etc/netstart and add this to the end of the file:
-
-# set up slip
-gateway=slip-gateway
-ifconfig sl0 inet $hostname $gateway netmask 0xffffff00
-route add default $gateway
-
- Note that because of the "slip-gateway" entry in /etc/hosts, there
- is no local dependency in the netstart file. Also, you might want
- to un-comment the "route add $hostname localhost" line.
-
-(3') Make a file /etc/resolv.conf which contains:
-
-domain HIP.Berkeley.EDU
-nameserver 128.32.136.9
-nameserver 128.32.136.12
-
- As you can see, these set up the nameserver hosts. Of course, the
- actual addresses depend on your environment.
-
-(4) Set the password for root and toor (and any other accounts that
- doesn't have a password). Use passwd, don't edit the passwd or
- passwd.master files!
-
-(5) Edit /etc/myname and reboot the machine.
-
-How to set up the connection:
-
-(6) Dial up, type "slip" at the prompt, enter your machine name and
- password. The things you need to enter depends on your
- environment. I use kermit, with a script like this:
-
-# kermit setup
-set modem hayes
-set line /dev/cua01
-set speed 57600
-set parity none
-set flow rts/cts
-set terminal bytesize 8
-set file type binary
-# The next macro will dial up and login
-define slip dial 643-9600, input 10 =>, if failure stop, -
-output slip\x0d, input 10 Username:, if failure stop, -
-output silvia\x0d, input 10 Password:, if failure stop, -
-output ***\x0d, echo \x0aCONNECTED\x0a
-
- (of course, you have to change the hostname and password to fit
- yours). Then you can just type "slip" from the kermit prompt to
- get connected.
-
- Note: leaving your password in plain text anywhere in the
- filesystem is generally a BAD idea. Do it at your own risk. I'm
- just too lazy.
-
- Note: If you have an 1.1 machine, and kermit doesn't give you a
- prompt, try "stty -f /dev/tty01 clocal". I put this in
- /etc/rc.local so that it works the first time I boot the machine.
- This doesn't apply to 1.1.5(.1) systems, as cua0? are already
- configured for dialouts.
-
-(7) Leave the kermit there (you can suspend it by "z") and as root,
- type
-
-slattach -h -c -s 57600 /dev/cua01
-
- if you are able to "ping" hosts on campus, you are connected!
-
- If it doesn't work, you might want to try "-a" instead of "-c".
-
-(8) Happy slipping!
-
-How to shutdown the connection:
-
-(9) Type "ps gx" (as root) to find out the PID of slattach, and use
- "kill -INT" to kill it.
-
- Then go back to kermit ("fg" if you suspended it) and exit from it
- ("q").
-
- The slattach man page says you have to use "ifconfig sl0 down" to
- mark the interface down, but this doesn't seem to make any
- difference for me. ("ifconfig sl0" reports the same thing.)
-
- Some times, your modem might refuse to drop the carrier (mine
- often does). In that case, simply start kermit and quit it again.
- It usually goes out on the second try.
-
- When you want to connect again, go back to (6). You may have to
- watch out for clocal mode. If "stty -f /dev/tty01" doesn't tell
- you it's clocal, you need to re-set it before kermitting. Again,
- this is only for 1.1 machines.
-
-TROUBLESHOOTING:
-
-If it doesn't work, feel free to ask me. The things that people
-tripped over so far:
-
-* Not using "-c" or "-a" in slattach (I have no idea why this can be
- fatal, but adding this flag solved the problem for at least one
- person)
-
-* Using "s10" instead of "sl0" (might be hard to see the difference on
- some fonts :)
-
-Try "ifconfig sl0" to see your interface status. I get:
-
-silvia# ifconfig sl0
-sl0: flags=10<POINTOPOINT>
- inet 136.152.64.181 --> 136.152.64.1 netmask ffffff00
-
-Also, "netstat -r" will give the routing table, in case you get the
-"no route to host" messages from ping. Mine looks like:
-
-silvia# netstat -r
-Routing tables
-Destination Gateway Flags Refs Use IfaceMTU Rtt
-Netmasks:
-(root node)
-(root node)
-
-Route Tree for Protocol Family inet:
-(root node) =>
-default inr-3.Berkeley.EDU UG 8 224515 sl0 - -
-localhost.Berkel localhost.Berkeley UH 5 42127 lo0 - 0.438
-inr-3.Berkeley.E silvia.HIP.Berkele UH 1 0 sl0 - -
-silvia.HIP.Berke localhost.Berkeley UGH 34 47641234 lo0 - 0.438
-(root node)
-
-(this is after transferring a bunch of files, your numbers should be
-smaller).
diff --git a/share/FAQ/Text/slip_server.FAQ b/share/FAQ/Text/slip_server.FAQ
deleted file mode 100644
index 99b50a2..0000000
--- a/share/FAQ/Text/slip_server.FAQ
+++ /dev/null
@@ -1,433 +0,0 @@
- Slip Server
- FAQ
- For
- FreeBSD
-
-$Id: slip_server.FAQ,v 1.2 1994/12/16 04:01:16 gclarkii Exp $
-
-Help for setting up SLIP Server services on a FreeBSD system
-------------------------------------------------------------
-
-Written by Guy Helmer (ghelmer@alpha.dsu.edu)
-Last Updated December 13, 1994
-
-This document provides suggestions for setting up SLIP Server services
-on a FreeBSD system, which typically means configuring your system to
-automatically startup connections upon login for remote SLIP clients.
-I've written this document based on my own experience; however, as
-your system and needs may be different, this document may not answer
-all of your questions, and I cannot be responsible if you damage your
-system or lose data due to attempting to follow the suggestions here.
-
-I have only setup SLIP Server services on a FreeBSD 1.1 system, so if
-you are running a different version (such as FreeBSD 2.0), your system
-may be different. I've decided to write this document since I've
-recently been asked for the umpteenth time how to setup a FreeBSD
-machine as a SLIP server :-)
-
-
-1. Prerequisites
-----------------
-
-This document is very technical in nature, so background knowledge is
-required. I must assume that you are familiar with the TCP/IP network
-protocol, and in particular, network and node addressing, network
-address masks, subnetting, routing, and routing protocols, such as
-RIP. Configuring SLIP services on a dial-up server requires a
-knowledge of these concepts, and if you are not familiar with them,
-please read a copy of either Craig Hunt's "TCP/IP Network
-Administration" published by O'Reilly & Associates, Inc. (ISBN Number
-0-937175-82-X), or Douglas Comer's book on the TCP/IP protocol.
-
-I will assume that you have already setup your modem(s) and configured
-the appropriate system files to allow logins through your modems (see
-the manual pages for sio(4) for information on the serial port device
-driver and ttys(5), gettytab(5), getty(8), & init(8) for information
-relevant to configuring the system to accept logins on modems, and
-perhaps stty(1) for information on setting serial port parameters
-[such as "clocal" for directly-connected serial interfaces]).
-
-2. Quick Overview
------------------
-
-In its typical configuration, using FreeBSD as a SLIP server works as
-follows: a SLIP user dials up your FreeBSD SLIP Server system and logs
-in with a special SLIP login ID that uses "/usr/sbin/sliplogin" as the
-special user's shell. The "sliplogin" program browses the file
-"/etc/slip.hosts" to find a matching line for the special user, and if
-it finds a match, connects the serial line to an available SLIP
-interface and then runs /etc/slip.login to configure the SLIP
-interface.
-
-2.1 An Example of a SLIP Server Login
--------------------------------------
-
-For example, if my SLIP user ID were "Shelmerg", that user's entry in
-/etc/master.passwd would look something like this (except it would be
-all on one line):
-
-Shelmerg:password:1964:89::0:0:Guy Helmer - SLIP:
- /usr/users/Shelmerg:/usr/sbin/sliplogin
-
-and, when I log in with that user ID, "sliplogin" will search
-/etc/slip.hosts for a line that had a matching user ID; on my system,
-I may have a line in /etc/slip.hosts that reads:
-
-Shelmerg dc-slip sl-helmer 0xfffffc00 autocomp
-
-sliplogin will find that matching line, hook the serial line I'm on
-into the next available SLIP interface, and then execute
-/etc/slip.login like this:
-
-/etc/slip.login 0 19200 Shelmerg dc-slip sl-helmer 0xfffffc00 autocomp
-
-If all goes well, /etc/slip.login will issue an "ifconfig" for the
-SLIP interface to which sliplogin attached itself (slip interface 0,
-in the above example, which was the first parameter in the list given
-to slip.login) to set the local IP address (dc-slip), remote IP
-address (sl-helmer), network mask for the SLIP interface (0xfffffc00),
-and any additional flags (autocomp). If something goes wrong,
-sliplogin usually logs good informational messages via the daemon
-syslog facility, which usually goes into /var/log/messages (see the
-manual pages for syslogd(8) and syslog.conf(5), and perhaps check
-/etc/syslog.conf to see to which files syslogd is logging).
-
-OK, enough of the examples -- let's dive into setting up the system.
-
-3. Kernel Configuration
------------------------
-
-FreeBSD's default kernels usually come with two SLIP interfaces
-defined (sl0 and sl1); you can use "netstat -i" to see whether these
-interfaces are defined in your kernel.
-
-Sample output from "netstat -i":
-Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
-ed0 1500 <Link>0.0.c0.2c.5f.4a 291311 0 174209 0 133
-ed0 1500 138.247.224 ivory 291311 0 174209 0 133
-lo0 65535 <Link> 79 0 79 0 0
-lo0 65535 loop localhost 79 0 79 0 0
-sl0* 296 <Link> 0 0 0 0 0
-sl1* 296 <Link> 0 0 0 0 0
-
-The sl0 and sl1 interfaces shown in "netstat -i"'s output indicate
-that there are two SLIP interfaces built into the kernel. (The
-asterisks after the "sl0" and "sl1" indicate that the interfaces are
-"down".)
-
-However, FreeBSD's default kernels do not come configured to forward
-packets (ie, your FreeBSD machine will not act as a router) due to
-Internet RFC requirements for Internet hosts (see RFC's 1009
-[Requirements for Internet Gateways], 1122 [Requirements for Internet
-Hosts -- Communication Layers], and perhaps 1127 [A Perspective on the
-Host Requirements RFCs]), so if you want your FreeBSD SLIP Server to
-act as a router, you'll have to add the line "options GATEWAY" to your
-machine's kernel configuration file and re-compile the kernel anyway.
-(Trivia: "Gateways" are the Internet's old name for what are now
-usually called "routers".)
-
-Please see the BSD System Manager's Manual chapter on "Building
-Berkeley Kernels with Config" [the source for which is in
-/usr/src/share/doc/smm] and the "FreeBSD Configuration Options" [in
-/sys/doc/options.doc] for more information on configuring and building
-kernels. You may have to unpack the kernel source distribution if
-haven't installed the system sources already (srcdist/srcsys.?? in
-FreeBSD 1.1, srcdist/sys.?? in FreeBSD 1.1.5.1, or the entire source
-distribution in FreeBSD 2.0-RELEASE) to be able to configure and build
-kernels.
-
-You'll notice that near the end of the default kernel configuration
-file (/sys/i386/conf/GENERICAH) is a line that reads:
-
-pseudo-device sl 2
-
-which is the line that defines the number of SLIP devices available in
-the kernel; the number at the end of the line is the maximum number of
-SLIP connections that may be operating simultaneously.
-
-See the "Building Berkeley Kernels with Config" and the manual page
-for config(8) to see how to configure and build kernels.
-
-4. Sliplogin Configuration
---------------------------
-
-As mentioned earlier, there are three files in the /etc directory that
-are part of the configuration for /usr/sbin/sliplogin (see
-sliplogin(8) for the actual manual page for sliplogin): slip.hosts,
-which lists the SLIP users & their associated IP addresses;
-slip.login, which usually just configures the SLIP interface; and
-slip.logout, which undoes slip.login's effects when the serial
-connection is terminated.
-
-4.1 slip.hosts Configuration & Local and Remote Address Selection
------------------------------------------------------------------
-
-/etc/slip.hosts contains lines which have at least four items listed:
-a SLIP user's login ID, the local address (local to the SLIP server)
-of the SLIP link, the remote address of the SLIP link, and the network
-mask. The local and remote addresses may be host names (given in
-/etc/hosts or by the domain name service, depending on your
-specifications in /etc/host.conf), and I believe the network mask may
-be a name that can be resolved by a lookup into /etc/networks. On one
-of my systems, /etc/slip.hosts looks like this:
-
------ begin /etc/slip.hosts -----
-#
-# login local-addr remote-addr mask opt1 opt2
-# (normal,compress,noicmp)
-#
-Shelmerg dc-slip sl-helmerg 0xfffffc00 autocomp
------ end /etc/slip.hosts ------
-
-At the end of the line is one or more of the options:
-
- "normal" - no header compression
- "compress" - compress headers
- "autocomp" - compress headers if the remote end allows it
- "noicmp" - disable ICMP packets (so any "ping" packets won't use up
- any of your bandwidth)
-
-Your choice of local and remote addresses for your SLIP links depends
-on whether you are going to dedicate a TCP/IP subnet or if you are
-going to use "proxy ARP" on your SLIP server (it's not "true" proxy
-ARP, but that is the terminology that I will use in this document to
-describe it). If you're not sure which method to select or how to
-assign IP addresses, please refer to the TCP/IP books referenced in
-the "Prerequisites" section and/or consult your IP network manager.
-
-If you are going to use a separate subnet for your SLIP clients, you
-will need to allocate the subnet number out of your assigned IP
-network number and assign each of your SLIP client's IP numbers out of
-that subnet; then you will probably either need to configure a static
-route to the SLIP subnet via your SLIP server on your nearest IP
-router, or install "gated" on your FreeBSD SLIP server and configure
-it to talk the appropriate routing protocols to your other routers to
-inform them about your SLIP server's route to the SLIP subnet.
-
-Otherwise, if you will use the "proxy ARP" method, you will need to
-assign your SLIP client's IP addresses out of your SLIP server's
-Ethernet subnet, and you'll also need to adjust your /etc/slip.login
-and /etc/slip.logout scripts to use arp(8) to manage the proxy-ARP
-entries in the SLIP server's ARP table.
-
-4.2 slip.login Configuration
-----------------------------
-
-The typical /etc/slip.login file looks like this:
-
------ begin /etc/slip.login -----
-#!/bin/sh -
-#
-# @(#)slip.login 5.1 (Berkeley) 7/1/90
-
-#
-# 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
------ end /etc/slip.login -----
-
-This slip.login file merely ifconfig's the appropriate SLIP interface
-with the local and remote addresses and network mask of the SLIP
-interface.
-
-If you have decided to use the "proxy ARP" method (instead of using a
-separate subnet for your SLIP clients), your /etc/slip.login file will
-need to look something like this:
-
------ begin /etc/slip.login for "proxy ARP" -----
-#!/bin/sh -
-#
-# @(#)slip.login 5.1 (Berkeley) 7/1/90
-
-#
-# 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
-# Answer ARP requests for the SLIP client with our Ethernet addr
-/usr/sbin/arp -s $5 00:11:22:33:44:55 pub
------ end /etc/slip.login for "proxy ARP" -----
-
-The additional line in this slip.login, "arp -s...", creates an ARP
-entry in the SLIP server's ARP table which asks the system to give out
-the SLIP server's Ethernet MAC address whenever a another system or
-router on the Ethernet asks to speak to the SLIP client's IP address.
-
-When using the example above, be sure to replace the Ethernet MAC
-address (00:11:22:33:44:55) with the MAC address of your system's
-Ethernet card, or your "proxy ARP" will definitely not work! You can
-discover your SLIP server's Ethernet MAC address by looking at the
-results of running "netstat -i"; the second line of the output should
-look something like:
-
-ed0 1500 <Link>0.2.c1.28.5f.4a 191923 0 129457 0 116
- ^^^^^^^^^^^^^^^
-
-which indicates that this particular system's Ethernet MAC address is
-"00:02:c1:28:5f:4a" -- the periods in the Ethernet MAC address given
-by "netstat -i" must be changed to colons and leading zeros should be
-added to each single-digit hexadecimal number to convert the address
-into the form that arp(8) desires; see the manual page on arp(8) for
-complete information on usage.
-
-Note that when you create /etc/slip.login and /etc/slip.logout, the
-"execute" bit ("chmod 755 /etc/slip.login /etc/slip.logout") must be
-set, or sliplogin will be unable to execute it.
-
-4.3 slip.logout Configuration
------------------------------
-
-"/etc/slip.logout" isn't strictly needed, but if you decide to create
-it, this is an example of a basic slip.logout script:
-
------ begin /etc/slip.logout -----
-#!/bin/sh -
-#
-# slip.logout
-
-#
-# logout 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 down
------ end /etc/slip.logout -----
-
-If you are using "proxy ARP", you'll want to have /etc/slip.logout
-remove the ARP entry for the SLIP client:
-
------ begin /etc/slip.logout for "proxy ARP" -----
-#!/bin/sh -
-#
-# @(#)slip.logout
-
-#
-# logout 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 down
-# Quit answering ARP requests for the SLIP client
-/usr/sbin/arp -d $5
------ end /etc/slip.logout for "proxy ARP" -----
-
-The "arp -d $5" removes the ARP entry that the "proxy ARP" slip.login
-added when the SLIP client logged in.
-
-It bears repeating: make sure /etc/slip.logout has the execute bit set
-for after you create it (e.g., "chmod 755 /etc/slip.logout").
-
-5. Routing Considerations
--------------------------
-
-If you are not using the "proxy ARP" method for routing packets
-between your SLIP clients and the rest of your network (and perhaps
-the Internet), you will probably either have to add static routes to
-your closest default router(s) to route your SLIP client subnet via
-your SLIP server, or you will probably need to install and configure
-gated on your FreeBSD SLIP server so that it will tell your routers
-via appropriate routing protocols about your SLIP subnet.
-
-5.1 Static Routes
------------------
-
-Adding static routes to your nearest default routers can be
-troublesome (or impossible, if you don't have authority to do so...).
-If you have a multiple-router network in your organization, some
-routers, such as Cisco and Proteon, may not only need to be configured
-with the static route to the SLIP subnet, but also need to be told
-which static routes to tell other routers about, so some expertise and
-troubleshooting/tweaking may be necessary to get static-route-based
-routing to work...
-
-5.2 Running gated
------------------
-
-An alternative to the headaches of static routes is to install gated
-on your FreeBSD SLIP server and configure it to use the appropriate
-routing protocols (RIP/OSPF/BGP/EGP) to tell other routers about your
-SLIP subnet. gated is available from ftp.gated.cornell.edu in
-/pub/gated; I believe the current version as of this writing is
-"gated-R3_5Alpha_8.tar.Z", which should include support for FreeBSD
-"out-of-the-box". Compile and install it, and then write a
-/etc/gated.conf file to configure your gated; here's a sample, similar
-to what I use on my FreeBSD SLIP server:
-
------ begin sample /etc/gated.conf for gated version 3.5Alpha5 -----
-#
-# gated configuration file for dc.dsu.edu; for gated version 3.5alpha5
-# Only broadcast RIP information for xxx.xxx.yy out the ed Ethernet interface
-#
-#
-# tracing options
-#
-traceoptions "/var/tmp/gated.output" replace size 100k files 2 general ;
-
-rip yes {
- interface sl noripout noripin ;
- interface ed ripin ripout version 1 ;
- traceoptions route ;
-} ;
-
-#
-# Turn on a bunch of tracing info for the interface to the kernel:
-kernel {
- traceoptions remnants request routes info interface ;
-} ;
-
-#
-# Propagate the route to xxx.xxx.yy out the Ethernet interface via RIP
-#
-
-export proto rip interface ed {
- proto direct {
- xxx.xxx.yy mask 255.255.252.0 metric 1; # SLIP connections
- } ;
-} ;
-
-#
-# Accept routes from RIP via ed Ethernet interfaces
-
-import proto rip interface ed {
- all ;
-} ;
-
------ end sample /etc/gated.conf -----
-
-The above sample gated.conf file broadcasts routing information
-regarding the SLIP subnet "xxx.xxx.yy" via RIP onto the Ethernet; if
-you are using a different Ethernet driver than the "ed" driver, you'll
-need to change the references to the "ed" interface appropriately.
-This sample file also sets up tracing to /var/tmp/gated.output for
-debugging gated; you can certainly turn off the tracing options if
-gated works OK for you. I've changed my SLIP subnet's address to
-"xxx.xxx.yy" throughout the above file; you'll need to change the
-"xxx.xxx.yy"'s into the network address of your own SLIP subnet (be
-sure to change the net mask in the "proto direct" clause as well).
-Complete gated configuration information may be read through the Web
-at "http://www.gated.cornell.edu/".
-
-When you get gated built and installed, and create a configuration
-file for it, you'll need to run gated in place of routed on your
-FreeBSD system; change the routed/gated startup parameters in
-/etc/netstart as appropriate for your system. Please see the manual
-page for gated for information on gated's command-line parameters.
-
-6. Acknowledgements
--------------------
-
-Thanks to these people for comments and advice regarding this FAQ:
-
- Wilko Bulte <wilko@yedi.iaf.nl>
- Piero Serini <Piero@Strider.Inet.IT>
-
-<<< END OF SLIP SERVER FAQ >>>
-
-
diff --git a/share/FAQ/Text/submitters.FAQ b/share/FAQ/Text/submitters.FAQ
deleted file mode 100644
index 69a79f3..0000000
--- a/share/FAQ/Text/submitters.FAQ
+++ /dev/null
@@ -1,167 +0,0 @@
--- A submitter's guide to FreeBSD --
-
-This guide is intended for those who are moderately familar with FreeBSD
-and are now to the point where they have some locally developed
-customizations or fixes to the system which they'd like to incorporate
-back into the mainstream sources, thus saving the work of having to
-re-integrate the changes for each subsequent FreeBSD release. Submitting
-something to the FreeBSD project is also an excellent way of getting your
-code seriously *tested*! Many people have developed an original concept
-far beyond what they might have envisioned at the start just due to the
-flood of feedback and ideas generated by the many thousands of users of
-FreeBSD. Contributions are also what FreeBSD lives and grows from,
-and so your contributions are very important to the continued survival
-of this communal effort of ours - we're very glad to see you reading this
-documentation! :-)
-
-Submissions to FreeBSD can generally be classified into four catagories:
-
-1. Ideas, general suggestions, bug reports.
-2. Addition, deletion, renaming or patching of existing sources.
-3. Significant contribution of a large body of independant work.
-4. Porting of freely available software.
-
-A submission in *any* of these catagories is highly welcomed as they
-are each, in their own way, quite significant to the project.
-
-
-1. An idea, suggestion or fix can be communicated in one of the following ways:
-
- o An idea or suggestion of general technical interest should be
- mailed to <hackers@freebsd.org>. Likewise, people with an interest
- in such things (and a tolerance for a HIGH volume of mail!) may
- subscribe by sendimg mail to <majordomo@freebsd.org>. See also the
- file /usr/share/FAQ/mailing-list.FAQ.
-
- o An actual bug report should be filed by using the send-pr(1)
- command (``man send-pr'' for information). This will prompt
- you for various fields to fill in. Simply go to the fields
- surrounded by <>'s and fill in your own information in place of
- what's suggested there. You should receive confirmation of your
- bug report and a tracking number (which you should also reference in
- any subsequent correspondence).
-
- If you do not receive confirmation in a timely fashion (3 days to
- a week, depending on your email connection) or are, for some
- reason, unable to use the send-pr command, then you may also
- file a bug report (or follow-up to one) by sending mail to:
-
- <bugs@freebsd.org>
-
-
-2. An addition or change to the existing source code is a somewhat trickier
- affair and depends a lot on how far out of date you are with the current
- state of the core FreeBSD development. There is a special on-going release
- of FreeBSD known as "FreeBSD-current" and made available in a variety of
- ways (see /usr/share/FAQ/current-policy.FAQ and /usr/share/FAQ/ctm.FAQ) for
- the convenience of developers who wish to actively work on the system.
-
- Working from older sources unfortunately means that your changes may
- sometimes be too obsolete to use, or too divergent to allow for easy
- re-integration. This can be minimized somewhat by subscribing to the
- <announce@freebsd.org> mailing list (among others) where periodic
- announcements concerning the current state of the system are made.
- If you see a change being proposed for which you have a better solution,
- then please, by all means come forward with your contribution and we
- will do our very best to evaluate it fairly and perhaps integrate it if
- it is indeed a better (or easier :) solution.
-
- Assuming that you can manage to secure fairly up-to-date sources to base
- your changes on, the next step is to produce a set of diffs to send to the
- FreeBSD maintainers for evaluation and possible adoption. This is done
- with the diff(1) command, with the FreeBSD maintainers preferring to receive
- diffs in `context diff' form. See the man page for diff for more details
- on producing both context and recursive context diffs
- (diff -c <oldfile> <newfile> or diff -c -r <olddir> <newdir>).
-
- Once you have a set of diffs that are capable of taking a copy of the
- original code and bringing it to a state identical to the "new" sources
- (you may test this with the patch(1) command - see patch man page), you
- should bundle them up in an email message and send it, along with a brief
- description of what the diffs are for, to <hackers@freebsd.org>. Someone
- will very likely get back in touch with you in 24 hours or less, assuming
- of course that your diffs are interesting! :-)
-
- If your changes don't express themselves well as diffs alone (e.g. you've
- perhaps added, deleted or renamed files as well) then you may be better off
- bundling any new files, diffs and instructions for deleting/renaming any
- others into a tar file and running the `uuencode' program on it before
- sending the output of that to <hackers@freebsd.org>. See the man pages
- on tar and uuencode for more info on bundling files through the mail this
- way.
-
- If your change is of a potentially sensitive nature, e.g. you're unsure
- of copyright issues governing its further distribution, or you're simply
- not ready to release it without a tighter review first, then you should
- send it to <core@freebsd.org> rather than <hackers@freebsd.org>. The core
- mailing list reaches a much smaller group of people who do much of the
- day-to-day work on FreeBSD. Note that this group is also VERY BUSY and so
- you should really only mail to them in cases where mailing to hackers
- truly is impractical.
-
-
-3. In the case of a significant contribution of a large body work, or the
- addition of an important new feature to FreeBSD, it becomes almost always
- necessary to either send changes as uuencoded tar files (see above)
- or upload them to our ftp site:
- ftp://freefall.cdrom.com/pub/FreeBSD/incoming
-
- Users may log in anonymously and upload their work or download the
- work-in-progress files left by others.
-
- When working with large amounts of code, the touchy subject of copyrights
- also invariably comes up. The view of the FreeBSD project towards
- acceptable copyrights (for code included in FreeBSD) are:
-
- 3a. Contributions under the BSD copyright (see the file
- /usr/share/examples/etc/bsd-style-copyright for a template)
- is greatly preferred due to its "no strings attached"
- nature and general attractiveness to commercial enterprises
- who might then be inclined to invest something of their own
- into FreeBSD.
-
- 3b. Contributions under the GNU Public License, or "GPL". This is
- not quite as popular a solution for us, due to (all religious
- issues aside) the amount of extra effort demanded of anyone
- using the code for commercial purposes. However, given the
- sheer quantity of GPL'd code we currently require (compiler,
- assembler, text formatter, etc), it would be silly to pretend
- that we couldn't deal with the GPL at all and so we have become
- more willing to accept code with either the BSD or the GPL
- copyright. Code under the GPL also goes into a different part
- of the tree, that being /sys/gnu or /usr/src/gnu.
-
- 3c. Contributions coming under any other type of copyright must be
- carefully reviewed before their inclusion into FreeBSD will even
- be considered. Contributions for which particularly restrictive
- commercial copyrights apply are generally rejected, though the
- authors are always free to make the changes available through
- their own channels.
-
-
-4. The porting of freely available software, while perhaps not as gratifying
- as developing your own package from scratch, is still a vital part of
- FreeBSD's growth and of great usefulness to those who wouldn't otherwise
- know where to turn for it. All ported software is organized into a
- hierarchy know as ``the ports collection''. This collection enables
- a new user to get a complete overview of what's available in a short time,
- and with a logical (we hope) framework. The ports collection also saves
- considerable space by not actually containing the the majority of the
- sources being ported. This can be confusing to the new user and the file
- /usr/share/FAQ/ports.FAQ goes some way towards explaing how it all works.
-
- If you have the ports collection on your machine, the file
- /usr/ports/GUIDELINES also helps to explain the process of creating
- and contributing a port of your own. For more information on the ports
- collection (that wasn't available in the FAQ), you may also send mail to
- <ports@freebsd.org>.
-
-
-Whichever way you decide to contribute, we hope you'll find it an enjoyable
-process and also realize how valuable your contributions are to the project!
-FreeBSD is one of those great projects where the more we all put in, the
-more we all get back out of it again, and with enough steady contributions
-it begins to aquire a momentum of its own. It is through such momentum
-that mountains are moved! :-)
-
- Jordan
diff --git a/share/FAQ/Text/sup.FAQ b/share/FAQ/Text/sup.FAQ
deleted file mode 100644
index 681d123..0000000
--- a/share/FAQ/Text/sup.FAQ
+++ /dev/null
@@ -1,91 +0,0 @@
- FreeBSD
- Sup FAQ
-
-$Id: sup.FAQ,v 1.1 1995/03/21 20:19:46 jkh Exp $
-
- SUP is a network based software update tool developed at CMU. The
-purpose of this document is get the beginner up and running with sup.
-
- First off you will need to pick up the sup binaries. The easiest
-way of doing this is to grab the sup.tgz package from:
-
- ftp://ftp.FreeBSD.ORG:/pub/FreeBSD/packages/sup.tgz
-
-Install the sup package using pkg_add and add the following line to
-your /etc/services file:
-
- sup 871/tcp #sup
-
-SUP gets the information it needs to run from a configuration file
-called a supfile. This file tells sup what collections it will be updating
-and/or installing and where they go. The supfile in this directory will
-sup both the source and ports collection - look for the blank line seperating
-the two collections; if you don't want ports, you can simply delete all the
-ports entries. If you're inside the United States, you may also uncomment
-the `secure' collection line to grab the DES code. If you're outside the
-U.S., you should NOT sup this code from FreeBSD.ORG as this will
-violate U.S. export restrictions. Simply sup everything *but* the secure
-collection and then go look on "braae.ru.ac.za", where it's available for
-anonymous ftp for those outside the U.S.
-
-Any other distributions you do not wish to receive can be commented out
-with a # at the begining of the distribution line.
-
-Once this is setup, you're ready to go. To start sup type:
-
- sup supfile
-
-If you wish to see what sup is doing "verbosely", give it the -v option,
-like so:
-
- sup -v supfile
-
-Thats all there is to it! Remember that if you're running current,
-which is what you will have if you sup, please join the freebsd-current
-mailing list. You should also be sure to read:
-
- ftp://ftp.FreeBSD.ORG:/pub/FreeBSD/FAQ/current-policy.FAQ
-
-For important information on just what we can and cannot do for you as
-a -current user.
-
-Gary Clark II / Jordan Hubbard
-FreeBSD maintainance persons.
-
-----
-
-Description of FreeBSD SUP distributions:
-
-base: /usr/src/... misc files at the top of /usr/src
-bin: /usr/src/bin system binaries
-secure: /usr/src/secure DES Sources. U.S./Canada only!
-etc: /usr/src/etc system files
-games: /usr/src/games games
-gnu: /usr/src/gnu sources under the GNU Public License
-include: /usr/src/include include files
-sys: /usr/src/sys kernel sources
-lib: /usr/src/lib libraries
-libexec: /usr/src/libexec more system binaries
-share: /usr/src/share various shared resources
-sbin: /usr/src/sbin even more system binaries
-usrbin: /usr/src/usr.bin user binaries
-usrsbin: /usr/src/usr.sbin that's it for the system binaries
-
-Ports:
-
-ports-base: /usr/ports/... misc files at the top of /usr/ports
-ports-editors: /usr/ports/editors text editors
-ports-game: /usr/ports/games games
-ports-lang: /usr/ports/lang programming languages
-ports-mail: /usr/ports/mail mail software
-ports-math: /usr/ports/math math software
-ports-net: /usr/ports/net networking software
-ports-news: /usr/ports/news USENET news software
-ports-print: /usr/ports/print printing software
-ports-russian: /usr/ports/russian russian software
-ports-shells: /usr/ports/shells various UN*X shells
-ports-utils: /usr/ports/utils miscellaneous utilities
-ports-x11: /usr/ports/x11 X11 software
-
-
-
diff --git a/share/FAQ/Text/systems.FAQ b/share/FAQ/Text/systems.FAQ
deleted file mode 100644
index 34c8e71..0000000
--- a/share/FAQ/Text/systems.FAQ
+++ /dev/null
@@ -1,59 +0,0 @@
-
- Systems FAQ
- for FreeBSD 2.0
-
-This FAQ lists systems (and componets) known to work with FreeBSD 2.0. None
-of these lists should be seen as a recomandation for a manufacture.
-
-$Id: systems.FAQ,v 1.2 1995/01/03 15:54:08 gclarkii Exp $
-
-
-i386:
-
-
-Motherboard: Magitronics 386DX-40
-CPU: i386DX-40
-Busses: ISA and VLB (VLB not tested)
-Ram: 20 Megs
-Video: Generic 1MB Tseng 4000 (ISA)
-Disks:
- 2 - Segate ST1126 (SCSI)
- 1 - Seagate ST1480 (SCSI)
- 1 - Toshiba MK-234FC-C (IDE)
-Controllers:
- Generic IDE
- Adaptec AH-1542CF
-
-Motherboard: Magitronics 386SX-40
-CPU: i386SX-40
-Busses: ISA
-Ram: 4 Megs
-Video: Monochrome
-Disks:
- 1-Seagate ST1126 (SCSI)
-Controllers:
- Future Domain 850
-Notes: Slow but useable
-
-i486:
-
-Motherboard: Gateway 2000 Handbook 486 HB486DX2-40
-CPU: i486SL DX2/40
-BUS(S): PCMCIA, one type II
-Video Card: Monochrome VGA.
-Are you running X on this?: no, havn't really tried.
-Types of Disks (manufacture and bus): 130Mb builtin. <Areal A130 U>
-If you wish to be credited: Poul-Henning Kamp phk@freefall.cdrom.com
-
-NOTES:
-This is a 3 pound portable. Runs perfect. Suspend works great. Has one
-serial and one parallel/floppy port, which can drive either a floppy or
-a parallel port, but not at the same time. Builtin "EZ" mouse-thinge.
-Highly recommended for people on the road.
-
-
-Credits:
- FreeBSD Core Team
- Gary Clark II
- Poul-Henning Kamp
-
diff --git a/share/FAQ/UUCP_Internals.FAQ b/share/FAQ/UUCP_Internals.FAQ
deleted file mode 100644
index b927122..0000000
--- a/share/FAQ/UUCP_Internals.FAQ
+++ /dev/null
@@ -1,1603 +0,0 @@
-Path: bloom-beacon.mit.edu!cambridge-news.cygnus.com!comton.airs.com!ian
-From: ian@airs.com (Ian Lance Taylor)
-Newsgroups: comp.mail.uucp,comp.answers,news.answers
-Subject: UUCP Internals Frequently Asked Questions
-Keywords: UUCP, protocol, FAQ
-Message-ID: <uucp-internals_787915801@airs.com>
-Date: 20 Dec 94 09:30:02 GMT
-Expires: 31 Jan 95 09:30:01 GMT
-Reply-To: ian@airs.com (Ian Lance Taylor)
-Followup-To: comp.mail.uucp
-Organization: Infinity Development, Waltham, MA
-Lines: 1587
-Approved: news-answers-request@MIT.Edu
-Supersedes: <uucp-internals_785496601@airs.com>
-Xref: bloom-beacon.mit.edu comp.mail.uucp:5270 comp.answers:9043 news.answers:31575
-
-Archive-name: uucp-internals
-Version: $Revision: 1.26 $
-Last-modified: $Date: 1994/10/26 02:39:07 $
-
- This article was written by Ian Lance Taylor <ian@airs.com> and I may
- even update it periodically. Please send me mail about suggestions
- or inaccuracies.
-
- This article describes how the various UUCP protocols work, and
- discusses some other internal UUCP issues. It does not describe how
- to configure UUCP, nor how to solve UUCP connection problems, nor how
- to deal with UUCP mail. I do not know of any FAQ postings on these
- topics. There are some documents on the net describing UUCP
- configuration, but I can not keep an up to date list here; try using
- archie.
-
- If you haven't read the news.announce.newusers articles, read them.
-
- This article is in digest format. Some newsreaders will be able to
- break it apart into separate articles. Please don't ask me how to do
- this, though.
-
- This article answers the following questions. If one of these
- questions is posted to comp.mail.uucp, please send mail to the poster
- referring her or him to this FAQ. There is no reason to post a
- followup, as most of us know the answer already.
-
-Sources
-What does "alarm" mean in debugging output?
-What are UUCP grades?
-What is the format of a UUCP lock file?
-What is the format of a UUCP X.* file?
-What is the UUCP protocol?
-What is the 'g' protocol?
-What is the 'f' protocol?
-What is the 't' protocol?
-What is the 'e' protocol?
-What is the 'G' protocol?
-What is the 'i' protocol?
-What is the 'j' protocol?
-What is the 'x' protocol?
-What is the 'y' protocol?
-What is the 'd' protocol?
-What is the 'h' protocol?
-What is the 'v' protocol?
-Thanks
-
-----------------------------------------------------------------------
-
-From: Sources
-Subject: Sources
-
-"Unix-to-Unix Copy Program," said PDP-1. "You will never find a more
-wretched hive of bugs and flamers. We must be cautious."
- --DECWars
-
-I took a lot of the information from Jamie E. Hanrahan's paper in the
-Fall 1990 DECUS Symposium, and from Managing UUCP and Usenet by Tim
-O'Reilly and Grace Todino (with contributions by several other
-people). The latter includes most of the former, and is published by
- O'Reilly & Associates, Inc.
- 103 Morris Street, Suite A
- Sebastopol, CA 95472
-It is currently in its tenth edition. The ISBN number is
-0-937175-93-5.
-
-Some information is originally due to a Usenet article by Chuck
-Wegrzyn. The information on execution files comes partially from
-Peter Honeyman. The information on the 'g' protocol comes partially
-from a paper by G.L. Chesson of Bell Laboratories, partially from
-Jamie E. Hanrahan's paper, and partially from source code by John
-Gilmore. The information on the 'f' protocol comes from the source
-code by Piet Berteema. The information on the 't' protocol comes from
-the source code by Rick Adams. The information on the 'e' protocol
-comes from a Usenet article by Matthias Urlichs. The information on
-the 'd' protocol comes from Jonathan Clark, who also supplied
-information about QFT. The FSUUCP information comes straight from
-Christopher J. Ambler; it applies to version 1.4 and up.
-
-Although there are few books about UUCP, there are many about networks
-and protocols in general. I recommend two non-technical books which
-describe the sorts of things that are available on the network: ``The
-Whole Internet,'' by Ed Krol, and ``Zen and the Art of the Internet,''
-by Brendan P. Kehoe. Good technical discussions of networking issues
-can be found in ``Internetworking with TCP/IP,'' by Douglas E. Comer
-and David L. Stevens and in ``Design and Validation of Computer
-Protocols'' by Gerard J. Holzmann.
-
-------------------------------
-
-From: alarm
-Subject: What does "alarm" mean in debugging output?
-
-The debugging output of many versions of UUCP (but not Taylor UUCP)
-will include messages like
- alarm 1
-or
- pkcget: alarm 1
-
-This message means that the UUCP package has timed out while waiting
-for some sort of response from the remote system. This normally
-indicates some sort of connection problem. For example, the modems
-might have lost their connection, or perhaps one of the modems will
-not transmit the XON and XOFF characters, or perhaps one side or the
-other is dropping characters. It can also mean that the packages
-disagree about some aspect of the UUCP protocol, although this is less
-common.
-
-Using the information in the rest of this posting, you should be able
-to figure out what type of data your UUCP was expecting to receive.
-This may give some indication as to exactly what the problem is. It
-is difficult to be more specific, since there are many possiblities.
-
-------------------------------
-
-From: UUCP-grades
-Subject: What are UUCP grades?
-
-Modern UUCP packages support grades for each command. The grades
-generally range from 'A' (the highest) to 'Z' followed by 'a' to 'z'.
-Some UUCP packages also support '0' to '9' before 'A'. Some UUCP
-packages may permit any ASCII character as a grade.
-
-On Unix, these grades are encoded in the name of the command file. A
-command file name generally has the form
- C.nnnngssss
-where nnnn is the remote system name for which the command is queued,
-g is a single character grade, and ssss is a four character sequence
-number. For example, a command file created for the system ``airs''
-at grade 'Z' might be named
- C.airsZ2551
-
-The remote system name will be truncated to seven characters, to
-ensure that the command file name will fit in the 14 character file
-name limit of the traditional Unix file system. UUCP packages which
-have no other means of distinguishing which command files are intended
-for which systems thus require all systems they connect to to have
-names that are unique in the first seven characters. Some UUCP
-packages use a variant of this format which truncates the system name
-to six characters. HDB and Taylor UUCP use a different spool
-directory format, which allows up to fourteen characters to be used
-for each system name.
-
-The sequence number in the command file name may be a decimal integer,
-or it may be a hexadecimal integer, or it may contain any alphanumeric
-character. Different UUCP packages are different.
-
-FSUUCP (a DOS based UUCP and news package) uses up to 8 characters for
-file names in the spool (this is a DOS file name limitation; actually,
-with the extension, 11 characters are available, but FSUUCP reserves
-that for future use). FSUUCP defaults mail to grade D, and news to
-grade N, except that when the grade of incoming mail can be
-determined, that grade is preserved if the mail is forwarded to
-another system. Mail and news are currently the only 2 types of
-transfers supported. The default grades may be changed by editing
-the MAIL.RC file for mail, or the FSUUCP.CFG file for news.
-
-UUPC/extended for DOS, OS/2 and Windows NT handles mail at grade 'C',
-news at grade 'd', and file transfers at grade 'n'. The UUPC/extended
-UUCP and RMAIL commands accept grades to override the default, the
-others do not.
-
-I do not know how command grades are handled in other non-Unix UUCP
-packages.
-
-Modern UUCP packages allow you to restrict file transfer by grade
-depending on the time of day. Typically this is done with a line in
-the Systems (or L.sys) file like this:
- airs Any/Z,Any2305-0855 ...
-This allows grades 'Z' and above to be transferred at any time. Lower
-grades may only be transferred at night. I believe that this grade
-restriction applies to local commands as well as to remote commands,
-but I am not sure. It may only apply if the UUCP package places the
-call, not if it is called by the remote system.
-
-Taylor UUCP can use the ``timegrade'' and ``call-timegrade'' commands
-to achieve the same effect (and supports the above format when reading
-Systems or L.sys).
-
-UUPC/extended provides the symmetricgrades option to announce the
-current grade in effect when calling the remote system.
-
-This sort of grade restriction is most useful if you know what grades
-are being used at the remote site. The default grades used depend on
-the UUCP package. Generally uucp and uux have different defaults. A
-particular grade can be specified with the -g option to uucp or uux.
-For example, to request execution of rnews on airs with grade 'd', you
-might use something like
- uux -gd - airs!rnews <article
-
-Uunet queues up mail at grade 'C', but increases the grade based on
-the size. News is queued at grade 'd', and file transfers at grade
-'n'. The example above would allow mail (below some large size) to be
-received at any time, but would only permit news to be transferred at
-night.
-
-------------------------------
-
-From: UUCP-lock-file
-Subject: What is the format of a UUCP lock file?
-
-This discussion applies only to Unix. I have no idea how UUCP locks
-ports on other systems.
-
-UUCP creates files to lock serial ports and systems. On most if not
-all systems these same lock files are also used by cu to coordinate
-access to serial ports. On some systems getty also uses these lock
-files, often under the name uugetty.
-
-The lock file normally contains the process ID of the locking process.
-This makes it easy to determine whether a lock is still valid. The
-algorithm is to create a temporary file and then link it to the name
-that must be locked. If the link fails because a file with that name
-already exists, the existing file is read to get the process ID. If
-the process still exists, the lock attempt fails. Otherwise the lock
-file is deleted and the locking algorithm is retried.
-
-Older UUCP packages put the lock files in the main UUCP spool
-directory, /usr/spool/uucp. HDB UUCP generally puts the lock files in
-a directory of their own, usually /usr/spool/locks or /etc/locks.
-
-The original UUCP lock file format encodes the process ID as a four
-byte binary number. The order of the bytes is host-dependent. HDB
-UUCP stores the process ID as a ten byte ASCII decimal number, with a
-trailing newline. For example, if process 1570 holds a lock file, it
-would contain the eleven characters space, space, space, space, space,
-space, one, five, seven, zero, newline. Some versions of UUCP add a
-second line indicating which program created the lock (uucp, cu, or
-getty/uugetty). I have also seen a third type of UUCP lock file which
-does not contain the process ID at all.
-
-The name of the lock file is traditionally "LCK.." followed by the
-base name of the device. For example, to lock /dev/ttyd0 the file
-LCK..ttyd0 would be created. On SCO Unix, the lock file name is
-always forced to lower case even if the device name has upper case
-letters.
-
-System V Release 4 UUCP names the lock file using the major and minor
-device numbers rather than the device name. The file is named
-LK.XXX.YYY.ZZZ, where XXX, YYY and ZZZ are all three digit decimal
-numbers. XXX is the major device number of the device holding the
-directory holding the device file (e.g., /dev). YYY is the major
-device number of the device file itself. ZZZ is the minor device
-number of the device file itself. If s holds the result of passing
-the device to the stat system call (e.g., stat ("/dev/ttyd0", &s)),
-the following line of C code will print out the corresponding lock
-file name:
- printf ("LK.%03d.%03d.%03d", major (s.st_dev),
- major (s.st_rdev), minor (s.st_rdev));
-The advantage of this system is that even if there are several links
-to the same device, they will all use the same lock file name.
-
-------------------------------
-
-From: X-file
-Subject: What is the format of a UUCP X.* file?
-
-UUCP X.* files control program execution. They are created by uux.
-They are transferred between computers just like any other file. The
-uuxqt daemon reads them to figure out how to execute the job requested
-by uux.
-
-An X.* file is simply a text file. The first character of each line
-is a command, and the remainder of the line supplies arguments. The
-following commands are defined:
- C command
- This gives the command to execute, including the program and
- all arguments. For example,
- C rmail ian@airs.com
- U user system
- This names the user who requested the command, and the system
- from which the request came.
- I standard-input
- This names the file from which standard input is taken. If no
- standard input file is given, the standard input will probably
- be attached to /dev/null. If the standard input file is not
- from the system on which the execution is to occur, it will
- also appear in an F command.
- O standard-output [ system ]
- This names the standard output file. The optional second
- argument names the system to which the file should be sent.
- If there is no second argument, the file should be created on
- the executing system.
- F required-file [ filename-to-use ]
- The F command can appear multiple times. Each F command names
- a file which must exist before the execution can proceed.
- This will usually be a file which is transferred from the
- system on which uux was executed, but it can also be a file
- from the local system or some other system. If the file is
- not from the local system, then the command will usually name
- a file in the spool directory. If the optional second
- argument appears, then the file should be copied to the
- execution directory under that name. This is necessary for
- any file other than the standard input file. If the standard
- input file is not from the local system, it will appear in
- both an F command and an I command.
- R requestor-address
- This is the address to which mail about the job should be
- sent. It is relative to the system named in the U command.
- If the R command does not appear, then mail is sent to the
- user named in the U command.
- Z
- This command takes no arguments. It means that a mail message
- should be sent if the command failed. This is the default
- behaviour for most modern UUCP packages, and for them the Z
- command does not actually do anything.
- N
- This command takes no arguments. It means that no mail
- message should be sent, even if the command failed.
- n
- This command takes no arguments. It means that a mail message
- should be sent if the command succeeded. Normally a message
- is sent only if the command failed.
- B
- This command takes no arguments. It means that the standard
- input should be returned with any error message. This can be
- useful in cases where the input would otherwise be lost.
- e
- This command takes no arguments. It means that the command
- should be processed with /bin/sh. For some packages this is
- the default anyhow. Most packages will refuse to execute
- complex commands or commands containing wildcards, because of
- the security holes this opens.
- E
- This command takes no arguments. It means that the command
- should be processed with the execve system call. For some
- packages this is the default anyhow.
- M status-file
- This command means that instead of mailing a message, the
- message should be copied to the named file on the system named
- by the U command.
- # comment
- This command is ignored, as is any other unrecognized command.
-
-Here is an example. Given the following command executed on system
-test1
- uux - test2!cat - test2!~ian/bar !qux '>~/gorp'
-(this is only an example, as most UUCP systems will not permit the cat
-command to be executed) Taylor UUCP will produce the following X.
-file:
- U ian test1
- F D.test1N003r qux
- O /usr/spool/uucppublic test1
- F D.test1N003s
- I D.test1N003s
- C cat - ~ian/bar qux
-The standard input will be read into a file and then transferred to
-the file D.test1N003s on system test2, and the file qux will be
-transferred to D.test1N003r on system test2. When the command is
-executed, the latter file will be copied to the execution directory
-under the name qux. Note that since the file ~ian/bar is already on
-the execution system, no action need be taken for it. The standard
-output will be collected in a file, then copied to the directory
-/usr/spool/uucppublic on the system test1.
-
-------------------------------
-
-From: UUCP-protocol
-Subject: What is the UUCP protocol?
-
-The UUCP protocol is a conversation between two UUCP packages. A UUCP
-conversation consists of three parts: an initial handshake, a series
-of file transfer requests, and a final handshake.
-
-Before the initial handshake, the caller will usually have logged in
-the called machine and somehow started the UUCP package there. On
-Unix this is normally done by setting the shell of the login name used
-to /usr/lib/uucp/uucico.
-
-All messages in the initial handshake begin with a ^P (a byte with the
-octal value \020) and end with a null byte (\000). A few systems end
-these messages with a line feed character (\012) instead of a null
-byte; the examples below assume a null byte is being used.
-
-Some options below are supported by QFT, which stands for Queued File
-Transfer, and is (or was) an internal Bell Labs version of UUCP.
-
-Taylor UUCP size negotiation was introduced by Taylor UUCP, and is
-also supported by DOS based FSUUCP and Amiga based wUUCP and
-UUCP-1.17.
-
-The initial handshake goes as follows. It is begun by the called
-machine.
-
-called: \020Shere=hostname\000
- The hostname is the UUCP name of the called machine. Older UUCP
- packages do not output it, and simply send \020Shere\000.
-
-caller: \020Shostname options\000
- The hostname is the UUCP name of the calling machine. The
- following options may appear (or there may be none):
- -QSEQ
- Report sequence number for this conversation. The
- sequence number is stored at both sites, and incremented
- after each call. If there is a sequence number mismatch,
- something has gone wrong (somebody may have broken
- security by pretending to be one of the machines) and the
- call is denied. If the sequence number changes on one of
- the machines, perhaps because of an attempted breakin or
- because a disk backup was restored, the sequence numbers
- on the two machines must be reconciled manually. This is
- not supported by FSUUCP.
- -xLEVEL
- Requests the called system to set its debugging level to
- the specified value. This is not supported by all
- systems.
- -pGRADE
- -vgrade=GRADE
- Requests the called system to only transfer files of the
- specified grade or higher. This is not supported by all
- systems. Some systems support -p, some support -vgrade=.
- -R
- Indicates that the calling UUCP understands how to restart
- failed file transmissions. Supported only by System V
- Release 4 UUCP and QFT.
- -ULIMIT
- Reports the ulimit value of the calling UUCP. The limit
- is specified as a base 16 number in C notation (e.g.,
- -U0x1000000). This number is the number of 512 byte
- blocks in the largest file which the calling UUCP can
- create. The called UUCP may not transfer a file larger
- than this. Supported only by System V Release 4 UUCP, QFT
- and FSUUCP. FSUUCP reports the lesser of the
- available disk space on the spool directory drive and the
- ulimit variable in FSUUCP.CFG.
- -N
- Indicates that the calling UUCP understands the Taylor
- UUCP size negotiation extension. Not supported by
- traditional UUCP packages.
-
-called: \020ROK\000
- There are actually several possible responses.
- ROK
- The calling UUCP is acceptable, and the handshake proceeds
- to the protocol negotiation. Some options may also
- appear; see below.
- ROKN
- The calling UUCP is acceptable, it specified -N, and the
- called UUCP also understands the Taylor UUCP size limiting
- extensions.
- RLCK
- The called UUCP already has a lock for the calling UUCP,
- which normally indicates the two machines are already
- communicating.
- RCB
- The called UUCP will call back. This may be used to avoid
- impostors (but only one machine out of each pair should
- call back, or no conversation will ever begin).
- RBADSEQ
- The call sequence number is wrong (see the -Q discussion
- above).
- RLOGIN
- The calling UUCP is using the wrong login name.
- RYou are unknown to me
- The calling UUCP is not known to the called UUCP, and the
- called UUCP does not permit connections from unknown
- systems. Some versions of UUCP just drop the line rather
- than sending this message.
-
- If the response is ROK, the following options are supported by
- System V Release 4 UUCP and QFT.
- -R
- The called UUCP knows how to restart failed file
- transmissions.
- -ULIMIT
- Reports the ulimit value of the called UUCP. The limit is
- specified as a base 16 number in C notation. This number
- is the number of 512 byte blocks in the largest file which
- the called UUCP can create. The calling UUCP may not send
- a file larger than this. Also supported by FSUUCP.
- -xLEVEL
- I'm not sure just what this means. It may request the
- calling UUCP to set its debugging level to the specified
- value.
- If the response is not ROK (or ROKN) both sides hang up the phone,
- abandoning the call.
-
-called: \020Pprotocols\000
- Note that the called UUCP outputs two strings in a row. The
- protocols string is a list of UUCP protocols supported by the
- caller. Each UUCP protocol has a single character name. These
- protocols are discussed in more detail later in this document.
- For example, the called UUCP might send \020Pgf\000.
-
-caller: \020Uprotocol\000
- The calling UUCP selects which protocol to use out of the
- protocols offered by the called UUCP. If there are no mutually
- supported protocols, the calling UUCP sends \020UN\000 and both
- sides hang up the phone. Otherwise the calling UUCP sends
- something like \020Ug\000.
-
-Most UUCP packages will consider each locally supported protocol in
-turn and select the first one supported by the called UUCP. With some
-versions of HDB UUCP, this can be modified by giving a list of
-protocols after the device name in the Devices file or the Systems
-file. For example, to select the 'e' protocol in Systems,
- airs Any ACU,e ...
-or in Devices,
- ACU,e ttyXX ...
-Taylor UUCP provides the ``protocol'' command which may be used either
-for a system or a port.
-
-After the protocol has been selected and the initial handshake has been
-completed, both sides turn on the selected protocol. For some
-protocols (notably 'g') a further handshake is done at this point.
-
-Each protocol supports a method for sending a command to the remote
-system. This method is used to transmit a series of commands between
-the two UUCP packages. At all times, one package is the master and
-the other is the slave. Initially, the calling UUCP is the master.
-
-If a protocol error occurs during the exchange of commands, both sides
-move immediately to the final handshake.
-
-The master will send one of four commands: S, R, X or H.
-
-Any file name referred to below is either an absolute pathname
-beginning with "/", a public directory pathname beginning with "~/", a
-pathname relative to a user's home directory beginning with "~USER/",
-or a spool directory file name. File names in the spool directory are
-not pathnames, but instead are converted to pathnames within the spool
-directory by UUCP. They always begin with "C." (for a command file
-created by uucp or uux), "D." (for a data file created by uucp, uux or
-by an execution, or received from another system for an execution), or
-"X." (for an execution file created by uux or received from another
-system).
-
-master: S FROM TO USER -OPTIONS TEMP MODE NOTIFY SIZE
- The S and the - are literal characters. This is a request by the
- master to send a file to the slave.
- FROM
- The name of the file to send. If the C option does not
- appear in OPTIONS, the master will actually open and send
- this file. Otherwise the file has been copied to the
- spool directory, where it is named TEMP. The slave
- ignores this field unless TO is a directory, in which case
- the basename of FROM will be used as the file name. If
- FROM is a spool directory filename, it must be a data file
- created for or by an execution, and must begin with "D.".
- TO
- The name to give the file on the slave. If this field
- names a directory the file is placed within that directory
- with the basename of FROM. A name ending in `/' is taken
- to be a directory even if one does not already exist with
- that name. If TO begins with `X.', an execution file will
- be created on the slave. Otherwise, if TO begins with
- `D.' it names a data file to be used by some execution
- file. Otherwise, TO should not be in the spool directory.
- USER
- The name of the user who requested the transfer.
- OPTIONS
- A list of options to control the transfer. The following
- options are defined (all options are single characters):
- C
- The file has been copied to the spool directory
- (the master should use TEMP rather than FROM).
- c
- The file has not been copied to the spool
- directory (this is the default).
- d
- The slave should create directories as necessary
- (this is the default).
- f
- The slave should not create directories if
- necessary, but should fail the transfer instead.
- m
- The master should send mail to USER when the
- transfer is complete (not supported by FSUUCP).
- n
- The slave should send mail to NOTIFY when the
- transfer is complete (not supported by FSUUCP).
- TEMP
- If the C option appears in OPTIONS, this names the file to
- be sent. Otherwise if FROM is in the spool directory,
- TEMP is the same as FROM. Otherwise TEMP may be a dummy
- string, such as "D.0". After the transfer has been
- succesfully completed, the master will delete the file
- TEMP.
- MODE
- This is an octal number giving the mode of the file on
- MASTER. If the file is not in the spool directory, the
- slave will always create it with mode 0666, except that if
- (MODE & 0111) is not zero (the file is executable), the
- slave will create the file with mode 0777. If the file is
- in the spool directory, some UUCP packages will use the
- algorithm above and some will always create the file with
- mode 0600. This field is not used by FSUUCP, since it is
- meaningless on DOS.
- NOTIFY
- This field may not be present, and in any case is only
- meaningful if the n option appears in OPTIONS. If the n
- option appears, then when the transfer is successfully
- completed, the slave will send mail to NOTIFY, which must
- be a legal mailing address on the slave. If a SIZE field
- will appear but the n option does not appear, NOTIFY will
- always be present, typically as the string "dummy" or
- simply a pair of double quotes.
- SIZE
- This field is only present when doing Taylor UUCP or SVR4
- UUCP size negotiation, It is the size of the file in
- bytes. Taylor UUCP version 1.03 sends the size as a
- decimal integer, while versions 1.04 and up, and all other
- UUCP packages that support size negotiation, send the size
- in base 16 with a leading 0x.
-
- The slave then responds with an S command response.
- SY START
- The slave is willing to accept the file, and file transfer
- begins. The START field will only be present when using
- file restart. It specifies the byte offset into the file
- at which to start sending. If this is a new file, START
- will be 0x0.
- SN2
- The slave denies permission to transfer the file. This
- can mean that the destination directory may not be
- accessed, or that no requests are permitted. It implies
- that the file transfer will never succeed.
- SN4
- The slave is unable to create the necessary temporary
- file. This implies that the file transfer might succeed
- later.
- SN6
- This is only used by Taylor UUCP size negotiation. It
- means that the slave considers the file too large to
- transfer at the moment, but it may be possible to transfer
- it at some other time.
- SN7
- This is only used by Taylor UUCP size negotiation. It
- means that the slave considers the file too large to ever
- transfer.
- SN8
- This is only used by Taylor UUCP. It means that the file
- was already received in a previous conversation. This can
- happen if the receive acknowledgement was lost after it
- was sent by the receiver but before it was received by the
- sender.
- SN9
- This is only used by Taylor UUCP (versions 1.05 and up)
- and FSUUCP (versions 1.5 and up). It means that the
- remote system was unable to open another channel (see the
- discussion of the 'i' protocol for more information about
- channels). This implies that the file transfer might
- succeed later.
- SN10
- This is reportedly used by SVR4 UUCP to mean that the file
- size is too large.
-
- If the slave responds with SY, a file transfer begins. When the
- file transfer is complete, the slave sends a C command response.
- CY
- The file transfer was successful.
- CYM
- The file transfer was successful, and the slave wishes to
- become the master; the master should send an H command,
- described below.
- CN5
- The temporary file could not be moved into the final
- location. This implies that the file transfer will never
- succeed.
-
- After the C command response has been received (in the SY case) or
- immediately (in an SN case) the master will send another command.
-
-master: R FROM TO USER -OPTIONS SIZE
- The R and the - are literal characters. This is a request by the
- master to receive a file from the slave. I do not know how SVR4
- UUCP or QFT implement file transfer restart in this case.
- FROM
- This is the name of the file on the slave which the master
- wishes to receive. It must not be in the spool directory,
- and it may not contain any wildcards.
- TO
- This is the name of the file to create on the master. I
- do not believe that it can be a directory. It may only be
- in the spool directory if this file is being requested to
- support an execution either on the master or on some
- system other than the slave.
- USER
- The name of the user who requested the transfer.
- OPTIONS
- A list of options to control the transfer. The following
- options are defined (all options are single characters):
- d
- The master should create directories as necessary
- (this is the default).
- f
- The master should not create directories if
- necessary, but should fail the transfer instead.
- m
- The master should send mail to USER when the
- transfer is complete.
- SIZE
- This only appears if Taylor UUCP size negotiation is being
- used. It specifies the largest file which the master is
- prepared to accept (when using SVR4 UUCP or QFT, this was
- specified in the -U option during the initial handshake).
-
- The slave then responds with an R command response. FSUUCP does
- not support R requests, and always responds with RN2.
- RY MODE [ SIZE ]
- The slave is willing to send the file, and file transfer
- begins. MODE is the octal mode of the file on the slave.
- The master treats this just as the slave does the MODE
- argument in the send command, q.v. I am told that SVR4
- UUCP sends a trailing SIZE argument. For some versions of
- BSD UUCP, the MODE argument may have a trailing M
- character (e.g., RY 0666M). This means that the slave
- wishes to become the master.
- RN2
- The slave is not willing to send the file, either because
- it is not permitted or because the file does not exist.
- This implies that the file request will never succeed.
- RN6
- This is only used by Taylor UUCP size negotiation. It
- means that the file is too large to send, either because
- of the size limit specifies by the master or because the
- slave considers it too large. The file transfer might
- succeed later, or it might not (this will be cleared up in
- a later release of Taylor UUCP).
- RN9
- This is only used by Taylor UUCP (versions 1.05 and up)
- and FSUUCP (versions 1.5 and up). It means that the
- remote system was unable to open another channel (see the
- discussion of the 'i' protocol for more information about
- channels). This implies that the file transfer might
- succeed later.
-
- If the slave responds with RY, a file transfer begins. When the
- file transfer is complete, the master sends a C command. The
- slave pretty much ignores this, although it may log it.
- CY
- The file transfer was successful.
- CN5
- The temporary file could not be moved into the final
- location.
-
- After the C command response has been sent (in the RY case) or
- immediately (in an RN case) the master will send another command.
-
-master: X FROM TO USER -OPTIONS
- The X and the - are literal characters. This is a request by the
- master to, in essence, execute uucp on the slave. The slave
- should execute "uucp FROM TO".
- FROM
- This is the name of the file or files on the slave which
- the master wishes to transfer. Any wildcards are expanded
- on the slave. If the master is requesting that the files
- be transferred to itself, the request would normally
- contain wildcard characters, since otherwise an `R'
- command would suffice. The master can also use this
- command to request that the slave transfer files to a
- third system.
- TO
- This is the name of the file or directory to which the
- files should be transferred. This will normally use a
- UUCP name. For example, if the master wishes to receive
- the files itself, it would use "master!path".
- USER
- The name of the user who requested the transfer.
- OPTIONS
- A list of options to control the transfer. It is not
- clear which, if any, options are supported by most UUCP
- packages.
-
- The slave then responds with an X command response. FSUUCP does
- not support X requests, and always responds with XN.
- XY
- The request was accepted, and the appropriate file
- transfer commands have been queued up for later
- processing.
- XN
- The request was denied. No particular reason is given.
-
- In either case, the master will then send another command.
-
-master: H
- This is used by the master to hang up the connection. The slave
- will respond with an H command response.
- HY
- The slave agrees to hang up the connection. In this case
- the master sends another HY command. In some UUCP
- packages the slave will then send a third HY command. At
- this point the protocol is shut down, and the final
- handshake is begun.
- HN
- The slave does not agree to hang up. In this case the
- master and the slave exchange roles. The next command
- will be sent by the former slave, which is the new master.
- The roles may be reversed several times during a single
- connection.
-
-After the protocol has been shut down, the final handshake is
-performed. This handshake has no real purpose, and some UUCP packages
-simply drop the connection rather than do it (in fact, some will drop
-the connection immediately after both sides agree to hangup, without
-even closing down the protocol).
-
-caller: \020OOOOOO\000
-called: \020OOOOOOO\000
-
-That is, the calling UUCP sends six O's and the called UUCP replies
-with seven O's. Some UUCP packages always send six O's.
-
-------------------------------
-
-From: UUCP-g
-Subject: What is the 'g' protocol?
-
-The 'g' protocol is a packet based flow controlled error correcting
-protocol that requires an eight bit clear connection. It is the
-original UUCP protocol, and is supported by all UUCP implementations.
-Many implementations of it are only able to support small window and
-packet sizes, specifically a window size of 3 and a packet size of 64
-bytes, but the protocol itself can support up to a window size of 7
-and a packet size of 4096 bytes. Complaints about the inefficiency of
-the 'g' protocol generally refer to specific implementations, rather
-than to the correctly implemented protocol.
-
-The 'g' protocol was originally designed for general packet drivers,
-and thus contains some features that are not used by UUCP, including
-an alternate data channel and the ability to renegotiate packet and
-window sizes during the communication session.
-
-The 'g' protocol is spoofed by many Telebit modems. When spoofing is
-in effect, each Telebit modem uses the 'g' protocol to communicate
-with the attached computer, but the data between the modems is sent
-using a Telebit proprietary error correcting protocol. This allows
-for very high throughput over the Telebit connection, which, because
-it is half-duplex, would not normally be able to handle the 'g'
-protocol very well at all. When a Telebit is spoofing the 'g'
-protocol, it forces the packet size to be 64 bytes and the window size
-to be 3.
-
-This discussion of the 'g' protocol explains how it works, but does
-not discuss useful error handling techniques. Some discussion of this
-can be found in Jamie E. Hanrahan's paper, cited above.
-
-All 'g' protocol communication is done with packets. Each packet
-begins with a six byte header. Control packets consist only of the
-header. Data packets contain additional data.
-
-The header is as follows:
-
- \020
- Every packet begins with a ^P.
- k (1 <= k <= 9)
- The k value is always 9 for a control packet. For a data
- packet, the k value indicates how much data follows the six
- byte header. The amount of data is 2 ** (k + 4), where **
- indicates exponentiation. Thus a k value of 1 means 32 data
- bytes and a k value of 8 means 4096 data bytes. The k value
- for a data packet must be between 1 and 8 inclusive.
- checksum low byte
- checksum high byte
- The checksum value is described below.
- control byte
- The control byte indicates the type of packet, and is
- described below.
- xor byte
- This byte is the xor of k, the checksum low byte, the checksum
- high byte and the control byte (i.e., the second, third,
- fourth and fifth header bytes). It is used to ensure that the
- header data is valid.
-
-The control byte in the header is composed of three bit fields,
-referred to here as TT (two bits), XXX (three bits) and YYY (three
-bits). The control is TTXXXYYY, or (TT << 6) + (XXX << 3) + YYY.
-
-The TT field takes on the following values:
- 0
- This is a control packet. In this case the k byte in the
- header must be 9. The XXX field indicates the type of control
- packet; these types are described below.
- 1
- This is an alternate data channel packet. This is not used by
- UUCP.
- 2
- This is a data packet, and the entire contents of the attached
- data field (whose length is given by the k byte in the header)
- are valid. The XXX and YYY fields are described below.
- 3
- This is a short data packet. Let the length of the data field
- (as given by the k byte in the header) be L. Let the first
- byte in the data field be B1. If B1 is less than 128 (if the
- most significant bit of B1 is 0), then there are L - B1 valid
- bytes of data in the data field, beginning with the second
- byte. If B1 >= 128, let B2 be the second byte in the data
- field. Then there are L - ((B1 & 0x7f) + (B2 << 7)) valid
- bytes of data in the data field, beginning with the third
- byte. In all cases L bytes of data are sent (and all data
- bytes participate in the checksum calculation) but some of the
- trailing bytes may be dropped by the receiver. The XXX and
- YYY fields are described below.
-
-In a data packet (short or not) the XXX field gives the sequence
-number of the packet. Thus sequence numbers can range from 0 to 7,
-inclusive. The YYY field gives the sequence number of the last
-correctly received packet.
-
-Each communication direction uses a window which indicates how many
-unacknowledged packets may be transmitted before waiting for an
-acknowledgement. The window may range from 1 to 7, and may be
-different in each direction. For example, if the window is 3 and the
-last packet acknowledged was packet number 6, packet numbers 7, 0 and
-1 may be sent but the sender must wait for an acknowledgement before
-sending packet number 2. This acknowledgement could come as the YYY
-field of a data packet or as the YYY field of a RJ or RR control
-packet (described below).
-
-Each packet must be transmitted in order (the sender may not skip
-sequence numbers). Each packet must be acknowledged, and each packet
-must be acknowledged in order.
-
-In a control packet, the XXX field takes on the following values:
- 1 CLOSE
- The connection should be closed immediately. This is
- typically sent when one side has seen too many errors and
- wants to give up. It is also sent when shutting down the
- protocol. If an unexpected CLOSE packet is received, a CLOSE
- packet should be sent in reply and the 'g' protocol should
- halt, causing UUCP to enter the final handshake.
- 2 RJ or NAK
- The last packet was not received correctly. The YYY field
- contains the sequence number of the last correctly received
- packet.
- 3 SRJ
- Selective reject. The YYY field contains the sequence number
- of a packet that was not received correctly, and should be
- retransmitted. This is not used by UUCP, and most
- implementations will not recognize it.
- 4 RR or ACK
- Packet acknowledgement. The YYY field contains the sequence
- number of the last correctly received packet.
- 5 INITC
- Third initialization packet. The YYY field contains the
- maximum window size to use.
- 6 INITB
- Second initialization packet. The YYY field contains the
- packet size to use. It requests a size of 2 ** (YYY + 5).
- Note that this is not the same coding used for the k byte in
- the packet header (it is 1 less). Most UUCP implementations
- that request a packet size larger than 64 bytes can handle any
- packet size up to that specified.
- 7 INITA
- First initialization packet. The YYY field contains the
- maximum window size to use.
-
-The checksum of a control packet is simply 0xaaaa - the control byte.
-
-The checksum of a data packet is 0xaaaa - (CHECK ^ the control byte),
-where ^ denotes exclusive or, and CHECK is the result of the following
-routine as run on the contents of the data field (every byte in the
-data field participates in the checksum, even for a short data
-packet). Below is the routine used by Taylor UUCP; it is a slightly
-modified version of a routine which John Gilmore patched from G.L.
-Chesson's original paper. The z argument points to the data and the c
-argument indicates how much data there is.
-
-int
-igchecksum (z, c)
- register const char *z;
- register int c;
-{
- register unsigned int ichk1, ichk2;
-
- ichk1 = 0xffff;
- ichk2 = 0;
-
- do
- {
- register unsigned int b;
-
- /* Rotate ichk1 left. */
- if ((ichk1 & 0x8000) == 0)
- ichk1 <<= 1;
- else
- {
- ichk1 <<= 1;
- ++ichk1;
- }
-
- /* Add the next character to ichk1. */
- b = *z++ & 0xff;
- ichk1 += b;
-
- /* Add ichk1 xor the character position in the buffer counting from
- the back to ichk2. */
- ichk2 += ichk1 ^ c;
-
- /* If the character was zero, or adding it to ichk1 caused an
- overflow, xor ichk2 to ichk1. */
- if (b == 0 || (ichk1 & 0xffff) < b)
- ichk1 ^= ichk2;
- }
- while (--c > 0);
-
- return ichk1 & 0xffff;
-}
-
-When the 'g' protocol is started, the calling UUCP sends an INITA
-control packet with the window size it wishes the called UUCP to use.
-The called UUCP responds with an INITA packet with the window size it
-wishes the calling UUCP to use. Pairs of INITB and INITC packets are
-then similarly exchanged. When these exchanges are completed, the
-protocol is considered to have been started.
-
-Note that the window and packet sizes are not a negotiation. Each
-system announces the window and packet size which the other system
-should use. It is possible that different window and packet sizes
-will be used in each direction. The protocol works this way on the
-theory that each system knows how much data it can accept without
-getting overrun. Therefore, each system tells the other how much data
-to send before waiting for an acknowledgement.
-
-When a UUCP package transmits a command, it sends one or more data
-packets. All the data packets will normally be complete, although
-some UUCP packages may send the last one as a short packet. The
-command string is sent with a trailing null byte, to let the receiving
-package know when the command is finished. Some UUCP packages require
-the last byte of the last packet sent to be null, even if the command
-ends earlier in the packet. Some packages may require all the
-trailing bytes in the last packet to be null, but I have not confirmed
-this.
-
-When a UUCP package sends a file, it will send a sequence of data
-packets. The end of the file is signalled by a short data packet
-containing zero valid bytes (it will normally be preceeded by a short
-data packet containing the last few bytes in the file).
-
-Note that the sequence numbers cover the entire communication session,
-including both command and file data.
-
-When the protocol is shut down, each UUCP package sends a CLOSE
-control packet.
-
-------------------------------
-
-From: UUCP-f
-Subject: What is the 'f' protocol?
-
-The 'f' protocol is a seven bit protocol which checksums an entire
-file at a time. It only uses the characters between \040 and \176
-(ASCII space and ~) inclusive as well as the carriage return
-character. It can be very efficient for transferring text only data,
-but it is very inefficient at transferring eight bit data (such as
-compressed news). It is not flow controlled, and the checksum is
-fairly insecure over large files, so using it over a serial connection
-requires handshaking (XON/XOFF can be used) and error correcting
-modems. Some people think it should not be used even under those
-circumstances.
-
-I believe the 'f' protocol originated in BSD versions of UUCP. It was
-originally intended for transmission over X.25 PAD links.
-
-The 'f' protocol has no startup or finish protocol. However, both
-sides typically sleep for a couple of seconds before starting up,
-because they switch the terminal into XON/XOFF mode and want to allow
-the changes to settle before beginning transmission.
-
-When a UUCP package transmits a command, it simply sends a string
-terminated by a carriage return.
-
-When a UUCP package transmits a file, each byte b of the file is
-translated according to the following table:
-
- 0 <= b <= 037: 0172, b + 0100 (0100 to 0137)
- 040 <= b <= 0171: b ( 040 to 0171)
- 0172 <= b <= 0177: 0173, b - 0100 ( 072 to 077)
- 0200 <= b <= 0237: 0174, b - 0100 (0100 to 0137)
- 0240 <= b <= 0371: 0175, b - 0200 ( 040 to 0171)
- 0372 <= b <= 0377: 0176, b - 0300 ( 072 to 077)
-
-That is, a byte between \040 and \171 inclusive is transmitted as is,
-and all other bytes are prefixed and modified as shown.
-
-When all the file data is sent, a seven byte sequence is sent: two
-bytes of \176 followed by four ASCII bytes of the checksum as printed
-in base 16 followed by a carriage return. For example, if the
-checksum was 0x1234, this would be sent: "\176\1761234\r".
-
-The checksum is initialized to 0xffff. For each byte that is sent it
-is modified as follows (where b is the byte before it has been
-transformed as described above):
-
- /* Rotate the checksum left. */
- if ((ichk & 0x8000) == 0)
- ichk <<= 1;
- else
- {
- ichk <<= 1;
- ++ichk;
- }
-
- /* Add the next byte into the checksum. */
- ichk += b;
-
-When the receiving UUCP sees the checksum, it compares it against its
-own calculated checksum and replies with a single character followed
-by a carriage return.
- G
- The file was received correctly.
- R
- The checksum did not match, and the file should be resent from
- the beginning.
- Q
- The checksum did not match, but too many retries have occurred
- and the communication session should be abandoned.
-
-The sending UUCP checks the returned character and acts accordingly.
-
-------------------------------
-
-From: UUCP-t
-Subject: What is the 't' protocol?
-
-The 't' protocol is intended for use on links which provide reliable
-end-to-end connections, such as TCP. It does no error checking or
-flow control, and requires an eight bit clear channel.
-
-I believe the 't' protocol originated in BSD versions of UUCP.
-
-When a UUCP package transmits a command, it first gets the length of
-the command string, C. It then sends ((C / 512) + 1) * 512 bytes (the
-smallest multiple of 512 which can hold C bytes plus a null byte)
-consisting of the command string itself followed by trailing null
-bytes.
-
-When a UUCP package sends a file, it sends it in blocks. Each block
-contains at most 1024 bytes of data. Each block consists of four
-bytes containing the amount of data in binary (most significant byte
-first, the same format as used by the Unix function htonl) followed by
-that amount of data. The end of the file is signalled by a block
-containing zero bytes of data.
-
-------------------------------
-
-From: UUCP-e
-Subject: What is the 'e' protocol?
-
-The 'e' protocol is similar to the 't' protocol. It does no flow
-control or error checking and is intended for use over networks
-providing reliable end-to-end connections, such as TCP.
-
-The 'e' protocol originated in versions of HDB UUCP.
-
-When a UUCP package transmits a command, it simply sends the command
-as an ASCII string terminated by a null byte.
-
-When a UUCP package transmits a file, it sends the complete size of
-the file as an ASCII decimal number. The ASCII string is padded out
-to 20 bytes with null bytes (i.e. if the file is 1000 bytes long, it
-sends "1000\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"). It then sends the
-entire file.
-
-------------------------------
-
-From: UUCP-G
-Subject: What is the 'G' protocol?
-
-The 'G' protocol is used by SVR4 UUCP. It is identical to the 'g'
-protocol, except that it is possible to modify the window and packet
-sizes. The SVR4 implementation of the 'g' protocol reportedly is
-fixed at a packet size of 64 and a window size of 7. Supposedly SVR4
-chose to implement a new protocol using a new letter to avoid any
-potential incompatibilities when using different packet or window
-sizes.
-
-Most implementations of the 'g' protocol that accept packets larger
-than 64 bytes will also accept packets smaller than whatever they
-requested in the INITB packet. The SVR4 'G' implementation is an
-exception; it will only accept packets of precisely the size it
-requests in the INITB packet.
-
-------------------------------
-
-From: UUCP-i
-Subject: What is the 'i' protocol?
-
-The 'i' protocol was written by Ian Lance Taylor (who also wrote this
-FAQ). It is used by Taylor UUCP version 1.04.
-
-It is a sliding window packet protocol, like the 'g' protocol, but it
-supports bidirectional transfers (i.e., file transfers in both
-directions simultaneously). It requires an eight bit clear
-connection. Several ideas for the protocol were taken from the paper
-``A High-Throughput Message Transport System'' by P. Lauder. I don't
-know where the paper was published, but the author's e-mail address is
-piers@cs.su.oz.au. The 'i' protocol does not adopt his main idea,
-which is to dispense with windows entirely. This is because some
-links still do require flow control and, more importantly, because
-using windows sets a limit to the amount of data which the protocol
-must be able to resend upon request. To reduce the costs of window
-acknowledgements, the protocol uses a large window and only requires
-an ack at the halfway point.
-
-Each packet starts with a six byte header, optionally followed by data
-bytes with a four byte checksum. There are currently five defined
-packet types (DATA, SYNC, ACK, NAK, SPOS, CLOSE) which are described
-below. Although any packet type may include data, any data provided
-with an ACK, NAK or CLOSE packet is ignored.
-
-Every DATA, SPOS and CLOSE packet has a sequence number. The sequence
-numbers are independent for each side. The first packet sent by each
-side is always number 1. Each packet is numbered one greater than the
-previous packet, modulo 32.
-
-Every packet has a local channel number and a remote channel number.
-For all packets at least one channel number is zero. When a UUCP
-command is sent to the remote system, it is assigned a non-zero local
-channel number. All packets associated with that UUCP command sent by
-the local system are given the selected local channel number. All
-associated packets sent by the remote system are given the selected
-number as the remote channel number. This permits each UUCP command
-to be uniquely identified by the channel number on the originating
-system, and therefore each UUCP package can associate all file data
-and UUCP command responses with the appropriate command. This is a
-requirement for bidirectional UUCP transfers.
-
-The protocol maintains a single global file position, which starts at
-0. For each incoming packet, any associated data is considered to
-occur at the current file position, and the file position is
-incremented by the amount of data contained. The exception is a
-packet of type SPOS, which is used to change the file position.
-The reason for keeping track of the file position is described below.
-
-The header is as follows:
-
- \007
- Every packet begins with ^G.
- (PACKET << 3) + LOCCHAN
- The five bit packet number combined with the three bit local
- channel number. DATA, SPOS and CLOSE packets use the packet
- sequence number for the PACKET field. NAK packet types use
- the PACKET field for the sequence number to be resent. ACK
- and SYNC do not use the PACKET field, and generally leave it
- set to 0. Packets which are not associated with a UUCP
- command from the local system use a local channel number of 0.
- (ACK << 3) + REMCHAN
- The five bit packet acknowledgement combined with the three
- bit remote channel number. The packet acknowledgement is the
- number of the last packet successfully received; it is used by
- all packet types. Packets which are not sent in response to a
- UUCP command from the remote system use a remote channel
- number of 0.
- (TYPE << 5) + (CALLER << 4) + LEN1
- The three bit packet type combined with the one bit packet
- direction combined with the upper four bits of the data
- length. The packet direction bit is always 1 for packets sent
- by the calling UUCP, and 0 for packets sent by the called
- UUCP. This prevents confusion caused by echoed packets.
- LEN2
- The lower eight bits of the data length. The twelve bits of
- data length permit packets ranging in size from 0 to 4095
- bytes.
- CHECK
- The exclusive or of the second through fifth bytes of the
- header. This provides an additional check that the header is
- valid.
-
-If the data length is non-zero, the packet is immediately followed by
-the specified number of data bytes. The data bytes are followed by a
-four byte CRC 32 checksum, with the most significant byte first. The
-CRC is calculated over the contents of the data field.
-
-The defined packet types are as follows:
-
- 0 (DATA)
- This is a plain data packet.
- 1 (SYNC)
- SYNC packets are exchanged when the protocol is initialized,
- and are described further below. SYNC packets do not carry
- sequence numbers (that is, the PACKET field is ignored).
- 2 (ACK)
- This is an acknowledgement packet. Since DATA packets also
- carry packet acknowledgements, ACK packets are only used when
- one side has no data to send. ACK packets do not carry
- sequence numbers.
- 3 (NAK)
- This is a negative acknowledgement. This is sent when a
- packet is received incorrectly, and means that the packet
- number appearing in the PACKET field must be resent. NAK
- packets do not carry sequence numbers (the PACKET field is
- already used).
- 4 (SPOS)
- This packet changes the file position. The packet contains
- four bytes of data holding the file position, most significant
- byte first. The next packet received will be considered to be
- at the named file position.
- 5 (CLOSE)
- When the protocol is shut down, each side sends a CLOSE
- packet. This packet does have a sequence number, which could
- be used to ensure that all packets were correctly received
- (this is not needed by UUCP, however, which uses the higher
- level H command with an HY response).
-
-When the protocol starts up, both systems send a SYNC packet. The
-SYNC packet includes at least three bytes of data. The first two
-bytes are the maximum packet size the remote system should send, most
-significant byte first. The third byte is the window size the remote
-system should use. The remote system may send packets of any size up
-to the maximum. If there is a fourth byte, it is the number of
-channels the remote system may use (this must be between 1 and 7,
-inclusive). Additional data bytes may be defined in the future.
-
-The window size is the number of packets that may be sent before a
-packet is acknowledged. There is no requirement that every packet be
-acknowledged; any acknowledgement is considered to acknowledge all
-packets through the number given. In the current implementation, if
-one side has no data to send, it sends an ACK when half the window is
-received.
-
-Note that the NAK packet corresponds to the unused 'g' protocol SRJ
-packet type, rather than to the RJ packet type. When a NAK is
-received, only the named packet should be resent, not any subsequent
-packets.
-
-Note that if both sides have data to send, but a packet is lost, it is
-perfectly reasonable for one side to continue sending packets, all of
-which will acknowledge the last packet correctly received, while the
-system whose packet was lost will be unable to send a new packet
-because the send window will be full. In this circumstance, neither
-side will time out and one side of the communication will be
-effectively shut down for a while. Therefore, any system with
-outstanding unacknowledged packets should arrange to time out and
-resend a packet even if data is being received.
-
-Commands are sent as a sequence of data packets with a non-zero local
-channel number. The last data packet for a command includes a
-trailing null byte (normally a command will fit in a single data
-packet). Files are sent as a sequence of data packets ending with one
-of length zero.
-
-The channel numbers permit a more efficient implementation of the UUCP
-file send command. Rather than send the command and then wait for the
-SY response before sending the file, the file data is sent beginning
-immediately after the S command is sent. If an SN response is
-received, the file send is aborted, and a final data packet of length
-zero is sent to indicate that the channel number may be reused. If an
-SY reponse with a file position indicator is received, the file send
-adjusts to the file position; this is why the protocol maintains a
-global file position.
-
-Note that the use of channel numbers means that each UUCP system may
-send commands and file data simultaneously. Moreover, each UUCP
-system may send multiple files at the same time, using the channel
-number to disambiguate the data. Sending a file before receiving an
-acknowledgement for the previous file helps to eliminate the round
-trip delays inherent in other UUCP protocols.
-
-------------------------------
-
-From: UUCP-j
-Subject: What is the 'j' protocol?
-
-The 'j' protocol is a variant of the 'i' protocol. It was also
-written by Ian Lance Taylor, and first appeared in Taylor UUCP version
-1.04.
-
-The 'j' protocol is a version of the 'i' protocol designed for
-communication links which intercept a few characters, such as XON or
-XOFF. It is not efficient to use it on a link which intercepts many
-characters, such as a seven bit link. The 'j' protocol performs no
-error correction or detection; that is presumed to be the
-responsibility of the 'i' protocol.
-
-When the 'j' protocol starts up, each system sends a printable ASCII
-string indicating which characters it wants to avoid using. The
-string begins with the ASCII character '^' (octal 136) and ends with
-the ASCII character '~' (octal 176). After sending this string, each
-system looks for the corresponding string from the remote system. The
-strings are composed of escape sequences: \ooo, where o is an octal
-digit. For example, sending the string ^\021\023~ means that the
-ASCII XON and XOFF characters should be avoided. The union of the
-characters described in both strings (the string which is sent and the
-string which is received) is the set of characters which must be
-avoided in this conversation. Avoiding a printable ASCII character
-(octal 040 to octal 176, inclusive) is not permitted.
-
-After the exchange of characters to avoid, the normal 'i' protocol
-start up is done, and the rest of the conversation uses the normal 'i'
-protocol. However, each 'i' protocol packet is wrapped to become a
-'j' protocol packet.
-
-Each 'j' protocol packet consists of a seven byte header, followed by
-data bytes, followed by index bytes, followed by a one byte trailer.
-The packet header looks like this:
-
- ^
- Every packet begins with the ASCII character '^', octal 136.
- HIGH
- LOW
- These two characters give the total number of bytes in the
- packet. Both HIGH and LOW are printable ASCII characters.
- The length of the packet is (HIGH - 040) * 0100 + (LOW - 040),
- where 040 <= HIGH < 0177 and 040 <= LOW < 0140. This permits
- a length of 6079 bytes, but there is a further restriction on
- packet size described below.
- =
- The ASCII character '=', octal 075.
- DATA-HIGH
- DATA-LOW
- These two characters give the total number of data bytes in
- the packet. The encoding is as described for HIGH and LOW.
- The number of data bytes is the size of the 'i' protocol
- packet wrapped inside this 'j' protocol packet.
- @
- The ASCII character '@', octal 100.
-
-The header is followed by the number of data bytes given in DATA-HIGH
-and DATA-LOW. These data bytes are the 'i' protocol packet which is
-being wrapped in the 'j' protocol packet. However, each character in
-the 'i' protocol packet which the 'j' protocol must avoid is
-transformed into a printable ASCII character (recall that avoiding a
-printable ASCII character is not permitted). Two index bytes are used
-for each character which must be transformed.
-
-The index bytes immediately follow the data bytes. The index bytes
-are created in pairs. Each pair of index bytes encodes the location
-of a character in the 'i' protocol packet which was transformed to
-become a printable ASCII character. Each pair of index bytes also
-encodes the precise transformation which was performed.
-
-When the sender finds a character which must be avoided, it will
-transform it using one or two operations. If the character is 0200 or
-greater, it will subtract 0200. If the resulting character is less
-than 020, or is equal to 0177, it will xor by 020. The result is
-a printable ASCII character.
-
-The zero based byte index of the character within the 'i' protocol
-packet is determined. This index is turned into a two byte printable
-ASCII index, INDEX-HIGH and INDEX-LOW, such that the index is
-(INDEX-HIGH - 040) * 040 + (INDEX-LOW - 040). INDEX-LOW is restricted
-such that 040 <= INDEX-LOW < 0100. INDEX-HIGH is not permitted to be
-0176, so 040 <= INDEX-HIGH < 0176. INDEX-LOW is then modified to
-encode the transformation:
-
- If the character transformation only had to subtract 0200, then
- INDEX-LOW is used as is.
-
- If the character transformation only had to xor by 020, then 040
- is added to INDEX-LOW.
-
- If both operations had to be performed, then 0100 is added to
- INDEX-LOW. However, if the value of INDEX-LOW were initially 077,
- then adding 0100 would result in 0177, which is not a printable
- ASCII character. For that special case, INDEX-HIGH is set to
- 0176, and INDEX-LOW is set to the original value of INDEX-HIGH.
-
-The receiver decodes the index bytes as follows (this is the reverse
-of the operations performed by the sender, presented here for
-additional clarity):
-
- The first byte in the index is INDEX-HIGH, and the second is
- INDEX-LOW.
-
- If 040 <= INDEX-HIGH < 0176, the index refers to the data byte at
- position (INDEX-HIGH - 040) * 040 + INDEX-LOW % 040.
-
- If 040 <= INDEX-LOW < 0100, then 0200 must be added to indexed
- byte.
-
- If 0100 <= INDEX-LOW < 0140, then 020 must be xor'ed to the
- indexed byte.
-
- If 0140 <= INDEX-LOW < 0177, then 0200 must be added to the
- indexed byte, and 020 must be xor'ed to the indexed byte.
-
- If INDEX-HIGH == 0176, the index refers to the data byte at
- position (INDEX-LOW - 040) * 040 + 037. 0200 must be added to the
- indexed byte, and 020 must be xor'ed to the indexed byte.
-
-This means the largest 'i' protocol packet which may be wrapped inside
-a 'j' protocol packet is (0175 - 040) * 040 + (077 - 040) == 3007
-bytes.
-
-The final character in a 'j' protocol packet, following the index
-bytes, is the ASCII character '~' (octal 176).
-
-The motivation behind using an indexing scheme, rather than escape
-characters, is to avoid data movement. The sender may simply add a
-header and a trailer to the 'i' protocol packet. Once the receiver
-has loaded the 'j' protocol packet, it may scan the index bytes,
-transforming the data bytes, and then pass the data bytes directly on
-to the 'i' protocol routine.
-
-------------------------------
-
-From: UUCP-x
-Subject: What is the 'x' protocol?
-
-The 'x' protocol is used in Europe (and probably elsewhere) with
-machines that contain an builtin X.25 card and can send eight bit data
-transparently across X.25 circuits, without interference from the X.28
-or X.29 layers. The protocol sends packets of 512 bytes, and relies
-on a write of zero bytes being read as zero bytes without stopping
-communication. It first appeared in the original System V UUCP
-implementation.
-
-------------------------------
-
-From: UUCP-y
-Subject: What is the 'y' protocol?
-
-The 'y' protocol was developed by Jorge Cwik for use in FX UUCICO, a
-PC uucico program. It is designed for communication lines which
-handle error correction and flow control. It is a streaming protocol,
-like the 'f' protocol. It requires an eight bit clean connection. It
-performs error detection, but not error correction; when an error is
-detected, the line is dropped. I do not know the implementation
-details.
-
-------------------------------
-
-From: UUCP-d
-Subject: What is the 'd' protocol?
-
-This is apparently used for DataKit muxhost (not RS-232) connections.
-No file size is sent. When a file has been completely transferred, a
-write of zero bytes is done; this must be read as zero bytes on the
-other end.
-
-------------------------------
-
-From: UUCP-h
-Subject: What is the 'h' protocol?
-
-This is apparently used in some places with HST modems. It does no
-error checking, and is not that different from the 't' protocol. I
-don't know the details.
-
-------------------------------
-
-From: UUCP-v
-Subject: What is the 'v' protocol?
-
-The 'v' protocol is used by UUPC/extended, a PC UUCP program. It is
-simply a version of the 'g' protocol which supports packets of any
-size, and also supports sending packets of different sizes during the
-same conversation. There are many 'g' protocol implementations which
-support both, but there are also many which do not. Using 'v' ensures
-that everything is supported.
-
-------------------------------
-
-From: Thanks
-Subject: Thanks
-
-Besides the papers and information acknowledged at the top of this
-article, the following people have contributed help, advice,
-suggestions and information:
- Earle Ake 513-429-6500 <ake@Dayton.SAIC.COM>
- cambler@nike.calpoly.edu (Christopher J. Ambler)
- jhc@iscp.bellcore.com (Jonathan Clark)
- jorge@laser.satlink.net (Jorge Cwik)
- celit!billd@UCSD.EDU (Bill Davidson)
- "Drew Derbyshire" <ahd@kew.com>
- erik@pdnfido.fidonet.org
- Matthew Farwell <dylan@ibmpcug.co.uk>
- dgilbert@gamiga.guelphnet.dweomer.org (David Gilbert)
- kherron@ms.uky.edu (Kenneth Herron)
- Mike Ipatow <mip@fido.itc.e-burg.su>
- Romain Kang <romain@pyramid.com>
- "Jonathan I. Kamens" <jik@GZA.COM>
- "David J. MacKenzie" <djm@eng.umd.edu>
- jum@helios.de (Jens-Uwe Mager)
- peter@xpoint.ruessel.sub.org (Peter Mandrella)
- david nugent <david@csource.oz.au>
- Stephen.Page@prg.oxford.ac.uk
- joey@tessi.UUCP (Joey Pruett)
- James Revell <revell@uunet.uu.net>
- Larry Rosenman <ler@lerami.lerctr.org>
- Rich Salz <rsalz@bbn.com>
- evesg@etlrips.etl.go.jp (Gjoen Stein)
- kls@ditka.Chicago.COM (Karl Swartz)
- Dima Volodin <dvv@hq.demos.su>
- jon@console.ais.org (Jon Zeeff)
- Eric Ziegast <ziegast@uunet.uu.net>
-
-------------------------------
-
-End of UUCP Internals Frequently Asked Questions
-******************************
---
-Ian Taylor | ian@airs.com | First to identify quote wins free e-mail message:
-``You don't have to sleep. That's just something *they* tell you to keep
- *control* over you. Nobody has to sleep; you're *taught* to sleep when
- you're a kid. If you're really determined, you can get over it.''
diff --git a/share/FAQ/ctm.FAQ b/share/FAQ/ctm.FAQ
deleted file mode 100644
index 60f7010..0000000
--- a/share/FAQ/ctm.FAQ
+++ /dev/null
@@ -1,191 +0,0 @@
-# ----------------------------------------------------------------------------
-# "THE BEER-WARE LICENSE" (Revision 42):
-# <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
-# can do whatever you want with this stuff. If we meet some day, and you think
-# this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
-# ----------------------------------------------------------------------------
-#
-# $Id: ctm.FAQ,v 1.5 1995/03/05 23:13:08 roberto Exp $
-#
-
- Obtaining FreeBSD-current sources using CTM.
- ============================================
-
-CTM is a method for keeping a remote directory tree in sync with a
-central one. It has been developed for usage with FreeBSD's source
-trees, though other people may find it useful for other purposes as
-time goes by. Little, if any, documentation currently exists at this
-time on the process of creating deltas so talk to phk@FreeBSD.org for
-more information should you wish to use CTM for other things.
-
-
-Why should I use CTM ?
-----------------------
-CTM will give you a local copy of the "FreeBSD-current" sources. If
-you are an active developer on FreeBSD, but have lousy or non-existent
-TCP/IP connectivity, CTM was made for you. You will need to transfer
-up to four deltas per day (or you can have them arrive in email
-automatically), the sizes for which are always kept as small as
-possible. This is typically less than 5K, with the occasional (one in
-ten) being 10-50K and every now and then a biggie of 100K+ or more
-coming around.
-
-You will also need to make yourself aware of the various caveats in
-running "current" sources, and for this it is recommended that you
-refer to the relevant FAQ: /usr/share/FAQ/current-policy.FAQ
-
-
-What do I need to use CTM?
---------------------------
-
-You will need two things: The "ctm" program and the initial deltas to
-feed it (to get up to "current" levels).
-
-The ctm program is in the FreeBSD-current tree from version 2.0.0 and
-forward (/usr/src/usr.sbin/ctm). If you are running an older version
-of FreeBSD, you can fetch the current ctm sources directly from:
-
- ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.sbin/ctm/
-
-The "deltas" you feed ctm can be had two ways, ftp or email. If you
-have general ftp access to the Internet, then the following ftp sites
-support access to CTM:
-
- ftp://freefall.cdrom.com/pub/CTM
-
-Ftp the the relevant directory and fetch the README file, starting
-from there.
-
-If you only have access to electronic mail or are otherwise blocked
-from using ftp, then you may wish to receive your deltas via email:
-
-Send email to majordomo@freebsd.org to subscribe to the list
-"ctm-src-cur" (if you do not know how to subscribe yourself using
-majordomo, send a message first containing the word `help' - it will
-send you back usage instructions).
-
-When you begin receiving your CTM updates in the mail, you may use the
-ctm_rmail program to unpack and apply them with. You can actually use
-the ctm_rmail program directly from a entry in /etc/aliases if you
-want. Check the "ctm_rmail" man page for more details.
-
-NOTE:
------
-
-No matter what method you use to get the CTM deltas, you should subscribe
-to the ctm-announce@freebsd.org mailing list. In the future this will be
-the only place where announcements about the operation of the CTM system
-will be posted. Send an email to majordomo@freebsd.org with a single
-line of "subscribe ctm-announce" to get added to the list.
-
-
-Starting off with CTM for the first time:
------------------------------------------
-
-Before you can start using CTM deltas, you will need to get a special
-"base" delta that provides a starting point for all deltas produced
-subsequently to it.
-
-You can recognize a base delta by the 'A' appended to the number
-(src-cur.0341A.gz for instance). As a rule a base delta is produced
-every 100 deltas, the next one will be src-cur.0400A.gz.
-By the way, they are large! 25 to 30 Megabytes of gzip'ed data is
-common for a base delta.
-
-If you do have the 2.0-RELEASE srcdist, you can instead retreive the
-src-cur.0372R20.gz file, it's only 4Mb and it will take you to current
-from the 2.0-RELEASE sources.
-
-Once you've picked a base delta to start from, you will also need all
-deltas with higher numbers following it.
-
-
-Using CTM in your daily life:
------------------------------
-
-To apply the deltas, simply say
-
- cd /where/ever/you/want/the/stuff
- ctm -v -v /where/you/store/your/deltas/src-cur.*
-
-CTM understands deltas which have been put through gzip, so you don't
-need to gunzip them first, this saves diskspace.
-
-Unless it feels very secure about the entire process, ctm will not
-touch your tree. To check out a delta you can also use the "-c" flag
-and CTM won't actually touch your tree, but only check the integrity
-of the delta, and see if it would apply cleanly to the tree.
-
-There are other options to ctm as well, look in the sources.
-
-I would also be very happy if somebody could help with the "user
-interface" portions, as I have realized that I can't make up my mind
-on what options should do what, how and when...
-
-That's really all there is to it. Everytime you get a new delta, you
-run it through ctm.
-
-Don't remove the deltas, if they are hard to download again. You just
-might want to keep them around in case something bad happens. Even if
-you only have floppy disks, consider using "fdwrite" to make a copy.
-
-
-Plans:
-------
-
-Tons of them:
-
- - Make local modifications to the tree possible. One way to do it
- could be this:
- When CTM wants to edit the file "foo/bar.c", it would first check
- for the existense of "foo/bar.c#ctm" If this file exists, the
- delta is applied to it instead. This way the foo/bar.c file can
- be edited to suit local needs.
- - Make a "restore file(s)" option to ctm, something like:
- ctm -r src/sys/i386/wd.c /here/are/my/deltas/src-cur.*
- would restore wd.c to the current status from the files.
- - Clean up the options to ctm, they became confusing and
- counter intuitive.
-
-The bad news is that I am very busy, so any help in doing this will be
-most welcome. And don't forget to tell me what you want also...
-
-
-Misc. stuff:
-------------
-
-All the "DES infected" (e.g. export controlled) source is not included.
-You will get the "international" version only. If sufficient interest
-appears, we will set up a "sec-cur" sequence too.
-
-If you are a frequent or valuable contributor to FreeBSD, I will be
-willing to arrange special services, one option is delivery via ftp or
-rcp to a machine closer to you. You need to have earned this, since
-it takes time to do, but I'll be all the more happy to do it for you
-then.
-
-There is a sequence of deltas for the ports collection too, but interest
-has not been all that high yet. Tell me if you want an email list for
-that too and we'll consider setting it up.
-
-If you have commit priviledges or are similary authorized by the
-FreeBSD core team, you can also get access to the CVS repository tree
-by the same means. Contact me (phk@FreeBSD.org) for details.
-
-
-Thanks!
--------
-
-Bruce Evans, for his pointed pen and invaluable comments.
-Soren Schmidt, for patience.
-Stephen McKay, wrote ctm_[rs]mail, much appreciated.
-Jordan Hubbard, for being so stubborn that I had to make it better.
-All the users, I hope you like it...
-
-Comments ?
-----------
-
-email phk@FreeBSD.org
-
-
-Poul-Henning
diff --git a/share/FAQ/current-policy.FAQ b/share/FAQ/current-policy.FAQ
deleted file mode 100644
index 4d9e86b..0000000
--- a/share/FAQ/current-policy.FAQ
+++ /dev/null
@@ -1,170 +0,0 @@
- THE FREEBSD CURRENT POLICY
-
-Last updated: $Date: 1994/10/03 03:48:39 $
-
-This document attempts to explain the rationale behind FreeBSD-current,
-what you should expect should you decide to run it, and states some
-prerequisites for making sure the process goes as smoothly as possible.
-
-
-1. What is FreeBSD-current?
-
-FreeBSD-current is, quite literally, nothing more than a daily snapshot of
-the working sources for FreeBSD. These include work in progress, experimental
-changes, and transitional mechanisms that may or may not be present in
-the next official release of the software. While many of us compile
-almost daily from FreeBSD-current sources, there are periods of time when
-the sources are literally uncompilable. These problems are generally resolved
-as expeditiously as possible, but whether or not FreeBSD-current sources bring
-disaster or greatly desired functionality can literally be a matter of which
-part of any given 24 hour period you grabbed them in! Please read on..
-
-Under certain circumstances we will sometimes make binaries for parts of
-FreeBSD-current available, but only because we're interested in getting
-something tested, not because we're in the business of providing binary
-releases of current. If we don't offer, please don't ask! It takes far
-too much time to do this as a general task.
-
-
-2. Who needs FreeBSD-current?
-
-FreeBSD-current is made generally available for 3 primary interest groups:
-
- 1. Members of the FreeBSD group who are actively working on one
- part or another of the source tree and for whom keeping `current'
- is an absolute requirement.
-
- 2. Members of the FreeBSD group who are active ALPHA/BETA testers
- and willing to spend time working through problems in order to
- ensure that FreeBSD-current remains as sane as possible. These
- are also people who wish to make topical suggestions on changes
- and the general direction of FreeBSD.
-
- 3. Peripheral members of the FreeBSD (or some other) group who merely
- wish to keep an eye on things and use the current sources for
- reference purposes (e.g. for *reading*, not running). These
- people also make the occasional comment or contribute code.
-
-
-3. What is FreeBSD-current _NOT_?
-
- 1. A fast-track to getting pre-release bits because there's something
- you heard was pretty cool in there and you want to be the first on
- your block to have it.
-
- 2. A quick way of getting bug fixes.
-
- 3. In any way "officially supported" by us.
-
- We do our best to help people genuinely in one of the 3
- "legitimate" FreeBSD-current catagories, but we simply DO NOT
- HAVE THE TIME to help every person who jumps into FreeBSD-current
- with more enthusiasm than knowledge of how to deal with
- experimental system software. This is not because we're mean and
- nasty people who don't like helping people out (we wouldn't even be
- doing FreeBSD if we were), it's literally because we can't answer
- 400 messages a day AND actually work on FreeBSD! I'm sure if
- given the choice between having us answer lots of questions or
- continue to improve FreeBSD, most of you would vote for us
- improving it (and so would we! :-).
-
-
-4. Ok. I still think I "qualify" for FreeBSD-current, so what do I do?
-
- 1. Join the freebsd-hackers and freebsd-commit mailing lists.
- This is not just a good idea, it's ESSENTIAL. If you aren't on
- freebsd-hackers, you won't read the comments that people are
- making about the current state of the system and thus will end
- up stumbling over a lot of problems that others have already
- found and solved. Even more importantly, you will miss out on
- potentially critical information (e.g. "Yo, Everybody! Before you
- rebuild /usr/src, you MUST rebuild the kernel or your system
- will crash horribly!").
-
- The freebsd-commit list will allow you to see the commit log
- entry for each change as its made. This can also contain
- important information, and will let you know what parts of the
- system are being actively changed.
-
- To join these lists, send mail to `majordomo@FreeBSD.ORG'
- and say:
-
- subscribe freebsd-hackers
- subscribe freebsd-commit
-
- In the body of your message. Optionally, you can also say `help'
- and MajorDomo will send you full help on how to subscribe and
- unsubscribe to the various other mailing lists we support.
-
- 2. Grab the sources from ftp.FreeBSD.ORG. You can do this in
- three ways:
-
- 1. Using the CTM facility. Read the ctm.FAQ file for more
- information. Unless you have a good TCP/IP connection at
- a flat rate, this is the way to do it.
-
- 2. Use the CMU `sup' program (Software Update Protocol).
- This is the second most recommended method, since it allows
- you to grab the entire collection once and then only what's
- changed from then on. Many people run sup from cron
- and keep their sources up-to-date automatically.
-
- The problem is that sup does not use the bandwidth efficient,
- unless the round-trip is very fast. If the cost of connection
- or the duration of the session is a concern, use CTM.
-
- To get a binary of the sup program for FreeBSD, as well
- as the documentation and some sample configuration files,
- look in:
-
- FreeBSD.ORG:~ftp/pub/sup
-
- 3. Use ftp. The source tree for FreeBSD-current is always
- "exported" on:
-
- ftp.FreeBSD.ORG:~ftp/pub/FreeBSD/FreeBSD-current
-
- We use `wu-ftpd' which allows compressed/tar'd grabbing
- of whole trees. e.g. you see:
-
- usr.bin/lex
-
- You can do:
-
- ftp> cd usr.bin
- ftp> get lex.tar.Z
-
- And it will get the whole directory for you as a compressed
- tar file.
-
- 3. If you're grabbing the sources to run, and not just look at,
- then grab ALL of current, not just selected portions. The
- reason for this is that various parts of the source depend on
- updates elsewhere and trying to compile just a subset is almost
- guaranteed to get you into trouble.
-
- 4. Before compiling current, read the Makefile in /usr/src
- carefully. You'll see one-time targets like `bootstrapld'
- which *MUST* be run as part of the upgrading process. Reading
- freebsd-hackers will keep you up-to-date on other bootstrapping
- procedures that sometimes become necessary as we move towards
- the next release.
-
- 5. Be active! If you're running FreeBSD-current, we want to know
- what you have to say about it, especially if you have suggestions
- for enhancements or bug fixes. Suggestions with accompanying code
- are received most enthusiastically! :-)
-
-
-Thank you for taking the time to read this all the way through. We're
-always very keen to remain "open" and share the fruits of our labor
-with the widest possible audience, but sharing development sources has
-always had certain pitfalls associated with it (which is why most
-commercial organizations won't even consider it) and I want to make
-sure that people at least come into this with their eyes open, and
-don't make the leap unless they're good at working without a net!
-
- Jordan
-
-
-
diff --git a/share/FAQ/diskspace.FAQ b/share/FAQ/diskspace.FAQ
deleted file mode 100644
index 31346df..0000000
--- a/share/FAQ/diskspace.FAQ
+++ /dev/null
@@ -1,267 +0,0 @@
- How to assign disk space to FreeBSD.
-
-$Id$
-
-1.0 Getting started.
----------------------
-
-After a general introduction, you will find some explanation on what you
-need to do to assign space to FreeBSD on your disk(s). This is done
-through the "sysinstall" program, which lives on the inital boot floppy.
-Those already expert with PCs may wish to skip ahead to section 1.2, the
-rest of you may (or may not) enjoy the brief history lesson.
-
-
-1.1 The ins and outs of allocating disk storage on your PC.
-------------------------------------------------------------
-
-Modern hard disk drives are now getting big enough that people don't want
-to allocate all of one to just one operating system anymore, especially
-given the increasing size of disk drives (the latest 9.0 Gbyte models
-holding the equivalent of some six thousand 1.44MB floppies!) and the
-virtual explosion of operating system options available for the PC. To
-solve this problem, IBM came up with a scheme for "slicing" the disks
-into more manageable chunks, or partitions. It works, but only just.
-To better understand why, first a brief bit of history:
-
-MS-DOS, when hard disk support was unceremoniously grafted on back in the
-late eighties, didn't have such "slices". What it had was a way to install
-Xenix and MS-DOS on the same disk (Remember when Microsoft were in the UNIX
-business?).
-
-In the first sector on the disk was a piece of "primary boot code" and a
-table with four entries. Each of those entries pointed at an arbitrary
-slice of the disk, with one of them was marked "active". The machine would
-boot by reading the first sector containing the boot code into RAM and then
-jumping to it. The job of this small piece of boot code was to look at
-the 4 entry table and decide which OS was to be booted by looking
-for the "active" flag. It would go and load the first sector of that slice
-of the disk into RAM and then and jump to it in turn. This bit of boot
-code was called the "secondary boot", and could be specific to a given
-operating system. The primary boot code and 4-entry table is known
-as the Master Boot Record, or MBR, and is very important to the proper
-operation of your PC! We will discuss the MBR in more detail later.
-
-It was later realized, with the hindsight that IBM is famous for, that disks
-could be bigger than the 32Mb that the early DOS FAT-12 file system could
-handle, so they added a kludge: They had two MSDOS slices, a "Primary" and
-a "Secondary". The primary could still only be 32Mb, but the Secondary had
-no size limit. And the trick was that the secondary had ANOTHER "table
-entry" so that now suddenly up to 5 slices could be available to MS-DOS.
-The Secondary boot record was later made recursive, thus effectively
-avoiding any fixed limit. Of course, they were still stuck with a maximum
-of 26 slices given the use of "drive letters" in DOS. They also reserved
-only 10 bits for cylinder addressing, limiting DOS to being able to address
-a maximum of 1024 cylinders (and cause of the dreaded "cylinder translation"
-kludges, the misconfiguration of which many users have seen as the notorious
-"Missing Operating System" message). Yes, truly DOS was and is an utterly
-terrible operating system, which of course explains its amazing degree of
-success. Anyway, this all brings us up to today, which is where FreeBSD
-comes in:
-
-
-1.2 What FreeBSD does
-----------------------
-FreeBSD has, like any other UNIX-like operating system, the concept of
-"partitions." Partitions are used to implement its own "slicing"
-abstraction, and although there is no real difference between a slice and a
-partition as such, we use the two words to distinguish between these two
-different levels of slicing.
-
-The result is that we have a two-tier structure on the disk:
-
-+-----------+
-| MBR-table |
-+-----------+ +---------+
-| Slice 1 | -----> | MSDOS |
-+-----------+ +---------+
-| Slice 2 |
-+-----------+ +-------------------+
-| Slice 3 | -----> | FreeBSD-disklabel |
-+-----------+ +-------------------+ +-----------------+
-| Slice 4 | | Partition A | -----> | Root-filesystem |
-+-----------+ +-------------------+ +-----------------+
- | Partition B | ---
- +-------------------+ \ +----------------+
- | Partition C | --> | swap-partition |
- +-------------------+ +----------------+
- | ... |
-
-
-Here are the rules that FreeBSD plays by:
-
-A: FreeBSD always has an MBR slice with type 0xa5 (each of the 4 slices can
- also have a unique integer identifier so you can tell your DOS slices
- from your FreeBSD slices from your Linux slices, etc). This means that
- there should always be an MBR record, even in the case where FreeBSD
- occupies the entire disk.
-B: The FreeBSD slice contains the FreeBSD disklabel in the second sector
- (remember, the first sector contains the secondary boot code for FreeBSD,
- which is what prints that FreeBSD prompt at you when you first boot
- FreeBSD from a floppy or hard disk).
-C: The 'C' partition in the FreeBSD disklabel corresponds to the entire
- FreeBSD slice.
-D: The 'D' partition corresponds to the entire physical disk.
-E: Should a disk not have a FreeBSD slice (because there simply is no
- FreeBSD on it anywhere), then the MBR slices are mapped into partitions
- 'E' to 'H' of an artificially created FreeBSD disklabel. This is useful
- for getting at DOS-only disks.
-
-Therefore, to get FreeBSD onto your disk, you need to do the following:
-
- Step FreeBSD utility
- ------------------------------------------------------------ ---------------
- 1. Make an MBR slice for FreeBSD (FDISK)
- 2. Partition the diskspace in the MBR slice into partitions (DISKLABEL)
- 3. Assign mountpoints to the partitions. (DISKLABEL)
-
-
-
-2. The sysinstall utility
---------------------------
-
-The sysinstall utility is the program you first see when you boot
-FreeBSD's install floppy. It is responsible for partitioning your
-disk, creating an MBR slice for FreeBSD, setting up the disklabel
-within that slice and creating filesystems for each FreeBSD partition
-you create within that slice. It is composed of a number of screens.
-These are described below.
-
-
-2.1 The main screen
---------------------
-The main screen shows you the current status, It shows you which disks
-FreeBSD has found, how big they are and how much of it is assigned to
-FreeBSD in a FreeBSD MBR slice. It also shows the partitions which have
-had a mountpoint assigned to them (not necessarily FreeBSD partitions;
-FreeBSD is perfectly capable of mounting DOS disks directly).
-
-(H)elp -- shows you this file.
-
-(F)disk -- enters the Fdisk editor, where you can change the MBR record.
- This is what you want to use to assign some part of the disk to FreeBSD.
-
-(D)isklabel -- enters the Disklabel editor, here you can change how the
- FreeBSD slice is partitioned for FreeBSD.
-
-(P)rocede -- will continue the installation process.
-
-(Q)uit -- Go back to the entry screen.
-
-
-2.2 FDISK - how to make an MBR slice
--------------------------------------
-There are some rules to follow here since altering your MBR is a potential
-minefield. There is really no way for the sysinstall program to genuinely
-know that you have a valid MBR, so you have to be extra careful in what
-you edit. Failure to do this properly can and will destroy your other
-operating system entries!
-
-Even if you don't plan to have MSDOS on a disk, make an MSDOS slice
-using the MSDOS's FDISK.COM program. The reason for this is that if you
-do it that way, you are 100% sure that FreeBSD will use the same number
-of heads, sectors and cylinders as MSDOS would use. If you really don't
-plan to have MSDOS on the disk, just (D)elete the slice in the FreeBSD's
-(F)disk editor.
-
-From the main screen press 'F' to enter the MBR editor. You have five
-commands available:
-
-(H)elp -- Shows you this file.
-
-(D)elete -- Deletes a slice entirely.
-
-(E)dit -- Allows you to edit a slice. It will ask how many megabytes
- you want to assign to the slice, and will suggest the maximum possible
- as a default. It might say zero, even though there is disk space
- available, in which case you will probably need to delete and recreate the
- other partitions to get it to see where the free space is.
- It will then ask you what type to give the slice, for which the default is
- 0xa5 (a FreeBSD slice). You can enter any other number here too, which
- can be useful as a placeholder for some other OS you plan to install
- later. Finally, it will ask you about the "boot flag". 0x80 means "boot
- from this" slice by default, and anything else means "don't".
-
- If you specified a FreeBSD slice, any existing slices with the 0xa5
- type will be reset to 0x00 "unused". FreeBSD only supports one slice
- per disk for FreeBSD.
-
-(R)eread -- This is your "undo" function. It will read the data of the
- disk again, disposing of any changes you may have made.
-
-(W)rite -- When you are satisfied with the data, this function will write
- the new MBR to the disk.
-
-(Q)uit -- Go back to the main screen.
-
-
-2.3 Disklabel - How to divide up the FreeBSD slice.
-----------------------------------------------------
-
-The disklabel screen provides the following commands:
-
-(H)elp -- Shows you this file.
-
-(S)ize -- Resizes a partition for you, it will suggest as a default the
- maximum amount of diskspace it can find. This algorithm isn't too smart
- and may say zero, even though there is diskspace available. If it
- does, delete and resize the other partitions.
-
-(A)ssign -- Here you assign where the filesystem in a partition is to
- be mounted. `b' partitions will always be made into "swap" partitions.
-
-(D)elete -- Delete a partition.
-
-(R)eread -- The undo function. It will reread the current disklabel from
- the kernel.
-
-(W)rite -- This will write the disklabel to the disk. You must always write
- before you quit, otherwise your changes will be lost.
-
-(Q)uit -- Exit back to the main screen.
-
-
-2.4. Hints on partition sizing
--------------------------------
-
-While it's impossible to say how much space you're going to want to
-make your various partitions without knowing more about your intended
-applicatins, here are some good rules of thumb to follow:
-
-1. Root (/) should be at least 18MB, and probably no more than 50MB unless
- you have some special reason for making your root partition really
- large. Remember that the root filesystem is only supposed to contain
- vital system files and little else.
-
-2. Swap should be at least 2*memory. That is to say if you have 8MB of
- memory, then you probably want 16MB of swap. Even more swap space
- certainly doesn't hurt, if you can afford to allocate it, and you should
- also think ahead a little to any planned memory upgrades you may have
- in mind since increasing this later can be very painful!
-
- If you're going to run the X Window System (XFree86), you should also
- consider having a *minimum* of 16MB of swap, since X tends to really
- use it up.
-
-3. /usr can take up the rest of your disk, though some people like to create
- extra partitions for user home directories and the like. Be sure to make
- your /usr big enough to contain the system software (about 50MB) and
- perhaps some of your own, unless you're going to use symbolic links to
- point things like /usr/local (or /usr/src) somewhere else.
-
-
-Here are some suggested filesystem names and sizes, just for reference:
-
-Mountpoint Filesystem size
--------------------------------
-/var 10Mb
-/usr 50Mb
-/ 16Mb
-
-/usr/src 120Mb If you want to have the sources online
-/usr/obj 100Mb If you want to compile all of them at one time
-
-/usr/X11R6 50Mb If you load the entire XFree86 binary kit.
-
-
-$Id: diskspace.FAQ,v 1.1 1995/01/03 15:48:36 gclarkii Exp $
diff --git a/share/FAQ/extras/ports-supfile b/share/FAQ/extras/ports-supfile
deleted file mode 100644
index ffc078b..0000000
--- a/share/FAQ/extras/ports-supfile
+++ /dev/null
@@ -1,26 +0,0 @@
-ports-base release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-archivers release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-benchmarks release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-audio release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-cad release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-comms release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-databases release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-devel release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-editors release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-emulators release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-games release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-graphics release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-japanese release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-lang release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-mail release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-math release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-net release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-news release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-plan9 release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-print release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-russian release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-security release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-shells release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-sysutils release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-utils release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-x11 release=current host=SUP.FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
diff --git a/share/FAQ/extras/secure-stable-supfile b/share/FAQ/extras/secure-stable-supfile
deleted file mode 100644
index 61ac7f0..0000000
--- a/share/FAQ/extras/secure-stable-supfile
+++ /dev/null
@@ -1,2 +0,0 @@
-eBones release=stable host=sup.internat.freebsd.org hostbase=/home base=/usr prefix=/usr/src delete old compress
-secure release=stable host=sup.internat.freebsd.org hostbase=/home base=/usr prefix=/usr/src delete old compress
diff --git a/share/FAQ/extras/secure-supfile b/share/FAQ/extras/secure-supfile
deleted file mode 100644
index 716f70c..0000000
--- a/share/FAQ/extras/secure-supfile
+++ /dev/null
@@ -1,2 +0,0 @@
-eBones release=current host=sup.internat.freebsd.org hostbase=/home base=/usr prefix=/usr/src delete old compress
-secure release=current host=sup.internat.freebsd.org hostbase=/home base=/usr prefix=/usr/src delete old compress
diff --git a/share/FAQ/extras/stable-supfile b/share/FAQ/extras/stable-supfile
deleted file mode 100644
index 5ba1db8..0000000
--- a/share/FAQ/extras/stable-supfile
+++ /dev/null
@@ -1,15 +0,0 @@
-src-base release=stable host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-bin release=stable host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-#src-eBones release=stable host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-etc release=stable host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-games release=stable host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-gnu release=stable host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-include release=stable host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-lib release=stable host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-libexec release=stable host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-sbin release=stable host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-#src-secure release=stable host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-share release=stable host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-sys release=stable host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-usrbin release=stable host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-usrsbin release=stable host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
diff --git a/share/FAQ/extras/standard-supfile b/share/FAQ/extras/standard-supfile
deleted file mode 100644
index 6d0ed19..0000000
--- a/share/FAQ/extras/standard-supfile
+++ /dev/null
@@ -1,15 +0,0 @@
-src-base release=current host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-bin release=current host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-#src-eBones release=current host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-etc release=current host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-games release=current host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-gnu release=current host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-include release=current host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-lib release=current host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-libexec release=current host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-sbin release=current host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-#src-secure release=current host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-share release=current host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-sys release=current host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-usrbin release=current host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
-src-usrsbin release=current host=sup.FreeBSD.org hostbase=/home base=/usr prefix=/usr/src delete old use-rel-suffix
diff --git a/share/FAQ/help.html b/share/FAQ/help.html
deleted file mode 100644
index 4bbc1a2..0000000
--- a/share/FAQ/help.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!-- $Id:$ -->
-
-<!DOCTYPE html PUBLIC '-//IETF//DTD HTML 2.0//EN'>
-<html>
- <head>
- <title>Using FreeBSD Help</title>
- </head>
- <body>
- <h1>Using FreeBSD Help</h1>
-
-<p>...stay tuned...
-
- </body>
-</html>
-
diff --git a/share/FAQ/index.html b/share/FAQ/index.html
deleted file mode 100644
index 291ed90..0000000
--- a/share/FAQ/index.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!-- $Id: index.html,v 1.1 1995/04/06 15:56:10 jfieber Exp $ -->
-
-<!DOCTYPE html PUBLIC '-//IETF//DTD HTML 2.0//EN'>
-<html>
- <head>
- <title>FreeBSD Documentation</title>
- </head>
- <body>
- <h1>FreeBSD Documentation</h1>
-
- <ul>
- <li><a href="help.html">How to use help</a></li>
- </ul>
-
- <p></p>
-
- <ul>
- <li><a href="HTML/userman.html">User Guide</a></li>
- <li><a href="HTML/adminman.html">Administrators Guide</a></li>
- <li><a href="HTML/refman.html">Reference Manual</a></li>
- </ul>
-
- <p></p>
-
- <ul>
- <li><a href="tutorials.html">Tutorials</a></li>
- <li><a href="HTML/freebsd-faq.html">Frequently Asked
- Questions with answers</a></li>
- <li><a href="http://www.freebsd.org/">Internet Resources</a></li>
- </ul>
-
- <p></p>
-
- <ul>
- <li><a href="HTML/infosources.html">For more information...</a></li>
- </ul>
-
- </body>
-</html>
-
diff --git a/share/FAQ/kerberos_setup.latex b/share/FAQ/kerberos_setup.latex
deleted file mode 100644
index fa2e81e..0000000
--- a/share/FAQ/kerberos_setup.latex
+++ /dev/null
@@ -1,326 +0,0 @@
-%% \documentstyle[11pt,a4]{article}
-\documentstyle[11pt]{article}
-%% \pagestyle{headings}
-%% \pagestyle{empty}
-\setlength{\textwidth}{6.5in}
-\setlength{\parindent}{0in}
-%% \setlength{\parskip}{\medskipamount}
-\setlength{\oddsidemargin}{0in}
-\setlength{\evensidemargin}{0in}
-%% \setlength{\footskip}{0.2cm}
-\begin{document}
-
-\begin{center}
-{\LARGE {\bf Configuring Kerberos IV on 4.4 BSD}} \\
-{\it Mark Dapoz} \\
-{\it $<$md@bsc.no$>$} \\
-{\it Bergen Scientific Centre} \\
-{\it Bergen, Norway} \\
-{\it April 4th, 1994} \\
-\end{center}
-
-\section{Introduction}
-
-The following instructions can be used as a quick guide on how to set up
-kerberos as distributed in 4.4 BSD. However, you should refer to the
-original Athena documentation for a complete description.
-
-
-\section{Creating the initial database}
-
-First make sure that you don't have any old kerberos databases around. You
-should change to the directory {\bf /etc/kerberosIV} and check that only the
-following files are present:
-
-\begin{verbatim}
-mideon# cd /etc/kerberosIV
-mideon# ls
-README krb.conf krb.realms register_keys
-\end{verbatim}
-
-If any additional files (such as principal.dir) exist, then use the
-{\bf kdb\_destroy} command to destroy the old kerberos database.\\
-
-You should now edit the {\bf krb.conf} and {\bf krb.realms} files to define
-your kerberos realm. In this case the realm will be {\it BSC.NO} and
-the server is {\it mideon.bsc.no}. We would edit the {\bf krb.conf}
-file to be as follows:
-
-\begin{verbatim}
-mideon# cat krb.conf
-BSC.NO
-BSC.NO mideon.bsc.no admin server
-CS.BERKELEY.EDU okeeffe.berkeley.edu
-ATHENA.MIT.EDU kerberos.mit.edu
-ATHENA.MIT.EDU kerberos-1.mit.edu
-ATHENA.MIT.EDU kerberos-2.mit.edu
-ATHENA.MIT.EDU kerberos-3.mit.edu
-LCS.MIT.EDU kerberos.lcs.mit.edu
-TELECOM.MIT.EDU bitsy.mit.edu
-ARC.NASA.GOV trident.arc.nasa.gov
-\end{verbatim}
-
-Now we have to add mideon.bsc.no to the BSC.NO realm and also add an entry
-to put all hosts in the .bsc.no domain in the BSC.NO realm. The
-{\bf krb.realms} file would be updated as follows:
-
-\begin{verbatim}
-mideon# cat krb.realms
-mideon.bsc.no BSC.NO
-.bsc.no BSC.NO
-.berkeley.edu CS.BERKELEY.EDU
-.MIT.EDU ATHENA.MIT.EDU
-.mit.edu ATHENA.MIT.EDU
-\end{verbatim}
-
-Now we're ready to create the database, issue the {\bf kdb\_init} command
-to do this:
-
-\begin{verbatim}
-mideon# kdb_init
-Realm name [default CS.BERKELEY.EDU ]: BSC.NO
-You will be prompted for the database Master Password.
-It is important that you NOT FORGET this password.
-
-Enter Kerberos master key:
-\end{verbatim}
-
-Now we have to save the key so that servers on the local machine can pick
-it up. Use the {\bf kstash} command to do this.
-
-\begin{verbatim}
-mideon# kstash
-
-Enter Kerberos master key:
-
-Current Kerberos master key version is 1.
-
-Master key entered. BEWARE!
-\end{verbatim}
-
-\section{Populating the database}
-
-We now have to add some entries into the database. First lets create an
-entry for the user {\it md}. Use the {\bf kdb\_edit} command to do this:
-
-\begin{verbatim}
-mideon# kdb_edit
-Opening database...
-
-Enter Kerberos master key:
-
-Current Kerberos master key version is 1.
-
-Master key entered. BEWARE!
-Previous or default values are in [brackets] ,
-enter return to leave the same, or new value.
-
-Principal name: md
-Instance:
-md. not found, Create [y] ?
-Principal: md, Instance: , kdc_key_ver: 1
-New Password:
-New Password:
-
-Principal's new key version = 1
-Expiration date (enter yyyy-mm-dd) [ 2000-01-01 ] ?
-Max ticket lifetime (*5 minutes) [ 255 ] ? 100
-Attributes [ 0 ] ?
-Edit O.K.
-\end{verbatim}
-
-Now lets add an entry for the password changing daemon, kpasswd. The
-principal name must be {\it kpasswd} and the instance must be the name of
-the local machine, {\it mideon} in this case. Similarily, we must also add
-an entry for the principal {\it rcmd} with an instance equal to the
-hostname of the local machine.
-
-\begin{verbatim}
-Principal name: kpasswd
-Instance: mideon
-kpasswd.mideon not found, Create [y] ?
-Principal: kpasswd, Instance: mideon, kdc_key_ver: 1
-New Password: <---- enter RANDOM here
-New Password: <---- and here
-Random password [y] ?
-
-Principal's new key version = 1
-Expiration date (enter yyyy-mm-dd) [ 2000-01-01 ] ?
-Max ticket lifetime (*5 minutes) [ 255 ] ?
-Attributes [ 0 ] ?
-Edit O.K.
-Principal name: rcmd
-Instance: mideon
-rcmd.mideon not found, Create [y] ?
-Principal: rcmd, Instance: mideon, kdc_key_ver: 1
-New Password: <---- enter RANDOM here
-New Password: <---- and here
-Random password [y] ?
-
-Principal's new key version = 1
-Expiration date (enter yyyy-mm-dd) [ 2000-01-01 ] ?
-Max ticket lifetime (*5 minutes) [ 255 ] ?
-Attributes [ 0 ] ?
-Edit O.K.
-Principal name: <---- null entry here will cause an exit
-\end{verbatim}
-
-\section{Creating the server file}
-
-We now have to extract all the instances which define the services on this
-machine. For this we use the {\bf ext\_srvtab} command.
-
-\begin{verbatim}
-mideon# ext_srvtab mideon
-
-Enter Kerberos master key:
-
-Current Kerberos master key version is 1.
-
-Master key entered. BEWARE!
-Generating 'mideon-new-srvtab'....
-\end{verbatim}
-
-Now, this command only generates a temporary file which must be renamed
-to {\bf srvtab} so that all the server can pick it up. Use the mv command to
-move it into place:
-
-\begin{verbatim}
-mideon# mv mideon-new-srvtab srvtab
-\end{verbatim}
-
-\section{Testing it all out}
-
-First we have to start the kerberos daemon:
-
-\begin{verbatim}
-mideon# kerberos &
-[1] 774
-mideon# Kerberos server starting
- Sleep forever on error
- Log file is /var/log/kerberos.log
-Current Kerberos master key version is 1.
-
-Master key entered. BEWARE!
-
-Current Kerberos master key version is 1
-Local realm: BSC.NO
-\end{verbatim}
-
-Now we can try using the {\bf kinit} command to get tokens for the id
-{\it md} that we created above:
-
-\begin{verbatim}
-mideon# kinit md
-Kerberos Initialization for "md"
-Kerberos Password:
-\end{verbatim}
-
-Try listing the tokens using {\bf klist} to see if we really have them:
-
-\begin{verbatim}
-mideon# klist
-Ticket file: /tmp/tkt0
-Principal: md@BSC.NO
-
- Issued Expires Principal
-Mar 23 21:06:52 Mar 24 05:06:52 krbtgt.BSC.NO@BSC.NO
-\end{verbatim}
-
-And now try changing the password using {\bf passwd} to check if the
-kpasswd daemon can get authorisation to the kerberos database:
-
-\begin{verbatim}
-mideon# passwd md
-Changing Kerberos password for md.@BSC.NO.
-Old Kerberos password:
-New Kerberos password:
-Retype new Kerberos password:
-Update complete.
-\end{verbatim}
-
-\section{Adding su priviledges}
-
-We should now add an id which is authorised to su to root. This is
-controlled by having an instance of {\it root} associated with a principal.
-Using {\bf kdb\_edit} we can create the entry {\it md.root} in the kerberos
-database:
-
-\begin{verbatim}
-mideon# kdb_edit
-Opening database...
-
-Enter Kerberos master key:
-
-Current Kerberos master key version is 1.
-
-Master key entered. BEWARE!
-Previous or default values are in [brackets] ,
-enter return to leave the same, or new value.
-
-Principal name: md
-Instance: root
-md.admin not found, Create [y] ?
-Principal: md, Instance: admin, kdc_key_ver: 1
-New Password:
-New Password:
-
-Principal's new key version = 1
-Expiration date (enter yyyy-mm-dd) [ 2000-01-01 ] ?
-Max ticket lifetime (*5 minutes) [ 255 ] ? 12
-Attributes [ 0 ] ?
-Edit O.K.
-Principal name:
-\end{verbatim}
-
-Now try getting tokens for it to make sure it works:
-
-\begin{verbatim}
-mideon# kinit md.root
-Kerberos Initialization for "md.root"
-Kerberos Password:
-\end{verbatim}
-
-And list them to check expiry times:
-
-\begin{verbatim}
-mideon# klist
-Ticket file: /tmp/tkt0
-Principal: md.root@BSC.NO
-
- Issued Expires Principal
-Mar 23 21:08:47 Mar 23 22:08:47 krbtgt.BSC.NO@BSC.NO
-mideon#
-\end{verbatim}
-
-Now we need to add the user to root's {\bf .klogin} file:
-
-\begin{verbatim}
-mideon# cat /root/.klogin
-md.root@BSC.NO
-\end{verbatim}
-
-Now try doing the su:
-
-\begin{verbatim}
-[md@mideon.bsc.no 10407] su
-Kerberos Password:
-Warning: tgt not verified.
-\end{verbatim}
-
-and take a look at what tokens we have:
-
-\begin{verbatim}
-mideon# klist
-Ticket file: /tmp/tkt_root_1250
-Principal: md.root@BSC.NO
-
- Issued Expires Principal
-Mar 23 22:09:59 Mar 23 22:19:59 krbtgt.BSC.NO@BSC.NO
-mideon#
-\end{verbatim}
-
-Notice that with this setup each user has their own entry for su'ing to
-root (the {\it user}.root entry in kerberos). This can allow you to give root
-access to multiple users without the need to share a common root password.
-\end{document}
diff --git a/share/FAQ/kernel-debug.FAQ b/share/FAQ/kernel-debug.FAQ
deleted file mode 100644
index 3ccdf60..0000000
--- a/share/FAQ/kernel-debug.FAQ
+++ /dev/null
@@ -1,417 +0,0 @@
- Kernel debugging FAQ for FreeBSD
-
-$Id: kernel-debug.FAQ,v 1.3 1995/01/02 12:01:59 joerg Exp $
-
-
-*** Debugging a kernel crash dump with kgdb ***
-
- Here are some instructions for getting kernel debugging working on a
- crash dump, it assumes that you have enough swap space for a crash
- dump. If you happen to have multiple swap partitions with the first
- one being too small to keep the dump, you can configure your kernel to
- use an alternate dump device (in the ``kernel'' line). Dumps to non-
- swap devices (e.g. tapes) are currently not supported.
-
- Config your kernel using config -g
-
- Remember that you need to specify ``options DODUMP'' in your config
- file in order to get kernel core dumps.
-
- When the kernel's been built make a copy of it, say kernel.debug, and
- then run strip -x on the original. Install the original as normal.
- You may also install the unstripped kernel, but symtab lookup time
- for some programs might drastically increase.
-
- If you are testing a new kernel (e.g. by typing the new kernel's
- name at the boot prompt), but need to boot a different one in order
- to get your system up & running again, do boot it only into single
- user state (the -s flag at the boot prompt), and then perform the
- following steps:
-
- fsck -p
- mount -a -t ufs # so your file system for /var/crash is writable
- savecore -N /kernel.panicked /var/crash
- exit # ...to multi-user
-
- This instructs savecore to use another kernel for symbol name
- extraction; it would default to the currently running kernel
- otherwise.
-
- Now, after a crash dump, go to /sys/compile/WHATEVER and run
- kgdb. From kgdb do:
-
- symbol-file kernel.debug
- exec-file /var/crash/system.0
- core-file /var/crash/ram.0
-
- and voila, you can debug the crash dump using the kernel sources
- just like you can for any other program.
-
- If your kernel panicked due to a trap (perhaps the most common case
- for getting a core dump), the following trick might help you. Examine
- the stack (`where') and look for the stack frame in the function
- trap(). Go `up' to that frame, and then type:
-
- frame frame->tf_ebp frame->tf_eip
-
- This will tell kgdb to go to the stack frame explicitly named by a
- frame pointer and instruction pointer, which is the location where
- the trap occured. There are still some bugs in kgdb (you can go
- `up' from there, but not `down'; the stack trace will still remain
- as it was before going to here), but generally this method will lead
- you much closer to the failing piece of code.
-
- Here's a script log of a kgdb session illustrating the above. Long
- lines have been folded to improve readability, and the lines are
- numbered for reference. Despite of this, it's a real-world error
- trace taken during the development of the pcvt console driver.
-
- 1:Script started on Fri Dec 30 23:15:22 1994
- 2:uriah # cd /sys/compile/URIAH
- 3:uriah # kgdb kernel /var/crash/vmcore.1
- 4:Reading symbol data from /usr/src/sys/compile/URIAH/kernel...done.
- 5:IdlePTD 1f3000
- 6:panic: because you said to!
- 7:current pcb at 1e3f70
- 8:Reading in symbols for ../../i386/i386/machdep.c...done.
- 9:(kgdb) where
- 10:#0 boot (arghowto=256) (../../i386/i386/machdep.c line 767)
- 11:#1 0xf0115159 in panic ()
- 12:#2 0xf01955bd in diediedie () (../../i386/i386/machdep.c line 698)
- 13:#3 0xf010185e in db_fncall ()
- 14:#4 0xf0101586 in db_command (-266509132, -266509516, -267381073)
- 15:#5 0xf0101711 in db_command_loop ()
- 16:#6 0xf01040a0 in db_trap ()
- 17:#7 0xf0192976 in kdb_trap (12, 0, -272630436, -266743723)
- 18:#8 0xf019d2eb in trap_fatal (...)
- 19:#9 0xf019ce60 in trap_pfault (...)
- 20:#10 0xf019cb2f in trap (...)
- 21:#11 0xf01932a1 in exception:calltrap ()
- 22:#12 0xf0191503 in cnopen (...)
- 23:#13 0xf0132c34 in spec_open ()
- 24:#14 0xf012d014 in vn_open ()
- 25:#15 0xf012a183 in open ()
- 26:#16 0xf019d4eb in syscall (...)
- 27:(kgdb) up 10
- 28:Reading in symbols for ../../i386/i386/trap.c...done.
- 29:#10 0xf019cb2f in trap (frame={tf_es = -260440048, tf_ds = 16, tf_\
- 30:edi = 3072, tf_esi = -266445372, tf_ebp = -272630356, tf_isp = -27\
- 31:2630396, tf_ebx = -266427884, tf_edx = 12, tf_ecx = -266427884, tf\
- 32:_eax = 64772224, tf_trapno = 12, tf_err = -272695296, tf_eip = -26\
- 33:6672343, tf_cs = -266469368, tf_eflags = 66066, tf_esp = 3072, tf_\
- 34:ss = -266427884}) (../../i386/i386/trap.c line 283)
- 35:283 (void) trap_pfault(&frame, FALSE);
- 36:(kgdb) frame frame->tf_ebp frame->tf_eip
- 37:Reading in symbols for ../../i386/isa/pcvt/pcvt_drv.c...done.
- 38:#0 0xf01ae729 in pcopen (dev=3072, flag=3, mode=8192, p=(struct p\
- 39:roc *) 0xf07c0c00) (../../i386/isa/pcvt/pcvt_drv.c line 403)
- 40:403 return ((*linesw[tp->t_line].l_open)(dev, tp));
- 41:(kgdb) list
- 42:398
- 43:399 tp->t_state |= TS_CARR_ON;
- 44:400 tp->t_cflag |= CLOCAL; /* cannot be a modem (:-) */
- 45:401
- 46:402 #if PCVT_NETBSD || (PCVT_FREEBSD >= 200)
- 47:403 return ((*linesw[tp->t_line].l_open)(dev, tp));
- 48:404 #else
- 49:405 return ((*linesw[tp->t_line].l_open)(dev, tp, flag));
- 50:406 #endif /* PCVT_NETBSD || (PCVT_FREEBSD >= 200) */
- 51:407 }
- 52:(kgdb) print tp
- 53:Reading in symbols for ../../i386/i386/cons.c...done.
- 54:$1 = (struct tty *) 0x1bae
- 55:(kgdb) print tp->t_line
- 56:$2 = 1767990816
- 57:(kgdb) up
- 58:#1 0xf0191503 in cnopen (dev=0x00000000, flag=3, mode=8192, p=(st\
- 59:ruct proc *) 0xf07c0c00) (../../i386/i386/cons.c line 126)
- 60: return ((*cdevsw[major(dev)].d_open)(dev, flag, mode, p));
- 61:(kgdb) up
- 62:#2 0xf0132c34 in spec_open ()
- 63:(kgdb) up
- 64:#3 0xf012d014 in vn_open ()
- 65:(kgdb) up
- 66:#4 0xf012a183 in open ()
- 67:(kgdb) up
- 68:#5 0xf019d4eb in syscall (frame={tf_es = 39, tf_ds = 39, tf_edi =\
- 69: 2158592, tf_esi = 0, tf_ebp = -272638436, tf_isp = -272629788, tf\
- 70:_ebx = 7086, tf_edx = 1, tf_ecx = 0, tf_eax = 5, tf_trapno = 582, \
- 71:tf_err = 582, tf_eip = 75749, tf_cs = 31, tf_eflags = 582, tf_esp \
- 72:= -272638456, tf_ss = 39}) (../../i386/i386/trap.c line 673)
- 73:673 error = (*callp->sy_call)(p, args, rval);
- 74:(kgdb) up
- 75:Initial frame selected; you cannot go up.
- 76:(kgdb) quit
- 77:uriah # exit
- 78:exit
- 79:
- 80:Script done on Fri Dec 30 23:18:04 1994
-
- Comments to the above script:
-
- line 6: this is a dump taken from within DDB (see below), hence the
- panic comment ``because you said to!'', and a rather long
- stack trace; the initial reason for going into DDB has been
- a page fault trap though
-
- line 20: the location of function ``trap()'' in the stack trace
-
- line 36: force usage of a new stack frame, kgdb responds and displays
- the source line where the trap happened; from looking at the
- code, there's a high probability that either the pointer
- access for ``tp'' was messed up, or the array access was
- out of bounds
-
- line 52: the pointer looks suspicious, but happens to be a valid
- address...
-
- line 56: ... but obviously points to garbage, so we have found our
- error, sigh! [For those uncommon with that particular piece
- of code: tp->t_line refers to the line discipline of the
- console device here, which must be a rather small integer
- number.]
-
-
-
-*** Post-mortem analysis of a dump ***
-
- What to do if a kernel dumped core but you didn't expect it, and it's
- therefore not compiled using config -g?
-
- Not everything is lost here. Don't panic. :-)
-
- Of course, you still need to configure all your kernels with the
- DODUMP option being set, otherwise you won't get a core dump at all.
- (This is for safety reasons in the default kernels, to avoid them
- trying to dump e.g. during system installation where there's no
- FreeBSD partition at all and valuable data on the disk could be
- destroyed.)
-
- Go to your kernel compile directory, and edit the line containing
- COPTFLAGS?=-O. Add the `-g' option there (but DON'T change anything
- on the level of optimization). If you do already know roughly the
- probable location of the failing piece of code (e.g., the `pcvt'
- driver in the example above), remove all the object files for this
- code. Rebuild the kernel. Due to the time stamp change on the
- Makefile, there will be some other object files rebuild, e.g.
- trap.o. With a bit of luck, the added -g option won't change
- anything for the generated code, so you'll finally get a new kernel
- with similiar code to the faulting one but some debugging symbols.
- You should at least verify the old and new sizes with the `size'
- command; if they mismatch, you probably need to give up here.
-
- Go and examine the dump as described above. The debugging symbols
- might be incomplete for some places (as can be seen in the stack trace
- in the example above: some functions are displayed without line
- numbers and argument lists). If you need more debugging symbols,
- remove the appropriate object files and repeat the kgdb session until
- you know enough.
-
- All this is not guaranteed to work, but most likely will do it fine.
-
-
-
-*** On-line kernel debugging using DDB ***
-
- While kgdb as an offline debugger provides a very high level of user
- interface (e.g. it can lookup source files, display C structures
- etc.), there are some things it cannot do. The most important ones
- being breakpointing and single-stepping kernel code.
-
- If you need to do low-level debugging on your kernel, there's an on-
- line debugger available called DDB. It allows to set breakpoints,
- single-step kernel functions, examine and change kernel variables
- etc. It can however not access kernel source files, and it does
- only have access to the global and static symbols, but not to the
- full debug information (including type and line number information)
- like kgdb.
-
- To configure your kernel to include DDB, add the option lines
-
- options DDB
- options "SYMTAB_SPACE=XXXX"
-
- to your config file, and rebuild. XXXX is the amount of space to be
- reserved into a global array DDB examines to find its symbols at run
- time. It must be large enough to hold all symbols, but not too
- large at all to avoid wasting space. 100000 Bytes are a good first
- bet for a ``normal'' kernel. The link stage will tell you about the
- usage of the symtab space, you'll see something like:
-
- dbsym: need 98765; avail 100000
-
- If the amount of allocated space has been too small, the above
- message is accompanied by the following error message:
-
- not enough room in db_symtab array
-
- and the link stage fails. You then need to increase the number,
- reconfig and recompile. If your config(8) has been compiled to not
- remove the old compile directory before continuing (this is a
- compile-time option [CONFIG_DONT_CLOBBER]), you need to remove
- db_aout.o prior to recompilation; this is the only file being
- affected by the SYMTAB_SPACE option.
-
-
- Once your DDB kernel is running, there are several ways to enter
- DDB. The first (and most early) way is to set the boot flag `-d'
- (right at the boot prompt). The kernel will start up in debug mode
- and enter DDB prior to any device probing. Hence you are able to
- even debug the device probe/attach functions.
-
- The second scenario is a hot-key on the keyboard, usually Ctrl-Alt-
- ESC. (For syscons, this can be remapped, and some of the
- distributed maps do this, so watch out.) There are patches
- available for a COMCONSOLE kernel, ask me (joerg@FreeBSD.org) for
- them.
-
- The third way is that any panic condition will branch to DDB if the
- kernel is configured to use it. (Thus it is not wise to configure a
- kernel with DDB for a machine running unattended.)
-
-
- The DDB commands roughly resemble some gdb commands. The first you
- probably need is to set a breakpoint:
-
- b function-name
- b address
-
- Numbers are taken hexadecimal by default, but to make them distinct
- from symbol names, hex numbers starting with the letters `a' - `f'
- need to be preceded with `0x' (for other numbers, this is optional).
- Simple expressions are allowed, e.g. ``function-name + 0x103''.
-
- To continue the operation of an interrupted kernel, simply type
-
- c
-
- To get a stack trace, use
-
- trace
-
- Note that when entering DDB via a hot-key, the kernel is currently
- servicing an interrupt, so the stack trace might be not of much use
- for you.
-
- If you want to remove a breakpoint, use
-
- del
- del address-expression
-
- The first form will be accepted immediately after a breakpoint hit,
- and deletes the current breakpoint. The second form can remove any
- breakpoint, but you need to specify the exact address, as it can be
- obtained from
-
- show b
-
- To single-step the kernel, try
-
- s
-
- This will step into functions, but you can make DDB trace them until
- the matching return statement is reached by
-
- n
-
- NOTE: this is different from gdb's ``next'' statement, it's like
- gdb's ``finish''.
-
- To examine data from memory, use e.g.
-
- x/wx 0xf0133fe0,40
- x/hd db_symtab_space
- x/bc termbuf,10
- x/s stringbuf
-
- for word/halfword/byte access, and hexadecimal/decimal/character/
- string display. The number after the comma is the object count.
- To display the next 0x10 items, simply use
-
- x ,10
-
- Similiarly, use
-
- x/ia foofunc,10
-
- to disassemble the first 0x10 instructions of foofunc, and display
- them along with their offset from the beginning of foofunc.
-
- To modify the memory, use the write command:
-
- w/b termbuf 0xa 0xb 0
- w/w 0xf0010030 0 0
-
- The command modifier (b/h/w) specifies the size of the data to be
- writtten, the first following expression is the address to write to,
- the remainder is interpreted as data to write to successive memory
- locations.
-
- If you need to know the current registers, use
-
- show reg
-
- Alternatively, you can display a single register value by e.g.
-
- print $eax
-
- and modify it by
-
- set $eax new-value
-
-
- Should you need to call some kernel functions from DDB, simply
- say
-
- call func(arg1, arg2, ...)
-
- The return value will be printed.
-
- For a ps-style summary of all running processes, use
-
- ps
-
-
-
- Well, you've now examined why your kernel failed, and you wish to
- reboot. Remember that, depending on the severity of previous
- malfunctioning, not all parts of the kernel might still be working
- as expected. Perform one of the following actions to shut down and
- reboot your system:
-
-
- call diediedie()
-
- (must usually be followed by another ``c[ontinue]'' statement),
- will cause your kernel to dump core and reboot, so you can later
- analyze the core on a higher level with kgdb.
-
-
- call boot(0)
-
- might be a good way to cleanly shut down the running system, sync()
- all disks, and finally reboot. As long as the disk and file system
- interfaces of the kernel are not damaged, this might be a good way
- for an almost clean shutdown.
-
-
- call cpu_reset()
-
- ...is the final way out of the desaster, almost similiar to hitting
- the Big Red Button.
-
-
-
-*** What to do if i want to debug a console driver? ***
-
- Since you need a console driver to run DDB on, things are more
- complicated if the console driver itself is flakey. You might
- remember the ``options COMCONSOLE'' line, and hook up a standard
- terminal onto your first serial port. DDB works on any configured
- console driver, of course it also works on a COMCONSOLE.
-
-
-
- Paul Richards, FreeBSD core team member. (paul@FreeBSD.org)
- J"org Wunsch (joerg@FreeBSD.org)
-
diff --git a/share/FAQ/mailing-list.FAQ b/share/FAQ/mailing-list.FAQ
deleted file mode 100644
index 74e231b..0000000
--- a/share/FAQ/mailing-list.FAQ
+++ /dev/null
@@ -1,105 +0,0 @@
- THE FREEBSD MAILING LIST FAQ
-
-$Id: mailing-list.FAQ,v 1.4 1994/10/10 10:39:10 gclarkii Exp $
-
---
-Though many of the FreeBSD development members read USENET, we cannot
-always guarantee that we'll get to your questions in a timely fashion
-(or at all) if you post them only to one of the comp.os.386bsd.*
-groups. By addressing your questions to the appropriate mailing list
-you will reach both us and a concentrated FreeBSD audience, invariably
-assuring a better (or at least faster) response.
-
-The following is a summary of the mailing lists:
-
-List Purpose
------------------------------------------------------------------------------
-freebsd-admim Administrative issues (limited)
-freebsd-arch Architecture and design discussions (limited)
-freebsd-bugs Bug reports
-freebsd-hackers Technical discussions and suggestions
-freebsd-questions User questions
-freebsd-announce Important events / milestones
-freebsd-current Discussions about the use of FreeBSD-current
-freebsd-commit Commit messages to source repository
-freebsd-core FreeBSD core team (limited)
-freebsd-security Security issues
-freebsd-fs Filesystems
-freebsd-ports Discussion of "ports"
-freebsd-platforms Porting to Non-Intel platforms
-freebsd-hardware General discussion of FreeBSD hardware
-freebsd-install Installation issues (limited)
-
------------------------------------------------------------------------------
-
-The following lists are for people seeing the log messages for source changes
-in specific areas:
-
-List name Source area Area Description (source for)
------------------------------------------------------------------------------
-cvs-CVSROOT /usr/src/[A-Z]* Top level /usr/src file changes
-cvs-all /usr/src All changes to the tree (superset)
-cvs-bin /usr/src/bin System binaries
-cvs-etc /usr/src/etc System files
-cvs-games /usr/src/games Games
-cvs-gnu /usr/src/gnu GPL'd utilities
-cvs-include /usr/src/include Include files
-cvs-kerberosIV /usr/src/kerberosIV Kerberos encryption code
-cvs-lib /usr/src/lib System libraries
-cvs-libexec /usr/src/libexec System binaries
-cvs-sbin /usr/src/sbin System binaries
-cvs-share /usr/src/share System shared files
-cvs-sys /usr/src/sys Kernel
-cvs-usrbin /usr/src/usr.bin Use binaries
-cvs-usrsbin /usr/src/usr.sbin System binaries
-cvs-ports /usr/ports Ported software
------------------------------------------------------------------------------
-
-Even though the lists freebsd-core, freebsd-admin, freebsd-install and
-freebsd-arch are closed, anyone is free to send suggestions and comments
-to them. All other lists are open.
-
-All mailing lists live on `FreeBSD.ORG', so to post to a list you
-simply mail to `<listname>@FreeBSD.ORG'. It will then be redistributed
-to mailing list members throughout the world.
-
-To subscribe to a list, send mail to:
-
- majordomo@FreeBSD.ORG
-
-And include the keyword
-
- subscribe <listname> [<optional address>]
-
-In the body of your message. For example, to subscribe yourself to
-freebsd-hackers, you'd do:
-
- % mail majordomo@FreeBSD.ORG
- subscribe freebsd-hackers
- ^D
-
-If you want to subscribe yourself under a different name, or submit a
-subscription request for a local mailing list (note: this is more efficient
-if you have several interested parties at one site, and highly appreciated by
-us!), you would do something like:
-
- % mail majordomo@FreeBSD.ORG
- subscribe freebsd-hackers local-hackers@somesite.com
- ^D
-
-Finally, it is also possible to unsubscribe yourself from a list, get a
-list of other list members or see the list of mailing lists again by
-sending other types of control messages to majordomo. For a complete
-list of available commands, do this:
-
- % mail majordomo@FreeBSD.ORG
- help
- ^D
-
-Finally, it is suggested that you only join the freebsd-hackers or
-freebsd-questions mailing lists if you're also willing to see upwards
-of 100 messages a day (peak)! If you're only interested in the "high points",
-then it's suggested that you join freebsd-announce, which will contain
-only infrequent traffic.
-
- Thank you!
diff --git a/share/FAQ/nfs.FAQ b/share/FAQ/nfs.FAQ
deleted file mode 100644
index 047b25a..0000000
--- a/share/FAQ/nfs.FAQ
+++ /dev/null
@@ -1,79 +0,0 @@
-FreeBSD and NFS [for a FAQ]
-
-$Id$
-
-Certain Ethernet adapters for ISA PC systems have limitations which
-can lead to serious network problems, particularly with NFS. This
-difficulty is not specific to FreeBSD, but FreeBSD systems are affected
-by it.
-
-The problem nearly always occurs when (FreeBSD) PC systems are networked
-with high-performance workstations, such as those made by Silicon Graphics,
-Inc., and Sun Microsystems, Inc. The NFS mount will work fine, and some
-operations may succeed, but suddenly the server will seem to become
-unresponsive to the client, even though requests to and from other systems
-continue to be processed. This happens to the client system, whether the
-client is the FreeBSD system or the workstation. On many systems, there is
-no way to shut down the client gracefully once this problem has manifested
-itself. The only solution is often to reset the client, because the NFS
-situation cannot be resolved.
-
-Though the "correct" solution is to get a higher performance and capacity
-Ethernet adapter for the FreeBSD system, there is a simple workaround that
-will allow satisfactory operation. If the FreeBSD system is the SERVER,
-include the option "wsize=1024" on the mount from the client. If the
-FreeBSD system is the CLIENT, then mount the NFS file system with the
-option "rsize=1024". These options may be specified using the fourth
-field of the fstab entry on the client for automatic mounts, or by using
-the "-o" parameter of the mount command for manual mounts.
-
-In the following examples, "fastws" is the host (interface) name of a
-high-performance workstation, and "freebox" is the host (interface) name of
-a FreeBSD system with a lower-performance Ethernet adapter. Also,
-"/sharedfs" will be the exported NFS filesystem (see "man exports"), and
-"/project" will be the mount point on the client for the exported file
-system. In all cases, note that additional options, such as "hard" or
-"soft" and "bg" may be desireable in your application.
-
-Examples for the FreeBSD system ("freebox") as the client:
- in /etc/fstab on freebox:
-fastws:/sharedfs /project nfs rw,rsize=1024 0 0
- as a manual mount command on freebox:
-mount -t nfs -o rsize=1024 fastws:/sharedfs /project
-
-Examples for the FreeBSD system as the server:
- in /etc/fstab on fastws:
-freebox:/sharedfs /project nfs rw,wsize=1024 0 0
- as a manual mount command on fastws:
-mount -t nfs -o wsize=1024 freebox:/sharedfs /project
-
-Nearly any 16-bit Ethernet adapter will allow operation without the above
-restrictions on the read or write size.
-
-For anyone who cares, here is what happens when the failure occurs, which
-also explains why it is unrecoverable. NFS typically works with a "block"
-size of 8k (though it may do fragments of smaller sizes). Since the maximum
-Ethernet packet is around 1500 bytes, the NFS "block" gets split into
-multiple Ethernet packets, even though it is still a single unit to the
-upper-level code, and must be received, assembled, and ACKNOWLEDGED as a
-unit. The high-performance workstations can pump out the packets which
-comprise the NFS unit one right after the other, just as close together as
-the standard allows. On the smaller, lower capacity cards, the later
-packets overrun the earlier packets of the same unit before they can be
-transferred to the host and the unit as a whole cannot be reconstructed or
-acknowledged. As a result, the workstation will time out and try again,
-but it will try again with the entire 8K unit, and the process will be
-repeated, ad infinitum.
-
-By keeping the unit size below the Ethernet packet size limitation, we
-ensure that any complete Ethernet packet received can be acknowledged
-individually, avoiding the deadlock situation.
-
-Overruns may still occur when a high-performance workstations is slamming
-data out to a PC system, but with the better cards, such overruns are
-not guarranteed on NFS "units". When an overrun occurs, the units affected
-will be retransmitted, and there will be a fair chance that they will be
-received, assembled, and acknowledged.
---
- John Lind, Starfire Consulting Services
-E-mail: john@starfire.MN.ORG USnail: PO Box 17247, Mpls MN 55417
diff --git a/share/FAQ/ports-supfile b/share/FAQ/ports-supfile
deleted file mode 100644
index 8a9b29c..0000000
--- a/share/FAQ/ports-supfile
+++ /dev/null
@@ -1,7 +0,0 @@
-ports-editors release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-lang release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-mail release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-net release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-shells release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-utils release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
-ports-x11 release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/ports delete old
diff --git a/share/FAQ/ports.FAQ b/share/FAQ/ports.FAQ
deleted file mode 100644
index 485a265..0000000
--- a/share/FAQ/ports.FAQ
+++ /dev/null
@@ -1,246 +0,0 @@
- The FreeBSD Ports FAQ file
-
-Revision: $Id: ports.FAQ,v 1.1 1995/01/05 07:27:00 gclarkii Exp $
-
-The ports system is kinda new, so there haven't been too many FAQ's to
-date, but hopefully this document will pre-empt (some|most) of them!!
-The ports system is constantly changing, but hopefully this document
-will be kept reasonably up to date (and you never know, it might even
-make sense!).
-
- - Gary Palmer
- & jkh
-
-1) What is a port?
-
- Unfortunately, there are more variations of UN*X than most people
-know of, and hence not all software for UN*X available on the Internet
-will work on all versions of UN*X (in fact, I can guarantee it!).
-Hence, some software needs modifications to work under some UN*Xs. The
-process of making those modifications is known as ``porting'' and the
-result known as a ``port'' (not to be confused with the sockets on the
-back of your computer!).
-
-
-2) What is the FreeBSD Ports Collection?
-
- People who (allegedly) know what they are doing have automated the
-process of ``porting'' software to FreeBSD, and the result is the
-Ports Collection. The general idea is that a combination of various
-programming tools available in the base FreeBSD installation will
-allow you to fetch the port from a FreeBSD mirror site, type ``make''
-and get the fully working program.
-
- The ports collection itself normally doesn't have any of the
-original source code necessary for the compilation in the tree, just
-those shell scripts, Makefiles and source code ``diffs'' that are
-necessary to compile the program under FreeBSD. This is meant to keep
-the entire system down to a manageable size, and the current system
-has over 100 ports in the master source tree, and yet a compressed tar
-file of that tree is about 2 megabytes (all the source code needed is
-over 100Mb's!).
-
-
-3) How does the system compile with no source code?
-
- A ports' Makefile automatically looks in a central location on
-your system (usually /usr/ports/distfiles, though this value can be
-customized) for the associated set of original distribution files that
-have been ``ported''. These are generally provided at various places
-on the Internet, though if you have a CDROM distribution of FreeBSD
-then you've already got them available on your CD for ease of use.
-See section 3.1 if you have such a CD distribution, otherwise skip to
-section 3.2.
-
-3.1 Compiling ports from CD
-
- Type something profound here.
-
-3.2 Compiling ports using an Internet connection
-
- The ports collection can also use an auto-fetch system to keep
-your ports collection source tree up to date, updating the central
-``distfiles'' version for you the next time you compile the port.
-
- Of course, this always assumes you have a permanent network link,
-or don't mind heavy usage of your telephone. If you don't want heavy
-network usage when you compile your ports tree, you can pre-fetch the
-necessary tarballs beforehand and put them into /usr/ports/distfiles
-(or wherever DISTDIR points) by hand. A good way to see what files a
-port is going to need is to cd to that port's directory and do a
-``make -n fetch'' to see what it does.
-
- You can also chose to get the source files either from the master
-FTP site as defined in the relevant Makefile (in the MASTER_SITES
-line), or some FreeBSD mirror site also carrying a set of distfiles,
-as does the master FTP site on ftp.FreeBSD.org (aka ftp.cdrom.com) in
-the directory /pub/FreeBSD/ports/distfiles. Note that the files in
-that directory are not guarenteed to be kept up to date - this is a
-volunteer project! We can't make any guarantees about the mirror
-sites either - they are obviously under independant control and don't
-even have to mirror the distfiles directory.
-
- If you have a non-permanant link, you can fetch all the distfiles by
-going to the top of the tree and typing ``make fetch''.
-
-
-4) It doesn't work?!
-
-Oh. You can do one of four (4) things :
-
-a) Fix it yourself. Technical details can be found in the GUIDELINES file,
- available from URL ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/GUIDELINES
-
-b) Gripe. This is done by e-mail *ONLY*! The people at Walnut Creek are
- in no way responsible for the functionality (or lack thereof) of the
- FreeBSD system as a whole, and especially the ports system, which
- is mainly contributed by 3rd parties. (If you don't believe me, check
- the catalogue, especially the line saying "We cannot offer tech-support
- on this product")
-
- The e-mail address is Ports@FreeBSD.org. Please include details of
- the port, where you got both the port source & distfile(s) from, and
- what the error was.
-
- Note: At time of writing, lang/Sather doesn't seem to work on Pentium
- machines due to the Intel Curse (aka the Floating Point Division Bug).
- Please don't tell us about this - gripe to Intel instead - it's their
- bug!
-
-c) Forget it. This is the easiest for most - very few of the programs in
- ports can be classed as `essential'!
-
-d) Grab the pre-compiled package from a ftp server. The ``master'' package
- collection is in:
- ftp://ftp.FreeBSD.org/pub/FreeBSD/packages/
-
- though check your local mirror first, please!
-
- These are more likely to work (on the whole) than trying to compile from
- source, and a lot faster!
-
-
-5) I've ported a program and I want to make a port out of it. What now?
-
- See the file GUIDELINES, in:
- ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/GUIDELINES
-
- This contains details of the procedure and structure involved.
-
-
-6) I've got a good port, what now?
-
- Upload the fixed version to freefall.cdrom.com /pub/incoming or
-ftp.FreeBSD.org /pub/FreeBSD/incoming and send e-mail to
-ports@FreeBSD.org with the filename and details. Someone on the
-all-volunteer `ports committee' will (hopefully) look it over and
-commit it to the ports collection if they like the looks of it.
-
-
-7) Things go funny during the fetch stage of compilation!
-
- We know. Please don't blame us. There is a program called `ncftp'
-which is used instead of the normal ftp as it can do so-called
-``background'' or ``batch'' transfers, ideal for this situation.
-Unfortunately it can do strange things, and has crashed at least one
-machine (during circumstances stranger than most, I'll admit, but it
-was still responsible). Hopefully a future release of ncftp will fix
-these problems (it is not maintained by the main FreeBSD team, but a
-third party, who is I believe aware of its shortcomings)
-
-
-8) I want to leave the compile going overnight, but some ports don't
- like this.
-
- There is a way around this. Before starting the compilation, type:
- setenv BATCH yes # (if you use csh/tcsh) or
- BATCH=yes # (for sh/bash)
-
- This should miss out ports which need user interaction. Unfortunately,
-ncftp doesn't know about this trick, and can often screw up and ask
-stupid questions in unattended batch mode. See (7).
-
- To compile those ports left out by doing the above, using a
-different login shell (or unsetting the above BATCH variable), set the
-INTERACTIVE variable instead (you can use the same statements as above
-except replace ``BATCH'' with ``INTERACTIVE'') and re-run make. This
-should now compile only those ports which will definitely ask for user
-interaction.
-
-
-9) The ports collection is weak. What can I do to help?
-
- First read the bsd.port.mk file (which may be found in
-/usr/share/mk/) and the associated bsd.port.subdir.mk file. A lot of
-the weirdness can be explained properly in there (most of the current
-weirdness is due to the lack of assumptions about anything, which is
-necessary due to the generic nature of these files). Also check that
-you have an up-to-date copy, as the file can change from minute to
-minute. A reasonably up-to-date copy can be found in:
-
- ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/share/mk/bsd.port*
-
- If you find that you still need to go in there and alter things,
-by all means do so, and then send the diffs to ports@FreeBSD.org if
-you'd like them to be a part of the default distribution. Please also
-remember that any changes must respect backwards-compatability with
-any and all older Makefiles, unless you want a real nightmare of
-/usr/ports munging ahead of you! Large scale changes will generally
-not be warmly welcomed unless all the existing makefiles work without
-alteration. Sorry!
-
-
-10) This FAQ is weak. What can I do?
-
- Send changes to ports@FreeBSD.org. Changes are most welcome!
-This FAQ is also very green and should be considered no more than
-a `good start' for now. Authors? You can come out of hiding any
-time now! :-)
-
-
-11) How do I get more information on all the ports?
-
- One good method is to cd to the top of the ports tree (say /usr/ports)
-and type something like:
-
- make describe | sed -e '/===/D' -e 's;/usr/ports/;;' | expand -40
-
-The ``make describe'' will try to extract the one-line description from
-each port, and the ``sed'' will delete the extraneous output. ``expand''
-just makes it a little more readable (sort of - you may want to season
-the output of this more to taste).
-
-
-12) I've heard of a new checksum system. What is this for?
-
- For various reasons, when using FTP over the Internet to obtain the
-source code, you may not always end up with the same copy of the code
-that the origional porter worked from, and this can lead to problems.
-So a simple checksumming system has been employed to try and highlight
-problems in this area.
-
- To check the entire system, go to the top of the ports tree
-(defaults to /usr/ports) and type
-
- make checksum
-
-This will give a report on the validity of the files you have FTP'd. If some
-are missing, the system will attempt to retrieve them before running the
-checksum routine. The same technique can be applied to a single port.
-
- The system will complain if there is no pre-computed checksum available
-for that port. Not all ports currently have checksums, but this should be
-cured soon.
-
- Some older versions of the system don't recognise the ``checksum''
-target. In that case, try the command
-
- make check-md5
-
-(``check-md5'' was the pre-cursor to the ``checksum'' target). If neither
-work, get the latest copies of bsd.port.mk and bsd.port.subdir.mk from
-
- ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/share/mk/bsd.port*
-
-and install them in /usr/share/mk. This will get you the latest version
-of the ports system.
diff --git a/share/FAQ/ppp.FAQ b/share/FAQ/ppp.FAQ
deleted file mode 100755
index 0a6a980..0000000
--- a/share/FAQ/ppp.FAQ
+++ /dev/null
@@ -1,369 +0,0 @@
- Info about setting up pppd daemon on FreeBSD-2.0
-
-$Id$
-
-Before you start setting up PPP on your machine make
-sure that pppd is located in /usr/sbin and directory /etc/ppp
-exists.
-
-pppd can work in two modes:
-
-i) as a "client" , i.e. you want to connect your machine to outside
-world via PPP serial connection or modem line.
-
-ii) as a "server" , i.e. your machine is located on the network and
-used to connect other computers using PPP.
-
-In both cases you will need to set up an options file ( /etc/ppp/options
-or ~/.ppprc if you have more then one user on your machine that uses
-PPP ).
-
-You also will need some modem/serial software ( preferably kermit )
-so you can dial and establish connection with remote host.
-
-1) Working as a PPP client
-
-I used the following options to connect to CISCO terminal server PPP
-line.
-
-----/etc/ppp/options-------
-crtscts # enable hardware flow control
-modem # modem control line
-noipdefault # remote PPP server must supply your IP address.
- # if the remote host doesn't send your IP during IPCP
- # negotiation , remove this option
-passive # wait for LCP packets
-domain ppp.foo.com # put your domain name here
-
-:<remote_ip> # put the IP of remote PPP host here
- # it will be used to route packets via PPP link
- # if you didn't specified the noipdefault option
- # change this line to <local_ip>:<remote_ip>
-
-defaultroute # put this if you want that PPP server will be your
- # default router
--------------------------
-
-To connect:
-i) Dial to the remote host using kermit ( or other modem program )
-enter your user name and password ( or whatever is needed to enable PPP
-ont the remote host )
-
-ii) Exit kermit. ( without hanging up the line )
-
-iii) enter:
-/usr/src/usr.sbin/pppd.new/pppd /dev/tty01 19200
-( put the appropriate speed and device name )
-
-Now your computer is connected with PPP. If the connection fails for some
-reasons you can add the "debug" option to the /etc/ppp/options file
-and check messages on the console to track the problem
-
-Following script will make all 3 stages automatically:
------/etc/ppp/pppup--------
-#!/bin/sh
-ps ax |grep pppd |grep -v grep
-pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing pppd, PID=' ${pid}
- kill ${pid}
-fi
-ps ax |grep kermit |grep -v grep
-pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing kermit, PID=' ${pid}
- kill -9 ${pid}
-fi
-
-ifconfig ppp0 down
-ifconfig ppp0 delete
-
-kermit -y /etc/ppp/kermit.dial
-pppd /dev/tty01 19200
------------------------------
-
-/etc/ppp/kermit.dial is kermit script that dials and makes all
-necessary authorization on the remote host.
-( Example of such script is attached to the end of this document )
-
-Use the follwing script to disconnect the PPP line:
------/etc/ppp/pppdown--------
-#!/bin/sh
-pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'`
-if [ X${pid} != "X" ] ; then
- echo 'killing pppd, PID=' ${pid}
- kill -TERM ${pid}
-fi
-
-ps ax |grep kermit |grep -v grep
-pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing kermit, PID=' ${pid}
- kill -9 ${pid}
-fi
-
-/sbin/ifconfig ppp0 down
-/sbin/ifconfig ppp0 delete
-kermit -y /etc/ppp/kermit.hup
-/etc/ppp/ppptest
-------------------------------
-
-Check if PPP is still running:
-
------/etc/ppp/ppptest---------
-#!/bin/sh
-pid=`ps ax| grep pppd |grep -v grep|awk '{print $1;}'`
-if [ X${pid} != "X" ] ; then
- echo 'pppd running: PID=' ${pid-NONE}
-else
- echo 'No pppd running.'
-fi
-set -x
-netstat -n -I ppp0
-ifconfig ppp0
------------------------------
-
-Hangs up modem line:
-
------/etc/ppp/kermit.hup-----
-set line /dev/tty01 ; put your modem device here
-set speed 19200
-set file type binary
-set file names literal
-set win 8
-set rec pack 1024
-set send pack 1024
-set block 3
-set term bytesize 8
-set command bytesize 8
-set flow none
-
-pau 1
-out +++
-inp 5 OK
-out ATH0\13
-echo \13
-exit
-----------------------------
-
-2) Working as a PPP server
-
-------/etc/ppp/options------
-crtscts # Hardware flow control
-netmask 255.255.255.0 # netmask ( not required )
-192.114.208.20:192.114.208.165 # ip's of local and remote hosts
- # local ip must be different from one
- # you assigned to the ethernet ( or other )
- # interface on your machine.
- # remote IP is ip address that will be
- # assigned to the remote machine
-domain ppp.foo.com # your domain
-passive # wait for LCP
-modem # modem line
-----------------------------
-
-Following script will enable ppp server on your machine
-
------/etc/ppp/pppserv-------
-#!/bin/sh
-ps ax |grep pppd |grep -v grep
-pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing pppd, PID=' ${pid}
- kill ${pid}
-fi
-ps ax |grep kermit |grep -v grep
-pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing kermit, PID=' ${pid}
- kill -9 ${pid}
-fi
-
-# reset ppp interface
-ifconfig ppp0 down
-ifconfig ppp0 delete
-
-# enable autoanswer mode
-kermit -y /etc/ppp/kermit.ans
-
-# run ppp
-pppd /dev/tty01 19200
-----------------------------
-
-Use this script to stop ppp server:
-
------/etc/ppp/pppservdown---
-#!/bin/sh
-ps ax |grep pppd |grep -v grep
-pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing pppd, PID=' ${pid}
- kill ${pid}
-fi
-ps ax |grep kermit |grep -v grep
-pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'`
-if [ "X${pid}" != "X" ] ; then
- echo 'killing kermit, PID=' ${pid}
- kill -9 ${pid}
-fi
-ifconfig ppp0 down
-ifconfig ppp0 delete
-
-kermit -y /etc/ppp/kermit.noans
-----------------------------
-
-Following kermit script will enable/disable autoanswer mode
-on your modem:
-
------/etc/ppp/kermit.ans----
-set line /dev/tty01
-set speed 19200
-set file type binary
-set file names literal
-set win 8
-set rec pack 1024
-set send pack 1024
-set block 3
-set term bytesize 8
-set command bytesize 8
-set flow none
-
-pau 1
-out +++
-inp 5 OK
-out ATH0\13
-inp 5 OK
-echo \13
-out ATS0=1\13 ; change this to out ATS0=0\13 if you want to disable
- ; autoanswer mod
-inp 5 OK
-echo \13
-exit
------------------------------
-
-This script is used for dialing and authorizing on remote host.
-You will need to customize it for your needs.
-Put your login and password in this script , also you'll need
-to change input statement depending on responces from your modem
-and remote host.
-
------/etc/ppp/kermit.dial----
-
-;
-; put the com line attached to the modem here:
-;
-set line /dev/tty01
-;
-; put the modem speed here:
-;
-set speed 19200
-set file type binary ; full 8 bit file xfer
-set file names literal
-set win 8
-set rec pack 1024
-set send pack 1024
-set block 3
-set term bytesize 8
-set command bytesize 8
-set flow none
-set modem hayes
-set dial hangup off
-set carrier auto ; Then SET CARRIER if necessary,
-set dial display on ; Then SET DIAL if necessary,
-set input echo on
-set input timeout proceed
-set input case ignore
-def \%x 0 ; login prompt counter
-goto slhup
-
-:slcmd ; put the modem in command mode
-echo Put the modem in command mode.
-clear ; Clear unread characters from input buffer
-pause 1
-output +++ ; hayes escape sequence
-input 1 OK\13\10 ; wait for OK
-if success goto slhup
-output \13
-pause 1
-output at\13
-input 1 OK\13\10
-if fail goto slcmd ; if modem doesn't answer OK, try again
-
-:slhup ; hang up the phone
-clear ; Clear unread characters from input buffer
-pause 1
-echo Hanging up the phone.
-output ath0\13 ; hayes command for on hook
-input 2 OK\13\10
-if fail goto slcmd ; if no OK answer, put modem in command mode
-
-:sldial ; dial the number
-pause 1
-echo Dialing.
-output atdt9,550311\13\10 ; put phone number here
-assign \%x 0 ; zero the time counter
-
-:look
-clear ; Clear unread characters from input buffer
-increment \%x ; Count the seconds
-input 1 {CONNECT }
-if success goto sllogin
-reinput 1 {NO CARRIER\13\10}
-if success goto sldial
-reinput 1 {NO DIALTONE\13\10}
-if success goto slnodial
-reinput 1 {\255}
-if success goto slhup
-reinput 1 {\127}
-if success goto slhup
-if < \%x 60 goto look
-else goto slhup
-
-:sllogin ; login
-assign \%x 0 ; zero the time counter
-pause 1
-echo Looking for login prompt.
-
-:slloop
-increment \%x ; Count the seconds
-clear ; Clear unread characters from input buffer
-output \13
-;
-; put your expected login prompt here:
-;
-input 1 {Username: }
-if success goto sluid
-reinput 1 {\255}
-if success goto slhup
-reinput 1 {\127}
-if success goto slhup
-if < \%x 10 goto slloop ; try 10 times to get a login prompt
-else goto slhup ; hang up and start again if 10 failures
-
-:sluid
-;
-; put your userid here:
-;
-output ppp-login\13
-input 1 {Password: }
-;
-; put your password here:
-;
-output ppp-password\13
-input 1 {Entering SLIP mode.}
-echo
-quit
-
-:slnodial
-echo \7No dialtone. Check the telephone line!\7
-exit 1
-
-; local variables:
-; mode: csh
-; comment-start: "; "
-; comment-start-skip: "; "
-; end:
-------------------------
-
-###################################################################
-Gennady B. Sorokopud ( gena@NetVision.net.il ) 24/10/94 12:00
diff --git a/share/FAQ/slip-dialup b/share/FAQ/slip-dialup
deleted file mode 100644
index 66a6646..0000000
--- a/share/FAQ/slip-dialup
+++ /dev/null
@@ -1,190 +0,0 @@
-***********************************************************************
-*** How to Set Up SLIP on FreeBSD ***
-***********************************************************************
-
-Updated for 1.1.5(.1) support by Satoshi Asami, 8/6/94.
-
-The following is I (asami) set up my FreeBSD machine for SLIP on a
-static host network. For dynamic hostname assignments (i.e., your
-address changes each time you dial up), you probably need to do
-something much fancier.
-
-This is just "what I did, and it worked for me". I'm sharing this
-just for your reference, I'm no expert in SLIP nor networking so your
-mileage may vary.
-
-Note: for 1.1 systems (not 1.1.5), you need to use /dev/tty01 instead
-of /dev/cua01. substitute all the occurences of "cua" in this document
-with "tty".
-
-Note: the default 1.1.5(.1) system only comes with cua/ttyd pairs for
-the last two ports (2 and 3), so if your modem is at sio0/sio1
-(COM1/COM2), you need to make the devices. Try "cd /dev; sh MAKEDEV
-cua01" to make the new special files for sio1 (ditto for sio0). This
-will delete tty01, but you shouldn't need it anymore...or you can make
-a symbolic link /dev/tty01 -> ttyd1 if you don't want to hunt down all
-occurences of tty01 in your setup files.
-
-I actually have a symbolic link /dev/modem -> cua01 (and /dev/mouse ->
-ttyd0). I use only the modem/mouse names in my configuration files.
-This helped a lot when I switched from 1.1 to 1.1.5.1 (tty01 => cua01)
-and when I had to move my modem temporarily to sio2 to enable the
-RS-232C port on the serial card. It can become quite cumbersome when
-you need to fix a bunch of files in /etc and .kermrc's all over the
-system!
-
-First, make sure you have
-
-pseudo-device sl 2
-
-in your kernel's config file. It is included in the GENERICAH and
-GENERICBT kernels, so this won't be a problem unless you deleted it.
-
-Things you have to do only once:
-
-(1) Add your home machine, the gateway and nameservers to your
- /etc/hosts file. Mine looks like this:
-
-127.0.0.1 localhost loghost
-136.152.64.181 silvia.HIP.Berkeley.EDU silvia.HIP silvia
-
-136.152.64.1 inr-3.Berkeley.EDU inr-3 slip-gateway
-128.32.136.9 ns1.Berkeley.edu ns1
-128.32.136.12 ns2.Berkeley.edu ns2
-
- By the way, silvia is the name of the car that I had when I was
- back in Japan (it's called 2?0SX here in U.S.).
-
-(2) Make sure you have "hosts" before "bind" in your /etc/host.conf.
- Otherwise, funny things may happen.
-
-(3) Edit the /etc/netstart and add this to the end of the file:
-
-# set up slip
-gateway=slip-gateway
-ifconfig sl0 inet $hostname $gateway netmask 0xffffff00
-route add default $gateway
-
- Note that because of the "slip-gateway" entry in /etc/hosts, there
- is no local dependency in the netstart file. Also, you might want
- to un-comment the "route add $hostname localhost" line.
-
-(3') Make a file /etc/resolv.conf which contains:
-
-domain HIP.Berkeley.EDU
-nameserver 128.32.136.9
-nameserver 128.32.136.12
-
- As you can see, these set up the nameserver hosts. Of course, the
- actual addresses depend on your environment.
-
-(4) Set the password for root and toor (and any other accounts that
- doesn't have a password). Use passwd, don't edit the passwd or
- passwd.master files!
-
-(5) Edit /etc/myname and reboot the machine.
-
-How to set up the connection:
-
-(6) Dial up, type "slip" at the prompt, enter your machine name and
- password. The things you need to enter depends on your
- environment. I use kermit, with a script like this:
-
-# kermit setup
-set modem hayes
-set line /dev/cua01
-set speed 57600
-set parity none
-set flow rts/cts
-set terminal bytesize 8
-set file type binary
-# The next macro will dial up and login
-define slip dial 643-9600, input 10 =>, if failure stop, -
-output slip\x0d, input 10 Username:, if failure stop, -
-output silvia\x0d, input 10 Password:, if failure stop, -
-output ***\x0d, echo \x0aCONNECTED\x0a
-
- (of course, you have to change the hostname and password to fit
- yours). Then you can just type "slip" from the kermit prompt to
- get connected.
-
- Note: leaving your password in plain text anywhere in the
- filesystem is generally a BAD idea. Do it at your own risk. I'm
- just too lazy.
-
- Note: If you have an 1.1 machine, and kermit doesn't give you a
- prompt, try "stty -f /dev/tty01 clocal". I put this in
- /etc/rc.local so that it works the first time I boot the machine.
- This doesn't apply to 1.1.5(.1) systems, as cua0? are already
- configured for dialouts.
-
-(7) Leave the kermit there (you can suspend it by "z") and as root,
- type
-
-slattach -h -c -s 57600 /dev/cua01
-
- if you are able to "ping" hosts on campus, you are connected!
-
- If it doesn't work, you might want to try "-a" instead of "-c".
-
-(8) Happy slipping!
-
-How to shutdown the connection:
-
-(9) Type "ps gx" (as root) to find out the PID of slattach, and use
- "kill -INT" to kill it.
-
- Then go back to kermit ("fg" if you suspended it) and exit from it
- ("q").
-
- The slattach man page says you have to use "ifconfig sl0 down" to
- mark the interface down, but this doesn't seem to make any
- difference for me. ("ifconfig sl0" reports the same thing.)
-
- Some times, your modem might refuse to drop the carrier (mine
- often does). In that case, simply start kermit and quit it again.
- It usually goes out on the second try.
-
- When you want to connect again, go back to (6). You may have to
- watch out for clocal mode. If "stty -f /dev/tty01" doesn't tell
- you it's clocal, you need to re-set it before kermitting. Again,
- this is only for 1.1 machines.
-
-TROUBLESHOOTING:
-
-If it doesn't work, feel free to ask me. The things that people
-tripped over so far:
-
-* Not using "-c" or "-a" in slattach (I have no idea why this can be
- fatal, but adding this flag solved the problem for at least one
- person)
-
-* Using "s10" instead of "sl0" (might be hard to see the difference on
- some fonts :)
-
-Try "ifconfig sl0" to see your interface status. I get:
-
-silvia# ifconfig sl0
-sl0: flags=10<POINTOPOINT>
- inet 136.152.64.181 --> 136.152.64.1 netmask ffffff00
-
-Also, "netstat -r" will give the routing table, in case you get the
-"no route to host" messages from ping. Mine looks like:
-
-silvia# netstat -r
-Routing tables
-Destination Gateway Flags Refs Use IfaceMTU Rtt
-Netmasks:
-(root node)
-(root node)
-
-Route Tree for Protocol Family inet:
-(root node) =>
-default inr-3.Berkeley.EDU UG 8 224515 sl0 - -
-localhost.Berkel localhost.Berkeley UH 5 42127 lo0 - 0.438
-inr-3.Berkeley.E silvia.HIP.Berkele UH 1 0 sl0 - -
-silvia.HIP.Berke localhost.Berkeley UGH 34 47641234 lo0 - 0.438
-(root node)
-
-(this is after transferring a bunch of files, your numbers should be
-smaller).
diff --git a/share/FAQ/slip.FAQ b/share/FAQ/slip.FAQ
deleted file mode 100644
index f05e9be..0000000
--- a/share/FAQ/slip.FAQ
+++ /dev/null
@@ -1,192 +0,0 @@
-***********************************************************************
-*** How to Set Up SLIP on FreeBSD ***
-***********************************************************************
-
-$Id$
-
-Updated for 1.1.5(.1) support by Satoshi Asami, 8/6/94.
-
-The following is I (asami) set up my FreeBSD machine for SLIP on a
-static host network. For dynamic hostname assignments (i.e., your
-address changes each time you dial up), you probably need to do
-something much fancier.
-
-This is just "what I did, and it worked for me". I'm sharing this
-just for your reference, I'm no expert in SLIP nor networking so your
-mileage may vary.
-
-Note: for 1.1 systems (not 1.1.5), you need to use /dev/tty01 instead
-of /dev/cua01. substitute all the occurences of "cua" in this document
-with "tty".
-
-Note: the default 1.1.5(.1) system only comes with cua/ttyd pairs for
-the last two ports (2 and 3), so if your modem is at sio0/sio1
-(COM1/COM2), you need to make the devices. Try "cd /dev; sh MAKEDEV
-cua01" to make the new special files for sio1 (ditto for sio0). This
-will delete tty01, but you shouldn't need it anymore...or you can make
-a symbolic link /dev/tty01 -> ttyd1 if you don't want to hunt down all
-occurences of tty01 in your setup files.
-
-I actually have a symbolic link /dev/modem -> cua01 (and /dev/mouse ->
-ttyd0). I use only the modem/mouse names in my configuration files.
-This helped a lot when I switched from 1.1 to 1.1.5.1 (tty01 => cua01)
-and when I had to move my modem temporarily to sio2 to enable the
-RS-232C port on the serial card. It can become quite cumbersome when
-you need to fix a bunch of files in /etc and .kermrc's all over the
-system!
-
-First, make sure you have
-
-pseudo-device sl 2
-
-in your kernel's config file. It is included in the GENERIC, GENERICAH
-and GENERICBT kernels, so this won't be a problem unless you deleted it.
-
-Things you have to do only once:
-
-(1) Add your home machine, the gateway and nameservers to your
- /etc/hosts file. Mine looks like this:
-
-127.0.0.1 localhost loghost
-136.152.64.181 silvia.HIP.Berkeley.EDU silvia.HIP silvia
-
-136.152.64.1 inr-3.Berkeley.EDU inr-3 slip-gateway
-128.32.136.9 ns1.Berkeley.edu ns1
-128.32.136.12 ns2.Berkeley.edu ns2
-
- By the way, silvia is the name of the car that I had when I was
- back in Japan (it's called 2?0SX here in U.S.).
-
-(2) Make sure you have "hosts" before "bind" in your /etc/host.conf.
- Otherwise, funny things may happen.
-
-(3) Edit the /etc/netstart and add this to the end of the file:
-
-# set up slip
-gateway=slip-gateway
-ifconfig sl0 inet $hostname $gateway netmask 0xffffff00
-route add default $gateway
-
- Note that because of the "slip-gateway" entry in /etc/hosts, there
- is no local dependency in the netstart file. Also, you might want
- to un-comment the "route add $hostname localhost" line.
-
-(3') Make a file /etc/resolv.conf which contains:
-
-domain HIP.Berkeley.EDU
-nameserver 128.32.136.9
-nameserver 128.32.136.12
-
- As you can see, these set up the nameserver hosts. Of course, the
- actual addresses depend on your environment.
-
-(4) Set the password for root and toor (and any other accounts that
- doesn't have a password). Use passwd, don't edit the passwd or
- passwd.master files!
-
-(5) Edit /etc/myname and reboot the machine.
-
-How to set up the connection:
-
-(6) Dial up, type "slip" at the prompt, enter your machine name and
- password. The things you need to enter depends on your
- environment. I use kermit, with a script like this:
-
-# kermit setup
-set modem hayes
-set line /dev/cua01
-set speed 57600
-set parity none
-set flow rts/cts
-set terminal bytesize 8
-set file type binary
-# The next macro will dial up and login
-define slip dial 643-9600, input 10 =>, if failure stop, -
-output slip\x0d, input 10 Username:, if failure stop, -
-output silvia\x0d, input 10 Password:, if failure stop, -
-output ***\x0d, echo \x0aCONNECTED\x0a
-
- (of course, you have to change the hostname and password to fit
- yours). Then you can just type "slip" from the kermit prompt to
- get connected.
-
- Note: leaving your password in plain text anywhere in the
- filesystem is generally a BAD idea. Do it at your own risk. I'm
- just too lazy.
-
- Note: If you have an 1.1 machine, and kermit doesn't give you a
- prompt, try "stty -f /dev/tty01 clocal". I put this in
- /etc/rc.local so that it works the first time I boot the machine.
- This doesn't apply to 1.1.5(.1) systems, as cua0? are already
- configured for dialouts.
-
-(7) Leave the kermit there (you can suspend it by "z") and as root,
- type
-
-slattach -h -c -s 57600 /dev/cua01
-
- if you are able to "ping" hosts on campus, you are connected!
-
- If it doesn't work, you might want to try "-a" instead of "-c".
-
-(8) Happy slipping!
-
-How to shutdown the connection:
-
-(9) Type "ps gx" (as root) to find out the PID of slattach, and use
- "kill -INT" to kill it.
-
- Then go back to kermit ("fg" if you suspended it) and exit from it
- ("q").
-
- The slattach man page says you have to use "ifconfig sl0 down" to
- mark the interface down, but this doesn't seem to make any
- difference for me. ("ifconfig sl0" reports the same thing.)
-
- Some times, your modem might refuse to drop the carrier (mine
- often does). In that case, simply start kermit and quit it again.
- It usually goes out on the second try.
-
- When you want to connect again, go back to (6). You may have to
- watch out for clocal mode. If "stty -f /dev/tty01" doesn't tell
- you it's clocal, you need to re-set it before kermitting. Again,
- this is only for 1.1 machines.
-
-TROUBLESHOOTING:
-
-If it doesn't work, feel free to ask me. The things that people
-tripped over so far:
-
-* Not using "-c" or "-a" in slattach (I have no idea why this can be
- fatal, but adding this flag solved the problem for at least one
- person)
-
-* Using "s10" instead of "sl0" (might be hard to see the difference on
- some fonts :)
-
-Try "ifconfig sl0" to see your interface status. I get:
-
-silvia# ifconfig sl0
-sl0: flags=10<POINTOPOINT>
- inet 136.152.64.181 --> 136.152.64.1 netmask ffffff00
-
-Also, "netstat -r" will give the routing table, in case you get the
-"no route to host" messages from ping. Mine looks like:
-
-silvia# netstat -r
-Routing tables
-Destination Gateway Flags Refs Use IfaceMTU Rtt
-Netmasks:
-(root node)
-(root node)
-
-Route Tree for Protocol Family inet:
-(root node) =>
-default inr-3.Berkeley.EDU UG 8 224515 sl0 - -
-localhost.Berkel localhost.Berkeley UH 5 42127 lo0 - 0.438
-inr-3.Berkeley.E silvia.HIP.Berkele UH 1 0 sl0 - -
-silvia.HIP.Berke localhost.Berkeley UGH 34 47641234 lo0 - 0.438
-(root node)
-
-(this is after transferring a bunch of files, your numbers should be
-smaller).
diff --git a/share/FAQ/slip_server.FAQ b/share/FAQ/slip_server.FAQ
deleted file mode 100644
index ee6676b..0000000
--- a/share/FAQ/slip_server.FAQ
+++ /dev/null
@@ -1,433 +0,0 @@
- Slip Server
- FAQ
- For
- FreeBSD
-
-$Id$
-
-Help for setting up SLIP Server services on a FreeBSD system
-------------------------------------------------------------
-
-Written by Guy Helmer (ghelmer@alpha.dsu.edu)
-Last Updated December 13, 1994
-
-This document provides suggestions for setting up SLIP Server services
-on a FreeBSD system, which typically means configuring your system to
-automatically startup connections upon login for remote SLIP clients.
-I've written this document based on my own experience; however, as
-your system and needs may be different, this document may not answer
-all of your questions, and I cannot be responsible if you damage your
-system or lose data due to attempting to follow the suggestions here.
-
-I have only setup SLIP Server services on a FreeBSD 1.1 system, so if
-you are running a different version (such as FreeBSD 2.0), your system
-may be different. I've decided to write this document since I've
-recently been asked for the umpteenth time how to setup a FreeBSD
-machine as a SLIP server :-)
-
-
-1. Prerequisites
-----------------
-
-This document is very technical in nature, so background knowledge is
-required. I must assume that you are familiar with the TCP/IP network
-protocol, and in particular, network and node addressing, network
-address masks, subnetting, routing, and routing protocols, such as
-RIP. Configuring SLIP services on a dial-up server requires a
-knowledge of these concepts, and if you are not familiar with them,
-please read a copy of either Craig Hunt's "TCP/IP Network
-Administration" published by O'Reilly & Associates, Inc. (ISBN Number
-0-937175-82-X), or Douglas Comer's book on the TCP/IP protocol.
-
-I will assume that you have already setup your modem(s) and configured
-the appropriate system files to allow logins through your modems (see
-the manual pages for sio(4) for information on the serial port device
-driver and ttys(5), gettytab(5), getty(8), & init(8) for information
-relevant to configuring the system to accept logins on modems, and
-perhaps stty(1) for information on setting serial port parameters
-[such as "clocal" for directly-connected serial interfaces]).
-
-2. Quick Overview
------------------
-
-In its typical configuration, using FreeBSD as a SLIP server works as
-follows: a SLIP user dials up your FreeBSD SLIP Server system and logs
-in with a special SLIP login ID that uses "/usr/sbin/sliplogin" as the
-special user's shell. The "sliplogin" program browses the file
-"/etc/slip.hosts" to find a matching line for the special user, and if
-it finds a match, connects the serial line to an available SLIP
-interface and then runs /etc/slip.login to configure the SLIP
-interface.
-
-2.1 An Example of a SLIP Server Login
--------------------------------------
-
-For example, if my SLIP user ID were "Shelmerg", that user's entry in
-/etc/master.passwd would look something like this (except it would be
-all on one line):
-
-Shelmerg:password:1964:89::0:0:Guy Helmer - SLIP:
- /usr/users/Shelmerg:/usr/sbin/sliplogin
-
-and, when I log in with that user ID, "sliplogin" will search
-/etc/slip.hosts for a line that had a matching user ID; on my system,
-I may have a line in /etc/slip.hosts that reads:
-
-Shelmerg dc-slip sl-helmer 0xfffffc00 autocomp
-
-sliplogin will find that matching line, hook the serial line I'm on
-into the next available SLIP interface, and then execute
-/etc/slip.login like this:
-
-/etc/slip.login 0 19200 Shelmerg dc-slip sl-helmer 0xfffffc00 autocomp
-
-If all goes well, /etc/slip.login will issue an "ifconfig" for the
-SLIP interface to which sliplogin attached itself (slip interface 0,
-in the above example, which was the first parameter in the list given
-to slip.login) to set the local IP address (dc-slip), remote IP
-address (sl-helmer), network mask for the SLIP interface (0xfffffc00),
-and any additional flags (autocomp). If something goes wrong,
-sliplogin usually logs good informational messages via the daemon
-syslog facility, which usually goes into /var/log/messages (see the
-manual pages for syslogd(8) and syslog.conf(5), and perhaps check
-/etc/syslog.conf to see to which files syslogd is logging).
-
-OK, enough of the examples -- let's dive into setting up the system.
-
-3. Kernel Configuration
------------------------
-
-FreeBSD's default kernels usually come with two SLIP interfaces
-defined (sl0 and sl1); you can use "netstat -i" to see whether these
-interfaces are defined in your kernel.
-
-Sample output from "netstat -i":
-Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
-ed0 1500 <Link>0.0.c0.2c.5f.4a 291311 0 174209 0 133
-ed0 1500 138.247.224 ivory 291311 0 174209 0 133
-lo0 65535 <Link> 79 0 79 0 0
-lo0 65535 loop localhost 79 0 79 0 0
-sl0* 296 <Link> 0 0 0 0 0
-sl1* 296 <Link> 0 0 0 0 0
-
-The sl0 and sl1 interfaces shown in "netstat -i"'s output indicate
-that there are two SLIP interfaces built into the kernel. (The
-asterisks after the "sl0" and "sl1" indicate that the interfaces are
-"down".)
-
-However, FreeBSD's default kernels do not come configured to forward
-packets (ie, your FreeBSD machine will not act as a router) due to
-Internet RFC requirements for Internet hosts (see RFC's 1009
-[Requirements for Internet Gateways], 1122 [Requirements for Internet
-Hosts -- Communication Layers], and perhaps 1127 [A Perspective on the
-Host Requirements RFCs]), so if you want your FreeBSD SLIP Server to
-act as a router, you'll have to add the line "options GATEWAY" to your
-machine's kernel configuration file and re-compile the kernel anyway.
-(Trivia: "Gateways" are the Internet's old name for what are now
-usually called "routers".)
-
-Please see the BSD System Manager's Manual chapter on "Building
-Berkeley Kernels with Config" [the source for which is in
-/usr/src/share/doc/smm] and the "FreeBSD Configuration Options" [in
-/sys/doc/options.doc] for more information on configuring and building
-kernels. You may have to unpack the kernel source distribution if
-haven't installed the system sources already (srcdist/srcsys.?? in
-FreeBSD 1.1, srcdist/sys.?? in FreeBSD 1.1.5.1, or the entire source
-distribution in FreeBSD 2.0-RELEASE) to be able to configure and build
-kernels.
-
-You'll notice that near the end of the default kernel configuration
-file (/sys/i386/conf/GENERICAH) is a line that reads:
-
-pseudo-device sl 2
-
-which is the line that defines the number of SLIP devices available in
-the kernel; the number at the end of the line is the maximum number of
-SLIP connections that may be operating simultaneously.
-
-See the "Building Berkeley Kernels with Config" and the manual page
-for config(8) to see how to configure and build kernels.
-
-4. Sliplogin Configuration
---------------------------
-
-As mentioned earlier, there are three files in the /etc directory that
-are part of the configuration for /usr/sbin/sliplogin (see
-sliplogin(8) for the actual manual page for sliplogin): slip.hosts,
-which lists the SLIP users & their associated IP addresses;
-slip.login, which usually just configures the SLIP interface; and
-slip.logout, which undoes slip.login's effects when the serial
-connection is terminated.
-
-4.1 slip.hosts Configuration & Local and Remote Address Selection
------------------------------------------------------------------
-
-/etc/slip.hosts contains lines which have at least four items listed:
-a SLIP user's login ID, the local address (local to the SLIP server)
-of the SLIP link, the remote address of the SLIP link, and the network
-mask. The local and remote addresses may be host names (given in
-/etc/hosts or by the domain name service, depending on your
-specifications in /etc/host.conf), and I believe the network mask may
-be a name that can be resolved by a lookup into /etc/networks. On one
-of my systems, /etc/slip.hosts looks like this:
-
------ begin /etc/slip.hosts -----
-#
-# login local-addr remote-addr mask opt1 opt2
-# (normal,compress,noicmp)
-#
-Shelmerg dc-slip sl-helmerg 0xfffffc00 autocomp
------ end /etc/slip.hosts ------
-
-At the end of the line is one or more of the options:
-
- "normal" - no header compression
- "compress" - compress headers
- "autocomp" - compress headers if the remote end allows it
- "noicmp" - disable ICMP packets (so any "ping" packets won't use up
- any of your bandwidth)
-
-Your choice of local and remote addresses for your SLIP links depends
-on whether you are going to dedicate a TCP/IP subnet or if you are
-going to use "proxy ARP" on your SLIP server (it's not "true" proxy
-ARP, but that is the terminology that I will use in this document to
-describe it). If you're not sure which method to select or how to
-assign IP addresses, please refer to the TCP/IP books referenced in
-the "Prerequisites" section and/or consult your IP network manager.
-
-If you are going to use a separate subnet for your SLIP clients, you
-will need to allocate the subnet number out of your assigned IP
-network number and assign each of your SLIP client's IP numbers out of
-that subnet; then you will probably either need to configure a static
-route to the SLIP subnet via your SLIP server on your nearest IP
-router, or install "gated" on your FreeBSD SLIP server and configure
-it to talk the appropriate routing protocols to your other routers to
-inform them about your SLIP server's route to the SLIP subnet.
-
-Otherwise, if you will use the "proxy ARP" method, you will need to
-assign your SLIP client's IP addresses out of your SLIP server's
-Ethernet subnet, and you'll also need to adjust your /etc/slip.login
-and /etc/slip.logout scripts to use arp(8) to manage the proxy-ARP
-entries in the SLIP server's ARP table.
-
-4.2 slip.login Configuration
-----------------------------
-
-The typical /etc/slip.login file looks like this:
-
------ begin /etc/slip.login -----
-#!/bin/sh -
-#
-# @(#)slip.login 5.1 (Berkeley) 7/1/90
-
-#
-# 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
------ end /etc/slip.login -----
-
-This slip.login file merely ifconfig's the appropriate SLIP interface
-with the local and remote addresses and network mask of the SLIP
-interface.
-
-If you have decided to use the "proxy ARP" method (instead of using a
-separate subnet for your SLIP clients), your /etc/slip.login file will
-need to look something like this:
-
------ begin /etc/slip.login for "proxy ARP" -----
-#!/bin/sh -
-#
-# @(#)slip.login 5.1 (Berkeley) 7/1/90
-
-#
-# 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
-# Answer ARP requests for the SLIP client with our Ethernet addr
-/usr/sbin/arp -s $5 00:11:22:33:44:55 pub
------ end /etc/slip.login for "proxy ARP" -----
-
-The additional line in this slip.login, "arp -s...", creates an ARP
-entry in the SLIP server's ARP table which asks the system to give out
-the SLIP server's Ethernet MAC address whenever a another system or
-router on the Ethernet asks to speak to the SLIP client's IP address.
-
-When using the example above, be sure to replace the Ethernet MAC
-address (00:11:22:33:44:55) with the MAC address of your system's
-Ethernet card, or your "proxy ARP" will definitely not work! You can
-discover your SLIP server's Ethernet MAC address by looking at the
-results of running "netstat -i"; the second line of the output should
-look something like:
-
-ed0 1500 <Link>0.2.c1.28.5f.4a 191923 0 129457 0 116
- ^^^^^^^^^^^^^^^
-
-which indicates that this particular system's Ethernet MAC address is
-"00:02:c1:28:5f:4a" -- the periods in the Ethernet MAC address given
-by "netstat -i" must be changed to colons and leading zeros should be
-added to each single-digit hexadecimal number to convert the address
-into the form that arp(8) desires; see the manual page on arp(8) for
-complete information on usage.
-
-Note that when you create /etc/slip.login and /etc/slip.logout, the
-"execute" bit ("chmod 755 /etc/slip.login /etc/slip.logout") must be
-set, or sliplogin will be unable to execute it.
-
-4.3 slip.logout Configuration
------------------------------
-
-"/etc/slip.logout" isn't strictly needed, but if you decide to create
-it, this is an example of a basic slip.logout script:
-
------ begin /etc/slip.logout -----
-#!/bin/sh -
-#
-# slip.logout
-
-#
-# logout 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 down
------ end /etc/slip.logout -----
-
-If you are using "proxy ARP", you'll want to have /etc/slip.logout
-remove the ARP entry for the SLIP client:
-
------ begin /etc/slip.logout for "proxy ARP" -----
-#!/bin/sh -
-#
-# @(#)slip.logout
-
-#
-# logout 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 down
-# Quit answering ARP requests for the SLIP client
-/usr/sbin/arp -d $5
------ end /etc/slip.logout for "proxy ARP" -----
-
-The "arp -d $5" removes the ARP entry that the "proxy ARP" slip.login
-added when the SLIP client logged in.
-
-It bears repeating: make sure /etc/slip.logout has the execute bit set
-for after you create it (e.g., "chmod 755 /etc/slip.logout").
-
-5. Routing Considerations
--------------------------
-
-If you are not using the "proxy ARP" method for routing packets
-between your SLIP clients and the rest of your network (and perhaps
-the Internet), you will probably either have to add static routes to
-your closest default router(s) to route your SLIP client subnet via
-your SLIP server, or you will probably need to install and configure
-gated on your FreeBSD SLIP server so that it will tell your routers
-via appropriate routing protocols about your SLIP subnet.
-
-5.1 Static Routes
------------------
-
-Adding static routes to your nearest default routers can be
-troublesome (or impossible, if you don't have authority to do so...).
-If you have a multiple-router network in your organization, some
-routers, such as Cisco and Proteon, may not only need to be configured
-with the static route to the SLIP subnet, but also need to be told
-which static routes to tell other routers about, so some expertise and
-troubleshooting/tweaking may be necessary to get static-route-based
-routing to work...
-
-5.2 Running gated
------------------
-
-An alternative to the headaches of static routes is to install gated
-on your FreeBSD SLIP server and configure it to use the appropriate
-routing protocols (RIP/OSPF/BGP/EGP) to tell other routers about your
-SLIP subnet. gated is available from ftp.gated.cornell.edu in
-/pub/gated; I believe the current version as of this writing is
-"gated-R3_5Alpha_8.tar.Z", which should include support for FreeBSD
-"out-of-the-box". Compile and install it, and then write a
-/etc/gated.conf file to configure your gated; here's a sample, similar
-to what I use on my FreeBSD SLIP server:
-
------ begin sample /etc/gated.conf for gated version 3.5Alpha5 -----
-#
-# gated configuration file for dc.dsu.edu; for gated version 3.5alpha5
-# Only broadcast RIP information for xxx.xxx.yy out the ed Ethernet interface
-#
-#
-# tracing options
-#
-traceoptions "/var/tmp/gated.output" replace size 100k files 2 general ;
-
-rip yes {
- interface sl noripout noripin ;
- interface ed ripin ripout version 1 ;
- traceoptions route ;
-} ;
-
-#
-# Turn on a bunch of tracing info for the interface to the kernel:
-kernel {
- traceoptions remnants request routes info interface ;
-} ;
-
-#
-# Propagate the route to xxx.xxx.yy out the Ethernet interface via RIP
-#
-
-export proto rip interface ed {
- proto direct {
- xxx.xxx.yy mask 255.255.252.0 metric 1; # SLIP connections
- } ;
-} ;
-
-#
-# Accept routes from RIP via ed Ethernet interfaces
-
-import proto rip interface ed {
- all ;
-} ;
-
------ end sample /etc/gated.conf -----
-
-The above sample gated.conf file broadcasts routing information
-regarding the SLIP subnet "xxx.xxx.yy" via RIP onto the Ethernet; if
-you are using a different Ethernet driver than the "ed" driver, you'll
-need to change the references to the "ed" interface appropriately.
-This sample file also sets up tracing to /var/tmp/gated.output for
-debugging gated; you can certainly turn off the tracing options if
-gated works OK for you. I've changed my SLIP subnet's address to
-"xxx.xxx.yy" throughout the above file; you'll need to change the
-"xxx.xxx.yy"'s into the network address of your own SLIP subnet (be
-sure to change the net mask in the "proto direct" clause as well).
-Complete gated configuration information may be read through the Web
-at "http://www.gated.cornell.edu/".
-
-When you get gated built and installed, and create a configuration
-file for it, you'll need to run gated in place of routed on your
-FreeBSD system; change the routed/gated startup parameters in
-/etc/netstart as appropriate for your system. Please see the manual
-page for gated for information on gated's command-line parameters.
-
-6. Acknowledgements
--------------------
-
-Thanks to these people for comments and advice regarding this FAQ:
-
- Wilko Bulte <wilko@yedi.iaf.nl>
- Piero Serini <Piero@Strider.Inet.IT>
-
-<<< END OF SLIP SERVER FAQ >>>
-
-
diff --git a/share/FAQ/standard-supfile b/share/FAQ/standard-supfile
deleted file mode 100644
index 6856d4c..0000000
--- a/share/FAQ/standard-supfile
+++ /dev/null
@@ -1,14 +0,0 @@
-base release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/src delete old
-bin release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/src delete old
-etc release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/src delete old
-games release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/src delete old
-gnu release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/src delete old
-include release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/src delete old
-sys release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/src delete old
-lib release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/src delete old
-libexec release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/src delete old
-sbin release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/src delete old
-#secure release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/src delete old
-share release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/src delete old
-usrbin release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/src delete old
-usrsbin release=current host=FreeBSD.ORG hostbase=/home base=/usr prefix=/usr/src delete old
diff --git a/share/FAQ/submitters.FAQ b/share/FAQ/submitters.FAQ
deleted file mode 100644
index 69a79f3..0000000
--- a/share/FAQ/submitters.FAQ
+++ /dev/null
@@ -1,167 +0,0 @@
--- A submitter's guide to FreeBSD --
-
-This guide is intended for those who are moderately familar with FreeBSD
-and are now to the point where they have some locally developed
-customizations or fixes to the system which they'd like to incorporate
-back into the mainstream sources, thus saving the work of having to
-re-integrate the changes for each subsequent FreeBSD release. Submitting
-something to the FreeBSD project is also an excellent way of getting your
-code seriously *tested*! Many people have developed an original concept
-far beyond what they might have envisioned at the start just due to the
-flood of feedback and ideas generated by the many thousands of users of
-FreeBSD. Contributions are also what FreeBSD lives and grows from,
-and so your contributions are very important to the continued survival
-of this communal effort of ours - we're very glad to see you reading this
-documentation! :-)
-
-Submissions to FreeBSD can generally be classified into four catagories:
-
-1. Ideas, general suggestions, bug reports.
-2. Addition, deletion, renaming or patching of existing sources.
-3. Significant contribution of a large body of independant work.
-4. Porting of freely available software.
-
-A submission in *any* of these catagories is highly welcomed as they
-are each, in their own way, quite significant to the project.
-
-
-1. An idea, suggestion or fix can be communicated in one of the following ways:
-
- o An idea or suggestion of general technical interest should be
- mailed to <hackers@freebsd.org>. Likewise, people with an interest
- in such things (and a tolerance for a HIGH volume of mail!) may
- subscribe by sendimg mail to <majordomo@freebsd.org>. See also the
- file /usr/share/FAQ/mailing-list.FAQ.
-
- o An actual bug report should be filed by using the send-pr(1)
- command (``man send-pr'' for information). This will prompt
- you for various fields to fill in. Simply go to the fields
- surrounded by <>'s and fill in your own information in place of
- what's suggested there. You should receive confirmation of your
- bug report and a tracking number (which you should also reference in
- any subsequent correspondence).
-
- If you do not receive confirmation in a timely fashion (3 days to
- a week, depending on your email connection) or are, for some
- reason, unable to use the send-pr command, then you may also
- file a bug report (or follow-up to one) by sending mail to:
-
- <bugs@freebsd.org>
-
-
-2. An addition or change to the existing source code is a somewhat trickier
- affair and depends a lot on how far out of date you are with the current
- state of the core FreeBSD development. There is a special on-going release
- of FreeBSD known as "FreeBSD-current" and made available in a variety of
- ways (see /usr/share/FAQ/current-policy.FAQ and /usr/share/FAQ/ctm.FAQ) for
- the convenience of developers who wish to actively work on the system.
-
- Working from older sources unfortunately means that your changes may
- sometimes be too obsolete to use, or too divergent to allow for easy
- re-integration. This can be minimized somewhat by subscribing to the
- <announce@freebsd.org> mailing list (among others) where periodic
- announcements concerning the current state of the system are made.
- If you see a change being proposed for which you have a better solution,
- then please, by all means come forward with your contribution and we
- will do our very best to evaluate it fairly and perhaps integrate it if
- it is indeed a better (or easier :) solution.
-
- Assuming that you can manage to secure fairly up-to-date sources to base
- your changes on, the next step is to produce a set of diffs to send to the
- FreeBSD maintainers for evaluation and possible adoption. This is done
- with the diff(1) command, with the FreeBSD maintainers preferring to receive
- diffs in `context diff' form. See the man page for diff for more details
- on producing both context and recursive context diffs
- (diff -c <oldfile> <newfile> or diff -c -r <olddir> <newdir>).
-
- Once you have a set of diffs that are capable of taking a copy of the
- original code and bringing it to a state identical to the "new" sources
- (you may test this with the patch(1) command - see patch man page), you
- should bundle them up in an email message and send it, along with a brief
- description of what the diffs are for, to <hackers@freebsd.org>. Someone
- will very likely get back in touch with you in 24 hours or less, assuming
- of course that your diffs are interesting! :-)
-
- If your changes don't express themselves well as diffs alone (e.g. you've
- perhaps added, deleted or renamed files as well) then you may be better off
- bundling any new files, diffs and instructions for deleting/renaming any
- others into a tar file and running the `uuencode' program on it before
- sending the output of that to <hackers@freebsd.org>. See the man pages
- on tar and uuencode for more info on bundling files through the mail this
- way.
-
- If your change is of a potentially sensitive nature, e.g. you're unsure
- of copyright issues governing its further distribution, or you're simply
- not ready to release it without a tighter review first, then you should
- send it to <core@freebsd.org> rather than <hackers@freebsd.org>. The core
- mailing list reaches a much smaller group of people who do much of the
- day-to-day work on FreeBSD. Note that this group is also VERY BUSY and so
- you should really only mail to them in cases where mailing to hackers
- truly is impractical.
-
-
-3. In the case of a significant contribution of a large body work, or the
- addition of an important new feature to FreeBSD, it becomes almost always
- necessary to either send changes as uuencoded tar files (see above)
- or upload them to our ftp site:
- ftp://freefall.cdrom.com/pub/FreeBSD/incoming
-
- Users may log in anonymously and upload their work or download the
- work-in-progress files left by others.
-
- When working with large amounts of code, the touchy subject of copyrights
- also invariably comes up. The view of the FreeBSD project towards
- acceptable copyrights (for code included in FreeBSD) are:
-
- 3a. Contributions under the BSD copyright (see the file
- /usr/share/examples/etc/bsd-style-copyright for a template)
- is greatly preferred due to its "no strings attached"
- nature and general attractiveness to commercial enterprises
- who might then be inclined to invest something of their own
- into FreeBSD.
-
- 3b. Contributions under the GNU Public License, or "GPL". This is
- not quite as popular a solution for us, due to (all religious
- issues aside) the amount of extra effort demanded of anyone
- using the code for commercial purposes. However, given the
- sheer quantity of GPL'd code we currently require (compiler,
- assembler, text formatter, etc), it would be silly to pretend
- that we couldn't deal with the GPL at all and so we have become
- more willing to accept code with either the BSD or the GPL
- copyright. Code under the GPL also goes into a different part
- of the tree, that being /sys/gnu or /usr/src/gnu.
-
- 3c. Contributions coming under any other type of copyright must be
- carefully reviewed before their inclusion into FreeBSD will even
- be considered. Contributions for which particularly restrictive
- commercial copyrights apply are generally rejected, though the
- authors are always free to make the changes available through
- their own channels.
-
-
-4. The porting of freely available software, while perhaps not as gratifying
- as developing your own package from scratch, is still a vital part of
- FreeBSD's growth and of great usefulness to those who wouldn't otherwise
- know where to turn for it. All ported software is organized into a
- hierarchy know as ``the ports collection''. This collection enables
- a new user to get a complete overview of what's available in a short time,
- and with a logical (we hope) framework. The ports collection also saves
- considerable space by not actually containing the the majority of the
- sources being ported. This can be confusing to the new user and the file
- /usr/share/FAQ/ports.FAQ goes some way towards explaing how it all works.
-
- If you have the ports collection on your machine, the file
- /usr/ports/GUIDELINES also helps to explain the process of creating
- and contributing a port of your own. For more information on the ports
- collection (that wasn't available in the FAQ), you may also send mail to
- <ports@freebsd.org>.
-
-
-Whichever way you decide to contribute, we hope you'll find it an enjoyable
-process and also realize how valuable your contributions are to the project!
-FreeBSD is one of those great projects where the more we all put in, the
-more we all get back out of it again, and with enough steady contributions
-it begins to aquire a momentum of its own. It is through such momentum
-that mountains are moved! :-)
-
- Jordan
diff --git a/share/FAQ/sup.FAQ b/share/FAQ/sup.FAQ
deleted file mode 100644
index c543fa0..0000000
--- a/share/FAQ/sup.FAQ
+++ /dev/null
@@ -1,90 +0,0 @@
- FreeBSD
- Sup FAQ
-
-$Id: sup.FAQ,v 1.3 1995/01/03 15:54:07 gclarkii Exp $
-
- SUP is a network based software update tool developed at CMU. The
-purpose of this document is get the beginner up and running with sup.
-
- First off you will need to pick up the sup binaries. The easiest
-way of doing this is to grab the sup.tgz package from:
-
- ftp://ftp.FreeBSD.ORG:/pub/FreeBSD/packages/sup.tgz
-
-Install the sup package using pkg_add and add the following line to
-your /etc/services file:
-
- sup 871/tcp #sup
-
-SUP gets the information it needs to run from a configuration file
-called a supfile. This file tells sup what collections it will be updating
-and/or installing and where they go. The supfile in this directory will
-sup both the source and ports collection - look for the blank line seperating
-the two collections; if you don't want ports, you can simply delete all the
-ports entries. If you're inside the United States, you may also uncomment
-the `secure' collection line to grab the DES code. If you're outside the
-U.S., you should NOT sup this code from FreeBSD.ORG as this will
-violate U.S. export restrictions. Simply sup everything *but* the secure
-collection and then go look on "braae.ru.ac.za", where it's available for
-anonymous ftp for those outside the U.S.
-
-Any other distributions you do not wish to receive can be commented out
-with a # at the begining of the distribution line.
-
-Once this is setup, you're ready to go. To start sup type:
-
- sup supfile
-
-If you wish to see what sup is doing "verbosely", give it the -v option,
-like so:
-
- sup -v supfile
-
-Thats all there is to it! Remember that if you're running current,
-which is what you will have if you sup, please join the freebsd-current
-mailing list. You should also be sure to read:
-
- ftp://ftp.FreeBSD.ORG:/pub/FreeBSD/FAQ/current-policy.FAQ
-
-For important information on just what we can and cannot do for you as
-a -current user.
-
-Gary Clark II / Jordan Hubbard
-FreeBSD maintainance persons.
-
-----
-
-Description of FreeBSD SUP distributions:
-
-base: /usr/src/... misc files at the top of /usr/src
-bin: /usr/src/bin system binaries
-secure: /usr/src/secure DES Sources. U.S./Canada only!
-etc: /usr/src/etc system files
-games: /usr/src/games games
-gnu: /usr/src/gnu sources under the GNU Public License
-include: /usr/src/include include files
-sys: /usr/src/sys kernel sources
-lib: /usr/src/lib libraries
-libexec: /usr/src/libexec more system binaries
-share: /usr/src/share various shared resources
-sbin: /usr/src/sbin even more system binaries
-usrbin: /usr/src/usr.bin user binaries
-usrsbin: /usr/src/usr.sbin that's it for the system binaries
-
-Ports:
-
-ports-base: /usr/ports/... misc files at the top of /usr/ports
-ports-editors: /usr/ports/editors text editors
-ports-game: /usr/ports/games games
-ports-lang: /usr/ports/lang programming languages
-ports-mail: /usr/ports/mail mail software
-ports-math: /usr/ports/math math software
-ports-net: /usr/ports/net networking software
-ports-news: /usr/ports/news USENET news software
-ports-print: /usr/ports/print printing software
-ports-shells: /usr/ports/shells various UN*X shells
-ports-utils: /usr/ports/utils miscellaneous utilities
-ports-x11: /usr/ports/x11 X11 software
-
-
-
diff --git a/share/FAQ/systems.FAQ b/share/FAQ/systems.FAQ
deleted file mode 100644
index dd0ac4f..0000000
--- a/share/FAQ/systems.FAQ
+++ /dev/null
@@ -1,59 +0,0 @@
-
- Systems FAQ
- for FreeBSD 2.0
-
-This FAQ lists systems (and componets) known to work with FreeBSD 2.0. None
-of these lists should be seen as a recomandation for a manufacture.
-
-$Id: systems.FAQ,v 1.1 1995/01/03 15:48:39 gclarkii Exp $
-
-
-i386:
-
-
-Motherboard: Magitronics 386DX-40
-CPU: i386DX-40
-Busses: ISA and VLB (VLB not tested)
-Ram: 20 Megs
-Video: Generic 1MB Tseng 4000 (ISA)
-Disks:
- 2 - Segate ST1126 (SCSI)
- 1 - Seagate ST1480 (SCSI)
- 1 - Toshiba MK-234FC-C (IDE)
-Controllers:
- Generic IDE
- Adaptec AH-1542CF
-
-Motherboard: Magitronics 386SX-40
-CPU: i386SX-40
-Busses: ISA
-Ram: 4 Megs
-Video: Monochrome
-Disks:
- 1-Seagate ST1126 (SCSI)
-Controllers:
- Future Domain 850
-Notes: Slow but useable
-
-i486:
-
-Motherboard: Gateway 2000 Handbook 486 HB486DX2-40
-CPU: i486SL DX2/40
-BUS(S): PCMCIA, one type II
-Video Card: Monochrome VGA.
-Are you running X on this?: no, havn't really tried.
-Types of Disks (manufacture and bus): 130Mb builtin. <Areal A130 U>
-If you wish to be credited: Poul-Henning Kamp phk@freefall.cdrom.com
-
-NOTES:
-This is a 3 pound portable. Runs perfect. Suspend works great. Has one
-serial and one parallel/floppy port, which can drive either a floppy or
-a parallel port, but not at the same time. Builtin "EZ" mouse-thinge.
-Highly recommended for people on the road.
-
-
-Credits:
- FreeBSD Core Team
- Gary Clark II
- Poul-Henning Kamp
-
diff --git a/share/FAQ/tutorials.html b/share/FAQ/tutorials.html
deleted file mode 100644
index 9a260af..0000000
--- a/share/FAQ/tutorials.html
+++ /dev/null
@@ -1,109 +0,0 @@
-<!-- $Id:$ -->
-
-<!DOCTYPE html PUBLIC '-//IETF//DTD HTML 2.0//EN'>
-<html>
- <head>
- <title>FreeBSD Tutorials</title>
- </head>
- <body>
-<h1>FreeBSD Tutorials</h1>
-<hr>
-
- <p>This page contains tutorials on topics that the short
- answer format of the main <a
- href="HTML/freebsd-faq.html">FAQ</a> cannot do justice to.
- If you have a particular area of expertise, we would like
- to here from you! Your contributions are not only welcome,
- but often save new users from uncountable headaches. If
- you've written something you think may help new users, by
- all means let us know about it by sending mail to <a
- href="mailto:doc@freebsd.org">doc@FreeBSD.ORG</a>.
-
-<h2>Installation Topics</h2>
-
- <ul>
-
- <li><a href = "Text/INSTALL">How to install a distribution.</a>
-
- <li><a href="Text/diskspace.FAQ">All about hard disk partitioning.</a>
-
- </ul>
-
-<h2>Networking topics</h2>
-
-<ul>
- <li><a href="HTML/dialup.html">Setting up FreeBSD for
- dialin access.</a></li>
-
- <li><a href="Text/slip.FAQ">Setting up FreeBSD as a SLIP
- <em>client</em>.</a>
-
- <li><a href="HTML/slip_server.html">Setting up FreeBSD as a SLIP
- <em>server</em>.</a>
-
- <li><a href="Text/ppp.FAQ">How to configure PPP.</a>
-
- <li><a href="Text/nfs.FAQ">Tips for users using NFS between
- FreeBSD and workstation hardware.</a>
-
- <li><a href="Text/diskless.FAQ">Setting up a diskless FreeBSD
- workstation.</a>
-
- <li><a href="LaTeX/kerberos_setup.latex">Setting up Kerberos</a>
- (this is a LaTeX document)
-
- <li><a href="Text/UUCP_Internals.FAQ">UUCP internals</a>
-
- </ul>
-
-
-<h2>FreeBSD-current topics</h2>
-
-<ul>
- <li><a href="Text/current-policy.FAQ">What you should know about running
- FreeBSD-current.</a>
-
- <li><a href="HTML/ctm.html">All about CTM</a>.
-
- <li><a href="Text/sup.FAQ">All about sup</a>.
-
- <li><a href="extras/ports-supfile">A sample supfile for the FreeBSD ports
- collection.</a>
-
- <li><a href="extras/standard-supfile">A sample supfile for the
- FreeBSD source tree.</a>
-
-</ul>
-
-<h2>Hardware topics</h2>
-
-<ul>
- <li><a href="Text/systems.FAQ">Systems and configurations
- on which FreeBSD is "known" to work.</a>
-
- <li><a href="Text/HW.TROUBLE">User feedback on finicky or broken
- hardware.</a>
-
- <li><a href="HTML/SCSI.html">Using SCSI devices with FreeBSD</a>.
-
-</ul>
-
-<h2>Miscellaneous</h2>
-<ul>
- <li><a href="Text/kernel-debug.FAQ">How to debug the kernel.</a>
- </li>
-
- <li><a href="Text/ports.FAQ">Using the FreeBSD "ports"
- collection</a></li>
-
- <li><a href="Text/submitters.FAQ">Becoming a contributor to
- the FreeBSD project</a></li>
-
- </ul>
-
-
-<hr>
-<a href="index.html">Return to the help page</a>
-
- </body>
-</html>
diff --git a/share/examples/etc/aliases b/share/examples/etc/aliases
deleted file mode 100644
index 0b5ed72..0000000
--- a/share/examples/etc/aliases
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# @(#)aliases 5.3 (Berkeley) 5/24/90
-#
-# Aliases in this file will NOT be expanded in the header from
-# Mail, but WILL be visible over networks or from /bin/mail.
-#
-# >>>>>>>>>> The program "newaliases" must be run after
-# >> NOTE >> this file is updated for any changes to
-# >>>>>>>>>> show through to sendmail.
-#
-
-# Basic system aliases -- these MUST be present
-MAILER-DAEMON: postmaster
-postmaster: root
-
-# General redirections for pseudo accounts
-bin: root
-daemon: root
-games: root
-ingres: root
-nobody: root
-system: root
-toor: root
-uucp: root
-
-# Well-known aliases -- these should be filled in!
-# root:
-# manager:
-# dumper:
-# operator:
diff --git a/share/examples/etc/csh.cshrc b/share/examples/etc/csh.cshrc
deleted file mode 100644
index 4a3bf3f..0000000
--- a/share/examples/etc/csh.cshrc
+++ /dev/null
@@ -1 +0,0 @@
-# System-wide .cshrc file for csh(1).
diff --git a/share/examples/etc/csh.login b/share/examples/etc/csh.login
deleted file mode 100644
index 6ab227a..0000000
--- a/share/examples/etc/csh.login
+++ /dev/null
@@ -1,7 +0,0 @@
-# System-wide .login file for csh(1).
-# Uncomment this to give you the default 4.2 behavior, where disk
-# information is shown in K-Blocks
-# setenv BLOCKSIZE K
-# Uncomment next lines, if you want to setup your locale (russian example)
-# setenv ENABLE_STARTUP_LOCALE
-# setenv LANG ru_SU.KOI8-R
diff --git a/share/examples/etc/csh.logout b/share/examples/etc/csh.logout
deleted file mode 100644
index f8601c0..0000000
--- a/share/examples/etc/csh.logout
+++ /dev/null
@@ -1 +0,0 @@
-# System-wide .logout file for csh(1).
diff --git a/share/examples/etc/dm.conf b/share/examples/etc/dm.conf
deleted file mode 100644
index 48c24de..0000000
--- a/share/examples/etc/dm.conf
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Game Control File
-# @(#)dm.conf 5.5 (Berkeley) 4/12/89
-#
-
-# TTYNAME
-# badtty /dev/tty19 # news
-# badtty /dev/tty20 # news/mail
-
-# DAY OF WEEK START STOP
-# time Monday 7 16 # 7am to 4pm
-# time Tuesday 7 16
-# time Wednesday 7 16
-# time Thursday 7 16
-# time Friday 7 16
-
-# GAME MAX LOAD MAX USERS PRIORITY
-# default must be the last entry for the ``game'' keyword
-game default 5 * *
diff --git a/share/examples/etc/fbtab b/share/examples/etc/fbtab
deleted file mode 100644
index c1bf054..0000000
--- a/share/examples/etc/fbtab
+++ /dev/null
@@ -1,2 +0,0 @@
-#/dev/ttyv0 0600 /dev/console
-#/dev/ttyv0 0600 /dev/pcaudio:/dev/pcaudioctl
diff --git a/share/examples/etc/ftpusers b/share/examples/etc/ftpusers
deleted file mode 100644
index d23c64a..0000000
--- a/share/examples/etc/ftpusers
+++ /dev/null
@@ -1,4 +0,0 @@
-# list of users disallowed any ftp access.
-# read by ftpd(8).
-root
-uucp
diff --git a/share/examples/etc/gettytab b/share/examples/etc/gettytab
deleted file mode 100644
index c0ac99a..0000000
--- a/share/examples/etc/gettytab
+++ /dev/null
@@ -1,173 +0,0 @@
-# from: @(#)gettytab 5.14 (Berkeley) 3/27/91
-#
-# Most of the table entries here are just copies of the old getty table,
-# it is by no means certain, or even likely, that any of them are optimal
-# for any purpose whatever. Nor is it likely that more than a couple are
-# even correct.
-#
-# The default gettytab entry, used to set defaults for all other
-# entries, and in cases where getty is called with no table name
-#
-# cb, ce and ck are desirable on most crt's. The non-crt entries need to
-# be changed to turn them off (cb@:ce@:ck@:).
-#
-# Parity defaults to even. There ought to be more alternative entries with
-# no parity. The Pc entry already has no parity.. The different parities
-# are:
-# (none): same as even except -inpck instead of inpck for login.
-# ep: getty will use raw mode (cs8 -parenb) (unless rw is set) and
-# fake parity. login will use even parity (cs7 parenb -parodd).
-# op: same as ep except odd parity (cs7 parenb parodd) for login.
-# op overrides ep.
-# ap: same as ep except -inpck instead of inpck for login.
-# ap overrides op and ep.
-# np: 1. don't fake parity in getty. The fake parity garbles
-# characters on non-terminals (like pccons) that don't
-# support parity. It would probably better for getty not to
-# try to fake parity. It could just use cbreak mode so as
-# as not to force cs8 and let the hardware handle the parity.
-# login has to be rely on the hardware anyway.
-# 2. set PASS8, giving cs8 -parenb -istrip -inpck.
-# np:ep: same as np except inpck.
-# np:op: same as np:ep except for parodd (but parodd is overridden).
-# np:ap: same as np except istrip.
-#
-default:\
- :cb:ce:ck:fd#1000:im=\r\n FreeBSD (%h) (%t)\r\n\r\n:sp#1200:
-
-#
-# Fixed speed entries
-#
-# The "std.NNN" names are known to the special case
-# portselector code in getty, however they can
-# be assigned to any table desired.
-# The "NNN-baud" names are known to the special case
-# autobaud code in getty, and likewise can
-# be assigned to any table desired (hopefully the same speed).
-#
-a|std.110|110-baud:\
- :np:nd#1:cd#1:uc:sp#110:
-b|std.134|134.5-baud:\
- :np:nd#1:cd#2:ff#1:td#1:sp#134:ht:nl:
-1|std.150|150-baud:\
- :np:nd#1:cd#2:td#1:fd#1:sp#150:ht:nl:lm=\E\72\6\6\17login\72 :
-c|std.300|300-baud:\
- :np:nd#1:cd#1:sp#300:
-d|std.600|600-baud:\
- :np:nd#1:cd#1:sp#600:
-f|std.1200|1200-baud:\
- :np:fd#1:sp#1200:
-6|std.2400|2400-baud:\
- :np:sp#2400:
-7|std.4800|4800-baud:\
- :np:sp#4800:
-2|std.9600|9600-baud:\
- :np:sp#9600:
-g|std.19200|19200-baud:\
- :np:sp#19200:
-std.38400|38400-baud:\
- :np:sp#38400:
-std.57600|57600-baud:\
- :np:sp#57600:
-std.115200|115200-baud:\
- :np:sp#115200:
-
-#
-# Dial in rotary tables, speed selection via 'break'
-#
-0|d300|Dial-300:\
- :nx=d1200:cd#2:sp#300:
-d1200|Dial-1200:\
- :nx=d150:fd#1:sp#1200:
-d150|Dial-150:\
- :nx=d110:lm@:tc=150-baud:
-d110|Dial-110:\
- :nx=d300:tc=300-baud:
-
-#
-# Fast dialup terminals, 2400/1200/300 rotary (can start either way)
-#
-D2400|d2400|Fast-Dial-2400:\
- :nx=D1200:tc=2400-baud:
-3|D1200|Fast-Dial-1200:\
- :nx=D300:tc=1200-baud:
-5|D300|Fast-Dial-300:\
- :nx=D2400:tc=300-baud:
-
-#
-#telebit (19200)
-#
-t19200:\
- :nx=t2400:tc=19200-baud:
-t2400:\
- :nx=t1200:tc=2400-baud:
-t1200:\
- :nx=t19200:tc=1200-baud:
-
-#
-#telebit (9600)
-#
-t9600:\
- :nx=t2400a:tc=9600-baud:
-t2400a:\
- :nx=t1200a:tc=2400-baud:
-t1200a:\
- :nx=t9600:tc=1200-baud:
-
-#
-# Odd special case terminals
-#
--|tty33|asr33|Pity the poor user of this beast:\
- :tc=110-baud:
-
-4|Console|Console Decwriter II:\
- :nd@:cd@:rw:tc=300-baud:
-
-e|Console-1200|Console Decwriter III:\
- :fd@:nd@:cd@:rw:tc=1200-baud:
-
-i|Interdata console:\
- :uc:sp#0:
-
-l|lsi chess terminal:\
- :sp#300:
-
-X|Xwindow|X window system:\
- :fd@:nd@:cd@:rw:sp#9600:
-
-P|Pc|Pc console:\
- :ht:np:sp#115200:
-
-#
-# Wierdo special case for fast crt's with hardcopy devices
-#
-8|T9600|CRT with hardcopy:\
- :nx=T300:tc=9600-baud:
-9|T300|CRT with hardcopy (300):\
- :nx=T9600:tc=300-baud:
-
-#
-# Plugboard, and misc other terminals
-#
-plug-9600|Plugboard-9600:\
- :pf#1:tc=9600-baud:
-p|P9600|Plugboard-9600-rotary:\
- :pf#1:nx=P300:tc=9600-baud:
-q|P300|Plugboard-300:\
- :pf#1:nx=P1200:tc=300-baud:
-r|P1200|Plugboard-1200:\
- :pf#1:nx=P9600:tc=1200-baud:
-
-#
-# XXXX Port selector
-#
-s|DSW|Port Selector:\
- :ps:sp#2400:
-
-#
-# Auto-baud speed detect entry for Micom 600.
-# Special code in getty will switch this out
-# to one of the NNN-baud entries.
-#
-A|Auto-baud:\
- :ab:sp#2400:f0#040:
diff --git a/share/examples/etc/group b/share/examples/etc/group
deleted file mode 100644
index 2bd4805..0000000
--- a/share/examples/etc/group
+++ /dev/null
@@ -1,17 +0,0 @@
-wheel:*:0:root
-daemon:*:1:daemon
-kmem:*:2:root
-sys:*:3:root
-tty:*:4:root
-operator:*:5:root
-bin:*:7:
-news:*:8:
-man:*:9:
-games:*:13:
-staff:*:20:root
-guest:*:31:root
-nobody:*:39:
-uucp:*:66:
-ingres:*:74:ingres
-dialer:*:117:
-nogroup:*:32766:
diff --git a/share/examples/etc/host.conf b/share/examples/etc/host.conf
deleted file mode 100644
index 4c82560..0000000
--- a/share/examples/etc/host.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-# $Id: host.conf,v 1.2 1993/11/07 01:02:57 wollman Exp $
-# Default is to use the nameserver first
-bind
-# If that doesn't work, then try the /etc/hosts file
-hosts
-# If you have YP/NIS configured, uncomment the next line
-# nis
diff --git a/share/examples/etc/hosts b/share/examples/etc/hosts
deleted file mode 100644
index 6528805..0000000
--- a/share/examples/etc/hosts
+++ /dev/null
@@ -1,28 +0,0 @@
-# $Id: hosts,v 1.4 1994/06/24 23:50:16 wollman Exp $
-#
-# Host Database
-# This file should contain the addresses and aliases
-# for local hosts that share this file.
-# In the presence of the domain name service or NIS, this file may
-# not be consulted at all; see /etc/host.conf for the resolution order.
-#
-#
-127.0.0.1 localhost localhost.my.domain
-#
-# Imaginary network.
-#10.0.0.2 myname.my.domain myname
-#10.0.0.3 myfriend.my.domain myfriend
-#
-# According to RFC 1597, you can use the following IP networks for
-# private nets which will never be connected to the Internet:
-#
-# 10.0.0.0 - 10.255.255.255
-# 172.16.0.0 - 172.31.255.255
-# 192.168.0.0 - 192.168.255.255
-#
-# In case you want to be able to connect to the Internet, you need
-# real official assigned numbers. PLEASE PLEASE PLEASE do not try
-# to invent your own network numbers but instead get one from your
-# network provider (if any) or from the Internet Registry (ftp to
-# rs.internic.net, directory `/templates').
-#
diff --git a/share/examples/etc/hosts.equiv b/share/examples/etc/hosts.equiv
deleted file mode 100644
index f6efd09..0000000
--- a/share/examples/etc/hosts.equiv
+++ /dev/null
@@ -1,2 +0,0 @@
-localhost
-my_very_good_friend.domain
diff --git a/share/examples/etc/hosts.lpd b/share/examples/etc/hosts.lpd
deleted file mode 100644
index 1be6dad..0000000
--- a/share/examples/etc/hosts.lpd
+++ /dev/null
@@ -1 +0,0 @@
-machine.domain
diff --git a/share/examples/etc/inetd.conf b/share/examples/etc/inetd.conf
deleted file mode 100644
index 127fe26..0000000
--- a/share/examples/etc/inetd.conf
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Internet server configuration database
-#
-# @(#)inetd.conf 5.4 (Berkeley) 6/30/90
-#
-ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l
-telnet stream tcp nowait root /usr/libexec/telnetd telnetd
-shell stream tcp nowait root /usr/libexec/rshd rshd
-login stream tcp nowait root /usr/libexec/rlogind rlogind
-exec stream tcp nowait root /usr/libexec/rexecd rexecd
-#uucpd stream tcp nowait root /usr/libexec/uucpd uucpd
-#nntp stream tcp nowait usenet /usr/libexec/nntpd nntpd
-finger stream tcp nowait nobody /usr/libexec/fingerd fingerd
-#tftp dgram udp wait nobody /usr/libexec/tftpd tftpd
-comsat dgram udp wait root /usr/libexec/comsat comsat
-#talk dgram udp wait root /usr/old/talkd talkd
-ntalk dgram udp wait root /usr/libexec/ntalkd ntalkd
-echo stream tcp nowait root internal
-discard stream tcp nowait root internal
-chargen stream tcp nowait root internal
-daytime stream tcp nowait root internal
-time stream tcp nowait root internal
-echo dgram udp wait root internal
-discard dgram udp wait root internal
-chargen dgram udp wait root internal
-daytime dgram udp wait root internal
-time dgram udp wait root internal
-# Kerberos authenticated services
-klogin stream tcp nowait root /usr/libexec/rlogind rlogind -k
-eklogin stream tcp nowait root /usr/libexec/rlogind rlogind -k -x
-kshell stream tcp nowait root /usr/libexec/rshd rshd -k
-# Services run ONLY on the Kerberos server
-# Neither of these work in FreeBSD 1.x.
-#krbupdate stream tcp nowait root /usr/libexec/registerd registerd
-#kpasswd stream tcp nowait root /usr/libexec/kpasswdd kpasswdd
-#
-# RPC based services
-# You MUST have portmapper running to use these!
-#rstatd/1-3 dgram rpc/udp wait root /usr/libexec/rpc.rstatd rpc.rstatd
-#rusersd/1-2 dgram rpc/udp wait root /usr/libexec/rpc.rusersd rpc.rusersd
-#walld/1 dgram rpc/udp wait root /usr/libexec/rpc.rwalld rpc.rwalld
-#
-# example entry for the pop3 server
-#pop3 stream tcp nowait root /usr/local/etc/popper popper
-#
diff --git a/share/examples/etc/login.access b/share/examples/etc/login.access
deleted file mode 100644
index 5cf5454..0000000
--- a/share/examples/etc/login.access
+++ /dev/null
@@ -1,44 +0,0 @@
-# Login access control table.
-#
-# When someone logs in, the table is scanned for the first entry that
-# matches the (user, host) combination, or, in case of non-networked
-# logins, the first entry that matches the (user, tty) combination. The
-# permissions field of that table entry determines whether the login will
-# be accepted or refused.
-#
-# Format of the login access control table is three fields separated by a
-# ":" character:
-#
-# permission : users : origins
-#
-# The first field should be a "+" (access granted) or "-" (access denied)
-# character. The second field should be a list of one or more login names,
-# group names, or ALL (always matches). The third field should be a list
-# of one or more tty names (for non-networked logins), host names, domain
-# names (begin with "."), host addresses, internet network numbers (end
-# with "."), ALL (always matches) or LOCAL (matches any string that does
-# not contain a "." character). If you run NIS you can use @netgroupname
-# in host or user patterns.
-#
-# The EXCEPT operator makes it possible to write very compact rules.
-#
-# The group file is searched only when a name does not match that of the
-# logged-in user. Only groups are matched in which users are explicitly
-# listed: the program does not look at a user's primary group id value.
-#
-##############################################################################
-#
-# Disallow console logins to all but a few accounts.
-#
-#-:ALL EXCEPT wheel shutdown sync:console
-#
-# Disallow non-local logins to privileged accounts (group wheel).
-#
-#-:wheel:ALL EXCEPT LOCAL .win.tue.nl
-#
-# Some accounts are not allowed to login from anywhere:
-#
-#-:wsbscaro wsbsecr wsbspac wsbsym wscosor wstaiwde:ALL
-#
-# All other accounts are allowed to login from anywhere.
-#
diff --git a/share/examples/etc/manpath.config b/share/examples/etc/manpath.config
deleted file mode 100644
index 37d3380..0000000
--- a/share/examples/etc/manpath.config
+++ /dev/null
@@ -1,31 +0,0 @@
-# manpath.config
-#
-# This file is read by manpath to configure the mandatory manpath, to
-# map each path element to a manpath element and to determine where the
-# "man" binary lives. The format is:
-#
-# MANBIN pathname
-# MANDATORY_MANPATH manpath_element
-# MANPATH_MAP path_element manpath_element
-#
-# MANBIN is optional
-#
-#MANBIN /usr/bin/man
-#
-# every automatically generated MANPATH includes these fields
-#
-MANDATORY_MANPATH /usr/share/man
-MANDATORY_MANPATH /usr/local/man
-MANDATORY_MANPATH /usr/X386/man
-#MANDATORY_MANPATH /usr/X11R6/man
-
-#
-# set up PATH to MANPATH mapping
-#
-MANPATH_MAP /bin /usr/share/man
-MANPATH_MAP /usr/bin /usr/share/man
-MANPATH_MAP /usr/ucb /usr/share/man
-MANPATH_MAP /usr/local/mh /usr/local/mh/man
-MANPATH_MAP /usr/local/bin /usr/local/man
-MANPATH_MAP /usr/X386/bin /usr/X386/man
-#MANPATH_MAP /usr/X11R6/bin /usr/X11R6/man
diff --git a/share/examples/etc/motd b/share/examples/etc/motd
deleted file mode 100644
index 776706f..0000000
--- a/share/examples/etc/motd
+++ /dev/null
@@ -1,4 +0,0 @@
-FreeBSD ?.?.? (UNKNOWN)
-
-Welcome to FreeBSD!
-
diff --git a/share/examples/etc/myname b/share/examples/etc/myname
deleted file mode 100644
index a0d6cce..0000000
--- a/share/examples/etc/myname
+++ /dev/null
@@ -1 +0,0 @@
-myname.my.domain
diff --git a/share/examples/etc/netstart b/share/examples/etc/netstart
deleted file mode 100644
index dc1187f..0000000
--- a/share/examples/etc/netstart
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh -
-#
-# $Id: netstart,v 1.13 1994/09/15 01:19:43 phk Exp $
-# From: @(#)netstart 5.9 (Berkeley) 3/30/91
-
-defaultrouter=NO
-routedflags=-q
-timedflags=NO
-xntpdflags="NO"
-ntpdate="NO"
-rwhod=NO
-sendmail_flags="-bd -q30m"
-#kerberos_server=YES
-#nfs_server=YES
-#name_server=YES
-#gated=YES
-
-# my-name is my symbolic name
-# my-netmask is specified in /etc/networks
-#
-hostname=`cat /etc/myname`
-hostname $hostname
-
-for i in /etc/hostname.*
-do
- ifn=`expr $i : '/etc/hostname\.\(.*\)'`
- if [ -e /etc/hostname.$ifn ]; then
- if [ -e /etc/start_if.$ifn ]; then
- sh /etc/start_if.$ifn $ifn
- fi
- ifconfig $ifn `cat /etc/hostname.$ifn`
- ifconfig $ifn
- fi
-done
-
-# set the address for the loopback interface
-ifconfig lo0 inet localhost
-
-if [ -n "$defaultrouter" -a "x$defaultrouter" != "xNO" ] ; then
- route add default $defaultrouter
-elif [ -f /etc/defaultrouter ] ; then
- route add default `cat /etc/defaultrouter`
-fi
-
-# use loopback, not the wire
-# route add $hostname localhost
diff --git a/share/examples/etc/networks b/share/examples/etc/networks
deleted file mode 100644
index 71aeb5b..0000000
--- a/share/examples/etc/networks
+++ /dev/null
@@ -1,16 +0,0 @@
-# @(#)networks 5.1 (Berkeley) 6/30/90
-#
-# Your Local Networks Database
-#
-your-net 127 # your comment
-your-netmask 255.255.255 # subnet mask for your-net
-
-#
-# Your subnets
-#
-subnet1 127.0.1 alias1 # comment 1
-subnet2 127.0.2 alias2 # comment 2
-
-#
-# Internet networks (from nic.ddn.mil)
-#
diff --git a/share/examples/etc/phones b/share/examples/etc/phones
deleted file mode 100644
index c6ab472..0000000
--- a/share/examples/etc/phones
+++ /dev/null
@@ -1,12 +0,0 @@
-# $Id: phones,v 1.4 1994/01/24 00:39:01 rgrimes Exp $
-# From: @(#)phones 5.2 (Berkeley) 6/30/90
-#
-# phones -- remote host phone number data base
-# see tip(1), phones(5)
-# [tip cannot currently accept comments in this file,
-# so this and the above lines must be removed.]
-system1 9=3156427750
-system2 9148841241
-netcom 1(408)241-9760
-netcom 1(415)328-9940
-omen 1(503)621-3746
diff --git a/share/examples/etc/printcap b/share/examples/etc/printcap
deleted file mode 100644
index 06791f8..0000000
--- a/share/examples/etc/printcap
+++ /dev/null
@@ -1,4 +0,0 @@
-# @(#)printcap 5.3 (Berkeley) 6/30/90
-
-#lp|local line printer:\
-# :lp=/dev/lp:sd=/var/spool/lpd:lf=/var/log/lpd-errs:
diff --git a/share/examples/etc/protocols b/share/examples/etc/protocols
deleted file mode 100644
index 1b9129c..0000000
--- a/share/examples/etc/protocols
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Internet (IP) protocols
-#
-# $Id: protocols,v 1.2 1993/11/07 00:31:22 wollman Exp $
-# from: @(#)protocols 5.1 (Berkeley) 4/17/89
-#
-# Updated for FreeBSD based on RFC 1340, Assigned Numbers (July 1992).
-#
-ip 0 IP # internet protocol, pseudo protocol number
-icmp 1 ICMP # internet control message protocol
-igmp 2 IGMP # Internet Group Management
-ggp 3 GGP # gateway-gateway protocol
-ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'')
-st 5 ST # ST datagram mode
-tcp 6 TCP # transmission control protocol
-egp 8 EGP # exterior gateway protocol
-pup 12 PUP # PARC universal packet protocol
-udp 17 UDP # user datagram protocol
-hmp 20 HMP # host monitoring protocol
-xns-idp 22 XNS-IDP # Xerox NS IDP
-rdp 27 RDP # "reliable datagram" protocol
-iso-tp4 29 ISO-TP4 # ISO Transport Protocol class 4
-xtp 36 XTP # Xpress Tranfer Protocol
-idpr-cmtp 39 IDPR-CMTP # IDPR Control Message Transport
-vmtp 81 VMTP # Versatile Message Transport
-ospf 89 OSPFIGP # Open Shortest Path First IGP
-ipip 94 IPIP # Yet Another IP encapsulation
-encap 98 ENCAP # Yet Another IP encapsulation
diff --git a/share/examples/etc/rc b/share/examples/etc/rc
deleted file mode 100644
index a1eb9ed..0000000
--- a/share/examples/etc/rc
+++ /dev/null
@@ -1,242 +0,0 @@
-#!/bin/sh
-# $Id: rc,v 1.1 1994/09/19 21:28:18 wollman Exp $
-# From: @(#)rc 5.27 (Berkeley) 6/5/91
-
-# System startup script run by init on autoboot
-# or after single-user.
-# Output and error are redirected to console by init,
-# and the console is the controlling terminal.
-
-stty status '^T'
-
-# Set shell to ignore SIGINT (2), but not children;
-# shell catches SIGQUIT (3) and returns to single user after fsck.
-trap : 2
-trap : 3 # shouldn't be needed
-
-HOME=/; export HOME
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-export PATH
-
-if [ $1x = autobootx ]
-then
- echo Automatic reboot in progress...
- fsck -p
- case $? in
- 0)
- ;;
- 2)
- exit 1
- ;;
- 4)
- reboot
- echo "reboot failed... help!"
- exit 1
- ;;
- 8)
- echo "Automatic file system check failed... help!"
- exit 1
- ;;
- 12)
- echo "Reboot interrupted"
- exit 1
- ;;
- 130)
- # interrupt before catcher installed
- exit 1
- ;;
- *)
- echo "Unknown error in reboot"
- exit 1
- ;;
- esac
-else
- echo Skipping disk checks ...
-fi
-
-trap "echo 'Reboot interrupted'; exit 1" 3
-
-swapon -a
-
-# Check for diskless boot, and remount the root RW.
-a=`mount`
-if [ 0 != `expr "$a" : '^[^/]*:/.* on /'` ] ; then
- mount -u -o rw /
-fi
-
-umount -a >/dev/null 2>&1
-mount -a -t nonfs
-
-# If the machine runs wall CMOS clock (compatible with MSDOS),
-# activate following line by creating empty file /etc/wall_cmos_clock
-# If this file not exist, following line does nothing (assumed
-# the machine runs UTC CMOS clock). See adjkerntz(8) for details.
-adjkerntz -i
-
-# configure serial devices
-if [ -f /etc/rc.serial ]
-then
- sh /etc/rc.serial
-fi
-
-# set hostname, turn on network
-echo 'starting network'
-. /etc/netstart
-
-# clean up left-over files
-rm -f /etc/nologin
-rm -f /var/spool/lock/*
-rm -f /var/spool/uucp/.Temp/*
-(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; })
-
-echo -n 'starting system logger'
-rm -f /dev/log
-syslogd
-
-# $timedflags is imported from /etc/netstart;
-# if $timedflags == NO, timed isn't run.
-if [ X${timedflags} != X"NO" ]; then
- echo -n ', time daemon'; timed $timedflags
-fi
-echo '.'
-
-# /var/crash should be a directory or a symbolic link
-# to the crash directory if core dumps are to be saved.
-if [ -d /var/crash ]; then
- echo checking for core dump...
- savecore /var/crash
-fi
-
-# echo -n 'checking quotas:'
-#quotacheck -a
-# echo ' done.'
-#quotaon -a
-
-# build ps databases
-kvm_mkdb /kernel
-dev_mkdb
-
-chmod 666 /dev/tty[pqrs]*
-
-# check the password temp/lock file
-if [ -f /etc/ptmp ]
-then
- logger -s -p auth.err \
- 'password file may be incorrect -- /etc/ptmp exists'
-fi
-
-# Recover elvis editor files.
-echo preserving editor files
-(cd /var/tmp && /usr/libexec/elvispreserve "-the system rebooted" elv* &&
- rm -f elvis[0-9a-f][0-9a-f][0-9a-f][0-9a-f]* \
- elvis_[0-9a-f][0-9a-f][0-9a-f][0-9a-f]*)
-
-# Recover vi editor files.
-virecovery=/var/tmp/vi.recover/recover.*
-if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then
- echo 'Recovering vi editor sessions'
- for i in $virecovery; do
- sendmail -t < $i
- done
-fi
-
-echo clearing /tmp
-
-# prune quickly with one rm, then use find to clean up /tmp/[lq]*
-# (not needed with mfs /tmp, but doesn't hurt there...)
-(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
- find -d . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;)
-
-# echo 'turning on accounting'; accton /var/account/acct
-
-echo -n standard daemons:
-echo -n ' cron'; cron
-echo '.'
-
-echo -n starting network daemons:
-
-# Portmapper should always be run, to provide RPC services for inetd.
-if [ -x /usr/sbin/portmap ]; then
- echo -n ' portmap'; portmap
-fi
-
-# $gated and $routedflags are imported from /etc/netstart.
-# If $gated == YES, gated is used; otherwise routed.
-# If $routedflags == NO, routed isn't run.
-if [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then
- echo -n ' gated'; gated $gatedflags
-elif [ X"${routedflags}" != X"NO" ]; then
- echo -n ' routed'; routed $routedflags
-fi
-
-if [ X${name_server} = X"YES" -a -r /etc/named.boot ]; then
- echo -n ' named'; named
-fi
-
-# $ntpdate and $xntpdflags are imported from /etc/netstart.
-# If $ntpdate != NO, run ntpdate $ntpdate to set the date correctly.
-# If $xntpdflags != NO, start xntpd.
-if [ X"${ntpdate}" != X"NO" ]; then
- echo ' ntpdate'; ntpdate $ntpdate
-fi
-
-if [ X"${xntpdflags}" != X"NO" ]; then
- if [ X"${tickadjflags}" != X"NO" ]; then
- echo 'adjusting kernel for xntpd'; tickadj ${tickadjflags--A}
- fi
- echo 'starting xntpd'; xntpd ${xntpdflags}
-fi
-
-if [ X"${ntpdate}" != X"NO" -o X"${xntpdflags}" != X"NO" ]; then
- echo -n 'starting more network daemons:'
-fi
-
-# $rwhod is imported from /etc/netstart;
-# if $rwhod is set to something other than NO, rwhod is run.
-if [ ${rwhod-NO} != "NO" ]; then
- echo -n ' rwhod'; rwhod
-fi
-
-echo -n ' printer'; lpd
-
-if [ X${nfs_server} = X"YES" -a -r /etc/exports ]; then
- echo -n ' mountd'; mountd
- echo -n ' nfsd'; nfsd -u -t 4
-fi
-
-if grep nfs /etc/fstab > /dev/null ; then
- echo -n ' nfsiod'; nfsiod -n 4
-fi
-
-# $sendmail_flags is imported from /etc/netstart;
-# if $sendmail_flags is something other than NO, sendmail is run.
-if [ X"${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then
- echo -n ' sendmail'; sendmail ${sendmail_flags}
-fi
-
-echo -n ' inetd'; inetd
-echo '.'
-
-mount -a -t nfs >/dev/null 2>&1 & # XXX shouldn't need background
-
-# if [ -x /usr/libexec/xtend ]; then
-# echo -n ' xtend'; /usr/libexec/xtend
-# fi
-
-# Make shared lib searching a little faster. Leave /usr/lib first if you
-# add your own entries or you may come to grief.
-if [ -x /sbin/ldconfig ]; then
- _LDC=/usr/lib
- if [ -d /usr/X11R6/lib ]; then _LDC="${_LDC} /usr/X11R6/lib" ; fi
- if [ -d /usr/X386/lib ]; then _LDC="${_LDC} /usr/X386/lib" ; fi
- if [ -d /usr/local/lib ]; then _LDC="${_LDC} /usr/local/lib" ; fi
- if [ -d /usr/gnu/lib ]; then _LDC="${_LDC} /usr/gnu/lib" ; fi
- echo 'setting ldconfig path:' ${_LDC}
- ldconfig ${_LDC}
-fi
-
-sh /etc/rc.local
-
-date
-
-exit 0
diff --git a/share/examples/etc/rc.local b/share/examples/etc/rc.local
deleted file mode 100644
index 8f74b38..0000000
--- a/share/examples/etc/rc.local
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# site-specific startup actions, daemons
-#
-# @(#)rc.local 5.4 (Berkeley) 12/14/90
-#
-
-T=/tmp/_motd
-rm -f $T
-uname -rs > $T
-echo "" >> $T
-sed '1,/^$/d' < /etc/motd >> $T
-cp $T /etc/motd
-chmod 644 /etc/motd
-rm -f $T
-
-echo -n 'starting local daemons:'
-
-# Kerberos runs ONLY on the Kerberos server machine
-if [ X${kerberos_server} = X"YES" ]; then
- echo -n ' kerberos'; kerberos >> /var/log/kerberos.log &
-fi
-
-echo '.'
diff --git a/share/examples/etc/rc.serial b/share/examples/etc/rc.serial
deleted file mode 100644
index 7f042e8..0000000
--- a/share/examples/etc/rc.serial
+++ /dev/null
@@ -1,91 +0,0 @@
-# Change some defauls for serial devices.
-# Standard defaults are:
-# dtrwait 300
-# initial cflag from <sys/ttydefaults.h> = cread cs8 hupcl
-# initial iflag, lflag and oflag all 0
-# speed 9600
-# special chars from <sys/ttydefaults.h>
-# nothing locked
-# except for serial consoles the initial iflag, lflag and oflag are from
-# <sys/ttydefaults.h> and clocal is locked on.
-
-default() {
- # Reset everything changed by the other functions to initial defaults.
- for i in $*
- do
- comcontrol /dev/ttyd$i dtrwait 300
- stty </dev/ttyid$i -clocal crtscts hupcl 9600 reprint ^R
- stty </dev/ttyld$i -clocal -crtscts -hupcl 0
- stty </dev/cuai0$i -clocal crtscts hupcl 9600 reprint ^R
- stty </dev/cual0$i -clocal -crtscts -hupcl 0
- done
-}
-
-maybe() {
- # Special settings.
- for i in $*
- do
- # Don't use ^R; it breaks bash's ^R when typed ahead.
- stty </dev/ttyid$i reprint undef
- stty </dev/cuai0$i reprint undef
- # Lock clocal off on dialin device for security.
- stty </dev/ttyld$i clocal
- # Lock the speeds to use old binaries that don't support them.
- # Any legal speed works to lock the initial speed.
- stty </dev/ttyld$i 300
- stty </dev/cual0$i 300
- done
-}
-
-modem() {
- # Modem that supports CTS and perhaps RTS handshaking.
- for i in $*
- do
- comcontrol /dev/ttyd$i dtrwait 100 # may depend on modem
- # Lock crtscts on.
- # Speed reasonable for V42bis.
- stty </dev/ttyid$i crtscts 57600
- stty </dev/ttyld$i crtscts
- stty </dev/cuai0$i crtscts 57600
- stty </dev/cual0$i crtscts
- done
-}
-
-mouse() {
- # Mouse on either callin or callout port.
- for i in $*
- do
- # Lock clocal on, hupcl off.
- # Standard speed for Microsoft mouse.
- stty </dev/ttyid$i clocal -hupcl 1200
- stty </dev/ttyld$i clocal hupcl
- stty </dev/cuai0$i clocal -hupcl 1200
- stty </dev/cual0$i clocal hupcl
- done
-}
-
-terminal() {
- # Terminal that supports CTS and perhaps RTS handshaking
- # with the cable or terminal arranged so that DCD is on
- # at least while the terminal is on.
- # Also works for bidirectional communications to another pc
- # provided at most one side runs getty.
- # Same as modem() except we want a faster speed and no dtrwait.
- modem $*
- for i in $*
- do
- comcontrol /dev/ttyd$i dtrwait 0
- stty </dev/ttyid$i 115200
- stty </dev/cuai0$i 115200
- done
-}
-
-# Don't use anything from this file unless you have some buggy programs
-# that require it.
-#
-# Edit the functions and the examples to suit your system.
-#
-# maybe 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v
-# mouse 2
-# modem 1
-# terminal 0
diff --git a/share/examples/etc/remote b/share/examples/etc/remote
deleted file mode 100644
index a860a26..0000000
--- a/share/examples/etc/remote
+++ /dev/null
@@ -1,50 +0,0 @@
-# @(#)remote 5.2 (Berkeley) 6/30/90
-#
-# remote -- remote host description file
-# see tip(1), remote(5)
-#
-# dv device to use for the tty
-# el EOL marks (default is NULL)
-# du make a call flag (dial up)
-# pn phone numbers (@ =>'s search phones file; possibly taken from
-# PHONES environment variable)
-# at ACU type
-# ie input EOF marks (default is NULL)
-# oe output EOF string (default is NULL)
-# cu call unit (default is dv)
-# br baud rate (defaults to 300)
-# fs frame size (default is BUFSIZ) -- used in buffering writes on
-# receive operations
-# tc to continue a capability
-
-# Systems definitions
-netcom|Netcom Unix Access:\
- :pn=@:tc=unix1200:
-omen|Omen BBS:\
- :pn=@:tc=dos1200:
-
-# UNIX system definitions
-unix1200|1200 Baud dial-out to a UNIX system:\
- :el=^U^C^R^O^D^S^Q:ie=%$:oe=^D:tc=dial1200:
-unix300|300 Baud dial-out to a UNIX system:\
- :el=^U^C^R^O^D^S^Q:ie=%$:oe=^D:tc=dial300:
-
-# DOS system definitions
-dos1200|1200 Baud dial-out to a DOS system:\
- :el=^U^C^R^O^D^S^Q:ie=%$:oe=^Z:pa=none:tc=dial1200:
-
-# General dialer definitions used below
-#
-# COURIER switch settings:
-# switch: 1 2 3 4 5 6 7 8 9 10
-# setting: D U D U D D U D U U
-# Rackmount: U U D U D U D D U D
-#
-dial2400|2400 Baud Hayes attributes:\
- :dv=/dev/tty00:br#2400:cu=/dev/tty00:at=hayes:du:
-dial1200|1200 Baud Hayes attributes:\
- :dv=/dev/tty00:br#1200:cu=/dev/tty00:at=hayes:du:
-
-# Hardwired line
-tty00b|tty0b:dv=/dev/tty00:br#2400
-tty00c|tty0c:dv=/dev/tty00:br#9600
diff --git a/share/examples/etc/rpc b/share/examples/etc/rpc
deleted file mode 100644
index 0ce30ec..0000000
--- a/share/examples/etc/rpc
+++ /dev/null
@@ -1,34 +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
-pcnfsd 150001 pcnfs
diff --git a/share/examples/etc/security b/share/examples/etc/security
deleted file mode 100644
index 76d5a6c..0000000
--- a/share/examples/etc/security
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh -
-#
-# @(#)security 5.3 (Berkeley) 5/28/91
-# $Id: security,v 1.6 1994/01/22 10:54:13 rgrimes Exp $
-#
-PATH=/sbin:/bin:/usr/bin
-
-host=`hostname -s`
-echo "Subject: $host security check output"
-
-LOG=/var/log
-TMP=/tmp/_secure.$$
-
-umask 027
-
-echo "checking setuid files and devices:"
-
-# don't have ncheck, but this does the equivalent of the commented out block.
-# note that one of the original problem, the possibility of overrunning
-# the args to ls, is still here...
-#
-MP=`mount -t ufs | sed 's;/dev/;&r;' | awk '{ print $3 }'`
-set $MP
-while test $# -ge 1; do
- mount=$1
- shift
- find $mount -xdev -perm -u+s -or -perm -g+s | sort
-done | xargs -n 20 ls -lgTd > $TMP
-
-if cmp $LOG/setuid.today $TMP >/dev/null; then :; else
- echo "$host setuid/device diffs:"
- diff $LOG/setuid.today $TMP
- mv $LOG/setuid.today $LOG/setuid.yesterday
- mv $TMP $LOG/setuid.today
-fi
-rm -f $TMP
-
-echo ""
-echo ""
-echo "checking for uids of 0:"
-awk 'BEGIN {FS=":"} $3=="0" {print $1,$3}' /etc/master.passwd
diff --git a/share/examples/etc/services b/share/examples/etc/services
deleted file mode 100644
index 61440a1..0000000
--- a/share/examples/etc/services
+++ /dev/null
@@ -1,180 +0,0 @@
-#
-# Network services, Internet style
-#
-# Note that it is presently the policy of IANA to assign a single well-known
-# port number for both TCP and UDP; hence, most entries here have two entries
-# even if the protocol doesn't support UDP operations.
-# Updated from RFC 1340, ``Assigned Numbers'' (July 1992). Not all ports
-# are included, only the more common ones.
-#
-# $Id: services,v 1.7 1994/03/02 17:58:29 wollman Exp $
-# From: @(#)services 5.8 (Berkeley) 5/9/91
-#
-tcpmux 1/tcp # TCP port service multiplexer
-echo 7/tcp
-echo 7/udp
-discard 9/tcp sink null
-discard 9/udp sink null
-systat 11/tcp users
-daytime 13/tcp
-daytime 13/udp
-netstat 15/tcp
-qotd 17/tcp quote
-msp 18/tcp # message send protocol
-msp 18/udp # message send protocol
-chargen 19/tcp ttytst source
-chargen 19/udp ttytst source
-ftp 21/tcp
-# 22 - unassigned
-telnet 23/tcp
-# 24 - private
-smtp 25/tcp mail
-# 26 - unassigned
-time 37/tcp timserver
-time 37/udp timserver
-rlp 39/udp resource # resource location
-nameserver 42/tcp name # IEN 116
-whois 43/tcp nicname
-domain 53/tcp nameserver # name-domain server
-domain 53/udp nameserver
-mtp 57/tcp # deprecated
-bootps 67/tcp # BOOTP server
-bootps 67/udp
-bootpc 68/tcp # BOOTP client
-bootpc 68/udp
-tftp 69/udp
-gopher 70/tcp # Internet Gopher
-gopher 70/udp
-rje 77/tcp netrjs
-finger 79/tcp
-www 80/tcp http # WorldWideWeb HTTP
-www 80/udp # HyperText Transfer Protocol
-link 87/tcp ttylink
-#kerberos 88/tcp krb5 # Kerberos v5
-#kerberos 88/udp
-supdup 95/tcp
-# 100 - reserved
-hostnames 101/tcp hostname # usually from sri-nic
-iso-tsap 102/tcp tsap # part of ISODE.
-csnet-ns 105/tcp cso-ns # also used by CSO name server
-csnet-ns 105/udp cso-ns
-rtelnet 107/tcp # Remote Telnet
-rtelnet 107/udp
-pop2 109/tcp postoffice # POP version 2
-pop2 109/udp
-pop3 110/tcp # POP version 3
-pop3 110/udp
-sunrpc 111/tcp
-sunrpc 111/udp
-auth 113/tcp authentication
-sftp 115/tcp
-uucp-path 117/tcp
-nntp 119/tcp readnews untp # USENET News Transfer Protocol
-ntp 123/tcp
-ntp 123/udp # Network Time Protocol
-netbios-ns 137/tcp # NETBIOS Name Service
-netbios-ns 137/udp
-netbios-dgm 138/tcp # NETBIOS Datagram Service
-netbios-dgm 138/udp
-netbios-ssn 139/tcp # NETBIOS session service
-netbios-ssn 139/udp
-imap2 143/tcp # Interim Mail Access Proto v2
-imap2 143/udp
-snmp 161/udp # Simple Net Mgmt Proto
-snmp-trap 162/udp snmptrap # Traps for SNMP
-cmip-man 163/tcp # ISO mgmt over IP (CMOT)
-cmip-man 163/udp
-cmip-agent 164/tcp
-cmip-agent 164/udp
-xdmcp 177/tcp # X Display Mgr. Control Proto
-xdmcp 177/udp
-nextstep 178/tcp NeXTStep NextStep # NeXTStep window
-nextstep 178/udp NeXTStep NextStep # server
-bgp 179/tcp # Border Gateway Proto.
-bgp 179/udp
-prospero 191/tcp # Cliff Neuman's Prospero
-prospero 191/udp
-irc 194/tcp # Internet Relay Chat
-irc 194/udp
-smux 199/tcp # SNMP Unix Multiplexer
-smux 199/udp
-at-rtmp 201/tcp # AppleTalk routing
-at-rtmp 201/udp
-at-nbp 202/tcp # AppleTalk name binding
-at-nbp 202/udp
-at-echo 204/tcp # AppleTalk echo
-at-echo 204/udp
-at-zis 206/tcp # AppleTalk zone information
-at-zis 206/udp
-z3950 210/tcp wais # NISO Z39.50 database
-z3950 210/udp wais
-ipx 213/tcp # IPX
-ipx 213/udp
-imap3 220/tcp # Interactive Mail Access
-imap3 220/udp # Protocol v3
-ulistserv 372/tcp # UNIX Listserv
-ulistserv 372/udp
-#
-# Berkeley-specific services
-#
-exec 512/tcp
-biff 512/udp comsat
-login 513/tcp
-who 513/udp whod
-shell 514/tcp cmd # no passwords used
-syslog 514/udp
-printer 515/tcp spooler # line printer spooler
-talk 517/udp
-ntalk 518/udp
-route 520/udp router routed # RIP
-timed 525/udp timeserver
-tempo 526/tcp newdate
-courier 530/tcp rpc
-conference 531/tcp chat
-netnews 532/tcp readnews
-netwall 533/udp # -for emergency broadcasts
-uucp 540/tcp uucpd # uucp daemon
-remotefs 556/tcp rfs_server rfs # Brunhoff remote filesystem
-#klogin 543/tcp # Kerberized `rlogin' (v5)
-#kshell 544/tcp # Kerberized `rsh' (v5)
-kerberos-adm 749/tcp # Kerberos `kadmin' (v5)
-#
-webster 765/tcp # Network dictionary
-webster 765/udp
-#
-# From ``Assigned Numbers'':
-#
-#> The Registered Ports are not controlled by the IANA and on most systems
-#> can be used by ordinary user processes or programs executed by ordinary
-#> users.
-#
-#> Ports are used in the TCP [45,106] to name the ends of logical
-#> connections which carry long term conversations. For the purpose of
-#> providing services to unknown callers, a service contact port is
-#> defined. This list specifies the port used by the server process as its
-#> contact port. While the IANA can not control uses of these ports it
-#> does register or list uses of these ports as a convienence to the
-#> community.
-#
-ingreslock 1524/tcp
-ingreslock 1524/udp
-prospero-np 1525/tcp # Prospero non-privileged
-prospero-np 1525/udp
-rfe 5002/tcp # Radio Free Ethernet
-rfe 5002/udp # Actually uses UDP only
-#
-#
-# Kerberos (Project Athena/MIT) services
-# Note that these are for Kerberos v4, and are unofficial. Sites running
-# v4 should uncomment these and comment out the v5 entries above.
-#
-kerberos 750/udp kdc # Kerberos (server) udp
-kerberos 750/tcp kdc # Kerberos (server) tcp
-krbupdate 760/tcp kreg # Kerberos registration
-kpasswd 761/tcp kpwd # Kerberos "passwd"
-klogin 543/tcp # Kerberos rlogin
-eklogin 2105/tcp # Kerberos encrypted rlogin
-kshell 544/tcp krcmd # Kerberos remote shell
-#
-supfilesrv 871/tcp # for SUP
-supfiledbg 1127/tcp # for SUP
diff --git a/share/examples/etc/shells b/share/examples/etc/shells
deleted file mode 100644
index df377f1..0000000
--- a/share/examples/etc/shells
+++ /dev/null
@@ -1,6 +0,0 @@
-# List of acceptable shells for chpass(1).
-# Ftpd will not allow users to connect who are not using
-# one of these shells.
-
-/bin/sh
-/bin/csh
diff --git a/share/examples/etc/syslog.conf b/share/examples/etc/syslog.conf
deleted file mode 100644
index 73d56b7..0000000
--- a/share/examples/etc/syslog.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-*.err;kern.debug;auth.notice;mail.crit /dev/console
-*.notice;kern.debug;lpr,auth.info;mail.crit /var/log/messages
-mail.info /var/log/maillog
-lpr.info /var/log/lpd-errs
-cron.* /var/cron/log
-*.err root
-*.notice;auth.debug root
-*.alert root
-*.emerg *
diff --git a/share/examples/etc/ttys b/share/examples/etc/ttys
deleted file mode 100644
index 9340654..0000000
--- a/share/examples/etc/ttys
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# @(#)ttys 5.1 (Berkeley) 4/17/89
-#
-# name getty type status comments
-#
-# This entry needed for asking password when init goes to single-user mode
-# If you want to be asked for password, change "secure" to "insecure" here
-console none unknown off secure
-#
-ttyv0 "/usr/libexec/getty Pc" cons25 on secure
-# Virtual terminals
-ttyv1 "/usr/libexec/getty Pc" cons25 on secure
-ttyv2 "/usr/libexec/getty Pc" cons25 on secure
-ttyv3 "/usr/libexec/getty Pc" cons25 off secure
-# Hardwired terminals
-tty00 "/usr/libexec/getty std.9600" unknown off secure
-tty01 "/usr/libexec/getty std.9600" unknown off secure
-# Dialin terminals
-ttyd2 "/usr/libexec/getty std.9600" unknown off secure
-ttyd3 "/usr/libexec/getty std.9600" unknown off secure
-# Pseudo terminals
-ttyp0 none network
-ttyp1 none network
-ttyp2 none network
-ttyp3 none network
-ttyp4 none network
-ttyp5 none network
-ttyp6 none network
-ttyp7 none network
-ttyp8 none network
-ttyp9 none network
-ttypa none network
-ttypb none network
-ttypc none network
-ttypd none network
-ttype none network
-ttypf none network
-ttyq0 none network
-ttyq1 none network
-ttyq2 none network
-ttyq3 none network
-ttyq4 none network
-ttyq5 none network
-ttyq6 none network
-ttyq7 none network
-ttyq8 none network
-ttyq9 none network
-ttyqa none network
-ttyqb none network
-ttyqc none network
-ttyqd none network
-ttyqe none network
-ttyqf none network
diff --git a/share/examples/lkm/vfs/Makefile b/share/examples/lkm/vfs/Makefile
deleted file mode 100644
index 9e66928..0000000
--- a/share/examples/lkm/vfs/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
-# 25 May 93
-#
-# Makefile for sample loadable file system
-#
-# 25 May 93 Terry Lambert Original
-#
-# Copyright (c) 1993 Terrence R. Lambert.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce 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 Terrence R. Lambert.
-# 4. The name Terrence R. Lambert may not be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-#
-# THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-
-SUBDIR= module
-
-load: _SUBDIRUSE
-
-unload: _SUBDIRUSE
-
-.include <bsd.subdir.mk>
-
-#
-# EOF -- This file has not been truncated.
-#
diff --git a/share/examples/lkm/vfs/README b/share/examples/lkm/vfs/README
deleted file mode 100644
index f5c1ac7..0000000
--- a/share/examples/lkm/vfs/README
+++ /dev/null
@@ -1,107 +0,0 @@
-# Copyright (c) 1993 Terrence R. Lambert.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce 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 Terrence R. Lambert.
-# 4. The name Terrence R. Lambert may not be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-#
-# THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-
-1.0 Overview
-
- This is the README file for the sample loaded file system.
-
-
-2.0 Preparation
-
- To use this module, you must have a kernel the does *NOT*
- have an existing "kernfs" file system in it. To determine
- if your system has the "kernfs" file system in it, check
- the build file for your kernel (usually this file is named
- "/sys/i386/conf/GENERICISA") for the following:
-
- options KERNFS
-
- By default, NetBSD has this file system compiled as part
- of the kernel; if you wish to use this example with NetBSD
- you will have to remove this "options" line and rebuild
- your kernel.
-
- Note: The file "/usr/include/sys/mount.h" must have the
- "kernfs" file system type in it for this example; if you
- do not have the following line in this file, you will not
- be able to use this example:
-
- #define MOUNT_KERNFS 7
-
- This line is created by applying the "kernfs" patches to
- your system. NetBSD as distributed already has these
- patches applied; if you are running vanilla 386BSD, you
- will have to locate and add these patches to use this
- example.
-
-
-3.0 Directions
-
- To test the module, do the following:
-
- cd module
- make load
-
- A load message (the copyright) will be printed on the console.
-
- You must then add the following line to the "/etc/fstab" file:
-
- kernfs /kern kernfs rw 1 1
-
- At the root prompt, type the following:
-
- mkdir /kern
-
- Ignore the following error if it occurs:
-
- mkdir: /kern: File exists
-
- Again at the root prompt, type the following command:
-
- mount /kern
- cd /kern
- cat version
-
- This will verify that the module is working correctly.
-
-
-4.0 Recovering resources
-
- The file system consumes 8 pages of memory when loaded; it
- can be freed up by unloading it. To unload it, type the
- following from the directory this file is in:
-
- cd module
- make unload
-
- The file system will be unloaded by name.
-
-
-5.0 END OF DOCUMENT
diff --git a/share/examples/lkm/vfs/module/Makefile b/share/examples/lkm/vfs/module/Makefile
deleted file mode 100644
index 63055f9..0000000
--- a/share/examples/lkm/vfs/module/Makefile
+++ /dev/null
@@ -1,71 +0,0 @@
-# 05 Jun 93
-#
-# Makefile for newsyscall
-#
-# 05 Jun 93 Terry Lambert Original
-#
-# Copyright (c) 1993 Terrence R. Lambert.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce 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 Terrence R. Lambert.
-# 4. The name Terrence R. Lambert may not be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-#
-# THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-
-SRCS=kernfsmod.c
-OBJS=$(SRCS:.c=.o)
-
-KSRCS=/sys/miscfs/kernfs/kernfs_vfsops.c /sys/miscfs/kernfs/kernfs_vnops.c
-KOBJS=kernfs_vfsops.o kernfs_vnops.o
-
-MODOBJ=combined.o
-
-KMOD=kernfsmod
-CFLAGS= -DKERNEL -I/sys/sys -I/sys
-
-all: $(MODOBJ)
-
-clean:
- rm -f $(OBJS) $(KOBJS) $(MODOBJ) $(KMOD)
-
-load:
- /sbin/modload -o $(KMOD) -e$(KMOD) $(MODOBJ)
-
-unload:
- /sbin/modunload -n $(KMOD)
-
-kernfs_vfsops.o: /sys/miscfs/kernfs/kernfs_vfsops.c
- $(CC) $(CFLAGS) -c -O $@ $<
-
-kernfs_vnops.o: /sys/miscfs/kernfs/kernfs_vnops.c
- $(CC) $(CFLAGS) -c -O $@ $<
-
-$(MODOBJ): $(OBJS) $(KOBJS)
- $(LD) -r -o $(MODOBJ) $(OBJS) $(KOBJS)
-
-#
-# EOF -- This file has not been truncated
-#
diff --git a/share/examples/lkm/vfs/module/kernfsmod.c b/share/examples/lkm/vfs/module/kernfsmod.c
deleted file mode 100644
index 2a083f6..0000000
--- a/share/examples/lkm/vfs/module/kernfsmod.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* 05 Jun 93*/
-/*
- * kernfsmod.c
- *
- * 05 Jun 93 Terry Lambert Original
- *
- * Copyright (c) 1993 Terrence R. Lambert.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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 Terrence R. Lambert.
- * 4. The name Terrence R. Lambert may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-#define printf I_HATE_ANSI
-#include <stdio.h>
-#undef printf
-#include <stdlib.h>
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/mount.h>
-#include <sys/exec.h>
-#include <sys/lkm.h>
-#include <a.out.h>
-#include <sys/file.h>
-#include <sys/errno.h>
-
-/*
- * This is the vfsops table from /sys/miscfs/kernfs/kernfs_vfsops.c
- */
-extern struct vfsops kernfs_vfsops;
-
-/*
- * Currently, the mount system call is broken in the way it operates
- * and the vfssw[] table does not have a character string identifier
- * for the file system type; therefore, to remount a file system after
- * it has been mounted in the first place, the offset into the table
- * must be the same; this will be corrected in future patches, but
- * not right now. At the same time the fstab format will need to
- * change to allow definition without mount of file systems.
- *
- * The flags field is a parameter to the init; this could be used to
- * change the file system operation: for instance, in ISOFS, this
- * could be used to enable/disable Rockridge extensions.
- */
-MOD_VFS("kernfs",MOUNT_KERNFS,0,&kernfs_vfsops)
-
-/*
- * This function is called each time the module is loaded. Technically,
- * we could have made this "nosys" in the "DISPATCH" in "kernfsmod()",
- * but it's a convenient place to kick a copyright out to the console.
- */
-static int
-kernfsmod_load( lkmtp, cmd)
-struct lkm_table *lkmtp;
-int cmd;
-{
- if( cmd == LKM_E_LOAD) { /* print copyright on console*/
- printf( "\nSample Loaded file system\n");
- printf( "Copyright (c) 1990, 1992 Jan-Simon Pendry\n");
- printf( "All rights reserved.\n");
- printf( "\nLoader stub and module loader is\n");
- printf( "Copyright (c) 1993\n");
- printf( "Terrence R. Lambert\n");
- printf( "All rights reserved\n");
- }
-
- return( 0);
-}
-
-
-/*
- * External entry point; should generally match name of .o file. The
- * arguments are always the same for all loaded modules. The "load",
- * "unload", and "stat" functions in "DISPATCH" will be called under
- * their respective circumstances unless their value is "nosys". If
- * called, they are called with the same arguments (cmd is included to
- * allow the use of a single function, ver is included for version
- * matching between modules and the kernel loader for the modules).
- *
- * Since we expect to link in the kernel and add external symbols to
- * the kernel symbol name space in a future version, generally all
- * functions used in the implementation of a particular module should
- * be static unless they are expected to be seen in other modules or
- * to resolve unresolved symbols alread existing in the kernel (the
- * second case is not likely to ever occur).
- *
- * The entry point should return 0 unless it is refusing load (in which
- * case it should return an errno from errno.h).
- */
-kernfsmod( lkmtp, cmd, ver)
-struct lkm_table *lkmtp;
-int cmd;
-int ver;
-{
- DISPATCH(lkmtp,cmd,ver,kernfsmod_load,nosys,nosys)
-}
-
-
-/*
- * EOF -- This file has not been truncated.
- */
diff --git a/share/examples/syscons/setrus b/share/examples/syscons/setrus
deleted file mode 100755
index 216622b..0000000
--- a/share/examples/syscons/setrus
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-# Load KOI8-R screen mapping.
-vidcontrol -l koi8-r2cp866
-# Load Alternate Codes screen font.
-vidcontrol -f 8x16 cp866b-8x16
-vidcontrol -f 8x14 cp866-8x14
-vidcontrol -f 8x8 cp866-8x8
-# Install JCUKEN keyboard mapping.
-kbdcontrol -l ru.koi8-r # Not needed for kernel compiled with RUKEYMAP option
-# Remap Grey Delete to ESC [ ~
-kbdcontrol -f 61 '[~'
-# Maximum key rate
-kbdcontrol -r fast
-# Blank after 5 min
-vidcontrol -t 300
-# Syscons screen saver
-(modstat | grep -q _saver || modload -u -o /tmp/snake_saver_mod -e saver_init -q /lkm/snake_saver_mod.o) > /dev/null 2>&1
diff --git a/share/man/man4/apm.4 b/share/man/man4/apm.4
deleted file mode 100644
index fbb8997..0000000
--- a/share/man/man4/apm.4
+++ /dev/null
@@ -1,146 +0,0 @@
-.\" LP (Laptop Package)
-.\"
-.\" Copyright (c) 1994 by HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>
-.\"
-.\" This software may be used, modified, copied, and distributed, in
-.\" both source and binary form provided that the above copyright and
-.\" these terms are retained. Under no circumstances is the author
-.\" responsible for the proper functioning of this software, nor does
-.\" the author assume any responsibility for damages incurred with its
-.\" use.
-.Dd November 1, 1994
-.Dt APM 4
-.Os
-.Sh NAME
-.Nm apm
-.Nd APM BIOS interface
-.Sh SYNOPSIS
-.Cd options APM
-.Cd device apm0 at isa?
-.Sh DESCRIPTION
-.Nm apm
-is an interface to the Intel / Microsoft APM (Advanced Power Management) BIOS
-on laptop PCs.
-.Pp
-.Nm apm
-provides the following power management functions.
-.Bl -enum -offset indent
-.It
-When the system wakes up from suspended mode,
-.Nm apm
-adjusts the system clock to RTC.
-.It
-When the system wakes up from suspended mode,
-.Nm apm
-passes a message to
-.Xr syslogd 8
-comprising of system wakeup time and elapsed time during suspended mode.
-.It
-.Nm apm
-slows CPU clock when there are no system activities (runnable processes,
-interrupts, etc.). This function is available only on systems whose APM
-supports CPU idling.
-.It
-.Nm apm
-exports an application interface as a character device. Applications
-can control APM, or retrieve APM status information via this interface.
-.Nm apm
-exports the following interfaces. These symbols are defined in
-.Dq Pa /usr/include/machine/apm_bios.h.
-.Bl -tag -width 4n -offset indent
-.It Sy APMIO_SUSPEND
-Suspend system.
-.It Sy APMIO_GET
-Get power management information.
-.It Sy APMIO_ENABLE
-.It Sy APMIO_DISABLE
-Enable / Disable power management.
-.It Sy APMIO_HALTCPU
-.It Sy APMIO_NOTHALTCPU
-Control execution of HLT in the kernel context switch routine.
-.Pp
-Some APM implementations execute the HLT
-.Pq Halt CPU until an interrupt occurs
-instruction in the
-.Dq Pa Idle CPU
-call, while others do not. Thus enabling this may result in
-redundant HLT executions because
-.Dq Pa Idle CPU
-is called from the kernel context switch routine that inherently executes
-HLT. This may reduce peak system performance.
-.Pp
-Also the system hangs up if HLT instruction is disabled in the kernel
-context switch routine, and if the APM implementation of the machine
-does not execute HLT in
-.Dq Pa Idle CPU.
-On some implementations that do not support CPU clock slowdown, APM
-might not execute HLT.
-.Nm apm
-disables
-.Sy APMIO_NOTHALTCPU
-operation on such machines.
-.Pp
-The current version of
-.Nm apm
-does not call
-.Dq Pa Idle CPU
-from the kernel context switch routine if clock slowdown is not supported,
-and it executes HLT instruction by default. Therefore, there is
-no need to use these two operations in most cases.
-.El
-.Pp
-These interfaces are used by
-.Xr apm 8
-and
-.Xr apmconf 8 .
-.It
-.Nm apm
-polls APM events and handles the following events.
-.Bl -column PMEV_POWERSTATECHANGEXXX "suspend system xxxxx"
-.It Sy "Name " "Action " "Description"
-.It Dv "PMEV_STANDBYREQ " No "suspend system " "standby request"
-.It Dv "PMEV_SUSPENDREQ " No "suspend system " "suspend request"
-.It Dv "PMEV_USERSUSPENDREQ " No "suspend system " "user suspend request"
-.It Dv "PMEV_CRITSUSPEND " No "suspend system " "critical suspend request"
-.It Dv "PMEV_NORMRESUME " No "resume system " "normal resume"
-.It Dv "PMEV_CRITRESUME " No "resume system " "critical resume"
-.It Dv "PMEV_STANDBYRESUME " No "resume system " "standby resume"
-.It Dv "PMEV_BATTERYLOW " No "notify message " "battery low"
-.It Dv "PMEV_UPDATETIME " No "adjust clock " "update time"
-.El
-.El
-.Sh BUGS
-WARNING! Many, if not most, of the implementations of APM-bios in laptops
-today are buggy. You may be putting your LCD-display and batteries at
-a risk by using this interface. (The reason this isn't a problem for
-MS-windows is that they use the real-mode interface.) If you see any
-weird behaviour from your system with this code in use, unplug the
-power and batteries ASAP, if not imidiately, and disable this code.
-.Pp
-We are very interested in getting this code working, so please send you
-observations of any anormalous behaviour to us.
-.Pp
-When
-.Nm apm
-is active, calling the BIOS setup routine by using hotkeys,
-may cause serious trouble when resuming the system.
-BIOS setup programs should be called during bootstrap, or from DOS.
-.Pp
-Some APM implementations cannot handle events such as pushing the
-power button or closing the cover. On such implementations, the system
-.Ar must
-be suspended
-.Ar only
-by using
-.Xr apm 8
-or
-.Xr zzz 8 .
-.Pp
-Disk spindown, LCD backlight control, and power on demand have not
-been supported on the current version.
-.Sh SEE ALSO
-.Xr apm 8 ,
-.Xr zzz 8 ,
-.Xr apmconf 8
-.Sh AUTHOR
-HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp> (Keio Univ., Japan)
diff --git a/share/man/man4/man4.i386/com.4 b/share/man/man4/man4.i386/com.4
deleted file mode 100644
index 4e45bab..0000000
--- a/share/man/man4/man4.i386/com.4
+++ /dev/null
@@ -1,102 +0,0 @@
-.\" Copyright (c) 1990, 1991 The Regents of the University of California.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the Systems Programming Group of the University of Utah Computer
-.\" Science Department.
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" from: @(#)dca.4 5.2 (Berkeley) 3/27/91
-.\" from: com.4,v 1.1 1993/08/06 11:19:07 cgd Exp
-.\" $Id$
-.\"
-.Dd August 28, 1993
-.Dt COM 4 i386
-.Os FreeBSD
-.Sh NAME
-.Nm com
-.Nd
-serial communications interface
-.Sh SYNOPSIS
-.Cd "device com0 at isa? port" \&"IO_COM1\&" tty irq 4 vector comintr
-.Cd "device com1 at isa? port" \&"IO_COM2\&" tty irq 3 vector comintr
-.Cd "device com2 at isa? port" \&"IO_COM3\&" tty irq 5 vector comintr
-.Cd "device com3 at isa? port" \&"IO_COM4\&" tty irq 9 vector comintr
-.Sh DESCRIPTION
-The
-.Nm com
-driver provides support for NS8250-, NS16450-, and NS16550-based
-.Tn EIA
-.Tn RS-232C
-.Pf ( Tn CCITT
-.Tn V.28 )
-communications interfaces. The NS8250 and NS16450 have single character
-buffers, and the NS16550 has a 16 character buffer.
-.Pp
-Input and output for each line may set to one of following baud rates;
-50, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2400, 4800, 9600,
-19200, 38400, 57600, or 115200.
-.Sh FILES
-.Bl -tag -width Pa
-.It Pa /dev/tty00
-.It Pa /dev/tty01
-.El
-.Sh DIAGNOSTICS
-.Bl -diag
-.It com%d: silo overflow.
-The single-character input
-.Dq silo
-has overflowed and incoming data has been lost.
-.\".It com%d: weird interrupt: %x.
-.\"The device has generated an unexpected interrupt
-.\"with the code listed.
-.El
-.Sh SEE ALSO
-.Xr tty 4
-.Xr sio 4
-.Sh HISTORY
-The
-.Nm
-driver is derived from the
-.Nm HP9000/300
-.Nm dca
-driver and is
-.Ud
-.Sh BUGS
-Data loss is possible on busy systems with baud rates greater than 300.
-The
-.Nm com
-driver is slow, buggy, and not properly tested.
-.Pp
-The name of this driver and the constants which define the locations
-of the various seiral ports are holdovers from
-.Nm DOS .
-.Pp
-As usual, you get what you pay for; cheap NS16550 clones
-generally don't work.
diff --git a/share/man/man4/man4.i386/fd.4 b/share/man/man4/man4.i386/fd.4
deleted file mode 100644
index 96ddcb0..0000000
--- a/share/man/man4/man4.i386/fd.4
+++ /dev/null
@@ -1,91 +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.
-.\"
-.\" @(#)fd.4 8.1 (Berkeley) 6/9/93
-.\"
-.Dd June 9, 1993
-.Dt FD 4
-.Os
-.Sh NAME
-.Nm fd ,
-.Nm stdin ,
-.Nm stdout ,
-.Nm stderr
-.Nd file descriptor files
-.Sh DESCRIPTION
-The files
-.Pa /dev/fd/0
-through
-.Pa /dev/fd/#
-refer to file descriptors which can be accessed through the file
-system.
-If the file descriptor is open and the mode the file is being opened
-with is a subset of the mode of the existing descriptor, the call:
-.Bd -literal -offset indent
-fd = open("/dev/fd/0", mode);
-.Ed
-.Pp
-and the call:
-.Bd -literal -offset indent
-fd = fcntl(0, F_DUPFD, 0);
-.Ed
-.Pp
-are equivalent.
-.Pp
-Opening the files
-.Pa /dev/stdin ,
-.Pa /dev/stdout
-and
-.Pa /dev/stderr
-is equivalent to the following calls:
-.Bd -literal -offset indent
-fd = fcntl(STDIN_FILENO, F_DUPFD, 0);
-fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
-fd = fcntl(STDERR_FILENO, F_DUPFD, 0);
-.Ed
-.Pp
-Flags to the
-.Xr open 2
-call other than
-.Dv O_RDONLY ,
-.Dv O_WRONLY
-and
-.Dv O_RDWR
-are ignored.
-.Sh FILES
-.Bl -tag -width /dev/stderr -compact
-.It Pa /dev/fd/#
-.It Pa /dev/stdin
-.It Pa /dev/stdout
-.It Pa /dev/stderr
-.El
-.Sh SEE ALSO
-.Xr tty 4
diff --git a/share/man/man4/man4.i386/lpa.4 b/share/man/man4/man4.i386/lpa.4
deleted file mode 100644
index 659db55..0000000
--- a/share/man/man4/man4.i386/lpa.4
+++ /dev/null
@@ -1,62 +0,0 @@
-.\"
-.\" Copyright (c) 1993 Christopher G. Demetriou
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by Christopher G. Demetriou.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\" derived from this software withough specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.\" from: lpa.4,v 1.1 1993/08/06 10:34:11 cgd Exp
-.\" $Id$
-.\"
-.Dd August 28, 1993
-.Dt LPA 4 i386
-.Os FreeBSD
-.Sh NAME
-.Nm lpa
-.Nd
-Interruptless parallel port driver
-.Sh SYNOPSIS
-.\" XXX this is awful hackery to get it to work right... -- cgd
-.Cd "device lpa0 at isa? port" \&"IO_LPT1\&" tty
-.Cd "device lpa1 at isa? port" \&"IO_LPT2\&" tty
-.Cd "device lpa2 at isa? port" \&"IO_LPT3\&" tty
-.Sh DESCRIPTION
-This driver provides access to parallel ports. It assumes that
-the parallel port controller will not cause an interrupt, and
-therefore must poll the controller.
-.Sh FILES
-.Bl -tag -width Pa -compact
-.It Pa /dev/lpa0
-first interruptless parallel port driver
-.El
-.Sh SEE ALSO
-.Xr lpt 4
-.Sh BUGS
-This driver only exists to support broken parallel port implementations.
-Systems with properly working parallel ports should use the
-.Nm lpt
-driver instead, as it is less resource-hungry.
-.Pp
-This driver could stand a rewrite.
diff --git a/share/man/man4/meteor.4 b/share/man/man4/meteor.4
deleted file mode 100644
index c4c2618..0000000
--- a/share/man/man4/meteor.4
+++ /dev/null
@@ -1,771 +0,0 @@
-.Dd August 15, 1995
-.br
-.in +0.5i
-.Dt METEOR 4
-.Os FreeBSD
-.Sh NAME
-.Nm meteor
-.Nd video capture driver
-.Sh SYNOPSIS
-.Nm video meteor
-.Sh DESCRIPTION
-The
-.Xr meteor
-driver provides support for a PCI
-.Em video
-capture. It allows the capture of 24 bit RGB, 16 bit RGB and 16 bit YUV
-output formats.
-
-.Pp
-.Sh Meteor Driver Installation
-To use the Matrox Meteor card in your system, you need a computer
-that support the PCI (preferably the Type 2 or better) interface bus.
-It is recommended that the system has as more than 16 MB of RAM since this
-capture card directly deposits the image to system RAM.
-.Pp
-The files required for Matrox Meteor card are:
-.br
-.in +0.5i
-/sys/pci/meteor.c
-.br
-/sys/i386/include/ioctl_meteor.h (also known as:
-.br
-/usr/include/machine/ioctl_meteor.h)
-.br
-.in -0.5i
-For FreeBSD release versions 2.1 and earlier, the following patch files are also required:
-.br
-.in +0.5i
-meteor/usr/sys/i386/i386/conf.patch
-.br
-meteor/usr/sys/conf/files.patch
-.br
-meteor/sys/i386/conf/LINT.patch
-.br
-These files are available for anonymous ftp at:
-.br
-.in +0.5i
-ftp://joy.cs.ndsu.nodak.edu/pub/meteor.tgz
-.br
-.in -1.0i
-.Pp
-1) In the configuration file, add the line (as shown in
-meteor/usr/sys/i386/conf/LINT.patch):
-.Pp
-.Em device meteor0
-.Pp
-2) There is also a couple of optional parameters you may use
-.Pp
-.Em options "METEOR_ALLOC_PAGES=xxx"
-specifies the number of contiguous pages to allocate when successfully
-probed. The default number of pages allocated by the kernel is 151.
-This means that there are (151*4096) bytes available for use.
-.Pp
-.Em options METEOR_DEALLOC_PAGES
-deallocate all pages when closing the device. Note, the chance of
-contiguously re-allocating new pages are very small. The default
-behavior is to not deallocate pages.
-.Pp
-.Em options "METEOR_DEALLOC_ABOVE=xxx"
-deallocate all pages above the specified number. The default action is
-to not deallocate above any pages.
-.Pp
-3) Make and install the kernel.
-.Pp
-4) Make the special file name:
-.Pp
-.Em mknod /dev/meteor0 c <major> 0
-The major number is determined by the placement of the device in conf.c.
-The patch supplied with the driver will make the major number 67.
-.Pp
-.Sh Meteor Capture Modes
-The Meteor capture driver has three modes of capture operation.
-.Pp
-1) Conventional read(2) interface.
-.in +0.5i
-.Pp
-This mode is the easiest and slowest to use. This mode is great for
-capturing a single field at little programming cost.
-.Pp
-In this mode, the user opens the device, set the capture mode
-and size (See: METEORSETGEO ioctl call), and uses the read system
-call to load the data into a buffer.
-.Pp
-meteor_read.c; read 400x300 RGB24 into a viewable PPM file
-.Pp
-.in -0.5i
-.nf
-#include <sys/fcntl.h>
-#include <machine/ioctl_meteor.h>
-
-extern int errno;
-#define ROWS 300
-#define COLS 400
-#define SIZE (ROWS * COLS * 4)
-main()
-{
- struct meteor_geomet geo;
- char buf[SIZE],b[4],header[16],*p;
- int i,o,c;
-
- if ((i = open("/dev/meteor0", O_RDONLY)) < 0) {
- printf("open failed: %d\n", errno);
- exit(1);
- }
- /* set up the capture type and size */
- geo.rows = ROWS;
- geo.columns = COLS;
- geo.frames = 1;
- geo.oformat = METEOR_GEO_RGB24 ;
-
- if (ioctl(i, METEORSETGEO, &geo) < 0) {
- printf("ioctl failed: %d\n", errno);
- exit(1);
- }
-
- c = METEOR_FMT_NTSC;
-
- if (ioctl(i, METEORSFMT, &c) < 0) {
- printf("ioctl failed: %d\n", errno);
- exit(1);
- }
-
- c = METEOR_INPUT_DEV0;
-
- if (ioctl(i, METEORSINPUT, &c) < 0) {
- printf("ioctl failed: %d\n", errno);
- exit(1);
- }
-
- if ((c=read(i, &buf[0], SIZE)) < SIZE) {
- printf("read failed %d %d %d\n", c, i, errno);
- close(i);
- exit(1);
- }
- close(i);
-
- if ((o = open("rgb24.ppm", O_WRONLY | O_CREAT, 0644)) < 0) {
- printf("ppm open failed: %d\n", errno);
- exit(1);
- }
-
- /* make PPM header and save to file */
- strcpy(&header[0], "P6 400 300 255 ");
- header[2] = header[6] = header[10] = header[14] = '\n';
- write (o, &header[0], 15);
- /* save the RGB data to PPM file */
- for (p = &buf[0]; p < &buf[SIZE]; ) {
- b[2] = *p++; /* blue */
- b[1] = *p++; /* green */
- b[0] = *p++; /* red */
- *p++; /* NULL byte */
- write(o,&b[0], 3); /* not very efficient */
- }
- close(o);
- exit(0);
-}
-.if
-.Pp
- 2) Memory mapped single capture or unsynchronized continuous capture.
-.in +0.5i
-.Pp
-The single capture mode is designed for conferencing tools such as nv.
-These tools need to control the starting of the image capture and also
-need several frames a second. The continuous capture mode is designed
-for applications that want free-running data.
-.Pp
-In this mode, the user opens the device, set the capture mode
-and size (See: METEORSETGEO ioctl call), memory maps the frame buffer
-memory into the user process space, and issues either the
-single-capture or the continuous capture call (See: METEORCAPTUR ioctl
-call) to load the data into the memory mapped buffer.
-.Pp
-As explained in the METEORCAPTUR ioctl call, the single frame capture
-ioctl will block until the capture is complete, the continuous capture
-will return immediately.
-.in -0.5i
-.Pp
- meteor_mmap_single_continuous.c
-.Pp
-.nf
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/fcntl.h>
-#include <machine/ioctl_meteor.h>
-
-extern int errno;
-#define ROWS 480
-#define COLS 640
-#define SIZE (ROW * COLS * 2)
-main()
-{
- struct meteor_geomet geo;
- char buf[SIZE];
- char *mmbuf;
- int i,c;
-
- if ((i = open("/dev/meteor0", O_RDONLY)) < 0) {
- printf("open failed\n");
- exit(1);
- }
-
- geo.rows = ROWS;
- geo.columns = COLS;
- geo.frames = 1;
- geo.oformat = METEOR_GEO_RGB16 ;
-
- if (ioctl(i, METEORSETGEO, &geo) < 0) {
- printf("ioctl failed: %d\n", errno);
- exit(1);
- }
-
- c = METEOR_FMT_NTSC;
-
- if (ioctl(i, METEORSFMT, &c) < 0) {
- printf("ioctl failed: %d\n", errno);
- exit(1);
- }
-
- c = METEOR_INPUT_DEV0;
-
- if (ioctl(i, METEORSINPUT, &c) < 0) {
- printf("ioctl failed: %d\n", errno);
- exit(1);
- }
-
- mmbuf=(char *)mmap((caddr_t)0, SIZE, PROT_READ, 0, i, (off_t)0);
-
-#ifdef SINGLE_MODE
- /* single frame capture */
- c = METEOR_CAP_SINGLE ;
- ioctl(i, METEORCAPTUR, &c); /* wait for the frame */
-
- /* directly access the frame buffer array data in mmbuf */
-#else
- /* continuous frame capture */
- c = METEOR_CAP_CONTINOUS ;
- ioctl(i, METEORCAPTUR, &c); /* returns immediately */
-
- /* directly access the frame buffer array data in mmbuf */
-
- c = METEOR_CAP_STOP_CONT ;
- ioctl(i, METEORCAPTUR, &c); /* close will also stop capture */
-#endif
-
- close(i);
- exit(0);
-}
-.if
-.Pp
- 3) Memory mapped, multi-frame ring buffer synchronize capture.
-.Pp
-.in +0.5i
-This continuous capture mode is synchronized with the application that
-processes up to 32 frames. This gives the advantages of both single and
-continuous capture modes.
-.Pp
-The kernel notifies the application of a new data by raising an
-application defined signal. The driver also shares a structure with
-the application that allows them to communicate which frame has been
-written by the kernel and which frame has been read by the application.
-.Pp
-The shared structure starts on the first page after your data. The
-structure address can be found by calculation:
-.in +0.5i
-.Pp
-(number_rows * number_columns * pixel_depth + 4095) & 0xfffff000
-.in -0.5i
-.Pp
- or
-.in +0.5i
-.Pp
-((number_rows * number_columns * pixel_depth + 4095)/4096) * 4096
-.in -0.5i
-.Pp
-The shared structure is of type struct meteor_mem. The two most
-important fields are called active and num_active_buf. active
-is a bitmap of frames written by the kernel. num_active_bufs is
-a count of frames marked in the active field. When a frame is read
-in by the driver, the num_active_bufs count is tested, if this
-count is below the threshold of number of active frames (value
-in meteor_mem's hiwat variable), the bit representing frame
-number in the buffer is stored in the active variable, the
-num_active_bufs is incremented, the kernel then raises the specified
-signal to activate the user application. The user application's
-responsibility when getting the signal is to check the active bitmap
-to determine the lowest active frame, use the data as the application
-desires, clear the bitmap entry for that frame, and decrement the
-num_active_bufs. If the threshold of number of active frames (hiwat)
-has been exceeded, no new frames or signal from the kernel will occur
-until the num_active_bufs is less than or equal to lowat.
-.Pp
-The driver loads the frames in a round-robin fashion. it is expected
-that the user removes them in the same order. The driver does not
-check to see if the frame is already active.
-.Pp
-The frame_size and number of frames in the buffer are also provided
-to the meteor_mem structure, but changing these fields in the
-application will not change the operation of the driver.
-.Pp
-In programming for this mode, the user opens the device, sets the
-geometry, mmaps the data/common control structure, then starts the
-continuous capture mode. A special signal catcher is required to
-process the frames as they are read by the kernel.
-.Pp
-When specifying the geometry (See: ioctl METEORSETGEO), it
-is important that the number of frames is set greater than 1.
-.in -0.5i
-.Pp
- skeleton_capture_n.c
-.Pp
-.nf
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/fcntl.h>
-#include <sys/signal.h>
-#include <machine/ioctl_meteor.h>
-
-int video; /* made global if you wish to stop capture in signal handler */
-caddr_t data_frames;
-struct meteor_mem *common_mem;
-extern int errno;
-
-#define FRAME_MAX
-
-void
-usr2_catcher()
-{
-#ifdef SIGNAL_STOP
- struct meteor_capframe capframe; /* for ioctl */
-#endif
- char *frame;
-
- /* find frame */
- frame = (char *) (data_frames + sig_cnt * common_mem->frame_size) ;
-
- /* add frame processing here */
- /* deactivate frame */
- common_mem->active &= ~(1 << (sig_cnt % 16));
- common_mem->num_active_bufs--;
-
- /* process next frame on next interrupt */
- sig_cnt = ((sig_cnt+1) % FRAME_MAX);
-
-#ifdef SIGNAL_STOP
- if (some_condition_requiring_stopping) {
- capframe.command=METEOR_CAP_STOP_FRAMES;
-
- if (ioctl(i, METEORCAPFRM, &capframe) < 0) {
- printf("METEORCAPFRM failed %d\n", errno);
- exit(1);
- }
- }
-#endif
-}
-
-main()
-{
- struct meteor_geomet geo;
- int height, width, depth, frames, size;
- struct meteor_capframe capframe;
-
- if ((i = open("/dev/meteor0", O_RDONLY)) < 0) {
- printf("open failed\n");
- exit(1);
- }
- printf("test %d %d\n", errno, i);
-
- height = geo.rows = 120;
- width= geo.columns = 320;
- frames = geo.frames = FRAME_MAX;
- depth = 2; /* 2 bytes per pixel for RGB*/
-
-
- geo.oformat = METEOR_GEO_RGB16;
-
- if (ioctl(i, METEORSETGEO, &geo) < 0) {
- printf("METEORSETGEO failed %d\n", errno);
- exit(1);
- }
-
- c = METEOR_FMT_NTSC;
-
- if (ioctl(i, METEORSFMT, &c) < 0) {
- printf("ioctl failed: %d\n", errno);
- exit(1);
- }
-
- c = METEOR_INPUT_DEV0;
-
- if (ioctl(i, METEORSINPUT, &c) < 0) {
- printf("ioctl failed: %d\n", errno);
- exit(1);
- }
-
- size = ((width*height*depth*frames+4095)/4096)*4096;
- /* add one page after data for meteor_mem */
- data_frames = mmap((caddr_t)0, size + 4096, PROT_READ | PROT_WRITE,
- 0, i, (off_t)0);
-
- if (data_frames == (caddr_t) -1) return (0);
-
- /* common_mem is located at page following data */
- common_mem = (struct meteor_mem *) (y + size);
-
- signal(SIGUSR2, usr2_catcher); /* catch new frame message */
-
- capframe.command=METEOR_CAP_N_FRAMES;
- capframe.signal=SIGUSR2;
- capframe.lowat=12; /* must be < hiwat */
- capframe.hiwat=14; /* must be < FRAME_MAX */
-
- /* start the sync capture */
- if (ioctl(i, METEORCAPFRM, &capframe) < 0) {
- printf("METEORCAPFRM failed %d\n", errno);
- exit(1);
- }
-
- /* this is the background working area, or you can sleep */
-
-
- /* to stop capture */
- capframe.command=METEOR_CAP_STOP_FRAMES;
-
- if (ioctl(i, METEORCAPFRM, &capframe) < 0) {
- printf("METEORCAPFRM failed %d\n", errno);
- exit(1);
- }
-}
-.if
-.Pp
-.Sh Meteor IOCTL Call and Parameters
-.Pp
-The Meteor capture driver has ioctl requests for capturing, reading card
-status, for setting and reading the geometry, and for setting and reading the
-attributes.
-.Pp
-IT IS VERY IMPORTANT TO CHECK FOR ERRORS ON THESE RETURNING IOCTLs.
-Errors indicate that something is very wrong with the ioctl and the
-application should not attempt to proceed further with capturing. The
-meteor capture driver still makes attempts to stop the next capture step if
-an error occurred in a previous step but was ignored by the application
-programmer.
-.Pp
-1) ioctl requests METEORSETGEO and METEORGETGEO
-.in +0.5i
-METEORSETGEO and METEORGETGEO are used to set and read the input
-size, input device, and output format for frame capture.
-.Pp
-These ioctl routines use the meteor_geomet structure that has the
-following entries:
-.Pp
-.Bl -tag -width columns
-.It Dv rows
-number of rows (lines high) in output image
-.It Dv columns
-number of pixels in a row (width) in output image
-.It Dv frames
-number of frames in buffer. Should be 1, unless using
-the multi-framed synchronous capture mode (METEORCAPFRM)
-which REQUIRES frames to be larger than 1.
-.Pp
-Note: if rows, columns or frames is not changed, then
-the existing values are used. The system defaults
-is 640x480x1.
-.It Dv oformat
-you may choose one of the following output format:
-.Bl -tag -width METEOR_GEO_YUV_PACKED
-.It Dv METEOR_GEO_RGB16
-RGB 16 bits xrrrrrgg gggbbbbb default)
-.It Dv METEOR_GEO_RGB24
-(RBG 24 bits packed in 32 bits:
-00000000 rrrrrrrr gggggggg bbbbbbbb)
-.It Dv METEOR_GEO_YUV_PACKED
-(4-2-2 YUV 16 bits packed. byte format:
-u0 y0 v0 y1 u1 y2 v1 y3 ...)
-.It Dv METEOR_GEO_YUV_PLANER
-(4-2-2 YUV 16 bits planer format:
-rows * columns bytes of y
-rows * column / 4 bytes of even u
-rows * column / 4 bytes of even v
-rows * column / 4 bytes of odd u
-rows * column / 4 bytes of odd v)
-.El
-.El
-.Pp
-The METEORSETGEO ioctl will fail if more than one entry from a category
-is selected. It is highly recommended that a METEORSETGEO is done
-before capturing data because you cannot guarantee the initial mode
-the card.
-.Pp
-The METEORSETGEO will also attempt to reallocate a new contiguous
-kernel buffer if the new geometry exceeds the old geometry. On
-other hand, if the new geometry will fit in the existing buffer,
-the existing buffer is used.
-.Pp
-If METEORSETGEO fails the ioctl() will return a value of -1 and the
-external variable errno will be set to:
-.Pp
-.Bl -tag -width EINVAL
-.It Dv EINVAL
-invalid meteor_geomet structure pointer, rows, columns,
-frames were invalid.
-.It Dv ENOMEM
-could not allocate the contigous block.
-.El
-.in -0.5i
-.Pp
-2) ioctl requests METEORSFMT and METEORGFMT
-.in +0.5i
-.Pp
-METEORSFMT and METEORGFMT are used to set and read the camera input
-standard format.
-.Pp
-Possible formats are:
-.Bl -tag -width METEOR_FMT_AUTOMODE
-.It Dv METEOR_FMT_NTSC
-NTSC (default mode)
-.It Dv METEOR_FMT_PAL
-PAL
-.It Dv METEOR_FMT_SECAM
-SECAM
-.It Dv METEOR_FMT_AUTOMODE
-Autodetect.
-.El
-.in -0.5i
-.Pp
-3) ioctl requests METEORSINPUT and METEORGINPUT
-.in +0.5i
-.Pp
-METEORSINPUT and METEORGINPUT are used to set and read the camera
-input device. Using the DB9 connector on the Meteor card, 4 input
-devices can be connected and an input camera can be selected with this
-ioctl.
-.Pp
-Possible formats are:
-.Bl -tag -width METEOR_INPUT_DEV_SVIDEO
-.It Dv METEOR_INPUT_DEV0
-(default if none specified)
-.It Dv METEOR_INPUT_DEV_RCA
-(same as METEOR_INPUT_DEV0)
-.It Dv METEOR_INPUT_DEV1
-.It Dv METEOR_INPUT_DEV2
-.It Dv METEOR_INPUT_DEV_SVIDEO
-(same as METEOR_INPUT_DEV2)
-.El
-.in -0.5i
-.Pp
-4) ioctl request METEORSTATUS
-.in +0.5i
-.Pp
-METEORSTATUS is used to read the status of the Meteor capture card
-and returns the following information:
-.Pp
-.Bl -tag -width METEOR_STATUS_ID_MASK
-.It Dv METEOR_STATUS_ID_MASK
-4 bit ID of the SAA7196 scaler chip.
-.It Dv METEOR_STATUS_DIR
-0 = scaler uses internal source.
-.br
-1 = scaler uses external data of expansion bus.
-.It Dv METEOR_STATUS_OEF
-0 = even field detected.
-.br
-1 = odd field detected.
-.It Dv METEOR_STATUS_SVP
-VRAM Port state:
-.br
-0 = inputs HFL and INCADDR inactive.
-.br
-1 = inputs HFL and INCADDR active.
-.It Dv METEOR_STATUS_STTC
-0 = TV horizontal time constant (slow).
-.br
-1 = VCR horizontal time constant (fast).
-.It Dv METEOR_STATUS_HCLK
-0 = Horizontal Phase Lock Loop locked.
-.br
-1 = Horizontal Phase Lock Loop unlocked.
-.It Dv METEOR_STATUS_FIDT
-0 = 50 Hz Field detected.
-.br
-1 = 60 Hz Field detected.
-.It Dv METEOR_STATUS_ALTD
-0 = no line alternating color burst detected.
-.br
-1 = line alternating color burst detected
-(PAL/SECAM).
-.It Dv METEOR_STATUS_CODE
-0 = no color information detected.
-.br
-1 = color information detected.
-.El
-.in -0.5i
-.Pp
-5) ioctl request METEORCAPTUR
-.in +0.5i
-.Pp
-METEORCAPTUR is used to single frame capture or unsynchronized
-continuous capture.
-.Pp
-The single frame capture ioctl request will return only after a
-frame has been captured and transfered to the frame buffer.
-.Pp
-The unsynchronized continuous capture will return immediately and
-data is directly deposited into the buffer when it is available.
-Since this is unsynchronized, it is possible the data is being
-written by the kernel while being read by the application.
-.Pp
-These ioctl routines use the following settings:
-following entries:
-.Pp
-.Bl -tag -width METEOR_CAP_CONTINOUS
-.It Dv METEOR_CAP_SINGLE
-capture one frame
-.It Dv METEOR_CAP_CONTINOUS
-unsynchronized continuous capture
-.It Dv METEOR_CAP_STOP_CONT
-stop the unsynchronized continuous
-capture
-.El
-.Pp
-If METEORCAPTUR fails the ioctl() will return a value of -1 and the
-external variable errno will be set to:
-.Pp
-.Bl -tag -width EINVAL
-.It Dv EINVAL
-invalid capture command value
-.It Dv ENXIO
-there is not internal buffer to hold the frame.
-this indicates the previous set geometry ioctl failed.
-.It Dv EIO
-card is already capturing.
-.El
-.in -0.5i
-.Pp
-6) ioctl request METEORCAPFRM
-.in +0.5i
-.Pp
-METEORCAPFRM is used for synchronous capture of multiple frames.
-.Pp
-This ioctl routines use the meteor_capture structure that has the
-following entries:
-.Pp
-.Bl -tag -width command
-.It Dv command
-possible values for command are:
-.Bl -tag -width METEOR_CAP_STOP_FRAMES
-.It Dv METEOR_CAP_STOP_FRAMES stop the capture does not use the
-other variable in structure.
-.It Dv METEOR_CAP_N_FRAMES start the capture using the other
-variables in the structure as inputs
-.El
-.It Dv signal
-signal to send to application when a new
-frame has been captured. This signal will
-only be raised if the captured frame is saved.
-.It Dv lowat
-see below
-.It Dv hiwat
-see below
-.El
-.Pp
-When a new frame is completed, the driver checks the current unread
-frame count stored in shared variable (the shared variable are stored
-in the meteor_mem structure) num_active_buf, if the count is larger
-than hiwat, the driver will not store any new frames and will not
-send capture signal to the user application until the num_active_buf
-is lower than lowat.
-.Pp
-If METEORCAPFRM fails the ioctl() will return a value of -1 and the
-external variable errno will be set to:
-.Pp
-.Bl -tag -width EINVAL
-.It Dv EINVAL
-invalid meteor_geomet structure pointer or bad command.
-.It Dv ENXIO
-there is not internal buffer to hold the frame.
-this indicates the previous set geometry ioctl failed.
-.It Dv EIO
-card is already capturing.
-.El
-.in -0.5i
-.Pp
-7) ioctl requests METEORSCHCV and METEORGCHCV
-.in +0.5i
-.Pp
-METEORSCHCV and METEORGCHCV are used to set and get the chrominance
-gain control and effects the UV output amplitude.
-.Pp
-If METEORSCHCV or METEORGCHCV fails the ioctl() will return a value
-of -1 and the external variable errno will be set to:
-.Pp
-.Bl -tag -width EINVAL
-.It Dv EINVAL
-EINVAL
-invalid unsigned char pointer.
-.El
-.in -0.5i
-.Pp
-8) ioctl requests METEORGHUE and METEORSHUE
-.in +0.5i
-.Pp
-METEORGHUE and METEORSHUE are used to get and set the hue. The
-signed character has legal values are from +127 which represent
-+178.6 degrees to -128 which represents -180 degrees.
-.Pp
-If METEORGHUE or METEORSHUE fails the ioctl() will return a value of
--1 and the external variable errno will be set to:
-.Pp
-.Bl -tag -width EINVAL
-.It Dv EINVAL
-invalid signed char pointer.
-.El
-.in -0.5i
-.Pp
-9) ioctl requests METEORSCOUNT and METEORGCOUNT
-.in +0.5i
-.Pp
-METEORGCOUNT is used to get the count of frame errors, DMA errors and
-count of the number of frames captured that have occurred since
-the device was opened. METEORSCOUNT can be used to reinitialize the
-counters.
-.Pp
-This ioctl routines use the meteor_counts structure that has the
-following entries:
-.Pp
-.Bl -tag -width frame_count
-.It Dv fifo_errors
-number of FIFO errors since device was opened.
-.It Dv dma_errors number of DMA errors since device was opened.
-
-.It Dv frame_count number of frames captured since device was opened.
-.El
-.Pp
-If METEORSCOUNT or METEORGCOUNT fails the ioctl() will return a value
-of -1 and the external variable errno will be set to:
-.Bl -tag -width EINVAL
-.It Dv EINVAL
-invalid meteor_counts structure pointer.
-.El
-.in -0.5i
-.Pp
-.Sh Known Bugs:
-.in +0.5i
-.Pp
-1) IIC register is difficult to set. We got around that by adding a long
-wait at each IIC register write.
-.Pp
-2) We had difficulties getting the Meteor capture card to work on systems
-that used NCR chipset SCSI cards. It is possible that the Meteor and NCR SCSI
-could work together using the newer TRITON motherboards.
-.in -0.5i
-.Pp
-.Sh Authors:
-.Pp
-.Bl -tag -width Mark_Tinguely
-.It Dv Jim Lowe
-(james@miller.cs.uwm.edu)
-.It Dv Mark Tinguely
-(tinguely@plains.nodak.edu)
-.El
diff --git a/share/man/man4/pt.4.orig b/share/man/man4/pt.4.orig
deleted file mode 100644
index e69de29..0000000
--- a/share/man/man4/pt.4.orig
+++ /dev/null
diff --git a/share/man/man4/uha.4 b/share/man/man4/uha.4
deleted file mode 100644
index 6ff562e..0000000
--- a/share/man/man4/uha.4
+++ /dev/null
@@ -1,74 +0,0 @@
-.\"
-.\" Copyright (c) 1994 Wilko Bulte
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\" derived from this software withough specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.\"
-.Dd August 31, 1994
-.Dt UHA 4 i386
-.Os FreeBSD
-.Sh NAME
-.Nm uha
-.Nd
-Ultrastore SCSI host adapter driver
-.Sh SYNOPSIS
-.sp
-For Ultrastore 24f controllers in EISA mode:
-.Cd "controller uha0 at isa? bio irq 14 vector uhaintr
-.Cd "controller scbus0
-.sp
-For Ultrastore 14f and 34f controllers:
-.Cd "controller uha0 at isa? port" \&"IO_UHA0\&" bio irq 14 drq 5 vector uhaintr
-.Cd "controller scbus0
-.sp
-For each disk:
-.Cd "device sd0
-.sp
-For each tape device:
-.Cd "device st0
-.sp
-For one or more cdroms:
-.Cd "device cd0
-.Sh DESCRIPTION
-This driver provides access to SCSI devices connected to an Ultrastore
-Ultrastore 14f, Ultrastore 24f or Ultrastore 34f hostadapter.
-.sp
-Note that for an Ultrastore 24f in EISA mode no I/O addresses or DMA channels
-are required in the kernel config file. If they are present, the driver
-will correctly find the Ultrastore 24f, but you tie up precious DMA channels
-and I/O ranges which are not used by the card.
-The Ultrastore 24f uses EISA slot specific I/O which is configured
-automatically.
-.Sh FILES
-.Bl -tag -width Pa -compact
-.It Pa /sys/i386/conf/GENERICBT
-sample generic kernel config file for Bustek and Ultrastore based systems
-.It Pa /sys/i386/isa/uha.c
-driver source
-.El
-.Sh SEE ALSO
-.Xr cd 4
-.Xr scsi 4
-.Xr sd 4
-.Xr st 4
diff --git a/share/man/man4/wd.4 b/share/man/man4/wd.4
deleted file mode 100644
index 0bde553..0000000
--- a/share/man/man4/wd.4
+++ /dev/null
@@ -1,64 +0,0 @@
-.\"
-.\" Copyright (c) 1994 Wilko Bulte
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\" derived from this software withough specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.\"
-.Dd August 31, 1994
-.Dt WD 4 i386
-.Os FreeBSD
-.Sh NAME
-.Nm wd
-.Nd
-Generic WD100x diskcontroller driver
-.Sh SYNOPSIS
-.sp
-.Cd "controller wdc0 at isa? port" \&"IO_WD1\&" bio irq 14 vector wdintr
-.Cd "disk wd0 at wdc0 drive 0
-.Cd "disk wd1 at wdc0 drive 1
-.sp
-.Sh DESCRIPTION
-This driver provides access to disks connected to controllers that emulate
-the Western Digital WD100x series. This range of controllers includes WD1003
-type ST412 controllers, WD1007 ESDI controllers and also the generic IDE
-controllers found on most motherboards.
-.sp
-Your controller documentation is usually quick to point out any WD100x
-compatibility.
-.Sh FILES
-.Bl -tag -width Pa -compact
-.It Pa /dev/wd*
-disk block device nodes
-.It Pa /dev/rwd*
-disk character device nodes
-.It Pa /sys/i386/conf/GENERICAH
-sample generic kernel config file for (a.o.) wd based systems
-.It Pa /sys/i386/isa/wd.c
-driver source
-.El
-.Sh SEE ALSO
-.Xr bad144 8
-.Sh NOTES
-This controller/disk combo has no provisions for automatic bad block handling.
-You need to run bad144(8) to check for bad blocks.
diff --git a/share/man/man4/worm.4.orig b/share/man/man4/worm.4.orig
deleted file mode 100644
index e69de29..0000000
--- a/share/man/man4/worm.4.orig
+++ /dev/null
diff --git a/share/syscons/fonts/alt-8x14.fnt b/share/syscons/fonts/alt-8x14.fnt
deleted file mode 100644
index 9dacecb..0000000
--- a/share/syscons/fonts/alt-8x14.fnt
+++ /dev/null
@@ -1,83 +0,0 @@
-begin 644 alt-8x14
-M`````````````````````'Z!I8&!I9F!?@``````?O_;___#Y_]^````````
-M;/[^_OY\.!`````````0.'S^?#@0````````&#P\Y^?G&!@\```````8/'[_
-M_WX8&#P``````````!@\/!@``````/______Y\/#Y_______`````#QF0D)F
-M/`````#_____PYF]O9G#_____P``'@X:,GC,S,QX```````\9F9F/!A^&!@`
-M`````#\S/S`P,'#PX```````?V-_8V-C9^?FP``````8&-L\YSS;&!@`````
-M`(#`X/C^^.#`@````````@8./OX^#@8"```````8/'X8&!A^/!@``````&9F
-M9F9F9@!F9@``````?]O;VWL;&QL;`````'S&8#ALQL9L.`S&?```````````
-M`/[^_@``````&#Q^&!@8?CP8?@`````8/'X8&!@8&!@``````!@8&!@8&'X\
-M&``````````8#/X,&````````````#!@_F`P`````````````,#`P/X`````
-M```````H;/YL*```````````$#@X?'S^_@````````#^_GQ\.#@0````````
-M```````````````````8/#P\&!@`&!@`````9F9F)```````````````;&S^
-M;&QL_FQL````&!A\QL+`?`:&QGP8&```````PL8,&#!FQ@``````.&QL.';<
-MS,QV`````#`P,&````````````````P8,#`P,#`8#```````,!@,#`P,#!@P
-M`````````&8\_SQF````````````&!A^&!@`````````````````&!@8,```
-M````````_@`````````````````````8&````````@8,&#!@P(````````!\
-MQL[>]N;&QGP``````!@X>!@8&!@8?@``````?,8&#!@P8,;^``````!\Q@8&
-M/`8&QGP```````P</&S,_@P,'@``````_L#`P/P&!L9\```````X8,#`_,;&
-MQGP``````/[&!@P8,#`P,```````?,;&QGS&QL9\``````!\QL;&?@8&#'@`
-M```````8&````!@8`````````!@8````&!@P```````&#!@P8#`8#`8`````
-M`````'X``'X`````````8#`8#`8,&#!@``````!\QL8,&!@`&!@``````'S&
-MQM[>WMS`?```````$#ALQL;^QL;&``````#\9F9F?&9F9OP``````#QFPL#`
-MP,)F/```````^&QF9F9F9FSX``````#^9F)H>&AB9OX``````/YF8FAX:&!@
-M\```````/&;"P,#>QF8Z``````#&QL;&_L;&QL8``````#P8&!@8&!@8/```
-M````'@P,#`P,S,QX``````#F9FQL>&QL9N8``````/!@8&!@8&)F_@``````
-MQN[^_M;&QL;&``````#&YO;^WL[&QL8``````#ALQL;&QL9L.```````_&9F
-M9GQ@8&#P``````!\QL;&QM;>?`P.`````/QF9F9\;&9FY@``````?,;&8#@,
-MQL9\``````!^?EH8&!@8&#P``````,;&QL;&QL;&?```````QL;&QL;&;#@0
-M``````#&QL;&UM;^?&P``````,;&;#@X.&S&Q@``````9F9F9CP8&!@\````
-M``#^QHP8,&#"QOX``````#PP,#`P,#`P/```````@,#@<#@<#@8"```````\
-M#`P,#`P,##P````0.&S&`````````````````````````````/\`,#`8````
-M`````````````````'@,?,S,=@``````X&!@>&QF9F9\``````````!\QL#`
-MQGP``````!P,##QLS,S,=@``````````?,;^P,9\```````X;&1@\&!@8/``
-M`````````';,S,Q\#,QX````X&!@;'9F9F;F```````8&``X&!@8&#P`````
-M``8&``X&!@8&9F8\````X&!@9FQX;&;F```````X&!@8&!@8&#P`````````
-M`.S^UM;6Q@``````````W&9F9F9F``````````!\QL;&QGP``````````-QF
-M9F9\8&#P````````=LS,S'P,#!X```````#<=F9@8/```````````'S&<!S&
-M?```````$#`P_#`P,#8<``````````#,S,S,S'8``````````&9F9F8\&```
-M````````QL;6UOYL``````````#&;#@X;,8``````````,;&QL9^!@SX````
-M````_LP8,&;^```````.&!@8<!@8&`X``````!@8&!@`&!@8&```````<!@8
-M&`X8&!AP``````!VW```````````````````$#ALQL;^````````/F;&QL;^
-MQL;&``````#^P,#\QL;&QOP``````/S&QL;\QL;&_```````_L;`P,#`P,#`
-M```````\;&QL;&QL;/[&@@```/[&P,#PP,#&_@``````UM;65'S6UM;6````
-M``!\Q@8<!@;&QGP``````,;&QL[>]N;&Q@`````,VL;&SM[VYL;&``````#&
-MS-CP\-C,QL8``````!XV9L;&QL;&Q@``````@L;&[N[^UL;&``````#&QL;&
-M_L;&QL8``````'[&QL;&QL;&_```````_L;&QL;&QL;&``````#\QL;&QOS`
-MP,```````'S&QL#`P,;&?```````?GY:&!@8&!@8``````#&QL;&QGX&QGP`
-M`````'S6UM;6UGP0.```````QL9L.#ALQL;&``````#,S,S,S,S,S/X"!@``
-M`,;&QL;&?@8&!@````#6UM;6UM;6UM;^`````-;6UM;6UM;6UOX"!@```.#@
-M8'QF9F9F?```````QL;&YK:VMK;F``````#`P,#\QL;&QOP``````'S&!AX&
-M!L;&?```````G+:VMO:VMK:<``````!^QL;&QGXV9L8``````````'S&QO[&
-MQ@``````````_L#\QL;\``````````#\QOS&QOP``````````/["P,#`P```
-M````````/&QL;&S^QH(```````!\QOS`QGP``````````-;6?-;6U@``````
-M````?,8<!L9\``````````#&SM[VYL8````````,&,;.WO;FQ@``````````
-MQLSXV,S&```````````^9F9F9L8``````````,;N_M;&Q@``````````QL;&
-M_L;&``````````!^QL;&QOP``````````/[&QL;&Q@```!%$$4011!%$$401
-M1!%$5:I5JE6J5:I5JE6J5:K==]UWW7?==]UWW7?==Q@8&!@8&!@8&!@8&!@8
-M&!@8&!@8&/@8&!@8&!@8&!@8&/@8^!@8&!@8&#8V-C8V-C;V-C8V-C8V````
-M`````/XV-C8V-C8``````/@8^!@8&!@8&#8V-C8V]@;V-C8V-C8V-C8V-C8V
-M-C8V-C8V-C8``````/X&]C8V-C8V-C8V-C8V]@;^````````-C8V-C8V-OX`
-M```````8&!@8&/@8^`````````````````#X&!@8&!@8&!@8&!@8&!\`````
-M```8&!@8&!@8_P````````````````#_&!@8&!@8&!@8&!@8&!\8&!@8&!@`
-M````````_P```````!@8&!@8&!C_&!@8&!@8&!@8&!@?&!\8&!@8&!@V-C8V
-M-C8V-S8V-C8V-C8V-C8V-S`_```````````````_,#<V-C8V-C8V-C8V-O<`
-M_P``````````````_P#W-C8V-C8V-C8V-C8W,#<V-C8V-C8``````/\`_P``
-M`````#8V-C8V]P#W-C8V-C8V&!@8&!C_`/\````````V-C8V-C8V_P``````
-M````````_P#_&!@8&!@8`````````/\V-C8V-C8V-C8V-C8V/P```````!@8
-M&!@8'Q@?```````````````?&!\8&!@8&!@`````````/S8V-C8V-C8V-C8V
-M-C;_-C8V-C8V&!@8&!C_&/\8&!@8&!@8&!@8&!@8^``````````````````?
-M&!@8&!@8__________________\`````````__________#P\/#P\/#P\/#P
-M\/#P#P\/#P\/#P\/#P\/#P__________````````````````_,;&QL;\P,``
-M``````!\QL#`QGP``````````'Y:&!@8&```````````QL;&QL9^!GP`````
-M`!!\UM;6UGP0.````````,9L.#ALQ@``````````S,S,S,S^!@P```````#&
-MQL9^!@8``````````-;6UM;6_@``````````UM;6UM;^`@8```````#@8'QF
-M9GP``````````,;&YK:VY@``````````P,#\QL;\``````````!\QAX&QGP`
-M`````````)RVMO:VG```````````?L9^-F;&````;&P`_L;`\,#`QOX`````
-M`&QL`'S&_,#&?```````,!@,!@P8,`!^```````,&#!@,!@,`'X```````X;
-M&Q@8&!@8&!@8&!@8&!@8&!@8V-AP````````&!@`?@`8&```````````=MP`
-M=MP````````X;&PX````````````````````&!@`````````````````&```
-M```````/#`P,#`SL;#P<``````!\@KJJHJ*JNH)\````<-@P8,CX````````
-=``````!\?'Q\?'P```````````````````````!\
-`
-end
diff --git a/share/syscons/fonts/alt-8x16.fnt b/share/syscons/fonts/alt-8x16.fnt
deleted file mode 100644
index 117db34..0000000
--- a/share/syscons/fonts/alt-8x16.fnt
+++ /dev/null
@@ -1,95 +0,0 @@
-begin 644 alt-8x16
-M````````````````````````?H&E@8&EF8&!?@```````'[_V___V^?__WX`
-M`````````&S^_O[^?#@0```````````0.'S^?#@0```````````8/#SGY^<8
-M&#P`````````&#Q^__]^&!@\`````````````!@\/!@```````#________G
-MP\/G________```````\9D)"9CP``````/______PYF]O9G#______\``!X&
-M#AIXS,S,S'@````````\9F9F9CP8?A@8````````/S,_,#`P,'#PX```````
-M`']C?V-C8V-GY^;`````````&!C;/.<\VQ@8``````"`P.#P^/[X\.#`@```
-M`````@8.'C[^/AX.!@(````````8/'X8&!A^/!@`````````9F9F9F9F9@!F
-M9@```````'_;V]M[&QL;&QL``````'S&8#ALQL9L.`S&?```````````````
-M_O[^_@```````!@\?A@8&'X\&'X````````8/'X8&!@8&!@8````````&!@8
-M&!@8&'X\&````````````!@,_@P8```````````````P8/Y@,```````````
-M`````,#`P/X``````````````"AL_FPH`````````````!`X.'Q\_OX`````
-M``````#^_GQ\.#@0```````````````````````````````8/#P\&!@8`!@8
-M``````!F9F8D``````````````````!L;/YL;&S^;&P`````&!A\QL+`?`8&
-MAL9\&!@```````#"Q@P8,&#&A@```````#AL;#AVW,S,S'8``````#`P,&``
-M````````````````#!@P,#`P,#`8#````````#`8#`P,#`P,&#``````````
-M``!F//\\9@``````````````&!A^&!@````````````````````8&!@P````
-M`````````/X````````````````````````8&````````````@8,&#!@P(``
-M```````X;,;&UM;&QFPX````````&#AX&!@8&!@8?@```````'S&!@P8,&#`
-MQOX```````!\Q@8&/`8&!L9\````````#!P\;,S^#`P,'@```````/[`P,#\
-M!@8&QGP````````X8,#`_,;&QL9\````````_L8&!@P8,#`P,````````'S&
-MQL9\QL;&QGP```````!\QL;&?@8&!@QX```````````8&````!@8````````
-M````&!@````8&#``````````!@P8,&`P&`P&````````````?@``?@``````
-M``````!@,!@,!@P8,&````````!\QL8,&!@8`!@8`````````'S&QM[>WMS`
-M?````````!`X;,;&_L;&QL8```````#\9F9F?&9F9F;\````````/&;"P,#`
-MP,)F/````````/AL9F9F9F9F;/@```````#^9F)H>&A@8F;^````````_F9B
-M:'AH8&!@\````````#QFPL#`WL;&9CH```````#&QL;&_L;&QL;&````````
-M/!@8&!@8&!@8/````````!X,#`P,#,S,S'@```````#F9F9L>'AL9F;F````
-M````\&!@8&!@8&)F_@```````,;N_O[6QL;&QL8```````#&YO;^WL[&QL;&
-M````````?,;&QL;&QL;&?````````/QF9F9\8&!@8/````````!\QL;&QL;&
-MUMY\#`X`````_&9F9GQL9F9FY@```````'S&QF`X#`;&QGP```````!^?EH8
-M&!@8&!@\````````QL;&QL;&QL;&?````````,;&QL;&QL9L.!````````#&
-MQL;&UM;6_NYL````````QL9L?#@X?&S&Q@```````&9F9F8\&!@8&#P`````
-M``#^QH8,&#!@PL;^````````/#`P,#`P,#`P/`````````"`P.!P.!P.!@(`
-M```````\#`P,#`P,#`P\`````!`X;,8`````````````````````````````
-M````_P``,#`8````````````````````````>`Q\S,S,=@```````.!@8'AL
-M9F9F9GP```````````!\QL#`P,9\````````'`P,/&S,S,S,=@``````````
-M`'S&_L#`QGP````````X;&1@\&!@8&#P````````````=LS,S,S,?`S,>```
-M`.!@8&QV9F9F9N8````````8&``X&!@8&!@\````````!@8`#@8&!@8&!F9F
-M/````.!@8&9L>'AL9N8````````X&!@8&!@8&!@\````````````[/[6UM;6
-MQ@```````````-QF9F9F9F8```````````!\QL;&QL9\````````````W&9F
-M9F9F?&!@\````````';,S,S,S'P,#!X```````#<=F9@8&#P````````````
-M?,9@.`S&?````````!`P,/PP,#`P-AP```````````#,S,S,S,QV````````
-M````9F9F9F8\&````````````,;&UM;6_FP```````````#&;#@X.&S&````
-M````````QL;&QL;&?@8,^````````/[,&#!@QOX````````.&!@8<!@8&!@.
-M````````&!@8&``8&!@8&````````'`8&!@.&!@8&'````````!VW```````
-M```````````````0.&S&QL;^`````````#YFQL;&_L;&QL8```````#^P,#`
-M_,;&QL;\````````_,;&QOS&QL;&_````````/[&P,#`P,#`P,`````````\
-M;&QL;&QL;&S^QH(`````_L;`P/#`P,#&_@```````-;6UE1\UM;6UM8`````
-M``!\Q@8&'`8&QL9\````````QL;&QL[>]N;&Q@``````#-K&QL;.WO;FQL8`
-M``````#&S-CP\-C,QL;&````````'C9FQL;&QL;&Q@```````,;&[N[^_M;6
-MQL8```````#&QL;&_L;&QL;&````````?L;&QL;&QL;&_````````/[&QL;&
-MQL;&QL8```````#\QL;&QL;\P,#`````````?,;&P,#`P,;&?````````'Y^
-M6A@8&!@8&!@```````#&QL;&QL9^!L9\````````?-;6UM;6UGP0.```````
-M`,;&;#@X;,;&QL8```````#,S,S,S,S,S,S^`@8$````QL;&QL9^!@8&!@``
-M`````-;6UM;6UM;6UOX```````#6UM;6UM;6UM;^`@8$````X.!@8'QF9F9F
-M?````````,;&QL;FMK:VMN8```````#`P,#`_,;&QL;\````````>,P&!AX>
-M!@;,>````````)RVMK;VMK:VMIP```````!^QL;&QGXV9L;&````````````
-M?,;&QO[&Q@```````````/[`_,;&QOP```````````#\QL;\QL;\````````
-M````_L;"P,#`P````````````#QL;&QL;/[&@@````````!\QL;\P,9\````
-M````````UM;6?-;6U@```````````'S&!AP&QGP```````````#&QL[>]N;&
-M``````````P8QL;.WO;FQ@```````````,;,V/C8S,8````````````^9F9F
-M9F;&````````````QN[^UL;&Q@```````````,;&QO[&QL8```````````!^
-MQL;&QL;\````````````_L;&QL;&Q@`````11!%$$4011!%$$4011!%$5:I5
-MJE6J5:I5JE6J5:I5JMUWW7?==]UWW7?==]UWW7<8&!@8&!@8&!@8&!@8&!@8
-M&!@8&!@8&/@8&!@8&!@8&!@8&!@8^!CX&!@8&!@8&!@V-C8V-C8V]C8V-C8V
-M-C8V`````````/XV-C8V-C8V-@``````^!CX&!@8&!@8&!@V-C8V-O8&]C8V
-M-C8V-C8V-C8V-C8V-C8V-C8V-C8V-@``````_@;V-C8V-C8V-C8V-C8V-O8&
-M_@``````````-C8V-C8V-OX``````````!@8&!@8^!CX````````````````
-M````^!@8&!@8&!@8&!@8&!@8&!\``````````!@8&!@8&!C_````````````
-M````````_Q@8&!@8&!@8&!@8&!@8&!\8&!@8&!@8&`````````#_````````
-M```8&!@8&!@8_Q@8&!@8&!@8&!@8&!@?&!\8&!@8&!@8&#8V-C8V-C8W-C8V
-M-C8V-C8V-C8V-C<P/P`````````````````_,#<V-C8V-C8V-C8V-C8V]P#_
-M`````````````````/\`]S8V-C8V-C8V-C8V-C8W,#<V-C8V-C8V-@``````
-M_P#_```````````V-C8V-O<`]S8V-C8V-C8V&!@8&!C_`/\``````````#8V
-M-C8V-C;_`````````````````/\`_Q@8&!@8&!@8`````````/\V-C8V-C8V
-M-C8V-C8V-C8_```````````8&!@8&!\8'P`````````````````?&!\8&!@8
-M&!@8&``````````_-C8V-C8V-C8V-C8V-C8V_S8V-C8V-C8V&!@8&!C_&/\8
-M&!@8&!@8&!@8&!@8&!CX````````````````````'Q@8&!@8&!@8________
-M_____________P````````#____________P\/#P\/#P\/#P\/#P\/#P#P\/
-M#P\/#P\/#P\/#P\/#_________\``````````````````/S&QL;&QOS`P,``
-M``````!\QL#`PL9\````````````?EH8&!@8&````````````,;&QL;&QGX&
-MQGP``````!!\UM;6UM9\$#@`````````QFPX.&S&Q@```````````,S,S,S,
-MS/X&#`````````#&QL;&?@8&````````````UM;6UM;6_@```````````-;6
-MUM;6UOX"!@0```````#@8'QF9F9\````````````QL;FMK:VY@``````````
-M`,#`_,;&QOP```````````!\Q@8>!L9\````````````G+:V]K:VG```````
-M`````'[&QGXV9L8`````9F8`_L;`P/#`P,;^````````;&P`?,;&_,#&?```
-M```````P&`P&#!@P`'X`````````#!@P8#`8#`!^````````#AL;&!@8&!@8
-M&!@8&!@8&!@8&!@8&-C8V'```````````!@8`'X`&!@`````````````=MP`
-M=MP`````````.&QL.````````````````````````!@8````````````````
-M````&```````````#PP,#`P,[&QL/!P```````!\@KJJHJ*BJKJ"?`````!P
-MV#!@R/@`````````````````?'Q\?'Q\?```````````````````````````
-!`#!@
-`
-end
diff --git a/share/syscons/fonts/alt-8x8.fnt b/share/syscons/fonts/alt-8x8.fnt
deleted file mode 100644
index 8db1c42..0000000
--- a/share/syscons/fonts/alt-8x8.fnt
+++ /dev/null
@@ -1,49 +0,0 @@
-begin 644 alt-8x8
-M``````````!^@:6!O9F!?G[_V__#Y_]^;/[^_GPX$``0.'S^?#@0`#A\./[^
-M?#A\$!`X?/Y\.'P``!@\/!@``/__Y\/#Y___`#QF0D)F/`#_PYF]O9G#_P\'
-M#WW,S,QX/&9F9CP8?A@_,S\P,'#PX']C?V-C9^;`F5H\Y^<\6IF`X/C^^."`
-M``(./OX^#@(`&#Q^&!A^/!AF9F9F9@!F`'_;VWL;&QL`/F,X;&PXS'@`````
-M?GY^`!@\?AA^/!C_&#Q^&!@8&``8&!@8?CP8```8#/X,&````#!@_F`P````
-M`,#`P/X````D9O]F)````!@\?O__````__]^/!@`````````````,'AX,#``
-M,`!L;&P``````&QL_FS^;&P`,'S`>`SX,```QLP8,&;&`#AL.';<S'8`8&#`
-M```````8,&!@8#`8`&`P&!@8,&```&8\_SQF````,##\,#``````````,#!@
-M````_````````````#`P``8,&#!@P(``?,;.WO;F?``P<#`P,##\`'C,##A@
-MS/P`>,P,.`S,>``</&S,_@P>`/S`^`P,S'@`.&#`^,S,>`#\S`P8,#`P`'C,
-MS'C,S'@`>,S,?`P8<```,#```#`P```P,```,#!@&#!@P&`P&````/P``/P`
-M`&`P&`P8,&``>,P,&#``,`!\QM[>WL!X`#!XS,S\S,P`_&9F?&9F_``\9L#`
-MP&8\`/AL9F9F;/@`_F)H>&AB_@#^8FAX:&#P`#QFP,#.9CX`S,S,_,S,S`!X
-M,#`P,#!X`!X,#`S,S'@`YF9L>&QFY@#P8&!@8F;^`,;N_O[6QL8`QN;VWL[&
-MQ@`X;,;&QFPX`/QF9GQ@8/``>,S,S-QX'`#\9F9\;&;F`'C,X'`<S'@`_+0P
-M,#`P>`#,S,S,S,S\`,S,S,S,>#``QL;&UO[NQ@#&1&PX.&S&`,S,S'@P,'@`
-M_L:,&#)F_@!X8&!@8&!X`,!@,!@,!@(`>!@8&!@8>``0.&S&````````````
-M``#_,#`8`````````'@,?,Q\`&!@8'QF9GP```!XS,#,>``,#`Q\S,Q\````
-M>,S\P'@`.&Q@\&!@\````'S,S'P,^&!@?&9F9F8`,`!P,#`P>``,``P,#`QL
-M.&!@9FQX;&8`<#`P,#`P>````,S^_M;&````^,S,S,P```!XS,S,>````'QF
-M9GQ@8```?,S,?`P,``#<=F9@\````'S`>`SX`!`P?#`P-!@```#,S,S,?```
-M`,S,S'@P````QM;^_FP```#&;#ALQ@```,S,S'P,^```_)@P9/P`'#`PX#`P
-M'``8&!@`&!@8`.`P,!PP,.``=MP`````````$#ALQL;^`!XV9F9^9F8`?&!@
-M?&9F?`!\9F9\9F9\`'Y@8&!@8&``.&QL;&QL_L9^8&!\8&!^`-O;?CQ^V]L`
-M/&8&'`9F/`!F9FY^=F9F`#QF;GYV9F8`9FQX<'AL9@`>-F9F9F9F`,;N_O[6
-MQL8`9F9F?F9F9@`\9F9F9F8\`'YF9F9F9F8`?&9F9GQ@8``\9F!@8&8\`'X8
-M&!@8&!@`9F9F/@9F/`!^V]O;?A@8`&9F/!@\9F8`9F9F9F9F?P-F9F8^!@8&
-M`-O;V]O;V_\`V]O;V]O;_P/@8&!\9F9\`,;&QO;>WO8`8&!@?&9F?`!XC`8^
-M!HQX`,[;V_O;V\X`/F9F9CXV9@```'@,?,QV```\8#QF9CP```!\9GQF?```
-M`'Y@8&!@````/&QL;/[&```\9GY@/````-M^/'[;````/&8,9CP```!F;GYV
-M9@``&&9N?G9F````9FQX;&8````>-F9F9@```,;^_M;&````9F9^9F8````\
-M9F9F/````'YF9F9F`!%$$4011!%$5:I5JE6J5:K==]UWW7?==Q@8&!@8&!@8
-M&!@8^!@8&!@8^!CX&!@8&#8V-O8V-C8V````_C8V-C8`^!CX&!@8&#;V!O8V
-M-C8V-C8V-C8V-C8`_@;V-C8V-C;V!OX`````-C8V_@`````8^!CX````````
-M`/@8&!@8&!@8'P`````8&!C_`````````/\8&!@8&!@8'Q@8&!@```#_````
-M`!@8&/\8&!@8&!\8'Q@8&!@V-C8W-C8V-C8W,#\``````#\P-S8V-C8V]P#_
-M``````#_`/<V-C8V-C<P-S8V-C8`_P#_`````#;W`/<V-C8V&/\`_P`````V
-M-C;_``````#_`/\8&!@8````_S8V-C8V-C8_`````!@?&!\``````!\8'Q@8
-M&!@````_-C8V-C8V-O\V-C8V&/\8_Q@8&!@8&!CX`````````!\8&!@8____
-M______\```#_______#P\/#P\/#P#P\/#P\/#P____\`````````?&9F?&``
-M```\9F!F/````'X8&!@8````9F8^!CP```!^V]M^&````&8\&#QF````9F9F
-M9G\#``!F9CX&!@```-O;V]O_````V]O;V_\#``#@8'QF?````,;&]M[V````
-M8&!\9GP```!\!CX&?````,[;^]O.````/F8^-F8`9@!^8'Q@?@`D`#QF?F`\
-M```P&`P&#!@P``P8,&`P&`P.&QL8&!@8&!@8&!@8V-AP`!@8`'X`&!@`=MP`
-M=MP````X;&PX`````````!@````````X.`````,"!@3,:#@0/$*9H:&90CPP
-72!`@>```````?'Q\?`````````!"?@`X
-`
-end
diff --git a/share/syscons/fonts/altb-8x16.fnt b/share/syscons/fonts/altb-8x16.fnt
deleted file mode 100644
index e072d63..0000000
--- a/share/syscons/fonts/altb-8x16.fnt
+++ /dev/null
@@ -1,95 +0,0 @@
-begin 664 altb-8x16
-M``````````````!$`````````'Z!I8&!O9F!@7X```````!^_]O__\/G__]^
-M````````9O____]^?CP\&!@`````&!@\/'Y^_WY^/#P8&``````8/#P89O__
-M9A@\?@`````8&#P\?O___WX8/'X`````````&#P\/!@```````#______^?#
-MP\/G________`````#QF0D)"9CP``````/_____#F;V]O9G#______\````>
-M#AHR>,S,S,QX````````/&9F9F8\&'X8&````````#\S,S\P,#!P\.``````
-M``!_8V-_8V-C9^?FP```````&!C;/.?G/-L8&````````(#`X/C^_OC@P(``
-M```````"!@X^_OX^#@8"`````!@\?A@8&!@8&!@8&'X\&```9F9F9F9F9F9F
-M`&9F`````'_;V]O;VWL;&QL;&P````!\QF`X;,;&;#@,QGP`````````````
-M`/[^_O[^`````!@\?A@8&!@8?CP8?@```!@\?O\8&!@8&!@8&!@8&!@8&!@8
-M&!@8&!@8_WX\&`````````@,#O\.#`@````````````0,'#_<#`0````````
-M`````,#`P,#^_@`````````````D9O]F)````````````!`0.#A\?/[^````
-M``````#^_GQ\.#@0$````````````````````````````!@\/#P\&!@8&``8
-M&`````!C8\8`````````````````;&QL_OYL;&S^_FQL;````!A^V]OH>#P>
-M%]O;?A@8``#FINP,&!@P,&!NRLX`````.&QL;#@X;<W&QLMS`````!@8,```
-M```````````````,&!@P,#`P,#`P&!@,````,!@8#`P,#`P,#!@8,```````
-M`&9F//__/&9F````````````&!A^?A@8`````````````````````!@8,```
-M`````````'Y^````````````````````````&!@`````!@8,#!@8,#!@8,#`
-M`````'S&QL;.WO;FQL;&?``````8.'@8&!@8&!@8&'X`````/&;#PP,&#!@P
-M8,/_`````/[&#!@\!@,#`\-F/``````<'#P\;&S,S?\-#!X`````_L#`P/SF
-MPP,#PV8\`````#QFQL#\YL/#P\-F/`````#^Q@8,#!@8,#`P,#``````/&;#
-MPV8\9L/#PV8\`````#QFP\/#PV<_`V-F/```````````&!@`````&!@`````
-M`````!@8`````!@8,``````#!@P8,'`P&`P&`P``````````?GX`?GX`````
-M`````,!@,!@,!@P8,&#``````#QFP\,#!@P8&``8&````````'[#P]_;V][`
-MP'P`````$#A\[L;&QL;^QL;&`````/YC8V-C?F-C8V-C_@`````\9L/#P,#`
-MP,/#9CP`````_&9C8V-C8V-C8V;\`````/]C86!D?&1@8&%C_P````#_8V%@
-M9'QD8&!@8/@`````/&;#P\#`S\/#PV<]`````,;&QL;&_L;&QL;&Q@`````\
-M&!@8&!@8&!@8&#P`````#P8&!@8&!@;&QL9\`````.-C9F9L?&QF9F-CXP``
-M``#P8&!@8&!@8&!A8_\`````P^?__]O;V\/#P\/#`````,;&YN;V]M[>SL[&
-MQ@`````\9L/#P\/#P\/#9CP`````_F-C8V-C?F!@8&#P`````#QFP\/#P\/#
-MR\]^/`8'``#^8V-C8V-^;&9F9O<`````?L/#P,!^`P,#P\-^`````/_;F1@8
-M&!@8&!@8/`````#&QL;&QL;&QL;&QGP`````QL;&QL;&QL;&?#@0`````,/#
-MP\/;V]O;V_]F9@````#&QFQL.#@X.&QLQL8`````P\/#P^=^/!@8&!@\````
-M`/[&C`P8&#`P8&+&_@`````\,#`P,#`P,#`P,#P`````P,!@8#`P&!@,#`8&
-M`````#P,#`P,#`P,#`P,/``````8/&;#````````````````````````````
-M````_P```#`P&```````````````````````/`8^9F9F9CL`````X&!@8'YC
-M8V-C8V/>``````````!\QL#`P,#&?``````.!@8&?L;&QL;&QGL`````````
-M`'S&QO[`P,9\`````#QF9F#P8&!@8&!@\```````````>\;&QL;&QGX&QGP`
-MX&!@8'QF9F9F9F;F```````8&``X&!@8&!@8/```````!@8`#@8&!@8&!@9F
-M9CP`X&!@8&9F;'AL9F;F`````#@8&!@8&!@8&!@8/```````````YO_;V]O#
-MP\,``````````-QF9F9F9F9F``````````!\QL;&QL;&?```````````WF-C
-M8V-C8WY@8/```````'O&QL;&QL9^!@8/``````#><V-@8&!@\```````````
-M?,;`<!P&QGP``````!`P,/PP,#`P,#8<``````````#&QL;&QL;&>P``````
-M````QL;&QNY\.!```````````,/#V]O;V_]F``````````#&[GPX.'SNQ@``
-M````````QL;&QL;&QGX,&'```````/[&#!@P8,;^``````X8&!@8<'`8&!@8
-M#@`````8&!@8&```&!@8&!@`````<!@8&!@>'A@8&!AP``````!VW```````
-M````````````````$#ALQL;&_@`````````0.&S&QO[&QL;&````````_F)B
-M8'QF9F9F_````````/QF9F9\9F9F9OP```````#^8F)@8&!@8&#P````````
-M'C9F9F9F9F9F_\.!`````/YF8FAX:&!B9OX```````#6UE14?'Q4UM;6````
-M````?,8&!CP&!@;&?````````,;&SL[6YN;&QL8`````.#C&QL[.UN;FQL;&
-M````````YF9L;'AX;&QFY@```````!XV9L;&QL;&QL8```````#&[O[^UL;&
-MQL;&````````QL;&QO[&QL;&Q@```````'S&QL;&QL;&QGP```````#^QL;&
-MQL;&QL;&````````_&9F9GQ@8&!@\````````#QFPL#`P,#"9CP```````!^
-M6A@8&!@8&!@\````````QL;&QL9^!@;&?```````/!A^V]O;V]M^&#P`````
-M``#&QFQ\.#A\;,;&````````S,S,S,S,S,S,_@8&`````,;&QL;&?@8&!@8`
-M``````#;V]O;V]O;V]O_````````V]O;V]O;V]O;_P,#`````/BP,#`\-C8V
-M-GP```````##P\/#\]O;V]OS````````\&!@8'QF9F9F_````````'C,!B8^
-M)@8&S'@```````#.V]O;^]O;V]O.````````/V9F9CX^9F9FYP``````````
-M`'@,?,S,S'8```````(&/&!@?&9F9F8\````````````_&9F?&9F_```````
-M`````'XR,C`P,'@````````````>-C9F9F;_P\,`````````?,;^P,#&?```
-M`````````-;65'Q4UM8````````````\9@8,!F8\````````````QL;.UN;&
-MQ@`````````X.,;&SM;FQL8```````````#F;'AX;&;F````````````'C9F
-M9F9F9@```````````,;N_O[6UL8```````````#&QL;^QL;&````````````
-M?,;&QL;&?````````````/[&QL;&QL8```""$((0@A""$((0@A""$((0PQC#
-M&,,8PQC#&,,8PQC#&-B#VA/8@]H3V(/:$]B#VA,8&!@8&!@8&!@8&!@8&!@8
-M&!@8&!@8&!CX&!@8&!@8&!@8&!@8&/@8^!@8&!@8&!@V-C8V-C8V-O8V-C8V
-M-C8V``````````#^-C8V-C8V-@```````/@8^!@8&!@8&!@V-C8V-C;V!O8V
-M-C8V-C8V-C8V-C8V-C8V-C8V-C8V-@```````/X&]C8V-C8V-C8V-C8V-C;V
-M!OX`````````-C8V-C8V-C;^`````````!@8&!@8&/@8^```````````````
-M`````/@8&!@8&!@8&!@8&!@8&!@?`````````!@8&!@8&!@8_P``````````
-M`````````/\8&!@8&!@8&!@8&!@8&!@?&!@8&!@8&```````````_P``````
-M```8&!@8&!@8&/\8&!@8&!@8&!@8&!@8'Q@?&!@8&!@8&#8V-C8V-C8V-S8V
-M-C8V-C8V-C8V-C8W,#\`````````````````/S`W-C8V-C8V-C8V-C8V-O<`
-M_P````````````````#_`/<V-C8V-C8V-C8V-C8V-S`W-C8V-C8V-@``````
-M`/\`_P`````````V-C8V-C;W`/<V-C8V-C8V&!@8&!@8_P#_`````````#8V
-M-C8V-C8V_P````````````````#_`/\8&!@8&!@8``````````#_-C8V-C8V
-M-C8V-C8V-C8V/P`````````8&!@8&!@?&!\`````````````````'Q@?&!@8
-M&!@8&```````````/S8V-C8V-C8V-C8V-C8V-O\V-C8V-C8V&!@8&!@8_QC_
-M&!@8&!@8&!@8&!@8&!@8^````````````````````!\8&!@8&!@8________
-M_____________P``````````___________P\/#P\/#P\/#P\/#P\/#P#P\/
-M#P\/#P\/#P\/#P\/#___________``````````````````#<9F9F9F9\8&#P
-M````````?,;`P,#&?````````````'Y:&!@8&#P```````````#&QL;&QGX&
-M!L9\```````\&'[;V]O;?A@8/````````,9L.#@X;,8```````````#,S,S,
-MS,S^!@8`````````QL;&QGX&!@```````````-;6UM;6UOX```````````#6
-MUM;6UM;^`P,`````````^+`P/C,S?@```````````,;&QO;>WO8`````````
-M``#P8&!\9F;\````````````/F<#'P-G/@```````````,[;V_O;V\X`````
-M``````!^S,S\;,S.``````!L;`#^9F!\8&!F_@```````,8``'S&_L#`QGP`
-M`````&`P&`P&#!@P8`!^```````,&#!@P&`P&`P`?```````#AL;&!@8&!@8
-M&!@8&!@8&!@8&!@8&!@8V/AP`````````!@8`'Y^`!@8````````````=MP`
-M=MP``````````#AL;&PX`````````````````````!@8````````````````
-M````&```````````#PP,#`P,#`SL;#P<````````/$*9H:&90CP```````!P
-MB!!@B/@`````````````````?'Q\?'Q\?````````````````````$)"?@``
-!`!!@
-`
-end
diff --git a/share/syscons/fonts/altc-8x16.fnt b/share/syscons/fonts/altc-8x16.fnt
deleted file mode 100644
index bb36c7e..0000000
--- a/share/syscons/fonts/altc-8x16.fnt
+++ /dev/null
@@ -1,95 +0,0 @@
-begin 644 altc-8x16
-M````````````````````````?H&E@8&EF8&!?@```````'[_V___V^?__WX`
-M`````````&S^_O[^?#@0```````````0.'S^?#@0```````````8/#SGY^<8
-M&#P`````````&#Q^__]^&!@\`````````````!@\/!@```````#________G
-MP\/G________```````\9D)"9CP``````/______PYF]O9G#______\``!X&
-M#AIXS,S,S'@````````\9F9F9CP8?A@8````````/S,_,#`P,'#PX```````
-M`']C?V-C8V-GY^;`````````&!C;/.<\VQ@8``````"`P.#P^/[X\.#`@```
-M`````@8.'C[^/AX.!@(````````8/'X8&!A^/!@`````````9F9F9F9F9@!F
-M9@```````'_;V]M[&QL;&QL``````'S&8#ALQL9L.`S&?```````````````
-M_O[^_@```````!@\?A@8&'X\&'X````````8/'X8&!@8&!@8````````&!@8
-M&!@8&'X\&````````````!@,_@P8```````````````P8/Y@,```````````
-M`````,#`P/X``````````````"AL_FPH`````````````!`X.'Q\_OX`````
-M``````#^_GQ\.#@0```````````````````````````````8/#P\&!@8`!@8
-M``````!F9F8D``````````````````!L;/YL;&S^;&P`````&!A\QL+`?`8&
-MAL9\&!@```````#"Q@P8,&#&A@```````#AL;#AVW,S,S'8``````#`P,&``
-M````````````````#!@P,#`P,#`8#````````#`8#`P,#`P,&#``````````
-M``!F//\\9@``````````````&!A^&!@````````````````````8&!@P````
-M`````````/X````````````````````````8&````````````@8,&#!@P(``
-M```````X;,;&UM;&QFPX````````&#AX&!@8&!@8?@```````'S&!@P8,&#`
-MQOX```````!\Q@8&/`8&!L9\````````#!P\;,S^#`P,'@```````/[`P,#\
-M!@8&QGP````````X8,#`_,;&QL9\````````_L8&!@P8,#`P,````````'S&
-MQL9\QL;&QGP```````!\QL;&?@8&!@QX```````````8&````!@8````````
-M````&!@````8&#``````````!@P8,&`P&`P&````````````?@``?@``````
-M``````!@,!@,!@P8,&````````!\QL8,&!@8`!@8`````````'S&QM[>WMS`
-M?````````!`X;,;&_L;&QL8```````#\9F9F?&9F9F;\````````/&;"P,#`
-MP,)F/````````/AL9F9F9F9F;/@```````#^9F)H>&A@8F;^````````_F9B
-M:'AH8&!@\````````#QFPL#`WL;&9CH```````#&QL;&_L;&QL;&````````
-M/!@8&!@8&!@8/````````!X,#`P,#,S,S'@```````#F9F9L>'AL9F;F````
-M````\&!@8&!@8&)F_@```````,;N_O[6QL;&QL8```````#&YO;^WL[&QL;&
-M````````?,;&QL;&QL;&?````````/QF9F9\8&!@8/````````!\QL;&QL;&
-MUMY\#`X`````_&9F9GQL9F9FY@```````'S&QF`X#`;&QGP```````!^?EH8
-M&!@8&!@\````````QL;&QL;&QL;&?````````,;&QL;&QL9L.!````````#&
-MQL;&UM;6_NYL````````QL9L?#@X?&S&Q@```````&9F9F8\&!@8&#P`````
-M``#^QH8,&#!@PL;^````````/#`P,#`P,#`P/`````````"`P.!P.!P.!@(`
-M```````\#`P,#`P,#`P\`````!`X;,8`````````````````````````````
-M````_P``,#`8````````````````````````>`Q\S,S,=@```````.!@8'AL
-M9F9F9GP```````````!\QL#`P,9\````````'`P,/&S,S,S,=@``````````
-M`'S&_L#`QGP````````X;&1@\&!@8&#P````````````=LS,S,S,?`S,>```
-M`.!@8&QV9F9F9N8````````8&``X&!@8&!@\````````!@8`#@8&!@8&!F9F
-M/````.!@8&9L>'AL9N8````````X&!@8&!@8&!@\````````````[/[6UM;6
-MQ@```````````-QF9F9F9F8```````````!\QL;&QL9\````````````W&9F
-M9F9F?&!@\````````';,S,S,S'P,#!X```````#<=F9@8&#P````````````
-M?,9@.`S&?````````!`P,/PP,#`P-AP```````````#,S,S,S,QV````````
-M````9F9F9F8\&````````````,;&UM;6_FP```````````#&;#@X.&S&````
-M````````QL;&QL;&?@8,^````````/[,&#!@QOX````````.&!@8<!@8&!@.
-M````````&!@8&``8&!@8&````````'`8&!@.&!@8&'````````!VW```````
-M```````````````0.&S&QL;^`````````#YFQL;&_L;&QL8```````#^P,#`
-M_,;&QL;\````````_,;&QOS&QL;&_````````/[&P,#`P,#`P,`````````\
-M;&QL;&QL;&S^QH(`````_L;`P/#`P,#&_@```````-;6UE1\UM;6UM8`````
-M``!\Q@8&'`8&QL9\````````QL;&QL[>]N;&Q@``````#-K&QL;.WO;FQL8`
-M``````#&S-CP\-C,QL;&````````'C9FQL;&QL;&Q@```````,;&[N[^_M;6
-MQL8```````#&QL;&_L;&QL;&````````?L;&QL;&QL;&_````````/[&QL;&
-MQL;&QL8```````#\QL;&QL;\P,#`````````?,;&P,#`P,;&?````````'Y^
-M6A@8&!@8&!@```````#&QL;&QL9^!L9\````````?-;6UM;6UGP0.```````
-M`,;&;#@X;,;&QL8```````#,S,S,S,S,S,S^`@8$````QL;&QL9^!@8&!@``
-M`````-;6UM;6UM;6UOX```````#6UM;6UM;6UM;^`@8$````X.!@8'QF9F9F
-M?````````,;&QL;FMK:VMN8```````#`P,#`_,;&QL;\````````>,P&!AX>
-M!@;,>````````)RVMK;VMK:VMIP```````!^QL;&QGXV9L;&````````````
-M?,;&QO[&Q@```````````/[`_,;&QOP```````````#\QL;\QL;\````````
-M````_L;"P,#`P````````````#QL;&QL;/[&@@````````!\QL;\P,9\````
-M````````UM;6?-;6U@```````````'S&!AP&QGP```````````#&QL[>]N;&
-M``````````P8QL;.WO;FQ@```````````,;,V/C8S,8````````````^9F9F
-M9F;&````````````QN[^UL;&Q@```````````,;&QO[&QL8```````````!^
-MQL;&QL;\````````````_L;&QL;&Q@`````11!%$$4011!%$$4011!%$5:I5
-MJE6J5:I5JE6J5:I5JMUWW7?==]UWW7?==]UWW7<8&!@8&!@8&!@8&!@8&!@8
-M&!@8&!@8&/@8&!@8&!@8&!@0_F9B8&!@8&!@\````````#QFP,#HT,#`9CP`
-M```````V)`!X,#`P,#!X````````&!``>#`P,#`P>````````'S&QF`X#`;&
-MQGP```````!@\&!L=F9F9F;F!@PP````#`@`/!@8&!@8&!BP8````"08`,;&
-MQL;&QGX&QGP```````+^P,#`P,#`````````&!``QLS8^-C,Q@``````````
-M````^!@8&!@8&!@8&!@8&!@8&!\``````````!@8&!@8&!C_````````````
-M````````_Q@8&!@8&!@8&!@8&!@8&!\8&!@8&!@8&`````````#_````````
-M```8&!@8&!@8_Q@8&!@8&!@8``````#&QL;&QL;^$!`X```````'B,NKJ*N;
-MB````````&#P8&!\9F9F9N8```````````!\QL!\!L9\``````#P8&!@?&9F
-M9F9FYP`````,&``\&!@8&!@8&!BP8````&#X8&!\=F9F9F;G````````_L;&
-MQL;&QL;&QOX```!L.,;&QL;&QGX&QGP```````!\;&QL;FEI:6G.````````
-MS,S,S/[)R<G)S@`````,&``\&!@8&!@8&#P`````-B0`/!@8&!@8&!@\````
-M````````S,S,_LG)S@```````````#Q,3$Y)2<X````````8$`#^PL#`P,#`
-M````````````/&+`^,!B/``````"!O[`P,#`P,#`P,``````&!#&QLS8\/#8
-MS,;&`````!@8&!@8&!CX````````````````````'Q@8&!@8&!@8________
-M_____________P````````#____________P\/#P\/#P\/#P\/#P\/#P#P\/
-M#P\/#P\/#P\/#P\/#_________\``````````````````/S&QL;&QOS`P,``
-M``````!\QL#`PL9\````````````?EH8&!@8&````````````,;&QL;&QGX&
-MQGP``````!!\UM;6UM9\$#@`````````QFPX.&S&Q@```````````,S,S,S,
-MS/X&#`````````#&QL;&?@8&````````````UM;6UM;6_@```````````-;6
-MUM;6UOX"!@0```````#@8'QF9F9\````````````QL;FMK:VY@``````````
-M`,#`_,;&QOP```````````!\Q@8>!L9\````````````G+:V]K:VG```````
-M`````'[&QGXV9L8`````9F8`_L;`P/#`P,;^````````;&P`?,;&_,#&?```
-M```````P&`P&#!@P`'X`````````#!@P8#`8#`!^````````#AL;&!@8&!@8
-M&!@8&!@8&!@8&!@8&-C8V'```````````!@8`'X`&!@`````````````=MP`
-M=MP`````````.&QL.````````````````````````!@8````````````````
-M````&```````````#PP,#`P,[&QL/!P```````#&QL;&QL;&QL;^$!`X``!P
-MV#!@R/@`````````````````?'Q\?'Q\?```````````````````````````
-!`#!@
-`
-end
diff --git a/share/syscons/fonts/koi8-8x14.fnt b/share/syscons/fonts/koi8-8x14.fnt
deleted file mode 100644
index 221c3fd..0000000
--- a/share/syscons/fonts/koi8-8x14.fnt
+++ /dev/null
@@ -1,83 +0,0 @@
-begin 644 koi8-8x14
-M`````````````````````'Z!I8&!I9F!?@``````?O_;___#Y_]^````````
-M;/[^_OY\.!`````````0.'S^?#@0````````&#P\Y^?G&!@\```````8/'[_
-M_WX8&#P``````````!@\/!@``````/______Y\/#Y_______`````#QF0D)F
-M/`````#_____PYF]O9G#_____P``'@X:,GC,S,QX```````\9F9F/!A^&!@`
-M`````#\S/S`P,'#PX```````?V-_8V-C9^?FP``````8&-L\YSS;&!@`````
-M`(#`X/C^^.#`@````````@8./OX^#@8"```````8/'X8&!A^/!@``````&9F
-M9F9F9@!F9@``````?]O;VWL;&QL;`````'S&8#ALQL9L.`S&?```````````
-M`/[^_@``````&#Q^&!@8?CP8?@`````8/'X8&!@8&!@``````!@8&!@8&'X\
-M&``````````8#/X,&````````````#!@_F`P`````````````,#`P/X`````
-M```````H;/YL*```````````$#@X?'S^_@````````#^_GQ\.#@0````````
-M```````````````````8/#P\&!@`&!@`````9F9F)```````````````;&S^
-M;&QL_FQL````&!A\QL+`?`:&QGP8&```````PL8,&#!FQ@``````.&QL.';<
-MS,QV`````#`P,&````````````````P8,#`P,#`8#```````,!@,#`P,#!@P
-M`````````&8\_SQF````````````&!A^&!@`````````````````&!@8,```
-M````````_@`````````````````````8&````````@8,&#!@P(````````!\
-MQL[>]N;&QGP``````!@X>!@8&!@8?@``````?,8&#!@P8,;^``````!\Q@8&
-M/`8&QGP```````P</&S,_@P,'@``````_L#`P/P&!L9\```````X8,#`_,;&
-MQGP``````/[&!@P8,#`P,```````?,;&QGS&QL9\``````!\QL;&?@8&#'@`
-M```````8&````!@8`````````!@8````&!@P```````&#!@P8#`8#`8`````
-M`````'X``'X`````````8#`8#`8,&#!@``````!\QL8,&!@`&!@``````'S&
-MQM[>WMS`?```````$#ALQL;^QL;&``````#\9F9F?&9F9OP``````#QFPL#`
-MP,)F/```````^&QF9F9F9FSX``````#^9F)H>&AB9OX``````/YF8FAX:&!@
-M\```````/&;"P,#>QF8Z``````#&QL;&_L;&QL8``````#P8&!@8&!@8/```
-M````'@P,#`P,S,QX``````#F9FQL>&QL9N8``````/!@8&!@8&)F_@``````
-MQN[^_M;&QL;&``````#&YO;^WL[&QL8``````#ALQL;&QL9L.```````_&9F
-M9GQ@8&#P``````!\QL;&QM;>?`P.`````/QF9F9\;&9FY@``````?,;&8#@,
-MQL9\``````!^?EH8&!@8&#P``````,;&QL;&QL;&?```````QL;&QL;&;#@0
-M``````#&QL;&UM;^?&P``````,;&;#@X.&S&Q@``````9F9F9CP8&!@\````
-M``#^QHP8,&#"QOX``````#PP,#`P,#`P/```````@,#@<#@<#@8"```````\
-M#`P,#`P,##P````0.&S&`````````````````````````````/\`,#`8````
-M`````````````````'@,?,S,=@``````X&!@>&QF9F9\``````````!\QL#`
-MQGP``````!P,##QLS,S,=@``````````?,;^P,9\```````X;&1@\&!@8/``
-M`````````';,S,Q\#,QX````X&!@;'9F9F;F```````8&``X&!@8&#P`````
-M``8&``X&!@8&9F8\````X&!@9FQX;&;F```````X&!@8&!@8&#P`````````
-M`.S^UM;6Q@``````````W&9F9F9F``````````!\QL;&QGP``````````-QF
-M9F9\8&#P````````=LS,S'P,#!X```````#<=F9@8/```````````'S&<!S&
-M?```````$#`P_#`P,#8<``````````#,S,S,S'8``````````&9F9F8\&```
-M````````QL;6UOYL``````````#&;#@X;,8``````````,;&QL9^!@SX````
-M````_LP8,&;^```````.&!@8<!@8&`X``````!@8&!@`&!@8&```````<!@8
-M&`X8&!AP``````!VW```````````````````$#ALQL;^``````````````#_
-M````````&!@8&!@8&!@8&!@8&!@`````````'Q@8&!@8&`````````#X&!@8
-M&!@8&!@8&!@8&!\````````8&!@8&!@8^````````!@8&!@8&!@?&!@8&!@8
-M&!@8&!@8&/@8&!@8&!@`````````_Q@8&!@8&!@8&!@8&!C_````````&!@8
-M&!@8&/\8&!@8&!C_________``````````````````#_________________
-M___________P\/#P\/#P\/#P\/#P\`\/#P\/#P\/#P\/#P\/$4011!%$$401
-M1!%$$415JE6J5:I5JE6J5:I5JMUWW7?==]UWW7?==]UW```.&QL8&!@8&!@8
-M&!@`````?'Q\?'Q\`````````````!@8``````````\,#`P,#.QL/!P`````
-M````=MP`=MP`````````#!@P8#`8#`!^```````P&`P&#!@P`'X`````````
-M`````````````!@8&!@8&!@8V-AP`````#AL;#@`````````````<-@P8,CX
-M```````````````````8````````````&!@`?@`8&````````````/\`_P``
-M`````#8V-C8V-C8V-C8V-C8V```````?&!\8&!@8&!@``&QL`'S&_,#&?```
-M```````````_-C8V-C8V```````_,#<V-C8V-C8``````/@8^!@8&!@8&```
-M``````#^-C8V-C8V``````#^!O8V-C8V-C88&!@8&!\8'P```````#8V-C8V
-M-C8_````````-C8V-C8W,#\````````8&!@8&/@8^````````#8V-C8V-C;^
-M````````-C8V-C;V!OX````````8&!@8&!\8'Q@8&!@8&#8V-C8V-C8W-C8V
-M-C8V-C8V-C8W,#<V-C8V-C88&!@8&/@8^!@8&!@8&&QL`/[&P/#`P,;^````
-M-C8V-C8V-O8V-C8V-C8V-C8V-O8&]C8V-C8V-@``````_P#_&!@8&!@8````
-M`````/\V-C8V-C8``````/\`]S8V-C8V-A@8&!@8_P#_````````-C8V-C8V
-M-O\````````V-C8V-O<`_P```````!@8&!@8_QC_&!@8&!@8-C8V-C8V-O\V
-M-C8V-C8V-C8V-O<`]S8V-C8V-@``?(*ZJJ*BJKJ"?`````````"<MK;VMIP`
-M`````````'S&QO[&Q@``````````_L#\QL;\``````````#,S,S,S/X&#```
-M`````#QL;&QL_L:"````````?,;\P,9\`````````!!\UM;6UGP0.```````
-M`/["P,#`P```````````QFPX.&S&``````````#&SM[VYL8````````,&,;.
-MWO;FQ@``````````QLSXV,S&```````````^9F9F9L8``````````,;N_M;&
-MQ@``````````QL;&_L;&``````````!^QL;&QOP``````````/[&QL;&Q@``
-M````````?L9^-F;&``````````#\QL;&QOS`P````````'S&P,#&?```````
-M````?EH8&!@8``````````#&QL;&QGX&?````````-;6?-;6U@``````````
-M_,;\QL;\``````````#`P/S&QOP``````````,;&YK:VY@``````````?,8<
-M!L9\``````````#6UM;6UOX``````````'S&'@;&?```````````UM;6UM;^
-M`@8```````#&QL9^!@8``````````.!@?&9F?```````G+:VMO:VMK:<````
-M```^9L;&QO[&QL8``````/[`P/S&QL;&_```````S,S,S,S,S,S^`@8````\
-M;&QL;&QL;/[&@@```/[&P,#PP,#&_@``````?-;6UM;6?!`X``````#^QL#`
-MP,#`P,```````,;&;#@X;,;&Q@``````QL;&SM[VYL;&``````S:QL;.WO;F
-MQL8``````,;,V/#PV,S&Q@``````'C9FQL;&QL;&``````""QL;N[O[6QL8`
-M`````,;&QL;^QL;&Q@``````?L;&QL;&QL;\``````#^QL;&QL;&QL8`````
-M`'[&QL;&?C9FQ@``````_,;&QL;\P,#```````!\QL;`P,#&QGP``````'Y^
-M6A@8&!@8&```````QL;&QL9^!L9\``````#6UM94?-;6UM8``````/S&QL;\
-MQL;&_```````P,#`_,;&QL;\``````#&QL;FMK:VMN8``````'S&!AP&!L;&
-M?`````#6UM;6UM;6UM;^``````!\Q@8>!@;&QGP`````UM;6UM;6UM;6_@(&
-=````QL;&QL9^!@8&``````#@X&!\9F9F9GP`````
-`
-end
diff --git a/share/syscons/fonts/koi8-8x16.fnt b/share/syscons/fonts/koi8-8x16.fnt
deleted file mode 100644
index 4648e88..0000000
--- a/share/syscons/fonts/koi8-8x16.fnt
+++ /dev/null
@@ -1,95 +0,0 @@
-begin 644 koi8-8x16
-M````````````````````````?H&E@8&EF8&!?@```````'[_V___V^?__WX`
-M`````````&S^_O[^?#@0```````````0.'S^?#@0```````````8/#SGY^<8
-M&#P`````````&#Q^__]^&!@\`````````````!@\/!@```````#________G
-MP\/G________```````\9D)"9CP``````/______PYF]O9G#______\``!X&
-M#AIXS,S,S'@````````\9F9F9CP8?A@8````````/S,_,#`P,'#PX```````
-M`']C?V-C8V-GY^;`````````&!C;/.<\VQ@8``````"`P.#P^/[X\.#`@```
-M`````@8.'C[^/AX.!@(````````8/'X8&!A^/!@`````````9F9F9F9F9@!F
-M9@```````'_;V]M[&QL;&QL``````'S&8#ALQL9L.`S&?```````````````
-M_O[^_@```````!@\?A@8&'X\&'X````````8/'X8&!@8&!@8````````&!@8
-M&!@8&'X\&````````````!@,_@P8```````````````P8/Y@,```````````
-M`````,#`P/X``````````````"AL_FPH`````````````!`X.'Q\_OX`````
-M``````#^_GQ\.#@0```````````````````````````````8/#P\&!@8`!@8
-M``````!F9F8D``````````````````!L;/YL;&S^;&P`````&!A\QL+`?`8&
-MAL9\&!@```````#"Q@P8,&#&A@```````#AL;#AVW,S,S'8``````#`P,&``
-M````````````````#!@P,#`P,#`8#````````#`8#`P,#`P,&#``````````
-M``!F//\\9@``````````````&!A^&!@````````````````````8&!@P````
-M`````````/X````````````````````````8&````````````@8,&#!@P(``
-M```````X;,;&UM;&QFPX````````&#AX&!@8&!@8?@```````'S&!@P8,&#`
-MQOX```````!\Q@8&/`8&!L9\````````#!P\;,S^#`P,'@```````/[`P,#\
-M!@8&QGP````````X8,#`_,;&QL9\````````_L8&!@P8,#`P,````````'S&
-MQL9\QL;&QGP```````!\QL;&?@8&!@QX```````````8&````!@8````````
-M````&!@````8&#``````````!@P8,&`P&`P&````````````?@``?@``````
-M``````!@,!@,!@P8,&````````!\QL8,&!@8`!@8`````````'S&QM[>WMS`
-M?````````!`X;,;&_L;&QL8```````#\9F9F?&9F9F;\````````/&;"P,#`
-MP,)F/````````/AL9F9F9F9F;/@```````#^9F)H>&A@8F;^````````_F9B
-M:'AH8&!@\````````#QFPL#`WL;&9CH```````#&QL;&_L;&QL;&````````
-M/!@8&!@8&!@8/````````!X,#`P,#,S,S'@```````#F9F9L>'AL9F;F````
-M````\&!@8&!@8&)F_@```````,;N_O[6QL;&QL8```````#&YO;^WL[&QL;&
-M````````?,;&QL;&QL;&?````````/QF9F9\8&!@8/````````!\QL;&QL;&
-MUMY\#`X`````_&9F9GQL9F9FY@```````'S&QF`X#`;&QGP```````!^?EH8
-M&!@8&!@\````````QL;&QL;&QL;&?````````,;&QL;&QL9L.!````````#&
-MQL;&UM;6_NYL````````QL9L?#@X?&S&Q@```````&9F9F8\&!@8&#P`````
-M``#^QH8,&#!@PL;^````````/#`P,#`P,#`P/`````````"`P.!P.!P.!@(`
-M```````\#`P,#`P,#`P\`````!`X;,8`````````````````````````````
-M````_P``,#`8````````````````````````>`Q\S,S,=@```````.!@8'AL
-M9F9F9GP```````````!\QL#`P,9\````````'`P,/&S,S,S,=@``````````
-M`'S&_L#`QGP````````X;&1@\&!@8&#P````````````=LS,S,S,?`S,>```
-M`.!@8&QV9F9F9N8````````8&``X&!@8&!@\````````!@8`#@8&!@8&!F9F
-M/````.!@8&9L>'AL9N8````````X&!@8&!@8&!@\````````````[/[6UM;6
-MQ@```````````-QF9F9F9F8```````````!\QL;&QL9\````````````W&9F
-M9F9F?&!@\````````';,S,S,S'P,#!X```````#<=F9@8&#P````````````
-M?,9@.`S&?````````!`P,/PP,#`P-AP```````````#,S,S,S,QV````````
-M````9F9F9F8\&````````````,;&UM;6_FP```````````#&;#@X.&S&````
-M````````QL;&QL;&?@8,^````````/[,&#!@QOX````````.&!@8<!@8&!@.
-M````````&!@8&``8&!@8&````````'`8&!@.&!@8&'````````!VW```````
-M```````````````0.&S&QL;^````````````````_P``````````&!@8&!@8
-M&!@8&!@8&!@8&``````````?&!@8&!@8&!@`````````^!@8&!@8&!@8&!@8
-M&!@8&!\``````````!@8&!@8&!CX```````````8&!@8&!@8'Q@8&!@8&!@8
-M&!@8&!@8&/@8&!@8&!@8&`````````#_&!@8&!@8&!@8&!@8&!@8_P``````
-M````&!@8&!@8&/\8&!@8&!@8&/________\`````````````````````____
-M______________________________#P\/#P\/#P\/#P\/#P\/`/#P\/#P\/
-M#P\/#P\/#P\/$4011!%$$4011!%$$4011%6J5:I5JE6J5:I5JE6J5:K==]UW
-MW7?==]UWW7?==]UW```.&QL8&!@8&!@8&!@8&`````!\?'Q\?'Q\````````
-M````````&!@```````````\,#`P,#.QL;#P<````````````=MP`=MP`````
-M```````,&#!@,!@,`'X`````````,!@,!@P8,`!^````````````````````
-M```````8&!@8&!@8&-C8V'```````#AL;#@```````````````!PV#!@R/@`
-M`````````````````````!@``````````````!@8`'X`&!@`````````````
-M_P#_```````````V-C8V-C8V-C8V-C8V-C8V```````?&!\8&!@8&!@8&```
-M;&P`?,;&_,#&?```````````````/S8V-C8V-C8V```````_,#<V-C8V-C8V
-M-@``````^!CX&!@8&!@8&!@`````````_C8V-C8V-C8V``````#^!O8V-C8V
-M-C8V-A@8&!@8'Q@?```````````V-C8V-C8V/P``````````-C8V-C8W,#\`
-M`````````!@8&!@8^!CX```````````V-C8V-C8V_@``````````-C8V-C;V
-M!OX``````````!@8&!@8'Q@?&!@8&!@8&!@V-C8V-C8V-S8V-C8V-C8V-C8V
-M-C8W,#<V-C8V-C8V-A@8&!@8^!CX&!@8&!@8&!AF9@#^QL#`\,#`QOX`````
-M-C8V-C8V-O8V-C8V-C8V-C8V-C8V]@;V-C8V-C8V-C8``````/\`_Q@8&!@8
-M&!@8`````````/\V-C8V-C8V-@``````_P#W-C8V-C8V-C88&!@8&/\`_P``
-M````````-C8V-C8V-O\``````````#8V-C8V]P#_```````````8&!@8&/\8
-M_Q@8&!@8&!@8-C8V-C8V-O\V-C8V-C8V-C8V-C8V]P#W-C8V-C8V-C8``'R"
-MNJJBHJ*JNH)\``````````"<MK;VMK:<````````````?,;&QO[&Q@``````
-M`````/[`_,;&QOP```````````#,S,S,S,S^!@P`````````/&QL;&QL_L:"
-M`````````'S&QOS`QGP``````````!!\UM;6UM9\$#@`````````_L;"P,#`
-MP````````````,9L.#ALQL8```````````#&QL[>]N;&``````````P8QL;.
-MWO;FQ@```````````,;,V/C8S,8````````````^9F9F9F;&````````````
-MQN[^UL;&Q@```````````,;&QO[&QL8```````````!^QL;&QL;\````````
-M````_L;&QL;&Q@```````````'[&QGXV9L8```````````#\QL;&QL;\P,#`
-M````````?,;`P,+&?````````````'Y:&!@8&!@```````````#&QL;&QL9^
-M!L9\````````UM;6?-;6U@```````````/S&QOS&QOP```````````#`P/S&
-MQL;\````````````QL;FMK:VY@```````````'S&!AP&QGP```````````#6
-MUM;6UM;^````````````?,8&'@;&?````````````-;6UM;6UOX"!@0`````
-M``#&QL;&?@8&````````````X&!\9F9F?````````)RVMK;VMK:VMIP`````
-M```^9L;&QO[&QL;&````````_L#`P/S&QL;&_````````,S,S,S,S,S,S/X"
-M!@0````\;&QL;&QL;&S^QH(`````_L;`P/#`P,#&_@```````'S6UM;6UM9\
-M$#@```````#^QL#`P,#`P,#`````````QL9L.#ALQL;&Q@```````,;&QL;.
-MWO;FQL8```````S:QL;&SM[VYL;&````````QLS8\/#8S,;&Q@```````!XV
-M9L;&QL;&QL8```````#&QN[N_O[6UL;&````````QL;&QO[&QL;&Q@``````
-M`'[&QL;&QL;&QOP```````#^QL;&QL;&QL;&````````?L;&QL9^-F;&Q@``
-M`````/S&QL;&QOS`P,````````!\QL;`P,#`QL9\````````?GY:&!@8&!@8
-M&````````,;&QL;&QGX&QGP```````#6UM94?-;6UM;6````````_,;&QOS&
-MQL;&_````````,#`P,#\QL;&QOP```````#&QL;&YK:VMK;F````````?,8&
-M!AP&!L;&?````````-;6UM;6UM;6UOX```````!XS`8&'AX&!LQX````````
-MUM;6UM;6UM;6_@(&!````,;&QL;&?@8&!@8```````#@X&!@?&9F9F9\````
-!`-;6
-`
-end
diff --git a/share/syscons/fonts/koi8-8x8.fnt b/share/syscons/fonts/koi8-8x8.fnt
deleted file mode 100644
index ec26286..0000000
--- a/share/syscons/fonts/koi8-8x8.fnt
+++ /dev/null
@@ -1,49 +0,0 @@
-begin 644 koi8-8x8
-M``````````!^@:6!O9F!?G[_V__#Y_]^;/[^_GPX$``0.'S^?#@0`#A\./[^
-M?#A\$!`X?/Y\.'P``!@\/!@``/__Y\/#Y___`#QF0D)F/`#_PYF]O9G#_P\'
-M#WW,S,QX/&9F9CP8?A@_,S\P,'#PX']C?V-C9^;`F5H\Y^<\6IF`X/C^^."`
-M``(./OX^#@(`&#Q^&!A^/!AF9F9F9@!F`'_;VWL;&QL`/F,X;&PXS'@`````
-M?GY^`!@\?AA^/!C_&#Q^&!@8&``8&!@8?CP8```8#/X,&````#!@_F`P````
-M`,#`P/X````D9O]F)````!@\?O__````__]^/!@`````````````,'AX,#``
-M,`!L;&P``````&QL_FS^;&P`,'S`>`SX,```QLP8,&;&`#AL.';<S'8`8&#`
-M```````8,&!@8#`8`&`P&!@8,&```&8\_SQF````,##\,#``````````,#!@
-M````_````````````#`P``8,&#!@P(``?,;.WO;F?``P<#`P,##\`'C,##A@
-MS/P`>,P,.`S,>``</&S,_@P>`/S`^`P,S'@`.&#`^,S,>`#\S`P8,#`P`'C,
-MS'C,S'@`>,S,?`P8<```,#```#`P```P,```,#!@&#!@P&`P&````/P``/P`
-M`&`P&`P8,&``>,P,&#``,`!\QM[>WL!X`#!XS,S\S,P`_&9F?&9F_``\9L#`
-MP&8\`/AL9F9F;/@`_F)H>&AB_@#^8FAX:&#P`#QFP,#.9CX`S,S,_,S,S`!X
-M,#`P,#!X`!X,#`S,S'@`YF9L>&QFY@#P8&!@8F;^`,;N_O[6QL8`QN;VWL[&
-MQ@`X;,;&QFPX`/QF9GQ@8/``>,S,S-QX'`#\9F9\;&;F`'C,X'`<S'@`_+0P
-M,#`P>`#,S,S,S,S\`,S,S,S,>#``QL;&UO[NQ@#&1&PX.&S&`,S,S'@P,'@`
-M_L:,&#)F_@!X8&!@8&!X`,!@,!@,!@(`>!@8&!@8>``0.&S&````````````
-M``#_,#`8`````````'@,?,Q\`&!@8'QF9GP```!XS,#,>``,#`Q\S,Q\````
-M>,S\P'@`.&Q@\&!@\````'S,S'P,^&!@?&9F9F8`,`!P,#`P>``,``P,#`QL
-M.&!@9FQX;&8`<#`P,#`P>````,S^_M;&````^,S,S,P```!XS,S,>````'QF
-M9GQ@8```?,S,?`P,``#<=F9@\````'S`>`SX`!`P?#`P-!@```#,S,S,?```
-M`,S,S'@P````QM;^_FP```#&;#ALQ@```,S,S'P,^```_)@P9/P`'#`PX#`P
-M'``8&!@`&!@8`.`P,!PP,.``=MP`````````$#ALQL;^`````/\`````&!@8
-M&!@8&!@````?&!@8&````/@8&!@8&!@8'P`````8&!CX`````!@8&!\8&!@8
-M&!@8^!@8&!@```#_&!@8&!@8&/\`````&!@8_Q@8&!C___\``````````/__
-M_______________P\/#P\/#P\`\/#P\/#P\/$4011!%$$415JE6J5:I5JMUW
-MW7?==]UW#AL;&!@8&!@``'Q\?'P````````8`````P(&!,QH.!``=MP`=MP`
-M```,&#!@,!@,`#`8#`8,&#```````$)^`!@8&!@8V-AP`#AL;#@````P2!`@
-M>````````#@X`````!@8`'X`&!@`_P#_`````#8V-C8V-C8V`!\8'Q@8&!@D
-M`#QF?F`\`````#\V-C8V`#\P-S8V-C8`^!CX&!@8&````/XV-C8V`/X&]C8V
-M-C88'Q@?`````#8V-C\`````-C<P/P`````8^!CX`````#8V-OX`````-O8&
-M_@`````8'Q@?&!@8&#8V-C<V-C8V-C<P-S8V-C88^!CX&!@8&&8`?F!\8'X`
-M-C8V]C8V-C8V]@;V-C8V-@#_`/\8&!@8````_S8V-C8`_P#W-C8V-AC_`/\`
-M````-C8V_P`````V]P#_`````!C_&/\8&!@8-C8V_S8V-C8V]P#W-C8V-CQ"
-MF:&AF4(\``#.V_O;S@```'@,?,QV```\8#QF9CP```!F9F9F?P,``#QL;&S^
-MQ@``/&9^8#P```!^V]M^&````'Y@8&!@````9CP8/&8```!F;GYV9@``&&9N
-M?G9F````9FQX;&8````>-F9F9@```,;^_M;&````9F9^9F8````\9F9F/```
-M`'YF9F9F````/F8^-F8```!\9F9\8````#QF8&8\````?A@8&!@```!F9CX&
-M/````-M^/'[;````?&9\9GP```!@8'QF?````,;&]M[V````/&8,9CP```#;
-MV]O;_P```'P&/@9\````V]O;V_\#``!F9CX&!@```.!@?&9\`,[;V_O;V\X`
-M'C9F9GYF9@!\8&!\9F9\`&9F9F9F9G\#.&QL;&QL_L9^8&!\8&!^`'[;V]M^
-M&!@`?F!@8&!@8`!F9CP8/&9F`&9F;GYV9F8`/&9N?G9F9@!F;'AP>&QF`!XV
-M9F9F9F8`QN[^_M;&Q@!F9F9^9F9F`#QF9F9F9CP`?F9F9F9F9@`^9F9F/C9F
-M`'QF9F9\8&``/&9@8&!F/`!^&!@8&!@8`&9F9CX&9CP`V]M^/'[;VP!\9F9\
-M9F9\`&!@8'QF9GP`QL;&]M[>]@`\9@8<!F8\`-O;V]O;V_\`>(P&/@:,>`#;
-7V]O;V]O_`V9F9CX&!@8`X&!@?&9F?``<
-`
-end
diff --git a/share/syscons/fonts/koi8b-8x16.fnt b/share/syscons/fonts/koi8b-8x16.fnt
deleted file mode 100644
index b64dc26..0000000
--- a/share/syscons/fonts/koi8b-8x16.fnt
+++ /dev/null
@@ -1,95 +0,0 @@
-begin 664 koi8b-8x16
-M``````````````!$`````````'Z!I8&!O9F!@7X```````!^_]O__\/G__]^
-M````````9O____]^?CP\&!@`````&!@\/'Y^_WY^/#P8&``````8/#P89O__
-M9A@\?@`````8&#P\?O___WX8/'X`````````&#P\/!@```````#______^?#
-MP\/G________`````#QF0D)"9CP``````/_____#F;V]O9G#______\````>
-M#AHR>,S,S,QX````````/&9F9F8\&'X8&````````#\S,S\P,#!P\.``````
-M``!_8V-_8V-C9^?FP```````&!C;/.?G/-L8&````````(#`X/C^_OC@P(``
-M```````"!@X^_OX^#@8"`````!@\?A@8&!@8&!@8&'X\&```9F9F9F9F9F9F
-M`&9F`````'_;V]O;VWL;&QL;&P````!\QF`X;,;&;#@,QGP`````````````
-M`/[^_O[^`````!@\?A@8&!@8?CP8?@```!@\?O\8&!@8&!@8&!@8&!@8&!@8
-M&!@8&!@8_WX\&`````````@,#O\.#`@````````````0,'#_<#`0````````
-M`````,#`P,#^_@`````````````D9O]F)````````````!`0.#A\?/[^````
-M``````#^_GQ\.#@0$````````````````````````````!@\/#P\&!@8&``8
-M&`````!C8\8`````````````````;&QL_OYL;&S^_FQL;````!A^V]OH>#P>
-M%]O;?A@8``#FINP,&!@P,&!NRLX`````.&QL;#@X;<W&QLMS`````!@8,```
-M```````````````,&!@P,#`P,#`P&!@,````,!@8#`P,#`P,#!@8,```````
-M`&9F//__/&9F````````````&!A^?A@8`````````````````````!@8,```
-M`````````'Y^````````````````````````&!@`````!@8,#!@8,#!@8,#`
-M`````'S&QL;.WO;FQL;&?``````8.'@8&!@8&!@8&'X`````/&;#PP,&#!@P
-M8,/_`````/[&#!@\!@,#`\-F/``````<'#P\;&S,S?\-#!X`````_L#`P/SF
-MPP,#PV8\`````#QFQL#\YL/#P\-F/`````#^Q@8,#!@8,#`P,#``````/&;#
-MPV8\9L/#PV8\`````#QFP\/#PV<_`V-F/```````````&!@`````&!@`````
-M`````!@8`````!@8,``````#!@P8,'`P&`P&`P``````````?GX`?GX`````
-M`````,!@,!@,!@P8,&#``````#QFP\,#!@P8&``8&````````'[#P]_;V][`
-MP'P`````$#A\[L;&QL;^QL;&`````/YC8V-C?F-C8V-C_@`````\9L/#P,#`
-MP,/#9CP`````_&9C8V-C8V-C8V;\`````/]C86!D?&1@8&%C_P````#_8V%@
-M9'QD8&!@8/@`````/&;#P\#`S\/#PV<]`````,;&QL;&_L;&QL;&Q@`````\
-M&!@8&!@8&!@8&#P`````#P8&!@8&!@;&QL9\`````.-C9F9L?&QF9F-CXP``
-M``#P8&!@8&!@8&!A8_\`````P^?__]O;V\/#P\/#`````,;&YN;V]M[>SL[&
-MQ@`````\9L/#P\/#P\/#9CP`````_F-C8V-C?F!@8&#P`````#QFP\/#P\/#
-MR\]^/`8'``#^8V-C8V-^;&9F9O<`````?L/#P,!^`P,#P\-^`````/_;F1@8
-M&!@8&!@8/`````#&QL;&QL;&QL;&QGP`````QL;&QL;&QL;&?#@0`````,/#
-MP\/;V]O;V_]F9@````#&QFQL.#@X.&QLQL8`````P\/#P^=^/!@8&!@\````
-M`/[&C`P8&#`P8&+&_@`````\,#`P,#`P,#`P,#P`````P,!@8#`P&!@,#`8&
-M`````#P,#`P,#`P,#`P,/``````8/&;#````````````````````````````
-M````_P```#`P&```````````````````````/`8^9F9F9CL`````X&!@8'YC
-M8V-C8V/>``````````!\QL#`P,#&?``````.!@8&?L;&QL;&QGL`````````
-M`'S&QO[`P,9\`````#QF9F#P8&!@8&!@\```````````>\;&QL;&QGX&QGP`
-MX&!@8'QF9F9F9F;F```````8&``X&!@8&!@8/```````!@8`#@8&!@8&!@9F
-M9CP`X&!@8&9F;'AL9F;F`````#@8&!@8&!@8&!@8/```````````YO_;V]O#
-MP\,``````````-QF9F9F9F9F``````````!\QL;&QL;&?```````````WF-C
-M8V-C8WY@8/```````'O&QL;&QL9^!@8/``````#><V-@8&!@\```````````
-M?,;`<!P&QGP``````!`P,/PP,#`P,#8<``````````#&QL;&QL;&>P``````
-M````QL;&QNY\.!```````````,/#V]O;V_]F``````````#&[GPX.'SNQ@``
-M````````QL;&QL;&QGX,&'```````/[&#!@P8,;^``````X8&!@8<'`8&!@8
-M#@`````8&!@8&```&!@8&!@`````<!@8&!@>'A@8&!AP``````!VW```````
-M````````````````$#ALQL;&_@```````````````/\`````````&!@8&!@8
-M&!@8&!@8&!@8&```````````'Q@8&!@8&!@``````````/@8&!@8&!@8&!@8
-M&!@8&!@?`````````!@8&!@8&!@8^``````````8&!@8&!@8&!\8&!@8&!@8
-M&!@8&!@8&!CX&!@8&!@8&```````````_Q@8&!@8&!@8&!@8&!@8&/\`````
-M````&!@8&!@8&!C_&!@8&!@8&/__________`````````````````````/__
-M______________________________#P\/#P\/#P\/#P\/#P\/`/#P\/#P\/
-M#P\/#P\/#P\/@A""$((0@A""$((0@A""$,,8PQC#&,,8PQC#&,,8PQC8@]H3
-MV(/:$]B#VA/8@]H3```.&QL8&!@8&!@8&!@8&`````!\?'Q\?'Q\````````
-M````````&!@```````````\,#`P,#`P,[&P\'```````````=MP`=MP`````
-M``````P8,&#`8#`8#`!\``````!@,!@,!@P8,&``?@````````````````!"
-M0GX````8&!@8&!@8&!@8V/AP```````X;&QL.`````````````!PB!!@B/@`
-M`````````````````````!@``````````````!@8`'Y^`!@8````````````
-M`/\`_P`````````V-C8V-C8V-C8V-C8V-C8V````````'Q@?&!@8&!@8&```
-M`,8``'S&_L#`QGP``````````````#\V-C8V-C8V````````/S`W-C8V-C8V
-M-@```````/@8^!@8&!@8&!@``````````/XV-C8V-C8V````````_@;V-C8V
-M-C8V-A@8&!@8&!\8'P`````````V-C8V-C8V-C\`````````-C8V-C8V-S`_
-M`````````!@8&!@8&/@8^``````````V-C8V-C8V-OX`````````-C8V-C8V
-M]@;^`````````!@8&!@8&!\8'Q@8&!@8&!@V-C8V-C8V-C<V-C8V-C8V-C8V
-M-C8V-S`W-C8V-C8V-A@8&!@8&/@8^!@8&!@8&!@``&QL`/YF8'Q@8&;^````
-M-C8V-C8V-C;V-C8V-C8V-C8V-C8V-O8&]C8V-C8V-C8```````#_`/\8&!@8
-M&!@8``````````#_-C8V-C8V-@```````/\`]S8V-C8V-C88&!@8&!C_`/\`
-M````````-C8V-C8V-C;_`````````#8V-C8V-O<`_P`````````8&!@8&!C_
-M&/\8&!@8&!@8-C8V-C8V-C;_-C8V-C8V-C8V-C8V-O<`]S8V-C8V-C8````\
-M0IFAH9E"/```````````````SMO;^]O;S@```````````'@,?,S,S'8`````
-M``(&/&!@?&9F9F8\````````````S,S,S,S,_@8&`````````!XV-F9F9O_#
-MPP````````!\QO[`P,9\```````````\&'[;V]O;?A@8/````````'XR,C`P
-M,'@```````````#&;#@X.&S&````````````QL;.UN;&Q@`````````X.,;&
-MSM;FQL8```````````#F;'AX;&;F````````````'C9F9F9F9@``````````
-M`,;N_O[6UL8```````````#&QL;^QL;&````````````?,;&QL;&?```````
-M`````/[&QL;&QL8```````````!^S,S\;,S.````````````W&9F9F9F?&!@
-M\````````'S&P,#`QGP```````````!^6A@8&!@\````````````QL;&QL9^
-M!@;&?````````-;65'Q4UM8```````````#\9F9\9F;\````````````\&!@
-M?&9F_````````````,;&QO;>WO8````````````\9@8,!F8\````````````
-MUM;6UM;6_@```````````#YG`Q\#9SX```````````#6UM;6UM;^`P,`````
-M````QL;&QGX&!@```````````/BP,#XS,WX```````#.V]O;^]O;V]O.````
-M````$#ALQL;^QL;&Q@```````/YB8F!\9F9F9OP```````#,S,S,S,S,S,S^
-M!@8`````'C9F9F9F9F9F_\.!`````/YF8FAX:&!B9OX``````#P8?MO;V]O;
-M?A@\````````_F)B8&!@8&!@\````````,;&;'PX.'QLQL8```````#&QL[.
-MUN;FQL;&`````#@XQL;.SM;FYL;&Q@```````.9F;&QX>&QL9N8````````>
-M-F;&QL;&QL;&````````QN[^_M;&QL;&Q@```````,;&QL;^QL;&QL8`````
-M``!\QL;&QL;&QL9\````````_L;&QL;&QL;&Q@```````#]F9F8^/F9F9N<`
-M``````#\9F9F?&!@8&#P````````/&;"P,#`P,)F/````````'Y:&!@8&!@8
-M&#P```````#&QL;&QGX&!L9\````````UM945'Q\5-;6U@```````/QF9F9\
-M9F9F9OP```````#P8&!@?&9F9F;\````````P\/#P_/;V]O;\P```````'S&
-M!@8\!@8&QGP```````#;V]O;V]O;V]O_````````>,P&)CXF!@;,>```````
-M`-O;V]O;V]O;V_\#`P````#&QL;&QGX&!@8&````````^+`P,#PV-C8V?```
-!`-O;
-`
-end
diff --git a/share/syscons/fonts/koi8c-8x16.fnt b/share/syscons/fonts/koi8c-8x16.fnt
deleted file mode 100644
index 4159dec..0000000
--- a/share/syscons/fonts/koi8c-8x16.fnt
+++ /dev/null
@@ -1,95 +0,0 @@
-begin 644 koi8c-8x16
-M````````````````````````?H&E@8&EF8&!?@```````'[_V___V^?__WX`
-M`````````&S^_O[^?#@0```````````0.'S^?#@0```````````8/#SGY^<8
-M&#P`````````&#Q^__]^&!@\`````````````!@\/!@```````#________G
-MP\/G________```````\9D)"9CP``````/______PYF]O9G#______\``!X&
-M#AIXS,S,S'@````````\9F9F9CP8?A@8````````/S,_,#`P,'#PX```````
-M`']C?V-C8V-GY^;`````````&!C;/.<\VQ@8``````"`P.#P^/[X\.#`@```
-M`````@8.'C[^/AX.!@(````````8/'X8&!A^/!@`````````9F9F9F9F9@!F
-M9@```````'_;V]M[&QL;&QL``````'S&8#ALQL9L.`S&?```````````````
-M_O[^_@```````!@\?A@8&'X\&'X````````8/'X8&!@8&!@8````````&!@8
-M&!@8&'X\&````````````!@,_@P8```````````````P8/Y@,```````````
-M`````,#`P/X``````````````"AL_FPH`````````````!`X.'Q\_OX`````
-M``````#^_GQ\.#@0```````````````````````````````8/#P\&!@8`!@8
-M``````!F9F8D``````````````````!L;/YL;&S^;&P`````&!A\QL+`?`8&
-MAL9\&!@```````#"Q@P8,&#&A@```````#AL;#AVW,S,S'8``````#`P,&``
-M````````````````#!@P,#`P,#`8#````````#`8#`P,#`P,&#``````````
-M``!F//\\9@``````````````&!A^&!@````````````````````8&!@P````
-M`````````/X````````````````````````8&````````````@8,&#!@P(``
-M```````X;,;&UM;&QFPX````````&#AX&!@8&!@8?@```````'S&!@P8,&#`
-MQOX```````!\Q@8&/`8&!L9\````````#!P\;,S^#`P,'@```````/[`P,#\
-M!@8&QGP````````X8,#`_,;&QL9\````````_L8&!@P8,#`P,````````'S&
-MQL9\QL;&QGP```````!\QL;&?@8&!@QX```````````8&````!@8````````
-M````&!@````8&#``````````!@P8,&`P&`P&````````````?@``?@``````
-M``````!@,!@,!@P8,&````````!\QL8,&!@8`!@8`````````'S&QM[>WMS`
-M?````````!`X;,;&_L;&QL8```````#\9F9F?&9F9F;\````````/&;"P,#`
-MP,)F/````````/AL9F9F9F9F;/@```````#^9F)H>&A@8F;^````````_F9B
-M:'AH8&!@\````````#QFPL#`WL;&9CH```````#&QL;&_L;&QL;&````````
-M/!@8&!@8&!@8/````````!X,#`P,#,S,S'@```````#F9F9L>'AL9F;F````
-M````\&!@8&!@8&)F_@```````,;N_O[6QL;&QL8```````#&YO;^WL[&QL;&
-M````````?,;&QL;&QL;&?````````/QF9F9\8&!@8/````````!\QL;&QL;&
-MUMY\#`X`````_&9F9GQL9F9FY@```````'S&QF`X#`;&QGP```````!^?EH8
-M&!@8&!@\````````QL;&QL;&QL;&?````````,;&QL;&QL9L.!````````#&
-MQL;&UM;6_NYL````````QL9L?#@X?&S&Q@```````&9F9F8\&!@8&#P`````
-M``#^QH8,&#!@PL;^````````/#`P,#`P,#`P/`````````"`P.!P.!P.!@(`
-M```````\#`P,#`P,#`P\`````!`X;,8`````````````````````````````
-M````_P``,#`8````````````````````````>`Q\S,S,=@```````.!@8'AL
-M9F9F9GP```````````!\QL#`P,9\````````'`P,/&S,S,S,=@``````````
-M`'S&_L#`QGP````````X;&1@\&!@8&#P````````````=LS,S,S,?`S,>```
-M`.!@8&QV9F9F9N8````````8&``X&!@8&!@\````````!@8`#@8&!@8&!F9F
-M/````.!@8&9L>'AL9N8````````X&!@8&!@8&!@\````````````[/[6UM;6
-MQ@```````````-QF9F9F9F8```````````!\QL;&QL9\````````````W&9F
-M9F9F?&!@\````````';,S,S,S'P,#!X```````#<=F9@8&#P````````````
-M?,9@.`S&?````````!`P,/PP,#`P-AP```````````#,S,S,S,QV````````
-M````9F9F9F8\&````````````,;&UM;6_FP```````````#&;#@X.&S&````
-M````````QL;&QL;&?@8,^````````/[,&#!@QOX````````.&!@8<!@8&!@.
-M````````&!@8&``8&!@8&````````'`8&!@.&!@8&'````````!VW```````
-M```````````````0.&S&QL;^````````````````_P``````````&!@8&!@8
-M&!@8&!@8&!@8&``````````?&!@8&!@8&!@`````````^!@8&!@8&!@8&!@8
-M&!@8&!\``````````!@8&!@8&!CX```````````8&!@8&!@8'Q@8&!@8&!@8
-M&!@8&!@8&/@8&!@8&!@8&`````````#_&!@8&!@8&!@8&!@8&!@8_P``````
-M````&!@8&!@8&/\8&!@8&!@8&/________\`````````````````````____
-M______________________________#P\/#P\/#P\/#P\/#P\/`/#P\/#P\/
-M#P\/#P\/#P\/$4011!%$$4011!%$$4011%6J5:I5JE6J5:I5JE6J5:K==]UW
-MW7?==]UWW7?==]UW```.&QL8&!@8&!@8&!@8&`````!\?'Q\?'Q\````````
-M````````&!@```````````\,#`P,#.QL;#P<````````````=MP`=MP`````
-M```````,&#!@,!@,`'X`````````,!@,!@P8,`!^````````````````````
-M```````8&!@8&!@8&-C8V'```````#AL;#@```````````````!PV#!@R/@`
-M`````````````````````!@``````````````!@8`'X`&!@`````````_L;&
-MQL;&QL;&QOX``````&#P8&QV9F9F9N8&##`````8$`#^PL#`P,#`````````
-M;&P`?,;&_,#&?````````````#QBP/C`8CP```````````!\QL!\!L9\````
-M````&!``>#`P,#`P>````````#8D`'@P,#`P,'@````````,"``\&!@8&!@8
-M&+!@````````/$Q,3DE)S@```````````,S,S/[)R<X```````!@\&!@?&9F
-M9F;F````````&!``QLS8^-C,Q@```````````O[`P,#`P,`````````D&`#&
-MQL;&QL9^!L9\````````QL;&QL;&_A`0.```````!XC+JZBKFX@``````&#X
-M8&!\=F9F9F;G`````!@0_F9B8&!@8&!@\`````!F9@#^QL#`\,#`QOX`````
-M```\9L#`Z-#`P&8\````````?,;&8#@,!L;&?``````,&``\&!@8&!@8&#P`
-M````-B0`/!@8&!@8&!@\``````P8`#P8&!@8&!@8&+!@`````'QL;&QN:6EI
-M:<X```````#,S,S,_LG)R<G.``````#P8&!@?&9F9F9FYP`````8$,;&S-CP
-M\-C,QL8``````@;^P,#`P,#`P,#``````&PXQL;&QL;&?@;&?````````,;&
-MQL;&QL;&QOX0$#@```````"<MK;VMK:<````````````?,;&QO[&Q@``````
-M`````/[`_,;&QOP```````````#,S,S,S,S^!@P`````````/&QL;&QL_L:"
-M`````````'S&QOS`QGP``````````!!\UM;6UM9\$#@`````````_L;"P,#`
-MP````````````,9L.#ALQL8```````````#&QL[>]N;&``````````P8QL;.
-MWO;FQ@```````````,;,V/C8S,8````````````^9F9F9F;&````````````
-MQN[^UL;&Q@```````````,;&QO[&QL8```````````!^QL;&QL;\````````
-M````_L;&QL;&Q@```````````'[&QGXV9L8```````````#\QL;&QL;\P,#`
-M````````?,;`P,+&?````````````'Y:&!@8&!@```````````#&QL;&QL9^
-M!L9\````````UM;6?-;6U@```````````/S&QOS&QOP```````````#`P/S&
-MQL;\````````````QL;FMK:VY@```````````'S&!AP&QGP```````````#6
-MUM;6UM;^````````````?,8&'@;&?````````````-;6UM;6UOX"!@0`````
-M``#&QL;&?@8&````````````X&!\9F9F?````````)RVMK;VMK:VMIP`````
-M```^9L;&QO[&QL;&````````_L#`P/S&QL;&_````````,S,S,S,S,S,S/X"
-M!@0````\;&QL;&QL;&S^QH(`````_L;`P/#`P,#&_@```````'S6UM;6UM9\
-M$#@```````#^QL#`P,#`P,#`````````QL9L.#ALQL;&Q@```````,;&QL;.
-MWO;FQL8```````S:QL;&SM[VYL;&````````QLS8\/#8S,;&Q@```````!XV
-M9L;&QL;&QL8```````#&QN[N_O[6UL;&````````QL;&QO[&QL;&Q@``````
-M`'[&QL;&QL;&QOP```````#^QL;&QL;&QL;&````````?L;&QL9^-F;&Q@``
-M`````/S&QL;&QOS`P,````````!\QL;`P,#`QL9\````````?GY:&!@8&!@8
-M&````````,;&QL;&QGX&QGP```````#6UM94?-;6UM;6````````_,;&QOS&
-MQL;&_````````,#`P,#\QL;&QOP```````#&QL;&YK:VMK;F````````?,8&
-M!AP&!L;&?````````-;6UM;6UM;6UOX```````!XS`8&'AX&!LQX````````
-MUM;6UM;6UM;6_@(&!````,;&QL;&?@8&!@8```````#@X&!@?&9F9F9\````
-!`-;6
-`
-end
diff --git a/share/syscons/scrnmaps/default b/share/syscons/scrnmaps/default
deleted file mode 100644
index e77969d..0000000
--- a/share/syscons/scrnmaps/default
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 1994 by Andrew A. Chernov, Moscow, Russia.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-scrmap_t scrmap = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
- 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
- 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
- 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
- 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
- 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
- 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
- 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
- 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
- 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
-};
diff --git a/share/syscons/scrnmaps/koi8-r2cp866.scm b/share/syscons/scrnmaps/koi8-r2cp866.scm
deleted file mode 100644
index 9470af1..0000000
--- a/share/syscons/scrnmaps/koi8-r2cp866.scm
+++ /dev/null
@@ -1,9 +0,0 @@
-begin 444 koi8-r2cp866
-M``$"`P0%!@<("0H+#`T.#Q`1$A,4%187&!D:&QP='A\@(2(C)"4F)R@I*BLL
-M+2XO,#$R,S0U-C<X.3H[/#T^/T!!0D-$149'2$E*2TQ-3D]045)35%565UA9
-M6EM<75Y?8&%B8V1E9F=H:6IK;&UN;W!Q<G-T=79W>'EZ>WQ]?G_$L]J_P-G#
-MM,+!Q=_<V]W>L+&R]/[Y^_?S\O_U^/WZ]LVZU?'6R;BWN]33R+Z]O,;'S+7P
-MMKG1TLO/T,K8U\[\[J"AYJ2EY*/EJ*FJJZRMKJ_OX.'BXZ:B[.NGZ.WIY^J>
-?@(&6A(64@Y6(B8J+C(V.CY^0D9*3AH*<FX>8G9F7FN'B
-`
-end
diff --git a/share/termcap/terminfo_extentions.doc b/share/termcap/terminfo_extentions.doc
deleted file mode 100644
index af79576..0000000
--- a/share/termcap/terminfo_extentions.doc
+++ /dev/null
@@ -1,476 +0,0 @@
-# These are the boolean capabilities
-auto_left_margin "bw" bool "bw" cub1 wraps from column 0 to last column
-auto_right_margin "am" bool "am" terminal has automatic margins
-no_esc_ctlc "xsb" bool "xb" beehive (f1=escape, f2=ctrl C)
-ceol_standout_glitch "xhp" bool "xs" stnadout not erased by overwriting (hp)
-eat_newline_glitch "xenl" bool "xn" newline ignored after 80 cols (concept)
-erase_overstrike "eo" bool "eo" can erase overstrikes with a blank
-generic_type "gn" bool "gn" generic line type
-hard_copy "hc" bool "hc" hardcopy terminal
-has_meta_key "km" bool "km" Has a meta key, sets msb high
-has_status_line "hs" bool "hs" has extra status line
-insert_null_glitch "in" bool "in" insert mode distinguishes nulls
-memory_above "da" bool "da" display may be retained above the screen
-memory_below "db" bool "db" display may be retained below the screen
-move_insert_mode "mir" bool "mi" safe to move while in insert mode
-move_standout_mode "msgr" bool "ms" safe to move while in standout mode
-over_strike "os" bool "os" terminal can overstrike
-status_line_esc_ok "eslok" bool "es" escape can be used on the status line
-dest_tabs_magic_smso "xt" bool "xt" tabs destructive, magic so char (t1061)
-tilde_glitch "hz" bool "hz" can't print ~'s (hazeltine)
-transparent_underline "ul" bool "ul" underline character overstrikes
-xon_xoff "xon" bool "xo" terminal uses xon/xoff handshaking
-needs_xon_xoff "nxon" bool "nx" padding won't work, xon/xoff required
-prtr_silent "mc5i" bool "5i" printer won't echo on screen
-hard_cursor "chts" bool "HC" cursor is hard to see
-non_rev_rmcup "nrrmc" bool "NR" smcup does not revrse rmcup
-no_pad_char "npc" bool "NP" pad character does not exist
-non_dest_scroll_region "ndscr" bool "ND" scrolling region is non-destructive
-can_change "ccc" bool "cc" terminal can re-define exiting colors
-back_color_erase "bce" bool "ut" screen erased with background color
-hue_lightness_saturation "hls" bool "hl" terminal uses only HLS color notation (tektronix)
-col_addr_glitch "xhpa" bool "YA" only positive motion for hpa/mhpa caps
-cr_cancels_micro_mode "crxm" bool "YB" using cr turns off micro mode
-has_print_wheel "daisy" bool "YC" printer needs operator to change character set
-row_addr_glitch "xvpa" bool "YD" only posistive motion for vhp/mvpa caps
-semi_auto_right_margin "sam" bool "YE" printing in last column causes cr
-cpi_changes_res "cpix" bool "YF" changing character pitch changes resolution
-lpi_changes_res "lpix" bool "YG" chnaging line pitch changes resolution
-# These are the numerical capabilities
-columns "cols" num "co" number of columns in aline
-init_tabs "it" num "it" tabs initially every # spaces
-lines "lines" num "li" number of lines on screen or page
-lines_of_memory "lm" num "lm" lines of memory if > line. 0 => varies
-magic_cookie_glitch "xmc" num "sg" number of blank chars left by smso or rmso
-padding_baud_rate "pb" num "pb" lowest baud rate where padding needed
-virtual_terminal "vt" num "vt" virtual terminal number (CB/unix)
-width_status_line "wsl" num "ws" columns in status line
-num_labels "nlab" num "Nl" number of lables on screen
-label_height "lh" num "lh" rows in each label
-label_width "lw" num "lw" columns in each label
-max_attributes "ma" num "ma" maximum combined attributes terminal can handle
-maximum_windows "wnum" num "MW" maxumum number of defineable windows
-# These are newer capabilities, order is probably wrong
-max_colors "colors" num "Co" maximum numbers of colors on screen
-max_pairs "pairs" num "pa" maximum number of color-pairs on the screen
-no_color_video "ncv" num "NC" video attributes that can't be used with colors
-buffer_capacity "bufsz" num "Ya" numbers of bytes buffered before printing
-dot_horz_spacing "spinh" num "Yc" spacing of pins vertically in pins per inch
-dot_vert_spacing "spinv" num "Yb" spacing of dots horizontally in dots per inch
-max_micro_address "maddr" num "Yd" maximum value in micro_..._address
-max_micro_jump "mjump" num "Ye" maximum value in parm_..._micro
-micro_char_size "mcs" num "Yf" character size when in micro mode
-micro_line_size "mls" num "Yg" line size when in micro mode
-number_of_pins "npins" num "Yh" numbers of pins in print-head
-output_res_char "orc" num "Yi" horizontal resolution in units per line
-output_res_line "orl" num "Yj" vertical resolution in units per line
-output_res_horz_inch "orhi" num "Yk" horizontal resolution in units per inch
-output_res_vert_inch "orvi" num "Yl" vertical resolution in units per inch
-print_rate "cps" num "Ym" print rate in chars per second
-wide_char_size "widcs" num "Yn" character step size when in double wide mode
-buttons "btns" num "BT" number of buttons on mouse
-bit_image_entwining "bitwin" num "Yo" number of passed for each bit-image row
-bit_image_type "bitype" num "Yp" type of bit-image device
-# These are the string capabilities
-back_tab "cbt" str "bt" back tab
-bell "bel" str "bl" audible signal (bell)
-carriage_return "cr" str "cr" carriage return
-change_scroll_region "csr" str "cs" change region to line #1 to line #2
-clear_all_tabs "tbc" str "ct" clear all tab stops
-clear_screen "clear" str "cl" clear screen and home cursor
-clr_eol "el" str "ce" clear to end of line
-clr_eos "ed" str "cd" clear to edn of screen
-column_address "hpa" str "ch" horizontal position, absolute
-command_character "cmdch" str "CC" terminal settable cmd character in prototype !?
-cursor_address "cup" str "cm" move to row #1 columns #2
-cursor_down "cud1" str "do" down one line
-cursor_home "home" str "ho" home cursor (if no cup)
-cursor_invisible "civis" str "vi" make cursor invisible
-cursor_left "cub1" str "le" move left one space
-cursor_mem_address "mrcup" str "CM" memory relative cursor addressing
-cursor_normal "cnorm" str "ve" make cursor appear normal (undo civis/cvvis)
-cursor_right "cuf1" str "nd" move right one space
-cursor_to_ll "ll" str "ll" last line, first column (if no cup)
-cursor_up "cuu1" str "up" up one line
-cursor_visible "cvvis" str "vs" make cursor very visible
-delete_character "dch1" str "dc" delete character
-delete_line "dl1" str "dl" delete line
-dis_status_line "dsl" str "ds" disable status line
-down_half_line "hd" str "hd" half a line down
-enter_alt_charset_mode "smacs" str "as" start alternate character set
-enter_blink_mode "blink" str "mb" turn on blinking
-enter_bold_mode "bold" str "md" turn on bold (extra bright) mode
-enter_ca_mode "smcup" str "ti" string to start programs using cup
-enter_delete_mode "smdc" str "dm" enter delete mode
-enter_dim_mode "dim" str "mh" turn on half-bright mode
-enter_insert_mode "smir" str "im" enter insert mode
-enter_secure_mode "invis" str "mk" turn on blank mode (characters invisible)
-enter_protected_mode "prot" str "mp" turn on protected mode
-enter_reverse_mode "rev" str "mr" turn on reverse video mode
-enter_standout_mode "smso" str "so" begin standout mode
-enter_underline_mode "smul" str "us" begin underline mode
-erase_chars "ech" str "ec" erase #1 characters
-exit_alt_charset_mode "rmacs" str "ae" end alternate character set
-exit_attribute_mode "sgr0" str "me" turn off all attributes
-exit_ca_mode "rmcup" str "te" strings to end programs using cup
-exit_delete_mode "rmdc" str "ed" end delete mode
-exit_insert_mode "rmir" str "ei" exit insert mode
-exit_standout_mode "rmso" str "se" exit standout mode
-exit_underline_mode "rmul" str "ue" exit underline mode
-flash_screen "flash" str "vb" visible bell (may not move cursor)
-form_feed "ff" str "ff" hardcopy terminal page eject
-from_status_line "fsl" str "fs" return from status line
-init_1string "is1" str "i1" initialization string
-init_2string "is2" str "is" initialization string
-init_3string "is3" str "i3" initialization string
-init_file "if" str "if" name of initialization file
-insert_character "ich1" str "ic" insert character
-insert_line "il1" str "al" insert line
-insert_padding "ip" str "ip" insert padding after inserted character
-key_backspace "kbs" str "kb" backspace key
-key_catab "ktbc" str "ka" clear-all-tabs key
-key_clear "kclr" str "kC" clear-screen or erase key
-key_ctab "kctab" str "kt" clear-tab key
-key_dc "kdch1" str "kD" delete-character key
-key_dl "kdl1" str "kL" delete-line key
-key_down "kcud1" str "kd" down-arrow key
-key_eic "krmir" str "kM" sent by rmir or smir in insert mode
-key_eol "kel" str "kE" clear-to-end-of-line key
-key_eos "ked" str "kS" clear-to-end-of-screen key
-key_f0 "kf0" str "k0" F0 function key
-key_f1 "kf1" str "k1" F1 function key
-key_f10 "kf10" str "k;" F10 function key
-key_f2 "kf2" str "k2" F2 function key
-key_f3 "kf3" str "k3" F3 function key
-key_f4 "kf4" str "k4" F4 function key
-key_f5 "kf5" str "k5" F5 function key
-key_f6 "kf6" str "k6" F6 function key
-key_f7 "kf7" str "k7" F7 function key
-key_f8 "kf8" str "k8" F8 fucntion key
-key_f9 "kf9" str "k9" F9 function key
-key_home "khome" str "kh" home key
-key_ic "kich1" str "kI" insert-character key
-key_il "kil1" str "kA" insert-line key
-key_left "kcub1" str "kl" left-arrow key
-key_ll "kll" str "kH" last-line key
-key_npage "knp" str "kN" next-page key
-key_ppage "kpp" str "kP" prev-page key
-key_right "kcuf1" str "kr" right-arrow key
-key_sf "kind" str "kF" scroll-forward key
-key_sr "kri" str "kR" scroll-backward key
-key_stab "khts" str "kT" set-tab key
-key_up "kcuu1" str "ku" up-arrow key
-keypad_local "rmkx" str "ke" out of 'keyboard_transmit' mode
-keypad_xmit "smkx" str "ks" enter into 'keyboard_transmit' mode
-lab_f0 "lf0" str "l0" label on function key f0 if not f0
-lab_f1 "lf1" str "l1" label on function key f1 if not f1
-lab_f10 "lf10" str "la" label on function key f10 if not f10
-lab_f2 "lf2" str "l2" label on function key f2 if not f2
-lab_f3 "lf3" str "l3" label on function key f3 if not f3
-lab_f4 "lf4" str "l4" label on function key f4 if not f4
-lab_f5 "lf5" str "l5" lable on function key f5 if not f5
-lab_f6 "lf6" str "l6" label on function key f6 if not f6
-lab_f7 "lf7" str "l7" label on function key f7 if not f7
-lab_f8 "lf8" str "l8" label on function key f8 if not f8
-lab_f9 "lf9" str "l9" label on function key f9 if not f9
-meta_off "rmm" str "mo" turn off meta mode
-meta_on "smm" str "mm" turn on meta mode (8th-bit on)
-newline "nel" str "nw" newline (behave like cr followed be lf)
-pad_char "pad" str "pc" padding char (instead of null)
-parm_dch "dch" str "DC" delete #1 chars
-parm_delete_line "dl" str "DL" delete #1 lines
-parm_down_cursor "cud" str "DO" down #1 lines
-parm_ich "ich" str "IC" insert #1 chars
-parm_index "indn" str "SF" scroll forward #1 lines
-parm_insert_line "il" str "AL" insert #1 lines
-parm_left_cursor "cub" str "LE" move #1 chars to the left
-parm_right_cursor "cuf" str "RI" move #1 chars to the right
-parm_rindex "rin" str "SR" scroll back #1 lines
-parm_up_cursor "cuu" str "UP" up #1 lines
-pkey_key "pfkey" str "pk" program function key #1 to type string #2
-pkey_local "pfloc" str "pl" program function key #1 to execute string #2
-pkey_xmit "pfx" str "px" program function key #1 to transmit string #2
-print_screen "mc0" str "ps" print contents of screen
-prtr_off "mc4" str "pf" turn off printer
-prtr_on "mc5" str "po" turn on printer
-repeat_char "rep" str "rp" repeat char #1 #2 times
-reset_1string "rs1" str "r1" reset string
-reset_2string "rs2" str "r2" reset string
-reset_3string "rs3" str "r3" reset string
-reset_file "rf" str "rf" name of reset file
-restore_cursor "rc" str "rc" restore cursor to last position of sc
-row_address "vpa" str "cv" vertical position absolute
-save_cursor "sc" str "sc" save current cursor position
-scroll_forward "ind" str "sf" scroll text up
-scroll_reverse "ri" str "sr" scroll text down
-set_attributes "sgr" str "sa" define video attributes #1-#9
-set_tab "hts" str "st" set a tab in every row, current columns
-set_window "wind" str "wi" current window is lines #1-#2 cols #3-#4
-tab "ht" str "ta" tab to next 8-space hardware tab stop
-to_status_line "tsl" str "ts" move to status line
-underline_char "uc" str "uc" underline char and move past it
-up_half_line "hu" str "hu" half a line up
-init_prog "iprog" str "iP" path name of program for initialization
-key_a1 "ka1" str "K1" upper left of keypad
-key_a3 "ka3" str "K3" upper right of keypad
-key_b2 "kb2" str "K2" center of keypad
-key_c1 "kc1" str "K4" lower left of keypad
-key_c3 "kc3" str "K5" lower right of keypad
-prtr_non "mc5p" str "pO" turn on printer for #1 bytes
-char_padding "rmp" str "rP" like ip but when in insert mode
-acs_chars "acsc" str "ac" graphics charset pairs - def=vt100
-plab_norm "pln" str "pn" program label #1 to show string #2
-key_btab "kcbt" str "kB" back-tab key
-enter_xon_mode "smxon" str "SX" turn on xon/xoff handshaking
-exit_xon_mode "rmxon" str "RX" turn off xon/xoff handshaking
-enter_am_mode "smam" str "SA" turn on automatic margins
-exit_am_mode "rmam" str "RA" turn off automatic margins
-xoff_character "xoffc" str "XF" XON character
-xon_character "xonc" str "XN" XOFF character
-ena_acs "enacs" str "eA" enable alternate char set
-label_on "smln" str "LO" turn on soft labels
-label_off "rmln" str "LF" turn off soft labels
-key_beg "kbeg" str "@1" begin key
-key_cancel "kcan" str "@2" cancel key
-key_close "kclo" str "@3" close key
-key_command "kcmd" str "@4" command key
-key_copy "kcpy" str "@5" copy key
-key_create "kcrt" str "@6" create key
-key_end "kend" str "@7" end key
-key_enter "kent" str "@8" enter/send key
-key_exit "kext" str "@9" exit key
-key_find "kfnd" str "@0" find key
-key_help "khlp" str "%1" help key
-key_mark "kmrk" str "%2" mark key
-key_message "kmsg" str "%3" message key
-key_move "kmov" str "%4" move key
-key_next "knxt" str "%5" next key
-key_open "kopn" str "%6" open key
-key_options "kopt" str "%7" options key
-key_previous "kprv" str "%8" previous key
-key_print "kprt" str "%9" print key
-key_redo "krdo" str "%0" redo key
-key_reference "kref" str "&1" reference key
-key_refresh "krfr" str "&2" refresh key
-key_replace "krpl" str "&3" replace key
-key_restart "krst" str "&4" restart key
-key_resume "kres" str "&5" resume key
-key_save "ksav" str "&6" save key
-key_suspend "kspd" str "&7" suspend key
-key_undo "kund" str "&8" undo key
-key_sbeg "kBEG" str "&9" shifted key
-key_scancel "kCAN" str "&0" shifted key
-key_scommand "kCMD" str "*1" shifted key
-key_scopy "kCPY" str "*2" shifted key
-key_screate "kCRT" str "*3" shifted key
-key_sdc "kDC" str "*4" shifted key
-key_sdl "kDL" str "*5" shifted key
-key_select "kslt" str "*6"
-key_send "kEND" str "*7" shifted key
-key_seol "kEOL" str "*8" shifted key
-key_sexit "kEXT" str "*9" shifted key
-key_sfind "kFND" str "*0" shifted key
-key_shelp "kHLP" str "#1" shifted key
-key_shome "kHOM" str "#2" shifted key
-key_sic "kIC" str "#3" shifted key
-key_sleft "kLFT" str "#4" shifted key
-key_smessage "kMSG" str "%a" shifted key
-key_smove "kMOV" str "%b" shifted key
-key_snext "kNXT" str "%c" shifted key
-key_soptions "kOPT" str "%d" shifted key
-key_sprevious "kPRV" str "%e" shifted key
-key_sprint "kPRT" str "%f" shifted key
-key_sredo "kRDO" str "%g" shifted key
-key_sreplace "kRPL" str "%h" shifted key
-key_sright "kRIT" str "%i" shifted key
-key_srsume "kRES" str "%j" shifted key
-key_ssave "kSAV" str "!1" shifted key
-key_ssuspend "kSPD" str "!2" shifted key
-key_sundo "kUND" str "!3" shifted key
-req_for_input "rfi" str "RF"
-key_f11 "kf11" str "F1" F11 function key
-key_f12 "kf12" str "F2" F11 function key
-key_f13 "kf13" str "F3" F11 function key
-key_f14 "kf14" str "F4" F11 function key
-key_f15 "kf15" str "F5" F11 function key
-key_f16 "kf16" str "F6" F11 function key
-key_f17 "kf17" str "F7" F11 function key
-key_f18 "kf18" str "F8" F11 function key
-key_f19 "kf19" str "F9" F11 function key
-key_f20 "kf20" str "FA" F11 function key
-key_f21 "kf21" str "FB" F11 function key
-key_f22 "kf22" str "FC" F11 function key
-key_f23 "kf23" str "FD" F11 function key
-key_f24 "kf24" str "FE" F11 function key
-key_f25 "kf25" str "FF" F11 function key
-key_f26 "kf26" str "FG" F11 function key
-key_f27 "kf27" str "FH" F11 function key
-key_f28 "kf28" str "FI" F11 function key
-key_f29 "kf29" str "FJ" F11 function key
-key_f30 "kf30" str "FK" F11 function key
-key_f31 "kf31" str "FL" F11 function key
-key_f32 "kf32" str "FM" F11 function key
-key_f33 "kf33" str "FN" F11 function key
-key_f34 "kf34" str "FO" F11 function key
-key_f35 "kf35" str "FP" F11 function key
-key_f36 "kf36" str "FQ" F11 function key
-key_f37 "kf37" str "FR" F11 function key
-key_f38 "kf38" str "FS" F11 function key
-key_f39 "kf39" str "FT" F11 function key
-key_f40 "kf40" str "FU" F11 function key
-key_f41 "kf41" str "FV" F11 function key
-key_f42 "kf42" str "FW" F11 function key
-key_f43 "kf43" str "FX" F11 function key
-key_f44 "kf44" str "FY" F11 function key
-key_f45 "kf45" str "FZ" F11 function key
-key_f46 "kf46" str "Fa" F11 function key
-key_f47 "kf47" str "Fb" F11 function key
-key_f48 "kf48" str "Fc" F11 function key
-key_f49 "kf49" str "Fd" F11 function key
-key_f50 "kf50" str "Fe" F11 function key
-key_f51 "kf51" str "Ff" F11 function key
-key_f52 "kf52" str "Fg" F11 function key
-key_f53 "kf53" str "Fh" F11 function key
-key_f54 "kf54" str "Fi" F11 function key
-key_f55 "kf55" str "Fj" F11 function key
-key_f56 "kf56" str "Fk" F11 function key
-key_f57 "kf57" str "Fl" F11 function key
-key_f58 "kf58" str "Fm" F11 function key
-key_f59 "kf59" str "Fn" F11 function key
-key_f60 "kf60" str "Fo" F11 function key
-key_f61 "kf61" str "Fp" F11 function key
-key_f62 "kf62" str "Fq" F11 function key
-key_f63 "kf63" str "Fr" F11 function key
-clr_bol "el1" str "cb" Clear to beginning of line
-clear_margins "mgc" str "MC" clear righ and left soft margins
-set_left_margin "smgl" str "ML" set left soft margin
-set_right_margin "smgr" str "MR" set right soft margin
-label_format "fln" str "Lf" label format
-set_clock "sclk" str "SC" set clock
-display_clock "dclk" str "DK" display clock
-remove_clock "rmclk" str "RC" remove clock
-create_window "cwin" str "CW" define a window #1 from #2, #3 to #4, #5
-goto_window "wingo" str "WG" go to window #1
-hangup "hup" str "HU" hang-up phone
-dial_phone "dial" str "DI" dial number #1
-quick_dial "qdial" str "QD" dial number #1 without checking
-tone "tone" str "TO" select touch tone dialing
-pulse "pulse" str "PU" select pulse dialling
-flash_hook "hook" str "fh" flash switch hook
-fixed_pause "pause" str "PA" pause for 2-3 seconds
-wait_tone "wait" str "WA" wait for dial-tone
-user0 "u0" str "u0" User string # 0
-user1 "u1" str "u1" User string # 1
-user2 "u2" str "u2" User string # 2
-user3 "u3" str "u3" User string # 3
-user4 "u4" str "u4" User string # 4
-user5 "u5" str "u5" User string # 5
-user6 "u6" str "u6" User string # 6
-user7 "u7" str "u7" User string # 7
-user8 "u8" str "u8" User string # 8
-user9 "u9" str "u9" User string # 9
-orig_pair "op" str "op"
-orig_colors "oc" str "oc"
-initialize_color "initc" str "Ic"
-initialize_pair "initp" str "Ip"
-set_color_pair "scp" str "sp"
-set_foreground "setf" str "Sf"
-set_background "setb" str "Sb"
-change_char_pitch "cpi" str "ZA"
-change_line_pitch "lpi" str "ZB"
-change_res_horz "chr" str "ZC"
-change_res_vert "cvr" str "ZD"
-define_char "defc" str "ZE"
-enter_doublewide_mode "swidm" str "ZF"
-enter_draft_quality "sdrfq" str "ZG"
-enter_italics_mode "sitm" str "ZH"
-enter_leftward_mode "slm" str "ZI"
-enter_micro_mode "smicm" str "ZJ"
-enter_near_letter_quality "snlq" str "ZK"
-enter_normal_quality "snrmq" str "ZL"
-enter_shadow_mode "sshm" str "ZM"
-enter_subscript_mode "ssubm" str "ZN"
-enter_superscript_mode "ssupm" str "ZO"
-enter_upward_mode "sum" str "ZP"
-exit_doublewide_mode "rwidm" str "ZQ"
-exit_italics_mode "ritm" str "ZR"
-exit_leftward_mode "rlm" str "ZS"
-exit_micro_mode "rmicm" str "ZT"
-exit_shadow_mode "rshm" str "ZU"
-exit_subscript_mode "rsubm" str "ZV"
-exit_superscript_mode "rsupm" str "ZW"
-exit_upward_mode "rum" str "ZX"
-micro_column_address "mhpa" str "ZY"
-micro_down "mcud1" str "ZZ"
-micro_left "mcub1" str "Za"
-micro_right "mcuf1" str "Zb"
-micro_row_address "mvpa" str "Zc"
-micro_up "mcuu1" str "Zd"
-order_of_pins "porder" str "Ze"
-parm_down_micro "mcud" str "Zf"
-parm_left_micro "mcub" str "Zg"
-parm_right_micro "mcuf" str "Zh"
-parm_up_micro "mcuu" str "Zi"
-select_char_set "scs" str "Zj"
-set_bottom_margin "smgb" str "Zk"
-set_bottom_margin_parm "smgbp" str "Zl"
-set_left_margin_parm "smglp" str "Zm"
-set_right_margin_parm "smgrp" str "Zn"
-set_top_margin "smgt" str "Zo"
-set_top_margin_parm "smgtp" str "Zp"
-start_bit_image "sbim" str "Zq"
-start_char_set_def "scsd" str "Zr"
-stop_bit_image "rbim" str "Zs"
-stop_char_set_def "rcsd" str "Zt"
-subscript_characters "subcs" str "Zu"
-superscript_characters "supcs" str "Zv"
-these_cause_cr "docr" str "Zw"
-zero_motion "zerom" str "Zx"
-char_set_names "csnm" str "Zy"
-key_mouse "kmous" str "Km"
-mouse_info "minfo" str "Mi"
-req_mouse_pos "reqmp" str "RQ"
-get_mouse "getm" str "Gm"
-set_a_foreground "setaf" str "AF"
-set_a_background "setab" str "AB"
-pkey_plab "pfxl" str "xl"
-device_type "devt" str "dv"
-code_set_init "csin" str "ci"
-set0_des_seq "s0ds" str "s0"
-set1_des_seq "s1ds" str "s1"
-set2_des_seq "s2ds" str "s2"
-set3_des_seq "s3ds" str "s3"
-set_lr_margin "smglr" str "ML"
-set_tb_margin "smgtb" str "MT"
-bit_image_repeat "birep" str "Xy"
-bit_image_newline "binel" str "Zz"
-bit_image_carriage_return "bicr" str "Yv"
-color_names "colornm" str "Yw"
-define_bit_image_region "defbi" str "Yx"
-end_bit_image_region "endbi" str "Yy"
-set_color_band "setcolor" str "Yz"
-set_page_length "slines" str "YZ"
-display_pc_char "dispc" str "S1"
-enter_pc_charset_mode "smpch" str "S2"
-exit_pc_charset_mode "rmpch" str "S3"
-enter_scancode_mode "smsc" str "S4"
-exit_scancode_mode "rmsc" str "S5"
-pc_term_options "pctrm" str "S6"
-scancode_escape "scesc" str "S7"
-alt_scancode_esc "scesa" str "S8"
-# These capabilities or either obselete or extentions on certain systems
-# They are not used by SVR4 terminfo, so I have no idea in order they
-# should be
-backspace_if_not_bs "OTbc" str "bc"
-other_non_function_keys "OTko" str "ko"
-arrow_key_map "OTma" str "ma"
-memory_lock_above "OTml" str "ml"
-memory_unlock "OTmu" str "mu"
-linefeed_if_not_lf "OTnl" str "nl"
-key_interrupt_char "UWki" str "ki"
-key_kill_char "UWkk" str "kk"
-key_suspend_char "UWkz" str "kz"
-scroll_left "sl1" str "Sl"
-scroll_right "sr1" str "Sr"
-parm_scroll_left "sl" str "SL"
-parm_scroll_right "sr" str "SR"
diff --git a/share/timedef/data/ru_SU.KOI8-R b/share/timedef/data/ru_SU.KOI8-R
deleted file mode 100644
index c51ad3f..0000000
--- a/share/timedef/data/ru_SU.KOI8-R
+++ /dev/null
@@ -1,78 +0,0 @@
-# $Id$
-#
-# WARNING: spaces may be essential at the end of lines
-# WARNING: empty lines are essential too
-#
-# Short months names
-#
-ÑÎ×
-ÆÅ×
-ÍÁÒ
-ÁÐÒ
-ÍÁÑ
-ÉÀÎ
-ÉÀÌ
-Á×Ç
-ÓÅÎ
-ÏËÔ
-ÎÏÑ
-ÄÅË
-#
-# Long months names
-#
-ÑÎ×ÁÒÑ
-ÆÅ×ÒÁÌÑ
-ÍÁÒÔÁ
-ÁÐÒÅÌÑ
-ÍÁÑ
-ÉÀÎÑ
-ÉÀÌÑ
-Á×ÇÕÓÔÁ
-ÓÅÎÔÑÂÒÑ
-ÏËÔÑÂÒÑ
-ÎÏÑÂÒÑ
-ÄÅËÁÂÒÑ
-#
-# Short weekdays names
-#
-×ÏÓ
-ÐÏÎ
-×ÔÏ
-ÓÒÅ
-ÞÅÔ
-ÐÑÔ
-ÓÕÂ
-#
-# Long weekdays names
-#
-×ÏÓËÒÅÓÅÎØÅ
-ÐÏÎÅÄÅÌØÎÉË
-×ÔÏÒÎÉË
-ÓÒÅÄÁ
-ÞÅÔ×ÅÒÇ
-ÐÑÔÎÉÃÁ
-ÓÕÂÂÏÔÁ
-#
-# X_fmt
-#
-%H:%M:%S
-#
-# x_fmt
-#
-%d.%m.%y
-#
-# c_fmt
-#
-%a %e %b %X %Y
-#
-# am
-# (two spaces)
-
-#
-# pm
-#
-ÐÐ
-#
-# date_fmt
-#
-%a %e %b %X %Z %Y
diff --git a/share/tmac/Makefile b/share/tmac/Makefile
deleted file mode 100644
index 0c81cba..0000000
--- a/share/tmac/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/8/93
-
-# XXX MISSING: tmac.r
-FILES= tmac.andoc tmac.s tmac.e
-MSRCS= doc doc-ditroff doc-common doc-nroff doc-syms
-
-LINKS= ${BINDIR}/tmac/tmac.andoc ${BINDIR}/tmac/tmac.an
-NOOBJ= noobj
-
-# old macros not currently installed...
-# OFILES= tmac.a tmac.cp
-
-all clean cleandir depend lint tags:
-
-beforeinstall:
- for i in ${MSRCS}; do \
- sed -f strip.sed < $$i > ${DESTDIR}${BINDIR}/tmac/tmac.$$i; \
- chown ${BINOWN}.${BINGRP} ${DESTDIR}${BINDIR}/tmac/tmac.$$i; \
- chmod 444 ${DESTDIR}${BINDIR}/tmac/tmac.$$i; \
- done
- install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${FILES} \
- ${DESTDIR}${BINDIR}/tmac
-
-
-.include <bsd.prog.mk>
diff --git a/share/zoneinfo/datfiles/asia b/share/zoneinfo/datfiles/asia
deleted file mode 100644
index 0fc6725..0000000
--- a/share/zoneinfo/datfiles/asia
+++ /dev/null
@@ -1,331 +0,0 @@
-# @(#)asia 7.1
-
-# From Guy Harris:
-# Incorporates data for Singapore from Robert Elz' asia 1.1, as well as
-# additional information from Tom Yap, Sun Microsystems Intercontinental
-# Technical Support (including a page from the Official Airline Guide -
-# Worldwide Edition). The names for time zones are guesses.
-
-###############################################################################
-
-# People's Republic of China
-
-# From Guy Harris:
-# People's Republic of China. Yes, they really have only one time zone.
-
-# From Bob Devine (January 28, 1988):
-# No they don't. See TIME mag, February 17, 1986 p.52. Even though
-# China is across 4 physical time zones, before Feb 1, 1986 only the
-# Peking (Bejing) time zone was recognized. Since that date, China
-# has two of 'em -- Peking's and Urumqi (named after the capital of
-# the Xinjiang Uighur Autonomous Region). I don't know about DST for it.
-#
-# . . .I just deleted the DST table and this editor makes it too
-# painful to suck in another copy.. So, here is what I have for
-# DST start/end dates for Peking's time zone (info from AP):
-#
-# 1986 May 4 - Sept 14
-# 1987 mid-April - ??
-
-# From U. S. Naval Observatory (January 19, 1989):
-# CHINA 8 H AHEAD OF UTC ALL OF CHINA, INCL TAIWAN
-# CHINA 9 H AHEAD OF UTC APR 17 - SEP 10
-
-# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
-Rule PRC 1970 max - Apr Sun<=14 2:00 1:00 D
-Rule PRC 1970 max - Sep Sun<=14 3:00 0 S
-
-# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL]
-Zone PRC 8:00 PRC C%sT
-
-###############################################################################
-
-# Republic of China
-
-# From Guy Harris
-
-# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL]
-Zone ROC 8:00 - CST
-
-###############################################################################
-
-# Hongkong
-
-# From Guy Harris
-
-# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL]
-Zone Hongkong 8:00 - HKT
-
-###############################################################################
-
-# Iran
-
-# From Bob Devine (January 28, 1988):
-# Iran: Last Sunday in March to third (?) Sunday in
-# September. Since the revolution, the official calendar is Monarchic
-# calendar; I have no idea what the correspondence between dates are.
-
-# From U. S. Naval Observatory (January 19, 1989):
-# IRAN 3.5H AHEAD OF UTC
-
-# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
-Rule Iran 1988 max - Mar lastSun 2:00 1:00 D
-Rule Iran 1988 max - Sep Sun>=15 2:00 0 S
-
-# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL]
-Zone Iran 3:30 Iran I%sT
-
-###############################################################################
-
-# Israel
-
-# From U. S. Naval Observatory (January 19, 1989):
-# ISRAEL 2 H AHEAD OF UTC
-# ISRAEL 3 H AHEAD OF UTC APR 10 - SEP 3
-
-# From Ephraim Silverberg (April 18, 1989):
-
-# Prior to 1989, the rules concerning Daylight Savings Time changed every
-# year; as information, regarding exact times and dates during this period,
-# is not readily available at the present time, the rules commence starting
-# with the year 1989.
-
-# From 1989 onwards the rules are as follows:
-#
-# 1. Daylight Savings Time commences midnight of the first Saturday night
-# following the seven-day festival of Pesach (Passover). The transition
-# is from midnight Israel Standard Time to 1 a.m. Israel Daylight Savings
-# time. As the Pesach festival is dependent on the Lunar calendar (the
-# first day is always on the 15th day of the month of Nisan), the rule
-# changes every year on the Gregorian calendar.
-#
-# 2. Standard Time is reinstated on the Saturday night whereupon Jews
-# following the Ashkenazi (European) rite begin to recite the Selichot
-# (forgiveness) prayers prior to the Jewish Lunar New Year. The transition
-# is from midnight Israel Daylight Savings time to 11 p.m. Israel Standard
-# Time. The law (according to the Ashkenazi custom) concerning the
-# commencement of the Selichot prayers is described in chapter 128, section
-# 5 of the "Code of Jewish Law," by Rabbi Shlomo Ganzfried (translated by
-# Hyman E. Goldin):
-#
-# Beginning with the Sunday [**] before Rosh Hashanah [***],
-# we rise early for the service of Selichot (supplications for
-# forgiveness). If Rosh Hashanah occurs on Monday or Tuesday, we
-# begin saying the Selichot from the Sunday of the preceding week.
-#
-# This, too, varies from year to year on the Gregorian calendar and, thus,
-# two explicit timezone rules are required for each Gregorian year.
-#
-# [**] actually Saturday night as the Jewish day commences at nightfall.
-# [***] the Jewish Lunar New Year.
-
-# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
-Rule Zion 1989 only - Apr 30 0:00 1:00 D
-Rule Zion 1989 only - Sep 24 0:00 0:00 S
-Rule Zion 1990 only - Apr 22 0:00 1:00 D
-Rule Zion 1990 only - Sep 16 0:00 0:00 S
-Rule Zion 1991 only - Apr 7 0:00 1:00 D
-Rule Zion 1991 only - Sep 1 0:00 0:00 S
-Rule Zion 1992 only - Apr 26 0:00 1:00 D
-Rule Zion 1992 only - Sep 20 0:00 0:00 S
-Rule Zion 1993 only - Apr 18 0:00 1:00 D
-Rule Zion 1993 only - Sep 12 0:00 0:00 S
-Rule Zion 1994 only - Apr 3 0:00 1:00 D
-Rule Zion 1994 only - Aug 28 0:00 0:00 S
-Rule Zion 1995 only - Apr 23 0:00 1:00 D
-Rule Zion 1995 only - Sep 17 0:00 0:00 S
-Rule Zion 1996 only - Apr 14 0:00 1:00 D
-Rule Zion 1996 only - Sep 8 0:00 0:00 S
-Rule Zion 1997 only - May 4 0:00 1:00 D
-Rule Zion 1997 only - Sep 28 0:00 0:00 S
-Rule Zion 1998 only - Apr 19 0:00 1:00 D
-Rule Zion 1998 only - Sep 13 0:00 0:00 S
-Rule Zion 1999 only - Apr 11 0:00 1:00 D
-Rule Zion 1999 only - Sep 5 0:00 0:00 S
-Rule Zion 2000 only - Apr 30 0:00 1:00 D
-Rule Zion 2000 only - Sep 24 0:00 0:00 S
-Rule Zion 2001 only - Apr 15 0:00 1:00 D
-Rule Zion 2001 only - Sep 9 0:00 0:00 S
-Rule Zion 2002 only - Apr 7 0:00 1:00 D
-Rule Zion 2002 only - Sep 1 0:00 0:00 S
-Rule Zion 2003 only - Apr 27 0:00 1:00 D
-Rule Zion 2003 only - Sep 21 0:00 0:00 S
-Rule Zion 2004 only - Apr 18 0:00 1:00 D
-Rule Zion 2004 only - Sep 12 0:00 0:00 S
-Rule Zion 2005 only - May 1 0:00 1:00 D
-Rule Zion 2005 only - Sep 25 0:00 0:00 S
-Rule Zion 2006 only - Apr 23 0:00 1:00 D
-Rule Zion 2006 only - Sep 17 0:00 0:00 S
-Rule Zion 2007 only - Apr 15 0:00 1:00 D
-Rule Zion 2007 only - Sep 9 0:00 0:00 S
-Rule Zion 2008 only - Apr 27 0:00 1:00 D
-Rule Zion 2008 only - Sep 21 0:00 0:00 S
-Rule Zion 2009 only - Apr 19 0:00 1:00 D
-Rule Zion 2009 only - Sep 13 0:00 0:00 S
-
-# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL]
-Zone Israel 2:00 Zion I%sT
-
-# The following is a chart of the day of the week and Gregorian date of
-# the first day of Pesach and the first day of Rosh Hashanah for the years
-# 1989 through 2009 inclusive.
-#
-# First Day of Passover
-# ---------------------
-# Gregorian Year Day of Week Month Day
-# -------------- ----------- ----- ---
-# 1989 Thursday April 20
-# 1990 Tuesday April 10
-# 1991 Saturday March 30
-# 1992 Saturday April 18
-# 1993 Tuesday April 6
-# 1994 Sunday March 27
-# 1995 Saturday April 15
-# 1996 Thursday April 4
-# 1997 Tuesday April 22
-# 1998 Saturday April 11
-# 1999 Thursday April 1
-# 2000 Thursday April 20
-# 2001 Sunday April 8
-# 2002 Thursday March 28
-# 2003 Thursday April 17
-# 2004 Tuesday April 6
-# 2005 Sunday April 24
-# 2006 Thursday April 13
-# 2007 Tuesday April 3
-# 2008 Sunday April 20
-# 2009 Thursday April 9
-#
-# First Day of Rosh Hashanah
-# --------------------------
-# Gregorian Year Day of Week Month Day
-# -------------- ----------- ----- ---
-# 1989 Saturday September 30
-# 1990 Thursday September 20
-# 1991 Monday September 9
-# 1992 Monday September 28
-# 1993 Thursday September 16
-# 1994 Tuesday September 6
-# 1995 Monday September 25
-# 1996 Saturday September 14
-# 1997 Thursday October 2
-# 1998 Monday September 21
-# 1999 Saturday September 11
-# 2000 Saturday September 30
-# 2001 Tuesday September 18
-# 2002 Saturday September 7
-# 2003 Saturday September 27
-# 2004 Thursday September 16
-# 2005 Tuesday October 4
-# 2006 Saturday September 23
-# 2007 Thursday September 13
-# 2008 Tuesday September 30
-# 2009 Saturday September 19
-
-###############################################################################
-
-# Japan
-
-# From Guy Harris
-
-# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL]
-Zone Japan 9:00 - JST
-
-###############################################################################
-
-# Republic of Korea
-
-# From Guy Harris:
-# According to someone at the Korean Times in San Francisco,
-# Daylight Savings Time was not observed until 1987. He did not know
-# at what time of day DST starts or ends.
-
-# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
-Rule ROK 1987 max - May Sun<=14 2:00 1:00 D
-Rule ROK 1987 max - Oct Sun<=14 3:00 0 S
-
-# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL]
-Zone ROK 9:00 ROK K%sT
-
-###############################################################################
-
-# Lebanon
-
-# From Bob Devine (January 28, 1988):
-# Lebanon: They do have DST but I don't know the dates.
-
-###############################################################################
-
-# Singapore
-
-# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL]
-Zone Singapore 8:00 - SST
-
-# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
-Rule Russia 1981 1984 - Apr 1 0:00 1:00 D
-Rule Russia 1981 1983 - Oct 1 0:00 0 K
-Rule Russia 1984 1990 - Sep lastSun 3:00 0 K
-Rule Russia 1985 1990 - Mar lastSun 2:00 1:00 D
-Rule Russia 1992 max - Sep lastSun 2:00s 0 K
-Rule Russia 1992 max - Mar lastSun 2:00s 1:00 D
-
-# Armenia
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Yerevan 2:58:00 - LMT 1924 May 2
- 3:00 - MSK 1957 Mar
- 4:00 Russia BS%s 1991 Sep 29 3:00
- 3:00 Russia MS%s
-
-# Azerbaijan
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Baku 3:19:24 - LMT 1924 May 2
- 3:00 - MSK 1957 Mar
- 4:00 Russia BS%s 1991 Sep 29 3:00
- 3:00 Russia MS%s
-
-# Georgia
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-#Zone Tbilisi 2:59:16 - LMT 1880
-Zone Tbilisi 2:59 - LST 1924 May 2
- 3:00 - MSK 1957 Mar
- 4:00 Russia BS%s 1991 Sep 29 3:00
- 3:00 Russia MS%s
-
-# Kazakhstan
-# From Paul Eggert <eggert@twinsun.com> (November 18, 1993):
-# Before 1993, Almaty was known by its Russian name ``Alma-Ata''.
-# From Shanks (1991):
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Almaty 5:07:48 - LMT 1924 May 2
- 5:00 - TSK 1957 Mar
- 6:00 Russia TS%s 1991 Sep 29 3:00
- 5:00 Russia TS%s
-
-# Kyrgyzstan
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Frunze 4:58:24 - LMT 1924 May 2
- 5:00 - TSK 1957 Mar
- 6:00 Russia TS%s 1991 Sep 29 3:00
- 5:00 Russia TS%s
-
-# Tajikistan
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Dushanbe 4:35:12 - LMT 1924 May 2
- 5:00 - TSK 1957 Mar
- 6:00 Russia TS%s 1991 Sep 29 3:00
- 5:00 Russia TS%s
-
-# Turkmenistan
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Ashkhabad 3:53:32 - LMT 1924 May 2
- 4:00 - BSK 1957 Mar
- 5:00 Russia SS%s 1991 Sep 29 3:00
- 4:00 Russia BS%s
-
-# Uzbekistan
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Tashkent 4:37:12 - LMT 1924 May 2
- 5:00 - TSK 1957 Mar
- 6:00 Russia TS%s 1991 Sep 29 3:00
- 5:00 Russia TS%s
-
diff --git a/share/zoneinfo/datfiles/europe b/share/zoneinfo/datfiles/europe
deleted file mode 100644
index bf9e297..0000000
--- a/share/zoneinfo/datfiles/europe
+++ /dev/null
@@ -1,318 +0,0 @@
-# @(#)europe 4.10
-
-# International country codes are used to identify countries' rules and
-# zones
-#
-# This data is by no means authoritative; if you think you know better, go
-# ahead and edit the file (and please send any changes to
-# ado@ncifcrf.gov for general use in the future).
-
-###############################################################################
-
-# United Kingdom
-
-# From Arthur David Olson (January 19, 1989):
-#
-# The starting and ending dates below (from which the rules are derived)
-# are from Whitaker's Almanack for 1987, page 146.
-# 1960 is the earliest year for which dates are given;
-# Whitaker's notes that British Summer Time (and, in some years, Double Summer
-# Time) was observed in earlier years but does not give start and end dates.
-#
-# A source at the British Information Office in New York avers that it's
-# known as "British" Summer Time in all parts of the United Kingdom.
-# 1960 April 10 October 2 (yes, 2, according to the almanac)
-# 1961 March 26 October 29
-# 1962 March 25 October 28
-# 1963 March 31 October 27
-# 1964 March 22 October 25
-# 1965 March 21 October 24
-# 1966 March 20 October 23
-# 1967 March 19 October 29
-# 1968 February 18 October 27
-# "British Standard Time, also one hour ahead of G. M. T., was kept between
-# 1968 Oct. 27-1971 Oct. 31."
-# 1972 March 19 October 29
-# 1973 March 18 October 28
-# 1974 March 17 October 27
-# 1975 March 16 October 26
-# 1976 March 21 October 24
-# 1977 March 20 October 23
-# 1978 March 19 October 29
-# 1979 March 18 October 28
-# 1980 March 16 October 26
-# 1981 March 29 October 25
-# 1982 March 28 October 24
-# 1983 March 27 October 23
-# 1984 March 25 October 28
-# 1985 March 31 October 27
-# 1986 March 30 October 26
-# 1987 March 29 October 25
-
-# From an Anonymous U. K. Donor (January 4, 1989):
-#
-# It is NOT possible to predict when [British Summer Time] will change
-# in a future year.
-#
-# (The admiralty calculate when they think it should be (no more that a couple
-# of years in advance) and advise the government who then decide whether or
-# not they will take the admiralty's advice)
-#
-# ...the Gre[e]nwich...observatory...[was] very helpful.
-#
-# I was not able to track down the Admiralty formula (I tried hard but failed)
-
-# ...
-# Date: 4 Jan 89 08:57:25 GMT (Wed)
-# From: Jonathan Leffler <nih-csl!uunet!mcvax!sphinx.co.uk!john>
-# ...
-# [British Summer Time] is fixed annually by Act of Parliament.
-# If you can predict what Parliament will do, you should be in
-# politics making a fortune, not computing.
-#
-# Summer time ends on Sunday 29 October 1989.
-
-# ...
-# Date: 5 Jan 89 09:50:38 GMT (Thu)
-# From: Peter Kendell <nih-csl!uunet!mcvax!tcom.stc.co.uk!pete>
-# ...
-#
-# From my Collins Diary for 1989 -
-#
-# "At the time of going to press the Home Office was unable to confirm
-# the 1989 starting and finishing dates for BST*, but expressed the
-# view that 26 March and 29 October were the likeliest dates to be
-# adopted"
-#
-# *British Summer Time.
-
-# From an Anonymous U. K. Donor (January 5, 1989):
-#
-# . . .our government is seriously considering applying Double Summer Time -
-# putting the clocks forwards and back TWO hours for daylight saving time.
-# This is advocated to standardise time in the EEC - we're all supposed to
-# keep the same time and to change the clocks on the same dates in the future.
-
-# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
-# Historic starting rules
-Rule GB-Eire 1960 only - Apr 10 1:00s 1:00 BST
-Rule GB-Eire 1961 1963 - Mar lastSun 1:00s 1:00 BST
-Rule GB-Eire 1964 1967 - Mar Sun>=19 1:00s 1:00 BST
-Rule GB-Eire 1968 only - Feb 18 1:00s 1:00 BST
-Rule GB-Eire 1972 1980 - Mar Sun>=16 1:00s 1:00 BST
-# Historic ending rules
-Rule GB-Eire 1960 only - Oct 2 1:00s 0 GMT
-Rule GB-Eire 1961 1967 - Oct Sun>=23 1:00s 0 GMT
-Rule GB-Eire 1971 only - Oct 31 1:00s 0 GMT
-# Current rules
-Rule GB-Eire 1981 max - Mar lastSun 1:00s 1:00 BST
-Rule GB-Eire 1972 max - Oct Sun>=23 1:00s 0 GMT
-
-# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL]
-Zone GB-Eire 0:00 GB-Eire %s 1968 Oct 27 1:00s
- 1:00 - BST 1971 Oct 31 1:00s
- 0:00 GB-Eire %s
-
-###############################################################################
-
-# Continental Europe
-
-# The use of 1986 as starting years below is conservative.
-
-Rule W-Eur 1986 max - Mar lastSun 1:00s 1:00 " DST"
-Rule W-Eur 1986 max - Sep lastSun 1:00s 0 -
-
-Rule M-Eur 1986 max - Mar lastSun 2:00s 1:00 " DST"
-Rule M-Eur 1986 max - Sep lastSun 2:00s 0 -
-
-Rule E-Eur 1986 max - Mar lastSun 3:00s 1:00 " DST"
-Rule E-Eur 1986 max - Sep lastSun 3:00s 0 -
-
-Rule Turkey 1986 max - Mar lastSun 1:00 1:00 " DST"
-Rule Turkey 1986 max - Sep lastSun 1:00 0 -
-
-Rule W-SU 1986 max - Mar lastSun 2:00s 1:00 " DST"
-Rule W-SU 1986 max - Sep lastSun 2:00s 0 -
-
-# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
-#Rule Russia 1880 only - Jan 1 0:00 0 -
-Rule Russia 1917 only - Jul 1 23:00 1:00 " DST"
-Rule Russia 1917 only - Dec 28 0:00 0 -
-Rule Russia 1918 only - May 31 22:00 2:00 " DDST"
-Rule Russia 1918 only - Sep 17 0:00 1:00 " DST"
-Rule Russia 1919 only - May 31 23:00 2:00 " DDST"
-Rule Russia 1919 only - Jul 1 2:00 1:00 D
-Rule Russia 1919 only - Aug 16 0:00 0 K
-Rule Russia 1921 only - Feb 14 23:00 1:00 D
-# Shanks gives 1921 Mar 21 for the following transition.
-# From Andrew A. Chernov <ache@astral.msk.su> (November 12, 1993):
-# My sources says, that it is Mar 20, not 21.
-Rule Russia 1921 only - Mar 20 23:00 2:00 DD
-Rule Russia 1921 only - Sep 1 0:00 1:00 D
-Rule Russia 1921 only - Oct 1 0:00 0 K
-Rule Russia 1981 1984 - Apr 1 0:00 1:00 D
-Rule Russia 1981 1983 - Oct 1 0:00 0 K
-Rule Russia 1984 1990 - Sep lastSun 2:00s 0 K
-Rule Russia 1985 1990 - Mar lastSun 2:00s 1:00 D
-Rule Russia 1992 max - Sep lastSun 2:00s 0 K
-Rule Russia 1992 max - Mar lastSun 2:00s 1:00 D
-
-# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL]
-Zone WET 0:00 W-Eur WET%s
-Zone Iceland 0:00 - WET
-Zone MET 1:00 M-Eur MET%s
-Zone Poland 1:00 W-Eur MET%s
-Zone EET 2:00 E-Eur EET%s
-Zone Turkey 3:00 Turkey EET%s
-Zone W-SU 3:00 M-Eur ????
-
-# Tom Hoffman says that MET is also known as Central European Time
-
-Link MET CET
-
-###############################################################################
-
-# One source shows that Bulgaria, Cyprus, Finland, and Greece observe DST from
-# the last Sunday in March to the last Sunday in September in 1986.
-# The source shows Romania changing a day later than everybody else.
-#
-# According to Bernard Sieloff's source, Poland is in the MET time zone but
-# uses the WE DST rules. The Western USSR uses EET+1 and ME DST rules.
-# Bernard Sieloff's source claims Romania switches on the same day, but at
-# 00:00 standard time (i.e., 01:00 DST). It also claims that Turkey
-# switches on the same day, but switches on at 01:00 standard time
-# and off at 00:00 standard time (i.e., 01:00 DST)
-
-# ...
-# Date: Wed, 28 Jan 87 16:56:27 -0100
-# From: seismo!mcvax!cgcha!wtho (Tom Hofmann)
-# Message-Id: <8701281556.AA22174@cgcha.uucp>
-# ...
-#
-# ...the European time rules are...standardized since 1981, when
-# most European coun[tr]ies started DST. Before that year, only
-# a few countries (UK, France, Italy) had DST, each according
-# to own national rules. In 1981, however, DST started on
-# 'Apr firstSun', and not on 'Mar lastSun' as in the following
-# years...
-# But also since 1981 there are some more national exceptions
-# than listed in 'europe': Switzerland, for example, joined DST
-# one year later, Denmark ended DST on 'Oct 1' instead of 'Sep
-# lastSun' in 1981---I don't know how they handle now.
-#
-# Finally, DST ist always from 'Apr 1' to 'Oct 1' in the
-# Soviet Union (as far as I know).
-#
-# Tom Hofmann, Scientific Computer Center, CIBA-GEIGY AG,
-# 4002 Basle, Switzerland
-# UUCP: ...!mcvax!cernvax!cgcha!wtho
-
-# ...
-# Date: Wed, 4 Feb 87 22:35:22 +0100
-# From: seismo!mcvax!cwi.nl!dik (Dik T. Winter)
-# ...
-#
-# The information from Tom Hofmann is (as far as I know) not entirely correct.
-# After a request from chongo at amdahl I tried to retrieve all information
-# about DST in Europe. I was able to find all from about 1969.
-#
-# ...standardization on DST in Europe started in about 1977 with switches on
-# first Sunday in April and last Sunday in September...
-# In 1981 UK joined Europe insofar that
-# the starting day for both shifted to last Sunday in March. And from 1982
-# the whole of Europe used DST, with switch dates April 1 and October 1 in
-# the Sov[i]et Union. In 1985 the SU reverted to standard Europe[a]n switch
-# dates...
-#
-# It should also be remembered that time-zones are not constants; e.g.
-# Portugal switched in 1976 from MET (or CET) to WET with DST...
-# Note also that though there were rules for switch dates not
-# all countries abided to these dates, and many individual deviations
-# occurred, though not since 1982 I believe. Another note: it is always
-# assumed that DST is 1 hour ahead of normal time, this need not be the
-# case; at least in the Netherlands there have been times when DST was 2 hours
-# in advance of normal time.
-#
-# ...
-# dik t. winter, cwi, amsterdam, nederland
-# INTERNET : dik@cwi.nl
-# BITNET/EARN: dik@mcvax
-
-# From Bob Devine (January 28, 1988):
-# ...
-# Greece: Last Sunday in April to last Sunday in September (iffy on dates).
-# Since 1978. Change at midnight.
-# ...
-# Monaco: has same DST as France.
-# ...
-
-# Russia
-# From Paul Eggert <eggert@twinsun.com> (November 18, 1993):
-# Moscow and Novosibirsk time zone names, and Moscow rules after 1991,
-# are from Andrew A. Chernov <ache@astral.msk.su>.
-# I invented the other time zone names.
-# The rest is from Shanks; it's probably wrong after 1991.
-# We're not sure whether St Petersburg switched in step with Moscow after 1991;
-# it might be a useless name, so we'll comment it out for now.
-#
-# From Shanks (1991):
-# Western Russia switched from the Julian to the Gregorian calendar
-# on 1918 Jan 14. Eatern Russia switched on 1920 Mar 18.
-# In 1929 the Soviet Union instituted a 5 day week; in 1932 it instituted
-# a 6 day week; on 1940 Jun 27 it returned to the Gregorian week.
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-#Zone St_Petersburg 2:30:20 - LMT 1880
-# 2:01 Russia LST%s 1919 Jul 1 2:00
-# 3:00 Russia MS%s 1922 Oct
-# 2:00 - EET 1930 Jun 21
-# 3:00 Russia MS%s 1991 Sep 29 3:00
-# 2:00 Russia SPS%s
-#Zone Moscow 2:30:20 - LMT 1880
-# 2:31 Russia LST%s 1919 Jul 1 2:00
-# 3:00 Russia MS%s 1922 Oct
-Zone Moscow 2:00 - EET 1930 Jun 21
- 3:00 Russia MS%s 1991 Mar lastSun 2:00s
- 2:00 1:00 "EET DST" 1991 Sep lastSun 2:00s
- 2:00 - EET 1992 Jan 19 2:00s
- 3:00 Russia MS%s
-Zone Sverdlovsk 4:02:34 - LMT 1924 May 2
- 4:00 - SSK 1957 Mar
- 5:00 Russia SS%s 1991 Sep 29 3:00
- 4:00 Russia SS%s
-Zone Omsk 4:53:36 - LMT 1924 May 2
- 5:00 - TSK 1957 Mar
- 6:00 Russia TS%s 1991 Sep 29 3:00
- 5:00 Russia OS%s
-Zone Novosibirsk 5:31:40 - LMT 1924 May 2
- 6:00 - NSK 1957 Mar
- 7:00 Russia NS%s 1991 Sep 29 3:00
- 6:00 Russia NS%s
-#Zone Irkutsk 6:57:20 - LMT 1880
-Zone Irkutsk 6:57 - LST 1924 May 2
- 7:00 - ISK 1957 Mar
- 8:00 Russia IS%s 1991 Sep 29 3:00
- 7:00 Russia IS%s
-Zone Yakutsk 8:38:40 - LMT 1924 May 2
- 8:00 - YSK 1957 Mar
- 9:00 Russia YS%s 1991 Sep 29 3:00
- 8:00 Russia YS%s
-#Zone Vladivostok 8:47:44 - LMT 1880
-Zone Vladivostok 8:48 - LST 1924 May 2
- 9:00 - VSK 1957 Mar
- 10:00 Russia VS%s 1991 Sep 29 3:00
- 9:00 Russia VS%s
-# MSK is taken; settle for GSK.
-Zone Magadan 10:03:12 - LMT 1924 May 2
- 10:00 - GSK 1957 Mar
- 11:00 Russia GS%s 1991 Sep 29 3:00
- 10:00 Russia GS%s
-# This name should be Asia/Petropavlovsk-Kamchatski, but that's too long.
-Zone Kamchatka 10:34:36 - LMT 1924 May 2
- 11:00 - PSK 1957 Mar
- 12:00 Russia PS%s 1991 Sep 29 3:00
- 11:00 Russia PS%s
-Zone Anadyr 11:49:56 - LMT 1924 May 2
- 12:00 - ASK 1957 Mar
- 13:00 Russia AS%s 1991 Sep 29 3:00
- 12:00 Russia AS%s
-
diff --git a/sys/conf/nfsswapvmunix.c b/sys/conf/nfsswapvmunix.c
deleted file mode 100644
index 7ca9a1d..0000000
--- a/sys/conf/nfsswapvmunix.c
+++ /dev/null
@@ -1,153 +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
- * Rick Macklem at The University of Guelph.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- *
- * @(#)nfsswapvmunix.c 8.1 (Berkeley) 6/10/93
- * $Id$
- */
-
-/*
- * Sample NFS swapvmunix configuration file.
- * This should be filled in by the bootstrap program.
- * See /sys/nfs/nfsdiskless.h for details of the fields.
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/socket.h>
-#include <sys/mount.h>
-
-#include <net/if.h>
-#include <nfs/nfsv2.h>
-#include <nfs/nfsdiskless.h>
-
-extern int nfs_mountroot();
-int (*mountroot)() = nfs_mountroot;
-
-dev_t rootdev = NODEV;
-dev_t argdev = NODEV;
-dev_t dumpdev = NODEV;
-
-struct swdevt swdevt[] = {
- { NODEV, 0, 5000 }, /* happy:/u/swap.dopey */
- { 0, 0, 0 }
-};
-struct nfs_diskless nfs_diskless = {
- { { 'q', 'e', '0', '\0' },
- { 0x10, 0x2, { 0x0, 0x0, 0x83, 0x68, 0x30, 0x2, } },
- { 0x10, 0x2, { 0x0, 0x0, 0x83, 0x68, 0x30, 0xff, } },
- { 0x10, 0x0, { 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, } },
- },
- { 0x10, 0x2, { 0x0, 0x0, 0x83, 0x68, 0x30, 0x12, } },
- {
- (struct sockaddr *)0, SOCK_DGRAM, 0, (nfsv2fh_t *)0,
- 0, 8192, 8192, 10, 100, (char *)0,
- },
- {
- 0xf,
- 0x9,
- 0x0,
- 0x0,
- 0x1,
- 0x0,
- 0x0,
- 0x0,
- 0xc,
- 0x0,
- 0x0,
- 0x0,
- 0x6,
- 0x0,
- 0x0,
- 0x0,
- 0x27,
- 0x18,
- 0x79,
- 0x27,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- },
- { 0x10, 0x2, { 0x8, 0x1, 0x83, 0x68, 0x30, 0x5, } },
- "happy",
- {
- (struct sockaddr *)0, SOCK_DGRAM, 0, (nfsv2fh_t *)0,
- 0, 8192, 8192, 10, 100, (char *)0,
- },
- {
- 0x0,
- 0x9,
- 0x0,
- 0x0,
- 0x1,
- 0x0,
- 0x0,
- 0x0,
- 0xc,
- 0x0,
- 0x0,
- 0x0,
- 0x2,
- 0x0,
- 0x0,
- 0x0,
- 0xd0,
- 0x48,
- 0x42,
- 0x25,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- },
- { 0x10, 0x2, { 0x8, 0x1, 0x83, 0x68, 0x30, 0x5, } },
- "happy",
-};
diff --git a/sys/gnu/i386/fpemul/bde_trapinfo.mail b/sys/gnu/i386/fpemul/bde_trapinfo.mail
deleted file mode 100644
index 2749e04..0000000
--- a/sys/gnu/i386/fpemul/bde_trapinfo.mail
+++ /dev/null
@@ -1,35 +0,0 @@
-From bde@kralizec.zeta.org.au Sun Jun 27 01:18:32 1993
-Received: from ultima.socs.uts.EDU.AU by bsd.coe.montana.edu (5.67/KAOS-1)
- id AA11952; Sun, 27 Jun 93 01:18:32 -0600
-Received: by ultima.socs.uts.EDU.AU (5.65+/SMI-3.3)
- id AA03033; Sun, 27 Jun 93 17:10:22 +1000
-Received: by kralizec.zeta.org.au (4.0/SMI-4.0)
- id AA15074; Sat, 26 Jun 93 02:32:58 EST
-Date: Sat, 26 Jun 93 02:32:58 EST
-From: bde@kralizec.zeta.org.au (Bruce Evans)
-Message-Id: <9306251632.AA15074@kralizec.zeta.org.au>
-To: nate@bsd.coe.montana.edu
-Subject: Re: Trapframe information
-Status: OR
-
-tf_isp original esp (probably spare - popal ignores it)
-tf_trapno s/w trap no (may be spare - trap.c has already looked at it)
-tf_err h/w error code (probably spare - gets discarded before iret)
-
-___fs not stored in 386BSD pcb. Constant anyway unless user has
- screwed with it (?).
-___gs ditto
-___orig_eip in linux, this is on the stack just before the call to the
- emulator. The reason that it's not a local variable is to
- avoid passing around pointers to it - current->frame (or
- whatever) points to everything in the stack frame. The
- macros hide a lot of slow memory references
- current->frame->var.
-
->(And I need to see if I can map orig_eip to one of the three that I'm unsure of
->in the BSD sources)
-
-tf_isp is the least evil.
-
-Bruce
-
diff --git a/sys/gnu/i386/isa/scd.c b/sys/gnu/i386/isa/scd.c
deleted file mode 100644
index 92d31de..0000000
--- a/sys/gnu/i386/isa/scd.c
+++ /dev/null
@@ -1,1530 +0,0 @@
-/*-
- * Copyright (c) 1995 Mikael Hybsch
- *
- * Portions of this file are copied from mcd.c
- * which has the following copyrights:
- *
- * Copyright 1993 by Holger Veit (data part)
- * Copyright 1993 by Brian Moore (audio part)
- * Changes Copyright 1993 by Gary Clark II
- * Changes Copyright (C) 1994 by Andrew A. Chernov
- *
- * Rewrote probe routine to work on newer Mitsumi drives.
- * Additional changes (C) 1994 by Jordan K. Hubbard
- *
- * The Linux driver cdu31a has been used as a reference when writing this
- * code, there fore bringing it under the GNU Public License. The following
- * conditions of redistribution therefore apply:
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-
-/* $Id: scd.c,v 1.7 1995/02/09 11:30:07 jkh Exp $ */
-
-/* Please send any comments to micke@dynas.se */
-
-#define SCD_DEBUG 0
-
-#include "scd.h"
-#if NSCD > 0
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/buf.h>
-#include <sys/stat.h>
-#include <sys/uio.h>
-#include <sys/ioctl.h>
-#include <sys/cdio.h>
-#include <sys/errno.h>
-#include <sys/dkbad.h>
-#include <sys/disklabel.h>
-#include <sys/devconf.h>
-#include <machine/stdarg.h>
-
-#include <i386/isa/isa.h>
-#include <i386/isa/isa_device.h>
-#include <gnu/i386/isa/scdreg.h>
-
-#define scd_part(dev) ((minor(dev)) & 7)
-#define scd_unit(dev) (((minor(dev)) & 0x38) >> 3)
-#define scd_phys(dev) (((minor(dev)) & 0x40) >> 6)
-#define RAW_PART 2
-
-/* flags */
-#define SCDOPEN 0x0001 /* device opened */
-#define SCDVALID 0x0002 /* parameters loaded */
-#define SCDINIT 0x0004 /* device is init'd */
-#define SCDPROBING 0x0020 /* probing */
-#define SCDTOC 0x0100 /* already read toc */
-#define SCDMBXBSY 0x0200 /* local mbx is busy */
-#define SCDSPINNING 0x0400 /* drive is spun up */
-
-#define SCD_S_BEGIN 0
-#define SCD_S_BEGIN1 1
-#define SCD_S_WAITSTAT 2
-#define SCD_S_WAITFIFO 3
-#define SCD_S_WAITSPIN 4
-#define SCD_S_WAITREAD 5
-#define SCD_S_WAITPARAM 6
-
-#define RDELAY_WAIT 300
-#define RDELAY_WAITREAD 300
-
-#define SCDBLKSIZE 2048
-
-#ifdef SCD_DEBUG
- int scd_debuglevel = SCD_DEBUG;
-# define XDEBUG(level, data) {if (scd_debuglevel >= level) printf data;}
-#else
-# define XDEBUG(level, data)
-#endif
-
-struct scd_mbx {
- short unit;
- short port;
- short retry;
- short nblk;
- int sz;
- u_long skip;
- struct buf *bp;
- int p_offset;
- short count;
-};
-
-struct scd_data {
- int iobase;
- char double_speed;
- char *name;
- short flags;
- int blksize;
- u_long disksize;
- struct disklabel dlabel;
- int openflag;
- struct {
- unsigned char adr :4;
- unsigned char ctl :4; /* xcdplayer needs this */
- unsigned char start_msf[3];
- } toc[MAX_TRACKS];
- short first_track;
- short last_track;
- struct ioc_play_msf last_play;
-
- short audio_status;
- struct buf head; /* head of buf queue */
- struct scd_mbx mbx;
-} scd_data[NSCD];
-
-/* prototypes */
-int scdopen(dev_t dev);
-int scdclose(dev_t dev);
-void scdstrategy(struct buf *bp);
-int scdioctl(dev_t dev, int cmd, caddr_t addr, int flags);
-int scdsize(dev_t dev);
-
-static int bcd2bin(bcd_t b);
-static bcd_t bin2bcd(int b);
-static void hsg2msf(int hsg, bcd_t *msf);
-static int msf2hsg(bcd_t *msf);
-
-static void process_attention(unsigned unit);
-static inline void write_control(unsigned port, unsigned data);
-static int waitfor_status_bits(int unit, int bits_set, int bits_clear);
-static int waitfor_attention(int unit);
-static int send_cmd(u_int unit, u_char cmd, u_int nargs, ...);
-static void init_drive(unsigned unit);
-static int spin_up(unsigned unit);
-static int read_toc(dev_t dev);
-static int get_result(u_int unit, int result_len, u_char *result);
-static void print_error(int unit, int errcode);
-
-static void scd_start(int unit);
-static void scd_doread(int state, struct scd_mbx *mbxin);
-
-static int scd_eject(int unit);
-static int scd_stop(int unit);
-static int scd_pause(int unit);
-static int scd_resume(int unit);
-static int scd_playtracks(int unit, struct ioc_play_track *pt);
-static int scd_playmsf(int unit, struct ioc_play_msf *msf);
-static int scd_play(int unit, struct ioc_play_msf *msf);
-static int scd_subchan(int unit, struct ioc_read_subchannel *sc);
-static int read_subcode(int unit, struct sony_subchannel_position_data *sc);
-
-/* for xcdplayer */
-static int scd_toc_header(int unit, struct ioc_toc_header *th);
-static int scd_toc_entrys(int unit, struct ioc_read_toc_entry *te);
-#define SCD_LASTPLUS1 170 /* don't ask, xcdplayer passes this in */
-
-extern int hz;
-
-int scd_probe(struct isa_device *dev);
-int scd_attach(struct isa_device *dev);
-struct isa_driver scddriver = { scd_probe, scd_attach, "scd" };
-
-static struct kern_devconf kdc_scd[NSCD] = { {
- 0, 0, 0, /* filled in by dev_attach */
- "scd", 0, { MDDT_ISA, 0, "bio" },
- isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
- &kdc_isa0, /* parent */
- 0, /* parentdata */
- DC_IDLE, /* status */
- "Sony CD-ROM drive" /* properly filled later */
-} };
-
-static inline void
-scd_registerdev(struct isa_device *id)
-{
- if(id->id_unit)
- kdc_scd[id->id_unit] = kdc_scd[0];
- kdc_scd[id->id_unit].kdc_unit = id->id_unit;
- kdc_scd[id->id_unit].kdc_isa = id;
- dev_attach(&kdc_scd[id->id_unit]);
-}
-
-int scd_attach(struct isa_device *dev)
-{
- struct scd_data *cd = scd_data + dev->id_unit;
- int i;
-
- cd->iobase = dev->id_iobase; /* Already set by probe, but ... */
-
- scd_registerdev(dev);
- /* name filled in probe */
- kdc_scd[dev->id_unit].kdc_description = scd_data[dev->id_unit].name;
- printf("scd%d: <%s>\n", dev->id_unit, scd_data[dev->id_unit].name);
-
- init_drive(dev->id_unit);
-
- cd->flags = SCDINIT;
- cd->audio_status = CD_AS_AUDIO_INVALID;
-
- return 1;
-}
-
-int
-scdopen(dev_t dev)
-{
- int unit,part,phys;
- int rc;
- struct scd_data *cd;
-
- unit = scd_unit(dev);
- if (unit >= NSCD)
- return ENXIO;
-
- cd = scd_data + unit;
- part = scd_part(dev);
- phys = scd_phys(dev);
-
- /* not initialized*/
- if (!(cd->flags & SCDINIT))
- return ENXIO;
-
- /* invalidated in the meantime? mark all open part's invalid */
- if (cd->openflag)
- return ENXIO;
-
- XDEBUG(1,("scd%d: DEBUG: status = 0x%x\n", unit, inb(cd->iobase+IREG_STATUS)));
-
- if ((rc = spin_up(unit)) != 0) {
- print_error(unit, rc);
- return EIO;
- }
- if (!(cd->flags & SCDTOC)) {
- int loop_count = 3;
-
- while (loop_count-- > 0 && (rc = read_toc(dev)) != 0) {
- if (rc == ERR_NOT_SPINNING) {
- rc = spin_up(unit);
- if (rc) {
- print_error(unit, rc);\
- return EIO;
- }
- continue;
- }
- printf("scd%d: TOC read error 0x%x\n", unit, rc);
- return EIO;
- }
- }
-
- cd->openflag = 1;
- cd->flags |= SCDVALID;
- kdc_scd[unit].kdc_state = DC_BUSY;
-
- return 0;
-}
-
-int
-scdclose(dev_t dev)
-{
- int unit,part,phys;
- struct scd_data *cd;
- int rlen;
- char rdata[10];
-
- unit = scd_unit(dev);
- if (unit >= NSCD)
- return ENXIO;
-
- cd = scd_data + unit;
- part = scd_part(dev);
- phys = scd_phys(dev);
-
- if (!(cd->flags & SCDINIT) || !cd->openflag)
- return ENXIO;
-
- if (cd->audio_status != CD_AS_PLAY_IN_PROGRESS) {
- (void)send_cmd(unit, CMD_SPIN_DOWN, 0);
- cd->flags &= ~SCDSPINNING;
- }
-
- kdc_scd[unit].kdc_state = DC_IDLE;
-
- /* close channel */
- cd->openflag = 0;
-
- return 0;
-}
-
-void
-scdstrategy(struct buf *bp)
-{
- struct scd_data *cd;
- struct buf *qp;
- int s;
- int unit = scd_unit(bp->b_dev);
-
- cd = scd_data + unit;
-
- XDEBUG(2, ("scd%d: DEBUG: strategy: block=%ld, bcount=%ld\n", unit, bp->b_blkno, bp->b_bcount));
-
- if (unit >= NSCD || bp->b_blkno < 0 || (bp->b_bcount % SCDBLKSIZE)) {
- printf("scd%d: strategy failure: blkno = %d, bcount = %d\n",
- unit, bp->b_blkno, bp->b_bcount);
- bp->b_error = EINVAL;
- bp->b_flags |= B_ERROR;
- goto bad;
- }
-
- /* if device invalidated (e.g. media change, door open), error */
- if (!(cd->flags & SCDVALID)) {
- printf("scd%d: media changed\n", unit);
- bp->b_error = EIO;
- goto bad;
- }
-
- /* read only */
- if (!(bp->b_flags & B_READ)) {
- bp->b_error = EROFS;
- goto bad;
- }
-
- /* no data to read */
- if (bp->b_bcount == 0)
- goto done;
-
- if (!(cd->flags & SCDTOC)) {
- bp->b_error = EIO;
- goto bad;
- }
- /* adjust transfer if necessary */
- if (bounds_check_with_label(bp,&cd->dlabel,1) <= 0)
- goto done;
-
- bp->b_pblkno = bp->b_blkno;
- bp->b_resid = 0;
-
- /* queue it */
- qp = &cd->head;
- s = splbio();
- disksort(qp,bp);
- splx(s);
-
- /* now check whether we can perform processing */
- scd_start(unit);
- return;
-
-bad:
- bp->b_flags |= B_ERROR;
-done:
- bp->b_resid = bp->b_bcount;
- biodone(bp);
- return;
-}
-
-static void
-scd_start(int unit)
-{
- struct scd_data *cd = scd_data + unit;
- struct buf *bp, *qp = &cd->head;
- struct partition *p;
- int part;
- register s = splbio();
-
- if (cd->flags & SCDMBXBSY) {
- splx(s);
- return;
- }
-
- if ((bp = qp->b_actf) != 0) {
- /* block found to process, dequeue */
- qp->b_actf = bp->b_actf;
- cd->flags |= SCDMBXBSY;
- splx(s);
- } else {
- /* nothing to do */
- splx(s);
- return;
- }
-
- p = cd->dlabel.d_partitions + scd_part(bp->b_dev);
-
- cd->mbx.unit = unit;
- cd->mbx.port = cd->iobase;
- cd->mbx.retry = 3;
- cd->mbx.bp = bp;
- cd->mbx.p_offset = p->p_offset;
- splx(s);
-
- scd_doread(SCD_S_BEGIN,&(cd->mbx));
- return;
-}
-
-int
-scdioctl(dev_t dev, int cmd, caddr_t addr, int flags)
-{
- struct scd_data *cd;
- int unit,part;
-
- unit = scd_unit(dev);
- part = scd_part(dev);
- cd = scd_data + unit;
-
- XDEBUG(1, ("scd%d: ioctl: cmd=0x%lx\n", unit, cmd));
-
- if (!(cd->flags & SCDVALID))
- return EIO;
-
- switch (cmd) {
- case DIOCSBAD:
- return EINVAL;
- case DIOCGDINFO:
- *(struct disklabel *)addr = cd->dlabel;
- return 0;
- case DIOCGPART:
- ((struct partinfo *)addr)->disklab = &cd->dlabel;
- ((struct partinfo *)addr)->part =
- &cd->dlabel.d_partitions[0];
- return 0;
- case CDIOCPLAYTRACKS:
- return scd_playtracks(unit, (struct ioc_play_track *) addr);
- case CDIOCPLAYBLOCKS:
- return EINVAL;
- case CDIOCPLAYMSF:
- return scd_playmsf(unit, (struct ioc_play_msf *) addr);
- case CDIOCREADSUBCHANNEL:
- return scd_subchan(unit, (struct ioc_read_subchannel *) addr);
- case CDIOREADTOCHEADER:
- return scd_toc_header (unit, (struct ioc_toc_header *) addr);
- case CDIOREADTOCENTRYS:
- return scd_toc_entrys (unit, (struct ioc_read_toc_entry*) addr);
- case CDIOCSETPATCH:
- case CDIOCGETVOL:
- case CDIOCSETVOL:
- case CDIOCSETMONO:
- case CDIOCSETSTERIO:
- case CDIOCSETMUTE:
- case CDIOCSETLEFT:
- case CDIOCSETRIGHT:
- return EINVAL;
- case CDIOCRESUME:
- return scd_resume(unit);
- case CDIOCPAUSE:
- return scd_pause(unit);
- case CDIOCSTART:
- return EINVAL;
- case CDIOCSTOP:
- return scd_stop(unit);
- case CDIOCEJECT:
- return scd_eject(unit);
- case CDIOCALLOW:
- return 0;
- case CDIOCSETDEBUG:
-#ifdef SCD_DEBUG
- scd_debuglevel++;
-#endif
- return 0;
- case CDIOCCLRDEBUG:
-#ifdef SCD_DEBUG
- scd_debuglevel = 0;
-
-#endif
- return 0;
- default:
- printf("scd%d: unsupported ioctl (cmd=0x%lx)\n", unit, cmd);
- return ENOTTY;
- }
-}
-
-int
-scdsize(dev_t dev)
-{
- return -1;
-}
-
-void
-scdintr()
-{
- return;
-}
-
-/***************************************************************
- * lower level of driver starts here
- **************************************************************/
-
-static int
-scd_playtracks(int unit, struct ioc_play_track *pt)
-{
- struct scd_data *cd = scd_data + unit;
- struct ioc_play_msf msf;
- int a = pt->start_track;
- int z = pt->end_track;
- int rc, i;
-
- if (!(cd->flags & SCDTOC) && (rc = read_toc(unit)) != 0) {
- if (rc == -ERR_NOT_SPINNING) {
- if (spin_up(unit) != 0)
- return EIO;
- rc = read_toc(unit);
- }
- if (rc != 0) {
- print_error(unit, rc);
- return EIO;
- }
- }
-
- XDEBUG(1, ("scd%d: playtracks from %d:%d to %d:%d\n", unit,
- a, pt->start_index, z, pt->end_index));
-
- if ( a < cd->first_track
- || a > cd->last_track
- || a > z
- || z > cd->last_track)
- return EINVAL;
-
- bcopy(cd->toc[a].start_msf, &msf.start_m, 3);
- hsg2msf(msf2hsg(cd->toc[z+1].start_msf)-1, &msf.end_m);
-
- return scd_play(unit, &msf);
-}
-
-/* The start/end msf is expected to be in bin format */
-static int
-scd_playmsf(int unit, struct ioc_play_msf *msfin)
-{
- struct ioc_play_msf msf;
-
- msf.start_m = bin2bcd(msfin->start_m);
- msf.start_s = bin2bcd(msfin->start_s);
- msf.start_f = bin2bcd(msfin->start_f);
- msf.end_m = bin2bcd(msfin->end_m);
- msf.end_s = bin2bcd(msfin->end_s);
- msf.end_f = bin2bcd(msfin->end_f);
-
- return scd_play(unit, &msf);
-}
-
-/* The start/end msf is expected to be in bcd format */
-static int
-scd_play(int unit, struct ioc_play_msf *msf)
-{
- struct scd_data *cd = scd_data + unit;
- int i, rc;
-
- XDEBUG(1, ("scd%d: playing: %02x:%02x:%02x -> %02x:%02x:%02x\n", unit,
- msf->start_m, msf->start_s, msf->start_f,
- msf->end_m, msf->end_s, msf->end_f));
-
- for (i = 0; i < 2; i++) {
- rc = send_cmd(unit, CMD_PLAY_AUDIO, 7,
- 0x03,
- msf->start_m, msf->start_s, msf->start_f,
- msf->end_m, msf->end_s, msf->end_f);
- if (rc == -ERR_NOT_SPINNING) {
- cd->flags &= ~SCDSPINNING;
- if (spin_up(unit) != 0)
- return EIO;
- } else if (rc < 0) {
- print_error(unit, rc);
- return EIO;
- } else {
- break;
- }
- }
- cd->audio_status = CD_AS_PLAY_IN_PROGRESS;
- bcopy((char *)msf, (char *)&cd->last_play, sizeof(struct ioc_play_msf));
- return 0;
-}
-
-static int
-scd_stop(int unit)
-{
- struct scd_data *cd = scd_data + unit;
-
- (void)send_cmd(unit, CMD_STOP_AUDIO, 0);
- cd->audio_status = CD_AS_PLAY_COMPLETED;
- return 0;
-}
-
-static int
-scd_pause(int unit)
-{
- struct scd_data *cd = scd_data + unit;
- struct sony_subchannel_position_data subpos;
-
- if (cd->audio_status != CD_AS_PLAY_IN_PROGRESS)
- return EINVAL;
-
- if (read_subcode(unit, &subpos) != 0)
- return EIO;
-
- if (send_cmd(unit, CMD_STOP_AUDIO, 0) != 0)
- return EIO;
-
- cd->last_play.start_m = subpos.abs_msf[0];
- cd->last_play.start_s = subpos.abs_msf[1];
- cd->last_play.start_f = subpos.abs_msf[2];
- cd->audio_status = CD_AS_PLAY_PAUSED;
-
- XDEBUG(1, ("scd%d: pause @ %02x:%02x:%02x\n", unit,
- cd->last_play.start_m,
- cd->last_play.start_s,
- cd->last_play.start_f));
-
- return 0;
-}
-
-static int
-scd_resume(int unit)
-{
- if (scd_data[unit].audio_status != CD_AS_PLAY_PAUSED)
- return EINVAL;
- return scd_play(unit, &scd_data[unit].last_play);
-}
-
-static int
-scd_eject(int unit)
-{
- struct scd_data *cd = scd_data + unit;
- int port = cd->iobase;
-
- cd->audio_status = CD_AS_AUDIO_INVALID;
- cd->flags &= ~(SCDSPINNING|SCDTOC);
-
- if (send_cmd(unit, CMD_STOP_AUDIO, 0) != 0 ||
- send_cmd(unit, CMD_SPIN_DOWN, 0) != 0 ||
- send_cmd(unit, CMD_EJECT, 0) != 0)
- {
- return EIO;
- }
- return 0;
-}
-
-static int
-scd_subchan(int unit, struct ioc_read_subchannel *sc)
-{
- struct scd_data *cd = scd_data + unit;
- struct sony_subchannel_position_data q;
- struct cd_sub_channel_info data;
-
- XDEBUG(1, ("scd%d: subchan af=%d, df=%d\n", unit,
- sc->address_format,
- sc->data_format));
-
- if (sc->address_format != CD_MSF_FORMAT)
- return EINVAL;
-
- if (sc->data_format != CD_CURRENT_POSITION)
- return EINVAL;
-
- if (read_subcode(unit, &q) != 0)
- return EIO;
-
- data.header.audio_status = cd->audio_status;
- data.what.position.data_format = CD_MSF_FORMAT;
- data.what.position.track_number = bcd2bin(q.track_number);
- data.what.position.reladdr.msf.unused = 0;
- data.what.position.reladdr.msf.minute = bcd2bin(q.rel_msf[0]);
- data.what.position.reladdr.msf.second = bcd2bin(q.rel_msf[1]);
- data.what.position.reladdr.msf.frame = bcd2bin(q.rel_msf[2]);
- data.what.position.absaddr.msf.unused = 0;
- data.what.position.absaddr.msf.minute = bcd2bin(q.abs_msf[0]);
- data.what.position.absaddr.msf.second = bcd2bin(q.abs_msf[1]);
- data.what.position.absaddr.msf.frame = bcd2bin(q.abs_msf[2]);
-
- if (copyout(&data, sc->data, min(sizeof(struct cd_sub_channel_info), sc->data_len))!=0)
- return EFAULT;
- return 0;
-}
-
-int
-scd_probe(struct isa_device *dev)
-{
- struct sony_drive_configuration drive_config;
- int unit = dev->id_unit;
- int rc;
- static char namebuf[8+16+8+3];
- char *s = namebuf;
- int loop_count = 0;
-
- scd_data[unit].flags = SCDPROBING;
- scd_data[unit].iobase = dev->id_iobase;
-
- bzero(&drive_config, sizeof(drive_config));
-
-again:
- /* Reset drive */
- write_control(dev->id_iobase, CBIT_RESET_DRIVE);
-
- /* Calm down */
- DELAY(300000);
-
- /* Only the ATTENTION bit may be set */
- if ((inb(dev->id_iobase+IREG_STATUS) & ~1) != 0) {
- XDEBUG(1, ("scd: too many bits set. probe failed.\n"));
- return 0;
- }
- rc = send_cmd(unit, CMD_GET_DRIVE_CONFIG, 0);
- if (rc != sizeof(drive_config)) {
- /* Sometimes if the drive is playing audio I get */
- /* the bad result 82. Fix by repeating the reset */
- if (rc > 0 && loop_count++ == 0)
- goto again;
- return 0;
- }
- if (get_result(unit, rc, (u_char *)&drive_config) != 0)
- return 0;
-
- bcopy(drive_config.vendor, namebuf, 8);
- s = namebuf+8;
- while (*(s-1) == ' ') /* Strip trailing spaces */
- s--;
- *s++ = ' ';
- bcopy(drive_config.product, s, 16);
- s += 16;
- while (*(s-1) == ' ')
- s--;
- *s++ = ' ';
- bcopy(drive_config.revision, s, 8);
- s += 8;
- while (*(s-1) == ' ')
- s--;
- *s = 0;
-
- scd_data[unit].name = namebuf;
-
- if (drive_config.config & 0x10)
- scd_data[unit].double_speed = 1;
- else
- scd_data[unit].double_speed = 0;
-
- return 4;
-}
-
-static int
-read_subcode(int unit, struct sony_subchannel_position_data *sc)
-{
- int rc;
-
- rc = send_cmd(unit, CMD_GET_SUBCHANNEL_DATA, 0);
- if (rc < 0 || rc < sizeof(*sc))
- return EIO;
- if (get_result(unit, rc, (u_char *)sc) != 0)
- return EIO;
- return 0;
-}
-
-/* State machine copied from mcd.c */
-
-/* This (and the code in mcd.c) will not work with more than one drive */
-/* because there is only one mbxsave below. Should fix that some day. */
-/* (mbxsave & state should probably be included in the scd_data struct and */
-/* the unit number used as first argument to scd_doread().) /Micke */
-
-/* state machine to process read requests
- * initialize with SCD_S_BEGIN: reset state machine
- * SCD_S_WAITSTAT: wait for ready (!busy)
- * SCD_S_WAITSPIN: wait for drive to spin up (if not spinning)
- * SCD_S_WAITFIFO: wait for param fifo to get ready, them exec. command.
- * SCD_S_WAITREAD: wait for data ready, read data
- * SCD_S_WAITPARAM: wait for command result params, read them, error if bad data read.
- */
-
-static struct scd_mbx *mbxsave;
-
-static void
-scd_doread(int state, struct scd_mbx *mbxin)
-{
- struct scd_mbx *mbx = (state!=SCD_S_BEGIN) ? mbxsave : mbxin;
- int unit = mbx->unit;
- int port = mbx->port;
- struct buf *bp = mbx->bp;
- struct scd_data *cd = scd_data + unit;
- int reg,i,k,c;
- int blknum;
- caddr_t addr;
- char rdata[10];
- static char sdata[3]; /* Must be preserved between calls to this function */
-
-loop:
- switch (state) {
- case SCD_S_BEGIN:
- mbx = mbxsave = mbxin;
-
- case SCD_S_BEGIN1:
- /* get status */
- mbx->count = RDELAY_WAIT;
-
- process_attention(unit);
- goto trystat;
-
- case SCD_S_WAITSTAT:
- untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITSTAT);
- if (mbx->count-- <= 0) {
- printf("scd%d: timeout. drive busy.\n",unit);
- goto harderr;
- }
-
-trystat:
- if (IS_BUSY(port)) {
- timeout((timeout_func_t)scd_doread,
- (caddr_t)SCD_S_WAITSTAT,hz/100); /* XXX */
- return;
- }
-
- process_attention(unit);
-
- /* reject, if audio active */
- if (cd->audio_status & CD_AS_PLAY_IN_PROGRESS) {
- printf("scd%d: audio is active\n",unit);
- goto harderr;
- }
-
- mbx->sz = cd->blksize;
-
-firstblock:
- /* for first block */
- mbx->nblk = (bp->b_bcount + (mbx->sz-1)) / mbx->sz;
- mbx->skip = 0;
-
-nextblock:
- if (!(cd->flags & SCDVALID))
- goto changed;
-
- blknum = (bp->b_blkno / (mbx->sz/DEV_BSIZE))
- + mbx->p_offset + mbx->skip/mbx->sz;
-
- XDEBUG(2, ("scd%d: scd_doread: read blknum=%d\n", unit, blknum));
-
- /* build parameter block */
- hsg2msf(blknum, sdata);
-
- write_control(port, CBIT_RESULT_READY_CLEAR);
- write_control(port, CBIT_RPARAM_CLEAR);
- write_control(port, CBIT_DATA_READY_CLEAR);
-
- if (FSTATUS_BIT(port, FBIT_WPARAM_READY))
- goto writeparam;
-
- mbx->count = 100;
- timeout((timeout_func_t)scd_doread,
- (caddr_t)SCD_S_WAITFIFO,hz/100); /* XXX */
- return;
-
- case SCD_S_WAITSPIN:
- untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITSPIN);
- if (mbx->count-- <= 0) {
- printf("scd%d: timeout waiting for drive to spin up.\n", unit);
- goto harderr;
- }
- if (!STATUS_BIT(port, SBIT_RESULT_READY)) {
- timeout((timeout_func_t)scd_doread,
- (caddr_t)SCD_S_WAITSPIN,hz/100); /* XXX */
- return;
- }
- write_control(port, CBIT_RESULT_READY_CLEAR);
- switch ((i = inb(port+IREG_RESULT)) & 0xf0) {
- case 0x20:
- i = inb(port+IREG_RESULT);
- print_error(unit, i);
- goto harderr;
- case 0x00:
- (void)inb(port+IREG_RESULT);
- cd->flags |= SCDSPINNING;
- break;
- }
- XDEBUG(1, ("scd%d: DEBUG: spin up complete\n", unit));
-
- state = SCD_S_BEGIN1;
- goto loop;
-
- case SCD_S_WAITFIFO:
- untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITFIFO);
- if (mbx->count-- <= 0) {
- printf("scd%d: timeout. write param not ready.\n",unit);
- goto harderr;
- }
- if (!FSTATUS_BIT(port, FBIT_WPARAM_READY)) {
- timeout((timeout_func_t)scd_doread,
- (caddr_t)SCD_S_WAITFIFO,hz/100); /* XXX */
- return;
- }
- XDEBUG(1, ("scd%d: mbx->count (writeparamwait) = %d(%d)\n", unit, mbx->count, 100));
-
-writeparam:
- /* The reason this test isn't done 'till now is to make sure */
- /* that it is ok to send the SPIN_UP cmd below. */
- if (!(cd->flags & SCDSPINNING)) {
- XDEBUG(1, ("scd%d: spinning up drive ...\n", unit));
- outb(port+OREG_COMMAND, CMD_SPIN_UP);
- mbx->count = 300;
- timeout((timeout_func_t)scd_doread,
- (caddr_t)SCD_S_WAITSPIN,hz/100); /* XXX */
- return;
- }
-
- reg = port + OREG_WPARAMS;
- /* send the read command */
- disable_intr();
- outb(reg, sdata[0]);
- outb(reg, sdata[1]);
- outb(reg, sdata[2]);
- outb(reg, 0);
- outb(reg, 0);
- outb(reg, 1);
- outb(port+OREG_COMMAND, CMD_READ);
- enable_intr();
-
- mbx->count = RDELAY_WAITREAD;
- for (i = 0; i < 50; i++) {
- if (STATUS_BIT(port, SBIT_DATA_READY))
- goto got_data;
- DELAY(100);
- }
-
- timeout((timeout_func_t)scd_doread,
- (caddr_t)SCD_S_WAITREAD,hz/100); /* XXX */
- return;
-
- case SCD_S_WAITREAD:
- untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITREAD);
- if (mbx->count-- <= 0) {
- if (STATUS_BIT(port, SBIT_RESULT_READY))
- goto got_param;
- printf("scd%d: timeout while reading data\n",unit);
- goto readerr;
- }
- if (!STATUS_BIT(port, SBIT_DATA_READY)) {
- process_attention(unit);
- if (!(cd->flags & SCDVALID))
- goto changed;
- timeout((timeout_func_t)scd_doread,
- (caddr_t)SCD_S_WAITREAD,hz/100); /* XXX */
- return;
- }
- XDEBUG(2, ("scd%d: mbx->count (after RDY_BIT) = %d(%d)\n", unit, mbx->count, RDELAY_WAITREAD));
-
-got_data:
- /* data is ready */
- addr = bp->b_un.b_addr + mbx->skip;
- write_control(port, CBIT_DATA_READY_CLEAR);
- insb(port+IREG_DATA, addr, mbx->sz);
-
- mbx->count = 100;
- for (i = 0; i < 20; i++) {
- if (STATUS_BIT(port, SBIT_RESULT_READY))
- goto waitfor_param;
- DELAY(100);
- }
- goto waitfor_param;
-
- case SCD_S_WAITPARAM:
- untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITPARAM);
- if (mbx->count-- <= 0) {
- printf("scd%d: timeout waiting for params\n",unit);
- goto readerr;
- }
-
-waitfor_param:
- if (!STATUS_BIT(port, SBIT_RESULT_READY)) {
- timeout((timeout_func_t)scd_doread,
- (caddr_t)SCD_S_WAITPARAM,hz/100); /* XXX */
- return;
- }
-#if SCD_DEBUG
- if (mbx->count < 100 && scd_debuglevel > 0)
- printf("scd%d: mbx->count (paramwait) = %d(%d)\n", unit, mbx->count, 100);
-#endif
-
-got_param:
- write_control(port, CBIT_RESULT_READY_CLEAR);
- switch ((i = inb(port+IREG_RESULT)) & 0xf0) {
- case 0x50:
- switch (i) {
- case ERR_FATAL_READ_ERROR1:
- case ERR_FATAL_READ_ERROR2:
- printf("scd%d: unrecoverable read error 0x%x\n", unit, i);
- goto harderr;
- }
- break;
- case 0x20:
- i = inb(port+IREG_RESULT);
- switch (i) {
- case ERR_NOT_SPINNING:
- XDEBUG(1, ("scd%d: read error: drive not spinning\n", unit));
- if (mbx->retry-- > 0) {
- state = SCD_S_BEGIN1;
- cd->flags &= ~SCDSPINNING;
- goto loop;
- }
- goto harderr;
- default:
- print_error(unit, i);
- goto readerr;
- }
- case 0x00:
- i = inb(port+IREG_RESULT);
- break;
- }
-
- if (--mbx->nblk > 0) {
- mbx->skip += mbx->sz;
- goto nextblock;
- }
-
- /* return buffer */
- bp->b_resid = 0;
- biodone(bp);
-
- cd->flags &= ~SCDMBXBSY;
- scd_start(mbx->unit);
- return;
- }
-
-readerr:
- if (mbx->retry-- > 0) {
- printf("scd%d: retrying ...\n",unit);
- state = SCD_S_BEGIN1;
- goto loop;
- }
-harderr:
- /* invalidate the buffer */
- bp->b_error = EIO;
- bp->b_flags |= B_ERROR;
- bp->b_resid = bp->b_bcount;
- biodone(bp);
-
- cd->flags &= ~SCDMBXBSY;
- scd_start(mbx->unit);
- return;
-
-changed:
- printf("scd%d: media changed\n", unit);
- goto harderr;
-}
-
-static int
-bcd2bin(bcd_t b)
-{
- return (b >> 4) * 10 + (b & 15);
-}
-
-static bcd_t
-bin2bcd(int b)
-{
- return ((b / 10) << 4) | (b % 10);
-}
-
-static void
-hsg2msf(int hsg, bcd_t *msf)
-{
- hsg += 150;
- M_msf(msf) = bin2bcd(hsg / 4500);
- hsg %= 4500;
- S_msf(msf) = bin2bcd(hsg / 75);
- F_msf(msf) = bin2bcd(hsg % 75);
-}
-
-static int
-msf2hsg(bcd_t *msf)
-{
- return (bcd2bin(M_msf(msf)) * 60 +
- bcd2bin(S_msf(msf))) * 75 +
- bcd2bin(F_msf(msf)) - 150;
-}
-
-static void
-process_attention(unsigned unit)
-{
- unsigned port = scd_data[unit].iobase;
- unsigned char code;
- int count = 0;
- int i;
-
- while (IS_ATTENTION(port) && count++ < 30) {
- write_control(port, CBIT_ATTENTION_CLEAR);
- code = inb(port+IREG_RESULT);
-
-#if SCD_DEBUG
- if (scd_debuglevel > 0) {
- if (count == 1)
- printf("scd%d: DEBUG: ATTENTIONS = 0x%x", unit, code);
- else
- printf(",0x%x", code);
- }
-#endif
-
- switch (code) {
- case ATTEN_SPIN_DOWN:
- scd_data[unit].flags &= ~SCDSPINNING;
- break;
-
- case ATTEN_SPIN_UP_DONE:
- scd_data[unit].flags |= SCDSPINNING;
- break;
-
- case ATTEN_AUDIO_DONE:
- scd_data[unit].audio_status = CD_AS_PLAY_COMPLETED;
- break;
-
- case ATTEN_DRIVE_LOADED:
- scd_data[unit].flags &= ~(SCDTOC|SCDSPINNING|SCDVALID);
- scd_data[unit].audio_status = CD_AS_AUDIO_INVALID;
- break;
-
- case ATTEN_EJECT_PUSHED:
- scd_data[unit].flags &= ~SCDVALID;
- break;
- }
- DELAY(100);
- }
-#if SCD_DEBUG
- if (scd_debuglevel > 0 && count > 0)
- printf("\n");
-#endif
-}
-
-/* Returns 0 OR sony error code */
-static int
-spin_up(unsigned unit)
-{
- unsigned char res_reg[12];
- unsigned int res_size;
- int rc;
- int loop_count = 0;
-
-again:
- rc = send_cmd(unit, CMD_SPIN_UP, NULL, 0, res_reg, &res_size);
- if (rc != 0) {
- XDEBUG(2, ("scd%d: CMD_SPIN_UP error 0x%x\n", unit, rc));
- return rc;
- }
-
- if (!(scd_data[unit].flags & SCDTOC)) {
- rc = send_cmd(unit, CMD_READ_TOC, 0);
- if (rc == ERR_NOT_SPINNING) {
- if (loop_count++ < 3)
- goto again;
- return rc;
- }
- if (rc != 0)
- return rc;
- }
-
- scd_data[unit].flags |= SCDSPINNING;
-
- return 0;
-}
-
-static struct sony_tracklist *
-get_tl(struct sony_toc *toc, int size)
-{
- struct sony_tracklist *tl = &toc->tracks[0];
-
- if (tl->track != 0xb0)
- return tl;
- (char *)tl += 9;
- if (tl->track != 0xb1)
- return tl;
- (char *)tl += 9;
- if (tl->track != 0xb2)
- return tl;
- (char *)tl += 9;
- if (tl->track != 0xb3)
- return tl;
- (char *)tl += 9;
- if (tl->track != 0xb4)
- return tl;
- (char *)tl += 9;
- if (tl->track != 0xc0)
- return tl;
- (char *)tl += 9;
- return tl;
-}
-
-static int
-read_toc(dev_t dev)
-{
- unsigned unit;
- struct scd_data *cd;
- unsigned part = 0; /* For now ... */
- struct sony_toc toc;
- struct sony_tracklist *tl;
- int rc, i, j;
- u_long first, last;
-
- unit = scd_unit(dev);
- cd = scd_data + unit;
-
- rc = send_cmd(unit, CMD_GET_TOC, 1, part+1);
- if (rc < 0)
- return rc;
- if (rc > sizeof(toc)) {
- printf("scd%d: program error: toc too large (%d)\n", unit, rc);
- return EIO;
- }
- if (get_result(unit, rc, (u_char *)&toc) != 0)
- return EIO;
-
- XDEBUG(1, ("scd%d: toc read. len = %d, sizeof(toc) = %d\n", unit, rc, sizeof(toc)));
-
- tl = get_tl(&toc, rc);
- first = msf2hsg(tl->start_msf);
- last = msf2hsg(toc.lead_out_start_msf);
- cd->blksize = SCDBLKSIZE;
- cd->disksize = last*cd->blksize/DEV_BSIZE;
-
- XDEBUG(1, ("scd%d: firstsector = %d, lastsector = %d", unit,
- first, last));
-
- cd->first_track = bcd2bin(toc.first_track);
- cd->last_track = bcd2bin(toc.last_track);
- if (cd->last_track > (MAX_TRACKS-2))
- cd->last_track = MAX_TRACKS-2;
- for (j = 0, i = cd->first_track; i <= cd->last_track; i++, j++) {
- cd->toc[i].adr = tl[j].adr;
- cd->toc[i].ctl = tl[j].ctl; /* for xcdplayer */
- bcopy(tl[j].start_msf, cd->toc[i].start_msf, 3);
-#ifdef SCD_DEBUG
- if (scd_debuglevel > 0) {
- if ((j % 3) == 0)
- printf("\nscd%d: tracks ", unit);
- printf("[%03d: %2d %2d %2d] ", i,
- bcd2bin(cd->toc[i].start_msf[0]),
- bcd2bin(cd->toc[i].start_msf[1]),
- bcd2bin(cd->toc[i].start_msf[2]));
- }
-#endif
- }
- bcopy(toc.lead_out_start_msf, cd->toc[cd->last_track+1].start_msf, 3);
-#ifdef SCD_DEBUG
- if (scd_debuglevel > 0) {
- i = cd->last_track+1;
- printf("[END: %2d %2d %2d]\n",
- bcd2bin(cd->toc[i].start_msf[0]),
- bcd2bin(cd->toc[i].start_msf[1]),
- bcd2bin(cd->toc[i].start_msf[2]));
- }
-#endif
-
- bzero(&cd->dlabel,sizeof(struct disklabel));
- /* filled with spaces first */
- strncpy(cd->dlabel.d_typename," ",
- sizeof(cd->dlabel.d_typename));
- strncpy(cd->dlabel.d_typename, cd->name,
- min(strlen(cd->name), sizeof(cd->dlabel.d_typename) - 1));
- strncpy(cd->dlabel.d_packname,"unknown ",
- sizeof(cd->dlabel.d_packname));
- cd->dlabel.d_secsize = cd->blksize;
- cd->dlabel.d_nsectors = 100;
- cd->dlabel.d_ntracks = 1;
- cd->dlabel.d_ncylinders = (cd->disksize/100)+1;
- cd->dlabel.d_secpercyl = 100;
- cd->dlabel.d_secperunit = cd->disksize;
- cd->dlabel.d_rpm = 300;
- cd->dlabel.d_interleave = 1;
- cd->dlabel.d_flags = D_REMOVABLE;
- cd->dlabel.d_npartitions= 1;
- cd->dlabel.d_partitions[0].p_offset = 0;
- cd->dlabel.d_partitions[0].p_size = cd->disksize;
- cd->dlabel.d_partitions[0].p_fstype = 9;
- cd->dlabel.d_magic = DISKMAGIC;
- cd->dlabel.d_magic2 = DISKMAGIC;
- cd->dlabel.d_checksum = dkcksum(&cd->dlabel);
-
- cd->flags |= SCDTOC;
-
- return 0;
-}
-
-static inline void
-write_control(unsigned port, unsigned data)
-{
- outb(port + OREG_CONTROL, data);
-}
-
-static void
-init_drive(unsigned unit)
-{
- int rc;
-
- rc = send_cmd(unit, CMD_SET_DRIVE_PARAM, 2,
- 0x05, 0x03 | ((scd_data[unit].double_speed) ? 0x04: 0));
- if (rc != 0)
- printf("scd%d: Unable to set parameters. Errcode = 0x%x\n", unit, rc);
-}
-
-/* Returns 0 or errno */
-static int
-get_result(u_int unit, int result_len, u_char *result)
-{
- unsigned int port = scd_data[unit].iobase;
- unsigned int res_reg = port + IREG_RESULT;
- unsigned char c;
- int loop_index = 2; /* send_cmd() reads two bytes ... */
-
- XDEBUG(1, ("scd%d: DEBUG: get_result: bytes=%d\n", unit, result_len));
-
- while (result_len-- > 0) {
- if (loop_index++ >= 10) {
- loop_index = 1;
- if (waitfor_status_bits(unit, SBIT_RESULT_READY, 0))
- return EIO;
- write_control(port, CBIT_RESULT_READY_CLEAR);
- }
- if (result)
- *result++ = inb(res_reg);
- else
- (void)inb(res_reg);
- }
- return 0;
-}
-
-/* Returns -0x100 for timeout, -(drive error code) OR number of result bytes */
-static int
-send_cmd(u_int unit, u_char cmd, u_int nargs, ...)
-{
- va_list ap;
- u_int port = scd_data[unit].iobase;
- u_int reg;
- u_char c;
- int rc;
- int i;
-
- if (waitfor_status_bits(unit, 0, SBIT_BUSY)) {
- printf("scd%d: drive busy\n", unit);
- return -0x100;
- }
-
- XDEBUG(1,("scd%d: DEBUG: send_cmd: cmd=0x%x nargs=%d", unit, cmd, nargs));
-
- write_control(port, CBIT_RESULT_READY_CLEAR);
- write_control(port, CBIT_RPARAM_CLEAR);
-
- for (i = 0; i < 100; i++)
- if (FSTATUS_BIT(port, FBIT_WPARAM_READY))
- break;
- if (!FSTATUS_BIT(port, FBIT_WPARAM_READY)) {
- XDEBUG(1, ("\nscd%d: wparam timeout\n", unit));
- return -EIO;
- }
-
- va_start(ap, nargs);
- reg = port + OREG_WPARAMS;
- for (i = 0; i < nargs; i++) {
- c = (u_char)va_arg(ap, int);
- outb(reg, c);
- XDEBUG(1, (",{0x%x}", c));
- }
- va_end(ap);
- XDEBUG(1, ("\n"));
-
- outb(port+OREG_COMMAND, cmd);
-
- if (rc = waitfor_status_bits(unit, SBIT_RESULT_READY, SBIT_BUSY))
- return -0x100;
-
- reg = port + IREG_RESULT;
- write_control(port, CBIT_RESULT_READY_CLEAR);
- switch ((rc = inb(reg)) & 0xf0) {
- case 0x20:
- rc = inb(reg);
- /* FALL TROUGH */
- case 0x50:
- XDEBUG(1, ("scd%d: DEBUG: send_cmd: drive_error=0x%x\n", unit, rc));
- return -rc;
- case 0x00:
- default:
- rc = inb(reg);
- XDEBUG(1, ("scd%d: DEBUG: send_cmd: result_len=%d\n", unit, rc));
- return rc;
- }
-}
-
-static void
-print_error(int unit, int errcode)
-{
- switch (errcode) {
- case -ERR_CD_NOT_LOADED:
- printf("scd%d: door is open\n", unit);
- break;
- case -ERR_NO_CD_INSIDE:
- printf("scd%d: no cd inside\n", unit);
- break;
- default:
- if (errcode == -0x100 || errcode > 0)
- printf("scd%d: device timeout\n", unit);
- else
- printf("scd%d: unexpected error 0x%x\n", unit, -errcode);
- break;
- }
-}
-
-/* Returns 0 or errno value */
-static int
-waitfor_status_bits(int unit, int bits_set, int bits_clear)
-{
- u_int port = scd_data[unit].iobase;
- u_int flags = scd_data[unit].flags;
- u_int reg = port + IREG_STATUS;
- u_int max_loop;
- u_char c = 0;
-
- if (flags & SCDPROBING) {
- max_loop = 0;
- while (max_loop++ < 1000) {
- c = inb(reg);
- if (c == 0xff)
- return EIO;
- if (c & SBIT_ATTENTION) {
- process_attention(unit);
- continue;
- }
- if ((c & bits_set) == bits_set &&
- (c & bits_clear) == 0)
- {
- break;
- }
- DELAY(10000);
- }
- } else {
- max_loop = 100;
- while (max_loop-- > 0) {
- c = inb(reg);
- if (c & SBIT_ATTENTION) {
- process_attention(unit);
- continue;
- }
- if ((c & bits_set) == bits_set &&
- (c & bits_clear) == 0)
- {
- break;
- }
- tsleep(waitfor_status_bits, PZERO - 1, "waitfor", hz/10);
- }
- }
- if ((c & bits_set) == bits_set &&
- (c & bits_clear) == 0)
- {
- return 0;
- }
-#ifdef SCD_DEBUG
- if (scd_debuglevel > 0)
- printf("scd%d: DEBUG: waitfor: TIMEOUT (0x%x,(0x%x,0x%x))\n", unit, c, bits_set, bits_clear);
- else
-#endif
- printf("scd%d: timeout.\n", unit);
- return EIO;
-}
-
-/* these two routines for xcdplayer - "borrowed" from mcd.c */
-static int
-scd_toc_header (int unit, struct ioc_toc_header* th)
-{
- struct scd_data *cd = scd_data + unit;
- int rc;
-
- if (!(cd->flags & SCDTOC) && (rc = read_toc(unit)) != 0) {
- print_error(unit, rc);
- return EIO;
- }
-
- th->starting_track = cd->first_track;
- th->ending_track = cd->last_track;
- th->len = 0; /* not used */
-
- return 0;
-}
-
-static int
-scd_toc_entrys (int unit, struct ioc_read_toc_entry *te)
-{
- struct scd_data *cd = scd_data + unit;
- struct cd_toc_entry toc_entry;
- int rc, i, len = te->data_len;
-
- if (!(cd->flags & SCDTOC) && (rc = read_toc(unit)) != 0) {
- print_error(unit, rc);
- return EIO;
- }
-
- /* find the toc to copy*/
- i = te->starting_track;
- if (i == SCD_LASTPLUS1)
- i = cd->last_track + 1;
-
- /* verify starting track */
- if (i < cd->first_track || i > cd->last_track+1)
- return EINVAL;
-
- /* valid length ? */
- if (len < sizeof(struct cd_toc_entry)
- || (len % sizeof(struct cd_toc_entry)) != 0)
- return EINVAL;
-
- /* copy the toc data */
- toc_entry.control = cd->toc[i].ctl;
- toc_entry.addr_type = te->address_format;
- toc_entry.track = i;
- if (te->address_format == CD_MSF_FORMAT) {
- toc_entry.addr.msf.unused = 0;
- toc_entry.addr.msf.minute = bcd2bin(cd->toc[i].start_msf[0]);
- toc_entry.addr.msf.second = bcd2bin(cd->toc[i].start_msf[1]);
- toc_entry.addr.msf.frame = bcd2bin(cd->toc[i].start_msf[2]);
- }
-
- /* copy the data back */
- if (copyout(&toc_entry, te->data, sizeof(struct cd_toc_entry)) != 0)
- return EFAULT;
-
- return 0;
-}
-
-
-#endif /* NSCD > 0 */
diff --git a/sys/gnu/i386/isa/scdreg.h b/sys/gnu/i386/isa/scdreg.h
deleted file mode 100644
index 93ace5c..0000000
--- a/sys/gnu/i386/isa/scdreg.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*-
- * Copyright (c) 1995 Mikael Hybsch
- *
- * The Linux driver cdu31a has been used as a reference when writing this
- * code, therefore bringing it under the GNU Public License. The following
- * conditions of redistribution therefore apply:
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id: scdreg.h,v 1.2 1995/01/29 22:51:41 jkh Exp $
- *
- */
-
-#ifndef SCD_H
-#define SCD_H
-
-#ifdef __GNUC__
-#if __GNUC__ >= 2
-#pragma pack(1)
-#endif
-#endif
-
-typedef unsigned char bcd_t;
-#define M_msf(msf) msf[0]
-#define S_msf(msf) msf[1]
-#define F_msf(msf) msf[2]
-
-#define IS_ATTENTION(port) ((inb(port+IREG_STATUS) & SBIT_ATTENTION) != 0)
-#define IS_BUSY(port) ((inb(port+IREG_STATUS) & SBIT_BUSY) != 0)
-#define IS_DATA_RDY(port) ((inb(port+IREG_STATUS) & SBIT_DATA_READY) != 0)
-#define STATUS_BIT(port, bit) ((inb(port+IREG_STATUS) & (bit)) != 0)
-#define FSTATUS_BIT(port, bit) ((inb(port+IREG_FSTATUS) & (bit)) != 0)
-
-#define OREG_COMMAND 0
-#define OREG_WPARAMS 1
-#define OREG_CONTROL 3
-#define CBIT_ATTENTION_CLEAR 0x01
-#define CBIT_RESULT_READY_CLEAR 0x02
-#define CBIT_DATA_READY_CLEAR 0x04
-#define CBIT_RPARAM_CLEAR 0x40
-#define CBIT_RESET_DRIVE 0x80
-
-#define IREG_STATUS 0
-#define SBIT_ATTENTION 0x01
-#define SBIT_RESULT_READY 0x02
-#define SBIT_DATA_READY 0x04
-#define SBIT_BUSY 0x80
-
-#define IREG_RESULT 1
-#define IREG_DATA 2
-#define IREG_FSTATUS 3
-#define FBIT_WPARAM_READY 0x01
-
-#define CMD_GET_DRIVE_CONFIG 0x00
-#define CMD_SET_DRIVE_PARAM 0x10
-#define CMD_GET_SUBCHANNEL_DATA 0x21
-#define CMD_GET_TOC 0x24
-#define CMD_READ_TOC 0x30
-#define CMD_READ 0x34
-#define CMD_PLAY_AUDIO 0x40
-#define CMD_STOP_AUDIO 0x41
-#define CMD_EJECT 0x50
-#define CMD_SPIN_UP 0x51
-#define CMD_SPIN_DOWN 0x52
-
-#define ERR_CD_NOT_LOADED 0x20
-#define ERR_NO_CD_INSIDE 0x21
-#define ERR_NOT_SPINNING 0x22
-#define ERR_FATAL_READ_ERROR1 0x53
-#define ERR_FATAL_READ_ERROR2 0x57
-
-#define ATTEN_DRIVE_LOADED 0x80
-#define ATTEN_EJECT_PUSHED 0x81
-#define ATTEN_AUDIO_DONE 0x90
-#define ATTEN_SPIN_UP_DONE 0x24
-#define ATTEN_SPIN_DOWN 0x27
-#define ATTEN_EJECT_DONE 0x28
-
-
-struct sony_drive_configuration {
- char vendor[8];
- char product[16];
- char revision[8];
- u_short config;
-};
-
-/* Almost same as cd_sub_channel_position_data */
-struct sony_subchannel_position_data {
- u_char control:4;
- u_char addr_type:4;
- u_char track_number;
- u_char index_number;
- u_char rel_msf[3];
- u_char dummy;
- u_char abs_msf[3];
-};
-
-struct sony_tracklist {
- u_char adr :4; /* xcdplayer needs these two values */
- u_char ctl :4;
- u_char track;
- u_char start_msf[3];
-};
-
-#define MAX_TRACKS 100
-
-struct sony_toc {
- u_char session_number;
-
- u_char :8;
- u_char :8;
- u_char first_track;
- u_char :8;
- u_char :8;
-
- u_char :8;
- u_char :8;
- u_char last_track;
- u_char :8;
- u_char :8;
-
- u_char :8;
- u_char :8;
- u_char lead_out_start_msf[3];
-
- struct sony_tracklist tracks[MAX_TRACKS];
-
- /* The rest is just to take space in case all data is returned */
-
- u_char dummy[6*9];
-};
-
-#endif /* SCD_H */
diff --git a/sys/gnu/i386/scd.c b/sys/gnu/i386/scd.c
deleted file mode 100644
index 2ea212e..0000000
--- a/sys/gnu/i386/scd.c
+++ /dev/null
@@ -1,1530 +0,0 @@
-/*-
- * Copyright (c) 1995 Mikael Hybsch
- *
- * Portions of this file are copied from mcd.c
- * which has the following copyrights:
- *
- * Copyright 1993 by Holger Veit (data part)
- * Copyright 1993 by Brian Moore (audio part)
- * Changes Copyright 1993 by Gary Clark II
- * Changes Copyright (C) 1994 by Andrew A. Chernov
- *
- * Rewrote probe routine to work on newer Mitsumi drives.
- * Additional changes (C) 1994 by Jordan K. Hubbard
- *
- * The Linux driver cdu31a has been used as a reference when writing this
- * code, there fore bringing it under the GNU Public License. The following
- * conditions of redistribution therefore apply:
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-
-/* $Id: scd.c,v 1.6 1995/02/06 22:35:06 jkh Exp $ */
-
-/* Please send any comments to micke@dynas.se */
-
-#define SCD_DEBUG 0
-
-#include "scd.h"
-#if NSCD > 0
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/buf.h>
-#include <sys/stat.h>
-#include <sys/uio.h>
-#include <sys/ioctl.h>
-#include <sys/cdio.h>
-#include <sys/errno.h>
-#include <sys/dkbad.h>
-#include <sys/disklabel.h>
-#include <sys/devconf.h>
-#include <machine/stdarg.h>
-
-#include <i386/isa/isa.h>
-#include <i386/isa/isa_device.h>
-#include <gnu/i386/scdreg.h>
-
-#define scd_part(dev) ((minor(dev)) & 7)
-#define scd_unit(dev) (((minor(dev)) & 0x38) >> 3)
-#define scd_phys(dev) (((minor(dev)) & 0x40) >> 6)
-#define RAW_PART 2
-
-/* flags */
-#define SCDOPEN 0x0001 /* device opened */
-#define SCDVALID 0x0002 /* parameters loaded */
-#define SCDINIT 0x0004 /* device is init'd */
-#define SCDPROBING 0x0020 /* probing */
-#define SCDTOC 0x0100 /* already read toc */
-#define SCDMBXBSY 0x0200 /* local mbx is busy */
-#define SCDSPINNING 0x0400 /* drive is spun up */
-
-#define SCD_S_BEGIN 0
-#define SCD_S_BEGIN1 1
-#define SCD_S_WAITSTAT 2
-#define SCD_S_WAITFIFO 3
-#define SCD_S_WAITSPIN 4
-#define SCD_S_WAITREAD 5
-#define SCD_S_WAITPARAM 6
-
-#define RDELAY_WAIT 300
-#define RDELAY_WAITREAD 300
-
-#define SCDBLKSIZE 2048
-
-#ifdef SCD_DEBUG
- int scd_debuglevel = SCD_DEBUG;
-# define XDEBUG(level, data) {if (scd_debuglevel >= level) printf data;}
-#else
-# define XDEBUG(level, data)
-#endif
-
-struct scd_mbx {
- short unit;
- short port;
- short retry;
- short nblk;
- int sz;
- u_long skip;
- struct buf *bp;
- int p_offset;
- short count;
-};
-
-struct scd_data {
- int iobase;
- char double_speed;
- char *name;
- short flags;
- int blksize;
- u_long disksize;
- struct disklabel dlabel;
- int openflag;
- struct {
- unsigned char adr :4;
- unsigned char ctl :4; /* xcdplayer needs this */
- unsigned char start_msf[3];
- } toc[MAX_TRACKS];
- short first_track;
- short last_track;
- struct ioc_play_msf last_play;
-
- short audio_status;
- struct buf head; /* head of buf queue */
- struct scd_mbx mbx;
-} scd_data[NSCD];
-
-/* prototypes */
-int scdopen(dev_t dev);
-int scdclose(dev_t dev);
-void scdstrategy(struct buf *bp);
-int scdioctl(dev_t dev, int cmd, caddr_t addr, int flags);
-int scdsize(dev_t dev);
-
-static int bcd2bin(bcd_t b);
-static bcd_t bin2bcd(int b);
-static void hsg2msf(int hsg, bcd_t *msf);
-static int msf2hsg(bcd_t *msf);
-
-static void process_attention(unsigned unit);
-static inline void write_control(unsigned port, unsigned data);
-static int waitfor_status_bits(int unit, int bits_set, int bits_clear);
-static int waitfor_attention(int unit);
-static int send_cmd(u_int unit, u_char cmd, u_int nargs, ...);
-static void init_drive(unsigned unit);
-static int spin_up(unsigned unit);
-static int read_toc(dev_t dev);
-static int get_result(u_int unit, int result_len, u_char *result);
-static void print_error(int unit, int errcode);
-
-static void scd_start(int unit);
-static void scd_doread(int state, struct scd_mbx *mbxin);
-
-static int scd_eject(int unit);
-static int scd_stop(int unit);
-static int scd_pause(int unit);
-static int scd_resume(int unit);
-static int scd_playtracks(int unit, struct ioc_play_track *pt);
-static int scd_playmsf(int unit, struct ioc_play_msf *msf);
-static int scd_play(int unit, struct ioc_play_msf *msf);
-static int scd_subchan(int unit, struct ioc_read_subchannel *sc);
-static int read_subcode(int unit, struct sony_subchannel_position_data *sc);
-
-/* for xcdplayer */
-static int scd_toc_header(int unit, struct ioc_toc_header *th);
-static int scd_toc_entrys(int unit, struct ioc_read_toc_entry *te);
-#define SCD_LASTPLUS1 170 /* don't ask, xcdplayer passes this in */
-
-extern int hz;
-
-int scd_probe(struct isa_device *dev);
-int scd_attach(struct isa_device *dev);
-struct isa_driver scddriver = { scd_probe, scd_attach, "scd" };
-
-static struct kern_devconf kdc_scd[NSCD] = { {
- 0, 0, 0, /* filled in by dev_attach */
- "scd", 0, { MDDT_ISA, 0, "bio" },
- isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
- &kdc_isa0, /* parent */
- 0, /* parentdata */
- DC_IDLE, /* status */
- "Sony CD-ROM drive" /* properly filled later */
-} };
-
-static inline void
-scd_registerdev(struct isa_device *id)
-{
- if(id->id_unit)
- kdc_scd[id->id_unit] = kdc_scd[0];
- kdc_scd[id->id_unit].kdc_unit = id->id_unit;
- kdc_scd[id->id_unit].kdc_isa = id;
- dev_attach(&kdc_scd[id->id_unit]);
-}
-
-int scd_attach(struct isa_device *dev)
-{
- struct scd_data *cd = scd_data + dev->id_unit;
- int i;
-
- cd->iobase = dev->id_iobase; /* Already set by probe, but ... */
-
- scd_registerdev(dev);
- /* name filled in probe */
- kdc_scd[dev->id_unit].kdc_description = scd_data[dev->id_unit].name;
- printf("scd%d: <%s>\n", dev->id_unit, scd_data[dev->id_unit].name);
-
- init_drive(dev->id_unit);
-
- cd->flags = SCDINIT;
- cd->audio_status = CD_AS_AUDIO_INVALID;
-
- return 1;
-}
-
-int
-scdopen(dev_t dev)
-{
- int unit,part,phys;
- int rc;
- struct scd_data *cd;
-
- unit = scd_unit(dev);
- if (unit >= NSCD)
- return ENXIO;
-
- cd = scd_data + unit;
- part = scd_part(dev);
- phys = scd_phys(dev);
-
- /* not initialized*/
- if (!(cd->flags & SCDINIT))
- return ENXIO;
-
- /* invalidated in the meantime? mark all open part's invalid */
- if (cd->openflag)
- return ENXIO;
-
- XDEBUG(1,("scd%d: DEBUG: status = 0x%x\n", unit, inb(cd->iobase+IREG_STATUS)));
-
- if ((rc = spin_up(unit)) != 0) {
- print_error(unit, rc);
- return EIO;
- }
- if (!(cd->flags & SCDTOC)) {
- int loop_count = 3;
-
- while (loop_count-- > 0 && (rc = read_toc(dev)) != 0) {
- if (rc == ERR_NOT_SPINNING) {
- rc = spin_up(unit);
- if (rc) {
- print_error(unit, rc);\
- return EIO;
- }
- continue;
- }
- printf("scd%d: TOC read error 0x%x\n", unit, rc);
- return EIO;
- }
- }
-
- cd->openflag = 1;
- cd->flags |= SCDVALID;
- kdc_scd[unit].kdc_state = DC_BUSY;
-
- return 0;
-}
-
-int
-scdclose(dev_t dev)
-{
- int unit,part,phys;
- struct scd_data *cd;
- int rlen;
- char rdata[10];
-
- unit = scd_unit(dev);
- if (unit >= NSCD)
- return ENXIO;
-
- cd = scd_data + unit;
- part = scd_part(dev);
- phys = scd_phys(dev);
-
- if (!(cd->flags & SCDINIT) || !cd->openflag)
- return ENXIO;
-
- if (cd->audio_status != CD_AS_PLAY_IN_PROGRESS) {
- (void)send_cmd(unit, CMD_SPIN_DOWN, 0);
- cd->flags &= ~SCDSPINNING;
- }
-
- kdc_scd[unit].kdc_state = DC_IDLE;
-
- /* close channel */
- cd->openflag = 0;
-
- return 0;
-}
-
-void
-scdstrategy(struct buf *bp)
-{
- struct scd_data *cd;
- struct buf *qp;
- int s;
- int unit = scd_unit(bp->b_dev);
-
- cd = scd_data + unit;
-
- XDEBUG(2, ("scd%d: DEBUG: strategy: block=%ld, bcount=%ld\n", unit, bp->b_blkno, bp->b_bcount));
-
- if (unit >= NSCD || bp->b_blkno < 0 || (bp->b_bcount % SCDBLKSIZE)) {
- printf("scd%d: strategy failure: blkno = %d, bcount = %d\n",
- unit, bp->b_blkno, bp->b_bcount);
- bp->b_error = EINVAL;
- bp->b_flags |= B_ERROR;
- goto bad;
- }
-
- /* if device invalidated (e.g. media change, door open), error */
- if (!(cd->flags & SCDVALID)) {
- printf("scd%d: media changed\n", unit);
- bp->b_error = EIO;
- goto bad;
- }
-
- /* read only */
- if (!(bp->b_flags & B_READ)) {
- bp->b_error = EROFS;
- goto bad;
- }
-
- /* no data to read */
- if (bp->b_bcount == 0)
- goto done;
-
- if (!(cd->flags & SCDTOC)) {
- bp->b_error = EIO;
- goto bad;
- }
- /* adjust transfer if necessary */
- if (bounds_check_with_label(bp,&cd->dlabel,1) <= 0)
- goto done;
-
- bp->b_pblkno = bp->b_blkno;
- bp->b_resid = 0;
-
- /* queue it */
- qp = &cd->head;
- s = splbio();
- disksort(qp,bp);
- splx(s);
-
- /* now check whether we can perform processing */
- scd_start(unit);
- return;
-
-bad:
- bp->b_flags |= B_ERROR;
-done:
- bp->b_resid = bp->b_bcount;
- biodone(bp);
- return;
-}
-
-static void
-scd_start(int unit)
-{
- struct scd_data *cd = scd_data + unit;
- struct buf *bp, *qp = &cd->head;
- struct partition *p;
- int part;
- register s = splbio();
-
- if (cd->flags & SCDMBXBSY) {
- splx(s);
- return;
- }
-
- if ((bp = qp->b_actf) != 0) {
- /* block found to process, dequeue */
- qp->b_actf = bp->b_actf;
- cd->flags |= SCDMBXBSY;
- splx(s);
- } else {
- /* nothing to do */
- splx(s);
- return;
- }
-
- p = cd->dlabel.d_partitions + scd_part(bp->b_dev);
-
- cd->mbx.unit = unit;
- cd->mbx.port = cd->iobase;
- cd->mbx.retry = 3;
- cd->mbx.bp = bp;
- cd->mbx.p_offset = p->p_offset;
- splx(s);
-
- scd_doread(SCD_S_BEGIN,&(cd->mbx));
- return;
-}
-
-int
-scdioctl(dev_t dev, int cmd, caddr_t addr, int flags)
-{
- struct scd_data *cd;
- int unit,part;
-
- unit = scd_unit(dev);
- part = scd_part(dev);
- cd = scd_data + unit;
-
- XDEBUG(1, ("scd%d: ioctl: cmd=0x%lx\n", unit, cmd));
-
- if (!(cd->flags & SCDVALID))
- return EIO;
-
- switch (cmd) {
- case DIOCSBAD:
- return EINVAL;
- case DIOCGDINFO:
- *(struct disklabel *)addr = cd->dlabel;
- return 0;
- case DIOCGPART:
- ((struct partinfo *)addr)->disklab = &cd->dlabel;
- ((struct partinfo *)addr)->part =
- &cd->dlabel.d_partitions[0];
- return 0;
- case CDIOCPLAYTRACKS:
- return scd_playtracks(unit, (struct ioc_play_track *) addr);
- case CDIOCPLAYBLOCKS:
- return EINVAL;
- case CDIOCPLAYMSF:
- return scd_playmsf(unit, (struct ioc_play_msf *) addr);
- case CDIOCREADSUBCHANNEL:
- return scd_subchan(unit, (struct ioc_read_subchannel *) addr);
- case CDIOREADTOCHEADER:
- return scd_toc_header (unit, (struct ioc_toc_header *) addr);
- case CDIOREADTOCENTRYS:
- return scd_toc_entrys (unit, (struct ioc_read_toc_entry*) addr);
- case CDIOCSETPATCH:
- case CDIOCGETVOL:
- case CDIOCSETVOL:
- case CDIOCSETMONO:
- case CDIOCSETSTERIO:
- case CDIOCSETMUTE:
- case CDIOCSETLEFT:
- case CDIOCSETRIGHT:
- return EINVAL;
- case CDIOCRESUME:
- return scd_resume(unit);
- case CDIOCPAUSE:
- return scd_pause(unit);
- case CDIOCSTART:
- return EINVAL;
- case CDIOCSTOP:
- return scd_stop(unit);
- case CDIOCEJECT:
- return scd_eject(unit);
- case CDIOCALLOW:
- return 0;
- case CDIOCSETDEBUG:
-#ifdef SCD_DEBUG
- scd_debuglevel++;
-#endif
- return 0;
- case CDIOCCLRDEBUG:
-#ifdef SCD_DEBUG
- scd_debuglevel = 0;
-
-#endif
- return 0;
- default:
- printf("scd%d: unsupported ioctl (cmd=0x%lx)\n", unit, cmd);
- return ENOTTY;
- }
-}
-
-int
-scdsize(dev_t dev)
-{
- return -1;
-}
-
-void
-scdintr()
-{
- return;
-}
-
-/***************************************************************
- * lower level of driver starts here
- **************************************************************/
-
-static int
-scd_playtracks(int unit, struct ioc_play_track *pt)
-{
- struct scd_data *cd = scd_data + unit;
- struct ioc_play_msf msf;
- int a = pt->start_track;
- int z = pt->end_track;
- int rc, i;
-
- if (!(cd->flags & SCDTOC) && (rc = read_toc(unit)) != 0) {
- if (rc == -ERR_NOT_SPINNING) {
- if (spin_up(unit) != 0)
- return EIO;
- rc = read_toc(unit);
- }
- if (rc != 0) {
- print_error(unit, rc);
- return EIO;
- }
- }
-
- XDEBUG(1, ("scd%d: playtracks from %d:%d to %d:%d\n", unit,
- a, pt->start_index, z, pt->end_index));
-
- if ( a < cd->first_track
- || a > cd->last_track
- || a > z
- || z > cd->last_track)
- return EINVAL;
-
- bcopy(cd->toc[a].start_msf, &msf.start_m, 3);
- hsg2msf(msf2hsg(cd->toc[z+1].start_msf)-1, &msf.end_m);
-
- return scd_play(unit, &msf);
-}
-
-/* The start/end msf is expected to be in bin format */
-static int
-scd_playmsf(int unit, struct ioc_play_msf *msfin)
-{
- struct ioc_play_msf msf;
-
- msf.start_m = bin2bcd(msfin->start_m);
- msf.start_s = bin2bcd(msfin->start_s);
- msf.start_f = bin2bcd(msfin->start_f);
- msf.end_m = bin2bcd(msfin->end_m);
- msf.end_s = bin2bcd(msfin->end_s);
- msf.end_f = bin2bcd(msfin->end_f);
-
- return scd_play(unit, &msf);
-}
-
-/* The start/end msf is expected to be in bcd format */
-static int
-scd_play(int unit, struct ioc_play_msf *msf)
-{
- struct scd_data *cd = scd_data + unit;
- int i, rc;
-
- XDEBUG(1, ("scd%d: playing: %02x:%02x:%02x -> %02x:%02x:%02x\n", unit,
- msf->start_m, msf->start_s, msf->start_f,
- msf->end_m, msf->end_s, msf->end_f));
-
- for (i = 0; i < 2; i++) {
- rc = send_cmd(unit, CMD_PLAY_AUDIO, 7,
- 0x03,
- msf->start_m, msf->start_s, msf->start_f,
- msf->end_m, msf->end_s, msf->end_f);
- if (rc == -ERR_NOT_SPINNING) {
- cd->flags &= ~SCDSPINNING;
- if (spin_up(unit) != 0)
- return EIO;
- } else if (rc < 0) {
- print_error(unit, rc);
- return EIO;
- } else {
- break;
- }
- }
- cd->audio_status = CD_AS_PLAY_IN_PROGRESS;
- bcopy((char *)msf, (char *)&cd->last_play, sizeof(struct ioc_play_msf));
- return 0;
-}
-
-static int
-scd_stop(int unit)
-{
- struct scd_data *cd = scd_data + unit;
-
- (void)send_cmd(unit, CMD_STOP_AUDIO, 0);
- cd->audio_status = CD_AS_PLAY_COMPLETED;
- return 0;
-}
-
-static int
-scd_pause(int unit)
-{
- struct scd_data *cd = scd_data + unit;
- struct sony_subchannel_position_data subpos;
-
- if (cd->audio_status != CD_AS_PLAY_IN_PROGRESS)
- return EINVAL;
-
- if (read_subcode(unit, &subpos) != 0)
- return EIO;
-
- if (send_cmd(unit, CMD_STOP_AUDIO, 0) != 0)
- return EIO;
-
- cd->last_play.start_m = subpos.abs_msf[0];
- cd->last_play.start_s = subpos.abs_msf[1];
- cd->last_play.start_f = subpos.abs_msf[2];
- cd->audio_status = CD_AS_PLAY_PAUSED;
-
- XDEBUG(1, ("scd%d: pause @ %02x:%02x:%02x\n", unit,
- cd->last_play.start_m,
- cd->last_play.start_s,
- cd->last_play.start_f));
-
- return 0;
-}
-
-static int
-scd_resume(int unit)
-{
- if (scd_data[unit].audio_status != CD_AS_PLAY_PAUSED)
- return EINVAL;
- return scd_play(unit, &scd_data[unit].last_play);
-}
-
-static int
-scd_eject(int unit)
-{
- struct scd_data *cd = scd_data + unit;
- int port = cd->iobase;
-
- cd->audio_status = CD_AS_AUDIO_INVALID;
- cd->flags &= ~(SCDSPINNING|SCDTOC);
-
- if (send_cmd(unit, CMD_STOP_AUDIO, 0) != 0 ||
- send_cmd(unit, CMD_SPIN_DOWN, 0) != 0 ||
- send_cmd(unit, CMD_EJECT, 0) != 0)
- {
- return EIO;
- }
- return 0;
-}
-
-static int
-scd_subchan(int unit, struct ioc_read_subchannel *sc)
-{
- struct scd_data *cd = scd_data + unit;
- struct sony_subchannel_position_data q;
- struct cd_sub_channel_info data;
-
- XDEBUG(1, ("scd%d: subchan af=%d, df=%d\n", unit,
- sc->address_format,
- sc->data_format));
-
- if (sc->address_format != CD_MSF_FORMAT)
- return EINVAL;
-
- if (sc->data_format != CD_CURRENT_POSITION)
- return EINVAL;
-
- if (read_subcode(unit, &q) != 0)
- return EIO;
-
- data.header.audio_status = cd->audio_status;
- data.what.position.data_format = CD_MSF_FORMAT;
- data.what.position.track_number = bcd2bin(q.track_number);
- data.what.position.reladdr.msf.unused = 0;
- data.what.position.reladdr.msf.minute = bcd2bin(q.rel_msf[0]);
- data.what.position.reladdr.msf.second = bcd2bin(q.rel_msf[1]);
- data.what.position.reladdr.msf.frame = bcd2bin(q.rel_msf[2]);
- data.what.position.absaddr.msf.unused = 0;
- data.what.position.absaddr.msf.minute = bcd2bin(q.abs_msf[0]);
- data.what.position.absaddr.msf.second = bcd2bin(q.abs_msf[1]);
- data.what.position.absaddr.msf.frame = bcd2bin(q.abs_msf[2]);
-
- if (copyout(&data, sc->data, min(sizeof(struct cd_sub_channel_info), sc->data_len))!=0)
- return EFAULT;
- return 0;
-}
-
-int
-scd_probe(struct isa_device *dev)
-{
- struct sony_drive_configuration drive_config;
- int unit = dev->id_unit;
- int rc;
- static char namebuf[8+16+8+3];
- char *s = namebuf;
- int loop_count = 0;
-
- scd_data[unit].flags = SCDPROBING;
- scd_data[unit].iobase = dev->id_iobase;
-
- bzero(&drive_config, sizeof(drive_config));
-
-again:
- /* Reset drive */
- write_control(dev->id_iobase, CBIT_RESET_DRIVE);
-
- /* Calm down */
- DELAY(300000);
-
- /* Only the ATTENTION bit may be set */
- if ((inb(dev->id_iobase+IREG_STATUS) & ~1) != 0) {
- XDEBUG(1, ("scd: too many bits set. probe failed.\n"));
- return 0;
- }
- rc = send_cmd(unit, CMD_GET_DRIVE_CONFIG, 0);
- if (rc != sizeof(drive_config)) {
- /* Sometimes if the drive is playing audio I get */
- /* the bad result 82. Fix by repeating the reset */
- if (rc > 0 && loop_count++ == 0)
- goto again;
- return 0;
- }
- if (get_result(unit, rc, (u_char *)&drive_config) != 0)
- return 0;
-
- bcopy(drive_config.vendor, namebuf, 8);
- s = namebuf+8;
- while (*(s-1) == ' ') /* Strip trailing spaces */
- s--;
- *s++ = ' ';
- bcopy(drive_config.product, s, 16);
- s += 16;
- while (*(s-1) == ' ')
- s--;
- *s++ = ' ';
- bcopy(drive_config.revision, s, 8);
- s += 8;
- while (*(s-1) == ' ')
- s--;
- *s = 0;
-
- scd_data[unit].name = namebuf;
-
- if (drive_config.config & 0x10)
- scd_data[unit].double_speed = 1;
- else
- scd_data[unit].double_speed = 0;
-
- return 4;
-}
-
-static int
-read_subcode(int unit, struct sony_subchannel_position_data *sc)
-{
- int rc;
-
- rc = send_cmd(unit, CMD_GET_SUBCHANNEL_DATA, 0);
- if (rc < 0 || rc < sizeof(*sc))
- return EIO;
- if (get_result(unit, rc, (u_char *)sc) != 0)
- return EIO;
- return 0;
-}
-
-/* State machine copied from mcd.c */
-
-/* This (and the code in mcd.c) will not work with more than one drive */
-/* because there is only one mbxsave below. Should fix that some day. */
-/* (mbxsave & state should probably be included in the scd_data struct and */
-/* the unit number used as first argument to scd_doread().) /Micke */
-
-/* state machine to process read requests
- * initialize with SCD_S_BEGIN: reset state machine
- * SCD_S_WAITSTAT: wait for ready (!busy)
- * SCD_S_WAITSPIN: wait for drive to spin up (if not spinning)
- * SCD_S_WAITFIFO: wait for param fifo to get ready, them exec. command.
- * SCD_S_WAITREAD: wait for data ready, read data
- * SCD_S_WAITPARAM: wait for command result params, read them, error if bad data read.
- */
-
-static struct scd_mbx *mbxsave;
-
-static void
-scd_doread(int state, struct scd_mbx *mbxin)
-{
- struct scd_mbx *mbx = (state!=SCD_S_BEGIN) ? mbxsave : mbxin;
- int unit = mbx->unit;
- int port = mbx->port;
- struct buf *bp = mbx->bp;
- struct scd_data *cd = scd_data + unit;
- int reg,i,k,c;
- int blknum;
- caddr_t addr;
- char rdata[10];
- static char sdata[3]; /* Must be preserved between calls to this function */
-
-loop:
- switch (state) {
- case SCD_S_BEGIN:
- mbx = mbxsave = mbxin;
-
- case SCD_S_BEGIN1:
- /* get status */
- mbx->count = RDELAY_WAIT;
-
- process_attention(unit);
- goto trystat;
-
- case SCD_S_WAITSTAT:
- untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITSTAT);
- if (mbx->count-- <= 0) {
- printf("scd%d: timeout. drive busy.\n",unit);
- goto harderr;
- }
-
-trystat:
- if (IS_BUSY(port)) {
- timeout((timeout_func_t)scd_doread,
- (caddr_t)SCD_S_WAITSTAT,hz/100); /* XXX */
- return;
- }
-
- process_attention(unit);
-
- /* reject, if audio active */
- if (cd->audio_status & CD_AS_PLAY_IN_PROGRESS) {
- printf("scd%d: audio is active\n",unit);
- goto harderr;
- }
-
- mbx->sz = cd->blksize;
-
-firstblock:
- /* for first block */
- mbx->nblk = (bp->b_bcount + (mbx->sz-1)) / mbx->sz;
- mbx->skip = 0;
-
-nextblock:
- if (!(cd->flags & SCDVALID))
- goto changed;
-
- blknum = (bp->b_blkno / (mbx->sz/DEV_BSIZE))
- + mbx->p_offset + mbx->skip/mbx->sz;
-
- XDEBUG(2, ("scd%d: scd_doread: read blknum=%d\n", unit, blknum));
-
- /* build parameter block */
- hsg2msf(blknum, sdata);
-
- write_control(port, CBIT_RESULT_READY_CLEAR);
- write_control(port, CBIT_RPARAM_CLEAR);
- write_control(port, CBIT_DATA_READY_CLEAR);
-
- if (FSTATUS_BIT(port, FBIT_WPARAM_READY))
- goto writeparam;
-
- mbx->count = 100;
- timeout((timeout_func_t)scd_doread,
- (caddr_t)SCD_S_WAITFIFO,hz/100); /* XXX */
- return;
-
- case SCD_S_WAITSPIN:
- untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITSPIN);
- if (mbx->count-- <= 0) {
- printf("scd%d: timeout waiting for drive to spin up.\n", unit);
- goto harderr;
- }
- if (!STATUS_BIT(port, SBIT_RESULT_READY)) {
- timeout((timeout_func_t)scd_doread,
- (caddr_t)SCD_S_WAITSPIN,hz/100); /* XXX */
- return;
- }
- write_control(port, CBIT_RESULT_READY_CLEAR);
- switch ((i = inb(port+IREG_RESULT)) & 0xf0) {
- case 0x20:
- i = inb(port+IREG_RESULT);
- print_error(unit, i);
- goto harderr;
- case 0x00:
- (void)inb(port+IREG_RESULT);
- cd->flags |= SCDSPINNING;
- break;
- }
- XDEBUG(1, ("scd%d: DEBUG: spin up complete\n", unit));
-
- state = SCD_S_BEGIN1;
- goto loop;
-
- case SCD_S_WAITFIFO:
- untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITFIFO);
- if (mbx->count-- <= 0) {
- printf("scd%d: timeout. write param not ready.\n",unit);
- goto harderr;
- }
- if (!FSTATUS_BIT(port, FBIT_WPARAM_READY)) {
- timeout((timeout_func_t)scd_doread,
- (caddr_t)SCD_S_WAITFIFO,hz/100); /* XXX */
- return;
- }
- XDEBUG(1, ("scd%d: mbx->count (writeparamwait) = %d(%d)\n", unit, mbx->count, 100));
-
-writeparam:
- /* The reason this test isn't done 'till now is to make sure */
- /* that it is ok to send the SPIN_UP cmd below. */
- if (!(cd->flags & SCDSPINNING)) {
- XDEBUG(1, ("scd%d: spinning up drive ...\n", unit));
- outb(port+OREG_COMMAND, CMD_SPIN_UP);
- mbx->count = 300;
- timeout((timeout_func_t)scd_doread,
- (caddr_t)SCD_S_WAITSPIN,hz/100); /* XXX */
- return;
- }
-
- reg = port + OREG_WPARAMS;
- /* send the read command */
- disable_intr();
- outb(reg, sdata[0]);
- outb(reg, sdata[1]);
- outb(reg, sdata[2]);
- outb(reg, 0);
- outb(reg, 0);
- outb(reg, 1);
- outb(port+OREG_COMMAND, CMD_READ);
- enable_intr();
-
- mbx->count = RDELAY_WAITREAD;
- for (i = 0; i < 50; i++) {
- if (STATUS_BIT(port, SBIT_DATA_READY))
- goto got_data;
- DELAY(100);
- }
-
- timeout((timeout_func_t)scd_doread,
- (caddr_t)SCD_S_WAITREAD,hz/100); /* XXX */
- return;
-
- case SCD_S_WAITREAD:
- untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITREAD);
- if (mbx->count-- <= 0) {
- if (STATUS_BIT(port, SBIT_RESULT_READY))
- goto got_param;
- printf("scd%d: timeout while reading data\n",unit);
- goto readerr;
- }
- if (!STATUS_BIT(port, SBIT_DATA_READY)) {
- process_attention(unit);
- if (!(cd->flags & SCDVALID))
- goto changed;
- timeout((timeout_func_t)scd_doread,
- (caddr_t)SCD_S_WAITREAD,hz/100); /* XXX */
- return;
- }
- XDEBUG(2, ("scd%d: mbx->count (after RDY_BIT) = %d(%d)\n", unit, mbx->count, RDELAY_WAITREAD));
-
-got_data:
- /* data is ready */
- addr = bp->b_un.b_addr + mbx->skip;
- write_control(port, CBIT_DATA_READY_CLEAR);
- insb(port+IREG_DATA, addr, mbx->sz);
-
- mbx->count = 100;
- for (i = 0; i < 20; i++) {
- if (STATUS_BIT(port, SBIT_RESULT_READY))
- goto waitfor_param;
- DELAY(100);
- }
- goto waitfor_param;
-
- case SCD_S_WAITPARAM:
- untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITPARAM);
- if (mbx->count-- <= 0) {
- printf("scd%d: timeout waiting for params\n",unit);
- goto readerr;
- }
-
-waitfor_param:
- if (!STATUS_BIT(port, SBIT_RESULT_READY)) {
- timeout((timeout_func_t)scd_doread,
- (caddr_t)SCD_S_WAITPARAM,hz/100); /* XXX */
- return;
- }
-#if SCD_DEBUG
- if (mbx->count < 100 && scd_debuglevel > 0)
- printf("scd%d: mbx->count (paramwait) = %d(%d)\n", unit, mbx->count, 100);
-#endif
-
-got_param:
- write_control(port, CBIT_RESULT_READY_CLEAR);
- switch ((i = inb(port+IREG_RESULT)) & 0xf0) {
- case 0x50:
- switch (i) {
- case ERR_FATAL_READ_ERROR1:
- case ERR_FATAL_READ_ERROR2:
- printf("scd%d: unrecoverable read error 0x%x\n", unit, i);
- goto harderr;
- }
- break;
- case 0x20:
- i = inb(port+IREG_RESULT);
- switch (i) {
- case ERR_NOT_SPINNING:
- XDEBUG(1, ("scd%d: read error: drive not spinning\n", unit));
- if (mbx->retry-- > 0) {
- state = SCD_S_BEGIN1;
- cd->flags &= ~SCDSPINNING;
- goto loop;
- }
- goto harderr;
- default:
- print_error(unit, i);
- goto readerr;
- }
- case 0x00:
- i = inb(port+IREG_RESULT);
- break;
- }
-
- if (--mbx->nblk > 0) {
- mbx->skip += mbx->sz;
- goto nextblock;
- }
-
- /* return buffer */
- bp->b_resid = 0;
- biodone(bp);
-
- cd->flags &= ~SCDMBXBSY;
- scd_start(mbx->unit);
- return;
- }
-
-readerr:
- if (mbx->retry-- > 0) {
- printf("scd%d: retrying ...\n",unit);
- state = SCD_S_BEGIN1;
- goto loop;
- }
-harderr:
- /* invalidate the buffer */
- bp->b_error = EIO;
- bp->b_flags |= B_ERROR;
- bp->b_resid = bp->b_bcount;
- biodone(bp);
-
- cd->flags &= ~SCDMBXBSY;
- scd_start(mbx->unit);
- return;
-
-changed:
- printf("scd%d: media changed\n", unit);
- goto harderr;
-}
-
-static int
-bcd2bin(bcd_t b)
-{
- return (b >> 4) * 10 + (b & 15);
-}
-
-static bcd_t
-bin2bcd(int b)
-{
- return ((b / 10) << 4) | (b % 10);
-}
-
-static void
-hsg2msf(int hsg, bcd_t *msf)
-{
- hsg += 150;
- M_msf(msf) = bin2bcd(hsg / 4500);
- hsg %= 4500;
- S_msf(msf) = bin2bcd(hsg / 75);
- F_msf(msf) = bin2bcd(hsg % 75);
-}
-
-static int
-msf2hsg(bcd_t *msf)
-{
- return (bcd2bin(M_msf(msf)) * 60 +
- bcd2bin(S_msf(msf))) * 75 +
- bcd2bin(F_msf(msf)) - 150;
-}
-
-static void
-process_attention(unsigned unit)
-{
- unsigned port = scd_data[unit].iobase;
- unsigned char code;
- int count = 0;
- int i;
-
- while (IS_ATTENTION(port) && count++ < 30) {
- write_control(port, CBIT_ATTENTION_CLEAR);
- code = inb(port+IREG_RESULT);
-
-#if SCD_DEBUG
- if (scd_debuglevel > 0) {
- if (count == 1)
- printf("scd%d: DEBUG: ATTENTIONS = 0x%x", unit, code);
- else
- printf(",0x%x", code);
- }
-#endif
-
- switch (code) {
- case ATTEN_SPIN_DOWN:
- scd_data[unit].flags &= ~SCDSPINNING;
- break;
-
- case ATTEN_SPIN_UP_DONE:
- scd_data[unit].flags |= SCDSPINNING;
- break;
-
- case ATTEN_AUDIO_DONE:
- scd_data[unit].audio_status = CD_AS_PLAY_COMPLETED;
- break;
-
- case ATTEN_DRIVE_LOADED:
- scd_data[unit].flags &= ~(SCDTOC|SCDSPINNING|SCDVALID);
- scd_data[unit].audio_status = CD_AS_AUDIO_INVALID;
- break;
-
- case ATTEN_EJECT_PUSHED:
- scd_data[unit].flags &= ~SCDVALID;
- break;
- }
- DELAY(100);
- }
-#if SCD_DEBUG
- if (scd_debuglevel > 0 && count > 0)
- printf("\n");
-#endif
-}
-
-/* Returns 0 OR sony error code */
-static int
-spin_up(unsigned unit)
-{
- unsigned char res_reg[12];
- unsigned int res_size;
- int rc;
- int loop_count = 0;
-
-again:
- rc = send_cmd(unit, CMD_SPIN_UP, NULL, 0, res_reg, &res_size);
- if (rc != 0) {
- XDEBUG(2, ("scd%d: CMD_SPIN_UP error 0x%x\n", unit, rc));
- return rc;
- }
-
- if (!(scd_data[unit].flags & SCDTOC)) {
- rc = send_cmd(unit, CMD_READ_TOC, 0);
- if (rc == ERR_NOT_SPINNING) {
- if (loop_count++ < 3)
- goto again;
- return rc;
- }
- if (rc != 0)
- return rc;
- }
-
- scd_data[unit].flags |= SCDSPINNING;
-
- return 0;
-}
-
-static struct sony_tracklist *
-get_tl(struct sony_toc *toc, int size)
-{
- struct sony_tracklist *tl = &toc->tracks[0];
-
- if (tl->track != 0xb0)
- return tl;
- (char *)tl += 9;
- if (tl->track != 0xb1)
- return tl;
- (char *)tl += 9;
- if (tl->track != 0xb2)
- return tl;
- (char *)tl += 9;
- if (tl->track != 0xb3)
- return tl;
- (char *)tl += 9;
- if (tl->track != 0xb4)
- return tl;
- (char *)tl += 9;
- if (tl->track != 0xc0)
- return tl;
- (char *)tl += 9;
- return tl;
-}
-
-static int
-read_toc(dev_t dev)
-{
- unsigned unit;
- struct scd_data *cd;
- unsigned part = 0; /* For now ... */
- struct sony_toc toc;
- struct sony_tracklist *tl;
- int rc, i, j;
- u_long first, last;
-
- unit = scd_unit(dev);
- cd = scd_data + unit;
-
- rc = send_cmd(unit, CMD_GET_TOC, 1, part+1);
- if (rc < 0)
- return rc;
- if (rc > sizeof(toc)) {
- printf("scd%d: program error: toc too large (%d)\n", unit, rc);
- return EIO;
- }
- if (get_result(unit, rc, (u_char *)&toc) != 0)
- return EIO;
-
- XDEBUG(1, ("scd%d: toc read. len = %d, sizeof(toc) = %d\n", unit, rc, sizeof(toc)));
-
- tl = get_tl(&toc, rc);
- first = msf2hsg(tl->start_msf);
- last = msf2hsg(toc.lead_out_start_msf);
- cd->blksize = SCDBLKSIZE;
- cd->disksize = last*cd->blksize/DEV_BSIZE;
-
- XDEBUG(1, ("scd%d: firstsector = %d, lastsector = %d", unit,
- first, last));
-
- cd->first_track = bcd2bin(toc.first_track);
- cd->last_track = bcd2bin(toc.last_track);
- if (cd->last_track > (MAX_TRACKS-2))
- cd->last_track = MAX_TRACKS-2;
- for (j = 0, i = cd->first_track; i <= cd->last_track; i++, j++) {
- cd->toc[i].adr = tl[j].adr;
- cd->toc[i].ctl = tl[j].ctl; /* for xcdplayer */
- bcopy(tl[j].start_msf, cd->toc[i].start_msf, 3);
-#ifdef SCD_DEBUG
- if (scd_debuglevel > 0) {
- if ((j % 3) == 0)
- printf("\nscd%d: tracks ", unit);
- printf("[%03d: %2d %2d %2d] ", i,
- bcd2bin(cd->toc[i].start_msf[0]),
- bcd2bin(cd->toc[i].start_msf[1]),
- bcd2bin(cd->toc[i].start_msf[2]));
- }
-#endif
- }
- bcopy(toc.lead_out_start_msf, cd->toc[cd->last_track+1].start_msf, 3);
-#ifdef SCD_DEBUG
- if (scd_debuglevel > 0) {
- i = cd->last_track+1;
- printf("[END: %2d %2d %2d]\n",
- bcd2bin(cd->toc[i].start_msf[0]),
- bcd2bin(cd->toc[i].start_msf[1]),
- bcd2bin(cd->toc[i].start_msf[2]));
- }
-#endif
-
- bzero(&cd->dlabel,sizeof(struct disklabel));
- /* filled with spaces first */
- strncpy(cd->dlabel.d_typename," ",
- sizeof(cd->dlabel.d_typename));
- strncpy(cd->dlabel.d_typename, cd->name,
- min(strlen(cd->name), sizeof(cd->dlabel.d_typename) - 1));
- strncpy(cd->dlabel.d_packname,"unknown ",
- sizeof(cd->dlabel.d_packname));
- cd->dlabel.d_secsize = cd->blksize;
- cd->dlabel.d_nsectors = 100;
- cd->dlabel.d_ntracks = 1;
- cd->dlabel.d_ncylinders = (cd->disksize/100)+1;
- cd->dlabel.d_secpercyl = 100;
- cd->dlabel.d_secperunit = cd->disksize;
- cd->dlabel.d_rpm = 300;
- cd->dlabel.d_interleave = 1;
- cd->dlabel.d_flags = D_REMOVABLE;
- cd->dlabel.d_npartitions= 1;
- cd->dlabel.d_partitions[0].p_offset = 0;
- cd->dlabel.d_partitions[0].p_size = cd->disksize;
- cd->dlabel.d_partitions[0].p_fstype = 9;
- cd->dlabel.d_magic = DISKMAGIC;
- cd->dlabel.d_magic2 = DISKMAGIC;
- cd->dlabel.d_checksum = dkcksum(&cd->dlabel);
-
- cd->flags |= SCDTOC;
-
- return 0;
-}
-
-static inline void
-write_control(unsigned port, unsigned data)
-{
- outb(port + OREG_CONTROL, data);
-}
-
-static void
-init_drive(unsigned unit)
-{
- int rc;
-
- rc = send_cmd(unit, CMD_SET_DRIVE_PARAM, 2,
- 0x05, 0x03 | ((scd_data[unit].double_speed) ? 0x04: 0));
- if (rc != 0)
- printf("scd%d: Unable to set parameters. Errcode = 0x%x\n", unit, rc);
-}
-
-/* Returns 0 or errno */
-static int
-get_result(u_int unit, int result_len, u_char *result)
-{
- unsigned int port = scd_data[unit].iobase;
- unsigned int res_reg = port + IREG_RESULT;
- unsigned char c;
- int loop_index = 2; /* send_cmd() reads two bytes ... */
-
- XDEBUG(1, ("scd%d: DEBUG: get_result: bytes=%d\n", unit, result_len));
-
- while (result_len-- > 0) {
- if (loop_index++ >= 10) {
- loop_index = 1;
- if (waitfor_status_bits(unit, SBIT_RESULT_READY, 0))
- return EIO;
- write_control(port, CBIT_RESULT_READY_CLEAR);
- }
- if (result)
- *result++ = inb(res_reg);
- else
- (void)inb(res_reg);
- }
- return 0;
-}
-
-/* Returns -0x100 for timeout, -(drive error code) OR number of result bytes */
-static int
-send_cmd(u_int unit, u_char cmd, u_int nargs, ...)
-{
- va_list ap;
- u_int port = scd_data[unit].iobase;
- u_int reg;
- u_char c;
- int rc;
- int i;
-
- if (waitfor_status_bits(unit, 0, SBIT_BUSY)) {
- printf("scd%d: drive busy\n", unit);
- return -0x100;
- }
-
- XDEBUG(1,("scd%d: DEBUG: send_cmd: cmd=0x%x nargs=%d", unit, cmd, nargs));
-
- write_control(port, CBIT_RESULT_READY_CLEAR);
- write_control(port, CBIT_RPARAM_CLEAR);
-
- for (i = 0; i < 100; i++)
- if (FSTATUS_BIT(port, FBIT_WPARAM_READY))
- break;
- if (!FSTATUS_BIT(port, FBIT_WPARAM_READY)) {
- XDEBUG(1, ("\nscd%d: wparam timeout\n", unit));
- return -EIO;
- }
-
- va_start(ap, nargs);
- reg = port + OREG_WPARAMS;
- for (i = 0; i < nargs; i++) {
- c = (u_char)va_arg(ap, int);
- outb(reg, c);
- XDEBUG(1, (",{0x%x}", c));
- }
- va_end(ap);
- XDEBUG(1, ("\n"));
-
- outb(port+OREG_COMMAND, cmd);
-
- if (rc = waitfor_status_bits(unit, SBIT_RESULT_READY, SBIT_BUSY))
- return -0x100;
-
- reg = port + IREG_RESULT;
- write_control(port, CBIT_RESULT_READY_CLEAR);
- switch ((rc = inb(reg)) & 0xf0) {
- case 0x20:
- rc = inb(reg);
- /* FALL TROUGH */
- case 0x50:
- XDEBUG(1, ("scd%d: DEBUG: send_cmd: drive_error=0x%x\n", unit, rc));
- return -rc;
- case 0x00:
- default:
- rc = inb(reg);
- XDEBUG(1, ("scd%d: DEBUG: send_cmd: result_len=%d\n", unit, rc));
- return rc;
- }
-}
-
-static void
-print_error(int unit, int errcode)
-{
- switch (errcode) {
- case -ERR_CD_NOT_LOADED:
- printf("scd%d: door is open\n", unit);
- break;
- case -ERR_NO_CD_INSIDE:
- printf("scd%d: no cd inside\n", unit);
- break;
- default:
- if (errcode == -0x100 || errcode > 0)
- printf("scd%d: device timeout\n", unit);
- else
- printf("scd%d: unexpected error 0x%x\n", unit, -errcode);
- break;
- }
-}
-
-/* Returns 0 or errno value */
-static int
-waitfor_status_bits(int unit, int bits_set, int bits_clear)
-{
- u_int port = scd_data[unit].iobase;
- u_int flags = scd_data[unit].flags;
- u_int reg = port + IREG_STATUS;
- u_int max_loop;
- u_char c = 0;
-
- if (flags & SCDPROBING) {
- max_loop = 0;
- while (max_loop++ < 1000) {
- c = inb(reg);
- if (c == 0xff)
- return EIO;
- if (c & SBIT_ATTENTION) {
- process_attention(unit);
- continue;
- }
- if ((c & bits_set) == bits_set &&
- (c & bits_clear) == 0)
- {
- break;
- }
- DELAY(10000);
- }
- } else {
- max_loop = 100;
- while (max_loop-- > 0) {
- c = inb(reg);
- if (c & SBIT_ATTENTION) {
- process_attention(unit);
- continue;
- }
- if ((c & bits_set) == bits_set &&
- (c & bits_clear) == 0)
- {
- break;
- }
- tsleep(waitfor_status_bits, PZERO - 1, "waitfor", hz/10);
- }
- }
- if ((c & bits_set) == bits_set &&
- (c & bits_clear) == 0)
- {
- return 0;
- }
-#ifdef SCD_DEBUG
- if (scd_debuglevel > 0)
- printf("scd%d: DEBUG: waitfor: TIMEOUT (0x%x,(0x%x,0x%x))\n", unit, c, bits_set, bits_clear);
- else
-#endif
- printf("scd%d: timeout.\n", unit);
- return EIO;
-}
-
-/* these two routines for xcdplayer - "borrowed" from mcd.c */
-static int
-scd_toc_header (int unit, struct ioc_toc_header* th)
-{
- struct scd_data *cd = scd_data + unit;
- int rc;
-
- if (!(cd->flags & SCDTOC) && (rc = read_toc(unit)) != 0) {
- print_error(unit, rc);
- return EIO;
- }
-
- th->starting_track = cd->first_track;
- th->ending_track = cd->last_track;
- th->len = 0; /* not used */
-
- return 0;
-}
-
-static int
-scd_toc_entrys (int unit, struct ioc_read_toc_entry *te)
-{
- struct scd_data *cd = scd_data + unit;
- struct cd_toc_entry toc_entry;
- int rc, i, len = te->data_len;
-
- if (!(cd->flags & SCDTOC) && (rc = read_toc(unit)) != 0) {
- print_error(unit, rc);
- return EIO;
- }
-
- /* find the toc to copy*/
- i = te->starting_track;
- if (i == SCD_LASTPLUS1)
- i = cd->last_track + 1;
-
- /* verify starting track */
- if (i < cd->first_track || i > cd->last_track+1)
- return EINVAL;
-
- /* valid length ? */
- if (len < sizeof(struct cd_toc_entry)
- || (len % sizeof(struct cd_toc_entry)) != 0)
- return EINVAL;
-
- /* copy the toc data */
- toc_entry.control = cd->toc[i].ctl;
- toc_entry.addr_type = te->address_format;
- toc_entry.track = i;
- if (te->address_format == CD_MSF_FORMAT) {
- toc_entry.addr.msf.unused = 0;
- toc_entry.addr.msf.minute = bcd2bin(cd->toc[i].start_msf[0]);
- toc_entry.addr.msf.second = bcd2bin(cd->toc[i].start_msf[1]);
- toc_entry.addr.msf.frame = bcd2bin(cd->toc[i].start_msf[2]);
- }
-
- /* copy the data back */
- if (copyout(&toc_entry, te->data, sizeof(struct cd_toc_entry)) != 0)
- return EFAULT;
-
- return 0;
-}
-
-
-#endif /* NSCD > 0 */
diff --git a/sys/gnu/i386/scdreg.h b/sys/gnu/i386/scdreg.h
deleted file mode 100644
index 93ace5c..0000000
--- a/sys/gnu/i386/scdreg.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*-
- * Copyright (c) 1995 Mikael Hybsch
- *
- * The Linux driver cdu31a has been used as a reference when writing this
- * code, therefore bringing it under the GNU Public License. The following
- * conditions of redistribution therefore apply:
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id: scdreg.h,v 1.2 1995/01/29 22:51:41 jkh Exp $
- *
- */
-
-#ifndef SCD_H
-#define SCD_H
-
-#ifdef __GNUC__
-#if __GNUC__ >= 2
-#pragma pack(1)
-#endif
-#endif
-
-typedef unsigned char bcd_t;
-#define M_msf(msf) msf[0]
-#define S_msf(msf) msf[1]
-#define F_msf(msf) msf[2]
-
-#define IS_ATTENTION(port) ((inb(port+IREG_STATUS) & SBIT_ATTENTION) != 0)
-#define IS_BUSY(port) ((inb(port+IREG_STATUS) & SBIT_BUSY) != 0)
-#define IS_DATA_RDY(port) ((inb(port+IREG_STATUS) & SBIT_DATA_READY) != 0)
-#define STATUS_BIT(port, bit) ((inb(port+IREG_STATUS) & (bit)) != 0)
-#define FSTATUS_BIT(port, bit) ((inb(port+IREG_FSTATUS) & (bit)) != 0)
-
-#define OREG_COMMAND 0
-#define OREG_WPARAMS 1
-#define OREG_CONTROL 3
-#define CBIT_ATTENTION_CLEAR 0x01
-#define CBIT_RESULT_READY_CLEAR 0x02
-#define CBIT_DATA_READY_CLEAR 0x04
-#define CBIT_RPARAM_CLEAR 0x40
-#define CBIT_RESET_DRIVE 0x80
-
-#define IREG_STATUS 0
-#define SBIT_ATTENTION 0x01
-#define SBIT_RESULT_READY 0x02
-#define SBIT_DATA_READY 0x04
-#define SBIT_BUSY 0x80
-
-#define IREG_RESULT 1
-#define IREG_DATA 2
-#define IREG_FSTATUS 3
-#define FBIT_WPARAM_READY 0x01
-
-#define CMD_GET_DRIVE_CONFIG 0x00
-#define CMD_SET_DRIVE_PARAM 0x10
-#define CMD_GET_SUBCHANNEL_DATA 0x21
-#define CMD_GET_TOC 0x24
-#define CMD_READ_TOC 0x30
-#define CMD_READ 0x34
-#define CMD_PLAY_AUDIO 0x40
-#define CMD_STOP_AUDIO 0x41
-#define CMD_EJECT 0x50
-#define CMD_SPIN_UP 0x51
-#define CMD_SPIN_DOWN 0x52
-
-#define ERR_CD_NOT_LOADED 0x20
-#define ERR_NO_CD_INSIDE 0x21
-#define ERR_NOT_SPINNING 0x22
-#define ERR_FATAL_READ_ERROR1 0x53
-#define ERR_FATAL_READ_ERROR2 0x57
-
-#define ATTEN_DRIVE_LOADED 0x80
-#define ATTEN_EJECT_PUSHED 0x81
-#define ATTEN_AUDIO_DONE 0x90
-#define ATTEN_SPIN_UP_DONE 0x24
-#define ATTEN_SPIN_DOWN 0x27
-#define ATTEN_EJECT_DONE 0x28
-
-
-struct sony_drive_configuration {
- char vendor[8];
- char product[16];
- char revision[8];
- u_short config;
-};
-
-/* Almost same as cd_sub_channel_position_data */
-struct sony_subchannel_position_data {
- u_char control:4;
- u_char addr_type:4;
- u_char track_number;
- u_char index_number;
- u_char rel_msf[3];
- u_char dummy;
- u_char abs_msf[3];
-};
-
-struct sony_tracklist {
- u_char adr :4; /* xcdplayer needs these two values */
- u_char ctl :4;
- u_char track;
- u_char start_msf[3];
-};
-
-#define MAX_TRACKS 100
-
-struct sony_toc {
- u_char session_number;
-
- u_char :8;
- u_char :8;
- u_char first_track;
- u_char :8;
- u_char :8;
-
- u_char :8;
- u_char :8;
- u_char last_track;
- u_char :8;
- u_char :8;
-
- u_char :8;
- u_char :8;
- u_char lead_out_start_msf[3];
-
- struct sony_tracklist tracks[MAX_TRACKS];
-
- /* The rest is just to take space in case all data is returned */
-
- u_char dummy[6*9];
-};
-
-#endif /* SCD_H */
diff --git a/sys/gnu/misc/aha274x.seq b/sys/gnu/misc/aha274x.seq
deleted file mode 100644
index 9b83b84..0000000
--- a/sys/gnu/misc/aha274x.seq
+++ /dev/null
@@ -1,1064 +0,0 @@
-# @(#)aic7xxx.seq 1.30 94/11/09 jda
-#
-# Adaptec 274x device driver for Linux.
-# Copyright (c) 1994 The University of Calgary Department of Computer Science.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-VERSION AIC7XXX_SEQ_VERSION 1.30
-
-MAXSCB-1 = 0xf
-
-SCSISEQ = 0x00
-SXFRCTL0 = 0x01
-SXFRCTL1 = 0x02
-SCSISIGI = 0x03
-SCSISIGO = 0x03
-SCSIRATE = 0x04
-SCSIID = 0x05
-SCSIDATL = 0x06
-STCNT = 0x08
-STCNT+0 = 0x08
-STCNT+1 = 0x09
-STCNT+2 = 0x0a
-SSTAT0 = 0x0b
-CLRSINT1 = 0x0c
-SSTAT1 = 0x0c
-SIMODE1 = 0x11
-SCSIBUSL = 0x12
-SHADDR = 0x14
-SELID = 0x19
-SBLKCTL = 0x1f
-SEQCTL = 0x60
-A = 0x64 # == ACCUM
-SINDEX = 0x65
-DINDEX = 0x66
-ALLZEROS = 0x6a
-NONE = 0x6a
-SINDIR = 0x6c
-DINDIR = 0x6d
-FUNCTION1 = 0x6e
-HADDR = 0x88
-HCNT = 0x8c
-HCNT+0 = 0x8c
-HCNT+1 = 0x8d
-HCNT+2 = 0x8e
-SCBPTR = 0x90
-INTSTAT = 0x91
-DFCNTRL = 0x93
-DFSTATUS = 0x94
-DFDAT = 0x99
-QINFIFO = 0x9b
-QINCNT = 0x9c
-QOUTFIFO = 0x9d
-
-SCSICONF = 0x5a
-
-# The two reserved bytes at SCBARRAY+1[23] are expected to be set to
-# zero, and the reserved bit in SCBARRAY+0 is used as an internal flag
-# to indicate whether or not to reload scatter-gather parameters after
-# a disconnect.
-#
-SCBARRAY+0 = 0xa0
-SCBARRAY+1 = 0xa1
-SCBARRAY+2 = 0xa2
-SCBARRAY+3 = 0xa3
-SCBARRAY+7 = 0xa7
-SCBARRAY+11 = 0xab
-SCBARRAY+14 = 0xae
-SCBARRAY+15 = 0xaf
-SCBARRAY+16 = 0xb0
-SCBARRAY+17 = 0xb1
-SCBARRAY+18 = 0xb2
-SCBARRAY+19 = 0xb3
-SCBARRAY+20 = 0xb4
-SCBARRAY+21 = 0xb5
-SCBARRAY+22 = 0xb6
-SCBARRAY+23 = 0xb7
-SCBARRAY+24 = 0xb8
-SCBARRAY+25 = 0xb9
-
-SIGNAL_0 = 0x01 # unknown scsi bus phase
-SIGNAL_1 = 0x11 # message reject
-SIGNAL_2 = 0x21 # no IDENTIFY after reconnect
-SIGNAL_3 = 0x31 # no cmd match for reconnect
-SIGNAL_4 = 0x41 # SDTR -> SCSIRATE conversion
-STATUS_ERROR = 0x51
-
-# The host adapter card (at least the BIOS) uses 20-2f for SCSI
-# device information, 32-33 and 5a-5f as well. Since we don't support
-# wide or twin-bus SCSI, 28-2f can be reclaimed. As it turns out, the
-# BIOS trashes 20-27 anyway, writing the synchronous negotiation results
-# on top of the BIOS values, so we re-use those for our per-target
-# scratchspace (actually a value that can be copied directly into
-# SCSIRATE). This implies, since we can't get the BIOS config values,
-# that all targets will be negotiated with for synchronous transfer.
-# NEEDSDTR has one bit per target indicating if an SDTR message is
-# needed for that device - this will be set initially, as well as
-# after a bus reset condition.
-#
-# The high bit of DROPATN is set if ATN should be dropped before the ACK
-# when outb is called. REJBYTE contains the first byte of a MESSAGE IN
-# message, so the driver can report an intelligible error if a message is
-# rejected.
-#
-# RESELECT's high bit is true if we are currently handling a reselect;
-# its next-highest bit is true ONLY IF we've seen an IDENTIFY message
-# from the reselecting target. If we haven't had IDENTIFY, then we have
-# no idea what the lun is, and we can't select the right SCB register
-# bank, so force a kernel panic if the target attempts a data in/out or
-# command phase instead of corrupting something.
-#
-# Note that SG_NEXT occupies four bytes.
-#
-SYNCNEG = 0x20
-DISC_DSB_A = 0x32
-
-DROPATN = 0x30
-REJBYTE = 0x31
-RESELECT = 0x34
-
-MSG_FLAGS = 0x35
-MSG_LEN = 0x36
-MSG_START+0 = 0x37
-MSG_START+1 = 0x38
-MSG_START+2 = 0x39
-MSG_START+3 = 0x3a
-MSG_START+4 = 0x3b
-MSG_START+5 = 0x3c
--MSG_START+0 = 0xc9 # 2's complement of MSG_START+0
-
-ARG_1 = 0x4c # sdtr conversion args & return
-ARG_2 = 0x4d
-RETURN_1 = 0x4c
-
-SIGSTATE = 0x4e # value written to SCSISIGO
-NEEDSDTR = 0x4f # send SDTR message, 1 bit/trgt
-
-SG_SIZEOF = 0x8 # sizeof(struct scatterlist)
-SG_NOLOAD = 0x50 # load SG pointer/length?
-SG_COUNT = 0x51 # working value of SG count
-SG_NEXT = 0x52 # working value of SG pointer
-SG_NEXT+0 = 0x52
-SG_NEXT+1 = 0x53
-SG_NEXT+2 = 0x54
-SG_NEXT+3 = 0x55
-
-SCBCOUNT = 0x56 # the actual number of SCBs
-ACTIVE_A = 0x57
-
-# Poll QINCNT for work - the lower three bits contain
-# the number of entries in the Queue In FIFO.
-#
-start:
- test SCSISIGI,0x4 jnz reselect # BSYI
- test QINCNT,MAXSCB-1 jz start
-
-# We have at least one queued SCB now. Set the SCB pointer
-# from the FIFO so we see the right bank of SCB registers,
-# then set SCSI options and set the initiator and target
-# SCSI IDs.
-#
- mov SCBPTR,QINFIFO
-
-# See if there is not already an active SCB for this target. This code
-# will have to be modified when we add support for dual and wide busses.
-
- and FUNCTION1,0x70,SCBARRAY+1
- mov A,FUNCTION1
- test ACTIVE_A,A jz active
-# Place the currently active back on the queue for later processing
- mov QINFIFO, SCBPTR
- jmp start
-
-# Mark the current target as busy and get working on the SCB
-active:
- or ACTIVE_A,A
- mov SCBARRAY+1 call initialize
- clr SG_NOLOAD
- clr RESELECT
-
-# As soon as we get a successful selection, the target should go
-# into the message out phase since we have ATN asserted. Prepare
-# the message to send, locking out the device driver. If the device
-# driver hasn't beaten us with an ABORT or RESET message, then tack
-# on a SDTR negotation if required.
-#
-# Messages are stored in scratch RAM starting with a flag byte (high bit
-# set means active message), one length byte, and then the message itself.
-#
- mov SCBARRAY+1 call disconnect # disconnect ok?
-
- and SINDEX,0x7,SCBARRAY+1 # lun
- or SINDEX,A # return value from disconnect
- or SINDEX,0x80 call mk_mesg # IDENTIFY message
-
- mov A,SINDEX
- cmp MSG_START+0,A jne !message # did driver beat us?
- mvi MSG_START+1 call mk_sdtr # build SDTR message if needed
-
-!message:
-
-# Enable selection phase as an initiator, and do automatic ATN
-# after the selection.
-#
- mvi SCSISEQ,0x48 # ENSELO|ENAUTOATNO
-
-# Wait for successful arbitration. The AIC-7770 documentation says
-# that SELINGO indicates successful arbitration, and that it should
-# be used to look for SELDO. However, if the sequencer is paused at
-# just the right time - a parallel fsck(8) on two drives did it for
-# me - then SELINGO can flip back to false before we've seen it. This
-# makes the sequencer sit in the arbitration loop forever. This is
-# Not Good.
-#
-# Therefore, I've added a check in the arbitration loop for SELDO
-# too. This could arguably be made a critical section by disabling
-# pauses, but I don't want to make a potentially infinite loop a CS.
-# I suppose you could fold it into the select loop, too, but since
-# I've been hunting this bug for four days it's kinda like a trophy.
-#
-arbitrate:
- test SSTAT0,0x40 jnz *select # SELDO
- test SSTAT0,0x10 jz arbitrate # SELINGO
-
-# Wait for a successful selection. If the hardware selection
-# timer goes off, then the driver gets the interrupt, so we don't
-# need to worry about it.
-#
-select:
- test SSTAT0,0x40 jz select # SELDO
- jmp *select
-
-# Reselection is being initiated by a target - we've seen the BSY
-# line driven active, and we didn't do it! Enable the reselection
-# hardware, and wait for it to finish. Make a note that we've been
-# reselected, but haven't seen an IDENTIFY message from the target
-# yet.
-#
-reselect:
- mvi SCSISEQ,0x10 # ENRSELI
-
-reselect1:
- test SSTAT0,0x20 jz reselect1 # SELDI
- mov SELID call initialize
-
- mvi RESELECT,0x80 # reselected, no IDENTIFY
-
-# After the [re]selection, make sure that the [re]selection enable
-# bit is off. This chip is flaky enough without extra things
-# turned on. Also clear the BUSFREE bit in SSTAT1 since we'll be
-# using it shortly.
-#
-*select:
- clr SCSISEQ
- mvi CLRSINT1,0x8 # CLRBUSFREE
-
-# Main loop for information transfer phases. If BSY is false, then
-# we have a bus free condition, expected or not. Otherwise, wait
-# for the target to assert REQ before checking MSG, C/D and I/O
-# for the bus phase.
-#
-# We can't simply look at the values of SCSISIGI here (if we want
-# to do synchronous data transfer), because the target won't assert
-# REQ if it's already sent us some data that we haven't acknowledged
-# yet.
-#
-ITloop:
- test SSTAT1,0x8 jnz p_busfree # BUSFREE
- test SSTAT1,0x1 jz ITloop # REQINIT
-
- and A,0xe0,SCSISIGI # CDI|IOI|MSGI
-
- cmp ALLZEROS,A je p_dataout
- cmp A,0x40 je p_datain
- cmp A,0x80 je p_command
- cmp A,0xc0 je p_status
- cmp A,0xa0 je p_mesgout
- cmp A,0xe0 je p_mesgin
-
- mvi INTSTAT,SIGNAL_0 # unknown - signal driver
-
-p_dataout:
- mvi 0 call scsisig # !CDO|!IOO|!MSGO
- call assert
- call sg_load
-
- mvi A,3
- mvi DINDEX,HCNT
- mvi SCBARRAY+23 call bcopy
-
- mvi A,3
- mvi DINDEX,STCNT
- mvi SCBARRAY+23 call bcopy
-
- mvi A,4
- mvi DINDEX,HADDR
- mvi SCBARRAY+19 call bcopy
-
- mvi 0x3d call dma # SCSIEN|SDMAEN|HDMAEN|
- # DIRECTION|FIFORESET
-
-# After a DMA finishes, save the final transfer pointer and count
-# back into the SCB, in case a device disconnects in the middle of
-# a transfer. Use SHADDR and STCNT instead of HADDR and HCNT, since
-# it's a reflection of how many bytes were transferred on the SCSI
-# (as opposed to the host) bus.
-#
- mvi A,3
- mvi DINDEX,SCBARRAY+23
- mvi STCNT call bcopy
-
- mvi A,4
- mvi DINDEX,SCBARRAY+19
- mvi SHADDR call bcopy
-
- call sg_advance
- mov SCBARRAY+18,SG_COUNT # residual S/G count
-
- jmp ITloop
-
-p_datain:
- mvi 0x40 call scsisig # !CDO|IOO|!MSGO
- call assert
- call sg_load
-
- mvi A,3
- mvi DINDEX,HCNT
- mvi SCBARRAY+23 call bcopy
-
- mvi A,3
- mvi DINDEX,STCNT
- mvi SCBARRAY+23 call bcopy
-
- mvi A,4
- mvi DINDEX,HADDR
- mvi SCBARRAY+19 call bcopy
-
- mvi 0x39 call dma # SCSIEN|SDMAEN|HDMAEN|
- # !DIRECTION|FIFORESET
- mvi A,3
- mvi DINDEX,SCBARRAY+23
- mvi STCNT call bcopy
-
- mvi A,4
- mvi DINDEX,SCBARRAY+19
- mvi SHADDR call bcopy
-
- call sg_advance
- mov SCBARRAY+18,SG_COUNT # residual S/G count
-
- jmp ITloop
-
-# Command phase. Set up the DMA registers and let 'er rip - the
-# two bytes after the SCB SCSI_cmd_length are zeroed by the driver,
-# so we can copy those three bytes directly into HCNT.
-#
-p_command:
- mvi 0x80 call scsisig # CDO|!IOO|!MSGO
- call assert
-
- mvi A,3
- mvi DINDEX,HCNT
- mvi SCBARRAY+11 call bcopy
-
- mvi A,3
- mvi DINDEX,STCNT
- mvi SCBARRAY+11 call bcopy
-
- mvi A,4
- mvi DINDEX,HADDR
- mvi SCBARRAY+7 call bcopy
-
- mvi 0x3d call dma # SCSIEN|SDMAEN|HDMAEN|
- # DIRECTION|FIFORESET
- jmp ITloop
-
-# Status phase. Wait for the data byte to appear, then read it
-# and store it into the SCB.
-#
-p_status:
- mvi 0xc0 call scsisig # CDO|IOO|!MSGO
-
- mvi SCBARRAY+14 call inb
- jmp ITloop
-
-# Message out phase. If there is no active message, but the target
-# took us into this phase anyway, build a no-op message and send it.
-#
-p_mesgout:
- mvi 0xa0 call scsisig # CDO|!IOO|MSGO
- mvi 0x8 call mk_mesg # build NOP message
-
-# Set up automatic PIO transfer from MSG_START. Bit 3 in
-# SXFRCTL0 (SPIOEN) is already on.
-#
- mvi SINDEX,MSG_START+0
- mov DINDEX,MSG_LEN
- clr A
-
-# When target asks for a byte, drop ATN if it's the last one in
-# the message. Otherwise, keep going until the message is exhausted.
-# (We can't use outb for this since it wants the input in SINDEX.)
-#
-# Keep an eye out for a phase change, in case the target issues
-# a MESSAGE REJECT.
-#
-p_mesgout2:
- test SSTAT0,0x2 jz p_mesgout2 # SPIORDY
- test SSTAT1,0x10 jnz p_mesgout6 # PHASEMIS
-
- cmp DINDEX,1 jne p_mesgout3 # last byte?
- mvi CLRSINT1,0x40 # CLRATNO - drop ATN
-
-# Write a byte to the SCSI bus. The AIC-7770 refuses to automatically
-# send ACKs in automatic PIO or DMA mode unless you make sure that the
-# "expected" bus phase in SCSISIGO matches the actual bus phase. This
-# behaviour is completely undocumented and caused me several days of
-# grief.
-#
-# After plugging in different drives to test with and using a longer
-# SCSI cable, I found that I/O in Automatic PIO mode ceased to function,
-# especially when transferring >1 byte. It seems to be much more stable
-# if STCNT is set to one before the transfer, and SDONE (in SSTAT0) is
-# polled for transfer completion - for both output _and_ input. The
-# only theory I have is that SPIORDY doesn't drop right away when SCSIDATL
-# is accessed (like the documentation says it does), and that on a longer
-# cable run, the sequencer code was fast enough to loop back and see
-# an SPIORDY that hadn't dropped yet.
-#
-p_mesgout3:
- call one_stcnt
- mov SCSIDATL,SINDIR
-
-p_mesgout4:
- test SSTAT0,0x4 jz p_mesgout4 # SDONE
- dec DINDEX
- inc A
- cmp MSG_LEN,A jne p_mesgout2
-
-# If the next bus phase after ATN drops is a message out, it means
-# that the target is requesting that the last message(s) be resent.
-#
-p_mesgout5:
- test SSTAT1,0x8 jnz p_mesgout6 # BUSFREE
- test SSTAT1,0x1 jz p_mesgout5 # REQINIT
-
- and A,0xe0,SCSISIGI # CDI|IOI|MSGI
- cmp A,0xa0 jne p_mesgout6
- mvi 0x10 call scsisig # ATNO - re-assert ATN
-
- jmp ITloop
-
-p_mesgout6:
- mvi CLRSINT1,0x40 # CLRATNO - in case of PHASEMIS
- clr MSG_FLAGS # no active msg
- jmp ITloop
-
-# Message in phase. Bytes are read using Automatic PIO mode, but not
-# using inb. This alleviates a race condition, namely that if ATN had
-# to be asserted under Automatic PIO mode, it had to beat the SCSI
-# circuitry sending an ACK to the target. This showed up under heavy
-# loads and really confused things, since ABORT commands wouldn't be
-# seen by the drive after an IDENTIFY message in until it had changed
-# to a data I/O phase.
-#
-p_mesgin:
- mvi 0xe0 call scsisig # CDO|IOO|MSGO
- mvi A call inb_first # read the 1st message byte
- mvi REJBYTE,A # save it for the driver
-
- cmp ALLZEROS,A jne p_mesgin1
-
-# We got a "command complete" message, so put the SCB pointer
-# into the Queue Out, and trigger a completion interrupt.
-# Check status for non zero return and interrupt driver if needed
-# This allows the driver to do a sense command to find out the
-# source of error. We don't bother to post to the QOUTFIFO in
-# the error case since it would require extra work in the kernel
-# driver to ensure that the entry was removed before the command
-# complete code tried processing it.
-
-# First, mark this target as free.
- and FUNCTION1,0x70,SCBARRAY+1
- mov A,FUNCTION1
- xor ACTIVE_A,A
-
- test SCBARRAY+14,0xff jz status_ok # 0 Status?
- call inb_last # ack & turn auto PIO back on
- mvi INTSTAT,STATUS_ERROR # let driver know
- jmp ITloop
-status_ok:
- mov QOUTFIFO,SCBPTR
- mvi INTSTAT,0x2 # CMDCMPLT
- jmp p_mesgin_done
-
-# Is it an extended message? We only support the synchronous data
-# transfer request message, which will probably be in response to
-# an SDTR message out from us. If it's not an SDTR, reject it -
-# apparently this can be done after any message in byte, according
-# to the SCSI-2 spec.
-#
-# XXX - we should really reject this if we didn't initiate the SDTR
-# negotiation; this may cause problems with unusual devices.
-#
-p_mesgin1:
- cmp A,1 jne p_mesgin2 # extended message code?
-
- mvi A call inb_next
- cmp A,3 jne p_mesginN # extended mesg length = 3
- mvi A call inb_next
- cmp A,1 jne p_mesginN # SDTR code
-
- mvi ARG_1 call inb_next # xfer period
- mvi ARG_2 call inb_next # REQ/ACK offset
- mvi INTSTAT,SIGNAL_4 # call driver to convert
-
- call ndx_sdtr # index sync config for target
- mov DINDEX,SINDEX
- mov DINDIR,RETURN_1 # save returned value
-
- not A # turn off "need sdtr" flag
- and NEEDSDTR,A
-
-# Even though the SCSI-2 specification says that a device responding
-# to our SDTR message should honor our parameters for transmitting
-# to us, it doesn't seem to work too well in real life. In particular,
-# a lot of CD-ROM and tape units don't function: try using the SDTR
-# parameters the device sent us for both transmitting and receiving.
-#
- mov SCSIRATE,RETURN_1
- jmp p_mesgin_done
-
-# Is it a disconnect message? Set a flag in the SCB to remind us
-# and await the bus going free.
-#
-p_mesgin2:
- cmp A,4 jne p_mesgin3 # disconnect code?
-
- or SCBARRAY+0,0x4 # set "disconnected" bit
- jmp p_mesgin_done
-
-# Save data pointers message? Copy working values into the SCB,
-# usually in preparation for a disconnect.
-#
-p_mesgin3:
- cmp A,2 jne p_mesgin4 # save data pointers code?
-
- call sg_ram2scb
- jmp p_mesgin_done
-
-# Restore pointers message? Data pointers are recopied from the
-# SCB anyway at the start of any DMA operation, so the only thing
-# to copy is the scatter-gather values.
-#
-p_mesgin4:
- cmp A,3 jne p_mesgin5 # restore pointers code?
-
- call sg_scb2ram
- jmp p_mesgin_done
-
-# Identify message? For a reconnecting target, this tells us the lun
-# that the reconnection is for - find the correct SCB and switch to it,
-# clearing the "disconnected" bit so we don't "find" it by accident later.
-#
-p_mesgin5:
- test A,0x80 jz p_mesgin6 # identify message?
-
- test A,0x78 jnz p_mesginN # !DiscPriv|!LUNTAR|!Reserved
-
- mov A call findSCB # switch to correct SCB
-
-# If a active message is present after calling findSCB, then either it
-# or the driver is trying to abort the command. Either way, something
-# untoward has happened and we should just leave it alone.
-#
- test MSG_FLAGS,0x80 jnz p_mesgin_done
-
- xor SCBARRAY+0,0x4 # clear disconnect bit in SCB
- mvi RESELECT,0xc0 # make note of IDENTIFY
-
- call sg_scb2ram # implied restore pointers
- # required on reselect
- jmp p_mesgin_done
-
-# Message reject? If we have an outstanding SDTR negotiation, assume
-# that it's a response from the target selecting asynchronous transfer,
-# otherwise just ignore it since we have no clue what it pertains to.
-#
-# XXX - I don't have a device that responds this way. Does this code
-# actually work?
-#
-p_mesgin6:
- cmp A,7 jne p_mesgin7 # message reject code?
-
- and FUNCTION1,0x70,SCSIID # outstanding SDTR message?
- mov A,FUNCTION1
- test NEEDSDTR,A jz p_mesgin_done # no - ignore rejection
-
- call ndx_sdtr # note use of asynch xfer
- mov DINDEX,SINDEX
- clr DINDIR
-
- not A # turn off "active sdtr" flag
- and NEEDSDTR,A
-
- clr SCSIRATE # select asynch xfer
- jmp p_mesgin_done
-
-# [ ADD MORE MESSAGE HANDLING HERE ]
-#
-p_mesgin7:
-
-# We have no idea what this message in is, and there's no way
-# to pass it up to the kernel, so we issue a message reject and
-# hope for the best. Since we're now using manual PIO mode to
-# read in the message, there should no longer be a race condition
-# present when we assert ATN. In any case, rejection should be a
-# rare occurrence - signal the driver when it happens.
-#
-p_mesginN:
- or SINDEX,0x10,SIGSTATE # turn on ATNO
- call scsisig
- mvi INTSTAT,SIGNAL_1 # let driver know
-
- mvi 0x7 call mk_mesg # MESSAGE REJECT message
-
-p_mesgin_done:
- call inb_last # ack & turn auto PIO back on
- jmp ITloop
-
-# Bus free phase. It might be useful to interrupt the device
-# driver if we aren't expecting this. For now, make sure that
-# ATN isn't being asserted and look for a new command.
-#
-p_busfree:
- mvi CLRSINT1,0x40 # CLRATNO
- clr SIGSTATE
- jmp start
-
-# Bcopy: number of bytes to transfer should be in A, DINDEX should
-# contain the destination address, and SINDEX should contain the
-# source address. All input parameters are trashed on return.
-#
-bcopy:
- mov DINDIR,SINDIR
- dec A
- cmp ALLZEROS,A jne bcopy
- ret
-
-# Locking the driver out, build a one-byte message passed in SINDEX
-# if there is no active message already. SINDEX is returned intact.
-#
-mk_mesg:
- mvi SEQCTL,0x40 # PAUSEDIS
- test MSG_FLAGS,0x80 jnz mk_mesg1 # active message?
-
- mvi MSG_FLAGS,0x80 # if not, there is now
- mvi MSG_LEN,1 # length = 1
- mov MSG_START+0,SINDEX # 1-byte message
-
-mk_mesg1:
- clr SEQCTL # !PAUSEDIS
- ret
-
-# Input byte in Automatic PIO mode. The address to store the byte
-# in should be in SINDEX. DINDEX will be used by this routine.
-#
-inb:
- test SSTAT0,0x2 jz inb # SPIORDY
- mov DINDEX,SINDEX
- call one_stcnt # xfer one byte
- mov DINDIR,SCSIDATL
-inb1:
- test SSTAT0,0x4 jz inb1 # SDONE - wait to "finish"
- ret
-
-# Carefully read data in Automatic PIO mode. I first tried this using
-# Manual PIO mode, but it gave me continual underrun errors, probably
-# indicating that I did something wrong, but I feel more secure leaving
-# Automatic PIO on all the time.
-#
-# According to Adaptec's documentation, an ACK is not sent on input from
-# the target until SCSIDATL is read from. So we wait until SCSIDATL is
-# latched (the usual way), then read the data byte directly off the bus
-# using SCSIBUSL. When we have pulled the ATN line, or we just want to
-# acknowledge the byte, then we do a dummy read from SCISDATL. The SCSI
-# spec guarantees that the target will hold the data byte on the bus until
-# we send our ACK.
-#
-# The assumption here is that these are called in a particular sequence,
-# and that REQ is already set when inb_first is called. inb_{first,next}
-# use the same calling convention as inb.
-#
-inb_first:
- mov DINDEX,SINDEX
- mov DINDIR,SCSIBUSL ret # read byte directly from bus
-
-inb_next:
- mov DINDEX,SINDEX # save SINDEX
-
- call one_stcnt # xfer one byte
- mov NONE,SCSIDATL # dummy read from latch to ACK
-inb_next1:
- test SSTAT0,0x4 jz inb_next1 # SDONE
-inb_next2:
- test SSTAT0,0x2 jz inb_next2 # SPIORDY - wait for next byte
- mov DINDIR,SCSIBUSL ret # read byte directly from bus
-
-inb_last:
- call one_stcnt # ACK with dummy read
- mov NONE,SCSIDATL
-inb_last1:
- test SSTAT0,0x4 jz inb_last1 # wait for completion
- ret
-
-# Output byte in Automatic PIO mode. The byte to output should be
-# in SINDEX. If DROPATN's high bit is set, then ATN will be dropped
-# before the byte is output.
-#
-outb:
- test SSTAT0,0x2 jz outb # SPIORDY
- call one_stcnt # xfer one byte
-
- test DROPATN,0x80 jz outb1
- mvi CLRSINT1,0x40 # CLRATNO
- clr DROPATN
-outb1:
- mov SCSIDATL,SINDEX
-outb2:
- test SSTAT0,0x4 jz outb2 # SDONE
- ret
-
-# Write the value "1" into the STCNT registers, for Automatic PIO
-# transfers.
-#
-one_stcnt:
- clr STCNT+2
- clr STCNT+1
- mvi STCNT+0,1 ret
-
-# DMA data transfer. HADDR and HCNT must be loaded first, and
-# SINDEX should contain the value to load DFCNTRL with - 0x3d for
-# host->scsi, or 0x39 for scsi->host. The SCSI channel is cleared
-# during initialization.
-#
-dma:
- mov DFCNTRL,SINDEX
-dma1:
-dma2:
- test SSTAT0,0x1 jnz dma3 # DMADONE
- test SSTAT1,0x10 jz dma1 # PHASEMIS, ie. underrun
-
-# We will be "done" DMAing when the transfer count goes to zero, or
-# the target changes the phase (in light of this, it makes sense that
-# the DMA circuitry doesn't ACK when PHASEMIS is active). If we are
-# doing a SCSI->Host transfer, flush the data FIFO.
-#
-dma3:
- test SINDEX,0x4 jnz dma5 # DIRECTION
- and SINDEX,0xfe # mask out FIFORESET
- or DFCNTRL,0x2,SINDEX # FIFOFLUSH
-dma4:
- test DFCNTRL,0x2 jnz dma4 # FIFOFLUSHACK
-
-# Now shut the DMA enables off, and copy STCNT (ie. the underrun
-# amount, if any) to the SCB registers; SG_COUNT will get copied to
-# the SCB's residual S/G count field after sg_advance is called. Make
-# sure that the DMA enables are actually off first lest we get an ILLSADDR.
-#
-dma5:
- clr DFCNTRL # disable DMA
-dma6:
- test DFCNTRL,0x38 jnz dma6 # SCSIENACK|SDMAENACK|HDMAENACK
-
- mvi A,3
- mvi DINDEX,SCBARRAY+15
- mvi STCNT call bcopy
-
- ret
-
-# Common SCSI initialization for selection and reselection. Expects
-# the target SCSI ID to be in the upper four bits of SINDEX, and A's
-# contents are stomped on return.
-#
-initialize:
- clr SBLKCTL # channel A, !wide
- and SCSIID,0xf0,SINDEX # target ID
- and A,0x7,SCSICONF # SCSI_ID_A[210]
- or SCSIID,A
-
-# Esundry initialization.
-#
- clr DROPATN
- clr SIGSTATE
-
-# Turn on Automatic PIO mode now, before we expect to see an REQ
-# from the target. It shouldn't hurt anything to leave it on. Set
-# CLRCHN here before the target has entered a data transfer mode -
-# with synchronous SCSI, if you do it later, you blow away some
-# data in the SCSI FIFO that the target has already sent to you.
-#
- mvi SXFRCTL0,0xa # SPIOEN|CLRCHN
-
-# Set SCSI bus parity checking and the selection timeout value,
-# and enable the hardware selection timer. Set the SELTO interrupt
-# to signal the driver.
-#
- and A,0x38,SCSICONF # PARITY_ENB_A|SEL_TIM_A[10]
- or SXFRCTL1,0x4,A # ENSTIMER
- mvi SIMODE1,0x84 # ENSELTIMO|ENSCSIPERR
-
-# Initialize scatter-gather pointers by setting up the working copy
-# in scratch RAM.
-#
- call sg_scb2ram
-
-# Initialize SCSIRATE with the appropriate value for this target.
-#
- call ndx_sdtr
- mov SCSIRATE,SINDIR
- ret
-
-# Assert that if we've been reselected, then we've seen an IDENTIFY
-# message.
-#
-assert:
- test RESELECT,0x80 jz assert1 # reselected?
- test RESELECT,0x40 jnz assert1 # seen IDENTIFY?
-
- mvi INTSTAT,SIGNAL_2 # no - cause a kernel panic
-
-assert1:
- ret
-
-# Find out if disconnection is ok from the information the BIOS has left
-# us. The target ID should be in the upper four bits of SINDEX; A will
-# contain either 0x40 (disconnection ok) or 0x00 (diconnection not ok)
-# on exit.
-#
-# This is the only place the target ID is limited to three bits, so we
-# can use the FUNCTION1 register.
-#
-disconnect:
- and FUNCTION1,0x70,SINDEX # strip off extra just in case
- mov A,FUNCTION1
- test DISC_DSB_A,A jz disconnect1 # bit nonzero if DISabled
-
- clr A ret
-disconnect1:
- mvi A,0x40 ret
-
-# Locate the SCB matching the target ID in SELID and the lun in the lower
-# three bits of SINDEX, and switch the SCB to it. Have the kernel print
-# a warning message if it can't be found, and generate an ABORT message
-# to the target. We keep the value of the t/c/l that we are trying to
-# in DINDEX so it is not overwritten during our check to see if we are
-# at the last SCB.
-#
-findSCB:
- and A,0x7,SINDEX # lun in lower three bits
- or DINDEX,A,SELID # can I do this?
- and DINDEX,0xf7 # only channel A implemented
-
- clr SINDEX
-
-findSCB1:
- mov SCBPTR,SINDEX # switch to new SCB
- mov A,DINDEX
- cmp SCBARRAY+1,A jne findSCB2 # target ID/channel/lun match?
- test SCBARRAY+0,0x4 jz findSCB2 # should be disconnected
-
- ret
-
-findSCB2:
- inc SINDEX
- mov A,SCBCOUNT
- cmp SINDEX,A jne findSCB1
-
- mvi INTSTAT,SIGNAL_3 # not found - signal kernel
- mvi 0x6 call mk_mesg # ABORT message
-
- or SINDEX,0x10,SIGSTATE # assert ATNO
- call scsisig
- ret
-
-# Make a working copy of the scatter-gather parameters in the SCB.
-#
-sg_scb2ram:
- mov SG_COUNT,SCBARRAY+2
-
- mvi A,4
- mvi DINDEX,SG_NEXT
- mvi SCBARRAY+3 call bcopy
-
- mvi SG_NOLOAD,0x80
- test SCBARRAY+0,0x10 jnz sg_scb2ram1 # don't reload s/g?
- clr SG_NOLOAD
-
-sg_scb2ram1:
- ret
-
-# Copying RAM values back to SCB, for Save Data Pointers message.
-#
-sg_ram2scb:
- mov SCBARRAY+2,SG_COUNT
-
- mvi A,4
- mvi DINDEX,SCBARRAY+3
- mvi SG_NEXT call bcopy
-
- and SCBARRAY+0,0xef,SCBARRAY+0
- test SG_NOLOAD,0x80 jz sg_ram2scb1 # reload s/g?
- or SCBARRAY+0,0x10
-
-sg_ram2scb1:
- ret
-
-# Load a struct scatter if needed and set up the data address and
-# length. If the working value of the SG count is nonzero, then
-# we need to load a new set of values.
-#
-# This, like the above DMA, assumes a little-endian host data storage.
-#
-sg_load:
- test SG_COUNT,0xff jz sg_load3 # SG being used?
- test SG_NOLOAD,0x80 jnz sg_load3 # don't reload s/g?
-
- clr HCNT+2
- clr HCNT+1
- mvi HCNT+0,SG_SIZEOF
-
- mvi A,4
- mvi DINDEX,HADDR
- mvi SG_NEXT call bcopy
-
- mvi DFCNTRL,0xd # HDMAEN|DIRECTION|FIFORESET
-
-# Wait for DMA from host memory to data FIFO to complete, then disable
-# DMA and wait for it to acknowledge that it's off.
-#
-sg_load1:
- test DFSTATUS,0x8 jz sg_load1 # HDONE
-
- clr DFCNTRL # disable DMA
-sg_load2:
- test DFCNTRL,0x8 jnz sg_load2 # HDMAENACK
-
-# Copy data from FIFO into SCB data pointer and data count. This assumes
-# that the struct scatterlist has this structure (this and sizeof(struct
-# scatterlist) == 12 are asserted in aic7xxx.c):
-#
-# struct scatterlist {
-# char *address; /* four bytes, little-endian order */
-# ... /* four bytes, ignored */
-# unsigned short length; /* two bytes, little-endian order */
-# }
-#
-
-# Not in FreeBSD. the scatter list is only 8 bytes.
-#
-# struct ahc_dma_seg {
-# physaddr addr; /* four bytes, little-endian order */
-# long len; /* four bytes, little endian order */
-# };
-#
-
- mov SCBARRAY+19,DFDAT # new data address
- mov SCBARRAY+20,DFDAT
- mov SCBARRAY+21,DFDAT
- mov SCBARRAY+22,DFDAT
-
- mov SCBARRAY+23,DFDAT
- mov SCBARRAY+24,DFDAT
- mov SCBARRAY+25,DFDAT
- mov NONE,DFDAT #Only support 24 bit length.
-
-sg_load3:
- ret
-
-# Advance the scatter-gather pointers only IF NEEDED. If SG is enabled,
-# and the SCSI transfer count is zero (note that this should be called
-# right after a DMA finishes), then move the working copies of the SG
-# pointer/length along. If the SCSI transfer count is not zero, then
-# presumably the target is disconnecting - do not reload the SG values
-# next time.
-#
-sg_advance:
- test SG_COUNT,0xff jz sg_advance2 # s/g enabled?
-
- test STCNT+0,0xff jnz sg_advance1 # SCSI transfer count nonzero?
- test STCNT+1,0xff jnz sg_advance1
- test STCNT+2,0xff jnz sg_advance1
-
- clr SG_NOLOAD # reload s/g next time
- dec SG_COUNT # one less segment to go
-
- clr A # add sizeof(struct scatter)
- add SG_NEXT+0,SG_SIZEOF,SG_NEXT+0
- adc SG_NEXT+1,A,SG_NEXT+1
- adc SG_NEXT+2,A,SG_NEXT+2
- adc SG_NEXT+3,A,SG_NEXT+3
-
- ret
-
-sg_advance1:
- mvi SG_NOLOAD,0x80 # don't reload s/g next time
-sg_advance2:
- ret
-
-# Add the array base SYNCNEG to the target offset (the target address
-# is in SCSIID), and return the result in SINDEX. The accumulator
-# contains the 3->8 decoding of the target ID on return.
-#
-ndx_sdtr:
- shr A,SCSIID,4
- and A,0x7
- add SINDEX,SYNCNEG,A
-
- and FUNCTION1,0x70,SCSIID # 3-bit target address decode
- mov A,FUNCTION1 ret
-
-# If we need to negotiate transfer parameters, build the SDTR message
-# starting at the address passed in SINDEX. DINDEX is modified on return.
-#
-mk_sdtr:
- mov DINDEX,SINDEX # save SINDEX
-
- call ndx_sdtr
- test NEEDSDTR,A jnz mk_sdtr1 # do we need negotiation?
- ret
-
-mk_sdtr1:
- mvi DINDIR,1 # extended message
- mvi DINDIR,3 # extended message length = 3
- mvi DINDIR,1 # SDTR code
- mvi DINDIR,25 # REQ/ACK transfer period
- mvi DINDIR,15 # REQ/ACK offset
-
- add MSG_LEN,-MSG_START+0,DINDEX # update message length
- ret
-
-# Set SCSI bus control signal state. This also saves the last-written
-# value into a location where the higher-level driver can read it - if
-# it has to send an ABORT or RESET message, then it needs to know this
-# so it can assert ATN without upsetting SCSISIGO. The new value is
-# expected in SINDEX. Change the actual state last to avoid contention
-# from the driver.
-#
-scsisig:
- mov SIGSTATE,SINDEX
- mov SCSISIGO,SINDEX ret
-
diff --git a/sys/gnu/misc/aha274x_seq.c b/sys/gnu/misc/aha274x_seq.c
deleted file mode 100644
index 46bb647..0000000
--- a/sys/gnu/misc/aha274x_seq.c
+++ /dev/null
@@ -1,355 +0,0 @@
-#define AIC7XXX_SEQ_VERSION "1.30"
-unsigned char seqprog[] = {
- 0x04, 0x03, 0x18, 0x1a,
- 0x0f, 0x9c, 0x00, 0x1e,
- 0xff, 0x9b, 0x90, 0x02,
- 0x70, 0xa1, 0x6e, 0x02,
- 0xff, 0x6e, 0x64, 0x02,
- 0x00, 0x57, 0x08, 0x1e,
- 0xff, 0x90, 0x9b, 0x02,
- 0x00, 0x65, 0x00, 0x10,
- 0x00, 0x57, 0x57, 0x00,
- 0x00, 0xa1, 0xf3, 0x16,
- 0xff, 0x6a, 0x50, 0x02,
- 0xff, 0x6a, 0x34, 0x02,
- 0x00, 0xa1, 0x05, 0x17,
- 0x07, 0xa1, 0x65, 0x02,
- 0x00, 0x65, 0x65, 0x00,
- 0x80, 0x65, 0xc2, 0x16,
- 0xff, 0x65, 0x64, 0x02,
- 0x00, 0x37, 0x13, 0x18,
- 0x38, 0x6a, 0x53, 0x17,
- 0x48, 0x6a, 0x00, 0x00,
- 0x40, 0x0b, 0x1c, 0x1a,
- 0x10, 0x0b, 0x14, 0x1e,
- 0x40, 0x0b, 0x16, 0x1e,
- 0x00, 0x65, 0x1c, 0x10,
- 0x10, 0x6a, 0x00, 0x00,
- 0x20, 0x0b, 0x19, 0x1e,
- 0x00, 0x19, 0xf3, 0x16,
- 0x80, 0x6a, 0x34, 0x00,
- 0xff, 0x6a, 0x00, 0x02,
- 0x08, 0x6a, 0x0c, 0x00,
- 0x08, 0x0c, 0xbb, 0x1a,
- 0x01, 0x0c, 0x1e, 0x1e,
- 0xe0, 0x03, 0x64, 0x02,
- 0x00, 0x6a, 0x28, 0x1c,
- 0x40, 0x64, 0x3e, 0x1c,
- 0x80, 0x64, 0x54, 0x1c,
- 0xc0, 0x64, 0x61, 0x1c,
- 0xa0, 0x64, 0x64, 0x1c,
- 0xe0, 0x64, 0x7c, 0x1c,
- 0x01, 0x6a, 0x91, 0x00,
- 0x00, 0x6a, 0x5e, 0x17,
- 0x00, 0x65, 0x01, 0x17,
- 0x00, 0x65, 0x2b, 0x17,
- 0x03, 0x6a, 0x64, 0x00,
- 0x8c, 0x6a, 0x66, 0x00,
- 0xb7, 0x6a, 0xbe, 0x16,
- 0x03, 0x6a, 0x64, 0x00,
- 0x08, 0x6a, 0x66, 0x00,
- 0xb7, 0x6a, 0xbe, 0x16,
- 0x04, 0x6a, 0x64, 0x00,
- 0x88, 0x6a, 0x66, 0x00,
- 0xb3, 0x6a, 0xbe, 0x16,
- 0x3d, 0x6a, 0xe6, 0x16,
- 0x03, 0x6a, 0x64, 0x00,
- 0xb7, 0x6a, 0x66, 0x00,
- 0x08, 0x6a, 0xbe, 0x16,
- 0x04, 0x6a, 0x64, 0x00,
- 0xb3, 0x6a, 0x66, 0x00,
- 0x14, 0x6a, 0xbe, 0x16,
- 0x00, 0x65, 0x40, 0x17,
- 0xff, 0x51, 0xb2, 0x02,
- 0x00, 0x65, 0x1e, 0x10,
- 0x40, 0x6a, 0x5e, 0x17,
- 0x00, 0x65, 0x01, 0x17,
- 0x00, 0x65, 0x2b, 0x17,
- 0x03, 0x6a, 0x64, 0x00,
- 0x8c, 0x6a, 0x66, 0x00,
- 0xb7, 0x6a, 0xbe, 0x16,
- 0x03, 0x6a, 0x64, 0x00,
- 0x08, 0x6a, 0x66, 0x00,
- 0xb7, 0x6a, 0xbe, 0x16,
- 0x04, 0x6a, 0x64, 0x00,
- 0x88, 0x6a, 0x66, 0x00,
- 0xb3, 0x6a, 0xbe, 0x16,
- 0x39, 0x6a, 0xe6, 0x16,
- 0x03, 0x6a, 0x64, 0x00,
- 0xb7, 0x6a, 0x66, 0x00,
- 0x08, 0x6a, 0xbe, 0x16,
- 0x04, 0x6a, 0x64, 0x00,
- 0xb3, 0x6a, 0x66, 0x00,
- 0x14, 0x6a, 0xbe, 0x16,
- 0x00, 0x65, 0x40, 0x17,
- 0xff, 0x51, 0xb2, 0x02,
- 0x00, 0x65, 0x1e, 0x10,
- 0x80, 0x6a, 0x5e, 0x17,
- 0x00, 0x65, 0x01, 0x17,
- 0x03, 0x6a, 0x64, 0x00,
- 0x8c, 0x6a, 0x66, 0x00,
- 0xab, 0x6a, 0xbe, 0x16,
- 0x03, 0x6a, 0x64, 0x00,
- 0x08, 0x6a, 0x66, 0x00,
- 0xab, 0x6a, 0xbe, 0x16,
- 0x04, 0x6a, 0x64, 0x00,
- 0x88, 0x6a, 0x66, 0x00,
- 0xa7, 0x6a, 0xbe, 0x16,
- 0x3d, 0x6a, 0xe6, 0x16,
- 0x00, 0x65, 0x1e, 0x10,
- 0xc0, 0x6a, 0x5e, 0x17,
- 0xae, 0x6a, 0xc9, 0x16,
- 0x00, 0x65, 0x1e, 0x10,
- 0xa0, 0x6a, 0x5e, 0x17,
- 0x08, 0x6a, 0xc2, 0x16,
- 0x37, 0x6a, 0x65, 0x00,
- 0xff, 0x36, 0x66, 0x02,
- 0xff, 0x6a, 0x64, 0x02,
- 0x02, 0x0b, 0x69, 0x1e,
- 0x10, 0x0c, 0x79, 0x1a,
- 0x01, 0x66, 0x6d, 0x18,
- 0x40, 0x6a, 0x0c, 0x00,
- 0x00, 0x65, 0xe3, 0x16,
- 0xff, 0x6c, 0x06, 0x02,
- 0x04, 0x0b, 0x6f, 0x1e,
- 0xff, 0x66, 0x66, 0x06,
- 0x01, 0x64, 0x64, 0x06,
- 0x00, 0x36, 0x69, 0x18,
- 0x08, 0x0c, 0x79, 0x1a,
- 0x01, 0x0c, 0x73, 0x1e,
- 0xe0, 0x03, 0x64, 0x02,
- 0xa0, 0x64, 0x79, 0x18,
- 0x10, 0x6a, 0x5e, 0x17,
- 0x00, 0x65, 0x1e, 0x10,
- 0x40, 0x6a, 0x0c, 0x00,
- 0xff, 0x6a, 0x35, 0x02,
- 0x00, 0x65, 0x1e, 0x10,
- 0xe0, 0x6a, 0x5e, 0x17,
- 0x64, 0x6a, 0xcf, 0x16,
- 0x00, 0x6a, 0x31, 0x00,
- 0x00, 0x6a, 0x8a, 0x18,
- 0x70, 0xa1, 0x6e, 0x02,
- 0xff, 0x6e, 0x64, 0x02,
- 0x00, 0x57, 0x57, 0x04,
- 0xff, 0xae, 0x87, 0x1e,
- 0x00, 0x65, 0xd7, 0x16,
- 0x51, 0x6a, 0x91, 0x00,
- 0x00, 0x65, 0x1e, 0x10,
- 0xff, 0x90, 0x9d, 0x02,
- 0x02, 0x6a, 0x91, 0x00,
- 0x00, 0x65, 0xb9, 0x10,
- 0x01, 0x64, 0x99, 0x18,
- 0x64, 0x6a, 0xd1, 0x16,
- 0x03, 0x64, 0xb5, 0x18,
- 0x64, 0x6a, 0xd1, 0x16,
- 0x01, 0x64, 0xb5, 0x18,
- 0x4c, 0x6a, 0xd1, 0x16,
- 0x4d, 0x6a, 0xd1, 0x16,
- 0x41, 0x6a, 0x91, 0x00,
- 0x00, 0x65, 0x4e, 0x17,
- 0xff, 0x65, 0x66, 0x02,
- 0xff, 0x4c, 0x6d, 0x02,
- 0xff, 0x64, 0x64, 0x04,
- 0x00, 0x4f, 0x4f, 0x02,
- 0xff, 0x4c, 0x04, 0x02,
- 0x00, 0x65, 0xb9, 0x10,
- 0x04, 0x64, 0x9c, 0x18,
- 0x04, 0xa0, 0xa0, 0x00,
- 0x00, 0x65, 0xb9, 0x10,
- 0x02, 0x64, 0x9f, 0x18,
- 0x00, 0x65, 0x23, 0x17,
- 0x00, 0x65, 0xb9, 0x10,
- 0x03, 0x64, 0xa2, 0x18,
- 0x00, 0x65, 0x1b, 0x17,
- 0x00, 0x65, 0xb9, 0x10,
- 0x80, 0x64, 0xaa, 0x1e,
- 0x78, 0x64, 0xb5, 0x1a,
- 0x00, 0x64, 0x0a, 0x17,
- 0x80, 0x35, 0xb9, 0x1a,
- 0x04, 0xa0, 0xa0, 0x04,
- 0xc0, 0x6a, 0x34, 0x00,
- 0x00, 0x65, 0x1b, 0x17,
- 0x00, 0x65, 0xb9, 0x10,
- 0x07, 0x64, 0xb5, 0x18,
- 0x70, 0x05, 0x6e, 0x02,
- 0xff, 0x6e, 0x64, 0x02,
- 0x00, 0x4f, 0xb9, 0x1e,
- 0x00, 0x65, 0x4e, 0x17,
- 0xff, 0x65, 0x66, 0x02,
- 0xff, 0x6a, 0x6d, 0x02,
- 0xff, 0x64, 0x64, 0x04,
- 0x00, 0x4f, 0x4f, 0x02,
- 0xff, 0x6a, 0x04, 0x02,
- 0x00, 0x65, 0xb9, 0x10,
- 0x10, 0x4e, 0x65, 0x00,
- 0x00, 0x65, 0x5e, 0x17,
- 0x11, 0x6a, 0x91, 0x00,
- 0x07, 0x6a, 0xc2, 0x16,
- 0x00, 0x65, 0xd7, 0x16,
- 0x00, 0x65, 0x1e, 0x10,
- 0x40, 0x6a, 0x0c, 0x00,
- 0xff, 0x6a, 0x4e, 0x02,
- 0x00, 0x65, 0x00, 0x10,
- 0xff, 0x6c, 0x6d, 0x02,
- 0xff, 0x64, 0x64, 0x06,
- 0x00, 0x6a, 0xbe, 0x18,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x40, 0x6a, 0x60, 0x00,
- 0x80, 0x35, 0xc7, 0x1a,
- 0x80, 0x6a, 0x35, 0x00,
- 0x01, 0x6a, 0x36, 0x00,
- 0xff, 0x65, 0x37, 0x02,
- 0xff, 0x6a, 0x60, 0x02,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x02, 0x0b, 0xc9, 0x1e,
- 0xff, 0x65, 0x66, 0x02,
- 0x00, 0x65, 0xe3, 0x16,
- 0xff, 0x06, 0x6d, 0x02,
- 0x04, 0x0b, 0xcd, 0x1e,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x65, 0x66, 0x02,
- 0xff, 0x12, 0x6d, 0x03,
- 0xff, 0x65, 0x66, 0x02,
- 0x00, 0x65, 0xe3, 0x16,
- 0xff, 0x06, 0x6a, 0x02,
- 0x04, 0x0b, 0xd4, 0x1e,
- 0x02, 0x0b, 0xd5, 0x1e,
- 0xff, 0x12, 0x6d, 0x03,
- 0x00, 0x65, 0xe3, 0x16,
- 0xff, 0x06, 0x6a, 0x02,
- 0x04, 0x0b, 0xd9, 0x1e,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x02, 0x0b, 0xdb, 0x1e,
- 0x00, 0x65, 0xe3, 0x16,
- 0x80, 0x30, 0xe0, 0x1e,
- 0x40, 0x6a, 0x0c, 0x00,
- 0xff, 0x6a, 0x30, 0x02,
- 0xff, 0x65, 0x06, 0x02,
- 0x04, 0x0b, 0xe1, 0x1e,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x6a, 0x0a, 0x02,
- 0xff, 0x6a, 0x09, 0x02,
- 0x01, 0x6a, 0x08, 0x01,
- 0xff, 0x65, 0x93, 0x02,
- 0x01, 0x0b, 0xe9, 0x1a,
- 0x10, 0x0c, 0xe7, 0x1e,
- 0x04, 0x65, 0xed, 0x1a,
- 0xfe, 0x65, 0x65, 0x02,
- 0x02, 0x65, 0x93, 0x00,
- 0x02, 0x93, 0xec, 0x1a,
- 0xff, 0x6a, 0x93, 0x02,
- 0x38, 0x93, 0xee, 0x1a,
- 0x03, 0x6a, 0x64, 0x00,
- 0xaf, 0x6a, 0x66, 0x00,
- 0x08, 0x6a, 0xbe, 0x16,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x6a, 0x1f, 0x02,
- 0xf0, 0x65, 0x05, 0x02,
- 0x07, 0x5a, 0x64, 0x02,
- 0x00, 0x05, 0x05, 0x00,
- 0xff, 0x6a, 0x30, 0x02,
- 0xff, 0x6a, 0x4e, 0x02,
- 0x0a, 0x6a, 0x01, 0x00,
- 0x38, 0x5a, 0x64, 0x02,
- 0x04, 0x64, 0x02, 0x00,
- 0x84, 0x6a, 0x11, 0x00,
- 0x00, 0x65, 0x1b, 0x17,
- 0x00, 0x65, 0x4e, 0x17,
- 0xff, 0x6c, 0x04, 0x02,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x80, 0x34, 0x04, 0x1f,
- 0x40, 0x34, 0x04, 0x1b,
- 0x21, 0x6a, 0x91, 0x00,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x70, 0x65, 0x6e, 0x02,
- 0xff, 0x6e, 0x64, 0x02,
- 0x00, 0x32, 0x09, 0x1f,
- 0xff, 0x6a, 0x64, 0x03,
- 0x40, 0x6a, 0x64, 0x01,
- 0x07, 0x65, 0x64, 0x02,
- 0x00, 0x19, 0x66, 0x00,
- 0xf7, 0x66, 0x66, 0x02,
- 0xff, 0x6a, 0x65, 0x02,
- 0xff, 0x65, 0x90, 0x02,
- 0xff, 0x66, 0x64, 0x02,
- 0x00, 0xa1, 0x13, 0x19,
- 0x04, 0xa0, 0x13, 0x1f,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x01, 0x65, 0x65, 0x06,
- 0xff, 0x56, 0x64, 0x02,
- 0x00, 0x65, 0x0e, 0x19,
- 0x31, 0x6a, 0x91, 0x00,
- 0x06, 0x6a, 0xc2, 0x16,
- 0x10, 0x4e, 0x65, 0x00,
- 0x00, 0x65, 0x5e, 0x17,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0xa2, 0x51, 0x02,
- 0x04, 0x6a, 0x64, 0x00,
- 0x52, 0x6a, 0x66, 0x00,
- 0xa3, 0x6a, 0xbe, 0x16,
- 0x80, 0x6a, 0x50, 0x00,
- 0x10, 0xa0, 0x22, 0x1b,
- 0xff, 0x6a, 0x50, 0x02,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x51, 0xa2, 0x02,
- 0x04, 0x6a, 0x64, 0x00,
- 0xa3, 0x6a, 0x66, 0x00,
- 0x52, 0x6a, 0xbe, 0x16,
- 0xef, 0xa0, 0xa0, 0x02,
- 0x80, 0x50, 0x2a, 0x1f,
- 0x10, 0xa0, 0xa0, 0x00,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x51, 0x3f, 0x1f,
- 0x80, 0x50, 0x3f, 0x1b,
- 0xff, 0x6a, 0x8e, 0x02,
- 0xff, 0x6a, 0x8d, 0x02,
- 0x08, 0x6a, 0x8c, 0x00,
- 0x04, 0x6a, 0x64, 0x00,
- 0x88, 0x6a, 0x66, 0x00,
- 0x52, 0x6a, 0xbe, 0x16,
- 0x0d, 0x6a, 0x93, 0x00,
- 0x08, 0x94, 0x34, 0x1f,
- 0xff, 0x6a, 0x93, 0x02,
- 0x08, 0x93, 0x36, 0x1b,
- 0xff, 0x99, 0xb3, 0x02,
- 0xff, 0x99, 0xb4, 0x02,
- 0xff, 0x99, 0xb5, 0x02,
- 0xff, 0x99, 0xb6, 0x02,
- 0xff, 0x99, 0xb7, 0x02,
- 0xff, 0x99, 0xb8, 0x02,
- 0xff, 0x99, 0xb9, 0x02,
- 0xff, 0x99, 0x6a, 0x02,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x51, 0x4d, 0x1f,
- 0xff, 0x08, 0x4c, 0x1b,
- 0xff, 0x09, 0x4c, 0x1b,
- 0xff, 0x0a, 0x4c, 0x1b,
- 0xff, 0x6a, 0x50, 0x02,
- 0xff, 0x51, 0x51, 0x06,
- 0xff, 0x6a, 0x64, 0x02,
- 0x08, 0x52, 0x52, 0x06,
- 0x00, 0x53, 0x53, 0x08,
- 0x00, 0x54, 0x54, 0x08,
- 0x00, 0x55, 0x55, 0x08,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x80, 0x6a, 0x50, 0x00,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x4c, 0x05, 0x64, 0x0a,
- 0x07, 0x64, 0x64, 0x02,
- 0x20, 0x64, 0x65, 0x06,
- 0x70, 0x05, 0x6e, 0x02,
- 0xff, 0x6e, 0x64, 0x03,
- 0xff, 0x65, 0x66, 0x02,
- 0x00, 0x65, 0x4e, 0x17,
- 0x00, 0x4f, 0x57, 0x1b,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x01, 0x6a, 0x6d, 0x00,
- 0x03, 0x6a, 0x6d, 0x00,
- 0x01, 0x6a, 0x6d, 0x00,
- 0x19, 0x6a, 0x6d, 0x00,
- 0x0f, 0x6a, 0x6d, 0x00,
- 0xc9, 0x66, 0x36, 0x06,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x65, 0x4e, 0x02,
- 0xff, 0x65, 0x03, 0x03,
-};
diff --git a/sys/gnu/misc/aic7770/COPYING b/sys/gnu/misc/aic7770/COPYING
deleted file mode 100644
index a43ea21..0000000
--- a/sys/gnu/misc/aic7770/COPYING
+++ /dev/null
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 675 Mass Ave, Cambridge, MA 02139, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- Appendix: How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19yy name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/sys/gnu/misc/aic7770/COPYRIGHT b/sys/gnu/misc/aic7770/COPYRIGHT
deleted file mode 100644
index 905285d..0000000
--- a/sys/gnu/misc/aic7770/COPYRIGHT
+++ /dev/null
@@ -1,16 +0,0 @@
-Adaptec 274x device driver for Linux.
-Copyright (c) 1994 The University of Calgary Department of Computer Science.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
diff --git a/sys/gnu/misc/aic7770/README b/sys/gnu/misc/aic7770/README
deleted file mode 100644
index 1e4e5a0..0000000
--- a/sys/gnu/misc/aic7770/README
+++ /dev/null
@@ -1,94 +0,0 @@
-@(#)README 1.16 94/11/09 jda
-
-AHA274x/284x DRIVER
-
-*** THIS SHOULD BE CONSIDERED BETA SOFTWARE ***
-
-BACKGROUND & LIMITATIONS
-
-For various reasons, we ended up with one of these cards under the
-impression that support was soon forthcoming. In mid-May, I asked
-Scott Ferris (the official person who's supposed to be writing this
-driver) what documentation he used, _finally_ got it from Adaptec,
-and started writing this driver. It is now at what I would consider
-a stable state - it runs our news server and is battered by SCSI
-requests 24 hours a day without dying. There are a few devices it
-reportedly doesn't like working with - those are being sorted out. Due
-to some unexpected equipment loans, I am able to support this at least
-for the time being.
-
-YOU MUST HAVE THE BIOS ENABLED OR THIS WILL NOT WORK. The BIOS extracts
-some configuration information that I cannot get to portably yet, as
-well as provides some self-tests which this driver does not attempt to
-duplicate.
-
-Scott's driver development is stalled for now, and after discussions
-with him, this is now officially out of "pre-alpha" status and into
-beta until the remaining device problems can be resolved. The latest
-patches can be obtained via anonymous ftp from ftp.cpsc.ucalgary.ca in
-/pub/systems/linux/aha274x.
-
-It supports both EISA 274x and VL-bus 284x, either single or twin-bus cards
-(but not the second SCSI bus of twin cards - see aha274x.c), and supports
-disconnection, synchronous SCSI, and scatter-gather. Unlike previous
-versions, abort() and reset() are now implemented, and both hosts.c and
-aha274x.c should give a clean compile. Code is now present to detect parity
-errors, but has not been tested.
-
-I wrote this using a 1.0.9 kernel. Unfortunately, I'm getting tired of
-#ifdef'ing everything to handle two or three different evolutionary steps
-in the SCSI kernel code, so I've upgraded my system to 1.1.49, and will
-only leave in code to support versions from about 1.1.45 onward.
-
-Thanks to patches supplied by Mark Olson <molson@tricord.com>, this driver
-will now work with the 284x series (the VL-bus version of this card). The
-294x (PCI-bus) support is based on patches sent to me by Mark Olson and
-Alan Hourihane <alanh@fairlite.demon.co.uk>.
-
-Under protest, this driver is subject to the GPL - see the file
-COPYING for details.
-
-Thanks to the following people for bug fixes/code improvements (also
-thanks to the people who have sent me feedback):
-
- "David F. Carlson" <dave@ee.rochester.edu>
- Jimen Ching <jiching@wiliki.eng.hawaii.edu>
- mday@artisoft.com (Matt Day)
- "Dean W. Gehnert" <deang@ims.com>
- Darcy Grant <darcy@cpsc.ucalgary.ca>
- Alan Hourihane <alanh@fairlite.demon.co.uk>
- isely@fncrd8.fnal.gov (Mike Isely)
- Mike Jerger <jerger@ux1.cso.uiuc.edu>
- tm@netcom.com (Toshiyasu Morita)
- neal@interact.org (Neal Norwitz)
- Mark Olson <molson@tricord.com>
- map@europa.ecn.uoknor.edu (Michael A. Parker)
- Thomas Scheunemann <thomas@dagobert.uni-duisburg.de>
-
-Special thanks to Drew Eckhardt <drew@kinglear.cs.Colorado.EDU> for
-fielding my questions about synchronous negotiation. Steffen Moeller
-<smoe0024@rz.uni-hildesheim.de> sent me installation instructions which
-were previously included in this README.
-
-David Pirie <pirie@cpsc.ucalgary.ca> was nice enough to loan me his
-2842 card for a week so I could track down one bug, as well as his
-CD-ROM drive later, and also thanks to Doug Fortune at Riley's Data Share
-in Calgary, who arranged a long-term loan of a 2842 board for further work.
-
-Many thanks to the fearless prerelease testers! Dean Gehnert has been
-building Slackware boot disks for the driver, which are available from
-ftp.cpsc.ucalgary.ca in /pub/systems/linux/aha274x/slackware_boot.
-
-Carl Riches <cgr@poplar1.cfr.washington.edu> has set up a mailing list
-for aic7xxx driver development. To subscribe, send a message to
-aic7770-list@poplar1.cfr.washington.edu with a message body of:
-
- subscribe AIC7770-LIST <your name here, without the angle brackets>
-
-Please direct questions and discussions to that list instead of me. When
-sending bug reports, please include a description of your hardware, the
-release numbers displayed by the driver at boot time, and as accurate a
-facsimilie of any error message you're mailing about.
-
-John Aycock
-aycock@cpsc.ucalgary.ca
diff --git a/sys/gnu/misc/aic7770/README-FIRST b/sys/gnu/misc/aic7770/README-FIRST
deleted file mode 100644
index 056dbc8..0000000
--- a/sys/gnu/misc/aic7770/README-FIRST
+++ /dev/null
@@ -1,19 +0,0 @@
-This is VERY MUCH ALPHA SOFTWARE. You MUST know what you're doing to
-use this, or else!!!
-
-Ok, everything's been renamed to reference an "aic7xxx" driver instead
-of "aha274x", and a merger of the two PCI patches I had has been put in,
-along with re-doing the detection and configuration routines. To summarize
-the status: it compiles cleanly. I don't expect it to work off the bat,
-but it's for the 294x development people to synchronize their code
-together.
-
-The file scsi-diffs-1.1.59 is NOT a proper patch file, but some diffs
-to kernel files concatenated together. I've sent these off to Drew,
-but if you're testing this you'll have to apply them - it allows a
-per-driver-instance can_queue variable, which for the aic7xxx driver
-is the number of SCBs the card supports.
-
-Good luck! I await your comments.. Mark, Alan - let me know where I
-broke it, please ;-)
-:ja
diff --git a/sys/gnu/misc/aic7770/aic7770.1 b/sys/gnu/misc/aic7770/aic7770.1
deleted file mode 100644
index 2009f8c..0000000
--- a/sys/gnu/misc/aic7770/aic7770.1
+++ /dev/null
@@ -1,54 +0,0 @@
-.\" Copyright (c) 1994
-.\" Justin T. Gibbs. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce 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 Justin T. Gibbs.
-.\" 4. The name of Justin T. Gibbs may not be used to endorse or promote
-.\" products derived from this software without specific prior written
-.\" permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY JUSTIN T. GIBBS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)aic7770.1 11/15/94
-.\"
-.Dd November 11, 1994
-.Dt AIC7770 1
-.Os BSD 4
-.Sh NAME
-.Nm aic7770
-.Nd aic7770 SCSI controller assembler
-.Sh SYNOPSIS
-.Nm aic7770
-.Op Fl o destination
-.Ar source-file
-.Sh DESCRIPTION
-.Ar Source-file
-is a file containing Aic7770 compatible assembly code. The output of the
-assembler defaults to
-.Ar a.out
-but can be optionally redirected to
-.Ar destination.
-.Pp
-.Sh AUTHOR
-This aic7770 compiler was written by John Aycock (aycock@cpsc.ucalgary.ca) and
-is subject to the GNU Public License.
-
diff --git a/sys/gnu/misc/aic7770/aic7770.c b/sys/gnu/misc/aic7770/aic7770.c
deleted file mode 100644
index 417a352..0000000
--- a/sys/gnu/misc/aic7770/aic7770.c
+++ /dev/null
@@ -1,584 +0,0 @@
-/*
- * Adaptec 274x device driver for Linux.
- * Copyright (c) 1994 The University of Calgary Department of Computer Science.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Comments are started by `#' and continue to the end of the line; lines
- * may be of the form:
- *
- * <label>*
- * <label>* <undef-sym> = <value>
- * <label>* <opcode> <operand>*
- *
- * A <label> is an <undef-sym> ending in a colon. Spaces, tabs, and commas
- * are token separators.
- */
-
-/* #define _POSIX_SOURCE 1 */
-#define _POSIX_C_SOURCE 2
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#define MEMORY 512 /* 2^9 29-bit words */
-#define MAXLINE 1024
-#define MAXTOKEN 32
-#define ADOTOUT "a.out"
-#define NOVALUE -1
-
-/*
- * AIC-7770 register definitions
- */
-#define R_SINDEX 0x65
-#define R_ALLONES 0x69
-#define R_ALLZEROS 0x6a
-#define R_NONE 0x6a
-
-static
-char sccsid[] =
- "@(#)aic7770.c 1.10 94/07/22 jda";
-
-int debug;
-int lineno, LC;
-char *filename;
-FILE *ifp, *ofp;
-unsigned char M[MEMORY][4];
-
-void error(char *s)
-{
- fprintf(stderr, "%s: %s at line %d\n", filename, s, lineno);
- exit(EXIT_FAILURE);
-}
-
-void *Malloc(size_t size)
-{
- void *p = malloc(size);
- if (!p)
- error("out of memory");
- return(p);
-}
-
-void *Realloc(void *ptr, size_t size)
-{
- void *p = realloc(ptr, size);
- if (!p)
- error("out of memory");
- return(p);
-}
-
-char *Strdup(char *s)
-{
- char *p = (char *)Malloc(strlen(s) + 1);
- strcpy(p, s);
- return(p);
-}
-
-typedef struct sym_t {
- struct sym_t *next; /* MUST BE FIRST */
- char *name;
- int value;
- int npatch, *patch;
-} sym_t;
-
-sym_t *head;
-
-void define(char *name, int value)
-{
- sym_t *p, *q;
-
- for (p = head, q = (sym_t *)&head; p; p = p->next) {
- if (!strcmp(p->name, name))
- error("redefined symbol");
- q = p;
- }
-
- p = q->next = (sym_t *)Malloc(sizeof(sym_t));
- p->next = NULL;
- p->name = Strdup(name);
- p->value = value;
- p->npatch = 0;
- p->patch = NULL;
-
- if (debug) {
- fprintf(stderr, "\"%s\" ", p->name);
- if (p->value != NOVALUE)
- fprintf(stderr, "defined as 0x%x\n", p->value);
- else
- fprintf(stderr, "undefined\n");
- }
-}
-
-sym_t *lookup(char *name)
-{
- sym_t *p;
-
- for (p = head; p; p = p->next)
- if (!strcmp(p->name, name))
- return(p);
- return(NULL);
-}
-
-void patch(sym_t *p, int location)
-{
- p->npatch += 1;
- p->patch = (int *)Realloc(p->patch, p->npatch * sizeof(int *));
-
- p->patch[p->npatch - 1] = location;
-}
-
-void backpatch(void)
-{
- int i;
- sym_t *p;
-
- for (p = head; p; p = p->next) {
-
- if (p->value == NOVALUE) {
- fprintf(stderr,
- "%s: undefined symbol \"%s\"\n",
- filename, p->name);
- exit(EXIT_FAILURE);
- }
-
- if (p->npatch) {
- if (debug)
- fprintf(stderr,
- "\"%s\" (0x%x) patched at",
- p->name, p->value);
-
- for (i = 0; i < p->npatch; i++) {
- M[p->patch[i]][0] &= ~1;
- M[p->patch[i]][0] |= ((p->value >> 8) & 1);
- M[p->patch[i]][1] = p->value & 0xff;
-
- if (debug)
- fprintf(stderr, " 0x%x", p->patch[i]);
- }
-
- if (debug)
- fputc('\n', stderr);
- }
- }
-}
-
-/*
- * Output words in byte-reversed order (least significant first)
- * since the sequencer RAM is loaded that way.
- */
-void output(FILE *fp)
-{
- int i;
-
- for (i = 0; i < LC; i++)
- fprintf(fp, "\t0x%02x, 0x%02x, 0x%02x, 0x%02x,\n",
- M[i][3],
- M[i][2],
- M[i][1],
- M[i][0]);
-}
-
-char **getl(int *n)
-{
- int i;
- char *p;
- static char buf[MAXLINE];
- static char *a[MAXTOKEN];
-
- i = 0;
-
- while (fgets(buf, sizeof(buf), ifp)) {
-
- lineno += 1;
-
- if (buf[strlen(buf)-1] != '\n')
- error("line too long");
-
- p = strchr(buf, '#');
- if (p)
- *p = '\0';
-
- for (p = strtok(buf, ", \t\n"); p; p = strtok(NULL, ", \t\n"))
- if (i < MAXTOKEN-1)
- a[i++] = p;
- else
- error("too many tokens");
- if (i) {
- *n = i;
- return(a);
- }
- }
- return(NULL);
-}
-
-#define A 0x8000 /* `A'ccumulator ok */
-#define I 0x4000 /* use as immediate value */
-#define SL 0x2000 /* shift left */
-#define SR 0x1000 /* shift right */
-#define RL 0x0800 /* rotate left */
-#define RR 0x0400 /* rotate right */
-#define LO 0x8000 /* lookup: ori-{jmp,jc,jnc,call} */
-#define LA 0x4000 /* lookup: and-{jz,jnz} */
-#define LX 0x2000 /* lookup: xor-{je,jne} */
-#define NA -1 /* not applicable */
-
-struct {
- char *name;
- int n; /* number of operands, including opcode */
- unsigned int op; /* immediate or L?|pos_from_0 */
- unsigned int dest; /* NA, pos_from_0, or I|immediate */
- unsigned int src; /* NA, pos_from_0, or I|immediate */
- unsigned int imm; /* pos_from_0, A|pos_from_0, or I|immediate */
- unsigned int addr; /* NA or pos_from_0 */
- int fmt; /* instruction format - 1, 2, or 3 */
-} instr[] = {
-/*
- * N OP DEST SRC IMM ADDR FMT
- */
- "mov", 3, 1, 1, 2, I|0xff, NA, 1,
- "mov", 4, LO|2, NA, 1, I|0, 3, 3,
- "mvi", 3, 0, 1, I|R_ALLZEROS, A|2, NA, 1,
- "mvi", 4, LO|2, NA, I|R_ALLZEROS, 1, 3, 3,
- "not", 2, 2, 1, 1, I|0xff, NA, 1,
- "not", 3, 2, 1, 2, I|0xff, NA, 1,
- "and", 3, 1, 1, 1, A|2, NA, 1,
- "and", 4, 1, 1, 3, A|2, NA, 1,
- "or", 3, 0, 1, 1, A|2, NA, 1,
- "or", 4, 0, 1, 3, A|2, NA, 1,
- "or", 5, LO|3, NA, 1, 2, 4, 3,
- "xor", 3, 2, 1, 1, A|2, NA, 1,
- "xor", 4, 2, 1, 3, A|2, NA, 1,
- "nop", 1, 1, I|R_NONE, I|R_ALLZEROS, I|0xff, NA, 1,
- "inc", 2, 3, 1, 1, I|1, NA, 1,
- "inc", 3, 3, 1, 2, I|1, NA, 1,
- "dec", 2, 3, 1, 1, I|0xff, NA, 1,
- "dec", 3, 3, 1, 2, I|0xff, NA, 1,
- "jmp", 2, LO|0, NA, I|R_SINDEX, I|0, 1, 3,
- "jc", 2, LO|0, NA, I|R_SINDEX, I|0, 1, 3,
- "jnc", 2, LO|0, NA, I|R_SINDEX, I|0, 1, 3,
- "call", 2, LO|0, NA, I|R_SINDEX, I|0, 1, 3,
- "test", 5, LA|3, NA, 1, A|2, 4, 3,
- "cmp", 5, LX|3, NA, 1, A|2, 4, 3,
- "ret", 1, 1, I|R_NONE, I|R_ALLZEROS, I|0xff, NA, 1,
- "clc", 1, 3, I|R_NONE, I|R_ALLZEROS, I|1, NA, 1,
- "clc", 4, 3, 2, I|R_ALLZEROS, A|3, NA, 1,
- "stc", 1, 3, I|R_NONE, I|R_ALLONES, I|1, NA, 1,
- "stc", 2, 3, 1, I|R_ALLONES, I|1, NA, 1,
- "add", 3, 3, 1, 1, A|2, NA, 1,
- "add", 4, 3, 1, 3, A|2, NA, 1,
- "adc", 3, 4, 1, 1, A|2, NA, 1,
- "adc", 4, 4, 1, 3, A|2, NA, 1,
- "shl", 3, 5, 1, 1, SL|2, NA, 2,
- "shl", 4, 5, 1, 2, SL|3, NA, 2,
- "shr", 3, 5, 1, 1, SR|2, NA, 2,
- "shr", 4, 5, 1, 2, SR|3, NA, 2,
- "rol", 3, 5, 1, 1, RL|2, NA, 2,
- "rol", 4, 5, 1, 2, RL|3, NA, 2,
- "ror", 3, 5, 1, 1, RR|2, NA, 2,
- "ror", 4, 5, 1, 2, RR|3, NA, 2,
- /*
- * Extensions (note also that mvi allows A)
- */
- "clr", 2, 1, 1, I|R_ALLZEROS, I|0xff, NA, 1,
- 0
-};
-
-int eval_operand(char **a, int spec)
-{
- int i;
- unsigned int want = spec & (LO|LA|LX);
-
- static struct {
- unsigned int what;
- char *name;
- int value;
- } jmptab[] = {
- LO, "jmp", 8,
- LO, "jc", 9,
- LO, "jnc", 10,
- LO, "call", 11,
- LA, "jz", 15,
- LA, "jnz", 13,
- LX, "je", 14,
- LX, "jne", 12,
- };
-
- spec &= ~(LO|LA|LX);
-
- for (i = 0; i < sizeof(jmptab)/sizeof(jmptab[0]); i++)
- if (jmptab[i].what == want &&
- !strcmp(jmptab[i].name, a[spec]))
- {
- return(jmptab[i].value);
- }
-
- if (want)
- error("invalid jump");
-
- return(spec); /* "case 0" - no flags set */
-}
-
-int eval_sdi(char **a, int spec)
-{
- sym_t *p;
- unsigned val;
-
- if (spec == NA)
- return(NA);
-
- switch (spec & (A|I|SL|SR|RL|RR)) {
- case SL:
- case SR:
- case RL:
- case RR:
- if (isdigit(*a[spec &~ (SL|SR|RL|RR)]))
- val = strtol(a[spec &~ (SL|SR|RL|RR)], NULL, 0);
- else {
- p = lookup(a[spec &~ (SL|SR|RL|RR)]);
- if (!p)
- error("undefined symbol used");
- val = p->value;
- }
-
- switch (spec & (SL|SR|RL|RR)) { /* blech */
- case SL:
- if (val > 7)
- return(0xf0);
- return(((val % 8) << 4) |
- (val % 8));
- case SR:
- if (val > 7)
- return(0xf0);
- return(((val % 8) << 4) |
- (1 << 3) |
- ((8 - (val % 8)) % 8));
- case RL:
- return(val % 8);
- case RR:
- return((8 - (val % 8)) % 8);
- }
- case I:
- return(spec &~ I);
- case A:
- /*
- * An immediate field of zero selects
- * the accumulator. Vigorously object
- * if zero is given otherwise - it's
- * most likely an error.
- */
- spec &= ~A;
- if (!strcmp("A", a[spec]))
- return(0);
- if (isdigit(*a[spec]) &&
- strtol(a[spec], NULL, 0) == 0)
- {
- error("immediate value of zero selects accumulator");
- }
- /* falls through */
- case 0:
- if (isdigit(*a[spec]))
- return(strtol(a[spec], NULL, 0));
- p = lookup(a[spec]);
- if (p)
- return(p->value);
- error("undefined symbol used");
- }
-
- return(NA); /* shut the compiler up */
-}
-
-int eval_addr(char **a, int spec)
-{
- sym_t *p;
-
- if (spec == NA)
- return(NA);
- if (isdigit(*a[spec]))
- return(strtol(a[spec], NULL, 0));
-
- p = lookup(a[spec]);
-
- if (p) {
- if (p->value != NOVALUE)
- return(p->value);
- patch(p, LC);
- } else {
- define(a[spec], NOVALUE);
- p = lookup(a[spec]);
- patch(p, LC);
- }
-
- return(NA); /* will be patched in later */
-}
-
-int crack(char **a, int n)
-{
- int i;
- int I_imm, I_addr;
- int I_op, I_dest, I_src, I_ret;
-
- /*
- * Check for "ret" at the end of the line; remove
- * it unless it's "ret" alone - we still want to
- * look it up in the table.
- */
- I_ret = (strcmp(a[n-1], "ret") ? 0 : !0);
- if (I_ret && n > 1)
- n -= 1;
-
- for (i = 0; instr[i].name; i++) {
- /*
- * Look for match in table given constraints,
- * currently just the name and the number of
- * operands.
- */
- if (!strcmp(instr[i].name, *a) && instr[i].n == n)
- break;
- }
- if (!instr[i].name)
- error("unknown opcode or wrong number of operands");
-
- I_op = eval_operand(a, instr[i].op);
- I_src = eval_sdi(a, instr[i].src);
- I_imm = eval_sdi(a, instr[i].imm);
- I_dest = eval_sdi(a, instr[i].dest);
- I_addr = eval_addr(a, instr[i].addr);
-
- switch (instr[i].fmt) {
- case 1:
- case 2:
- M[LC][0] = (I_op << 1) | I_ret;
- M[LC][1] = I_dest;
- M[LC][2] = I_src;
- M[LC][3] = I_imm;
- break;
- case 3:
- if (I_ret)
- error("illegal use of \"ret\"");
- M[LC][0] = (I_op << 1) | ((I_addr >> 8) & 1);
- M[LC][1] = I_addr & 0xff;
- M[LC][2] = I_src;
- M[LC][3] = I_imm;
- break;
- }
-
- return(1); /* no two-byte instructions yet */
-}
-
-#undef SL
-#undef SR
-#undef RL
-#undef RR
-#undef LX
-#undef LA
-#undef LO
-#undef I
-#undef A
-
-void assemble(void)
-{
- int n;
- char **a;
- sym_t *p;
-
- while ((a = getl(&n))) {
-
- while (a[0][strlen(*a)-1] == ':') {
- a[0][strlen(*a)-1] = '\0';
- p = lookup(*a);
- if (p)
- p->value = LC;
- else
- define(*a, LC);
- a += 1;
- n -= 1;
- }
-
- if (!n) /* line was all labels */
- continue;
-
- if (n == 3 && !strcmp("VERSION", *a))
- fprintf(ofp, "#define %s \"%s\"\n", a[1], a[2]);
- else {
- if (n == 3 && !strcmp("=", a[1]))
- define(*a, strtol(a[2], NULL, 0));
- else
- LC += crack(a, n);
- }
- }
-
- backpatch();
- output(ofp);
-
- if (debug)
- output(stderr);
-}
-
-int main(int argc, char **argv)
-{
- int c;
-
- while ((c = getopt(argc, argv, "dho:")) != EOF) {
- switch (c) {
- case 'd':
- debug = !0;
- break;
- case 'o':
- ofp = fopen(optarg, "w");
- if (!ofp) {
- perror(optarg);
- exit(EXIT_FAILURE);
- }
- break;
- case 'h':
- printf("usage: %s [-d] [-ooutput] input\n", *argv);
- exit(EXIT_SUCCESS);
- case NULL:
- /*
- * An impossible option to shut the compiler
- * up about sccsid[].
- */
- exit((int)sccsid);
- default:
- exit(EXIT_FAILURE);
- }
- }
-
- if (argc - optind != 1) {
- fprintf(stderr, "%s: must have one input file\n", *argv);
- exit(EXIT_FAILURE);
- }
- filename = argv[optind];
-
- ifp = fopen(filename, "r");
- if (!ifp) {
- perror(filename);
- exit(EXIT_FAILURE);
- }
-
- if (!ofp) {
- ofp = fopen(ADOTOUT, "w");
- if (!ofp) {
- perror(ADOTOUT);
- exit(EXIT_FAILURE);
- }
- }
-
- assemble();
- exit(EXIT_SUCCESS);
-}
diff --git a/sys/gnu/misc/aic7770/aic7770.seq b/sys/gnu/misc/aic7770/aic7770.seq
deleted file mode 100644
index a112033..0000000
--- a/sys/gnu/misc/aic7770/aic7770.seq
+++ /dev/null
@@ -1,1157 +0,0 @@
-# @(#)aic7xxx.seq 1.31 94/11/25 jda
-#
-# Adaptec 274x device driver for Linux.
-# Copyright (c) 1994 The University of Calgary Department of Computer Science.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-VERSION AIC7XXX_SEQ_VERSION 1.31
-
-SCBMASK = 0x1f
-
-SCSISEQ = 0x00
-SXFRCTL0 = 0x01
-SXFRCTL1 = 0x02
-SCSISIGI = 0x03
-SCSISIGO = 0x03
-SCSIRATE = 0x04
-SCSIID = 0x05
-SCSIDATL = 0x06
-STCNT = 0x08
-STCNT+0 = 0x08
-STCNT+1 = 0x09
-STCNT+2 = 0x0a
-SSTAT0 = 0x0b
-CLRSINT1 = 0x0c
-SSTAT1 = 0x0c
-SIMODE1 = 0x11
-SCSIBUSL = 0x12
-SHADDR = 0x14
-SELID = 0x19
-SBLKCTL = 0x1f
-SEQCTL = 0x60
-A = 0x64 # == ACCUM
-SINDEX = 0x65
-DINDEX = 0x66
-ALLZEROS = 0x6a
-NONE = 0x6a
-SINDIR = 0x6c
-DINDIR = 0x6d
-FUNCTION1 = 0x6e
-HADDR = 0x88
-HCNT = 0x8c
-HCNT+0 = 0x8c
-HCNT+1 = 0x8d
-HCNT+2 = 0x8e
-SCBPTR = 0x90
-INTSTAT = 0x91
-DFCNTRL = 0x93
-DFSTATUS = 0x94
-DFDAT = 0x99
-QINFIFO = 0x9b
-QINCNT = 0x9c
-QOUTFIFO = 0x9d
-
-SCSICONF_A = 0x5a
-SCSICONF_B = 0x5b
-
-# The two reserved bytes at SCBARRAY+1[23] are expected to be set to
-# zero, and the reserved bit in SCBARRAY+0 is used as an internal flag
-# to indicate whether or not to reload scatter-gather parameters after
-# a disconnect.
-#
-SCBARRAY+0 = 0xa0
-SCBARRAY+1 = 0xa1
-SCBARRAY+2 = 0xa2
-SCBARRAY+3 = 0xa3
-SCBARRAY+7 = 0xa7
-SCBARRAY+11 = 0xab
-SCBARRAY+14 = 0xae
-SCBARRAY+15 = 0xaf
-SCBARRAY+16 = 0xb0
-SCBARRAY+17 = 0xb1
-SCBARRAY+18 = 0xb2
-SCBARRAY+19 = 0xb3
-SCBARRAY+20 = 0xb4
-SCBARRAY+21 = 0xb5
-SCBARRAY+22 = 0xb6
-SCBARRAY+23 = 0xb7
-SCBARRAY+24 = 0xb8
-SCBARRAY+25 = 0xb9
-
-SIGNAL_0 = 0x01 # unknown scsi bus phase
-SIGNAL_1 = 0x11 # message reject
-SIGNAL_2 = 0x21 # no IDENTIFY after reconnect
-SIGNAL_3 = 0x31 # no cmd match for reconnect
-SIGNAL_4 = 0x41 # SDTR -> SCSIRATE conversion
-STATUS_ERROR = 0x51
-
-# The host adapter card (at least the BIOS) uses 20-2f for SCSI
-# device information, 32-33 and 5a-5f as well. As it turns out, the
-# BIOS trashes 20-2f, writing the synchronous negotiation results
-# on top of the BIOS values, so we re-use those for our per-target
-# scratchspace (actually a value that can be copied directly into
-# SCSIRATE). The kernel driver will enable synchronous negotiation
-# for all targets that have a value other than 0 in the lower four
-# bits of the target scratch space. This should work irregardless of
-# whether the bios has been installed. NEEDSDTR has one bit per target
-# indicating if an SDTR message is needed for that device - this will
-# be set initially (based on a search through the target scratch space),
-# as well as after a bus reset condition.
-#
-# The high bit of DROPATN is set if ATN should be dropped before the ACK
-# when outb is called. REJBYTE contains the first byte of a MESSAGE IN
-# message, so the driver can report an intelligible error if a message is
-# rejected.
-#
-# RESELECT's high bit is true if we are currently handling a reselect;
-# its next-highest bit is true ONLY IF we've seen an IDENTIFY message
-# from the reselecting target. If we haven't had IDENTIFY, then we have
-# no idea what the lun is, and we can't select the right SCB register
-# bank, so force a kernel panic if the target attempts a data in/out or
-# command phase instead of corrupting something.
-#
-# Note that SG_NEXT occupies four bytes.
-#
-SYNCNEG = 0x20
-
-DROPATN = 0x30
-REJBYTE = 0x31
-DISC_DSB_A = 0x32
-DISC_DSB_B = 0x33
-RESELECT = 0x34
-
-MSG_FLAGS = 0x35
-MSG_LEN = 0x36
-MSG_START+0 = 0x37
-MSG_START+1 = 0x38
-MSG_START+2 = 0x39
-MSG_START+3 = 0x3a
-MSG_START+4 = 0x3b
-MSG_START+5 = 0x3c
--MSG_START+0 = 0xc9 # 2's complement of MSG_START+0
-
-ARG_1 = 0x4c # sdtr conversion args & return
-RETURN_1 = 0x4c
-
-SIGSTATE = 0x4d # value written to SCSISIGO
-NEEDSDTR_A = 0x4e # send SDTR message, 1 bit/trgt
-NEEDSDTR_B = 0x4f
-
-SG_SIZEOF = 0x8 # sizeof(struct scatterlist)
-SG_NOLOAD = 0x50 # load SG pointer/length?
-SG_COUNT = 0x51 # working value of SG count
-SG_NEXT = 0x52 # working value of SG pointer
-SG_NEXT+0 = 0x52
-SG_NEXT+1 = 0x53
-SG_NEXT+2 = 0x54
-SG_NEXT+3 = 0x55
-
-SCBCOUNT = 0x56 # the actual number of SCBs
-FLAGS = 0x57 # Device configuration flags
-TWIN_BUS = 0x01
-WIDE_BUS = 0x02
-
-ACTIVE_A = 0x58
-ACTIVE_B = 0x59
-
-# Poll QINCNT for work - the lower bits contain
-# the number of entries in the Queue In FIFO.
-#
-start:
- test FLAGS,TWIN_BUS jz start2 # Are we a twin channel device?
-# For fairness, we check the other bus first, since we just finished a
-# transaction on the current channel.
- xor SBLKCTL,0x08 # Toggle to the other bus
- test SCSISIGI,0x4 jnz reselect # BSYI
- xor SBLKCTL,0x08 # Toggle to the original bus
-start2:
- test SCSISIGI,0x4 jnz reselect # BSYI
- test QINCNT,SCBMASK jz start
-
-# We have at least one queued SCB now. Set the SCB pointer
-# from the FIFO so we see the right bank of SCB registers,
-# then set SCSI options and set the initiator and target
-# SCSI IDs.
-#
- mov SCBPTR,QINFIFO
-
-# See if there is not already an active SCB for this target. This code
-# locks out on a per target basis instead of target/lun. Although this
-# is not ideal for devices that have multiple luns active at the same
-# time, it is faster than looping through all SCB's looking for active
-# commands. It may be benificial to make findscb a more general procedure
-# to see if the added cost of the search is negligible. This code also
-# assumes that the kernel driver will clear the active flags on board
-# initialization, board reset, and a target's SELTO.
-
- and FUNCTION1,0x70,SCBARRAY+1
- mov A,FUNCTION1
- test SCBARRAY+1,0x88 jz test_a # Id < 8 && A channel
-
- test ACTIVE_B,A jnz requeue
- or ACTIVE_B,A # Mark the current target as busy
- jmp start_scb
-
-# Place the currently active back on the queue for later processing
-requeue:
- mov QINFIFO, SCBPTR
- jmp start
-
-test_a:
- test ACTIVE_A,A jnz requeue
- or ACTIVE_A,A # Mark the current target as busy
-
-start_scb:
- and A,0x08,SCBARRAY+1
- mov SBLKCTL,A # select channel, !wide
- mov SCBARRAY+1 call initialize
- clr SG_NOLOAD
- clr RESELECT
-
-# As soon as we get a successful selection, the target should go
-# into the message out phase since we have ATN asserted. Prepare
-# the message to send, locking out the device driver. If the device
-# driver hasn't beaten us with an ABORT or RESET message, then tack
-# on an SDTR negotiation if required.
-#
-# Messages are stored in scratch RAM starting with a flag byte (high bit
-# set means active message), one length byte, and then the message itself.
-#
- mov SCBARRAY+1 call disconnect # disconnect ok?
-
- and SINDEX,0x7,SCBARRAY+1 # lun
- or SINDEX,A # return value from disconnect
- or SINDEX,0x80 call mk_mesg # IDENTIFY message
-
- mov A,SINDEX
- cmp MSG_START+0,A jne !message # did driver beat us?
- mvi MSG_START+1 call mk_sdtr # build SDTR message if needed
-
-!message:
-
-# Enable selection phase as an initiator, and do automatic ATN
-# after the selection.
-#
- mvi SCSISEQ,0x48 # ENSELO|ENAUTOATNO
-
-# Wait for successful arbitration. The AIC-7770 documentation says
-# that SELINGO indicates successful arbitration, and that it should
-# be used to look for SELDO. However, if the sequencer is paused at
-# just the right time - a parallel fsck(8) on two drives did it for
-# me - then SELINGO can flip back to false before we've seen it. This
-# makes the sequencer sit in the arbitration loop forever. This is
-# Not Good.
-#
-# Therefore, I've added a check in the arbitration loop for SELDO
-# too. This could arguably be made a critical section by disabling
-# pauses, but I don't want to make a potentially infinite loop a CS.
-# I suppose you could fold it into the select loop, too, but since
-# I've been hunting this bug for four days it's kinda like a trophy.
-#
-arbitrate:
- test SSTAT0,0x40 jnz *select # SELDO
- test SSTAT0,0x10 jz arbitrate # SELINGO
-
-# Wait for a successful selection. If the hardware selection
-# timer goes off, then the driver gets the interrupt, so we don't
-# need to worry about it.
-#
-select:
- test SSTAT0,0x40 jz select # SELDO
- jmp *select
-
-# Reselection is being initiated by a target - we've seen the BSY
-# line driven active, and we didn't do it! Enable the reselection
-# hardware, and wait for it to finish. Make a note that we've been
-# reselected, but haven't seen an IDENTIFY message from the target
-# yet.
-#
-reselect:
- mvi SCSISEQ,0x10 # ENRSELI
-
-reselect1:
- test SSTAT0,0x20 jz reselect1 # SELDI
- mov SELID call initialize
-
- mvi RESELECT,0x80 # reselected, no IDENTIFY
-
-# After the [re]selection, make sure that the [re]selection enable
-# bit is off. This chip is flaky enough without extra things
-# turned on. Also clear the BUSFREE bit in SSTAT1 since we'll be
-# using it shortly.
-#
-*select:
- clr SCSISEQ
- mvi CLRSINT1,0x8 # CLRBUSFREE
-
-# Main loop for information transfer phases. If BSY is false, then
-# we have a bus free condition, expected or not. Otherwise, wait
-# for the target to assert REQ before checking MSG, C/D and I/O
-# for the bus phase.
-#
-# We can't simply look at the values of SCSISIGI here (if we want
-# to do synchronous data transfer), because the target won't assert
-# REQ if it's already sent us some data that we haven't acknowledged
-# yet.
-#
-ITloop:
- test SSTAT1,0x8 jnz p_busfree # BUSFREE
- test SSTAT1,0x1 jz ITloop # REQINIT
-
- and A,0xe0,SCSISIGI # CDI|IOI|MSGI
-
- cmp ALLZEROS,A je p_dataout
- cmp A,0x40 je p_datain
- cmp A,0x80 je p_command
- cmp A,0xc0 je p_status
- cmp A,0xa0 je p_mesgout
- cmp A,0xe0 je p_mesgin
-
- mvi INTSTAT,SIGNAL_0 # unknown - signal driver
-
-p_dataout:
- mvi 0 call scsisig # !CDO|!IOO|!MSGO
- call assert
- call sg_load
-
- mvi A,3
- mvi DINDEX,HCNT
- mvi SCBARRAY+23 call bcopy
-
- mvi A,3
- mvi DINDEX,STCNT
- mvi SCBARRAY+23 call bcopy
-
- mvi A,4
- mvi DINDEX,HADDR
- mvi SCBARRAY+19 call bcopy
-
- mvi 0x3d call dma # SCSIEN|SDMAEN|HDMAEN|
- # DIRECTION|FIFORESET
-
-# After a DMA finishes, save the final transfer pointer and count
-# back into the SCB, in case a device disconnects in the middle of
-# a transfer. Use SHADDR and STCNT instead of HADDR and HCNT, since
-# it's a reflection of how many bytes were transferred on the SCSI
-# (as opposed to the host) bus.
-#
- mvi A,3
- mvi DINDEX,SCBARRAY+23
- mvi STCNT call bcopy
-
- mvi A,4
- mvi DINDEX,SCBARRAY+19
- mvi SHADDR call bcopy
-
- call sg_advance
- mov SCBARRAY+18,SG_COUNT # residual S/G count
-
- jmp ITloop
-
-p_datain:
- mvi 0x40 call scsisig # !CDO|IOO|!MSGO
- call assert
- call sg_load
-
- mvi A,3
- mvi DINDEX,HCNT
- mvi SCBARRAY+23 call bcopy
-
- mvi A,3
- mvi DINDEX,STCNT
- mvi SCBARRAY+23 call bcopy
-
- mvi A,4
- mvi DINDEX,HADDR
- mvi SCBARRAY+19 call bcopy
-
- mvi 0x39 call dma # SCSIEN|SDMAEN|HDMAEN|
- # !DIRECTION|FIFORESET
- mvi A,3
- mvi DINDEX,SCBARRAY+23
- mvi STCNT call bcopy
-
- mvi A,4
- mvi DINDEX,SCBARRAY+19
- mvi SHADDR call bcopy
-
- call sg_advance
- mov SCBARRAY+18,SG_COUNT # residual S/G count
-
- jmp ITloop
-
-# Command phase. Set up the DMA registers and let 'er rip - the
-# two bytes after the SCB SCSI_cmd_length are zeroed by the driver,
-# so we can copy those three bytes directly into HCNT.
-#
-p_command:
- mvi 0x80 call scsisig # CDO|!IOO|!MSGO
- call assert
-
- mvi A,3
- mvi DINDEX,HCNT
- mvi SCBARRAY+11 call bcopy
-
- mvi A,3
- mvi DINDEX,STCNT
- mvi SCBARRAY+11 call bcopy
-
- mvi A,4
- mvi DINDEX,HADDR
- mvi SCBARRAY+7 call bcopy
-
- mvi 0x3d call dma # SCSIEN|SDMAEN|HDMAEN|
- # DIRECTION|FIFORESET
- jmp ITloop
-
-# Status phase. Wait for the data byte to appear, then read it
-# and store it into the SCB.
-#
-p_status:
- mvi 0xc0 call scsisig # CDO|IOO|!MSGO
-
- mvi SCBARRAY+14 call inb
- jmp ITloop
-
-# Message out phase. If there is no active message, but the target
-# took us into this phase anyway, build a no-op message and send it.
-#
-p_mesgout:
- mvi 0xa0 call scsisig # CDO|!IOO|MSGO
- mvi 0x8 call mk_mesg # build NOP message
-
-# Set up automatic PIO transfer from MSG_START. Bit 3 in
-# SXFRCTL0 (SPIOEN) is already on.
-#
- mvi SINDEX,MSG_START+0
- mov DINDEX,MSG_LEN
- clr A
-
-# When target asks for a byte, drop ATN if it's the last one in
-# the message. Otherwise, keep going until the message is exhausted.
-# (We can't use outb for this since it wants the input in SINDEX.)
-#
-# Keep an eye out for a phase change, in case the target issues
-# a MESSAGE REJECT.
-#
-p_mesgout2:
- test SSTAT0,0x2 jz p_mesgout2 # SPIORDY
- test SSTAT1,0x10 jnz p_mesgout6 # PHASEMIS
-
- cmp DINDEX,1 jne p_mesgout3 # last byte?
- mvi CLRSINT1,0x40 # CLRATNO - drop ATN
-
-# Write a byte to the SCSI bus. The AIC-7770 refuses to automatically
-# send ACKs in automatic PIO or DMA mode unless you make sure that the
-# "expected" bus phase in SCSISIGO matches the actual bus phase. This
-# behaviour is completely undocumented and caused me several days of
-# grief.
-#
-# After plugging in different drives to test with and using a longer
-# SCSI cable, I found that I/O in Automatic PIO mode ceased to function,
-# especially when transferring >1 byte. It seems to be much more stable
-# if STCNT is set to one before the transfer, and SDONE (in SSTAT0) is
-# polled for transfer completion - for both output _and_ input. The
-# only theory I have is that SPIORDY doesn't drop right away when SCSIDATL
-# is accessed (like the documentation says it does), and that on a longer
-# cable run, the sequencer code was fast enough to loop back and see
-# an SPIORDY that hadn't dropped yet.
-#
-p_mesgout3:
- call one_stcnt
- mov SCSIDATL,SINDIR
-
-p_mesgout4:
- test SSTAT0,0x4 jz p_mesgout4 # SDONE
- dec DINDEX
- inc A
- cmp MSG_LEN,A jne p_mesgout2
-
-# If the next bus phase after ATN drops is a message out, it means
-# that the target is requesting that the last message(s) be resent.
-#
-p_mesgout5:
- test SSTAT1,0x8 jnz p_mesgout6 # BUSFREE
- test SSTAT1,0x1 jz p_mesgout5 # REQINIT
-
- and A,0xe0,SCSISIGI # CDI|IOI|MSGI
- cmp A,0xa0 jne p_mesgout6
- mvi 0x10 call scsisig # ATNO - re-assert ATN
-
- jmp ITloop
-
-p_mesgout6:
- mvi CLRSINT1,0x40 # CLRATNO - in case of PHASEMIS
- clr MSG_FLAGS # no active msg
- jmp ITloop
-
-# Message in phase. Bytes are read using Automatic PIO mode, but not
-# using inb. This alleviates a race condition, namely that if ATN had
-# to be asserted under Automatic PIO mode, it had to beat the SCSI
-# circuitry sending an ACK to the target. This showed up under heavy
-# loads and really confused things, since ABORT commands wouldn't be
-# seen by the drive after an IDENTIFY message in until it had changed
-# to a data I/O phase.
-#
-p_mesgin:
- mvi 0xe0 call scsisig # CDO|IOO|MSGO
- mvi A call inb_first # read the 1st message byte
- mvi REJBYTE,A # save it for the driver
-
- cmp ALLZEROS,A jne p_mesgin1
-
-# We got a "command complete" message, so put the SCB pointer
-# into the Queue Out, and trigger a completion interrupt.
-# Check status for non zero return and interrupt driver if needed
-# This allows the driver to interpret errors only when they occur
-# instead of always uploading the scb. If the status is SCSI_CHECK,
-# the driver will download a new scb requesting sense, to replace
-# the old one and the sequencer code will imediately jump to start
-# working on it. If the kernel driver does not wish to request sense,
-# the sequencer program counter is incremented by 1, preventing another run
-# on the current SCB and the command is allowed to complete. We don't
-# bother to post to the QOUTFIFO in the error case since it would require
-# extra work in the kernel driver to ensure that the entry was removed
-# before the command complete code tried processing it.
-
- test SCBARRAY+14,0xff jz status_ok # 0 Status?
- call inb_last # ack & turn auto PIO back on
- mvi INTSTAT,STATUS_ERROR # let driver know
- jmp start_scb
-
-status_ok:
-
-# First, mark this target as free.
- and FUNCTION1,0x70,SCBARRAY+1
- mov A,FUNCTION1
- test SCBARRAY+1,0x88 jz clear_a
- xor ACTIVE_B,A
- jmp complete
-
-clear_a:
- xor ACTIVE_A,A
-
-complete:
- mov QOUTFIFO,SCBPTR
- mvi INTSTAT,0x02 # CMDCMPLT
- jmp p_mesgin_done
-
-# Is it an extended message? We only support the synchronous data
-# transfer request message, which will probably be in response to
-# an SDTR message out from us. If it's not an SDTR, reject it -
-# apparently this can be done after any message in byte, according
-# to the SCSI-2 spec.
-#
-# XXX - we should really reject this if we didn't initiate the SDTR
-# negotiation; this may cause problems with unusual devices.
-#
-p_mesgin1:
- cmp A,1 jne p_mesgin2 # extended message code?
-
- mvi A call inb_next
- cmp A,3 jne p_mesginN # extended mesg length = 3
- mvi A call inb_next
- cmp A,1 jne p_mesginN # SDTR code
-
- mvi ARG_1 call inb_next # xfer period
- mvi A call inb_next # REQ/ACK offset
- mvi INTSTAT,SIGNAL_4 # call driver to convert
-
- call ndx_sdtr # index sync config for target
- mov DINDEX,SINDEX
- not A # turn off "need sdtr" flag
- test SBLKCTL,0x08 jnz p_mesgin1_b
- test SCSIID,0x80 jnz p_mesgin1_b
- and NEEDSDTR_A,A
- jmp p_mesgin1_save
-
-p_mesgin1_b:
- and NEEDSDTR_B,A
-
-p_mesgin1_save:
- and A,0x80,SINDIR # get the WIDEXFER flag
- or RETURN_1,A # Set WIDEXFER if necessary
- mov DINDIR,RETURN_1 # save returned value
-
-# Even though the SCSI-2 specification says that a device responding
-# to our SDTR message should honor our parameters for transmitting
-# to us, it doesn't seem to work too well in real life. In particular,
-# a lot of CD-ROM and tape units don't function: try using the SDTR
-# parameters the device sent us for both transmitting and receiving.
-#
- mov SCSIRATE,RETURN_1
- jmp p_mesgin_done
-
-# Is it a disconnect message? Set a flag in the SCB to remind us
-# and await the bus going free.
-#
-p_mesgin2:
- cmp A,4 jne p_mesgin3 # disconnect code?
-
- or SCBARRAY+0,0x4 # set "disconnected" bit
- jmp p_mesgin_done
-
-# Save data pointers message? Copy working values into the SCB,
-# usually in preparation for a disconnect.
-#
-p_mesgin3:
- cmp A,2 jne p_mesgin4 # save data pointers code?
-
- call sg_ram2scb
- jmp p_mesgin_done
-
-# Restore pointers message? Data pointers are recopied from the
-# SCB anyway at the start of any DMA operation, so the only thing
-# to copy is the scatter-gather values.
-#
-p_mesgin4:
- cmp A,3 jne p_mesgin5 # restore pointers code?
-
- call sg_scb2ram
- jmp p_mesgin_done
-
-# Identify message? For a reconnecting target, this tells us the lun
-# that the reconnection is for - find the correct SCB and switch to it,
-# clearing the "disconnected" bit so we don't "find" it by accident later.
-#
-p_mesgin5:
- test A,0x80 jz p_mesgin6 # identify message?
-
- test A,0x78 jnz p_mesginN # !DiscPriv|!LUNTAR|!Reserved
-
- mov A call findSCB # switch to correct SCB
-
-# If a active message is present after calling findSCB, then either it
-# or the driver is trying to abort the command. Either way, something
-# untoward has happened and we should just leave it alone.
-#
- test MSG_FLAGS,0x80 jnz p_mesgin_done
-
- and SCBARRAY+0,0xfb # clear disconnect bit in SCB
- mvi RESELECT,0xc0 # make note of IDENTIFY
-
- call sg_scb2ram # implied restore pointers
- # required on reselect
- jmp p_mesgin_done
-
-# Message reject? If we have an outstanding SDTR negotiation, assume
-# that it's a response from the target selecting asynchronous transfer,
-# otherwise just ignore it since we have no clue what it pertains to.
-#
-# XXX - I don't have a device that responds this way. Does this code
-# actually work?
-#
-p_mesgin6:
- cmp A,7 jne p_mesgin7 # message reject code?
-
- and FUNCTION1,0x70,SCSIID # outstanding SDTR message?
- mov A,FUNCTION1
-
- test SBLKCTL,0x08 jnz p_mesgin6_b
- test SCSIID,0x80 jnz p_mesgin6_b
- test NEEDSDTR_A,A jz p_mesgin_done # no - ignore rejection
- call ndx_sdtr # note use of asynch xfer
- mov DINDEX,SINDEX
- clr DINDIR
-
- not A
- and NEEDSDTR_A,A
- jmp p_mesgin6_done
-
-p_mesgin6_b:
- test NEEDSDTR_B,A jz p_mesgin_done # no - ignore rejection
- call ndx_sdtr # note use of asynch xfer
- mov DINDEX,SINDEX
- clr DINDIR
-
- not A
- and NEEDSDTR_B,A
-
-p_mesgin6_done:
-
- clr SCSIRATE # select asynch xfer
- jmp p_mesgin_done
-
-# [ ADD MORE MESSAGE HANDLING HERE ]
-#
-p_mesgin7:
-
-# We have no idea what this message in is, and there's no way
-# to pass it up to the kernel, so we issue a message reject and
-# hope for the best. Since we're now using manual PIO mode to
-# read in the message, there should no longer be a race condition
-# present when we assert ATN. In any case, rejection should be a
-# rare occurrence - signal the driver when it happens.
-#
-p_mesginN:
- or SINDEX,0x10,SIGSTATE # turn on ATNO
- call scsisig
- mvi INTSTAT,SIGNAL_1 # let driver know
-
- mvi 0x7 call mk_mesg # MESSAGE REJECT message
-
-p_mesgin_done:
- call inb_last # ack & turn auto PIO back on
- jmp ITloop
-
-# Bus free phase. It might be useful to interrupt the device
-# driver if we aren't expecting this. For now, make sure that
-# ATN isn't being asserted and look for a new command.
-#
-p_busfree:
- mvi CLRSINT1,0x40 # CLRATNO
- clr SIGSTATE
- jmp start
-
-# Bcopy: number of bytes to transfer should be in A, DINDEX should
-# contain the destination address, and SINDEX should contain the
-# source address. All input parameters are trashed on return.
-#
-bcopy:
- mov DINDIR,SINDIR
- dec A
- cmp ALLZEROS,A jne bcopy
- ret
-
-# Locking the driver out, build a one-byte message passed in SINDEX
-# if there is no active message already. SINDEX is returned intact.
-#
-mk_mesg:
- mvi SEQCTL,0x50 # PAUSEDIS|FASTMODE
- test MSG_FLAGS,0x80 jnz mk_mesg1 # active message?
-
- mvi MSG_FLAGS,0x80 # if not, there is now
- mvi MSG_LEN,1 # length = 1
- mov MSG_START+0,SINDEX # 1-byte message
-
-mk_mesg1:
- mvi SEQCTL,0x10 # !PAUSEDIS|FASTMODE
- ret
-
-# Input byte in Automatic PIO mode. The address to store the byte
-# in should be in SINDEX. DINDEX will be used by this routine.
-#
-inb:
- test SSTAT0,0x2 jz inb # SPIORDY
- mov DINDEX,SINDEX
- call one_stcnt # xfer one byte
- mov DINDIR,SCSIDATL
-inb1:
- test SSTAT0,0x4 jz inb1 # SDONE - wait to "finish"
- ret
-
-# Carefully read data in Automatic PIO mode. I first tried this using
-# Manual PIO mode, but it gave me continual underrun errors, probably
-# indicating that I did something wrong, but I feel more secure leaving
-# Automatic PIO on all the time.
-#
-# According to Adaptec's documentation, an ACK is not sent on input from
-# the target until SCSIDATL is read from. So we wait until SCSIDATL is
-# latched (the usual way), then read the data byte directly off the bus
-# using SCSIBUSL. When we have pulled the ATN line, or we just want to
-# acknowledge the byte, then we do a dummy read from SCISDATL. The SCSI
-# spec guarantees that the target will hold the data byte on the bus until
-# we send our ACK.
-#
-# The assumption here is that these are called in a particular sequence,
-# and that REQ is already set when inb_first is called. inb_{first,next}
-# use the same calling convention as inb.
-#
-inb_first:
- mov DINDEX,SINDEX
- mov DINDIR,SCSIBUSL ret # read byte directly from bus
-
-inb_next:
- mov DINDEX,SINDEX # save SINDEX
-
- call one_stcnt # xfer one byte
- mov NONE,SCSIDATL # dummy read from latch to ACK
-inb_next1:
- test SSTAT0,0x4 jz inb_next1 # SDONE
-inb_next2:
- test SSTAT0,0x2 jz inb_next2 # SPIORDY - wait for next byte
- mov DINDIR,SCSIBUSL ret # read byte directly from bus
-
-inb_last:
- call one_stcnt # ACK with dummy read
- mov NONE,SCSIDATL
-inb_last1:
- test SSTAT0,0x4 jz inb_last1 # wait for completion
- ret
-
-# Output byte in Automatic PIO mode. The byte to output should be
-# in SINDEX. If DROPATN's high bit is set, then ATN will be dropped
-# before the byte is output.
-#
-outb:
- test SSTAT0,0x2 jz outb # SPIORDY
- call one_stcnt # xfer one byte
-
- test DROPATN,0x80 jz outb1
- mvi CLRSINT1,0x40 # CLRATNO
- clr DROPATN
-outb1:
- mov SCSIDATL,SINDEX
-outb2:
- test SSTAT0,0x4 jz outb2 # SDONE
- ret
-
-# Write the value "1" into the STCNT registers, for Automatic PIO
-# transfers.
-#
-one_stcnt:
- clr STCNT+2
- clr STCNT+1
- mvi STCNT+0,1 ret
-
-# DMA data transfer. HADDR and HCNT must be loaded first, and
-# SINDEX should contain the value to load DFCNTRL with - 0x3d for
-# host->scsi, or 0x39 for scsi->host. The SCSI channel is cleared
-# during initialization.
-#
-dma:
- mov DFCNTRL,SINDEX
-dma1:
-dma2:
- test SSTAT0,0x1 jnz dma3 # DMADONE
- test SSTAT1,0x10 jz dma1 # PHASEMIS, ie. underrun
-
-# We will be "done" DMAing when the transfer count goes to zero, or
-# the target changes the phase (in light of this, it makes sense that
-# the DMA circuitry doesn't ACK when PHASEMIS is active). If we are
-# doing a SCSI->Host transfer, the data FIFO should be flushed auto-
-# magically on STCNT=0 or a phase change, so just wait for FIFO empty
-# status.
-#
-dma3:
- test SINDEX,0x4 jnz dma5 # DIRECTION
-dma4:
- test DFSTATUS,0x1 jz dma4 # FIFOEMP
-
-# Now shut the DMA enables off, and copy STCNT (ie. the underrun
-# amount, if any) to the SCB registers; SG_COUNT will get copied to
-# the SCB's residual S/G count field after sg_advance is called. Make
-# sure that the DMA enables are actually off first lest we get an ILLSADDR.
-#
-dma5:
- clr DFCNTRL # disable DMA
-dma6:
- test DFCNTRL,0x38 jnz dma6 # SCSIENACK|SDMAENACK|HDMAENACK
-
- mvi A,3
- mvi DINDEX,SCBARRAY+15
- mvi STCNT call bcopy
-
- ret
-
-# Common SCSI initialization for selection and reselection. Expects
-# the target SCSI ID to be in the upper four bits of SINDEX, and A's
-# contents are stomped on return.
-#
-initialize:
- and SCSIID,0xf0,SINDEX # target ID
- test SBLKCTL,0x08 jnz initialize_b
- mvi SINDEX,SCSICONF_A
- test FLAGS,WIDE_BUS jnz initialize_wide
- and A,0x7,SCSICONF_A # SCSI_ID_A[210]
- jmp initialize_2
-initialize_b:
- and A,0x7,SCSICONF_B # SCSI_ID_B[210]
- mvi SCSICONF_B jmp initialize_2
-
-initialize_wide:
- and A, 0xf,SCSICONF_B
-
-initialize_2:
- or SCSIID,A
-
-# Esundry initialization.
-#
- clr DROPATN
- clr SIGSTATE
-
-# Turn on Automatic PIO mode now, before we expect to see an REQ
-# from the target. It shouldn't hurt anything to leave it on. Set
-# CLRCHN here before the target has entered a data transfer mode -
-# with synchronous SCSI, if you do it later, you blow away some
-# data in the SCSI FIFO that the target has already sent to you.
-#
-# DFON is a 7870 bit enabling digital filtering of REQ and ACK signals.
-#
- mvi SXFRCTL0,0x8a # DFON|SPIOEN|CLRCHN
-
-# Set SCSI bus parity checking and the selection timeout value,
-# and enable the hardware selection timer. Set the SELTO interrupt
-# to signal the driver.
-#
-# STPWEN is 7870-specific, enabling an external termination power source.
-#
- and A,0x38,SINDIR # PARITY_ENB|SEL_TIM[10]
- or SXFRCTL1,0x7,A # ENSTIMER|ACTNEGEN|STPWEN
- mvi SIMODE1,0x84 # ENSELTIMO|ENSCSIPERR
-
-# Initialize scatter-gather pointers by setting up the working copy
-# in scratch RAM.
-#
- call sg_scb2ram
-
-# Initialize SCSIRATE with the appropriate value for this target.
-#
- call ndx_sdtr
- mov SCSIRATE,SINDIR
- ret
-
-# Assert that if we've been reselected, then we've seen an IDENTIFY
-# message.
-#
-assert:
- test RESELECT,0x80 jz assert1 # reselected?
- test RESELECT,0x40 jnz assert1 # seen IDENTIFY?
-
- mvi INTSTAT,SIGNAL_2 # no - cause a kernel panic
-
-assert1:
- ret
-
-# Find out if disconnection is ok from the information the BIOS has left
-# us. The tcl from SCBARRAY+1 should be in SINDEX; A will
-# contain either 0x40 (disconnection ok) or 0x00 (disconnection not ok)
-# on exit.
-#
-# To allow for wide or twin busses, we check the upper bit of the target ID
-# and the channel ID and look at the appropriate disconnect register.
-#
-disconnect:
- and FUNCTION1,0x70,SINDEX # strip off extra just in case
- mov A,FUNCTION1
- test SINDEX, 0x88 jz disconnect_a
-
- test DISC_DSB_B,A jz disconnect1 # bit nonzero if DISabled
- clr A ret
-
-disconnect_a:
- test DISC_DSB_A,A jz disconnect1 # bit nonzero if DISabled
- clr A ret
-
-disconnect1:
- mvi A,0x40 ret
-
-# Locate the SCB matching the target ID in SELID and the lun in the lower
-# three bits of SINDEX, and switch the SCB to it. Have the kernel print
-# a warning message if it can't be found, and generate an ABORT message
-# to the target. We keep the value of the t/c/l that we are trying to find
-# in DINDEX so it is not overwritten during our check to see if we are
-# at the last SCB.
-#
-findSCB:
- and A,0x7,SINDEX # lun in lower three bits
- or DINDEX,A,SELID
- and DINDEX,0xf7
- and A,0x08,SBLKCTL # B Channel??
- or DINDEX,A
- clr SINDEX
-
-findSCB1:
- mov A,DINDEX
- mov SCBPTR,SINDEX # switch to new SCB
- cmp SCBARRAY+1,A jne findSCB2 # target ID/channel/lun match?
- test SCBARRAY+0,0x4 jz findSCB2 # should be disconnected
- ret
-
-findSCB2:
- inc SINDEX
- mov A,SCBCOUNT
- cmp SINDEX,A jne findSCB1
-
- mvi INTSTAT,SIGNAL_3 # not found - signal kernel
- mvi 0x6 call mk_mesg # ABORT message
-
- or SINDEX,0x10,SIGSTATE # assert ATNO
- call scsisig
- ret
-
-# Make a working copy of the scatter-gather parameters in the SCB.
-#
-sg_scb2ram:
- mov SG_COUNT,SCBARRAY+2
-
- mvi A,4
- mvi DINDEX,SG_NEXT
- mvi SCBARRAY+3 call bcopy
-
- mvi SG_NOLOAD,0x80
- test SCBARRAY+0,0x10 jnz sg_scb2ram1 # don't reload s/g?
- clr SG_NOLOAD
-
-sg_scb2ram1:
- ret
-
-# Copying RAM values back to SCB, for Save Data Pointers message.
-#
-sg_ram2scb:
- mov SCBARRAY+2,SG_COUNT
-
- mvi A,4
- mvi DINDEX,SCBARRAY+3
- mvi SG_NEXT call bcopy
-
- and SCBARRAY+0,0xef,SCBARRAY+0
- test SG_NOLOAD,0x80 jz sg_ram2scb1 # reload s/g?
- or SCBARRAY+0,0x10
-
-sg_ram2scb1:
- ret
-
-# Load a struct scatter if needed and set up the data address and
-# length. If the working value of the SG count is nonzero, then
-# we need to load a new set of values.
-#
-# This, like the above DMA, assumes a little-endian host data storage.
-#
-sg_load:
- test SG_COUNT,0xff jz sg_load3 # SG being used?
- test SG_NOLOAD,0x80 jnz sg_load3 # don't reload s/g?
-
- clr HCNT+2
- clr HCNT+1
- mvi HCNT+0,SG_SIZEOF
-
- mvi A,4
- mvi DINDEX,HADDR
- mvi SG_NEXT call bcopy
-
- mvi DFCNTRL,0xd # HDMAEN|DIRECTION|FIFORESET
-
-# Wait for DMA from host memory to data FIFO to complete, then disable
-# DMA and wait for it to acknowledge that it's off.
-#
-sg_load1:
- test DFSTATUS,0x8 jz sg_load1 # HDONE
-
- clr DFCNTRL # disable DMA
-sg_load2:
- test DFCNTRL,0x8 jnz sg_load2 # HDMAENACK
-
-# Copy data from FIFO into SCB data pointer and data count. This assumes
-# that the struct scatterlist has this structure (this and sizeof(struct
-# scatterlist) == 12 are asserted in aic7xxx.c):
-#
-# struct scatterlist {
-# char *address; /* four bytes, little-endian order */
-# ... /* four bytes, ignored */
-# unsigned short length; /* two bytes, little-endian order */
-# }
-#
-
-# Not in FreeBSD. the scatter list is only 8 bytes.
-#
-# struct ahc_dma_seg {
-# physaddr addr; /* four bytes, little-endian order */
-# long len; /* four bytes, little endian order */
-# };
-#
-
- mov SCBARRAY+19,DFDAT # new data address
- mov SCBARRAY+20,DFDAT
- mov SCBARRAY+21,DFDAT
- mov SCBARRAY+22,DFDAT
-
- mov SCBARRAY+23,DFDAT
- mov SCBARRAY+24,DFDAT
- mov SCBARRAY+25,DFDAT
- mov NONE,DFDAT #Only support 24 bit length.
-
-sg_load3:
- ret
-
-# Advance the scatter-gather pointers only IF NEEDED. If SG is enabled,
-# and the SCSI transfer count is zero (note that this should be called
-# right after a DMA finishes), then move the working copies of the SG
-# pointer/length along. If the SCSI transfer count is not zero, then
-# presumably the target is disconnecting - do not reload the SG values
-# next time.
-#
-sg_advance:
- test SG_COUNT,0xff jz sg_advance2 # s/g enabled?
-
- test STCNT+0,0xff jnz sg_advance1 # SCSI transfer count nonzero?
- test STCNT+1,0xff jnz sg_advance1
- test STCNT+2,0xff jnz sg_advance1
-
- clr SG_NOLOAD # reload s/g next time
- dec SG_COUNT # one less segment to go
-
- clr A # add sizeof(struct scatter)
- add SG_NEXT+0,SG_SIZEOF,SG_NEXT+0
- adc SG_NEXT+1,A,SG_NEXT+1
- adc SG_NEXT+2,A,SG_NEXT+2
- adc SG_NEXT+3,A,SG_NEXT+3
-
- ret
-
-sg_advance1:
- mvi SG_NOLOAD,0x80 # don't reload s/g next time
-sg_advance2:
- ret
-
-# Add the array base SYNCNEG to the target offset (the target address
-# is in SCSIID), and return the result in SINDEX. The accumulator
-# contains the 3->8 decoding of the target ID on return.
-#
-ndx_sdtr:
- shr A,SCSIID,4
- test SBLKCTL,0x08 jz ndx_sdtr_2
- or A,0x08 # Channel B entries add 8
-ndx_sdtr_2:
- add SINDEX,SYNCNEG,A
-
- and FUNCTION1,0x70,SCSIID # 3-bit target address decode
- mov A,FUNCTION1 ret
-
-# If we need to negotiate transfer parameters, build the SDTR message
-# starting at the address passed in SINDEX. DINDEX is modified on return.
-#
-mk_sdtr:
- mov DINDEX,SINDEX # save SINDEX
-
- call ndx_sdtr
- test SCBARRAY+1,0x88 jz mk_sdtr1_a
- test NEEDSDTR_B,A jnz mk_sdtr1 # do we need negotiation?
- ret
-mk_sdtr1_a:
- test NEEDSDTR_A,A jnz mk_sdtr1 # do we need negotiation?
- ret
-
-mk_sdtr1:
- mvi DINDIR,1 # extended message
- mvi DINDIR,3 # extended message length = 3
- mvi DINDIR,1 # SDTR code
- mvi DINDIR,25 # REQ/ACK transfer period
- mvi DINDIR,15 # REQ/ACK offset
-
- add MSG_LEN,-MSG_START+0,DINDEX # update message length
- ret
-
-# Set SCSI bus control signal state. This also saves the last-written
-# value into a location where the higher-level driver can read it - if
-# it has to send an ABORT or RESET message, then it needs to know this
-# so it can assert ATN without upsetting SCSISIGO. The new value is
-# expected in SINDEX. Change the actual state last to avoid contention
-# from the driver.
-#
-scsisig:
- mov SIGSTATE,SINDEX
- mov SCSISIGO,SINDEX ret
diff --git a/sys/gnu/misc/aic7770/aic7770_seq.h b/sys/gnu/misc/aic7770/aic7770_seq.h
deleted file mode 100644
index 24fa91b..0000000
--- a/sys/gnu/misc/aic7770/aic7770_seq.h
+++ /dev/null
@@ -1,351 +0,0 @@
-#define AIC7XXX_SEQ_VERSION "1.31"
- 0x04, 0x03, 0x18, 0x1a,
- 0x1f, 0x9c, 0x00, 0x1e,
- 0xff, 0x9b, 0x90, 0x02,
- 0x70, 0xa1, 0x6e, 0x02,
- 0xff, 0x6e, 0x64, 0x02,
- 0x00, 0x57, 0x08, 0x1e,
- 0xff, 0x90, 0x9b, 0x02,
- 0x00, 0x65, 0x00, 0x10,
- 0x00, 0x57, 0x57, 0x00,
- 0x00, 0xa1, 0xf1, 0x16,
- 0xff, 0x6a, 0x50, 0x02,
- 0xff, 0x6a, 0x34, 0x02,
- 0x00, 0xa1, 0x03, 0x17,
- 0x07, 0xa1, 0x65, 0x02,
- 0x00, 0x65, 0x65, 0x00,
- 0x80, 0x65, 0xc2, 0x16,
- 0xff, 0x65, 0x64, 0x02,
- 0x00, 0x37, 0x13, 0x18,
- 0x38, 0x6a, 0x51, 0x17,
- 0x48, 0x6a, 0x00, 0x00,
- 0x40, 0x0b, 0x1c, 0x1a,
- 0x10, 0x0b, 0x14, 0x1e,
- 0x40, 0x0b, 0x16, 0x1e,
- 0x00, 0x65, 0x1c, 0x10,
- 0x10, 0x6a, 0x00, 0x00,
- 0x20, 0x0b, 0x19, 0x1e,
- 0x00, 0x19, 0xf1, 0x16,
- 0x80, 0x6a, 0x34, 0x00,
- 0xff, 0x6a, 0x00, 0x02,
- 0x08, 0x6a, 0x0c, 0x00,
- 0x08, 0x0c, 0xbb, 0x1a,
- 0x01, 0x0c, 0x1e, 0x1e,
- 0xe0, 0x03, 0x64, 0x02,
- 0x00, 0x6a, 0x28, 0x1c,
- 0x40, 0x64, 0x3e, 0x1c,
- 0x80, 0x64, 0x54, 0x1c,
- 0xc0, 0x64, 0x61, 0x1c,
- 0xa0, 0x64, 0x64, 0x1c,
- 0xe0, 0x64, 0x7c, 0x1c,
- 0x01, 0x6a, 0x91, 0x00,
- 0x00, 0x6a, 0x5c, 0x17,
- 0x00, 0x65, 0xff, 0x16,
- 0x00, 0x65, 0x29, 0x17,
- 0x03, 0x6a, 0x64, 0x00,
- 0x8c, 0x6a, 0x66, 0x00,
- 0xb7, 0x6a, 0xbe, 0x16,
- 0x03, 0x6a, 0x64, 0x00,
- 0x08, 0x6a, 0x66, 0x00,
- 0xb7, 0x6a, 0xbe, 0x16,
- 0x04, 0x6a, 0x64, 0x00,
- 0x88, 0x6a, 0x66, 0x00,
- 0xb3, 0x6a, 0xbe, 0x16,
- 0x3d, 0x6a, 0xe6, 0x16,
- 0x03, 0x6a, 0x64, 0x00,
- 0xb7, 0x6a, 0x66, 0x00,
- 0x08, 0x6a, 0xbe, 0x16,
- 0x04, 0x6a, 0x64, 0x00,
- 0xb3, 0x6a, 0x66, 0x00,
- 0x14, 0x6a, 0xbe, 0x16,
- 0x00, 0x65, 0x3e, 0x17,
- 0xff, 0x51, 0xb2, 0x02,
- 0x00, 0x65, 0x1e, 0x10,
- 0x40, 0x6a, 0x5c, 0x17,
- 0x00, 0x65, 0xff, 0x16,
- 0x00, 0x65, 0x29, 0x17,
- 0x03, 0x6a, 0x64, 0x00,
- 0x8c, 0x6a, 0x66, 0x00,
- 0xb7, 0x6a, 0xbe, 0x16,
- 0x03, 0x6a, 0x64, 0x00,
- 0x08, 0x6a, 0x66, 0x00,
- 0xb7, 0x6a, 0xbe, 0x16,
- 0x04, 0x6a, 0x64, 0x00,
- 0x88, 0x6a, 0x66, 0x00,
- 0xb3, 0x6a, 0xbe, 0x16,
- 0x39, 0x6a, 0xe6, 0x16,
- 0x03, 0x6a, 0x64, 0x00,
- 0xb7, 0x6a, 0x66, 0x00,
- 0x08, 0x6a, 0xbe, 0x16,
- 0x04, 0x6a, 0x64, 0x00,
- 0xb3, 0x6a, 0x66, 0x00,
- 0x14, 0x6a, 0xbe, 0x16,
- 0x00, 0x65, 0x3e, 0x17,
- 0xff, 0x51, 0xb2, 0x02,
- 0x00, 0x65, 0x1e, 0x10,
- 0x80, 0x6a, 0x5c, 0x17,
- 0x00, 0x65, 0xff, 0x16,
- 0x03, 0x6a, 0x64, 0x00,
- 0x8c, 0x6a, 0x66, 0x00,
- 0xab, 0x6a, 0xbe, 0x16,
- 0x03, 0x6a, 0x64, 0x00,
- 0x08, 0x6a, 0x66, 0x00,
- 0xab, 0x6a, 0xbe, 0x16,
- 0x04, 0x6a, 0x64, 0x00,
- 0x88, 0x6a, 0x66, 0x00,
- 0xa7, 0x6a, 0xbe, 0x16,
- 0x3d, 0x6a, 0xe6, 0x16,
- 0x00, 0x65, 0x1e, 0x10,
- 0xc0, 0x6a, 0x5c, 0x17,
- 0xae, 0x6a, 0xc9, 0x16,
- 0x00, 0x65, 0x1e, 0x10,
- 0xa0, 0x6a, 0x5c, 0x17,
- 0x08, 0x6a, 0xc2, 0x16,
- 0x37, 0x6a, 0x65, 0x00,
- 0xff, 0x36, 0x66, 0x02,
- 0xff, 0x6a, 0x64, 0x02,
- 0x02, 0x0b, 0x69, 0x1e,
- 0x10, 0x0c, 0x79, 0x1a,
- 0x01, 0x66, 0x6d, 0x18,
- 0x40, 0x6a, 0x0c, 0x00,
- 0x00, 0x65, 0xe3, 0x16,
- 0xff, 0x6c, 0x06, 0x02,
- 0x04, 0x0b, 0x6f, 0x1e,
- 0xff, 0x66, 0x66, 0x06,
- 0x01, 0x64, 0x64, 0x06,
- 0x00, 0x36, 0x69, 0x18,
- 0x08, 0x0c, 0x79, 0x1a,
- 0x01, 0x0c, 0x73, 0x1e,
- 0xe0, 0x03, 0x64, 0x02,
- 0xa0, 0x64, 0x79, 0x18,
- 0x10, 0x6a, 0x5c, 0x17,
- 0x00, 0x65, 0x1e, 0x10,
- 0x40, 0x6a, 0x0c, 0x00,
- 0xff, 0x6a, 0x35, 0x02,
- 0x00, 0x65, 0x1e, 0x10,
- 0xe0, 0x6a, 0x5c, 0x17,
- 0x64, 0x6a, 0xcf, 0x16,
- 0x00, 0x6a, 0x31, 0x00,
- 0x00, 0x6a, 0x8a, 0x18,
- 0x70, 0xa1, 0x6e, 0x02,
- 0xff, 0x6e, 0x64, 0x02,
- 0x00, 0x57, 0x57, 0x04,
- 0xff, 0xae, 0x87, 0x1e,
- 0x00, 0x65, 0xd7, 0x16,
- 0x51, 0x6a, 0x91, 0x00,
- 0x00, 0x65, 0x1e, 0x10,
- 0xff, 0x90, 0x9d, 0x02,
- 0x02, 0x6a, 0x91, 0x00,
- 0x00, 0x65, 0xb9, 0x10,
- 0x01, 0x64, 0x99, 0x18,
- 0x64, 0x6a, 0xd1, 0x16,
- 0x03, 0x64, 0xb5, 0x18,
- 0x64, 0x6a, 0xd1, 0x16,
- 0x01, 0x64, 0xb5, 0x18,
- 0x4c, 0x6a, 0xd1, 0x16,
- 0x4d, 0x6a, 0xd1, 0x16,
- 0x41, 0x6a, 0x91, 0x00,
- 0x00, 0x65, 0x4c, 0x17,
- 0xff, 0x65, 0x66, 0x02,
- 0xff, 0x4c, 0x6d, 0x02,
- 0xff, 0x64, 0x64, 0x04,
- 0x00, 0x4f, 0x4f, 0x02,
- 0xff, 0x4c, 0x04, 0x02,
- 0x00, 0x65, 0xb9, 0x10,
- 0x04, 0x64, 0x9c, 0x18,
- 0x04, 0xa0, 0xa0, 0x00,
- 0x00, 0x65, 0xb9, 0x10,
- 0x02, 0x64, 0x9f, 0x18,
- 0x00, 0x65, 0x21, 0x17,
- 0x00, 0x65, 0xb9, 0x10,
- 0x03, 0x64, 0xa2, 0x18,
- 0x00, 0x65, 0x19, 0x17,
- 0x00, 0x65, 0xb9, 0x10,
- 0x80, 0x64, 0xaa, 0x1e,
- 0x78, 0x64, 0xb5, 0x1a,
- 0x00, 0x64, 0x08, 0x17,
- 0x80, 0x35, 0xb9, 0x1a,
- 0x04, 0xa0, 0xa0, 0x04,
- 0xc0, 0x6a, 0x34, 0x00,
- 0x00, 0x65, 0x19, 0x17,
- 0x00, 0x65, 0xb9, 0x10,
- 0x07, 0x64, 0xb5, 0x18,
- 0x70, 0x05, 0x6e, 0x02,
- 0xff, 0x6e, 0x64, 0x02,
- 0x00, 0x4f, 0xb9, 0x1e,
- 0x00, 0x65, 0x4c, 0x17,
- 0xff, 0x65, 0x66, 0x02,
- 0xff, 0x6a, 0x6d, 0x02,
- 0xff, 0x64, 0x64, 0x04,
- 0x00, 0x4f, 0x4f, 0x02,
- 0xff, 0x6a, 0x04, 0x02,
- 0x00, 0x65, 0xb9, 0x10,
- 0x10, 0x4e, 0x65, 0x00,
- 0x00, 0x65, 0x5c, 0x17,
- 0x11, 0x6a, 0x91, 0x00,
- 0x07, 0x6a, 0xc2, 0x16,
- 0x00, 0x65, 0xd7, 0x16,
- 0x00, 0x65, 0x1e, 0x10,
- 0x40, 0x6a, 0x0c, 0x00,
- 0xff, 0x6a, 0x4e, 0x02,
- 0x00, 0x65, 0x00, 0x10,
- 0xff, 0x6c, 0x6d, 0x02,
- 0xff, 0x64, 0x64, 0x06,
- 0x00, 0x6a, 0xbe, 0x18,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x50, 0x6a, 0x60, 0x00,
- 0x80, 0x35, 0xc7, 0x1a,
- 0x80, 0x6a, 0x35, 0x00,
- 0x01, 0x6a, 0x36, 0x00,
- 0xff, 0x65, 0x37, 0x02,
- 0x10, 0x6a, 0x60, 0x00,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x02, 0x0b, 0xc9, 0x1e,
- 0xff, 0x65, 0x66, 0x02,
- 0x00, 0x65, 0xe3, 0x16,
- 0xff, 0x06, 0x6d, 0x02,
- 0x04, 0x0b, 0xcd, 0x1e,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x65, 0x66, 0x02,
- 0xff, 0x12, 0x6d, 0x03,
- 0xff, 0x65, 0x66, 0x02,
- 0x00, 0x65, 0xe3, 0x16,
- 0xff, 0x06, 0x6a, 0x02,
- 0x04, 0x0b, 0xd4, 0x1e,
- 0x02, 0x0b, 0xd5, 0x1e,
- 0xff, 0x12, 0x6d, 0x03,
- 0x00, 0x65, 0xe3, 0x16,
- 0xff, 0x06, 0x6a, 0x02,
- 0x04, 0x0b, 0xd9, 0x1e,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x02, 0x0b, 0xdb, 0x1e,
- 0x00, 0x65, 0xe3, 0x16,
- 0x80, 0x30, 0xe0, 0x1e,
- 0x40, 0x6a, 0x0c, 0x00,
- 0xff, 0x6a, 0x30, 0x02,
- 0xff, 0x65, 0x06, 0x02,
- 0x04, 0x0b, 0xe1, 0x1e,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x6a, 0x0a, 0x02,
- 0xff, 0x6a, 0x09, 0x02,
- 0x01, 0x6a, 0x08, 0x01,
- 0xff, 0x65, 0x93, 0x02,
- 0x01, 0x0b, 0xe9, 0x1a,
- 0x10, 0x0c, 0xe7, 0x1e,
- 0x04, 0x65, 0xeb, 0x1a,
- 0x01, 0x94, 0xea, 0x1e,
- 0xff, 0x6a, 0x93, 0x02,
- 0x38, 0x93, 0xec, 0x1a,
- 0x03, 0x6a, 0x64, 0x00,
- 0xaf, 0x6a, 0x66, 0x00,
- 0x08, 0x6a, 0xbe, 0x16,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x6a, 0x1f, 0x02,
- 0xf0, 0x65, 0x05, 0x02,
- 0x07, 0x5a, 0x64, 0x02,
- 0x00, 0x05, 0x05, 0x00,
- 0xff, 0x6a, 0x30, 0x02,
- 0xff, 0x6a, 0x4e, 0x02,
- 0x8a, 0x6a, 0x01, 0x00,
- 0x38, 0x5a, 0x64, 0x02,
- 0x05, 0x64, 0x02, 0x00,
- 0x84, 0x6a, 0x11, 0x00,
- 0x00, 0x65, 0x19, 0x17,
- 0x00, 0x65, 0x4c, 0x17,
- 0xff, 0x6c, 0x04, 0x02,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x80, 0x34, 0x02, 0x1f,
- 0x40, 0x34, 0x02, 0x1b,
- 0x21, 0x6a, 0x91, 0x00,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x70, 0x65, 0x6e, 0x02,
- 0xff, 0x6e, 0x64, 0x02,
- 0x00, 0x32, 0x07, 0x1f,
- 0xff, 0x6a, 0x64, 0x03,
- 0x40, 0x6a, 0x64, 0x01,
- 0x07, 0x65, 0x64, 0x02,
- 0x00, 0x19, 0x66, 0x00,
- 0xf7, 0x66, 0x66, 0x02,
- 0xff, 0x6a, 0x65, 0x02,
- 0xff, 0x66, 0x64, 0x02,
- 0xff, 0x65, 0x90, 0x02,
- 0x00, 0xa1, 0x11, 0x19,
- 0x04, 0xa0, 0x11, 0x1f,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x01, 0x65, 0x65, 0x06,
- 0xff, 0x56, 0x64, 0x02,
- 0x00, 0x65, 0x0c, 0x19,
- 0x31, 0x6a, 0x91, 0x00,
- 0x06, 0x6a, 0xc2, 0x16,
- 0x10, 0x4e, 0x65, 0x00,
- 0x00, 0x65, 0x5c, 0x17,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0xa2, 0x51, 0x02,
- 0x04, 0x6a, 0x64, 0x00,
- 0x52, 0x6a, 0x66, 0x00,
- 0xa3, 0x6a, 0xbe, 0x16,
- 0x80, 0x6a, 0x50, 0x00,
- 0x10, 0xa0, 0x20, 0x1b,
- 0xff, 0x6a, 0x50, 0x02,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x51, 0xa2, 0x02,
- 0x04, 0x6a, 0x64, 0x00,
- 0xa3, 0x6a, 0x66, 0x00,
- 0x52, 0x6a, 0xbe, 0x16,
- 0xef, 0xa0, 0xa0, 0x02,
- 0x80, 0x50, 0x28, 0x1f,
- 0x10, 0xa0, 0xa0, 0x00,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x51, 0x3d, 0x1f,
- 0x80, 0x50, 0x3d, 0x1b,
- 0xff, 0x6a, 0x8e, 0x02,
- 0xff, 0x6a, 0x8d, 0x02,
- 0x08, 0x6a, 0x8c, 0x00,
- 0x04, 0x6a, 0x64, 0x00,
- 0x88, 0x6a, 0x66, 0x00,
- 0x52, 0x6a, 0xbe, 0x16,
- 0x0d, 0x6a, 0x93, 0x00,
- 0x08, 0x94, 0x32, 0x1f,
- 0xff, 0x6a, 0x93, 0x02,
- 0x08, 0x93, 0x34, 0x1b,
- 0xff, 0x99, 0xb3, 0x02,
- 0xff, 0x99, 0xb4, 0x02,
- 0xff, 0x99, 0xb5, 0x02,
- 0xff, 0x99, 0xb6, 0x02,
- 0xff, 0x99, 0xb7, 0x02,
- 0xff, 0x99, 0xb8, 0x02,
- 0xff, 0x99, 0xb9, 0x02,
- 0xff, 0x99, 0x6a, 0x02,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x51, 0x4b, 0x1f,
- 0xff, 0x08, 0x4a, 0x1b,
- 0xff, 0x09, 0x4a, 0x1b,
- 0xff, 0x0a, 0x4a, 0x1b,
- 0xff, 0x6a, 0x50, 0x02,
- 0xff, 0x51, 0x51, 0x06,
- 0xff, 0x6a, 0x64, 0x02,
- 0x08, 0x52, 0x52, 0x06,
- 0x00, 0x53, 0x53, 0x08,
- 0x00, 0x54, 0x54, 0x08,
- 0x00, 0x55, 0x55, 0x08,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x80, 0x6a, 0x50, 0x00,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x4c, 0x05, 0x64, 0x0a,
- 0x07, 0x64, 0x64, 0x02,
- 0x20, 0x64, 0x65, 0x06,
- 0x70, 0x05, 0x6e, 0x02,
- 0xff, 0x6e, 0x64, 0x03,
- 0xff, 0x65, 0x66, 0x02,
- 0x00, 0x65, 0x4c, 0x17,
- 0x00, 0x4f, 0x55, 0x1b,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x01, 0x6a, 0x6d, 0x00,
- 0x03, 0x6a, 0x6d, 0x00,
- 0x01, 0x6a, 0x6d, 0x00,
- 0x19, 0x6a, 0x6d, 0x00,
- 0x0f, 0x6a, 0x6d, 0x00,
- 0xc9, 0x66, 0x36, 0x06,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x65, 0x4e, 0x02,
- 0xff, 0x65, 0x03, 0x03,
diff --git a/sys/gnu/misc/aic7xxx/COPYING b/sys/gnu/misc/aic7xxx/COPYING
deleted file mode 100644
index a43ea21..0000000
--- a/sys/gnu/misc/aic7xxx/COPYING
+++ /dev/null
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 675 Mass Ave, Cambridge, MA 02139, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- Appendix: How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19yy name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/sys/gnu/misc/aic7xxx/COPYRIGHT b/sys/gnu/misc/aic7xxx/COPYRIGHT
deleted file mode 100644
index 905285d..0000000
--- a/sys/gnu/misc/aic7xxx/COPYRIGHT
+++ /dev/null
@@ -1,16 +0,0 @@
-Adaptec 274x device driver for Linux.
-Copyright (c) 1994 The University of Calgary Department of Computer Science.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
diff --git a/sys/gnu/misc/aic7xxx/README b/sys/gnu/misc/aic7xxx/README
deleted file mode 100644
index 1e4e5a0..0000000
--- a/sys/gnu/misc/aic7xxx/README
+++ /dev/null
@@ -1,94 +0,0 @@
-@(#)README 1.16 94/11/09 jda
-
-AHA274x/284x DRIVER
-
-*** THIS SHOULD BE CONSIDERED BETA SOFTWARE ***
-
-BACKGROUND & LIMITATIONS
-
-For various reasons, we ended up with one of these cards under the
-impression that support was soon forthcoming. In mid-May, I asked
-Scott Ferris (the official person who's supposed to be writing this
-driver) what documentation he used, _finally_ got it from Adaptec,
-and started writing this driver. It is now at what I would consider
-a stable state - it runs our news server and is battered by SCSI
-requests 24 hours a day without dying. There are a few devices it
-reportedly doesn't like working with - those are being sorted out. Due
-to some unexpected equipment loans, I am able to support this at least
-for the time being.
-
-YOU MUST HAVE THE BIOS ENABLED OR THIS WILL NOT WORK. The BIOS extracts
-some configuration information that I cannot get to portably yet, as
-well as provides some self-tests which this driver does not attempt to
-duplicate.
-
-Scott's driver development is stalled for now, and after discussions
-with him, this is now officially out of "pre-alpha" status and into
-beta until the remaining device problems can be resolved. The latest
-patches can be obtained via anonymous ftp from ftp.cpsc.ucalgary.ca in
-/pub/systems/linux/aha274x.
-
-It supports both EISA 274x and VL-bus 284x, either single or twin-bus cards
-(but not the second SCSI bus of twin cards - see aha274x.c), and supports
-disconnection, synchronous SCSI, and scatter-gather. Unlike previous
-versions, abort() and reset() are now implemented, and both hosts.c and
-aha274x.c should give a clean compile. Code is now present to detect parity
-errors, but has not been tested.
-
-I wrote this using a 1.0.9 kernel. Unfortunately, I'm getting tired of
-#ifdef'ing everything to handle two or three different evolutionary steps
-in the SCSI kernel code, so I've upgraded my system to 1.1.49, and will
-only leave in code to support versions from about 1.1.45 onward.
-
-Thanks to patches supplied by Mark Olson <molson@tricord.com>, this driver
-will now work with the 284x series (the VL-bus version of this card). The
-294x (PCI-bus) support is based on patches sent to me by Mark Olson and
-Alan Hourihane <alanh@fairlite.demon.co.uk>.
-
-Under protest, this driver is subject to the GPL - see the file
-COPYING for details.
-
-Thanks to the following people for bug fixes/code improvements (also
-thanks to the people who have sent me feedback):
-
- "David F. Carlson" <dave@ee.rochester.edu>
- Jimen Ching <jiching@wiliki.eng.hawaii.edu>
- mday@artisoft.com (Matt Day)
- "Dean W. Gehnert" <deang@ims.com>
- Darcy Grant <darcy@cpsc.ucalgary.ca>
- Alan Hourihane <alanh@fairlite.demon.co.uk>
- isely@fncrd8.fnal.gov (Mike Isely)
- Mike Jerger <jerger@ux1.cso.uiuc.edu>
- tm@netcom.com (Toshiyasu Morita)
- neal@interact.org (Neal Norwitz)
- Mark Olson <molson@tricord.com>
- map@europa.ecn.uoknor.edu (Michael A. Parker)
- Thomas Scheunemann <thomas@dagobert.uni-duisburg.de>
-
-Special thanks to Drew Eckhardt <drew@kinglear.cs.Colorado.EDU> for
-fielding my questions about synchronous negotiation. Steffen Moeller
-<smoe0024@rz.uni-hildesheim.de> sent me installation instructions which
-were previously included in this README.
-
-David Pirie <pirie@cpsc.ucalgary.ca> was nice enough to loan me his
-2842 card for a week so I could track down one bug, as well as his
-CD-ROM drive later, and also thanks to Doug Fortune at Riley's Data Share
-in Calgary, who arranged a long-term loan of a 2842 board for further work.
-
-Many thanks to the fearless prerelease testers! Dean Gehnert has been
-building Slackware boot disks for the driver, which are available from
-ftp.cpsc.ucalgary.ca in /pub/systems/linux/aha274x/slackware_boot.
-
-Carl Riches <cgr@poplar1.cfr.washington.edu> has set up a mailing list
-for aic7xxx driver development. To subscribe, send a message to
-aic7770-list@poplar1.cfr.washington.edu with a message body of:
-
- subscribe AIC7770-LIST <your name here, without the angle brackets>
-
-Please direct questions and discussions to that list instead of me. When
-sending bug reports, please include a description of your hardware, the
-release numbers displayed by the driver at boot time, and as accurate a
-facsimilie of any error message you're mailing about.
-
-John Aycock
-aycock@cpsc.ucalgary.ca
diff --git a/sys/gnu/misc/aic7xxx/README-FIRST b/sys/gnu/misc/aic7xxx/README-FIRST
deleted file mode 100644
index 056dbc8..0000000
--- a/sys/gnu/misc/aic7xxx/README-FIRST
+++ /dev/null
@@ -1,19 +0,0 @@
-This is VERY MUCH ALPHA SOFTWARE. You MUST know what you're doing to
-use this, or else!!!
-
-Ok, everything's been renamed to reference an "aic7xxx" driver instead
-of "aha274x", and a merger of the two PCI patches I had has been put in,
-along with re-doing the detection and configuration routines. To summarize
-the status: it compiles cleanly. I don't expect it to work off the bat,
-but it's for the 294x development people to synchronize their code
-together.
-
-The file scsi-diffs-1.1.59 is NOT a proper patch file, but some diffs
-to kernel files concatenated together. I've sent these off to Drew,
-but if you're testing this you'll have to apply them - it allows a
-per-driver-instance can_queue variable, which for the aic7xxx driver
-is the number of SCBs the card supports.
-
-Good luck! I await your comments.. Mark, Alan - let me know where I
-broke it, please ;-)
-:ja
diff --git a/sys/gnu/misc/aic7xxx/aic7770_seq.h b/sys/gnu/misc/aic7xxx/aic7770_seq.h
deleted file mode 100644
index 24fa91b..0000000
--- a/sys/gnu/misc/aic7xxx/aic7770_seq.h
+++ /dev/null
@@ -1,351 +0,0 @@
-#define AIC7XXX_SEQ_VERSION "1.31"
- 0x04, 0x03, 0x18, 0x1a,
- 0x1f, 0x9c, 0x00, 0x1e,
- 0xff, 0x9b, 0x90, 0x02,
- 0x70, 0xa1, 0x6e, 0x02,
- 0xff, 0x6e, 0x64, 0x02,
- 0x00, 0x57, 0x08, 0x1e,
- 0xff, 0x90, 0x9b, 0x02,
- 0x00, 0x65, 0x00, 0x10,
- 0x00, 0x57, 0x57, 0x00,
- 0x00, 0xa1, 0xf1, 0x16,
- 0xff, 0x6a, 0x50, 0x02,
- 0xff, 0x6a, 0x34, 0x02,
- 0x00, 0xa1, 0x03, 0x17,
- 0x07, 0xa1, 0x65, 0x02,
- 0x00, 0x65, 0x65, 0x00,
- 0x80, 0x65, 0xc2, 0x16,
- 0xff, 0x65, 0x64, 0x02,
- 0x00, 0x37, 0x13, 0x18,
- 0x38, 0x6a, 0x51, 0x17,
- 0x48, 0x6a, 0x00, 0x00,
- 0x40, 0x0b, 0x1c, 0x1a,
- 0x10, 0x0b, 0x14, 0x1e,
- 0x40, 0x0b, 0x16, 0x1e,
- 0x00, 0x65, 0x1c, 0x10,
- 0x10, 0x6a, 0x00, 0x00,
- 0x20, 0x0b, 0x19, 0x1e,
- 0x00, 0x19, 0xf1, 0x16,
- 0x80, 0x6a, 0x34, 0x00,
- 0xff, 0x6a, 0x00, 0x02,
- 0x08, 0x6a, 0x0c, 0x00,
- 0x08, 0x0c, 0xbb, 0x1a,
- 0x01, 0x0c, 0x1e, 0x1e,
- 0xe0, 0x03, 0x64, 0x02,
- 0x00, 0x6a, 0x28, 0x1c,
- 0x40, 0x64, 0x3e, 0x1c,
- 0x80, 0x64, 0x54, 0x1c,
- 0xc0, 0x64, 0x61, 0x1c,
- 0xa0, 0x64, 0x64, 0x1c,
- 0xe0, 0x64, 0x7c, 0x1c,
- 0x01, 0x6a, 0x91, 0x00,
- 0x00, 0x6a, 0x5c, 0x17,
- 0x00, 0x65, 0xff, 0x16,
- 0x00, 0x65, 0x29, 0x17,
- 0x03, 0x6a, 0x64, 0x00,
- 0x8c, 0x6a, 0x66, 0x00,
- 0xb7, 0x6a, 0xbe, 0x16,
- 0x03, 0x6a, 0x64, 0x00,
- 0x08, 0x6a, 0x66, 0x00,
- 0xb7, 0x6a, 0xbe, 0x16,
- 0x04, 0x6a, 0x64, 0x00,
- 0x88, 0x6a, 0x66, 0x00,
- 0xb3, 0x6a, 0xbe, 0x16,
- 0x3d, 0x6a, 0xe6, 0x16,
- 0x03, 0x6a, 0x64, 0x00,
- 0xb7, 0x6a, 0x66, 0x00,
- 0x08, 0x6a, 0xbe, 0x16,
- 0x04, 0x6a, 0x64, 0x00,
- 0xb3, 0x6a, 0x66, 0x00,
- 0x14, 0x6a, 0xbe, 0x16,
- 0x00, 0x65, 0x3e, 0x17,
- 0xff, 0x51, 0xb2, 0x02,
- 0x00, 0x65, 0x1e, 0x10,
- 0x40, 0x6a, 0x5c, 0x17,
- 0x00, 0x65, 0xff, 0x16,
- 0x00, 0x65, 0x29, 0x17,
- 0x03, 0x6a, 0x64, 0x00,
- 0x8c, 0x6a, 0x66, 0x00,
- 0xb7, 0x6a, 0xbe, 0x16,
- 0x03, 0x6a, 0x64, 0x00,
- 0x08, 0x6a, 0x66, 0x00,
- 0xb7, 0x6a, 0xbe, 0x16,
- 0x04, 0x6a, 0x64, 0x00,
- 0x88, 0x6a, 0x66, 0x00,
- 0xb3, 0x6a, 0xbe, 0x16,
- 0x39, 0x6a, 0xe6, 0x16,
- 0x03, 0x6a, 0x64, 0x00,
- 0xb7, 0x6a, 0x66, 0x00,
- 0x08, 0x6a, 0xbe, 0x16,
- 0x04, 0x6a, 0x64, 0x00,
- 0xb3, 0x6a, 0x66, 0x00,
- 0x14, 0x6a, 0xbe, 0x16,
- 0x00, 0x65, 0x3e, 0x17,
- 0xff, 0x51, 0xb2, 0x02,
- 0x00, 0x65, 0x1e, 0x10,
- 0x80, 0x6a, 0x5c, 0x17,
- 0x00, 0x65, 0xff, 0x16,
- 0x03, 0x6a, 0x64, 0x00,
- 0x8c, 0x6a, 0x66, 0x00,
- 0xab, 0x6a, 0xbe, 0x16,
- 0x03, 0x6a, 0x64, 0x00,
- 0x08, 0x6a, 0x66, 0x00,
- 0xab, 0x6a, 0xbe, 0x16,
- 0x04, 0x6a, 0x64, 0x00,
- 0x88, 0x6a, 0x66, 0x00,
- 0xa7, 0x6a, 0xbe, 0x16,
- 0x3d, 0x6a, 0xe6, 0x16,
- 0x00, 0x65, 0x1e, 0x10,
- 0xc0, 0x6a, 0x5c, 0x17,
- 0xae, 0x6a, 0xc9, 0x16,
- 0x00, 0x65, 0x1e, 0x10,
- 0xa0, 0x6a, 0x5c, 0x17,
- 0x08, 0x6a, 0xc2, 0x16,
- 0x37, 0x6a, 0x65, 0x00,
- 0xff, 0x36, 0x66, 0x02,
- 0xff, 0x6a, 0x64, 0x02,
- 0x02, 0x0b, 0x69, 0x1e,
- 0x10, 0x0c, 0x79, 0x1a,
- 0x01, 0x66, 0x6d, 0x18,
- 0x40, 0x6a, 0x0c, 0x00,
- 0x00, 0x65, 0xe3, 0x16,
- 0xff, 0x6c, 0x06, 0x02,
- 0x04, 0x0b, 0x6f, 0x1e,
- 0xff, 0x66, 0x66, 0x06,
- 0x01, 0x64, 0x64, 0x06,
- 0x00, 0x36, 0x69, 0x18,
- 0x08, 0x0c, 0x79, 0x1a,
- 0x01, 0x0c, 0x73, 0x1e,
- 0xe0, 0x03, 0x64, 0x02,
- 0xa0, 0x64, 0x79, 0x18,
- 0x10, 0x6a, 0x5c, 0x17,
- 0x00, 0x65, 0x1e, 0x10,
- 0x40, 0x6a, 0x0c, 0x00,
- 0xff, 0x6a, 0x35, 0x02,
- 0x00, 0x65, 0x1e, 0x10,
- 0xe0, 0x6a, 0x5c, 0x17,
- 0x64, 0x6a, 0xcf, 0x16,
- 0x00, 0x6a, 0x31, 0x00,
- 0x00, 0x6a, 0x8a, 0x18,
- 0x70, 0xa1, 0x6e, 0x02,
- 0xff, 0x6e, 0x64, 0x02,
- 0x00, 0x57, 0x57, 0x04,
- 0xff, 0xae, 0x87, 0x1e,
- 0x00, 0x65, 0xd7, 0x16,
- 0x51, 0x6a, 0x91, 0x00,
- 0x00, 0x65, 0x1e, 0x10,
- 0xff, 0x90, 0x9d, 0x02,
- 0x02, 0x6a, 0x91, 0x00,
- 0x00, 0x65, 0xb9, 0x10,
- 0x01, 0x64, 0x99, 0x18,
- 0x64, 0x6a, 0xd1, 0x16,
- 0x03, 0x64, 0xb5, 0x18,
- 0x64, 0x6a, 0xd1, 0x16,
- 0x01, 0x64, 0xb5, 0x18,
- 0x4c, 0x6a, 0xd1, 0x16,
- 0x4d, 0x6a, 0xd1, 0x16,
- 0x41, 0x6a, 0x91, 0x00,
- 0x00, 0x65, 0x4c, 0x17,
- 0xff, 0x65, 0x66, 0x02,
- 0xff, 0x4c, 0x6d, 0x02,
- 0xff, 0x64, 0x64, 0x04,
- 0x00, 0x4f, 0x4f, 0x02,
- 0xff, 0x4c, 0x04, 0x02,
- 0x00, 0x65, 0xb9, 0x10,
- 0x04, 0x64, 0x9c, 0x18,
- 0x04, 0xa0, 0xa0, 0x00,
- 0x00, 0x65, 0xb9, 0x10,
- 0x02, 0x64, 0x9f, 0x18,
- 0x00, 0x65, 0x21, 0x17,
- 0x00, 0x65, 0xb9, 0x10,
- 0x03, 0x64, 0xa2, 0x18,
- 0x00, 0x65, 0x19, 0x17,
- 0x00, 0x65, 0xb9, 0x10,
- 0x80, 0x64, 0xaa, 0x1e,
- 0x78, 0x64, 0xb5, 0x1a,
- 0x00, 0x64, 0x08, 0x17,
- 0x80, 0x35, 0xb9, 0x1a,
- 0x04, 0xa0, 0xa0, 0x04,
- 0xc0, 0x6a, 0x34, 0x00,
- 0x00, 0x65, 0x19, 0x17,
- 0x00, 0x65, 0xb9, 0x10,
- 0x07, 0x64, 0xb5, 0x18,
- 0x70, 0x05, 0x6e, 0x02,
- 0xff, 0x6e, 0x64, 0x02,
- 0x00, 0x4f, 0xb9, 0x1e,
- 0x00, 0x65, 0x4c, 0x17,
- 0xff, 0x65, 0x66, 0x02,
- 0xff, 0x6a, 0x6d, 0x02,
- 0xff, 0x64, 0x64, 0x04,
- 0x00, 0x4f, 0x4f, 0x02,
- 0xff, 0x6a, 0x04, 0x02,
- 0x00, 0x65, 0xb9, 0x10,
- 0x10, 0x4e, 0x65, 0x00,
- 0x00, 0x65, 0x5c, 0x17,
- 0x11, 0x6a, 0x91, 0x00,
- 0x07, 0x6a, 0xc2, 0x16,
- 0x00, 0x65, 0xd7, 0x16,
- 0x00, 0x65, 0x1e, 0x10,
- 0x40, 0x6a, 0x0c, 0x00,
- 0xff, 0x6a, 0x4e, 0x02,
- 0x00, 0x65, 0x00, 0x10,
- 0xff, 0x6c, 0x6d, 0x02,
- 0xff, 0x64, 0x64, 0x06,
- 0x00, 0x6a, 0xbe, 0x18,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x50, 0x6a, 0x60, 0x00,
- 0x80, 0x35, 0xc7, 0x1a,
- 0x80, 0x6a, 0x35, 0x00,
- 0x01, 0x6a, 0x36, 0x00,
- 0xff, 0x65, 0x37, 0x02,
- 0x10, 0x6a, 0x60, 0x00,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x02, 0x0b, 0xc9, 0x1e,
- 0xff, 0x65, 0x66, 0x02,
- 0x00, 0x65, 0xe3, 0x16,
- 0xff, 0x06, 0x6d, 0x02,
- 0x04, 0x0b, 0xcd, 0x1e,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x65, 0x66, 0x02,
- 0xff, 0x12, 0x6d, 0x03,
- 0xff, 0x65, 0x66, 0x02,
- 0x00, 0x65, 0xe3, 0x16,
- 0xff, 0x06, 0x6a, 0x02,
- 0x04, 0x0b, 0xd4, 0x1e,
- 0x02, 0x0b, 0xd5, 0x1e,
- 0xff, 0x12, 0x6d, 0x03,
- 0x00, 0x65, 0xe3, 0x16,
- 0xff, 0x06, 0x6a, 0x02,
- 0x04, 0x0b, 0xd9, 0x1e,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x02, 0x0b, 0xdb, 0x1e,
- 0x00, 0x65, 0xe3, 0x16,
- 0x80, 0x30, 0xe0, 0x1e,
- 0x40, 0x6a, 0x0c, 0x00,
- 0xff, 0x6a, 0x30, 0x02,
- 0xff, 0x65, 0x06, 0x02,
- 0x04, 0x0b, 0xe1, 0x1e,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x6a, 0x0a, 0x02,
- 0xff, 0x6a, 0x09, 0x02,
- 0x01, 0x6a, 0x08, 0x01,
- 0xff, 0x65, 0x93, 0x02,
- 0x01, 0x0b, 0xe9, 0x1a,
- 0x10, 0x0c, 0xe7, 0x1e,
- 0x04, 0x65, 0xeb, 0x1a,
- 0x01, 0x94, 0xea, 0x1e,
- 0xff, 0x6a, 0x93, 0x02,
- 0x38, 0x93, 0xec, 0x1a,
- 0x03, 0x6a, 0x64, 0x00,
- 0xaf, 0x6a, 0x66, 0x00,
- 0x08, 0x6a, 0xbe, 0x16,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x6a, 0x1f, 0x02,
- 0xf0, 0x65, 0x05, 0x02,
- 0x07, 0x5a, 0x64, 0x02,
- 0x00, 0x05, 0x05, 0x00,
- 0xff, 0x6a, 0x30, 0x02,
- 0xff, 0x6a, 0x4e, 0x02,
- 0x8a, 0x6a, 0x01, 0x00,
- 0x38, 0x5a, 0x64, 0x02,
- 0x05, 0x64, 0x02, 0x00,
- 0x84, 0x6a, 0x11, 0x00,
- 0x00, 0x65, 0x19, 0x17,
- 0x00, 0x65, 0x4c, 0x17,
- 0xff, 0x6c, 0x04, 0x02,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x80, 0x34, 0x02, 0x1f,
- 0x40, 0x34, 0x02, 0x1b,
- 0x21, 0x6a, 0x91, 0x00,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x70, 0x65, 0x6e, 0x02,
- 0xff, 0x6e, 0x64, 0x02,
- 0x00, 0x32, 0x07, 0x1f,
- 0xff, 0x6a, 0x64, 0x03,
- 0x40, 0x6a, 0x64, 0x01,
- 0x07, 0x65, 0x64, 0x02,
- 0x00, 0x19, 0x66, 0x00,
- 0xf7, 0x66, 0x66, 0x02,
- 0xff, 0x6a, 0x65, 0x02,
- 0xff, 0x66, 0x64, 0x02,
- 0xff, 0x65, 0x90, 0x02,
- 0x00, 0xa1, 0x11, 0x19,
- 0x04, 0xa0, 0x11, 0x1f,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x01, 0x65, 0x65, 0x06,
- 0xff, 0x56, 0x64, 0x02,
- 0x00, 0x65, 0x0c, 0x19,
- 0x31, 0x6a, 0x91, 0x00,
- 0x06, 0x6a, 0xc2, 0x16,
- 0x10, 0x4e, 0x65, 0x00,
- 0x00, 0x65, 0x5c, 0x17,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0xa2, 0x51, 0x02,
- 0x04, 0x6a, 0x64, 0x00,
- 0x52, 0x6a, 0x66, 0x00,
- 0xa3, 0x6a, 0xbe, 0x16,
- 0x80, 0x6a, 0x50, 0x00,
- 0x10, 0xa0, 0x20, 0x1b,
- 0xff, 0x6a, 0x50, 0x02,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x51, 0xa2, 0x02,
- 0x04, 0x6a, 0x64, 0x00,
- 0xa3, 0x6a, 0x66, 0x00,
- 0x52, 0x6a, 0xbe, 0x16,
- 0xef, 0xa0, 0xa0, 0x02,
- 0x80, 0x50, 0x28, 0x1f,
- 0x10, 0xa0, 0xa0, 0x00,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x51, 0x3d, 0x1f,
- 0x80, 0x50, 0x3d, 0x1b,
- 0xff, 0x6a, 0x8e, 0x02,
- 0xff, 0x6a, 0x8d, 0x02,
- 0x08, 0x6a, 0x8c, 0x00,
- 0x04, 0x6a, 0x64, 0x00,
- 0x88, 0x6a, 0x66, 0x00,
- 0x52, 0x6a, 0xbe, 0x16,
- 0x0d, 0x6a, 0x93, 0x00,
- 0x08, 0x94, 0x32, 0x1f,
- 0xff, 0x6a, 0x93, 0x02,
- 0x08, 0x93, 0x34, 0x1b,
- 0xff, 0x99, 0xb3, 0x02,
- 0xff, 0x99, 0xb4, 0x02,
- 0xff, 0x99, 0xb5, 0x02,
- 0xff, 0x99, 0xb6, 0x02,
- 0xff, 0x99, 0xb7, 0x02,
- 0xff, 0x99, 0xb8, 0x02,
- 0xff, 0x99, 0xb9, 0x02,
- 0xff, 0x99, 0x6a, 0x02,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x51, 0x4b, 0x1f,
- 0xff, 0x08, 0x4a, 0x1b,
- 0xff, 0x09, 0x4a, 0x1b,
- 0xff, 0x0a, 0x4a, 0x1b,
- 0xff, 0x6a, 0x50, 0x02,
- 0xff, 0x51, 0x51, 0x06,
- 0xff, 0x6a, 0x64, 0x02,
- 0x08, 0x52, 0x52, 0x06,
- 0x00, 0x53, 0x53, 0x08,
- 0x00, 0x54, 0x54, 0x08,
- 0x00, 0x55, 0x55, 0x08,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x80, 0x6a, 0x50, 0x00,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x4c, 0x05, 0x64, 0x0a,
- 0x07, 0x64, 0x64, 0x02,
- 0x20, 0x64, 0x65, 0x06,
- 0x70, 0x05, 0x6e, 0x02,
- 0xff, 0x6e, 0x64, 0x03,
- 0xff, 0x65, 0x66, 0x02,
- 0x00, 0x65, 0x4c, 0x17,
- 0x00, 0x4f, 0x55, 0x1b,
- 0xff, 0x6a, 0x6a, 0x03,
- 0x01, 0x6a, 0x6d, 0x00,
- 0x03, 0x6a, 0x6d, 0x00,
- 0x01, 0x6a, 0x6d, 0x00,
- 0x19, 0x6a, 0x6d, 0x00,
- 0x0f, 0x6a, 0x6d, 0x00,
- 0xc9, 0x66, 0x36, 0x06,
- 0xff, 0x6a, 0x6a, 0x03,
- 0xff, 0x65, 0x4e, 0x02,
- 0xff, 0x65, 0x03, 0x03,
diff --git a/sys/gnu/misc/aic7xxx/aic7xxx.1 b/sys/gnu/misc/aic7xxx/aic7xxx.1
deleted file mode 100644
index 2ff33b7..0000000
--- a/sys/gnu/misc/aic7xxx/aic7xxx.1
+++ /dev/null
@@ -1,70 +0,0 @@
-.\" Copyright (c) 1994, 1995
-.\" Justin T. Gibbs. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.\"
-.Dd November 11, 1994
-.Dt AIC7XXX_ASM 1
-.Os BSD 4
-.Sh NAME
-.Nm aic7xxx_asm
-.Nd Assembler for the Adaptec aic7xxx family of asics
-.Sh SYNOPSIS
-.Nm aic7xxx_asm
-.Op Fl d
-.Op Fl D Ar variable=value
-.Op Fl v
-.Op Fl o Ar file
-.Ar source-file
-.Sh DESCRIPTION
-The Adaptec aic7xxx family of asics are single chip SCSI controllers with a
-RISC like command processor. This assembler parses the language outlined
-in the Adaptec technical document
-.%T "AIC-7770 (EISA/ISA Bus Master Single-Chip SCSI Host Adaptor) Data Book"
-and produces ascii output intended for a C byte array.
-.Pp
-The aic7xxx assembler is required to compile kernels with aic7xxx SCSI
-adaptor support (AHA-274x, AHA-284x, AHA-294x controllers) and is compiled,
-installed, and used automatically in the kernel compile directory when
-necessary.
-.Pp
-The options are as follows:
-.Bl -tag -width Ds
-.It Fl D Ar variable=value
-Define
-.Ar variable
-to be
-.Ar value
-in the global context
-.It Fl d
-Turn on debugging
-.It Fl v
-Print version information
-.It Fl o Ar file
-Redirect assembler output to
-.Ar file
-.Pp
-.Sh AUTHOR
-This aic7770 assembler was written by
-John Aycock (aycock@cpsc.ucalgary.ca)
diff --git a/sys/gnu/misc/aic7xxx/aic7xxx.c b/sys/gnu/misc/aic7xxx/aic7xxx.c
deleted file mode 100644
index 5f910d4..0000000
--- a/sys/gnu/misc/aic7xxx/aic7xxx.c
+++ /dev/null
@@ -1,643 +0,0 @@
-/*+M*************************************************************************
- * Adaptec AIC7770/AIC7870 sequencer code assembler.
- *
- * Copyright (c) 1994 John Aycock
- * The University of Calgary Department of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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 Calgary
- * Department of Computer Science 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Comments are started by `#' and continue to the end of the line; lines
- * may be of the form:
- * <label>*
- * <label>* <undef-sym> = <value>
- * <label>* <opcode> <operand>*
- *
- * A <label> is an <undef-sym> ending in a colon. Spaces, tabs, and commas
- * are token separators.
- *
- *-M*************************************************************************/
-static char id[] = "$Id$";
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#define MEMORY 448
-#define MAXLINE 1024
-#define MAXTOKEN 32
-#define ADOTOUT "a.out"
-#define NOVALUE -1
-
-/*
- * AIC-7770/AIC-7870 register definitions
- */
-#define R_SINDEX 0x65
-#define R_ALLONES 0x69
-#define R_ALLZEROS 0x6a
-#define R_NONE 0x6a
-
-int debug;
-int lineno, LC;
-char *filename;
-FILE *ifp, *ofp;
-unsigned char M[MEMORY][4];
-
-void
-error(char *s)
-{
- fprintf(stderr, "%s: %s at line %d\n", filename, s, lineno);
- exit(EXIT_FAILURE);
-}
-
-void *
-Malloc(size_t size)
-{
- void *p = malloc(size);
- if (!p)
- error("out of memory");
- return(p);
-}
-
-void *
-Realloc(void *ptr, size_t size)
-{
- void *p = realloc(ptr, size);
- if (!p)
- error("out of memory");
- return(p);
-}
-
-char *
-Strdup(char *s)
-{
- char *p = (char *)Malloc(strlen(s) + 1);
- strcpy(p, s);
- return(p);
-}
-
-typedef struct sym_t {
- struct sym_t *next; /* MUST BE FIRST */
- char *name;
- int value;
- int npatch;
- int *patch;
-} sym_t;
-
-sym_t *head;
-
-void
-define(char *name, int value)
-{
- sym_t *p, *q;
-
- for (p = head, q = (sym_t *)&head; p; p = p->next) {
- if (!strcmp(p->name, name))
- error("redefined symbol");
- q = p;
- }
-
- p = q->next = (sym_t *)Malloc(sizeof(sym_t));
- p->next = NULL;
- p->name = Strdup(name);
- p->value = value;
- p->npatch = 0;
- p->patch = NULL;
-
- if (debug) {
- fprintf(stderr, "\"%s\" ", p->name);
- if (p->value != NOVALUE)
- fprintf(stderr, "defined as 0x%x\n", p->value);
- else
- fprintf(stderr, "undefined\n");
- }
-}
-
-sym_t *
-lookup(char *name)
-{
- sym_t *p;
-
- for (p = head; p; p = p->next)
- if (!strcmp(p->name, name))
- return(p);
- return(NULL);
-}
-
-void
-patch(sym_t *p, int location)
-{
- p->npatch += 1;
- p->patch = (int *)Realloc(p->patch, p->npatch * sizeof(int *));
-
- p->patch[p->npatch - 1] = location;
-}
-
-void backpatch(void)
-{
- int i;
- sym_t *p;
-
- for (p = head; p; p = p->next) {
-
- if (p->value == NOVALUE) {
- fprintf(stderr,
- "%s: undefined symbol \"%s\"\n",
- filename, p->name);
- exit(EXIT_FAILURE);
- }
-
- if (p->npatch) {
- if (debug)
- fprintf(stderr,
- "\"%s\" (0x%x) patched at",
- p->name, p->value);
-
- for (i = 0; i < p->npatch; i++) {
- M[p->patch[i]][0] &= ~1;
- M[p->patch[i]][0] |= ((p->value >> 8) & 1);
- M[p->patch[i]][1] = p->value & 0xff;
-
- if (debug)
- fprintf(stderr, " 0x%x", p->patch[i]);
- }
-
- if (debug)
- fputc('\n', stderr);
- }
- }
-}
-
-/*
- * Output words in byte-reversed order (least significant first)
- * since the sequencer RAM is loaded that way.
- */
-void
-output(FILE *fp)
-{
- int i;
-
- for (i = 0; i < LC; i++)
- fprintf(fp, "\t0x%02x, 0x%02x, 0x%02x, 0x%02x,\n",
- M[i][3],
- M[i][2],
- M[i][1],
- M[i][0]);
- printf("%d out of %d instructions used.\n", LC, MEMORY);
-}
-
-char **
-getl(int *n)
-{
- int i;
- char *p, *quote;
- static char buf[MAXLINE];
- static char *a[MAXTOKEN];
-
- i = 0;
-
- while (fgets(buf, sizeof(buf), ifp)) {
-
- lineno += 1;
-
- if (buf[strlen(buf)-1] != '\n')
- error("line too long");
-
- p = strchr(buf, '#');
- if (p)
- *p = '\0';
- p = buf;
-rescan:
- quote = strchr(p, '\"');
- if (quote)
- *quote = '\0';
- for (p = strtok(p, ", \t\n"); p; p = strtok(NULL, ", \t\n"))
- if (i < MAXTOKEN-1)
- a[i++] = p;
- else
- error("too many tokens");
- if (quote) {
- quote++;
- p = strchr(quote, '\"');
- if (!p)
- error("unterminated string constant");
- else if (i < MAXTOKEN-1) {
- a[i++] = quote;
- *p = '\0';
- p++;
- }
- else
- error("too many tokens");
- goto rescan;
- }
- if (i) {
- *n = i;
- return(a);
- }
- }
- return(NULL);
-}
-
-#define A 0x8000 /* `A'ccumulator ok */
-#define I 0x4000 /* use as immediate value */
-#define SL 0x2000 /* shift left */
-#define SR 0x1000 /* shift right */
-#define RL 0x0800 /* rotate left */
-#define RR 0x0400 /* rotate right */
-#define LO 0x8000 /* lookup: ori-{jmp,jc,jnc,call} */
-#define LA 0x4000 /* lookup: and-{jz,jnz} */
-#define LX 0x2000 /* lookup: xor-{je,jne} */
-#define NA -1 /* not applicable */
-
-struct {
- char *name;
- int n; /* number of operands, including opcode */
- unsigned int op; /* immediate or L?|pos_from_0 */
- unsigned int dest; /* NA, pos_from_0, or I|immediate */
- unsigned int src; /* NA, pos_from_0, or I|immediate */
- unsigned int imm; /* pos_from_0, A|pos_from_0, or I|immediate */
- unsigned int addr; /* NA or pos_from_0 */
- int fmt; /* instruction format - 1, 2, or 3 */
-} instr[] = {
-/*
- * N OP DEST SRC IMM ADDR FMT
- */
- { "mov", 3, 1, 1, 2, I|0xff, NA, 1 },
- { "mov", 4, LO|2, NA, 1, I|0, 3, 3 },
- { "mvi", 3, 0, 1, I|R_ALLZEROS, A|2, NA, 1 },
- { "mvi", 4, LO|2, NA, I|R_ALLZEROS, 1, 3, 3 },
- { "not", 2, 2, 1, 1, I|0xff, NA, 1 },
- { "and", 3, 1, 1, 1, A|2, NA, 1 },
- { "and", 4, 1, 1, 3, A|2, NA, 1 },
- { "or", 3, 0, 1, 1, A|2, NA, 1 },
- { "or", 4, 0, 1, 3, A|2, NA, 1 },
- { "or", 5, LO|3, NA, 1, 2, 4, 3 },
- { "xor", 3, 2, 1, 1, A|2, NA, 1 },
- { "xor", 4, 2, 1, 3, A|2, NA, 1 },
- { "nop", 1, 1, I|R_NONE, I|R_ALLZEROS, I|0xff, NA, 1 },
- { "inc", 2, 3, 1, 1, I|1, NA, 1 },
- { "inc", 3, 3, 1, 2, I|1, NA, 1 },
- { "dec", 2, 3, 1, 1, I|0xff, NA, 1 },
- { "dec", 3, 3, 1, 2, I|0xff, NA, 1 },
- { "jmp", 2, LO|0, NA, I|R_SINDEX, I|0, 1, 3 },
- { "jc", 2, LO|0, NA, I|R_SINDEX, I|0, 1, 3 },
- { "jnc", 2, LO|0, NA, I|R_SINDEX, I|0, 1, 3 },
- { "call", 2, LO|0, NA, I|R_SINDEX, I|0, 1, 3 },
- { "test", 5, LA|3, NA, 1, A|2, 4, 3 },
- { "cmp", 5, LX|3, NA, 1, A|2, 4, 3 },
- { "ret", 1, 1, I|R_NONE, I|R_ALLZEROS, I|0xff, NA, 1 },
- { "ret", 1, 1, I|R_NONE, I|R_ALLZEROS, I|0xff, NA, 1 },
- { "clc", 1, 3, I|R_NONE, I|R_ALLZEROS, I|1, NA, 1 },
- { "clc", 4, 3, 2, I|R_ALLZEROS, A|3, NA, 1 },
- { "stc", 2, 3, 1, I|R_ALLONES, I|1, NA, 1 },
- { "add", 3, 3, 1, 1, A|2, NA, 1 },
- { "add", 4, 3, 1, 3, A|2, NA, 1 },
- { "adc", 3, 4, 1, 1, A|2, NA, 1 },
- { "adc", 4, 4, 1, 3, A|2, NA, 1 },
- { "shl", 3, 5, 1, 1, SL|2, NA, 2 },
- { "shl", 4, 5, 1, 2, SL|3, NA, 2 },
- { "shr", 3, 5, 1, 1, SR|2, NA, 2 },
- { "shr", 4, 5, 1, 2, SR|3, NA, 2 },
- { "rol", 3, 5, 1, 1, RL|2, NA, 2 },
- { "rol", 4, 5, 1, 2, RL|3, NA, 2 },
- { "ror", 3, 5, 1, 1, RR|2, NA, 2 },
- { "ror", 4, 5, 1, 2, RR|3, NA, 2 },
- /*
- * Extensions (note also that mvi allows A)
- */
- { "clr", 2, 1, 1, I|R_ALLZEROS, I|0xff, NA, 1 },
- { 0, 0, 0, 0, 0, 0, 0, 0 }
-};
-
-int
-eval_operand(char **a, int spec)
-{
- int i;
- unsigned int want = spec & (LO|LA|LX);
-
- static struct {
- unsigned int what;
- char *name;
- int value;
- } jmptab[] = {
- { LO, "jmp", 8 },
- { LO, "jc", 9 },
- { LO, "jnc", 10 },
- { LO, "call", 11 },
- { LA, "jz", 15 },
- { LA, "jnz", 13 },
- { LX, "je", 14 },
- { LX, "jne", 12 },
- };
-
- spec &= ~(LO|LA|LX);
-
- for (i = 0; i < sizeof(jmptab)/sizeof(jmptab[0]); i++)
- if (jmptab[i].what == want &&
- !strcmp(jmptab[i].name, a[spec]))
- {
- return(jmptab[i].value);
- }
-
- if (want)
- error("invalid jump");
-
- return(spec); /* "case 0" - no flags set */
-}
-
-int
-eval_sdi(char **a, int spec)
-{
- sym_t *p;
- unsigned val;
-
- if (spec == NA)
- return(NA);
-
- switch (spec & (A|I|SL|SR|RL|RR)) {
- case SL:
- case SR:
- case RL:
- case RR:
- if (isdigit(*a[spec &~ (SL|SR|RL|RR)]))
- val = strtol(a[spec &~ (SL|SR|RL|RR)], NULL, 0);
- else {
- p = lookup(a[spec &~ (SL|SR|RL|RR)]);
- if (!p)
- error("undefined symbol used");
- val = p->value;
- }
-
- switch (spec & (SL|SR|RL|RR)) { /* blech */
- case SL:
- if (val > 7)
- return(0xf0);
- return(((val % 8) << 4) |
- (val % 8));
- case SR:
- if (val > 7)
- return(0xf0);
- return(((val % 8) << 4) |
- (1 << 3) |
- ((8 - (val % 8)) % 8));
- case RL:
- return(val % 8);
- case RR:
- return((8 - (val % 8)) % 8);
- }
- case I:
- return(spec &~ I);
- case A:
- /*
- * An immediate field of zero selects
- * the accumulator. Vigorously object
- * if zero is given otherwise - it's
- * most likely an error.
- */
- spec &= ~A;
- if (!strcmp("A", a[spec]))
- return(0);
- if (isdigit(*a[spec]) &&
- strtol(a[spec], NULL, 0) == 0)
- {
- error("immediate value of zero selects accumulator");
- }
- /* falls through */
- case 0:
- if (isdigit(*a[spec]))
- return(strtol(a[spec], NULL, 0));
- p = lookup(a[spec]);
- if (p)
- return(p->value);
- error("undefined symbol used");
- }
-
- return(NA); /* shut the compiler up */
-}
-
-int
-eval_addr(char **a, int spec)
-{
- sym_t *p;
-
- if (spec == NA)
- return(NA);
- if (isdigit(*a[spec]))
- return(strtol(a[spec], NULL, 0));
-
- p = lookup(a[spec]);
-
- if (p) {
- if (p->value != NOVALUE)
- return(p->value);
- patch(p, LC);
- } else {
- define(a[spec], NOVALUE);
- p = lookup(a[spec]);
- patch(p, LC);
- }
-
- return(NA); /* will be patched in later */
-}
-
-int
-crack(char **a, int n)
-{
- int i;
- int I_imm, I_addr;
- int I_op, I_dest, I_src, I_ret;
-
- /*
- * Check for "ret" at the end of the line; remove
- * it unless it's "ret" alone - we still want to
- * look it up in the table.
- */
- I_ret = (strcmp(a[n-1], "ret") ? 0 : !0);
- if (I_ret && n > 1)
- n -= 1;
-
- for (i = 0; instr[i].name; i++) {
- /*
- * Look for match in table given constraints,
- * currently just the name and the number of
- * operands.
- */
- if (!strcmp(instr[i].name, *a) && instr[i].n == n)
- break;
- }
- if (!instr[i].name)
- error("unknown opcode or wrong number of operands");
-
- I_op = eval_operand(a, instr[i].op);
- I_src = eval_sdi(a, instr[i].src);
- I_imm = eval_sdi(a, instr[i].imm);
- I_dest = eval_sdi(a, instr[i].dest);
- I_addr = eval_addr(a, instr[i].addr);
-
- if( LC >= MEMORY )
- error("Memory exhausted!\n");
-
- switch (instr[i].fmt) {
- case 1:
- case 2:
- M[LC][0] = (I_op << 1) | I_ret;
- M[LC][1] = I_dest;
- M[LC][2] = I_src;
- M[LC][3] = I_imm;
- break;
- case 3:
- if (I_ret)
- error("illegal use of \"ret\"");
- M[LC][0] = (I_op << 1) | ((I_addr >> 8) & 1);
- M[LC][1] = I_addr & 0xff;
- M[LC][2] = I_src;
- M[LC][3] = I_imm;
- break;
- }
-
- return (1); /* no two-byte instructions yet */
-}
-
-#undef SL
-#undef SR
-#undef RL
-#undef RR
-#undef LX
-#undef LA
-#undef LO
-#undef I
-#undef A
-
-void
-assemble(void)
-{
- int n;
- char **a;
- sym_t *p;
-
- while ((a = getl(&n))) {
-
- while (a[0][strlen(*a)-1] == ':') {
- a[0][strlen(*a)-1] = '\0';
- p = lookup(*a);
- if (p)
- p->value = LC;
- else
- define(*a, LC);
- a += 1;
- n -= 1;
- }
-
- if (!n) /* line was all labels */
- continue;
-
- if (n == 3 && !strcmp("VERSION", *a))
- fprintf(ofp, "#define %s \"%s\"\n", a[1], a[2]);
- else {
- if (n == 3 && !strcmp("=", a[1]))
- define(*a, strtol(a[2], NULL, 0));
- else
- LC += crack(a, n);
- }
- }
-
- backpatch();
- output(ofp);
-
- if (debug)
- output(stderr);
-}
-
-int
-main(int argc, char **argv)
-{
- int c;
-
- while ((c = getopt(argc, argv, "dho:vD")) != EOF) {
- switch (c) {
- case 'd':
- debug = !0;
- break;
- case 'D':
- {
- char *p;
- if ((p = strchr(optarg, '=')) != NULL) {
- *p = '\0';
- define(optarg, strtol(p + 1, NULL, 0));
- }
- else
- define(optarg, 1);
- break;
- }
- case 'o':
- ofp = fopen(optarg, "w");
- if (!ofp) {
- perror(optarg);
- exit(EXIT_FAILURE);
- }
- break;
- case 'h':
- printf("usage: %s [-d] [-Dname] [-ooutput] input\n",
- *argv);
- exit(EXIT_SUCCESS);
- break;
- case 'v':
- printf("%s\n", id);
- exit(EXIT_SUCCESS);
- break;
- default:
- exit(EXIT_FAILURE);
- break;
- }
- }
-
- if (argc - optind != 1) {
- fprintf(stderr, "%s: must have one input file\n", *argv);
- exit(EXIT_FAILURE);
- }
- filename = argv[optind];
-
- ifp = fopen(filename, "r");
- if (!ifp) {
- perror(filename);
- exit(EXIT_FAILURE);
- }
-
- if (!ofp) {
- ofp = fopen(ADOTOUT, "w");
- if (!ofp) {
- perror(ADOTOUT);
- exit(EXIT_FAILURE);
- }
- }
-
- assemble();
- exit(EXIT_SUCCESS);
-}
diff --git a/sys/gnu/misc/aic7xxx/aic7xxx.seq b/sys/gnu/misc/aic7xxx/aic7xxx.seq
deleted file mode 100644
index 435da74..0000000
--- a/sys/gnu/misc/aic7xxx/aic7xxx.seq
+++ /dev/null
@@ -1,1253 +0,0 @@
-##+M#########################################################################
-# Adaptec 274x/284x/294x device driver for Linux and FreeBSD.
-#
-# Copyright (c) 1994 John Aycock
-# The University of Calgary Department of Computer Science.
-# All rights reserved.
-#
-# Modifications/enhancements:
-# Copyright (c) 1994, 1995 Justin Gibbs. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions, and the following disclaimer.
-# 2. Redistributions in binary form must reproduce 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 Calgary
-# Department of Computer Science 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# FreeBSD, Twin, Wide, 2 command per target support, tagged queuing and other
-# optimizations provided by Justin T. Gibbs (gibbs@FreeBSD.org)
-#
-##-M#########################################################################
-
-VERSION AIC7XXX_SEQ_VER "$Id: aic7xxx.seq,v 1.13 1995/04/09 06:40:16 gibbs Exp $"
-
-SCBMASK = 0x1f
-
-SCSISEQ = 0x00
-SXFRCTL0 = 0x01
-SXFRCTL1 = 0x02
-SCSISIGI = 0x03
-SCSISIGO = 0x03
-SCSIRATE = 0x04
-SCSIID = 0x05
-SCSIDATL = 0x06
-STCNT = 0x08
-STCNT+0 = 0x08
-STCNT+1 = 0x09
-STCNT+2 = 0x0a
-SSTAT0 = 0x0b
-CLRSINT1 = 0x0c
-SSTAT1 = 0x0c
-SIMODE1 = 0x11
-SCSIBUSL = 0x12
-SHADDR = 0x14
-SELID = 0x19
-SBLKCTL = 0x1f
-SEQCTL = 0x60
-A = 0x64 # == ACCUM
-SINDEX = 0x65
-DINDEX = 0x66
-ALLZEROS = 0x6a
-NONE = 0x6a
-SINDIR = 0x6c
-DINDIR = 0x6d
-FUNCTION1 = 0x6e
-HADDR = 0x88
-HADDR+1 = 0x89
-HADDR+2 = 0x8a
-HADDR+3 = 0x8b
-HCNT = 0x8c
-HCNT+0 = 0x8c
-HCNT+1 = 0x8d
-HCNT+2 = 0x8e
-SCBPTR = 0x90
-INTSTAT = 0x91
-DFCNTRL = 0x93
-DFSTATUS = 0x94
-DFDAT = 0x99
-QINFIFO = 0x9b
-QINCNT = 0x9c
-QOUTFIFO = 0x9d
-
-SCSICONF_A = 0x5a
-SCSICONF_B = 0x5b
-
-# The two reserved bytes at SCBARRAY+1[23] are expected to be set to
-# zero, and the reserved bit in SCBARRAY+0 is used as an internal flag
-# to indicate whether or not to reload scatter-gather parameters after
-# a disconnect. We also use bits 6 & 7 to indicate whether or not to
-# initiate SDTR or WDTR repectively when starting this command.
-#
-SCBARRAY+0 = 0xa0
-
-DISCONNECTED = 0x04
-NEEDDMA = 0x08
-SG_LOAD = 0x10
-TAG_ENB = 0x20
-NEEDSDTR = 0x40
-NEEDWDTR = 0x80
-
-SCBARRAY+1 = 0xa1
-SCBARRAY+2 = 0xa2
-SCBARRAY+3 = 0xa3
-SCBARRAY+4 = 0xa4
-SCBARRAY+5 = 0xa5
-SCBARRAY+6 = 0xa6
-SCBARRAY+7 = 0xa7
-SCBARRAY+8 = 0xa8
-SCBARRAY+9 = 0xa9
-SCBARRAY+10 = 0xaa
-SCBARRAY+11 = 0xab
-SCBARRAY+12 = 0xac
-SCBARRAY+13 = 0xad
-SCBARRAY+14 = 0xae
-SCBARRAY+15 = 0xaf
-SCBARRAY+16 = 0xb0
-SCBARRAY+17 = 0xb1
-SCBARRAY+18 = 0xb2
-SCBARRAY+19 = 0xb3
-SCBARRAY+20 = 0xb4
-SCBARRAY+21 = 0xb5
-SCBARRAY+22 = 0xb6
-SCBARRAY+23 = 0xb7
-SCBARRAY+24 = 0xb8
-SCBARRAY+25 = 0xb9
-SCBARRAY+26 = 0xba
-SCBARRAY+27 = 0xbb
-SCBARRAY+28 = 0xbc
-SCBARRAY+29 = 0xbd
-
-BAD_PHASE = 0x01 # unknown scsi bus phase
-CMDCMPLT = 0x02
-SEND_REJECT = 0x11 # sending a message reject
-NO_IDENT = 0x21 # no IDENTIFY after reconnect
-NO_MATCH = 0x31 # no cmd match for reconnect
-MSG_SDTR = 0x41 # SDTR message recieved
-MSG_WDTR = 0x51 # WDTR message recieved
-MSG_REJECT = 0x61 # Reject message recieved
-BAD_STATUS = 0x71 # Bad status from target
-RESIDUAL = 0x81 # Residual byte count != 0
-ABORT_TAG = 0x91 # Sent an ABORT_TAG message
-
-# The host adapter card (at least the BIOS) uses 20-2f for SCSI
-# device information, 32-33 and 5a-5f as well. As it turns out, the
-# BIOS trashes 20-2f, writing the synchronous negotiation results
-# on top of the BIOS values, so we re-use those for our per-target
-# scratchspace (actually a value that can be copied directly into
-# SCSIRATE). The kernel driver will enable synchronous negotiation
-# for all targets that have a value other than 0 in the lower four
-# bits of the target scratch space. This should work irregardless of
-# whether the bios has been installed. NEEDWDTR and NEEDSDTR are the top
-# two bits of the SCB control byte. The kernel driver will set these
-# when a WDTR or SDTR message should be sent to the target the SCB's
-# command references.
-#
-# The high bit of DROPATN is set if ATN should be dropped before the ACK
-# when outb is called. REJBYTE contains the first byte of a MESSAGE IN
-# message, so the driver can report an intelligible error if a message is
-# rejected.
-#
-# FLAGS's high bit is true if we are currently handling a reselect;
-# its next-highest bit is true ONLY IF we've seen an IDENTIFY message
-# from the reselecting target. If we haven't had IDENTIFY, then we have
-# no idea what the lun is, and we can't select the right SCB register
-# bank, so force a kernel panic if the target attempts a data in/out or
-# command phase instead of corrupting something.
-#
-# Note that SG_NEXT occupies four bytes.
-#
-SYNCNEG = 0x20
-
-DROPATN = 0x30
-REJBYTE = 0x31
-DISC_DSB_A = 0x32
-DISC_DSB_B = 0x33
-
-MSG_LEN = 0x34
-MSG_START+0 = 0x35
-MSG_START+1 = 0x36
-MSG_START+2 = 0x37
-MSG_START+3 = 0x38
-MSG_START+4 = 0x39
-MSG_START+5 = 0x3a
--MSG_START+0 = 0xcb # 2's complement of MSG_START+0
-
-ARG_1 = 0x4a # sdtr conversion args & return
-BUS_16_BIT = 0x01
-RETURN_1 = 0x4a
-
-SIGSTATE = 0x4b # value written to SCSISIGO
-
-# Linux users should use 0xc (12) for SG_SIZEOF
-SG_SIZEOF = 0x8 # sizeof(struct ahc_dma)
-#SG_SIZEOF = 0xc # sizeof(struct scatterlist)
-SCB_SIZEOF = 0x13 # sizeof SCB to DMA (19 bytes)
-
-SG_NOLOAD = 0x4c # load SG pointer/length?
-SG_COUNT = 0x4d # working value of SG count
-SG_NEXT = 0x4e # working value of SG pointer
-SG_NEXT+0 = 0x4e
-SG_NEXT+1 = 0x4f
-SG_NEXT+2 = 0x50
-SG_NEXT+3 = 0x51
-
-SCBCOUNT = 0x52 # the actual number of SCBs
-FLAGS = 0x53 # Device configuration flags
-TWIN_BUS = 0x01
-WIDE_BUS = 0x02
-MAX_SYNC = 0x08
-SENSE = 0x10
-ACTIVE_MSG = 0x20
-IDENTIFY_SEEN = 0x40
-RESELECTED = 0x80
-
-ACTIVE_A = 0x54
-ACTIVE_B = 0x55
-SAVED_TCL = 0x56
-# Poll QINCNT for work - the lower bits contain
-# the number of entries in the Queue In FIFO.
-#
-start:
- test FLAGS,SENSE jnz start_sense
-start_nosense:
- test FLAGS,TWIN_BUS jz start2 # Are we a twin channel device?
-# For fairness, we check the other bus first, since we just finished a
-# transaction on the current channel.
- xor SBLKCTL,0x08 # Toggle to the other bus
- test SCSISIGI,0x4 jnz reselect # BSYI
- xor SBLKCTL,0x08 # Toggle to the original bus
-start2:
- test SCSISIGI,0x4 jnz reselect # BSYI
- test QINCNT,SCBMASK jz start_nosense
-
-# We have at least one queued SCB now. Set the SCB pointer
-# from the FIFO so we see the right bank of SCB registers,
-# then set SCSI options and set the initiator and target
-# SCSI IDs.
-#
- mov SCBPTR,QINFIFO
-
-# If the control byte of this SCB has the NEEDDMA flag set, we have
-# yet to DMA it from host memory
-
-test SCBARRAY+0,NEEDDMA jz test_busy
- clr HCNT+2
- clr HCNT+1
- mvi HCNT+0,SCB_SIZEOF
-
- mvi DINDEX,HADDR
- mvi SCBARRAY+26 call bcopy_4
-
- mvi DFCNTRL,0xd # HDMAEN|DIRECTION|FIFORESET
-
-# Wait for DMA from host memory to data FIFO to complete, then disable
-# DMA and wait for it to acknowledge that it's off.
-#
- call dma_finish
-
-# Copy the SCB from the FIFO to the SCBARRAY
-
- mvi DINDEX, SCBARRAY+0
- call bcopy_3_dfdat
- call bcopy_4_dfdat
- call bcopy_4_dfdat
- call bcopy_4_dfdat
- call bcopy_4_dfdat
-
-# See if there is not already an active SCB for this target. This code
-# locks out on a per target basis instead of target/lun. Although this
-# is not ideal for devices that have multiple luns active at the same
-# time, it is faster than looping through all SCB's looking for active
-# commands. It may be benificial to make findscb a more general procedure
-# to see if the added cost of the search is negligible. This code also
-# assumes that the kernel driver will clear the active flags on board
-# initialization, board reset, and a target's SELTO.
-
-test_busy:
- test SCBARRAY+0,0x20 jnz start_scb
- and FUNCTION1,0x70,SCBARRAY+1
- mov A,FUNCTION1
- test SCBARRAY+1,0x88 jz test_a # Id < 8 && A channel
-
- test ACTIVE_B,A jnz requeue
- or ACTIVE_B,A # Mark the current target as busy
- jmp start_scb
-
-start_sense:
-# Clear the SENSE flag first, then do a normal start_scb
- and FLAGS,0xef
- jmp start_scb
-
-# Place the currently active back on the queue for later processing
-requeue:
- mov QINFIFO, SCBPTR
- jmp start_nosense
-
-test_a:
- test ACTIVE_A,A jnz requeue
- or ACTIVE_A,A # Mark the current target as busy
-
-start_scb:
- or SCBARRAY+0,NEEDDMA
- and SINDEX,0xf7,SBLKCTL #Clear the channel select bit
- and A,0x08,SCBARRAY+1 #Get new channel bit
- or SINDEX,A
- mov SBLKCTL,SINDEX # select channel
- mov SCBARRAY+1 call initialize
- clr SG_NOLOAD
- and FLAGS,0x3f # !RESELECTING
-
-# As soon as we get a successful selection, the target should go
-# into the message out phase since we have ATN asserted. Prepare
-# the message to send, locking out the device driver. If the device
-# driver hasn't beaten us with an ABORT or RESET message, then tack
-# on an SDTR negotiation if required.
-#
-# Messages are stored in scratch RAM starting with a flag byte (high bit
-# set means active message), one length byte, and then the message itself.
-#
- mov SCBARRAY+1 call disconnect # disconnect ok?
-
- and SINDEX,0x7,SCBARRAY+1 # lun
- or SINDEX,A # return value from disconnect
- or SINDEX,0x80 call mk_mesg # IDENTIFY message
-
- mov A,SINDEX
- test SCBARRAY+0,0xe0 jz !message # WDTR, SDTR or TAG??
- cmp MSG_START+0,A jne !message # did driver beat us?
-
-# Tag Message if Tag enabled in SCB control block. Use SCBPTR as the tag
-# value
-
-mk_tag:
- mvi DINDEX, MSG_START+1
- test SCBARRAY+0,TAG_ENB jz mk_tag_done
- and A,0x23,SCBARRAY+0
- mov DINDIR,A
- mov DINDIR,SCBPTR
-
- add MSG_LEN,-MSG_START+0,DINDEX # update message length
-
-mk_tag_done:
-
- mov DINDEX call mk_dtr # build DTR message if needed
-
-!message:
-
-# Enable selection phase as an initiator, and do automatic ATN
-# after the selection.
-#
- mvi SCSISEQ,0x48 # ENSELO|ENAUTOATNO
-
-# Wait for successful arbitration. The AIC-7770 documentation says
-# that SELINGO indicates successful arbitration, and that it should
-# be used to look for SELDO. However, if the sequencer is paused at
-# just the right time - a parallel fsck(8) on two drives did it for
-# me - then SELINGO can flip back to false before we've seen it. This
-# makes the sequencer sit in the arbitration loop forever. This is
-# Not Good.
-#
-# Therefore, I've added a check in the arbitration loop for SELDO
-# too. This could arguably be made a critical section by disabling
-# pauses, but I don't want to make a potentially infinite loop a CS.
-# I suppose you could fold it into the select loop, too, but since
-# I've been hunting this bug for four days it's kinda like a trophy.
-#
-arbitrate:
- test SSTAT0,0x40 jnz *select # SELDO
- test SSTAT0,0x10 jz arbitrate # SELINGO
-
-# Wait for a successful selection. If the hardware selection
-# timer goes off, then the driver gets the interrupt, so we don't
-# need to worry about it.
-#
-select:
- test SSTAT0,0x40 jz select # SELDO
- jmp *select
-
-# Reselection is being initiated by a target - we've seen the BSY
-# line driven active, and we didn't do it! Enable the reselection
-# hardware, and wait for it to finish. Make a note that we've been
-# reselected, but haven't seen an IDENTIFY message from the target
-# yet.
-#
-reselect:
- mvi SCSISEQ,0x10 # ENRSELI
-
-reselect1:
- test SSTAT0,0x20 jz reselect1 # SELDI
- mov SELID call initialize
-
- and FLAGS,0x3f # reselected, no IDENTIFY
- or FLAGS,RESELECTED
-
-# After the [re]selection, make sure that the [re]selection enable
-# bit is off. This chip is flaky enough without extra things
-# turned on. Also clear the BUSFREE bit in SSTAT1 since we'll be
-# using it shortly.
-#
-*select:
- clr SCSISEQ
- mvi CLRSINT1,0x8 # CLRBUSFREE
-
-# Main loop for information transfer phases. If BSY is false, then
-# we have a bus free condition, expected or not. Otherwise, wait
-# for the target to assert REQ before checking MSG, C/D and I/O
-# for the bus phase.
-#
-# We can't simply look at the values of SCSISIGI here (if we want
-# to do synchronous data transfer), because the target won't assert
-# REQ if it's already sent us some data that we haven't acknowledged
-# yet.
-#
-ITloop:
- test SSTAT1,0x8 jnz p_busfree # BUSFREE
- test SSTAT1,0x1 jz ITloop # REQINIT
-
- and A,0xe0,SCSISIGI # CDI|IOI|MSGI
-
- cmp ALLZEROS,A je p_dataout
- cmp A,0x40 je p_datain
- cmp A,0x80 je p_command
- cmp A,0xc0 je p_status
- cmp A,0xa0 je p_mesgout
- cmp A,0xe0 je p_mesgin
-
- mvi INTSTAT,BAD_PHASE # unknown - signal driver
-
-p_dataout:
- mvi 0 call scsisig # !CDO|!IOO|!MSGO
- call assert
- call sg_load
-
- mvi DINDEX,HADDR
- mvi SCBARRAY+19 call bcopy_4
-
-# mvi DINDEX,HCNT # implicit since HCNT is next to HADDR
- mvi SCBARRAY+23 call bcopy_3
-
- mvi DINDEX,STCNT
- mvi SCBARRAY+23 call bcopy_3
-
-# If we are the last SG block, don't set wideodd.
- test SCBARRAY+18,0xff jnz p_dataout_wideodd
- mvi 0x3d call dma # SCSIEN|SDMAEN|HDMAEN|
- # DIRECTION|FIFORESET
- jmp p_dataout_rest
-
-p_dataout_wideodd:
- mvi 0xbd call dma # WIDEODD|SCSIEN|SDMAEN|HDMAEN|
- # DIRECTION|FIFORESET
-
-p_dataout_rest:
-# After a DMA finishes, save the final transfer pointer and count
-# back into the SCB, in case a device disconnects in the middle of
-# a transfer. Use SHADDR and STCNT instead of HADDR and HCNT, since
-# it's a reflection of how many bytes were transferred on the SCSI
-# (as opposed to the host) bus.
-#
- mvi DINDEX,SCBARRAY+23
- mvi STCNT call bcopy_3
-
- mvi DINDEX,SCBARRAY+19
- mvi SHADDR call bcopy_4
-
- call sg_advance
- mov SCBARRAY+18,SG_COUNT # residual S/G count
-
- jmp ITloop
-
-p_datain:
- mvi 0x40 call scsisig # !CDO|IOO|!MSGO
- call assert
- call sg_load
-
- mvi DINDEX,HADDR
- mvi SCBARRAY+19 call bcopy_4
-
-# mvi DINDEX,HCNT # implicit since HCNT is next to HADDR
- mvi SCBARRAY+23 call bcopy_3
-
- mvi DINDEX,STCNT
- mvi SCBARRAY+23 call bcopy_3
-
-# If we are the last SG block, don't set wideodd.
- test SCBARRAY+18,0xff jnz p_datain_wideodd
- mvi 0x39 call dma # SCSIEN|SDMAEN|HDMAEN|
- # !DIRECTION|FIFORESET
- jmp p_datain_rest
-p_datain_wideodd:
- mvi 0xb9 call dma # WIDEODD|SCSIEN|SDMAEN|HDMAEN|
- # !DIRECTION|FIFORESET
-p_datain_rest:
- mvi DINDEX,SCBARRAY+23
- mvi STCNT call bcopy_3
-
- mvi DINDEX,SCBARRAY+19
- mvi SHADDR call bcopy_4
-
- call sg_advance
- mov SCBARRAY+18,SG_COUNT # residual S/G count
-
- jmp ITloop
-
-# Command phase. Set up the DMA registers and let 'er rip - the
-# two bytes after the SCB SCSI_cmd_length are zeroed by the driver,
-# so we can copy those three bytes directly into HCNT.
-#
-p_command:
- mvi 0x80 call scsisig # CDO|!IOO|!MSGO
- call assert
-
- mvi DINDEX,HADDR
- mvi SCBARRAY+7 call bcopy_4
-
-# mvi DINDEX,HCNT # implicit since HCNT is next to HADDR
- mvi SCBARRAY+11 call bcopy_3
-
- mvi DINDEX,STCNT
- mvi SCBARRAY+11 call bcopy_3
-
- mvi 0x3d call dma # SCSIEN|SDMAEN|HDMAEN|
- # DIRECTION|FIFORESET
- jmp ITloop
-
-# Status phase. Wait for the data byte to appear, then read it
-# and store it into the SCB.
-#
-p_status:
- mvi 0xc0 call scsisig # CDO|IOO|!MSGO
-
- mvi SCBARRAY+14 call inb_first
- jmp p_mesgin_done
-
-# Message out phase. If there is no active message, but the target
-# took us into this phase anyway, build a no-op message and send it.
-#
-p_mesgout:
- mvi 0xa0 call scsisig # CDO|!IOO|MSGO
- mvi 0x8 call mk_mesg # build NOP message
-
- clr STCNT+2
- clr STCNT+1
-
-# Set up automatic PIO transfer from MSG_START. Bit 3 in
-# SXFRCTL0 (SPIOEN) is already on.
-#
- mvi SINDEX,MSG_START+0
- mov DINDEX,MSG_LEN
-
-# When target asks for a byte, drop ATN if it's the last one in
-# the message. Otherwise, keep going until the message is exhausted.
-# (We can't use outb for this since it wants the input in SINDEX.)
-#
-# Keep an eye out for a phase change, in case the target issues
-# a MESSAGE REJECT.
-#
-p_mesgout2:
- test SSTAT0,0x2 jz p_mesgout2 # SPIORDY
- test SSTAT1,0x10 jnz p_mesgout6 # PHASEMIS
-
- cmp DINDEX,1 jne p_mesgout3 # last byte?
- mvi CLRSINT1,0x40 # CLRATNO - drop ATN
-
-# Write a byte to the SCSI bus. The AIC-7770 refuses to automatically
-# send ACKs in automatic PIO or DMA mode unless you make sure that the
-# "expected" bus phase in SCSISIGO matches the actual bus phase. This
-# behaviour is completely undocumented and caused me several days of
-# grief.
-#
-# After plugging in different drives to test with and using a longer
-# SCSI cable, I found that I/O in Automatic PIO mode ceased to function,
-# especially when transferring >1 byte. It seems to be much more stable
-# if STCNT is set to one before the transfer, and SDONE (in SSTAT0) is
-# polled for transfer completion - for both output _and_ input. The
-# only theory I have is that SPIORDY doesn't drop right away when SCSIDATL
-# is accessed (like the documentation says it does), and that on a longer
-# cable run, the sequencer code was fast enough to loop back and see
-# an SPIORDY that hadn't dropped yet.
-#
-p_mesgout3:
- mvi STCNT+0, 0x01
- mov SCSIDATL,SINDIR
-
-p_mesgout4:
- test SSTAT0,0x4 jz p_mesgout4 # SDONE
- dec DINDEX
- test DINDEX,0xff jnz p_mesgout2
-
-# If the next bus phase after ATN drops is a message out, it means
-# that the target is requesting that the last message(s) be resent.
-#
-p_mesgout5:
- test SSTAT1,0x8 jnz p_mesgout6 # BUSFREE
- test SSTAT1,0x1 jz p_mesgout5 # REQINIT
-
- and A,0xe0,SCSISIGI # CDI|IOI|MSGI
- cmp A,0xa0 jne p_mesgout6
- mvi 0x10 call scsisig # ATNO - re-assert ATN
-
- jmp ITloop
-
-p_mesgout6:
- mvi CLRSINT1,0x40 # CLRATNO - in case of PHASEMIS
- and FLAGS,0xdf # no active msg
- jmp ITloop
-
-# Message in phase. Bytes are read using Automatic PIO mode, but not
-# using inb. This alleviates a race condition, namely that if ATN had
-# to be asserted under Automatic PIO mode, it had to beat the SCSI
-# circuitry sending an ACK to the target. This showed up under heavy
-# loads and really confused things, since ABORT commands wouldn't be
-# seen by the drive after an IDENTIFY message in until it had changed
-# to a data I/O phase.
-#
-p_mesgin:
- mvi 0xe0 call scsisig # CDO|IOO|MSGO
- mvi A call inb_first # read the 1st message byte
- mvi REJBYTE,A # save it for the driver
-
- cmp ALLZEROS,A jne p_mesgin1
-
-# We got a "command complete" message, so put the SCB pointer
-# into the Queue Out, and trigger a completion interrupt.
-# Check status for non zero return and interrupt driver if needed
-# This allows the driver to interpret errors only when they occur
-# instead of always uploading the scb. If the status is SCSI_CHECK,
-# the driver will download a new scb requesting sense, to replace
-# the old one and set the SENSE sequencer flag. If the sense flag is
-# set, the sequencer imediately jumps to start working on the sense
-# command. If the kernel driver does not wish to request sense, it need
-# do nothing, and the command is allowed to complete. We don't
-# bother to post to the QOUTFIFO in the error case since it would require
-# extra work in the kernel driver to ensure that the entry was removed
-# before the command complete code tried processing it.
-
-# First check for residuals
- test SCBARRAY+15,0xff jnz resid
- test SCBARRAY+16,0xff jnz resid
- test SCBARRAY+17,0xff jnz resid
-
-check_status:
- test SCBARRAY+14,0xff jz status_ok # 0 Status?
- mvi INTSTAT,BAD_STATUS # let driver know
- test FLAGS,SENSE jz status_ok
- jmp p_mesgin_done
-
-status_ok:
-# First, mark this target as free.
- test SCBARRAY+0,0x20 jnz complete # Tagged command
- and FUNCTION1,0x70,SCBARRAY+1
- mov A,FUNCTION1
- test SCBARRAY+1,0x88 jz clear_a
- xor ACTIVE_B,A
- jmp complete
-
-clear_a:
- xor ACTIVE_A,A
-
-complete:
- mov QOUTFIFO,SCBPTR
- mvi INTSTAT,CMDCMPLT
- jmp p_mesgin_done
-
-# If we have a residual count, interrupt and tell the host. Other
-# alternatives are to pause the sequencer on all command completes (yuck),
-# dma the resid directly to the host (slick, but a ton of instructions), or
-# have the sequencer pause itself when it encounters a non-zero resid
-# (unecessary pause just to flag the command -- yuck, but takes few instructions
-# and since it shouldn't happen that often is good enough for our purposes).
-
-resid:
- mvi INTSTAT,RESIDUAL
- jmp check_status
-
-# Is it an extended message? We only support the synchronous and wide data
-# transfer request messages, which will probably be in response to
-# WDTR or SDTR message outs from us. If it's not SDTR or WDTR, reject it -
-# apparently this can be done after any message in byte, according
-# to the SCSI-2 spec.
-#
-p_mesgin1:
- cmp A,1 jne p_mesgin2 # extended message code?
-
- mvi ARG_1 call inb_next # extended message length
- mvi A call inb_next # extended message code
-
- cmp A,1 je p_mesginSDTR # Syncronous negotiation message
- cmp A,3 je p_mesginWDTR # Wide negotiation message
- jmp p_mesginN
-
-p_mesginWDTR:
- cmp ARG_1,2 jne p_mesginN # extended mesg length = 2
- mvi A call inb_next # Width of bus
- mvi INTSTAT,MSG_WDTR # let driver know
- test RETURN_1,0x80 jz p_mesgin_done# Do we need to send WDTR?
-
-# We didn't initiate the wide negotiation, so we must respond to the request
- and RETURN_1,0x7f # Clear the SEND_WDTR Flag
- or FLAGS,ACTIVE_MSG
- mvi DINDEX,MSG_START+0
- mvi MSG_START+0 call mk_wdtr # build WDTR message
- or SINDEX,0x10,SIGSTATE # turn on ATNO
- call scsisig
- jmp p_mesgin_done
-
-p_mesginSDTR:
- cmp ARG_1,3 jne p_mesginN # extended mesg length = 3
- mvi ARG_1 call inb_next # xfer period
- mvi A call inb_next # REQ/ACK offset
- mvi INTSTAT,MSG_SDTR # call driver to convert
-
- test RETURN_1,0xc0 jz p_mesgin_done# Do we need to mk_sdtr or rej?
- test RETURN_1,0x40 jnz p_mesginN # Requested SDTR too small - rej
- or FLAGS,ACTIVE_MSG
- mvi DINDEX, MSG_START+0
- mvi MSG_START+0 call mk_sdtr
- or SINDEX,0x10,SIGSTATE # turn on ATNO
- call scsisig
- jmp p_mesgin_done
-
-# Is it a disconnect message? Set a flag in the SCB to remind us
-# and await the bus going free.
-#
-p_mesgin2:
- cmp A,4 jne p_mesgin3 # disconnect code?
-
- or SCBARRAY+0,0x4 # set "disconnected" bit
- jmp p_mesgin_done
-
-# Save data pointers message? Copy working values into the SCB,
-# usually in preparation for a disconnect.
-#
-p_mesgin3:
- cmp A,2 jne p_mesgin4 # save data pointers code?
-
- call sg_ram2scb
- jmp p_mesgin_done
-
-# Restore pointers message? Data pointers are recopied from the
-# SCB anyway at the start of any DMA operation, so the only thing
-# to copy is the scatter-gather values.
-#
-p_mesgin4:
- cmp A,3 jne p_mesgin5 # restore pointers code?
-
- call sg_scb2ram
- jmp p_mesgin_done
-
-# Identify message? For a reconnecting target, this tells us the lun
-# that the reconnection is for - find the correct SCB and switch to it,
-# clearing the "disconnected" bit so we don't "find" it by accident later.
-#
-p_mesgin5:
- test A,0x80 jz p_mesgin6 # identify message?
-
- test A,0x78 jnz p_mesginN # !DiscPriv|!LUNTAR|!Reserved
-
- and A,0x07 # lun in lower three bits
- or SAVED_TCL,A,SELID
- and SAVED_TCL,0xf7
- and A,0x08,SBLKCTL # B Channel??
- or SAVED_TCL,A
- call inb_last # ACK
- mov ALLZEROS call findSCB
-setup_SCB:
- and SCBARRAY+0,0xfb # clear disconnect bit in SCB
- or FLAGS,IDENTIFY_SEEN # make note of IDENTIFY
-
- call sg_scb2ram # implied restore pointers
- # required on reselect
- jmp ITloop
-get_tag:
- mvi A call inb_first
- cmp A,0x20 jne return # Simple Tag message?
- mvi A call inb_next
- call inb_last
- test A,0xf0 jnz abort_tag # Tag in range?
- mov SCBPTR,A
- mov A,SAVED_TCL
- cmp SCBARRAY+1,A jne abort_tag
- test SCBARRAY+0,TAG_ENB jz abort_tag
- ret
-abort_tag:
- or SINDEX,0x10,SIGSTATE # turn on ATNO
- call scsisig
- mvi INTSTAT,ABORT_TAG # let driver know
- mvi 0xd call mk_mesg # ABORT TAG message
- ret
-
-# Message reject? Let the kernel driver handle this. If we have an
-# outstanding WDTR or SDTR negotiation, assume that it's a response from
-# the target selecting 8bit or asynchronous transfer, otherwise just ignore
-# it since we have no clue what it pertains to.
-#
-p_mesgin6:
- cmp A,7 jne p_mesgin7 # message reject code?
-
- mvi INTSTAT, MSG_REJECT
- jmp p_mesgin_done
-
-# [ ADD MORE MESSAGE HANDLING HERE ]
-#
-p_mesgin7:
-
-# We have no idea what this message in is, and there's no way
-# to pass it up to the kernel, so we issue a message reject and
-# hope for the best. Since we're now using manual PIO mode to
-# read in the message, there should no longer be a race condition
-# present when we assert ATN. In any case, rejection should be a
-# rare occurrence - signal the driver when it happens.
-#
-p_mesginN:
- or SINDEX,0x10,SIGSTATE # turn on ATNO
- call scsisig
- mvi INTSTAT,SEND_REJECT # let driver know
-
- mvi 0x7 call mk_mesg # MESSAGE REJECT message
-
-p_mesgin_done:
- call inb_last # ack & turn auto PIO back on
- jmp ITloop
-
-
-# Bus free phase. It might be useful to interrupt the device
-# driver if we aren't expecting this. For now, make sure that
-# ATN isn't being asserted and look for a new command.
-#
-p_busfree:
- mvi CLRSINT1,0x40 # CLRATNO
- clr SIGSTATE
- jmp start
-
-# Instead of a generic bcopy routine that requires an argument, we unroll
-# the two cases that are actually used, and call them explicitly. This
-# not only reduces the overhead of doing a bcopy by 2/3rds, but ends up
-# saving space in the program since you don't have to put the argument
-# into the accumulator before the call. Both functions expect DINDEX to
-# contain the destination address and SINDEX to contain the source
-# address.
-bcopy_3:
- mov DINDIR,SINDIR
- mov DINDIR,SINDIR
- mov DINDIR,SINDIR ret
-
-bcopy_4:
- mov DINDIR,SINDIR
- mov DINDIR,SINDIR
- mov DINDIR,SINDIR
- mov DINDIR,SINDIR ret
-
-bcopy_3_dfdat:
- mov DINDIR,DFDAT
- mov DINDIR,DFDAT
- mov DINDIR,DFDAT ret
-
-bcopy_4_dfdat:
- mov DINDIR,DFDAT
- mov DINDIR,DFDAT
- mov DINDIR,DFDAT
- mov DINDIR,DFDAT ret
-
-# Locking the driver out, build a one-byte message passed in SINDEX
-# if there is no active message already. SINDEX is returned intact.
-#
-mk_mesg:
- mvi SEQCTL,0x50 # PAUSEDIS|FASTMODE
- test FLAGS,ACTIVE_MSG jnz mk_mesg1 # active message?
-
- or FLAGS,ACTIVE_MSG # if not, there is now
- mvi MSG_LEN,1 # length = 1
- mov MSG_START+0,SINDEX # 1-byte message
-
-mk_mesg1:
- mvi SEQCTL,0x10 ret # !PAUSEDIS|FASTMODE
-
-# Carefully read data in Automatic PIO mode. I first tried this using
-# Manual PIO mode, but it gave me continual underrun errors, probably
-# indicating that I did something wrong, but I feel more secure leaving
-# Automatic PIO on all the time.
-#
-# According to Adaptec's documentation, an ACK is not sent on input from
-# the target until SCSIDATL is read from. So we wait until SCSIDATL is
-# latched (the usual way), then read the data byte directly off the bus
-# using SCSIBUSL. When we have pulled the ATN line, or we just want to
-# acknowledge the byte, then we do a dummy read from SCISDATL. The SCSI
-# spec guarantees that the target will hold the data byte on the bus until
-# we send our ACK.
-#
-# The assumption here is that these are called in a particular sequence,
-# and that REQ is already set when inb_first is called. inb_{first,next}
-# use the same calling convention as inb.
-#
-inb_first:
- clr STCNT+2
- clr STCNT+1
- mov DINDEX,SINDEX
- mov DINDIR,SCSIBUSL ret # read byte directly from bus
-
-inb_next:
- mov DINDEX,SINDEX # save SINDEX
-
- mvi STCNT+0,1 # xfer one byte
- mov NONE,SCSIDATL # dummy read from latch to ACK
-inb_next1:
- test SSTAT0,0x4 jz inb_next1 # SDONE
-inb_next2:
- test SSTAT0,0x2 jz inb_next2 # SPIORDY - wait for next byte
- mov DINDIR,SCSIBUSL ret # read byte directly from bus
-
-inb_last:
- mvi STCNT+0,1 # ACK with dummy read
- mov NONE,SCSIDATL
-inb_last1:
- test SSTAT0,0x4 jz inb_last1 # wait for completion
- ret
-
-# DMA data transfer. HADDR and HCNT must be loaded first, and
-# SINDEX should contain the value to load DFCNTRL with - 0x3d for
-# host->scsi, or 0x39 for scsi->host. The SCSI channel is cleared
-# during initialization.
-#
-dma:
- mov DFCNTRL,SINDEX
-dma1:
-dma2:
- test SSTAT0,0x1 jnz dma3 # DMADONE
- test SSTAT1,0x10 jz dma1 # PHASEMIS, ie. underrun
-
-# We will be "done" DMAing when the transfer count goes to zero, or
-# the target changes the phase (in light of this, it makes sense that
-# the DMA circuitry doesn't ACK when PHASEMIS is active). If we are
-# doing a SCSI->Host transfer, the data FIFO should be flushed auto-
-# magically on STCNT=0 or a phase change, so just wait for FIFO empty
-# status.
-#
-dma3:
- test SINDEX,0x4 jnz dma5 # DIRECTION
-dma4:
- test DFSTATUS,0x1 jz dma4 # !FIFOEMP
-
-# Now shut the DMA enables off, and copy STCNT (ie. the underrun
-# amount, if any) to the SCB registers; SG_COUNT will get copied to
-# the SCB's residual S/G count field after sg_advance is called. Make
-# sure that the DMA enables are actually off first lest we get an ILLSADDR.
-#
-dma5:
- clr DFCNTRL # disable DMA
-dma6:
- test DFCNTRL,0x38 jnz dma6 # SCSIENACK|SDMAENACK|HDMAENACK
-
- mvi DINDEX,SCBARRAY+15
- mvi STCNT call bcopy_3
-
- ret
-
-dma_finish:
- test DFSTATUS,0x8 jz dma_finish # HDONE
-
- clr DFCNTRL # disable DMA
-dma_finish2:
- test DFCNTRL,0x8 jnz dma_finish2 # HDMAENACK
- ret
-
-# Common SCSI initialization for selection and reselection. Expects
-# the target SCSI ID to be in the upper four bits of SINDEX, and A's
-# contents are stomped on return.
-#
-initialize:
- and SINDEX,0xf0 # Get target ID
- and A,0x0f,SCSIID
- or SINDEX,A
- mov SCSIID,SINDEX
-
-# Esundry initialization.
-#
- clr DROPATN
- clr SIGSTATE
-
-# Turn on Automatic PIO mode now, before we expect to see a REQ
-# from the target. It shouldn't hurt anything to leave it on. Set
-# CLRCHN here before the target has entered a data transfer mode -
-# with synchronous SCSI, if you do it later, you blow away some
-# data in the SCSI FIFO that the target has already sent to you.
-#
- mvi SXFRCTL0,0x8a # DFON|SPIOEN|CLRCHN
-
-# Initialize scatter-gather pointers by setting up the working copy
-# in scratch RAM.
-#
- call sg_scb2ram
-
-# Initialize SCSIRATE with the appropriate value for this target.
-#
- call ndx_dtr
- mov SCSIRATE,SINDIR ret
-
-# Assert that if we've been reselected, then we've seen an IDENTIFY
-# message.
-#
-assert:
- test FLAGS,RESELECTED jz return # reselected?
- test FLAGS,IDENTIFY_SEEN jnz return # seen IDENTIFY?
-
- mvi INTSTAT,NO_IDENT ret # no - cause a kernel panic
-
-# Find out if disconnection is ok from the information the BIOS has left
-# us. The tcl from SCBARRAY+1 should be in SINDEX; A will
-# contain either 0x40 (disconnection ok) or 0x00 (disconnection not ok)
-# on exit.
-#
-# To allow for wide or twin busses, we check the upper bit of the target ID
-# and the channel ID and look at the appropriate disconnect register.
-#
-disconnect:
- and FUNCTION1,0x70,SINDEX # strip off extra just in case
- mov A,FUNCTION1
- test SINDEX, 0x88 jz disconnect_a
-
- test DISC_DSB_B,A jz disconnect1 # bit nonzero if DISabled
- clr A ret
-
-disconnect_a:
- test DISC_DSB_A,A jz disconnect1 # bit nonzero if DISabled
- clr A ret
-
-disconnect1:
- mvi A,0x40 ret
-
-# Locate the SCB matching the target ID/channel/lun in SAVED_TCL and switch
-# the SCB to it. Have the kernel print a warning message if it can't be
-# found, and generate an ABORT message to the target. SINDEX should be
-# cleared on call.
-#
-findSCB:
- mov A,SAVED_TCL
- mov SCBPTR,SINDEX # switch to new SCB
- cmp SCBARRAY+1,A jne findSCB1 # target ID/channel/lun match?
- test SCBARRAY+0,0x4 jz findSCB1 # should be disconnected
- test SCBARRAY+0,TAG_ENB jnz get_tag
- ret
-
-findSCB1:
- inc SINDEX
- mov A,SCBCOUNT
- cmp SINDEX,A jne findSCB
-
- mvi INTSTAT,NO_MATCH # not found - signal kernel
- mvi 0x6 call mk_mesg # ABORT message
-
- or SINDEX,0x10,SIGSTATE # assert ATNO
- call scsisig
- ret
-
-# Make a working copy of the scatter-gather parameters in the SCB.
-#
-sg_scb2ram:
- mov SG_COUNT,SCBARRAY+2
-
- mvi DINDEX,SG_NEXT
- mvi SCBARRAY+3 call bcopy_4
-
- mvi SG_NOLOAD,0x80
- test SCBARRAY+0,0x10 jnz return # don't reload s/g?
- clr SG_NOLOAD ret
-
-# Copying RAM values back to SCB, for Save Data Pointers message.
-#
-sg_ram2scb:
- mov SCBARRAY+2,SG_COUNT
-
- mvi DINDEX,SCBARRAY+3
- mvi SG_NEXT call bcopy_4
-
- and SCBARRAY+0,0xef,SCBARRAY+0
- test SG_NOLOAD,0x80 jz return # reload s/g?
- or SCBARRAY+0,SG_LOAD ret
-
-# Load a struct scatter if needed and set up the data address and
-# length. If the working value of the SG count is nonzero, then
-# we need to load a new set of values.
-#
-# This, like the above DMA, assumes a little-endian host data storage.
-#
-sg_load:
- test SG_COUNT,0xff jz return # SG being used?
- test SG_NOLOAD,0x80 jnz return # don't reload s/g?
-
- clr HCNT+2
- clr HCNT+1
- mvi HCNT+0,SG_SIZEOF
-
- mvi DINDEX,HADDR
- mvi SG_NEXT call bcopy_4
-
- mvi DFCNTRL,0xd # HDMAEN|DIRECTION|FIFORESET
-
-# Wait for DMA from host memory to data FIFO to complete, then disable
-# DMA and wait for it to acknowledge that it's off.
-#
-
- call dma_finish
-
-# Copy data from FIFO into SCB data pointer and data count. This assumes
-# that the struct scatterlist has this structure (this and sizeof(struct
-# scatterlist) == 12 are asserted in aic7xxx.c):
-#
-# struct scatterlist {
-# char *address; /* four bytes, little-endian order */
-# ... /* four bytes, ignored */
-# unsigned short length; /* two bytes, little-endian order */
-# }
-#
-
-# Not in FreeBSD. the scatter list entry is only 8 bytes.
-#
-# struct ahc_dma_seg {
-# physaddr addr; /* four bytes, little-endian order */
-# long len; /* four bytes, little endian order */
-# };
-#
-
- mvi DINDEX, SCBARRAY+19
- call bcopy_4_dfdat
-
-# For Linux, we must throw away four bytes since there is a 32bit gap
-# in the middle of a struct scatterlist
-# mov NONE,DFDAT
-# mov NONE,DFDAT
-# mov NONE,DFDAT
-# mov NONE,DFDAT
-
- call bcopy_3_dfdat #Only support 24 bit length.
- ret
-
-# Advance the scatter-gather pointers only IF NEEDED. If SG is enabled,
-# and the SCSI transfer count is zero (note that this should be called
-# right after a DMA finishes), then move the working copies of the SG
-# pointer/length along. If the SCSI transfer count is not zero, then
-# presumably the target is disconnecting - do not reload the SG values
-# next time.
-#
-sg_advance:
- test SG_COUNT,0xff jz return # s/g enabled?
-
- test STCNT+0,0xff jnz sg_advance1 # SCSI transfer count nonzero?
- test STCNT+1,0xff jnz sg_advance1
- test STCNT+2,0xff jnz sg_advance1
-
- clr SG_NOLOAD # reload s/g next time
- dec SG_COUNT # one less segment to go
-
- clr A # add sizeof(struct scatter)
- add SG_NEXT+0,SG_SIZEOF,SG_NEXT+0
- adc SG_NEXT+1,A,SG_NEXT+1
- adc SG_NEXT+2,A,SG_NEXT+2
- adc SG_NEXT+3,A,SG_NEXT+3 ret
-
-sg_advance1:
- mvi SG_NOLOAD,0x80 ret # don't reload s/g next time
-
-# Add the array base SYNCNEG to the target offset (the target address
-# is in SCSIID), and return the result in SINDEX. The accumulator
-# contains the 3->8 decoding of the target ID on return.
-#
-ndx_dtr:
- shr A,SCSIID,4
- test SBLKCTL,0x08 jz ndx_dtr_2
- or A,0x08 # Channel B entries add 8
-ndx_dtr_2:
- add SINDEX,SYNCNEG,A
-
- and FUNCTION1,0x70,SCSIID # 3-bit target address decode
- mov A,FUNCTION1 ret
-
-# If we need to negotiate transfer parameters, build the WDTR or SDTR message
-# starting at the address passed in SINDEX. DINDEX is modified on return.
-# The SCSI-II spec requires that Wide negotiation occur first and you can
-# only negotiat one or the other at a time otherwise in the event of a message
-# reject, you wouldn't be able to tell which message was the culpret.
-#
-mk_dtr:
- test SCBARRAY+0,0xc0 jz return # NEEDWDTR|NEEDSDTR
- test SCBARRAY+0,NEEDWDTR jnz mk_wdtr_16bit
- or FLAGS, MAX_SYNC # Force an offset of 15
-
-mk_sdtr:
- mvi DINDIR,1 # extended message
- mvi DINDIR,3 # extended message length = 3
- mvi DINDIR,1 # SDTR code
- call sdtr_to_rate
- mov DINDIR,RETURN_1 # REQ/ACK transfer period
- test FLAGS, MAX_SYNC jnz mk_sdtr_max_sync
- and DINDIR,0xf,SINDIR # Sync Offset
-
-mk_sdtr_done:
- add MSG_LEN,-MSG_START+0,DINDEX ret # update message length
-
-mk_sdtr_max_sync:
-# We're initiating sync negotiation, so request the max offset we can (15)
- mvi DINDIR, 0x0f
- xor FLAGS, MAX_SYNC
- jmp mk_sdtr_done
-
-mk_wdtr_16bit:
- mvi ARG_1,BUS_16_BIT
-mk_wdtr:
- mvi DINDIR,1 # extended message
- mvi DINDIR,2 # extended message length = 2
- mvi DINDIR,3 # WDTR code
- mov DINDIR,ARG_1 # bus width
-
- add MSG_LEN,-MSG_START+0,DINDEX ret # update message length
-
-# Set SCSI bus control signal state. This also saves the last-written
-# value into a location where the higher-level driver can read it - if
-# it has to send an ABORT or RESET message, then it needs to know this
-# so it can assert ATN without upsetting SCSISIGO. The new value is
-# expected in SINDEX. Change the actual state last to avoid contention
-# from the driver.
-#
-scsisig:
- mov SIGSTATE,SINDEX
- mov SCSISIGO,SINDEX ret
-
-sdtr_to_rate:
- call ndx_dtr # index scratch space for target
- shr A,SINDIR,0x4
- dec SINDEX #Preserve SINDEX
- and A,0x7
- clr RETURN_1
-sdtr_to_rate_loop:
- test A,0x0f jz sdtr_to_rate_done
- add RETURN_1,0x18
- dec A
- jmp sdtr_to_rate_loop
-sdtr_to_rate_done:
- shr RETURN_1,0x2
- add RETURN_1,0x18 ret
-
-return:
- ret
diff --git a/sys/gnu/scsi/nic5000.c b/sys/gnu/scsi/nic5000.c
deleted file mode 100644
index d4271df..0000000
--- a/sys/gnu/scsi/nic5000.c
+++ /dev/null
@@ -1,1476 +0,0 @@
-static char rcsid[] = "@(#)$Id: nic5000.c,v 1.1 1995/02/14 15:00:37 jkh Exp $";
-/*******************************************************************************
- * II - Version 0.1 $Revision: 1.1 $ $State: Exp $
- *
- * Copyright 1994 Dietmar Friede
- *******************************************************************************
- * Bug reports, patches, comments, suggestions should be sent to:
- *
- * jkr@saarlink.de or jkrause@guug.de
- *
- *******************************************************************************
- * $Log: nic5000.c,v $
- * Revision 1.1 1995/02/14 15:00:37 jkh
- * An ISDN driver that supports the EDSS1 and the 1TR6 ISDN interfaces.
- * EDSS1 is the "Euro-ISDN", 1TR6 is the soon obsolete german ISDN Interface.
- * Obtained from: Dietmar Friede <dfriede@drnhh.neuhaus.de> and
- * Juergen Krause <jkr@saarlink.de>
- *
- * This is only one part - the rest to follow in a couple of hours.
- * This part is a benign import, since it doesn't affect anything else.
- *
- *
- ******************************************************************************/
-
-/*
- *
- * Copyright (c) 1994 Dietmar Friede (dietmar@friede.de) All rights reserved.
- * FSF/FSAG GNU Copyright applies
- *
- * A low level driver for the NICCY-5000 ISDN/SCSI device
- *
- */
-
-#include "snic.h"
-#if NSNIC > 0
-
-#define SPLSNIC splbio
-#define ESUCCESS 0
-#define SNIC_RETRIES 8
-#include "sys/types.h"
-#include "sys/param.h"
-#include "sys/ioctl.h"
-#include "sys/malloc.h"
-#include "sys/kernel.h"
-
-#include "scsi/scsi_all.h"
-#include "scsi/scsiconf.h"
-#include "gnu/isdn/isdn_ioctl.h"
-#include "gnu/i386/isa/niccyreg.h"
-#include "gnu/scsi/scsi_nic.h"
-/* #define NETBSD */
-
-#undef SCSI_NOMASK
-#define OPEN 1
-#define LOAD_HEAD 2
-#define LOAD_DATA 4
-#define LOAD_ENTITY 8
-#define IS_DIAL(p) (((p)&0x20)==0)
-#define IS_LISTEN(p) ((p)&0x20)
-#define CHAN(pl) (((pl)&7)-1)
-#define C_CHAN(x) ((x)&1)
-#define APPL(pl) ((((pl)>>6)&0x7f)-1)
-#define CARD(pl) (((pl)>>13)&7)
-#define MK_APPL(pl) (((pl)+1)<<6)
-#define min(a,b) ((a)<(b)?(a):(b))
-
-#define SNICOUTSTANDING 2
-
-extern int hz;
-
-struct snic_data
-{
- struct scsi_switch *sc_sw; /* address of scsi low level switch */
- int ctrl; /* so they know which one we want */
- int targ; /* our scsi target ID */
- int lu; /* out scsi lu */
- int cmdscount; /* cmds allowed outstanding by board*/
- int xfer_block_wait;
- struct scsi_xfer *free_xfer;
- struct scsi_xfer scsi_xfer[SNICOUTSTANDING]; /* XXX */
-};
-
-struct snic_driver
-{
- int size;
- struct snic_data **snic_data;
-}*snic_driver;
-
-static int next_snic_unit = 0;
-static unsigned dnlnum = 0;
-
-static u_char ack_msg= 0xff;
-static u_char snic_nxt_b;
-
-typedef enum
-{
- DISCON, ISDISCON, DIAL, CALLED, CONNECT, IDLE, ACTIVE, WAITING, WAIT_ACK
-} io_state;
-
-typedef struct
-{
- char ctrl;
- u_char msg_nr;
- short plci;
- short ncci;
- short state;
- Buffer o_buf;
-} chan_t;
-
-struct snic_softc
-{
- short sc_stat;
- u_char sc_flags;
- u_char sc_unit;
- u_char sc_ctrl;
- u_char sc_type;
- u_short sc_istat;
- struct scsi_msg sc_icmd;
- Buffer sc_imsg;
- Header sc_imsg0;
- u_short sc_ostat;
- struct scsi_msg sc_ocmd;
- Buffer sc_omsg;
- chan_t sc_chan[2];
- u_char sc_state_ind[8];
- u_char sc_gotack;
-} snic_sc[NSNIC];
-
-extern isdn_appl_t isdn_appl[];
-extern isdn_ctrl_t isdn_ctrl[];
-extern u_short isdn_state;
-extern int ispy_applnr;
-extern int Isdn_Appl, Isdn_Ctrl, Isdn_Typ;
-extern void isdn_start_out();
-
-static old_spy= 0;
-static void snic_interupt();
-static int snic_get_msg();
-static void snic_start();
-
-int snic_connect(), snic_listen(), snic_disconnect(), snic_accept();
-int snic_output();
-
-#ifdef NETBSD
-int snicattach(int ctrl, struct scsi_switch *scsi_switch, int physid, int *sunit)
-{
- int targ, lu;
-#else /* FreeBSD */
-int snicattach(int ctrl, int targ, int lu, struct scsi_switch *scsi_switch)
-{
-#endif
- int unit,i;
- struct snic_data *snic, **snicrealloc;
- struct snic_softc *sc;
- int cn;
- isdn_ctrl_t *ctrl0, *ctrl1;
-
-#ifdef NETBSD
- targ = physid >> 3;
- lu = physid & 7;
-#endif
-
- if(next_snic_unit >= NSNIC)
- return(0);
-
- unit = next_snic_unit;
- if (next_snic_unit == 0)
- {
- snic_driver =
- malloc(sizeof(struct snic_driver),M_DEVBUF,M_NOWAIT);
- if(!snic_driver)
- {
- printf("snic%d: malloc failed\n",unit);
- return(0);
- }
- bzero(snic_driver,sizeof(snic_driver));
- snic_driver->size = 0;
- }
- next_snic_unit++;
-
- if(unit >= snic_driver->size)
- {
- snicrealloc =
- malloc(sizeof(snic_driver->snic_data) * next_snic_unit,
- M_DEVBUF,M_NOWAIT);
- if(!snicrealloc)
- {
- printf("snic%d: malloc failed\n",unit);
- return(0);
- }
- /* Make sure we have something to copy before we copy it */
- bzero(snicrealloc,sizeof(snic_driver->snic_data) * next_snic_unit);
- if(snic_driver->size)
- {
- bcopy(snic_driver->snic_data,snicrealloc,
- sizeof(snic_driver->snic_data) * snic_driver->size);
- free(snic_driver->snic_data,M_DEVBUF);
- }
- snic_driver->snic_data = snicrealloc;
- snic_driver->snic_data[unit] = NULL;
- snic_driver->size++;
- }
-
- if(snic_driver->snic_data[unit])
- {
- return(0);
- }
-
- snic = snic_driver->snic_data[unit] =
- malloc(sizeof(struct snic_data),M_DEVBUF,M_NOWAIT);
- if(!snic)
- {
- printf("snic%d: malloc failed\n",unit);
- return(0);
- }
-#ifdef NETBSD
- *sunit= unit;
-#endif
- bzero(snic,sizeof(struct snic_data));
-
- snic->sc_sw = scsi_switch;
- snic->ctrl = ctrl;
- snic->targ = targ;
- snic->lu = lu;
- snic->cmdscount = SNICOUTSTANDING; /* XXX (ask the board) */
-
- i = snic->cmdscount;
- while(i-- )
- {
- snic->scsi_xfer[i].next = snic->free_xfer;
- snic->free_xfer = &snic->scsi_xfer[i];
- }
-
- sc = &snic_sc[unit];
- sc->sc_ctrl = -1;
- sc->sc_gotack= 1;
- if ((cn = isdn_ctrl_attach(2)) == -1)
- {
- return (0);
- }
- sc->sc_ctrl = cn;
-
- sc->sc_chan[0].plci = sc->sc_chan[1].plci = -1;
-
- ctrl0 = &isdn_ctrl[cn];
- ctrl1 = &isdn_ctrl[cn + 1];
- sc->sc_chan[0].ctrl = ctrl0->ctrl = cn;
- sc->sc_chan[1].ctrl = ctrl1->ctrl = cn + 1;
- ctrl0->o_buf = &sc->sc_chan[0].o_buf.Data[5];
- ctrl1->o_buf = &sc->sc_chan[1].o_buf.Data[5];
-
- ctrl0->listen = ctrl1->listen = snic_listen;
- ctrl0->disconnect = ctrl1->disconnect = snic_disconnect;
- ctrl0->accept = ctrl1->accept = snic_accept;
- ctrl0->connect = ctrl1->connect = snic_connect;
- ctrl0->output = ctrl1->output = snic_output;
- ctrl0->unit = ctrl1->unit = unit;
- ctrl0->appl = ctrl1->appl = -1;
- ctrl0->o_len = ctrl1->o_len = -1;
- sc->sc_flags= LOAD_ENTITY;
- return(1);
-}
-
-static
-struct scsi_xfer *snic_get_xs(int unit)
-{
- struct scsi_xfer *xs;
- struct snic_data *snic;
- int s;
-
- snic = snic_driver->snic_data[unit];
- if (xs = snic->free_xfer)
- {
- snic->free_xfer = xs->next;
- xs->flags = 0;
- }
- return(xs);
-}
-
-static void
-snic_free_xs(int unit, struct scsi_xfer *xs)
-{
- struct snic_data *snic;
-
- snic = snic_driver->snic_data[unit];
- xs->next = snic->free_xfer;
- snic->free_xfer = xs;
-}
-
-static void
-snic_timout(int unit)
-{
- struct snic_softc * sc= &snic_sc[unit&0xff];
-
- if(sc->sc_istat&0x100)
- {
- snic_interupt(unit);
- return;
- }
- if(sc->sc_istat & 2)
- sc->sc_istat= sc->sc_ostat= 0;
- else if((sc->sc_istat & 0x200) == 0 ) return;
- if(sc->sc_ostat & 0xff)
- {
- sc->sc_istat|= 0x200;
- timeout(snic_timout,unit,2);
- return;
- }
- if(sc->sc_gotack) snic_start(unit);
- snic_get_msg(unit);
-}
-
-static int
-isdn_small_interupt(int unit, struct scsi_xfer *xs)
-{
- struct snic_data *snic = snic_driver->snic_data[unit];
- struct snic_softc * sc= &snic_sc[unit];
- Header *msg = &sc->sc_imsg0;
- int c;
-
- switch (msg->Type)
- {
- case 0:
- if(sc->sc_istat&0x200)
- break;
- sc->sc_istat|= 0x200;
- timeout(snic_timout,unit,2);
- break;
- case 0xff:
- sc->sc_gotack= 1;
- break;
- case 0xfe:
-printf("f");
- sc->sc_gotack= 1;
- for(c= 0; c < 2; c++)
- {
- chan_t *chan = &sc->sc_chan[c];
- if(chan->state == WAIT_ACK)
- {
- chan->state = WAITING;
- sc->sc_ostat |= c?0x800:0x400;
- }
- }
- break;
- case 0xfd:
-printf("fd");
- break;
- default:
- return(0);
- }
- sc->sc_istat&= ~0xff;
- sc->sc_imsg0.Type= 0;
- return(1);
-}
-
-static void
-snic_get_done(int unit, struct scsi_xfer *xs)
-{
- struct snic_data *snic = snic_driver->snic_data[unit];
- struct snic_softc * sc= &snic_sc[unit];
- Header *msg = &sc->sc_imsg0;
- int len, error;
-
- error= xs->error;
-
- switch(error)
- {
- case XS_NOERROR:
- if(xs->datalen == 0)
- sc->sc_imsg.h.Type= 0;
-
- if(isdn_small_interupt(unit,xs)) break;
-
- if(xs->datalen < (len=(msg->DataLen + 10)))
- {
- struct scsi_msg *scsi_cmd= &sc->sc_icmd;
- /* resubmit it */
-
- sc->sc_imsg.h.Type= 0xba;
- scsi_cmd->len[1]= (len>>8)&0xff;
- scsi_cmd->len[2]= len&0xff;
- xs->retries= SNIC_RETRIES;
- xs->error = XS_NOERROR;
- xs->flags &= ~ITSDONE;
- xs->data = (char *) &sc->sc_imsg;
- xs->datalen = len;
- xs->resid = len;
-
- if ((*(snic->sc_sw->scsi_cmd))(xs) == SUCCESSFULLY_QUEUED)
- {
- return;
- }
- error= xs->error | 0x1000;
- break;
- }
- if(xs->datalen <= 10)
- {
- sc->sc_istat|= 0x400;
- sc->sc_imsg.h = sc->sc_imsg0;
- }
- sc->sc_imsg0.Type= 0;
- break;
-
- case XS_TIMEOUT:
- case XS_BUSY:
- case XS_DRIVER_STUFFUP:
- break;
- default:
- printf("snic%d: unknown error %x\n",unit,xs->error);
- }
-
- if(error)
- {
- sc->sc_imsg.h.Type= sc->sc_imsg0.Type= 0;
- sc->sc_istat&= 0x200;
- if((sc->sc_istat&0x200) == 0)
- {
- sc->sc_istat= 0x200;
- timeout(snic_timout,unit,2);
- }
- }
-
- snic_free_xs(unit,xs);
- if(sc->sc_istat&0x4ff == 0x400 )
- sc->sc_istat|= 1;
- if(sc->sc_istat&0xff)
- {
- snic_interupt(unit);
- return;
- }
- if(sc->sc_gotack) snic_start(unit);
- if(sc->sc_istat & 0x200)
- return;
- sc->sc_istat|= 0x200;
- timeout(snic_timout,unit,2);
-}
-
-static int
-snic_get_msg(unit)
-int unit;
-{
- struct snic_data *snic = snic_driver->snic_data[unit];
- struct snic_softc * sc= &snic_sc[unit];
- struct scsi_msg *scsi_cmd= &sc->sc_icmd;
- struct scsi_xfer *xs;
- Header *data= &sc->sc_imsg0;
- int retval;
-
- if(sc->sc_istat&0xff)
- return(-1);
- sc->sc_istat |= 1;
-
- data->Type= 0xbb;
- sc->sc_istat &= ~0x200;
-
- bzero(scsi_cmd, sizeof(struct scsi_msg));
- bzero(data,10);
-
- scsi_cmd->op_code = GET_MSG_COMMAND;
- scsi_cmd->len[2]= 10;
-
- xs = snic_get_xs(unit);
- if(!xs)
- {
- sc->sc_istat&= ~0xff;
- data->Type= 0;
- return(EBUSY);
- }
-
- xs->flags |= (INUSE | SCSI_DATA_IN | SCSI_NOSLEEP);
- xs->adapter = snic->ctrl;
- xs->targ = snic->targ;
- xs->lu = snic->lu;
- xs->retries = SNIC_RETRIES;
- xs->timeout = 2000;
- xs->cmd = (struct scsi_generic *) scsi_cmd;
- xs->cmdlen = sizeof(struct scsi_msg);
- xs->data = (char *) data;
- xs->datalen = 10;
- xs->resid = 10;
- xs->when_done = snic_get_done;
- xs->done_arg = unit;
- xs->done_arg2 = (int)xs;
- xs->bp = NULL;
- xs->error = XS_NOERROR;
-
- if(retval = (*(snic->sc_sw->scsi_cmd))(xs))
- {
- sc->sc_istat= ~0xff;
- data->Type= 0;
- snic_free_xs(unit,xs);
- }
- return (retval);
-}
-
-static void
-snic_put_done(int unit, struct scsi_xfer *xs)
-{
- int retval;
- struct snic_data *snic = snic_driver->snic_data[unit];
- struct snic_softc * sc= &snic_sc[unit];
- Header *b= (Header *) xs->data;
- int c;
-
- sc->sc_ostat&= ~0xff;
- if(xs->error != XS_NOERROR)
- {
- snic_free_xs(unit,xs);
- switch(b->Type)
- {
- case 0:
- return;
- case 0xff:
- sc->sc_ostat|= 0x100;
- return;
- case BD_DATA_B3_REQ | 0x40:
- case BD_DATA_B3_REQ:
- sc->sc_ostat|= 0x400;
- return;
- default:
- sc->sc_ostat|= 0x200;
- return;
- }
- }
-
- snic_free_xs(unit,xs);
-
- c= 0;
- switch(b->Type)
- {
- case 0xff: break;
- case BD_DATA_B3_REQ | 0x40:
- c= 1;
- case BD_DATA_B3_REQ:
- sc->sc_chan[c].state = WAIT_ACK;
- break;
- default:
- b->Type= 0;
- }
-
- if(sc->sc_istat&0x100)
- {
- snic_interupt(unit);
- return;
- }
-
- if(sc->sc_ostat&0x100)
- {
- sc->sc_ostat&= ~0x100;
- if(snic_put_msg(unit,&ack_msg,1,0))
- sc->sc_ostat|= 0x100;
- else return;
- }
-
- if(sc->sc_gotack) snic_start(unit);
- if(sc->sc_istat&0x200)
- return;
- sc->sc_istat|= 0x200;
- timeout(snic_timout,unit,2);
-}
-
-static void
-snic_start(int unit)
-{
- int retval;
- struct snic_softc * sc= &snic_sc[unit];
- Header *b;
- int c;
-
- if(sc->sc_ostat&0x200)
- {
- b= &sc->sc_omsg.h;
- sc->sc_ostat&= ~0x200;
- if(snic_put_msg(unit,b, b->DataLen+10,2))
- sc->sc_ostat|= 0x200;
- else return;
- }
-
-
- for(c= 0; c<2; c++)
- {
- int cc= (snic_nxt_b++)&1;
- u_short m= 0x400 << cc;
-
- if(sc->sc_ostat&m)
- {
- chan_t *chan= &sc->sc_chan[cc];
- b= &chan->o_buf.h;
- sc->sc_ostat&= ~m;
- if(chan->state == WAITING)
- {
- chan->state= ACTIVE;
- if(snic_put_msg(unit,b, b->DataLen+10,4))
- {
- chan->state= WAITING;
- sc->sc_ostat|= m;
- }
- else return;
- }
- }
- }
-}
-
-int
-snic_put_msg(int unit, Header *data, unsigned len, int w)
-{
- struct snic_softc *sc = &snic_sc[unit];
- struct scsi_msg *scsi_cmd = &sc->sc_ocmd;
- int retval;
- struct scsi_xfer *xs;
- struct snic_data *snic = snic_driver->snic_data[unit];
-
- if(data->Type==0)
- return(0);
-
- if(sc->sc_ostat&0xff)
- return(EBUSY);
-
- sc->sc_ostat |= 1;
- if((data->Type == 0xa8) || (data->Type == 0xe8))
- {
- if(sc->sc_gotack==0)
- {
- sc->sc_ostat &= ~0xff;
- return(EBUSY);
- }
- }
- if(data->Type != 0xff)
- sc->sc_gotack= 0;
- bzero(scsi_cmd, sizeof(struct scsi_msg));
-
- scsi_cmd->op_code = PUT_MSG_COMMAND;
- if(len > 2063)
- {
- printf("snic%d: unsupported length %d\n",unit,len);
- sc->sc_ostat &= ~0xff;
- return(ENODEV);
- }
- scsi_cmd->len[1]= (len >> 8) & 0xff;
- scsi_cmd->len[2]= len & 0xff;
-
- xs = snic_get_xs(unit);
- if(!xs)
- {
- printf("snic pm%d: busy %d\n", unit, w);
- sc->sc_ostat &= ~0xff;
- return(EBUSY);
- }
- xs->flags |= (INUSE | SCSI_DATA_OUT | SCSI_NOSLEEP);
- xs->adapter = snic->ctrl;
- xs->targ = snic->targ;
- xs->lu = snic->lu;
- xs->retries = SNIC_RETRIES;
- xs->timeout = 2000;
- xs->cmd = (struct scsi_generic *) scsi_cmd;
- xs->cmdlen = sizeof(struct scsi_msg);
- xs->data = (char *)data;
- xs->datalen = len;
- xs->resid = len;
- xs->when_done = snic_put_done;
- xs->done_arg = unit;
- xs->done_arg2 = (int)xs;
- xs->bp = NULL;
- xs->error = XS_NOERROR;
-
- if(retval = (*(snic->sc_sw->scsi_cmd))(xs))
- {
- sc->sc_ostat &= ~0xff;
- snic_free_xs(unit,xs);
- return(EBUSY);
- }
-
- return(0);
-}
-
-int
-snicopen(dev_t dev, int flag)
-{
- struct snic_softc *sc;
- u_char unit;
- int x;
- unsigned error;
- u_char b= 0xff;
-
- unit = minor(dev);
- /* minor number out of limits ? */
- if (unit >= next_snic_unit)
- return (ENXIO);
- sc = &snic_sc[unit];
-
- x= splhigh();
- /* Card busy ? */
- if (sc->sc_flags & 7)
- {
- splx(x);
- return (EBUSY);
- }
- sc->sc_flags |= OPEN;
-
- if(sc->sc_flags & LOAD_ENTITY)
- {
- snic_get_msg(unit);
-/*
- if(snic_put_msg(unit,(Header *) &ack_msg,1,5))
- sc->sc_ostat|= 0x100;
-*/
- }
-
- splx(x);
- return (0);
-}
-
-int
-snicclose(dev_t dev, int flag)
-{
- struct snic_softc *sc = &snic_sc[minor(dev)];
-
- sc->sc_flags &= ~7;
- return (0);
-}
-
-int
-snicioctl(dev_t dev, int cmd, caddr_t data, int flag)
-{
- int error;
- u_char unit= minor(dev);
- int i, x;
- struct snic_softc *sc = &snic_sc[minor(dev)];
- Buffer *b= &sc->sc_omsg;
-
- error = 0;
- x= splhigh();
- while(sc->sc_ostat || (sc->sc_gotack==0))
- {
- error = tsleep((caddr_t) sc, PZERO | PCATCH, "ioctl", 2);
- if (error != EWOULDBLOCK)
- {
- splx(x);
- return(error);
- }
- }
-
- switch (cmd)
- {
- case NICCY_DEBUG:
- data[0]= 0x50;
- bcopy(sc->sc_state_ind,data+1,8);
- break;
- case NICCY_LOAD:
- {
- struct head *head = (struct head *) data;
- int len, l, off;
-
- bzero(b, 22);
- b->h.Type = MD_DNL_MOD_REQ;
- sc->sc_type = head->typ;
- b->h.SubType = head->typ;
- b->h.DataLen = 12;
- bcopy(head->nam, b->Data, 8);
- bcopy(&head->len, &b->Data[8], 4);
-
- sc->sc_flags |= LOAD_HEAD;
- sc->sc_stat = -1;
- while((error= snic_put_msg(unit,(Header *) b,22,6)) == EBUSY)
- {
- error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic1", 1);
- if (error != EWOULDBLOCK)
- break;
- }
- if(error == 0)
- {
- while (sc->sc_flags & LOAD_HEAD)
- {
- error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic2", 1);
- if (error != EWOULDBLOCK)
- break;
- error= 0;
- }
- }
- if (sc->sc_flags & 7)
- sc->sc_flags = (sc->sc_flags & ~7 ) | OPEN;
- if(error)
- {
- head->status = sc->sc_stat;
- splx(x);
- return (error);
- }
-
- len= head->d_len;
- off= 0;
- while(len > 0)
- {
- while(sc->sc_ostat || (sc->sc_gotack==0))
- {
- error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic7", 2);
- if (error != EWOULDBLOCK)
- {
- splx(x);
- return(error);
- }
- }
- bzero(b,10);
- b->h.Type = MD_DNL_MOD_DATA;
- sc->sc_type = head->typ;
- b->h.SubType = head->typ;
- l= min(len,512);
- len-= l;
- b->h.DataLen = l + 8;
- b->h.Number = dnlnum++;
- b->h.MoreData= len>0;
- bcopy(head->nam, b->Data, 8);
- if(error= copyin(head->data+off, b->Data+8, l))
- {
- splx(x);
- return(error);
- }
- off+= l;
- sc->sc_flags |= LOAD_DATA;
- sc->sc_stat = -1;
-
- while((error= snic_put_msg(unit,(Header *) b,b->h.DataLen+10,7)) == EBUSY)
- {
- error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic3", 1);
- if (error != EWOULDBLOCK)
- break;
- }
- }
-
- if(error == 0)
- {
- while (sc->sc_flags & LOAD_DATA)
- {
- error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic4", 1);
- if (error != EWOULDBLOCK)
- break;
- error= 0;
- }
- }
- if (sc->sc_flags & 7)
- sc->sc_flags = (sc->sc_flags & ~7 ) | OPEN;
- head->status = sc->sc_stat;
- splx(x);
- return (error);
- }
- case NICCY_SET_CLOCK:
- bzero(b,10);
- b->h.Type = MD_SET_CLOCK_REQ;
- b->h.DataLen = 14;
- bcopy(data, b->Data,14);
- while((error= snic_put_msg(unit,(Header *) b,24,8)) == EBUSY)
- {
- error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic5", 1);
- if (error != EWOULDBLOCK)
- break;
- }
- splx(x);
- return (error);
- case NICCY_SPY:
- bzero(b,10);
- b->h.Type = MD_MANUFACT_REQ;
- b->h.SubType = 18;
- b->h.DataLen = 1;
-/* There are ilegal states. So I use them to toggle */
- if((data[0] == 0) && (old_spy == 0)) data[0]= 255;
- else if(data[0] && old_spy ) data[0]= 0;
- old_spy= b->Data[0]= data[0];
- while((error= snic_put_msg(unit,(Header *) b,11,9)) == EBUSY)
- {
- error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic6", 1);
- if (error != EWOULDBLOCK)
- break;
- }
- splx(x);
- return (error);
- case NICCY_RESET:
- bzero(b,10);
- b->h.Type = MD_RESET_REQ;
- while((error= snic_put_msg(unit,(Header *) b,10,9)) == EBUSY)
- {
- error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic6", 1);
- if (error != EWOULDBLOCK)
- break;
- }
- sc->sc_flags|= LOAD_ENTITY;
- splx(x);
- return (error);
-
- default:
- error = ENODEV;
- }
- splx(x);
- return (error);
-}
-
-#define con_b3_req(unit,mb,pl) en_q(unit,mb|BD_CONN_B3_REQ,0,pl,0,NULL)
-#define con_act_resp(unit,pl) en_q(unit,DD_CONN_ACT_RSP,0, pl,0,NULL)
-#define discon_resp(sc,pl) en_q(unit,DD_DISC_RSP,0, pl,0,NULL)
-#define inf_resp(unit,pl) en_q(unit,DD_INFO_RSP,0, pl,0,NULL)
-#define listen_b3_req(unit,mb,pl) en_q(unit,mb|BD_LIST_B3_REQ,0,pl,0,NULL)
-#define con_resp(unit,pl,rea) en_q(unit,DD_CONN_RSP,0, pl, 1,(u_char *) &rea)
-
-static int
-en_q(int unit, int t, int st, int pl, int l, u_char *val)
-{
- struct snic_softc * sc= &snic_sc[unit];
- Buffer *b= &sc->sc_omsg;
- int error= 0;
-
- if(b->h.Type)
- {
- return(EBUSY);
- }
- bzero(b,10);
-if(( t >= 0x80) && CHAN(pl) && ((t & 0x40) == 0))
-printf("?%x %x",t,pl);
-if(t>=0x40)
-printf("S%x %x",t,pl);
-
- b->h.Type = t;
- b->h.SubType = st;
- b->h.PLCI = pl;
- if(l)
- {
- b->h.DataLen= l;
- bcopy(val,b->Data,l);
- }
-
- if((error= snic_put_msg(unit,(Header *) b,10+l,13)) == EBUSY)
- {
- sc->sc_ostat|= 0x200;
- return(0);
- }
- return(error);
-}
-
-static int
-reset_plci(int w, chan_t * chan, short p)
-{
- isdn_ctrl_t *ctrl;
-
- if (p == -1)
- return (-1);
-
- if(chan == NULL)
- return(p);
-
- ctrl = &isdn_ctrl[chan->ctrl];
- if(chan->plci == p)
- {
- if (ISBUSY(ctrl->appl))
- {
- isdn_disconn_ind(ctrl->appl);
- isdn_appl[ctrl->appl].ctrl = -1;
- isdn_appl[ctrl->appl].state = 0;
- }
- ctrl->appl = -1;
- ctrl->o_len = -1;
- chan->plci = -1;
- chan->ncci = -1;
- chan->state = DISCON;
- chan->o_buf.h.Type= 0;
- }
- return (p);
-}
-
-static int
-sel_b2_prot_req(int unit, int c, int pl, dlpd_t * dlpd)
-{
- return(en_q(unit, (c ? 0x40 : 0)| BD_SEL_PROT_REQ, 2, pl, sizeof(dlpd_t), (u_char *) dlpd));
-}
-
-static int
-sel_b3_prot_req(int unit, int mb, u_short pl, ncpd_t * ncpd)
-{
- return(en_q(unit, mb | BD_SEL_PROT_REQ, 3, pl, sizeof(ncpd_t), (u_char *) ncpd));
-}
-
-static int
-discon_req(int w, int unit , int pl, int rea, int err)
-{
- if((pl == 0) || (pl == -1))
- return(0);
- return(en_q(unit, DD_DISC_REQ,0, pl, 1, (u_char *) &rea));
-}
-
-static int
-state_ind(int unit, int api, int spv)
-{
- u_char buf[3];
-
- buf[0]= unit; buf[1]= api; buf[2]= spv;
- return(en_q(unit, MD_STATE_IND,0, 0, 3, buf));
-}
-
-static int
-con_b3_resp(int unit, int mb, u_short ncci, u_short pl, u_char reject)
-{
- u_char buf[32];
- int l = 4;
-
- bzero(buf, 32);
- *(u_short *) buf = ncci;
- buf[2] = reject;
- buf[3] = 0; /* ncpi ??? */
- l += 15;
- return(en_q(unit, mb | BD_CONN_B3_RSP,0, pl, l, buf));
-}
-
-int
-snic_connect(int cn, int ap, int b_channel, int inf_mask, int out_serv
- ,int out_serv_add, int src_subadr, unsigned ad_len
- ,char *dest_addr, int spv)
-{
- char buf[128];
-
- if (ad_len > 118)
- return (-1);
-
- buf[0] = spv ? 0x53 : 0;
- buf[1] = b_channel;
- if (spv)
- inf_mask |= 0x40000000;
- *(u_long *) & buf[2] = inf_mask;
- buf[6] = out_serv;
- buf[7] = out_serv_add;
- buf[8] = src_subadr;
- buf[9] = ad_len;
- bcopy(dest_addr, &buf[10], ad_len);
- return (en_q(isdn_ctrl[cn].unit, DD_CONN_REQ, 0, MK_APPL(ap), ad_len + 10, buf));
-}
-
-int
-snic_listen(int cn, int ap, int inf_mask, int subadr_mask, int si_mask, int spv)
-{
- u_short sbuf[4];
-
- if (spv)
- inf_mask |= 0x40000000;
- *(u_long *) sbuf = inf_mask;
- sbuf[2] = subadr_mask;
- sbuf[3] = si_mask;
- return (en_q(isdn_ctrl[cn].unit, DD_LISTEN_REQ, 0, MK_APPL(ap), 8, (u_char *) sbuf));
-}
-
-int
-snic_disconnect(int cn, int rea)
-{
- isdn_ctrl_t *ctrl = &isdn_ctrl[cn];
- chan_t *chan = &snic_sc[ctrl->unit].sc_chan[C_CHAN(cn)];
- int p, err;
- u_char buf[16];
-
- if(chan->ncci != -1)
- {
- bzero(buf,16);
- *(u_short *) buf = chan->ncci;
- err= en_q(ctrl->unit, (C_CHAN(cn)?0x40:0)|BD_DISC_B3_REQ, 0
- , chan->plci, 3+sizeof(ncpi_t), buf);
- if((err==0) && (ctrl->o_len == 0))
- ctrl->o_len= -1;
- return(err);
- }
- p = chan->plci;
- if ((p == 0) || (p == -1))
- return (ENODEV);
-
- err= en_q(ctrl->unit, DD_DISC_REQ, 0, p, 1, (u_char *) &rea);
- if((err==0) && (ctrl->o_len == 0))
- ctrl->o_len= -1;
- return(err);
-}
-
-int
-snic_accept(int cn, int an, int rea)
-{
- isdn_ctrl_t *ctrl = &isdn_ctrl[cn];
- struct snic_softc *sc = &snic_sc[ctrl->unit];
- chan_t *chan = &sc->sc_chan[C_CHAN(cn)];
- isdn_appl_t *appl = &isdn_appl[an];
-
- if(ISFREE(ctrl->appl))
- return(ENODEV);
-
- if (rea)
- {
- ctrl->appl= -1;
- return(discon_req(1, ctrl->unit, chan->plci, rea, 0));
- }
- ctrl->appl= an;
- ctrl->lastact = time.tv_sec;
- appl->ctrl= cn;
- appl->state= 4;
-
- return(sel_b2_prot_req(ctrl->unit, C_CHAN(cn), chan->plci, &appl->dlpd));
-}
-
-int
-snic_output(int cn)
-{
- isdn_ctrl_t *ctrl = &isdn_ctrl[cn];
- struct snic_softc *sc = &snic_sc[ctrl->unit];
- chan_t *chan = &sc->sc_chan[C_CHAN(cn)];
- int len= ctrl->o_len;
- Buffer *b= &chan->o_buf;
- int error= 0;
-
- if (sc->sc_state_ind[1] || (chan->ncci == -1))
- return (ENODEV);
-
- if(chan->state != IDLE)
- return(EBUSY);
- chan->state= WAITING;
-
- bzero(b,10);
-
- b->h.Type = BD_DATA_B3_REQ;
- if(C_CHAN(cn)) b->h.Type |= 0x40;
- b->h.PLCI = chan->plci;
- b->h.DataLen= len+5;
- *(u_short *) b->Data = chan->ncci;
- *(u_short *) &b->Data[2] = 0;
- b->h.Number = b->Data[4] = chan->msg_nr++;
-
- chan->state = ACTIVE;
- ctrl->lastact = time.tv_sec;
-
- if((error= snic_put_msg(ctrl->unit,(Header *) b,15+len,14)) == EBUSY)
- {
- sc->sc_ostat|= C_CHAN(cn)?0x800:0x400;
- chan->state= WAITING;
- return(0);
- }
- return(error);
-}
-
-static void
-badstate(Header *h, int n)
-{
- int i;
- u_char *p= (u_char *)h;
- printf("Niccy: not implemented %x.%x len %d at %d", h->Type,
- h->SubType, h->DataLen,n);
- if(h->DataLen)
- {
- p+= 10;
- for(i=0; i < h->DataLen ; i++) printf(" %x",p[i]);
- }
- printf("\n");
-}
-
-unsigned SavMsgTyp;
-
-static void
-snic_interupt(unsigned unit)
-{
- struct snic_softc * sc= &snic_sc[unit&0xff];
- Buffer *msg;
- chan_t *chan;
- u_short n, mb, c, pl, err = 0;
- isdn_ctrl_t *ctrl;
- isdn_appl_t *appl;
- int error= 0;
-
- msg = &sc->sc_imsg;
- chan= NULL;
- ctrl= NULL;
- appl= NULL;
-
-SavMsgTyp= msg->h.Type;
-
- if(sc->sc_istat & 2)
- return;
-
- if(sc->sc_ostat&0xff)
- {
- sc->sc_istat|= 0x101;
- if(sc->sc_istat&0x200)
- return;
- sc->sc_istat|= 0x200;
- timeout(snic_timout,unit,2);
- return;
- }
-
- mb= 0;
- pl = msg->h.PLCI;
- if(pl && (msg->h.Type >= 0x40) && (msg->h.Type < 0xfd) && (msg->h.Type != 0x47))
- {
- if ((c = CHAN(pl)) < 2)
- {
- chan = &sc->sc_chan[c];
- ctrl = &isdn_ctrl[chan->ctrl];
- } else
- {
- c = 0xffff;
- chan= NULL;
- ctrl= NULL;
- }
-
- if(ctrl && (ctrl->appl & 0xC0) == 0)
- appl= &isdn_appl[ctrl->appl];
- else if( APPL(pl) < 0x30)
- appl = &isdn_appl[APPL(pl)];
- else if( APPL(pl) < 0x40)
- appl= NULL;
- else goto fin;
-
- if(msg->h.Type >= 0x80)
- {
- mb= msg->h.Type & 0x40;
- msg->h.Type &= 0xbf;
- }
- }
-SavMsgTyp|= 0x100;
-
-if(msg->h.Type>=0x40)
-printf("I%x %x %x",msg->h.Type,pl,mb);
- switch (msg->h.Type)
- {
- case 0x01: /* INIT IND */
- case 0x15: /* POLL IND */
- error= en_q(unit,msg->h.Type|0x20,0,0,0,NULL);
- break;
- case 0x04: /* DNL MOD CONF */
- sc->sc_stat = msg->Data[0];
- if (sc->sc_flags & 7)
- sc->sc_flags = (sc->sc_flags & ~7) | OPEN;
- break;
- case 0x06: /* DNL MOD IND */
- sc->sc_stat = msg->Data[0];
- error= en_q(unit,msg->h.Type|0x20,sc->sc_type,0,1, &msg->Data[1]);
- if(sc->sc_flags & LOAD_ENTITY)
- {
- sc->sc_istat= sc->sc_ostat= 2;
- timeout(snic_timout,unit,hz);
- msg->h.Type= 0;
- return;
- }
- if (sc->sc_flags)
- sc->sc_flags = OPEN;
- break;
- case 0x0e: /* SET CLOCK CONF */
- error= state_ind(unit,1,0);
- break;
- case 0x16: /* STATE IND */
- if(sc->sc_flags & LOAD_ENTITY)
- {
- if(sc->sc_flags & 7)
- sc->sc_flags = OPEN;
- else sc->sc_flags= 0;
- }
- bcopy( msg->Data, sc->sc_state_ind, 8);
- error= en_q(unit,msg->h.Type|0x20,0,0,0,NULL);
- break;
- case 0x17: /* STATE RESP */
- bcopy( msg->Data, sc->sc_state_ind, 8);
- break;
- case 0x1e: /* MANUFACT CONF */
- if(msg->h.SubType == 18)
- break;
- badstate(&msg->h,1);
- break;
- case 0x1f: /* MANUFACT IND */
- if(msg->h.SubType == 19)
- {
- isdn_input(ispy_applnr, msg->h.DataLen, msg->Data,0);
- error= en_q(unit,msg->h.Type|0x20,msg->h.SubType,0,0,NULL);
- break;
- }
- badstate(&msg->h,2);
- break;
- case 0x40: /* CONNECT CONF */
- err = *(u_short *) msg->Data;
- if (err || (appl == NULL) || (chan == NULL) || (ctrl == NULL))
- {
- if(chan) reset_plci(3, chan, pl);
- if(appl) appl->state= 0;
- break;
- }
- if (ISBUSY(ctrl->appl))
- {
- error= discon_req(2, unit, pl, 0, 0);
- break;
- }
- chan->plci = pl;
- chan->msg_nr = 0;
- chan->ncci = -1;
- ctrl->lastact = time.tv_sec;
- ctrl->appl = APPL(pl);
- appl->ctrl = chan->ctrl;
- ctrl->islisten= 0;
- chan->state = DIAL;
- appl->state= 3;
- break;
-
- case 0x41: /* CONNECT IND */
- if (ISBUSY(ctrl->appl))
- {
- error= discon_req(3, unit, pl, 0, 0);
- break;
- }
- chan->plci = pl;
- chan->msg_nr = 0;
- chan->ncci = -1;
- ctrl->lastact = time.tv_sec;
- ctrl->appl = 0x7f;
- ctrl->islisten= 1;
- chan->state = CALLED;
- msg->Data[msg->Data[3] + 4] = 0;
- isdn_accept_con_ind(APPL(pl), chan->ctrl, msg->Data[0], msg->Data[1]
- ,msg->Data[2], msg->Data[3], (char *) &msg->Data[4]);
- break;
-
- case 0x42: /* CONNECT ACTIVE IND */
- error= con_act_resp(unit, pl);
- if (IS_LISTEN(pl))
- {
- isdn_conn_ind(ctrl->appl,chan->ctrl,0);
- break;
- }
- isdn_conn_ind(APPL(pl),chan->ctrl,1);
- chan->state = CONNECT;
- ctrl->appl = APPL(pl);
- appl->ctrl = chan->ctrl;
- break;
-
- case 0x43: /* DISCONNECT CONF */
- reset_plci(4, chan, pl);
- break;
-
- case 0x44: /* DISCONNECT IND */
- error= discon_resp(unit, reset_plci(5, chan, pl));
- break;
-
- case 0x47: /* LISTEN CONF */
- isdn_state = *(u_short *) msg->Data;
- break;
-
- case 0x4a: /* INFO IND */
- isdn_info(APPL(pl),*(u_short *)msg->Data, msg->Data[2], msg->Data+3);
- error= inf_resp(unit, pl);
- break;
- case 0x80: /* SELECT PROT CONF */
- err = *(u_short *) msg->Data;
- if (err)
- {
- error= discon_req(4, unit, pl, 0, err);
- break;
- }
-
- switch (msg->h.SubType)
- {
- case 2:/* SELECT B2 PROTOCOL */
- if(ISFREE(ctrl->appl))
- break;
- error= sel_b3_prot_req(unit, mb, pl, &isdn_appl[ctrl->appl].ncpd);
- break;
-
- case 3:/* SELECT B3 PROTOCOL */
- if (IS_DIAL(pl))
- error= con_b3_req(unit, mb, pl);
- else
- error= listen_b3_req(unit, mb, pl);
- break;
- }
- break;
-
- case 0x81: /* LISTEN B3 CONF */
- err = *(u_short *) msg->Data;
- if (err)
- {
- error= discon_req(5, unit, pl, 0, err);
- break;
- }
- error= con_resp(unit, pl, err);
- break;
-
- case 0x82: /* CONNECT B3 CONF */
- err = *(u_short *) (msg->Data + 2);
- n = *(u_short *) msg->Data;
-
- if (err)
- {
- error= discon_req(6, unit, pl, 0, err);
- break;
- }
- if(ISFREE(ctrl->appl))
- break;
- chan->ncci = n;
- chan->state = CONNECT;
- break;
-
- case 0x83: /* CONNECT B3 IND */
- if(ISFREE(ctrl->appl))
- break;
- n = *(u_short *) msg->Data;
- chan->ncci = n;
- chan->state = CONNECT;
- error= con_b3_resp(unit, mb, n, pl, 0);
- break;
-
- case 0x84: /* CONNECT B3 ACTIVE IND */
- if(ISFREE(ctrl->appl))
- break;
- if (chan->state < IDLE)
- {
- chan->state = IDLE;
- ctrl->o_len = 0;
- timeout(isdn_start_out,chan->ctrl,hz/5);
- }
- break;
-
- case 0x85: /* DISCONNECT B3 CONF */
- if(ISBUSY(ctrl->appl))
- chan->state = ISDISCON;
- err = *(u_short *) (msg->Data + 2);
- if (err)
- {
- error= discon_req(7, unit, pl, 0, err);
- break;
- }
- break;
- case 0x86: /* DISCONNECT B3 IND */
- if(ISBUSY(ctrl->appl))
- chan->state = ISDISCON;
- err = *(u_short *) (msg->Data + 2);
- error= discon_req(8, unit, pl, 0, err);
- break;
-
- case 0x88: /* DATA B3 CONF */
- if(ISFREE(ctrl->appl))
- break;
- err = *(u_short *) (msg->Data + 2);
- if (err)
- {
-printf("e%x\n",err);
- ctrl->send_err++;
- isdn_appl[ctrl->appl].send_err++;
- }
- chan->state = IDLE;
- chan->o_buf.h.Type= 0;
- ctrl->o_len = 0;
- isdn_start_out(chan->ctrl);
- break;
-
- case 0x89: /* DATA B3 IND */
- if(ISFREE(ctrl->appl))
- break;
- if(isdn_input(ctrl->appl, msg->h.DataLen-5, msg->Data+5,ctrl->islisten))
- ctrl->lastact = time.tv_sec;
- break;
-
- default:
- badstate(&msg->h,3);
- break;
- }
-
-fin:
- if(error)
- {
-printf("x%x %x %x %x %x\n",error,msg->h.Type,sc->sc_istat,sc->sc_ostat,sc->sc_omsg.h.Type);
- sc->sc_istat|= 0x101;
- if(sc->sc_istat&0x200)
- return;
- sc->sc_istat|= 0x200;
- timeout(snic_timout,unit,2);
- return;
- }
-
- msg->h.Type= 0;
- if(snic_put_msg(unit,(Header *) &ack_msg,1,15))
- sc->sc_ostat|= 0x100;
- sc->sc_istat= 0x200;
- snic_get_msg(unit);
-}
-
-#endif /* NSNIC > 0 */
diff --git a/sys/gnu/scsi/scsi_nic.h b/sys/gnu/scsi/scsi_nic.h
deleted file mode 100644
index 4847df8..0000000
--- a/sys/gnu/scsi/scsi_nic.h
+++ /dev/null
@@ -1,53 +0,0 @@
-static char rcsid[] = "@(#)$Id: scsi_nic.h,v 1.1 1995/01/25 14:06:18 jkr Exp jkr $";
-/*******************************************************************************
- * II - Version 0.1 $Revision: 1.1 $ $State: Exp $
- *
- * Copyright 1994 Dietmar Friede
- *******************************************************************************
- * Bug reports, patches, comments, suggestions should be sent to:
- *
- * jkr@saarlink.de or jkrause@guug.de
- *
- *******************************************************************************
- * $Log: scsi_nic.h,v $
- *
- ******************************************************************************/
-
-/*
- * This file defines the NICCY 5000 Interface.
- * Copyright Dr. Neuhaus GmbH, Hamburg and Dietmar Friede
- *
-*/
-#define GET_MSG_COMMAND 0x08
-#define PUT_MSG_COMMAND 0x0a
-
-#pragma pack (1)
-struct scsi_msg
-{
- u_char op_code;
- u_char dummy;
- u_char len[3];
- u_char control;
-};
-
-typedef struct
-{
- unsigned char Type;
- unsigned char SubType;
- unsigned short Number ;
- unsigned char MoreData ;
- unsigned char Reserved[1] ;
- unsigned short DataLen ;
- unsigned short PLCI;
-} Header;
-
-#define SNIC_BUF_SIZE 2048+15
-
-typedef struct
-{
- Header h;
- unsigned char Data[SNIC_BUF_SIZE];
-} Buffer;
-
-#pragma pack ()
-
diff --git a/sys/i386/boot/README.386BSD b/sys/i386/boot/README.386BSD
deleted file mode 100644
index cc5cb8f..0000000
--- a/sys/i386/boot/README.386BSD
+++ /dev/null
@@ -1,151 +0,0 @@
-This Boot code is different from the original boot code that came with
-386BSD in that it uses the BIOS to load the kernel and to provide all i/o
-services. The advantage ofthis is that the same boot code exactly, can run
-on any device that is supported by the BIOS. (That's most of them)
-This is important for the 'generic scsi' project because it means we can
-write drivers for new scsi adapters without having to develop an new
-set of boot blocks for each.
-
-At this point you should read the first part of README.MACH... come back here
-when you have done that:
-
-In normal operation, when co-existing with other operating systems, the
-following operations occur:
-
-1/ the BIOS loads the first block of the disk (called the Master Boot Record
-or MBR) and if it has the correct magic numbers, jumps into it:
-
-2/ The MBR code, looks at the Partition table that is embedded within it,
-to detirmine which is the partition to boot from. If you are using the os-bs
-bootblocks (highly recommended) then it will give you a menu to choose from.
-
-3/ The MBR will load the first record of the selected partition and
-if it has (the same) magic numbers, jumps into it. In 386bsd this is the
-first stage boot, (or boot1) it is represented in /usr/mdec by
-wdboot, asboot and sdboot. If the disk has been set up without DOS partitioning
-then this block will be at block zero, and will have been loaded directly by
-the BIOS.
-
-4/ Boot1 will look at block0 (which might be itself if there are no DOS
-partitions) and will find the 386bsd partition, and using the information
-regarding the start position of that partition, will load the next 13 sectors
-or so, to around 90000 (640k - 64k). and will jump into it at the appropriate
-entry point. Since boot1 and boot2 were compiled together as one file
-and then split later, boot1 knows the exact position within boot2 of the
-entry point.
-
-Boot 1 also contains a compiled in DOS partition table
-(in case it is at block 0), which contains a 386bsd partition starting
-at 0. This ensures that the same code can work whether or not
-boot1 is at block 0.
-
-5/ Boot2 asks the user for a boot device, partition and filename, and then
-loads the MBR of the selected device. This may or may not be the device
-which was originally used to boot the first MBR. The partition table
-of the new MBR is searched for a 386bsd partition, and if one is found,
-that is then in turn searched for the disklabel. This could all be on the
-second disk at this point, if the user selected it.
-
-6/On finding the disklabel, boot2 can find the correct unix partition
-within the 386bsd partition, and using cutdown filesystem code,
-look for the file to boot (e.g. 386bsd).
-
-7/ Boot2 loads this file starting at the location specified by the a.out header,
-(see later) and leaps into it at the location specified in he header.
-
-if the file does not exist or cannot be loaded, boot2 goes back to step 5.
-
-386bsd is now running and will hopefully start vm etc. and get to multi-user
-mode.
-
-##########################################################################
-During all these steps, all i/o is performed using the BIOS. This has a number
-of side effects:
-
-1/ Since BIOS disk calls are specified in terms of cylinder,head and sector,
-and the BIOS read the disk information from either the CMOS or from some other
-location which is un-available to us, we must use the cyl,head,sec information
-that is given in the MBR, rather than the start address in the MBR, because
-we cannot guarentee that we can corectly calculate C,H,S from the start address.
-
-Therefore, the C,H,S information in the MBR must be as correct for this boot
-to work as it would be for DOS to boot. For example, adaptec BIOS routines
-assume a layout of 64 heads and 32 sectors giving 1MB per ficticious cylinder.
-You must use these figures to calculate the correct values. Luckily, the DOS
-fdisk program will do all this for you if you tell it to give you a DOS
-partition, and you can change it to a 386BSD partition later. If you use
-no DOS partitioning, then the compiled in table in Boot1 will do just fine.
-
-If you want to do it by hand remember that BIOS counts sectors starting at 1.
-(cylinders and heads start at 0 (??))
-
-2/ you cannot overwrite the bottom 4k of ram until you have finished ALL
-bios calls, as BIOS uses this area as scratch memory.
-
-3/ Since BIOS runs in REAL mode, and Boot2 runs in protected mode,
-Boot 2 switches back to real mode just before each BIOS call and then
-back to protected mode on each return. Touch this at your peril.!
-
-#########################################################################
-In answering the prompt from Boot2:
-you can,
-1/ leave it alone.. it will boot the indicated file from the first
-partition of the first drive seen by the BIOS (C:)
-
-2/ enter only "-s" to boot the default to single user mode
-
-3/ enter only a filename (optionally with -s) to boot that kernel,
-
-4/ enter a whole line of the form shown in the prompt. This allows you to
-boot some other partition, possibly on the second drive, as root.
-
-
-##########################################################################
-In the case you have two drives the same type (both scsi or bith IDE/ESDI),
-wd(0,a)xxx
- will boot xxx from drive 0, a partition.
-wd(1,a)xxx
- will boot xxx from drive 1, a partition.
-
-similarly for sd.
-
-if you have one wd drive and one scsi drive, then you MUST
-use device 'hd'
-
-otherwise the following will happen:
-
-with wd0 and sd0, you specify sd1 or wd1 to indicate the 2nd drive.
-it boots the kernel correctly, then tells the kernel to use sd1 as root.
-you however may not have an sd1, and problems arise.
-
-hd is special in that the kernel is always told to use unit 0,
-The correct TYPE of device will be specified too, so the kernel
-will be told either sd0 or wd0.
-
-Whether sd or wd is specified to the kernel is read from the disklabel,
-so ensure that all SCSI disks have type SCSI in their disklabel or the
-boot code will assume they are ESDI or IDE. (Remember, because it is
-working through the BIOS it has ho idea what kind of disk it is.
-
-##########################################################################
-Installing:
-The makefile supplied has a target install which will create the
-files wdboot,bootwd ,sdboot and bootsd in /usr/mdec.
-BEWARE these will overwrite the existing wdboot and bootwd. (so back
-them up)
-
-there are also targets wd and sd which wil only do one of them
-
-The commented out targets wd0 and sd0 are examples of how to
-load the new bootblocks, however,make sure you change the
-device type and label to suit your drive if you uncomment them.
-(see 'man disklabel')
-
-If you already have made partitions using the old bootblocks
-these should install painlessly.
-
-Before you do this ensure you have a booting floppy with correct
-disktab and bootblock files on it so that if it doesn't work, you can
-re-disklabel from the floppy.
-
-$Id$
diff --git a/sys/i386/boot/README.MACH b/sys/i386/boot/README.MACH
deleted file mode 100644
index cb62329..0000000
--- a/sys/i386/boot/README.MACH
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1992, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- *
- * from: Mach, Revision 2.2 92/04/04 11:33:55 rpd
- * $Id$
- */
-
-********NOTE: This is not all relevant to the 386BSD version**********
-
- AT386 Protected Mode Bootstrap Loader
- =====================================
-
-1. Overview of Startup
- -------------------
-
- After the system is rebooted, the BIOS bootstrap routine reads Sector
- 1, Track 0 into memory at location 0000:7C00H. If location 0000:7DFEH
- (last two bytes of that sector) contains the value AA55H, the BIOS
- bootstrap routine will transfer control to 0000:7C00H. Otherwise, the
- boot code in that sector is bad and the boot routine stops.
-
- For DOS compatibility reason, one extra stage of boot is required if
- the boot device is a hard disk. The first sector of the hard disk will
- contain the MOS-DOS boot code and a boot record partition table.
- When this sector is loaded into 0000:7C00H, it will relocate itself
- to somewhere else and then load the first sector of the active
- partition into 0000:7C00H. Both UNIX and DOS use the command "fdisk"
-[ 386bsd does not have an 'fdisk' (yet) ]
- to install this first sector into the hard disk and to manipulate
- the hard disk partitions.
-
-
-
-2. The First Stage Bootstrap Loader
- --------------------------------
-
- After startup, the first stage boot is loaded at 0000:7C00H. This
- first stage boot will load itself and the second stage boot into
- memory at location 0000:1000H. For floppy disks, the first cylinder
- is reserved as the boot cylinder, and the boot code (first and second)
- will be loaded from there. Currently, only double sided, high density
- (15 sectors per track) floppies are supported. For hard disks, the
- first 29 sectors of the active partition is reserved for boot code
- which will be loaded by the first stage boot. All the disk types
- recognized by BIOS are supported by this bootstrap loader.
-[for 386bsd we load the second stage booter to 9000:0]
-
-
-
-3. The Second Stage Bootstrap Loader
- --------------------------------
-
- After the boot code is loaded, the control is passed to the second
- stage bootstrap loader "boot2()". In order to be able to load the
- big kernel image (bigger than 512K or 640K, depends on the memory
- configuration), the second stage boot loader will run on the protected
- mode. This bootstarp loader does not have any stand alone device
- drivers, all the I/O's are through the BIOS calls. Since the first
- stage boot code will no longer be used at this moment, the memory
- location of the first stage boot code (0000:1000H to 0000:1200H) will
- be used as an internal buffer for BIOS calls. Immediately after this
- internal buffer is the GDT table for the second stage boot loader.
- Since this boot loader needs to switch back and forth between protected
- and real mode in order to use BIOS calls, the limit of the boot code
- and boot data segments must not be greater than 64K.
-
- The boot loader loads the kernel image at memory location above 1 MB
- to skip the memory hole between 521K/640K and 1MB. After the kernel
- is loaded, the boot loader stores the information in the stack and
- then passes control to kernel. Currently, the three information passed
- fromm the boot loader to the kernel are type of the boot device, size
- of the base memory and size of the extended memory.
-
-[ 386bsd receives: howto, bootdev]
-
-[ 386bsd is loaded where-ever the "MByte" bits of the load address specify,
-so if you link it for FE100000 it will load to 1MB, but if you link
-it for FE000000 it will load ad 0MB]
-
-[for machines with only 512KB normal ram the kernel will need to be linked
-for 1MB and the bootblocks modified to run below 512KB. (8000:0)]
-
-
-4. The UNIX Startup
- ----------------
-
- Since the boot loader loads the kernel image at memory location above
- 1MB, the kernel has to start as protected mode. In addition, the
- link editor description file (vuifile) has to indicate that
- the text and data segments start above 1MB. Also, the boot loader
- passes the infomation to the kernel through the stack.
-
-[MOST of what is mentionned below is NOT relevant to 386bsd]
-
-5. Disk Layout and Bad Block Handling
- ---------------------------------
-
- The System V/386 Release 3.2 (AT) disk layout will be used as the disk
- layout for the MACH System on the AT platform.
-
- This disk layout is as follows:
-
- * Reserve the first sector of cylinder 0 for the DOS boot record which
- contains the master boot code (446 bytes) and the partition table.
- (Refer to DOS Technical Reference Manual page 9-6 to 9-10).
-
- * Reserve the first 29 sectors of the UNIX partition for the first
- and the second stage bootstrap.
-
- * Reserve the 30th sector of the UNIX partition for the pdinfo and
- the vtoc tables.
-
- * Reserve the 31st to the 34th sectors of the UNIX partition for the
- bad track and the bad block mapping tables.
-
- * Reserve up to 253 consecutive tracks when required, beginning with
- the 35th sector of the UNIX partition, for alternate tracks.
-
- * Reserve up to 253 consecutive blocks, beginning with the first
- sector after the alternate tracks area, for alternate blocks.
-
- SEC
- 1
- ----------------------------------------------------
- | X | | CYL 0, TRK 0
- ---------------- .......... --------------------
- | .......... |
- ---------------- .......... --------------------
- | .......... |
- ===============================================================
- ^ | BOOTSTRAP | CYL N, TRK M
- | ----------------------------------------------------
- | | |30 |31 |32 |33 |34 |
- ---------------------------------------------------- ---
- U | .......... | ^
- N ---------------- .......... --------------------- |
- I | .......... | Alternate Tracks
- X ---------------- .......... --------------------- |
- | .......... | V
- P ---------------------------------------------------- ---
- A | .......... | ^
- R ---------------- .......... --------------------- |
- T | .......... | Alternate Blocks
- I ---------------- .......... -------------------- |
- T | .......... | V
- I ---------------------------------------------------- ---
- O | Unix root partition starts from here |
- N ---------------- -----------------
- | |
- ----------------------------------------------------
- | |
- ----------------------------------------------------
- | |
- | ---------------------------------------------------
- | | |
- | ----------------------------------------------------
- V | |
- ===============================================================
- | ........ |
- --------------- ........ --------------
- | ........ |
- ----------------------------------------------------
-
-
- The bad block handling mechanism is as follows:
-
- * Use the alternate track in the alternate tracks area if the
- track containing the target sector is bad.
-
- * Use the alternate block in the alternate blocks area if the
- target sector is bad.
-
-
-
-
-6. How to make:
- -----------
-
- Since the kernel image is loaded above 1 MB, the kernel must start
- as protected mode. This means that this bootstrap loader will work
- only when the corresponding changes on the kernel startup code are done.
-
- The make command to generate this bootstrap loader is:
-
- make -f boot.mk fdboot (floppy boot loader)
- make -f boot.mk hdboot (wini boot loader)
-[to make 386bsd bootblocks "make sd wd" (warning: they will be installed
-in /dev/mdec.. take backups)]
diff --git a/sys/i386/boot/asm.S b/sys/i386/boot/asm.S
deleted file mode 100644
index 90f523f..0000000
--- a/sys/i386/boot/asm.S
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1992, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- *
- * from: Mach, Revision 2.2 92/04/04 11:34:13 rpd
- * $Id: asm.S,v 1.4 1994/10/02 05:18:24 rgrimes Exp $
- */
-
-
-/*
- Copyright 1988, 1989, 1990, 1991, 1992
- by Intel Corporation, Santa Clara, California.
-
- All Rights Reserved
-
-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 appears in all
-copies and that both the copyright notice and this permission notice
-appear in supporting documentation, and that the name of Intel
-not be used in advertising or publicity pertaining to distribution
-of the software without specific, written prior permission.
-
-INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
-IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
-NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-
- .file "asm.s"
-
-#include "asm.h"
-
-
-CR0_PE_ON = 0x1
-CR0_PE_OFF = 0xfffffffe
-
-.globl _ouraddr
- .text
-
-/*
- *
- * real_to_prot()
- * transfer from real mode to protected mode.
- */
-
-ENTRY(real_to_prot)
- /* guarantee that interrupt is disabled when in prot mode */
- cli
-
- /* load the gdtr */
- addr32
- data32
- lgdt EXT(Gdtr)
-
- /* set the PE bit of CR0 */
- mov %cr0, %eax
-
- data32
- or $CR0_PE_ON, %eax
- mov %eax, %cr0
-
- /*
- * make intrasegment jump to flush the processor pipeline and
- * reload CS register
- */
- data32
- ljmp $0x18, $xprot
-
-xprot:
- /*
- * we are in USE32 mode now
- * set up the protected mode segment registers : DS, SS, ES
- */
- mov $0x20, %eax
- movw %ax, %ds
- movw %ax, %ss
- movw %ax, %es
-
-#ifdef BDE_DEBUGGER
- /* load idtr so we can debug */
- lidt EXT(Idtr_prot)
-#endif
-
- ret
-
-/*
- *
- * prot_to_real()
- * transfer from protected mode to real mode
- *
- */
-
-ENTRY(prot_to_real)
-
- /* set up a dummy stack frame for the second seg change. */
- movl _ouraddr, %eax
- sarl $4, %eax
- pushw %ax
- movw $xreal, %ax /* gas botches pushw $xreal, extra bytes 0, 0 */
- pushw %ax /* decode to add %al, (%eax) (%al usually 0) */
-
- /* Change to use16 mode. */
- ljmp $0x28, $x16
-
-x16:
- /* clear the PE bit of CR0 */
- mov %cr0, %eax
- data32
- and $CR0_PE_OFF, %eax
- mov %eax, %cr0
-
- /*
- * make intersegment jmp to flush the processor pipeline
- * using the fake stack frame set up earlier
- * and reload CS register
- */
- lret
-
-xreal:
- /*
- * we are in real mode now
- * set up the real mode segment registers : DS, SS, ES
- */
- movw %cs, %ax
- movw %ax, %ds
- movw %ax, %ss
- movw %ax, %es
-
-#ifdef BDE_DEBUGGER
- /* load idtr so we can debug */
- addr32
- data32
- lidt EXT(Idtr_real)
-#endif
-
- data32
- ret
-
-/*
- * startprog(phyaddr)
- * start the program on protected mode where phyaddr is the entry point
- *
- * XXX This whole mess should go away and we should run the boot code in
- * flat 32 bit mode with it linked -T BOOTSEG. See the netboot code for
- * how this is done.
- */
-
-ENTRY(startprog)
- push %ebp
- mov %esp, %ebp
- movl %esp, %eax /* Use eax as the old stack pointer */
-
- /* convert the current stack to a 32 bit flat model */
- mov $0x10, %ebx
- movw %bx, %ss
- addl $(BOOTSEG<<4),%esp
-
- /* copy the arguments from the old stack to the new stack */
- pushl 0x14(%eax) /* &bootinfo */
- pushl $0 /* was &nfsdiskless */
- pushl $0 /* was esym */
- pushl $0 /* was cyloffset */
- pushl 0x10(%eax) /* bootdev */
- pushl 0x0C(%eax) /* howto */
- movl $(ourreturn),%ebx
- addl $(BOOTSEG<<4),%ebx /* Fix it up for flat segments */
- pushl %ebx /* our return address */
-
- /* push on our entry address */
- pushl $0x08 /* segment selector */
- pushl 0x08(%eax) /* kernel entry address */
-
- /* convert over the other data segs */
- mov $0x10, %ebx
- movw %bx, %ds
- movw %bx, %es
-
- /* convert the PC (and code seg) */
- lret
-ourreturn:
- /* For now there is not much we can do, just lock in a loop */
- jmp ourreturn
-
-/*
- *
- * pbzero( dst, cnt)
- * where src is a virtual address and dst is a physical address
- */
-
-ENTRY(pbzero)
- push %ebp
- mov %esp, %ebp
- push %es
- push %esi
- push %edi
- push %ecx
-
- cld
-
- /* set %es to point at the flat segment */
- mov $0x10, %eax
- movw %ax, %es
-
- mov 0x8(%ebp), %edi /* destination */
- mov 0xc(%ebp), %ecx /* count */
- mov $0x0, %eax /* value */
-
- rep
- stosb
-
- pop %ecx
- pop %edi
- pop %esi
- pop %es
- pop %ebp
-
- ret
-/*
- * pcpy(src, dst, cnt)
- * where src is a virtual address and dst is a physical address
- */
-
-ENTRY(pcpy)
- push %ebp
- mov %esp, %ebp
- push %es
- push %esi
- push %edi
- push %ecx
-
- cld
-
- /* set %es to point at the flat segment */
- mov $0x10, %eax
- movw %ax, %es
-
- mov 0x8(%ebp), %esi /* source */
- mov 0xc(%ebp), %edi /* destination */
- mov 0x10(%ebp), %ecx /* count */
-
- rep
- movsb
-
- pop %ecx
- pop %edi
- pop %esi
- pop %es
- pop %ebp
-
- ret
-
diff --git a/sys/i386/boot/asm.h b/sys/i386/boot/asm.h
deleted file mode 100644
index 43242bd..0000000
--- a/sys/i386/boot/asm.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990,1989 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- *
- * from: Mach, Revision 2.7 92/02/29 15:33:41 rpd
- * $Id$
- */
-
-#define S_ARG0 4(%esp)
-#define S_ARG1 8(%esp)
-#define S_ARG2 12(%esp)
-#define S_ARG3 16(%esp)
-
-#define FRAME pushl %ebp; movl %esp, %ebp
-#define EMARF leave
-
-#define B_ARG0 8(%ebp)
-#define B_ARG1 12(%ebp)
-#define B_ARG2 16(%ebp)
-#define B_ARG3 20(%ebp)
-
-#ifdef wheeze
-
-#define ALIGN 4
-#define EXT(x) x
-#define LEXT(x) x:
-#define LCL(x) ./**/x
-
-#define LB(x,n) ./**/x
-#define LBb(x,n) ./**/x
-#define LBf(x,n) ./**/x
-
-#define SVC lcall $7,$0
-
-#define String .string
-#define Value .value
-#define Times(a,b) [a\*b]
-#define Divide(a,b) [a\\b]
-
-#define INB inb (%dx)
-#define OUTB outb (%dx)
-#define INL inl (%dx)
-#define OUTL outl (%dx)
-
-#else wheeze
-#define ALIGN
-#define LCL(x) x
-
-#define LB(x,n) n
-#ifdef __STDC__
-#define EXT(x) _ ## x
-#define LEXT(x) _ ## x ## :
-
-#define LBb(x,n) n ## b
-#define LBf(x,n) n ## f
-#else __STDC__
-#define EXT(x) _/**/x
-#define LEXT(x) _/**/x/**/:
-#define LBb(x,n) n/**/b
-#define LBf(x,n) n/**/f
-#endif __STDC__
-#define SVC .byte 0x9a; .long 0; .word 0x7
-
-#define String .ascii
-#define Value .word
-#define Times(a,b) (a*b)
-#define Divide(a,b) (a/b)
-
-#define INB inb %dx, %al
-#define OUTB outb %al, %dx
-#define INL inl %dx, %eax
-#define OUTL outl %eax, %dx
-
-#endif wheeze
-
-#define addr32 .byte 0x67
-#define data32 .byte 0x66
-
-#ifdef GPROF
-#ifdef __STDC__
-
-#define MCOUNT .data; LB(x, 9); .long 0; .text; lea LBb(x, 9),%edx; call mcount
-#define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x) ; \
- pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
-#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \
- .align ALIGN; LEXT(x) LEXT(y) ; \
- pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
-#define ASENTRY(x) .globl x; .align ALIGN; x ## : ; \
- pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
-
-#else __STDC__
-
-#define MCOUNT .data; LB(x, 9): .long 0; .text; lea LBb(x, 9),%edx; call mcount
-#define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x) ; \
- pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
-#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \
- .align ALIGN; LEXT(x) LEXT(y)
-#define ASENTRY(x) .globl x; .align ALIGN; x: ; \
- pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
-
-#endif __STDC__
-#else GPROF
-#ifdef __STDC__
-
-#define MCOUNT
-#define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x)
-#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \
- .align ALIGN; LEXT(x) LEXT(y)
-#define ASENTRY(x) .globl x; .align ALIGN; x ## :
-
-#else __STDC__
-
-#define MCOUNT
-#define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x)
-#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \
- .align ALIGN; LEXT(x) LEXT(y)
-#define ASENTRY(x) .globl x; .align ALIGN; x:
-
-#endif __STDC__
-#endif GPROF
-
-#define Entry(x) .globl EXT(x); .align ALIGN; LEXT(x)
-#define DATA(x) .globl EXT(x); .align ALIGN; LEXT(x)
diff --git a/sys/i386/boot/bios.S b/sys/i386/boot/bios.S
deleted file mode 100644
index 16ded4d..0000000
--- a/sys/i386/boot/bios.S
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1992, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- *
- * from: Mach, Revision 2.2 92/04/04 11:34:26 rpd
- * $Id: bios.S,v 1.2 1993/10/16 19:11:30 rgrimes Exp $
- */
-
-/*
- Copyright 1988, 1989, 1990, 1991, 1992
- by Intel Corporation, Santa Clara, California.
-
- All Rights Reserved
-
-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 appears in all
-copies and that both the copyright notice and this permission notice
-appear in supporting documentation, and that the name of Intel
-not be used in advertising or publicity pertaining to distribution
-of the software without specific, written prior permission.
-
-INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
-IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
-NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-
- .file "bios.s"
-
-#include "asm.h"
- .text
-
-/*
- * biosread(dev, cyl, head, sec, nsec, offset)
- * Read "nsec" sectors from disk to offset "offset" in boot segment
- * BIOS call "INT 0x13 Function 0x2" to read sectors from disk into memory
- * Call with %ah = 0x2
- * %al = number of sectors
- * %ch = cylinder
- * %cl = sector
- * %dh = head
- * %dl = drive (0x80 for hard disk, 0x0 for floppy disk)
- * %es:%bx = segment:offset of buffer
- * Return:
- * %al = 0x0 on success; err code on failure
- */
-
-ENTRY(biosread)
- push %ebp
- mov %esp, %ebp
-
- push %ebx
- push %ecx
- push %edx
- push %es
-
- movb 0x10(%ebp), %dh
- movw 0x0c(%ebp), %cx
- /* cylinder; the highest 2 bits of cyl is in %cl */
- xchgb %ch, %cl
- rorb $2, %cl
- movb 0x14(%ebp), %al
- orb %al, %cl
- incb %cl /* sector; sec starts from 1, not 0 */
- movb 0x8(%ebp), %dl /* device */
- movl 0x1c(%ebp), %ebx /* offset */
-
- /* prot_to_real will set %es to BOOTSEG */
- call EXT(prot_to_real) /* enter real mode */
- movb $0x2, %ah /* subfunction */
- addr32
- movb 0x18(%ebp), %al /* number of sectors */
-
- sti
- int $0x13
- cli
-
- /* save return value (actually movw %ax, %bx) */
- mov %eax, %ebx
-
- data32
- call EXT(real_to_prot) /* back to protected mode */
-
- xor %eax, %eax
- movb %bh, %al /* return value in %ax */
-
- pop %es
- pop %edx
- pop %ecx
- pop %ebx
- pop %ebp
-
- ret
-
-
-/*
- * putc(ch)
- * BIOS call "INT 10H Function 0Eh" to write character to console
- * Call with %ah = 0x0e
- * %al = character
- * %bh = page
- * %bl = foreground color ( graphics modes)
- */
-
-
-ENTRY(putc)
- push %ebp
- mov %esp, %ebp
- push %ebx
- push %ecx
-
- movb 0x8(%ebp), %cl
-
- call EXT(prot_to_real)
-
- data32
- mov $0x1, %ebx /* %bh=0, %bl=1 (blue) */
- movb $0xe, %ah
- movb %cl, %al
- sti
- int $0x10 /* display a byte */
- cli
-
- data32
- call EXT(real_to_prot)
-
- pop %ecx
- pop %ebx
- pop %ebp
- ret
-
-
-/*
- * getc()
- * BIOS call "INT 16H Function 00H" to read character from keyboard
- * Call with %ah = 0x0
- * Return: %ah = keyboard scan code
- * %al = ASCII character
- */
-
-ENTRY(getc)
- push %ebp
- mov %esp, %ebp
- push %ebx /* save %ebx */
-
- call EXT(prot_to_real)
-
- movb $0x0, %ah
- sti
- int $0x16
- cli
-
- movb %al, %bl /* real_to_prot uses %eax */
-
- data32
- call EXT(real_to_prot)
-
- xor %eax, %eax
- movb %bl, %al
-
- pop %ebx
- pop %ebp
- ret
-/*
- * ischar()
- * if there is a character pending, return it; otherwise return 0
- * BIOS call "INT 16H Function 01H" to check whether a character is pending
- * Call with %ah = 0x1
- * Return:
- * If key waiting to be input:
- * %ah = keyboard scan code
- * %al = ASCII character
- * Zero flag = clear
- * else
- * Zero flag = set
- */
-ENTRY(ischar)
- push %ebp
- mov %esp, %ebp
- push %ebx
-
- call EXT(prot_to_real) /* enter real mode */
-
- xor %ebx, %ebx
- movb $0x1, %ah
- sti
- int $0x16
- cli
- data32
- jz nochar
- movb %al, %bl
-
-nochar:
- data32
- call EXT(real_to_prot)
-
- xor %eax, %eax
- movb %bl, %al
-
- pop %ebx
- pop %ebp
- ret
-
-/*
- *
- * get_diskinfo(): return a word that represents the
- * max number of sectors and heads and drives for this device
- *
- */
-
-ENTRY(get_diskinfo)
- push %ebp
- mov %esp, %ebp
- push %es
- push %ebx
- push %ecx
- push %edx
-
- movb 0x8(%ebp), %dl /* diskinfo(drive #) */
- call EXT(prot_to_real) /* enter real mode */
-
- movb $0x8, %ah /* ask for disk info */
-
- sti
- int $0x13
- cli
-
- jnc ok
- /*
- * Urk. Call failed. It is not supported for floppies by old BIOS's.
- * Guess it's a 15-sector floppy. Initialize all the registers for
- * documentation, although we only need head and sector counts.
- */
- subb %ah, %ah /* %ax = 0 */
- movb %al, %al
- movb %ah, %bh /* %bh = 0 */
- movb $2, %bl /* %bl bits 0-3 = drive type,
- bit 2 = 1.2M */
- movb $79, %ch /* max track */
- movb $15, %cl /* max sector */
- movb $1, %dh /* max head */
- movb $1, %dl /* # floppy drives installed */
- /* es:di = parameter table */
- /* carry = 0 */
-ok:
-
- data32
- call EXT(real_to_prot) /* back to protected mode */
-
- xor %eax, %eax
-
- /* form a longword representing all this gunk */
- movb %dh, %ah /* max head */
- andb $0x3f, %cl /* mask of cylinder gunk */
- movb %cl, %al /* max sector (and # sectors) */
-
- pop %edx
- pop %ecx
- pop %ebx
- pop %es
- pop %ebp
- ret
-
-/*
- *
- * memsize(i) : return the memory size in KB. i == 0 for conventional memory,
- * i == 1 for extended memory
- * BIOS call "INT 12H" to get conventional memory size
- * BIOS call "INT 15H, AH=88H" to get extended memory size
- * Both have the return value in AX.
- *
- */
-
-ENTRY(memsize)
- push %ebp
- mov %esp, %ebp
- push %ebx
-
- mov 8(%ebp), %ebx
-
- call EXT(prot_to_real) /* enter real mode */
-
- cmpb $0x1, %bl
- data32
- je xext
-
- sti
- int $0x12
- cli
- data32
- jmp xdone
-
-xext: movb $0x88, %ah
- sti
- int $0x15
- cli
-
-xdone:
- mov %eax, %ebx
-
- data32
- call EXT(real_to_prot)
-
- mov %ebx, %eax
- pop %ebx
- pop %ebp
- ret
diff --git a/sys/i386/boot/boot.c b/sys/i386/boot/boot.c
deleted file mode 100644
index a64ee21..0000000
--- a/sys/i386/boot/boot.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1992, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- *
- * from: Mach, [92/04/03 16:51:14 rvb]
- * $Id: boot.c,v 1.19 1994/10/26 20:22:10 jkh Exp $
- */
-
-
-/*
- Copyright 1988, 1989, 1990, 1991, 1992
- by Intel Corporation, Santa Clara, California.
-
- All Rights Reserved
-
-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 appears in all
-copies and that both the copyright notice and this permission notice
-appear in supporting documentation, and that the name of Intel
-not be used in advertising or publicity pertaining to distribution
-of the software without specific, written prior permission.
-
-INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
-IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
-NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-
-#include <sys/param.h>
-#include "boot.h"
-#include <a.out.h>
-#include <sys/reboot.h>
-#include <machine/bootinfo.h>
-
-struct exec head;
-struct bootinfo_t bootinfo;
-char *name;
-char *names[] = {
- "/kernel"
-};
-#define NUMNAMES (sizeof(names)/sizeof(char *))
-
-extern int end;
-boot(drive)
-int drive;
-{
- int loadflags, currname = 0;
- char *t;
-
- printf("\n>> FreeBSD BOOT @ 0x%x: %d/%d k of memory\n",
- ouraddr,
- memsize(0),
- memsize(1));
- printf("use hd(1,a)/kernel to boot sd0 when wd0 is also installed\n");
- gateA20();
-loadstart:
- /***************************************************************\
- * As a default set it to the first partition of the first *
- * floppy or hard drive *
- \***************************************************************/
- part = unit = 0;
- maj = (drive&0x80 ? 0 : 2); /* a good first bet */
- name = names[currname++];
-
- loadflags = 0;
- if (currname == NUMNAMES)
- currname = 0;
- getbootdev(&loadflags);
- if (openrd()) {
- printf("Can't find %s\n", name);
- goto loadstart;
- }
-/* if (inode.i_mode&IEXEC)
- loadflags |= RB_KDB;
-*/
- loadprog(loadflags);
- goto loadstart;
-}
-
-loadprog(howto)
- int howto;
-{
- long int startaddr;
- long int addr; /* physical address.. not directly useable */
- long int bootdev;
- long int total;
- int i;
- unsigned char tmpbuf[4096]; /* we need to load the first 4k here */
-
- read(&head, sizeof(head));
- if ( N_BADMAG(head)) {
- printf("Invalid format!\n");
- return;
- }
-
- poff = N_TXTOFF(head);
- /*if(poff==0)
- poff = 32;*/
-
- startaddr = (int)head.a_entry & 0x00FFFFFF; /* some MEG boundary */
- addr = startaddr;
- printf("Booting %s(%d,%c)%s @ 0x%x\n"
- , devs[maj]
- , unit
- , 'a'+part
- , name
- , addr);
- if(addr < ouraddr)
- {
- if((addr + head.a_text + head.a_data) > ouraddr)
- {
- printf("kernel overlaps loader\n");
- return;
- }
- if((addr + head.a_text + head.a_data + head.a_bss) > 0xa0000)
- {
- printf("bss exceeds 640k limit\n");
- return;
- }
- }
- printf("text=0x%x ", head.a_text);
- /********************************************************/
- /* LOAD THE TEXT SEGMENT */
- /* don't clobber the first 4k yet (BIOS NEEDS IT) */
- /********************************************************/
- read(tmpbuf,4096);
- addr += 4096;
- xread(addr, head.a_text - 4096);
- addr += head.a_text - 4096;
-
- /********************************************************/
- /* Load the Initialised data after the text */
- /********************************************************/
- while (addr & CLOFSET)
- *(char *)addr++ = 0;
-
- printf("data=0x%x ", head.a_data);
- xread(addr, head.a_data);
- addr += head.a_data;
-
- /********************************************************/
- /* Skip over the uninitialised data */
- /* (but clear it) */
- /********************************************************/
- printf("bss=0x%x ", head.a_bss);
- if( (addr < ouraddr) && ((addr + head.a_bss) > ouraddr))
- {
- pbzero(addr,ouraddr - (int)addr);
- }
- else
- {
- pbzero(addr,head.a_bss);
- }
- addr += head.a_bss;
-
-#ifdef LOADSYMS /* not yet, haven't worked this out yet */
- if (addr > 0x100000)
- {
- /********************************************************/
- /*copy in the symbol header */
- /********************************************************/
- pcpy(&head.a_syms, addr, sizeof(head.a_syms));
- addr += sizeof(head.a_syms);
-
- /********************************************************/
- /* READ in the symbol table */
- /********************************************************/
- printf("symbols=[+0x%x", head.a_syms);
- xread(addr, head.a_syms);
- addr += head.a_syms;
-
- /********************************************************/
- /* Followed by the next integer (another header) */
- /* more debug symbols? */
- /********************************************************/
- read(&i, sizeof(int));
- pcpy(&i, addr, sizeof(int));
- i -= sizeof(int);
- addr += sizeof(int);
-
-
- /********************************************************/
- /* and that many bytes of (debug symbols?) */
- /********************************************************/
- printf("+0x%x] ", i);
- xread(addr, i);
- addr += i;
- }
-#endif LOADSYMS
- /********************************************************/
- /* and note the end address of all this */
- /********************************************************/
-
- total = ((addr+sizeof(int)-1))&~(sizeof(int)-1);
- printf("total=0x%x ", total);
- bootdev = (MAKEBOOTDEV(maj, 0, 0, unit, part)) ;
- /****************************************************************/
- /* copy that first page and overwrite any BIOS variables */
- /****************************************************************/
- printf("entry point=0x%x\n" ,(int)startaddr);
- /* Under no circumstances overwrite precious BIOS variables! */
- pcpy(tmpbuf, startaddr, 0x400);
- pcpy(tmpbuf + 0x500, startaddr + 0x500, 4096 - 0x500);
- bootinfo.version=1;
- bootinfo.kernelname=(char *)((int)name + (BOOTSEG<<4));
- bootinfo.nfs_diskless=0;
- startprog((int)startaddr, howto, bootdev, (int)&bootinfo+(BOOTSEG<<4));
- return;
-}
-
-#define NAMEBUF_LEN 100
-
-char namebuf[NAMEBUF_LEN];
-getbootdev(howto)
- int *howto;
-{
- char c, *ptr = namebuf;
- printf("Boot: [[[%s(%d,%c)]%s][-s][-r][-a][-c][-d][-b]] :- "
- , devs[maj]
- , unit
- , 'a'+part
- , name);
- if (gets(namebuf)) {
- while (c=*ptr) {
- while (c==' ')
- c = *++ptr;
- if (!c)
- return;
- if (c=='-')
- while ((c = *++ptr) && c!=' ')
- switch (c) {
- case 'r':
- *howto |= RB_DFLTROOT; continue;
- case 'a':
- *howto |= RB_ASKNAME; continue;
- case 'c':
- *howto |= RB_CONFIG; continue;
- case 's':
- *howto |= RB_SINGLE; continue;
- case 'd':
- *howto |= RB_KDB; continue;
- case 'b':
- *howto |= RB_HALT; continue;
- }
- else {
- name = ptr;
- while ((c = *++ptr) && c!=' ');
- if (c)
- *ptr++ = 0;
- }
- }
- if (name[0] != '/') {
- int i;
- /* This is incredibly gross, but nonetheless compact */
- /* which is a good thing for a boot block to be */
- for (i = NAMEBUF_LEN - 1; i; i--)
- name[i] = name[i - 1];
- name[0] = '/';
- }
- } else
- printf("\n");
-}
-
diff --git a/sys/i386/boot/boot.h b/sys/i386/boot/boot.h
deleted file mode 100644
index 2046990..0000000
--- a/sys/i386/boot/boot.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1992, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- *
- * from: Mach, Revision 2.2 92/04/04 11:35:03 rpd
- * $Id: boot.h,v 1.3 1993/10/16 19:11:32 rgrimes Exp $
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <ufs/ufs/quota.h>
-#include <ufs/ffs/fs.h>
-#include <ufs/ufs/inode.h>
-
-extern char *devs[], *name, *iodest;
-extern struct fs *fs;
-extern struct inode inode;
-extern int dosdev, unit, part, maj, boff, poff, bnum, cnt;
-extern long int ouraddr;
diff --git a/sys/i386/boot/boot2.S b/sys/i386/boot/boot2.S
deleted file mode 100644
index 5984f83..0000000
--- a/sys/i386/boot/boot2.S
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1992, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- *
- * from: Mach, Revision 2.2 92/04/04 11:35:26 rpd
- * $Id: boot2.S,v 1.4 1994/06/22 05:52:25 jkh Exp $
- */
-
-#include "asm.h"
-
-/* Conventional GDT indexes. */
-#define BOOT_CS_INDEX 3
-#define BOOT_CS16_INDEX 5
-#define BOOT_DS_INDEX 4
-
-#ifdef BDE_DEBUGGER
-#define DB_CS_INDEX 14
-#define DB_CS16_INDEX 15
-#define DB_DS_INDEX 16
-#define GDT_INDEX 17
-#endif
-
-/* Vector numbers. */
-#define BREAKPOINT_VECTOR 3
-#define DEBUG_VECTOR 1
-
-/*
- * boot2() -- second stage boot
- */
-
-.globl EXT(ouraddr)
-
-ENTRY(boot2)
- data32
- subl %eax, %eax
- mov %cs, %ax
- mov %ax, %ds
- mov %ax, %es
- data32
- shll $4, %eax
- addr32
- data32
- movl %eax, EXT(ouraddr)
-
- /* fix up GDT entries for bootstrap */
-#define FIXUP(gdt_index) \
- addr32; \
- movl %eax, EXT(Gdt)+(8*gdt_index)+2; /* actually movw %ax */ \
- addr32; \
- movb %bl, EXT(Gdt)+(8*gdt_index)+4
-
- data32
- shld $16, %eax, %ebx
- FIXUP(BOOT_CS_INDEX)
- FIXUP(BOOT_CS16_INDEX)
- FIXUP(BOOT_DS_INDEX)
-
- /* fix up GDT pointer */
- data32
- movl %eax, %ecx
- data32
- addl $ EXT(Gdt), %eax
- addr32
- data32
- movl %eax, EXT(Gdtr)+2
-
-#ifdef BDE_DEBUGGER
- /* fix up GDT entry for GDT */
- data32
- shld $16, %eax, %ebx
- FIXUP(GDT_INDEX)
-
- /* fix up IDT pointer */
- data32
- addl $ EXT(Idt), %ecx
- addr32
- data32
- movl %ecx, EXT(Idtr_prot)+2
-
- /* %es = vector table segment for a while */
- push %es
- data32
- subl %eax, %eax
- mov %ax, %es
-
- /* fix up GDT entries for bdb */
- data32
- movl $4*DEBUG_VECTOR, %esi
- addr32
- movl %es: 2(%esi), %eax /* actually movw to %ax */
- data32
- shll $4, %eax
- data32
- shld $16, %eax, %ebx
- FIXUP(DB_CS_INDEX)
- FIXUP(DB_CS16_INDEX)
- FIXUP(DB_DS_INDEX)
-
- /* Fetch entry points of bdb's protected mode trap handlers. These
- * are stored at 2 before the corresponding entry points for real mode.
- */
- data32
- subl %ebx, %ebx
- addr32
- movl %es: (%esi), %ebx /* actually movw to %bx */
- data32
- subl %ecx, %ecx
- addr32
- movl %es: 4*(BREAKPOINT_VECTOR-DEBUG_VECTOR)(%esi), %ecx
- /* actually movw to %cx */
-
- /* %es = bdb segment for a while */
- data32
- shrl $4, %eax
- mov %ax, %es
-
- /* fix up IDT entries for bdb */
- data32
- subl $2, %ebx /* calculate EA to check it */
- jb 1f /* give up if it would trap */
- addr32
- movl %es: (%ebx), %eax /* actually movw to %ax */
- addr32
- movl %eax, EXT(Idt)+8*DEBUG_VECTOR /* actually movw %ax */
-1:
- data32
- subl $2, %ecx
- jb 1f
- addr32
- movl %es: (%ecx), %eax /* actually movw to %ax */
- addr32
- movl %eax, EXT(Idt)+8*BREAKPOINT_VECTOR /* actually movw %ax */
-1:
-
- /* finished with groping in real mode segments */
- pop %es
-#endif /* BDE_DEBUGGER */
-
- /* change to protected mode */
- data32
- call EXT(real_to_prot)
-
- /* clear the bss */
- movl $ EXT(edata), %edi /* no EXT(_edata) - krufty ld */
- movl $ EXT(end), %ecx /* or EXT(_end) */
- subl %edi, %ecx
- subb %al, %al
- rep
- stosb
-
- movzbl %dl, %edx /* discard head (%dh) and random high bits */
- pushl %edx
- call EXT(boot)
-oops:
- hlt
- jmp oops
-
- .data
- .align 2
-#if 0 /* XXX this would give losing "_ouraddr :". Better declared in C */
-EXT(ouraddr):
-#else
-_ouraddr:
-#endif
- .long 0
diff --git a/sys/i386/boot/disk.c b/sys/i386/boot/disk.c
deleted file mode 100644
index a63ca5a..0000000
--- a/sys/i386/boot/disk.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1992, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- *
- * from: Mach, Revision 2.2 92/04/04 11:35:49 rpd
- * $Id: disk.c,v 1.4 1994/02/22 22:59:40 rgrimes Exp $
- */
-
-/*
- * 93/10/08 bde
- * If there is no 386BSD partition, initialize the label sector with
- * LABELSECTOR instead of with garbage.
- *
- * 93/08/22 bde
- * Fixed reading of bad sector table. It is at the end of the 'c'
- * partition, which is not always at the end of the disk.
- */
-
-#include "boot.h"
-#ifdef DO_BAD144
-#include <sys/dkbad.h>
-#endif DO_BAD144
-#include <sys/disklabel.h>
-
-#define BIOS_DEV_FLOPPY 0x0
-#define BIOS_DEV_WIN 0x80
-
-#define BPS 512
-#define SPT(di) ((di)&0xff)
-#define HEADS(di) ((((di)>>8)&0xff)+1)
-
-char *devs[] = {"wd", "hd", "fd", "wt", "sd", 0};
-
-#ifdef DO_BAD144
-struct dkbad dkb;
-int do_bad144;
-int bsize;
-#endif DO_BAD144
-
-int spt, spc;
-
-char *iodest;
-struct fs *fs;
-struct inode inode;
-int dosdev, unit, part, maj, boff, poff, bnum, cnt;
-
-/*#define EMBEDDED_DISKLABEL 1*/
-extern struct disklabel disklabel;
-/*struct disklabel disklabel;*/
-
-devopen()
-{
- struct dos_partition *dptr;
- struct disklabel *dl;
- int dosdev = inode.i_dev;
- int i, sector, di;
-
- di = get_diskinfo(dosdev);
- spc = (spt = SPT(di)) * HEADS(di);
- if (dosdev == 2)
- {
- boff = 0;
- part = (spt == 15 ? 3 : 1);
- }
- else
- {
-#ifdef EMBEDDED_DISKLABEL
- dl = &disklabel;
-#else EMBEDDED_DISKLABEL
- Bread(dosdev, 0);
- dptr = (struct dos_partition *)(((char *)0)+DOSPARTOFF);
- sector = LABELSECTOR;
- for (i = 0; i < NDOSPART; i++, dptr++)
- if (dptr->dp_typ == DOSPTYP_386BSD) {
- sector = dptr->dp_start + LABELSECTOR;
- break;
- }
- Bread(dosdev, sector++);
- dl=((struct disklabel *)0);
- disklabel = *dl; /* structure copy (maybe useful later)*/
-#endif EMBEDDED_DISKLABEL
- if (dl->d_magic != DISKMAGIC) {
- printf("bad disklabel");
- return 1;
- }
- if( (maj == 4) || (maj == 0) || (maj == 1))
- {
- if (dl->d_type == DTYPE_SCSI)
- {
- maj = 4; /* use scsi as boot dev */
- }
- else
- {
- maj = 0; /* must be ESDI/IDE */
- }
- }
- boff = dl->d_partitions[part].p_offset;
-#ifdef DO_BAD144
- bsize = dl->d_partitions[part].p_size;
- do_bad144 = 0;
- if (dl->d_flags & D_BADSECT) {
- /* this disk uses bad144 */
- int i;
- int dkbbnum;
- struct dkbad *dkbptr;
-
- /* find the first readable bad sector table */
- /* some of this code is copied from ufs/ufs_disksubr.c */
- /* including the bugs :-( */
- /* read a bad sector table */
-
-#define BAD144_PART 2 /* XXX scattered magic numbers */
-#define BSD_PART 0 /* XXX should be 2 but bad144.c uses 0 */
- if (dl->d_partitions[BSD_PART].p_offset != 0)
- dkbbnum = dl->d_partitions[BAD144_PART].p_offset
- + dl->d_partitions[BAD144_PART].p_size;
- else
- dkbbnum = dl->d_secperunit;
- dkbbnum -= dl->d_nsectors;
-
- if (dl->d_secsize > DEV_BSIZE)
- dkbbnum *= dl->d_secsize / DEV_BSIZE;
- else
- dkbbnum /= DEV_BSIZE / dl->d_secsize;
- i = 0;
- do_bad144 = 0;
- do {
- /* XXX: what if the "DOS sector" < 512 bytes ??? */
- Bread(dosdev, dkbbnum + i);
- dkbptr = (struct dkbad *) 0;
-/* XXX why is this not in <sys/dkbad.h> ??? */
-#define DKBAD_MAGIC 0x4321
- if (dkbptr->bt_mbz == 0 &&
- dkbptr->bt_flag == DKBAD_MAGIC) {
- dkb = *dkbptr; /* structure copy */
- do_bad144 = 1;
- break;
- }
- i += 2;
- } while (i < 10 && i < dl->d_nsectors);
- if (!do_bad144)
- printf("Bad bad sector table\n");
- else
- printf("Using bad sector table at %d\n", dkbbnum+i);
- }
-#endif DO_BAD144
- }
- return 0;
-}
-
-devread()
-{
- int offset, sector = bnum;
- int dosdev = inode.i_dev;
- for (offset = 0; offset < cnt; offset += BPS)
- {
- Bread(dosdev, badsect(dosdev, sector++));
- bcopy(0, iodest+offset, BPS);
- }
-}
-
-#define I_ADDR ((void *) 0) /* XXX where all reads go */
-
-/* Read ahead buffer large enough for one track on a 1440K floppy. For
- * reading from floppies, the bootstrap has to be loaded on a 64K boundary
- * to ensure that this buffer doesn't cross a 64K DMA boundary.
- */
-#define RA_SECTORS 18
-static char ra_buf[RA_SECTORS * BPS];
-static int ra_dev;
-static int ra_end;
-static int ra_first;
-
-Bread(dosdev,sector)
- int dosdev,sector;
-{
- if (dosdev != ra_dev || sector < ra_first || sector >= ra_end)
- {
- int cyl, head, sec, nsec;
-
- cyl = sector/spc;
- head = (sector % spc) / spt;
- sec = sector % spt;
- nsec = spt - sec;
- if (nsec > RA_SECTORS)
- nsec = RA_SECTORS;
- twiddle();
- if (biosread(dosdev, cyl, head, sec, nsec, ra_buf) != 0)
- {
- nsec = 1;
- twiddle();
- while (biosread(dosdev, cyl, head, sec, nsec, ra_buf) != 0) {
- printf("Error: C:%d H:%d S:%d\n", cyl, head, sec);
- twiddle();
- }
- }
- ra_dev = dosdev;
- ra_first = sector;
- ra_end = sector + nsec;
- }
- bcopy(ra_buf + (sector - ra_first) * BPS, I_ADDR, BPS);
-}
-
-badsect(dosdev, sector)
- int dosdev, sector;
-{
- int i;
-#ifdef DO_BAD144
- if (do_bad144) {
- u_short cyl;
- u_short head;
- u_short sec;
- int newsec;
- struct disklabel *dl = &disklabel;
-
- /* XXX */
- /* from wd.c */
- /* bt_cyl = cylinder number in sorted order */
- /* bt_trksec is actually (head << 8) + sec */
-
- /* only remap sectors in the partition */
- if (sector < boff || sector >= boff + bsize) {
- goto no_remap;
- }
-
- cyl = sector / dl->d_secpercyl;
- head = (sector % dl->d_secpercyl) / dl->d_nsectors;
- sec = sector % dl->d_nsectors;
- sec = (head<<8) + sec;
-
- /* now, look in the table for a possible bad sector */
- for (i=0; i<126; i++) {
- if (dkb.bt_bad[i].bt_cyl == cyl) {
- /* found same cylinder */
- if (dkb.bt_bad[i].bt_trksec == sec) {
- /* FOUND! */
- break;
- }
- } else if (dkb.bt_bad[i].bt_cyl > cyl) {
- i = 126;
- break;
- }
- }
- if (i == 126) {
- /* didn't find bad sector */
- goto no_remap;
- }
- /* otherwise find replacement sector */
- if (dl->d_partitions[BSD_PART].p_offset != 0)
- newsec = dl->d_partitions[BAD144_PART].p_offset
- + dl->d_partitions[BAD144_PART].p_size;
- else
- newsec = dl->d_secperunit;
- newsec -= dl->d_nsectors + i + 1;
- return newsec;
- }
-#endif DO_BAD144
- no_remap:
- return sector;
-}
diff --git a/sys/i386/boot/io.c b/sys/i386/boot/io.c
deleted file mode 100644
index ce2b1fe..0000000
--- a/sys/i386/boot/io.c
+++ /dev/null
@@ -1,225 +0,0 @@
-
-/*
- * Mach Operating System
- * Copyright (c) 1992, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- *
- * from: Mach, Revision 2.2 92/04/04 11:35:57 rpd
- * $Id: io.c,v 1.8 1994/09/18 07:39:55 swallace Exp $
- */
-
-#include <machine/cpufunc.h>
-
-#define K_RDWR 0x60 /* keyboard data & cmds (read/write) */
-#define K_STATUS 0x64 /* keyboard status */
-#define K_CMD 0x64 /* keybd ctlr command (write-only) */
-
-#define K_OBUF_FUL 0x01 /* output buffer full */
-#define K_IBUF_FUL 0x02 /* input buffer full */
-
-#define KC_CMD_WIN 0xd0 /* read output port */
-#define KC_CMD_WOUT 0xd1 /* write output port */
-#define KB_A20 0xdf /* enable A20,
- enable output buffer full interrupt
- enable data line
- enable clock line */
-
-/*
- * Gate A20 for high memory
- */
-unsigned char x_20 = KB_A20;
-gateA20()
-{
-#ifdef IBM_L40
- outb(0x92, 0x2);
-#else IBM_L40
- while (inb(K_STATUS) & K_IBUF_FUL);
- while (inb(K_STATUS) & K_OBUF_FUL)
- (void)inb(K_RDWR);
-
- outb(K_CMD, KC_CMD_WOUT);
- while (inb(K_STATUS) & K_IBUF_FUL);
- outb(K_RDWR, x_20);
- while (inb(K_STATUS) & K_IBUF_FUL);
-#endif IBM_L40
-}
-
-/* printf - only handles %d as decimal, %c as char, %s as string */
-
-printf(format,data)
- char *format;
- int data;
-{
- int *dataptr = &data;
- char c;
-
- reset_twiddle();
- while (c = *format++)
- if (c != '%')
- putchar(c);
- else
- switch (c = *format++) {
- case 'd': {
- int num = *dataptr++;
- char buf[10], *ptr = buf;
- if (num<0) {
- num = -num;
- putchar('-');
- }
- do
- *ptr++ = '0'+num%10;
- while (num /= 10);
- do
- putchar(*--ptr);
- while (ptr != buf);
- break;
- }
- case 'x': {
- int num = *dataptr++, dig;
- char buf[8], *ptr = buf;
- do
- *ptr++ = (dig=(num&0xf)) > 9?
- 'a' + dig - 10 :
- '0' + dig;
- while (num >>= 4);
- do
- putchar(*--ptr);
- while (ptr != buf);
- break;
- }
- case 'c': putchar((*dataptr++)&0xff); break;
- case 's': {
- char *ptr = (char *)*dataptr++;
- while (c = *ptr++)
- putchar(c);
- break;
- }
- }
-}
-
-putchar(c)
-{
- if (c == '\n')
- putc('\r');
- putc(c);
-}
-
-getchar()
-{
- int c;
-
- if ((c=getc()) == '\r')
- c = '\n';
- if (c == '\b') {
- putchar('\b');
- putchar(' ');
- }
- putchar(c);
- return(c);
-}
-
-#if BOOTWAIT
-/*
- * This routine uses an inb to an unused port, the time to execute that
- * inb is approximately 1.25uS. This value is pretty constant across
- * all CPU's and all buses, with the exception of some PCI implentations
- * that do not forward this I/O adress to the ISA bus as they know it
- * is not a valid ISA bus address, those machines execute this inb in
- * 60 nS :-(.
- *
- * XXX we need to use BIOS timer calls or something more reliable to
- * produce timeouts in the boot code.
- */
-delay1ms()
-{
- int i = 800;
- while (--i >= 0)
- (void)inb(0x84);
-}
-#endif
-
-gets(buf)
-char *buf;
-{
- int i;
- char *ptr=buf;
-
-#if BOOTWAIT
- for (i = BOOTWAIT; i>0; delay1ms(),i--)
-#endif
- if (ischar())
- for (;;)
- switch(*ptr = getchar() & 0xff) {
- case '\n':
- case '\r':
- *ptr = '\0';
- return 1;
- case '\b':
- if (ptr > buf) ptr--;
- continue;
- default:
- ptr++;
- }
- return 0;
-}
-
-strcmp(s1, s2)
-char *s1, *s2;
-{
- while (*s1 == *s2) {
- if (!*s1++)
- return 0;
- s2++;
- }
- return 1;
-}
-
-bcopy(from, to, len)
-char *from, *to;
-int len;
-{
- while (len-- > 0)
- *to++ = *from++;
-}
-
-static int tw_on;
-static int tw_pos;
-static char tw_chars[] = "|/-\\";
-
-reset_twiddle()
-{
- if (tw_on)
- putchar('\b');
- tw_on = 0;
- tw_pos = 0;
-}
-
-twiddle()
-{
- if (tw_on)
- putchar('\b');
- else
- tw_on = 1;
- putchar(tw_chars[tw_pos++]);
- tw_pos %= (sizeof(tw_chars) - 1);
-}
diff --git a/sys/i386/boot/netboot/509.doc b/sys/i386/boot/netboot/509.doc
deleted file mode 100644
index 1908c64..0000000
--- a/sys/i386/boot/netboot/509.doc
+++ /dev/null
@@ -1,21 +0,0 @@
-During adding of 3C509 support I made following changes:
-
-1) File if_epreg.h added - it is slightly different from one in
-/usr/src/sys/i386/isa !
-
-2) Support of 3C509 added to ether.c
-
-3) Flag -DINCLUDE_3C509 added (to ether.h, ether.c, Makefile)
-
-4) Routine eth_fillname() added to ether.c because 3C509 has
-different driver (ep0 instead of ed0). Main.c was changed
-according to this.
-
-I had tested this version with 3C509 only, but I see no reasons
-why it must not work with other cards.
-
-But don't try to link it for both 3C509 and 8390-based cards. In
-this case object file grows behind 16K and everything fails
-to work. I don't know how correct this trouble.
-
- Serge Babkin (babkin@hq.icb.chel.su)
diff --git a/sys/i386/boot/netboot/ether.c b/sys/i386/boot/netboot/ether.c
deleted file mode 100644
index 1077ab0..0000000
--- a/sys/i386/boot/netboot/ether.c
+++ /dev/null
@@ -1,1243 +0,0 @@
-
-/**************************************************************************
-NETBOOT - BOOTP/TFTP Bootstrap Program
-
-Author: Martin Renters.
- Date: Mar 22 1995
-
- This code is based heavily on David Greenman's if_ed.c driver and
- Andres Vega Garcia's if_ep.c driver.
-
- Copyright (C) 1993-1994, David Greenman, Martin Renters.
- Copyright (C) 1993-1995, Andres Vega Garcia.
- Copyright (C) 1995, Serge Babkin.
- This software may be used, modified, copied, distributed, and sold, in
- both source and binary form provided that the above copyright and these
- terms are retained. Under no circumstances are the authors responsible for
- the proper functioning of this software, nor do the authors assume any
- responsibility for damages incurred with its use.
-
-3c503 support added by Bill Paul (wpaul@ctr.columbia.edu) on 11/15/94
-SMC8416 support added by Bill Paul (wpaul@ctr.columbia.edu) on 12/25/94
-3c509 support added by Serge Babkin (babkin@hq.icb.chel.su) on 03/22/95
-
-***************************************************************************/
-
-/* #define EDEBUG */
-
-#include "netboot.h"
-#include "ether.h"
-
-#ifdef INCLUDE_3C509
-# include "if_epreg.h"
-#endif
-
-extern short aui;
-char bnc=0, utp=0; /* for 3C509 */
-unsigned short eth_nic_base;
-unsigned short eth_asic_base;
-unsigned short eth_base;
-unsigned char eth_tx_start;
-unsigned char eth_laar;
-unsigned char eth_flags;
-unsigned char eth_vendor;
-unsigned char eth_memsize;
-unsigned char *eth_bmem;
-unsigned char *eth_rmem;
-unsigned char *eth_node_addr;
-
-#ifdef INCLUDE_3C509
-
-static send_ID_sequence();
-static get_eeprom_data();
-static get_e();
-
-#endif
-
-/**************************************************************************
-The following two variables are used externally
-***************************************************************************/
-char packet[ETH_MAX_PACKET];
-int packetlen;
-
-/*************************************************************************
-ETH_FILLNAME - Fill name of adapter in NFS structure
-**************************************************************************/
-
-eth_fillname(where)
-char *where;
-{
- switch(eth_vendor) {
- case VENDOR_3C509:
- where[0]='e'; where[1]='p'; where[2]='0'; where[3]=0;
- break;
- case VENDOR_WD:
- case VENDOR_NOVELL:
- case VENDOR_3COM:
- where[0]='e'; where[1]='d'; where[2]='0'; where[3]=0;
- break;
- default:
- where[0]='?'; where[1]='?'; where[2]='?'; where[3]=0;
- break;
- }
-}
-
-/**************************************************************************
-ETH_PROBE - Look for an adapter
-***************************************************************************/
-eth_probe()
-{
- /* common variables */
- int i;
-#ifdef INCLUDE_3C509
- /* variables for 3C509 */
- int data, j, io_base, id_port = EP_ID_PORT;
- int nisa = 0, neisa = 0;
- u_short k;
- int ep_current_tag = EP_LAST_TAG + 1;
- short *p;
-#endif
-#if defined(INCLUDE_3COM) || defined(INCLUDE_WD) || defined(INCLUDE_NE)
- /* varaibles for 8390 */
- struct wd_board *brd;
- char *name;
- unsigned short chksum;
- unsigned char c;
-#endif
-
- eth_vendor = VENDOR_NONE;
-
-#ifdef INCLUDE_3C509
-
- /*********************************************************
- Search for 3Com 509 card
- ***********************************************************/
-
- /* Look for the EISA boards, leave them activated */
- /* search for the first card, ignore all others */
- for(j = 1; j < 16 && eth_vendor==VENDOR_NONE ; j++) {
- io_base = (j * EP_EISA_START) | EP_EISA_W0;
- if (inw(io_base + EP_W0_MFG_ID) != MFG_ID)
- continue;
-
- /* we must found 0x1f if the board is EISA configurated */
- if ((inw(io_base + EP_W0_ADDRESS_CFG) & 0x1f) != 0x1f)
- continue;
-
- /* Reset and Enable the card */
- outb(io_base + EP_W0_CONFIG_CTRL, W0_P4_CMD_RESET_ADAPTER);
- DELAY(1000); /* we must wait at least 1 ms */
- outb(io_base + EP_W0_CONFIG_CTRL, W0_P4_CMD_ENABLE_ADAPTER);
-
- /*
- * Once activated, all the registers are mapped in the range
- * x000 - x00F, where x is the slot number.
- */
- eth_base = j * EP_EISA_START;
- eth_vendor = VENDOR_3C509;
- }
- ep_current_tag--;
-
- /* Look for the ISA boards. Init and leave them actived */
- /* search for the first card, ignore all others */
- outb(id_port, 0xc0); /* Global reset */
- DELAY(1000);
- for (i = 0; i < EP_MAX_BOARDS && eth_vendor==VENDOR_NONE; i++) {
- outb(id_port, 0);
- outb(id_port, 0);
- send_ID_sequence(id_port);
-
- data = get_eeprom_data(id_port, EEPROM_MFG_ID);
- if (data != MFG_ID)
- break;
-
- /* resolve contention using the Ethernet address */
- for (j = 0; j < 3; j++)
- data = get_eeprom_data(id_port, j);
-
- eth_base =
- (get_eeprom_data(id_port, EEPROM_ADDR_CFG) & 0x1f) * 0x10 + 0x200;
- outb(id_port, ep_current_tag); /* tags board */
- outb(id_port, ACTIVATE_ADAPTER_TO_CONFIG);
- eth_vendor = VENDOR_3C509;
- ep_current_tag--;
- }
-
- if(eth_vendor != VENDOR_3C509)
- goto no3c509;
-
- /*
- * The iobase was found and MFG_ID was 0x6d50. PROD_ID should be
- * 0x9[0-f]50
- */
- GO_WINDOW(0);
- k = get_e(EEPROM_PROD_ID);
- if ((k & 0xf0ff) != (PROD_ID & 0xf0ff))
- goto no3c509;
-
- if(eth_base >= EP_EISA_START) {
- printf("3C5x9 board on EISA at 0x%x - ",eth_base);
- } else {
- printf("3C5x9 board on ISA at 0x%x - ",eth_base);
- }
-
- /* test for presence of connectors */
- i = inw(IS_BASE + EP_W0_CONFIG_CTRL);
- j = inw(IS_BASE + EP_W0_ADDRESS_CFG) >> 14;
-
- switch(j) {
- case 0:
- if(i & IS_UTP) {
- printf("10baseT\r\n");
- utp=1;
- }
- else {
- printf("10baseT not present\r\n");
- eth_vendor=VENDOR_NONE;
- goto no3c509;
- }
-
- break;
- case 1:
- if(i & IS_AUI)
- printf("10base5\r\n");
- else {
- printf("10base5 not present\r\n");
- eth_vendor=VENDOR_NONE;
- goto no3c509;
- }
-
- break;
- case 3:
- if(i & IS_BNC) {
- printf("10base2\r\n");
- bnc=1;
- }
- else {
- printf("10base2 not present\r\n");
- eth_vendor=VENDOR_NONE;
- goto no3c509;
- }
-
- break;
- default:
- printf("unknown connector\r\n");
- eth_vendor=VENDOR_NONE;
- goto no3c509;
- }
- /*
- * Read the station address from the eeprom
- */
- p = (u_short *) arptable[ARP_CLIENT].node;
- for (i = 0; i < 3; i++) {
- GO_WINDOW(0);
- p[i] = htons(get_e(i));
- GO_WINDOW(2);
- outw(BASE + EP_W2_ADDR_0 + (i * 2), ntohs(p[i]));
- }
-
- printf("Ethernet address: ");
- for(i=0; i<5; i++) {
- printf("%b:",arptable[ARP_CLIENT].node[i]);
- }
- printf("%b\n",arptable[ARP_CLIENT].node[i]);
-
- eth_node_addr = arptable[ARP_CLIENT].node;
- eth_reset();
- return eth_vendor;
-no3c509:
- eth_vendor = VENDOR_NONE;
-#endif
-
-#if defined(INCLUDE_3COM) || defined(INCLUDE_WD) || defined(INCLUDE_NE)
-#ifdef INCLUDE_WD
- /******************************************************************
- Search for WD/SMC cards
- *******************************************************************/
- for (eth_asic_base = WD_LOW_BASE; eth_asic_base <= WD_HIGH_BASE;
- eth_asic_base += 0x20) {
- chksum = 0;
- for (i=8; i<16; i++)
- chksum += inb(i+eth_asic_base);
- if ((chksum & 0x00FF) == 0x00FF)
- break;
- }
- if (eth_asic_base <= WD_HIGH_BASE) { /* We've found a board */
- eth_vendor = VENDOR_WD;
- eth_nic_base = eth_asic_base + WD_NIC_ADDR;
- c = inb(eth_asic_base+WD_BID); /* Get board id */
- for (brd = wd_boards; brd->name; brd++)
- if (brd->id == c) break;
- if (!brd->name) {
- printf("\r\nUnknown Ethernet type %x\r\n", c);
- return(0); /* Unknown type */
- }
- eth_flags = brd->flags;
- eth_memsize = brd->memsize;
- eth_tx_start = 0;
- if ((c == TYPE_WD8013EP) &&
- (inb(eth_asic_base + WD_ICR) & WD_ICR_16BIT)) {
- eth_flags = FLAG_16BIT;
- eth_memsize = MEM_16384;
- }
- if ((c & WD_SOFTCONFIG) && (!(eth_flags & FLAG_790))) {
- eth_bmem = (char *)(0x80000 |
- ((inb(eth_asic_base + WD_MSR) & 0x3F) << 13));
- } else
- eth_bmem = (char *)WD_DEFAULT_MEM;
- if (brd->id == TYPE_SMC8216T || brd->id == TYPE_SMC8216C) {
- (unsigned int) *(eth_bmem + 8192) = (unsigned int)0;
- if ((unsigned int) *(eth_bmem + 8192)) {
- brd += 2;
- eth_memsize = brd->memsize;
- }
- }
- outb(eth_asic_base + WD_MSR, 0x80); /* Reset */
- printf("\r\n%s base 0x%x, memory 0x%X, addr ",
- brd->name, eth_asic_base, eth_bmem);
- for (i=0; i<6; i++) {
- printf("%b",(int)(arptable[ARP_CLIENT].node[i] =
- inb(i+eth_asic_base+WD_LAR)));
- if (i < 5) printf (":");
- }
- if (eth_flags & FLAG_790) {
- outb(eth_asic_base+WD_MSR, WD_MSR_MENB);
- outb(eth_asic_base+0x04, (inb(eth_asic_base+0x04) |
- 0x80));
- outb(eth_asic_base+0x0B,
- (((unsigned)eth_bmem >> 13) & 0x0F) |
- (((unsigned)eth_bmem >> 11) & 0x40) |
- (inb(eth_asic_base+0x0B) & 0xB0));
- outb(eth_asic_base+0x04, (inb(eth_asic_base+0x04) &
- ~0x80));
- } else {
- outb(eth_asic_base+WD_MSR,
- (((unsigned)eth_bmem >> 13) & 0x3F) | 0x40);
- }
- if (eth_flags & FLAG_16BIT) {
- if (eth_flags & FLAG_790) {
- eth_laar = inb(eth_asic_base + WD_LAAR);
- outb(eth_asic_base + WD_LAAR, WD_LAAR_M16EN);
- inb(0x84);
- } else {
- outb(eth_asic_base + WD_LAAR, (eth_laar =
- WD_LAAR_M16EN | WD_LAAR_L16EN | 1));
- }
- }
- printf("\r\n");
-
- }
-#endif
-#ifdef INCLUDE_3COM
- /******************************************************************
- Search for 3Com 3c503 if no WD/SMC cards
- *******************************************************************/
- if (eth_vendor == VENDOR_NONE) {
- eth_asic_base = _3COM_BASE + _3COM_ASIC_OFFSET;
- eth_nic_base = _3COM_BASE;
- eth_vendor = VENDOR_3COM;
- /*
- * Note that we use the same settings for both 8 and 16 bit cards:
- * both have an 8K bank of memory at page 1 while only the 16 bit
- * cards have a bank at page 0.
- */
- eth_memsize = MEM_16384;
- eth_tx_start = 32;
-
- /* Check our base address */
-
- switch(inb(eth_asic_base + _3COM_BCFR)) {
- case _3COM_BCFR_300:
- if ((int)eth_nic_base != 0x300)
- return(0);
- break;
- case _3COM_BCFR_310:
- if ((int)eth_nic_base != 0x310)
- return(0);
- break;
- case _3COM_BCFR_330:
- if ((int)eth_nic_base != 0x330)
- return(0);
- break;
- case _3COM_BCFR_350:
- if ((int)eth_nic_base != 0x350)
- return(0);
- break;
- case _3COM_BCFR_250:
- if ((int)eth_nic_base != 0x250)
- return(0);
- break;
- case _3COM_BCFR_280:
- if ((int)eth_nic_base != 0x280)
- return(0);
- break;
- case _3COM_BCFR_2A0:
- if ((int)eth_nic_base != 0x2a0)
- return(0);
- break;
- case _3COM_BCFR_2E0:
- if ((int)eth_nic_base != 0x2e0)
- return(0);
- break;
- default:
- return (0);
- }
-
- /* Now get the shared memory address */
-
- switch (inb(eth_asic_base + _3COM_PCFR)) {
- case _3COM_PCFR_DC000:
- eth_bmem = (char *)0xdc000;
- break;
- case _3COM_PCFR_D8000:
- eth_bmem = (char *)0xd8000;
- break;
- case _3COM_PCFR_CC000:
- eth_bmem = (char *)0xcc000;
- break;
- case _3COM_PCFR_C8000:
- eth_bmem = (char *)0xc8000;
- break;
- default:
- return (0);
- }
-
- /* Need this to make eth_poll() happy. */
-
- eth_rmem = eth_bmem - 0x2000;
-
- /* Reset NIC and ASIC */
-
- outb (eth_asic_base + _3COM_CR , _3COM_CR_RST | _3COM_CR_XSEL);
- outb (eth_asic_base + _3COM_CR , _3COM_CR_XSEL);
-
- /* Get our ethernet address */
-
- outb(eth_asic_base + _3COM_CR, _3COM_CR_EALO | _3COM_CR_XSEL);
- printf("\r\n3Com 3c503 base 0x%x, memory 0x%X addr ",
- eth_nic_base, eth_bmem);
- for (i=0; i<6; i++) {
- printf("%b",(int)(arptable[ARP_CLIENT].node[i] =
- inb(eth_nic_base+i)));
- if (i < 5) printf (":");
- }
- outb(eth_asic_base + _3COM_CR, _3COM_CR_XSEL);
- /*
- * Initialize GA configuration register. Set bank and enable shared
- * mem. We always use bank 1.
- */
- outb(eth_asic_base + _3COM_GACFR, _3COM_GACFR_RSEL |
- _3COM_GACFR_MBS0);
-
- outb(eth_asic_base + _3COM_VPTR2, 0xff);
- outb(eth_asic_base + _3COM_VPTR1, 0xff);
- outb(eth_asic_base + _3COM_VPTR0, 0x00);
- /*
- * Clear memory and verify that it worked (we use only 8K)
- */
- bzero(eth_bmem, 0x2000);
- for(i = 0; i < 0x2000; ++i)
- if (*((eth_bmem)+i)) {
- printf ("Failed to clear 3c503 shared mem.\r\n");
- return (0);
- }
- /*
- * Initialize GA page/start/stop registers.
- */
- outb(eth_asic_base + _3COM_PSTR, eth_tx_start);
- outb(eth_asic_base + _3COM_PSPR, eth_memsize);
-
- printf ("\r\n");
-
- }
-#endif
-#ifdef INCLUDE_NE
- /******************************************************************
- Search for NE1000/2000 if no WD/SMC or 3com cards
- *******************************************************************/
- if (eth_vendor == VENDOR_NONE) {
- char romdata[16], testbuf[32];
- char test[] = "NE1000/2000 memory";
- eth_bmem = (char *)0; /* No shared memory */
- eth_asic_base = NE_BASE + NE_ASIC_OFFSET;
- eth_nic_base = NE_BASE;
- eth_vendor = VENDOR_NOVELL;
- eth_flags = FLAG_PIO;
- eth_memsize = MEM_16384;
- eth_tx_start = 32;
- c = inb(eth_asic_base + NE_RESET);
- outb(eth_asic_base + NE_RESET, c);
- inb(0x84);
- outb(eth_nic_base + D8390_P0_COMMAND, D8390_COMMAND_STP |
- D8390_COMMAND_RD2);
- outb(eth_nic_base + D8390_P0_RCR, D8390_RCR_MON);
- outb(eth_nic_base + D8390_P0_DCR, D8390_DCR_FT1 | D8390_DCR_LS);
- outb(eth_nic_base + D8390_P0_PSTART, MEM_8192);
- outb(eth_nic_base + D8390_P0_PSTOP, MEM_16384);
- eth_pio_write(test, 8192, sizeof(test));
- eth_pio_read(8192, testbuf, sizeof(test));
- if (!bcompare(test, testbuf, sizeof(test))) {
- eth_flags |= FLAG_16BIT;
- eth_memsize = MEM_32768;
- eth_tx_start = 64;
- outb(eth_nic_base + D8390_P0_DCR, D8390_DCR_WTS |
- D8390_DCR_FT1 | D8390_DCR_LS);
- outb(eth_nic_base + D8390_P0_PSTART, MEM_16384);
- outb(eth_nic_base + D8390_P0_PSTOP, MEM_32768);
- eth_pio_write(test, 16384, sizeof(test));
- eth_pio_read(16384, testbuf, sizeof(test));
- if (!bcompare(testbuf, test, sizeof(test))) return (0);
- }
- eth_pio_read(0, romdata, 16);
- printf("\r\nNE1000/NE2000 base 0x%x, addr ", eth_nic_base);
- for (i=0; i<6; i++) {
- printf("%b",(int)(arptable[ARP_CLIENT].node[i] = romdata[i
- + ((eth_flags & FLAG_16BIT) ? i : 0)]));
- if (i < 5) printf (":");
- }
- printf("\r\n");
- }
- if (eth_vendor == VENDOR_NONE)
- goto no8390;
-
- if (eth_vendor != VENDOR_3COM) eth_rmem = eth_bmem;
- eth_node_addr = arptable[ARP_CLIENT].node;
- eth_reset();
- return(eth_vendor);
-#endif /* NE */
-no8390:
-#endif /*8390 */
-
- return VENDOR_NONE;
-}
-
-/**************************************************************************
-ETH_RESET - Reset adapter
-***************************************************************************/
-eth_reset()
-{
- int s, i;
-
-#ifdef INCLUDE_3C509
-
- /***********************************************************
- Reset 3Com 509 card
- *************************************************************/
-
- if(eth_vendor != VENDOR_3C509)
- goto no3c509;
-
- /* stop card */
- outw(BASE + EP_COMMAND, RX_DISABLE);
- outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK);
- while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);
- outw(BASE + EP_COMMAND, TX_DISABLE);
- outw(BASE + EP_COMMAND, STOP_TRANSCEIVER);
- outw(BASE + EP_COMMAND, RX_RESET);
- outw(BASE + EP_COMMAND, TX_RESET);
- outw(BASE + EP_COMMAND, C_INTR_LATCH);
- outw(BASE + EP_COMMAND, SET_RD_0_MASK);
- outw(BASE + EP_COMMAND, SET_INTR_MASK);
- outw(BASE + EP_COMMAND, SET_RX_FILTER);
-
- /*
- /* initialize card
- */
- while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);
-
- GO_WINDOW(0);
-
- /* Disable the card */
- outw(BASE + EP_W0_CONFIG_CTRL, 0);
-
- /* Configure IRQ to none */
- outw(BASE + EP_W0_RESOURCE_CFG, SET_IRQ(0));
-
- /* Enable the card */
- outw(BASE + EP_W0_CONFIG_CTRL, ENABLE_DRQ_IRQ);
-
- GO_WINDOW(2);
-
- /* Reload the ether_addr. */
- for (i = 0; i < 6; i++)
- outb(BASE + EP_W2_ADDR_0 + i, arptable[ARP_CLIENT].node[i]);
-
- outw(BASE + EP_COMMAND, RX_RESET);
- outw(BASE + EP_COMMAND, TX_RESET);
-
- /* Window 1 is operating window */
- GO_WINDOW(1);
- for (i = 0; i < 31; i++)
- inb(BASE + EP_W1_TX_STATUS);
-
- /* get rid of stray intr's */
- outw(BASE + EP_COMMAND, ACK_INTR | 0xff);
-
- outw(BASE + EP_COMMAND, SET_RD_0_MASK | S_5_INTS);
-
- outw(BASE + EP_COMMAND, SET_INTR_MASK | S_5_INTS);
-
- outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL |
- FIL_BRDCST);
-
- /* configure BNC */
- if(bnc) {
- outw(BASE + EP_COMMAND, START_TRANSCEIVER);
- DELAY(1000);
- }
- /* configure UTP */
- if(utp) {
- GO_WINDOW(4);
- outw(BASE + EP_W4_MEDIA_TYPE, ENABLE_UTP);
- GO_WINDOW(1);
- }
-
- /* start tranciever and receiver */
- outw(BASE + EP_COMMAND, RX_ENABLE);
- outw(BASE + EP_COMMAND, TX_ENABLE);
-
- /* set early threshold for minimal packet length */
- outw(BASE + EP_COMMAND, SET_RX_EARLY_THRESH | 64);
-
- outw(BASE + EP_COMMAND, SET_TX_START_THRESH | 16);
-
- return 1;
-no3c509:
-
-#endif
-
-#if defined(INCLUDE_3COM) || defined(INCLUDE_WD) || defined(INCLUDE_NE)
-
- /**************************************************************
- Reset cards based on 8390 chip
- ****************************************************************/
-
- if(eth_vendor!=VENDOR_WD && eth_vendor!=VENDOR_NOVELL
- && eth_vendor!=VENDOR_3COM)
- goto no8390;
-
- if (eth_flags & FLAG_790)
- outb(eth_nic_base+D8390_P0_COMMAND,
- D8390_COMMAND_PS0 | D8390_COMMAND_STP);
- else
- outb(eth_nic_base+D8390_P0_COMMAND,
- D8390_COMMAND_PS0 | D8390_COMMAND_RD2 |
- D8390_COMMAND_STP);
- if (eth_flags & FLAG_16BIT)
- outb(eth_nic_base+D8390_P0_DCR, 0x49);
- else
- outb(eth_nic_base+D8390_P0_DCR, 0x48);
- outb(eth_nic_base+D8390_P0_RBCR0, 0);
- outb(eth_nic_base+D8390_P0_RBCR1, 0);
- outb(eth_nic_base+D8390_P0_RCR, 4); /* allow broadcast frames */
- outb(eth_nic_base+D8390_P0_TCR, 2);
- outb(eth_nic_base+D8390_P0_TPSR, eth_tx_start);
- outb(eth_nic_base+D8390_P0_PSTART, eth_tx_start + D8390_TXBUF_SIZE);
- if (eth_flags & FLAG_790) outb(eth_nic_base + 0x09, 0);
- outb(eth_nic_base+D8390_P0_PSTOP, eth_memsize);
- outb(eth_nic_base+D8390_P0_BOUND, eth_tx_start + D8390_TXBUF_SIZE);
- outb(eth_nic_base+D8390_P0_ISR, 0xFF);
- outb(eth_nic_base+D8390_P0_IMR, 0);
- if (eth_flags & FLAG_790)
- outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS1 |
- D8390_COMMAND_STP);
- else
- outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS1 |
- D8390_COMMAND_RD2 | D8390_COMMAND_STP);
- for (i=0; i<6; i++)
- outb(eth_nic_base+D8390_P1_PAR0+i, eth_node_addr[i]);
- for (i=0; i<6; i++)
- outb(eth_nic_base+D8390_P1_MAR0+i, 0xFF);
- outb(eth_nic_base+D8390_P1_CURR, eth_tx_start + D8390_TXBUF_SIZE+1);
- if (eth_flags & FLAG_790)
- outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 |
- D8390_COMMAND_STA);
- else
- outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 |
- D8390_COMMAND_RD2 | D8390_COMMAND_STA);
- outb(eth_nic_base+D8390_P0_ISR, 0xFF);
- outb(eth_nic_base+D8390_P0_TCR, 0);
-#ifdef INCLUDE_3COM
- if (eth_vendor == VENDOR_3COM) {
- /*
- * No way to tell whether or not we're supposed to use
- * the 3Com's transceiver unless the user tells us.
- * 'aui' should have some compile time default value
- * which can be changed from the command menu.
- */
- if (aui)
- outb(eth_asic_base + _3COM_CR, 0);
- else
- outb(eth_asic_base + _3COM_CR, _3COM_CR_XSEL);
- }
-#endif
- return(1);
-no8390:
-#endif /* 8390 */
-}
-
-/**************************************************************************
-ETH_TRANSMIT - Transmit a frame
-***************************************************************************/
-static const char padmap[] = {
- 0, 3, 2, 1};
-
-eth_transmit(d,t,s,p)
-char *d; /* Destination */
-unsigned short t; /* Type */
-unsigned short s; /* size */
-char *p; /* Packet */
-{
- register u_int len;
- int pad;
- int status;
- unsigned char c;
-
-#ifdef INCLUDE_3C509
-
- if(eth_vendor != VENDOR_3C509)
- goto no3c509;
-
-#ifdef EDEBUG
- printf("{l=%d,t=%x}",s+14,t);
-#endif
-
- /* swap bytes of type */
- t=(( t&0xFF )<<8) | ((t>>8) & 0xFF);
-
- len=s+14; /* actual length of packet */
- pad = padmap[len & 3];
-
- /*
- * The 3c509 automatically pads short packets to minimum ethernet length,
- * but we drop packets that are too large. Perhaps we should truncate
- * them instead?
- */
- if (len + pad > ETHER_MAX_LEN) {
- return 0;
- }
-
- /* drop acknowledgements */
- while(( status=inb(BASE + EP_W1_TX_STATUS) )& TXS_COMPLETE ) {
- if(status & (TXS_UNDERRUN|TXS_MAX_COLLISION|TXS_STATUS_OVERFLOW)) {
- outw(BASE + EP_COMMAND, TX_RESET);
- outw(BASE + EP_COMMAND, TX_ENABLE);
- }
-
- outb(BASE + EP_W1_TX_STATUS, 0x0);
- }
-
- while (inw(BASE + EP_W1_FREE_TX) < len + pad + 4) {
- /* no room in FIFO */
- }
-
- outw(BASE + EP_W1_TX_PIO_WR_1, len);
- outw(BASE + EP_W1_TX_PIO_WR_1, 0x0); /* Second dword meaningless */
-
- /* write packet */
- outsw(BASE + EP_W1_TX_PIO_WR_1, d, 3);
- outsw(BASE + EP_W1_TX_PIO_WR_1, eth_node_addr, 3);
- outw(BASE + EP_W1_TX_PIO_WR_1, t);
- outsw(BASE + EP_W1_TX_PIO_WR_1, p, s / 2);
- if (s & 1)
- outb(BASE + EP_W1_TX_PIO_WR_1, *(p+s - 1));
-
- while (pad--)
- outb(BASE + EP_W1_TX_PIO_WR_1, 0); /* Padding */
-
- /* timeout after sending */
- DELAY(1000);
- return 0;
-no3c509:
-#endif /* 3C509 */
-
-#if defined(INCLUDE_3COM) || defined(INCLUDE_WD) || defined(INCLUDE_NE)
-
- if(eth_vendor!=VENDOR_WD && eth_vendor!=VENDOR_NOVELL
- && eth_vendor!=VENDOR_3COM)
- goto no8390;
-
-#ifdef INCLUDE_3COM
- if (eth_vendor == VENDOR_3COM) {
- bcopy(d, eth_bmem, 6); /* dst */
- bcopy(eth_node_addr, eth_bmem+6, ETHER_ADDR_SIZE); /* src */
- *(eth_bmem+12) = t>>8; /* type */
- *(eth_bmem+13) = t;
- bcopy(p, eth_bmem+14, s);
- s += 14;
- while (s < ETH_MIN_PACKET) *(eth_bmem+(s++)) = 0;
- }
-#endif
-#ifdef INCLUDE_WD
- if (eth_vendor == VENDOR_WD) { /* Memory interface */
- if (eth_flags & FLAG_16BIT) {
- outb(eth_asic_base + WD_LAAR, eth_laar | WD_LAAR_M16EN);
- inb(0x84);
- }
- if (eth_flags & FLAG_790) {
- outb(eth_asic_base + WD_MSR, WD_MSR_MENB);
- inb(0x84);
- }
- inb(0x84);
- bcopy(d, eth_bmem, 6); /* dst */
- bcopy(eth_node_addr, eth_bmem+6, ETHER_ADDR_SIZE); /* src */
- *(eth_bmem+12) = t>>8; /* type */
- *(eth_bmem+13) = t;
- bcopy(p, eth_bmem+14, s);
- s += 14;
- while (s < ETH_MIN_PACKET) *(eth_bmem+(s++)) = 0;
- if (eth_flags & FLAG_790) {
- outb(eth_asic_base + WD_MSR, 0);
- inb(0x84);
- }
- if (eth_flags & FLAG_16BIT) {
- outb(eth_asic_base + WD_LAAR, eth_laar & ~WD_LAAR_M16EN);
- inb(0x84);
- }
- }
-#endif
-#ifdef INCLUDE_NE
- if (eth_vendor == VENDOR_NOVELL) { /* Programmed I/O */
- unsigned short type;
- type = (t >> 8) | (t << 8);
- eth_pio_write(d, eth_tx_start<<8, 6);
- eth_pio_write(eth_node_addr, (eth_tx_start<<8)+6, 6);
- eth_pio_write(&type, (eth_tx_start<<8)+12, 2);
- eth_pio_write(p, (eth_tx_start<<8)+14, s);
- s += 14;
- if (s < ETH_MIN_PACKET) s = ETH_MIN_PACKET;
- }
-#endif
- twiddle();
- if (eth_flags & FLAG_790)
- outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 |
- D8390_COMMAND_STA);
- else
- outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 |
- D8390_COMMAND_RD2 | D8390_COMMAND_STA);
- outb(eth_nic_base+D8390_P0_TPSR, eth_tx_start);
- outb(eth_nic_base+D8390_P0_TBCR0, s);
- outb(eth_nic_base+D8390_P0_TBCR1, s>>8);
- if (eth_flags & FLAG_790)
- outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 |
- D8390_COMMAND_TXP | D8390_COMMAND_STA);
- else
- outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 |
- D8390_COMMAND_TXP | D8390_COMMAND_RD2 |
- D8390_COMMAND_STA);
- return(0);
-
-no8390:
-#endif /* 8390 */
-}
-
-/**************************************************************************
-ETH_POLL - Wait for a frame
-***************************************************************************/
-eth_poll()
-{
- /* common variables */
- unsigned short type = 0;
- unsigned short len;
- /* variables for 3C509 */
-#ifdef INCLUDE_3C509
- struct ether_header *eh;
- int lenthisone;
- short rx_fifo2, status, cst;
- register short rx_fifo;
-#endif
- /* variables for 8390 */
-#if defined(INCLUDE_3COM) || defined(INCLUDE_WD) || defined(INCLUDE_NE)
- int ret = 0;
- unsigned char bound,curr,rstat;
- unsigned short pktoff;
- unsigned char *p;
- struct ringbuffer pkthdr;
-#endif
-
-#ifdef INCLUDE_3C509
-
- if(eth_vendor!=VENDOR_3C509)
- goto no3c509;
-
- cst=inw(BASE + EP_STATUS);
-
-#ifdef EDEBUG
- if(cst & 0x1FFF)
- printf("-%x-",cst);
-#endif
-
- if( (cst & (S_RX_COMPLETE|S_RX_EARLY) )==0 ) {
- /* acknowledge everything */
- outw(BASE + EP_COMMAND, ACK_INTR| (cst & S_5_INTS));
- outw(BASE + EP_COMMAND, C_INTR_LATCH);
-
- return 0;
- }
-
- status = inw(BASE + EP_W1_RX_STATUS);
-#ifdef EDEBUG
- printf("*%x*",status);
-#endif
-
- if (status & ERR_RX) {
- outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK);
- return 0;
- }
-
- rx_fifo = status & RX_BYTES_MASK;
- if (rx_fifo==0)
- return 0;
-
- /* read packet */
-#ifdef EDEBUG
- printf("[l=%d",rx_fifo);
-#endif
- insw(BASE + EP_W1_RX_PIO_RD_1, packet, rx_fifo / 2);
- if(rx_fifo & 1)
- packet[rx_fifo-1]=inb(BASE + EP_W1_RX_PIO_RD_1);
- packetlen=rx_fifo;
-
- while(1) {
- status = inw(BASE + EP_W1_RX_STATUS);
-#ifdef EDEBUG
- printf("*%x*",status);
-#endif
- rx_fifo = status & RX_BYTES_MASK;
-
- if(rx_fifo>0) {
- insw(BASE + EP_W1_RX_PIO_RD_1, packet+packetlen, rx_fifo / 2);
- if(rx_fifo & 1)
- packet[packetlen+rx_fifo-1]=inb(BASE + EP_W1_RX_PIO_RD_1);
- packetlen+=rx_fifo;
-#ifdef EDEBUG
- printf("+%d",rx_fifo);
-#endif
- }
-
- if(( status & RX_INCOMPLETE )==0) {
-#ifdef EDEBUG
- printf("=%d",packetlen);
-#endif
- break;
- }
-
- DELAY(1000);
- }
-
- /* acknowledge reception of packet */
- outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK);
- while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);
-
- type = (packet[12]<<8) | packet[13];
-
-#ifdef EDEBUG
- if(packet[0]+packet[1]+packet[2]+packet[3]+packet[4]+
- packet[5] == 0xFF*6)
- printf(",t=0x%x,b]",type);
- else
- printf(",t=0x%x]",type);
-#endif
-
-
- if (type == ARP) {
- struct arprequest *arpreq;
- unsigned long reqip;
-
- arpreq = (struct arprequest *)&packet[ETHER_HDR_SIZE];
-
-#ifdef EDEBUG
- printf("(ARP %I->%I)",ntohl(*(int*)arpreq->sipaddr),
- ntohl(*(int*)arpreq->tipaddr));
-#endif
-
- convert_ipaddr(&reqip, arpreq->tipaddr);
- if ((ntohs(arpreq->opcode) == ARP_REQUEST) &&
- (reqip == arptable[ARP_CLIENT].ipaddr)) {
- arpreq->opcode = htons(ARP_REPLY);
- bcopy(arpreq->sipaddr, arpreq->tipaddr, 4);
- bcopy(arpreq->shwaddr, arpreq->thwaddr, 6);
- bcopy(arptable[ARP_CLIENT].node, arpreq->shwaddr, 6);
- convert_ipaddr(arpreq->sipaddr, &reqip);
- eth_transmit(arpreq->thwaddr, ARP, sizeof(struct arprequest),
- arpreq);
- return(0);
- }
- } else if(type==IP) {
- struct iphdr *iph;
-
- iph = (struct iphdr *)&packet[ETHER_HDR_SIZE];
-#ifdef EDEBUG
- printf("(IP %I-%d->%I)",ntohl(*(int*)iph->src),
- ntohs(iph->protocol),ntohl(*(int*)iph->dest));
-#endif
- }
-
- return 1;
-
-no3c509:
-#endif /* 3C509 */
-#if defined(INCLUDE_3COM) || defined(INCLUDE_WD) || defined(INCLUDE_NE)
-
- if(eth_vendor!=VENDOR_WD && eth_vendor!=VENDOR_NOVELL
- && eth_vendor!=VENDOR_3COM)
- goto no8390;
-
- rstat = inb(eth_nic_base+D8390_P0_RSR);
- if (rstat & D8390_RSTAT_OVER) {
- eth_reset();
- return(0);
- }
- if (!(rstat & D8390_RSTAT_PRX)) return(0);
- bound = inb(eth_nic_base+D8390_P0_BOUND)+1;
- if (bound == eth_memsize) bound = eth_tx_start + D8390_TXBUF_SIZE;
- outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS1);
- curr = inb(eth_nic_base+D8390_P1_CURR);
- outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0);
- if (curr == eth_memsize) curr=eth_tx_start + D8390_TXBUF_SIZE;
- if (curr == bound) return(0);
- if (eth_vendor == VENDOR_WD) {
- if (eth_flags & FLAG_16BIT) {
- outb(eth_asic_base + WD_LAAR, eth_laar | WD_LAAR_M16EN);
- inb(0x84);
- }
- if (eth_flags & FLAG_790) {
- outb(eth_asic_base + WD_MSR, WD_MSR_MENB);
- inb(0x84);
- }
- inb(0x84);
- }
- pktoff = (bound << 8);
- if (eth_flags & FLAG_PIO)
- eth_pio_read(pktoff, &pkthdr, 4);
- else
- bcopy(eth_rmem + pktoff, &pkthdr, 4);
- len = pkthdr.len - 4; /* sub CRC */
- pktoff += 4;
- if (len > 1514) len = 1514;
- bound = pkthdr.bound; /* New bound ptr */
- if ( (pkthdr.status & D8390_RSTAT_PRX) && (len > 14) && (len < 1518)) {
- p = packet;
- packetlen = len;
- len = (eth_memsize << 8) - pktoff;
- if (packetlen > len) { /* We have a wrap-around */
- if (eth_flags & FLAG_PIO)
- eth_pio_read(pktoff, p, len);
- else
- bcopy(eth_rmem + pktoff, p, len);
- pktoff = (eth_tx_start + D8390_TXBUF_SIZE) << 8;
- p += len;
- packetlen -= len;
- }
- if (eth_flags & FLAG_PIO)
- eth_pio_read(pktoff, p, packetlen);
- else
- bcopy(eth_rmem + pktoff, p, packetlen);
-
- type = (packet[12]<<8) | packet[13];
- ret = 1;
- }
- if (eth_vendor == VENDOR_WD) {
- if (eth_flags & FLAG_790) {
- outb(eth_asic_base + WD_MSR, 0);
- inb(0x84);
- }
- if (eth_flags & FLAG_16BIT) {
- outb(eth_asic_base + WD_LAAR, eth_laar &
- ~WD_LAAR_M16EN);
- inb(0x84);
- }
- inb(0x84);
- }
- if (bound == (eth_tx_start + D8390_TXBUF_SIZE))
- bound = eth_memsize;
- outb(eth_nic_base+D8390_P0_BOUND, bound-1);
- if (ret && (type == ARP)) {
- struct arprequest *arpreq;
- unsigned long reqip;
- arpreq = (struct arprequest *)&packet[ETHER_HDR_SIZE];
- convert_ipaddr(&reqip, arpreq->tipaddr);
- if ((ntohs(arpreq->opcode) == ARP_REQUEST) &&
- (reqip == arptable[ARP_CLIENT].ipaddr)) {
- arpreq->opcode = htons(ARP_REPLY);
- bcopy(arpreq->sipaddr, arpreq->tipaddr, 4);
- bcopy(arpreq->shwaddr, arpreq->thwaddr, 6);
- bcopy(arptable[ARP_CLIENT].node, arpreq->shwaddr, 6);
- convert_ipaddr(arpreq->sipaddr, &reqip);
- eth_transmit(arpreq->thwaddr, ARP, sizeof(struct arprequest),
- arpreq);
- return(0);
- }
- }
- return(ret);
-no8390:
-#endif /* 8390 */
-}
-
-#ifdef INCLUDE_NE
-/**************************************************************************
-NE1000/NE2000 Support Routines
-***************************************************************************/
-
-/* inw and outw are not needed more - standard version of them is used */
-
-/**************************************************************************
-ETH_PIO_READ - Read a frame via Programmed I/O
-***************************************************************************/
-eth_pio_read(src, dst, cnt, init)
-unsigned short src;
-unsigned char *dst;
-unsigned short cnt;
-int init;
-{
- if (cnt & 1) cnt++;
- outb(eth_nic_base + D8390_P0_COMMAND, D8390_COMMAND_RD2 |
- D8390_COMMAND_STA);
- outb(eth_nic_base + D8390_P0_RBCR0, cnt);
- outb(eth_nic_base + D8390_P0_RBCR1, cnt>>8);
- outb(eth_nic_base + D8390_P0_RSAR0, src);
- outb(eth_nic_base + D8390_P0_RSAR1, src>>8);
- outb(eth_nic_base + D8390_P0_COMMAND, D8390_COMMAND_RD0 |
- D8390_COMMAND_STA);
- if (eth_flags & FLAG_16BIT) {
- while (cnt) {
- *((unsigned short *)dst) = inw(eth_asic_base + NE_DATA);
- dst += 2;
- cnt -= 2;
- }
- }
- else {
- while (cnt--)
- *(dst++) = inb(eth_asic_base + NE_DATA);
- }
-}
-
-/**************************************************************************
-ETH_PIO_WRITE - Write a frame via Programmed I/O
-***************************************************************************/
-eth_pio_write(src, dst, cnt, init)
-unsigned char *src;
-unsigned short dst;
-unsigned short cnt;
-int init;
-{
- outb(eth_nic_base + D8390_P0_COMMAND, D8390_COMMAND_RD2 |
- D8390_COMMAND_STA);
- outb(eth_nic_base + D8390_P0_ISR, D8390_ISR_RDC);
- outb(eth_nic_base + D8390_P0_RBCR0, cnt);
- outb(eth_nic_base + D8390_P0_RBCR1, cnt>>8);
- outb(eth_nic_base + D8390_P0_RSAR0, dst);
- outb(eth_nic_base + D8390_P0_RSAR1, dst>>8);
- outb(eth_nic_base + D8390_P0_COMMAND, D8390_COMMAND_RD1 |
- D8390_COMMAND_STA);
- if (eth_flags & FLAG_16BIT) {
- if (cnt & 1) cnt++; /* Round up */
- while (cnt) {
- outw(eth_asic_base + NE_DATA, *((unsigned short *)src));
- src += 2;
- cnt -= 2;
- }
- }
- else {
- while (cnt--)
- outb(eth_asic_base + NE_DATA, *(src++));
- }
- while((inb(eth_nic_base + D8390_P0_ISR) & D8390_ISR_RDC)
- != D8390_ISR_RDC);
-}
-#else
-/**************************************************************************
-ETH_PIO_READ - Dummy routine when NE2000 not compiled in
-***************************************************************************/
-eth_pio_read() {
-}
-#endif
-
-#ifdef INCLUDE_3C509
-/*************************************************************************
- 3Com 509 - specific routines
-**************************************************************************/
-
-static int
-eeprom_rdy()
-{
- int i;
-
- for (i = 0; is_eeprom_busy(IS_BASE) && i < MAX_EEPROMBUSY; i++);
- if (i >= MAX_EEPROMBUSY) {
- printf("3c509: eeprom failed to come ready.\r\n");
- return (0);
- }
- return (1);
-}
-
-/*
- * get_e: gets a 16 bits word from the EEPROM. we must have set the window
- * before
- */
-static int
-get_e(offset)
-int offset;
-{
- if (!eeprom_rdy())
- return (0xffff);
- outw(IS_BASE + EP_W0_EEPROM_COMMAND, EEPROM_CMD_RD | offset);
- if (!eeprom_rdy())
- return (0xffff);
- return (inw(IS_BASE + EP_W0_EEPROM_DATA));
-}
-
-static int
-send_ID_sequence(port)
-int port;
-{
- int cx, al;
-
- for (al = 0xff, cx = 0; cx < 255; cx++) {
- outb(port, al);
- al <<= 1;
- if (al & 0x100)
- al ^= 0xcf;
- }
- return (1);
-}
-
-
-/*
- * We get eeprom data from the id_port given an offset into the eeprom.
- * Basically; after the ID_sequence is sent to all of the cards; they enter
- * the ID_CMD state where they will accept command requests. 0x80-0xbf loads
- * the eeprom data. We then read the port 16 times and with every read; the
- * cards check for contention (ie: if one card writes a 0 bit and another
- * writes a 1 bit then the host sees a 0. At the end of the cycle; each card
- * compares the data on the bus; if there is a difference then that card goes
- * into ID_WAIT state again). In the meantime; one bit of data is returned in
- * the AX register which is conveniently returned to us by inb(). Hence; we
- * read 16 times getting one bit of data with each read.
- */
-static int
-get_eeprom_data(id_port, offset)
-int id_port;
-int offset;
-{
- int i, data = 0;
- outb(id_port, 0x80 + offset);
- DELAY(1000);
- for (i = 0; i < 16; i++)
- data = (data << 1) | (inw(id_port) & 1);
- return (data);
-}
-
-/* a surrogate */
-
-DELAY(val)
-{
- int c;
-
- for(c=0; c<val; c+=20) {
- twiddle();
- }
-}
-
-#endif
-
diff --git a/sys/i386/boot/netboot/ether.h b/sys/i386/boot/netboot/ether.h
deleted file mode 100644
index 8cd4df4..0000000
--- a/sys/i386/boot/netboot/ether.h
+++ /dev/null
@@ -1,262 +0,0 @@
-/**************************************************************************
-NETBOOT - BOOTP/TFTP Bootstrap Program
-
-Author: Martin Renters
- Date: Jun/94
-
-**************************************************************************/
-
-#define TRUE 1
-#define FALSE 0
-
-#define ETH_MIN_PACKET 64
-#define ETH_MAX_PACKET 1518
-
-#define VENDOR_NONE 0
-#define VENDOR_WD 1
-#define VENDOR_NOVELL 2
-#define VENDOR_3COM 3
-#define VENDOR_3C509 4
-
-#define FLAG_PIO 0x01
-#define FLAG_16BIT 0x02
-#define FLAG_790 0x04
-
-#define MEM_8192 32
-#define MEM_16384 64
-#define MEM_32768 128
-
-/**************************************************************************
-Western Digital/SMC Board Definitions
-**************************************************************************/
-#define WD_LOW_BASE 0x200
-#define WD_HIGH_BASE 0x3e0
-#ifndef WD_DEFAULT_MEM
-#define WD_DEFAULT_MEM 0xD0000
-#endif
-#define WD_NIC_ADDR 0x10
-
-/**************************************************************************
-Western Digital/SMC ASIC Addresses
-**************************************************************************/
-#define WD_MSR 0x00
-#define WD_ICR 0x01
-#define WD_IAR 0x02
-#define WD_BIO 0x03
-#define WD_IRR 0x04
-#define WD_LAAR 0x05
-#define WD_IJR 0x06
-#define WD_GP2 0x07
-#define WD_LAR 0x08
-#define WD_BID 0x0E
-
-#define WD_ICR_16BIT 0x01
-
-#define WD_MSR_MENB 0x40
-
-#define WD_LAAR_L16EN 0x40
-#define WD_LAAR_M16EN 0x80
-
-#define WD_SOFTCONFIG 0x20
-
-/**************************************************************************
-Western Digital/SMC Board Types
-**************************************************************************/
-#define TYPE_WD8003S 0x02
-#define TYPE_WD8003E 0x03
-#define TYPE_WD8013EBT 0x05
-#define TYPE_WD8003W 0x24
-#define TYPE_WD8003EB 0x25
-#define TYPE_WD8013W 0x26
-#define TYPE_WD8013EP 0x27
-#define TYPE_WD8013WC 0x28
-#define TYPE_WD8013EPC 0x29
-#define TYPE_SMC8216T 0x2a
-#define TYPE_SMC8216C 0x2b
-#define TYPE_SMC8416T 0x00 /* Bogus entries: the 8416 generates the */
-#define TYPE_SMC8416C 0x00 /* the same codes as the 8216. */
-#define TYPE_SMC8013EBP 0x2c
-
-#ifdef INCLUDE_WD
-struct wd_board {
- char *name;
- char id;
- char flags;
- char memsize;
-} wd_boards[] = {
- {"WD8003S", TYPE_WD8003S, 0, MEM_8192},
- {"WD8003E", TYPE_WD8003E, 0, MEM_8192},
- {"WD8013EBT", TYPE_WD8013EBT, FLAG_16BIT, MEM_16384},
- {"WD8003W", TYPE_WD8003W, 0, MEM_8192},
- {"WD8003EB", TYPE_WD8003EB, 0, MEM_8192},
- {"WD8013W", TYPE_WD8013W, FLAG_16BIT, MEM_16384},
- {"WD8003EP/WD8013EP",
- TYPE_WD8013EP, 0, MEM_8192},
- {"WD8013WC", TYPE_WD8013WC, FLAG_16BIT, MEM_16384},
- {"WD8013EPC", TYPE_WD8013EPC, FLAG_16BIT, MEM_16384},
- {"SMC8216T", TYPE_SMC8216T, FLAG_16BIT | FLAG_790, MEM_16384},
- {"SMC8216C", TYPE_SMC8216C, FLAG_16BIT | FLAG_790, MEM_16384},
- {"SMC8416T", TYPE_SMC8416T, FLAG_16BIT | FLAG_790, MEM_8192},
- {"SMC8416C/BT", TYPE_SMC8416C, FLAG_16BIT | FLAG_790, MEM_8192},
- {"SMC8013EBP", TYPE_SMC8013EBP,FLAG_16BIT, MEM_16384},
- {NULL, 0, 0}
-};
-#endif
-/**************************************************************************
-3com 3c503 definitions
-**************************************************************************/
-
-#ifndef _3COM_BASE
-#define _3COM_BASE 0x300
-#endif
-
-#define _3COM_TX_PAGE_OFFSET_8BIT 0x20
-#define _3COM_TX_PAGE_OFFSET_16BIT 0x0
-#define _3COM_RX_PAGE_OFFSET_16BIT 0x20
-
-#define _3COM_ASIC_OFFSET 0x400
-#define _3COM_NIC_OFFSET 0x0
-
-#define _3COM_PSTR 0
-#define _3COM_PSPR 1
-
-#define _3COM_BCFR 3
-#define _3COM_BCFR_2E0 0x01
-#define _3COM_BCFR_2A0 0x02
-#define _3COM_BCFR_280 0x04
-#define _3COM_BCFR_250 0x08
-#define _3COM_BCFR_350 0x10
-#define _3COM_BCFR_330 0x20
-#define _3COM_BCFR_310 0x40
-#define _3COM_BCFR_300 0x80
-#define _3COM_PCFR 4
-#define _3COM_PCFR_C8000 0x10
-#define _3COM_PCFR_CC000 0x20
-#define _3COM_PCFR_D8000 0x40
-#define _3COM_PCFR_DC000 0x80
-#define _3COM_CR 6
-#define _3COM_CR_RST 0x01 /* Reset GA and NIC */
-#define _3COM_CR_XSEL 0x02 /* Transceiver select. BNC=1(def) AUI=0 */
-#define _3COM_CR_EALO 0x04 /* window EA PROM 0-15 to I/O base */
-#define _3COM_CR_EAHI 0x08 /* window EA PROM 16-31 to I/O base */
-#define _3COM_CR_SHARE 0x10 /* select interrupt sharing option */
-#define _3COM_CR_DBSEL 0x20 /* Double buffer select */
-#define _3COM_CR_DDIR 0x40 /* DMA direction select */
-#define _3COM_CR_START 0x80 /* Start DMA controller */
-#define _3COM_GACFR 5
-#define _3COM_GACFR_MBS0 0x01
-#define _3COM_GACFR_MBS1 0x02
-#define _3COM_GACFR_MBS2 0x04
-#define _3COM_GACFR_RSEL 0x08 /* enable shared memory */
-#define _3COM_GACFR_TEST 0x10 /* for GA testing */
-#define _3COM_GACFR_OWS 0x20 /* select 0WS access to GA */
-#define _3COM_GACFR_TCM 0x40 /* Mask DMA interrupts */
-#define _3COM_GACFR_NIM 0x80 /* Mask NIC interrupts */
-#define _3COM_STREG 7
-#define _3COM_STREG_REV 0x07 /* GA revision */
-#define _3COM_STREG_DIP 0x08 /* DMA in progress */
-#define _3COM_STREG_DTC 0x10 /* DMA terminal count */
-#define _3COM_STREG_OFLW 0x20 /* Overflow */
-#define _3COM_STREG_UFLW 0x40 /* Underflow */
-#define _3COM_STREG_DPRDY 0x80 /* Data port ready */
-#define _3COM_IDCFR 8
-#define _3COM_IDCFR_DRQ0 0x01 /* DMA request 1 select */
-#define _3COM_IDCFR_DRQ1 0x02 /* DMA request 2 select */
-#define _3COM_IDCFR_DRQ2 0x04 /* DMA request 3 select */
-#define _3COM_IDCFR_UNUSED 0x08 /* not used */
-#define _3COM_IDCFR_IRQ2 0x10 /* Interrupt request 2 select */
-#define _3COM_IDCFR_IRQ3 0x20 /* Interrupt request 3 select */
-#define _3COM_IDCFR_IRQ4 0x40 /* Interrupt request 4 select */
-#define _3COM_IDCFR_IRQ5 0x80 /* Interrupt request 5 select */
-#define _3COM_IRQ2 2
-#define _3COM_IRQ3 3
-#define _3COM_IRQ4 4
-#define _3COM_IRQ5 5
-#define _3COM_DAMSB 9
-#define _3COM_DALSB 0x0a
-#define _3COM_VPTR2 0x0b
-#define _3COM_VPTR1 0x0c
-#define _3COM_VPTR0 0x0d
-#define _3COM_RFMSB 0x0e
-#define _3COM_RFLSB 0x0f
-
-/**************************************************************************
-NE1000/2000 definitions
-**************************************************************************/
-#ifndef NE_BASE
-#define NE_BASE 0x320
-#endif
-#define NE_ASIC_OFFSET 0x10
-#define NE_RESET 0x0F /* Used to reset card */
-#define NE_DATA 0x00 /* Used to read/write NIC mem */
-
-/**************************************************************************
-8390 Register Definitions
-**************************************************************************/
-#define D8390_P0_COMMAND 0x00
-#define D8390_P0_PSTART 0x01
-#define D8390_P0_PSTOP 0x02
-#define D8390_P0_BOUND 0x03
-#define D8390_P0_TSR 0x04
-#define D8390_P0_TPSR 0x04
-#define D8390_P0_TBCR0 0x05
-#define D8390_P0_TBCR1 0x06
-#define D8390_P0_ISR 0x07
-#define D8390_P0_RSAR0 0x08
-#define D8390_P0_RSAR1 0x09
-#define D8390_P0_RBCR0 0x0A
-#define D8390_P0_RBCR1 0x0B
-#define D8390_P0_RSR 0x0C
-#define D8390_P0_RCR 0x0C
-#define D8390_P0_TCR 0x0D
-#define D8390_P0_DCR 0x0E
-#define D8390_P0_IMR 0x0F
-#define D8390_P1_COMMAND 0x00
-#define D8390_P1_PAR0 0x01
-#define D8390_P1_PAR1 0x02
-#define D8390_P1_PAR2 0x03
-#define D8390_P1_PAR3 0x04
-#define D8390_P1_PAR4 0x05
-#define D8390_P1_PAR5 0x06
-#define D8390_P1_CURR 0x07
-#define D8390_P1_MAR0 0x08
-
-#define D8390_COMMAND_PS0 0x0 /* Page 0 select */
-#define D8390_COMMAND_PS1 0x40 /* Page 1 select */
-#define D8390_COMMAND_PS2 0x80 /* Page 2 select */
-#define D8390_COMMAND_RD2 0x20 /* Remote DMA control */
-#define D8390_COMMAND_RD1 0x10
-#define D8390_COMMAND_RD0 0x08
-#define D8390_COMMAND_TXP 0x04 /* transmit packet */
-#define D8390_COMMAND_STA 0x02 /* start */
-#define D8390_COMMAND_STP 0x01 /* stop */
-
-#define D8390_RCR_MON 0x20 /* monitor mode */
-
-#define D8390_DCR_FT1 0x40
-#define D8390_DCR_LS 0x08 /* Loopback select */
-#define D8390_DCR_WTS 0x01 /* Word transfer select */
-
-#define D8390_ISR_PRX 0x01 /* successful recv */
-#define D8390_ISR_PTX 0x02 /* successful xmit */
-#define D8390_ISR_RXE 0x04 /* receive error */
-#define D8390_ISR_TXE 0x08 /* transmit error */
-#define D8390_ISR_OVW 0x10 /* Overflow */
-#define D8390_ISR_CNT 0x20 /* Counter overflow */
-#define D8390_ISR_RDC 0x40 /* Remote DMA complete */
-#define D8390_ISR_RST 0x80 /* reset */
-
-#define D8390_RSTAT_PRX 0x01 /* successful recv */
-#define D8390_RSTAT_CRC 0x02 /* CRC error */
-#define D8390_RSTAT_FAE 0x04 /* Frame alignment error */
-#define D8390_RSTAT_OVER 0x08 /* overflow */
-
-#define D8390_TXBUF_SIZE 6
-#define D8390_RXBUF_END 32
-#define D8390_PAGE_SIZE 256
-
-struct ringbuffer {
- unsigned char status;
- unsigned char bound;
- unsigned short len;
-};
diff --git a/sys/i386/boot/netboot/if_epreg.h b/sys/i386/boot/netboot/if_epreg.h
deleted file mode 100644
index 049f235..0000000
--- a/sys/i386/boot/netboot/if_epreg.h
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * Copyright (c) 1993 Herb Peyerl (hpeyerl@novatel.ca) All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer. 2. The name
- * of the author may not be used to endorse or promote products derived from
- * this software withough specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * if_epreg.h,v 1.4 1994/11/13 10:12:37 gibbs Exp Modified by:
- *
- October 2, 1994
-
- Modified by: Andres Vega Garcia
-
- INRIA - Sophia Antipolis, France
- e-mail: avega@sophia.inria.fr
- finger: avega@pax.inria.fr
-
- */
-
-/*
- * Ethernet software status per interface.
- */
-/*
- * Some global constants
- */
-#define ETHER_MIN_LEN 64
-#define ETHER_MAX_LEN 1518
-#define ETHER_ADDR_LEN 6
-
-#define TX_INIT_RATE 16
-#define TX_INIT_MAX_RATE 64
-#define RX_INIT_LATENCY 64
-#define RX_INIT_EARLY_THRESH 64
-#define MIN_RX_EARLY_THRESHF 16 /* not less than ether_header */
-#define MIN_RX_EARLY_THRESHL 4
-
-#define EEPROMSIZE 0x40
-#define MAX_EEPROMBUSY 1000
-#define EP_LAST_TAG 0xd7
-#define EP_MAX_BOARDS 16
-#define EP_ID_PORT 0x100
-
-/*
- * some macros to acces long named fields
- */
-#define IS_BASE (eth_base)
-#define BASE (eth_base)
-
-/*
- * Commands to read/write EEPROM trough EEPROM command register (Window 0,
- * Offset 0xa)
- */
-#define EEPROM_CMD_RD 0x0080 /* Read: Address required (5 bits) */
-#define EEPROM_CMD_WR 0x0040 /* Write: Address required (5 bits) */
-#define EEPROM_CMD_ERASE 0x00c0 /* Erase: Address required (5 bits) */
-#define EEPROM_CMD_EWEN 0x0030 /* Erase/Write Enable: No data required */
-
-#define EEPROM_BUSY (1<<15)
-#define EEPROM_TST_MODE (1<<14)
-
-/*
- * Some short functions, worth to let them be a macro
- */
-#define is_eeprom_busy(b) (inw((b)+EP_W0_EEPROM_COMMAND)&EEPROM_BUSY)
-#define GO_WINDOW(x) outw(BASE+EP_COMMAND, WINDOW_SELECT|(x))
-
-/**************************************************************************
- * *
- * These define the EEPROM data structure. They are used in the probe
- * function to verify the existance of the adapter after having sent
- * the ID_Sequence.
- *
- * There are others but only the ones we use are defined here.
- *
- **************************************************************************/
-
-#define EEPROM_NODE_ADDR_0 0x0 /* Word */
-#define EEPROM_NODE_ADDR_1 0x1 /* Word */
-#define EEPROM_NODE_ADDR_2 0x2 /* Word */
-#define EEPROM_PROD_ID 0x3 /* 0x9[0-f]50 */
-#define EEPROM_MFG_ID 0x7 /* 0x6d50 */
-#define EEPROM_ADDR_CFG 0x8 /* Base addr */
-#define EEPROM_RESOURCE_CFG 0x9 /* IRQ. Bits 12-15 */
-
-/**************************************************************************
- * *
- * These are the registers for the 3Com 3c509 and their bit patterns when *
- * applicable. They have been taken out the the "EtherLink III Parallel *
- * Tasking EISA and ISA Technical Reference" "Beta Draft 10/30/92" manual *
- * from 3com. *
- * *
- **************************************************************************/
-
-#define EP_COMMAND 0x0e /* Write. BASE+0x0e is always a
- * command reg. */
-#define EP_STATUS 0x0e /* Read. BASE+0x0e is always status
- * reg. */
-#define EP_WINDOW 0x0f /* Read. BASE+0x0f is always window
- * reg. */
-/*
- * Window 0 registers. Setup.
- */
-/* Write */
-#define EP_W0_EEPROM_DATA 0x0c
-#define EP_W0_EEPROM_COMMAND 0x0a
-#define EP_W0_RESOURCE_CFG 0x08
-#define EP_W0_ADDRESS_CFG 0x06
-#define EP_W0_CONFIG_CTRL 0x04
-/* Read */
-#define EP_W0_PRODUCT_ID 0x02
-#define EP_W0_MFG_ID 0x00
-
-/*
- * Window 1 registers. Operating Set.
- */
-/* Write */
-#define EP_W1_TX_PIO_WR_2 0x02
-#define EP_W1_TX_PIO_WR_1 0x00
-/* Read */
-#define EP_W1_FREE_TX 0x0c
-#define EP_W1_TX_STATUS 0x0b /* byte */
-#define EP_W1_TIMER 0x0a /* byte */
-#define EP_W1_RX_STATUS 0x08
-#define EP_W1_RX_PIO_RD_2 0x02
-#define EP_W1_RX_PIO_RD_1 0x00
-
-/*
- * Window 2 registers. Station Address Setup/Read
- */
-/* Read/Write */
-#define EP_W2_ADDR_5 0x05
-#define EP_W2_ADDR_4 0x04
-#define EP_W2_ADDR_3 0x03
-#define EP_W2_ADDR_2 0x02
-#define EP_W2_ADDR_1 0x01
-#define EP_W2_ADDR_0 0x00
-
-/*
- * Window 3 registers. FIFO Management.
- */
-/* Read */
-#define EP_W3_FREE_TX 0x0c
-#define EP_W3_FREE_RX 0x0a
-
-/*
- * Window 4 registers. Diagnostics.
- */
-/* Read/Write */
-#define EP_W4_MEDIA_TYPE 0x0a
-#define EP_W4_CTRLR_STATUS 0x08
-#define EP_W4_NET_DIAG 0x06
-#define EP_W4_FIFO_DIAG 0x04
-#define EP_W4_HOST_DIAG 0x02
-#define EP_W4_TX_DIAG 0x00
-
-/*
- * Window 5 Registers. Results and Internal status.
- */
-/* Read */
-#define EP_W5_READ_0_MASK 0x0c
-#define EP_W5_INTR_MASK 0x0a
-#define EP_W5_RX_FILTER 0x08
-#define EP_W5_RX_EARLY_THRESH 0x06
-#define EP_W5_TX_AVAIL_THRESH 0x02
-#define EP_W5_TX_START_THRESH 0x00
-
-/*
- * Window 6 registers. Statistics.
- */
-/* Read/Write */
-#define TX_TOTAL_OK 0x0c
-#define RX_TOTAL_OK 0x0a
-#define TX_DEFERRALS 0x08
-#define RX_FRAMES_OK 0x07
-#define TX_FRAMES_OK 0x06
-#define RX_OVERRUNS 0x05
-#define TX_COLLISIONS 0x04
-#define TX_AFTER_1_COLLISION 0x03
-#define TX_AFTER_X_COLLISIONS 0x02
-#define TX_NO_SQE 0x01
-#define TX_CD_LOST 0x00
-
-/****************************************
- *
- * Register definitions.
- *
- ****************************************/
-
-/*
- * Command register. All windows.
- *
- * 16 bit register.
- * 15-11: 5-bit code for command to be executed.
- * 10-0: 11-bit arg if any. For commands with no args;
- * this can be set to anything.
- */
-#define GLOBAL_RESET (u_short) 0x0000 /* Wait at least 1ms
- * after issuing */
-#define WINDOW_SELECT (u_short) (0x1<<11)
-#define START_TRANSCEIVER (u_short) (0x2<<11) /* Read ADDR_CFG reg to
- * determine whether
- * this is needed. If
- * so; wait 800 uSec
- * before using trans-
- * ceiver. */
-#define RX_DISABLE (u_short) (0x3<<11) /* state disabled on
- * power-up */
-#define RX_ENABLE (u_short) (0x4<<11)
-#define RX_RESET (u_short) (0x5<<11)
-#define RX_DISCARD_TOP_PACK (u_short) (0x8<<11)
-#define TX_ENABLE (u_short) (0x9<<11)
-#define TX_DISABLE (u_short) (0xa<<11)
-#define TX_RESET (u_short) (0xb<<11)
-#define REQ_INTR (u_short) (0xc<<11)
-#define SET_INTR_MASK (u_short) (0xe<<11)
-#define SET_RD_0_MASK (u_short) (0xf<<11)
-#define SET_RX_FILTER (u_short) (0x10<<11)
-#define FIL_INDIVIDUAL (u_short) (0x1)
-#define FIL_GROUP (u_short) (0x2)
-#define FIL_BRDCST (u_short) (0x4)
-#define FIL_ALL (u_short) (0x8)
-#define SET_RX_EARLY_THRESH (u_short) (0x11<<11)
-#define SET_TX_AVAIL_THRESH (u_short) (0x12<<11)
-#define SET_TX_START_THRESH (u_short) (0x13<<11)
-#define STATS_ENABLE (u_short) (0x15<<11)
-#define STATS_DISABLE (u_short) (0x16<<11)
-#define STOP_TRANSCEIVER (u_short) (0x17<<11)
-/*
- * The following C_* acknowledge the various interrupts. Some of them don't
- * do anything. See the manual.
- */
-#define ACK_INTR (u_short) (0x6800)
-#define C_INTR_LATCH (u_short) (ACK_INTR|0x1)
-#define C_CARD_FAILURE (u_short) (ACK_INTR|0x2)
-#define C_TX_COMPLETE (u_short) (ACK_INTR|0x4)
-#define C_TX_AVAIL (u_short) (ACK_INTR|0x8)
-#define C_RX_COMPLETE (u_short) (ACK_INTR|0x10)
-#define C_RX_EARLY (u_short) (ACK_INTR|0x20)
-#define C_INT_RQD (u_short) (ACK_INTR|0x40)
-#define C_UPD_STATS (u_short) (ACK_INTR|0x80)
-
-/*
- * Status register. All windows.
- *
- * 15-13: Window number(0-7).
- * 12: Command_in_progress.
- * 11: reserved.
- * 10: reserved.
- * 9: reserved.
- * 8: reserved.
- * 7: Update Statistics.
- * 6: Interrupt Requested.
- * 5: RX Early.
- * 4: RX Complete.
- * 3: TX Available.
- * 2: TX Complete.
- * 1: Adapter Failure.
- * 0: Interrupt Latch.
- */
-#define S_INTR_LATCH (u_short) (0x1)
-#define S_CARD_FAILURE (u_short) (0x2)
-#define S_TX_COMPLETE (u_short) (0x4)
-#define S_TX_AVAIL (u_short) (0x8)
-#define S_RX_COMPLETE (u_short) (0x10)
-#define S_RX_EARLY (u_short) (0x20)
-#define S_INT_RQD (u_short) (0x40)
-#define S_UPD_STATS (u_short) (0x80)
-#define S_5_INTS (S_CARD_FAILURE|S_TX_COMPLETE|\
- S_TX_AVAIL|S_RX_COMPLETE|S_RX_EARLY)
-#define S_COMMAND_IN_PROGRESS (u_short) (0x1000)
-
-/*
- * FIFO Registers.
- * RX Status. Window 1/Port 08
- *
- * 15: Incomplete or FIFO empty.
- * 14: 1: Error in RX Packet 0: Incomplete or no error.
- * 13-11: Type of error.
- * 1000 = Overrun.
- * 1011 = Run Packet Error.
- * 1100 = Alignment Error.
- * 1101 = CRC Error.
- * 1001 = Oversize Packet Error (>1514 bytes)
- * 0010 = Dribble Bits.
- * (all other error codes, no errors.)
- *
- * 10-0: RX Bytes (0-1514)
- */
-#define ERR_RX_INCOMPLETE (u_short) (0x1<<15)
-#define ERR_RX (u_short) (0x1<<14)
-#define ERR_RX_OVERRUN (u_short) (0x8<<11)
-#define ERR_RX_RUN_PKT (u_short) (0xb<<11)
-#define ERR_RX_ALIGN (u_short) (0xc<<11)
-#define ERR_RX_CRC (u_short) (0xd<<11)
-#define ERR_RX_OVERSIZE (u_short) (0x9<<11)
-#define ERR_RX_DRIBBLE (u_short) (0x2<<11)
-
-/*
- * FIFO Registers.
- * TX Status. Window 1/Port 0B
- *
- * Reports the transmit status of a completed transmission. Writing this
- * register pops the transmit completion stack.
- *
- * Window 1/Port 0x0b.
- *
- * 7: Complete
- * 6: Interrupt on successful transmission requested.
- * 5: Jabber Error (TP Only, TX Reset required. )
- * 4: Underrun (TX Reset required. )
- * 3: Maximum Collisions.
- * 2: TX Status Overflow.
- * 1-0: Undefined.
- *
- */
-#define TXS_COMPLETE 0x80
-#define TXS_SUCCES_INTR_REQ 0x40
-#define TXS_JABBER 0x20
-#define TXS_UNDERRUN 0x10
-#define TXS_MAX_COLLISION 0x8
-#define TXS_STATUS_OVERFLOW 0x4
-
-/*
- * Configuration control register.
- * Window 0/Port 04
- */
-/* Read */
-#define IS_AUI (1<<13)
-#define IS_BNC (1<<12)
-#define IS_UTP (1<<9)
-/* Write */
-#define ENABLE_DRQ_IRQ 0x0001
-#define W0_P4_CMD_RESET_ADAPTER 0x4
-#define W0_P4_CMD_ENABLE_ADAPTER 0x1
-/*
- * Media type and status.
- * Window 4/Port 0A
- */
-#define ENABLE_UTP 0xc0
-#define DISABLE_UTP 0x0
-
-/*
- * Resource control register
- */
-
-#define SET_IRQ(i) ( ((i)<<12) | 0xF00) /* set IRQ i */
-
-/*
- * Receive status register
- */
-
-#define RX_BYTES_MASK (u_short) (0x07ff)
-#define RX_ERROR 0x4000
-#define RX_INCOMPLETE 0x8000
-
-
-/*
- * Misc defines for various things.
- */
-#define ACTIVATE_ADAPTER_TO_CONFIG 0xff /* to the id_port */
-#define MFG_ID 0x6d50 /* in EEPROM and W0 ADDR_CONFIG */
-#define PROD_ID 0x9150
-
-#define AUI 0x1
-#define BNC 0x2
-#define UTP 0x4
-
-#define ETHER_ADDR_LEN 6
-#define ETHER_MAX 1536
-#define RX_BYTES_MASK (u_short) (0x07ff)
-
- /* EISA support */
-#define EP_EISA_START 0x1000
-#define EP_EISA_W0 0x0c80
diff --git a/sys/i386/boot/netboot/netboot.doc b/sys/i386/boot/netboot/netboot.doc
deleted file mode 100644
index d9d261e..0000000
--- a/sys/i386/boot/netboot/netboot.doc
+++ /dev/null
@@ -1,42 +0,0 @@
-
-Configuring FreeBSD to run diskless Oct 15/1994
-===================================
-
-1) Find a machine that will be your server. This machine will require
- enough disk space to hold the FreeBSD 2.0 binaries and have bootp and
- tftp services available.
-
-2) Create a bootptab entry for the diskless FreeBSD machine.
-
- sample entry:
-
- diskless:\
- :ht=ether:\
- :ha=0000c01f848a:\
- :sm=255.255.255.0:\
- :hn:\
- :ds=192.1.2.3:\
- :ip=192.1.2.4:\
- :vm=rfc1048:
-
-
-3) Create a cfg.x.x.x.x file for your diskless machine. This is now an
- ASCII file with netboot commands in it.
-
- sample cfg.x.x.x.x:
-
- hostname diskless.freebsd.com
- rootfs server.freebsd.com:/var/rootfs/diskless
- swapfs server.freebsd.com:/var/swap/diskless
-
-4) On the server, export the root and swap filesystems to the client. This
- usually involves putting them in the /etc/exports file and one some
- machines running /usr/etc/exportfs -av
-
-5) Make a BOOTROM by copying netboot.rom to an EPROM, or copy netboot.com to
- a DOS diskette.
-
-6) Boot the diskless machine and run netboot.com if you're using DOS.
-
-
-Martin Renters martin@innovus.com
diff --git a/sys/i386/boot/rmaouthdr b/sys/i386/boot/rmaouthdr
deleted file mode 100644
index 4bb9c84..0000000
--- a/sys/i386/boot/rmaouthdr
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/csh -f
-#
-# from: Mach, Revision 2.2 92/04/04 11:36:01 rpd
-# $Id$
-#
-dd if=$1 of=$2 ibs=32 skip=1 obs=1024b
diff --git a/sys/i386/boot/serialboot/Makefile b/sys/i386/boot/serialboot/Makefile
deleted file mode 100644
index a282843..0000000
--- a/sys/i386/boot/serialboot/Makefile
+++ /dev/null
@@ -1,59 +0,0 @@
-# $Id: Makefile,v 1.22 1994/11/05 21:06:16 ache Exp $
-#
-
-PROG= boot
-
-.PATH: ${.CURDIR}/../biosboot
-# Order is very important on the SRCS line for this prog
-SRCS= start.S table.c boot2.S boot.c asm.S bios.S io.c disk.c sys.c
-
-BINDIR= /usr/mdec
-BINMODE= 444
-CFLAGS= -O -DDO_BAD144 -DBOOTWAIT=${BOOTWAIT} -DCOMCONSOLE=0x3F8
-CFLAGS+= -DBOOTSEG=${BOOTSEG} -DBOOTSTACK=${BOOTSTACK}
-CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../biosboot -I${.CURDIR}/../..
-CLEANFILES+= boot.nohdr boot.strip boot1 boot2
-DPADD= ${LIBC}
-LDFLAGS+= -N -T 0 -nostdlib
-LDADD= -lc
-LINKS= ${BINDIR}/sdboot ${BINDIR}/wdboot\
- ${BINDIR}/sdboot ${BINDIR}/fdboot\
- ${BINDIR}/bootsd ${BINDIR}/bootwd\
- ${BINDIR}/bootsd ${BINDIR}/bootfd
-NOSHARED= YES
-NOMAN=
-STRIP=
-
-# tunable timeout parameter, waiting for keypress, calibrated in mS
-BOOTWAIT?= 5000
-
-# Location that boot2 is loaded at
-BOOTSEG= 0x1000
-
-# Offset in BOOTSEG for the top of the stack, keep this 16 byte aligned
-BOOTSTACK= 0xFFF0
-
-boot.strip: boot
- cp -p boot boot.strip
- strip boot.strip
- size boot.strip
-
-boot.nohdr: boot.strip
- dd if=boot.strip of=boot.nohdr ibs=32 skip=1 obs=1024b
- ls -l boot.nohdr
-
-boot1: boot.nohdr
- dd if=boot.nohdr of=boot1 bs=512 count=1
-
-boot2: boot.nohdr
- dd if=boot.nohdr of=boot2 bs=512 skip=1
-
-all: boot1 boot2
-
-beforeinstall:
- install ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}\
- boot1 ${DESTDIR}${BINDIR}/sdboot
- install ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}\
- boot2 ${DESTDIR}${BINDIR}/bootsd
-
-.include <bsd.prog.mk>
diff --git a/sys/i386/boot/serialboot/bios.S b/sys/i386/boot/serialboot/bios.S
deleted file mode 100644
index c292452..0000000
--- a/sys/i386/boot/serialboot/bios.S
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1992, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- *
- * from: Mach, Revision 2.2 92/04/04 11:34:26 rpd
- * $Id: bios.S,v 1.3 1994/10/02 05:18:25 rgrimes Exp $
- */
-
-/*
- Copyright 1988, 1989, 1990, 1991, 1992
- by Intel Corporation, Santa Clara, California.
-
- All Rights Reserved
-
-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 appears in all
-copies and that both the copyright notice and this permission notice
-appear in supporting documentation, and that the name of Intel
-not be used in advertising or publicity pertaining to distribution
-of the software without specific, written prior permission.
-
-INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
-IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
-NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-
-/*
- * Serial bootblock interface routines
- * Copyright (c) 1994, J"org Wunsch
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * THE AUTHOR ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. THE AUTHOR DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- */
-
- .file "bios.s"
-
-#include "asm.h"
- .text
-
-/*
- * biosread(dev, cyl, head, sec, nsec, offset)
- * Read "nsec" sectors from disk to offset "offset" in boot segment
- * BIOS call "INT 0x13 Function 0x2" to read sectors from disk into memory
- * Call with %ah = 0x2
- * %al = number of sectors
- * %ch = cylinder
- * %cl = sector
- * %dh = head
- * %dl = drive (0x80 for hard disk, 0x0 for floppy disk)
- * %es:%bx = segment:offset of buffer
- * Return:
- * %al = 0x0 on success; err code on failure
- */
-
-ENTRY(biosread)
- push %ebp
- mov %esp, %ebp
-
- push %ebx
- push %ecx
- push %edx
- push %es
-
- movb 0x10(%ebp), %dh
- movw 0x0c(%ebp), %cx
- /* cylinder; the highest 2 bits of cyl is in %cl */
- xchgb %ch, %cl
- rorb $2, %cl
- movb 0x14(%ebp), %al
- orb %al, %cl
- incb %cl /* sector; sec starts from 1, not 0 */
- movb 0x8(%ebp), %dl /* device */
- movl 0x1c(%ebp), %ebx /* offset */
-
- /* prot_to_real will set %es to BOOTSEG */
- call EXT(prot_to_real) /* enter real mode */
- movb $0x2, %ah /* subfunction */
- addr32
- movb 0x18(%ebp), %al /* number of sectors */
-
- sti
- int $0x13
- cli
-
- /* save return value (actually movw %ax, %bx) */
- mov %eax, %ebx
-
- data32
- call EXT(real_to_prot) /* back to protected mode */
-
- xor %eax, %eax
- movb %bh, %al /* return value in %ax */
-
- pop %es
- pop %edx
- pop %ecx
- pop %ebx
- pop %ebp
-
- ret
-
-/*
- * The serial port interface routines implement a simple polled i/o
- * interface to a standard serial port. Due to the space restrictions
- * for the boot blocks, no BIOS support is used (since BIOS requires
- * expensive real/protected mode switches), instead the rudimentary
- * BIOS support is duplicated here.
- *
- * The base address for the i/o port is passed from the Makefile in
- * the COMCONSOLE preprocessor macro. Console parameters are currently
- * hard-coded to 9600 Bd, 8 bit. This can be changed in the
- * init_serial() function.
- */
-
-/*
- * void putc(char ch)
- * send ch to serial port
- *
- */
-
-ENTRY(putc)
- push %ebp
- mov %esp, %ebp
- push %edx
-
- mov $COMCONSOLE + 5, %edx # line status reg
-1: inb %dx, %al
- test $0x20, %al
- jz 1b # TX buffer not empty
-
- movb 0x8(%ebp), %al
-
- sub $5, %edx # TX output reg
- outb %al, %dx # send this one
-
- pop %edx
- pop %ebp
- ret
-
-/*
- * int getc(void)
- * read a character from serial port
- */
-
-ENTRY(getc)
- push %ebp
- mov %esp, %ebp
- push %edx
-
- mov $COMCONSOLE + 5, %edx # line status reg
-1:
- inb %dx, %al
- testb $0x01, %al
- jz 1b # no RX char available
-
- xor %eax, %eax
- sub $5, %edx # RX buffer reg
- inb %dx, %al # fetch (first) character
-
- cmp $0x7F, %eax # make DEL...
- jne 2f
- mov $0x08, %eax # look like BS
-2:
- pop %edx
- pop %ebp
- ret
-
-/*
- * int ischar(void)
- * if there is a character pending, return true; otherwise return 0
- */
-ENTRY(ischar)
- push %ebp
- mov %esp, %ebp
- push %edx
-
- xorl %eax, %eax
- mov $COMCONSOLE + 5, %edx # line status reg
- inb %dx, %al
- andb $0x01, %al # RX char available?
-
- pop %edx
- pop %ebp
- ret
-
-/*
- * void init_serial(void)
- * initialize the serial console port to 9600 Bd, 8 bpc
- */
-ENTRY(init_serial)
- push %ebp
- mov %esp, %ebp
- push %edx
-
- mov $COMCONSOLE + 3, %edx # line control reg
- movb $0x80, %al
- outb %al, %dx # enable DLAB
-
- sub $3, %edx # divisor latch, low byte
- mov $12, %ax # divisor 12: 9600 Bd
- outb %al, %dx
- inc %edx # divisor latch, high byte
- movb %ah, %al
- outb %al, %dx
-
- add $2, %edx # line control reg
- movb $0x13, %al
- outb %al, %dx # 8 bit, no parity, 1 stop bit
-
- inc %edx # modem control reg
- mov $3, %al
- outb %al, %dx # enable DTR/RTS
-
- /* now finally, flush the input buffer */
- inc %edx # line status reg
-1:
- inb %dx, %al
- testb $0x01, %al
- jz 2f # no more characters buffered
- sub $5, %edx # rx buffer reg
- inb %dx, %al # throw away
- add $5, %edx
- jmp 1b
-2:
- pop %edx
- pop %ebp
- ret
-
-/*
- *
- * get_diskinfo(): return a word that represents the
- * max number of sectors and heads and drives for this device
- *
- */
-
-ENTRY(get_diskinfo)
- push %ebp
- mov %esp, %ebp
- push %es
- push %ebx
- push %ecx
- push %edx
-
- movb 0x8(%ebp), %dl /* diskinfo(drive #) */
- call EXT(prot_to_real) /* enter real mode */
-
- movb $0x8, %ah /* ask for disk info */
-
- sti
- int $0x13
- cli
-
- jnc ok
- /*
- * Urk. Call failed. It is not supported for floppies by old BIOS's.
- * Guess it's a 15-sector floppy. Initialize all the registers for
- * documentation, although we only need head and sector counts.
- */
- subb %ah, %ah /* %ax = 0 */
- movb %al, %al
- movb %ah, %bh /* %bh = 0 */
- movb $2, %bl /* %bl bits 0-3 = drive type,
- bit 2 = 1.2M */
- movb $79, %ch /* max track */
- movb $15, %cl /* max sector */
- movb $1, %dh /* max head */
- movb $1, %dl /* # floppy drives installed */
- /* es:di = parameter table */
- /* carry = 0 */
-ok:
-
- data32
- call EXT(real_to_prot) /* back to protected mode */
-
- xor %eax, %eax
-
- /* form a longword representing all this gunk */
- movb %dh, %ah /* max head */
- andb $0x3f, %cl /* mask of cylinder gunk */
- movb %cl, %al /* max sector (and # sectors) */
-
- pop %edx
- pop %ecx
- pop %ebx
- pop %es
- pop %ebp
- ret
-
-/*
- *
- * memsize(i) : return the memory size in KB. i == 0 for conventional memory,
- * i == 1 for extended memory
- * BIOS call "INT 12H" to get conventional memory size
- * BIOS call "INT 15H, AH=88H" to get extended memory size
- * Both have the return value in AX.
- *
- */
-
-ENTRY(memsize)
- push %ebp
- mov %esp, %ebp
- push %ebx
-
- mov 8(%ebp), %ebx
-
- call EXT(prot_to_real) /* enter real mode */
-
- cmpb $0x1, %bl
- data32
- je xext
-
- sti
- int $0x12
- cli
- data32
- jmp xdone
-
-xext: movb $0x88, %ah
- sti
- int $0x15
- cli
-
-xdone:
- mov %eax, %ebx
-
- data32
- call EXT(real_to_prot)
-
- mov %ebx, %eax
- pop %ebx
- pop %ebp
- ret
-
diff --git a/sys/i386/boot/serialboot/boot.c b/sys/i386/boot/serialboot/boot.c
deleted file mode 100644
index 06bd6ba..0000000
--- a/sys/i386/boot/serialboot/boot.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1992, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- *
- * from: Mach, [92/04/03 16:51:14 rvb]
- * $Id: boot.c,v 1.22 1994/11/07 11:26:26 davidg Exp $
- */
-
-
-/*
- Copyright 1988, 1989, 1990, 1991, 1992
- by Intel Corporation, Santa Clara, California.
-
- All Rights Reserved
-
-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 appears in all
-copies and that both the copyright notice and this permission notice
-appear in supporting documentation, and that the name of Intel
-not be used in advertising or publicity pertaining to distribution
-of the software without specific, written prior permission.
-
-INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
-IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
-NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-
-#include <sys/param.h>
-#include "boot.h"
-#include <a.out.h>
-#include <sys/reboot.h>
-#include <machine/bootinfo.h>
-
-struct exec head;
-struct bootinfo_t bootinfo;
-char *name;
-char *names[] = {
- "/kernel"
-};
-#define NUMNAMES (sizeof(names)/sizeof(char *))
-
-extern void init_serial(void);
-extern int end;
-boot(drive)
-int drive;
-{
- int loadflags, currname = 0, ret;
- char *t;
-
- init_serial();
-
- printf("\n>> FreeBSD BOOT @ 0x%x: %d/%d k of memory\n",
- ouraddr,
- memsize(0),
- memsize(1));
- printf("Use hd(1,a)/kernel to boot sd0 when wd0 is also installed.\n");
- printf("Usage: [[[%s(0,a)]%s][-s][-r][-a][-c][-d][-b]]\nUse ? for file list.\n\n"
- , devs[(drive & 0x80) ? 0 : 2]
- , names[0]);
- gateA20();
-loadstart:
- /***************************************************************\
- * As a default set it to the first partition of the first *
- * floppy or hard drive *
- \***************************************************************/
- part = unit = 0;
- maj = (drive&0x80 ? 0 : 2); /* a good first bet */
- name = names[currname++];
-
- loadflags = 0;
- if (currname == NUMNAMES)
- currname = 0;
- printf("Boot: ");
- getbootdev(&loadflags);
- ret = openrd();
- if (ret != 0) {
- if (ret > 0)
- printf("Can't find %s\n", name);
- goto loadstart;
- }
-/* if (inode.i_mode&IEXEC)
- loadflags |= RB_KDB;
-*/
- loadprog(loadflags);
- goto loadstart;
-}
-
-loadprog(howto)
- int howto;
-{
- long int startaddr;
- long int addr; /* physical address.. not directly useable */
- long int bootdev;
- long int total;
- int i;
- unsigned char tmpbuf[4096]; /* we need to load the first 4k here */
-
- read(&head, sizeof(head));
- if ( N_BADMAG(head)) {
- printf("Invalid format!\n");
- return;
- }
-
- poff = N_TXTOFF(head);
- /*if(poff==0)
- poff = 32;*/
-
- startaddr = (int)head.a_entry & 0x00FFFFFF; /* some MEG boundary */
- addr = startaddr;
- printf("Booting %s(%d,%c)%s @ 0x%x\n"
- , devs[maj]
- , unit
- , 'a'+part
- , name
- , addr);
- if(addr < ouraddr)
- {
- if((addr + head.a_text + head.a_data) > ouraddr)
- {
- printf("kernel overlaps loader\n");
- return;
- }
- if((addr + head.a_text + head.a_data + head.a_bss) > 0xa0000)
- {
- printf("bss exceeds 640k limit\n");
- return;
- }
- }
- printf("text=0x%x ", head.a_text);
- /********************************************************/
- /* LOAD THE TEXT SEGMENT */
- /* don't clobber the first 4k yet (BIOS NEEDS IT) */
- /********************************************************/
- read(tmpbuf,4096);
- addr += 4096;
- xread(addr, head.a_text - 4096);
- addr += head.a_text - 4096;
-
- /********************************************************/
- /* Load the Initialised data after the text */
- /********************************************************/
- while (addr & CLOFSET)
- *(char *)addr++ = 0;
-
- printf("data=0x%x ", head.a_data);
- xread(addr, head.a_data);
- addr += head.a_data;
-
- /********************************************************/
- /* Skip over the uninitialised data */
- /* (but clear it) */
- /********************************************************/
- printf("bss=0x%x ", head.a_bss);
- if( (addr < ouraddr) && ((addr + head.a_bss) > ouraddr))
- {
- pbzero(addr,ouraddr - (int)addr);
- }
- else
- {
- pbzero(addr,head.a_bss);
- }
- addr += head.a_bss;
-
-#ifdef LOADSYMS /* not yet, haven't worked this out yet */
- if (addr > 0x100000)
- {
- /********************************************************/
- /*copy in the symbol header */
- /********************************************************/
- pcpy(&head.a_syms, addr, sizeof(head.a_syms));
- addr += sizeof(head.a_syms);
-
- /********************************************************/
- /* READ in the symbol table */
- /********************************************************/
- printf("symbols=[+0x%x", head.a_syms);
- xread(addr, head.a_syms);
- addr += head.a_syms;
-
- /********************************************************/
- /* Followed by the next integer (another header) */
- /* more debug symbols? */
- /********************************************************/
- read(&i, sizeof(int));
- pcpy(&i, addr, sizeof(int));
- i -= sizeof(int);
- addr += sizeof(int);
-
-
- /********************************************************/
- /* and that many bytes of (debug symbols?) */
- /********************************************************/
- printf("+0x%x] ", i);
- xread(addr, i);
- addr += i;
- }
-#endif LOADSYMS
- /********************************************************/
- /* and note the end address of all this */
- /********************************************************/
-
- total = ((addr+sizeof(int)-1))&~(sizeof(int)-1);
- printf("total=0x%x ", total);
- bootdev = (MAKEBOOTDEV(maj, 0, 0, unit, part)) ;
- /****************************************************************/
- /* copy that first page and overwrite any BIOS variables */
- /****************************************************************/
- printf("entry point=0x%x\n" ,(int)startaddr);
- /* Under no circumstances overwrite precious BIOS variables! */
- pcpy(tmpbuf, startaddr, 0x400);
- pcpy(tmpbuf + 0x500, startaddr + 0x500, 4096 - 0x500);
- bootinfo.version=1;
- bootinfo.kernelname=(char *)((int)name + (BOOTSEG<<4));
- bootinfo.nfs_diskless=0;
- startprog((int)startaddr, howto, bootdev, (int)&bootinfo+(BOOTSEG<<4));
- return;
-}
-
-#define NAMEBUF_LEN 100
-
-char namebuf[NAMEBUF_LEN];
-getbootdev(howto)
- int *howto;
-{
- char c, *ptr = namebuf;
- if (gets(namebuf)) {
- while (c=*ptr) {
- while (c==' ')
- c = *++ptr;
- if (!c)
- return;
- if (c=='-')
- while ((c = *++ptr) && c!=' ')
- switch (c) {
- case 'r':
- *howto |= RB_DFLTROOT; continue;
- case 'a':
- *howto |= RB_ASKNAME; continue;
- case 'c':
- *howto |= RB_CONFIG; continue;
- case 's':
- *howto |= RB_SINGLE; continue;
- case 'd':
- *howto |= RB_KDB; continue;
- case 'b':
- *howto |= RB_HALT; continue;
- }
- else {
- name = ptr;
- while ((c = *++ptr) && c!=' ');
- if (c)
- *ptr++ = 0;
- }
- }
- } else
- printf("\n");
-}
-
diff --git a/sys/i386/boot/start.S b/sys/i386/boot/start.S
deleted file mode 100644
index d0bcbf8..0000000
--- a/sys/i386/boot/start.S
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1992, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- *
- * from: Mach, Revision 2.2 92/04/04 11:36:29 rpd
- * $Id: start.S,v 1.4 1994/10/02 05:18:26 rgrimes Exp $
- */
-
-/*
- Copyright 1988, 1989, 1990, 1991, 1992
- by Intel Corporation, Santa Clara, California.
-
- All Rights Reserved
-
-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 appears in all
-copies and that both the copyright notice and this permission notice
-appear in supporting documentation, and that the name of Intel
-not be used in advertising or publicity pertaining to distribution
-of the software without specific, written prior permission.
-
-INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
-IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
-NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-#include "asm.h"
-
- .file "start.s"
-
-SIGNATURE= 0xaa55
-LOADSZ= 15 /* size of unix boot */
-PARTSTART= 0x1be /* starting address of partition table */
-NUMPART= 4 /* number of partitions in partition table */
-PARTSZ= 16 /* each partition table entry is 16 bytes */
-BSDPART= 0xA5 /* value of boot_ind, means bootable partition */
-BOOTABLE= 0x80 /* value of boot_ind, means bootable partition */
-
- .text
-
-ENTRY(boot1)
- /*
- * start (aka boot1) is loaded at 0x0:0x7c00 but we want 0x7c0:0
- * ljmp to the next instruction to adjust %cs
- */
- data32
- ljmp $0x7c0, $start
-
-start:
- /* set up %ds */
- mov %cs, %ax
- mov %ax, %ds
-
- /* set up %ss and %esp */
- data32
- mov $BOOTSEG, %eax
- mov %ax, %ss
- data32
- mov $BOOTSTACK, %esp
-
- /* set up %es, (where we will load boot2 to) */
- mov %ax, %es
-
-#ifdef DEBUG
- data32
- mov $one, %esi
- data32
- call message
-#endif
-
- /* bootstrap passes us drive number in %dl */
- cmpb $0x80, %dl
- data32
- jae hd
-
-fd:
- mov $0x0, %dl
- /* reset the disk system */
-#ifdef DEBUG
- data32
- mov $two, %esi
- data32
- call message
-#endif
- movb $0x0, %ah
- int $0x13
- data32
- mov $0x0001, %ecx /* cyl 0, sector 1 */
- movb $0, %dh /* head */
-#ifdef DEBUG
- data32
- mov $three, %esi
- data32
- call message
-#endif
- data32
- jmp load
-
-hd: /**** load sector 0 into the BOOTSEG ****/
-#ifdef DEBUG
- data32
- mov $four, %esi
- data32
- call message
-#endif
- data32
- mov $0x0201, %eax
- xor %ebx, %ebx /* %bx = 0 */
- data32
- mov $0x0001, %ecx
-#ifdef DEBUG
- data32
- mov $five, %esi
- data32
- call message
-#endif
- data32
- andl $0xff, %edx
- /*mov $0x0080, %edx*/
- int $0x13
- data32
- jb read_error
-
- /* find the first 386BSD partition */
- data32
- mov $PARTSTART, %ebx
- data32
- mov $NUMPART, %ecx
-again:
- addr32
- movb %es:4(%ebx), %al
- cmpb $BSDPART, %al
- data32
- je found
- data32
- add $PARTSZ, %ebx
- data32
- loop again
- data32
- mov $enoboot, %esi
- data32
- jmp err_stop
-
-
-/*
- * BIOS call "INT 0x13 Function 0x2" to read sectors from disk into memory
- * Call with %ah = 0x2
- * %al = number of sectors
- * %ch = cylinder
- * %cl = sector
- * %dh = head
- * %dl = drive (0x80 for hard disk, 0x0 for floppy disk)
- * %es:%bx = segment:offset of buffer
- * Return:
- * %al = 0x0 on success; err code on failure
- */
-
-found:
- addr32
- movb %es:1(%ebx), %dh /* head */
- addr32
- movl %es:2(%ebx), %ecx /*sect, cyl (+ 2 bytes junk in top word) */
-
-load:
- movb $0x2, %ah /* function 2 */
- movb $LOADSZ, %al /* number of blocks */
- xor %ebx, %ebx /* %bx = 0, put it at 0 in the BOOTSEG */
- int $0x13
- data32
- jb read_error
-
- /*
- * ljmp to the second stage boot loader (boot2).
- * After ljmp, %cs is BOOTSEG and boot1 (512 bytes) will be used
- * as an internal buffer "intbuf".
- */
-
-#ifdef DEBUG
- data32
- mov $six, %esi
- data32
- call message
-#endif
- data32
- ljmp $BOOTSEG, $ EXT(boot2)
-
-/*
- * read_error
- */
-read_error:
- data32
- mov $eread, %esi
-err_stop:
- data32
- call message
- data32
- jmp stop
-
-/*
- * message: write the error message in %ds:%esi to console
- */
-message:
- /*
- * Use BIOS "int 10H Function 0Eh" to write character in teletype mode
- * %ah = 0xe %al = character
- * %bh = page %bl = foreground color (graphics modes)
- */
-
- data32
- push %eax
- data32
- push %ebx
- data32
- mov $0x0001, %ebx
- cld
-
-nextb:
- lodsb /* load a byte into %al */
- cmpb $0x0, %al
- data32
- je done
- movb $0xe, %ah
- int $0x10 /* display a byte */
- data32
- jmp nextb
-done:
- data32
- pop %ebx
- data32
- pop %eax
- data32
- ret
-
-stop: hlt
- data32
- jmp stop /* halt doesnt actually halt forever */
-
-/* error messages */
-
-#ifdef DEBUG
-one: String "1\r\n\0"
-two: String "2\r\n\0"
-three: String "3\r\n\0"
-four: String "4\r\n\0"
-five: String "5\r\n\0"
-six: String "6\r\n\0"
-seven: String "7\r\n\0"
-#endif DEBUG
-eread: String "Read error\r\n\0"
-enoboot: String "No bootable partition\r\n\0"
-endofcode:
-/* throw in a partition in case we are block0 as well */
-/* flag, head, sec, cyl, typ, ehead, esect, ecyl, start, len */
- . = EXT(boot1) + PARTSTART
- .byte 0x0,0,0,0,0,0,0,0
- .long 0,0
- .byte 0x0,0,0,0,0,0,0,0
- .long 0,0
- .byte 0x0,0,0,0,0,0,0,0
- .long 0,0
- .byte BOOTABLE,0,1,0,BSDPART,255,255,255
- .long 0,50000
-/* the last 2 bytes in the sector 0 contain the signature */
- . = EXT(boot1) + 0x1fe
- .value SIGNATURE
-ENTRY(disklabel)
- . = EXT(boot1) + 0x400
diff --git a/sys/i386/boot/sys.c b/sys/i386/boot/sys.c
deleted file mode 100644
index 48cbade..0000000
--- a/sys/i386/boot/sys.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1992, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- *
- * from: Mach, Revision 2.2 92/04/04 11:36:34 rpd
- * $Id: sys.c,v 1.4 1994/08/21 17:47:26 paul Exp $
- */
-
-#include "boot.h"
-#include <sys/dir.h>
-#include <sys/reboot.h>
-
-#ifdef 0
-/* #define BUFSIZE 4096 */
-#define BUFSIZE MAXBSIZE
-
-char buf[BUFSIZE], fsbuf[SBSIZE], iobuf[MAXBSIZE];
-#endif
-
-#define BUFSIZE 8192
-#define MAPBUFSIZE BUFSIZE
-char buf[BUFSIZE], fsbuf[BUFSIZE], iobuf[BUFSIZE];
-
-int xread(addr, size)
- char * addr;
- int size;
-{
- int count = BUFSIZE;
- while (size > 0) {
- if (BUFSIZE > size)
- count = size;
- read(buf, count);
- pcpy(buf, addr, count);
- size -= count;
- addr += count;
- }
-}
-
-read(buffer, count)
- int count;
- char *buffer;
-{
- int logno, off, size;
- int cnt2, bnum2;
-
- while (count) {
- off = blkoff(fs, poff);
- logno = lblkno(fs, poff);
- cnt2 = size = blksize(fs, &inode, logno);
- bnum2 = fsbtodb(fs, block_map(logno)) + boff;
- cnt = cnt2;
- bnum = bnum2;
- if ( (!off) && (size <= count))
- {
- iodest = buffer;
- devread();
- }
- else
- {
- iodest = iobuf;
- size -= off;
- if (size > count)
- size = count;
- devread();
- bcopy(iodest+off,buffer,size);
- }
- buffer += size;
- count -= size;
- poff += size;
- }
-}
-
-find(path)
- char *path;
-{
- char *rest, ch;
- int block, off, loc, ino = ROOTINO;
- struct direct *dp;
-loop: iodest = iobuf;
- cnt = fs->fs_bsize;
- bnum = fsbtodb(fs,ino_to_fsba(fs,ino)) + boff;
- devread();
- bcopy(&((struct dinode *)iodest)[ino % fs->fs_inopb],
- &inode.i_din,
- sizeof (struct dinode));
- if (!*path)
- return 1;
- while (*path == '/')
- path++;
- if (!inode.i_size || ((inode.i_mode&IFMT) != IFDIR))
- return 0;
- for (rest = path; (ch = *rest) && ch != '/'; rest++) ;
- *rest = 0;
- loc = 0;
- do {
- if (loc >= inode.i_size)
- return 0;
- if (!(off = blkoff(fs, loc))) {
- block = lblkno(fs, loc);
- cnt = blksize(fs, &inode, block);
- bnum = fsbtodb(fs, block_map(block)) + boff;
- iodest = iobuf;
- devread();
- }
- dp = (struct direct *)(iodest + off);
- loc += dp->d_reclen;
- } while (!dp->d_ino || strcmp(path, dp->d_name));
- ino = dp->d_ino;
- *(path = rest) = ch;
- goto loop;
-}
-
-char mapbuf[MAPBUFSIZE];
-int mapblock = 0;
-
-block_map(file_block)
- int file_block;
-{
- if (file_block < NDADDR)
- return(inode.i_db[file_block]);
- if ((bnum=fsbtodb(fs, inode.i_ib[0])+boff) != mapblock) {
- iodest = mapbuf;
- cnt = fs->fs_bsize;
- devread();
- mapblock = bnum;
- }
- return (((int *)mapbuf)[(file_block - NDADDR) % NINDIR(fs)]);
-}
-
-openrd()
-{
- char **devp, *cp = name;
- /*******************************************************\
- * If bracket given look for preceding device name *
- \*******************************************************/
- while (*cp && *cp!='(')
- cp++;
- if (!*cp)
- {
- cp = name;
- }
- else
- {
- if (cp++ != name)
- {
- for (devp = devs; *devp; devp++)
- if (name[0] == (*devp)[0] &&
- name[1] == (*devp)[1])
- break;
- if (!*devp)
- {
- printf("Unknown device\n");
- return 1;
- }
- maj = devp-devs;
- }
- /*******************************************************\
- * Look inside brackets for unit number, and partition *
- \*******************************************************/
- /*
- * Allow any valid digit as the unit number, as the BIOS
- * will complain if the unit number is out of range.
- * Restricting the range here prevents the possibilty of using
- * BIOSes that support more than 2 units.
- * XXX Bad values may cause strange errors, need to check if
- * what happens when a value out of range is supplied.
- */
- if (*cp >= '0' && *cp <= '9')
- unit = *cp++ - '0';
- if (!*cp || (*cp == ',' && !*++cp))
- return 1;
- if (*cp >= 'a' && *cp <= 'p')
- part = *cp++ - 'a';
- while (*cp && *cp++!=')') ;
- if (!*cp)
- return 1;
- }
- switch(maj)
- {
- case 1:
- dosdev = unit | 0x80;
- unit = 0;
- break;
- case 0:
- case 4:
- dosdev = unit | 0x80;
- break;
- case 2:
- dosdev = unit;
- break;
- case 3:
- printf("Wangtek unsupported\n");
- return 1;
- break;
- }
- inode.i_dev = dosdev;
- /***********************************************\
- * Now we know the disk unit and part, *
- * Load disk info, (open the device) *
- \***********************************************/
- if (devopen())
- return 1;
-
- /***********************************************\
- * Load Filesystem info (mount the device) *
- \***********************************************/
- iodest = (char *)(fs = (struct fs *)fsbuf);
- cnt = SBSIZE;
- bnum = SBLOCK + boff;
- devread();
- /***********************************************\
- * Find the actual FILE on the mounted device *
- \***********************************************/
- if (!find(cp))
- {
- return 1;
- }
- poff = 0;
- name = cp;
- return 0;
-}
diff --git a/sys/i386/boot/table.c b/sys/i386/boot/table.c
deleted file mode 100644
index 677a12f..0000000
--- a/sys/i386/boot/table.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1992, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- *
- * from: Mach, Revision 2.2 92/04/04 11:36:43 rpd
- * $Id: table.c,v 1.3 1993/10/16 19:11:40 rgrimes Exp $
- */
-
-/*
- Copyright 1988, 1989, 1990, 1991, 1992
- by Intel Corporation, Santa Clara, California.
-
- All Rights Reserved
-
-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 appears in all
-copies and that both the copyright notice and this permission notice
-appear in supporting documentation, and that the name of Intel
-not be used in advertising or publicity pertaining to distribution
-of the software without specific, written prior permission.
-
-INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
-IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
-NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-
-/* Segment Descriptor
- *
- * 31 24 19 16 7 0
- * ------------------------------------------------------------
- * | | |B| |A| | | |1|0|E|W|A| |
- * | BASE 31..24 |G|/|0|V| LIMIT |P|DPL| TYPE | BASE 23:16 |
- * | | |D| |L| 19..16| | |1|1|C|R|A| |
- * ------------------------------------------------------------
- * | | |
- * | BASE 15..0 | LIMIT 15..0 |
- * | | |
- * ------------------------------------------------------------
- */
-
-struct seg_desc {
- unsigned short limit_15_0;
- unsigned short base_15_0;
- unsigned char base_23_16;
- unsigned char p_dpl_type;
- unsigned char g_b_a_limit;
- unsigned char base_31_24;
- };
-
-#define RUN 0 /* not really 0, but filled in at boot time */
-
-struct seg_desc Gdt[] = {
- {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 0x0 : null */
- {0xFFFF, 0x0, 0x0, 0x9F, 0xCF, 0x0}, /* 0x08 : kernel code */
- /* 0x9E? */
- {0xFFFF, 0x0, 0x0, 0x93, 0xCF, 0x0}, /* 0x10 : kernel data */
- /* 0x92? */
- {0xFFFF, RUN, RUN, 0x9E, 0x40, 0x0}, /* 0x18 : boot code */
- {0xFFFF, RUN, RUN, 0x92, 0x40, 0x0}, /* 0x20 : boot data */
- {0xFFFF, RUN, RUN, 0x9E, 0x0, 0x0}, /* 0x28 : boot code, 16 bits */
-#ifdef BDE_DEBUGGER
- /* More for bdb. */
- {}, /* BIOS_CS_INDEX = 6 : null */
- {}, /* BIOS_TMP_INDEX = 7 : null */
- {}, /* TSS_INDEX = 8 : null */
- {0xFFFF, 0x0, 0x0, 0xB2, 0x40, 0x0}, /* DS_286_INDEX = 9 */
- {0xFFFF, 0x0, 0x0, 0xB2, 0x40, 0x0}, /* ES_286_INDEX = 10 */
- {}, /* Unused = 11 : null */
- {0x7FFF, 0x8000, 0xB, 0xB2, 0x40, 0x0}, /* COLOR_INDEX = 12 */
- {0x7FFF, 0x0, 0xB, 0xB2, 0x40, 0x0}, /* MONO_INDEX = 13 */
- {0xFFFF, RUN, RUN, 0x9A, 0x40, 0x0}, /* DB_CS_INDEX = 14 */
- {0xFFFF, RUN, RUN, 0x9A, 0x0, 0x0}, /* DB_CS16_INDEX = 15 */
- {0xFFFF, RUN, RUN, 0x92, 0x40, 0x0}, /* DB_DS_INDEX = 16 */
- {8*18-1, RUN, RUN, 0x92, 0x40, 0x0}, /* GDT_INDEX = 17 */
-#endif /* BDE_DEBUGGER */
-};
-
-#ifdef BDE_DEBUGGER
-struct idt_desc {
- unsigned short entry_15_0;
- unsigned short selector;
- unsigned char padding;
- unsigned char p_dpl_type;
- unsigned short entry_31_16;
-};
-
-struct idt_desc Idt[] = {
- {}, /* Null (int 0) */
- {RUN, 0x70, 0, 0x8E, 0}, /* DEBUG_VECTOR = 1 */
- {}, /* Null (int 2) */
- {RUN, 0x70, 0, 0xEE, 0}, /* BREAKPOINT_VECTOR = 3 */
-};
-#endif /* BDE_DEBUGGER */
-
-struct pseudo_desc {
- unsigned short limit;
- unsigned short base_low;
- unsigned short base_high;
- };
-
-struct pseudo_desc Gdtr = { sizeof Gdt - 1, RUN, RUN };
-#ifdef BDE_DEBUGGER
-struct pseudo_desc Idtr_prot = { sizeof Idt - 1, RUN, RUN };
-struct pseudo_desc Idtr_real = { 0x400 - 1, 0x0, 0x0 };
-#endif
diff --git a/sys/i386/conf/ATAPI b/sys/i386/conf/ATAPI
deleted file mode 100644
index bf04ac1..0000000
--- a/sys/i386/conf/ATAPI
+++ /dev/null
@@ -1,123 +0,0 @@
-#
-# ATAPI -- GENERIC kernel with ATAPI (IDE) CDROM support added.
-#
-# $Id: ATAPI,v 1.1 1995/10/04 08:25:24 jkh Exp $
-#
-
-machine "i386"
-cpu "I386_CPU"
-cpu "I486_CPU"
-cpu "I586_CPU"
-ident ATAPIKERN
-maxusers 10
-
-options MATH_EMULATE #Support for x87 emulation
-options INET #InterNETworking
-options FFS #Berkeley Fast Filesystem
-options NFS #Network Filesystem
-options MSDOSFS #MSDOS Filesystem
-options "CD9660" #ISO 9660 Filesystem
-options PROCFS #Process filesystem
-options "COMPAT_43" #Compatible with BSD 4.3
-options "SCSI_DELAY=15" #Be pessimistic about Joe SCSI device
-options BOUNCE_BUFFERS #include support for DMA bounce buffers
-options UCONSOLE #Allow users to grab the console
-
-options SYSVSHM
-options SYSVSEM
-options SYSVMSG
-
-config kernel root on wd0
-
-controller isa0
-controller pci0
-
-controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr
-disk fd0 at fdc0 drive 0
-disk fd1 at fdc0 drive 1
-tape ft0 at fdc0 drive 2
-
-controller wdc0 at isa? port "IO_WD1" bio irq 14 vector wdintr
-disk wd0 at wdc0 drive 0
-disk wd1 at wdc0 drive 1
-
-controller wdc1 at isa? port "IO_WD2" bio irq 15 vector wdintr
-disk wd2 at wdc1 drive 0
-disk wd3 at wdc1 drive 1
-
-options ATAPI #Enable ATAPI support for IDE bus
-device wcd0 #IDE CD-ROM
-
-controller ncr0
-controller ahc0
-
-controller bt0 at isa? port "IO_BT0" bio irq ? vector btintr
-controller uha0 at isa? port "IO_UHA0" bio irq ? drq 5 vector uhaintr
-controller ahc1 at isa? bio irq ? vector ahcintr
-controller ahb0 at isa? bio irq ? vector ahbintr
-controller aha0 at isa? port "IO_AHA0" bio irq ? drq 5 vector ahaintr
-controller aic0 at isa? port 0x340 bio irq 11 vector aicintr
-controller nca0 at isa? port 0x1f88 bio irq 10 vector ncaintr
-controller nca1 at isa? port 0x350 bio irq 5 vector ncaintr
-controller sea0 at isa? bio irq 5 iomem 0xc8000 iosiz 0x2000 vector seaintr
-
-controller scbus0
-
-device sd0
-
-device st0
-
-device cd0 #Only need one of these, the code dynamically grows
-
-device wt0 at isa? port 0x300 bio irq 5 drq 1 vector wtintr
-device mcd0 at isa? port 0x300 bio irq 10 vector mcdintr
-device mcd1 at isa? port 0x340 bio irq 11 vector mcdintr
-
-controller matcd0 at isa? port ? bio
-
-device scd0 at isa? port 0x230 bio
-
-# syscons is the default console driver, resembling an SCO console
-device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
-# Enable this and PCVT_FREEBSD for pcvt vt220 compatible console driver
-#device vt0 at isa? port "IO_KBD" tty irq 1 vector pcrint
-#options "PCVT_FREEBSD=210" # pcvt running on FreeBSD 2.1
-#options XSERVER # include code for XFree86
-
-device npx0 at isa? port "IO_NPX" irq 13 vector npxintr
-
-device sio0 at isa? port "IO_COM1" tty irq 4 vector siointr
-device sio1 at isa? port "IO_COM2" tty irq 3 vector siointr
-device sio2 at isa? port "IO_COM3" tty irq 5 vector siointr
-device sio3 at isa? port "IO_COM4" tty irq 9 vector siointr
-
-device lpt0 at isa? port? tty irq 7 vector lptintr
-device lpt1 at isa? port? tty
-device lpt2 at isa? port? tty
-device mse0 at isa? port 0x23c tty irq 5 vector mseintr
-
-# Order is important here due to intrusive probes, do *not* alphabetize
-# this list of network interfaces until the probes have been fixed.
-# Right now it appears that the ie0 must be probed before ep0. See
-# revision 1.20 of this file.
-device de0
-device ed0 at isa? port 0x280 net irq 5 iomem 0xd8000 vector edintr
-device ed1 at isa? port 0x300 net irq 5 iomem 0xd8000 vector edintr
-device ie0 at isa? port 0x360 net irq 7 iomem 0xd0000 vector ieintr
-device ep0 at isa? port 0x300 net irq 10 vector epintr
-device ix0 at isa? port 0x300 net irq 10 iomem 0xd0000 iosiz 32768 vector ixintr
-device le0 at isa? port 0x300 net irq 5 iomem 0xd0000 vector le_intr
-device lnc0 at isa? port 0x280 net irq 10 drq 0 vector lncintr
-device lnc1 at isa? port 0x300 net irq 10 drq 0 vector lncintr
-device ze0 at isa? port 0x300 net irq 5 iomem 0xd8000 vector zeintr
-device zp0 at isa? port 0x300 net irq 10 iomem 0xd8000 vector zpintr
-
-pseudo-device loop
-pseudo-device ether
-pseudo-device log
-pseudo-device sl 1
-# ijppp uses tun instead of ppp device
-#pseudo-device ppp 1
-pseudo-device tun 1
-pseudo-device pty 16
-pseudo-device gzip # Exec gzipped a.out's
diff --git a/sys/i386/conf/BOOTFLP b/sys/i386/conf/BOOTFLP
deleted file mode 100644
index 1bb3bd4..0000000
--- a/sys/i386/conf/BOOTFLP
+++ /dev/null
@@ -1,70 +0,0 @@
-#
-# GENERIC -- Generic machine with WD/AHx/NCR/BTx family disks
-#
-# $Id: BOOTFLP,v 1.2 1995/02/21 13:42:57 jkh Exp $
-#
-
-machine "i386"
-cpu "I386_CPU"
-cpu "I486_CPU"
-cpu "I586_CPU"
-ident BOOTFLP
-maxusers 10
-
-options MATH_EMULATE #Support for x87 emulation
-options FFS #Berkeley Fast Filesystem
-options "CD9660" #ISO 9660 Filesystem
-options "SCSI_DELAY=15" #Be pessimistic about Joe SCSI device
-options "SCSI_NCR_MAX_SYNC=0" #Restrict NCR to asynch. transfers
-options BOUNCE_BUFFERS #include support for DMA bounce buffers
-options UCONSOLE #Allow users to grab the console
-
-config kernel root on wd0 swap on vn0 dumps on wd0
-
-controller isa0
-controller pci0
-
-controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr
-disk fd0 at fdc0 drive 0
-
-controller wdc0 at isa? port "IO_WD1" bio irq 14 vector wdintr
-disk wd0 at wdc0 drive 0
-disk wd1 at wdc0 drive 1
-
-controller wdc1 at isa? port "IO_WD2" bio irq 15 vector wdintr
-disk wd2 at wdc1 drive 0
-disk wd3 at wdc1 drive 1
-
-device sio0 at isa? port "IO_COM1" tty irq 4 vector siointr
-
-controller ncr0
-controller ahc0
-
-controller bt0 at isa? port "IO_BT0" bio irq ? vector btintr
-controller uha0 at isa? port "IO_UHA0" bio irq ? drq 5 vector uhaintr
-controller ahc1 at isa? bio irq ? vector ahcintr
-controller ahb0 at isa? bio irq ? vector ahbintr
-controller aha0 at isa? port "IO_AHA0" bio irq ? drq 5 vector ahaintr
-controller aic0 at isa? port 0x340 bio irq 11 vector aicintr
-controller nca0 at isa? port 0x1f88 bio irq 10 vector ncaintr
-controller nca1 at isa? port 0x350 bio irq 5 vector ncaintr
-controller sea0 at isa? bio irq 5 iomem 0xc8000 iosiz 0x2000 vector seaintr
-
-controller scbus0
-
-device sd0
-
-device st0 #Only need one of these, the code dynamically grows
-
-device cd0 #Only need one of these, the code dynamically grows
-
-device wt0 at isa? port 0x300 bio irq 5 drq 1 vector wtintr
-device mcd0 at isa? port 0x300 bio irq 10 vector mcdintr
-device mcd1 at isa? port 0x340 bio irq 11 vector mcdintr
-
-device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
-device npx0 at isa? port "IO_NPX" irq 13 vector npxintr
-
-pseudo-device log
-pseudo-device gzip # Exec gzipped a.out's
-pseudo-device vn
diff --git a/sys/i386/conf/CORBIN b/sys/i386/conf/CORBIN
deleted file mode 100644
index 165e97c..0000000
--- a/sys/i386/conf/CORBIN
+++ /dev/null
@@ -1,116 +0,0 @@
-#
-# 'CORBIN' Kernel Configuration
-#
-machine "i386"
-cpu "I386_CPU"
-cpu "I486_CPU"
-ident CORBIN
-
-timezone 8 dst
-maxusers 16
-
-options "i486"
-
-options INET,GATEWAY
-#options MULTICAST,MROUTING
-options FFS
-options MFS
-options NFS
-options LFS
-options FIFO
-options PROCFS
-options UNION
-options KERNFS
-options FDESC
-options PORTAL
-options NULLFS
-options UMAPFS
-options "CD9660"
-
-options KTRACE #kernel syscall tracing
-options "COMPAT_43" #sycall compatibility
-#options "TCP_COMPAT_42"
-#options UCONSOLE #allow non-root console switch
-#options "COMCONSOLE=0" #serial console
-options COM_BIDIR #"bidirectional" serial ports
-options COM_MULTIPORT #multiport serial cards
-options MATH_EMULATE #i387 math emulator
-#options SYSVSHM #SYSV shared memory
-#options "SHMMAXPGS=1024" #max sysvshm shared pages
-options DUMMY_NOPS #no nops in inb/outb
-options FAT_CURSOR #block cursor
-options "NCONS=4" #four virtual consoles
-options "SYMTAB_SPACE=92000" #space for debugging symbols
-options "NFS_MAXATTRTIMO=10" #maximum NFS attribute cache timeout
-
-options USER_LDT
-
-config kernel root on sd0 swap on sd0 dumps on sd0
-
-#ISA bus
-controller isa0
-
-#MFM disk
-controller wdc0 at isa? port "IO_WD1" bio irq 14 vector wdintr
-disk wd0 at wdc0 drive 0
-disk wd1 at wdc0 drive 1
-
-#Floppy disk
-controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr
-disk fd0 at fdc0 drive 0
-disk fd1 at fdc0 drive 1
-
-#IO_AHA0 = 0x330 IO_AHA1 = 0x334
-controller ahb0 at isa? bio irq 11 vector ahbintr
-#controller aha0 at isa? port 0x330 bio irq 11 drq 5 vector ahaintr
-#controller aha1 at isa? port "IO_AHA1" bio irq 12 drq 7 vector ahaintr
-controller scbus0
-device sd0
-device sd1
-device sd2
-device sd3
-#
-device st0
-device cd0
-#
-#device mcd0 at isa? port 0x320 bio irq 5 vector mcdintr
-
-#PC console - "syscons"
-device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
-
-#Numeric processor (FPU)
-device npx0 at isa? port "IO_NPX" irq 13 vector npxintr
-
-#16450/16550 UARTs
-#device com0 at isa? port "IO_COM1" tty irq 4 vector comintr
-#device com1 at isa? port "IO_COM2" tty irq 3 vector comintr
-#device com2 at isa? port 0x3e8 tty irq 9 vector comintr
-#device com3 at isa? port 0x2e8 tty irq 2 vector comintr
-device sio0 at isa? port "IO_COM1" tty irq 4 vector siointr
-device sio1 at isa? port "IO_COM2" tty irq 3 vector siointr
-device sio2 at isa? port 0x3e8 tty irq 9 vector siointr
-#device sio3 at isa? port 0x2e8 tty irq 2 vector siointr
-
-#device ep0 at isa? port 0x300 net irq 10 vector epintr
-
-#Western Digital WD8003/WD8013 ethernet
-#device ed0 at isa? port 0x300 net flags 0x04 irq 10 iomem 0xcc000 iosiz 16384 vector edintr
-device ed0 at isa? port 0x300 net irq 10 iomem 0xcc000 vector edintr
-
-#device is0 at isa? port 0x280 net irq 10 drq 7 vector isintr
-
-#device wt0 at isa? port 0x300 bio irq 5 drq 1 vector wtintr
-
-#device sb0 at isa? port 0x220 irq 5 drq 1 vector sbintr
-
-#device snd3 at isa? port 0x388 irq 12 drq 3 vector pasintr
-#device snd2 at isa? port 0x220 irq 7 drq 1 vector sbintr
-
-pseudo-device loop
-pseudo-device ether
-pseudo-device sl 2
-pseudo-device log
-pseudo-device pty 16
-pseudo-device bpfilter 4
-pseudo-device ddb
-#pseudo-device speaker
diff --git a/sys/i386/conf/GENERICAH b/sys/i386/conf/GENERICAH
deleted file mode 100644
index 3022340..0000000
--- a/sys/i386/conf/GENERICAH
+++ /dev/null
@@ -1,92 +0,0 @@
-#
-# GENERICAH -- Generic machine with WD/AHx/NCR family disks
-#
-# $Id: GENERICAH,v 1.53 1994/10/20 00:53:26 phk Exp $
-#
-
-machine "i386"
-cpu "I386_CPU"
-cpu "I486_CPU"
-cpu "I586_CPU"
-ident GENERICAH
-maxusers 10
-
-options MATH_EMULATE #Support for x87 emulation
-options INET #InterNETworking
-options FFS #Berkeley Fast File System
-options PROCFS #Process filesystem
-options NFS #Network File System
-options "CD9660" #CD ISO9660 File System
-options "COMPAT_43" #Compatible with BSD 4.3
-options UCONSOLE #X Console support
-options "FAT_CURSOR" #block cursor in syscons or pccons
-options "SCSI_DELAY=15" #Be pessimistic about Joe SCSI device
-options "NCONS=4" #4 virtual consoles
-options BOUNCE_BUFFERS #include support for DMA bounce buffers
-
-config kernel root on wd0 swap on wd0 and wd1 and sd0 and sd1 dumps on wd0
-
-controller isa0
-
-controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr
-disk fd0 at fdc0 drive 0
-disk fd1 at fdc0 drive 1
-#tape ft0 at fdc0 drive 2
-
-controller wdc0 at isa? port "IO_WD1" bio irq 14 vector wdintr
-disk wd0 at wdc0 drive 0
-disk wd1 at wdc0 drive 1
-
-controller wdc1 at isa? port "IO_WD2" bio irq 15 vector wdintr
-disk wd2 at wdc1 drive 0
-disk wd3 at wdc1 drive 1
-
-controller ahb0 at isa? bio irq ? vector ahbintr
-controller aha0 at isa? port "IO_AHA0" bio irq ? drq 5 vector ahaintr
-controller pas0 at isa? port 0x1f88 bio
-controller aic0 at isa? port 0x340 bio irq 11 vector aicintr
-controller pci0
-controller ncr0
-
-controller scbus0
-
-device sd0
-device sd1
-device sd2
-device sd3
-
-device st0
-device st1
-
-device cd0 #Only need one of these, the code dynamically grows
-
-device wt0 at isa? port 0x300 bio irq 5 drq 1 vector wtintr
-device mcd0 at isa? port 0x300 bio irq 10 vector mcdintr
-device mcd1 at isa? port 0x340 bio irq 11 vector mcdintr
-
-device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
-device npx0 at isa? port "IO_NPX" irq 13 vector npxintr
-
-device sio0 at isa? port "IO_COM1" tty irq 4 vector siointr
-device sio1 at isa? port "IO_COM2" tty irq 3 vector siointr
-device sio2 at isa? port "IO_COM3" tty irq 5 vector siointr
-device sio3 at isa? port "IO_COM4" tty irq 9 vector siointr
-
-device lpt0 at isa? port? tty irq 7 vector lptintr
-device lpt1 at isa? port? tty
-device lpt2 at isa? port? tty
-
-device ed0 at isa? port 0x280 net irq 5 iomem 0xd8000 vector edintr
-device ed1 at isa? port 0x300 net irq 5 iomem 0xd8000 vector edintr
-device ed2 at isa? port 0x300 net irq 10 iomem 0xcc000 vector edintr
-device ep0 at isa? port 0x300 net irq 10 vector epintr
-device ie0 at isa? port 0x360 net irq 7 iomem 0xd0000 vector ieintr
-device is0 at isa? port 0x280 net irq 10 drq 7 vector isintr
-
-pseudo-device loop
-pseudo-device ether
-pseudo-device log
-pseudo-device sl 2
-pseudo-device pty 16
-pseudo-device speaker
-pseudo-device gzip # Exec gzipped a.out's
diff --git a/sys/i386/conf/GENERICBT b/sys/i386/conf/GENERICBT
deleted file mode 100644
index 9c1009e..0000000
--- a/sys/i386/conf/GENERICBT
+++ /dev/null
@@ -1,87 +0,0 @@
-#
-# GENERICBT -- Generic machine with WD/BTx family disks
-#
-# $Id: GENERICBT,v 1.49 1994/10/20 00:53:28 phk Exp $
-#
-
-machine "i386"
-cpu "I386_CPU"
-cpu "I486_CPU"
-cpu "I586_CPU"
-ident GENERICBT
-maxusers 10
-
-options MATH_EMULATE #Support for x87 emulation
-options INET #InterNETworking
-options FFS #Berkeley Fast File System
-options PROCFS #Process filesystem
-options NFS #Network File System
-options "CD9660" #CD ISO9660 File System
-options "COMPAT_43" #Compatible with BSD 4.3
-options UCONSOLE #X Console support
-options "FAT_CURSOR" #block cursor in syscons or pccons
-options "SCSI_DELAY=15" #Be pessimistic about Joe SCSI device
-options "NCONS=4" #4 virtual consoles
-options BOUNCE_BUFFERS #include support for DMA bounce buffers
-
-config kernel root on wd0 swap on wd0 and wd1 and sd0 and sd1 dumps on wd0
-
-controller isa0
-
-controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr
-disk fd0 at fdc0 drive 0
-disk fd1 at fdc0 drive 1
-#tape ft0 at fdc0 drive 2
-
-controller wdc0 at isa? port "IO_WD1" bio irq 14 vector wdintr
-disk wd0 at wdc0 drive 0
-disk wd1 at wdc0 drive 1
-
-controller wdc1 at isa? port "IO_WD2" bio irq 15 vector wdintr
-disk wd2 at wdc1 drive 0
-disk wd3 at wdc1 drive 1
-
-controller bt0 at isa? port "IO_BT0" bio irq ? vector btintr
-controller uha0 at isa? port "IO_UHA0" bio irq ? drq 5 vector uhaintr
-controller scbus0
-
-device sd0
-device sd1
-device sd2
-device sd3
-
-device st0
-device st1
-
-device cd0 #Only need one of these, the code dynamically grows
-
-device wt0 at isa? port 0x300 bio irq 5 drq 1 vector wtintr
-device mcd0 at isa? port 0x300 bio irq 10 vector mcdintr
-device mcd1 at isa? port 0x340 bio irq 11 vector mcdintr
-
-device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
-device npx0 at isa? port "IO_NPX" irq 13 vector npxintr
-
-device sio0 at isa? port "IO_COM1" tty irq 4 vector siointr
-device sio1 at isa? port "IO_COM2" tty irq 3 vector siointr
-device sio2 at isa? port "IO_COM3" tty irq 5 vector siointr
-device sio3 at isa? port "IO_COM4" tty irq 9 vector siointr
-
-device lpt0 at isa? port? tty irq 7 vector lptintr
-device lpt1 at isa? port? tty
-device lpt2 at isa? port? tty
-
-device ed0 at isa? port 0x280 net irq 5 iomem 0xd8000 vector edintr
-device ed1 at isa? port 0x300 net irq 5 iomem 0xd8000 vector edintr
-device ed2 at isa? port 0x300 net irq 10 iomem 0xcc000 vector edintr
-device ep0 at isa? port 0x300 net irq 10 vector epintr
-device ie0 at isa? port 0x360 net irq 7 iomem 0xd0000 vector ieintr
-device is0 at isa? port 0x280 net irq 10 drq 7 vector isintr
-
-pseudo-device loop
-pseudo-device ether
-pseudo-device log
-pseudo-device sl 2
-pseudo-device pty 16
-pseudo-device speaker
-pseudo-device gzip # Exec gzipped a.out's
diff --git a/sys/i386/conf/IPFIREWALL b/sys/i386/conf/IPFIREWALL
deleted file mode 100644
index 9371286..0000000
--- a/sys/i386/conf/IPFIREWALL
+++ /dev/null
@@ -1,101 +0,0 @@
-#
-# IPFIREWALL -- Sample Generic kernel suitable for building an IP firewall.
-#
-# $Id: IPFIREWALL,v 1.1 1994/10/28 15:09:36 jkh Exp $
-#
-
-machine "i386"
-cpu "I386_CPU"
-cpu "I486_CPU"
-cpu "I586_CPU"
-ident GENERIC
-maxusers 10
-
-options INET #InterNETworking
-options FFS #Berkeley Fast File System
-options NFS #Network File system
-options PROCFS #Process filesystem
-options "COMPAT_43" #Compatible with BSD 4.3
-options UCONSOLE #X Console support
-options "FAT_CURSOR" #block cursor in syscons or pccons
-options "SCSI_DELAY=15" #Be pessimistic about Joe SCSI device
-options "NCONS=4" #4 virtual consoles
-options BOUNCE_BUFFERS #include support for DMA bounce buffers
-options USERCONFIG #Allow user configuration with -c
-options GATEWAY #Pass packets
-options IPFIREWALL #firewall code
-options IPFIREWALL_VERBOSE #print information about dropped packets
-options IPBROADCASTECHO=1 #send reply to broadcast pings
-options IPMASKAGENT=1 #send reply to icmp mask requests
-
-config kernel root on wd0 swap on wd0 and wd1 and sd0 and sd1 dumps on wd0
-
-controller isa0
-controller pci0
-
-controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr
-disk fd0 at fdc0 drive 0
-disk fd1 at fdc0 drive 1
-#tape ft0 at fdc0 drive 2
-
-controller wdc0 at isa? port "IO_WD1" bio irq 14 vector wdintr
-disk wd0 at wdc0 drive 0
-disk wd1 at wdc0 drive 1
-
-controller wdc1 at isa? port "IO_WD2" bio irq 15 vector wdintr
-disk wd2 at wdc1 drive 0
-disk wd3 at wdc1 drive 1
-
-controller ncr0
-
-controller bt0 at isa? port "IO_BT0" bio irq ? vector btintr
-controller ahb0 at isa? bio irq ? vector ahbintr
-controller aha0 at isa? port "IO_AHA0" bio irq ? drq 5 vector ahaintr
-controller uha0 at isa? port "IO_UHA0" bio irq ? drq 5 vector uhaintr
-controller aic0 at isa? port 0x340 bio irq 11 vector aicintr
-controller pas0 at isa? port 0x1f88 bio
-controller sea0 at isa? bio irq 5 iomem 0xc8000 iosiz 0x2000 vector seaintr
-controller scbus0
-
-device sd0
-device sd1
-device sd2
-device sd3
-
-device st0
-device st1
-
-device cd0 #Only need one of these, the code dynamically grows
-
-device wt0 at isa? port 0x300 bio irq 5 drq 1 vector wtintr
-device mcd0 at isa? port 0x300 bio irq 10 vector mcdintr
-device mcd1 at isa? port 0x340 bio irq 11 vector mcdintr
-
-device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
-device npx0 at isa? port "IO_NPX" irq 13 vector npxintr
-
-device sio0 at isa? port "IO_COM1" tty irq 4 vector siointr
-device sio1 at isa? port "IO_COM2" tty irq 3 vector siointr
-device sio2 at isa? port "IO_COM3" tty irq 5 vector siointr
-device sio3 at isa? port "IO_COM4" tty irq 9 vector siointr
-
-device lpt0 at isa? port? tty irq 7 vector lptintr
-device lpt1 at isa? port? tty
-device lpt2 at isa? port? tty
-
-device ed0 at isa? port 0x280 net irq 5 iomem 0xd8000 vector edintr
-device ed1 at isa? port 0x300 net irq 5 iomem 0xd8000 vector edintr
-device ed2 at isa? port 0x300 net irq 10 iomem 0xcc000 vector edintr
-device ep0 at isa? port 0x300 net irq 10 vector epintr
-device ie0 at isa? port 0x360 net irq 7 iomem 0xd0000 vector ieintr
-device is0 at isa? port 0x280 net irq 10 drq 7 vector isintr
-
-pseudo-device loop
-pseudo-device ether
-pseudo-device log
-pseudo-device ppp 2
-pseudo-device sl 2
-pseudo-device pty 16
-pseudo-device speaker
-pseudo-device gzip # Exec gzipped a.out's
-pseudo-device bpfilter 1
diff --git a/sys/i386/conf/MINI b/sys/i386/conf/MINI
deleted file mode 100644
index e038ee5..0000000
--- a/sys/i386/conf/MINI
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# MINI -- A kernel to get FreeBSD on onto a disk.
-#
-# $Id: MINI,v 1.4 1994/10/20 00:19:37 phk Exp $
-#
-
-machine "i386"
-cpu "I386_CPU"
-cpu "I486_CPU"
-cpu "I586_CPU"
-ident MINI
-maxusers 1
-
-options MATH_EMULATE #Support for x87 emulation
-options FFS #Berkeley Fast File System
-options "FAT_CURSOR" #block cursor in syscons or pccons
-options "SCSI_DELAY=15" #Be pessimistic about Joe SCSI device
-options "NCONS=1" #1 virtual consoles
-options BOUNCE_BUFFERS #include support for DMA bounce buffers
-
-config kernel root on wd0 swap on wd0 and wd1 and sd0 and sd1 dumps on wd0
-
-controller isa0
-controller pci0
-
-controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr
-disk fd0 at fdc0 drive 0
-disk fd1 at fdc0 drive 1
-
-controller wdc0 at isa? port "IO_WD1" bio irq 14 vector wdintr
-disk wd0 at wdc0 drive 0
-disk wd1 at wdc0 drive 1
-
-controller wdc1 at isa? port "IO_WD2" bio irq 15 vector wdintr
-disk wd2 at wdc1 drive 0
-disk wd3 at wdc1 drive 1
-
-controller ncr0
-
-controller bt0 at isa? port "IO_BT0" bio irq ? vector btintr
-controller ahb0 at isa? bio irq ? vector ahbintr
-controller aha0 at isa? port "IO_AHA0" bio irq ? drq 5 vector ahaintr
-controller uha0 at isa? port "IO_UHA0" bio irq ? drq 5 vector uhaintr
-controller aic0 at isa? port 0x340 bio irq 11 vector aicintr
-
-controller scbus0
-
-device sd0
-device sd1
-device sd2
-device sd3
-
-device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
-device npx0 at isa? port "IO_NPX" irq 13 vector npxintr
-
-#pseudo-device gzip # Exec gzipped a.out's
diff --git a/sys/i386/conf/PCVT b/sys/i386/conf/PCVT
deleted file mode 100644
index 00e927f..0000000
--- a/sys/i386/conf/PCVT
+++ /dev/null
@@ -1,103 +0,0 @@
-#
-# PCVT - based on $Id: GENERIC,v 1.30 1995/01/28 05:01:43 jkh Exp $
-#
-
-machine "i386"
-cpu "I386_CPU"
-cpu "I486_CPU"
-cpu "I586_CPU"
-ident GENERIC
-maxusers 10
-
-options MATH_EMULATE #Support for x87 emulation
-options INET #InterNETworking
-options FFS #Berkeley Fast Filesystem
-options NFS #Network Filesystem
-options MSDOSFS #MSDOS Filesystem
-options "CD9660" #ISO 9660 Filesystem
-options PROCFS #Process filesystem
-options "COMPAT_43" #Compatible with BSD 4.3
-options "SCSI_DELAY=15" #Be pessimistic about Joe SCSI device
-options BOUNCE_BUFFERS #include support for DMA bounce buffers
-options UCONSOLE #Allow users to grab the console
-
-# pcvt needs XCONSOLE for Xfree
-options XCONSOLE
-options "PCVT_FREEBSD=210" # pcvt running on FreeBSD 2.1
-
-config kernel root on wd0 swap on wd0 and wd1 and sd0 and sd1 and vn0 dumps on wd0
-
-controller isa0
-controller pci0
-
-controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr
-disk fd0 at fdc0 drive 0
-disk fd1 at fdc0 drive 1
-tape ft0 at fdc0 drive 2
-
-controller wdc0 at isa? port "IO_WD1" bio irq 14 vector wdintr
-disk wd0 at wdc0 drive 0
-disk wd1 at wdc0 drive 1
-
-controller wdc1 at isa? port "IO_WD2" bio irq 15 vector wdintr
-disk wd2 at wdc1 drive 0
-disk wd3 at wdc1 drive 1
-
-controller ncr0
-controller ahc0
-
-controller bt0 at isa? port "IO_BT0" bio irq ? vector btintr
-controller uha0 at isa? port "IO_UHA0" bio irq ? drq 5 vector uhaintr
-controller ahc1 at isa? bio irq ? vector ahcintr
-controller ahb0 at isa? bio irq ? vector ahbintr
-controller aha0 at isa? port "IO_AHA0" bio irq ? drq 5 vector ahaintr
-controller aic0 at isa? port 0x340 bio irq 11 vector aicintr
-controller nca0 at isa? port 0x1f88 bio irq 10 vector ncaintr
-controller nca1 at isa? port 0x350 bio irq 5 vector ncaintr
-controller sea0 at isa? bio irq 5 iomem 0xc8000 iosiz 0x2000 vector seaintr
-
-controller scbus0
-
-device sd0
-
-device st0
-
-device cd0 #Only need one of these, the code dynamically grows
-
-device wt0 at isa? port 0x300 bio irq 5 drq 1 vector wtintr
-device mcd0 at isa? port 0x300 bio irq 10 vector mcdintr
-device mcd1 at isa? port 0x340 bio irq 11 vector mcdintr
-
-device scd0 at isa? port 0x230 bio
-
-# device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
-device vt0 at isa? port "IO_KBD" tty irq 1 vector pcrint
-
-device npx0 at isa? port "IO_NPX" irq 13 vector npxintr
-
-device sio0 at isa? port "IO_COM1" tty irq 4 vector siointr
-device sio1 at isa? port "IO_COM2" tty irq 3 vector siointr
-device sio2 at isa? port "IO_COM3" tty irq 5 vector siointr
-device sio3 at isa? port "IO_COM4" tty irq 9 vector siointr
-
-device lpt0 at isa? port? tty irq 7 vector lptintr
-device lpt1 at isa? port? tty
-device lpt2 at isa? port? tty
-
-device de0
-device ed0 at isa? port 0x280 net irq 5 iomem 0xd8000 vector edintr
-device ed1 at isa? port 0x300 net irq 5 iomem 0xd8000 vector edintr
-device ie0 at isa? port 0x360 net irq 7 iomem 0xd0000 vector ieintr
-device ep0 at isa? port 0x300 net irq 10 vector epintr
-device lnc0 at isa? port 0x280 net irq 10 drq 0 vector lncintr
-device le0 at isa? port 0x300 net irq 5 iomem 0xd0000 vector le_intr
-device ze0 at isa? port 0x300 net irq 5 iomem 0xd8000 vector zeintr
-
-pseudo-device loop
-pseudo-device ether
-pseudo-device log
-pseudo-device sl 2
-pseudo-device pty 16
-pseudo-device speaker
-pseudo-device gzip # Exec gzipped a.out's
-pseudo-device vn
diff --git a/sys/i386/conf/SYSCONS b/sys/i386/conf/SYSCONS
deleted file mode 100644
index 5c1fb04..0000000
--- a/sys/i386/conf/SYSCONS
+++ /dev/null
@@ -1,87 +0,0 @@
-#
-# SYSCONS -- Generic machine with WD/AHx family disks and syscons
-#
-# $Id: SYSCONS,v 1.20 1994/03/01 01:27:03 alm Exp $
-#
-
-machine "i386"
-cpu "I386_CPU"
-cpu "I486_CPU"
-ident SYSCONS
-timezone 8 dst
-maxusers 10
-maxfdescs 2048 #Max file descriptors per process
-options MATH_EMULATE #Support for x87 emulation
-options INET #InterNETworking
-options ISOFS #ISO File System
-options NFS #Network File System
-options PCFS #MSDOS File System
-options "COMPAT_43" #Compatible with BSD 4.3
-options "TCP_COMPAT_42" #TCP/IP compatible with 4.2
-options XSERVER #Xserver
-options UCONSOLE #X Console support
-options "NCONS=8" #8 virtual consoles
-options "FAT_CURSOR" #block cursor in syscons
-options "STAR_SAVER" #syscons "stars" screen saver
-#options GATEWAY #Host is a Gateway (forwards packets)
-
-config "386bsd" root on wd0 swap on wd0 and sd0 dumps on wd0
-
-controller isa0
-
-controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr
-disk fd0 at fdc0 drive 0
-disk fd1 at fdc0 drive 1
-#tape ft0 at fdc0 drive 2
-
-controller wdc0 at isa? port "IO_WD1" bio irq 14 vector wdintr
-disk wd0 at wdc0 drive 0
-disk wd1 at wdc0 drive 1
-
-controller wdc1 at isa? port "IO_WD2" bio irq 15 vector wdintr
-disk wd2 at wdc1 drive 0
-disk wd3 at wdc1 drive 1
-
-controller ahb0 at isa? bio irq 11 vector ahbintr
-controller aha0 at isa? port "IO_AHA0" bio irq 11 drq 5 vector ahaintr
-controller scbus0
-
-device sd0
-device sd1
-device sd2
-device sd3
-
-device st0
-device st1
-
-device cd0 #Only need one of these, the code dynamically grows
-
-device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
-device npx0 at isa? port "IO_NPX" irq 13 vector npxintr
-
-device sio0 at isa? port "IO_COM1" tty irq 4 vector siointr
-device sio1 at isa? port "IO_COM2" tty irq 3 vector siointr
-device sio2 at isa? port "IO_COM3" tty irq 5 vector siointr
-device sio3 at isa? port "IO_COM4" tty irq 9 vector siointr
-
-device lpt0 at isa? port "IO_LPT3" tty irq 7 vector lptintr
-device lpa0 at isa? port "IO_LPT1" tty
-device lpa1 at isa? port "IO_LPT2" tty
-
-device ed0 at isa? port 0x280 net irq 5 iomem 0xd8000 vector edintr
-device ed1 at isa? port 0x300 net irq 5 iomem 0xd8000 vector edintr
-device ie0 at isa? port 0x360 net irq 7 iomem 0xd0000 vector ieintr
-device is0 at isa? port 0x280 net irq 10 drq 7 vector isintr
-
-device wt0 at isa? port 0x300 bio irq 5 drq 1 vector wtintr
-
-pseudo-device loop
-pseudo-device ether
-pseudo-device log
-pseudo-device sl 2
-pseudo-device pty 16
-pseudo-device speaker
-
-pseudo-device swappager
-pseudo-device vnodepager
-pseudo-device devpager
diff --git a/sys/i386/eisa/eisadevs.c b/sys/i386/eisa/eisadevs.c
deleted file mode 100644
index 0b7087f..0000000
--- a/sys/i386/eisa/eisadevs.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Written by Billie Alsup (balsup@tfs.com)
- * for TRW Financial Systems for use under the MACH(2.5)and OSF/1 operating
- * systems.
- *
- * TRW Financial Systems, in accordance with their agreement with Carnegie
- * Mellon University, makes this software available to CMU to distribute
- * or use in any manner that they see fit as long as this message is kept with
- * the software. For this reason TFS also grants any other persons or
- * organisations permission to use or modify this software.
- *
- * TFS supplies this software to be publicly redistributed
- * on the understanding that TFS is not responsible for the correct
- * functioning of this software in any circumstances.
- *
- * $Id: eisadevs.c,v 1.1 1995/04/23 08:55:43 julian Exp $
- */
-
-/*
- * Ported to run under FreeBSD by Julian Elischer (julian@tfs.com) Sept 1992
- */
-/* This needs to be automatically generated.. */
-
-#include <sys/param.h>
-#include <sys/systm.h> /* isn't it a joy */
-#include <sys/kernel.h> /* to have three of these */
-#include <sys/conf.h>
-
-#include "i386/isa/isa_device.h"
-#include "eisaconf.h"
-#include "bt.h"
-#if NBT > 0
-extern struct isa_driver btdriver;
-int btintr();
-#endif
-#if NSI > 0
-extern struct isa_driver sidriver;
-int siintr();
-#endif
-
-struct eisa_dev eisa_dev[] = {
-#if NBT > 0
- { "BUS",0x420,0,&bio_imask,{-1,&btdriver,0,0,-1,0,0,btintr,0,0,0,0,0}},
- { "BUS",0x470,0,&bio_imask,{-1,&btdriver,0,0,-1,0,0,btintr,0,0,0,0,0}},
-#endif /* NBT > 0 */
-/* add your devices here */
-#if NSI > 0
- { "SLX",0x411,0,&tty_imask,{-1,&sidriver,0,0,-1,0,0,siintr,0,0,0,0,0}},
-#endif /* NSI > 0 */
-
- {0,0,0}
-};
-
diff --git a/sys/i386/ibcs2/README.iBCS2 b/sys/i386/ibcs2/README.iBCS2
deleted file mode 100644
index 2977b09..0000000
--- a/sys/i386/ibcs2/README.iBCS2
+++ /dev/null
@@ -1,124 +0,0 @@
-What it is
-==========
-
-This is a project that Sean Eric Fagan (sef@kithrup.com) started, and
-Soren Schmidt (sos@login.dknet.dk, author of syscons) picked up. It allows
-SYSVr3.2 i386 binaries (iBCS2 compatible) to run under FreeBSD-2.0.
-We haven't been able to do an exhaustive test, of course, but we are able
-to run at least the following programs:
-
- ISC 2.2 sh, vi, dd, date, wc, chmod, etc.
-
- SCO 3.2v2 runs most (coff) utils on a chroot'ed filesystem
- Informix-2.10, gcc, bash, tcsh ....
-
- SCO 3.2v4 sh, gzip, GNU make, tcsh
-
-Some of those, for both ISC and SCO, used the shared libraries that are
-available for those systems. Currently, the only way to run them, is to
-get a copy of the shared libraries in question (e.g. /shlib/libc_s).
-There might be a way to generate them from a package available for Linux,
-but we haven't had the time or energy to do it ourself, and the last call
-for volunteers resulted in nothing. If someone else wants to volunteer,
-we would be grateful.
-
-
-How to get it into the system
-=============================
-
-There are two ways of getting iBCS2 support into the system. One is to use
-Loadable Kernel Modules (LKM) to put it into the kernel at run-time. This
-demands a kernel compiled with:
-
- options "COMPAT_IBCS2"
-
-This puts in the nessesary hooks to let the iBCS2 support do its thing.
-One loads the iBCS2 support by using the command 'ibcs2' (in /usr/bin).
-You can use 'modstat' to see the loaded modules.
-
-Another way is to compile it into the kernel. This is accomplished using:
-
- options "COMPAT_IBCS2"
- options "IBCS2"
-
-in the kernel config file.
-
-
-Where's what
-============
-
-The ibcs2 package consists of quite a few files located in ./sys/i386/ibcs2.
-Here is a brief description of them:
-
-ibcs2.h: Basic header file defines iBCS2 types etc.
-
-ibcs2_dummy.c: Stubs to system calls not yet supported, or not feasible
- to emulate.
-
-ibcs2_ioctl.c: Probably the single-most complicated part of it, this deals
- with translating as many ioctl calls as possible between
- BSD and iBCS2.
-
-ibcs2_misc.c: This has all of the wrapping routines that were thought
- "easy" (at least initially) or that didn't fit anywhere else.
-
-ibcs2_file.c: Functions that deals with file I/O, such as getdents and read
- which are more complex than one should expect.
-
-ibcs2_signal.c: This deals with the signal cruft, including both system
- calls and signal translation.
-
-ibcs2_stats.c: This has all of the filesystem statistic wrappers
- (stat, fstat, statfs, etc.).
-
-ibcs2_sysent.c: This has the system call table for iBCS2 programs, and is
- NOT generated automatically.
-
-ibcs2_ipc.c: Stubs for the iBCS2 ipc calls (shm, msg, sem).
-
-ibcs2_isc.c: This deals with the ISC specific system call (cisc()).
-
-ibcs2_sysi86.c: This deals with the i86 specific system call (sysi86()).
-
-ibcs2_xenix.c: This deals with the Xenix specific system call (cxenix()).
- (This also has some of SCO's POSIX-conformant functions.)
-
-imgact_coff.c: This is the functions that alllows the kernel to load
- COFF programs. It also deals with shared library loading.
-
-There also exist two files (ibcs2_socksys.[ch]) which contains a proto
-implementation of the SYSVr3 socket system, donated by Mostyn Lewis
-(mostyn@mrl.com). It has not been tested much but is included as a basis
-for network support, which is nessesary to run X and the likes.
-
-
-What's Next
-===========
-
-Much needs to be done yet, mainly the socksys emulation should be looked
-at to get socket support going. There currently also is no ipc support.
-The sem & msg functions should map fairly easy to the BSD ones, but our
-current BSD shm implementation is not even close to SYSV behavior, if it
-works at all.
-We currently have loaders or "image_activators" for other binary formats,
-but none of them is really usefull yet (xout, elf).
-Also most of the wrappers for the extra syscalls used by SYSVr4 has been
-done, but not much testing yet because of lacks in the elf loader (but it
-will run a statically linked SYSVr4 shell).
-
-All the wrappers should be tested one by one using every aspect of use
-by the iBCS2 system. The tests we have done so far is to run small
-testprograms to check a limited set of the emulation. When this proved
-that the basics was functional, we tried with what iBCS2 programs where
-at hand. This is by no means an exhaustive test or to say that the
-emulation is errorfree, only a statement of overall functionality of
-the emulator.
-
-Surely much work can be done here, but we are both kind of lazy, and did
-the whole thing just for the fun of it, and mainly as a "can it be done"
-project.
-
- Soren Schmidt (sos@login.dknet.dk)
- Sean Eric Fagan (sef@kithrup.com)
-
-
diff --git a/sys/i386/ibcs2/ibcs2.h b/sys/i386/ibcs2/ibcs2.h
deleted file mode 100644
index 8063c7b..0000000
--- a/sys/i386/ibcs2/ibcs2.h
+++ /dev/null
@@ -1,280 +0,0 @@
-/*-
- * Copyright (c) 1994 Søren Schmidt
- * Copyright (c) 1994 Sean Eric Fagan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer
- * in this position and unchanged.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software withough specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id: ibcs2.h,v 1.3 1994/10/17 22:13:06 sos Exp $
- */
-
-/* trace all iBCS2 system calls */
-extern int ibcs2_trace;
-
-/* convert signals between bsd & iBCS2 */
-extern int bsd_to_ibcs2_signal[];
-extern int ibcs2_to_bsd_signal[];
-char *ibcs2_sig_to_str(int);
-
-/* iBCS2 type definitions */
-typedef char * ibcs2_caddr_t;
-typedef long ibcs2_daddr_t;
-typedef long ibcs2_off_t;
-typedef long ibcs2_key_t;
-typedef unsigned short ibcs2_uid_t;
-typedef unsigned long ibcs2_x_uid_t;
-typedef unsigned short ibcs2_gid_t;
-typedef unsigned long ibcs2_x_gid_t;
-typedef short ibcs2_nlink_t;
-typedef unsigned long ibcs2_x_nlink_t;
-typedef short ibcs2_dev_t;
-typedef long ibcs2_x_dev_t;
-typedef unsigned short ibcs2_ino_t;
-typedef unsigned long ibcs2_x_ino_t;
-typedef unsigned short ibcs2_mode_t;
-typedef unsigned long ibcs2_x_mode_t;
-typedef short ibcs2_pid_t;
-typedef long ibcs2_x_pid_t;
-typedef unsigned int ibcs2_size_t;
-typedef unsigned long ibcs2_time_t;
-typedef struct timespec ibcs2_timestruc_t;
-typedef long ibcs2_clock_t;
-typedef unsigned int ibcs2_sigset_t;
-typedef void (*ibcs2_sig_t) (int);
-
-/* misc defines */
-#define UA_ALLOC() \
- (ALIGN(((caddr_t)PS_STRINGS) + sizeof(struct ps_strings)))
-#define IBCS2_RETVAL_SIZE (3 * sizeof(int))
-#define IBCS2_MAGIC_IN 0xe215
-#define IBCS2_MAGIC_OUT 0x8e11
-#define IBCS2_MAGIC_RETURN(arg) *(((int *)arg) - 3) = IBCS2_MAGIC_OUT; \
- *(((int *)arg) - 2) = retval[0]; \
- *(((int *)arg) - 1) = retval[1]; \
- return(0);
-
-/* iBCS2 signal numbers */
-#define IBCS2_SIGHUP 1
-#define IBCS2_SIGINT 2
-#define IBCS2_SIGQUIT 3
-#define IBCS2_SIGILL 4
-#define IBCS2_SIGTRAP 5
-#define IBCS2_SIGIOT 6
-#define IBCS2_SIGABRT 6
-#define IBCS2_SIGEMT 7
-#define IBCS2_SIGFPE 8
-#define IBCS2_SIGKILL 9
-#define IBCS2_SIGBUS 10
-#define IBCS2_SIGSEGV 11
-#define IBCS2_SIGSYS 12
-#define IBCS2_SIGPIPE 13
-#define IBCS2_SIGALRM 14
-#define IBCS2_SIGTERM 15
-#define IBCS2_SIGUSR1 16
-#define IBCS2_SIGUSR2 17
-#define IBCS2_SIGCLD 18
-#define IBCS2_SIGCHLD 18
-#define IBCS2_SIGPWR 19
-#define IBCS2_SIGWINCH 20
-#define IBCS2_SIGURG 21
-#define IBCS2_SIGPOLL 22
-#define IBCS2_SIGIO 22
-#define IBCS2_SIGSTOP 23
-#define IBCS2_SIGTSTP 24
-#define IBCS2_SIGCONT 25
-#define IBCS2_SIGTTIN 26
-#define IBCS2_SIGTTOU 27
-#define IBCS2_SIGVTALRM 28
-#define IBCS2_SIGPROF 29
-#define IBCS2_SIGGXCPU 30
-#define IBCS2_SIGGXFSZ 31
-#define IBCS2_NSIG 32
-#define IBCS2_SIGMASK 0xFF
-
-#define IBCS2_SA_NOCLDSTOP 0x01
-#define IBCS2_SIG_DFL (void (*)())0
-#define IBCS2_SIG_IGN (void (*)())1
-#define IBCS2_SIG_HOLD (void (*)())2
-
-/* iBCS2 open & fcntl file modes */
-#define IBCS2_RDONLY 0x000
-#define IBCS2_WRONLY 0x001
-#define IBCS2_RDWR 0x002
-#define IBCS2_NDELAY 0x004
-#define IBCS2_APPEND 0x008
-#define IBCS2_SYNC 0x010
-#define IBCS2_NONBLOCK 0x080
-#define IBCS2_CREAT 0x100
-#define IBCS2_TRUNC 0x200
-#define IBCS2_EXCL 0x400
-#define IBCS2_NOCTTY 0x800
-#define IBCS2_PRIV 0x1000
-
-/* iBCS2 fcntl commands */
-#define IBCS2_F_DUPFD 0
-#define IBCS2_F_GETFD 1
-#define IBCS2_F_SETFD 2
-#define IBCS2_F_GETFL 3
-#define IBCS2_F_SETFL 4
-#define IBCS2_F_GETLK 5
-#define IBCS2_F_SETLK 6
-#define IBCS2_F_SETLKW 7
-
-#define IBCS2_F_RDLCK 1
-#define IBCS2_F_WRLCK 2
-#define IBCS2_F_UNLCK 3
-
-/* iBCS2 poll commands */
-#define IBCS2_POLLIN 0x0001
-#define IBCS2_POLLPRI 0x0002
-#define IBCS2_POLLOUT 0x0004
-#define IBCS2_POLLERR 0x0008
-#define IBCS2_POLLHUP 0x0010
-#define IBCS2_POLLNVAL 0x0020
-#define IBCS2_POLLRDNORM 0x0040
-#define IBCS2_POLLWRNORM 0x0004
-#define IBCS2_POLLRDBAND 0x0080
-#define IBCS2_POLLWRBAND 0x0100
-#define IBCS2_READPOLL (IBCS2_POLLIN|IBCS2_POLLRDNORM|IBCS2_POLLRDBAND)
-#define IBCS2_WRITEPOLL (IBCS2_POLLOUT|IBCS2_POLLWRNORM|IBCS2_POLLWRBAND)
-
-/* iBCS2 termio input modes */
-#define IBCS2_IGNBRK 0x0001
-#define IBCS2_BRKINT 0x0002
-#define IBCS2_IGNPAR 0x0004
-#define IBCS2_PARMRK 0x0008
-#define IBCS2_INPCK 0x0010
-#define IBCS2_ISTRIP 0x0020
-#define IBCS2_INLCR 0x0040
-#define IBCS2_IGNCR 0x0080
-#define IBCS2_ICRNL 0x0100
-#define IBCS2_IUCLC 0x0200
-#define IBCS2_IXON 0x0400
-#define IBCS2_IXANY 0x0800
-#define IBCS2_IXOFF 0x1000
-#define IBCS2_DOSMODE 0x8000
-
-/* iBCS2 termio output modes */
-#define IBCS2_OPOST 0x0001
-#define IBCS2_OLCUC 0x0002
-#define IBCS2_ONLCR 0x0004
-#define IBCS2_OCRNL 0x0008
-#define IBCS2_ONOCR 0x0010
-#define IBCS2_ONLRET 0x0020
-#define IBCS2_OFILL 0x0040
-#define IBCS2_OFDEL 0x0080
-#define IBCS2_NL1 0x0100
-#define IBCS2_CR1 0x0200
-#define IBCS2_CR2 0x0400
-#define IBCS2_TAB1 0x0800
-#define IBCS2_TAB2 0x1000
-#define IBCS2_BS1 0x2000
-#define IBCS2_VT1 0x4000
-#define IBCS2_FF1 0x8000
-
-/* iBCS2 termio control modes */
-#define IBCS2_CBAUD 0x000F
-#define IBCS2_B0 0x0
-#define IBCS2_B50 0x0001
-#define IBCS2_B75 0x0002
-#define IBCS2_B110 0x0003
-#define IBCS2_B134 0x0004
-#define IBCS2_B150 0x0005
-#define IBCS2_B200 0x0006
-#define IBCS2_B300 0x0007
-#define IBCS2_B600 0x0008
-#define IBCS2_B1200 0x0009
-#define IBCS2_B1800 0x000A
-#define IBCS2_B2400 0x000B
-#define IBCS2_B4800 0x000C
-#define IBCS2_B9600 0x000D
-#define IBCS2_B19200 0x000E
-#define IBCS2_B38400 0x000F
-#define IBCS2_CSIZE 0x0030
-#define IBCS2_CS5 0x0
-#define IBCS2_CS6 0x0010
-#define IBCS2_CS7 0x0020
-#define IBCS2_CS8 0x0030
-#define IBCS2_CSTOPB 0x0040
-#define IBCS2_CREAD 0x0080
-#define IBCS2_PARENB 0x0100
-#define IBCS2_PARODD 0x0200
-#define IBCS2_HUPCL 0x0400
-#define IBCS2_CLOCAL 0x0800
-#define IBCS2_RCV1EN 0x1000
-#define IBCS2_XMT1EN 0x2000
-#define IBCS2_LOBLK 0x4000
-#define IBCS2_XCLUDE 0x8000
-
-/* iBCS2 termio line discipline 0 modes */
-#define IBCS2_ISIG 0x0001
-#define IBCS2_ICANON 0x0002
-#define IBCS2_XCASE 0x0004
-#define IBCS2_ECHO 0x0008
-#define IBCS2_ECHOE 0x0010
-#define IBCS2_ECHOK 0x0020
-#define IBCS2_ECHONL 0x0040
-#define IBCS2_NOFLSH 0x0080
-
-/* iBCS2 control characters */
-#define IBCS2_VINTR 0
-#define IBCS2_VQUIT 1
-#define IBCS2_VERASE 2
-#define IBCS2_VKILL 3
-#define IBCS2_VEOF 4 /* ICANON */
-#define IBCS2_VEOL 5 /* ICANON */
-#define IBCS2_VEOL2 6
-#define IBCS2_VSWTCH 7
-#define IBCS2_VMIN 4 /* !ICANON */
-#define IBCS2_VTIME 5 /* !ICANON */
-#define IBCS2_VSUSP 10
-#define IBCS2_VSTART 11
-#define IBCS2_VSTOP 12
-#define IBCS2_NCC 8 /* termio */
-#define IBCS2_NCCS 13 /* termios */
-
-/* iBCS2 ulimit commands */
-#define IBCS2_GETFSIZE 1
-#define IBCS2_SETFSIZE 2
-#define IBCS2_GETPSIZE 3
-#define IBCS2_GETMOPEN 4
-
-/* iBCS2 emulator trace control */
-#define IBCS2_TRACE_FILE 0x00000001
-#define IBCS2_TRACE_IOCTL 0x00000002
-#define IBCS2_TRACE_ISC 0x00000004
-#define IBCS2_TRACE_MISC 0x00000008
-#define IBCS2_TRACE_SIGNAL 0x00000010
-#define IBCS2_TRACE_STATS 0x00000020
-#define IBCS2_TRACE_XENIX 0x00000040
-#define IBCS2_TRACE_IOCTLCNV 0x00000080
-#define IBCS2_TRACE_COFF 0x01000000
-#define IBCS2_TRACE_ELF 0x02000000
-#define IBCS2_TRACE_ALL 0x0300007f
-
-#define IBCS2_FP_NO 0 /* no fp support */
-#define IBCS2_FP_SW 1 /* software emulator */
-#define IBCS2_FP_287 2 /* 80287 FPU */
-#define IBCS2_FP_387 3 /* 80387 FPU */
-
diff --git a/sys/i386/ibcs2/ibcs2_dummy.c b/sys/i386/ibcs2/ibcs2_dummy.c
deleted file mode 100644
index 7a7c102..0000000
--- a/sys/i386/ibcs2/ibcs2_dummy.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*-
- * Copyright (c) 1994 Søren Schmidt
- * Copyright (c) 1994 Sean Eric Fagan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer
- * in this position and unchanged.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software withough specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id: ibcs2_dummy.c,v 1.1 1994/10/14 08:52:59 sos Exp $
- */
-
-#include <i386/ibcs2/ibcs2.h>
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/sysent.h>
-#include <sys/errno.h>
-#include <machine/cpu.h>
-#include <machine/psl.h>
-#include <machine/reg.h>
-
-int
-ibcs2_nosys(struct proc *p, void *args, int *retval)
-{
- printf("IBCS2: no such syscall eax = %d(0x%x)\n",
- ((struct trapframe*)p->p_md.md_regs)->tf_eax,
- ((struct trapframe*)p->p_md.md_regs)->tf_eax);
- return ENOSYS;
-}
-
-int
-ibcs2_clocal(struct proc *p, void *args, int *retval)
-{
- printf("IBCS2: 'clocal' not implemented yet\n");
- return EINVAL;
-}
-
-int
-ibcs2_sysfs(struct proc *p, void *args, int *retval)
-{
- printf("IBCS2: 'sysfs' not implemented yet\n");
- return EINVAL;
-}
-
-int
-ibcs2_uadmin(struct proc *p, void *args, int *retval)
-{
- printf("IBCS2: 'uadmin' not implemented yet\n");
- return EINVAL;
-}
-
-int
-ibcs2_advfs(struct proc *p, void *args, int *retval)
-{
- printf("IBCS2: 'advfs' not implemented yet\n");
- return EINVAL;
-}
-
-int
-ibcs2_unadvfs(struct proc *p, void *args, int *retval)
-{
- printf("IBCS2: 'unadvfs' not implemented yet\n");
- return EINVAL;
-}
-
-int
-ibcs2_libattach(struct proc *p, void *args, int *retval)
-{
- printf("IBCS2: 'libattach' obsolete\n");
- return EINVAL;
-}
-
-int
-ibcs2_libdetach(struct proc *p, void *args, int *retval)
-{
- printf("IBCS2: 'libdetach' obsolete\n");
- return EINVAL;
-}
-
-int
-ibcs2_plock(struct proc *p, void *args, int *retval)
-{
- printf("IBCS2: 'plock' not supported\n");
- return 0;
-}
-
-
-/*
- * getmsg/putmsg are STREAMS related system calls
- * We don't have STREAMS (yet??) but fake it anyways
- */
-int
-ibcs2_getmsg(struct proc *p, void *args, int *retval)
-{
- printf("IBCS2: 'getmsg' not supported\n");
- return 0;
-}
-
-int
-ibcs2_putmsg(struct proc *p, void *args, int *retval)
-{
- printf("IBCS2: 'putmsg' not supported\n");
- return 0;
-}
-
-/*
- * The following are RFS system calls
- * We don't have RFS.
- */
-int
-ibcs2_rfdebug(struct proc *p, void *args, int *retval)
-{
- printf("IBCS2: 'rdebug' not supported\n");
- return EINVAL;
-}
-
-int
-ibcs2_rfstart(struct proc *p, void *args, int *retval)
-{
- printf("IBCS2: 'rfstart' not supported\n");
- return EINVAL;
-}
-
-int
-ibcs2_rfstop(struct proc *p, void *args, int *retval)
-{
- printf("IBCS2: 'rfstop' not supported\n");
- return EINVAL;
-}
-
-int
-ibcs2_rfsys(struct proc *p, void *args, int *retval)
-{
- printf("IBCS2: 'rfsys' not supported\n");
- return EINVAL;
-}
-
-int
-ibcs2_rmount(struct proc *p, void *args, int *retval)
-{
- printf("IBCS2: 'rmount' not supported\n");
- return EINVAL;
-}
-
-int
-ibcs2_rumount(struct proc *p, void *args, int *retval)
-{
- printf("IBCS2: 'rumount' not supported\n");
- return EINVAL;
-}
diff --git a/sys/i386/ibcs2/ibcs2_file.c b/sys/i386/ibcs2/ibcs2_file.c
deleted file mode 100644
index c621758..0000000
--- a/sys/i386/ibcs2/ibcs2_file.c
+++ /dev/null
@@ -1,525 +0,0 @@
-/*-
- * Copyright (c) 1994 Søren Schmidt
- * Copyright (c) 1994 Sean Eric Fagan
- * All rights reserved.
- *
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer
- * in this position and unchanged.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Id: ibcs2_file.c,v 1.2 1994/12/14 22:03:48 sos Exp $
- */
-
-#include <i386/ibcs2/ibcs2.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/fcntl.h>
-#include <sys/file.h>
-#include <sys/filedesc.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/vnode.h>
-#include <sys/malloc.h>
-#include <sys/exec.h>
-#include <vm/vm.h>
-#include <ufs/ufs/dir.h>
-
-
-struct ibcs2_close_args {
- int fd;
-};
-
-int
-ibcs2_close(struct proc *p, struct ibcs2_close_args *args, int *retval)
-{
- if (ibcs2_trace & IBCS2_TRACE_FILE)
- printf("IBCS2: 'close' fd=%d\n", args->fd);
- return close(p, args, retval);
-}
-
-struct ibcs2_creat_args {
- char *fname;
- int fmode;
-};
-
-int
-ibcs2_creat(struct proc *p, struct ibcs2_creat_args *args, int *retval)
-{
- struct args {
- char *fname;
- int mode;
- int crtmode;
- } bsd_open_args;
-
- if (ibcs2_trace & IBCS2_TRACE_FILE)
- printf("IBCS2: 'creat' name=%s, mode=%x\n",
- args->fname, args->fmode);
- bsd_open_args.fname = args->fname;
- bsd_open_args.crtmode = args->fmode;
- bsd_open_args.mode = O_WRONLY | O_CREAT | O_TRUNC;
- return open(p, &bsd_open_args, retval);
-}
-
-int
-ibcs2_dup(struct proc *p, void *args, int *retval)
-{
- if (ibcs2_trace & IBCS2_TRACE_FILE)
- printf("IBCS2: 'dup'\n");
- return dup(p, args, retval);
-}
-
-struct ibcs2_flock {
- short l_type;
- short l_whence;
- ibcs2_off_t l_start;
- ibcs2_off_t l_len;
- short l_sysid;
- ibcs2_pid_t l_pid;
-};
-
-static void
-ibcs2_to_bsd_flock(struct ibcs2_flock *ibcs2_flock, struct flock *bsd_flock)
-{
- switch (ibcs2_flock->l_type) {
- case IBCS2_F_RDLCK:
- bsd_flock->l_type = F_RDLCK;
- break;
- case IBCS2_F_WRLCK:
- bsd_flock->l_type = F_WRLCK;
- break;
- case IBCS2_F_UNLCK:
- bsd_flock->l_type = F_UNLCK;
- break;
- }
- bsd_flock->l_whence = ibcs2_flock->l_whence;
- bsd_flock->l_start = (off_t)ibcs2_flock->l_start;
- bsd_flock->l_len = (off_t)ibcs2_flock->l_len;
- bsd_flock->l_pid = (pid_t)ibcs2_flock->l_pid;
-}
-
-static void
-bsd_to_ibcs2_flock(struct flock *bsd_flock, struct ibcs2_flock *ibcs2_flock)
-{
- switch (bsd_flock->l_type) {
- case F_RDLCK:
- ibcs2_flock->l_type = IBCS2_F_RDLCK;
- break;
- case F_WRLCK:
- ibcs2_flock->l_type = IBCS2_F_WRLCK;
- break;
- case F_UNLCK:
- ibcs2_flock->l_type = IBCS2_F_UNLCK;
- break;
- }
- ibcs2_flock->l_whence = bsd_flock->l_whence;
- ibcs2_flock->l_start = (ibcs2_off_t)bsd_flock->l_start;
- ibcs2_flock->l_len = (ibcs2_off_t)bsd_flock->l_len;
- ibcs2_flock->l_sysid = 0;
- ibcs2_flock->l_pid = (ibcs2_pid_t)bsd_flock->l_pid;
-}
-
-struct ibcs2_fcntl_args {
- int fd;
- int cmd;
- int arg;
-};
-
-int
-ibcs2_fcntl(struct proc *p, struct ibcs2_fcntl_args *args, int *retval)
-{
- int error, result;
- struct fcntl_args {
- int fd;
- int cmd;
- int arg;
- } fcntl_args;
- struct ibcs2_flock ibcs2_flock;
- struct flock *bsd_flock = (struct flock *)UA_ALLOC();
-
- if (ibcs2_trace & IBCS2_TRACE_FILE)
- printf("IBCS2: 'fcntl' fd=%d, cmd=%d arg=%d\n",
- args->fd, args->cmd, args->arg);
-
- fcntl_args.fd = args->fd;
- fcntl_args.arg = 0;
-
- switch (args->cmd) {
- case IBCS2_F_DUPFD:
- fcntl_args.cmd = F_DUPFD;
- return fcntl(p, &fcntl_args, retval);
-
- case IBCS2_F_GETFD:
- fcntl_args.cmd = F_GETFD;
- return fcntl(p, &fcntl_args, retval);
-
- case IBCS2_F_SETFD:
- fcntl_args.cmd = F_SETFD;
- return fcntl(p, &fcntl_args, retval);
-
- case IBCS2_F_GETFL:
- fcntl_args.cmd = F_GETFL;
- error = fcntl(p, &fcntl_args, &result);
- *retval = 0;
- if (result & O_RDONLY) *retval |= IBCS2_RDONLY;
- if (result & O_WRONLY) *retval |= IBCS2_WRONLY;
- if (result & O_RDWR) *retval |= IBCS2_RDWR;
- if (result & O_NDELAY) *retval |= IBCS2_NONBLOCK;
- if (result & O_APPEND) *retval |= IBCS2_APPEND;
- if (result & O_FSYNC) *retval |= IBCS2_SYNC;
- return error;
-
- case IBCS2_F_SETFL:
- if (args->arg & IBCS2_NDELAY) fcntl_args.arg |= O_NONBLOCK;
- if (args->arg & IBCS2_APPEND) fcntl_args.arg |= O_APPEND;
- if (args->arg & IBCS2_SYNC) fcntl_args.arg |= O_FSYNC;
- fcntl_args.cmd = F_SETFL;
- return fcntl(p, &fcntl_args, retval);
-
- case IBCS2_F_GETLK:
- if ((error = copyin((caddr_t)args->arg, (caddr_t)&ibcs2_flock,
- sizeof(struct ibcs2_flock))))
- return error;
- ibcs2_to_bsd_flock(&ibcs2_flock, bsd_flock);
- fcntl_args.cmd = F_GETLK;
- fcntl_args.arg = (int)bsd_flock;
- if (error = fcntl(p, &fcntl_args, retval))
- return error;
- bsd_to_ibcs2_flock(bsd_flock, &ibcs2_flock);
- return copyout((caddr_t)&ibcs2_flock, (caddr_t)args->arg,
- sizeof(struct ibcs2_flock));
-
- case IBCS2_F_SETLK:
- if ((error = copyin((caddr_t)args->arg, (caddr_t)&ibcs2_flock,
- sizeof(struct ibcs2_flock))))
- return error;
- ibcs2_to_bsd_flock(&ibcs2_flock, bsd_flock);
- fcntl_args.cmd = F_SETLK;
- fcntl_args.arg = (int)bsd_flock;
- return fcntl(p, &fcntl_args, retval);
-
- case IBCS2_F_SETLKW:
- if ((error = copyin((caddr_t)args->arg, (caddr_t)&ibcs2_flock,
- sizeof(struct ibcs2_flock))))
- return error;
- ibcs2_to_bsd_flock(&ibcs2_flock, bsd_flock);
- fcntl_args.cmd = F_SETLKW;
- fcntl_args.arg = (int)bsd_flock;
- return fcntl(p, &fcntl_args, retval);
- }
- return EINVAL;
-}
-
-struct ibcs2_dirent {
- ibcs2_ino_t d_ino;
- ibcs2_off_t d_off;
- unsigned short d_reclen;
- char d_name[256];
-};
-
-struct ibcs2_getdents_args {
- int fd;
- char *buf;
- int nbytes;
-};
-
-#define BSD_DIRENT(cp) ((struct direct *)(cp))
-#define IBCS2_RECLEN(p) \
- (((2*sizeof(long)+sizeof(short)+BSD_DIRENT(p)->d_namlen+1)+3)&~3)
-
-int
-ibcs2_getdents(struct proc *p, struct ibcs2_getdents_args *args, int *retval)
-{
- struct vnode *vp;
- struct ibcs2_dirent dir;
- struct file *fp;
- struct uio auio;
- struct iovec aiov;
- off_t off;
- caddr_t inp, buf, outp;
- int len, reclen, resid;
- int buflen, error, eofflag;
-
- if (ibcs2_trace & IBCS2_TRACE_FILE)
- printf("IBCS2: 'getdents' fd = %d, size = %d\n",
- args->fd, args->nbytes);
- if ((error = getvnode(p->p_fd, args->fd, &fp)) != 0)
- return error;
- if ((fp->f_flag & FREAD) == 0)
- return EBADF;
- vp = (struct vnode *)fp->f_data;
- if (vp->v_type != VDIR)
- return EINVAL;
- buflen = min(DEFAULT_PAGE_SIZE, max(DIRBLKSIZ, args->nbytes));
- buf = malloc(buflen, M_TEMP, M_WAITOK);
- VOP_LOCK(vp);
- off = fp->f_offset;
-again:
- aiov.iov_base = buf;
- aiov.iov_len = buflen;
- auio.uio_iov = &aiov;
- auio.uio_iovcnt = 1;
- auio.uio_rw = UIO_READ;
- auio.uio_segflg = UIO_SYSSPACE;
- auio.uio_procp = p;
- auio.uio_resid = buflen;
- auio.uio_offset = off & ~(DIRBLKSIZ-1);
- if (error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, NULL, NULL))
- goto out;
- inp = buf + (off & (DIRBLKSIZ-1));
- buflen -= off & (DIRBLKSIZ-1);
- outp = args->buf;
- resid = args->nbytes;
- if ((len = (buflen - auio.uio_resid)) <= 0)
- goto eof;
- for (; len > 0 && resid > 0; len -= reclen) {
- reclen = BSD_DIRENT(inp)->d_reclen;
- if (reclen & 3)
- panic("ibcs2_getdents");
- if (BSD_DIRENT(inp)->d_ino == 0) {
- off += reclen;
- inp += reclen;
- continue;
- }
- if (IBCS2_RECLEN(inp) > len || resid < IBCS2_RECLEN(inp)) {
- outp++;
- break;
- }
- bzero(&dir, sizeof(struct ibcs2_dirent));
- dir.d_ino = BSD_DIRENT(inp)->d_ino;
- dir.d_off = (ibcs2_off_t)off;
- dir.d_reclen = IBCS2_RECLEN(inp);
- bcopy(BSD_DIRENT(inp)->d_name, &dir.d_name,
- BSD_DIRENT(inp)->d_namlen);
- if (error = copyout(&dir, outp, dir.d_reclen))
- goto out;
- outp += IBCS2_RECLEN(inp);
- resid -= IBCS2_RECLEN(inp);
- off += reclen;
- inp += reclen;
- }
- if (outp == args->buf)
- goto again;
- fp->f_offset = off;
-eof:
- *retval = args->nbytes - resid;
-out:
- VOP_UNLOCK(vp);
- free(buf, M_TEMP);
- return error;
-}
-
-struct ibcs2_open_args {
- char *fname;
- int fmode;
- int crtmode;
-};
-
-int
-ibcs2_open(struct proc *p, struct ibcs2_open_args *args, int *retval)
-{
- int bsd_mode = 0;
- int noctty = args->fmode & 0x8000;
- int error;
-
- if (ibcs2_trace & IBCS2_TRACE_FILE)
- printf("IBCS2: 'open' name=%s, flags=%x, mode=%x\n",
- args->fname, args->fmode, args->crtmode);
- if (args->fmode & IBCS2_RDONLY) bsd_mode |= O_RDONLY;
- if (args->fmode & IBCS2_WRONLY) bsd_mode |= O_WRONLY;
- if (args->fmode & IBCS2_RDWR) bsd_mode |= O_RDWR;
- if (args->fmode & IBCS2_NDELAY) bsd_mode |= O_NONBLOCK;
- if (args->fmode & IBCS2_APPEND) bsd_mode |= O_APPEND;
- if (args->fmode & IBCS2_SYNC) bsd_mode |= O_FSYNC;
- if (args->fmode & IBCS2_NONBLOCK) bsd_mode |= O_NONBLOCK;
- if (args->fmode & IBCS2_PRIV) bsd_mode |= O_EXLOCK;
- if (args->fmode & IBCS2_CREAT) bsd_mode |= O_CREAT;
- if (args->fmode & IBCS2_TRUNC) bsd_mode |= O_TRUNC | O_CREAT;
- if (args->fmode & IBCS2_EXCL) bsd_mode |= O_EXCL;
- if (args->fmode & IBCS2_NOCTTY) bsd_mode |= O_NOCTTY;
- args->fmode = bsd_mode;
- error = open(p, args, retval);
- if (!error && !noctty && SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
- struct filedesc *fdp = p->p_fd;
- struct file *fp = fdp->fd_ofiles[*retval];
-
- if (fp->f_type == DTYPE_VNODE)
- (fp->f_ops->fo_ioctl)(fp, TIOCSCTTY, (caddr_t) 0, p);
- }
- return error;
-}
-
-struct ibcs2_read_args {
- int fd;
- char *buffer;
- unsigned int count;
-};
-
-int
-ibcs2_read(struct proc *p, struct ibcs2_read_args *args, int *retval)
-{
- struct ibcs2_dir {
- ibcs2_ino_t inode;
- char fname[14];
- } dirbuf;
- struct vnode *vp;
- struct file *fp;
- struct uio auio;
- struct iovec aiov;
- caddr_t inp, buf, outp;
- off_t off;
- int buflen, error, eofflag;
- int len, reclen, resid;
-
- if (ibcs2_trace & IBCS2_TRACE_FILE)
- printf("IBCS2: 'read' fd=%d, count=%d\n",
- args->fd, args->count);
-
- if (error = getvnode(p->p_fd, args->fd, &fp))
- if (error == EINVAL)
- return read(p, args, retval);
- else
- return error;
- if ((fp->f_flag & FREAD) == 0)
- return EBADF;
- vp = (struct vnode *)fp->f_data;
- if (vp->v_type != VDIR) {
- if (ibcs2_trace & IBCS2_TRACE_FILE)
- printf("normal read\n");
- return read(p, args, retval);
- }
- if (ibcs2_trace & IBCS2_TRACE_FILE)
- printf("read directory\n");
- buflen = min(DEFAULT_PAGE_SIZE, max(DIRBLKSIZ, args->count));
- buf = malloc(buflen, M_TEMP, M_WAITOK);
- VOP_LOCK(vp);
- off = fp->f_offset;
-again:
- aiov.iov_base = buf;
- aiov.iov_len = buflen;
- auio.uio_iov = &aiov;
- auio.uio_iovcnt = 1;
- auio.uio_rw = UIO_READ;
- auio.uio_segflg = UIO_SYSSPACE;
- auio.uio_procp = p;
- auio.uio_resid = buflen;
- auio.uio_offset = off & ~(DIRBLKSIZ-1);
- if (error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, NULL, NULL))
- goto out;
- inp = buf + (off & (DIRBLKSIZ-1));
- buflen -= off & (DIRBLKSIZ-1);
- outp = args->buffer;
- resid = args->count;
- if ((len = (buflen - auio.uio_resid)) == 0)
- goto eof;
- for (; len > 0 && resid > 0; len -= reclen) {
- reclen = BSD_DIRENT(inp)->d_reclen;
- if (reclen & 3)
- panic("ibcs2_read");
- if (BSD_DIRENT(inp)->d_ino == 0) {
- inp += reclen;
- off += reclen;
- continue;
- }
- if (reclen > len || resid < sizeof(struct ibcs2_dir)) {
- outp++;
- break;
- }
- /*
- * TODO: break up name if > 14 chars
- * put 14 chars in each dir entry wtih d_ino = 0xffff
- * and set the last dir entry's d_ino = inode
- */
- dirbuf.inode = (BSD_DIRENT(inp)->d_ino > 0x0000fffe) ?
- 0xfffe : BSD_DIRENT(inp)->d_ino;
- bcopy(BSD_DIRENT(inp)->d_name, &dirbuf.fname, 14); /* XXX */
- if (error = copyout(&dirbuf, outp, sizeof(dirbuf)))
- goto out;
- off += reclen;
- inp += reclen;
- outp += sizeof(struct ibcs2_dir);
- resid -= sizeof(struct ibcs2_dir);
- }
- if (outp == args->buffer)
- goto again;
- fp->f_offset = off;
-eof:
- *retval = args->count - resid;
-out:
- VOP_UNLOCK(vp);
- free(buf, M_TEMP);
- return error;
-}
-
-struct ibcs2_seek_args {
- int fdes;
- ibcs2_off_t off;
- int whence;
-};
-
-int
-ibcs2_seek(struct proc *p, struct ibcs2_seek_args *args, int *retval)
-{
-
- struct seek_args {
- int fdes;
- int pad;
- off_t off;
- int whence;
- } tmp_args;
- off_t tmp_retval;
- int error;
-
- if (ibcs2_trace & IBCS2_TRACE_FILE)
- printf("IBCS2: 'seek' fd=%d, offset=%d, how=%d\n",
- args->fdes, args->off, args->whence);
- tmp_args.fdes = args->fdes;
- tmp_args.off = (off_t)args->off;
- tmp_args.whence = args->whence;
- error = lseek(p, &tmp_args, &tmp_retval);
- *retval = (int)tmp_retval;
- return error;
-}
-
-struct ibcs2_write_args {
- int fd;
- char *buffer;
- unsigned int count;
-};
-
-int
-ibcs2_write(struct proc *p, struct ibcs2_write_args *args, int *retval)
-{
- if (ibcs2_trace & IBCS2_TRACE_FILE)
- printf("IBCS2: 'write' fd=%d, count=%d\n",
- args->fd, args->count);
- return write(p, args, retval);
-}
diff --git a/sys/i386/ibcs2/ibcs2_stats.c b/sys/i386/ibcs2/ibcs2_stats.c
deleted file mode 100644
index 4a8a80c..0000000
--- a/sys/i386/ibcs2/ibcs2_stats.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/*-
- * Copyright (c) 1994 Sean Eric Fagan
- * Copyright (c) 1994 Søren Schmidt
- * All rights reserved.
- *
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer
- * in this position and unchanged.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Id: ibcs2_stats.c,v 1.2 1995/05/30 08:00:11 rgrimes Exp $
- */
-
-#include <i386/ibcs2/ibcs2.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/file.h>
-#include <sys/filedesc.h>
-#include <sys/mount.h>
-#include <sys/namei.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/vnode.h>
-#include <vm/vm.h>
-#include <vm/vm_param.h>
-#include <vm/vm_map.h>
-#include <vm/vm_kern.h>
-
-struct ibcs2_stat {
- ibcs2_dev_t stat_dev;
- ibcs2_ino_t stat_ino;
- ibcs2_mode_t stat_mode;
- ibcs2_nlink_t stat_nlink;
- ibcs2_uid_t stat_uid;
- ibcs2_gid_t stat_gid;
- ibcs2_dev_t stat_rdev;
- ibcs2_size_t stat_size;
- ibcs2_time_t stat_atime;
- ibcs2_time_t stat_mtime;
- ibcs2_time_t stat_ctime;
-};
-
-struct ibcs2_stat_args {
- char *path;
- struct ibcs2_stat *buf;
-};
-
-static int
-stat_copyout(struct stat *buf, void *ubuf)
-{
- struct ibcs2_stat tbuf;
-
- tbuf.stat_dev = buf->st_dev;
- tbuf.stat_ino = buf->st_ino;
- tbuf.stat_mode = buf->st_mode;
- tbuf.stat_nlink = buf->st_nlink;
- tbuf.stat_uid = buf->st_uid;
- tbuf.stat_gid = buf->st_gid;
- tbuf.stat_rdev = buf->st_rdev;
- tbuf.stat_size = buf->st_size;
- tbuf.stat_atime = buf->st_atime;
- tbuf.stat_mtime = buf->st_mtime;
- tbuf.stat_ctime = buf->st_ctime;
- return copyout(&tbuf, ubuf, sizeof(tbuf));
-}
-
-int
-ibcs2_stat(struct proc *p, struct ibcs2_stat_args *args, int *retval)
-{
- struct stat buf;
- struct ibcs2_stat tbuf;
- struct nameidata nd;
- int error;
-
- if (ibcs2_trace & IBCS2_TRACE_STATS)
- printf("IBCS2: 'stat' path=%s\n", args->path);
-
- /* XXX use of 'curproc' should be 'p'?*/
- NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_USERSPACE, args->path, curproc);
- error = namei(&nd);
-
- if (!error) {
- error = vn_stat(nd.ni_vp, &buf, p);
- vput(nd.ni_vp);
- }
-
- if (!error)
- error = stat_copyout(&buf, args->buf);
-
- return error;
-}
-
-int
-ibcs2_lstat(struct proc *p, struct ibcs2_stat_args *args, int *retval)
-{
- struct stat buf;
- struct ibcs2_stat tbuf;
- struct nameidata nd;
- int error;
-
- if (ibcs2_trace & IBCS2_TRACE_STATS)
- printf("IBCS2: 'lstat' path=%s\n", args->path);
-
- /* XXX use of 'curproc' should be 'p'?*/
- NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_USERSPACE, args->path, curproc);
- error = namei(&nd);
-
- if (!error) {
- error = vn_stat(nd.ni_vp, &buf, p);
- vput(nd.ni_vp);
- }
-
- if (!error)
- error = stat_copyout(&buf, args->buf);
-
- return error;
-}
-
-struct ibcs2_fstat_args {
- int fd;
- struct ibcs2_stat *buf;
-};
-
-int
-ibcs2_fstat(struct proc *p, struct ibcs2_fstat_args *args, int *retval)
-{
- struct ibcs2_stat tbuf;
- struct filedesc *fdp = p->p_fd;
- struct file *fp;
- struct stat buf;
- int error;
-
- if (ibcs2_trace & IBCS2_TRACE_STATS)
- printf("IBCS2: 'fstat' fd=%d\n", args->fd);
- if ((unsigned)args->fd >= fdp->fd_nfiles
- || (fp = fdp->fd_ofiles[args->fd]) == NULL)
- return EBADF;
-
- switch (fp->f_type) {
- case DTYPE_VNODE:
- error = vn_stat((struct vnode *)fp->f_data, &buf, p);
- break;
-
- case DTYPE_SOCKET:
- error = soo_stat((struct socket *)fp->f_data, &buf);
- break;
-
- default:
- panic("IBCS2 fstat");
- /*NOTREACHED*/
- }
- if (!error)
- error = stat_copyout(&buf, args->buf);
-
- return error;
-}
-
-struct ibcs2_statfs {
- short f_fstyp;
- long f_bsize;
- long f_frsize;
- long f_blocks;
- long f_bfree;
- long f_files;
- long f_ffree;
- char f_fname[6];
- char f_fpack[6];
-};
-
-struct ibcs2_statfs_args {
- char *path;
- struct statfs *buf;
- int len;
- int fstyp;
-};
-
-int
-ibcs2_statfs(struct proc *p, struct ibcs2_statfs_args *args, int *retval)
-{
- struct mount *mp;
- struct nameidata *ndp;
- struct statfs *sp;
- struct nameidata nd;
- struct ibcs2_statfs tmp;
- int error;
-
- if (ibcs2_trace & IBCS2_TRACE_STATS)
- printf("IBCS2: 'statfs' path=%s\n", args->path);
- ndp = &nd;
- /* XXX use of 'curproc' should be 'p'?*/
- NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args->path, curproc);
- if (error = namei(ndp))
- return error;
- mp = ndp->ni_vp->v_mount;
- sp = &mp->mnt_stat;
- vrele(ndp->ni_vp);
- if (error = VFS_STATFS(mp, sp, p))
- return error;
- sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
- tmp.f_fstyp = sp->f_type;
- tmp.f_bsize = sp->f_bsize;
- tmp.f_frsize = sp->f_iosize;
- tmp.f_blocks = sp->f_blocks;
- tmp.f_bfree = sp->f_bfree;
- tmp.f_ffree = sp->f_ffree;
- tmp.f_files = sp->f_files;
- bcopy (sp->f_mntonname, tmp.f_fname, 6);
- bcopy (sp->f_mntfromname, tmp.f_fpack, 6);
- return copyout((caddr_t)&tmp, (caddr_t)args->buf, args->len);
-}
-
-struct ibcs2_fstatfs_args {
- int fd;
- struct statfs *buf;
-};
-
-int
-ibcs2_fstatfs(struct proc *p, struct ibcs2_fstatfs_args *args, int *retval)
-{
- struct file *fp;
- struct mount *mp;
- struct statfs *sp;
- struct ibcs2_statfs tmp;
- int error;
-
- if (ibcs2_trace & IBCS2_TRACE_STATS)
- printf("IBCS2: 'fstatfs' fd=%d\n", args->fd);
- if (error = getvnode(p->p_fd, args->fd, &fp))
- return error;
- mp = ((struct vnode *)fp->f_data)->v_mount;
- sp = &mp->mnt_stat;
- if (error = VFS_STATFS(mp, sp, p))
- return error;
- sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
- tmp.f_fstyp = sp->f_type;
- tmp.f_bsize = sp->f_bsize;
- tmp.f_frsize = sp->f_iosize;
- tmp.f_blocks = sp->f_blocks;
- tmp.f_bfree = sp->f_bfree;
- tmp.f_ffree = sp->f_ffree;
- tmp.f_files = sp->f_files;
- bcopy (sp->f_mntonname, tmp.f_fname, 6);
- bcopy (sp->f_mntfromname, tmp.f_fpack, 6);
- return copyout((caddr_t)&tmp, (caddr_t)args->buf,
- sizeof(struct statfs));
-}
diff --git a/sys/i386/include/dkio.h b/sys/i386/include/dkio.h
deleted file mode 100644
index c6d78d5..0000000
--- a/sys/i386/include/dkio.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)dkio.h 5.2 (Berkeley) 1/18/91
- * $Id: dkio.h,v 1.3 1993/11/07 17:42:51 wollman Exp $
- */
-
-#ifndef _MACHINE_DKIO_H_
-#define _MACHINE_DKIO_H_
-
-/*
- * Structures and definitions for disk io control commands
- *
- * THIS WHOLE AREA NEEDS MORE THOUGHT. FOR NOW JUST IMPLEMENT
- * ENOUGH TO READ AND WRITE HEADERS ON MASSBUS DISKS. EVENTUALLY
- * SHOULD BE ABLE TO DETERMINE DRIVE TYPE AND DO OTHER GOOD STUFF.
- */
-
-/* disk io control commands */
-#define DKIOCHDR _IO('d', 1) /* next I/O will read/write header */
-
-#endif /* !_MACHINE_DKIO_H_ */
diff --git a/sys/i386/include/eflags.h b/sys/i386/include/eflags.h
deleted file mode 100644
index 663b317..0000000
--- a/sys/i386/include/eflags.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990,1989 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- *
- * $Id$
- */
-
-#ifndef _I386_EFLAGS_H_
-#define _I386_EFLAGS_H_
-
-/*
- * i386 flags register
- */
-#define EFL_CF 0x00000001 /* carry */
-#define EFL_PF 0x00000004 /* parity of low 8 bits */
-#define EFL_AF 0x00000010 /* carry out of bit 3 */
-#define EFL_ZF 0x00000040 /* zero */
-#define EFL_SF 0x00000080 /* sign */
-#define EFL_TF 0x00000100 /* trace trap */
-#define EFL_IF 0x00000200 /* interrupt enable */
-#define EFL_DF 0x00000400 /* direction */
-#define EFL_OF 0x00000800 /* overflow */
-#define EFL_IOPL 0x00003000 /* IO privilege level: */
-#define EFL_IOPL_KERNEL 0x00000000 /* kernel */
-#define EFL_IOPL_USER 0x00003000 /* user */
-#define EFL_NT 0x00004000 /* nested task */
-#define EFL_RF 0x00010000 /* resume without tracing */
-#define EFL_VM 0x00020000 /* virtual 8086 mode */
-
-#define EFL_USER_SET (EFL_IF)
-#define EFL_USER_CLEAR (EFL_IOPL|EFL_NT|EFL_RF)
-
-#endif _I386_EFLAGS_H_
diff --git a/sys/i386/include/ioctl_pc.h b/sys/i386/include/ioctl_pc.h
deleted file mode 100644
index bc6a255..0000000
--- a/sys/i386/include/ioctl_pc.h
+++ /dev/null
@@ -1,797 +0,0 @@
-/* Copyright 1992,1993 by Holger Veit
- * May be freely used with Bill Jolitz's port of
- * 386bsd and may be included in a 386bsd collection
- * as long as binary and source are available and reproduce the above
- * copyright.
- *
- * You may freely modify this code and contribute improvements based
- * on this code as long as you don't claim to be the original author.
- * Commercial use of this source requires permittance of the copyright
- * holder. A general license for 386bsd will override this restriction.
- *
- * Use at your own risk. The copyright holder or any person who makes
- * this code available for the public (administrators of public archives
- * for instance) are not responsible for any harm to hardware or software
- * that might happen due to wrong application or program faults.
- *
- * Addendum: The XFree86 developers and maintainers are hereby granted the
- * right to distribute this file together with their source distributions
- * and patchkits of XFree86 without further explicit permission of the
- * above copyright holder.
- * This and another file is a necessary include file for the unified
- * pccons/codrv implementation of XFree86. This file is needed if
- * someone wants to compile an Xserver on a system which does not have,
- * for some reasons, the codrv console driver which comes with this file. The
- * availability of this file avoids a large number of #ifdef's and
- * allows to make the xserver code easier runtime-configurable.
- * To make use of this file, it must be installed in /usr/include/sys.
- * This file is not the complete console device driver, so it is possible
- * that properties described in this file do not work without having the
- * complete driver distribution. This is not a fault of the Xserver that
- * was built with this file.
- *
- *
- *
- * From: @(#)$RCSfile: ioctl_pc.h,v
- * Revision: 1.1.1.1 (Contributed to 386bsd)
- * Date: 1993/06/12 14:58:11
- *
- * Important notice: #defined values are subject to be changed!!!
- * Don't use the constant, use the name instead!
- *
- * codrv1-style uses ioctls 'K': 1-33,255
- * 'V': 100-109
- *
- * -hv- Holger Veit, Holger.Veit@gmd.de
- * -hm Hellmuth Michaelis, hm@hcshh.hcs.de
- * -vak- Sergey Vakulenko, vak@kiae.su
- *
- * 25-07-92 -hv- First version
- * 16-08-92 -hm adding vga ioctl for cursor shape
- * 25-10-92 -hv- X11 + video related ioctls
- * 01/12/92 -vak- 8x16 font loading, beep ioctl,
- * LED reassignment ioctl.
- * 22-04-93 -hv- unified most CODRV1/CODRV2 codes
- * 24-04-93 -hv- revised parts of keymap structures
- *
- * $Id$
- */
-
-#ifndef _IOCTL_PC_H_
-#define _IOCTL_PC_H_
-
-#ifdef NOTDEF
-#if __GNUC__ >= 2
-#pragma pack(1)
-#endif
-#endif
-
-#ifndef KERNEL
-#include <sys/ioctl.h>
-#ifndef _TYPES_H_
-#include <sys/types.h>
-#endif
-#else
-#include "ioctl.h"
-#endif
-
-
-/***************************************************************************
- * Basic definitions
- ***************************************************************************/
-
-/* Use this data type when manipulating characters, don't use 'char' or 'u_char'
- * some day this will be changed to 'u_short' or 'u_long' size to allow
- * characters > 255
- */
-typedef u_char XCHAR;
-
-/***************************************************************************
- * driver identification
- ***************************************************************************/
-
-/*
- * This defines the CONSOLE INFORMATION data structure, used to
- * describe console capabilities, to distinguish between different
- * versions. If this ioctl fail, you probably have an old style "pccons"
- * driver (or an "improved" console driver, whose writer is not interested
- * in providing compatibility for anything).
- * In this case, a considerable number of features may not work as expected,
- * or do not work at all.
- */
-
-#define MAXINFOSIZE 16
-struct consinfo {
- u_long info1;
- u_long __reserved1__;
- u_long __reserved2__;
- u_long __reserved3__;
- XCHAR drv_name[MAXINFOSIZE+1];
- XCHAR emul_name[MAXINFOSIZE+1];
- XCHAR __reserved1_name__[MAXINFOSIZE+1];
- XCHAR __reserved2_name__[MAXINFOSIZE+1];
-};
-
-struct oldconsinfo {
- u_long info1;
- u_long __reserved__;
-};
-
-#define CONSGINFO _IOR('K',255,struct consinfo) /* Get console capabilities */
-#define OLDCONSGINFO _IOR('K',255,struct oldconsinfo) /* compatibility */
-#define CONS_ISPC 0x00000001 /* is derived from old PCCONS */
-#define CONS_ISCO 0x00000002 /* is derived from CO driver */
-#define CONS_reserved1 0x00000004 /* reserved for other console drivers */
-#define CONS_reserved2 0x00000008 /* reserved for other console drivers */
-#define CONS_HASKBD 0x00000010 /* has /dev/kbd */
-#define CONS_HASSCAN 0x00000020 /* uses Scan codes */
-#define CONS_HASKEYNUM 0x00000040 /* uses KEYNUMS */
-#define CONS_HASVTY 0x00000080 /* has /dev/vty* */
-#define CONS_HASPC3 0x00000100 /* unused, historical */
-#define CONS_HASVTHP 0x00000200 /* unused, historical */
-#define CONS_reserved3 0x00000400 /* reserved */
-#define CONS_reserved4 0x00000800 /* reserved */
-#define CONS_HASPX386 0x00001000 /* has X386 probing support +new CONSOLE_X_MODE */
-#define CONS_HASOX386 0x00002000 /* has old X386 support CONSOLE_X_MODE_ON/OFF */
-#define CONS_reserved5 0x00004000 /* reserved */
-#define CONS_reserved6 0x00008000 /* reserved */
-#define CONS_HASKCAP 0x00010000 /* has ioctl keycap support */
-#define CONS_HASFNT 0x00020000 /* has ioctl font support */
-#define CONS_reserved7 0x00040000 /* reserved */
-#define CONS_reserved8 0x00080000 /* reserved */
-#define CONS_USE7BIT 0x00100000 /* does not support 8bit characters */
-#define CONS_USEPC8 0x00200000 /* uses PC8 8-bit mapping */
-#define CONS_USELATIN1 0x00400000 /* uses ISO LATIN1 mapping */
-#define CONS_HAS10646 0x00800000 /* has /dev/unicode */
-#define CONS_PCCONS2 0x01000000 /* modified pccons */
-#define CONS_CODRV1 0x02000000 /* old codrv ioctls */
-#define CONS_CODRV2 0x04000000 /* codrv ioctls 0.1.2 */
-#define CONS_reserved9 0x08000000 /* reserved */
-#define CONS_reserved10 0x10000000 /* reserved */
-#define CONS_reserved11 0x20000000 /* reserved */
-#define CONS_reserved12 0x40000000 /* reserved */
-#define CONS_reserved13 0x80000000 /* reserved */
-
-
-/***************************************************************************
- * IOCTLs for AT Keyboard
- ***************************************************************************/
-
-/**** initializing the keyboard ****/
-
-/* reset keyboard, run selftests and set default values:
- * default keymap, no overloaded keys, default typematic rate
- * KBD_TPD500|KBD_TPM100, repetition on
- */
-#define KBDCOLDRESET _IO('K', 1) /* reset keyboard and set default
- * values:
- * default keymap, no overloaded
- * keys, default typematic rate
- * KBD_TPD500|KBD_TPM100
- */
-/* resets the mode in keyboard controller only */
-#define KBDWARMRESET _IO('K', 23)
-
-
-
-/**** key repetition (typematic) feature ****/
-
-/* get (G) / set (S) key repetition rate and delay
- * see below for a definition of rate and delay and the necessary
- * argument
- */
-#define KBDGTPMAT _IOR('K', 2, int)
-#define KBDSTPMAT _IOW('K', 3, int)
-
-/* Typematic rates:
- * Rate = 1 / Period, with
- * Period = (8+ (Val&7)) * 2^((Val>>3)&3) * 0.00417 seconds,
- * and Val the typematic value below
- *
- * The typematic delay is determined by
- * Delay = (1+((Val>>5)&3)) * 250 msec +/- 20 %
- *
- * Source IBM/AT reference manual, 1987
- *
- * Note that you have to pass one TPD* and one TPM* value to the KBDSTPMAT
- * ioctl: they are different flags of the same data word. Also note that
- * 0x00 is a valid value: KBD_TPD250|KBD_TPM300 which is really fast, instead
- * of turning off key repetition entirely. You can turn off key repetition
- * with the ioctls KBDGREPSW/KBDSREPSW.
-*/
-
-#define KBD_TPD250 0x0000 /* 250 ms */
-#define KBD_TPD500 0x0020 /* 500 ms */
-#define KBD_TPD750 0x0040 /* 750 ms */
-#define KBD_TPD1000 0x0060 /* 1000 ms */
-
-#define KBD_TPM300 0x0000 /* 30.0 rate */
-#define KBD_TPM267 0x0001 /* 26.7 rate */
-#define KBD_TPM240 0x0002 /* 24.0 rate */
-#define KBD_TPM218 0x0003 /* 21.8 rate */
-#define KBD_TPM200 0x0004 /* 20.0 rate */
-#define KBD_TPM185 0x0005 /* 18.5 rate */
-#define KBD_TPM171 0x0006 /* 17.1 rate */
-#define KBD_TPM160 0x0007 /* 16.0 rate */
-#define KBD_TPM150 0x0008 /* 15.0 rate */
-#define KBD_TPM133 0x0009 /* 13.3 rate */
-#define KBD_TPM120 0x000a /* 12.0 rate */
-#define KBD_TPM109 0x000b /* 10.9 rate */
-#define KBD_TPM100 0x000c /* 10.0 rate */
-#define KBD_TPM92 0x000d /* 9.2 rate */
-#define KBD_TPM86 0x000e /* 8.6 rate */
-#define KBD_TPM80 0x000f /* 8.0 rate */
-#define KBD_TPM75 0x0010 /* 7.5 rate */
-#define KBD_TPM67 0x0011 /* 6.7 rate */
-#define KBD_TPM60 0x0012 /* 6.0 rate */
-#define KBD_TPM55 0x0013 /* 5.5 rate */
-#define KBD_TPM50 0x0014 /* 5.0 rate */
-#define KBD_TPM46 0x0015 /* 4.6 rate */
-#define KBD_TPM43 0x0016 /* 4.3 rate */
-#define KBD_TPM40 0x0017 /* 4.0 rate */
-#define KBD_TPM37 0x0018 /* 3.7 rate */
-#define KBD_TPM33 0x0019 /* 3.3 rate */
-#define KBD_TPM30 0x001a /* 3.0 rate */
-#define KBD_TPM27 0x001b /* 2.7 rate */
-#define KBD_TPM25 0x001c /* 2.5 rate */
-#define KBD_TPM23 0x001d /* 2.3 rate */
-#define KBD_TPM21 0x001e /* 2.1 rate */
-#define KBD_TPM20 0x001f /* 2.0 rate */
-
-
-/* get (G) / set (S) the key repetition switch */
-#define KBD_REPEATOFF 0
-#define KBD_REPEATON 1
-#define KBDGREPSW _IOR('K', 4, int)
-#define KBDSREPSW _IOW('K', 5, int)
-
-
-
-/**** handling keyboard LEDS and Lock keys ****/
-
-/* get (G) / set (S) the keyboard LEDs,
- * does not influence the state of the lock keys.
- * Note: if keyboard serves tty console mode (VTYs have keyboard focus),
- * the lock keys will still modify the state when used
- */
-#define KBDGLEDS _IOR('K', 6, int)
-#define KBDSLEDS _IOW('K', 7, int)
-
-/* get (G) / set (S) the SCROLL, NUM, CAPS ALTGRLOCK keys
- * (note: ALTGRLOCK or SHIFTLOCK are not necessarily accessible
- * on your keyboard)
- */
-#define KBD_LOCKSCROLL 0x0001
-#define KBD_LOCKNUM 0x0002
-#define KBD_LOCKCAPS 0x0004
-#define KBD_LOCKALTGR 0x0008
-#define KBD_LOCKSHIFT 0x0010
-#define KBDGLOCK _IOR('K', 8, int)
-#define KBDSLOCK _IOW('K', 9, int)
-
-
-
-/**** making noise ****/
-
-/* get (G) / set (S) the beeper frequency and tone duration
- * the nr param determines the VTY which parameters are changed
- * VTY# = 0...n, n < max_vtys
- * nr = -1: actual vty
- * nr = -2: Set the system default beep frequency
- *
- * in some emulations, you can also set pitch and duration by an ESC code
- */
-#define KBD_ACTVTY -1
-#define KBD_DEFLT -2
-struct kbd_bell {
- int pitch;
- int duration;
- int nr;
-};
-
-#define KBDGETBEEP _IOWR('K',28, struct kbd_bell)
-#define KBDSETBEEP _IOW('K',29, struct kbd_bell)
-
-/* do a beep of specified frequency and duration
- * the argument nr is unused
- * a NULL arg performs a default system beep
- */
-#define KBDBELL _IOW('K',30, struct kbd_bell)
-
-
-
-/**** I/O access ****/
-
-/* This call allows programs to access I/O ports.
- * The ioctl is intended to perform several tasks for the XFree86 Xserver,
- * but currently has other interesting applications. This is why it is
- * priviledged and can only be executed by root (or with setuid-root).
- * In future the ioctl might be restricted to allow access to video ports
- * only.
- */
-#define X_MODE_ON 1
-#define X_MODE_OFF 0
-#define CONSOLE_X_MODE _IOW('K',22,int)
-
-
-/**** keyboard overloading ****/
-
-/* Codrv allows loading of strings to keys in six layers.
- * Any string may have a length of up to KBDMAXOVLKEYSIZE XCHARS.
- * !!! Warning: This ioctl uses the type XCHAR. In future, this may
- * !!! no longer be a char type, so str*** functions might not work any more
- * !!! some day.
- * The available layers are:
- *
- * - unshifted
- * - with shift key
- * - with ctrl key
- * - with meta key (usually ALT-left)
- * - with altgr key (usually ALT-right)
- * - with shift+altgr key
- *
- * There are no combinations: shift-ctrl, ctrl-alt, shift-meta.
- * The combination ctrl-altleft-somekey is reserved for system purposes.
- * These keys are usually processed before the above keys. To gain control
- * over these keys, you must run the keyboard in raw mode (/dev/kbd) and
- * do ALL the processing yourself. The Xserver for instance does it this way.
- * The following special keys are currently defined:
- *
- * CTRL-ALTLEFT-DELETE: Reboot
- * CTRL-ALTLEFT-ESCAPE: Call the debugger (if compiled into the kernel)
- * CTRL-ALTLEFT-KP+: Switch to next resolution (Xserver only)
- * CTRL-ALTLEFT-KP-: Switch to previous resolution (Xserver only)
- */
-
-/* values for type field of various kbd_overload ioctls */
-#define KBD_NONE 0 /* no function, key is disabled */
-#define KBD_SHIFT 1 /* keyboard shift */
-#define KBD_META 2 /* (ALT) alternate shift, sets bit8 to ASCII code */
-#define KBD_NUM 3 /* numeric shift cursors vs. numeric */
-#define KBD_CTL 4 /* control shift -- allows ctl function */
-#define KBD_CAPS 5 /* caps shift -- swaps case of letter */
-#define KBD_ASCII 6 /* ascii code for this key */
-#define KBD_SCROLL 7 /* stop output */
-#define KBD_FUNC 8 /* function key */
-#define KBD_KP 9 /* Keypad keys */
-#define KBD_BREAK 10 /* The damned BREAK key, ignored in ioctl */
-#define KBD_ALTGR 11 /* AltGr Translation feature */
-#define KBD_SHFTLOCK 12 /* some people are accustomed to this nonsense */
-#define KBD_ALTGRLOCK 13 /* Useful for 8-bit national kbds (cyrillic) */
-#define KBD_DOALTCAPS 0x0400 /* change by altgr + caps shift */
-#define KBD_DOCAPS 0x0800 /* change by caps shift */
-#define KBD_DIACPFX 0x4000 /* Key carries a diacritical prefix */
-#define KBD_OVERLOAD 0x8000 /* Key is overloaded, ignored in ioctl */
-#define KBD_MASK 0x001f /* mask for type */
-
-#define KBDMAXOVLKEYSIZE 15 /* excl. zero byte */
-struct kbd_ovlkey {
- u_short keynum;
- u_short type;
- XCHAR unshift[KBDMAXOVLKEYSIZE+1];
- XCHAR shift[KBDMAXOVLKEYSIZE+1];
- XCHAR ctrl[KBDMAXOVLKEYSIZE+1];
- XCHAR meta[KBDMAXOVLKEYSIZE+1];
- XCHAR altgr[KBDMAXOVLKEYSIZE+1];
- XCHAR shiftaltgr[KBDMAXOVLKEYSIZE+1];
-};
-
-
-/* Get (G) / Set (S) a key assignment. This will influence the current
- * key value only
- */
-#define KBDGCKEY _IOWR('K',16, struct kbd_ovlkey)
-#define KBDSCKEY _IOW('K',17, struct kbd_ovlkey)
-
-/* Get (G) the default (old) key assignment. You cannot overwrite the
- * default setting, so this ioctl is unpaired
- */
-#define KBDGOKEY _IOWR('K',18, struct kbd_ovlkey)
-
-
-
-/* Remove a key assignment for a key, i.e. restore default setting for key
- * arg = keynum
- */
-#define KBDRMKEY _IOW('K', 19, int)
-
-/* Restore the default key setting */
-#define KBDDEFAULT _IO('K',20)
-
-
-
-/* Set behavior of unassigned key layers
- * Note that there is a hack from further versions which uses
- * the flags KBD_C0 and KBD_A0 for this. This is still supported, but
- * is not recommended way to do. It may disappear in future
- * (what means that it won't :-))
- */
-#define KBD_CLEARCTRL 2
-#define KBD_CLEARMETA 4
-#define KBD_CLEARALT 1
-#ifdef notyet
- #define KBD_CLEARNORM 8
- #define KBD_CLEARSHIFT 16
- #define KBD_CLEARSHALT 32
-#endif
-#define KBDSCLRLYR _IOW('K',31,int)
-
-/* get (G) / set (S) CAPSLOCK LED behaviour.
- * Not all of this keys may be accessible at your keyboard
- * Note: For compatibility, the S ioctl returns the old state in arg
- */
-#define KBD_CAPSCAPS 0 /* LED follows CAPSLOCK state */
-#define KBD_CAPSSHIFT 1 /* LED follows SHIFTLOCK state */
-#define KBD_CAPSALTGR 2 /* LED follows ALTGRLOCK state */
-#define KBD_CAPSINIT 0x04 /* bit to set to set a default for all VTYs */
-#define KBDGCAPSLED _IOR('K',27,int)
-#define KBDSCAPSLED _IOWR('K',25,int)
-
-/* extended functions: functions that are triggered by a keypress
- * before key is converted to ASCII
- *
- * use function KBD_HOTKEYDELETE to remove a hotkey from a key
- */
-struct kbd_hotkey {
- u_short key;
- u_short modifier;
- u_short function;
-};
-#define KBDGSPECF _IOWR('K',32,struct kbd_hotkey)
-#define KBDSSPECF _IOW('K',33,struct kbd_hotkey)
-
-/* extended function prefixes (in modifier field)
- * bit set triggers a special function on the key layer
- */
-#define KBD_NOEXT 0x00 /* trigger never */
-#define KBD_EXT_N 0x01 /* on normal key (normal layer) */
-#define KBD_EXT_S 0x02 /* on shift key (shift layer) */
-#define KBD_EXT_C 0x04 /* on ctrl key (ctrl layer) */
-#define KBD_EXT_A 0x08 /* on alt key (alt layer) */
-#define KBD_EXT_SK 0x10 /* on syskey (PRINTSCREEN) (Meta Layer) */
-#define KBD_EXT_CA 0x20 /* on ctrl-alt (shift alt layer) */
-
-/* extended functions (in function field) */
-#define KBD_VTY0 0 /* select vty 0 */
-#define KBD_VTY1 1 /* select vty 1 */
-#define KBD_VTY2 2 /* select vty 2 */
-#define KBD_VTY3 3 /* select vty 3 */
-#define KBD_VTY4 4 /* select vty 4 */
-#define KBD_VTY5 5 /* select vty 5 */
-#define KBD_VTY6 6 /* select vty 6 */
-#define KBD_VTY7 7 /* select vty 7 */
-#define KBD_VTY8 8 /* select vty 8 */
-#define KBD_VTY9 9 /* select vty 9 */
-#define KBD_VTY10 10 /* select vty 10 */
-#define KBD_VTY11 11 /* select vty 11 */
-#define KBD_VTYUP 0x80 /* select next vty */
-#define KBD_VTYDOWN 0x81 /* select previous vty */
-#define KBD_RESETKEY 0x82 /* the CTRL-ALT-DEL key (movable) */
-#define KBD_DEBUGKEY 0x83 /* the CTRL-ALT-ESC key (debugger) */
-
-#define KBD_HOTKEYDELETE 0xff /* use to delete a hotkey KBDSSPECF */
-
-
-
-/* These are names used in older versions of keycap/codrv */
-/* do not use the following functions any longer in future */
-#ifdef COMPAT_CO011
-#define KBDRESET KBDCOLDRESET
-#define KBDRESET8042 KBDWARMRESET
-#define KBDFORCEASCII _IOW('K', 24, int) /* no op in codrv-0.1.2 */
-#define KBD_SCROLLLOCK KBD_LOCKSCROLL
-#define KBD_NUMLOCK KBD_LOCKNUM
-#define KBD_CAPSLOCK KBD_LOCKCAPS
-#define KBDASGNLEDS KBDSCAPSLED
-#ifndef KERNEL
-struct kbd_sound {
- int pitch; /* Frequency in Hz */
- int duration; /* Time in msec */
-};
-#endif
-#define KBDSETBELL _IOW('K',21, struct kbd_sound) /* do some music */
-#define OLDKBDSETBEEP _IOW('K',26, struct kbd_sound) /* change beep settings */
-
-struct oldkbd_ovlkey {
- u_short keynum;
- u_short type;
- char unshift[KBDMAXOVLKEYSIZE+1];
- char shift[KBDMAXOVLKEYSIZE+1];
- char ctrl[KBDMAXOVLKEYSIZE+1];
- char altgr[KBDMAXOVLKEYSIZE+1];
-};
-#define OLDKBDGCKEY _IOWR('K',16, struct oldkbd_ovlkey) /* get current key values */
-
-
-
-#endif /*COMPAT_CO011*/
-
-/***************************************************************************
- * IOCTLs for Video Adapter
- ***************************************************************************/
-
-/* to define the cursor shape for ioctl */
-struct cursorshape {
- int start; /* topmost scanline, range 0...31 */
- int end; /* bottom scanline, range 0...31 */
-};
-
-#define VGAGCURSOR _IOR('V',100, struct cursorshape) /* get cursor shape */
-#define VGASCURSOR _IOW('V',101, struct cursorshape) /* set cursor shape */
-
-
-
-/**** information ****/
-
-/* the video information structure for ioctl */
-struct videoinfo {
- char name[20]; /* ASCIZ name of detected card */
- short type; /* Adapter type, see below */
- short subtype; /* Adapter specific subtype */
- short ram; /* in KBytes */
- short iobase; /* Address of 6845: 0x3b0 / 0x3d0 */
-};
-
-/* Get information about the videoboard */
-#define VGAGINFO _IOR('V',102, struct videoinfo)
-
-/* recognized Adapter types */
-#define VG_UNKNOWN 0
-#define VG_MONO 1
-#define VG_CGA 2
-#define VG_EGA 3
-#define VG_VGA 4
-#define VG_CHIPS 5
-/* CHIPS & TECHNOLOGIES has subtypes:
- * 0x10 82c451
- * 0x11 82c452
- * 0x20 82c455
- * 0x30 82c453
- * 0x50 82c455
- */
-#define VG_GENOA 6
-/* GENOA has subtypes:
- * 0x33/0x55 5100-5400, ET3000 based
- * 0x22 6100
- * 0x00 6200,6300
- * 0x11 6400,6600
- */
-#define VG_PARADISE 7
-/* PARADISE has subtypes:
- * 01 PVGA1A,WD90C90
- * 02 WD90C00
- * 03 WD90C10
- * 04 WD90C11
- */
-#define VG_TVGA 8
-/* TVGA has subtypes:
- * 00-02 8800
- * 03 8900B
- * 04 8900C
- * 13 8900C
- * 23 9000
- */
-#define VG_ET3000 9
-#define VG_ET4000 10
-#define VG_VIDEO7 11
-/* VIDEO7 has subtypes:
- * 0x80-0xfe VEGA VGA
- * 0x70-0x7e V7VGA FASTWRITE/VRAM
- * 0x50-0x59 V7VGA version 5
- * 0x41-0x49 1024i
- */
-#define VG_ATI 12
-/* ATI has subtypes:
- * 0x01nn 18800
- * 0x02nn 18800-1
- * 0x03nn 28800-2
- * 0x04nn-05nn
- * with nn:
- * 0x01 VGA WONDER
- * 0x02 EGA WONDER800+
- * 0x03 VGA BASIC 16+
- */
-
-
-
-/**** Screen blanking ****/
-
-/* Get (G) / Set (S) screen blanker timeout (seconds),
- * time=0 disables blanking
- *
- * The blanking state is coded in bits 31 and 30 of word returned by get
- */
-#define VGA_BLANKOFF 0x00000000 /* display is on, no blanking */
-#define VGA_BLANKON 0x40000000 /* display is on, wait for blank */
-#define VGA_BLANKED 0x80000000 /* display is dark */
-#define VGAGBLANK _IOR('V',2,int)
-#define VGASBLANK _IOW('V',3,int)
-
-
-
-/**** Text/Attribute direct access, block move ****/
-
-struct vga_block {
- short mode;
- short pagenum;
- short x0,y0; /* upper left coordinates 0..x-1, 0..y-1 */
- short x1,y1; /* lower right coordinates >= x0,y0 */
- u_char *map; /* must be allocated by user process ! */
-};
-
-/* mode word */
-#define VGA_SCREEN 0x01 /* entire screen, ignore x,y */
-#define VGA_WINDOW 0x02 /* use x,y for a rectangular window */
-#define VGA_TEXT 0x10 /* copy text information only */
-#define VGA_ATTR 0x20 /* copy attribute information only */
-#define VGA_BOTH 0x30 /* copy text and attribute */
-#define VGA_ALL 0x31 /* copy complete screen */
-
-/* Get (G) / Set (S) a rectangular block of screen
- * The virtual screen need not be visible.
- * The buffer must be provided by the user process and must be large enough
- * use VGAGVRES to find out how many bytes
- * pagenum: 0..n, n < max_vty, VTY number
- * -1, actual VTY
- */
-#define VGAGBLOCK _IOWR('V',4,struct vga_block)
-#define VGASBLOCK _IOW('V',5,struct vga_block)
-
-
-
-#define VGA_TXTPAGE0 0
-#define VGA_TXTPAGE1 1
-#ifdef notyet
-#define VGA_GFXPAGE 2
-#endif
-#define VGA_PC8CODING 0x80 /* obsolete ! */
-
-/* maximum dimension of pixels
- * Note: this is the space reserved in the fontchar map, but
- * does not mean, that this resolution is accepted in the current release
- * codrv-0.1.2 accepts 8x16 / "9x16" fonts only
- */
-#define VGA_MAXX 16
-#define VGA_MAXY 16
-
-struct fchar {
- XCHAR encoding; /* encoding of character */
- char _f1_,_f2_,_f3_; /* filler */
- u_char map[VGA_MAXX/8*VGA_MAXY];
-};
-
-struct fmap {
- short page; /* page to load */
- short nr; /* nr of characters to load */
- char x,y; /* x,y pixel width */
- XCHAR start; /* first character in sequence (get only) */
- struct fchar *fntmap; /* allocated by user process */
-};
-
-/* get (G) / set (S) font map. Must provide page,nr,start for get */
-#define VGAGFONTMAP _IOWR('V',6,struct fmap)
-#define VGASFONTMAP _IOW('V',7,struct fmap)
-
-
-
-/* do not use the following functions any longer in future */
-#ifdef COMPAT_CO011
-/* miscellaneous functions: */
-#define VGA_DIS1 1 /* disable font 1 */
-#define VGA_GTENC 2 /* get current encoding */
-#define VGA_SBLANK 3 /* set screen blanking timeout (use VGASBLANK!) */
-#define VGA_GBLANK 4 /* get screen blanking timeout (use VGAGBLANK!) */
-
-struct miscfcns {
- u_char cmd;
- union {
- short enc[2];
- int timeout;
- } u;
-};
-#define VGAMISCFCNS _IOWR('V',107,struct miscfcns) /* misc functions */
-
-
-/* Font mapping this needs at least an EGA card (else EINVAL) */
-#define VGAFNTLATIN1 0x00
-#define VGAFNTEXTEND1 0x01
-#define VGAFNTEXTEND2 0x02
-#define VGAFNTGREEK 0x03
-#define VGAFNTCYRILLIC 0x04
-#define VGAFNTHEBREW 0x05
-#define VGAFNTARABIAN 0x06
-
-#define VGA_FNTNCHARS 256
-#define VGA_FNTCSIZE 15
-
-struct fontchar {
- u_char page; /* which font page */
- u_char idx; /* which char in font page */
- u_char cmap[VGA_FNTCSIZE]; /* character bitmap */
-};
-
-#define OLDVGAGCHAR _IOWR('V',105,struct fontchar) /* get character of font */
-#define OLDVGASCHAR _IOW('V',106,struct fontchar) /* set character in font */
-
-struct fontmap {
- u_char page; /* page to load */
- u_short encoding; /* font encoding */
- u_char map[VGA_FNTNCHARS*VGA_FNTCSIZE];
-};
-
-#define OLDVGAGFNTMAP _IOWR('V',103,struct fontmap) /* get font */
-#define VGAGFNTMAP OLDVGAGFNTMAP
-#define OLDVGASFNTMAP _IOW('V',104,struct fontmap) /* set font */
-#define VGASFNTMAP OLDVGASFNTMAP
-
-#endif
-
-
-
-
-struct textpage {
- u_char pagenum; /* note: only page 0 used by vtys */
-#define VGA_TEXTATTR 0
-#define VGA_TEXTDATA 1
- u_char ad;
-#define VGA_LINES 50 /* only 25 used for now */
-#define VGA_COLUMNS 80
- u_char map[VGA_LINES*VGA_COLUMNS];
-};
-
-#define VGAGPAGE _IOWR('V',108,struct textpage) /* get a data page */
-#define VGASPAGE _IOW('V',109,struct textpage) /* set a data page */
-
-/**** Signalling access ****/
-
-/* Use "take control" in an application program to signal the kernel
- * that the program wants to use video memory (such as Xserver)
- * before the program switches modes
- *
- * Use "give control" to return the control to the kernel. The application
- * should have restored the original state before giving back control.
- * Close /dev/vga also returns control.
- *
- * However, the kernel remains the master in the house, and reserves the right
- * to grab control back at any time. (It usually doesn't).
- *
- */
-#define VGATAKECTRL _IO('V',8)
-#define VGAGIVECTRL _IO('V',9)
-
-/***************************************************************************
- * Pandora's box, don't even think of using the following ioctl's
- * (if you happen to find some; codrv_experimental might not be
- * available at your system)
- ***************************************************************************/
-
-#ifdef PANDORA
-#include "codrv_experimental.h"
-#endif
-
-
-
-/***************************************************************************
- * XFree86 pccons support
- ***************************************************************************/
-
-#ifdef COMPAT_PCCONS
-/* The following calls are special to the old pccons driver and are
- * not understood or supported by codrv.
- * This file serves as a central definition base for these calls
- * in order to avoid defining them in applications that want to
- * use them.
- *
- * One word of warning: There are different purpose tty ioctls
- * with the same encoding, see <sys/ioctl.h>
- * TIOCSDTR = _IO('t', 121)
- * TIOCCBRK = _IO('t', 122)
- *
- */
-#define CONSOLE_X_MODE_ON _IO('t',121)
-#define CONSOLE_X_MODE_OFF _IO('t',122)
-#define CONSOLE_X_BELL _IOW('t',123,int[2])
-#endif /* COMPAT_PCCONS */
-
-#endif /* _IOCTL_PC_H_ */
-
diff --git a/sys/i386/include/pio.h b/sys/i386/include/pio.h
deleted file mode 100644
index ef9aba3..0000000
--- a/sys/i386/include/pio.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1990 Carnegie-Mellon University
- * All rights reserved. The CMU software License Agreement specifies
- * the terms and conditions for use and redistribution.
- *
- * from: Mach, unknown, 386BSD patch kit
- * $Id: pio.h,v 1.2 1993/10/16 14:39:23 rgrimes Exp $
- */
-
-#ifndef _MACHINE_PIO_H_
-#define _MACHINE_PIO_H_ 1
-
-#define inl(y) \
-({ unsigned long _tmp__; \
- asm volatile("inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
- _tmp__; })
-
-#define inw(y) \
-({ unsigned short _tmp__; \
- asm volatile(".byte 0x66; inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
- _tmp__; })
-
-/*
- * only do this if it has not already be defined.. this is a crock for the
- * patch kit for right now. Need to clean up all the inx, outx stuff for
- * 0.1.5 to use 1 common header file, that has Bruces fast mode inb/outb
- * stuff in it. Rgrimes 5/27/93
- */
-#ifndef inb
-#define inb(y) \
-({ unsigned char _tmp__; \
- asm volatile("inb %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
- _tmp__; })
-#endif
-
-
-#define outl(x, y) \
-{ asm volatile("outl %0, %1" : : "a" (y) , "d" ((unsigned short)(x))); }
-
-
-#define outw(x, y) \
-{asm volatile(".byte 0x66; outl %0, %1" : : "a" ((unsigned short)(y)) , "d" ((unsigned short)(x))); }
-
-
-#define outb(x, y) \
-{ asm volatile("outb %0, %1" : : "a" ((unsigned char)(y)) , "d" ((unsigned short)(x))); }
-#endif /* _MACHINE_PIO_H_ */
diff --git a/sys/i386/isa/aha1742.c b/sys/i386/isa/aha1742.c
deleted file mode 100644
index 6b65be5..0000000
--- a/sys/i386/isa/aha1742.c
+++ /dev/null
@@ -1,1273 +0,0 @@
-/*
- * Written by Julian Elischer (julian@tfs.com)
- * for TRW Financial Systems for use under the MACH(2.5) operating system.
- *
- * TRW Financial Systems, in accordance with their agreement with Carnegie
- * Mellon University, makes this software available to CMU to distribute
- * or use in any manner that they see fit as long as this message is kept with
- * the software. For this reason TFS also grants any other persons or
- * organisations permission to use or modify this software.
- *
- * TFS supplies this software to be publicly redistributed
- * on the understanding that TFS is not responsible for the correct
- * functioning of this software in any circumstances.
- *
- * commenced: Sun Sep 27 18:14:01 PDT 1992
- *
- * $Id: aha1742.c,v 1.38 1995/10/28 15:38:42 phk Exp $
- */
-
-#include <sys/types.h>
-
-#ifdef KERNEL /* don't laugh, it compiles as a program too.. look */
-#include "ahb.h"
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/malloc.h>
-#include <sys/buf.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <machine/clock.h>
-#include <i386/isa/isa.h>
-#include <i386/isa/isa_device.h>
-#else
-#define NAHB 1
-#endif /*KERNEL */
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <sys/devconf.h>
-
-/* */
-
-#ifdef KERNEL
-# ifdef DDB
-#define fatal_if_no_DDB()
-# else
-#define fatal_if_no_DDB() panic("panic for historical reasons")
-# endif
-#endif
-
-typedef unsigned long int physaddr;
-#include <sys/kernel.h>
-
-#define KVTOPHYS(x) vtophys(x)
-
-#define AHB_ECB_MAX 32 /* store up to 32ECBs at any one time */
- /* in aha1742 H/W ( Not MAX ? ) */
-#define ECB_HASH_SIZE 32 /* when we have a physical addr. for */
- /* a ecb and need to find the ecb in */
- /* space, look it up in the hash table */
-#define ECB_HASH_SHIFT 9 /* only hash on multiples of 512 */
-#define ECB_HASH(x) ((((long int)(x))>>ECB_HASH_SHIFT) % ECB_HASH_SIZE)
-
-#define AHB_NSEG 33 /* number of dma segments supported */
-
-/*
- * AHA1740 standard EISA Host ID regs (Offset from slot base)
- */
-#define HID0 0xC80 /* 0,1: msb of ID2, 3-7: ID1 */
-#define HID1 0xC81 /* 0-4: ID3, 4-7: LSB ID2 */
-#define HID2 0xC82 /* product, 0=174[20] 1 = 1744 */
-#define HID3 0xC83 /* firmware revision */
-
-#define CHAR1(B1,B2) (((B1>>2) & 0x1F) | '@')
-#define CHAR2(B1,B2) (((B1<<3) & 0x18) | ((B2>>5) & 0x7)|'@')
-#define CHAR3(B1,B2) ((B2 & 0x1F) | '@')
-
-/* AHA1740 EISA board control registers (Offset from slot base) */
-#define EBCTRL 0xC84
-#define CDEN 0x01
-/*
- * AHA1740 EISA board mode registers (Offset from slot base)
- */
-#define PORTADDR 0xCC0
-#define PORTADDR_ENHANCED 0x80
-#define BIOSADDR 0xCC1
-#define INTDEF 0xCC2
-#define SCSIDEF 0xCC3
-#define BUSDEF 0xCC4
-#define RESV0 0xCC5
-#define RESV1 0xCC6
-#define RESV2 0xCC7
-/**** bit definitions for INTDEF ****/
-#define INT9 0x00
-#define INT10 0x01
-#define INT11 0x02
-#define INT12 0x03
-#define INT14 0x05
-#define INT15 0x06
-#define INTHIGH 0x08 /* int high=ACTIVE (else edge) */
-#define INTEN 0x10
-/**** bit definitions for SCSIDEF ****/
-#define HSCSIID 0x0F /* our SCSI ID */
-#define RSTPWR 0x10 /* reset scsi bus on power up or reset */
-/**** bit definitions for BUSDEF ****/
-#define B0uS 0x00 /* give up bus immediatly */
-#define B4uS 0x01 /* delay 4uSec. */
-#define B8uS 0x02
-/*
- * AHA1740 ENHANCED mode mailbox control regs (Offset from slot base)
- */
-#define MBOXOUT0 0xCD0
-#define MBOXOUT1 0xCD1
-#define MBOXOUT2 0xCD2
-#define MBOXOUT3 0xCD3
-
-#define ATTN 0xCD4
-#define G2CNTRL 0xCD5
-#define G2INTST 0xCD6
-#define G2STAT 0xCD7
-
-#define MBOXIN0 0xCD8
-#define MBOXIN1 0xCD9
-#define MBOXIN2 0xCDA
-#define MBOXIN3 0xCDB
-
-#define G2STAT2 0xCDC
-
-/*
- * Bit definitions for the 5 control/status registers
- */
-#define ATTN_TARGET 0x0F
-#define ATTN_OPCODE 0xF0
-#define OP_IMMED 0x10
-#define AHB_TARG_RESET 0x80
-#define OP_START_ECB 0x40
-#define OP_ABORT_ECB 0x50
-
-#define G2CNTRL_SET_HOST_READY 0x20
-#define G2CNTRL_CLEAR_EISA_INT 0x40
-#define G2CNTRL_HARD_RESET 0x80
-
-#define G2INTST_TARGET 0x0F
-#define G2INTST_INT_STAT 0xF0
-#define AHB_ECB_OK 0x10
-#define AHB_ECB_RECOVERED 0x50
-#define AHB_HW_ERR 0x70
-#define AHB_IMMED_OK 0xA0
-#define AHB_ECB_ERR 0xC0
-#define AHB_ASN 0xD0 /* for target mode */
-#define AHB_IMMED_ERR 0xE0
-
-#define G2STAT_BUSY 0x01
-#define G2STAT_INT_PEND 0x02
-#define G2STAT_MBOX_EMPTY 0x04
-
-#define G2STAT2_HOST_READY 0x01
-
-struct ahb_dma_seg {
- physaddr addr;
- long len;
-};
-
-struct ahb_ecb_status {
- u_short status;
-#define ST_DON 0x0001
-#define ST_DU 0x0002
-#define ST_QF 0x0008
-#define ST_SC 0x0010
-#define ST_DO 0x0020
-#define ST_CH 0x0040
-#define ST_INT 0x0080
-#define ST_ASA 0x0100
-#define ST_SNS 0x0200
-#define ST_INI 0x0800
-#define ST_ME 0x1000
-#define ST_ECA 0x4000
- u_char ha_status;
-#define HS_OK 0x00
-#define HS_CMD_ABORTED_HOST 0x04
-#define HS_CMD_ABORTED_ADAPTER 0x05
-#define HS_TIMED_OUT 0x11
-#define HS_HARDWARE_ERR 0x20
-#define HS_SCSI_RESET_ADAPTER 0x22
-#define HS_SCSI_RESET_INCOMING 0x23
- u_char targ_status;
-#define TS_OK 0x00
-#define TS_CHECK_CONDITION 0x02
-#define TS_BUSY 0x08
- u_long resid_count;
- u_long resid_addr;
- u_short addit_status;
- u_char sense_len;
- u_char unused[9];
- u_char cdb[6];
-};
-
-
-struct ecb {
- u_char opcode;
-#define ECB_SCSI_OP 0x01
- u_char:4;
- u_char options:3;
- u_char:1;
- short opt1;
-#define ECB_CNE 0x0001
-#define ECB_DI 0x0080
-#define ECB_SES 0x0400
-#define ECB_S_G 0x1000
-#define ECB_DSB 0x4000
-#define ECB_ARS 0x8000
- short opt2;
-#define ECB_LUN 0x0007
-#define ECB_TAG 0x0008
-#define ECB_TT 0x0030
-#define ECB_ND 0x0040
-#define ECB_DAT 0x0100
-#define ECB_DIR 0x0200
-#define ECB_ST 0x0400
-#define ECB_CHK 0x0800
-#define ECB_REC 0x4000
-#define ECB_NRB 0x8000
- u_short unused1;
- physaddr data;
- u_long datalen;
- physaddr status;
- physaddr chain;
- short unused2;
- short unused3;
- physaddr sense;
- u_char senselen;
- u_char cdblen;
- short cksum;
- u_char cdb[12];
- /*-----------------end of hardware supported fields----------------*/
- struct ecb *next; /* in free list */
- struct scsi_xfer *xs; /* the scsi_xfer for this cmd */
- int flags;
-#define ECB_FREE 0
-#define ECB_ACTIVE 1
-#define ECB_ABORTED 2
-#define ECB_IMMED 4
-#define ECB_IMMED_FAIL 8
- struct ahb_dma_seg ahb_dma[AHB_NSEG];
- struct ahb_ecb_status ecb_status;
- struct scsi_sense_data ecb_sense;
- struct ecb *nexthash;
- physaddr hashkey; /* physaddr of this struct */
-};
-
-struct ahb_data {
- int flags;
-#define AHB_INIT 0x01;
- int baseport;
- struct ecb *ecbhash[ECB_HASH_SIZE];
- struct ecb *free_ecb;
- int our_id; /* our scsi id */
- int vect;
- struct ecb *immed_ecb; /* an outstanding immediete command */
- struct scsi_link sc_link;
- int numecbs;
-} *ahbdata[NAHB];
-
-static int ahbprobe();
-static int ahbprobe1 __P((struct isa_device *dev));
-static int ahb_attach();
-static int ahb_init __P((int unit));
-static int32 ahb_scsi_cmd();
-static timeout_t ahb_timeout;
-static void ahb_done();
-static struct ecb *cheat;
-static void ahb_free_ecb();
-static void ahbminphys();
-static struct ecb *ahb_ecb_phys_kv();
-static u_int32 ahb_adapter_info();
-
-#define EISA_MAX_SLOTS 16 /* XXX This should go into a comon header */
-static int ahb_slot = 0; /* slot last board was found in */
-static int ahb_unit = 0;
-static int ahb_debug = 0;
-#define AHB_SHOWECBS 0x01
-#define AHB_SHOWINTS 0x02
-#define AHB_SHOWCMDS 0x04
-#define AHB_SHOWMISC 0x08
-#define FAIL 1
-#define SUCCESS 0
-#define PAGESIZ 4096
-
-#ifdef KERNEL
-struct isa_driver ahbdriver =
-{
- ahbprobe,
- ahb_attach,
- "ahb"
-};
-
-static struct scsi_adapter ahb_switch =
-{
- ahb_scsi_cmd,
- ahbminphys,
- 0,
- 0,
- ahb_adapter_info,
- "ahb",
- { 0, 0 }
-};
-
-/* the below structure is so we have a default dev struct for our link struct */
-static struct scsi_device ahb_dev =
-{
- NULL, /* Use default error handler */
- NULL, /* have a queue, served by this */
- NULL, /* have no async handler */
- NULL, /* Use default 'done' routine */
- "ahb",
- 0,
- { 0, 0 }
-};
-
-static struct kern_devconf kdc_ahb[NAHB] = { {
- 0, 0, 0, /* filled in by dev_attach */
- "ahb", 0, { MDDT_ISA, 0, "bio" },
- isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
- &kdc_isa0, /* parent */
- 0, /* parentdata */
- DC_UNCONFIGURED, /* always start out here in probe */
- "Adaptec 174x-series SCSI host adapter",
- DC_CLS_MISC /* host adapters aren't special */
-} };
-
-static inline void
-ahb_registerdev(struct isa_device *id)
-{
- if(id->id_unit)
- kdc_ahb[id->id_unit] = kdc_ahb[0];
- kdc_ahb[id->id_unit].kdc_unit = id->id_unit;
- kdc_ahb[id->id_unit].kdc_parentdata = id;
- dev_attach(&kdc_ahb[id->id_unit]);
-}
-
-#endif /*KERNEL */
-
-#ifndef KERNEL
-main()
-{
- printf("ahb_data size is %d\n", sizeof(struct ahb_data));
- printf("ecb size is %d\n", sizeof(struct ecb));
-}
-
-#else /*KERNEL */
-
-/*
- * Function to send a command out through a mailbox
- */
-static void
-ahb_send_mbox(int unit, int opcode, int target, struct ecb *ecb)
-{
- int port = ahbdata[unit]->baseport;
- int wait = 300; /* 3ms should be enough */
- int stport = port + G2STAT;
- int s = splbio();
-
- while (--wait) {
- if ((inb(stport) & (G2STAT_BUSY | G2STAT_MBOX_EMPTY))
- == (G2STAT_MBOX_EMPTY))
- break;
- DELAY(10);
- }
- if (wait == 0) {
- printf("ahb%d: board not responding\n", unit);
- Debugger("aha1742");
- fatal_if_no_DDB();
- }
- outl(port + MBOXOUT0, KVTOPHYS(ecb)); /* don't know this will work */
- outb(port + ATTN, opcode | target);
-
- splx(s);
-}
-
-/*
- * Function to poll for command completion when in poll mode
- */
-static int
-ahb_poll(int unit, int wait)
-{ /* in msec */
- struct ahb_data *ahb = ahbdata[unit];
- int port = ahb->baseport;
- int stport = port + G2STAT;
-
- retry:
- while (--wait) {
- if (inb(stport) & G2STAT_INT_PEND)
- break;
- DELAY(1000);
- } if (wait == 0) {
- printf("ahb%d: board not responding\n", unit);
- return (EIO);
- }
- if (cheat != ahb_ecb_phys_kv(ahb, inl(port + MBOXIN0))) {
- printf("discarding 0x%lx ", inl(port + MBOXIN0));
- outb(port + G2CNTRL, G2CNTRL_CLEAR_EISA_INT);
- DELAY(50000);
- goto retry;
- }
- /* don't know this will work */
- ahbintr(unit);
- return (0);
-}
-
-/*
- * Function to send an immediate type command to the adapter
- */
-static void
-ahb_send_immed(int unit, int target, u_long cmd)
-{
- int port = ahbdata[unit]->baseport;
- int s = splbio();
- int stport = port + G2STAT;
- int wait = 100; /* 1 ms enough? */
-
- while (--wait) {
- if ((inb(stport) & (G2STAT_BUSY | G2STAT_MBOX_EMPTY))
- == (G2STAT_MBOX_EMPTY))
- break;
- DELAY(10);
- } if (wait == 0) {
- printf("ahb%d: board not responding\n", unit);
- Debugger("aha1742");
- fatal_if_no_DDB();
- }
- outl(port + MBOXOUT0, cmd); /* don't know this will work */
- outb(port + G2CNTRL, G2CNTRL_SET_HOST_READY);
- outb(port + ATTN, OP_IMMED | target);
- splx(s);
-}
-
-/*
- * Check the slots looking for a board we recognise
- * If we find one, note it's address (slot) and call
- * the actual probe routine to check it out.
- */
-static int
-ahbprobe(dev)
- struct isa_device *dev;
-{
- int port;
- u_char byte1, byte2, byte3;
-
- ahb_slot++;
- while (ahb_slot < EISA_MAX_SLOTS) {
- port = 0x1000 * ahb_slot;
- byte1 = inb(port + HID0);
- byte2 = inb(port + HID1);
- byte3 = inb(port + HID2);
- if (byte1 == 0xff) {
- ahb_slot++;
- continue;
- }
- if ((CHAR1(byte1, byte2) == 'A')
- && (CHAR2(byte1, byte2) == 'D')
- && (CHAR3(byte1, byte2) == 'P')
- && ((byte3 == 0) || (byte3 == 1))) {
- dev->id_iobase = port;
- return ahbprobe1(dev);
- }
- ahb_slot++;
- }
- return 0;
-}
-
-/*
- * Check if the device can be found at the port given
- * and if so, set it up ready for further work
- * as an argument, takes the isa_device structure from
- * autoconf.c.
- */
-static int
-ahbprobe1(dev)
- struct isa_device *dev;
-{
- /*
- * find unit and check we have that many defined
- */
- int unit = ahb_unit;
- struct ahb_data *ahb;
-
- if (unit >= NAHB) {
- printf("ahb: unit number (%d) too high\n", unit);
- return 0;
- }
- dev->id_unit = unit;
-
- /*
- * Allocate a storage area for us
- */
- if (ahbdata[unit]) {
- printf("ahb%d: memory already allocated\n", unit);
- return 0;
- }
- ahb = malloc(sizeof(struct ahb_data), M_TEMP, M_NOWAIT);
- if (!ahb) {
- printf("ahb%d: cannot malloc!\n", unit);
- return 0;
- }
- bzero(ahb, sizeof(struct ahb_data));
- ahbdata[unit] = ahb;
- ahb->baseport = dev->id_iobase;
-#ifndef DEV_LKM
- ahb_registerdev(dev);
-#endif /* DEV_LKM */
-
- /*
- * Try initialise a unit at this location
- * sets up dma and bus speed, loads ahb->vect
- */
- if (ahb_init(unit) != 0) {
- ahbdata[unit] = NULL;
- free(ahb, M_TEMP);
- return (0);
- }
- /*
- * If it's there, put in it's interrupt vectors
- */
- dev->id_irq = (1 << ahb->vect);
- dev->id_drq = -1; /* use EISA dma */
-
- ahb_unit++;
- return IO_EISASIZE;
-}
-
-/*
- * Attach all the sub-devices we can find
- */
-static int
-ahb_attach(dev)
- struct isa_device *dev;
-{
- int unit = dev->id_unit;
- struct ahb_data *ahb = ahbdata[unit];
- struct scsibus_data *scbus;
-
- /*
- * fill in the prototype scsi_link.
- */
- ahb->sc_link.adapter_unit = unit;
- ahb->sc_link.adapter_targ = ahb->our_id;
- ahb->sc_link.adapter = &ahb_switch;
- ahb->sc_link.device = &ahb_dev;
-
- /*
- * Prepare the scsibus_data area for the upperlevel
- * scsi code.
- */
- scbus = scsi_alloc_bus();
- if(!scbus)
- return 0;
- scbus->adapter_link = &ahb->sc_link;
-
- kdc_ahb[unit].kdc_state = DC_BUSY; /* host adapters are always busy */
- /*
- * ask the adapter what subunits are present
- */
- scsi_attachdevs(scbus);
-
- return 1;
-}
-
-/*
- * Return some information to the caller about
- * the adapter and it's capabilities
- */
-static u_int32
-ahb_adapter_info(unit)
- int unit;
-{
- return (2); /* 2 outstanding requests at a time per device */
-}
-
-/*
- * Catch an interrupt from the adaptor
- */
-void
-ahbintr(unit)
- int unit;
-{
- struct ecb *ecb;
- unsigned char stat;
- u_char ahbstat;
- int target;
- long int mboxval;
- struct ahb_data *ahb = ahbdata[unit];
-
- int port = ahb->baseport;
-
-#ifdef AHBDEBUG
- printf("ahbintr ");
-#endif /*AHBDEBUG */
-
- while (inb(port + G2STAT) & G2STAT_INT_PEND) {
- /*
- * First get all the information and then
- * acknowlege the interrupt
- */
- ahbstat = inb(port + G2INTST);
- target = ahbstat & G2INTST_TARGET;
- stat = ahbstat & G2INTST_INT_STAT;
- mboxval = inl(port + MBOXIN0); /* don't know this will work */
- outb(port + G2CNTRL, G2CNTRL_CLEAR_EISA_INT);
-#ifdef AHBDEBUG
- printf("status = 0x%x ", stat);
-#endif /*AHBDEBUG */
- /*
- * Process the completed operation
- */
-
- if (stat == AHB_ECB_OK) { /* common case is fast */
- ecb = ahb_ecb_phys_kv(ahb, mboxval);
- } else {
- switch (stat) {
- case AHB_IMMED_OK:
- ecb = ahb->immed_ecb;
- ahb->immed_ecb = 0;
- break;
- case AHB_IMMED_ERR:
- ecb = ahb->immed_ecb;
- ecb->flags |= ECB_IMMED_FAIL;
- ahb->immed_ecb = 0;
- break;
- case AHB_ASN: /* for target mode */
- printf("ahb%d: "
- "Unexpected ASN interrupt(0x%lx)\n",
- unit, mboxval);
- ecb = 0;
- break;
- case AHB_HW_ERR:
- printf("ahb%d: "
- "Hardware error interrupt(0x%lx)\n",
- unit, mboxval);
- ecb = 0;
- break;
- case AHB_ECB_RECOVERED:
- ecb = ahb_ecb_phys_kv(ahb, mboxval);
- break;
- case AHB_ECB_ERR:
- ecb = ahb_ecb_phys_kv(ahb, mboxval);
- break;
- default:
- printf(" Unknown return from ahb%d(%x)\n", unit, ahbstat);
- ecb = 0;
- }
- } if (ecb) {
-#ifdef AHBDEBUG
- if (ahb_debug & AHB_SHOWCMDS) {
- show_scsi_cmd(ecb->xs);
- }
- if ((ahb_debug & AHB_SHOWECBS) && ecb)
- printf("<int ecb(%x)>", ecb);
-#endif /*AHBDEBUG */
- untimeout(ahb_timeout, (caddr_t)ecb);
- ahb_done(unit, ecb, ((stat == AHB_ECB_OK) ? SUCCESS : FAIL));
- }
- }
-}
-
-/*
- * We have a ecb which has been processed by the
- * adaptor, now we look to see how the operation
- * went.
- */
-static void
-ahb_done(unit, ecb, state)
- int unit, state;
- struct ecb *ecb;
-{
- struct ahb_ecb_status *stat = &ecb->ecb_status;
- struct scsi_sense_data *s1, *s2;
- struct scsi_xfer *xs = ecb->xs;
-
- SC_DEBUG(xs->sc_link, SDEV_DB2, ("ahb_done\n"));
- /*
- * Otherwise, put the results of the operation
- * into the xfer and call whoever started it
- */
- if (ecb->flags & ECB_IMMED) {
- if (ecb->flags & ECB_IMMED_FAIL) {
- xs->error = XS_DRIVER_STUFFUP;
- }
- goto done;
- }
- if ((state == SUCCESS) || (xs->flags & SCSI_ERR_OK)) { /* All went correctly OR errors expected */
- xs->resid = 0;
- xs->error = 0;
- } else {
-
- s1 = &(ecb->ecb_sense);
- s2 = &(xs->sense);
-
- if (stat->ha_status) {
- switch (stat->ha_status) {
- case HS_SCSI_RESET_ADAPTER:
- break;
- case HS_SCSI_RESET_INCOMING:
- break;
- case HS_CMD_ABORTED_HOST: /* No response */
- case HS_CMD_ABORTED_ADAPTER: /* No response */
- break;
- case HS_TIMED_OUT: /* No response */
-#ifdef AHBDEBUG
- if (ahb_debug & AHB_SHOWMISC) {
- printf("timeout reported back\n");
- }
-#endif /*AHBDEBUG */
- xs->error = XS_TIMEOUT;
- break;
- default: /* Other scsi protocol messes */
- xs->error = XS_DRIVER_STUFFUP;
-#ifdef AHBDEBUG
- if (ahb_debug & AHB_SHOWMISC) {
- printf("unexpected ha_status: %x\n",
- stat->ha_status);
- }
-#endif /*AHBDEBUG */
- }
- } else {
- switch (stat->targ_status) {
- case TS_CHECK_CONDITION:
- /* structure copy!!!!! */
- *s2 = *s1;
- xs->error = XS_SENSE;
- break;
- case TS_BUSY:
- xs->error = XS_BUSY;
- break;
- default:
-#ifdef AHBDEBUG
- if (ahb_debug & AHB_SHOWMISC) {
- printf("unexpected targ_status: %x\n",
- stat->targ_status);
- }
-#endif /*AHBDEBUG */
- xs->error = XS_DRIVER_STUFFUP;
- }
- }
- }
-done: xs->flags |= ITSDONE;
- ahb_free_ecb(unit, ecb, xs->flags);
- scsi_done(xs);
-}
-
-/*
- * A ecb (and hence a mbx-out is put onto the
- * free list.
- */
-static void
-ahb_free_ecb(unit, ecb, flags)
- int unit, flags;
- struct ecb *ecb;
-{
- unsigned int opri = 0;
- struct ahb_data *ahb = ahbdata[unit];
-
- if (!(flags & SCSI_NOMASK))
- opri = splbio();
-
- ecb->next = ahb->free_ecb;
- ahb->free_ecb = ecb;
- ecb->flags = ECB_FREE;
- /*
- * If there were none, wake abybody waiting for
- * one to come free, starting with queued entries
- */
- if (!ecb->next) {
- wakeup((caddr_t)&ahb->free_ecb);
- }
- if (!(flags & SCSI_NOMASK))
- splx(opri);
-}
-
-/*
- * Get a free ecb
- * If there are none, see if we can allocate a
- * new one. If so, put it in the hash table too
- * otherwise either return an error or sleep
- */
-static struct ecb *
-ahb_get_ecb(unit, flags)
- int unit, flags;
-{
- struct ahb_data *ahb = ahbdata[unit];
- unsigned opri = 0;
- struct ecb *ecbp;
- int hashnum;
-
- if (!(flags & SCSI_NOMASK))
- opri = splbio();
- /*
- * If we can and have to, sleep waiting for one to come free
- * but only if we can't allocate a new one.
- */
- while (!(ecbp = ahb->free_ecb)) {
- if (ahb->numecbs < AHB_ECB_MAX) {
- ecbp = (struct ecb *) malloc(sizeof(struct ecb),
- M_TEMP,
- M_NOWAIT);
- if (ecbp) {
- bzero(ecbp, sizeof(struct ecb));
- ahb->numecbs++;
- ecbp->flags = ECB_ACTIVE;
- /*
- * put in the phystokv hash table
- * Never gets taken out.
- */
- ecbp->hashkey = KVTOPHYS(ecbp);
- hashnum = ECB_HASH(ecbp->hashkey);
- ecbp->nexthash = ahb->ecbhash[hashnum];
- ahb->ecbhash[hashnum] = ecbp;
- } else {
- printf("ahb%d: Can't malloc ECB\n", unit);
- } goto gottit;
- } else {
- if (!(flags & SCSI_NOSLEEP)) {
- tsleep((caddr_t)&ahb->free_ecb, PRIBIO,
- "ahbecb", 0);
- }
- }
- } if (ecbp) {
- /* Get ECB from from free list */
- ahb->free_ecb = ecbp->next;
- ecbp->flags = ECB_ACTIVE;
- }
-gottit: if (!(flags & SCSI_NOMASK))
- splx(opri);
-
- return (ecbp);
-}
-
-/*
- * given a physical address, find the ecb that
- * it corresponds to:
- */
-static struct ecb *
-ahb_ecb_phys_kv(ahb, ecb_phys)
- struct ahb_data *ahb;
- physaddr ecb_phys;
-{
- int hashnum = ECB_HASH(ecb_phys);
- struct ecb *ecbp = ahb->ecbhash[hashnum];
-
- while (ecbp) {
- if (ecbp->hashkey == ecb_phys)
- break;
- ecbp = ecbp->nexthash;
- }
- return ecbp;
-}
-
-/*
- * Start the board, ready for normal operation
- */
-static int
-ahb_init(unit)
- int unit;
-{
- struct ahb_data *ahb = ahbdata[unit];
- int port = ahb->baseport;
- int intdef;
- int wait = 1000; /* 1 sec enough? */
- int i;
- int stport = port + G2STAT;
-#define NO_NO 1
-#ifdef NO_NO
- /*
- * reset board, If it doesn't respond, assume
- * that it's not there.. good for the probe
- */
- outb(port + EBCTRL, CDEN); /* enable full card */
- outb(port + PORTADDR, PORTADDR_ENHANCED);
-
- outb(port + G2CNTRL, G2CNTRL_HARD_RESET);
- DELAY(1000);
- outb(port + G2CNTRL, 0);
- DELAY(10000);
- while (--wait) {
- if ((inb(stport) & G2STAT_BUSY) == 0)
- break;
- DELAY(1000);
- } if (wait == 0) {
-#ifdef AHBDEBUG
- if (ahb_debug & AHB_SHOWMISC)
- printf("ahb_init: No answer from aha1742 board\n");
-#endif /*AHBDEBUG */
- return (ENXIO);
- }
- i = inb(port + MBOXIN0) & 0xff;
- if (i) {
- printf("self test failed, val = 0x%x\n", i);
- return (EIO);
- }
-#endif
- while (inb(stport) & G2STAT_INT_PEND) {
- printf(".");
- outb(port + G2CNTRL, G2CNTRL_CLEAR_EISA_INT);
- DELAY(10000);
- }
- outb(port + EBCTRL, CDEN); /* enable full card */
- outb(port + PORTADDR, PORTADDR_ENHANCED);
- /*
- * Assume we have a board at this stage
- * setup dma channel from jumpers and save int
- * level
- */
- printf("ahb%d: reading board settings, ", unit);
-
- intdef = inb(port + INTDEF);
- switch (intdef & 0x07) {
- case INT9:
- ahb->vect = 9;
- break;
- case INT10:
- ahb->vect = 10;
- break;
- case INT11:
- ahb->vect = 11;
- break;
- case INT12:
- ahb->vect = 12;
- break;
- case INT14:
- ahb->vect = 14;
- break;
- case INT15:
- ahb->vect = 15;
- break;
- default:
- printf("illegal int setting\n");
- return (EIO);
- }
- printf("int=%d\n", ahb->vect);
-
- outb(port + INTDEF, (intdef | INTEN)); /* make sure we can interrupt */
-
- /* who are we on the scsi bus? */
- ahb->our_id = (inb(port + SCSIDEF) & HSCSIID);
-
- /*
- * Note that we are going and return (to probe)
- */
- ahb->flags |= AHB_INIT;
- return (0);
-}
-
-#ifndef min
-#define min(x,y) (x < y ? x : y)
-#endif /* min */
-
-static void
-ahbminphys(bp)
- struct buf *bp;
-{
- if (bp->b_bcount > ((AHB_NSEG - 1) * PAGESIZ)) {
- bp->b_bcount = ((AHB_NSEG - 1) * PAGESIZ);
- }
-}
-
-/*
- * start a scsi operation given the command and
- * the data address. Also needs the unit, target
- * and lu
- */
-static int32
-ahb_scsi_cmd(xs)
- struct scsi_xfer *xs;
-{
- struct ecb *ecb;
- struct ahb_dma_seg *sg;
- int seg; /* scatter gather seg being worked on */
- int thiskv;
- physaddr thisphys, nextphys;
- int unit = xs->sc_link->adapter_unit;
- int bytes_this_seg, bytes_this_page, datalen, flags;
- struct ahb_data *ahb = ahbdata[unit];
- int s;
-
- SC_DEBUG(xs->sc_link, SDEV_DB2, ("ahb_scsi_cmd\n"));
- /*
- * get a ecb (mbox-out) to use. If the transfer
- * is from a buf (possibly from interrupt time)
- * then we can't allow it to sleep
- */
- flags = xs->flags;
- if (xs->bp)
- flags |= (SCSI_NOSLEEP); /* just to be sure */
- if (flags & ITSDONE) {
- printf("ahb%d: Already done?", unit);
- xs->flags &= ~ITSDONE;
- }
- if (!(flags & INUSE)) {
- printf("ahb%d: Not in use?", unit);
- xs->flags |= INUSE;
- }
- if (!(ecb = ahb_get_ecb(unit, flags))) {
- xs->error = XS_DRIVER_STUFFUP;
- return (TRY_AGAIN_LATER);
- }
- cheat = ecb;
- SC_DEBUG(xs->sc_link, SDEV_DB3, ("start ecb(%p)\n", ecb));
- ecb->xs = xs;
- /*
- * If it's a reset, we need to do an 'immediate'
- * command, and store it's ecb for later
- * if there is already an immediate waiting,
- * then WE must wait
- */
- if (flags & SCSI_RESET) {
- ecb->flags |= ECB_IMMED;
- if (ahb->immed_ecb) {
- return (TRY_AGAIN_LATER);
- }
- ahb->immed_ecb = ecb;
- if (!(flags & SCSI_NOMASK)) {
- s = splbio();
- ahb_send_immed(unit, xs->sc_link->target, AHB_TARG_RESET);
- timeout(ahb_timeout, (caddr_t)ecb, (xs->timeout * hz) / 1000);
- splx(s);
- return (SUCCESSFULLY_QUEUED);
- } else {
- ahb_send_immed(unit, xs->sc_link->target, AHB_TARG_RESET);
- /*
- * If we can't use interrupts, poll on completion
- */
- SC_DEBUG(xs->sc_link, SDEV_DB3, ("wait\n"));
- if (ahb_poll(unit, xs->timeout)) {
- ahb_free_ecb(unit, ecb, flags);
- xs->error = XS_TIMEOUT;
- return (HAD_ERROR);
- }
- return (COMPLETE);
- }
- }
- /*
- * Put all the arguments for the xfer in the ecb
- */
- ecb->opcode = ECB_SCSI_OP;
- ecb->opt1 = ECB_SES | ECB_DSB | ECB_ARS;
- if (xs->datalen) {
- ecb->opt1 |= ECB_S_G;
- }
- ecb->opt2 = xs->sc_link->lun | ECB_NRB;
- ecb->cdblen = xs->cmdlen;
- ecb->sense = KVTOPHYS(&(ecb->ecb_sense));
- ecb->senselen = sizeof(ecb->ecb_sense);
- ecb->status = KVTOPHYS(&(ecb->ecb_status));
-
- if (xs->datalen) { /* should use S/G only if not zero length */
- ecb->data = KVTOPHYS(ecb->ahb_dma);
- sg = ecb->ahb_dma;
- seg = 0;
-#ifdef TFS
- if (flags & SCSI_DATA_UIO) {
- iovp = ((struct uio *) xs->data)->uio_iov;
- datalen = ((struct uio *) xs->data)->uio_iovcnt;
- xs->datalen = 0;
- while ((datalen) && (seg < AHB_NSEG)) {
- sg->addr = (physaddr) iovp->iov_base;
- xs->datalen += sg->len = iovp->iov_len;
- SC_DEBUGN(xs->sc_link, SDEV_DB4,
- ("(0x%x@0x%x)", iovp->iov_len
- ,iovp->iov_base));
- sg++;
- iovp++;
- seg++;
- datalen--;
- }
- }
- else
-#endif /*TFS */
- {
- /*
- * Set up the scatter gather block
- */
-
- SC_DEBUG(xs->sc_link, SDEV_DB4,
- ("%ld @%p:- ", xs->datalen, xs->data));
- datalen = xs->datalen;
- thiskv = (int) xs->data;
- thisphys = KVTOPHYS(thiskv);
-
- while ((datalen) && (seg < AHB_NSEG)) {
- bytes_this_seg = 0;
-
- /* put in the base address */
- sg->addr = thisphys;
-
- SC_DEBUGN(xs->sc_link, SDEV_DB4, ("0x%lx",
- thisphys));
-
- /* do it at least once */
- nextphys = thisphys;
- while ((datalen) && (thisphys == nextphys)) {
- /*
- * This page is contiguous (physically) with
- * the the last, just extend the length
- */
- /* how far to the end of the page */
- nextphys = (thisphys & (~(PAGESIZ - 1)))
- + PAGESIZ;
- bytes_this_page = nextphys - thisphys;
- /**** or the data ****/
- bytes_this_page = min(bytes_this_page
- ,datalen);
- bytes_this_seg += bytes_this_page;
- datalen -= bytes_this_page;
-
- /* get more ready for the next page */
- thiskv = (thiskv & (~(PAGESIZ - 1)))
- + PAGESIZ;
- if (datalen)
- thisphys = KVTOPHYS(thiskv);
- }
- /*
- * next page isn't contiguous, finish the seg
- */
- SC_DEBUGN(xs->sc_link, SDEV_DB4,
- ("(0x%x)", bytes_this_seg));
- sg->len = bytes_this_seg;
- sg++;
- seg++;
- }
- } /*end of iov/kv decision */
- ecb->datalen = seg * sizeof(struct ahb_dma_seg);
- SC_DEBUGN(xs->sc_link, SDEV_DB4, ("\n"));
- if (datalen) { /* there's still data, must have run out of segs! */
- printf("ahb_scsi_cmd%d: more than %d DMA segs\n",
- unit, AHB_NSEG);
- xs->error = XS_DRIVER_STUFFUP;
- ahb_free_ecb(unit, ecb, flags);
- return (HAD_ERROR);
- }
- } else { /* No data xfer, use non S/G values */
- ecb->data = (physaddr) 0;
- ecb->datalen = 0;
- } ecb->chain = (physaddr) 0;
- /*
- * Put the scsi command in the ecb and start it
- */
- bcopy(xs->cmd, ecb->cdb, xs->cmdlen);
- /*
- * Usually return SUCCESSFULLY QUEUED
- */
- if (!(flags & SCSI_NOMASK)) {
- s = splbio();
- ahb_send_mbox(unit, OP_START_ECB, xs->sc_link->target, ecb);
- timeout(ahb_timeout, (caddr_t)ecb, (xs->timeout * hz) / 1000);
- splx(s);
- SC_DEBUG(xs->sc_link, SDEV_DB3, ("cmd_sent\n"));
- return (SUCCESSFULLY_QUEUED);
- }
- /*
- * If we can't use interrupts, poll on completion
- */
- ahb_send_mbox(unit, OP_START_ECB, xs->sc_link->target, ecb);
- SC_DEBUG(xs->sc_link, SDEV_DB3, ("cmd_wait\n"));
- do {
- if (ahb_poll(unit, xs->timeout)) {
- if (!(xs->flags & SCSI_SILENT))
- printf("cmd fail\n");
- ahb_send_mbox(unit, OP_ABORT_ECB, xs->sc_link->target, ecb);
- if (ahb_poll(unit, 2000)) {
- printf("abort failed in wait\n");
- ahb_free_ecb(unit, ecb, flags);
- }
- xs->error = XS_DRIVER_STUFFUP;
- return (HAD_ERROR);
- }
- } while (!(xs->flags & ITSDONE)); /* something (?) else finished */
- if (xs->error) {
- return (HAD_ERROR);
- }
- return (COMPLETE);
-}
-
-static void
-ahb_timeout(void *arg1)
-{
- struct ecb * ecb = (struct ecb *)arg1;
- int unit;
- struct ahb_data *ahb;
- int s = splbio();
-
- unit = ecb->xs->sc_link->adapter_unit;
- ahb = ahbdata[unit];
- printf("ahb%d:%d:%d (%s%d) timed out ", unit
- ,ecb->xs->sc_link->target
- ,ecb->xs->sc_link->lun
- ,ecb->xs->sc_link->device->name
- ,ecb->xs->sc_link->dev_unit);
-
-#ifdef AHBDEBUG
- if (ahb_debug & AHB_SHOWECBS)
- ahb_print_active_ecb(unit);
-#endif /*AHBDEBUG */
-
- /*
- * If it's immediate, don't try abort it
- */
- if (ecb->flags & ECB_IMMED) {
- ecb->xs->retries = 0; /* I MEAN IT ! */
- ecb->flags |= ECB_IMMED_FAIL;
- ahb_done(unit, ecb, FAIL);
- splx(s);
- return;
- }
- /*
- * If it has been through before, then
- * a previous abort has failed, don't
- * try abort again
- */
- if (ecb->flags == ECB_ABORTED) {
- /*
- * abort timed out
- */
- printf("AGAIN");
- ecb->xs->retries = 0; /* I MEAN IT ! */
- ecb->ecb_status.ha_status = HS_CMD_ABORTED_HOST;
- ahb_done(unit, ecb, FAIL);
- } else { /* abort the operation that has timed out */
- printf("\n");
- ahb_send_mbox(unit, OP_ABORT_ECB, ecb->xs->sc_link->target, ecb);
- /* 2 secs for the abort */
- timeout(ahb_timeout, (caddr_t)ecb, 2 * hz);
- ecb->flags = ECB_ABORTED;
- }
- splx(s);
-}
-
-#ifdef AHBDEBUG
-static void
-ahb_print_ecb(ecb)
- struct ecb *ecb;
-{
- printf("ecb:%x op:%x cmdlen:%d senlen:%d\n"
- ,ecb
- ,ecb->opcode
- ,ecb->cdblen
- ,ecb->senselen);
- printf(" datlen:%d hstat:%x tstat:%x flags:%x\n"
- ,ecb->datalen
- ,ecb->ecb_status.ha_status
- ,ecb->ecb_status.targ_status
- ,ecb->flags);
- show_scsi_cmd(ecb->xs);
-}
-
-static void
-ahb_print_active_ecb(int unit)
-{
- struct ahb_data *ahb = ahbdata[unit];
- struct ecb *ecb;
- int i = 0;
-
- while (i < ECB_HASH_SIZE) {
- ecb = ahb->ecbhash[i];
- while (ecb) {
- if (ecb->flags != ECB_FREE) {
- ahb_print_ecb(ecb);
- }
- ecb = ecb->nexthash;
- } i++;
- }
-}
-#endif /*AHBDEBUG */
-#endif /*KERNEL */
diff --git a/sys/i386/isa/aha2742.c b/sys/i386/isa/aha2742.c
deleted file mode 100644
index 81c46dc..0000000
--- a/sys/i386/isa/aha2742.c
+++ /dev/null
@@ -1,1710 +0,0 @@
-/*
- * Driver for the 27/284X series adaptec SCSI controllers written by
- * Justin T. Gibbs. Much of this driver was taken from Julian Elischer's
- * 1742 driver, so it bears his copyright.
- *
- * Written by Julian Elischer (julian@tfs.com)
- * for TRW Financial Systems for use under the MACH(2.5) operating system.
- *
- * TRW Financial Systems, in accordance with their agreement with Carnegie
- * Mellon University, makes this software available to CMU to distribute
- * or use in any manner that they see fit as long as this message is kept with
- * the software. For this reason TFS also grants any other persons or
- * organisations permission to use or modify this software.
- *
- * TFS supplies this software to be publicly redistributed
- * on the understanding that TFS is not responsible for the correct
- * functioning of this software in any circumstances.
- *
- * commenced: Sun Sep 27 18:14:01 PDT 1992
- *
- * $Id: aha2742.c,v 1.3 1994/11/18 07:25:02 jkh Exp $
- */
-/*
- * TODO:
- * Add support for dual and wide busses
- * Implement Target Mode
- * Implement Tagged Queuing
- * Add target reset capabilities
- * Test the check SCSI sense code
- * Write a message abort procedure for use in ahc_timeout
- * Add support for the 294X series cards
- *
- * This driver is very stable, and seems to offer performance
- * comprable to the 1742 FreeBSD driver. The only timeouts
- * I have ever experienced were due to critical driver bugs
- * where an abort wouldn't have helped me anyway. So I haven't
- * written code to actually search the QINFIFO and/or kill an
- * active command. Same goes for target reset.
- */
-
-#define AHC_SCB_MAX 16 /*
- * Up to 16 SCBs on some types of aic7xxx based
- * boards. The aic7770 family only have 4
- */
-
-#include "ahc.h" /* for NAHC from config */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <sys/malloc.h>
-#include <sys/buf.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <i386/isa/isa.h>
-#include <i386/isa/isa_device.h>
-#include <machine/cpufunc.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-#define AHC_NSEG 256 /* number of dma segments supported */
-#define PAGESIZ 4096
-#if 0
-#define AHCDEBUG
-#endif
-
-/*
- * I don't know if this is correct, but Justin screwed the pooch here too
- * so I have to guess. ARGH! -jkh
- */
-#ifndef IO_EISASIZE
-#define IO_EISASIZE 0x1000
-#endif
-
-typedef unsigned long int physaddr;
-
-#include <sys/kernel.h>
-#define KVTOPHYS(x) vtophys(x)
-
-typedef enum {
- AHC_274, /* Single Channel */
- AHC_274T, /* Twin Channel */
- AHC_274W, /* Wide Channel */
- AHC_284, /* VL Single Channel */
- AHC_284T, /* VL Twin Channel */
- AHC_284W, /* VL Wide Channel - Do these exist?? */
-}ahc_type;
-
-int ahcprobe();
-int ahcprobe1 __P((struct isa_device *dev, ahc_type type));
-int ahc_attach();
-int ahc_init __P((int unit));
-void ahc_loadseq __P((int port));
-int ahcintr();
-int32 ahc_scsi_cmd();
-timeout_t ahc_timeout;
-void ahc_done();
-struct scb *ahc_get_scb __P((int unit, int flags));
-void ahc_free_scb();
-void ahcminphys();
-struct scb *ahc_scb_phys_kv();
-u_int32 ahc_adapter_info();
-
-#define MAX_SLOTS 8 /* XXX should this be 16?? Need EISA spec */
-static ahc_slot = 0; /* slot last board was found in */
-static ahc_unit = 0;
-
-/* Different debugging levels - only one so-far */
-#define AHC_SHOWMISC 0x0001
-int ahc_debug = AHC_SHOWMISC;
-/*
- * Standard EISA Host ID regs (Offset from slot base)
- */
-
-#define HID0 0xC80 /* 0,1: msb of ID2, 2-7: ID1 */
-#define HID1 0xC81 /* 0-4: ID3, 5-7: LSB ID2 */
-#define HID2 0xC82 /* product, 0=174[20] 1 = 1744 */
-#define HID3 0xC83 /* firmware revision */
-
-/**** bit definitions for SCSIDEF ****/
-#define HSCSIID 0x07 /* our SCSI ID */
-
-typedef struct
-{
- ahc_type type;
- unsigned char id; /* The Last EISA Host ID reg */
-} ahc_sig;
-
-#define CHAR1(B1,B2) (((B1>>2) & 0x1F) | '@')
-#define CHAR2(B1,B2) (((B1<<3) & 0x18) | ((B2>>5) & 0x7)|'@')
-#define CHAR3(B1,B2) ((B2 & 0x1F) | '@')
-
-struct isa_driver ahcdriver = {ahcprobe, ahc_attach, "ahc"};
-
-struct scsi_adapter ahc_switch =
-{
- ahc_scsi_cmd,
- ahcminphys,
- 0,
- 0,
- ahc_adapter_info,
- "ahc",
- { 0, 0 }
-};
-
-/* the below structure is so we have a default dev struct for our link struct */
-struct scsi_device ahc_dev =
-{
- NULL, /* Use default error handler */
- NULL, /* have a queue, served by this */
- NULL, /* have no async handler */
- NULL, /* Use default 'done' routine */
- "ahc",
- 0,
- { 0, 0 }
-};
-
-/*
- * All of these should be in a separate header file shared by the sequencer
- * code and the kernel level driver. The only catch is that we would need to
- * add an additional 0xc00 offset when using them in the kernel driver. The
- * aic7770 assembler must be modified to allow include files as well. All
- * page numbers refer to the Adaptec AIC-7770 Data Book availible from
- * Adaptec's Technical Documents Department 1-800-634-2766
- */
-
-/* -------------------- AIC-7770 offset definitions ----------------------- */
-
-/*
- * SCSI Sequence Control (p. 3-11).
- * Each bit, when set starts a specific SCSI sequence on the bus
- */
-#define SCSISEQ 0xc00
-#define TEMODEO 0x80
-#define ENSELO 0x40
-#define ENSELI 0x20
-#define ENRSELI 0x10
-#define ENAUTOATNO 0x08
-#define ENAUTOATNI 0x04
-#define ENAUTOATNP 0x02
-#define SCSIRSTO 0x01
-
-/*
- * SCSI Control Signal Read Register (p. 3-15).
- * Reads the actual state of the SCSI bus pins
- */
-#define SCSISIGI 0xc03
-#define CDI 0x80
-#define IOI 0x40
-#define MSGI 0x20
-#define ATNI 0x10
-#define SELI 0x08
-#define BSYI 0x04
-#define REQI 0x02
-#define ACKI 0x01
-
-/*
- * SCSI Contol Signal Write Register (p. 3-16).
- * Writing to this register modifies the control signals on the bus. Only
- * those signals that are allowed in the current mode (Initiator/Target) are
- * asserted.
- */
-#define SCSISIGO 0xc03
-#define CDO 0x80
-#define IOO 0x40
-#define MSGO 0x20
-#define ATNO 0x10
-#define SELO 0x08
-#define BSYO 0x04
-#define REQO 0x02
-#define ACKO 0x01
-
-/*
- * SCSI ID (p. 3-18).
- * Contains the ID of the board and the current target on the
- * selected channel
- */
-#define SCSIID 0xc05
-#define TID 0xf0 /* Target ID mask */
-#define OID 0x0f /* Our ID mask */
-
-/*
- * SCSI Status 0 (p. 3-21)
- * Contains one set of SCSI Interrupt codes
- * These are most likely of interest to the sequencer
- */
-#define SSTAT0 0xc0b
-#define TARGET 0x80 /* Board is a target */
-#define SELDO 0x40 /* Selection Done */
-#define SELDI 0x20 /* Board has been selected */
-#define SELINGO 0x10 /* Selection In Progress */
-#define SWRAP 0x08 /* 24bit counter wrap */
-#define SDONE 0x04 /* STCNT = 0x000000 */
-#define SPIORDY 0x02 /* SCSI PIO Ready */
-#define DMADONE 0x01 /* DMA transfer completed */
-
-/*
- * Clear SCSI Interrupt 1 (p. 3-23)
- * Writing a 1 to a bit clears the associated SCSI Interrupt in SSTAT1.
- */
-#define CLRSINT1 0xc0c
-#define CLRSELTIMEO 0x80
-#define CLRATNO 0x40
-#define CLRSCSIRSTI 0x20
-/* UNUSED 0x10 */
-#define CLRBUSFREE 0x08
-#define CLRSCSIPERR 0x04
-#define CLRPHASECHG 0x02
-#define CLRREQINIT 0x01
-
-/*
- * SCSI Status 1 (p. 3-24)
- * These interrupt bits are of interest to the kernel driver
- */
-#define SSTAT1 0xc0c
-#define SELTO 0x80
-#define ATNTARG 0x40
-#define SCSIRSTI 0x20
-#define PHASEMIS 0x10
-#define BUSFREE 0x08
-#define SCSIPERR 0x04
-#define PHASECHG 0x02
-#define REQINIT 0x01
-
-/*
- * Selection/Reselection ID (p. 3-31)
- * Upper four bits are the device id. The ONEBIT is set when the re/selecting
- * device did not set its own ID.
- */
-#define SELID 0xc19
-#define SELID_MASK 0xf0
-#define ONEBIT 0x08
-/* UNUSED 0x07 */
-
-/*
- * SCSI Block Control (p. 3-32)
- * Controls Bus type and channel selection. In a twin channel configuration
- * addresses 0x00-0x1e are gated to the appropriate channel based on this
- * register. SELWIDE allows for the coexistence of 8bit and 16bit devices
- * on a wide bus.
- */
-#define SBLKCTL 0xc1f
-/* UNUSED 0xc0 */
-#define AUTOFLUSHDIS 0x20
-/* UNUSED 0x10 */
-#define SELBUSB 0x08
-/* UNUSED 0x04 */
-#define SELWIDE 0x02
-/* UNUSED 0x01 */
-
-/*
- * Sequencer Control (p. 3-33)
- * Error detection mode and speed configuration
- */
-#define SEQCTL 0xc60
-#define PERRORDIS 0x80
-#define PAUSEDIS 0x40
-#define FAILDIS 0x20
-#define FASTMODE 0x10
-#define BRKADRINTEN 0x08
-#define STEP 0x04
-#define SEQRESET 0x02
-#define LOADRAM 0x01
-
-/*
- * Sequencer RAM Data (p. 3-34)
- * Single byte window into the Scratch Ram area starting at the address
- * specified by SEQADDR0 and SEQADDR1. To write a full word, simply write
- * four bytes in sucessesion. The SEQADDRs will increment after the most
- * significant byte is written
- */
-#define SEQRAM 0xc61
-
-/*
- * Sequencer Address Registers (p. 3-35)
- * Only the first bit of SEQADDR1 holds addressing information
- */
-#define SEQADDR0 0xc62
-#define SEQADDR1 0xc63
-#define SEQADDR1_MASK 0x01
-
-/*
- * Accumulator
- * We cheat by passing arguments in the Accumulator up to the kernel driver
- */
-#define ACCUM 0xc64
-
-/*
- * Board Control (p. 3-43)
- */
-#define BCTL 0xc84
-/* RSVD 0xf0 */
-#define ACE 0x08 /* Support for external processors */
-/* RSVD 0x06 */
-#define ENABLE 0x01
-
-/*
- * Host Control (p. 3-47) R/W
- * Overal host control of the device.
- */
-#define HCNTRL 0xc87
-/* UNUSED 0x80 */
-#define POWRDN 0x40
-/* UNUSED 0x20 */
-#define SWINT 0x10
-#define IRQMS 0x08
-#define PAUSE 0x04
-#define INTEN 0x02
-#define CHIPRST 0x01
-#define REQ_PAUSE IRQMS | PAUSE | INTEN
-#define UNPAUSE_274X IRQMS | INTEN
-#define UNPAUSE_284X INTEN
-
-/*
- * SCB Pointer (p. 3-49)
- * Gate one of the four SCBs into the SCBARRAY window.
- */
-#define SCBPTR 0xc90
-
-/*
- * Interrupt Status (p. 3-50)
- * Status for system interrupts
- */
-#define INTSTAT 0xc91
-#define SEQINT_MASK 0xf0 /* SEQINT Status Codes */
-#define BAD_PHASE 0x00
-#define MSG_REJECT 0x10
-#define NO_IDENT 0x20
-#define NO_MATCH 0x30
-#define TRANS_RATE 0x40
-#define BAD_STATUS 0x50
-#define BRKADRINT 0x08
-#define SCSIINT 0x04
-#define CMDCMPLT 0x02
-#define SEQINT 0x01
-#define INT_PEND SEQINT | SCSIINT | CMDCMPLT /* For polling */
-
-/*
- * Hard Error (p. 3-53)
- * Reporting of catastrophic errors. You usually cannot recover from
- * these without a full board reset.
- */
-#define ERROR 0xc92
-/* UNUSED 0xf0 */
-#define PARERR 0x08
-#define ILLOPCODE 0x04
-#define ILLSADDR 0x02
-#define ILLHADDR 0x01
-
-/*
- * Clear Interrupt Status (p. 3-52)
- */
-#define CLRINT 0xc92
-#define CLRBRKADRINT 0x08
-#define CLRINTSTAT 0x04 /* UNDOCUMENTED - must be unpaused */
-#define CLRCMDINT 0x02
-#define CLRSEQINT 0x01
-
-/*
- * SCB Auto Increment (p. 3-59)
- * Byte offset into the SCB Array and an optional bit to allow auto
- * incrementing of the address during download and upload operations
- */
-#define SCBCNT 0xc9a
-#define SCBAUTO 0x80
-#define SCBCNT_MASK 0x1f
-
-/*
- * Queue In FIFO (p. 3-60)
- * Input queue for queued SCBs (commands that the seqencer has yet to start)
- */
-#define QINFIFO 0xc9b
-
-/*
- * Queue In Count (p. 3-60)
- * Number of queued SCBs
- */
-#define QINCNT 0xc9c
-
-/*
- * Queue Out FIFO (p. 3-61)
- * Queue of SCBs that have completed and await the host
- */
-#define QOUTFIFO 0xc9d
-
-/*
- * Queue Out Count (p. 3-61)
- * Number of queued SCBs in the Out FIFO
- */
-#define QOUTCNT 0xc9e
-
-#define SCBARRAY 0xca0
-
-/* ---------------- END AIC-7770 Register Definitions ----------------- */
-
-/* ---------------------- Scratch RAM Offsets ------------------------- */
-/* These offsets are either to values that are initialized by the board's
- * BIOS or are specified by the Linux sequencer code. If I can figure out
- * how to read the EISA configuration info at probe time, the cards could
- * be run without BIOS support installed
- */
-
-/*
- * The sequencer will stick the frist byte of any rejected message here so
- * we can see what is getting thrown away.
- */
-#define HA_REJBYTE 0xc31
-
-/*
- * Pending message flag
- */
-#define HA_MSG_FLAGS 0xc35
-
-/*
- * Length of pending message
- */
-#define HA_MSG_LEN 0xc36
-
-/*
- * message body
- */
-#define HA_MSG_START 0xc37 /* outgoing message body */
-
-/*
- * These are offsets into the card's scratch ram. Some of the values are
- * specified in the AHA2742 technical reference manual and are initialized
- * by the BIOS at boot time.
- */
-#define HA_ARG_1 0xc4c
-#define HA_ARG_2 0xc4d
-#define HA_RETURN_1 0xc4c
-
-#define HA_SIGSTATE 0xc4e
-#define HA_NEEDSDTR 0xc4f
-
-#define HA_SCSICONF 0xc5a
-#define INTDEF 0xc5c
-#define HA_HOSTCONF 0xc5d
-#define HA_SCBCOUNT 0xc56
-#define ACTIVE_A 0xc57
-#define MSG_ABORT 0x06
-
-/*
- * Since the sequencer can disable pausing in a critical section, we
- * must loop until it actually stops.
- * XXX Should add a timeout in here!!
- */
-#define PAUSE_SEQUENCER(ahc) \
- outb(HCNTRL + ahc->baseport, REQ_PAUSE); \
- \
- while ((inb(HCNTRL + ahc->baseport) & PAUSE) == 0) \
- ;
-
-#define UNPAUSE_SEQUENCER(ahc) \
- outb( HCNTRL + ahc->baseport, ahc->unpause )
-
-/*
- * Restart the sequencer program from address zero
- */
-#define RESTART_SEQUENCER(ahc) \
- do { \
- outb( SEQCTL + ahc->baseport, SEQRESET ); \
- } while (inw(SEQADDR0 + ahc->baseport) != 0); \
- \
- UNPAUSE_SEQUENCER(ahc);
-
-
-struct ahc_dma_seg {
- physaddr addr;
- long len;
-};
-
-/*
- * The driver keeps up to four scb structures per card in memory. Only the
- * first 26 bytes of the structure are valid for the hardware, the rest used
- * for driver level bookeeping. The "__attribute ((packed))" tags ensure that
- * gcc does not attempt to pad the long ints in the structure to word
- * boundaries since the first 26 bytes of this structure must have the correct
- * offsets for the hardware to find them. The driver should be further
- * optimized so that we only have to download the first 14 bytes since as long
- * as we always use S/G, the last fields should be zero anyway. Its mostly a
- * matter of looking through the sequencer code and ensuring that those fields
- * are cleared or loaded with a valid value before being read.
- */
-struct scb {
-/* ------------ Begin hardware supported fields ---------------- */
-/*1*/ u_char control;
-#define SCB_REJ_MDP 0x80 /* Reject MDP message */
-#define SCB_DCE 0x40 /* Disconnect enable */
-#define SCB_TE 0x20 /* Tag enable */
-#define SCB_WAITING 0x06
-#define SCB_DIS 0x04
-#define SCB_TAG_TYPE 0x3
-#define SIMPLE_QUEUE 0x0
-#define HEAD_QUEUE 0x1
-#define OR_QUEUE 0x2
-/*2*/ u_char target_channel_lun; /* 4/1/3 bits */
-/*3*/ u_char SG_segment_count;
-/*7*/ physaddr SG_list_pointer __attribute__ ((packed));
-/*11*/ physaddr cmdpointer __attribute__ ((packed));
-/*12*/ u_char cmdlen;
-/*14*/ u_char RESERVED[2]; /* must be zero */
-/*15*/ u_char target_status;
-/*18*/ u_char residual_data_count[3];
-/*19*/ u_char residual_SG_segment_count;
-/*23*/ physaddr data __attribute__ ((packed));
-/*26*/ u_char datalen[3];
-#define SCB_SIZE 26 /* amount to actually download */
-#if 0
- /*
- * No real point in transferring this to the
- * SCB registers.
- */
- unsigned char RESERVED[6];
-#endif
- /*-----------------end of hardware supported fields----------------*/
- struct scb *next; /* in free list */
- struct scsi_xfer *xs; /* the scsi_xfer for this cmd */
- int flags;
- int position; /* Position in scbarray */
-#define SCB_FREE 0
-#define SCB_ACTIVE 1
-#define SCB_ABORTED 2
-#define SCB_IMMED 4
-#define SCB_IMMED_FAIL 8
-#define SCB_SENSE 16
- struct ahc_dma_seg ahc_dma[AHC_NSEG] __attribute__ ((packed));
- struct scsi_sense sense_cmd; /* SCSI command block */
-};
-
-struct ahc_data {
- ahc_type type;
- int flags;
-#define AHC_INIT 0x01;
- int baseport;
- struct scb *scbarray[AHC_SCB_MAX]; /* Mirror boards scbarray */
- struct scb *free_scb;
- int our_id; /* our scsi id */
- int vect;
- struct scb *immed_ecb; /* an outstanding immediete command */
- struct scsi_link sc_link;
- int numscbs;
- u_char maxscbs;
- int unpause;
-} *ahcdata[NAHC];
-
-
-#ifdef AHCDEBUG
-void
-ahc_print_scb(scb)
- struct scb *scb;
-{
- printf("scb:%x control:%x tcl:%x cmdlen:%d cmdpointer:%x\n"
- ,scb
- ,scb->control
- ,scb->target_channel_lun
- ,scb->cmdlen
- ,scb->cmdpointer );
- printf(" datlen:%d data:%x res:%x segs:%x segp:%x\n"
- ,scb->datalen[2] << 16 | scb->datalen[1] << 8 | scb->datalen[0]
- ,scb->data
- ,scb->RESERVED[1] << 8 | scb->RESERVED[0]
- ,scb->SG_segment_count
- ,scb->SG_list_pointer);
- printf(" sg_addr:%x sg_len:%d\n"
- ,scb->ahc_dma[0].addr
- ,scb->ahc_dma[0].len);
- printf(" size:%d\n"
- ,(int)&(scb->next) - (int)scb);
-}
-
-void
-ahc_print_active_scb(ahc)
- struct ahc_data *ahc;
-{
- int cur_scb_offset;
- int port = ahc->baseport;
- PAUSE_SEQUENCER(ahc);
- cur_scb_offset = inb(SCBPTR + port);
- UNPAUSE_SEQUENCER(ahc);
- ahc_print_scb(ahc->scbarray[cur_scb_offset]);
-}
-
-#define PARERR 0x08
-#define ILLOPCODE 0x04
-#define ILLSADDR 0x02
-#define ILLHADDR 0x01
-
-#endif
-
-static struct {
- u_char errno;
- char *errmesg;
-} hard_error[] = {
- ILLHADDR, "Illegal Host Access",
- ILLSADDR, "Illegal Sequencer Address referrenced",
- ILLOPCODE, "Illegal Opcode in sequencer program",
- PARERR, "Sequencer Ram Parity Error",
-};
-
-
-/*
- * Valid SCSIRATE values. (p. 3-17)
- * Provides a mapping of tranfer periods in ns to the proper value to
- * stick in the scsiscfr reg to use that transfer rate.
- */
-static struct {
- short sxfr;
- short period; /* in ns */
- char *rate;
-} ahc_syncrates[] = {
- 0x00, 100, "10.0",
- 0x10, 125, "8.0",
- 0x20, 150, "6.67",
- 0x30, 175, "5.7",
- 0x40, 200, "5.0",
- 0x50, 225, "4.4",
- 0x60, 250, "4.0",
- 0x70, 275, "3.6"
-};
-
-static int ahc_num_syncrates =
- sizeof(ahc_syncrates) / sizeof(ahc_syncrates[0]);
-
-int
-ahcprobe(struct isa_device *dev)
-{
- int port;
- int i;
- u_char sig_id[4];
-
- ahc_sig valid_ids[] = {
- /* Entries of other tested adaptors should be added here */
- AHC_274, 0x71, /*274x, Card*/
- AHC_274, 0x70, /*274x, Motherboard*/
- AHC_284, 0x56, /*284x, BIOS enabled*/
- AHC_284, 0x57, /*284x, BIOS disabled*/
- };
-
-
- ahc_slot++;
- while (ahc_slot <= MAX_SLOTS) {
- port = 0x1000 * ahc_slot;
- for( i = 0; i < sizeof(sig_id); i++ )
- {
- /*
- * An outb is required to prime these registers on
- * VL cards
- */
- outb( port + HID0, HID0 + i );
- sig_id[i] = inb(port + HID0 + i);
- }
- if (sig_id[0] == 0xff) {
- ahc_slot++;
- continue;
- }
- /* Check manufacturer's ID. */
- if ((CHAR1(sig_id[0], sig_id[1]) == 'A')
- && (CHAR2(sig_id[0], sig_id[1]) == 'D')
- && (CHAR3(sig_id[0], sig_id[1]) == 'P')
- && (sig_id[2] == 0x77)) {
- for( i = 0; i < sizeof(valid_ids)/sizeof(ahc_sig); i++)
- if ( sig_id[3] == valid_ids[i].id ) {
- dev->id_iobase = port;
- return ahcprobe1(dev, valid_ids[i].type);
- }
- }
- ahc_slot++;
- }
- return 0;
-}
-
-/*
- * Check if the device can be found at the port given
- * and if so, determine configuration and set it up for further work.
- * As an argument, takes the isa_device structure from
- * autoconf.c.
- */
-
-int
-ahcprobe1(dev, type)
- struct isa_device *dev;
- ahc_type type;
-{
-
- /*
- * find unit and check we have that many defined
- */
-
- int unit = dev->id_unit;
- struct ahc_data *ahc;
-
- if (unit >= NAHC) {
- printf("ahc: unit number (%d) too high\n", unit);
- return 0;
- }
-
- /*
- * Allocate a storage area for us
- */
-
- if (ahcdata[unit]) {
- printf("ahc%d: memory already allocated\n", unit);
- return 0;
- }
- ahc = malloc(sizeof(struct ahc_data), M_TEMP, M_NOWAIT);
- if (!ahc) {
- printf("ahc%d: cannot malloc!\n", unit);
- return 0;
- }
- bzero(ahc, sizeof(struct ahc_data));
- ahcdata[unit] = ahc;
- ahc->baseport = dev->id_iobase;
- ahc->type = type;
-
- /*
- * Try to initialize a unit at this location
- * reset the AIC-7770, read its registers,
- * and fill in the dev structure accordingly
- */
-
- if (ahc_init(unit) != 0) {
- ahcdata[unit] = NULL;
- free(ahc, M_TEMP);
- return (0);
- }
-
- /*
- * If it's there, put in it's interrupt vectors
- */
-
- dev->id_irq = (1 << ahc->vect);
- dev->id_drq = -1; /* use EISA dma */
-
- ahc_unit++;
- return IO_EISASIZE;
-}
-
-
-/*
- * Look up the valid period to SCSIRATE conversion in our table.
- */
-static
-void ahc_scsirate(scsirate, period, offset, unit, target )
- u_char *scsirate;
- u_char period, offset;
- int unit, target;
-{
- int i;
-
- for (i = 0; i < ahc_num_syncrates; i++) {
-
- if ((ahc_syncrates[i].period - period) >= 0) {
- *scsirate = (ahc_syncrates[i].sxfr) | (offset & 0x0f);
-#ifdef AHCDEBUG
- printf("ahc%d: target %d synchronous at %sMb/s\n",
- unit, target, ahc_syncrates[i].rate );
-#endif /* AHCDEBUG */
- return;
- }
- }
- /* Default to asyncronous transfer */
- *scsirate = 0;
-#ifdef AHCDEBUG
- printf("ahc%d: target %d using asyncronous transfers\n",
- unit, target );
-#endif /* AHCDEBUG */
-
-}
-
-
-/*
- * Attach all the sub-devices we can find
- */
-int
-ahc_attach(dev)
- struct isa_device *dev;
-{
- int unit = dev->id_unit;
- struct ahc_data *ahc = ahcdata[unit];
-
- /*
- * fill in the prototype scsi_link.
- */
- ahc->sc_link.adapter_unit = unit;
- ahc->sc_link.adapter_targ = ahc->our_id;
- ahc->sc_link.adapter = &ahc_switch;
- ahc->sc_link.device = &ahc_dev;
- ahc->sc_link.flags = DEBUGLEVEL;
-
- /*
- * Here, we should really fill in up to two different sc_links,
- * making use of the extra fields in the sc_link structure so
- * we can know which channel any requests are for. Then its just
- * a matter of doing a scsi_attachdevs to both instead of the one.
- * This should be done when we get or write sequencer code that
- * supports more than one channel. XXX
- */
-
- /*
- * ask the adapter what subunits are present
- */
- scsi_attachdevs(&(ahc->sc_link));
-
- return 1;
-}
-
-void
-ahc_send_scb( ahc, scb )
- struct ahc_data *ahc;
- struct scb *scb;
-{
- int old_scbptr;
- int base = ahc->baseport;
-
- PAUSE_SEQUENCER(ahc);
-
- old_scbptr = inb(SCBPTR + base);
- outb(SCBPTR + base, scb->position);
-
- outb(SCBCNT + base, SCBAUTO);
-
- outsb(SCBARRAY + base, scb, SCB_SIZE);
-
- outb(SCBCNT + base, 0);
-
- outb(QINFIFO + base, scb->position);
- outb(SCBPTR + base, old_scbptr);
-
- UNPAUSE_SEQUENCER(ahc);
-}
-
-static
-void ahc_getscb(base, scb)
- int base;
- struct scb *scb;
-{
- outb(SCBCNT + base, 0x80); /* SCBAUTO */
-
- insb(SCBARRAY + base, scb, SCB_SIZE);
-
- outb(SCBCNT + base, 0);
-}
-
-/*
- * Catch an interrupt from the adaptor
- */
-int
-ahcintr(unit)
- int unit;
-{
- int intstat;
- u_char status;
- struct ahc_data *ahc = ahcdata[unit];
- int port = ahc->baseport;
- struct scb *scb = NULL;
- struct scsi_xfer *xs = NULL;
-
- intstat = inb(INTSTAT + port);
-
- if (intstat & BRKADRINT) {
- /* We upset the sequencer :-( */
-
- /* Lookup the error message */
- int i, error = inb(ERROR + port);
- int num_errors = sizeof(hard_error)/sizeof(hard_error[0]);
- for(i = 0; error != 1 && i < num_errors; i++)
- error >>= 1;
- panic("ahc%d: brkadrint, %s at seqaddr = 0x%x\n",
- unit, hard_error[i].errmesg, inw(SEQADDR0 + port));
- }
- if (intstat & SEQINT) {
- unsigned char transfer, offset, rate;
-
- switch (intstat & SEQINT_MASK) {
- case BAD_PHASE:
- panic("ahc%d: unknown scsi bus phase. "
- "Attempting to continue\n", unit);
- break;
- case MSG_REJECT:
- printf("ahc%d: Warning - "
- "message reject, message type: 0x%x\n", unit,
- inb(HA_REJBYTE + port));
- break;
- case NO_IDENT:
- panic("ahc%d: No IDENTIFY message from reconnecting "
- "target %d\n",
- unit, (inb(SELID + port) >> 4) & 0xf);
- break;
- case NO_MATCH:
- {
- u_char active;
- int target = (inb(SELID + port) >> 4) & 0x4;
- printf("ahc%d: no active SCB for reconnecting "
- "target %d - issuing ABORT\n",
- unit, target);
- active = inb(HA_SCBCOUNT + port);
- printf("SCBCOUNT is %d\n", active);
- DELAY(10000);
- active = inb(ACTIVE_A + port);
- active &= ~(0x01 << target);
- outb(ACTIVE_A + port, active);
- outb(CLRSINT1 + port, CLRSELTIMEO);
- RESTART_SEQUENCER(ahc);
- break;
- }
- case TRANS_RATE:
- /*
- * Help the sequencer to translate the negotiated
- * transfer rate. Transfer is 1/4 the period
- * in ns as is returned by the sync negotiation
- * message. So, we must multiply by four
- */
- transfer = inb(HA_ARG_1 + port) << 2;
- /* The bottom half of SCSIXFER*/
- offset = inb(HA_ARG_2 + port);
- ahc_scsirate(&rate, transfer, offset, unit,
- inb(SCSIID + port) >> 0x4);
- outb(HA_RETURN_1 + port, rate);
- break;
- case BAD_STATUS:
- {
- int scb_index, saved_scb_index;
-
- /* The sequencer will notify us when a command
- * has an error that would be of interest to
- * the kernel. This allows us to leave the sequencer
- * running in the common case of command completes
- * without error.
- */
-
- scb_index = inb(SCBPTR + port);
- scb = ahc->scbarray[scb_index];
- if (!scb || !(scb->flags & SCB_ACTIVE)) {
- printf("ahc%d: ahcintr - referenced scb not "
- "valid during seqint 0x%x scb(%d)\n",
- unit, intstat, scb_index);
- goto clear;
- }
-
- xs = scb->xs;
-
- ahc_getscb(port, scb);
-
-#ifdef AHCDEBUG
- if(xs->sc_link->target == DEBUGTARG)
- ahc_print_scb(scb);
-#endif
- xs->status = scb->target_status;
- xs->resid = ((scb->residual_data_count[2] << 16) |
- (scb->residual_data_count[1] << 8) |
- scb->residual_data_count[0]);
- switch(scb->target_status){
- case SCSI_OK:
- printf("ahc%d: Interrupted for staus of "
- "0???\n", unit);
- break;
- case SCSI_CHECK:
-#ifdef AHCDEBUG
- printf("ahc%d: SCSI Check requested\n", unit);
-#endif
- /*Priliminary code for requesting Sense */
- /* Enable at your own risk */
-#if STILL_NEEDS_TESTING
- if((xs->error == XS_NOERROR) &&
- !(scb->flags & SCB_SENSE))
- {
- struct ahc_dma_seg *sg = scb->ahc_dma;
- struct scsi_sense *sc = &(scb->sense_cmd);
- int scbsave[AHC_SCB_MAX], i;
- int queued = inb(QINCNT + port);
-#ifdef AHCDEBUG
- printf("SENDING SENSE.\n");
-#endif
- bzero(scb, SCB_SIZE);
- scb->flags |= SCB_SENSE;
- xs->error = XS_SENSE;
- sc->op_code = REQUEST_SENSE;
- sc->byte2 = xs->sc_link->lun << 5;
- sc->length = sizeof(struct scsi_sense_data);
- scb->cmdlen = sizeof(*sc);
- scb->cmdpointer = KVTOPHYS(sc);
- scb->SG_segment_count = 1;
- scb->SG_list_pointer = KVTOPHYS(sg);
- sg->addr = KVTOPHYS(&xs->sense);
- sg->len = sizeof(struct scsi_sense_data);
- /*
- * Reinsert us at head of
- * queue
- */
- outb(SCBCNT + port, 0x80);
- outsb(SCBARRAY + port, scb, SCB_SIZE);
- outb(SCBCNT + port, 0);
-
- for (i = 0; i < queued; i++)
- scbsave[i] = inb(QINFIFO + port);
-
- outb(QINFIFO + port, scb->position);
-
- for (i = 0; i < queued; i++)
- outb(QINFIFO + port, scbsave[i]);
-
- /* New lease on life */
- untimeout(ahc_timeout, (caddr_t)scb);
- timeout(ahc_timeout, (caddr_t)scb,
- (xs->timeout * hz) / 1000);
-
- goto clear;
- }
-#endif
- xs->error = XS_DRIVER_STUFFUP;
- break;
- case SCSI_BUSY:
- xs->error = XS_BUSY;
- printf("ahc%d: Target Busy\n", unit);
- break;
- default:
-#ifdef AHCDEBUG
- if (ahc_debug & AHC_SHOWMISC)
- {
- printf("unexpected targ_status: %x\n",
- scb->target_status);
- }
-#endif /*AHCDEBUG */
- xs->error = XS_DRIVER_STUFFUP;
- break;
- }
- untimeout(ahc_timeout, (caddr_t)scb);
- ahc_done(unit, scb);
- break;
- }
- default:
- printf("ahc: seqint, "
- "intstat = 0x%x, scsisigi = 0x%x\n",
- intstat, inb(SCSISIGI + port));
- break;
- }
-
- /*
- * Clear the upper byte that holds SEQINT status
- * codes and clear the SEQINT bit.
- */
-clear:
- outb(CLRINT + port, CLRSEQINT);
-
- /*
- * The sequencer is paused immediately on
- * a SEQINT, so we should restart it when
- * we leave this section.
- */
- UNPAUSE_SEQUENCER(ahc);
- }
-
-
- if (intstat & SCSIINT) {
-
- int scb_index = inb(SCBPTR + port);
- status = inb(SSTAT1 + port);
-
- scb = ahc->scbarray[scb_index];
- if (!scb || scb->flags != SCB_ACTIVE) {
- printf("ahc%d: ahcintr - referenced scb not "
- "valid during scsiint 0x%x scb(%d)\n",
- unit, status, scb_index);
- outb(CLRSINT1 + port, status);
- UNPAUSE_SEQUENCER(ahc);
- outb(CLRINT + port, CLRINTSTAT);
- scb = NULL;
- goto cmdcomplete;
- }
- xs = scb->xs;
-
- if (status & SELTO) {
- u_char active;
- outb(SCSISEQ + port, 0);
- xs->error = XS_TIMEOUT;
- /*
- * Clear any pending messages for the timed out
- * target, and mark the target as free
- */
- outb(HA_MSG_FLAGS + port, 0);
- active = inb(ACTIVE_A + port);
- active &= ~(0x01 << xs->sc_link->target);
- outb(ACTIVE_A + port, active);
-
- outb(CLRSINT1 + port, CLRSELTIMEO);
- RESTART_SEQUENCER(ahc);
-
- outb(CLRINT + port, CLRINTSTAT);
- }
-
- if (status & SCSIPERR) {
- printf("ahc%d: parity error on channel A "
- "target %d, lun %d\n",
- unit,
- xs->sc_link->target,
- xs->sc_link->lun);
- xs->error = XS_DRIVER_STUFFUP;
-
- outb(CLRSINT1 + port, CLRSCSIPERR);
- UNPAUSE_SEQUENCER(ahc);
-
- outb(CLRINT + port, CLRINTSTAT);
- scb = NULL;
- }
- if (status & BUSFREE) {
-#if 0
- /*
- * Has seen busfree since selection, i.e.
- * a "spurious" selection. Shouldn't happen.
- */
- printf("ahc: unexpected busfree\n");
- xs->error = XS_DRIVER_STUFFUP;
- outb(CLRSINT1 + port, BUSFREE); /* CLRBUSFREE */
-#endif
- }
-
- else {
- printf("ahc%d: Unknown SCSIINT. Status = 0x%x\n",
- unit, status);
- outb(CLRSINT1 + port, status);
- UNPAUSE_SEQUENCER(ahc);
- outb(CLRINT + port, CLRINTSTAT);
- scb = NULL;
- }
- if(scb != NULL) {
- /* We want to process the command */
- untimeout(ahc_timeout, (caddr_t)scb);
- ahc_done(unit, scb);
- }
- }
-cmdcomplete:
- if (intstat & CMDCMPLT) {
- int scb_index, saved_scb_index;
-
- do {
- scb_index = inb(QOUTFIFO + port);
- scb = ahc->scbarray[scb_index];
- if (!scb || !(scb->flags & SCB_ACTIVE)) {
- printf("ahc%d: WARNING "
- "no command for scb %d (cmdcmplt)\n",
- unit, scb_index);
- outb(CLRINT + port, CLRCMDINT);
- continue;
- }
-
- outb(CLRINT+ port, CLRCMDINT);
- untimeout(ahc_timeout, (caddr_t)scb);
- ahc_done(unit, scb);
-
- } while (inb(QOUTCNT + port));
- }
-
- return 1;
-}
-
-/*
- * We have a scb which has been processed by the
- * adaptor, now we look to see how the operation
- * went.
- */
-void
-ahc_done(unit, scb)
- int unit;
- struct scb *scb;
-{
- struct scsi_xfer *xs = scb->xs;
-
- SC_DEBUG(xs->sc_link, SDEV_DB2, ("ahc_done\n"));
- /*
- * Put the results of the operation
- * into the xfer and call whoever started it
- */
- if ((xs->flags & SCSI_ERR_OK) && !(xs->error == XS_SENSE)) {
- /* All went correctly OR errors expected */
- xs->error = 0;
- }
- xs->flags |= ITSDONE;
- ahc_free_scb(unit, scb, xs->flags);
- scsi_done(xs);
-}
-
-/*
- * Start the board, ready for normal operation
- */
-int
-ahc_init(unit)
- int unit;
-{
- struct ahc_data *ahc = ahcdata[unit];
- int port = ahc->baseport;
- int intdef;
-
- /*
- * Assume we have a board at this stage
- * Find out the configured interupt and the card type.
- */
-
- printf("ahc%d: scb %d; SCB_SIZE %d, ahc_dma %d\n", unit,
- sizeof(struct scb), SCB_SIZE, sizeof(struct ahc_dma_seg));
- printf("ahc%d: reading board settings\n", unit);
-
- outb(HCNTRL + port, CHIPRST);
- switch( ahc->type ) {
- case AHC_274:
- printf("ahc%d: 274x", unit);
- ahc->unpause = UNPAUSE_274X;
- ahc->maxscbs = 0x4;
- break;
- case AHC_284:
- printf("ahc%d: 284x", unit);
- ahc->unpause = UNPAUSE_284X;
- ahc->maxscbs = 0x4;
- break;
- default:
- };
-
-
- /* Determine channel configuration. */
- switch ( inb(SBLKCTL + port) ) {
- case 0:
- printf(" Single Channel, ");
- break;
- case 2:
- printf(" Wide SCSI configuration - Unsupported\n");
- ahc->type += 2;
- return(-1);
- break;
- case 8:
- printf(" Twin Channel - ignoring channel B, ");
- ahc->type += 1;
- break;
- default:
- printf(" Unsupported adapter type. Ignoring\n");
- return(-1);
- }
-
- intdef = inb(INTDEF + port);
- switch (intdef & 0xf) {
- case 9:
- ahc->vect = 9;
- break;
- case 10:
- ahc->vect = 10;
- break;
- case 11:
- ahc->vect = 11;
- break;
- case 12:
- ahc->vect = 12;
- break;
- case 14:
- ahc->vect = 14;
- break;
- case 15:
- ahc->vect = 15;
- break;
- default:
- printf("illegal irq setting\n");
- return (EIO);
- }
- printf("int=%d, ", ahc->vect);
-
- /* who are we on the scsi bus? */
- ahc->our_id = (inb(HA_SCSICONF + port) & HSCSIID);
- printf("SCSI Id=%d\n", ahc->our_id);
-
- /*
- * Load the Sequencer program and Enable the adapter
- */
-
- printf("ahc%d: Downloading Sequencer Program\n", unit);
- ahc_loadseq(port);
- outb(BCTL + port, ENABLE);
-
- /* Reset the SCSI bus. Is this necessary? */
- outb(SCSISEQ + port, SCSIRSTO);
- DELAY(500);
- outb(SCSISEQ + port, 0);
-
- /*
- * Attempt syncronous negotiation for all targets.
- * Clear the pending messages flag
- */
- outb( HA_NEEDSDTR + port, 0xff );
- outb( HA_MSG_FLAGS + port, 0);
- printf("SCBCOUNT == %d\n", ahc->maxscbs);
- outb(HA_SCBCOUNT + port, ahc->maxscbs);
- outb( ACTIVE_A + port, 0 );
-
- UNPAUSE_SEQUENCER(ahc);
-
- /*
- * Note that we are going and return (to probe)
- */
- ahc->flags |= AHC_INIT;
- return (0);
-}
-
-void
-ahcminphys(bp)
- struct buf *bp;
-{
-/* Even though the card can transfer up to 16megs per command
- * we are limited by the number of segments in the dma segment
- * list that we can hold. The worst case is that all pages are
- * discontinuous physically, hense the "page per segment" limit
- * enforced here.
- */
- if (bp->b_bcount > ((AHC_NSEG - 1) * PAGESIZ)) {
- bp->b_bcount = ((AHC_NSEG - 1) * PAGESIZ);
- }
-}
-
-/*
- * start a scsi operation given the command and
- * the data address, target, and lun all of which
- * are stored in the scsi_xfer struct
- */
-int32
-ahc_scsi_cmd(xs)
- struct scsi_xfer *xs;
-{
- struct scb *scb = NULL;
- struct ahc_dma_seg *sg;
- int seg; /* scatter gather seg being worked on */
- int thiskv;
- physaddr thisphys, nextphys;
- int unit = xs->sc_link->adapter_unit;
- int bytes_this_seg, bytes_this_page, datalen, flags;
- struct ahc_data *ahc = ahcdata[unit];
- int s;
-
- SC_DEBUG(xs->sc_link, SDEV_DB2, ("ahc_scsi_cmd\n"));
- /*
- * get an scb to use. If the transfer
- * is from a buf (possibly from interrupt time)
- * then we can't allow it to sleep
- */
- flags = xs->flags;
- if (xs->bp)
- flags |= (SCSI_NOSLEEP); /* just to be sure */
- if (flags & ITSDONE) {
- printf("ahc%d: Already done?", unit);
- xs->flags &= ~ITSDONE;
- }
- if (!(flags & INUSE)) {
- printf("ahc%d: Not in use?", unit);
- xs->flags |= INUSE;
- }
- if (!(scb = ahc_get_scb(unit, flags))) {
- xs->error = XS_DRIVER_STUFFUP;
- return (TRY_AGAIN_LATER);
- }
- SC_DEBUG(xs->sc_link, SDEV_DB3, ("start scb(%x)\n", scb));
- scb->xs = xs;
-
- if (flags & SCSI_RESET) {
- /* AR: Needs Implementation */
- printf("ahc0: SCSI_RESET called.\n");
- }
- /*
- * Put all the arguments for the xfer in the scb
- */
-
- /* Note, Linux sequencer code does not support extra channels */
- scb->target_channel_lun = ((xs->sc_link->target << 4) & 0xF0) |
- xs->sc_link->lun & 0x7;
- scb->cmdlen = xs->cmdlen;
- scb->cmdpointer = KVTOPHYS(xs->cmd);
- if (xs->datalen) { /* should use S/G only if not zero length */
- scb->SG_list_pointer = KVTOPHYS(scb->ahc_dma);
- sg = scb->ahc_dma;
- seg = 0;
- {
- /*
- * Set up the scatter gather block
- */
- SC_DEBUG(xs->sc_link, SDEV_DB4,
- ("%d @0x%x:- ", xs->datalen, xs->data));
- datalen = xs->datalen;
- thiskv = (int) xs->data;
- thisphys = KVTOPHYS(thiskv);
-
- while ((datalen) && (seg < AHC_NSEG)) {
- bytes_this_seg = 0;
-
- /* put in the base address */
- sg->addr = thisphys;
-
- SC_DEBUGN(xs->sc_link, SDEV_DB4, ("0x%x", thisphys));
-
- /* do it at least once */
- nextphys = thisphys;
- while ((datalen) && (thisphys == nextphys)) {
- /*
- * This page is contiguous (physically)
- * with the the last, just extend the
- * length
- */
- /* how far to the end of the page */
- nextphys = (thisphys & (~(PAGESIZ - 1)))
- + PAGESIZ;
- bytes_this_page = nextphys - thisphys;
- /**** or the data ****/
- bytes_this_page = min(bytes_this_page
- ,datalen);
- bytes_this_seg += bytes_this_page;
- datalen -= bytes_this_page;
-
- /* get more ready for the next page */
- thiskv = (thiskv & (~(PAGESIZ - 1)))
- + PAGESIZ;
- if (datalen)
- thisphys = KVTOPHYS(thiskv);
- }
- /*
- * next page isn't contiguous, finish the seg
- */
- SC_DEBUGN(xs->sc_link, SDEV_DB4,
- ("(0x%x)", bytes_this_seg));
- sg->len = bytes_this_seg;
- sg++;
- seg++;
- }
- } /*end of iov/kv decision */
- scb->SG_segment_count = seg;
- SC_DEBUGN(xs->sc_link, SDEV_DB4, ("\n"));
- if (datalen) { /* there's still data, must have run out of segs! */
- printf("ahc_scsi_cmd%d: more than %d DMA segs\n",
- unit, AHC_NSEG);
- xs->error = XS_DRIVER_STUFFUP;
- ahc_free_scb(unit, scb, flags);
- return (HAD_ERROR);
- }
- }
- /* else No data xfer, use non S/G values
- * the SG_segment_count and SG_list_pointer are pre-zeroed, so
- * we don't have to do anything
- */
-
- /*
- * Usually return SUCCESSFULLY QUEUED
- */
-#ifdef AHCDEBUG
- if(xs->sc_link->target == DEBUGTARG)
- ahc_print_scb(scb);
-#endif
- if (!(flags & SCSI_NOMASK)) {
- s = splbio();
- ahc_send_scb(ahc, scb);
- timeout(ahc_timeout, (caddr_t)scb, (xs->timeout * hz) / 1000);
- splx(s);
- SC_DEBUG(xs->sc_link, SDEV_DB3, ("cmd_sent\n"));
- return (SUCCESSFULLY_QUEUED);
- }
- /*
- * If we can't use interrupts, poll on completion
- */
- ahc_send_scb(ahc, scb);
- SC_DEBUG(xs->sc_link, SDEV_DB3, ("cmd_wait\n"));
- do {
- if (ahc_poll(unit, xs->timeout)) {
- if (!(xs->flags & SCSI_SILENT))
- printf("cmd fail\n");
- printf("cmd fail\n");
- printf("Abort called. Someone implement me please!\n");
- xs->error = XS_DRIVER_STUFFUP;
- return (HAD_ERROR);
- }
- } while (!(xs->flags & ITSDONE)); /* something (?) else finished */
- if (xs->error) {
- return (HAD_ERROR);
- }
- return (COMPLETE);
-}
-
-
-/*
- * Return some information to the caller about
- * the adapter and it's capabilities.
- */
-u_int32
-ahc_adapter_info(unit)
- int unit;
-{
- return (2); /* 2 outstanding requests at a time per device */
-}
-
-/*
- * A scb (and hence an scb entry on the board is put onto the
- * free list.
- */
-void
-ahc_free_scb(unit, scb, flags)
- int unit, flags;
- struct scb *scb;
-{
- unsigned int opri = 0;
- struct ahc_data *ahc = ahcdata[unit];
-
- if (!(flags & SCSI_NOMASK))
- opri = splbio();
-
- scb->next = ahc->free_scb;
- ahc->free_scb = scb;
- scb->flags = SCB_FREE;
- /*
- * If there were none, wake abybody waiting for
- * one to come free, starting with queued entries
- */
- if (!scb->next) {
- wakeup((caddr_t)&ahc->free_scb);
- }
- if (!(flags & SCSI_NOMASK))
- splx(opri);
-}
-
-/*
- * Get a free scb
- * If there are none, see if we can allocate a
- * new one. Otherwise either return an error or sleep
- */
-struct scb *
-ahc_get_scb(unit, flags)
- int unit, flags;
-{
- struct ahc_data *ahc = ahcdata[unit];
- unsigned opri = 0;
- struct scb *scbp;
- int position;
-
- if (!(flags & SCSI_NOMASK))
- opri = splbio();
- /*
- * If we can and have to, sleep waiting for one to come free
- * but only if we can't allocate a new one.
- */
- while (!(scbp = ahc->free_scb)) {
- if (ahc->numscbs < ahc->maxscbs) {
- scbp = (struct scb *) malloc(sizeof(struct scb),
- M_TEMP, M_NOWAIT);
- if (scbp) {
- bzero(scbp, sizeof(struct scb));
- scbp->position = ahc->numscbs;
- ahc->numscbs++;
- scbp->flags = SCB_ACTIVE;
- /*
- * Place in the scbarray
- * Never is removed. Position
- * in ahc->scbarray is the scbarray
- * position on the board we will
- * load it into.
- */
- ahc->scbarray[scbp->position] = scbp;
- } else {
- printf("ahc%d: Can't malloc SCB\n", unit);
- } goto gottit;
- } else {
- if (!(flags & SCSI_NOSLEEP)) {
- tsleep((caddr_t)&ahc->free_scb, PRIBIO,
- "ahcscb", 0);
- }
- }
- } if (scbp) {
- /* Get SCB from from free list */
- ahc->free_scb = scbp->next;
- /* preserve the position */
- position = scbp->position;
- bzero(scbp, sizeof(struct scb));
- scbp->flags = SCB_ACTIVE;
- scbp->position = position;
- }
-gottit: if (!(flags & SCSI_NOMASK))
- splx(opri);
-
- return (scbp);
-}
-
-void ahc_loadseq(port)
- int port;
-{
- extern unsigned char seqprog[];
-
- outb(SEQCTL + port, PERRORDIS|SEQRESET|LOADRAM);
-
- outsb(SEQRAM + port, seqprog, sizeof(seqprog));
-
- outb(SEQCTL + port, 0);
- do {
- /* XXX Need a timer here? */
- outb(SEQCTL + port, SEQRESET);
-
- } while (inw(SEQADDR0 + port) != 0);
-}
-
-/*
- * Function to poll for command completion when in poll mode
- */
-int
-ahc_poll(int unit, int wait)
-{ /* in msec */
- struct ahc_data *ahc = ahcdata[unit];
- int port = ahc->baseport;
- int stport = INTSTAT + port;
-
- retry:
- while (--wait) {
- if (inb(stport) & INT_PEND)
- break;
- DELAY(1000);
- } if (wait == 0) {
- printf("ahc%d: board not responding\n", unit);
- return (EIO);
- }
- ahcintr(unit);
- return (0);
-}
-
-void
-ahc_timeout(void *arg1)
-{
- struct scb *scb = (struct scb *)arg1;
- int unit, cur_scb_offset, port;
- struct ahc_data *ahc;
- int s = splbio();
-
- unit = scb->xs->sc_link->adapter_unit;
- ahc = ahcdata[unit];
- port = ahc->baseport;
- printf("ahc%d: target %d, lun %d (%s%d) timed out ", unit
- ,scb->xs->sc_link->target
- ,scb->xs->sc_link->lun
- ,scb->xs->sc_link->device->name
- ,scb->xs->sc_link->dev_unit);
-#if 0
-#ifdef AHCDEBUG
- if (ahc_debug & AHC_SHOWMISC)
- ahc_print_active_scb(unit);
-#endif /*AHCDEBUG */
-#endif
-
- /*
- * If it's immediate, don't try abort it
- */
- if (scb->flags & SCB_IMMED) {
- scb->xs->retries = 0; /* I MEAN IT ! */
- scb->flags |= SCB_IMMED_FAIL;
- ahc_done(unit, scb);
- splx(s);
- return;
- }
- /*
- * If it has been through before, then
- * a previous abort has failed, don't
- * try abort again
- */
- if (scb->flags == SCB_ABORTED) {
- /*
- * abort timed out
- */
- printf("AGAIN");
- scb->xs->retries = 0; /* I MEAN IT ! */
- ahc_done(unit, scb);
- } else { /* abort the operation that has timed out */
- printf("Abort unsupported!!!\n");
- }
- splx(s);
-}
-
diff --git a/sys/i386/isa/aic7770.c b/sys/i386/isa/aic7770.c
deleted file mode 100644
index e7963d7..0000000
--- a/sys/i386/isa/aic7770.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Product specific probe and attach routines for:
- * 27/284X and aic7770 motherboard SCSI controllers
- *
- * Copyright (c) 1995 Justin T. Gibbs
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice immediately at the beginning of the file, without modification,
- * this list of conditions, and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Absolutely no warranty of function or purpose is made by the author
- * Justin T. Gibbs.
- * 4. Modifications may be freely made to this file if the above conditions
- * are met.
- *
- * $Id: aic7770.c,v 1.15 1995/07/04 21:14:16 gibbs Exp $
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <i386/isa/isa.h>
-#include <i386/isa/isa_device.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <sys/devconf.h>
-#include <machine/cpufunc.h>
-#include <i386/scsi/aic7xxx.h>
-
-int aic7770probe __P((struct isa_device *dev));
-int aic7770_attach __P((struct isa_device *dev));
-
-/*
- * Standard EISA Host ID regs (Offset from slot base)
- */
-
-#define HID0 0xC80 /* 0,1: msb of ID2, 2-7: ID1 */
-#define HID1 0xC81 /* 0-4: ID3, 5-7: LSB ID2 */
-#define HID2 0xC82 /* product */
-#define HID3 0xC83 /* firmware revision */
-
-#define CHAR1(B1,B2) (((B1>>2) & 0x1F) | '@')
-#define CHAR2(B1,B2) (((B1<<3) & 0x18) | ((B2>>5) & 0x7)|'@')
-#define CHAR3(B1,B2) ((B2 & 0x1F) | '@')
-
-#define EISA_MAX_SLOTS 16 /* XXX should be defined in a common header */
-static ahc_slot = 0; /* slot last board was found in */
-
-struct isa_driver ahcdriver = {aic7770probe, aic7770_attach, "ahc"};
-
-typedef struct
-{
- ahc_type type;
- unsigned char id; /* The Last EISA Host ID reg */
-} aic7770_sig;
-
-static struct kern_devconf kdc_aic7770[NAHC] = { {
- 0, 0, 0, /* filled in by dev_attach */
- "ahc", 0, { MDDT_ISA, 0, "bio" },
- isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
- &kdc_isa0, /* parent */
- 0, /* parentdata */
- DC_UNCONFIGURED, /* always start out here */
- "Adaptec aic7770 based SCSI host adapter",
- DC_CLS_MISC /* host adapters aren't special */
-} };
-
-static inline void
-aic7770_registerdev(struct isa_device *id)
-{
- if(id->id_unit)
- kdc_aic7770[id->id_unit] = kdc_aic7770[0];
- kdc_aic7770[id->id_unit].kdc_unit = id->id_unit;
- kdc_aic7770[id->id_unit].kdc_parentdata = id;
- dev_attach(&kdc_aic7770[id->id_unit]);
-}
-
-int
-aic7770probe(struct isa_device *dev)
-{
- u_long port;
- int i;
- u_char sig_id[4];
-
- aic7770_sig valid_ids[] = {
- /* Entries of other tested adaptors should be added here */
- { AHC_274, 0x71 }, /*274x*/
- { AHC_AIC7770, 0x70 }, /*aic7770 on Motherboard*/
- { AHC_284, 0x56 }, /*284x, BIOS enabled*/
- { AHC_284, 0x57 } /*284x, BIOS disabled*/
- };
-
-
- ahc_slot++;
- while (ahc_slot < EISA_MAX_SLOTS) {
- port = 0x1000 * ahc_slot;
- for( i = 0; i < sizeof(sig_id); i++ )
- {
- /*
- * An outb is required to prime these registers on
- * VL cards
- */
- outb( port + HID0, HID0 + i );
- sig_id[i] = inb(port + HID0 + i);
- }
- if (sig_id[0] == 0xff) {
- ahc_slot++;
- continue;
- }
- /* Check manufacturer's ID. */
- if ((CHAR1(sig_id[0], sig_id[1]) == 'A')
- && (CHAR2(sig_id[0], sig_id[1]) == 'D')
- && (CHAR3(sig_id[0], sig_id[1]) == 'P')
- && (sig_id[2] == 0x77)) {
- for(i=0; i < sizeof(valid_ids)/sizeof(aic7770_sig);i++)
- if ( sig_id[3] == valid_ids[i].id ) {
- int unit = dev->id_unit;
- dev->id_iobase = port;
-#ifndef DEV_LKM
- aic7770_registerdev(dev);
-#endif /* DEV_LKM */
- if(ahcprobe(unit, port,
- valid_ids[i].type, AHC_FNONE)){
- /*
- * If it's there, put in it's
- * interrupt vectors
- */
- dev->id_irq = (1 <<
- ahcdata[unit]->vect);
- dev->id_drq = -1; /* EISA dma */
- ahc_unit++;
- return IO_EISASIZE;
- }
- }
- }
- ahc_slot++;
- }
- return 0;
-}
-
-int
-aic7770_attach(dev)
- struct isa_device *dev;
-{
- int unit = dev->id_unit;
- kdc_aic7770[unit].kdc_state = DC_BUSY; /* host adapters always busy */
- return ahc_attach(unit);
-}
-
diff --git a/sys/i386/isa/bt742a.c b/sys/i386/isa/bt742a.c
deleted file mode 100644
index ebc6941..0000000
--- a/sys/i386/isa/bt742a.c
+++ /dev/null
@@ -1,1764 +0,0 @@
-/*
- * Written by Julian Elischer (julian@tfs.com)
- * for TRW Financial Systems for use under the MACH(2.5) operating system.
- *
- * TRW Financial Systems, in accordance with their agreement with Carnegie
- * Mellon University, makes this software available to CMU to distribute
- * or use in any manner that they see fit as long as this message is kept with
- * the software. For this reason TFS also grants any other persons or
- * organisations permission to use or modify this software.
- *
- * TFS supplies this software to be publicly redistributed
- * on the understanding that TFS is not responsible for the correct
- * functioning of this software in any circumstances.
- *
- * $Id: bt742a.c,v 1.47 1995/12/10 13:38:22 phk Exp $
- */
-
-/*
- * Bulogic/Bustek 32 bit Addressing Mode SCSI driver.
- *
- * NOTE: 1. Some bt5xx card can NOT handle 32 bit addressing mode.
- * 2. OLD bt445s Revision A,B,C,D(nowired) + any firmware version
- * has broken busmaster for handling 32 bit addressing on H/W bus
- * side.
- *
- * 3. Extended probing still needs confirmation from our user base, due
- * to several H/W and firmware dependencies. If you have a problem
- * with extended probing, please contact 'amurai@spec.co.jp'
- *
- * amurai@spec.co.jp 94/6/16
- */
-
-/*
- * bt742a SCSI driver
- */
-
-#include <sys/types.h>
-
-#ifdef KERNEL /* don't laugh.. it compiles to a program too.. look */
-#include "bt.h"
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/sysctl.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/malloc.h>
-#include <sys/buf.h>
-#include <sys/proc.h>
-#endif /* KERNEL */
-
-#include <machine/clock.h>
-
-#include <vm/vm.h>
-#include <vm/vm_param.h>
-#include <vm/pmap.h>
-
-#include <i386/isa/isa_device.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <sys/devconf.h>
-
-#ifdef KERNEL
-#include <sys/kernel.h>
-#else /*KERNEL */
-#define NBT 1
-#endif /*KERNEL */
-
-typedef unsigned long int physaddr;
-
-/*
- * I/O Port Interface
- */
-
-#define BT_BASE bt->bt_base
-#define BT_CTRL_STAT_PORT (BT_BASE + 0x0) /* control & status */
-#define BT_CMD_DATA_PORT (BT_BASE + 0x1) /* cmds and datas */
-#define BT_INTR_PORT (BT_BASE + 0x2) /* Intr. stat */
-
-/*
- * BT_CTRL_STAT bits (write)
- */
-
-#define BT_HRST 0x80 /* Hardware reset */
-#define BT_SRST 0x40 /* Software reset */
-#define BT_IRST 0x20 /* Interrupt reset */
-#define BT_SCRST 0x10 /* SCSI bus reset */
-
-/*
- * BT_CTRL_STAT bits (read)
- */
-
-#define BT_STST 0x80 /* Self test in Progress */
-#define BT_DIAGF 0x40 /* Diagnostic Failure */
-#define BT_INIT 0x20 /* Mbx Init required */
-#define BT_IDLE 0x10 /* Host Adapter Idle */
-#define BT_CDF 0x08 /* cmd/data out port full */
-#define BT_DF 0x04 /* Data in port full */
-#define BT_INVDCMD 0x01 /* Invalid command */
-
-/*
- * BT_CMD_DATA bits (write)
- */
-
-#define BT_NOP 0x00 /* No operation */
-#define BT_MBX_INIT 0x01 /* Mbx initialization */
-#define BT_START_SCSI 0x02 /* start scsi command */
-#define BT_START_BIOS 0x03 /* start bios command */
-#define BT_INQUIRE 0x04 /* Adapter Inquiry */
-#define BT_MBO_INTR_EN 0x05 /* Enable MBO available interrupt */
-#define BT_SEL_TIMEOUT_SET 0x06 /* set selection time-out */
-#define BT_BUS_ON_TIME_SET 0x07 /* set bus-on time */
-#define BT_BUS_OFF_TIME_SET 0x08 /* set bus-off time */
-#define BT_SPEED_SET 0x09 /* set transfer speed */
-#define BT_DEV_GET 0x0a /* return installed devices */
-#define BT_CONF_GET 0x0b /* return configuration data */
-#define BT_TARGET_EN 0x0c /* enable target mode */
-#define BT_SETUP_GET 0x0d /* return setup data */
-#define BT_WRITE_CH2 0x1a /* write channel 2 buffer */
-#define BT_READ_CH2 0x1b /* read channel 2 buffer */
-#define BT_WRITE_FIFO 0x1c /* write fifo buffer */
-#define BT_READ_FIFO 0x1d /* read fifo buffer */
-#define BT_ECHO 0x1e /* Echo command data */
-#define BT_MBX_INIT_EXTENDED 0x81 /* Mbx initialization */
-#define BT_INQUIRE_EXTENDED 0x8D /* Adapter Setup Inquiry */
-
-/* The following command appeared at FirmWare 3.31 */
-#define BT_ROUND_ROBIN 0x8f /* Enable/Disable(default) round robin */
-#define BT_STRICT_ROUND_ROBIN 0x00 /* Parameter value for strict mode */
-#define BT_AGRES_ROUND_ROBIN 0x01 /* Parameter value for backword comp */
-
-struct bt_cmd_buf {
- u_char byte[16];
-};
-
-/*
- * BT_INTR_PORT bits (read)
- */
-
-#define BT_ANY_INTR 0x80 /* Any interrupt */
-#define BT_SCRD 0x08 /* SCSI reset detected */
-#define BT_HACC 0x04 /* Command complete */
-#define BT_MBOA 0x02 /* MBX out empty */
-#define BT_MBIF 0x01 /* MBX in full */
-
-/*
- * Mail box defs etc.
- * these could be bigger but we need the bt_data to fit on a single page..
- */
-
-#define BT_MBX_SIZE 32 /* mail box size (MAX 255 MBxs) */
- /* don't need that many really */
-#define BT_CCB_MAX 32 /* store up to 32CCBs at any one time */
- /* in bt742a H/W ( Not MAX ? ) */
-#define CCB_HASH_SIZE 32 /* when we have a physical addr. for */
- /* a ccb and need to find the ccb in */
- /* space, look it up in the hash table */
-#define CCB_HASH_SHIFT 9 /* only hash on multiples of 512 */
-#define CCB_HASH(x) ((((long int)(x))>>CCB_HASH_SHIFT) % CCB_HASH_SIZE)
-
-#define bt_nextmbx( wmb, mbx, mbio ) \
- if ( (wmb) == &((mbx)->mbio[BT_MBX_SIZE - 1 ]) ) \
- (wmb) = &((mbx)->mbio[0]); \
- else \
- (wmb)++;
-
-typedef struct bt_mbx_out {
- physaddr ccb_addr;
- unsigned char dummy[3];
- unsigned char cmd;
-} BT_MBO;
-
-typedef struct bt_mbx_in {
- physaddr ccb_addr;
- unsigned char btstat;
- unsigned char sdstat;
- unsigned char dummy;
- unsigned char stat;
-} BT_MBI;
-
-struct bt_mbx {
- BT_MBO mbo[BT_MBX_SIZE];
- BT_MBI mbi[BT_MBX_SIZE];
- BT_MBO *tmbo; /* Target Mail Box out */
- BT_MBI *tmbi; /* Target Mail Box in */
-};
-
-/*
- * mbo.cmd values
- */
-
-#define BT_MBO_FREE 0x0 /* MBO entry is free */
-#define BT_MBO_START 0x1 /* MBO activate entry */
-#define BT_MBO_ABORT 0x2 /* MBO abort entry */
-
-/*
- * mbi.stat values
- */
-
-#define BT_MBI_FREE 0x0 /* MBI entry is free */
-#define BT_MBI_OK 0x1 /* completed without error */
-#define BT_MBI_ABORT 0x2 /* aborted ccb */
-#define BT_MBI_UNKNOWN 0x3 /* Tried to abort invalid CCB */
-#define BT_MBI_ERROR 0x4 /* Completed with error */
-
-#if defined(BIG_DMA)
-WARNING...THIS WON'T WORK(won't fit on 1 page)
-/* #define BT_NSEG 2048*/ /* Number of scatter gather segments - to much vm */
-#define BT_NSEG 128
-#else
-#define BT_NSEG 33
-#endif /* BIG_DMA */
-
-struct bt_scat_gath {
- unsigned long seg_len;
- physaddr seg_addr;
-};
-
-struct bt_ccb {
- unsigned char opcode;
- unsigned char:3, data_in:1, data_out:1,:3;
- unsigned char scsi_cmd_length;
- unsigned char req_sense_length;
- /*------------------------------------longword boundary */
- unsigned long data_length;
- /*------------------------------------longword boundary */
- physaddr data_addr;
- /*------------------------------------longword boundary */
- unsigned char dummy[2];
- unsigned char host_stat;
- unsigned char target_stat;
- /*------------------------------------longword boundary */
- unsigned char target;
- unsigned char lun;
- unsigned char scsi_cmd[12]; /* 12 bytes (bytes only) */
- unsigned char dummy2[1];
- unsigned char link_id;
- /*------------------------------------4 longword boundary */
- physaddr link_addr;
- /*------------------------------------longword boundary */
- physaddr sense_ptr;
-/*-----end of HW fields-------------------------------longword boundary */
- struct scsi_sense_data scsi_sense;
- /*------------------------------------longword boundary */
- struct bt_scat_gath scat_gath[BT_NSEG];
- /*------------------------------------longword boundary */
- struct bt_ccb *next;
- /*------------------------------------longword boundary */
- struct scsi_xfer *xfer; /* the scsi_xfer for this cmd */
- /*------------------------------------longword boundary */
- struct bt_mbx_out *mbx; /* pointer to mail box */
- /*------------------------------------longword boundary */
- int flags;
-#define CCB_FREE 0
-#define CCB_ACTIVE 1
-#define CCB_ABORTED 2
- /*------------------------------------longword boundary */
- struct bt_ccb *nexthash; /* if two hash the same */
- /*------------------------------------longword boundary */
- physaddr hashkey; /*physaddr of this ccb */
- /*------------------------------------longword boundary */
-};
-
-/*
- * opcode fields
- */
-
-#define BT_INITIATOR_CCB 0x00 /* SCSI Initiator CCB */
-#define BT_TARGET_CCB 0x01 /* SCSI Target CCB */
-#define BT_INIT_SCAT_GATH_CCB 0x02 /* SCSI Initiator with scattter gather */
-#define BT_RESET_CCB 0x81 /* SCSI Bus reset */
-
-/*
- * bt_ccb.host_stat values
- */
-
-#define BT_OK 0x00 /* cmd ok */
-#define BT_LINK_OK 0x0a /* Link cmd ok */
-#define BT_LINK_IT 0x0b /* Link cmd ok + int */
-#define BT_SEL_TIMEOUT 0x11 /* Selection time out */
-#define BT_OVER_UNDER 0x12 /* Data over/under run */
-#define BT_BUS_FREE 0x13 /* Bus dropped at unexpected time */
-#define BT_INV_BUS 0x14 /* Invalid bus phase/sequence */
-#define BT_BAD_MBO 0x15 /* Incorrect MBO cmd */
-#define BT_BAD_CCB 0x16 /* Incorrect ccb opcode */
-#define BT_BAD_LINK 0x17 /* Not same values of LUN for links */
-#define BT_INV_TARGET 0x18 /* Invalid target direction */
-#define BT_CCB_DUP 0x19 /* Duplicate CCB received */
-#define BT_INV_CCB 0x1a /* Invalid CCB or segment list */
-#define BT_ABORTED 42 /* pseudo value from driver */
-
-struct bt_boardID {
- u_char board_type;
- u_char custom_feture;
- char firm_revision;
- u_char firm_version;
-};
-
-struct bt_setup {
- u_char sync_neg:1;
- u_char parity:1;
- u_char :6;
- u_char speed;
- u_char bus_on;
- u_char bus_off;
- u_char num_mbx;
- u_char mbx[3]; /* for backwards compatibility */
- struct {
- u_char offset:4;
- u_char period:3;
- u_char valid:1;
- } sync[8];
- u_char disc_sts;
-};
-
-struct bt_config {
- u_char chan;
- u_char intr;
- u_char scsi_dev:3;
- u_char :5;
-};
-
-#define BT_INQUIRE_REV_THIRD 0x84 /* Get Adapter FirmWare version #3 */
-#define BT_INQUIRE_REV_FOURTH 0x85 /* Get Adapter FirmWare version #4 */
-
-/*
- * Determine 32bit address/Data firmware functionality from the bus type
- * Note: bt742a/747[s|d]/757/946/445s will return 'E'
- * bt542b/545s/545d will return 'A'
- * 94/05/18 amurai@spec.co.jp
- */
-#define BT_BUS_TYPE_24bit 'A' /* PC/AT 24 bit address bus type */
-#define BT_BUS_TYPE_32bit 'E' /* EISA/VLB/PCI 32 bit address bus type */
-#define BT_BUS_TYPE_MCA 'M' /* Micro chanel is ? forget it right now */
-struct bt_ext_info {
- u_char bus_type; /* Host adapter bus type */
- u_char bios_addr; /* Bios Address-Not used */
- u_short max_seg; /* Max segment List */
- u_char num_mbx; /* Number of mailbox */
- int32 mbx_base; /* mailbox base address */
- struct {
- u_char resv1:1; /* ??? */
- u_char force:1; /* ON: force sync */
- u_char maxsync:1; /* ON: 10MB/s , OFF: 5MB/s */
- u_char resv2:2; /* ??? */
- u_char sync:1; /* ON: Sync, OFF: async ONLY!! */
- u_char resv3:2; /* ??? */
- } s;
- u_char firmid[3]; /* Firmware ver. & rev. w/o last char */
-};
-
-#define BT_GET_BOARD_INFO 0x8b /* Get H/W ID and Revision */
-struct bt_board_info {
- u_char id[4]; /* i.e bt742a -> '7','4','2','A' */
- u_char ver[2]; /* i.e Board Revision 'H' -> 'H', 0x00 */
-};
-
-#define BT_GET_SYNC_VALUE 0x8c /* Get Synchronous Value */
-struct bt_sync_value {
- u_char value[8]; /* Synchrnous value (value * 10 nsec) */
-};
-
-#define INT9 0x01
-#define INT10 0x02
-#define INT11 0x04
-#define INT12 0x08
-#define INT14 0x20
-#define INT15 0x40
-
-#define EISADMA 0x00
-#define CHAN0 0x01
-#define CHAN5 0x20
-#define CHAN6 0x40
-#define CHAN7 0x80
-
-#define KVTOPHYS(x) vtophys(x)
-#define PAGESIZ 4096
-#define INVALIDATE_CACHE {asm volatile( ".byte 0x0F ;.byte 0x08" ); }
-
-static struct bt_data {
- short bt_base; /* base port for each board */
- struct bt_mbx bt_mbx; /* all our mailboxes */
- struct bt_ccb *bt_ccb_free; /* list of free CCBs */
- struct bt_ccb *ccbhash[CCB_HASH_SIZE]; /* phys to kv hash */
- int bt_int; /* int. read off board */
- int bt_dma; /* DMA channel read of board */
- int bt_scsi_dev; /* adapters scsi id */
- int numccbs; /* how many we have malloc'd */
- int bt_bounce; /* should we bounce? */
- struct scsi_link sc_link; /* prototype for devs */
-} *btdata[NBT];
-
-/***********debug values *************/
-#define BT_SHOWCCBS 0x01
-#define BT_SHOWINTS 0x02
-#define BT_SHOWCMDS 0x04
-#define BT_SHOWMISC 0x08
-static int bt_debug = 0;
-SYSCTL_INT(_debug, OID_AUTO, bt742a_debug, CTLFLAG_RW, &bt_debug, 0, "");
-
-#ifdef KERNEL
-static int btprobe();
-static int btattach();
-static int32 bt_scsi_cmd();
-static int bt_poll __P((int unit, struct scsi_xfer *xs, struct bt_ccb *ccb));
-static void bt_timeout(void *);
-static int bt_init __P((int unit));
-static void bt_inquire_setup_information();
-static void bt_done();
-static void btminphys();
-static u_int32 bt_adapter_info();
-static struct bt_ccb *bt_get_ccb();
-static struct bt_ccb *bt_ccb_phys_kv();
-
-static int btunit = 0;
-static int btprobing = 0;
-
-struct isa_driver btdriver =
-{
- btprobe,
- btattach,
- "bt"
-};
-
-static struct scsi_adapter bt_switch =
-{
- bt_scsi_cmd,
- btminphys,
- 0,
- 0,
- bt_adapter_info,
- "bt",
- { 0, 0 }
-};
-
-/* the below structure is so we have a default dev struct for out link struct */
-static struct scsi_device bt_dev =
-{
- NULL, /* Use default error handler */
- NULL, /* have a queue, served by this */
- NULL, /* have no async handler */
- NULL, /* Use default 'done' routine */
- "bt",
- 0,
- { 0, 0 }
-};
-
-static struct kern_devconf kdc_bt[NBT] = { {
- 0, 0, 0, /* filled in by dev_attach */
- "bt", 0, { MDDT_ISA, 0, "bio" },
- isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
- &kdc_isa0, /* parent */
- 0, /* parentdata */
- DC_UNCONFIGURED, /* always start here */
- "Buslogic 742-compatible SCSI host adapter",
- DC_CLS_MISC /* host adapters aren't special */
-} };
-
-static inline void
-bt_registerdev(struct isa_device *id)
-{
- if(id->id_unit)
- kdc_bt[id->id_unit] = kdc_bt[0];
- kdc_bt[id->id_unit].kdc_unit = id->id_unit;
- kdc_bt[id->id_unit].kdc_parentdata = id;
- dev_attach(&kdc_bt[id->id_unit]);
-}
-
-#endif /*KERNEL */
-
-#define BT_RESET_TIMEOUT 1000
-#ifndef KERNEL
-main()
-{
- printf("bt_data is %d bytes\n", sizeof(struct bt_data));
- printf("bt_ccb is %d bytes\n", sizeof(struct bt_ccb));
- printf("bt_mbx is %d bytes\n", sizeof(struct bt_mbx));
-}
-
-#else /*KERNEL */
-
-/*
- * bt_cmd(unit, icnt, ocnt, wait, retval, opcode, args)
- *
- * Activate Adapter command
- * icnt: number of args (outbound bytes written after opcode)
- * ocnt: number of expected returned bytes
- * wait: number of seconds to wait for response
- * retval: buffer where to place returned bytes
- * opcode: opcode BT_NOP, BT_MBX_INIT, BT_START_SCSI ...
- * args: parameters
- *
- * Performs an adapter command through the ports. Not to be confused with a
- * scsi command, which is read in via the dma; one of the adapter commands
- * tells it to read in a scsi command.
- */
-static int
-bt_cmd(unit, icnt, ocnt, wait, retval, opcode, args)
- int unit;
- int icnt;
- int ocnt;
- int wait;
- u_char *retval;
- unsigned opcode;
- u_char args;
-{
- struct bt_data *bt = btdata[unit];
- unsigned *ic = &opcode;
- u_char oc;
- register i;
- int sts;
-
- /*
- * multiply the wait argument by a big constant
- * zero defaults to 1
- */
- if (wait)
- wait *= 100000;
- else
- wait = 100000;
- /*
- * Wait for the adapter to go idle, unless it's one of
- * the commands which don't need this
- */
- if (opcode != BT_MBX_INIT && opcode != BT_START_SCSI) {
- i = 100000; /* 1 sec? */
- while (--i) {
- sts = inb(BT_CTRL_STAT_PORT);
- if (sts & BT_IDLE) {
- break;
- }
- DELAY(10);
- }
- if (i == 0) {
- if(!btprobing)
- printf("bt%d: bt_cmd, host not idle(0x%x)\n",
- unit, sts);
- return (ENXIO);
- }
- }
- /*
- * Now that it is idle, if we expect output, preflush the
- * queue feeding to us.
- */
- if (ocnt) {
- while ((inb(BT_CTRL_STAT_PORT)) & BT_DF)
- inb(BT_CMD_DATA_PORT);
- }
- /*
- * Output the command and the number of arguments given
- * for each byte, first check the port is empty.
- */
- icnt++;
- /* include the command */
- while (icnt--) {
- sts = inb(BT_CTRL_STAT_PORT);
- for (i = wait; i; i--) {
- sts = inb(BT_CTRL_STAT_PORT);
- if (!(sts & BT_CDF))
- break;
- DELAY(10);
- }
- if (i == 0) {
- if(!btprobing)
- printf("bt%d: bt_cmd, cmd/data port full\n",
- unit);
- outb(BT_CTRL_STAT_PORT, BT_SRST);
- return (ENXIO);
- }
- outb(BT_CMD_DATA_PORT, (u_char) (*ic++));
- }
- /*
- * If we expect input, loop that many times, each time,
- * looking for the data register to have valid data
- */
- while (ocnt--) {
- sts = inb(BT_CTRL_STAT_PORT);
- for (i = wait; i; i--) {
- sts = inb(BT_CTRL_STAT_PORT);
- if (sts & BT_DF)
- break;
- DELAY(10);
- }
- if (i == 0) {
- if(!btprobing)
- printf("bt%d: bt_cmd, cmd/data port empty %d\n",
- unit, ocnt);
- return (ENXIO);
- }
- oc = inb(BT_CMD_DATA_PORT);
- if (retval)
- *retval++ = oc;
- }
- /*
- * Wait for the board to report a finised instruction
- */
- i = 100000; /* 1 sec? */
- while (--i) {
- sts = inb(BT_INTR_PORT);
- if (sts & BT_HACC) {
- break;
- }
- DELAY(10);
- }
- if (i == 0) {
- if(!btprobing)
- printf("bt%d: bt_cmd, host not finished(0x%x)\n",
- unit, sts);
- return (ENXIO);
- }
- outb(BT_CTRL_STAT_PORT, BT_IRST);
- return (0);
-}
-
-/*
- * Check if the device can be found at the port given
- * and if so, set it up ready for further work
- * as an argument, takes the isa_device structure from
- * autoconf.c
- */
-static int
-btprobe(dev)
- struct isa_device *dev;
-{
- /*
- * find unit and check we have that many defined
- */
- int unit = btunit;
- struct bt_data *bt;
-
- btprobing = 1;
- if (unit >= NBT) {
- printf("bt%d: unit number too high\n", unit);
- return 0;
- }
- /*
- * Allocate a storage area for us
- */
- if (btdata[unit]) {
- printf("bt%d: memory already allocated\n", unit);
- return 0;
- }
- bt = malloc(sizeof(struct bt_data), M_TEMP, M_NOWAIT);
- if (!bt) {
- printf("bt%d: cannot malloc!\n", unit);
- return 0;
- }
- bzero(bt, sizeof(struct bt_data));
- btdata[unit] = bt;
- if(dev->id_iobase > 0xFFF) /* an EISA card, we have an EISA port */
- {
- int i = inb(dev->id_iobase + 0x0C);
- static unsigned long bt_iobase[8] =
- { 0x330,0x334,0x230,0x234,0x130,0x134,0x00,0x00 };
-
- if (!(dev->id_iobase = bt_iobase[i&7])) {
- printf("bt_iobase disabled or invalid; index %d\n"
- ,i&7);
- return 0;
- }
-#if defined(DEBUG)
- printf("btprobe: Trying iobase 0x%x\n",dev->dev_addr);
-#endif /* defined(DEBUG) */
- }
-
- bt->bt_base = dev->id_iobase;
-
-#ifndef DEV_LKM
- bt_registerdev(dev);
-#endif /* not DEV_LKM */
-
- /*
- * Try initialise a unit at this location
- * sets up dma and bus speed, loads bt->bt_int
- */
- if (bt_init(unit) != 0) {
- btdata[unit] = NULL;
- free(bt, M_TEMP);
- return 0;
- }
- /*
- * If it's there, put in it's interrupt vectors
- */
- dev->id_unit = unit;
- dev->id_irq = (1 << bt->bt_int);
- dev->id_drq = bt->bt_dma;
-
- btunit++;
- return 1;
-}
-
-/*
- * Attach all the sub-devices we can find
- */
-static int
-btattach(dev)
- struct isa_device *dev;
-{
- int unit = dev->id_unit;
- struct bt_data *bt = btdata[unit];
- struct scsibus_data *scbus;
-
- btprobing = 0;
- /*
- * fill in the prototype scsi_link.
- */
- bt->sc_link.adapter_unit = unit;
- bt->sc_link.adapter_targ = bt->bt_scsi_dev;
- bt->sc_link.adapter = &bt_switch;
- bt->sc_link.device = &bt_dev;
- bt->sc_link.flags = bt->bt_bounce ? SDEV_BOUNCE : 0;
-
- /*
- * Prepare the scsibus_data area for the upperlevel
- * scsi code.
- */
- scbus = scsi_alloc_bus();
- /* XXX scbus->magtarg should be adjusted for Wide cards */
- if(!scbus)
- return 0;
- scbus->adapter_link = &bt->sc_link;
-
- kdc_bt[unit].kdc_state = DC_BUSY; /* host adapters are always busy */
-
- /*
- * ask the adapter what subunits are present
- */
- scsi_attachdevs(scbus);
- return 1;
-}
-
-/*
- * Return some information to the caller about the adapter and its
- * capabilities.
- */
-static u_int32
-bt_adapter_info(unit)
- int unit;
-{
- return (2); /* 2 outstanding requests at a time per device */
-}
-
-/*
- * Catch an interrupt from the adaptor
- */
-void
-btintr(unit)
- int unit;
-{
- struct bt_data *bt = btdata[unit];
- BT_MBI *wmbi;
- struct bt_mbx *wmbx;
- struct bt_ccb *ccb;
- unsigned char stat;
- int i, wait;
- int found = 0;
-
-#ifdef UTEST
- printf("btintr ");
-#endif
- /*
- * First acknowlege the interrupt, Then if it's
- * not telling about a completed operation
- * just return.
- */
- stat = inb(BT_INTR_PORT);
-
- /* Mail Box out empty ? */
- if (stat & BT_MBOA) {
- printf("bt%d: Available Free mbo post\n", unit);
- /* Disable MBO available interrupt */
- outb(BT_CMD_DATA_PORT, BT_MBO_INTR_EN);
- wait = 100000; /* 1 sec enough? */
- for (i = wait; i; i--) {
- if (!(inb(BT_CTRL_STAT_PORT) & BT_CDF))
- break;
- DELAY(10);
- }
- if (i == 0) {
- printf("bt%d: bt_intr, cmd/data port full\n", unit);
- outb(BT_CTRL_STAT_PORT, BT_SRST);
- return;
- }
- outb(BT_CMD_DATA_PORT, 0x00); /* Disable */
- wakeup((caddr_t)&bt->bt_mbx);
- outb(BT_CTRL_STAT_PORT, BT_IRST);
- return;
- }
- if (!(stat & BT_MBIF)) {
- outb(BT_CTRL_STAT_PORT, BT_IRST);
- return;
- }
- /*
- * If it IS then process the competed operation
- */
- wmbx = &bt->bt_mbx;
- wmbi = wmbx->tmbi;
- AGAIN:
- while (wmbi->stat != BT_MBI_FREE) {
- ccb = bt_ccb_phys_kv(bt, (wmbi->ccb_addr));
- if (!ccb) {
- wmbi->stat = BT_MBI_FREE;
- printf("bt: BAD CCB ADDR!\n");
- continue;
- }
- found++;
- if ((stat = wmbi->stat) != BT_MBI_OK) {
- switch (stat) {
- case BT_MBI_ABORT:
-#ifdef UTEST
- if (bt_debug & BT_SHOWMISC)
- printf("abort ");
-#endif
- ccb->host_stat = BT_ABORTED;
- break;
-
- case BT_MBI_UNKNOWN:
- ccb = (struct bt_ccb *) 0;
-#ifdef UTEST
- if (bt_debug & BT_SHOWMISC)
- printf("unknown ccb for abort");
-#endif
- break;
-
- case BT_MBI_ERROR:
- break;
-
- default:
- panic("Impossible mbxi status");
-
- }
-#ifdef UTEST
- if ((bt_debug & BT_SHOWCMDS) && ccb) {
- u_char *cp;
- cp = ccb->scsi_cmd;
- printf("op=%x %x %x %x %x %x\n",
- cp[0], cp[1], cp[2],
- cp[3], cp[4], cp[5]);
- printf("stat %x for mbi addr = 0x%08x\n"
- ,wmbi->stat, wmbi);
- printf("addr = 0x%x\n", ccb);
- }
-#endif
- }
- wmbi->stat = BT_MBI_FREE;
- if (ccb) {
- untimeout(bt_timeout, (caddr_t)ccb);
- bt_done(unit, ccb);
- }
- /* Set the IN mail Box pointer for next */ bt_nextmbx(wmbi, wmbx, mbi);
- }
- if (!found) {
- for (i = 0; i < BT_MBX_SIZE; i++) {
- if (wmbi->stat != BT_MBI_FREE) {
- found++;
- break;
- }
- bt_nextmbx(wmbi, wmbx, mbi);
- }
- if (!found) {
-#ifdef DEBUG
- printf("bt%d: mbi at 0x%08x should be found, stat=%02x..resync\n",
- unit, wmbi, stat);
-#endif
- } else {
- found = 0;
- goto AGAIN;
- }
- }
- wmbx->tmbi = wmbi;
- outb(BT_CTRL_STAT_PORT, BT_IRST);
-}
-
-/*
- * A ccb is put onto the free list.
- */
-static void
-bt_free_ccb(unit, ccb, flags)
- int unit;
- struct bt_ccb *ccb;
- int flags;
-{
- struct bt_data *bt = btdata[unit];
- unsigned int opri;
-
- opri = splbio();
-
- ccb->next = bt->bt_ccb_free;
- bt->bt_ccb_free = ccb;
- ccb->flags = CCB_FREE;
- /*
- * If there were none, wake anybody waiting for one to come free,
- * starting with queued entries.
- */
- if (!ccb->next) {
- wakeup((caddr_t)&bt->bt_ccb_free);
- }
-
- splx(opri);
-}
-
-/*
- * Get a free ccb
- *
- * If there are none, see if we can allocate a new one. If so, put it in
- * the hash table too otherwise either return an error or sleep.
- */
-static struct bt_ccb *
-bt_get_ccb(unit, flags)
- int unit;
- int flags;
-{
- struct bt_data *bt = btdata[unit];
- unsigned opri;
- struct bt_ccb *ccbp;
- int hashnum;
-
- opri = splbio();
- /*
- * If we can and have to, sleep waiting for one to come free
- * but only if we can't allocate a new one.
- */
- while (!(ccbp = bt->bt_ccb_free)) {
- if (bt->numccbs < BT_CCB_MAX) {
- if (ccbp = (struct bt_ccb *) malloc(sizeof(struct bt_ccb),
- M_TEMP,
- M_NOWAIT)) {
- bzero(ccbp, sizeof(struct bt_ccb));
- bt->numccbs++;
- ccbp->flags = CCB_ACTIVE;
- /*
- * put in the phystokv hash table
- * Never gets taken out.
- */
- ccbp->hashkey = KVTOPHYS(ccbp);
- hashnum = CCB_HASH(ccbp->hashkey);
- ccbp->nexthash = bt->ccbhash[hashnum];
- bt->ccbhash[hashnum] = ccbp;
- } else {
- printf("bt%d: Can't malloc CCB\n", unit);
- }
- goto gottit;
- } else {
- if (!(flags & SCSI_NOSLEEP)) {
- tsleep((caddr_t)&bt->bt_ccb_free, PRIBIO,
- "btccb", 0);
- continue;
- }
- break;
- }
- }
- if (ccbp) {
- /* Get CCB from from free list */
- bt->bt_ccb_free = ccbp->next;
- ccbp->flags = CCB_ACTIVE;
- }
- gottit:
- splx(opri);
-
- return (ccbp);
-}
-
-/*
- * given a physical address, find the ccb that
- * it corresponds to:
- */
-static struct bt_ccb *
-bt_ccb_phys_kv(bt, ccb_phys)
- struct bt_data *bt;
- physaddr ccb_phys;
-{
- int hashnum = CCB_HASH(ccb_phys);
- struct bt_ccb *ccbp = bt->ccbhash[hashnum];
-
- while (ccbp) {
- if (ccbp->hashkey == ccb_phys)
- break;
- ccbp = ccbp->nexthash;
- }
- return ccbp;
-}
-
-/*
- * Get a MBO and then Send it
- */
-static BT_MBO *
-bt_send_mbo(int unit, int flags, int cmd, struct bt_ccb *ccb)
-{
- struct bt_data *bt = btdata[unit];
- unsigned opri;
- BT_MBO *wmbo; /* Mail Box Out pointer */
- struct bt_mbx *wmbx; /* Mail Box pointer specified unit */
- int i, wait;
-
- wmbx = &bt->bt_mbx;
-
- opri = splbio();
-
- /* Get the Target OUT mail Box pointer and move to Next */
- wmbo = wmbx->tmbo;
- wmbx->tmbo = (wmbo == &(wmbx->mbo[BT_MBX_SIZE - 1]) ?
- &(wmbx->mbo[0]) : wmbo + 1);
-
- /*
- * Check the outmail box is free or not.
- * Note: Under the normal operation, it shuld NOT happen to wait.
- */
- while (wmbo->cmd != BT_MBO_FREE) {
- wait = 100000; /* 1 sec enough? */
- /* Enable MBO available interrupt */
- outb(BT_CMD_DATA_PORT, BT_MBO_INTR_EN);
- for (i = wait; i; i--) {
- if (!(inb(BT_CTRL_STAT_PORT) & BT_CDF))
- break;
- DELAY(10);
- }
- if (i == 0) {
- printf("bt%d: bt_send_mbo, cmd/data port full\n", unit);
- outb(BT_CTRL_STAT_PORT, BT_SRST);
- return ((BT_MBO *) 0);
- }
- outb(BT_CMD_DATA_PORT, 0x01); /* Enable */
- tsleep((caddr_t)wmbx, PRIBIO, "btsend", 0);
- /* XXX */ /*can't do this! */
- /* May be servicing an int */
- }
- /* Link CCB to the Mail Box */
- wmbo->ccb_addr = KVTOPHYS(ccb);
- ccb->mbx = wmbo;
- wmbo->cmd = cmd;
-
- /* Send it! */
- outb(BT_CMD_DATA_PORT, BT_START_SCSI);
-
- splx(opri);
-
- return (wmbo);
-}
-
-/*
- * We have a ccb which has been processed by the
- * adaptor, now we look to see how the operation
- * went. Wake up the owner if waiting
- */
-static void
-bt_done(unit, ccb)
- int unit;
- struct bt_ccb *ccb;
-{
- struct scsi_sense_data *s1, *s2;
- struct scsi_xfer *xs = ccb->xfer;
-
- SC_DEBUG(xs->sc_link, SDEV_DB2, ("bt_done\n"));
- /*
- * Otherwise, put the results of the operation
- * into the xfer and call whoever started it
- */
- if ((ccb->host_stat != BT_OK || ccb->target_stat != SCSI_OK)
- && (!(xs->flags & SCSI_ERR_OK))) {
-
- s1 = &(ccb->scsi_sense);
- s2 = &(xs->sense);
-
- if (ccb->host_stat) {
- switch (ccb->host_stat) {
- case BT_ABORTED: /* No response */
- case BT_SEL_TIMEOUT: /* No response */
- SC_DEBUG(xs->sc_link, SDEV_DB3,
- ("timeout reported back\n"));
- xs->error = XS_TIMEOUT;
- break;
- default: /* Other scsi protocol messes */
- xs->error = XS_DRIVER_STUFFUP;
- SC_DEBUG(xs->sc_link, SDEV_DB3,
- ("unexpected host_stat: %x\n",
- ccb->host_stat));
- }
- } else {
- switch (ccb->target_stat) {
- case 0x02:
- *s2 = *s1;
- xs->error = XS_SENSE;
- break;
- case 0x08:
- xs->error = XS_BUSY;
- break;
- default:
- SC_DEBUG(xs->sc_link, SDEV_DB3,
- ("unexpected target_stat: %x\n",
- ccb->target_stat));
- xs->error = XS_DRIVER_STUFFUP;
- }
- }
- } else { /* All went correctly OR errors expected */
- xs->resid = 0;
- }
- xs->flags |= ITSDONE;
- bt_free_ccb(unit, ccb, xs->flags);
- scsi_done(xs);
-}
-
-/*
- * Start the board, ready for normal operation
- */
-static int
-bt_init(unit)
- int unit;
-{
- struct bt_data *bt = btdata[unit];
- unsigned char ad[4];
- volatile int i, sts;
- struct bt_config conf;
- struct bt_ext_info info;
- struct bt_board_info binfo;
-
- /*
- * reset board, If it doesn't respond, assume
- * that it's not there.. good for the probe
- */
-
- outb(BT_CTRL_STAT_PORT, BT_HRST | BT_SRST);
-
- DELAY(10000);
-
- for (i = BT_RESET_TIMEOUT; i; i--) {
- sts = inb(BT_CTRL_STAT_PORT);
- if (sts == (BT_IDLE | BT_INIT))
- break;
- DELAY(1000);
- }
- if (i == 0) {
-#ifdef UTEST
- printf("bt_init: No answer from board\n");
-#endif
- return (ENXIO);
- }
-
- DELAY(10000);
-
- /*
- * Displaying Board ID and Hardware Revision
- * 94/05/18 amurai@spec.co.jp
- */
- i = bt_cmd(unit, 1, sizeof(binfo),0,
- &binfo,BT_GET_BOARD_INFO,sizeof(binfo));
- if(i)
- return i;
- printf("bt%d: Bt%c%c%c%c/%c%d-", unit,
- binfo.id[0],
- binfo.id[1],
- binfo.id[2],
- binfo.id[3],
- binfo.ver[0],
- (unsigned) binfo.ver[1]
- );
-
- /*
- * Make sure board has a capability of 32bit addressing.
- * and Firmware also need a capability of 32bit addressing pointer
- * in Extended mailbox and ccb structure.
- * 94/05/18 amurai@spec.co.jp
- */
- bt_cmd(unit, 1, sizeof(info),0,&info, BT_INQUIRE_EXTENDED,sizeof(info));
- switch (info.bus_type) {
- case BT_BUS_TYPE_24bit: /* PC/AT 24 bit address bus */
- printf("ISA(24bit) bus\n");
- break;
- case BT_BUS_TYPE_32bit: /* EISA/VLB/PCI 32 bit bus */
- printf("PCI/EISA/VLB(32bit) bus\n");
- break;
- case BT_BUS_TYPE_MCA: /* forget it right now */
- printf("MCA bus architecture...");
- printf("giving up\n");
- return (ENXIO);
- break;
- default:
- printf("Unknown state...");
- printf("giving up\n");
- return (ENXIO);
- break;
- }
- if ( binfo.id[0] == '4' && binfo.id[1] == '4' && binfo.id[2] == '5' &&
- binfo.id[3] == 'S' ) {
- printf("bt%d: Your card cannot DMA above 16MB boundary. Bounce buffering enabled.\n", unit);
- bt->bt_bounce++;
- } else if ( binfo.id[0] == '5' ) {
- printf("bt%d: This driver is designed for using 32 bit addressing\n",unit);
- printf("bt%d: mode firmware and EISA/PCI/VLB bus architectures\n",unit);
- printf("bt%d: Bounce-buffering will be used (and is necessary)\n", unit);
- printf("bt%d: if you have more than 16MBytes memory.\n",unit);
- bt->bt_bounce++;
- } else if ( info.bus_type == BT_BUS_TYPE_24bit ) {
- printf("bt%d: Your board should report a 32bit bus architecture type..\n",unit);
- printf("bt%d: The firmware on your board may have a problem with over\n",unit);
- printf("bt%d: 16MBytes memory handling with this driver.\n",unit);
- bt->bt_bounce++;
- }
-
- /*
- * Assume we have a board at this stage
- * setup dma channel from jumpers and save int
- * level
- */
- printf("bt%d: reading board settings, ", unit);
-
- bt_cmd(unit, 0, sizeof(conf), 0, &conf, BT_CONF_GET);
- switch (conf.chan) {
- case EISADMA:
- bt->bt_dma = -1;
- break;
- case CHAN0:
- outb(0x0b, 0x0c);
- outb(0x0a, 0x00);
- bt->bt_dma = 0;
- break;
- case CHAN5:
- outb(0xd6, 0xc1);
- outb(0xd4, 0x01);
- bt->bt_dma = 5;
- break;
- case CHAN6:
- outb(0xd6, 0xc2);
- outb(0xd4, 0x02);
- bt->bt_dma = 6;
- break;
- case CHAN7:
- outb(0xd6, 0xc3);
- outb(0xd4, 0x03);
- bt->bt_dma = 7;
- break;
- default:
- printf("illegal dma setting %x\n", conf.chan);
- return (EIO);
- }
- if (bt->bt_dma == -1)
- printf("busmastering, ");
- else
- printf("dma=%d, ", bt->bt_dma);
-
- switch (conf.intr) {
- case INT9:
- bt->bt_int = 9;
- break;
- case INT10:
- bt->bt_int = 10;
- break;
- case INT11:
- bt->bt_int = 11;
- break;
- case INT12:
- bt->bt_int = 12;
- break;
- case INT14:
- bt->bt_int = 14;
- break;
- case INT15:
- bt->bt_int = 15;
- break;
- default:
- printf("illegal int setting\n");
- return (EIO);
- }
- printf("int=%d\n", bt->bt_int);
-
- /* who are we on the scsi bus */
- bt->bt_scsi_dev = conf.scsi_dev;
- /*
- * Initialize mail box
- */
- *((physaddr *) ad) = KVTOPHYS(&bt->bt_mbx);
- bt_cmd(unit, 5, 0, 0, 0, BT_MBX_INIT_EXTENDED
- ,BT_MBX_SIZE
- ,ad[0]
- ,ad[1]
- ,ad[2]
- ,ad[3]);
-
- /*
- * Set Pointer chain null for just in case
- * Link the ccb's into a free-list W/O mbox
- * Initialize mail box status to free
- */
- if (bt->bt_ccb_free != (struct bt_ccb *) 0) {
- printf("bt%d: bt_ccb_free is NOT initialized but init here\n",
- unit);
- bt->bt_ccb_free = (struct bt_ccb *) 0;
- }
- for (i = 0; i < BT_MBX_SIZE; i++) {
- bt->bt_mbx.mbo[i].cmd = BT_MBO_FREE;
- bt->bt_mbx.mbi[i].stat = BT_MBI_FREE;
- }
- /*
- * Set up initial mail box for round-robin operation.
- */
- bt->bt_mbx.tmbo = &bt->bt_mbx.mbo[0];
- bt->bt_mbx.tmbi = &bt->bt_mbx.mbi[0];
- bt_inquire_setup_information(unit, &info);
-
- /*
- * Note that we are going and return (to probe)
- */
- return 0;
-}
-
-static void
-bt_inquire_setup_information(
- int unit,
- struct bt_ext_info *info )
-{
- struct bt_setup setup;
- struct bt_sync_value sync;
- char dummy[8];
- char sub_ver[3];
- struct bt_boardID bID;
- int i;
-
- /* Inquire Installed Devices */
- bzero( &dummy[0], sizeof(dummy) );
- bt_cmd(unit, 0, sizeof(dummy), 100, &dummy[0], BT_DEV_GET);
-
- /*
- * If board has a capbility of Syncrhonouse mode,
- * Get a SCSI Synchronous value
- */
-
- if (info->s.force) { /* Assume fast sync capability */
- info->s.sync = 1; /* It's appear at 4.25? version */
- info->s.maxsync = 1;
- }
- if ( info->s.sync ) {
- bt_cmd(unit, 1, sizeof(sync), 100,
- &sync,BT_GET_SYNC_VALUE,sizeof(sync));
- }
-
- /*
- * Inquire Board ID to board for firmware version
- */
- bt_cmd(unit, 0, sizeof(bID), 0, &bID, BT_INQUIRE);
- bt_cmd(unit, 0, 1, 0, &sub_ver[0], BT_INQUIRE_REV_THIRD );
- i = ((int)(bID.firm_revision-'0')) * 10 + (int)(bID.firm_version-'0');
- if ( i >= 33 ) {
- bt_cmd(unit, 0, 1, 0, &sub_ver[1], BT_INQUIRE_REV_FOURTH );
- } else {
- /*
- * Below rev 3.3 firmware has a problem for issuing
- * the BT_INQUIRE_REV_FOURTH command.
- */
- sub_ver[1]='\0';
- }
- sub_ver[2]='\0';
- if (sub_ver[1]==' ')
- sub_ver[1]='\0';
- printf("bt%d: version %c.%c%s, ",
- unit, bID.firm_revision, bID.firm_version, sub_ver );
-
- /*
- * Obtain setup information from board.
- */
- bt_cmd(unit, 1, sizeof(setup), 0, &setup, BT_SETUP_GET, sizeof(setup));
-
- if (setup.sync_neg && info->s.sync ) {
- if ( info->s.maxsync ) {
- printf("fast sync, "); /* Max 10MB/s */
- } else {
- printf("sync, "); /* Max 5MB/s */
- }
- } else {
- if ( info->s.sync ) {
- printf("async, "); /* Never try by board */
- } else {
- printf("async only, "); /* Doesn't has a capability on board */
- }
- }
- if (setup.parity) {
- printf("parity, ");
- } else {
- printf("no parity, ");
- }
- printf("%d mbxs, %d ccbs\n", setup.num_mbx, BT_CCB_MAX);
-
- /*
- * Displayi SCSI negotiation value by each target.
- * amurai@spec.co.jp
- */
- for (i = 0; i < 8; i++) {
- if (!setup.sync[i].valid )
- continue;
- if ( (!setup.sync[i].offset && !setup.sync[i].period)
- || !info->s.sync ) {
- printf("bt%d: targ %d async\n", unit, i);
- } else {
- printf("bt%d: targ %d sync rate=%2d.%02dMB/s(%dns), offset=%02d\n",
- unit, i,
- 100 / sync.value[i],
- (100 % sync.value[i]) * 100 / sync.value[i],
- sync.value[i] * 10,
- setup.sync[i].offset );
- }
- }
-
- /*
- * Enable round-robin scheme - appeared at firmware rev. 3.31
- * Below rev 3.XX firmware has a problem for issuing
- * BT_ROUND_ROBIN command amurai@spec.co.jp
- */
- if ( bID.firm_revision >= '3' ) {
- printf("bt%d: Using Strict Round robin scheme\n", unit);
- bt_cmd(unit, 1, 0, 0, 0, BT_ROUND_ROBIN, BT_STRICT_ROUND_ROBIN);
- } else {
- printf("bt%d: Not using Strict Round robin scheme\n", unit);
- }
-
-}
-
-#ifndef min
-#define min(x,y) (x < y ? x : y)
-#endif /* min */
-
-static void
-btminphys(bp)
- struct buf *bp;
-{
- if (bp->b_bcount > ((BT_NSEG - 1) * PAGESIZ)) {
- bp->b_bcount = ((BT_NSEG - 1) * PAGESIZ);
- }
-}
-
-/*
- * start a scsi operation given the command and the data address. Also needs
- * the unit, target and lu.
- */
-static int32
-bt_scsi_cmd(xs)
- struct scsi_xfer *xs;
-{
- struct bt_ccb *ccb;
- struct bt_scat_gath *sg;
- int seg; /* scatter gather seg being worked on */
- int thiskv;
- physaddr thisphys, nextphys;
- int unit = xs->sc_link->adapter_unit;
- int bytes_this_seg, bytes_this_page, datalen, flags;
-
- SC_DEBUG(xs->sc_link, SDEV_DB2, ("bt_scsi_cmd\n"));
- /*
- * get a ccb (mbox-out) to use. If the transfer
- * is from a buf (possibly from interrupt time)
- * then we can't allow it to sleep
- */
- flags = xs->flags;
- if (flags & ITSDONE) {
- printf("bt%d: Already done?\n", unit);
- xs->flags &= ~ITSDONE;
- }
- if (!(flags & INUSE)) {
- printf("bt%d: Not in use?\n", unit);
- xs->flags |= INUSE;
- }
- if (!(ccb = bt_get_ccb(unit, flags))) {
- xs->error = XS_DRIVER_STUFFUP;
- return (TRY_AGAIN_LATER);
- }
- SC_DEBUG(xs->sc_link, SDEV_DB3,
- ("start ccb(%p)\n", ccb));
- /*
- * Put all the arguments for the xfer in the ccb
- */
- ccb->xfer = xs;
- if (flags & SCSI_RESET) {
- ccb->opcode = BT_RESET_CCB;
- } else {
- /* can't use S/G if zero length */
- ccb->opcode = (xs->datalen ?
- BT_INIT_SCAT_GATH_CCB
- : BT_INITIATOR_CCB);
- }
- ccb->target = xs->sc_link->target;
- ccb->data_out = 0;
- ccb->data_in = 0;
- ccb->lun = xs->sc_link->lun;
- ccb->scsi_cmd_length = xs->cmdlen;
- ccb->sense_ptr = KVTOPHYS(&(ccb->scsi_sense));
- ccb->req_sense_length = sizeof(ccb->scsi_sense);
-
- if ((xs->datalen) && (!(flags & SCSI_RESET))) { /* can use S/G only if not zero length */
- ccb->data_addr = KVTOPHYS(ccb->scat_gath);
- sg = ccb->scat_gath;
- seg = 0;
-#ifdef TFS
- if (flags & SCSI_DATA_UIO) {
- iovp = ((struct uio *) xs->data)->uio_iov;
- datalen = ((struct uio *) xs->data)->uio_iovcnt;
- xs->datalen = 0;
- while ((datalen) && (seg < BT_NSEG)) {
- sg->seg_addr = (physaddr) iovp->iov_base;
- xs->datalen += sg->seg_len = iovp->iov_len;
- SC_DEBUGN(xs->sc_link, SDEV_DB4, ("(0x%x@0x%x)"
- ,iovp->iov_len, iovp->iov_base));
- sg++;
- iovp++;
- seg++;
- datalen--;
- }
- } else
-#endif /* TFS */
- {
- /*
- * Set up the scatter gather block
- */
-
- SC_DEBUG(xs->sc_link, SDEV_DB4,
- ("%ld @%p:- ", xs->datalen, xs->data));
- datalen = xs->datalen;
- thiskv = (int) xs->data;
- thisphys = KVTOPHYS(thiskv);
-
- while ((datalen) && (seg < BT_NSEG)) {
- bytes_this_seg = 0;
-
- /* put in the base address */
- sg->seg_addr = thisphys;
-
- SC_DEBUGN(xs->sc_link, SDEV_DB4,
- ("0x%lx", thisphys));
-
- /* do it at least once */
- nextphys = thisphys;
- while ((datalen) && (thisphys == nextphys))
- /*
- * This page is contiguous (physically) with
- * the the last, just extend the length
- */
- {
- /* how far to the end of the page */
- nextphys = (thisphys & (~(PAGESIZ - 1)))
- + PAGESIZ;
- bytes_this_page = nextphys - thisphys;
- /**** or the data ****/
- bytes_this_page = min(bytes_this_page
- ,datalen);
- bytes_this_seg += bytes_this_page;
- datalen -= bytes_this_page;
-
- /* get more ready for the next page */
- thiskv = (thiskv & (~(PAGESIZ - 1)))
- + PAGESIZ;
- if (datalen)
- thisphys = KVTOPHYS(thiskv);
- }
- /*
- * next page isn't contiguous, finish the seg
- */
- SC_DEBUGN(xs->sc_link, SDEV_DB4,
- ("(0x%x)", bytes_this_seg));
- sg->seg_len = bytes_this_seg;
- sg++;
- seg++;
- }
- }
- /* end of iov/kv decision */
- ccb->data_length = seg * sizeof(struct bt_scat_gath);
- SC_DEBUGN(xs->sc_link, SDEV_DB4, ("\n"));
- if (datalen) {
- /*
- * there's still data, must have run out of segs!
- */
- printf("bt%d: bt_scsi_cmd, more than %d DMA segs\n",
- unit, BT_NSEG);
- xs->error = XS_DRIVER_STUFFUP;
- bt_free_ccb(unit, ccb, flags);
- return (HAD_ERROR);
- }
- } else { /* No data xfer, use non S/G values */
- ccb->data_addr = (physaddr) 0;
- ccb->data_length = 0;
- }
- ccb->link_id = 0;
- ccb->link_addr = (physaddr) 0;
- /*
- * Put the scsi command in the ccb and start it
- */
- if (!(flags & SCSI_RESET)) {
- bcopy(xs->cmd, ccb->scsi_cmd, ccb->scsi_cmd_length);
- }
- if (bt_send_mbo(unit, flags, BT_MBO_START, ccb) == (BT_MBO *) 0) {
- xs->error = XS_DRIVER_STUFFUP;
- bt_free_ccb(unit, ccb, flags);
- return (TRY_AGAIN_LATER);
- }
- /*
- * Usually return SUCCESSFULLY QUEUED
- */
- SC_DEBUG(xs->sc_link, SDEV_DB3, ("cmd_sent\n"));
- if (!(flags & SCSI_NOMASK)) {
- timeout(bt_timeout, (caddr_t)ccb, (xs->timeout * hz) / 1000);
- return (SUCCESSFULLY_QUEUED);
- }
- /*
- * If we can't use interrupts, poll on completion
- */
- return (bt_poll(unit, xs, ccb));
-}
-
-/*
- * Poll a particular unit, looking for a particular xs
- */
-static int
-bt_poll(unit, xs, ccb)
- int unit;
- struct scsi_xfer *xs;
- struct bt_ccb *ccb;
-{
- struct bt_data *bt = btdata[unit];
- int count = xs->timeout;
- u_char stat;
-
- /* timeouts are in msec, so we loop in 1000 usec cycles */
- while (count) {
- /*
- * If we had interrupts enabled, would we
- * have got an interrupt?
- */
- stat = inb(BT_INTR_PORT);
- if (stat & BT_ANY_INTR) {
- btintr(unit);
- }
- if (xs->flags & ITSDONE) {
- break;
- }
- DELAY(1000); /* only happens in boot so ok */
- count--;
- }
- if (count == 0) {
- /*
- * We timed out, so call the timeout handler manually,
- * accounting for the fact that the clock is not running yet
- * by taking out the clock queue entry it makes.
- */
- bt_timeout(ccb);
-
- /*
- * because we are polling, take out the timeout entry
- * bt_timeout made
- */
- untimeout(bt_timeout, (caddr_t)ccb);
- count = 2000;
- while (count) {
- /*
- * Once again, wait for the int bit
- */
- stat = inb(BT_INTR_PORT);
- if (stat & BT_ANY_INTR) {
- btintr(unit);
- }
- if (xs->flags & ITSDONE) {
- break;
- }
- DELAY(1000); /* only happens in boot so ok */
- count--;
- }
- if (count == 0) {
- /*
- * We timed out again... This is bad. Notice that
- * this time there is no clock queue entry to remove.
- */
- bt_timeout(ccb);
- }
- }
- if (xs->error)
- return (HAD_ERROR);
- return (COMPLETE);
-}
-
-static void
-bt_timeout(void *arg1)
-{
- struct bt_ccb * ccb = (struct bt_ccb *)arg1;
- int unit;
- struct bt_data *bt;
- int s = splbio();
-
- /*
- * A timeout routine in kernel DONOT unlink
- * Entry chains when time outed....So infinity Loop..
- * 94/04/20 amurai@spec.co.jp
- */
- untimeout(bt_timeout, (caddr_t)ccb);
-
- unit = ccb->xfer->sc_link->adapter_unit;
- bt = btdata[unit];
-
-#ifdef UTEST
- bt_print_active_ccbs(unit);
-#endif
-
- /*
- * If the ccb's mbx is not free, then the board has gone Far East?
- */
- if (bt_ccb_phys_kv(bt, ccb->mbx->ccb_addr) == ccb &&
- ccb->mbx->cmd != BT_MBO_FREE) {
- printf("bt%d: not taking commands!\n", unit);
- Debugger("bt742a");
- }
- /*
- * If it has been through before, then
- * a previous abort has failed, don't
- * try abort again
- */
- if (ccb->flags == CCB_ABORTED) {
- /*
- * abort timed out
- */
- printf("bt%d: Abort Operation has timed out\n", unit);
- ccb->xfer->retries = 0; /* I MEAN IT ! */
- ccb->host_stat = BT_ABORTED;
- bt_done(unit, ccb);
- } else {
- /* abort the operation that has timed out */
- printf("bt%d: Try to abort\n", unit);
- bt_send_mbo(unit, ~SCSI_NOMASK,
- BT_MBO_ABORT, ccb);
- /* 2 secs for the abort */
- ccb->flags = CCB_ABORTED;
- timeout(bt_timeout, (caddr_t)ccb, 2 * hz);
- }
- splx(s);
-}
-
-#ifdef UTEST
-static void
-bt_print_ccb(ccb)
- struct bt_ccb *ccb;
-{
- printf("ccb:%x op:%x cmdlen:%d senlen:%d\n"
- ,ccb
- ,ccb->opcode
- ,ccb->scsi_cmd_length
- ,ccb->req_sense_length);
- printf(" datlen:%d hstat:%x tstat:%x flags:%x\n"
- ,ccb->data_length
- ,ccb->host_stat
- ,ccb->target_stat
- ,ccb->flags);
-}
-
-static void
-bt_print_active_ccbs(int unit)
-{
- struct bt_data *bt = btdata[unit];
- struct bt_ccb *ccb;
- int i = 0;
-
- while (i < CCB_HASH_SIZE) {
- ccb = bt->ccbhash[i];
- while (ccb) {
- if (ccb->flags != CCB_FREE)
- bt_print_ccb(ccb);
- ccb = ccb->nexthash;
- }
- i++;
- }
-}
-#endif /*UTEST */
-#endif /*KERNEL */
diff --git a/sys/i386/isa/creative.h b/sys/i386/isa/creative.h
deleted file mode 100644
index ed7e1dd..0000000
--- a/sys/i386/isa/creative.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*creative.h-------------------------------------------------------------------
- Matsushita(Panasonic) / Creative CD-ROM Driver (matcd)
- Authored by Frank Durda IV
-
- Copyright 1994, 1995 Frank Durda IV. All rights reserved.
- "FDIV" is a trademark of Frank Durda IV.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
- 1. Redistributions of source code must retain the above copyright
- notice positioned at the very beginning of this file without
- modification, all copyright strings, all related programming
- codes that display the copyright strings, this list of
- conditions and the following disclaimer.
- 2. Redistributions in binary form must contain all copyright strings
- and related programming code that display the copyright strings.
- 3. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- 4. All advertising materials mentioning features or use of this
- software must display the following acknowledgement:
- "The Matsushita/Panasonic CD-ROM driver was developed
- by Frank Durda IV for use with "FreeBSD" and similar
- operating systems."
- "Similar operating systems" includes mainly non-profit oriented
- systems for research and education, including but not restricted
- to "NetBSD", "386BSD", and "Mach" (by CMU). The wording of the
- acknowledgement (in electronic form or printed text) may not be
- changed without permission from the author.
- 5. Absolutely no warranty of function, fitness or purpose is made
- by the author Frank Durda IV.
- 6. Neither the name of the author nor the name "FreeBSD" may
- be used to endorse or promote products derived from this software
- without specific prior written permission.
- (The author can be reached at bsdmail@nemesis.lonestar.org)
- 7. The product containing this software must meet all of these
- conditions even if it is unsupported, not a complete system
- and/or does not contain compiled code.
- 8. These conditions will be in force for the full life of the
- copyright.
- 9. If all the above conditions are met, modifications to other
- parts of this file may be freely made, although any person
- or persons making changes do not receive the right to add their
- name or names to the copyright strings and notices in this
- software. Persons making changes are encouraged to insert edit
- history in matcd.c and to put your name and details of the
- change there.
- 10. You must have prior written permission from the author to
- deviate from these terms.
-
- Vendors who produce product(s) containing this code are encouraged
- (but not required) to provide copies of the finished product(s) to
- the author and to correspond with the author about development
- activity relating to this code. Donations of development hardware
- and/or software are also welcome. (This is one of the faster ways
- to get a driver developed for a device.)
-
- THIS SOFTWARE IS PROVIDED BY THE DEVELOPER(S) ``AS IS'' AND ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER(S) BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
-See matcd.c for Edit History
-
- These are the I/O port mapping offsets and bit assignments used
- by Creative Labs in their implementation of the host interface for
- the Matsushita CD-ROM drive. These may be different in the adapter
- cards (including sound cards) made by other vendors.
- It is unknown if the Creative interface is based on a reference design
- provided by Matsushita (other interface vendors would similar or
- identical if this was the case).
-
- The drive is actually capable of some things that the Creative
- interface doesn't implement, such as DMA and interrupts.
-
- See matcd.h for defines related to the Matsushita drive itself.
-*/
-
-
-/* Creative Labs (and compatible) I/O port mapping offsets
-*/
-
-#define NUMPORTS 4 /*Four ports are decoded by the i/f*/
-
-#define CMD 0 /*Write - commands*/
-#define DATA 0 /*Read - data/status from drive*/
-#define PHASE 1 /*Write - switch between data/status*/
-#define STATUS 1 /*Read - buss status*/
-#define RESET 2 /*Write - reset all attached drives*/
- /*Any value written will reset*/
-#define SELECT 3 /*Write - drive select*/
-
-
-/* Creative PHASE port bit assignments
-*/
-
-#define PHASENA 1 /*Access data bytes instead of status*/
-
-
-/* Creative STATUS port register bits
-*/
-
-#define DTEN 2 /*When low, in data xfer phase*/
-#define STEN 4 /*When low, in status phase*/
-#define TEST 1 /*Function is unknown*/
-
-
-/* Creative drive SELECT port bit assignments
- Note that in the Creative interface, DS0==Bit 1 and
- DS1==Bit 0 (DS is Drive Select).
-*/
-
-#define CRDRIVE0 0x00
-#define CRDRIVE1 0x02
-#define CRDRIVE2 0x01
-#define CRDRIVE3 0x03
-
-/*End of creative.h*/
-
-
diff --git a/sys/i386/isa/ic/ncr_5380.h b/sys/i386/isa/ic/ncr_5380.h
deleted file mode 100644
index 0a05bff..0000000
--- a/sys/i386/isa/ic/ncr_5380.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- *
- * $Id$
- *
- * Definitions for 5380 SCSI-controller chip.
- *
- * Derived from "NCR 53C80 Family SCSI Protocol Controller Data Manual"
- */
-
-#ifndef _IC_NCR_5380_H_
-#define _IC_NCR_5380_H_
-
-#if 0 /* XXX */
-/*
- * Register map
- */
-
-typedef struct {
- volatile u_char sci_data; /* r: Current data */
-#define sci_odata sci_data /* w: Out data */
-
- volatile u_char sci_icmd; /* rw:Initiator command */
-
- volatile u_char sci_mode; /* rw:Mode */
-
- volatile u_char sci_tcmd; /* rw:Target command */
-
- volatile u_char sci_bus_csr;/* r: Bus Status */
-#define sci_sel_enb sci_bus_csr /* w: Select enable */
-
- volatile u_char sci_csr; /* r: Status */
-#define sci_dma_send sci_csr /* w: Start dma send data */
-
- volatile u_char sci_idata; /* r: Input data */
-#define sci_trecv sci_idata /* w: Start dma recv, target */
-
- volatile u_char sci_iack; /* r: Interrupt Acknowledge */
-#define sci_irecv sci_iack /* w: Start dma recv, initiator */
-} sci_regmap_t;
-
-
-/*
- * Initiator command register
- */
-
-#define SCI_ICMD_DATA 0x01 /* rw:Assert data bus */
-#define SCI_ICMD_ATN 0x02 /* rw:Assert ATN signal */
-#define SCI_ICMD_SEL 0x04 /* rw:Assert SEL signal */
-#define SCI_ICMD_BSY 0x08 /* rw:Assert BSY signal */
-#define SCI_ICMD_ACK 0x10 /* rw:Assert ACK signal */
-#define SCI_ICMD_LST 0x20 /* r: Lost arbitration */
-#define SCI_ICMD_DIFF SCI_ICMD_LST /* w: Differential cable */
-#define SCI_ICMD_AIP 0x40 /* r: Arbitration in progress */
-#define SCI_ICMD_TEST SCI_ICMD_AIP /* w: Test mode */
-#define SCI_ICMD_RST 0x80 /* rw:Assert RST signal */
-
-
-/*
- * Mode register
- */
-
-#define SCI_MODE_ARB 0x01 /* rw: Start arbitration */
-#define SCI_MODE_DMA 0x02 /* rw: Enable DMA xfers */
-#define SCI_MODE_MONBSY 0x04 /* rw: Monitor BSY signal */
-#define SCI_MODE_DMA_IE 0x08 /* rw: Enable DMA complete interrupt */
-#define SCI_MODE_PERR_IE 0x10 /* rw: Interrupt on parity errors */
-#define SCI_MODE_PAR_CHK 0x20 /* rw: Check parity */
-#define SCI_MODE_TARGET 0x40 /* rw: Target mode (Initiator if 0) */
-#define SCI_MODE_BLOCKDMA 0x80 /* rw: Block-mode DMA handshake (MBZ) */
-
-
-/*
- * Target command register
- */
-
-#define SCI_TCMD_IO 0x01 /* rw: Assert I/O signal */
-#define SCI_TCMD_CD 0x02 /* rw: Assert C/D signal */
-#define SCI_TCMD_MSG 0x04 /* rw: Assert MSG signal */
-#define SCI_TCMD_PHASE_MASK 0x07 /* r: Mask for current bus phase */
-#define SCI_TCMD_REQ 0x08 /* rw: Assert REQ signal */
-#define SCI_TCMD_LAST_SENT 0x80 /* ro: Last byte was xferred
- * (not on 5380/1) */
-
-#define SCI_PHASE(x) SCSI_PHASE(x)
-
-/*
- * Current (SCSI) Bus status
- */
-
-#define SCI_BUS_DBP 0x01 /* r: Data Bus parity */
-#define SCI_BUS_SEL 0x02 /* r: SEL signal */
-#define SCI_BUS_IO 0x04 /* r: I/O signal */
-#define SCI_BUS_CD 0x08 /* r: C/D signal */
-#define SCI_BUS_MSG 0x10 /* r: MSG signal */
-#define SCI_BUS_REQ 0x20 /* r: REQ signal */
-#define SCI_BUS_BSY 0x40 /* r: BSY signal */
-#define SCI_BUS_RST 0x80 /* r: RST signal */
-
-#define SCI_CUR_PHASE(x) SCSI_PHASE((x)>>2)
-
-/*
- * Bus and Status register
- */
-
-#define SCI_CSR_ACK 0x01 /* r: ACK signal */
-#define SCI_CSR_ATN 0x02 /* r: ATN signal */
-#define SCI_CSR_DISC 0x04 /* r: Disconnected (BSY==0) */
-#define SCI_CSR_PHASE_MATCH 0x08 /* r: Bus and SCI_TCMD match */
-#define SCI_CSR_INT 0x10 /* r: Interrupt request */
-#define SCI_CSR_PERR 0x20 /* r: Parity error */
-#define SCI_CSR_DREQ 0x40 /* r: DMA request */
-#define SCI_CSR_DONE 0x80 /* r: DMA count is zero */
-
-#endif /* XXX */
-
-#define R_CSDR 0 /* R Current SCSI Data Reg. */
-#define W_ODR 0 /* W Output Data Reg. */
-
-#define R_ICR 1 /* R Initiator Command Reg. */
-#define R_ICR_ASSERT_RST 0x80
-#define R_ICR_ARBITRATION_IN_PROGRESS 0x40
-#define R_ICR_LOST_ARBITRATION 0x20
-#define R_ICR_ASSERT_ACK 0x10
-#define R_ICR_ASSERT_BSY 0x08
-#define R_ICR_ASSERT_SEL 0x04
-#define R_ICR_ASSERT_ATN 0x02
-#define R_ICR_ASSERT_DATA_BUS 0x01
-
-#define W_ICR 1 /* W Initiator Command Reg. */
-#define W_ICR_ASSERT_RST 0x80
-#define W_ICR_TRI_STATE_MODE 0x40
-#define W_ICR_DIFF_ENABLE 0x20
-#define W_ICR_ASSERT_ACK 0x10
-#define W_ICR_ASSERT_BSY 0x08
-#define W_ICR_ASSERT_SEL 0x04
-#define W_ICR_ASSERT_ATN 0x02
-#define W_ICR_ASSERT_DATA_BUS 0x01
-
-/*
- * The mask to use when doing read_modify_write on ICR.
- */
-#define RW_ICR_MASK (~(W_ICR_DIFF_ENABLE|W_ICR_TRI_STATE_MODE))
-
-#define RW_MR 2 /* RW Mode Reg. */
-#define RW_MR_BLOCK_MODE_DMA 0x80
-#define RW_MR_TARGET_MODE 0x40
-#define RW_MR_ENABLE_PARITY_CHECKING 0x20
-#define RW_MR_ENABLE_PARITY_INTERRUPT 0x10
-#define RW_MR_ENABLE_EOP_INTERRUPT 0x08
-#define RW_MR_MONITOR_BUSY 0x04
-#define RW_MR_DMA_MODE 0x02
-#define RW_MR_ARBITRATE 0x01
-
-#define R_TCR 3 /* R Target Command Reg. */
-#define R_TCR_LAST_BYTE_SENT 0x80
-/* R_TCR_RESERVED 0x40 */
-/* R_TCR_RESERVED 0x20 */
-/* R_TCR_RESERVED 0x10 */
-#define R_TCR_ASSERT_REQ 0x08
-#define R_TCR_ASSERT_MSG 0x04
-#define R_TCR_ASSERT_CD 0x02
-#define R_TCR_ASSERT_IO 0x01
-
-#define W_TCR 3 /* W Target Command Reg. */
-/* W_TCR_RESERVED 0x80 */
-/* W_TCR_RESERVED 0x40 */
-/* W_TCR_RESERVED 0x20 */
-/* W_TCR_RESERVED 0x10 */
-#define W_TCR_ASSERT_REQ 0x08
-#define W_TCR_ASSERT_MSG 0x04
-#define W_TCR_ASSERT_CD 0x02
-#define W_TCR_ASSERT_IO 0x01
-
-#define R_CSCR 4 /* R Current SCSI Bus Status Reg. */
-#define R_CSCR_RST 0x80
-#define R_CSCR_BSY 0x40
-#define R_CSCR_REQ 0x20
-#define R_CSCR_MSG 0x10
-#define R_CSCR_CD 0x08
-#define R_CSCR_IO 0x04
-#define R_CSCR_SEL 0x02
-#define R_CSCR_ACK 0x01
-
-#define W_SER 4 /* W Select Enable Reg. */
-#define W_SER_SCSI_ID_7 0x80
-#define W_SER_SCSI_ID_6 0x40
-#define W_SER_SCSI_ID_5 0x20
-#define W_SER_SCSI_ID_4 0x10
-#define W_SER_SCSI_ID_3 0x08
-#define W_SER_SCSI_ID_2 0x04
-#define W_SER_SCSI_ID_1 0x02
-#define W_SER_SCSI_ID_0 0x01
-
-#define R_BSR 5 /* R Bus and Status Reg. */
-#define R_BSR_END_OF_DMA_XFER 0x80
-#define R_BSR_DMA_REQUEST 0x40
-#define R_BSR_PARITY_ERROR 0x20
-#define R_BSR_INTERRUPT_REQUEST_ACTIVE 0x10
-#define R_BSR_PHASE_MISMATCH 0x08
-#define R_BSR_BUSY_ERROR 0x04
-#define R_BSR_ATN 0x02
-#define R_BSR_ACK 0x01
-
-#define W_SDSR 5 /* W Start DMA Send Reg. */
-#define R_IDR 6 /* R Input Data Reg. */
-#define W_SDTR 6 /* W Start DMA Target Receive Reg. */
-#define R_RPIR 7 /* R Reset Parity/Interrupt Reg. */
-#define W_SDIR 7 /* W Start DMA Initiator Receive Reg. */
-
-#endif /* _IC_NCR_5380_H_ */
diff --git a/sys/i386/isa/if_is.c b/sys/i386/isa/if_is.c
deleted file mode 100644
index b374c10..0000000
--- a/sys/i386/isa/if_is.c
+++ /dev/null
@@ -1,1102 +0,0 @@
-/*
- * Isolan AT 4141-0 Ethernet driver
- * Isolink 4110
- *
- * By Paul Richards
- *
- * Copyright (C) 1993, Paul Richards. This software may be used, modified,
- * copied, distributed, and sold, in both source and binary form provided
- * that the above copyright and these terms are retained. Under no
- * circumstances is the author responsible for the proper functioning
- * of this software, nor does the author assume any responsibility
- * for damages incurred with its use.
- *
- * $Id: if_is.c,v 1.32 1994/11/24 14:29:22 davidg Exp $
- */
-
-/* TODO
-
-1) Add working multicast support
-2) Use better allocation of memory to card
-3) Advertise for more packets until all transmit buffers are full
-4) Add more of the timers/counters e.g. arpcom.opackets etc.
-*/
-
-#include "is.h"
-#if NIS > 0
-
-#include "bpfilter.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/syslog.h>
-#include <sys/devconf.h>
-
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/if_types.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-#endif
-
-#ifdef NS
-#include <netns/ns.h>
-#include <netns/ns_if.h>
-#endif
-
-#if NBPFILTER > 0
-#include <net/bpf.h>
-#include <net/bpfdesc.h>
-#endif
-
-#include <i386/isa/isa_device.h>
-#include <i386/isa/if_isreg.h>
-#include <i386/isa/icu.h>
-
-#include <vm/vm.h>
-
-#define ETHER_MIN_LEN 64
-#define ETHER_MAX_LEN 1518
-#define ETHER_ADDR_LEN 6
-
-char *card_type[] = {"Unknown",
- "BICC Isolan",
- "NE2100"};
-
-char *ic_type[] = {"Unknown",
- "Am7990 LANCE",
- "Am79960 PCnet_ISA"};
-
-
-struct is_softc {
- struct arpcom arpcom; /* Ethernet common part */
- int iobase;
- int rap;
- int rdp;
- int ic_type; /* Am 7990 or Am79960 */
- int card_type;
- int is_debug;
- struct init_block *init_block; /* Lance initialisation block */
- struct mds *rd;
- struct mds *td;
- unsigned char *rbuf;
- unsigned char *tbuf;
- int last_rd;
- int last_td;
- int no_td;
- caddr_t bpf; /* BPF "magic cookie" */
-
-} is_softc[NIS] ;
-
-
-/* Function prototypes */
-static int is_probe(struct isa_device *);
-static int is_attach(struct isa_device *);
-static void is_watchdog(int);
-static int is_ioctl(struct ifnet *, int, caddr_t);
-static void is_init(int);
-static void is_start(struct ifnet *);
-static void istint(int);
-#ifdef ISDEBUG
-static void recv_print(int, int);
-static void xmit_print(int, int);
-#endif ISDEBUG
-static int ne2100_probe(int);
-static int bicc_probe(int);
-static int lance_probe(int);
-
-
-
-static inline void is_rint(int unit);
-static inline void isread(struct is_softc*, unsigned char*, int);
-
-struct mbuf *isget();
-
-struct isa_driver isdriver = {
- is_probe,
- is_attach,
- "is"
-};
-
-void
-iswrcsr(unit,port,val)
- int unit;
- u_short port;
- u_short val;
-{
- outw(is_softc[unit].rap,port);
- outw(is_softc[unit].rdp,val);
-}
-
-u_short isrdcsr(unit,port)
- int unit;
- u_short port;
-{
- outw(is_softc[unit].rap,port);
- return(inw(is_softc[unit].rdp));
-}
-
-static struct kern_devconf kdc_is[NIS] = { {
- 0, 0, 0, /* filled in by dev_attach */
- "is", 0, { MDDT_ISA, 0, "net" },
- isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
- &kdc_isa0, /* parent */
- 0, /* parentdata */
- DC_BUSY, /* network interfaces are always busy */
- "Isolan AT 4141-0, Isolink 4110, or NE2100 Ethernet adapter"
-} };
-
-static inline void
-is_registerdev(struct isa_device *id)
-{
- if(id->id_unit)
- kdc_is[id->id_unit] = kdc_is[0];
- kdc_is[id->id_unit].kdc_unit = id->id_unit;
- kdc_is[id->id_unit].kdc_isa = id;
- dev_attach(&kdc_is[id->id_unit]);
-}
-
-int
-is_probe(isa_dev)
- struct isa_device *isa_dev;
-{
- int unit = isa_dev->id_unit ;
- int nports;
-
- is_softc[unit].iobase = isa_dev->id_iobase;
-
- /*
- * It's impossible to do a non-invasive probe of the
- * LANCE and PCnet_ISA. The LANCE requires setting the
- * STOP bit to access the registers and the PCnet_ISA
- * address port resets to an unknown state!!
- */
-
- /*
- * Check for BICC cards first since for the NE2100 and
- * PCnet-ISA cards this write will hit the Address PROM.
- */
-
-#ifdef DEBUG
- printf("Dumping io space for is%d starting at %x\n",unit,is_softc[unit].iobase);
- for (i=0; i< 32; i++)
- printf(" %x ",inb(is_softc[unit].iobase+i));
- printf("\n");
-#endif /* DEBUG*/
-
- nports = bicc_probe(unit);
- if (nports)
- return (nports);
- nports = ne2100_probe(unit);
- if (nports)
- return (nports);
-
-
- return (0);
-}
-
-int
-ne2100_probe(unit)
- int unit;
-{
-struct is_softc *is = &is_softc[unit];
-int i;
-
- is->rap = is->iobase + NE2100_RAP;
- is->rdp = is->iobase + NE2100_RDP;
-
- is->ic_type = lance_probe(unit);
- if (is->ic_type) {
- is->card_type = NE2100;
- /*
- * Extract the physical MAC address from ROM
- */
- for(i=0;i<ETHER_ADDR_LEN;i++)
- is->arpcom.ac_enaddr[i]=inb(is->iobase+i);
-
- /*
- * Return number of I/O ports used by card
- */
- return (24);
- }
- return (0);
-}
-
-
-int
-bicc_probe(unit)
- int unit;
-{
-struct is_softc *is = &is_softc[unit];
-int i;
-
- is->rap = is->iobase + BICC_RAP;
- is->rdp = is->iobase + BICC_RDP;
-
- is->ic_type = lance_probe(unit);
- if (is->ic_type) {
- is->card_type = BICC;
-
- /*
- * Extract the physical ethernet address from ROM
- */
-
- for(i=0;i<ETHER_ADDR_LEN;i++)
- is->arpcom.ac_enaddr[i]=inb(is->iobase+(i*2));
-
- /*
- * Return number of I/O ports used by card
- */
- return (16);
- }
- return (0);
-}
-
-
-/*
- * Determine which, if any, of the LANCE or
- * PCnet-ISA are present on the card.
- */
-
-int
-lance_probe(unit)
- int unit;
-{
-int type=0;
-
- /*
- * Have to reset the LANCE to get any
- * stable information from it.
- */
-
- iswrcsr(unit,0,STOP);
- DELAY(100);
-
- if (isrdcsr(unit,0) != STOP)
- /*
- * This either isn't a LANCE
- * or there's a major problem.
- */
- return(0);
-
- /*
- * Depending on which controller it is, CSR3 will have
- * different settable bits. Write to them all and see which ones
- * get set.
- */
-
- iswrcsr(unit,3, LANCE_MASK);
-
- if (isrdcsr(unit,3) == LANCE_MASK)
- type = LANCE;
-
- if (isrdcsr(unit,3) == PCnet_ISA_MASK)
- type = PCnet_ISA;
-
- return (type);
-}
-
-/*
- * Reset of interface.
- */
-static void
-is_reset(int unit)
-{
- if (unit >= NIS)
- return;
- printf("is%d: reset\n", unit);
- is_init(unit);
-}
-
-/*
- * Interface exists: make available by filling in network interface
- * record. System will initialize the interface when it is ready
- * to accept packets. We get the ethernet address here.
- */
-int
-is_attach(isa_dev)
- struct isa_device *isa_dev;
-{
- int unit = isa_dev->id_unit;
- struct is_softc *is = &is_softc[unit];
- struct ifnet *ifp = &is->arpcom.ac_if;
- struct ifaddr *ifa;
- struct sockaddr_dl *sdl;
-
- ifp->if_unit = unit;
- ifp->if_name = isdriver.name ;
- ifp->if_mtu = ETHERMTU;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS;
- ifp->if_init = is_init;
- ifp->if_output = ether_output;
- ifp->if_start = is_start;
- ifp->if_ioctl = is_ioctl;
- ifp->if_reset = is_reset;
- ifp->if_watchdog = is_watchdog;
-
- /*
- * XXX -- not sure this is right place to do this
- * Allocate memory for use by Lance
- * Memory allocated for:
- * initialisation block,
- * ring descriptors,
- * transmit and receive buffers.
- */
-
- /*
- * XXX - hopefully have better way to get dma'able memory later,
- * this code assumes that the physical memory address returned
- * from malloc will be below 16Mb. The Lance's address registers
- * are only 16 bits wide!
- */
-
-#define ISMAXMEM ((NRBUF+NTBUF)*(BUFSIZE) + (NRBUF+NTBUF)*sizeof(struct mds) \
- + sizeof(struct init_block) + 8)
- is->init_block = (struct init_block *)malloc(ISMAXMEM,M_TEMP,M_NOWAIT);
- if (!is->init_block) {
- printf("is%d : Couldn't allocate memory for card\n",unit);
- }
- /*
- * XXX -- should take corrective action if not
- * quadword alilgned, the 8 byte slew factor in ISMAXMEM
- * allows for this.
- */
-
- if ((u_long)is->init_block & 0x3)
- printf("is%d: memory allocated not quadword aligned\n",
- isa_dev->id_unit);
-
- /* Set up DMA */
- isa_dmacascade(isa_dev->id_drq);
-
- if_attach(ifp);
- is_registerdev(isa_dev);
-
- /*
- * Search down the ifa address list looking
- * for the AF_LINK type entry
- */
-
- ifa = ifp->if_addrlist;
- while ((ifa != 0) && (ifa->ifa_addr != 0) &&
- (ifa->ifa_addr->sa_family != AF_LINK))
- ifa = ifa->ifa_next;
-
- /*
- * If we find an AF_LINK type entry, we will fill
- * in the hardware address for this interface.
- */
-
- if ((ifa != 0) && (ifa->ifa_addr != 0)) {
-
- /*
- * Fill in the link level address for this interface
- */
-
- sdl = (struct sockaddr_dl *)ifa->ifa_addr;
- sdl->sdl_type = IFT_ETHER;
- sdl->sdl_alen = ETHER_ADDR_LEN;
- sdl->sdl_slen = 0;
- bcopy(is->arpcom.ac_enaddr, LLADDR(sdl), ETHER_ADDR_LEN);
- }
-
- printf ("is%d: address %s\n", unit,
- ether_sprintf(is->arpcom.ac_enaddr)) ;
- printf("%s, %s\n",ic_type[is->ic_type],card_type[is->card_type]);
-
-#if NBPFILTER > 0
- bpfattach(&is->bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
-#endif
- return 1;
-}
-
-static void
-is_watchdog(unit)
- int unit;
-{
- log(LOG_ERR, "is%d: device timeout\n", unit);
- is_reset(unit);
-}
-
-
-/* Lance initialisation block set up */
-void
-init_mem(unit)
- int unit;
-{
- int i;
- void *temp;
- struct is_softc *is = &is_softc[unit];
-
- /*
- * At this point we assume that the
- * memory allocated to the Lance is
- * quadword aligned. If it isn't
- * then the initialisation is going
- * fail later on.
- */
-
-
- /*
- * Set up lance initialisation block
- */
-
- temp = (void *)is->init_block;
- temp += sizeof(struct init_block);
- is->rd = (struct mds *) temp;
- is->td = (struct mds *) (temp + (NRBUF*sizeof(struct mds)));
- temp += (NRBUF+NTBUF) * sizeof(struct mds);
-
- is->init_block->mode = 0;
- for (i=0; i<ETHER_ADDR_LEN; i++)
- is->init_block->padr[i] = is->arpcom.ac_enaddr[i];
- for (i = 0; i < 8; ++i)
- is->init_block->ladrf[i] = MULTI_INIT_ADDR;
- is->init_block->rdra = kvtop(is->rd);
- is->init_block->rlen = ((kvtop(is->rd) >> 16) & 0xff) | (RLEN<<13);
- is->init_block->tdra = kvtop(is->td);
- is->init_block->tlen = ((kvtop(is->td) >> 16) & 0xff) | (TLEN<<13);
-
-
- /*
- * Set up receive ring descriptors
- */
-
- is->rbuf = (unsigned char *)temp;
- for (i=0; i<NRBUF; i++) {
- (is->rd+i)->addr = kvtop(temp);
- (is->rd+i)->flags= ((kvtop(temp) >> 16) & 0xff) | OWN;
- (is->rd+i)->bcnt = -BUFSIZE;
- (is->rd+i)->mcnt = 0;
- temp += BUFSIZE;
- }
-
- /*
- * Set up transmit ring descriptors
- */
-
- is->tbuf = (unsigned char *)temp;
- for (i=0; i<NTBUF; i++) {
- (is->td+i)->addr = kvtop(temp);
- (is->td+i)->flags= ((kvtop(temp) >> 16) & 0xff);
- (is->td+i)->bcnt = 0;
- (is->td+i)->mcnt = 0;
- temp += BUFSIZE;
- }
-
-}
-
-/*
- * Initialization of interface; set up initialization block
- * and transmit/receive descriptor rings.
- */
-
-static void
-is_init(unit)
- int unit;
-{
- register struct is_softc *is = &is_softc[unit];
- struct ifnet *ifp = &is->arpcom.ac_if;
- int s;
- register i;
-
- /* Address not known */
- if (ifp->if_addrlist == (struct ifaddr *)0) return;
-
- s = splimp();
-
- /*
- * Lance must be stopped
- * to access registers.
- */
-
- iswrcsr(unit,0,STOP);
-
- is->last_rd = is->last_td = is->no_td = 0;
-
- /* Set up lance's memory area */
- init_mem(unit);
-
- /* No byte swapping etc */
- iswrcsr(unit,3,0);
-
- /* Give lance the physical address of its memory area */
- iswrcsr(unit,1,kvtop(is->init_block));
- iswrcsr(unit,2,(kvtop(is->init_block) >> 16) & 0xff);
-
- /* OK, let's try and initialise the Lance */
- iswrcsr(unit,0,INIT);
-
- /* Wait for initialisation to finish */
- for(i=0; i<1000; i++){
- if (isrdcsr(unit,0)&IDON)
- break;
- }
- if (isrdcsr(unit,0)&IDON) {
- /* Start lance */
- iswrcsr(unit,0,STRT|IDON|INEA);
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
-
- is_start(ifp);
- }
- else
- printf("is%d: card failed to initialise\n", unit);
-
- (void) splx(s);
-}
-
-/*
- * Setup output on interface.
- * Get another datagram to send off of the interface queue,
- * and map it to the interface before starting the output.
- * called only at splimp or interrupt level.
- */
-static void
-is_start(ifp)
- struct ifnet *ifp;
-{
- int unit = ifp->if_unit;
- register struct is_softc *is = &is_softc[unit];
- struct mbuf *m0, *m;
- unsigned char *buffer;
- u_short len;
- struct mds *cdm;
-
-
- if ((is->arpcom.ac_if.if_flags & IFF_RUNNING) == 0)
- return;
-
- do {
- cdm = (is->td + is->last_td);
- if (cdm->flags&OWN)
- return;
-
- IF_DEQUEUE(&is->arpcom.ac_if.if_snd, m);
-
- if (m == 0)
- return;
-
- /*
- * Copy the mbuf chain into the transmit buffer
- */
-
- buffer = is->tbuf+(BUFSIZE*is->last_td);
- len=0;
- for (m0=m; m != 0; m=m->m_next) {
- bcopy(mtod(m,caddr_t),buffer,m->m_len);
- buffer += m->m_len;
- len += m->m_len;
- }
-#if NBPFILTER > 0
- if (is->bpf) {
- bpf_mtap(is->bpf, m0);
- }
-#endif
-
-
- m_freem(m0);
- len = max(len,ETHER_MIN_LEN);
-
- /*
- * Init transmit registers, and set transmit start flag.
- */
-
- cdm->flags |= (OWN|STP|ENP);
- cdm->bcnt = -len;
- cdm->mcnt = 0;
-#ifdef ISDEBUG
- if (is->is_debug)
- xmit_print(unit,is->last_td);
-#endif
-
- iswrcsr(unit,0,TDMD|INEA);
- if (++is->last_td >= NTBUF)
- is->last_td=0;
- }while(++is->no_td < NTBUF);
- is->no_td = NTBUF;
- is->arpcom.ac_if.if_flags |= IFF_OACTIVE;
-#ifdef ISDEBUG
- if (is->is_debug)
- printf("no_td = %x, last_td = %x\n",is->no_td, is->last_td);
-#endif
-}
-
-
-/*
- * Controller interrupt.
- */
-void
-isintr(unit)
- int unit;
-{
- register struct is_softc *is = &is_softc[unit];
- u_short isr;
-
- while((isr=isrdcsr(unit,0))&INTR) {
- if (isr&ERR) {
- if (isr&BABL){
- printf("is%d: BABL\n",unit);
- is->arpcom.ac_if.if_oerrors++;
- }
- if (isr&CERR) {
- printf("is%d: CERR\n",unit);
- is->arpcom.ac_if.if_collisions++;
- }
- if (isr&MISS) {
- printf("is%d: MISS\n",unit);
- is->arpcom.ac_if.if_ierrors++;
- }
- if (isr&MERR)
- printf("is%d: MERR\n",unit);
- iswrcsr(unit,0,BABL|CERR|MISS|MERR|INEA);
- }
- if (!(isr&RXON)) {
- printf("is%d: !(isr&RXON)\n", unit);
- is->arpcom.ac_if.if_ierrors++;
- is_reset(unit);
- return;
- }
- if (!(isr&TXON)) {
- printf("is%d: !(isr&TXON)\n", unit);
- is->arpcom.ac_if.if_oerrors++;
- is_reset(unit);
- return;
- }
-
- if (isr&RINT) {
- /* reset watchdog timer */
- is->arpcom.ac_if.if_timer = 0;
- is_rint(unit);
- }
- if (isr&TINT) {
- /* reset watchdog timer */
- is->arpcom.ac_if.if_timer = 0;
- iswrcsr(unit,0,TINT|INEA);
- istint(unit);
- }
- }
-}
-
-static void
-istint(unit)
- int unit;
-{
- struct is_softc *is = &is_softc[unit];
- register struct ifnet *ifp = &is->arpcom.ac_if;
- int i,loopcount=0;
- struct mds *cdm;
-
- is->arpcom.ac_if.if_opackets++;
- do {
- if ((i=is->last_td - is->no_td) < 0)
- i+=NTBUF;
- cdm = (is->td+i);
-#ifdef ISDEBUG
- if (is->is_debug)
- printf("Trans cdm = %x\n",cdm);
-#endif
- if (cdm->flags&OWN) {
- if (loopcount)
- break;
- return;
- }
- loopcount++;
- is->arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
- }while(--is->no_td > 0);
- is_start(ifp);
-
-}
-
-#define NEXTRDS \
- if (++rmd == NRBUF) rmd=0, cdm=is->rd; else ++cdm
-
-/* only called from one place, so may as well integrate */
-static inline void is_rint(int unit)
-{
- register struct is_softc *is=&is_softc[unit];
- register int rmd = is->last_rd;
- struct mds *cdm = (is->rd + rmd);
-
- /* Out of sync with hardware, should never happen */
-
- if (cdm->flags & OWN) {
- printf("is%d: error: out of sync\n",unit);
- iswrcsr(unit,0,RINT|INEA);
- return;
- }
-
- /* Process all buffers with valid data */
- while (!(cdm->flags&OWN)) {
- /* Clear interrupt to avoid race condition */
- iswrcsr(unit,0,RINT|INEA);
- if (cdm->flags&ERR) {
- if (cdm->flags&FRAM)
- printf("is%d: FRAM\n",unit);
- if (cdm->flags&OFLO)
- printf("is%d: OFLO\n",unit);
- if (cdm->flags&CRC)
- printf("is%d: CRC\n",unit);
- if (cdm->flags&RBUFF)
- printf("is%d: RBUFF\n",unit);
- }else
- if (cdm->flags&(STP|ENP) != (STP|ENP)) {
- do {
- iswrcsr(unit,0,RINT|INEA);
- cdm->mcnt = 0;
- cdm->flags |= OWN;
- NEXTRDS;
- }while (!(cdm->flags&(OWN|ERR|STP|ENP)));
- is->last_rd = rmd;
- printf("is%d: Chained buffer\n",unit);
- if ((cdm->flags & (OWN|ERR|STP|ENP)) != ENP) {
- is_reset(unit);
- return;
- }
- }else
- {
-#ifdef ISDEBUG
- if (is->is_debug)
- recv_print(unit,is->last_rd);
-#endif
- isread(is,is->rbuf+(BUFSIZE*rmd),(int)cdm->mcnt);
- is->arpcom.ac_if.if_ipackets++;
- }
-
- cdm->flags |= OWN;
- cdm->mcnt = 0;
- NEXTRDS;
-#ifdef ISDEBUG
- if (is->is_debug)
- printf("is->last_rd = %x, cdm = %x\n",is->last_rd,cdm);
-#endif
- } /* while */
- is->last_rd = rmd;
-} /* is_rint */
-
-
-/*
- * Pass a packet to the higher levels.
- * We deal with the trailer protocol here.
- */
-static inline void
-isread(struct is_softc *is, unsigned char *buf, int len)
-{
- register struct ether_header *eh;
- struct mbuf *m;
-
- eh = (struct ether_header *)buf;
- len = len - sizeof(struct ether_header) - 4;
-
- if (len == 0) return;
-
- /*
- * Pull packet off interface. Off is nonzero if packet
- * has trailing header; neget will then force this header
- * information to be at the front, but we still have to drop
- * the type and length which are at the front of any trailer data.
- */
- m = isget(buf, len, 0, &is->arpcom.ac_if);
- if (m == 0) return;
-#if NBPFILTER > 0
- /*
- * Check if there's a BPF listener on this interface.
- * If so, hand off the raw packet to bpf.
- */
- if (is->bpf) {
- bpf_mtap(is->bpf, m);
-
- /*
- * Note that the interface cannot be in promiscuous mode if
- * there are no BPF listeners. And if we are in promiscuous
- * mode, we have to check if this packet is really ours.
- *
- * XXX This test does not support multicasts.
- */
- if ((is->arpcom.ac_if.if_flags & IFF_PROMISC) &&
- bcmp(eh->ether_dhost, is->arpcom.ac_enaddr,
- sizeof(eh->ether_dhost)) != 0 &&
- bcmp(eh->ether_dhost, etherbroadcastaddr,
- sizeof(eh->ether_dhost)) != 0) {
-
- m_freem(m);
- return;
- }
- }
-#endif
-
-
- ether_input(&is->arpcom.ac_if, eh, m);
-}
-
-/*
- * Supporting routines
- */
-
-/*
- * Pull read data off a interface.
- * Len is length of data, with local net header stripped.
- * Off is non-zero if a trailer protocol was used, and
- * gives the offset of the trailer information.
- * We copy the trailer information and then all the normal
- * data into mbufs. When full cluster sized units are present
- * we copy into clusters.
- */
-struct mbuf *
-isget(buf, totlen, off0, ifp)
- caddr_t buf;
- int totlen, off0;
- struct ifnet *ifp;
-{
- struct mbuf *top, **mp, *m;
- int off = off0, len;
- register caddr_t cp = buf;
- char *epkt;
-
- buf += sizeof(struct ether_header);
- cp = buf;
- epkt = cp + totlen;
-
-
- if (off) {
- cp += off + 2 * sizeof(u_short);
- totlen -= 2 * sizeof(u_short);
- }
-
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m == 0)
- return (0);
- m->m_pkthdr.rcvif = ifp;
- m->m_pkthdr.len = totlen;
- m->m_len = MHLEN;
- top = 0;
- mp = &top;
- while (totlen > 0) {
- if (top) {
- MGET(m, M_DONTWAIT, MT_DATA);
- if (m == 0) {
- m_freem(top);
- return (0);
- }
- m->m_len = MLEN;
- }
- len = min(totlen, epkt - cp);
- if (len >= MINCLSIZE) {
- MCLGET(m, M_DONTWAIT);
- if (m->m_flags & M_EXT)
- m->m_len = len = min(len, MCLBYTES);
- else
- len = m->m_len;
- } else {
- /*
- * Place initial small packet/header at end of mbuf.
- */
- if (len < m->m_len) {
- if (top == 0 && len + max_linkhdr <= m->m_len)
- m->m_data += max_linkhdr;
- m->m_len = len;
- } else
- len = m->m_len;
- }
- bcopy(cp, mtod(m, caddr_t), (unsigned)len);
- cp += len;
- *mp = m;
- mp = &m->m_next;
- totlen -= len;
- if (cp == epkt)
- cp = buf;
- }
- return (top);
-}
-
-
-/*
- * Process an ioctl request.
- */
-int
-is_ioctl(ifp, cmd, data)
- register struct ifnet *ifp;
- int cmd;
- caddr_t data;
-{
- register struct ifaddr *ifa = (struct ifaddr *)data;
- int unit = ifp->if_unit;
- register struct is_softc *is=&is_softc[unit];
- struct ifreq *ifr = (struct ifreq *)data;
- int s, error = 0;
-
- s = splimp();
-
- switch (cmd) {
-
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
-
- switch (ifa->ifa_addr->sa_family) {
-#ifdef INET
- case AF_INET:
- is_init(ifp->if_unit); /* before arpwhohas */
- arp_ifinit((struct arpcom *)ifp, ifa);
- break;
-#endif
-#ifdef NS
- /*
- * XXX - This code is probably wrong
- */
- case AF_NS:
- {
- register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
-
- if (ns_nullhost(*ina))
- ina->x_host =
- *(union ns_host *)(is->arpcom.ac_enaddr);
- else {
- /*
- *
- */
- bcopy((caddr_t)ina->x_host.c_host,
- (caddr_t)is->arpcom.ac_enaddr,
- sizeof(is->arpcom.ac_enaddr));
- }
- /*
- * Set new address
- */
- is_init(ifp->if_unit);
- break;
- }
-#endif
- default:
- is_init(ifp->if_unit);
- break;
- }
- break;
-
- case SIOCSIFFLAGS:
- /*
- * If interface is marked down and it is running, then stop it
- */
- if ((ifp->if_flags & IFF_UP) == 0 &&
- ifp->if_flags & IFF_RUNNING) {
- iswrcsr(unit,0,STOP);
- ifp->if_flags &= ~IFF_RUNNING;
- } else {
- /*
- * If interface is marked up and it is stopped, then start it
- */
- if ((ifp->if_flags & IFF_UP) &&
- (ifp->if_flags & IFF_RUNNING) == 0)
- is_init(ifp->if_unit);
- }
-#ifdef ISDEBUG
- if (ifp->if_flags & IFF_DEBUG)
- is->is_debug = 1;
- else
- is->is_debug = 0;
-#endif
-#if NBPFILTER > 0
- if (ifp->if_flags & IFF_PROMISC) {
- /*
- * Set promiscuous mode on interface.
- * XXX - for multicasts to work, we would need to
- * write 1's in all bits of multicast
- * hashing array. For now we assume that
- * this was done in is_init().
- */
- is->init_block->mode = PROM;
- } else
- /*
- * XXX - for multicasts to work, we would need to
- * rewrite the multicast hashing array with the
- * proper hash (would have been destroyed above).
- */
- { /* Don't know about this */};
-#endif
- break;
-
-#ifdef notdef
- case SIOCGHWADDR:
- bcopy((caddr_t)is->arpcom.ac_enaddr, (caddr_t) &ifr->ifr_data,
- sizeof(is->arpcom.ac_enaddr));
- break;
-#endif
-
- case SIOCSIFMTU:
-
- /*
- * Set the interface MTU.
- */
- if (ifr->ifr_mtu > ETHERMTU) {
- error = EINVAL;
- } else {
- ifp->if_mtu = ifr->ifr_mtu;
- }
- break;
-
- default:
- error = EINVAL;
- }
- (void) splx(s);
- return (error);
-}
-
-#ifdef ISDEBUG
-staic void
-recv_print(unit,no)
- int unit,no;
-{
- register struct is_softc *is=&is_softc[unit];
- struct mds *rmd;
- int len,i,printed=0;
-
- rmd = (is->rd+no);
- len = rmd->mcnt;
- printf("is%d: Receive buffer %d, len = %d\n",unit,no,len);
- printf("is%d: Status %x\n",unit,isrdcsr(unit,0));
- for (i=0; i<len; i++) {
- if (!printed) {
- printed=1;
- printf("is%d: data: ", unit);
- }
- printf("%x ",*(is->rbuf+(BUFSIZE*no)+i));
- }
- if (printed)
- printf("\n");
-}
-
-static void
-xmit_print(unit,no)
- int unit,no;
-{
- register struct is_softc *is=&is_softc[unit];
- struct mds *rmd;
- int i, printed=0;
- u_short len;
-
- rmd = (is->td+no);
- len = -(rmd->bcnt);
- printf("is%d: Transmit buffer %d, len = %d\n",unit,no,len);
- printf("is%d: Status %x\n",unit,isrdcsr(unit,0));
- printf("is%d: addr %x, flags %x, bcnt %x, mcnt %x\n",
- unit,rmd->addr,rmd->flags,rmd->bcnt,rmd->mcnt);
- for (i=0; i<len; i++) {
- if (!printed) {
- printed = 1;
- printf("is%d: data: ", unit);
- }
- printf("%x ",*(is->tbuf+(BUFSIZE*no)+i));
- }
- if (printed)
- printf("\n");
-}
-#endif /* ISDEBUG */
-
-#endif /* NIS > 0 */
diff --git a/sys/i386/isa/if_isreg.h b/sys/i386/isa/if_isreg.h
deleted file mode 100644
index b4b4ece..0000000
--- a/sys/i386/isa/if_isreg.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Isolan AT 4141-0 Ethernet driver header file
- * Isolink 4110
- *
- * By Paul Richards
- *
- * Copyright (C) 1993, Paul Richards. This software may be used, modified,
- * copied, distributed, and sold, in both source and binary form provided
- * that the above copyright and these terms are retained. Under no
- * circumstances is the author responsible for the proper functioning
- * of this software, nor does the author assume any responsibility
- * for damages incurred with its use.
- *
- * $Id: if_isreg.h,v 1.3 1993/10/24 04:27:00 paul Exp $
- */
-
-/*
- * Initialize multicast address hashing registers to accept
- * all multicasts (only used when in promiscuous mode)
- */
-#if NBPFILTER > 0
-#define MULTI_INIT_ADDR 0xff
-#else
-#define MULTI_INIT_ADDR 0
-#endif
-
-/* Declarations specific to this driver */
-#define NTBUF 2
-#define TLEN 1
-#define NRBUF 8
-#define RLEN 3
-#define BUFSIZE 1518
-#define BICC_RDP 0xc
-#define BICC_RAP 0xe
-#define NE2100_RDP 0x10
-#define NE2100_RAP 0x12
-
-/* Board types */
-#define BICC 1
-#define NE2100 2
-
-/* Am7990 or Am79960 */
-#define LANCE 1
-#define LANCE_MASK 0x07
-#define PCnet_ISA 2
-#define PCnet_ISA_MASK 0x0
-
-
-/* Control and status register 0 flags */
-
-#define ERR 0x8000
-#define BABL 0x4000
-#define CERR 0x2000
-#define MISS 0x1000
-#define MERR 0x0800
-#define RINT 0x0400
-#define TINT 0x0200
-#define IDON 0x0100
-#define INTR 0x0080
-#define INEA 0x0040
-#define RXON 0x0020
-#define TXON 0x0010
-#define TDMD 0x0008
-#define STOP 0x0004
-#define STRT 0x0002
-#define INIT 0x0001
-
-/* Coontrol and status register 3 flags */
-
-#define BSWP 0x0004
-#define ACON 0x0002
-#define BCON 0x0001
-
-/* Initialisation block (must be on word boundary) */
-
-struct init_block {
- u_short mode; /* Mode register */
- u_char padr[6]; /* Ethernet address */
- u_char ladrf[8]; /* Logical address filter (multicast) */
- u_short rdra; /* Low order pointer to receive ring */
- u_short rlen; /* High order pointer and no. rings */
- u_short tdra; /* Low order pointer to transmit ring */
- u_short tlen; /* High order pointer and no rings */
- };
-
-/* Mode settings */
-
-#define PROM 0x8000 /* Promiscuous */
-#define INTL 0x0040 /* Internal loopback */
-#define DRTY 0x0020 /* Disable retry */
-#define COLL 0x0010 /* Force collision */
-#define DTCR 0x0008 /* Disable transmit crc */
-#define LOOP 0x0004 /* Loop back */
-#define DTX 0x0002 /* Disable transmitter */
-#define DRX 0x0001 /* Disable receiver */
-
-/* Message descriptor structure */
-
-struct mds {
- u_short addr;
- u_short flags;
- u_short bcnt;
- u_short mcnt;
- };
-
-/* Receive ring status flags */
-
-#define OWN 0x8000 /* Owner bit, 0=host, 1=Lance */
-#define MDERR 0x4000 /* Error */
-#define FRAM 0x2000 /* Framing error error */
-#define OFLO 0x1000 /* Silo overflow */
-#define CRC 0x0800 /* CRC error */
-#define RBUFF 0x0400 /* Buffer error */
-#define STP 0x0200 /* Start of packet */
-#define ENP 0x0100 /* End of packet */
-
-/* Transmit ring flags */
-
-#define MORE 0x1000 /* More than 1 retry */
-#define ONE 0x0800 /* One retry */
-#define DEF 0x0400 /* Deferred transmit */
-
-/* Transmit errors */
-
-#define TBUFF 0x8000 /* Buffer error */
-#define UFLO 0x4000 /* Silo underflow */
-#define LCOL 0x1000 /* Late collision */
-#define LCAR 0x0800 /* Loss of carrier */
-#define RTRY 0x0400 /* Tried 16 times */
diff --git a/sys/i386/isa/if_zereg.h b/sys/i386/isa/if_zereg.h
deleted file mode 100644
index 7eefd61..0000000
--- a/sys/i386/isa/if_zereg.h
+++ /dev/null
@@ -1,859 +0,0 @@
-/*
- * National Semiconductor DS8390 NIC register definitions
- *
- * if_edreg.h,v
- * Revision 1.1.2.1 1993/07/21 13:50:04 cgd
- * from davidg:
- * Added config file override for memory size and added flags to force
- * 8bit or 16bit operation, and a flag to disable transmitter double buffering.
- * See the updated "ed.relnotes" file for information about how to set
- * the flags.
- * This should be considered the first "production" release. It still
- * needs a manual page, though.
- *
- * Revision 1.1 1993/07/03 12:21:07 cgd
- * add support for David Greenman "ed" driver
- *
- * Revision 1.2 93/06/23 03:03:05 davidg
- * added some additional definitions for the 83C584 bus interface
- * chip (SMC/WD boards)
- *
- * Revision 1.1 93/06/23 03:01:07 davidg
- * Initial revision
- *
- */
-
-/*
- * Page 0 register offsets
- */
-#define ZE_P0_CR 0x00 /* Command Register */
-
-#define ZE_P0_CLDA0 0x01 /* Current Local DMA Addr low (read) */
-#define ZE_P0_PSTART 0x01 /* Page Start register (write) */
-
-#define ZE_P0_CLDA1 0x02 /* Current Local DMA Addr high (read) */
-#define ZE_P0_PSTOP 0x02 /* Page Stop register (write) */
-
-#define ZE_P0_BNRY 0x03 /* Boundary Pointer */
-
-#define ZE_P0_TSR 0x04 /* Transmit Status Register (read) */
-#define ZE_P0_TPSR 0x04 /* Transmit Page Start (write) */
-
-#define ZE_P0_NCR 0x05 /* Number of Collisions Reg (read) */
-#define ZE_P0_TBCR0 0x05 /* Transmit Byte count, low (write) */
-
-#define ZE_P0_FIFO 0x06 /* FIFO register (read) */
-#define ZE_P0_TBCR1 0x06 /* Transmit Byte count, high (write) */
-
-#define ZE_P0_ISR 0x07 /* Interrupt Status Register */
-
-#define ZE_P0_CRDA0 0x08 /* Current Remote DMA Addr low (read) */
-#define ZE_P0_RSAR0 0x08 /* Remote Start Address low (write) */
-
-#define ZE_P0_CRDA1 0x09 /* Current Remote DMA Addr high (read) */
-#define ZE_P0_RSAR1 0x09 /* Remote Start Address high (write) */
-
-#define ZE_P0_RBCR0 0x0a /* Remote Byte Count low (write) */
-
-#define ZE_P0_RBCR1 0x0b /* Remote Byte Count high (write) */
-
-#define ZE_P0_RSR 0x0c /* Receive Status (read) */
-#define ZE_P0_RCR 0x0c /* Receive Configuration Reg (write) */
-
-#define ZE_P0_CNTR0 0x0d /* frame alignment error counter (read) */
-#define ZE_P0_TCR 0x0d /* Transmit Configuration Reg (write) */
-
-#define ZE_P0_CNTR1 0x0e /* CRC error counter (read) */
-#define ZE_P0_DCR 0x0e /* Data Configuration Reg (write) */
-
-#define ZE_P0_CNTR2 0x0f /* missed packet counter (read) */
-#define ZE_P0_IMR 0x0f /* Interrupt Mask Register (write) */
-
-/*
- * Page 1 register offsets
- */
-#define ZE_P1_CR 0x00 /* Command Register */
-#define ZE_P1_PAR0 0x01 /* Physical Address Register 0 */
-#define ZE_P1_PAR1 0x02 /* Physical Address Register 1 */
-#define ZE_P1_PAR2 0x03 /* Physical Address Register 2 */
-#define ZE_P1_PAR3 0x04 /* Physical Address Register 3 */
-#define ZE_P1_PAR4 0x05 /* Physical Address Register 4 */
-#define ZE_P1_PAR5 0x06 /* Physical Address Register 5 */
-#define ZE_P1_CURR 0x07 /* Current RX ring-buffer page */
-#define ZE_P1_MAR0 0x08 /* Multicast Address Register 0 */
-#define ZE_P1_MAR1 0x09 /* Multicast Address Register 1 */
-#define ZE_P1_MAR2 0x0a /* Multicast Address Register 2 */
-#define ZE_P1_MAR3 0x0b /* Multicast Address Register 3 */
-#define ZE_P1_MAR4 0x0c /* Multicast Address Register 4 */
-#define ZE_P1_MAR5 0x0d /* Multicast Address Register 5 */
-#define ZE_P1_MAR6 0x0e /* Multicast Address Register 6 */
-#define ZE_P1_MAR7 0x0f /* Multicast Address Register 7 */
-
-/*
- * Page 2 register offsets
- */
-#define ZE_P2_CR 0x00 /* Command Register */
-#define ZE_P2_PSTART 0x01 /* Page Start (read) */
-#define ZE_P2_CLDA0 0x01 /* Current Local DMA Addr 0 (write) */
-#define ZE_P2_PSTOP 0x02 /* Page Stop (read) */
-#define ZE_P2_CLDA1 0x02 /* Current Local DMA Addr 1 (write) */
-#define ZE_P2_RNPP 0x03 /* Remote Next Packet Pointer */
-#define ZE_P2_TPSR 0x04 /* Transmit Page Start (read) */
-#define ZE_P2_LNPP 0x05 /* Local Next Packet Pointer */
-#define ZE_P2_ACU 0x06 /* Address Counter Upper */
-#define ZE_P2_ACL 0x07 /* Address Counter Lower */
-#define ZE_P2_RCR 0x0c /* Receive Configuration Register (read) */
-#define ZE_P2_TCR 0x0d /* Transmit Configuration Register (read) */
-#define ZE_P2_DCR 0x0e /* Data Configuration Register (read) */
-#define ZE_P2_IMR 0x0f /* Interrupt Mask Register (read) */
-
-/*
- * Command Register (CR) definitions
- */
-
-/*
- * STP: SToP. Software reset command. Takes the controller offline. No
- * packets will be received or transmitted. Any reception or
- * transmission in progress will continue to completion before
- * entering reset state. To exit this state, the STP bit must
- * reset and the STA bit must be set. The software reset has
- * executed only when indicated by the RST bit in the ISR being
- * set.
- */
-#define ZE_CR_STP 0x01
-
-/*
- * STA: STArt. This bit is used to activate the NIC after either power-up,
- * or when the NIC has been put in reset mode by software command
- * or error.
- */
-#define ZE_CR_STA 0x02
-
-/*
- * TXP: Transmit Packet. This bit must be set to indicate transmission of
- * a packet. TXP is internally reset either after the transmission is
- * completed or aborted. This bit should be set only after the Transmit
- * Byte Count and Transmit Page Start register have been programmed.
- */
-#define ZE_CR_TXP 0x04
-
-/*
- * RD0, RD1, RD2: Remote DMA Command. These three bits control the operation
- * of the remote DMA channel. RD2 can be set to abort any remote DMA
- * command in progress. The Remote Byte Count registers should be cleared
- * when a remote DMA has been aborted. The Remote Start Addresses are not
- * restored to the starting address if the remote DMA is aborted.
- *
- * RD2 RD1 RD0 function
- * 0 0 0 not allowed
- * 0 0 1 remote read
- * 0 1 0 remote write
- * 0 1 1 send packet
- * 1 X X abort
- */
-#define ZE_CR_RD0 0x08
-#define ZE_CR_RD1 0x10
-#define ZE_CR_RD2 0x20
-
-/*
- * PS0, PS1: Page Select. The two bits select which register set or 'page' to
- * access.
- *
- * PS1 PS0 page
- * 0 0 0
- * 0 1 1
- * 1 0 2
- * 1 1 reserved
- */
-#define ZE_CR_PS0 0x40
-#define ZE_CR_PS1 0x80
-/* bit encoded aliases */
-#define ZE_CR_PAGE_0 0x00 /* (for consistency) */
-#define ZE_CR_PAGE_1 0x40
-#define ZE_CR_PAGE_2 0x80
-
-/*
- * Interrupt Status Register (ISR) definitions
- */
-
-/*
- * PRX: Packet Received. Indicates packet received with no errors.
- */
-#define ZE_ISR_PRX 0x01
-
-/*
- * PTX: Packet Transmitted. Indicates packet transmitted with no errors.
- */
-#define ZE_ISR_PTX 0x02
-
-/*
- * RXE: Receive Error. Indicates that a packet was received with one or more
- * the following errors: CRC error, frame alignment error, FIFO overrun,
- * missed packet.
- */
-#define ZE_ISR_RXE 0x04
-
-/*
- * TXE: Transmission Error. Indicates that an attempt to transmit a packet
- * resulted in one or more of the following errors: excessive
- * collisions, FIFO underrun.
- */
-#define ZE_ISR_TXE 0x08
-
-/*
- * OVW: OverWrite. Indicates a receive ring-buffer overrun. Incoming network
- * would exceed (has exceeded?) the boundry pointer, resulting in data
- * that was previously received and not yet read from the buffer to be
- * overwritten.
- */
-#define ZE_ISR_OVW 0x10
-
-/*
- * CNT: Counter Overflow. Set when the MSB of one or more of the Network Talley
- * Counters has been set.
- */
-#define ZE_ISR_CNT 0x20
-
-/*
- * RDC: Remote Data Complete. Indicates that a Remote DMA operation has completed.
- */
-#define ZE_ISR_RDC 0x40
-
-/*
- * RST: Reset status. Set when the NIC enters the reset state and cleared when a
- * Start Command is issued to the CR. This bit is also set when a receive
- * ring-buffer overrun (OverWrite) occurs and is cleared when one or more
- * packets have been removed from the ring. This is a read-only bit.
- */
-#define ZE_ISR_RST 0x80
-
-/*
- * Interrupt Mask Register (IMR) definitions
- */
-
-/*
- * PRXE: Packet Received interrupt Enable. If set, a received packet will cause
- * an interrupt.
- */
-#define ZE_IMR_PRXE 0x01
-
-/*
- * PTXE: Packet Transmit interrupt Enable. If set, an interrupt is generated when
- * a packet transmission completes.
- */
-#define ZE_IMR_PTXE 0x02
-
-/*
- * RXEE: Receive Error interrupt Enable. If set, an interrupt will occur whenever a
- * packet is received with an error.
- */
-#define ZE_IMR_RXEE 0x04
-
-/*
- * TXEE: Transmit Error interrupt Enable. If set, an interrupt will occur whenever
- * a transmission results in an error.
- */
-#define ZE_IMR_TXEE 0x08
-
-/*
- * OVWE: OverWrite error interrupt Enable. If set, an interrupt is generated whenever
- * the receive ring-buffer is overrun. i.e. when the boundry pointer is exceeded.
- */
-#define ZE_IMR_OVWE 0x10
-
-/*
- * CNTE: Counter overflow interrupt Enable. If set, an interrupt is generated whenever
- * the MSB of one or more of the Network Statistics counters has been set.
- */
-#define ZE_IMR_CNTE 0x20
-
-/*
- * RDCE: Remote DMA Complete interrupt Enable. If set, an interrupt is generated
- * when a remote DMA transfer has completed.
- */
-#define ZE_IMR_RDCE 0x40
-
-/*
- * bit 7 is unused/reserved
- */
-
-/*
- * Data Configuration Register (DCR) definitions
- */
-
-/*
- * WTS: Word Transfer Select. WTS establishes byte or word transfers for
- * both remote and local DMA transfers
- */
-#define ZE_DCR_WTS 0x01
-
-/*
- * BOS: Byte Order Select. BOS sets the byte order for the host.
- * Should be 0 for 80x86, and 1 for 68000 series processors
- */
-#define ZE_DCR_BOS 0x02
-
-/*
- * LAS: Long Address Select. When LAS is 1, the contents of the remote
- * DMA registers RSAR0 and RSAR1 are used to provide A16-A31
- */
-#define ZE_DCR_LAS 0x04
-
-/*
- * LS: Loopback Select. When 0, loopback mode is selected. Bits D1 and D2
- * of the TCR must also be programmed for loopback operation.
- * When 1, normal operation is selected.
- */
-#define ZE_DCR_LS 0x08
-
-/*
- * AR: Auto-initialize Remote. When 0, data must be removed from ring-buffer
- * under program control. When 1, remote DMA is automatically initiated
- * and the boundry pointer is automatically updated
- */
-#define ZE_DCR_AR 0x10
-
-/*
- * FT0, FT1: Fifo Threshold select.
- * FT1 FT0 Word-width Byte-width
- * 0 0 1 word 2 bytes
- * 0 1 2 words 4 bytes
- * 1 0 4 words 8 bytes
- * 1 1 8 words 12 bytes
- *
- * During transmission, the FIFO threshold indicates the number of bytes
- * or words that the FIFO has filled from the local DMA before BREQ is
- * asserted. The transmission threshold is 16 bytes minus the receiver
- * threshold.
- */
-#define ZE_DCR_FT0 0x20
-#define ZE_DCR_FT1 0x40
-
-/*
- * bit 7 (0x80) is unused/reserved
- */
-
-/*
- * Transmit Configuration Register (TCR) definitions
- */
-
-/*
- * CRC: Inhibit CRC. If 0, CRC will be appended by the transmitter, if 0, CRC
- * is not appended by the transmitter.
- */
-#define ZE_TCR_CRC 0x01
-
-/*
- * LB0, LB1: Loopback control. These two bits set the type of loopback that is
- * to be performed.
- *
- * LB1 LB0 mode
- * 0 0 0 - normal operation (DCR_LS = 0)
- * 0 1 1 - internal loopback (DCR_LS = 0)
- * 1 0 2 - external loopback (DCR_LS = 1)
- * 1 1 3 - external loopback (DCR_LS = 0)
- */
-#define ZE_TCR_LB0 0x02
-#define ZE_TCR_LB1 0x04
-
-/*
- * ATD: Auto Transmit Disable. Clear for normal operation. When set, allows
- * another station to disable the NIC's transmitter by transmitting to
- * a multicast address hashing to bit 62. Reception of a multicast address
- * hashing to bit 63 enables the transmitter.
- */
-#define ZE_TCR_ATD 0x08
-
-/*
- * OFST: Collision Offset enable. This bit when set modifies the backoff
- * algorithm to allow prioritization of nodes.
- */
-#define ZE_TCR_OFST 0x10
-
-/*
- * bits 5, 6, and 7 are unused/reserved
- */
-
-/*
- * Transmit Status Register (TSR) definitions
- */
-
-/*
- * PTX: Packet Transmitted. Indicates successful transmission of packet.
- */
-#define ZE_TSR_PTX 0x01
-
-/*
- * bit 1 (0x02) is unused/reserved
- */
-
-/*
- * COL: Transmit Collided. Indicates that the transmission collided at least
- * once with another station on the network.
- */
-#define ZE_TSR_COL 0x04
-
-/*
- * ABT: Transmit aborted. Indicates that the transmission was aborted due to
- * excessive collisions.
- */
-#define ZE_TSR_ABT 0x08
-
-/*
- * CRS: Carrier Sense Lost. Indicates that carrier was lost during the
- * transmission of the packet. (Transmission is not aborted because
- * of a loss of carrier)
- */
-#define ZE_TSR_CRS 0x10
-
-/*
- * FU: FIFO Underrun. Indicates that the NIC wasn't able to access bus/
- * transmission memory before the FIFO emptied. Transmission of the
- * packet was aborted.
- */
-#define ZE_TSR_FU 0x20
-
-/*
- * CDH: CD Heartbeat. Indicates that the collision detection circuitry
- * isn't working correctly during a collision heartbeat test.
- */
-#define ZE_TSR_CDH 0x40
-
-/*
- * OWC: Out of Window Collision: Indicates that a collision occurred after
- * a slot time (51.2us). The transmission is rescheduled just as in
- * normal collisions.
- */
-#define ZE_TSR_OWC 0x80
-
-/*
- * Receiver Configuration Register (RCR) definitions
- */
-
-/*
- * SEP: Save Errored Packets. If 0, error packets are discarded. If set to 1,
- * packets with CRC and frame errors are not discarded.
- */
-#define ZE_RCR_SEP 0x01
-
-/*
- * AR: Accept Runt packet. If 0, packet with less than 64 byte are discarded.
- * If set to 1, packets with less than 64 byte are not discarded.
- */
-#define ZE_RCR_AR 0x02
-
-/*
- * AB: Accept Broadcast. If set, packets sent to the broadcast address will be
- * accepted.
- */
-#define ZE_RCR_AB 0x04
-
-/*
- * AM: Accept Multicast. If set, packets sent to a multicast address are checked
- * for a match in the hashing array. If clear, multicast packets are ignored.
- */
-#define ZE_RCR_AM 0x08
-
-/*
- * PRO: Promiscuous Physical. If set, all packets with a physical addresses are
- * accepted. If clear, a physical destination address must match this
- * station's address. Note: for full promiscuous mode, RCR_AB and RCR_AM
- * must also be set. In addition, the multicast hashing array must be set
- * to all 1's so that all multicast addresses are accepted.
- */
-#define ZE_RCR_PRO 0x10
-
-/*
- * MON: Monitor Mode. If set, packets will be checked for good CRC and framing,
- * but are not stored in the ring-buffer. If clear, packets are stored (normal
- * operation).
- */
-#define ZE_RCR_MON 0x20
-
-/*
- * bits 6 and 7 are unused/reserved.
- */
-
-/*
- * Receiver Status Register (RSR) definitions
- */
-
-/*
- * PRX: Packet Received without error.
- */
-#define ZE_RSR_PRX 0x01
-
-/*
- * CRC: CRC error. Indicates that a packet has a CRC error. Also set for frame
- * alignment errors.
- */
-#define ZE_RSR_CRC 0x02
-
-/*
- * FAE: Frame Alignment Error. Indicates that the incoming packet did not end on
- * a byte boundry and the CRC did not match at the last byte boundry.
- */
-#define ZE_RSR_FAE 0x04
-
-/*
- * FO: FIFO Overrun. Indicates that the FIFO was not serviced (during local DMA)
- * causing it to overrun. Reception of the packet is aborted.
- */
-#define ZE_RSR_FO 0x08
-
-/*
- * MPA: Missed Packet. Indicates that the received packet couldn't be stored in
- * the ring-buffer because of insufficient buffer space (exceeding the
- * boundry pointer), or because the transfer to the ring-buffer was inhibited
- * by RCR_MON - monitor mode.
- */
-#define ZE_RSR_MPA 0x10
-
-/*
- * PHY: Physical address. If 0, the packet received was sent to a physical address.
- * If 1, the packet was accepted because of a multicast/broadcast address
- * match.
- */
-#define ZE_RSR_PHY 0x20
-
-/*
- * DIS: Receiver Disabled. Set to indicate that the receiver has enetered monitor
- * mode. Cleared when the receiver exits monitor mode.
- */
-#define ZE_RSR_DIS 0x40
-
-/*
- * DFR: Deferring. Set to indicate a 'jabber' condition. The CRS and COL inputs
- * are active, and the transceiver has set the CD line as a result of the
- * jabber.
- */
-#define ZE_RSR_DFR 0x80
-
-/*
- * receive ring discriptor
- *
- * The National Semiconductor DS8390 Network interface controller uses
- * the following receive ring headers. The way this works is that the
- * memory on the interface card is chopped up into 256 bytes blocks.
- * A contiguous portion of those blocks are marked for receive packets
- * by setting start and end block #'s in the NIC. For each packet that
- * is put into the receive ring, one of these headers (4 bytes each) is
- * tacked onto the front.
- */
-struct ze_ring {
- struct edr_status { /* received packet status */
- u_char rs_prx:1, /* packet received intack */
- rs_crc:1, /* crc error */
- rs_fae:1, /* frame alignment error */
- rs_fo:1, /* fifo overrun */
- rs_mpa:1, /* packet received intack */
- rs_phy:1, /* packet received intack */
- rs_dis:1, /* packet received intack */
- rs_dfr:1; /* packet received intack */
- } ze_rcv_status; /* received packet status */
- u_char next_packet; /* pointer to next packet */
- u_short count; /* bytes in packet (length + 4) */
-};
-
-/*
- * Common constants
- */
-#define ZE_PAGE_SIZE 256 /* Size of RAM pages in bytes */
-#define ZE_TXBUF_SIZE 6 /* Size of TX buffer in pages */
-#define ZE_PAGE_OFFSET 0x40 /* mem buffer starts at 0x4000 */
-
-/*
- * Vendor types
- */
-#define ZE_VENDOR_WD_SMC 0x00 /* Western Digital/SMC */
-#define ZE_VENDOR_3COM 0x01 /* 3Com */
-
-/*
- * Compile-time config flags
- */
-/*
- * this sets the default for enabling/disablng the tranceiver
- */
-#define ZE_FLAGS_DISABLE_TRANCEIVER 0x01
-
-/*
- * This forces the board to be used in 8/16bit mode even if it
- * autoconfigs differently
- */
-#define ZE_FLAGS_FORCE_8BIT_MODE 0x02
-#define ZE_FLAGS_FORCE_16BIT_MODE 0x04
-
-/*
- * This disables the use of double transmit buffers.
- */
-#define ZE_FLAGS_NO_DOUBLE_BUFFERING 0x08
-
-/*
- * definitions for IBM credit card adapter for ethernet
- */
-
-#define ZE_DATA_IO 0x10
-#define ZE_MISC 0x18
-#define ZE_RESET 0x1F
-
-#if 0
-/*
- * Definitions for Western digital/SMC WD80x3 series ASIC
- */
-/*
- * Memory Select Register (MSR)
- */
-#define ZE_WD_MSR 0
-
-#define ZE_WD_MSR_ADDR 0x3f /* Memory decode bits 18-13 */
-#define ZE_WD_MSR_MENB 0x40 /* Memory enable */
-#define ZE_WD_MSR_RST 0x80 /* Reset board */
-
-/*
- * Interface Configuration Register (ICR)
- */
-#define ZE_WD_ICR 1
-
-#define ZE_WD_ICR_16BIT 0x01 /* 16-bit interface */
-#define ZE_WD_ICR_OAR 0x02 /* select register. 0=BIO 1=EAR */
-#define ZE_WD_ICR_IR2 0x04 /* high order bit of encoded IRQ */
-#define ZE_WD_ICR_MSZ 0x08 /* memory size (0=8k 1=32k) */
-#define ZE_WD_ICR_RLA 0x10 /* recall LAN address */
-#define ZE_WD_ICR_RX7 0x20 /* recall all but i/o and LAN address */
-#define ZE_WD_ICR_RIO 0x40 /* recall i/o address */
-#define ZE_WD_ICR_STO 0x80 /* store to non-volatile memory */
-
-/*
- * IO Address Register (IAR)
- */
-#define ZE_WD_IAR 2
-
-/*
- * EEROM Address Register
- */
-#define ZE_WD_EAR 3
-
-/*
- * Interrupt Request Register (IRR)
- */
-#define ZE_WD_IRR 4
-
-#define ZE_WD_IRR_0WS 0x01 /* use 0 wait-states on 8 bit bus */
-#define ZE_WD_IRR_OUT1 0x02 /* WD83C584 pin 1 output */
-#define ZE_WD_IRR_OUT2 0x04 /* WD83C584 pin 2 output */
-#define ZE_WD_IRR_OUT3 0x08 /* WD83C584 pin 3 output */
-#define ZE_WD_IRR_FLASH 0x10 /* Flash RAM is in the ROM socket */
-
-/*
- * The three bit of the encoded IRQ are decoded as follows:
- *
- * IR2 IR1 IR0 IRQ
- * 0 0 0 2/9
- * 0 0 1 3
- * 0 1 0 5
- * 0 1 1 7
- * 1 0 0 10
- * 1 0 1 11
- * 1 1 0 15
- * 1 1 1 4
- */
-#define ZE_WD_IRR_IR0 0x20 /* bit 0 of encoded IRQ */
-#define ZE_WD_IRR_IR1 0x40 /* bit 1 of encoded IRQ */
-#define ZE_WD_IRR_IEN 0x80 /* Interrupt enable */
-
-/*
- * LA Address Register (LAAR)
- */
-#define ZE_WD_LAAR 5
-
-#define ZE_WD_LAAR_ADDRHI 0x1f /* bits 23-19 of RAM address */
-#define ZE_WD_LAAR_0WS16 0x20 /* enable 0 wait-states on 16 bit bus */
-#define ZE_WD_LAAR_L16EN 0x40 /* enable 16-bit operation */
-#define ZE_WD_LAAR_M16EN 0x80 /* enable 16-bit memory access */
-
-/* i/o base offset to station address/card-ID PROM */
-#define ZE_WD_PROM 8
-
-/* i/o base offset to CARD ID */
-#define ZE_WD_CARD_ID ZE_WD_PROM+6
-
-#define ZE_TYPE_WD8003S 0x02
-#define ZE_TYPE_WD8003E 0x03
-#define ZE_TYPE_WD8013EBT 0x05
-#define ZE_TYPE_WD8013EB 0x27
-#define ZE_TYPE_WD8013EBP 0x2c
-#define ZE_TYPE_WD8013EPC 0x29
-
-/* Bit definitions in card ID */
-#define ZE_WD_REV_MASK 0x1f /* Revision mask */
-#define ZE_WD_SOFTCONFIG 0x20 /* Soft config */
-#define ZE_WD_LARGERAM 0x40 /* Large RAM */
-#define ZE_MICROCHANEL 0x80 /* Microchannel bus (vs. isa) */
-
-/*
- * Checksum total. All 8 bytes in station address PROM will add up to this
- */
-#define ZE_WD_ROM_CHECKSUM_TOTAL 0xFF
-
-#define ZE_WD_NIC_OFFSET 0x10 /* I/O base offset to NIC */
-#define ZE_WD_ASIC_OFFSET 0 /* I/O base offset to ASIC */
-#define ZE_WD_IO_PORTS 32 /* # of i/o addresses used */
-
-#define ZE_WD_PAGE_OFFSET 0 /* page offset for NIC access to mem */
-
-/*
- * Definitions for 3Com 3c503
- */
-#define ZE_3COM_NIC_OFFSET 0
-#define ZE_3COM_ASIC_OFFSET 0x400 /* offset to nic i/o regs */
-
-/*
- * XXX - The I/O address range is fragmented in the 3c503; this is the
- * number of regs at iobase.
- */
-#define ZE_3COM_IO_PORTS 16 /* # of i/o addresses used */
-
-#define ZE_3COM_PAGE_OFFSET 0x20 /* memory starts in second bank */
-
-/*
- * Page Start Register. Must match PSTART in NIC
- */
-#define ZE_3COM_PSTR 0
-
-/*
- * Page Stop Register. Must match PSTOP in NIC
- */
-#define ZE_3COM_PSPR 1
-
-/*
- * Drq Timer Register. Determines number of bytes to be transfered during
- * a DMA burst.
- */
-#define ZE_3COM_DQTR 2
-
-/*
- * Base Configuration Register. Read-only register which contains the
- * board-configured I/O base address of the adapter. Bit encoded.
- */
-#define ZE_3COM_BCFR 3
-
-#define ZE_3COM_BCFR_2E0 0x01
-#define ZE_3COM_BCFR_2A0 0x02
-#define ZE_3COM_BCFR_280 0x04
-#define ZE_3COM_BCFR_250 0x08
-#define ZE_3COM_BCFR_350 0x10
-#define ZE_3COM_BCFR_330 0x20
-#define ZE_3COM_BCFR_310 0x40
-#define ZE_3COM_BCFR_300 0x80
-
-/*
- * EPROM Configuration Register. Read-only register which contains the
- * board-configured memory base address. Bit encoded.
- */
-#define ZE_3COM_PCFR 4
-
-#define ZE_3COM_PCFR_C8000 0x10
-#define ZE_3COM_PCFR_CC000 0x20
-#define ZE_3COM_PCFR_D8000 0x40
-#define ZE_3COM_PCFR_DC000 0x80
-
-/*
- * GA Configuration Register. Gate-Array Configuration Register.
- */
-#define ZE_3COM_GACFR 5
-
-/*
- * mbs2 mbs1 mbs0 start address
- * 0 0 0 0x0000
- * 0 0 1 0x2000
- * 0 1 0 0x4000
- * 0 1 1 0x6000
- *
- * Note that with adapters with only 8K, the setting for 0x2000 must
- * always be used.
- */
-#define ZE_3COM_GACFR_MBS0 0x01
-#define ZE_3COM_GACFR_MBS1 0x02
-#define ZE_3COM_GACFR_MBS2 0x04
-
-#define ZE_3COM_GACFR_RSEL 0x08 /* enable shared memory */
-#define ZE_3COM_GACFR_TEST 0x10 /* for GA testing */
-#define ZE_3COM_GACFR_OWS 0x20 /* select 0WS access to GA */
-#define ZE_3COM_GACFR_TCM 0x40 /* Mask DMA interrupts */
-#define ZE_3COM_GACFR_NIM 0x80 /* Mask NIC interrupts */
-
-/*
- * Control Register. Miscellaneous control functions.
- */
-#define ZE_3COM_CR 6
-
-#define ZE_3COM_CR_RST 0x01 /* Reset GA and NIC */
-#define ZE_3COM_CR_XSEL 0x02 /* Transceiver select. BNC=1(def) AUI=0 */
-#define ZE_3COM_CR_EALO 0x04 /* window EA PROM 0-15 to I/O base */
-#define ZE_3COM_CR_EAHI 0x08 /* window EA PROM 16-31 to I/O base */
-#define ZE_3COM_CR_SHARE 0x10 /* select interrupt sharing option */
-#define ZE_3COM_CR_DBSEL 0x20 /* Double buffer select */
-#define ZE_3COM_CR_DDIR 0x40 /* DMA direction select */
-#define ZE_3COM_CR_START 0x80 /* Start DMA controller */
-
-/*
- * Status Register. Miscellaneous status information.
- */
-#define ZE_3COM_STREG 7
-
-#define ZE_3COM_STREG_REV 0x07 /* GA revision */
-#define ZE_3COM_STREG_DIP 0x08 /* DMA in progress */
-#define ZE_3COM_STREG_DTC 0x10 /* DMA terminal count */
-#define ZE_3COM_STREG_OFLW 0x20 /* Overflow */
-#define ZE_3COM_STREG_UFLW 0x40 /* Underflow */
-#define ZE_3COM_STREG_DPRDY 0x80 /* Data port ready */
-
-/*
- * Interrupt/DMA Configuration Register
- */
-#define ZE_3COM_IDCFR 8
-
-#define ZE_3COM_IDCFR_DRQ0 0x01 /* DMA request 1 select */
-#define ZE_3COM_IDCFR_DRQ1 0x02 /* DMA request 2 select */
-#define ZE_3COM_IDCFR_DRQ2 0x04 /* DMA request 3 select */
-#define ZE_3COM_IDCFR_UNUSED 0x08 /* not used */
-#define ZE_3COM_IDCFR_IRQ2 0x10 /* Interrupt request 2 select */
-#define ZE_3COM_IDCFR_IRQ3 0x20 /* Interrupt request 3 select */
-#define ZE_3COM_IDCFR_IRQ4 0x40 /* Interrupt request 4 select */
-#define ZE_3COM_IDCFR_IRQ5 0x80 /* Interrupt request 5 select */
-
-/*
- * DMA Address Register MSB
- */
-#define ZE_3COM_DAMSB 9
-
-/*
- * DMA Address Register LSB
- */
-#define ZE_3COM_DALSB 0x0a
-
-/*
- * Vector Pointer Register 2
- */
-#define ZE_3COM_VPTR2 0x0b
-
-/*
- * Vector Pointer Register 1
- */
-#define ZE_3COM_VPTR1 0x0c
-
-/*
- * Vector Pointer Register 0
- */
-#define ZE_3COM_VPTR0 0x0d
-
-/*
- * Register File Access MSB
- */
-#define ZE_3COM_RFMSB 0x0e
-
-/*
- * Register File Access LSB
- */
-#define ZE_3COM_RFLSB 0x0f
-#endif
diff --git a/sys/i386/isa/iso8859.font b/sys/i386/isa/iso8859.font
deleted file mode 100644
index 0553a6b..0000000
--- a/sys/i386/isa/iso8859.font
+++ /dev/null
@@ -1,1254 +0,0 @@
-/*-
- * Copyright (c) 1992-1994 Søren Schmidt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer
- * in this position and unchanged.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software withough specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id$
- */
-
-char font_8x8[256*8] = {
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x7E, 0x81, 0xA5, 0x81, 0xBD, 0x99, 0x81, 0x7E,
-0x7E, 0xFF, 0xDB, 0xFF, 0xC3, 0xE7, 0xFF, 0x7E,
-0x6C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00,
-0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x10, 0x00,
-0x38, 0x7C, 0x38, 0xFE, 0xFE, 0x7C, 0x38, 0x7C,
-0x10, 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x7C,
-0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00,
-0xFF, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF,
-0x00, 0x3C, 0x66, 0x42, 0x42, 0x66, 0x3C, 0x00,
-0xFF, 0xC3, 0x99, 0xBD, 0xBD, 0x99, 0xC3, 0xFF,
-0x0F, 0x07, 0x0F, 0x7D, 0xCC, 0xCC, 0xCC, 0x78,
-0x3C, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18,
-0x3F, 0x33, 0x3F, 0x30, 0x30, 0x70, 0xF0, 0xE0,
-0x7F, 0x63, 0x7F, 0x63, 0x63, 0x67, 0xE6, 0xC0,
-0x99, 0x5A, 0x3C, 0xE7, 0xE7, 0x3C, 0x5A, 0x99,
-0x80, 0xE0, 0xF8, 0xFE, 0xF8, 0xE0, 0x80, 0x00,
-0x02, 0x0E, 0x3E, 0xFE, 0x3E, 0x0E, 0x02, 0x00,
-0x18, 0x3C, 0x7E, 0x18, 0x18, 0x7E, 0x3C, 0x18,
-0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00,
-0x7F, 0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x00,
-0x3E, 0x63, 0x38, 0x6C, 0x6C, 0x38, 0xCC, 0x78,
-0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E, 0x7E, 0x00,
-0x18, 0x3C, 0x7E, 0x18, 0x7E, 0x3C, 0x18, 0xFF,
-0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00,
-0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00,
-0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00,
-0x00, 0x30, 0x60, 0xFE, 0x60, 0x30, 0x00, 0x00,
-0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xFE, 0x00, 0x00,
-0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00,
-0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x00, 0x00,
-0x00, 0xFF, 0xFF, 0x7E, 0x3C, 0x18, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x30, 0x78, 0x78, 0x30, 0x30, 0x00, 0x30, 0x00,
-0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00,
-0x30, 0x7C, 0xC0, 0x78, 0x0C, 0xF8, 0x30, 0x00,
-0x00, 0xC6, 0xCC, 0x18, 0x30, 0x66, 0xC6, 0x00,
-0x38, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0x76, 0x00,
-0x60, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00,
-0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00,
-0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00,
-0x00, 0x30, 0x30, 0xFC, 0x30, 0x30, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x60,
-0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00,
-0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00,
-0x7C, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0x7C, 0x00,
-0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0xFC, 0x00,
-0x78, 0xCC, 0x0C, 0x38, 0x60, 0xCC, 0xFC, 0x00,
-0x78, 0xCC, 0x0C, 0x38, 0x0C, 0xCC, 0x78, 0x00,
-0x1C, 0x3C, 0x6C, 0xCC, 0xFE, 0x0C, 0x1E, 0x00,
-0xFC, 0xC0, 0xF8, 0x0C, 0x0C, 0xCC, 0x78, 0x00,
-0x38, 0x60, 0xC0, 0xF8, 0xCC, 0xCC, 0x78, 0x00,
-0xFC, 0xCC, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x00,
-0x78, 0xCC, 0xCC, 0x78, 0xCC, 0xCC, 0x78, 0x00,
-0x78, 0xCC, 0xCC, 0x7C, 0x0C, 0x18, 0x70, 0x00,
-0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00,
-0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x60,
-0x18, 0x30, 0x60, 0xC0, 0x60, 0x30, 0x18, 0x00,
-0x00, 0x00, 0xFC, 0x00, 0x00, 0xFC, 0x00, 0x00,
-0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00,
-0x78, 0xCC, 0x0C, 0x18, 0x30, 0x00, 0x30, 0x00,
-0x7C, 0xC6, 0xDE, 0xDE, 0xDE, 0xC0, 0x78, 0x00,
-0x30, 0x78, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0x00,
-0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00,
-0x3C, 0x66, 0xC0, 0xC0, 0xC0, 0x66, 0x3C, 0x00,
-0xF8, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00,
-0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00,
-0xFE, 0x62, 0x68, 0x78, 0x68, 0x60, 0xF0, 0x00,
-0x3C, 0x66, 0xC0, 0xC0, 0xCE, 0x66, 0x3E, 0x00,
-0xCC, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0xCC, 0x00,
-0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
-0x1E, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00,
-0xE6, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0xE6, 0x00,
-0xF0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00,
-0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00,
-0xC6, 0xE6, 0xF6, 0xDE, 0xCE, 0xC6, 0xC6, 0x00,
-0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00,
-0xFC, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00,
-0x78, 0xCC, 0xCC, 0xCC, 0xDC, 0x78, 0x1C, 0x00,
-0xFC, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0xE6, 0x00,
-0x78, 0xCC, 0xE0, 0x70, 0x1C, 0xCC, 0x78, 0x00,
-0xFC, 0xB4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
-0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xFC, 0x00,
-0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00,
-0xC6, 0xC6, 0xC6, 0xD6, 0xFE, 0xEE, 0xC6, 0x00,
-0xC6, 0xC6, 0x6C, 0x38, 0x38, 0x6C, 0xC6, 0x00,
-0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x30, 0x78, 0x00,
-0xFE, 0xC6, 0x8C, 0x18, 0x32, 0x66, 0xFE, 0x00,
-0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00,
-0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x02, 0x00,
-0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00,
-0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
-0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00,
-0xE0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0xDC, 0x00,
-0x00, 0x00, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x00,
-0x1C, 0x0C, 0x0C, 0x7C, 0xCC, 0xCC, 0x76, 0x00,
-0x00, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00,
-0x38, 0x6C, 0x60, 0xF0, 0x60, 0x60, 0xF0, 0x00,
-0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8,
-0xE0, 0x60, 0x6C, 0x76, 0x66, 0x66, 0xE6, 0x00,
-0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
-0x0C, 0x00, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78,
-0xE0, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0xE6, 0x00,
-0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
-0x00, 0x00, 0xCC, 0xFE, 0xFE, 0xD6, 0xC6, 0x00,
-0x00, 0x00, 0xF8, 0xCC, 0xCC, 0xCC, 0xCC, 0x00,
-0x00, 0x00, 0x78, 0xCC, 0xCC, 0xCC, 0x78, 0x00,
-0x00, 0x00, 0xDC, 0x66, 0x66, 0x7C, 0x60, 0xF0,
-0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0x1E,
-0x00, 0x00, 0xDC, 0x76, 0x66, 0x60, 0xF0, 0x00,
-0x00, 0x00, 0x7C, 0xC0, 0x78, 0x0C, 0xF8, 0x00,
-0x10, 0x30, 0x7C, 0x30, 0x30, 0x34, 0x18, 0x00,
-0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00,
-0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00,
-0x00, 0x00, 0xC6, 0xD6, 0xFE, 0xFE, 0x6C, 0x00,
-0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00,
-0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8,
-0x00, 0x00, 0xFC, 0x98, 0x30, 0x64, 0xFC, 0x00,
-0x1C, 0x30, 0x30, 0xE0, 0x30, 0x30, 0x1C, 0x00,
-0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00,
-0xE0, 0x30, 0x30, 0x1C, 0x30, 0x30, 0xE0, 0x00,
-0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x3C, 0x7E, 0xFF, 0x7E, 0x18, 0x00,
-0xAA, 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA,
-0x44, 0x44, 0x44, 0x44, 0x1F, 0x04, 0x04, 0x04,
-0x7C, 0x40, 0x40, 0x40, 0x1F, 0x10, 0x10, 0x10,
-0x38, 0x44, 0x44, 0x38, 0x1E, 0x11, 0x14, 0x13,
-0x40, 0x40, 0x40, 0x7C, 0x1F, 0x10, 0x10, 0x10,
-0x38, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00,
-0x44, 0x64, 0x4C, 0x44, 0x10, 0x10, 0x10, 0x1F,
-0x44, 0x44, 0x28, 0x10, 0x1F, 0x04, 0x04, 0x04,
-0x18, 0x18, 0x18, 0x18, 0xF8, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0x18, 0x18,
-0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00,
-0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0x18, 0x18,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x00, 0x0C, 0x30, 0x60, 0x18, 0x0C, 0x7E, 0x00,
-0x00, 0x30, 0x0C, 0x06, 0x18, 0x30, 0x7E, 0x00,
-0x00, 0x00, 0x03, 0x3E, 0x36, 0x36, 0x6C, 0x00,
-0x00, 0x00, 0x04, 0x7E, 0x10, 0x7E, 0x40, 0x00,
-0x00, 0x1C, 0x30, 0x30, 0x30, 0x30, 0x7E, 0x00,
-0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x30, 0x00, 0x30, 0x30, 0x78, 0x78, 0x30, 0x00,
-0x00, 0x00, 0x10, 0x7C, 0xC0, 0xC0, 0x7C, 0x10,
-0x00, 0x38, 0x60, 0x60, 0xF0, 0x60, 0xFC, 0x00,
-0x00, 0xC3, 0x3C, 0x66, 0x66, 0x3C, 0xC3, 0x00,
-0x00, 0xCC, 0xCC, 0x78, 0x30, 0xFC, 0x30, 0x00,
-0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00,
-0x7E, 0xC0, 0x7C, 0xC6, 0x7C, 0x06, 0xFC, 0x00,
-0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x7C, 0x82, 0xBA, 0xA2, 0xBA, 0x82, 0x7C, 0x00,
-0x1C, 0x06, 0x1E, 0x22, 0x1F, 0x3F, 0x00, 0x00,
-0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00,
-0x00, 0xFE, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x7C, 0x82, 0xBA, 0xB2, 0xAA, 0x82, 0x7C, 0x00,
-0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x38, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x10, 0x7C, 0x10, 0x00, 0x7C, 0x00, 0x00,
-0x1C, 0x36, 0x06, 0x18, 0x3E, 0x00, 0x00, 0x00,
-0x1E, 0x02, 0x0E, 0x02, 0x1E, 0x00, 0x00, 0x00,
-0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0xC0,
-0x7E, 0xCA, 0xCA, 0x7E, 0x0A, 0x0A, 0x0A, 0x00,
-0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30,
-0x06, 0x0E, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00,
-0x0E, 0x11, 0x11, 0x11, 0x0E, 0x1F, 0x00, 0x00,
-0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00,
-0x60, 0xE0, 0x66, 0x6C, 0x33, 0x67, 0x0F, 0x03,
-0x60, 0xE0, 0x66, 0x6C, 0x36, 0x6A, 0x04, 0x0E,
-0xF0, 0x20, 0x96, 0x6C, 0x33, 0x67, 0x0F, 0x03,
-0x30, 0x00, 0x30, 0x60, 0xC0, 0xCC, 0x78, 0x00,
-0x18, 0x0C, 0x30, 0x78, 0xCC, 0xFC, 0xCC, 0x00,
-0x60, 0xC0, 0x30, 0x78, 0xCC, 0xFC, 0xCC, 0x00,
-0x78, 0x84, 0x30, 0x78, 0xCC, 0xFC, 0xCC, 0x00,
-0x66, 0x98, 0x30, 0x78, 0xCC, 0xFC, 0xCC, 0x00,
-0xCC, 0x00, 0x30, 0x78, 0xCC, 0xFC, 0xCC, 0x00,
-0x30, 0x48, 0x30, 0x78, 0xCC, 0xFC, 0xCC, 0x00,
-0x3E, 0x78, 0x98, 0x9C, 0xF8, 0x98, 0x9E, 0x00,
-0x3C, 0x66, 0xC0, 0xC0, 0xC0, 0x66, 0x1C, 0x30,
-0x30, 0x18, 0xFE, 0x62, 0x78, 0x62, 0xFE, 0x00,
-0x18, 0x30, 0xFE, 0x62, 0x78, 0x62, 0xFE, 0x00,
-0x38, 0x44, 0xFE, 0x62, 0x78, 0x62, 0xFE, 0x00,
-0x66, 0x00, 0xFE, 0x62, 0x78, 0x62, 0xFE, 0x00,
-0x60, 0x30, 0x78, 0x30, 0x30, 0x30, 0x78, 0x00,
-0x18, 0x30, 0x78, 0x30, 0x30, 0x30, 0x78, 0x00,
-0x78, 0x84, 0x78, 0x30, 0x30, 0x30, 0x78, 0x00,
-0xCC, 0x00, 0x78, 0x30, 0x30, 0x30, 0x78, 0x00,
-0x78, 0x6C, 0x66, 0xF6, 0x66, 0x6C, 0x78, 0x00,
-0x66, 0x98, 0xE6, 0xF6, 0xDE, 0xCE, 0xC6, 0x00,
-0x30, 0x18, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00,
-0x18, 0x30, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00,
-0x38, 0x44, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00,
-0x66, 0x98, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00,
-0xC6, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00,
-0x00, 0xC6, 0x6C, 0x38, 0x38, 0x6C, 0xC6, 0x00,
-0x06, 0x7C, 0xCE, 0x9A, 0xB2, 0xE6, 0x78, 0xC0,
-0x60, 0x30, 0xCC, 0xCC, 0xCC, 0xCC, 0xFC, 0x00,
-0x18, 0x30, 0xCC, 0xCC, 0xCC, 0xCC, 0xFC, 0x00,
-0x78, 0x84, 0xCC, 0xCC, 0xCC, 0xCC, 0xFC, 0x00,
-0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xFC, 0x00,
-0x18, 0x30, 0xCC, 0xCC, 0x78, 0x30, 0x78, 0x00,
-0x60, 0x78, 0x6C, 0x78, 0x60, 0x60, 0x60, 0x00,
-0x78, 0xCC, 0xC4, 0xDC, 0xC6, 0xC6, 0xDC, 0xC0,
-0x30, 0x18, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00,
-0x18, 0x30, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00,
-0x78, 0x84, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00,
-0x66, 0x98, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00,
-0xCC, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00,
-0x30, 0x48, 0x38, 0x0C, 0x7C, 0xCC, 0x76, 0x00,
-0x00, 0x00, 0xEC, 0x32, 0x7E, 0xB0, 0x6E, 0x00,
-0x00, 0x00, 0x3C, 0x66, 0xC0, 0x66, 0x1C, 0x30,
-0x30, 0x18, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00,
-0x18, 0x30, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00,
-0x78, 0x84, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00,
-0xCC, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00,
-0x60, 0x30, 0x00, 0x70, 0x30, 0x30, 0x78, 0x00,
-0x18, 0x30, 0x00, 0x70, 0x30, 0x30, 0x78, 0x00,
-0x70, 0x88, 0x00, 0x70, 0x30, 0x30, 0x78, 0x00,
-0xCC, 0x00, 0x00, 0x70, 0x30, 0x30, 0x78, 0x00,
-0x6C, 0x38, 0x6C, 0x0C, 0x6C, 0xCC, 0x78, 0x00,
-0x66, 0x98, 0xF8, 0xCC, 0xCC, 0xCC, 0xCC, 0x00,
-0x60, 0x30, 0x00, 0x7C, 0xC6, 0xC6, 0x7C, 0x00,
-0x18, 0x30, 0x00, 0x7C, 0xC6, 0xC6, 0x7C, 0x00,
-0x38, 0x44, 0x00, 0x7C, 0xC6, 0xC6, 0x7C, 0x00,
-0x66, 0x98, 0x00, 0x7C, 0xC6, 0xC6, 0x7C, 0x00,
-0xC6, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0x7C, 0x00,
-0x00, 0x00, 0x18, 0x00, 0x7E, 0x00, 0x18, 0x00,
-0x00, 0x00, 0x06, 0x7C, 0xDE, 0xF6, 0x7C, 0xC0,
-0x60, 0x30, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00,
-0x18, 0x30, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00,
-0x30, 0x48, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00,
-0xCC, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00,
-0x18, 0x30, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8,
-0xE0, 0x78, 0x6C, 0x66, 0x6C, 0x78, 0xE0, 0x00,
-0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8
-};
-
-char font_8x14[256*14] = {
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x7E, 0x81, 0xA5, 0x81, 0x81, 0xBD, 0x99, 0x81,
-0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0xFF,
-0xDB, 0xFF, 0xFF, 0xC3, 0xE7, 0xFF, 0x7E, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x7F, 0x7F,
-0x7F, 0x7F, 0x3E, 0x1C, 0x08, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x08, 0x1C, 0x3E, 0x7F, 0x3E,
-0x1C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x18, 0x3C, 0x3C, 0xE7, 0xE7, 0xE7, 0x18, 0x18,
-0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C,
-0x7E, 0xFF, 0xFF, 0x7E, 0x18, 0x18, 0x3C, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
-0x3C, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
-0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE7, 0xC3, 0xC3,
-0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
-0x00, 0x00, 0x3C, 0x24, 0x42, 0x42, 0x24, 0x3C,
-0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
-0xC3, 0xDB, 0xBD, 0xBD, 0xDB, 0xC3, 0xFF, 0xFF,
-0xFF, 0xFF, 0x00, 0x00, 0x1F, 0x07, 0x0D, 0x19,
-0x78, 0xCC, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x18,
-0x7E, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x0C, 0x0A, 0x09, 0x09, 0x09, 0x0A, 0x08, 0x38,
-0x78, 0x78, 0x30, 0x00, 0x00, 0x00, 0x1F, 0x11,
-0x1F, 0x11, 0x11, 0x11, 0x13, 0x37, 0x77, 0x72,
-0x20, 0x00, 0x00, 0x00, 0x18, 0x18, 0xDB, 0x3C,
-0xE7, 0x3C, 0xDB, 0x18, 0x18, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x40, 0x60, 0x70, 0x7C, 0x7F, 0x7C,
-0x70, 0x60, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x01, 0x03, 0x07, 0x1F, 0x7F, 0x1F, 0x07, 0x03,
-0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C,
-0x7E, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33, 0x33,
-0x33, 0x33, 0x00, 0x33, 0x33, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7F, 0xDB, 0xDB, 0xDB, 0x7B, 0x1B,
-0x1B, 0x1B, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x3E,
-0x63, 0x30, 0x1C, 0x36, 0x63, 0x63, 0x36, 0x1C,
-0x06, 0x63, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x7E, 0x18,
-0x18, 0x18, 0x7E, 0x3C, 0x18, 0x7E, 0x00, 0x00,
-0x00, 0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x0C, 0x06, 0x7F, 0x06, 0x0C, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30,
-0x7F, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60,
-0x7F, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x24, 0x42, 0xFF, 0x42, 0x24, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x18, 0x3C, 0x7E, 0xFF, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
-0x7E, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x18, 0x3C, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66,
-0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x7F, 0x36,
-0x36, 0x36, 0x7F, 0x36, 0x36, 0x00, 0x00, 0x00,
-0x08, 0x08, 0x3E, 0x63, 0x60, 0x60, 0x3E, 0x03,
-0x03, 0x63, 0x3E, 0x08, 0x08, 0x00, 0x00, 0x00,
-0x00, 0x61, 0x63, 0x06, 0x0C, 0x18, 0x30, 0x63,
-0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x36,
-0x36, 0x1C, 0x3B, 0x6E, 0x66, 0x66, 0x3B, 0x00,
-0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x60, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x30,
-0x30, 0x18, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x18,
-0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x66, 0x3C, 0x7E, 0x3C, 0x66, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
-0x7E, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x06, 0x0C,
-0x18, 0x30, 0x60, 0x40, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x3E, 0x63, 0x67, 0x6F, 0x7B, 0x73,
-0x63, 0x63, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x0C, 0x1C, 0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C,
-0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x63,
-0x03, 0x06, 0x0C, 0x18, 0x30, 0x63, 0x7F, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x3E, 0x63, 0x03, 0x03,
-0x1E, 0x03, 0x03, 0x63, 0x3E, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x06, 0x0E, 0x1E, 0x36, 0x66, 0x7F,
-0x06, 0x06, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x7E, 0x60, 0x60, 0x60, 0x7E, 0x03, 0x03, 0x63,
-0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x30,
-0x60, 0x60, 0x7E, 0x63, 0x63, 0x63, 0x3E, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x7F, 0x63, 0x03, 0x06,
-0x0C, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x3E, 0x63, 0x63, 0x63, 0x3E, 0x63,
-0x63, 0x63, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x3E, 0x63, 0x63, 0x63, 0x3F, 0x03, 0x03, 0x06,
-0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
-0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00,
-0x00, 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x30,
-0x18, 0x0C, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x7E, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30,
-0x18, 0x0C, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x3E, 0x63, 0x63, 0x06,
-0x0C, 0x0C, 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x3E, 0x63, 0x63, 0x6F, 0x6F, 0x6F,
-0x6E, 0x60, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x08, 0x1C, 0x36, 0x63, 0x63, 0x7F, 0x63, 0x63,
-0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x33,
-0x33, 0x33, 0x3E, 0x33, 0x33, 0x33, 0x7E, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x1E, 0x33, 0x60, 0x60,
-0x60, 0x60, 0x60, 0x33, 0x1E, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7C, 0x36, 0x33, 0x33, 0x33, 0x33,
-0x33, 0x36, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x7F, 0x33, 0x30, 0x34, 0x3C, 0x34, 0x30, 0x33,
-0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x33,
-0x30, 0x34, 0x3C, 0x34, 0x30, 0x30, 0x78, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x1E, 0x33, 0x60, 0x60,
-0x60, 0x6F, 0x63, 0x33, 0x1D, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x63, 0x63, 0x63, 0x63, 0x7F, 0x63,
-0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x06,
-0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3C, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x73, 0x33, 0x36, 0x36,
-0x3C, 0x36, 0x36, 0x33, 0x73, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x78, 0x30, 0x30, 0x30, 0x30, 0x30,
-0x30, 0x33, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x63, 0x77, 0x7F, 0x6B, 0x63, 0x63, 0x63, 0x63,
-0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x73,
-0x7B, 0x7F, 0x6F, 0x67, 0x63, 0x63, 0x63, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x1C, 0x36, 0x63, 0x63,
-0x63, 0x63, 0x63, 0x36, 0x1C, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7E, 0x33, 0x33, 0x33, 0x3E, 0x30,
-0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x1C, 0x36, 0x63, 0x63, 0x63, 0x63, 0x6B, 0x3E,
-0x1C, 0x06, 0x03, 0x00, 0x00, 0x00, 0x7E, 0x33,
-0x33, 0x33, 0x3E, 0x36, 0x33, 0x33, 0x73, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x3E, 0x63, 0x63, 0x30,
-0x1C, 0x06, 0x63, 0x63, 0x3E, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7E, 0x5A, 0x18, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
-0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63,
-0x63, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x08, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 0x63, 0x63,
-0x63, 0x6B, 0x6B, 0x7F, 0x36, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x36,
-0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18,
-0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x63,
-0x06, 0x0C, 0x18, 0x30, 0x60, 0x63, 0x7F, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x3C, 0x30, 0x30, 0x30,
-0x30, 0x30, 0x30, 0x30, 0x3C, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x40, 0x60, 0x30, 0x18, 0x0C, 0x06,
-0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C,
-0x3C, 0x00, 0x00, 0x00, 0x08, 0x1C, 0x36, 0x63,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
-0x18, 0x18, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x66,
-0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x30,
-0x30, 0x3E, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E,
-0x63, 0x60, 0x60, 0x63, 0x3E, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x0E, 0x06, 0x06, 0x3E, 0x66, 0x66,
-0x66, 0x66, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x3E, 0x63, 0x7F, 0x60, 0x63,
-0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x33,
-0x30, 0x7C, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3B,
-0x66, 0x66, 0x66, 0x3E, 0x06, 0x66, 0x3C, 0x00,
-0x00, 0x00, 0x70, 0x30, 0x30, 0x36, 0x3B, 0x33,
-0x33, 0x33, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x0C, 0x0C, 0x00, 0x1C, 0x0C, 0x0C, 0x0C, 0x0C,
-0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C,
-0x00, 0x1C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0xCC,
-0x78, 0x00, 0x00, 0x00, 0x70, 0x30, 0x30, 0x33,
-0x36, 0x3C, 0x36, 0x33, 0x73, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x1C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C,
-0x0C, 0x0C, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x66, 0x7F, 0x6B, 0x6B, 0x6B,
-0x6B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x6E, 0x33, 0x33, 0x33, 0x33, 0x33, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E,
-0x63, 0x63, 0x63, 0x63, 0x3E, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x33, 0x33,
-0x33, 0x3E, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x3B, 0x66, 0x66, 0x66, 0x3E,
-0x06, 0x06, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x6E, 0x33, 0x30, 0x30, 0x30, 0x78, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E,
-0x63, 0x38, 0x0E, 0x63, 0x3E, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x08, 0x18, 0x7E, 0x18, 0x18,
-0x18, 0x1B, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66,
-0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x08, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63,
-0x63, 0x6B, 0x6B, 0x7F, 0x36, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x36, 0x1C,
-0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x63, 0x66, 0x66, 0x66, 0x3E,
-0x06, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x7F, 0x66, 0x0C, 0x18, 0x33, 0x7F, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x0E, 0x18, 0x18, 0x18,
-0x70, 0x18, 0x18, 0x18, 0x0E, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x70, 0x18, 0x18, 0x18, 0x0E, 0x18, 0x18, 0x18,
-0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3B, 0x6E,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x1C,
-0x36, 0x63, 0x63, 0x7F, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x7E, 0x3C,
-0x18, 0x00, 0x00, 0x00, 0x55, 0xAA, 0x55, 0xAA,
-0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA,
-0x55, 0xAA, 0x00, 0x44, 0x44, 0x7C, 0x44, 0x44,
-0x00, 0x1F, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00,
-0x00, 0x7C, 0x40, 0x78, 0x40, 0x40, 0x00, 0x1F,
-0x10, 0x1E, 0x10, 0x10, 0x00, 0x00, 0x00, 0x38,
-0x44, 0x40, 0x44, 0x38, 0x00, 0x1E, 0x11, 0x1E,
-0x14, 0x13, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40,
-0x40, 0x7C, 0x00, 0x1F, 0x10, 0x1E, 0x10, 0x10,
-0x00, 0x00, 0x00, 0x38, 0x6C, 0x6C, 0x38, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7E, 0x18,
-0x18, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x44,
-0x64, 0x54, 0x4C, 0x44, 0x00, 0x10, 0x10, 0x10,
-0x10, 0x1F, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44,
-0x28, 0x10, 0x00, 0x1F, 0x04, 0x04, 0x04, 0x04,
-0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x18, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x18, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x18, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x0C, 0x18,
-0x30, 0x60, 0x30, 0x18, 0x0C, 0x00, 0x7E, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x0C, 0x06,
-0x0C, 0x18, 0x30, 0x00, 0x7E, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x03, 0x3E, 0x76, 0x36,
-0x36, 0x36, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x02, 0x04, 0x7E, 0x08, 0x10, 0x7E, 0x20,
-0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x36,
-0x30, 0x30, 0x7C, 0x30, 0x30, 0x73, 0x7E, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x18, 0x18, 0x00, 0x18, 0x18, 0x3C, 0x3C, 0x3C,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
-0x08, 0x3E, 0x63, 0x60, 0x60, 0x63, 0x3E, 0x08,
-0x08, 0x00, 0x00, 0x00, 0x1C, 0x36, 0x30, 0x30,
-0x7C, 0x30, 0x30, 0x73, 0x7E, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x42, 0x3C, 0x66, 0x66, 0x66,
-0x3C, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18, 0x7E,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
-0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00,
-0x00, 0x00, 0x00, 0x3E, 0x63, 0x30, 0x1C, 0x36,
-0x63, 0x63, 0x36, 0x1C, 0x06, 0x63, 0x3E, 0x00,
-0x00, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x3E, 0x41, 0x5D, 0x51, 0x51, 0x5D, 0x41,
-0x3E, 0x00, 0x00, 0x00, 0x00, 0x38, 0x04, 0x3C,
-0x44, 0x3C, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x36,
-0x6C, 0x36, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x03,
-0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E,
-0x41, 0x5D, 0x55, 0x59, 0x55, 0x41, 0x3E, 0x00,
-0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00,
-0x7E, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6C, 0x18,
-0x30, 0x64, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x7C, 0x0C, 0x38, 0x0C, 0x6C,
-0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x06, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66,
-0x3B, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x7F, 0xDB,
-0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x0C, 0x0C, 0x06, 0x1C, 0x00, 0x30,
-0x70, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44,
-0x44, 0x38, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x36,
-0x1B, 0x36, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x60, 0xE0, 0x63, 0x66, 0x6C, 0x18, 0x33,
-0x67, 0xCF, 0x1F, 0x03, 0x03, 0x00, 0x00, 0x60,
-0xE0, 0x63, 0x66, 0x6C, 0x18, 0x30, 0x6E, 0xC3,
-0x06, 0x0C, 0x1F, 0x00, 0x00, 0xF0, 0x30, 0x63,
-0xF6, 0x6C, 0x18, 0x33, 0x67, 0xCF, 0x1F, 0x03,
-0x03, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18,
-0x18, 0x30, 0x63, 0x63, 0x3E, 0x00, 0x00, 0x00,
-0x60, 0x30, 0x18, 0x00, 0x1C, 0x36, 0x63, 0x63,
-0x7F, 0x63, 0x63, 0x00, 0x00, 0x00, 0x03, 0x06,
-0x0C, 0x00, 0x1C, 0x36, 0x63, 0x63, 0x7F, 0x63,
-0x63, 0x00, 0x00, 0x00, 0x08, 0x1C, 0x36, 0x00,
-0x1C, 0x36, 0x63, 0x63, 0x7F, 0x63, 0x63, 0x00,
-0x00, 0x00, 0x3B, 0x6E, 0x00, 0x08, 0x1C, 0x36,
-0x63, 0x63, 0x7F, 0x63, 0x63, 0x00, 0x00, 0x00,
-0x00, 0x63, 0x63, 0x08, 0x1C, 0x36, 0x63, 0x63,
-0x7F, 0x63, 0x63, 0x00, 0x00, 0x00, 0x1C, 0x36,
-0x1C, 0x00, 0x1C, 0x36, 0x63, 0x63, 0x7F, 0x63,
-0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x36,
-0x66, 0x66, 0x67, 0x7E, 0x66, 0x66, 0x67, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x1E, 0x33, 0x60, 0x60,
-0x60, 0x60, 0x60, 0x33, 0x1E, 0x0C, 0x06, 0x1C,
-0x60, 0x30, 0x18, 0x00, 0x7F, 0x33, 0x30, 0x3E,
-0x30, 0x33, 0x7F, 0x00, 0x00, 0x00, 0x06, 0x0C,
-0x18, 0x00, 0x7F, 0x33, 0x30, 0x3E, 0x30, 0x33,
-0x7F, 0x00, 0x00, 0x00, 0x08, 0x1C, 0x36, 0x00,
-0x7F, 0x33, 0x30, 0x3E, 0x30, 0x33, 0x7F, 0x00,
-0x00, 0x00, 0x00, 0x63, 0x63, 0x00, 0x7F, 0x33,
-0x30, 0x3E, 0x30, 0x33, 0x7F, 0x00, 0x00, 0x00,
-0x60, 0x30, 0x18, 0x00, 0x3C, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x06, 0x0C,
-0x18, 0x00, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x3C, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x66, 0x00,
-0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00,
-0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x3C, 0x18,
-0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x3C, 0x36, 0x33, 0x33, 0x7B, 0x33,
-0x33, 0x36, 0x3C, 0x00, 0x00, 0x00, 0x3B, 0x6E,
-0x00, 0x63, 0x73, 0x7B, 0x7F, 0x6F, 0x67, 0x63,
-0x63, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00,
-0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00,
-0x00, 0x00, 0x03, 0x06, 0x0C, 0x00, 0x1C, 0x36,
-0x63, 0x63, 0x63, 0x36, 0x1C, 0x00, 0x00, 0x00,
-0x08, 0x1C, 0x36, 0x00, 0x1C, 0x36, 0x63, 0x63,
-0x63, 0x36, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x3B,
-0x6E, 0x00, 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36,
-0x1C, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 0x00,
-0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x36, 0x1C,
-0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x03, 0x1E, 0x36, 0x67, 0x6F, 0x6B, 0x7B,
-0x73, 0x36, 0x3C, 0x60, 0x00, 0x00, 0x60, 0x30,
-0x18, 0x00, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
-0x3E, 0x00, 0x00, 0x00, 0x03, 0x06, 0x0C, 0x00,
-0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3E, 0x00,
-0x00, 0x00, 0x08, 0x1C, 0x36, 0x00, 0x63, 0x63,
-0x63, 0x63, 0x63, 0x63, 0x3E, 0x00, 0x00, 0x00,
-0x00, 0x63, 0x63, 0x00, 0x63, 0x63, 0x63, 0x63,
-0x63, 0x63, 0x3E, 0x00, 0x00, 0x00, 0x06, 0x0C,
-0x18, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18,
-0x3C, 0x00, 0x00, 0x00, 0x00, 0x78, 0x30, 0x3E,
-0x33, 0x33, 0x3E, 0x30, 0x30, 0x30, 0x78, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x1C, 0x36, 0x63, 0x66,
-0x6C, 0x67, 0x63, 0x6B, 0x6E, 0x60, 0x60, 0x00,
-0x00, 0x60, 0x30, 0x18, 0x00, 0x3C, 0x06, 0x3E,
-0x66, 0x66, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x06,
-0x0C, 0x18, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x66,
-0x3B, 0x00, 0x00, 0x00, 0x00, 0x08, 0x1C, 0x36,
-0x00, 0x3C, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x3B, 0x6E, 0x00, 0x3C,
-0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x66, 0x66, 0x00, 0x3C, 0x06, 0x3E,
-0x66, 0x66, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x1C,
-0x36, 0x1C, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x66,
-0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x76, 0x0B, 0x3B, 0x6E, 0x68, 0x37, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E,
-0x63, 0x60, 0x60, 0x63, 0x3E, 0x0C, 0x06, 0x1C,
-0x00, 0x30, 0x18, 0x0C, 0x00, 0x3E, 0x63, 0x7F,
-0x60, 0x63, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x03,
-0x06, 0x0C, 0x00, 0x3E, 0x63, 0x7F, 0x60, 0x63,
-0x3E, 0x00, 0x00, 0x00, 0x00, 0x08, 0x1C, 0x36,
-0x00, 0x3E, 0x63, 0x7F, 0x60, 0x63, 0x3E, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 0x00, 0x3E,
-0x63, 0x7F, 0x60, 0x63, 0x3E, 0x00, 0x00, 0x00,
-0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18,
-0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x06,
-0x0C, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18,
-0x3C, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x66,
-0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x38,
-0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x36, 0x1C, 0x36, 0x06, 0x3E, 0x66,
-0x66, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x3B, 0x6E, 0x00, 0x6E, 0x33, 0x33, 0x33, 0x33,
-0x33, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18,
-0x00, 0x3E, 0x63, 0x63, 0x63, 0x63, 0x3E, 0x00,
-0x00, 0x00, 0x00, 0x06, 0x0C, 0x18, 0x00, 0x3E,
-0x63, 0x63, 0x63, 0x63, 0x3E, 0x00, 0x00, 0x00,
-0x00, 0x08, 0x1C, 0x36, 0x00, 0x3E, 0x63, 0x63,
-0x63, 0x63, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x3B, 0x6E, 0x00, 0x3E, 0x63, 0x63, 0x63, 0x63,
-0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63,
-0x00, 0x3E, 0x63, 0x63, 0x63, 0x63, 0x3E, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
-0x7E, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x03, 0x3E, 0x67, 0x6F,
-0x7B, 0x73, 0x3E, 0x60, 0x00, 0x00, 0x00, 0x60,
-0x30, 0x18, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66,
-0x3B, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0C, 0x18,
-0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3B, 0x00,
-0x00, 0x00, 0x00, 0x18, 0x3C, 0x66, 0x00, 0x66,
-0x66, 0x66, 0x66, 0x66, 0x3B, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x66, 0x66, 0x00, 0x66, 0x66, 0x66,
-0x66, 0x66, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x06,
-0x0C, 0x18, 0x00, 0x63, 0x66, 0x66, 0x66, 0x3E,
-0x06, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x78,
-0x30, 0x3E, 0x33, 0x33, 0x33, 0x33, 0x3E, 0x30,
-0x78, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x66,
-0x66, 0x66, 0x66, 0x3E, 0x06, 0x66, 0x3C, 0x00
-};
-
-char font_8x16[256*16] = {
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7E, 0x81, 0xA5, 0x81, 0x81, 0xBD,
-0x99, 0x81, 0x81, 0x7E, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7E, 0xFF, 0xDB, 0xFF, 0xFF, 0xC3,
-0xE7, 0xFF, 0xFF, 0x7E, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x6C, 0xFE, 0xFE, 0xFE,
-0xFE, 0x7C, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7C, 0xFE,
-0x7C, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x18, 0x3C, 0x3C, 0xE7, 0xE7,
-0xE7, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF,
-0x7E, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C,
-0x3C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE7, 0xC3,
-0xC3, 0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x66, 0x42,
-0x42, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
-0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC3, 0x99, 0xBD,
-0xBD, 0x99, 0xC3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-0x00, 0x00, 0x1E, 0x0E, 0x1A, 0x32, 0x78, 0xCC,
-0xCC, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x3C,
-0x18, 0x7E, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x3F, 0x33, 0x3F, 0x30, 0x30, 0x30,
-0x30, 0x70, 0xF0, 0xE0, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7F, 0x63, 0x7F, 0x63, 0x63, 0x63,
-0x63, 0x67, 0xE7, 0xE6, 0xC0, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x18, 0x18, 0xDB, 0x3C, 0xE7,
-0x3C, 0xDB, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFE, 0xF8,
-0xF0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x02, 0x06, 0x0E, 0x1E, 0x3E, 0xFE, 0x3E,
-0x1E, 0x0E, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18,
-0x7E, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
-0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7F, 0xDB, 0xDB, 0xDB, 0x7B, 0x1B,
-0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x7C, 0xC6, 0x60, 0x38, 0x6C, 0xC6, 0xC6,
-0x6C, 0x38, 0x0C, 0xC6, 0x7C, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0xFE, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18,
-0x7E, 0x3C, 0x18, 0x7E, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x18, 0x7E, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0C, 0xFE,
-0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xFE,
-0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0,
-0xC0, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x66, 0xFF,
-0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7C,
-0x7C, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0x7C, 0x7C,
-0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x18, 0x3C, 0x3C, 0x3C, 0x18, 0x18,
-0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x6C, 0x6C, 0xFE, 0x6C, 0x6C,
-0x6C, 0xFE, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00,
-0x18, 0x18, 0x7C, 0xC6, 0xC2, 0xC0, 0x7C, 0x06,
-0x06, 0x86, 0xC6, 0x7C, 0x18, 0x18, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0xC2, 0xC6, 0x0C, 0x18,
-0x30, 0x60, 0xC6, 0x86, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x38, 0x6C, 0x6C, 0x38, 0x76, 0xDC,
-0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x30,
-0x30, 0x30, 0x18, 0x0C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x0C,
-0x0C, 0x0C, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3C, 0xFF,
-0x3C, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7E,
-0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0C, 0x18,
-0x30, 0x60, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x3C, 0x66, 0xC3, 0xC3, 0xDB, 0xDB,
-0xC3, 0xC3, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x7E, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7C, 0xC6, 0x06, 0x0C, 0x18, 0x30,
-0x60, 0xC0, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7C, 0xC6, 0x06, 0x06, 0x3C, 0x06,
-0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x0C, 0x1C, 0x3C, 0x6C, 0xCC, 0xFE,
-0x0C, 0x0C, 0x0C, 0x1E, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xFE, 0xC0, 0xC0, 0xC0, 0xFC, 0x06,
-0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x38, 0x60, 0xC0, 0xC0, 0xFC, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xFE, 0xC6, 0x06, 0x06, 0x0C, 0x18,
-0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7E, 0x06,
-0x06, 0x06, 0x0C, 0x78, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
-0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
-0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60,
-0x30, 0x18, 0x0C, 0x06, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00,
-0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0C, 0x06,
-0x0C, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7C, 0xC6, 0xC6, 0x0C, 0x18, 0x18,
-0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xDE, 0xDE,
-0xDE, 0xDC, 0xC0, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE,
-0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x7C, 0x66,
-0x66, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x3C, 0x66, 0xC2, 0xC0, 0xC0, 0xC0,
-0xC0, 0xC2, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xF8, 0x6C, 0x66, 0x66, 0x66, 0x66,
-0x66, 0x66, 0x6C, 0xF8, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xFE, 0x66, 0x62, 0x68, 0x78, 0x68,
-0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xFE, 0x66, 0x62, 0x68, 0x78, 0x68,
-0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x3C, 0x66, 0xC2, 0xC0, 0xC0, 0xDE,
-0xC6, 0xC6, 0x66, 0x3A, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6,
-0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C,
-0xCC, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xE6, 0x66, 0x66, 0x6C, 0x78, 0x78,
-0x6C, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xF0, 0x60, 0x60, 0x60, 0x60, 0x60,
-0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xC3, 0xE7, 0xFF, 0xFF, 0xDB, 0xC3,
-0xC3, 0xC3, 0xC3, 0xC3, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xC6, 0xE6, 0xF6, 0xFE, 0xDE, 0xCE,
-0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x7C, 0x60,
-0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6,
-0xC6, 0xD6, 0xDE, 0x7C, 0x0C, 0x0E, 0x00, 0x00,
-0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x7C, 0x6C,
-0x66, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7C, 0xC6, 0xC6, 0x60, 0x38, 0x0C,
-0x06, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xFF, 0xDB, 0x99, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3,
-0xC3, 0x66, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xDB,
-0xDB, 0xFF, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xC3, 0xC3, 0x66, 0x3C, 0x18, 0x18,
-0x3C, 0x66, 0xC3, 0xC3, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xC3, 0xC3, 0xC3, 0x66, 0x3C, 0x18,
-0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xFF, 0xC3, 0x86, 0x0C, 0x18, 0x30,
-0x60, 0xC1, 0xC3, 0xFF, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x3C, 0x30, 0x30, 0x30, 0x30, 0x30,
-0x30, 0x30, 0x30, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0x70, 0x38,
-0x1C, 0x0E, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C,
-0x0C, 0x0C, 0x0C, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00,
-0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0C, 0x7C,
-0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xE0, 0x60, 0x60, 0x78, 0x6C, 0x66,
-0x66, 0x66, 0x66, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC0,
-0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x1C, 0x0C, 0x0C, 0x3C, 0x6C, 0xCC,
-0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xFE,
-0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x38, 0x6C, 0x64, 0x60, 0xF0, 0x60,
-0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xCC, 0xCC,
-0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xCC, 0x78, 0x00,
-0x00, 0x00, 0xE0, 0x60, 0x60, 0x6C, 0x76, 0x66,
-0x66, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x06, 0x06, 0x00, 0x0E, 0x06, 0x06,
-0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3C, 0x00,
-0x00, 0x00, 0xE0, 0x60, 0x60, 0x66, 0x6C, 0x78,
-0x78, 0x6C, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xE6, 0xFF, 0xDB,
-0xDB, 0xDB, 0xDB, 0xDB, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x66, 0x66,
-0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x66, 0x66,
-0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xCC, 0xCC,
-0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0x0C, 0x1E, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x76, 0x66,
-0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0x60,
-0x38, 0x0C, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x10, 0x30, 0x30, 0xFC, 0x30, 0x30,
-0x30, 0x30, 0x36, 0x1C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xCC, 0xCC, 0xCC,
-0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xC3, 0xC3, 0xC3,
-0xC3, 0x66, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xC3, 0xC3, 0xC3,
-0xDB, 0xDB, 0xFF, 0x66, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x66, 0x3C,
-0x18, 0x3C, 0x66, 0xC3, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x0C, 0xF8, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xCC, 0x18,
-0x30, 0x60, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x0E, 0x18, 0x18, 0x18, 0x70, 0x18,
-0x18, 0x18, 0x18, 0x0E, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0E, 0x18,
-0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6C, 0xC6,
-0xC6, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x7E, 0xFF,
-0xFF, 0x7E, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA,
-0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA,
-0x00, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88, 0x00,
-0x3E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
-0x00, 0xF8, 0x80, 0xF0, 0x80, 0x80, 0x80, 0x00,
-0x3E, 0x20, 0x3C, 0x20, 0x20, 0x20, 0x00, 0x00,
-0x00, 0x70, 0x88, 0x80, 0x80, 0x88, 0x70, 0x00,
-0x3C, 0x22, 0x3C, 0x28, 0x24, 0x22, 0x00, 0x00,
-0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0xF8, 0x00,
-0x3E, 0x20, 0x3C, 0x20, 0x20, 0x20, 0x00, 0x00,
-0x00, 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7E, 0x18,
-0x18, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x88, 0xC8, 0xA8, 0xA8, 0x98, 0x88, 0x00,
-0x20, 0x20, 0x20, 0x20, 0x20, 0x3E, 0x00, 0x00,
-0x00, 0x88, 0x88, 0x88, 0x88, 0x50, 0x20, 0x00,
-0x3E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF8,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1F,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xFF,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1F,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF8,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xFF,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-0x00, 0x00, 0x00, 0x0C, 0x18, 0x30, 0x60, 0x30,
-0x18, 0x0C, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x30, 0x18, 0x0C, 0x06, 0x0C,
-0x18, 0x30, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x02, 0x7E, 0xEC, 0x6C, 0x6C,
-0x6C, 0x6C, 0x6C, 0xCC, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x06, 0x0C, 0x7E, 0x18, 0x18,
-0x7E, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x38, 0x6C, 0x64, 0x60, 0xF0, 0x60, 0x60,
-0x60, 0x60, 0xE6, 0xFC, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18,
-0x3C, 0x3C, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x18, 0x18, 0x7E, 0xC3, 0xC0, 0xC0, 0xC0,
-0xC3, 0x7E, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x38, 0x6C, 0x64, 0x60, 0xF0, 0x60, 0x60,
-0x60, 0x60, 0xE6, 0xFC, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x82, 0xC6, 0x7C, 0xC6, 0xC6,
-0xC6, 0xC6, 0x7C, 0xC6, 0x82, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xC3, 0x66, 0x3C, 0x18, 0xFF, 0x18,
-0xFF, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18,
-0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x7C, 0xC6, 0x60, 0x38, 0x6C, 0xC6, 0xC6,
-0x6C, 0x38, 0x0C, 0xC6, 0x7C, 0x00, 0x00, 0x00,
-0x00, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7C, 0xC6, 0x82, 0xBA, 0xA2, 0xA2,
-0xBA, 0x82, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x70, 0x18, 0x78, 0xC8, 0x78, 0x00, 0xF8,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6C, 0xD8,
-0x6C, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x06,
-0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7C, 0xC6, 0x82, 0xBA, 0xAA, 0xB2,
-0xAA, 0x82, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7E, 0x18,
-0x18, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x70, 0xD8, 0x30, 0x60, 0xC8, 0xF8, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0xF8, 0x18, 0x30, 0x18, 0xD8, 0x70, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66,
-0x66, 0x7E, 0x63, 0x60, 0xC0, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x7F, 0xDB, 0xDB, 0xDB, 0x7B, 0x1B,
-0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x18, 0x0C, 0x06, 0x3C, 0x00, 0x00,
-0x00, 0x60, 0xE0, 0x60, 0x60, 0x60, 0xF0, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x70, 0xD8, 0x88, 0xD8, 0x70, 0x00, 0xF8,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xD8, 0x6C, 0x36,
-0x6C, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0xC0, 0xC0, 0xC2, 0xC6, 0xCC, 0x18, 0x30,
-0x66, 0xCE, 0x96, 0x3E, 0x06, 0x06, 0x00, 0x00,
-0x00, 0xC0, 0xC0, 0xC2, 0xC6, 0xCC, 0x18, 0x30,
-0x60, 0xCE, 0x9B, 0x06, 0x0C, 0x1F, 0x00, 0x00,
-0x00, 0xF0, 0x30, 0x72, 0x36, 0xEC, 0x18, 0x30,
-0x66, 0xCE, 0x96, 0x3E, 0x06, 0x06, 0x00, 0x00,
-0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60,
-0xC0, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x60, 0x30, 0x18, 0x00, 0x38, 0x6C, 0xC6, 0xC6,
-0xFE, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
-0x0C, 0x18, 0x30, 0x00, 0x38, 0x6C, 0xC6, 0xC6,
-0xFE, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
-0x10, 0x38, 0x6C, 0x00, 0x38, 0x6C, 0xC6, 0xC6,
-0xFE, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x76, 0xDC, 0x00, 0x38, 0x6C, 0xC6, 0xC6,
-0xFE, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
-0x00, 0xC6, 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6,
-0xFE, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
-0x38, 0x6C, 0x38, 0x00, 0x38, 0x6C, 0xC6, 0xC6,
-0xFE, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x3E, 0x6C, 0xCC, 0xCC, 0xFE, 0xCC,
-0xCC, 0xCC, 0xCC, 0xCE, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x3C, 0x66, 0xC2, 0xC0, 0xC0, 0xC0,
-0xC2, 0x66, 0x3C, 0x0C, 0x06, 0x7C, 0x00, 0x00,
-0x30, 0x18, 0x0C, 0x00, 0xFE, 0x66, 0x60, 0x7C,
-0x60, 0x60, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00,
-0x18, 0x30, 0x60, 0x00, 0xFE, 0x66, 0x60, 0x7C,
-0x60, 0x60, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00,
-0x10, 0x38, 0x6C, 0x00, 0xFE, 0x66, 0x60, 0x7C,
-0x60, 0x60, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00,
-0x00, 0xC6, 0x00, 0xFE, 0x66, 0x60, 0x60, 0x7C,
-0x60, 0x60, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00,
-0x30, 0x18, 0x0C, 0x00, 0x3C, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x0C, 0x18, 0x30, 0x00, 0x3C, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x18, 0x3C, 0x66, 0x00, 0x3C, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x66, 0x00, 0x3C, 0x18, 0x18, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x78, 0x6C, 0x66, 0x66, 0x66, 0xF6,
-0x66, 0x66, 0x6C, 0x78, 0x00, 0x00, 0x00, 0x00,
-0x76, 0xDC, 0x00, 0xC6, 0xE6, 0xF6, 0xFE, 0xDE,
-0xCE, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
-0x60, 0x30, 0x18, 0x00, 0x7C, 0xC6, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x0C, 0x18, 0x30, 0x00, 0x7C, 0xC6, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x10, 0x38, 0x6C, 0x00, 0x7C, 0xC6, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x76, 0xDC, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0xC6, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x10,
-0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x02, 0x06, 0x7C, 0xCE, 0xCE, 0xDE, 0xD6, 0xD6,
-0xF6, 0xE6, 0xE6, 0x7C, 0xC0, 0x80, 0x00, 0x00,
-0x60, 0x30, 0x18, 0x00, 0xC6, 0xC6, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x0C, 0x18, 0x30, 0x00, 0xC6, 0xC6, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x10, 0x38, 0x6C, 0x00, 0xC6, 0xC6, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0xC6, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x0C, 0x18, 0x30, 0x00, 0xC3, 0xC3, 0x66, 0x3C,
-0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0xF0, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x7C, 0x60,
-0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x38, 0x6C, 0xC6, 0xCE, 0xDC, 0xD8,
-0xCC, 0xC6, 0xD6, 0xDC, 0xC0, 0x80, 0x00, 0x00,
-0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0C, 0x7C,
-0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0C, 0x7C,
-0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x10, 0x38, 0x6C, 0x00, 0x78, 0x0C, 0x7C,
-0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x76, 0xDC, 0x00, 0x78, 0x0C, 0x7C,
-0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xCC, 0x00, 0x00, 0x78, 0x0C, 0x7C,
-0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x38, 0x6C, 0x38, 0x00, 0x78, 0x0C, 0x7C,
-0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x3B, 0x1B,
-0x7E, 0xD8, 0xDC, 0x77, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x3C, 0x66, 0x60, 0x60,
-0x66, 0x3C, 0x0C, 0x06, 0x3C, 0x00, 0x00, 0x00,
-0x00, 0x60, 0x30, 0x18, 0x00, 0x7C, 0xC6, 0xFE,
-0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x0C, 0x18, 0x30, 0x00, 0x7C, 0xC6, 0xFE,
-0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x10, 0x38, 0x6C, 0x00, 0x7C, 0xC6, 0xFE,
-0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xC6, 0x00, 0x00, 0x7C, 0xC6, 0xFE,
-0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x06, 0x0C, 0x18, 0x00, 0x38, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x18, 0x3C, 0x66, 0x00, 0x38, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18,
-0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x6C, 0x38, 0x38, 0x6C, 0x0C, 0x3C, 0x6C,
-0xCC, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x76, 0xDC, 0x00, 0xDC, 0x66, 0x66,
-0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x60, 0x30, 0x18, 0x00, 0x7C, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x18, 0x30, 0x60, 0x00, 0x7C, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x10, 0x38, 0x6C, 0x00, 0x7C, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x76, 0xDC, 0x00, 0x7C, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xC6, 0x00, 0x00, 0x7C, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7E,
-0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x02, 0x06, 0x7C, 0xCE, 0xDE,
-0xD6, 0xF6, 0xE6, 0x7C, 0xC0, 0x80, 0x00, 0x00,
-0x00, 0x60, 0x30, 0x18, 0x00, 0xCC, 0xCC, 0xCC,
-0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x18, 0x30, 0x60, 0x00, 0xCC, 0xCC, 0xCC,
-0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x30, 0x78, 0xCC, 0x00, 0xCC, 0xCC, 0xCC,
-0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xCC, 0x00, 0x00, 0xCC, 0xCC, 0xCC,
-0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x18, 0x30, 0x60, 0x00, 0xC6, 0xC6, 0xC6,
-0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x0C, 0xF8, 0x00,
-0x00, 0x00, 0x00, 0xF0, 0x60, 0x7C, 0x66, 0x66,
-0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00,
-0x00, 0x00, 0x66, 0x66, 0x00, 0xEE, 0x66, 0x66,
-0x66, 0x66, 0x66, 0x3E, 0x06, 0x0C, 0x38, 0x00
-};
diff --git a/sys/i386/isa/matcd.c b/sys/i386/isa/matcd.c
deleted file mode 100644
index ae6ecd7..0000000
--- a/sys/i386/isa/matcd.c
+++ /dev/null
@@ -1,2286 +0,0 @@
-/*matcd.c--------------------------------------------------------------------
- Matsushita(Panasonic) / Creative CD-ROM Driver (matcd)
- Authored by Frank Durda IV
-
- Copyright 1994, 1995 Frank Durda IV. All rights reserved.
- "FDIV" is a trademark of Frank Durda IV.
-
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
- 1. Redistributions of source code must retain the above copyright
- notice positioned at the very beginning of this file without
- modification, all copyright strings, all related programming
- codes that display the copyright strings, this list of
- conditions and the following disclaimer.
- 2. Redistributions in binary form must contain all copyright strings
- and related programming code that display the copyright strings.
- 3. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- 4. All advertising materials mentioning features or use of this
- software must display the following acknowledgement:
- "The Matsushita/Panasonic CD-ROM driver was developed
- by Frank Durda IV for use with "FreeBSD" and similar
- operating systems."
- "Similar operating systems" includes mainly non-profit oriented
- systems for research and education, including but not restricted
- to "NetBSD", "386BSD", and "Mach" (by CMU). The wording of the
- acknowledgement (in electronic form or printed text) may not be
- changed without permission from the author.
- 5. Absolutely no warranty of function, fitness or purpose is made
- by the author Frank Durda IV.
- 6. Neither the name of the author nor the name "FreeBSD" may
- be used to endorse or promote products derived from this software
- without specific prior written permission.
- (The author can be reached at bsdmail@nemesis.lonestar.org)
- 7. The product containing this software must meet all of these
- conditions even if it is unsupported, not a complete system
- and/or does not contain compiled code.
- 8. These conditions will be in force for the full life of the
- copyright.
- 9. If all the above conditions are met, modifications to other
- parts of this file may be freely made, although any person
- or persons making changes do not receive the right to add their
- name or names to the copyright strings and notices in this
- software. Persons making changes are encouraged to insert edit
- history in matcd.c and to put your name and details of the
- change there.
- 10. You must have prior written permission from the author to
- deviate from these terms.
-
- Vendors who produce product(s) containing this code are encouraged
- (but not required) to provide copies of the finished product(s) to
- the author and to correspond with the author about development
- activity relating to this code. Donations of development hardware
- and/or software are also welcome. (This is one of the faster ways
- to get a driver developed for a device.)
-
- THIS SOFTWARE IS PROVIDED BY THE DEVELOPER(S) ``AS IS'' AND ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER(S) BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
-Dedicated to: My family and Max, my Golden Retriever
-
-Thanks to: Jordan Hubbard (jkh) for getting me ramped-up to 2.x system
- quickly enough to make the 2.1 release. He put up with
- plenty of silly questions.
-
-and The people who donated equipment and other material to make
- development of this driver possible. Donations and
- sponsors for projects are appreciated.
-
-
------------------------------------------------------------------------------
-Edit History - (should be in sync with any source control log entries)
-
- Never seen one of these before? Ok, here is how it works.
- Every time you change the code, you increment the edit number,
- that number over there in the <%d> and in the (%d) in the
- version string. You never set this number lower than it is.
- Near, or preferably on lines that change, insert the edit
- number. If there is a number there already, you can replace it
- with a newer one.
-
- In the edit history, start with the edit number, and a good
- description of what changes were made. Then follow it with
- the date, your name and an EMAIL address where you can be reached.
-
- Please follow this practice; it helps leave understandable code in
- your wake.
-
- FYI, you have major and minor release codes. These are numbered
- 1 thru n. Major feature additions should get a new major release
- number. Minor releases start with a null and then letters
- A thru Z. So 3A(456) is Major release 3, Minor release 1,
- Edit 456 (in Microsoft-ese that would be 03.01.456), and 5(731)
- is Major release 5, Minor release 0, Edit 731. Typically only the
- author will change the major and minor release codes.
-
- EDIT edit Edit HISTORY history History
-
-<1> This initial version is to get basic filesystem I/O working
- using the SoundBlaster 16 interface. The stand-alone adapter
- card doesn't work yet.
- December 1994 Frank Durda IV bsdmail@nemesis.lonestar.org
-
-<2> Corrections to resolve a race condition when multiple drives
- on the same controller was active. Fixed drive 1 & 2 swap
- problem. See selectdrive().
- 21-Jan-95 Frank Durda IV bsdmail@nemesis.lonestar.org
-
-<3> Added automatic probing and support for all Creative Labs sound
- cards with the Creative/Panasonic interface and the stand-alone
- interface adapters. See AUTOHUNT and FULLCONFIG conditionals
- for more information.
- 21-Jan-95 Frank Durda IV bsdmail@nemesis.lonestar.org
-
-<4> Rebundled debug conditionals.
- 14-Feb-95 Frank Durda IV bsdmail@nemesis.lonestar.org
-
-<5> Changes needed to work on FreeBSD 2.1. Also added draincmd
- since some conditions cause the drive to produce surprise data.
- See setmode and draincmd
- 19-Feb-95 Frank Durda IV bsdmail@nemesis.lonestar.org
-
-<6> Got rid of some redundant error code by creating chk_error().
- Also built a nice generic buss-lock function.
- 20-Feb-95 Frank Durda IV bsdmail@nemesis.lonestar.org
-
-<7> Improved comments, general structuring.
- Fixed a problem with disc eject not working if LOCKDRIVE was set.
- Apparently the drive will reject an EJECT command if the drive
- is LOCKED.
- 21-Feb-95 Frank Durda IV bsdmail@nemesis.lonestar.org
-
-Edit number code marking begins here - earlier edits were during development.
-
-<8> Final device name selected and actually made to compile under
- >2.0. For newer systems, it is "matcd", for older it is "mat".
- 24-Feb-95 Frank Durda IV bsdmail@nemesis.lonestar.org
-
-<9> Added some additional disk-related ioctl functions that didn't
- make it into earlier versions.
- 26-Feb-95 Frank Durda IV bsdmail@nemesis.lonestar.org
-
-<10> Updated some conditionals so the code will compile under
- 1.1.5.1, although this is not the supported platform.
- Also found that some other devices probe code was changing the
- settings for the port 0x302 debug board, so added code to set it
- to a sane state before we use it.
- 26-Feb-95 Frank Durda IV bsdmail@nemesis.lonestar.org
-
-
----------------------------------------------------------------------------*/
-
-/*Match this format: Version__dc(d)__dd-mmm-yy */
-static char MATCDVERSION[]="Version 1(10) 26-Feb-95";
-
-/* The following strings may not be changed*/
-static char MATCDCOPYRIGHT[] = "Matsushita CD-ROM driver, Copr. 1994,1995 Frank Durda IV";
-/* The proceeding strings may not be changed*/
-
-
-/*---------------------------------------------------------------------------
- Include declarations
----------------------------------------------------------------------------*/
-
-#include "types.h"
-#include "param.h"
-#include "systm.h"
-
-#include "buf.h"
-#include "dkbad.h"
-#include "cdio.h"
-#include "conf.h"
-#include "disklabel.h"
-#include "errno.h"
-#include "file.h"
-#include "i386/isa/isa.h"
-#include "i386/isa/isa_device.h"
-#include "ioctl.h"
-#include "proc.h"
-#include "stat.h"
-#include "uio.h"
-
-#include "options.h" /*Conditional compile options and
- probe port hints*/
-#include "matcd.h" /*Drive-related defines and strings*/
-#include "creative.h" /*Host interface related defines*/
-
-
-/*---------------------------------------------------------------------------
- Defines and structures
----------------------------------------------------------------------------*/
-
-#ifdef FULLCONFIG
-#define NUMCTRLRS 4 /*With modern boards, four is max*/
-#else /*FULLCONFIG*/
-#define NUMCTRLRS 1 /*Produces a slightly smaller kernel*/
-#endif /*FULLCONFIG*/
-#define DRIVESPERC 4 /*This is a constant*/
-#define TOTALDRIVES NUMCTRLRS*DRIVESPERC /*Max possible drives*/
-#if DIAGPORT > 0xff /*<10>*/
-#define DIAGOUT outw /*<10>*/
-#else /*DIAGPORT*/ /*<10>*/
-#define DIAGOUT outb /*<10>*/
-#endif /*DIAGPORT*/ /*<10>*/
-#ifdef DIAGPORT
-int diagloop; /*Used to show looping*/
-#endif /*DIAGPORT*/
-
-
-#define TICKRES 10 /*Our coarse timer resolution*/
-#define ISABUSKHZ 8330 /*Number of IN/OUT ISA/sec*/
-
-#ifndef FREE2
-#define RAW_PART 2 /*Needs to be defined in 1.1.5.1*/
-#endif /*FREE2*/
-
-
-#define MATCDBLK 2048 /*Standard block size*/
-#define MATCDRBLK 2352 /*Raw and/or DA block size*/
-#define MATCD_RETRYS 5 /*Number of retries for read ops*/
-#define MATCD_READ_1 0x80 /*Read state machine defines*/
-#define MATCD_READ_2 0x90 /*Read state machine defines*/
-
-struct matcd_volinfo {
- unsigned char type; /*00 CD-DA or CD-ROM
- 10 CD-I
- 20 XA */
- unsigned char trk_low; /*Normally 1*/
- unsigned char trk_high; /*Highest track number*/
- unsigned char vol_msf[3]; /*Size of disc in min/sec/frame*/
-};
-
-
-struct matcd_mbx {
- short controller;
- short ldrive;
- short partition;
- short port;
- short retry;
- short nblk;
- int sz;
- u_long skip;
- struct buf *bp;
- int p_offset;
- short count;
-};
-
-
-struct matcd_data {
- short config;
- short drivemode; /*Last state drive was set to*/
- short flags;
- short status;
- int blksize;
- u_long disksize;
- int iobase;
- struct disklabel dlabel;
- int partflags[MAXPARTITIONS];
- int openflags;
- struct matcd_volinfo volinfo;
- short debug;
- struct matcd_mbx mbx;
-} matcd_data[TOTALDRIVES];
-
-
-/* Bit equates for matcd_data.flags*/
-
-#define MATCDINIT 0x0001 /*Probe ran on host adapter*/
-#define MATCDLABEL 0x0004 /*Valid TOC exists*/
-#define MATCDWARN 0x0020 /*Have reported an open disc change*/
-
-
-/* Bit equates for matcd_data.partflags*/
-
-#define MATCDOPEN 0x0001
-#define MATCDREADRAW 0x0002
-
-
-#define DELAY_STATUS 10000l /* 10000 * 1us */
-#define DELAY_GETREPLY 200000l /* 200000 * 2us */
-#define DELAY_SEEKREAD 20000l /* 20000 * 1us */
-#define matcd_delay DELAY
-
-
-
-/* Error classes returned by chk_error()*/
-
-#define ERR_RETRY 1 /*A retry might recover this*/
-#define ERR_INIT 2 /*A retry almost certainly will get this*/
-#define ERR_FATAL 3 /*This cannot be recovered from*/
-
-
-struct buf request_head[NUMCTRLRS]; /*A queue for each host interface*/
- int nextcontroller=0; /*Number of interface units found*/
- int drivepresent=0; /*Don't change this - see license*/
-static struct matcd_mbx *mbxsave;
-
-unsigned char if_state[4]={0,0,0,0}; /*State of the host I/F and buss*/
-
-/* Flags in the if_state array
-*/
-
-#define BUSSBUSY 0x01 /*Buss is already busy*/
-
-
-
-struct matcd_read2 {
- unsigned char start_msf[3];
- unsigned char end_msf[3];
-};
-
-/*---------------------------------------------------------------------------
- These macros take apart the minor number and yield the
- partition, drive on controller, and controller.
- This must match the settings in /dev/MAKEDEV.
----------------------------------------------------------------------------*/
-
-#define matcd_partition(dev) ((minor(dev)) & 0x07)
-#define matcd_ldrive(dev) (((minor(dev)) & 0x78) >> 3)
-#define matcd_cdrive(dev) (((minor(dev)) & 0x18) >> 3)
-#define matcd_controller(dev) (((minor(dev)) & 0x60) >> 5)
-
-
-#ifndef FREE2
-/*---------------------------------------------------------------------------
- This makes the long function names shorter for systems
- using the older kernel config program
----------------------------------------------------------------------------*/
-#define matcdopen matopen /*<8>*/
-#define matcdclose matclose /*<8>*/
-#define matcdstrategy matstrategy /*<8>*/
-#define matcdioctl matioctl /*<8>*/
-#define matcdsize matsize /*<8>*/
-#define matcddriver matdriver /*<10>*/
-#endif /*FREE2*/
-
-
-/*---------------------------------------------------------------------------
- Entry points and other connections to/from kernel - see conf.c
----------------------------------------------------------------------------*/
-
- int matcdopen(dev_t dev);
- int matcdclose(dev_t dev);
- void matcdstrategy(struct buf *bp);
- int matcdioctl(dev_t dev, int command, caddr_t addr, int flags);
- int matcdsize(dev_t dev);
-extern int hz;
-extern int matcd_probe(struct isa_device *dev);
-extern int matcd_attach(struct isa_device *dev);
-struct isa_driver matcddriver={matcd_probe, matcd_attach,
- "matcd"};
-
-
-/*---------------------------------------------------------------------------
- Internal function declarations
----------------------------------------------------------------------------*/
-
-static int matcd_getdisklabel(int ldrive);
-static void matcd_start(struct buf *dp);
-static void zero_cmd(char *);
-static void matcd_pread(int port, int count, unsigned char * data);
-static int matcd_fastcmd(int port,int ldrive,int cdrive,
- unsigned char * cp);
-static void matcd_slowcmd(int port,int ldrive,int cdrive,
- unsigned char * cp);
-static int matcd_getstat(int ldrive, int sflg);
-static void matcd_setflags(int ldrive, struct matcd_data *cd);
-static int msf2hsg(unsigned char *msf);
-static void matcd_blockread(int state);
-static int matcd_getreply(int ldrive, int dly);
-static void selectdrive(int port,int drive);
-static void doreset(int port,int cdrive);
-static int doprobe(int port,int cdrive);
-static void watchdog(int state, char * foo);
-static void lockbuss(int controller, int ldrive);
-static void unlockbuss(int controller, int ldrive);
-static int matcd_volinfo(int ldrive);
-static void draincmd(int port,int cdrive,int ldrive);
-static int get_error(int port, int ldrive, int cdrive);
-static int chk_error(int errnum);
-static int msf_to_blk(unsigned char * cd);
- int docmd(char *cmd, int ldrive, int cdrive, int controller,
- int port);
- int get_stat(int port, int ldrive);
- int matcd_eject(int ldrive, int cdrive, int controller);
- int media_chk(struct matcd_data *cd, int errnum, int ldrive);
- int waitforit(int timelimit, int state, int port, char *where);
-#ifdef FULLDRIVER
-static int matcd_playtracks(int ldrive, int cdrive, int controller,
- struct ioc_play_track *pt);
-static int matcd_playmsf(int ldrive, int cdrive, int controller,
- struct ioc_play_msf *pt);
-static int matcd_pause(int ldrive, int cdrive, int controller,
- struct ioc_play_msf * addr,int action);
-static int matcd_stop(int ldrive, int cdrive, int controller,
- struct ioc_play_msf * addr);
-#endif /*FULLDRIVER*/
-
-
-/*----------------------------------------------------------------------
- matcdopen - Open the device
-
- This routine actually gets called every time anybody opens
- any partition on a drive. But the first call is the one that
- does all the work.
-
- If you #define LOCKDRIVE, the drive eject button will be ignored
- while any partition on the drive is open.
-----------------------------------------------------------------------*/
-int matcdopen(dev_t dev)
-{
- int cdrive,ldrive,partition,controller;
- struct matcd_data *cd;
- int i,z,port;
- unsigned char cmd[MAXCMDSIZ];
-
-#if DIAGPORT == 0x302 /*<10>*/
- DIAGOUT(0x300,0x00); /*<10>Init diag board in case some
- other device probe scrambled it*/
-#endif /*<10>DIAGPORT*/
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0x10); /*Show where we are*/
-#endif /*DIAGPORT*/
- ldrive=matcd_ldrive(dev);
- cdrive=matcd_cdrive(dev);
- partition=matcd_partition(dev);
- controller=matcd_controller(dev);
- cd= &matcd_data[ldrive];
- port=cd->iobase; /*and port#*/
-
- if (ldrive >= TOTALDRIVES) return(ENXIO);
-
-
-#ifdef DEBUGOPEN
- printf("matcd%d: Open: dev %x partition %x controller %x flags %x cdrive %x\n",
- ldrive,dev,partition,controller,cd->flags,matcd_cdrive(dev));
-#endif /*DEBUGOPEN*/
-
- if (!(cd->flags & MATCDINIT)) { /*Did probe find this drive*/
- return(ENXIO);
- }
-
- if (!(cd->flags & MATCDLABEL) &&
- cd->openflags) { /*Has drive completely closed?*/
- return(ENXIO); /*No, all partitions must close*/
- }
-
-
-/* Now, test to see if the media is ready
-*/
-
- lockbuss(controller,ldrive);
- zero_cmd(cmd);
- cmd[0]=NOP; /*Test drive*/
- matcd_slowcmd(port,ldrive,cdrive,cmd);
- i=waitforit(10*TICKRES,DTEN,port,"matcdopen");
- z=get_stat(port,ldrive); /*Read and toss status byte*/
- unlockbuss(controller, ldrive); /*Release buss lock*/
- if ((z & MATCD_ST_DSKIN)==0) { /*Is there a disc in the drive?*/
-#ifdef DEBUGOPEN
- printf("matcd%d: No Disc in open\n",ldrive);
-#endif /*DEBUGOPEN*/
- return(ENXIO);
- }
- if (z & MATCD_ST_ERROR) { /*Was there an error*/
- i=get_error(port,ldrive,cdrive); /*Find out what it was*/
- if (cd->openflags) { /*Any parts open?*/
- if (media_chk(cd,i,ldrive)) { /*Was it a disc chg?*/
-#ifdef DEBUGOPEN
- printf("matcd%d: Disc change detected i %x z %x\n",
- ldrive,i,z);
-#endif /*DEBUGOPEN*/
- return(ENOTTY);
- }
- }
- }
-
-/* Here we fill in the disklabel structure although most is
- hardcoded.
-*/
-
- if ((cd->flags & MATCDLABEL)==0) {
- bzero(&cd->dlabel,sizeof(struct disklabel));
-
-
-/* Now we query the drive for the actual size of the media.
- This is where we find out of there is any media or if the
- media isn't a Mode 1 or Mode 2/XA disc.
- See version information about Mode 2/XA support.
-*/
- lockbuss(controller,ldrive);
- i=matcdsize(dev);
- unlockbuss(controller, ldrive); /*Release buss lock*/
-#ifdef DEBUGOPEN
- printf("matcd%d: Buss unlocked in open\n",ldrive);
-#endif /*DEBUGOPEN*/
- if (i < 0) {
- printf("matcd%d: Could not read the disc size\n",ldrive);
- return(ENXIO);
- } /*matcdsize filled in rest of dlabel*/
-
-/* Based on the results, fill in the variable entries in the disklabel
-*/
- cd->dlabel.d_secsize=cd->blksize;
- cd->dlabel.d_ncylinders=(cd->disksize/100)+1;
- cd->dlabel.d_secperunit=cd->disksize;
- cd->dlabel.d_partitions[0].p_size=cd->disksize;
- cd->dlabel.d_checksum=dkcksum(&cd->dlabel);
-
-
-/* Now fill in the hardcoded section
-*/
- /*123456789012345678*/
- strncpy(cd->dlabel.d_typename,"Matsushita CDR ",16);
- strncpy(cd->dlabel.d_packname,"(c) 1994, fdiv ",16);
- cd->dlabel.d_magic=DISKMAGIC;
- cd->dlabel.d_magic2=DISKMAGIC;
- cd->dlabel.d_nsectors=100;
- cd->dlabel.d_secpercyl=100;
- cd->dlabel.d_ntracks=1;
- cd->dlabel.d_interleave=1;
- cd->dlabel.d_rpm=300;
- cd->dlabel.d_npartitions=1; /*See note below*/
- cd->dlabel.d_partitions[0].p_offset=0;
- cd->dlabel.d_partitions[0].p_fstype=9;
- cd->dlabel.d_flags=D_REMOVABLE;
-
-/* I originally considered allowing the partition match tracks or
- sessions on the media, but since you are allowed up to 99
- tracks in the RedBook world, this would not fit in with the
- BSD fixed partition count scheme. So ioctls are used to shift
- the track to be accessed into partition 1.
-*/
-
- cd->flags |= MATCDLABEL; /*Mark drive as having TOC*/
- }
-
-#ifdef DEBUGOPEN
- printf("matcd%d open2: partition=%d disksize=%d blksize=%x flags=%x\n",
- ldrive,partition,cd->disksize,cd->blksize,cd->flags);
-#endif /*DEBUGOPEN*/
-
-#ifdef LOCKDRIVE
- if (cd->openflags==0) {
- lockbuss(controller,ldrive);
- zero_cmd(cmd);
- cmd[0]=LOCK; /*Lock drive*/
- cmd[1]=1;
- matcd_slowcmd(port,ldrive,cdrive,cmd);
- i=waitforit(10*TICKRES,DTEN,port,"matcdopen");
- z=get_stat(port,ldrive);/*Read and toss status byte*/
- unlockbuss(controller, ldrive); /*Release buss lock*/
- }
-#endif /*LOCKDRIVE*/
- cd->openflags |= (1<<partition);/*Mark partition open*/
-
- if (partition==RAW_PART ||
- (partition < cd->dlabel.d_npartitions &&
- cd->dlabel.d_partitions[partition].p_fstype != FS_UNUSED)) {
- cd->partflags[partition] |= MATCDOPEN;
- if (partition == RAW_PART) {
- cd->partflags[partition] |= MATCDREADRAW;
- }
-#ifdef DEBUGOPEN
- printf("matcd%d: Open is complete\n",ldrive);
-#endif /*DEBUGOPEN*/
- return(0);
- }
-#ifdef DEBUGOPEN
- printf("matcd%d: Open FAILED\n",ldrive);
-#endif /*DEBUGOPEN*/
- return(ENXIO);
-}
-
-
-/*----------------------------------------------------------------------
- matcdclose - Close the device
-
- Depending on how you compiled the driver, close may not
- do much other than clear some driver settings.
- Note that audio playback will continue.
-
- If you did #define LOCKDRIVE, the drive was locked when the
- matcdopen call is done. If we did that, then we unlock the
- drive now.
-----------------------------------------------------------------------*/
-
-int matcdclose(dev_t dev)
-{
- int ldrive,cdrive,port,partition,controller,i,z;
- struct matcd_data *cd;
- unsigned char cmd[MAXCMDSIZ];
-
- ldrive = matcd_ldrive(dev);
- cdrive=matcd_cdrive(dev);
- cd=matcd_data + ldrive;
- port=cd->iobase; /*and port#*/
-
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0x20); /*Show where we are*/
-#endif /*DIAGPORT*/
- if (ldrive >= TOTALDRIVES)
- return(ENXIO);
-
- partition = matcd_partition(dev);
- controller=matcd_controller(dev);
-#ifdef DEBUGOPEN
- printf("matcd%d: Close partition=%d\n", ldrive, partition);
-#endif /*DEBUGOPEN*/
-
- if (!(cd->flags & MATCDINIT))
- return(ENXIO);
-
- cd->partflags[partition] &= ~(MATCDOPEN|MATCDREADRAW);
- cd->openflags &= ~(1<<partition);
-#ifdef LOCKDRIVE
- if (cd->openflags==0) {
- lockbuss(controller,ldrive);
- zero_cmd(cmd);
- cmd[0]=LOCK; /*Unlock drive*/
- matcd_slowcmd(port,ldrive,cdrive,cmd);
- i=waitforit(10*TICKRES,DTEN,port,"matcdopen");
- z=get_stat(port,ldrive);/*Read and toss status byte*/
- unlockbuss(controller, ldrive); /*Release buss lock*/
- }
-#endif /*LOCKDRIVE*/
- cd->flags &= ~MATCDWARN; /*Clear any warning flag*/
- return(0);
-}
-
-
-/*----------------------------------------------------------------------
- matcdstrategy - Accepts I/O requests from kernel for processing
-
- This routine accepts a read request block pointer (historically
- but somewhat inaccurately called *bp for buffer pointer).
- Various sanity checks are performed on the request.
- When we are happy with the request and the state of the device,
- the request is added to the queue of requests for the controller
- that the drive is connected to. We support multiple controllers
- so there are multiple queues. Once the request is added, we
- call the matcd_start routine to start the device in case it isn't
- doing something already. All I/O including ioctl requests
- rely on the current request starting the next one before exiting.
-----------------------------------------------------------------------*/
-
-void matcdstrategy(struct buf *bp)
-{
- struct matcd_data *cd;
- struct buf *dp;
- int s;
- int ldrive,controller;
-
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0x30); /*Show where we are*/
-#endif /*DIAGPORT*/
- ldrive=matcd_ldrive(bp->b_dev);
- controller=matcd_controller(bp->b_dev);
- cd= &matcd_data[ldrive];
-
-#ifdef DEBUGIO
- printf("matcd%d: Strategy: buf=0x%lx, block#=%ld bcount=%ld\n",
- ldrive,bp,bp->b_blkno,bp->b_bcount);
-#endif /*DEBUGIO*/
-
-
- if (ldrive >= TOTALDRIVES || bp->b_blkno < 0) {
- printf("matcd%d: Bogus parameters received - kernel may be corrupted\n",ldrive);
- bp->b_error=EINVAL;
- bp->b_flags|=B_ERROR;
- goto bad;
- }
-
- if (!(cd->flags & MATCDLABEL)) {
- bp->b_error = EIO;
- goto bad;
- }
-
- if (!(bp->b_flags & B_READ)) {
- bp->b_error = EROFS;
- goto bad;
- }
-
- if (bp->b_bcount==0) /*Request is zero-length - all done*/
- goto done;
-
- if (matcd_partition(bp->b_dev) != RAW_PART) {
- if (!(cd->flags & MATCDLABEL)) {
- bp->b_error = EIO;
- goto bad;
- }
- if (bounds_check_with_label(bp,&cd->dlabel,1) <= 0) {
- goto done;
- }
- } else {
- bp->b_pblkno=bp->b_blkno;
- bp->b_resid=0;
- }
-
- s=splbio(); /*Make sure we don't get intr'ed*/
- dp=&request_head[controller]; /*Pointer to controller queue*/
- disksort(dp,bp); /*Add new request (bp) to queue (dp
- and sort the requests in a way that
- may not be ideal for CD-ROM media*/
-
-#ifdef DEBUGQUEUE
- printf("matcd%d: Dump BP chain: -------\n",ldrive);
- while (bp) {
- printf("Block %d\n",bp->b_pblkno);
-#ifdef FREE2
- bp=bp->b_actf;
-#else /*FREE2*/
- bp=bp->av_forw;
-#endif /*FREE2*/
- }
- printf("matcd%d: ---------------------\n",ldrive);
-#endif /*DEBUGQUEUE*/
-
- matcd_start(dp); /*Ok, with our newly sorted queue,
- see if we can start an I/O operation
- right now*/
- splx(s); /*Return priorities to normal*/
- return; /*All done*/
-
-bad: bp->b_flags |= B_ERROR; /*Request bad in some way*/
-done: bp->b_resid = bp->b_bcount; /*Show un read amount*/
- biodone(bp); /*Signal we have done all we plan to*/
- return;
-}
-
-
-/*----------------------------------------------------------------------
- matcd_start - Pull a request from the queue and consider doing it.
-----------------------------------------------------------------------*/
-
-static void matcd_start(struct buf *dp)
-{
- struct matcd_data *cd;
- struct buf *bp;
- struct partition *p;
- int part,ldrive,controller;
- register s;
-
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0x40); /*Show where we are*/
- diagloop=0;
-#endif /*DIAGPORT*/
- if ((bp=dp->b_actf) == NULL) { /*Nothing on read queue to do?*/
- wakeup((caddr_t)&matcd_data->status); /*Wakeup any blocked*/
- return; /* opens, ioctls, etc*/
- }
-
- ldrive=matcd_ldrive(bp->b_dev); /*Get logical drive#*/
- cd=&matcd_data[ldrive]; /*Get pointer to data for this drive*/
- controller=matcd_controller(bp->b_dev); /*Also get interface #*/
-#ifdef DEBUGIO
- printf("matcd%d: In start controller %d\n",ldrive,controller);
-#endif /*DEBUGIO*/
-
- if (if_state[controller] & BUSSBUSY) {
-#ifdef DEBUGIO
- printf("matcd%d: Dropping thread in start, controller %d\n",
- ldrive,controller);
-#endif /*DEBUGIO*/
- return;
- }
-
-#ifdef FREE2
- dp->b_actf = bp->b_actf;
-#else /*FREE2*/
- dp->b_actf = bp->av_forw; /*Get next request from queue*/
-#endif /*FREE2*/
-
- part=matcd_partition(bp->b_dev);
- p=cd->dlabel.d_partitions + part;
-
- if_state[controller] |= BUSSBUSY;/*Mark buss as busy*/
- cd->mbx.ldrive=ldrive; /*Save current logical drive*/
- cd->mbx.controller=controller; /*and controller*/
- cd->mbx.partition=part; /*and partition (2048 vs 2532)*/
- cd->mbx.port=cd->iobase; /*and port#*/
- cd->mbx.retry=MATCD_RETRYS; /*and the retry count*/
- cd->mbx.bp=bp; /*and the bp*/
- cd->mbx.p_offset=p->p_offset; /*and where the data will go*/
- matcd_blockread(MATCD_READ_1+ldrive); /*Actually start the read*/
- return; /*Dropping thread. matcd_blockread
- must have scheduled a timeout or
- we will go to sleep forever*/
-}
-
-
-/*----------------------------------------------------------------------
- matcdioctl - Process things that aren't block reads
-
- In this driver, ioctls are used mainly to change
- the mode the drive is running in, play audio and other
- things that don't fit into the block read scheme of things.
-----------------------------------------------------------------------*/
-
-int matcdioctl(dev_t dev, int command, caddr_t addr, int flags)
-{
- struct matcd_data *cd;
- int ldrive,cdrive,partition;
- int i,z;
- unsigned char * p;
- int port, controller;
- unsigned char zz;
-
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0x50); /*Show where we are*/
-#endif /*DIAGPORT*/
- ldrive=matcd_ldrive(dev);
- cdrive=matcd_cdrive(dev);
- partition=matcd_partition(dev);
- controller=ldrive>>2;
- cd = &matcd_data[ldrive];
- port=cd->iobase;
-
-#ifdef DEBUGIOCTL
- printf("matcd%d: ioctl %x cdrive %x parms ",ldrive,command,cdrive);
- for (i=0;i<10;i++) {
- zz=addr[i];
- printf("%02x ",zz);
- }
- printf(" flags %x\n",cd->flags);
-#endif /*DEBUGIOCTL*/
-
- if (!(cd->flags & MATCDLABEL)) /*Did we read TOC OK?*/
- return(EIO);
-
- switch(command) {
- case DIOCSBAD: /*<9>*/
- return(EINVAL); /*<9>*/
- case DIOCGDINFO: /*<9>*/
- *(struct disklabel *) addr = cd->dlabel; /*<9>*/
- return(0); /*<9>*/
- case DIOCGPART: /*<9>*/
- ((struct partinfo *) addr)->disklab=&cd->dlabel;/*<9>*/
- ((struct partinfo *) addr)->part= /*<9>*/
- &cd->dlabel.d_partitions[matcd_partition(dev)];/*<9>*/
- return(0); /*<9>*/
- case DIOCWDINFO: /*<9>*/
- case DIOCSDINFO: /*<9>*/
-#ifdef FREE2 /*<10>*/
- if ((flags & FWRITE) == 0) { /*<9>*/
- return(EBADF); /*<9>*/
- } /*<9>*/
- else { /*<9>*/
- return setdisklabel(&cd->dlabel, /*<9>*/
- (struct disklabel *) addr, 0);/*<9>*/
- } /*<9>*/
-#endif /*<10>FREE2*/
- case DIOCWLABEL: /*<9>*/
- return(EBADF); /*<9>*/
- case CDIOCEJECT:
- return(matcd_eject(ldrive, cdrive, controller));
-#ifdef FULLDRIVER
- case CDIOCPLAYTRACKS:
- return(matcd_playtracks(ldrive, cdrive, controller,
- (struct ioc_play_track *) addr));
- case CDIOCPLAYMSF:
- return(matcd_playmsf(ldrive, cdrive, controller,
- (struct ioc_play_msf *) addr));
- case CDIOCRESUME:
- return(matcd_pause(ldrive, cdrive, controller,
- (struct ioc_play_msf *) addr,RESUME));
- case CDIOCPAUSE:
- return(matcd_pause(ldrive, cdrive, controller,
- (struct ioc_play_msf *) addr,0));
- case CDIOCSTOP:
- return(matcd_stop(ldrive, cdrive, controller,
- (struct ioc_play_msf *) addr));
-
- case CDIOCGETVOL:
- case CDIOCSETVOL:
- case CDIOCSETMONO:
- case CDIOCSETSTERIO:
- case CDIOCSETMUTE:
- case CDIOCSETLEFT:
- case CDIOCSETRIGHT:
-#endif /*FULLDRIVER*/
-
- case CDIOCREADSUBCHANNEL:
- case CDIOREADTOCHEADER:
- case CDIOREADTOCENTRYS:
-
- case CDIOCSETPATCH:
- case CDIOCSTART:
- case CDIOCRESET:
- return(EINVAL);
- default:
- return(ENOTTY);
- }
-}
-
-/*----------------------------------------------------------------------
- matcdsize - Reports how many blocks exist on the disc.
-----------------------------------------------------------------------*/
-
-int matcdsize(dev_t dev)
-{
- int size,blksize;
- int ldrive,part;
- struct matcd_data *cd;
-
- ldrive=matcd_ldrive(dev);
- part=matcd_partition(dev);
- if (part==RAW_PART)
- blksize=MATCDRBLK; /*2353*/
- else
- blksize=MATCDBLK; /*2048*/
-
- cd = &matcd_data[ldrive];
-
- if (matcd_volinfo(ldrive) >= 0) {
- cd->blksize=blksize;
- size=msf_to_blk((char * )&cd->volinfo.vol_msf);
-
- cd->disksize=size*(blksize/DEV_BSIZE);
-#ifdef DEBUGOPEN
- printf("matcd%d: Media size %d\n",ldrive,size);
-#endif /*DEBUGOPEN*/
- return(0);
- }
- return(-1);
-}
-
-/*----------------------------------------------------------------------
- matcd_probe - Search for host interface/adapters
-
- The probe routine hunts for the first drive on the interface since
- there is no way to locate just the adapter. It also resets the
- entire drive chain while it is there. matcd_attach() takes care of
- the rest of the initialization.
-
- The probe routine can be compiled two ways. In AUTOHUNT mode,
- the kernel config file can say "port?" and we will check all ports
- listed in the port_hint array (see above).
-
- Without AUTOHUNT set, the config file must list a specific port
- address to check.
-
- Note that specifying the explicit addresses makes boot-up a lot
- faster.
-
- The probe will locate Panasonic/Creative interface on the following
- Creative adapter boards:
- #1730 Sound Blaster 16
- #1740 Sound Blaster 16 (cost reduced)
- #1810 omniCD upgrade kit adapter card (stand-alone CD)
- #3100 PhoneBlaster SB16 + Sierra 14.4K modem combo
- Creative releases a newer and cheaper-to-make Sound Blaster
- board every few months, so by the original release date of this
- software, there are probably 8 different board models called
- Sound Blaster 16. These include "Vibra", "Value", etc.
-
- Please report additional part numbers and board descriptions
- and new port numbers that work to the author.
-
-----------------------------------------------------------------------*/
-
-int matcd_probe(struct isa_device *dev)
-{
- int i,cdrive;
- unsigned char y,z,drive;
- int level;
- int port = dev->id_iobase; /*Take port hint from config file*/
- cdrive=nextcontroller; /*Controller defined by pass for now*/
-
-#if DIAGPORT == 0x302 /*<10>*/
- DIAGOUT(0x300,0x00); /*<10>Init diag board in case some
- other device probe scrambled it*/
-#endif /*<10>DIAGPORT*/
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0x60); /*Show where we are*/
-#endif /*DIAGPORT*/
- if (nextcontroller==NUMCTRLRS) {
- printf("matcdc%d: - Too many interfaces specified in config\n",
- nextcontroller);
- return(0);
- }
- if (nextcontroller==0) { /*Very first time to be called*/
- for (i=0; i<TOTALDRIVES; i++) {
- matcd_data[i].drivemode=MODE_UNKNOWN;
- matcd_data[i].flags=0;
- }
- }
-
- i=nextcontroller*DRIVESPERC; /*Precompute controller offset*/
- for (y=0; y<DRIVESPERC; y++) {
- matcd_data[i+y].flags=0;
- matcd_data[i+y].config=0;
- }
-
-#ifdef DEBUGPROBE
- printf("matcdc%d: In probe i %d y %d port %x\n",
- nextcontroller,i,y,port);
-#endif /*DEBUGPROBE*/
-#ifdef AUTOHUNT
-#ifdef DEBUGPROBE
- printf("matcd%d: size of port_hints %d\n",
- nextcontroller,sizeof(port_hints));
-#endif /*DEBUGPROBE*/
- if (port==-1) {
- for(i=0;i<(sizeof(port_hints)/sizeof(short));i++) {
- port=port_hints[i];
-#ifdef DEBUGPROBE
- printf("matcdc%d: Port hint %x\n",nextcontroller,port);
-#endif /*DEBUGPROBE*/
- if (port==-1) {
- dev->id_iobase=-1; /*Put port ? back*/
- return(0);/*Nothing left to try*/
- }
- if (port!=0) { /*Unused port found*/
- dev->id_iobase=port;
- port_hints[i]=0;/*Don't use that port again*/
- if (doprobe(port,cdrive)==0) return(NUMPORTS);
- }
- }
- dev->id_iobase=-1; /*Put port ? back as it was*/
- return(0); /*Interface not found*/
-
- } else { /*Config specified a port*/
- i=0; /*so eliminate it from the hint list*/
- for(i=0;;i++) { /*or we might try to assign it again*/
- if (port_hints[i]== -1) break; /*End of list*/
- if (port_hints[i]==port) {
- port_hints[i]=0; /*Clear duplicate*/
- break;
- }
- }
- if (doprobe(port,cdrive)==0) return(NUMPORTS);
- else return(0);
- }
-#else /*AUTOHUNT*/
- if (port==-1) {
- printf("matcd%d: AUTOHUNT disabled but port? specified in config\n",
- nextcontroller);
- return(0);
- }
- if (doprobe(port,cdrive)==0) return(NUMPORTS);
- else return(0);
-#endif /*AUTOHUNT*/
-}
-
-/*----------------------------------------------------------------------
- doprobe - Common probe code that actually checks the ports we
- have decided to test.
-----------------------------------------------------------------------*/
-
-int doprobe(int port,int cdrive)
-{
- unsigned char cmd[MAXCMDSIZ];
-
-#ifdef RESETONBOOT
- doreset(port,cdrive); /*Reset what might be our device*/
-#endif /*RESETONBOOT*/
-
- zero_cmd(cmd);
- cmd[0]=NOP; /*A reasonably harmless command.
- This command will fail after
- power-up or after reset. That's OK*/
- if (matcd_fastcmd(port,0,0,cmd)==0) {/*Issue command*/
- inb(port+CMD); /*Read status byte*/
-#ifdef DEBUGPROBE
- printf("matcdc%d: Probe found something\n",nextcontroller);
-#endif /*DEBUGPROBE*/
- if (drivepresent==0) { /*Don't change this - see license*/
- printf("matcd - Matsushita (Panasonic) CD-ROM Driver by FDIV, %s\n",MATCDVERSION);
- /*Don't change this - see license*/
- drivepresent++; /*Don't change this - see license*/
- } /*Don't change this - see license*/
- return(0); /*Drive 0 detected*/
- }
-#ifdef DEBUGPROBE
- printf("matcdc%d: Probe DID NOT find something\n",nextcontroller);
-#endif /*DEBUGPROBE*/
- return(1); /*Nothing detected*/
-}
-
-
-/*----------------------------------------------------------------------
- matcd_attach - Locates drives on the adapters that were located.
- If we got here, we located a interface and at least one
- drive. Now we figure out how many drives are under that
- interface. The Panasonic interface is too simple to call
- it a controller, but in the existing PDP model, that is
- what it would be.
-----------------------------------------------------------------------*/
-
-int matcd_attach(struct isa_device *dev)
-{
- int i;
- unsigned char y,z,cdrive;
- int level;
- unsigned char cmd[MAXCMDSIZ];
- unsigned char data[12];
- struct matcd_data *cd;
- int port = dev->id_iobase; /*Take port ID selected in probe()*/
-
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0x70); /*Show where we are*/
-#endif /*DIAGPORT*/
-#ifdef DEBUGPROBE
- printf("matcdc: Attach dev %x id_unit %d\n",dev,dev->id_unit);
-#endif /*DEBUGPROBE*/
- for (cdrive=0; cdrive<4; cdrive++) { /*We're hunting drives...*/
- zero_cmd(cmd);
- cmd[0]=NOP; /*A reasonably harmless command.
- This command will fail after
- power-up or after reset. It's OK*/
- i=cdrive+(DRIVESPERC*nextcontroller);
- if (matcd_fastcmd(port,i,cdrive,cmd)==0) { /*Issue command*/
- z=get_stat(port,cdrive);/*Read and toss status byte*/
- if ((z & MATCD_ST_ERROR)) { /*If there was an error,
- we must ask for error info
- or subsequent cmds fail*/
- zero_cmd(cmd);
- cmd[0]=READERROR; /*Inquire*/
- matcd_fastcmd(port,i,cdrive,cmd);
- matcd_pread(port,8,data);/*Read data returned*/
- z=get_stat(port,i);/*Read and toss status byte*/
-#ifdef DEBUGPROBE
- printf("matcd%d: Status byte %x ",i,z);
-#endif /*DEBUGPROBE*/
- }
- zero_cmd(cmd);
- cmd[0]=READID; /*Get drive ID*/
- matcd_fastcmd(port,i,cdrive,cmd);
- matcd_pread(port,10,data);/*Read Drive Parm*/
- z=get_stat(port,i); /*Read and toss status byte*/
- data[10]=0; /*Build ASCIZ string*/
- printf("matcd%d: [%s] ",i,data);
- cd=&matcd_data[i];
- cd->flags |= MATCDINIT;
- cd->iobase=dev->id_iobase;
- cd->openflags=0;
- for (i=0; i<MAXPARTITIONS; i++) {
- cd->partflags[i]=0;
- }
- }
- }
- nextcontroller++; /*Bump ctlr assign to next number*/
- printf("\n"); /*End line of drive reports*/
- return(1);
-}
-
-
-/*----------------------------------------------------------------------
- zero_cmd - Initialize command buffer
-----------------------------------------------------------------------*/
-
-void zero_cmd(char * lcmd)
-{
- int i;
- for (i=0; i<MAXCMDSIZ; lcmd[i++]=0);
- return;
-}
-
-
-/*----------------------------------------------------------------------
- doreset - Resets all the drives connected to a interface
-----------------------------------------------------------------------*/
-
-void doreset(int port,int cdrive)
-{
- register int i,z;
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0x80); /*Show where we are*/
-#endif /*DIAGPORT*/
- outb(port+RESET,0); /*Reset what might be our device*/
- /*Although this ensures a known
- state, it does close the drive
- door (if open) and aborts any
- audio playback in progress. */
- for (i=0;i<(125*ISABUSKHZ);i++){/*DELAY 500msec minimum. Worst
- case is door open and none or
- unreadable media */
- z=inb(port+CMD); /*This makes the loop run at a
- known speed. This value is ok
- for 8.33MHz bus*/
- }
- for (i=0;i<4;i++) {
- matcd_data[(cdrive*4)+i].drivemode=MODE_UNKNOWN;
- }
- return;
-}
-
-
-/*----------------------------------------------------------------------
- matcd_fastcmd - Send a command to a drive
-
- This routine executed commands that return instantly (or reasonably
- quick), such as RESET, NOP, READ ERROR, etc. The only difference
- between it and handling for slower commands, is the slower commands
- will invoke a timeout/sleep if they don't get an instant response.
-
- Fastcmd is mainly used in probe(), attach() and error related
- functions. Every attempt should be made to NOT use this
- function for any command that might be executed when the system
- is up.
-----------------------------------------------------------------------*/
-
-int matcd_fastcmd(int port,int ldrive,int cdrive,unsigned char * cp)
-{
- unsigned int i;
- unsigned char z;
- int level;
-#ifdef DEBUGCMD
- unsigned char *cx;
-#endif /*DEBUGCMD*/
-
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0x90); /*Show where we are*/
-#endif /*DIAGPORT*/
-
-
- draincmd(port,cdrive,ldrive); /*Make sure buss is really idle*/
-#ifdef DEBUGCMD
- cx=cp;
- printf("matcd%d: Fast Send port %x sel %d command %x %x %x %x %x %x %x\n",
- ldrive,port,cdrive,cx[0],cx[1],cx[2],cx[3],cx[4],cx[5],cx[6]);
-#endif /*DEBUGCMD*/
- selectdrive(port,cdrive); /*Enable the desired target drive*/
- level=splhigh(); /*----------------------------------------*/
- for (i=0; i<7; i++) { /*The seven bytes of the command*/
- outb(port+CMD,*cp++); /*must be sent within 10msec or*/
- } /*the drive will ignore the cmd*/
- splx(level); /*------------------------------------------------*/
-
-/* Now we wait a maximum of 240msec for a response.
- Only in a few rare cases does it take this long.
- If it is longer, the command should probably be slept on
- rather than increasing the timing value
-*/
-
- for (i=0; i<(60*ISABUSKHZ); i++) {
- z = (inb(port+STATUS)) & (DTEN|STEN);
- if (z != (DTEN|STEN)) break;
- }
-
-/* We are now either in a data or status phase, OR we timed-out.*/
-
- if (z == (DTEN|STEN)) {
-#ifdef DEBUGCMD
- printf("matcd%d: Command time-out\n",ldrive);
-#endif /*DEBUGCMD*/
- return(-1);
- }
- if (z != DTEN) {
- return(1);
- }
- return(0);
-}
-
-
-/*----------------------------------------------------------------------
- matcd_slowcmd - Issue a command to the drive
-
- This routine is for commands that might take a long time, such
- as a read or seek. The caller must determine if the command
- completes instantly or schedule a poll later on.
-----------------------------------------------------------------------*/
-
-void matcd_slowcmd(int port,int ldrive,int cdrive,unsigned char * cp)
-{
- unsigned int i;
- unsigned char z;
- int level,size;
-#ifdef DEBUGCMD
- unsigned char *cx;
-#endif /*DEBUGCMD*/
-
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0xa0); /*Show where we are*/
-#endif /*DIAGPORT*/
-
- draincmd(port,cdrive,ldrive); /*Make sure buss is really idle*/
-
-#ifdef DEBUGCMD
- cx=cp;
- printf("matcd%d: Slow Send port %x sel %d command %x %x %x %x %x %x %x\n",
- ldrive,port,cdrive,cx[0],cx[1],cx[2],cx[3],cx[4],cx[5],cx[6]);
-#endif /*DEBUGCMD*/
- selectdrive(port,cdrive); /*Enable the desired target drive*/
- if (*cp==ABORT) size=1;
- else size=7;
- level=splhigh(); /*----------------------------------------*/
- for (i=0; i<size; i++) { /*The seven bytes of the command*/
- outb(port+CMD,*cp++); /*must be sent within 10msec or*/
- } /*the drive will ignore the cmd*/
- splx(level); /*------------------------------------------------*/
- return;
-}
-
-
-/*----------------------------------------------------------------------
- draincmd - Makes certain the buss is idle and throws away
- any residual data from the drive if there is any.
- Called as preface to most commands.
- Added in Edit 5.
-
- This was added because switching drive modes causes
- the drive to emit buffers that were meant to be sent
- to the D-to-A to be sent to the host. See setmode.
-----------------------------------------------------------------------*/
-void draincmd(int port,int cdrive,int ldrive)
-{
- int i,z;
-
- i=inb(port+STATUS);
- if (i==0xff) return;
-
- printf("matcd%d: in draincmd: buss not idle %x - trying to fix\n",
- ldrive,inb(port+STATUS));
- if ((i & DTEN|STEN) == STEN) {
-#ifdef DEBUGCMD
- printf("matcd%d: Data present READING - ",ldrive);
-#endif /*DEBUGCMD*/
- i=0;
- outb(port+STATUS,1); /*Enable data read*/
- while ((inb(port+STATUS) & (DTEN|STEN)) == STEN) {
- inb(port+DATA);
- i++;
- }
- outb(port+STATUS,0);
-#ifdef DEBUGCMD
- printf("%d bytes read\n",i);
-#endif /*DEBUGCMD*/
- }
-#ifdef DEBUGCMD
- printf("matcd%d: Now read status: ",ldrive);
-#endif /*DEBUGCMD*/
- i=get_stat(port,ldrive); /*Read and toss status byte*/
- z=inb(port+STATUS); /*Read buss status*/
-#ifdef DEBUGCMD
- printf("Data byte %x and status is now %x\n",i,z);
-#endif /*DEBUGCMD*/
- if (z!=0xff) {
- printf("matcd%d: Buss not idle %x - resetting\n",
- cdrive,inb(port+STATUS));
- doreset(port,cdrive);
- }
- return;
-}
-
-
-/*----------------------------------------------------------------------
- selectdrive - Swaps drive select bits
-
- On Creative SB/SB16/stand-alone adapters, possibly to make them
- to reverse engineer. On these boards, the drive select signals
- are swapped.
-----------------------------------------------------------------------*/
-
-void selectdrive(int port,int drive)
-{
- switch(drive) {
- case 0: /*0x00 -> 0x00*/
- outb(port+SELECT,CRDRIVE0);
- break;
- case 1: /*0x01 -> 0x02*/
- outb(port+SELECT,CRDRIVE1);
- break;
- case 2: /*0x02 -> 0x01*/
- outb(port+SELECT,CRDRIVE2);
- break;
- case 3: /*0x03 -> 0x03*/
- outb(port+SELECT,CRDRIVE3);
- break;
- }
- return;
-}
-
-
-/*----------------------------------------------------------------------
- matcd_pread - Read small blocks of control data from a drive
-----------------------------------------------------------------------*/
-
-void matcd_pread(int port, int count, unsigned char * data)
-{
- int i;
-
- for (i=0; i<count; i++) {
- *data++ = inb(port+CMD);
- }
- return;
-}
-
-
-/*----------------------------------------------------------------------
- matcd_setmode - Configures disc to run in the desired data mode
-
- This routine assumes the drive is already idle.
-
-NOTE - Undocumented action of hardware: If you change (or reaffirm) data
- modes with MODESELECT + BLOCKPARAM immediately after a command was
- issued that aborted a DA play operation, the drive will unexpectedly
- return 2532 bytes of data in a data phase on the first or second
- subsequent command.
-
- Original Symptom: drive will refuse to go idle after reading data
- and status expected for a command. State mechanics for this are
- not fully understood.
-----------------------------------------------------------------------*/
-
-int matcd_setmode(int ldrive, int mode)
-{
- struct matcd_data *cd;
- int retries;
- int i,z,port,cdrive;
- unsigned char cmd[MAXCMDSIZ];
-
- cd = matcd_data + ldrive;
- retries=3;
- cdrive=ldrive&0x03;
- port=cd->iobase;
- if (cd->drivemode==mode) {
- return(0); /*Drive already set*/
- }
-
-/* The drive is not in the right mode, so we need to set it.
-*/
-
- zero_cmd(cmd);
- cmd[0]=MODESELECT; /*Set drive transfer modes*/
-/* cmd[1]=BLOCKPARAM; BLOCKPARAM==0*/
- cmd[2]=mode;
- switch(mode) {
- case MODE_DATA:
- cmd[3]=0x08; /*2048 bytes*/
- break;
- case MODE_USER:
- cmd[3]=0x09; /*2352 bytes*/
- cmd[4]=0x30;
- break;
- case MODE_DA:
- cmd[3]=0x09; /*2352 bytes*/
- cmd[4]=0x30;
- break;
- }
- i=0;
- while(retries-- > 0) {
- i=matcd_fastcmd(port,ldrive,cdrive,cmd);
- z=get_stat(port,ldrive);/*Read and toss status byte*/
- if (i==0) {
- cd->drivemode=mode; /*Set new mode*/
- return(i);
- }
- get_error(port,ldrive,cdrive);
- }
- cd->drivemode=MODE_UNKNOWN; /*We failed*/
- return(i);
-}
-
-
-/*----------------------------------------------------------------------
- matcd_volinfo - Read information from disc Table of Contents
-----------------------------------------------------------------------*/
-
-static int matcd_volinfo(int ldrive)
-{
- struct matcd_data *cd;
- int port,i;
- int z,cdrive;
- int retry;
- unsigned char cmd[MAXCMDSIZ];
- unsigned char data[12];
-
- retry=5;
- cd = &matcd_data[ldrive];
- cdrive=ldrive&0x03;
- port=cd->iobase;
-
-#ifdef DEBUGOPEN
- printf("matcd%d: In volinfo, port %x\n",ldrive,port);
-#endif /*DEBUGOPEN*/
-
- while(retry>0) {
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0xB0); /*Show where we are*/
-#endif /*DIAGPORT*/
- zero_cmd(cmd);
- cmd[0]=READDINFO; /*Read Disc Info*/
- matcd_slowcmd(port,ldrive,cdrive,cmd);
- i=waitforit(10*TICKRES,DTEN,port,"volinfo");
- if (i) { /*THIS SHOULD NOT HAPPEN*/
- z=get_stat(port,ldrive);/*Read and toss status byte*/
- printf("matcd%d: command failed, status %x\n",
- ldrive,z);
- return(-1);
- }
- matcd_pread(port, 6, data); /*Read data returned*/
- z=get_stat(port,ldrive);/*Read and toss status byte*/
-#ifdef DEBUGOPEN
- printf("matcd%d: Data got was %x %x %x %x %x %x ",ldrive,
- data[0],data[1],data[2], data[3],data[4],data[5]);
- printf("status byte %x\n",z);
-#endif /*DEBUGOPEN*/
- if ((z & MATCD_ST_ERROR)==0)
- break; /*No Error*/
-
-/* If media change or other error, you have to read error data or
- the drive will reject subsequent commands.
-*/
-
- if (chk_error(get_error(port, ldrive, cdrive))==ERR_FATAL) {
-#ifdef DEBUGOPEN
- printf("matcd%d: command failed, status %x\n",
- ldrive,z);
-#endif /*DEBUGOPEN*/
- return(-1);
- }
- if ((--retry)==0) return(-1);
-#ifdef DEBUGOPEN
- printf("matcd%d: Retrying",ldrive);
-#endif /*DEBUGOPEN*/
- }
-#ifdef DEBUGOPEN
- printf("matcd%d: Status port %x \n",ldrive,inb(port+STATUS));
-#endif /*DEBUGOPEN*/
-
- cd->volinfo.type=data[0];
- cd->volinfo.trk_high=data[2];
- cd->volinfo.trk_low=data[1];
- cd->volinfo.vol_msf[0]=data[3];
- cd->volinfo.vol_msf[1]=data[4];
- cd->volinfo.vol_msf[2]=data[5];
-
- if (cd->volinfo.trk_low + cd->volinfo.trk_high) {
- cd->flags |= MATCDLABEL;
- return(0);
- }
- return(-1);
-}
-
-
-/*----------------------------------------------------------------------
- blk_to_msf - Convert block numbers into CD disk block ids
-----------------------------------------------------------------------*/
-
-static void blk_to_msf(int blk, unsigned char *msf)
-{
- blk += 150; /*2 seconds skip required to
- reach ISO data*/
- msf[0] = blk/4500;
- blk %= 4500;
- msf[1] = blk / 75;
- msf[2] = blk % 75;
- return;
-}
-
-
-/*----------------------------------------------------------------------
- msf_to_blk - Convert CD disk block ids into block numbers
-----------------------------------------------------------------------*/
-
-static int msf_to_blk(unsigned char * cd)
-{
- return(((cd[0]*60) /*Convert MSF to*/
- +cd[1])*75 /*Blocks minus 2*/
- +cd[2]-150); /*seconds*/
-}
-
-
-/*----------------------------------------------------------------------
- matcd_blockread - Performs actual background disc I/O operations
-
- This routine is handed the block number to read, issues the
- command to the drive, waits for it to complete, reads the
- data or error, retries if needed, and returns the results
- to the host.
-----------------------------------------------------------------------*/
-
-static void matcd_blockread(int state)
-{
- struct matcd_mbx *mbx;
- int ldrive,cdrive;
- int port;
- struct buf *bp;
- struct buf *dp;
- struct matcd_data *cd;
- int i,k,z;
- int l,m;
- struct matcd_read2 rbuf;
- int blknum;
- caddr_t addr;
- int status;
- int errtyp;
- int phase;
- unsigned char cmd[MAXCMDSIZ];
-
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0xC0 + (diagloop * 0x100));/*Show where we are*/
-#endif /*DIAGPORT*/
- mbx = &matcd_data[state & 0x0f].mbx;
- ldrive=mbx->ldrive; /*ldrive is logical drive #*/
- cdrive=ldrive & 0x03; /*cdrive is drive # on a controller*/
- port=mbx->port; /*port is base port for i/f*/
- bp= mbx->bp;
- cd=&matcd_data[ldrive];
-
- dp=&request_head[mbx->controller];
-
-#ifdef DEBUGIO
- printf("matcd%d: Show state %x cdrive %d partition %d\n",
- ldrive,state,cdrive,mbx->partition);
-#endif /*DEBUGIO*/
-
-loop:
-#ifdef DEBUGIO
- printf("matcd%d: Top dp %x\n",ldrive,dp);
-#endif /*DEBUGIO*/
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0xCF + (diagloop * 0x100));/*Show where we are*/
-#endif /*DIAGPORT*/
- switch (state & 0xf0) {
- case MATCD_READ_1:
-#ifdef DEBUGIO
- printf("matcd%d: State 1 cd->flags %x\n",ldrive,cd->flags);
-#endif /*DEBUGIO*/
-#ifdef DIAGPORT
- diagloop=0;
- DIAGOUT(DIAGPORT,0xC1); /*Show where we are*/
-#endif /*DIAGPORT*/
- /* to check for raw/cooked mode */
- if (cd->partflags[mbx->partition] & MATCDREADRAW) {
- mbx->sz = MATCDRBLK;
- i=matcd_setmode(ldrive, MODE_DA);
-#ifdef DEBUGIO
- printf("matcd%d: Set MODE_DA result %d\n",ldrive,i);
-#endif /*DEBUGIO*/
- } else {
- mbx->sz = cd->blksize;
- i=matcd_setmode(ldrive, MODE_DATA);
-#ifdef DEBUGIO
- printf("matcd%d: Set MODE_DATA result %d\n",ldrive,i);
-#endif /*DEBUGIO*/
- }
- /*for first block*/
-#ifdef DEBUGIO
- printf("matcd%d: A mbx %x bp %x b_bcount %x sz %x\n",
- ldrive,mbx,bp,bp->b_bcount,mbx->sz);
-#endif /*DEBUGIO*/
- mbx->nblk = (bp->b_bcount + (mbx->sz-1)) / mbx->sz;
- mbx->skip=0;
-nextblock:
-#ifdef DEBUGIO
- printf("matcd%d: at Nextblock b_blkno %d\n",
- ldrive,bp->b_blkno);
-#endif /*DEBUGIO*/
-
- blknum=(bp->b_blkno / (mbx->sz/DEV_BSIZE))
- + mbx->p_offset + mbx->skip/mbx->sz;
-
- blk_to_msf(blknum,rbuf.start_msf);
-
- zero_cmd(cmd);
- cmd[0]=READ; /*Get drive ID*/
- cmd[1]=rbuf.start_msf[0];
- cmd[2]=rbuf.start_msf[1];
- cmd[3]=rbuf.start_msf[2];
- cmd[6]=1;
- matcd_slowcmd(port,ldrive,cdrive,cmd);
-
-/* Now that we have issued the command, check immediately to
- see if data is ready. The drive has read-ahead caching, so
- it is possible the data is already in the drive buffer.
-
- If the data is not ready, schedule a wakeup and later on this
- code will run again to see if the data is ready then.
-*/
-
- case MATCD_READ_2:
- state=MATCD_READ_2+ldrive;
- phase = (inb(port+STATUS)) & (DTEN|STEN);
-#ifdef DEBUGIO
- printf("matcd%d: In state 2 status %x ",ldrive,phase);
-#endif /*DEBUGIO*/
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0xC2 + (diagloop++ * 0x100));/*Show where we are*/
-#endif /*DIAGPORT*/
- switch(phase) {
- case (DTEN|STEN): /*DTEN==H STEN==H*/
-#ifdef DEBUGIO
- printf("matcd%d: Sleeping\n",ldrive);
-#endif /*DEBUGIO*/
- timeout((timeout_func_t)matcd_blockread,
- (caddr_t)MATCD_READ_2+ldrive,hz/100);
- return;
-
-
- case STEN: /*DTEN=L STEN=H*/
- case 0: /*DTEN=L STEN=L*/
-#ifdef DEBUGIO
- printf("matcd%d: Data Phase\n",ldrive);
-#endif /*DEBUGIO*/
- outb(port+STATUS,1); /*Enable data read*/
- addr=bp->b_un.b_addr + mbx->skip;
-#ifdef DEBUGIO
- printf("matcd%d: Xfer Addr %x size %x",
- ldrive,addr,mbx->sz);
-#endif /*DEBUGIO*/
- i=0;
- while(inb(port+STATUS)==0xfd) {
- *addr++=inb(port+DATA);
- i++;
- }
-#ifdef DEBUGIO
- printf("matcd%d: Read %d bytes\n",ldrive,i);
-#endif /*DEBUGIO*/
- outb(port+STATUS,0); /*Disable data read*/
-
-
-/* Now, wait for the Status phase to arrive. This will also
- tell us if any went wrong with the request.
-*/
- while((inb(port+STATUS)&(DTEN|STEN)) != DTEN);
- status=get_stat(port,ldrive); /*Read and toss status byte*/
-#ifdef DEBUGIO
- printf("matcd%d: Status port %x byte %x ",
- ldrive,i,status);
-#endif /*DEBUGIO*/
- if (status & MATCD_ST_ERROR) {
- i=get_error(port,ldrive,cdrive);
- printf("matcd%d: %s while reading block %d [Soft]\n",
- ldrive,matcderrors[i],bp->b_blkno);
- }
- media_chk(cd,i,ldrive);
-
- if (--mbx->nblk > 0) {
- mbx->skip += mbx->sz;
- goto nextblock; /*Oooooh, you flunk the course*/
- }
- bp->b_resid=0;
- biodone(bp);
-
- unlockbuss(ldrive>>2, ldrive); /*Release buss lock*/
- matcd_start(dp);
- return;
-
-/* Here we skipped the data phase and went directly to status.
- This indicates a hard error.
-*/
-
- case DTEN: /*DTEN=H STEN=L*/
- status=get_stat(port,ldrive); /*Read and toss status byte*/
-#ifdef DEBUGIO
- printf("matcd%d: error, status was %x\n",
- ldrive,status);
-#endif /*DEBUGIO*/
-
-/* Ok, we need more details, so read error. This is needed to issue
- any further commands anyway
-*/
-
- errtyp=get_error(port,ldrive,cdrive);
- printf("matcd%d: %s while reading block %d\n",
- ldrive,matcderrors[errtyp],bp->b_blkno);
-
- if (media_chk(cd,errtyp,ldrive))
- goto giveup;
-
- errtyp=chk_error(errtyp);
- switch(errtyp) {
- case ERR_RETRY: /*We can retry this error, but the
- drive probably has already*/
- if (mbx->retry-- > 0 ) {
- state=MATCD_READ_1+ldrive;
-#ifdef DEBUGIO
- printf("matcd%d: Attempting retry\n",
- ldrive);
-#endif /*DEBUGIO*/
- goto loop;
- }
- goto giveup;
-
-/* These errors usually indicate the user took the media from the
- drive while the dev was open. We will invalidate the unit
- until it closes when we see this.
-*/
- case ERR_INIT:/*Media probably was removed
- while the dev was open.
- Invalidate the unit until
- it is closed.*/
-
- case ERR_FATAL:/*This type of error is so
- bad we will never recover
- even if we retry.*/
- default:
-giveup:
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0xCE + (diagloop * 0x100));/*Show where we are*/
-#endif /*DIAGPORT*/
- bp->b_flags |= B_ERROR;
- bp->b_resid = bp->b_bcount;
- biodone(bp);
- unlockbuss(ldrive>>2, ldrive);
- matcd_start(dp);
- return;
- }
- }
- }
-}
-
-
-/*----------------------------------------------------------------------
- matcd_eject - Open drive tray
-----------------------------------------------------------------------*/
-
-int matcd_eject(int ldrive, int cdrive, int controller)
-{
- int retries,i,z,port;
- struct matcd_data *cd;
- unsigned char cmd[MAXCMDSIZ];
-
- cd=&matcd_data[ldrive];
- port=cd->iobase; /*Get I/O port base*/
-
- zero_cmd(cmd); /*Initialize command buffer*/
-#ifdef LOCKDRIVE
- cmd[0]=LOCK; /*Unlock drive*/
- i=docmd(cmd,ldrive,cdrive,controller,port); /*Issue command*/
-#endif /*LOCKDRIVE*/
- cmd[0]=DOOROPEN; /*Open Door*/
- i=docmd(cmd,ldrive,cdrive,controller,port); /*Issue command*/
- cd->flags &= ~MATCDLABEL; /*Mark volume info invalid*/
- return(i); /*Return result we got*/
-}
-
-
-/*----------------------------------------------------------------------
- docmd - Get the buss, do the command, wait for completion,
- attempt retries, give up the buss.
- For commands that do not return data.
-----------------------------------------------------------------------*/
-
-int docmd(char * cmd, int ldrive, int cdrive, int controller, int port)
-{
- int retries,i,z;
-
- lockbuss(controller, ldrive); /*Request buss*/
- retries=3;
- while(retries-- > 0) {
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0xD0); /*Show where we are*/
-#endif /*DIAGPORT*/
- matcd_slowcmd(port,ldrive,cdrive,cmd);
- i=waitforit(80*TICKRES,DTEN,port,"cmd");
- z=get_stat(port,ldrive);/*Read and toss status byte*/
- if ((z & MATCD_ST_ERROR)==0) break;
- i=chk_error(get_error(port,ldrive,cdrive));
- if (i!=ERR_INIT) {
- unlockbuss(controller, ldrive); /*Release buss*/
- return(EFAULT);
- }
- }
- unlockbuss(controller, ldrive); /*Release buss*/
- return(i);
-}
-
-
-/*----------------------------------------------------------------------
- get_error - Read the error that aborted a command.
- Created in Edit 6
-----------------------------------------------------------------------*/
-
-int get_error(int port, int ldrive, int cdrive)
-{
- int status,errnum;
- unsigned char cmd1[MAXCMDSIZ];
- unsigned char data[12];
-
- zero_cmd(cmd1);
- cmd1[0]=READERROR; /*Enquire*/
- matcd_fastcmd(port,ldrive,cdrive,cmd1);
- matcd_pread(port, 8, data); /*Read data returned*/
- errnum=data[2]; /*Caller wants it classified*/
- status=get_stat(port,ldrive); /*Read and toss status byte*/
-
-#ifdef DEBUGCMD
- printf("matcd%d: Chkerror found %x on command %x addrval %x statusdata %x statusport %x\n",
- ldrive,errnum,data[1],data[0],status,inb(port+STATUS));
-#endif /*DEBUGCMD*/
- return(errnum);
-}
-
-
-/*----------------------------------------------------------------------
- chk_error - Classify the error that the drive reported
- Created in Edit 6
-----------------------------------------------------------------------*/
-
-int chk_error(int errnum)
-{
- switch(errnum) {
-/* These are errors we can attempt a retry for, although the drive
- has already done so.
-*/
- case UNRECV_ERROR:
- case SEEK_ERROR:
- case TRACK_ERROR:
- case FOCUS_ERROR:
- case CLV_ERROR:
- case DATA_ERROR:
- return(ERR_RETRY);
-
-/* These errors usually indicate the user took the media from the
- drive while the dev was open. We will invalidate the unit
- until it closes when we see this.
-*/
- case NOT_READY:
- case MEDIA_CHANGED:
- case DISC_OUT:
- case HARD_RESET:
- return (ERR_INIT);
-
-/* These errors indicate the system is confused about the drive
- or media, and point to bugs in the driver or OS. These errors
- cannot be retried since you will always get the same error.
-*/
-
- case RAM_ERROR:
- case DIAG_ERROR:
- case CDB_ERROR:
- case END_ADDRESS:
- case MODE_ERROR:
- case ILLEGAL_REQ:
- case ADDRESS_ERROR:
- default:
- return (ERR_FATAL);
- }
-}
-
-
-/*----------------------------------------------------------------------
- get_stat - Reads status byte
-
- This routine should be totally unnecessary, performing the
- task with a single line of in-line code. However in special
- cases, the drives return blocks of data that are not associated
- with the command in question. This appears to be a firmware
- error and the rest of the driver makes an effort to avoid
- triggering the fault. However, reading and throwing this
- bogus data is faster and less destructive than resetting all
- the drives on a given controller, plus it leaves the other drives
- unaffected.
-----------------------------------------------------------------------*/
-
-int get_stat(int port,int ldrive)
-{
- int status;
- status=inb(port+DATA); /*Read the status byte, last step of cmd*/
- while ((inb(port+STATUS))!=0xff) {
- printf("matcd%d: get_stat: After reading status byte, buss didn't go idle\n",ldrive);
- if (( status & DTEN|STEN) == STEN) {
- int k;
- k=0;
-#ifdef DEBUGCMD
- printf("matcd%d: DATA PRESENT!!!! DISCARDING\n",ldrive);
-#endif /*DEBUGCMD*/
- outb(port+STATUS,1); /*Enable data read*/
- while ((inb(port+STATUS) & (DTEN|STEN)) == STEN) {
- inb(port+DATA);
-/* printf("%2x ",inb(port+DATA));*/
- k++;
- }
- outb(port+STATUS,0);
-#ifdef DEBUGCMD
- printf("\nmatcd%d: BYTES READ IN DATA was %d\n",
- ldrive,k);
-#endif /*DEBUGCMD*/
- }
- status=inb(port+DATA); /*Read the status byte again*/
-#ifdef DEBUGCMD
- printf("matcd%d: Next status byte is %x\n",ldrive,status);
-#endif /*DEBUGCMD*/
- }
- return(status);
-}
-
-
-/*----------------------------------------------------------------------
- waitforit - Waits for a command started by slowcmd to complete.
-----------------------------------------------------------------------*/
-
-int waitforit(int timelimit, int state, int port, char * where)
-{
- int i,j;
-
- j=i=0;
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0xE0); /*Show where we are*/
- diagloop=0;
-#endif /*DIAGPORT*/
-#ifdef DEBUGCMD
- printf("matcd: waitforit port %x timelimit %x hz %x\n",
- port,timelimit,hz);
-#endif /*DEBUGCMD*/
- while (i<timelimit) {
- j=inb(port+STATUS) & (STEN|DTEN); /*Read status*/
- if (j!=(STEN|DTEN)) break;
- timeout((timeout_func_t)watchdog, (caddr_t)0,hz/100);
- tsleep((caddr_t)&port_hints, PRIBIO, where, 0);
- i++;
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0xE1+(diagloop++ * 0x100)); /*Show where we are*/
-#endif /*DIAGPORT*/
- }
-#ifdef DEBUGCMD
- printf("matcd: Count was %d\n",i);
-#endif /*DEBUGCMD*/
- if (j==state) return(0); /*Command complete*/
-#ifdef DEBUGCMD
- printf("matcd: Timeout!");
-#endif /*DEBUGCMD*/
- return(1); /*Timeout occurred*/
-}
-
-
-/*----------------------------------------------------------------------
- watchdog - Gives us a heartbeat for things we are waiting on
-----------------------------------------------------------------------*/
-
-static void watchdog(int state, char * foo)
-{
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0xF0); /*Show where we are*/
-#endif /*DIAGPORT*/
- wakeup((caddr_t)&port_hints);
- return;
-}
-
-
-/*----------------------------------------------------------------------
- lockbuss - Wait for the buss on the requested driver interface
- to go idle and acquire it.
- Created in Edit 6
-----------------------------------------------------------------------*/
-
-void lockbuss(int controller, int ldrive)
-{
- while ((if_state[controller] & BUSSBUSY)) {
-#ifdef DEBUGSLEEP
- printf("matcd%d: Can't do it now - going to sleep\n,
- ldrive");
-#endif /*DEBUGSLEEP*/
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0xF1); /*Show where we are*/
-#endif /*DIAGPORT*/
- tsleep((caddr_t)&matcd_data->status, PRIBIO,
- "matcdopen", 0);
- }
- if_state[controller] |= BUSSBUSY; /*It's ours NOW*/
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0xF2); /*Show where we are*/
-#endif /*DIAGPORT*/
-#ifdef DEBUGSLEEP
- printf("matcd%d: BUSS locked in lockbuss\n",ldrive);
-#endif /*DEBUGSLEEP*/
-}
-
-
-/*----------------------------------------------------------------------
- lockbuss - Wait for the buss on the requested driver interface
- to go idle and acquire it.
- Created in Edit 6
-----------------------------------------------------------------------*/
-
-void unlockbuss(int controller, int ldrive)
-{
-#ifdef DIAGPORT
- DIAGOUT(DIAGPORT,0xF4); /*Show where we are*/
-#endif /*DIAGPORT*/
- if_state[controller] &= ~BUSSBUSY;
-#ifdef DEBUGSLEEP
- printf("matcd%d: bussunlocked\n",ldrive);
-#endif /*DEBUGSLEEP*/
- wakeup((caddr_t)&matcd_data->status); /*Wakeup other users*/
- matcd_start(&request_head[controller]); /*Wake up any block I/O*/
-}
-
-
-/*----------------------------------------------------------------------
- media_chk - Checks error for types related to media
- changes.
-----------------------------------------------------------------------*/
-
-int media_chk(struct matcd_data *cd,int errnum,int ldrive)
-{
- if (errnum==NOT_READY ||
- errnum==MEDIA_CHANGED ||
- errnum==HARD_RESET ||
- errnum==DISC_OUT) {
- cd->flags &= ~MATCDLABEL; /*Mark label as invalid*/
-
- if ((cd->flags & MATCDWARN)==0) { /*Have we said this*/
- printf("matcd%d: Media changed - Further I/O aborted until device closed\n",ldrive);
- cd->flags |= MATCDWARN;
- }
- return(1);
- }
- return(0);
-}
-
-
-/*----------------------------------------------------------------------
- The following functions are related to the audio playback
- capabilities of the drive. They can be omitted from the
- finished driver using the FULLDRIVER conditional.
-
- The full set of features the drive is capable of are currently
- not implemented but will be added in an upcoming release.
-----------------------------------------------------------------------*/
-#ifdef FULLDRIVER
-/*----------------------------------------------------------------------
- matcd_playtracks - Plays one or more audio tracks
-----------------------------------------------------------------------*/
-
-static int matcd_playtracks(int ldrive, int cdrive, int controller,
- struct ioc_play_track *pt)
-{
- struct matcd_data *cd;
- int start,end;
- int i,port;
- unsigned char cmd[MAXCMDSIZ];
-
- cd=&matcd_data[ldrive];
- port=cd->iobase;
-
- if ((cd->flags & MATCDLABEL)==0)
- return(EIO); /*Refuse after chg error*/
-
- start=pt->start_track;
- end=pt->end_track;
-
- if (start < 1 || /*Starting track valid?*/
- end < 1 || /*Ending track valid?*/
- start > end || /*Start higher than end?*/
- end > cd->volinfo.trk_high) /*End track higher than disc size?*/
- return(ESPIPE); /*Track out of range*/
-
- lockbuss(controller, ldrive); /*Request buss*/
- i=matcd_setmode(ldrive, MODE_DA);/*Force drive into audio mode*/
- unlockbuss(controller, ldrive); /*Release buss*/
- if (i!=0) {
- return(i); /*Not legal for this media?*/
- }
- zero_cmd(cmd);
- cmd[0]=PLAYTRKS; /*Play Audio Track/Index*/
- cmd[1]=start;
- cmd[2]=pt->start_index;
- cmd[3]=end;
- cmd[4]=pt->end_index;
- i=docmd(cmd,ldrive,cdrive,controller,port); /*Issue command*/
-#ifdef DEBUGIOCTL
- printf("matcd%d: Play track results %d \n",ldrive,i);
-#endif /*DEBUGIOCTL*/
- return(i);
-}
-
-
-/*----------------------------------------------------------------------
- matcd_playmsf - Plays between a range of blocks
-----------------------------------------------------------------------*/
-
-static int matcd_playmsf(int ldrive, int cdrive, int controller,
- struct ioc_play_msf *pt)
-{
- struct matcd_data *cd;
- int i,port;
- unsigned char cmd[MAXCMDSIZ];
-
- cd=&matcd_data[ldrive];
- port=cd->iobase;
-
-#ifdef DEBUGIOCTL
- printf("matcd%d: playmsf %2x %2x %2x -> %2x %2x %2x\n",
- ldrive,pt->start_m, pt->start_s, pt->start_f, pt->end_m,
- pt->end_s,pt->end_f);
-#endif /*DEBUGIOCTL*/
-
- if ((cd->flags & MATCDLABEL)==0)
- return(EIO); /*Refuse after chg error*/
-
- if ((cd->volinfo.vol_msf[0]==0 &&
- cd->volinfo.vol_msf[1]<2) || /*Must be after 0'1"75F*/
- msf_to_blk((char *)&pt->start_m) >
- msf_to_blk((char *)&cd->volinfo.vol_msf)) {
-#ifdef DEBUGIOCTL
- printf("matcd%d: Invalid block combination\n",ldrive);
-#endif /*DEBUGIOCTL*/
- return(ESPIPE); /*Track out of range*/
- }
-
-
- lockbuss(controller, ldrive); /*Request buss*/
- i=matcd_setmode(ldrive, MODE_DA);/*Force drive into audio mode*/
- unlockbuss(controller, ldrive); /*Release buss*/
- if (i!=0) {
- return(i); /*Not legal for this media?*/
- }
- zero_cmd(cmd);
- cmd[0]=PLAYBLOCKS; /*Play Audio Blocks*/
- cmd[1]=pt->start_m;
- cmd[2]=pt->start_s;
- cmd[3]=pt->start_f;
- cmd[4]=pt->end_m;
- cmd[5]=pt->end_s;
- cmd[6]=pt->end_f;
- i=docmd(cmd,ldrive,cdrive,controller,port); /*Issue command*/
- return(i);
-}
-
-
-/*----------------------------------------------------------------------
- matcd_pause - Pause or Resume audio playback
-----------------------------------------------------------------------*/
-
-static int matcd_pause(int ldrive, int cdrive, int controller,
- struct ioc_play_msf * addr,int action)
-{
- struct matcd_data *cd;
- int i,port;
- unsigned char cmd[MAXCMDSIZ];
-
- cd=&matcd_data[ldrive];
- port=cd->iobase;
-
- if ((cd->flags & MATCDLABEL)==0)
- return(EIO); /*Refuse after chg error*/
-
- zero_cmd(cmd);
- cmd[0]=PAUSE; /*Pause or Resume playing audio*/
- cmd[1]=action;
- i=docmd(cmd,ldrive,cdrive,controller,port); /*Issue command*/
-#ifdef DEBUGIOCTL
- printf("matcd%d: Pause / Resume results %d \n",ldrive,i);
-#endif /*DEBUGIOCTL*/
- return(i);
-}
-
-
-/*----------------------------------------------------------------------
- matcd_stop - Stop audio playback
-----------------------------------------------------------------------*/
-
-static int matcd_stop(int ldrive, int cdrive, int controller,
- struct ioc_play_msf * addr)
-{
- struct matcd_data *cd;
- int i,port;
- unsigned char cmd[MAXCMDSIZ];
-
- cd=&matcd_data[ldrive];
- port=cd->iobase;
-
- if ((cd->flags & MATCDLABEL)==0)
- return(EIO); /*Refuse after chg error*/
-
- zero_cmd(cmd);
- cmd[0]=ABORT; /*Abort playing audio*/
- i=docmd(cmd,ldrive,cdrive,controller,port); /*Issue command*/
-#ifdef DEBUGIOCTL
- printf("matcd%d: Abort results %d \n",ldrive,i);
-#endif /*DEBUGIOCTL*/
- return(i);
-}
-
-#endif /*FULLDRIVER*/
-
-/*End of matcd.c*/
-
diff --git a/sys/i386/isa/matcd.h b/sys/i386/isa/matcd.h
deleted file mode 100644
index 827f0a9..0000000
--- a/sys/i386/isa/matcd.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*matcd.h---------------------------------------------------------------------
- Matsushita(Panasonic) / Creative CD-ROM Driver (matcd)
- Authored by Frank Durda IV
-
- Copyright 1994, 1995 Frank Durda IV. All rights reserved.
- "FDIV" is a trademark of Frank Durda IV.
-
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
- 1. Redistributions of source code must retain the above copyright
- notice positioned at the very beginning of this file without
- modification, all copyright strings, all related programming
- codes that display the copyright strings, this list of
- conditions and the following disclaimer.
- 2. Redistributions in binary form must contain all copyright strings
- and related programming code that display the copyright strings.
- 3. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- 4. All advertising materials mentioning features or use of this
- software must display the following acknowledgement:
- "The Matsushita/Panasonic CD-ROM driver was developed
- by Frank Durda IV for use with "FreeBSD" and similar
- operating systems."
- "Similar operating systems" includes mainly non-profit oriented
- systems for research and education, including but not restricted
- to "NetBSD", "386BSD", and "Mach" (by CMU). The wording of the
- acknowledgement (in electronic form or printed text) may not be
- changed without permission from the author.
- 5. Absolutely no warranty of function, fitness or purpose is made
- by the author Frank Durda IV.
- 6. Neither the name of the author nor the name "FreeBSD" may
- be used to endorse or promote products derived from this software
- without specific prior written permission.
- (The author can be reached at bsdmail@nemesis.lonestar.org)
- 7. The product containing this software must meet all of these
- conditions even if it is unsupported, not a complete system
- and/or does not contain compiled code.
- 8. These conditions will be in force for the full life of the
- copyright.
- 9. If all the above conditions are met, modifications to other
- parts of this file may be freely made, although any person
- or persons making changes do not receive the right to add their
- name or names to the copyright strings and notices in this
- software. Persons making changes are encouraged to insert edit
- history in matcd.c and to put your name and details of the
- change there.
- 10. You must have prior written permission from the author to
- deviate from these terms.
-
- Vendors who produce product(s) containing this code are encouraged
- (but not required) to provide copies of the finished product(s) to
- the author and to correspond with the author about development
- activity relating to this code. Donations of development hardware
- and/or software are also welcome. (This is one of the faster ways
- to get a driver developed for a device.)
-
- THIS SOFTWARE IS PROVIDED BY THE DEVELOPER(S) ``AS IS'' AND ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER(S) BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
-See matcd.c for Edit History information.
-
-
- Matsushita CR562/CR563 Commands
- This is not a complete list - just the ones this version uses
-*/
-
-#define NOP 0x05 /*No action - just return status*/
-#define DOOROPEN 0x06 /*Open tray*/
-#define DOORCLOSE 0x07 /*Close tray*/
-#define ABORT 0x08 /*Abort command*/
-#define MODESELECT 0x09 /*Set drive parameters*/
-#define LOCK 0x0c /*Prevent/Allow medium removal*/
-#define PAUSE 0x0d /*Pause/Resume playback*/
-#define PLAYBLOCKS 0x0e /*Play audio - block to block*/
-#define PLAYTRKS 0x0f /*Play audio - tracks & index*/
-#define READ 0x10 /*Read data*/
-#define READERROR 0x82 /*Read Error*/
-#define READID 0x83 /*Read Drive Type & Firmware Info*/
-#define READDINFO 0x8b /*Read TOC tracks & drive size*/
-
-#define BLOCKPARAM 0x00 /*Used with MODESELECT command*/
-#define RESUME 0x80 /*Used with PAUSE command*/
-
-#define MAXCMDSIZ 12 /*Max command size with NULL*/
-
-/* Possible data transfers for MODESELECT + BLOCKPARAM */
-
-#define MODE_DATA 0x00 /*2048, 2340*/
-#define MODE_DA 0x82 /*2352*/
-#define MODE_USER 0x01 /*2048, 2052, 2336, 2340, 2352*/
-#define MODE_UNKNOWN 0xff /*Uninitialized state*/
-
-/*The following two modes are not implemented in the driver at this time*/
-
-#define MODE_XA 0x81 /*2048, 2060, 2324, 2336, 2340, 2352*/
-
-
-/* Matsushita CR562/CR563 Status bits*/
-
-#define MATCD_ST_DOOROPEN 0x80 /*Door is open right now*/
-#define MATCD_ST_DSKIN 0x40 /*Disc in drive*/
-#define MATCD_ST_SPIN 0x20 /*Disc is spinning*/
-#define MATCD_ST_ERROR 0x10 /*Error on command*/
-#define MATCD_ST_BUSY 0x04 /*Drive is busy*/
-#define MATCD_ST_AUDIOBSY 0x02 /*Drive is playing audio*/
-
-#define MATCDAUDIOBSY MATCD_ST_AUDIOBSY
-#define MATCDDSKCHNG MATCD_ST_DSKCHNG
-#define MATCDDSKIN MATCD_ST_DSKIN
-#define MATCDDOOROPEN MATCD_ST_DOOROPEN
-
-
-/* Error codes returned from READERROR command.*/
-
-#define NO_ERROR 0x00
-#define RECV_RETRY 0x01
-#define RECV_ECC 0x02
-#define NOT_READY 0x03
-#define TOC_ERROR 0x04
-#define UNRECV_ERROR 0x05
-#define SEEK_ERROR 0x06
-#define TRACK_ERROR 0x07
-#define RAM_ERROR 0x08
-#define DIAG_ERROR 0x09
-#define FOCUS_ERROR 0x0a
-#define CLV_ERROR 0x0b
-#define DATA_ERROR 0x0c
-#define ADDRESS_ERROR 0x0d
-#define CDB_ERROR 0x0e
-#define END_ADDRESS 0x0f
-#define MODE_ERROR 0x10
-#define MEDIA_CHANGED 0x11
-#define HARD_RESET 0x12
-#define ROM_ERROR 0x13
-#define CMD_ERROR 0x14
-#define DISC_OUT 0x15
-#define HARD_ERROR 0x16
-#define ILLEGAL_REQ 0x17
-
-
-/* Human-readable error messages - what a concept!*/
-
-static unsigned char * matcderrors[]={"No error", /* 00 */
- "Soft read error after retry", /* 01 */
- "Soft read error after error-correction", /* 02 */
- "Not ready", /* 03 */
- "Unable to read TOC", /* 04 */
- "Hard read error of data track",/* 05 */
- "Seek did not complete", /* 06 */
- "Tracking servo failure", /* 07 */
- "Drive RAM failure", /* 08 */
- "Drive self-test failed", /* 09 */
- "Focusing servo failure", /* 0a */
- "Spindle servo failure", /* 0b */
- "Data path failure", /* 0c */
- "Illegal logical block address",/* 0d */
- "Illegal field in CDB", /* 0e */
- "End of user encountered on this track", /* 0f */
- "Illegal data mode for this track", /* 10 */
- "Media changed", /* 11 */
- "Power-on or drive reset occurred", /* 12 */
- "Drive ROM failure", /* 13 */
- "Illegal drive command received from host",/* 14 */
- "Disc removed during operation",/* 15 */
- "Drive Hardware error", /* 16 */
- "Illegal request from host"}; /* 17 */
-
-/*End of matcd.h*/
-
-
diff --git a/sys/i386/isa/matcd/matcd.h b/sys/i386/isa/matcd/matcd.h
deleted file mode 100644
index 8802149..0000000
--- a/sys/i386/isa/matcd/matcd.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/*matcd.h---------------------------------------------------------------------
-
- Matsushita(Panasonic) / Creative CD-ROM Driver (matcd)
- Authored by Frank Durda IV
-
- Copyright 1994, 1995 Frank Durda IV. All rights reserved.
- "FDIV" is a trademark of Frank Durda IV.
-
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
- 1. Redistributions of source code must retain the above copyright
- notice positioned at the very beginning of this file without
- modification, all copyright strings, all related programming
- codes that display the copyright strings, this list of
- conditions and the following disclaimer.
- 2. Redistributions in binary form must contain all copyright strings
- and related programming code that display the copyright strings.
- 3. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- 4. All advertising materials mentioning features or use of this
- software must display the following acknowledgement:
- "The Matsushita/Panasonic CD-ROM driver was developed
- by Frank Durda IV for use with "FreeBSD" and similar
- operating systems."
- "Similar operating systems" includes mainly non-profit oriented
- systems for research and education, including but not restricted
- to "NetBSD", "386BSD", and "Mach" (by CMU). The wording of the
- acknowledgement (in electronic form or printed text) may not be
- changed without permission from the author.
- 5. Absolutely no warranty of function, fitness or purpose is made
- by the author Frank Durda IV.
- 6. Neither the name of the author nor the name "FreeBSD" may
- be used to endorse or promote products derived from this software
- without specific prior written permission.
- (The author can be reached at bsdmail@nemesis.lonestar.org)
- 7. The product containing this software must meet all of these
- conditions even if it is unsupported, not a complete system
- and/or does not contain compiled code.
- 8. These conditions will be in force for the full life of the
- copyright.
- 9. If all the above conditions are met, modifications to other
- parts of this file may be freely made, although any person
- or persons making changes do not receive the right to add their
- name or names to the copyright strings and notices in this
- software. Persons making changes are encouraged to insert edit
- history in matcd.c and to put your name and details of the
- change there.
- 10. You must have prior written permission from the author to
- deviate from these terms.
-
- Vendors who produce product(s) containing this code are encouraged
- (but not required) to provide copies of the finished product(s) to
- the author and to correspond with the author about development
- activity relating to this code. Donations of development hardware
- and/or software are also welcome. (This is one of the faster ways
- to get a driver developed for a device.)
-
- THIS SOFTWARE IS PROVIDED BY THE DEVELOPER(S) ``AS IS'' AND ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER(S) BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
------No changes are allowed above this line------------------------------------
-
-See matcd.c for Edit History information.
-
-
- Matsushita CR562/CR563 Commands
- This is not a complete list - just the ones this version uses
-*/
-
-#define NOP 0x05 /*No action - just return status*/
-#define DOOROPEN 0x06 /*Open tray*/
-#define DOORCLOSE 0x07 /*Close tray*/
-#define ABORT 0x08 /*Abort command*/
-#define MODESELECT 0x09 /*Set drive parameters*/
-#define LOCK 0x0c /*Prevent/Allow medium removal*/
-#define PAUSE 0x0d /*Pause/Resume playback*/
-#define PLAYBLOCKS 0x0e /*Play audio - block to block*/
-#define PLAYTRKS 0x0f /*Play audio - tracks & index*/
-#define READ 0x10 /*Read data*/
-#define READERROR 0x82 /*Read Error*/
-#define READID 0x83 /*Read Drive Type & Firmware Info*/
-#define MODESENSE 0x84 /*<12>Report drive settings*/
-#define READSUBQ 0x87 /*<14>Read Q channel information*/
-#define READDINFO 0x8b /*<13>Read TOC tracks & drive size*/
-#define READTOC 0x8c /*<13>Read entry from TOC*/
-
-#define BLOCKPARAM 0x00 /*Used with MODESELECT command*/
-#define SPEEDPARM 0x03 /*<12>Adjust audio playback speed*/
-#define AUDIOPARM 0x05 /*<12>Set/read audio levels & routing*/
-#define RESUME 0x80 /*Used with PAUSE command*/
-
-#define MAXCMDSIZ 12 /*Max command size with NULL*/
-
-/* Possible data transfers for MODESELECT + BLOCKPARAM */
-
-#define MODE_DATA 0x00 /*2048, 2340*/
-#define MODE_DA 0x82 /*2352*/
-#define MODE_USER 0x01 /*2048, 2052, 2336, 2340, 2352*/
-#define MODE_UNKNOWN 0xff /*Uninitialized state*/
-
-/*<12>The following mode is not implemented in the driver at this time*/
-
-#define MODE_XA 0x81 /*2048, 2060, 2324, 2336, 2340, 2352*/
-
-#define DEFVOL 0xff /*<12>Default drive volume level, 100%
- volume. Based on drive action.*/
-#define OUTLEFT 0x01 /*Output on Left*/
-#define OUTRIGHT 0x02 /*Output on Right*/
-
-/* Matsushita CR562/CR563 Status bits*/
-
-#define MATCD_ST_DOOROPEN 0x80 /*Door is open right now*/
-#define MATCD_ST_DSKIN 0x40 /*Disc in drive*/
-#define MATCD_ST_SPIN 0x20 /*Disc is spinning*/
-#define MATCD_ST_ERROR 0x10 /*Error on command*/
-#define MATCD_ST_AUDIOBSY 0x08 /*Drive is playing audio*/
-#define MATCD_ST_LOCK 0x04 /*<14>Drive is locked*/
-#define MATCD_ST_X2 0x02 /*<14>Media is at double-speed*/
-#define MATCD_ST_READY 0x01 /*<14>Drive is ready*/
-
-#define MATCDAUDIOBSY MATCD_ST_AUDIOBSY
-#define MATCDDSKCHNG MATCD_ST_DSKCHNG
-#define MATCDDSKIN MATCD_ST_DSKIN
-#define MATCDDOOROPEN MATCD_ST_DOOROPEN
-
-
-/* Error codes returned from READERROR command.*/
-
-#define NO_ERROR 0x00
-#define RECV_RETRY 0x01
-#define RECV_ECC 0x02
-#define NOT_READY 0x03
-#define TOC_ERROR 0x04
-#define UNRECV_ERROR 0x05
-#define SEEK_ERROR 0x06
-#define TRACK_ERROR 0x07
-#define RAM_ERROR 0x08
-#define DIAG_ERROR 0x09
-#define FOCUS_ERROR 0x0a
-#define CLV_ERROR 0x0b
-#define DATA_ERROR 0x0c
-#define ADDRESS_ERROR 0x0d
-#define CDB_ERROR 0x0e
-#define END_ADDRESS 0x0f
-#define MODE_ERROR 0x10
-#define MEDIA_CHANGED 0x11
-#define HARD_RESET 0x12
-#define ROM_ERROR 0x13
-#define CMD_ERROR 0x14
-#define DISC_OUT 0x15
-#define HARD_ERROR 0x16
-#define ILLEGAL_REQ 0x17
-
-
-/* Human-readable error messages - what a concept!*/
-
-static unsigned char * matcderrors[]={"No error", /* 00 */
- "Soft read error after retry", /* 01 */
- "Soft read error after error-correction", /* 02 */
- "Not ready", /* 03 */
- "Unable to read TOC", /* 04 */
- "Hard read error of data track",/* 05 */
- "Seek did not complete", /* 06 */
- "Tracking servo failure", /* 07 */
- "Drive RAM failure", /* 08 */
- "Drive self-test failed", /* 09 */
- "Focusing servo failure", /* 0a */
- "Spindle servo failure", /* 0b */
- "Data path failure", /* 0c */
- "Illegal logical block address",/* 0d */
- "Illegal field in CDB", /* 0e */
- "End of user encountered on this track", /* 0f */
- "Illegal data mode for this track", /* 10 */
- "Media changed", /* 11 */
- "Power-on or drive reset occurred", /* 12 */
- "Drive ROM failure", /* 13 */
- "Illegal drive command received from host",/* 14 */
- "Disc removed during operation",/* 15 */
- "Drive Hardware error", /* 16 */
- "Illegal request from host"}; /* 17 */
-
-/*End of matcd.h*/
-
-
diff --git a/sys/i386/isa/npx.c.orig b/sys/i386/isa/npx.c.orig
deleted file mode 100644
index dd425d7..0000000
--- a/sys/i386/isa/npx.c.orig
+++ /dev/null
@@ -1,555 +0,0 @@
-/*-
- * Copyright (c) 1990 William Jolitz.
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)npx.c 7.2 (Berkeley) 5/12/91
- * $Id: npx.c,v 1.11 1994/09/09 23:12:32 wollman Exp $
- */
-
-#include "npx.h"
-#if NNPX > 0
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/proc.h>
-#include <machine/cpu.h>
-#include <machine/pcb.h>
-#include <machine/trap.h>
-#include <sys/ioctl.h>
-#include <machine/specialreg.h>
-#include <i386/isa/icu.h>
-#include <i386/isa/isa_device.h>
-#include <i386/isa/isa.h>
-
-/*
- * 387 and 287 Numeric Coprocessor Extension (NPX) Driver.
- */
-
-#ifdef __GNUC__
-
-#define disable_intr() __asm("cli")
-#define enable_intr() __asm("sti")
-#define fldcw(addr) __asm("fldcw %0" : : "m" (*addr))
-#define fnclex() __asm("fnclex")
-#define fninit() __asm("fninit")
-#define fnsave(addr) __asm("fnsave %0" : "=m" (*addr) : "0" (*addr))
-#define fnstcw(addr) __asm("fnstcw %0" : "=m" (*addr) : "0" (*addr))
-#define fnstsw(addr) __asm("fnstsw %0" : "=m" (*addr) : "0" (*addr))
-#define fp_divide_by_0() __asm("fldz; fld1; fdiv %st,%st(1); fwait")
-#define frstor(addr) __asm("frstor %0" : : "m" (*addr))
-#define fwait() __asm("fwait")
-#define read_eflags() ({u_long ef; \
- __asm("pushf; popl %0" : "=a" (ef)); \
- ef; })
-#define start_emulating() __asm("smsw %%ax; orb %0,%%al; lmsw %%ax" \
- : : "n" (CR0_TS) : "ax")
-#define stop_emulating() __asm("clts")
-#define write_eflags(ef) __asm("pushl %0; popf" : : "a" ((u_long) ef))
-
-#else /* not __GNUC__ */
-
-void disable_intr __P((void));
-void enable_intr __P((void));
-void fldcw __P((caddr_t addr));
-void fnclex __P((void));
-void fninit __P((void));
-void fnsave __P((caddr_t addr));
-void fnstcw __P((caddr_t addr));
-void fnstsw __P((caddr_t addr));
-void fp_divide_by_0 __P((void));
-void frstor __P((caddr_t addr));
-void fwait __P((void));
-u_long read_eflags __P((void));
-void start_emulating __P((void));
-void stop_emulating __P((void));
-void write_eflags __P((u_long ef));
-
-#endif /* __GNUC__ */
-
-typedef u_char bool_t;
-
-extern struct gate_descriptor idt[];
-
-int npxdna __P((void));
-void npxexit __P((struct proc *p));
-void npxinit __P((u_int control));
-void npxintr __P((struct intrframe frame));
-void npxsave __P((struct save87 *addr));
-static int npxattach __P((struct isa_device *dvp));
-static int npxprobe __P((struct isa_device *dvp));
-static int npxprobe1 __P((struct isa_device *dvp));
-
-struct isa_driver npxdriver = {
- npxprobe, npxattach, "npx",
-};
-
-u_int npx0_imask;
-struct proc *npxproc;
-
-static bool_t npx_ex16;
-static bool_t npx_exists;
-int hw_float;
-static struct gate_descriptor npx_idt_probeintr;
-static int npx_intrno;
-static volatile u_int npx_intrs_while_probing;
-static bool_t npx_irq13;
-static volatile u_int npx_traps_while_probing;
-
-/*
- * Special interrupt handlers. Someday intr0-intr15 will be used to count
- * interrupts. We'll still need a special exception 16 handler. The busy
- * latch stuff in probintr() can be moved to npxprobe().
- */
-void probeintr(void);
-asm
-("
- .text
-_probeintr:
- ss
- incl _npx_intrs_while_probing
- pushl %eax
- movb $0x20,%al # EOI (asm in strings loses cpp features)
- outb %al,$0xa0 # IO_ICU2
- outb %al,$0x20 #IO_ICU1
- movb $0,%al
- outb %al,$0xf0 # clear BUSY# latch
- popl %eax
- iret
-");
-
-void probetrap(void);
-asm
-("
- .text
-_probetrap:
- ss
- incl _npx_traps_while_probing
- fnclex
- iret
-");
-
-/*
- * Probe routine. Initialize cr0 to give correct behaviour for [f]wait
- * whether the device exists or not (XXX should be elsewhere). Set flags
- * to tell npxattach() what to do. Modify device struct if npx doesn't
- * need to use interrupts. Return 1 if device exists.
- */
-static int
-npxprobe(dvp)
- struct isa_device *dvp;
-{
- int result;
- u_long save_eflags;
- u_char save_icu1_mask;
- u_char save_icu2_mask;
- struct gate_descriptor save_idt_npxintr;
- struct gate_descriptor save_idt_npxtrap;
- /*
- * This routine is now just a wrapper for npxprobe1(), to install
- * special npx interrupt and trap handlers, to enable npx interrupts
- * and to disable other interrupts. Someday isa_configure() will
- * install suitable handlers and run with interrupts enabled so we
- * won't need to do so much here.
- */
- npx_intrno = NRSVIDT + ffs(dvp->id_irq) - 1;
- save_eflags = read_eflags();
- disable_intr();
- save_icu1_mask = inb(IO_ICU1 + 1);
- save_icu2_mask = inb(IO_ICU2 + 1);
- save_idt_npxintr = idt[npx_intrno];
- save_idt_npxtrap = idt[16];
- outb(IO_ICU1 + 1, ~(IRQ_SLAVE | dvp->id_irq));
- outb(IO_ICU2 + 1, ~(dvp->id_irq >> 8));
- setidt(16, probetrap, SDT_SYS386TGT, SEL_KPL);
- setidt(npx_intrno, probeintr, SDT_SYS386IGT, SEL_KPL);
- npx_idt_probeintr = idt[npx_intrno];
- enable_intr();
- result = npxprobe1(dvp);
- disable_intr();
- outb(IO_ICU1 + 1, save_icu1_mask);
- outb(IO_ICU2 + 1, save_icu2_mask);
- idt[npx_intrno] = save_idt_npxintr;
- idt[16] = save_idt_npxtrap;
- write_eflags(save_eflags);
- return (result);
-}
-
-static int
-npxprobe1(dvp)
- struct isa_device *dvp;
-{
- int control;
- int status;
-#ifdef lint
- npxintr();
-#endif
- /*
- * Partially reset the coprocessor, if any. Some BIOS's don't reset
- * it after a warm boot.
- */
- outb(0xf1, 0); /* full reset on some systems, NOP on others */
- outb(0xf0, 0); /* clear BUSY# latch */
- /*
- * Prepare to trap all ESC (i.e., NPX) instructions and all WAIT
- * instructions. We must set the CR0_MP bit and use the CR0_TS
- * bit to control the trap, because setting the CR0_EM bit does
- * not cause WAIT instructions to trap. It's important to trap
- * WAIT instructions - otherwise the "wait" variants of no-wait
- * control instructions would degenerate to the "no-wait" variants
- * after FP context switches but work correctly otherwise. It's
- * particularly important to trap WAITs when there is no NPX -
- * otherwise the "wait" variants would always degenerate.
- *
- * Try setting CR0_NE to get correct error reporting on 486DX's.
- * Setting it should fail or do nothing on lesser processors.
- */
- load_cr0(rcr0() | CR0_MP | CR0_NE);
- /*
- * But don't trap while we're probing.
- */
- stop_emulating();
- /*
- * Finish resetting the coprocessor, if any. If there is an error
- * pending, then we may get a bogus IRQ13, but probeintr() will handle
- * it OK. Bogus halts have never been observed, but we enabled
- * IRQ13 and cleared the BUSY# latch early to handle them anyway.
- */
- fninit();
- DELAY(1000); /* wait for any IRQ13 (fwait might hang) */
-#ifdef DIAGNOSTIC
- if (npx_intrs_while_probing != 0)
- printf("fninit caused %u bogus npx interrupt(s)\n",
- npx_intrs_while_probing);
- if (npx_traps_while_probing != 0)
- printf("fninit caused %u bogus npx trap(s)\n",
- npx_traps_while_probing);
-#endif
- /*
- * Check for a status of mostly zero.
- */
- status = 0x5a5a;
- fnstsw(&status);
- if ((status & 0xb8ff) == 0) {
- /*
- * Good, now check for a proper control word.
- */
- control = 0x5a5a;
- fnstcw(&control);
- if ((control & 0x1f3f) == 0x033f) {
- hw_float = npx_exists = 1;
- /*
- * We have an npx, now divide by 0 to see if exception
- * 16 works.
- */
- control &= ~(1 << 2); /* enable divide by 0 trap */
- fldcw(&control);
- npx_traps_while_probing = npx_intrs_while_probing = 0;
- fp_divide_by_0();
- if (npx_traps_while_probing != 0) {
- /*
- * Good, exception 16 works.
- */
- npx_ex16 = 1;
- dvp->id_irq = 0; /* zap the interrupt */
- /*
- * special return value to flag that we do not
- * actually use any I/O registers
- */
- return (-1);
- }
- if (npx_intrs_while_probing != 0) {
- /*
- * Bad, we are stuck with IRQ13.
- */
- npx_irq13 = 1;
- npx0_imask = dvp->id_irq; /* npxattach too late */
- return (IO_NPXSIZE);
- }
- /*
- * Worse, even IRQ13 is broken. Use emulator.
- */
- }
- }
- /*
- * Probe failed, but we want to get to npxattach to initialize the
- * emulator and say that it has been installed. XXX handle devices
- * that aren't really devices better.
- */
- dvp->id_irq = 0;
- /*
- * special return value to flag that we do not
- * actually use any I/O registers
- */
- return (-1);
-}
-
-/*
- * Attach routine - announce which it is, and wire into system
- */
-int
-npxattach(dvp)
- struct isa_device *dvp;
-{
- if (!npx_ex16 && !npx_irq13) {
- if (npx_exists) {
- printf("npx%d: Error reporting broken, using 387 emulator\n",dvp->id_unit);
- hw_float = npx_exists = 0;
- } else {
- printf("npx%d: 387 Emulator\n",dvp->id_unit);
- }
- }
- npxinit(__INITIAL_NPXCW__);
- return (1); /* XXX unused */
-}
-
-/*
- * Initialize floating point unit.
- */
-void
-npxinit(control)
- u_int control;
-{
- struct save87 dummy;
-
- if (!npx_exists)
- return;
- /*
- * fninit has the same h/w bugs as fnsave. Use the detoxified
- * fnsave to throw away any junk in the fpu. fnsave initializes
- * the fpu and sets npxproc = NULL as important side effects.
- */
- npxsave(&dummy);
- stop_emulating();
- fldcw(&control);
- if (curpcb != NULL)
- fnsave(&curpcb->pcb_savefpu);
- start_emulating();
-}
-
-/*
- * Free coprocessor (if we have it).
- */
-void
-npxexit(p)
- struct proc *p;
-{
-
- if (p == npxproc) {
- start_emulating();
- npxproc = NULL;
- }
-}
-
-/*
- * Record the FPU state and reinitialize it all except for the control word.
- * Then generate a SIGFPE.
- *
- * Reinitializing the state allows naive SIGFPE handlers to longjmp without
- * doing any fixups.
- *
- * XXX there is currently no way to pass the full error state to signal
- * handlers, and if this is a nested interrupt there is no way to pass even
- * a status code! So there is no way to have a non-naive SIGFPE handler. At
- * best a handler could do an fninit followed by an fldcw of a static value.
- * fnclex would be of little use because it would leave junk on the FPU stack.
- * Returning from the handler would be even less safe than usual because
- * IRQ13 exception handling makes exceptions even less precise than usual.
- */
-void
-npxintr(frame)
- struct intrframe frame;
-{
- int code;
-
- if (npxproc == NULL || !npx_exists) {
- /* XXX no %p in stand/printf.c. Cast to quiet gcc -Wall. */
- printf("npxintr: npxproc = %lx, curproc = %lx, npx_exists = %d\n",
- (u_long) npxproc, (u_long) curproc, npx_exists);
- panic("npxintr from nowhere");
- }
- if (npxproc != curproc) {
- printf("npxintr: npxproc = %lx, curproc = %lx, npx_exists = %d\n",
- (u_long) npxproc, (u_long) curproc, npx_exists);
- panic("npxintr from non-current process");
- }
- /*
- * Save state. This does an implied fninit. It had better not halt
- * the cpu or we'll hang.
- */
- outb(0xf0, 0);
- fnsave(&curpcb->pcb_savefpu);
- fwait();
- /*
- * Restore control word (was clobbered by fnsave).
- */
- fldcw(&curpcb->pcb_savefpu.sv_env.en_cw);
- fwait();
- /*
- * Remember the exception status word and tag word. The current
- * (almost fninit'ed) fpu state is in the fpu and the exception
- * state just saved will soon be junk. However, the implied fninit
- * doesn't change the error pointers or register contents, and we
- * preserved the control word and will copy the status and tag
- * words, so the complete exception state can be recovered.
- */
- curpcb->pcb_savefpu.sv_ex_sw = curpcb->pcb_savefpu.sv_env.en_sw;
- curpcb->pcb_savefpu.sv_ex_tw = curpcb->pcb_savefpu.sv_env.en_tw;
-
- /*
- * Pass exception to process.
- */
- if (ISPL(frame.if_cs) == SEL_UPL) {
- /*
- * Interrupt is essentially a trap, so we can afford to call
- * the SIGFPE handler (if any) as soon as the interrupt
- * returns.
- *
- * XXX little or nothing is gained from this, and plenty is
- * lost - the interrupt frame has to contain the trap frame
- * (this is otherwise only necessary for the rescheduling trap
- * in doreti, and the frame for that could easily be set up
- * just before it is used).
- */
- curproc->p_md.md_regs = (int *)&frame.if_es;
-#ifdef notyet
- /*
- * Encode the appropriate code for detailed information on
- * this exception.
- */
- code = XXX_ENCODE(curpcb->pcb_savefpu.sv_ex_sw);
-#else
- code = 0; /* XXX */
-#endif
- trapsignal(curproc, SIGFPE, code);
- } else {
- /*
- * Nested interrupt. These losers occur when:
- * o an IRQ13 is bogusly generated at a bogus time, e.g.:
- * o immediately after an fnsave or frstor of an
- * error state.
- * o a couple of 386 instructions after
- * "fstpl _memvar" causes a stack overflow.
- * These are especially nasty when combined with a
- * trace trap.
- * o an IRQ13 occurs at the same time as another higher-
- * priority interrupt.
- *
- * Treat them like a true async interrupt.
- */
- psignal(npxproc, SIGFPE);
- }
-}
-
-/*
- * Implement device not available (DNA) exception
- *
- * It would be better to switch FP context here (only). This would require
- * saving the state in the proc table instead of in the pcb.
- */
-int
-npxdna()
-{
- if (!npx_exists)
- return (0);
- if (npxproc != NULL) {
- printf("npxdna: npxproc = %lx, curproc = %lx\n",
- (u_long) npxproc, (u_long) curproc);
- panic("npxdna");
- }
- stop_emulating();
- /*
- * Record new context early in case frstor causes an IRQ13.
- */
- npxproc = curproc;
- /*
- * The following frstor may cause an IRQ13 when the state being
- * restored has a pending error. The error will appear to have been
- * triggered by the current (npx) user instruction even when that
- * instruction is a no-wait instruction that should not trigger an
- * error (e.g., fnclex). On at least one 486 system all of the
- * no-wait instructions are broken the same as frstor, so our
- * treatment does not amplify the breakage. On at least one
- * 386/Cyrix 387 system, fnclex works correctly while frstor and
- * fnsave are broken, so our treatment breaks fnclex if it is the
- * first FPU instruction after a context switch.
- */
- frstor(&curpcb->pcb_savefpu);
-
- return (1);
-}
-
-/*
- * Wrapper for fnsave instruction to handle h/w bugs. If there is an error
- * pending, then fnsave generates a bogus IRQ13 on some systems. Force
- * any IRQ13 to be handled immediately, and then ignore it. This routine is
- * often called at splhigh so it must not use many system services. In
- * particular, it's much easier to install a special handler than to
- * guarantee that it's safe to use npxintr() and its supporting code.
- */
-void
-npxsave(addr)
- struct save87 *addr;
-{
- u_char icu1_mask;
- u_char icu2_mask;
- u_char old_icu1_mask;
- u_char old_icu2_mask;
- struct gate_descriptor save_idt_npxintr;
-
- disable_intr();
- old_icu1_mask = inb(IO_ICU1 + 1);
- old_icu2_mask = inb(IO_ICU2 + 1);
- save_idt_npxintr = idt[npx_intrno];
- outb(IO_ICU1 + 1, old_icu1_mask & ~(IRQ_SLAVE | npx0_imask));
- outb(IO_ICU2 + 1, old_icu2_mask & ~(npx0_imask >> 8));
- idt[npx_intrno] = npx_idt_probeintr;
- enable_intr();
- stop_emulating();
- fnsave(addr);
- fwait();
- start_emulating();
- npxproc = NULL;
- disable_intr();
- icu1_mask = inb(IO_ICU1 + 1); /* masks may have changed */
- icu2_mask = inb(IO_ICU2 + 1);
- outb(IO_ICU1 + 1,
- (icu1_mask & ~npx0_imask) | (old_icu1_mask & npx0_imask));
- outb(IO_ICU2 + 1,
- (icu2_mask & ~(npx0_imask >> 8))
- | (old_icu2_mask & (npx0_imask >> 8)));
- idt[npx_intrno] = save_idt_npxintr;
- enable_intr(); /* back to usual state */
-}
-
-#endif /* NNPX > 0 */
diff --git a/sys/i386/isa/options.h b/sys/i386/isa/options.h
deleted file mode 100644
index 3dd1b5f8..0000000
--- a/sys/i386/isa/options.h
+++ /dev/null
@@ -1,250 +0,0 @@
-/*options.h--------------------------------------------------------------------
- Matsushita(Panasonic) / Creative CD-ROM Driver (matcd)
- Authored by Frank Durda IV
-
- Copyright 1994, 1995 Frank Durda IV. All rights reserved.
- "FDIV" is a trademark of Frank Durda IV.
-
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
- 1. Redistributions of source code must retain the above copyright
- notice positioned at the very beginning of this file without
- modification, all copyright strings, all related programming
- codes that display the copyright strings, this list of
- conditions and the following disclaimer.
- 2. Redistributions in binary form must contain all copyright strings
- and related programming code that display the copyright strings.
- 3. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- 4. All advertising materials mentioning features or use of this
- software must display the following acknowledgement:
- "The Matsushita/Panasonic CD-ROM driver was developed
- by Frank Durda IV for use with "FreeBSD" and similar
- operating systems."
- "Similar operating systems" includes mainly non-profit oriented
- systems for research and education, including but not restricted
- to "NetBSD", "386BSD", and "Mach" (by CMU). The wording of the
- acknowledgement (in electronic form or printed text) may not be
- changed without permission from the author.
- 5. Absolutely no warranty of function, fitness or purpose is made
- by the author Frank Durda IV.
- 6. Neither the name of the author nor the name "FreeBSD" may
- be used to endorse or promote products derived from this software
- without specific prior written permission.
- (The author can be reached at bsdmail@nemesis.lonestar.org)
- 7. The product containing this software must meet all of these
- conditions even if it is unsupported, not a complete system
- and/or does not contain compiled code.
- 8. These conditions will be in force for the full life of the
- copyright.
- 9. If all the above conditions are met, modifications to other
- parts of this file may be freely made, although any person
- or persons making changes do not receive the right to add their
- name or names to the copyright strings and notices in this
- software. Persons making changes are encouraged to insert edit
- history in matcd.c and to put your name and details of the
- change there.
- 10. You must have prior written permission from the author to
- deviate from these terms.
-
- Vendors who produce product(s) containing this code are encouraged
- (but not required) to provide copies of the finished product(s) to
- the author and to correspond with the author about development
- activity relating to this code. Donations of development hardware
- and/or software are also welcome. (This is one of the faster ways
- to get a driver developed for a device.)
-
- THIS SOFTWARE IS PROVIDED BY THE DEVELOPER(S) ``AS IS'' AND ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER(S) BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
- Conditional compilation flags - change to suit your system
----------------------------------------------------------------------------*/
-
-/* AUTOHUNT Adds extra code that allows the driver to search
- for interface cards rather than having to hard-code
- the locations in the kernel conf file.
- Leaving AUTOHUNT enabled is the recommended setting.
-*/
-
-#define AUTOHUNT
-
-
-/* FULLCONFIG Allows up to four host interface boards for a
- total of 16 drives. If disabled, only a single
- host interface (of any type) is allowed. The
- additional driver size is insignificant.
- Leaving FULLCONFIG enabled is the recommended setting.
-*/
-
-#define FULLCONFIG
-
-
-/* FULLDRIVER If not set, the audio, non-data functions and
- some error recovery functions are eliminated from
- the compiled driver. The resulting driver will be
- smaller and may help a kernel fit on a boot floppy.
- Leaving FULLDRIVER enabled is the recommended setting.
-*/
-
-#define FULLDRIVER
-
-
-/* RESETONBOOT causes the driver to reset the drive(s) to be
- reset during probing. This causes any audio
- playback to be aborted and the drives will close
- their trays if they are open.
- Leaving RESETONBOOT enabled is the recommended setting.
-*/
-
-#define RESETONBOOT
-
-
-/* LOCKDRIVE If enabled, the when the drive is open, the
- door is locked. The front panel eject button
- is ignored. When the drive is completely closed,
- the eject button will be honored.
- Leaving LOCKDRIVE disabled is the recommended setting.
-*/
-
-/*#define LOCKDRIVE*/
-
-
-/*<5> FREE2 If enabled, the changes are inserted so this
-<5> module will compile in the world of FreeBSD 2.x.
-<5> Without this, it is known to work in
-<5> FreeBSD 1.1.5.1.
-<5>*/
-
-#define FREE2 /*<5>Correct setting for 2.x*/
-
-
-/*---------------------------------------------------------------------------
- This structure contains the hints for where we should look for the
- host adapter. If you want to change where we search or reduce the
- places we search to avoid confusing some other device, either
- specify explicit addresses in the kernel config file (preferred)
- or change this array.
-
- If the kernel config fuke has multiple ? entries, the probe routines
- will use this table multiple times and will eliminate each failed
- entry probe tries.
-
- WARNING: The number of controller entries for this driver in config
- must be less than or equal to the number of hints if hints are used.
-
- If you add entries to the table, add them immediately before
- the -1 end-of-table marker. The values already present are
- the ones found on standard SoundBlaster 16 and standalone cards.
----------------------------------------------------------------------------*/
-
-
-#ifdef AUTOHUNT
-int port_hints[]={
- 0x230,0x240, /*Ports SB audio boards can use*/
- 0x250,0x260, /*Ports standalone CD/IF board can*/
- -1}; /*use. Table MUST end with -1*/
-#endif /*AUTOHUNT*/
-
-
-/*---------------------------------------------------------------------------
- Debugging flags - Turn these on only if you are looking at a
- problem.
----------------------------------------------------------------------------*/
-
-/* DEBUGOPEN If enabled, debug messages for open and close
- operations.
-*/
-
-/*#define DEBUGOPEN*/
-
-
-/* DEBUGIO If enabled, reports on calls to strategy, start
- and other I/O related functions.
-*/
-
-/*#define DEBUGIO*/
-
-
-/* DEBUGQUEUE If enabled, shows activity on disk request queues.
- Warning - This debug is VERY VERY NOISY and will
- loop endlessly if queues are not null terminated
- as they should be.
-*/
-
-/*#define DEBUGQUEUE*/
-
-
-/* DEBUGCMD If enabled, shows the actual commands being issued
- to the CD-ROM drives.
-*/
-
-/*#define DEBUGCMD*/
-
-
-/* DEBUGSLEEP If enabled, reports on timeouts, wakeups, dropped
- threads, etc.
-*/
-
-/*#define DEBUGSLEEP*/
-
-
-/* DEBUGIOCTL If enabled, reports on the various ioctl-related
- calls and operations. You might have to enable
- DEBUGCMD as well to get enough debugging information.
-*/
-
-/*#define DEBUGIOCTL*/
-
-
-/* DEBUGPROBE If enabled, reports on the process of locating
- adapters and drives. The debugging in matcdprobe()
- and matcdattach() routines is enabled with this
- flag.
-*/
-
-/*#define DEBUGPROBE*/
-
-
-/* DIAGPORT If enabled, additional code is added to send
- debugging state to a debug port. This should
- not be enabled in production. The value
- can be set to 0x80 or 0x302, depending on what
- type of debugging board you own. The global variable
- diagloop is used to make looping reports on these
- devices.
-
- Some other drivers and possible the kernel fiddle
- with the 0x80 debug port, so it may not be usable
- for isolating failures that result in a kernel panic.
- The 0x302 debug board is recommended in these cases.
- It also displays a word of data, so you get more
- detail.
-
-<10> It was discovered the 0x302 board was getting set
-<10> into a strange state by the probes for other
-<10> devices. To resolve this, the display control port
-<10> (0x300) is reset in our probe and open routines.
-<10> DO NOT use DIAGPORT 0x302 if an adapter is present
-<10> at that address. It could ruin the EEPROM settings
-<10> on the device.
-*/
-
-/*#define DIAGPORT 0x80*/
-/*#define DIAGPORT 0x302*/
-
-/*End of options.h*/
-
-
diff --git a/sys/i386/isa/pas.c b/sys/i386/isa/pas.c
deleted file mode 100644
index 2bd8718..0000000
--- a/sys/i386/isa/pas.c
+++ /dev/null
@@ -1,974 +0,0 @@
-/*
- * Copyright (C) 1994 Poul-Henning Kamp
- *
- * All rights reserved.
- *
- * This file contains some material which are covered by the message after
- * this message.
- *
- * The rest of this file is covered by the following clause:
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- *
- * $Id: pas.c,v 1.5 1994/10/18 03:53:12 phk Exp $
- *
- * This is a driver for the one particular kind of the "ProAudioSpectrum"
- * card from MediaVision. To find out if your card is supported, you can
- * either try out the driver, or you can look for a chip a little less than
- * 1" square in one end of the card, with writing on it that say ...5380...
- *
- * Up to four of these cards can be in the same computer. If you have
- * multiple cards, you need to set the "card-id" jumpers correspondingly.
- *
- * The driver uses no interrupts, so don't expect record-breaking performance.
- *
- * Poul-Henning Kamp <phk@freefall.cdrom.com>
- */
-
-/*
- * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo,
- * Michael L. Finch, Bradley A. Grantham, and
- * Lawrence A. Kesteloot
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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 Alice Group.
- * 4. The names of the Alice Group or any of its members may not be used
- * to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Was: Id: pas.c,v 1.8.2.1 1994/07/11 00:02:32 cgd Exp
- *
- * Modified for use with the pc532 by Phil Nelson, Feb 94.
- */
-
-
-#include "pas.h"
-#if NPAS > 0
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/devconf.h>
-
-#include <i386/isa/isa_device.h>
-#include <i386/isa/ic/ncr_5380.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-/*
- * Define this macro to disable the PSEUDO-DMA transfers.
- */
-#undef NO_PAS16_PSEUDO_DMA
-
-/*
- * This parameter determines how many byte we "insb" between each check for
- * a change of phase.
- */
-
-#ifndef PAS16_PSEUDO_DMA_SIZE
-# define PAS16_PSEUDO_DMA_SIZE 512
-#endif
-
-/*
- * How many times we attempt to select a device.
- */
-#ifndef ATTEMPT_SELECTION
-# define ATTEMPT_SELECTION 5
-#endif /* ATTEMPT_SELECTION */
-
-/*
- * How many microseconds between each attempt.
- */
-#ifndef SELECTION_DELAY
-# define SELECTION_DELAY 10000
-#endif /* SELECTION_DELAY */
-
-#ifndef PAS16_TIMEOUT
-# define PAS16_TIMEOUT 1000000
-#endif /* PAS16_TIMEOUT */
-/* What we need to debug the driver */
-
-#ifdef PAS_DEBUG
-# if PAS_DEBUG == 0
-# undef PAS_DEBUG
-# else
- static int pas_show_scsi_cmd(struct scsi_xfer *xs);
-# ifndef PAS_DEBUG_REQUEST_SENSE
-# define PAS_DEBUG_REQUEST_SENSE
-# endif
-# endif
-#endif /* PAS_DEBUG */
-
-#define SCSI_PHASE_DATA_OUT 0x0
-#define SCSI_PHASE_DATA_IN 0x1
-#define SCSI_PHASE_CMD 0x2
-#define SCSI_PHASE_STATUS 0x3
-#define SCSI_PHASE_UNSPEC1 0x4
-#define SCSI_PHASE_UNSPEC2 0x5
-#define SCSI_PHASE_MESSAGE_OUT 0x6
-#define SCSI_PHASE_MESSAGE_IN 0x7
-
-#define SCSI_CUR_PHASE(x) ((x>>2)&0x7)
-
-#define SCSI_RET_SUCCESS 0
-#define SCSI_RET_RETRY 1
-#define SCSI_RET_DEVICE_DOWN 2
-#define SCSI_RET_COMMAND_FAIL 3
-
-
-/* Our per device (card) structure */
-static
-struct pas_softc {
- struct scsi_link sc_link;
- int mv_unit;
- u_short iobase;
-#define xor_0000 iobase
- u_short xor_0001;
- u_short xor_0002;
- u_short xor_0003;
- u_short xor_2000;
- u_short xor_2001;
- u_short xor_2002;
- u_short xor_2003;
- u_short xor_4000;
- u_short xor_4001;
- u_short xor_4003;
-} s_pas[NPAS];
-
-/*
- * Register Access-macros use these
- */
-#define r_csdr(ptr) (ptr->xor_0000)
-#define w_odr(ptr) (ptr->xor_0000)
-#define r_icr(ptr) (ptr->xor_0001)
-#define w_icr(ptr) (ptr->xor_0001)
-#define rw_mr(ptr) (ptr->xor_0002)
-#define r_tcr(ptr) (ptr->xor_0003)
-#define w_tcr(ptr) (ptr->xor_0003)
-#define r_cscr(ptr) (ptr->xor_2000)
-#define w_ser(ptr) (ptr->xor_2000)
-#define r_bsr(ptr) (ptr->xor_2001)
-#define w_sdsr(ptr) (ptr->xor_2001)
-#define r_idr(ptr) (ptr->xor_2002)
-#define w_sdtr(ptr) (ptr->xor_2002)
-#define r_rpir(ptr) (ptr->xor_2003)
-#define w_sdir(ptr) (ptr->xor_2003)
-#define pas_data(ptr) (ptr->xor_4000)
-#define pas_stat(ptr) (ptr->xor_4001)
-#define R_PAS_STAT_DREQ 0x80
-#define pas_irq(ptr) (ptr->xor_4003)
-
-/*
- * The actual macros used to access the chip
- */
-#define P_PAS struct pas_softc *
-#define R_PAS(ptr,foo) inb(foo(ptr))
-#define W_PAS(ptr,foo,val) outb(foo(ptr),val)
-#define M_PAS(ptr,foo,opr,arg) outb(foo(ptr),R_PAS(ptr,foo) opr arg)
-
-#define WAIT_FOR_NOT_REQ(ptr) { \
- int scsi_timeout = PAS16_TIMEOUT; \
- while ( (R_PAS(ptr,r_cscr) & R_CSCR_REQ) && \
- (R_PAS(ptr,r_cscr) & R_CSCR_REQ) && \
- (R_PAS(ptr,r_cscr) & R_CSCR_REQ) && \
- (--scsi_timeout) ); \
- if (!scsi_timeout) { \
- printf("scsi timeout--WAIT_FOR_NOT_REQ-- pas.c:%d.\n", __LINE__); \
- goto scsi_timeout_error; \
- } \
-}
-#define WAIT_FOR_REQ(ptr) { \
- int scsi_timeout = PAS16_TIMEOUT; \
- while ( ((R_PAS(ptr,r_cscr) & R_CSCR_REQ) == 0) && \
- ((R_PAS(ptr,r_cscr) & R_CSCR_REQ) == 0) && \
- ((R_PAS(ptr,r_cscr) & R_CSCR_REQ) == 0) && \
- (--scsi_timeout) ); \
- if (!scsi_timeout) { \
- printf("scsi timeout--WAIT_FOR_REQ-- pas.c:%d.\n", __LINE__); \
- goto scsi_timeout_error; \
- } \
-}
-
-static u_int32 pas_adapter_info(int adapter_number);
-static void pas_minphys(struct buf *bp);
-static int32 pas_scsi_cmd(struct scsi_xfer *xs);
-static int pas_reset(int);
-static int pas_send_cmd(struct scsi_xfer *xs);
-static int scsi_req(P_PAS,int,int,u_char *,int,
- u_char *, int , int *, int *);
-static int sci_data_out(P_PAS, int, int, u_char *);
-static int sci_data_in(P_PAS, int, int, u_char *);
-static int select_target(P_PAS, int);
-
-extern int pasprobe(struct isa_device *dev);
-extern int pasattach(struct isa_device *dev);
-struct isa_driver pasdriver = { pasprobe, pasattach, "pas" };
-
-
-static
-struct scsi_adapter pas_adapter = {
- pas_scsi_cmd, /* scsi_cmd() */
- pas_minphys, /* scsi_minphys() */
- 0, /* open_target_lu() */
- 0, /* close_target_lu() */
- pas_adapter_info, /* adapter_info() */
- "pas", /* name */
- { 0, 0 } /* spare[2] */
-};
-
-static
-struct scsi_device pas_dev = {
- NULL, /* Use default error handler. */
- NULL, /* have a queue, served by this (?) */
- NULL, /* have no async handler. */
- NULL, /* Use default "done" routine. */
- "pas",
- 0,
- { 0, 0 }
-};
-
-static char *mv_type[] = {
- 0,0,0,0,0,0,"PAS+",0,0,0,0,0,"PAS16D",0,"CDPC","PAS16"};
-
-int
-pasprobe(struct isa_device *dev)
-{
- int port = dev->id_iobase;
- int base = port - 0x1c00;
- int unit = dev->id_unit;
- int i, j;
-
- if(base & 3) {
- printf("pas%d cannot operate on address %x.", unit,port);
- printf(" Address must be a multiple of four.\n");
- return 0;
- }
- /* Tell the PAS16 we want to talk to, where to listen */
- outb(0x9a01,0xbc + unit);
- outb(0x9a01,base >> 2);
-
-#ifdef PAS_DEBUG
- printf("%x: 0x803=%x 0xec03=%x 0xff88=%x\n",
- base,inb(base^0x803),inb(base^0xec03),inb(base^0xfc00));
-#endif
-
- /* Killer one */
- i = inb(base ^ 0x803);
- if(i == 0xff) return 0;
-
- /* killer two */
- if((0x03 & inb(base^0xec03)) != 0x03) return 0;
-
- /* killer three */
- for(i=0;i<4;i++) {
- if(inb(port) != 0xff || inb(port^0x2000) != 0xff)
- goto ok;
- }
- return 0;
-ok:
- /* killer four */
- i = inb(base ^ 0x803);
- outb(base^0x803,i ^ 0xe0);
- j = inb(base^0x803);
- outb(base^0x803,1);
- if(i != j) return 0;
-
- return 4;
-}
-
-static u_int32
-pas_adapter_info(int adapter_number)
-{
- return 1;
-}
-
-static struct kern_devconf kdc_pas[NPAS] = { {
- 0, 0, 0, /* filled in by dev_attach */
- "pas", 0, { MDDT_ISA, 0, "bio" },
- isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
- &kdc_isa0, /* parent */
- 0, /* parentdata */
- DC_BUSY, /* host adapters are always busy */
- "Media Vision ProAudioSpectrum SCSI host adapter"
-} };
-
-static inline void
-pas_registerdev(struct isa_device *id)
-{
- if(id->id_unit)
- kdc_pas[id->id_unit] = kdc_pas[0];
- kdc_pas[id->id_unit].kdc_unit = id->id_unit;
- kdc_pas[id->id_unit].kdc_parentdata = id;
- dev_attach(&kdc_pas[id->id_unit]);
-}
-
-int
-pasattach(struct isa_device *dev)
-{
- int i,base=dev->id_iobase-0x1c00;
- struct pas_softc *ppas;
- i = inb(base^0xEC03) & 0x0f;
- printf("pas%d: Type = %d <%s>\n",dev->id_unit,i,mv_type[i]);
- ppas = s_pas + dev->id_unit;
- ppas->sc_link.adapter_unit = dev->id_unit;
- ppas->sc_link.adapter_targ = 7;
- ppas->sc_link.adapter = &pas_adapter;
- ppas->sc_link.device = &pas_dev;
- ppas->iobase=dev->id_iobase;
- ppas->xor_0001 = ppas->iobase^0x0001;
- ppas->xor_0002 = ppas->iobase^0x0002;
- ppas->xor_0003 = ppas->iobase^0x0003;
- ppas->xor_2000 = ppas->iobase^0x2000;
- ppas->xor_2001 = ppas->iobase^0x2001;
- ppas->xor_2002 = ppas->iobase^0x2002;
- ppas->xor_2003 = ppas->iobase^0x2003;
- ppas->xor_4000 = ppas->iobase^0x4000;
- ppas->xor_4001 = ppas->iobase^0x4001;
- ppas->xor_4003 = ppas->iobase^0x4003;
-
- /* Various magic */
- outb(base^0x4000,0x30);
- outb(base^0x4001,0x01);
- outb(base^0xbc00,0x01);
- outb(base^0x8003,0x4d);
-
- pas_registerdev(dev);
- scsi_attachdevs(&(ppas->sc_link));
- pas_reset(dev->id_unit);
- return 1;
-}
-
-static void
-pas_minphys(struct buf *bp)
-{
-#define MIN_PHYS 65536 /*BARF!!!!*/
- if (bp->b_bcount > MIN_PHYS) {
- printf("Uh-oh... pas_minphys setting bp->b_bcount = %x.\n", MIN_PHYS);
- bp->b_bcount = MIN_PHYS;
- }
-#undef MIN_PHYS
-}
-
-static int32
-pas_scsi_cmd(struct scsi_xfer *xs)
-{
- int flags, s, r;
-
- flags = xs->flags;
- if (xs->bp) flags |= (SCSI_NOSLEEP);
- if ( flags & ITSDONE ) {
- printf("Already done?");
- xs->flags &= ~ITSDONE;
- }
- if ( ! ( flags & INUSE ) ) {
- printf("Not in use?");
- xs->flags |= INUSE;
- }
-
- if ( flags & SCSI_RESET ) {
- printf("flags & SCSIRESET.\n");
- if ( ! ( flags & SCSI_NOSLEEP ) ) {
- s = splbio();
- pas_reset(xs->sc_link->adapter_unit);
- splx(s);
- return(SUCCESSFULLY_QUEUED);
- } else {
- pas_reset(xs->sc_link->adapter_unit);
- return (COMPLETE);
- }
- }
-
- r = pas_send_cmd(xs);
- xs->flags |= ITSDONE;
- scsi_done(xs);
- if (xs->flags&SCSI_NOMASK) {
- return (r);
- }
- return SUCCESSFULLY_QUEUED;
-}
-
-#ifdef PAS_DEBUG
-static int
-pas_show_scsi_cmd(struct scsi_xfer *xs)
-{
- u_char *b = (u_char *) xs->cmd;
- int i = 0;
-
- if ( ! ( xs->flags & SCSI_RESET ) ) {
- printf("pas(%d:%d:%d) ",
- xs->sc_link->adapter_unit, xs->sc_link->target, xs->sc_link->lun);
- printf("%d@%x, %d@%x <",xs->cmdlen,(u_long)xs->cmd,
- xs->datalen,(u_long)xs->data);
- while (i < xs->cmdlen) {
- if (i) printf(",");
- printf("%x",b[i++]);
- }
- printf(">\n");
- } else {
- printf("pas(%d:%d:%d)-RESET-\n",
- xs->sc_link->adapter_unit, xs->sc_link->target,
- xs->sc_link->lun);
- }
- return 0;
-}
-#endif /* PAS_DEBUG */
-
-static int
-pas_reset(int adapter)
-{
- struct pas_softc *ppas = s_pas + adapter;
-
- /*
- * Reset Hold Time is 25 uSec
- */
- W_PAS(ppas,w_icr,W_ICR_ASSERT_RST);
- DELAY(25);
- W_PAS(ppas,w_icr,0);
-
- W_PAS(ppas,rw_mr,0);
- W_PAS(ppas,w_ser,0);
-
- return 0;
-}
-
-static int
-pas_send_cmd(struct scsi_xfer *xs)
-{
- P_PAS ptr = s_pas + xs->sc_link->adapter_unit;
- int s,sent,ret;
- int sense;
- u_char cmd[6];
-
-#ifdef PAS_DEBUG
- pas_show_scsi_cmd(xs);
-#endif /* PAS_DEBUG */
- s = splbio();
- sense = scsi_req(ptr,
- xs->sc_link->target, xs->sc_link->lun,
- (u_char*)xs->cmd, xs->cmdlen, xs->data, xs->datalen,
- &sent, &ret);
- splx(s);
- switch (sense) {
- case 0x00:
- xs->error = XS_NOERROR;
- xs->resid = sent;
- return (COMPLETE);
- case 0x02: /* Check condition */
-
-#ifdef PAS_DEBUG_REQUEST_SENSE
- printf("pas%d, target%d: sent=%d,ret=%d,sense=%x check. cond.\n",
- xs->sc_link->adapter_unit, xs->sc_link->target,sent,ret,sense);
- printf("Cmd:<%x",((u_char*)(xs->cmd))[0]);
- for(sent=1;sent < sizeof xs->cmdlen;sent++) {
- printf(",%x",((u_char*)(xs->cmd))[sent]);
- }
- printf(">\n");
-#endif /* PAS_DEBUG_REQUEST_SENSE */
- cmd[0] = 3;
- cmd[1] = xs->sc_link->lun<<5;
- cmd[2] = 0;
- cmd[3] = 0;
- cmd[4] = sizeof xs->sense;
- cmd[5] = 0;
-
- DELAY(10);
- s = splbio();
- scsi_req(ptr, xs->sc_link->target, xs->sc_link->lun,
- cmd, sizeof cmd,
- (caddr_t) &(xs->sense), sizeof xs->sense,
- &sent, &ret);
- splx(s);
-#ifdef PAS_DEBUG_REQUEST_SENSE
- printf("Sense result: (sent=%d, ret=%d)\n",sent,ret);
- printf("<%x",((u_char*)(&xs->sense))[0]);
- for(sent=1;sent < sizeof xs->sense;sent++) {
- printf(",%x",((u_char*)(&xs->sense))[sent]);
- }
- printf(">\n");
-#endif /* PAS_DEBUG_REQUEST_SENSE */
- xs->error = XS_SENSE;
- return HAD_ERROR;
- case 0x08: /* Busy */
- xs->error = XS_BUSY;
- return HAD_ERROR;
- default:
- xs->error = XS_DRIVER_STUFFUP;
- return HAD_ERROR;
- }
-}
-
-/*
- * Perform arbitration and selection. Figure 5-1, more or less.
- */
-
-static int
-select_target(P_PAS ptr, int tid)
-{
- int myid = ptr->sc_link.adapter_targ;
- int ret = SCSI_RET_RETRY;
- int tries = ATTEMPT_SELECTION;
- int delay = SELECTION_DELAY;
- int i;
-
- /*
- * Convert the ID's to bit-maps.
- */
- myid = 1 << myid;
- tid = 1 << tid;
-
- /*
- * Not documented, but clearly needed for now.
- * XXX is this missing somewhere else, and this is just a hack ?
- */
-loop:
- W_PAS(ptr,w_tcr,0);
-
-
- /*
- * Write ID Bit to Output Register.
- */
- W_PAS(ptr,w_odr,myid);
-
- /*
- * Set "ARBITRATE" Bit.
- */
- W_PAS(ptr,rw_mr,RW_MR_ARBITRATE);
-
- /*
- * Check "Arbitration in progress" Bit.
- */
- for (i = 0; i < 20; i++) /* 20usec circa */
- if (R_PAS(ptr,r_icr) & R_ICR_ARBITRATION_IN_PROGRESS)
- goto aip;
- goto lost;
-
-aip:
- /*
- * Wait 2.2 usec Arbitration Delay.
- */
- DELAY(2);
-
- /*
- * Check "Lost Arbitration" Bit.
- */
- if (R_PAS(ptr,r_icr) & R_ICR_LOST_ARBITRATION)
- goto lost;
-
- /*
- * Higher priority ID present ?
- */
- if ((R_PAS(ptr,r_csdr) & ~myid) > myid)
- goto lost;
-
- /*
- * Check "Lost Arbitration" Bit.
- */
- if (R_PAS(ptr,r_icr) & R_ICR_LOST_ARBITRATION)
- goto lost;
-
- /*
- * Set "Assert SEL/".
- */
- W_PAS(ptr,w_icr,W_ICR_ASSERT_SEL);
-
- /*
- * Check "Lost Arbitration" Bit.
- */
- if (R_PAS(ptr,r_icr) & R_ICR_LOST_ARBITRATION) {
- goto nosel;
- }
-
- /*
- * Wait 1.2 usec minimum. (Bus Clear + Settle)
- */
- DELAY(2);
-
- /*
- * Write Target and Initiator's ID bits to output Register.
- */
- W_PAS(ptr,w_odr,myid|tid);
-
- /*
- * Set "Assert BSY/" + "Assert Data Bus".
- */
- W_PAS(ptr,w_icr,
- W_ICR_ASSERT_SEL | W_ICR_ASSERT_BSY | W_ICR_ASSERT_DATA_BUS);
-
- /*
- * Reset "ARBITRATE" Bit.
- */
- W_PAS(ptr,rw_mr,0);
-
- /*
- * Reset "Select Enable" Register.
- */
- W_PAS(ptr,w_ser,0);
-
- /*
- * Reset "Assert BSY/".
- */
- W_PAS(ptr,w_icr,
- W_ICR_ASSERT_SEL | W_ICR_ASSERT_DATA_BUS);
-
- /*
- * "BSY/" Asserted within 250 msec ?
- */
- for(i=0;i<250000;i+=100) {
- if (R_PAS(ptr,r_cscr) & R_CSCR_BSY)
- goto resp;
- DELAY(100);
- }
- goto nodev;
-resp:
-
- /*
- * Reset "Assert SEL/" + "Assert Data Bus".
- */
- W_PAS(ptr,w_icr,0);
-
- return SCSI_RET_SUCCESS;
-
-nodev:
- ret = SCSI_RET_DEVICE_DOWN;
-
-nosel:
- W_PAS(ptr,w_icr,0);
-
-lost:
- W_PAS(ptr,rw_mr,0);
- if(--tries) {
- DELAY(delay);
- goto loop;
- }
-
- return ret;
-}
-
-/*
- * Figure 5-2.
- */
-
-static int
-sci_data_out(P_PAS ptr, int phase, int count, u_char *data)
-{
- register unsigned char icmd;
- register int cnt=0,zonk;
-
- if (SCSI_CUR_PHASE(R_PAS(ptr,r_cscr)) != phase)
- return cnt;
-
- icmd = R_PAS(ptr,r_icr) & RW_ICR_MASK;
-
-#ifndef NO_PAS16_PSEUDO_DMA
- /*
- * The PAS16 has special provisions for doing pseudo-dma.
- */
-
- /*
- * Don't use pseudo-dma unless we need much data. This way we avoid all
- * the variable length stuff entirely.
- *
- * XXX something screws up for big transfers :-(
- */
-
- if(count >= 128 && count <= 8192) {
-
- M_PAS(ptr,rw_mr,|,RW_MR_DMA_MODE);
-
- W_PAS(ptr,w_icr,icmd | W_ICR_ASSERT_DATA_BUS);
-
- W_PAS(ptr,w_sdsr,0);
-
- while(count >= PAS16_PSEUDO_DMA_SIZE) {
- zonk=0;
- while(!(R_PAS(ptr,pas_stat) & R_PAS_STAT_DREQ))
- if (++zonk > 1000 || SCSI_CUR_PHASE(R_PAS(ptr,r_cscr)) != phase)
- return cnt;
-
- outsb(pas_data(ptr),data,PAS16_PSEUDO_DMA_SIZE);
-
- data += PAS16_PSEUDO_DMA_SIZE;
- cnt += PAS16_PSEUDO_DMA_SIZE;
- count -= PAS16_PSEUDO_DMA_SIZE;
-
- }
-
- if(count) {
- while(!(R_PAS(ptr,pas_stat) & R_PAS_STAT_DREQ))
- if (SCSI_CUR_PHASE(R_PAS(ptr,r_cscr)) != phase)
- return cnt;
- outsb(pas_data(ptr),data,count);
- cnt += count;
- data += count;
- }
-
- M_PAS(ptr,rw_mr,&,~RW_MR_DMA_MODE);
- W_PAS(ptr,w_icr,icmd);
- return cnt;
- }
-#endif /* NO_PAS16_PSEUDO_DMA */
-loop:
- if (SCSI_CUR_PHASE(R_PAS(ptr,r_cscr)) != phase)
- return cnt;
-
- W_PAS(ptr,w_odr, *data);
- WAIT_FOR_REQ(ptr);
- icmd |= W_ICR_ASSERT_DATA_BUS;
- W_PAS(ptr,w_icr,icmd);
- icmd |= W_ICR_ASSERT_ACK;
- W_PAS(ptr,w_icr,icmd);
-
- icmd &= ~(W_ICR_ASSERT_DATA_BUS|W_ICR_ASSERT_ACK);
- WAIT_FOR_NOT_REQ(ptr);
- W_PAS(ptr,w_icr,icmd);
- ++cnt;
- data++;
- if (--count > 0)
- goto loop;
-scsi_timeout_error:
- return cnt;
-}
-
-static int
-sci_data_in(P_PAS ptr, int phase, int count, u_char *data)
-{
- unsigned char icmd;
- int cnt=0;
-
- if (SCSI_CUR_PHASE(R_PAS(ptr,r_cscr)) != phase)
- return cnt;
-
-#ifndef NO_PAS16_PSEUDO_DMA
- /*
- * The PAS16 has special provisions for doing pseudo-dma.
- */
-
- /*
- * Don't use pseudo-dma unless we need much data. This way we avoid all
- * the variable length stuff entirely.
- */
- if(count >= 128) {
-
- M_PAS(ptr,rw_mr,|,RW_MR_DMA_MODE);
-
- W_PAS(ptr,w_sdir,0);
-
- while(count > PAS16_PSEUDO_DMA_SIZE) {
- while(!(R_PAS(ptr,pas_stat) & R_PAS_STAT_DREQ)) ;
-
- insb(pas_data(ptr),data,PAS16_PSEUDO_DMA_SIZE);
-
- data += PAS16_PSEUDO_DMA_SIZE;
- cnt += PAS16_PSEUDO_DMA_SIZE;
- count -= PAS16_PSEUDO_DMA_SIZE;
-
- if (SCSI_CUR_PHASE(R_PAS(ptr,r_cscr)) != phase)
- return cnt;
- }
-
- while(!(R_PAS(ptr,pas_stat) & R_PAS_STAT_DREQ)) ;
-
- insb(pas_data(ptr),data,count-1);
- cnt += count-1;
- data += count-1;
-
- while(!(R_PAS(ptr,pas_stat) & R_PAS_STAT_DREQ)) ;
- while((R_PAS(ptr,r_cscr) & R_CSCR_REQ));
- *data = R_PAS(ptr,r_idr);
- cnt++;
- M_PAS(ptr,rw_mr,&,~RW_MR_DMA_MODE);
- return cnt;
- }
-#endif /* NO_PAS16_PSEUDO_DMA */
-
- icmd = R_PAS(ptr,r_icr) & RW_ICR_MASK;
-
-loop:
- if (SCSI_CUR_PHASE(R_PAS(ptr,r_cscr)) != phase)
- return cnt;
-
- WAIT_FOR_REQ(ptr);
- *data++ = R_PAS(ptr,r_csdr);
-
- icmd |= W_ICR_ASSERT_ACK;
- W_PAS(ptr,w_icr,icmd);
- icmd &= ~W_ICR_ASSERT_ACK;
-
- WAIT_FOR_NOT_REQ(ptr);
- W_PAS(ptr,w_icr,icmd);
- ++cnt;
- if (--count > 0)
- goto loop;
-
-scsi_timeout_error:
- return cnt;
-}
-
-
-static int
-cmd_xfer(P_PAS ptr, int maxlen, u_char *data, u_char *status, u_char *msg)
-{
- int xfer=0, phase;
-
- W_PAS(ptr,w_icr,0);
-
- while (1) {
-
- WAIT_FOR_REQ(ptr);
-
- phase = SCSI_CUR_PHASE(R_PAS(ptr,r_cscr));
-
- switch (phase) {
- case SCSI_PHASE_CMD:
- W_PAS(ptr,w_tcr,SCSI_PHASE_CMD);
- xfer += sci_data_out(ptr, SCSI_PHASE_CMD, maxlen, data);
- return xfer;
- case SCSI_PHASE_DATA_IN:
- printf("Data in phase in cmd_xfer?\n");
- return 0;
- case SCSI_PHASE_DATA_OUT:
- printf("Data out phase in cmd_xfer?\n");
- return 0;
- case SCSI_PHASE_STATUS:
- W_PAS(ptr,w_tcr,SCSI_PHASE_STATUS);
- printf("status in cmd_xfer.\n");
- sci_data_in(ptr, SCSI_PHASE_STATUS, 1, status);
- break;
- case SCSI_PHASE_MESSAGE_IN:
- W_PAS(ptr,w_tcr,SCSI_PHASE_MESSAGE_IN);
- printf("msgin in cmd_xfer.\n");
- sci_data_in(ptr, SCSI_PHASE_MESSAGE_IN, 1, msg);
- break;
- case SCSI_PHASE_MESSAGE_OUT:
- W_PAS(ptr,w_tcr,SCSI_PHASE_MESSAGE_OUT);
- sci_data_out(ptr, SCSI_PHASE_MESSAGE_OUT, 1, msg);
- break;
- default:
- printf("Unexpected phase 0x%x in cmd_xfer()\n", phase);
-scsi_timeout_error:
- return xfer;
- break;
- }
- }
-}
-
-static int
-data_xfer(P_PAS ptr, int maxlen, u_char *data, u_char *status, u_char *msg)
-{
- int retlen = 0, xfer, phase;
-
- W_PAS(ptr,w_icr,0);
-
- *status = 0;
-
- while (1) {
-
- WAIT_FOR_REQ(ptr);
-
- phase = SCSI_CUR_PHASE(R_PAS(ptr,r_cscr));
- switch (phase) {
- case SCSI_PHASE_CMD:
- printf("Command phase in data_xfer().\n");
- return retlen;
- case SCSI_PHASE_DATA_IN:
- W_PAS(ptr,w_tcr,SCSI_PHASE_DATA_IN);
- xfer = sci_data_in (ptr, SCSI_PHASE_DATA_IN, maxlen, data);
- retlen += xfer;
- maxlen -= xfer;
- break;
- case SCSI_PHASE_DATA_OUT:
- W_PAS(ptr,w_tcr,SCSI_PHASE_DATA_OUT);
- xfer = sci_data_out (ptr, SCSI_PHASE_DATA_OUT, maxlen, data);
- retlen += xfer;
- maxlen -= xfer;
- break;
- case SCSI_PHASE_STATUS:
- W_PAS(ptr,w_tcr,SCSI_PHASE_STATUS);
- sci_data_in(ptr, SCSI_PHASE_STATUS, 1, status);
- break;
- case SCSI_PHASE_MESSAGE_IN:
- W_PAS(ptr,w_tcr,SCSI_PHASE_MESSAGE_IN);
- sci_data_in(ptr, SCSI_PHASE_MESSAGE_IN, 1, msg);
- if (*msg == 0) {
- return retlen;
- } else {
- printf( "message 0x%x in data_xfer.\n", *msg);
- }
- break;
- case SCSI_PHASE_MESSAGE_OUT:
- W_PAS(ptr,w_tcr,SCSI_PHASE_MESSAGE_OUT);
- sci_data_out(ptr, SCSI_PHASE_MESSAGE_OUT, 1, msg);
- break;
- default:
- printf( "Unexpected phase 0x%x in data_xfer().\n",
- phase);
-scsi_timeout_error:
- return retlen;
- break;
- }
- }
-}
-
-static int
-scsi_req(P_PAS ptr, int target, int lun, u_char *cmd, int cmdlen,
- u_char *databuf, int datalen, int *sent, int *ret)
-{
-/* Returns 0 on success, -1 on internal error, or the status byte */
- int cmd_bytes_sent, r;
- u_char stat, msg, c;
-
- *sent = 0;
- if ( ( r = select_target(ptr, target) ) != SCSI_RET_SUCCESS) {
- *ret = r;
- switch (r) {
- case SCSI_RET_RETRY:
- return 0x08;
- default:
- printf("select_target(target %d, lun %d) failed(%d).\n",
- target, lun, r);
- case SCSI_RET_DEVICE_DOWN:
- return -1;
- }
- }
-
- c = 0x80 | lun;
-
- if ((cmd_bytes_sent = cmd_xfer(ptr, cmdlen, cmd, &stat, &c)) != cmdlen) {
- *ret = SCSI_RET_COMMAND_FAIL;
- printf("Data underrun sending CCB (%d bytes of %d, sent).\n",
- cmd_bytes_sent, cmdlen);
- return -1;
- }
-
- *sent=data_xfer(ptr, datalen, databuf, &stat, &msg);
-
- *ret = 0;
- return stat;
-}
-
-#endif /* NPAS */
diff --git a/sys/i386/isa/pcic.c b/sys/i386/isa/pcic.c
deleted file mode 100644
index f5b31c9..0000000
--- a/sys/i386/isa/pcic.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*-
- * TODO:
- * [1] integrate into current if_ed.c
- * [2] parse tuples to find out where to map the shared memory buffer,
- * and what to write into the configuration register
- * [3] move pcic-specific code into a separate module.
- *
- * Device driver for IBM PCMCIA Credit Card Adapter for Ethernet,
- * if_ze.c
- *
- * Based on the Device driver for National Semiconductor DS8390 ethernet
- * adapters by David Greenman. Modifications for PCMCIA by Keith Moore.
- * Adapted for FreeBSD 1.1.5 by Jordan Hubbard.
- *
- * Currently supports only the IBM Credit Card Adapter for Ethernet, but
- * could probably work with other PCMCIA cards also, if it were modified
- * to get the locations of the PCMCIA configuration option register (COR)
- * by parsing the configuration tuples, rather than by hard-coding in
- * the value expected by IBM's card.
- *
- * Sources for data on the PCMCIA/IBM CCAE specific portions of the driver:
- *
- * [1] _Local Area Network Credit Card Adapters Technical Reference_,
- * IBM Corp., SC30-3585-00, part # 33G9243.
- * [2] "pre-alpha" PCMCIA support code for Linux by Barry Jaspan.
- * [3] Intel 82536SL PC Card Interface Controller Data Sheet, Intel
- * Order Number 290423-002
- * [4] National Semiconductor DP83902A ST-NIC (tm) Serial Network
- * Interface Controller for Twisted Pair data sheet.
- *
- *
- * Copyright (C) 1993, David Greenman. This software may be used, modified,
- * copied, distributed, and sold, in both source and binary form provided
- * that the above copyright and these terms are retained. Under no
- * circumstances is the author responsible for the proper functioning
- * of this software, nor does the author assume any responsibility
- * for damages incurred with its use.
- */
-#include <sys/param.h>
-#if defined(__FreeBSD__)
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <machine/clock.h>
-#endif
-#include <i386/isa/isa.h>
-#include <i386/isa/isa_device.h>
-#include <i386/isa/icu.h>
-#include <i386/isa/pcic.h>
-
-void
-pcic_print_regs (int slot)
-{
- int i, j;
-
- for (i = 0; i < 0x40; i += 16) {
- for (j = 0; j < 16; ++j)
- printf ("%02x ", pcic_getb (slot, i + j));
- printf ("\n");
- }
-}
-
-/*
- * map a portion of the card's memory space into system memory
- * space.
- *
- * slot = # of the slot the card is plugged into
- * window = which pcic memory map registers to use (0..4)
- * sys_addr = base system PHYSICAL memory address where we want it. must
- * be on an appropriate boundary (lower 12 bits are zero).
- * card_addr = the base address of the card's memory to correspond
- * to sys_addr
- * length = length of the segment to map (may be rounded up as necessary)
- * type = which card memory space to map (attribute or shared)
- * width = 1 for byte-wide mapping; 2 for word (16-bit) mapping.
- */
-
-void
-pcic_map_memory (int slot, int window, unsigned long sys_addr,
- unsigned long card_addr, unsigned long length,
- enum memtype type, int width)
-{
- unsigned short offset;
- unsigned short mem_start_addr;
- unsigned short mem_stop_addr;
-
- sys_addr >>= 12;
- card_addr >>= 12;
- length >>= 12;
- /*
- * compute an offset for the chip such that
- * (sys_addr + offset) = card_addr
- * but the arithmetic is done modulo 2^14
- */
- offset = (card_addr - sys_addr) & 0x3FFF;
- /*
- * now OR in the bit for "attribute memory" if necessary
- */
- if (type == ATTRIBUTE) {
- offset |= (PCIC_REG << 8);
- /* REG == "region active" pin on card */
- }
- /*
- * okay, set up the chip memory mapping registers, and turn
- * on the enable bit for this window.
- * if we are doing 16-bit wide accesses (width == 2),
- * turn on the appropriate bit.
- *
- * XXX for now, we set all of the wait state bits to zero.
- * Not really sure how they should be set.
- */
- mem_start_addr = sys_addr & 0xFFF;
- if (width == 2)
- mem_start_addr |= (PCIC_DATA16 << 8);
- mem_stop_addr = (sys_addr + length) & 0xFFF;
-
- pcic_putw (slot, MEM_START_ADDR(window), mem_start_addr);
- pcic_putw (slot, MEM_STOP_ADDR(window), mem_stop_addr);
- pcic_putw (slot, MEM_OFFSET(window), offset);
- /*
- * Assert the bit (PCIC_MEMCS16) that says to decode all of
- * the address lines.
- */
- pcic_putb (slot, PCIC_ADDRWINE,
- pcic_getb (slot, PCIC_ADDRWINE) |
- MEM_ENABLE_BIT(window) | PCIC_MEMCS16);
-}
-
-void
-pcic_unmap_memory (int slot, int window)
-{
- /*
- * seems like we need to turn off the enable bit first, after which
- * we can clear the registers out just to be sure.
- */
- pcic_putb (slot, PCIC_ADDRWINE,
- pcic_getb (slot, PCIC_ADDRWINE) & ~MEM_ENABLE_BIT(window));
- pcic_putw (slot, MEM_START_ADDR(window), 0);
- pcic_putw (slot, MEM_STOP_ADDR(window), 0);
- pcic_putw (slot, MEM_OFFSET(window), 0);
-}
-
-/*
- * map a range of addresses into system i/o space
- * (no translation of i/o addresses is possible)
- *
- * 'width' is:
- * + 0 to tell the PCIC to generate the ISA IOCS16* signal from
- * the PCMCIA IOIS16* signal.
- * + 1 to select 8-bit width
- * + 2 to select 16-bit width
- */
-
-void
-pcic_map_io (int slot, int window, unsigned short base, unsigned short length,
- unsigned short width)
-{
- unsigned char x;
-
- pcic_putw (slot, IO_START_ADDR(window), base);
- pcic_putw (slot, IO_STOP_ADDR(window), base+length-1);
- /*
- * select the bits that determine whether
- * an i/o operation is 8 or 16 bits wide
- */
- x = pcic_getb (slot, PCIC_IOCTL);
- switch (width) {
- case 0: /* PCMCIA card decides */
- if (window)
- x = (x & 0xf0) | PCIC_IO1_CS16;
- else
- x = (x & 0x0f) | PCIC_IO0_CS16;
- break;
- case 1: /* 8 bits wide */
- break;
- case 2: /* 16 bits wide */
- if (window)
- x = (x & 0xf0) | PCIC_IO1_16BIT;
- else
- x = (x & 0x0f) | PCIC_IO0_16BIT;
- break;
- }
- pcic_putb (slot, PCIC_IOCTL, x);
- pcic_putb (slot, PCIC_ADDRWINE,
- pcic_getb (slot, PCIC_ADDRWINE) | IO_ENABLE_BIT(window));
-}
-
-#ifdef TEST
-void
-pcic_unmap_io (int slot, int window)
-{
- pcic_putb (slot, PCIC_ADDRWINE,
- pcic_getb (slot, PCIC_ADDRWINE) & ~IO_ENABLE_BIT(window));
- pcic_putw (slot, IO_START_ADDR(window), 0);
- pcic_putw (slot, IO_STOP_ADDR(window), 0);
-}
-#endif /* TEST */
-
-/*
- * tell the PCIC which irq we want to use. only the following are legal:
- * 3, 4, 5, 7, 9, 10, 11, 12, 14, 15
- *
- * NB: 'irq' is an interrupt NUMBER, not a MASK as in struct isa_device.
- */
-
-void
-pcic_map_irq (int slot, int irq)
-{
- if (irq < 3 || irq == 6 || irq == 8 || irq == 13 || irq > 15) {
- printf ("zp: pcic_map_irq (slot %d): illegal irq %d\n", slot, irq);
- return;
- }
- pcic_putb (slot, PCIC_INT_GEN,
- pcic_getb (slot, PCIC_INT_GEN) | (irq & 0x0F));
-}
-
-void
-pcic_power_on (int slot)
-{
- pcic_putb (slot, PCIC_STATUS,
- pcic_getb (slot, PCIC_STATUS) | PCIC_POW);
- DELAY (100000);
- pcic_putb (slot, PCIC_POWER,
- pcic_getb (slot, PCIC_POWER) | PCIC_DISRST | PCIC_PCPWRE);
- DELAY (100000);
- pcic_putb (slot, PCIC_POWER,
- pcic_getb (slot, PCIC_POWER) | PCIC_OUTENA);
-}
-
-void
-pcic_power_off (int slot)
-{
- pcic_putb (slot, PCIC_POWER,
- pcic_getb (slot, PCIC_POWER) & ~(PCIC_OUTENA|PCIC_PCPWRE));
-}
-
-void
-pcic_reset (int slot)
-{
- /* assert RESET (by clearing a bit!), wait a bit, and de-assert it */
- pcic_putb (slot, PCIC_INT_GEN,
- pcic_getb (slot, PCIC_INT_GEN) & ~PCIC_CARDRESET);
- DELAY (100000);
- pcic_putb (slot, PCIC_INT_GEN,
- pcic_getb (slot, PCIC_INT_GEN) | PCIC_CARDRESET);
-}
-
diff --git a/sys/i386/isa/readMBR.c b/sys/i386/isa/readMBR.c
deleted file mode 100644
index 7515723..0000000
--- a/sys/i386/isa/readMBR.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- *
- * THIS SOFTWARE IS PROVIDED BY THE WRITERS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE WRITERS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * written by julian elischer (julian@tfs.com)
- *
- * @(#)readMBR.c 8.5 (tfs) 1/21/94
- * $Id: readMBR.c,v 1.4 1994/11/14 13:22:41 bde Exp $
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/disklabel.h>
-
-#define b_cylinder b_resid
-
-/*
- * Attempt to read a machine-type dependent Device partitioning table
- * In this case a PC BIOS MBR.
- * Destroys the original disklabel if it finds an MBR, so you'd better
- * know what you're doing. It assumes that the label you've given it
- * Is the one that controls the device, so that it can fiddle with it
- * to make sure it's reading absolute sectors.
- * On exit:
- * Leaves the disklabel set up with the various partitions
- * in the last 4 entries,
- * the A partition pointing to the BSD part
- * the C partition set as the BSD partition, (read the disklabel from there) and
- * the D partition set as the whole disk for beating up
- * will also give you a copy of the machine dependent table if you ask..
- * returns 0 for success,
- * On failure, restores the disklabel and returns a messages pointer.
- */
-char *
-readMBRtolabel(dev, strat, lp, dp, cyl)
- dev_t dev;
- void (*strat)();
- register struct disklabel *lp;
- struct dos_partition *dp;
- int *cyl;
-{
- register struct buf *bp;
- struct disklabel *dlp;
- struct disklabel labelsave;
- char *msg = NULL;
- int i;
- int pseudopart = 4; /* we fill in pseudoparts from e through h*/
- int seenBSD = 0;
-
- /*
- * Save a copy of the disklabel in case we return with an error
- */
- bcopy(lp,&labelsave,sizeof(labelsave));
-
- /*
- * Set the disklabel to some useable partitions in case it's rubbish
- */
- if (lp->d_secperunit == 0)
- lp->d_secperunit = 0x1fffffff;
- lp->d_npartitions = 4;
- for (i=0; i<MAXPARTITIONS; i++) {
- lp->d_partitions[i].p_offset = 0;
- lp->d_partitions[i].p_size = 0;
- }
- lp->d_partitions[RAWPART].p_size = DOSBBSECTOR + 1; /* start low */
- strcpy(lp->d_packname,"MBR based label"); /* Watch the length ! */
-
- /*
- * Get a buffer and get ready to read the MBR
- */
- bp = geteblk((int)lp->d_secsize);
- /* read master boot record */
- bp->b_dev = makedev(major(dev), dkminor(dkunit(dev), RAWPART));
- bp->b_blkno = DOSBBSECTOR;
- bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
- bp->b_cylinder = DOSBBSECTOR / lp->d_secpercyl;
- (*strat)(bp);
-
- /* if successful, wander through dos partition table */
- if ( biowait(bp)) {
- msg = "dos partition I/O error";
- goto bad;
- } else {
- /*
- * If there seems to be BIOS bootblock and partition table
- * in that block, then try interpret it, otherwise
- * give up and use whatever we have synthesised so far
- */
- if ((*(bp->b_un.b_addr + 510) != (char) 0x55)
- ||(*(bp->b_un.b_addr + 511) != (char) 0xaa)) {
- printf("disk doesn't have an MBR\n");
- if(dp)
- bzero(bp->b_un.b_addr + DOSPARTOFF,
- NDOSPART * sizeof(*dp));
- goto hrumpf;
- }
-
- if(dp) { /* if they asked for a copy, give it to them */
- bcopy(bp->b_un.b_addr + DOSPARTOFF, dp,
- NDOSPART * sizeof(*dp));
- }
- dp = (struct dos_partition *)(bp->b_un.b_addr + DOSPARTOFF);
- /*
- * We have a DOS MBR..
- * We set up the last 4 partitions in the
- * disklabel to reflect the DOS partitions
- * In case we never find a disklabel, in which
- * case this information will be all we have
- * but it might be all we need to access a DOS
- * partition.
- */
- for (i = 0; i < NDOSPART; i++, dp++,pseudopart++) {
-
- if (!dp->dp_size)
- continue;
- /*
- * Set this DOS part into the disklabel
- */
- lp->d_partitions[pseudopart].p_size =
- dp->dp_size;
- lp->d_partitions[pseudopart].p_offset =
- dp->dp_start;
-
- /*
- * make sure the D part can hold it all
- */
- if((dp->dp_start + dp->dp_size)
- > lp->d_partitions[3].p_size) {
- lp->d_partitions[3].p_size
- = (dp->dp_start + dp->dp_size);
- }
-
- /*
- * If we haven't seen a *BSD partition then
- * check if this is a valid part..
- * if it is it may be the best we are going to
- * to see, so take note of it to deduce a
- * geometry in case we never find a disklabel.
- */
- switch(dp->dp_typ) {
- case DOSPTYP_386BSD:
- /*
- * at a pinch we could throw
- * a FFS on here
- */
- lp->d_partitions[pseudopart].p_fstype
- = FS_BSDFFS;
- /*
- * Only get a disklabel from the
- * first one we see..
- */
- if (seenBSD == 0) {
- /*
- * If it IS our part, then we
- * need sector address for
- * SCSI/IDE, cylinder for
- * ESDI/ST506/RLL
- */
- seenBSD = 1;
- *cyl = DPCYL(dp->dp_scyl,
- dp->dp_ssect);
-
- /*
- * Note which part we are in (?)
- */
- lp->d_subtype &= ~3;
- lp->d_subtype |= i & 3;
- lp->d_subtype
- |= DSTYPE_INDOSPART;
-
- /*
- * update disklabel with
- * details for reading the REAL
- * disklabel it it exists
- */
- lp->d_partitions[OURPART].p_size =
- dp->dp_size;
- lp->d_partitions[OURPART].p_offset =
- dp->dp_start;
- }
- break;
- case 0xB7: /* BSDI (?)*//* doubtful */
- lp->d_partitions[pseudopart].p_fstype
- = FS_BSDFFS;
- break;
- case 1:
- case 4:
- case 6:
- case 0xF2:
- lp->d_partitions[pseudopart].p_fstype
- = FS_MSDOS;
- break;
- }
-
- /*
- * Try deduce the geometry, working
- * on the principle that this
- * partition PROBABLY ends on a
- * cylinder boundary.
- * This is really a kludge, but we are
- * forced into it by the PC's design.
- * If we've seen a 386bsd part,
- * believe it and check no further.
- */
- if (seenBSD) continue;
- lp->d_ntracks = dp->dp_ehd + 1;
- lp->d_nsectors = DPSECT(dp->dp_esect);
- lp->d_secpercyl = lp->d_ntracks *
- lp->d_nsectors;
- }
- lp->d_npartitions = 8;
- }
-hrumpf:
- bp->b_flags = B_INVAL | B_AGE;
- brelse(bp);
- return 0;
-bad:
- bcopy(&labelsave,lp,sizeof(labelsave));
- bp->b_flags = B_INVAL | B_AGE;
- brelse(bp);
- return msg;
-}
-
-
diff --git a/sys/i386/isa/sound/HOWTO_MIDI b/sys/i386/isa/sound/HOWTO_MIDI
deleted file mode 100644
index f0601e5..0000000
--- a/sys/i386/isa/sound/HOWTO_MIDI
+++ /dev/null
@@ -1,51 +0,0 @@
-The following file describes the procedure for adding modules to MIDI
-Please READ the main documentation files for the driver first!!!
-
-
- Example: We have a sound card with a MIDI chip & port on it
- and, we call it the 'MYBLASTER' card:
-
- **************************************************************************
-
- 0: Run 'configure'. Select the MIDI on CHIP support option.
-
- 1: Write a midi driver module; 'blast_midi.c'
- (with functions for open,close,read,write,attach.)
-
- 1a: Write all functions except the 'attach' the way you want.
-
- For the 'attach' function, look at a model in the 'pro_midi.c'
- file. Just dup it in the same fashion. For the 'generic_midi_operations'
- structure which is required, see file 'dev_table.h'.
-
- 2: We called the 'attach' function: 'blast_attach'.
-
- Go to the file 'dev_table.h' and add your driver name and the function
- pointer ( which is 'blast_attach' ) to the 'midi_supported' table.
-
- 3: You are almost set. Go and make a reference
- to an 'exclude constant'; say EXLCUDE_BLAST_MIDI in your module
- (refer to the 'pro_midi.c' file for model). Also make sure to
- add the constant to the file 'sound_config.h' (for example, look
- where the constant EXCLUDE_PRO_MIDI is in the file.)
-
- 4: Add the line
-
- #define ALL_EXTERNAL_TO_ME
-
- as the 1st line of your 'blast_midi.c' file. This happily, makes
- you ignorant of everything else specific to the driver! :).
-
- 4a: And of course, don't forget to make a device :). Note that your
- minor number should be = ( 15 + position of your driver in the
- 'midi_supported' table in the 'dev_table.h' file ).
-
- Eg: Your driver is the second one in the table. viz midi_supported[1].
- Your device minor number should be ( 15 + 1 = 16 ). Then, make the
- reference to your device as, say CMIDI_DEV_BLAST in the file
- 'sound_config.h'. Also add this in 'soundcard.c' for the open, read,
- write and close routines. See files for example using CMIDI_DEV_PRO
- (which is the ProAudioSpectrum on chip MIDI).
-
- 5: You are all set. If ever you have problems, follow the same model
- as the file 'pro_midi.c', except for substituting your own functions!
diff --git a/sys/i386/isa/sound/RELNOTES b/sys/i386/isa/sound/RELNOTES
deleted file mode 100644
index 03d492d..0000000
--- a/sys/i386/isa/sound/RELNOTES
+++ /dev/null
@@ -1,38 +0,0 @@
-Welcome to use the Linux sound driver for FreeBSD. This
-driver supports the SoundBlaster, SB Pro, Pro Audio Spectrum 16,
-AdLib and Gravis UltraSound sound cards.
-
-In addition there is rather limited support for MPU-401
-(and compatible) midi cards. Also, the OPL-3 synthesizer
-of the SB Pro and PAS16 cards is now supported in the 4 OP
-modes.
-
-Most of the features of the /dev/sequencer device file are
-available just for GUS owners.
-
-The SoundBlaster 16 and SB 16 ASP cards are not supported,
-though they may work in mono mode with speeds < 22 kHz.
-The OPL-3 chicp of the SB 16 should work (without problems?).
-Is there anybody willing to implement the SB 16 support
-(have the SB 16 and the SDK for it)?
-
-Since this driver is a sound driver, it does not contain support
-for SCSI/CD-ROM/Joystick -devices.
-
-Known bugs
-----------
-
-- It's not possible to open /dev/dsp (or /dev/audio) while the
- /dev/sequencer is open for output and GUS is the only soundcard
- installed. It's possible if /dev/dsp is opened before /dev/sequencer
- but at this time the GUS is not available for access via /dev/sequencer.
- This is a limitation of the driver.
-- MPU-401 driver hangs the computer on boot if there is no MPU-401 installed.
- It uses by default the I/O port 0x330, which is also used by the
- Adaptec 1542 SCSI adapter.
-- The /dev/sequencer playback to GUS sounds sometimes rather weird. Hitting
- ^C and playing again should solve this problem. This is probably caused by
- incompatibilities between the GUS and certain VLB motherboards. Try to avoid
- switching between VTs while patches are being loaded to the GUS.
-- There is a skeleton of the patch manager support. It doesn't work in
- this version.
diff --git a/sys/i386/isa/sound/RELNOTES.Linux b/sys/i386/isa/sound/RELNOTES.Linux
deleted file mode 100644
index ea57d0a..0000000
--- a/sys/i386/isa/sound/RELNOTES.Linux
+++ /dev/null
@@ -1,255 +0,0 @@
-Release notes for the Linux Sound Driver 2.5
---------------------------------------------
-There is also a version called 2.5-beta floating around the net. This
-version contains some fixes after it. Mainly to the SB and GUS code.
-
-CAUTION! The SVR4.2 port has not been tested much. Backup your system
- carefully before trying it.
-
-This is mainly a bug fix release. There are couple of new things such as
-linear volume mode for GUS and MIDI recording for SB 2.0 and SB Pro.
-Also this version supports the mixer of GUS v3.7. (Support for GUS MAX and
-the 16-bit daughtercard is coming sooner or later).
-
-NOTE! The sound driver is a part of the Linux kernel distribution also.
- Check that your kernel doesn't have more recent version than this
- when installing a separately distributed sound driver. The
- version number of this driver is defined in the makefile.
-
-This version contains a driver for the SB16 also.
-The SB16 driver requires separate DMA channels for the 8 and 16 bit
-modes. There should be a way to share the 8 bit DMA channels between
-these modes but this feature is not supported yet.
-The SB16 DSP support is by Joerg Schubert (jsb@sth.ruhr-uni-bochum.de).
-
-The SB16 driver has also the Midi input capability even at the same
-time with the /dev/dsp. Also the WaveBlaster daughter board is supported.
-No support for the ASP chip yet (the ASP chip can be installed but it's
-not used by the driver).
-
-You will need the snd-util-2.5.tar.gz and snd-data-0.1.tar.Z
-packages to use this driver. They should be in the same
-ftp site or BBS from where you got this driver. For
-example at nic.funet.fi:pub/OS/Linux/*.
-
-If you are looking for the installation instructions, please
-look at $OS/Readme.
-
-This version supports the following soundcards:
-GUS, SoundBlaster, SB Pro, SB16, Pro Audio Spectrum 16 and AdLib.
-In addition there is rather limited support for MPU-401.
-(and compatible) midi cards. Also the OPL-3 synthesizer
-Most of the features of the /dev/sequencer device file are
-available just for GUS owners.
-
-NOTE! There are separate driver for CD-ROMS supported by
- some soundcards. The driver for CDU31A (Fusion 16) is
- called cdu31a-0.6.diff.z. It will be contained in the
- Linux version 0.99.12. The driver for the CD-ROM of SB Pro
- is sbpcd0.4.tar.gz (these were the latest versions when I wrote
- this). These files should be at least at sunsite.unc.edu.
- Also the SCSI interface of the PAS16 should be supported by
- Linux 0.99.13k and later.
-
- There is also a driver for joystick. Look for file joystick-0.5.tar.gz
- (sunsite).
-
-
-Compatibility with the earlier versions
----------------------------------------
-
-In this version the ultrasound.h no longer includes the sys/soundcard.h
-You have to change the gmod.c of the snd-util-2.0 package and to add an
-include for it.
-
-IMPORTANT!!!!!!!!!!!!!!!!!!!!!!
-
-This version is not binary or source compatible with the version 1.0c.
-
-The ioctl() interface has changed completely since version 1.0c. All
-programs using this driver must be at least recompiled.
-The snd-util-2.0 package contains some utilities for this version.
-
-The version 1.0c and earlier used a 'nonportable' ioctl calling scheme
-where the input argument was passed by value and the output value was
-returned as the functional return. For example setting the speed of
-/dev/dsp were done as the following:
-
- int actual_speed;
- actual_speed = ioctl(fd, SOUND_PCM_WRITE_RATE, 44100);
-
-After version 1.99.0 this must be done as the following:
-
- int actual_speed = 44100;
- ioctl(fd, SOUND_PCM_WRITE_RATE, &actual_speed);
-
-If you have an application written for the version 1.0, you should search
-for the strings SNDCTL_ and SOUND_ and to check the parameters.
-The following ioctl calls have changed:
-
- SNDCTL_SEQ_GETOUTCOUNT
- SNDCTL_SEQ_GETINCOUNT
- SNDCTL_SEQ_TESTMIDI
- SNDCTL_DSP_SPEED
- SNDCTL_DSP_STEREO
- SNDCTL_DSP_GETBLKSIZE
- SNDCTL_DSP_SAMPLESIZE
- SOUND_PCM_WRITE_CHANNELS
- SOUND_PCM_WRITE_FILTER
- SOUND_PCM_READ_RATE
- SOUND_PCM_READ_CHANNELS
- SOUND_PCM_READ_BITS
- SOUND_PCM_READ_FILTER
- SOUND_PCM_WRITE_BITS
- SOUND_PCM_WRITE_RATE
- SOUND_MIXER_READ_* (several ones)
- SOUND_MIXER_WRITE_* (several ones)
-
-Since the this version will support more than one synthesizer devices
-at the same time, the ioctl(SNDCTL_FM_LOAD_INSTR) is obsolete. In addition
-there is some new fields which must be initialized. Look at the sbiset.c in
-the snd-util-2.0 package for further info.
-
-This version is almost 100% compatible with the alpha test version (1.99.9). The
-difference is in the installation procedure.
-
-Using this driver with other operating systems than Linux
----------------------------------------------------------
-
-This package contains just the Linux version. The version 2.3
-for SCO is available at nic.funet.fi:pub/OS/Linux/ALPHA/sound.
-The version 2.3 doesn't work well with xxxxxBSD. Use the version
-2.3 for them.
-
-/dev/sndstat
-------------
-
-The /dev/sndstat is now available in the SCO and BSD versions also.
-
-This is a new devicefile for debugging purposes. A better place for
-it is in the /proc -directory but I was just too lazy to implement it
-properly. The /dev/sndstat (major 14, minor 6) is a file which returns
-info about the current configuration (see the example below). If you
-send me a error/problem report, please include a printout from this
-device to your message (cat /dev/sndstat).
-
-Note! This device file is currently present only in the Linux version
- of this driver.
-
------- cut here --- cat /dev/sndstat example --------
-Sound Driver:1.99.7 (Fri Jul 9 17:01:47 GMT 1993 root@lucifer.savolai.fi)
-Config options: 0x00000d4b
-
-HW config:
-Type 4: Gravis Ultrasound at 0x210 irq 15 drq 6
-Type 3: ProAudioSpectrum at 0x388 irq 10 drq 3
-Type 2: SoundBlaster at 0x220 irq 7 drq 1
-Type 1: AdLib at 0x388 irq 0 drq 0
-
-PCM devices:
-00: Gravis UltraSound
-01: Pro Audio Spectrum
-02: SoundBlaster 2.0
-
-Synth devices:
-00: Gravis UltraSound
-01: Yamaha OPL-3
-
-Midi devices:
-00: Gravis UltraSound
-01: Pro Audio Spectrum
-
-Mixer(s) installed
------- cut here ---- End of Example -----------
-
-Known bugs/limitations
-----------------------
-
-- High speed recording of long audio samples (>20 second) to disk
- is not possible. Everything works until next sync() which delays the
- recording process too much. A delay longer than 0.1 to 0.3 seconds is
- too much.
-- The SB16 driver sometimes swaps the left and right channels together.
-- Midi input doesn't work with SB and SB Pro (SB16 works).
-- It's not possible to open /dev/dsp (or /dev/audio) while the
- /dev/sequencer is open for output and GUS is the only soundcard
- installed. It's possible if /dev/dsp is opened before /dev/sequencer
- but at this time the GUS is not available for access via /dev/sequencer.
- This is a limitation of the driver.
-- MPU-401 driver hangs the computer on boot if there is no MPU-401 installed.
- It uses by default the I/O port 0x330 whic is used by Adaptec 1542 SCSI
- adapter.
-- There are some problems in midi input with MPU-401 and the SB16 midi
- (MPU-401 emulation). This makes it impossible to read long sysex dumps
- using these devices.
-- The /dev/sequencer playback to GUS sounds sometimes rather weird. Hitting
- ^C and playing again should solve this problem. This is propably caused by
- incompatibilities between GUS and certain VLB motherboards (like mine).
- Try to avoid
- switching between VTs while patches are being loaded to the GUS.
- This problem disappears completely if you define GUS_PATCH_NO_DMA in the
- local.h (after make config in linux). The drawback is that patch loading
- without DMA takes several times longer than with DMA.
-- There is a skeleton of the patch manager support. It don't work in
- this version.
-
-
-Future development
-------------------
-
-- Since this driver is no longer just the Linux Sound Driver, it's time
- to give it a new name. I have planned to use name VoxWare.
-- I'm writing a Hacker's guide to the VoxWare sound driver. Should
- be ready within this(/next) year (alpha version).
-- Completion of the ISC, SCO and BSD ports. Port to SVR4.2.
-- I'm interested to implement/include support for new soundcards and
- operating systems.
-
- Hint for the soundcard and OS manufacturers:
- I'm collecting soundcards (high end ones) and SDKs for them. In
- addition I'm collecting PC operating systems. I will be happy if
- somebody sends me such items. In addition such kind of donation
- makes it easier to change the VoxWare driver to support your
- soundcard or operating system. However, please contact me before
- sending anything.
-
-I will propably release some fix versions within this and next year. At
-least when the non-Linux versions get ready. The next major release (3.0)
-will be quite complete rewrite and released after about a year (end of 94 or
-beginning of 95).
-
-
-Contributors
-------------
-
-This driver contains code by several contributors. In addition several other
-persons have given usefull suggestions. The following is a list of major
-contributors. (I could have forgotten some names.)
-
- Craig Metz 1/2 of the PAS16 Mixer and PCM support
- Rob Hooft Volume computation algorithm for the FM synth.
- Mika Liljeberg uLaw encoding and decoding routines
- Greg Lee Volume computation algorithm for the GUS and
- lot's of valuable suggestions.
- Andy Warner Initial ISC port
- Jim Lowe Initial FreeBSD port
- Anders Baekgaard Bughunting and valuable suggestions.
- Joerg Schubert SB16 DSP support.
- Andrew Robinson Improvements to the GUS driver
- Megens SA MIDI recording for SB and SB Pro.
- Mikael Nordqvist Linear volume support for GUS.
- Ian Hartas SVR4.2 port
- Markus Aroharju and
- Risto Kankkunen Major contributions to the mixer support
- of GUS v3.7.
- Hunyue Yau Sound Galaxy NX Pro mixer support.
-
-Regards,
-
-Hannu Savolainen
-hannu@voxware.pp.fi, Hannu.Savolainen@Helsinki.fi
-
-Snail mail: Hannu Savolainen
- Pallaksentie 4 A 2
- 00970 Helsinki
- Finland
diff --git a/sys/i386/isa/sound/Readme.freebsd b/sys/i386/isa/sound/Readme.freebsd
deleted file mode 100644
index 03f96f4..0000000
--- a/sys/i386/isa/sound/Readme.freebsd
+++ /dev/null
@@ -1,36 +0,0 @@
-
-This driver was updated to VoxWare v3.0 pre-release and ad1848 support was
-enabled (since it works for me :)
-
-To configure the sound driver, one or more of these entries should go in your
-config file:
-
-device snd5 at isa? port 0x330 irq 6 vector mpuintr # MPU-401
-device snd4 at isa? port 0x220 irq 15 drq 6 vector gusintr # GUS
-device snd3 at isa? port 0x388 irq 10 drq 6 vector pasintr # PAS
-device snd2 at isa? port 0x220 irq 7 drq 1 vector sbintr # SB
-device snd6 at isa? port 0x220 irq 7 drq 5 vector sbintr # SB16 ?
-device snd7 at isa? port 0x300 # YM3812 ???
-device snd1 at isa? port 0x388 # YM3812
-device snd10 at isa? port 0x530 irq 10 drq 1 vector adintr # MSS
-
-Then add some of these (no need for EXCLUDE_BLAH anymore):
-
-[ Need to know if multiple entries required! - jkh ]
-
-options AUDIO_PAS
-options AUDIO_SB
-options AUDIO_GUS
-options AUDIO_MPU401
-options AUDIO_UART6850
-options AUDIO_PSS
-options AUDIO_GUS16
-options AUDIO_GUSMAX
-options AUDIO_MSS
-options AUDIO_SBPRO
-options AUDIO_SB16
-options AUDIO_YM3812
-
-
-
--Sujal Patel (smpatel@wam.umd.edu)
diff --git a/sys/i386/isa/sound/gustest/Makefile b/sys/i386/isa/sound/gustest/Makefile
deleted file mode 100644
index d161e5b..0000000
--- a/sys/i386/isa/sound/gustest/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-all: gustest gusload gmod midithru
-
-gustest: gustest.c
- $(CC) -o gustest gustest.c -lm
-
-gusload: gusload.c
- $(CC) -o gusload gusload.c
-
-gmod: gmod.c
- $(CC) -o gmod gmod.c
-
-midithru: midithru.c
- $(CC) -o midithru midithru.c
-
-clean:
- rm -f gusload gustest gmod midithru *.o
diff --git a/sys/i386/isa/sound/gustest/Readme b/sys/i386/isa/sound/gustest/Readme
deleted file mode 100644
index 7640bf8..0000000
--- a/sys/i386/isa/sound/gustest/Readme
+++ /dev/null
@@ -1,67 +0,0 @@
-The programs in this directory are more or less incompletely implemented.
-I have used them for debugging purposes while developing the driver.
-
-Files in this directory:
-
-
-../ultrasound.h (sys/ultrasound.h)
- This file contains some macros which are similar than
- the procedures provided by GUSUNIT.PAS. See gustest.c
- for more information.
- INSTALL THIS FILE TO YOUR /usr/include/sys !!!!!!!!!!!!
-
-gusload.c This program can be used to load patches (samples) to
- the DRAM of GUS. It understands the format used in the
- .pat files shipped with GUS.
-
- Usage: gusload pgm# patchfile.
- or gusload reset #Removes all patches from memory.
-
- You should load just the patches you will need to play
- a Midi file, since the memory capacity of GUS is rather
- limited (256k-1M).
-
- Example:
-
- gusload 0 acpiano.pat
- gusload 1 britepno.pat
- gusload 19 church.pat
-
- This program is not required if the adagio package is
- used. It can do the patch uploading itself.
-
-gmod.c This is a simple module player which demonstrates
- programming with GUS. It doesn't try to interpret
- most of the effect commands. In fact this program
- may interpret the modules incorrectly since I am
- not a module player expert.
- This version plays .MOD, .STM and .669 modules.
-
-midithru.c This program reads messages from the Midi interface
- and plays the notes with an internal synthesizer
- (FM or GUS). The program accepts one argument, the
- synthesizer device number. In addition to the note on
- and note off messages it interprets also program changes
- and channel pressure messages.
- If you need an example on programming the /dev/sequencer,
- this is a good one. The voice allocation algorithm is
- not good so don't look at it.
-
- NOTE! This program is useful with gmod. Jus load
- a module with gmod. Wait until the module has
- finished or hit ^C. Now you can play the samples
- with the midithru program.
-
- NOTE2! You need a Midi keyboard to use this program. In
- addition the Midi interface of GUS is not supported
- yet which means you need also PAS16 or MPU-401.
-
-pmtest.c
-gpatinfo.c ******* For information only *******
- These programs demonstrate the patch manager interface
- which will be included to some later driver version.
- This interface is not complete in version 1.99.9.
- Using pmtest will hang your system sooner or later.
-
-Hannu Savolainen
-hsavolai@cs.helsinki.fi
diff --git a/sys/i386/isa/sound/gustest/gmidi.h b/sys/i386/isa/sound/gustest/gmidi.h
deleted file mode 100644
index 106cfa2..0000000
--- a/sys/i386/isa/sound/gustest/gmidi.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * $Id$
- */
- char patch_names[][9] =
- {
- /* 0 */ "acpiano",
- /* 1 */ "britepno",
- /* 2 */ "synpiano",
- /* 3 */ "honktonk",
- /* 4 */ "epiano1",
- /* 5 */ "epiano2",
- /* 6 */ "hrpschrd",
- /* 7 */ "clavinet",
- /* 8 */ "celeste",
- /* 9 */ "glocken",
- /* 10 */ "musicbox",
- /* 11 */ "vibes",
- /* 12 */ "marimba",
- /* 13 */ "xylophon",
- /* 14 */ "tubebell",
- /* 15 */ "santur",
- /* 16 */ "homeorg",
- /* 17 */ "percorg",
- /* 18 */ "rockorg",
- /* 19 */ "church",
- /* 20 */ "reedorg",
- /* 21 */ "accordn",
- /* 22 */ "harmonca",
- /* 23 */ "concrtna",
- /* 24 */ "nyguitar",
- /* 25 */ "acguitar",
- /* 26 */ "jazzgtr",
- /* 27 */ "cleangtr",
- /* 28 */ "mutegtr",
- /* 29 */ "odguitar",
- /* 30 */ "distgtr",
- /* 31 */ "gtrharm",
- /* 32 */ "acbass",
- /* 33 */ "fngrbass",
- /* 34 */ "pickbass",
- /* 35 */ "fretless",
- /* 36 */ "slapbas1",
- /* 37 */ "slapbas2",
- /* 38 */ "synbass1",
- /* 39 */ "synbass2",
- /* 40 */ "violin",
- /* 41 */ "viola",
- /* 42 */ "cello",
- /* 43 */ "contraba",
- /* 44 */ "marcato",
- /* 45 */ "pizzcato",
- /* 46 */ "harp",
- /* 47 */ "timpani",
- /* 48 */ "marcato",
- /* 49 */ "slowstr",
- /* 50 */ "synstr1",
- /* 51 */ "synstr2",
- /* 52 */ "choir",
- /* 53 */ "doo",
- /* 54 */ "voices",
- /* 55 */ "orchhit",
- /* 56 */ "trumpet",
- /* 57 */ "trombone",
- /* 58 */ "tuba",
- /* 59 */ "mutetrum",
- /* 60 */ "frenchrn",
- /* 61 */ "hitbrass",
- /* 62 */ "synbras1",
- /* 63 */ "synbras2",
- /* 64 */ "sprnosax",
- /* 65 */ "altosax",
- /* 66 */ "tenorsax",
- /* 67 */ "barisax",
- /* 68 */ "oboe",
- /* 69 */ "englhorn",
- /* 70 */ "bassoon",
- /* 71 */ "clarinet",
- /* 72 */ "piccolo",
- /* 73 */ "flute",
- /* 74 */ "recorder",
- /* 75 */ "woodflut",
- /* 76 */ "bottle",
- /* 77 */ "shakazul",
- /* 78 */ "whistle",
- /* 79 */ "ocarina",
- /* 80 */ "sqrwave",
- /* 81 */ "sawwave",
- /* 82 */ "calliope",
- /* 83 */ "chiflead",
- /* 84 */ "voxlead",
- /* 85 */ "voxlead",
- /* 86 */ "lead5th",
- /* 87 */ "basslead",
- /* 88 */ "fantasia",
- /* 89 */ "warmpad",
- /* 90 */ "polysyn",
- /* 91 */ "ghostie",
- /* 92 */ "bowglass",
- /* 93 */ "metalpad",
- /* 94 */ "halopad",
- /* 95 */ "sweeper",
- /* 96 */ "aurora",
- /* 97 */ "soundtrk",
- /* 98 */ "crystal",
- /* 99 */ "atmosphr",
- /* 100 */ "freshair",
- /* 101 */ "unicorn",
- /* 102 */ "sweeper",
- /* 103 */ "startrak",
- /* 104 */ "sitar",
- /* 105 */ "banjo",
- /* 106 */ "shamisen",
- /* 107 */ "koto",
- /* 108 */ "kalimba",
- /* 109 */ "bagpipes",
- /* 110 */ "fiddle",
- /* 111 */ "Shannai",
- /* 112 */ "carillon",
- /* 113 */ "agogo",
- /* 114 */ "steeldrm",
- /* 115 */ "woodblk",
- /* 116 */ "taiko",
- /* 117 */ "toms",
- /* 118 */ "syntom",
- /* 119 */ "revcym",
- /* 120 */ "fx-fret",
- /* 121 */ "fx-blow",
- /* 122 */ "seashore",
- /* 123 */ "jungle",
- /* 124 */ "telephon",
- /* 125 */ "helicptr",
- /* 126 */ "applause",
- /* 127 */ "ringwhsl"
- };
diff --git a/sys/i386/isa/sound/gustest/gmod.c b/sys/i386/isa/sound/gustest/gmod.c
deleted file mode 100644
index 2988783..0000000
--- a/sys/i386/isa/sound/gustest/gmod.c
+++ /dev/null
@@ -1,1589 +0,0 @@
-/*
- * gmod.c - Module player for GUS and Linux.
- * (C) Hannu Savolainen, 1993
- *
- * NOTE! This program doesn't try to be a complete module player.
- * It's just a too I used while developing the driver. In
- * addition it can be used as an example on programming
- * the LInux Sound Driver with GUS.
- * $Id$
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <machine/ultrasound.h>
-#include <fcntl.h>
-#include <math.h>
-#include <string.h>
-
-#define CMD_ARPEG 0x00
-#define CMD_SLIDEUP 0x01
-#define CMD_SLIDEDOWN 0x02
-#define CMD_SLIDETO 0x03
-#define SLIDE_SIZE 8
-#define CMD_VOLSLIDE 0x0a
-#define CMD_JUMP 0x0b
-#define CMD_VOLUME 0x0c
-#define CMD_BREAK 0x0d
-#define CMD_SPEED 0x0f
-#define CMD_NOP 0xfe
-#define CMD_NONOTE 0xff
-
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-
-#define MAX_TRACK 8
-#define MAX_PATTERN 128
-#define MAX_POSITION 128
-
-struct note_info
- {
- unsigned char note;
- unsigned char vol;
- unsigned char sample;
- unsigned char command;
- short parm1, parm2;
- };
-
-struct voice_info
- {
- int sample;
- int note;
- int volume;
- int pitchbender;
-
- /* Pitch sliding */
-
- int slide_pitch;
- int slide_goal;
- int slide_rate;
-
- int volslide;
- };
-
-typedef struct note_info pattern[MAX_TRACK][64];
-int pattern_len[MAX_POSITION];
-int pattern_tempo[MAX_POSITION];
-pattern *pattern_table[MAX_PATTERN];
-
-struct voice_info voices[MAX_TRACK];
-
-int nr_channels, nr_patterns, songlength;
-int tune[MAX_POSITION];
-double tick_duration;
-
-int period_table[] =
-{
- 856, 808, 762, 720, 678, 640, 604, 570, 538, 508, 480, 453,
- 428, 404, 381, 360, 339, 320, 302, 285, 269, 254, 240, 226,
- 214, 202, 190, 180, 170, 160, 151, 143, 135, 127, 120, 113
-};
-
-SEQ_DEFINEBUF (2048);
-
-int seqfd;
-int sample_ok[128], sample_vol[128];
-int tmp, gus_dev;
-double this_time, next_time;
-int ticks_per_division;
-double clock_rate; /* HZ */
-
-/*
- * The function seqbuf_dump() must always be provided
- */
-
-void play_module (char *name);
-int load_module (char *name);
-int play_note (int channel, struct note_info *pat);
-void lets_play_voice (int channel, struct voice_info *v);
-
-void
-seqbuf_dump ()
-{
- if (_seqbufptr)
- if (write (seqfd, _seqbuf, _seqbufptr) == -1)
- {
- perror ("write /dev/sequencer");
- exit (-1);
- }
- _seqbufptr = 0;
-}
-
-void
-init_voices ()
-{
- int i;
-
- for (i = 0; i < MAX_TRACK; i++)
- {
- voices[i].sample = 0;
- voices[i].note = 0;
- voices[i].volume = 64;
-
- voices[i].slide_pitch = 0;
- voices[i].slide_goal = 0;
- voices[i].slide_rate = 0;
- voices[i].pitchbender = 0;
-
- voices[i].volslide = 0;
- }
-}
-
-int
-main (int argc, char *argv[])
-{
- int i, n, j;
- struct synth_info info;
-
- if ((seqfd = open ("/dev/sequencer", O_WRONLY, 0)) == -1)
- {
- perror ("/dev/sequencer");
- exit (-1);
- }
-
- if (ioctl (seqfd, SNDCTL_SEQ_NRSYNTHS, &n) == -1)
- {
- perror ("/dev/sequencer");
- exit (-1);
- }
-
- for (i = 0; i < n; i++)
- {
- info.device = i;
-
- if (ioctl (seqfd, SNDCTL_SYNTH_INFO, &info) == -1)
- {
- perror ("/dev/sequencer");
- exit (-1);
- }
-
- if (info.synth_type == SYNTH_TYPE_SAMPLE
- && info.synth_subtype == SAMPLE_TYPE_GUS)
- gus_dev = i;
- }
-
- if (gus_dev == -1)
- {
- fprintf (stderr, "Gravis Ultrasound not detected\n");
- exit (-1);
- }
-
- GUS_NUMVOICES (gus_dev, 14);
-
- for (i = 1; i < argc; i++)
- {
- for (j = 0; j < MAX_PATTERN; j++)
- pattern_table[j] = NULL;
-
- if (load_module (argv[i]))
- {
- tick_duration = 100.0 / clock_rate;
- play_module (argv[i]);
- }
-
- }
-
- SEQ_DUMPBUF ();
- close (seqfd);
-
- exit (0);
-}
-
-unsigned short
-intelize (unsigned short v)
-{
- return ((v & 0xff) << 8) | ((v >> 8) & 0xff);
-}
-
-unsigned long
-intelize4 (unsigned long v)
-{
- return
- (((v >> 16) & 0xff) << 8) | (((v >> 16) >> 8) & 0xff) |
- (((v & 0xff) << 8) | ((v >> 8) & 0xff) << 16);
-}
-
-int
-load_stm_module (int mod_fd, char *name)
-{
-
- struct sample_header
- {
- char name[12];
- unsigned char instr_disk;
- unsigned short reserved1;
- unsigned short length; /* In bytes */
- unsigned short loop_start;
- unsigned short loop_end;
- unsigned char volume;
- unsigned char reserved2;
- unsigned short C2_speed;
- unsigned short reserved3;
-
- };
-
- int i, total_mem;
- int sample_ptr;
-
- int position;
-
- unsigned char *tune_ptr; /* array 0-127 */
-
- char header[1105], sname[21];
-
- int nr_samples; /* 16 or 32 samples (or 64 or ???) */
- int slen, npat;
-
- fprintf (stderr, "Loading .STM module: %s\n", name);
-
- if (read (mod_fd, header, sizeof (header)) != sizeof (header))
- {
- fprintf (stderr, "%s: Short file (header)\n", name);
- close (mod_fd);
- return 0;
- }
-
- strncpy (sname, header, 20);
-
- fprintf (stderr, "\nModule: %s - ", sname);
-
- if (header[28] != 0x1a)
- {
- fprintf (stderr, "Not a STM module\n");
- close (mod_fd);
- return 0;
- }
-
- npat = header[33];
- slen = 0;
- tune_ptr = &header[48 + (31 * 32)];
-
- for (i = 0; i < 64; i++)
- {
- tune[i] = tune_ptr[i];
- if (tune[i] < npat)
- slen = i;
- }
-
- fprintf (stderr, "Song lenght %d, %d patterns.\n", slen, npat);
-
- nr_samples = 31;
-
- sample_ptr = 48 + (31 * 32) + 64 + (npat * 1024); /* Location where the
- * first sample is
- * stored */
- total_mem = 0;
-
- for (i = 0; i < 32; i++)
- sample_ok[i] = 0;
-
- for (i = 0; i < nr_samples; i++)
- {
- int len, loop_start, loop_end, base_freq;
- unsigned short loop_flags = 0;
-
- struct sample_header *sample;
-
- struct patch_info *patch;
-
- sample = (struct sample_header *) &header[48 + (i * 32)];
-
- len = sample->length;
- loop_start = sample->loop_start;
- loop_end = sample->loop_end;
- base_freq = sample->C2_speed;
-
- if (strlen (sample->name) > 21)
- {
- fprintf (stderr, "\nInvalid name for sample #%d\n", i);
- close (mod_fd);
- return 0;
- }
-
- if (len > 0)
- {
- int x;
-
- if (loop_end > len)
- loop_end = 1;
- else if (loop_end < loop_start)
- {
- loop_start = 0;
- loop_end = 0;
- }
- else
- loop_flags = WAVE_LOOPING;
-
- total_mem += len;
- patch = (struct patch_info *) malloc (sizeof (*patch) + len);
-
- patch->key = GUS_PATCH;
- patch->device_no = gus_dev;
- patch->instr_no = i;
- patch->mode = loop_flags;
- patch->len = len;
- patch->loop_start = loop_start;
- patch->loop_end = loop_end;
- patch->base_freq = base_freq;
- patch->base_note = 261630; /* Mid C */
- patch->low_note = 0;
- patch->high_note = 0x7fffffff;
- patch->volume = 120;
-
- if (lseek (mod_fd, sample_ptr, 0) == -1)
- {
- perror (name);
- close (mod_fd);
- free (patch);
- return 0;
- }
-
- sample_ptr += len;
-
- if ((x = read (mod_fd, patch->data, len)) != len)
- {
- fprintf (stderr, "Short file (sample at %d (%d!=%d)\n", sample_ptr, x, len);
- close (mod_fd);
- free (patch);
- return 0;
- }
-
- fprintf (stderr, "Sample %02d: %05d, %05d, %05d, %07d %s\n",
- i,
- len,
- loop_start,
- loop_end,
- base_freq,
- sample->name);
-
- if (write (seqfd, patch, sizeof (*patch) + len) == -1)
- {
- perror ("ioctl /dev/sequencer");
- exit (-1);
- }
- else
- sample_ok[i] = 1;
-
- free (patch);
- }
- }
-
- nr_patterns = slen;
- songlength = slen;
- nr_channels = 4;
-
- for (position = 0; position < npat; position++)
- {
- unsigned char patterns[64][4][4];
- int pat, channel, x;
-
- int pp = 1104 + (position * 1024);
-
- if ((pattern_table[position] = (pattern *) malloc (sizeof (struct note_info) * 64 * nr_channels)) == NULL)
- {
- fprintf (stderr, "Can't allocate memory for a pattern\n");
- return 0;
- }
-
- if (lseek (mod_fd, pp, 0) == -1)
- {
- perror (name);
- close (mod_fd);
- return 0;
- }
-
- if ((x = read (mod_fd, patterns, 1024)) != 1024)
- {
- fprintf (stderr, "Short file (pattern at %d), %d!=%d\n", pp, x, 1024);
- close (mod_fd);
- return 0;
- }
-
- for (pat = 0; pat < 64; pat++)
- {
-
- for (channel = 0; channel < 4; channel++)
- {
- unsigned char *p;
-
- unsigned vol, note, octave, sample, effect, params;
-
- p = &patterns[pat][channel][0];
-
- if (p[0] < 251)
- {
- note = p[0] & 15;
- octave = p[0] / 16;
-
- note = 48 + octave * 12 + note;
-
- sample = p[1] / 8;
- vol = (p[1] & 7) + (p[2] / 2);
- effect = p[2] & 0xF;
- params = p[3];
- }
- else
- {
- note = 0;
- octave = 0;
-
- sample = 0;
- vol = 0;
- effect = CMD_NONOTE;
- params = 0;
- }
-
- (*pattern_table[position])[channel][pat].note = note;
- (*pattern_table[position])[channel][pat].sample = sample;
- (*pattern_table[position])[channel][pat].command = effect;
- (*pattern_table[position])[channel][pat].parm1 = params;
- (*pattern_table[position])[channel][pat].parm2 = 0;
- (*pattern_table[position])[channel][pat].vol = vol;
- }
-
- }
-
- }
-
- close (mod_fd);
- return 1;
-}
-
-int
-load_669_module (int mod_fd, char *name)
-{
- struct sample_header
- {
- char name[13];
- unsigned long length; /* In bytes */
- unsigned long loop_start;
- unsigned long loop_end;
- };
-
- int i, total_mem;
- int sample_ptr;
-
- int position;
-
- unsigned char *tune_ptr, *len_ptr, *tempo_ptr; /* array 0-127 */
-
- char header[1084];
- char msg[110];
-
- int nr_samples; /* 16 or 32 samples */
- int slen, npat;
-
- clock_rate = 25.0;
-
- fprintf (stderr, "Loading .669 module: %s\n", name);
-
- if (read (mod_fd, header, sizeof (header)) != sizeof (header))
- {
- fprintf (stderr, "%s: Short file (header)\n", name);
- close (mod_fd);
- return 0;
- }
-
- if (*(unsigned short *) &header[0] != 0x6669)
- {
- fprintf (stderr, "Not a 669 file\n");
- close (mod_fd);
- return 0;
- }
-
- strncpy (msg, &header[2], 108);
-
- for (i = 0; i < strlen (msg); i++)
- if ((msg[i] >= ' ' && msg[i] <= 'z') || msg[i] == '\n')
- printf ("%c", msg[i]);
- printf ("\n");
-
- npat = header[0x6f];
-
- tune_ptr = &header[0x71];
-
- for (slen = 0; slen < 128 && tune_ptr[slen] != 0xff; slen++);
- slen--;
-
- for (i = 0; i < slen; i++)
- tune[i] = tune_ptr[i];
-
- len_ptr = &header[0x171];
- for (i = 0; i < slen; i++)
- pattern_len[i] = len_ptr[i] - 1;
-
- tempo_ptr = &header[0xf1];
- for (i = 0; i < slen; i++)
- pattern_tempo[i] = tempo_ptr[i];
-
- nr_samples = header[0x6e];
-
- fprintf (stderr, "Song lenght %d, %d patterns, %d samples.\n", slen, npat, nr_samples);
-
- sample_ptr = 0x1f1 + (nr_samples * 0x19) + (npat * 0x600); /* Location where the
- * first sample is
- * stored */
- total_mem = 0;
-
- for (i = 0; i < 64; i++)
- sample_ok[i] = 0;
-
- for (i = 0; i < nr_samples; i++)
- {
- int len, loop_start, loop_end;
- unsigned short loop_flags = 0;
-
- struct sample_header *sample;
- char sname[14];
-
- struct patch_info *patch;
-
- sample = (struct sample_header *) &header[0x1f1 + (i * 0x19)];
-
- len = *(unsigned long *) &sample->name[13];
- loop_start = *(unsigned long *) &sample->name[17];
- loop_end = *(unsigned long *) &sample->name[21];
- if (loop_end > len)
- loop_end = 1;
- else if (loop_end == len)
- loop_end--;
-
- if (loop_end < loop_start)
- {
- loop_start = 0;
- loop_end = 0;
- }
-
- strncpy (sname, sample->name, 13);
-
- if (len > 0 && len < 200000)
- {
- total_mem += len;
-
- fprintf (stderr, "Sample %02d: %05d, %05d, %05d %s\n",
- i,
- len,
- loop_start,
- loop_end,
- sname);
-
- patch = (struct patch_info *) malloc (sizeof (*patch) + len);
-
- if (loop_end == 0)
- loop_end = 1;
- if (loop_end >= len)
- loop_end = 1;
-
- if (loop_end > 1) loop_flags = WAVE_LOOPING;
-
- patch->key = GUS_PATCH;
- patch->device_no = gus_dev;
- patch->instr_no = i;
- patch->mode = WAVE_UNSIGNED | loop_flags;
- patch->len = len;
- patch->loop_start = loop_start;
- patch->loop_end = loop_end;
- patch->base_freq = 8448;
- patch->base_note = 261630;
- patch->low_note = 1000;
- patch->high_note = 0x7fffffff;
- patch->volume = 120;
-
- if (lseek (mod_fd, sample_ptr, 0) == -1)
- {
- fprintf (stderr, "Seek failed\n");
- perror (name);
- close (mod_fd);
- free (patch);
- return 0;
- }
-
- sample_ptr += len;
-
- if (read (mod_fd, patch->data, len) != len)
- {
- fprintf (stderr, "Short file (sample at %d)\n", sample_ptr);
- close (mod_fd);
- free (patch);
- return 0;
- }
-
- if (write (seqfd, patch, sizeof (*patch) + len) == -1)
- {
- perror ("ioctl /dev/sequencer");
- /* exit (-1); */
- }
- else
- sample_ok[i] = 1;
-
- free (patch);
- }
- }
-
- nr_patterns = slen;
- songlength = slen;
- nr_channels = 8;
-
- for (position = 0; position < npat; position++)
- {
- unsigned char patterns[0x600];
- int pat, channel, x;
-
- int pp = 0x1f1 + (nr_samples * 0x19) + (position * 0x600);
-
- if ((pattern_table[position] = (pattern *) malloc (sizeof (struct note_info) * 64 * nr_channels)) == NULL)
- {
- fprintf (stderr, "Can't allocate memory for a pattern\n");
- return 0;
- }
-
-
- if (lseek (mod_fd, pp, 0) == -1)
- {
- perror (name);
- close (mod_fd);
- return 0;
- }
-
- if ((x = read (mod_fd, patterns, 1024)) != 1024)
- {
- fprintf (stderr, "Short file (pattern at %d) %d!=1024\n", pp, x);
- close (mod_fd);
- return 0;
- }
-
- for (pat = 0; pat < 64; pat++)
- {
-
- for (channel = 0; channel < 8; channel++)
- {
- unsigned char *p;
-
- unsigned vol, period, sample, effect, params;
-
- p = &patterns[pat * 24 + channel * 3];
-
- if (p[0] >= 0xfe ||
- (p[0] == 0xff && p[1] == 0xff && p[2] == 0xff) ||
- (p[0] == 0 && p[1] == 0 && p[2] == 0) ||
- *(int *) p == -1)
- {
- period = 0;
- effect = CMD_NONOTE;
- sample = 0;
- vol = 0;
- params = 0;
-
- if (p[0] == 0)
- {
- effect = CMD_BREAK;
- params = -2;
- }
- }
- else
- {
- period = (p[0] >> 2) + 48;
- effect = (p[2] >> 4);
- params = p[2] & 0x0f;
- vol = p[1] & 0x0f;
-
- if (p[2] == 0xfe)
- {
- effect = CMD_VOLUME;
- params = vol;
- }
- else if (p[2] == 0xff)
- {
- effect = CMD_NOP;
- }
- else
- switch (effect)
- {
- case 0: /* a - Portamento up */
- effect = CMD_SLIDEUP;
- break;
-
- case 1: /* b - Portamento down */
- effect = CMD_SLIDEDOWN;
- break;
-
- case 2: /* c - Port to note */
- effect = CMD_SLIDETO;
- break;
-
- case 3: /* d - Frequency adjust */
- effect = CMD_NOP; /* To be implemented */
- break;
-
- case 4: /* e - Frequency vibrato */
- effect = CMD_NOP; /* To be implemented */
- break;
-
- case 5: /* f - Set tempo */
- effect = CMD_SPEED;
- break;
-
- default:
- effect = CMD_NOP;
- }
-
- sample = (((p[0] << 4) & 0x30) | ((p[1] >> 4) & 0x0f)) + 1;
- }
-
- (*pattern_table[position])[channel][pat].note = period;
- (*pattern_table[position])[channel][pat].sample = sample;
- (*pattern_table[position])[channel][pat].command = effect;
- (*pattern_table[position])[channel][pat].parm1 = params;
- (*pattern_table[position])[channel][pat].parm2 = 0;
- (*pattern_table[position])[channel][pat].vol = vol;
- }
-
- }
-
- }
-
- close (mod_fd);
- return 1;
-}
-
-int
-load_mmd0_module (int mod_fd, char *name)
-{
-
- struct sample_header
- {
- unsigned short loop_start;
- unsigned short loop_end;
- unsigned char midich;
- unsigned char midipreset;
- unsigned char volume;
- unsigned char strans;
- };
-
- int i, total_mem;
- int sample_ptr;
-
- int position;
-
- unsigned char *tune_ptr; /* array 0-127 */
-
- char header[1105];
-
- int nr_samples; /* 16 or 32 samples (or 64 or ???) */
- int slen, npat;
-
- fprintf (stderr, "Loading .MED module: %s\n", name);
-
- if (read (mod_fd, header, sizeof (header)) != sizeof (header))
- {
- fprintf (stderr, "%s: Short file (header)\n", name);
- close (mod_fd);
- return 0;
- }
-
- if (strncmp (header, "MMD0", 4))
- {
- fprintf (stderr, "Not a MED module\n");
- close (mod_fd);
- return 0;
- }
-
- printf ("Module len %d\n", intelize4 (*(long *) &header[4]));
- printf ("Song info %d\n", intelize4 (*(long *) &header[8]));
- printf ("Song len %d\n", intelize4 (*(long *) &header[12]));
- printf ("Blockarr %x\n", intelize4 (*(long *) &header[16]));
- printf ("Blockarr len %d\n", intelize4 (*(long *) &header[20]));
- printf ("Sample array %x\n", intelize4 (*(long *) &header[24]));
- printf ("Sample array len %d\n", intelize4 (*(long *) &header[28]));
- printf ("Exp data %x\n", intelize4 (*(long *) &header[32]));
- printf ("Exp size %d\n", intelize4 (*(long *) &header[36]));
- printf ("Pstate %d\n", intelize (*(long *) &header[40]));
- printf ("Pblock %d\n", intelize (*(long *) &header[42]));
-
- return 0;
-
- npat = header[33];
- slen = 0;
- tune_ptr = &header[48 + (31 * 32)];
-
- for (i = 0; i < 64; i++)
- {
- tune[i] = tune_ptr[i];
- if (tune[i] < npat)
- slen = i;
- }
-
- fprintf (stderr, "Song lenght %d, %d patterns.\n", slen, npat);
-
- nr_samples = 31;
-
- sample_ptr = 48 + (31 * 32) + 64 + (npat * 1024); /* Location where the
- * first sample is
- * stored */
- total_mem = 0;
-
- for (i = 0; i < 32; i++)
- sample_ok[i] = 0;
-
- for (i = 0; i < nr_samples; i++)
- {
- int len, loop_start, loop_end, base_freq;
- unsigned short loop_flags = 0;
-
- struct sample_header *sample;
-
- struct patch_info *patch;
-
- sample = (struct sample_header *) &header[48 + (i * 32)];
-
- /*
- * len = sample->length; loop_start = sample->loop_start; loop_end =
- * sample->loop_end; base_freq = sample->C2_speed;
- *
- * if (strlen (sample->name) > 21) { fprintf (stderr, "\nInvalid name for
- * sample #%d\n", i); close (mod_fd); return 0; }
- */
- if (len > 0)
- {
- int x;
-
- if (loop_end > len)
- loop_end = 1;
-
- if (loop_end < loop_start)
- {
- loop_start = 0;
- loop_end = 0;
- }
-
- if (loop_end > 2) loop_flags = WAVE_LOOPING;
-
- total_mem += len;
- patch = (struct patch_info *) malloc (sizeof (*patch) + len);
-
- patch->key = GUS_PATCH;
- patch->device_no = gus_dev;
- patch->instr_no = i;
- patch->mode = loop_flags;
- patch->len = len;
- patch->loop_start = loop_start;
- patch->loop_end = loop_end;
- patch->base_freq = base_freq;
- patch->base_note = 261630; /* Mid C */
- patch->low_note = 0;
- patch->high_note = 0x7fffffff;
- patch->volume = 120;
-
- if (lseek (mod_fd, sample_ptr, 0) == -1)
- {
- perror (name);
- close (mod_fd);
- free (patch);
- return 0;
- }
-
- sample_ptr += len;
-
- if ((x = read (mod_fd, patch->data, len)) != len)
- {
- fprintf (stderr, "Short file (sample at %d (%d!=%d)\n", sample_ptr, x, len);
- close (mod_fd);
- free (patch);
- return 0;
- }
- /*
- * fprintf (stderr, "Sample %02d: %05d, %05d, %05d, %07d %s\n", i,
- * len, loop_start, loop_end, base_freq, sample->name);
- */
- if (write (seqfd, patch, sizeof (*patch) + len) == -1)
- {
- perror ("ioctl /dev/sequencer");
- exit (-1);
- }
- else
- sample_ok[i] = 1;
-
- free (patch);
- }
- }
-
- nr_patterns = slen;
- songlength = slen;
- nr_channels = 4;
-
- for (position = 0; position < npat; position++)
- {
- unsigned char patterns[64][4][4];
- int pat, channel, x;
-
- int pp = 1104 + (position * 1024);
-
- if ((pattern_table[position] = (pattern *) malloc (sizeof (struct note_info) * 64 * nr_channels)) == NULL)
- {
- fprintf (stderr, "Can't allocate memory for a pattern\n");
- return 0;
- }
-
- if (lseek (mod_fd, pp, 0) == -1)
- {
- perror (name);
- close (mod_fd);
- return 0;
- }
-
- if ((x = read (mod_fd, patterns, 1024)) != 1024)
- {
- fprintf (stderr, "Short file (pattern at %d), %d!=%d\n", pp, x, 1024);
- close (mod_fd);
- return 0;
- }
-
- for (pat = 0; pat < 64; pat++)
- {
-
- for (channel = 0; channel < 4; channel++)
- {
- unsigned char *p;
-
- unsigned vol, note, octave, sample, effect, params;
-
- p = &patterns[pat][channel][0];
-
- if (p[0] < 251)
- {
- note = p[0] & 15;
- octave = p[0] / 16;
-
- note = 48 + octave * 12 + note;
-
- sample = p[1] / 8;
- vol = (p[1] & 7) + (p[2] / 2);
- effect = p[2] & 0xF;
- params = p[3];
- }
- else
- {
- note = 0;
- octave = 0;
-
- sample = 0;
- vol = 0;
- effect = CMD_NONOTE;
- params = 0;
- }
-
- (*pattern_table[position])[channel][pat].note = note;
- (*pattern_table[position])[channel][pat].sample = sample;
- (*pattern_table[position])[channel][pat].command = effect;
- (*pattern_table[position])[channel][pat].parm1 = params;
- (*pattern_table[position])[channel][pat].parm2 = 0;
- (*pattern_table[position])[channel][pat].vol = vol;
- }
-
- }
-
- }
-
- close (mod_fd);
- return 1;
-}
-
-int
-load_module (char *name)
-{
-
- struct sample_header
- {
- char name[22];
- unsigned short length; /* In words */
-
- unsigned char finetune;
- unsigned char volume;
-
- unsigned short repeat_point; /* In words */
- unsigned short repeat_length; /* In words */
- };
-
- int i, mod_fd, total_mem;
- int sample_ptr, pattern_loc;
-
- int position;
-
- unsigned char *tune_ptr; /* array 0-127 */
-
- char header[1084];
-
- int nr_samples; /* 16 or 32 samples */
- int slen, npat;
- char mname[23];
-
- ioctl (seqfd, SNDCTL_SEQ_SYNC, 0);
- ioctl (seqfd, SNDCTL_SEQ_RESETSAMPLES, &gus_dev);
-
- clock_rate = 50.0;
-
- for (i = 0; i < MAX_POSITION; i++)
- pattern_len[i] = 64;
-
- for (i = 0; i < MAX_POSITION; i++)
- pattern_tempo[i] = 0;
-
- if ((mod_fd = open (name, O_RDONLY, 0)) == -1)
- {
- perror (name);
- return 0;
- }
-
- if (read (mod_fd, header, sizeof (header)) != sizeof (header))
- {
- fprintf (stderr, "%s: Short file (header)\n", name);
- close (mod_fd);
- return 0;
- }
-
- if (lseek (mod_fd, 0, 0) == -1)
- {
- perror (name);
- close (mod_fd);
- return 0;
- }
-
- if (header[28] == 0x1a)
- return load_stm_module (mod_fd, name);
-
- if (*(unsigned short *) &header[0] == 0x6669)
- return load_669_module (mod_fd, name);
-
- if (!strncmp (header, "MMD0", 4))
- return load_mmd0_module (mod_fd, name);
-
- fprintf (stderr, "Loading .MOD module: %s\n", name);
-
- strncpy (mname, header, 22);
- fprintf (stderr, "\nModule: %s - ", mname);
-
- if (!strncmp (&header[1080], "M.K.", 4) || !strncmp (&header[1080], "FLT8", 4))
- {
- fprintf (stderr, "31 samples\n");
- nr_samples = 31;
- }
- else
- {
- fprintf (stderr, "15 samples\n");
- nr_samples = 15;
- }
-
- if (nr_samples == 31)
- {
- sample_ptr = pattern_loc = 1084;
- slen = header[950];
- tune_ptr = (unsigned char *) &header[952];
- }
- else
- {
- sample_ptr = pattern_loc = 600;
- slen = header[470];
- tune_ptr = (unsigned char *) &header[472];
- }
-
- npat = 0;
- for (i = 0; i < 128; i++)
- {
- tune[i] = tune_ptr[i];
-
- if (tune_ptr[i] > npat)
- npat = tune_ptr[i];
- }
- npat++;
-
- fprintf (stderr, "Song lenght %d, %d patterns.\n", slen, npat);
-
- sample_ptr += (npat * 1024); /* Location where the first sample is stored */
- total_mem = 0;
-
- for (i = 0; i < 32; i++)
- sample_ok[i] = 0;
-
- for (i = 0; i < nr_samples; i++)
- {
- int len, loop_start, loop_end;
- unsigned short loop_flags = 0;
- char pname[22];
-
- struct sample_header *sample;
-
- struct patch_info *patch;
-
- sample = (struct sample_header *) &header[20 + (i * 30)];
-
- len = intelize (sample->length) * 2;
- loop_start = intelize (sample->repeat_point) * 2;
- loop_end = loop_start + (intelize (sample->repeat_length) * 2);
-
- if (loop_start > len)
- loop_start = 0;
- if (loop_end > len)
- loop_end = len;
-
- if (loop_end <= loop_start)
- loop_end = loop_start + 1;
-
- if (loop_end > 2 && loop_end > loop_start)
- loop_flags = WAVE_LOOPING;
-
- strncpy (pname, sample->name, 20);
-
- if (len > 0)
- {
- fprintf (stderr, "Sample %02d: L%05d, S%05d, E%05d V%02d %s\n",
- i,
- len,
- loop_start,
- loop_end,
- sample->volume,
- pname);
-
- total_mem += len;
-
- patch = (struct patch_info *) malloc (sizeof (*patch) + len);
-
- patch->key = GUS_PATCH;
- patch->device_no = gus_dev;
- patch->instr_no = i;
- patch->mode = loop_flags;
- patch->len = len;
- patch->loop_start = loop_start;
- patch->loop_end = loop_end;
- patch->base_note = 261630; /* Middle C */
- patch->base_freq = 8448;
- patch->low_note = 0;
- patch->high_note = 20000000;
- patch->volume = 120;
- patch->panning = 0;
-
- if (lseek (mod_fd, sample_ptr, 0) == -1)
- {
- perror (name);
- close (mod_fd);
- free (patch);
- return 0;
- }
-
- sample_ptr += len;
-
- if (read (mod_fd, patch->data, len) != len)
- {
- fprintf (stderr, "Short file (sample) %d\n", sample_ptr);
- close (mod_fd);
- free (patch);
- return 0;
- }
-
- SEQ_WRPATCH (patch, sizeof (*patch) + len);
-
- sample_ok[i] = 1;
- if (sample->volume == 0) sample->volume = 64;
- sample_vol[i] = sample->volume;
-
- free (patch);
- }
- }
-
- nr_patterns = npat;
- songlength = slen;
- nr_channels = 4;
-
- for (position = 0; position < npat; position++)
- {
- unsigned char patterns[64][4][4];
- int pat, channel;
-
- int pp = pattern_loc + (position * 1024);
-
- if (lseek (mod_fd, pp, 0) == -1)
- {
- perror (name);
- close (mod_fd);
- return 0;
- }
-
- if (read (mod_fd, patterns, 1024) != 1024)
- {
- fprintf (stderr, "Short file (pattern %d) %d\n", tune[position], pp);
- close (mod_fd);
- return 0;
- }
-
- if ((pattern_table[position] = (pattern *) malloc (sizeof (struct note_info) * 64 * nr_channels)) == NULL)
- {
- fprintf (stderr, "Can't allocate memory for a pattern\n");
- return 0;
- }
-
- for (pat = 0; pat < 64; pat++)
- {
- for (channel = 0; channel < 4; channel++)
- {
- unsigned short tmp;
- unsigned char *p;
-
- unsigned period, sample, effect, params, note, vol;
-
- p = &patterns[pat][channel][0];
-
- tmp = (p[0] << 8) | p[1];
- sample = (tmp >> 8) & 0x10;
- period =
- MIN (tmp & 0xFFF, 1023);
- tmp = (p[2] << 8) | p[3];
- sample |= tmp >> 12;
- effect = (tmp >> 8) & 0xF;
- params = tmp & 0xFF;
-
- note = 0;
-
- if (period)
- {
- /*
- * Convert period to a Midi note number
- */
-
- for (note = 0; note < 37 && period != period_table[note]; note++);
- if (note >= 37)
- note = 0;
-
- note += 48;
- }
-
- vol = 64;
-
- if (sample)
- if (effect == 0xc)
- {
- vol = params;
- }
- else
- vol = sample_vol[sample - 1];
-
- vol *= 2;
- if (vol>64)vol--;
-
- (*pattern_table[position])[channel][pat].note = note;
- (*pattern_table[position])[channel][pat].sample = sample;
- (*pattern_table[position])[channel][pat].command = effect;
- (*pattern_table[position])[channel][pat].parm1 = params;
- (*pattern_table[position])[channel][pat].parm2 = 0;
- (*pattern_table[position])[channel][pat].vol = vol;
- }
- }
- }
-
- close (mod_fd);
- return 1;
-}
-
-int
-panning (int ch)
-{
- static int panning_tab[] =
- {-110, 110, 110, -110};
-
- return panning_tab[ch % 4];
-}
-
-void
-set_speed (int parm)
-{
- if (!parm)
- parm = 1;
-
- if (parm < 32)
- {
- ticks_per_division = parm;
- }
- else
- {
- tick_duration = (60.0 / parm) * 10.0;
- }
-
-}
-
-void
-play_module (char *name)
-{
- int i, position, jump_to_pos;
-
- init_voices ();
-
- SEQ_START_TIMER ();
-#if 1
- for (i=0;i<32;i++)
- {
- SEQ_EXPRESSION(gus_dev, i, 127);
- SEQ_MAIN_VOLUME(gus_dev, i, 100);
- }
-#endif
- next_time = 0.0;
-
- set_speed (6);
-
- for (position = 0; position < songlength; position++)
- {
- int tick, pattern, channel, pos, go_to;
-
- pos = tune[position];
- if (pattern_tempo[position])
- set_speed (pattern_tempo[position]);
-
- jump_to_pos = -1;
- for (pattern = 0; pattern < pattern_len[position] && jump_to_pos == -1; pattern++)
- {
- this_time = 0.0;
-
- for (channel = 0; channel < nr_channels; channel++)
- {
- if ((go_to = play_note (channel, &(*pattern_table[pos])[channel][pattern])) != -1)
- jump_to_pos = go_to;
-
- }
-
- next_time += tick_duration;
-
- for (tick = 1; tick < ticks_per_division; tick++)
- {
- for (channel = 0; channel < nr_channels; channel++)
- lets_play_voice (channel, &voices[channel]);
- next_time += tick_duration;
- }
-
- }
-
- if (jump_to_pos >= 0)
- position = jump_to_pos;
- }
-
- SEQ_WAIT_TIME ((int) next_time + 200); /* Wait extra 2 secs */
-
- for (i = 0; i < nr_channels; i++)
- SEQ_STOP_NOTE (gus_dev, i, 0, 127);
- SEQ_DUMPBUF ();
-
- for (i = 0; i < nr_patterns; i++)
- free (pattern_table[i]);
-}
-
-void
-sync_time ()
-{
- if (next_time > this_time)
- {
- SEQ_WAIT_TIME ((long) next_time);
- this_time = next_time;
- }
-}
-
-void
-set_volslide (int channel, struct note_info *pat)
-{
- int n;
-
- voices[channel].volslide = 0;
-
- if ((n = (pat->parm1 & 0xf0) >> 4))
- voices[channel].volslide = n;
- else
- voices[channel].volslide = pat->parm1 & 0xf;
-}
-
-void
-set_slideto (int channel, struct note_info *pat)
-{
- int size, rate, dir, range = 200;
-
- rate = pat->parm1;
- size = voices[channel].note - pat->note;
- if (!size)
- return;
-
- if (size < 0)
- {
- size *= -1;
- dir = -1;
- }
- else
- dir = 1;
-
- if (size > 2)
- {
- range = size * 100;
- rate = rate * size / 200;
- }
-
- rate = pat->parm1 * dir / 30;
- if (!rate)
- rate = 1;
-
- voices[channel].slide_pitch = 1;
- voices[channel].slide_goal = (dir * 8192 * 200 * 2 / size) / range;
- voices[channel].pitchbender = 0;
- voices[channel].slide_rate = rate;
- SEQ_BENDER_RANGE (gus_dev, channel, range);
-}
-
-int
-play_note (int channel, struct note_info *pat)
-{
- int jump = -1;
- int sample;
-
- if (pat->sample == 0x3f)
- pat->sample = 0;
-
- if (pat->command == CMD_NONOTE)
- return -1; /* Undefined */
-
- sample = pat->sample;
-
- if (sample && !pat->note)
- {
- pat->note = voices[channel].note;
- }
-
- if (sample)
- voices[channel].sample = sample;
- else
- sample = voices[channel].sample;
-
- sample--;
-
- if (pat->note && pat->command != 3) /* Have a note -> play */
- {
- if (sample < 0)
- sample = voices[channel].sample - 1;
-
- if (!sample_ok[sample])
- sample = voices[channel].sample - 1;
-
- if (sample < 0)
- sample = 0;
-
- if (sample_ok[sample])
- {
- sync_time ();
-
- if (pat->vol > 127) pat->vol=127;
- SEQ_SET_PATCH (gus_dev, channel, sample);
- SEQ_PANNING (gus_dev, channel, panning (channel));
- SEQ_PITCHBEND (gus_dev, channel, 0);
- SEQ_START_NOTE (gus_dev, channel, pat->note, pat->vol);
-
- voices[channel].volume = pat->vol;
- voices[channel].note = pat->note;
- voices[channel].slide_pitch = 0;
- }
- else
- SEQ_STOP_NOTE (gus_dev, channel, pat->note, pat->vol);
- }
-
- switch (pat->command)
- {
-
- case CMD_NOP:;
- break;
-
- case CMD_JUMP:
- jump = pat->parm1;
- break;
-
- case CMD_BREAK:
- jump = -2;
- break;
-
- case CMD_SPEED:
- set_speed (pat->parm1);
- break;
-
- case CMD_SLIDEUP:
- voices[channel].slide_pitch = 1;
- voices[channel].slide_goal = 8191;
- voices[channel].pitchbender = 0;
- voices[channel].slide_rate = pat->parm1 * SLIDE_SIZE;
- SEQ_BENDER_RANGE (gus_dev, channel, 200);
- break;
-
- case CMD_SLIDEDOWN:
- voices[channel].slide_pitch = 1;
- voices[channel].slide_goal = -8192;
- voices[channel].pitchbender = 0;
- voices[channel].slide_rate = -pat->parm1 * SLIDE_SIZE;
- SEQ_BENDER_RANGE (gus_dev, channel, 200);
- break;
-
- case CMD_SLIDETO:
- set_slideto (channel, pat);
- break;
-
- case CMD_VOLUME:
- {
- int vol = pat->parm1*2;
- if (vol>127) vol=127;
- if (pat->note && pat->command != 3)
- break;
- SEQ_START_NOTE (gus_dev, channel, 255, vol);
- }
- break;
-
- case CMD_ARPEG:
- break;
-
- case 0x0e:
- /* printf ("Cmd 0xE%02x\n", pat->parm1); */
- break;
-
- case CMD_VOLSLIDE:
- set_slideto (channel, pat);
- break;
-
- default:
- /* printf ("Command %x %02x\n", pat->command, pat->parm1); */
- }
-
- return jump;
-}
-
-void
-lets_play_voice (int channel, struct voice_info *v)
-{
- if (v->slide_pitch)
- {
- v->pitchbender += v->slide_rate;
- if (v->slide_goal < 0)
- {
- if (v->pitchbender <= v->slide_goal)
- {
- v->pitchbender = v->slide_goal;
- v->slide_pitch = 0; /* Stop */
- }
- }
- else
- {
- if (v->pitchbender >= v->slide_goal)
- {
- v->pitchbender = v->slide_goal;
- v->slide_pitch = 0; /* Stop */
- }
- }
-
- sync_time ();
- SEQ_PITCHBEND (gus_dev, channel, v->pitchbender);
- }
-
- if (v->volslide)
- {
- v->volume += v->volslide;
- sync_time ();
-
- if (v->volume > 127) v->volume = 127;
- SEQ_START_NOTE (gus_dev, channel, 255, v->volume);
- }
-}
diff --git a/sys/i386/isa/sound/gustest/gpatinfo.c b/sys/i386/isa/sound/gustest/gpatinfo.c
deleted file mode 100644
index 17dcb12..0000000
--- a/sys/i386/isa/sound/gustest/gpatinfo.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * gpatinfo.c: This program demonstrates the patch management
- * interface of the GUS driver.
- *
- * NOTE! The patch manager interface is highly device dependent,
- * currently incompletely implemented prototype and
- * will change before final implementation.
- *
- * $Id$
- */
-
-#include <stdio.h>
-#include <machine/ultrasound.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include "gmidi.h"
-
-#define GUS_DEV gus_dev
-
-#define patch_access(cmd, rec) \
- rec.command = cmd;\
- rec.device = gus_dev;\
- if (ioctl(seqfd, SNDCTL_PMGR_IFACE, &rec)==-1)\
- {\
- perror("/dev/sequencer(SNDCTL_PMGR_IFACE/" #cmd ")");\
- exit(-1);\
- }
-
-SEQ_DEFINEBUF (2048);
-
-int seqfd;
-
-int gus_dev = -1;
-
-/*
- * The function seqbuf_dump() must always be provided
- */
-
-void
-seqbuf_dump ()
-{
- if (_seqbufptr)
- if (write (seqfd, _seqbuf, _seqbufptr) == -1)
- {
- perror ("write /dev/sequencer");
- exit (-1);
- }
- _seqbufptr = 0;
-}
-
-int
-main (int argc, char *argv[])
-{
- int i, j, n;
- struct synth_info info;
- struct patch_info *patch;
- struct patmgr_info mgr, mgr2, mgr3;
-
- if ((seqfd = open ("/dev/sequencer", O_WRONLY, 0)) == -1)
- {
- perror ("/dev/sequencer");
- exit (-1);
- }
-
- if (ioctl (seqfd, SNDCTL_SEQ_NRSYNTHS, &n) == -1)
- {
- perror ("/dev/sequencer");
- exit (-1);
- }
-
-/*
- * First locate the GUS device
- */
-
- for (i = 0; i < n; i++)
- {
- info.device = i;
-
- if (ioctl (seqfd, SNDCTL_SYNTH_INFO, &info) == -1)
- {
- perror ("/dev/sequencer");
- exit (-1);
- }
-
- if (info.synth_type == SYNTH_TYPE_SAMPLE
- && info.synth_subtype == SAMPLE_TYPE_GUS)
- gus_dev = i;
- }
-
- if (gus_dev == -1)
- {
- fprintf (stderr, "Error: Gravis Ultrasound not detected\n");
- exit (-1);
- }
-
- printf("Gravis UltraSound device = %d\n", gus_dev);
-
- /*
- * Get type of the Patch Manager interface of the GUS device
- */
-
- patch_access(PM_GET_DEVTYPE, mgr);
- printf("Patch manager type: %d\n", mgr.parm1);
-
- if (mgr.parm1 != PMTYPE_WAVE)
- {
- fprintf(stderr, "Hups, this program seems to be obsolete\n");
- exit(-1);
- }
-
- /*
- * The GUS driver supports up to 256 different midi program numbers but
- * this limit can be changed before compiling the driver. The following
- * call returns the value compiled to the driver.
- */
-
- patch_access(PM_GET_PGMMAP, mgr);
- printf("Device supports %d midi programs.\n", mgr.parm1);
-
- /*
- * Each program can be undefined or it may have one or more patches.
- * A patch consists of header and the waveform data. If there is more
- * than one patch in a program, the right one is selected by checking the
- * note number when the program is played.
- *
- * The following call reads an array indexed by program number. Each
- * element defines the number of patches defined for the corresponding
- * program.
- */
- printf("Loaded programs:\n");
-
- for (i=0;i<mgr.parm1;i++)
- if (mgr.data.data8[i])
- {
- printf("%03d: %2d patches\n", i, mgr.data.data8[i]);
-
- /*
- * Next get the magic keys of the patches associated with this program.
- * This key can be used to access the patc data.
- */
- mgr2.parm1=i;
- patch_access(PM_GET_PGM_PATCHES, mgr2);
- for (j = 0;j<mgr2.parm1;j++)
- {
- printf("\tPatch %d: %3d ", j, mgr2.data.data32[j]);
-
- /*
- * The last step is to read the patch header (without wave data).
- * The header is returned in the mgr3.data. The field parm1 returns
- * address of the wave data in tge GUS DRAM. Parm2 returns
- * size of the struct patch_info in the kernel.
- *
- * There is also the PM_SET_PATCH call which allows modification of the
- * header data. The only limitation is that the sample len cannot be
- * increased.
- */
- mgr3.parm1 = mgr2.data.data32[j];
- patch_access(PM_GET_PATCH, mgr3);
- patch = (struct patch_info *)&mgr3.data; /* Pointer to the patch hdr */
-
- printf("DRAM ptr = %7d, sample len =%6d bytes.\n",
- mgr3.parm1, patch->len);
-
- }
- }
-
- i = gus_dev;
-
- if (ioctl(seqfd, SNDCTL_SYNTH_MEMAVL, &i)==-1) exit(-1);
- printf("%d bytes of DRAM available for wave data\n", i);
-
-
- exit(0);
-}
diff --git a/sys/i386/isa/sound/gustest/gusload.c b/sys/i386/isa/sound/gustest/gusload.c
deleted file mode 100644
index 1ed9a3b..0000000
--- a/sys/i386/isa/sound/gustest/gusload.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * $Id$
- */
-/*
- * patutil.c - A sample program which loads patches to the Gravis
- * Ultrasound
- *
- */
-
-#ifndef PATCH_PATH
-#define PATCH_PATH "/D/ultrasnd/midi"
-#endif
-
-#include <stdio.h>
-#include <machine/ultrasound.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include "gmidi.h"
-
-struct pat_header
- {
- char magic[12];
- char version[10];
- char description[60];
- unsigned char instruments;
- char voices;
- char channels;
- unsigned short nr_waveforms;
- unsigned short master_volume;
- unsigned long data_size;
- };
-
-struct sample_header
- {
- char name[7];
- unsigned char fractions;
- long len;
- long loop_start;
- long loop_end;
- unsigned short base_freq;
- long low_note;
- long high_note;
- long base_note;
- short detune;
- unsigned char panning;
-
- unsigned char envelope_rate[6];
- unsigned char envelope_offset[6];
-
- unsigned char tremolo_sweep;
- unsigned char tremolo_rate;
- unsigned char tremolo_depth;
-
- unsigned char vibrato_sweep;
- unsigned char vibrato_rate;
- unsigned char vibrato_depth;
-
- char modes;
-
- short scale_frequency;
- unsigned short scale_factor;
- };
-
-#define GUS_DEV gus_dev
-
-SEQ_DEFINEBUF (2048);
-
-int seqfd;
-
-int gus_dev = -1;
-
-struct patch_info *patch;
-
-/*
- * The function seqbuf_dump() must always be provided
- */
-
-void
-seqbuf_dump ()
-{
- if (_seqbufptr)
- if (write (seqfd, _seqbuf, _seqbufptr) == -1)
- {
- perror ("write /dev/sequencer");
- exit (-1);
- }
- _seqbufptr = 0;
-}
-
-int
-main (int argc, char *argv[])
-{
- int i, n, patfd, pgm, print_only = 0;
- struct synth_info info;
- struct pat_header header;
- struct sample_header sample;
- char buf[256];
- char name[256];
- long offset;
-
- if ((seqfd = open ("/dev/sequencer", O_WRONLY, 0)) == -1)
- {
- perror ("/dev/sequencer");
- exit (-1);
- }
-
- if (ioctl (seqfd, SNDCTL_SEQ_NRSYNTHS, &n) == -1)
- {
- perror ("/dev/sequencer");
- exit (-1);
- }
-
-
- for (i = 0; i < n; i++)
- {
- info.device = i;
-
- if (ioctl (seqfd, SNDCTL_SYNTH_INFO, &info) == -1)
- {
- perror ("/dev/sequencer");
- exit (-1);
- }
-
- if (info.synth_type == SYNTH_TYPE_SAMPLE
- && info.synth_subtype == SAMPLE_TYPE_GUS)
- gus_dev = i;
- }
-
- if (gus_dev == -1)
- {
- fprintf (stderr, "Error: Gravis Ultrasound not detected\n");
- exit (-1);
- }
-
- if (argc == 2)
- {
- if (!strcmp (argv[1], "reset"))
- if (ioctl (seqfd, SNDCTL_SEQ_RESETSAMPLES, &gus_dev) == -1)
- perror ("Sample reset");
- exit (0);
- }
-
- if (argc != 3)
- {
- fprintf (stderr, "Usage: %s pgm# patchfile\n", argv[0]);
- fprintf (stderr, " or : %s pgm# GM\n", argv[0]);
- fprintf (stderr, " or : %s pgm# -l\n", argv[0]);
- fprintf (stderr, " or : %s reset\n", argv[0]);
- fprintf (stderr, " or : %s -l patchfile\n", argv[0]);
- exit (-1);
- }
-
- pgm = atoi (argv[1]);
- strcpy (name, argv[2]);
-
- if (strcmp (name, "GM") == 0 || strcmp(name, "-l")==0)
- {
- if (strcmp (name, "-l") == 0) print_only = 1;
- if (pgm < 0 || pgm > 127)
- {
- fprintf (stderr, "pgm# must be between 0 and 127\n");
- exit (-1);
- }
-
- sprintf (name, PATCH_PATH "/%s.pat", patch_names[pgm]);
-
- if (!print_only)
- fprintf (stderr, "Loading program %d from %s\n", pgm, name);
- }
- else if (strcmp (argv[1], "-l") == 0)
- print_only = 1;
-
- if ((patfd = open (name, O_RDONLY, 0)) == -1)
- {
- perror (name);
- exit (-1);
- }
-
- if (read (patfd, buf, 0xef) != 0xef)
- {
- fprintf (stderr, "%s: Short file\n", name);
- exit (-1);
- }
-
- memcpy ((char *) &header, buf, sizeof (header));
-
- if (strncmp (header.magic, "GF1PATCH110", 12))
- {
- fprintf (stderr, "%s: Not a patch file\n", name);
- exit (-1);
- }
-
- if (strncmp (header.version, "ID#000002", 10))
- {
- fprintf (stderr, "%s: Incompatible patch file version\n", name);
- exit (-1);
- }
-
- header.nr_waveforms = *(unsigned short *) &buf[85];
- header.master_volume = *(unsigned short *) &buf[87];
-
- if (print_only)
- {
- printf ("Patch file: %s contains %d samples\n\n", name, header.nr_waveforms);
- printf ("Master volume: %d\n", header.master_volume);
- }
-
- offset = 0xef;
-
- for (i = 0; i < header.nr_waveforms; i++)
- {
- if (lseek (patfd, offset, 0) == -1)
- {
- perror (name);
- exit (-1);
- }
-
- if (read (patfd, &buf, sizeof (sample)) != sizeof (sample))
- {
- fprintf (stderr, "%s: Short file\n", name);
- exit (-1);
- }
-
- memcpy ((char *) &sample, buf, sizeof (sample));
-
- /*
- * Since some fields of the patch record are not 32bit aligned, we must
- * handle them specially.
- */
- sample.low_note = *(long *) &buf[22];
- sample.high_note = *(long *) &buf[26];
- sample.base_note = *(long *) &buf[30];
- sample.detune = *(short *) &buf[34];
- sample.panning = (unsigned char) buf[36];
-
- memcpy (sample.envelope_rate, &buf[37], 6);
- memcpy (sample.envelope_offset, &buf[43], 6);
-
- sample.tremolo_sweep = (unsigned char) buf[49];
- sample.tremolo_rate = (unsigned char) buf[50];
- sample.tremolo_depth = (unsigned char) buf[51];
-
- sample.vibrato_sweep = (unsigned char) buf[52];
- sample.vibrato_rate = (unsigned char) buf[53];
- sample.vibrato_depth = (unsigned char) buf[54];
- sample.modes = (unsigned char) buf[55];
- sample.scale_frequency = *(short *) &buf[56];
- sample.scale_factor = *(unsigned short *) &buf[58];
-
- if (print_only)
- {
- printf("\nSample: %03d / %s\n", i, sample.name);
- printf ("Len: %d, Loop start: %d, Loop end: %d\n", sample.len, sample.loop_start, sample.loop_end);
- printf ("Flags: ");
- if (sample.modes & WAVE_16_BITS)
- printf ("16 bit ");
- if (sample.modes & WAVE_UNSIGNED)
- printf ("unsigned ");
- if (sample.modes & WAVE_LOOP_BACK)
- printf("reverse ");
- if (sample.modes & WAVE_BIDIR_LOOP)
- printf("bidir ");
- if (sample.modes & WAVE_LOOPING)
- printf ("looping "); else printf("one_shot" );
- if (sample.modes & WAVE_SUSTAIN_ON)
- printf ("sustain ");
- if (sample.modes & WAVE_ENVELOPES)
- printf ("enveloped ");
- printf ("\n");
-
- if (sample.modes & WAVE_ENVELOPES)
- {
- int i;
-
- printf ("Envelope info: ");
- for (i = 0; i < 6; i++)
- {
- printf ("%d/%d ", sample.envelope_rate[i],
- sample.envelope_offset[i]);
- }
- printf ("\n");
- }
-
- printf("Tremolo: sweep=%d, rate=%d, depth=%d\n",
- sample.tremolo_sweep,
- sample.tremolo_rate,
- sample.tremolo_depth);
-
- printf("Vibrato: sweep=%d, rate=%d, depth=%d\n",
- sample.vibrato_sweep,
- sample.vibrato_rate,
- sample.vibrato_depth);
- }
-
- offset = offset + 96;
- patch = (struct patch_info *) malloc (sizeof (*patch) + sample.len);
-
- patch->key = GUS_PATCH;
- patch->device_no = GUS_DEV;
- patch->instr_no = pgm;
- patch->mode = sample.modes | WAVE_TREMOLO |
- WAVE_VIBRATO | WAVE_SCALE;
- patch->len = sample.len;
- patch->loop_start = sample.loop_start;
- patch->loop_end = sample.loop_end;
- patch->base_note = sample.base_note;
- patch->high_note = sample.high_note;
- patch->low_note = sample.low_note;
- patch->base_freq = sample.base_freq;
- patch->detuning = sample.detune;
- patch->panning = (sample.panning - 7) * 16;
-
- memcpy (patch->env_rate, sample.envelope_rate, 6);
- memcpy (patch->env_offset, sample.envelope_offset, 6);
-
- patch->tremolo_sweep = sample.tremolo_sweep;
- patch->tremolo_rate = sample.tremolo_rate;
- patch->tremolo_depth = sample.tremolo_depth;
-
- patch->vibrato_sweep = sample.vibrato_sweep;
- patch->vibrato_rate = sample.vibrato_rate;
- patch->vibrato_depth = sample.vibrato_depth;
-
- patch->scale_frequency = sample.scale_frequency;
- patch->scale_factor = sample.scale_factor;
-
- patch->volume = header.master_volume;
-
- if (lseek (patfd, offset, 0) == -1)
- {
- perror (name);
- exit (-1);
- }
-
- if (!print_only)
- {
- if (read (patfd, patch->data, sample.len) != sample.len)
- {
- fprintf (stderr, "%s: Short file\n", name);
- exit (-1);
- }
-
- SEQ_WRPATCH (patch, sizeof (*patch) + sample.len);
- }
-
- offset = offset + sample.len;
- }
-
- exit (0);
-}
diff --git a/sys/i386/isa/sound/gustest/midithru.c b/sys/i386/isa/sound/gustest/midithru.c
deleted file mode 100644
index c4fab7f..0000000
--- a/sys/i386/isa/sound/gustest/midithru.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * $Id$
- */
-#include <stdio.h>
-#include <machine/soundcard.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <sys/errno.h>
-
-SEQ_DEFINEBUF (2048);
-SEQ_PM_DEFINES;
-
-int seqfd, dev = 0;
-unsigned char buf[100];
-int bufp;
-
-/* LRU list for free operators */
-
-unsigned char free_list[256];
-int fhead=0, ftail=0, flen=0;
-
-/* LRU list for still playing notes */
-
-unsigned char note_list[256];
-int nhead=0, ntail=0, nlen=0;
-unsigned char oper_note[32];
-
-int pgm = 0;
-int num_voices;
-int bender = 0; /* Initially off */
-
-void
-seqbuf_dump ()
-{
- if (_seqbufptr)
- if (write (seqfd, _seqbuf, _seqbufptr) == -1)
- {
- perror ("write /dev/sequencer");
- exit (-1);
- }
- _seqbufptr = 0;
-}
-
-void
-stop_note(int note, int velocity)
-{
- int i, op;
-
- op=255;
-
- for (i=0;i<num_voices && op==255;i++)
- {
- if (oper_note[i]== note) op=i;
- }
-
- if (op==255)
- {
- fprintf(stderr, "Note %d off, note not started\n", note);
- fprintf(stderr, "%d, %d\n", flen, nlen);
- return; /* Has already been killed ??? */
- }
-
- SEQ_STOP_NOTE(dev, op, note, velocity);
- SEQ_DUMPBUF();
-
- oper_note[op] = 255;
-
- free_list[ftail]=op;
- flen++;
- ftail = (ftail+1) % num_voices;
-
- for (i=0;i<16;i++)
- if (note_list[i] == op) note_list[i] = 255;
-
- while (nlen && note_list[nhead] == 255)
- {
- nlen--;
- /* printf("Remove from note queue %d, len %d\n", nhead, nlen); */
- nhead = (nhead+1) % 256;
- }
-}
-
-void
-kill_one_note()
-{
- int oldest;
-
- if (!nlen) {fprintf(stderr, "Free list empty but no notes playing\n");return;} /* No notes playing */
-
- oldest = note_list[nhead];
- nlen--;
- nhead = (nhead+1) % 256;
-
- fprintf(stderr, "Killing oper %d, note %d\n", oldest, oper_note[oldest]);
-
- if (oldest== 255) return; /* Was already stopped. Why? */
-
- stop_note(oper_note[oldest], 127);
-}
-
-void
-start_note(int note, int velocity)
-{
- int free;
-
- if (!flen) kill_one_note();
-
- if (!flen) {printf("** no free voices\n");return;} /* Panic??? */
-
- free = free_list[fhead];
- flen--;
- fhead = (fhead+1) % num_voices;
-
- note_list[ntail] = free;
-
- if (nlen>255)
- {
-#if 0
- fprintf(stderr, "Note list overflow %d, %d, %d\n",
- nlen, nhead, ntail);
-#endif
- nlen=0; /* Overflow -> hard reset */
- }
- nlen++;
- ntail = (ntail+1) % 256;
-
- oper_note[free] = note;
-
- SEQ_SET_PATCH(dev, free, pgm);
- SEQ_PITCHBEND(dev, free, bender);
- SEQ_START_NOTE(dev, free, note, velocity);
- SEQ_DUMPBUF();
-}
-
-void
-channel_pressure(int ch, int pressure)
-{
- int i;
-
- for (i=0;i<num_voices;i++)
- {
- if (oper_note[i] != 255)
- {
-#if 1
- SEQ_CHN_PRESSURE(dev, i, pressure);
-#else
- SEQ_EXPRESSION(dev, i, pressure);
-#endif
- SEQ_DUMPBUF();
- }
- }
-}
-
-void
-pitch_bender(int ch, int value)
-{
- int i;
-
- value -= 8192;
-
- bender = value;
-
- for (i=0;i<num_voices;i++)
- {
- if (oper_note[i] != 255)
- {
- bender = value;
- SEQ_PITCHBEND(dev, i, value);
- SEQ_DUMPBUF();
- }
- }
-}
-
-void
-do_buf()
-{
- int ch = buf[0] & 0x0f;
- int value;
-
- switch (buf[0] & 0xf0)
- {
- case 0x90: /* Note on */
- if (bufp < 3) break;
- /* printf("Note on %d %d %d\n", ch, buf[1], buf[2]); */
- if (buf[2])
- start_note(buf[1], buf[2]);
- else
- stop_note(buf[1], buf[2]);
- bufp=1;
- break;
-
- case 0xb0: /* Control change */
- if (bufp < 3) break;
- /* printf("Control change %d %d %d\n", ch, buf[1], buf[2]); */
- bufp=1;
- break;
-
- case 0x80: /* Note off */
- if (bufp < 3) break;
- /* printf("Note off %d %d %d\n", ch, buf[1], buf[2]); */
- stop_note(buf[1], buf[2]);
- bufp=1;
- break;
-
- case 0xe0: /* Pitch bender */
- if (bufp < 3) break;
- value = ((buf[2] & 0x7f) << 7) | (buf[1] & 0x7f);
- /* printf("Pitch bender %d %d\n", ch, value >> 7); */
- pitch_bender(ch, value);
- bufp=1;
- break;
-
- case 0xc0: /* Pgm change */
- if (bufp < 2) break;
- /* printf("Pgm change %d %d\n", ch, buf[1]); */
- pgm = buf[1];
- if (PM_LOAD_PATCH(dev, 0, pgm) < 0)
- if (errno != ESRCH) /* No such process */
- perror("PM_LOAD_PATCH");
- bufp=0;
- break;
-
- case 0xd0: /* Channel pressure */
- if (bufp < 2) break;
- /* printf("Channel pressure %d %d\n", ch, buf[1]); */
- channel_pressure(ch, buf[1]);
- bufp=1;
- break;
-
- default:
- bufp=0;
- }
-}
-
-int
-main (int argc, char *argv[])
-{
- int i, n, max_voice = 999;
-
- struct synth_info info;
-
- unsigned char ev[4], *p;
-
- if (argc >= 2) dev = atoi(argv[1]);
-
- for (i=0;i<16;i++) oper_note[i] = 255;
-
- if ((seqfd = open ("/dev/sequencer", O_RDWR, 0)) == -1)
- {
- perror ("open /dev/sequencer");
- exit (-1);
- }
-
- if (argc >= 3)
- {
- int d = dev;
- ioctl(seqfd, SNDCTL_FM_4OP_ENABLE, &d);
- }
-
- info.device = dev;
-
- if (ioctl(seqfd, SNDCTL_SYNTH_INFO, &info)==-1)
- {
- perror ("info /dev/sequencer");
- exit (-1);
- }
-
- num_voices = info.nr_voices;
- if (num_voices>max_voice)num_voices = max_voice;
- fprintf(stderr, "Output to synth device %d (%s)\n", dev, info.name);
- fprintf(stderr, "%d voices available\n", num_voices);
-
- for (i=0;i<num_voices;i++)
- {
- flen++;
- free_list[fhead] = i;
- fhead = (fhead+1) % num_voices;
- }
-
- bufp = 0;
- if (PM_LOAD_PATCH(dev, 0, 0) < 0) /* Load the default instrument */
- if (errno != ESRCH) /* No such process */
- perror("PM_LOAD_PATCH");
-
- while (1)
- {
- if ((n = read (seqfd, ev, sizeof (ev))) == -1)
- {
- perror ("read /dev/sequencer");
- exit (-1);
- }
-
- for (i = 0; i <= (n / 4); i++)
- {
- p = &ev[i * 4];
-
- if (p[0] == SEQ_MIDIPUTC && p[2] == 0 /* Midi if# == 0 */)
- {
-/* printf("%02x ", p[1]);fflush(stdout); */
- if (p[1] & 0x80) /* Status */
- {
- if (bufp)
- do_buf ();
- buf[0] = p[1];
- bufp = 1;
- }
- else if (bufp)
- {
- buf[bufp++] = p[1];
- if ((buf[0] & 0xf0) == 0x90 || (buf[0] & 0xf0) == 0x80 || (buf[0] & 0xf0) == 0xb0 ||
- (buf[0] & 0xf0) == 0xe0)
- {
- if (bufp == 3)
- do_buf ();
- }
- else
- if ((buf[0] & 0xf0) == 0xc0 || (buf[0] & 0xf0) == 0xd0)
- {
- if (bufp == 2) do_buf();
- }
- }
- }
- }
- }
-
- exit (0);
-}
diff --git a/sys/i386/isa/sound/gustest/pmtest.c b/sys/i386/isa/sound/gustest/pmtest.c
deleted file mode 100644
index 0520545..0000000
--- a/sys/i386/isa/sound/gustest/pmtest.c
+++ /dev/null
@@ -1,412 +0,0 @@
-/*
- * $Id$
- */
-/*
- * CAUTION! This program is just an incompletely implemented version
- * of the patch manager daemon for GUS. Using this program
- * with the driver version 1.99.9 will hang your system
- * completely (sooner or later).
- *
- * This program is for information only. The final
- * implementation of the patch manager will not be
- * compatible with this one.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <machine/ultrasound.h>
-#include <strings.h>
-#include <sys/errno.h>
-#include "gmidi.h"
-
-#ifndef PATCH_PATH
-#define PATCH_PATH "/D/ultrasnd/midi"
-#endif
-
-char loadmap[256] =
-{0}; /* 1 if the patch is already loaded */
-
-struct pat_header
- {
- char magic[12];
- char version[10];
- char description[60];
- unsigned char instruments;
- char voices;
- char channels;
- unsigned short nr_waveforms;
- unsigned short master_volume;
- unsigned long data_size;
- };
-
-struct sample_header
- {
- char name[7];
- unsigned char fractions;
- long len;
- long loop_start;
- long loop_end;
- unsigned short base_freq;
- long low_note;
- long high_note;
- long base_note;
- short detune;
- unsigned char panning;
-
- unsigned char envelope_rate[6];
- unsigned char envelope_offset[6];
-
- unsigned char tremolo_sweep;
- unsigned char tremolo_rate;
- unsigned char tremolo_depth;
-
- unsigned char vibrato_sweep;
- unsigned char vibrato_rate;
- unsigned char vibrato_depth;
-
- char modes;
-
- short scale_frequency;
- unsigned short scale_factor;
- };
-int seqfd = 0, gus_dev = -1;
-
-struct patch_info *patch;
-
-int
-do_load_patch (struct patmgr_info *rec)
-{
- int i, patfd, pgm, print_only = 0;
- struct pat_header header;
- struct sample_header sample;
- char buf[256];
- char name[256];
- long offset;
-
- pgm = rec->data.data8[0];
-
- if (loadmap[pgm])
- return 0; /* Already loaded */
-
- sprintf (name, PATCH_PATH "/%s.pat", patch_names[pgm]);
-
- if ((patfd = open (name, O_RDONLY, 0)) == -1)
- {
- perror (name);
- return errno;
- }
-
- if (read (patfd, buf, 0xef) != 0xef)
- {
- fprintf (stderr, "%s: Short file\n", name);
- return EIO;
- }
-
- memcpy ((char *) &header, buf, sizeof (header));
-
- if (strncmp (header.magic, "GF1PATCH110", 12))
- {
- fprintf (stderr, "%s: Not a patch file\n", name);
- return EINVAL;
- }
-
- if (strncmp (header.version, "ID#000002", 10))
- {
- fprintf (stderr, "%s: Incompatible patch file version\n", name);
- return EINVAL;
- }
-
- header.nr_waveforms = *(unsigned short *) &buf[85];
- header.master_volume = *(unsigned short *) &buf[87];
-
- printf ("GUS: Loading: %s\n", name);
-
- offset = 0xef;
-
- for (i = 0; i < header.nr_waveforms; i++)
- {
- if (lseek (patfd, offset, 0) == -1)
- {
- perror (name);
- return errno;
- }
-
- if (read (patfd, &buf, sizeof (sample)) != sizeof (sample))
- {
- fprintf (stderr, "%s: Short file\n", name);
- return EIO;
- }
-
- memcpy ((char *) &sample, buf, sizeof (sample));
-
- /*
- * Since some fields of the patch record are not 32bit aligned, we must
- * handle them specially.
- */
- sample.low_note = *(long *) &buf[22];
- sample.high_note = *(long *) &buf[26];
- sample.base_note = *(long *) &buf[30];
- sample.detune = *(short *) &buf[34];
- sample.panning = (unsigned char) buf[36];
-
- memcpy (sample.envelope_rate, &buf[37], 6);
- memcpy (sample.envelope_offset, &buf[43], 6);
-
- sample.tremolo_sweep = (unsigned char) buf[49];
- sample.tremolo_rate = (unsigned char) buf[50];
- sample.tremolo_depth = (unsigned char) buf[51];
-
- sample.vibrato_sweep = (unsigned char) buf[52];
- sample.vibrato_rate = (unsigned char) buf[53];
- sample.vibrato_depth = (unsigned char) buf[54];
- sample.modes = (unsigned char) buf[55];
- sample.scale_frequency = *(short *) &buf[56];
- sample.scale_factor = *(unsigned short *) &buf[58];
-
- if (print_only)
- {
- printf ("\nSample: %03d / %s\n", i, sample.name);
- printf ("Len: %d, Loop start: %d, Loop end: %d\n", sample.len, sample.loop_start, sample.loop_end);
- printf ("Flags: ");
- if (sample.modes & WAVE_16_BITS)
- printf ("16 bit ");
- if (sample.modes & WAVE_UNSIGNED)
- printf ("unsigned ");
- if (sample.modes & WAVE_LOOP_BACK)
- printf ("reverse ");
- if (sample.modes & WAVE_BIDIR_LOOP)
- printf ("bidir ");
- if (sample.modes & WAVE_LOOPING)
- printf ("looping ");
- else
- printf ("one_shot");
- if (sample.modes & WAVE_SUSTAIN_ON)
- printf ("sustain ");
- if (sample.modes & WAVE_ENVELOPES)
- printf ("enveloped ");
- printf ("\n");
-
- if (sample.modes & WAVE_ENVELOPES)
- {
- int i;
-
- printf ("Envelope info: ");
- for (i = 0; i < 6; i++)
- {
- printf ("%d/%d ", sample.envelope_rate[i],
- sample.envelope_offset[i]);
- }
- printf ("\n");
- }
-
- printf ("Tremolo: sweep=%d, rate=%d, depth=%d\n",
- sample.tremolo_sweep,
- sample.tremolo_rate,
- sample.tremolo_depth);
-
- printf ("Vibrato: sweep=%d, rate=%d, depth=%d\n",
- sample.vibrato_sweep,
- sample.vibrato_rate,
- sample.vibrato_depth);
- }
-
- offset = offset + 96;
- patch = (struct patch_info *) malloc (sizeof (*patch) + sample.len);
-
- patch->key = GUS_PATCH;
- patch->device_no = gus_dev;
- patch->instr_no = pgm;
- patch->mode = sample.modes | WAVE_TREMOLO |
- WAVE_VIBRATO | WAVE_SCALE;
- patch->len = sample.len;
- patch->loop_start = sample.loop_start;
- patch->loop_end = sample.loop_end;
- patch->base_note = sample.base_note;
- patch->high_note = sample.high_note;
- patch->low_note = sample.low_note;
- patch->base_freq = sample.base_freq;
- patch->detuning = sample.detune;
- patch->panning = (sample.panning - 7) * 16;
-
- memcpy (patch->env_rate, sample.envelope_rate, 6);
- memcpy (patch->env_offset, sample.envelope_offset, 6);
-
- patch->tremolo_sweep = sample.tremolo_sweep;
- patch->tremolo_rate = sample.tremolo_rate;
- patch->tremolo_depth = sample.tremolo_depth;
-
- patch->vibrato_sweep = sample.vibrato_sweep;
- patch->vibrato_rate = sample.vibrato_rate;
- patch->vibrato_depth = sample.vibrato_depth;
-
- patch->scale_frequency = sample.scale_frequency;
- patch->scale_factor = sample.scale_factor;
-
- patch->volume = header.master_volume;
-
- if (lseek (patfd, offset, 0) == -1)
- {
- perror (name);
- return errno;
- }
-
- if (!print_only)
- {
- if (read (patfd, patch->data, sample.len) != sample.len)
- {
- fprintf (stderr, "%s: Short file\n", name);
- return EIO;
- }
-
- if (write (seqfd, patch, sizeof (*patch) + sample.len) == -1)
- {
- perror ("/dev/pmgr0");
- return errno;
- }
- }
-
- offset = offset + sample.len;
- }
-
- loadmap[pgm] = 1;
- return 0;
-}
-
-int
-main (int argc, char *argv[])
-{
- struct patmgr_info inf;
- int err, i, n;
- struct synth_info info;
-
- if ((seqfd = open ("/dev/patmgr0", O_RDWR, 0)) == -1)
- {
- fprintf (stderr, "Cannot open\n");
- perror ("/dev/patmgr0");
- exit (-1);
- }
-
- if (ioctl (seqfd, SNDCTL_SEQ_NRSYNTHS, &n) == -1)
- {
- perror ("NRSYNTH: /dev/patmgr0");
- exit (-1);
- }
-
- for (i = 0; i < n; i++)
- {
- info.device = i;
-
- if (ioctl (seqfd, SNDCTL_SYNTH_INFO, &info) == -1)
- {
- perror ("SYNTH_INFO: /dev/patmgr0");
- exit (-1);
- }
-
- if (info.synth_type == SYNTH_TYPE_SAMPLE
- && info.synth_subtype == SAMPLE_TYPE_GUS)
- gus_dev = i;
- }
-
- if (gus_dev == -1)
- {
- fprintf (stderr, "Error: Gravis Ultrasound not detected\n");
- exit (-1);
- }
-
- if (ioctl (seqfd, SNDCTL_SEQ_RESETSAMPLES, &gus_dev) == -1)
- perror ("Sample reset");
-
- for (i = 0; i < 256; i++)
- loadmap[i] = 0;
-
- while (1)
- {
- if (read (seqfd, (char *) &inf, sizeof (inf)) != sizeof (inf))
- {
- perror ("Read");
- exit (-1);
- }
-
- if (inf.key == PM_K_EVENT)
- switch (inf.command)
- {
- case PM_E_OPENED:
- printf ("Opened\n");
- break;
-
- case PM_E_CLOSED:
- printf ("Closed\n");
- if (ioctl (seqfd, SNDCTL_SEQ_RESETSAMPLES, &gus_dev) == -1)
- perror ("Sample reset");
- for (i = 0; i < 256; i++)
- loadmap[i] = 0;
- break;
-
- case PM_E_PATCH_RESET:
- printf ("Patch reset called\n");
- for (i = 0; i < 256; i++)
- loadmap[i] = 0;
- break;
-
- case PM_E_PATCH_LOADED:
- printf ("Patch loaded by client\n");
- break;
-
- default:
- printf ("Unknown event %d\n", inf.command);
- inf.key = PM_ERROR;
- inf.parm1 = EINVAL;
- }
- else if (inf.key == PM_K_COMMAND)
- switch (inf.command)
- {
- case _PM_LOAD_PATCH:
- if ((err = do_load_patch (&inf)))
- if (err == ENOSPC)
- {
- if (ioctl (seqfd, SNDCTL_SEQ_RESETSAMPLES, &gus_dev) == -1)
- {
- perror ("Sample reset");
- return errno;
- }
-
- for (i = 0; i < 256; i++)
- loadmap[i] = 0;
- err = do_load_patch (&inf);
- }
-
- if (err)
- {
- inf.key = PM_ERROR;
- inf.parm1 = err;
- printf("Error = %d\n", err);
- }
- else
- {
- inf.key = PM_K_COMMAND;
- inf.parm1 = 0;
- }
- break;
-
- default:
- printf ("Unknown command %d\n", inf.command);
- inf.key = PM_ERROR;
- inf.parm1 = EINVAL;
- }
- else
- {
- printf ("Unknown event %d/%d\n", inf.key, inf.command);
- inf.key = PM_ERROR;
- inf.parm1 = EINVAL;
- }
-
- if (write (seqfd, (char *) &inf, sizeof (inf)) != sizeof (inf))
- {
- perror ("write");
- exit (-1);
- }
- }
-
- exit (0);
-}
diff --git a/sys/i386/isa/sound/midi.c b/sys/i386/isa/sound/midi.c
deleted file mode 100644
index a11a4df..0000000
--- a/sys/i386/isa/sound/midi.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright by UWM - comments to soft-eng@cs.uwm.edu
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Id$
- */
-#define _MIDI_TABLE_C_
-#include "sound_config.h"
-
-#ifdef CONFIGURE_SOUNDCARD
-
-#ifndef EXCLUDE_CHIP_MIDI
-
-
-static int generic_midi_busy[MAX_MIDI_DEV];
-
-long
-CMIDI_init (long mem_start)
-{
-
- int i;
- int n = num_midi_drivers;
-
- /*
- * int n = sizeof (midi_supported) / sizeof( struct generic_midi_info );
- */
- for (i = 0; i < n; i++)
- {
- if (midi_supported[i].attach (mem_start))
- {
- printk ("MIDI: Successfully attached %s\n", midi_supported[i].name);
- }
-
- }
- return (mem_start);
-}
-
-
-int
-CMIDI_open (int dev, struct fileinfo *file)
-{
-
- int mode, err, retval;
-
- dev = dev >> 4;
-
- mode = file->mode & O_ACCMODE;
-
-
- if (generic_midi_busy[dev])
- return (RET_ERROR (EBUSY));
-
-
- if (dev >= num_generic_midis)
- {
- printk (" MIDI device %d not installed.\n", dev);
- return (ENXIO);
- }
-
- if (!generic_midi_devs[dev])
- {
- printk (" MIDI device %d not initialized\n", dev);
- return (ENXIO);
- }
-
- /* If all good and healthy, go ahead and issue call! */
-
-
- retval = generic_midi_devs[dev]->open (dev, mode);
-
- /* If everything ok, set device as busy */
-
- if (retval >= 0)
- generic_midi_busy[dev] = 1;
-
- return (retval);
-
-}
-
-int
-CMIDI_write (int dev, struct fileinfo *file, snd_rw_buf * buf, int count)
-{
-
- int retval;
-
- dev = dev >> 4;
-
- if (dev >= num_generic_midis)
- {
- printk (" MIDI device %d not installed.\n", dev);
- return (ENXIO);
- }
-
- /*
- * Make double sure of healthiness -- doubt Need we check this again??
- *
- */
-
- if (!generic_midi_devs[dev])
- {
- printk (" MIDI device %d not initialized\n", dev);
- return (ENXIO);
- }
-
- /* If all good and healthy, go ahead and issue call! */
-
-
- retval = generic_midi_devs[dev]->write (dev, buf);
-
- return (retval);
-
-}
-
-int
-CMIDI_read (int dev, struct fileinfo *file, snd_rw_buf * buf, int count)
-{
- int retval;
-
- dev = dev >> 4;
-
- if (dev >= num_generic_midis)
- {
- printk (" MIDI device %d not installed.\n", dev);
- return (ENXIO);
- }
-
- /*
- * Make double sure of healthiness -- doubt Need we check this again??
- *
- */
-
- if (!generic_midi_devs[dev])
- {
- printk (" MIDI device %d not initialized\n", dev);
- return (ENXIO);
- }
-
- /* If all good and healthy, go ahead and issue call! */
-
-
- retval = generic_midi_devs[dev]->read (dev, buf);
-
- return (retval);
-
-}
-
-int
-CMIDI_close (int dev, struct fileinfo *file)
-{
-
- int retval;
-
- dev = dev >> 4;
-
- if (dev >= num_generic_midis)
- {
- printk (" MIDI device %d not installed.\n", dev);
- return (ENXIO);
- }
-
- /*
- * Make double sure of healthiness -- doubt Need we check this again??
- *
- */
-
- if (!generic_midi_devs[dev])
- {
- printk (" MIDI device %d not initialized\n", dev);
- return (ENXIO);
- }
-
- /* If all good and healthy, go ahead and issue call! */
-
-
- generic_midi_devs[dev]->close (dev);
-
- generic_midi_busy[dev] = 0; /* Free the device */
-
- return (0);
-
-}
-
-#endif
-
-#endif
diff --git a/sys/i386/isa/sound/pro_midi.c b/sys/i386/isa/sound/pro_midi.c
deleted file mode 100644
index 93c1937..0000000
--- a/sys/i386/isa/sound/pro_midi.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright by UWM - comments to soft-eng@cs.uwm.edu
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Id$
- */
-#define ALL_EXTERNAL_TO_ME
-#include "sound_config.h"
-
-#ifdef CONFIGURE_SOUNDCARD
-
-#include "pas.h"
-#define ESUCCESS 0
-
-#if !defined(EXCLUDE_PRO_MIDI) && !defined(EXCLUDE_CHIP_MIDI)
-
-
-/** Structure for handling operations **/
-
-
-static struct generic_midi_operations pro_midi_operations =
-{
-
- {"Pro_Audio_Spectrum 16 MV101", 0},
- pro_midi_open,
- pro_midi_close,
- pro_midi_write,
- pro_midi_read
-};
-
-/*
- * Note! Note! Note! Follow the same model for any other attach function you
- * may write
- */
-
-long
-pro_midi_attach (long mem_start)
-{
- pro_midi_dev = num_generic_midis;
- generic_midi_devs[num_generic_midis++] = &pro_midi_operations;
- return mem_start;
-}
-
-int
-pro_midi_open (int dev, int mode)
-{
-
- int intr_mask, s;
-
-
- s = splhigh ();
-
-
- /* Reset the input and output FIFO pointers */
-
-
- outb (MIDI_CONTROL, M_C_RESET_INPUT_FIFO | M_C_RESET_OUTPUT_FIFO);
-
- /* Get the interrupt status */
-
- intr_mask = inb (INTERRUPT_MASK);
-
-
- /* Enable MIDI IRQ */
-
- intr_mask |= I_M_MIDI_IRQ_ENABLE;
- outb (INTERRUPT_MASK, intr_mask);
-
-
- /* Enable READ/WRITE on MIDI port. This part is quite unsure though */
-
- outb (MIDI_CONTROL, M_C_ENA_OUTPUT_IRQ | M_C_ENA_INPUT_IRQ);
-
- /* Acknowledge pending interrupts */
-
- outb (MIDI_STATUS, 0xff);
-
-
- splx (s);
-
- return (ESUCCESS);
-
-
-}
-
-
-void
-pro_midi_close (int dev)
-{
-
- int intr_mask;
-
- /* Clean up */
-
- outb (MIDI_CONTROL, M_C_RESET_INPUT_FIFO | M_C_RESET_OUTPUT_FIFO);
- intr_mask = inb (INTERRUPT_MASK);
- intr_mask &= ~I_M_MIDI_IRQ_ENABLE;
- outb (INTERRUPT_MASK, intr_mask);
-
- return;
-}
-
-int
-pro_midi_write (int dev, struct uio *uio)
-{
-
- int s;
- unsigned char data;
-
- /* printf("midi: Going to do write routine..\n"); */
- while (uio->uio_resid)
- {
-
- if (uiomove (&data, 1, uio))
- return (ENOTTY);
-
- s = splhigh ();
-
- DELAY (30);
- outb (MIDI_DATA, data);
- DELAY (70); /* Ze best pause.. find a better one if you
- * can :) */
- splx (s);
- }
-
- return (ESUCCESS);
-
-}
-
-
-int
-pro_midi_read (int dev, struct uio *uio)
-{
-
- int s;
- unsigned char data;
-
- s = splhigh ();
-
- /* For each uio_iov[] entry .... */
-
- while (uio->uio_resid)
- {
-
- if (((inb (MIDI_STATUS) & M_S_INPUT_AVAIL) == 0) &&
- ((inb (MIDI_FIFO_STATUS) & MIDI_INPUT_AVAILABLE) == 0))
-
- data = 0xfe;
- else
- data = inb (MIDI_DATA);
-
- if (uiomove (&data, 1, uio))
- {
-
- printf ("midi: Bad copyout()!\n");
- return (ENOTTY);
-
- }
-
- }
- splx (s);
- return (ESUCCESS);
-
-}
-
-#endif
-
-#endif
diff --git a/sys/i386/isa/sound/pss.c b/sys/i386/isa/sound/pss.c
deleted file mode 100644
index 839f142..0000000
--- a/sys/i386/isa/sound/pss.c
+++ /dev/null
@@ -1,925 +0,0 @@
-/* Marc.Hoffman@analog.com
-
- This is a pss driver.
-
- it is based on Greg.Yukna@analog.com @file{host} for DOG
-
- Unfortunately I can't distribute the ld file needed to
- make the pss card to emulate the SB stuff.
-
- I have provided a simple interface to the PSS unlike the
- DOG version. to download a new algorithm just cat it to
- /dev/pss 14,9.
-
- You really need to rebuild this with the synth.ld file
-
- get the <synth>.ld from your dos directory maybe
- voyetra\dsp001.ld
-
- ld2inc < synth.ld > synth-ld.h
- (make config does the same).
-
- rebuild
-
- Okay if you blow things away no problem just
-
- main(){ioctl(open("/dev/pss"),SNDCTL_PSS_RESET)};
-
- and everything will be okay.
-
- At first I was going to worry about applications that were using
- the sound stuff and disallow the use of /dev/pss. But for
- now I figured it doesn't matter.
-
- And if you change algos all the other applications running die off
- due to DMA problems. Yeah just pull the plug and watch em die.
-
- If the registers get hosed
- main(){ioctl(open("/dev/pss"),SNDCTL_PSS_SETUP_REGISTERS)};
-
- Probably everything else can be done via mmap
-
- Oh if you want to develop code for the ADSP-21xx or Program the
- 1848 just send me mail and I will hook you up.
-
- marc.hoffman@analog.com
-
- * $Id: pss.c,v 1.2 1994/10/01 02:17:00 swallace Exp $
- */
-#include "sound_config.h"
-
-#if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_PSS)
-
-#ifndef PSS_MSS_BASE
-#define PSS_MSS_BASE 0
-#endif
-
-#ifndef PSS_MPU_BASE
-#define PSS_MPU_BASE 0
-#endif
-
-#ifndef PSS_MPU_IRQ
-#define PSS_MPU_IRQ 0
-#endif
-
-#undef DEB
-#define DEB(x) x
-
-#include "pss.h"
-
-static int pss_ok = 0;
-static int sb_ok = 0;
-
-static int pss_base;
-static int pss_irq;
-static int pss_dma;
-
-static int gamePort = 0;
-
-static int sbInt;
-static int cdPol;
-static int cdAddr = 0; /* 0x340; */
-static int cdInt = 10;
-
-/* Define these by hand in local.h */
-static int wssAddr = PSS_MSS_BASE;
-static int midiAddr = PSS_MPU_BASE;
-static int midiInt = PSS_MPU_IRQ;
-
-static int SoundPortAddress;
-static int SoundPortData;
-static int speaker = 1;
-
-
-static struct pss_speaker default_speaker =
-{0, 0, 0, PSS_STEREO};
-
-DEFINE_WAIT_QUEUE (pss_sleeper, pss_sleep_flag);
-
-#include "synth-ld.h"
-
-static int pss_download_boot (unsigned char *block, int size);
-static int pss_reset_dsp (void);
-
-static inline void
-pss_outpw (unsigned short port, unsigned short value)
-{
- __asm__ __volatile__ ("outw %w0, %w1"
- : /* no outputs */
- :"a" (value), "d" (port));
-}
-
-static inline unsigned int
-pss_inpw (unsigned short port)
-{
- unsigned int _v;
- __asm__ __volatile__ ("inw %w1,%w0"
- :"=a" (_v):"d" (port), "0" (0));
-
- return _v;
-}
-
-static void
-PSS_write (int data)
-{
- int i, limit;
-
- limit = GET_TIME () + 10; /* The timeout is 0.1 seconds */
- /*
- * Note! the i<5000000 is an emergency exit. The dsp_command() is sometimes
- * called while interrupts are disabled. This means that the timer is
- * disabled also. However the timeout situation is a abnormal condition.
- * Normally the DSP should be ready to accept commands after just couple of
- * loops.
- */
-
- for (i = 0; i < 5000000 && GET_TIME () < limit; i++)
- {
- if (pss_inpw (pss_base + PSS_STATUS) & PSS_WRITE_EMPTY)
- {
- pss_outpw (pss_base + PSS_DATA, data);
- return;
- }
- }
- printk ("PSS: DSP Command (%04x) Timeout.\n", data);
- printk ("IRQ conflict???\n");
-}
-
-
-static void
-pss_setaddr (int addr, int configAddr)
-{
- int val;
-
- val = pss_inpw (configAddr);
- val &= ADDR_MASK;
- val |= (addr << 4);
- pss_outpw (configAddr, val);
-}
-
-/*_____ pss_checkint
- This function tests an interrupt number to see if
- it is available. It takes the interrupt button
- as it's argument and returns TRUE if the interrupt
- is ok.
-*/
-static int
-pss_checkint (int intNum)
-{
- int val;
- int ret;
- int i;
-
- /*_____ Set the interrupt bits */
- switch (intNum)
- {
- case 3:
- val = pss_inpw (pss_base + PSS_CONFIG);
- val &= INT_MASK;
- val |= INT_3_BITS;
- pss_outpw (pss_base + PSS_CONFIG, val);
- break;
- case 5:
- val = pss_inpw (pss_base + PSS_CONFIG);
- val &= INT_MASK;
- val |= INT_5_BITS;
- pss_outpw (pss_base + PSS_CONFIG, val);
- break;
- case 7:
- val = pss_inpw (pss_base + PSS_CONFIG);
- val &= INT_MASK;
- val |= INT_7_BITS;
- pss_outpw (pss_base + PSS_CONFIG, val);
- break;
- case 9:
- val = pss_inpw (pss_base + PSS_CONFIG);
- val &= INT_MASK;
- val |= INT_9_BITS;
- pss_outpw (pss_base + PSS_CONFIG, val);
- break;
- case 10:
- val = pss_inpw (pss_base + PSS_CONFIG);
- val &= INT_MASK;
- val |= INT_10_BITS;
- pss_outpw (pss_base + PSS_CONFIG, val);
- break;
- case 11:
- val = pss_inpw (pss_base + PSS_CONFIG);
- val &= INT_MASK;
- val |= INT_11_BITS;
- pss_outpw (pss_base + PSS_CONFIG, val);
- break;
- case 12:
- val = pss_inpw (pss_base + PSS_CONFIG);
- val &= INT_MASK;
- val |= INT_12_BITS;
- pss_outpw (pss_base + PSS_CONFIG, val);
- break;
- default:
- printk ("unknown interrupt selected. %d\n", intNum);
- return 0;
- }
-
- /*_____ Set the interrupt test bit */
- val = pss_inpw (pss_base + PSS_CONFIG);
- val |= INT_TEST_BIT;
- pss_outpw (pss_base + PSS_CONFIG, val);
-
- /*_____ Check if the interrupt is in use */
- /*_____ Do it a few times in case there is a delay */
- ret = 0;
- for (i = 0; i < 5; i++)
- {
- val = pss_inpw (pss_base + PSS_CONFIG);
- if (val & INT_TEST_PASS)
- {
- ret = 1;
- break;
- }
- }
- /*_____ Clear the Test bit and the interrupt bits */
- val = pss_inpw (pss_base + PSS_CONFIG);
- val &= INT_TEST_BIT_MASK;
- val &= INT_MASK;
- pss_outpw (pss_base + PSS_CONFIG, val);
- return (ret);
-}
-
-/*____ pss_setint
- This function sets the correct bits in the
- configuration register to
- enable the chosen interrupt.
-*/
-static void
-pss_setint (int intNum, int configAddress)
-{
- int val;
-
- switch (intNum)
- {
- case 0:
- val = pss_inpw (configAddress);
- val &= INT_MASK;
- pss_outpw (configAddress, val);
- break;
- case 3:
- val = pss_inpw (configAddress);
- val &= INT_MASK;
- val |= INT_3_BITS;
- pss_outpw (configAddress, val);
- break;
- case 5:
- val = pss_inpw (configAddress);
- val &= INT_MASK;
- val |= INT_5_BITS;
- pss_outpw (configAddress, val);
- break;
- case 7:
- val = pss_inpw (configAddress);
- val &= INT_MASK;
- val |= INT_7_BITS;
- pss_outpw (configAddress, val);
- break;
- case 9:
- val = pss_inpw (configAddress);
- val &= INT_MASK;
- val |= INT_9_BITS;
- pss_outpw (configAddress, val);
- break;
- case 10:
- val = pss_inpw (configAddress);
- val &= INT_MASK;
- val |= INT_10_BITS;
- pss_outpw (configAddress, val);
- break;
- case 11:
- val = pss_inpw (configAddress);
- val &= INT_MASK;
- val |= INT_11_BITS;
- pss_outpw (configAddress, val);
- break;
- case 12:
- val = pss_inpw (configAddress);
- val &= INT_MASK;
- val |= INT_12_BITS;
- pss_outpw (configAddress, val);
- break;
- default:
- printk ("pss_setint unknown int\n");
- }
-}
-
-
-/*____ pss_setsbint
- This function sets the correct bits in the
- SoundBlaster configuration PSS register to
- enable the chosen interrupt.
- It takes a interrupt button as its argument.
-*/
-static void
-pss_setsbint (int intNum)
-{
- int val;
- int sbConfigAddress;
-
- sbConfigAddress = pss_base + SB_CONFIG;
- switch (intNum)
- {
- case 3:
- val = pss_inpw (sbConfigAddress);
- val &= INT_MASK;
- val |= INT_3_BITS;
- pss_outpw (sbConfigAddress, val);
- break;
- case 5:
- val = pss_inpw (sbConfigAddress);
- val &= INT_MASK;
- val |= INT_5_BITS;
- pss_outpw (sbConfigAddress, val);
- break;
- case 7:
- val = pss_inpw (sbConfigAddress);
- val &= INT_MASK;
- val |= INT_7_BITS;
- pss_outpw (sbConfigAddress, val);
- break;
- default:
- printk ("pss_setsbint: unknown_int\n");
- }
-}
-
-/*____ pss_setsbdma
- This function sets the correct bits in the
- SoundBlaster configuration PSS register to
- enable the chosen DMA channel.
- It takes a DMA button as its argument.
-*/
-static void
-pss_setsbdma (int dmaNum)
-{
- int val;
- int sbConfigAddress;
-
- sbConfigAddress = pss_base + SB_CONFIG;
-
- switch (dmaNum)
- {
- case 1:
- val = pss_inpw (sbConfigAddress);
- val &= DMA_MASK;
- val |= DMA_1_BITS;
- pss_outpw (sbConfigAddress, val);
- break;
- default:
- printk ("Personal Sound System ERROR! pss_setsbdma: unknown_dma\n");
- }
-}
-
-/*____ pss_setwssdma
- This function sets the correct bits in the
- WSS configuration PSS register to
- enable the chosen DMA channel.
- It takes a DMA button as its argument.
-*/
-static void
-pss_setwssdma (int dmaNum)
-{
- int val;
- int wssConfigAddress;
-
- wssConfigAddress = pss_base + PSS_WSS_CONFIG;
-
- switch (dmaNum)
- {
- case 0:
- val = pss_inpw (wssConfigAddress);
- val &= DMA_MASK;
- val |= DMA_0_BITS;
- pss_outpw (wssConfigAddress, val);
- break;
- case 1:
- val = pss_inpw (wssConfigAddress);
- val &= DMA_MASK;
- val |= DMA_1_BITS;
- pss_outpw (wssConfigAddress, val);
- break;
- case 3:
- val = pss_inpw (wssConfigAddress);
- val &= DMA_MASK;
- val |= DMA_3_BITS;
- pss_outpw (wssConfigAddress, val);
- break;
- default:
- printk ("Personal Sound System ERROR! pss_setwssdma: unknown_dma\n");
- }
-}
-
-
-/*_____ SetSpeakerOut
- This function sets the Volume, Bass, Treble and Mode of
- the speaker out channel.
- */
-void
-pss_setspeaker (struct pss_speaker *spk)
-{
- PSS_write (SET_MASTER_COMMAND);
- if (spk->volume > PHILLIPS_VOL_MAX)
- spk->volume = PHILLIPS_VOL_MAX;
- if (spk->volume < PHILLIPS_VOL_MIN)
- spk->volume = PHILLIPS_VOL_MIN;
-
- PSS_write (MASTER_VOLUME_LEFT
- | (PHILLIPS_VOL_CONSTANT + spk->volume / PHILLIPS_VOL_STEP));
- PSS_write (SET_MASTER_COMMAND);
- PSS_write (MASTER_VOLUME_RIGHT
- | (PHILLIPS_VOL_CONSTANT + spk->volume / PHILLIPS_VOL_STEP));
-
- if (spk->bass > PHILLIPS_BASS_MAX)
- spk->bass = PHILLIPS_BASS_MAX;
- if (spk->bass < PHILLIPS_BASS_MIN)
- spk->bass = PHILLIPS_BASS_MIN;
- PSS_write (SET_MASTER_COMMAND);
- PSS_write (MASTER_BASS
- | (PHILLIPS_BASS_CONSTANT + spk->bass / PHILLIPS_BASS_STEP));
-
- if (spk->treb > PHILLIPS_TREBLE_MAX)
- spk->treb = PHILLIPS_TREBLE_MAX;
- if (spk->treb < PHILLIPS_TREBLE_MIN)
- spk->treb = PHILLIPS_TREBLE_MIN;
- PSS_write (SET_MASTER_COMMAND);
- PSS_write (MASTER_TREBLE
- | (PHILLIPS_TREBLE_CONSTANT + spk->treb / PHILLIPS_TREBLE_STEP));
-
- PSS_write (SET_MASTER_COMMAND);
- PSS_write (MASTER_SWITCH | spk->mode);
-}
-
-static void
-pss_init1848 (void)
-{
- /*_____ Wait for 1848 to init */
- while (INB (SoundPortAddress) & SP_IN_INIT);
-
- /*_____ Wait for 1848 to autocal */
- OUTB (SoundPortAddress, SP_TEST_AND_INIT);
- while (INB (SoundPortData) & AUTO_CAL_IN_PROG);
-}
-
-static int
-pss_configure_registers_to_look_like_sb (void)
-{
- pss_setaddr (wssAddr, pss_base + PSS_WSS_CONFIG);
-
- SoundPortAddress = wssAddr + 4;
- SoundPortData = wssAddr + 5;
-
- DEB (printk ("Turning Game Port %s.\n",
- gamePort ? "On" : "Off"));
-
- /*_____ Turn on the Game port */
- if (gamePort)
- pss_outpw (pss_base + PSS_STATUS,
- pss_inpw (pss_base + PSS_STATUS) | GAME_BIT);
- else
- pss_outpw (pss_base + PSS_STATUS,
- pss_inpw (pss_base + PSS_STATUS) & GAME_BIT_MASK);
-
-
- DEB (printk ("PSS attaching base %x irq %d dma %d\n",
- pss_base, pss_irq, pss_dma));
-
- /* Check if sb is enabled if it is check the interrupt */
- pss_outpw (pss_base + SB_CONFIG, 0);
-
- if (pss_irq != 0)
- {
- DEB (printk ("PSS Emulating Sound Blaster ADDR %04x\n", pss_base));
- DEB (printk ("PSS SBC: attaching base %x irq %d dma %d\n",
- SBC_BASE, SBC_IRQ, SBC_DMA));
-
- if (pss_checkint (SBC_IRQ) == 0)
- {
- printk ("PSS! attach: int_error\n");
- return 0;
- }
-
- pss_setsbint (SBC_IRQ);
- pss_setsbdma (SBC_DMA);
- sb_ok = 1;
- }
- else
- {
- sb_ok = 0;
- printk ("PSS: sound blaster error init\n");
- }
-
- /* Check if cd is enabled if it is check the interrupt */
- pss_outpw (pss_base + CD_CONFIG, 0);
-
- if (cdAddr != 0)
- {
- DEB (printk ("PSS:CD drive %x irq: %d", cdAddr, cdInt));
- if (cdInt != 0)
- {
- if (pss_checkint (cdInt) == 0)
- {
- printk ("Can't allocate cdInt %d\n", cdInt);
- }
- else
- {
- int val;
-
- printk ("CD poll ");
- pss_setaddr (cdAddr, pss_base + CD_CONFIG);
- pss_setint (cdInt, pss_base + CD_CONFIG);
-
- /* set the correct bit in the
- configuration register to
- set the irq polarity for the CD-Rom.
- NOTE: This bit is in the address config
- field, It must be configured after setting
- the CD-ROM ADDRESS!!! */
- val = pss_inpw (pss_base + CD_CONFIG);
- pss_outpw (pss_base + CD_CONFIG, 0);
- val &= CD_POL_MASK;
- if (cdPol)
- val |= CD_POL_BIT;
- pss_outpw (pss_base + CD_CONFIG, val);
- }
- }
- }
-
- /* Check if midi is enabled if it is check the interrupt */
- pss_outpw (pss_base + MIDI_CONFIG, 0);
- if (midiAddr != 0)
- {
- printk ("midi init %x %d\n", midiAddr, midiInt);
- if (pss_checkint (midiInt) == 0)
- {
- printk ("midi init int error %x %d\n", midiAddr, midiInt);
- }
- else
- {
- pss_setaddr (midiAddr, pss_base + MIDI_CONFIG);
- pss_setint (midiInt, pss_base + MIDI_CONFIG);
- }
- }
- return 1;
-}
-
-long
-attach_pss (long mem_start, struct address_info *hw_config)
-{
- if (pss_ok)
- {
- if (hw_config)
- {
- printk (" <PSS-ESC614>");
- }
-
- return mem_start;
- }
-
- pss_ok = 1;
-
- if (pss_configure_registers_to_look_like_sb () == 0)
- return mem_start;
-
- if (sb_ok)
- if (pss_synthLen
- && pss_download_boot (pss_synth, pss_synthLen))
- {
- if (speaker)
- pss_setspeaker (&default_speaker);
- pss_ok = 1;
- }
- else
- pss_reset_dsp ();
-
- return mem_start;
-}
-
-int
-probe_pss (struct address_info *hw_config)
-{
- pss_base = hw_config->io_base;
- pss_irq = hw_config->irq;
- pss_dma = hw_config->dma;
-
- if ((pss_inpw (pss_base + 4) & 0xff00) == 0x4500)
- {
- attach_pss (0, hw_config);
- return 1;
- }
- printk (" fail base %x irq %d dma %d\n", pss_base, pss_irq, pss_dma);
- return 0;
-}
-
-
-static int
-pss_reattach (void)
-{
- pss_ok = 0;
- attach_pss (0, 0);
- return 1;
-}
-
-static int
-pss_reset_dsp ()
-{
- unsigned long i, limit = GET_TIME () + 10;
-
- pss_outpw (pss_base + PSS_CONTROL, 0x2000);
-
- for (i = 0; i < 32768 && GET_TIME () < limit; i++)
- pss_inpw (pss_base + PSS_CONTROL);
-
- pss_outpw (pss_base + PSS_CONTROL, 0x0000);
-
- return 1;
-}
-
-
-static int
-pss_download_boot (unsigned char *block, int size)
-{
- int i, limit, val, count;
-
- printk ("PSS: downloading boot code synth.ld... ");
-
- /*_____ Warn DSP software that a boot is coming */
- pss_outpw (pss_base + PSS_DATA, 0x00fe);
-
- limit = GET_TIME () + 10;
-
- for (i = 0; i < 32768 && GET_TIME () < limit; i++)
- if (pss_inpw (pss_base + PSS_DATA) == 0x5500)
- break;
-
- pss_outpw (pss_base + PSS_DATA, *block++);
-
- pss_reset_dsp ();
- printk ("start ");
-
- count = 1;
- while (1)
- {
- int j;
-
- for (j = 0; j < 327670; j++)
- {
- /*_____ Wait for BG to appear */
- if (pss_inpw (pss_base + PSS_STATUS) & PSS_FLAG3)
- break;
- }
-
- if (j == 327670)
- {
- /* It's ok we timed out when the file was empty */
- if (count >= size)
- break;
- else
- {
- printk ("\nPSS: DownLoad timeout problems, byte %d=%d\n",
- count, size);
- return 0;
- }
- }
- /*_____ Send the next byte */
- pss_outpw (pss_base + PSS_DATA, *block++);
- count++;
- }
-
- /*_____ Why */
- pss_outpw (pss_base + PSS_DATA, 0);
-
- limit = GET_TIME () + 10;
- for (i = 0; i < 32768 && GET_TIME () < limit; i++)
- val = pss_inpw (pss_base + PSS_STATUS);
-
- printk ("downloaded\n");
-
- limit = GET_TIME () + 10;
- for (i = 0; i < 32768 && GET_TIME () < limit; i++)
- {
- val = pss_inpw (pss_base + PSS_STATUS);
- if (val & 0x4000)
- break;
- }
-
- /* now read the version */
- for (i = 0; i < 32000; i++)
- {
- val = pss_inpw (pss_base + PSS_STATUS_REG);
- if (val & PSS_READ_FULL)
- break;
- }
- if (i == 32000)
- return 0;
-
- val = pss_inpw (pss_base + PSS_DATA_REG);
-
- return 1;
-}
-
-
-/* The following is a simple device driver for the pss.
- All I really care about is communication to and from the pss.
-
- The ability to reinitialize the <synth.ld> This will be
- default when release is chosen.
-
- SNDCTL_PSS_DOWNLOAD:
-
- Okay we need to creat new minor numbers for the
- DOWNLOAD functionality.
-
- 14,0x19 -- /dev/pssld where a read operation would output the
- current ld to user space
- where a write operation would effectively
- download a new ld.
-
- 14,0x09 -- /dev/psecho would open up a communication path to the
- esc614 asic. Given the ability to send
- messages to the asic and receive messages too.
-
- All messages would get read and written in the
- same manner. It would be up to the application
- and the ld to maintain a relationship
- of what the messages mean.
-
- for this device we need to implement select. */
-#define CODE_BUFFER_LEN (64*1024)
-static char *code_buffer;
-static int code_length;
-
-static int lock_pss = 0;
-
-int
-pss_open (int dev, struct fileinfo *file)
-{
- int mode;
-
- DEB (printk ("pss_open\n"));
-
- if (pss_ok == 0)
- return RET_ERROR (EIO);
-
- if (lock_pss)
- return 0;
-
- lock_pss = 1;
-
- dev = dev >> 4;
- mode = file->mode & O_ACCMODE;
- if (mode == O_WRONLY)
- {
- printk ("pss-open for WRONLY\n");
- code_length = 0;
- }
-
- RESET_WAIT_QUEUE (pss_sleeper, pss_sleep_flag);
- return 1;
-}
-
-void
-pss_release (int dev, struct fileinfo *file)
-{
- int mode;
-
- DEB (printk ("pss_release\n"));
- if (pss_ok == 0)
- return RET_ERROR (EIO);
-
- dev = dev >> 4;
- mode = file->mode & O_ACCMODE;
- if (mode == O_WRONLY && code_length > 0)
- {
-#ifdef linux
- /* This just allows interrupts while the conversion is running */
- __asm__ ("sti");
-#endif
- if (!pss_download_boot (code_buffer, code_length))
- {
- pss_reattach ();
- }
- }
- lock_pss = 0;
-}
-
-int
-pss_read (int dev, struct fileinfo *file, snd_rw_buf * buf, int count)
-{
- int c, p;
-
- DEB (printk ("pss_read\n"));
- if (pss_ok == 0)
- return RET_ERROR (EIO);
-
- dev = dev >> 4;
- p = 0;
- c = count;
-
- return count - c;
-}
-
-int
-pss_write (int dev, struct fileinfo *file, snd_rw_buf * buf, int count)
-{
- DEB (printk ("pss_write\n"));
- if (pss_ok == 0)
- return RET_ERROR (EIO);
- dev = dev >> 4;
-
- if (count) /* Flush output */
- {
- COPY_FROM_USER (&code_buffer[code_length], buf, 0, count);
- code_length += count;
- }
- return count;
-}
-
-
-int
-pss_ioctl (int dev, struct fileinfo *file,
- unsigned int cmd, unsigned int arg)
-{
- DEB (printk ("pss_ioctl dev=%d cmd=%x\n", dev, cmd));
- if (pss_ok == 0)
- return RET_ERROR (EIO);
-
- dev = dev >> 4;
-
- switch (cmd)
- {
- case SNDCTL_PSS_RESET:
- pss_reattach ();
- return 1;
-
- case SNDCTL_PSS_SETUP_REGISTERS:
- pss_configure_registers_to_look_like_sb ();
- return 1;
-
- case SNDCTL_PSS_SPEAKER:
- {
- struct pss_speaker params;
- COPY_FROM_USER (&params, (char *) arg, 0, sizeof (struct pss_speaker));
-
- pss_setspeaker (&params);
- return 0;
- }
- default:
- return RET_ERROR (EIO);
- }
-}
-
-/* This is going to be used to implement
- waiting on messages sent from the DSP and to the
- DSP when communication is used via the pss directly.
-
- We need to find out if the pss can generate a different
- interrupt other than the one it has been setup for.
-
- This way we can carry on a conversation with the pss
- on a separate channel. This would be useful for debugging. */
-
-pss_select (int dev, struct fileinfo * file, int sel_type, select_table * wait)
-{
- return 0;
- if (pss_ok == 0)
- return RET_ERROR (EIO);
-
- dev = dev >> 4;
-
- switch (sel_type)
- {
- case SEL_IN:
- select_wait (&pss_sleeper, wait);
- return 0;
- break;
-
- case SEL_OUT:
- select_wait (&pss_sleeper, wait);
- return 0;
- break;
-
- case SEL_EX:
- return 0;
- }
-
- return 0;
-}
-
-long
-pss_init (long mem_start)
-{
- DEB (printk ("pss_init\n"));
- if (pss_ok)
- {
- code_buffer = mem_start;
- mem_start += CODE_BUFFER_LEN;
- }
- return mem_start;
-}
-
-#endif
diff --git a/sys/i386/isa/sound/pss.h b/sys/i386/isa/sound/pss.h
deleted file mode 100644
index e020af6..0000000
--- a/sys/i386/isa/sound/pss.h
+++ /dev/null
@@ -1,371 +0,0 @@
-/******************************************************************************
-
- def.h
-
- Version 1.3 11/2/93
-
- Copyright (c) 1993 Analog Devices Inc. All rights reserved
-
-******************************************************************************/
-/* Port offsets from base port for Sound Blaster DSP */
-#define DSP_PORT_CMSD0 0x00 /* C/MS music voice 1-6 data port, write only */
-#define DSP_PORT_CMSR0 0x01 /* C/MS music voice 1-6 register port, write only */
-#define DSP_PORT_CMSD1 0x02 /* C/MS music voice 7-12 data port, write only */
-#define DSP_PORT_CMSR1 0x03 /* C/MS music voice 7-12 register port, write only */
-
-#define DSP_PORT_STATUS 0x04 /* DSP Status bits, read only */
-#define DSP_PORT_CONTROL 0x04 /* DSP Control bits, write only */
-#define DSP_PORT_DATA_LSB 0x05 /* Read or write LSB of 16 bit data */
-
-
-#define DSP_PORT_RESET 0x06 /* DSP Reset, write only */
-#define DSP_PORT_07h 0x07 /* reserved port */
-
-#define DSP_PORT_FMD0 0x08 /* FM music data/status port, read/write */
-#define DSP_PORT_FMR0 0x09 /* FM music data/status port, write only */
-
-#define DSP_PORT_RDDATA 0x0A /* DSP Read data, read only reading signals DSP */
-#define DSP_PORT_0Bh 0x0B /* reserved port */
-#define DSP_PORT_WRDATA 0x0C /* DSP Write data or command, write */
-#define DSP_PORT_WRBUSY 0x0C /* DSP Write buffer status (bit 7), read */
-#define DSP_PORT_0Dh 0x0D /* reserved port */
-#define DSP_PORT_DATAAVAIL 0x0E /* DSP Data available status (bit 7), read only */
-#define DSP_PORT_INTERFACE 0x0E /* Sets DMA Channel and Interrupt, write only */
-#define DSP_PORT_0Fh 0x0F /* reserved port (used on Pro cards) */
-
-#define ADDR_MASK 0x003f
-
-#define INT_MASK 0xffc7
-#define INT_3_BITS 0x0008
-#define INT_5_BITS 0x0010
-#define INT_7_BITS 0x0018
-#define INT_9_BITS 0x0020
-#define INT_10_BITS 0x0028
-#define INT_11_BITS 0x0030
-#define INT_12_BITS 0x0038
-
-#define GAME_BIT 0x0400
-#define GAME_BIT_MASK 0xfbff
-
-#define INT_TEST_BIT 0x0200
-#define INT_TEST_PASS 0x0100
-#define INT_TEST_BIT_MASK 0xFDFF
-
-#define DMA_MASK 0xfff8
-#define DMA_0_BITS 0x0001
-#define DMA_1_BITS 0x0002
-#define DMA_3_BITS 0x0003
-#define DMA_5_BITS 0x0004
-#define DMA_6_BITS 0x0005
-#define DMA_7_BITS 0x0006
-
-#define DMA_TEST_BIT 0x0080
-#define DMA_TEST_PASS 0x0040
-#define DMA_TEST_BIT_MASK 0xFF7F
-
-
-/* Echo DSP Flags */
-
-#define DSP_FLAG3 0x10
-#define DSP_FLAG2 0x08
-#define DSP_FLAG1 0x80
-#define DSP_FLAG0 0x40
-
-#define PSS_CONFIG 0x10
-#define PSS_WSS_CONFIG 0x12
-#define SB_CONFIG 0x14
-#define MIDI_CONFIG 0x18
-#define CD_CONFIG 0x16
-#define UART_CONFIG 0x1a
-
-#define PSS_DATA 0x00
-#define PSS_STATUS 0x02
-#define PSS_CONTROL 0x02
-#define PSS_ID_VERS 0x04
-
-#define PSS_FLAG3 0x0800
-#define PSS_FLAG2 0x0400
-#define PSS_FLAG1 0x1000
-#define PSS_FLAG0 0x0800
-
-/*_____ WSS defines */
-#define WSS_BASE_ADDRESS 0x530
-#define WSS_CONFIG 0x0
-#define WSS_VERSION 0x03
-#define WSS_SP0 0x04
-#define WSS_SP1 0x05
-#define WSS_SP2 0x06
-#define WSS_SP3 0x07
-
-/*_____ SoundPort register addresses */
-
-#define SP_LIN_SOURCE_CTRL 0x00
-#define SP_RIN_SOURCE_CTRL 0x01
-#define SP_LIN_GAIN_CTRL 0x10
-#define SP_RIN_GAIN_CTRL 0x11
-#define SP_LAUX1_CTRL 0x02
-#define SP_RAUX1_CTRL 0x03
-#define SP_LAUX2_CTRL 0x04
-#define SP_RAUX2_CTRL 0x05
-#define SP_LOUT_CTRL 0x06
-#define SP_ROUT_CTRL 0x07
-#define SP_CLK_FORMAT 0x48
-#define SP_INT_CONF 0x09
-#define SP_INT_CONF_MCE 0x49
-#define SP_PIN_CTRL 0x0a
-#define SP_TEST_INIT 0x0b
-#define SP_MISC_CTRL 0x0c
-#define SP_MIX_CTRL 0x0d
-#define SP_DMA_UCNT 0x0e
-#define SP_DMA_LCNT 0x0f
-
-/*_____ Gain constants */
-
-#define GAIN_0 0x00
-#define GAIN_1_5 0x01
-#define GAIN_3 0x02
-#define GAIN_4_5 0x03
-#define GAIN_6 0x04
-#define GAIN_7_5 0x05
-#define GAIN_9 0x06
-#define GAIN_10_5 0x07
-#define GAIN_12 0x08
-#define GAIN_13_5 0x09
-#define GAIN_15 0x0a
-#define GAIN_16_5 0x0b
-#define GAIN_18 0x0c
-#define GAIN_19_5 0x0d
-#define GAIN_21 0x0e
-#define GAIN_22_5 0x0f
-#define MUTE 0XFFFF
-
-/*_____ Attenuation constants */
-
-#define ATTEN_0 0x00
-#define ATTEN_1_5 0x01
-#define ATTEN_3 0x02
-#define ATTEN_4_5 0x03
-#define ATTEN_6 0x04
-#define ATTEN_7_5 0x05
-#define ATTEN_9 0x06
-#define ATTEN_10_5 0x07
-#define ATTEN_12 0x08
-#define ATTEN_13_5 0x09
-#define ATTEN_15 0x0a
-#define ATTEN_16_5 0x0b
-#define ATTEN_18 0x0c
-#define ATTEN_19_5 0x0d
-#define ATTEN_21 0x0e
-#define ATTEN_22_5 0x0f
-
-
-#define PSS_WRITE_EMPTY 0x8000
-
-#define CD_POL_MASK 0xFFBF
-#define CD_POL_BIT 0x0040
-
-
-
-/******************************************************************************
-
- host.h
-
- Version 1.2 9/27/93
-
- Copyright (c) 1993 Analog Devices Inc. All rights reserved
-
-******************************************************************************/
-#define SB_WRITE_FULL 0x80
-#define SB_READ_FULL 0x80
-#define SB_WRITE_STATUS 0x0C
-#define SB_READ_STATUS 0x0E
-#define SB_READ_DATA 0x0A
-#define SB_WRITE_DATA 0x0C
-
-#define PSS_DATA_REG 0x00
-#define PSS_STATUS_REG 0x02
-#define PSS_WRITE_EMPTY 0x8000
-#define PSS_READ_FULL 0x4000
-
-/*_____ 1848 Sound Port bit defines */
-
-#define SP_IN_INIT 0x80
-#define MODE_CHANGE_ENABLE 0x40
-#define MODE_CHANGE_MASK 0xbf
-#define TRANSFER_DISABLE 0x20
-#define TRANSFER_DISABLE_MASK 0xdf
-#define ADDRESS_MASK 0xf0
-
-/*_____ Status bits */
-#define INTERRUPT_STATUS 0x01
-#define PLAYBACK_READY 0x02
-#define PLAYBACK_LEFT 0x04
-/*_____ pbright is not left */
-#define PLAYBACK_UPPER 0x08
-/*_____ bplower is not upper */
-
-#define SAMPLE_OVERRUN 0x10
-#define SAMPLE_UNDERRUN 0x10
-#define CAPTURE_READY 0x20
-#define CAPTURE_LEFT 0x40
-/*_____ cpright is not left */
-#define CAPTURE_UPPER 0x08
-/*_____ cplower is not upper */
-
-/*_____ Input & Output regs bits */
-#define LINE_INPUT 0x80
-#define AUX_INPUT 0x40
-#define MIC_INPUT 0x80
-#define MIXED_DAC_INPUT 0xC0
-#define INPUT_GAIN_MASK 0xf0
-#define INPUT_MIC_GAIN_ENABLE 0x20
-#define INPUT_MIC_GAIN_MASK 0xdf
-#define INPUT_SOURCE_MASK 0x3f
-#define AUX_INPUT_ATTEN_MASK 0xf0
-#define AUX_INPUT_MUTE 0x80
-#define AUX_INPUT_MUTE_MASK 0x7f
-#define OUTPUT_MUTE 0x80
-#define OUTPUT_MUTE_MASK 0x7f
-#define OUTPUT_ATTEN_MASK 0xc0
-
-/*_____ Clock and Data format reg bits */
-#define CLOCK_SELECT_MASK 0xfe
-#define CLOCK_XTAL2 0x01
-#define CLOCK_XTAL1 0x00
-#define CLOCK_FREQ_MASK 0xf1
-#define STEREO_MONO_MASK 0xef
-#define STEREO 0x10
-#define AUDIO_MONO 0x00
-#define LINEAR_COMP_MASK 0xdf
-#define LINEAR 0x00
-#define COMPANDED 0x20
-#define FORMAT_MASK 0xbf
-#define PCM 0x00
-#define ULAW 0x00
-#define TWOS_COMP 0x40
-#define ALAW 0x40
-
-/*_____ Interface Configuration reg bits */
-#define PLAYBACK_ENABLE 0x01
-#define PLAYBACK_ENABLE_MASK 0xfe
-#define CAPTURE_ENABLE 0x02
-#define CAPTURE_ENABLE_MASK 0xfd
-#define SINGLE_DMA 0x04
-#define SINGLE_DMA_MASK 0xfb
-#define DUAL_DMA 0x00
-#define AUTO_CAL_ENABLE 0x08
-#define AUTO_CAL_DISABLE_MASK 0xf7
-#define PLAYBACK_PIO_ENABLE 0x40
-#define PLAYBACK_DMA_MASK 0xbf
-#define CAPTURE_PIO_ENABLE 0x80
-#define CAPTURE_DMA_MASK 0x7f
-
-/*_____ Pin control bits */
-#define INTERRUPT_ENABLE 0x02
-#define INTERRUPT_MASK 0xfd
-
-/*_____ Test and init reg bits */
-#define OVERRANGE_LEFT_MASK 0xfc
-#define OVERRANGE_RIGHT_MASK 0xf3
-#define DATA_REQUEST_STATUS 0x10
-#define AUTO_CAL_IN_PROG 0x20
-#define PLAYBACK_UNDERRUN 0x40
-#define CAPTURE_UNDERRUN 0x80
-
-/*_____ Miscellaneous Control reg bits */
-#define ID_MASK 0xf0
-
-/*_____ Digital Mix Control reg bits */
-#define DIGITAL_MIX1_MUTE_MASK 0xfe
-#define MIX_ATTEN_MASK 0x03
-
-/*_____ 1848 Sound Port reg defines */
-
-#define SP_LEFT_INPUT_CONTROL 0x0
-#define SP_RIGHT_INPUT_CONTROL 0x1
-#define SP_LEFT_AUX1_CONTROL 0x2
-#define SP_RIGHT_AUX1_CONTROL 0x3
-#define SP_LEFT_AUX2_CONTROL 0x4
-#define SP_RIGHT_AUX2_CONTROL 0x5
-#define SP_LEFT_OUTPUT_CONTROL 0x6
-#define SP_RIGHT_OUTPUT_CONTROL 0x7
-#define SP_CLOCK_DATA_FORMAT 0x8
-#define SP_INTERFACE_CONFIG 0x9
-#define SP_PIN_CONTROL 0xA
-#define SP_TEST_AND_INIT 0xB
-#define SP_MISC_INFO 0xC
-#define SP_DIGITAL_MIX 0xD
-#define SP_UPPER_BASE_COUNT 0xE
-#define SP_LOWER_BASE_COUNT 0xF
-
-#define HOST_SP_ADDR (0x534)
-#define HOST_SP_DATA (0x535)
-
-
-/******************************************************************************
-
- phillips.h
-
- Version 1.2 9/27/93
-
- Copyright (c) 1993 Analog Devices Inc. All rights reserved
-
-******************************************************************************/
-/*_____ Phillips control SW defines */
-
-/*_____ Settings and ranges */
-#define VOLUME_MAX 6
-#define VOLUME_MIN (-64)
-#define VOLUME_RANGE 70
-#define VOLUME_STEP 2
-#define BASS_MAX 15
-#define BASS_MIN (-12)
-#define BASS_STEP 2
-#define BASS_RANGE 27
-#define TREBLE_MAX 12
-#define TREBLE_MIN (-12)
-#define TREBLE_STEP 2
-#define TREBLE_RANGE 24
-
-#define VOLUME_CONSTANT 252
-#define BASS_CONSTANT 246
-#define TREBLE_CONSTANT 246
-
-/*_____ Software commands */
-#define SET_MASTER_COMMAND 0x0010
-#define MASTER_VOLUME_LEFT 0x0000
-#define MASTER_VOLUME_RIGHT 0x0100
-#define MASTER_BASS 0x0200
-#define MASTER_TREBLE 0x0300
-#define MASTER_SWITCH 0x0800
-
-#define STEREO_MODE 0x00ce
-#define PSEUDO_MODE 0x00d6
-#define SPATIAL_MODE 0x00de
-#define MONO_MODE 0x00c6
-
-
-#define PSS_STEREO 0x00ce
-#define PSS_PSEUDO 0x00d6
-#define PSS_SPATIAL 0x00de
-#define PSS_MONO 0x00c6
-
-#define PHILLIPS_VOL_MIN -64
-#define PHILLIPS_VOL_MAX 6
-#define PHILLIPS_VOL_DELTA 70
-#define PHILLIPS_VOL_INITIAL -20
-#define PHILLIPS_VOL_CONSTANT 252
-#define PHILLIPS_VOL_STEP 2
-#define PHILLIPS_BASS_MIN -12
-#define PHILLIPS_BASS_MAX 15
-#define PHILLIPS_BASS_DELTA 27
-#define PHILLIPS_BASS_INITIAL 0
-#define PHILLIPS_BASS_CONSTANT 246
-#define PHILLIPS_BASS_STEP 2
-#define PHILLIPS_TREBLE_MIN -12
-#define PHILLIPS_TREBLE_MAX 12
-#define PHILLIPS_TREBLE_DELTA 24
-#define PHILLIPS_TREBLE_INITIAL 0
-#define PHILLIPS_TREBLE_CONSTANT 246
-#define PHILLIPS_TREBLE_STEP 2
-
diff --git a/sys/i386/isa/sound/soundcard.h b/sys/i386/isa/sound/soundcard.h
deleted file mode 100644
index 02d0da7..0000000
--- a/sys/i386/isa/sound/soundcard.h
+++ /dev/null
@@ -1,1045 +0,0 @@
-#ifndef SOUNDCARD_H
-#define SOUNDCARD_H
-/*
- * Copyright by Hannu Savolainen 1993
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *
- */
-
- /*
- * If you make modifications to this file, please contact me before
- * distributing the modified version. There is already enough
- * divercity in the world.
- *
- * Regards,
- * Hannu Savolainen
- * hannu@voxware.pp.fi
- */
-
-#define SOUND_VERSION 301
-#define VOXWARE
-
-#include <sys/ioctl.h>
-
-/*
- * Supported card ID numbers (Should be somewhere else?)
- */
-
-#define SNDCARD_ADLIB 1
-#define SNDCARD_SB 2
-#define SNDCARD_PAS 3
-#define SNDCARD_GUS 4
-#define SNDCARD_MPU401 5
-#define SNDCARD_SB16 6
-#define SNDCARD_SB16MIDI 7
-#define SNDCARD_UART6850 8
-#define SNDCARD_GUS16 9
-#define SNDCARD_MSS 10
-#define SNDCARD_PSS 11
-#define SNDCARD_SSCAPE 12
-#define SNDCARD_PSS_MPU 13
-#define SNDCARD_PSS_MSS 14
-#define SNDCARD_SSCAPE_MSS 15
-#define SNDCARD_TRXPRO 16
-#define SNDCARD_TRXPRO_SB 17
-#define SNDCARD_TRXPRO_MPU 18
-
-/***********************************
- * IOCTL Commands for /dev/sequencer
- */
-
-#ifndef _IOWR
-/* @(#)ioctlp.h */
-
-/* Ioctl's have the command encoded in the lower word,
- * and the size of any in or out parameters in the upper
- * word. The high 2 bits of the upper word are used
- * to encode the in/out status of the parameter; for now
- * we restrict parameters to at most 128 bytes.
- */
-/* #define IOCTYPE (0xff<<8) */
-#define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */
-#define IOC_VOID 0x00000000 /* no parameters */
-#define IOC_OUT 0x20000000 /* copy out parameters */
-#define IOC_IN 0x40000000 /* copy in parameters */
-#define IOC_INOUT (IOC_IN|IOC_OUT)
-/* the 0x20000000 is so we can distinguish new ioctl's from old */
-#define _IO(x,y) ((int)(IOC_VOID|(x<<8)|y))
-#define _IOR(x,y,t) ((int)(IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y))
-#define _IOW(x,y,t) ((int)(IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y))
-/* this should be _IORW, but stdio got there first */
-#define _IOWR(x,y,t) ((int)(IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y))
-#endif /* !_IOWR */
-
-#define SNDCTL_SEQ_RESET _IO ('Q', 0)
-#define SNDCTL_SEQ_SYNC _IO ('Q', 1)
-#define SNDCTL_SYNTH_INFO _IOWR('Q', 2, struct synth_info)
-#define SNDCTL_SEQ_CTRLRATE _IOWR('Q', 3, int) /* Set/get timer resolution (HZ) */
-#define SNDCTL_SEQ_GETOUTCOUNT _IOR ('Q', 4, int)
-#define SNDCTL_SEQ_GETINCOUNT _IOR ('Q', 5, int)
-#define SNDCTL_SEQ_PERCMODE _IOW ('Q', 6, int)
-#define SNDCTL_FM_LOAD_INSTR _IOW ('Q', 7, struct sbi_instrument) /* Valid for FM only */
-#define SNDCTL_SEQ_TESTMIDI _IOW ('Q', 8, int)
-#define SNDCTL_SEQ_RESETSAMPLES _IOW ('Q', 9, int)
-#define SNDCTL_SEQ_NRSYNTHS _IOR ('Q',10, int)
-#define SNDCTL_SEQ_NRMIDIS _IOR ('Q',11, int)
-#define SNDCTL_MIDI_INFO _IOWR('Q',12, struct midi_info)
-#define SNDCTL_SEQ_TRESHOLD _IOW ('Q',13, int)
-#define SNDCTL_SYNTH_MEMAVL _IOWR('Q',14, int) /* in=dev#, out=memsize */
-#define SNDCTL_FM_4OP_ENABLE _IOW ('Q',15, int) /* in=dev# */
-#define SNDCTL_PMGR_ACCESS _IOWR('Q',16, struct patmgr_info)
-#define SNDCTL_SEQ_PANIC _IO ('Q',17)
-#define SNDCTL_SEQ_OUTOFBAND _IOW ('Q',18, struct seq_event_rec)
-
- struct seq_event_rec {
- unsigned char arr[8];
- };
-
-#define SNDCTL_TMR_TIMEBASE _IOWR('T', 1, int)
-#define SNDCTL_TMR_START _IO ('T', 2)
-#define SNDCTL_TMR_STOP _IO ('T', 3)
-#define SNDCTL_TMR_CONTINUE _IO ('T', 4)
-#define SNDCTL_TMR_TEMPO _IOWR('T', 5, int)
-#define SNDCTL_TMR_SOURCE _IOWR('T', 6, int)
-# define TMR_INTERNAL 0x00000001
-# define TMR_EXTERNAL 0x00000002
-# define TMR_MODE_MIDI 0x00000010
-# define TMR_MODE_FSK 0x00000020
-# define TMR_MODE_CLS 0x00000040
-# define TMR_MODE_SMPTE 0x00000080
-#define SNDCTL_TMR_METRONOME _IOW ('T', 7, int)
-#define SNDCTL_TMR_SELECT _IOW ('T', 8, int)
-
-/*
- * Sample loading mechanism for internal synthesizers (/dev/sequencer)
- * The following patch_info structure has been designed to support
- * Gravis UltraSound. It tries to be universal format for uploading
- * sample based patches but is propably too limited.
- */
-
-struct patch_info {
- short key; /* Use GUS_PATCH here */
-#define GUS_PATCH 0x04fd
-#define OBSOLETE_GUS_PATCH 0x02fd
- short device_no; /* Synthesizer number */
- short instr_no; /* Midi pgm# */
-
- unsigned long mode;
-/*
- * The least significant byte has the same format than the GUS .PAT
- * files
- */
-#define WAVE_16_BITS 0x01 /* bit 0 = 8 or 16 bit wave data. */
-#define WAVE_UNSIGNED 0x02 /* bit 1 = Signed - Unsigned data. */
-#define WAVE_LOOPING 0x04 /* bit 2 = looping enabled-1. */
-#define WAVE_BIDIR_LOOP 0x08 /* bit 3 = Set is bidirectional looping. */
-#define WAVE_LOOP_BACK 0x10 /* bit 4 = Set is looping backward. */
-#define WAVE_SUSTAIN_ON 0x20 /* bit 5 = Turn sustaining on. (Env. pts. 3)*/
-#define WAVE_ENVELOPES 0x40 /* bit 6 = Enable envelopes - 1 */
- /* (use the env_rate/env_offs fields). */
-/* Linux specific bits */
-#define WAVE_VIBRATO 0x00010000 /* The vibrato info is valid */
-#define WAVE_TREMOLO 0x00020000 /* The tremolo info is valid */
-#define WAVE_SCALE 0x00040000 /* The scaling info is valid */
-/* Other bits must be zeroed */
-
- long len; /* Size of the wave data in bytes */
- long loop_start, loop_end; /* Byte offsets from the beginning */
-
-/*
- * The base_freq and base_note fields are used when computing the
- * playback speed for a note. The base_note defines the tone frequency
- * which is heard if the sample is played using the base_freq as the
- * playback speed.
- *
- * The low_note and high_note fields define the minimum and maximum note
- * frequencies for which this sample is valid. It is possible to define
- * more than one samples for a instrument number at the same time. The
- * low_note and high_note fields are used to select the most suitable one.
- *
- * The fields base_note, high_note and low_note should contain
- * the note frequency multiplied by 1000. For example value for the
- * middle A is 440*1000.
- */
-
- unsigned int base_freq;
- unsigned long base_note;
- unsigned long high_note;
- unsigned long low_note;
- int panning; /* -128=left, 127=right */
- int detuning;
-
-/* New fields introduced in version 1.99.5 */
-
- /* Envelope. Enabled by mode bit WAVE_ENVELOPES */
- unsigned char env_rate[ 6 ]; /* GUS HW ramping rate */
- unsigned char env_offset[ 6 ]; /* 255 == 100% */
-
- /*
- * The tremolo, vibrato and scale info are not supported yet.
- * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or
- * WAVE_SCALE
- */
-
- unsigned char tremolo_sweep;
- unsigned char tremolo_rate;
- unsigned char tremolo_depth;
-
- unsigned char vibrato_sweep;
- unsigned char vibrato_rate;
- unsigned char vibrato_depth;
-
- int scale_frequency;
- unsigned int scale_factor; /* from 0 to 2048 or 0 to 2 */
-
- int volume;
- int spare[4];
- char data[1]; /* The waveform data starts here */
- };
-
-
-struct sysex_info {
- short key; /* Use GUS_PATCH here */
-#define SYSEX_PATCH 0x05fd
- short device_no; /* Synthesizer number */
- long len; /* Size of the sysex data in bytes */
- unsigned char data[1]; /* Sysex data starts here */
- };
-
-/*
- * Patch management interface (/dev/sequencer, /dev/patmgr#)
- * Don't use these calls if you want to maintain compatibility with
- * the future versions of the driver.
- */
-
-#define PS_NO_PATCHES 0 /* No patch support on device */
-#define PS_MGR_NOT_OK 1 /* Plain patch support (no mgr) */
-#define PS_MGR_OK 2 /* Patch manager supported */
-#define PS_MANAGED 3 /* Patch manager running */
-
-#define SNDCTL_PMGR_IFACE _IOWR('P', 1, struct patmgr_info)
-
-/*
- * The patmgr_info is a fixed size structure which is used for two
- * different purposes. The intended use is for communication between
- * the application using /dev/sequencer and the patch manager daemon
- * associated with a synthesizer device (ioctl(SNDCTL_PMGR_ACCESS)).
- *
- * This structure is also used with ioctl(SNDCTL_PGMR_IFACE) which allows
- * a patch manager daemon to read and write device parameters. This
- * ioctl available through /dev/sequencer also. Avoid using it since it's
- * extremely hardware dependent. In addition access trough /dev/sequencer
- * may confuse the patch manager daemon.
- */
-
-struct patmgr_info { /* Note! size must be < 4k since kmalloc() is used */
- unsigned long key; /* Don't worry. Reserved for communication
- between the patch manager and the driver. */
-#define PM_K_EVENT 1 /* Event from the /dev/sequencer driver */
-#define PM_K_COMMAND 2 /* Request from a application */
-#define PM_K_RESPONSE 3 /* From patmgr to application */
-#define PM_ERROR 4 /* Error returned by the patmgr */
- int device;
- int command;
-
-/*
- * Commands 0x000 to 0xfff reserved for patch manager programs
- */
-#define PM_GET_DEVTYPE 1 /* Returns type of the patch mgr interface of dev */
-#define PMTYPE_FM2 1 /* 2 OP fm */
-#define PMTYPE_FM4 2 /* Mixed 4 or 2 op FM (OPL-3) */
-#define PMTYPE_WAVE 3 /* Wave table synthesizer (GUS) */
-#define PM_GET_NRPGM 2 /* Returns max # of midi programs in parm1 */
-#define PM_GET_PGMMAP 3 /* Returns map of loaded midi programs in data8 */
-#define PM_GET_PGM_PATCHES 4 /* Return list of patches of a program (parm1) */
-#define PM_GET_PATCH 5 /* Return patch header of patch parm1 */
-#define PM_SET_PATCH 6 /* Set patch header of patch parm1 */
-#define PM_READ_PATCH 7 /* Read patch (wave) data */
-#define PM_WRITE_PATCH 8 /* Write patch (wave) data */
-
-/*
- * Commands 0x1000 to 0xffff are for communication between the patch manager
- * and the client
- */
-#define _PM_LOAD_PATCH 0x100
-
-/*
- * Commands above 0xffff reserved for device specific use
- */
-
- long parm1;
- long parm2;
- long parm3;
-
- union {
- unsigned char data8[4000];
- unsigned short data16[2000];
- unsigned long data32[1000];
- struct patch_info patch;
- } data;
- };
-
-/*
- * When a patch manager daemon is present, it will be informed by the
- * driver when something important happens. For example when the
- * /dev/sequencer is opened or closed. A record with key == PM_K_EVENT is
- * returned. The command field contains the event type:
- */
-#define PM_E_OPENED 1 /* /dev/sequencer opened */
-#define PM_E_CLOSED 2 /* /dev/sequencer closed */
-#define PM_E_PATCH_RESET 3 /* SNDCTL_RESETSAMPLES called */
-#define PM_E_PATCH_LOADED 4 /* A patch has been loaded by appl */
-
-/*
- * /dev/sequencer input events.
- *
- * The data written to the /dev/sequencer is a stream of events. Events
- * are records of 4 or 8 bytes. The first byte defines the size.
- * Any number of events can be written with a write call. There
- * is a set of macros for sending these events. Use these macros if you
- * want to maximize portability of your program.
- *
- * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events.
- * (All input events are currently 4 bytes long. Be prepared to support
- * 8 byte events also. If you receive any event having first byte >= 128,
- * it's a 8 byte event.
- *
- * The events are documented at the end of this file.
- *
- * Normal events (4 bytes)
- * There is also a 8 byte version of most of the 4 byte events. The
- * 8 byte one is recommended.
- */
-#define SEQ_NOTEOFF 0
-#define SEQ_FMNOTEOFF SEQ_NOTEOFF /* Just old name */
-#define SEQ_NOTEON 1
-#define SEQ_FMNOTEON SEQ_NOTEON
-#define SEQ_WAIT TMR_WAIT_ABS
-#define SEQ_PGMCHANGE 3
-#define SEQ_FMPGMCHANGE SEQ_PGMCHANGE
-#define SEQ_SYNCTIMER TMR_START
-#define SEQ_MIDIPUTC 5
-#define SEQ_DRUMON 6 /*** OBSOLETE ***/
-#define SEQ_DRUMOFF 7 /*** OBSOLETE ***/
-#define SEQ_ECHO TMR_ECHO /* For synching programs with output */
-#define SEQ_AFTERTOUCH 9
-#define SEQ_CONTROLLER 10
-
-/*******************************************
- * Midi controller numbers
- *******************************************
- * Controllers 0 to 31 (0x00 to 0x1f) and
- * 32 to 63 (0x20 to 0x3f) are continuous
- * controllers.
- * In the MIDI 1.0 these controllers are sent using
- * two messages. Controller numbers 0 to 31 are used
- * to send the MSB and the controller numbers 32 to 63
- * are for the LSB. Note that just 7 bits are used in MIDI bytes.
- */
-
-#define CTL_BANK_SELECT 0x00
-#define CTL_MODWHEEL 0x01
-#define CTL_BREATH 0x02
-/* undefined 0x03 */
-#define CTL_FOOT 0x04
-#define CTL_PORTAMENTO_TIME 0x05
-#define CTL_DATA_ENTRY 0x06
-#define CTL_MAIN_VOLUME 0x07
-#define CTL_BALANCE 0x08
-/* undefined 0x09 */
-#define CTL_PAN 0x0a
-#define CTL_EXPRESSION 0x0b
-/* undefined 0x0c */
-/* undefined 0x0d */
-/* undefined 0x0e */
-/* undefined 0x0f */
-#define CTL_GENERAL_PURPOSE1 0x10
-#define CTL_GENERAL_PURPOSE2 0x11
-#define CTL_GENERAL_PURPOSE3 0x12
-#define CTL_GENERAL_PURPOSE4 0x13
-/* undefined 0x14 - 0x1f */
-
-/* undefined 0x20 */
-/* The controller numbers 0x21 to 0x3f are reserved for the */
-/* least significant bytes of the controllers 0x00 to 0x1f. */
-/* These controllers are not recognised by the driver. */
-
-/* Controllers 64 to 69 (0x40 to 0x45) are on/off switches. */
-/* 0=OFF and 127=ON (intermediate values are possible) */
-#define CTL_DAMPER_PEDAL 0x40
-#define CTL_SUSTAIN 0x40 /* Alias */
-#define CTL_HOLD 0x40 /* Alias */
-#define CTL_PORTAMENTO 0x41
-#define CTL_SOSTENUTO 0x42
-#define CTL_SOFT_PEDAL 0x43
-/* undefined 0x44 */
-#define CTL_HOLD2 0x45
-/* undefined 0x46 - 0x4f */
-
-#define CTL_GENERAL_PURPOSE5 0x50
-#define CTL_GENERAL_PURPOSE6 0x51
-#define CTL_GENERAL_PURPOSE7 0x52
-#define CTL_GENERAL_PURPOSE8 0x53
-/* undefined 0x54 - 0x5a */
-#define CTL_EXT_EFF_DEPTH 0x5b
-#define CTL_TREMOLO_DEPTH 0x5c
-#define CTL_CHORUS_DEPTH 0x5d
-#define CTL_DETUNE_DEPTH 0x5e
-#define CTL_CELESTE_DEPTH 0x5e /* Alias for the above one */
-#define CTL_PHASER_DEPTH 0x5f
-#define CTL_DATA_INCREMENT 0x60
-#define CTL_DATA_DECREMENT 0x61
-#define CTL_NONREG_PARM_NUM_LSB 0x62
-#define CTL_NONREG_PARM_NUM_MSB 0x63
-#define CTL_REGIST_PARM_NUM_LSB 0x64
-#define CTL_REGIST_PARM_NUM_MSB 0x65
-/* undefined 0x66 - 0x78 */
-/* reserved 0x79 - 0x7f */
-
-/* Pseudo controllers (not midi compatible) */
-#define CTRL_PITCH_BENDER 255
-#define CTRL_PITCH_BENDER_RANGE 254
-#define CTRL_EXPRESSION 253 /* Obsolete */
-#define CTRL_MAIN_VOLUME 252 /* Obsolete */
-#define SEQ_BALANCE 11
-#define SEQ_VOLMODE 12
-
-/*
- * Volume mode decides how volumes are used
- */
-
-#define VOL_METHOD_ADAGIO 1
-#define VOL_METHOD_LINEAR 2
-
-/*
- * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as
- * input events.
- */
-
-/*
- * Event codes 0xf0 to 0xfc are reserved for future extensions.
- */
-
-#define SEQ_FULLSIZE 0xfd /* Long events */
-/*
- * SEQ_FULLSIZE events are used for loading patches/samples to the
- * synthesizer devices. These events are passed directly to the driver
- * of the associated synthesizer device. There is no limit to the size
- * of the extended events. These events are not queued but executed
- * immediately when the write() is called (execution can take several
- * seconds of time).
- *
- * When a SEQ_FULLSIZE message is written to the device, it must
- * be written using exactly one write() call. Other events cannot
- * be mixed to the same write.
- *
- * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the
- * /dev/sequencer. Don't write other data together with the instrument structure
- * Set the key field of the structure to FM_PATCH. The device field is used to
- * route the patch to the corresponding device.
- *
- * For Gravis UltraSound use struct patch_info. Initialize the key field
- * to GUS_PATCH.
- */
-#define SEQ_PRIVATE 0xfe /* Low level HW dependent events (8 bytes) */
-#define SEQ_EXTENDED 0xff /* Extended events (8 bytes) OBSOLETE */
-
-/*
- * Record for FM patches
- */
-
-typedef unsigned char sbi_instr_data[32];
-
-struct sbi_instrument {
- unsigned short key; /* Initialize to FM_PATCH or OPL3_PATCH */
-#define FM_PATCH 0x01fd
-#define OPL3_PATCH 0x03fd
- short device; /* Synth# (0-4) */
- int channel; /* Program# to be initialized */
- sbi_instr_data operators; /* Register settings for operator cells (.SBI format) */
- };
-
-struct synth_info { /* Read only */
- char name[30];
- int device; /* 0-N. INITIALIZE BEFORE CALLING */
- int synth_type;
-#define SYNTH_TYPE_FM 0
-#define SYNTH_TYPE_SAMPLE 1
-#define SYNTH_TYPE_MIDI 2 /* Midi interface */
-
- int synth_subtype;
-#define FM_TYPE_ADLIB 0x00
-#define FM_TYPE_OPL3 0x01
-
-#define SAMPLE_TYPE_GUS 0x10
-
- int perc_mode; /* No longer supported */
- int nr_voices;
- int nr_drums; /* Obsolete field */
- int instr_bank_size;
- unsigned long capabilities;
-#define SYNTH_CAP_PERCMODE 0x00000001 /* No longer used */
-#define SYNTH_CAP_OPL3 0x00000002 /* Set if OPL3 supported */
-#define SYNTH_CAP_INPUT 0x00000004 /* Input (MIDI) device */
- int dummies[19]; /* Reserve space */
- };
-
-struct sound_timer_info {
- char name[30];
- int caps;
- };
-
-#define MIDI_CAP_MPU401 1 /* MPU-401 intelligent mode */
-
-struct midi_info {
- char name[30];
- int device; /* 0-N. INITIALIZE BEFORE CALLING */
- unsigned long capabilities; /* To be defined later */
- int dev_type;
- int dummies[18]; /* Reserve space */
- };
-
-/********************************************
- * ioctl commands for the /dev/midi##
- */
-typedef struct {
- unsigned char cmd;
- char nr_args, nr_returns;
- unsigned char data[30];
- } mpu_command_rec;
-
-#define SNDCTL_MIDI_PRETIME _IOWR('m', 0, int)
-#define SNDCTL_MIDI_MPUMODE _IOWR('m', 1, int)
-#define SNDCTL_MIDI_MPUCMD _IOWR('m', 2, mpu_command_rec)
-
-/********************************************
- * IOCTL commands for /dev/dsp and /dev/audio
- */
-
-#define SNDCTL_DSP_RESET _IO ('P', 0)
-#define SNDCTL_DSP_SYNC _IO ('P', 1)
-#define SNDCTL_DSP_SPEED _IOWR('P', 2, int)
-#define SNDCTL_DSP_STEREO _IOWR('P', 3, int)
-#define SNDCTL_DSP_GETBLKSIZE _IOR('P', 4, int)
-#define SNDCTL_DSP_SETBLKSIZE _IOW('P', 4, int)
-#define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT
-#define SOUND_PCM_WRITE_CHANNELS _IOWR('P', 6, int)
-#define SOUND_PCM_WRITE_FILTER _IOWR('P', 7, int)
-#define SNDCTL_DSP_POST _IO ('P', 8)
-#define SNDCTL_DSP_SUBDIVIDE _IOWR('P', 9, int)
-#define SNDCTL_DSP_SETFRAGMENT _IOWR('P',10, int)
-
-/* Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */
-#define SNDCTL_DSP_GETFMTS _IOR ('P',11, int) /* Returns a mask */
-#define SNDCTL_DSP_SETFMT _IOWR('P',5, int) /* Selects ONE fmt*/
-# define AFMT_QUERY 0x00000000 /* Return current fmt */
-# define AFMT_MU_LAW 0x00000001
-# define AFMT_A_LAW 0x00000002
-# define AFMT_IMA_ADPCM 0x00000004
-# define AFMT_U8 0x00000008
-# define AFMT_S16_LE 0x00000010 /* Little endian signed 16*/
-# define AFMT_S16_BE 0x00000020 /* Big endian signed 16 */
-# define AFMT_S8 0x00000040
-# define AFMT_U16_LE 0x00000080 /* Little endian U16 */
-# define AFMT_U16_BE 0x00000100 /* Big endian U16 */
-# define AFMT_MPEG 0x00000200 /* MPEG (2) audio */
-
-/*
- * Buffer status queries.
- */
-typedef struct audio_buf_info {
- int fragments; /* # of available fragments (partially usend ones not counted) */
- int fragsize; /* Size of a fragment in bytes */
-
- int bytes; /* Available space in bytes (includes partially used fragments) */
- /* Note! 'bytes' could be more than fragments*fragsize */
- } audio_buf_info;
-
-#define SNDCTL_DSP_GETOSPACE _IOR ('P',12, audio_buf_info)
-#define SNDCTL_DSP_GETISPACE _IOR ('P',13, audio_buf_info)
-#define SNDCTL_DSP_NONBLOCK _IO ('P',14)
-
-#define SOUND_PCM_READ_RATE _IOR ('P', 2, int)
-#define SOUND_PCM_READ_CHANNELS _IOR ('P', 6, int)
-#define SOUND_PCM_READ_BITS _IOR ('P', 5, int)
-#define SOUND_PCM_READ_FILTER _IOR ('P', 7, int)
-
-/* Some alias names */
-#define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT
-#define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED
-#define SOUND_PCM_POST SNDCTL_DSP_POST
-#define SOUND_PCM_RESET SNDCTL_DSP_RESET
-#define SOUND_PCM_SYNC SNDCTL_DSP_SYNC
-#define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE
-#define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT
-#define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS
-#define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT
-#define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE
-#define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE
-#define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK
-
-/*
- * ioctl calls to be used in communication with coprocessors and
- * DSP chips.
- */
-
-typedef struct copr_buffer {
- int command; /* Set to 0 if not used */
- int flags;
-#define CPF_NONE 0x0000
-#define CPF_FIRST 0x0001 /* First block */
-#define CPF_LAST 0x0002 /* Last block */
- int len;
- int offs; /* If required by the device (0 if not used) */
-
- unsigned char data[4000]; /* NOTE! 4000 is not 4k */
- } copr_buffer;
-
-typedef struct copr_debug_buf {
- int command; /* Used internally. Set to 0 */
- int parm1;
- int parm2;
- int flags;
- int len; /* Length of data in bytes */
- } copr_debug_buf;
-
-typedef struct copr_msg {
- int len;
- unsigned char data[4000];
- } copr_msg;
-
-#define SNDCTL_COPR_RESET _IO ('C', 0)
-#define SNDCTL_COPR_LOAD _IOWR('C', 1, copr_buffer)
-#define SNDCTL_COPR_RDATA _IOWR('C', 2, copr_debug_buf)
-#define SNDCTL_COPR_RCODE _IOWR('C', 3, copr_debug_buf)
-#define SNDCTL_COPR_WDATA _IOW ('C', 4, copr_debug_buf)
-#define SNDCTL_COPR_WCODE _IOW ('C', 5, copr_debug_buf)
-#define SNDCTL_COPR_RUN _IOWR('C', 6, copr_debug_buf)
-#define SNDCTL_COPR_HALT _IOWR('C', 7, copr_debug_buf)
-#define SNDCTL_COPR_SENDMSG _IOW ('C', 8, copr_msg)
-#define SNDCTL_COPR_RCVMSG _IOR ('C', 9, copr_msg)
-
-/*********************************************
- * IOCTL commands for /dev/mixer
- */
-
-/*
- * Mixer devices
- *
- * There can be up to 20 different analog mixer channels. The
- * SOUND_MIXER_NRDEVICES gives the currently supported maximum.
- * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells
- * the devices supported by the particular mixer.
- */
-
-#define SOUND_MIXER_NRDEVICES 17
-#define SOUND_MIXER_VOLUME 0
-#define SOUND_MIXER_BASS 1
-#define SOUND_MIXER_TREBLE 2
-#define SOUND_MIXER_SYNTH 3
-#define SOUND_MIXER_PCM 4
-#define SOUND_MIXER_SPEAKER 5
-#define SOUND_MIXER_LINE 6
-#define SOUND_MIXER_MIC 7
-#define SOUND_MIXER_CD 8
-#define SOUND_MIXER_IMIX 9 /* Recording monitor */
-#define SOUND_MIXER_ALTPCM 10
-#define SOUND_MIXER_RECLEV 11 /* Recording level */
-#define SOUND_MIXER_IGAIN 12 /* Input gain */
-#define SOUND_MIXER_OGAIN 13 /* Output gain */
-/*
- * The AD1848 codec and compatibles have three line level inputs
- * (line, aux1 and aux2). Since each card manufacturer have assigned
- * different meanings to these inputs, it's inpractical to assign
- * specific meanings (line, cd, synth etc.) to them.
- */
-#define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */
-#define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */
-#define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */
-
-/* Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) */
-/* Not counted to SOUND_MIXER_NRDEVICES, but use the same number space */
-#define SOUND_ONOFF_MIN 28
-#define SOUND_ONOFF_MAX 30
-#define SOUND_MIXER_MUTE 28 /* 0 or 1 */
-#define SOUND_MIXER_ENHANCE 29 /* Enhanced stereo (0, 40, 60 or 80) */
-#define SOUND_MIXER_LOUD 30 /* 0 or 1 */
-
-/* Note! Number 31 cannot be used since the sign bit is reserved */
-
-#define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \
- "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \
- "Line1", "Line2", "Line3"}
-
-#define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \
- "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \
- "line1", "line2", "line3"}
-
-/* Device bitmask identifiers */
-
-#define SOUND_MIXER_RECSRC 0xff /* Arg contains a bit for each recording source */
-#define SOUND_MIXER_DEVMASK 0xfe /* Arg contains a bit for each supported device */
-#define SOUND_MIXER_RECMASK 0xfd /* Arg contains a bit for each supported recording source */
-#define SOUND_MIXER_CAPS 0xfc
- #define SOUND_CAP_EXCL_INPUT 0x00000001 /* Only one recording source at a time */
-#define SOUND_MIXER_STEREODEVS 0xfb /* Mixer channels supporting stereo */
-
-/* Device mask bits */
-
-#define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME)
-#define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS)
-#define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE)
-#define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH)
-#define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM)
-#define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER)
-#define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE)
-#define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC)
-#define SOUND_MASK_CD (1 << SOUND_MIXER_CD)
-#define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX)
-#define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM)
-#define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV)
-#define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN)
-#define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN)
-#define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1)
-#define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2)
-#define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3)
-
-#define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE)
-#define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE)
-#define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD)
-
-#define MIXER_READ(dev) _IOR('M', dev, int)
-#define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME)
-#define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS)
-#define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE)
-#define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH)
-#define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM)
-#define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER)
-#define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE)
-#define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC)
-#define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD)
-#define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX)
-#define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM)
-#define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV)
-#define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN)
-#define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN)
-#define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1)
-#define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2)
-#define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3)
-#define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE)
-#define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE)
-#define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD)
-
-#define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC)
-#define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK)
-#define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK)
-#define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS)
-#define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS)
-
-#define MIXER_WRITE(dev) _IOWR('M', dev, int)
-#define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME)
-#define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS)
-#define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE)
-#define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH)
-#define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM)
-#define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER)
-#define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE)
-#define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC)
-#define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD)
-#define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX)
-#define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM)
-#define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV)
-#define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN)
-#define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN)
-#define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1)
-#define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2)
-#define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3)
-#define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE)
-#define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE)
-#define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD)
-
-#define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC)
-
-/*
- * Level 2 event types for /dev/sequencer
- */
-
-/*
- * The 4 most significant bits of byte 0 specify the class of
- * the event:
- *
- * 0x8X = system level events,
- * 0x9X = device/port specific events, event[1] = device/port,
- * The last 4 bits give the subtype:
- * 0x02 = Channel event (event[3] = chn).
- * 0x01 = note event (event[4] = note).
- * (0x01 is not used alone but always with bit 0x02).
- * event[2] = MIDI message code (0x80=note off etc.)
- *
- */
-
-#define EV_SEQ_LOCAL 0x80
-#define EV_TIMING 0x81
-#define EV_CHN_COMMON 0x92
-#define EV_CHN_VOICE 0x93
-/*
- * Event types 200 to 220 are reserved for application use.
- * These numbers will not be used by the driver.
- */
-
-/*
- * Events for event type EV_CHN_VOICE
- */
-
-#define MIDI_NOTEOFF 0x80
-#define MIDI_NOTEON 0x90
-#define MIDI_KEY_PRESSURE 0xA0
-
-/*
- * Events for event type EV_CHN_COMMON
- */
-
-#define MIDI_CTL_CHANGE 0xB0
-#define MIDI_PGM_CHANGE 0xC0
-#define MIDI_CHN_PRESSURE 0xD0
-#define MIDI_PITCH_BEND 0xE0
-
-#define MIDI_SYSTEM_PREFIX 0xF0
-
-/*
- * Timer event types
- */
-#define TMR_WAIT_REL 1 /* Time relative to the prev time */
-#define TMR_WAIT_ABS 2 /* Absolute time since TMR_START */
-#define TMR_STOP 3
-#define TMR_START 4
-#define TMR_CONTINUE 5
-#define TMR_TEMPO 6
-#define TMR_ECHO 8
-#define TMR_CLOCK 9 /* MIDI clock */
-#define TMR_SPP 10 /* Song position pointer */
-#define TMR_TIMESIG 11 /* Time signature */
-
-#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
-/*
- * Some convenience macros to simplify programming of the
- * /dev/sequencer interface
- *
- * These macros define the API which should be used when possible.
- */
-
-#ifndef USE_SIMPLE_MACROS
-void seqbuf_dump(void); /* This function must be provided by programs */
-
-/* Sample seqbuf_dump() implementation:
- *
- * SEQ_DEFINEBUF (2048); -- Defines a buffer for 2048 bytes
- *
- * int seqfd; -- The file descriptor for /dev/sequencer.
- *
- * void
- * seqbuf_dump ()
- * {
- * if (_seqbufptr)
- * if (write (seqfd, _seqbuf, _seqbufptr) == -1)
- * {
- * perror ("write /dev/sequencer");
- * exit (-1);
- * }
- * _seqbufptr = 0;
- * }
- */
-
-#define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0
-#define SEQ_USE_EXTBUF() extern unsigned char _seqbuf[]; extern int _seqbuflen;extern int _seqbufptr
-#define SEQ_DECLAREBUF() SEQ_USE_EXTBUF()
-#define SEQ_PM_DEFINES struct patmgr_info _pm_info
-#define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump()
-#define _SEQ_ADVBUF(len) _seqbufptr += len
-#define SEQ_DUMPBUF seqbuf_dump
-#else
-/*
- * This variation of the sequencer macros is used just to format one event
- * using fixed buffer.
- *
- * The program using the macro library must define the following macros before
- * using this library.
- *
- * #define _seqbuf name of the buffer (unsigned char[])
- * #define _SEQ_ADVBUF(len) If the applic needs to know the exact
- * size of the event, this macro can be used.
- * Otherwise this must be defined as empty.
- * #define _seqbufptr Define the name of index variable or 0 if
- * not required.
- */
-#define _SEQ_NEEDBUF(len) /* empty */
-#endif
-
-#define PM_LOAD_PATCH(dev, bank, pgm) (SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \
- _pm_info.device=dev, _pm_info.data.data8[0]=pgm, \
- _pm_info.parm1 = bank, _pm_info.parm2 = 1, \
- ioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info))
-#define PM_LOAD_PATCHES(dev, bank, pgm) (SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \
- _pm_info.device=dev, memcpy(_pm_info.data.data8, pgm, 128), \
- _pm_info.parm1 = bank, _pm_info.parm2 = 128, \
- ioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info))
-
-#define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8);\
- _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
- _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\
- _seqbuf[_seqbufptr+2] = (dev);\
- _seqbuf[_seqbufptr+3] = (mode);\
- _seqbuf[_seqbufptr+4] = 0;\
- _seqbuf[_seqbufptr+5] = 0;\
- _seqbuf[_seqbufptr+6] = 0;\
- _seqbuf[_seqbufptr+7] = 0;\
- _SEQ_ADVBUF(8);}
-
-/*
- * Midi voice messages
- */
-
-#define _CHN_VOICE(dev, event, chn, note, parm) \
- {_SEQ_NEEDBUF(8);\
- _seqbuf[_seqbufptr] = EV_CHN_VOICE;\
- _seqbuf[_seqbufptr+1] = (dev);\
- _seqbuf[_seqbufptr+2] = (event);\
- _seqbuf[_seqbufptr+3] = (chn);\
- _seqbuf[_seqbufptr+4] = (note);\
- _seqbuf[_seqbufptr+5] = (parm);\
- _seqbuf[_seqbufptr+6] = (0);\
- _seqbuf[_seqbufptr+7] = 0;\
- _SEQ_ADVBUF(8);}
-
-#define SEQ_START_NOTE(dev, chn, note, vol) \
- _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol)
-
-#define SEQ_STOP_NOTE(dev, chn, note, vol) \
- _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol)
-
-#define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \
- _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure)
-
-/*
- * Midi channel messages
- */
-
-#define _CHN_COMMON(dev, event, chn, p1, p2, w14) \
- {_SEQ_NEEDBUF(8);\
- _seqbuf[_seqbufptr] = EV_CHN_COMMON;\
- _seqbuf[_seqbufptr+1] = (dev);\
- _seqbuf[_seqbufptr+2] = (event);\
- _seqbuf[_seqbufptr+3] = (chn);\
- _seqbuf[_seqbufptr+4] = (p1);\
- _seqbuf[_seqbufptr+5] = (p2);\
- *(short *)&_seqbuf[_seqbufptr+6] = (w14);\
- _SEQ_ADVBUF(8);}
-
-#define SEQ_CHN_PRESSURE(dev, chn, pressure) \
- _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)
-
-#define SEQ_SET_PATCH(dev, chn, patch) \
- _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)
-
-#define SEQ_CONTROL(dev, chn, controller, value) \
- _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
-
-#define SEQ_BENDER(dev, chn, value) \
- _CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value)
-
-
-#define SEQ_V2_X_CONTROL(dev, voice, controller, value) {_SEQ_NEEDBUF(8);\
- _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
- _seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\
- _seqbuf[_seqbufptr+2] = (dev);\
- _seqbuf[_seqbufptr+3] = (voice);\
- _seqbuf[_seqbufptr+4] = (controller);\
- *(short *)&_seqbuf[_seqbufptr+5] = (value);\
- _seqbuf[_seqbufptr+7] = 0;\
- _SEQ_ADVBUF(8);}
-/*
- * The following 5 macros are incorrectly implemented and obsolete.
- * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead.
- */
-#define SEQ_PITCHBEND(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value)
-#define SEQ_BENDER_RANGE(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value)
-#define SEQ_EXPRESSION(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128)
-#define SEQ_MAIN_VOLUME(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100)
-#define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2)
-#if 0
-#define SEQ_PANNING(dev, voice, pos) {_SEQ_NEEDBUF(8);\
- _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
- _seqbuf[_seqbufptr+1] = SEQ_BALANCE;\
- _seqbuf[_seqbufptr+2] = (dev);\
- _seqbuf[_seqbufptr+3] = (voice);\
- (char)_seqbuf[_seqbufptr+4] = (pos);\
- _seqbuf[_seqbufptr+5] = 0;\
- _seqbuf[_seqbufptr+6] = 0;\
- _seqbuf[_seqbufptr+7] = 1;\
- _SEQ_ADVBUF(8);}
-#endif
-
-/*
- * Timing and syncronization macros
- */
-
-#define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
- _seqbuf[_seqbufptr+0] = EV_TIMING; \
- _seqbuf[_seqbufptr+1] = (ev); \
- _seqbuf[_seqbufptr+2] = 0;\
- _seqbuf[_seqbufptr+3] = 0;\
- *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
- _SEQ_ADVBUF(8);}
-
-#define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0)
-#define SEQ_STOP_TIMER() _TIMER_EVENT(TMR_STOP, 0)
-#define SEQ_CONTINUE_TIMER() _TIMER_EVENT(TMR_CONTINUE, 0)
-#define SEQ_WAIT_TIME(ticks) _TIMER_EVENT(TMR_WAIT_ABS, ticks)
-#define SEQ_DELTA_TIME(ticks) _TIMER_EVENT(TMR_WAIT_REL, ticks)
-#define SEQ_ECHO_BACK(key) _TIMER_EVENT(TMR_ECHO, key)
-#define SEQ_SET_TEMPO(value) _TIMER_EVENT(TMR_TEMPO, value)
-#define SEQ_SONGPOS(pos) _TIMER_EVENT(TMR_SPP, pos)
-#define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig)
-
-/*
- * Events for the level 1 interface only
- */
-
-#define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4);\
- _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\
- _seqbuf[_seqbufptr+1] = (byte);\
- _seqbuf[_seqbufptr+2] = (device);\
- _seqbuf[_seqbufptr+3] = 0;\
- _SEQ_ADVBUF(4);}
-
-/*
- * Patch loading.
- */
-#define SEQ_WRPATCH(patchx, len) {if (_seqbufptr) seqbuf_dump();\
- if (write(seqfd, (char*)(patchx), len)==-1) \
- perror("Write patch: /dev/sequencer");}
-#define SEQ_WRPATCH2(patchx, len) (seqbuf_dump(), write(seqfd, (char*)(patchx), len))
-
-#endif
-#endif
diff --git a/sys/i386/isa/sound/ultrasound.h b/sys/i386/isa/sound/ultrasound.h
deleted file mode 100644
index 40e2443..0000000
--- a/sys/i386/isa/sound/ultrasound.h
+++ /dev/null
@@ -1,121 +0,0 @@
-#ifndef _ULTRASOUND_H_
-#define _ULTRASOUND_H_
-/*
- * Copyright by Hannu Savolainen 1993
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-/*
- * ultrasound.h - Macros for programming the Gravis Ultrasound
- * These macros are extremely device dependent
- * and not portable.
- */
-
-/*
- * Private events for Gravis Ultrasound (GUS)
- *
- * Format:
- * byte 0 - SEQ_PRIVATE (0xfe)
- * byte 1 - Synthesizer device number (0-N)
- * byte 2 - Command (see below)
- * byte 3 - Voice number (0-31)
- * bytes 4 and 5 - parameter P1 (unsigned short)
- * bytes 6 and 7 - parameter P2 (unsigned short)
- *
- * Commands:
- * Each command affects one voice defined in byte 3.
- * Unused parameters (P1 and/or P2 *MUST* be initialized to zero).
- * _GUS_NUMVOICES - Sets max. number of concurrent voices (P1=14-31, default 16)
- * _GUS_VOICESAMPLE- ************ OBSOLETE *************
- * _GUS_VOICEON - Starts voice (P1=voice mode)
- * _GUS_VOICEOFF - Stops voice (no parameters)
- * _GUS_VOICEFADE - Stops the voice smoothly.
- * _GUS_VOICEMODE - Alters the voice mode, don't start or stop voice (P1=voice mode)
- * _GUS_VOICEBALA - Sets voice balence (P1, 0=left, 7=middle and 15=right, default 7)
- * _GUS_VOICEFREQ - Sets voice (sample) playback frequency (P1=Hz)
- * _GUS_VOICEVOL - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off)
- * _GUS_VOICEVOL2 - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off)
- * (Like GUS_VOICEVOL but doesn't change the hw
- * volume. It just updates volume in the voice table).
- *
- * _GUS_RAMPRANGE - Sets limits for volume ramping (P1=low volume, P2=high volume)
- * _GUS_RAMPRATE - Sets the speed for volume ramping (P1=scale, P2=rate)
- * _GUS_RAMPMODE - Sets the volume ramping mode (P1=ramping mode)
- * _GUS_RAMPON - Starts volume ramping (no parameters)
- * _GUS_RAMPOFF - Stops volume ramping (no parameters)
- * _GUS_VOLUME_SCALE - Changes the volume calculation constants
- * for all voices.
- */
-
-#define _GUS_NUMVOICES 0x00
-#define _GUS_VOICESAMPLE 0x01 /* OBSOLETE */
-#define _GUS_VOICEON 0x02
-#define _GUS_VOICEOFF 0x03
-#define _GUS_VOICEMODE 0x04
-#define _GUS_VOICEBALA 0x05
-#define _GUS_VOICEFREQ 0x06
-#define _GUS_VOICEVOL 0x07
-#define _GUS_RAMPRANGE 0x08
-#define _GUS_RAMPRATE 0x09
-#define _GUS_RAMPMODE 0x0a
-#define _GUS_RAMPON 0x0b
-#define _GUS_RAMPOFF 0x0c
-#define _GUS_VOICEFADE 0x0d
-#define _GUS_VOLUME_SCALE 0x0e
-#define _GUS_VOICEVOL2 0x0f
-#define _GUS_VOICE_POS 0x10
-
-/*
- * GUS API macros
- */
-
-#define _GUS_CMD(chn, voice, cmd, p1, p2) \
- {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = SEQ_PRIVATE;\
- _seqbuf[_seqbufptr+1] = (chn); _seqbuf[_seqbufptr+2] = cmd;\
- _seqbuf[_seqbufptr+3] = voice;\
- *(unsigned short*)&_seqbuf[_seqbufptr+4] = p1;\
- *(unsigned short*)&_seqbuf[_seqbufptr+6] = p2;\
- _SEQ_ADVBUF(8);}
-
-#define GUS_NUMVOICES(chn, p1) _GUS_CMD(chn, 0, _GUS_NUMVOICES, (p1), 0)
-#define GUS_VOICESAMPLE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICESAMPLE, (p1), 0) /* OBSOLETE */
-#define GUS_VOICEON(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEON, (p1), 0)
-#define GUS_VOICEOFF(chn, voice) _GUS_CMD(chn, voice, _GUS_VOICEOFF, 0, 0)
-#define GUS_VOICEFADE(chn, voice) _GUS_CMD(chn, voice, _GUS_VOICEFADE, 0, 0)
-#define GUS_VOICEMODE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEMODE, (p1), 0)
-#define GUS_VOICEBALA(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEBALA, (p1), 0)
-#define GUS_VOICEFREQ(chn, voice, p) _GUS_CMD(chn, voice, _GUS_VOICEFREQ, \
- (p) & 0xffff, ((p) >> 16) & 0xffff)
-#define GUS_VOICEVOL(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEVOL, (p1), 0)
-#define GUS_VOICEVOL2(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEVOL2, (p1), 0)
-#define GUS_RAMPRANGE(chn, voice, low, high) _GUS_CMD(chn, voice, _GUS_RAMPRANGE, (low), (high))
-#define GUS_RAMPRATE(chn, voice, p1, p2) _GUS_CMD(chn, voice, _GUS_RAMPRATE, (p1), (p2))
-#define GUS_RAMPMODE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_RAMPMODE, (p1), 0)
-#define GUS_RAMPON(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_RAMPON, (p1), 0)
-#define GUS_RAMPOFF(chn, voice) _GUS_CMD(chn, voice, _GUS_RAMPOFF, 0, 0)
-#define GUS_VOLUME_SCALE(chn, voice, p1, p2) _GUS_CMD(chn, voice, _GUS_VOLUME_SCALE, (p1), (p2))
-#define GUS_VOICE_POS(chn, voice, p) _GUS_CMD(chn, voice, _GUS_VOICE_POS, \
- (p) & 0xffff, ((p) >> 16) & 0xffff)
-
-#endif
diff --git a/sys/i386/isa/sound/vat_audio.c b/sys/i386/isa/sound/vat_audio.c
deleted file mode 100644
index 74f0bdd..0000000
--- a/sys/i386/isa/sound/vat_audio.c
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Minimally compliant SunOS compatible audio driver front-end
- * for use with VAT.
- *
- * This is a front end for the voxware based drivers that form the standard
- * audio driver system for FreeBSD. It will not operate without the voxware
- * package.
- *
- * This is not a full implementation of the SunOS audio driver, don't
- * expect anything other than vat to operate with it.
- *
- * ---WARNING
- * ---WARNING this work is not complete, it still doesn't work
- * ---WARNING
- *
- * Copyright (C) 1993-1994 Jim Lowe
- * Additional development by Amancio Hasty
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation.
- *
- * This software is provided `as-is'. The author disclaims all
- * warranties with regard to this software, including without
- * limitation all implied warranties of merchantability, fitness for
- * a particular purpose, or noninfringement. In no event shall the
- * author be liable for any damages whatsoever, including
- * special, incidental or consequential damages, including loss of
- * use, data, or profits, even if advised of the possibility thereof,
- * and regardless of whether in an action in contract, tort or
- * negligence, arising out of or in connection with the use or
- * performance of this software.
- *
- */
-
-#include "vat_audio.h"
-#include "snd.h" /* Generic Sound Driver (voxware) */
-
-#if (NVAT_AUDIO > 0) && (NSND > 0)
-
-#include "sound_config.h"
-#include "os.h"
-#include "vat_audioio.h"
-
-#define splaudio splclock
-
-extern int sndopen (dev_t dev, int flags);
-extern int sndclose (dev_t dev, int flags);
-extern int sndioctl (dev_t dev, int cmd, void *arg, int mode);
-extern int sndread (int dev, struct uio *uio);
-extern int sndwrite (int dev, struct uio *uio);
-
-struct va_softc {
- dev_t rdev; /* record device */
- dev_t pdev; /* playback device */
- dev_t mixer; /* mixer device */
- struct selinfo wsel; /* write select info */
- struct selinfo rsel; /* read select info */
- int rlevel;
- int plevel;
- int open;
-} va_softc;
-
-#define DEF_SAMPLE_RATE 8007
-
-#ifndef AUDIOBLOCKSIZE
-#define AUDIOBLOCKSIZE 160 /* 20ms at 8khz */
-#endif
-
-static int iblocksize = AUDIOBLOCKSIZE;
-static int oblocksize = 1024;
-
-static u_int record_devices = (SOUND_MASK_MIC|SOUND_MASK_LINE|SOUND_MASK_CD);
-
-static int default_level[SOUND_MIXER_NRDEVICES] = { /* max = 0x64 */
- 0x3232, /* Master Volume */
- 0x3232, /* Bass */
- 0x3232, /* Treble */
- 0x0000, /* FM */
- 0x6464, /* PCM */
- 0x0000, /* PC Speaker */
- 0x6464, /* Ext Line */
- 0x6464, /* Mic */
- 0x4b4b, /* CD */
- 0x0000, /* Recording monitor (input mixer) -- avoid feedback */
- 0x4b4b, /* SB PCM */
- 0x6464, /* Record Level -- to ADC */
-};
-
-
-static void
-setpgain(int level)
-{
- register struct va_softc *va = (struct va_softc *)&va_softc;
- int arg;
-
- level = (level * 100 / 255) & 0x7f;
- arg = (level << 8) | level;
-
- sndioctl(va->mixer, MIXER_WRITE(SOUND_MIXER_PCM), &arg, 0);
-}
-
-static void
-setrgain(int level)
-{
- register struct va_softc *va = (struct va_softc *)&va_softc;
- int arg, arg1;
-
- level = (level * 100 / 255) & 0x7f;
- arg = (level << 8) | level;
-
- sndioctl(va->mixer, SOUND_MIXER_WRITE_LINE, &arg, 0);
- sndioctl(va->mixer, SOUND_MIXER_WRITE_MIC, &arg, 0);
- sndioctl(va->mixer, SOUND_MIXER_WRITE_CD, &arg, 0);
-}
-
-static int
-setprate(int rate)
-{
- register struct va_softc *va = (struct va_softc *)&va_softc;
- register int dev;
-
- dev = va->pdev >> 4;
- return (audio_devs[dev]->ioctl(dev, SOUND_PCM_WRITE_RATE, rate, 1));
-}
-
-static int
-setrrate(int rate)
-{
- register struct va_softc *va = (struct va_softc *)&va_softc;
- register int dev;
-
- dev = va->rdev >> 4;
- return (audio_devs[dev]->ioctl(dev, SOUND_PCM_WRITE_RATE, rate, 1));
-}
-
-int
-vaopen(dev_t dev, int flags)
-{
- register struct va_softc *va = (struct va_softc *)&va_softc;
- int s;
-
- if (va->open)
- return(EBUSY);
- else
- va->open = 1;
-
-#ifdef SND_BIDIR
- va->rdev = SND_DEV_AUDIO | (1<<4); /* first and second device */
- va->pdev = SND_DEV_AUDIO | (0<<4);
- va->mixer = SND_DEV_CTL;
-
- s = sndopen(va->rdev, FREAD);
- if (s) {
- va->open = 0;
- return(s);
- }
-
- s = sndopen(va->pdev, FWRITE);
- if (s) {
- va->open = 0;
- sndclose(va->rdev, FREAD);
- return(s);
- }
-#else
- va->rdev = SND_DEV_AUDIO | (0<<4); /* first attached device */
- va->pdev = SND_DEV_AUDIO | (0<<4);
- va->mixer = SND_DEV_CTL;
-
- s = sndopen(va->rdev, flags);
- if (s) {
- va->open = 0;
- return(s);
- }
-#endif
-
- /* set sample rates */
- setprate(DEF_SAMPLE_RATE);
- setrrate(DEF_SAMPLE_RATE);
-
- /* set block size for I/O samples */
- sndioctl(va->rdev, SNDCTL_DSP_GETBLKSIZE, &iblocksize, 0);
- sndioctl(va->pdev, SNDCTL_DSP_GETBLKSIZE, &oblocksize, 0);
-
- /* initialize mixer controls the way we want them */
- sndioctl(va->mixer, SOUND_MIXER_WRITE_RECSRC, &record_devices, 0);
-
- for (s = 0; s < SOUND_MIXER_NRDEVICES; s++)
- sndioctl(va->mixer, MIXER_WRITE(s), &default_level[s], 0);
-
- va->rlevel = (default_level[SOUND_MASK_MIC] & 0x7f) * 255 / 100;
- va->plevel = (default_level[SOUND_MASK_PCM] & 0x7f) * 255 / 100;
-
- if (flags & FREAD) /* start the read process */
- DMAbuf_start_input(va->rdev>>4);
-
- return(0);
-}
-
-int
-vaclose(dev_t dev, int flags)
-{
- register struct va_softc *va = (struct va_softc *)&va_softc;
-
- va->open = 0;
-
- sndioctl(va->mixer, SNDCTL_DSP_RESET, NULL, 0);
-
-#ifdef SND_BIDIR
- sndclose(va->pdev, FWRITE);
- sndclose(va->rdev, FREAD);
-#else
- sndclose(va->rdev, flags);
-#endif
- return (0);
-}
-
-int
-varead(dev_t dev, struct uio *buf)
-{
- register struct va_softc *va = (struct va_softc *)&va_softc;
-
- return sndread(va->rdev, buf);
-}
-
-int
-vawrite(dev_t dev, struct uio *buf)
-{
- register struct va_softc *va = (struct va_softc *)&va_softc;
-
- return sndwrite(va->pdev, buf);
-}
-
-void
-audio_get_info(struct va_softc *va, struct audio_info *ai)
-{
- struct audio_prinfo *r, *p;
- int rdev = va->rdev >> 4;
- int pdev = va->pdev >> 4;
-
- r = &ai->record;
- p = &ai->play;
-
- p->sample_rate =
- audio_devs[pdev]->ioctl(pdev, SOUND_PCM_READ_RATE, 0, 1);
- r->sample_rate =
- audio_devs[rdev]->ioctl(rdev, SOUND_PCM_READ_RATE, 0, 1);
-
- p->channels =
- audio_devs[pdev]->ioctl(pdev, SOUND_PCM_READ_CHANNELS, 0, 1);
- r->channels =
- audio_devs[rdev]->ioctl(rdev, SOUND_PCM_READ_CHANNELS, 0, 1);
-
- p->precision = audio_devs[pdev]->ioctl(pdev, SOUND_PCM_READ_BITS, 0, 1);
- r->precision = audio_devs[rdev]->ioctl(rdev, SOUND_PCM_READ_BITS, 0, 1);
-
- p->encoding = r->encoding = AUDIO_ENCODING_ULAW;
-
- ai->monitor_gain = 0;
-
- r->gain = va->rlevel;
- p->gain = va->plevel;
-
- r->port = 1;
- p->port = AUDIO_SPEAKER;
-
- p->open = r->open = va->open;
-}
-
-void
-audio_set_info(struct va_softc *va, struct audio_info *ai)
-{
- struct audio_prinfo *r, *p;
- int rdev = va->rdev >> 4;
- int pdev = va->pdev >> 4;
-
- r = &ai->record;
- p = &ai->play;
-
- /* Only set gains if mode == -1, I think this is a bug in vat. */
-
- if (ai->mode == ~0) {
- if (p->gain != ~0) {
- va->plevel = p->gain;
- setpgain(va->plevel);
- }
- if (r->gain != ~0) {
- va->rlevel = r->gain;
- setrgain(va->rlevel);
- }
- }
-
- if (p->sample_rate != ~0)
- p->sample_rate = setprate(p->sample_rate);
-
- if (r->sample_rate != ~0)
- r->sample_rate = setrrate(r->sample_rate);
-
- DMAbuf_start_input(rdev);
-}
-
-int
-vaioctl(dev_t dev, int cmd, caddr_t arg, int mode)
-{
- register struct va_softc *va = (struct va_softc *)&va_softc;
- int s;
-
- switch(cmd) {
- case FIONBIO:
- break; /* handled above in file i/o routines */
- case AUDIO_GETINFO:
- audio_get_info(va, (struct audio_info *)arg);
- break;
- case AUDIO_SETINFO:
- audio_set_info(va, (struct audio_info *)arg);
- break;
- default:
- printf("vaioctl: cmd=0x%x, '%c', num = %d, len=%d, %s\n",
- cmd, IOCGROUP(cmd), cmd & 0xff, IOCPARM_LEN(cmd),
- cmd&IOC_IN ? "in" : "out");
-
- s = sndioctl(va->rdev, cmd, arg, mode);
-
- if (s == 0)
- s = sndioctl(va->pdev, cmd, arg, mode);
- break;
- }
- return(0);
-}
-
-int
-vaselect(dev_t dev, int rw, struct proc *p)
-{
- register struct va_softc *va = (struct va_softc *)&va_softc;
- int s, r;
-
- r = 0;
- s = splaudio();
-
- switch (rw) {
- case FREAD:
- if (DMAbuf_input_ready(va->rdev>>4))
- r = 1;
- else
- selrecord(p, &va->rsel);
- break;
- case FWRITE:
- if (DMAbuf_output_ready(va->pdev>>4))
- r = 1;
- else
- selrecord(p, &va->wsel);
- break;
- }
-
- splx(s);
- return(r);
-}
-
-void
-audio_rint(void)
-{
- register struct va_softc *va = (struct va_softc *)&va_softc;
-
- if (!va->open)
- return;
-
- selwakeup(&va->rsel);
-}
-
-void
-audio_pint(void)
-{
- register struct va_softc *va = (struct va_softc *)&va_softc;
-
- if (!va->open)
- return;
-
- selwakeup(&va->wsel);
-}
-#else
-
-void audio_rint(void) {}
-void audio_pint(void) {}
-
-#endif /* NVAT_AUDIO && NSND */
diff --git a/sys/i386/isa/sound/vat_audioio.h b/sys/i386/isa/sound/vat_audioio.h
deleted file mode 100644
index 03cff23..0000000
--- a/sys/i386/isa/sound/vat_audioio.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 1991-1993 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 Computer Systems
- * Engineering Group at Lawrence Berkeley Laboratory.
- * 4. Neither the name of the University nor of the Laboratory may be used
- * to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * /home/ncvs/src/sys/i386/isa/sound/vat_audioio.h,v 1.1 1994/12/16 04:59:18 pst Exp (LBL)
- */
-
-#ifndef _BSD_AUDIOIO_H_
-#define _BSD_AUDIOIO_H_
-
-/*
- * /dev/audio ioctls. needs comments!
- */
-#define AUDIO_MIN_GAIN (0)
-#define AUDIO_MAX_GAIN (255)
-
-#define AUDIO_ENCODING_ULAW (1)
-#define AUDIO_ENCODING_ALAW (2)
-#define AUDIO_ENCODING_LINEAR (3)
-
-struct audio_prinfo {
- u_int sample_rate;
- u_int channels;
- u_int precision;
- u_int encoding;
- u_int gain;
- u_int port;
- u_long seek; /* BSD extension */
- u_int ispare[3];
- u_int samples;
- u_int eof;
-
- u_char pause;
- u_char error;
- u_char waiting;
- u_char cspare[3];
- u_char open;
- u_char active;
-
-};
-
-struct audio_info {
- struct audio_prinfo play;
- struct audio_prinfo record;
- u_int monitor_gain;
- /* BSD extensions */
- u_int blocksize; /* input blocking threshold */
- u_int hiwat; /* output high water mark */
- u_int lowat; /* output low water mark */
- u_int backlog; /* samples of output backlog to gen. */
-#define AUMODE_PLAY 0
-#define AUMODE_RECORD 1
- u_int mode;
-};
-typedef struct audio_info audio_info_t;
-
-#define AUDIO_INITINFO(p)\
- (void)memset((void *)(p), 0xff, sizeof(struct audio_info))
-
-#if (defined(sun) || defined(ibm032)) && !defined(__GNUC__)
-#define AUDIO_GETINFO _IOR(A, 21, struct audio_info)
-#define AUDIO_SETINFO _IOWR(A, 22, struct audio_info)
-#define AUDIO_DRAIN _IO(A, 23)
-#define AUDIO_FLUSH _IO(A, 24)
-#define AUDIO_WSEEK _IOR(A, 25, u_long)
-#define AUDIO_RERROR _IOR(A, 26, int)
-#define AUDIO_GETMAP _IOR(A, 27, struct mapreg)
-#define AUDIO_SETMAP _IOW(A, 28, struct mapreg)
-#else
-#define AUDIO_GETINFO _IOR('A', 21, struct audio_info)
-#define AUDIO_SETINFO _IOWR('A', 22, struct audio_info)
-#define AUDIO_DRAIN _IO('A', 23)
-#define AUDIO_FLUSH _IO('A', 24)
-#define AUDIO_WSEEK _IOR('A', 25, u_long)
-#define AUDIO_RERROR _IOR('A', 26, int)
-#define AUDIO_GETMAP _IOR('A', 27, struct mapreg)
-#define AUDIO_SETMAP _IOW('A', 28, struct mapreg)
-#endif
-
-#define AUDIO_SPEAKER 1
-#define AUDIO_HEADPHONE 2
-
-#endif /* _BSD_AUDIOIO_H_ */
diff --git a/sys/i386/pci/README.de b/sys/i386/pci/README.de
deleted file mode 100644
index fb81945..0000000
--- a/sys/i386/pci/README.de
+++ /dev/null
@@ -1,48 +0,0 @@
-$Id: README.de,v 1.3 1994/10/12 11:19:36 se Exp $
-
-----------------
-
-The enclosed driver should be considered as beta-test software. It
-has run on exactly one machine. Therefore testing has been limited.
-This driver is in no way supported by Digital Equipment. See the
-disclaimers in the sources for more.
-
-This driver the DEC DE435 PCI NIC. It should also work with other PCI
-boards that use the DC21040-AA chip (also known as TULIP). This
-driver requires the DC21040-AA to be pass 2.3 or later. If you are
-using a eariler pass chip, you may encounter undetected transmit
-corruptions. This driver also requires that DC21040-AA use a serial
-Ethernet address ROM as described in the DC21040 specification.
-
-The DEC DE425 EISA NIC based on the DC21040-AA is not support at
-this time. A future update will include support for it.
-
-The driver includes full support for both BPF and IP Multicast.
-If the autosensing of the driver fails, you can use ifconfig(8) to
-switch the driver to the correct port.
-
- ifconfig de0 altphys Thinwire/AUI port
- ifconfig de0 -altphys 10baseT/UTP port
-
-To enable this driver, you first need to add the following lines to
-your config file (in i386/conf):
-
- controller pci0
- device de0
-
-The PCI support code will automatically determine and enable the
-correct IRQ.
-
-Now you are ready to rebuild your kernel, reboot, and see if the
-driver can configure your board. When the system boots, you will
-hopefully something close to:
-
- de0 <digital dc21040 ethernet> int a irq 9 on pci0:7
- reg20: virtual=0xf290a000 physical=0xc0001000
- de0: enabling Thinwire/AUI port
- de0: DC21040 [10Mb/s] pass 2.3 ethernet address 08:00:2b:e2:1e:09
- bpf: de0 attached
-
-in the startup log. If so, the board configured properly and
-should be ready to use.
-
diff --git a/sys/i386/pci/README.de-le b/sys/i386/pci/README.de-le
deleted file mode 100644
index 60cd2e2..0000000
--- a/sys/i386/pci/README.de-le
+++ /dev/null
@@ -1,33 +0,0 @@
-$Id: README.de-le,v 1.1 1994/10/01 20:16:44 wollman Exp $
-
-----------------
-
-The enclosed drivers should be considered beta-test software. These
-drivers are in no way supported by Digital Equipment. See the
-disclaimers in the sources for more information. Please be aware that
-Digital does not employee me to write drivers for FreeBSD.
-
-This kit contains one driver:
-
- de DEC DE435 PCI NIC or compatible
-
-See README.de for information and installation instruction specific to this
-driver.
-
-Could you please send me the startup messages in the boot
-long along with the type of your PC once the driver configures?
-
-If you have any problems, comments, suggestions, rant or raves, don't
-hesitate to send me mail @ thomas@lkg.dec.com.
-
-Lastly, if you change or modify the code, I want context diffs of your
-changes. I want this to the canonical DEC EtherWORKS driver kit for
-FreeBSD, NetBSD, BSD/386, and any other BSD based O/S. Please make
-sure your diffs are approriate conditionalized.
-
-Thanks,
-Matt Thomas
---
-Mail: thomas@lkg.dec.com
-URL: http://ftp.digital.com/~thomas/
-
diff --git a/sys/i386/pci/aic7870.c b/sys/i386/pci/aic7870.c
deleted file mode 100644
index 373fea5..0000000
--- a/sys/i386/pci/aic7870.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Product specific probe and attach routines for:
- * 294X and aic7870 motherboard SCSI controllers
- *
- * Copyright (c) 1995 Justin T. Gibbs
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice immediately at the beginning of the file, without modification,
- * this list of conditions, and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Absolutely no warranty of function or purpose is made by the author
- * Justin T. Gibbs.
- * 4. Modifications may be freely made to this file if the above conditions
- * are met.
- *
- * $Id: aic7870.c,v 1.2 1995/01/16 16:31:57 gibbs Exp $
- */
-
-#include <pci.h>
-#if NPCI > 0
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <i386/pci/pcireg.h>
-#include <i386/scsi/aic7xxx.h>
-
-#define PCI_BASEADR0 PCI_MAP_REG_START
-#define PCI_DEVICE_ID_ADAPTEC_2940 0x71789004ul
-#define PCI_DEVICE_ID_ADAPTEC_AIC7870 0x70789004ul
-
-static char* aic7870_probe __P((pcici_t tag, pcidi_t type));
-void aic7870_attach __P((pcici_t config_id, int unit));
-
-static u_long aic7870_count;
-
-struct pci_driver ahc_device = {
- aic7870_probe,
- aic7870_attach,
- &aic7870_count
-};
-
-static char*
-aic7870_probe (pcici_t tag, pcidi_t type)
-{
- switch(type) {
- case PCI_DEVICE_ID_ADAPTEC_2940:
- return ("Adaptec 294X SCSI host adapter");
- break;
- case PCI_DEVICE_ID_ADAPTEC_AIC7870:
- return ("Adaptec aic7870 SCSI host adapter");
- break;
- default:
- break;
- }
- return (0);
-
-}
-
-void
-aic7870_attach(config_id, unit)
- pcici_t config_id;
- int unit;
-{
- u_long io_port;
- if(!(io_port = pci_conf_read(config_id, PCI_BASEADR0)))
- return;
- io_port -= 0xc01ul; /*
- printf("io_port = 0x%lx\n", io_port);
- * Make the offsets the same as for EISA
- * The first bit of PCI_BASEADR0 is always
- * set hence we subtract 0xc01 instead of the
- * 0xc00 that you would expect.
- */
- if(ahcprobe(unit, io_port, AHC_294)){
- ahc_unit++;
- if(ahc_attach(unit))
- /*
- * To be compatible with the isa style of
- * interrupt handler, we pass the unit number
- * not a pointer to our per device structure.
- */
- pci_map_int (config_id, ahcintr, (void *)unit,
- &bio_imask);
- }
- return;
-}
-
-#endif /* NPCI > 0 */
diff --git a/sys/i386/pci/dc21040.h b/sys/i386/pci/dc21040.h
deleted file mode 100644
index 4afa274..0000000
--- a/sys/i386/pci/dc21040.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/*-
- * Copyright (c) 1994 Matt Thomas (thomas@lkg.dec.com)
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. The name of the author may not be used to endorse or promote products
- * derived from this software withough specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id: dc21040.h,v 1.2 1994/08/15 20:42:25 thomas Exp thomas $
- *
- * $Log: dc21040.h,v $
- * Revision 1.2 1994/08/15 20:42:25 thomas
- * misc additions
- *
- * Revision 1.1 1994/08/12 21:02:46 thomas
- * Initial revision
- *
- * Revision 1.8 1994/08/05 20:20:54 thomas
- * Enable change log
- *
- * Revision 1.7 1994/08/05 20:20:14 thomas
- * *** empty log message ***
- *
- */
-
-#if !defined(_DC21040_H)
-#define _DC21040_H
-
-typedef signed int tulip_sint32_t;
-typedef unsigned int tulip_uint32_t;
-
-#if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN
-#define TULIP_BITFIELD2(a, b) b, a
-#define TULIP_BITFIELD3(a, b, c) c, b, a
-#define TULIP_BITFIELD4(a, b, c, d) d, c, b, a
-#else
-#define TULIP_BITFIELD2(a, b) a, b
-#define TULIP_BITFIELD3(a, b, c) a, b, c
-#define TULIP_BITFIELD4(a, b, c, d) a, b, c, d
-#endif
-
-typedef struct {
- tulip_uint32_t d_status;
- tulip_uint32_t TULIP_BITFIELD3(d_length1 : 11,
- d_length2 : 11,
- d_flag : 10);
- tulip_uint32_t d_addr1;
- tulip_uint32_t d_addr2;
-} tulip_desc_t;
-
-#define TULIP_DSTS_OWNER 0x80000000 /* Owner (1 = DC21040) */
-#define TULIP_DSTS_ERRSUM 0x00008000 /* Error Summary */
-/*
- * Transmit Status
- */
-#define TULIP_DSTS_TxBABBLE 0x00004000 /* Transmitter Babbled */
-#define TULIP_DSTS_TxCARRLOSS 0x00000800 /* Carrier Loss */
-#define TULIP_DSTS_TxNOCARR 0x00000400 /* No Carrier */
-#define TULIP_DSTS_TxLATECOLL 0x00000200 /* Late Collision */
-#define TULIP_DSTS_TxEXCCOLL 0x00000100 /* Excessive Collisions */
-#define TULIP_DSTS_TxNOHRTBT 0x00000080 /* No Heartbeat */
-#define TULIP_DSTS_TxCOLLMASK 0x00000078 /* Collision Count (mask) */
-#define TULIP_DSTS_V_TxCOLLCNT 0x00000003 /* Collision Count (bit) */
-#define TULIP_DSTS_TxLINKFAIL 0x00000004 /* Link Failure */
-#define TULIP_DSTS_TxUNDERFLOW 0x00000002 /* Underflow Error */
-#define TULIP_DSTS_TxDEFERRED 0x00000001 /* Initially Deferred */
-/*
- * Receive Status
- */
-#define TULIP_DSTS_RxBADLENGTH 0x00004000 /* Length Error */
-#define TULIP_DSTS_RxDATATYPE 0x00003000 /* Data Type */
-#define TULIP_DSTS_RxRUNT 0x00000800 /* Runt Frame */
-#define TULIP_DSTS_RxMULTICAST 0x00000400 /* Multicast Frame */
-#define TULIP_DSTS_RxFIRSTDESC 0x00000200 /* First Descriptor */
-#define TULIP_DSTS_RxLASTDESC 0x00000100 /* Last Descriptor */
-#define TULIP_DSTS_RxTOOLONG 0x00000080 /* Frame Too Long */
-#define TULIP_DSTS_RxCOLLSEEN 0x00000040 /* Collision Seen */
-#define TULIP_DSTS_RxFRAMETYPE 0x00000020 /* Frame Type */
-#define TULIP_DSTS_RxWATCHDOG 0x00000010 /* Receive Watchdog */
-#define TULIP_DSTS_RxDRBBLBIT 0x00000004 /* Dribble Bit */
-#define TULIP_DSTS_RxBADCRC 0x00000002 /* CRC Error */
-#define TULIP_DSTS_RxOVERFLOW 0x00000001 /* Overflow */
-
-
-#define TULIP_DFLAG_ENDRING 0x0008 /* End of Transmit Ring */
-#define TULIP_DFLAG_CHAIN 0x0004 /* Chain using d_addr2 */
-
-#define TULIP_DFLAG_TxWANTINTR 0x0200 /* Signal Interrupt on Completion */
-#define TULIP_DFLAG_TxLASTSEG 0x0100 /* Last Segment */
-#define TULIP_DFLAG_TxFIRSTSEG 0x0080 /* First Segment */
-#define TULIP_DFLAG_TxINVRSFILT 0x0040 /* Inverse Filtering */
-#define TULIP_DFLAG_TxSETUPPKT 0x0020 /* Setup Packet */
-#define TULIP_DFLAG_TxHASCRC 0x0010 /* Don't Append the CRC */
-#define TULIP_DFLAG_TxNOPADDING 0x0002 /* Don't AutoPad */
-#define TULIP_DFLAG_TxHASHFILT 0x0001 /* Hash/Perfect Filtering */
-
-/*
- * The DC21040 Registers (IO Space Addresses)
- */
-#define TULIP_REG_BUSMODE 0x00 /* CSR0 -- Bus Mode */
-#define TULIP_REG_TXPOLL 0x08 /* CSR1 -- Transmit Poll Demand */
-#define TULIP_REG_RXPOLL 0x10 /* CSR2 -- Receive Poll Demand */
-#define TULIP_REG_RXLIST 0x18 /* CSR3 -- Receive List Base Addr */
-#define TULIP_REG_TXLIST 0x20 /* CSR4 -- Transmit List Base Addr */
-#define TULIP_REG_STATUS 0x28 /* CSR5 -- Status */
-#define TULIP_REG_CMD 0x30 /* CSR6 -- Command */
-#define TULIP_REG_INTR 0x38 /* CSR7 -- Interrupt Control */
-#define TULIP_REG_MISSES 0x40 /* CSR8 -- Missed Frame Counter */
-#define TULIP_REG_ADDRROM 0x48 /* CSR9 -- ENET ROM Register */
-#define TULIP_REG_RSRVD 0x50 /* CSR10 -- Reserved */
-#define TULIP_REG_FULL_DUPLEX 0x58 /* CSR11 -- Full Duplex */
-#define TULIP_REG_SIA_STATUS 0x60 /* CSR12 -- SIA Status */
-#define TULIP_REG_SIA_CONN 0x68 /* CSR13 -- SIA Connectivity */
-#define TULIP_REG_SIA_TXRX 0x70 /* CSR14 -- SIA Tx Rx */
-#define TULIP_REG_SIA_GEN 0x78 /* CSR15 -- SIA General */
-
-/*
- * CSR5 -- Status Register
- * CSR7 -- Interrupt Control
- */
-#define TULIP_STS_ERRORMASK 0x03800000L /* ( R) Error Bits (Valid when SYSERROR is set) */
-#define TULIP_STS_ERR_PARITY 0x00000000L /* 000 - Parity Error (Perform Reset) */
-#define TULIP_STS_ERR_MASTER 0x00800000L /* 001 - Master Abort */
-#define TULIP_STS_ERR_TARGET 0x01000000L /* 010 - Target Abort */
-#define TULIP_STS_TXSTATEMASK 0x00700000L /* ( R) Transmission Process State */
-#define TULIP_STS_TXS_RESET 0x00000000L /* 000 - Rset or transmit jabber expired */
-#define TULIP_STS_TXS_FETCH 0x00100000L /* 001 - Fetching transmit descriptor */
-#define TULIP_STS_TXS_WAITEND 0x00200000L /* 010 - Wait for end of transmission */
-#define TULIP_STS_TXS_READING 0x00300000L /* 011 - Read buffer and enqueue data */
-#define TULIP_STS_TXS_RSRVD 0x00400000L /* 100 - Reserved */
-#define TULIP_STS_TXS_SETUP 0x00500000L /* 101 - Setup Packet */
-#define TULIP_STS_TXS_SUSPEND 0x00600000L /* 110 - Transmit FIFO underflow or an
- unavailable transmit descriptor */
-#define TULIP_STS_TXS_CLOSE 0x00700000L /* 111 - Close transmit descriptor */
-#define TULIP_STS_RXSTATEMASK 0x000E0000L /* ( R) Receive Process State*/
-#define TULIP_STS_RXS_STOPPED 0x00000000L /* 000 - Stopped */
-#define TULIP_STS_RXS_FETCH 0x00020000L /* 001 - Running -- Fetch receive descriptor */
-#define TULIP_STS_RXS_ENDCHECK 0x00040000L /* 010 - Running -- Check for end of receive
- packet before prefetch of next descriptor */
-#define TULIP_STS_RXS_WAIT 0x00060000L /* 011 - Running -- Wait for receive packet */
-#define TULIP_STS_RXS_SUSPEND 0x00080000L /* 100 - Suspended -- As a result of
- unavailable receive buffers */
-#define TULIP_STS_RXS_CLOSE 0x000A0000L /* 101 - Running -- Close receive descriptor */
-#define TULIP_STS_RXS_FLUSH 0x000C0000L /* 110 - Running -- Flush the current frame
- from the receive FIFO as a result of
- an unavailable receive buffer */
-#define TULIP_STS_RXS_DEQUEUE 0x000E0000L /* 111 - Running -- Dequeue the receive frame
- from the receive FIFO into the receive
- buffer. */
-#define TULIP_STS_NORMALINTR 0x00010000L /* (RW) Normal Interrupt */
-#define TULIP_STS_ABNRMLINTR 0x00008000L /* (RW) Abnormal Interrupt */
-#define TULIP_STS_SYSERROR 0x00002000L /* (RW) System Error */
-#define TULIP_STS_LINKFAIL 0x00001000L /* (RW) Link Failure */
-#define TULIP_STS_FULDPLXSHRT 0x00000800L /* (RW) Full Duplex Short Fram Rcvd */
-#define TULIP_STS_AUI 0x00000400L /* (RW) AUI/TP Switch */
-#define TULIP_STS_RXTIMEOUT 0x00000200L /* (RW) Receive Watchbog Timeout */
-#define TULIP_STS_RXSTOPPED 0x00000100L /* (RW) Receive Process Stopped */
-#define TULIP_STS_RXNOBUF 0x00000080L /* (RW) Receive Buffer Unavailable */
-#define TULIP_STS_RXINTR 0x00000040L /* (RW) Receive Interrupt */
-#define TULIP_STS_TXUNDERFLOW 0x00000020L /* (RW) Transmit Underflow */
-#define TULIP_STS_TXBABBLE 0x00000008L /* (RW) Transmit Jabber Timeout */
-#define TULIP_STS_TXNOBUF 0x00000004L /* (RW) Transmit Buffer Unavailable */
-#define TULIP_STS_TXSTOPPED 0x00000002L /* (RW) Transmit Process Stopped */
-#define TULIP_STS_TXINTR 0x00000001L /* (RW) Transmit Interrupt */
-
-/*
- * CSR6 -- Command (Operation Mode) Register
- */
-#define TULIP_CMD_CAPTREFFCT 0x00020000L /* (RW) Capture Effect (!802.3) */
-#define TULIP_CMD_BACKPRESSURE 0x00010000L /* (RW) Back Pressure (!802.3) */
-#define TULIP_CMD_THRESHOLDCTL 0x0000C000L /* (RW) Threshold Control */
-#define TULIP_CMD_THRSHLD72 0x00000000L /* 00 - 72 Bytes */
-#define TULIP_CMD_THRSHLD96 0x00004000L /* 01 - 96 Bytes */
-#define TULIP_CMD_THRSHLD128 0x00008000L /* 10 - 128 bytes */
-#define TULIP_CMD_THRSHLD160 0x0000C000L /* 11 - 160 Bytes */
-#define TULIP_CMD_TXRUN 0x00002000L /* (RW) Start/Stop Transmitter */
-#define TULIP_CMD_FORCECOLL 0x00001000L /* (RW) Force Collisions */
-#define TULIP_CMD_OPERMODE 0x00000C00L /* (RW) Operating Mode */
-#define TULIP_CMD_FULLDULPEX 0x00000200L /* (RW) Full Duplex Mode */
-#define TULIP_CMD_FLAKYOSCDIS 0x00000100L /* (RW) Flakey Oscillator Disable */
-#define TULIP_CMD_ALLMULTI 0x00000080L /* (RW) Pass All Multicasts */
-#define TULIP_CMD_PROMISCUOUS 0x00000040L /* (RW) Promiscuous Mode */
-#define TULIP_CMD_BACKOFFCTR 0x00000020L /* (RW) Start/Stop Backoff Counter (!802.3) */
-#define TULIP_CMD_INVFILTER 0x00000010L /* (R ) Inverse Filtering */
-#define TULIP_CMD_PASSBADPKT 0x00000008L /* (RW) Pass Bad Frames */
-#define TULIP_CMD_HASHONLYFLTR 0x00000004L /* (R ) Hash Only Filtering */
-#define TULIP_CMD_RXRUN 0x00000002L /* (RW) Start/Stop Receive Filtering */
-#define TULIP_CMD_HASHPRFCTFLTR 0x00000001L /* (R ) Hash/Perfect Receive Filtering */
-
-
-#define TULIP_SIASTS_LINKFAIL 0x00000004L
-#define TULIP_SIACONN_RESET 0x00000000L
-
-#define TULIP_SIACONN_AUI 0x0000000DL
-#define TULIP_SIACONN_10BASET 0x00000005L
-
-#define TULIP_BUSMODE_SWRESET 0x00000001L
-
-#endif /* !defined(_DC21040_H) */
diff --git a/sys/i386/pci/if_de.c b/sys/i386/pci/if_de.c
deleted file mode 100644
index 0c0ac6b..0000000
--- a/sys/i386/pci/if_de.c
+++ /dev/null
@@ -1,1155 +0,0 @@
-/*-
- * Copyright (c) 1994 Matt Thomas (thomas@lkg.dec.com)
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. The name of the author may not be used to endorse or promote products
- * derived from this software withough specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id: if_de.c,v 1.12 1994/12/22 21:56:19 wollman Exp $
- *
- */
-
-/*
- * DEC DC21040 PCI Ethernet Controller
- *
- * Written by Matt Thomas
- * BPF support code stolen directly from if_ec.c
- *
- * This driver supports the DEC DE435 or any other PCI
- * board which support DC21040.
- */
-
-#include "de.h"
-#if NDE > 0
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/protosw.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/errno.h>
-#include <sys/malloc.h>
-
-#include <net/if.h>
-#include <net/if_types.h>
-#include <net/if_dl.h>
-#include <net/route.h>
-
-#include "bpfilter.h"
-#if NBPFILTER > 0
-#include <net/bpf.h>
-#include <net/bpfdesc.h>
-#endif
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-#endif
-
-#ifdef NS
-#include <netns/ns.h>
-#include <netns/ns_if.h>
-#endif
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_param.h>
-
-
-#include <pci.h>
-#if NPCI > 0
-#include <i386/pci/pcireg.h>
-#endif
-#include <i386/isa/icu.h>
-#include <i386/pci/dc21040.h>
-
-/*
- * This module supports the DEC DC21040 PCI Ethernet Controller.
- */
-
-typedef struct {
- unsigned long addr;
- unsigned long length;
-} tulip_addrvec_t;
-
-typedef struct {
- tulip_desc_t *ri_first;
- tulip_desc_t *ri_last;
- tulip_desc_t *ri_nextin;
- tulip_desc_t *ri_nextout;
- int ri_max;
- int ri_free;
-} tulip_ringinfo_t;
-
-typedef struct {
- volatile tulip_uint32_t *csr_busmode; /* CSR0 */
- volatile tulip_uint32_t *csr_txpoll; /* CSR1 */
- volatile tulip_uint32_t *csr_rxpoll; /* CSR2 */
- volatile tulip_uint32_t *csr_rxlist; /* CSR3 */
- volatile tulip_uint32_t *csr_txlist; /* CSR4 */
- volatile tulip_uint32_t *csr_status; /* CSR5 */
- volatile tulip_uint32_t *csr_command; /* CSR6 */
- volatile tulip_uint32_t *csr_intr; /* CSR7 */
- volatile tulip_uint32_t *csr_missed_frame; /* CSR8 */
- volatile tulip_sint32_t *csr_enetrom; /* CSR9 */
- volatile tulip_uint32_t *csr_reserved; /* CSR10 */
- volatile tulip_uint32_t *csr_full_duplex; /* CSR11 */
- volatile tulip_uint32_t *csr_sia_status; /* CSR12 */
- volatile tulip_uint32_t *csr_sia_connectivity; /* CSR13 */
- volatile tulip_uint32_t *csr_sia_tx_rx; /* CSR14 */
- volatile tulip_uint32_t *csr_sia_general; /* CSR15 */
-} tulip_regfile_t;
-
-/*
- * The DC21040 has a stupid restriction in that the receive
- * buffers must be longword aligned. But since Ethernet
- * headers are not a multiple of longwords in size this forces
- * the data to non-longword aligned. Since IP requires the
- * data to be longword aligned, we need to copy it after it has
- * been DMA'ed in our memory.
- *
- * Since we have to copy it anyways, we might as well as allocate
- * dedicated receive space for the input. This allows to use a
- * small receive buffer size and more ring entries to be able to
- * better keep with a flood of tiny Ethernet packets.
- *
- * The receive space MUST ALWAYS be a multiple of the page size.
- * And the number of receive descriptors multiplied by the size
- * of the receive buffers must equal the recevive space. This
- * is so that we can manipulate the page tables so that even if a
- * packet wraps around the end of the receive space, we can
- * treat it as virtually contiguous.
- */
-#define TULIP_RXBUFSIZE 512
-#define TULIP_RXDESCS 128
-#define TULIP_RXSPACE (TULIP_RXBUFSIZE * TULIP_RXDESCS)
-#define TULIP_TXDESCS 128
-
-typedef struct {
- struct arpcom tulip_ac;
- tulip_regfile_t tulip_csrs;
- vm_offset_t tulip_rxspace;
- unsigned tulip_flags;
-#define TULIP_WANTSETUP 0x01
-#define TULIP_WANTHASH 0x02
-#define TULIP_DOINGSETUP 0x04
-#define TULIP_ALTPHYS 0x08 /* use AUI */
- unsigned char tulip_rombuf[32];
- tulip_uint32_t tulip_setupbuf[192/sizeof(tulip_uint32_t)];
- tulip_uint32_t tulip_setupdata[192/sizeof(tulip_uint32_t)];
- tulip_uint32_t tulip_intrmask;
- tulip_uint32_t tulip_cmdmode;
- tulip_uint32_t tulip_revinfo;
-#if NBPFILTER > 0
- caddr_t tulip_bpf; /* BPF context */
-#endif
- struct ifqueue tulip_txq;
- tulip_ringinfo_t tulip_rxinfo;
- tulip_ringinfo_t tulip_txinfo;
-} tulip_softc_t;
-
-#ifndef IFF_ALTPHYS
-#define IFF_ALTPHYS IFF_LINK0 /* In case it isn't defined */
-#endif
-typedef enum { TULIP_DC21040, TULIP_DC21140 } tulip_chipid_t;
-const char *tulip_chipdescs[] = {
- "DC21040 [10Mb/s]",
- "DC21140 [100Mb/s]",
-};
-
-tulip_softc_t *tulips[NDE];
-tulip_chipid_t tulip_chipids[NDE];
-
-#define tulip_if tulip_ac.ac_if
-#define tulip_unit tulip_ac.ac_if.if_unit
-#define tulip_name tulip_ac.ac_if.if_name
-#define tulip_hwaddr tulip_ac.ac_enaddr
-
-#define TULIP_CRC32_POLY 0xEDB88320UL /* CRC-32 Poly -- Little Endian */
-#define TULIP_CHECK_RXCRC 0
-#define TULIP_MAX_TXSEG 30
-
-#define TULIP_ADDREQUAL(a1, a2) \
- (((u_short *)a1)[0] == ((u_short *)a2)[0] \
- && ((u_short *)a1)[1] == ((u_short *)a2)[1] \
- && ((u_short *)a1)[2] == ((u_short *)a2)[2])
-#define TULIP_ADDRBRDCST(a1) \
- (((u_short *)a1)[0] == 0xFFFFU \
- && ((u_short *)a1)[1] == 0xFFFFU \
- && ((u_short *)a1)[2] == 0xFFFFU)
-
-static void tulip_start(struct ifnet *ifp);
-static void tulip_addr_filter(tulip_softc_t *sc);
-
-#if __FreeBSD__ > 1
-#define TULIP_IFRESET_ARGS int unit
-#define TULIP_RESET(sc) tulip_reset((sc)->tulip_unit)
-#else
-#define TULIP_IFRESET_ARGS int unit, int uban
-#define TULIP_RESET(sc) tulip_reset((sc)->tulip_unit, 0)
-#endif
-
-static void
-tulip_reset(
- TULIP_IFRESET_ARGS)
-{
- tulip_softc_t *sc = tulips[unit];
- tulip_ringinfo_t *ri;
- tulip_desc_t *di;
- vm_offset_t vmoff;
-
- *sc->tulip_csrs.csr_busmode = TULIP_BUSMODE_SWRESET;
- DELAY(10); /* Wait 10 microsends (actually 50 PCI cycles but at
- 33MHz that comes to two microseconds but wait a
- bit longer anyways) */
-
- /*
- * Use the
- */
- *sc->tulip_csrs.csr_sia_connectivity = TULIP_SIACONN_RESET;
- if (sc->tulip_if.if_flags & IFF_ALTPHYS) {
- if ((sc->tulip_flags & TULIP_ALTPHYS) == 0)
- printf("%s%d: enabling Thinwire/AUI port\n",
- sc->tulip_if.if_name, sc->tulip_if.if_unit);
- *sc->tulip_csrs.csr_sia_connectivity = TULIP_SIACONN_AUI;
- sc->tulip_flags |= TULIP_ALTPHYS;
- } else {
- if (sc->tulip_flags & TULIP_ALTPHYS)
- printf("%s%d: enabling 10baseT/UTP port\n",
- sc->tulip_if.if_name, sc->tulip_if.if_unit);
- *sc->tulip_csrs.csr_sia_connectivity = TULIP_SIACONN_10BASET;
- sc->tulip_flags &= ~TULIP_ALTPHYS;
- }
- *sc->tulip_csrs.csr_txlist = vtophys(&sc->tulip_txinfo.ri_first[0]);
- *sc->tulip_csrs.csr_rxlist = vtophys(&sc->tulip_rxinfo.ri_first[0]);
- *sc->tulip_csrs.csr_intr = 0;
- *sc->tulip_csrs.csr_busmode = 0x4800;
-
- sc->tulip_txq.ifq_maxlen = TULIP_TXDESCS;
- /*
- * Free all the mbufs that were on the transmit ring.
- */
- for (;;) {
- struct mbuf *m;
- IF_DEQUEUE(&sc->tulip_txq, m);
- if (m == NULL)
- break;
- m_freem(m);
- }
-
- ri = &sc->tulip_txinfo;
- ri->ri_nextin = ri->ri_nextout = ri->ri_first;
- ri->ri_free = ri->ri_max;
- for (di = ri->ri_first; di < ri->ri_last; di++)
- di->d_status = 0;
-
- /*
- * We need to collect all the mbufs were on the
- * receive ring before we reinit it either to put
- * them back on or to know if we have to allocate
- * more.
- */
- ri = &sc->tulip_rxinfo;
- ri->ri_nextin = ri->ri_nextout = ri->ri_first;
- ri->ri_free = ri->ri_max;
- for (vmoff = vtophys(sc->tulip_rxspace), di = ri->ri_first;
- di < ri->ri_last; di++, vmoff += TULIP_RXBUFSIZE) {
- di->d_status |= TULIP_DSTS_OWNER;
- di->d_length1 = TULIP_RXBUFSIZE; di->d_addr1 = vmoff;
- di->d_length2 = 0; di->d_addr2 = 0;
- }
-
- sc->tulip_intrmask = TULIP_STS_NORMALINTR|TULIP_STS_RXINTR|TULIP_STS_TXINTR
- |TULIP_STS_ABNRMLINTR|TULIP_STS_SYSERROR|TULIP_STS_TXSTOPPED
- |TULIP_STS_TXBABBLE|TULIP_STS_LINKFAIL|TULIP_STS_RXSTOPPED;
- sc->tulip_flags &= ~(TULIP_DOINGSETUP|TULIP_WANTSETUP);
- tulip_addr_filter(sc);
-}
-
-static void
-tulip_init(
- int unit)
-{
- tulip_softc_t *sc = tulips[unit];
-
- if (sc->tulip_if.if_flags & IFF_UP) {
- sc->tulip_if.if_flags |= IFF_RUNNING;
- if (sc->tulip_if.if_flags & IFF_PROMISC) {
- sc->tulip_cmdmode |= TULIP_CMD_PROMISCUOUS;
- } else {
- sc->tulip_cmdmode &= ~TULIP_CMD_PROMISCUOUS;
- if (sc->tulip_if.if_flags & IFF_ALLMULTI) {
- sc->tulip_cmdmode |= TULIP_CMD_ALLMULTI;
- } else {
- sc->tulip_cmdmode &= ~TULIP_CMD_ALLMULTI;
- }
- }
- sc->tulip_cmdmode |= TULIP_CMD_TXRUN;
- if ((sc->tulip_flags & TULIP_WANTSETUP) == 0) {
- sc->tulip_cmdmode |= TULIP_CMD_RXRUN;
- sc->tulip_intrmask |= TULIP_STS_RXSTOPPED;
- } else {
- sc->tulip_intrmask &= ~TULIP_STS_RXSTOPPED;
- tulip_start(&sc->tulip_if);
- }
- sc->tulip_cmdmode |= TULIP_CMD_THRSHLD160;
- *sc->tulip_csrs.csr_intr = sc->tulip_intrmask;
- *sc->tulip_csrs.csr_command = sc->tulip_cmdmode;
- } else {
- TULIP_RESET(sc);
- sc->tulip_if.if_flags &= ~IFF_RUNNING;
- }
-}
-
-
-#if TULIP_CHECK_RXCRC
-static unsigned
-tulip_crc32(
- u_char *addr,
- int len)
-{
- unsigned int crc = 0xFFFFFFFF;
- static unsigned int crctbl[256];
- int idx;
- static int done;
- /*
- * initialize the multicast address CRC table
- */
- for (idx = 0; !done && idx < 256; idx++) {
- unsigned int tmp = idx;
- tmp = (tmp >> 1) ^ (tmp & 1 ? TULIP_CRC32_POLY : 0); /* XOR */
- tmp = (tmp >> 1) ^ (tmp & 1 ? TULIP_CRC32_POLY : 0); /* XOR */
- tmp = (tmp >> 1) ^ (tmp & 1 ? TULIP_CRC32_POLY : 0); /* XOR */
- tmp = (tmp >> 1) ^ (tmp & 1 ? TULIP_CRC32_POLY : 0); /* XOR */
- tmp = (tmp >> 1) ^ (tmp & 1 ? TULIP_CRC32_POLY : 0); /* XOR */
- tmp = (tmp >> 1) ^ (tmp & 1 ? TULIP_CRC32_POLY : 0); /* XOR */
- tmp = (tmp >> 1) ^ (tmp & 1 ? TULIP_CRC32_POLY : 0); /* XOR */
- tmp = (tmp >> 1) ^ (tmp & 1 ? TULIP_CRC32_POLY : 0); /* XOR */
- crctbl[idx] = tmp;
- }
- done = 1;
-
- while (len-- > 0)
- crc = (crc >> 8) ^ crctbl[*addr++] ^ crctbl[crc & 0xFF];
-
- return crc;
-}
-#endif
-
-static void
-tulip_rx_intr(
- tulip_softc_t *sc)
-{
- tulip_ringinfo_t *ri = &sc->tulip_rxinfo;
- struct ifnet *ifp = &sc->tulip_if;
-
- for (;;) {
- tulip_desc_t *eop;
- int total_len, ndescs;
- caddr_t bufaddr = (caddr_t) sc->tulip_rxspace;
-
- for (ndescs = 1, eop = ri->ri_nextin;; ndescs++) {
- if (((volatile tulip_desc_t *) eop)->d_status & TULIP_DSTS_OWNER)
- return;
-
- if (eop->d_status & TULIP_DSTS_RxLASTDESC)
- break;
- if (++eop == ri->ri_last)
- eop = ri->ri_first;
- }
-
- bufaddr += TULIP_RXBUFSIZE * (ri->ri_nextin - ri->ri_first);
- total_len = ((eop->d_status >> 16) & 0x7FF) - 4;
-
- if ((eop->d_status & TULIP_DSTS_ERRSUM) == 0) {
- struct ether_header eh;
- struct mbuf *m;
-
-#if TULIP_CHECK_RXCRC
- unsigned crc = tulip_crc32(bufaddr, total_len);
- if (~crc != *((unsigned *) &bufaddr[total_len])) {
- printf("de0: bad rx crc: %08x [rx] != %08x\n",
- *((unsigned *) &bufaddr[total_len]), ~crc);
- goto next;
- }
-#endif
- eh = *(struct ether_header *) bufaddr;
-#if NBPFILTER > 0
- if (sc->tulip_bpf != NULL) {
- bpf_tap(sc->tulip_bpf, bufaddr, total_len);
- if ((eh.ether_dhost[0] & 1) == 0 &&
- !TULIP_ADDREQUAL(eh.ether_dhost, sc->tulip_ac.ac_enaddr))
- goto next;
- } else if (!TULIP_ADDREQUAL(eh.ether_dhost, sc->tulip_ac.ac_enaddr)
- && !TULIP_ADDRBRDCST(eh.ether_dhost)) {
- goto next;
- }
-#endif
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m != NULL) {
- m->m_pkthdr.rcvif = ifp;
- total_len -= sizeof(eh);
- if (total_len > MHLEN) {
- MCLGET(m, M_DONTWAIT);
- if ((m->m_flags & M_EXT) == 0) {
- m_freem(m);
- ifp->if_ierrors++;
- goto next;
- }
- }
- bcopy(bufaddr + sizeof(eh), mtod(m, caddr_t), total_len);
- m->m_len = m->m_pkthdr.len = total_len;
- ether_input(ifp, &eh, m);
- } else {
- ifp->if_ierrors++;
- }
- } else {
- ifp->if_ierrors++;
- }
-next:
- ifp->if_ipackets++;
- while (ndescs-- > 0) {
- ri->ri_nextin->d_status |= TULIP_DSTS_OWNER;
- if (++ri->ri_nextin == ri->ri_last)
- ri->ri_nextin = ri->ri_first;
- }
- }
-}
-
-static int
-tulip_tx_intr(
- tulip_softc_t *sc)
-{
- tulip_ringinfo_t *ri = &sc->tulip_txinfo;
- struct mbuf *m;
- int xmits = 0;
-
- while (ri->ri_free < ri->ri_max) {
- if (((volatile tulip_desc_t *) ri->ri_nextin)->d_status & TULIP_DSTS_OWNER)
- break;
-
- if (ri->ri_nextin->d_flag & TULIP_DFLAG_TxLASTSEG) {
- if (ri->ri_nextin->d_flag & TULIP_DFLAG_TxSETUPPKT) {
- /*
- * We've just finished processing a setup packet.
- * Mark that we can finished it. If there's not
- * another pending, startup the TULIP receiver.
- * Make sure we ack the RXSTOPPED so we won't get
- * an abormal interrupt indication.
- */
- sc->tulip_flags &= ~TULIP_DOINGSETUP;
- if ((sc->tulip_flags & TULIP_WANTSETUP) == 0) {
- sc->tulip_cmdmode |= TULIP_CMD_RXRUN;
- sc->tulip_intrmask |= TULIP_STS_RXSTOPPED;
- *sc->tulip_csrs.csr_status = TULIP_STS_RXSTOPPED;
- *sc->tulip_csrs.csr_command = sc->tulip_cmdmode;
- *sc->tulip_csrs.csr_intr = sc->tulip_intrmask;
- }
- } else {
- IF_DEQUEUE(&sc->tulip_txq, m);
- m_freem(m);
- sc->tulip_if.if_collisions +=
- (ri->ri_nextin->d_status & TULIP_DSTS_TxCOLLMASK)
- >> TULIP_DSTS_V_TxCOLLCNT;
- if (ri->ri_nextin->d_status & TULIP_DSTS_ERRSUM)
- sc->tulip_if.if_oerrors++;
- xmits++;
- }
- }
-
- if (++ri->ri_nextin == ri->ri_last)
- ri->ri_nextin = ri->ri_first;
- ri->ri_free++;
- sc->tulip_if.if_flags &= ~IFF_OACTIVE;
- }
- sc->tulip_if.if_opackets += xmits;
- return xmits;
-}
-
-static int
-tulip_txsegment(
- tulip_softc_t *sc,
- struct mbuf *m,
- tulip_addrvec_t *avp,
- size_t maxseg)
-{
- int segcnt;
-
- for (segcnt = 0; m; m = m->m_next) {
- int len = m->m_len;
- caddr_t addr = mtod(m, caddr_t);
- unsigned clsize = CLBYTES - (((u_long) addr) & (CLBYTES-1));
-
- while (len > 0) {
- unsigned slen = min(len, clsize);
- if (segcnt < maxseg) {
- avp->addr = vtophys(addr);
- avp->length = slen;
- }
- len -= slen;
- addr += slen;
- clsize = CLBYTES;
- avp++;
- segcnt++;
- }
- }
- if (segcnt >= maxseg) {
- printf("%s%d: tulip_txsegment: extremely fragmented packet encountered (%d segments)\n",
- sc->tulip_name, sc->tulip_unit, segcnt);
- return -1;
- }
- avp->addr = 0;
- avp->length = 0;
- return segcnt;
-}
-
-static void
-tulip_start(
- struct ifnet *ifp)
-{
- tulip_softc_t *sc = (tulip_softc_t *) ifp;
- struct ifqueue *ifq = &ifp->if_snd;
- tulip_ringinfo_t *ri = &sc->tulip_txinfo;
- tulip_desc_t *sop, *eop;
- struct mbuf *m;
- tulip_addrvec_t addrvec[TULIP_MAX_TXSEG+1], *avp;
- int segcnt;
- tulip_uint32_t d_status;
-
- if ((ifp->if_flags & IFF_RUNNING) == 0)
- return;
-
- for (;;) {
- if (sc->tulip_flags & TULIP_WANTSETUP) {
- if ((sc->tulip_flags & TULIP_DOINGSETUP) || ri->ri_free == 1) {
- ifp->if_flags |= IFF_OACTIVE;
- return;
- }
- bcopy(sc->tulip_setupdata, sc->tulip_setupbuf,
- sizeof(sc->tulip_setupbuf));
- sc->tulip_flags &= ~TULIP_WANTSETUP;
- sc->tulip_flags |= TULIP_DOINGSETUP;
- ri->ri_free--;
- ri->ri_nextout->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN;
- ri->ri_nextout->d_flag |= TULIP_DFLAG_TxFIRSTSEG|TULIP_DFLAG_TxLASTSEG
- |TULIP_DFLAG_TxSETUPPKT|TULIP_DFLAG_TxWANTINTR;
- if (sc->tulip_flags & TULIP_WANTHASH)
- ri->ri_nextout->d_flag |= TULIP_DFLAG_TxHASHFILT;
- ri->ri_nextout->d_length1 = sizeof(sc->tulip_setupbuf);
- ri->ri_nextout->d_addr1 = vtophys(sc->tulip_setupbuf);
- ri->ri_nextout->d_length2 = 0;
- ri->ri_nextout->d_addr2 = 0;
- ri->ri_nextout->d_status = TULIP_DSTS_OWNER;
- *sc->tulip_csrs.csr_txpoll = 1;
- /*
- * Advance the ring for the next transmit packet.
- */
- if (++ri->ri_nextout == ri->ri_last)
- ri->ri_nextout = ri->ri_first;
- }
-
- IF_DEQUEUE(ifq, m);
- if (m == NULL)
- break;
-
- /*
- * First find out how many and which different pages
- * the mbuf data occupies. Then check to see if we
- * have enough descriptor space in our transmit ring
- * to actually send it.
- */
- segcnt = tulip_txsegment(sc, m, addrvec,
- min(ri->ri_max - 1, TULIP_MAX_TXSEG));
- if (segcnt < 0) {
- struct mbuf *m0;
- MGETHDR(m0, M_DONTWAIT, MT_DATA);
- if (m0 != NULL) {
- if (m->m_pkthdr.len > MHLEN) {
- MCLGET(m0, M_DONTWAIT);
- if ((m0->m_flags & M_EXT) == 0) {
- m_freem(m);
- continue;
- }
- }
- m_copydata(m, 0, m0->m_pkthdr.len, mtod(m0, caddr_t));
- m0->m_pkthdr.len = m0->m_len = m->m_pkthdr.len;
- m_freem(m);
- IF_PREPEND(ifq, m0);
- continue;
- } else {
- m_freem(m);
- continue;
- }
- }
- if (ri->ri_free - 2 <= (segcnt + 1) >> 1)
- break;
-
- ri->ri_free -= (segcnt + 1) >> 1;
- /*
- * Now we fill in our transmit descriptors. This is
- * a bit reminiscent of going on the Ark two by two
- * since each descriptor for the TULIP can describe
- * two buffers. So we advance through the address
- * vector two entries at a time to to fill each
- * descriptor. Clear the first and last segment bits
- * in each descriptor (actually just clear everything
- * but the end-of-ring or chain bits) to make sure
- * we don't get messed up by previously sent packets.
- */
- sop = ri->ri_nextout;
- d_status = 0;
- avp = addrvec;
- do {
- eop = ri->ri_nextout;
- eop->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN;
- eop->d_status = d_status;
- eop->d_addr1 = avp->addr; eop->d_length1 = avp->length; avp++;
- eop->d_addr2 = avp->addr; eop->d_length2 = avp->length; avp++;
- d_status = TULIP_DSTS_OWNER;
- if (++ri->ri_nextout == ri->ri_last)
- ri->ri_nextout = ri->ri_first;
- } while ((segcnt -= 2) > 0);
-#if NBPFILTER > 0
- if (sc->tulip_bpf != NULL)
- bpf_mtap(sc->tulip_bpf, m);
-#endif
- /*
- * The descriptors have been filled in. Mark the first
- * and last segments, indicate we want a transmit complete
- * interrupt, give the descriptors to the TULIP, and tell
- * it to transmit!
- */
-
- IF_ENQUEUE(&sc->tulip_txq, m);
- eop->d_flag |= TULIP_DFLAG_TxLASTSEG|TULIP_DFLAG_TxWANTINTR;
- sop->d_flag |= TULIP_DFLAG_TxFIRSTSEG;
- sop->d_status = TULIP_DSTS_OWNER;
-
- *sc->tulip_csrs.csr_txpoll = 1;
- }
- if (m != NULL) {
- ifp->if_flags |= IFF_OACTIVE;
- IF_PREPEND(ifq, m);
- }
-}
-
-static int
-tulip_intr(
- tulip_softc_t *sc)
-{
- tulip_uint32_t csr;
-
- while ((csr = *sc->tulip_csrs.csr_status) & (TULIP_STS_NORMALINTR|TULIP_STS_ABNRMLINTR)) {
- *sc->tulip_csrs.csr_status = csr & sc->tulip_intrmask;
-
- if (csr & TULIP_STS_SYSERROR) {
- if ((csr & TULIP_STS_ERRORMASK) == TULIP_STS_ERR_PARITY) {
- TULIP_RESET(sc);
- tulip_init(sc->tulip_unit);
- return 1;
- }
- }
- if (csr & TULIP_STS_ABNRMLINTR) {
- printf("%s%d: abnormal interrupt: 0x%05x [0x%05x]\n",
- sc->tulip_name, sc->tulip_unit, csr, csr & sc->tulip_intrmask);
- *sc->tulip_csrs.csr_command = sc->tulip_cmdmode;
- }
- if (csr & TULIP_STS_RXINTR)
- tulip_rx_intr(sc);
- if (sc->tulip_txinfo.ri_free < sc->tulip_txinfo.ri_max) {
- tulip_tx_intr(sc);
- tulip_start(&sc->tulip_if);
- }
- }
- return 1;
-}
-
-/*
- * This is the standard method of reading the DEC Address ROMS.
- */
-static int
-tulip_read_macaddr(
- tulip_softc_t *sc)
-{
- int cksum, rom_cksum, idx;
- tulip_sint32_t csr;
- unsigned char tmpbuf[8];
- static u_char testpat[] = { 0xFF, 0, 0x55, 0xAA, 0xFF, 0, 0x55, 0xAA };
-
- *sc->tulip_csrs.csr_enetrom = 1;
- for (idx = 0; idx < 32; idx++) {
- int cnt = 0;
- while ((csr = *sc->tulip_csrs.csr_enetrom) < 0 && cnt < 10000)
- cnt++;
- sc->tulip_rombuf[idx] = csr & 0xFF;
- }
-
- if (bcmp(&sc->tulip_rombuf[0], &sc->tulip_rombuf[16], 8) != 0) {
- /*
- * Some folks don't use the standard ethernet rom format
- * but instead just put the address in the first 6 bytes
- * of the rom and let the rest be all 0xffs. (Can we say
- * ZNYX???)
- */
- for (idx = 6; idx < 32; idx++) {
- if (sc->tulip_rombuf[idx] != 0xFF)
- return -4;
- }
- /*
- * Make sure the address is not multicast or locally assigned
- * that the OUI is not 00-00-00.
- */
- if ((sc->tulip_rombuf[0] & 3) != 0)
- return -4;
- if (sc->tulip_rombuf[0] == 0 && sc->tulip_rombuf[1] == 0
- && sc->tulip_rombuf[2] == 0)
- return -4;
- bcopy(sc->tulip_rombuf, sc->tulip_hwaddr, 6);
- return 0;
- }
- if (bcmp(&sc->tulip_rombuf[24], testpat, 8) != 0)
- return -3;
-
- tmpbuf[0] = sc->tulip_rombuf[15]; tmpbuf[1] = sc->tulip_rombuf[14];
- tmpbuf[2] = sc->tulip_rombuf[13]; tmpbuf[3] = sc->tulip_rombuf[12];
- tmpbuf[4] = sc->tulip_rombuf[11]; tmpbuf[5] = sc->tulip_rombuf[10];
- tmpbuf[6] = sc->tulip_rombuf[9]; tmpbuf[7] = sc->tulip_rombuf[8];
- if (bcmp(&sc->tulip_rombuf[0], tmpbuf, 8) != 0)
- return -2;
-
- bcopy(sc->tulip_rombuf, sc->tulip_hwaddr, 6);
-
- cksum = *(u_short *) &sc->tulip_hwaddr[0];
- cksum *= 2;
- if (cksum > 65535) cksum -= 65535;
- cksum += *(u_short *) &sc->tulip_hwaddr[2];
- if (cksum > 65535) cksum -= 65535;
- cksum *= 2;
- if (cksum > 65535) cksum -= 65535;
- cksum += *(u_short *) &sc->tulip_hwaddr[4];
- if (cksum >= 65535) cksum -= 65535;
-
- rom_cksum = *(u_short *) &sc->tulip_rombuf[6];
-
- if (cksum != rom_cksum)
- return -1;
- return 0;
-}
-
-static unsigned
-tulip_mchash(
- unsigned char *mca)
-{
- u_int idx, bit, data, crc = 0xFFFFFFFFUL;
-
-#ifdef __alpha
- for (data = *(__unaligned u_long *) mca, bit = 0; bit < 48; bit++, data >>=
-1)
- crc = (crc >> 1) ^ (((crc ^ data) & 1) ? TULIP_CRC32_POLY : 0);
-#else
- for (idx = 0; idx < 6; idx++)
- for (data = *mca++, bit = 0; bit < 8; bit++, data >>= 1)
- crc = (crc >> 1) ^ (((crc ^ data) & 1) ? TULIP_CRC32_POLY : 0);
-#endif
- return crc & 0x1FF;
-}
-
-static void
-tulip_addr_filter(
- tulip_softc_t *sc)
-{
- tulip_uint32_t *sp = sc->tulip_setupdata;
- struct ether_multistep step;
- struct ether_multi *enm;
- int i;
-
- sc->tulip_flags &= ~TULIP_WANTHASH;
- sc->tulip_flags |= TULIP_WANTSETUP;
- sc->tulip_cmdmode &= ~TULIP_CMD_RXRUN;
- sc->tulip_intrmask &= ~TULIP_STS_RXSTOPPED;
- if (sc->tulip_ac.ac_multicnt > 14) {
- unsigned hash;
- /*
- * If we have more than 14 multicasts, we have
- * go into hash perfect mode (512 bit multicast
- * hash and one perfect hardware).
- */
-
- bzero(sc->tulip_setupdata, sizeof(sc->tulip_setupdata));
- hash = tulip_mchash(etherbroadcastaddr);
- sp[hash >> 4] |= 1 << (hash & 0xF);
- ETHER_FIRST_MULTI(step, &sc->tulip_ac, enm);
- while (enm != NULL) {
- hash = tulip_mchash(enm->enm_addrlo);
- sp[hash >> 4] |= 1 << (hash & 0xF);
- ETHER_NEXT_MULTI(step, enm);
- }
- sc->tulip_cmdmode |= TULIP_WANTHASH;
- sp[40] = ((u_short *) sc->tulip_ac.ac_enaddr)[0];
- sp[41] = ((u_short *) sc->tulip_ac.ac_enaddr)[1];
- sp[42] = ((u_short *) sc->tulip_ac.ac_enaddr)[2];
- } else {
- /*
- * Else can get perfect filtering for 16 addresses.
- */
- i = 0;
- ETHER_FIRST_MULTI(step, &sc->tulip_ac, enm);
- for (; enm != NULL; i++) {
- *sp++ = ((u_short *) enm->enm_addrlo)[0];
- *sp++ = ((u_short *) enm->enm_addrlo)[1];
- *sp++ = ((u_short *) enm->enm_addrlo)[2];
- ETHER_NEXT_MULTI(step, enm);
- }
- /*
- * If an IP address is enabled, turn on broadcast
- */
- if (sc->tulip_ac.ac_ipaddr.s_addr != 0) {
- i++;
- *sp++ = 0xFFFF;
- *sp++ = 0xFFFF;
- *sp++ = 0xFFFF;
- }
- /*
- * Pad the rest with our hardware address
- */
- for (; i < 16; i++) {
- *sp++ = ((u_short *) sc->tulip_ac.ac_enaddr)[0];
- *sp++ = ((u_short *) sc->tulip_ac.ac_enaddr)[1];
- *sp++ = ((u_short *) sc->tulip_ac.ac_enaddr)[2];
- }
- }
-}
-
-static int
-tulip_ioctl(
- struct ifnet *ifp,
- int cmd,
- caddr_t data)
-{
- tulip_softc_t *sc = tulips[ifp->if_unit];
- struct ifaddr *ifa = (struct ifaddr *)data;
- struct ifreq *ifr = (struct ifreq *) data;
- int s, error = 0;
-
- s = splimp();
-
- switch (cmd) {
- case SIOCSIFADDR: {
-
- ifp->if_flags |= IFF_UP;
- switch(ifa->ifa_addr->sa_family) {
-#ifdef INET
- case AF_INET: {
- ((struct arpcom *)ifp)->ac_ipaddr = IA_SIN(ifa)->sin_addr;
- tulip_addr_filter(sc); /* reset multicast filtering */
- (*ifp->if_init)(ifp->if_unit);
- arp_ifinit((struct arpcom *)ifp, ifa);
- break;
- }
-#endif /* INET */
-
-#ifdef NS
- /* This magic copied from if_is.c; I don't use XNS,
- * so I have no way of telling if this actually
- * works or not.
- */
- case AF_NS: {
- struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
- if (ns_nullhost(*ina)) {
- ina->x_host = *(union ns_host *)(sc->tulip_ac.ac_enaddr);
- } else {
- ifp->if_flags &= ~IFF_RUNNING;
- bcopy((caddr_t)ina->x_host.c_host,
- (caddr_t)sc->tulip_ac.ac_enaddr,
- sizeof sc->tulip_ac.ac_enaddr);
- }
-
- (*ifp->if_init)(ifp->if_unit);
- break;
- }
-#endif /* NS */
-
- default: {
- (*ifp->if_init)(ifp->if_unit);
- break;
- }
- }
- break;
- }
-
- case SIOCSIFFLAGS: {
- /*
- * Changing the connection forces a reset.
- */
- if (sc->tulip_flags & TULIP_ALTPHYS) {
- if ((ifp->if_flags & IFF_ALTPHYS) == 0)
- TULIP_RESET(sc);
- } else {
- if (ifp->if_flags & IFF_ALTPHYS)
- TULIP_RESET(sc);
- }
- (*ifp->if_init)(ifp->if_unit);
- break;
- }
-
- case SIOCADDMULTI:
- case SIOCDELMULTI: {
- /*
- * Update multicast listeners
- */
- if (cmd == SIOCADDMULTI)
- error = ether_addmulti(ifr, &sc->tulip_ac);
- else
- error = ether_delmulti(ifr, &sc->tulip_ac);
-
- if (error == ENETRESET) {
- tulip_addr_filter(sc); /* reset multicast filtering */
- (*ifp->if_init)(ifp->if_unit);
- error = 0;
- }
- break;
- }
- case SIOCSIFMTU:
- /*
- * Set the interface MTU.
- */
- if (ifr->ifr_mtu > ETHERMTU) {
- error = EINVAL;
- } else {
- ifp->if_mtu = ifr->ifr_mtu;
- }
- break;
-
- default: {
- error = EINVAL;
- break;
- }
- }
-
- splx(s);
- return error;
-}
-
-static void
-tulip_attach(
- tulip_softc_t *sc)
-{
- struct ifnet *ifp = &sc->tulip_if;
- int cnt;
-
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
-
- *sc->tulip_csrs.csr_sia_connectivity = 0;
- *sc->tulip_csrs.csr_sia_connectivity = TULIP_SIACONN_10BASET;
- for (cnt = 0; cnt < 240000; cnt++) {
- if ((*sc->tulip_csrs.csr_sia_status & TULIP_SIASTS_LINKFAIL) == 0)
- break;
- DELAY(10);
- }
- if (*sc->tulip_csrs.csr_sia_status & TULIP_SIASTS_LINKFAIL) {
- ifp->if_flags |= IFF_ALTPHYS;
- } else {
- sc->tulip_flags |= TULIP_ALTPHYS;
- }
- TULIP_RESET(sc);
-
- ifp->if_init = tulip_init;
- ifp->if_ioctl = tulip_ioctl;
- ifp->if_output = ether_output;
- ifp->if_reset = tulip_reset;
- ifp->if_start = tulip_start;
-
- printf("%s%d: %s pass %d.%d ethernet address %s\n",
- sc->tulip_name, sc->tulip_unit,
- tulip_chipdescs[tulip_chipids[sc->tulip_unit]],
- (sc->tulip_revinfo & 0xF0) >> 4,
- sc->tulip_revinfo & 0x0F,
- ether_sprintf(sc->tulip_hwaddr));
-
- if_attach(ifp);
-
-#if NBPFILTER > 0
- bpfattach(&sc->tulip_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
-#endif
-}
-
-static void
-tulip_initcsrs(
- tulip_softc_t *sc,
- volatile tulip_uint32_t *va_csrs,
- size_t csr_size)
-{
- sc->tulip_csrs.csr_busmode = va_csrs + 0 * csr_size;
- sc->tulip_csrs.csr_txpoll = va_csrs + 1 * csr_size;
- sc->tulip_csrs.csr_rxpoll = va_csrs + 2 * csr_size;
- sc->tulip_csrs.csr_rxlist = va_csrs + 3 * csr_size;
- sc->tulip_csrs.csr_txlist = va_csrs + 4 * csr_size;
- sc->tulip_csrs.csr_status = va_csrs + 5 * csr_size;
- sc->tulip_csrs.csr_command = va_csrs + 6 * csr_size;
- sc->tulip_csrs.csr_intr = va_csrs + 7 * csr_size;
- sc->tulip_csrs.csr_missed_frame = va_csrs + 8 * csr_size;
- sc->tulip_csrs.csr_enetrom = va_csrs + 9 * csr_size;
- sc->tulip_csrs.csr_reserved = va_csrs + 10 * csr_size;
- sc->tulip_csrs.csr_full_duplex = va_csrs + 11 * csr_size;
- sc->tulip_csrs.csr_sia_status = va_csrs + 12 * csr_size;
- sc->tulip_csrs.csr_sia_connectivity = va_csrs + 13 * csr_size;
- sc->tulip_csrs.csr_sia_tx_rx = va_csrs + 14 * csr_size;
- sc->tulip_csrs.csr_sia_general = va_csrs + 15 * csr_size;
-}
-
-static void
-tulip_initring(
- tulip_softc_t *sc,
- tulip_ringinfo_t *ri,
- tulip_desc_t *descs,
- int ndescs)
-{
- ri->ri_max = ndescs;
- ri->ri_first = descs;
- ri->ri_last = ri->ri_first + ri->ri_max;
- bzero((caddr_t) ri->ri_first, sizeof(ri->ri_first[0]) * ri->ri_max);
- ri->ri_last[-1].d_flag = TULIP_DFLAG_ENDRING;
-}
-
-#if NPCI > 0
-/*
- * This is the PCI configuration support. Since the DC21040 is available
- * on both EISA and PCI boards, one must be careful in how defines the
- * DC21040 in the config file.
- */
-static char* tulip_pci_probe (pcici_t config_id, pcidi_t device_id);
-static void tulip_pci_attach(pcici_t config_id, int unit);
-static u_long tulip_count;
-
-struct pci_driver dedevice = {
- tulip_pci_probe,
- tulip_pci_attach,
- &tulip_count,
-};
-
-#define PCI_CFID 0x00 /* Configuration ID */
-#define PCI_CFCS 0x04 /* Configurtion Command/Status */
-#define PCI_CFRV 0x08 /* Configuration Revision */
-#define PCI_CFLT 0x0c /* Configuration Latency Timer */
-#define PCI_CBIO 0x10 /* Configuration Base IO Address */
-#define PCI_CBMA 0x14 /* Configuration Base Memory Address */
-#define PCI_CFIT 0x3c /* Configuration Interrupt */
-#define PCI_CFDA 0x40 /* Configuration Driver Area */
-
-#define TULIP_PCI_CSRSIZE (8 / sizeof(tulip_uint32_t))
-static char*
-tulip_pci_probe(
- pcici_t config_id,
- pcidi_t device_id)
-{
- int idx;
- for (idx = 0; idx < NDE; idx++) {
- if (tulips[idx] == NULL) {
- if (device_id == 0x00021011ul) {
- tulip_chipids[idx] = TULIP_DC21040;
- return "Digital DC21040 Ethernet";
- }
- if (device_id == 0x00091011ul) {
- tulip_chipids[idx] = TULIP_DC21140;
- return "Digital DC21140 Fast Ethernet";
- }
- return NULL;
- }
- }
- return NULL;
-}
-
-static void
-tulip_pci_attach(
- pcici_t config_id,
- int unit)
-{
- tulip_softc_t *sc;
- int retval, idx;
- vm_offset_t va_csrs, pa_csrs;
- tulip_desc_t *rxdescs, *txdescs;
-
- sc = (tulip_softc_t *) malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT);
- if (sc == NULL)
- return;
-
- rxdescs = (tulip_desc_t *)
- malloc(sizeof(tulip_desc_t) * TULIP_RXDESCS, M_DEVBUF, M_NOWAIT);
- if (rxdescs == NULL) {
- free((caddr_t) sc, M_DEVBUF);
- return;
- }
-
- txdescs = (tulip_desc_t *)
- malloc(sizeof(tulip_desc_t) * TULIP_TXDESCS, M_DEVBUF, M_NOWAIT);
- if (txdescs == NULL) {
- free((caddr_t) rxdescs, M_DEVBUF);
- free((caddr_t) sc, M_DEVBUF);
- return;
- }
-
- bzero(sc, sizeof(*sc)); /* Zero out the softc*/
- sc->tulip_rxspace = vm_page_alloc_contig(TULIP_RXSPACE + NBPG, 0, 0xffffffff, PAGE_SIZE);
- /*
- * We've allocated an extra page of receive space so we can double map
- * the first page of the receive space into the page after the last page
- * of the receive space. This means that even if a receive wraps around
- * the end of the receive space, it will still virtually contiguous and
- * that greatly simplifies the recevie logic.
- */
- pmap_enter(pmap_kernel(), sc->tulip_rxspace + TULIP_RXSPACE,
- vtophys(sc->tulip_rxspace), VM_PROT_READ|VM_PROT_WRITE, TRUE);
-
- sc->tulip_unit = unit;
- sc->tulip_name = "de";
- retval = pci_map_mem(config_id, PCI_CBMA, &va_csrs, &pa_csrs);
- if (!retval) {
- kmem_free(kernel_map, sc->tulip_rxspace, TULIP_RXSPACE + NBPG);
- free((caddr_t) txdescs, M_DEVBUF);
- free((caddr_t) rxdescs, M_DEVBUF);
- free((caddr_t) sc, M_DEVBUF);
- return;
- }
- tulips[unit] = sc;
- tulip_initcsrs(sc, (volatile tulip_uint32_t *) va_csrs, TULIP_PCI_CSRSIZE);
- tulip_initring(sc, &sc->tulip_rxinfo, rxdescs, TULIP_RXDESCS);
- tulip_initring(sc, &sc->tulip_txinfo, txdescs, TULIP_TXDESCS);
- sc->tulip_revinfo = pci_conf_read(config_id, PCI_CFRV);
- if ((retval = tulip_read_macaddr(sc)) < 0) {
- printf("de%d: can't read ENET ROM (why=%d) (", sc->tulip_unit, retval);
- for (idx = 0; idx < 32; idx++)
- printf("%02x", sc->tulip_rombuf[idx]);
- printf("\n");
- printf("%s%d: %s pass %d.%d ethernet address %s\n",
- sc->tulip_name, sc->tulip_unit,
- tulip_chipdescs[tulip_chipids[sc->tulip_unit]],
- (sc->tulip_revinfo & 0xF0) >> 4, sc->tulip_revinfo & 0x0F,
- "unknown");
- } else {
- TULIP_RESET(sc);
- tulip_attach(sc);
- pci_map_int (config_id, tulip_intr, (void*) sc, &net_imask);
- }
-}
-#endif /* NPCI > 0 */
-#endif /* NDE > 0 */
diff --git a/sys/i386/pci/ncr.c b/sys/i386/pci/ncr.c
deleted file mode 100644
index 8a10ddd..0000000
--- a/sys/i386/pci/ncr.c
+++ /dev/null
@@ -1,6505 +0,0 @@
-/**************************************************************************
-**
-** $Id: ncr.c,v 1.13 1994/11/28 23:18:46 se Exp $
-**
-** Device driver for the NCR 53C810 PCI-SCSI-Controller.
-**
-** 386bsd / FreeBSD / NetBSD
-**
-**-------------------------------------------------------------------------
-**
-** Written for 386bsd and FreeBSD by
-** Wolfgang Stanglmeier <wolf@dentaro.gun.de>
-** Stefan Esser <se@mi.Uni-Koeln.de>
-**
-** Ported to NetBSD by
-** Charles M. Hannum <mycroft@gnu.ai.mit.edu>
-**
-**-------------------------------------------------------------------------
-**
-** Copyright (c) 1994 Wolfgang Stanglmeier. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-***************************************************************************
-*/
-
-#define NCR_VERSION (2)
-#define MAX_UNITS (16)
-
-
-/*==========================================================
-**
-** Configuration and Debugging
-**
-** May be overwritten in <i386/conf/XXXXX>
-**
-**==========================================================
-*/
-
-/*
-** SCSI address of this device.
-** The boot routines should have set it.
-** If not, use this.
-*/
-
-#ifndef SCSI_NCR_MYADDR
-#define SCSI_NCR_MYADDR (7)
-#endif /* SCSI_NCR_MYADDR */
-
-/*
-** The maximal synchronous frequency in kHz.
-** (0=asynchronous)
-*/
-
-#ifndef SCSI_NCR_MAX_SYNC
-#define SCSI_NCR_MAX_SYNC (10000)
-#endif /* SCSI_NCR_MAX_SYNC */
-
-/*
-** The maximal bus with (in log2 byte)
-** (0=8 bit, 1=16 bit)
-*/
-
-#ifndef SCSI_NCR_MAX_WIDE
-#define SCSI_NCR_MAX_WIDE (1)
-#endif /* SCSI_NCR_MAX_WIDE */
-
-/*
-** The maximum number of tags per logic unit.
-** Used only for disk devices that support tags.
-*/
-
-#ifndef SCSI_NCR_MAX_TAGS
-#define SCSI_NCR_MAX_TAGS (4)
-#endif /* SCSI_NCR_MAX_TAGS */
-
-/*==========================================================
-**
-** Configuration and Debugging
-**
-**==========================================================
-*/
-
-/*
-** Number of targets supported by the driver.
-** n permits target numbers 0..n-1.
-** Default is 7, meaning targets #0..#6.
-** #7 .. is myself.
-*/
-
-#define MAX_TARGET (7)
-
-/*
-** Number of logic units supported by the driver.
-** n enables logic unit numbers 0..n-1.
-** The common SCSI devices require only
-** one lun, so take 1 as the default.
-*/
-
-#define MAX_LUN (1)
-
-/*
-** The maximum number of jobs scheduled for starting.
-** There should be one slot per target, and one slot
-** for each tag of each target.
-*/
-
-#define MAX_START (7 * SCSI_NCR_MAX_TAGS)
-
-/*
-** The maximum number of segments a transfer is split into.
-*/
-
-#define MAX_SCATTER (33)
-
-/*
-** The maximum transfer length (should be >= 64k).
-** MUST NOT be greater than (MAX_SCATTER-1) * NBPG.
-*/
-
-#define MAX_SIZE ((MAX_SCATTER-1) * NBPG)
-
-/*
-** Write disk status information to dkstat ?
-*/
-
-/* #define DK */
-
-/*==========================================================
-**
-** Include files
-**
-**==========================================================
-*/
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/proc.h>
-
-#ifdef KERNEL
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/buf.h>
-#include <sys/kernel.h>
-#ifdef DK
-#include <sys/dkstat.h>
-#endif /* DK */
-#include <vm/vm.h>
-#endif /* KERNEL */
-
-#include <i386/pci/ncrreg.h>
-
-#ifdef __NetBSD__
-#include <sys/device.h>
-#include <i386/pci/pcivar.h>
-#endif /* __NetBSD */
-#include <i386/pci/pcireg.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-
-/*==========================================================
-**
-** Debugging tags
-**
-**==========================================================
-*/
-
-#define DEBUG_ALLOC (0x0001)
-#define DEBUG_PHASE (0x0002)
-#define DEBUG_POLL (0x0004)
-#define DEBUG_QUEUE (0x0008)
-#define DEBUG_RESULT (0x0010)
-#define DEBUG_SCATTER (0x0020)
-#define DEBUG_SCRIPT (0x0040)
-#define DEBUG_TINY (0x0080)
-#define DEBUG_TIMING (0x0100)
-#define DEBUG_NEGO (0x0200)
-#define DEBUG_TAGS (0x0400)
-#define DEBUG_FREEZE (0x0800)
-#define DEBUG_RESTART (0x1000)
-
-/*
-** Enable/Disable debug messages.
-** Can be changed at runtime too.
-*/
-
-#ifdef SCSI_DEBUG_FLAGS
- #define DEBUG_FLAGS ncr_debug;
-#else /* SCSI_DEBUG_FLAGS */
- #define SCSI_DEBUG_FLAGS 0
- #define DEBUG_FLAGS 0
-#endif /* SCSI_DEBUG_FLAGS */
-
-
-
-/*==========================================================
-**
-** assert ()
-**
-**==========================================================
-**
-** modified copy from 386bsd:/usr/include/sys/assert.h
-**
-**----------------------------------------------------------
-*/
-
-#define assert(expression) { \
- if (!(expression)) { \
- (void)printf(\
- "assertion \"%s\" failed: file \"%s\", line %d\n", \
- #expression, \
- __FILE__, __LINE__); \
- } \
-}
-
-/*==========================================================
-**
-** Access to the controller chip.
-**
-**==========================================================
-*/
-
-#define INB(r) (np->reg->r)
-#define INW(r) (np->reg->r)
-#define INL(r) (np->reg->r)
-
-#define OUTB(r, val) np->reg->r = val
-#define OUTW(r, val) np->reg->r = val
-#define OUTL(r, val) np->reg->r = val
-
-/*==========================================================
-**
-** Command control block states.
-**
-**==========================================================
-*/
-
-#define HS_IDLE (0)
-#define HS_BUSY (1)
-#define HS_NEGOTIATE (2) /* sync/wide data transfer*/
-#define HS_DISCONNECT (3) /* Disconnected by target */
-
-#define HS_COMPLETE (4)
-#define HS_SEL_TIMEOUT (5) /* Selection timeout */
-#define HS_RESET (6) /* SCSI reset */
-#define HS_ABORTED (7) /* Transfer aborted */
-#define HS_TIMEOUT (8) /* Software timeout */
-#define HS_FAIL (9) /* SCSI or PCI bus errors */
-#define HS_UNEXPECTED (10) /* Unexpected disconnect */
-
-#define HS_DONEMASK (0xfc)
-
-/*==========================================================
-**
-** Software Interrupt Codes
-**
-**==========================================================
-*/
-
-#define SIR_SENSE_RESTART (1)
-#define SIR_SENSE_FAILED (2)
-#define SIR_STALL_RESTART (3)
-#define SIR_STALL_QUEUE (4)
-#define SIR_NEGO_SYNC (5)
-#define SIR_NEGO_WIDE (6)
-#define SIR_NEGO_FAILED (7)
-#define SIR_NEGO_PROTO (8)
-#define SIR_REJECT_RECEIVED (9)
-#define SIR_REJECT_SENT (10)
-#define SIR_IGN_RESIDUE (11)
-#define SIR_MISSING_SAVE (12)
-#define SIR_MAX (12)
-
-/*==========================================================
-**
-** Extended error codes.
-** xerr_status field of struct ccb.
-**
-**==========================================================
-*/
-
-#define XE_OK (0)
-#define XE_EXTRA_DATA (1) /* unexpected data phase */
-#define XE_BAD_PHASE (2) /* illegal phase (4/5) */
-
-/*==========================================================
-**
-** Negotiation status.
-** nego_status field of struct ccb.
-**
-**==========================================================
-*/
-
-#define NS_SYNC (1)
-#define NS_WIDE (2)
-
-/*==========================================================
-**
-** "Special features" of targets.
-** quirks field of struct tcb.
-** actualquirks field of struct ccb.
-**
-**==========================================================
-*/
-
-#define QUIRK_AUTOSAVE (0x01)
-#define QUIRK_NOMSG (0x02)
-#define QUIRK_UPDATE (0x80)
-
-/*==========================================================
-**
-** Capability bits in Inquire response byte 7.
-**
-**==========================================================
-*/
-
-#define INQ7_QUEUE (0x02)
-#define INQ7_SYNC (0x10)
-#define INQ7_WIDE16 (0x20)
-
-/*==========================================================
-**
-** Misc.
-**
-**==========================================================
-*/
-
-#define CCB_MAGIC (0xf2691ad2)
-#define MAX_TAGS (16) /* hard limit */
-
-/*==========================================================
-**
-** OS dependencies.
-**
-**==========================================================
-*/
-
-#ifndef __FreeBSD__
-#ifndef __NetBSD__
- #define ANCIENT
-#endif /*__NetBSD__*/
-#endif /*__FreeBSD__*/
-
-#ifdef ANCIENT
-#ifdef KERNEL
- extern int splbio(void);
- extern void splx(int level);
- extern int wakeup(void* channel);
- extern int tsleep();
- extern int DELAY();
- extern int scsi_attachdevs();
- extern void timeout();
- extern void untimeout();
-#endif /* KERNEL */
- #define bio_imask biomask
- #define LUN lu
- #define TARGET targ
- #define PRINT_ADDR(xp) printf ("ncr0: targ %d lun %d ",xp->targ,xp->lu)
- #define INT32 int
- #define U_INT32 long
- #define TIMEOUT
-#else /* !ANCIENT */
- #define LUN sc_link->lun
- #define TARGET sc_link->target
- #define PRINT_ADDR(xp) sc_print_addr(xp->sc_link)
-#ifdef __NetBSD__
- #define INT32 int
- #define U_INT32 u_int
- #define TIMEOUT (void*)
-#else /*__NetBSD__*/
- #define INT32 int32
- #define U_INT32 u_int32
- #define TIMEOUT (timeout_func_t)
-#endif /*__NetBSD__*/
-#endif /* ANCIENT */
-
-/*==========================================================
-**
-** Declaration of structs.
-**
-**==========================================================
-*/
-
-struct tcb;
-struct lcb;
-struct ccb;
-struct ncb;
-struct script;
-
-typedef struct ncb * ncb_p;
-typedef struct tcb * tcb_p;
-typedef struct lcb * lcb_p;
-typedef struct ccb * ccb_p;
-
-struct link {
- u_long l_cmd;
- u_long l_paddr;
-};
-
-struct usrcmd {
- u_long target;
- u_long lun;
- u_long data;
- u_long cmd;
-};
-
-#define UC_SETSYNC 10
-#define UC_SETTAGS 11
-#define UC_SETDEBUG 12
-#define UC_SETORDER 13
-#define UC_SETWIDE 14
-#define UC_SETFLAG 15
-
-#define UF_TRACE (0x01)
-
-
-/*==========================================================
-**
-** Access to fields of structs.
-**
-**==========================================================
-*/
-
-#define offsetof(type, member) ((size_t)(&((type *)0)->member))
-
-/*---------------------------------------
-**
-** Timestamps for profiling
-**
-**---------------------------------------
-*/
-
-struct tstamp {
- struct timeval start;
- struct timeval end;
- struct timeval select;
- struct timeval command;
- struct timeval data;
- struct timeval status;
- struct timeval disconnect;
- struct timeval reselect;
-};
-
-/*
-** profiling data (per device)
-*/
-
-struct profile {
- u_long num_trans;
- u_long num_bytes;
- u_long num_disc;
- u_long num_break;
- u_long num_int;
- u_long num_fly;
- u_long ms_setup;
- u_long ms_data;
- u_long ms_disc;
- u_long ms_post;
-};
-
-/*==========================================================
-**
-** Declaration of structs: TARGET control block
-**
-**==========================================================
-*/
-
-struct tcb {
- /*
- ** during reselection the ncr jumps to this point
- ** with SFBR set to the encoded TARGET number
- ** with bit 7 set.
- ** if it's not this target, jump to the next.
- **
- ** JUMP IF (SFBR != #TARGET#)
- ** @(next tcb)
- */
-
- struct link jump_tcb;
-
- /*
- ** load the actual values for the sxfer and the scntl3
- ** register (sync/wide mode).
- **
- ** SCR_COPY (1);
- ** @(sval field of this tcb)
- ** @(sxfer register)
- ** SCR_COPY (1);
- ** @(wval field of this tcb)
- ** @(scntl3 register)
- */
-
- ncrcmd getscr[6];
-
- /*
- ** if next message is "identify"
- ** then load the message to SFBR,
- ** else load 0 to SFBR.
- **
- ** CALL
- ** <RESEL_LUN>
- */
-
- struct link call_lun;
-
- /*
- ** now look for the right lun.
- **
- ** JUMP
- ** @(first ccb of this lun)
- */
-
- struct link jump_lcb;
-
- /*
- ** pointer to interrupted getcc ccb
- */
-
- ccb_p hold_cp;
-
- /*
- ** statistical data
- */
-
- u_long transfers;
- u_long bytes;
-
- /*
- ** user settable limits for sync transfer
- ** and tagged commands.
- */
-
- u_char usrsync;
- u_char usrtags;
- u_char usrwide;
- u_char usrflag;
-
- /*
- ** negotiation of wide and synch transfer.
- ** device quirks.
- */
-
-/*0*/ u_char minsync;
-/*1*/ u_char sval;
-/*2*/ u_short period;
-/*0*/ u_char maxoffs;
-
-/*1*/ u_char quirks;
-
-/*2*/ u_char widedone;
-/*3*/ u_char wval;
- /*
- ** inquire data
- */
-#define MAX_INQUIRE 36
- u_char inqdata[MAX_INQUIRE];
-
- /*
- ** the lcb's of this tcb
- */
-
- lcb_p lp[MAX_LUN];
-};
-
-/*==========================================================
-**
-** Declaration of structs: LUN control block
-**
-**==========================================================
-*/
-
-struct lcb {
- /*
- ** during reselection the ncr jumps to this point
- ** with SFBR set to the "Identify" message.
- ** if it's not this lun, jump to the next.
- **
- ** JUMP IF (SFBR == #LUN#)
- ** @(next lcb of this target)
- */
-
- struct link jump_lcb;
-
- /*
- ** if next message is "simple tag",
- ** then load the tag to SFBR,
- ** else load 0 to SFBR.
- **
- ** CALL
- ** <RESEL_TAG>
- */
-
- struct link call_tag;
-
- /*
- ** now look for the right ccb.
- **
- ** JUMP
- ** @(first ccb of this lun)
- */
-
- struct link jump_ccb;
-
- /*
- ** start of the ccb chain
- */
-
- ccb_p next_ccb;
-
- /*
- ** Control of tagged queueing
- */
-
- u_char reqccbs;
- u_char actccbs;
- u_char reqlink;
- u_char actlink;
- u_char usetags;
- u_char lasttag;
-};
-
-/*==========================================================
-**
-** Declaration of structs: COMMAND control block
-**
-**==========================================================
-**
-** This substructure is copied from the ccb to a
-** global address after selection (or reselection)
-** and copied back before disconnect.
-**
-** These fields are accessible to the script processor.
-**
-**----------------------------------------------------------
-*/
-
-struct head {
- /*
- ** Execution of a ccb starts at this point.
- ** It's a jump to the "SELECT" label
- ** of the script.
- **
- ** After successful selection the script
- ** processor overwrites it with a jump to
- ** the IDLE label of the script.
- */
-
- struct link launch;
-
- /*
- ** Saved data pointer.
- ** Points to the position in the script
- ** responsible for the actual transfer
- ** of data.
- ** It's written after reception of a
- ** "SAVE_DATA_POINTER" message.
- ** The goalpointer points after
- ** the last transfer command.
- */
-
- u_long savep;
- u_long lastp;
- u_long goalp;
-
- /*
- ** The virtual address of the ccb
- ** containing this header.
- */
-
- ccb_p cp;
-
- /*
- ** space for some timestamps to gather
- ** profiling data about devices and this driver.
- */
-
- struct tstamp stamp;
-
- /*
- ** status fields.
- */
-
- u_char status[8];
-};
-
-/*
-** The status bytes are used by the host and the script processor.
-**
-** The first four byte are copied to the scratchb register
-** (declared as scr0..scr3 in ncr_reg.h) just after the select/reselect,
-** and copied back just after disconnecting.
-** Inside the script the XX_REG are used.
-**
-** The last four bytes are used inside the script by "COPY" commands.
-** Because source and destination must have the same alignment
-** in a longword, the fields HAVE to be on the selected offsets.
-** xerr_st (4) 0 (0x34) scratcha
-** sync_st (5) 1 (0x05) sxfer
-** wide_st (7) 3 (0x03) scntl3
-*/
-
-/*
-** First four bytes (script)
-*/
-#define QU_REG scr0
-#define HS_REG scr1
-#define HS_PRT nc_scr1
-#define SS_REG scr2
-#define PS_REG scr3
-
-/*
-** First four bytes (host)
-*/
-#define actualquirks phys.header.status[0]
-#define host_status phys.header.status[1]
-#define scsi_status phys.header.status[2]
-#define parity_status phys.header.status[3]
-
-/*
-** Last four bytes (script)
-*/
-#define xerr_st header.status[4] /* MUST be ==0 mod 4 */
-#define sync_st header.status[5] /* MUST be ==1 mod 4 */
-#define nego_st header.status[6]
-#define wide_st header.status[7] /* MUST be ==3 mod 4 */
-
-/*
-** Last four bytes (host)
-*/
-#define xerr_status phys.xerr_st
-#define sync_status phys.sync_st
-#define nego_status phys.nego_st
-#define wide_status phys.wide_st
-
-/*==========================================================
-**
-** Declaration of structs: Data structure block
-**
-**==========================================================
-**
-** During execution of a ccb by the script processor,
-** the DSA (data structure address) register points
-** to this substructure of the ccb.
-** This substructure contains the header with
-** the script-processor-changable data and
-** data blocks for the indirect move commands.
-**
-**----------------------------------------------------------
-*/
-
-struct dsb {
-
- /*
- ** Header.
- ** Has to be the first entry,
- ** because it's jumped to by the
- ** script processor
- */
-
- struct head header;
-
- /*
- ** Table data for Script
- */
-
- struct scr_tblsel select;
- struct scr_tblmove smsg ;
- struct scr_tblmove smsg2 ;
- struct scr_tblmove cmd ;
- struct scr_tblmove sense ;
- struct scr_tblmove data [MAX_SCATTER];
-};
-
-/*==========================================================
-**
-** Declaration of structs: Command control block.
-**
-**==========================================================
-**
-** During execution of a ccb by the script processor,
-** the DSA (data structure address) register points
-** to this substructure of the ccb.
-** This substructure contains the header with
-** the script-processor-changable data and then
-** data blocks for the indirect move commands.
-**
-**----------------------------------------------------------
-*/
-
-
-struct ccb {
- /*
- ** during reselection the ncr jumps to this point.
- ** If a "SIMPLE_TAG" message was received,
- ** then SFBR is set to the tag.
- ** else SFBR is set to 0
- ** If looking for another tag, jump to the next ccb.
- **
- ** JUMP IF (SFBR != #TAG#)
- ** @(next ccb of this lun)
- */
-
- struct link jump_ccb;
-
- /*
- ** After execution of this call, the return address
- ** (in the TEMP register) points to the following
- ** data structure block.
- ** So copy it to the DSA register, and start
- ** processing of this data structure.
- **
- ** CALL
- ** <RESEL_TMP>
- */
-
- struct link call_tmp;
-
- /*
- ** This is the data structure which is
- ** to be executed by the script processor.
- */
-
- struct dsb phys;
-
- /*
- ** If a data transfer phase is terminated too early
- ** (after reception of a message (i.e. DISCONNECT)),
- ** we have to prepare a mini script to transfer
- ** the rest of the data.
- */
-
- u_long patch[8];
-
- /*
- ** The general SCSI driver provides a
- ** pointer to a control block.
- */
-
- struct scsi_xfer *xfer;
-
-#ifdef ANCIENT
- /*
- ** We copy the SCSI command, because it
- ** may be volatile (on the stack).
- **
- */
- struct scsi_generic cmd;
-#endif /* ANCIENT */
-
- /*
- ** We prepare a message to be sent after selection,
- ** and a second one to be sent after getcc selection.
- ** Contents are IDENTIFY and SIMPLE_TAG.
- ** While negotiating sync or wide transfer,
- ** a SDTM or WDTM message is appended.
- */
-
- u_char scsi_smsg [8];
- u_char scsi_smsg2[8];
-
- /*
- ** Lock this ccb.
- ** Flag is used while looking for a free ccb.
- */
-
- u_long magic;
-
- /*
- ** Completion time out for this job.
- ** It's set to time of start + allowed number of seconds.
- */
-
- u_long tlimit;
-
- /*
- ** All ccbs of one hostadapter are linked.
- */
-
- ccb_p link_ccb;
-
- /*
- ** All ccbs of one target/lun are linked.
- */
-
- ccb_p next_ccb;
-
- /*
- ** Tag for this transfer.
- ** It's patched into jump_ccb.
- ** If it's not zero, a SIMPLE_TAG
- ** message is included in smsg.
- */
-
- u_char tag;
-};
-
-/*==========================================================
-**
-** Declaration of structs: NCR device descriptor
-**
-**==========================================================
-*/
-
-struct ncb {
-#ifdef __NetBSD__
- struct device sc_dev;
- struct intrhand sc_ih;
-#else /* !__NetBSD__ */
- int unit;
-#endif /* __NetBSD__ */
-
- /*-----------------------------------------------
- ** Scripts ..
- **-----------------------------------------------
- **
- ** During reselection the ncr jumps to this point.
- ** The SFBR register is loaded with the encoded target id.
- **
- ** Jump to the first target.
- **
- ** JUMP
- ** @(next tcb)
- */
- struct link jump_tcb;
-
- /*-----------------------------------------------
- ** Configuration ..
- **-----------------------------------------------
- **
- ** virtual and physical addresses
- ** of the 53c810 chip.
- */
- vm_offset_t vaddr;
- vm_offset_t paddr;
-
- /*
- ** pointer to the chip's registers.
- */
- volatile
- struct ncr_reg* reg;
-
- /*
- ** A copy of the script, relocated for this ncb.
- */
- struct script *script;
- u_long p_script;
-
- /*
- ** The SCSI address of the host adapter.
- */
- u_char myaddr;
-
- /*
- ** timing parameters
- */
- u_char ns_async;
- u_char ns_sync;
- u_char rv_scntl3;
-
-#ifndef ANCIENT
- /*-----------------------------------------------
- ** Link to the generic SCSI driver
- **-----------------------------------------------
- */
-
- struct scsi_link sc_link;
-#endif /* ANCIENT */
-
- /*-----------------------------------------------
- ** Job control
- **-----------------------------------------------
- **
- ** Commands from user
- */
- struct usrcmd user;
- u_char order;
-
- /*
- ** Target data
- */
- struct tcb target[MAX_TARGET];
-
- /*
- ** Start queue.
- */
- u_long squeue [MAX_START];
- u_short squeueput;
- u_short actccbs;
-
- /*
- ** Timeout handler
- */
- u_long heartbeat;
- u_short ticks;
- u_short latetime;
- u_long lasttime;
-
- /*-----------------------------------------------
- ** Debug and profiling
- **-----------------------------------------------
- **
- ** register dump
- */
- struct ncr_reg regdump;
- struct timeval regtime;
-
- /*
- ** Profiling data
- */
- struct profile profile;
- u_long disc_phys;
- u_long disc_ref;
-
- /*
- ** The global header.
- ** Accessible to both the host and the
- ** script-processor.
- */
- struct head header;
-
- /*
- ** The global control block.
- ** It's used only during the configuration phase.
- ** A target control block will be created
- ** after the first successful transfer.
- */
- struct ccb ccb;
-
- /*
- ** message buffers.
- ** Should be longword aligned,
- ** because they're written with a
- ** COPY script command.
- */
- u_char msgout[8];
- u_char msgin [8];
- u_long lastmsg;
-
- /*
- ** Buffer for STATUS_IN phase.
- */
- u_char scratch;
-
- /*
- ** controller chip dependent maximal transfer width.
- */
- u_char maxwide;
-
- /*
- ** lockout of execption handler call while starting command.
- */
- u_char lock;
-};
-
-/*==========================================================
-**
-**
-** Script for NCR-Processor.
-**
-** Use ncr_script_fill() to create the variable parts.
-** Use ncr_script_copy_and_bind() to make a copy and
-** bind to physical addresses.
-**
-**
-**==========================================================
-**
-** We have to know the offsets of all labels before
-** we reach them (for forward jumps).
-** Therefore we declare a struct here.
-** If you make changes inside the script,
-** DONT FORGET TO CHANGE THE LENGTHS HERE!
-**
-**----------------------------------------------------------
-*/
-
-struct script {
- ncrcmd start [ 7];
- ncrcmd start0 [ 2];
- ncrcmd start1 [ 3];
- ncrcmd startpos [ 1];
- ncrcmd tryloop [MAX_START*5+2];
- ncrcmd trysel [ 8];
- ncrcmd skip [ 8];
- ncrcmd skip2 [ 3];
- ncrcmd idle [ 2];
- ncrcmd select [ 24];
- ncrcmd prepare [ 4];
- ncrcmd loadpos [ 14];
- ncrcmd prepare2 [ 24];
- ncrcmd setmsg [ 5];
- ncrcmd clrack [ 2];
- ncrcmd dispatch [ 31];
- ncrcmd no_data [ 17];
- ncrcmd checkatn [ 10];
- ncrcmd command [ 15];
- ncrcmd status [ 27];
- ncrcmd msg_in [ 26];
- ncrcmd msg_bad [ 6];
- ncrcmd msg_parity [ 6];
- ncrcmd msg_reject [ 8];
- ncrcmd msg_ign_residue [ 32];
- ncrcmd msg_extended [ 18];
- ncrcmd msg_ext_2 [ 18];
- ncrcmd msg_wdtr [ 27];
- ncrcmd msg_ext_3 [ 18];
- ncrcmd msg_sdtr [ 27];
- ncrcmd complete [ 13];
- ncrcmd cleanup [ 12];
- ncrcmd cleanup0 [ 11];
- ncrcmd signal [ 10];
- ncrcmd save_dp [ 5];
- ncrcmd restore_dp [ 5];
- ncrcmd disconnect [ 12];
- ncrcmd disconnect0 [ 5];
- ncrcmd disconnect1 [ 23];
- ncrcmd msg_out [ 9];
- ncrcmd msg_out_done [ 7];
- ncrcmd msg_out_abort [ 10];
- ncrcmd getcc [ 4];
- ncrcmd getcc1 [ 5];
- ncrcmd getcc2 [ 33];
- ncrcmd getcc3 [ 10];
- ncrcmd badgetcc [ 6];
- ncrcmd reselect [ 12];
- ncrcmd reselect2 [ 6];
- ncrcmd resel_tmp [ 5];
- ncrcmd resel_lun [ 18];
- ncrcmd resel_tag [ 24];
- ncrcmd data_in [MAX_SCATTER * 4 + 7];
- ncrcmd data_out [MAX_SCATTER * 4 + 7];
- ncrcmd aborttag [ 4];
- ncrcmd abort [ 20];
- ncrcmd snooptest [ 11];
-};
-
-/*==========================================================
-**
-**
-** Function headers.
-**
-**
-**==========================================================
-*/
-
-#ifdef KERNEL
-static void ncr_alloc_ccb (ncb_p np, struct scsi_xfer * xp);
-static void ncr_complete (ncb_p np, ccb_p cp);
-static int ncr_delta (struct timeval * from, struct timeval * to);
-static void ncr_exception (ncb_p np);
-static void ncr_free_ccb (ncb_p np, ccb_p cp, int flags);
-static void ncr_getclock (ncb_p np);
-static ccb_p ncr_get_ccb (ncb_p np, u_long flags, u_long t,u_long l);
-static U_INT32 ncr_info (int unit);
-static void ncr_init (ncb_p np, char * msg, u_long code);
-static int ncr_intr (ncb_p np);
-static void ncr_int_ma (ncb_p np);
-static void ncr_int_sir (ncb_p np);
-static void ncr_int_sto (ncb_p np);
-#ifndef NEW_SCSICONF
-static u_long ncr_lookup (char* id);
-#endif /* NEW_SCSICONF */
-static void ncr_min_phys (struct buf *bp);
-static void ncr_negotiate (struct ncb* np, struct tcb* tp);
-static void ncr_opennings (ncb_p np, lcb_p lp, struct scsi_xfer * xp);
-static void ncb_profile (ncb_p np, ccb_p cp);
-static void ncr_script_copy_and_bind
- (struct script * script, ncb_p np);
-static void ncr_script_fill (struct script * scr);
-static int ncr_scatter (struct dsb* phys,u_long vaddr,u_long datalen);
-static void ncr_setmaxtags (tcb_p tp, u_long usrtags);
-static void ncr_setsync (ncb_p np, ccb_p cp, u_char sxfer);
-static void ncr_settags (tcb_p tp, lcb_p lp);
-static void ncr_setwide (ncb_p np, ccb_p cp, u_char wide);
-static int ncr_show_msg (u_char * msg);
-static int ncr_snooptest (ncb_p np);
-static INT32 ncr_start (struct scsi_xfer *xp);
-static void ncr_timeout (ncb_p np);
-static void ncr_usercmd (ncb_p np);
-static void ncr_wakeup (ncb_p np, u_long code);
-
-#ifdef __NetBSD__
-static int ncr_probe (struct device *, struct device *, void *);
-static void ncr_attach (struct device *, struct device *, void *);
-#else /* !__NetBSD */
-static char* ncr_probe (pcici_t tag, pcidi_t type);
-static void ncr_attach (pcici_t tag, int unit);
-#endif /* __NetBSD__ */
-
-#endif /* KERNEL */
-
-/*==========================================================
-**
-**
-** Global static data.
-**
-**
-**==========================================================
-*/
-
-
-static char ident[] =
- "\n$Id: ncr.c,v 1.13 1994/11/28 23:18:46 se Exp $\n";
-
-u_long ncr_version = NCR_VERSION
- + (u_long) sizeof (struct ncb)
- * (u_long) sizeof (struct ccb)
- * (u_long) sizeof (struct lcb)
- * (u_long) sizeof (struct tcb);
-
-#ifdef KERNEL
-
-#ifndef __NetBSD__
-u_long nncr=MAX_UNITS;
-ncb_p ncrp [MAX_UNITS];
-#endif
-
-static int ncr_debug = SCSI_DEBUG_FLAGS;
-
-int ncr_cache; /* to be alligned _NOT_ static */
-
-/*
-** SCSI cmd to get the SCSI sense data
-*/
-
-static u_char rs_cmd [6] =
- { 0x03, 0, 0, 0, sizeof (struct scsi_sense_data), 0 };
-
-/*==========================================================
-**
-**
-** Global static data: auto configure
-**
-**
-**==========================================================
-*/
-
-#define NCR_810_ID (0x00011000ul)
-#define NCR_815_ID (0x00041000ul)
-#define NCR_825_ID (0x00031000ul)
-
-#ifdef __NetBSD__
-
-struct cfdriver ncrcd = {
- NULL, "ncr", ncr_probe, ncr_attach, DV_DISK, sizeof(struct ncb)
-};
-
-#else /* !__NetBSD__ */
-
-static u_long ncr_count;
-
-struct pci_driver ncr_device = {
- ncr_probe,
- ncr_attach,
- &ncr_count
-};
-
-#endif /* !__NetBSD__ */
-
-#ifndef ANCIENT
-struct scsi_adapter ncr_switch =
-{
- ncr_start,
- ncr_min_phys,
- 0,
- 0,
- ncr_info,
- "ncr",
-};
-
-struct scsi_device ncr_dev =
-{
- NULL, /* Use default error handler */
- NULL, /* have a queue, served by this */
- NULL, /* have no async handler */
- NULL, /* Use default 'done' routine */
- "ncr",
-};
-#else /* ANCIENT */
-struct scsi_switch ncr_switch =
-{
- ncr_start,
- ncr_min_phys,
- 0,
- 0,
- ncr_info,
- 0,0,0
-};
-#endif /* ANCIENT */
-
-#ifdef __NetBSD__
-
-#define ncr_name(np) (np->sc_dev.dv_xname)
-
-#else /* !__NetBSD__ */
-
-static char *ncr_name (ncb_p np)
-{
- static char name[10];
- sprintf(name, "ncr%d", np->unit);
- return (name);
-}
-#endif
-
-/*==========================================================
-**
-**
-** Scripts for NCR-Processor.
-**
-** Use ncr_script_bind for binding to physical addresses.
-**
-**
-**==========================================================
-**
-** NADDR generates a reference to a field of the controller data.
-** PADDR generates a reference to another part of the script.
-** RADDR generates a reference to a script processor register.
-** FADDR generates a reference to a script processor register
-** with offset.
-**
-**----------------------------------------------------------
-*/
-
-#define RELOC_SOFTC 0x40000000
-#define RELOC_LABEL 0x50000000
-#define RELOC_REGISTER 0x60000000
-#define RELOC_MASK 0xf0000000
-
-#define NADDR(label) (RELOC_SOFTC | offsetof(struct ncb, label))
-#define PADDR(label) (RELOC_LABEL | offsetof(struct script, label))
-#define RADDR(label) (RELOC_REGISTER | REG(label))
-#define FADDR(label,ofs)(RELOC_REGISTER | ((REG(label))+(ofs)))
-
-static struct script script0 = {
-/*--------------------------< START >-----------------------*/ {
- /*
- ** Claim to be still alive ...
- */
- SCR_COPY (sizeof (((struct ncb *)0)->heartbeat)),
- (ncrcmd) &time.tv_sec,
- NADDR (heartbeat),
- /*
- ** Make data structure address invalid.
- ** clear SIGP.
- */
- SCR_LOAD_REG (dsa, 0xff),
- 0,
- SCR_FROM_REG (ctest2),
- 0,
-}/*-------------------------< START0 >----------------------*/,{
- /*
- ** Hook for interrupted GetConditionCode.
- ** Will be patched to ... IFTRUE by
- ** the interrupt handler.
- */
- SCR_INT ^ IFFALSE (0),
- SIR_SENSE_RESTART,
-
-}/*-------------------------< START1 >----------------------*/,{
- /*
- ** Hook for stalled start queue.
- ** Will be patched to IFTRUE by the interrupt handler.
- */
- SCR_INT ^ IFFALSE (0),
- SIR_STALL_RESTART,
- /*
- ** Then jump to a certain point in tryloop.
- ** Due to the lack of indirect addressing the code
- ** is self modifying here.
- */
- SCR_JUMP,
-}/*-------------------------< STARTPOS >--------------------*/,{
- PADDR(tryloop),
-}/*-------------------------< TRYLOOP >---------------------*/,{
-/*
-** Load an entry of the start queue into dsa
-** and try to start it by jumping to TRYSEL.
-**
-** Because the size depends on the
-** #define MAX_START parameter, it is filled
-** in at runtime.
-**
-**-----------------------------------------------------------
-**
-** ##===========< I=0; i<MAX_START >===========
-** || SCR_COPY (4),
-** || NADDR (squeue[i]),
-** || RADDR (dsa),
-** || SCR_CALL,
-** || PADDR (trysel),
-** ##==========================================
-**
-** SCR_JUMP,
-** PADDR(tryloop),
-**
-**-----------------------------------------------------------
-*/
-0
-
-}/*-------------------------< TRYSEL >----------------------*/,{
- /*
- ** Now:
- ** DSA: Address of a Data Structure
- ** or Address of the IDLE-Label.
- **
- ** TEMP: Address of a script, which tries to
- ** start the NEXT entry.
- **
- ** Save the TEMP register into the SCRATCHA register.
- ** Then copy the DSA to TEMP and RETURN.
- ** This is kind of an indirect jump.
- ** (The script processor has NO stack, so the
- ** CALL is actually a jump and link, and the
- ** RETURN is an indirect jump.)
- **
- ** If the slot was empty, DSA contains the address
- ** of the IDLE part of this script. The processor
- ** jumps to IDLE and waits for a reselect.
- ** It will wake up and try the same slot again
- ** after the SIGP bit becomes set by the host.
- **
- ** If the slot was not empty, DSA contains
- ** the address of the phys-part of a ccb.
- ** The processor jumps to this address.
- ** phys starts with head,
- ** head starts with launch,
- ** so actually the processor jumps to
- ** the lauch part.
- ** If the entry is scheduled to be executed,
- ** then launch contains a jump to SELECT.
- ** If it's not scheduled, it contains a jump to IDLE.
- */
- SCR_COPY (4),
- RADDR (temp),
- RADDR (scratcha),
- SCR_COPY (4),
- RADDR (dsa),
- RADDR (temp),
- SCR_RETURN,
- 0
-
-}/*-------------------------< SKIP >------------------------*/,{
- /*
- ** This entry has been canceled.
- ** Next time use the next slot.
- */
- SCR_COPY (4),
- RADDR (scratcha),
- PADDR (startpos),
- /*
- ** patch the launch field.
- ** should look like an idle process.
- */
- SCR_COPY (4),
- RADDR (dsa),
- PADDR (skip2),
- SCR_COPY (8),
- PADDR (idle),
-}/*-------------------------< SKIP2 >-----------------------*/,{
- 0,
- SCR_JUMP,
- PADDR(start),
-}/*-------------------------< IDLE >------------------------*/,{
- /*
- ** Nothing to do?
- ** Wait for reselect.
- */
- SCR_JUMP,
- PADDR(reselect),
-
-}/*-------------------------< SELECT >----------------------*/,{
- /*
- ** DSA contains the address of a scheduled
- ** data structure.
- **
- ** SCRATCHA contains the address of the script,
- ** which starts the next entry.
- **
- ** Set Initiator mode.
- **
- ** (Target mode is left as an exercise for the student)
- */
-
- SCR_CLR (SCR_TRG),
- 0,
- SCR_LOAD_REG (HS_REG, 0xff),
- 0,
-
- /*
- ** And try to select this target.
- */
- SCR_SEL_TBL_ATN ^ offsetof (struct dsb, select),
- PADDR (reselect),
-
- /*
- ** Now there are 4 possibilities:
- **
- ** (1) The ncr looses arbitration.
- ** This is ok, because it will try again,
- ** when the bus becomes idle.
- ** (But beware of the timeout function!)
- **
- ** (2) The ncr is reselected.
- ** Then the script processor takes the jump
- ** to the RESELECT label.
- **
- ** (3) The ncr completes the selection.
- ** Then it will execute the next statement.
- **
- ** (4) There is a selection timeout.
- ** Then the ncr should interrupt the host and stop.
- ** Unfortunately, it seems to continue execution
- ** of the script. But it will fail with an
- ** IID-interrupt on the next WHEN.
- */
-
- SCR_JUMPR ^ IFTRUE (WHEN (SCR_MSG_IN)),
- 0,
-
- /*
- ** Save target id to ctest0 register
- */
-
- SCR_FROM_REG (sdid),
- 0,
- SCR_TO_REG (ctest0),
- 0,
- /*
- ** Send the IDENTIFY and SIMPLE_TAG messages
- ** (and the M_X_SYNC_REQ message)
- */
- SCR_MOVE_TBL ^ SCR_MSG_OUT,
- offsetof (struct dsb, smsg),
- SCR_JUMPR ^ IFTRUE (WHEN (SCR_MSG_OUT)),
- -16,
- SCR_CLR (SCR_ATN),
- 0,
- SCR_COPY (1),
- RADDR (sfbr),
- NADDR (lastmsg),
- /*
- ** Selection complete.
- ** Next time use the next slot.
- */
- SCR_COPY (4),
- RADDR (scratcha),
- PADDR (startpos),
-}/*-------------------------< PREPARE >----------------------*/,{
- /*
- ** The ncr doesn't have an indirect load
- ** or store command. So we have to
- ** copy part of the control block to a
- ** fixed place, where we can access it.
- **
- ** We patch the address part of a
- ** COPY command with the DSA-register.
- */
- SCR_COPY (4),
- RADDR (dsa),
- PADDR (loadpos),
- /*
- ** then we do the actual copy.
- */
- SCR_COPY (sizeof (struct head)),
- /*
- ** continued after the next label ...
- */
-
-}/*-------------------------< LOADPOS >---------------------*/,{
- 0,
- NADDR (header),
- /*
- ** Mark this ccb as not scheduled.
- */
- SCR_COPY (8),
- PADDR (idle),
- NADDR (header.launch),
- /*
- ** Set a time stamp for this selection
- */
- SCR_COPY (sizeof (struct timeval)),
- (ncrcmd) &time,
- NADDR (header.stamp.select),
- /*
- ** load the savep (saved pointer) into
- ** the TEMP register (actual pointer)
- */
- SCR_COPY (4),
- NADDR (header.savep),
- RADDR (temp),
- /*
- ** Initialize the status registers
- */
- SCR_COPY (4),
- NADDR (header.status),
- RADDR (scr0),
-
-}/*-------------------------< PREPARE2 >---------------------*/,{
- /*
- ** Load the synchronous mode register
- */
- SCR_COPY (1),
- NADDR (sync_st),
- RADDR (sxfer),
- /*
- ** Load the wide mode and timing register
- */
- SCR_COPY (1),
- NADDR (wide_st),
- RADDR (scntl3),
- /*
- ** Initialize the msgout buffer with a NOOP message.
- */
- SCR_LOAD_REG (scratcha, M_NOOP),
- 0,
- SCR_COPY (1),
- RADDR (scratcha),
- NADDR (msgout),
- SCR_COPY (1),
- RADDR (scratcha),
- NADDR (msgin),
- /*
- ** Message in phase ?
- */
- SCR_JUMP ^ IFFALSE (WHEN (SCR_MSG_IN)),
- PADDR (dispatch),
- /*
- ** Extended or reject message ?
- */
- SCR_FROM_REG (sbdl),
- 0,
- SCR_JUMP ^ IFTRUE (DATA (M_EXTENDED)),
- PADDR (msg_in),
- SCR_JUMP ^ IFTRUE (DATA (M_REJECT)),
- PADDR (msg_reject),
- /*
- ** normal processing
- */
- SCR_JUMP,
- PADDR (dispatch),
-}/*-------------------------< SETMSG >----------------------*/,{
- SCR_COPY (1),
- RADDR (scratcha),
- NADDR (msgout),
- SCR_SET (SCR_ATN),
- 0,
-}/*-------------------------< CLRACK >----------------------*/,{
- /*
- ** Terminate possible pending message phase.
- */
- SCR_CLR (SCR_ACK),
- 0,
-
-}/*-----------------------< DISPATCH >----------------------*/,{
- SCR_FROM_REG (HS_REG),
- 0,
- SCR_INT ^ IFTRUE (DATA (HS_NEGOTIATE)),
- SIR_NEGO_FAILED,
- SCR_RETURN ^ IFTRUE (WHEN (SCR_DATA_OUT)),
- 0,
- SCR_RETURN ^ IFTRUE (IF (SCR_DATA_IN)),
- 0,
- SCR_JUMP ^ IFTRUE (IF (SCR_MSG_OUT)),
- PADDR (msg_out),
- SCR_JUMP ^ IFTRUE (IF (SCR_MSG_IN)),
- PADDR (msg_in),
- SCR_JUMP ^ IFTRUE (IF (SCR_COMMAND)),
- PADDR (command),
- SCR_JUMP ^ IFTRUE (IF (SCR_STATUS)),
- PADDR (status),
- /*
- ** Discard one illegal phase byte, if required.
- */
- SCR_LOAD_REG (scratcha, XE_BAD_PHASE),
- 0,
- SCR_COPY (1),
- RADDR (scratcha),
- NADDR (xerr_st),
- SCR_JUMPR ^ IFFALSE (IF (SCR_ILG_OUT)),
- 8,
- SCR_MOVE_ABS (1) ^ SCR_ILG_OUT,
- NADDR (scratch),
- SCR_JUMPR ^ IFFALSE (IF (SCR_ILG_IN)),
- 8,
- SCR_MOVE_ABS (1) ^ SCR_ILG_IN,
- NADDR (scratch),
- SCR_JUMP,
- PADDR (dispatch),
-
-}/*-------------------------< NO_DATA >--------------------*/,{
- /*
- ** The target wants to tranfer too much data
- ** or in the wrong direction.
- ** Remember that in extended error.
- */
- SCR_LOAD_REG (scratcha, XE_EXTRA_DATA),
- 0,
- SCR_COPY (1),
- RADDR (scratcha),
- NADDR (xerr_st),
- /*
- ** Discard one data byte, if required.
- */
- SCR_JUMPR ^ IFFALSE (WHEN (SCR_DATA_OUT)),
- 8,
- SCR_MOVE_ABS (1) ^ SCR_DATA_OUT,
- NADDR (scratch),
- SCR_JUMPR ^ IFFALSE (IF (SCR_DATA_IN)),
- 8,
- SCR_MOVE_ABS (1) ^ SCR_DATA_IN,
- NADDR (scratch),
- /*
- ** .. and repeat as required.
- */
- SCR_CALL,
- PADDR (dispatch),
- SCR_JUMP,
- PADDR (no_data),
-}/*-------------------------< CHECKATN >--------------------*/,{
- /*
- ** If AAP (bit 1 of scntl0 register) is set
- ** and a parity error is detected,
- ** the script processor asserts ATN.
- **
- ** The target should switch to a MSG_OUT phase
- ** to get the message.
- */
- SCR_FROM_REG (socl),
- 0,
- SCR_JUMP ^ IFFALSE (MASK (CATN, CATN)),
- PADDR (dispatch),
- /*
- ** count it
- */
- SCR_REG_REG (PS_REG, SCR_ADD, 1),
- 0,
- /*
- ** Prepare a M_ID_ERROR message
- ** (initiator detected error).
- ** The target should retry the transfer.
- */
- SCR_LOAD_REG (scratcha, M_ID_ERROR),
- 0,
- SCR_JUMP,
- PADDR (setmsg),
-
-}/*-------------------------< COMMAND >--------------------*/,{
- /*
- ** If this is not a GETCC transfer ...
- */
- SCR_FROM_REG (SS_REG),
- 0,
-/*<<<*/ SCR_JUMPR ^ IFTRUE (DATA (S_CHECK_COND)),
- 28,
- /*
- ** ... set a timestamp ...
- */
- SCR_COPY (sizeof (struct timeval)),
- (ncrcmd) &time,
- NADDR (header.stamp.command),
- /*
- ** ... and send the command
- */
- SCR_MOVE_TBL ^ SCR_COMMAND,
- offsetof (struct dsb, cmd),
- SCR_JUMP,
- PADDR (dispatch),
- /*
- ** Send the GETCC command
- */
-/*>>>*/ SCR_MOVE_ABS (6) ^ SCR_COMMAND,
- (ncrcmd) &rs_cmd,
- SCR_JUMP,
- PADDR (dispatch),
-
-}/*-------------------------< STATUS >--------------------*/,{
- /*
- ** set the timestamp.
- */
- SCR_COPY (sizeof (struct timeval)),
- (ncrcmd) &time,
- NADDR (header.stamp.status),
- /*
- ** If this is a GETCC transfer,
- */
- SCR_FROM_REG (SS_REG),
- 0,
-/*<<<*/ SCR_JUMPR ^ IFFALSE (DATA (S_CHECK_COND)),
- 40,
- /*
- ** get the status
- */
- SCR_MOVE_ABS (1) ^ SCR_STATUS,
- NADDR (scratch),
- /*
- ** Save status to scsi_status.
- ** Mark as complete.
- ** And wait for disconnect.
- */
- SCR_TO_REG (SS_REG),
- 0,
- SCR_REG_REG (SS_REG, SCR_OR, S_SENSE),
- 0,
- SCR_LOAD_REG (HS_REG, HS_COMPLETE),
- 0,
- SCR_JUMP,
- PADDR (checkatn),
- /*
- ** If it was no GETCC transfer,
- ** save the status to scsi_status.
- */
-/*>>>*/ SCR_MOVE_ABS (1) ^ SCR_STATUS,
- NADDR (scratch),
- SCR_TO_REG (SS_REG),
- 0,
- /*
- ** if it was no check condition ...
- */
- SCR_JUMP ^ IFTRUE (DATA (S_CHECK_COND)),
- PADDR (checkatn),
- /*
- ** ... mark as complete.
- */
- SCR_LOAD_REG (HS_REG, HS_COMPLETE),
- 0,
- SCR_JUMP,
- PADDR (checkatn),
-
-}/*-------------------------< MSG_IN >--------------------*/,{
- /*
- ** Get the first byte of the message
- ** and save it to SCRATCHA.
- **
- ** The script processor doesn't negate the
- ** ACK signal after this transfer.
- */
- SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
- NADDR (msgin[0]),
- /*
- ** Check for message parity error.
- */
- SCR_TO_REG (scratcha),
- 0,
- SCR_FROM_REG (socl),
- 0,
- SCR_JUMP ^ IFTRUE (MASK (CATN, CATN)),
- PADDR (msg_parity),
- SCR_FROM_REG (scratcha),
- 0,
- /*
- ** Parity was ok, handle this message.
- */
- SCR_JUMP ^ IFTRUE (DATA (M_COMPLETE)),
- PADDR (complete),
- SCR_JUMP ^ IFTRUE (DATA (M_SAVE_DP)),
- PADDR (save_dp),
- SCR_JUMP ^ IFTRUE (DATA (M_RESTORE_DP)),
- PADDR (restore_dp),
- SCR_JUMP ^ IFTRUE (DATA (M_DISCONNECT)),
- PADDR (disconnect),
- SCR_JUMP ^ IFTRUE (DATA (M_EXTENDED)),
- PADDR (msg_extended),
- SCR_JUMP ^ IFTRUE (DATA (M_NOOP)),
- PADDR (clrack),
- SCR_JUMP ^ IFTRUE (DATA (M_REJECT)),
- PADDR (msg_reject),
- SCR_JUMP ^ IFTRUE (DATA (M_IGN_RESIDUE)),
- PADDR (msg_ign_residue),
- /*
- ** Rest of the messages left as
- ** an exercise ...
- **
- ** Unimplemented messages:
- ** fall through to MSG_BAD.
- */
-}/*-------------------------< MSG_BAD >------------------*/,{
- /*
- ** unimplemented message - reject it.
- */
- SCR_INT,
- SIR_REJECT_SENT,
- SCR_LOAD_REG (scratcha, M_REJECT),
- 0,
- SCR_JUMP,
- PADDR (setmsg),
-
-}/*-------------------------< MSG_PARITY >---------------*/,{
- /*
- ** count it
- */
- SCR_REG_REG (PS_REG, SCR_ADD, 0x01),
- 0,
- /*
- ** send a "message parity error" message.
- */
- SCR_LOAD_REG (scratcha, M_PARITY),
- 0,
- SCR_JUMP,
- PADDR (setmsg),
-}/*-------------------------< MSG_REJECT >---------------*/,{
- /*
- ** If a negotiation was in progress,
- ** negotiation failed.
- */
- SCR_FROM_REG (HS_REG),
- 0,
- SCR_INT ^ IFTRUE (DATA (HS_NEGOTIATE)),
- SIR_NEGO_FAILED,
- /*
- ** else make host log this message
- */
- SCR_INT ^ IFFALSE (DATA (HS_NEGOTIATE)),
- SIR_REJECT_RECEIVED,
- SCR_JUMP,
- PADDR (clrack),
-
-}/*-------------------------< MSG_IGN_RESIDUE >----------*/,{
- /*
- ** Terminate cycle
- */
- SCR_CLR (SCR_ACK),
- 0,
- SCR_JUMP ^ IFFALSE (WHEN (SCR_MSG_IN)),
- PADDR (dispatch),
- /*
- ** get residue size.
- */
- SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
- NADDR (msgin[1]),
- /*
- ** Check for message parity error.
- */
- SCR_TO_REG (scratcha),
- 0,
- SCR_FROM_REG (socl),
- 0,
- SCR_JUMP ^ IFTRUE (MASK (CATN, CATN)),
- PADDR (msg_parity),
- SCR_FROM_REG (scratcha),
- 0,
- /*
- ** Size is 0 .. ignore message.
- */
- SCR_JUMP ^ IFTRUE (DATA (0)),
- PADDR (clrack),
- /*
- ** Size is not 1 .. have to interrupt.
- */
-/*<<<*/ SCR_JUMPR ^ IFFALSE (DATA (1)),
- 40,
- /*
- ** Check for residue byte in swide register
- */
- SCR_FROM_REG (scntl2),
- 0,
-/*<<<*/ SCR_JUMPR ^ IFFALSE (MASK (WSR, WSR)),
- 16,
- /*
- ** There IS data in the swide register.
- ** Discard it.
- */
- SCR_REG_REG (scntl2, SCR_OR, WSR),
- 0,
- SCR_JUMP,
- PADDR (clrack),
- /*
- ** Load again the size to the sfbr register.
- */
-/*>>>*/ SCR_FROM_REG (scratcha),
- 0,
-/*>>>*/ SCR_INT,
- SIR_IGN_RESIDUE,
- SCR_JUMP,
- PADDR (clrack),
-
-}/*-------------------------< MSG_EXTENDED >-------------*/,{
- /*
- ** Terminate cycle
- */
- SCR_CLR (SCR_ACK),
- 0,
- SCR_JUMP ^ IFFALSE (WHEN (SCR_MSG_IN)),
- PADDR (dispatch),
- /*
- ** get length.
- */
- SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
- NADDR (msgin[1]),
- /*
- ** Check for message parity error.
- */
- SCR_TO_REG (scratcha),
- 0,
- SCR_FROM_REG (socl),
- 0,
- SCR_JUMP ^ IFTRUE (MASK (CATN, CATN)),
- PADDR (msg_parity),
- SCR_FROM_REG (scratcha),
- 0,
- /*
- */
- SCR_JUMP ^ IFTRUE (DATA (3)),
- PADDR (msg_ext_3),
- SCR_JUMP ^ IFFALSE (DATA (2)),
- PADDR (msg_bad),
-}/*-------------------------< MSG_EXT_2 >----------------*/,{
- SCR_CLR (SCR_ACK),
- 0,
- SCR_JUMP ^ IFFALSE (WHEN (SCR_MSG_IN)),
- PADDR (dispatch),
- /*
- ** get extended message code.
- */
- SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
- NADDR (msgin[2]),
- /*
- ** Check for message parity error.
- */
- SCR_TO_REG (scratcha),
- 0,
- SCR_FROM_REG (socl),
- 0,
- SCR_JUMP ^ IFTRUE (MASK (CATN, CATN)),
- PADDR (msg_parity),
- SCR_FROM_REG (scratcha),
- 0,
- SCR_JUMP ^ IFTRUE (DATA (M_X_WIDE_REQ)),
- PADDR (msg_wdtr),
- /*
- ** unknown extended message
- */
- SCR_JUMP,
- PADDR (msg_bad)
-}/*-------------------------< MSG_WDTR >-----------------*/,{
- SCR_CLR (SCR_ACK),
- 0,
- SCR_JUMP ^ IFFALSE (WHEN (SCR_MSG_IN)),
- PADDR (dispatch),
- /*
- ** get data bus width
- */
- SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
- NADDR (msgin[3]),
- SCR_FROM_REG (socl),
- 0,
- SCR_JUMP ^ IFTRUE (MASK (CATN, CATN)),
- PADDR (msg_parity),
- /*
- ** let the host do the real work.
- */
- SCR_INT,
- SIR_NEGO_WIDE,
- /*
- ** let the target fetch our answer.
- */
- SCR_SET (SCR_ATN),
- 0,
- SCR_CLR (SCR_ACK),
- 0,
-
- SCR_INT ^ IFFALSE (WHEN (SCR_MSG_OUT)),
- SIR_NEGO_PROTO,
- /*
- ** Send the M_X_WIDE_REQ
- */
- SCR_MOVE_ABS (4) ^ SCR_MSG_OUT,
- NADDR (msgout),
- SCR_CLR (SCR_ATN),
- 0,
- SCR_COPY (1),
- RADDR (sfbr),
- NADDR (lastmsg),
- SCR_JUMP,
- PADDR (msg_out_done),
-
-}/*-------------------------< MSG_EXT_3 >----------------*/,{
- SCR_CLR (SCR_ACK),
- 0,
- SCR_JUMP ^ IFFALSE (WHEN (SCR_MSG_IN)),
- PADDR (dispatch),
- /*
- ** get extended message code.
- */
- SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
- NADDR (msgin[2]),
- /*
- ** Check for message parity error.
- */
- SCR_TO_REG (scratcha),
- 0,
- SCR_FROM_REG (socl),
- 0,
- SCR_JUMP ^ IFTRUE (MASK (CATN, CATN)),
- PADDR (msg_parity),
- SCR_FROM_REG (scratcha),
- 0,
- SCR_JUMP ^ IFTRUE (DATA (M_X_SYNC_REQ)),
- PADDR (msg_sdtr),
- /*
- ** unknown extended message
- */
- SCR_JUMP,
- PADDR (msg_bad)
-
-}/*-------------------------< MSG_SDTR >-----------------*/,{
- SCR_CLR (SCR_ACK),
- 0,
- SCR_JUMP ^ IFFALSE (WHEN (SCR_MSG_IN)),
- PADDR (dispatch),
- /*
- ** get period and offset
- */
- SCR_MOVE_ABS (2) ^ SCR_MSG_IN,
- NADDR (msgin[3]),
- SCR_FROM_REG (socl),
- 0,
- SCR_JUMP ^ IFTRUE (MASK (CATN, CATN)),
- PADDR (msg_parity),
- /*
- ** let the host do the real work.
- */
- SCR_INT,
- SIR_NEGO_SYNC,
- /*
- ** let the target fetch our answer.
- */
- SCR_SET (SCR_ATN),
- 0,
- SCR_CLR (SCR_ACK),
- 0,
-
- SCR_INT ^ IFFALSE (WHEN (SCR_MSG_OUT)),
- SIR_NEGO_PROTO,
- /*
- ** Send the M_X_SYNC_REQ
- */
- SCR_MOVE_ABS (5) ^ SCR_MSG_OUT,
- NADDR (msgout),
- SCR_CLR (SCR_ATN),
- 0,
- SCR_COPY (1),
- RADDR (sfbr),
- NADDR (lastmsg),
- SCR_JUMP,
- PADDR (msg_out_done),
-
-}/*-------------------------< COMPLETE >-----------------*/,{
- /*
- ** Complete message.
- **
- ** If it's not the get condition code,
- ** copy TEMP register to LASTP in header.
- */
- SCR_FROM_REG (SS_REG),
- 0,
-/*<<<*/ SCR_JUMPR ^ IFTRUE (MASK (S_SENSE, S_SENSE)),
- 12,
- SCR_COPY (4),
- RADDR (temp),
- NADDR (header.lastp),
-/*>>>*/ /*
- ** When we terminate the cycle by clearing ACK,
- ** the target may disconnect immediately.
- **
- ** We don't want to be told of an
- ** "unexpected disconnect",
- ** so we disable this feature.
- */
- SCR_REG_REG (scntl2, SCR_AND, 0x7f),
- 0,
- /*
- ** Terminate cycle ...
- */
- SCR_CLR (SCR_ACK),
- 0,
- /*
- ** ... and wait for the disconnect.
- */
- SCR_WAIT_DISC,
- 0,
-}/*-------------------------< CLEANUP >-------------------*/,{
- /*
- ** dsa: Pointer to ccb
- ** or xxxxxxFF (no ccb)
- **
- ** HS_REG: Host-Status (<>0!)
- */
- SCR_FROM_REG (dsa),
- 0,
- SCR_JUMP ^ IFTRUE (DATA (0xff)),
- PADDR (signal),
- /*
- ** dsa is valid.
- ** save the status registers
- */
- SCR_COPY (4),
- RADDR (scr0),
- NADDR (header.status),
- /*
- ** and copy back the header to the ccb.
- */
- SCR_COPY (4),
- RADDR (dsa),
- PADDR (cleanup0),
- SCR_COPY (sizeof (struct head)),
- NADDR (header),
-}/*-------------------------< CLEANUP0 >--------------------*/,{
- 0,
-
- /*
- ** If command resulted in "check condition"
- ** status and is not yet completed,
- ** try to get the condition code.
- */
- SCR_FROM_REG (HS_REG),
- 0,
-/*<<<*/ SCR_JUMPR ^ IFFALSE (MASK (0, HS_DONEMASK)),
- 16,
- SCR_FROM_REG (SS_REG),
- 0,
- SCR_JUMP ^ IFTRUE (DATA (S_CHECK_COND)),
- PADDR(getcc2),
- /*
- ** And make the DSA register invalid.
- */
-/*>>>*/ SCR_LOAD_REG (dsa, 0xff), /* invalid */
- 0,
-}/*-------------------------< SIGNAL >----------------------*/,{
- /*
- ** if status = queue full,
- ** reinsert in startqueue and stall queue.
- */
- SCR_FROM_REG (SS_REG),
- 0,
- SCR_INT ^ IFTRUE (DATA (S_QUEUE_FULL)),
- SIR_STALL_QUEUE,
- /*
- ** if job completed ...
- */
- SCR_FROM_REG (HS_REG),
- 0,
- /*
- ** ... signal completion to the host
- */
- SCR_INT_FLY ^ IFFALSE (MASK (0, HS_DONEMASK)),
- 0,
- /*
- ** Auf zu neuen Schandtaten!
- */
- SCR_JUMP,
- PADDR(start),
-
-}/*-------------------------< SAVE_DP >------------------*/,{
- /*
- ** SAVE_DP message:
- ** Copy TEMP register to SAVEP in header.
- */
- SCR_COPY (4),
- RADDR (temp),
- NADDR (header.savep),
- SCR_JUMP,
- PADDR (clrack),
-}/*-------------------------< RESTORE_DP >---------------*/,{
- /*
- ** RESTORE_DP message:
- ** Copy SAVEP in header to TEMP register.
- */
- SCR_COPY (4),
- NADDR (header.savep),
- RADDR (temp),
- SCR_JUMP,
- PADDR (clrack),
-
-}/*-------------------------< DISCONNECT >---------------*/,{
- /*
- ** If QUIRK_AUTOSAVE is set,
- ** do an "save pointer" operation.
- */
- SCR_FROM_REG (QU_REG),
- 0,
-/*<<<*/ SCR_JUMPR ^ IFFALSE (MASK (QUIRK_AUTOSAVE, QUIRK_AUTOSAVE)),
- 12,
- /*
- ** like SAVE_DP message:
- ** Copy TEMP register to SAVEP in header.
- */
- SCR_COPY (4),
- RADDR (temp),
- NADDR (header.savep),
-/*>>>*/ /*
- ** Check if temp==savep or temp==goalp:
- ** if not, log a missing save pointer message.
- ** In fact, it's a comparation mod 256.
- **
- ** Hmmm, I hadn't thought that I would be urged to
- ** write this kind of ugly self modifying code.
- **
- ** It's unbelievable, but the ncr53c8xx isn't able
- ** to subtract one register from another.
- */
- SCR_FROM_REG (temp),
- 0,
- /*
- ** You are not expected to understand this ..
- */
- SCR_COPY (1),
- NADDR (header.savep),
- PADDR (disconnect0),
-}/*-------------------------< DISCONNECT0 >--------------*/,{
-/*<<<*/ SCR_JUMPR ^ IFTRUE (DATA (1)),
- 20,
- /*
- ** neither this
- */
- SCR_COPY (1),
- NADDR (header.goalp),
- PADDR (disconnect1),
-}/*-------------------------< DISCONNECT1 >--------------*/,{
- SCR_INT ^ IFFALSE (DATA (1)),
- SIR_MISSING_SAVE,
-/*>>>*/
-
- /*
- ** DISCONNECTing ...
- **
- ** Disable the "unexpected disconnect" feature.
- */
- SCR_REG_REG (scntl2, SCR_AND, 0x7f),
- 0,
- SCR_CLR (SCR_ACK),
- 0,
- /*
- ** Wait for the disconnect.
- */
- SCR_WAIT_DISC,
- 0,
- /*
- ** Profiling:
- ** Set a time stamp,
- ** and count the disconnects.
- */
- SCR_COPY (sizeof (struct timeval)),
- (ncrcmd) &time,
- NADDR (header.stamp.disconnect),
- SCR_COPY (4),
- NADDR (disc_phys),
- RADDR (temp),
- SCR_REG_REG (temp, SCR_ADD, 0x01),
- 0,
- SCR_COPY (4),
- RADDR (temp),
- NADDR (disc_phys),
- /*
- ** Status is: DISCONNECTED.
- */
- SCR_LOAD_REG (HS_REG, HS_DISCONNECT),
- 0,
- SCR_JUMP,
- PADDR (cleanup),
-
-}/*-------------------------< MSG_OUT >-------------------*/,{
- /*
- ** The target requests a message.
- ** First remove ATN so the target will
- ** not continue fetching messages.
- */
- SCR_MOVE_ABS (1) ^ SCR_MSG_OUT,
- NADDR (msgout),
- SCR_COPY (1),
- RADDR (sfbr),
- NADDR (lastmsg),
- /*
- ** If it was no ABORT message ...
- */
- SCR_JUMP ^ IFTRUE (DATA (M_ABORT)),
- PADDR (msg_out_abort),
- /*
- ** ... wait for the next phase
- ** if it's a message out, send it again, ...
- */
- SCR_JUMP ^ IFTRUE (WHEN (SCR_MSG_OUT)),
- PADDR (msg_out),
-}/*-------------------------< MSG_OUT_DONE >--------------*/,{
- /*
- ** ... else clear the message ...
- */
- SCR_LOAD_REG (scratcha, M_NOOP),
- 0,
- SCR_COPY (4),
- RADDR (scratcha),
- NADDR (msgout),
- /*
- ** ... and process the next phase
- */
- SCR_JUMP,
- PADDR (dispatch),
-}/*-------------------------< MSG_OUT_ABORT >-------------*/,{
- /*
- ** After ABORT message,
- **
- ** expect an immediate disconnect, ...
- */
- SCR_REG_REG (scntl2, SCR_AND, 0x7f),
- 0,
- SCR_CLR (SCR_ACK),
- 0,
- SCR_WAIT_DISC,
- 0,
- /*
- ** ... and set the status to "ABORTED"
- */
- SCR_LOAD_REG (HS_REG, HS_ABORTED),
- 0,
- SCR_JUMP,
- PADDR (cleanup),
-
-}/*-------------------------< GETCC >-----------------------*/,{
- /*
- ** The ncr doesn't have an indirect load
- ** or store command. So we have to
- ** copy part of the control block to a
- ** fixed place, where we can modify it.
- **
- ** We patch the address part of a COPY command
- ** with the address of the dsa register ...
- */
- SCR_COPY (4),
- RADDR (dsa),
- PADDR (getcc1),
- /*
- ** ... then we do the actual copy.
- */
- SCR_COPY (sizeof (struct head)),
-}/*-------------------------< GETCC1 >----------------------*/,{
- 0,
- NADDR (header),
- /*
- ** Initialize the status registers
- */
- SCR_COPY (4),
- NADDR (header.status),
- RADDR (scr0),
-}/*-------------------------< GETCC2 >----------------------*/,{
- /*
- ** Get the condition code from a target.
- **
- ** DSA points to a data structure.
- ** Set TEMP to the script location
- ** that receives the condition code.
- **
- ** Because there is no script command
- ** to load a longword into a register,
- ** we use a CALL command.
- */
-/*<<<*/ SCR_CALLR,
- 24,
- /*
- ** Get the condition code.
- */
- SCR_MOVE_TBL ^ SCR_DATA_IN,
- offsetof (struct dsb, sense),
- /*
- ** No data phase may follow!
- */
- SCR_CALL,
- PADDR (checkatn),
- SCR_JUMP,
- PADDR (no_data),
-/*>>>*/
-
- /*
- ** The CALL jumps to this point.
- ** Prepare for a RESTORE_POINTER message.
- ** Save the TEMP register into the saved pointer.
- */
- SCR_COPY (4),
- RADDR (temp),
- NADDR (header.savep),
- /*
- ** Load scratcha, because in case of a selection timeout,
- ** the host will expect a new value for startpos in
- ** the scratcha register.
- */
- SCR_COPY (4),
- PADDR (startpos),
- RADDR (scratcha),
- /*
- ** If QUIRK_NOMSG is set, select without ATN.
- ** and don't send a message.
- */
- SCR_FROM_REG (QU_REG),
- 0,
- SCR_JUMP ^ IFTRUE (MASK (QUIRK_NOMSG, QUIRK_NOMSG)),
- PADDR(getcc3),
- /*
- ** Then try to connect to the target.
- ** If we are reselected, special treatment
- ** of the current job is required before
- ** accepting the reselection.
- */
- SCR_SEL_TBL_ATN ^ offsetof (struct dsb, select),
- PADDR(badgetcc),
- /*
- ** save target id.
- */
- SCR_FROM_REG (sdid),
- 0,
- SCR_TO_REG (ctest0),
- 0,
- /*
- ** Send the IDENTIFY message.
- ** In case of short transfer, remove ATN.
- */
- SCR_MOVE_TBL ^ SCR_MSG_OUT,
- offsetof (struct dsb, smsg2),
- SCR_CLR (SCR_ATN),
- 0,
- /*
- ** save the first byte of the message.
- */
- SCR_COPY (1),
- RADDR (sfbr),
- NADDR (lastmsg),
- SCR_JUMP,
- PADDR (prepare2),
-
-}/*-------------------------< GETCC3 >----------------------*/,{
- /*
- ** Try to connect to the target.
- ** If we are reselected, special treatment
- ** of the current job is required before
- ** accepting the reselection.
- **
- ** Silly target won't accept a message.
- ** Select without ATN.
- */
- SCR_SEL_TBL ^ offsetof (struct dsb, select),
- PADDR(badgetcc),
- /*
- ** save target id.
- */
- SCR_FROM_REG (sdid),
- 0,
- SCR_TO_REG (ctest0),
- 0,
- /*
- ** Force error if selection timeout
- */
- SCR_JUMPR ^ IFTRUE (WHEN (SCR_MSG_IN)),
- 0,
- /*
- ** don't negotiate.
- */
- SCR_JUMP,
- PADDR (prepare2),
-
-}/*------------------------< BADGETCC >---------------------*/,{
- /*
- ** If SIGP was set, clear it and try again.
- */
- SCR_FROM_REG (ctest2),
- 0,
- SCR_JUMP ^ IFTRUE (MASK (CSIGP,CSIGP)),
- PADDR (getcc2),
- SCR_INT,
- SIR_SENSE_FAILED,
-}/*-------------------------< RESELECT >--------------------*/,{
- /*
- ** make the DSA invalid.
- */
- SCR_LOAD_REG (dsa, 0xff),
- 0,
- SCR_CLR (SCR_TRG),
- 0,
- /*
- ** Sleep waiting for a reselection.
- ** If SIGP is set, special treatment.
- **
- ** Zu allem bereit ..
- */
- SCR_WAIT_RESEL,
- PADDR(reselect2),
- /*
- ** ... zu nichts zu gebrauchen ?
- **
- ** load the target id into the SFBR
- ** and jump to the control block.
- **
- ** Look at the declarations of
- ** - struct ncb
- ** - struct tcb
- ** - struct lcb
- ** - struct ccb
- ** to understand what's going on.
- */
- SCR_REG_SFBR (ssid, SCR_AND, 0x87),
- 0,
- SCR_TO_REG (ctest0),
- 0,
- SCR_JUMP,
- NADDR (jump_tcb),
-}/*-------------------------< RESELECT2 >-------------------*/,{
- /*
- ** If it's not connected :(
- ** -> interrupted by SIGP bit.
- ** Jump to start.
- */
- SCR_FROM_REG (ctest2),
- 0,
- SCR_JUMP ^ IFTRUE (MASK (CSIGP,CSIGP)),
- PADDR (start),
- SCR_JUMP,
- PADDR (reselect),
-
-}/*-------------------------< RESEL_TMP >-------------------*/,{
- /*
- ** The return address in TEMP
- ** is in fact the data structure address,
- ** so copy it to the DSA register.
- */
- SCR_COPY (4),
- RADDR (temp),
- RADDR (dsa),
- SCR_JUMP,
- PADDR (prepare),
-
-}/*-------------------------< RESEL_LUN >-------------------*/,{
- /*
- ** come back to this point
- ** to get an IDENTIFY message
- ** Wait for a msg_in phase.
- */
-/*<<<*/ SCR_JUMPR ^ IFFALSE (WHEN (SCR_MSG_IN)),
- 48,
- /*
- ** message phase
- ** It's not a sony, it's a trick:
- ** read the data without acknowledging it.
- */
- SCR_FROM_REG (sbdl),
- 0,
-/*<<<*/ SCR_JUMPR ^ IFFALSE (MASK (M_IDENTIFY, 0x98)),
- 32,
- /*
- ** It WAS an Identify message.
- ** get it and ack it!
- */
- SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
- NADDR (msgin),
- SCR_CLR (SCR_ACK),
- 0,
- /*
- ** Mask out the LUN.
- */
- SCR_REG_REG (sfbr, SCR_AND, 0x07),
- 0,
- SCR_RETURN,
- 0,
- /*
- ** No message phase or no IDENTIFY message:
- ** return 0.
- */
-/*>>>*/ SCR_LOAD_SFBR (0),
- 0,
- SCR_RETURN,
- 0,
-
-}/*-------------------------< RESEL_TAG >-------------------*/,{
- /*
- ** come back to this point
- ** to get a SIMPLE_TAG message
- ** Wait for a MSG_IN phase.
- */
-/*<<<*/ SCR_JUMPR ^ IFFALSE (WHEN (SCR_MSG_IN)),
- 64,
- /*
- ** message phase
- ** It's a trick - read the data
- ** without acknowledging it.
- */
- SCR_FROM_REG (sbdl),
- 0,
-/*<<<*/ SCR_JUMPR ^ IFFALSE (DATA (M_SIMPLE_TAG)),
- 48,
- /*
- ** It WAS a SIMPLE_TAG message.
- ** get it and ack it!
- */
- SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
- NADDR (msgin),
- SCR_CLR (SCR_ACK),
- 0,
- /*
- ** Wait for the second byte (the tag)
- */
-/*<<<*/ SCR_JUMPR ^ IFFALSE (WHEN (SCR_MSG_IN)),
- 24,
- /*
- ** Get it and ack it!
- */
- SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
- NADDR (msgin),
- SCR_CLR (SCR_ACK|SCR_CARRY),
- 0,
- SCR_RETURN,
- 0,
- /*
- ** No message phase or no SIMPLE_TAG message
- ** or no second byte: return 0.
- */
-/*>>>*/ SCR_LOAD_SFBR (0),
- 0,
- SCR_SET (SCR_CARRY),
- 0,
- SCR_RETURN,
- 0,
-
-}/*-------------------------< DATA_IN >--------------------*/,{
-/*
-** Because the size depends on the
-** #define MAX_SCATTER parameter,
-** it is filled in at runtime.
-**
-** SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_IN)),
-** PADDR (no_data),
-** SCR_COPY (sizeof (struct timeval)),
-** (ncrcmd) &time,
-** NADDR (header.stamp.data),
-** SCR_MOVE_TBL ^ SCR_DATA_IN,
-** offsetof (struct dsb, data[ 0]),
-**
-** ##===========< i=1; i<MAX_SCATTER >=========
-** || SCR_CALL ^ IFFALSE (WHEN (SCR_DATA_IN)),
-** || PADDR (checkatn),
-** || SCR_MOVE_TBL ^ SCR_DATA_IN,
-** || offsetof (struct dsb, data[ i]),
-** ##==========================================
-**
-** SCR_CALL,
-** PADDR (checkatn),
-** SCR_JUMP,
-** PADDR (no_data),
-*/
-0
-}/*-------------------------< DATA_OUT >-------------------*/,{
-/*
-** Because the size depends on the
-** #define MAX_SCATTER parameter,
-** it is filled in at runtime.
-**
-** SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_IN)),
-** PADDR (no_data),
-** SCR_COPY (sizeof (struct timeval)),
-** (ncrcmd) &time,
-** NADDR (header.stamp.data),
-** SCR_MOVE_TBL ^ SCR_DATA_OUT,
-** offsetof (struct dsb, data[ 0]),
-**
-** ##===========< i=1; i<MAX_SCATTER >=========
-** || SCR_CALL ^ IFFALSE (WHEN (SCR_DATA_OUT)),
-** || PADDR (dispatch),
-** || SCR_MOVE_TBL ^ SCR_DATA_OUT,
-** || offsetof (struct dsb, data[ i]),
-** ##==========================================
-**
-** SCR_CALL,
-** PADDR (dispatch),
-** SCR_JUMP,
-** PADDR (no_data),
-**
-**---------------------------------------------------------
-*/
-(u_long)&ident
-
-}/*-------------------------< ABORTTAG >-------------------*/,{
- /*
- ** Abort a bad reselection.
- ** Set the message to ABORT vs. ABORT_TAG
- */
- SCR_LOAD_REG (scratcha, M_ABORT_TAG),
- 0,
- SCR_JUMPR ^ IFFALSE (CARRYSET),
- 8,
-}/*-------------------------< ABORT >----------------------*/,{
- SCR_LOAD_REG (scratcha, M_ABORT),
- 0,
- SCR_COPY (1),
- RADDR (scratcha),
- NADDR (msgout),
- SCR_SET (SCR_ATN),
- 0,
- SCR_CLR (SCR_ACK),
- 0,
- /*
- ** and send it.
- ** we expect an immediate disconnect
- */
- SCR_REG_REG (scntl2, SCR_AND, 0x7f),
- 0,
- SCR_MOVE_ABS (1) ^ SCR_MSG_OUT,
- NADDR (msgout),
- SCR_COPY (1),
- RADDR (sfbr),
- NADDR (lastmsg),
- SCR_WAIT_DISC,
- 0,
- SCR_JUMP,
- PADDR (start),
-}/*-------------------------< SNOOPTEST >-------------------*/,{
- /*
- ** Read the variable.
- */
- SCR_COPY (4),
- (ncrcmd) &ncr_cache,
- RADDR (scratcha),
- /*
- ** Write the variable.
- */
- SCR_COPY (4),
- RADDR (temp),
- (ncrcmd) &ncr_cache,
- /*
- ** Read back the variable.
- */
- SCR_COPY (4),
- (ncrcmd) &ncr_cache,
- RADDR (temp),
- /*
- ** And stop.
- */
- SCR_INT,
- 99,
-}/*--------------------------------------------------------*/
-};
-
-/*==========================================================
-**
-**
-** Fill in #define dependent parts of the script
-**
-**
-**==========================================================
-*/
-
-void ncr_script_fill (struct script * scr)
-{
- int i;
- ncrcmd *p;
-
- p = scr->tryloop;
- for (i=0; i<MAX_START; i++) {
- *p++ =SCR_COPY (4);
- *p++ =NADDR (squeue[i]);
- *p++ =RADDR (dsa);
- *p++ =SCR_CALL;
- *p++ =PADDR (trysel);
- };
- *p++ =SCR_JUMP;
- *p++ =PADDR(tryloop);
-
- assert ((u_long)p == (u_long)&scr->tryloop + sizeof (scr->tryloop));
-
- p = scr->data_in;
-
- *p++ =SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_IN));
- *p++ =PADDR (no_data);
- *p++ =SCR_COPY (sizeof (struct timeval));
- *p++ =(ncrcmd) &time;
- *p++ =NADDR (header.stamp.data);
- *p++ =SCR_MOVE_TBL ^ SCR_DATA_IN;
- *p++ =offsetof (struct dsb, data[ 0]);
-
- for (i=1; i<MAX_SCATTER; i++) {
- *p++ =SCR_CALL ^ IFFALSE (WHEN (SCR_DATA_IN));
- *p++ =PADDR (checkatn);
- *p++ =SCR_MOVE_TBL ^ SCR_DATA_IN;
- *p++ =offsetof (struct dsb, data[i]);
- };
-
- *p++ =SCR_CALL;
- *p++ =PADDR (checkatn);
- *p++ =SCR_JUMP;
- *p++ =PADDR (no_data);
-
- assert ((u_long)p == (u_long)&scr->data_in + sizeof (scr->data_in));
-
- p = scr->data_out;
-
- *p++ =SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_OUT));
- *p++ =PADDR (no_data);
- *p++ =SCR_COPY (sizeof (struct timeval));
- *p++ =(ncrcmd) &time;
- *p++ =NADDR (header.stamp.data);
- *p++ =SCR_MOVE_TBL ^ SCR_DATA_OUT;
- *p++ =offsetof (struct dsb, data[ 0]);
-
- for (i=1; i<MAX_SCATTER; i++) {
- *p++ =SCR_CALL ^ IFFALSE (WHEN (SCR_DATA_OUT));
- *p++ =PADDR (dispatch);
- *p++ =SCR_MOVE_TBL ^ SCR_DATA_OUT;
- *p++ =offsetof (struct dsb, data[i]);
- };
-
- *p++ =SCR_CALL;
- *p++ =PADDR (dispatch);
- *p++ =SCR_JUMP;
- *p++ =PADDR (no_data);
-
- assert ((u_long)p == (u_long)&scr->data_out + sizeof (scr->data_out));
-}
-
-/*==========================================================
-**
-**
-** Copy and rebind a script.
-**
-**
-**==========================================================
-*/
-
-static void ncr_script_copy_and_bind (struct script *script, ncb_p np)
-{
- ncrcmd opcode, new, old;
- ncrcmd *src, *dst, *start, *end;
- int relocs;
-
- np->script = (struct script *)
- malloc (sizeof (struct script), M_DEVBUF, M_WAITOK);
- np->p_script = vtophys(np->script);
-
- src = script->start;
- dst = np->script->start;
-
- start = src;
- end = src + (sizeof(struct script) / 4);
-
- while (src < end) {
-
- *dst++ = opcode = *src++;
-
- /*
- ** If we forget to change the length
- ** in struct script, a field will be
- ** padded with 0. This is an illegal
- ** command.
- */
-
- if (opcode == 0) {
- printf ("%s: ERROR0 IN SCRIPT at %d.\n",
- ncr_name(np), src-start-1);
- DELAY (1000000);
- };
-
- if (DEBUG_FLAGS & DEBUG_SCRIPT)
- printf ("%x: <%x>\n",
- (unsigned)(src-1), (unsigned)opcode);
-
- /*
- ** We don't have to decode ALL commands
- */
- switch (opcode >> 28) {
-
- case 0xc:
- /*
- ** COPY has TWO arguments.
- */
- relocs = 2;
- if ((src[0] ^ src[1]) & 3) {
- printf ("%s: ERROR1 IN SCRIPT at %d.\n",
- ncr_name(np), src-start-1);
- DELAY (1000000);
- };
- break;
-
- case 0x0:
- /*
- ** MOVE (absolute address)
- */
- relocs = 1;
- break;
-
- case 0x8:
- /*
- ** JUMP / CALL
- ** dont't relocate if relative :-)
- */
- if (opcode & 0x00800000)
- relocs = 0;
- else
- relocs = 1;
- break;
-
- case 0x4:
- case 0x5:
- case 0x6:
- case 0x7:
- relocs = 1;
- break;
-
- default:
- relocs = 0;
- break;
- };
-
- if (relocs) {
- while (relocs--) {
- old = *src++;
-
- switch (old & RELOC_MASK) {
- case RELOC_REGISTER:
- new = (old & ~RELOC_MASK) + np->paddr;
- break;
- case RELOC_LABEL:
- new = (old & ~RELOC_MASK) + vtophys(np->script);
- break;
- case RELOC_SOFTC:
- new = (old & ~RELOC_MASK) + vtophys(np);
- break;
- case 0:
- /* Don't relocate a 0 address. */
- if (old == 0) {
- new = old;
- break;
- }
- /* fall through */
- default:
- new = vtophys(old);
- break;
- }
-
- *dst++ = new;
- }
- } else
- *dst++ = *src++;
-
- };
-}
-
-/*==========================================================
-**
-**
-** Auto configuration.
-**
-**
-**==========================================================
-*/
-
-/*----------------------------------------------------------
-**
-** Reduce the transfer length to the max value
-** we can transfer safely.
-**
-** Reading a block greater then MAX_SIZE from the
-** raw (character) device exercises a memory leak
-** in the vm subsystem. This is common to ALL devices.
-** We have submitted a description of this bug to
-** <FreeBSD-bugs@freefall.cdrom.com>.
-** It should be fixed in the current release.
-**
-**----------------------------------------------------------
-*/
-
-void ncr_min_phys (struct buf *bp)
-{
- if (bp->b_bcount > MAX_SIZE) bp->b_bcount = MAX_SIZE;
-}
-
-/*----------------------------------------------------------
-**
-** Maximal number of outstanding requests per target.
-**
-**----------------------------------------------------------
-*/
-
-U_INT32 ncr_info (int unit)
-{
- return (1); /* may be changed later */
-}
-
-/*----------------------------------------------------------
-**
-** Probe the hostadapter.
-**
-**----------------------------------------------------------
-*/
-
-#ifdef __NetBSD__
-
-int
-ncr_probe(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct cfdata *cf = self->dv_cfdata;
- struct pci_attach_args *pa = aux;
-
- if (!pci_targmatch(cf, pa))
- return 0;
- if (pa->pa_id != NCR_810_ID &&
- pa->pa_id != NCR_815_ID &&
- pa->pa_id != NCR_825_ID)
- return 0;
-
- return 1;
-}
-
-#else /* !__NetBSD__ */
-
-
-static char* ncr_probe (pcici_t tag, pcidi_t type)
-{
- switch (type) {
-
- case NCR_810_ID:
- return ("ncr 53c810 scsi");
-
- case NCR_815_ID:
- return ("ncr 53c815 scsi");
-
- case NCR_825_ID:
- return ("ncr 53c825 wide scsi");
- }
- return (0);
-}
-
-#endif /* !__NetBSD__ */
-
-
-/*==========================================================
-**
-**
-** Auto configuration: attach and init a host adapter.
-**
-**
-**==========================================================
-*/
-
-#define MIN_ASYNC_PD 40
-#define MIN_SYNC_PD 20
-
-#ifdef __NetBSD__
-
-int
-ncr_print()
-{
-}
-
-void
-ncr_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct pci_attach_args *pa = aux;
- int retval;
- ncb_p np = (void *)self;
-
- /*
- ** XXX
- ** Perhaps try to figure what which model chip it is and print that
- ** out.
- */
- printf("\n");
-
- /*
- ** Try to map the controller chip to
- ** virtual and physical memory.
- */
-
- retval = pci_map_mem(pa->pa_tag, 0x14, &np->vaddr, &np->paddr);
- if (retval)
- return;
-
- np->sc_ih.ih_fun = ncr_intr;
- np->sc_ih.ih_arg = np;
- np->sc_ih.ih_level = IPL_BIO;
-
- retval = pci_map_int(pa->pa_tag, &np->sc_ih);
- if (retval)
- return;
-
-#else /* !__NetBSD__ */
-
-static void ncr_attach (pcici_t config_id, int unit)
-{
- ncb_p np;
-#if ! (__FreeBSD__ >= 2)
- extern unsigned bio_imask;
-#endif
-
-
- /*
- ** allocate structure
- */
-
- np = (ncb_p) malloc (sizeof (struct ncb), M_DEVBUF, M_WAITOK);
- if (!np) return;
- ncrp[unit]=np;
-
- /*
- ** initialize structure.
- */
-
- bzero (np, sizeof (*np));
- np->unit = unit;
-
- /*
- ** Try to map the controller chip to
- ** virtual and physical memory.
- */
-
- if (!pci_map_mem (config_id, 0x14, &np->vaddr, &np->paddr))
- return;
-
-#endif /* !__NetBSD__ */
-
- /*
- ** Do chip dependent initialization.
- */
-
-#ifdef __NetBSD__
- switch (pa->pa_id) {
-#else
- switch (pci_conf_read (config_id, PCI_ID_REG)) {
-#endif
- case NCR_810_ID:
- np->maxwide = 0;
- break;
- case NCR_815_ID:
- case NCR_825_ID:
- np->maxwide = 1;
- break;
- }
-
- /*
- ** Patch script to physical addresses
- */
-
- ncr_script_fill (&script0);
- ncr_script_copy_and_bind (&script0, np);
-
- /*
- ** init data structure
- */
-
- np -> jump_tcb.l_cmd = SCR_JUMP ;
- np -> jump_tcb.l_paddr = vtophys (&np->script->abort);
-
- /*
- ** Make the controller's registers available.
- ** Now the INB INW INL OUTB OUTW OUTL macros
- ** can be used safely.
- */
-
- np->reg = (struct ncr_reg*) np->vaddr;
-
- /*
- ** Get SCSI addr of host adapter (set by bios?).
- */
-
- np->myaddr = INB(nc_scid) & 0x07;
- if (!np->myaddr) np->myaddr = SCSI_NCR_MYADDR;
-
- /*
- ** Get the value of the chip's clock.
- ** Find the right value for scntl3.
- */
-
- ncr_getclock (np);
-
- /*
- ** Reset chip.
- */
-
- OUTB (nc_istat, SRST);
- OUTB (nc_istat, 0 );
-
- /*
- ** Now check the cache handling of the pci chipset.
- */
-
- if (ncr_snooptest (np)) {
- printf ("CACHE INCORRECTLY CONFIGURED.\n");
- return;
- };
-
-#ifndef __NetBSD__
- /*
- ** Install the interrupt handler.
- */
-
- if (!pci_map_int (config_id, ncr_intr, np, &bio_imask))
- printf ("\tinterruptless mode: reduced performance.\n");
-#endif
-
- /*
- ** After SCSI devices have been opened, we cannot
- ** reset the bus safely, so we do it here.
- ** Interrupt handler does the real work.
- */
-
- OUTB (nc_scntl1, CRST);
-
- /*
- ** process the reset exception,
- ** if interrupts are not enabled yet.
- */
- ncr_exception (np);
-
-#ifdef ANCIENT
- printf ("%s: waiting for scsi devices to settle\n",
- ncr_name (np));
- DELAY (1000000);
-#endif
- printf ("%s scanning for targets 0..%d ($Revision: 1.13 $)\n",
- ncr_name (np), MAX_TARGET-1);
-
- /*
- ** Now let the generic SCSI driver
- ** look for the SCSI devices on the bus ..
- */
-
-#ifndef ANCIENT
-#ifdef __NetBSD__
- np->sc_link.adapter_softc = np;
-#else /* !__NetBSD__ */
- np->sc_link.adapter_unit = unit;
-#endif /* !__NetBSD__ */
- np->sc_link.adapter_targ = np->myaddr;
- np->sc_link.adapter = &ncr_switch;
- np->sc_link.device = &ncr_dev;
-
-#ifdef __NetBSD__
- config_found(self, &np->sc_link, ncr_print);
-#else /* !__NetBSD__ */
- scsi_attachdevs (&np->sc_link);
-#endif /* !__NetBSD__ */
-#else /* ANCIENT */
- scsi_attachdevs (unit, np->myaddr, &ncr_switch);
-#endif /* ANCIENT */
-
- /*
- ** start the timeout daemon
- */
- ncr_timeout (np);
- np->lasttime=0;
-
- /*
- ** Done.
- */
-
- return;
-}
-
-/*==========================================================
-**
-**
-** Process pending device interrupts.
-**
-**
-**==========================================================
-*/
-
-int
-ncr_intr(np)
- ncb_p np;
-{
- int n = 0;
-
- if (DEBUG_FLAGS & DEBUG_TINY) printf ("[");
-
- if (INB(nc_istat) & (INTF|SIP|DIP)) {
- /*
- ** Repeat until no outstanding ints
- */
- do {
- ncr_exception (np);
- } while (INB(nc_istat) & (INTF|SIP|DIP));
-
- n=1;
- np->ticks = 100;
- };
-
- if (DEBUG_FLAGS & DEBUG_TINY) printf ("]\n");
-
- return (n);
-}
-
-/*==========================================================
-**
-**
-** Start execution of a SCSI command.
-** This is called from the generic SCSI driver.
-**
-**
-**==========================================================
-*/
-
-static INT32 ncr_start (struct scsi_xfer * xp)
-{
-#ifndef ANCIENT
-#ifdef __NetBSD__
- ncb_p np = xp->sc_link->adapter_softc;
-#else /*__NetBSD__*/
- ncb_p np = ncrp[xp->sc_link->adapter_unit];
-#endif/*__NetBSD__*/
-#else /* ANCIENT */
- ncb_p np = ncrp[xp->adapter];
-#endif /* ANCIENT */
-
- struct scsi_generic * cmd = xp->cmd;
- ccb_p cp;
- lcb_p lp;
- tcb_p tp = &np->target[xp->TARGET];
-
- int i, oldspl, segments, flags = xp->flags;
- u_char ptr, nego, idmsg;
- u_long msglen, msglen2;
-
-
-
- /*---------------------------------------------
- **
- ** Reset SCSI bus
- **
- ** Interrupt handler does the real work.
- **
- **---------------------------------------------
- */
-
- if (flags & SCSI_RESET) {
- OUTB (nc_scntl1, CRST);
- return(COMPLETE);
- };
-
- /*---------------------------------------------
- **
- ** Some shortcuts ...
- **
- **---------------------------------------------
- */
-
- if ((xp->TARGET == np->myaddr ) ||
- (xp->TARGET >= MAX_TARGET) ||
- (xp->LUN >= MAX_LUN ) ||
- (flags & SCSI_DATA_UIO)) {
- xp->error = XS_DRIVER_STUFFUP;
- return(HAD_ERROR);
- };
-
- /*---------------------------------------------
- **
- ** Diskaccess to partial blocks?
- **
- **---------------------------------------------
- */
-
- if ((xp->datalen & 0x1ff) && !(tp->inqdata[0] & 0x1f)) {
- switch (cmd->opcode) {
- case 0x28: /* READ_BIG (10) */
- case 0xa8: /* READ_HUGE (12) */
- case 0x2a: /* WRITE_BIG (10) */
- case 0xaa: /* WRITE_HUGE(12) */
- PRINT_ADDR(xp);
- printf ("access to partial disk block refused.\n");
- xp->error = XS_DRIVER_STUFFUP;
- return(HAD_ERROR);
- };
- };
-
-#ifdef ANCIENT
- /*---------------------------------------------
- ** Ancient version of <sys/scsi/sd.c>
- ** doesn't set the DATA_IN/DATA_OUT bits.
- ** So we have to fix it ..
- **---------------------------------------------
- */
-
- switch (cmd->opcode) {
- case 0x1a: /* MODE_SENSE */
- case 0x25: /* READ_CAPACITY */
- case 0x28: /* READ_BIG (10) */
- xp->flags |= SCSI_DATA_IN;
- break;
- case 0x2a: /* WRITE_BIG(10) */
- xp->flags |= SCSI_DATA_OUT;
- break;
- };
-#endif /* ANCIENT */
-
- if (DEBUG_FLAGS & DEBUG_TINY) {
- PRINT_ADDR(xp);
- printf ("CMD=%x F=%x L=%x ", cmd->opcode,
- (unsigned)xp->flags, (unsigned) xp->datalen);
- }
-
- /*--------------------------------------------
- **
- ** Sanity checks ...
- ** copied from Elischer's Adaptec driver.
- **
- **--------------------------------------------
- */
-
- flags = xp->flags;
- if (!(flags & INUSE)) {
- printf("%s: ?INUSE?\n", ncr_name (np));
- xp->flags |= INUSE;
- };
-
- if(flags & ITSDONE) {
- printf("%s: ?ITSDONE?\n", ncr_name (np));
- xp->flags &= ~ITSDONE;
- };
-
- if (xp->bp)
- flags |= (SCSI_NOSLEEP); /* just to be sure */
-
- /*---------------------------------------------------
- **
- ** Assign a ccb / bind xp
- **
- **----------------------------------------------------
- */
-
- if (!(cp=ncr_get_ccb (np, flags, xp->TARGET, xp->LUN))) {
- printf ("%s: no ccb.\n", ncr_name (np));
- xp->error = XS_DRIVER_STUFFUP;
- return(TRY_AGAIN_LATER);
- };
- cp->xfer = xp;
-
- /*---------------------------------------------------
- **
- ** timestamp
- **
- **----------------------------------------------------
- */
-
- bzero (&cp->phys.header.stamp, sizeof (struct tstamp));
- cp->phys.header.stamp.start = time;
-
- /*----------------------------------------------------
- **
- ** Get device quirks from a speciality table.
- **
- ** @GENSCSI@
- ** This should be a part of the device table
- ** in "scsi_conf.c".
- **
- **----------------------------------------------------
- */
-
- if (tp->quirks & QUIRK_UPDATE) {
-#ifdef NEW_SCSICONF
- tp->quirks = xp->sc_link->quirks;
-#else
- tp->quirks = ncr_lookup ((char*) &tp->inqdata[0]);
-#endif
- if (tp->quirks) {
- PRINT_ADDR(xp);
- printf ("quirks=%x.\n", tp->quirks);
- };
- };
-
- /*---------------------------------------------------
- **
- ** negotiation required?
- **
- **----------------------------------------------------
- */
-
- nego = 0;
-
- if (tp->inqdata[7]) {
- /*
- ** negotiate synchronous transfers?
- */
-
- if (!tp->period) {
- if (tp->inqdata[7] & INQ7_SYNC) {
- nego = NS_SYNC;
- } else {
- tp->period =0xffff;
- tp->sval = 0xe0;
- PRINT_ADDR(xp);
- printf ("asynchronous.\n");
- };
- };
-
- /*
- ** negotiate wide transfers ?
- */
-
- if (!tp->widedone) {
- if (tp->inqdata[7] & INQ7_WIDE16) {
- if (!nego) nego = NS_WIDE;
- } else
- tp->widedone=1;
- };
- };
-
- /*---------------------------------------------------
- **
- ** choose a new tag ...
- **
- **----------------------------------------------------
- */
-
- if ((lp = tp->lp[xp->LUN]) && (lp->usetags)) {
- /*
- ** assign a tag to this ccb!
- */
- while (!cp->tag) {
- ccb_p cp2 = lp->next_ccb;
- lp->lasttag = lp->lasttag % 255 + 1;
- while (cp2 && cp2->tag != lp->lasttag)
- cp2 = cp2->next_ccb;
- if (cp2) continue;
- cp->tag=lp->lasttag;
- if (DEBUG_FLAGS & DEBUG_TAGS) {
- PRINT_ADDR(xp);
- printf ("using tag #%d.\n", cp->tag);
- };
- };
- } else {
- cp->tag=0;
-#if !defined(ANCIENT) && !defined(__NetBSD__) && !(__FreeBSD__ >= 2)
- /*
- ** @GENSCSI@ Bug in "/sys/scsi/cd.c"
- **
- ** /sys/scsi/cd.c initializes opennings with 2.
- ** Our info value of 1 is not respected.
- */
- if (xp->sc_link && xp->sc_link->opennings) {
- PRINT_ADDR(xp);
- printf ("opennings set to 0.\n");
- xp->sc_link->opennings = 0;
- };
-#endif
- };
-
- /*----------------------------------------------------
- **
- ** Build the identify / tag / sdtr message
- **
- **----------------------------------------------------
- */
-
- idmsg = (cp==&np->ccb ? 0x80 : 0xc0) | xp->LUN;
-
- cp -> scsi_smsg [0] = idmsg;
- msglen=1;
-
- if (cp->tag) {
-
- /*
- ** Ordered write ops, unordered read ops.
- */
- switch (cmd->opcode) {
- case 0x08: /* READ_SMALL (6) */
- case 0x28: /* READ_BIG (10) */
- case 0xa8: /* READ_HUGE (12) */
- cp -> scsi_smsg [msglen] = M_SIMPLE_TAG;
- break;
- default:
- cp -> scsi_smsg [msglen] = M_ORDERED_TAG;
- }
-
- /*
- ** can be overwritten by ncrcontrol
- */
- switch (np->order) {
- case M_SIMPLE_TAG:
- case M_ORDERED_TAG:
- cp -> scsi_smsg [msglen] = np->order;
- };
- msglen++;
- cp -> scsi_smsg [msglen++] = cp -> tag;
- }
-
- switch (nego) {
- case NS_SYNC:
- cp -> scsi_smsg [msglen++] = M_EXTENDED;
- cp -> scsi_smsg [msglen++] = 3;
- cp -> scsi_smsg [msglen++] = M_X_SYNC_REQ;
- cp -> scsi_smsg [msglen++] = tp->minsync;
- cp -> scsi_smsg [msglen++] = tp->maxoffs;
- if (DEBUG_FLAGS & DEBUG_NEGO) {
- PRINT_ADDR(cp->xfer);
- printf ("sync msgout: ");
- ncr_show_msg (&cp->scsi_smsg [msglen-5]);
- printf (".\n");
- };
- break;
- case NS_WIDE:
- cp -> scsi_smsg [msglen++] = M_EXTENDED;
- cp -> scsi_smsg [msglen++] = 2;
- cp -> scsi_smsg [msglen++] = M_X_WIDE_REQ;
- cp -> scsi_smsg [msglen++] = tp->usrwide;
- if (DEBUG_FLAGS & DEBUG_NEGO) {
- PRINT_ADDR(cp->xfer);
- printf ("wide msgout: ");
- ncr_show_msg (&cp->scsi_smsg [msglen-4]);
- printf (".\n");
- };
- break;
- };
-
- /*----------------------------------------------------
- **
- ** Build the identify message for getcc.
- **
- **----------------------------------------------------
- */
-
- cp -> scsi_smsg2 [0] = idmsg;
- msglen2 = 1;
-
- /*----------------------------------------------------
- **
- ** Build the data descriptors
- **
- **----------------------------------------------------
- */
-
- segments = ncr_scatter (&cp->phys, (vm_offset_t) xp->data,
- (vm_size_t) xp->datalen);
-
- if (segments < 0) {
- xp->error = XS_DRIVER_STUFFUP;
- ncr_free_ccb(np, cp, flags);
- return(HAD_ERROR);
- };
-
- /*----------------------------------------------------
- **
- ** Set the SAVED_POINTER.
- **
- **----------------------------------------------------
- */
-
- if (flags & SCSI_DATA_IN) {
- cp->phys.header.savep = vtophys (&np->script->data_in);
- cp->phys.header.goalp = cp->phys.header.savep +20 +segments*16;
- } else if (flags & SCSI_DATA_OUT) {
- cp->phys.header.savep = vtophys (&np->script->data_out);
- cp->phys.header.goalp = cp->phys.header.savep +20 +segments*16;
- } else {
- cp->phys.header.savep = vtophys (&np->script->no_data);
- cp->phys.header.goalp = cp->phys.header.savep;
- };
- cp->phys.header.lastp = cp->phys.header.savep;
-
-
- /*----------------------------------------------------
- **
- ** fill ccb
- **
- **----------------------------------------------------
- **
- **
- ** physical -> virtual backlink
- ** Generic SCSI command
- */
- cp->phys.header.cp = cp;
- /*
- ** Startqueue
- */
- cp->phys.header.launch.l_paddr = vtophys (&np->script->select);
- cp->phys.header.launch.l_cmd = SCR_JUMP;
- /*
- ** select
- */
- cp->phys.select.sel_id = xp->TARGET;
- cp->phys.select.sel_scntl3 = tp->wval;
- cp->phys.select.sel_sxfer = tp->sval;
- /*
- ** message
- */
- cp->phys.smsg.addr = vtophys (&cp->scsi_smsg );
- cp->phys.smsg.size = msglen;
- cp->phys.smsg2.addr = vtophys (&cp->scsi_smsg2);
- cp->phys.smsg2.size = msglen2;
- /*
- ** command
- */
-#ifdef ANCIENT
- bcopy (cmd, &cp->cmd, sizeof (cp->cmd));
- cp->phys.cmd.addr = vtophys (&cp->cmd);
-#else /* ANCIENT */
- cp->phys.cmd.addr = vtophys (cmd);
-#endif /* ANCIENT */
- cp->phys.cmd.size = xp->cmdlen;
- /*
- ** sense data
- */
- cp->phys.sense.addr = vtophys (&cp->xfer->sense);
- cp->phys.sense.size = sizeof(struct scsi_sense_data);
- /*
- ** status
- */
- cp->actualquirks = tp->quirks;
- cp->host_status = nego ? HS_NEGOTIATE : HS_BUSY;
- cp->scsi_status = S_ILLEGAL;
- cp->parity_status = 0;
-
- cp->xerr_status = XE_OK;
- cp->sync_status = tp->sval;
- cp->nego_status = nego;
- cp->wide_status = tp->wval;
-
- /*----------------------------------------------------
- **
- ** Critical region: starting this job.
- **
- **----------------------------------------------------
- */
-
- oldspl = 0; /* for the sake of gcc */
- if (!(flags & SCSI_NOMASK)) oldspl = splbio();
- np->lock++;
-
- /*
- ** reselect pattern and activate this job.
- */
-
- cp->jump_ccb.l_cmd = (SCR_JUMP ^ IFFALSE (DATA (cp->tag)));
- cp->tlimit = time.tv_sec + xp->timeout / 1000 + 2;
- cp->magic = CCB_MAGIC;
-
- /*
- ** insert into startqueue.
- */
-
- ptr = np->squeueput + 1;
- if (ptr >= MAX_START) ptr=0;
- np->squeue [ptr ] = vtophys(&np->script->idle);
- np->squeue [np->squeueput] = vtophys(&cp->phys);
- np->squeueput = ptr;
-
- if(DEBUG_FLAGS & DEBUG_QUEUE)
- printf ("%s: queuepos=%d tryoffset=%d.\n", ncr_name (np),
- np->squeueput,
- (unsigned)(np->script->startpos[0]-
- (vtophys(&np->script->tryloop))));
-
- /*
- ** Script processor may be waiting for reconnect.
- ** Wake it up.
- */
- OUTB (nc_istat, SIGP);
-
- /*
- ** If interrupts are enabled, return now.
- ** Command is successfully queued.
- */
-
- np->lock--;
- if (!(flags & SCSI_NOMASK)) {
- splx (oldspl);
- if (np->lasttime) {
- if(DEBUG_FLAGS & DEBUG_TINY) printf ("Q");
- return(SUCCESSFULLY_QUEUED);
- };
- };
-
- /*----------------------------------------------------
- **
- ** Interrupts not yet enabled - have to poll.
- **
- **----------------------------------------------------
- */
-
- if (DEBUG_FLAGS & DEBUG_POLL) printf("P");
-
- for (i=xp->timeout; i && !(xp->flags & ITSDONE);i--) {
- if ((DEBUG_FLAGS & DEBUG_POLL) && (cp->host_status))
- printf ("%c", (cp->host_status & 0xf) + '0');
- DELAY (1000);
- ncr_exception (np);
- };
-
- /*
- ** Abort if command not done.
- */
- if (!(xp->flags & ITSDONE)) {
- printf ("%s: aborting job ...\n", ncr_name (np));
- OUTB (nc_istat, CABRT);
- DELAY (100000);
- OUTB (nc_istat, SIGP);
- ncr_exception (np);
- };
-
- if (!(xp->flags & ITSDONE)) {
- printf ("%s: abortion failed at %x.\n",
- ncr_name (np), (unsigned) INL(nc_dsp));
- ncr_init (np, "timeout", HS_TIMEOUT);
- };
-
- if (!(xp->flags & ITSDONE)) {
- cp-> host_status = HS_SEL_TIMEOUT;
- ncr_complete (np, cp);
- };
-
- if (DEBUG_FLAGS & DEBUG_RESULT) {
- printf ("%s: result: %x %x.\n",
- ncr_name (np), cp->host_status, cp->scsi_status);
- };
- if (!(flags & SCSI_NOMASK))
- return (SUCCESSFULLY_QUEUED);
- switch (xp->error) {
- case 0 : return (COMPLETE);
- case XS_BUSY: return (TRY_AGAIN_LATER);
- };
- return (HAD_ERROR);
-}
-
-/*==========================================================
-**
-**
-** Complete execution of a SCSI command.
-** Signal completion to the generic SCSI driver.
-**
-**
-**==========================================================
-*/
-
-void ncr_complete (ncb_p np, ccb_p cp)
-{
- struct scsi_xfer * xp;
- tcb_p tp;
- lcb_p lp;
-
- /*
- ** Sanity check
- */
-
- if (!cp || !cp->magic || !cp->xfer) return;
- cp->magic = 1;
- cp->tlimit= 0;
-
- /*
- ** No Reselect anymore.
- */
- cp->jump_ccb.l_cmd = (SCR_JUMP);
-
- /*
- ** No starting.
- */
- cp->phys.header.launch.l_paddr= vtophys (&np->script->idle);
-
- /*
- ** timestamp
- */
- ncb_profile (np, cp);
-
- if (DEBUG_FLAGS & DEBUG_TINY)
- printf ("CCB=%x STAT=%x/%x\n", (unsigned)cp & 0xfff,
- cp->host_status,cp->scsi_status);
-
- xp = cp->xfer;
- cp->xfer = NULL;
- tp = &np->target[xp->TARGET];
- lp = tp->lp[xp->LUN];
-
- /*
- ** Check for parity errors.
- */
-
- if (cp->parity_status) {
- PRINT_ADDR(xp);
- printf ("%d parity error(s), fallback.\n", cp->parity_status);
- /*
- ** fallback to asynch transfer.
- */
- tp->usrsync=255;
- tp->period = 0;
- };
-
- /*
- ** Check for extended errors.
- */
-
- if (cp->xerr_status != XE_OK) {
- PRINT_ADDR(xp);
- switch (cp->xerr_status) {
- case XE_EXTRA_DATA:
- printf ("extraneous data discarded.\n");
- break;
- case XE_BAD_PHASE:
- printf ("illegal scsi phase (4/5).\n");
- break;
- default:
- printf ("extended error %d.\n", cp->xerr_status);
- break;
- };
- if (cp->host_status==HS_COMPLETE)
- cp->host_status = HS_FAIL;
- };
-
- /*
- ** Check the status.
- */
- if ( (cp->host_status == HS_COMPLETE)
- && (cp->scsi_status == S_GOOD)) {
-
- /*
- ** All went well.
- */
-
- xp->resid = 0;
-
- /*
- ** if (cp->phys.header.lastp != cp->phys.header.goalp)...
- **
- ** @RESID@
- ** Could dig out the correct value for resid,
- ** but it would be quite complicated.
- **
- ** The ah1542.c driver sets it to 0 too ...
- */
-
- /*
- ** Try to assign a ccb to this nexus
- */
- ncr_alloc_ccb (np, xp);
-
- /*
- ** On inquire cmd (0x12) save some data.
- */
-#ifdef ANCIENT
- if (cp->cmd.opcode == 0x12) {
-#else /* ANCIENT */
- if (xp->cmd->opcode == 0x12) {
-#endif /* ANCIENT */
- bcopy ( xp->data,
- &tp->inqdata,
- sizeof (tp->inqdata));
-
- /*
- ** set number of tags
- */
- ncr_setmaxtags (tp, tp->usrtags);
-
- /*
- ** prepare negotiation of synch and wide.
- */
- ncr_negotiate (np, tp);
-
- /*
- ** force quirks update before next command start
- */
- tp->quirks |= QUIRK_UPDATE;
- };
-
- /*
- ** Announce changes to the generic driver
- */
- if (lp) {
- ncr_settags (tp, lp);
- if (lp->reqlink != lp->actlink)
- ncr_opennings (np, lp, xp);
- };
-
-#ifdef DK
- dk_xfer[DK] ++;
- dk_wds [DK] += xp->datalen/64;
- dk_wpms[DK] = 1000000;
-#endif /* DK */
-
- tp->bytes += xp->datalen;
- tp->transfers ++;
-
- } else if (xp->flags & SCSI_ERR_OK) {
-
- /*
- ** Not correct, but errors expected.
- */
- xp->resid = 0;
-
- } else if ((cp->host_status == HS_COMPLETE)
- && (cp->scsi_status == (S_SENSE|S_GOOD))) {
-
- /*
- ** Check condition code
- */
- xp->error = XS_SENSE;
-
- if (DEBUG_FLAGS & (DEBUG_RESULT|DEBUG_TINY)) {
- u_char * p = (u_char*) & xp->sense;
- int i;
- printf ("\n%s: sense data:", ncr_name (np));
- for (i=0; i<14; i++) printf (" %x", *p++);
- printf (".\n");
- };
-
- } else if ((cp->host_status == HS_COMPLETE)
- && (cp->scsi_status == S_BUSY)) {
-
- /*
- ** Target is busy.
- */
- xp->error = XS_BUSY;
-
- } else if ((cp->host_status == HS_SEL_TIMEOUT)
- || (cp->host_status == HS_TIMEOUT)) {
-
- /*
- ** No response
- */
- xp->error = XS_TIMEOUT;
-
- } else {
-
- /*
- ** Other protocol messes
- */
- PRINT_ADDR(xp);
- printf ("COMMAND FAILED (%x %x) @%x.\n",
- cp->host_status, cp->scsi_status, (unsigned)cp);
-
- xp->error = XS_DRIVER_STUFFUP;
- }
-
- xp->flags |= ITSDONE;
-
- /*
- ** trace output
- */
-
- if (tp->usrflag & UF_TRACE) {
- u_char * p;
- int i;
- PRINT_ADDR(xp);
- printf (" CMD:");
-#ifdef ANCIENT
- p = (u_char*) &cp->cmd.opcode;
-#else /* ANCIENT */
- p = (u_char*) &xp->cmd->opcode;
-#endif /* ANCIENT */
- for (i=0; i<xp->cmdlen; i++) printf (" %x", *p++);
-
- if (cp->host_status==HS_COMPLETE) {
- switch (cp->scsi_status) {
- case S_GOOD:
- printf (" GOOD");
- break;
- case S_CHECK_COND:
- printf (" SENSE:");
- p = (u_char*) &xp->sense;
-#ifdef ANCIENT
- for (i=0; i<sizeof(xp->sense); i++)
-#else /* ANCIENT */
- for (i=0; i<xp->req_sense_length; i++)
-#endif /* ANCIENT */
- printf (" %x", *p++);
- break;
- default:
- printf (" STAT: %x\n", cp->scsi_status);
- break;
- };
- } else printf (" HOSTERROR: %x", cp->host_status);
- printf ("\n");
- };
-
- /*
- ** Free this ccb
- */
- ncr_free_ccb (np, cp, xp->flags);
-
- /*
- ** signal completion to generic driver.
- */
-#ifdef ANCIENT
- if (xp->when_done)
- (*(xp->when_done))(xp->done_arg,xp->done_arg2);
-#else /* ANCIENT */
- scsi_done (xp);
-#endif /* ANCIENT */
-}
-
-/*==========================================================
-**
-**
-** Signal all (or one) control block done.
-**
-**
-**==========================================================
-*/
-
-void ncr_wakeup (ncb_p np, u_long code)
-{
- /*
- ** Starting at the default ccb and following
- ** the links, complete all jobs with a
- ** host_status greater than "disconnect".
- **
- ** If the "code" parameter is not zero,
- ** complete all jobs that are not IDLE.
- */
-
- int s=splbio();
-
- ccb_p cp = &np->ccb;
- while (cp) {
- switch (cp->host_status) {
-
- case HS_IDLE:
- break;
-
- case HS_DISCONNECT:
- if(DEBUG_FLAGS & DEBUG_TINY) printf ("D");
- /* fall through */
-
- case HS_BUSY:
- case HS_NEGOTIATE:
- if (!code) break;
- cp->host_status = code;
-
- /* fall through */
-
- default:
- ncr_complete (np, cp);
- break;
- };
- cp = cp -> link_ccb;
- };
- splx (s);
-}
-
-/*==========================================================
-**
-**
-** Start NCR chip.
-**
-**
-**==========================================================
-*/
-
-void ncr_init (ncb_p np, char * msg, u_long code)
-{
- int i;
- u_long usrsync;
- u_char usrwide;
-
- /*
- ** Reset chip.
- */
-
- OUTB (nc_istat, SRST );
-
- /*
- ** Message.
- */
-
- if (msg) printf ("%s: restart (%s).\n", ncr_name (np), msg);
-
- /*
- ** Clear Start Queue
- */
-
- for (i=0;i<MAX_START;i++)
- np -> squeue [i] = vtophys (&np->script->idle);
-
- /*
- ** Start at first entry.
- */
-
- np->squeueput = 0;
- np->script->startpos[0] = vtophys (&np->script->tryloop);
- np->script->start0 [0] = SCR_INT ^ IFFALSE (0);
-
- /*
- ** Wakeup all pending jobs.
- */
-
- ncr_wakeup (np, code);
-
- /*
- ** Init chip.
- */
-
- OUTB (nc_istat, 0 ); /* Remove Reset, abort ... */
- OUTB (nc_scntl0, 0xca ); /* full arb., ena parity, par->ATN */
- OUTB (nc_scntl1, 0x00 ); /* odd parity, and remove CRST!! */
- OUTB (nc_scntl3, np->rv_scntl3);/* timing prescaler */
- OUTB (nc_scid , 0x40|np->myaddr);/* host adapter SCSI address */
- OUTW (nc_respid, 1ul<<np->myaddr);/* id to respond to */
- OUTB (nc_istat , SIGP ); /* Signal Process */
- OUTB (nc_dmode , 0xc0 ); /* Burst length = 16 transfer */
- OUTB (nc_dcntl , NOCOM ); /* no single step mode, protect SFBR*/
- OUTB (nc_ctest4, 0x08 ); /* enable master parity checking */
- OUTB (nc_stest2, EXT ); /* Extended Sreq/Sack filtering */
- OUTB (nc_stest3, TE ); /* TolerANT enable */
- OUTB (nc_stime0, 0xfb ); /* HTH = 1.6sec STO = 0.1 sec. */
-
- /*
- ** Reinitialize usrsync.
- ** Have to renegotiate synch mode.
- */
-
- usrsync = 255;
- if (SCSI_NCR_MAX_SYNC) {
- u_long period;
- period =1000000/SCSI_NCR_MAX_SYNC; /* ns = 10e6 / kHz */
- if (period <= 11 * np->ns_sync) {
- if (period < 4 * np->ns_sync)
- usrsync = np->ns_sync;
- else
- usrsync = period / 4;
- };
- };
-
- /*
- ** Reinitialize usrwide.
- ** Have to renegotiate wide mode.
- */
-
- usrwide = (SCSI_NCR_MAX_WIDE);
- if (usrwide > np->maxwide) usrwide=np->maxwide;
-
- /*
- ** Fill in target structure.
- */
-
- for (i=0;i<MAX_TARGET;i++) {
- tcb_p tp = &np->target[i];
-
- tp->sval = 0;
- tp->wval = np->rv_scntl3;
-
- tp->usrsync = usrsync;
- tp->usrwide = usrwide;
-
- ncr_negotiate (np, tp);
- }
-
- /*
- ** enable ints
- */
-
- OUTW (nc_sien , STO|HTH|MA|SGE|UDC|RST);
- OUTB (nc_dien , MDPE|BF|ABRT|SSI|SIR|IID);
-
- /*
- ** Start script processor.
- */
-
- OUTL (nc_dsp, vtophys (&np->script->start));
-}
-
-/*==========================================================
-**
-** Prepare the negotiation values for wide and
-** synchronous transfers.
-**
-**==========================================================
-*/
-
-static void ncr_negotiate (struct ncb* np, struct tcb* tp)
-{
- /*
- ** minsync unit is 4ns !
- */
-
- u_long minsync = tp->usrsync;
-
- if (minsync < 25) minsync=25;
-
- /*
- ** if not scsi 2
- ** don't believe FAST!
- */
-
- if ((minsync < 50) && (tp->inqdata[2] & 0x0f) < 2)
- minsync=50;
-
- /*
- ** our limit ..
- */
-
- if (minsync < np->ns_sync)
- minsync = np->ns_sync;
-
- /*
- ** divider limit
- */
-
- if (minsync > (np->ns_sync * 11) / 4)
- minsync = 255;
-
- tp->minsync = minsync;
- tp->maxoffs = (minsync<255 ? 8 : 0);
-
- /*
- ** period=0: has to negotiate sync transfer
- */
-
- tp->period=0;
-
- /*
- ** widedone=0: has to negotiate wide transfer
- */
- tp->widedone=0;
-}
-
-/*==========================================================
-**
-** Switch sync mode for current job and it's target
-**
-**==========================================================
-*/
-
-static void ncr_setsync (ncb_p np, ccb_p cp, u_char sxfer)
-{
- struct scsi_xfer *xp;
- tcb_p tp;
- u_char target = INB (nc_ctest0)&7;
-
- assert (cp);
- if (!cp) return;
-
- xp = cp->xfer;
- assert (xp);
- if (!xp) return;
- assert (target == xp->TARGET & 7);
-
- tp = &np->target[target];
- tp->period= sxfer&0xf ? ((sxfer>>5)+4) * np->ns_sync : 0xffff;
-
- if (tp->sval == sxfer) return;
- tp->sval = sxfer;
-
- /*
- ** Bells and whistles ;-)
- */
- PRINT_ADDR(xp);
- if (sxfer & 0x0f) {
- /*
- ** Disable extended Sreq/Sack filtering
- */
- if (tp->period <= 200) OUTB (nc_stest2, 0);
- printf ("%s%dns (%d Mb/sec) offset %d.\n",
- tp->period<200 ? "FAST SCSI-2 ":"",
- tp->period, (1000+tp->period/2)/tp->period,
- sxfer & 0x0f);
- } else printf ("asynchronous.\n");
-
- /*
- ** set actual value and sync_status
- */
- OUTB (nc_sxfer, sxfer);
- np->sync_st = sxfer;
-
- /*
- ** patch ALL ccbs of this target.
- */
- for (cp = &np->ccb; cp; cp = cp->link_ccb) {
- if (!cp->xfer) continue;
- if (cp->xfer->TARGET != target) continue;
- cp->sync_status = sxfer;
- };
-}
-
-/*==========================================================
-**
-** Switch wide mode for current job and it's target
-**
-**==========================================================
-*/
-
-static void ncr_setwide (ncb_p np, ccb_p cp, u_char wide)
-{
- struct scsi_xfer *xp;
- u_short target = INB (nc_ctest0)&7;
- tcb_p tp;
- u_char scntl3 = np->rv_scntl3 | (wide ? EWS : 0);
-
- assert (cp);
- if (!cp) return;
-
- xp = cp->xfer;
- assert (xp);
- if (!xp) return;
- assert (target == xp->TARGET & 7);
-
- tp = &np->target[target];
- tp->widedone = wide+1;
- if (tp->wval == scntl3) return;
- tp->wval = scntl3;
-
- /*
- ** Bells and whistles ;-)
- */
- PRINT_ADDR(xp);
- if (scntl3 & EWS)
- printf ("WIDE SCSI (16 bit) enabled.\n");
- else
- printf ("WIDE SCSI disabled.\n");
-
- /*
- ** set actual value and sync_status
- */
- OUTB (nc_scntl3, scntl3);
- np->wide_st = scntl3;
-
- /*
- ** patch ALL ccbs of this target.
- */
- for (cp = &np->ccb; cp; cp = cp->link_ccb) {
- if (!cp->xfer) continue;
- if (cp->xfer->TARGET != target) continue;
- cp->wide_status = scntl3;
- };
-}
-
-/*==========================================================
-**
-** Switch tagged mode for a target.
-**
-**==========================================================
-*/
-
-static void ncr_setmaxtags (tcb_p tp, u_long usrtags)
-{
- int l;
- tp->usrtags = usrtags;
- for (l=0; l<MAX_LUN; l++) {
- lcb_p lp;
- if (!tp) break;
- lp=tp->lp[l];
- if (!lp) continue;
- ncr_settags (tp, lp);
- };
-}
-
-static void ncr_settags (tcb_p tp, lcb_p lp)
-{
- u_char reqtags, tmp;
-
- if ((!tp) || (!lp)) return;
-
- /*
- ** only devices capable of tagges commands
- ** only disk devices
- ** only if enabled by user ..
- */
- if (( tp->inqdata[7] & INQ7_QUEUE) && ((tp->inqdata[0] & 0x1f)==0x00)
- && tp->usrtags) {
- reqtags = tp->usrtags;
- if (lp->actlink <= 1)
- lp->usetags=reqtags;
- } else {
- reqtags = 1;
- if (lp->actlink <= 1)
- lp->usetags=0;
- };
-
- /*
- ** don't announce more than available.
- */
- tmp = lp->actccbs;
- if (tmp > reqtags) tmp = reqtags;
- lp->reqlink = tmp;
-
- /*
- ** don't discard if announced.
- */
- tmp = lp->actlink;
- if (tmp < reqtags) tmp = reqtags;
- lp->reqccbs = tmp;
-}
-
-/*----------------------------------------------------
-**
-** handle user commands
-**
-**----------------------------------------------------
-*/
-
-static void ncr_usercmd (ncb_p np)
-{
- u_char t;
- tcb_p tp;
-
- switch (np->user.cmd) {
-
- case 0: return;
-
- case UC_SETSYNC:
- for (t=0; t<MAX_TARGET; t++) {
- if (!((np->user.target>>t)&1)) continue;
- tp = &np->target[t];
- tp->usrsync = np->user.data;
- ncr_negotiate (np, tp);
- };
- break;
-
- case UC_SETTAGS:
- if (np->user.data > MAX_TAGS)
- break;
- for (t=0; t<MAX_TARGET; t++) {
- if (!((np->user.target>>t)&1)) continue;
- ncr_setmaxtags (&np->target[t], np->user.data);
- };
- break;
-
- case UC_SETDEBUG:
- ncr_debug = np->user.data;
- break;
-
- case UC_SETORDER:
- np->order = np->user.data;
- break;
-
- case UC_SETWIDE:
- for (t=0; t<MAX_TARGET; t++) {
- u_long size;
- if (!((np->user.target>>t)&1)) continue;
- tp = &np->target[t];
- size = np->user.data;
- if (size > np->maxwide) size=np->maxwide;
- tp->usrwide = size;
- ncr_negotiate (np, tp);
- };
- break;
-
- case UC_SETFLAG:
- for (t=0; t<MAX_TARGET; t++) {
- if (!((np->user.target>>t)&1)) continue;
- tp = &np->target[t];
- tp->usrflag = np->user.data;
- };
- break;
- }
- np->user.cmd=0;
-}
-
-
-
-
-/*==========================================================
-**
-**
-** ncr timeout handler.
-**
-**
-**==========================================================
-**
-** Misused to keep the driver running when
-** interrupts are not configured correctly.
-**
-**----------------------------------------------------------
-*/
-
-static void ncr_timeout (ncb_p np)
-{
- u_long thistime = time.tv_sec;
- u_long step = np->ticks;
- u_long count = 0;
- long signed t;
- ccb_p cp;
-
- if (np->lasttime != thistime) {
- np->lasttime = thistime;
-
- ncr_usercmd (np);
-
- /*----------------------------------------------------
- **
- ** handle ncr chip timeouts
- **
- ** Assumption:
- ** We have a chance to arbitrate for the
- ** SCSI bus at least every 10 seconds.
- **
- **----------------------------------------------------
- */
-
- t = thistime - np->heartbeat;
-
- if (t<2) np->latetime=0; else np->latetime++;
-
- if (np->latetime>2) {
- /*
- ** If there are no requests, the script
- ** processor will sleep on SEL_WAIT_RESEL.
- ** But we have to check whether it died.
- ** Let's wake it up.
- */
- OUTB (nc_istat, SIGP);
- };
-
- if (np->latetime>10) {
- /*
- ** Although we tried to wakeup it,
- ** the script processor didn't answer.
- **
- ** May be a target is hanging,
- ** or another initator lets a tape device
- ** rewind with disconnect disabled :-(
- **
- ** We won't accept that.
- */
- printf ("%s: reset by timeout.\n", ncr_name (np));
- OUTB (nc_istat, SRST);
- OUTB (nc_istat, 0);
- if (INB (nc_sbcl) & CBSY)
- OUTB (nc_scntl1, CRST);
- ncr_init (np, NULL, HS_TIMEOUT);
- np->heartbeat = thistime;
- };
-
- /*----------------------------------------------------
- **
- ** handle ccb timeouts
- **
- **----------------------------------------------------
- */
-
- for (cp=&np->ccb; cp; cp=cp->link_ccb) {
- /*
- ** look for timed out ccbs.
- */
- if (!cp->host_status) continue;
- count++;
- if (cp->tlimit > thistime) continue;
-
- /*
- ** Disable reselect.
- ** Remove it from startqueue.
- */
- cp->jump_ccb.l_cmd = (SCR_JUMP);
- if (cp->phys.header.launch.l_paddr ==
- vtophys (&np->script->select)) {
- printf ("%s: timeout ccb=%x (skip)\n",
- ncr_name (np), (unsigned)cp);
- cp->phys.header.launch.l_paddr
- = vtophys (&np->script->skip);
- };
-
- switch (cp->host_status) {
-
- case HS_BUSY:
- case HS_NEGOTIATE:
- /*
- ** still in start queue ?
- */
- if (cp->phys.header.launch.l_paddr ==
- vtophys (&np->script->skip))
- continue;
-
- /* fall through */
- case HS_DISCONNECT:
- cp->host_status=HS_TIMEOUT;
- };
- cp->tag = 0;
-
- /*
- ** wakeup this ccb.
- */
- {
- int oldspl = splbio();
- ncr_complete (np, cp);
- splx (oldspl);
- };
- };
- }
-
- timeout (TIMEOUT ncr_timeout, (caddr_t) np, step ? step : 1);
-
- if ((INB(nc_istat) & (INTF|SIP|DIP)) && !np->lock) {
-
- /*
- ** Process pending interrupts.
- */
-
- int oldspl = splbio ();
- if (DEBUG_FLAGS & DEBUG_TINY) printf ("{");
- ncr_exception (np);
- if (DEBUG_FLAGS & DEBUG_TINY) printf ("}");
- splx (oldspl);
- };
-}
-
-/*==========================================================
-**
-**
-** ncr chip exception handler.
-**
-**
-**==========================================================
-*/
-
-void ncr_exception (ncb_p np)
-{
- u_char istat, dstat;
- u_short sist;
- u_long dsp;
-
- /*
- ** interrupt on the fly ?
- */
- while ((istat = INB (nc_istat)) & INTF) {
- if (DEBUG_FLAGS & DEBUG_TINY) printf ("F");
- OUTB (nc_istat, INTF);
- np->profile.num_fly++;
- ncr_wakeup (np, 0);
- };
-
- if (!(istat & (SIP|DIP))) return;
-
- /*
- ** Steinbach's Guideline for Systems Programming:
- ** Never test for an error condition you don't know how to handle.
- */
-
- dstat = INB (nc_dstat);
- sist = INW (nc_sist) ;
- np->profile.num_int++;
-
- if (DEBUG_FLAGS & DEBUG_TINY)
- printf ("<%d|%x:%x|%x:%x>",
- INB(nc_scr0),
- dstat,sist,
- (unsigned)INL(nc_dsp),
- (unsigned)INL(nc_dbc));
- if ((dstat==DFE) && (sist==PAR)) return;
-
-/*==========================================================
-**
-** First the normal cases.
-**
-**==========================================================
-*/
- /*-------------------------------------------
- ** SCSI reset
- **-------------------------------------------
- */
-
- if (sist & RST) {
- ncr_init (np, "scsi reset", HS_RESET);
- return;
- };
-
- /*-------------------------------------------
- ** selection timeout
- **
- ** IID excluded from dstat mask!
- ** (chip bug)
- **-------------------------------------------
- */
-
- if ((sist & STO) &&
- !(sist & (GEN|HTH|MA|SGE|UDC|RST|PAR)) &&
- !(dstat & (MDPE|BF|ABRT|SIR))) {
- ncr_int_sto (np);
- return;
- };
-
- /*-------------------------------------------
- ** Phase mismatch.
- **-------------------------------------------
- */
-
- if ((sist & MA) &&
- !(sist & (STO|GEN|HTH|SGE|UDC|RST|PAR)) &&
- !(dstat & (MDPE|BF|ABRT|SIR|IID))) {
- ncr_int_ma (np);
- return;
- };
-
- /*----------------------------------------
- ** move command with length 0
- **----------------------------------------
- */
-
- if ((dstat & IID) &&
- !(sist & (STO|GEN|HTH|MA|SGE|UDC|RST|PAR)) &&
- !(dstat & (MDPE|BF|ABRT|SIR)) &&
- ((INL(nc_dbc) & 0xf8000000) == SCR_MOVE_TBL)) {
- /*
- ** Target wants more data than available.
- ** The "no_data" script will do it.
- */
- OUTL (nc_dsp, vtophys(&np->script->no_data));
- return;
- };
-
- /*-------------------------------------------
- ** Programmed interrupt
- **-------------------------------------------
- */
-
- if ((dstat & SIR) &&
- !(sist & (STO|GEN|HTH|MA|SGE|UDC|RST|PAR)) &&
- !(dstat & (MDPE|BF|ABRT|IID)) &&
- (INB(nc_dsps) <= SIR_MAX)) {
- ncr_int_sir (np);
- return;
- };
-
- /*========================================
- ** do the register dump
- **========================================
- */
-
- if (time.tv_sec - np->regtime.tv_sec>10) {
- int i;
- np->regtime = time;
- for (i=0; i<sizeof(np->regdump); i++)
- ((char*)&np->regdump)[i] = ((char*)np->reg)[i];
- np->regdump.nc_dstat = dstat;
- np->regdump.nc_sist = sist;
- };
-
- printf ("%s targ %d?: ERROR (%x:%x:%x) (%x/%x) @ (%x:%x).\n",
- ncr_name (np), INB (nc_ctest0)&7, dstat, sist,
- INB (nc_sbcl),
- INB (nc_sxfer),INB (nc_scntl3),
- (unsigned) (dsp = INL (nc_dsp)),
- (unsigned) INL (nc_dbc));
-
- /*----------------------------------------
- ** clean up the dma fifo
- **----------------------------------------
- */
-
- if ( (INB(nc_sstat0) & (ILF|ORF|OLF) ) ||
- (INB(nc_sstat1) & (FF3210) ) ||
- (INB(nc_sstat2) & (ILF1|ORF1|OLF1)) || /* wide .. */
- !(dstat & DFE)) {
- printf ("%s: have to clear fifos.\n", ncr_name (np));
- OUTB (nc_stest3, TE|CSF); /* clear scsi fifo */
- OUTB (nc_ctest3, CLF); /* clear dma fifo */
- }
-
- /*----------------------------------------
- ** unexpected disconnect
- **----------------------------------------
- */
-
- if ((sist & UDC) &&
- !(sist & (STO|GEN|HTH|MA|SGE|RST|PAR)) &&
- !(dstat & (MDPE|BF|ABRT|SIR|IID))) {
- OUTB (nc_scr0, HS_UNEXPECTED);
- OUTL (nc_dsp, vtophys(&np->script->cleanup));
- return;
- };
-
- /*----------------------------------------
- ** cannot disconnect
- **----------------------------------------
- */
-
- if ((dstat & IID) &&
- !(sist & (STO|GEN|HTH|MA|SGE|UDC|RST|PAR)) &&
- !(dstat & (MDPE|BF|ABRT|SIR)) &&
- ((INL(nc_dbc) & 0xf8000000) == SCR_WAIT_DISC)) {
- /*
- ** Data cycles while waiting for disconnect.
- ** Force disconnect.
- */
- OUTB (nc_scntl1, 0);
- /*
- ** System may hang, but timeout will handle that.
- ** In fact, timeout can handle ALL problems :-)
- */
- OUTB (nc_dcntl, (STD|NOCOM));
- return;
- };
-
- /*----------------------------------------
- ** single step
- **----------------------------------------
- */
-
- if ((dstat & SSI) &&
- !(sist & (STO|GEN|HTH|MA|SGE|UDC|RST|PAR)) &&
- !(dstat & (MDPE|BF|ABRT|SIR|IID))) {
- OUTB (nc_dcntl, (STD|NOCOM));
- return;
- };
-
-/*
-** @RECOVER@ HTH, SGE, ABRT.
-**
-** We should try to recover from these interrupts.
-** They may occur if there are problems with synch transfers,
-** or if targets are powerswitched while the driver is running.
-*/
-
- if (sist & SGE) {
- OUTB (nc_ctest3, CLF); /* clear scsi offsets */
- }
-
- /*
- ** Freeze controller to be able to read the messages.
- */
-
- if (DEBUG_FLAGS & DEBUG_FREEZE) {
- int i;
- unsigned char val;
- for (i=0; i<0x60; i++) {
- switch (i%16) {
-
- case 0:
- printf ("%s: reg[%d0]: ",
- ncr_name(np),i/16);
- break;
- case 4:
- case 8:
- case 12:
- printf (" ");
- break;
- };
- val = ((unsigned char*) np->vaddr) [i];
- printf (" %x%x", val/16, val%16);
- if (i%16==15) printf (".\n");
- };
-
- untimeout (TIMEOUT ncr_timeout, (caddr_t) np);
-
- printf ("%s: halted!\n", ncr_name(np));
- /*
- ** don't restart controller ...
- */
- OUTB (nc_istat, SRST);
- return;
- };
-
- /*
- ** sorry, have to kill ALL jobs ...
- */
-
- ncr_init (np, "fatal error", HS_FAIL);
-}
-
-/*==========================================================
-**
-** ncr chip exception handler for selection timeout
-**
-**==========================================================
-**
-** There seems to be a bug in the 53c810.
-** Although a STO-interrupt is pending,
-** it continues executing script commands.
-** But it will fail and interrupt (IID) on
-** the next instruction where it's looking
-** for a valid phase.
-**
-**----------------------------------------------------------
-*/
-
-void ncr_int_sto (ncb_p np)
-{
- u_long dsa, scratcha, diff;
- ccb_p cp;
- if (DEBUG_FLAGS & DEBUG_TINY) printf ("T");
-
- /*
- ** look for ccb and set the status.
- */
-
- dsa = INL (nc_dsa);
- cp = &np->ccb;
- while (cp && (vtophys(&cp->phys) != dsa))
- cp = cp->link_ccb;
-
- if (cp) {
- cp-> host_status = HS_SEL_TIMEOUT;
- ncr_complete (np, cp);
- };
-
- /*
- ** repair start queue
- */
-
- scratcha = INL (nc_scratcha);
- diff = scratcha - vtophys(&np->script->tryloop);
-
- assert ((diff <= MAX_START * 20) && !(diff % 20));
-
- if ((diff <= MAX_START * 20) && !(diff % 20)) {
- np->script->startpos[0] = scratcha;
- OUTL (nc_dsp, vtophys (&np->script->start));
- return;
- };
- ncr_init (np, "selection timeout", HS_FAIL);
-}
-
-/*==========================================================
-**
-**
-** ncr chip exception handler for phase errors.
-**
-**
-**==========================================================
-**
-** We have to construct a new transfer descriptor,
-** to transfer the rest of the current block.
-**
-**----------------------------------------------------------
-*/
-
-static void ncr_int_ma (ncb_p np)
-{
- u_long dbc;
- u_long rest;
- u_long dsa;
- u_long dsp;
- u_long nxtdsp;
- u_long *vdsp;
- u_long oadr, olen;
- u_long *tblp, *newcmd;
- u_char cmd, sbcl, delta, ss0, ss2;
- ccb_p cp;
-
- dsp = INL (nc_dsp);
- dsa = INL (nc_dsa);
- dbc = INL (nc_dbc);
- ss0 = INB (nc_sstat0);
- ss2 = INB (nc_sstat2);
- sbcl= INB (nc_sbcl);
-
- cmd = dbc >> 24;
- rest= dbc & 0xffffff;
- delta=(INB (nc_dfifo) - rest) & 0x7f;
-
- /*
- ** The data in the dma fifo has not been transfered to
- ** the target -> add the amount to the rest
- ** and clear the data.
- ** Check the sstat2 register in case of wide transfer.
- */
-
- if (! (INB(nc_dstat) & DFE)) rest += delta;
- if (ss0 & OLF) rest++;
- if (ss0 & ORF) rest++;
- if (INB(nc_scntl3) & EWS) {
- if (ss2 & OLF1) rest++;
- if (ss2 & ORF1) rest++;
- };
- OUTB (nc_ctest3, CLF ); /* clear dma fifo */
- OUTB (nc_stest3, TE|CSF); /* clear scsi fifo */
-
- /*
- ** verify cp
- */
- dsa = INL (nc_dsa);
- cp = &np->ccb;
- while (cp && (vtophys(&cp->phys) != dsa))
- cp = cp->link_ccb;
-
- assert (cp == np->header.cp);
- assert (cp);
- if (!cp)
- return;
-
- /*
- ** find the interrupted script command,
- ** and the address at where to continue.
- */
-
- if (dsp == vtophys (&cp->patch[2])) {
- vdsp = &cp->patch[0];
- nxtdsp = vdsp[3];
- } else if (dsp == vtophys (&cp->patch[6])) {
- vdsp = &cp->patch[4];
- nxtdsp = vdsp[3];
- } else {
- vdsp = (u_long*) ((char*)np->script - vtophys(np->script) + dsp -8);
- nxtdsp = dsp;
- };
-
- /*
- ** log the information
- */
- if (DEBUG_FLAGS & (DEBUG_TINY|DEBUG_PHASE)) {
- printf ("P%d%d ",cmd&7, sbcl&7);
- printf ("RL=%d D=%d SS0=%x ",
- (unsigned) rest, (unsigned) delta, ss0);
- };
- if (DEBUG_FLAGS & DEBUG_PHASE) {
- printf ("\nCP=%x CP2=%x DSP=%x NXT=%x VDSP=%x CMD=%x ",
- (unsigned)cp, (unsigned)np->header.cp,
- (unsigned)dsp,
- (unsigned)nxtdsp, (unsigned)vdsp, cmd);
- };
-
- /*
- ** get old startaddress and old length.
- */
-
- oadr = vdsp[1];
-
- if (cmd & 0x10) { /* Table indirect */
- tblp = (u_long*) ((char*) &cp->phys + oadr);
- olen = tblp[0];
- oadr = tblp[1];
- } else {
- tblp = (u_long*) 0;
- olen = vdsp[0] & 0xffffff;
- };
-
- if (DEBUG_FLAGS & DEBUG_PHASE) {
- printf ("OCMD=%x\nTBLP=%x OLEN=%x OADR=%x\n",
- (unsigned) (vdsp[0] >> 24),
- (unsigned) tblp,
- (unsigned) olen,
- (unsigned) oadr);
- };
-
- /*
- ** if old phase not dataphase, leave here.
- */
-
- assert (cmd == (vdsp[0] >> 24));
- if (cmd & 0x06) {
- PRINT_ADDR(cp->xfer);
- printf ("phase change %d-%d %d@%x resid=%d.\n",
- cmd&7, sbcl&7, (unsigned)olen,
- (unsigned)oadr, (unsigned)rest);
-
- OUTB (nc_dcntl, (STD|NOCOM));
- return;
- };
-
- /*
- ** choose the correct patch area.
- ** if savep points to one, choose the other.
- */
-
- newcmd = cp->patch;
- if (cp->phys.header.savep == vtophys (newcmd)) newcmd+=4;
-
- /*
- ** fillin the commands
- */
-
- newcmd[0] = ((cmd & 0x0f) << 24) | rest;
- newcmd[1] = oadr + olen - rest;
- newcmd[2] = SCR_JUMP;
- newcmd[3] = nxtdsp;
-
- if (DEBUG_FLAGS & DEBUG_PHASE) {
- PRINT_ADDR(cp->xfer);
- printf ("newcmd[%d] %x %x %x %x.\n",
- newcmd - cp->patch,
- (unsigned)newcmd[0],
- (unsigned)newcmd[1],
- (unsigned)newcmd[2],
- (unsigned)newcmd[3]);
- }
- /*
- ** fake the return address (to the patch).
- ** and restart script processor at dispatcher.
- */
- np->profile.num_break++;
- OUTL (nc_temp, vtophys (newcmd));
- OUTL (nc_dsp, vtophys (&np->script->dispatch));
-}
-
-/*==========================================================
-**
-**
-** ncr chip exception handler for programmed interrupts.
-**
-**
-**==========================================================
-*/
-
-static int ncr_show_msg (u_char * msg)
-{
- u_char i;
- printf ("%x",*msg);
- if (*msg==M_EXTENDED) {
- for (i=1;i<8;i++) {
- if (i-1>msg[1]) break;
- printf ("-%x",msg[i]);
- };
- return (i+1);
- } else if ((*msg & 0xf0) == 0x20) {
- printf ("-%x",msg[1]);
- return (2);
- };
- return (1);
-}
-
-void ncr_int_sir (ncb_p np)
-{
- u_char chg, ofs, per, fak, wide;
- u_char num = INB (nc_dsps);
- ccb_p cp=0;
- u_long dsa;
- u_char target = INB (nc_ctest0) & 7;
- tcb_p tp = &np->target[target];
- int i;
- if (DEBUG_FLAGS & DEBUG_TINY) printf ("I#%d", num);
-
- switch (num) {
- case SIR_SENSE_RESTART:
- case SIR_STALL_RESTART:
- break;
-
- default:
- /*
- ** lookup the ccb
- */
- dsa = INL (nc_dsa);
- cp = &np->ccb;
- while (cp && (vtophys(&cp->phys) != dsa))
- cp = cp->link_ccb;
-
- assert (cp == np->header.cp);
- assert (cp);
- if (!cp)
- goto out;
- }
-
- switch (num) {
-
-/*--------------------------------------------------------------------
-**
-** Processing of interrupted getcc selects
-**
-**--------------------------------------------------------------------
-*/
-
- case SIR_SENSE_RESTART:
- /*------------------------------------------
- ** Script processor is idle.
- ** Look for interrupted "check cond"
- **------------------------------------------
- */
-
- if (DEBUG_FLAGS & DEBUG_RESTART)
- printf ("%s: int#%d",ncr_name (np),num);
- cp = (ccb_p) 0;
- for (i=0; i<MAX_TARGET; i++) {
- if (DEBUG_FLAGS & DEBUG_RESTART) printf (" t%d", i);
- tp = &np->target[i];
- if (DEBUG_FLAGS & DEBUG_RESTART) printf ("+");
- cp = tp->hold_cp;
- if (!cp) continue;
- if (DEBUG_FLAGS & DEBUG_RESTART) printf ("+");
- if ((cp->host_status==HS_BUSY) &&
- (cp->scsi_status==S_CHECK_COND))
- break;
- if (DEBUG_FLAGS & DEBUG_RESTART) printf ("- (remove)");
- tp->hold_cp = cp = (ccb_p) 0;
- };
-
- if (cp) {
- if (DEBUG_FLAGS & DEBUG_RESTART)
- printf ("+ restart job ..\n");
- OUTL (nc_dsa, vtophys (&cp->phys));
- OUTL (nc_dsp, vtophys (&np->script->getcc));
- return;
- };
-
- /*
- ** no job, resume normal processing
- */
- if (DEBUG_FLAGS & DEBUG_RESTART) printf (" -- remove trap\n");
- np->script->start0[0] = SCR_INT ^ IFFALSE (0);
- break;
-
- case SIR_SENSE_FAILED:
- /*-------------------------------------------
- ** While trying to reselect for
- ** getting the condition code,
- ** a target reselected us.
- **-------------------------------------------
- */
- PRINT_ADDR(cp->xfer);
- if (DEBUG_FLAGS & DEBUG_RESTART)
- printf ("in getcc reselect by t%d.\n",
- INB(nc_ssid)&7);
-
- /*
- ** Mark this job
- */
- cp->host_status = HS_BUSY;
- cp->scsi_status = S_CHECK_COND;
- np->target[cp->xfer->TARGET].hold_cp = cp;
-
- /*
- ** And patch code to restart it.
- */
- np->script->start0[0] = SCR_INT;
- break;
-
-/*-----------------------------------------------------------------------------
-**
-** Was Sie schon immer ueber transfermode negotiation wissen wollten ...
-**
-** We try to negotiate sync and wide transfer only after
-** a successfull inquire command. We look to byte 7 of the
-** inquire data to determine the capabilities if the target.
-**
-** When we try to negotiate, we append the negotiation message
-** to the identify and (maybe) simpletag message.
-** The host status field is set to HS_NEGOTIATE to mark this
-** situation.
-**
-** If the target doesn't answer this message immidiately
-** (as required by the standard), the SIR_NEGO_FAIL interrupt
-** will be raised eventually.
-** The handler removes the HS_NEGOTIATE status, and sets the
-** negotiated value to the default (async / nowide).
-**
-** If we receive a matching answer immediately, we check it
-** for validity, and set the values.
-**
-** If we receive a Reject message immediately, we assume the
-** negotiation has failed, and set to the standard values.
-**
-** If we receive a negotiation message while not in HS_NEGOTIATE
-** state, it's a target initiated negotiation. We prepare a
-** (hopefully) valid answer, set the values, and send this
-** answer back to the target.
-**
-** If the target doesn't fetch the answer (no message out phase),
-** we assume the negotiation has failed, and set the values to
-** the default.
-**
-** When we set the values, we set in all ccbs belonging to this
-** target, in the controllers register, and in the "phys"
-** field of the controllers struct ncb.
-**
-** Possible cases: hs sir msg_in value send goto
-** We try try to negotiate:
-** -> target doesnt't msgin NEG FAIL noop defa. - dispatch
-** -> target rejected our msg NEG FAIL reject defa. - dispatch
-** -> target answered (ok) NEG SYNC sdtr set - clrack
-** -> target answered (!ok) NEG SYNC sdtr defa. REJ--->msg_bad
-** -> target answered (ok) NEG WIDE wdtr set - clrack
-** -> target answered (!ok) NEG WIDE wdtr defa. REJ--->msg_bad
-** -> any other msgin NEG FAIL noop defa - dispatch
-**
-** Target tries to negotiate:
-** -> incoming message --- SYNC sdtr set SDTR -
-** -> incoming message --- WIDE wdtr set WDTR -
-** We sent our answer:
-** -> target doesn't msgout --- PROTO ? defa. - dispatch
-**
-**-----------------------------------------------------------------------------
-*/
-
- case SIR_NEGO_FAILED:
- /*-------------------------------------------------------
- **
- ** Negotiation failed.
- ** Target doesn't send an answer message,
- ** or target rejected our message.
- **
- ** Remove negotiation request.
- **
- **-------------------------------------------------------
- */
- OUTB (HS_PRT, HS_BUSY);
-
- /* fall through */
-
- case SIR_NEGO_PROTO:
- /*-------------------------------------------------------
- **
- ** Negotiation failed.
- ** Target doesn't fetch the answer message.
- **
- **-------------------------------------------------------
- */
-
- if (DEBUG_FLAGS & DEBUG_NEGO) {
- PRINT_ADDR(cp->xfer);
- printf ("negotiation failed sir=%x status=%x.\n",
- num, cp->nego_status);
- };
-
- /*
- ** any error in negotiation:
- ** fall back to default mode.
- */
- switch (cp->nego_status) {
-
- case NS_SYNC:
- ncr_setsync (np, cp, 0xe0);
- break;
-
- case NS_WIDE:
- ncr_setwide (np, cp, 0);
- break;
-
- };
- np->msgin [0] = M_NOOP;
- np->msgout[0] = M_NOOP;
- cp->nego_status = 0;
- OUTL (nc_dsp,vtophys (&np->script->dispatch));
- break;
-
- case SIR_NEGO_SYNC:
- /*
- ** Synchronous request message received.
- */
-
- if (DEBUG_FLAGS & DEBUG_NEGO) {
- PRINT_ADDR(cp->xfer);
- printf ("sync msgin: ");
- (void) ncr_show_msg (np->msgin);
- printf (".\n");
- };
-
- /*
- ** get requested values.
- */
-
- chg = 0;
- per = np->msgin[3];
- ofs = np->msgin[4];
- if (ofs==0) per=255;
-
- /*
- ** if target sends SDTR message,
- ** it CAN transfer synch.
- */
-
- if (ofs)
- tp->inqdata[7] |= INQ7_SYNC;
-
- /*
- ** check values against driver limits.
- */
-
- if (per < np->ns_sync)
- {chg = 1; per = np->ns_sync;}
- if (per < tp->minsync)
- {chg = 1; per = tp->minsync;}
- if (ofs > tp->maxoffs)
- {chg = 1; ofs = tp->maxoffs;}
-
- /*
- ** Check against controller limits.
- */
- fak = (4ul * per - 1) / np->ns_sync - 3;
- if (ofs && (fak>7)) {chg = 1; ofs = 0;}
- if (!ofs) fak=7;
-
- if (DEBUG_FLAGS & DEBUG_NEGO) {
- PRINT_ADDR(cp->xfer);
- printf ("sync: per=%d ofs=%d fak=%d chg=%d.\n",
- per, ofs, fak, chg);
- }
-
- if (INB (HS_PRT) == HS_NEGOTIATE) {
- OUTB (HS_PRT, HS_BUSY);
- switch (cp->nego_status) {
-
- case NS_SYNC:
- /*
- ** This was an answer message
- */
- if (chg) {
- /*
- ** Answer wasn't acceptable.
- */
- ncr_setsync (np, cp, 0xe0);
- OUTL (nc_dsp,vtophys (&np->script->msg_bad));
- } else {
- /*
- ** Answer is ok.
- */
- ncr_setsync (np, cp, (fak<<5)|ofs);
- OUTL (nc_dsp,vtophys (&np->script->clrack));
- };
- return;
-
- case NS_WIDE:
- ncr_setwide (np, cp, 0);
- break;
- };
- };
-
- /*
- ** It was a request. Set value and
- ** prepare an answer message
- */
-
- ncr_setsync (np, cp, (fak<<5)|ofs);
-
- np->msgout[0] = M_EXTENDED;
- np->msgout[1] = 3;
- np->msgout[2] = M_X_SYNC_REQ;
- np->msgout[3] = per;
- np->msgout[4] = ofs;
-
- np->msgin [0] = M_NOOP;
-
- cp->nego_status = NS_SYNC;
-
- if (DEBUG_FLAGS & DEBUG_NEGO) {
- PRINT_ADDR(cp->xfer);
- printf ("sync msgout: ");
- (void) ncr_show_msg (np->msgin);
- printf (".\n");
- }
- break;
-
- case SIR_NEGO_WIDE:
- /*
- ** Wide request message received.
- */
- if (DEBUG_FLAGS & DEBUG_NEGO) {
- PRINT_ADDR(cp->xfer);
- printf ("wide msgin: ");
- (void) ncr_show_msg (np->msgin);
- printf (".\n");
- };
-
- /*
- ** get requested values.
- */
-
- chg = 0;
- wide = np->msgin[3];
-
- /*
- ** if target sends WDTR message,
- ** it CAN transfer wide.
- */
-
- if (wide)
- tp->inqdata[7] |= INQ7_WIDE16;
-
- /*
- ** check values against driver limits.
- */
-
- if (wide > tp->usrwide)
- {chg = 1; wide = tp->usrwide;}
-
- if (DEBUG_FLAGS & DEBUG_NEGO) {
- PRINT_ADDR(cp->xfer);
- printf ("wide: wide=%d chg=%d.\n", wide, chg);
- }
-
- if (INB (HS_PRT) == HS_NEGOTIATE) {
- OUTB (HS_PRT, HS_BUSY);
- switch (cp->nego_status) {
-
- case NS_WIDE:
- /*
- ** This was an answer message
- */
- if (chg) {
- /*
- ** Answer wasn't acceptable.
- */
- ncr_setwide (np, cp, 0);
- OUTL (nc_dsp,vtophys (&np->script->msg_bad));
- } else {
- /*
- ** Answer is ok.
- */
- ncr_setwide (np, cp, wide);
- OUTL (nc_dsp,vtophys (&np->script->clrack));
- };
- return;
-
- case NS_SYNC:
- ncr_setsync (np, cp, 0xe0);
- break;
- };
- };
-
- /*
- ** It was a request, set value and
- ** prepare an answer message
- */
-
- ncr_setwide (np, cp, wide);
-
- np->msgout[0] = M_EXTENDED;
- np->msgout[1] = 2;
- np->msgout[2] = M_X_WIDE_REQ;
- np->msgout[3] = wide;
-
- np->msgin [0] = M_NOOP;
-
- cp->nego_status = NS_WIDE;
-
- if (DEBUG_FLAGS & DEBUG_NEGO) {
- PRINT_ADDR(cp->xfer);
- printf ("wide msgout: ");
- (void) ncr_show_msg (np->msgin);
- printf (".\n");
- }
- break;
-
-/*--------------------------------------------------------------------
-**
-** Processing of special messages
-**
-**--------------------------------------------------------------------
-*/
-
- case SIR_REJECT_RECEIVED:
- /*-----------------------------------------------
- **
- ** We received a M_REJECT message.
- **
- **-----------------------------------------------
- */
-
- PRINT_ADDR(cp->xfer);
- printf ("M_REJECT received (%x:%x).\n",
- (unsigned)np->lastmsg, np->msgout[0]);
- break;
-
- case SIR_REJECT_SENT:
- /*-----------------------------------------------
- **
- ** We received an unknown message
- **
- **-----------------------------------------------
- */
-
- PRINT_ADDR(cp->xfer);
- printf ("M_REJECT sent for ");
- (void) ncr_show_msg (np->msgin);
- printf (".\n");
- break;
-
-/*--------------------------------------------------------------------
-**
-** Processing of special messages
-**
-**--------------------------------------------------------------------
-*/
-
- case SIR_IGN_RESIDUE:
- /*-----------------------------------------------
- **
- ** We received an IGNORE RESIDUE message,
- ** which couldn't be handled by the script.
- **
- **-----------------------------------------------
- */
-
- PRINT_ADDR(cp->xfer);
- printf ("M_IGN_RESIDUE received, but not yet implemented.\n");
- break;
-
- case SIR_MISSING_SAVE:
- /*-----------------------------------------------
- **
- ** We received an DISCONNECT message,
- ** but the datapointer wasn't saved before.
- **
- **-----------------------------------------------
- */
-
- PRINT_ADDR(cp->xfer);
- printf ("M_DISCONNECT received, but datapointer not saved:\n"
- "\tdata=%x save=%x goal=%x.\n",
- (unsigned) INL (nc_temp),
- (unsigned) np->header.savep,
- (unsigned) np->header.goalp);
- break;
-
-/*--------------------------------------------------------------------
-**
-** Processing of a "S_QUEUE_FULL" status.
-**
-** The current command has been rejected,
-** because there are too many in the command queue.
-** We have started too many commands for that target.
-**
-** If possible, reinsert at head of queue.
-** Stall queue until there are no disconnected jobs
-** (ncr is REALLY idle). Then restart processing.
-**
-** We should restart the current job after the controller
-** has become idle. But this is not yet implemented.
-**
-**--------------------------------------------------------------------
-*/
- case SIR_STALL_QUEUE:
- /*-----------------------------------------------
- **
- ** Stall the start queue.
- **
- **-----------------------------------------------
- */
- PRINT_ADDR(cp->xfer);
- printf ("queue full.\n");
-
- np->script->start1[0] = SCR_INT;
-
- /*
- ** Try to disable tagged transfers.
- */
- ncr_setmaxtags (&np->target[target], 0);
-
- /*
- ** @QUEUE@
- **
- ** Should update the launch field of the
- ** current job to be able to restart it.
- ** Then prepend it to the start queue.
- */
-
- /* fall through */
-
- case SIR_STALL_RESTART:
- /*-----------------------------------------------
- **
- ** Enable selecting again,
- ** if NO disconnected jobs.
- **
- **-----------------------------------------------
- */
- /*
- ** Look for a disconnected job.
- */
- cp = &np->ccb;
- while (cp && cp->host_status != HS_DISCONNECT)
- cp = cp->link_ccb;
-
- /*
- ** if there is one, ...
- */
- if (cp) {
- /*
- ** wait for reselection
- */
- OUTL (nc_dsp, vtophys (&np->script->reselect));
- return;
- };
-
- /*
- ** else remove the interrupt.
- */
-
- printf ("%s: queue empty.\n", ncr_name (np));
- np->script->start1[0] = SCR_INT ^ IFFALSE (0);
- break;
- };
-
-out:
- OUTB (nc_dcntl, (STD|NOCOM));
-}
-
-/*==========================================================
-**
-**
-** Aquire a control block
-**
-**
-**==========================================================
-*/
-
-static ccb_p ncr_get_ccb
- (ncb_p np, u_long flags, u_long target, u_long lun)
-{
- lcb_p lp;
- ccb_p cp = (ccb_p ) 0;
-
- /*
- ** Lun structure available ?
- */
-
- lp = np->target[target].lp[lun];
- if (lp)
- cp = lp->next_ccb;
-
- /*
- ** Look for free CCB
- */
-
- while (cp && cp->magic) cp = cp->next_ccb;
-
- /*
- ** if nothing available, take the default.
- */
-
- if (!cp) cp = &np->ccb;
-
- /*
- ** Wait until available.
- */
-
- while (cp->magic) {
- if (flags & SCSI_NOSLEEP) break;
- if (tsleep ((caddr_t)cp, PZERO|PCATCH, "ncr", 0))
- break;
- };
-
- if (cp->magic)
- return ((ccb_p) 0);
-
- cp->magic = 1;
- return (cp);
-}
-
-/*==========================================================
-**
-**
-** Release one control block
-**
-**
-**==========================================================
-*/
-
-void ncr_free_ccb (ncb_p np, ccb_p cp, int flags)
-{
- /*
- ** sanity
- */
-
- if (!cp) return;
-
- cp -> host_status = HS_IDLE;
- cp -> magic = 0;
- if (cp == &np->ccb)
- wakeup ((caddr_t) cp);
-}
-
-/*==========================================================
-**
-**
-** Allocation of resources for Targets/Luns/Tags.
-**
-**
-**==========================================================
-*/
-
-static void ncr_alloc_ccb (ncb_p np, struct scsi_xfer * xp)
-{
- tcb_p tp;
- lcb_p lp;
- ccb_p cp;
-
- u_long target;
- u_long lun;
-
- if (!np) return;
- if (!xp) return;
-
- target = xp->TARGET;
- lun = xp->LUN;
-
- if (target>=MAX_TARGET) return;
- if (lun >=MAX_LUN ) return;
-
- tp=&np->target[target];
-
- if (!tp->jump_tcb.l_cmd) {
-
- /*
- ** initialize it.
- */
- tp->jump_tcb.l_cmd = (SCR_JUMP^IFFALSE (DATA (0x80 + target)));
- tp->jump_tcb.l_paddr = np->jump_tcb.l_paddr;
-
- tp->getscr[0] = SCR_COPY (1);
- tp->getscr[1] = vtophys (&tp->sval);
- tp->getscr[2] = np->paddr + offsetof (struct ncr_reg, nc_sxfer);
- tp->getscr[3] = SCR_COPY (1);
- tp->getscr[4] = vtophys (&tp->wval);
- tp->getscr[5] = np->paddr + offsetof (struct ncr_reg, nc_scntl3);
-
- assert (( (offsetof(struct ncr_reg, nc_sxfer) ^
- offsetof(struct tcb , sval )) &3) == 0);
- assert (( (offsetof(struct ncr_reg, nc_scntl3) ^
- offsetof(struct tcb , wval )) &3) == 0);
-
- tp->call_lun.l_cmd = (SCR_CALL);
- tp->call_lun.l_paddr = vtophys (&np->script->resel_lun);
-
- tp->jump_lcb.l_cmd = (SCR_JUMP);
- tp->jump_lcb.l_paddr = vtophys (&np->script->abort);
- np->jump_tcb.l_paddr = vtophys (&tp->jump_tcb);
-
- ncr_setmaxtags (tp, SCSI_NCR_MAX_TAGS);
- }
-
- /*
- ** Logic unit control block
- */
- lp = tp->lp[lun];
- if (!lp) {
- /*
- ** Allocate a lcb
- */
- lp = (lcb_p) malloc (sizeof (struct lcb), M_DEVBUF, M_NOWAIT);
- if (!lp) return;
-
- /*
- ** Initialize it
- */
- bzero (lp, sizeof (*lp));
- lp->jump_lcb.l_cmd = (SCR_JUMP ^ IFFALSE (DATA (lun)));
- lp->jump_lcb.l_paddr = tp->jump_lcb.l_paddr;
-
- lp->call_tag.l_cmd = (SCR_CALL);
- lp->call_tag.l_paddr = vtophys (&np->script->resel_tag);
-
- lp->jump_ccb.l_cmd = (SCR_JUMP);
- lp->jump_ccb.l_paddr = vtophys (&np->script->aborttag);
-
- lp->actlink = 1;
- /*
- ** Link into Lun-Chain
- */
-
- tp->jump_lcb.l_paddr = vtophys (&lp->jump_lcb);
- tp->lp[lun] = lp;
-
- }
-
- /*
- ** Limit possible number of ccbs.
- **
- ** If tagged command queueing is enabled,
- ** can use more than one ccb.
- */
-
- if (np->actccbs >= MAX_START-2) return;
- if (lp->actccbs && (lp->actccbs >= lp->reqccbs))
- return;
-
- /*
- ** Allocate a ccb
- */
- cp = (ccb_p) malloc (sizeof (struct ccb), M_DEVBUF, M_NOWAIT);
-
- if (!cp)
- return;
-
- if (DEBUG_FLAGS & DEBUG_ALLOC) {
- PRINT_ADDR(xp);
- printf ("new ccb @%x.\n", (unsigned) cp);
- }
-
- /*
- ** Count it
- */
- lp->actccbs++;
- np->actccbs++;
-
- /*
- ** Initialize it.
- */
- bzero (cp, sizeof (*cp));
-
- /*
- ** link in reselect chain.
- */
- cp->jump_ccb.l_cmd = SCR_JUMP;
- cp->jump_ccb.l_paddr = lp->jump_ccb.l_paddr;
- lp->jump_ccb.l_paddr = vtophys(&cp->jump_ccb);
- cp->call_tmp.l_cmd = SCR_CALL;
- cp->call_tmp.l_paddr = vtophys(&np->script->resel_tmp);
-
- /*
- ** link in wakeup chain
- */
- cp->link_ccb = np->ccb.link_ccb;
- np->ccb.link_ccb = cp;
-
- /*
- ** Link into CCB-Chain
- */
- cp->next_ccb = lp->next_ccb;
- lp->next_ccb = cp;
-}
-
-/*==========================================================
-**
-**
-** Announce the number of ccbs/tags to the scsi driver.
-**
-**
-**==========================================================
-*/
-
-static void ncr_opennings (ncb_p np, lcb_p lp, struct scsi_xfer * xp)
-{
-#ifndef ANCIENT
- /*
- ** want to reduce the number ...
- */
- if (lp->actlink > lp->reqlink) {
-
- /*
- ** Try to reduce the count.
- ** We assume to run at splbio ..
- */
- u_char diff = lp->actlink - lp->reqlink;
-
- if (!diff) return;
-
- if (diff > xp->sc_link->opennings)
- diff = xp->sc_link->opennings;
-
- xp->sc_link->opennings -= diff;
- lp->actlink -= diff;
- if (DEBUG_FLAGS & DEBUG_TAGS)
- printf ("%s: actlink: diff=%d, new=%d, req=%d\n",
- ncr_name(np), diff, lp->actlink, lp->reqlink);
- return;
- };
-
- /*
- ** want to increase the number ?
- */
- if (lp->reqlink > lp->actlink) {
- u_char diff = lp->reqlink - lp->actlink;
-
- xp->sc_link->opennings += diff;
- lp->actlink += diff;
- wakeup ((caddr_t) xp->sc_link);
- if (DEBUG_FLAGS & DEBUG_TAGS)
- printf ("%s: actlink: diff=%d, new=%d, req=%d\n",
- ncr_name(np), diff, lp->actlink, lp->reqlink);
- };
-#endif
-}
-
-/*==========================================================
-**
-**
-** Build Scatter Gather Block
-**
-**
-**==========================================================
-**
-** The transfer area may be scattered among
-** several non adjacent physical pages.
-**
-** We may use MAX_SCATTER blocks.
-**
-**----------------------------------------------------------
-*/
-
-static int ncr_scatter
- (struct dsb* phys, vm_offset_t vaddr, vm_size_t datalen)
-{
- u_long paddr, pnext;
-
- u_short segment = 0;
- u_long segsize, segaddr;
- u_long size, csize = 0;
- u_long chunk = MAX_SIZE;
- int free;
-
- bzero (&phys->data, sizeof (phys->data));
- if (!datalen) return (0);
-
- paddr = vtophys (vaddr);
-
- /*
- ** insert extra break points at a distance of chunk.
- ** We try to reduce the number of interrupts due to
- ** unexpected phase changes due to disconnects.
- ** A typical harddisk may disconnect before ANY block.
- ** If we want to avoid unexpected phase changes at all
- ** we have to use a break point every 512 bytes.
- ** Of course the number of scatter/gather blocks is
- ** limited.
- */
-
- free = MAX_SCATTER - 1;
-
- if (vaddr & (NBPG-1)) free -= datalen / NBPG;
-
- if (free>1)
- while ((chunk * free >= 2 * datalen) && (chunk>=1024))
- chunk /= 2;
-
- if(DEBUG_FLAGS & DEBUG_SCATTER)
- printf("ncr?:\tscattering virtual=0x%x size=%d chunk=%d.\n",
- (unsigned) vaddr, (unsigned) datalen, (unsigned) chunk);
-
- /*
- ** Build data descriptors.
- */
- while (datalen && (segment < MAX_SCATTER)) {
-
- /*
- ** this segment is empty
- */
- segsize = 0;
- segaddr = paddr;
- pnext = paddr;
-
- if (!csize) csize = chunk;
-
- while ((datalen) && (paddr == pnext) && (csize)) {
-
- /*
- ** continue this segment
- */
- pnext = (paddr & (~(NBPG - 1))) + NBPG;
-
- /*
- ** Compute max size
- */
-
- size = pnext - paddr; /* page size */
- if (size > datalen) size = datalen; /* data size */
- if (size > csize ) size = csize ; /* chunksize */
-
- segsize += size;
- vaddr += size;
- csize -= size;
- datalen -= size;
- paddr = vtophys (vaddr);
- };
-
- if(DEBUG_FLAGS & DEBUG_SCATTER)
- printf ("\tseg #%d addr=%x size=%d (rest=%d).\n",
- segment,
- (unsigned) segaddr,
- (unsigned) segsize,
- (unsigned) datalen);
-
- phys->data[segment].addr = segaddr;
- phys->data[segment].size = segsize;
- segment++;
- }
-
- if (datalen) {
- printf("ncr?: scatter/gather failed (residue=%d).\n",
- (unsigned) datalen);
- return (-1);
- };
-
- return (segment);
-}
-
-/*==========================================================
-**
-**
-** Test the pci bus snoop logic :-(
-**
-** Has to be called with interrupts disabled.
-**
-**
-**==========================================================
-*/
-
-static int ncr_snooptest (struct ncb* np)
-{
- u_long ncr_rd, ncr_wr, ncr_bk, host_rd, host_wr, pc, err=0;
- /*
- ** init
- */
- pc = vtophys (&np->script->snooptest);
- host_wr = 1;
- ncr_wr = 2;
- /*
- ** Set memory and register.
- */
- ncr_cache = host_wr;
- OUTL (nc_temp, ncr_wr);
- /*
- ** Start script (exchange values)
- */
- OUTL (nc_dsp, pc);
- /*
- ** Wait 'til done
- */
- while (!(INB(nc_istat) & (INTF|SIP|DIP)));
- /*
- ** Read memory and register.
- */
- host_rd = ncr_cache;
- ncr_rd = INL (nc_scratcha);
- ncr_bk = INL (nc_temp);
- /*
- ** Reset ncr chip
- */
- OUTB (nc_istat, SRST);
- OUTB (nc_istat, 0 );
- /*
- ** Show results.
- */
- if (host_wr != ncr_rd) {
- printf ("CACHE TEST FAILED: host wrote %d, ncr read %d.\n",
- (int) host_wr, (int) ncr_rd);
- err |= 1;
- };
- if (host_rd != ncr_wr) {
- printf ("CACHE TEST FAILED: ncr wrote %d, host read %d.\n",
- (int) ncr_wr, (int) host_rd);
- err |= 2;
- };
- if (ncr_bk != ncr_wr) {
- printf ("CACHE TEST FAILED: ncr wrote %d, read back %d.\n",
- (int) ncr_wr, (int) ncr_bk);
- err |= 4;
- };
- return (err);
-}
-
-/*==========================================================
-**
-**
-** Profiling the drivers and targets performance.
-**
-**
-**==========================================================
-*/
-
-/*
-** Compute the difference in milliseconds.
-**/
-
-static int ncr_delta (struct timeval * from, struct timeval * to)
-{
- if (!from->tv_sec) return (-1);
- if (!to ->tv_sec) return (-2);
- return ( (to->tv_sec - from->tv_sec - 2)*1000+
- +(to->tv_usec - from->tv_usec + 2000000)/1000);
-}
-
-#define PROFILE cp->phys.header.stamp
-static void ncb_profile (ncb_p np, ccb_p cp)
-{
- int co, da, st, en, di, se, post,work,disc;
- u_long diff;
-
- PROFILE.end = time;
-
- st = ncr_delta (&PROFILE.start,&PROFILE.status);
- if (st<0) return; /* status not reached */
-
- da = ncr_delta (&PROFILE.start,&PROFILE.data);
- if (da<0) return; /* No data transfer phase */
-
- co = ncr_delta (&PROFILE.start,&PROFILE.command);
- if (co<0) return; /* command not executed */
-
- en = ncr_delta (&PROFILE.start,&PROFILE.end),
- di = ncr_delta (&PROFILE.start,&PROFILE.disconnect),
- se = ncr_delta (&PROFILE.start,&PROFILE.select);
- post = en - st;
-
- /*
- ** @PROFILE@ Disconnect time invalid if multiple disconnects
- */
-
- if (di>=0) disc = se-di; else disc = 0;
-
- work = (st - co) - disc;
-
- diff = (np->disc_phys - np->disc_ref) & 0xff;
- np->disc_ref += diff;
-
- np->profile.num_trans += 1;
- if (cp->xfer)
- np->profile.num_bytes += cp->xfer->datalen;
- np->profile.num_disc += diff;
- np->profile.ms_setup += co;
- np->profile.ms_data += work;
- np->profile.ms_disc += disc;
- np->profile.ms_post += post;
-}
-#undef PROFILE
-
-/*==========================================================
-**
-**
-** Device lookup.
-**
-** @GENSCSI@ should be integrated to scsiconf.c
-**
-**
-**==========================================================
-*/
-
-#ifndef NEW_SCSICONF
-
-struct table_entry {
- char * manufacturer;
- char * model;
- char * version;
- u_long info;
-};
-
-static struct table_entry device_tab[] =
-{
- {"SONY", "SDT-5000", "3.17", QUIRK_NOMSG},
- {"WangDAT", "Model 2600", "01.7", QUIRK_NOMSG},
- {"WangDAT", "Model 3200", "02.2", QUIRK_NOMSG},
- {"WangDAT", "Model 1300", "02.4", QUIRK_NOMSG},
- {"", "", "", 0} /* catch all: must be last entry. */
-};
-
-static u_long ncr_lookup(char * id)
-{
- struct table_entry * p = device_tab;
- char *d, *r, c;
-
- for (;;p++) {
-
- d = id+8;
- r = p->manufacturer;
- while ((c=*r++)) if (c!=*d++) break;
- if (c) continue;
-
- d = id+16;
- r = p->model;
- while ((c=*r++)) if (c!=*d++) break;
- if (c) continue;
-
- d = id+32;
- r = p->version;
- while ((c=*r++)) if (c!=*d++) break;
- if (c) continue;
-
- return (p->info);
- }
-}
-#endif
-
-/*==========================================================
-**
-** Determine the ncr's clock frequency.
-** This is important for the negotiation
-** of the synchronous transfer rate.
-**
-**==========================================================
-**
-** Note: we have to return the correct value.
-** THERE IS NO SAVE DEFAULT VALUE.
-**
-** We assume that all NCR based boards are delivered
-** with a 40Mhz clock. Because we have to divide
-** by an integer value greater than 3, only clock
-** frequencies of 40Mhz (/4) or 50MHz (/5) permit
-** the FAST-SCSI rate of 10MHz.
-**
-**----------------------------------------------------------
-*/
-
-#ifndef NCR_CLOCK
-# define NCR_CLOCK 40
-#endif /* NCR_CLOCK */
-
-
-static void ncr_getclock (ncb_p np)
-{
- u_char tbl[5] = {6,2,3,4,6};
- u_char f;
- u_char ns_clock = (1000/NCR_CLOCK);
-
- /*
- ** Compute the best value for scntl3.
- */
-
- f = (2 * MIN_SYNC_PD - 1) / ns_clock;
- if (!f ) f=1;
- if (f>4) f=4;
- np -> ns_sync = (ns_clock * tbl[f]) / 2;
- np -> rv_scntl3 = f<<4;
-
- f = (2 * MIN_ASYNC_PD - 1) / ns_clock;
- if (!f ) f=1;
- if (f>4) f=4;
- np -> ns_async = (ns_clock * tbl[f]) / 2;
- np -> rv_scntl3 |= f;
- if (DEBUG_FLAGS & DEBUG_TIMING)
- printf ("%s: sclk=%d async=%d sync=%d (ns) scntl3=0x%x\n",
- ncr_name (np), ns_clock, np->ns_async, np->ns_sync, np->rv_scntl3);
-}
-
-/*=========================================================================*/
-#endif /* KERNEL */
-
-
diff --git a/sys/i386/pci/ncr_reg.h b/sys/i386/pci/ncr_reg.h
deleted file mode 100644
index 1d2b7da..0000000
--- a/sys/i386/pci/ncr_reg.h
+++ /dev/null
@@ -1,547 +0,0 @@
-/**************************************************************************
-**
-** $Id: ncr_reg.h,v 2.1 94/09/16 08:01:34 wolf Rel $
-**
-** Device driver for the NCR 53C810 PCI-SCSI-Controller.
-**
-** 386bsd / FreeBSD / NetBSD
-**
-**-------------------------------------------------------------------------
-**
-** Written for 386bsd and FreeBSD by
-** wolf@dentaro.gun.de Wolfgang Stanglmeier
-** se@mi.Uni-Koeln.de Stefan Esser
-**
-** Ported to NetBSD by
-** mycroft@gnu.ai.mit.edu
-**
-**-------------------------------------------------------------------------
-**
-** Copyright (c) 1994 Wolfgang Stanglmeier. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**-------------------------------------------------------------------------
-*/
-
-#ifndef __NCR_REG_H__
-#define __NCR_REG_H__
-
-
-/*-----------------------------------------------------------------
-**
-** The ncr 53c810 register structure.
-**
-**-----------------------------------------------------------------
-*/
-
-struct ncr_reg {
-/*00*/ u_char nc_scntl0; /* full arb., ena parity, par->ATN */
-
-/*01*/ u_char nc_scntl1; /* no reset */
- #define ISCON 0x10 /* connected to scsi */
- #define CRST 0x08 /* force reset */
-
-/*02*/ u_char nc_scntl2; /* no disconnect expected */
- #define SDU 0x80 /* cmd: disconnect will raise error */
- #define CHM 0x40 /* sta: chained mode */
- #define WSS 0x08 /* sta: wide scsi send [W]*/
- #define WSR 0x01 /* sta: wide scsi received [W]*/
-
-/*03*/ u_char nc_scntl3; /* cnf system clock dependent */
- #define EWS 0x08 /* cmd: enable wide scsi [W]*/
-
-/*04*/ u_char nc_scid; /* cnf host adapter scsi address */
- #define RRE 0x40 /* r/w:e enable response to resel. */
- #define SRE 0x20 /* r/w:e enable response to select */
-
-/*05*/ u_char nc_sxfer; /* ### Sync speed and count */
-
-/*06*/ u_char nc_sdid; /* ### Destination-ID */
-
-/*07*/ u_char nc_gpreg; /* ??? IO-Pins */
-
-/*08*/ u_char nc_sfbr; /* ### First byte in phase */
-
-/*09*/ u_char nc_socl;
- #define CREQ 0x80 /* r/w: SCSI-REQ */
- #define CACK 0x40 /* r/w: SCSI-ACK */
- #define CBSY 0x20 /* r/w: SCSI-BSY */
- #define CSEL 0x10 /* r/w: SCSI-SEL */
- #define CATN 0x08 /* r/w: SCSI-ATN */
- #define CMSG 0x04 /* r/w: SCSI-MSG */
- #define CC_D 0x02 /* r/w: SCSI-C_D */
- #define CI_O 0x01 /* r/w: SCSI-I_O */
-
-/*0a*/ u_char nc_ssid;
-
-/*0b*/ u_char nc_sbcl;
-
-/*0c*/ u_char nc_dstat;
- #define DFE 0x80 /* sta: dma fifo empty */
- #define MDPE 0x40 /* int: master data parity error */
- #define BF 0x20 /* int: script: bus fault */
- #define ABRT 0x10 /* int: script: command aborted */
- #define SSI 0x08 /* int: script: single step */
- #define SIR 0x04 /* int: script: interrupt instruct. */
- #define IID 0x01 /* int: script: illegal instruct. */
-
-/*0d*/ u_char nc_sstat0;
- #define ILF 0x80 /* sta: data in SIDL register lsb */
- #define ORF 0x40 /* sta: data in SODR register lsb */
- #define OLF 0x20 /* sta: data in SODL register lsb */
- #define AIP 0x10 /* sta: arbitration in progress */
- #define LOA 0x08 /* sta: arbitration lost */
- #define WOA 0x04 /* sta: arbitration won */
- #define IRST 0x02 /* sta: scsi reset signal */
- #define SDP 0x01 /* sta: scsi parity signal */
-
-/*0e*/ u_char nc_sstat1;
- #define FF3210 0xf0 /* sta: bytes in the scsi fifo */
-
-/*0f*/ u_char nc_sstat2;
- #define ILF1 0x80 /* sta: data in SIDL register msb[W]*/
- #define ORF1 0x40 /* sta: data in SODR register msb[W]*/
- #define OLF1 0x20 /* sta: data in SODL register msb[W]*/
-
-/*10*/ u_long nc_dsa; /* --> Base page */
-
-/*14*/ u_char nc_istat; /* --> Main Command and status */
- #define CABRT 0x80 /* cmd: abort current operation */
- #define SRST 0x40 /* mod: reset chip */
- #define SIGP 0x20 /* r/w: message from host to ncr */
- #define SEM 0x10 /* r/w: message between host + ncr */
- #define CON 0x08 /* sta: connected to scsi */
- #define INTF 0x04 /* sta: int on the fly (reset by wr)*/
- #define SIP 0x02 /* sta: scsi-interupt */
- #define DIP 0x01 /* sta: host/script interupt */
-
-/*15*/ u_char nc_15_;
-/*16*/ u_char nc_16_;
-/*17*/ u_char nc_17_;
-
-/*18*/ u_char nc_ctest0;
-/*19*/ u_char nc_ctest1;
-
-/*1a*/ u_char nc_ctest2;
- #define CSIGP 0x40
-
-/*1b*/ u_char nc_ctest3;
- #define CLF 0x04 /* clear scsi fifo */
-
-/*1c*/ u_long nc_temp; /* ### Temporary stack */
-
-/*20*/ u_char nc_dfifo;
-/*21*/ u_char nc_ctest4;
-/*22*/ u_char nc_ctest5;
-/*23*/ u_char nc_ctest6;
-
-/*24*/ u_long nc_dbc; /* ### Byte count and command */
-/*28*/ u_long nc_dnad; /* ### Next command register */
-/*2c*/ u_long nc_dsp; /* --> Script Pointer */
-/*30*/ u_long nc_dsps; /* --> Script pointer save/opcode#2 */
-/*34*/ u_long nc_scratcha; /* ??? Temporary register a */
-
-/*38*/ u_char nc_dmode;
-/*39*/ u_char nc_dien;
-/*3a*/ u_char nc_dwt;
-
-/*3b*/ u_char nc_dcntl; /* --> Script execution control */
- #define SSM 0x10 /* mod: single step mode */
- #define STD 0x04 /* cmd: start dma mode */
- #define NOCOM 0x01 /* cmd: protect sfbr while reselect */
-
-/*3c*/ u_long nc_adder;
-
-/*40*/ u_short nc_sien; /* -->: interupt enable */
-/*42*/ u_short nc_sist; /* <--: interupt status */
- #define STO 0x0400/* sta: timeout (select) */
- #define GEN 0x0200/* sta: timeout (general) */
- #define HTH 0x0100/* sta: timeout (handshake) */
- #define MA 0x80 /* sta: phase mismatch */
- #define CMP 0x40 /* sta: arbitration complete */
- #define SEL 0x20 /* sta: selected by another device */
- #define RSL 0x10 /* sta: reselected by another device*/
- #define SGE 0x08 /* sta: gross error (over/underflow)*/
- #define UDC 0x04 /* sta: unexpected disconnect */
- #define RST 0x02 /* sta: scsi bus reset detected */
- #define PAR 0x01 /* sta: scsi parity error */
-
-/*44*/ u_char nc_slpar;
-/*45*/ u_char nc_swide;
-/*46*/ u_char nc_macntl;
-/*47*/ u_char nc_gpcntl;
-/*48*/ u_char nc_stime0; /* cmd: timeout for select&handshake*/
-/*49*/ u_char nc_stime1; /* cmd: timeout user defined */
-/*4a*/ u_short nc_respid; /* sta: Reselect-IDs */
-
-/*4c*/ u_char nc_stest0;
-
-/*4d*/ u_char nc_stest1;
-
-/*4e*/ u_char nc_stest2;
- #define ROF 0x40 /* reset scsi offset (after gross error!) */
- #define EXT 0x02 /* extended filtering */
-
-/*4f*/ u_char nc_stest3;
- #define TE 0x80 /* c: tolerAnt enable */
- #define CSF 0x02 /* c: clear scsi fifo */
-
-/*50*/ u_short nc_sidl; /* Lowlevel: latched from scsi data */
-/*52*/ u_short nc_52_;
-/*54*/ u_short nc_sodl; /* Lowlevel: data out to scsi data */
-/*56*/ u_short nc_56_;
-/*58*/ u_short nc_sbdl; /* Lowlevel: data from scsi data */
-/*5a*/ u_short nc_5a_;
-/*5c*/ u_char nc_scr0; /* Working register B */
-/*5d*/ u_char nc_scr1; /* */
-/*5e*/ u_char nc_scr2; /* */
-/*5f*/ u_char nc_scr3; /* */
-/*60*/
-};
-
-/*-----------------------------------------------------------
-**
-** Utility macros for the script.
-**
-**-----------------------------------------------------------
-*/
-
-#define REGJ(p,r) (offsetof(struct ncr_reg, p ## r))
-#define REG(r) REGJ (nc_, r)
-
-#ifndef TARGET_MODE
-#define TARGET_MODE 0
-#endif
-
-typedef unsigned long ncrcmd;
-
-/*-----------------------------------------------------------
-**
-** SCSI phases
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_DATA_OUT 0x00000000
-#define SCR_DATA_IN 0x01000000
-#define SCR_COMMAND 0x02000000
-#define SCR_STATUS 0x03000000
-#define SCR_ILG_OUT 0x04000000
-#define SCR_ILG_IN 0x05000000
-#define SCR_MSG_OUT 0x06000000
-#define SCR_MSG_IN 0x07000000
-
-/*-----------------------------------------------------------
-**
-** Data transfer via SCSI.
-**
-**-----------------------------------------------------------
-**
-** MOVE_ABS (LEN)
-** <<start address>>
-**
-** MOVE_IND (LEN)
-** <<dnad_offset>>
-**
-** MOVE_TBL
-** <<dnad_offset>>
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_MOVE_ABS(l) ((0x08000000 ^ (TARGET_MODE << 1ul)) | (l))
-#define SCR_MOVE_IND(l) ((0x28000000 ^ (TARGET_MODE << 1ul)) | (l))
-#define SCR_MOVE_TBL (0x18000000 ^ (TARGET_MODE << 1ul))
-
-struct scr_tblmove {
- u_long size;
- u_long addr;
-};
-
-/*-----------------------------------------------------------
-**
-** Selection
-**
-**-----------------------------------------------------------
-**
-** SEL_ABS | SCR_ID (0..7) [ | REL_JMP]
-** <<alternate_address>>
-**
-** SEL_TBL | << dnad_offset>> [ | REL_JMP]
-** <<alternate_address>>
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_SEL_ABS 0x40000000
-#define SCR_SEL_ABS_ATN 0x41000000
-#define SCR_SEL_TBL 0x42000000
-#define SCR_SEL_TBL_ATN 0x43000000
-
-struct scr_tblsel {
- u_char sel_0;
- u_char sel_sxfer;
- u_char sel_id;
- u_char sel_scntl3;
-};
-
-#define SCR_JMP_REL 0x04000000
-#define SCR_ID(id) (((u_long)(id)) << 16)
-
-/*-----------------------------------------------------------
-**
-** Waiting for Disconnect or Reselect
-**
-**-----------------------------------------------------------
-**
-** WAIT_DISC
-** dummy: <<alternate_address>>
-**
-** WAIT_RESEL
-** <<alternate_address>>
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_WAIT_DISC 0x48000000
-#define SCR_WAIT_RESEL 0x50000000
-
-/*-----------------------------------------------------------
-**
-** Bit Set / Reset
-**
-**-----------------------------------------------------------
-**
-** SET (flags {|.. })
-**
-** CLR (flags {|.. })
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_SET(f) (0x58000000 | (f))
-#define SCR_CLR(f) (0x60000000 | (f))
-
-#define SCR_CARRY 0x00000400
-#define SCR_TRG 0x00000200
-#define SCR_ACK 0x00000040
-#define SCR_ATN 0x00000008
-
-
-
-
-/*-----------------------------------------------------------
-**
-** Memory to memory move
-**
-**-----------------------------------------------------------
-**
-** COPY (bytecount)
-** << source_address >>
-** << destination_address >>
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_COPY(n) (0xc0000000 | (n))
-
-/*-----------------------------------------------------------
-**
-** Register move and binary operations
-**
-**-----------------------------------------------------------
-**
-** SFBR_REG (reg, op, data) reg = SFBR op data
-** << 0 >>
-**
-** REG_SFBR (reg, op, data) SFBR = reg op data
-** << 0 >>
-**
-** REG_REG (reg, op, data) reg = reg op data
-** << 0 >>
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_REG_OFS(ofs) ((ofs) << 16ul)
-
-#define SCR_SFBR_REG(reg,op,data) \
- (0x68000000 | (SCR_REG_OFS(REG(reg))) | (op) | ((data)<<8ul))
-
-#define SCR_REG_SFBR(reg,op,data) \
- (0x70000000 | (SCR_REG_OFS(REG(reg))) | (op) | ((data)<<8ul))
-
-#define SCR_REG_REG(reg,op,data) \
- (0x78000000 | (SCR_REG_OFS(REG(reg))) | (op) | ((data)<<8ul))
-
-
-#define SCR_LOAD 0x00000000
-#define SCR_SHL 0x01000000
-#define SCR_OR 0x02000000
-#define SCR_XOR 0x03000000
-#define SCR_AND 0x04000000
-#define SCR_SHR 0x05000000
-#define SCR_ADD 0x06000000
-#define SCR_ADDC 0x07000000
-
-/*-----------------------------------------------------------
-**
-** FROM_REG (reg) reg = SFBR
-** << 0 >>
-**
-** TO_REG (reg) SFBR = reg
-** << 0 >>
-**
-** LOAD_REG (reg, data) reg = <data>
-** << 0 >>
-**
-** LOAD_SFBR(data) SFBR = <data>
-** << 0 >>
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_FROM_REG(reg) \
- SCR_REG_SFBR(reg,SCR_OR,0)
-
-#define SCR_TO_REG(reg) \
- SCR_SFBR_REG(reg,SCR_OR,0)
-
-#define SCR_LOAD_REG(reg,data) \
- SCR_REG_REG(reg,SCR_LOAD,data)
-
-#define SCR_LOAD_SFBR(data) \
- (SCR_REG_SFBR (gpreg, SCR_LOAD, data))
-
-/*-----------------------------------------------------------
-**
-** Waiting for Disconnect or Reselect
-**
-**-----------------------------------------------------------
-**
-** JUMP [ | IFTRUE/IFFALSE ( ... ) ]
-** <<address>>
-**
-** JUMPR [ | IFTRUE/IFFALSE ( ... ) ]
-** <<distance>>
-**
-** CALL [ | IFTRUE/IFFALSE ( ... ) ]
-** <<address>>
-**
-** CALLR [ | IFTRUE/IFFALSE ( ... ) ]
-** <<distance>>
-**
-** RETURN [ | IFTRUE/IFFALSE ( ... ) ]
-** <<dummy>>
-**
-** INT [ | IFTRUE/IFFALSE ( ... ) ]
-** <<ident>>
-**
-** INT_FLY [ | IFTRUE/IFFALSE ( ... ) ]
-** <<ident>>
-**
-** Conditions:
-** WHEN (phase)
-** IF (phase)
-** CARRY
-** DATA (data, mask)
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_JUMP 0x80080000
-#define SCR_JUMPR 0x80880000
-#define SCR_CALL 0x88080000
-#define SCR_CALLR 0x88880000
-#define SCR_RETURN 0x90080000
-#define SCR_INT 0x98080000
-#define SCR_INT_FLY 0x98180000
-
-#define IFFALSE(arg) (0x00080000 | (arg))
-#define IFTRUE(arg) (0x00000000 | (arg))
-
-#define WHEN(phase) (0x00030000 | (phase))
-#define IF(phase) (0x00020000 | (phase))
-
-#define DATA(D) (0x00040000 | ((D) & 0xff))
-#define MASK(D,M) (0x00040000 | (((M ^ 0xff) & 0xff) << 8ul)|((D) & 0xff))
-
-#define CARRYSET (0x00200000)
-
-/*-----------------------------------------------------------
-**
-** SCSI constants.
-**
-**-----------------------------------------------------------
-*/
-
-/*
-** Messages
-*/
-
-#define M_COMPLETE (0x00)
-#define M_EXTENDED (0x01)
-#define M_SAVE_DP (0x02)
-#define M_RESTORE_DP (0x03)
-#define M_DISCONNECT (0x04)
-#define M_ID_ERROR (0x05)
-#define M_ABORT (0x06)
-#define M_REJECT (0x07)
-#define M_NOOP (0x08)
-#define M_PARITY (0x09)
-#define M_LCOMPLETE (0x0a)
-#define M_FCOMPLETE (0x0b)
-#define M_RESET (0x0c)
-#define M_ABORT_TAG (0x0d)
-#define M_CLEAR_QUEUE (0x0e)
-#define M_INIT_REC (0x0f)
-#define M_REL_REC (0x10)
-#define M_TERMINATE (0x11)
-#define M_SIMPLE_TAG (0x20)
-#define M_HEAD_TAG (0x21)
-#define M_ORDERED_TAG (0x22)
-#define M_IGN_RESIDUE (0x23)
-#define M_IDENTIFY (0x80)
-
-#define M_X_MODIFY_DP (0x00)
-#define M_X_SYNC_REQ (0x01)
-#define M_X_WIDE_REQ (0x03)
-
-/*
-** Status
-*/
-
-#define S_GOOD (0x00)
-#define S_CHECK_COND (0x02)
-#define S_COND_MET (0x04)
-#define S_BUSY (0x08)
-#define S_INT (0x10)
-#define S_INT_COND_MET (0x14)
-#define S_CONFLICT (0x18)
-#define S_TERMINATED (0x20)
-#define S_QUEUE_FULL (0x28)
-#define S_ILLEGAL (0xff)
-#define S_SENSE (0x80)
-
-#endif /*__NCR_REG_H__*/
diff --git a/sys/i386/pci/ncrcontrol.c b/sys/i386/pci/ncrcontrol.c
deleted file mode 100644
index 5adecbc..0000000
--- a/sys/i386/pci/ncrcontrol.c
+++ /dev/null
@@ -1,1630 +0,0 @@
-/**************************************************************************
-**
-** $Id: ncrcontrol.c,v 2.3 94/10/09 21:10:08 wolf Oct11 $
-**
-** Utility for NCR 53C810 device driver.
-**
-** 386bsd / FreeBSD / NetBSD
-**
-**-------------------------------------------------------------------------
-**
-** Written for 386bsd and FreeBSD by
-** wolf@dentaro.gun.de Wolfgang Stanglmeier
-** se@mi.Uni-Koeln.de Stefan Esser
-**
-** Ported to NetBSD by
-** mycroft@gnu.ai.mit.edu
-**
-**-------------------------------------------------------------------------
-**
-** Copyright (c) 1994 Wolfgang Stanglmeier. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-***************************************************************************
-*/
-
-#include <sys/file.h>
-#include <sys/types.h>
-#ifdef __NetBSD__
-#include <sys/device.h>
-#endif
-#include <nlist.h>
-#include <stdio.h>
-#include <errno.h>
-#include <paths.h>
-#include <limits.h>
-#include <kvm.h>
-#include <i386/pci/ncr.c>
-
-/*
-** used external functions
-*/
-
-#if defined(__NetBSD__) || (__FreeBSD__ >= 2)
-kvm_t *kvm;
-#define KVM_NLIST(n) (kvm_nlist(kvm, (n)) >= 0)
-#define KVM_READ(o, p, l) (kvm_read(kvm, (o), (void*)(p), (l)) == (l))
-#else
-#define KVM_NLIST(n) (kvm_nlist((n)) >= 0)
-#define KVM_READ(o, p, l) (kvm_read((void*)(o), (p), (l)) == (l))
-#endif
-
-extern void exit();
-extern char* strerror (int num);
-
-/*===========================================================
-**
-** Global variables.
-**
-**===========================================================
-*/
-
-char *prog;
-u_long verbose;
-u_long wizard;
-
-
-
-struct nlist nl[] = {
-#define N_NCR_VERSION 0
- { "_ncr_version" },
-#ifdef __NetBSD__
-#define N_NCRCD 1
- { "_ncrcd" },
-#else
-#define N_NCRP 1
- { "_ncrp" },
-#define N_NNCR 2
- { "_nncr" },
-#endif
- { 0 }
-};
-
-
-char *vmunix = _PATH_UNIX;
-char *kmemf = NULL;
-
-int kvm_isopen;
-
-u_long ncr_base;
-u_long lcb_base;
-u_long ccb_base;
-
-u_long ncr_unit;
-#ifdef __NetBSD__
-struct cfdriver ncrcd;
-#else
-u_long ncr_units;
-#endif
-
-struct ncb ncr;
-struct lcb lcb;
-struct ccb ccb;
-
-u_long target_mask;
-u_long global_lun_mask;
-u_long lun_mask;
-u_long interval;
-
-/*===========================================================
-**
-** Accessing kernel memory via kvm library.
-**
-**===========================================================
-*/
-
-read_ccb(u_long base)
-{
- ccb_base = base;
- if (!KVM_READ (
- base,
- &ccb,
- sizeof (struct ccb))) {
- fprintf (stderr, "%s: bad kvm read at %x.\n", prog, base);
- exit (1);
- };
-}
-
-read_lcb(u_long base)
-{
- lcb_base = base;
- if (!KVM_READ (
- base,
- &lcb,
- sizeof (struct lcb))) {
- fprintf (stderr, "%s: bad kvm read at %x.\n", prog, base);
- exit (1);
- };
-}
-
-read_ncr()
-{
- if (!KVM_READ (
- ncr_base,
- &ncr,
- sizeof (ncr))) {
- fprintf (stderr, "%s: bad kvm read at %x.\n", prog, ncr_base);
- exit (1);
- };
-}
-
-void open_kvm(int flags)
-{
- int i;
- u_long kernel_version;
-#if defined(__NetBSD__) || (__FreeBSD__ >= 2)
- char errbuf[_POSIX2_LINE_MAX];
-#endif
-
- if (kvm_isopen) return;
-
-#if defined(__NetBSD__) || (__FreeBSD__ >= 2)
- kvm = kvm_openfiles(vmunix, kmemf, NULL, flags, errbuf);
- if (kvm == NULL) {
- fprintf(stderr, "%s: kvm_openfiles: %s\n", prog, errbuf);
- exit(1);
- }
-#else
- if (kvm_openfiles(vmunix, kmemf, NULL) == -1) {
- fprintf(stderr, "%s: kvm_openfiles: %s\n", prog, kvm_geterr());
- exit(1);
- }
-#endif
-
- if (!KVM_NLIST(nl)) {
- fprintf(stderr, "%s: no symbols in \"%s\".\n",
- prog, vmunix);
- exit (2);
- };
-
- for (i=0; nl[i].n_name; i++)
- if (nl[i].n_type == 0) {
- fprintf(stderr, "%s: no symbol \"%s\" in \"%s\".\n",
- prog, nl[i].n_name, vmunix);
- exit(1);
- }
-
- if (!KVM_READ (
- nl[N_NCR_VERSION].n_value,
- &kernel_version,
- sizeof (kernel_version))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
-
- if (kernel_version != ncr_version){
- fprintf (stderr, "%s: incompatible with kernel. Rebuild!\n",
- prog);
- exit (1);
- };
-
-#ifdef __NetBSD__
-
- if (!KVM_READ (
- nl[N_NCRCD].n_value,
- &ncrcd,
- sizeof (ncrcd))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
-
- if (ncr_unit >= ncrcd.cd_ndevs){
- fprintf (stderr, "%s: bad unit number (valid range: 0-%d).\n",
- prog, ncrcd.cd_ndevs-1);
- exit (1);
- };
-
- if (!KVM_READ (
- ncrcd.cd_devs+4*ncr_unit,
- &ncr_base,
- sizeof (ncr_base))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
-
- if (!ncr_base) {
- fprintf (stderr,
- "%s: control structure not allocated (not found in autoconfig?)\n", prog);
- exit (1);
- };
-
-#else /* !__NetBSD__ */
-
- if (!KVM_READ (
- nl[N_NNCR].n_value,
- &ncr_units,
- sizeof (ncr_units))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
-
- if (ncr_unit >= ncr_units){
- fprintf (stderr, "%s: bad unit number (valid range: 0-%d).\n",
- prog, ncr_units-1);
- exit (1);
- };
-
- if (!KVM_READ (
- nl[N_NCRP].n_value+4*ncr_unit,
- &ncr_base,
- sizeof (ncr_base))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
-
- if (!ncr_base) {
- fprintf (stderr,
- "%s: control structure not allocated (not found in autoconfig?)\n", prog);
- exit (1);
- };
-
-#endif /* !__NetBSD__ */
-
- read_ncr();
-
- if (!ncr.vaddr) {
- fprintf (stderr,
- "%s: 53c810 not mapped (not found in autoconfig?)\n", prog);
- exit (1);
- };
-
- kvm_isopen = 1;
-}
-
-
-
-
-void set_target_mask(void)
-{
- int t;
- if (target_mask) return;
- for (t=0; t<MAX_TARGET; t++)
- if (ncr.target[t].jump_tcb.l_cmd) target_mask |= (1<<t);
-}
-
-void set_lun_mask(struct tcb * tp)
-{
- int l;
- lun_mask = global_lun_mask;
- if (lun_mask) return;
- for (l=0; l<MAX_LUN; l++)
- if (tp->lp[l]) lun_mask |= (1<<l);
-}
-
-void printc (u_char*p, int l)
-{
- for (;l>0;l--) {
- char c=*p++;
- printf ("%c", c?c:'_');
- }
-}
-
-/*================================================================
-**
-**
-** system info
-**
-**
-**================================================================
-*/
-
-do_info(void)
-{
- int t,l,i,d,f,fl;
- struct tcb * tip;
- open_kvm(O_RDONLY);
-
- if (verbose>=3)
- printf ("ncr unit=%d data@%x register@%x (pci@%x)\n\n",
- ncr_unit, ncr_base, ncr.vaddr, ncr.paddr);
-
- set_target_mask();
-
- printf ("T:L Vendor Device Rev Speed Max Wide Tags\n");
- for (t=0; t<MAX_TARGET;t++) {
- if (!((target_mask>>t)&1)) continue;
- tip = &ncr.target[t];
-
- set_lun_mask(tip);
- if (!lun_mask) lun_mask=1;
- fl=1;
-
- for (l=0; l<MAX_LUN; l++) {
- if (!((lun_mask>>l)&1)) continue;
-
- printf ("%d:%d ", t, l);
-
- if (!tip->jump_tcb.l_cmd) break;
-
- if (fl) {
- fl=0;
- printc (&tip->inqdata[ 8], 8);printf(" ");
- printc (&tip->inqdata[16],16);printf(" ");
- printc (&tip->inqdata[32], 4);printf(" ");
-
- if (tip->period==0xffff) {
- printf ("asyn");
- } else if (tip->period) {
- printf ("%4.1f", 1000.0 / tip->period);
- } else {
- printf (" ?");
- }
-
- printf (" ");
-
- if (tip->minsync==255) {
- printf ("asyn");
- } else if (tip->minsync) {
- printf ("%4.1f", 250.0 / tip->minsync);
- } else {
- printf (" ?");
- }
- } else printf (" ");
-
- if (!tip->lp[l]) {
- printf (" no\n");
- continue;
- };
- read_lcb ((u_long) tip->lp[l]);
-
- switch (tip->widedone) {
- case 1:
- printf (" 8");
- break;
- case 2:
- printf (" 16");
- break;
- case 3:
- printf (" 32");
- break;
- default:
- printf (" ?");
- };
-
- if (lcb.usetags)
- printf ("%5d", lcb.actlink);
- else
- printf (" -");
-
- printf ("\n");
-
- };
-
- if (!tip->jump_tcb.l_cmd) {
- printf (" --- no target.\n");
- continue;
- };
-
- if (verbose<1) continue;
-
- for (i=0; i<8; i++) {
- char* (class[10])={
- "disk","tape","printer","processor",
- "worm", "cdrom", "scanner", "optical disk",
- "media changer", "communication device"};
- d = tip->inqdata[i];
- printf ("[%02x]: ",d);
-
- switch (i) {
-
- case 0:
- f = d & 0x1f;
- if (f<10) printf (class[f]);
- else printf ("unknown (%x)", f);
- break;
- case 1:
- f = (d>>7) & 1;
- if (f) printf ("removable media");
- else printf ("fixed media");
- break;
-
- case 2:
- f = d & 7;
- switch (f) {
- case 0: printf ("SCSI-1");
- break;
- case 1: printf ("SCSI-1 with CCS");
- break;
- case 2: printf ("SCSI-2");
- break;
- default:
- printf ("unknown ansi version (%d)",
- f);
- }
- break;
-
- case 3:
- if (d&0xc0) printf ("capabilities:");
- if (d&0x80) printf (" AEN");
- if (d&0x40) printf (" TERMINATE-I/O");
- break;
-
- case 7:
- if (d&0xfb) printf ("capabilities:");
- if (d&0x80) printf (" relative");
- if (d&0x40) printf (" wide32");
- if (d&0x20) printf (" wide");
- if (d&0x10) printf (" synch");
- if (d&0x08) printf (" link");
- if (d&0x02) printf (" tags");
- if (d&0x01) printf (" soft-reset");
- };
- printf ("\n");
- };
- printf ("\n");
- };
- printf ("\n");
-#ifndef __NetBSD__
- if (ncr.imask) {
- u_short v;
- printf ("Interrupt vector is");
- if (ncr.imask & (ncr.imask-1))
- printf (" one of the following:");
- for (v=15;v>0;v--)
- if ((ncr.imask>>v)&1)
- printf (" %d",v);
- printf (".\n\n");
- };
-#endif
-}
-
-/*================================================================
-**
-**
-** profiling
-**
-**
-**================================================================
-*/
-
-do_profile(void)
-{
-#define old backup.profile
-#define new ncr.profile
-
- struct ncb backup;
- struct profile diff;
- int tra,line,t;
-
- open_kvm(O_RDONLY);
-
- set_target_mask();
-
- if (interval<1) interval=1;
- for (;;) {
- /*
- ** Header Line 1
- */
- printf (" total ");
-
- for (t=0; t<MAX_TARGET; t++) {
- if (!((target_mask>>t)&1)) continue;
- printf (" ");
- printc (&ncr.target[t].inqdata[16],8);
- };
-
- printf (" transf. disconn interru");
-
- if (verbose>=1) printf (" ---- ms/transfer ----");
-
- printf ("\n");
-
- /*
- ** Header Line 2
- */
-
- printf ("t/s kb/s ");
-
- for (t=0; t<MAX_TARGET; t++) {
- if (!((target_mask>>t)&1)) continue;
- printf (" t/s kb/s");
- };
-
- printf (" length exp une fly brk");
-
- if (verbose>=1) printf (" total pre post disc");
-
- printf ("\n");
-
- /*
- ** Data
- */
-
- for(line=0;line<20;line++) {
- backup = ncr;
- read_ncr();
- diff.num_trans = new.num_trans - old.num_trans;
- diff.num_bytes = new.num_bytes - old.num_bytes;
- diff.num_fly = new.num_fly - old.num_fly ;
- diff.num_int = new.num_int - old.num_int ;
- diff.ms_setup = new.ms_setup - old.ms_setup;
- diff.ms_data = new.ms_data - old.ms_data;
- diff.ms_disc = new.ms_disc - old.ms_disc;
- diff.ms_post = new.ms_post - old.ms_post;
- diff.num_disc = new.num_disc - old.num_disc;
- diff.num_break = new.num_break - old.num_break;
-
- tra = diff.num_trans;
- if (!tra) tra=1;
-
- printf ("%3.0f %4.0f ",
- (1.0 * diff.num_trans) / interval,
- (1.0 * diff.num_bytes) / (1024*interval));
-
-
- for (t=0; t<MAX_TARGET; t++) {
- if (!((target_mask>>t)&1)) continue;
- printf (" %3.0f %4.0f",
- ((ncr.target[t].transfers-
- backup.target[t].transfers)*1.0)
- /interval,
- ((ncr.target[t].bytes-
- backup.target[t].bytes)*1.0)
- /(1024*interval));
- };
-
- printf ("%7.0f ", (diff.num_bytes*1.0) / tra);
-
- printf (" %4.0f", (1.0*(diff.num_disc-diff.num_break))
- /interval);
-
- printf ("%4.0f", (1.0*diff.num_break)/interval);
-
- printf ("%4.0f", (1.0*diff.num_fly) / interval);
-
- printf ("%4.0f", (1.0*diff.num_int) / interval);
-
- if (verbose >= 1) {
- printf ("%7.1f",
- (diff.ms_disc+diff.ms_data+diff.ms_setup+diff.ms_post)
- * 1.0 / tra);
-
- printf ("%5.1f%5.1f%6.1f",
- 1.0 * diff.ms_setup / tra,
- 1.0 * diff.ms_post / tra,
- 1.0 * diff.ms_disc / tra);
- };
-
- printf ("\n");
- fflush (stdout);
- sleep (interval);
- };
- };
-}
-
-/*================================================================
-**
-**
-** Port access
-**
-**
-**================================================================
-*/
-
-static int kernelwritefile;
-static char* kernelwritefilename = _PATH_KMEM;
-
-void openkernelwritefile(void)
-{
- if (kernelwritefile) return;
-
- kernelwritefile = open (kernelwritefilename, O_WRONLY);
- if (kernelwritefile<3) {
- fprintf (stderr, "%s: %s: %s\n",
- prog, kernelwritefilename, strerror(errno));
- exit (1);
- };
-}
-
-void out (u_char reg, u_char val)
-{
- u_long addr = ncr.vaddr + reg;
- openkernelwritefile();
- if (lseek (kernelwritefile, addr, 0) != addr) {
- fprintf (stderr, "%s: %s: %s\n",
- prog, kernelwritefilename, strerror(errno));
- exit (1);
- }
- if (write (kernelwritefile, &val, 1) < 0) {
- fprintf (stderr, "%s: %s: %s\n",
- prog, kernelwritefilename, strerror(errno));
- exit (1);
- };
-}
-
-u_char in (u_char reg)
-{
- u_char res;
- if (!KVM_READ (
- (ncr.vaddr + reg),
- &res,
- 1)) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- }
- return (res);
-}
-
-/*================================================================
-**
-**
-** Setting of driver parameters
-**
-**
-**================================================================
-*/
-
-void do_set (char * arg)
-{
- struct usrcmd user;
- u_long addr;
- int i;
-
- open_kvm(O_RDWR);
- addr = ncr_base + offsetof (struct ncb, user);
-
- for (i=3; i; i--) {
- if (!KVM_READ (
- (addr),
- &user,
- sizeof (user))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- }
- if (!user.cmd) break;
- sleep (1);
- }
- if (user.cmd) {
- fprintf (stderr, "%s: ncb.user busy.\n", prog);
- exit (1);
- };
-
- user.target = target_mask;
- user.lun = lun_mask;
- user.data = 0;
- user.cmd = 0;
-
- if (!strcmp(arg, "?")) { printf (
-"async: disable synchronous transfers.\n"
-"sync=value: set the maximal synchronous transfer rate (MHz).\n"
-"fast: set FAST SCSI-2.\n"
-"\n"
-"wide=value: set the bus width (0=8bit 1=16bit).\n"
-"\n"
-"tags=value: use this number of tags.\n"
-"orderedtag: use ordered tags only.\n"
-"simpletag: use simple tags only.\n"
-"orderedwrite: use simple tags for read, else ordered tags.\n"
-"\n"
-"debug=value: set debug mode.\n"
-"\n");
- return;
- };
-
- if (!strcmp(arg, "async")) {
- user.data = 255;
- user.cmd = UC_SETSYNC;
- };
-
- if (!strcmp(arg, "fast")) {
- user.data = 25;
- user.cmd = UC_SETSYNC;
- };
-
- if (!strncmp(arg, "sync=", 5)) {
- float f = strtod (arg+5, NULL);
- if (f>=4.0 && f<=10.0) {
- user.data = 250.0 / f;
- user.cmd = UC_SETSYNC;
- };
- };
-
- if (!strncmp(arg, "wide=", 5)) {
- u_char t = strtoul (arg+5, (char**)0, 0);
- if (t<=1) {
- user.data = t;
- user.cmd = UC_SETWIDE;
- };
- };
-
- if (!strncmp(arg, "tags=", 5)) {
- u_char t = strtoul (arg+5, (char**)0, 0);
- if (t<=MAX_TAGS) {
- user.data = t;
- user.cmd = UC_SETTAGS;
- };
- };
-
- if (!strncmp(arg, "flags=", 6)) {
- u_char t = strtoul (arg+6, (char**)0, 0);
- if (t<=0xff) {
- user.data = t;
- user.cmd = UC_SETFLAG;
- };
- };
-
- if (!strncmp(arg, "debug=", 6)) {
- user.data = strtoul (arg+6, (char**)0, 0);
- user.cmd = UC_SETDEBUG;
- };
-
- if (!strcmp(arg, "orderedtag")) {
- user.data = M_ORDERED_TAG;
- user.cmd = UC_SETORDER;
- };
-
- if (!strcmp(arg, "simpletag")) {
- user.data = M_SIMPLE_TAG;
- user.cmd = UC_SETORDER;
- };
-
- if (!strcmp(arg, "orderedwrite")) {
- user.data = 0;
- user.cmd = UC_SETORDER;
- };
-
- if (user.cmd) {
- openkernelwritefile();
-
- if (lseek (kernelwritefile, addr, 0) != addr) {
- fprintf (stderr, "%s: %s: %s\n",
- prog, kernelwritefilename, strerror(errno));
- exit (1);
- }
- if (write (kernelwritefile, &user, sizeof (user)) < 0) {
- fprintf (stderr, "%s: %s: %s\n",
- prog, kernelwritefilename, strerror(errno));
- exit (1);
- }
-
- return;
- };
-
- fprintf (stderr, "%s: do_set \"%s\" not (yet) implemented.\n",
- prog, arg);
-}
-
-/*================================================================
-**
-**
-** D O _ K I L L
-**
-**
-**================================================================
-*/
-
-do_kill(char * arg)
-{
- open_kvm(O_RDWR);
-
- if (!strcmp(arg, "?")) { printf (
-"scsireset: force SCSI bus reset.\n"
-"scriptabort: send an abort cmd to the script processor.\n"
-"scriptstart: start script processind (set SIGP bit).\n"
-"evenparity: force even parity.\n"
-"oddparity: force odd parity.\n"
-"noreselect: disable reselect (force timeouts).\n"
-"doreselect: enable reselect.\n"
-"\n");
- return;
- };
-
- if (!wizard) {
- fprintf (stderr, "%s: You are NOT a wizard!\n", prog);
- exit (2);
- };
-
- if (!strcmp(arg, "scsireset")) {
- out (0x01, 0x08);
- out (0x01, 0x00);
- return;
- };
- if (!strcmp(arg, "scriptabort")) {
- out (0x14, 0x80);
- out (0x14, 0x20);
- return;
- };
- if (!strcmp(arg, "scriptstart")) {
- out (0x14, 0x20);
- return;
- };
- if (!strcmp(arg, "evenparity")) {
- out (0x01, 0x04);
- return;
- };
- if (!strcmp(arg, "oddparity")) {
- out (0x01, 0x00);
- return;
- };
- if (!strcmp(arg, "noreselect")) {
- out (0x04, in (0x04) & ~RRE);
- return;
- };
- if (!strcmp(arg, "doreselect")) {
- out (0x04, in (0x04) | RRE);
- return;
- };
- fprintf (stderr, "%s: do_kill \"%s\" not (yet) implemented.\n",
- prog, arg);
-}
-
-/*================================================================
-**
-**
-** Write debug info: utilities: write symbolname.
-**
-**
-**================================================================
-*/
-
-static const char * sn (u_long a)
-{
- static char buffer[100];
-
- const char * s="";
- u_long d,m;
-
- a -= ncr.p_script;
- m = sizeof (struct script);
-
- if ((d=a-offsetof(struct script, start))<m) m=d, s="<start>";
- if ((d=a-offsetof(struct script, start1))<m) m=d, s="<start1>";
- if ((d=a-offsetof(struct script, startpos))<m) m=d, s="<startpos>";
- if ((d=a-offsetof(struct script, tryloop))<m) m=d, s="<tryloop>";
- if ((d=a-offsetof(struct script, trysel))<m) m=d, s="<trysel>";
- if ((d=a-offsetof(struct script, skip))<m) m=d, s="<skip>";
- if ((d=a-offsetof(struct script, skip2))<m) m=d, s="<skip2>";
- if ((d=a-offsetof(struct script, idle))<m) m=d, s="<idle>";
- if ((d=a-offsetof(struct script, select))<m) m=d, s="<select>";
- if ((d=a-offsetof(struct script, prepare))<m) m=d, s="<prepare>";
- if ((d=a-offsetof(struct script, loadpos))<m) m=d, s="<loadpos>";
- if ((d=a-offsetof(struct script, prepare2))<m) m=d, s="<prepare2>";
- if ((d=a-offsetof(struct script, setmsg))<m) m=d, s="<setmsg>";
- if ((d=a-offsetof(struct script, clrack))<m) m=d, s="<clrack>";
- if ((d=a-offsetof(struct script, dispatch))<m) m=d, s="<dispatch>";
- if ((d=a-offsetof(struct script, checkatn))<m) m=d, s="<checkatn>";
- if ((d=a-offsetof(struct script, command))<m) m=d, s="<command>";
- if ((d=a-offsetof(struct script, status))<m) m=d, s="<status>";
- if ((d=a-offsetof(struct script, msg_in))<m) m=d, s="<msg_in>";
- if ((d=a-offsetof(struct script, msg_bad))<m) m=d, s="<msg_bad>";
- if ((d=a-offsetof(struct script, msg_parity))<m) m=d, s="<msg_parity>";
- if ((d=a-offsetof(struct script, msg_reject))<m) m=d, s="<msg_reject>";
- if ((d=a-offsetof(struct script, msg_extended))<m) m=d, s="<msg_extended>";
- if ((d=a-offsetof(struct script, msg_sdtr))<m) m=d, s="<msg_sdtr>";
- if ((d=a-offsetof(struct script, complete))<m) m=d, s="<complete>";
- if ((d=a-offsetof(struct script, cleanup))<m) m=d, s="<cleanup>";
- if ((d=a-offsetof(struct script, cleanup0))<m) m=d, s="<cleanup>";
- if ((d=a-offsetof(struct script, signal))<m) m=d, s="<signal>";
- if ((d=a-offsetof(struct script, save_dp))<m) m=d, s="<save_dp>";
- if ((d=a-offsetof(struct script, restore_dp))<m) m=d, s="<restore_dp>";
- if ((d=a-offsetof(struct script, disconnect))<m) m=d, s="<disconnect>";
- if ((d=a-offsetof(struct script, msg_out))<m) m=d, s="<msg_out>";
- if ((d=a-offsetof(struct script, msg_out_done))<m) m=d, s="<msg_out_done>";
- if ((d=a-offsetof(struct script, msg_out_abort))<m) m=d, s="<msg_out_abort>";
- if ((d=a-offsetof(struct script, getcc))<m) m=d, s="<getcc>";
- if ((d=a-offsetof(struct script, getcc1))<m) m=d, s="<getcc1>";
- if ((d=a-offsetof(struct script, getcc2))<m) m=d, s="<getcc2>";
- if ((d=a-offsetof(struct script, badgetcc))<m) m=d, s="<badgetcc>";
- if ((d=a-offsetof(struct script, reselect))<m) m=d, s="<reselect>";
- if ((d=a-offsetof(struct script, reselect2))<m) m=d, s="<reselect2>";
- if ((d=a-offsetof(struct script, resel_tmp))<m) m=d, s="<resel_tmp>";
- if ((d=a-offsetof(struct script, resel_lun))<m) m=d, s="<resel_lun>";
- if ((d=a-offsetof(struct script, resel_tag))<m) m=d, s="<resel_tag>";
- if ((d=a-offsetof(struct script, data_in))<m) m=d, s="<data_in>";
- if ((d=a-offsetof(struct script, data_out))<m) m=d, s="<data_out>";
- if ((d=a-offsetof(struct script, no_data))<m) m=d, s="<no_data>";
- if ((d=a-offsetof(struct script, aborttag))<m) m=d, s="<aborttag>";
- if ((d=a-offsetof(struct script, abort))<m) m=d, s="<abort>";
-
- if (!*s) return s;
-
- sprintf (buffer, "%s:%d%c", s, m/4, 0);
- return (buffer);
-}
-
-/*================================================================
-**
-**
-** Write debug info: utilities: write misc. fields.
-**
-**
-**================================================================
-*/
-
-static void printm (u_char * msg, int len)
-{
- u_char l;
- do {
- if (*msg==M_EXTENDED)
- l=msg[1]+2;
- else if ((*msg & 0xf0)==0x20)
- l=2;
- else l=1;
- len-=l;
-
- printf (" %x",*msg++);
- while (--l>0) printf ("-%x",*msg++);
- } while (len>0);
-}
-
-void dump_table (const char * str, struct scr_tblmove * p, int l)
-{
- int i;
- for (i=0;l>0;i++,p++,l--) if (p->size) {
- printf (" %s[%d]: %5d @ 0x%08x\n",
- str, i, p->size, p->addr);
- };
-}
-
-void dump_link (const char* name, struct link * link)
-{
- printf ("%s: cmd=%08x pa=%08x %s\n",
- name, link->l_cmd, link->l_paddr, sn(link->l_paddr));
-}
-
-/*================================================================
-**
-**
-** Write debug info: utilities: write time fields.
-**
-**
-**================================================================
-*/
-
-void dump_tstamp (const char* name, struct tstamp * p)
-#define P(id,fld)\
- if (p->fld.tv_sec) \
- printf ("%s: "id" at %s.%06d",\
- name,ctime(&p->fld.tv_sec),p->fld.tv_usec);
-{
- P ("started ", start);
- P ("ended ", end );
- P ("selected ", select);
- P ("command ", command);
- P ("data ", data);
- P ("status ", status);
- P ("disconnected", disconnect);
- P ("reselected ", reselect);
- printf ("\n");
-}
-
-
-
-
-void dump_profile (const char* name, struct profile * p)
-{
- printf ("%s: %10d transfers.\n" ,name,p->num_trans);
- printf ("%s: %10d bytes transferred.\n",name,p->num_bytes);
- printf ("%s: %10d disconnects.\n" ,name,p->num_disc);
- printf ("%s: %10d short transfers.\n" ,name,p->num_break);
- printf ("%s: %10d interrupts.\n" ,name,p->num_int);
- printf ("%s: %10d on the fly ints.\n" ,name,p->num_fly);
- printf ("%s: %10d ms setup time.\n" ,name,p->ms_setup);
- printf ("%s: %10d ms data transfer.\n" ,name,p->ms_data);
- printf ("%s: %10d ms disconnected.\n" ,name,p->ms_disc);
- printf ("%s: %10d ms postprocessing.\n",name,p->ms_post);
- printf ("\n");
-}
-
-/*================================================================
-**
-**
-** Write debug info: utilities: write script registers.
-**
-**
-**================================================================
-*/
-
-static void dump_reg(struct ncr_reg * rp)
-{
- u_char *reg = (u_char*) rp;
-#define l(i) (reg[i]+(reg[i+1]<<8ul)+(reg[i+2]<<16ul)+(reg[i+3]<<24ul))
- int ad;
-
- char*(phasename[8])={"DATA-OUT","DATA-IN","COMMAND","STATUS",
- "ILG-OUT","ILG-IN","MESSAGE-OUT","MESSAGE-IN"};
- for (ad=0x00;ad<0x80;ad++) {
- switch (ad % 16) {
-
- case 0:
- printf (" %02x:\t",ad);
- break;
- case 8:
- printf (" : ");
- break;
- default:
- printf (" ");
- };
- printf ("%02x", reg[ad]);
- if (ad % 16 == 15) printf ("\n");
- };
- printf ("\n");
- printf (" DSP %08x %-20s CMD %08x DSPS %08x %s\n",
- l(0x2c),sn(l(0x2c)),l(0x24),l(0x30), sn(l(0x30)));
- printf (" TEMP %08x %-20s DSA %08x\n",
- l(0x1c),sn(l(0x1c)),l(0x10));
- printf ("\n");
- printf (" Busstatus: ");
- if ((reg[0x0b]>>7)&1) printf (" Req");
- if ((reg[0x0b]>>6)&1) printf (" Ack");
- if ((reg[0x0b]>>5)&1) printf (" Bsy");
- if ((reg[0x0b]>>4)&1) printf (" Sel");
- if ((reg[0x0b]>>3)&1) printf (" Atn");
- printf (" %s\n", phasename[reg[0x0b]&7]);
-
- printf (" Dmastatus: ");
- if ((reg[0x0c]>>7)&1) printf (" FifoEmpty");
- if ((reg[0x0c]>>6)&1) printf (" MasterParityError");
- if ((reg[0x0c]>>5)&1) printf (" BusFault");
- if ((reg[0x0c]>>4)&1) printf (" Aborted");
- if ((reg[0x0c]>>3)&1) printf (" SingleStep");
- if ((reg[0x0c]>>2)&1) printf (" Interrupt");
- if ((reg[0x0c]>>0)&1) printf (" IllegalInstruction");
- printf ("\n");
- printf (" Intstatus: ");
- if ((reg[0x14]>>7)&1) printf (" Abort");
- if ((reg[0x14]>>6)&1) printf (" SoftwareReset");
- if ((reg[0x14]>>5)&1) printf (" SignalProcess");
- if ((reg[0x14]>>4)&1) printf (" Semaphore");
- if ((reg[0x14]>>3)&1) printf (" Connected");
- if ((reg[0x14]>>2)&1) printf (" IntOnTheFly");
- if ((reg[0x14]>>1)&1) printf (" SCSI-Interrupt");
- if ((reg[0x14]>>0)&1) printf (" DMA-Interrupt");
- printf ("\n");
- printf (" ScsiIstat: ");
- if ((reg[0x42]>>7)&1) printf (" PhaseMismatch");
- if ((reg[0x42]>>6)&1) printf (" Complete");
- if ((reg[0x42]>>5)&1) printf (" Selected");
- if ((reg[0x42]>>4)&1) printf (" Reselected");
- if ((reg[0x42]>>3)&1) printf (" GrossError");
- if ((reg[0x42]>>2)&1) printf (" UnexpectedDisconnect");
- if ((reg[0x42]>>1)&1) printf (" ScsiReset");
- if ((reg[0x42]>>0)&1) printf (" ParityError");
- if ((reg[0x43]>>2)&1) printf (" SelectionTimeout");
- if ((reg[0x43]>>1)&1) printf (" TimerExpired");
- if ((reg[0x43]>>0)&1) printf (" HandshakeTimeout");
- printf ("\n");
- printf (" ID=%d DEST-ID=%d RESEL-ID=%d\n", reg[4]&7, reg[6]&7, reg[0xa]&7);
- printf ("\n");
-}
-
-/*================================================================
-**
-**
-** Write debug info: utilities: write header.
-**
-**
-**================================================================
-*/
-
-char * debug_opt;
-
-dump_head (struct head * hp)
-{
- dump_link (" launch", & hp->launch);
- printf (" savep: %08x %s\n",
- hp->savep, sn((u_long) hp->savep));
- printf (" cp: %08x %s\n",
- hp->cp, sn((u_long)hp->cp));
- if (strchr (debug_opt, 'y')) {
- printf ("\n");
- dump_tstamp (" timestamp", &hp->stamp);
- };
-
- printf (" status: %x %x %x %x %x %x %x %x\n",
- hp->status[0], hp->status[1], hp->status[2], hp->status[3],
- hp->status[4], hp->status[5], hp->status[6], hp->status[7]);
-
- printf ("\n");
-}
-
-/*================================================================
-**
-**
-** Write debug info: utilities: write ccb.
-**
-**
-**================================================================
-*/
-
-void dump_ccb (struct ccb * cp, u_long base)
-{
- printf ("----------------------\n");
- printf ("struct ccb @ %08x:\n", base);
- printf ("----------------------\n");
-
- dump_link (" next", &cp->jump_ccb);
- dump_link (" call", &cp->call_tmp);
-
- dump_head (&cp->phys.header);
-
- if (strchr (debug_opt, 's')) {
- dump_table(" smsg", &cp->phys.smsg, 1);
- dump_table("smsg2", &cp->phys.smsg2, 1);
- dump_table(" cmd", &cp->phys.cmd, 1);
- dump_table(" data", &cp->phys.data[0],MAX_SCATTER);
- dump_table("sense", &cp->phys.sense, 1);
- };
-
- if (strchr (debug_opt, 'a')) {
- int i;
- for (i=0; i<8; i++)
- printf (" patch[%d]: %08x\n", i, cp->patch[i]);
- };
-
- if (strchr (debug_opt, 'x')) {
- printf (" xfer: -- dump not yet implemented.\n");
- };
-
- if (strchr (debug_opt, 'm')) {
- printf (" smsg:");
- printm (cp->scsi_smsg, cp->phys.smsg.size);
- printf ("\n");
- printf (" smsg2:");
- printm (cp->scsi_smsg2, cp->phys.smsg2.size);
- printf ("\n");
- };
-
- printf (" magic: %x\n", cp->magic);
- if (cp->tlimit)
- printf (" timeout at: %s", ctime((time_t*)&cp->tlimit));
- printf (" link_ccb: %08x\n", (u_long) cp->link_ccb);
- printf (" next_ccb: %08x\n", (u_long) cp->next_ccb);
- printf (" tag: %d\n", cp->tag);
- printf ("\n");
-}
-
-/*================================================================
-**
-**
-** Write debug info: struct lcb
-**
-**
-**================================================================
-*/
-
-static void dump_lcb (u_long base)
-{
- struct lcb l;
- struct ccb c;
- u_long cp,cn;
-
- printf ("----------------------\n");
- printf ("struct lcb @ %08x:\n", base);
- printf ("----------------------\n");
-
- if (!KVM_READ (
- base,
- &l,
- sizeof (struct lcb))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
- printf (" reqccbs: %d\n", l.reqccbs);
- printf (" actccbs: %d\n", l.actccbs);
- printf (" reqlink: %d\n", l.reqlink);
- printf (" actlink: %d\n", l.actlink);
- printf (" usetags: %d\n", l.usetags);
- dump_link (" jump_lcb", &l.jump_lcb);
- dump_link (" call_tag", &l.call_tag);
- dump_link (" jump_ccb", &l.jump_ccb);
- printf ("\n");
- cp = (u_long) l.next_ccb;
- cn = 0;
- while (cp) {
- cn++;
- printf ("ccb #%d:\n", cn);
- if (!KVM_READ (
- cp,
- &c,
- sizeof (struct ccb))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
- dump_ccb (&c, cp);
- cp= (u_long) c.next_ccb;
- };
-}
-
-/*================================================================
-**
-**
-** Write debug info: struct tcb
-**
-**
-**================================================================
-*/
-
-static void dump_tip (struct tcb * tip)
-{
- int i;
- u_long lp;
-
- printf ("----------------------\n");
- printf ("struct tcb:\n");
- printf ("----------------------\n");
-
- printf (" transfers:%10d.\n", tip->transfers);
- printf (" bytes:%10d.\n", tip->bytes );
- printf (" user limits: usrsync=%d usrwide=%d usrtags=%d.\n",
- tip->usrsync, tip->usrwide, tip->usrtags);
- printf (" sync: minsync=%d, maxoffs=%d, period=%d ns, sval=%x.\n",
- tip->minsync, tip->maxoffs, tip->period, tip->sval);
- printf (" wide: widedone=%d, wval=%x.\n",
- tip->widedone, tip->wval);
-
- printf (" hold_cp: %x\n", tip->hold_cp);
- dump_link (" jump_tcb", &tip->jump_tcb);
- dump_link (" call_lun", &tip->call_lun);
- dump_link (" jump_lcb", &tip->jump_lcb);
- if (tip->hold_cp) printf (" hold_cp: @ %x\n", tip->hold_cp);
- printf ("\n");
-
- if (strchr (debug_opt, 'l')) {
- for (i=0;i<MAX_LUN;i++) {
- lp= (u_long) tip->lp[i];
- printf ("logic unit #%d:\n", i);
- if (lp) dump_lcb (lp);
- };
- }
-}
-
-/*================================================================
-**
-**
-** Write debug info: struct ncb
-**
-**
-**================================================================
-*/
-
-
-static void dump_ncr (void)
-{
- u_long tp;
- int i;
-
- printf ("----------------------\n");
- printf ("struct ncb @ %x:\n", ncr_base);
- printf ("----------------------\n");
-
- dump_link (" jump_tcb", &ncr.jump_tcb);
- printf (" register: @ %x (p=%x)\n", ncr.vaddr, ncr.paddr);
-
- if (strchr (debug_opt, 'r')) {
- struct ncr_reg reg;
-
- if (!KVM_READ (
- ncr.vaddr,
- &reg,
- sizeof (reg))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
-
- printf ("\n");
- dump_reg (&reg);
- };
-
- printf (" script: @ %x (p=%x)\n", ncr.script, ncr.p_script);
-
- printf ("hostscsiaddr: %d\n", ncr.myaddr);
- printf (" ns_async: %d ns\n", ncr.ns_async);
- printf (" ns_sync : %d ns\n", ncr.ns_sync);
- printf (" scntl3: 0x%02x\n", ncr.rv_scntl3);
- printf ("\n");
-
- /* sc_link not dumped */
-
- if (strchr (debug_opt, 'u')) {
- printf (" usercmd: cmd=%x data=%x target=%x lun=%x\n",
- ncr.user.cmd,
- ncr.user.data,
- ncr.user.target,
- ncr.user.lun);
- };
-
- printf (" actccbs: %d\n", ncr.actccbs);
-
- if (strchr (debug_opt, 'q')) {
-
- u_long startpos;
-
- if (!KVM_READ (
- ((u_long)ncr.script
- +offsetof(struct script, startpos)),
- &startpos,
- sizeof (startpos))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
-
- printf (" startpos: %x\n", startpos);
- printf (" slot: %d\n", (startpos-
- (ncr.p_script+offsetof(struct script, tryloop)))/20);
- printf (" squeuput: %d\n", ncr.squeueput);
- for (i=0; i<MAX_START; i++)
- printf ("%12d: %08x %s\n", i,
- ncr.squeue[i], sn(ncr.squeue[i]));
-
- printf ("\n");
- };
-
- printf (" ticks: %d ms\n", ncr.ticks * 10);
- printf (" heartbeat: %s", ctime ((time_t*)&ncr.heartbeat));
- printf (" lasttime: %s", ctime ((time_t*)&ncr.lasttime));
-#ifndef __NetBSD__
- printf ("imask/mcount: %x / %d\n", ncr.imask, ncr.mcount);
-#endif
- printf ("\n");
-
- if (strchr (debug_opt, 'd') && ncr.regtime.tv_sec) {
- printf (" regdump: %s", ctime (&ncr.regtime.tv_sec));
- dump_reg (&ncr.regdump);
- };
-
- if (strchr (debug_opt, 'p')) {
- printf ("\n");
- dump_profile (" profile", &ncr.profile);
- };
-
- if (strchr (debug_opt, 'h')) {
- printf ("\n");
- dump_head ( &ncr.header);
- };
-
- if (strchr (debug_opt, 'c')) {
- dump_ccb (&ncr.ccb, ncr_base + offsetof (struct ncb, ccb));
- };
-
- if (strchr (debug_opt, 'm')) {
- printf (" msgout:"); printm (ncr.msgout,0); printf ("\n");
- printf (" msg in:"); printm (ncr.msgin,0); printf ("\n");
- printf ("\n");
- };
-
- if (strchr (debug_opt, 't')) {
- struct tcb * tip;
- for (i=0;i<MAX_TARGET;i++) {
- tip = &ncr.target[i];
- if (!tip->jump_tcb.l_cmd) continue;
- printf ("target #%d:\n", i);
- dump_tip (tip);
- }
- }
-}
-
-/*================================================================
-**
-**
-** D O _ D E B U G
-**
-**
-**================================================================
-*/
-
-
-do_debug(char * arg)
-{
- open_kvm(O_RDONLY);
- debug_opt = arg;
- if (strchr (debug_opt, '?')) printf (
-"'?': list debug options [sic].\n"
-"'a': show patchfields in ccbs (requires c).\n"
-"'c': show ccbs.\n"
-"'d': show register dump.\n"
-"'h': show header information.\n"
-"'m': show message buffers.\n"
-"'n': show ncr main control block.\n"
-"'p': show profiling information.\n"
-"'q': show start queue.\n"
-"'r': show registers (*DANGEROUS*).\n"
-"'s': show scatter/gather info.\n"
-"'t': show target control blocks.\n"
-"'u': show user cmd field.\n"
-"'x': show generic xfer structure.\n"
-"'y': show timestamps.\n"
-"\n"
- );
-
- if (strchr (debug_opt, 'n')) dump_ncr ();
- if (strchr (debug_opt, 'r')) {
- struct ncr_reg reg;
- if (!KVM_READ (
- ncr.vaddr,
- &reg,
- sizeof (reg))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
- dump_reg (&reg);
- };
-}
-
-
-/*================================================================
-**
-**
-** Main function
-**
-**
-**================================================================
-*/
-
-void main(argc, argv)
- int argc;
- char **argv;
-{
- extern char *optarg;
- extern int optind;
- int usage=0;
- char * charp;
- int ch, getopt(),atoi();
- int i,step;
-
- prog = *argv;
- while ((ch = getopt(argc, argv, "M:N:u:f:t:l:p:s:k:d:vwhin:?")) != -1)
- switch((char)ch) {
- case 'M':
- if (kvm_isopen) {
- fprintf (stderr,
- "%s: -M: kernel file already open.\n",
- prog);
- exit (1);
- };
- kmemf = optarg;
- break;
- case 'N':
- if (kvm_isopen) {
- fprintf (stderr,
- "%s: -N: symbol table already open.\n",
- prog);
- exit (1);
- };
- vmunix = optarg;
- break;
- case 'f':
- fprintf (stderr,
- "%s: -f: option not yet implemented.\n",
- prog);
- exit (1);
-
- case 'u':
- i = strtoul (optarg, &charp, 0);
- if (!*optarg || *charp || (i<0)) {
- fprintf (stderr,
- "%s: bad unit number \"%s\".\n",
- prog, optarg);
- exit (1);
- }
- ncr_unit = i;
- break;
- case 't':
- i = strtoul (optarg, &charp, 0);
- if (!*optarg || *charp || (i<0) || (i>=MAX_TARGET)) {
- fprintf (stderr,
- "%s: bad target number \"%s\" (valid range: 0-%d).\n",
- prog, optarg, MAX_TARGET-1);
- exit (1);
- }
- target_mask |= 1ul << i;
- break;
- case 'n':
- open_kvm(O_RDONLY);
- i = strtoul (optarg, &charp, 0);
- printf ("addr %d (0x%x) has label %s.\n",
- i,i,sn(i));
- break;
- case 'l':
- i = strtoul (optarg, &charp, 0);
- if (!*optarg || *charp || (i<0) || (i>=MAX_LUN)) {
- fprintf (stderr,
- "%s: bad logic unit number \"%s\" (valid range: 0-%d).\n",
- prog, optarg, MAX_LUN);
- exit (1);
- }
- global_lun_mask |= 1ul << i;
- break;
- case 'p':
- i = strtoul (optarg, &charp, 0);
- if (!*optarg || *charp || (i<1) || (i>60)) {
- fprintf (stderr,
- "%s: bad interval \"%s\".\n",
- prog, optarg);
- exit (1);
- }
- interval = i;
- do_profile();
- break;
-
- case 'w':
- wizard=1;
- break;
- case 'v':
- verbose++;
- break;
- case 'i':
- do_info();
- break;
-
- case 's':
- do_set(optarg);
- break;
- case 'd':
- do_debug(optarg);
- break;
- case 'k':
- do_kill(optarg);
- break;
- case 'h':
- case '?':
- usage++;
- break;
- default:(void)fprintf(stderr,
- "%s: illegal option \"%c\".\n", prog, ch);
- usage++;
- }
-
- argv += optind;
- argc -= optind;
-
- if (argc) printf ("%s: rest of line starting with \"%s\" ignored.\n",
- prog, *argv);
-
- if (verbose&&!kvm_isopen) usage++;
- if (usage) {
- fprintf (stderr,
- "Usage:\n"
- "\n"
- "%s [-M$] [-N$] {-f$} {-t#} {-l#} [-hivw?] [-d$] [-s$] [-k] [[-p] <time>]\n"
- "\n"
- "-t <#> select target number\n"
- "-l <#> select lun number\n"
- "-i get info\n"
- "-v verbose\n"
- "-p <seconds> performance data\n"
- "\n"
- "Wizards only (proceed on your own risk):\n"
- "-n <#> get the name for address #\n"
- "-w wizard mode\n"
- "-d <options> debug info\n"
- "-d? list debug options\n"
- "-s <param=value> set parameter\n"
- "-s? list parameters\n"
- "-k <torture> torture driver by simulating errors\n"
- "-k? list tortures\n"
- "-M <kernelimage> (default: %s)\n"
- "-N <symboltable> (default: %s)\n"
- , prog, _PATH_KMEM, _PATH_UNIX);
- if (verbose) fprintf (stderr, ident);
- exit (1);
- }
-
- if (!kvm_isopen) {
- do_info();
- do_profile();
- };
- exit (0);
-}
diff --git a/sys/i386/pci/ncrreg.h b/sys/i386/pci/ncrreg.h
deleted file mode 100644
index 1a22aee..0000000
--- a/sys/i386/pci/ncrreg.h
+++ /dev/null
@@ -1,547 +0,0 @@
-/**************************************************************************
-**
-** $Id: ncrreg.h,v 2.3 94/10/09 21:10:34 wolf Oct11 $
-**
-** Device driver for the NCR 53C810 PCI-SCSI-Controller.
-**
-** 386bsd / FreeBSD / NetBSD
-**
-**-------------------------------------------------------------------------
-**
-** Written for 386bsd and FreeBSD by
-** wolf@dentaro.gun.de Wolfgang Stanglmeier
-** se@mi.Uni-Koeln.de Stefan Esser
-**
-** Ported to NetBSD by
-** mycroft@gnu.ai.mit.edu
-**
-**-------------------------------------------------------------------------
-**
-** Copyright (c) 1994 Wolfgang Stanglmeier. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-***************************************************************************
-*/
-
-#ifndef __NCR_REG_H__
-#define __NCR_REG_H__
-
-
-/*-----------------------------------------------------------------
-**
-** The ncr 53c810 register structure.
-**
-**-----------------------------------------------------------------
-*/
-
-struct ncr_reg {
-/*00*/ u_char nc_scntl0; /* full arb., ena parity, par->ATN */
-
-/*01*/ u_char nc_scntl1; /* no reset */
- #define ISCON 0x10 /* connected to scsi */
- #define CRST 0x08 /* force reset */
-
-/*02*/ u_char nc_scntl2; /* no disconnect expected */
- #define SDU 0x80 /* cmd: disconnect will raise error */
- #define CHM 0x40 /* sta: chained mode */
- #define WSS 0x08 /* sta: wide scsi send [W]*/
- #define WSR 0x01 /* sta: wide scsi received [W]*/
-
-/*03*/ u_char nc_scntl3; /* cnf system clock dependent */
- #define EWS 0x08 /* cmd: enable wide scsi [W]*/
-
-/*04*/ u_char nc_scid; /* cnf host adapter scsi address */
- #define RRE 0x40 /* r/w:e enable response to resel. */
- #define SRE 0x20 /* r/w:e enable response to select */
-
-/*05*/ u_char nc_sxfer; /* ### Sync speed and count */
-
-/*06*/ u_char nc_sdid; /* ### Destination-ID */
-
-/*07*/ u_char nc_gpreg; /* ??? IO-Pins */
-
-/*08*/ u_char nc_sfbr; /* ### First byte in phase */
-
-/*09*/ u_char nc_socl;
- #define CREQ 0x80 /* r/w: SCSI-REQ */
- #define CACK 0x40 /* r/w: SCSI-ACK */
- #define CBSY 0x20 /* r/w: SCSI-BSY */
- #define CSEL 0x10 /* r/w: SCSI-SEL */
- #define CATN 0x08 /* r/w: SCSI-ATN */
- #define CMSG 0x04 /* r/w: SCSI-MSG */
- #define CC_D 0x02 /* r/w: SCSI-C_D */
- #define CI_O 0x01 /* r/w: SCSI-I_O */
-
-/*0a*/ u_char nc_ssid;
-
-/*0b*/ u_char nc_sbcl;
-
-/*0c*/ u_char nc_dstat;
- #define DFE 0x80 /* sta: dma fifo empty */
- #define MDPE 0x40 /* int: master data parity error */
- #define BF 0x20 /* int: script: bus fault */
- #define ABRT 0x10 /* int: script: command aborted */
- #define SSI 0x08 /* int: script: single step */
- #define SIR 0x04 /* int: script: interrupt instruct. */
- #define IID 0x01 /* int: script: illegal instruct. */
-
-/*0d*/ u_char nc_sstat0;
- #define ILF 0x80 /* sta: data in SIDL register lsb */
- #define ORF 0x40 /* sta: data in SODR register lsb */
- #define OLF 0x20 /* sta: data in SODL register lsb */
- #define AIP 0x10 /* sta: arbitration in progress */
- #define LOA 0x08 /* sta: arbitration lost */
- #define WOA 0x04 /* sta: arbitration won */
- #define IRST 0x02 /* sta: scsi reset signal */
- #define SDP 0x01 /* sta: scsi parity signal */
-
-/*0e*/ u_char nc_sstat1;
- #define FF3210 0xf0 /* sta: bytes in the scsi fifo */
-
-/*0f*/ u_char nc_sstat2;
- #define ILF1 0x80 /* sta: data in SIDL register msb[W]*/
- #define ORF1 0x40 /* sta: data in SODR register msb[W]*/
- #define OLF1 0x20 /* sta: data in SODL register msb[W]*/
-
-/*10*/ u_long nc_dsa; /* --> Base page */
-
-/*14*/ u_char nc_istat; /* --> Main Command and status */
- #define CABRT 0x80 /* cmd: abort current operation */
- #define SRST 0x40 /* mod: reset chip */
- #define SIGP 0x20 /* r/w: message from host to ncr */
- #define SEM 0x10 /* r/w: message between host + ncr */
- #define CON 0x08 /* sta: connected to scsi */
- #define INTF 0x04 /* sta: int on the fly (reset by wr)*/
- #define SIP 0x02 /* sta: scsi-interrupt */
- #define DIP 0x01 /* sta: host/script interrupt */
-
-/*15*/ u_char nc_15_;
-/*16*/ u_char nc_16_;
-/*17*/ u_char nc_17_;
-
-/*18*/ u_char nc_ctest0;
-/*19*/ u_char nc_ctest1;
-
-/*1a*/ u_char nc_ctest2;
- #define CSIGP 0x40
-
-/*1b*/ u_char nc_ctest3;
- #define CLF 0x04 /* clear scsi fifo */
-
-/*1c*/ u_long nc_temp; /* ### Temporary stack */
-
-/*20*/ u_char nc_dfifo;
-/*21*/ u_char nc_ctest4;
-/*22*/ u_char nc_ctest5;
-/*23*/ u_char nc_ctest6;
-
-/*24*/ u_long nc_dbc; /* ### Byte count and command */
-/*28*/ u_long nc_dnad; /* ### Next command register */
-/*2c*/ u_long nc_dsp; /* --> Script Pointer */
-/*30*/ u_long nc_dsps; /* --> Script pointer save/opcode#2 */
-/*34*/ u_long nc_scratcha; /* ??? Temporary register a */
-
-/*38*/ u_char nc_dmode;
-/*39*/ u_char nc_dien;
-/*3a*/ u_char nc_dwt;
-
-/*3b*/ u_char nc_dcntl; /* --> Script execution control */
- #define SSM 0x10 /* mod: single step mode */
- #define STD 0x04 /* cmd: start dma mode */
- #define NOCOM 0x01 /* cmd: protect sfbr while reselect */
-
-/*3c*/ u_long nc_adder;
-
-/*40*/ u_short nc_sien; /* -->: interrupt enable */
-/*42*/ u_short nc_sist; /* <--: interrupt status */
- #define STO 0x0400/* sta: timeout (select) */
- #define GEN 0x0200/* sta: timeout (general) */
- #define HTH 0x0100/* sta: timeout (handshake) */
- #define MA 0x80 /* sta: phase mismatch */
- #define CMP 0x40 /* sta: arbitration complete */
- #define SEL 0x20 /* sta: selected by another device */
- #define RSL 0x10 /* sta: reselected by another device*/
- #define SGE 0x08 /* sta: gross error (over/underflow)*/
- #define UDC 0x04 /* sta: unexpected disconnect */
- #define RST 0x02 /* sta: scsi bus reset detected */
- #define PAR 0x01 /* sta: scsi parity error */
-
-/*44*/ u_char nc_slpar;
-/*45*/ u_char nc_swide;
-/*46*/ u_char nc_macntl;
-/*47*/ u_char nc_gpcntl;
-/*48*/ u_char nc_stime0; /* cmd: timeout for select&handshake*/
-/*49*/ u_char nc_stime1; /* cmd: timeout user defined */
-/*4a*/ u_short nc_respid; /* sta: Reselect-IDs */
-
-/*4c*/ u_char nc_stest0;
-
-/*4d*/ u_char nc_stest1;
-
-/*4e*/ u_char nc_stest2;
- #define ROF 0x40 /* reset scsi offset (after gross error!) */
- #define EXT 0x02 /* extended filtering */
-
-/*4f*/ u_char nc_stest3;
- #define TE 0x80 /* c: tolerAnt enable */
- #define CSF 0x02 /* c: clear scsi fifo */
-
-/*50*/ u_short nc_sidl; /* Lowlevel: latched from scsi data */
-/*52*/ u_short nc_52_;
-/*54*/ u_short nc_sodl; /* Lowlevel: data out to scsi data */
-/*56*/ u_short nc_56_;
-/*58*/ u_short nc_sbdl; /* Lowlevel: data from scsi data */
-/*5a*/ u_short nc_5a_;
-/*5c*/ u_char nc_scr0; /* Working register B */
-/*5d*/ u_char nc_scr1; /* */
-/*5e*/ u_char nc_scr2; /* */
-/*5f*/ u_char nc_scr3; /* */
-/*60*/
-};
-
-/*-----------------------------------------------------------
-**
-** Utility macros for the script.
-**
-**-----------------------------------------------------------
-*/
-
-#define REGJ(p,r) (offsetof(struct ncr_reg, p ## r))
-#define REG(r) REGJ (nc_, r)
-
-#ifndef TARGET_MODE
-#define TARGET_MODE 0
-#endif
-
-typedef unsigned long ncrcmd;
-
-/*-----------------------------------------------------------
-**
-** SCSI phases
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_DATA_OUT 0x00000000
-#define SCR_DATA_IN 0x01000000
-#define SCR_COMMAND 0x02000000
-#define SCR_STATUS 0x03000000
-#define SCR_ILG_OUT 0x04000000
-#define SCR_ILG_IN 0x05000000
-#define SCR_MSG_OUT 0x06000000
-#define SCR_MSG_IN 0x07000000
-
-/*-----------------------------------------------------------
-**
-** Data transfer via SCSI.
-**
-**-----------------------------------------------------------
-**
-** MOVE_ABS (LEN)
-** <<start address>>
-**
-** MOVE_IND (LEN)
-** <<dnad_offset>>
-**
-** MOVE_TBL
-** <<dnad_offset>>
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_MOVE_ABS(l) ((0x08000000 ^ (TARGET_MODE << 1ul)) | (l))
-#define SCR_MOVE_IND(l) ((0x28000000 ^ (TARGET_MODE << 1ul)) | (l))
-#define SCR_MOVE_TBL (0x18000000 ^ (TARGET_MODE << 1ul))
-
-struct scr_tblmove {
- u_long size;
- u_long addr;
-};
-
-/*-----------------------------------------------------------
-**
-** Selection
-**
-**-----------------------------------------------------------
-**
-** SEL_ABS | SCR_ID (0..7) [ | REL_JMP]
-** <<alternate_address>>
-**
-** SEL_TBL | << dnad_offset>> [ | REL_JMP]
-** <<alternate_address>>
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_SEL_ABS 0x40000000
-#define SCR_SEL_ABS_ATN 0x41000000
-#define SCR_SEL_TBL 0x42000000
-#define SCR_SEL_TBL_ATN 0x43000000
-
-struct scr_tblsel {
- u_char sel_0;
- u_char sel_sxfer;
- u_char sel_id;
- u_char sel_scntl3;
-};
-
-#define SCR_JMP_REL 0x04000000
-#define SCR_ID(id) (((u_long)(id)) << 16)
-
-/*-----------------------------------------------------------
-**
-** Waiting for Disconnect or Reselect
-**
-**-----------------------------------------------------------
-**
-** WAIT_DISC
-** dummy: <<alternate_address>>
-**
-** WAIT_RESEL
-** <<alternate_address>>
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_WAIT_DISC 0x48000000
-#define SCR_WAIT_RESEL 0x50000000
-
-/*-----------------------------------------------------------
-**
-** Bit Set / Reset
-**
-**-----------------------------------------------------------
-**
-** SET (flags {|.. })
-**
-** CLR (flags {|.. })
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_SET(f) (0x58000000 | (f))
-#define SCR_CLR(f) (0x60000000 | (f))
-
-#define SCR_CARRY 0x00000400
-#define SCR_TRG 0x00000200
-#define SCR_ACK 0x00000040
-#define SCR_ATN 0x00000008
-
-
-
-
-/*-----------------------------------------------------------
-**
-** Memory to memory move
-**
-**-----------------------------------------------------------
-**
-** COPY (bytecount)
-** << source_address >>
-** << destination_address >>
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_COPY(n) (0xc0000000 | (n))
-
-/*-----------------------------------------------------------
-**
-** Register move and binary operations
-**
-**-----------------------------------------------------------
-**
-** SFBR_REG (reg, op, data) reg = SFBR op data
-** << 0 >>
-**
-** REG_SFBR (reg, op, data) SFBR = reg op data
-** << 0 >>
-**
-** REG_REG (reg, op, data) reg = reg op data
-** << 0 >>
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_REG_OFS(ofs) ((ofs) << 16ul)
-
-#define SCR_SFBR_REG(reg,op,data) \
- (0x68000000 | (SCR_REG_OFS(REG(reg))) | (op) | ((data)<<8ul))
-
-#define SCR_REG_SFBR(reg,op,data) \
- (0x70000000 | (SCR_REG_OFS(REG(reg))) | (op) | ((data)<<8ul))
-
-#define SCR_REG_REG(reg,op,data) \
- (0x78000000 | (SCR_REG_OFS(REG(reg))) | (op) | ((data)<<8ul))
-
-
-#define SCR_LOAD 0x00000000
-#define SCR_SHL 0x01000000
-#define SCR_OR 0x02000000
-#define SCR_XOR 0x03000000
-#define SCR_AND 0x04000000
-#define SCR_SHR 0x05000000
-#define SCR_ADD 0x06000000
-#define SCR_ADDC 0x07000000
-
-/*-----------------------------------------------------------
-**
-** FROM_REG (reg) reg = SFBR
-** << 0 >>
-**
-** TO_REG (reg) SFBR = reg
-** << 0 >>
-**
-** LOAD_REG (reg, data) reg = <data>
-** << 0 >>
-**
-** LOAD_SFBR(data) SFBR = <data>
-** << 0 >>
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_FROM_REG(reg) \
- SCR_REG_SFBR(reg,SCR_OR,0)
-
-#define SCR_TO_REG(reg) \
- SCR_SFBR_REG(reg,SCR_OR,0)
-
-#define SCR_LOAD_REG(reg,data) \
- SCR_REG_REG(reg,SCR_LOAD,data)
-
-#define SCR_LOAD_SFBR(data) \
- (SCR_REG_SFBR (gpreg, SCR_LOAD, data))
-
-/*-----------------------------------------------------------
-**
-** Waiting for Disconnect or Reselect
-**
-**-----------------------------------------------------------
-**
-** JUMP [ | IFTRUE/IFFALSE ( ... ) ]
-** <<address>>
-**
-** JUMPR [ | IFTRUE/IFFALSE ( ... ) ]
-** <<distance>>
-**
-** CALL [ | IFTRUE/IFFALSE ( ... ) ]
-** <<address>>
-**
-** CALLR [ | IFTRUE/IFFALSE ( ... ) ]
-** <<distance>>
-**
-** RETURN [ | IFTRUE/IFFALSE ( ... ) ]
-** <<dummy>>
-**
-** INT [ | IFTRUE/IFFALSE ( ... ) ]
-** <<ident>>
-**
-** INT_FLY [ | IFTRUE/IFFALSE ( ... ) ]
-** <<ident>>
-**
-** Conditions:
-** WHEN (phase)
-** IF (phase)
-** CARRY
-** DATA (data, mask)
-**
-**-----------------------------------------------------------
-*/
-
-#define SCR_JUMP 0x80080000
-#define SCR_JUMPR 0x80880000
-#define SCR_CALL 0x88080000
-#define SCR_CALLR 0x88880000
-#define SCR_RETURN 0x90080000
-#define SCR_INT 0x98080000
-#define SCR_INT_FLY 0x98180000
-
-#define IFFALSE(arg) (0x00080000 | (arg))
-#define IFTRUE(arg) (0x00000000 | (arg))
-
-#define WHEN(phase) (0x00030000 | (phase))
-#define IF(phase) (0x00020000 | (phase))
-
-#define DATA(D) (0x00040000 | ((D) & 0xff))
-#define MASK(D,M) (0x00040000 | (((M ^ 0xff) & 0xff) << 8ul)|((D) & 0xff))
-
-#define CARRYSET (0x00200000)
-
-/*-----------------------------------------------------------
-**
-** SCSI constants.
-**
-**-----------------------------------------------------------
-*/
-
-/*
-** Messages
-*/
-
-#define M_COMPLETE (0x00)
-#define M_EXTENDED (0x01)
-#define M_SAVE_DP (0x02)
-#define M_RESTORE_DP (0x03)
-#define M_DISCONNECT (0x04)
-#define M_ID_ERROR (0x05)
-#define M_ABORT (0x06)
-#define M_REJECT (0x07)
-#define M_NOOP (0x08)
-#define M_PARITY (0x09)
-#define M_LCOMPLETE (0x0a)
-#define M_FCOMPLETE (0x0b)
-#define M_RESET (0x0c)
-#define M_ABORT_TAG (0x0d)
-#define M_CLEAR_QUEUE (0x0e)
-#define M_INIT_REC (0x0f)
-#define M_REL_REC (0x10)
-#define M_TERMINATE (0x11)
-#define M_SIMPLE_TAG (0x20)
-#define M_HEAD_TAG (0x21)
-#define M_ORDERED_TAG (0x22)
-#define M_IGN_RESIDUE (0x23)
-#define M_IDENTIFY (0x80)
-
-#define M_X_MODIFY_DP (0x00)
-#define M_X_SYNC_REQ (0x01)
-#define M_X_WIDE_REQ (0x03)
-
-/*
-** Status
-*/
-
-#define S_GOOD (0x00)
-#define S_CHECK_COND (0x02)
-#define S_COND_MET (0x04)
-#define S_BUSY (0x08)
-#define S_INT (0x10)
-#define S_INT_COND_MET (0x14)
-#define S_CONFLICT (0x18)
-#define S_TERMINATED (0x20)
-#define S_QUEUE_FULL (0x28)
-#define S_ILLEGAL (0xff)
-#define S_SENSE (0x80)
-
-#endif /*__NCR_REG_H__*/
diff --git a/sys/i386/pci/ncrstat.c b/sys/i386/pci/ncrstat.c
deleted file mode 100644
index d7208b4..0000000
--- a/sys/i386/pci/ncrstat.c
+++ /dev/null
@@ -1,1630 +0,0 @@
-/**************************************************************************
-**
-** $Id: ncrstat.c,v 2.0.0.10 94/09/16 09:38:24 wolf Exp $
-**
-** Utility for NCR 53C810 device driver.
-**
-** 386bsd / FreeBSD / NetBSD
-**
-**-------------------------------------------------------------------------
-**
-** Written for 386bsd and FreeBSD by
-** wolf@dentaro.gun.de Wolfgang Stanglmeier
-** se@mi.Uni-Koeln.de Stefan Esser
-**
-** Ported to NetBSD by
-** mycroft@gnu.ai.mit.edu
-**
-**-------------------------------------------------------------------------
-**
-** Copyright (c) 1994 Wolfgang Stanglmeier. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-**-------------------------------------------------------------------------
-*/
-
-#include <sys/file.h>
-#include <sys/types.h>
-#ifdef __NetBSD__
-#include <sys/device.h>
-#endif
-#include <nlist.h>
-#include <stdio.h>
-#include <errno.h>
-#include <paths.h>
-#include <limits.h>
-#include <kvm.h>
-#include <i386/pci/ncr.c>
-
-/*
-** used external functions
-*/
-
-#if defined(__NetBSD__) || (__FreeBSD__ >= 2)
-kvm_t *kvm;
-#define KVM_NLIST(n) (kvm_nlist(kvm, (n)) >= 0)
-#define KVM_READ(o, p, l) (kvm_read(kvm, (o), (void*)(p), (l)) == (l))
-#else
-#define KVM_NLIST(n) (kvm_nlist((n)) >= 0)
-#define KVM_READ(o, p, l) (kvm_read((void*)(o), (p), (l)) == (l))
-#endif
-
-extern void exit();
-extern char* strerror (int num);
-
-/*===========================================================
-**
-** Global variables.
-**
-**===========================================================
-*/
-
-char *prog;
-u_long verbose;
-u_long wizard;
-
-
-
-struct nlist nl[] = {
-#define N_NCR_VERSION 0
- { "_ncr_version" },
-#ifdef __NetBSD__
-#define N_NCRCD 1
- { "_ncrcd" },
-#else
-#define N_NCRP 1
- { "_ncrp" },
-#define N_NNCR 2
- { "_nncr" },
-#endif
- { 0 }
-};
-
-
-char *vmunix = _PATH_UNIX;
-char *kmemf = NULL;
-
-int kvm_isopen;
-
-u_long ncr_base;
-u_long lcb_base;
-u_long ccb_base;
-
-u_long ncr_unit;
-#ifdef __NetBSD__
-struct cfdriver ncrcd;
-#else
-u_long ncr_units;
-#endif
-
-struct ncb ncr;
-struct lcb lcb;
-struct ccb ccb;
-
-u_long target_mask;
-u_long global_lun_mask;
-u_long lun_mask;
-u_long interval;
-
-/*===========================================================
-**
-** Accessing kernel memory via kvm library.
-**
-**===========================================================
-*/
-
-read_ccb(u_long base)
-{
- ccb_base = base;
- if (!KVM_READ (
- base,
- &ccb,
- sizeof (struct ccb))) {
- fprintf (stderr, "%s: bad kvm read at %x.\n", prog, base);
- exit (1);
- };
-}
-
-read_lcb(u_long base)
-{
- lcb_base = base;
- if (!KVM_READ (
- base,
- &lcb,
- sizeof (struct lcb))) {
- fprintf (stderr, "%s: bad kvm read at %x.\n", prog, base);
- exit (1);
- };
-}
-
-read_ncr()
-{
- if (!KVM_READ (
- ncr_base,
- &ncr,
- sizeof (ncr))) {
- fprintf (stderr, "%s: bad kvm read at %x.\n", prog, ncr_base);
- exit (1);
- };
-}
-
-void open_kvm(int flags)
-{
- int i;
- u_long kernel_version;
-#if defined(__NetBSD__) || (__FreeBSD__ >= 2)
- char errbuf[_POSIX2_LINE_MAX];
-#endif
-
- if (kvm_isopen) return;
-
-#if defined(__NetBSD__) || (__FreeBSD__ >= 2)
- kvm = kvm_openfiles(vmunix, kmemf, NULL, flags, errbuf);
- if (kvm == NULL) {
- fprintf(stderr, "%s: kvm_openfiles: %s\n", prog, errbuf);
- exit(1);
- }
-#else
- if (kvm_openfiles(vmunix, kmemf, NULL) == -1) {
- fprintf(stderr, "%s: kvm_openfiles: %s\n", prog, kvm_geterr());
- exit(1);
- }
-#endif
-
- if (!KVM_NLIST(nl)) {
- fprintf(stderr, "%s: no symbols in \"%s\".\n",
- prog, vmunix);
- exit (2);
- };
-
- for (i=0; nl[i].n_name; i++)
- if (nl[i].n_type == 0) {
- fprintf(stderr, "%s: no symbol \"%s\" in \"%s\".\n",
- prog, nl[i].n_name, vmunix);
- exit(1);
- }
-
- if (!KVM_READ (
- nl[N_NCR_VERSION].n_value,
- &kernel_version,
- sizeof (kernel_version))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
-
- if (kernel_version != ncr_version){
- fprintf (stderr, "%s: incompatible with kernel. Rebuild!\n",
- prog);
- exit (1);
- };
-
-#ifdef __NetBSD__
-
- if (!KVM_READ (
- nl[N_NCRCD].n_value,
- &ncrcd,
- sizeof (ncrcd))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
-
- if (ncr_unit >= ncrcd.cd_ndevs){
- fprintf (stderr, "%s: bad unit number (valid range: 0-%d).\n",
- prog, ncrcd.cd_ndevs-1);
- exit (1);
- };
-
- if (!KVM_READ (
- ncrcd.cd_devs+4*ncr_unit,
- &ncr_base,
- sizeof (ncr_base))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
-
- if (!ncr_base) {
- fprintf (stderr,
- "%s: control structure not allocated (not found in autoconfig?)\n", prog);
- exit (1);
- };
-
-#else /* !__NetBSD__ */
-
- if (!KVM_READ (
- nl[N_NNCR].n_value,
- &ncr_units,
- sizeof (ncr_units))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
-
- if (ncr_unit >= ncr_units){
- fprintf (stderr, "%s: bad unit number (valid range: 0-%d).\n",
- prog, ncr_units-1);
- exit (1);
- };
-
- if (!KVM_READ (
- nl[N_NCRP].n_value+4*ncr_unit,
- &ncr_base,
- sizeof (ncr_base))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
-
- if (!ncr_base) {
- fprintf (stderr,
- "%s: control structure not allocated (not found in autoconfig?)\n", prog);
- exit (1);
- };
-
-#endif /* !__NetBSD__ */
-
- read_ncr();
-
- if (!ncr.vaddr) {
- fprintf (stderr,
- "%s: 53c810 not mapped (not found in autoconfig?)\n", prog);
- exit (1);
- };
-
- kvm_isopen = 1;
-}
-
-
-
-
-void set_target_mask(void)
-{
- int t;
- if (target_mask) return;
- for (t=0; t<MAX_TARGET; t++)
- if (ncr.target[t].jump_tcb.l_cmd) target_mask |= (1<<t);
-}
-
-void set_lun_mask(struct tcb * tp)
-{
- int l;
- lun_mask = global_lun_mask;
- if (lun_mask) return;
- for (l=0; l<MAX_LUN; l++)
- if (tp->lp[l]) lun_mask |= (1<<l);
-}
-
-void printc (u_char*p, int l)
-{
- for (;l>0;l--) {
- char c=*p++;
- printf ("%c", c?c:'_');
- }
-}
-
-/*================================================================
-**
-**
-** system info
-**
-**
-**================================================================
-*/
-
-do_info(void)
-{
- int t,l,i,d,f,fl;
- struct tcb * tip;
- open_kvm(O_RDONLY);
-
- if (verbose>=3)
- printf ("ncr unit=%d data@%x register@%x (pci@%x)\n\n",
- ncr_unit, ncr_base, ncr.vaddr, ncr.paddr);
-
- set_target_mask();
-
- printf ("T:L Vendor Device Rev Speed Max Wide Tags\n");
- for (t=0; t<MAX_TARGET;t++) {
- if (!((target_mask>>t)&1)) continue;
- tip = &ncr.target[t];
-
- set_lun_mask(tip);
- if (!lun_mask) lun_mask=1;
- fl=1;
-
- for (l=0; l<MAX_LUN; l++) {
- if (!((lun_mask>>l)&1)) continue;
-
- printf ("%d:%d ", t, l);
-
- if (!tip->jump_tcb.l_cmd) break;
-
- if (fl) {
- fl=0;
- printc (&tip->inqdata[ 8], 8);printf(" ");
- printc (&tip->inqdata[16],16);printf(" ");
- printc (&tip->inqdata[32], 4);printf(" ");
-
- if (tip->period==0xffff) {
- printf ("asyn");
- } else if (tip->period) {
- printf ("%4.1f", 1000.0 / tip->period);
- } else {
- printf (" ?");
- }
-
- printf (" ");
-
- if (tip->minsync==255) {
- printf ("asyn");
- } else if (tip->minsync) {
- printf ("%4.1f", 250.0 / tip->minsync);
- } else {
- printf (" ?");
- }
- } else printf (" ");
-
- if (!tip->lp[l]) {
- printf (" no\n");
- continue;
- };
- read_lcb ((u_long) tip->lp[l]);
-
- switch (tip->widedone) {
- case 1:
- printf (" 8");
- break;
- case 2:
- printf (" 16");
- break;
- case 3:
- printf (" 32");
- break;
- default:
- printf (" ?");
- };
-
- if (lcb.usetags)
- printf ("%5d", lcb.actlink);
- else
- printf (" -");
-
- printf ("\n");
-
- };
-
- if (!tip->jump_tcb.l_cmd) {
- printf (" --- no target.\n");
- continue;
- };
-
- if (verbose<1) continue;
-
- for (i=0; i<8; i++) {
- char* (class[10])={
- "disk","tape","printer","processor",
- "worm", "cdrom", "scanner", "optical disk",
- "media changer", "communication device"};
- d = tip->inqdata[i];
- printf ("[%02x]: ",d);
-
- switch (i) {
-
- case 0:
- f = d & 0x1f;
- if (f<10) printf (class[f]);
- else printf ("unknown (%x)", f);
- break;
- case 1:
- f = (d>>7) & 1;
- if (f) printf ("removable media");
- else printf ("fixed media");
- break;
-
- case 2:
- f = d & 7;
- switch (f) {
- case 0: printf ("SCSI-1");
- break;
- case 1: printf ("SCSI-1 with CCS");
- break;
- case 2: printf ("SCSI-2");
- break;
- default:
- printf ("unknown ansi version (%d)",
- f);
- }
- break;
-
- case 3:
- if (d&0xc0) printf ("capabilities:");
- if (d&0x80) printf (" AEN");
- if (d&0x40) printf (" TERMINATE-I/O");
- break;
-
- case 7:
- if (d&0xfb) printf ("capabilities:");
- if (d&0x80) printf (" relative");
- if (d&0x40) printf (" wide32");
- if (d&0x20) printf (" wide");
- if (d&0x10) printf (" synch");
- if (d&0x08) printf (" link");
- if (d&0x02) printf (" tags");
- if (d&0x01) printf (" soft-reset");
- };
- printf ("\n");
- };
- printf ("\n");
- };
- printf ("\n");
-#ifndef __NetBSD__
- if (ncr.imask) {
- u_short v;
- printf ("Interrupt vector is");
- if (ncr.imask & (ncr.imask-1))
- printf (" one of the following:");
- for (v=15;v>0;v--)
- if ((ncr.imask>>v)&1)
- printf (" %d",v);
- printf (".\n\n");
- };
-#endif
-}
-
-/*================================================================
-**
-**
-** profiling
-**
-**
-**================================================================
-*/
-
-do_profile(void)
-{
-#define old backup.profile
-#define new ncr.profile
-
- struct ncb backup;
- struct profile diff;
- int tra,line,t;
-
- open_kvm(O_RDONLY);
-
- set_target_mask();
-
- if (interval<1) interval=1;
- for (;;) {
- /*
- ** Header Line 1
- */
- printf (" total ");
-
- for (t=0; t<MAX_TARGET; t++) {
- if (!((target_mask>>t)&1)) continue;
- printf (" ");
- printc (&ncr.target[t].inqdata[16],8);
- };
-
- printf (" transf. disconn interru");
-
- if (verbose>=1) printf (" ---- ms/transfer ----");
-
- printf ("\n");
-
- /*
- ** Header Line 2
- */
-
- printf ("t/s kb/s ");
-
- for (t=0; t<MAX_TARGET; t++) {
- if (!((target_mask>>t)&1)) continue;
- printf (" t/s kb/s");
- };
-
- printf (" length exp une fly brk");
-
- if (verbose>=1) printf (" total pre post disc");
-
- printf ("\n");
-
- /*
- ** Data
- */
-
- for(line=0;line<20;line++) {
- backup = ncr;
- read_ncr();
- diff.num_trans = new.num_trans - old.num_trans;
- diff.num_bytes = new.num_bytes - old.num_bytes;
- diff.num_fly = new.num_fly - old.num_fly ;
- diff.num_int = new.num_int - old.num_int ;
- diff.ms_setup = new.ms_setup - old.ms_setup;
- diff.ms_data = new.ms_data - old.ms_data;
- diff.ms_disc = new.ms_disc - old.ms_disc;
- diff.ms_post = new.ms_post - old.ms_post;
- diff.num_disc = new.num_disc - old.num_disc;
- diff.num_break = new.num_break - old.num_break;
-
- tra = diff.num_trans;
- if (!tra) tra=1;
-
- printf ("%3.0f %4.0f ",
- (1.0 * diff.num_trans) / interval,
- (1.0 * diff.num_bytes) / (1024*interval));
-
-
- for (t=0; t<MAX_TARGET; t++) {
- if (!((target_mask>>t)&1)) continue;
- printf (" %3.0f %4.0f",
- ((ncr.target[t].transfers-
- backup.target[t].transfers)*1.0)
- /interval,
- ((ncr.target[t].bytes-
- backup.target[t].bytes)*1.0)
- /(1024*interval));
- };
-
- printf ("%7.0f ", (diff.num_bytes*1.0) / tra);
-
- printf (" %4.0f", (1.0*(diff.num_disc-diff.num_break))
- /interval);
-
- printf ("%4.0f", (1.0*diff.num_break)/interval);
-
- printf ("%4.0f", (1.0*diff.num_fly) / interval);
-
- printf ("%4.0f", (1.0*diff.num_int) / interval);
-
- if (verbose >= 1) {
- printf ("%7.1f",
- (diff.ms_disc+diff.ms_data+diff.ms_setup+diff.ms_post)
- * 1.0 / tra);
-
- printf ("%5.1f%5.1f%6.1f",
- 1.0 * diff.ms_setup / tra,
- 1.0 * diff.ms_post / tra,
- 1.0 * diff.ms_disc / tra);
- };
-
- printf ("\n");
- fflush (stdout);
- sleep (interval);
- };
- };
-}
-
-/*================================================================
-**
-**
-** Port access
-**
-**
-**================================================================
-*/
-
-static int kernelwritefile;
-static char* kernelwritefilename = _PATH_KMEM;
-
-void openkernelwritefile(void)
-{
- if (kernelwritefile) return;
-
- kernelwritefile = open (kernelwritefilename, O_WRONLY);
- if (kernelwritefile<3) {
- fprintf (stderr, "%s: %s: %s\n",
- prog, kernelwritefilename, strerror(errno));
- exit (1);
- };
-}
-
-void out (u_char reg, u_char val)
-{
- u_long addr = ncr.vaddr + reg;
- openkernelwritefile();
- if (lseek (kernelwritefile, addr, 0) != addr) {
- fprintf (stderr, "%s: %s: %s\n",
- prog, kernelwritefilename, strerror(errno));
- exit (1);
- }
- if (write (kernelwritefile, &val, 1) < 0) {
- fprintf (stderr, "%s: %s: %s\n",
- prog, kernelwritefilename, strerror(errno));
- exit (1);
- };
-}
-
-u_char in (u_char reg)
-{
- u_char res;
- if (!KVM_READ (
- (ncr.vaddr + reg),
- &res,
- 1)) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- }
- return (res);
-}
-
-/*================================================================
-**
-**
-** Setting of driver parameters
-**
-**
-**================================================================
-*/
-
-void do_set (char * arg)
-{
- struct usrcmd user;
- u_long addr;
- int i;
-
- open_kvm(O_RDWR);
- addr = ncr_base + offsetof (struct ncb, user);
-
- for (i=3; i; i--) {
- if (!KVM_READ (
- (addr),
- &user,
- sizeof (user))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- }
- if (!user.cmd) break;
- sleep (1);
- }
- if (user.cmd) {
- fprintf (stderr, "%s: ncb.user busy.\n", prog);
- exit (1);
- };
-
- user.target = target_mask;
- user.lun = lun_mask;
- user.data = 0;
- user.cmd = 0;
-
- if (!strcmp(arg, "?")) { printf (
-"async: disable synchronous transfers.\n"
-"sync=value: set the maximal synchronous transfer rate (MHz).\n"
-"fast: set FAST SCSI-2.\n"
-"\n"
-"wide=value: set the bus width (0=8bit 1=16bit).\n"
-"\n"
-"tags=value: use this number of tags.\n"
-"orderedtag: use ordered tags only.\n"
-"simpletag: use simple tags only.\n"
-"orderedwrite: use simple tags for read, else ordered tags.\n"
-"\n"
-"debug=value: set debug mode.\n"
-"\n");
- return;
- };
-
- if (!strcmp(arg, "async")) {
- user.data = 255;
- user.cmd = UC_SETSYNC;
- };
-
- if (!strcmp(arg, "fast")) {
- user.data = 25;
- user.cmd = UC_SETSYNC;
- };
-
- if (!strncmp(arg, "sync=", 5)) {
- float f = strtod (arg+5, NULL);
- if (f>=4.0 && f<=10.0) {
- user.data = 250.0 / f;
- user.cmd = UC_SETSYNC;
- };
- };
-
- if (!strncmp(arg, "wide=", 5)) {
- u_char t = strtoul (arg+5, (char**)0, 0);
- if (t<=1) {
- user.data = t;
- user.cmd = UC_SETWIDE;
- };
- };
-
- if (!strncmp(arg, "tags=", 5)) {
- u_char t = strtoul (arg+5, (char**)0, 0);
- if (t<=SCSI_NCR_MAX_TAGS) {
- user.data = t;
- user.cmd = UC_SETTAGS;
- };
- };
-
- if (!strncmp(arg, "flags=", 6)) {
- u_char t = strtoul (arg+6, (char**)0, 0);
- if (t<=0xff) {
- user.data = t;
- user.cmd = UC_SETFLAG;
- };
- };
-
- if (!strncmp(arg, "debug=", 6)) {
- user.data = strtoul (arg+6, (char**)0, 0);
- user.cmd = UC_SETDEBUG;
- };
-
- if (!strcmp(arg, "orderedtag")) {
- user.data = M_ORDERED_TAG;
- user.cmd = UC_SETORDER;
- };
-
- if (!strcmp(arg, "simpletag")) {
- user.data = M_SIMPLE_TAG;
- user.cmd = UC_SETORDER;
- };
-
- if (!strcmp(arg, "orderedwrite")) {
- user.data = 0;
- user.cmd = UC_SETORDER;
- };
-
- if (user.cmd) {
- openkernelwritefile();
-
- if (lseek (kernelwritefile, addr, 0) != addr) {
- fprintf (stderr, "%s: %s: %s\n",
- prog, kernelwritefilename, strerror(errno));
- exit (1);
- }
- if (write (kernelwritefile, &user, sizeof (user)) < 0) {
- fprintf (stderr, "%s: %s: %s\n",
- prog, kernelwritefilename, strerror(errno));
- exit (1);
- }
-
- return;
- };
-
- fprintf (stderr, "%s: do_set \"%s\" not (yet) implemented.\n",
- prog, arg);
-}
-
-/*================================================================
-**
-**
-** D O _ K I L L
-**
-**
-**================================================================
-*/
-
-do_kill(char * arg)
-{
- open_kvm(O_RDWR);
-
- if (!strcmp(arg, "?")) { printf (
-"scsireset: force SCSI bus reset.\n"
-"scriptabort: send an abort cmd to the script processor.\n"
-"scriptstart: start script processind (set SIGP bit).\n"
-"evenparity: force even parity.\n"
-"oddparity: force odd parity.\n"
-"noreselect: disable reselect (force timeouts).\n"
-"doreselect: enable reselect.\n"
-"\n");
- return;
- };
-
- if (!wizard) {
- fprintf (stderr, "%s: You are NOT a wizard!\n", prog);
- exit (2);
- };
-
- if (!strcmp(arg, "scsireset")) {
- out (0x01, 0x08);
- out (0x01, 0x00);
- return;
- };
- if (!strcmp(arg, "scriptabort")) {
- out (0x14, 0x80);
- out (0x14, 0x20);
- return;
- };
- if (!strcmp(arg, "scriptstart")) {
- out (0x14, 0x20);
- return;
- };
- if (!strcmp(arg, "evenparity")) {
- out (0x01, 0x04);
- return;
- };
- if (!strcmp(arg, "oddparity")) {
- out (0x01, 0x00);
- return;
- };
- if (!strcmp(arg, "noreselect")) {
- out (0x04, in (0x04) & ~RRE);
- return;
- };
- if (!strcmp(arg, "doreselect")) {
- out (0x04, in (0x04) | RRE);
- return;
- };
- fprintf (stderr, "%s: do_kill \"%s\" not (yet) implemented.\n",
- prog, arg);
-}
-
-/*================================================================
-**
-**
-** Write debug info: utilities: write symbolname.
-**
-**
-**================================================================
-*/
-
-static const char * sn (u_long a)
-{
- static char buffer[100];
-
- const char * s="";
- u_long d,m;
-
- a -= ncr.p_script;
- m = sizeof (struct script);
-
- if ((d=a-offsetof(struct script, start))<m) m=d, s="<start>";
- if ((d=a-offsetof(struct script, start1))<m) m=d, s="<start1>";
- if ((d=a-offsetof(struct script, startpos))<m) m=d, s="<startpos>";
- if ((d=a-offsetof(struct script, tryloop))<m) m=d, s="<tryloop>";
- if ((d=a-offsetof(struct script, trysel))<m) m=d, s="<trysel>";
- if ((d=a-offsetof(struct script, skip))<m) m=d, s="<skip>";
- if ((d=a-offsetof(struct script, skip2))<m) m=d, s="<skip2>";
- if ((d=a-offsetof(struct script, idle))<m) m=d, s="<idle>";
- if ((d=a-offsetof(struct script, select))<m) m=d, s="<select>";
- if ((d=a-offsetof(struct script, prepare))<m) m=d, s="<prepare>";
- if ((d=a-offsetof(struct script, loadpos))<m) m=d, s="<loadpos>";
- if ((d=a-offsetof(struct script, prepare2))<m) m=d, s="<prepare2>";
- if ((d=a-offsetof(struct script, setmsg))<m) m=d, s="<setmsg>";
- if ((d=a-offsetof(struct script, clrack))<m) m=d, s="<clrack>";
- if ((d=a-offsetof(struct script, dispatch))<m) m=d, s="<dispatch>";
- if ((d=a-offsetof(struct script, checkatn))<m) m=d, s="<checkatn>";
- if ((d=a-offsetof(struct script, command))<m) m=d, s="<command>";
- if ((d=a-offsetof(struct script, status))<m) m=d, s="<status>";
- if ((d=a-offsetof(struct script, msg_in))<m) m=d, s="<msg_in>";
- if ((d=a-offsetof(struct script, msg_bad))<m) m=d, s="<msg_bad>";
- if ((d=a-offsetof(struct script, msg_parity))<m) m=d, s="<msg_parity>";
- if ((d=a-offsetof(struct script, msg_reject))<m) m=d, s="<msg_reject>";
- if ((d=a-offsetof(struct script, msg_extended))<m) m=d, s="<msg_extended>";
- if ((d=a-offsetof(struct script, msg_sdtr))<m) m=d, s="<msg_sdtr>";
- if ((d=a-offsetof(struct script, complete))<m) m=d, s="<complete>";
- if ((d=a-offsetof(struct script, cleanup))<m) m=d, s="<cleanup>";
- if ((d=a-offsetof(struct script, cleanup0))<m) m=d, s="<cleanup>";
- if ((d=a-offsetof(struct script, signal))<m) m=d, s="<signal>";
- if ((d=a-offsetof(struct script, save_dp))<m) m=d, s="<save_dp>";
- if ((d=a-offsetof(struct script, restore_dp))<m) m=d, s="<restore_dp>";
- if ((d=a-offsetof(struct script, disconnect))<m) m=d, s="<disconnect>";
- if ((d=a-offsetof(struct script, msg_out))<m) m=d, s="<msg_out>";
- if ((d=a-offsetof(struct script, msg_out_done))<m) m=d, s="<msg_out_done>";
- if ((d=a-offsetof(struct script, msg_out_abort))<m) m=d, s="<msg_out_abort>";
- if ((d=a-offsetof(struct script, getcc))<m) m=d, s="<getcc>";
- if ((d=a-offsetof(struct script, getcc1))<m) m=d, s="<getcc1>";
- if ((d=a-offsetof(struct script, getcc2))<m) m=d, s="<getcc2>";
- if ((d=a-offsetof(struct script, badgetcc))<m) m=d, s="<badgetcc>";
- if ((d=a-offsetof(struct script, reselect))<m) m=d, s="<reselect>";
- if ((d=a-offsetof(struct script, reselect2))<m) m=d, s="<reselect2>";
- if ((d=a-offsetof(struct script, resel_tmp))<m) m=d, s="<resel_tmp>";
- if ((d=a-offsetof(struct script, resel_lun))<m) m=d, s="<resel_lun>";
- if ((d=a-offsetof(struct script, resel_tag))<m) m=d, s="<resel_tag>";
- if ((d=a-offsetof(struct script, data_in))<m) m=d, s="<data_in>";
- if ((d=a-offsetof(struct script, data_out))<m) m=d, s="<data_out>";
- if ((d=a-offsetof(struct script, no_data))<m) m=d, s="<no_data>";
- if ((d=a-offsetof(struct script, aborttag))<m) m=d, s="<aborttag>";
- if ((d=a-offsetof(struct script, abort))<m) m=d, s="<abort>";
-
- if (!*s) return s;
-
- sprintf (buffer, "%s:%d%c", s, m/4, 0);
- return (buffer);
-}
-
-/*================================================================
-**
-**
-** Write debug info: utilities: write misc. fields.
-**
-**
-**================================================================
-*/
-
-static void printm (u_char * msg, int len)
-{
- u_char l;
- do {
- if (*msg==M_EXTENDED)
- l=msg[1]+2;
- else if ((*msg & 0xf0)==0x20)
- l=2;
- else l=1;
- len-=l;
-
- printf (" %x",*msg++);
- while (--l>0) printf ("-%x",*msg++);
- } while (len>0);
-}
-
-void dump_table (const char * str, struct scr_tblmove * p, int l)
-{
- int i;
- for (i=0;l>0;i++,p++,l--) if (p->size) {
- printf (" %s[%d]: %5d @ 0x%08x\n",
- str, i, p->size, p->addr);
- };
-}
-
-void dump_link (const char* name, struct link * link)
-{
- printf ("%s: cmd=%08x pa=%08x %s\n",
- name, link->l_cmd, link->l_paddr, sn(link->l_paddr));
-}
-
-/*================================================================
-**
-**
-** Write debug info: utilities: write time fields.
-**
-**
-**================================================================
-*/
-
-void dump_tstamp (const char* name, struct tstamp * p)
-#define P(id,fld)\
- if (p->fld.tv_sec) \
- printf ("%s: "id" at %s.%06d",\
- name,ctime(&p->fld.tv_sec),p->fld.tv_usec);
-{
- P ("started ", start);
- P ("ended ", end );
- P ("selected ", select);
- P ("command ", command);
- P ("data ", data);
- P ("status ", status);
- P ("disconnected", disconnect);
- P ("reselected ", reselect);
- printf ("\n");
-}
-
-
-
-
-void dump_profile (const char* name, struct profile * p)
-{
- printf ("%s: %10d transfers.\n" ,name,p->num_trans);
- printf ("%s: %10d bytes transferred.\n",name,p->num_bytes);
- printf ("%s: %10d disconnects.\n" ,name,p->num_disc);
- printf ("%s: %10d short transfers.\n" ,name,p->num_break);
- printf ("%s: %10d interrupts.\n" ,name,p->num_int);
- printf ("%s: %10d on the fly ints.\n" ,name,p->num_fly);
- printf ("%s: %10d ms setup time.\n" ,name,p->ms_setup);
- printf ("%s: %10d ms data transfer.\n" ,name,p->ms_data);
- printf ("%s: %10d ms disconnected.\n" ,name,p->ms_disc);
- printf ("%s: %10d ms postprocessing.\n",name,p->ms_post);
- printf ("\n");
-}
-
-/*================================================================
-**
-**
-** Write debug info: utilities: write script registers.
-**
-**
-**================================================================
-*/
-
-static void dump_reg(struct ncr_reg * rp)
-{
- u_char *reg = (u_char*) rp;
-#define l(i) (reg[i]+(reg[i+1]<<8ul)+(reg[i+2]<<16ul)+(reg[i+3]<<24ul))
- int ad;
-
- char*(phasename[8])={"DATA-OUT","DATA-IN","COMMAND","STATUS",
- "ILG-OUT","ILG-IN","MESSAGE-OUT","MESSAGE-IN"};
- for (ad=0x00;ad<0x80;ad++) {
- switch (ad % 16) {
-
- case 0:
- printf (" %02x:\t",ad);
- break;
- case 8:
- printf (" : ");
- break;
- default:
- printf (" ");
- };
- printf ("%02x", reg[ad]);
- if (ad % 16 == 15) printf ("\n");
- };
- printf ("\n");
- printf (" DSP %08x %-20s CMD %08x DSPS %08x %s\n",
- l(0x2c),sn(l(0x2c)),l(0x24),l(0x30), sn(l(0x30)));
- printf (" TEMP %08x %-20s DSA %08x\n",
- l(0x1c),sn(l(0x1c)),l(0x10));
- printf ("\n");
- printf (" Busstatus: ");
- if ((reg[0x0b]>>7)&1) printf (" Req");
- if ((reg[0x0b]>>6)&1) printf (" Ack");
- if ((reg[0x0b]>>5)&1) printf (" Bsy");
- if ((reg[0x0b]>>4)&1) printf (" Sel");
- if ((reg[0x0b]>>3)&1) printf (" Atn");
- printf (" %s\n", phasename[reg[0x0b]&7]);
-
- printf (" Dmastatus: ");
- if ((reg[0x0c]>>7)&1) printf (" FifoEmpty");
- if ((reg[0x0c]>>6)&1) printf (" MasterParityError");
- if ((reg[0x0c]>>5)&1) printf (" BusFault");
- if ((reg[0x0c]>>4)&1) printf (" Aborted");
- if ((reg[0x0c]>>3)&1) printf (" SingleStep");
- if ((reg[0x0c]>>2)&1) printf (" Interrupt");
- if ((reg[0x0c]>>0)&1) printf (" IllegalInstruction");
- printf ("\n");
- printf (" Intstatus: ");
- if ((reg[0x14]>>7)&1) printf (" Abort");
- if ((reg[0x14]>>6)&1) printf (" SoftwareReset");
- if ((reg[0x14]>>5)&1) printf (" SignalProcess");
- if ((reg[0x14]>>4)&1) printf (" Semaphore");
- if ((reg[0x14]>>3)&1) printf (" Connected");
- if ((reg[0x14]>>2)&1) printf (" IntOnTheFly");
- if ((reg[0x14]>>1)&1) printf (" SCSI-Interrupt");
- if ((reg[0x14]>>0)&1) printf (" DMA-Interrupt");
- printf ("\n");
- printf (" ScsiIstat: ");
- if ((reg[0x42]>>7)&1) printf (" PhaseMismatch");
- if ((reg[0x42]>>6)&1) printf (" Complete");
- if ((reg[0x42]>>5)&1) printf (" Selected");
- if ((reg[0x42]>>4)&1) printf (" Reselected");
- if ((reg[0x42]>>3)&1) printf (" GrossError");
- if ((reg[0x42]>>2)&1) printf (" UnexpectedDisconnect");
- if ((reg[0x42]>>1)&1) printf (" ScsiReset");
- if ((reg[0x42]>>0)&1) printf (" ParityError");
- if ((reg[0x43]>>2)&1) printf (" SelectionTimeout");
- if ((reg[0x43]>>1)&1) printf (" TimerExpired");
- if ((reg[0x43]>>0)&1) printf (" HandshakeTimeout");
- printf ("\n");
- printf (" ID=%d DEST-ID=%d RESEL-ID=%d\n", reg[4]&7, reg[6]&7, reg[0xa]&7);
- printf ("\n");
-}
-
-/*================================================================
-**
-**
-** Write debug info: utilities: write header.
-**
-**
-**================================================================
-*/
-
-char * debug_opt;
-
-dump_head (struct head * hp)
-{
- dump_link (" launch", & hp->launch);
- printf (" savep: %08x %s\n",
- hp->savep, sn((u_long) hp->savep));
- printf (" cp: %08x %s\n",
- hp->cp, sn((u_long)hp->cp));
- if (strchr (debug_opt, 'y')) {
- printf ("\n");
- dump_tstamp (" timestamp", &hp->stamp);
- };
-
- printf (" status: %x %x %x %x %x %x %x %x\n",
- hp->status[0], hp->status[1], hp->status[2], hp->status[3],
- hp->status[4], hp->status[5], hp->status[6], hp->status[7]);
-
- printf ("\n");
-}
-
-/*================================================================
-**
-**
-** Write debug info: utilities: write ccb.
-**
-**
-**================================================================
-*/
-
-void dump_ccb (struct ccb * cp, u_long base)
-{
- printf ("----------------------\n");
- printf ("struct ccb @ %08x:\n", base);
- printf ("----------------------\n");
-
- dump_link (" next", &cp->jump_ccb);
- dump_link (" call", &cp->call_tmp);
-
- dump_head (&cp->phys.header);
-
- if (strchr (debug_opt, 's')) {
- dump_table(" smsg", &cp->phys.smsg, 1);
- dump_table("smsg2", &cp->phys.smsg2, 1);
- dump_table(" cmd", &cp->phys.cmd, 1);
- dump_table(" data", &cp->phys.data[0],MAX_SCATTER);
- dump_table("sense", &cp->phys.sense, 1);
- };
-
- if (strchr (debug_opt, 'a')) {
- int i;
- for (i=0; i<8; i++)
- printf (" patch[%d]: %08x\n", i, cp->patch[i]);
- };
-
- if (strchr (debug_opt, 'x')) {
- printf (" xfer: -- dump not yet implemented.\n");
- };
-
- if (strchr (debug_opt, 'm')) {
- printf (" smsg:");
- printm (cp->scsi_smsg, cp->phys.smsg.size);
- printf ("\n");
- printf (" smsg2:");
- printm (cp->scsi_smsg2, cp->phys.smsg2.size);
- printf ("\n");
- };
-
- printf (" magic: %x\n", cp->magic);
- if (cp->tlimit)
- printf (" timeout at: %s", ctime((time_t*)&cp->tlimit));
- printf (" link_ccb: %08x\n", (u_long) cp->link_ccb);
- printf (" next_ccb: %08x\n", (u_long) cp->next_ccb);
- printf (" tag: %d\n", cp->tag);
- printf ("\n");
-}
-
-/*================================================================
-**
-**
-** Write debug info: struct lcb
-**
-**
-**================================================================
-*/
-
-static void dump_lcb (u_long base)
-{
- struct lcb l;
- struct ccb c;
- u_long cp,cn;
-
- printf ("----------------------\n");
- printf ("struct lcb @ %08x:\n", base);
- printf ("----------------------\n");
-
- if (!KVM_READ (
- base,
- &l,
- sizeof (struct lcb))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
- printf (" reqccbs: %d\n", l.reqccbs);
- printf (" actccbs: %d\n", l.actccbs);
- printf (" reqlink: %d\n", l.reqlink);
- printf (" actlink: %d\n", l.actlink);
- printf (" usetags: %d\n", l.usetags);
- dump_link (" jump_lcb", &l.jump_lcb);
- dump_link (" call_tag", &l.call_tag);
- dump_link (" jump_ccb", &l.jump_ccb);
- printf ("\n");
- cp = (u_long) l.next_ccb;
- cn = 0;
- while (cp) {
- cn++;
- printf ("ccb #%d:\n", cn);
- if (!KVM_READ (
- cp,
- &c,
- sizeof (struct ccb))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
- dump_ccb (&c, cp);
- cp= (u_long) c.next_ccb;
- };
-}
-
-/*================================================================
-**
-**
-** Write debug info: struct tcb
-**
-**
-**================================================================
-*/
-
-static void dump_tip (struct tcb * tip)
-{
- int i;
- u_long lp;
-
- printf ("----------------------\n");
- printf ("struct tcb:\n");
- printf ("----------------------\n");
-
- printf (" transfers:%10d.\n", tip->transfers);
- printf (" bytes:%10d.\n", tip->bytes );
- printf (" user limits: usrsync=%d usrwide=%d usrtags=%d.\n",
- tip->usrsync, tip->usrwide, tip->usrtags);
- printf (" sync: minsync=%d, maxoffs=%d, period=%d ns, sval=%x.\n",
- tip->minsync, tip->maxoffs, tip->period, tip->sval);
- printf (" wide: widedone=%d, wval=%x.\n",
- tip->widedone, tip->wval);
-
- printf (" hold_cp: %x\n", tip->hold_cp);
- dump_link (" jump_tcb", &tip->jump_tcb);
- dump_link (" call_lun", &tip->call_lun);
- dump_link (" jump_lcb", &tip->jump_lcb);
- if (tip->hold_cp) printf (" hold_cp: @ %x\n", tip->hold_cp);
- printf ("\n");
-
- if (strchr (debug_opt, 'l')) {
- for (i=0;i<MAX_LUN;i++) {
- lp= (u_long) tip->lp[i];
- printf ("logic unit #%d:\n", i);
- if (lp) dump_lcb (lp);
- };
- }
-}
-
-/*================================================================
-**
-**
-** Write debug info: struct ncb
-**
-**
-**================================================================
-*/
-
-
-static void dump_ncr (void)
-{
- u_long tp;
- int i;
-
- printf ("----------------------\n");
- printf ("struct ncb @ %x:\n", ncr_base);
- printf ("----------------------\n");
-
- dump_link (" jump_tcb", &ncr.jump_tcb);
- printf (" register: @ %x (p=%x)\n", ncr.vaddr, ncr.paddr);
-
- if (strchr (debug_opt, 'r')) {
- struct ncr_reg reg;
-
- if (!KVM_READ (
- ncr.vaddr,
- &reg,
- sizeof (reg))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
-
- printf ("\n");
- dump_reg (&reg);
- };
-
- printf (" script: @ %x (p=%x)\n", ncr.script, ncr.p_script);
-
- printf ("hostscsiaddr: %d\n", ncr.myaddr);
- printf (" ns_async: %d ns\n", ncr.ns_async);
- printf (" ns_sync : %d ns\n", ncr.ns_sync);
- printf (" scntl3: 0x%02x\n", ncr.rv_scntl3);
- printf ("\n");
-
- /* sc_link not dumped */
-
- if (strchr (debug_opt, 'u')) {
- printf (" usercmd: cmd=%x data=%x target=%x lun=%x\n",
- ncr.user.cmd,
- ncr.user.data,
- ncr.user.target,
- ncr.user.lun);
- };
-
- printf (" actccbs: %d\n", ncr.actccbs);
-
- if (strchr (debug_opt, 'q')) {
-
- u_long startpos;
-
- if (!KVM_READ (
- ((u_long)ncr.script
- +offsetof(struct script, startpos)),
- &startpos,
- sizeof (startpos))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
-
- printf (" startpos: %x\n", startpos);
- printf (" slot: %d\n", (startpos-
- (ncr.p_script+offsetof(struct script, tryloop)))/20);
- printf (" squeuput: %d\n", ncr.squeueput);
- for (i=0; i<MAX_START; i++)
- printf ("%12d: %08x %s\n", i,
- ncr.squeue[i], sn(ncr.squeue[i]));
-
- printf ("\n");
- };
-
- printf (" ticks: %d ms\n", ncr.ticks * 10);
- printf (" heartbeat: %s", ctime ((time_t*)&ncr.heartbeat));
- printf (" lasttime: %s", ctime ((time_t*)&ncr.lasttime));
-#ifndef __NetBSD__
- printf ("imask/mcount: %x / %d\n", ncr.imask, ncr.mcount);
-#endif
- printf ("\n");
-
- if (strchr (debug_opt, 'd') && ncr.regtime.tv_sec) {
- printf (" regdump: %s", ctime (&ncr.regtime.tv_sec));
- dump_reg (&ncr.regdump);
- };
-
- if (strchr (debug_opt, 'p')) {
- printf ("\n");
- dump_profile (" profile", &ncr.profile);
- };
-
- if (strchr (debug_opt, 'h')) {
- printf ("\n");
- dump_head ( &ncr.header);
- };
-
- if (strchr (debug_opt, 'c')) {
- dump_ccb (&ncr.ccb, ncr_base + offsetof (struct ncb, ccb));
- };
-
- if (strchr (debug_opt, 'm')) {
- printf (" msgout:"); printm (ncr.msgout,0); printf ("\n");
- printf (" msg in:"); printm (ncr.msgin,0); printf ("\n");
- printf ("\n");
- };
-
- if (strchr (debug_opt, 't')) {
- struct tcb * tip;
- for (i=0;i<MAX_TARGET;i++) {
- tip = &ncr.target[i];
- if (!tip->jump_tcb.l_cmd) continue;
- printf ("target #%d:\n", i);
- dump_tip (tip);
- }
- }
-}
-
-/*================================================================
-**
-**
-** D O _ D E B U G
-**
-**
-**================================================================
-*/
-
-
-do_debug(char * arg)
-{
- open_kvm(O_RDONLY);
- debug_opt = arg;
- if (strchr (debug_opt, '?')) printf (
-"'?': list debug options [sic].\n"
-"'a': show patchfields in ccbs (requires c).\n"
-"'c': show ccbs.\n"
-"'d': show register dump.\n"
-"'h': show header information.\n"
-"'m': show message buffers.\n"
-"'n': show ncr main control block.\n"
-"'p': show profiling information.\n"
-"'q': show start queue.\n"
-"'r': show registers (*DANGEROUS*).\n"
-"'s': show scatter/gather info.\n"
-"'t': show target control blocks.\n"
-"'u': show user cmd field.\n"
-"'x': show generic xfer structure.\n"
-"'y': show timestamps.\n"
-"\n"
- );
-
- if (strchr (debug_opt, 'n')) dump_ncr ();
- if (strchr (debug_opt, 'r')) {
- struct ncr_reg reg;
- if (!KVM_READ (
- ncr.vaddr,
- &reg,
- sizeof (reg))) {
- fprintf (stderr, "%s: bad kvm read.\n", prog);
- exit (1);
- };
- dump_reg (&reg);
- };
-}
-
-
-/*================================================================
-**
-**
-** Main function
-**
-**
-**================================================================
-*/
-
-void main(argc, argv)
- int argc;
- char **argv;
-{
- extern char *optarg;
- extern int optind;
- int usage=0;
- char * charp;
- int ch, getopt(),atoi();
- int i,step;
-
- prog = *argv;
- while ((ch = getopt(argc, argv, "M:N:u:f:t:l:p:s:k:d:vwhin:?")) != -1)
- switch((char)ch) {
- case 'M':
- if (kvm_isopen) {
- fprintf (stderr,
- "%s: -M: kernel file already open.\n",
- prog);
- exit (1);
- };
- kmemf = optarg;
- break;
- case 'N':
- if (kvm_isopen) {
- fprintf (stderr,
- "%s: -N: symbol table already open.\n",
- prog);
- exit (1);
- };
- vmunix = optarg;
- break;
- case 'f':
- fprintf (stderr,
- "%s: -f: option not yet implemented.\n",
- prog);
- exit (1);
-
- case 'u':
- i = strtoul (optarg, &charp, 0);
- if (!*optarg || *charp || (i<0)) {
- fprintf (stderr,
- "%s: bad unit number \"%s\".\n",
- prog, optarg);
- exit (1);
- }
- ncr_unit = i;
- break;
- case 't':
- i = strtoul (optarg, &charp, 0);
- if (!*optarg || *charp || (i<0) || (i>=MAX_TARGET)) {
- fprintf (stderr,
- "%s: bad target number \"%s\" (valid range: 0-%d).\n",
- prog, optarg, MAX_TARGET-1);
- exit (1);
- }
- target_mask |= 1ul << i;
- break;
- case 'n':
- open_kvm(O_RDONLY);
- i = strtoul (optarg, &charp, 0);
- printf ("addr %d (0x%x) has label %s.\n",
- i,i,sn(i));
- break;
- case 'l':
- i = strtoul (optarg, &charp, 0);
- if (!*optarg || *charp || (i<0) || (i>=MAX_LUN)) {
- fprintf (stderr,
- "%s: bad logic unit number \"%s\" (valid range: 0-%d).\n",
- prog, optarg, MAX_LUN);
- exit (1);
- }
- global_lun_mask |= 1ul << i;
- break;
- case 'p':
- i = strtoul (optarg, &charp, 0);
- if (!*optarg || *charp || (i<1) || (i>60)) {
- fprintf (stderr,
- "%s: bad interval \"%s\".\n",
- prog, optarg);
- exit (1);
- }
- interval = i;
- do_profile();
- break;
-
- case 'w':
- wizard=1;
- break;
- case 'v':
- verbose++;
- break;
- case 'i':
- do_info();
- break;
-
- case 's':
- do_set(optarg);
- break;
- case 'd':
- do_debug(optarg);
- break;
- case 'k':
- do_kill(optarg);
- break;
- case 'h':
- case '?':
- usage++;
- break;
- default:(void)fprintf(stderr,
- "%s: illegal option \"%c\".\n", prog, ch);
- usage++;
- }
-
- argv += optind;
- argc -= optind;
-
- if (argc) printf ("%s: rest of line starting with \"%s\" ignored.\n",
- prog, *argv);
-
- if (verbose&&!kvm_isopen) usage++;
- if (usage) {
- fprintf (stderr,
- "Usage:\n"
- "\n"
- "%s [-M$] [-N$] {-f$} {-t#} {-l#} [-hivw?] [-d$] [-s$] [-k] [[-p] <time>]\n"
- "\n"
- "-t <#> select target number\n"
- "-l <#> select lun number\n"
- "-i get info\n"
- "-v verbose\n"
- "-p <seconds> performance data\n"
- "\n"
- "Wizards only (proceed on your own risk):\n"
- "-n <#> get the name for address #\n"
- "-w wizard mode\n"
- "-d <options> debug info\n"
- "-d? list debug options\n"
- "-s <param=value> set parameter\n"
- "-s? list parameters\n"
- "-k <torture> torture driver by simulating errors\n"
- "-k? list tortures\n"
- "-M <kernelimage> (default: %s)\n"
- "-N <symboltable> (default: %s)\n"
- , prog, _PATH_KMEM, _PATH_UNIX);
- if (verbose) fprintf (stderr, ident);
- exit (1);
- }
-
- if (!kvm_isopen) {
- do_info();
- do_profile();
- };
- exit (0);
-}
diff --git a/sys/i386/pci/pci.c b/sys/i386/pci/pci.c
deleted file mode 100644
index 6ef7163..0000000
--- a/sys/i386/pci/pci.c
+++ /dev/null
@@ -1,778 +0,0 @@
-/**************************************************************************
-**
-** $Id: pci.c,v 1.8 1994/10/25 23:09:08 se Exp $
-**
-** General subroutines for the PCI bus on 80*86 systems.
-** pci_configure ()
-**
-** 386bsd / FreeBSD
-**
-**-------------------------------------------------------------------------
-**
-** Copyright (c) 1994 Wolfgang Stanglmeier. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-***************************************************************************
-*/
-
-#include <pci.h>
-#if NPCI > 0
-
-#ifndef __FreeBSD2__
-#if __FreeBSD__ >= 2
-#define __FreeBSD2__
-#endif
-#endif
-
-/*========================================================
-**
-** #includes and declarations
-**
-**========================================================
-*/
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/errno.h>
-
-#include <vm/vm.h>
-#include <vm/vm_param.h>
-
-#include <i386/isa/isa.h>
-#include <i386/isa/isa_device.h>
-#include <i386/isa/icu.h>
-#include <i386/pci/pcireg.h>
-
-#ifdef __FreeBSD2__
-#include <sys/devconf.h>
-
-struct pci_devconf {
- struct kern_devconf pdc_kdc;
- struct pci_info pdc_pi;
-};
-#endif
-
-/*
-** Function prototypes missing in system headers
-*/
-
-#ifndef __FreeBSD2__
-extern pmap_t pmap_kernel(void);
-static vm_offset_t pmap_mapdev (vm_offset_t paddr, vm_size_t vsize);
-
-/*
- * Type of the first (asm) part of an interrupt handler.
- */
-typedef void inthand_t __P((u_int cs, u_int ef, u_int esp, u_int ss));
-
-/*
- * Usual type of the second (C) part of an interrupt handler. Some bogus
- * ones need the arg to be the interrupt frame (and not a copy of it, which
- * is all that is possible in C).
- */
-typedef void inthand2_t __P((int unit));
-
-/*
-** XXX @FreeBSD2@
-**
-** Unfortunately, the mptr argument is _no_ pointer in 2.0 FreeBSD.
-** We would prefer a pointer because it enables us to install
-** new interrupt handlers at any time.
-** (This is just going to be changed ... <se> :)
-** In 2.0 FreeBSD later installed interrupt handlers may change
-** the xyz_imask, but this would not be recognized by handlers
-** which are installed before.
-*/
-
-static int
-register_intr __P((int intr, int device_id, unsigned int flags,
- inthand2_t *handler, unsigned int * mptr, int unit));
-extern unsigned intr_mask[ICU_LEN];
-
-#endif /* !__FreeBSD2__ */
-
-/*========================================================
-**
-** Autoconfiguration of pci devices.
-**
-** This is reverse to the isa configuration.
-** (1) find a pci device.
-** (2) look for a driver.
-**
-**========================================================
-*/
-
-/*--------------------------------------------------------
-**
-** The pci devices can be mapped to any address.
-** As default we start at the last gigabyte.
-**
-**--------------------------------------------------------
-*/
-
-#ifndef PCI_PMEM_START
-#define PCI_PMEM_START 0xc0000000
-#endif
-
-static vm_offset_t pci_paddr = PCI_PMEM_START;
-
-/*--------------------------------------------------------
-**
-** The pci device interrupt lines should have been
-** assigned by the bios. But if the bios failed to
-** to it, we set it.
-**
-**--------------------------------------------------------
-*/
-
-#ifndef PCI_IRQ
-#define PCI_IRQ 0
-#endif
-
-static u_long pci_irq = PCI_IRQ;
-
-/*---------------------------------------------------------
-**
-** pci_configure ()
-**
-** Probe all devices on pci bus and attach them.
-**
-** May be called more than once.
-** Any device is attached only once.
-** (Attached devices are remembered in pci_seen.)
-**
-**---------------------------------------------------------
-*/
-
-static void not_supported (pcici_t tag, u_long type);
-
-static unsigned long pci_seen[NPCI];
-
-static int pci_conf_count;
-
-#ifdef __FreeBSD2__
-static int
-pci_externalize (struct proc *, struct kern_devconf *, void *, size_t);
-
-static int
-pci_internalize (struct proc *, struct kern_devconf *, void *, size_t);
-
-#endif /* __FreeBSD2__ */
-
-void pci_configure()
-{
- u_char device,last_device;
- u_short bus;
- pcici_t tag;
- pcidi_t type;
- u_long data;
- int unit;
- int pci_mechanism;
- int pciint;
- int irq;
- char* name=0;
- vm_offset_t old_addr=pci_paddr;
-
- struct pci_driver *drp=0;
- struct pci_device *dvp;
-
-#ifdef __FreeBSD2__
- struct pci_devconf *pdcp;
-#endif
-
- /*
- ** check pci bus present
- */
-
- pci_mechanism = pci_conf_mode ();
- if (!pci_mechanism) return;
- last_device = pci_mechanism==1 ? 31 : 15;
-
- /*
- ** hello world ..
- */
-
-
- for (bus=0;bus<NPCI;bus++) {
-#ifndef PCI_QUIET
- printf ("pci%d: scanning device 0..%d, mechanism=%d.\n",
- bus, last_device, pci_mechanism);
-#endif
- for (device=0; device<=last_device; device ++) {
-
- if (pci_seen[bus] & (1ul << device))
- continue;
-
- tag = pcitag (bus, device, 0);
- type = pci_conf_read (tag, PCI_ID_REG);
-
- if ((!type) || (type==0xfffffffful)) continue;
-
- /*
- ** lookup device in ioconfiguration:
- */
-
- for (dvp = pci_devtab; dvp->pd_name; dvp++) {
- drp = dvp->pd_driver;
- if (!drp)
- continue;
- if ((name=(*drp->probe)(tag, type)))
- break;
- };
-
- if (!dvp->pd_name) {
-#ifndef PCI_QUIET
- if (pci_conf_count)
- continue;
- printf("pci%d:%d: ", bus, device);
- not_supported (tag, type);
-#endif
- continue;
- };
-
- pci_seen[bus] |= (1ul << device);
- /*
- ** Get and increment the unit.
- */
-
- unit = (*drp->count)++;
-
- /*
- ** ignore device ?
- */
-
- if (!*name) continue;
-
- /*
- ** Announce this device
- */
-
- printf ("%s%d <%s>", dvp->pd_name, unit, name);
-
- /*
- ** Get the int pin number (pci interrupt number a-d)
- ** from the pci configuration space.
- */
-
- data = pci_conf_read (tag, PCI_INTERRUPT_REG);
- pciint = PCI_INTERRUPT_PIN_EXTRACT(data);
-
- if (pciint) {
-
- printf (" int %c", 0x60+pciint);
-
- /*
- ** If the interrupt line register is not set,
- ** set it now from PCI_IRQ.
- */
-
- if (!(PCI_INTERRUPT_LINE_EXTRACT(data))) {
-
- irq = pci_irq & 0x0f;
- pci_irq >>= 4;
-
- data = PCI_INTERRUPT_LINE_INSERT(data, irq);
- printf (" (config)");
- pci_conf_write (tag, PCI_INTERRUPT_REG, data);
- };
-
- irq = PCI_INTERRUPT_LINE_EXTRACT(data);
-
- /*
- ** If it's zero, the isa irq number is unknown,
- ** and we cannot bind the pci interrupt to isa.
- */
-
- if (irq)
- printf (" irq %d", irq);
- else
- printf (" not bound");
- };
-
- /*
- ** enable memory access
- */
-
- data = (pci_conf_read (tag, PCI_COMMAND_STATUS_REG)
- & 0xffff) | PCI_COMMAND_MEM_ENABLE;
-
- pci_conf_write (tag, (u_char) PCI_COMMAND_STATUS_REG, data);
-
- /*
- ** show pci slot.
- */
-
- printf (" on pci%d:%d\n", bus, device);
-
-#ifdef __FreeBSD2__
-
- /*
- ** Allocate a devconf structure
- */
-
- pdcp = (struct pci_devconf *)
- malloc (sizeof (struct pci_devconf),M_DEVBUF,M_WAITOK);
-
- /*
- ** Fill in.
- **
- ** Sorry, this is not yet complete.
- ** We should, and eventually will, set the
- ** parent pointer to a pci bus devconf structure,
- ** and arrange to set the state field dynamically.
- **
- ** But I'll go to vacation today, and after all,
- ** wasn't there a new feature freeze on Oct 1.?
- */
-
- pdcp -> pdc_pi.pi_bus = bus;
- pdcp -> pdc_pi.pi_device = device;
-
- pdcp -> pdc_kdc.kdc_name = dvp->pd_name;
- pdcp -> pdc_kdc.kdc_unit = unit;
-
- pdcp -> pdc_kdc.kdc_md.mddc_devtype = MDDT_PCI;
-
- pdcp -> pdc_kdc.kdc_externalize = pci_externalize;
- pdcp -> pdc_kdc.kdc_internalize = pci_internalize;
-
- pdcp -> pdc_kdc.kdc_datalen = PCI_EXTERNAL_LEN;
- pdcp -> pdc_kdc.kdc_parentdata = &pdcp->pdc_pi;
- pdcp -> pdc_kdc.kdc_state = DC_UNKNOWN;
- pdcp -> pdc_kdc.kdc_description = name;
-
- /*
- ** And register this device
- */
-
- dev_attach (&pdcp->pdc_kdc);
-
-#endif /* __FreeBSD2__ */
-
-
- /*
- ** attach device
- ** may produce additional log messages,
- ** i.e. when installing subdevices.
- */
-
- (*drp->attach) (tag, unit);
- };
- };
-
-#ifndef PCI_QUIET
- if (pci_paddr != old_addr)
- printf ("pci uses physical addresses from 0x%lx to 0x%lx\n",
- (u_long)PCI_PMEM_START, (u_long)pci_paddr);
-#endif
- pci_conf_count++;
-}
-
-/*-----------------------------------------------------------------------
-**
-** Map device into port space.
-**
-** PCI-Specification: 6.2.5.1: address maps
-**
-**-----------------------------------------------------------------------
-*/
-
-int pci_map_port (pcici_t tag, u_long reg, u_short* pa)
-{
- /*
- ** @MAPIO@ not yet implemented.
- */
- printf ("pci_map_port failed: not yet implemented\n");
- return (0);
-}
-
-/*-----------------------------------------------------------------------
-**
-** Map device into virtual and physical space
-**
-** PCI-Specification: 6.2.5.1: address maps
-**
-**-----------------------------------------------------------------------
-*/
-
-int pci_map_mem (pcici_t tag, u_long reg, vm_offset_t* va, vm_offset_t* pa)
-{
- u_long data;
- vm_size_t vsize;
- vm_offset_t vaddr;
-
- /*
- ** sanity check
- */
-
- if (reg < PCI_MAP_REG_START || reg >= PCI_MAP_REG_END || (reg & 3)) {
- printf ("pci_map_mem failed: bad register=0x%x\n",
- (unsigned)reg);
- return (0);
- };
-
- /*
- ** get size and type of memory
- **
- ** type is in the lowest four bits.
- ** If device requires 2^n bytes, the next
- ** n-4 bits are read as 0.
- */
-
- pci_conf_write (tag, reg, 0xfffffffful);
- data = pci_conf_read (tag, reg);
-
- switch (data & 0x0f) {
-
- case PCI_MAP_MEMORY_TYPE_32BIT: /* 32 bit non cachable */
- break;
-
- default: /* unknown */
- printf ("pci_map_mem failed: bad memory type=0x%x\n",
- (unsigned) data);
- return (0);
- };
-
- /*
- ** mask out the type,
- ** and round up to a page size
- */
-
- vsize = round_page (-(data & PCI_MAP_MEMORY_ADDRESS_MASK));
-
- if (!vsize) return (0);
-
- /*
- ** align physical address to virtual size
- */
-
- if ((data = pci_paddr % vsize))
- pci_paddr += vsize - data;
-
- vaddr = (vm_offset_t) pmap_mapdev (pci_paddr, vsize);
-
-
- if (!vaddr) return (0);
-
-#ifndef PCI_QUIET
- /*
- ** display values.
- */
-
- printf ("\treg%d: virtual=0x%lx physical=0x%lx\n",
- (unsigned) reg, (u_long)vaddr, (u_long)pci_paddr);
-#endif
-
- /*
- ** return them to the driver
- */
-
- *va = vaddr;
- *pa = pci_paddr;
-
- /*
- ** set device address
- */
-
- pci_conf_write (tag, reg, pci_paddr);
-
- /*
- ** and don't forget to increment pci_paddr
- */
-
- pci_paddr += vsize;
-
- return (1);
-}
-
-/*------------------------------------------------------------
-**
-** Interface functions for the devconf module.
-**
-**------------------------------------------------------------
-*/
-
-static int
-pci_externalize (struct proc *p, struct kern_devconf *kdcp, void *u, size_t l)
-{
- struct pci_externalize_buffer buffer;
- struct pci_info * pip = kdcp->kdc_parentdata;
- pcici_t tag;
- int i;
-
- if (l < sizeof buffer) {
- return ENOMEM;
- };
-
- tag = pcitag (pip->pi_bus, pip->pi_device, 0);
-
- buffer.peb_pci_info = *pip;
-
- for (i=0; i<PCI_EXT_CONF_LEN; i++) {
- buffer.peb_config[i] = pci_conf_read (tag, i*4);
- };
-
- return copyout(&buffer, u, sizeof buffer);
-}
-
-
-static int
-pci_internalize (struct proc *p, struct kern_devconf *kdcp, void *u, size_t s)
-{
- return EOPNOTSUPP;
-}
-
-/*-----------------------------------------------------------------------
-**
-** Map pci interrupts to isa interrupts.
-**
-**-----------------------------------------------------------------------
-*/
-
-static unsigned int pci_int_mask [16];
-
-int pci_map_int (pcici_t tag, int(*func)(), void* arg, unsigned* maskptr)
-{
- int irq;
- unsigned mask;
-
- irq = PCI_INTERRUPT_LINE_EXTRACT(
- pci_conf_read (tag, PCI_INTERRUPT_REG));
-
- if (irq >= 16 || irq <= 0) {
- printf ("pci_map_int failed: no int line set.\n");
- return (0);
- }
-
- mask = 1ul << irq;
-
- if (!maskptr)
- maskptr = &pci_int_mask[irq];
-
- INTRMASK (*maskptr, mask);
-
- register_intr(
- irq, /* isa irq */
- 0, /* deviced?? */
- 0, /* flags? */
- (inthand2_t*) func, /* handler */
- maskptr, /* mask pointer */
- (int) arg); /* handler arg */
-
-#ifdef __FreeBSD2__
- /*
- ** XXX See comment at beginning of file.
- **
- ** Have to update all the interrupt masks ... Grrrrr!!!
- */
- {
- unsigned * mp = &intr_mask[0];
- /*
- ** update the isa interrupt masks.
- */
- for (mp=&intr_mask[0]; mp<&intr_mask[ICU_LEN]; mp++)
- if (*mp & *maskptr)
- *mp |= mask;
- /*
- ** update the pci interrupt masks.
- */
- for (mp=&pci_int_mask[0]; mp<&pci_int_mask[16]; mp++)
- if (*mp & *maskptr)
- *mp |= mask;
- };
-#endif
-
- INTREN (mask);
-
- return (1);
-}
-
-/*-----------------------------------------------------------
-**
-** Display of unknown devices.
-**
-**-----------------------------------------------------------
-*/
-struct vt {
- u_short ident;
- char* name;
-};
-
-static struct vt VendorTable[] = {
- {0x1002, "ATI TECHNOLOGIES INC"},
- {0x1011, "DIGITAL EQUIPMENT CORPORATION"},
- {0x101A, "NCR"},
- {0x102B, "MATROX"},
- {0x1045, "OPTI"},
- {0x5333, "S3 INC."},
- {0x8086, "INTEL CORPORATION"},
- {0,0}
-};
-
-static const char *const majclasses[] = {
- "old", "storage", "network", "display",
- "multimedia", "memory", "bridge"
-};
-
-void not_supported (pcici_t tag, u_long type)
-{
- u_char reg;
- u_long data;
- struct vt * vp;
-
- /*
- ** lookup the names.
- */
-
- for (vp=VendorTable; vp->ident; vp++)
- if (vp->ident == (type & 0xffff))
- break;
-
- /*
- ** and display them.
- */
-
- if (vp->ident) printf (vp->name);
- else printf ("vendor=0x%lx", type & 0xffff);
-
- printf (", device=0x%lx", type >> 16);
-
- data = (pci_conf_read(tag, PCI_CLASS_REG) >> 24) & 0xff;
- if (data < sizeof(majclasses) / sizeof(majclasses[0]))
- printf(", class=%s", majclasses[data]);
-
- printf (" [not supported]\n");
-
- for (reg=PCI_MAP_REG_START; reg<PCI_MAP_REG_END; reg+=4) {
- data = pci_conf_read (tag, reg);
- if (!data) continue;
- switch (data&7) {
-
- case 1:
- case 5:
- printf (" map(%x): io(%lx)\n",
- reg, data & ~3);
- break;
- case 0:
- printf (" map(%x): mem32(%lx)\n",
- reg, data & ~7);
- break;
- case 2:
- printf (" map(%x): mem20(%lx)\n",
- reg, data & ~7);
- break;
- case 4:
- printf (" map(%x): mem64(%lx)\n",
- reg, data & ~7);
- break;
- }
- }
-}
-
-#ifndef __FreeBSD2__
-/*-----------------------------------------------------------
-**
-** Mapping of physical to virtual memory
-**
-**-----------------------------------------------------------
-*/
-
-extern vm_map_t kernel_map;
-
-static vm_offset_t pmap_mapdev (vm_offset_t paddr, vm_size_t vsize)
-{
- vm_offset_t vaddr,value;
- u_long result;
-
- vaddr = vm_map_min (kernel_map);
-
- result = vm_map_find (kernel_map, (void*)0, (vm_offset_t) 0,
- &vaddr, vsize, TRUE);
-
- if (result != KERN_SUCCESS) {
- printf (" vm_map_find failed(%d)\n", result);
- return (0);
- };
-
- /*
- ** map physical
- */
-
- value = vaddr;
- while (vsize >= NBPG) {
- pmap_enter (pmap_kernel(), vaddr, paddr,
- VM_PROT_READ|VM_PROT_WRITE, TRUE);
- vaddr += NBPG;
- paddr += NBPG;
- vsize -= NBPG;
- };
- return (value);
-}
-
-/*------------------------------------------------------------
-**
-** Emulate the register_intr() function of FreeBSD 2.0
-**
-** requires a patch:
-** FreeBSD 2.0: "/sys/i386/isa/vector.s"
-** 386bsd0.1: "/sys/i386/isa/icu.s"
-** 386bsd1.0: Please ask Jesus Monroy Jr.
-**
-**------------------------------------------------------------
-*/
-
-#include <machine/segments.h>
-
-int pci_int_unit [16];
-inthand2_t* (pci_int_hdlr [16]);
-unsigned int * pci_int_mptr [16];
-unsigned int pci_int_count[16];
-
-extern void
- Vpci3(), Vpci4(), Vpci5(), Vpci6(), Vpci7(), Vpci8(), Vpci9(),
- Vpci10(), Vpci11(), Vpci12(), Vpci13(), Vpci14(), Vpci15();
-
-static inthand_t* pci_int_glue[16] = {
- 0, 0, 0, Vpci3, Vpci4, Vpci5, Vpci6, Vpci7, Vpci8,
- Vpci9, Vpci10, Vpci11, Vpci12, Vpci13, Vpci14, Vpci15 };
-
-static int
-register_intr __P((int intr, int device_id, unsigned int flags,
- inthand2_t *handler, unsigned int* mptr, int unit))
-{
- if (intr >= 16 || intr <= 2)
- return (EINVAL);
- if (pci_int_hdlr [intr])
- return (EBUSY);
-
- pci_int_hdlr [intr] = handler;
- pci_int_unit [intr] = unit;
- pci_int_mptr [intr] = mptr;
-
- setidt(NRSVIDT + intr, pci_int_glue[intr], SDT_SYS386IGT, SEL_KPL);
- return (0);
-}
-#endif /* __FreeBSD2__ */
-#endif /* NPCI */
diff --git a/sys/i386/pci/pci.h b/sys/i386/pci/pci.h
deleted file mode 100644
index 359bc96..0000000
--- a/sys/i386/pci/pci.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/**************************************************************************
-**
-** $Id: pci.h,v 2.1 94/09/16 08:01:35 wolf Rel $
-**
-** #define for pci bus device drivers
-**
-** 386bsd / FreeBSD
-**
-**-------------------------------------------------------------------------
-**
-** Copyright (c) 1994 Wolfgang Stanglmeier. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**-------------------------------------------------------------------------
-*/
-
-#ifndef __PCI_H__
-#define __PCI_H__
-
-/*
-** main pci initialization function.
-** called at boot time from autoconf.c
-*/
-
-void pci_configure(void);
-
-/*
-** pci configuration id
-**
-** is constructed from: bus, device & function numbers.
-*/
-
-typedef union {
- u_long cfg1;
- struct {
- u_char enable;
- u_char forward;
- u_short port;
- } cfg2;
- } pcici_t;
-
-/*
-** Each pci device has an unique device id.
-** It is used to find a matching driver.
-*/
-
-typedef u_long pcidi_t;
-
-#endif /*__PCI_H__*/
diff --git a/sys/i386/pci/pci_config.c b/sys/i386/pci/pci_config.c
deleted file mode 100644
index d7a41c0..0000000
--- a/sys/i386/pci/pci_config.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/**************************************************************************
-**
-** $Id: pci_config.c,v 1.9 1994/10/13 01:12:30 se Exp $
-**
-** @PCI@ this should be part of "ioconf.c".
-**
-** The config-utility should build it!
-**
-**-------------------------------------------------------------------------
-**
-** Copyright (c) 1994 Wolfgang Stanglmeier. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-***************************************************************************
-*/
-
-#include <sys/types.h>
-#include <i386/pci/pcireg.h>
-
-#include <ncr.h>
-#if NNCR>0
-extern struct pci_driver ncr_device;
-#endif
-
-#include <de.h>
-#if NDE > 0
-extern struct pci_driver dedevice;
-#endif
-
-#include <ahc.h>
-#if NAHC > 0
-extern struct pci_driver ahc_device;
-#endif
-
-extern struct pci_driver chipset_device;
-extern struct pci_driver vga_device;
-extern struct pci_driver ign_device;
-extern struct pci_driver lkm_device;
-
-struct pci_device pci_devtab[] = {
-
-#if NNCR>0
- {&ncr_device, "ncr", 0 },
-#endif
-
-#if NDE>0
- {&dedevice, "de", 0 },
-#endif
-
-#if NAHC>0
- {&ahc_device, "ahc", 0 },
-#endif
-
- {&chipset_device, "chip", 0 },
- {&vga_device, "graphics", 0 },
- {&ign_device, "ign", 0 },
- {&lkm_device, "lkm", 0 },
- {0, 0, 0 }
-};
diff --git a/sys/i386/pci/pci_device.h b/sys/i386/pci/pci_device.h
deleted file mode 100644
index aecbd6e..0000000
--- a/sys/i386/pci/pci_device.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/**************************************************************************
-**
-** $Id: pci_device.h,v 1.5 1994/09/28 16:34:10 se Exp $
-**
-** #define for pci based device drivers
-**
-** 386bsd / FreeBSD
-**
-**-------------------------------------------------------------------------
-**
-** Copyright (c) 1994 Wolfgang Stanglmeier. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**-------------------------------------------------------------------------
-*/
-
-#ifndef __PCI_DEVICE_H__
-#define __PCI_DEVICE_H__
-
-/*------------------------------------------------------------
-**
-** Per driver structure.
-**
-**------------------------------------------------------------
-*/
-
-struct pci_driver {
- int (*probe )(pcici_t pci_ident); /* test whether device is present */
- int (*attach)(pcici_t pci_ident); /* setup driver for a device */
- pcidi_t device_id; /* device pci id */
- char *name; /* device (long) name */
- int (*intr)(int); /* interupt handler */
-};
-
-/*-----------------------------------------------------------
-**
-** Per device structure.
-**
-** It is initialized by the config utility and should live in
-** "ioconf.c". At the moment there is only one field.
-**
-** This is a first attempt to include the pci bus to 386bsd.
-** So this structure may grow ..
-**
-** Extended by Garrett Wollman <wollman@halloran-eldar.lcs.mit.edu>
-** for future loadable drivers .
-**
-**-----------------------------------------------------------
-*/
-
-struct pci_device {
- struct
- pci_driver* pd_driver;
- pcidi_t pd_device_id; /* device pci id */
- const char * pd_name; /* for future loadable drivers */
- int pd_flags;
- int pd_npresent; /* for future loadable drivers */
-};
-
-#define PDF_LOADABLE 0x01
-#define PDF_COVERED 0x02
-
-/*-----------------------------------------------------------
-**
-** This table should be generated in file "ioconf.c"
-** by the config program.
-** It is used at boot time by the configuration function
-** pci_configure()
-**
-**-----------------------------------------------------------
-*/
-
-extern struct pci_device pci_devtab[];
-
-/*-----------------------------------------------------------
-**
-** This functions may be used by drivers to map devices
-** to virtual and physical addresses. The va and pa
-** addresses are "in/out" parameters. If they are 0
-** on entry, the mapping function assigns an address.
-**
-**-----------------------------------------------------------
-*/
-
-int pci_map_mem (pcici_t tag, u_long entry, u_long * va, u_long * pa);
-
-int pci_map_port(pcici_t tag, u_long entry, u_short * pa);
-
-#endif /*__PCI_DEVICE_H__*/
diff --git a/sys/i386/pci/pci_intel.c b/sys/i386/pci/pci_intel.c
deleted file mode 100644
index 48451f5..0000000
--- a/sys/i386/pci/pci_intel.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/**************************************************************************
-**
-** $Id: pci_intel.c,v 2.1 94/09/16 08:02:42 wolf Rel $
-**
-** Device driver for INTEL PCI chipsets.
-**
-** 386bsd / FreeBSD
-**
-**-------------------------------------------------------------------------
-**
-** Written for 386bsd and FreeBSD by
-** wolf@dentaro.gun.de Wolfgang Stanglmeier
-** se@mi.Uni-Koeln.de Stefan Esser
-**
-**-------------------------------------------------------------------------
-**
-** Copyright (c) 1994 Stefan Esser. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**-------------------------------------------------------------------------
-*/
-
-
-/*==========================================================
-**
-** Include files
-**
-**==========================================================
-*/
-
-#include <sys/types.h>
-
-#include <i386/pci/pci.h>
-#include <i386/pci/pcibios.h>
-#include <i386/pci/pci_device.h>
-
-static int probe1(pcici_t config_id);
-static int return0(int unit);
-static int intel_attach(pcici_t config_id);
-static int intel_82424zx_attach(pcici_t config_id);
-static int intel_82434lx_attach(pcici_t config_id);
-extern void printf();
-static char confread(pcici_t config_id, int port);
-
-struct condmsg {
- unsigned char port;
- unsigned char mask;
- unsigned char value;
- char flags;
- char *text;
-};
-
-#define M_EQ 0 /* mask and return true if equal */
-#define M_NE 1 /* mask and return true if not equal */
-#define TRUE 2 /* don't read config, always true */
-
-
-struct pci_driver intel82378_device = {
- probe1,
- intel_attach,
- 0x04848086,
- "intel 82378IB pci-isa bridge",
- return0
-};
-
-struct pci_driver intel82424_device = {
- probe1,
- intel_82424zx_attach,
- 0x04838086,
- "intel 82424ZX cache dram controller",
- return0
-};
-
-struct pci_driver intel82375_device = {
- probe1,
- intel_attach,
- 0x04828086,
- "intel 82375EB pci-eisa bridge",
- return0
-};
-
-struct pci_driver intel82434_device = {
- probe1,
- intel_82434lx_attach,
- 0x04a38086,
- "intel 82434LX pci cache memory controller",
- return0
-};
-
-struct condmsg conf82424zx[] =
-{
- { 0x00, 0x00, 0x00, TRUE, "\tCPU: " },
- { 0x50, 0xe0, 0x00, M_EQ, "486DX" },
- { 0x50, 0xe0, 0x20, M_EQ, "486SX" },
- { 0x50, 0xe0, 0x40, M_EQ, "486DX2 or 486DX4" },
- { 0x50, 0xe0, 0x80, M_EQ, "Overdrive (writeback)" },
-
- { 0x00, 0x00, 0x00, TRUE, ", bus=" },
- { 0x50, 0x03, 0x00, M_EQ, "25MHz" },
- { 0x50, 0x03, 0x01, M_EQ, "33MHz" },
- { 0x53, 0x01, 0x01, TRUE, ", CPU->Memory posting "},
- { 0x53, 0x01, 0x00, M_EQ, "OFF" },
- { 0x53, 0x01, 0x01, M_EQ, "ON" },
-
- { 0x56, 0x30, 0x00, M_NE, "\n\tWarning:" },
- { 0x56, 0x20, 0x00, M_NE, " NO cache parity!" },
- { 0x56, 0x10, 0x00, M_NE, " NO DRAM parity!" },
- { 0x55, 0x04, 0x04, M_EQ, "\n\tWarning: refresh OFF! " },
-
- { 0x00, 0x00, 0x00, TRUE, "\n\tCache: " },
- { 0x52, 0x01, 0x00, M_EQ, "None" },
- { 0x52, 0xc1, 0x01, M_EQ, "64KB" },
- { 0x52, 0xc1, 0x41, M_EQ, "128KB" },
- { 0x52, 0xc1, 0x81, M_EQ, "256KB" },
- { 0x52, 0xc1, 0xc1, M_EQ, "512KB" },
- { 0x52, 0x03, 0x01, M_EQ, " writethrough" },
- { 0x52, 0x03, 0x03, M_EQ, " writeback" },
-
- { 0x52, 0x01, 0x01, M_EQ, ", cache clocks=" },
- { 0x52, 0x05, 0x01, M_EQ, "3-1-1-1" },
- { 0x52, 0x05, 0x05, M_EQ, "2-1-1-1" },
-
- { 0x00, 0x00, 0x00, TRUE, "\n\tDRAM:" },
- { 0x55, 0x43, 0x00, M_NE, " page mode" },
- { 0x55, 0x02, 0x02, M_EQ, " code fetch" },
- { 0x55, 0x43, 0x43, M_EQ, "," },
- { 0x55, 0x43, 0x42, M_EQ, " and" },
- { 0x55, 0x40, 0x40, M_EQ, " read" },
- { 0x55, 0x03, 0x03, M_EQ, " and" },
- { 0x55, 0x43, 0x41, M_EQ, " and" },
- { 0x55, 0x01, 0x01, M_EQ, " write" },
- { 0x55, 0x43, 0x00, M_NE, "," },
-
- { 0x00, 0x00, 0x00, TRUE, " memory clocks=" },
- { 0x55, 0x20, 0x00, M_EQ, "X-2-2-2" },
- { 0x55, 0x20, 0x20, M_EQ, "X-1-2-1" },
-
- { 0x00, 0x00, 0x00, TRUE, "\n\tPCI: CPU->PCI posting " },
- { 0x53, 0x02, 0x02, M_EQ, "ON" },
- { 0x53, 0x02, 0x00, M_EQ, "OFF" },
- { 0x00, 0x00, 0x00, TRUE, ", CPU->PCI burst mode " },
- { 0x54, 0x02, 0x02, M_EQ, "ON" },
- { 0x54, 0x02, 0x00, M_EQ, "OFF" },
- { 0x00, 0x00, 0x00, TRUE, ", PCI->Memory posting " },
- { 0x54, 0x01, 0x01, M_EQ, "ON" },
- { 0x54, 0x01, 0x00, M_EQ, "OFF" },
-
- { 0x00, 0x00, 0x00, TRUE, "\n" },
-
-/* end marker */
- { 0 }
-};
-
-struct condmsg conf82434lx[] =
-{
- { 0x00, 0x00, 0x00, TRUE, "\tCPU: " },
- { 0x50, 0xe0, 0x80, M_EQ, "Pentium" },
- { 0x50, 0xe0, 0x80, M_NE, "???" },
- { 0x50, 0x02, 0x00, M_EQ, ", ???MHz" },
- { 0x50, 0x03, 0x02, M_EQ, ", 60MHz" },
- { 0x50, 0x03, 0x03, M_EQ, ", 66MHz" },
- { 0x50, 0x04, 0x00, M_EQ, " (primary cache OFF)" },
-
- { 0x53, 0x01, 0x01, TRUE, ", CPU->Memory posting "},
- { 0x53, 0x01, 0x00, M_EQ, "OFF" },
- { 0x53, 0x01, 0x01, M_NE, "ON" },
-
- { 0x53, 0x04, 0x00, M_NE, ", read around write"},
-
- { 0x71, 0xc0, 0x00, M_NE, "\n\tWarning: NO cache parity!" },
- { 0x57, 0x20, 0x00, M_NE, "\n\tWarning: NO DRAM parity!" },
- { 0x55, 0x01, 0x01, M_EQ, "\n\tWarning: refresh OFF! " },
-
- { 0x00, 0x00, 0x00, TRUE, "\n\tCache: " },
- { 0x52, 0x01, 0x00, M_EQ, "None" },
- { 0x52, 0x81, 0x01, M_EQ, "" },
- { 0x52, 0xc1, 0x81, M_EQ, "256KB" },
- { 0x52, 0xc1, 0xc1, M_EQ, "512KB" },
- { 0x52, 0x03, 0x01, M_EQ, " writethrough" },
- { 0x52, 0x03, 0x03, M_EQ, " writeback" },
-
- { 0x52, 0x01, 0x01, M_EQ, ", cache clocks=" },
- { 0x52, 0x20, 0x00, M_EQ, "3-2-2-2/4-2-2-2" },
- { 0x52, 0x20, 0x00, M_NE, "3-1-1-1" },
-
- { 0x00, 0x00, 0x00, TRUE, "\n\tDRAM:" },
- { 0x57, 0x10, 0x00, M_EQ, " page mode" },
-
- { 0x00, 0x00, 0x00, TRUE, " memory clocks=" },
- { 0x57, 0xc0, 0x00, M_EQ, "X-4-4-4 (70ns)" },
- { 0x57, 0xc0, 0x40, M_EQ, "X-4-4-4/X-3-3-3 (60ns)" },
- { 0x57, 0xc0, 0x80, M_EQ, "???" },
- { 0x57, 0xc0, 0xc0, M_EQ, "X-3-3-3 (50ns)" },
-
- { 0x00, 0x00, 0x00, TRUE, "\n\tPCI: CPU->PCI posting " },
- { 0x53, 0x02, 0x02, M_EQ, "ON" },
- { 0x53, 0x02, 0x00, M_EQ, "OFF" },
- { 0x00, 0x00, 0x00, TRUE, ", CPU->PCI burst mode " },
- { 0x54, 0x02, 0x00, M_NE, "ON" },
- { 0x54, 0x02, 0x00, M_EQ, "OFF" },
- { 0x00, 0x00, 0x00, TRUE, ", PCI->Memory posting " },
- { 0x54, 0x01, 0x00, M_NE, "ON" },
- { 0x54, 0x01, 0x00, M_EQ, "OFF" },
- { 0x54, 0x04, 0x00, TRUE, ", PCI clocks=" },
- { 0x54, 0x04, 0x00, M_EQ, "2-2-2-2" },
- { 0x54, 0x04, 0x00, M_NE, "2-1-1-1" },
-
- { 0x00, 0x00, 0x00, TRUE, "\n" },
-
-/* end marker */
- { 0 }
-};
-
-int return0(int unit)
-{
- return (0);
-}
-
-int probe1(pcici_t config_id)
-{
- return (1);
-}
-
-static char confread (pcici_t config_id, int port)
-{
- unsigned long portw = port & ~3;
- unsigned long ports = (port - portw) << 3;
-
- unsigned long l = pci_conf_read (config_id, portw);
- return (l >> ports);
-}
-
-static void writeconfig(pcici_t config_id, struct condmsg *tbl)
-{
- while (tbl->text) {
- int cond = 0;
- if (tbl->flags == TRUE) {
- cond = 1;
- } else {
- unsigned char v = (unsigned char) confread(config_id, tbl->port);
- switch (tbl->flags) {
- case M_EQ:
- if ((v & tbl->mask) == tbl->value) cond = 1;
- break;
- case M_NE:
- if ((v & tbl->mask) != tbl->value) cond = 1;
- break;
- }
- }
- if (cond) printf ("%s", tbl->text);
- tbl++;
- }
-}
-
-int intel_attach(pcici_t config_id)
-{
- printf ("\t[40] %lx [50] %lx [54] %lx\n",
- pci_conf_read (config_id, 0x40),
- pci_conf_read (config_id, 0x50),
- pci_conf_read (config_id, 0x54));
- return(0);
-}
-
-int intel_82424zx_attach(pcici_t config_id)
-{
- writeconfig (config_id, conf82424zx);
- return (0);
-}
-
-int intel_82434lx_attach(pcici_t config_id)
-{
- writeconfig (config_id, conf82434lx);
- return (0);
-}
-
diff --git a/sys/i386/pci/pcibios.c b/sys/i386/pci/pcibios.c
deleted file mode 100644
index 2069387..0000000
--- a/sys/i386/pci/pcibios.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/**************************************************************************
-**
-** $Id: pcibios.c,v 2.6 94/10/11 19:01:25 wolf Oct11 $
-**
-** #define for pci-bus bios functions.
-**
-** 386bsd / FreeBSD
-**
-**-------------------------------------------------------------------------
-**
-** Copyright (c) 1994 Wolfgang Stanglmeier. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-***************************************************************************
-*/
-
-#include <pci.h>
-#if NPCI > 0
-
-#if __FreeBSD__ >= 2
-#define HAS_CPUFUNC_H
-#endif
-
-#include <types.h>
-#include <i386/isa/isa.h>
-#include <i386/pci/pcireg.h>
-#ifdef HAS_CPUFUNC_H
-#include <i386/include/cpufunc.h>
-#endif
-
-extern int printf();
-
-static char pci_mode;
-
-
-/*--------------------------------------------------------------------
-**
-** Port access
-**
-**--------------------------------------------------------------------
-*/
-
-#ifndef HAS_CPUFUNC_H
-
-#undef inl
-#define inl(port) \
-({ u_long data; \
- __asm __volatile("inl %1, %0": "=a" (data): "d" ((u_short)(port))); \
- data; })
-
-
-#undef outl
-#define outl(port, data) \
-{__asm __volatile("outl %0, %1"::"a" ((u_long)(data)), "d" ((u_short)(port)));}
-
-
-#undef inb
-#define inb(port) \
-({ u_char data; \
- __asm __volatile("inb %1, %0": "=a" (data): "d" ((u_short)(port))); \
- data; })
-
-
-#undef outb
-#define outb(port, data) \
-{__asm __volatile("outb %0, %1"::"a" ((u_char)(data)), "d" ((u_short)(port)));}
-
-#endif /* HAS_CPUFUNC_H */
-
-/*--------------------------------------------------------------------
-**
-** Determine configuration mode
-**
-**--------------------------------------------------------------------
-*/
-
-
-#define CONF1_ENABLE 0x80000000ul
-#define CONF1_ADDR_PORT 0x0cf8
-#define CONF1_DATA_PORT 0x0cfc
-
-
-#define CONF2_ENABLE_PORT 0x0cf8
-#define CONF2_FORWARD_PORT 0x0cfa
-
-
-int pci_conf_mode (void)
-{
-#ifdef PCI_CONF_MODE
- return (PCI_CONF_MODE)
-#else /* PCI_CONF_MODE */
- u_long result, oldval;
-
- /*---------------------------------------
- ** Configuration mode 2 ?
- **---------------------------------------
- */
-
- outb (CONF2_ENABLE_PORT, 0);
- outb (CONF2_FORWARD_PORT, 0);
- if (!inb (CONF2_ENABLE_PORT) && !inb (CONF2_FORWARD_PORT)) {
- pci_mode = 2;
- return (2);
- };
-
- /*---------------------------------------
- ** Configuration mode 1 ?
- **---------------------------------------
- */
-
- oldval = inl (CONF1_ADDR_PORT);
- outl (CONF1_ADDR_PORT, CONF1_ENABLE);
- result = inl (CONF1_ADDR_PORT);
- outl (CONF1_ADDR_PORT, oldval);
-
- if (result == CONF1_ENABLE) {
- pci_mode = 1;
- return (1);
- };
-
- /*---------------------------------------
- ** No PCI bus available.
- **---------------------------------------
- */
- return (0);
-#endif /* PCI_CONF_MODE */
-}
-
-/*--------------------------------------------------------------------
-**
-** Build a pcitag from bus, device and function number
-**
-**--------------------------------------------------------------------
-*/
-
-pcici_t pcitag (unsigned char bus,
- unsigned char device,
- unsigned char func)
-{
- pcici_t tag;
-
- tag.cfg1 = 0;
- if (device >= 32) return tag;
- if (func >= 8) return tag;
-
- switch (pci_mode) {
-
- case 1:
- tag.cfg1 = CONF1_ENABLE
- | (((u_long) bus ) << 16ul)
- | (((u_long) device) << 11ul)
- | (((u_long) func ) << 8ul);
- break;
- case 2:
- if (device >= 16) break;
- tag.cfg2.port = 0xc000 | (device << 8ul);
- tag.cfg2.enable = 0xf1 | (func << 1ul);
- tag.cfg2.forward = bus;
- break;
- };
- return tag;
-}
-
-/*--------------------------------------------------------------------
-**
-** Read register from configuration space.
-**
-**--------------------------------------------------------------------
-*/
-
-
-u_long pci_conf_read (pcici_t tag, u_long reg)
-{
- u_long addr, data = 0;
-
- if (!tag.cfg1) return (0xfffffffful);
-
- switch (pci_mode) {
-
- case 1:
- addr = tag.cfg1 | (reg & 0xfc);
-#ifdef PCI_DEBUG
- printf ("pci_conf_read(1): addr=%x ", addr);
-#endif
- outl (CONF1_ADDR_PORT, addr);
- data = inl (CONF1_DATA_PORT);
- outl (CONF1_ADDR_PORT, 0 );
- break;
-
- case 2:
- addr = tag.cfg2.port | (reg & 0xfc);
-#ifdef PCI_DEBUG
- printf ("pci_conf_read(2): addr=%x ", addr);
-#endif
- outb (CONF2_ENABLE_PORT , tag.cfg2.enable );
- outb (CONF2_FORWARD_PORT, tag.cfg2.forward);
-
- data = inl ((u_short) addr);
-
- outb (CONF2_ENABLE_PORT, 0);
- outb (CONF2_FORWARD_PORT, 0);
- break;
- };
-
-#ifdef PCI_DEBUG
- printf ("data=%x\n", data);
-#endif
-
- return (data);
-}
-
-/*--------------------------------------------------------------------
-**
-** Write register into configuration space.
-**
-**--------------------------------------------------------------------
-*/
-
-
-void pci_conf_write (pcici_t tag, u_long reg, u_long data)
-{
- u_long addr;
-
- if (!tag.cfg1) return;
-
- switch (pci_mode) {
-
- case 1:
- addr = tag.cfg1 | (reg & 0xfc);
-#ifdef PCI_DEBUG
- printf ("pci_conf_write(1): addr=%x data=%x\n",
- addr, data);
-#endif
- outl (CONF1_ADDR_PORT, addr);
- outl (CONF1_DATA_PORT, data);
- outl (CONF1_ADDR_PORT, 0 );
- break;
-
- case 2:
- addr = tag.cfg2.port | (reg & 0xfc);
-#ifdef PCI_DEBUG
- printf ("pci_conf_write(2): addr=%x data=%x\n",
- addr, data);
-#endif
- outb (CONF2_ENABLE_PORT, tag.cfg2.enable);
- outb (CONF2_FORWARD_PORT, tag.cfg2.forward);
-
- outl ((u_short) addr, data);
-
- outb (CONF2_ENABLE_PORT, 0);
- outb (CONF2_FORWARD_PORT, 0);
- break;
- };
-}
-#endif /* NPCI > 0 */
diff --git a/sys/i386/pci/pcibios.h b/sys/i386/pci/pcibios.h
deleted file mode 100644
index 7d240f5..0000000
--- a/sys/i386/pci/pcibios.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/**************************************************************************
-**
-** $Id: pcibios.h,v 2.1 94/09/16 08:01:37 wolf Rel $
-**
-** #define for pci-bus bios functions.
-** #define for pci configuration space registers.
-**
-** 386bsd / FreeBSD
-**
-**-------------------------------------------------------------------------
-**
-** Copyright (c) 1994 Wolfgang Stanglmeier. All rights reserved.
-** Copyright (c) 1994 Charles Hannum. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**-------------------------------------------------------------------------
-*/
-
-#ifndef __PCIBIOS_H__
-#define __PCIBIOS_H__
-
-/*
-** the availability of a pci bus.
-** configuration mode (1 or 2)
-** 0 if no pci bus found.
-*/
-
-int pci_conf_mode (void);
-
-/*
-** The number of the last available pci bus.
-*/
-
-int pci_last_bus (void);
-
-/*
-** get a "ticket" for accessing a pci device
-** configuration space.
-*/
-
-pcici_t pcitag (unsigned char bus,
- unsigned char device,
- unsigned char func);
-
-/*
-** read or write the configuration space.
-*/
-
-u_long pci_conf_read (pcici_t tag, u_long reg );
-void pci_conf_write (pcici_t tag, u_long reg, u_long data);
-
-
-/*------------------------------------------------------------------
-**
-** Names for PCI configuration space registers.
-**
-** Copyright (c) 1994 Charles Hannum. All rights reserved.
-**
-**------------------------------------------------------------------
-*/
-
-/*
- * Device identification register; contains a vendor ID and a device ID.
- * We have little need to distinguish the two parts.
- */
-#define PCI_ID_REG 0x00
-
-/*
- * Command and status register.
- */
-#define PCI_COMMAND_STATUS_REG 0x04
-
-#define PCI_COMMAND_IO_ENABLE 0x00000001
-#define PCI_COMMAND_MEM_ENABLE 0x00000002
-#define PCI_COMMAND_MASTER_ENABLE 0x00000004
-#define PCI_COMMAND_SPECIAL_ENABLE 0x00000008
-#define PCI_COMMAND_INVALIDATE_ENABLE 0x00000010
-#define PCI_COMMAND_PALETTE_ENABLE 0x00000020
-#define PCI_COMMAND_PARITY_ENABLE 0x00000040
-#define PCI_COMMAND_STEPPING_ENABLE 0x00000080
-#define PCI_COMMAND_SERR_ENABLE 0x00000100
-#define PCI_COMMAND_BACKTOBACK_ENABLE 0x00000200
-
-#define PCI_STATUS_BACKTOBACK_OKAY 0x00800000
-#define PCI_STATUS_PARITY_ERROR 0x01000000
-#define PCI_STATUS_DEVSEL_FAST 0x00000000
-#define PCI_STATUS_DEVSEL_MEDIUM 0x02000000
-#define PCI_STATUS_DEVSEL_SLOW 0x04000000
-#define PCI_STATUS_DEVSEL_MASK 0x06000000
-#define PCI_STATUS_TARGET_TARGET_ABORT 0x08000000
-#define PCI_STATUS_MASTER_TARGET_ABORT 0x10000000
-#define PCI_STATUS_MASTER_ABORT 0x20000000
-#define PCI_STATUS_SPECIAL_ERROR 0x40000000
-#define PCI_STATUS_PARITY_DETECT 0x80000000
-
-/*
- * Class register; defines basic type of device.
- */
-#define PCI_CLASS_REG 0x08
-
-#define PCI_CLASS_MASK 0xff000000
-#define PCI_SUBCLASS_MASK 0x00ff0000
-
-/* base classes */
-#define PCI_CLASS_PREHISTORIC 0x00000000
-#define PCI_CLASS_MASS_STORAGE 0x01000000
-#define PCI_CLASS_NETWORK 0x02000000
-#define PCI_CLASS_DISPLAY 0x03000000
-#define PCI_CLASS_MULTIMEDIA 0x04000000
-#define PCI_CLASS_MEMORY 0x05000000
-#define PCI_CLASS_BRIDGE 0x06000000
-#define PCI_CLASS_UNDEFINED 0xff000000
-
-/* 0x00 prehistoric subclasses */
-#define PCI_SUBCLASS_PREHISTORIC_MISC 0x00000000
-#define PCI_SUBCLASS_PREHISTORIC_VGA 0x00010000
-
-/* 0x01 mass storage subclasses */
-#define PCI_SUBCLASS_MASS_STORAGE_SCSI 0x00000000
-#define PCI_SUBCLASS_MASS_STORAGE_IDE 0x00010000
-#define PCI_SUBCLASS_MASS_STORAGE_FLOPPY 0x00020000
-#define PCI_SUBCLASS_MASS_STORAGE_IPI 0x00030000
-#define PCI_SUBCLASS_MASS_STORAGE_MISC 0x00800000
-
-/* 0x02 network subclasses */
-#define PCI_SUBCLASS_NETWORK_ETHERNET 0x00000000
-#define PCI_SUBCLASS_NETWORK_TOKENRING 0x00010000
-#define PCI_SUBCLASS_NETWORK_FDDI 0x00020000
-#define PCI_SUBCLASS_NETWORK_MISC 0x00800000
-
-/* 0x03 display subclasses */
-#define PCI_SUBCLASS_DISPLAY_VGA 0x00000000
-#define PCI_SUBCLASS_DISPLAY_XGA 0x00010000
-#define PCI_SUBCLASS_DISPLAY_MISC 0x00800000
-
-/* 0x04 multimedia subclasses */
-#define PCI_SUBCLASS_MULTIMEDIA_VIDEO 0x00000000
-#define PCI_SUBCLASS_MULTIMEDIA_AUDIO 0x00010000
-#define PCI_SUBCLASS_MULTIMEDIA_MISC 0x00800000
-
-/* 0x05 memory subclasses */
-#define PCI_SUBCLASS_MEMORY_RAM 0x00000000
-#define PCI_SUBCLASS_MEMORY_FLASH 0x00010000
-#define PCI_SUBCLASS_MEMORY_MISC 0x00800000
-
-/* 0x06 bridge subclasses */
-#define PCI_SUBCLASS_BRIDGE_HOST 0x00000000
-#define PCI_SUBCLASS_BRIDGE_ISA 0x00010000
-#define PCI_SUBCLASS_BRIDGE_EISA 0x00020000
-#define PCI_SUBCLASS_BRIDGE_MC 0x00030000
-#define PCI_SUBCLASS_BRIDGE_PCI 0x00040000
-#define PCI_SUBCLASS_BRIDGE_PCMCIA 0x00050000
-#define PCI_SUBCLASS_BRIDGE_MISC 0x00800000
-
-/*
- * Mapping registers
- */
-#define PCI_MAP_REG_START 0x10
-#define PCI_MAP_REG_END 0x28
-
-#define PCI_MAP_MEMORY 0x00000000
-#define PCI_MAP_IO 0x00000001
-
-#define PCI_MAP_MEMORY_TYPE_32BIT 0x00000000
-#define PCI_MAP_MEMORY_TYPE_32BIT_1M 0x00000002
-#define PCI_MAP_MEMORY_TYPE_64BIT 0x00000004
-#define PCI_MAP_MEMORY_TYPE_MASK 0x00000006
-#define PCI_MAP_MEMORY_CACHABLE 0x00000008
-#define PCI_MAP_MEMORY_ADDRESS_MASK 0xfffffff0
-
-/*
- * Interrupt configuration register
- */
-#define PCI_INTERRUPT_REG 0x3c
-
-#define PCI_INTERRUPT_PIN_MASK 0x0000ff00
-#define PCI_INTERRUPT_PIN_EXTRACT(x) ((((x) & PCI_INTERRUPT_PIN_MASK) >> 8) & 0xff)
-#define PCI_INTERRUPT_PIN_NONE 0x00
-#define PCI_INTERRUPT_PIN_A 0x01
-#define PCI_INTERRUPT_PIN_B 0x02
-#define PCI_INTERRUPT_PIN_C 0x03
-#define PCI_INTERRUPT_PIN_D 0x04
-
-#define PCI_INTERRUPT_LINE_MASK 0x000000ff
-#define PCI_INTERRUPT_LINE_EXTRACT(x) ((((x) & PCI_INTERRUPT_LINE_MASK) >> 0) & 0xff)
-#define PCI_INTERRUPT_LINE_INSERT(x,v) (((x) & ~PCI_INTERRUPT_LINE_MASK) | ((v) << 0))
-
-#endif
diff --git a/sys/i386/pci/pcireg.h b/sys/i386/pci/pcireg.h
deleted file mode 100644
index dd1f1cc..0000000
--- a/sys/i386/pci/pcireg.h
+++ /dev/null
@@ -1,423 +0,0 @@
-/**************************************************************************
-**
-** $Id: pcireg.h,v 1.1 1994/10/12 02:25:03 se Exp $
-**
-** Declarations for pci bus drivers.
-**
-** 386bsd / FreeBSD
-**
-**-------------------------------------------------------------------------
-**
-** Copyright (c) 1994 Wolfgang Stanglmeier. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-***************************************************************************
-*/
-
-#ifndef __PCI_REG_H__
-#define __PCI_REG_H__
-
-/*-----------------------------------------------------------------
-**
-** main pci initialization function.
-** called at boot time from autoconf.c
-**
-**-----------------------------------------------------------------
-*/
-
-void pci_configure (void);
-
-/*-----------------------------------------------------------------
-**
-** The pci configuration id describes a pci device on the bus.
-** It is constructed from: bus, device & function numbers.
-**
-**-----------------------------------------------------------------
-*/
-
-typedef union {
- u_long cfg1;
- struct {
- u_char enable;
- u_char forward;
- u_short port;
- } cfg2;
- } pcici_t;
-
-/*-----------------------------------------------------------------
-**
-** Each pci device has an unique device id.
-** It is used to find a matching driver.
-**
-**-----------------------------------------------------------------
-*/
-
-typedef u_long pcidi_t;
-
-/*-----------------------------------------------------------------
-**
-** The pci driver structure.
-**
-** probe: Checks if the driver can support a device
-** with this type. The tag may be used to get
-** more info with pci_read_conf(). See below.
-** It returns a string with the devices name,
-** or a NULL pointer, if the driver cannot
-** support this device.
-**
-** attach: Allocate a control structure and prepare
-** it. This function may use the pci mapping
-** functions. See below.
-** (configuration id) or type.
-**
-** count: A pointer to a unit counter.
-** It's used by the pci configurator to
-** allocate unit numbers.
-**
-**-----------------------------------------------------------------
-*/
-
-struct pci_driver {
- char* (*probe ) (pcici_t tag, pcidi_t type);
- void (*attach) (pcici_t tag, int unit);
- u_long *count;
-};
-
-/*-----------------------------------------------------------------
-**
-** The pci-devconf interface.
-**
-**-----------------------------------------------------------------
-*/
-
-struct pci_info {
- u_short pi_bus;
- u_short pi_device;
-};
-
-#define PCI_EXT_CONF_LEN (16)
-#define PCI_EXTERNAL_LEN (sizeof(struct pci_externalize_buffer))
-
-struct pci_externalize_buffer {
- struct pci_info peb_pci_info;
- u_long peb_config[PCI_EXT_CONF_LEN];
-};
-
-
-/*-----------------------------------------------------------------
-**
-** Per device structure.
-**
-** An array of this structure should be created by the
-** config utility and live in "ioconf.c".
-**
-** At the moment it's created by hand and lives in
-** pci_config.c
-**
-** pd_driver:
-** a pointer to the driver structure.
-**
-** pd_name:
-** the name of the devices which are supported
-** by this driver for kernel messages.
-**
-** pd_flags:
-** for further study.
-**
-**-----------------------------------------------------------------
-*/
-
-struct pci_device {
- struct
- pci_driver* pd_driver;
- const char * pd_name;
- int pd_flags;
-};
-
-/*-----------------------------------------------------------------
-**
-** This table should be generated in file "ioconf.c"
-** by the config program.
-** It is used at boot time by the configuration function
-** pci_configure()
-**
-**-----------------------------------------------------------------
-*/
-
-extern struct pci_device pci_devtab[];
-
-/*-----------------------------------------------------------------
-**
-** Map a pci device to physical and virtual memory.
-**
-** The va and pa addresses are "in/out" parameters.
-** If they are 0 on entry, the function assigns an address.
-**
-** Entry selects the register in the pci configuration
-** space, which supplies the size of the region, and
-** receives the physical address.
-**
-** If there is any error, a message is written, and
-** the function returns with zero.
-** Else it returns with a value different to zero.
-**
-**-----------------------------------------------------------------
-*/
-
-int pci_map_mem (pcici_t tag, u_long entry, u_long * va, u_long * pa);
-
-/*-----------------------------------------------------------------
-**
-** Map a pci device to an io port area.
-**
-** *pa is an "in/out" parameter.
-** If it's 0 on entry, the function assigns an port number..
-**
-** Entry selects the register in the pci configuration
-** space, which supplies the size of the region, and
-** receives the port number.
-**
-** If there is any error, a message is written, and
-** the function returns with zero.
-** Else it returns with a value different to zero.
-**
-**-----------------------------------------------------------------
-*/
-
-int pci_map_port(pcici_t tag, u_long entry, u_short * pa);
-
-/*-----------------------------------------------------------------
-**
-** Map a pci interrupt to an isa irq line,
-** and enable the interrupt.
-**
-** func is the interrupt handler, arg is the argument
-** to this function.
-**
-** The maskptr argument should be &bio_imask,
-** &net_imask etc. or NULL.
-**
-** If there is any error, a message is written, and
-** the function returns with zero.
-** Else it returns with a value different to zero.
-**
-** A word of caution for FreeBSD 2.0:
-**
-** We use the register_intr() function.
-**
-** The interrupt line of the selected device is included
-** into the supplied mask: after the corresponding splXXX
-** this drivers interrupts are blocked.
-**
-** But in the interrupt handlers startup code ONLY
-** the interrupt of the driver is blocked, and NOT
-** all interrupts of the spl group.
-**
-** It may be required to additional block the group
-** interrupts by splXXX() inside the interrupt handler.
-**
-** In pre 2.0 kernels we emulate the register_intr
-** function. The emulating function blocks all interrupts
-** of the group in the interrupt handler prefix code.
-**
-**-----------------------------------------------------------------
-*/
-
-int pci_map_int (pcici_t tag, int (*func)(), void* arg, unsigned * maskptr);
-
-/*-----------------------------------------------------------------
-**
-** The following functions are provided by the pci bios.
-** They are used only by the pci configuration.
-**
-** pci_conf_mode():
-** Probes for a pci system.
-** Returns 1 or 2 for pci configuration mechanism.
-** Returns 0 if no pci system.
-**
-** pcitag():
-** Gets a handle for accessing the pci configuration
-** space.
-** This handle is given to the mapping functions (see
-** above) or to the read/write functions.
-**
-** pci_conf_read():
-** Read a long word from the pci configuration space.
-** Requires a tag (from pcitag) and the register
-** number (should be a long word alligned one).
-**
-** pci_conf_write():
-** Writes a long word to the pci configuration space.
-** Requires a tag (from pcitag), the register number
-** (should be a long word alligned one), and a value.
-**
-**-----------------------------------------------------------------
-*/
-
-int pci_conf_mode (void);
-
-pcici_t pcitag (unsigned char bus,
- unsigned char device,
- unsigned char func);
-
-u_long pci_conf_read (pcici_t tag, u_long reg );
-void pci_conf_write (pcici_t tag, u_long reg, u_long data);
-
-
-/*------------------------------------------------------------------
-**
-** Names for PCI configuration space registers.
-**
-** Copyright (c) 1994 Charles Hannum. All rights reserved.
-**
-**------------------------------------------------------------------
-*/
-
-/*
- * Device identification register; contains a vendor ID and a device ID.
- * We have little need to distinguish the two parts.
- */
-#define PCI_ID_REG 0x00
-
-/*
- * Command and status register.
- */
-#define PCI_COMMAND_STATUS_REG 0x04
-
-#define PCI_COMMAND_IO_ENABLE 0x00000001
-#define PCI_COMMAND_MEM_ENABLE 0x00000002
-#define PCI_COMMAND_MASTER_ENABLE 0x00000004
-#define PCI_COMMAND_SPECIAL_ENABLE 0x00000008
-#define PCI_COMMAND_INVALIDATE_ENABLE 0x00000010
-#define PCI_COMMAND_PALETTE_ENABLE 0x00000020
-#define PCI_COMMAND_PARITY_ENABLE 0x00000040
-#define PCI_COMMAND_STEPPING_ENABLE 0x00000080
-#define PCI_COMMAND_SERR_ENABLE 0x00000100
-#define PCI_COMMAND_BACKTOBACK_ENABLE 0x00000200
-
-#define PCI_STATUS_BACKTOBACK_OKAY 0x00800000
-#define PCI_STATUS_PARITY_ERROR 0x01000000
-#define PCI_STATUS_DEVSEL_FAST 0x00000000
-#define PCI_STATUS_DEVSEL_MEDIUM 0x02000000
-#define PCI_STATUS_DEVSEL_SLOW 0x04000000
-#define PCI_STATUS_DEVSEL_MASK 0x06000000
-#define PCI_STATUS_TARGET_TARGET_ABORT 0x08000000
-#define PCI_STATUS_MASTER_TARGET_ABORT 0x10000000
-#define PCI_STATUS_MASTER_ABORT 0x20000000
-#define PCI_STATUS_SPECIAL_ERROR 0x40000000
-#define PCI_STATUS_PARITY_DETECT 0x80000000
-
-/*
- * Class register; defines basic type of device.
- */
-#define PCI_CLASS_REG 0x08
-
-#define PCI_CLASS_MASK 0xff000000
-#define PCI_SUBCLASS_MASK 0x00ff0000
-
-/* base classes */
-#define PCI_CLASS_PREHISTORIC 0x00000000
-#define PCI_CLASS_MASS_STORAGE 0x01000000
-#define PCI_CLASS_NETWORK 0x02000000
-#define PCI_CLASS_DISPLAY 0x03000000
-#define PCI_CLASS_MULTIMEDIA 0x04000000
-#define PCI_CLASS_MEMORY 0x05000000
-#define PCI_CLASS_BRIDGE 0x06000000
-#define PCI_CLASS_UNDEFINED 0xff000000
-
-/* 0x00 prehistoric subclasses */
-#define PCI_SUBCLASS_PREHISTORIC_MISC 0x00000000
-#define PCI_SUBCLASS_PREHISTORIC_VGA 0x00010000
-
-/* 0x01 mass storage subclasses */
-#define PCI_SUBCLASS_MASS_STORAGE_SCSI 0x00000000
-#define PCI_SUBCLASS_MASS_STORAGE_IDE 0x00010000
-#define PCI_SUBCLASS_MASS_STORAGE_FLOPPY 0x00020000
-#define PCI_SUBCLASS_MASS_STORAGE_IPI 0x00030000
-#define PCI_SUBCLASS_MASS_STORAGE_MISC 0x00800000
-
-/* 0x02 network subclasses */
-#define PCI_SUBCLASS_NETWORK_ETHERNET 0x00000000
-#define PCI_SUBCLASS_NETWORK_TOKENRING 0x00010000
-#define PCI_SUBCLASS_NETWORK_FDDI 0x00020000
-#define PCI_SUBCLASS_NETWORK_MISC 0x00800000
-
-/* 0x03 display subclasses */
-#define PCI_SUBCLASS_DISPLAY_VGA 0x00000000
-#define PCI_SUBCLASS_DISPLAY_XGA 0x00010000
-#define PCI_SUBCLASS_DISPLAY_MISC 0x00800000
-
-/* 0x04 multimedia subclasses */
-#define PCI_SUBCLASS_MULTIMEDIA_VIDEO 0x00000000
-#define PCI_SUBCLASS_MULTIMEDIA_AUDIO 0x00010000
-#define PCI_SUBCLASS_MULTIMEDIA_MISC 0x00800000
-
-/* 0x05 memory subclasses */
-#define PCI_SUBCLASS_MEMORY_RAM 0x00000000
-#define PCI_SUBCLASS_MEMORY_FLASH 0x00010000
-#define PCI_SUBCLASS_MEMORY_MISC 0x00800000
-
-/* 0x06 bridge subclasses */
-#define PCI_SUBCLASS_BRIDGE_HOST 0x00000000
-#define PCI_SUBCLASS_BRIDGE_ISA 0x00010000
-#define PCI_SUBCLASS_BRIDGE_EISA 0x00020000
-#define PCI_SUBCLASS_BRIDGE_MC 0x00030000
-#define PCI_SUBCLASS_BRIDGE_PCI 0x00040000
-#define PCI_SUBCLASS_BRIDGE_PCMCIA 0x00050000
-#define PCI_SUBCLASS_BRIDGE_MISC 0x00800000
-
-/*
- * Mapping registers
- */
-#define PCI_MAP_REG_START 0x10
-#define PCI_MAP_REG_END 0x28
-
-#define PCI_MAP_MEMORY 0x00000000
-#define PCI_MAP_IO 0x00000001
-
-#define PCI_MAP_MEMORY_TYPE_32BIT 0x00000000
-#define PCI_MAP_MEMORY_TYPE_32BIT_1M 0x00000002
-#define PCI_MAP_MEMORY_TYPE_64BIT 0x00000004
-#define PCI_MAP_MEMORY_TYPE_MASK 0x00000006
-#define PCI_MAP_MEMORY_CACHABLE 0x00000008
-#define PCI_MAP_MEMORY_ADDRESS_MASK 0xfffffff0
-
-/*
- * Interrupt configuration register
- */
-#define PCI_INTERRUPT_REG 0x3c
-
-#define PCI_INTERRUPT_PIN_MASK 0x0000ff00
-#define PCI_INTERRUPT_PIN_EXTRACT(x) ((((x) & PCI_INTERRUPT_PIN_MASK) >> 8) & 0xff)
-#define PCI_INTERRUPT_PIN_NONE 0x00
-#define PCI_INTERRUPT_PIN_A 0x01
-#define PCI_INTERRUPT_PIN_B 0x02
-#define PCI_INTERRUPT_PIN_C 0x03
-#define PCI_INTERRUPT_PIN_D 0x04
-
-#define PCI_INTERRUPT_LINE_MASK 0x000000ff
-#define PCI_INTERRUPT_LINE_EXTRACT(x) ((((x) & PCI_INTERRUPT_LINE_MASK) >> 0) & 0xff)
-#define PCI_INTERRUPT_LINE_INSERT(x,v) (((x) & ~PCI_INTERRUPT_LINE_MASK) | ((v) << 0))
-
-#endif /* __PCI_REG_H__ */
diff --git a/sys/i386/pci/pcisupport.c b/sys/i386/pci/pcisupport.c
deleted file mode 100644
index 21a25a5..0000000
--- a/sys/i386/pci/pcisupport.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/**************************************************************************
-**
-** $Id: pcisupport.c,v 1.5 1994/10/25 18:45:19 se Exp $
-**
-** Device driver for INTEL PCI chipsets.
-**
-** 386bsd / FreeBSD
-**
-**-------------------------------------------------------------------------
-**
-** Written for 386bsd and FreeBSD by
-** wolf@dentaro.gun.de Wolfgang Stanglmeier
-** se@mi.Uni-Koeln.de Stefan Esser
-**
-**-------------------------------------------------------------------------
-**
-** Copyright (c) 1994 Stefan Esser. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-***************************************************************************
-*/
-
-
-/*==========================================================
-**
-** Include files
-**
-**==========================================================
-*/
-
-#include <sys/types.h>
-
-#include <i386/pci/pcireg.h>
-
-extern void printf();
-
-extern int bootverbose;
-
-
-/*---------------------------------------------------------
-**
-** Intel chipsets for 486 / Pentium processor
-**
-**---------------------------------------------------------
-*/
-
-static char* chipset_probe (pcici_t tag, pcidi_t type);
-static void chipset_attach(pcici_t tag, int unit);
-static u_long chipset_count;
-
-struct pci_driver chipset_device = {
- chipset_probe,
- chipset_attach,
- &chipset_count
-};
-
-static char confread(pcici_t config_id, int port);
-
-struct condmsg {
- unsigned char port;
- unsigned char mask;
- unsigned char value;
- char flags;
- char *text;
-};
-
-#define M_EQ 0 /* mask and return true if equal */
-#define M_NE 1 /* mask and return true if not equal */
-#define TRUE 2 /* don't read config, always true */
-
-static char* chipset_probe (pcici_t tag, pcidi_t type)
-{
- switch (type) {
- case 0x04848086:
- return ("intel 82378IB pci-isa bridge");
- case 0x04838086:
- return ("intel 82424ZX cache dram controller");
- case 0x04828086:
- return ("intel 82375EB pci-eisa bridge");
- case 0x04a38086:
- return ("intel 82434LX pci cache memory controller");
- };
- return ((char*)0);
-}
-
-struct condmsg conf82424zx[] =
-{
- { 0x00, 0x00, 0x00, TRUE, "\tCPU: " },
- { 0x50, 0xe0, 0x00, M_EQ, "486DX" },
- { 0x50, 0xe0, 0x20, M_EQ, "486SX" },
- { 0x50, 0xe0, 0x40, M_EQ, "486DX2 or 486DX4" },
- { 0x50, 0xe0, 0x80, M_EQ, "Overdrive (writeback)" },
-
- { 0x00, 0x00, 0x00, TRUE, ", bus=" },
- { 0x50, 0x03, 0x00, M_EQ, "25MHz" },
- { 0x50, 0x03, 0x01, M_EQ, "33MHz" },
- { 0x53, 0x01, 0x01, TRUE, ", CPU->Memory posting "},
- { 0x53, 0x01, 0x00, M_EQ, "OFF" },
- { 0x53, 0x01, 0x01, M_EQ, "ON" },
-
- { 0x56, 0x30, 0x00, M_NE, "\n\tWarning:" },
- { 0x56, 0x20, 0x00, M_NE, " NO cache parity!" },
- { 0x56, 0x10, 0x00, M_NE, " NO DRAM parity!" },
- { 0x55, 0x04, 0x04, M_EQ, "\n\tWarning: refresh OFF! " },
-
- { 0x00, 0x00, 0x00, TRUE, "\n\tCache: " },
- { 0x52, 0x01, 0x00, M_EQ, "None" },
- { 0x52, 0xc1, 0x01, M_EQ, "64KB" },
- { 0x52, 0xc1, 0x41, M_EQ, "128KB" },
- { 0x52, 0xc1, 0x81, M_EQ, "256KB" },
- { 0x52, 0xc1, 0xc1, M_EQ, "512KB" },
- { 0x52, 0x03, 0x01, M_EQ, " writethrough" },
- { 0x52, 0x03, 0x03, M_EQ, " writeback" },
-
- { 0x52, 0x01, 0x01, M_EQ, ", cache clocks=" },
- { 0x52, 0x05, 0x01, M_EQ, "3-1-1-1" },
- { 0x52, 0x05, 0x05, M_EQ, "2-1-1-1" },
-
- { 0x00, 0x00, 0x00, TRUE, "\n\tDRAM:" },
- { 0x55, 0x43, 0x00, M_NE, " page mode" },
- { 0x55, 0x02, 0x02, M_EQ, " code fetch" },
- { 0x55, 0x43, 0x43, M_EQ, "," },
- { 0x55, 0x43, 0x42, M_EQ, " and" },
- { 0x55, 0x40, 0x40, M_EQ, " read" },
- { 0x55, 0x03, 0x03, M_EQ, " and" },
- { 0x55, 0x43, 0x41, M_EQ, " and" },
- { 0x55, 0x01, 0x01, M_EQ, " write" },
- { 0x55, 0x43, 0x00, M_NE, "," },
-
- { 0x00, 0x00, 0x00, TRUE, " memory clocks=" },
- { 0x55, 0x20, 0x00, M_EQ, "X-2-2-2" },
- { 0x55, 0x20, 0x20, M_EQ, "X-1-2-1" },
-
- { 0x00, 0x00, 0x00, TRUE, "\n\tCPU->PCI: posting " },
- { 0x53, 0x02, 0x00, M_NE, "ON" },
- { 0x53, 0x02, 0x00, M_EQ, "OFF" },
- { 0x00, 0x00, 0x00, TRUE, ", burst mode " },
- { 0x54, 0x02, 0x00, M_NE, "ON" },
- { 0x54, 0x02, 0x00, M_EQ, "OFF" },
- { 0x00, 0x00, 0x00, TRUE, "\n\tPCI->Memory: posting " },
- { 0x54, 0x01, 0x00, M_NE, "ON" },
- { 0x54, 0x01, 0x00, M_EQ, "OFF" },
-
- { 0x00, 0x00, 0x00, TRUE, "\n" },
-
-/* end marker */
- { 0 }
-};
-
-struct condmsg conf82434lx[] =
-{
- { 0x00, 0x00, 0x00, TRUE, "\tCPU: " },
- { 0x50, 0xe3, 0x82, M_EQ, "Pentium, 60MHz" },
- { 0x50, 0xe3, 0x83, M_EQ, "Pentium, 66MHz" },
- { 0x50, 0xe3, 0xa2, M_EQ, "Pentium, 90MHz" },
- { 0x50, 0xe3, 0xa3, M_EQ, "Pentium, 100MHz" },
- { 0x50, 0xc2, 0x82, M_NE, "(unknown)" },
- { 0x50, 0x04, 0x00, M_EQ, " (primary cache OFF)" },
-
- { 0x53, 0x01, 0x01, TRUE, ", CPU->Memory posting "},
- { 0x53, 0x01, 0x01, M_NE, "OFF" },
- { 0x53, 0x01, 0x01, M_EQ, "ON" },
-
- { 0x53, 0x04, 0x00, M_NE, ", read around write"},
-
- { 0x71, 0xc0, 0x00, M_NE, "\n\tWarning: NO cache parity!" },
- { 0x57, 0x20, 0x00, M_NE, "\n\tWarning: NO DRAM parity!" },
- { 0x55, 0x01, 0x01, M_EQ, "\n\tWarning: refresh OFF! " },
-
- { 0x00, 0x00, 0x00, TRUE, "\n\tCache: " },
- { 0x52, 0x01, 0x00, M_EQ, "None" },
- { 0x52, 0x81, 0x01, M_EQ, "" },
- { 0x52, 0xc1, 0x81, M_EQ, "256KB" },
- { 0x52, 0xc1, 0xc1, M_EQ, "512KB" },
- { 0x52, 0x03, 0x01, M_EQ, " writethrough" },
- { 0x52, 0x03, 0x03, M_EQ, " writeback" },
-
- { 0x52, 0x01, 0x01, M_EQ, ", cache clocks=" },
- { 0x52, 0x20, 0x00, M_EQ, "3-2-2-2/4-2-2-2" },
- { 0x52, 0x20, 0x00, M_NE, "3-1-1-1" },
-
- { 0x00, 0x00, 0x00, TRUE, "\n\tDRAM:" },
- { 0x57, 0x10, 0x00, M_EQ, " page mode" },
-
- { 0x00, 0x00, 0x00, TRUE, " memory clocks=" },
- { 0x57, 0xc0, 0x00, M_EQ, "X-4-4-4 (70ns)" },
- { 0x57, 0xc0, 0x40, M_EQ, "X-4-4-4/X-3-3-3 (60ns)" },
- { 0x57, 0xc0, 0x80, M_EQ, "???" },
- { 0x57, 0xc0, 0xc0, M_EQ, "X-3-3-3 (50ns)" },
-
- { 0x00, 0x00, 0x00, TRUE, "\n\tCPU->PCI: posting " },
- { 0x53, 0x02, 0x02, M_EQ, "ON" },
- { 0x53, 0x02, 0x00, M_EQ, "OFF" },
- { 0x00, 0x00, 0x00, TRUE, ", burst mode " },
- { 0x54, 0x02, 0x00, M_NE, "ON" },
- { 0x54, 0x02, 0x00, M_EQ, "OFF" },
- { 0x54, 0x04, 0x00, TRUE, ", PCI clocks=" },
- { 0x54, 0x04, 0x00, M_EQ, "2-2-2-2" },
- { 0x54, 0x04, 0x00, M_NE, "2-1-1-1" },
- { 0x00, 0x00, 0x00, TRUE, "\n\tPCI->Memory: posting " },
- { 0x54, 0x01, 0x00, M_NE, "ON" },
- { 0x54, 0x01, 0x00, M_EQ, "OFF" },
-
- { 0x00, 0x00, 0x00, TRUE, "\n" },
-
-/* end marker */
- { 0 }
-};
-
-static char confread (pcici_t config_id, int port)
-{
- unsigned long portw = port & ~3;
- unsigned long ports = (port - portw) << 3;
-
- unsigned long l = pci_conf_read (config_id, portw);
- return (l >> ports);
-}
-
-static void writeconfig(pcici_t config_id, struct condmsg *tbl)
-{
- while (tbl->text) {
- int cond = 0;
- if (tbl->flags == TRUE) {
- cond = 1;
- } else {
- unsigned char v = (unsigned char) confread(config_id, tbl->port);
- switch (tbl->flags) {
- case M_EQ:
- if ((v & tbl->mask) == tbl->value) cond = 1;
- break;
- case M_NE:
- if ((v & tbl->mask) != tbl->value) cond = 1;
- break;
- }
- }
- if (cond) printf ("%s", tbl->text);
- tbl++;
- }
-}
-
-void chipset_attach(pcici_t config_id, int unit)
-{
- if (bootverbose) {
- switch (pci_conf_read (config_id, 0)) {
-
- case 0x04838086:
- writeconfig (config_id, conf82424zx);
- break;
- case 0x04a38086:
- writeconfig (config_id, conf82434lx);
- break;
- case 0x04848086:
- case 0x04828086:
- printf ("\t[40] %lx [50] %lx [54] %lx\n",
- pci_conf_read (config_id, 0x40),
- pci_conf_read (config_id, 0x50),
- pci_conf_read (config_id, 0x54));
- break;
- };
- }
-}
-
-/*---------------------------------------------------------
-**
-** Catchall driver for VGA devices
-**
-**
-** By Garrett Wollman
-** <wollman@halloran-eldar.lcs.mit.edu>
-**
-**---------------------------------------------------------
-*/
-
-static char* vga_probe (pcici_t tag, pcidi_t type);
-static void vga_attach(pcici_t tag, int unit);
-static u_long vga_count;
-
-struct pci_driver vga_device = {
- vga_probe,
- vga_attach,
- &vga_count
-};
-
-static char* vga_probe (pcici_t tag, pcidi_t type)
-{
- int data = pci_conf_read(tag, PCI_CLASS_REG);
-
- switch (data & PCI_CLASS_MASK) {
-
- case PCI_CLASS_PREHISTORIC:
- if ((data & PCI_SUBCLASS_MASK)
- != PCI_SUBCLASS_PREHISTORIC_VGA)
- break;
-
- case PCI_CLASS_DISPLAY:
- return ("display device");
- };
- return ((char*)0);
-}
-
-static void vga_attach(pcici_t tag, int unit)
-{
-/*
-** Breaks some systems.
-** The assigned adresses _have_ to be announced to the console driver.
-*/
-#if 0
- vm_offset_t va;
- vm_offset_t pa;
- int reg;
- for (reg = PCI_MAP_REG_START; reg < PCI_MAP_REG_END; reg += 4)
- (void) pci_map_mem (tag, reg, &va, &pa);
-#endif
-}
-
-/*---------------------------------------------------------
-**
-** Hook for loadable pci drivers
-**
-**---------------------------------------------------------
-*/
-
-static char* lkm_probe (pcici_t tag, pcidi_t type);
-static void lkm_attach(pcici_t tag, int unit);
-static u_long lkm_count;
-
-struct pci_driver lkm_device = {
- lkm_probe,
- lkm_attach,
- &lkm_count
-};
-
-static char* lkm_probe (pcici_t tag, pcidi_t type)
-{
- /*
- ** Should try to load a matching driver.
- ** XXX Not yet!
- */
- return ((char*)0);
-}
-
-static void lkm_attach(pcici_t tag, int unit)
-{
-}
-
-/*---------------------------------------------------------
-**
-** Devices to ignore
-**
-**---------------------------------------------------------
-*/
-
-static char* ign_probe (pcici_t tag, pcidi_t type);
-static void ign_attach(pcici_t tag, int unit);
-static u_long ign_count;
-
-struct pci_driver ign_device = {
- ign_probe,
- ign_attach,
- &ign_count
-};
-
-static char* ign_probe (pcici_t tag, pcidi_t type)
-{
- switch (type) {
-
- case 0x10001042ul: /* wd */
- return ("");
-
- };
- return ((char*)0);
-}
-
-static void ign_attach(pcici_t tag, int unit)
-{
-}
diff --git a/sys/kern/subr_rmap.c b/sys/kern/subr_rmap.c
deleted file mode 100644
index a43899e..0000000
--- a/sys/kern/subr_rmap.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*-
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)subr_rmap.c 8.1 (Berkeley) 6/10/93
- * $Id$
- */
-
-#include <sys/param.h>
-#include <sys/map.h>
-#include <sys/proc.h>
-
-void
-rminit(a1, a2, a3, a4, a5)
- struct map *a1;
- long a2, a3;
- char *a4;
- int a5;
-{
-
- /*
- * Body deleted.
- */
- return;
-}
-
-long
-rmalloc(a1, a2)
- struct map *a1;
- long a2;
-{
-
- /*
- * Body deleted.
- */
- return (0);
-}
-
-void
-rmfree(a1, a2, a3)
- struct map *a1;
- long a2, a3;
-{
-
- /*
- * Body deleted.
- */
- return;
-}
diff --git a/sys/libkern/libkern.h b/sys/libkern/libkern.h
deleted file mode 100644
index e32f72d..0000000
--- a/sys/libkern/libkern.h
+++ /dev/null
@@ -1,65 +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.
- *
- * @(#)libkern.h 8.1 (Berkeley) 6/10/93
- * $Id: libkern.h,v 1.5 1994/11/14 14:56:46 bde Exp $
- */
-
-#include <sys/types.h>
-
-static inline int imax(int a, int b) { return (a > b ? a : b); }
-static inline int imin(int a, int b) { return (a < b ? a : b); }
-static inline long lmax(long a, long b) { return (a > b ? a : b); }
-static inline long lmin(long a, long b) { return (a < b ? a : b); }
-static inline u_int max(u_int a, u_int b) { return (a > b ? a : b); }
-static inline u_int min(u_int a, u_int b) { return (a < b ? a : b); }
-static inline quad_t qmax(quad_t a, quad_t b) { return (a > b ? a : b); }
-static inline quad_t qmin(quad_t a, quad_t b) { return (a < b ? a : b); }
-static inline u_long ulmax(u_long a, u_long b) { return (a > b ? a : b); }
-static inline u_long ulmin(u_long a, u_long b) { return (a < b ? a : b); }
-
-/* Prototypes for non-quad routines. */
-int bcmp __P((const void *, const void *, size_t));
-#ifndef HAVE_INLINE_FFS
-int ffs __P((int));
-#endif
-int locc __P((int, char *, u_int));
-u_long random __P((void));
-char *rindex __P((const char *, int));
-int scanc __P((u_int, u_char *, u_char *, int));
-int skpc __P((int, int, char *));
-char *strcat __P((char *, const char *));
-int strcmp __P((const char *, const char *));
-char *strcpy __P((char *, const char *));
-size_t strlen __P((const char *));
-int strncmp __P((const char *, const char *, size_t));
-char *strncpy __P((char *, const char *, size_t));
diff --git a/sys/libkern/strtol.c b/sys/libkern/strtol.c
deleted file mode 100644
index 9c257da..0000000
--- a/sys/libkern/strtol.c
+++ /dev/null
@@ -1,128 +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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtol.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <machine/limits.h>
-
-
-/*
- * Convert a string to a long integer.
- *
- * Ignores `locale' stuff. Assumes that the upper and lower case
- * alphabets and digits are each contiguous.
- *
- * Slightly lobotomized for inclusion in libkern.
- */
-long
-strtol(nptr, endptr, base)
- const char *nptr;
- char **endptr;
- register int base;
-{
- register const char *s = nptr;
- register unsigned long acc;
- register int c;
- register unsigned long cutoff;
- register int neg = 0, any, cutlim;
-
- /*
- * Skip white space and pick up leading +/- sign if any.
- * If base is 0, allow 0x for hex and 0 for octal, else
- * assume decimal; if base is already 16, allow 0x.
- */
- do {
- c = *s++;
- } while (c == ' ' || c == '\t');
- if (c == '-') {
- neg = 1;
- c = *s++;
- } else if (c == '+')
- c = *s++;
- if ((base == 0 || base == 16) &&
- c == '0' && (*s == 'x' || *s == 'X')) {
- c = s[1];
- s += 2;
- base = 16;
- }
- if (base == 0)
- base = c == '0' ? 8 : 10;
-
- /*
- * Compute the cutoff value between legal numbers and illegal
- * numbers. That is the largest legal value, divided by the
- * base. An input number that is greater than this value, if
- * followed by a legal input character, is too big. One that
- * is equal to this value may be valid or not; the limit
- * between valid and invalid numbers is then based on the last
- * digit. For instance, if the range for longs is
- * [-2147483648..2147483647] and the input base is 10,
- * cutoff will be set to 214748364 and cutlim to either
- * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated
- * a value > 214748364, or equal but the next digit is > 7 (or 8),
- * the number is too big, and we will return a range error.
- *
- * Set any if any `digits' consumed; make it negative to indicate
- * overflow.
- */
- cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX;
- cutlim = cutoff % (unsigned long)base;
- cutoff /= (unsigned long)base;
- for (acc = 0, any = 0;; c = *s++) {
- if (c >= '0' && c <= '9')
- c -= '0';
- else if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))
- c -= (c >= 'A' && c <= 'Z') ? 'A' - 10 : 'a' - 10;
- else
- break;
- if (c >= base)
- break;
- if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
- any = -1;
- else {
- any = 1;
- acc *= base;
- acc += c;
- }
- }
- if (any < 0) {
- acc = neg ? LONG_MIN : LONG_MAX;
- } else if (neg)
- acc = -acc;
- if (endptr != 0)
- *endptr = (char *)(any ? s - 1 : nptr);
- return (acc);
-}
diff --git a/sys/miscfs/devfs/devfs_back.c b/sys/miscfs/devfs/devfs_back.c
deleted file mode 100644
index 20a69e5..0000000
--- a/sys/miscfs/devfs/devfs_back.c
+++ /dev/null
@@ -1,467 +0,0 @@
-
-/*
- * Written by Julian Elischer (julian@DIALix.oz.au)
- *
- * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_back.c,v 1.4 1995/09/03 05:43:38 julian Exp $
- */
-
-#include "param.h"
-#include "systm.h"
-#include "types.h"
-#include "kernel.h"
-#include "file.h" /* define FWRITE ... */
-#include "conf.h"
-#include "stat.h"
-#include "mount.h"
-#include "vnode.h"
-#include "malloc.h"
-#include "dir.h" /* defines dirent structure */
-#include "devfsdefs.h"
-#include "sys/devfsext.h"
-
-
-SYSINIT(devfs, SI_SUB_DEVFS, SI_ORDER_FIRST, devfs_sinit, NULL)
-
-devnm_p dev_root; /* root of the backing tree */
-
-/*
- * Set up the root directory node in the backing plane
- * This is happenning before the vfs system has been
- * set up yet, so be careful about what we reference..
- * Notice that the ops are by indirection.. as they haven't
- * been set up yet!
- */
-void devfs_sinit() /*proto*/
-{
- int retval; /* we will discard this */
- /*
- * call the right routine at the right time with the right args....
- */
- retval = dev_add_node("root",NULL,DEV_DIR,NULL,&dev_root);
- printf("DEVFS: ready for devices\n");
-}
-
-/***********************************************************************\
-* Given a starting node (0 for root) and a pathname, return the node *
-* for the end item on the path. It MUST BE A DIRECTORY. If the 'CREATE' *
-* option is true, then create any missing nodes in the path and create *
-* and return the final node as well. *
-* Generally, this MUST be the first function called by any module *
-* as it also calls the initial setup code, in case it has never been *
-* done yet. *
-* This is used to set up a directory, before making nodes in it.. *
-* *
-* Warning: This function is RECURSIVE. *
-* char *path, find this dir (err if not dir) *
-* dn_p dirnode, starting point (0 = root) *
-* int create, create path if not found *
-* dn_p *dn_pp) where to return the node of the dir *
-\***********************************************************************/
-int dev_finddir(char *orig_path, dn_p dirnode, int create, dn_p *dn_pp) /*proto*/
-{
- devnm_p devnmp;
- char pathbuf[DEVMAXPATHSIZE];
- char *path;
- char *name;
- register char *cp;
- int retval;
-
-
- DBPRINT(("dev_finddir\n"));
- if(!dirnode) dirnode = dev_root->dnp;
- if(dirnode->type != DEV_DIR) return ENOTDIR;
- if(strlen(orig_path) > (DEVMAXPATHSIZE - 1)) return ENAMETOOLONG;
- path = pathbuf;
- strcpy(path,orig_path);
- while(*path == '/') path++; /* always absolute, skip leading / */
- /***************************************\
- * find the next segment of the name *
- \***************************************/
- cp = name = path;
- while((*cp != '/') && (*cp != 0))
- {
- cp++;
- }
- /***********************************************\
- * Check to see if it's the last component *
- \***********************************************/
- if(*cp)
- {
- path = cp + 1; /* path refers to the rest */
- *cp = 0; /* name is now a separate string */
- if(!(*path))
- {
- path = (char *)0; /* was trailing slash */
- }
- }
- else
- {
- path = (char *)0; /* no more to do */
- }
-
- /***************************************\
- * Start scanning along the linked list *
- \***************************************/
- devnmp = dirnode->by.Dir.dirlist;
- while(devnmp && strcmp(devnmp->name,name))
- {
- devnmp = devnmp->next;
- }
- if(devnmp)
- { /* check it's a directory */
- if(devnmp->dnp->type != DEV_DIR) return ENOTDIR;
- }
- else
- {
- /***************************************\
- * The required element does not exist *
- * So we will add it if asked to. *
- \***************************************/
- if(!create) return ENOENT;
-
- if(retval = dev_add_node(name, dirnode ,DEV_DIR,
- NULL, &devnmp))
- {
- return retval;
- }
- }
- if(path) /* decide whether to recurse more or return */
- {
- return (dev_finddir(path,devnmp->dnp,create,dn_pp));
- }
- else
- {
- *dn_pp = devnmp->dnp;
- return 0;
- }
-}
-
-/***********************************************************************\
-* Add a new element to the devfs backing structure. *
-* If we're creating a root node, then dirname is NULL *
-\***********************************************************************/
-int dev_add_node(char *name, dn_p dirnode, int entrytype, union typeinfo *by, devnm_p *devnm_pp) /*proto*/
-{
- devnm_p devnmp;
- devnm_p realthing; /* needed to create an alias */
- dn_p dnp;
- int retval;
-
- DBPRINT(("dev_add_node\n"));
- if(dirnode ) {
- if(dirnode->type != DEV_DIR) return(ENOTDIR);
-
- retval = dev_finddir(name,dirnode,0,&dnp); /*don't create!*/
- dnp = NULL; /*just want the return code..*/
- if(retval != ENOENT) /* only acceptable answer */
- return(EEXIST);
- }
- /*
- * make sure the name is legal
- */
- if(strlen(name) > (DEVMAXNAMESIZE - 1)) return (ENAMETOOLONG);
- /*
- * Allocate and fill out a new backing node
- */
- if(!(devnmp = (devnm_p)malloc(sizeof(devnm_t),
- M_DEVFSBACK, M_NOWAIT)))
- {
- return ENOMEM;
- }
- bzero(devnmp,sizeof(devnm_t));
- if(!(dnp = (dn_p)malloc(sizeof(devnode_t),
- M_DEVFSNODE, M_NOWAIT)))
- {
- free(devnmp,M_DEVFSBACK);
- return ENOMEM;
- }
- bzero(dnp,sizeof(devnode_t));
- /*
- * Link hte two together
- * include the implicit link in the count of links to the devnode..
- * this stops it from being accidentally freed later.
- */
- devnmp->dnp = dnp;
- dnp->links = 1; /* implicit from our own name-node */
-
- /*
- * note the node type we are adding
- * and set the creation times to NOW
- * put in it's name
- */
- strcpy(devnmp->name,name);
- dnp->type = entrytype;
- TIMEVAL_TO_TIMESPEC(&time,&(dnp->ctime))
- dnp->mtime = dnp->ctime;
- dnp->atime = dnp->ctime;
-
- /*
- * And set up a new 'clones' list (empty)
- */
- devnmp->prev_frontp = &(devnmp->next_front);
-
- /*
- * Check if we are making a root node..
- * (with no parent)
- */
- if(dirnode) {
- /*
- * Put it on the END of the linked list of directory entries
- */
- devnmp->parent = dirnode;
- devnmp->prevp = dirnode->by.Dir.dirlast;
- devnmp->next = *(devnmp->prevp); /* should be NULL */ /*right?*/
- *(devnmp->prevp) = devnmp;
- dirnode->by.Dir.dirlast = &(devnmp->next);
- dirnode->by.Dir.entrycount++;
- }
- /*
- * return the answer
- */
- switch(entrytype) {
- case DEV_DIR:
- /*
- * As it's a directory, make sure it has a null entries list
- */
- dnp->by.Dir.dirlast =
- &(dnp->by.Dir.dirlist);
- dnp->by.Dir.dirlist = (devnm_p)0;
- if ( dirnode ) {
- dnp->by.Dir.parent = (dn_p)dirnode;
- } else {
- /* root loops to self */
- dnp->by.Dir.parent = dnp;
- }
- dnp->by.Dir.parent->links++; /* account for .. */
- dnp->links++; /* for .*/
- dnp->by.Dir.myname = devnmp;
- /*
- * make sure that the ops associated with it are the ops
- * that we use (by default) for directories
- */
- dnp->ops = &devfs_vnodeop_p;
- dnp->mode |= 0555; /* default perms */
- break;
- case DEV_BDEV:
- /*
- * Make sure it has DEVICE type ops
- * and device specific fields are correct
- */
- dnp->ops = &dev_spec_vnodeop_p;
- dnp->by.Bdev.bdevsw = by->Bdev.bdevsw;
- dnp->by.Bdev.dev = by->Bdev.dev;
- break;
- case DEV_CDEV:
- /*
- * Make sure it has DEVICE type ops
- * and device specific fields are correct
- */
- dnp->ops = &dev_spec_vnodeop_p;
- dnp->by.Cdev.cdevsw = by->Cdev.cdevsw;
- dnp->by.Cdev.dev = by->Cdev.dev;
- break;
- case DEV_DDEV:
- /*
- * store the address of (the address of) the ops
- * and the magic cookie to use with them
- */
- dnp->by.Ddev.arg = by->Ddev.arg;
- dnp->ops = by->Ddev.ops;
- break;
-
-
- case DEV_ALIAS:
- /*
- * point to the node we want to shadow
- * Also store the fact we exist so that aliases
- * can be deleted accuratly when the original node
- * is deleted.. (i.e. when device is removed)
- */
- realthing = by->Alias.realthing;
- dnp->by.Alias.realthing = realthing;
- dnp->by.Alias.next = realthing->as.back.aliases;
- realthing->as.back.aliases = devnmp;
- realthing->as.back.alias_count++;
- break;
- }
- /*
- * If we have a parent, then maybe we should duplicate
- * ourselves onto any plane that the parent is on...
- * Though this may be better handled elsewhere as
- * it stops this routine from being used for front nodes
- */
- if(dirnode) {
- if(retval = devfs_add_fronts(dirnode->by.Dir.myname,devnmp))
- {
- /*XXX*//* no idea what to do if it fails... */
- return retval;
- }
- }
-
- *devnm_pp = devnmp;
- return 0 ;
-}
-
-/***********************************************************************
- * remove all fronts to this dev and also it's aliases,
- * Then remove this node.
- * For now only allow DEVICE nodes to go.. XXX
- * directory nodes are more complicated and may need more work..
- */
-int dev_remove(devnm_p devnmp) /*proto*/
-{
- devnm_p alias;
-
- DBPRINT(("dev_remove\n"));
- /*
- * Check the type of the node.. for now don't allow dirs
- */
- switch(devnmp->dnp->type)
- {
- case DEV_BDEV:
- case DEV_CDEV:
- case DEV_DDEV:
- case DEV_ALIAS:
- case DEV_SLNK:
- break;
- case DEV_DIR:
- default:
- return(EINVAL);
- }
- /*
- * Free each alias
- */
- while ( devnmp->as.back.alias_count)
- {
- alias = devnmp->as.back.aliases;
- devnmp->as.back.aliases = alias->dnp->by.Alias.next;
- devnmp->as.back.alias_count--;
- devfs_dn_free(alias->dnp);
- free (alias, M_DEVFSBACK);
- }
- /*
- * Now remove front items of the Main node itself
- */
- devfs_remove_fronts(devnmp);
-
- /*
- * now we should free the main node
- */
- devfs_dn_free(devnmp->dnp);
- free (devnmp, M_DEVFSBACK);
- return 0;
-}
-
-int dev_touch(devnm_p key) /* update the node for this dev */ /*proto*/
-{
- DBPRINT(("dev_touch\n"));
- TIMEVAL_TO_TIMESPEC(&time,&(key->dnp->mtime))
- return 0; /*XXX*/
-}
-
-void devfs_dn_free(dn_p dnp) /*proto*/
-{
- if(dnp->links <= 0)
- {
- printf("devfs node reference count bogus\n");
- Debugger("devfs_dn_free");
- return;
- }
- if(--dnp->links == 0 )
- {
- devfs_dropvnode(dnp);
- free (dnp, M_DEVFSNODE);
- }
-}
-/***********************************************************************\
-* UTILITY routine: *
-* Return the major number for the cdevsw entry containing the given *
-* address. *
-\***********************************************************************/
-int get_cdev_major_num(caddr_t addr) /*proto*/
-{
- int index = 0;
-
- DBPRINT(("get_cdev_major_num\n"));
- while (index < nchrdev)
- {
- if(((caddr_t)(cdevsw[index].d_open) == addr)
- ||((caddr_t)(cdevsw[index].d_read) == addr)
- ||((caddr_t)(cdevsw[index].d_ioctl) == addr))
- {
- return index;
- }
- index++;
- }
- return -1;
-}
-
-int get_bdev_major_num(caddr_t addr) /*proto*/
-{
- int index = 0;
-
- DBPRINT(("get_bdev_major_num\n"));
- while (index < nblkdev)
- {
- if(((caddr_t)(bdevsw[index].d_open) == addr)
- ||((caddr_t)(bdevsw[index].d_strategy) == addr)
- ||((caddr_t)(bdevsw[index].d_ioctl) == addr))
- {
- return index;
- }
- index++;
- }
- return -1;
-}
-
-/***********************************************************************\
-* Add the named device entry into the given directory, and make it *
-* The appropriate type... (called (sometimes indirectly) by drivers..) *
-\***********************************************************************/
-void *dev_add(char *path,
- char *name,
- void *funct,
- int minor,
- int chrblk,
- uid_t uid,
- gid_t gid,
- int perms)
-{
- devnm_p new_dev;
- dn_p dnp; /* devnode for parent directory */
- int retval;
- int major ;
- union typeinfo by;
-
- DBPRINT(("dev_add\n"));
- retval = dev_finddir(path,NULL,1,&dnp);
- if (retval) return 0;
- switch(chrblk)
- {
- case DV_CHR:
- major = get_cdev_major_num(funct);
- by.Cdev.cdevsw = cdevsw + major;
- by.Cdev.dev = makedev(major, minor);
- if( dev_add_node(name, dnp, DEV_CDEV,
- &by,&new_dev))
- return 0;
- break;
- case DV_BLK:
- major = get_bdev_major_num(funct);
- by.Bdev.bdevsw = bdevsw + major;
- by.Bdev.dev = makedev(major, minor);
- if( dev_add_node(name, dnp, DEV_BDEV,
- &by, &new_dev))
- return 0;
- break;
- default:
- return(0);
- }
- new_dev->dnp->gid = gid;
- new_dev->dnp->uid = uid;
- new_dev->dnp->mode |= perms;
- return new_dev;
-}
-
-
-
diff --git a/sys/miscfs/devfs/devfs_front.c b/sys/miscfs/devfs/devfs_front.c
deleted file mode 100644
index a3d0255..0000000
--- a/sys/miscfs/devfs/devfs_front.c
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- * Written by Julian Elischer (julian@DIALix.oz.au)
- *
- * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_front.c,v 1.3 1995/04/20 07:42:41 julian Exp $
- *
- */
-
-#include "param.h"
-#include "systm.h"
-#include "kernel.h"
-#include "file.h" /* define FWRITE ... */
-#include "conf.h"
-#include "stat.h"
-#include "mount.h"
-#include "vnode.h"
-#include "malloc.h"
-#include "dir.h" /* defines dirent structure */
-#include "devfsdefs.h"
-
-
-
-/***********************************************************************\
-* Given a directory backing node, and a child backing node, add the *
-* appropriate front nodes to the front nodes of the directory to *
-* represent the child node to the user *
-* *
-* on failure, front nodes will either be correct or not exist for each *
-* front dir, however dirs completed will not be stripped of completed *
-* frontnodes on failure of a later parent frontnode *
-* *
-\***********************************************************************/
-int devfs_add_fronts(devnm_p parent,devnm_p child) /*proto*/
-{
- devnm_p newfp;
- devnm_p falias;
-
- DBPRINT((" devfs_add_fronts\n"));
- /***********************************************\
- * Find the frontnodes of the parent node *
- \***********************************************/
- for (falias = parent->next_front; falias; falias = falias->next_front)
- {
- if(dev_findfront(falias->dnp,child->name))
- {
- printf("Device %s not created, already exists\n",
- child->name);
- continue;
- }
- if( dev_mk_front(falias->dnp,child,&newfp,NULL))
- {
- printf("Device %s: allocation failed\n",
- child->name);
- continue;
- }
-
- }
- return(0); /* for now always succeed */
-}
-
-/***************************************************************\
-* Search down the linked list off a front dir to find "name" *
-* return the dn_p for that node.
-\***************************************************************/
-dn_p dev_findfront(dn_p dir,char *name) /*proto*/
-{
- devnm_p newfp;
- DBPRINT((" dev_findfront(%s)\n",name));
- if(dir->type != DEV_DIR) return 0;/*XXX*/ /* printf?*/
-
- if(name[0] == '.')
- {
- if(name[1] == 0)
- {
- return dir;
- }
- if((name[1] == '.') && (name[2] == 0))
- {
- if(dir->by.Dir.parent == dir) /* root? */
- return dir;
- else
- return dir->by.Dir.parent;
- }
- }
- newfp = dir->by.Dir.dirlist;
- while(newfp)
- {
- if(!(strcmp(name,newfp->name)))
- break;
- newfp = newfp->next;
- }
- if(newfp)
- return newfp->dnp;
- else
- return (dn_p)0;
-}
-
-/***************************************************************\
-* Create and link in a new front element.. *
-* Parent can be 0 for a root node *
-* Not presently usable to make a symlink XXX *
-* Must teach this to handle where there is no back node *
-* maybe split into two bits? *
-\***************************************************************/
-int dev_mk_front(dn_p parent,devnm_p back,devnm_p *devnm_pp , struct devfsmount *dvm) /*proto*/
-{
- devnm_p newfp;
- struct devfsmount *dmt;
- devnm_p newback;
- devnm_p newfront;
- int error;
- dn_p dnp;
-
- DBPRINT((" dev_mk_front\n"));
- if(parent && (parent->type != DEV_DIR)) return EINVAL;
- /*XXX*/ /* printf?*/
- if(!(newfp = malloc(sizeof(devnm_t),M_DEVFSFRONT,M_NOWAIT)))
- {
- return(ENOMEM);
- }
- bzero(newfp,sizeof(*newfp));
- strcpy(newfp->name,back->name);
-
- /*******************************************************\
- * If we are creating an alias, Then we need to find the *
- * real object's file_node. (It must pre-exist) *
- * this means that aliases have no front nodes... *
- * In effect ALIAS back nodes are just place markers *
- \*******************************************************/
- if(back->dnp->type == DEV_ALIAS)
- {
- back = back->dnp->by.Alias.realthing;
- }
-
- /*
- * either use the existing devnode or make our own,
- * depending on if we are a dev or a dir.
- */
- switch(back->dnp->type) {
- case DEV_BDEV:
- case DEV_CDEV:
- case DEV_DDEV:
- dnp = newfp->dnp = back->dnp;
- newfp->dnp->links++; /* wherever it is.....*/
- break;
- case DEV_DIR:
- dnp = newfp->dnp = malloc(sizeof(devnode_t),
- M_DEVFSNODE,M_NOWAIT);
- if(!(dnp))
- {
- free(newfp,M_DEVFSFRONT);
- return ENOMEM;
- }
- /*
- * we have two options.. bcopy and reset some items,
- * or bzero and reset or copy some items...
- */
- bcopy(back->dnp,newfp->dnp,sizeof(devnode_t));
- dnp->links = 1; /* EXTRA from '.' */
- dnp->links++; /* wherever it is.....*/
- dnp->by.Dir.dirlast =
- &dnp->by.Dir.dirlist;
- dnp->by.Dir.dirlist = NULL;
- dnp->by.Dir.entrycount = 0;
- dnp->vn = NULL;
- dnp->vn_id = 0;
- break;
- case DEV_SLNK: /* should never happen XXX (hmm might)*/
- default:
- printf("unknown DEV type\n");
- return EINVAL;
- }
- /*******************************************************\
- * Put it in the parent's directory list (at the end). *
- \*******************************************************/
- if(parent)
- {
- newfp->next = *parent->by.Dir.dirlast;
- newfp->prevp = parent->by.Dir.dirlast;
- *parent->by.Dir.dirlast = newfp;
- parent->by.Dir.dirlast = &newfp->next;
- parent->by.Dir.entrycount++;
- newfp->dnp->dvm = parent->dvm; /* XXX bad for devs */
- if(back->dnp->type == DEV_DIR)
- {
- newfp->dnp->by.Dir.parent
- = parent;
- parent->links++; /* only dirs have '..'*/
- }
- parent->len += strlen(newfp->name) + 8;/*ok, ok?*/
- } else {
- /*
- * it's the root node, put in the dvm
- * and link it to itself...
- * we know it's a DIR
- */
- dnp->by.Dir.parent = newfp->dnp;
- dnp->links++; /* extra for '..'*/
- dnp->dvm = dvm;
- }
-
- /*
- * not accounted for in the link counts..
- * only used to get from the front name entries
- * to the total length of the names
- * which is stored in the parent's devnode
- */
- newfp->parent = parent; /* is NULL for root */
- /*******************************************************\
- * Put it in the appropriate back/front list too. *
- \*******************************************************/
- newfp->next_front = *back->prev_frontp;
- newfp->prev_frontp = back->prev_frontp;
- *back->prev_frontp = newfp;
- back->prev_frontp = &(newfp->next_front);
- back->frontcount++;
- newfp->as.front.realthing = back;
-
- /*
- * If it is a directory, then recurse down all the other
- * subnodes in it....
- */
- if ( newfp->dnp->type == DEV_DIR)
- {
- for(newback = back->dnp->by.Dir.dirlist;
- newback; newback = newback->next)
- {
- if(error = dev_mk_front(newfp->dnp,
- newback, &newfront, NULL))
- {
- return error;
- }
- }
- }
- *devnm_pp = newfp;
- return(0);
-}
-
-/*
- * duplicate the backing tree into a tree of nodes hung off the
- * mount point given as the argument. Do this by
- * calling dev_mk_front() which recurses all the way
- * up the tree..
- */
-int devfs_make_plane(struct devfsmount *devfs_mp_p) /*proto*/
-{
- devnm_p parent;
- devnm_p new;
- devnm_p realthing;
- int error;
-
- DBPRINT((" devfs_make_plane\n"));
- realthing = dev_root;
- if(error = dev_mk_front(0, realthing,&new, devfs_mp_p))
- {
- return error;
- }
- devfs_mp_p->plane_root = new;
-
- return error;
-}
-
-void devfs_free_plane(struct devfsmount *devfs_mp_p) /*proto*/
-{
- devnm_p devfp;
-
- DBPRINT((" devfs_free_plane\n"));
- devfp = devfs_mp_p->plane_root;
- if(devfp) dev_free_front(devfp);
-}
-
-/*
- * Remove all the front nodes associated with a backing node
- */
-void devfs_remove_fronts(devnm_p devbp) /*proto*/
-{
- while(devbp->next_front)
- {
- dev_free_front(devbp->next_front);
- }
-}
-/***************************************************************\
-* Free a front node (and any below it of it's a directory node) *
-\***************************************************************/
-void dev_free_front(devnm_p devfp) /*proto*/
-{
- dn_p parent = devfp->parent;
- devnm_p back;
-
- DBPRINT((" dev_free_front\n"));
- if(devfp->dnp->type == DEV_DIR)
- {
- while(devfp->dnp->by.Dir.dirlist)
- {
- dev_free_front(devfp->dnp->by.Dir.dirlist);
- }
- /*
- * drop the reference counts on our and our parent's
- * nodes for "." and ".." (root has ".." -> "." )
- */
- devfs_dn_free(devfp->dnp); /* account for '.' */
- devfs_dn_free(devfp->dnp->by.Dir.parent); /* and '..' */
- }
- /*
- * unlink ourselves from the directory on this plane
- */
- if(parent) /* if not fs root */
- {
- if( *devfp->prevp = devfp->next)/* yes, assign */
- {
- devfp->next->prevp = devfp->prevp;
- }
- else
- {
- parent->by.Dir.dirlast
- = devfp->prevp;
- }
- parent->by.Dir.entrycount--;
- parent->len -= strlen(devfp->name);
- }
- /*
- * If the node has a backing pointer we need to free ourselves
- * from that..
- * Remember that we may not HAVE a backing node.
- */
- if (back = devfp->as.front.realthing) /* yes an assign */
- {
- if( *devfp->prev_frontp = devfp->next_front)/* yes, assign */
- {
- devfp->next_front->prev_frontp = devfp->prev_frontp;
- }
- else
- {
- back->prev_frontp = devfp->prev_frontp;
- }
- back->frontcount--;
- }
- /***************************************************************\
- * If the front node has it's own devnode structure, *
- * then free it. *
- \***************************************************************/
- devfs_dn_free(devfp->dnp);
- free(devfp,M_DEVFSFRONT);
- return;
-}
-
-/*******************************************************\
-* Theoretically this could be called for any kind of *
-* vnode, however in practice it must be a DEVFS vnode *
-\*******************************************************/
-int devfs_vntodn(struct vnode *vn_p, dn_p *dn_pp) /*proto*/
-{
-
-DBPRINT((" vntodn "));
- if(vn_p->v_tag != VT_DEVFS)
- {
- printf("bad-tag ");
- Debugger("bad-tag ");
- return(EINVAL);
- }
- if(vn_p->v_usecount == 0)
- {
- printf("not locked! ");
- }
- if((vn_p->v_type == VBAD) || (vn_p->v_type == VNON))
- {
- printf("bad-type ");
- return(EINVAL);
- }
- *dn_pp = (dn_p)vn_p->v_data;
-
- return(0);
-}
-
-/***************************************************************\
-* given a dev_node, find the appropriate vnode if one is already*
-* associated, or get a new one an associate it with the dev_node*
-* need to check about vnode references.. should we increment it?*
-\***************************************************************/
-int devfs_dntovn(dn_p dnp, struct vnode **vn_pp) /*proto*/
-{
- struct vnode *vn_p, *nvp;
- int error = 0;
-
- vn_p = dnp->vn;
-DBPRINT(("dntovn "));
- if( vn_p)
- {
- if(vn_p->v_id != dnp->vn_id)
- {
- printf("bad-id ");
- goto skip;
- }
- if(vn_p->v_tag != VT_DEVFS)
- {
- printf("bad-tag ");
- goto skip;
- }
- if(vn_p->v_op != *(dnp->ops))
- {
- printf("bad-ops ");
- goto skip;
- }
- if((dn_p)(vn_p->v_data) != dnp)
- {
- printf("bad-rev_link ");
- goto skip;
- }
- if(vn_p->v_type != VNON)
- {
- vget(vn_p,0/*lockflag ?*/); /*XXX*/
- *vn_pp = vn_p;
- return(0);
- }
- else
- {
- printf("bad-type");
- }
-skip:
- vn_p = (struct vnode *) 0;
- }
- if(!(error = getnewvnode(VT_DEVFS,
- dnp->dvm->mount,
- *(dnp->ops),
- &vn_p)))
- {
- dnp->vn = vn_p;
- dnp->vn_id = vn_p->v_id;
- *vn_pp = vn_p;
-DBPRINT(("(New vnode)"));
- switch(dnp->type)
- {
- case DEV_SLNK:
- break;
- case DEV_DIR:
- if(dnp->by.Dir.parent == dnp)
- {
- vn_p->v_flag |= VROOT;
- }
- vn_p->v_type = VDIR;
- break;
- case DEV_BDEV:
- vn_p->v_type = VBLK;
- if (nvp = checkalias(vn_p,
- dnp->by.Bdev.dev,
- (struct mount *)0))
- {
- vput(vn_p);
- vn_p = nvp;
- }
- break;
- case DEV_CDEV:
- vn_p->v_type = VCHR;
- if (nvp = checkalias(vn_p,
- dnp->by.Cdev.dev,
- (struct mount *)0))
- {
- vput(vn_p);
- vn_p = nvp;
- }
- break;
- case DEV_DDEV:
- break;
- }
- if ( vn_p)
- {
- vn_p->v_mount = dnp->dvm->mount;/* XXX Duplicated */
- *vn_pp = vn_p;
- vn_p->v_data = (void *)dnp;
- }
- else
- {
- error = EINVAL;
- }
- }
- return error;
-}
diff --git a/sys/sys/map.h b/sys/sys/map.h
deleted file mode 100644
index 7c793a3..0000000
--- a/sys/sys/map.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- *
- * @(#)map.h 8.3 (Berkeley) 1/26/94
- * $Id: map.h,v 1.3 1994/08/21 04:41:50 paul Exp $
- */
-
-#ifndef _SYS_MAP_H_
-#define _SYS_MAP_H_
-
-struct map {
- struct mapent *m_limit; /* address of last slot in map */
- char *m_name; /* name of resource, for messages */
-};
-
-struct mapent {
- long m_size; /* size of this segment of the map */
- long m_addr; /* start of segment */
-};
-
-#ifdef KERNEL
-#define ARGMAPSIZE 16
-struct map *kmemmap, *mbmap, *swapmap;
-int nswapmap;
-#endif
-
-#endif
diff --git a/sys/sys/trace.h b/sys/sys/trace.h
deleted file mode 100644
index 85b4759..0000000
--- a/sys/sys/trace.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*-
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- *
- * @(#)trace.h 8.1 (Berkeley) 6/2/93
- * $Id: trace.h,v 1.2 1994/08/02 07:53:52 davidg Exp $
- */
-
-#ifndef _SYS_TRACE_H_
-#define _SYS_TRACE_H_
-
-/*
- * File system buffer tracing points; all trace <pack(dev, size), bn>
- */
-#define TR_BREADHIT 0 /* buffer read found in cache */
-#define TR_BREADMISS 1 /* buffer read not in cache */
-#define TR_BWRITE 2 /* buffer written */
-#define TR_BREADHITRA 3 /* buffer read-ahead found in cache */
-#define TR_BREADMISSRA 4 /* buffer read-ahead not in cache */
-#define TR_XFODMISS 5 /* exe fod read */
-#define TR_XFODHIT 6 /* exe fod read */
-#define TR_BRELSE 7 /* brelse */
-#define TR_BREALLOC 8 /* expand/contract a buffer */
-
-/*
- * Memory allocator trace points; all trace the amount of memory involved
- */
-#define TR_MALL 10 /* memory allocated */
-
-/*
- * Paging trace points: all are <vaddr, pid>
- */
-#define TR_INTRANS 20 /* page intransit block */
-#define TR_EINTRANS 21 /* page intransit wait done */
-#define TR_FRECLAIM 22 /* reclaim from free list */
-#define TR_RECLAIM 23 /* reclaim from loop */
-#define TR_XSFREC 24 /* reclaim from free list instead of drum */
-#define TR_XIFREC 25 /* reclaim from free list instead of fsys */
-#define TR_WAITMEM 26 /* wait for memory in pagein */
-#define TR_EWAITMEM 27 /* end memory wait in pagein */
-#define TR_ZFOD 28 /* zfod page fault */
-#define TR_EXFOD 29 /* exec fod page fault */
-#define TR_VRFOD 30 /* vread fod page fault */
-#define TR_CACHEFOD 31 /* fod in file system cache */
-#define TR_SWAPIN 32 /* drum page fault */
-#define TR_PGINDONE 33 /* page in done */
-#define TR_SWAPIO 34 /* swap i/o request arrives */
-
-/*
- * System call trace points.
- */
-#define TR_VADVISE 40 /* vadvise occurred with <arg, pid> */
-
-/*
- * Miscellaneous
- */
-#define TR_STAMP 45 /* user said vtrace(VTR_STAMP, value); */
-
-/*
- * This defines the size of the trace flags array.
- */
-#define TR_NFLAGS 100 /* generous */
-
-#define TRCSIZ 4096
-
-/*
- * Specifications of the vtrace() system call, which takes one argument.
- */
-#define VTRACE 64+51
-
-#define VTR_DISABLE 0 /* set a trace flag to 0 */
-#define VTR_ENABLE 1 /* set a trace flag to 1 */
-#define VTR_VALUE 2 /* return value of a trace flag */
-#define VTR_UALARM 3 /* set alarm to go off (sig 16) */
- /* in specified number of hz */
-#define VTR_STAMP 4 /* user specified stamp */
-
-#ifdef KERNEL
-#ifdef TRACE
-struct proc *traceproc;
-int tracewhich, tracebuf[TRCSIZ];
-u_int tracex;
-char traceflags[TR_NFLAGS];
-#define pack(v,b) (((v)->v_mount->mnt_stat.f_fsid.val[0])<<16)|(b)
-#define trace(a,b,c) { \
- if (traceflags[a]) \
- trace1(a,b,c); \
-}
-#else
-#define trace(a,b,c)
-#endif
-#endif
-
-#endif
diff --git a/sys/ufs/ufs/lockf.h b/sys/ufs/ufs/lockf.h
deleted file mode 100644
index f549166..0000000
--- a/sys/ufs/ufs/lockf.h
+++ /dev/null
@@ -1,80 +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
- * Scooter Morris at Genentech Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- *
- * @(#)lockf.h 8.1 (Berkeley) 6/11/93
- * $Id$
- */
-
-/*
- * The lockf structure is a kernel structure which contains the information
- * associated with a byte range lock. The lockf structures are linked into
- * the inode structure. Locks are sorted by the starting byte of the lock for
- * efficiency.
- */
-struct lockf {
- short lf_flags; /* Lock semantics: F_POSIX, F_FLOCK, F_WAIT */
- short lf_type; /* Lock type: F_RDLCK, F_WRLCK */
- off_t lf_start; /* The byte # of the start of the lock */
- off_t lf_end; /* The byte # of the end of the lock (-1=EOF)*/
- caddr_t lf_id; /* The id of the resource holding the lock */
- struct inode *lf_inode; /* Back pointer to the inode */
- struct lockf *lf_next; /* A pointer to the next lock on this inode */
- struct lockf *lf_block; /* The list of blocked locks */
-};
-
-/* Maximum length of sleep chains to traverse to try and detect deadlock. */
-#define MAXDEPTH 50
-
-__BEGIN_DECLS
-void lf_addblock __P((struct lockf *, struct lockf *));
-int lf_clearlock __P((struct lockf *));
-int lf_findoverlap __P((struct lockf *,
- struct lockf *, int, struct lockf ***, struct lockf **));
-struct lockf *
- lf_getblock __P((struct lockf *));
-int lf_getlock __P((struct lockf *, struct flock *));
-int lf_setlock __P((struct lockf *));
-void lf_split __P((struct lockf *, struct lockf *));
-void lf_wakelock __P((struct lockf *));
-__END_DECLS
-
-#ifdef LOCKF_DEBUG
-extern int lockf_debug;
-
-__BEGIN_DECLS
-void lf_print __P((char *, struct lockf *));
-void lf_printlist __P((char *, struct lockf *));
-__END_DECLS
-#endif
diff --git a/sys/ufs/ufs/ufs_lockf.c b/sys/ufs/ufs/ufs_lockf.c
deleted file mode 100644
index bdc22cd..0000000
--- a/sys/ufs/ufs/ufs_lockf.c
+++ /dev/null
@@ -1,708 +0,0 @@
-/*
- * Copyright (c) 1982, 1986, 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Scooter Morris at Genentech Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- *
- * @(#)ufs_lockf.c 8.3 (Berkeley) 1/6/94
- * $Id$
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/file.h>
-#include <sys/proc.h>
-#include <sys/vnode.h>
-#include <sys/malloc.h>
-#include <sys/fcntl.h>
-
-#include <ufs/ufs/lockf.h>
-#include <ufs/ufs/quota.h>
-#include <ufs/ufs/inode.h>
-#include <ufs/ufs/ufs_extern.h>
-
-/*
- * This variable controls the maximum number of processes that will
- * be checked in doing deadlock detection.
- */
-int maxlockdepth = MAXDEPTH;
-
-#ifdef LOCKF_DEBUG
-int lockf_debug = 0;
-#endif
-
-#define NOLOCKF (struct lockf *)0
-#define SELF 0x1
-#define OTHERS 0x2
-
-/*
- * Set a byte-range lock.
- */
-int
-lf_setlock(lock)
- register struct lockf *lock;
-{
- register struct lockf *block;
- struct inode *ip = lock->lf_inode;
- struct lockf **prev, *overlap, *ltmp;
- static char lockstr[] = "lockf";
- int ovcase, priority, needtolink, error;
-
-#ifdef LOCKF_DEBUG
- if (lockf_debug & 1)
- lf_print("lf_setlock", lock);
-#endif /* LOCKF_DEBUG */
-
- /*
- * Set the priority
- */
- priority = PLOCK;
- if (lock->lf_type == F_WRLCK)
- priority += 4;
- priority |= PCATCH;
- /*
- * Scan lock list for this file looking for locks that would block us.
- */
- while (block = lf_getblock(lock)) {
- /*
- * Free the structure and return if nonblocking.
- */
- if ((lock->lf_flags & F_WAIT) == 0) {
- FREE(lock, M_LOCKF);
- return (EAGAIN);
- }
- /*
- * We are blocked. Since flock style locks cover
- * the whole file, there is no chance for deadlock.
- * For byte-range locks we must check for deadlock.
- *
- * Deadlock detection is done by looking through the
- * wait channels to see if there are any cycles that
- * involve us. MAXDEPTH is set just to make sure we
- * do not go off into neverland.
- */
- if ((lock->lf_flags & F_POSIX) &&
- (block->lf_flags & F_POSIX)) {
- register struct proc *wproc;
- register struct lockf *waitblock;
- int i = 0;
-
- /* The block is waiting on something */
- wproc = (struct proc *)block->lf_id;
- while (wproc->p_wchan &&
- (wproc->p_wmesg == lockstr) &&
- (i++ < maxlockdepth)) {
- waitblock = (struct lockf *)wproc->p_wchan;
- /* Get the owner of the blocking lock */
- waitblock = waitblock->lf_next;
- if ((waitblock->lf_flags & F_POSIX) == 0)
- break;
- wproc = (struct proc *)waitblock->lf_id;
- if (wproc == (struct proc *)lock->lf_id) {
- free(lock, M_LOCKF);
- return (EDEADLK);
- }
- }
- }
- /*
- * For flock type locks, we must first remove
- * any shared locks that we hold before we sleep
- * waiting for an exclusive lock.
- */
- if ((lock->lf_flags & F_FLOCK) &&
- lock->lf_type == F_WRLCK) {
- lock->lf_type = F_UNLCK;
- (void) lf_clearlock(lock);
- lock->lf_type = F_WRLCK;
- }
- /*
- * Add our lock to the blocked list and sleep until we're free.
- * Remember who blocked us (for deadlock detection).
- */
- lock->lf_next = block;
- lf_addblock(block, lock);
-#ifdef LOCKF_DEBUG
- if (lockf_debug & 1) {
- lf_print("lf_setlock: blocking on", block);
- lf_printlist("lf_setlock", block);
- }
-#endif /* LOCKF_DEBUG */
- if (error = tsleep((caddr_t)lock, priority, lockstr, 0)) {
- /*
- * Delete ourselves from the waiting to lock list.
- */
- for (block = lock->lf_next;
- block != NOLOCKF;
- block = block->lf_block) {
- if (block->lf_block != lock)
- continue;
- block->lf_block = block->lf_block->lf_block;
- break;
- }
- /*
- * If we did not find ourselves on the list, but
- * are still linked onto a lock list, then something
- * is very wrong.
- */
- if (block == NOLOCKF && lock->lf_next != NOLOCKF)
- panic("lf_setlock: lost lock");
- free(lock, M_LOCKF);
- return (error);
- }
- }
- /*
- * No blocks!! Add the lock. Note that we will
- * downgrade or upgrade any overlapping locks this
- * process already owns.
- *
- * Skip over locks owned by other processes.
- * Handle any locks that overlap and are owned by ourselves.
- */
- prev = &ip->i_lockf;
- block = ip->i_lockf;
- needtolink = 1;
- for (;;) {
- if (ovcase = lf_findoverlap(block, lock, SELF, &prev, &overlap))
- block = overlap->lf_next;
- /*
- * Six cases:
- * 0) no overlap
- * 1) overlap == lock
- * 2) overlap contains lock
- * 3) lock contains overlap
- * 4) overlap starts before lock
- * 5) overlap ends after lock
- */
- switch (ovcase) {
- case 0: /* no overlap */
- if (needtolink) {
- *prev = lock;
- lock->lf_next = overlap;
- }
- break;
-
- case 1: /* overlap == lock */
- /*
- * If downgrading lock, others may be
- * able to acquire it.
- */
- if (lock->lf_type == F_RDLCK &&
- overlap->lf_type == F_WRLCK)
- lf_wakelock(overlap);
- overlap->lf_type = lock->lf_type;
- FREE(lock, M_LOCKF);
- lock = overlap; /* for debug output below */
- break;
-
- case 2: /* overlap contains lock */
- /*
- * Check for common starting point and different types.
- */
- if (overlap->lf_type == lock->lf_type) {
- free(lock, M_LOCKF);
- lock = overlap; /* for debug output below */
- break;
- }
- if (overlap->lf_start == lock->lf_start) {
- *prev = lock;
- lock->lf_next = overlap;
- overlap->lf_start = lock->lf_end + 1;
- } else
- lf_split(overlap, lock);
- lf_wakelock(overlap);
- break;
-
- case 3: /* lock contains overlap */
- /*
- * If downgrading lock, others may be able to
- * acquire it, otherwise take the list.
- */
- if (lock->lf_type == F_RDLCK &&
- overlap->lf_type == F_WRLCK) {
- lf_wakelock(overlap);
- } else {
- ltmp = lock->lf_block;
- lock->lf_block = overlap->lf_block;
- lf_addblock(lock, ltmp);
- }
- /*
- * Add the new lock if necessary and delete the overlap.
- */
- if (needtolink) {
- *prev = lock;
- lock->lf_next = overlap->lf_next;
- prev = &lock->lf_next;
- needtolink = 0;
- } else
- *prev = overlap->lf_next;
- free(overlap, M_LOCKF);
- continue;
-
- case 4: /* overlap starts before lock */
- /*
- * Add lock after overlap on the list.
- */
- lock->lf_next = overlap->lf_next;
- overlap->lf_next = lock;
- overlap->lf_end = lock->lf_start - 1;
- prev = &lock->lf_next;
- lf_wakelock(overlap);
- needtolink = 0;
- continue;
-
- case 5: /* overlap ends after lock */
- /*
- * Add the new lock before overlap.
- */
- if (needtolink) {
- *prev = lock;
- lock->lf_next = overlap;
- }
- overlap->lf_start = lock->lf_end + 1;
- lf_wakelock(overlap);
- break;
- }
- break;
- }
-#ifdef LOCKF_DEBUG
- if (lockf_debug & 1) {
- lf_print("lf_setlock: got the lock", lock);
- lf_printlist("lf_setlock", lock);
- }
-#endif /* LOCKF_DEBUG */
- return (0);
-}
-
-/*
- * Remove a byte-range lock on an inode.
- *
- * Generally, find the lock (or an overlap to that lock)
- * and remove it (or shrink it), then wakeup anyone we can.
- */
-int
-lf_clearlock(unlock)
- register struct lockf *unlock;
-{
- struct inode *ip = unlock->lf_inode;
- register struct lockf *lf = ip->i_lockf;
- struct lockf *overlap, **prev;
- int ovcase;
-
- if (lf == NOLOCKF)
- return (0);
-#ifdef LOCKF_DEBUG
- if (unlock->lf_type != F_UNLCK)
- panic("lf_clearlock: bad type");
- if (lockf_debug & 1)
- lf_print("lf_clearlock", unlock);
-#endif /* LOCKF_DEBUG */
- prev = &ip->i_lockf;
- while (ovcase = lf_findoverlap(lf, unlock, SELF, &prev, &overlap)) {
- /*
- * Wakeup the list of locks to be retried.
- */
- lf_wakelock(overlap);
-
- switch (ovcase) {
-
- case 1: /* overlap == lock */
- *prev = overlap->lf_next;
- FREE(overlap, M_LOCKF);
- break;
-
- case 2: /* overlap contains lock: split it */
- if (overlap->lf_start == unlock->lf_start) {
- overlap->lf_start = unlock->lf_end + 1;
- break;
- }
- lf_split(overlap, unlock);
- overlap->lf_next = unlock->lf_next;
- break;
-
- case 3: /* lock contains overlap */
- *prev = overlap->lf_next;
- lf = overlap->lf_next;
- free(overlap, M_LOCKF);
- continue;
-
- case 4: /* overlap starts before lock */
- overlap->lf_end = unlock->lf_start - 1;
- prev = &overlap->lf_next;
- lf = overlap->lf_next;
- continue;
-
- case 5: /* overlap ends after lock */
- overlap->lf_start = unlock->lf_end + 1;
- break;
- }
- break;
- }
-#ifdef LOCKF_DEBUG
- if (lockf_debug & 1)
- lf_printlist("lf_clearlock", unlock);
-#endif /* LOCKF_DEBUG */
- return (0);
-}
-
-/*
- * Check whether there is a blocking lock,
- * and if so return its process identifier.
- */
-int
-lf_getlock(lock, fl)
- register struct lockf *lock;
- register struct flock *fl;
-{
- register struct lockf *block;
-
-#ifdef LOCKF_DEBUG
- if (lockf_debug & 1)
- lf_print("lf_getlock", lock);
-#endif /* LOCKF_DEBUG */
-
- if (block = lf_getblock(lock)) {
- fl->l_type = block->lf_type;
- fl->l_whence = SEEK_SET;
- fl->l_start = block->lf_start;
- if (block->lf_end == -1)
- fl->l_len = 0;
- else
- fl->l_len = block->lf_end - block->lf_start + 1;
- if (block->lf_flags & F_POSIX)
- fl->l_pid = ((struct proc *)(block->lf_id))->p_pid;
- else
- fl->l_pid = -1;
- } else {
- fl->l_type = F_UNLCK;
- }
- return (0);
-}
-
-/*
- * Walk the list of locks for an inode and
- * return the first blocking lock.
- */
-struct lockf *
-lf_getblock(lock)
- register struct lockf *lock;
-{
- struct lockf **prev, *overlap, *lf = lock->lf_inode->i_lockf;
- int ovcase;
-
- prev = &lock->lf_inode->i_lockf;
- while (ovcase = lf_findoverlap(lf, lock, OTHERS, &prev, &overlap)) {
- /*
- * We've found an overlap, see if it blocks us
- */
- if ((lock->lf_type == F_WRLCK || overlap->lf_type == F_WRLCK))
- return (overlap);
- /*
- * Nope, point to the next one on the list and
- * see if it blocks us
- */
- lf = overlap->lf_next;
- }
- return (NOLOCKF);
-}
-
-/*
- * Walk the list of locks for an inode to
- * find an overlapping lock (if any).
- *
- * NOTE: this returns only the FIRST overlapping lock. There
- * may be more than one.
- */
-int
-lf_findoverlap(lf, lock, type, prev, overlap)
- register struct lockf *lf;
- struct lockf *lock;
- int type;
- struct lockf ***prev;
- struct lockf **overlap;
-{
- off_t start, end;
-
- *overlap = lf;
- if (lf == NOLOCKF)
- return (0);
-#ifdef LOCKF_DEBUG
- if (lockf_debug & 2)
- lf_print("lf_findoverlap: looking for overlap in", lock);
-#endif /* LOCKF_DEBUG */
- start = lock->lf_start;
- end = lock->lf_end;
- while (lf != NOLOCKF) {
- if (((type & SELF) && lf->lf_id != lock->lf_id) ||
- ((type & OTHERS) && lf->lf_id == lock->lf_id)) {
- *prev = &lf->lf_next;
- *overlap = lf = lf->lf_next;
- continue;
- }
-#ifdef LOCKF_DEBUG
- if (lockf_debug & 2)
- lf_print("\tchecking", lf);
-#endif /* LOCKF_DEBUG */
- /*
- * OK, check for overlap
- *
- * Six cases:
- * 0) no overlap
- * 1) overlap == lock
- * 2) overlap contains lock
- * 3) lock contains overlap
- * 4) overlap starts before lock
- * 5) overlap ends after lock
- */
- if ((lf->lf_end != -1 && start > lf->lf_end) ||
- (end != -1 && lf->lf_start > end)) {
- /* Case 0 */
-#ifdef LOCKF_DEBUG
- if (lockf_debug & 2)
- printf("no overlap\n");
-#endif /* LOCKF_DEBUG */
- if ((type & SELF) && end != -1 && lf->lf_start > end)
- return (0);
- *prev = &lf->lf_next;
- *overlap = lf = lf->lf_next;
- continue;
- }
- if ((lf->lf_start == start) && (lf->lf_end == end)) {
- /* Case 1 */
-#ifdef LOCKF_DEBUG
- if (lockf_debug & 2)
- printf("overlap == lock\n");
-#endif /* LOCKF_DEBUG */
- return (1);
- }
- if ((lf->lf_start <= start) &&
- (end != -1) &&
- ((lf->lf_end >= end) || (lf->lf_end == -1))) {
- /* Case 2 */
-#ifdef LOCKF_DEBUG
- if (lockf_debug & 2)
- printf("overlap contains lock\n");
-#endif /* LOCKF_DEBUG */
- return (2);
- }
- if (start <= lf->lf_start &&
- (end == -1 ||
- (lf->lf_end != -1 && end >= lf->lf_end))) {
- /* Case 3 */
-#ifdef LOCKF_DEBUG
- if (lockf_debug & 2)
- printf("lock contains overlap\n");
-#endif /* LOCKF_DEBUG */
- return (3);
- }
- if ((lf->lf_start < start) &&
- ((lf->lf_end >= start) || (lf->lf_end == -1))) {
- /* Case 4 */
-#ifdef LOCKF_DEBUG
- if (lockf_debug & 2)
- printf("overlap starts before lock\n");
-#endif /* LOCKF_DEBUG */
- return (4);
- }
- if ((lf->lf_start > start) &&
- (end != -1) &&
- ((lf->lf_end > end) || (lf->lf_end == -1))) {
- /* Case 5 */
-#ifdef LOCKF_DEBUG
- if (lockf_debug & 2)
- printf("overlap ends after lock\n");
-#endif /* LOCKF_DEBUG */
- return (5);
- }
- panic("lf_findoverlap: default");
- }
- return (0);
-}
-
-/*
- * Add a lock to the end of the blocked list.
- */
-void
-lf_addblock(lock, blocked)
- struct lockf *lock;
- struct lockf *blocked;
-{
- register struct lockf *lf;
-
- if (blocked == NOLOCKF)
- return;
-#ifdef LOCKF_DEBUG
- if (lockf_debug & 2) {
- lf_print("addblock: adding", blocked);
- lf_print("to blocked list of", lock);
- }
-#endif /* LOCKF_DEBUG */
- if ((lf = lock->lf_block) == NOLOCKF) {
- lock->lf_block = blocked;
- return;
- }
- while (lf->lf_block != NOLOCKF)
- lf = lf->lf_block;
- lf->lf_block = blocked;
- return;
-}
-
-/*
- * Split a lock and a contained region into
- * two or three locks as necessary.
- */
-void
-lf_split(lock1, lock2)
- register struct lockf *lock1;
- register struct lockf *lock2;
-{
- register struct lockf *splitlock;
-
-#ifdef LOCKF_DEBUG
- if (lockf_debug & 2) {
- lf_print("lf_split", lock1);
- lf_print("splitting from", lock2);
- }
-#endif /* LOCKF_DEBUG */
- /*
- * Check to see if spliting into only two pieces.
- */
- if (lock1->lf_start == lock2->lf_start) {
- lock1->lf_start = lock2->lf_end + 1;
- lock2->lf_next = lock1;
- return;
- }
- if (lock1->lf_end == lock2->lf_end) {
- lock1->lf_end = lock2->lf_start - 1;
- lock2->lf_next = lock1->lf_next;
- lock1->lf_next = lock2;
- return;
- }
- /*
- * Make a new lock consisting of the last part of
- * the encompassing lock
- */
- MALLOC(splitlock, struct lockf *, sizeof *splitlock, M_LOCKF, M_WAITOK);
- bcopy((caddr_t)lock1, (caddr_t)splitlock, sizeof *splitlock);
- splitlock->lf_start = lock2->lf_end + 1;
- splitlock->lf_block = NOLOCKF;
- lock1->lf_end = lock2->lf_start - 1;
- /*
- * OK, now link it in
- */
- splitlock->lf_next = lock1->lf_next;
- lock2->lf_next = splitlock;
- lock1->lf_next = lock2;
-}
-
-/*
- * Wakeup a blocklist
- */
-void
-lf_wakelock(listhead)
- struct lockf *listhead;
-{
- register struct lockf *blocklist, *wakelock;
-
- blocklist = listhead->lf_block;
- listhead->lf_block = NOLOCKF;
- while (blocklist != NOLOCKF) {
- wakelock = blocklist;
- blocklist = blocklist->lf_block;
- wakelock->lf_block = NOLOCKF;
- wakelock->lf_next = NOLOCKF;
-#ifdef LOCKF_DEBUG
- if (lockf_debug & 2)
- lf_print("lf_wakelock: awakening", wakelock);
-#endif /* LOCKF_DEBUG */
- wakeup((caddr_t)wakelock);
- }
-}
-
-#ifdef LOCKF_DEBUG
-/*
- * Print out a lock.
- */
-void
-lf_print(tag, lock)
- char *tag;
- register struct lockf *lock;
-{
-
- printf("%s: lock 0x%lx for ", tag, lock);
- if (lock->lf_flags & F_POSIX)
- printf("proc %d", ((struct proc *)(lock->lf_id))->p_pid);
- else
- printf("id 0x%x", lock->lf_id);
- printf(" in ino %d on dev <%d, %d>, %s, start %d, end %d",
- lock->lf_inode->i_number,
- major(lock->lf_inode->i_dev),
- minor(lock->lf_inode->i_dev),
- lock->lf_type == F_RDLCK ? "shared" :
- lock->lf_type == F_WRLCK ? "exclusive" :
- lock->lf_type == F_UNLCK ? "unlock" :
- "unknown", lock->lf_start, lock->lf_end);
- if (lock->lf_block)
- printf(" block 0x%x\n", lock->lf_block);
- else
- printf("\n");
-}
-
-void
-lf_printlist(tag, lock)
- char *tag;
- struct lockf *lock;
-{
- register struct lockf *lf;
-
- printf("%s: Lock list for ino %d on dev <%d, %d>:\n",
- tag, lock->lf_inode->i_number,
- major(lock->lf_inode->i_dev),
- minor(lock->lf_inode->i_dev));
- for (lf = lock->lf_inode->i_lockf; lf; lf = lf->lf_next) {
- printf("\tlock 0x%lx for ", lf);
- if (lf->lf_flags & F_POSIX)
- printf("proc %d", ((struct proc *)(lf->lf_id))->p_pid);
- else
- printf("id 0x%x", lf->lf_id);
- printf(", %s, start %d, end %d",
- lf->lf_type == F_RDLCK ? "shared" :
- lf->lf_type == F_WRLCK ? "exclusive" :
- lf->lf_type == F_UNLCK ? "unlock" :
- "unknown", lf->lf_start, lf->lf_end);
- if (lf->lf_block)
- printf(" block 0x%x\n", lf->lf_block);
- else
- printf("\n");
- }
-}
-#endif /* LOCKF_DEBUG */
diff --git a/sys/vm/vm_user.c b/sys/vm/vm_user.c
deleted file mode 100644
index 104e814..0000000
--- a/sys/vm/vm_user.c
+++ /dev/null
@@ -1,130 +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 Mach Operating System project at Carnegie-Mellon 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.
- *
- * from: @(#)vm_user.c 8.2 (Berkeley) 1/12/94
- *
- *
- * Copyright (c) 1987, 1990 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Authors: Avadis Tevanian, Jr., Michael Wayne Young
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- *
- * $Id: vm_user.c,v 1.8 1995/02/20 18:08:18 davidg Exp $
- */
-
-/*
- * User-exported virtual memory functions.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-
-#include <vm/vm.h>
-
-simple_lock_data_t vm_alloc_lock; /* XXX */
-
-/*
- * Similar to vm_allocate but assigns an explicit pager.
- */
-int
-vm_allocate_with_pager(map, addr, size, anywhere, pager, poffset, internal)
- register vm_map_t map;
- register vm_offset_t *addr;
- register vm_size_t size;
- boolean_t anywhere;
- vm_pager_t pager;
- vm_offset_t poffset;
- boolean_t internal;
-{
- register vm_object_t object;
- register int result;
-
- if (map == NULL)
- return (KERN_INVALID_ARGUMENT);
-
- *addr = trunc_page(*addr);
- size = round_page(size);
-
- /*
- * Lookup the pager/paging-space in the object cache. If it's not
- * there, then create a new object and cache it.
- */
- object = vm_object_lookup(pager);
- if (object == NULL) {
- object = vm_object_allocate(size);
- /*
- * From Mike Hibler: "unnamed anonymous objects should never
- * be on the hash list ... For now you can just change
- * vm_allocate_with_pager to not do vm_object_enter if this is
- * an internal object ..."
- */
- if (!internal)
- vm_object_enter(object, pager);
- }
- if (internal)
- object->flags |= OBJ_INTERNAL;
- else {
- object->flags &= ~OBJ_INTERNAL;
- cnt.v_nzfod -= atop(size);
- }
-
- result = vm_map_find(map, object, poffset, addr, size, anywhere);
- if (result != KERN_SUCCESS)
- vm_object_deallocate(object);
- else if (pager != NULL)
- vm_object_setpager(object, pager, (vm_offset_t) 0, TRUE);
- return (result);
-}
diff --git a/sys/vm/vm_vmio.c b/sys/vm/vm_vmio.c
deleted file mode 100644
index 8450c92..0000000
--- a/sys/vm/vm_vmio.c
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * Copyright (c) 1994 John S. Dyson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice immediately at the beginning of the file, without modification,
- * this list of conditions, and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Absolutely no warranty of function or purpose is made by the author
- * John S. Dyson.
- * 4. Modifications may be freely made to this file if the above conditions
- * are met.
- *
- * $Id$
- */
-/*
- * THIS IS PRELIMINARY, BUGGY AND NON-WORKING CODE
- * WHEN THIS NOTICE IS REMOVED -- IT WILL WORK... :-).
- *
- * THINGS TO DO:
- * COMMENTS, THE SYSTEM ALMOST RUNS WITH IT. THIS IS CURRENTLY MEANT
- * ONLY AS A PLACEHOLDER!!!
- */
-#define VMIO
-#include "param.h"
-#include "proc.h"
-#include "malloc.h"
-#include "vm_param.h"
-#include "vm.h"
-#include "lock.h"
-#include "queue.h"
-#include "vm_prot.h"
-#include "vm_object.h"
-#include "vm_page.h"
-#include "vnode_pager.h"
-#include "vm_map.h"
-#include "vm_pageout.h"
-#include "vnode.h"
-#include "uio.h"
-#include "mount.h"
-
-/* #include "buf.h" */
-#include "miscfs/specfs/specdev.h"
-/* #include "vmio.h" */
-
-int vnode_pager_initialized;
-extern vm_map_t pager_map;
-
-struct buf * getpbuf();
-void relpbuf(struct buf *bp);
-
-/*
- * map an object into kva
- * return 1 if all are in memory, and 0 if any are fake.
- */
-int
-vmio_alloc_pages( vm_object_t object, vm_offset_t start,
- vm_offset_t size, vm_page_t *ms) {
-
- int pagecount;
- vm_page_t m;
- int i,j;
- int s;
- vm_offset_t kva;
- struct buf *bp;
- int ioneeded=0;
-
- pagecount = size / PAGE_SIZE;
-
- for(i=0;i<pagecount;i++) {
- vm_page_t m;
- m = vm_page_lookup( object, start + i * PAGE_SIZE);
- if( m) {
- /*
- * See if something else has already gotten this page
- */
- if( m->busy || (m->flags & (PG_VMIO|PG_BUSY))) {
- /*
- * Something has the page, so we have to
- * release all the pages we've gotten to
- * this point, wait for the page to unbusy
- * and then start over.
- */
- int j;
- for(j = 0; j < i; j++) {
- vm_page_t n;
- n = ms[j];
- if( n) {
- /*
- * unbusy the page.
- */
- PAGE_WAKEUP(n);
- if( n->flags & PG_FAKE)
- vm_page_free(n);
- }
- }
- m->flags |= PG_WANTED;
- tsleep((caddr_t)m, PVM, "vngpwt", 0);
- return -1;
- }
- m->flags |= PG_REFERENCED;
- } else {
- m = (vm_page_t) vm_page_alloc( object,
- start + i * PAGE_SIZE);
- if( !m) {
- VM_WAIT;
- for(j=0;j<i;j++) {
- vm_page_t n;
- n = ms[j];
- if( n) {
- PAGE_WAKEUP(n);
- if( n->flags & PG_FAKE)
- vm_page_free(n);
- }
- }
- return -1;
- }
- }
- ms[i] = m;
- }
- /*
- * hold the pages and assign them to the mapping
- */
- for(i=0;i<pagecount;i++) {
- m = ms[i];
- vm_page_hold(m);
- if( m->flags & PG_FAKE)
- ++ioneeded;
-
- vm_page_deactivate(m);
- if( (m->flags & PG_ACTIVE) == 0)
- vm_page_activate(m);
- m->flags |= PG_VMIO;
- m->flags &= ~PG_BUSY;
- ++m->act_count;
- pmap_page_protect( VM_PAGE_TO_PHYS(m), VM_PROT_READ);
- }
- return ioneeded;
-
-}
-
-void
-vmio_rawiodone( struct buf *bp) {
- int s;
- int i;
- vm_object_t object;
- vm_page_t m;
-
- if( bp->b_bufsize != bp->b_bcount)
- bzero( bp->b_data + bp->b_bcount, bp->b_bufsize - bp->b_bcount);
- printf("rawdone: (blk: %d, count: %d)\n",
- bp->b_blkno, bp->b_bcount);
- s = splbio();
- object = bp->b_pages[0]->object;
- for( i = 0; i < bp->b_npages; i++) {
- m = bp->b_pages[i];
- if( m) {
- --m->busy;
- if( m->busy == 0) {
- m->flags |= PG_CLEAN;
- m->flags &= ~(PG_LAUNDRY|PG_FAKE);
- PAGE_WAKEUP(m);
- }
- } else {
- panic("vmio_rawiodone: page is gone!!!");
- }
- }
- HOLDRELE(bp->b_vp);
- relpbuf(bp);
- --object->paging_in_progress;
- if( object->paging_in_progress == 0)
- wakeup((caddr_t)object);
- splx(s);
- return;
-}
-
-void
-vmio_get_pager(struct vnode *vp) {
- if( vp->v_type == VREG) {
- vm_object_t object;
- vm_pager_t pager;
- if((vp->v_vmdata == NULL) || (vp->v_flag & VVMIO) == 0) {
- pager = (vm_pager_t) vnode_pager_alloc(vp, 0, 0, 0);
- object = (vm_object_t) vp->v_vmdata;
- if( object->pager != pager)
- panic("vmio_get_pager: pager/object mismatch");
- (void) vm_object_lookup( pager);
- pager_cache( object, TRUE);
- vp->v_flag |= VVMIO;
- } else {
- object = (vm_object_t) vp->v_vmdata;
- pager = object->pager;
- if( pager == NULL) {
- panic("vmio_get_pager: pager missing");
- }
- (void) vm_object_lookup( pager);
- }
- }
-}
-
-void
-vmio_free_pager( struct vnode *vp) {
- if( vp->v_vmdata == NULL)
- panic("vmio_free_pager: object missing");
- vm_object_deallocate( (vm_object_t) vp->v_vmdata);
-}
-
-void
-vmio_aread( struct buf *lbp) {
- struct vnode *vp, *dp;
- vm_object_t object;
- vm_offset_t offset;
- vm_offset_t size;
- vm_offset_t off;
- int forcemore;
- int runp;
- int s;
-
- s = splbio();
- vp = lbp->b_vp;
- object = (vm_object_t) vp->v_vmdata;
- offset = trunc_page(lbp->b_lblkno * vp->v_mount->mnt_stat.f_iosize);
- size = round_page(lbp->b_bcount);
- forcemore = 0;
- printf("queueing read: iosize: %d, b_lblkno: %d, offset: %d, size: %d:",
- vp->v_mount->mnt_stat.f_iosize,
- lbp->b_lblkno, offset, size);
-
- for(off = 0; off < size; ) {
- vm_offset_t curoff;
- int pgidx, pgcnt, i;
- struct buf *bp;
- pgidx = off / PAGE_SIZE;
- if( !forcemore) {
- while( (off < size) &&
- (lbp->b_pages[pgidx]->flags & PG_FAKE) == 0) {
- off = trunc_page(off) + PAGE_SIZE;
- pgidx += 1;
- }
- }
- if( off >= size)
- break;
- bp = getpbuf();
-
- ++object->paging_in_progress;
-
- curoff = offset + off;
- VOP_BMAP( vp, curoff / vp->v_mount->mnt_stat.f_iosize,
- &dp, &bp->b_blkno, &runp);
-
- bp->b_bcount = (runp + 1) * vp->v_mount->mnt_stat.f_iosize;
- if( off + bp->b_bcount > size)
- bp->b_bcount = size - off;
- bp->b_bufsize = round_page(bp->b_bcount);
-
- pgcnt = bp->b_bufsize / PAGE_SIZE;
- for(i=0;i<pgcnt;i++) {
- ++lbp->b_pages[pgidx+i]->busy;
- bp->b_pages[i] = lbp->b_pages[pgidx+i];
- bp->b_pages[i]->flags |= PG_BUSY;
- }
- bp->b_npages = pgcnt;
- pmap_qenter((vm_offset_t) bp->b_data, &lbp->b_pages[pgidx], pgcnt);
- bp->b_data += curoff - trunc_page(curoff);
- off += bp->b_bcount;
- if( off & (PAGE_SIZE - 1))
- forcemore = 1;
- else
- forcemore = 0;
- /*
- * round up physical size for real devices
- */
- if( dp->v_type == VBLK || dp->v_type == VCHR) {
- bp->b_bcount = (bp->b_bcount + DEV_BSIZE - 1) & ~(DEV_BSIZE - 1);
- }
- /*
- * and map the pages to be read into the kva
- */
- VHOLD(vp);
- /* build a minimal buffer header */
- bp->b_flags = B_BUSY | B_READ | B_CALL | B_ASYNC;
- bp->b_iodone = vmio_rawiodone;
- /* B_PHYS is not set, but it is nice to fill this in */
- bp->b_proc = curproc;
- bp->b_rcred = bp->b_wcred = bp->b_proc->p_ucred;
- if( bp->b_rcred != NOCRED)
- crhold(bp->b_rcred);
- if( bp->b_wcred != NOCRED)
- crhold(bp->b_wcred);
- bp->b_lblkno = bp->b_blkno;
-/* bp->b_vp = dp; */
- bgetvp( dp, bp);
- printf(" p: (blk: %d, coff: %d, off: %d, count: %d)",
- bp->b_blkno, curoff, off, bp->b_bcount);
-
- /* Should be a BLOCK or character DEVICE if we get here */
- bp->b_dev = dp->v_rdev;
-
- /* do the input */
- VOP_STRATEGY(bp);
- }
- printf("\n");
- splx(s);
-}
-
-int
-vmio_getblk( struct buf *bp) {
- struct vnode *vp;
- vm_object_t object;
- vm_offset_t offset;
- vm_offset_t size;
- vm_page_t ms[(MAXBSIZE + PAGE_SIZE - 1)/PAGE_SIZE];
- int rtval;
-
- vp = bp->b_vp;
- if( (object = (vm_object_t) vp->v_vmdata) == NULL)
- panic("vmio_build_bp: object missing");
-
- offset = trunc_page(bp->b_lblkno * vp->v_mount->mnt_stat.f_iosize);
- size = round_page(bp->b_bcount);
- printf("vmio_getblk: off:%d(0x%x) blk: %d, size: %d",
- offset, offset, bp->b_lblkno, size);
-
- bp->b_flags &= ~B_CACHE;
- if( (rtval = vmio_alloc_pages( object, offset, size, ms)) == 0) {
- bp->b_flags |= B_CACHE;
- printf("(cached)\n");
- } else {
- printf("(ioneeded:%d)\n", rtval);
- }
-
- if( rtval < 0) {
- printf("vmio_getblk: vmio_alloc_pages busy\n");
- return 0;
- }
-
- bp->b_npages = size / PAGE_SIZE;
- pmap_qenter((vm_offset_t) bp->b_data, ms, bp->b_npages);
- bp->b_flags |= B_VMIO;
- bp->b_bufsize = size;
- bcopy( ms, bp->b_pages, bp->b_npages * sizeof(vm_page_t));
- return 1;
-}
-
-int
-vmio_biowait( struct buf *lbp) {
- int i;
- int s;
- printf("vmio_biowait -->");
-restart:
- s = splbio();
- for(i=lbp->b_npages-1;i >= 0; --i) {
- if( lbp->b_pages[i]->busy || (lbp->b_pages[i]->flags & PG_BUSY)) {
- lbp->b_pages[i]->flags |= PG_WANTED;
- printf(" waiting on page %d of xfer at %d, flags: 0x%x\n",
- i, lbp->b_blkno, lbp->b_pages[i]->flags);
- tsleep( (caddr_t) lbp->b_pages[i], PVM, "vbiowt", 0);
- splx(s);
- goto restart;
- }
- }
- splx(s);
- printf("vmio_biowait: finished\n");
- return 1;
-}
-
-void
-vmio_brelse( struct buf *lbp) {
- int i;
- int nfullpages = lbp->b_bcount / PAGE_SIZE;
- pmap_qremove((vm_offset_t) lbp->b_data, lbp->b_npages);
- for(i=0;i<lbp->b_npages;i++) {
- if( (i < nfullpages) && ((lbp->b_flags & B_DELWRI) == 0))
- lbp->b_pages[i]->flags |= PG_CLEAN;
- if( lbp->b_flags & B_DELWRI)
- lbp->b_pages[i]->flags &= ~PG_CLEAN;
- lbp->b_pages[i]->flags &= ~PG_VMIO;
- vm_page_unhold(lbp->b_pages[i]);
- PAGE_WAKEUP(lbp->b_pages[i]);
- }
- lbp->b_flags &= ~B_VMIO;
- lbp->b_flags |= B_INVAL;
- lbp->b_bufsize = 0;
-}
diff --git a/usr.bin/at/at.1 b/usr.bin/at/at.1
deleted file mode 100644
index e33ba82..0000000
--- a/usr.bin/at/at.1
+++ /dev/null
@@ -1,216 +0,0 @@
-.\"
-.\" Copyright (c) 1993 Christopher G. Demetriou
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by Christopher G. Demetriou.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\" derived from this software withough specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.\" $Id: at.1,v 1.1 1994/01/05 01:08:56 nate Exp $
-.\"
-.Dd December 5, 1993
-.Dt "AT" 1
-.Os FreeBSD 1.1
-.Sh NAME
-.Nm at, batch, atq, atrm
-.Nd queue, examine, or delete jobs for later execution
-.\"
-.Sh SYOPSIS
-.Nm at
-.Op Fl q Ar queue
-.Op Fl f Ar file
-.Op Fl m
-.Ar time
-.Pp
-.Nm atq
-.Op Fl q Ar queue
-.Op Fl v
-.Pp
-.Nm atrm
-.Ar job
-.Op Ar job ...
-.Pp
-.Nm batch
-.Op Fl f Ar file
-.Op Fl m
-.Ar time
-.Sh DESCRIPTION
-The
-.Nm at
-and
-.Nm batch
-utilities read commands from the standard input or a specified file
-which are to be executed at a later time, using
-.Xr sh 1 .
-.Pp
-The functions of the commands are as follows:
-.Bl -tag -width indent
-.It Nm at
-Executes commands at a specified time.
-.It Nm atq
-Lists the user's pending jobs, unless the user is
-the superuser. In that case, everybody's jobs are
-listed.
-.It Nm atrm
-Deletes jobs.
-.It Nm batch
-executes commands when system load levels permit.
-In other words, it executes the commands when the load
-average drops below a specified level.
-.El
-.Pp
-For both
-.Nm at
-and
-.Nm batch ,
-the working directory, environment (except for the variables
-.Nm TERM ,
-.Nm TERMCAP ,
-.Nm DISPLAY ,
-and
-.Nm _ )
-and the umask are retained from the time of invocation. The user
-will be mailed the standard output and standard error from
-his commands if any output is generated. If
-.Nm at
-is executed from a
-.Xr su 1
-shell, the owner of the login whell will receive the mail.
-.Sh OPTIONS
-.Bl -tag -width indent
-The available options are as follows:
-.It Fl q Ar queue
-Use the specified queue. A queue designation consists
-of a single letter; valid queue designation range from
-.Ar a
-to
-.Ar l .
-The
-.Ar a
-queue is the default, and
-.Ar b
-is the batch queue. Queues with higher letters run with
-increased niceness. If
-.Nm atq
-is given a specific queue, it will only show jobs pending
-in that queue.
-.It Fl m
-Send mail to the user when the job has completed, even if
-there was no output.
-.It Fl f Ar file
-Reads the job from
-.Ar file
-rather than the standard input.
-.It Fl v
-Shows completed but not yet deleted jobs in the queue.
-.Sh TIME SPECIFICATION
-.Nm At
-allows some moderately complex time specifications.
-It accepts times of the form
-.Ar HHMM
-or
-.Ar HH:MM
-to run a job at a specific time of day. If
-that time is already passed, the next day is assumed.
-You may also specify
-.Nm midnight ,
-.Nm noon ,
-or
-.Nm teatime
-(4PM) and you can give a time of day suffixed with
-.Nm AM
-or
-.Nm PM
-for running in the morning or the evening. You can
-also specify the date on which the job will be run
-by giving a date in the form
-.Ar month-name day
-with an optional
-.Ar year ,
-or giving a date of the form
-.Ar MMDDYY ,
-.Ar MM/DD/YY
-or
-.Ar DD.MM.YY .
-You can also give times like
-.Nm now +
-.Ar count time-units ,
-where the time units can be
-.Nm minutes, hours, days,
-or
-.Nm weeks
-You can suffix the time with
-.Nm today
-to run the job today, or
-.Nm tomorrow
-to run the job tomorrow.
-.Pp
-For example, to run a job at 4PM three days from now, you
-would specify a time of
-.Nm 4PM + 3 days .
-To run a job at 10:00AM on on July 31, you would specify
-a time of
-.Nm 10AM Jul 31 .
-Finally, to run a job at 1AM tomorrow, you would specify
-a time of
-.Nm 1AM tomorrow .
-.Sh FILES
-.Bl -tag -width /var/at/lockfile -compact
-.It Pa /var/at/jobs
-Directory containing job files
-.It Pa /var/at/spool
-Directory containing output spool files
-.It Pa /var/at/lockfile
-Job-creation lock file.
-.It Pa /var/run/utmp
-.El
-.Sh SEE ALSO
-.Xr crond 8 ,
-.Xr nice 1 ,
-.Xr sh 1 ,
-.Xr atrun 8
-.Sh AUTHOR
-.Bl -tag
-Thomas Koenig, ig25@rz.uni-karlsruhe.de
-.El
-.Sh BUGS
-Traditional access control to
-.Nm at
-and
-.Nm batch
-via the files
-.Pa /var/at/at.allow
-and
-.Pa /var/at/at.deny
-is not implemented.
-.Pp
-If the file
-.Pa /var/run/utmp
-is not available or corrupted, or if the user is not
-logged in at the time
-.Nm at
-is invoked, the mail is sent to the userid found in the
-environment variable
-.Nm LOGNAME .
-If that is undefined or empty, the current userid is assumed.
diff --git a/usr.bin/at/pathnames.h b/usr.bin/at/pathnames.h
deleted file mode 100644
index 400ecfa..0000000
--- a/usr.bin/at/pathnames.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1993 Christopher G. Demetriou
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christopher G. Demetriou.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software withough specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id: pathnames.h,v 1.1 1993/12/05 11:37:23 cgd Exp $
- */
-
-#ifndef _PATHNAMES_H_
-#define _PATHNAMES_H_
-
-#include <paths.h>
-
-#define _PATH_ATJOBS "/var/at/jobs/"
-#define _PATH_ATSPOOL "/var/at/spool/"
-#define _PATH_LOCKFILE "/var/at/lockfile"
-
-#endif /* !_PATHNAMES_H_ */
diff --git a/usr.bin/colldef/data/lt_LN.ISO8859-1 b/usr.bin/colldef/data/lt_LN.ISO8859-1
deleted file mode 100644
index f63cfed..0000000
--- a/usr.bin/colldef/data/lt_LN.ISO8859-1
+++ /dev/null
@@ -1,19 +0,0 @@
-order \
-# controls
- \x01;...;\x1f;\x7f;...;\x9f;\
-# spaces
- \ ;\xa0;\
-# puncts
- .;:;\;;\,;!;?;\xa1;\xbf;\
-# digits
- 0;...;9;\
-# alphas
- a;\xe0;...;\xe5;A;\xc0;...;\xc5;b;B;c;\xe7;C;\xc7;d;D;e;\xe8;...;\xeb;\
- E;\xc8;...;\xcb;f;F;g;G;h;H;i;\xec;...;\xef;I;\xcc;...;\xcf;j;J;k;K;\
- l;L;m;M;n;\xf1;N;\xd1;o;\xf2;...;\xf6;\xf8;O;\xd2;...;\xd6;\xd8;\
- p;P;q;Q;r;R;s;S;t;T;u;\xf9;...;\xfc;U;\xd9;...;\xdc;v;V;w;W;x;X;y;\
- \xfd;Y;\xdd;z;Z;\xf0;\xd0;\xfe;\xde;\xe6;\xc6;\xdf;\xff;\
-# remains
- \";...;&;\
- \(;...;+;/;\<;...;\>;@;[;...;`;\{;...;~;\xa2;...;\xbe;\
- \xd7;\xf7
diff --git a/usr.bin/colldef/data/lt_LN.ISO_8859-1 b/usr.bin/colldef/data/lt_LN.ISO_8859-1
deleted file mode 100644
index f63cfed..0000000
--- a/usr.bin/colldef/data/lt_LN.ISO_8859-1
+++ /dev/null
@@ -1,19 +0,0 @@
-order \
-# controls
- \x01;...;\x1f;\x7f;...;\x9f;\
-# spaces
- \ ;\xa0;\
-# puncts
- .;:;\;;\,;!;?;\xa1;\xbf;\
-# digits
- 0;...;9;\
-# alphas
- a;\xe0;...;\xe5;A;\xc0;...;\xc5;b;B;c;\xe7;C;\xc7;d;D;e;\xe8;...;\xeb;\
- E;\xc8;...;\xcb;f;F;g;G;h;H;i;\xec;...;\xef;I;\xcc;...;\xcf;j;J;k;K;\
- l;L;m;M;n;\xf1;N;\xd1;o;\xf2;...;\xf6;\xf8;O;\xd2;...;\xd6;\xd8;\
- p;P;q;Q;r;R;s;S;t;T;u;\xf9;...;\xfc;U;\xd9;...;\xdc;v;V;w;W;x;X;y;\
- \xfd;Y;\xdd;z;Z;\xf0;\xd0;\xfe;\xde;\xe6;\xc6;\xdf;\xff;\
-# remains
- \";...;&;\
- \(;...;+;/;\<;...;\>;@;[;...;`;\{;...;~;\xa2;...;\xbe;\
- \xd7;\xf7
diff --git a/usr.bin/colldef/data/ru_SU.CP866 b/usr.bin/colldef/data/ru_SU.CP866
deleted file mode 100644
index 4a6d583..0000000
--- a/usr.bin/colldef/data/ru_SU.CP866
+++ /dev/null
@@ -1,20 +0,0 @@
-# cp866
-order \
-# controls
- \x01;...;\x1f;\x7f;\
-# spaces
- \ ;\xff;\
-# puncts
- .;:;\;;\,;!;?;\
-# digits
- 0;...;9;\
-# alphas
- A;a;B;b;C;c;D;d;E;e;F;f;G;g;H;h;I;i;J;j;K;k;L;l;\
- M;m;N;n;O;o;P;p;Q;q;R;r;S;s;T;t;U;u;V;v;W;w;X;x;\
- Y;y;Z;z;\
- €; ;;¡;‚;¢;ƒ;£;„;¤;…;¥;ð;ñ;†;¦;‡;§;ˆ;¨;‰;©;Š;ª;\
- ‹;«;Œ;¬;;­;Ž;®;;¯;;à;‘;á;’;â;“;ã;”;ä;•;å;–;æ;\
- —;ç;˜;è;™;é;š;ê;›;ë;œ;ì;;í;ž;î;Ÿ;ï;\
-# remains
- \";...;&;\(;...;+;/;\<;...;\>;@;[;...;`;\{;...;~;\
- \xb0;...;\xdf;\xf2;...;\xfe
diff --git a/usr.bin/colldef/data/ru_SU.KOI8-R b/usr.bin/colldef/data/ru_SU.KOI8-R
deleted file mode 100644
index c1f1544..0000000
--- a/usr.bin/colldef/data/ru_SU.KOI8-R
+++ /dev/null
@@ -1,20 +0,0 @@
-# koi8-r
-order \
-# controls
- \x01;...;\x1f;\x7f;\
-# spaces
- \ ;\x9a;\
-# puncts
- .;:;\;;\,;!;?;\
-# digits
- 0;...;9;\
-# alphas
- A;a;B;b;C;c;D;d;E;e;F;f;G;g;H;h;I;i;J;j;K;k;L;l;\
- M;m;N;n;O;o;P;p;Q;q;R;r;S;s;T;t;U;u;V;v;W;w;X;x;\
- Y;y;Z;z;\
- á;Á;â;Â;÷;×;ç;Ç;ä;Ä;å;Å;³;£;ö;Ö;ú;Ú;é;É;ê;Ê;ë;Ë;\
- ì;Ì;í;Í;î;Î;ï;Ï;ð;Ð;ò;Ò;ó;Ó;ô;Ô;õ;Õ;æ;Æ;è;È;ã;Ã;\
- þ;Þ;û;Û;ý;Ý;ÿ;ß;ù;Ù;ø;Ø;ü;Ü;à;À;ñ;Ñ;\
-# remains
- \";...;&;\(;...;+;/;\<;...;\>;@;[;...;`;\{;...;~;\
- \x80;...;\x99;\x9b;...;\xa2;\xa4;...;\xb2;\xb4;...;\xbf
diff --git a/usr.bin/f2c/f77.script b/usr.bin/f2c/f77.script
deleted file mode 100644
index d98bd75..0000000
--- a/usr.bin/f2c/f77.script
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/bin/sh
-# Compile Fortran code, adding -lf2c.
-# This is a slightly modified g++ script.
-
-: || exec /bin/sh -f $0 $argv:q
-
-# The compiler name might be different when doing cross-compilation
-# (this should be configured)
-gcc_name=cc
-speclang=-xnone
-
-# replace the command name by the name of the new command
-progname=`basename $0`
-case "$0" in
- */*)
- gcc=`echo $0 | sed -e "s;/[^/]*$;;"`/$gcc_name
- ;;
- *)
- gcc=$gcc_name
- ;;
-esac
-
-# $first is yes for first arg, no afterwards.
-first=yes
-# If next arg is the argument of an option, $quote is non-empty.
-# More precisely, it is the option that wants an argument.
-quote=
-# $library is made empty to disable use of libf2c.
-#library=-lF77 -lI77 -lm
-library="-lf2c -lm"
-numargs=$#
-
-# ash requires the newline before `do'.
-for arg
-do
- if [ $first = yes ]
- then
- # Need some 1st arg to `set' which does not begin with `-'.
- # We get rid of it after the loop ends.
- set gcc
- first=no
- fi
- # If you have to ask what this does, you should not edit this file. :-)
- # The ``S'' at the start is so that echo -nostdinc does not eat the
- # -nostdinc.
- arg=`echo "S$arg" | sed "s/^S//; s/'/'\\\\\\\\''/g"`
- if [ x$quote != x ]
- then
- quote=
- else
- quote=
- case $arg in
- -nostdlib)
- # Inhibit linking with -lf2c.
- library=
- ;;
- -lm | -lmath)
- # Because libf2c uses things from the math library, make sure it
- # always comes before the math library. We recognize both -lm
- # and -lmath, since on some systems (e.g. m88k SVR3), it
- # doesn't call it libm.a for some reason.
- #set "$@" $library
- #library=""
- ;;
- -[bBVDUoeTuIYmLiA] | -Tdata)
- # these switches take following word as argument,
- # so don't treat it as a file name.
- quote=$arg
- ;;
- -[cSEM] | -MM)
- # Don't specify libraries if we won't link,
- # since that would cause a warning.
- library=
- ;;
- -x*)
- speclang=$arg
- ;;
- -v)
- # catch `f77 -v'
- if [ $numargs = 1 ] ; then library="" ; fi
- ;;
- -*)
- # Pass other options through; they don't need -x and aren't inputs.
- ;;
- *)
- # If file ends in .i, put options around it.
- # But not if a specified -x option is currently active.
- case "$speclang $arg" in -xnone\ *.i)
- set "$@" -xf2c "'$arg'" -xnone
- continue
- esac
- ;;
- esac
- fi
- set "$@" "'$arg'"
-done
-
-# Get rid of that initial 1st arg
-if [ $first = no ]; then
- shift
-else
- echo "$0: No input files specified."
- exit 1
-fi
-
-if [ x$quote != x ]
-then
- echo "$0: argument to \`$quote' missing"
- exit 1
-fi
-
-eval $gcc "$@" $library
-
-
diff --git a/usr.bin/f2c/index b/usr.bin/f2c/index
deleted file mode 100644
index 5212535..0000000
--- a/usr.bin/f2c/index
+++ /dev/null
@@ -1,127 +0,0 @@
-# ====== index for f2c/src ======
-# NOTE: "all from f2c/src" is the complete f2c source (sans libraries).
-# The remaining files in this directory are the component modules
-# of "all from f2c/src", so you can request just the modules that
-# have changed since last you updated your f2c source. You can
-# tell what has changed by looking at the timestamps at the end
-# of "readme from f2c".
-file f2c/src/cds.c
-
-file f2c/src/data.c
-
-file f2c/src/defines.h
-
-file f2c/src/defs.h
-
-file f2c/src/equiv.c
-
-file f2c/src/error.c
-
-file f2c/src/exec.c
-
-file f2c/src/expr.c
-
-file f2c/src/f2c.1
-
-file f2c/src/f2c.1t
-
-file f2c/src/f2c.h
-
-file f2c/src/format.c
-
-file f2c/src/format.h
-
-file f2c/src/formatdata.c
-
-file f2c/src/ftypes.h
-
-file f2c/src/gram.c
-
-file f2c/src/gram.dcl
-
-file f2c/src/gram.exec
-
-file f2c/src/gram.expr
-
-file f2c/src/gram.head
-
-file f2c/src/gram.io
-
-file f2c/src/init.c
-
-file f2c/src/intr.c
-
-file f2c/src/io.c
-
-file f2c/src/iob.h
-
-file f2c/src/lex.c
-
-file f2c/src/machdefs.h
-
-file f2c/src/main.c
-
-file f2c/src/makefile
-
-file f2c/src/malloc.c
-
-file f2c/src/mem.c
-
-file f2c/src/memset.c
-
-file f2c/src/misc.c
-
-file f2c/src/names.c
-
-file f2c/src/names.h
-
-file f2c/src/niceprintf.c
-
-file f2c/src/niceprintf.h
-
-file f2c/src/notice
-
-file f2c/src/output.c
-
-file f2c/src/output.h
-
-file f2c/src/p1defs.h
-
-file f2c/src/p1output.c
-
-file f2c/src/parse.h
-
-file f2c/src/parse_args.c
-
-file f2c/src/pccdefs.h
-
-file f2c/src/pread.c
-
-file f2c/src/proc.c
-
-file f2c/src/put.c
-
-file f2c/src/putpcc.c
-
-file f2c/src/sysdep.c
-
-file f2c/src/sysdep.h
-
-file f2c/src/tokens
-
-file f2c/src/usignal.h
-
-file f2c/src/vax.c
-
-file f2c/src/version.c
-
-file f2c/src/xsum.c
-
-file f2c/src/xsum0.out
-
-file f2c/src/Notice
-
-file f2c/src/README
-
-file f2c/src/readme
-
diff --git a/usr.bin/f2c/index.html b/usr.bin/f2c/index.html
deleted file mode 100644
index 2265f2a..0000000
--- a/usr.bin/f2c/index.html
+++ /dev/null
@@ -1,138 +0,0 @@
-<HTML>
-<HEAD><TITLE>/netlib/f2c/src</TITLE></HEAD>
-<BODY>
-<H2>/netlib/f2c/src</H2>
-<UL>
-<PRE>
-====== index for f2c/src ======
-NOTE: "all from f2c/src" is the complete f2c source (sans libraries).
-The remaining files in this directory are the component modules
-of "all from f2c/src", so you can request just the modules that
-have changed since last you updated your f2c source. You can
-tell what has changed by looking at the timestamps at the end
-of "readme from f2c".
-</PRE>
-<LI><EM>file: </EM><A HREF="cds.c.Z">cds.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/cds.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="data.c.Z">data.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/data.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="defines.h.Z">defines.h</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/defines.h.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="defs.h.Z">defs.h</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/defs.h.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="equiv.c.Z">equiv.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/equiv.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="error.c.Z">error.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/error.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="exec.c.Z">exec.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/exec.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="expr.c.Z">expr.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/expr.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="f2c.1.Z">f2c.1</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/f2c.1.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="f2c.1t.Z">f2c.1t</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/f2c.1t.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="f2c.h.Z">f2c.h</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/f2c.h.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="format.c.Z">format.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/format.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="format.h.Z">format.h</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/format.h.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="formatdata.c.Z">formatdata.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/formatdata.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="ftypes.h.Z">ftypes.h</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/ftypes.h.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="gram.c.Z">gram.c</A><MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="gram.dcl.Z">gram.dcl</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/gram.dcl.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="gram.exec.Z">gram.exec</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/gram.exec.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="gram.expr.Z">gram.expr</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/gram.expr.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="gram.head.Z">gram.head</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/gram.head.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="gram.io.Z">gram.io</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/gram.io.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="init.c.Z">init.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/init.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="intr.c.Z">intr.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/intr.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="io.c.Z">io.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/io.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="iob.h.Z">iob.h</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/iob.h.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="lex.c.Z">lex.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/lex.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="machdefs.h.Z">machdefs.h</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/machdefs.h.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="main.c.Z">main.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/main.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="makefile.Z">makefile</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/makefile.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="malloc.c.Z">malloc.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/malloc.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="mem.c.Z">mem.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/mem.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="memset.c.Z">memset.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/memset.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="misc.c.Z">misc.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/misc.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="names.c.Z">names.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/names.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="names.h.Z">names.h</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/names.h.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="niceprintf.c.Z">niceprintf.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/niceprintf.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="niceprintf.h.Z">niceprintf.h</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/niceprintf.h.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="notice.Z">notice</A><MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="output.c.Z">output.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/output.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="output.h.Z">output.h</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/output.h.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="p1defs.h.Z">p1defs.h</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/p1defs.h.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="p1output.c.Z">p1output.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/p1output.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="parse.h.Z">parse.h</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/parse.h.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="parse_args.c.Z">parse_args.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/parse_args.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="pccdefs.h.Z">pccdefs.h</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/pccdefs.h.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="pread.c.Z">pread.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/pread.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="proc.c.Z">proc.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/proc.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="put.c.Z">put.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/put.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="putpcc.c.Z">putpcc.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/putpcc.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="sysdep.c.Z">sysdep.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/sysdep.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="sysdep.h.Z">sysdep.h</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/sysdep.h.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="tokens.Z">tokens</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/tokens.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="usignal.h.Z">usignal.h</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/usignal.h.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="vax.c.Z">vax.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/vax.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="version.c.Z">version.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/version.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="xsum.c.Z">xsum.c</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/xsum.c.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="xsum0.out.Z">xsum0.out</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/xsum0.out.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="Notice.Z">Notice</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/Notice.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="README.Z">README</A> (<A HREF="ftp://netlib.att.com/netlib.depend/f2c/src/README.tar">with dependencies</A>)<MENU>
-</MENU>
-<LI><EM>file: </EM><A HREF="readme.Z">readme</A><MENU>
-</MENU>
-<P><LI><A HREF="/netlib/bib/thesaurus.html.Z">index help</A>
-</UL>
-<P><A HREF="/netlib/bib/ericjack.html.Z">Eric and Jack</EM>
-</BODY></HTML>
diff --git a/usr.bin/f2c/notice b/usr.bin/f2c/notice
deleted file mode 100644
index 9715a19..0000000
--- a/usr.bin/f2c/notice
+++ /dev/null
@@ -1,23 +0,0 @@
-/****************************************************************
-Copyright 1990 - 1995 by AT&T Bell Laboratories and Bellcore.
-
-Permission to use, copy, modify, and distribute this software
-and its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appear in all
-copies and that both that the copyright notice and this
-permission notice and warranty disclaimer appear in supporting
-documentation, and that the names of AT&T Bell Laboratories or
-Bellcore or any of their entities not be used in advertising or
-publicity pertaining to distribution of the software without
-specific, written prior permission.
-
-AT&T and Bellcore disclaim all warranties with regard to this
-software, including all implied warranties of merchantability
-and fitness. In no event shall AT&T or Bellcore be liable for
-any special, indirect or consequential damages or any damages
-whatsoever resulting from loss of use, data or profits, whether
-in an action of contract, negligence or other tortious action,
-arising out of or in connection with the use or performance of
-this software.
-****************************************************************/
-
diff --git a/usr.bin/f2c/readme b/usr.bin/f2c/readme
deleted file mode 100644
index b8e5a67..0000000
--- a/usr.bin/f2c/readme
+++ /dev/null
@@ -1,145 +0,0 @@
-Type "make" to check the validity of the f2c source and compile f2c.
-
-On a PC, you may need to compile xsum.c with -DMSDOS (i.e., with
-MSDOS #defined).
-
-If your compiler does not understand ANSI/ISO C syntax (i.e., if
-you have a K&R C compiler), compile with -DKR_headers .
-
-On non-Unix systems where files have separate binary and text modes,
-you may need to "make xsumr.out" rather than "make xsum.out".
-
-If (in accordance with what follows) you need to modify the makefile
-or any of the source files, first issue a "make xsum.out" (or, if
-appropriate, "make xsumr.out") to check the validity of the f2c source,
-then make your changes, then type "make f2c".
-
-The file usignal.h is for the benefit of strictly ANSI include files
-on a UNIX system -- the ANSI signal.h does not define SIGHUP or SIGQUIT.
-You may need to modify usignal.h if you are not running f2c on a UNIX
-system.
-
-Should you get the message "xsum0.out xsum1.out differ", see what lines
-are different (`diff xsum0.out xsum1.out`) and ask netlib
-(e.g., netlib@research.att.com) to send you the files in question,
-plus the current xsum0.out (which may have changed) "from f2c/src".
-For example, if exec.c and expr.c have incorrect check sums, you would
-send netlib the message
- send exec.c expr.c xsum0.out from f2c/src
-You can also ftp these files from netlib.att.com; for more details, ask
-netlib@research.att.com to "send readme from f2c".
-
-On some systems, the malloc and free in malloc.c let f2c run faster
-than do the standard malloc and free. Other systems may not tolerate
-redefinition of malloc and free (though changes of 8 Nov. 1994 may
-render this less of a problem than hitherto). If yours is such a
-system, you may either modify the makefile appropriately (remove
-"malloc.o" from the "OBJECTS =" assignment), or simply execute
- cc -c -DCRAY malloc.c
-before typing "make". Still other systems have a -lmalloc that
-provides performance competitive with that from malloc.c; you may
-wish to compare the two on your system.
-
-On some BSD systems, you may need to create a file named "string.h"
-whose single line is
-#include <strings.h>
-you may need to add " -Dstrchr=index" to the "CFLAGS =" assignment
-in the makefile, and you may need to add " memset.o" to the "OBJECTS ="
-assignment in the makefile -- see the comments in memset.c .
-
-For non-UNIX systems, you may need to change some things in sysdep.c,
-such as the choice of intermediate file names.
-
-On some systems, you may need to modify parts of sysdep.h (which is
-included by defs.h). In particular, for Sun 4.1 systems and perhaps
-some others, you need to comment out the typedef of size_t. For some
-systems (e.g., IRIX 4.0.1 and AIX) it is better to add
-#define ANSI_Libraries
-to the beginning of sysdep.h (or to supply -DANSI_Libraries in the
-makefile).
-
-Alas, some systems #define __STDC__ but do not provide a true standard
-(ANSI or ISO) C environment, e.g. do not provide stdlib.h . If yours
-is such a system, then (a) you should complain loudly to your vendor
-about __STDC__ being erroneously defined, and (b) you should insert
-#undef __STDC__
-at the beginning of sysdep.h . You may need to make other adjustments.
-
-For some non-ANSI versions of stdio, you must change the values given
-to binread and binwrite in sysdep.c from "rb" and "wb" to "r" and "w".
-You may need to make this change if you run f2c and get an error
-message of the form
- Compiler error ... cannot open intermediate file ...
-
-On many systems, it is best to combine libF77 and libI77 into a single
-library, say libf2c, as suggested in "readme from f2c". If you do not
-do this, then you should adjust the definition of link_msg in sysdep.c
-appropriately (e.g., replacing "-lf2c" by "-lF77 -lI77"). On Unix
-systems, the easiest way to create libf2c.a is to make libF77/libF77.a
-and libI77/libI77.a (after reading and heeding libF77/README and
-libI77/README), and then to say
-
- cp libF77/libF77.a libf2c.a
- ar ruv libf2c.a libI77/*.o
- ranlib libf2c.a
-
-The last step, ranlib, may not be necessary on your system. On
-other systems, just compile all the .c files in libF77 and libI77,
-and put the resulting objects (except one or both of the Version
-objects) into a library, called perhaps f2c.lib .
-
-Some older C compilers object to
- typedef void (*foo)();
-or to
- typedef void zap;
- zap (*foo)();
-If yours is such a compiler, change the definition of VOID in
-f2c.h from void to int.
-
-For convenience with systems that use control-Z to denote end-of-file,
-f2c treats control-Z characters (ASCII 26, '\x1a') that appear at the
-beginning of a line as an end-of-file indicator. You can disable this
-test by compiling lex.c with NO_EOF_CHAR_CHECK #defined, or can
-change control-Z to some other character by #defining EOF_CHAR to
-be the desired value.
-
-
-If your machine has IEEE, VAX, or IBM-mainframe arithmetic, but your
-printf is inaccurate (e.g., with Symantec C++ version 6.0,
-printf("%.17g",12.) prints 12.000000000000001), you can make f2c print
-correctly rounded numbers by compiling with -DUSE_DTOA and adding
-dtoa.o g_fmt.o to the makefile's OBJECTS = line, so it becomes
-
- OBJECTS = $(OBJECTSd) malloc.o dtoa.o g_fmt.o
-
-Also add the rule
-
- dtoa.o: dtoa.c
- $(CC) -c $(CFLAGS) -DMALLOC=ckalloc -DIEEE... dtoa.c
-
-(without the initial tab) to the makefile, where IEEE... is one of
-IEEE_MC68k, IEEE_8087, VAX, or IBM, depending on your machine's
-arithmetic. See the comments near the start of dtoa.c.
-
-The relevant source files, dtoa.c and g_fmt.c, are available
-separately from netlib's fp directory. For example, you could
-send the E-mail message
-
- send dtoa.c g_fmt.c from fp
-
-to netlib@research.att.com (or use anonymous ftp from netlib.att.com
-and look in directory /netlib/fp).
-
-The makefile has a rule for creating tokdefs.h. If you cannot use the
-makefile, an alternative is to extract tokdefs.h from the beginning of
-gram.c: it's the first 100 lines.
-
-
-Please send bug reports to dmg@research.att.com . The old index file
-(now called "readme" due to unfortunate changes in netlib conventions:
-"send readme from f2c") will report recent changes in the recent-change
-log at its end; all changes will be shown in the "changes" file
-("send changes from f2c"). To keep current source, you will need to
-request xsum0.out and version.c, in addition to the changed source
-files. Changes first appear on netlib@research.att.com, and in due
-time propagate to the other netlib sites that are kept current.
diff --git a/usr.bin/f2c/xsum.c b/usr.bin/f2c/xsum.c
deleted file mode 100644
index b87ace7..0000000
--- a/usr.bin/f2c/xsum.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/****************************************************************
-Copyright 1990, 1993, 1994 by AT&T Bell Laboratories and Bellcore.
-
-Permission to use, copy, modify, and distribute this software
-and its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appear in all
-copies and that both that the copyright notice and this
-permission notice and warranty disclaimer appear in supporting
-documentation, and that the names of AT&T Bell Laboratories or
-Bellcore or any of their entities not be used in advertising or
-publicity pertaining to distribution of the software without
-specific, written prior permission.
-
-AT&T and Bellcore disclaim all warranties with regard to this
-software, including all implied warranties of merchantability
-and fitness. In no event shall AT&T or Bellcore be liable for
-any special, indirect or consequential damages or any damages
-whatsoever resulting from loss of use, data or profits, whether
-in an action of contract, negligence or other tortious action,
-arising out of or in connection with the use or performance of
-this software.
-****************************************************************/
-
-#define _POSIX_SOURCE
-#include "stdio.h"
-#ifndef KR_headers
-#include "stdlib.h"
-#include "sys/types.h"
-#include "fcntl.h" /* for declaration of open, O_RDONLY */
-#include "unistd.h" /* for read, close */
-#endif
-#ifdef MSDOS
-#include "io.h"
-#endif
-#ifndef O_RDONLY
-#define O_RDONLY 0
-#endif
-#ifndef O_BINARY
-#define O_BINARY O_RDONLY
-#endif
-
- char *progname;
- static int ignore_cr;
-
- void
-#ifdef KR_headers
-usage(rc)
-#else
-usage(int rc)
-#endif
-{
- fprintf(stderr, "usage: %s [-r] [file [file...]]\n\
- option -r ignores carriage return characters\n", progname);
- exit(rc);
- }
-
-typedef unsigned char Uchar;
-
- long
-#ifdef KR_headers
-sum32(sum, x, n)
- register long sum;
- register Uchar *x;
- int n;
-#else
-sum32(register long sum, register Uchar *x, int n)
-#endif
-{
- register Uchar *xe;
- static long crc_table[256] = {
- 0, 151466134, 302932268, 453595578,
- -9583591, -160762737, -312236747, -463170141,
- -19167182, -136529756, -321525474, -439166584,
- 28724267, 145849533, 330837255, 448732561,
- -38334364, -189783822, -273059512, -423738914,
- 47895677, 199091435, 282375505, 433292743,
- 57448534, 174827712, 291699066, 409324012,
- -67019697, -184128295, -300991133, -418902539,
- -76668728, -227995554, -379567644, -530091662,
- 67364049, 218420295, 369985021, 520795499,
- 95791354, 213031020, 398182870, 515701056,
- -86479645, -203465611, -388624945, -506380967,
- 114897068, 266207290, 349655424, 500195606,
- -105581387, -256654301, -340093543, -490887921,
- -134039394, -251295736, -368256590, -485758684,
- 124746887, 241716241, 358686123, 476458301,
- -153337456, -2395898, -455991108, -304803798,
- 162629001, 11973919, 465560741, 314102835,
- 134728098, 16841012, 436840590, 319723544,
- -144044613, -26395347, -446403433, -329032703,
- 191582708, 40657250, 426062040, 274858062,
- -200894995, -50223749, -435620671, -284179369,
- -172959290, -55056048, -406931222, -289830788,
- 182263263, 64630089, 416513267, 299125861,
- 229794136, 78991822, 532414580, 381366498,
- -220224191, -69691945, -523123603, -371788549,
- -211162774, -93398532, -513308602, -396314416,
- 201600371, 84090341, 503991391, 386759881,
- -268078788, -117292630, -502591472, -351526778,
- 258520357, 107972019, 493278217, 341959839,
- 249493774, 131713432, 483432482, 366454964,
- -239911657, -122417791, -474129349, -356881235,
- -306674912, -457198666, -4791796, -156118374,
- 315967289, 466778031, 14362133, 165418627,
- 325258002, 442776452, 23947838, 141187752,
- -334573813, -452329571, -33509849, -150495567,
- 269456196, 419996626, 33682024, 184992510,
- -278767779, -429561909, -43239823, -194312473,
- -288089226, -405591072, -52790694, -170046772,
- 297394031, 415166457, 62373443, 179343061,
- 383165416, 533828478, 81314500, 232780370,
- -373594127, -524527769, -72022307, -223201717,
- -401789990, -519431348, -100447498, -217810336,
- 392228803, 510123861, 91131631, 208256633,
- -345918580, -496598246, -110112096, -261561802,
- 336361365, 487278339, 100800185, 251995695,
- 364526526, 482151208, 129260178, 246639108,
- -354943065, -472854735, -119955829, -237064675,
- 459588272, 308539942, 157983644, 7181066,
- -469170519, -317835713, -167286907, -16754925,
- -440448382, -323454444, -139383890, -21619912,
- 450006683, 332774925, 148697015, 31186721,
- -422325548, -271261118, -186797064, -36011154,
- 431888077, 280569435, 196114401, 45565815,
- 403200742, 286222960, 168180682, 50400092,
- -412770561, -295522711, -177471533, -59977915,
- -536157576, -384970002, -234585260, -83643454,
- 526853729, 375396087, 225003341, 74348507,
- 517040714, 399923932, 215944038, 98057200,
- -507728301, -390357307, -206385281, -88735767,
- 498987548, 347783818, 263426864, 112501670,
- -489671163, -338229613, -253864151, -103192641,
- -479823314, -362722632, -244835582, -126932076,
- 470531639, 353144481, 235265819, 117632909
- };
-
- xe = x + n;
- while(x < xe)
- sum = crc_table[(sum ^ *x++) & 0xff] ^ (sum >> 8 & 0xffffff);
- return sum;
- }
-
- int
-#ifdef KR_headers
-cr_purge(buf, n)
- Uchar *buf;
- int n;
-#else
-cr_purge(Uchar *buf, int n)
-#endif
-{
- register Uchar *b, *b1, *be;
- b = buf;
- be = b + n;
- while(b < be)
- if (*b++ == '\r') {
- b1 = b - 1;
- while(b < be)
- if ((*b1 = *b++) != '\r')
- b1++;
- return b1 - buf;
- }
- return n;
- }
-
-static Uchar Buf[16*1024];
-
- void
-#ifdef KR_headers
-process(s, x)
- char *s;
- int x;
-#else
-process(char *s, int x)
-#endif
-{
- register int n;
- long fsize, sum;
-
- sum = 0;
- fsize = 0;
- while((n = read(x, (char *)Buf, sizeof(Buf))) > 0) {
- if (ignore_cr)
- n = cr_purge(Buf, n);
- fsize += n;
- sum = sum32(sum, Buf, n);
- }
- sum &= 0xffffffff;
- if (n==0)
- printf("%s\t%lx\t%ld\n", s, sum & 0xffffffff, fsize);
- else { perror(s); }
- close(x);
- }
-
-#ifdef KR_headers
-main(argc, argv)
- char **argv;
-#else
-main(int argc, char **argv)
-#endif
-{
- int x;
- char *s;
- static int rc;
-
- progname = *argv;
- argc = argc; /* turn off "not used" warning */
- s = *++argv;
- if (s && *s == '-') {
- switch(s[1]) {
- case '?':
- usage(0);
- case 'r':
- ignore_cr = 1;
- case '-':
- break;
- default:
- fprintf(stderr, "invalid option %s\n", s);
- usage(1);
- }
- s = *++argv;
- }
- if (s) do {
- x = open(s, O_RDONLY|O_BINARY);
- if (x < 0) {
- fprintf(stderr, "%s: can't open %s\n", progname, s);
- rc |= 1;
- }
- else
- process(s, x);
- }
- while(s = *++argv);
- else {
- process("/dev/stdin", fileno(stdin));
- }
- return rc;
- }
diff --git a/usr.bin/grep/egrep/Makefile b/usr.bin/grep/egrep/Makefile
deleted file mode 100644
index 5df3e8f..0000000
--- a/usr.bin/grep/egrep/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/27/93
-
-# -DSLOWSYS invoke xread() for system time quirk on PDP, others?
-# -DNOKANJI default is for Japanese Unix. undef only for raw
-# parity-marked search capability, not standard w/grep.
-# -DCHINESE for systems using EUC Chinese2 codes
-# -Dstrrchr=rindex, -Dstrchr=index as necessary
-
-PROG= egrep
-CFLAGS+=-Dstrrchr=rindex -Dstrchr=index -DNOKANJI
-DPADD= ${LIBCOMPAT}
-LDADD= -lcompat # must search compat to get spencers early regexp package
-MAN1= grep.1
-LINKS= ${BINDIR}/egrep ${BINDIR}/grep ${BINDIR}/egrep ${BINDIR}/fgrep
-MLINKS= grep.1 egrep.1 grep.1 fgrep.1
-
-.include "../../Makefile.inc"
-.include <bsd.prog.mk>
diff --git a/usr.bin/key/README.WZV b/usr.bin/key/README.WZV
deleted file mode 100644
index a13f3b5..0000000
--- a/usr.bin/key/README.WZV
+++ /dev/null
@@ -1,100 +0,0 @@
-One of the nice things of S/Key is that it still leaves you the option
-to use regular UNIX passwords. In fact, the presence of S/Key support
-is completely invisible for a user until she has set up a password with
-the keyinit command. You can permit regular UNIX passwords for local
-logins, while at the same time insisting on S/Key passwords for logins
-from outside.
-
-ORIGIN
-
-These files are modified versions of the s/key files found on
-thumper.bellcore.com at 21 oct 1993. They have been fixed to
-run on top of SunOS 4.1.3 and Solaris 2.3.
-
-Installation is described at the end of this file.
-
-USAGE
-
-Use the keyinit command to set up a new series of s/key passwords.
-
- wzv_6% keyinit
- Updating wietse:
- Old key: wz173500
- Reminder - Only use this method if you are direct connected.
- If you are using telnet or dial-in exit with no password and use keyinit -s.
- Enter secret password:
- Again secret password:
-
- ID wietse s/key is 99 wz173501
- BLAH BLA BLAH BLAH BLAH BLA
-
-Be sure to make your secret password sufficiently long. Try using a
-full sentence instead of just one single word.
-
-You will have to do a "keyinit" on every system that you want to login
-on using one-time passwords.
-
-Whenever you log into an s/key protected system you will see
-something like:
-
- login: wietse
- s/key 98 wz173501
- Password:
-
-In this case you can either enter your regular UNIX password or
-your one-time s/key password. For example, I open a local window
-to compute the password:
-
- local% key 98 wz173501
- Reminder - Do not use key while logged in via telnet or rlogin.
- Enter secret password:
- BLAH BLA BLAH BLAH BLAH BLA
-
-The "BLAH BLA BLAH BLAH BLAH BLA" is the one-time s/key password.
-
-If you have to type the one-time password in by hand, it is convenient
-to have echo turned on so that you can correct typing errors. Just type
-a newline at the "Password:" prompt:
-
- login: wietse
- s/key 98 wz173501
- Password: (turning echo on)
- Password:BLAH BLA BLAH BLAH BLAH BLA
-
-The 98 in the challenge will be 97 the next time, and so on. You'll get
-a warning when you are about to run out of s/key passwords, so that you
-will have to run the keyinit command again.
-
-Sometimes it is more practical to carry a piece of paper with a small
-series of one-time passwords. You can generate the list with:
-
- % key -n 10 98 wz173501
- 98: BLAH BLA BLAH BLAH BLAH BLA
- 97: ...
- 96: ...
-
-Be careful when printing material like this!
-
-INSTALLATION
-
-To install, do: make sunos4 (or whatever), then: make install.
-
-The UNIX password is always permitted with non-network logins. By
-default, UNIX passwords are always permitted (the Bellcore code by
-default disallows UNIX passwords but I think that is too painful). In
-order to permit UNIX passwords only with logins from specific networks,
-create a file /etc/skey.access. For example,
-
- # First word says if UNIX passwords are to be permitted or denied.
- # remainder of the rule is a networknumber and mask. A rule matches a
- # host if any of its addresses satisfies:
- #
- # network = (address & mask)
- #
- #what network mask
- permit 131.155.210.0 255.255.255.0
- deny 0.0.0.0 0.0.0.0
-
-This particular example will permit UNIX passwords with logins from any
-host on network 131.155.210, but will insist on one-time passwords in
-all other cases.
diff --git a/usr.bin/key/skey.1 b/usr.bin/key/skey.1
deleted file mode 100644
index b4e0455..0000000
--- a/usr.bin/key/skey.1
+++ /dev/null
@@ -1,59 +0,0 @@
-.ll 6i
-.pl 10.5i
-.\" @(#)skey.1 1.1 10/28/93
-.\"
-.lt 6.0i
-.TH KEY 1 "28 October 1993"
-.AT 3
-.SH NAME
-S/key \- A procedure to use one time passwords for accessing computer systems.
-.SH DESCRIPTION
-.I S/key
-is a procedure for using one time password to authenticate access to
-computer systems. It uses 64 bits of information transformed by the
-MD4 algorithm. The user supplies the 64 bits in the form of 6 English
-words that are generated by a secure computer.
-Example use of the S/key program
-.I key
-.sp
- Usage example:
-.sp 0
- >key 99 th91334
-.sp 0
- Enter password: <your secret password is entered here>
-.sp 0
- OMEN US HORN OMIT BACK AHOY
-.sp 0
- >
-.sp
-The programs that are part of the S/Key system are keyinit, key, and
-keyinfo. Keyinit is used to get your ID set up, key is
-used to get the one time password each time,
-keyinfo is used to extract information from the S/Key database.
-.sp
-When you run "keyinit" you inform the system of your
-secret password. Running "key" then generates the
-one-time passwords, and also requires your secret
-password. If however, you misspell your password
-while running "key", you will get a list of passwords
-that will not work, and no indication about the problem.
-.sp
-Password sequence numbers count backward from 99. If you
-don't know this, the syntax for "key" will be confusing.
-.sp
-You can enter the passwords using small letters, even
-though the "key" program gives them in caps.
-.sp
-Macintosh and a general purpose PC use
-are available.
-.sp
-Under FreeBSD, you can control, with /etc/skey.access, from which
-hosts and/or networks the use of S/Key passwords is obligated.
-.LP
-.SH SEE ALSO
-.BR keyinit(1),
-.BR key(1),
-.BR keyinfo(1)
-.BR skey.access(5)
-.SH AUTHOR
-Phil Karn, Neil M. Haller, John S. Walden, Scott Chasin
diff --git a/usr.bin/login/login_skey.c b/usr.bin/login/login_skey.c
deleted file mode 100644
index b94bd28..0000000
--- a/usr.bin/login/login_skey.c
+++ /dev/null
@@ -1,105 +0,0 @@
- /* Portions taken from the skey distribution on Oct 21 1993 */
-#ifdef SKEY
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <string.h>
-#include <netdb.h>
-#include <arpa/inet.h>
-#include <stdio.h>
-#include <termios.h>
-#include <pwd.h>
-#include <syslog.h>
-
-#include <skey.h>
-
-/* skey_getpass - read regular or s/key password */
-
-char *skey_getpass(prompt, pwd, pwok)
-char *prompt;
-struct passwd *pwd;
-int pwok;
-{
- static char buf[128];
- struct skey skey;
- char *cp;
- void rip();
- struct termios saved_ttymode;
- struct termios noecho_ttymode;
- char *username = pwd ? pwd->pw_name : "nope";
- int sflag;
-
- /* Attempt an s/key challenge. */
-
- if ((sflag = skeychallenge(&skey, username, buf)) == 0) {
- printf("%s\n", buf);
- }
- if (!pwok) {
- printf("(s/key required)\n");
- }
- fputs(prompt, stdout);
- fflush(stdout);
-
- /* Save current input modes and turn echo off. */
-
- tcgetattr(0, &saved_ttymode);
- tcgetattr(0, &noecho_ttymode);
- noecho_ttymode.c_lflag &= ~ECHO;
- tcsetattr(0, TCSANOW, &noecho_ttymode);
-
- /* Read password. */
-
- buf[0] = 0;
- fgets(buf, sizeof(buf), stdin);
- rip(buf);
-
- /* Restore previous input modes. */
-
- tcsetattr(0, TCSANOW, &saved_ttymode);
-
- /* Give S/Key users a chance to do it with echo on. */
-
- if (sflag == 0 && feof(stdin) == 0 && buf[0] == 0) {
- fputs(" (turning echo on)\n", stdout);
- fputs(prompt, stdout);
- fflush(stdout);
- fgets(buf, sizeof(buf), stdin);
- rip(buf);
- } else {
- putchar('\n');
- }
- return (buf);
-}
-
-/* skey_crypt - return encrypted UNIX passwd if s/key or regular password ok */
-
-char *skey_crypt(pp, salt, pwd, pwok)
-char *pp;
-char *salt;
-struct passwd *pwd;
-int pwok;
-{
- struct skey skey;
- char *p;
- char *crypt();
-
- /* Try s/key authentication even when the UNIX password is permitted. */
-
- if (pwd != 0 && skeylookup(&skey, pwd->pw_name) == 0
- && skeyverify(&skey, pp) == 0) {
- /* s/key authentication succeeded */
- if (skey.n < 5)
- printf("Warning! Change s/key password soon\n");
- return (pwd->pw_passwd);
- }
-
- /* When s/key authentication does not work, always invoke crypt(). */
-
- p = crypt(pp, salt);
- if (pwok && pwd != 0 && strcmp(p, pwd->pw_passwd) == 0)
- return (pwd->pw_passwd);
-
- /* The user does not exist or entered bad input. */
-
- return (":");
-}
-#endif SKEY
diff --git a/usr.bin/mklocale/POSIX b/usr.bin/mklocale/POSIX
deleted file mode 100644
index 4f1ae60..0000000
--- a/usr.bin/mklocale/POSIX
+++ /dev/null
@@ -1,33 +0,0 @@
-# @(#)POSIX 8.1 (Berkeley) 6/6/93
-
-/*
- * Standard LOCALE_CTYPE for the C Locale
- */
-ENCODING "NONE"
-VARIABLE A comment line or data line. Only 1 allowed. Copied verbatim.
-
-#
-# This is a comment
-#
-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 '0' - '9' 'a' - 'f' 'A' - 'F'
-BLANK ' ' '\t'
-PRINT 0x20 - 0x7e
-# IDEOGRAM
-# SPECIAL
-# PHONEGRAM
-
-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>
diff --git a/usr.bin/mklocale/data/ja_JP.EUC b/usr.bin/mklocale/data/ja_JP.EUC
deleted file mode 100644
index 88fdc91..0000000
--- a/usr.bin/mklocale/data/ja_JP.EUC
+++ /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 '0' - '9' '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/mklocale/data/lt_LN.ASCII b/usr.bin/mklocale/data/lt_LN.ASCII
deleted file mode 100644
index 95cbeeb..0000000
--- a/usr.bin/mklocale/data/lt_LN.ASCII
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Standard LOCALE_CTYPE for the ASCII Locale
- */
-ENCODING "NONE"
-VARIABLE Strict 7bit ASCII locale
-
-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 '0' - '9' 'a' - 'f' 'A' - 'F'
-BLANK ' ' '\t'
-PRINT 0x20 - 0x7e
-# IDEOGRAM
-# SPECIAL
-# PHONEGRAM
-
-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>
diff --git a/usr.bin/mklocale/data/lt_LN.ISO8859-1 b/usr.bin/mklocale/data/lt_LN.ISO8859-1
deleted file mode 100644
index 5232ae3..0000000
--- a/usr.bin/mklocale/data/lt_LN.ISO8859-1
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Standard LOCALE_CTYPE for the iso_8859_1 Locale
- */
-ENCODING "NONE"
-VARIABLE ISO 8859-1 Latin-1 character set
-
-#
-# This is a comment
-#
-ALPHA 'A' - 'Z' 'a' - 'z' 0xc0 - 0xff
-CONTROL 0x00 - 0x1f 0x7f - 0x9f
-DIGIT '0' - '9'
-GRAPH 0x21 - 0x7e 0xa0 - 0xff
-LOWER 'a' - 'z' 0xe0 - 0xff
-PUNCT 0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e 0xa1 - 0xbf
-SPACE 0x09 - 0x0d 0x20 0xa0
-UPPER 'A' - 'Z' 0xc0 - 0xde
-XDIGIT 'a' - 'f' 'A' - 'F'
-BLANK ' ' '\t' 0xa0
-PRINT 0x20 - 0x7e 0xa0 - 0xff
-# IDEOGRAM
-# SPECIAL
-# PHONEGRAM
-
-MAPLOWER <'A' - 'Z' : 'a'>
-MAPLOWER <'a' - 'z' : 'a'>
-MAPLOWER <0xc0 - 0xdd : 0xe0>
-MAPLOWER <0xe0 - 0xff : 0xe0>
-MAPUPPER <'A' - 'Z' : 'A'>
-MAPUPPER <'a' - 'z' : 'A'>
-MAPUPPER <0xc0 - 0xdd : 0xc0>
-MAPUPPER <0xe0 - 0xff : 0xc0>
-TODIGIT <'0' - '9' : 0>
-TODIGIT <'A' - 'F' : 10>
-TODIGIT <'a' - 'f' : 10>
diff --git a/usr.bin/mklocale/data/lt_LN.ISO_8859-1 b/usr.bin/mklocale/data/lt_LN.ISO_8859-1
deleted file mode 100644
index 5c74641..0000000
--- a/usr.bin/mklocale/data/lt_LN.ISO_8859-1
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Standard LOCALE_CTYPE for the iso_8859_1 Locale
- */
-ENCODING "NONE"
-VARIABLE ISO 8859-1 Latin-1 character set
-
-#
-# This is a comment
-#
-ALPHA 'A' - 'Z' 'a' - 'z' 0xc0 - 0xd6 0xd8 - 0xf6 0xf8 - 0xff
-CONTROL 0x00 - 0x1f 0x7f - 0x9f
-DIGIT '0' - '9'
-GRAPH 0x21 - 0x7e 0xa0 - 0xff
-LOWER 'a' - 'z' 0xdf - 0xf6 0xf8 - 0xff
-PUNCT 0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e 0xa1 - 0xbf 0xd7 0xf7
-SPACE 0x09 - 0x0d ' ' 0xa0
-UPPER 'A' - 'Z' 0xc0 - 0xd6 0xd8 - 0xde
-XDIGIT '0' - '9' 'a' - 'f' 'A' - 'F'
-BLANK ' ' '\t'
-PRINT 0x20 - 0x7e 0xa0 - 0xff
-# IDEOGRAM
-# SPECIAL
-# PHONEGRAM
-
-MAPLOWER <'A' - 'Z' : 'a'>
-MAPLOWER <'a' - 'z' : 'a'>
-MAPLOWER <0xc0 - 0xd6 : 0xe0>
-MAPLOWER <0xd8 - 0xde : 0xf8>
-MAPLOWER <0xdf - 0xf6 : 0xdf>
-MAPLOWER <0xf8 - 0xff : 0xf8>
-MAPUPPER <'A' - 'Z' : 'A'>
-MAPUPPER <'a' - 'z' : 'A'>
-MAPUPPER <0xc0 - 0xd6 : 0xc0>
-MAPUPPER <0xd8 - 0xde : 0xd8>
-MAPUPPER <0xe0 - 0xf6 : 0xc0>
-MAPUPPER <0xf8 - 0xfe : 0xd8>
-TODIGIT <'0' - '9' : 0>
-TODIGIT <'A' - 'F' : 10>
-TODIGIT <'a' - 'f' : 10>
diff --git a/usr.bin/mklocale/data/ru_SU.CP866 b/usr.bin/mklocale/data/ru_SU.CP866
deleted file mode 100644
index 659482b..0000000
--- a/usr.bin/mklocale/data/ru_SU.CP866
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * LOCALE_CTYPE for Russian Alternative character set (CP866)
- */
-ENCODING "NONE"
-VARIABLE Russian Alternative charset (CP866) by ache@astral.msk.su
-
-#
-# This is a comment
-#
-ALPHA 'A' - 'Z' 'a' - 'z' 0x80 - 0xaf 0xe0 - 0xf1
-CONTROL 0x00 - 0x1f 0x7f
-DIGIT '0' - '9'
-GRAPH 0x21 - 0x7e 0x80 - 0xff
-LOWER 'a' - 'z' 0xa0 - 0xaf 0xe0 - 0xef 0xf1
-PUNCT 0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e
-SPACE 0x09 - 0x0d 0x20
-UPPER 'A' - 'Z' 0x80 - 0x9f 0xf0
-XDIGIT '0' - '9' 'a' - 'f' 'A' - 'F'
-BLANK ' ' '\t'
-PRINT 0x20 - 0x7e 0x80 - 0xff
-# IDEOGRAM
-# SPECIAL
-# PHONEGRAM
-
-MAPLOWER <'A' - 'Z' : 'a'>
-MAPLOWER <'a' - 'z' : 'a'>
-MAPLOWER <0x80 - 0x8f : 0xa0>
-MAPLOWER <0x90 - 0x9f : 0xe0>
-MAPLOWER <0xf0 0xf1>
-MAPLOWER <0xa0 - 0xaf : 0xa0>
-MAPLOWER <0xe0 - 0xef : 0xe0>
-MAPLOWER <0xf1 0xf1>
-MAPUPPER <'A' - 'Z' : 'A'>
-MAPUPPER <'a' - 'z' : 'A'>
-MAPUPPER <0x80 - 0x9f : 0x80>
-MAPUPPER <0xf0 0xf0>
-MAPUPPER <0xa0 - 0xaf : 0x80>
-MAPUPPER <0xe0 - 0xef : 0x90>
-MAPUPPER <0xf1 0xf0>
-TODIGIT <'0' - '9' : 0>
-TODIGIT <'A' - 'F' : 10>
-TODIGIT <'a' - 'f' : 10>
diff --git a/usr.bin/mklocale/data/ru_SU.KOI8-R b/usr.bin/mklocale/data/ru_SU.KOI8-R
deleted file mode 100644
index 6d9f539..0000000
--- a/usr.bin/mklocale/data/ru_SU.KOI8-R
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * LOCALE_CTYPE for Russian koi8-r character set (RFC1489)
- */
-ENCODING "NONE"
-VARIABLE Russian koi8-r character set by ache@astral.msk.su
-
-#
-# This is a comment
-#
-ALPHA 'A' - 'Z' 'a' - 'z' 0xa3 0xb3 0xc0 - 0xff
-CONTROL 0x00 - 0x1f 0x7f
-DIGIT '0' - '9'
-GRAPH 0x21 - 0x7e 0x80 - 0xff
-LOWER 'a' - 'z' 0xa3 0xc0 - 0xdf
-PUNCT 0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e
-SPACE 0x09 - 0x0d 0x20
-UPPER 'A' - 'Z' 0xb3 0xe0 - 0xff
-XDIGIT '0' - '9' 'a' - 'f' 'A' - 'F'
-BLANK ' ' '\t'
-PRINT 0x20 - 0x7e 0x80 - 0xff
-# IDEOGRAM
-# SPECIAL
-# PHONEGRAM
-
-MAPLOWER <'A' - 'Z' : 'a'>
-MAPLOWER <'a' - 'z' : 'a'>
-MAPLOWER <0xb3 0xa3>
-MAPLOWER <0xa3 0xa3>
-MAPLOWER <0xe0 - 0xff : 0xc0>
-MAPLOWER <0xc0 - 0xdf : 0xc0>
-MAPUPPER <'A' - 'Z' : 'A'>
-MAPUPPER <'a' - 'z' : 'A'>
-MAPUPPER <0xb3 0xb3>
-MAPUPPER <0xa3 0xb3>
-MAPUPPER <0xe0 - 0xff : 0xe0>
-MAPUPPER <0xc0 - 0xdf : 0xe0>
-TODIGIT <'0' - '9' : 0>
-TODIGIT <'A' - 'F' : 10>
-TODIGIT <'a' - 'f' : 10>
diff --git a/usr.bin/mklocale/iso_8859_1 b/usr.bin/mklocale/iso_8859_1
deleted file mode 100644
index 5232ae3..0000000
--- a/usr.bin/mklocale/iso_8859_1
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Standard LOCALE_CTYPE for the iso_8859_1 Locale
- */
-ENCODING "NONE"
-VARIABLE ISO 8859-1 Latin-1 character set
-
-#
-# This is a comment
-#
-ALPHA 'A' - 'Z' 'a' - 'z' 0xc0 - 0xff
-CONTROL 0x00 - 0x1f 0x7f - 0x9f
-DIGIT '0' - '9'
-GRAPH 0x21 - 0x7e 0xa0 - 0xff
-LOWER 'a' - 'z' 0xe0 - 0xff
-PUNCT 0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e 0xa1 - 0xbf
-SPACE 0x09 - 0x0d 0x20 0xa0
-UPPER 'A' - 'Z' 0xc0 - 0xde
-XDIGIT 'a' - 'f' 'A' - 'F'
-BLANK ' ' '\t' 0xa0
-PRINT 0x20 - 0x7e 0xa0 - 0xff
-# IDEOGRAM
-# SPECIAL
-# PHONEGRAM
-
-MAPLOWER <'A' - 'Z' : 'a'>
-MAPLOWER <'a' - 'z' : 'a'>
-MAPLOWER <0xc0 - 0xdd : 0xe0>
-MAPLOWER <0xe0 - 0xff : 0xe0>
-MAPUPPER <'A' - 'Z' : 'A'>
-MAPUPPER <'a' - 'z' : 'A'>
-MAPUPPER <0xc0 - 0xdd : 0xc0>
-MAPUPPER <0xe0 - 0xff : 0xc0>
-TODIGIT <'0' - '9' : 0>
-TODIGIT <'A' - 'F' : 10>
-TODIGIT <'a' - 'f' : 10>
diff --git a/usr.bin/mklocale/ja_JP.EUC b/usr.bin/mklocale/ja_JP.EUC
deleted file mode 100644
index 55eb155..0000000
--- a/usr.bin/mklocale/ja_JP.EUC
+++ /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/mklocale/ru_SU.KOI8-R b/usr.bin/mklocale/ru_SU.KOI8-R
deleted file mode 100644
index d2164c4..0000000
--- a/usr.bin/mklocale/ru_SU.KOI8-R
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * LOCALE_CTYPE for Russian koi8-r character set (RFC1489)
- */
-ENCODING "NONE"
-VARIABLE Russian koi8-r character set by ache@astral.msk.su
-
-#
-# This is a comment
-#
-ALPHA 'A' - 'Z' 'a' - 'z' 0xa3 0xb3 0xc0 - 0xff
-CONTROL 0x00 - 0x1f 0x7f
-DIGIT '0' - '9'
-GRAPH 0x21 - 0x7e 0x80 - 0xff
-LOWER 'a' - 'z' 0xa3 0xc0 - 0xdf
-PUNCT 0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e
-SPACE 0x09 - 0x0d 0x20
-UPPER 'A' - 'Z' 0xb3 0xe0 - 0xff
-XDIGIT 'a' - 'f' 'A' - 'F'
-BLANK ' ' '\t'
-PRINT 0x20 - 0x7e 0x80 - 0xff
-# IDEOGRAM
-# SPECIAL
-# PHONEGRAM
-
-MAPLOWER <'A' - 'Z' : 'a'>
-MAPLOWER <'a' - 'z' : 'a'>
-MAPLOWER <0xb3 0xa3>
-MAPLOWER <0xa3 0xa3>
-MAPLOWER <0xe0 - 0xff : 0xc0>
-MAPLOWER <0xc0 - 0xdf : 0xc0>
-MAPUPPER <'A' - 'Z' : 'A'>
-MAPUPPER <'a' - 'z' : 'A'>
-MAPUPPER <0xb3 0xb3>
-MAPUPPER <0xa3 0xb3>
-MAPUPPER <0xe0 - 0xff : 0xe0>
-MAPUPPER <0xc0 - 0xdf : 0xe0>
-TODIGIT <'0' - '9' : 0>
-TODIGIT <'A' - 'F' : 10>
-TODIGIT <'a' - 'f' : 10>
diff --git a/usr.bin/passwd/yppasswd.1 b/usr.bin/passwd/yppasswd.1
deleted file mode 100644
index 7004490..0000000
--- a/usr.bin/passwd/yppasswd.1
+++ /dev/null
@@ -1,115 +0,0 @@
-.\"
-.\" Manpage Copyright 1994 Olaf Kirch, <okir@monad.swb.de>
-.\"
-.Dd 18 December 1994
-.Dt YPPASSWD 1
-.Os FreeBSD 2.x
-.Sh NAME
-.Nm yppasswd, ypchpass, ypchfn, ypchsh
-.Nd modify a user's NIS password data
-.Sh SYNOPSIS
-.Nm yppasswd
-.Op Fl f
-.Op Fl s
-.Op Ar user
-.Nm ypchpass
-.Op Ar user
-.Nm ypchfn
-.Op Ar user
-.Nm ypchsh
-.Op Ar user
-.Sh DESCRIPTION
-When distributing your users' passwords over NIS (a.k.a. YP), the standard
-.Nm passwd ,
-.Nm chpass ,
-.Nm chfn , and
-.Nm chsh
-utilities cannot be
-used anymore to let a user change her password, because they only modify
-the password file on the local host. They are usually replaced by their
-YP counterparts, \fByppasswd\fP, \fBypchpass\fP, \fBypchfn\fP and \fBypchsh\fP.
-.Pp
-These commands are in fact the very same program, linked to different names.
-Using the command line switches, you can choose whether to update your
-password, your login shell (\fB-s\fP), or your GECOS field
-information (\fB-f\fP), or a combination of them. \fBchfn\fP and
-\fByppasswd\fP \fB-f\fP are equivalent, as are \fBchsh\fP and
-\fByppasswd\fP \fB-s\fP.
-.Pp
-When invoked without the \fIuser\fP argument, the account information for
-the invoking user will be updated, otherwise that of \fIuser\fP will be
-updated. This option is only available to the superuser.
-.Pp
-All tools will first prompt the user for the current NIS password needed
-for authentication with the \fByppasswdd\fP daemon. Subsequently, the
-program prompts for the updated information:
-.\"
-.\"
-.Pp "\fByppasswd\fP
-Change the user's NIS password. The user is prompted for the new password.
-While typing the password, echoing is turned off, so the password does not
-appear on the screen. An empty password is rejected, as are passwords shorter
-than six characters. The user will then be requested to retype the
-password to make sure it wasn't misspelled the first time.
-.\"
-.\"
-.Pp "\fBypchsh\fP or \fB-s\fP
-Change the user's login shell. The user is prompted for a new shell,
-offering the old one as default:
-.Pp
-.in +2n
-.ft B
-.nf
-Login shell [/bin/bash]: _
-.fi
-.ft
-.in
-.Pp
-To accept the default, simply press return. To clear the shell field in
-your \fBpasswd\fP file entry (so that the system's default shell is selected),
-enter the string \fInone\fP.
-.\"
-.\"
-.Pp "\fBypchfn\fP or \fB-f\fP
-Change the user's full name and related information. Traditionally, some
-applications expect the GECOS field (field 4) of the \fBpasswd\fP file to
-contain the user's real name (as opposed to the login name) plus some
-additional information like the office phone number. This information is
-displayed by \fBfinger(1)\fP and probably some other tools, too.
-.Pp
-When setting the full name, \fBypchfn\fP displays the following prompts,
-with the defaults in brackets:
-.Pp
-.in +2n
-.ft B
-.nf
-Name [Joe Doe]:
-Location [2nd floor, bldg 34]:
-Office Phone [12345]:
-Home Phone []:
-.fi
-.ft
-.in
-.Pp
-To accept a default, simply press return. To clear a field, enter the string
-\fInone\fP.
-.Sh LICENSE
-This program is a heavily beefed-up version of Theo de Raadt's \fByppasswd\fP
-client, which is covered by the BSD license. Therefore, the BSD license
-applies to this program as well.
-
-.Sh SEE ALSO
-.Xr finger 1 ,
-.Xr passwd 5 ,
-.Xr passwd 1 ,
-.Xr yppasswdd 8 .
-.Sh AUTHOR
-Theo de Raadt <deraadt@fsa.ca> (original client)
-.br
-Olaf Kirch <okir@monad.swb.de> (heavy modifications and manpages)
-.br
-Bill Paul <wpaul@ctr.columbia.edu> (port to FreeBSD and merger with
-.Xr passwd 1
-.Sh NOTES
-All these commands are really only symbolic links to
-.Xr passwd 1
diff --git a/usr.bin/timedef/data/ru_SU.KOI8-R b/usr.bin/timedef/data/ru_SU.KOI8-R
deleted file mode 100644
index e7a869f..0000000
--- a/usr.bin/timedef/data/ru_SU.KOI8-R
+++ /dev/null
@@ -1,76 +0,0 @@
-# WARNING: spaces may be essential at the end of lines
-# WARNING: empty lines are essential too
-#
-# Short months names
-#
-ÑÎ×
-ÆÅ×
-ÍÁÒ
-ÁÐÒ
-ÍÁÑ
-ÉÀÎ
-ÉÀÌ
-Á×Ç
-ÓÅÎ
-ÏËÔ
-ÎÏÑ
-ÄÅË
-#
-# Long months names
-#
-ÑÎ×ÁÒÑ
-ÆÅ×ÒÁÌÑ
-ÍÁÒÔÁ
-ÁÐÒÅÌÑ
-ÍÁÑ
-ÉÀÎÑ
-ÉÀÌÑ
-Á×ÇÕÓÔÁ
-ÓÅÎÔÑÂÒÑ
-ÏËÔÑÂÒÑ
-ÎÏÑÂÒÑ
-ÄÅËÁÂÒÑ
-#
-# Short weekdays names
-#
-×ÏÓ
-ÐÏÎ
-×ÔÏ
-ÓÒÅ
-ÞÅÔ
-ÐÑÔ
-ÓÕÂ
-#
-# Long weekdays names
-#
-×ÏÓËÒÅÓÅÎØÅ
-ÐÏÎÅÄÅÌØÎÉË
-×ÔÏÒÎÉË
-ÓÒÅÄÁ
-ÞÅÔ×ÅÒÇ
-ÐÑÔÎÉÃÁ
-ÓÕÂÂÏÔÁ
-#
-# X_fmt
-#
-%H:%M:%S
-#
-# x_fmt
-#
-%d.%m.%y
-#
-# c_fmt
-#
-%x %X
-#
-# am
-#
-
-#
-# pm
-#
-ÐÐ
-#
-# date_fmt
-#
-%a %e %b %H:%M:%S %Z %Y
diff --git a/usr.bin/tip/pathnames.h b/usr.bin/tip/pathnames.h
deleted file mode 100644
index fae04cb..0000000
--- a/usr.bin/tip/pathnames.h
+++ /dev/null
@@ -1,44 +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_ACULOG "/var/log/aculog"
-#define _PATH_LOCKDIRNAME "/var/spool/lock/LCK..%s"
-#ifdef notdef
-#define _PATH_LOCKDIRNAME "/var/spool/uucp/LCK/LCK..%s"
-#endif
-#define _PATH_PHONES "/etc/phones"
-#define _PATH_REMOTE "/etc/remote"
diff --git a/usr.bin/tip/tip.c b/usr.bin/tip/tip.c
deleted file mode 100644
index 0d84e75..0000000
--- a/usr.bin/tip/tip.c
+++ /dev/null
@@ -1,608 +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[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/*
- * tip - UNIX link to other systems
- * tip [-v] [-speed] system-name
- * or
- * cu phone-number [-s speed] [-l line] [-a acu]
- */
-#include "tip.h"
-#include "pathnames.h"
-
-/*
- * Baud rate mapping table
- */
-int bauds[] = {
- 0, 50, 75, 110, 134, 150, 200, 300, 600,
- 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, -1
-};
-
-int disc = OTTYDISC; /* tip normally runs this way */
-void intprompt();
-void timeout();
-void cleanup();
-void tipdone();
-char *sname();
-char PNbuf[256]; /* This limits the size of a number */
-
-main(argc, argv)
- char *argv[];
-{
- char *system = NOSTR;
- register int i;
- register char *p;
- char sbuf[12];
-
- gid = getgid();
- egid = getegid();
- uid = getuid();
- euid = geteuid();
- if (equal(sname(argv[0]), "cu")) {
- cumode = 1;
- cumain(argc, argv);
- goto cucommon;
- }
-
- if (argc > 4) {
- fprintf(stderr, "usage: tip [-v] [-speed] [system-name]\n");
- exit(1);
- }
- if (!isatty(0)) {
- fprintf(stderr, "tip: must be interactive\n");
- exit(1);
- }
-
- for (; argc > 1; argv++, argc--) {
- if (argv[1][0] != '-')
- system = argv[1];
- else switch (argv[1][1]) {
-
- case 'v':
- vflag++;
- break;
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- BR = atoi(&argv[1][1]);
- break;
-
- default:
- fprintf(stderr, "tip: %s, unknown option\n", argv[1]);
- break;
- }
- }
-
- if (system == NOSTR)
- goto notnumber;
- if (isalpha(*system))
- goto notnumber;
- /*
- * System name is really a phone number...
- * Copy the number then stomp on the original (in case the number
- * is private, we don't want 'ps' or 'w' to find it).
- */
- if (strlen(system) > sizeof PNbuf - 1) {
- fprintf(stderr, "tip: phone number too long (max = %d bytes)\n",
- sizeof PNbuf - 1);
- exit(1);
- }
- strncpy( PNbuf, system, sizeof PNbuf - 1 );
- for (p = system; *p; p++)
- *p = '\0';
- PN = PNbuf;
- (void)sprintf(sbuf, "tip%d", BR);
- system = sbuf;
-
-notnumber:
- (void)signal(SIGINT, cleanup);
- (void)signal(SIGQUIT, cleanup);
- (void)signal(SIGHUP, cleanup);
- (void)signal(SIGTERM, cleanup);
- (void)signal(SIGUSR1, tipdone);
-
- if ((i = hunt(system)) == 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();
-
- /*
- * Kludge, their's no easy way to get the initialization
- * in the right order, so force it here
- */
- if ((PH = getenv("PHONES")) == NOSTR)
- PH = _PATH_PHONES;
- vinit(); /* init variables */
- setparity("even"); /* set the parity table */
- if ((i = speed(number(value(BAUDRATE)))) == NULL) {
- printf("tip: bad baud rate %d\n", number(value(BAUDRATE)));
- (void)uu_unlock(uucplock);
- exit(3);
- }
-
- /*
- * Now that we have the logfile and the ACU open
- * return to the real uid and gid. These things will
- * be closed on exit. Swap real and effective uid's
- * so we can get the original permissions back
- * for removing the uucp lock.
- */
- user_uid();
-
- /*
- * Hardwired connections require the
- * line speed set before they make any transmissions
- * (this is particularly true of things like a DF03-AC)
- */
- if (HW)
- ttysetup(i);
- if (p = connect()) {
- printf("\07%s\n[EOT]\n", p);
- daemon_uid();
- (void)uu_unlock(uucplock);
- exit(1);
- }
- if (!HW)
- ttysetup(i);
-cucommon:
- /*
- * From here down the code is shared with
- * the "cu" version of tip.
- */
-
- ioctl(0, TIOCGETP, (char *)&defarg);
- ioctl(0, TIOCGETC, (char *)&defchars);
- ioctl(0, TIOCGLTC, (char *)&deflchars);
- ioctl(0, TIOCGETD, (char *)&odisc);
- arg = defarg;
- arg.sg_flags = ANYP | CBREAK;
- tchars = defchars;
- tchars.t_intrc = tchars.t_quitc = -1;
- ltchars = deflchars;
- ltchars.t_suspc = ltchars.t_dsuspc = ltchars.t_flushc
- = ltchars.t_lnextc = -1;
- raw();
-
- pipe(fildes); pipe(repdes);
- (void)signal(SIGALRM, timeout);
-
- /*
- * Everything's set up now:
- * connection established (hardwired or dialup)
- * line conditioned (baud rate, mode, etc.)
- * internal data structures (variables)
- * so, fork one process for local side and one for remote.
- */
- printf(cumode ? "Connected\r\n" : "\07connected\r\n");
- if (pid = fork())
- tipin();
- else
- tipout();
- /*NOTREACHED*/
-}
-
-void
-cleanup()
-{
-
- daemon_uid();
- (void)uu_unlock(uucplock);
- if (odisc)
- ioctl(0, TIOCSETD, (char *)&odisc);
- exit(0);
-}
-
-void
-tipdone()
-{
- tipabort("Hangup.");
-}
-/*
- * Muck with user ID's. We are setuid to the owner of the lock
- * directory when we start. user_uid() reverses real and effective
- * ID's after startup, to run with the user's permissions.
- * daemon_uid() switches back to the privileged uid for unlocking.
- * Finally, to avoid running a shell with the wrong real uid,
- * shell_uid() sets real and effective uid's to the user's real ID.
- */
-static int uidswapped;
-
-user_uid()
-{
- if (uidswapped == 0) {
- seteuid(uid);
- uidswapped = 1;
- }
-}
-
-daemon_uid()
-{
-
- if (uidswapped) {
- seteuid(euid);
- uidswapped = 0;
- }
-}
-
-shell_uid()
-{
-
- seteuid(uid);
-}
-
-/*
- * put the controlling keyboard into raw mode
- */
-raw()
-{
-
- ioctl(0, TIOCSETP, &arg);
- ioctl(0, TIOCSETC, &tchars);
- ioctl(0, TIOCSLTC, &ltchars);
- ioctl(0, TIOCSETD, (char *)&disc);
-}
-
-
-/*
- * return keyboard to normal mode
- */
-unraw()
-{
-
- ioctl(0, TIOCSETD, (char *)&odisc);
- ioctl(0, TIOCSETP, (char *)&defarg);
- ioctl(0, TIOCSETC, (char *)&defchars);
- ioctl(0, TIOCSLTC, (char *)&deflchars);
-}
-
-static jmp_buf promptbuf;
-
-/*
- * Print string ``s'', then read a string
- * in from the terminal. Handles signals & allows use of
- * normal erase and kill characters.
- */
-prompt(s, p)
- char *s;
- register char *p;
-{
- register char *b = p;
- sig_t oint, oquit;
-
- stoprompt = 0;
- oint = signal(SIGINT, intprompt);
- oquit = signal(SIGQUIT, SIG_IGN);
- unraw();
- printf("%s", s);
- if (setjmp(promptbuf) == 0)
- while ((*p = getchar()) != EOF && *p != '\n')
- p++;
- *p = '\0';
-
- raw();
- (void)signal(SIGINT, oint);
- (void)signal(SIGQUIT, oquit);
- return (stoprompt || p == b);
-}
-
-/*
- * Interrupt service routine during prompting
- */
-void
-intprompt()
-{
-
- (void)signal(SIGINT, SIG_IGN);
- stoprompt = 1;
- printf("\r\n");
- longjmp(promptbuf, 1);
-}
-
-/*
- * ****TIPIN TIPIN****
- */
-tipin()
-{
- char gch, bol = 1;
-
- /*
- * Kinda klugey here...
- * check for scripting being turned on from the .tiprc file,
- * but be careful about just using setscript(), as we may
- * send a SIGEMT before tipout has a chance to set up catching
- * it; so wait a second, then setscript()
- */
- if (boolean(value(SCRIPT))) {
- sleep(1);
- setscript();
- }
-
- while (1) {
- gch = getchar()&0177;
- if ((gch == character(value(ESCAPE))) && bol) {
- if (!(gch = escape()))
- continue;
- } else if (!cumode && gch == character(value(RAISECHAR))) {
- boolean(value(RAISE)) = !boolean(value(RAISE));
- continue;
- } else if (gch == '\r') {
- bol = 1;
- pwrite(FD, &gch, 1);
- if (boolean(value(HALFDUPLEX)))
- printf("\r\n");
- continue;
- } else if (!cumode && gch == character(value(FORCE)))
- gch = getchar()&0177;
- bol = any(gch, value(EOL));
- if (boolean(value(RAISE)) && islower(gch))
- gch = toupper(gch);
- pwrite(FD, &gch, 1);
- if (boolean(value(HALFDUPLEX)))
- printf("%c", gch);
- }
-}
-
-extern esctable_t etable[];
-
-/*
- * Escape handler --
- * called on recognition of ``escapec'' at the beginning of a line
- */
-escape()
-{
- register char gch;
- register esctable_t *p;
- char c = character(value(ESCAPE));
-
- gch = (getchar()&0177);
- for (p = etable; p->e_char; p++)
- if (p->e_char == gch) {
- if ((p->e_flags&PRIV) && uid)
- continue;
- printf("%s", ctrl(c));
- (*p->e_func)(gch);
- return (0);
- }
- /* ESCAPE ESCAPE forces ESCAPE */
- if (c != gch)
- pwrite(FD, &c, 1);
- return (gch);
-}
-
-speed(n)
- int n;
-{
- register int *p;
-
- for (p = bauds; *p != -1; p++)
- if (*p == n)
- return (p - bauds);
- return (NULL);
-}
-
-any(c, p)
- register char c, *p;
-{
- while (p && *p)
- if (*p++ == c)
- return (1);
- return (0);
-}
-
-size(s)
- register char *s;
-{
- register int i = 0;
-
- while (s && *s++)
- i++;
- return (i);
-}
-
-char *
-interp(s)
- register char *s;
-{
- static char buf[256];
- register char *p = buf, c, *q;
-
- while (c = *s++) {
- for (q = "\nn\rr\tt\ff\033E\bb"; *q; q++)
- if (*q++ == c) {
- *p++ = '\\'; *p++ = *q;
- goto next;
- }
- if (c < 040) {
- *p++ = '^'; *p++ = c + 'A'-1;
- } else if (c == 0177) {
- *p++ = '^'; *p++ = '?';
- } else
- *p++ = c;
- next:
- ;
- }
- *p = '\0';
- return (buf);
-}
-
-char *
-ctrl(c)
- char c;
-{
- static char s[3];
-
- if (c < 040 || c == 0177) {
- s[0] = '^';
- s[1] = c == 0177 ? '?' : c+'A'-1;
- s[2] = '\0';
- } else {
- s[0] = c;
- s[1] = '\0';
- }
- return (s);
-}
-
-/*
- * Help command
- */
-help(c)
- char c;
-{
- register esctable_t *p;
-
- printf("%c\r\n", c);
- for (p = etable; p->e_char; p++) {
- if ((p->e_flags&PRIV) && uid)
- continue;
- printf("%2s", ctrl(character(value(ESCAPE))));
- printf("%-2s %c %s\r\n", ctrl(p->e_char),
- p->e_flags&EXP ? '*': ' ', p->e_help);
- }
-}
-
-/*
- * Set up the "remote" tty's state
- */
-ttysetup(speed)
- int speed;
-{
- unsigned bits = LDECCTQ;
-
- arg.sg_ispeed = arg.sg_ospeed = speed;
- arg.sg_flags = RAW;
- if (boolean(value(TAND)))
- arg.sg_flags |= TANDEM;
- ioctl(FD, TIOCSETP, (char *)&arg);
- ioctl(FD, TIOCLBIS, (char *)&bits);
-}
-
-/*
- * Return "simple" name from a file name,
- * strip leading directories.
- */
-char *
-sname(s)
- register char *s;
-{
- register char *p = s;
-
- while (*s)
- if (*s++ == '/')
- p = s;
- return (p);
-}
-
-static char partab[0200];
-static int bits8;
-
-/*
- * Do a write to the remote machine with the correct parity.
- * We are doing 8 bit wide output, so we just generate a character
- * with the right parity and output it.
- */
-pwrite(fd, buf, n)
- int fd;
- char *buf;
- register int n;
-{
- register int i;
- register char *bp;
- extern int errno;
-
- bp = buf;
- if (bits8 == 0)
- for (i = 0; i < n; i++) {
- *bp = partab[(*bp) & 0177];
- bp++;
- }
- if (write(fd, buf, n) < 0) {
- if (errno == EIO)
- tipabort("Lost carrier.");
- if (errno == ENODEV)
- tipabort("tty not available.");
- /* this is questionable */
- perror("write");
- }
-}
-
-/*
- * Build a parity table with appropriate high-order bit.
- */
-setparity(defparity)
- char *defparity;
-{
- register int i, flip, clr, set;
- char *parity;
- extern char evenpartab[];
-
- if (value(PARITY) == NOSTR)
- value(PARITY) = defparity;
- parity = value(PARITY);
- if (equal(parity, "none")) {
- bits8 = 1;
- return;
- }
- bits8 = 0;
- flip = 0;
- clr = 0377;
- set = 0;
- if (equal(parity, "odd"))
- flip = 0200; /* reverse bit 7 */
- else if (equal(parity, "zero"))
- clr = 0177; /* turn off bit 7 */
- else if (equal(parity, "one"))
- set = 0200; /* turn on bit 7 */
- else if (!equal(parity, "even")) {
- (void) fprintf(stderr, "%s: unknown parity value\r\n", parity);
- (void) fflush(stderr);
- }
- for (i = 0; i < 0200; i++)
- partab[i] = evenpartab[i] ^ flip | set & clr;
-}
diff --git a/usr.bin/tip/tip.h b/usr.bin/tip/tip.h
deleted file mode 100644
index f1b833d..0000000
--- a/usr.bin/tip/tip.h
+++ /dev/null
@@ -1,280 +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.
- *
- * @(#)tip.h 8.1 (Berkeley) 6/6/93
- */
-
-/*
- * tip - terminal interface program
- */
-
-#include <sys/types.h>
-#include <machine/endian.h>
-#include <sys/file.h>
-#include <sys/time.h>
-
-#include <sgtty.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <pwd.h>
-#include <ctype.h>
-#include <setjmp.h>
-#include <unistd.h>
-#include <errno.h>
-
-/*
- * Remote host attributes
- */
-char *DV; /* UNIX device(s) to open */
-char *EL; /* chars marking an EOL */
-char *CM; /* initial connection message */
-char *IE; /* EOT to expect on input */
-char *OE; /* EOT to send to complete FT */
-char *CU; /* call unit if making a phone call */
-char *AT; /* acu type */
-char *PN; /* phone number(s) */
-char *DI; /* disconnect string */
-char *PA; /* parity to be generated */
-
-char *PH; /* phone number file */
-char *RM; /* remote file name */
-char *HO; /* host name */
-
-long BR; /* line speed for conversation */
-long FS; /* frame size for transfers */
-
-char DU; /* this host is dialed up */
-char HW; /* this device is hardwired, see hunt.c */
-char *ES; /* escape character */
-char *EX; /* exceptions */
-char *FO; /* force (literal next) char*/
-char *RC; /* raise character */
-char *RE; /* script record file */
-char *PR; /* remote prompt */
-long DL; /* line delay for file transfers to remote */
-long CL; /* char delay for file transfers to remote */
-long ET; /* echocheck timeout */
-char HD; /* this host is half duplex - do local echo */
-
-/*
- * String value table
- */
-typedef
- struct {
- char *v_name; /* whose name is it */
- char v_type; /* for interpreting set's */
- char v_access; /* protection of touchy ones */
- char *v_abrev; /* possible abreviation */
- char *v_value; /* casted to a union later */
- }
- value_t;
-
-#define STRING 01 /* string valued */
-#define BOOL 02 /* true-false value */
-#define NUMBER 04 /* numeric value */
-#define CHAR 010 /* character value */
-
-#define WRITE 01 /* write access to variable */
-#define READ 02 /* read access */
-
-#define CHANGED 01 /* low bit is used to show modification */
-#define PUBLIC 1 /* public access rights */
-#define PRIVATE 03 /* private to definer */
-#define ROOT 05 /* root defined */
-
-#define TRUE 1
-#define FALSE 0
-
-#define ENVIRON 020 /* initialize out of the environment */
-#define IREMOTE 040 /* initialize out of remote structure */
-#define INIT 0100 /* static data space used for initialization */
-#define TMASK 017
-
-/*
- * Definition of ACU line description
- */
-typedef
- struct {
- char *acu_name;
- int (*acu_dialer)();
- int (*acu_disconnect)();
- int (*acu_abort)();
- }
- acu_t;
-
-#define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */
-
-/*
- * variable manipulation stuff --
- * if we defined the value entry in value_t, then we couldn't
- * initialize it in vars.c, so we cast it as needed to keep lint
- * happy.
- */
-typedef
- union {
- int zz_number;
- short zz_boolean[2];
- char zz_character[4];
- int *zz_address;
- }
- zzhack;
-
-#define value(v) vtable[v].v_value
-
-#define number(v) ((((zzhack *)(&(v))))->zz_number)
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-#define boolean(v) ((((zzhack *)(&(v))))->zz_boolean[0])
-#define character(v) ((((zzhack *)(&(v))))->zz_character[0])
-#endif
-
-#if BYTE_ORDER == BIG_ENDIAN
-#define boolean(v) ((((zzhack *)(&(v))))->zz_boolean[1])
-#define character(v) ((((zzhack *)(&(v))))->zz_character[3])
-#endif
-
-#define address(v) ((((zzhack *)(&(v))))->zz_address)
-
-/*
- * Escape command table definitions --
- * lookup in this table is performed when ``escapec'' is recognized
- * at the begining of a line (as defined by the eolmarks variable).
-*/
-
-typedef
- struct {
- char e_char; /* char to match on */
- char e_flags; /* experimental, priviledged */
- char *e_help; /* help string */
- int (*e_func)(); /* command */
- }
- esctable_t;
-
-#define NORM 00 /* normal protection, execute anyone */
-#define EXP 01 /* experimental, mark it with a `*' on help */
-#define PRIV 02 /* priviledged, root execute only */
-
-extern int vflag; /* verbose during reading of .tiprc file */
-extern value_t vtable[]; /* variable table */
-
-#ifndef ACULOG
-#define logent(a, b, c, d)
-#define loginit()
-#endif
-
-/*
- * Definition of indices into variable table so
- * value(DEFINE) turns into a static address.
- */
-
-#define BEAUTIFY 0
-#define BAUDRATE 1
-#define DIALTIMEOUT 2
-#define EOFREAD 3
-#define EOFWRITE 4
-#define EOL 5
-#define ESCAPE 6
-#define EXCEPTIONS 7
-#define FORCE 8
-#define FRAMESIZE 9
-#define HOST 10
-#define LOG 11
-#define PHONES 12
-#define PROMPT 13
-#define RAISE 14
-#define RAISECHAR 15
-#define RECORD 16
-#define REMOTE 17
-#define SCRIPT 18
-#define TABEXPAND 19
-#define VERBOSE 20
-#define SHELL 21
-#define HOME 22
-#define ECHOCHECK 23
-#define DISCONNECT 24
-#define TAND 25
-#define LDELAY 26
-#define CDELAY 27
-#define ETIMEOUT 28
-#define RAWFTP 29
-#define HALFDUPLEX 30
-#define LECHO 31
-#define PARITY 32
-
-#define NOVAL ((value_t *)NULL)
-#define NOACU ((acu_t *)NULL)
-#define NOSTR ((char *)NULL)
-#define NOFILE ((FILE *)NULL)
-#define NOPWD ((struct passwd *)0)
-
-struct sgttyb arg; /* current mode of local terminal */
-struct sgttyb defarg; /* initial mode of local terminal */
-struct tchars tchars; /* current state of terminal */
-struct tchars defchars; /* initial state of terminal */
-struct ltchars ltchars; /* current local characters of terminal */
-struct ltchars deflchars; /* initial local characters of terminal */
-
-FILE *fscript; /* FILE for scripting */
-
-int fildes[2]; /* file transfer synchronization channel */
-int repdes[2]; /* read process sychronization channel */
-int FD; /* open file descriptor to remote host */
-int AC; /* open file descriptor to dialer (v831 only) */
-int vflag; /* print .tiprc initialization sequence */
-int sfd; /* for ~< operation */
-int pid; /* pid of tipout */
-uid_t uid, euid; /* real and effective user id's */
-gid_t gid, egid; /* real and effective group id's */
-int stop; /* stop transfer session flag */
-int quit; /* same; but on other end */
-int intflag; /* recognized interrupt */
-int stoprompt; /* for interrupting a prompt session */
-int timedout; /* ~> transfer timedout */
-int cumode; /* simulating the "cu" program */
-
-char fname[80]; /* file name buffer for ~< */
-char copyname[80]; /* file name buffer for ~> */
-char ccc; /* synchronization character */
-char ch; /* for tipout */
-char *uucplock; /* name of lock file for uucp's */
-
-int odisc; /* initial tty line discipline */
-extern int disc; /* current tty discpline */
-
-extern char *ctrl();
-extern char *vinterp();
-extern char *connect();
-
-int tipabort __P((char *));
diff --git a/usr.bin/tip/tipout.c b/usr.bin/tip/tipout.c
deleted file mode 100644
index 246cfb7..0000000
--- a/usr.bin/tip/tipout.c
+++ /dev/null
@@ -1,166 +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[] = "@(#)tipout.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include "tip.h"
-/*
- * tip
- *
- * lower fork of tip -- handles passive side
- * reading from the remote host
- */
-
-static jmp_buf sigbuf;
-
-/*
- * TIPOUT wait state routine --
- * sent by TIPIN when it wants to posses the remote host
- */
-void
-intIOT()
-{
-
- write(repdes[1],&ccc,1);
- read(fildes[0], &ccc,1);
- longjmp(sigbuf, 1);
-}
-
-/*
- * Scripting command interpreter --
- * accepts script file name over the pipe and acts accordingly
- */
-void
-intEMT()
-{
- char c, line[256];
- register char *pline = line;
- char reply;
-
- read(fildes[0], &c, 1);
- while (c != '\n') {
- *pline++ = c;
- read(fildes[0], &c, 1);
- }
- *pline = '\0';
- if (boolean(value(SCRIPT)) && fscript != NULL)
- fclose(fscript);
- if (pline == line) {
- boolean(value(SCRIPT)) = FALSE;
- reply = 'y';
- } else {
- if ((fscript = fopen(line, "a")) == NULL)
- reply = 'n';
- else {
- reply = 'y';
- boolean(value(SCRIPT)) = TRUE;
- }
- }
- write(repdes[1], &reply, 1);
- longjmp(sigbuf, 1);
-}
-
-void
-intTERM()
-{
-
- if (boolean(value(SCRIPT)) && fscript != NULL)
- fclose(fscript);
- exit(0);
-}
-
-void
-intSYS()
-{
-
- boolean(value(BEAUTIFY)) = !boolean(value(BEAUTIFY));
- longjmp(sigbuf, 1);
-}
-
-/*
- * ****TIPOUT TIPOUT****
- */
-tipout()
-{
- char buf[BUFSIZ];
- register char *cp;
- register int cnt;
- extern int errno;
- int omask;
-
- signal(SIGINT, SIG_IGN);
- signal(SIGQUIT, SIG_IGN);
- signal(SIGEMT, intEMT); /* attention from TIPIN */
- signal(SIGTERM, intTERM); /* time to go signal */
- signal(SIGIOT, intIOT); /* scripting going on signal */
- signal(SIGHUP, intTERM); /* for dial-ups */
- signal(SIGSYS, intSYS); /* beautify toggle */
- (void) setjmp(sigbuf);
- for (omask = 0;; sigsetmask(omask)) {
- cnt = read(FD, buf, BUFSIZ);
- if (cnt <= 0) {
- /* lost carrier */
- if (cnt < 0 && errno == EIO) {
- sigblock(sigmask(SIGTERM));
- intTERM();
- /*NOTREACHED*/
- } else if (cnt == 0 && errno == ENOENT) {
- kill(getppid(),SIGUSR1);
- sigblock(sigmask(SIGTERM));
- intTERM();
- /*NOTREACHED*/
- } else {
- printf("%d %d\r",cnt,errno);
- fflush(stdout);
- }
- continue;
- }
-#define ALLSIGS sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
- omask = sigblock(ALLSIGS);
- for (cp = buf; cp < buf + cnt; cp++)
- *cp &= 0177;
- write(1, buf, cnt);
- if (boolean(value(SCRIPT)) && fscript != NULL) {
- if (!boolean(value(BEAUTIFY))) {
- fwrite(buf, 1, cnt, fscript);
- continue;
- }
- for (cp = buf; cp < buf + cnt; cp++)
- if ((*cp >= ' ' && *cp <= '~') ||
- any(*cp, value(EXCEPTIONS)))
- putc(*cp, fscript);
- }
- }
-}
diff --git a/usr.bin/tip/uucplock.c b/usr.bin/tip/uucplock.c
deleted file mode 100644
index 917d812..0000000
--- a/usr.bin/tip/uucplock.c
+++ /dev/null
@@ -1,102 +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 sccsid[] = "@(#)uucplock.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/dir.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdio.h>
-#include "pathnames.h"
-
-/*
- * uucp style locking routines
- * return: 0 - success
- * -1 - failure
- */
-
-uu_lock(ttyname)
- char *ttyname;
-{
- int fd, pid;
- char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN];
- FILE *ff;
-
- (void)sprintf(tbuf, _PATH_LOCKDIRNAME, ttyname);
- fd = open(tbuf, O_WRONLY|O_CREAT|O_EXCL, 0644);
- if (fd >= 0)
- ff = fdopen(fd, "w");
- if (fd < 0 || ff == NULL) {
- /*
- * file is already locked
- * check to see if the process holding the lock still exists
- */
- ff = fopen(tbuf, "r+");
- if (ff == NULL) {
- perror("lock open");
- return(-1);
- }
- if (fscanf(ff, "%10d\n", &pid) != 1) {
- perror("lock read");
- (void)fclose(ff);
- return(-1);
- }
-
- if (kill(pid, 0) == 0 || errno != ESRCH) {
- (void)fclose(ff); /* process is still running */
- return(-1);
- }
- /*
- * The process that locked the file isn't running, so
- * we'll lock it ourselves
- */
- rewind(ff);
- /* fall out and finish the locking process */
- }
- (void)fprintf(ff, "%10d\n", getpid());
- (void)fclose(ff);
- return(0);
-}
-
-uu_unlock(ttyname)
- char *ttyname;
-{
- char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN];
-
- (void)sprintf(tbuf, _PATH_LOCKDIRNAME, ttyname);
- return(unlink(tbuf));
-}
diff --git a/usr.bin/uucp/acucntrl/Makefile b/usr.bin/uucp/acucntrl/Makefile
deleted file mode 100644
index 8a2b44f..0000000
--- a/usr.bin/uucp/acucntrl/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/6/93
-
-PROG= acucntrl
-CFLAGS+=-I${.CURDIR}/../includes
-BINDIR= ${LIBDIR}
-BINOWN= root
-BINMODE=6550
-MAN8= acucntrl.8
-
-.include <bsd.prog.mk>
diff --git a/usr.bin/uucp/acucntrl/acucntrl.8 b/usr.bin/uucp/acucntrl/acucntrl.8
deleted file mode 100644
index b2b7f0e..0000000
--- a/usr.bin/uucp/acucntrl/acucntrl.8
+++ /dev/null
@@ -1,164 +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.
-.\"
-.\" @(#)acucntrl.8 8.2 (Berkeley) 12/11/93
-.\"
-.TH ACUCNTRL 8 "December 11, 1993"
-.UC 6
-.SH NAME
-acucntrl \- turn around tty line between dialin and dialout
-.SH SYNOPSIS
-.B /usr/lib/uucp/acucntrl
-keyword ttyline
-.SH DESCRIPTION
-.PP
-.I Acucntrl
-turns around the terminal line,
-enabling it to be used for both dialin and dialout.
-On dialin a terminal line is assumed to have modem control enabled and a getty
-process in existence waiting for logins. On dialout modem control is disabled
-and there is no getty process.
-.PP
-This program must be run setuid to root.
-.PP
-.I keyword
-is chosen from the list:
-.I disable
-or
-.IR dialout ,
-to condition a line for dialout;
-and
-.I enable
-or
-.IR dialin ,
-to condition a line for dialin.
-.PP
-When the line is conditioned for dialing out, the login name of the real uid
-of the process is placed in /etc/utmp in capitals.
-This declares that the line is in use and acts as an additional locking
-mechanism.
-.I Acucntrl
-will refuse to act if the /etc/utmp entry for the line is not null,
-is not the the user's login name (capitalized or not),
-and if the process is not running as the superuser.
-The last condition is to allow the superuser to clear the state of the line.
-.PP
-Turning modem control on or off is handled by poking into /dev/kmem.
-It is currently implemented for dz, dh, and dmf lines.
-.PP
-Under 4.2 BSD the program will also refuse to disable a line if carrier is
-sensed on it. This is to avoid the dead period where someone has just dialed
-in and made the connection but has not yet logged in.
-.PP
-.I Ttyline
-can be either of the form tty* or /dev/tty*.
-Enabling/disabling a line whose name does not begin with ttyd? is prohibited
-unless the real uid of the process is 0 or if the login name corresponding to
-the real uid is uucp. This is a security precaution.
-.PP
-Steps taken when disabling
-.RI ( i . e .
-setup for dialing out)
-.IP 1)
-check input arguments
-.IP 2)
-look in /etc/utmp to check that the line is not in use by another user
-.IP 3)
-disable modem control on line
-.IP 4)
-check for carrier on device
-.IP 5)
-change owner of device to real uid
-.IP 6)
-edit /etc/ttys, changing the first character of the appropriate line to 0
-.IP 7)
-send a hangup to process 1 to poke init to disable getty
-.IP 8)
-post uid name in capitals in /etc/utmp to let world know device has been grabbed
-.IP 9)
-make sure that DTR is on
-.PP
-Steps taken when enabling
-.RI ( i . e .
-setup for dialing in)
-.IP 1)
-check input arguments
-.IP 2)
-look in /etc/utmp to check that the line is not in use by another user
-.IP 3)
-make sure modem control on line is disabled
-.IP 4)
-turn off DTR to make sure line is hung up
-.IP 5)
-condition line: clear exclusive use and set hangup on close modes
-.IP 6)
-turn on modem control
-.IP 7)
-edit /etc/ttys, changing the first character of the appropriate line to 1
-.IP 8)
-send a hangup to process 1 to poke init to enable getty
-.IP 9)
-clear uid name for /etc/utmp
-.SH HISTORY
-.PP
-First written by Allan Wilkes (fisher!allan)
-.PP
-Modified June 8,1983 by W.Sebok (astrovax!wls) to poke the kernel rather
-than use a kernel hack to turn on/off modem control, using a subroutine
-stolen from a program written by Tsutomu Shimomura {astrovax,escher}!tsutomu
-.PP
-Worked over many times by W.Sebok
-.RI ( i . e .
-hacked to death)
-.SH FILES
-/dev/kmem, /kernel, /etc/ttys, /etc/utmp, /dev/tty*
-.SH BUGS
-.PP
-Sensing carrier requires the 4.2 BSD TIOCMGET ioctl call. Unfortunately this
-ioctl is not implemented in the vanilla 4.2 BSD dh driver even though the
-dz and dmf drivers use an emulation of the DH11's modem control bits. This
-has been fixed here.
-.PP
-Some time (currently 2 seconds) is required between disabling modem control
-and opening the device. This is probably because of a race with getty whose
-open is finally being allowed to complete. This time interval may not be
-enough on a loaded system. Because of this problem and the above problem with
-the dh driver there is deliberately no error message given when the TIOCMGET
-ioctl fails.
-.PP
-Previously there were similar synchronization problems with the init process.
-When dialins are disabled the capitalized name of the process cannot be posted
-into /etc/utmp until init has finished clearing /etc/utmp. However one does
-not know how long that will take, and, on a loaded system, it can take quite
-a while. This was solved by the strategy of 1) posting the name, 2) poking
-init, 3) going into a loop where the process repeatedly waits a second and
-checks whether the entry has been cleared from /etc/utmp, and 4) posting the
-name again.
diff --git a/usr.bin/uucp/uupoll/Makefile b/usr.bin/uucp/uupoll/Makefile
deleted file mode 100644
index 97794d5..0000000
--- a/usr.bin/uucp/uupoll/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/6/93
-
-PROG= uupoll
-CFLAGS+=-I${.CURDIR}/../includes
-BINMODE=6555
-DPADD= ${LIBCOMPAT}
-LDADD= ${LIBUU} -lcompat
-MAN8= uupoll.8
-
-.include <bsd.prog.mk>
diff --git a/usr.bin/uucp/uusnap/Makefile b/usr.bin/uucp/uusnap/Makefile
deleted file mode 100644
index d23ab2a..0000000
--- a/usr.bin/uucp/uusnap/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/6/93
-
-PROG= uusnap
-CFLAGS+=-I${.CURDIR}/../includes
-BINMODE=6555
-MAN8= uusnap.8
-
-.include <bsd.prog.mk>
diff --git a/usr.bin/watch/Makefile b/usr.bin/watch/Makefile
deleted file mode 100644
index 7a9f602..0000000
--- a/usr.bin/watch/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-PROG= watch
-MAN8= watch.8
-BINMODE=500
-LDADD= -ltermcap
-
-.include <bsd.prog.mk>
diff --git a/usr.bin/watch/snp.4 b/usr.bin/watch/snp.4
deleted file mode 100644
index 47b97d8..0000000
--- a/usr.bin/watch/snp.4
+++ /dev/null
@@ -1,49 +0,0 @@
-.Dd Februar 17, 1995
-.Dt SNP(4)
-.Os
-.Sh NAME
-
- snp - tty snoop interface.
-
-.Sh SYNOPSIS
-#include <sys/snoop.h>
-
-.Sh DESCRIPTION
- /dev/snp? are snoop devices which allow user to attach to any tty
-and watch activities on it. Device can be used by root only.
- To connect device to tty use special iocontrol SNPSTTY.Argument to
-it is a structure 'snptty'.
- struct snptty {
- int st_type;
- int st_unit;
- }
-
-st_type - type of tty to attach. Currently supported are :
- ST_PTY - pseudo-tty devices.
- ST_VTY - virtual ttys (syscons).
- ST_SIO - serial ttys.
-
-st_unit - number of tty unit.
-By specifying ever st_type or st_unit -1 user can detach snp
-device from tty.
-
- SNPGTTY - iocontrol returns current tty attached.
- FIONREAD - iocontrol returns ever positive value equal to number of
- characters in read buffer. Also special values defined:
- SNP_OFLOW - device overflow occured,device automatically
- detached.
- SNP_TTYCLOSE - tty still has not been attached.
- SNP_DETACH - snp device has been detached by user or
- tty device has been closed and detached
- automatically.
-
-.Sh SEE ALSO
-
-watch(8), pty(4), sio(4)
-.Sh BUGS
-
-While in line mode,user input can't be seen.
-Has no ability to write to attached tty device.
-
-.Sh HISTORY
-FreeBSD 2.1 by Ugen J.S.Antsilevich <ugen@NetVision.net.il>
diff --git a/usr.bin/watch/watch.8 b/usr.bin/watch/watch.8
deleted file mode 100644
index a57a70c..0000000
--- a/usr.bin/watch/watch.8
+++ /dev/null
@@ -1,77 +0,0 @@
-.\"
-.\" @(#)watch.8 1.1 (FreeBSD) 2/17/95
-.\"
-.Dd February 17, 1995
-.Dt WATCH 8
-.Os
-.Sh NAME
-.Nm watch
-.Nd snoop on another tty line
-.Sh SYNOPSYS
-.Nm watch
-.Op Fl ciot
-.Ar tty
-.\" watch [-ciot] [<tty name>]
-.Sh DESCRIPTION
-.Nm Watch
-allows the superuser to examine all data coming through a specified tty.
-.Nm Watch
-writes to standard output.
-.Pp
-The options are as follows:
-.Bl -tag -width "-l nul "
-.It Fl c
-Reconnect on close. If the tty observed by
-.Nm watch
-is closed, automatically reattach to the same tty.
-If this option is not specified,
-.Nm watch
-will request a new tty if running in interactive mode or exit if running
-without a controlling tty.
-.It Fl i
-Force interactive mode.
-Interactive mode is a default if
-.Nm watch
-is started from a tty.
-If output is redirected to a file, interactive mode can still be requested
-by specifying this option.
-.It Fl o
-Reconnect on overflow.
-The behaviour of
-.Nm watch
-if the observed tty overflows is similar to the behavior if the observed tty
-is closed.
-For more info see
-.Xr snp 4 .
-.It Fl t
-Print the date and time when observation of a given tty is started.
-.It Ar tty
-Tty may be specified as a remote pseudo tty device, a virtual console, or
-a serial line.
-Names may be preceded by "/dev/".
-.Sh OPERATION
-While running in interactive mode, all user input is discarded except for:
-.Pp
-.Bl -tag -width "XXXX" -compact
-.It Sy "<control-C>"
-Exit
-.Nm watch .
-.It Sy "<control-W>"
-Clear screen.
-.It Sy "<control-X>"
-Change attached tty.
-.Sh RESTRICTIONS
-Only the superuser can run
-.Nm watch .
-.Sh SEE ALSO
-.Xr snpl4 ,
-.Xr pty 4 ,
-.Xr sio 4 .
-.Sh BUGS
-No terminal emulation is performed.
-All user output is reproduced as-is.
-.Sh AUTHOR
-Ugen J.S. Antsilevich <ugen@NetVision.net.il>
-.Sh HISTORY
-.Nm Watch
-first appeared in FreeBSD 2.1
diff --git a/usr.bin/watch/watch.c b/usr.bin/watch/watch.c
deleted file mode 100644
index f5e4007..0000000
--- a/usr.bin/watch/watch.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- * Copyright (c) 1995 Ugen J.S.Antsilevich
- *
- * Redistribution and use in source forms, with and without modification,
- * are permitted provided that this entire comment appears intact.
- *
- * Redistribution in binary form may occur without any restrictions.
- * Obviously, it would be nice if you gave credit where credit is due
- * but requiring it would be too onerous.
- *
- * This software is provided ``AS IS'' without any warranties of any kind.
- *
- * Snoop stuff.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/select.h>
-#include <sys/fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/ioctl_compat.h>
-#include <sys/snoop.h>
-
-
-#define MSG_INIT "Snoop started."
-#define MSG_OFLOW "Snoop stopped due to overflow.Reconnecting."
-#define MSG_CLOSED "Snoop stopped due to tty close.Reconnecting."
-#define MSG_CHANGE "Snoop device change by user request."
-
-
-#define DEV_NAME_LEN 12 /* for /dev/ttyXX++ */
-#define MIN_SIZE 256
-
-#define CHR_SWITCH 24 /* Ctrl+X */
-#define CHR_CLEAR 23 /* Ctrl+V */
-
-
-int opt_reconn_close = 0;
-int opt_reconn_oflow = 0;
-int opt_interactive = 1;
-int opt_timestamp = 0;
-
-char dev_name[DEV_NAME_LEN];
-int snp_io;
-struct snptty snp_tty;
-int std_in = 0, std_out = 1;
-
-
-int clear_ok = 0;
-struct sgttyb sgo;
-char tbuf[1024], buf[1024];
-
-
-void
-clear()
-{
- if (clear_ok)
- tputs(buf, 1, putchar);
- fflush(stdout);
-}
-
-void
-timestamp(buf)
- char *buf;
-{
- time_t t;
- char btmp[1024];
- clear();
- printf("\n---------------------------------------------\n");
- t = time(NULL);
- strftime(btmp, 1024, "Time: %d %b %H:%M", localtime(&t));
- printf("%s\n", btmp);
- printf("%s\n", buf);
- printf("---------------------------------------------\n");
- fflush(stdout);
-}
-
-void
-set_tty()
-{
- struct sgttyb sgn;
- ioctl(std_in, TIOCGETP, &sgo);
- /* bcopy(&sgn, &sgo, sizeof(struct sgttyb)); */
- sgn = sgo;
- sgn.sg_flags |= CBREAK;
- sgn.sg_flags &= ~ECHO;
- ioctl(std_in, TIOCSETP, &sgn);
-}
-
-void
-unset_tty()
-{
- ioctl(std_in, TIOCSETP, &sgo);
-}
-
-
-void
-fatal(buf)
- char *buf;
-{
- unset_tty();
- if (buf)
- fprintf(stderr, "Fatal: %s\n", buf);
- exit(1);
-}
-
-int
-open_snp()
-{
- char snp[DEV_NAME_LEN] = "/dev/snpX";
- char c;
- int f;
- for (c = '0'; c <= '9'; c++) {
- snp[8] = c;
- if ((f = open(snp, O_RDONLY)) < 0)
- continue;
- return f;
- }
- fatal("Cannot open snoop device.");
-}
-
-
-void
-cleanup()
-{
- if (opt_timestamp)
- timestamp("Logging Exited.");
- close(snp_io);
- unset_tty();
- exit(0);
-}
-
-
-void
-show_usage()
-{
- printf("watch -[ciot] [tty name]\n");
- exit(1);
-}
-
-void
-setup_scr()
-{
- char *cbuf = buf, *term;
- if (!opt_interactive)
- return;
- if ((term = getenv("TERM")))
- if (tgetent(tbuf, term) == 1)
- if (tgetstr("cl", &cbuf))
- clear_ok = 1;
- clear();
- set_tty();
-}
-
-
-int
-ctoh(c)
- char c;
-{
- if (c >= '0' && c <= '9')
- return (int) (c - '0');
-
- if (c >= 'a' && c <= 'f')
- return (int) (c - 'a' + 10);
-
- fatal("Bad tty number.");
-}
-
-
-void
-detach_snp()
-{
- struct snptty st;
- st.st_type = -1;
- st.st_unit = -1;
- ioctl(snp_io, SNPSTTY, &st);
-}
-
-void
-attach_snp()
-{
- if (ioctl(snp_io, SNPSTTY, &snp_tty) != 0)
- fatal("Cannot attach to tty.");
- if (opt_timestamp)
- timestamp("Logging Started.");
-}
-
-
-void
-set_dev(name)
- char *name;
-{
- char buf[DEV_NAME_LEN], num[DEV_NAME_LEN];
- int unitbase = 0;
-
- if (strlen(name) > 5 && !strncmp(name, "/dev/", 5))
- strcpy(buf, &(name[5]));
- else
- strcpy(buf, name);
-
- if (strlen(buf) < 4)
- fatal("Bad tty name.");
-
- if (!strncmp(buf, "tty", 3))
- switch (buf[3]) {
- case 'v':
- snp_tty.st_unit = ctoh(buf[4]);
- snp_tty.st_type = ST_VTY;
- goto got_num;
- case 'r':
- unitbase += 16;
- case 'q':
- unitbase += 16;
- case 'p':
- snp_tty.st_unit = ctoh(buf[4]) + unitbase;
- snp_tty.st_type = ST_PTY;
- goto got_num;
- case '0':
- case 'd':
- snp_tty.st_unit = ctoh(buf[4]);
- snp_tty.st_type = ST_SIO;
- goto got_num;
- default:
- fatal("Bad tty name.");
-
- }
-
-
- if (!strncmp(buf, "vty", 3)) {
- strcpy(num, &(buf[3]));
- snp_tty.st_unit = atoi(num);
- snp_tty.st_type = ST_VTY;
- goto got_num;
- }
- if (!strncmp(buf, "pty", 3)) {
- strcpy(num, &(buf[3]));
- snp_tty.st_unit = atoi(num);
- snp_tty.st_type = ST_PTY;
- goto got_num;
- }
- if (!strncmp(buf, "sio", 3) || !strncmp(buf, "cua", 3)) {
- strcpy(num, &(buf[3]));
- snp_tty.st_unit = atoi(num);
- snp_tty.st_type = ST_SIO;
- goto got_num;
- }
- fatal("Bad tty name.");
-got_num:
- attach_snp();
-}
-
-void
-ask_dev(dev_name, msg)
- char *dev_name, *msg;
-{
- char buf[DEV_NAME_LEN];
- int len;
-
- clear();
- unset_tty();
-
- if (msg)
- printf("%s\n", msg);
- if (dev_name)
- printf("Enter device name [%s]:", dev_name);
- else
- printf("Enter device name:");
-
- if (fgets(buf, DEV_NAME_LEN - 1, stdin)) {
- len = strlen(buf);
- if (buf[len - 1] == '\n')
- buf[len - 1] = '\0';
- if (buf[0] != '\0' && buf[0] != ' ')
- strcpy(dev_name, buf);
- }
- set_tty();
-}
-
-
-void
-main(ac, av)
- int ac;
- char **av;
-{
- int res, nread, b_size = MIN_SIZE;
- extern int optind;
- char ch, *buf;
- fd_set fd_s;
-
- if (getuid() != 0)
- fatal(NULL);
-
- if (isatty(std_out))
- opt_interactive = 1;
- else
- opt_interactive = 0;
-
-
- while ((ch = getopt(ac, av, "ciot")) != EOF)
- switch (ch) {
- case 'c':
- opt_reconn_close = 1;
- break;
- case 'i':
- opt_interactive = 1;
- break;
- case 'o':
- opt_reconn_oflow = 1;
- break;
- case 't':
- opt_timestamp = 1;
- break;
- case '?':
- default:
- show_usage();
- exit(1);
- }
-
- signal(SIGINT, cleanup);
-
- setup_scr();
- snp_io = open_snp();
-
- if (*(av += optind) == NULL) {
- if (opt_interactive)
- ask_dev(dev_name, MSG_INIT);
- else
- fatal("No device name given.");
- } else
- strncpy(dev_name, *av, DEV_NAME_LEN);
-
- set_dev(dev_name);
-
- if (!(buf = (char *) malloc(b_size)))
- fatal("Cannot malloc().");
-
- FD_ZERO(&fd_s);
-
- while (1) {
- if (opt_interactive)
- FD_SET(std_in, &fd_s);
- FD_SET(snp_io, &fd_s);
- res = select(snp_io + 1, &fd_s, NULL, NULL, NULL);
- if (opt_interactive && FD_ISSET(std_in, &fd_s)) {
- switch (ch = getchar()) {
- case CHR_CLEAR:
- clear();
- break;
- case CHR_SWITCH:
- /* detach_snp(); */
- ask_dev(dev_name, MSG_CHANGE);
- set_dev(dev_name);
- break;
- default:
- }
- }
- if (!FD_ISSET(snp_io, &fd_s))
- continue;
-
- if ((res = ioctl(snp_io, FIONREAD, &nread)) != 0)
- fatal("ioctl() failed.");
-
- switch (nread) {
- case SNP_OFLOW:
- if (opt_reconn_oflow)
- attach_snp();
- else if (opt_interactive) {
- ask_dev(dev_name, MSG_OFLOW);
- set_dev(dev_name);
- } else
- cleanup();
- case SNP_DETACH:
- case SNP_TTYCLOSE:
- if (opt_reconn_close)
- attach_snp();
- else if (opt_interactive) {
- ask_dev(dev_name, MSG_CLOSED);
- set_dev(dev_name);
- } else
- cleanup();
- default:
- if (nread < (b_size / 2) && (b_size / 2) > MIN_SIZE) {
- free(buf);
- if (!(buf = (char *) malloc(b_size / 2)))
- fatal("Cannot malloc()");
- b_size = b_size / 2;
- }
- if (nread > b_size) {
- b_size = (nread % 2) ? (nread + 1) : (nread);
- free(buf);
- if (!(buf = (char *) malloc(b_size)))
- fatal("Cannot malloc()");
- }
- if (read(snp_io, buf, nread) < nread)
- fatal("read failed.");
- if (write(std_out, buf, nread) < nread)
- fatal("write failed.");
- }
- } /* While */
-}
diff --git a/usr.sbin/adduser/adduser b/usr.sbin/adduser/adduser
deleted file mode 100644
index 0980004..0000000
--- a/usr.sbin/adduser/adduser
+++ /dev/null
@@ -1,195 +0,0 @@
-#!/usr/bin/perl
-
-
-
-# Copyright (c) 1994 GB Data Systems
-# All rights reserved.
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. The name of the Author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-# THIS SOFTWARE IS PROVIDED BY GB DATA AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL GB DATA OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-
-#
-# $Id: adduser,v 1.3 1994/12/28 13:49:55 ache Exp $
-#
-
-$configfile = "\/etc\/adduser.conf";
-
-if (-f $configfile) {
- open (CONFIG, "$configfile");
- while (<CONFIG>) {
- eval "$_";
- }
-}
-
-open (WHOAMI, "whoami|");
-
-while (<WHOAMI>) {
-$whoami = $_;
-}
-chop $whoami;
-
-if ($whoami ne "root") {
-system "clear";
-print "\n\nYou must be root to add an user\n\n";
-close WHOAMI;
-exit;
-}
-close WHOAMI;
-
-# Start getting information and print a banner
-
-print " Adduser\n";
-print " A system utility for adding users with defaults\n";
-print "\n\n";
-
-#
-# User ID
-#
-
-
-print "Please enter the login name of the user: ";
-chop ($userlogin = <STDIN>);
-
-
-sub subuid {
-$userid = "";
-print "Please enter the user id or hit enter for the next id: ";
-chop ($userid = <STDIN>);
-}
-
-while (!$userid) {
-&subuid;
-if (!$userid) {
- if ($useautoids) {
- open (USERID, "+<$userids");
- chop ($xxuserid = <USERID>);
- $userid = $xxuserid + 1;
- close USERID;
- open (USERID, "+>$userids");
- print (USERID "$userid\n");
- close USERID;
- } else { &subuid; }
-}
-}
-
-#
-# Group ID
-#
-
-sub groupids {
-print "Please enter the group id or hit enter for the default id: ";
-chop ($groupid = <STDIN>);
-}
-
-&groupids;
-
-while (!$groupid) {
- if ($defgroupid) {
- if (!$groupid) {
- $groupid = "$defgroupid";
- } else { &groupids; }
- } else { &groupids; }
-}
-
-#
-# User name
-#
-
-print "Please enter the user's name: ";
-chop ($username = <STDIN>);
-
-#
-# Home directory
-#
-
-print "Please enter the users home directory or hit enter for default: ";
-chop ($userdir = <STDIN>);
-
-if (!$userdir) {
- $userdir = "$defusrdir\/$userlogin";
- print "$userdir\n";
-}
-
-#
-# Login Shell
-#
-
-print "Please enter the users login shell or hit enter for default: ";
-chop ($usershell = <STDIN>);
-
-if (!$usershell) {
- $usershell = "$userdefshell";
- print "$usershell\n";
-}
-
-#
-# Create password file entry
-#
-
-print "Opening and locking passwd file in blocking mode.\n";
-open (PASS, '>>/etc/master.passwd');
-flock (PASS, 2) || die "Can't lock passwd file, must be in use!!\n";
-print (PASS "$userlogin::$userid:$groupid::0:0:$username,,,:$userdir:$usershell\n");
-print "Unlocking and closing password file\n";
-flock (PASS,8);
-close PASS;
-print "Re-indexing password databases\n";
-system 'pwd_mkdb -p /etc/master.passwd';
-system "passwd $userlogin";
-
-#
-# Create user directory
-#
-print "Creating user directory\n";
-if (! -e $defusrdir) {
- system "mkdir -p $defusrdir\/$userdir";
-} else {
- system "mkdir $userdir";
-}
-
-
-print "Copying user shell files\n";
-system "cp $skel_location\/dot.login $userdir\/\.login";
-system "cp $skel_location\/dot.profile $userdir\/\.profile";
-
-if ($usershell eq "\/bin\/csh" || $usershell eq "\/usr\/local\/bin\/tcsh")
- {
- system "cp $skel_location\/dot.cshrc $userdir\/.cshrc";
- }
-system "chmod -R 664 $userdir";
-system "chown -R $userid.$groupid $userdir";
-
-
-
-#
-# Print out information used in creation of this account
-#
-print "\n\n";
-print "Information used to create this account follows.\n";
-print "\n";
-print "Login Name: $userlogin\n";
-print "UserId: $userid\n";
-print "GroupId: $groupid\n";
-print "UserName: $username\n";
-print "HomeDir: $userdir\n";
-print "Shell: $usershell\n";
-print "\nDONE\n\n";
-
diff --git a/usr.sbin/adduser/adduser.1 b/usr.sbin/adduser/adduser.1
deleted file mode 100644
index 88534d8..0000000
--- a/usr.sbin/adduser/adduser.1
+++ /dev/null
@@ -1,75 +0,0 @@
-
-.\" Copyright (c) 1994 GB Data Systems
-.\" All rights reserved.
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. The name of the Author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
-.\" THIS SOFTWARE IS PROVIDED BY GB DATA AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL GB DATA OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-
-.\" $Id: adduser.1,v 1.2 1994/12/28 07:11:29 gclarkii Exp $
-
-.Dd December 28, 1994
-.Dt ADDUSER 1
-.Os FreeBSD
-
-.Sh NAME
-.Nm adduser
-
-.Sh SYNOPSIS
-.Nm
-
-.Sh DESCRIPTION
-.Nm
-is a Perl script for adding users under a BSD system. It has the ability to
-keep track of the current userid and increment this automaticly. It can
-also use a default group id.
-.Ss SETUP
-In the normal course of usage there is no setup needed. If you wish to use
-auto-increment mode, you must do two things.
-
-.Bl -enum -compact
-.It
-Change the variable in
-.Pa /etc/adduser.conf
-to allow for the auto-increment
-.It
-Change the file
-.Pa /etc/userids
-to show the current id number.
-.El
-
-To use the default group id, just change the variable in
-.Pa /etc/adduser.conf
-to reflect the group that you wish as a default.
-
-.Sh FILES
-.Pa /etc/adduser.conf
-.Pa /etc/userids
-.Pa /usr/share/skel/*
-
-.Sh SEE ALSO
-.Xr adduser 8
-.Xr perl 1
-
-.Sh HISTORY
-The adduser command appeared in FreeBSD 2.0C (12-94).
-
-
-
diff --git a/usr.sbin/adduser/adduser.conf b/usr.sbin/adduser/adduser.conf
deleted file mode 100644
index a5f52dd..0000000
--- a/usr.sbin/adduser/adduser.conf
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# Configuration file for adduser (1)
-#
-# $Id:$
-
-$useautoids = "1"; # Define this if you wish to use auto-increment
-$defgroupid = "20"; # Default ID
-$defusrdir = "\/usr\/u"; # Default User Dir
-$userdefshell = "\/bin\/csh"; # Default user shell
-$skel_location = "\/usr\/share\/skel"; # Location of shell skeletons
-$userids = "\.\/userids"; # Location of 'userids' file
-
diff --git a/usr.sbin/adduser/adduser.sh b/usr.sbin/adduser/adduser.sh
deleted file mode 100644
index 58aac32..0000000
--- a/usr.sbin/adduser/adduser.sh
+++ /dev/null
@@ -1,195 +0,0 @@
-#!/usr/bin/perl
-
-
-
-# Copyright (c) 1994 GB Data Systems
-# All rights reserved.
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. The name of the Author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-# THIS SOFTWARE IS PROVIDED BY GB DATA AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL GB DATA OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-
-#
-# $Id: adduser,v 1.4 1994/12/28 17:27:21 gclarkii Exp $
-#
-
-$configfile = "\/etc\/adduser.conf";
-
-if (-f $configfile) {
- open (CONFIG, "$configfile");
- while (<CONFIG>) {
- eval "$_";
- }
-}
-
-open (WHOAMI, "whoami|");
-
-while (<WHOAMI>) {
-$whoami = $_;
-}
-chop $whoami;
-
-if ($whoami ne "root") {
-system "clear";
-print "\n\nYou must be root to add an user\n\n";
-close WHOAMI;
-exit;
-}
-close WHOAMI;
-
-# Start getting information and print a banner
-
-print " Adduser\n";
-print " A system utility for adding users with defaults\n";
-print "\n\n";
-
-#
-# User ID
-#
-
-
-print "Please enter the login name of the user: ";
-chop ($userlogin = <STDIN>);
-
-
-sub subuid {
-$userid = "";
-print "Please enter the user id or hit enter for the next id: ";
-chop ($userid = <STDIN>);
-}
-
-while (!$userid) {
-&subuid;
-if (!$userid) {
- if ($useautoids) {
- open (USERID, "+<$userids");
- chop ($xxuserid = <USERID>);
- $userid = $xxuserid + 1;
- close USERID;
- open (USERID, "+>$userids");
- print (USERID "$userid\n");
- close USERID;
- } else { &subuid; }
-}
-}
-
-#
-# Group ID
-#
-
-sub groupids {
-print "Please enter the group id or hit enter for the default id: ";
-chop ($groupid = <STDIN>);
-}
-
-&groupids;
-
-while (!$groupid) {
- if ($defgroupid) {
- if (!$groupid) {
- $groupid = "$defgroupid";
- } else { &groupids; }
- } else { &groupids; }
-}
-
-#
-# User name
-#
-
-print "Please enter the user's name: ";
-chop ($username = <STDIN>);
-
-#
-# Home directory
-#
-
-print "Please enter the users home directory or hit enter for default: ";
-chop ($userdir = <STDIN>);
-
-if (!$userdir) {
- $userdir = "$defusrdir\/$userlogin";
- print "$userdir\n";
-}
-
-#
-# Login Shell
-#
-
-print "Please enter the users login shell or hit enter for default: ";
-chop ($usershell = <STDIN>);
-
-if (!$usershell) {
- $usershell = "$userdefshell";
- print "$usershell\n";
-}
-
-#
-# Create password file entry
-#
-
-print "Opening and locking passwd file in blocking mode.\n";
-open (PASS, '>>/etc/master.passwd');
-flock (PASS, 2) || die "Can't lock passwd file, must be in use!!\n";
-print (PASS "$userlogin::$userid:$groupid::0:0:$username,,,:$userdir:$usershell\n");
-print "Unlocking and closing password file\n";
-flock (PASS,8);
-close PASS;
-print "Re-indexing password databases\n";
-system 'pwd_mkdb -p /etc/master.passwd';
-system "passwd $userlogin";
-
-#
-# Create user directory
-#
-print "Creating user directory\n";
-if (! -e $defusrdir) {
- system "mkdir -p $defusrdir\/$userdir";
-} else {
- system "mkdir $userdir";
-}
-
-
-print "Copying user shell files\n";
-system "cp $skel_location\/dot.login $userdir\/\.login";
-system "cp $skel_location\/dot.profile $userdir\/\.profile";
-
-if ($usershell eq "\/bin\/csh" || $usershell eq "\/usr\/local\/bin\/tcsh")
- {
- system "cp $skel_location\/dot.cshrc $userdir\/.cshrc";
- }
-system "chmod -R 664 $userdir";
-system "chown -R $userid.$groupid $userdir";
-
-
-
-#
-# Print out information used in creation of this account
-#
-print "\n\n";
-print "Information used to create this account follows.\n";
-print "\n";
-print "Login Name: $userlogin\n";
-print "UserId: $userid\n";
-print "GroupId: $groupid\n";
-print "UserName: $username\n";
-print "HomeDir: $userdir\n";
-print "Shell: $usershell\n";
-print "\nDONE\n\n";
-
diff --git a/usr.sbin/bootpd/Makefile b/usr.sbin/bootpd/Makefile
deleted file mode 100644
index e661b6b..0000000
--- a/usr.sbin/bootpd/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-# bootpd/Makefile
-# $Id: Makefile,v 1.1.1.1 1994/09/10 14:44:53 csgr Exp $
-
-PROG= bootpd
-#CFLAGS+= -DETC_ETHERS
-CFLAGS+= -DSYSLOG -DDEBUG -DVEND_CMU
-
-
-SRCS= bootpd.c dovend.c readfile.c hash.c dumptab.c \
- lookup.c getif.c hwaddr.c report.c tzone.c rtmsg.c
-
-MAN5= bootptab.5
-MAN8= bootpd.8
-
-.include <bsd.prog.mk>
diff --git a/usr.sbin/bootpd/getether.c b/usr.sbin/bootpd/getether.c
deleted file mode 100644
index 724a376..0000000
--- a/usr.sbin/bootpd/getether.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * getether.c : get the ethernet address of an interface
- *
- * All of this code is quite system-specific. As you may well
- * guess, it took a good bit of detective work to figure out!
- *
- * If you figure out how to do this on another system,
- * please let me know. <gwr@mc.com>
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <ctype.h>
-#include <syslog.h>
-
-#include "report.h"
-#define EALEN 6
-
-#if defined(ultrix) || (defined(__osf__) && defined(__alpha))
-/*
- * This is really easy on Ultrix! Thanks to
- * Harald Lundberg <hl@tekla.fi> for this code.
- *
- * The code here is not specific to the Alpha, but that was the
- * only symbol we could find to identify DEC's version of OSF.
- * (Perhaps we should just define DEC in the Makefile... -gwr)
- */
-
-#include <sys/ioctl.h>
-#include <net/if.h> /* struct ifdevea */
-
-getether(ifname, eap)
- char *ifname, *eap;
-{
- int rc = -1;
- int fd;
- struct ifdevea phys;
- bzero(&phys, sizeof(phys));
- strcpy(phys.ifr_name, ifname);
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
- report(LOG_ERR, "getether: socket(INET,DGRAM) failed");
- return -1;
- }
- if (ioctl(fd, SIOCRPHYSADDR, &phys) < 0) {
- report(LOG_ERR, "getether: ioctl SIOCRPHYSADDR failed");
- } else {
- bcopy(&phys.current_pa[0], eap, EALEN);
- rc = 0;
- }
- close(fd);
- return rc;
-}
-
-#define GETETHER
-#endif /* ultrix|osf1 */
-
-
-#ifdef SUNOS
-
-#include <sys/sockio.h>
-#include <sys/time.h> /* needed by net_if.h */
-#include <net/nit_if.h> /* for NIOCBIND */
-#include <net/if.h> /* for struct ifreq */
-
-getether(ifname, eap)
- char *ifname; /* interface name from ifconfig structure */
- char *eap; /* Ether address (output) */
-{
- int rc = -1;
-
- struct ifreq ifrnit;
- int nit;
-
- bzero((char *) &ifrnit, sizeof(ifrnit));
- strncpy(&ifrnit.ifr_name[0], ifname, IFNAMSIZ);
-
- nit = open("/dev/nit", 0);
- if (nit < 0) {
- report(LOG_ERR, "getether: open /dev/nit: %s",
- get_errmsg());
- return rc;
- }
- do {
- if (ioctl(nit, NIOCBIND, &ifrnit) < 0) {
- report(LOG_ERR, "getether: NIOCBIND on nit");
- break;
- }
- if (ioctl(nit, SIOCGIFADDR, &ifrnit) < 0) {
- report(LOG_ERR, "getether: SIOCGIFADDR on nit");
- break;
- }
- bcopy(&ifrnit.ifr_addr.sa_data[0], eap, EALEN);
- rc = 0;
- } while (0);
- close(nit);
- return rc;
-}
-
-#define GETETHER
-#endif /* SUNOS */
-
-
-#if defined(__FreeBSD__) || defined(__NetBSD__)
-/* Thanks to John Brezak <brezak@ch.hp.com> for this code. */
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/if_types.h>
-
-getether(ifname, eap)
- char *ifname; /* interface name from ifconfig structure */
- char *eap; /* Ether address (output) */
-{
- int fd, rc = -1;
- register int n;
- struct ifreq ibuf[16], ifr;
- struct ifconf ifc;
- register struct ifreq *ifrp, *ifend;
-
- /* Fetch the interface configuration */
- fd = socket(AF_INET, SOCK_DGRAM, 0);
- if (fd < 0) {
- report(LOG_ERR, "getether: socket %s: %s", ifname, get_errmsg());
- return (fd);
- }
- ifc.ifc_len = sizeof(ibuf);
- ifc.ifc_buf = (caddr_t) ibuf;
- if (ioctl(fd, SIOCGIFCONF, (char *) &ifc) < 0 ||
- ifc.ifc_len < sizeof(struct ifreq)) {
- report(LOG_ERR, "getether: SIOCGIFCONF: %s", get_errmsg);
- goto out;
- }
- /* Search interface configuration list for link layer address. */
- ifrp = ibuf;
- ifend = (struct ifreq *) ((char *) ibuf + ifc.ifc_len);
- while (ifrp < ifend) {
- /* Look for interface */
- if (strcmp(ifname, ifrp->ifr_name) == 0 &&
- ifrp->ifr_addr.sa_family == AF_LINK &&
- ((struct sockaddr_dl *) &ifrp->ifr_addr)->sdl_type == IFT_ETHER) {
- bcopy(LLADDR((struct sockaddr_dl *) &ifrp->ifr_addr), eap, EALEN);
- rc = 0;
- break;
- }
- /* Bump interface config pointer */
- n = ifrp->ifr_addr.sa_len + sizeof(ifrp->ifr_name);
- if (n < sizeof(*ifrp))
- n = sizeof(*ifrp);
- ifrp = (struct ifreq *) ((char *) ifrp + n);
- }
-
- out:
- close(fd);
- return (rc);
-}
-
-#define GETETHER
-#endif /* __NetBSD__ */
-
-
-#ifdef SVR4
-/*
- * This is for "Streams TCP/IP" by Lachman Associates.
- * They sure made this cumbersome! -gwr
- */
-
-#include <sys/sockio.h>
-#include <sys/dlpi.h>
-#include <stropts.h>
-#ifndef NULL
-#define NULL 0
-#endif
-
-getether(ifname, eap)
- char *ifname; /* interface name from ifconfig structure */
- char *eap; /* Ether address (output) */
-{
- int rc = -1;
- char devname[32];
- char tmpbuf[sizeof(union DL_primitives) + 16];
- struct strbuf cbuf;
- int fd, flags;
- union DL_primitives *dlp;
- char *enaddr;
- int unit = -1; /* which unit to attach */
-
- sprintf(devname, "/dev/%s", ifname);
- fd = open(devname, 2);
- if (fd < 0) {
- /* Try without the trailing digit. */
- char *p = devname + 5;
- while (isalpha(*p))
- p++;
- if (isdigit(*p)) {
- unit = *p - '0';
- *p = '\0';
- }
- fd = open(devname, 2);
- if (fd < 0) {
- report(LOG_ERR, "getether: open %s: %s",
- devname, get_errmsg());
- return rc;
- }
- }
-#ifdef DL_ATTACH_REQ
- /*
- * If this is a "Style 2" DLPI, then we must "attach" first
- * to tell the driver which unit (board, port) we want.
- * For now, decide this based on the device name.
- * (Should do "info_req" and check dl_provider_style ...)
- */
- if (unit >= 0) {
- memset(tmpbuf, 0, sizeof(tmpbuf));
- dlp = (union DL_primitives *) tmpbuf;
- dlp->dl_primitive = DL_ATTACH_REQ;
- dlp->attach_req.dl_ppa = unit;
- cbuf.buf = tmpbuf;
- cbuf.len = DL_ATTACH_REQ_SIZE;
- if (putmsg(fd, &cbuf, NULL, 0) < 0) {
- report(LOG_ERR, "getether: attach: putmsg: %s", get_errmsg());
- goto out;
- }
- /* Recv the ack. */
- cbuf.buf = tmpbuf;
- cbuf.maxlen = sizeof(tmpbuf);
- flags = 0;
- if (getmsg(fd, &cbuf, NULL, &flags) < 0) {
- report(LOG_ERR, "getether: attach: getmsg: %s", get_errmsg());
- goto out;
- }
- /*
- * Check the type, etc.
- */
- if (dlp->dl_primitive == DL_ERROR_ACK) {
- report(LOG_ERR, "getether: attach: dlpi_errno=%d, unix_errno=%d",
- dlp->error_ack.dl_errno,
- dlp->error_ack.dl_unix_errno);
- goto out;
- }
- if (dlp->dl_primitive != DL_OK_ACK) {
- report(LOG_ERR, "getether: attach: not OK or ERROR");
- goto out;
- }
- } /* unit >= 0 */
-#endif /* DL_ATTACH_REQ */
-
- /*
- * Get the Ethernet address the same way the ARP module
- * does when it is pushed onto a new stream (bind).
- * One should instead be able just do an dl_info_req
- * but many drivers do not supply the hardware address
- * in the response to dl_info_req (they MUST supply it
- * for dl_bind_ack because the ARP module requires it).
- */
- memset(tmpbuf, 0, sizeof(tmpbuf));
- dlp = (union DL_primitives *) tmpbuf;
- dlp->dl_primitive = DL_BIND_REQ;
- dlp->bind_req.dl_sap = 0x8FF; /* XXX - Unused SAP */
- cbuf.buf = tmpbuf;
- cbuf.len = DL_BIND_REQ_SIZE;
- if (putmsg(fd, &cbuf, NULL, 0) < 0) {
- report(LOG_ERR, "getether: bind: putmsg: %s", get_errmsg());
- goto out;
- }
- /* Recv the ack. */
- cbuf.buf = tmpbuf;
- cbuf.maxlen = sizeof(tmpbuf);
- flags = 0;
- if (getmsg(fd, &cbuf, NULL, &flags) < 0) {
- report(LOG_ERR, "getether: bind: getmsg: %s", get_errmsg());
- goto out;
- }
- /*
- * Check the type, etc.
- */
- if (dlp->dl_primitive == DL_ERROR_ACK) {
- report(LOG_ERR, "getether: bind: dlpi_errno=%d, unix_errno=%d",
- dlp->error_ack.dl_errno,
- dlp->error_ack.dl_unix_errno);
- goto out;
- }
- if (dlp->dl_primitive != DL_BIND_ACK) {
- report(LOG_ERR, "getether: bind: not OK or ERROR");
- goto out;
- }
- if (dlp->bind_ack.dl_addr_offset == 0) {
- report(LOG_ERR, "getether: bind: ack has no address");
- goto out;
- }
- if (dlp->bind_ack.dl_addr_length < EALEN) {
- report(LOG_ERR, "getether: bind: ack address truncated");
- goto out;
- }
- /*
- * Copy the Ethernet address out of the message.
- */
- enaddr = tmpbuf + dlp->bind_ack.dl_addr_offset;
- memcpy(eap, enaddr, EALEN);
- rc = 0;
-
- out:
- close(fd);
- return rc;
-}
-
-#define GETETHER
-#endif /* SVR4 */
-
-
-#ifdef linux
-/*
- * This is really easy on Linux! This version (for linux)
- * written by Nigel Metheringham <nigelm@ohm.york.ac.uk>
- *
- * The code is almost identical to the Ultrix code - however
- * the names are different to confuse the innocent :-)
- * Most of this code was stolen from the Ultrix bit above.
- */
-
-#include <sys/ioctl.h>
-#include <net/if.h> /* struct ifreq */
-
-/* In a properly configured system this should be either sys/socketio.h
- or sys/sockios.h, but on my distribution these don't line up correctly */
-#include <linux/sockios.h> /* Needed for IOCTL defs */
-
-getether(ifname, eap)
- char *ifname, *eap;
-{
- int rc = -1;
- int fd;
- struct ifreq phys;
- bzero(&phys, sizeof(phys));
- strcpy(phys.ifr_name, ifname);
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
- report(LOG_ERR, "getether: socket(INET,DGRAM) failed");
- return -1;
- }
- if (ioctl(fd, SIOCGIFHWADDR, &phys) < 0) {
- report(LOG_ERR, "getether: ioctl SIOCGIFHWADDR failed");
- } else {
- bcopy(phys.ifr_hwaddr, eap, EALEN);
- rc = 0;
- }
- close(fd);
- return rc;
-}
-
-#define GETETHER
-#endif /* linux */
-
-
-/* If we don't know how on this system, just return an error. */
-#ifndef GETETHER
-getether(ifname, eap)
- char *ifname, *eap;
-{
- return -1;
-}
-
-#endif /* !GETETHER */
-
-/*
- * Local Variables:
- * tab-width: 4
- * c-indent-level: 4
- * c-argdecl-indent: 4
- * c-continued-statement-offset: 4
- * c-continued-brace-offset: -4
- * c-label-offset: -4
- * c-brace-offset: 0
- * End:
- */
diff --git a/usr.sbin/bootpd/hwaddr.c b/usr.sbin/bootpd/hwaddr.c
deleted file mode 100644
index 840b953..0000000
--- a/usr.sbin/bootpd/hwaddr.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * hwaddr.c - routines that deal with hardware addresses.
- * (i.e. Ethernet)
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-
-#if defined(SUNOS) || defined(SVR4)
-#include <sys/sockio.h>
-#endif
-#ifdef SVR4
-#include <sys/stream.h>
-#include <stropts.h>
-#include <fcntl.h>
-#endif
-
-#include <net/if_arp.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#ifndef NO_UNISTD
-#include <unistd.h>
-#endif
-#include <syslog.h>
-
-#ifndef USE_BFUNCS
-/* Yes, memcpy is OK here (no overlapped copies). */
-#include <memory.h>
-#define bcopy(a,b,c) memcpy(b,a,c)
-#define bzero(p,l) memset(p,0,l)
-#define bcmp(a,b,c) memcmp(a,b,c)
-#endif
-
-/* For BSD 4.4, set arp entry by writing to routing socket */
-#if defined(BSD)
-#if BSD >= 199306
-extern int bsd_arp_set __P((struct in_addr *, char *, int));
-#endif
-#endif
-
-#include "bptypes.h"
-#include "hwaddr.h"
-#include "report.h"
-
-extern int debug;
-
-/*
- * Hardware address lengths (in bytes) and network name based on hardware
- * type code. List in order specified by Assigned Numbers RFC; Array index
- * is hardware type code. Entries marked as zero are unknown to the author
- * at this time. . . .
- */
-
-struct hwinfo hwinfolist[] =
-{
- {0, "Reserved"}, /* Type 0: Reserved (don't use this) */
- {6, "Ethernet"}, /* Type 1: 10Mb Ethernet (48 bits) */
- {1, "3Mb Ethernet"}, /* Type 2: 3Mb Ethernet (8 bits) */
- {0, "AX.25"}, /* Type 3: Amateur Radio AX.25 */
- {1, "ProNET"}, /* Type 4: Proteon ProNET Token Ring */
- {0, "Chaos"}, /* Type 5: Chaos */
- {6, "IEEE 802"}, /* Type 6: IEEE 802 Networks */
- {0, "ARCNET"} /* Type 7: ARCNET */
-};
-int hwinfocnt = sizeof(hwinfolist) / sizeof(hwinfolist[0]);
-
-
-/*
- * Setup the arp cache so that IP address 'ia' will be temporarily
- * bound to hardware address 'ha' of length 'len'.
- */
-void
-setarp(s, ia, ha, len)
- int s; /* socket fd */
- struct in_addr *ia;
- u_char *ha;
- int len;
-{
-#ifdef SIOCSARP
- struct arpreq arpreq; /* Arp request ioctl block */
- struct sockaddr_in *si;
-#ifdef SVR4
- int fd;
- struct strioctl iocb;
-#endif /* SVR4 */
-
- bzero((caddr_t) & arpreq, sizeof(arpreq));
- arpreq.arp_flags = ATF_INUSE | ATF_COM;
-
- /* Set up the protocol address. */
- arpreq.arp_pa.sa_family = AF_INET;
- si = (struct sockaddr_in *) &arpreq.arp_pa;
- si->sin_addr = *ia;
-
- /* Set up the hardware address. */
- bcopy(ha, arpreq.arp_ha.sa_data, len);
-
-#ifdef SVR4
- /*
- * And now the stuff for System V Rel 4.x which does not
- * appear to allow SIOCxxx ioctls on a socket descriptor.
- * Thanks to several people: (all sent the same fix)
- * Barney Wolff <barney@databus.com>,
- * bear@upsys.se (Bj|rn Sj|holm),
- * Michael Kuschke <Michael.Kuschke@Materna.DE>,
- */
- if ((fd=open("/dev/arp", O_RDWR)) < 0) {
- report(LOG_ERR, "open /dev/arp: %s\n", get_errmsg());
- }
- iocb.ic_cmd = SIOCSARP;
- iocb.ic_timout = 0;
- iocb.ic_dp = (char *)&arpreq;
- iocb.ic_len = sizeof(arpreq);
- if (ioctl(fd, I_STR, (caddr_t)&iocb) < 0) {
- report(LOG_ERR, "ioctl I_STR: %s\n", get_errmsg());
- }
- close (fd);
-
-#else /* SVR4 */
- /*
- * On SunOS, the ioctl sometimes returns ENXIO, and it
- * appears to happen when the ARP cache entry you tried
- * to add is already in the cache. (Sigh...)
- * XXX - Should this error simply be ignored? -gwr
- */
- if (ioctl(s, SIOCSARP, (caddr_t) & arpreq) < 0) {
- report(LOG_ERR, "ioctl SIOCSARP: %s", get_errmsg());
- }
-#endif /* SVR4 */
-#else /* SIOCSARP */
-#if defined(BSD) && (BSD >= 199306)
- bsd_arp_set(ia, ha, len);
-#else /* Not BSD 4.4, and SIOCSARP not defined */
- /*
- * Oh well, SIOCSARP is not defined. Just run arp(8).
- * XXX - Gag!
- */
- char buf[256];
- int status;
-
- sprintf(buf, "arp -s %s %s temp",
- inet_ntoa(*ia), haddrtoa(ha, len));
- if (debug > 2)
- report(LOG_INFO, buf);
- status = system(buf);
- if (status)
- report(LOG_ERR, "arp failed, exit code=0x%x", status);
- return;
-#endif /* ! 4.4 BSD */
-#endif /* SIOCSARP */
-}
-
-
-/*
- * Convert a hardware address to an ASCII string.
- */
-char *
-haddrtoa(haddr, hlen)
- u_char *haddr;
- int hlen;
-{
- static char haddrbuf[3 * MAXHADDRLEN + 1];
- char *bufptr;
-
- if (hlen > MAXHADDRLEN)
- hlen = MAXHADDRLEN;
-
- bufptr = haddrbuf;
- while (hlen > 0) {
- sprintf(bufptr, "%02X:", (unsigned) (*haddr++ & 0xFF));
- bufptr += 3;
- hlen--;
- }
- bufptr[-1] = 0;
- return (haddrbuf);
-}
-
-
-/*
- * haddr_conv802()
- * --------------
- *
- * Converts a backwards address to a canonical address and a canonical address
- * to a backwards address.
- *
- * INPUTS:
- * adr_in - pointer to six byte string to convert (unsigned char *)
- * addr_len - how many bytes to convert
- *
- * OUTPUTS:
- * addr_out - The string is updated to contain the converted address.
- *
- * CALLER:
- * many
- *
- * DATA:
- * Uses conv802table to bit-reverse the address bytes.
- */
-
-static u_char conv802table[256] =
-{
- /* 0x00 */ 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0,
- /* 0x08 */ 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
- /* 0x10 */ 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
- /* 0x18 */ 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8,
- /* 0x20 */ 0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4,
- /* 0x28 */ 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
- /* 0x30 */ 0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC,
- /* 0x38 */ 0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC,
- /* 0x40 */ 0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2,
- /* 0x48 */ 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2,
- /* 0x50 */ 0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA,
- /* 0x58 */ 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA,
- /* 0x60 */ 0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6,
- /* 0x68 */ 0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6,
- /* 0x70 */ 0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE,
- /* 0x78 */ 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE,
- /* 0x80 */ 0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1,
- /* 0x88 */ 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1,
- /* 0x90 */ 0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9,
- /* 0x98 */ 0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9,
- /* 0xA0 */ 0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5,
- /* 0xA8 */ 0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5,
- /* 0xB0 */ 0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED,
- /* 0xB8 */ 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD,
- /* 0xC0 */ 0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3,
- /* 0xC8 */ 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3,
- /* 0xD0 */ 0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB,
- /* 0xD8 */ 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB,
- /* 0xE0 */ 0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7,
- /* 0xE8 */ 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
- /* 0xF0 */ 0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF,
- /* 0xF8 */ 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF,
-};
-
-void
-haddr_conv802(addr_in, addr_out, len)
- register u_char *addr_in, *addr_out;
- int len;
-{
- u_char *lim;
-
- lim = addr_out + len;
- while (addr_out < lim)
- *addr_out++ = conv802table[*addr_in++];
-}
-
-#if 0
-/*
- * For the record, here is a program to generate the
- * bit-reverse table above.
- */
-static int
-bitrev(n)
- int n;
-{
- int i, r;
-
- r = 0;
- for (i = 0; i < 8; i++) {
- r <<= 1;
- r |= (n & 1);
- n >>= 1;
- }
- return r;
-}
-
-main()
-{
- int i;
- for (i = 0; i <= 0xFF; i++) {
- if ((i & 7) == 0)
- printf("/* 0x%02X */", i);
- printf(" 0x%02X,", bitrev(i));
- if ((i & 7) == 7)
- printf("\n");
- }
-}
-
-#endif
-
-/*
- * Local Variables:
- * tab-width: 4
- * c-indent-level: 4
- * c-argdecl-indent: 4
- * c-continued-statement-offset: 4
- * c-continued-brace-offset: -4
- * c-label-offset: -4
- * c-brace-offset: 0
- * End:
- */
diff --git a/usr.sbin/bootpd/rtmsg.c b/usr.sbin/bootpd/rtmsg.c
deleted file mode 100644
index 6de6102..0000000
--- a/usr.sbin/bootpd/rtmsg.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (c) 1984, 1993
- * The Regents of the University of California. All rights reserved.
- * Copyright (c) 1994
- * Geoffrey M. Rehmet, All rights reserved.
- *
- * This code is derived from software which forms part of the 4.4-Lite
- * Berkeley software distribution, which was in derived from software
- * contributed to Berkeley by Sun Microsystems, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * from arp.c 8.2 (Berkeley) 1/2/94
- * $Id$
- */
-
-#include <sys/param.h>
-/*
- * Verify that we are at least 4.4 BSD
- */
-#if defined(BSD)
-#if BSD >= 199306
-
-#include <sys/socket.h>
-
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/if_types.h>
-#include <net/route.h>
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-#include <arpa/inet.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <syslog.h>
-#include <unistd.h>
-
-#include "report.h"
-
-
-static int rtmsg __P((int));
-
-static int s = -1; /* routing socket */
-
-
-/*
- * Open the routing socket
- */
-static void getsocket () {
- if (s < 0) {
- s = socket(PF_ROUTE, SOCK_RAW, 0);
- if (s < 0) {
- report(LOG_ERR, "socket %s", strerror(errno));
- exit(1);
- }
- }
-}
-
-static struct sockaddr_in so_mask = {8, 0, 0, { 0xffffffff}};
-static struct sockaddr_inarp blank_sin = {sizeof(blank_sin), AF_INET }, sin_m;
-static struct sockaddr_dl blank_sdl = {sizeof(blank_sdl), AF_LINK }, sdl_m;
-static int expire_time, flags, export_only, doing_proxy;
-static struct {
- struct rt_msghdr m_rtm;
- char m_space[512];
-} m_rtmsg;
-
-/*
- * Set an individual arp entry
- */
-int bsd_arp_set(ia, eaddr, len)
- struct in_addr *ia;
- char *eaddr;
- int len;
-{
- register struct sockaddr_inarp *sin = &sin_m;
- register struct sockaddr_dl *sdl;
- register struct rt_msghdr *rtm = &(m_rtmsg.m_rtm);
- u_char *ea;
- struct timeval time;
-
- getsocket();
- sdl_m = blank_sdl;
- sin_m = blank_sin;
- sin->sin_addr = *ia;
-
- ea = (u_char *)LLADDR(&sdl_m);
- bcopy(eaddr, ea, len);
- sdl_m.sdl_alen = len;
- doing_proxy = flags = export_only = expire_time = 0;
-
- /* make arp entry temporary */
- gettimeofday(&time, 0);
- expire_time = time.tv_sec + 20 * 60;
-
-tryagain:
- if (rtmsg(RTM_GET) < 0) {
- report(LOG_WARNING, "rtmget: %s", strerror(errno));
- return (1);
- }
- sin = (struct sockaddr_inarp *)(rtm + 1);
- sdl = (struct sockaddr_dl *)(sin->sin_len + (char *)sin);
- if (sin->sin_addr.s_addr == sin_m.sin_addr.s_addr) {
- if (sdl->sdl_family == AF_LINK &&
- (rtm->rtm_flags & RTF_LLINFO) &&
- !(rtm->rtm_flags & RTF_GATEWAY)) switch (sdl->sdl_type) {
- case IFT_ETHER: case IFT_FDDI: case IFT_ISO88023:
- case IFT_ISO88024: case IFT_ISO88025:
- goto overwrite;
- }
- if (doing_proxy == 0) {
- report(LOG_WARNING, "set: can only proxy for %s\n",
- inet_ntoa(sin->sin_addr));
- return (1);
- }
- if (sin_m.sin_other & SIN_PROXY) {
- report(LOG_WARNING,
- "set: proxy entry exists for non 802 device\n");
- return(1);
- }
- sin_m.sin_other = SIN_PROXY;
- export_only = 1;
- goto tryagain;
- }
-overwrite:
- if (sdl->sdl_family != AF_LINK) {
- report(LOG_WARNING,
- "cannot intuit interface index and type for %s\n",
- inet_ntoa(sin->sin_addr));
- return (1);
- }
- sdl_m.sdl_type = sdl->sdl_type;
- sdl_m.sdl_index = sdl->sdl_index;
- return (rtmsg(RTM_ADD));
-}
-
-
-static int rtmsg(cmd)
- int cmd;
-{
- static int seq;
- int rlen;
- register struct rt_msghdr *rtm = &m_rtmsg.m_rtm;
- register char *cp = m_rtmsg.m_space;
- register int l;
-
- errno = 0;
- bzero((char *)&m_rtmsg, sizeof(m_rtmsg));
- rtm->rtm_flags = flags;
- rtm->rtm_version = RTM_VERSION;
-
- switch (cmd) {
- default:
- report(LOG_ERR, "set_arp: internal wrong cmd - exiting");
- exit(1);
- case RTM_ADD:
- rtm->rtm_addrs |= RTA_GATEWAY;
- rtm->rtm_rmx.rmx_expire = expire_time;
- rtm->rtm_inits = RTV_EXPIRE;
- rtm->rtm_flags |= (RTF_HOST | RTF_STATIC);
- sin_m.sin_other = 0;
- if (doing_proxy) {
- if (export_only)
- sin_m.sin_other = SIN_PROXY;
- else {
- rtm->rtm_addrs |= RTA_NETMASK;
- rtm->rtm_flags &= ~RTF_HOST;
- }
- }
- /* FALLTHROUGH */
- case RTM_GET:
- rtm->rtm_addrs |= RTA_DST;
- }
-#define NEXTADDR(w, s) \
- if (rtm->rtm_addrs & (w)) { \
- bcopy((char *)&s, cp, sizeof(s)); cp += sizeof(s);}
-
- NEXTADDR(RTA_DST, sin_m);
- NEXTADDR(RTA_GATEWAY, sdl_m);
- NEXTADDR(RTA_NETMASK, so_mask);
-
- rtm->rtm_msglen = cp - (char *)&m_rtmsg;
-
- l = rtm->rtm_msglen;
- rtm->rtm_seq = ++seq;
- rtm->rtm_type = cmd;
- if ((rlen = write(s, (char *)&m_rtmsg, l)) < 0) {
- if ((errno != ESRCH) && !(errno == EEXIST && cmd == RTM_ADD)){
- report(LOG_WARNING, "writing to routing socket: %s",
- strerror(errno));
- return (-1);
- }
- }
- do {
- l = read(s, (char *)&m_rtmsg, sizeof(m_rtmsg));
- } while (l > 0 && (rtm->rtm_seq != seq || rtm->rtm_pid != getpid()));
- if (l < 0)
- report(LOG_WARNING, "arp: read from routing socket: %s\n",
- strerror(errno));
- return (0);
-}
-
-#endif /* BSD */
-#endif /* BSD >= 199306 */
diff --git a/usr.sbin/bootpef/Makefile b/usr.sbin/bootpef/Makefile
deleted file mode 100644
index 4abb5f1..0000000
--- a/usr.sbin/bootpef/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# bootpef/Makefile
-# $Id: Makefile,v 1.2 1994/09/10 15:00:04 csgr Exp $
-
-PROG= bootpef
-SRCDIR= ${.CURDIR}/../bootpd
-#CFLAGS+= -DETC_ETHERS
-CFLAGS+= -DDEBUG -I${SRCDIR}
-.PATH: ${SRCDIR}
-MANSRC= ${SRCDIR}
-
-SRCS= bootpef.c dovend.c readfile.c hash.c dumptab.c \
- lookup.c hwaddr.c report.c rtmsg.c tzone.c
-
-MAN8= bootpef.8
-
-.include <bsd.prog.mk>
-
diff --git a/usr.sbin/bootpgw/Makefile b/usr.sbin/bootpgw/Makefile
deleted file mode 100644
index 6be63f6..0000000
--- a/usr.sbin/bootpgw/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-# bootpgw/Makefile
-# $Id: Makefile,v 1.1.1.1 1994/09/10 14:44:56 csgr Exp $
-
-PROG= bootpgw
-SRCDIR= ${.CURDIR}/../bootpd
-CFLAGS+= -DSYSLOG -DDEBUG -I${SRCDIR}
-.PATH: ${SRCDIR}
-
-SRCS= bootpgw.c getif.c hwaddr.c report.c rtmsg.c
-
-MAN8=
-
-.include <bsd.prog.mk>
-
diff --git a/usr.sbin/bootptest/Makefile b/usr.sbin/bootptest/Makefile
deleted file mode 100644
index 35e9867..0000000
--- a/usr.sbin/bootptest/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-# bootptest/Makefile
-# $Id: Makefile,v 1.3 1994/08/22 22:19:04 gwr Exp $
-
-PROG= bootptest
-SRCDIR= ${.CURDIR}/../bootpd
-CFLAGS+= -I${SRCDIR}
-.PATH: ${SRCDIR}
-MANSRC= ${SRCDIR}
-
-SRCS= bootptest.c print-bootp.c getif.c getether.c report.c
-
-MAN8= bootptest.8
-
-.include <bsd.prog.mk>
-
diff --git a/usr.sbin/dbsym/Makefile b/usr.sbin/dbsym/Makefile
deleted file mode 100644
index e1fbf2c..0000000
--- a/usr.sbin/dbsym/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# $Id$
-
-PROG= dbsym
-NOMAN= noman
-
-.include <bsd.prog.mk>
diff --git a/usr.sbin/dbsym/dbsym.c b/usr.sbin/dbsym/dbsym.c
deleted file mode 100644
index 833627c..0000000
--- a/usr.sbin/dbsym/dbsym.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/* Written by Pace Willisson (pace@blitz.com)
- * and placed in the public domain.
- */
-
-#ifndef lint
-static char rcsid[] = "$Id: dbsym.c,v 1.3 1994/01/19 03:52:25 nate Exp $";
-#endif /* not lint */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <a.out.h>
-#include <stab.h>
-#include <machine/param.h>
-#include <vm/vm_param.h>
-#include <vm/lock.h>
-#include <vm/pmap.h>
-#include <machine/pmap.h>
-#include <machine/vmparam.h>
-
-#define FILE_OFFSET(vadr) (((vadr) - text_adr) - N_DATADDR(hdr) + \
- N_DATOFF(hdr) + N_TXTADDR(hdr))
-
-u_int text_adr = KERNBASE;
-
-struct nlist *old_syms;
-int num_old_syms;
-char *old_strtab;
-int old_strtab_size;
-
-struct nlist *new_syms;
-int num_new_syms;
-int new_syms_bytes;
-char *new_strtab;
-int new_strtab_size;
-
-int db_symtabsize_adr;
-int db_symtab_adr;
-
-int avail;
-
-int force = 0;
-int zap_locals = 0;
-int debugging = 0;
-
-usage ()
-{
- fprintf (stderr, "usage: dbsym [-fgx] [-T addr] file\n");
- exit (1);
-}
-
-struct exec hdr;
-
-main (argc, argv)
-char **argv;
-{
- FILE *f;
- char *name;
- extern int optind;
- int c, i;
- int need;
- char *buf, *p;
- struct nlist *nsp, *sp;
- int len;
-
-
- while ((c = getopt (argc, argv, "fgxT:")) != EOF) {
- switch (c) {
- case 'f':
- force = 1;
- break;
- case 'g':
- debugging = 1;
- break;
- case 'x':
- zap_locals = 1;
- break;
- case 'T':
- text_adr = strtoul(optarg, &p, 16);
- if (*p)
- err("illegal text address: %s", optarg);
- break;
- default:
- usage ();
- }
- }
-
- if (optind >= argc)
- usage ();
-
- name = argv[optind++];
-
- if (optind != argc)
- usage ();
-
- if ((f = fopen (name, "r+")) == NULL) {
- fprintf (stderr, "can't open %s\n", name);
- exit (1);
- }
-
- if (fread ((char *)&hdr, sizeof hdr, 1, f) != 1) {
- fprintf (stderr, "can't read header\n");
- exit (1);
- }
-
- if (N_BADMAG (hdr)) {
- fprintf (stderr, "bad magic number\n");
- exit (1);
- }
-
- if (hdr.a_syms == 0) {
- fprintf (stderr, "no symbols\n");
- exit (1);
- }
-
- fseek (f, N_STROFF (hdr), 0);
- if (fread ((char *)&old_strtab_size, sizeof (int), 1, f) != 1) {
- fprintf (stderr, "can't read old strtab size\n");
- exit (1);
- }
-
- if ((old_syms = (struct nlist *)malloc (hdr.a_syms)) == NULL
- || ((old_strtab = malloc (old_strtab_size)) == NULL)
- || ((new_syms = (struct nlist *)malloc (hdr.a_syms)) == NULL)
- || ((new_strtab = malloc (old_strtab_size)) == NULL)) {
- fprintf (stderr, "out of memory\n");
- exit (1);
- }
-
- fseek (f, N_SYMOFF (hdr), 0);
- if (fread ((char *)old_syms, hdr.a_syms, 1, f) != 1) {
- fprintf (stderr, "can't read symbols\n");
- exit (1);
- }
-
- fseek (f, N_STROFF (hdr), 0);
- if (fread ((char *)old_strtab, old_strtab_size, 1, f) != 1) {
- fprintf (stderr, "can't read string table\n");
- exit (1);
- }
-
- num_old_syms = hdr.a_syms / sizeof (struct nlist);
-
- new_strtab_size = 4;
-
- nsp = new_syms;
- for (i = 0, sp = old_syms; i < num_old_syms; i++, sp++) {
- if (zap_locals && !(sp->n_type & N_EXT))
- continue;
-
- if (sp->n_type & N_STAB)
- switch (sp->n_type & ~N_EXT) {
- case N_SLINE:
- if (debugging)
- *nsp++ = *sp;
- continue;
- case N_FUN:
- case N_PSYM:
- case N_SO:
- if (!debugging)
- continue;
- goto skip_tests;
- break;
- default:
- continue;
- }
-
- if ((sp->n_type & ~N_EXT) == N_UNDF)
- continue;
-
- if (!debugging && (sp->n_type & ~N_EXT) == N_FN)
- continue;
-
- if (sp->n_un.n_strx == 0)
- continue;
-
- if (sp->n_value < text_adr)
- continue;
-
- if (sp->n_value > (text_adr + hdr.a_text + hdr.a_data +
- hdr.a_bss))
- continue;
-
- skip_tests:
-
- name = old_strtab + sp->n_un.n_strx;
-
- len = strlen (name);
-
- if (len == 0)
- continue;
-
- if (strcmp (name, "gcc_compiled.") == 0)
- continue;
-
- if (strcmp (name, "gcc2_compiled.") == 0)
- continue;
-
- if (strcmp (name, "___gnu_compiled_c") == 0)
- continue;
-
- *nsp = *sp;
-
- nsp->n_un.n_strx = new_strtab_size;
- strcpy (new_strtab + new_strtab_size, name);
- new_strtab_size += len + 1;
- nsp++;
-
- if (strcmp (name, "_db_symtab") == 0)
- db_symtab_adr = sp->n_value;
- if (strcmp (name, "_db_symtabsize") == 0)
- db_symtabsize_adr = sp->n_value;
- }
-
- if (db_symtab_adr == 0 || db_symtabsize_adr == 0)
- if (!force) {
- fprintf (stderr, "couldn't find db_symtab symbols\n");
- exit (1);
- } else
- exit (0);
-
- *(int *)new_strtab = new_strtab_size;
- num_new_syms = nsp - new_syms;
- new_syms_bytes = num_new_syms * sizeof (struct nlist);
-
- need = sizeof (int)
- + num_new_syms * sizeof (struct nlist)
- + new_strtab_size;
-
- fseek (f, FILE_OFFSET (db_symtabsize_adr), 0);
-
- if (fread ((char *)&avail, sizeof (int), 1, f) != 1) {
- fprintf (stderr, "can't read symtabsize\n");
- exit (1);
- }
-
- printf ("dbsym: need %d; avail %d\n", need, avail);
-
- if (need > avail) {
- fprintf (stderr, "not enough room in db_symtab array\n");
- exit (1);
- }
-
- fseek (f, FILE_OFFSET (db_symtab_adr), 0);
- fwrite ((char *)&new_syms_bytes, sizeof (int), 1, f);
- fwrite ((char *)new_syms, new_syms_bytes, 1, f);
- fwrite (new_strtab, new_strtab_size, 1, f);
- fflush (f);
-
- if (feof (f) || ferror (f)) {
- fprintf (stderr, "write error\n");
- exit (1);
- }
- exit (0);
-}
-
diff --git a/usr.sbin/named/tools/nsquery/Makefile b/usr.sbin/named/tools/nsquery/Makefile
deleted file mode 100644
index 5263aa1..0000000
--- a/usr.sbin/named/tools/nsquery/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# @(#)Makefile 5.1 (Berkeley) 5/28/90
-
-PROG= nsquery
-NOMAN= noman
-
-.include "../../../Makefile.inc"
-.include <bsd.prog.mk>
diff --git a/usr.sbin/named/tools/nsquery/nsquery.c b/usr.sbin/named/tools/nsquery/nsquery.c
deleted file mode 100644
index c1ac28e..0000000
--- a/usr.sbin/named/tools/nsquery/nsquery.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * ++Copyright++ 1986
- * -
- * Copyright (c) 1986
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * -
- * Portions Copyright (c) 1993 by Digital Equipment Corporation.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies, and that
- * the name of Digital Equipment Corporation not be used in advertising or
- * publicity pertaining to distribution of the document or software without
- * specific, written prior permission.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
- * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- * -
- * --Copyright--
- */
-
-#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1986 Regents of the University of California.\n\
- portions Copyright (c) 1993 Digital Equipment Corporation\n\
- All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)nsquery.c 4.8 (Berkeley) 6/1/90";
-static char rcsid[] = "$Id: nsquery.c,v 1.2 1994/09/22 20:45:28 pst Exp $";
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <arpa/inet.h>
-#include <stdio.h>
-#include <netdb.h>
-#include <resolv.h>
-#include <string.h>
-
-main(argc, argv)
- int argc;
- char **argv;
-{
- extern struct __res_state _res;
- register struct hostent *hp;
- register char *s;
-
- res_init();
-
- if (argc >= 2 && strcmp(argv[1], "-d") == 0) {
- _res.options |= RES_DEBUG;
- argc--;
- argv++;
- }
- if (argc < 2) {
- fprintf(stderr, "usage: nsquery [-d] host [server]\n");
- exit(1);
- }
- if (argc == 3) {
- hp = gethostbyname(argv[2]);
- if (hp == NULL) {
- fprintf(stderr, "nsquery:");
- herror(argv[2]);
- exit(1);
- }
- printf("\nServer:\n");
- printanswer(hp);
- _res.nsaddr.sin_addr = *(struct in_addr *)hp->h_addr;
-#ifdef nsaddr /* struct __res_state includes nscount and nsaddr_list[] */
- _res.nscount = 1;
-#endif
- }
-
- hp = gethostbyname(argv[1]);
- if (hp == NULL) {
- fprintf(stderr, "nsquery: %s: ", argv[1]);
- herror((char *)NULL);
- exit(1);
- }
- printanswer(hp);
- exit(0);
-}
-
-printanswer(hp)
- register struct hostent *hp;
-{
- register char **cp;
-
- printf("Name: %s\n", hp->h_name);
-#if BSD >= 43 || defined(h_addr)
- printf("Addresses:");
- for (cp = hp->h_addr_list; cp && *cp; cp++)
- printf(" %s", inet_ntoa(*(struct in_addr *)(*cp)));
- printf("\n");
-#else
- printf("Address: %s\n", inet_ntoa(*(struct in_addr *)hp->h_addr));
-#endif
- printf("Aliases:");
- for (cp = hp->h_aliases; cp && *cp && **cp; cp++)
- printf(" %s", *cp);
- printf("\n\n");
-}
diff --git a/usr.sbin/named/tools/nstest/Makefile b/usr.sbin/named/tools/nstest/Makefile
deleted file mode 100644
index e976d52..0000000
--- a/usr.sbin/named/tools/nstest/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# @(#)Makefile 5.1 (Berkeley) 5/28/90
-
-PROG= nstest
-NOMAN= noman
-
-.include "../../../Makefile.inc"
-.include <bsd.prog.mk>
diff --git a/usr.sbin/named/tools/nstest/nstest.c b/usr.sbin/named/tools/nstest/nstest.c
deleted file mode 100644
index d40e748..0000000
--- a/usr.sbin/named/tools/nstest/nstest.c
+++ /dev/null
@@ -1,423 +0,0 @@
-/*
- * ++Copyright++ 1986
- * -
- * Copyright (c) 1986
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * -
- * Portions Copyright (c) 1993 by Digital Equipment Corporation.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies, and that
- * the name of Digital Equipment Corporation not be used in advertising or
- * publicity pertaining to distribution of the document or software without
- * specific, written prior permission.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
- * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- * -
- * --Copyright--
- */
-
-#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1986 Regents of the University of California.\n\
- portions Copyright (c) 1993 Digital Equipment Corporation\n\
- All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)nstest.c 4.15 (Berkeley) 3/21/91";
-static char rcsid[] = "$Id: nstest.c,v 1.2 1994/09/22 20:45:31 pst Exp $";
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-#include <stdio.h>
-#include <resolv.h>
-
-char *progname;
-FILE *log;
-#define MAXDATA 256 /* really should get this from named/db.h */
-main(argc, argv)
- char **argv;
-{
- register char *cp;
- register u_char *ucp;
- struct hostent *hp;
- u_short port = htons(NAMESERVER_PORT);
- char buf[BUFSIZ];
- u_char packet[PACKETSZ], answer[8*1024], OldRRData[MAXDATA];
- struct rrec NewRR;
- u_int32_t l;
- int n, dump_packet;
-
- NewRR.r_data = (char *) malloc(MAXDATA);
- NewRR.r_data = (char *) malloc(MAXDATA);
- progname = argv[0];
- dump_packet = 0;
- _res.options |= RES_DEBUG|RES_RECURSE;
- (void) res_init();
- while (argc > 1 && argv[1][0] == '-') {
- argc--;
- cp = *++argv;
- while (*++cp)
- switch (*cp) {
- case 'p':
- if (--argc <= 0)
- usage();
- port = htons(atoi(*++argv));
- break;
-
- case 'i':
- _res.options |= RES_IGNTC;
- break;
-
- case 'v':
- _res.options |= RES_USEVC|RES_STAYOPEN;
- break;
-
- case 'r':
- _res.options &= ~RES_RECURSE;
- break;
-
- case 'd':
- dump_packet++;
- break;
-
- default:
- usage();
- }
- }
- _res.nsaddr.sin_family = AF_INET;
- _res.nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
- _res.nsaddr.sin_port = port;
- if (argc > 1) {
- if (!inet_aton(argv[1],
- (struct in_addr *)&_res.nsaddr.sin_addr))
- usage();
- }
- if (argc > 2) {
- log = fopen(argv[2],"w");
- if (log == NULL) perror(argv[2]);
- }
- for (;;) {
- printf("> ");
- fflush(stdout);
- if ((cp = fgets(buf, sizeof buf, stdin)) == NULL)
- break;
- switch (*cp++) {
- case 'a':
- n = res_mkquery(QUERY, cp, C_IN, T_A, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case 'A':
- n = ntohl(inet_addr(cp));
- putlong((u_int32_t)n, (u_char*)cp);
- n = res_mkquery(IQUERY, "", C_IN, T_A, (u_char *)cp,
- INT32SZ, NULL,
- packet, sizeof(packet));
- break;
-
- case 'f':
- n = res_mkquery(QUERY, cp, C_ANY, T_UINFO, NULL,
- 0, NULL, packet, sizeof packet);
- break;
-
- case 'F':
- n = res_mkquery(QUERY, cp, C_IN, T_AFSDB, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case 'g':
- n = res_mkquery(QUERY, cp, C_ANY, T_GID, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case 'G':
- *(int *)cp = htonl(atoi(cp));
- n = res_mkquery(IQUERY, "", C_ANY, T_GID, (u_char *)cp,
- sizeof(int), NULL, packet, sizeof packet);
- break;
-
- case 'c':
- n = res_mkquery(QUERY, cp, C_IN, T_CNAME, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case 'h':
- n = res_mkquery(QUERY, cp, C_IN, T_HINFO, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case 'm':
- n = res_mkquery(QUERY, cp, C_IN, T_MX, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case 'M':
- n = res_mkquery(QUERY, cp, C_IN, T_MAILB, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case 'n':
- n = res_mkquery(QUERY, cp, C_IN, T_NS, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case 'p':
- n = res_mkquery(QUERY, cp, C_IN, T_PTR, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case 's':
- n = res_mkquery(QUERY, cp, C_IN, T_SOA, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case 'T':
- n = res_mkquery(QUERY, cp, C_IN, T_TXT, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case 'u':
- n = res_mkquery(QUERY, cp, C_ANY, T_UID, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case 'U':
- *(int *)cp = htonl(atoi(cp));
- n = res_mkquery(IQUERY, "", C_ANY, T_UID, (u_char *)cp,
- sizeof(int), NULL,
- packet, sizeof packet);
- break;
-
- case 'x':
- n = res_mkquery(QUERY, cp, C_IN, T_AXFR, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case 'w':
- n = res_mkquery(QUERY, cp, C_IN, T_WKS, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case 'b':
- n = res_mkquery(QUERY, cp, C_IN, T_MB, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case 'B':
- n = res_mkquery(QUERY, cp, C_IN, T_MG, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case 'i':
- n = res_mkquery(QUERY, cp, C_IN, T_MINFO, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case 'r':
- n = res_mkquery(QUERY, cp, C_IN, T_MR, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
- case '*':
- n = res_mkquery(QUERY, cp, C_IN, T_ANY, NULL, 0,
- NULL, packet, sizeof packet);
- break;
-
-#ifdef ALLOW_UPDATES
- case '^':
- {
- char IType[10], TempStr[50];
- int Type, oldnbytes, nbytes, i;
-#ifdef ALLOW_T_UNSPEC
- printf("Data type (a = T_A, u = T_UNSPEC): ");
- gets(IType);
- if (IType[0] == 'u') {
- Type = T_UNSPEC;
- printf("How many data bytes? ");
- gets(TempStr); /* Throw away CR */
- sscanf(TempStr, "%d", &nbytes);
- for (i = 0; i < nbytes; i++) {
- (NewRR.r_data)[i] = (char) i;
- }
- } else {
-#endif /* ALLOW_T_UNSPEC */
- Type = T_A;
- nbytes = INT32SZ;
- printf(
- "Inet addr for new dname (e.g., 192.4.3.2): "
- );
- gets(TempStr);
- putlong(ntohl(inet_addr(TempStr)),
- NewRR.r_data);
-#ifdef ALLOW_T_UNSPEC
- }
-#endif
- NewRR.r_class = C_IN;
- NewRR.r_type = Type;
- NewRR.r_size = nbytes;
- NewRR.r_ttl = 99999999;
- printf("Add, modify, or modify all (a/m/M)? ");
- gets(TempStr);
- if (TempStr[0] == 'a') {
- n = res_mkquery(UPDATEA, cp, C_IN, Type,
- OldRRData, nbytes,
- &NewRR, packet,
- sizeof packet);
- } else {
- if (TempStr[0] == 'm') {
- printf("How many data bytes in old RR? ");
- gets(TempStr); /* Throw away CR */
- sscanf(TempStr, "%d", &oldnbytes);
- for (i = 0; i < oldnbytes; i++) {
- OldRRData[i] = (char) i;
- }
- n = res_mkquery(UPDATEM, cp,
- C_IN, Type,
- OldRRData, oldnbytes,
- &NewRR, packet,
- sizeof packet);
- } else { /* Modify all */
- n = res_mkquery(UPDATEMA, cp,
- C_IN, Type, NULL, 0,
- &NewRR, packet,
- sizeof packet);
-
- }
- }
- }
- break;
-
-#ifdef ALLOW_T_UNSPEC
- case 'D':
- n = res_mkquery(UPDATEDA, cp, C_IN, T_UNSPEC,
- (char *)0, 0, NULL,
- packet, sizeof packet);
- break;
-
- case 'd':
- {
- char TempStr[100];
- int nbytes, i;
- printf("How many data bytes in oldrr data? ");
- gets(TempStr); /* Throw away CR */
- sscanf(TempStr, "%d", &nbytes);
- for (i = 0; i < nbytes; i++) {
- OldRRData[i] = (char) i;
- }
- n = res_mkquery(UPDATED, cp, C_IN, T_UNSPEC,
- OldRRData, nbytes, NULL,
- packet, sizeof packet);
- }
- break;
-#endif /* ALLOW_T_UNSPEC */
-#endif /* ALLOW_UPDATES */
-
- default:
- printf("a{host} - query T_A\n");
- printf("A{addr} - iquery T_A\n");
- printf("b{user} - query T_MB\n");
- printf("B{user} - query T_MG\n");
- printf("f{host} - query T_UINFO\n");
- printf("g{host} - query T_GID\n");
- printf("G{gid} - iquery T_GID\n");
- printf("h{host} - query T_HINFO\n");
- printf("i{host} - query T_MINFO\n");
- printf("p{host} - query T_PTR\n");
- printf("m{host} - query T_MX\n");
- printf("M{host} - query T_MAILB\n");
- printf("n{host} - query T_NS\n");
- printf("r{host} - query T_MR\n");
- printf("s{host} - query T_SOA\n");
- printf("T{host} - query T_TXT\n");
- printf("u{host} - query T_UID\n");
- printf("U{uid} - iquery T_UID\n");
- printf("x{host} - query T_AXFR\n");
- printf("w{host} - query T_WKS\n");
- printf("F{host} - query T_AFSDB\n");
- printf("c{host} - query T_CNAME\n");
- printf("*{host} - query T_ANY\n");
-#ifdef ALLOW_UPDATES
- printf("^{host} - add/mod/moda (T_A/T_UNSPEC)\n");
-#ifdef ALLOW_T_UNSPEC
- printf("D{host} - deletea T_UNSPEC\n");
- printf("d{host} - delete T_UNSPEC\n");
-#endif /* ALLOW_T_UNSPEC */
-#endif /* ALLOW_UPDATES */
- continue;
- }
- if (n < 0) {
- printf("res_mkquery: buffer too small\n");
- continue;
- }
- if (log) {
- fprintf(log,"SEND QUERY\n");
- fp_query(packet, log);
- }
- n = res_send(packet, n, answer, sizeof(answer));
- if (n < 0) {
- printf("res_send: send error\n");
- if (log) fprintf(log, "res_send: send error\n");
- }
- else {
- if (dump_packet) {
- int f;
- f = creat("ns_packet.dump", 0644);
- write(f, answer, n);
- (void) close(f);
- }
- if (log) {
- fprintf(log, "GOT ANSWER\n");
- fp_query(answer, log);
- }
- }
- }
-}
-
-usage()
-{
- fprintf(stderr, "Usage: %s [-v] [-i] [-r] [-d] [-p port] hostaddr\n",
- progname);
- exit(1);
-}
diff --git a/usr.sbin/pkg_install/+COMMENT b/usr.sbin/pkg_install/+COMMENT
deleted file mode 100644
index d29a496..0000000
--- a/usr.sbin/pkg_install/+COMMENT
+++ /dev/null
@@ -1 +0,0 @@
-Package install (source), version 0.5 \ No newline at end of file
diff --git a/usr.sbin/pkg_install/+CONTENTS b/usr.sbin/pkg_install/+CONTENTS
deleted file mode 100644
index ff4d7d9..0000000
--- a/usr.sbin/pkg_install/+CONTENTS
+++ /dev/null
@@ -1,2 +0,0 @@
-@cwd /usr/ports
-pkg_install
diff --git a/usr.sbin/pkg_install/+DESC b/usr.sbin/pkg_install/+DESC
deleted file mode 100644
index dd42917..0000000
--- a/usr.sbin/pkg_install/+DESC
+++ /dev/null
@@ -1,5 +0,0 @@
-This is the pkg_install suite of tools for doing maintainance of
-software "packages". More documentation is available in the man pages
-for each individual command.
-
-This is pkg_install version 0.5.
diff --git a/usr.sbin/pkg_install/pkg b/usr.sbin/pkg_install/pkg
deleted file mode 100755
index f3e53c9..0000000
--- a/usr.sbin/pkg_install/pkg
+++ /dev/null
@@ -1,158 +0,0 @@
-#!/usr/local/bin/wish -f
-#$Id: pkg,v 1.6 1993/09/03 23:37:22 rich Exp $
-#
-#$Log: pkg,v $
-# Revision 1.6 1993/09/03 23:37:22 rich
-# warn user if no tar archives are found in the current directory.
-# removed the revision string from the lower text frame.
-#
-# Revision 1.5 1993/09/03 15:48:04 rich
-# glob for .tar.gz, .tar.z and .tar.Z looking for archives
-#
-# Revision 1.4 1993/08/28 15:53:59 rich
-# added version and date info to lower text window.
-#
-# Revision 1.3 1993/08/28 15:47:12 rich
-# filtered out ^Ls in pkg_* output.
-#
-#
-set pkgname ""
-wm title . "Package Installation"
-#--------------------------------------------------------------
-# The top level main window, consisting of a bar of buttons and a list
-# of packages and a description of the current package.
-#--------------------------------------------------------------
-frame .menu -relief raised -borderwidth 1
-frame .frame -borderwidth 4
-
-scrollbar .frame.scroll -relief sunken -command ".frame.list yview"
-listbox .frame.list -yscroll ".frame.scroll set" -relief sunken -setgrid 1
-pack append .frame .frame.scroll {right filly} \
- .frame.list {left expand fill}
-
-# build the lower window shoing the complete description of a pacage
-frame .f -borderwidth 4
-text .f.t -width 80 -height 20 -yscrollcommand ".f.s set" -relief sunken
-
-# Initially display instructions in this window. Erase the
-# instructions and show the package description when the user clicks
-# on a package.
-#
-.f.t insert end "Double click on a package above to see it's
-complete description here."
-scrollbar .f.s -relief sunken -command ".f.t yview"
-pack append .f .f.s {right filly} .f.t {left expand fill}
-
-bind .frame.list <Double-Button-1> \
- {foreach i [selection get] {do_description $i}}
-pack append . .menu {top fill} \
- .f {bottom expand fill} \
- .frame {bottom expand fill}
-
-#----------------------------------------------------------------
-# Make menu bar:
-#----------------------------------------------------------------
-button .menu.inst -text "Install" \
- -command "apply_to_pkg \"pkg_add -v\""
-button .menu.dein -text "Deinstall" \
- -command "apply_to_pkg \"pkg_delete -v\""
-button .menu.installed -text "What is Installed?" \
- -command "list_pkgs \"pkg_info -I -a |tr ' ' ' '\""
-button .menu.available -text "What can I install?" \
- -command "list_pkgs \"pkg_info -I -c [glob -nocomplain *.{tgz,tar.z,tar.gz,tar.Z}] |tr ' ' ' '\""
-button .menu.cont -text "Contents?" \
- -command "global pkgname; apply_to_pkg \"pkg_info -d -v |tr -d ' '\""
-button .menu.quit -text "Quit" -command "destroy ."
-button .menu.help -text "Help" -command "do_help"
-
-pack append .menu \
- .menu.inst left \
- .menu.dein left \
- .menu.installed left \
- .menu.available left \
- .menu.cont left \
- .menu.quit left \
- .menu.help right
-#-------------------------------------------------------
-# Display the package description.
-#-------------------------------------------------------
-proc list_pkgs {s} {
- set line ""
- set f [eval "open {| csh -c \"$s\" } r"]
- .frame.list delete 0 end
- while {[gets $f line] > 0} {
- .frame.list insert end $line
- }
- close $f
-}
-
-# display the list of available packages
-set archives [glob -nocomplain *.{tgz,tar.z,tar.gz,tar.Z}]
-if {$pkgname == ""} {
- .frame.list delete 0 end
- .frame.list insert end "Warning: no compressed tar archives files found."
-} else {
- list_pkgs "pkg_info -I -c $archives |tr ' ' ' '"
-}
-
-#-------------------------------------------------------
-# Display the package description.
-#-------------------------------------------------------
-proc do_description {s} {
- global pkgname
- regexp {[^ ]*} $s filename
- set pkgname $filename
- .f.t delete 0.0 end
- set cmd "pkg_info -d $filename |tr -d ' '"
- set f [eval "open {| csh -c \"$cmd\" } r"]
- while {![eof $f]} {
- .f.t insert end [read $f]
- }
-}
-#-------------------------------------------------------
-# package install window.
-#-------------------------------------------------------
-proc do_help {{w .help}} {
- catch {destroy $w}
- toplevel $w
- wm title $w "Help"
- wm iconname $w "Help"
- button $w.ok -text OK -command "destroy $w"
- message $w.t -relief raised -bd 2 \
- -text "You can install, deinstall and list info on the available packages. To select a package and see it's complete description, press mouse button 1 over the package name. To install a selected package, press the Install button. To exit, press the \"Quit\" button."
- pack append $w $w.ok {bottom fillx} $w.t {expand fill}
-}
-#-------------------------------------------------------
-# Apply a command to a package.
-#-------------------------------------------------------
-proc apply_to_pkg {s} {
- global pkgname
- .f.t delete 0.0 end
- if {$pkgname == ""} {
- .f.t insert end "You must double click on a package name first!"
- } else {
- .f.t delete 0.0 end
- .f.t insert end "Running: $s $pkgname\n"
- set f [eval "open {| $s $pkgname} r"]
- while {![eof $f]} {
- .f.t insert end [read $f 64]
- }
- }
-}
-#-------------------------------------------------------
-# Invoke an arbitrary command.
-#-------------------------------------------------------
-proc do_command {s} {
- .f.t delete 0.0 end
- .f.t insert end "Running: $s\n"
- set f [eval "open {| $s} r"]
- while {![eof $f]} {
- .f.t insert end [read $f 64]
- }
-}
-# local variables:
-# mode: csh
-# compile-command: ""
-# comment-start: "# "
-# comment-start-skip: "# "
-# end:
diff --git a/usr.sbin/rarpd/ether_addr.c b/usr.sbin/rarpd/ether_addr.c
deleted file mode 100644
index 7404c81..0000000
--- a/usr.sbin/rarpd/ether_addr.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * ethernet address conversion and lookup routines
- *
- * Written by Bill Paul <wpaul@ctr.columbia.edu>
- * Center for Telecommunications Research
- * Columbia University, New York City
- *
- * This code is public domain. There is no copyright. There are no
- * distribution or usage restrictions. There are no strings attached.
- *
- * Have a party.
- *
- * $Id: ether_addr.c,v 1.4 1995/03/05 22:03:58 wpaul Exp $
- */
-
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <string.h>
-#include <sys/param.h>
-
-#ifndef _PATH_ETHERS
-#define _PATH_ETHERS "/etc/ethers"
-#endif
-
-/*
- * This should be defined in <netinet/if_ether.h> but it isn't.
- */
-struct ether_addr {
- unsigned char octet[6];
-};
-
-extern int yp_get_default_domain();
-extern int yp_match();
-char *yp_domain;
-
-/*
- * Parse a string of text containing an ethernet address and hostname
- * and separate it into its component parts.
- */
-int ether_line(l, e, hostname)
- char *l;
- struct ether_addr *e;
- char *hostname;
-{
- int i, o[6];
-
- i = sscanf(l, "%x:%x:%x:%x:%x:%x %s", &o[0], &o[1], &o[2],
- &o[3], &o[4], &o[5],
- hostname);
- if (i != 7)
- return (i);
-
- for (i=0; i<6; i++)
- e->octet[i] = o[i];
- return (0);
-}
-
-/*
- * Convert an ASCII representation of an ethernet address to
- * binary form.
- */
-struct ether_addr *ether_aton(a)
- char *a;
-{
- int i;
- static struct ether_addr o;
-
- i = sscanf(a, "%x:%x:%x:%x:%x:%x", o.octet[0], o.octet[1], o.octet[2],
- o.octet[3], o.octet[4], o.octet[5]);
- if (i != 6)
- return (NULL);
- return ((struct ether_addr *)&o);
-}
-
-/*
- * Convert a binary representation of an ethernet address to
- * an ASCII string.
- */
-char *ether_ntoa(n)
- struct ether_addr *n;
-{
- int i;
- static char a[18];
-
- i = sprintf(a,"%x:%x:%x:%x:%x:%x",n->octet[0],n->octet[1],n->octet[2],
- n->octet[3],n->octet[4],n->octet[5]);
- if (i < 11)
- return (NULL);
- return ((char *)&a);
-}
-
-/*
- * Map an ethernet address to a hostname. Use either /etc/ethers or
- * NIS/YP.
- */
-
-int ether_ntohost(hostname, e)
- char *hostname;
- struct ether_addr *e;
-{
- FILE *fp;
- char buf[BUFSIZ];
- struct ether_addr local_ether;
- char local_host[MAXHOSTNAMELEN];
- char *result;
- int resultlen;
- char *ether_a;
-
- if ((fp = fopen(_PATH_ETHERS, "r")) == NULL)
- return (1);
-
- while (fgets(buf,BUFSIZ,fp)) {
- if (buf[0] == '#')
- continue;
- if (buf[0] == '+') {
- fclose(fp); /* Can ignore /etc/ethers from here on. */
- if (yp_get_default_domain(&yp_domain))
- return(1);
- ether_a = ether_ntoa(e);
- if (yp_match(yp_domain, "ethers.byaddr", ether_a,
- strlen(ether_a), &result, &resultlen)) {
- free(result);
- return(1);
- }
- if (!ether_line(result, &local_ether, &local_host)) {
- strcpy(hostname, (char *)&local_host);
- free(result);
- return(0);
- } else {
- free(result);
- return(1);
- }
- }
- if (!ether_line(&buf, &local_ether, &local_host)) {
- if (!bcmp((char *)&local_ether.octet[0],
- (char *)&e->octet[0], 6)) {
- /* We have a match */
- strcpy(hostname, (char *)&local_host);
- fclose(fp);
- return(0);
- }
- }
- }
-fclose(fp);
-return (1);
-}
-
-/*
- * Map a hostname to an ethernet address using /etc/ethers or
- * NIS/YP.
- */
-int ether_hostton(hostname, e)
- char *hostname;
- struct ether_addr *e;
-{
- FILE *fp;
- char buf[BUFSIZ];
- struct ether_addr local_ether;
- char local_host[MAXHOSTNAMELEN];
- char *result;
- int resultlen;
-
- if ((fp = fopen(_PATH_ETHERS, "r")) == NULL)
- return (1);
-
- while (fgets(buf,BUFSIZ,fp)) {
- if (buf[0] == '#')
- continue;
- if (buf[0] == '+') {
- fclose(fp); /* Can ignore /etc/ethers from here on. */
- if (yp_get_default_domain(&yp_domain))
- return(1);
- if (yp_match(yp_domain, "ethers.byname", hostname,
- strlen(hostname), &result, &resultlen)) {
- free(result);
- return(1);
- }
- if (!ether_line(result, &local_ether, &local_host)) {
- bcopy((char *)&local_ether.octet[0],
- (char *)&e->octet[0], 6);
- free(result);
- return(0);
- } else {
- free(result);
- return(1);
- }
- }
- if (!ether_line(&buf, &local_ether, &local_host)) {
- if (!strcmp(hostname, (char *)&local_host)) {
- /* We have a match */
- bcopy((char *)&local_ether.octet[0],
- (char *)&e->octet[0], 6);
- fclose(fp);
- return(0);
- }
- }
- }
-fclose(fp);
-return (1);
-}
diff --git a/usr.sbin/rtprio/rtprio.2 b/usr.sbin/rtprio/rtprio.2
deleted file mode 100644
index 2c1b4c7..0000000
--- a/usr.sbin/rtprio/rtprio.2
+++ /dev/null
@@ -1,106 +0,0 @@
-.\" Copyright (c) 1994, Henrik Vestergaard Draboel
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce 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 Henrik Vestergaard Draboel.
-.\" 4. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $Id: rtprio.2,v 1.2 1994/09/01 12:09:17 davidg Exp $
-.\"
-.Dd July 23, 1994
-.Dt RTPRIO 2
-.Sh NAME
-.Nm rtprio
-.Nd examine or modify a process realtime or idle priority
-.Sh SYNOPSIS
-.Fd #include <sys/resource.h>
-.Fd #include <sys/rtprio.h>
-.Ft int
-.Fn rtprio "function" "pid_t pid" "struct rtprio *rtp"
-.Sh DESCRIPTION
-.Fn rtprio
-is used to lookup or change the realtime or idle priority of a process.
-
-.Fa function
-specifies the operation to be performed. RTP_LOOKUP to lookup the current priority,
-and RTP_SET to set the priority.
-.Fa pid
-specifies the process to be used, 0 for the current process.
-
-.Fa *rtp
-is a pointer to a struct rtprio which is used to specify the priority and priority type.
-This structure has the following form:
-.Bd -literal
-struct rtprio {
- u_short type;
- u_short prio;
-};
-.Ed
-.Pp
-The value of the
-.Nm type
-field may be RTP_PRIO_REALTIME for realtime priorities,
-RTP_PRIO_NORMAL for normal priorities, and RTP_PRIO_IDLE for idle priorities.
-The priority specified by the
-.Nm prio
-field ranges between 0 and
-.Dv RTP_PRIO_MAX (usually 31) .
-0 is the highest possible priority.
-
-Realtime and idle priority is inherited through fork() and exec().
-
-A realtime process can only be preempted by a process of equal or
-higher priority, or by an interrupt; idle priority processes will run only
-when no other real/normal priority process is runnable. Higher real/idle priority processes
-preempt lower real/idle priority processes. Processes of equal real/idle priority are run round-robin.
-.Sh RETURN VALUES
-.Fn rtprio
-will return 0 for success and -1 for all errors. The global variable
-.Va errno
-will be set to indicate the error.
-.Sh ERRORS
-.Fn rtprio
-will fail if
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The specified
-.Fa prio
-was out of range.
-.It Bq Er EPERM
-The calling process is not allowed to set the realtime priority. Only
-root is allowed to change the realtime priority of any process, and non-root
-may only change the idle priority of the current process.
-.It Bq Er ESRCH
-The specified process was not found.
-.Sh AUTHOR
-The original author was Henrik Vestergaard Draboel - hvd@terry.ping.dk. This
-implementation in FreeBSD was substantially rewritten by David Greenman.
-.Sh SEE ALSO
-.Xr rtprio 1 ,
-.Xr nice 1 ,
-.Xr ps 1 ,
-.Xr nice 2 ,
-.Xr renice 8
-
diff --git a/usr.sbin/swapinfo/Makefile b/usr.sbin/swapinfo/Makefile
deleted file mode 100644
index fb02166..0000000
--- a/usr.sbin/swapinfo/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# @(#)Makefile 5.5 (Berkeley) 4/23/91
-
-PROG= swapinfo
-SRCS= swapinfo.c
-.PATH: ${.CURDIR}/../../bin/df
-
-DPADD= ${LIBMATH} ${LIBUTIL}
-LDADD= -lm -lkvm
-BINGRP= kmem
-BINMODE=2555
-
-.include <bsd.prog.mk>
diff --git a/usr.sbin/swapinfo/README b/usr.sbin/swapinfo/README
deleted file mode 100644
index f8019a8..0000000
--- a/usr.sbin/swapinfo/README
+++ /dev/null
@@ -1,38 +0,0 @@
-swapinfo
-========
-
-Swapinfo is designed to provide some information to the user about the
-state of the swap space on the system. I've written it based on a
-brief (!) perusal of the VM code in 386BSD. I could be pretty confused
-about how it all fits together, and perhaps this is totally bogus.
-It seems to work for me, though.
-
-How it works:
-
-During startup, the system traverses the list of configured swap partitions,
-and determines the size of the various partitions. As each new partition
-is added for swapping (via swapon), the free space on that disk is added
-to a linked list of free space. Adjacent areas are coalesced to form
-larger areas. The swapping algorithm seems to take the first free section
-that it finds [?].
-
-Swapinfo reads in the list of configured swap partitions from the /dev/kmem,
-to determine the size of the partitions. It then traverses the list
-of free space, figuring up how much is still available and how much
-has therefore been used. Things get a little hairy in that the swap space
-is divided amongst the configured swap partitions so that the first
-4096 blocks of swap go on the first swap partition, the second 4096 on
-the second swap partition, and so on. This works out to be a fairly
-simple bit of code, though.
-
-More caveats:
-
-This works on my system. Your milage may vary. Since I'm reading /dev/kmem
-to follow a linked list, the program could easily get lost looking for
-some free space if anything got changed between reads of /dev/kmem.
-If you get occasional inconsistant results, ignore 'em.
-
-Feel free to send bug reports, flames, etc., to:
-
-Kevin Lahey
-kml@rokkaku.atl.ga.us
diff --git a/usr.sbin/swapinfo/devname.c b/usr.sbin/swapinfo/devname.c
deleted file mode 100644
index 5f2815d..0000000
--- a/usr.sbin/swapinfo/devname.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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[] = "@(#)devname.c 5.14 (Berkeley) 5/6/91";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <db.h>
-#include <stdio.h>
-#include <paths.h>
-
-char *
-devname(dev, type)
- dev_t dev;
- mode_t type;
-{
- struct {
- mode_t type;
- dev_t dev;
- } bkey;
- static DB *db;
- static int failure;
- DBT data, key;
-
- if (!db && !failure &&
- !(db = dbopen(_PATH_DEVDB, O_RDONLY, 0, DB_HASH, NULL))) {
- (void)fprintf(stderr,
- "warning: no device database %s\n", _PATH_DEVDB);
- failure = 1;
- }
- if (failure)
- return("??");
-
- /*
- * Keys are a mode_t followed by a dev_t. The former is the type of
- * the file (mode & S_IFMT), the latter is the st_rdev field.
- */
- bkey.dev = dev;
- bkey.type = type;
- key.data = &bkey;
- key.size = sizeof(bkey);
- return((db->get)(db, &key, &data, 0L) ? "??" : (char *)data.data);
-}
diff --git a/usr.sbin/swapinfo/swapinfo.1 b/usr.sbin/swapinfo/swapinfo.1
deleted file mode 100644
index 54e89c5..0000000
--- a/usr.sbin/swapinfo/swapinfo.1
+++ /dev/null
@@ -1,53 +0,0 @@
-.\"
-.\" swapinfo
-.\"
-.Dd February 23, 1993
-.Dt SWAPINFO 1
-.Sh NAME
-.Nm swapinfo
-.Nd display free swap space
-.Sh SYNOPSIS
-.Nm swapinfo
-.Op Fl k
-.Sh DESCRIPTION
-.Nm Swapinfo
-displays statistics about the amount of free swap space on all of the
-swap areas compiled into the kernel.
-.Pp
-The following options are available:
-.Bl -tag -width Ds
-.It Fl k
-By default, all sizes are reported in 512-byte block counts.
-The
-.Fl k
-option causes the numbers to be reported in kilobyte counts.
-.El
-.Sh STATISTICS
-Statistics are reported for all swap partitions configured into the kernel.
-The first column is the device name of the partition. The next column is
-the total space available in the partition. The
-.Ar Used
-column indicates the total blocks used so far; the
-.Ar Available
-column indicates how much space is remaining on each partition.
-The
-.Ar Capacity
-reports the percentage of space used.
-.Pp
-If more than one partition is configured into the system, totals for all
-of the statistics will be reported in the final line of the report.
-.Sh "BUGS AND CAVEATS"
-The information reported by
-.Nm swapinfo
-is stored in the kernel in a linked list. Since we are merely reading
-this list out of kernel memory, it is entirely possible that the list could
-change as we try to read it. Suspicious and unrepeatable values are probably
-incorrect.
-.Pp
-Statistics are reported for all swap partitions compiled into the kernel,
-regardless of whether those partitions are being used.
-.Sh AUTHOR
-.RS
-Kevin Lahey
-.br
-kml@rokkaku.atl.ga.us
diff --git a/usr.sbin/swapinfo/swapinfo.c b/usr.sbin/swapinfo/swapinfo.c
deleted file mode 100644
index 811a936..0000000
--- a/usr.sbin/swapinfo/swapinfo.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * swapinfo
- *
- * Swapinfo will provide some information about the state of the swap
- * space for the system. It'll determine the number of swap areas,
- * their original size, and their utilization.
- *
- * Kevin Lahey, February 16, 1993
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/conf.h>
-#include <sys/rlist.h>
-#include <nlist.h>
-#include <kvm.h>
-#include <limits.h>
-
-struct rlist *swaplist;
-
-static struct nlist nl[] = {{"_swaplist"}, /* list of free swap areas */
-#define VM_SWAPMAP 0
- {"_swdevt"}, /* list of swap devices and sizes */
-#define VM_SWDEVT 1
- {"_nswap"}, /* size of largest swap device */
-#define VM_NSWAP 2
- {"_nswdev"}, /* number of swap devices */
-#define VM_NSWDEV 3
- {"_dmmax"}, /* maximum size of a swap block */
-#define VM_DMMAX 4
- {""}};
-
-char *getbsize __P((int *, long *));
-void usage __P((void));
-
-main (argc, argv)
-int argc;
-char **argv;
-{
- int i, total_avail, total_free, total_partitions, *by_device,
- nswap, nswdev, dmmax, ch;
- struct swdevt *swdevt;
- struct rlist head;
- static long blocksize;
- static int headerlen;
- static char *header;
- kvm_t *kd;
- char errbuf[_POSIX2_LINE_MAX];
-
- /* We are trying to be simple here: */
-
- while ((ch = getopt(argc, argv, "k")) != EOF)
- switch(ch) {
- case 'k':
- putenv("BLOCKSIZE=1k");
- break;
- case '?':
- default:
- usage();
- }
-
- /* Open up /dev/kmem for reading. */
-
- kd = kvm_openfiles((char *)NULL, (char *)NULL, (char *)NULL, 0, errbuf);
- if (kd == NULL) {
- fprintf (stderr, "%s: kvm_openfiles: %s\n",
- argv [0], errbuf);
- exit (1);
- }
-
- /* Figure out the offset of the various structures we'll need. */
-
- if (kvm_nlist(kd, nl) == -1) {
- fprintf (stderr, "%s: kvm_nlist: %s\n",
- argv [0], kvm_geterr(kd));
- exit (1);
- }
-
- if (kvm_read(kd, nl[VM_NSWAP].n_value, &nswap, sizeof (nswap)) !=
- sizeof (nswap)) {
- fprintf (stderr, "%s: didn't read all of nswap\n",
- argv [0]);
- exit (5);
- }
-
- if (kvm_read(kd, nl[VM_NSWDEV].n_value, &nswdev, sizeof (nswdev)) !=
- sizeof (nswdev)) {
- fprintf (stderr, "%s: didn't read all of nswdev\n",
- argv [0]);
- exit (5);
- }
-
- if (kvm_read(kd, nl[VM_DMMAX].n_value, &dmmax, sizeof (dmmax)) !=
- sizeof (dmmax)) {
- fprintf (stderr, "%s: didn't read all of dmmax\n",
- argv [0]);
- exit (5);
- }
-
- if ((swdevt = malloc (sizeof (struct swdevt) * nswdev)) == NULL ||
- (by_device = calloc (sizeof (*by_device), nswdev)) == NULL) {
- perror ("malloc");
- exit (5);
- }
-
- if (kvm_read(kd, nl[VM_SWDEVT].n_value, swdevt,
- sizeof (struct swdevt) * nswdev) !=
- sizeof (struct swdevt) * nswdev) {
- fprintf (stderr, "%s: didn't read all of swdevt\n",
- argv [0]);
- exit (5);
- }
-
- if (kvm_read(kd, nl[0].n_value, &swaplist, sizeof (struct rlist *)) !=
- sizeof (struct rlist *)) {
- fprintf (stderr, "%s: didn't read all of swaplist\n",
- argv [0]);
- exit (5);
- }
-
- /* Traverse the list of free swap space... */
-
- total_free = 0;
- while (swaplist) {
- int top, bottom, next_block;
-
- if (kvm_read(kd, (long) swaplist, &head, sizeof (struct rlist )) !=
- sizeof (struct rlist )) {
- fprintf (stderr, "%s: didn't read all of head\n",
- argv [0]);
- exit (5);
- }
-
- top = head.rl_end;
- bottom = head.rl_start;
-
- total_free += top - bottom + 1;
-
- /*
- * Swap space is split up among the configured disk.
- * The first dmmax blocks of swap space some from the
- * first disk, the next dmmax blocks from the next,
- * and so on. The list of free space joins adjacent
- * free blocks, ignoring device boundries. If we want
- * to keep track of this information per device, we'll
- * just have to extract it ourselves.
- */
-
- while (top / dmmax != bottom / dmmax) {
- next_block = ((bottom + dmmax) / dmmax);
- by_device [(bottom / dmmax) % nswdev] +=
- next_block * dmmax - bottom;
- bottom = next_block * dmmax;
- }
-
- by_device [(bottom / dmmax) % nswdev] +=
- top - bottom + 1;
-
- swaplist = head.rl_next;
- }
-
- header = getbsize(&headerlen, &blocksize);
- printf ("%-10s %10s %10s %10s %10s\n",
- "Device", header, "Used", "Available", "Capacity");
- for (total_avail = total_partitions = i = 0; i < nswdev; i++) {
- printf ("/dev/%-5s %10d ",
- devname (swdevt [i].sw_dev, S_IFBLK),
- swdevt [i].sw_nblks / (blocksize/512));
-
- /*
- * Don't report statistics for partitions which have not
- * yet been activated via swapon(8).
- */
-
- if (!swdevt [i].sw_freed) {
- printf (" *** not available for swapping ***\n");
- } else {
- total_partitions++;
- total_avail += swdevt [i].sw_nblks;
- printf ("%10d %10d %7.0f%%\n",
- (swdevt [i].sw_nblks - by_device [i]) / (blocksize/512),
- by_device [i] / (blocksize/512),
- (double) (swdevt [i].sw_nblks -
- by_device [i]) /
- (double) swdevt [i].sw_nblks * 100.0);
- }
- }
-
- /*
- * If only one partition has been set up via swapon(8), we don't
- * need to bother with totals.
- */
-
- if (total_partitions > 1)
- printf ("%-10s %10d %10d %10d %7.0f%%\n", "Total",
- total_avail / (blocksize/512),
- (total_avail - total_free) / (blocksize/512),
- total_free / (blocksize/512),
- (double) (total_avail - total_free) /
- (double) total_avail * 100.0);
-
- exit (0);
-}
-
-void
-usage()
-{
- (void)fprintf(stderr, "usage: swapinfo [-k]\n");
- exit(1);
-}
-
-
diff --git a/usr.sbin/tcpdump/tcpdump/tcplex.l b/usr.sbin/tcpdump/tcpdump/tcplex.l
deleted file mode 100644
index 3db8a32..0000000
--- a/usr.sbin/tcpdump/tcpdump/tcplex.l
+++ /dev/null
@@ -1,144 +0,0 @@
-%{
-/*
- * Copyright (c) 1988-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: (1) source code distributions
- * retain the above copyright notice and this paragraph in its entirety, (2)
- * distributions including binary code include the above copyright notice and
- * this paragraph in its entirety in the documentation or other materials
- * provided with the distribution, and (3) all advertising materials mentioning
- * features or use of this software display the following acknowledgement:
- * ``This product includes software developed by the University of California,
- * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
- * the University nor the names of its contributors may be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#ifndef lint
-static char rcsid[] =
- "@(#) $Header: /home/ncvs/src/usr.sbin/tcpdump/tcpdump/tcplex.l,v 1.1.1.1 1993/06/12 14:42:05 rgrimes Exp $ (LBL)";
-#endif
-
-/*
- * Compiling with gcc under SunOS will cause problems unless we have this
- * cruft here. The flex skeleton includes stddef.h which defines these types
- * (under gcc). They will conflict with Sun's definitions in sys/types.h.
- */
-#define size_t xxxsize_t
-#define ptrdiff_t xxxptrdiff_t
-#define wchar_t xxxwchar_t
-#include <sys/types.h>
-#undef size_t
-#undef ptrdiff_t
-#undef wchar_t
-
-#include "nametoaddr.h"
-
-/*
- * We need bpf since enum bpf_code is in YYSTYPE.
- */
-#include <sys/time.h>
-#include <net/bpf.h>
-
-#include "gencode.h"
-#include "y.tab.h" /* "tokdefs.h" */
-
-#ifdef FLEX_SCANNER
-#undef YY_INPUT
-#define YY_INPUT(buf, result, max)\
- {\
- char *src = in_buffer;\
- int i;\
-\
- if (*src == 0)\
- result = YY_NULL;\
- else {\
- for (i = 0; *src && i < max; ++i)\
- buf[i] = *src++;\
- in_buffer += i;\
- result = i;\
- }\
- }
-#else
-#undef getc
-#define getc(fp) (*in_buffer == 0 ? EOF : *in_buffer++)
-#endif
-
-extern YYSTYPE yylval;
-static char *in_buffer;
-
-%}
-
-N ([0-9]+|(0X|0x)[0-9A-Fa-f]+)
-B ([0-9A-Fa-f][0-9A-Fa-f]?)
-
-%a 3000
-
-%%
-dst return DST;
-src return SRC;
-
-link|ether|ppp|slip return LINK;
-arp return ARP;
-rarp return RARP;
-ip return IP;
-tcp return TCP;
-udp return UDP;
-icmp return ICMP;
-
-host return HOST;
-net return NET;
-port return PORT;
-proto return PROTO;
-
-gateway return GATEWAY;
-
-less return LESS;
-greater return GREATER;
-byte return BYTE;
-broadcast return TK_BROADCAST;
-multicast return TK_MULTICAST;
-
-and return AND;
-or return OR;
-not return '!';
-
-len return LEN;
-
-[ \n\t] ;
-[+\-*/:\[\]!<>()&|=] return yytext[0];
-">=" return GEQ;
-"<=" return LEQ;
-"!=" return NEQ;
-"==" return '=';
-"<<" return LSH;
-">>" return RSH;
-{N} { yylval.i = stoi(yytext); return NUM; }
-({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) {
- yylval.h = atoin(yytext); return HID;
-}
-{B}:{B}:{B}:{B}:{B}:{B} { yylval.e = ETHER_aton(yytext); return EID; }
-{B}:+({B}:+)+ { error("bogus ethernet address %s", yytext); }
-[A-Za-z][-_.A-Za-z0-9]* { yylval.s = yytext; return ID; }
-"\\"[^ !()\n\t]+ { yylval.s = yytext + 1; return ID; }
-[^ \[\]\t\n\-_.A-Za-z0-9!<>()&|=]+ { error("illegal token: %s\n", yytext); }
-. { error("illegal char '%c'", *yytext); }
-%%
-void
-lex_init(buf)
- char *buf;
-{
- in_buffer = buf;
-}
-int
-yywrap()
-/* so we don't need -ll */
-{
- return 1;
-}
diff --git a/usr.sbin/tzsetup/tzsetup.sh b/usr.sbin/tzsetup/tzsetup.sh
deleted file mode 100644
index f3d9431..0000000
--- a/usr.sbin/tzsetup/tzsetup.sh
+++ /dev/null
@@ -1,181 +0,0 @@
-#!/bin/sh
-# $Id: tzsetup.sh,v 1.3 1994/11/02 00:00:17 ache Exp $
-#
-# Copyright 1994, Garrett A. Wollman. All rights reserved.
-# This script is subject to the terms and conditions listed at the
-# end.
-#
-
-ask() {
- while true; do
- echo -n "$1" "(${2-no default}) "
- read ans
- if [ -z "$ans" ]; then
- ans="$2"
- fi
- if [ -z "$ans" ]; then
- echo 'An empty response is not valid.'
- continue
- fi
- return 0
- done
-}
-
-askyn() {
- while : ; do
- ask "$1 [yn]?" $2
- case $ans in
- [Yy]*) return 0;;
- [Nn]*) return 1;;
- esac
- done
-}
-
-select() {
- where=$1
- while true; do
- echo "Please select a location from the following list which"
- echo "has the same legal time as your location:"
- echo ""
- ls -C /usr/share/zoneinfo/$where
- echo ""
- echo "Type \`\`exit'' to return to the main menu."
- ask "Your choice:" exit
- if [ "$ans" = "exit" ]; then return 0; fi
- city="$ans"
- if [ -r /usr/share/zoneinfo/$where/$city ]; then
- echo -n "I think the time in `echo $city | tr _ ' '` is: "
- TZ=$where/$city date
- if askyn "Is this what you wanted" y; then
- rm -f /etc/localtime
- cp /usr/share/zoneinfo/$where/$city \
- /etc/localtime && echo "Timezone changed."
- return 0
- fi
- fi
- done
-}
-
-setadjkerntz() {
- cat << EOF
-
-You can configure your system to assume that the battery-backed CMOS
-clock is set to your local legal time rather than Universal or
-Greenwich time. When the system boots, the \`adjkerntz' program will
-examine your current time, reverse-apply the timezone correction, and
-then set the system's UTC time to the corrected value. This approach
-is NOT guaranteed to always work; in particular, if you reboot your
-system during the transition from or to summer time, the calculation
-is sometimes impossible, and wierd things may result.
-
-For this reason, we recommend that, unless you absolutely positively
-must leave your CMOS clock on local time, you set your CMOS clock to GMT.
-
-EOF
- if [ -f /etc/wall_cmos_clock ]; then
- curr=y
- echo "This system is currently set up for local CMOS time."
- else
- curr=n
- echo "This system is currently set up for GMT CMOS time."
- fi
- if askyn "Do you want a local CMOS clock" $curr; then
- touch /etc/wall_cmos_clock
- if [ $curr = "n" ] && askyn "Start now" y; then
- /sbin/adjkerntz -i
- fi
- else
- rm -f /etc/wall_cmos_clock
- fi
- echo "Done."
-}
-
-mainmenu() {
- set `TZ= date`
- if askyn "Is $4, $1 $2 $3 $6 the correct current date and time" n; then
- cat << EOF
-
-Unless your local time is GMT, this probably means that your CMOS
-clock is on local time. In this case, the local times that you will
-be shown will be incorrect. You should either set your CMOS clock to
-GMT, or select option 98 from the main menu after selecting a
-timezone.
-
-EOF
- echo -n "Press return to continue ==>"
- read junk
- fi
-
- while true; do
- cat <<EOH
-
-
- Pick the item that best describes your location:
-
- 1) Africa
- 2) North, South, Central America (includes Greenland)
- 3) Atlantic Ocean islands
- 4) Asia and the Middle East
- 5) Australia
- 6) Europe
- 7) Indian Ocean islands
- 8) Pacific islands (includes Hawaii)
-
- 98) Select CMOS time status (UTC or local)
- 99) Exit this menu
-
-EOH
- ask 'Your choice?' 99
- case $ans in
- 1) select Africa;;
- 2) select America;;
- 3) select Atlantic;;
- 4) select Asia;;
- 5) select Australia;;
- 6) select Europe;;
- 7) select Indian;;
- 8) select Pacific;;
- 9) select Etc;;
- 10) select SystemV;;
- 98) setadjkerntz;;
- 99) return 0;;
- esac
- done
-}
-
-cat <<EOH
-Welcome to `sysctl -n kern.ostype` `sysctl -n kern.osrelease`!
-
-This program will help you select a default timezone for your users and
-for system processes.
-
-EOH
-echo -n 'Press return to continue ==>'
-read return
-
-mainmenu
-exit 0
-#
-# Copyright (c) 1994 Garrett A. Wollman. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
diff --git a/usr.sbin/xntpd/xntpres/Makefile b/usr.sbin/xntpd/xntpres/Makefile
deleted file mode 100644
index fc41047..0000000
--- a/usr.sbin/xntpd/xntpres/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# $Id: Makefile,v 1.1 1993/12/21 20:38:27 wollman Exp $
-#
-
-CFLAGS+= -I${.CURDIR}/../include
-
-.if exists(${.CURDIR}/../lib/obj)
-LDADD+= -L${.CURDIR}/../lib/obj
-DPADD+= -L${.CURDIR}/../lib/obj/libntp.a
-.else
-LDADD+= -L${.CURDIR}/../lib
-DPADD+= -L${.CURDIR}/../lib/libntp.a
-.endif
-
-LDADD+= -lntp
-
-PROG= xntpres
-NOMAN=
-CLEANFILES+= .version version.c
-
-SRCS= xntpres.c version.c
-
-beforedepend: version.c
-
-version.c: ${.CURDIR}/../VERSION
- ${.CURDIR}/../scripts/mkversion xntpres
-
-.include <bsd.prog.mk>
OpenPOWER on IntegriCloud